diff --git a/Makefile b/Makefile index 79ed8f16003b..80ee5303d338 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,7 @@ MAKER_CODE := 01 REVISION := 0 MODERN ?= 0 TEST ?= 0 +ANALYZE ?= 0 ifeq (modern,$(MAKECMDGOALS)) MODERN := 1 @@ -118,7 +119,10 @@ LIBPATH := -L ../../tools/agbcc/lib LIB := $(LIBPATH) -lgcc -lc -L../../libagbsyscall -lagbsyscall else CC1 = $(shell $(PATH_MODERNCC) --print-prog-name=cc1) -quiet -override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast +override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast -std=gnu17 +ifeq ($(ANALYZE),1) +override CFLAGS += -fanalyzer +endif ROM := $(MODERN_ROM_NAME) OBJ_DIR := $(MODERN_OBJ_DIR_NAME) LIBPATH := -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libnosys.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libc.a))" diff --git a/asm/macros/battle_frontier/frontier_util.inc b/asm/macros/battle_frontier/frontier_util.inc index c875fcdde2d8..e40eccb5e7e1 100644 --- a/asm/macros/battle_frontier/frontier_util.inc +++ b/asm/macros/battle_frontier/frontier_util.inc @@ -1,4 +1,4 @@ - @ Get the status (CHALLENGE_STATUS_*) of the current challenge and store the result in VAR_TEMP_0 + @ Get the status (CHALLENGE_STATUS_*) of the current challenge and store the result in VAR_TEMP_CHALLENGE_STATUS .macro frontier_getstatus setvar VAR_0x8004, FRONTIER_UTIL_FUNC_GET_STATUS special CallFrontierUtilFunc diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 1fd843e4b072..866831c46246 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1187,11 +1187,11 @@ .byte 0xe5 .endm - .macro doweatherformchangeanimation + .macro unused3 .byte 0xe6 .endm - .macro tryweatherformdatachange + .macro unused4 .byte 0xe7 .endm @@ -1311,7 +1311,7 @@ callnative BS_CalcMetalBurstDmg .4byte \failInstr .endm - + .macro jumpifcantfling battler:req, jumpInstr:req callnative BS_JumpIfCantFling .byte \battler @@ -1361,6 +1361,11 @@ callnative BS_SetSnow .endm + .macro applysaltcure battler:req + callnative BS_ApplySaltCure + .byte \battler + .endm + .macro setzeffect callnative BS_SetZEffect .endm @@ -1382,6 +1387,57 @@ .4byte \ptr .endm + .macro jumpifcantloseitem battler:req, ptr:req + callnative BS_JumpIfCantLoseItem + .byte \battler + .4byte \ptr + .endm + + .macro handlemegaevo battler:req, case:req + callnative BS_HandleMegaEvolution + .byte \battler + .byte \case + .endm + + .macro handleprimalreversion battler:req, case:req + callnative BS_HandlePrimalReversion + .byte \battler + .byte \case + .endm + + .macro handleultraburst battler:req, case:req + callnative BS_HandleUltraBurst + .byte \battler + .byte \case + .endm + + .macro jumpifshelltrap battler:req, jumpInstr:req + callnative BS_JumpIfShellTrap + .byte \battler + .4byte \jumpInstr + .endm + + .macro jumpifemergencyexited battler:req, jumpInstr:req + callnative BS_JumpIfEmergencyExited + .byte \battler + .4byte \jumpInstr + .endm + + .macro jumpifrodaffected battler:req, jumpInstr:req + callnative BS_JumpIfRod + .4byte \jumpInstr + .endm + + .macro jumpifabsorbaffected battler:req, jumpInstr:req + callnative BS_JumpIfAbsorb + .4byte \jumpInstr + .endm + + .macro jumpifmotoraffected battler:req, jumpInstr:req + callnative BS_JumpIfMotor + .4byte \jumpInstr + .endm + .macro jumpifargument argument:req, jumpInstr:req callnative BS_JumpIfArgument .byte \argument @@ -1640,16 +1696,6 @@ .4byte \failInstr .endm - .macro handlemegaevo battler:req, case:req - various \battler, VARIOUS_HANDLE_MEGA_EVO - .byte \case - .endm - - .macro handleprimalreversion battler:req, case:req - various \battler, VARIOUS_HANDLE_PRIMAL_REVERSION - .byte \case - .endm - .macro handleformchange battler:req, case:req various \battler, VARIOUS_HANDLE_FORM_CHANGE .byte \case @@ -2016,21 +2062,6 @@ various BS_ATTACKER, VARIOUS_SHELL_SIDE_ARM_CHECK .endm - .macro jumpifrodaffected battler:req, jumpInstr:req - various \battler, VARIOUS_JUMP_IF_ROD - .4byte \jumpInstr - .endm - - .macro jumpifabsorbaffected battler:req, jumpInstr:req - various \battler, VARIOUS_JUMP_IF_ABSORB - .4byte \jumpInstr - .endm - - .macro jumpifmotoraffected battler:req, jumpInstr:req - various \battler, VARIOUS_JUMP_IF_MOTOR - .4byte \jumpInstr - .endm - .macro jumpifteanoberry jumpInstr:req various BS_ATTACKER, VARIOUS_TEATIME_TARGETS .4byte \jumpInstr @@ -2295,16 +2326,6 @@ waitmessage B_WAIT_TIME_LONG .endm - .macro jumpifemergencyexited battler:req, jumpInstr:req - various \battler, VARIOUS_JUMP_IF_EMERGENCY_EXITED - .4byte \jumpInstr - .endm - - .macro jumpifshelltrap battler:req, ptr:req - various \battler, VARIOUS_JUMP_IF_SHELL_TRAP - .4byte \ptr - .endm - .macro hitswitchtargetfailed various 0, VARIOUS_HIT_SWITCH_TARGET_FAILED .endm @@ -2313,3 +2334,9 @@ various 0, VARIOUS_TRY_REVIVAL_BLESSING .4byte \jumpInstr .endm + + @ Will jump to script pointer if the specified battler has or has not fainted. + .macro jumpiffainted battler:req, value:req, ptr:req + getbattlerfainted \battler + jumpifbyte CMP_EQUAL, gBattleCommunication, \value, \ptr + .endm diff --git a/asm/macros/event.inc b/asm/macros/event.inc index 78d3037aeb6f..d2d8f8ca6fa4 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -2018,3 +2018,10 @@ setvar VAR_0x8002, \tryMultiple special TrySpecialOverworldEvo .endm + + .macro ai_vs_ai_battle trainer1:req, trainer2:req + setflag B_FLAG_AI_VS_AI_BATTLE + setvar VAR_0x8004, \trainer1 + callnative CreateTrainerPartyForPlayer + trainerbattle_no_intro \trainer2, NULL + .endm diff --git a/charmap.txt b/charmap.txt index 220ff2ed5535..21989771158b 100644 --- a/charmap.txt +++ b/charmap.txt @@ -367,7 +367,7 @@ B_ATK_PARTNER_NAME = FD 0E B_ATK_NAME_WITH_PREFIX = FD 0F B_DEF_NAME_WITH_PREFIX = FD 10 B_EFF_NAME_WITH_PREFIX = FD 11 @ EFF = short for gEffectBattler -B_ACTIVE_NAME_WITH_PREFIX = FD 12 +@ FD 12 - preiously gActiveBattler with prefix B_SCR_ACTIVE_NAME_WITH_PREFIX = FD 13 B_CURRENT_MOVE = FD 14 B_LAST_MOVE = FD 15 @@ -409,8 +409,8 @@ B_ATK_TEAM2 = FD 38 B_DEF_NAME = FD 39 B_DEF_TEAM1 = FD 3A B_DEF_TEAM2 = FD 3B -B_ACTIVE_NAME = FD 3C -B_ACTIVE_NAME2 = FD 3D @ no Illusion check +@ FD 3C - preiously gActiveBattler +@ FD 3D - preiously gActiveBattler without Illusion Check @ indicates the end of a town/city name (before " TOWN" or " CITY") NAME_END = FC 00 diff --git a/common_syms/battle_controllers.txt b/common_syms/battle_controllers.txt new file mode 100644 index 000000000000..0b3c25266a1c --- /dev/null +++ b/common_syms/battle_controllers.txt @@ -0,0 +1,3 @@ +gBattlerControllerFuncs +gBattleControllerData +gBattlerControllerEndFuncs diff --git a/common_syms/battle_main.txt b/common_syms/battle_main.txt index f6f02c48d32c..7a9faa5a13e2 100644 --- a/common_syms/battle_main.txt +++ b/common_syms/battle_main.txt @@ -2,8 +2,6 @@ gPreBattleCallback1 gBattleMainFunc gBattleResults gLeveledUpInBattle -gBattlerControllerFuncs gHealthboxSpriteIds gMultiUsePlayerCursor gNumberOfMovesToChoose -gBattleControllerData diff --git a/constants/constants.inc b/constants/constants.inc index e7561f429342..1f8f1cda2e22 100644 --- a/constants/constants.inc +++ b/constants/constants.inc @@ -1,2 +1,3 @@ .include "constants/gba_constants.inc" .include "constants/global.inc" + .include "constants/tms_hms.inc" diff --git a/constants/gba_constants.inc b/constants/gba_constants.inc index 3ff857ee8dfb..9f51b0f02b02 100644 --- a/constants/gba_constants.inc +++ b/constants/gba_constants.inc @@ -1,3 +1,6 @@ +#ifndef GUARD_CONSTANTS_GBA_CONSTANTS_INC +#define GUARD_CONSTANTS_GBA_CONSTANTS_INC + .set PSR_USR_MODE, 0x00000010 .set PSR_FIQ_MODE, 0x00000011 .set PSR_IRQ_MODE, 0x00000012 @@ -511,3 +514,5 @@ .set BLDCNT_TGT2_OBJ, 1 << 12 .set BLDCNT_TGT2_BD, 1 << 13 .set BLDCNT_TGT2_ALL, BLDCNT_TGT2_BG0 | BLDCNT_TGT2_BG1 | BLDCNT_TGT2_BG2 | BLDCNT_TGT2_BG3 | BLDCNT_TGT2_OBJ | BLDCNT_TGT2_BD + +#endif @ GUARD_CONSTANTS_GBA_CONSTANTS_INC diff --git a/constants/global.inc b/constants/global.inc index 621ba2af89d2..b9462fa26b62 100644 --- a/constants/global.inc +++ b/constants/global.inc @@ -1,3 +1,6 @@ +#ifndef GUARD_CONSTANTS_GLOBAL_INC +#define GUARD_CONSTANTS_GLOBAL_INC + .set TRUE, 1 .set FALSE, 0 @@ -20,3 +23,5 @@ .set OBJ_IMAGE_ANIM_H_FLIP, 1 << 6 .set OBJ_IMAGE_ANIM_V_FLIP, 1 << 7 + +#endif @ GUARD_CONSTANTS_GLOBAL_INC diff --git a/constants/m4a_constants.inc b/constants/m4a_constants.inc index 1a744dc7fb6a..2599b6c4aa0f 100644 --- a/constants/m4a_constants.inc +++ b/constants/m4a_constants.inc @@ -1,3 +1,6 @@ +#ifndef GUARD_CONSTANTS_M4A_CONSTANTS_INC +#define GUARD_CONSTANTS_M4A_CONSTANTS_INC + .equiv ID_NUMBER, 0x68736d53 .equiv PCM_DMA_BUF_SIZE, 1584 @@ -250,3 +253,5 @@ struct_field o_CgbChannel_nextChannelPointer, 4 struct_field o_CgbChannel_dummy4, 8 struct_field CgbChannel_size, 0 + +#endif @ GUARD_CONSTANTS_M4A_CONSTANTS_INC diff --git a/constants/tms_hms.inc b/constants/tms_hms.inc new file mode 100644 index 000000000000..4ce6d903285c --- /dev/null +++ b/constants/tms_hms.inc @@ -0,0 +1,22 @@ +#ifndef GUARD_CONSTANTS_TMS_HMS_INC +#define GUARD_CONSTANTS_TMS_HMS_INC + +#include "constants/tms_hms.h" + +/* Expands to: +* enum_start ITEM_TM01 +* enum ITEM_TM_FOCUS_PUNCH +* ... +* enum_start ITEM_HM01 +* enum ITEM_HM_CUT +* ... */ +#define EQUIV_TM(id) enum ITEM_TM_ ## id; +#define EQUIV_HM(id) enum ITEM_HM_ ## id; + enum_start ITEM_TM01 +FOREACH_TM(EQUIV_TM) + enum_start ITEM_HM01 +FOREACH_HM(EQUIV_HM) +#undef EQUIV_TM +#undef EQUIV_HM + +#endif @ GUARD_CONSTANTS_TMS_HMS_INC diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index df556c6f1a20..0b72e1cf9861 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -910,7 +910,6 @@ gBattleAnims_StatusConditions:: .align 2 gBattleAnims_General:: - .4byte General_WeatherFormChange @ B_ANIM_CASTFORM_CHANGE .4byte General_StatsChange @ B_ANIM_STATS_CHANGE .4byte General_SubstituteFade @ B_ANIM_SUBSTITUTE_FADE .4byte General_SubstituteAppear @ B_ANIM_SUBSTITUTE_APPEAR @@ -948,6 +947,8 @@ gBattleAnims_General:: .4byte General_ZMoveActivate @ B_ANIM_ZMOVE_ACTIVATE .4byte General_AffectionHangedOn @ B_ANIM_AFFECTION_HANGED_ON .4byte General_Snow @ B_ANIM_SNOW_CONTINUES + .4byte General_UltraBurst @ B_ANIM_ULTRA_BURST + .4byte General_SaltCureDamage @ B_ANIM_SALT_CURE_DAMAGE .align 2 gBattleAnims_Special:: @@ -1018,7 +1019,7 @@ Move_MIRACLE_EYE: createsprite gWhiteHaloSpriteTemplate, ANIM_ATTACKER, 5 delay 40 playsewithpan SE_M_LEER, SOUND_PAN_TARGET - createvisualtask AnimTask_BlendColorCycle, 2, 1, 1, 2, 0, 10, RGB_BLACK + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG, 1, 2, 0, 10, RGB_BLACK call MindReaderEyeSpikeEffect waitforvisualfinish call UnsetPsychicBg @@ -1085,13 +1086,13 @@ Move_GYRO_BALL: createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 4, -10, 0, 1, 0 createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 1, -32, 0, 0, 3 waitforvisualfinish - createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, 0, 0 - createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, 1, 0 + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, ANIM_ATTACKER, 0 + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, ANIM_TARGET, 0 createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_ATTACKER, 4, 0, 12, 1 createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 4, 0, 12, 1 waitforvisualfinish - createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, 0, 1 - createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, 1, 1 + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, ANIM_ATTACKER, 1 + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, ANIM_TARGET, 1 waitforvisualfinish createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 5 delay 3 @@ -1138,7 +1139,7 @@ Move_NATURAL_GIFT: loadspritegfx ANIM_TAG_HOLLOW_ORB monbg ANIM_ATTACKER splitbgprio ANIM_ATTACKER - createvisualtask AnimTask_BlendColorCycle, 2, 2, 2, 2, 0, 16, RGB(27, 31, 18) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 16, RGB(27, 31, 18) playsewithpan SE_M_MEGA_KICK, -64 call GrantingStarsEffect waitforvisualfinish @@ -1614,7 +1615,7 @@ Move_COPYCAT: loadspritegfx ANIM_TAG_GRAY_ORB loadspritegfx ANIM_TAG_THIN_RING playsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendColorCycle, 2, 2, 8, 1, 0, 12, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 8, 1, 0, 12, RGB_WHITE createvisualtask AnimTask_StockpileDeformMon, 5 call StockpileAbsorb call StockpileAbsorb @@ -1733,7 +1734,7 @@ Move_PUNISHMENT: setalpha 12, 8 playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET createsprite gPunishmentImpactSpriteTemplate 2, 4, 0, 0, 1, 2 - createvisualtask AnimTask_ShakeMon 2, ANIM_TARGET, 3, 0, 6, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 waitforvisualfinish clearmonbg ANIM_TARGET blendoff @@ -1746,14 +1747,14 @@ Move_LAST_RESORT: waitbgfadein loadspritegfx ANIM_TAG_IMPACT playsewithpan SE_M_SWIFT, SOUND_PAN_ATTACKER - createsprite gComplexPaletteBlendSpriteTemplate, 2, 7, 2, 4, 2, RGB(31, 31, 31), 10, 0, 0 + createsprite gComplexPaletteBlendSpriteTemplate, 2, 7, 2, 4, 2, RGB_WHITE, 10, 0, 0 waitforvisualfinish delay 10 playsewithpan SE_M_SWAGGER, SOUND_PAN_ATTACKER waitplaysewithpan SE_M_SWAGGER, SOUND_PAN_ATTACKER, 8 - createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, 0, 18, 6, 2, 4 + createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 18, 6, 2, 4 waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, 2, 5, 1, 0, 16, 16, RGB(31, 31, 31) + createsprite gSimplePaletteBlendSpriteTemplate, 2, 5, 1, 0, 16, 16, RGB_WHITE createsprite gSlideMonToOffsetSpriteTemplate, 2, 5, 0, 20, 0, 0, 4 delay 3 waitforvisualfinish @@ -1761,14 +1762,14 @@ Move_LAST_RESORT: createsprite gBasicHitSplatSpriteTemplate, 132, 4, -10, 0, 1, 0 createsprite gSlideMonToOffsetSpriteTemplate, 2, 5, 1, -32, 0, 0, 3 waitforvisualfinish - createvisualtask AnimTask_RotateMonSpriteToSide, 2, 4, 8, -256, 0, 0 - createvisualtask AnimTask_RotateMonSpriteToSide, 2, 4, 8, -256, 1, 0 - createvisualtask AnimTask_ShakeMonInPlace, 2, 5, 0, 4, 0, 12, 1 - createvisualtask AnimTask_ShakeMonInPlace, 2, 5, 1, 4, 0, 12, 1 - createsprite gSimplePaletteBlendSpriteTemplate, 2, 5, 1, 2, 16, 0, RGB(31, 31, 31) + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 4, 8, -256, ANIM_ATTACKER, 0 + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 4, 8, -256, ANIM_TARGET, 0 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_PLAYER_RIGHT, 0, 4, 0, 12, 1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_PLAYER_RIGHT, 1, 4, 0, 12, 1 + createsprite gSimplePaletteBlendSpriteTemplate, 2, 5, 1, 2, 16, 0, RGB_WHITE waitforvisualfinish - createvisualtask AnimTask_RotateMonSpriteToSide, 2, 4, 8, -256, 0, 1 - createvisualtask AnimTask_RotateMonSpriteToSide, 2, 4, 8, -256, 1, 1 + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 4, 8, -256, ANIM_ATTACKER, 1 + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 4, 8, -256, ANIM_TARGET, 1 waitforvisualfinish createsprite gSlideMonToOriginalPosSpriteTemplate, 2, 3, 0, 0, 5 delay 3 @@ -1798,7 +1799,7 @@ Move_SUCKER_PUNCH: createsprite gSuckerPunchSpriteTemplate, 130, 6, -18, 5, 40, 8, 160, 0 delay 4 createsprite gBasicHitSplatSpriteTemplate, 130, 4, -8, 8, 1, 2 - createvisualtask AnimTask_RotateMonSpriteToSide, 2, 4, 6, 384, 1, 2 + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 4, 6, 384, ANIM_TARGET, 2 playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET waitforvisualfinish createsprite gSlideMonToOriginalPosSpriteTemplate, 2, 3, 0, 1, 4 @@ -1870,7 +1871,7 @@ General_AquaRingHeal: createsprite gGuardRingSpriteTemplate, 2, 0 waitforvisualfinish playsewithpan SE_SHINY, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendColorCycle, 2, 10, 0, 2, 10, RGB(31, 31, 31) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATK_SIDE, 0, 2, 10, RGB_WHITE waitforvisualfinish clearmonbg ANIM_ATK_PARTNER blendoff @@ -1880,7 +1881,7 @@ Move_MAGNET_RISE: loadspritegfx ANIM_TAG_IMPACT loadspritegfx ANIM_TAG_SPARK_2 delay 0 - createvisualtask AnimTask_BlendColorCycle 2, 31, -31, 1, 5, 5, RGB(31, 31, 20) + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_BATTLERS), -31, 1, 5, 5, RGB(31, 31, 20) playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER createvisualtask AnimTask_WindUpLunge, 5, ANIM_ATTACKER, -12, 4, 10, 10, 12, 6 createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 32, 24, 190, 12, ANIM_ATTACKER, 1, 0 @@ -1905,11 +1906,11 @@ Move_MAGNET_RISE: delay 0 createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 238, 24, 165, 10, ANIM_ATTACKER, 1, 1 delay 0 - createvisualtask AnimTask_BlendColorCycle, 2, 31, -31, 1, 0, 0, RGB(31, 31, 20) + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_BATTLERS), -31, 1, 0, 0, RGB(31, 31, 20) delay 20 - createvisualtask AnimTask_BlendColorCycle, 2, 31, -31, 1, 7, 7, RGB(31, 31, 20) + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_BATTLERS), -31, 1, 7, 7, RGB(31, 31, 20) waitforvisualfinish - createvisualtask AnimTask_BlendColorCycle, 2, 31, -31, 1, 0, 0, RGB(31, 31, 20) + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_BATTLERS), -31, 1, 0, 0, RGB(31, 31, 20) waitforvisualfinish end @@ -2122,7 +2123,7 @@ Move_POISON_JAB: createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, -4, -6, 1, 3 playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET createsprite gPoisonJabProjectileSpriteTemplate, ANIM_TARGET, 2, 2, 31, 10 - createvisualtask AnimTask_SwayMon, 5, 0, 3, 0x2000, 6, ANIM_TARGET + createvisualtask AnimTask_SwayMon, 5, 0, 3, 8192, 6, ANIM_TARGET createvisualtask AnimTask_BlendMonInAndOut, 5, ANIM_TARGET, RGB(16, 0, 16), 12, 0, 1 delay 2 createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 6, 4, 1, 3 @@ -2241,13 +2242,13 @@ Move_AQUA_TAIL: playsewithpan SE_M_VITAL_THROW, SOUND_PAN_TARGET createsprite gAquaTailKnockOffSpriteTemplate, 130, 2, -16, -16 delay 8 - createsprite gComplexPaletteBlendSpriteTemplate, 2, 7, 31, 5, 1, RGB(31, 31, 31), 10, 0, 0 + createsprite gComplexPaletteBlendSpriteTemplate, 2, 7, 31, 5, 1, RGB_WHITE, 10, 0, 0 createsprite gAquaTailHitSpriteTemplate, 131, 4, 0, 0, 1, 2 playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET createsprite gSlideMonToOffsetSpriteTemplate, 2, 5, 1, -12, 10, 0, 3 createsprite gSlideMonToOriginalPosSpriteTemplate, 2, 3, 0, 0, 5 delay 3 - createvisualtask AnimTask_ShakeMonInPlace, 2, 5, 1, 0, 3, 6, 1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_PLAYER_RIGHT, 1, 0, 3, 6, 1 delay 5 createsprite gSlideMonToOriginalPosSpriteTemplate, 2, 3, 1, 0, 6 delay 10 @@ -2374,7 +2375,7 @@ Move_DRAGON_PULSE: call DragonPulseParticle call DragonPulseParticle createvisualtask AnimTask_SwayMon, 5, 0, 6, 51200, 4, ANIM_TARGET - createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB(30, 10, 13) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 12, RGB(30, 10, 13) call DragonPulseParticle call DragonPulseParticle call DragonPulseParticle @@ -2406,7 +2407,7 @@ Move_DRAGON_RUSH: playsewithpan SE_M_VITAL_THROW, SOUND_PAN_TARGET createsprite gDragonRushSpriteTemplate, 131, 2, -16, -16 delay 8 - createsprite gComplexPaletteBlendSpriteTemplate, 2, 7, 31, 5, 1, RGB(31, 31, 31), 10, 0, 0 + createsprite gComplexPaletteBlendSpriteTemplate, 2, 7, 31, 5, 1, RGB_WHITE, 10, 0, 0 createsprite gBasicHitSplatSpriteTemplate, 3, 4, 0, 0, 1, 1 createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 5, 1 waitforvisualfinish @@ -2564,12 +2565,12 @@ Move_BRAVE_BIRD: Move_EARTH_POWER: loadspritegfx ANIM_TAG_SMALL_EMBER loadspritegfx ANIM_TAG_FIRE_PLUME - createvisualtask AnimTask_HorizontalShake, 3, 5, 10, 50 - createvisualtask AnimTask_HorizontalShake, 3, 1, 10, 50 + createvisualtask AnimTask_HorizontalShake, 3, ANIM_PLAYER_RIGHT, 10, 50 + createvisualtask AnimTask_HorizontalShake, 3, ANIM_TARGET, 10, 50 playsewithpan SE_M_EARTHQUAKE, SOUND_PAN_TARGET delay 40 loopsewithpan 145, SOUND_PAN_TARGET 11, 3 - createvisualtask AnimTask_ShakeMon 5, 5, ANIM_TARGET, 0, 3, 25, 1 + createvisualtask AnimTask_ShakeMon, 5, 5, ANIM_TARGET, 0, 3, 25, 1 createsprite gDragonRageFirePlumeSpriteTemplate, 194, 3, 1, 5, 0 delay 1 createsprite gDragonRageFirePlumeSpriteTemplate, 194, 3, 1, -10, -15 @@ -2652,7 +2653,7 @@ GigaImpactContinuity: delay 1 createsprite gSlideMonToOffsetSpriteTemplate 2, 5, 1, -16, 0, 0, 4 waitforvisualfinish - createvisualtask AnimTask_ShakeMonInPlace 2, 5, 1, 4, 0, 12, 1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_PLAYER_RIGHT, 1, 4, 0, 12, 1 waitforvisualfinish delay 2 createsprite gSlideMonToOriginalPosSpriteTemplate 2, 3, 0, 0, 5 @@ -2832,7 +2833,7 @@ Move_SHADOW_CLAW: setalpha 12, 8 createsprite gHorizontalLungeSpriteTemplate ANIM_ATTACKER, 2, 6, 4 delay 4 - createvisualtask AnimTask_ShakeMon2 2, ANIM_TARGET, 2, 0, 18, 1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 18, 1 createsprite gClawSlashSpriteTemplate, ANIM_TARGET, 2, -10, -10, 0 createsprite gClawSlashSpriteTemplate, ANIM_TARGET, 2, -10, 10, 0 playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET @@ -2958,7 +2959,7 @@ Move_SHADOW_SNEAK: createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x0, 0x7, 0x0000 waitforvisualfinish playsewithpan SE_M_FAINT_ATTACK, SOUND_PAN_ATTACKER - createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 0x2, 0x0, 0x12, 0x6, 0x1, 0x3 + createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 18, 6, 1, 3 createvisualtask AnimTask_AttackerFadeToInvisible, 0x2, 0x1 waitforvisualfinish clearmonbg ANIM_ATTACKER @@ -2966,7 +2967,7 @@ Move_SHADOW_SNEAK: delay 0x1 createvisualtask AnimTask_DestinyBondWhiteShadow, 0x5, 0x0, 0x30 delay 0x30 - createvisualtask AnimTask_BlendColorCycle, 0x2, F_PAL_TARGET, 0x2, 0x2, 0x0, 0xF, 0x0 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 15, RGB_BLACK createsprite gShadowSneakImpactSpriteTemplate, ANIM_TARGET, 2, 0xfff6, 0xfff6, 0x0 call ShadowSneakMovement createsprite gShadowSneakImpactSpriteTemplate, ANIM_TARGET, 2, 0xa, 0x14, 0x0 @@ -2982,7 +2983,7 @@ Move_SHADOW_SNEAK: end ShadowSneakMovement: playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 delay 0x4 return @@ -3085,7 +3086,7 @@ Move_ZEN_HEADBUTT: delay 2 createsprite gBowMonSpriteTemplate, 2, 1, 1 waitforvisualfinish - createvisualtask AnimTask_ShakeMonInPlace, 2, 5, 0, 2, 0, 4, 1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_PLAYER_RIGHT, 0, 2, 0, 4, 1 createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 6, 1 createsprite gBowMonSpriteTemplate, 2, 1, 2 createsprite gAquaTailHitSpriteTemplate, 131, 4, 0, 0, 1, 1 @@ -3125,7 +3126,7 @@ Move_MIRROR_SHOT: createvisualtask SoundTask_PlaySE1WithPanning, 5, SE_M_VITAL_THROW2, SOUND_PAN_TARGET waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPalExclude, 5, 5, 2, 10, 0, RGB_WHITEALPHA - createvisualtask AnimTask_HorizontalShake, 5, 1, 5, 14 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 5, 14 waitforvisualfinish clearmonbg ANIM_ATTACKER blendoff @@ -3139,7 +3140,7 @@ Move_FLASH_CANNON: loadspritegfx ANIM_TAG_FLASH_CANNON_BALL monbg ANIM_ATTACKER setalpha 13, 8 - createvisualtask AnimTask_ElectricChargingParticles, 2, 0, 60, 2, 12 + createvisualtask AnimTask_ElectricChargingParticles, 2, ANIM_ATTACKER, 60, 2, 12 playsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER delay 30 playsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER @@ -3169,7 +3170,6 @@ Move_FLASH_CANNON: end Move_ROCK_CLIMB: - createvisualtask AnimTask_Splash, 2, 2, ANIM_ATTACKER, 3 delay 8 loopsewithpan SE_M_TAIL_WHIP, SOUND_PAN_ATTACKER, 38, 3 waitforvisualfinish @@ -3195,7 +3195,7 @@ Move_ROCK_CLIMB: createsprite gBasicHitSplatSpriteTemplate, 131, 4, 5, -52, 1, 1 createsprite gSlideMonToOffsetSpriteTemplate, 2, 5, 1, -25, 16, 1, 4 delay 4 - createvisualtask AnimTask_ShakeMonInPlace, 2, 5, 1, 0, 3, 6, 1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_PLAYER_RIGHT, 1, 0, 3, 6, 1 delay 30 createsprite gSlideMonToOriginalPosSpriteTemplate, 2, 3, 0, 0, 6 delay 4 @@ -3234,7 +3234,7 @@ Move_TRICK_ROOM:: InitRoomAnimation: setalpha 8, 8 playsewithpan SE_M_SUPERSONIC, SOUND_PAN_TARGET - createvisualtask AnimTask_ScaleMonAndRestore, 5, 0xfffa, 0xfffa, 15, 1, 1 + createvisualtask AnimTask_ScaleMonAndRestore, 5, -6, -6, 15, ANIM_TARGET, 1 return Move_DRACO_METEOR: @@ -3264,16 +3264,16 @@ Move_DISCHARGE: loadspritegfx ANIM_TAG_IMPACT loadspritegfx ANIM_TAG_SPARK_2 delay 0 - createvisualtask AnimTask_BlendColorCycle, 2, 3, -31, 1, 5, 5, RGB(31, 31, 20) + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_ATTACKER), -31, 1, 5, 5, RGB(31, 31, 20) playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 32, 24, 190, 12, 0, 1, 0 delay 0 createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 80, 24, 22, 12, 0, 1, 0 createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 156, 24, 121, 13, 0, 1, 1 delay 0 - createvisualtask AnimTask_BlendColorCycle, 2, 3, -31, 1, 0, 0, RGB(31, 31, 20) + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_ATTACKER), -31, 1, 0, 0, RGB(31, 31, 20) delay 10 - createvisualtask AnimTask_BlendColorCycle 2, 3, -31, 1, 5, 5, RGB(31, 31, 20) + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_ATTACKER), -31, 1, 5, 5, RGB(31, 31, 20) playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 100, 24, 60, 10, 0, 1, 0 createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 170, 24, 42, 11, 0, 1, 1 @@ -3368,10 +3368,10 @@ DischargeElectrify: Move_LAVA_PLUME: loadspritegfx ANIM_TAG_FIRE_PLUME loopsewithpan 152, SOUND_PAN_ATTACKER, 9, 2 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 2, 2, 0, 11, RGB_RED - createvisualtask AnimTask_ShakeMon2 2, ANIM_TARGET, 1, 0, 32, 1 - createvisualtask AnimTask_ShakeMon2 2, ANIM_DEF_PARTNER, 1, 0, 32, 1 - createvisualtask AnimTask_ShakeMon2 2, ANIM_ATK_PARTNER, 1, 0, 32, 1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB_RED + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 1, 0, 32, 1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_DEF_PARTNER, 1, 0, 32, 1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATK_PARTNER, 1, 0, 32, 1 waitforvisualfinish createsprite gLavaPlumeSpriteTemplate, 130, 1, 0 createsprite gLavaPlumeSpriteTemplate, 130, 1, 32 @@ -3582,7 +3582,7 @@ Move_GUNK_SHOT: splitbgprio ANIM_TARGET setalpha 12, 8 call SetGunkShotBG - createvisualtask AnimTask_ShakeMon 5, 5, ANIM_ATTACKER, 0, 2, 40, 1 + createvisualtask AnimTask_ShakeMon, 5, 5, ANIM_ATTACKER, 0, 2, 40, 1 delay 6 panse SE_M_HYDRO_PUMP, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 2, 0 createvisualtask AnimTask_StartSinAnimTimer, 5, 1, 100 @@ -3760,8 +3760,8 @@ Move_STONE_EDGE: delay 2 createsprite gBasicHitSplatSpriteTemplate, 131, 4, -32, -16, 1, 3 playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMonInPlace, 2, 5, 1, 3, 0, 12, 1 - createvisualtask AnimTask_ShakeMonInPlace, 2, 5, 3, 3, 0, 12, 1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_PLAYER_RIGHT, 1, 3, 0, 12, 1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_PLAYER_RIGHT, 3, 3, 0, 12, 1 delay 4 createsprite gRandomPosHitSplatSpriteTemplate, 131, 2, 1, 3 playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET @@ -3779,7 +3779,7 @@ Move_STONE_EDGE: Move_CAPTIVATE: loadspritegfx ANIM_TAG_MAGENTA_HEART loadspritegfx ANIM_TAG_SPARKLE_2 - createvisualtask AnimTask_RockMonBackAndForth, 5, 3, 0, 2, 0 + createvisualtask AnimTask_RockMonBackAndForth, 5, ANIM_DEF_PARTNER, 0, 2, 0 createsprite gMagentaHeartSpriteTemplate, 3, 2, 0, 20 playsewithpan SE_M_CHARM, SOUND_PAN_ATTACKER delay 15 @@ -3816,7 +3816,7 @@ Move_GRASS_KNOT: createsprite gGrassKnotSpriteTemplate, 130, 6, -18, 19, 40, 8, 160, 0 delay 4 createsprite gBasicHitSplatSpriteTemplate, 130, 4, -8, 8, 1, 2 - createvisualtask AnimTask_RotateMonSpriteToSide, 2, 4, 6, 384, 1, 2 + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 4, 6, 384, ANIM_TARGET, 2 playsewithpan SE_M_VITAL_THROW2 SOUND_PAN_TARGET waitforvisualfinish createsprite gSlideMonToOriginalPosSpriteTemplate, 2, 3, 0, 1, 4 @@ -3829,19 +3829,19 @@ Move_CHATTER: monbg ANIM_DEF_PARTNER createvisualtask AnimTask_UproarDistortion, 2, 0 createsprite gUproarRingSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 0, 0, 0x1f, 8 - createvisualtask SoundTask_PlayDoubleCry, 2, ANIM_ATTACKER, 0xff + createvisualtask SoundTask_PlayDoubleCry, 2, ANIM_ATTACKER, DOUBLE_CRY_GROWL createsprite gJaggedMusicNoteSpriteTemplate, ANIM_ATTACKER, 2, 0, 0x1d, -12, 0 createsprite gJaggedMusicNoteSpriteTemplate, ANIM_ATTACKER, 2, 0, -12, 0xffe3, 1 delay 16 createvisualtask AnimTask_UproarDistortion, 2, 0 createsprite gUproarRingSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 0, 0, 0x1f, 8 - createvisualtask SoundTask_PlayDoubleCry, 2, ANIM_ATTACKER, 0xff + createvisualtask SoundTask_PlayDoubleCry, 2, ANIM_ATTACKER, DOUBLE_CRY_GROWL createsprite gJaggedMusicNoteSpriteTemplate, ANIM_ATTACKER, 2, 0, 12, 0xffe3, 1 createsprite gJaggedMusicNoteSpriteTemplate, ANIM_ATTACKER, 2, 0, 0xffe3, -12, 0 delay 16 createvisualtask AnimTask_UproarDistortion, 2, 0 createsprite gUproarRingSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 0, 0, 0x1f, 8 - createvisualtask SoundTask_PlayDoubleCry, 2, ANIM_ATTACKER, 0xff + createvisualtask SoundTask_PlayDoubleCry, 2, ANIM_ATTACKER, DOUBLE_CRY_GROWL createsprite gJaggedMusicNoteSpriteTemplate, ANIM_ATTACKER, 2, 0, 0x18, 0xffe8, 1 createsprite gJaggedMusicNoteSpriteTemplate, ANIM_ATTACKER, 2, 0, 0xffe8, 0xffe8, 0 waitforvisualfinish @@ -4003,25 +4003,25 @@ Move_CHARGE_BEAM: loadspritegfx ANIM_TAG_BLACK_BALL_2 loadspritegfx ANIM_TAG_SPARK_2 delay 0 - createvisualtask AnimTask_BlendColorCycle, 2, 3, -31, 1, 5, 5, RGB(31, 31, 22) + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_ATTACKER), -31, 1, 5, 5, RGB(31, 31, 22) playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 32, 24, 190, 12, 0, 1, 0 delay 0 createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 80, 24, 22, 12, 0, 1, 0 createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 156, 24, 121, 13, 0, 1, 1 delay 0 - createvisualtask AnimTask_BlendColorCycle, 2, 3, -31, 1, 0, 0, RGB(31, 31, 22) + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_ATTACKER), -31, 1, 0, 0, RGB(31, 31, 22) delay 10 - createvisualtask AnimTask_BlendColorCycle, 2, 3, -31, 1, 5, 5, RGB(31, 31, 22) + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_ATTACKER), -31, 1, 5, 5, RGB(31, 31, 22) playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 100, 24, 60, 10, 0, 1, 0 createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 170, 24, 42, 11, 0, 1, 1 delay 0 createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 238, 24, 165, 10, 0, 1, 1 delay 0 - createvisualtask AnimTask_BlendColorCycle, 2, 3, -31, 1, 0, 0, RGB(31, 31, 22) + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_ATTACKER), -31, 1, 0, 0, RGB(31, 31, 22) delay 20 - createvisualtask AnimTask_BlendColorCycle, 2, 3, -31, 1, 7, 7, RGB(31, 31, 22) + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_ATTACKER), -31, 1, 7, 7, RGB(31, 31, 22) playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_ATTACKER, 4, 0, 0, 32, 12, 0, 20, 0, 0 createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_ATTACKER, 4, 0, 0, 32, 12, 64, 20, 1, 0 @@ -4033,7 +4033,7 @@ Move_CHARGE_BEAM: createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_ATTACKER, 4, 0, 0, 16, 12, 224, 20, 2, 0 delay 4 waitforvisualfinish - createvisualtask AnimTask_BlendColorCycle, 2, 3, -31, 1, 0, 0, RGB(31, 31, 22) + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_ATTACKER), -31, 1, 0, 0, RGB(31, 31, 22) playsewithpan SE_M_THUNDER_WAVE, SOUND_PAN_ATTACKER createsprite gZapCannonBallSpriteTemplate, ANIM_TARGET, 3, 10, 0, 0, 0, 30, 0 createsprite gZapCannonSparkSpriteTemplate, ANIM_TARGET, 4, 10, 0, 16, 30, 0, 40, 0 @@ -4053,31 +4053,34 @@ Move_CHARGE_BEAM: end Move_WOOD_HAMMER: + loadspritegfx ANIM_TAG_WOOD_HAMMER + loadspritegfx ANIM_TAG_WOOD_HAMMER_HAMMER loadspritegfx ANIM_TAG_IMPACT - monbg ANIM_TARGET - setalpha 12, 8 playsewithpan SE_M_SWAGGER, SOUND_PAN_ATTACKER - createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 18, 6, 2, 4 - waitforvisualfinish - createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 0, 20, 0, 0, 4 - delay 3 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, 0, 10, 0, 0 - createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 4, -10, 0, 1, 0 - playsewithpan SE_M_MEGA_KICK2, SOUND_PAN_TARGET - delay 1 - createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 1, -16, 0, 0, 4 - waitforvisualfinish - createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 4, 0, 12, 1 - waitforvisualfinish - delay 2 - createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 5 - delay 3 - createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 1, 0, 7 + createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 12, 4, 2, 4 + createsprite gWoodHammerHammerSpriteTemplate, ANIM_TARGET, 2 + delay 60 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_ATTACKER, 3, 0, 12, 4 + delay 18 + createvisualtask AnimTask_SquishTarget, 0x2 + delay 6 + call WoodHammerImpact waitforvisualfinish - clearmonbg ANIM_TARGET - blendoff end +WoodHammerImpact: + playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET + createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, ANIM_TARGET, 2 + createsprite gWoodHammerSmallSpriteTemplate, ANIM_TARGET, 2, 0, 0, 20, 24, 14, 1 + createsprite gWoodHammerSmallSpriteTemplate, ANIM_TARGET, 2, 5, 0, -20, 24, 14, 0 + createsprite gWoodHammerSmallSpriteTemplate, ANIM_TARGET, 2, 0, 5, 20, -24, 14, 1 + createsprite gWoodHammerSmallSpriteTemplate, ANIM_TARGET, 2, -5, 0, -20, -24, 14, 0 + createsprite gWoodHammerSmallSpriteTemplate, ANIM_TARGET, 2, 0, 0, 20, 24, 20, 2 + createsprite gWoodHammerSmallSpriteTemplate, ANIM_TARGET, 2, 5, 0, -20, 24, 20, 2 + createsprite gWoodHammerSmallSpriteTemplate, ANIM_TARGET, 2, 0, 5, 20, -24, 20, 2 + createsprite gWoodHammerSmallSpriteTemplate, ANIM_TARGET, 2, -5, 0, -20, -24, 20, 2 + return + Move_AQUA_JET: loadspritegfx ANIM_TAG_SPARKLE_6 loadspritegfx ANIM_TAG_ROUND_SHADOW @@ -4106,7 +4109,7 @@ Move_AQUA_JET: delay 12 call RisingWaterHitEffect waitforvisualfinish - visible 0 + visible ANIM_ATTACKER clearmonbg ANIM_DEF_PARTNER blendoff end @@ -4141,8 +4144,8 @@ Move_ATTACK_ORDER: waitforvisualfinish createsprite gBasicHitSplatSpriteTemplate 131, 4, -32, -16, 1, 3 playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMonInPlace, 2, 5, 1, 3, 0, 12, 1 - createvisualtask AnimTask_ShakeMonInPlace, 2, 5, 1, 3, 0, 12, 1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_PLAYER_RIGHT, 1, 3, 0, 12, 1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_PLAYER_RIGHT, 1, 3, 0, 12, 1 delay 4 createsprite gRandomPosHitSplatSpriteTemplate 131, 2, 1, 3 playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET @@ -4291,9 +4294,9 @@ Move_ROAR_OF_TIME: createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 1, 16, 0, 0 waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 1, 0, 16, -1 - createvisualtask SoundTask_PlayDoubleCry, 2, ANIM_ATTACKER, 0xff + createvisualtask SoundTask_PlayDoubleCry, 2, ANIM_ATTACKER, DOUBLE_CRY_GROWL delay 0x20 - createvisualtask AnimTask_ShakeMonInPlace, 2, 1, 10, 0, 20, 1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 10, 0, 20, 1 playsewithpan 170, SOUND_PAN_TARGET createsprite gExplosionSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 1, 1 delay 6 @@ -4425,13 +4428,13 @@ Move_MAGMA_STORM: loopsewithpan SE_M_SACRED_FIRE2, SOUND_PAN_TARGET, 5, 8 createvisualtask AnimTask_SeismicTossBgAccelerateDownAtEnd, 3 createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 2, 47, 1 - createvisualtask AnimTask_BlendColorCycle, 2, 6, 4, 2, 2, 0, 12, RGB(22, 9, 7) + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_ATTACKER | F_PAL_TARGET), 4, 2, 2, 0, 12, RGB(22, 9, 7) call FireSpinEffect call FireSpinEffect - createvisualtask AnimTask_BlendColorCycle, 2, 6, 4, 2, 2, 0, 12, RGB(22, 9, 7) + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_ATTACKER | F_PAL_TARGET), 4, 2, 2, 0, 12, RGB(22, 9, 7) call FireSpinEffect call FireSpinEffect - createvisualtask AnimTask_BlendColorCycle, 2, 6, 4, 2, 2, 0, 12, RGB(22, 9, 7) + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_ATTACKER | F_PAL_TARGET), 4, 2, 2, 0, 12, RGB(22, 9, 7) call FireSpinEffect restorebg waitbgfadeout @@ -4522,7 +4525,7 @@ Move_SEED_FLARE: delay 2 createsprite gSeedFlareGreenCirclesTemplate, ANIM_ATTACKER, 2, 0xffd8, -20, 16 delay 30 - createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 0x28, 1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 40, 1 createsprite gSeedFlareGreenWavesTemplate, ANIM_ATTACKER, 0x28, 10, 0x900, 0x60, 1 createsprite gRazorLeafCutterSpriteTemplate, ANIM_TARGET, 3, 20, -10, 20, 0, 0x16, 20, 1 createsprite gRazorLeafCutterSpriteTemplate, ANIM_TARGET, 3, 20, -10, 20, 0, 0x16, -20, 1 @@ -4637,7 +4640,7 @@ ShadowForcePrep: createvisualtask AnimTask_SetGrayscaleOrOriginalPal, 5, ANIM_DEF_PARTNER, TRUE waitforvisualfinish clearmonbg ANIM_ATTACKER - invisible 0 + invisible ANIM_ATTACKER delay 1 goto ShadowForceWaitEnd ShadowForceAttack: @@ -4650,8 +4653,8 @@ ShadowForceAttack: playsewithpan SOUND_PAN_ATTACKER, 192 createvisualtask AnimTask_NightShadeClone, 5, 85 delay 70 - createvisualtask AnimTask_ShakeMon2 2, ANIM_TARGET, 2, 0, 12, 1 - createvisualtask AnimTask_BlendColorCycle 2, 4, 0, 2, 0, 13, 0 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 12, 1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 0, 2, 0, 13, RGB_BLACK waitforvisualfinish clearmonbg ANIM_ATTACKER delay 1 @@ -4696,7 +4699,7 @@ Move_WIDE_GUARD: loadspritegfx ANIM_TAG_WATER_ORB @blue color monbg ANIM_ATTACKER setalpha 12, 8 - createvisualtask AnimTask_RockMonBackAndForth, 0x5, 0x0, 0x3, 0x0 + createvisualtask AnimTask_RockMonBackAndForth, 5, ANIM_ATTACKER, 3, 0 waitplaysewithpan SE_M_PSYBEAM2, SOUND_PAN_ATTACKER, 0x10 createsprite gWideGuardBlueConversionTemplate, ANIM_ATTACKER, 0x2, 0xffe8, 0xffe8 delay 3 @@ -4800,7 +4803,7 @@ Move_PSYSHOCK: monbg ANIM_TARGET setalpha 8, 8 createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 10, 1 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 0, 2, 0, 8, 767 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 2, 0, 8, RGB(31, 23, 0) waitforvisualfinish loopsewithpan SE_M_SUPERSONIC, SOUND_PAN_TARGET, 10, 3 createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 15, 1 @@ -4842,7 +4845,7 @@ Move_AUTOTOMIZE: loadspritegfx ANIM_TAG_METAL_BITS @Metal Bits setalpha 12, 8 monbg ANIM_ATK_PARTNER - createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 0x2, 0x0, 0x18, 0x6, 0x4, 0x4 + createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 24, 6, 4, 4 createvisualtask AnimTask_TraceMonBlended 0x2, 0x0, 0x4, 0x7, 0xa playsewithpan SE_ELEVATOR, SOUND_PAN_ATTACKER createsprite gAutotomizeMetalShardsTemplate, ANIM_ATTACKER, 0x2, 0x0, 0x0 @@ -4872,7 +4875,7 @@ Move_RAGE_POWDER:: call RagePowderSprinkle call RagePowderSprinkle call RagePowderSprinkle - createvisualtask AnimTask_BlendColorCycle, ANIM_ATTACKER, 0x2, F_PAL_ATTACKER, 0x2, 0x2, 0x0, 0xb, 0x1f + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB_RED waitforvisualfinish clearmonbg ANIM_DEF_PARTNER end @@ -4895,7 +4898,7 @@ Move_TELEKINESIS:: createsprite gSpinningSparkleSpriteTemplate, ANIM_ATTACKER, 0xd, 0x14, 0xffec waitforvisualfinish loopsewithpan SE_M_SUPERSONIC, SOUND_PAN_TARGET, 0xa, 0x3 - createvisualtask AnimTask_SwayMon, 0x5, 0x1, 0x18, 0xD0, 0x1, ANIM_TARGET + createvisualtask AnimTask_SwayMon, 5, 1, 24, 208, 1, ANIM_TARGET waitforvisualfinish delay 0xA createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0x1, 0x9, 0x0, 0x0 @@ -4934,7 +4937,7 @@ Move_STORM_THROW: createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 0, 20, 0, 0, 4 playsewithpan SE_M_SWAGGER, SOUND_PAN_TARGET delay 1 - createvisualtask AnimTask_RotateMonSpriteToSide, 2, 10, 0xC00, 1, 2 + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 10, 3072, ANIM_TARGET, 2 playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET delay 3 createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 7 @@ -4958,6 +4961,14 @@ Move_FLAME_BURST: delay 18 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 16, 1 createsprite gExplosionSpriteTemplate, ANIM_TARGET, 4, 0, 0, 1, 0 + call FlameBurstSpread + playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET + delay 3 + createsprite gExplosionSpriteTemplate, ANIM_TARGET, 4, 14, -14, 1, 0 + playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET + waitforvisualfinish + end +FlameBurstSpread: createsprite gFireSpreadSpriteTemplate, ANIM_TARGET, 1, 0, 0, 192, 76, 70 createsprite gFireSpreadSpriteTemplate, ANIM_TARGET, 1, 0, 0, -192, 76, 70 createsprite gFireSpreadSpriteTemplate, ANIM_TARGET, 1, 0, 0, 20, 140, 70 @@ -4972,12 +4983,8 @@ Move_FLAME_BURST: createsprite gFireSpreadSpriteTemplate, ANIM_TARGET, 1, 0, 0, -224, -32, 70 createsprite gFireSpreadSpriteTemplate, ANIM_TARGET, 1, 0, 0, 112, -128, 70 createsprite gFireSpreadSpriteTemplate, ANIM_TARGET, 1, 0, 0, -112, -128, 70 - playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET - delay 3 - createsprite gExplosionSpriteTemplate, ANIM_TARGET, 4, 14, -14, 1, 0 - playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET - waitforvisualfinish - end + return + Move_SLUDGE_WAVE: panse SE_M_WHIRLPOOL, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 0x2, 0x0 @@ -5121,7 +5128,7 @@ Move_SOAK: delay 30 playsewithpan SE_M_WATERFALL, 63 createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 4, 0, 17, 1 - createvisualtask AnimTask_BlendColorCycle, 2, 4, 1, 2, 0, 12, RGB_BLUE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 1, 2, 0, 12, RGB_BLUE createsprite gWaterHitSplatSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 1, 1 createsprite gSmallDriftingBubblesSpriteTemplate, ANIM_ATTACKER, 4, 0, 0 createsprite gSmallDriftingBubblesSpriteTemplate, ANIM_ATTACKER, 4, 0, 0 @@ -5144,7 +5151,7 @@ Move_FLAME_CHARGE: loadspritegfx ANIM_TAG_IMPACT monbg ANIM_TARGET loopsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER, 0x20, 0x6 - createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 0x2, 0x0, 0xc, 0x6, 0x6, 0x3 + createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 12, 6, 6, 3 call FlameChargeSwirl delay 0x9 call FlameChargeSwirl @@ -5159,7 +5166,7 @@ Move_FLAME_CHARGE: delay 0x3 playsewithpan SE_M_MEGA_KICK2, SOUND_PAN_TARGET createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x1, 0x0 - createvisualtask AnimTask_ShakeMon, 0x2, 0x1, 0x6, 0x0, 0x8, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 6, 0, 8, 1 call FireSpreadEffect playsewithpan SE_M_FIRE_PUNCH, SOUND_PAN_ATTACKER waitforvisualfinish @@ -5182,9 +5189,9 @@ Move_COIL: delay 0x7 createsprite gConstrictBindingSpriteTemplate, ANIM_TARGET, 3, 0x0, 0xfff8, 0x1, 0x2 delay 0x8 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x3, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 3, 0, 6, 1 delay 0x14 - createvisualtask AnimTask_ShakeMon2, 0x83, 0x1, 0x4, 0x0, 0x5, 0x1 + createvisualtask AnimTask_ShakeMon2, 131, ANIM_TARGET, 4, 0, 5, 1 createvisualtask AnimTask_StretchTargetUp, 0x3 playsewithpan SE_M_BIND, SOUND_PAN_TARGET setarg 0x7 0xffff @@ -5210,7 +5217,7 @@ Move_ACID_SPRAY: playsewithpan SE_M_BUBBLE3, SOUND_PAN_ATTACKER delay 33 createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 2, 0, 10, 1 - createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB(30, 0, 31) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 12, RGB(30, 0, 31) playsewithpan SE_M_DIVE, SOUND_PAN_ATTACKER createsprite gAcidPoisonDropletSpriteTemplate, ANIM_TARGET, 2, 0, -20, 10, 15, 55, FALSE createsprite gAcidPoisonDropletSpriteTemplate, ANIM_TARGET, 2, 0, -20, -20, 15, 55, FALSE @@ -5239,7 +5246,7 @@ Move_FOUL_PLAY: createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 0x4, 0x4 delay 0x6 createsprite gFoulPlayImpactTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x1, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, 0x1, 0x3, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 playsewithpan SE_M_VITAL_THROW SOUND_PAN_TARGET createvisualtask AnimTask_BlendBattleAnimPal, 0xa, (F_PAL_BG | F_PAL_BATTLERS), 0x3, 0xa, 0x0, 0x0 createsprite gFoulPlayRingTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x100, 0x0 @@ -5265,7 +5272,7 @@ Move_SIMPLE_BEAM: call SimpleBeamsRegular call SimpleBeamsRegular createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x2, 0x0, 0x9, 0x7FFF - createvisualtask AnimTask_SwayMon, 0x5, 0x0, 0x6, 0x800, 0x4, ANIM_TARGET + createvisualtask AnimTask_SwayMon, 5, 0, 6, 2048, 4, ANIM_TARGET call SimpleBeamWithRings call SimpleBeamWithRings call SimpleBeamWithRings @@ -5309,14 +5316,14 @@ Move_ENTRAINMENT: playsewithpan SE_M_TEETER_DANCE, SOUND_PAN_ATTACKER delay 0x18 playsewithpan SE_M_TEETER_DANCE, SOUND_PAN_ATTACKER - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 0x1f, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 31, 1 waitforvisualfinish end Move_AFTER_YOU: loadspritegfx ANIM_TAG_ANGER @rage loadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT @green color - createvisualtask AnimTask_SwayMon, 0x5, 0x1, 0xF, 0x600, 0x2, ANIM_ATTACKER + createvisualtask AnimTask_SwayMon, 5, 1, 15, 1536, 2, ANIM_ATTACKER delay 0x1 createsprite gAfterYouGreenRageTemplate, ANIM_ATTACKER, 2, 0x0, 0xffec, 0xffe0 createsprite gAfterYouGreenRageTemplate, ANIM_ATTACKER, 2, 0x0, 0xfffb, 0xffe5 @@ -5333,7 +5340,7 @@ Move_ROUND: createvisualtask AnimTask_MusicNotesRainbowBlend, 2 waitforvisualfinish monbg ANIM_TARGET - createvisualtask SoundTask_PlayCryHighPitch, 2, 0, 255 + createvisualtask SoundTask_PlayCryHighPitch, 2, ANIM_ATTACKER, 255 createvisualtask AnimTask_UproarDistortion, 2, 0 createsprite gWavyMusicNotesSpriteTemplate, ANIM_TARGET, 2, 7, 0, 12 delay 5 @@ -5354,7 +5361,7 @@ Move_ECHOED_VOICE: loadspritegfx ANIM_TAG_METAL_SOUND_WAVES monbg ANIM_DEF_PARTNER splitbgprio_foes ANIM_TARGET - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x2, 0x0, 0x8, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 2, 0, 8, 1 call MetalSoundPlayNote call MetalSoundPlayNote call MetalSoundPlayNote @@ -5376,9 +5383,9 @@ Move_CHIP_AWAY: waitforvisualfinish monbg ANIM_ATK_PARTNER setalpha 12, 8 - createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 0x2, 0x0, 0x18, 0x6, 0x1, 0x5 + createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 24, 6, 1, 5 delay 0x4 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x5, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 6, 1 createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 4, 0x0, 0x0, 0x1, 0x1 playsewithpan SE_M_VITAL_THROW2 SOUND_PAN_TARGET waitforvisualfinish @@ -5404,7 +5411,7 @@ Move_CLEAR_SMOG: call ClearSmogCloud delay 120 loopsewithpan SE_M_TOXIC, SOUND_PAN_TARGET, 18, 2 - createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 12, RGB_WHITE delay 10 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 15, 1 waitforvisualfinish @@ -5450,7 +5457,7 @@ Move_QUICK_GUARD: loadspritegfx ANIM_TAG_QUICK_GUARD_HAND @hand loadspritegfx ANIM_TAG_SPARKLE_4 @sparkles setalpha 12, 8 - createvisualtask AnimTask_BlendColorCycle, 0x2, F_PAL_ATTACKER, 0x0, 0x2, 0x0, 0xa, 0x7FFF + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 2, 0, 10, RGB_WHITE delay 0x10 monbg ANIM_ATTACKER createsprite gQuickGuardArmImpactTemplate, ANIM_TARGET, 3, 0xE, 0x0, 0x8, 0x0, 0x0 @@ -5492,7 +5499,7 @@ Move_SCALD: call ScaldBeams call ScaldBeams call ScaldBeams - createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 11, RGB_RED + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 11, RGB_RED createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 3, 0, 37, 1 call ScaldHitSplats call ScaldBeams @@ -5532,13 +5539,13 @@ Move_SHELL_SMASH: loadspritegfx ANIM_TAG_ROCKS loadspritegfx ANIM_TAG_HANDS_AND_FEET playsewithpan SE_M_SCRATCH, SOUND_PAN_ATTACKER - createsprite gShellSmashRightShellSpriteTemplate, ANIM_ATTACKER, 2, 0xffd7, 0x0, 0x2, 0x333, 0x0, 0xa - createsprite gShellSmashLeftShellSpriteTemplate, ANIM_ATTACKER, 2, 0x20, 0x0, 0x6, 0xfccd, 0x0, 0xa + createsprite gShellSmashRightShellSpriteTemplate, ANIM_ATTACKER, 2, 0xffd7, 0x0, 0x2, 0x333, 0x0, 10, 30 + createsprite gShellSmashLeftShellSpriteTemplate, ANIM_ATTACKER, 2, 0x20, 0x0, 0x6, 0xfccd, 0x0, 10, 30 delay 10 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x1, 0x1 createsprite gFistFootSpriteTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x8, 0x1, 0x0 playsewithpan SE_M_ICY_WIND, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 2, 1, 3, 0, 5, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 5, 1 waitforvisualfinish playsewithpan SE_M_BUBBLE, SOUND_PAN_TARGET createsprite gShellSmashPurpleRocksSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x14, 0x18, 0xe, 0x2 @@ -5549,7 +5556,7 @@ Move_SHELL_SMASH: createsprite gShellSmashPurpleRocksSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x1e, 0xffee, 0x8, 0x2 createsprite gShellSmashPurpleRocksSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0xffe2, 0x12, 0x8, 0x2 createsprite gShellSmashPurpleRocksSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0xffe2, 0xffee, 0x8, 0x2 - createvisualtask AnimTask_ShakeMon, 2, 1, 0, 3, 7, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 7, 1 waitforvisualfinish end @@ -5594,10 +5601,10 @@ Move_HEX: playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER waitbgfadein createvisualtask AnimTask_PurpleFlamesOnTarget, 0x3 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_TARGET, 0x2, 0x0, 0x25, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 2, 0, 37, 1 playsewithpan SE_M_NIGHTMARE, SOUND_PAN_TARGET delay 0x20 - createvisualtask AnimTask_BlendColorCycle, 0x2, F_PAL_TARGET, 0x2, 0x2, 0x0, 0xc, 0x4C4A @;Deep purple + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 12, RGB(10, 2, 19) @;Deep purple createsprite gCurseGhostSpriteTemplate, ANIM_TARGET, 4 waitforvisualfinish clearmonbg ANIM_TARGET @@ -5632,7 +5639,7 @@ SkyDropUnleash: delay 0x7 playsewithpan SE_M_MEGA_KICK2, SOUND_PAN_TARGET createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x0, 0x1, 0x0 - createvisualtask AnimTask_ShakeMon, 0x5, 0x1, 0x0, 0x5, 0xb, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 5, 11, 1 waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -5655,7 +5662,7 @@ Move_CIRCLE_THROW: monbg ANIM_DEF_PARTNER setalpha 12, 8 playsewithpan SE_M_VITAL_THROW, SOUND_PAN_ATTACKER - createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 0x2, 0x0, 0xc, 0x4, 0x1, 0x2 + createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 12, 4, 1, 2 waitforvisualfinish createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0x14, 0x0, 0x0, 0x4 delay 0x2 @@ -5683,8 +5690,8 @@ Move_INCINERATE: delay 1 createsprite gIncinerateSpriteTemplate, ANIM_TARGET, 2, 6, 20, 0, -16, 24, 20 playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER - createvisualtask AnimTask_SwayMon, 5, 0, 3, 0xc00, 8, ANIM_TARGET - createvisualtask AnimTask_SwayMon, 5, 0, 3, 0xc00, 8, ANIM_DEF_PARTNER + createvisualtask AnimTask_SwayMon, 5, 0, 3, 3072, 8, ANIM_TARGET + createvisualtask AnimTask_SwayMon, 5, 0, 3, 3072, 8, ANIM_DEF_PARTNER delay 3 createsprite gIncinerateSpriteTemplate, ANIM_TARGET, 2, 6, 20, 0, -16, 24, 20 delay 3 @@ -5745,7 +5752,7 @@ Move_ACROBATICS: delay 7 playsewithpan SE_M_MEGA_KICK2, SOUND_PAN_TARGET createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 2, 0, 0, 1, 0 - createvisualtask AnimTask_ShakeMon, 5, 1, 0, 5, 11, 1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 5, 11, 1 waitforvisualfinish clearmonbg ANIM_TARGET blendoff @@ -5803,7 +5810,7 @@ Move_RETALIATE: playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x10, 0x10, 0x43D waitforvisualfinish - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0, 0x3, 0xf, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 15, 1 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x10, 0x0, 0x043D waitforvisualfinish clearmonbg ANIM_DEF_PARTNER @@ -5816,21 +5823,21 @@ Move_FINAL_GAMBIT: loadspritegfx ANIM_TAG_EXPLOSION @explosion animation createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x0, 0xC, 0x0 @Darken waitforvisualfinish - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0xa, 0x1 - createvisualtask AnimTask_BlendColorCycle, 0x2, F_PAL_ATTACKER, 0x0, 0x2, 0x0, 0x8, 0x7fff + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 10, 1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 2, 0, 8, RGB_WHITE waitforvisualfinish playsewithpan SE_M_SAND_ATTACK, SOUND_PAN_ATTACKER createsprite gFinalGambitBlueYawnTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x25 delay 0x4 waitforvisualfinish - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 0xf, 0x1 - createvisualtask AnimTask_ScaleMonAndRestore, 0x5, 0xfffc, 0xfffc, 0xf, 0x1, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 15, 1 + createvisualtask AnimTask_ScaleMonAndRestore, 5, -4, -4, 15, ANIM_TARGET, 1 waitforvisualfinish monbg ANIM_TARGET delay 0x1 playsewithpan SE_M_EXPLOSION, SOUND_PAN_ATTACKER createsprite gFinalGambitExplosionTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x1, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0, 0x3, 0xf, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 15, 1 waitforvisualfinish clearmonbg ANIM_TARGET createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0xC, 0x0, 0x0 @@ -5851,7 +5858,7 @@ Move_INFERNO: loadspritegfx ANIM_TAG_SMALL_EMBER call SetImpactBackground loopsewithpan SE_M_SACRED_FIRE2, SOUND_PAN_TARGET, 40, 4 - createvisualtask AnimTask_ShakeMon, 5, 1, 0, 2, 94, 1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 2, 94, 1 createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 1, 0, 9, RGB_RED call InfernoAnim call InfernoAnim @@ -5929,7 +5936,7 @@ Move_WATER_PLEDGE: panse SE_M_HYDRO_PUMP, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, +2, 0 - createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 11, RGB_BLUE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 11, RGB_BLUE createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 3, 0, 37, 1 createsprite gWaterPledgeOrbSpriteTemplate, ANIM_TARGET, 3, 0, 10, -40, 2 @@ -6042,7 +6049,7 @@ Move_FIRE_PLEDGE: panse SE_M_FLAMETHROWER, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, +2, 0 - createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 11, RGB_RED + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 11, RGB_RED createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 3, 0, 37, 1 createsprite gFirePledgeSpriteTemplate, ANIM_TARGET, 3, 0, 10, -40, 2 @@ -6139,79 +6146,83 @@ Move_GRASS_PLEDGE: @middle fountain (also continues left fountain) - playsewithpan SE_M_SCRATCH, SOUND_PAN_TARGET - createsprite gVineWhipSpriteTemplate, ANIM_TARGET, 2, 0, 0 + call GrassPledgeMiddleFountain - createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 11, RGB_GREEN - createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 3, 0, 37, 1 +@right fountain (also continues middle and left fountains) + + playsewithpan SE_M_SCRATCH, SOUND_PAN_TARGET + createsprite gVineWhipSpriteTemplate, ANIM_TARGET, 2, 16, 0 + createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 24, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 0, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, -24, 10, -40, 2 delay 4 + createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 24, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 0, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, -24, 10, -40, 2 delay 4 + createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 24, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 0, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, -24, 10, -40, 2 delay 4 + createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 24, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 0, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, -24, 10, -40, 2 delay 4 + createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 24, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 0, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, -24, 10, -40, 2 delay 4 + createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 24, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 0, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, -24, 10, -40, 2 delay 4 + createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 24, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 0, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, -24, 10, -40, 2 delay 4 + createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 24, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 0, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, -24, 10, -40, 2 delay 4 -@right fountain (also continues middle and left fountains) + waitforvisualfinish + clearmonbg ANIM_DEF_PARTNER + blendoff + end +GrassPledgeMiddleFountain: playsewithpan SE_M_SCRATCH, SOUND_PAN_TARGET - createsprite gVineWhipSpriteTemplate, ANIM_TARGET, 2, 16, 0 + createsprite gVineWhipSpriteTemplate, ANIM_TARGET, 2, 0, 0 + + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 11, RGB_GREEN + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 3, 0, 37, 1 - createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 24, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 0, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, -24, 10, -40, 2 delay 4 - createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 24, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 0, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, -24, 10, -40, 2 delay 4 - createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 24, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 0, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, -24, 10, -40, 2 delay 4 - createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 24, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 0, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, -24, 10, -40, 2 delay 4 - createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 24, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 0, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, -24, 10, -40, 2 delay 4 - createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 24, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 0, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, -24, 10, -40, 2 delay 4 - createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 24, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 0, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, -24, 10, -40, 2 delay 4 - createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 24, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, 0, 10, -40, 2 createsprite gGrassPledgeSpriteTemplate, ANIM_TARGET, 3, -24, 10, -40, 2 delay 4 - - waitforvisualfinish - clearmonbg ANIM_DEF_PARTNER - blendoff - end + return Move_VOLT_SWITCH: loadspritegfx ANIM_TAG_SPARK @@ -6224,14 +6235,14 @@ Move_VOLT_SWITCH: delay 4 createsprite gUproarRingSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 0, 0, 0x3BDF, 8 delay 4 - createvisualtask AnimTask_ShakeMon, 5, 1, 0, 3, 45, 1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 3, 45, 1 createsprite gUproarRingSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 0, 0, 0x3BDF, 8 delay 4 createsprite gUproarRingSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 0, 0, 0x3BDF, 8 delay 4 call ElectricityEffect playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER - createvisualtask AnimTask_CanBattlerSwitch 1, ANIM_ATTACKER + createvisualtask AnimTask_CanBattlerSwitch, 1, ANIM_ATTACKER jumpretfalse VoltSwitchContinue createvisualtask AnimTask_IsTargetSameSide 1 jumprettrue VoltSwitchAgainstPartner @@ -6240,7 +6251,7 @@ VoltSwitchContinue: waitforvisualfinish clearmonbg ANIM_ATTACKER blendoff - createvisualtask AnimTask_CanBattlerSwitch 1, ANIM_ATTACKER + createvisualtask AnimTask_CanBattlerSwitch, 1, ANIM_ATTACKER jumpretfalse VoltSwitchLast invisible ANIM_ATTACKER VoltSwitchLast: @@ -6249,7 +6260,7 @@ VoltSwitchLast: @ Attacking the same side requires a change of direction @ why would you attack your partner though?! VoltSwitchAgainstPartner: - createvisualtask AnimTask_SlideOffScreen, 5, ANIM_ATTACKER, +2 + createvisualtask AnimTask_SlideOffScreen, 5, ANIM_ATTACKER, 2 goto VoltSwitchContinue Move_STRUGGLE_BUG: @@ -6259,7 +6270,7 @@ Move_STRUGGLE_BUG: setalpha 12, 8 createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 2, 0, 9, 0x0a1f waitforvisualfinish - createvisualtask AnimTask_FlailMovement, 2, 0 + createvisualtask AnimTask_FlailMovement, 2, ANIM_ATTACKER createsprite gMovementWavesSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 2 createsprite gMovementWavesSpriteTemplate, ANIM_ATTACKER, 2, 0, 1, 2 loopsewithpan SE_M_HEADBUTT, SOUND_PAN_ATTACKER, 0x8, 0x2 @@ -6279,7 +6290,7 @@ Move_STRUGGLE_BUG: end Move_BULLDOZE: - createvisualtask AnimTask_Splash, 0x2, 0x0, 0x3 + createvisualtask AnimTask_Splash, 2, ANIM_ATTACKER, 3 delay 0x8 goto Move_EARTHQUAKE @@ -6292,14 +6303,14 @@ Move_FROST_BREATH: createvisualtask AnimTask_StartSlidingBg, 0x5, 0x300, 0x0, 0x0, 0xffff waitbgfadein playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER - createvisualtask AnimTask_ShakeMon, 0x5, 0x0, 0x0, 0x2, 0x28, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 0, 2, 40, 1 waitforvisualfinish createsprite gSlideMonToOffsetSpriteTemplate, ANIM_TARGET, 2, 0x0, 0xf, 0x0, 0x0, 0x4 waitforvisualfinish createsprite gFrostBreathBlueBreathTemplate, ANIM_TARGET, 2, 0x1e, 0xf, 0x0, 0xa, 0xa waitforvisualfinish loopsewithpan SE_M_ICY_WIND, SOUND_PAN_TARGET, 0xb, 0x3 - createvisualtask AnimTask_ShakeMon, 0x5, 0x1, 0x0, 0x3, 0x19, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 3, 25, 1 createsprite gFrostBreathBlueRageTemplate, ANIM_TARGET, 66, 0x1, 0x5, 0x0 delay 0x1 createsprite gFrostBreathBlueRageTemplate, ANIM_TARGET, 66, 0x1, 0xfff6, 0xfff1 @@ -6340,7 +6351,7 @@ Move_DRAGON_TAIL: createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0x0, 0x5 call TailWhackDown delay 0x3 - createvisualtask AnimTask_ShakeMonInPlace, 0x2, 0x1, 0x0, 0x3, 0x6, 0x1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 0, 3, 6, 1 waitforvisualfinish delay 0x5 createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_TARGET, 0x0, 0x6 @@ -6369,7 +6380,7 @@ Move_WORK_UP: createsprite gEndureEnergySpriteTemplate, ANIM_ATTACKER, 2, 0, -18, 26, 3 createsprite gEndureEnergySpriteTemplate, ANIM_ATTACKER, 2, 0, 18, 26, 3 delay 14 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 2, 2, 0, 11, RGB(31, 2, 4) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB(31, 2, 4) createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 createsprite gEndureEnergySpriteTemplate, ANIM_ATTACKER, 2, 0, -13, 26, 2 createsprite gEndureEnergySpriteTemplate, ANIM_ATTACKER, 2, 0, 13, 26, 2 @@ -6435,7 +6446,7 @@ Move_WILD_CHARGE: createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0x1a, 0x0, 0x0, 0x5 delay 0x6 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 4, 0xfff6, 0x0, 0x1, 0x0 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0, 0x3, 0x10, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 16, 1 playsewithpan SE_M_MEGA_KICK2, SOUND_PAN_TARGET call ElectricityEffect waitforvisualfinish @@ -6454,7 +6465,7 @@ Move_DRILL_RUN: setalpha 12, 8 fadetobg BG_FISSURE waitbgfadeout - createvisualtask AnimTask_PositionFissureBgOnBattler, 0x5, 0x1, 0x5, 0xffff + createvisualtask AnimTask_PositionFissureBgOnBattler, 5, ANIM_TARGET, 5, -1 createsprite gBowMonSpriteTemplate, ANIM_ATTACKER, 2, 0x0 playsewithpan SE_M_HEADBUTT, SOUND_PAN_ATTACKER waitforvisualfinish @@ -6463,8 +6474,8 @@ Move_DRILL_RUN: createsprite gHornHitSpriteTemplate, ANIM_TARGET, 4, 0x0, 0x0, 0xc waitforvisualfinish playse 0x14 - createvisualtask AnimTask_ShakeMonInPlace, 0x2, 0x0, 0x2, 0x0, 0x28, 0x1 - createvisualtask AnimTask_ShakeMonInPlace, 0x2, 0x1, 0xa, 0x0, 0x28, 0x1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_ATTACKER, 2, 0, 40, 1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 10, 0, 40, 1 createsprite gFlashingHitSplatSpriteTemplate, ANIM_TARGET, 3, 0x0, 0x0, 0x1, 0x3 playsewithpan SE_M_HORN_ATTACK, SOUND_PAN_TARGET delay 0x4 @@ -6513,13 +6524,13 @@ Move_DUAL_CHOP: playsewithpan SE_M_JUMP_KICK, SOUND_PAN_ATTACKER createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 0x4, 0x4 delay 0x6 - createvisualtask AnimTask_ShakeMon, 0x2, 0x1, 0x5, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 6, 1 createsprite gKarateChopSpriteTemplate, ANIM_ATTACKER, 2, 0xffe0, 0x0, 0x0, 0x0, 0xa, 0x1, 0x3, 0x0 @left createsprite gKarateChopSpriteTemplate, ANIM_ATTACKER, 2, 0x0515, 0x0, 0x0, 0x0, 0xa, 0x1, 0x3, 0x0 @right waitforvisualfinish playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET createsprite gDualChopImpactTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x1, 0x2 - createvisualtask AnimTask_ShakeMon, 0x5, 0x1, 0x4, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 4, 0, 6, 1 waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -6533,7 +6544,7 @@ Move_HEART_STAMP: delay 0x1E clearmonbg ANIM_TARGET playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon2, 0x83, 0x1, 0x4, 0x0, 0x5, 0x1 + createvisualtask AnimTask_ShakeMon2, 131, ANIM_TARGET, 4, 0, 5, 1 createvisualtask AnimTask_StretchTargetUp, 0x3 waitforvisualfinish end @@ -6546,7 +6557,7 @@ Move_HORN_LEECH: playsewithpan SE_M_HEADBUTT, SOUND_PAN_ATTACKER createsprite gHornLeechHornTemplate, ANIM_TARGET, 2, 0x0, 0x0, 0x25 waitforvisualfinish - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x5, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 6, 1 createsprite gFlashingHitSplatSpriteTemplate, ANIM_TARGET, 3, 0x0, 0x0, 0x1, 0x1 playsewithpan SE_M_HORN_ATTACK, SOUND_PAN_TARGET call GigaDrainAbsorbEffect @@ -6574,7 +6585,7 @@ Move_SACRED_SWORD: createsprite gSacredSwordBladesTemplate, ANIM_TARGET, 1, 0x0, 0xa, 0x0, 0xFF00, 0xA createsprite gSacredSwordCutTemplate, ANIM_ATTACKER, 2, 0x28, 0xffe0, 0x0 delay 0x5 - createvisualtask AnimTask_ShakeMon, 0x2, 0x1, 0x0, 0x3, 0xa, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 10, 1 waitforvisualfinish clearmonbg ANIM_TARGET blendoff @@ -6589,7 +6600,7 @@ Move_RAZOR_SHELL: playsewithpan SE_M_CUT, SOUND_PAN_TARGET createsprite gCuttingSliceSpriteTemplate, ANIM_ATTACKER, 1, 0x28, 0xffe0, 0x0 delay 0x5 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0, 0x3, 0xa, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 10, 1 waitforvisualfinish clearmonbg ANIM_TARGET waitforvisualfinish @@ -6605,12 +6616,12 @@ Move_HEAT_CRASH: createsprite gHeatCrashEruptionRockTemplate, ANIM_ATTACKER, 3, 0x0, 0xffe0, 0xf delay 0x13 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0xfff8, 0x1, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0, 0x4, 0x9, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 4, 9, 1 playsewithpan SE_M_MEGA_KICK2, SOUND_PAN_TARGET delay 0x5 createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 0xa, 0xfff8, 0x1, 0x1 playsewithpan SE_M_ROCK_THROW, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0, 0x3, 0x5, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 5, 1 createsprite gRockScatterSpriteTemplate, ANIM_TARGET, 2, 0xfff4, 0x20, 0x3, 0x4 createsprite gRockScatterSpriteTemplate, ANIM_TARGET, 2, 0x8, 0x1f, 0x2, 0x2 createsprite gRockScatterSpriteTemplate, ANIM_TARGET, 2, 0xfffc, 0x1c, 0x2, 0x3 @@ -6625,7 +6636,7 @@ Move_LEAF_TORNADO: monbg ANIM_DEF_PARTNER splitbgprio ANIM_TARGET playsewithpan SE_M_GUST, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 0x5, 0x1, 0x0, 0x2, 0x2f, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 2, 47, 1 createsprite gEllipticalGustSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0xfff0 createvisualtask AnimTask_AnimateGustTornadoPalette, 0x5, 0x1, 0x46 call LeafTornadoVortex @@ -6733,7 +6744,7 @@ Move_NIGHT_DAZE: delay 0x1 createsprite gNightDazeVioletRingsTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x0, 0x0, 0x1F, 0x8 waitforvisualfinish - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 0x1f, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 31, 1 createvisualtask AnimTask_BlendBattleAnimPal, 0xA, F_PAL_TARGET, 0x2, 0x0, 0x9, 0x2002 delay 0x6 playsewithpan SE_M_SUPERSONIC, SOUND_PAN_ATTACKER @@ -6748,7 +6759,7 @@ Move_PSYSTRIKE: monbg ANIM_TARGET setalpha 8, 8 createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 10, 1 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 0, 2, 0, 8, RGB_RED + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 2, 0, 8, RGB_RED waitforvisualfinish createvisualtask AnimTask_InvertScreenColor, 2, 0x1 | 0x2 | 0x4 loopsewithpan SE_M_SUPERSONIC, SOUND_PAN_TARGET, 10, 3 @@ -6769,7 +6780,7 @@ Move_TAIL_SLAP: setalpha 12, 8 choosetwoturnanim TailSlapRight TailSlapLeft TailSlapContinue: - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET waitforvisualfinish clearmonbg ANIM_TARGET @@ -6792,7 +6803,7 @@ Move_HURRICANE: createvisualtask AnimTask_StartSlidingBg, 0x5, 0x1000, 0x0, 0x1, 0xffff waitbgfadein playsewithpan SE_M_GUST, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0, 0x3, 0x40, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 64, 1 call HurricaneGust delay 0xA call HurricaneGust @@ -6825,8 +6836,8 @@ Move_HEAD_CHARGE: delay 0x2 createsprite gBowMonSpriteTemplate, ANIM_ATTACKER, 2, 0x1 waitforvisualfinish - createvisualtask AnimTask_ShakeMon, 0x2, 0x0, 0x2, 0x0, 0x4, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x5, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_ATTACKER, 2, 0, 4, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 6, 1 createsprite gBowMonSpriteTemplate, ANIM_ATTACKER, 2, 0x2 createsprite gFlashingHitSplatSpriteTemplate, ANIM_TARGET, 3, 0x0, 0x0, 0x1, 0x1 playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET @@ -6845,13 +6856,13 @@ Move_GEAR_GRIND: createsprite gGearGrindTemplate, ANIM_ATTACKER, 2, 0x20, 0x20, 0x0, 0xfccd, 0xfccd, 0xa delay 0xa createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0xfff8, 0x0, 0x1, 0x1 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_TARGET, 0x0, 0x7, 0x5, 0x2 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 7, 5, 2 waitforvisualfinish createsprite gGearGrindTemplate, ANIM_ATTACKER, 2, 0x20, 0xffe0, 0x0, 0xfccd, 0x333, 0xa createsprite gGearGrindTemplate, ANIM_ATTACKER, 2, 0xffe0, 0x20, 0x0, 0x333, 0xfccd, 0xa delay 0xa createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0x8, 0x0, 0x1, 0x1 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_TARGET, 0x0, 0x8, 0x4, 0x2 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 8, 4, 2 waitforvisualfinish stopsound clearmonbg ANIM_TARGET @@ -6870,7 +6881,7 @@ Move_SEARING_SHOT: setalpha 8, 8 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x0, 0x10, 0x0 waitforvisualfinish - createvisualtask AnimTask_ElectricChargingParticles, 0x2, 0x0, 0x3c, 0x2, 0xc + createvisualtask AnimTask_ElectricChargingParticles, 2, ANIM_ATTACKER, 60, 2, 12 createvisualtask AnimTask_BlendBattleAnimPal, 0xA, F_PAL_ATTACKER, 0x2, 0x0, 0x9, 0x1F playsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER delay 0x1e @@ -6923,9 +6934,9 @@ Move_SEARING_SHOT: monbg ANIM_ATK_PARTNER createvisualtask AnimTask_BlendBattleAnimPal, 0xA, F_PAL_ADJACENT, 0x2, 0x0, 0x9, 0x1F playsewithpan SE_M_EXPLOSION, SOUND_PAN_ATTACKER - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 0x1B, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_DEF_PARTNER, 0x3, 0x0, 0x1B, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_ATK_PARTNER, 0x3, 0x0, 0x1B, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 27, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_DEF_PARTNER, 3, 0, 27, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_ATK_PARTNER, 3, 0, 27, 1 playsewithpan SE_M_FIRE_PUNCH, SOUND_PAN_TARGET createsprite gSearingShotEruptionImpactTemplate, ANIM_TARGET, 3, -5, -5, 0x1, 0x1E, ANIM_TARGET createsprite gSearingShotEruptionImpactTemplate, ANIM_TARGET, 3, 5, 10, 0x1, 0x1E, ANIM_TARGET @@ -7006,7 +7017,7 @@ TechnoBlastNormal: createsprite gTechnoBlastWhiteSparkTemplate, ANIM_TARGET, 4, 0xa, 0x0, 0x8, 0x1e, 0xe0, 0x28, 0x2 waitforvisualfinish playsewithpan SE_M_EMBER, SOUND_PAN_ATTACKER - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x4, 0x0, 0x5, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 5, 1 createsprite gTechnoBlastWhiteSmokeTemplate, ANIM_TARGET, 2, 0x8, 0x8, 0x1, 0x0 delay 0x2 createsprite gTechnoBlastWhiteSmokeTemplate, ANIM_TARGET, 2, 0xfff8, 0xfff8, 0x1, 0x0 @@ -7092,7 +7103,7 @@ TechnoBlastElectric: createsprite gTechnoBlastYellowSparkTemplate, ANIM_TARGET, 4, 0xa, 0x0, 0x8, 0x1e, 0xe0, 0x28, 0x2 waitforvisualfinish playsewithpan SE_M_EMBER, SOUND_PAN_ATTACKER - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x4, 0x0, 0x5, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 5, 1 createsprite gTechnoBlastYellowSmokeTemplate, ANIM_TARGET, 2, 0x8, 0x8, 0x1, 0x0 createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 0x5, 0x0, 0x5, 0x0 createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 0xfffb, 0xa, 0x5, 0x1 @@ -7226,7 +7237,7 @@ TechnoBlastWater: createsprite gTechnoBlastBlueSparkTemplate, ANIM_TARGET, 4, 0xa, 0x0, 0x8, 0x1e, 0xe0, 0x28, 0x2 waitforvisualfinish playsewithpan SE_M_EMBER, SOUND_PAN_ATTACKER - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x4, 0x0, 0x5, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 5, 1 createsprite gTechnoBlastBlueSmokeTemplate, ANIM_TARGET, 2, 0x8, 0x8, 0x1, 0x0 createsprite gTechnoBlastBlueBubbleTemplate, ANIM_ATTACKER, 2, 0xa, 0xa, 0x19, 0x1 createsprite gTechnoBlastBlueBubbleTemplate, ANIM_ATTACKER, 2, 0xfff1, 0x0, 0x19, 0x1 @@ -7279,7 +7290,7 @@ TechnoBlastFire: createsprite gTechnoBlastRedSparkTemplate, ANIM_TARGET, 4, 0xa, 0x0, 0x8, 0x1e, 0xe0, 0x28, 0x2 waitforvisualfinish playsewithpan SE_M_EMBER, SOUND_PAN_ATTACKER - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x4, 0x0, 0x5, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 5, 1 createsprite gTechnoBlastRedSmokeTemplate, ANIM_TARGET, 2, 0x8, 0x8, 0x1, 0x0 createsprite gFireSpreadSpriteTemplate, ANIM_TARGET, 1, 0, 10, 192, 176, 40 createsprite gFireSpreadSpriteTemplate, ANIM_TARGET, 1, 0, 10, -192, 240, 40 @@ -7363,7 +7374,7 @@ TechnoBlastIce: createsprite gTechnoBlastIceSparkTemplate, ANIM_TARGET, 4, 0xa, 0x0, 0x8, 0x1e, 0xe0, 0x28, 0x2 waitforvisualfinish playsewithpan SE_M_EMBER, SOUND_PAN_ATTACKER - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x4, 0x0, 0x5, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 5, 1 createsprite gTechnoBlastIceSmokeTemplate, ANIM_TARGET, 2, 0x8, 0x8, 0x1, 0x0 createsprite gIceCrystalHitLargeSpriteTemplate, ANIM_TARGET, 2, 0xfff6, 0xfff6, 0x0 delay 0x2 @@ -7415,7 +7426,7 @@ Move_RELIC_SONG: monbg ANIM_DEF_PARTNER createvisualtask AnimTask_MusicNotesRainbowBlend, 0x2 waitforvisualfinish - createvisualtask SoundTask_PlayCryWithEcho, 2, ANIM_ATTACKER, 2 + createvisualtask SoundTask_PlayCryWithEcho, 2, FALSE createvisualtask AnimTask_UproarDistortion, 0x2, 0x0 createsprite gUproarRingSpriteTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x0, 0x0, 0x1f, 0x8 createsprite gJaggedMusicNoteSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x1d, 0xfff4, 0x0 @@ -7471,8 +7482,8 @@ Move_RELIC_SONG: waitforvisualfinish createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 0xffe0, 0xfff0, 0x1, 0x3 playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMonInPlace, 0x2, 0x1, 0x3, 0x0, 0xc, 0x1 - createvisualtask AnimTask_ShakeMonInPlace, 0x2, 0x3, 0x3, 0x0, 0xc, 0x1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 3, 0, 12, 1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_DEF_PARTNER, 3, 0, 12, 1 delay 0x5 createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, 0x1, 0x3 playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET @@ -7508,7 +7519,7 @@ Move_SECRET_SWORD: createsprite gSecretSwordBladesTemplate, ANIM_TARGET, 1, 0x0, 0xa, 0x0, 0xFF00, 0xA createsprite gCuttingSliceSpriteTemplate, ANIM_ATTACKER, 2, 0x28, 0xffe0, 0x0 delay 0x5 - createvisualtask AnimTask_ShakeMon, 0x2, 0x1, 0x0, 0x3, 0xa, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 10, 1 waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x0, 0x10, 0x0, 0x0 waitforvisualfinish @@ -7557,7 +7568,7 @@ Move_BOLT_STRIKE:: setalpha 12, 8 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x0, 0x10, 0x0 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x2, 0x0, 0x9, 0x07FE - createvisualtask AnimTask_ElectricChargingParticles, 0x2, 0x0, 0x40, 0x0, 0x2 + createvisualtask AnimTask_ElectricChargingParticles, 2, ANIM_ATTACKER, 64, 0, 2 playsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER delay 0xc createsprite gGrowingShockWaveOrbSpriteTemplate, ANIM_ATTACKER, 2 @@ -7565,7 +7576,7 @@ Move_BOLT_STRIKE:: clearmonbg ANIM_ATTACKER playsewithpan SE_M_SWAGGER, SOUND_PAN_ATTACKER waitplaysewithpan SE_M_SWAGGER, SOUND_PAN_ATTACKER, 0x8 - createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 0x2, 0x0, 0x12, 0x6, 0x2, 0x4 + createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 18, 6, 2, 4 delay 0xA fadetobg BG_BOLT_STRIKE waitbgfadeout @@ -7575,7 +7586,7 @@ Move_BOLT_STRIKE:: delay 0x6 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 4, 0xfff6, 0x0, 0x1, 0x0 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x2, 0x0, 0x9, 0x07FE - createvisualtask AnimTask_ShakeMon2, 0x2, ANIM_TARGET, 0x2, 0x0, 0x20, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 32, 1 playsewithpan SE_M_TRI_ATTACK2, SOUND_PAN_TARGET call ElectricityEffect createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0x0, 0x5 @@ -7666,7 +7677,7 @@ Move_FIERY_DANCE:: createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x0, 0xc, 0x14be waitforvisualfinish playsewithpan SE_M_SACRED_FIRE2, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_TARGET, 0x0, 0x2, 0x40, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 2, 64, 1 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x1, 0x0, 0x9, 0x1f call FireSpinEffect call FireSpinEffect @@ -7688,7 +7699,7 @@ Move_FREEZE_SHOCK:: loadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT @Electric Circle choosetwoturnanim FreezeShockCharge FreezeShockAttack FreezeShockCharge: - createvisualtask AnimTask_HorizontalShake, 0x5, 0x0, 0x2, 0x10 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_ATTACKER, 2, 16 playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_TARGET createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x1, 0x0, 0xf, 0x7fff createsprite gFreezeShockCircleTemplate, ANIM_ATTACKER, 2 @electric circle @@ -7712,7 +7723,7 @@ FreezeShockAttack: createsprite gZapCannonSparkSpriteTemplate, ANIM_TARGET, 4, 0xa, 0x0, 0x8, 0x1e, 0xa0, 0x28, 0x0 createsprite gZapCannonSparkSpriteTemplate, ANIM_TARGET, 4, 0xa, 0x0, 0x8, 0x1e, 0xe0, 0x28, 0x2 waitforvisualfinish - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x4, 0x0, 0x5, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 5, 1 delay 0xf waitplaysewithpan SE_M_THUNDERBOLT2, SOUND_PAN_TARGET, 0x13 call ElectricityEffect @@ -7735,7 +7746,7 @@ IceBurnCharge: waitforvisualfinish loopsewithpan SE_M_ICY_WIND, SOUND_PAN_TARGET, 0x4, 0x3 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x1, 0x8, 0x0, 0x0 - createvisualtask AnimTask_HorizontalShake, 0x5, 0x0, 0x2, 0x10 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_ATTACKER, 2, 16 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x1, 0x0, 0xf, 0x7fff delay 0x14 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x1, 0xf, 0x0, 0x7fff @@ -7815,8 +7826,8 @@ Move_SNARL:: waitforvisualfinish createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 0xffe0, 0xfff0, 0x1, 0x3 playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMonInPlace, 0x2, 0x1, 0x3, 0x0, 0xc, 0x1 - createvisualtask AnimTask_ShakeMonInPlace, 0x2, 0x3, 0x3, 0x0, 0xc, 0x1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 3, 0, 12, 1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_DEF_PARTNER, 3, 0, 12, 1 delay 0x4 createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, 0x1, 0x3 playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET @@ -7848,7 +7859,7 @@ Move_ICICLE_CRASH:: delay 0x2 createsprite gIcicleCrashSpearTemplate, ANIM_TARGET, 2, 0xffe9, 0x0, 0xfff6, 0x1 playsewithpan SE_M_ICY_WIND, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0, 0x5, 0x32, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 5, 50, 1 delay 0x2 call LaunchIcicleCrashSpear call LaunchIcicleCrashSpear @@ -7921,9 +7932,9 @@ Move_V_CREATE:: createvisualtask AnimTask_StartSlidingBg, 0x5, 0xA00, 0x0, 0x1, 0xffff waitbgfadein playsewithpan SE_M_TAKE_DOWN, SOUND_PAN_ATTACKER - createvisualtask AnimTask_WindUpLunge, 0x5, 0x0, 0xffe8, 0x8, 0x17, 0xa, 0x28, 0xa + createvisualtask AnimTask_WindUpLunge, 5, ANIM_ATTACKER, -24, 8, 23, 10, 40, 10 delay 0x23 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0, 0x5, 0x32, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 5, 50, 1 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x2, 0x0, 0x9, 0x1f playsewithpan SE_M_EXPLOSION, SOUND_PAN_ATTACKER createsprite gExplosionSpriteTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x1, 0x1 @@ -7944,7 +7955,7 @@ Move_V_CREATE:: createsprite gClawSlashSpriteTemplate, ANIM_TARGET, 2, 0xfff6, 0xfff6, 0x0 createsprite gClawSlashSpriteTemplate, ANIM_TARGET, 2, 0xa, 0xfff6, 0x1 waitforvisualfinish - createvisualtask AnimTask_ShakeMonInPlace, 0x2, 0x1, 0x4, 0x0, 0xc, 0x1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 4, 0, 12, 1 waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x2, 0x9, 0x0, 0x1f createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x2, 0x9, 0x0, 0x1f @@ -7977,8 +7988,8 @@ Move_FUSION_FLARE:: playsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER call FusionFlareBuff delay 0x8 - createvisualtask AnimTask_BlendColorCycle, 0x2, F_PAL_ATTACKER, 0x2, 0x2, 0x0, 0xb, 0x1F - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x20, 0x1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB_RED + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 createsprite gVerticalDipSpriteTemplate, ANIM_ATTACKER, 2, 0x8, 0x1, 0x0 delay 0x8 playsewithpan SE_M_SWAGGER, SOUND_PAN_ATTACKER @@ -7991,7 +8002,7 @@ Move_FUSION_FLARE:: createsprite gFusionFlareRedBubblesTemplate, ANIM_ATTACKER, 66, 0x50, 0x3c, 0xa, 0x3, 0x14, 0x32, 0x0 createsprite gFusionFlareRedBubblesTemplate, ANIM_ATTACKER, 66, 0x8c, 0x64, 0x10, 0x1, 0x14, 0x1e, 0x1 delay 0x29 - createvisualtask AnimTask_BlendColorCycle, 0x2, F_PAL_TARGET, 0x2, 0x2, 0x0, 0xb, 0x1F + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 11, RGB_RED delay 0x5 createsprite gFusionFlareRedRingTemplate, ANIM_ATTACKER, 3, 0x1, 0x1, 0x1, 0x1, 0x1F, 0x8 createsprite gFusionFlareRedBubblesTemplate, ANIM_ATTACKER, 66, 0x64, 0x64, 0x8, 0x1, 0x14, 0x28, 0x0 @@ -7999,7 +8010,7 @@ Move_FUSION_FLARE:: createsprite gFusionFlareRedBubblesTemplate, ANIM_ATTACKER, 66, 0xc8, 0x50, 0x8, 0x1, 0x28, 0x14, 0x0 createsprite gFusionFlareRedBubblesTemplate, ANIM_ATTACKER, 66, 0x50, 0x3c, 0xa, 0x3, 0x14, 0x32, 0x0 createsprite gFusionFlareRedBubblesTemplate, ANIM_ATTACKER, 66, 0x8c, 0x64, 0x10, 0x1, 0x14, 0x1e, 0x1 - createvisualtask AnimTask_HorizontalShake, 0x5, 0x1, 0x2, 0x10 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 2, 16 delay 0x5 playsewithpan SE_M_EXPLOSION, SOUND_PAN_ATTACKER waitforvisualfinish @@ -8049,7 +8060,7 @@ Move_FUSION_BOLT:: createsprite gFusionBoltBallTemplate, ANIM_TARGET, 2, 0x10 playsewithpan SE_M_THUNDERBOLT, SOUND_PAN_ATTACKER delay 0x8 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0xa, 0x0, 0x12, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 10, 0, 18, 1 playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET createsprite gElectricPuffSpriteTemplate, ANIM_ATTACKER, 2, 0x1, 0x10, 0x10 delay 0x2 @@ -8057,7 +8068,7 @@ Move_FUSION_BOLT:: delay 0x8 createvisualtask AnimTask_VoltTackleAttackerReappear, 0x5 waitforvisualfinish - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x3, 0x0, 0x9, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 3, 0, 9, 1 playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER createsprite gElectricPuffSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x10, 0x10 delay 0x2 @@ -8139,7 +8150,7 @@ Move_BELCH:: playsewithpan SE_SUCCESS, SOUND_PAN_ATTACKER createsprite gBelchBerryTemplate, ANIM_ATTACKER, 2, 0x14, 0xfff8, 0xfff8, 0xfff8, 0x14, 0xffe0 delay 0x13 - createvisualtask AnimTask_ShakeMonInPlace, 0x2, 0x1, 0xa, 0x0, 0x14, 0x1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 10, 0, 20, 1 playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET createsprite gExplosionSpriteTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x1, 0x1 delay 0x6 @@ -8170,10 +8181,10 @@ Move_ROTOTILLER:: waitforvisualfinish createsprite gDirtMoundSpriteTemplate, ANIM_ATTACKER, 1, 0x0, 0x0, 0xb4 createsprite gDirtMoundSpriteTemplate, ANIM_ATTACKER, 1, 0x0, 0x1, 0xb4 - createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 0x2, 0x0, 0x6, 0x4, 0x2, 0x4 + createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 6, 4, 2, 4 call DigThrowDirt call DigThrowDirt - createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 0x2, 0x0, 0x6, 0x4, 0x2, 0x4 + createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 6, 4, 2, 4 call DigThrowDirt call DigThrowDirt waitforvisualfinish @@ -8362,7 +8373,7 @@ Move_FORESTS_CURSE: createsprite gForestsCurseIngrainTemplate, ANIM_ATTACKER, 66, 0x8c, 0x64, 0x10, 0x1, 0x14, 0x1e, 0x1 waitforvisualfinish createsprite gCurseGhostSpriteTemplate, ANIM_TARGET, 2 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x2, 0x0, 0xe, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 14, 1 waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x2, 0x8, 0x0, 0x02E3 delay 0x3 @@ -8401,9 +8412,9 @@ Move_PETAL_BLIZZARD:: waitforvisualfinish createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 0xffe0, 0xfff0, 0x1, 0x3 playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMonInPlace, 0x2, ANIM_TARGET, 0x3, 0x0, 0xC, 0x1 - createvisualtask AnimTask_ShakeMonInPlace, 0x2, ANIM_DEF_PARTNER, 0x3, 0x0, 0xC, 0x1 - createvisualtask AnimTask_ShakeMonInPlace, 0x2, ANIM_ATK_PARTNER, 0x3, 0x0, 0xC, 0x1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 3, 0, 12, 1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_DEF_PARTNER, 3, 0, 12, 1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_ATK_PARTNER, 3, 0, 12, 1 delay 0x4 createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, 0x1, 0x3 playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET @@ -8458,11 +8469,11 @@ Move_DISARMING_VOICE:: loadspritegfx ANIM_TAG_NOISE_LINE createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x0, 0x8, 0x6e7d waitforvisualfinish - createvisualtask SoundTask_PlayDoubleCry, 0x2, 0x0, 0xff + createvisualtask SoundTask_PlayDoubleCry, 2, ANIM_ATTACKER, DOUBLE_CRY_GROWL call RoarEffect delay 0xA - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x1, 0x0, 0x1A, 0x1 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x3, 0x1, 0x0, 0x1A, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 1, 0, 26, 1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_DEF_PARTNER, 1, 0, 26, 1 waitforvisualfinish createvisualtask SoundTask_WaitForCry, 0x5 waitforvisualfinish @@ -8475,7 +8486,7 @@ Move_PARTING_SHOT: fadetobg BG_DARK waitbgfadein delay 0 - createvisualtask SoundTask_PlayDoubleCry, 2, 0, 255 + createvisualtask SoundTask_PlayDoubleCry, 2, ANIM_ATTACKER, DOUBLE_CRY_GROWL call RoarEffect delay 10 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 1, 0, 9, 1 @@ -8733,7 +8744,7 @@ Move_ELECTRIFY:: monbg ANIM_DEF_PARTNER playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_TARGET createsprite gElectrifyYellowRingTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x1, 0x0, 0x1f, 0x8 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_TARGET, 0x4, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 4, 0, 6, 1 createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 0x5, 0x0, 0x5, 0x0 delay 0x1 createsprite gElectrifyYellowRingTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x1, 0x0, 0x1f, 0x8 @@ -8762,7 +8773,7 @@ Move_PLAY_ROUGH:: loadspritegfx ANIM_TAG_IMPACT loadspritegfx ANIM_TAG_PINK_HEART loadspritegfx ANIM_TAG_DUCK - monbg 0x3 + monbg ANIM_DEF_PARTNER setalpha 12, 8 playsewithpan SE_M_CRABHAMMER, SOUND_PAN_ATTACKER waitplaysewithpan SE_M_FLAMETHROWER, SOUND_PAN_TARGET, 0xa @@ -8826,7 +8837,7 @@ Move_FAIRY_WIND:: createsprite gFairyWindCloudTemplate, ANIM_TARGET, 3, 0x14, 0xfff6, 0x14, 0x5, 0x16, 0xffee, 0x1 delay 0x5 createsprite gFairyWindCloudTemplate, ANIM_TARGET, 3, 0x14, 0xfff6, 0x14, 0xfff6, 0x16, 0xf, 0x1 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x2, 0x0, 0x12, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 18, 1 delay 0x5 createsprite gFairyWindCloudTemplate, ANIM_TARGET, 3, 0x14, 0xfff6, 0x14, 0x0, 0x16, 0xffec, 0x1 delay 0x5 @@ -8868,7 +8879,7 @@ Move_BOOMBURST: loadspritegfx ANIM_TAG_EXPLOSION loadspritegfx ANIM_TAG_THIN_RING createvisualtask AnimTask_InvertScreenColor, 2, 0x1 | 0x4 | 0x8 | 0x10 - createvisualtask SoundTask_PlayCryWithEcho, 5 + createvisualtask SoundTask_PlayCryWithEcho, 5, FALSE createvisualtask AnimTask_ScaleMonAndRestore, 5, -5, -5, 5, ANIM_ATTACKER, 0 createsprite gHyperVoiceRingSpriteTemplate, ANIM_ATTACKER, 0, 45, 0, 0, 0, 0, 0, 1 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 1, 0, 6, 1 @@ -8945,14 +8956,14 @@ Move_KINGS_SHIELD:: Move_PLAY_NICE:: loadspritegfx ANIM_TAG_RED_HEART loopsewithpan SE_M_SANDSTORM, SOUND_PAN_ATTACKER, 0xc, 0x3 - createvisualtask AnimTask_SwayMon, 0x5, 0x0, 0xc, 0x1000, 0x4, 0x0 + createvisualtask AnimTask_SwayMon, 5, 0, 12, 4096, 4, ANIM_ATTACKER delay 0xF createsprite gRedHeartProjectileSpriteTemplate, ANIM_TARGET, 3, 0x14, 0xfff8 end Move_CONFIDE:: loadspritegfx ANIM_TAG_CONFIDE @Confide Bubble - createvisualtask AnimTask_Splash, 0x2, ANIM_ATTACKER, 0x3 + createvisualtask AnimTask_Splash, 2, ANIM_ATTACKER, 3 createsprite gConfideBubbleTemplate, ANIM_ATTACKER, 11, 0x0, 0x64 playsewithpan SE_M_METRONOME, SOUND_PAN_ATTACKER waitforvisualfinish @@ -9013,8 +9024,8 @@ Move_DIAMOND_STORM:: @this is the buffet part createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 0xffe0, 0xfff0, 0x1, 0x3 playsewithpan SE_M_ICY_WIND, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMonInPlace, 0x2, 0x1, 0x3, 0x0, 0xc, 0x1 - createvisualtask AnimTask_ShakeMonInPlace, 0x2, 0x3, 0x3, 0x0, 0xc, 0x1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 3, 0, 12, 1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_DEF_PARTNER, 3, 0, 12, 1 delay 0x4 createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, 0x1, 0x3 playsewithpan SE_M_ICY_WIND, SOUND_PAN_TARGET @@ -9043,7 +9054,7 @@ Move_STEAM_ERUPTION:: createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x1, 0x0, 0x9, 0x1f call SteamEruptionBreath delay 0x2 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x2, 0x0, 0x15, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 21, 1 call SteamEruptionBreath call SteamEruptionBreath call SteamEruptionBreath @@ -9120,7 +9131,7 @@ Move_HYPERSPACE_HOLE:: end HyperspaceHoleMovement: playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon2, 0x2, ANIM_TARGET, 0x3, 0x0, 0xf, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 3, 0, 15, 1 delay 0x4 return @@ -9152,8 +9163,8 @@ Move_MYSTICAL_FIRE:: loadspritegfx ANIM_TAG_FIRE setalpha 8, 8 playse 0xb1 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0xa, 0x1 - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x2, 0x0, 0x2, 0x0, 0x8, 0x7fff + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 10, 1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 2, 0, 8, RGB_WHITE waitforvisualfinish waitsound blendoff @@ -9222,7 +9233,7 @@ Move_AROMATIC_MIST:: call SweetScentEffect createsprite gSweetScentPetalSpriteTemplate, ANIM_ATTACKER, 2, 0x37, 0x0 setpan SOUND_PAN_TARGET - createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_DEF_SIDE, 1, 5, 5, 13, 0x56bf + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_DEF_SIDE, 1, 5, 5, 13, RGB(31, 21, 21) call SweetScentEffect waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x8, 0x0, 0x6E7D @@ -9357,7 +9368,7 @@ GeomancyChargeUp: createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x0, 0xC, 0x0 waitforvisualfinish playsewithpan SE_M_COSMIC_POWER, SOUND_PAN_ATTACKER - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_ATTACKER, 0x0, 0x2, 0x5f, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 0, 2, 95, 1 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x2, 0x0, 0x5, 0x1F call GeomancyRingBuff createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x2, 0x0, 0x5, 0x2C0 @@ -9436,7 +9447,7 @@ GeomancyUnleash: waitforvisualfinish playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x10, 0x10, 0x4D01 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_ATTACKER, 0x0, 0x2, 0x25, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 0, 2, 37, 1 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x2, 0x0, 0x5, 0x1F createsprite gGeomancyRedCellRaiseTemplate, ANIM_ATTACKER, 2, 0x14, 0x20, 0xffd0, 0x32, 0x1 createsprite gGeomancyGreenCellRaiseTemplate, ANIM_ATTACKER, 2, 0x0, 0x20, 0xffda, 0x19, 0x1 @@ -9585,7 +9596,7 @@ Move_DAZZLING_GLEAM:: createsprite gGrantingStarsSpriteTemplate, ANIM_ATTACKER, 2, 12, -5, 0, 0, 32, 60 delay 8 waitforvisualfinish - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x2, 0x0, 0x3, 0x0, 0x10, 0x7fff + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 3, 0, 16, RGB_WHITE delay 0x4 playsewithpan SE_M_GIGA_DRAIN, SOUND_PAN_ATTACKER waitforvisualfinish @@ -9610,7 +9621,7 @@ Move_HOLD_HANDS:: loadspritegfx ANIM_TAG_MAGENTA_HEART @charm loadspritegfx ANIM_TAG_VERTICAL_HEX @red playsewithpan SE_M_PETAL_DANCE, SOUND_PAN_ATTACKER - createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 0x2, 0x0, 0xc, 0x6, 0x6, 0x3 + createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 12, 6, 6, 3 createsprite gHoldHandsHeartTemplate, ANIM_ATTACKER, 2, 0x0, 0xffe8, 0x8, 0x8c delay 0x8 createsprite gHoldHandsHeartTemplate, ANIM_ATTACKER, 2, 0x0, 0xffe8, 0x8, 0x8c @@ -9636,14 +9647,14 @@ Move_HOLD_HANDS:: createsprite gHelpingHandClapSpriteTemplate, ANIM_ATTACKER, 40, 0x1 delay 0x13 playsewithpan SE_M_ENCORE, 0x0 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x2, 0x2, 0x0, 0x5, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATK_PARTNER, 2, 0, 5, 1 delay 0xe playsewithpan SE_M_ENCORE, 0x0 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x2, 0x2, 0x0, 0x5, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATK_PARTNER, 2, 0, 5, 1 delay 0x14 playsewithpan SE_M_ENCORE, 0x0 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x2, 0x3, 0x0, 0xa, 0x1 - createvisualtask AnimTask_BlendMonInAndOut, 0x2, 0x2, 0x3ff, 0xc, 0x1, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATK_PARTNER, 3, 0, 10, 1 + createvisualtask AnimTask_BlendMonInAndOut, 2, ANIM_ATK_PARTNER, RGB_YELLOW, 12, 1, 1 end Move_BABY_DOLL_EYES:: @@ -9657,11 +9668,11 @@ Move_BABY_DOLL_EYES:: createsprite gOpeningEyeSpriteTemplate, ANIM_ATTACKER, 5, 0x0, 0x0, 0x1, 0x0 delay 0x20 playsewithpan SE_M_LEER, SOUND_PAN_ATTACKER - createvisualtask AnimTask_ScaleMonAndRestore, 0x5, 0xfffb, 0xfffb, 0xa, 0x0, 0x1 + createvisualtask AnimTask_ScaleMonAndRestore, 5, -5, -5, 10, ANIM_ATTACKER, 1 waitforvisualfinish delay 0xa - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x1, 0x0, 0x9, 0x1 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x3, 0x1, 0x0, 0x9, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 1, 0, 9, 1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_DEF_PARTNER, 1, 0, 9, 1 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x0, 0xA, 0x0, 0x7FFF waitforvisualfinish clearmonbg ANIM_DEF_PARTNER @@ -9673,7 +9684,7 @@ Move_NUZZLE:: loadspritegfx ANIM_TAG_ITEM_BAG loadspritegfx ANIM_TAG_SPARK_2 loadspritegfx ANIM_TAG_IMPACT - createvisualtask AnimTask_RockMonBackAndForth, 0x5, 0x0, 0x2, 0x0 + createvisualtask AnimTask_RockMonBackAndForth, 5, ANIM_ATTACKER, 2, 0 createsprite gMagentaHeartSpriteTemplate, ANIM_ATTACKER, 3, 0x0, 0x14 playsewithpan SE_M_CHARM, SOUND_PAN_ATTACKER delay 0xf @@ -9701,7 +9712,7 @@ Move_HOLD_BACK:: playsewithpan SE_M_SWAGGER, SOUND_PAN_TARGET createsprite gHoldBackSwipeTemplate, ANIM_TARGET, 2, 0x0, 0x0, 0x1 waitforvisualfinish - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x3, 0x0, 0xa, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 3, 0, 10, 1 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x1, 0x2 createsprite gHoldBackRingTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x100, 0x0 createsprite gHoldBackStarsTemplate, ANIM_TARGET, 3, 0xfff0, 0xfff8, 0xa0, 0xffe0 @@ -9722,7 +9733,7 @@ Move_INFESTATION:: monbg ANIM_DEF_PARTNER splitbgprio ANIM_TARGET createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 0x2, 0x0, 0x9, 0x7320 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 0x4f, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 79, 1 loopsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER, 0x0, 0x4F call InfestationVortex call InfestationVortex @@ -9780,8 +9791,8 @@ Move_OBLIVION_WING:: createsoundtask SoundTask_LoopSEAdjustPanning, 0x7, 0xf0, 0xffc0, SOUND_PAN_TARGET, 0x1, 0xf, 0x0, 0x5 call OblivionWingBeam call OblivionWingBeam - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0, 0x3, 40, 0x1 - createvisualtask AnimTask_BlendColorCycle, 0x2, F_PAL_TARGET, 0x2, 0x4, 0x0, 0xc, 0x289F @Pinkish Red + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 40, 1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 4, 0, 12, RGB(31, 4, 10) @Pinkish Red call OblivionWingBeam call OblivionWingBeam call OblivionWingBeam @@ -9836,8 +9847,8 @@ Move_THOUSAND_ARROWS:: playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER waitforvisualfinish delay 0x30 - createvisualtask AnimTask_HorizontalShake, 0x5, 0x5, 0xa, 0x32 - createvisualtask AnimTask_HorizontalShake, 0x5, 0x4, 0xa, 0x32 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 10, 0x32 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 10, 0x32 call ThousandArrowsDown call ThousandArrowsDown call ThousandArrowsDown @@ -10037,9 +10048,9 @@ Move_LANDS_WRATH:: fadetobg BG_FISSURE waitbgfadeout playsewithpan SE_M_EARTHQUAKE, 0x0 - createvisualtask AnimTask_HorizontalShake, 0x5, 0x5, 0xa, 0x32 - createvisualtask AnimTask_HorizontalShake, 0x5, 0x4, 0xa, 0x32 - createvisualtask AnimTask_PositionFissureBgOnBattler, 0x5, 0x1, 0x5, 0xffff + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 10, 0x32 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 10, 0x32 + createvisualtask AnimTask_PositionFissureBgOnBattler, 5, ANIM_TARGET, 5, -1 waitbgfadein waitforvisualfinish call UnsetPsychicBg @@ -10071,17 +10082,17 @@ Move_LIGHT_OF_RUIN:: loadspritegfx ANIM_TAG_EXPLOSION @explosion createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_ELECTRIC_ORBS, 0, 0xC, 0xC, 0x6DDE @Pink waitforvisualfinish - createvisualtask AnimTask_ElectricChargingParticles, 0x2, 0x0, 0x14, 0x0, 0x2 + createvisualtask AnimTask_ElectricChargingParticles, 2, ANIM_ATTACKER, 20, 0, 2 panse SE_M_SOLAR_BEAM, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 0x2, 0x0 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x0, 0xF, 0x6B1F - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_ATTACKER, 0x0, 0x4, 0x32, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_ATTACKER, 0, 4, 50, 1 createvisualtask AnimTask_FlashAnimTagWithColor, 2, ANIM_TAG_ORBS, 1, 12, RGB_RED, 16, 0, 0 call LightOfRuinBeam call LightOfRuinBeam call LightOfRuinBeam call LightOfRuinBeam call LightOfRuinBeam - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x4, 0x0, 0x32, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 50, 1 call LightOfRuinBeam call LightOfRuinBeam call LightOfRuinBeam @@ -10109,7 +10120,7 @@ Move_LIGHT_OF_RUIN:: delay 0x2 createsprite gLightOfRuinPinkDischargeTemplate, ANIM_ATTACKER, 2, 0x1, 0xfff0, 0xfff0 delay 0x5 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_TARGET, 0x0, 0x5, 0xb, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 5, 11, 1 createsprite gLightOfRuinPinkExplosionTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x1, 0x1 delay 0x10 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x10, 0x0, 0x7FFF @@ -10204,9 +10215,9 @@ Move_PRECIPICE_BLADES:: setalpha 12, 8 fadetobg 0x15 waitbgfadeout - createvisualtask AnimTask_PositionFissureBgOnBattler, 0x5, 0x1, 0x5, 0xffff - createvisualtask AnimTask_HorizontalShake, 0x5, 0x5, 0xa, 0x5 - createvisualtask AnimTask_HorizontalShake, 0x5, 0x4, 0xa, 0x5 + createvisualtask AnimTask_PositionFissureBgOnBattler, 5, ANIM_TARGET, 5, -1 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 10, 0x5 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 10, 0x5 playsewithpan SE_M_EARTHQUAKE, 0x0 createvisualtask AnimTask_IsTargetPlayerSide, 0x2 jumpargeq 0x7, ANIM_TARGET, PrecipiceBladesOpponent @@ -10280,7 +10291,7 @@ Move_DRAGON_ASCENT:: playsewithpan SE_M_MEGA_KICK2, SOUND_PAN_TARGET createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 4, -10, 0, 1, 0 createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 0x1, -32, 0, 0, 3 - createvisualtask AnimTask_ShakeMonInPlace, 0x2, ANIM_TARGET, 6, 0, 12, 1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 6, 0, 12, 1 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, (F_PAL_ATTACKER | F_PAL_BG | F_PAL_ANIM_1 | F_PAL_ANIM_2), 2, 16, 0, RGB(26, 31, 0) waitforvisualfinish delay 3 @@ -10316,7 +10327,7 @@ Move_HYPERSPACE_FURY:: createvisualtask AnimTask_SetPsychicBackground, 0x5 waitbgfadein loopsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET, 0x2, 0x10 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0, 0x3, 0x20, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 32, 1 createsprite gHyperspaceFuryHandTemplate, ANIM_TARGET, 2, 0x1, 0x0, 0x0, 0xffe0, 0x10 call HyperspaceFuryRandomImpact delay 0x2 @@ -10355,9 +10366,9 @@ Move_HYPERSPACE_FURY:: createsprite gHyperspaceFuryHandTemplate, ANIM_TARGET, 2, 0x1, 0x0, 0x10, 0x10, 0x10 call HyperspaceFuryRandomImpact delay 0x7 - createvisualtask SoundTask_PlayDoubleCry, 0x2, ANIM_ATTACKER, 0xff + createvisualtask SoundTask_PlayDoubleCry, 2, ANIM_ATTACKER, DOUBLE_CRY_GROWL visible ANIM_ATTACKER - createvisualtask AnimTask_ShakeMon2, 0x2, ANIM_TARGET, 0x0, 0x3, 0x20, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 0, 3, 32, 1 playsewithpan SE_M_FIRE_PUNCH, SOUND_PAN_TARGET invisible ANIM_ATTACKER call UnsetPsychicBg @@ -10408,7 +10419,7 @@ Move_FIRST_IMPRESSION:: createsprite gSprayWaterDropletSpriteTemplate, ANIM_TARGET, 5, 0x0, 0x1 playsewithpan SE_M_SKETCH, SOUND_PAN_TARGET createsprite gSprayWaterDropletSpriteTemplate, ANIM_TARGET, 5, 0x1, 0x1 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x4, 0x0, 0x5, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 5, 1 createvisualtask AnimTask_StretchTargetUp, 0x3 waitforvisualfinish delay 0x19 @@ -10421,7 +10432,7 @@ Move_FIRST_IMPRESSION:: delay 0x1 createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, ANIM_TARGET, 0xffe4, 0x0, 0x0, 0x3 waitforvisualfinish - createvisualtask AnimTask_ShakeMonInPlace, 0x2, 0x1, 0x4, 0x0, 0xc, 0x1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 4, 0, 12, 1 waitforvisualfinish delay 0xa createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0x0, 0x6 @@ -10468,7 +10479,7 @@ Move_SPIRIT_SHACKLE:: playsewithpan SE_M_RAZOR_WIND2, SOUND_PAN_ATTACKER createsprite gSpiritShackleArrowTemplate, ANIM_TARGET, 2, 0x10, 0x0, 0x0, 0x0, 0xf delay 0x8 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 0xa, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 10, 1 waitforvisualfinish loopsewithpan SE_SHINY, SOUND_PAN_ATTACKER, 0x1c, 0x2 createsprite gSpiritShackleChainTemplate, ANIM_TARGET, 2, 0xfff0, 0xfff0 @@ -10546,44 +10557,44 @@ Move_SPARKLING_ARIA:: end SparklingAriaRain: createsprite gSparklingAriaRainTemplate, ANIM_TARGET, 2, 0x1, 0xdc, 0x3c - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 0x6, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_DEF_PARTNER, 0x3, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_DEF_PARTNER, 3, 0, 6, 1 delay 0x2 createsprite gSparklingAriaBubbleRainTemplate, ANIM_TARGET, 2, 0x1, 0x3c, 0x64 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 0x6, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_DEF_PARTNER, 0x3, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_DEF_PARTNER, 3, 0, 6, 1 delay 0x2 createsprite gSparklingAriaRainTemplate, ANIM_TARGET, 2, 0x1, 0x8c, 0x37 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 0x6, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_DEF_PARTNER, 0x3, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_DEF_PARTNER, 3, 0, 6, 1 delay 0x2 createsprite gSparklingAriaRainTemplate, ANIM_TARGET, 2, 0x1, 0xb4, 0x32 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 0x6, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_DEF_PARTNER, 0x3, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_DEF_PARTNER, 3, 0, 6, 1 delay 0x2 createsprite gSparklingAriaRainTemplate, ANIM_TARGET, 2, 0x1, 0x14, 0x5a - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 0x6, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_DEF_PARTNER, 0x3, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_DEF_PARTNER, 3, 0, 6, 1 delay 0x2 createsprite gSparklingAriaBubbleRainTemplate, ANIM_TARGET, 2, 0x1, 0x5a, 0x5a - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 0x6, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_DEF_PARTNER, 0x3, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_DEF_PARTNER, 3, 0, 6, 1 delay 0x2 createsprite gSparklingAriaRainTemplate, ANIM_TARGET, 2, 0x1, 0xa0, 0x3c - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 0x6, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_DEF_PARTNER, 0x3, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_DEF_PARTNER, 3, 0, 6, 1 delay 0x2 createsprite gSparklingAriaRainTemplate, ANIM_TARGET, 2, 0x1, 0x1e, 0x5a - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 0x6, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_DEF_PARTNER, 0x3, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_DEF_PARTNER, 3, 0, 6, 1 delay 0x2 createsprite gSparklingAriaRainTemplate, ANIM_TARGET, 2, 0x1, 0x78, 0x3c - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 0x6, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_DEF_PARTNER, 0x3, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_DEF_PARTNER, 3, 0, 6, 1 delay 0x2 createsprite gSparklingAriaBubbleRainTemplate, ANIM_TARGET, 2, 0x1, 0xc8, 0x28 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 0x6, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_DEF_PARTNER, 0x3, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_DEF_PARTNER, 3, 0, 6, 1 delay 0x2 return SparklingAriaCharge: @@ -10763,7 +10774,7 @@ Move_HIGH_HORSEPOWER:: playsewithpan SE_M_MEGA_KICK2, SOUND_PAN_TARGET call SetImpactBackground createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x1, 0x0 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x4, 0x0, 0x16, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 22, 1 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x2, 0x0, 0x0, 0x7fff createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 0x1f, 0x3, 0x1, 0x0, 0x8, 0x0, 0x0 waitforvisualfinish @@ -10855,7 +10866,7 @@ SolarBladeUnleash: createvisualtask AnimTask_BlendBattleAnimPal 10, (F_PAL_BG | F_PAL_BATTLERS), 1, 0, 6, 0x7fff waitforvisualfinish playsewithpan SE_M_SWORDS_DANCE, SOUND_PAN_ATTACKER - createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 0x2, 0x0, 0x10, 0x6, 0x1, 0x4 + createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 16, 6, 1, 4 createsprite gSwordsDanceBladeSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0 call SolarBladeSunRays call SolarBladeSunRays @@ -10867,7 +10878,7 @@ SolarBladeUnleash: playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET createsprite gSolarBladeImpactTemplate, ANIM_TARGET, 2, 0x0, 0x0, 0x1 delay 0x2 - createvisualtask AnimTask_ShakeMon2, 0x2, ANIM_TARGET, 0x2, 0x0, 0xC, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 12, 1 waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal 10, (F_PAL_BG | F_PAL_BATTLERS), 1, 6, 0, 0x7fff waitforvisualfinish @@ -11048,7 +11059,7 @@ Move_THROAT_CHOP:: delay 0x3 createsprite gThroatChopRedImpactTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x1, 0x2 playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_TARGET, 0x4, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 4, 0, 6, 1 waitforvisualfinish createvisualtask AnimTask_InvertScreenColor, 0x2, 0x101, 0x101, 0x101 waitforvisualfinish @@ -11071,7 +11082,7 @@ PollenPuffOpponent: setalpha 12, 8 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x0, 0x8, 0x0 waitforvisualfinish - createvisualtask AnimTask_RockMonBackAndForth, 0x5, 0x0, 0x2, 0x0 + createvisualtask AnimTask_RockMonBackAndForth, 5, ANIM_ATTACKER, 2, 0 createsprite gPollenPuffPinkStarTemplate, ANIM_ATTACKER, 2, 0xa, 0xa, 0x19, 0x0 playsewithpan SE_M_MORNING_SUN, SOUND_PAN_ATTACKER delay 0xD @@ -11100,7 +11111,7 @@ PollenPuffOpponent: createsprite gPollenPuffSporeTemplate, ANIM_TARGET, 2, 0xa, 0x0, 0x0, 0x0, 0x19, 0xffe0 waitforvisualfinish playsewithpan SE_M_EXPLOSION, SOUND_PAN_ATTACKER - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 createsprite gPollenPuffImpactTemplates, ANIM_TARGET, 2, 0x1, 0x1, 0x0, 0xFFE0, 0x10 @up createsprite gPollenPuffImpactTemplates, ANIM_TARGET, 2, 0x1, 0x1, 0xFFEE, 0xFFEE, 0x10 @upperleft createsprite gPollenPuffImpactTemplates, ANIM_TARGET, 2, 0x1, 0x1, 0x0, 0x1C, 0x10 @down @@ -11127,7 +11138,7 @@ PollenPuffAlly: setalpha 12, 8 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x0, 0x8, 0x0 waitforvisualfinish - createvisualtask AnimTask_RockMonBackAndForth, 0x5, 0x0, 0x2, 0x0 + createvisualtask AnimTask_RockMonBackAndForth, 5, ANIM_ATTACKER, 2, 0 createsprite gPollenPuffPinkStarTemplate, ANIM_ATTACKER, 2, 0xa, 0xa, 0x19, 0x0 playsewithpan SE_M_MORNING_SUN, SOUND_PAN_ATTACKER delay 0xD @@ -11180,9 +11191,9 @@ Move_ANCHOR_SHOT:: createsprite gAnchorShotAngledAnchorTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x35 waitforvisualfinish createsprite gAnchorShotAnchorTemplate, ANIM_ATTACKER, 3, 0x0, 0xffe0, 0xf - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0, 0x3, 0xf, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 15, 1 delay 0x25 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0, 0x3, 0xf, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 15, 1 waitforvisualfinish loopsewithpan SE_SHINY, SOUND_PAN_ATTACKER 0x1c 0x2 createsprite gAnchorShotChainTemplate, ANIM_TARGET, 2, 0xfff0, 0xfff0 @@ -11240,7 +11251,7 @@ Move_LUNGE:: loadspritegfx ANIM_TAG_RAZOR_LEAF @green loadspritegfx ANIM_TAG_SMALL_BUBBLES @ball monbg ANIM_ATK_PARTNER - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_ATTACKER, 0x3, 0x0, 0xf0, 0x0 + createvisualtask AnimTask_ShakeMon, 2, ANIM_ATTACKER, 3, 0, 240, 0 loopsewithpan SE_M_PSYBEAM2, SOUND_PAN_ATTACKER, 0xe, 0xa createsprite gLungeGreenChargeTemplate, ANIM_ATTACKER, 2 delay 0x6e @@ -11261,7 +11272,7 @@ Move_LUNGE:: createsprite gTealAlertSpriteTemplate, ANIM_ATTACKER, 4, 0xffce, 0xffd8, 0x6 createsprite gTealAlertSpriteTemplate, ANIM_ATTACKER, 4, 0xffd8, 0x28, 0x6 createsprite gTealAlertSpriteTemplate, ANIM_ATTACKER, 4, 0x32, 0xffce, 0x6 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_TARGET, 0x0, 0x5, 0xb, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 5, 11, 1 delay 0x2 createsprite gTealAlertSpriteTemplate, ANIM_ATTACKER, 4, 0x32, 0xffe2, 0x6 createsprite gTealAlertSpriteTemplate, ANIM_ATTACKER, 4, 0x3c, 0xa, 0x6 @@ -11311,15 +11322,15 @@ Move_FIRE_LASH:: waitforvisualfinish createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0x18, 0x0, 0x0, 0x6 delay 0x4 - createvisualtask AnimTask_ShakeMon, 0x2, 0x1, 0x5, 0x0, 0x8, 0x1 - createvisualtask AnimTask_BlendMonInAndOut, 0x3, 0x1, 0x1f, 0xc, 0x1, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 8, 1 + createvisualtask AnimTask_BlendMonInAndOut, 3, ANIM_TARGET, RGB_RED, 12, 1, 1 playsewithpan SE_M_FLAME_WHEEL2, SOUND_PAN_TARGET loadspritegfx ANIM_TAG_SLASH createsprite gSlashSliceSpriteTemplate, ANIM_TARGET, 2, 0x1, 0xfff8, 0x0 playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET delay 0x4 createsprite gSlashSliceSpriteTemplate, ANIM_TARGET, 2, 0x1, 0x8, 0x0 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x4, 0x0, 0x12, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 18, 1 playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET delay 0x7 createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0x0, 0x9 @@ -11336,23 +11347,23 @@ Move_POWER_TRIP:: playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER call PowerTripBuffUp delay 0x8 - createvisualtask AnimTask_BlendColorCycle, 0x2, F_PAL_ATTACKER, 0x2, 0x2, 0x0, 0xb, 0x0 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x20, 0x1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB_BLACK + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 call PowerTripBuffUp delay 0x8 call PowerTripBuffUp waitforvisualfinish playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET createsprite gPowerTripImpactTemplate, ANIM_ATTACKER, 2, 0xFFF5, 0xA, 0x1, 0x2 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 delay 0x5 playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET createsprite gPowerTripImpactTemplate, ANIM_ATTACKER, 2, 0x0, 0xFFF5, 0x1, 0x2 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 delay 0x5 playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET createsprite gPowerTripImpactTemplate, ANIM_ATTACKER, 2, 0xA, 0x0, 0x1, 0x2 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 waitforvisualfinish clearmonbg ANIM_DEF_PARTNER end @@ -11391,7 +11402,7 @@ Move_BURN_UP:: createvisualtask AnimTask_CopyPalUnfadedToBackup, 0x5, 0x1, 0x0 delay 0x1 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x1, 0x0, 0xd, 0x1c - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_ATTACKER, 0x2, 0x0, 0xf, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 2, 0, 15, 1 waitforvisualfinish delay 0x1E createsprite gUproarRingSpriteTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x0, 0x0, 0x1f, 0x8 @@ -11402,7 +11413,7 @@ Move_BURN_UP:: createvisualtask AnimTask_CopyPalFadedToUnfaded, 0x5, 0x1 delay 0x1 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x0, 0x0, 0xd, 0x4a52 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_ATTACKER, 0x3, 0x0, 0xf, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 3, 0, 15, 1 delay 0xF createvisualtask AnimTask_BlendBattleAnimPal, 0xA, F_PAL_TARGET, 0x2, 0x0, 0xC, 0x1C delay 0x1 @@ -11413,7 +11424,7 @@ Move_BURN_UP:: createvisualtask AnimTask_CopyPalUnfadedFromBackup, 0x5, 0x1, 0x0 delay 0x1 playsewithpan SE_M_FLAME_WHEEL2, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_TARGET, 0x2, 0x0, 0xf, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 2, 0, 15, 1 call FireSpreadEffect waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x0, 0xd, 0x0, 0x4a52 @@ -11480,7 +11491,7 @@ Move_SMART_STRIKE:: splitbgprio ANIM_TARGET setalpha 12, 8 call SonicBoomProjectile - createvisualtask AnimTask_ShakeMon, 0x2, 0x1, 0x3, 0x0, 0xa, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 10, 1 loadspritegfx ANIM_TAG_FLASH_CANNON_BALL createsprite gSmartStrikeImpactTemplate, ANIM_TARGET, 4, 0x0, 0x0, 0x8, 0x1, 0x0 playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET @@ -11539,7 +11550,7 @@ Move_REVELATION_DANCE:: createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x0, 0xF, 0x0 waitforvisualfinish playsewithpan SE_M_PETAL_DANCE, SOUND_PAN_ATTACKER - createvisualtask AnimTask_RockMonBackAndForth, 0x5, 0x0, 0x2, 0x0 + createvisualtask AnimTask_RockMonBackAndForth, 5, ANIM_ATTACKER, 2, 0 createsprite gRevelationDanceYellowOrbsTemplate, ANIM_ATTACKER, 2, 0x0, 0xffe8, 0x8, 0x8c createsprite gRevelationDanceYellowFlowerTemplate, ANIM_ATTACKER, 2, 0x10, 0xffe8, 0x8, 0x64 createsprite gRevelationDanceYellowFlowerTemplate, ANIM_ATTACKER, 2, 0xfff0, 0xffe8, 0x8, 0x64 @@ -11555,7 +11566,7 @@ Move_REVELATION_DANCE:: createsprite gRevelationDanceYellowFlowerTemplate, ANIM_ATTACKER, 2, 0x10, 0xffe8, 0x0, 0x64 createsprite gRevelationDanceYellowFlowerTemplate, ANIM_ATTACKER, 2, 0xfff0, 0xffe8, 0x0, 0x64 delay 0x1e - createvisualtask AnimTask_RockMonBackAndForth, 0x5, 0x0, 0x2, 0x0 + createvisualtask AnimTask_RockMonBackAndForth, 5, ANIM_ATTACKER, 2, 0 createsprite gRevelationDanceYellowFlowerTemplate, ANIM_ATTACKER, 2, 0x14, 0xfff0, 0xe, 0x50 createsprite gRevelationDanceYellowFlowerTemplate, ANIM_ATTACKER, 2, 0xffec, 0xfff2, 0x10, 0x50 waitforvisualfinish @@ -11577,7 +11588,7 @@ Move_REVELATION_DANCE:: createsprite gRevelationDanceYellowDispersalTemplate, ANIM_TARGET, 1, 0x0, 0xa, 0xa0, 0x30, 0x28 createsprite gRevelationDanceYellowDispersalTemplate, ANIM_TARGET, 1, 0x0, 0xa, 0xff20, 0xffe0, 0x28 createsprite gRevelationDanceYellowDispersalTemplate, ANIM_TARGET, 1, 0x0, 0xa, 0x70, 0xff80, 0x28 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0xF, 0x0, 0x0 waitforvisualfinish @@ -11717,8 +11728,8 @@ Move_CORE_ENFORCER:: monbg ANIM_TARGET createvisualtask AnimTask_CreateSmallSolarBeamOrbs, 0x5 panse SE_M_SOLAR_BEAM, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 0x2, 0x0 - createvisualtask AnimTask_ShakeMon2, 0x5, ANIM_TARGET, 0x2, 0x0, 0x41, 0x1 - createvisualtask AnimTask_ShakeMon2, 0x5, ANIM_DEF_PARTNER, 0x2, 0x0, 0x41, 0x1 + createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 2, 0, 65, 1 + createvisualtask AnimTask_ShakeMon2, 5, ANIM_DEF_PARTNER, 2, 0, 65, 1 createsprite gCoreEnforcerBeamTemplate, ANIM_TARGET, 3, 0xf, 0x0, 0x14, 0x0 createsprite gCoreEnforcerImpactTemplate, ANIM_TARGET, 3, 0xfff5, 0xffe2, 0x1, 0x3 delay 0x1 @@ -11776,9 +11787,9 @@ Move_CORE_ENFORCER:: createsprite gCoreEnforcerBeamTemplate, ANIM_TARGET, 3, 0xf, 0x0, 0x14, 0x6 delay 0x7 createsprite gCoreEnforcerSnoreTemplate, ANIM_ATTACKER, 2, 0x0, 0x0 - createvisualtask AnimTask_ShakeMon2, 0x2, ANIM_TARGET, 0x2, 0x0, 0x1e, 0x1 - createvisualtask AnimTask_ShakeMon2, 0x2, ANIM_DEF_PARTNER, 0x2, 0x0, 0x1e, 0x1 - createvisualtask AnimTask_ShakeMon2, 0x2, ANIM_ATK_PARTNER, 0x2, 0x0, 0x1e, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 30, 1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_DEF_PARTNER, 2, 0, 30, 1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATK_PARTNER, 2, 0, 30, 1 playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET createsprite gCoreEnforcerExplosionTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, ANIM_TARGET, 0x1 delay 0x6 @@ -11808,7 +11819,7 @@ Move_TROP_KICK:: loadspritegfx ANIM_TAG_FLOWER @flowers monbg ANIM_DEF_PARTNER createsprite gTropKickGreenFootTemplate, ANIM_ATTACKER, 2, 0xfff0, 0x8, 0x0, 0x0, 0xa, 0x1, 0x1, 0x1 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_TARGET, 0x4, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 4, 0, 6, 1 playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET delay 0xA playsewithpan SE_M_MORNING_SUN, SOUND_PAN_ATTACKER @@ -11837,14 +11848,14 @@ Move_INSTRUCT:: createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x2, 0x0, 0x8, 0x7DB9 delay 0x4 monbg ANIM_TARGET - createvisualtask AnimTask_BlendMonInAndOut, 0x5, 0x0, 0x37b, 0xc, 0x1, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 0x29, 0x1 + createvisualtask AnimTask_BlendMonInAndOut, 5, ANIM_ATTACKER, RGB(27, 27, 0), 12, 1, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 41, 1 playsewithpan SE_M_BIND, SOUND_PAN_TARGET delay 0x1A - createvisualtask AnimTask_BlendMonInAndOut, 0x5, 0x0, 0x37b, 0xc, 0x1, 0x1 + createvisualtask AnimTask_BlendMonInAndOut, 5, ANIM_ATTACKER, RGB(27, 27, 0), 12, 1, 1 playsewithpan SE_M_BIND, SOUND_PAN_TARGET delay 0x1A - createvisualtask AnimTask_BlendMonInAndOut, 0x5, 0x0, 0x37b, 0xc, 0x1, 0x1 + createvisualtask AnimTask_BlendMonInAndOut, 5, ANIM_ATTACKER, RGB(27, 27, 0), 12, 1, 1 playsewithpan SE_M_BIND, SOUND_PAN_TARGET delay 0x1D createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x2, 0x8, 0x0, 0x7DB9 @@ -11857,7 +11868,7 @@ General_BeakBlastSetUp: loadspritegfx ANIM_TAG_SMALL_EMBER @Fire playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER delay 0x3 - createvisualtask AnimTask_BlendColorCycle, 0x2, F_PAL_ATTACKER, 0x2, 0x2, 0x0, 0xb, 0x1f + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB_RED createsprite gFireSpiralOutwardSpriteTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x38, 0x0 waitforvisualfinish end @@ -11873,7 +11884,7 @@ Move_BEAK_BLAST:: delay 0x2 loopsewithpan SE_M_HORN_ATTACK, SOUND_PAN_TARGET 0x4 0x8 createvisualtask AnimTask_DrillPeckHitSplats, 0x5 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x4, 0x0, 0x12, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 18, 1 waitforvisualfinish createsprite gBowMonSpriteTemplate, ANIM_ATTACKER, 2, 0x2 waitforvisualfinish @@ -11891,14 +11902,14 @@ Move_CLANGING_SCALES:: createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x0, 0xC, 0x2002 createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_METAL_SOUND_WAVES, 0, 10, 10, 0x642D waitforvisualfinish - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x2, 0x0, 0x8, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 2, 0, 8, 1 call ClangingScalesMetalSound call ClangingScalesMetalSound call ClangingScalesMetalSound call ClangingScalesMetalSound delay 0x5 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0, 0x3, 0xf, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_DEF_PARTNER, 0x0, 0x3, 0xf, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 15, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_DEF_PARTNER, 0, 3, 15, 1 waitforvisualfinish clearmonbg ANIM_DEF_PARTNER delay 0x0 @@ -11966,9 +11977,9 @@ Move_BRUTAL_SWING:: delay 0x6 createsprite gBrutalSwingBasicImpactTemplate, ANIM_TARGET, 3, 0xffe0, 0xfff0, 0x1, 0x1 playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0, 0x3, 0x15, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_DEF_PARTNER, 0x0, 0x3, 0x15, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_ATK_PARTNER, 0x0, 0x3, 0x15, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 21, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_DEF_PARTNER, 0, 3, 21, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_ATK_PARTNER, 0, 3, 21, 1 delay 0x4 createsprite gBrutalSwingRandomImpactTemplate, ANIM_TARGET, 3, 0x1, 0x1 playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET @@ -12002,7 +12013,7 @@ Move_AURORA_VEIL:: createsprite gAuroraVeilRingTemplate, ANIM_ATTACKER, 2 waitforvisualfinish playsewithpan SE_SHINY, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendColorCycle, 0x2, 0xa, 0x0, 0x2, 0x0, 0xa, 0x7fff + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATK_SIDE, 0, 2, 0, 10, RGB_WHITE waitforvisualfinish call UnsetPsychicBg waitforvisualfinish @@ -12118,40 +12129,40 @@ ShellTrapUnleash: delay 0x3 call ShellTrapFireLaunch2 playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER - createvisualtaskontargets AnimTask_ShakeMon, 0x2, 0, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtaskontargets AnimTask_ShakeMon, 2, 0, ANIM_TARGET, 3, 0, 6, 1 delay 0x3 playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER - createvisualtaskontargets AnimTask_ShakeMon, 0x2, 0, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtaskontargets AnimTask_ShakeMon, 2, 0, ANIM_TARGET, 3, 0, 6, 1 delay 0x3 playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER - createvisualtaskontargets AnimTask_ShakeMon, 0x2, 0, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtaskontargets AnimTask_ShakeMon, 2, 0, ANIM_TARGET, 3, 0, 6, 1 delay 0x3 playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER - createvisualtaskontargets AnimTask_ShakeMon, 0x2, 0, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtaskontargets AnimTask_ShakeMon, 2, 0, ANIM_TARGET, 3, 0, 6, 1 delay 0x3 playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER - createvisualtaskontargets AnimTask_ShakeMon, 0x2, 0, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtaskontargets AnimTask_ShakeMon, 2, 0, ANIM_TARGET, 3, 0, 6, 1 delay 0x3 playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER - createvisualtaskontargets AnimTask_ShakeMon, 0x2, 0, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtaskontargets AnimTask_ShakeMon, 2, 0, ANIM_TARGET, 3, 0, 6, 1 delay 0x3 playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER - createvisualtaskontargets AnimTask_ShakeMon, 0x2, 0, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtaskontargets AnimTask_ShakeMon, 2, 0, ANIM_TARGET, 3, 0, 6, 1 delay 0x3 playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER - createvisualtaskontargets AnimTask_ShakeMon, 0x2, 0, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtaskontargets AnimTask_ShakeMon, 2, 0, ANIM_TARGET, 3, 0, 6, 1 delay 0x3 playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER - createvisualtaskontargets AnimTask_ShakeMon, 0x2, 0, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtaskontargets AnimTask_ShakeMon, 2, 0, ANIM_TARGET, 3, 0, 6, 1 delay 0x3 playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER - createvisualtaskontargets AnimTask_ShakeMon, 0x2, 0, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtaskontargets AnimTask_ShakeMon, 2, 0, ANIM_TARGET, 3, 0, 6, 1 delay 0x3 playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER - createvisualtaskontargets AnimTask_ShakeMon, 0x2, 0, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtaskontargets AnimTask_ShakeMon, 2, 0, ANIM_TARGET, 3, 0, 6, 1 delay 0x3 playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER - createvisualtaskontargets AnimTask_ShakeMon, 0x2, 0, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtaskontargets AnimTask_ShakeMon, 2, 0, ANIM_TARGET, 3, 0, 6, 1 delay 0x3 waitforvisualfinish clearmonbg ANIM_TARGET @@ -12174,31 +12185,31 @@ ShellTrapFireLaunch1: return ShellTrapFireLaunch2: createsprite gShellTrapFireHitsTemplate, ANIM_ATTACKER, 40, 0x0, 0x0, 0x0, 0x0, 0x38, 0x4, 0x4, 0x1 - createvisualtaskontargets AnimTask_ShakeMon, 0x2, 0, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtaskontargets AnimTask_ShakeMon, 2, 0, ANIM_TARGET, 3, 0, 6, 1 playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER delay 0x3 createsprite gShellTrapFireHitsTemplate, ANIM_ATTACKER, 40, 0x0, 0xfff6, 0x0, 0xfff6, 0x38, 0x4, 0x4, 0x1 - createvisualtaskontargets AnimTask_ShakeMon, 0x2, 0, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtaskontargets AnimTask_ShakeMon, 2, 0, ANIM_TARGET, 3, 0, 6, 1 playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER delay 0x3 createsprite gShellTrapFireHitsTemplate, ANIM_ATTACKER, 40, 0x0, 0xa, 0x0, 0xa, 0x38, 0xfffc, 0x3, 0x1 - createvisualtaskontargets AnimTask_ShakeMon, 0x2, 0, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtaskontargets AnimTask_ShakeMon, 2, 0, ANIM_TARGET, 3, 0, 6, 1 playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER delay 0x3 createsprite gShellTrapFireHitsTemplate, ANIM_ATTACKER, 40, 0x0, 0xffec, 0x0, 0xffec, 0x38, 0xfffc, 0x5, 0x1 - createvisualtaskontargets AnimTask_ShakeMon, 0x2, 0, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtaskontargets AnimTask_ShakeMon, 2, 0, ANIM_TARGET, 3, 0, 6, 1 playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER delay 0x3 createsprite gShellTrapFireHitsTemplate, ANIM_ATTACKER, 40, 0x0, 0xf, 0x0, 0xf, 0x38, 0x4, 0x4, 0x1 - createvisualtaskontargets AnimTask_ShakeMon, 0x2, 0, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtaskontargets AnimTask_ShakeMon, 2, 0, ANIM_TARGET, 3, 0, 6, 1 playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER delay 0x3 createsprite gShellTrapFireHitsTemplate, ANIM_ATTACKER, 40, 0x0, 0xffec, 0x0, 0xffec, 0x38, 0x4, 0x4, 0x1 - createvisualtaskontargets AnimTask_ShakeMon, 0x2, 0, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtaskontargets AnimTask_ShakeMon, 2, 0, ANIM_TARGET, 3, 0, 6, 1 playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER delay 0x3 createsprite gShellTrapFireHitsTemplate, ANIM_ATTACKER, 40, 0x0, 0x14, 0x0, 0x14, 0x38, 0x4, 0x4, 0x1 - createvisualtaskontargets AnimTask_ShakeMon, 0x2, 0, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtaskontargets AnimTask_ShakeMon, 2, 0, ANIM_TARGET, 3, 0, 6, 1 playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_ATTACKER delay 0x3 return @@ -12213,12 +12224,12 @@ Move_FLEUR_CANNON:: createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x0, 0xF, 0x7440 waitforvisualfinish panse SE_M_SOLAR_BEAM, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 0x2, 0x0 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_ATTACKER, 0x0, 0x4, 0x32, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_ATTACKER, 0, 4, 50, 1 createvisualtask AnimTask_FlashAnimTagWithColor, 2, ANIM_TAG_ORBS, 1, 12, RGB_RED, 16, 0, 0 call FleurCannonBeam call FleurCannonBeam call FleurCannonBeam - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x4, 0x0, 0x32, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 50, 1 call FleurCannonBeam call FleurCannonBeam call FleurCannonBeam @@ -12242,7 +12253,7 @@ Move_FLEUR_CANNON:: delay 0x2 createsprite gFleurCannonDischargeTemplate, ANIM_ATTACKER, 2, 0x1, 0xfff0, 0xfff0 delay 0x5 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_TARGET, 0x0, 0x5, 0xb, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 5, 11, 1 waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x10, 0x0, 0x7440 waitforvisualfinish @@ -12273,14 +12284,14 @@ PsychicFangsRegular: createsprite gSharpTeethSpriteTemplate, ANIM_ATTACKER, 2, 0x20, 0x20, 0x5, 0xfccd, 0xfccd, 0xa delay 0xa createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0xfff8, 0x0, 0x1, 0x1 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_TARGET, 0x0, 0x7, 0x5, 0x2 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 7, 5, 2 delay 0x10 playsewithpan SE_M_BITE, SOUND_PAN_TARGET createsprite gSharpTeethSpriteTemplate, ANIM_ATTACKER, 2, 0x20, 0xffe0, 0x7, 0xfccd, 0x333, 0xa createsprite gSharpTeethSpriteTemplate, ANIM_ATTACKER, 2, 0xffe0, 0x20, 0x3, 0x333, 0xfccd, 0xa delay 0xa createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0x8, 0x0, 0x1, 0x1 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_TARGET, 0x0, 0x8, 0x4, 0x2 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 8, 4, 2 PsychicFangsEnd: playsewithpan SE_M_SUPERSONIC, SOUND_PAN_TARGET waitforvisualfinish @@ -12295,7 +12306,7 @@ PsychicFangsDestroyWall: createsprite gSharpTeethSpriteTemplate, ANIM_ATTACKER, 2, 0x20, 0x20, 0x5, 0xfccd, 0xfccd, 0xa delay 0xa createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0xfff8, 0x0, 0x1, 0x1 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_TARGET, 0x0, 0x7, 0x5, 0x2 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 7, 5, 2 delay 0x10 playsewithpan SE_M_BITE, SOUND_PAN_TARGET createsprite gSharpTeethSpriteTemplate, ANIM_ATTACKER, 2, 0x20, 0xffe0, 0x7, 0xfccd, 0x333, 0xa @@ -12307,7 +12318,7 @@ PsychicFangsDestroyWall: createsprite gBrickBreakWallShardSpriteTemplate, ANIM_ATTACKER, 2, 0x1, 0x2, 0xfff8, 0xc createsprite gBrickBreakWallShardSpriteTemplate, ANIM_ATTACKER, 2, 0x1, 0x3, 0x8, 0xc playsewithpan SE_M_BRICK_BREAK, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_TARGET, 0x0, 0x8, 0x4, 0x2 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 8, 4, 2 delay 0x10 goto PsychicFangsEnd @@ -12317,10 +12328,10 @@ Move_STOMPING_TANTRUM:: loadspritegfx ANIM_TAG_IMPACT @pound hit loadspritegfx ANIM_TAG_SMALL_EMBER @hit color monbg ANIM_TARGET - createvisualtask AnimTask_Splash, 0x2, ANIM_ATTACKER, 0x3 + createvisualtask AnimTask_Splash, 2, ANIM_ATTACKER, 3 delay 0x5 - createvisualtask AnimTask_HorizontalShake, 0x5, 0x5, 0xa, 0x5 - createvisualtask AnimTask_HorizontalShake, 0x5, 0x4, 0xa, 0x5 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 10, 0x5 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 10, 0x5 createsprite gStompingTantrumRockTemplate, ANIM_ATTACKER, 2, 0x0, 0x0 createsprite gStompingTantrumRockTemplate, ANIM_ATTACKER, 2, 0x0, 0x1 createsprite gStompingTantrumRockTemplate, ANIM_ATTACKER, 2, 0x0, 0x2 @@ -12360,12 +12371,12 @@ Move_SHADOW_BONE:: createsprite gSpinningBoneSpriteTemplate, ANIM_ATTACKER, 2, 0xffd6, 0xffe7, 0x0, 0x0, 0xf delay 0xc createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x1, 0x1 - createvisualtask AnimTask_ShakeMon, 0x5, 0x1, 0x0, 0x5, 0x5, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 5, 5, 1 createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 0x7, 0x5, 0x1, 0x0, 0xa, 0x0, 0x0 playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET waitforvisualfinish createvisualtask AnimTask_NightmareClone, 0x2 - createvisualtask AnimTask_ShakeMon, 0x2, 0x1, 0x3, 0x0, 0x28, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 40, 1 playsewithpan SE_M_NIGHTMARE, SOUND_PAN_TARGET waitforvisualfinish restorebg @@ -12379,11 +12390,11 @@ Move_ACCELEROCK:: loadspritegfx ANIM_TAG_IMPACT monbg ANIM_ATK_PARTNER setalpha 12, 8 - createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 0x2, 0x0, 0x18, 0x6, 0x1, 0x5 + createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 24, 6, 1, 5 createvisualtask AnimTask_TraceMonBlended, 0x2, 0x0, 0x4, 0x7, 0x3 playsewithpan SE_M_JUMP_KICK, SOUND_PAN_ATTACKER delay 0x4 - createvisualtask AnimTask_ShakeMon, 0x2, 0x1, 0x5, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 6, 1 createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 4, 0x0, 0x0, 0x1, 0x1 playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 0x1, 0x3, 0x0, 0x5, 0x1 @@ -12407,7 +12418,7 @@ Move_LIQUIDATION:: createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 0x4, 0x4 delay 0x6 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x1, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, 0x1, 0x3, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 playsewithpan SE_M_DOUBLE_TEAM, SOUND_PAN_TARGET waitforvisualfinish call RisingWaterHitEffect @@ -12455,8 +12466,8 @@ Move_PRISMATIC_LASER:: unloadspritegfx ANIM_TAG_ICE_CHUNK unloadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT delay 0x1E - createvisualtask AnimTask_HorizontalShake, 0x5, 0x5, 0xa, 0x32 - createvisualtask AnimTask_HorizontalShake, 0x5, 0x4, 0xa, 0x32 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 10, 0x32 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 10, 0x32 playsewithpan SE_M_SOLAR_BEAM, SOUND_PAN_ATTACKER call PrismaticLaserRain call PrismaticLaserRain @@ -12552,7 +12563,7 @@ SpectralThiefUnleash: delay 0x5 playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET createsprite gSpectralThiefBlackSmokeTemplate, ANIM_TARGET, 2, 0x8, 0x8, 0x0, 0x0 - invisible 0x0 + invisible ANIM_ATTACKER delay 0x2 createsprite gSpectralThiefBlackSmokeTemplate, ANIM_TARGET, 2, 0xfff8, 0xfff8, 0x0, 0x0 delay 0x2 @@ -12572,7 +12583,7 @@ SpectralThiefUnleash: waitforvisualfinish createvisualtask AnimTask_DestinyBondWhiteShadow, 0x5, 0x0, 0x30 delay 0x30 - createvisualtask AnimTask_ShakeMonInPlace, 0x2, 0x0, 0x2, 0x0, 0x18, 0x1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_ATTACKER, 2, 0, 24, 1 createvisualtask AnimTask_BlendBattleAnimPalExclude, 0x2, 0x6, 0x1, 0x0, 0xc, 0x77bd delay 0x18 createvisualtask AnimTask_BlendBattleAnimPalExclude, 0x2, 0x6, 0x1, 0xc, 0x0, 0x77bd @@ -12592,33 +12603,33 @@ SpectralThiefUnleash: delay 0x1 createsprite gSpectralThiefThiefImpactTemplate, ANIM_TARGET, 2, 0xfff6, 0xfff6, 0x0 playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 delay 0x4 createsprite gSpectralThiefThiefImpactTemplate, ANIM_TARGET, 2, 0xa, 0x14, 0x0 playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 delay 0x4 createsprite gSpectralThiefThiefImpactTemplate, ANIM_TARGET, 2, 0xfffb, 0xa, 0x0 playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 delay 0x4 createsprite gSpectralThiefThiefImpactTemplate, ANIM_TARGET, 2, 0x11, 0xfff4, 0x0 playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 delay 0x4 createsprite gSpectralThiefThiefImpactTemplate, ANIM_TARGET, 2, 0xfff1, 0xf, 0x0 playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 delay 0x4 createsprite gSpectralThiefThiefImpactTemplate, ANIM_TARGET, 2, 0x0, 0x0, 0x0 playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 delay 0x4 createsprite gSpectralThiefThiefImpactTemplate, ANIM_TARGET, 2, 0x14, 0x2, 0x0 playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 waitforvisualfinish - visible 0x0 + visible ANIM_ATTACKER delay 0x2 restorebg waitbgfadein @@ -12640,7 +12651,7 @@ SpectralThiefSteal: playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER call SpectralThiefBuffUp delay 0x8 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x20, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 call SpectralThiefBuffUp delay 0x8 call SpectralThiefBuffUp @@ -12668,7 +12679,7 @@ Move_SUNSTEEL_STRIKE:: setalpha 12, 8 playsewithpan SE_M_DOUBLE_TEAM, SOUND_PAN_TARGET createsprite gSunsteelStrikeBlackFlyBallTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0xd, 0x150 - createvisualtask AnimTask_HorizontalShake, 0x5, 0x4, 0x1, 0x1A + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 1, 26 delay 0x18 createsprite gSunsteelStrikeRocksTemplate, ANIM_ATTACKER, 2, 0x0, 0x0 @The rock particles mess up the fly animation createsprite gSunsteelStrikeRocksTemplate, ANIM_ATTACKER, 2, 0x0, 0x1 @@ -12699,7 +12710,7 @@ Move_SUNSTEEL_STRIKE:: createsprite gSunsteelStrikeSuperpowerTemplate, ANIM_TARGET, 2, 0x14 delay 0x14 createsprite gSunsteelStrikeRedImpactTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x1, 0x0 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_TARGET, 0x6, 0x0, 0x8, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 6, 0, 8, 1 waitforvisualfinish unloadspritegfx ANIM_TAG_METEOR @superpower unloadspritegfx ANIM_TAG_GOLD_RING @beam @@ -12746,14 +12757,14 @@ Move_MOONGEIST_BEAM:: call MoongeistBeamCharge delay 0x20 createsoundtask SoundTask_LoopSEAdjustPanning, 0x7, 0xCC, 0xffc0, SOUND_PAN_TARGET, 0x1, 0xf, 0x0, 0x5 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_ATTACKER, 0x0, 0x4, 0x32, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_ATTACKER, 0, 4, 50, 1 createvisualtask AnimTask_FlashAnimTagWithColor, 2, ANIM_TAG_ORBS, 1, 12, RGB_RED, 16, 0, 0 call MoongeistBeamOrbs call MoongeistBeamOrbs call MoongeistBeamOrbs call MoongeistBeamOrbs call MoongeistBeamOrbs - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x4, 0x0, 0x32, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 50, 1 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x2, 0x0, 0xb, 0x6739 call MoongeistBeamOrbs call MoongeistBeamOrbs @@ -12838,21 +12849,21 @@ Move_ZING_ZAP:: loadspritegfx ANIM_TAG_SMALL_EMBER @yellow color monbg ANIM_TARGET call ZingZapSparks1 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_ATTACKER, 0x4, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 4, 0, 6, 1 delay 0xA call ZingZapSparks2 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_ATTACKER, 0x4, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 4, 0, 6, 1 delay 0xA call ZingZapSparks1 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_ATTACKER, 0x4, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 4, 0, 6, 1 delay 0xA call ZingZapSparks2 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_ATTACKER, 0x4, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 4, 0, 6, 1 delay 0xA - createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 0x2, 0x0, 0x18, 0x6, 0x1, 0x5 + createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 24, 6, 1, 5 delay 0x4 call ZingZapSparks1 - invisible 0x0 + invisible ANIM_ATTACKER createsprite gZingZapYellowBallTemplate, ANIM_TARGET, 2, 0x0, 0x0, 0xF delay 0xA call ZingZapSparks2 @@ -12861,9 +12872,9 @@ Move_ZING_ZAP:: playsewithpan SE_M_JUMP_KICK, SOUND_PAN_ATTACKER waitforvisualfinish createsprite gZingZapRingTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x1, 0x0, 0x1f, 0x8 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_TARGET, 0x4, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 4, 0, 6, 1 call ElectricityEffect - visible 0x0 + visible ANIM_ATTACKER waitforvisualfinish clearmonbg ANIM_TARGET end @@ -12953,11 +12964,11 @@ Move_NATURES_MADNESS:: createsprite gNaturesMadnessCrystalsTemplate, ANIM_ATTACKER, 2, 0x19, 0x14, 0x19, 0x1 createsprite gNaturesMadnessCrystalsTemplate, ANIM_ATTACKER, 2, 0xffec, 0x14, 0x19, 0x1 createsprite gNaturesMadnessCrystalsTemplate, ANIM_ATTACKER, 2, 0xc, 0x0, 0x19, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 delay 0x5 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 delay 0x5 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0003, 0x0000, 0x0006, 0x0001 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 waitforvisualfinish clearmonbg ANIM_TARGET blendoff @@ -12972,8 +12983,8 @@ Move_MULTI_ATTACK:: playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER call MultiAttackBuff delay 0x8 - createvisualtask AnimTask_BlendColorCycle, 0x2, F_PAL_ATTACKER, 0x2, 0x2, 0x0, 0xb, 0x7fff - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x20, 0x1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB_WHITE + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 call MultiAttackBuff delay 0x8 call MultiAttackBuff @@ -12982,7 +12993,7 @@ Move_MULTI_ATTACK:: playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET createsprite gCuttingSliceSpriteTemplate, ANIM_ATTACKER, 2, 0x28, 0xffe0, 0x0 createsprite gCuttingSliceSpriteTemplate, ANIM_ATTACKER, 2, 0x28, 0xffd0, 0x0 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0, 0x3, 0xf, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 15, 1 waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0xC, 0x0, 0x0 waitforvisualfinish @@ -13013,9 +13024,9 @@ Move_MIND_BLOWN:: playsewithpan SE_FALL, SOUND_PAN_TARGET createsprite gMindBlownHeadTemplate, ANIM_TARGET, 2, 0x0, 0x0, 0x25 waitforvisualfinish - createvisualtask AnimTask_ShakeMon2, 0x2, ANIM_TARGET, 0x2, 0x0, 0xf, 0x1 - createvisualtask AnimTask_ShakeMon2, 0x2, ANIM_DEF_PARTNER, 0x2, 0x0, 0xf, 0x1 - createvisualtask AnimTask_ShakeMon2, 0x2, ANIM_ATK_PARTNER, 0x2, 0x0, 0xf, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 15, 1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_DEF_PARTNER, 2, 0, 15, 1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATK_PARTNER, 2, 0, 15, 1 delay 0x1 playsewithpan SE_M_EXPLOSION, SOUND_PAN_ATTACKER createsprite gMindBlownBlueImpactTemplate, ANIM_TARGET, 3, 0x1, 0x0 @@ -13069,7 +13080,7 @@ Move_PLASMA_FISTS:: createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x0, 0x10, 0x0 waitforvisualfinish createsprite gPlasmaFistsChargeTemplate, ANIM_ATTACKER, 2, 0x0 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_ATTACKER, 0x0, 0x3, 0x5c, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_ATTACKER, 0, 3, 92, 1 call PlasmaFistSpark1 delay 0xA call PlasmaFistSpark2 @@ -13095,7 +13106,7 @@ Move_PLASMA_FISTS:: call PlasmaFistSpark2 waitforvisualfinish clearmonbg ANIM_ATTACKER - createvisualtask AnimTask_ShockWaveProgressingBolt, 0x5 + createvisualtask AnimTask_ShockWaveProgressingBolt, 5, ANIM_ATTACKER waitforvisualfinish monbg ANIM_TARGET call PlasmaFistsImpact @@ -13109,7 +13120,7 @@ Move_PLASMA_FISTS:: end PlasmaFistSpark1: playsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendColorCycle, 0x2, F_PAL_ATTACKER, 0x0, 0x2, 0x0, 0xb, 0x5bff + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 2, 0, 11, RGB(31, 31, 22) createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 0x20, 0x18, 0xbe, 0xc, 0x0, 0x1, 0x0 delay 0x0 createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 0x50, 0x18, 0x16, 0xc, 0x0, 0x1, 0x0 @@ -13138,7 +13149,7 @@ PlasmaFistsImpact: playsewithpan SE_M_TRI_ATTACK2, SOUND_PAN_TARGET createvisualtask AnimTask_InvertScreenColor, 0x2, 0x101, 0x101, 0x101 delay 0x2 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0, 0x3, 0xf, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 15, 1 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x1, 0x2 return @@ -13203,7 +13214,7 @@ Move_PHOTON_GEYSER:: waitforvisualfinish monbg ANIM_TARGET createsprite gPhotonGeyserYellowRingTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x1, 0x0, 0x1f, 0x8 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x4, 0x0, 0x5, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 5, 1 playsewithpan SE_M_EXPLOSION, SOUND_PAN_ATTACKER unloadspritegfx ANIM_TAG_YELLOW_BALL @confuse ray (for zap cannon) unloadspritegfx ANIM_TAG_BLACK_BALL_2 @zap cannon @@ -13211,7 +13222,7 @@ Move_PHOTON_GEYSER:: @Shoot beam to the sky loadspritegfx ANIM_TAG_STRAIGHT_BEAM createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x6, 0x0, 0x10, 0x43FF @Light yellow - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x4, 0x0, 0x60, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 4, 0, 96, 1 panse SE_M_SOLAR_BEAM, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 0x2, 0x0 call PhotonGeyserBeam waitforvisualfinish @@ -13337,7 +13348,7 @@ Move_SNIPE_SHOT:: playsewithpan SE_M_GIGA_DRAIN, SOUND_PAN_TARGET createsprite gSnipeShotBallTemplate, ANIM_TARGET, 2, 0, 0, 16 waitforvisualfinish - createvisualtask AnimTask_ShakeMon2, 2, 1, 4, 0, 8, 1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 8, 1 waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 16, 0, 0 @;Black waitforvisualfinish @@ -13355,7 +13366,7 @@ Move_JAW_LOCK:: createsprite gJawLockTeethTemplate, ANIM_ATTACKER, 2, 0x20, 0x20, 0x5, 0xfccd, 0xfccd, 0xa, 15 delay 0xa createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0xfff8, 0x0, 0x1, 0x1 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_TARGET, 0x0, 0x7, 0xA, 0x2 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 7, 10, 2 waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x7, 0x0, 0x0 @;Black waitforvisualfinish @@ -13420,8 +13431,8 @@ Move_TAR_SHOT:: createsprite gAppleAcidLaunchTemplate, ANIM_TARGET, 2, 0x14, 0x0, 0x28, 0x1, 0xffe8, 0x0 playsewithpan SE_M_BUBBLE3, SOUND_PAN_ATTACKER delay 0xf - createvisualtask AnimTask_ShakeMon2, 0x5, ANIM_TARGET, 0x2, 0x0, 0xa, 0x1 - createvisualtask AnimTask_BlendColorCycle, 0x2, F_PAL_TARGET, 0x2, 0x2, 0x0, 0x10, 0x0 @;Black + createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 2, 0, 10, 1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 16, RGB_BLACK @;Black createsprite gAppleAcidDripTemplate, ANIM_TARGET, 2, 0xffe6, 0xffe8, 0x0, 0xf, 0x37 playsewithpan SE_M_BUBBLE, SOUND_PAN_TARGET delay 0xa @@ -13458,7 +13469,7 @@ Move_MAGIC_POWDER:: createsprite gPoisonPowderParticleSpriteTemplate, ANIM_TARGET, 2, 0x5, 0xffea, 0x75, 0x50, 0x5, 0x1 waitforvisualfinish playsewithpan SE_M_SUPERSONIC, SOUND_PAN_TARGET - createvisualtask AnimTask_ScaleMonAndRestore, 0x5, 0xfffa, 0xfffa, 0xf, 0x1, 0x1 + createvisualtask AnimTask_ScaleMonAndRestore, 5, -6, -6, 15, ANIM_TARGET, 1 waitforvisualfinish end @@ -13469,7 +13480,7 @@ Move_DRAGON_DARTS:: createsprite gDreepyMissileTemplate, ANIM_TARGET, 2, 0x0, 0x0, 0x19 delay 0x19 playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 0x10, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 16, 1 createsprite gExplosionSpriteTemplate, ANIM_TARGET, 3, 0x0, 0x0, 0x1, 0x1 waitforvisualfinish end @@ -13499,9 +13510,9 @@ Move_OCTOLOCK:: delay 0x7 createsprite gConstrictBindingSpriteTemplate, ANIM_TARGET, 3, 0x0, 0xfff8, 0x1, 0x2 delay 0x8 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x3, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 3, 0, 6, 1 delay 0x14 - createvisualtask AnimTask_BlendColorCycle, 0x2, F_PAL_TARGET, 0x2, 0x2, 0x0, 0x8, 0x1f + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 8, RGB_RED playsewithpan SE_M_BIND, SOUND_PAN_TARGET setarg 0x7 0xffff waitforvisualfinish @@ -13516,16 +13527,16 @@ Move_BOLT_BEAK:: createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_HORN_HIT, 0, 12, 12, 0x079D @Yellow call BoltBeakSparks waitforvisualfinish - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x3, 0xffe1, 0x1, 0x0, 0x0, 0x5bff + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_ATTACKER), -31, 1, 0, 0, RGB(31, 31, 22) createsprite gHorizontalLungeSpriteTemplate, 0x2, 0x2, 0x4, 0x4 delay 0x4 createsprite gHornHitSpriteTemplate, 0x84, 0x3, 0x8, 0x8, 0xa waitforvisualfinish createsprite gFlashingHitSplatSpriteTemplate, 0x83, 0x4, 0x0, 0x0, 0x1, 0x1 playsewithpan SE_M_HORN_ATTACK, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 0x2, 0x1, 0x3, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 waitforvisualfinish - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x4, 0xffe1, 0x2, 0x0, 0x6, 0x5bff + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, -31, 2, 0, 6, RGB(31, 31, 22) call ElectricityEffect waitforvisualfinish end @@ -13536,18 +13547,18 @@ BoltBeakSparks: createsprite gBoltBeakBlueSparkTemplate, 0x0, 0x7, 0x50, 0x18, 0x16, 0xc, 0x0, 0x1, 0x0 createsprite gSparkElectricitySpriteTemplate, 0x0, 0x7, 0x9c, 0x18, 0x79, 0xd, 0x0, 0x1, 0x1 delay 0x0 - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x3, 0xffe1, 0x1, 0x0, 0x0, 0x5bff + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_ATTACKER), -31, 1, 0, 0, RGB(31, 31, 22) delay 0xa - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x3, 0xffe1, 0x1, 0x5, 0x5, 0x5bff + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_ATTACKER), -31, 1, 5, 5, RGB(31, 31, 22) playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER createsprite gBoltBeakBlueSparkTemplate, 0x0, 0x7, 0x64, 0x18, 0x3c, 0xa, 0x0, 0x1, 0x0 createsprite gSparkElectricitySpriteTemplate, 0x0, 0x7, 0xaa, 0x18, 0x2a, 0xb, 0x0, 0x1, 0x1 delay 0x0 createsprite gBoltBeakBlueSparkTemplate, 0x0, 0x7, 0xee, 0x18, 0xa5, 0xa, 0x0, 0x1, 0x1 delay 0x0 - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x3, 0xffe1, 0x1, 0x0, 0x0, 0x76E1 + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_ATTACKER), -31, 1, 0, 0, RGB(1, 23, 29) delay 0x14 - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x3, 0xffe1, 0x1, 0x4, 0x4, 0x76E1 + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_ATTACKER), -31, 1, 4, 4, RGB(1, 23, 29) playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER createsprite gSparkElectricityFlashingSpriteTemplate, 0x4, 0x8, 0x0, 0x0, 0x20, 0xc, 0x0, 0x14, 0x0, 0x0 createsprite gBoltBeakBlueFlashingSparkTemplate, 0x4, 0x8, 0x0, 0x0, 0x20, 0xc, 0x40, 0x14, 0x1, 0x0 @@ -13566,7 +13577,7 @@ Move_FISHIOUS_REND:: createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_SHARP_TEETH, 0, 10, 10, 0x726A @Blue Teeth playsewithpan SE_M_WATERFALL, SOUND_PAN_TARGET createsprite gFishiousRendTeethTemplate, ANIM_TARGET, 0, 50, 4 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x4, 0x0, 0xC, 0x2 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 4, 0, 12, 2 call FishousRendBubbles waitforvisualfinish end @@ -13623,7 +13634,7 @@ Move_CLANGOROUS_SOUL:: loadspritegfx ANIM_TAG_POISON_BUBBLE @purple loadspritegfx ANIM_TAG_AIR_WAVE_2 @white/grey loadspritegfx ANIM_TAG_SPARKLE_2 @stars - createvisualtask AnimTask_RockMonBackAndForth, 0x5, 0x0, 0x2, 0x0 + createvisualtask AnimTask_RockMonBackAndForth, 5, ANIM_ATTACKER, 2, 0 call ClangorousSoulStarBuffEffect call ClangorousSoulStarBuffEffect call ClangorousSoulStarBuffEffect @@ -13713,7 +13724,7 @@ Move_DRUM_BEATING:: delay 0x5 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0xfff6, 0xfff6, 0x1, 0x3 playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 0x3, ANIM_TARGET, 0x8, 0x0, 0x14, 0x1 + createvisualtask AnimTask_ShakeMon, 3, ANIM_TARGET, 8, 0, 20, 1 delay 0x3 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0xa, 0x8, 0x1, 0x3 playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET @@ -13757,8 +13768,8 @@ Move_PYRO_BALL:: playsewithpan SE_M_FLAME_WHEEL2, SOUND_PAN_TARGET createsprite gPyroBallEmberBallTemplate, ANIM_ATTACKER, 2, 0, 10, 0, 5, 20, -20 waitforvisualfinish - createvisualtask AnimTask_BlendColorCycle, 0x2, F_PAL_TARGET, 0x2, 0x2, 0x0, 0xc, 0x1f - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0, 0x3, 0xf, 0x1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 12, RGB_RED + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 15, 1 call FireSpreadEffect delay 0x20 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x7, 0x0, 0x043D @@ -13805,7 +13816,7 @@ Move_AURA_WHEEL:: createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x18, 0x0, 0x0, 0x6 delay 0x4 playsewithpan SE_M_TRI_ATTACK2, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x5, 0x0, 0x17, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 23, 1 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 4, 0xfff6, 0x0, 0x1, 0x0 createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_SPARK_2, 2, 12, 0, 0x76E1 @Revert blue Electricity createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_TARGET, 4, 0x0, 0x0, 0x30, 0x2c, 0x0, 0x28, 0x0, 0x8003 @@ -13829,8 +13840,8 @@ Move_BREAKING_SWIPE:: createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 0xffe0, 0xfff0, 0x1, 0x1 createsprite gBreakingSwipeCenteredElectricity, ANIM_TARGET, 2, 0x5, 0x0, 0x5, 0x0 playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0, 0x3, 0x15, 0x1 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_DEF_PARTNER, 0x0, 0x3, 0x15, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 21, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_DEF_PARTNER, 0, 3, 21, 1 delay 0x4 createsprite gRandomPosHitSplatSpriteTemplate, ANIM_TARGET, 3, 0x1, 0x1 createsprite gBreakingSwipeCenteredElectricity, ANIM_TARGET, 2, 0xfff1, 0xfff6, 0x5, 0x0 @@ -13855,7 +13866,7 @@ Move_BRANCH_POKE:: playsewithpan SE_M_HEADBUTT, SOUND_PAN_ATTACKER createsprite gBranchPokeBranchTemplate, ANIM_TARGET, 2, 0x0, 0x0, 0x25 waitforvisualfinish - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x5, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 6, 1 createsprite gFlashingHitSplatSpriteTemplate, ANIM_TARGET, 3, 0x0, 0x0, 0x1, 0x1 playsewithpan SE_M_HORN_ATTACK, SOUND_PAN_TARGET waitforvisualfinish @@ -13879,10 +13890,10 @@ Move_OVERDRIVE:: OverdriveRings: playsewithpan SE_M_THUNDERBOLT, SOUND_PAN_TARGET createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 0x1f, 0x3, 0x8, 0x0, 0x3ff - createvisualtask AnimTask_ScaleMonAndRestore, 0x5, 0xfffb, 0xfffb, 0x5, 0x0, 0x0 + createvisualtask AnimTask_ScaleMonAndRestore, 5, -5, -5, 5, ANIM_ATTACKER, 0 createsprite gHyperVoiceRingSpriteTemplate, ANIM_ATTACKER, 0, 0x2d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x1, 0x0, 0x6, 0x1 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x3, 0x1, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 1, 0, 6, 1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_DEF_PARTNER, 1, 0, 6, 1 createvisualtask AnimTask_ShakeBattleTerrain, 0x2, 0x1, 0x0, 0x6, 0x1 createvisualtask SoundTask_WaitForCry, 0x5 return @@ -13904,7 +13915,7 @@ Move_APPLE_ACID:: createsprite gAppleAcidLaunchTemplate, ANIM_TARGET, 2, 0x14, 0x0, 0x28, 0x1, 0xffe8, 0x0 playsewithpan SE_M_BUBBLE3, SOUND_PAN_ATTACKER delay 0xf - createvisualtask AnimTask_ShakeMon2, 0x5, ANIM_TARGET, 0x2, 0x0, 0xa, 0x1 + createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 2, 0, 10, 1 createsprite gAppleAcidDripTemplate, ANIM_TARGET, 2, 0x0, 0xffea, 0x0, 0xf, 0x37 playsewithpan SE_M_BUBBLE, SOUND_PAN_TARGET delay 0xa @@ -13973,8 +13984,32 @@ SmallAppleShower: delay 0x2 return +@ credits to Skeli Move_SPIRIT_BREAK:: - goto Move_PSYCHIC + loadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT + loadspritegfx ANIM_TAG_TEAL_ALERT + loadspritegfx ANIM_TAG_EXPLOSION_2 + createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_CIRCLE_OF_LIGHT, 0x0, 0x10, 0x10, 0x7FFF + createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_TEAL_ALERT, 0x0, 0xA, 0xA, 0x7DDE + createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_EXPLOSION_2, 0x0, 0xA, 0xA, 0x7DDE + monbg ANIM_DEF_PARTNER + createvisualtask AnimTask_WindUpLunge, 5, ANIM_ATTACKER, -20, 8, 48, 8, 56, 6 + playsewithpan SE_M_MEGA_KICK, SOUND_PAN_TARGET + createsprite gSpriteTemplate_SpiritBreakChargeBall, ANIM_TARGET, 1, ANIM_TARGET + call MindReaderEyeSpikeEffect + call MindReaderEyeSpikeEffect + call MindReaderEyeSpikeEffect + call MindReaderEyeSpikeEffect + waitforvisualfinish + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 5, 5, 1 + playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET + createsprite gSpriteTemplate_SpiritBreakExplode, ANIM_TARGET, 3, 0x0, 0x0, 0x1, 0x1 + waitforvisualfinish + delay 0x5 + createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0x0, 0x5 + clearmonbg ANIM_DEF_PARTNER + waitforvisualfinish + end Move_STRANGE_STEAM:: loadspritegfx ANIM_TAG_PINK_CLOUD @@ -13987,7 +14022,7 @@ Move_STRANGE_STEAM:: call StrangeSteamCloud call StrangeSteamCloud call StrangeSteamCloud - createvisualtask AnimTask_ShakeMon2, 0x2, ANIM_TARGET, 0x2, 0x0, 0x2A, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 42, 1 call StrangeSteamCloud call StrangeSteamCloud call StrangeSteamCloud @@ -14041,7 +14076,7 @@ Move_OBSTRUCT:: loadspritegfx ANIM_TAG_OBSTRUCT_CROSS createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_NOISE_LINE, 0, 10, 10, 0 @Black createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_PROTECT, 0, 10, 10, 0 @Black - createvisualtask SoundTask_PlayDoubleCry, 0x2, ANIM_ATTACKER, 0xff + createvisualtask SoundTask_PlayDoubleCry, 2, ANIM_ATTACKER, DOUBLE_CRY_GROWL call RoarEffect waitforvisualfinish delay 0x10 @@ -14056,8 +14091,44 @@ Move_OBSTRUCT:: clearmonbg ANIM_ATK_PARTNER end +@Credits to Skeli Move_FALSE_SURRENDER:: - goto Move_FEINT + loadspritegfx ANIM_TAG_IMPACT + loadspritegfx ANIM_TAG_CROSS_IMPACT + monbg ANIM_ATTACKER + fadetobg BG_DARK + waitbgfadein + delay 0x0 + playsewithpan SE_M_FAINT_ATTACK, 0xc0 + createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 18, 6, 1, 3 + createvisualtask AnimTask_AttackerFadeToInvisible, 0x2, 0x1 + waitforvisualfinish + clearmonbg ANIM_ATTACKER + invisible ANIM_ATTACKER + delay 0x1 + createvisualtask AnimTask_SetAttackerInvisibleWaitForSignal, 0x2, + monbg ANIM_TARGET + setalpha 12, 8 + delay 0x1 + playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 0x1f, 0x3, 0x1, 0x7fff, 0xa, 0x0, 0xa + createsprite gSpriteTemplate_LargeCrossImpact, ANIM_ATTACKER, 3, 0x0, 0x0, 0x1, 0x14 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 7, 0, 9, 1 + waitforvisualfinish + clearmonbg ANIM_TARGET + blendoff + delay 0x1 + setarg 0x7, 0x1000 + delay 0x1 + createvisualtask AnimTask_InitAttackerFadeFromInvisible, 0x2, + monbg ANIM_ATTACKER + createvisualtask AnimTask_AttackerFadeFromInvisible, 0x2, 0x1 + waitforvisualfinish + clearmonbg ANIM_ATTACKER + delay 0x1 + restorebg + waitbgfadein + end Move_METEOR_ASSAULT:: loadspritegfx ANIM_TAG_ELECTRIC_ORBS @@ -14065,7 +14136,7 @@ Move_METEOR_ASSAULT:: loadspritegfx ANIM_TAG_EXPLOSION createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_ELECTRIC_ORBS, 0, 12, 12, 0x0B1D @Light orange createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 1, 0, 9, 0x0B1D @Light orange - createvisualtask AnimTask_ElectricChargingParticles, 0x2, 0x0, 0x30, 0x0, 0x4 + createvisualtask AnimTask_ElectricChargingParticles, 2, ANIM_ATTACKER, 48, 0, 4 playsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER waitforvisualfinish invisible ANIM_ATTACKER @@ -14073,7 +14144,7 @@ Move_METEOR_ASSAULT:: playsewithpan SE_M_SWAGGER, SOUND_PAN_ATTACKER delay 0xF createvisualtask AnimTask_BlendBattleAnimPal, 10, (F_PAL_BG | F_PAL_ATTACKER), 1, 0x10, 0x10, 0x7FFF @Screen flash white - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x0, 0x5, 0x20, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 5, 32, 1 call BasicExplosion call BasicExplosion waitforvisualfinish @@ -14108,7 +14179,7 @@ Move_STEEL_BEAM:: delay 48 loadspritegfx ANIM_TAG_ELECTRIC_ORBS loadspritegfx ANIM_TAG_GUST - createvisualtask AnimTask_ElectricChargingParticles, 0x2, 0x0, 0x14, 0x0, 0x2 + createvisualtask AnimTask_ElectricChargingParticles, 2, ANIM_ATTACKER, 20, 0, 2 playsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER delay 20 loadspritegfx ANIM_TAG_STEEL_BEAM @@ -14161,17 +14232,216 @@ SetSteelBeamBackground: SetSteelBeamBgPlayer: fadetobg BG_STEEL_BEAM_PLAYER +@Credits to Skeli Move_EXPANDING_FORCE:: - end @to do: + loadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT + loadspritegfx ANIM_TAG_EXPLOSION_2 + createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_CIRCLE_OF_LIGHT, 0x0, 0xA, 0xA, 0x7DDE + createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_EXPLOSION_2, 0x0, 0xA, 0xA, 0x7DDE + monbg ANIM_DEF_PARTNER + call SetPsychicBackground + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 10, 1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, F_PAL_ATTACKER, 2, 0, 8, RGB(31, 23, 0) + waitforvisualfinish + playsewithpan SE_M_MEGA_KICK, SOUND_PAN_TARGET + choosetwoturnanim EXPANDING_FORCE_SINGLE_TARGET EXPANDING_FORCE_BOTH_TARGETS + +EXPANDING_FORCE_SINGLE_TARGET: + createsprite gSpriteTemplate_SpiritBreakChargeBall, ANIM_TARGET, 1, ANIM_TARGET + waitforvisualfinish + createvisualtask AnimTask_ShakeTargetBasedOnMovePowerOrDmg, 0x2, 0x0, 0x1, 0x18, 0x1, 0x0 + call MaxKnuckleExplosionGeyser + waitforvisualfinish + call UnsetPsychicBg + clearmonbg ANIM_DEF_PARTNER + end + +EXPANDING_FORCE_BOTH_TARGETS: + createsprite gSpriteTemplate_SpiritBreakChargeBall, ANIM_TARGET, 1, ANIM_TARGET + createsprite gSpriteTemplate_SpiritBreakChargeBall, ANIM_TARGET, 1, ANIM_DEF_PARTNER + waitforvisualfinish + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 24, 1 @;High power + createvisualtask AnimTask_ShakeMon, 2, ANIM_DEF_PARTNER, 5, 0, 24, 1 + call ExpandingForceExplosionGeyser + waitforvisualfinish + call UnsetPsychicBg + clearmonbg ANIM_DEF_PARTNER + end + +ExpandingForceExplosionGeyser: + createsprite gSpriteTemplate_ExpandingForceExplode, ANIM_TARGET, 4, 0x0003, 0x0005, ANIM_TARGET + playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET + delay 0x0 + createsprite gSpriteTemplate_ExpandingForceExplode, ANIM_TARGET, 4, 0xfff5, 0xfff1, ANIM_TARGET + playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET + delay 0x0 + createsprite gSpriteTemplate_ExpandingForceExplode, ANIM_TARGET, 4, 0x0008, 0xfffb, ANIM_TARGET + playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET + delay 0x0 + createsprite gSpriteTemplate_ExpandingForceExplode, ANIM_TARGET, 4, 0xfffa, 0x0012, ANIM_TARGET + playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET + delay 0x0 + createsprite gSpriteTemplate_ExpandingForceExplode, ANIM_TARGET, 4, 0x0000, 0x0005, ANIM_TARGET + playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET + delay 0x0 + createsprite gSpriteTemplate_ExpandingForceExplode, ANIM_TARGET, 4, 0x0003, 0xfff5, ANIM_TARGET + delay 0x0 + createsprite gSpriteTemplate_ExpandingForceExplode, ANIM_TARGET, 4, 0xfff5, 0xffe1, ANIM_TARGET + delay 0x0 + createsprite gSpriteTemplate_ExpandingForceExplode, ANIM_TARGET, 4, 0x0008, 0xffeb, ANIM_TARGET + delay 0x0 + createsprite gSpriteTemplate_ExpandingForceExplode, ANIM_TARGET, 4, 0xfffa, 0x0002, ANIM_TARGET + delay 0x0 + createsprite gSpriteTemplate_ExpandingForceExplode, ANIM_TARGET, 4, 0x0000, 0xfff5, ANIM_TARGET + delay 0x0 + createsprite gSpriteTemplate_ExpandingForceExplode, ANIM_TARGET, 4, 0x0003, 0xffe5, ANIM_TARGET + delay 0x0 + createsprite gSpriteTemplate_ExpandingForceExplode, ANIM_TARGET, 4, 0xfff5, 0xffd1, ANIM_TARGET + delay 0x0 + createsprite gSpriteTemplate_ExpandingForceExplode, ANIM_TARGET, 4, 0x0008, 0xffdb, ANIM_TARGET + delay 0x0 + createsprite gSpriteTemplate_ExpandingForceExplode, ANIM_TARGET, 4, 0xfffa, 0xfff2, ANIM_TARGET + delay 0x0 + createsprite gSpriteTemplate_ExpandingForceExplode, ANIM_TARGET, 4, 0x0000, 0xffe5, ANIM_TARGET + return + +MaxKnuckleExplosionGeyser: + createsprite gLightThatBurnsTheSkyExplosionSpriteTemplate, ANIM_TARGET, 4, 0x0003, 0x0005, ANIM_TARGET, 0x0 + playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET + delay 0x0 + createsprite gLightThatBurnsTheSkyExplosionSpriteTemplate, ANIM_TARGET, 4, 0xfff5, 0xfff1, ANIM_TARGET, 0x0 + playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET + delay 0x0 + createsprite gLightThatBurnsTheSkyExplosionSpriteTemplate, ANIM_TARGET, 4, 0x0008, 0xfffb, ANIM_TARGET, 0x0 + playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET + delay 0x0 + createsprite gLightThatBurnsTheSkyExplosionSpriteTemplate, ANIM_TARGET, 4, 0xfffa, 0x0012, ANIM_TARGET, 0x0 + playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET + delay 0x0 + createsprite gLightThatBurnsTheSkyExplosionSpriteTemplate, ANIM_TARGET, 4, 0x0000, 0x0005, ANIM_TARGET, 0x0 + playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET + delay 0x0 + createsprite gLightThatBurnsTheSkyExplosionSpriteTemplate, ANIM_TARGET, 4, 0x0003, 0xfff5, ANIM_TARGET, 0x0 + delay 0x0 + createsprite gLightThatBurnsTheSkyExplosionSpriteTemplate, ANIM_TARGET, 4, 0xfff5, 0xffe1, ANIM_TARGET, 0x0 + delay 0x0 + createsprite gLightThatBurnsTheSkyExplosionSpriteTemplate, ANIM_TARGET, 4, 0x0008, 0xffeb, ANIM_TARGET, 0x0 + delay 0x0 + createsprite gLightThatBurnsTheSkyExplosionSpriteTemplate, ANIM_TARGET, 4, 0xfffa, 0x0002, ANIM_TARGET, 0x0 + delay 0x0 + createsprite gLightThatBurnsTheSkyExplosionSpriteTemplate, ANIM_TARGET, 4, 0x0000, 0xfff5, ANIM_TARGET, 0x0 + delay 0x0 + createsprite gLightThatBurnsTheSkyExplosionSpriteTemplate, ANIM_TARGET, 4, 0x0003, 0xffe5, ANIM_TARGET, 0x0 + delay 0x0 + createsprite gLightThatBurnsTheSkyExplosionSpriteTemplate, ANIM_TARGET, 4, 0xfff5, 0xffd1, ANIM_TARGET, 0x0 + delay 0x0 + createsprite gLightThatBurnsTheSkyExplosionSpriteTemplate, ANIM_TARGET, 4, 0x0008, 0xffdb, ANIM_TARGET, 0x0 + delay 0x0 + createsprite gLightThatBurnsTheSkyExplosionSpriteTemplate, ANIM_TARGET, 4, 0xfffa, 0xfff2, ANIM_TARGET, 0x0 + delay 0x0 + createsprite gLightThatBurnsTheSkyExplosionSpriteTemplate, ANIM_TARGET, 4, 0x0000, 0xffe5, ANIM_TARGET, 0x0 + return + +@Credits to Skeli Move_STEEL_ROLLER:: - goto Move_GYRO_BALL + loadspritegfx ANIM_TAG_STEAMROLLER + loadspritegfx ANIM_TAG_IMPACT + loadspritegfx ANIM_TAG_ROCKS + playsewithpan SE_M_DOUBLE_TEAM, SOUND_PAN_TARGET + createsprite gSpriteTemplate_SteelRoller, ANIM_TARGET, 3, 0, -40, 2, 50, 3 + delay 1 + createvisualtask AnimTask_SquishTarget, 0x2, + delay 14 + call SteelRollerRocks + delay 33 + call SteelRollerRocks + waitforvisualfinish + end +SteelRollerRocks: + playsewithpan SE_M_STRENGTH, SOUND_PAN_TARGET + createsprite gRockScatterSpriteTemplate, ANIM_TARGET, 2, 0xfff4, 0x1b, 0x2, 0x3 + createsprite gRockScatterSpriteTemplate, ANIM_TARGET, 2, 0x8, 0x1c, 0x3, 0x4 + createsprite gRockScatterSpriteTemplate, ANIM_TARGET, 2, 0xfffc, 0x1e, 0x2, 0x3 + createsprite gRockScatterSpriteTemplate, ANIM_TARGET, 2, 0xc, 0x19, 0x4, 0x4 + return +@Credits to Skeli Move_SCALE_SHOT:: - end @to do: + loadspritegfx ANIM_TAG_SHELL_RIGHT + loadspritegfx ANIM_TAG_IMPACT + createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 0x4, 0x6 + delay 0x3 + playsewithpan SE_M_BONEMERANG, SOUND_PAN_ATTACKER + createsprite gSpriteTemplate_ScaleShotScale, ANIM_TARGET, 2, 0x10, 0x0, 0x0, 0x0, 0x14, 0x101 + waitforvisualfinish + playsewithpan SE_M_ROCK_THROW, SOUND_PAN_TARGET + createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 0x0, 0x0, 0x1, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 5, 1 + delay 0x10 + stopsound + waitforvisualfinish + end +@Credits to Skeli Move_METEOR_BEAM:: - end @to do: + loadspritegfx ANIM_TAG_ROCKS + fadetobg BG_COSMIC + waitbgfadeout + choosetwoturnanim METEOR_BEAM_CHARGE METEOR_BEAM_BLAST + +METEOR_BEAM_CHARGE: + createvisualtask AnimTask_StartSlidingBg, 0x5, 0x0, 0xFC00, FALSE, 0xffff + waitbgfadein + monbg ANIM_ATK_PARTNER + playsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER + call ContinentalCrushStockpileRocks + playsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER + call ContinentalCrushStockpileRocks + waitforvisualfinish + clearmonbg ANIM_ATK_PARTNER + call UnsetPsychicBg + end + +METEOR_BEAM_BLAST: + createvisualtask AnimTask_StartSlidingBg, 0x5, 0xf700, 0x0, TRUE, 0xffff @;Scroll right/left + waitbgfadein + monbg ANIM_TARGET + panse SE_M_SOLAR_BEAM, SOUND_PAN_ATTACKER SOUND_PAN_TARGET 0x2 0x0 + createvisualtask AnimTask_ShakeMon, 2, ANIM_ATTACKER, 0, 4, 87, 1 + call MeteorBeamRockLaunch + call MeteorBeamRockLaunch + call MeteorBeamRockLaunch + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 0, 4, 81, 1 + call MeteorBeamRockLaunch + call MeteorBeamRockLaunch + call MeteorBeamRockLaunch + call MeteorBeamRockLaunch + call MeteorBeamRockLaunch + call MeteorBeamRockLaunch + call MeteorBeamRockLaunch + call MeteorBeamRockLaunch + call MeteorBeamRockLaunch + call MeteorBeamRockLaunch + call MeteorBeamRockLaunch + call MeteorBeamRockLaunch + call MeteorBeamRockLaunch + call MeteorBeamRockLaunch + call MeteorBeamRockLaunch + call MeteorBeamRockLaunch + call MeteorBeamRockLaunch + call MeteorBeamRockLaunch + waitforvisualfinish + clearmonbg ANIM_TARGET + call UnsetPsychicBg + end + +MeteorBeamRockLaunch: + createsprite gSpriteTemplate_MeteorBeamRock, ANIM_TARGET, 2, 0, 0, 0x10 + delay 0x2 + createsprite gSpriteTemplate_MeteorBeamRock, ANIM_TARGET, 2, 0, 0, 0x10 + delay 0x2 + return Move_SHELL_SIDE_ARM:: createvisualtask AnimTask_ShellSideArm, 0x5 @@ -14215,19 +14485,116 @@ Move_SHELL_SIDE_ARM_SPECIAL: @ Modified Snipe Shot, placeholder playsewithpan SE_M_GIGA_DRAIN, SOUND_PAN_TARGET createsprite gSnipeShotBallTemplate, ANIM_TARGET, 2, 0, 0, 24 waitforvisualfinish - createvisualtask AnimTask_ShakeMon2, 2, 1, 4, 0, 8, 1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 8, 1 waitforvisualfinish end +@Credits to Skeli Move_MISTY_EXPLOSION:: - end @to do: + loadspritegfx ANIM_TAG_EXPLOSION + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 0x1, 0x8, 0x9, 0x7A5B, 0x8, 0x0, 0x8 + createvisualtask AnimTask_ShakeMon2, 5, ANIM_PLAYER_LEFT, 8, 0, 40, 1 + createvisualtask AnimTask_ShakeMon2, 5, ANIM_PLAYER_RIGHT, 8, 0, 40, 1 + createvisualtask AnimTask_ShakeMon2, 5, ANIM_OPPONENT_LEFT, 8, 0, 40, 1 + createvisualtask AnimTask_ShakeMon2, 5, ANIM_OPPONENT_RIGHT, 8, 0, 40, 1 + createvisualtask AnimTask_ShakeMon2, 5, ANIM_ATTACKER_FORCE, 8, 0, 40, 1 + call Explosion1 + call Explosion1 + waitforvisualfinish + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, 0x1, 0x1, 0x10, 0x10, 0x7F7F @;White Pink + delay 0x32 + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, 0x1, 0x3, 0x10, 0x0, 0x7F7F @;White Pink + end +@Credits to Skeli Move_GRASSY_GLIDE:: - end @to do: - -Move_RISING_VOLTAGE:: - end @to do: - + loadspritegfx ANIM_TAG_LEAF @leaves + loadspritegfx ANIM_TAG_IMPACT @hits + loadspritegfx ANIM_TAG_WHIP_HIT + createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_IMPACT, 0x0, 0xD, 0xD, 0x0266 @;Leaf Green + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 2, 0, 8, RGB(12, 29, 0) + delay 0x2 + playsewithpan SE_M_JUMP_KICK, SOUND_PAN_ATTACKER + createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 0, -120, 0, 0, 10 @;Slide off off, screen + waitforvisualfinish + call GrassPledgeMiddleFountain + waitforvisualfinish + createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0x0, 0x2 + end + +@Credits to Skeli +Move_RISING_VOLTAGE:: + loadspritegfx ANIM_TAG_ELECTRIC_ORBS + loadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT + loadspritegfx ANIM_TAG_SPARK_2 + loadspritegfx ANIM_TAG_LIGHTNING + monbg ANIM_ATTACKER + setalpha 12, 8 + createvisualtask AnimTask_GetBattleTerrain, 0x5, + jumpargeq 0x0, BG_ELECTRIC_TERRAIN, ANIM_RISING_VOLTAGE_STRONGER +ANIM_RISING_VOLTAGE_NORMAL: + createvisualtask AnimTask_BlendBattleAnimPal, 0x2, F_PAL_BG, 0x1, 0x0, 0x4, 0x0 @;To black + waitforvisualfinish + createvisualtask AnimTask_ElectricChargingParticles, 2, ANIM_ATTACKER, 30, 0, 3 @;Amount, Slowness, Slowness, Compaction + playsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER + delay 0xc + createsprite gGrowingShockWaveOrbSpriteTemplate, ANIM_ATTACKER, 0, 0x0 + waitforvisualfinish + createvisualtask AnimTask_ShakeTargetBasedOnMovePowerOrDmg, 0x2, 0x0, 0x1, 0x34, 0x1, 0x0 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 1, 4, 0, 12, RGB(29, 28, 1) + playsewithpan SE_M_TRI_ATTACK2, SOUND_PAN_TARGET + createsprite gLightningSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x10 + delay 0x1 + createsprite gLightningSpriteTemplate, ANIM_TARGET, 2, 0x0, 0xfff0 + delay 0x1 + createsprite gLightningSpriteTemplate, ANIM_TARGET, 2, 0x0, 0xffe0 + call StokedSparksurferSparkGeyser + call StokedSparksurferSparkGeyser + waitforvisualfinish + createvisualtask AnimTask_BlendBattleAnimPal, 0x2, F_PAL_BG, 0x1, 0x4, 0x0, 0x0 @;From black + waitforvisualfinish + clearmonbg ANIM_ATTACKER + end + +ANIM_RISING_VOLTAGE_STRONGER: + createvisualtask AnimTask_BlendBattleAnimPal, 0x2, F_PAL_BG, 0x1, 0x0, 0xC, 0x0 @;To black + waitforvisualfinish + createvisualtask AnimTask_ElectricChargingParticles, 2, ANIM_ATTACKER, 55, 0, 0 @;Amount, Slowness, Slowness, Compaction + playsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER + delay 0xc + createsprite gGrowingShockWaveOrbSpriteTemplate, ANIM_ATTACKER, 2, + waitforvisualfinish + createvisualtask AnimTask_ShakeTargetBasedOnMovePowerOrDmg, 0x2, 0x0, 0x1, 0x54, 0x1, 0x0 + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x4, 0x0, 0x10, 0x079D + playsewithpan SE_M_TRI_ATTACK2, SOUND_PAN_TARGET + createsprite gLightningSpriteTemplate, ANIM_TARGET, 2, 0x10, 0x10 + delay 0x1 + createsprite gLightningSpriteTemplate, ANIM_TARGET, 2, 0x10, 0xfff0 + delay 0x1 + createsprite gLightningSpriteTemplate, ANIM_TARGET, 2, 0x10, 0xffe0 + call StokedSparksurferSparkGeyser + playsewithpan SE_M_TRI_ATTACK2, SOUND_PAN_TARGET + createsprite gLightningSpriteTemplate, ANIM_TARGET, 2, -0x18, 0x10 + delay 0x1 + createsprite gLightningSpriteTemplate, ANIM_TARGET, 2, -0x18, 0xfff0 + delay 0x1 + createsprite gLightningSpriteTemplate, ANIM_TARGET, 2, -0x18, 0xffe0 + call StokedSparksurferSparkGeyser + playsewithpan SE_M_TRI_ATTACK2, SOUND_PAN_TARGET + createsprite gLightningSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x10 + delay 0x1 + createsprite gLightningSpriteTemplate, ANIM_TARGET, 2, 0x0, 0xfff0 + delay 0x1 + createsprite gLightningSpriteTemplate, ANIM_TARGET, 2, 0x0, 0xffe0 + call StokedSparksurferSparkGeyser + waitforvisualfinish + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x1, 0x10, 0x0, 0x079D @;From Yellow + createvisualtask AnimTask_BlendBattleAnimPal, 0x2, F_PAL_BG, 0x1, 0xC, 0x0, 0x0 @;From black + waitforvisualfinish + clearmonbg ANIM_ATTACKER + end + + Move_TERRAIN_PULSE:: loadspritegfx ANIM_TAG_DRAGON_PULSE monbg ANIM_TARGET @@ -14246,7 +14613,7 @@ TerrainPulseNormal: call DragonPulseParticle call DragonPulseParticle createvisualtask AnimTask_SwayMon, 5, 0, 2, 51200, 24, ANIM_TARGET - createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 12, RGB_WHITE goto TerrainPulseEnd TerrainPulseElectric: @@ -14257,7 +14624,7 @@ TerrainPulseElectric: call DragonPulseParticle call DragonPulseParticle createvisualtask AnimTask_SwayMon, 5, 0, 4, 51200, 24, ANIM_TARGET - createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB(27, 27, 0) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 12, RGB(27, 27, 0) goto TerrainPulseEnd TerrainPulseGrass: @@ -14268,7 +14635,7 @@ TerrainPulseGrass: call DragonPulseParticle call DragonPulseParticle createvisualtask AnimTask_SwayMon, 5, 0, 4, 51200, 24, ANIM_TARGET - createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB(11, 26, 11) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 12, RGB(11, 26, 11) goto TerrainPulseEnd TerrainPulseFairy: @@ -14279,7 +14646,7 @@ TerrainPulseFairy: call DragonPulseParticle call DragonPulseParticle createvisualtask AnimTask_SwayMon, 5, 0, 4, 51200, 24, ANIM_TARGET - createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB(31, 24, 31) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 12, RGB(31, 24, 31) goto TerrainPulseEnd TerrainPulsePsychic: @@ -14290,7 +14657,7 @@ TerrainPulsePsychic: call DragonPulseParticle call DragonPulseParticle createvisualtask AnimTask_SwayMon, 5, 0, 4, 51200, 24, ANIM_TARGET - createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB(27, 0, 13) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 12, RGB(27, 0, 13) goto TerrainPulseEnd TerrainPulseEnd: @@ -14312,124 +14679,1786 @@ TerrainPulseEnd: end Move_SKITTER_SMACK:: - end @to do: + loadspritegfx ANIM_TAG_IMPACT @Hits + loadspritegfx ANIM_TAG_WHITE_SHADOW @Destiny Bond + loadspritegfx ANIM_TAG_QUICK_GUARD_HAND @Black Colour + loadspritegfx ANIM_TAG_RAZOR_LEAF + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x0, 0x10, 0x7FFF + waitforvisualfinish + playsewithpan SE_M_FAINT_ATTACK, SOUND_PAN_ATTACKER + invisible ANIM_ATTACKER + delay 1 + visible ANIM_ATTACKER + delay 1 + invisible ANIM_ATTACKER + delay 1 + visible ANIM_ATTACKER + delay 1 + invisible ANIM_ATTACKER + waitsound + createvisualtask AnimTask_DestinyBondWhiteShadow, 0x5, 0x0, 0x30 + delay 0x17 + createvisualtask AnimTask_IsTargetSameSide, 0x2, + createvisualtask AnimTask_SnatchOpposingMonMove, 0x2, + delay 0x19 + visible ANIM_ATTACKER + invisible ANIM_ATTACKER + delay 5 + createsprite gSkitterSmackImpactTemplate, ANIM_TARGET, 2, 0xfff6, 0xfff6, 0x0 + call HyperspaceHoleMovement + createsprite gSkitterSmackImpactTemplate, ANIM_TARGET, 2, 0xa, 0x14, 0x0 + call HyperspaceHoleMovement + createsprite gSkitterSmackImpactTemplate, ANIM_TARGET, 2, 0xfffb, 0xa, 0x0 + call HyperspaceHoleMovement + createsprite gSkitterSmackImpactTemplate, ANIM_TARGET, 2, 0x11, 0xfff4, 0x0 + call HyperspaceHoleMovement + waitforvisualfinish + visible ANIM_ATTACKER + delay 1 + invisible ANIM_ATTACKER + delay 1 + visible ANIM_ATTACKER + delay 1 + invisible ANIM_ATTACKER + delay 1 + visible ANIM_ATTACKER + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x10, 0x0, 0x7FFF + waitforvisualfinish + end +@Credits to Skeli Move_BURNING_JEALOUSY:: - goto Move_OVERHEAT + loadspritegfx ANIM_TAG_SMALL_EMBER + playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER + createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 0, 2, 42, 1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 8, RGB_RED + call BurningJealousyFireBuffEffect + delay 0x8 + call BurningJealousyFireBuffEffect + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 8, RGB_RED + delay 0x4 + call BurningJealousyFireBuffEffect + waitforvisualfinish + monbg ANIM_TARGET + playsewithpan SE_M_FLAME_WHEEL2, SOUND_PAN_ATTACKER + createvisualtask AnimTask_FlailMovement, 2, ANIM_ATTACKER + call BurningJealousyFlames + delay 0x8 + call BurningJealousyFlames + delay 0x8 + call BurningJealousyFlames + playsewithpan SE_M_FIRE_PUNCH, SOUND_PAN_TARGET + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 12, 1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_DEF_PARTNER, 2, 0, 12, 1 + createvisualtask AnimTask_BlendMonInAndOut, 3, ANIM_TARGET, RGB_RED, 12, 1, 1 + createvisualtask AnimTask_BlendMonInAndOut, 3, ANIM_DEF_PARTNER, RGB_RED, 12, 1, 1 + call FireSpreadEffect @ INCINERATE_BURN_CHANCE + waitforvisualfinish + clearmonbg ANIM_TARGET + end + +BurningJealousyFireBuffEffect: + createsprite gSpriteTemplate_BurningJealousyFireBuff, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0xffe8, 0x1a, 0x2, 0x18 + delay 0x3 + createsprite gSpriteTemplate_BurningJealousyFireBuff, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0xe, 0x1c, 0x1, 0x18 + delay 0x3 + createsprite gSpriteTemplate_BurningJealousyFireBuff, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0xfffb, 0xa, 0x2, 0x18 + delay 0x3 + createsprite gSpriteTemplate_BurningJealousyFireBuff, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0x1c, 0x1a, 0x3, 0x18 + delay 0x3 + return + +BurningJealousyFlames: + createsprite gSpriteTemplate_BurningJealousyEmit, ANIM_ATTACKER, 2, 0x0, 0x0, 0x1e, 0xfb00, 0x0, 0x3 + createsprite gSpriteTemplate_BurningJealousyEmit, ANIM_ATTACKER, 2, 0x0, 0x0, 0x1e, 0x0, 0x0500, 0x3 + createsprite gSpriteTemplate_BurningJealousyEmit, ANIM_ATTACKER, 2, 0x0, 0x0, 0x1e, 0x0, 0xfb00, 0x3 + createsprite gSpriteTemplate_BurningJealousyEmit, ANIM_ATTACKER, 2, 0x0, 0x0, 0x1e, 0x0500, 0x0300, 0x3 + createsprite gSpriteTemplate_BurningJealousyEmit, ANIM_ATTACKER, 2, 0x0, 0x0, 0x1e, 0xfb00, 0x0300, 0x3 + createsprite gSpriteTemplate_BurningJealousyEmit, ANIM_ATTACKER, 2, 0x0, 0x0, 0x1e, 0x0500, 0xfd00, 0x3 + createsprite gSpriteTemplate_BurningJealousyEmit, ANIM_ATTACKER, 2, 0x0, 0x0, 0x1e, 0xfb00, 0xfd00, 0x3 + return + +@Credits to Skeli Move_LASH_OUT:: - end @to do: + loadspritegfx ANIM_TAG_FOCUS_ENERGY @focus energy + loadspritegfx ANIM_TAG_HANDS_AND_FEET @black color + loadspritegfx ANIM_TAG_SLAM_HIT_2 + loadspritegfx ANIM_TAG_IMPACT @hit + createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_SLAM_HIT_2, 0x0, 0xA, 0xA, 0x1F + monbg ANIM_DEF_PARTNER + playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER + call PowerTripBuffUp + delay 0x8 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB_RED + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 + call PowerTripBuffUp + delay 0x8 + call PowerTripBuffUp + waitforvisualfinish + fadetobg BG_DARK + waitbgfadein + playsewithpan SE_M_VITAL_THROW, SOUND_PAN_TARGET + createsprite gSpriteTemplate_LashOutStrike, ANIM_TARGET, 2, 0xfff0, 0xfff0, FALSE + delay 0x8 + createsprite gFoulPlayImpactTemplate, ANIM_TARGET, 3, 10, 0x0, ANIM_TARGET, 0x1 + playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET + createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, ANIM_TARGET, 0xfff4, 0xa, 0x0, 0x3 + delay 0x8 + createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_TARGET, 0x0, 0x5 + delay 0x8 + playsewithpan SE_M_VITAL_THROW, SOUND_PAN_TARGET + createsprite gSpriteTemplate_LashOutStrike, ANIM_TARGET, 2, 0xfff0, 0xfff0, TRUE + delay 0x8 + createsprite gFoulPlayImpactTemplate, ANIM_TARGET, 3, -10, 0x0, ANIM_TARGET, 0x1 + playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET + createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, ANIM_TARGET, 0xC, 0xa, 0x0, 0x3 + delay 0x8 + waitforvisualfinish + createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_TARGET, 0x0, 0x5 + restorebg + clearmonbg ANIM_DEF_PARTNER + end + + +Move_POLTERGEIST:: + loadspritegfx ANIM_TAG_EYE_SPARKLE + loadspritegfx ANIM_TAG_WHITE_SHADOW @Destiny Bond + loadspritegfx ANIM_TAG_QUICK_GUARD_HAND @Black Colour + loadspritegfx ANIM_TAG_IMPACT + loadspritegfx ANIM_TAG_POLTERGEIST + fadetobg BG_NIGHTMARE + waitbgfadein + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 2, 0, 0, 16, RGB_BLACK + waitforvisualfinish + createsprite gEyeSparkleSpriteTemplate, ANIM_ATTACKER, 0, -16, -8 + createsprite gEyeSparkleSpriteTemplate, ANIM_ATTACKER, 0, 16, -8 + playsewithpan SE_M_DETECT, SOUND_PAN_ATTACKER + waitforvisualfinish + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 2, 0, 16, 0, RGB_BLACK + playsewithpan SE_M_FAINT_ATTACK, SOUND_PAN_ATTACKER + delay 0x1 + createvisualtask AnimTask_DestinyBondWhiteShadow, 0x5, 0x0, 0x24 + delay 0x30 + playsewithpan SE_M_SAND_ATTACK, SOUND_PAN_TARGET + createvisualtask AnimTask_PoltergeistItem, 2 + waitforvisualfinish + setalpha 12, 8 + createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x1, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 5, 5, 1 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 0x7, 0x5, 0x1, 0x0, 0xa, 0x0, 0x0 + playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET + waitforvisualfinish + createvisualtask AnimTask_NightmareClone, 0x2 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 40, 1 + playsewithpan SE_M_NIGHTMARE, SOUND_PAN_TARGET + waitforvisualfinish + restorebg + waitbgfadein + clearmonbg 0x3 + blendoff + end + +@Credits to Skeli +Move_CORROSIVE_GAS:: + loadspritegfx ANIM_TAG_PINK_CLOUD @Fumes + createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_PINK_CLOUD, 0x0, 0xE, 0xE, 0x19EF @;Garbage green + monbg ANIM_ATTACKER + loopsewithpan SE_M_FLAME_WHEEL2, SOUND_PAN_ATTACKER, 0x8, 0x3 + delay 0x0 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 1, 2, 0, 15, RGB(15, 15, 6) @;Garbage green + createsprite gSpriteTemplate_CorrosiveGasSmoke, ANIM_ATTACKER, 0x7a, 0x3, 0xfff2, 0x12, 0x2e + delay 0x0 + createsprite gSpriteTemplate_CorrosiveGasSmoke, ANIM_ATTACKER, 0x79, 0x3, 0xe, 0xfff2, 0x2e + delay 0x0 + createsprite gSpriteTemplate_CorrosiveGasSmoke, ANIM_ATTACKER, 0x78, 0x3, 0xfff4, 0xfff6, 0x2e + delay 0x0 + createsprite gSpriteTemplate_CorrosiveGasSmoke, ANIM_ATTACKER, 0x77, 0x3, 0xe, 0xe, 0x2e + delay 0x0 + createsprite gSpriteTemplate_CorrosiveGasSmoke, ANIM_ATTACKER, 0x76, 0x3, 0x0, 0x0, 0x2e + delay 0x0 + createsprite gSpriteTemplate_CorrosiveGasSmoke, ANIM_ATTACKER, 0x7b, 0x3, 0x4, 0x4, 0x1e + waitforvisualfinish + playsewithpan SE_M_TOXIC, SOUND_PAN_TARGET + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_TARGET | F_PAL_ATK_PARTNER | F_PAL_DEF_PARTNER), 1, 2, 0, 14, RGB(15, 15, 6) @;Garbage green + waitforvisualfinish + clearmonbg ANIM_ATTACKER + end + +@Credits to Skeli +Move_COACHING:: + playsewithpan SE_M_TAIL_WHIP, SOUND_PAN_ATTACKER + createvisualtask AnimTask_Splash, 2, ANIM_ATTACKER, 1 + waitforvisualfinish + playsewithpan SE_M_TAIL_WHIP, SOUND_PAN_TARGET + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 1, 2, 0, 10, RGB(29, 18, 7) + createvisualtask AnimTask_Splash, 2, ANIM_TARGET, 1 + waitforvisualfinish + end + +@Credits to Skeli +Move_FLIP_TURN:: + loadspritegfx ANIM_TAG_ICE_CRYSTALS @;Bubbles + loadspritegfx ANIM_TAG_HYDRO_PUMP + loadspritegfx ANIM_TAG_WATER_IMPACT + monbg ANIM_TARGET + setalpha 12, 8 + call WaterfallBubblesOnAttacker + waitforvisualfinish + invisible ANIM_ATTACKER + playsewithpan SE_M_JUMP_KICK, SOUND_PAN_ATTACKER + createsprite gSpriteTemplate_FlipTurnThere, ANIM_TARGET, 2, 0x0, 0x0, 0x15 + waitforvisualfinish + playsewithpan SE_M_TAIL_WHIP, SOUND_PAN_TARGET + createsprite gWaterHitSplatSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x0, 0x1, 0x2 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 + createsprite gSpriteTemplate_FlipTurnBack, ANIM_ATTACKER, 3, 0x0, 0xFFF1, 0xFFF0, 0x24 + waitforvisualfinish + visible ANIM_ATTACKER + clearmonbg ANIM_TARGET + blendoff + end + + +@Credits to Skeli +Move_TRIPLE_AXEL:: + loadspritegfx ANIM_TAG_HANDS_AND_FEET + loadspritegfx ANIM_TAG_IMPACT + loadspritegfx ANIM_TAG_ICE_CRYSTALS + monbg ANIM_DEF_PARTNER + setalpha 12, 8 + playsewithpan SE_M_VITAL_THROW2, 0x3f + jumpifmoveturn 0, TripleAxelTurn0 + jumpifmoveturn 1, TripleAxelTurn1 + goto TripleAxelTurn2 +TripleAxelTurn0: + createsprite gFistFootSpriteTemplate, ANIM_TARGET, 4, 0xfff0, 0xfff8, 0x14, 0x1, 0x2 + createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 0xfff0, 0xfff0, 0x1, 0x2 + createsprite gTripleAxelIceCrystalSpriteTemplate, ANIM_TARGET, 1, 0xfff0, 0xfff8, 0xff00, 0xffd8 + createsprite gTripleAxelIceCrystalSpriteTemplate, ANIM_TARGET, 1, 0xfff0, 0xfff8, 0x1a0, 0xffda + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 4, 0, 4, 1 + goto TripleAxelEnd +TripleAxelTurn1: + createsprite gFistFootSpriteTemplate, ANIM_TARGET, 4, 0x8, 0x8, 0x14, 0x1, 0x2 + createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 0x8, 0x0, 0x1, 0x2 + createsprite gTripleAxelIceCrystalSpriteTemplate, ANIM_TARGET, 1, 0x8, 0x8, 0xa0, 0xffe0 + createsprite gTripleAxelIceCrystalSpriteTemplate, ANIM_TARGET, 1, 0x8, 0x8, 0xff00, 0xffd8 + createsprite gTripleAxelIceCrystalSpriteTemplate, ANIM_TARGET, 1, 0x8, 0x8, 0x1a0, 0xffda + createsprite gTripleAxelIceCrystalSpriteTemplate, ANIM_TARGET, 1, 0x8, 0x8, 0xfe80, 0xffe1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 4, 0, 6, 1 + goto TripleAxelEnd +TripleAxelTurn2: + createsprite gFistFootSpriteTemplate, ANIM_TARGET, 4, 0x0, 0x0, 0x14, 0x1, 0x2 + createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 0x0, 0xfff8, 0x1, 0x1 + createsprite gTripleAxelIceCrystalSpriteTemplate, ANIM_TARGET, 1, 0x0, 0x0, 0xa0, 0xffe0 + createsprite gTripleAxelIceCrystalSpriteTemplate, ANIM_TARGET, 1, 0x0, 0x0, 0xff00, 0xffd8 + createsprite gTripleAxelIceCrystalSpriteTemplate, ANIM_TARGET, 1, 0x0, 0x0, 0x80, 0xfff0 + createsprite gTripleAxelIceCrystalSpriteTemplate, ANIM_TARGET, 1, 0x0, 0x0, 0x1a0, 0xffda + createsprite gTripleAxelIceCrystalSpriteTemplate, ANIM_TARGET, 1, 0x0, 0x0, 0xff80, 0xffea + createsprite gTripleAxelIceCrystalSpriteTemplate, ANIM_TARGET, 1, 0x0, 0x0, 0xfe80, 0xffe1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 6, 0, 8, 1 +TripleAxelEnd: + delay 4 + playsewithpan SE_M_ICY_WIND, 0x3f + waitforvisualfinish + clearmonbg ANIM_DEF_PARTNER + blendoff + end + +@Credits to Skeli +Move_DUAL_WINGBEAT:: + loadspritegfx ANIM_TAG_IMPACT + loadspritegfx ANIM_TAG_WHITE_FEATHER + setalpha 12, 8 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 10, 1 + playsewithpan SE_M_WING_ATTACK, SOUND_PAN_TARGET + jumpifmoveturn 1, DualWingbeatRightSide +DualWingbeatLeftSide: + createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 2, -20, 10, ANIM_TARGET, 0x2 + delay 1 + playsewithpan SE_M_WING_ATTACK, SOUND_PAN_TARGET + createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, -20, 0, ANIM_TARGET, 0x2 + call DualWingbeatFeatherScatterLeft + delay 1 + playsewithpan SE_M_WING_ATTACK, SOUND_PAN_TARGET + createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 4, -20, -10, ANIM_TARGET, 0x2 + delay 1 + playsewithpan SE_M_WING_ATTACK, SOUND_PAN_TARGET + createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 5, -20, -20, ANIM_TARGET, 0x2 + delay 1 + playsewithpan SE_M_WING_ATTACK, SOUND_PAN_TARGET + createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 6, -20, -30, ANIM_TARGET, 0x2 + waitforvisualfinish + blendoff + end +DualWingbeatRightSide: + createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 2, 10, 10, ANIM_TARGET, 0x2 + delay 1 + playsewithpan SE_M_WING_ATTACK, SOUND_PAN_TARGET + createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 10, 0, ANIM_TARGET, 0x2 + call DualWingbeatFeatherScatterRight + delay 1 + playsewithpan SE_M_WING_ATTACK, SOUND_PAN_TARGET + createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 4, 10, -10, ANIM_TARGET, 0x2 + delay 1 + playsewithpan SE_M_WING_ATTACK, SOUND_PAN_TARGET + createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 5, 10, -20, ANIM_TARGET, 0x2 + delay 1 + playsewithpan SE_M_WING_ATTACK, SOUND_PAN_TARGET + createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 6, 10, -30, ANIM_TARGET, 0x2 + waitforvisualfinish + blendoff + end +DualWingbeatFeatherScatterLeft: + createsprite gDualWingbeatFeatherSpriteTemplate, ANIM_TARGET, 1, 0xfff0, 0xfff8, 0xa0, 0xffe0 + createsprite gDualWingbeatFeatherSpriteTemplate, ANIM_TARGET, 1, 0xfff0, 0xfff8, 0xff00, 0xffd8 + createsprite gDualWingbeatFeatherSpriteTemplate, ANIM_TARGET, 1, 0xfff0, 0xfff8, 0x1a0, 0xffda + createsprite gDualWingbeatFeatherSpriteTemplate, ANIM_TARGET, 1, 0xfff0, 0xfff8, 0xfe80, 0xffe1 + return +DualWingbeatFeatherScatterRight: + createsprite gDualWingbeatFeatherSpriteTemplate, ANIM_TARGET, 1, 0, 0xfff8, 0xa0, 0xffe0 + createsprite gDualWingbeatFeatherSpriteTemplate, ANIM_TARGET, 1, 0, 0xfff8, 0xff00, 0xffd8 + createsprite gDualWingbeatFeatherSpriteTemplate, ANIM_TARGET, 1, 0, 0xfff8, 0x1a0, 0xffda + createsprite gDualWingbeatFeatherSpriteTemplate, ANIM_TARGET, 1, 0, 0xfff8, 0xfe80, 0xffe1 + return + +@ credits to Skeli +Move_SCORCHING_SANDS:: + loadspritegfx ANIM_TAG_MUD_SAND + loadspritegfx ANIM_TAG_SMALL_EMBER + monbg ANIM_ATK_PARTNER + splitbgprio ANIM_ATTACKER + setalpha 12, 8 + playsewithpan SE_M_SAND_ATTACK, SOUND_PAN_ATTACKER + createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0xfff6, 0x0, 0x0, 0x3 + waitforvisualfinish + createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x2 + call SandAttackDirt + call SandAttackDirt + call SandAttackDirt + call SandAttackDirt + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 2, 0, 25, 1 + call SandAttackDirt + call SandAttackDirt + playsewithpan SE_M_FIRE_PUNCH, SOUND_PAN_TARGET + call FireSpreadEffect + waitforvisualfinish + clearmonbg ANIM_ATK_PARTNER + blendoff + end + +@ credits to skeli +Move_JUNGLE_HEALING:: + loadspritegfx ANIM_TAG_ROOTS + loadspritegfx ANIM_TAG_ORBS + loadspritegfx ANIM_TAG_SPARKLE_2 + fadetobg BG_SNUGGLE_FOREVER + waitbgfadeout + createsprite gIngrainRootSpriteTemplate, ANIM_ATTACKER, 2, 0x10, 0x1a, 0xffff, 0x2, 0x96 + playsewithpan SE_M_SCRATCH, SOUND_PAN_ATTACKER + delay 0xa + createsprite gIngrainRootSpriteTemplate, ANIM_ATTACKER, 2, 0xffe0, 0x14, 0x1, 0x1, 0x8c + playsewithpan SE_M_SCRATCH, SOUND_PAN_ATTACKER + delay 0xa + createsprite gIngrainRootSpriteTemplate, ANIM_ATTACKER, 2, 0x20, 0x16, 0x1, 0x0, 0x82 + playsewithpan SE_M_SCRATCH, SOUND_PAN_ATTACKER + delay 0xa + createsprite gIngrainRootSpriteTemplate, ANIM_ATTACKER, 2, 0xfff0, 0x19, 0xffff, 0x3, 0x78 + playsewithpan SE_M_SCRATCH, SOUND_PAN_ATTACKER + delay 0x28 + createsprite gIngrainOrbSpriteTemplate, ANIM_ATTACKER, 3, 0x20, 0x1a, 0xffff, 0x3, 0x1e + delay 0x5 + playsewithpan SE_M_BUBBLE3, SOUND_PAN_ATTACKER + delay 0x5 + createsprite gIngrainOrbSpriteTemplate, ANIM_ATTACKER, 3, 0xffd0, 0x14, 0x1, 0x2, 0x1e + playsewithpan SE_M_BUBBLE3, SOUND_PAN_ATTACKER + delay 0x5 + playsewithpan SE_M_BUBBLE3, SOUND_PAN_ATTACKER + delay 0x5 + createsprite gIngrainOrbSpriteTemplate, ANIM_ATTACKER, 3, 0x30, 0x1a, 0xfffe, 0x3, 0x12 + playsewithpan SE_M_BUBBLE3, SOUND_PAN_ATTACKER + delay 0xa + playsewithpan SE_M_STAT_INCREASE, 0xc0 + createvisualtask AnimTask_StatusClearedEffect, 0x2, 0x1 + waitforvisualfinish + restorebg + waitbgfadein + end + +@ credits to ghoulslash +Move_SILK_TRAP:: + loadspritegfx ANIM_TAG_PROTECT + loadspritegfx ANIM_TAG_SPIDER_WEB + splitbgprio ANIM_ATTACKER + playsewithpan SE_M_STRING_SHOT2, SOUND_PAN_TARGET + createsprite gSpiderWebSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, FALSE + waitforvisualfinish + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_PROTECT, 0, 10, 10, RGB_LIME_GREEN + monbg ANIM_ATK_PARTNER + waitplaysewithpan SE_M_REFLECT, SOUND_PAN_ATTACKER, 0x10 + createsprite gProtectSpriteTemplate, ANIM_ATTACKER, 2, 24, 0, 90 + waitforvisualfinish + clearmonbg ANIM_ATK_PARTNER + end + +@ Also used by Snow weather. Currently identical with Move_HAIL +Move_SNOWSCAPE:: + loadspritegfx ANIM_TAG_HAIL + loadspritegfx ANIM_TAG_ICE_CRYSTALS + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 3, 0, 6, RGB_BLACK + waitforvisualfinish + createvisualtask AnimTask_Hail, 5 + loopsewithpan SE_M_HAIL, 0, 8, 10 + waitforvisualfinish + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 3, 6, 0, RGB_BLACK + end + +@Credits to Skeli +Move_WICKED_BLOW:: + loadspritegfx ANIM_TAG_FOCUS_ENERGY + loadspritegfx ANIM_TAG_HANDS_AND_FEET + loadspritegfx ANIM_TAG_IMPACT + loadspritegfx ANIM_TAG_PAIN_SPLIT + loadspritegfx ANIM_TAG_SPARKLE_4 + createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_PAIN_SPLIT, 0x0, 0x9, 0x9, 0x1F + createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_FOCUS_ENERGY, 0x0, 0x8, 0x8, 0x1F + playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER + call WickedBlowBuffEffect + delay 0x8 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB_BLACK + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 + call WickedBlowBuffEffect + delay 0x8 + call WickedBlowBuffEffect + waitforvisualfinish + fadetobg BG_DARK + waitbgfadeout + playsewithpan SE_M_JUMP_KICK, SOUND_PAN_ATTACKER + createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0x1c, 0x0, 0x0, 0x5 + delay 0x5 + createsprite gSpriteTemplate_WickedBlowFist, ANIM_TARGET, 4, ANIM_TARGET, 0, 0, 16, 32 + delay 6 + loopsewithpan SE_M_STRENGTH, SOUND_PAN_TARGET, 0x4, 0x6 + createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 0x0, 0x0, 0x1, 0x1 + createsprite gSpriteTemplate_WickedBlowBlackStars, ANIM_TARGET, 2, 0xfff0, 0xfff8, 0xfe80, 0xffe1 + createsprite gSpriteTemplate_WickedBlowRedStars, ANIM_TARGET, 2, 0xfff0, 0xfff8, 0xff00, 0xffd8 + createsprite gSpriteTemplate_WickedBlowBlackStars, ANIM_TARGET, 2, 0xfff0, 0xfff8, 0xff80, 0xffea + createsprite gSpriteTemplate_WickedBlowRedStars, ANIM_TARGET, 2, 0xfff0, 0xfff8, 0x80, 0xfff0 + createsprite gSpriteTemplate_WickedBlowBlackStars, ANIM_TARGET, 2, 0xfff0, 0xfff8, 0xa0, 0xffe0 + createsprite gSpriteTemplate_WickedBlowRedStars, ANIM_TARGET, 2, 0xfff0, 0xfff8, 0x1a0, 0xffda + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 4, 10, 1 + delay 20 + createvisualtask AnimTask_TwinkleTackleLaunch, 0x2, 50 + delay 50 + playsewithpan SE_M_DETECT, SOUND_PAN_TARGET + createsprite gTwinkleTackleTwinkleSpriteTemplate, ANIM_TARGET, 13, 0x0, 0x0, ANIM_TARGET @detect star + waitforvisualfinish + blendoff + createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0x0, 0x6 + restorebg + waitbgfadeout + visible ANIM_TARGET + waitforvisualfinish + waitbgfadein + end + +WickedBlowBuffEffect: + createsprite gPowerTripFocusEnergyTemplate, ANIM_ATTACKER, 2, 0x0, 0xffe8, 0x1a, 0x2 + delay 0x4 + createsprite gPowerTripFocusEnergyTemplate, ANIM_ATTACKER, 2, 0x0, 0xe, 0x1c, 0x1 + delay 0x4 + createsprite gPowerTripFocusEnergyTemplate, ANIM_ATTACKER, 2, 0x0, 0xfffb, 0xa, 0x2 + delay 0x4 + createsprite gEndureEnergySpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x1c, 0x1a, 0x3 + delay 0x4 + createsprite gEndureEnergySpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0xfff4, 0x0, 0x1 + return + + + +@Credits to Skeli +Move_SURGING_STRIKES:: + loadspritegfx ANIM_TAG_IMPACT_2 + loadspritegfx ANIM_TAG_WATER_IMPACT + jumpifmoveturn 1 SURGING_STRIKES_1 + jumpifmoveturn 2 SURGING_STRIKES_2 + +SURGING_STRIKES_0: + playsewithpan SE_M_GIGA_DRAIN, SOUND_PAN_TARGET + createsprite gSpriteTemplate_SurgingStrikesImpact, ANIM_TARGET, 2, -40, -20, 0, 0, 10, -20 @Top left + delay 5 + playsewithpan SE_M_GIGA_DRAIN, SOUND_PAN_TARGET + createsprite gSpriteTemplate_SurgingStrikesImpact, ANIM_TARGET, 2, 40, 20, 0, 0, 10, 20 @Bottom right + createsprite gWaterHitSplatSpriteTemplate, ANIM_TARGET, 1, -5, -5, ANIM_TARGET, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 8, 1 + delay 5 + createsprite gWaterHitSplatSpriteTemplate, ANIM_TARGET, 1, 5, 5, ANIM_TARGET, 0x1 + waitforvisualfinish + end + +SURGING_STRIKES_1: + playsewithpan SE_M_GIGA_DRAIN, SOUND_PAN_TARGET + createsprite gSpriteTemplate_SurgingStrikesImpact, ANIM_TARGET, 2, 40, -20, 0, 0, 10, -20 @Top Right + delay 5 + playsewithpan SE_M_GIGA_DRAIN, SOUND_PAN_TARGET + createsprite gSpriteTemplate_SurgingStrikesImpact, ANIM_TARGET, 2, -40, 20, 0, 0, 10, 20 @Bottom left + createsprite gWaterHitSplatSpriteTemplate, ANIM_TARGET, 1, 5, -5, ANIM_TARGET, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 8, 1 + delay 5 + createsprite gWaterHitSplatSpriteTemplate, ANIM_TARGET, 1, -5, 5, ANIM_TARGET, 0x1 + waitforvisualfinish + end + +SURGING_STRIKES_2: + playsewithpan SE_M_GIGA_DRAIN, SOUND_PAN_TARGET + createsprite gSpriteTemplate_SurgingStrikesImpact, ANIM_TARGET, 2, -40, -20, 0, 0, 10, -20 @Top left + delay 5 + playsewithpan SE_M_GIGA_DRAIN, SOUND_PAN_TARGET + createsprite gSpriteTemplate_SurgingStrikesImpact, ANIM_TARGET, 2, 40, -20, 0, 0, 10, -20 @Top Right + createsprite gWaterHitSplatSpriteTemplate, ANIM_TARGET, 1, -5, -5, ANIM_TARGET, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 0, 4, 8, 1 + delay 5 + createsprite gWaterHitSplatSpriteTemplate, ANIM_TARGET, 1, 5, -5, ANIM_TARGET, 0x1 + waitforvisualfinish + end + + +@Credits to Skeli +Move_THUNDER_CAGE:: + loadspritegfx ANIM_TAG_SHOCK_3 @Thunderbolt Ball + loadspritegfx ANIM_TAG_SPARK @Electric lines + loadspritegfx ANIM_TAG_SPARK_H @Thunder Wave + loadspritegfx ANIM_TAG_SPARK_2 + monbg ANIM_TARGET + splitbgprio ANIM_TARGET + loopsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_TARGET, 0xA, 0x9 + createsprite gThunderboltOrbSpriteTemplate, ANIM_TARGET, 3, 100, -25, -30, 0x0 + createsprite gThunderboltOrbSpriteTemplate, ANIM_TARGET, 3, 100, 0, -30, 0x0 + createsprite gThunderboltOrbSpriteTemplate, ANIM_TARGET, 3, 100, 25, -30, 0x0 + createsprite gThunderWaveSpriteTemplate, ANIM_TARGET, 2, -16, -16 + delay 4 + createsprite gThunderWaveSpriteTemplate, ANIM_TARGET, 2, -16, 0 + delay 4 + createsprite gThunderWaveSpriteTemplate, ANIM_TARGET, 2, -16, 16 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 3, 0, 50, 1 + call ThunderCageBolts + delay 0x4 + createsprite gThunderWaveSpriteTemplate, ANIM_TARGET, 2, -16, -16 + delay 4 + createsprite gThunderWaveSpriteTemplate, ANIM_TARGET, 2, -16, 0 + delay 4 + createsprite gThunderWaveSpriteTemplate, ANIM_TARGET, 2, -16, 16 + call ThunderCageBolts + waitforvisualfinish + clearmonbg ANIM_TARGET + end +ThunderCageBolts: + createvisualtask AnimTask_ElectricBolt, 2, 25, -40, 1 + delay 0x9 + createvisualtask AnimTask_ElectricBolt, 2, -25, -40, 1 + delay 0x9 + createvisualtask AnimTask_ElectricBolt, 2, 0, -40, 1 + delay 0x9 + return + + +@Credits to Skeli +Move_DRAGON_ENERGY:: + loadspritegfx ANIM_TAG_HYDRO_PUMP + createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_HYDRO_PUMP, 0x0, 0xC, 0xC, 0x2C5E @;Regidrago Reddish Reddish, Purple + monbg ANIM_TARGET + playsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 4, 0, 11, RGB(31, 28, 31) @;Pinkish White + waitforvisualfinish + playsewithpan SE_M_DETECT, SOUND_PAN_TARGET + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, (F_PAL_BG | F_PAL_BATTLERS), 0x1, 0x10, 0x0, 0x2C5E @;Regidrago Reddish Reddish, Purple + createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 0, -120, 0, 0, 1 @;Slide off off, screen + waitforvisualfinish + playsewithpan SE_M_SOLAR_BEAM, SOUND_PAN_TARGET + call DragonEnergyShot + call DragonEnergyShot + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 4, 0, 94, 1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_DEF_PARTNER, 4, 0, 94, 1 + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + call DragonEnergyShot + waitforvisualfinish + createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0x0, 10 + clearmonbg ANIM_TARGET + waitforvisualfinish + end + +DragonEnergyShot: + createsprite gSpriteTemplate_DragonEnergyShot, ANIM_TARGET, 2, 0x19 + delay 0x1 + createsprite gSpriteTemplate_DragonEnergyShot, ANIM_TARGET, 2, 0x19 + delay 0x1 + return + + +@Credits to Skeli +Move_FREEZING_GLARE:: + loadspritegfx ANIM_TAG_SMALL_RED_EYE + loadspritegfx ANIM_TAG_EYE_SPARKLE + loadspritegfx ANIM_TAG_ICE_CRYSTALS @ice + call SetPsychicBackground + createsprite gEyeSparkleSpriteTemplate, ANIM_ATTACKER, 0, 0xfff0, 0xfff8 + createsprite gEyeSparkleSpriteTemplate, ANIM_ATTACKER, 0, 0x10, 0xfff8 + createvisualtask AnimTask_GlareEyeDots, 0x5, 0x0 + playsewithpan SE_M_PSYBEAM2, SOUND_PAN_ATTACKER + waitforvisualfinish + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 12, RGB(12, 26, 31) @;Ice blue + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 4, 28, 1 + call IceCrystalEffectShort + waitforvisualfinish + call UnsetPsychicBg + end + + +@Credits to Skeli +Move_FIERY_WRATH:: + loadspritegfx ANIM_TAG_SMALL_EMBER + loadspritegfx ANIM_TAG_PURPLE_RING + playsewithpan SE_M_SACRED_FIRE2, 0xc0 + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x2, 0x0, 0xE, 0x0 + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x4, 0x0, 0x8, 0x1F + createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 0, 2, 32, 1 + call DragonClawFireSpiral + call DragonClawFireSpiral + waitforvisualfinish + loopsewithpan SE_M_PSYBEAM, SOUND_PAN_TARGET, 20, 3 + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_DEF_SIDE, 0x4, 0x0, 0xF, 0x3006 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 60, 1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_DEF_PARTNER, 4, 0, 60, 1 + call FieryWrathGeyser + call FieryWrathGeyser + call FieryWrathGeyser + call FieryWrathGeyser + waitforvisualfinish + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x2, 0x8, 0x0, 0x1F + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_DEF_SIDE, 0x2, 0x9, 0x0, 0x3006 + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0xE, 0x0, 0x0 + waitforvisualfinish + end + +FieryWrathGeyser: + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_TARGET, 0xfffc, 0x10 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_DEF_PARTNER, 0xfffc, 0x10 + delay 0x0 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_TARGET, 0x100D, 0x10 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_DEF_PARTNER, 0x100D, 0x10 + delay 0x0 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_TARGET, 0x4, 0x10 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_DEF_PARTNER, 0x4, 0x10 + delay 0x0 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_TARGET, 0xfff0, 0x10 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_DEF_PARTNER, 0xfff0, 0x10 + delay 0x0 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_TARGET, 0xfffc, 0x10 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_DEF_PARTNER, 0xfffc, 0x10 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_TARGET, 0x100D, 0x10 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_DEF_PARTNER, 0x100D, 0x10 + delay 0x0 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_TARGET, 0x4, 0x10 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_DEF_PARTNER, 0x4, 0x10 + delay 0x0 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_TARGET, 0xfff0, 0x10 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_DEF_PARTNER, 0xfff0, 0x10 + delay 0x0 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_TARGET, 0xfffc, 0x10 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_DEF_PARTNER, 0xfffc, 0x10 + delay 0x0 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_TARGET, 0x100D, 0x10 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_DEF_PARTNER, 0x100D, 0x10 + delay 0x0 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_TARGET, 0x4, 0x10 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_DEF_PARTNER, 0x4, 0x10 + delay 0x0 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_TARGET, 0xfff0, 0x10 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_DEF_PARTNER, 0xfff0, 0x10 + delay 0x0 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_TARGET, 0xfffc, 0x10 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_DEF_PARTNER, 0xfffc, 0x10 + delay 0x0 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_TARGET, 0x100D, 0x10 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_DEF_PARTNER, 0x100D, 0x10 + delay 0x0 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_TARGET, 0x4, 0x10 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_DEF_PARTNER, 0x4, 0x10 + delay 0x0 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_TARGET, 0xfff0, 0x10 + createsprite gSpriteTemplate_FieryWrathGeyser, ANIM_TARGET, 4, ANIM_DEF_PARTNER, 0xfff0, 0x10 + return + + + +@Credits to Skeli +Move_THUNDEROUS_KICK:: + loadspritegfx ANIM_TAG_IMPACT + loadspritegfx ANIM_TAG_HANDS_AND_FEET + loadspritegfx ANIM_TAG_SPARK_2 + monbg ANIM_TARGET + fadetobg BG_MAX_LIGHTNING + waitbgfadeout + createvisualtask AnimTask_StartSlidingBg, 0x5, 0xff00, 0x0, 0x1, 0xffff + setalpha 12, 8 + playsewithpan SE_M_MEGA_KICK, SOUND_PAN_TARGET + createsprite gMegaPunchKickSpriteTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x1, 0x32 + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, 0x4, 0x2, 0x0, 0x7, 0x7fff + createvisualtask AnimTask_ShakeMon, 2, ANIM_ATTACKER, 2, 0, 22, 1 + call ZingZapSparks1 + delay 0xA + call ZingZapSparks2 + delay 0xA + call ZingZapSparks1 + delay 0xA + call ZingZapSparks2 + delay 0x3 + createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0x30, 0x3, 0x0, 0x4 + delay 0x7 + playsewithpan SE_M_MEGA_KICK2, SOUND_PAN_TARGET + createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x1, 0x0 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 22, 1 + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x0, 0x10, 0x0, 0x7fff + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 0x1f, 0x3, 0x1, 0x0, 0x8, 0x0, 0x0 + waitforvisualfinish + createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0x0, 0x5 + clearmonbg ANIM_TARGET + blendoff + call UnsetPsychicBg + end + + +@Credits to Skeli +Move_GLACIAL_LANCE:: + loadspritegfx ANIM_TAG_ICICLE_SPEAR + loadspritegfx ANIM_TAG_ICE_CUBE + loadspritegfx ANIM_TAG_ICE_CRYSTALS @ice + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x0, 0xA, 0x3C00 @;Royal Blue + monbg ANIM_TARGET + playsewithpan SE_M_HAIL, SOUND_PAN_TARGET + createvisualtask AnimTask_CentredFrozenIceCube, ANIM_TARGET, 0 + createsprite gSpriteTemplate_GlacialLance, ANIM_TARGET, 2, 0, 40, 0, 0, 40, 50, 10 + delay 60 + createvisualtask AnimTask_FlashAnimTagWithColor, 0x2, ANIM_TAG_ICICLE_SPEAR, 0x4, 0x1, 0x7FFF, 0x10, 0x0, 0x0 + playsewithpan SE_M_DETECT, SOUND_PAN_TARGET + delay 38 + playsewithpan SE_M_BRICK_BREAK, SOUND_PAN_TARGET + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 6, 0, 52, 1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_DEF_PARTNER, 6, 0, 52, 1 + delay 4 + call IceCrystalEffectLong + waitforvisualfinish + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x0, 0xA, 0x0, 0x3C00 @;Royal Blue + waitforvisualfinish + clearmonbg ANIM_TARGET + end + + +Move_ASTRAL_BARRAGE:: + goto Move_SHADOW_BALL + + +@Credits to Skeli +Move_EERIE_SPELL:: + loadspritegfx ANIM_TAG_PURPLE_FLAME + call SetPsychicBackground + waitforvisualfinish + monbg ANIM_TARGET + splitbgprio_all + loopsewithpan SE_M_PSYBEAM, SOUND_PAN_TARGET, 0x14, 0x5 + createvisualtask AnimTask_SpiteTargetShadow 0x0 + call EerieSpellConvergingFlames + call EerieSpellConvergingFlames + call EerieSpellConvergingFlames + waitforvisualfinish + clearmonbg ANIM_TARGET + call UnsetPsychicBg + waitforvisualfinish + end + +EerieSpellConvergingFlames: + createsprite gSpriteTemplate_EerieSpellFlame, ANIM_TARGET, 2, 0x1, 0x0, 0x0, 0xffe0, 0x10 + delay 0x2 + createsprite gSpriteTemplate_EerieSpellFlame, ANIM_TARGET, 2, 0x1, 0x0, 0x16, 0xffea, 0x10 + delay 0x2 + createsprite gSpriteTemplate_EerieSpellFlame, ANIM_TARGET, 2, 0x1, 0x0, 0x1e, 0x0, 0x10 + delay 0x2 + createsprite gSpriteTemplate_EerieSpellFlame, ANIM_TARGET, 2, 0x1, 0x0, 0x14, 0x14, 0x10 + delay 0x2 + createsprite gSpriteTemplate_EerieSpellFlame, ANIM_TARGET, 2, 0x1, 0x0, 0x0, 0x1c, 0x10 + delay 0x2 + createsprite gSpriteTemplate_EerieSpellFlame, ANIM_TARGET, 2, 0x1, 0x0, 0xffed, 0x13, 0x10 + delay 0x2 + createsprite gSpriteTemplate_EerieSpellFlame, ANIM_TARGET, 2, 0x1, 0x0, 0xffe5, 0x0, 0x10 + delay 0x2 + createsprite gSpriteTemplate_EerieSpellFlame, ANIM_TARGET, 2, 0x1, 0x0, 0xffee, 0xffee, 0x10 + delay 0x2 + createsprite gSpriteTemplate_EerieSpellFlame, ANIM_TARGET, 2, 0x1, 0x0, 0x0, 0xffe7, 0x10 + delay 0x2 + createsprite gSpriteTemplate_EerieSpellFlame, ANIM_TARGET, 2, 0x1, 0x0, 0x11, 0xffef, 0x10 + delay 0x2 + createsprite gSpriteTemplate_EerieSpellFlame, ANIM_TARGET, 2, 0x1, 0x0, 0x17, 0x0, 0x10 + return + +@@@@@@@@@@@@@@@@@@@@@@@ GEN 9 @@@@@@@@@@@@@@@@@@@@@@@ +@ credits to Skeli +Move_DIRE_CLAW:: + loadspritegfx ANIM_TAG_SLASH + loadspritegfx ANIM_TAG_POISON_BUBBLE + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_SLASH, 0x0, 0xC, 0xC, 0x6038 @;Purple + createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 4, 4 + delay 6 + playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET + createsprite gSlashSliceSpriteTemplate, ANIM_TARGET, 2, ANIM_TARGET, 0xfff0, 0x0 + delay 0x2 + playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET + createsprite gSlashSliceSpriteTemplate, ANIM_TARGET, 2, ANIM_TARGET, 0x0, 0x0 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 36, 1 + delay 0x2 + playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET + createsprite gSlashSliceSpriteTemplate, ANIM_TARGET, 2, ANIM_TARGET, 0x0, 0x0 + call PoisonBubblesEffect + waitforvisualfinish + end + + +@ credits to Skeli +Move_PSYSHIELD_BASH:: + loadspritegfx ANIM_TAG_IMPACT + loadspritegfx ANIM_TAG_WATER_GUN @Blue colour + call SetPsychicBackground + monbg ANIM_DEF_PARTNER + setalpha 12, 8 + playsewithpan SE_M_SUPERSONIC, SOUND_PAN_ATTACKER + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x1, 0x0, 0xB, 0x7FAF @;Light blue + createvisualtask AnimTask_WindUpLunge, 5, ANIM_ATTACKER, -24, 8, 23, 10, 56, 10 + delay 0x23 + createsprite gSpriteTemplate_PsyshieldBashHit, ANIM_ATTACKER, 4, -10, 0x0, 0x1, 0x0 + playsewithpan SE_M_MEGA_KICK2, SOUND_PAN_TARGET + delay 0x1 + createsprite gSlideMonToOffsetSpriteTemplate ANIM_TARGET, 2, ANIM_TARGET, 0xfff0, 0x0, 0x0, 0x4 + waitforvisualfinish + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 4, 0, 12, 1 + waitforvisualfinish + delay 0x2 + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x1, 0xB, 0x0, 0x7FAF @;Light blue + createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x5 + delay 0x3 + createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 0x1, 0x0, 0x7 + waitforvisualfinish + call UnsetPsychicBg + clearmonbg ANIM_DEF_PARTNER + blendoff + end + +@ credits to skeli +Move_POWER_SHIFT:: + loadspritegfx ANIM_TAG_BLUEGREEN_ORB + loadspritegfx ANIM_TAG_RED_HEART @Red colour for orb + monbg ANIM_ATK_PARTNER + playsewithpan SE_M_REVERSAL, SOUND_PAN_ATTACKER + createsprite gSpriteTemplate_PowerShiftOffenseBall, ANIM_ATTACKER, 2, POWER_SHIFT_LEFT_X, 0, POWER_SHIFT_RIGHT_X, 0, POWER_SHIFT_DELAY, POWER_SHIFT_ARC + createsprite gSpriteTemplate_PowerShiftDefenseBall, ANIM_ATTACKER, 2, POWER_SHIFT_RIGHT_X, 0, POWER_SHIFT_LEFT_X, 0, POWER_SHIFT_DELAY, POWER_SHIFT_ARC + waitforvisualfinish + playsewithpan SE_M_DETECT, SOUND_PAN_ATTACKER + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 2, 0, 10, RGB_WHITE + waitforvisualfinish + clearmonbg ANIM_ATK_PARTNER + end + + +@ credits to skeli +Move_STONE_AXE:: + loadspritegfx ANIM_TAG_SLAM_HIT_2 @Cut + loadspritegfx ANIM_TAG_ROCKS + monbg ANIM_TARGET + splitbgprio ANIM_TARGET + playsewithpan SE_M_CUT, SOUND_PAN_TARGET + createsprite gSpriteTemplate_StoneAxeSlash, ANIM_TARGET, 2, 50, -10, 100, 8, 1 @;Move left + delay 0x5 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 4, 16, 1 + playsewithpan SE_M_ROCK_THROW, SOUND_PAN_TARGET + call StoneAxeRockFragments + delay 0x8 + call StoneAxeRockFragments + waitforvisualfinish + clearmonbg ANIM_TARGET + end + +StoneAxeRockFragments: + createsprite gRockFragmentSpriteTemplate, ANIM_TARGET, 4, 0x0, 0x0, 0x14, 0x18, 0xe, 0x2 + createsprite gRockFragmentSpriteTemplate, ANIM_TARGET, 4, 0x5, 0x0, 0xffec, 0x18, 0xe, 0x1 + createsprite gRockFragmentSpriteTemplate, ANIM_TARGET, 4, 0x0, 0x5, 0x14, 0xffe8, 0xe, 0x2 + createsprite gRockFragmentSpriteTemplate, ANIM_TARGET, 4, 0xfffb, 0x0, 0xffec, 0xffe8, 0xe, 0x2 + createsprite gRockFragmentSpriteTemplate, ANIM_TARGET, 4, 0x0, 0xfffb, 0x1e, 0x12, 0x8, 0x2 + createsprite gRockFragmentSpriteTemplate, ANIM_TARGET, 4, 0x0, 0x0, 0x1e, 0xffee, 0x8, 0x2 + createsprite gRockFragmentSpriteTemplate, ANIM_TARGET, 4, 0x0, 0x0, 0xffe2, 0x12, 0x8, 0x2 + createsprite gRockFragmentSpriteTemplate, ANIM_TARGET, 4, 0x0, 0x0, 0xffe2, 0xffee, 0x8, 0x2 + return + + +@Credits to Skeli +Move_SPRINGTIDE_STORM:: + loadspritegfx ANIM_TAG_GUST + loadspritegfx ANIM_TAG_RED_HEART + playsewithpan SE_M_GUST, SOUND_PAN_TARGET + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 4, 88, 1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 6, 0, 11, RGB(31, 22, 30) + call HurricaneGust + call SpringtideStormHeartSwirl + call HurricaneGust + call SpringtideStormHeartSwirl + call HurricaneGust + call SpringtideStormHeartSwirl + call HurricaneGust + call SpringtideStormHeartSwirl + call HurricaneGust + call SpringtideStormHeartSwirl + call HurricaneGust + call SpringtideStormHeartSwirl + waitforvisualfinish + stopsound + end + +SpringtideStormHeartSwirl: + createsprite gSpriteTemplate_SpringtideHeart, ANIM_TARGET, 2, 0x0, 0x20, 0x210, 0x1e, 0xa, 0x32, ANIM_TARGET + delay 0x2 + createsprite gSpriteTemplate_SpringtideHeart, ANIM_TARGET, 2, 0x0, 0x24, 0x1e0, 0x14, 0xd, 0xffd2, ANIM_TARGET + delay 0x2 + createsprite gSpriteTemplate_SpringtideHeart, ANIM_TARGET, 2, 0x0, 0x25, 0x240, 0x14, 0x5, 0x2a, ANIM_TARGET + delay 0x2 + createsprite gSpriteTemplate_SpringtideHeart, ANIM_TARGET, 2, 0x0, 0x23, 0x190, 0x19, 0x8, 0xffd6, ANIM_TARGET + delay 0x2 + createsprite gSpriteTemplate_SpringtideHeart, ANIM_TARGET, 2, 0x0, 0x20, 0x200, 0x19, 0xd, 0x2e, ANIM_TARGET + delay 0x2 + createsprite gSpriteTemplate_SpringtideHeart, ANIM_TARGET, 2, 0x0, 0x25, 0x1d0, 0x1e, 0xc, 0xffce, ANIM_TARGET + return + + +@Credits to Skeli +Move_MYSTICAL_POWER:: + loadspritegfx ANIM_TAG_THIN_RING + loadspritegfx ANIM_TAG_POISON_BUBBLE @Purple Colour + loadspritegfx ANIM_TAG_HYDRO_PUMP @Blue colour + setalpha 12, 8 + call SetPsychicBackground + monbg ANIM_TARGET + splitbgprio ANIM_TARGET + call PsystrikeInwardRing + delay 0xA + call PsystrikeInwardRing + delay 0xA + call PsystrikeInwardRing + delay 0xA + waitforvisualfinish + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x6, 0x0, 0xB, 0x7FAF @;Light blue + createvisualtask AnimTask_ExtrasensoryDistortion, 0x5, 0x0 + call MysticalPowerFoeRings + createvisualtask AnimTask_ExtrasensoryDistortion, 0x5, 0x1 + call MysticalPowerFoeRings + createvisualtask AnimTask_ExtrasensoryDistortion, 0x5, 0x2 + call MysticalPowerFoeTwoRingsOnly + waitforvisualfinish + clearmonbg ANIM_TARGET + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x1, 0xB, 0x0, 0x7FAF @;Light blue + call UnsetPsychicBg + blendoff + end + +@ TODO port cfru psystrike anim +PsystrikeInwardRing: + createsprite gSpriteTemplate_VioletMind, ANIM_ATTACKER, 0x28, 0x0, 0x0, 0x0, 0x0 + playsewithpan SE_M_SUPERSONIC, SOUND_PAN_ATTACKER + return + +MysticalPowerFoeRings: + playsewithpan SE_M_BIND, SOUND_PAN_TARGET + createsprite gSpriteTemplate_MysticalPowerRing, ANIM_TARGET, 2, -20, -10, ANIM_TARGET, 0x0 + delay MYSTICAL_POWER_RING_PAUSE + createsprite gSpriteTemplate_MysticalPowerRing, ANIM_TARGET, 2, 0, 10, ANIM_TARGET, 0x0 + delay MYSTICAL_POWER_RING_PAUSE + createsprite gSpriteTemplate_MysticalPowerRing, ANIM_TARGET, 2, 10, -20, ANIM_TARGET, 0x0 + delay MYSTICAL_POWER_RING_PAUSE + return + +MysticalPowerFoeTwoRingsOnly: + playsewithpan SE_M_BIND, SOUND_PAN_TARGET + createsprite gSpriteTemplate_MysticalPowerRing, ANIM_TARGET, 2, -20, -10, ANIM_TARGET, 0x0 + delay MYSTICAL_POWER_RING_PAUSE + createsprite gSpriteTemplate_MysticalPowerRing, ANIM_TARGET, 2, 0, 10, ANIM_TARGET, 0x0 + delay MYSTICAL_POWER_RING_PAUSE + return + + +@Credits to Skeli +Move_RAGING_FURY:: + loadspritegfx ANIM_TAG_SMALL_EMBER + loopsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER, 0x8, 0x3 + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_ATTACKER | F_PAL_TARGET), 2, 5, 3, 8, RGB_RED + createvisualtask AnimTask_WindUpLunge, 5, ANIM_ATTACKER, -20, 8, 32, 8, 56, 6 + call OutrageFlames + call OutrageFlames + delay 10 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 24, 1 + playsewithpan SE_M_FIRE_PUNCH, SOUND_PAN_TARGET + call FlameBurstSpread + waitforvisualfinish + createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0x0, 0x5 + waitforvisualfinish + end + +@Credits to Skeli +Move_WAVE_CRASH:: + loadspritegfx ANIM_TAG_WATER_IMPACT + loadspritegfx ANIM_TAG_SMALL_BUBBLES + loadspritegfx ANIM_TAG_ICE_CRYSTALS @Bubbles on attacker + monbg ANIM_DEF_PARTNER + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x2, 0x0, 0xB, 0x726A + createvisualtask AnimTask_WindUpLunge, 5, ANIM_ATTACKER, -20, 8, 48, 8, 56, 6 + call WaterfallBubblesOnAttacker + waitforvisualfinish + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 5, 5, 1 + call RisingWaterHitEffect + waitforvisualfinish + delay 0x5 + createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0x0, 0x5 + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x1, 0xB, 0x0, 0x726A + clearmonbg ANIM_DEF_PARTNER + waitforvisualfinish + end + + +@Credits to Skeli +Move_CHLOROBLAST:: + loadspritegfx ANIM_TAG_THIN_RING + loadspritegfx ANIM_TAG_HYDRO_PUMP + createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_THIN_RING, 0x0, 0xA, 0xA, 0x03AC + createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_HYDRO_PUMP, 0x0, 0xC, 0xC, 0x03AC + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x2, 0x0, 0x10, 0x0 + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x2, 0x0, 0x10, 0x03AC + createvisualtask AnimTask_BlendNonAttackerPalettes, 0x2, 0x2, 0x0, 0x10, 0x0 + playsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER + createsprite gThinRingShrinkingSpriteTemplate ANIM_ATTACKER, 0x28, 0, 0, 0, 0 + delay 0xe + createsprite gThinRingShrinkingSpriteTemplate ANIM_ATTACKER, 0x28, 0, 0, 0, 0 + delay 0xe + createsprite gThinRingShrinkingSpriteTemplate ANIM_ATTACKER, 0x28, 0, 0, 0, 0 + waitforvisualfinish + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA, + fadetobg BG_CHLOROBLAST + waitbgfadeout + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x0, 0x10, 0x0, 0x0 + delay 0x10 + createvisualtask AnimTask_ShakeMon, 2, ANIM_ATTACKER, 0, 4, 74, 1 + createsoundtask SoundTask_LoopSEAdjustPanning, 0xf0, 0xFF00 | SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 0x1, 0x17, 0x0, 0x5 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 1, 67 + call ChloroblastShot + call ChloroblastShot + call ChloroblastShot + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 4, 0, 74, 1 + call ChloroblastShot + call ChloroblastShot + call ChloroblastShot + call ChloroblastShot + call ChloroblastShot + call ChloroblastShot + call ChloroblastShot + call ChloroblastShot + call ChloroblastShot + call ChloroblastShot + call ChloroblastShot + call ChloroblastShot + call ChloroblastShot + call ChloroblastShot + call ChloroblastShot + waitforvisualfinish + delay 0x5 + createvisualtask AnimTask_BlendNonAttackerPalettes, 0x2, 0x2, 0x0, 0x0, 0x0 @;From Black + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x0, 0x10, 0x0, 0x03AC + restorebg + waitbgfadeout + createvisualtask AnimTask_AllBattlersVisible, 0xA, + clearmonbg ANIM_DEF_PARTNER + waitbgfadein + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, (F_PAL_BG | F_PAL_BATTLERS), 0x2, 0x0, 0x0, 0x0 @;From Black + end +ChloroblastShot: + createsprite gSpriteTemplate_ChloroblastShot, ANIM_TARGET, 2, 0, 0, 0x19 + delay 0x2 + createsprite gSpriteTemplate_ChloroblastShot, ANIM_TARGET, 2, 0, 0, 0x19 + delay 0x2 + return + +@Credits to Skeli +Move_MOUNTAIN_GALE:: + loadspritegfx ANIM_TAG_ROCKS @Rocks + loadspritegfx ANIM_TAG_DRAGON_ASCENT_FOE @White Rock Colour + monbg ANIM_TARGET + call MountainGaleIceRock + delay 0x6 + call MountainGaleIceRock + delay 0x6 + call MountainGaleIceRock + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 4, 24, 1 + playsewithpan SE_M_STRENGTH, SOUND_PAN_TARGET + delay 0x6 + call MountainGaleIceRock + playsewithpan SE_M_STRENGTH, SOUND_PAN_TARGET + delay 0x6 + call MountainGaleIceRock + playsewithpan SE_M_STRENGTH, SOUND_PAN_TARGET + delay 0x6 + playsewithpan SE_M_STRENGTH, SOUND_PAN_TARGET + delay 0x6 + playsewithpan SE_M_STRENGTH, SOUND_PAN_TARGET + waitforvisualfinish + clearmonbg ANIM_TARGET + end + +MountainGaleIceRock: + playsewithpan SE_M_EXPLOSION, SOUND_PAN_ATTACKER + createsprite gSpriteTemplate_MountainGaleRock, ANIM_ATTACKER, 2, 0x14, 0xfff8, 0xfff8, 0xfff8, 0x14, 0xffe0 + return + + + +@Credits to Skeli +Move_VICTORY_DANCE:: + loadspritegfx ANIM_TAG_HOLLOW_ORB + createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 40, 6, 3, 3 + playsewithpan SE_M_TELEPORT, SOUND_PAN_ATTACKER + delay 0x8 + createvisualtask AnimTask_BlendPalInAndOutByTag, 0x5, ANIM_TAG_HOLLOW_ORB, 0x0B1D, 0xe, 0x0, 0x3 @;Light orange + createsprite gDragonDanceOrbSpriteTemplate, ANIM_ATTACKER, 2, 0x0 + createsprite gDragonDanceOrbSpriteTemplate, ANIM_ATTACKER, 2, 0x2b + createsprite gDragonDanceOrbSpriteTemplate, ANIM_ATTACKER, 2, 0x55 + createsprite gDragonDanceOrbSpriteTemplate, ANIM_ATTACKER, 2, 0x80 + createsprite gDragonDanceOrbSpriteTemplate, ANIM_ATTACKER, 2, 0xaa + createsprite gDragonDanceOrbSpriteTemplate, ANIM_ATTACKER, 2, 0xd5 + delay 0x1e + playsewithpan SE_M_TELEPORT, SOUND_PAN_ATTACKER + delay 0x1e + playsewithpan SE_M_TELEPORT, SOUND_PAN_ATTACKER + waitforvisualfinish + end + +@Credits to Skeli +Move_HEADLONG_RUSH:: + loadspritegfx ANIM_TAG_MUD_SAND @Dig + loadspritegfx ANIM_TAG_IMPACT + loadspritegfx ANIM_TAG_EXPLOSION_2 + loadspritegfx ANIM_TAG_ROCKS + fadetobg BG_ROCK_WRECKER + waitbgfadeout + createvisualtask AnimTask_StartSlidingBg, 0x5, 0xF000, 0x0, 0x0, 0xffff + waitbgfadein + createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 0, 2, 38, 1 + call PulverizingPancakeDiggingRun + call PulverizingPancakeDiggingRun + call PulverizingPancakeDiggingRun + call PulverizingPancakeDiggingRun + call PulverizingPancakeDiggingRun + call PulverizingPancakeDiggingRun + call PulverizingPancakeDiggingRun + call PulverizingPancakeDiggingRun + call PulverizingPancakeDiggingRun + waitforvisualfinish + createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0x2a, 0x0, 0x0, 0x5 + createsprite gSpriteTemplate_HeadlongRushImpact, ANIM_TARGET, 4, 0xfff6, 0x0, 0x1, 0x0 + delay 0x5 + createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 4, 0, 44, 1 + call MaxQuake_DirtGeyser + call MaxQuake_DirtGeyser + waitforvisualfinish + createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0x0, 0x5 + call UnsetPsychicBg + waitforvisualfinish + end +@ from max quake +MaxQuake_DirtGeyser: + createsprite gTectonicRageExplosionSpriteTemplate, ANIM_TARGET, 2, 0x0003, 0x0005, 0x1, 0x0 + createsprite gSpriteTemplate_MaxQuakeRockGeyser, ANIM_TARGET, 4, ANIM_TARGET, 0xfffc, 0x10 + playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET + delay 0x0 + createsprite gTectonicRageExplosionSpriteTemplate, ANIM_TARGET, 2, 0xfff5, 0xfff1, 0x1, 0x0 + createsprite gSpriteTemplate_MaxQuakeDirtGeyser, ANIM_TARGET, 4, 0, 0x100D, 0x10 + playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET + delay 0x0 + createsprite gTectonicRageExplosionSpriteTemplate, ANIM_TARGET, 2, 0x0008, 0xfffb, 0x1, 0x0 + createsprite gSpriteTemplate_MaxQuakeDirtGeyser, ANIM_TARGET, 4, 0, 0x4, 0x10 + playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET + delay 0x0 + createsprite gTectonicRageExplosionSpriteTemplate, ANIM_TARGET, 2, 0xfffa, 0x0012, 0x1, 0x0 + createsprite gSpriteTemplate_MaxQuakeRockGeyser, ANIM_TARGET, 4, ANIM_TARGET, 0xfff0, 0x10 + playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET + delay 0x0 + createsprite gTectonicRageExplosionSpriteTemplate, ANIM_TARGET, 2, 0x0000, 0x0005, 0x1, 0x0 + createsprite gSpriteTemplate_MaxQuakeDirtGeyser, ANIM_TARGET, 4, 0, 0xfffc, 0x10 + playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET + createsprite gTectonicRageExplosionSpriteTemplate, ANIM_TARGET, 2, 0x0003, 0xfff5, ANIM_TARGET, 0x0 + createsprite gSpriteTemplate_MaxQuakeDirtGeyser, ANIM_TARGET, 4, 0, 0x100D, 0x10 + delay 0x0 + createsprite gTectonicRageExplosionSpriteTemplate, ANIM_TARGET, 2, 0xfff5, 0xffe1, ANIM_TARGET, 0x0 + createsprite gSpriteTemplate_MaxQuakeRockGeyser, ANIM_TARGET, 4, ANIM_TARGET, 0x4, 0x10 + delay 0x0 + createsprite gTectonicRageExplosionSpriteTemplate, ANIM_TARGET, 2, 0x0008, 0xffeb, ANIM_TARGET, 0x0 + createsprite gSpriteTemplate_MaxQuakeDirtGeyser, ANIM_TARGET, 4, 0, 0xfff0, 0x10 + delay 0x0 + createsprite gTectonicRageExplosionSpriteTemplate, ANIM_TARGET, 2, 0xfffa, 0x0002, ANIM_TARGET, 0x0 + createsprite gSpriteTemplate_MaxQuakeDirtGeyser, ANIM_TARGET, 4, 0, 0xfffc, 0x10 + delay 0x0 + createsprite gTectonicRageExplosionSpriteTemplate, ANIM_TARGET, 2, 0x0000, 0xfff5, ANIM_TARGET, 0x0 + createsprite gSpriteTemplate_MaxQuakeRockGeyser, ANIM_TARGET, 4, ANIM_TARGET, 0x100D, 0x10 + delay 0x0 + createsprite gTectonicRageExplosionSpriteTemplate, ANIM_TARGET, 2, 0x0003, 0xffe5, ANIM_TARGET, 0x0 + createsprite gSpriteTemplate_MaxQuakeDirtGeyser, ANIM_TARGET, 4, 0, 0x4, 0x10 + delay 0x0 + createsprite gTectonicRageExplosionSpriteTemplate, ANIM_TARGET, 2, 0xfff5, 0xffd1, ANIM_TARGET, 0x0 + createsprite gSpriteTemplate_MaxQuakeDirtGeyser, ANIM_TARGET, 4, 0, 0xfff0, 0x10 + delay 0x0 + createsprite gTectonicRageExplosionSpriteTemplate, ANIM_TARGET, 2, 0x0008, 0xffdb, ANIM_TARGET, 0x0 + createsprite gSpriteTemplate_MaxQuakeRockGeyser, ANIM_TARGET, 4, ANIM_TARGET, 0xfffc, 0x10 + delay 0x0 + createsprite gTectonicRageExplosionSpriteTemplate, ANIM_TARGET, 2, 0xfffa, 0xfff2, ANIM_TARGET, 0x0 + createsprite gSpriteTemplate_MaxQuakeDirtGeyser, ANIM_TARGET, 4, 0, 0x100D, 0x10 + delay 0x0 + createsprite gTectonicRageExplosionSpriteTemplate, ANIM_TARGET, 2, 0x0000, 0xffe5, ANIM_TARGET, 0x0 + createsprite gSpriteTemplate_MaxQuakeDirtGeyser, ANIM_TARGET, 4, 0, 0x4, 0x10 + delay 0x0 + createsprite gSpriteTemplate_MaxQuakeRockGeyser, ANIM_TARGET, 4, ANIM_TARGET, 0xfff0, 0x10 + return + + +@Credits to Skeli +Move_BARB_BARRAGE:: + loadspritegfx ANIM_TAG_SPIKES + loadspritegfx ANIM_TAG_SHADOW_BALL @Spikes colour + loadspritegfx ANIM_TAG_POISON_BUBBLE + monbg ANIM_TARGET + call BarbBarrageSpikeShoot + loopsewithpan SE_M_DIG, SOUND_PAN_ATTACKER, 0x7, 0x3 + createvisualtask AnimTask_FlailMovement, 2, ANIM_ATTACKER + delay 0x14 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 7, 0, 32, 1 + call PoisonBubblesEffect + clearmonbg ANIM_TARGET + end +BarbBarrageSpikeShoot: + delay 0x3 + createsprite gSpriteTemplate_BarbBarrage, ANIM_TARGET, 2, 0x0, 0x0, 0x1e, 0xfb00, 0x0, 0x3 + delay 0x0 + createsprite gSpriteTemplate_BarbBarrage, ANIM_TARGET, 2, 0x0, 0x0, 0x1e, 0x0, 0x0500, 0x3 + delay 0x0 + createsprite gSpriteTemplate_BarbBarrage, ANIM_TARGET, 2, 0x0, 0x0, 0x1e, 0x0, 0xfb00, 0x3 + delay 0x0 + createsprite gSpriteTemplate_BarbBarrage, ANIM_TARGET, 2, 0x0, 0x0, 0x1e, 0x0500, 0x0300, 0x3 + delay 0x0 + createsprite gSpriteTemplate_BarbBarrage, ANIM_TARGET, 2, 0x0, 0x0, 0x1e, 0xfb00, 0x0300, 0x3 + delay 0x0 + createsprite gSpriteTemplate_BarbBarrage, ANIM_TARGET, 2, 0x0, 0x0, 0x1e, 0x0500, 0xfd00, 0x3 + delay 0x0 + createsprite gSpriteTemplate_BarbBarrage, ANIM_TARGET, 2, 0x0, 0x0, 0x1e, 0xfb00, 0xfd00, 0x3 + return + + + +@Credits to Skeli +Move_ESPER_WING:: + loadspritegfx ANIM_TAG_PUNISHMENT_BLADES @Punishment Blade + loadspritegfx ANIM_TAG_WHITE_FEATHER + createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_WHITE_FEATHER, 0x0, 0xA, 0xA, 0x7DDE + monbg ANIM_TARGET + call SetPsychicBackground + playsewithpan SE_M_SUPERSONIC, SOUND_PAN_ATTACKER + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 2, 0, 8, RGB(31, 23, 0) + waitforvisualfinish + playsewithpan SE_M_WING_ATTACK, SOUND_PAN_ATTACKER + call EsperWingBlade + playsewithpan SE_M_WING_ATTACK, SOUND_PAN_ATTACKER + delay ESPER_WING_SPEED / 2 + playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 12, 1 + call WingAttackFeatherScatter + waitforvisualfinish + call UnsetPsychicBg + clearmonbg ANIM_DEF_PARTNER + end + +EsperWingBlade: + createsprite gPsychoCutSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x0, ESPER_WING_SPEED + delay ESPER_WING_SPEED / 2 + createsprite gPsychoCutSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x0, ESPER_WING_SPEED + return + +@ TODO update wing attack anim with this +WingAttackFeatherScatter: + createsprite gSpriteTemplate_WingAttackFeather, ANIM_TARGET, 1, 0xfff8, 0xfff8, 0xa0, 0xffe0 + createsprite gSpriteTemplate_WingAttackFeather, ANIM_TARGET, 1, 0xfff8, 0xfff8, 0xff00, 0xffd8 + createsprite gSpriteTemplate_WingAttackFeather, ANIM_TARGET, 1, 0xfff8, 0xfff8, 0x1a0, 0xffda + createsprite gSpriteTemplate_WingAttackFeather, ANIM_TARGET, 1, 0xfff8, 0xfff8, 0xfe80, 0xffe1 + return + + +@Credits to Skeli +Move_BITTER_MALICE:: + loadspritegfx ANIM_TAG_PURPLE_RING + loadspritegfx ANIM_TAG_EYE_SPARKLE + loadspritegfx ANIM_TAG_ICE_CRYSTALS + playsewithpan SE_M_SACRED_FIRE2, SOUND_PAN_TARGET + createvisualtask AnimTask_ScaryFace, 0x5 @ internally checks side + createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 2, 0, 76, 1 + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x4, 0x0, 0xF, 0x3006 @;Dark Purple + createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_PURPLE_RING, 0x4, 0x0, 0xE, 0x3006 @;Dark Purple + call BitterMaliceSwirl + call BitterMaliceSwirl + call BitterMaliceSwirl + delay 0x4 @;Wait until the blends are reset after the scary face fades out + call IceCrystalEffectShort + waitforvisualfinish + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x1, 0xF, 0x0, 0x3006 @;Dark Purple + end + +BitterMaliceSwirl: + createsprite gSpriteTemplate_BitterMaliceRing, ANIM_TARGET, 2, 0x0, 0x1c, 0x210, 0x1e, 0xd, 0x32, 0x1 + delay 0x2 + createsprite gSpriteTemplate_BitterMaliceRing, ANIM_TARGET, 2, 0x0, 0x20, 0x1e0, 0x14, 0x10, 0xffd2, 0x1 + delay 0x2 + createsprite gSpriteTemplate_BitterMaliceRing, ANIM_TARGET, 2, 0x0, 0x21, 0x240, 0x14, 0x8, 0x2a, 0x1 + delay 0x2 + createsprite gSpriteTemplate_BitterMaliceRing, ANIM_TARGET, 2, 0x0, 0x1f, 0x190, 0x19, 0xb, 0xffd6, 0x1 + delay 0x2 + createsprite gSpriteTemplate_BitterMaliceRing, ANIM_TARGET, 2, 0x0, 0x1c, 0x200, 0x19, 0x10, 0x2e, 0x1 + delay 0x2 + createsprite gSpriteTemplate_BitterMaliceRing, ANIM_TARGET, 2, 0x0, 0x21, 0x1d0, 0x1e, 0xf, 0xffce, 0x1 + delay 0x2 + return + +@ credits to Skeli +Move_SHELTER:: + loadspritegfx ANIM_TAG_SHELL_LEFT + loadspritegfx ANIM_TAG_SHELL_RIGHT + playsewithpan SE_M_HEADBUTT, SOUND_PAN_ATTACKER + createvisualtask AnimTask_ShellSmashShrinkAttacker, 0x2 + createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_SHELL_LEFT, 0x1, 0x0, 0xE, 0x6B5A @ light light, gray + createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_SHELL_RIGHT, 0x1, 0x0, 0xE, 0x6B5A @ light light, gray + createsprite gShellSmashRightShellSpriteTemplate, ANIM_ATTACKER, 2, 0xffd7, 0x0, 0x2, 0x333, 0x0, 10, 30 + createsprite gShellSmashLeftShellSpriteTemplate, ANIM_ATTACKER, 2, 0x20, 0x0, 0x6, 0xfccd, 0x0, 10, 30 + createvisualtask AnimTask_FadeOutParticles, 0x2, 0 + waitforvisualfinish + blendoff + end + + +@Credits to Skeli +Move_TRIPLE_ARROWS:: + loadspritegfx ANIM_TAG_SPIRIT_ARROW @Arrow + loadspritegfx ANIM_TAG_HANDS_AND_FEET + monbg ANIM_DEF_PARTNER + splitbgprio ANIM_TARGET + playsewithpan SE_M_JUMP_KICK, SOUND_PAN_TARGET + createsprite gSpriteTemplate_TripleArrowKick, ANIM_TARGET, 2, -30, -20, 0x10, -20 + waitforvisualfinish + playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 6, 6, 1 + delay 0x4 + playsewithpan SE_M_RAZOR_WIND2, SOUND_PAN_ATTACKER + createsprite gSpiritShackleArrowTemplate, ANIM_TARGET, 2, -40, 0, 0, 0, TRIPLE_ARROW_FLY_TIME + delay 0x3 + playsewithpan SE_M_RAZOR_WIND2, SOUND_PAN_ATTACKER + createsprite gSpiritShackleArrowTemplate, ANIM_TARGET, 2, 40, 0, 0, 0, TRIPLE_ARROW_FLY_TIME + delay 0x3 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 3, 0, 10, 1 + playsewithpan SE_M_RAZOR_WIND2, SOUND_PAN_ATTACKER + createvisualtask AnimTask_IsAttackerPlayerSide, 0x2, + jumpargeq 0x7, FALSE, TripleArrowsOnOpponent + createsprite gSpiritShackleArrowTemplate, ANIM_TARGET, 2, 0, -60, 0, 0, TRIPLE_ARROW_FLY_TIME +TripleArrowsEnd: + delay 0x3 + waitforvisualfinish + clearmonbg ANIM_DEF_PARTNER + end +TripleArrowsOnOpponent: + createsprite gSpiritShackleArrowTemplate, ANIM_TARGET, 2, 0, 50, 0, 0, TRIPLE_ARROW_FLY_TIME @Below becomes becomes, above + goto TripleArrowsEnd + + + +@Credits to Skeli +Move_INFERNAL_PARADE:: + loadspritegfx ANIM_TAG_PURPLE_FLAME + loadspritegfx ANIM_TAG_WISP_FIRE + monbg ANIM_TARGET + splitbgprio_foes ANIM_TARGET + fadetobg BG_GHOST + playsewithpan SE_M_PSYBEAM, 0xc0 + waitbgfadein + createsprite gSpriteTemplate_InfernalParadeFlame, ANIM_TARGET, 2, -30, 10, 20 @;Bottom left + delay 0x3 + createsprite gSpriteTemplate_InfernalParadeFlame, ANIM_TARGET, 2, 30, -30, -20 @;Top right + delay 0x3 + createsprite gSpriteTemplate_InfernalParadeFlame, ANIM_TARGET, 2, 30, 10, 20 @;Bottom right + delay 0x3 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 50, 1 + call InfernalFlames + call InfernalFlames + call InfernalFlames + call InfernalFlames + playsewithpan SE_M_FLAME_WHEEL2, SOUND_PAN_TARGET + createsprite gWillOWispFireSpriteTemplate, ANIM_TARGET, 2, 0x0 + createsprite gWillOWispFireSpriteTemplate, ANIM_TARGET, 2, 0x2a + createsprite gWillOWispFireSpriteTemplate, ANIM_TARGET, 2, 0x54 + createsprite gWillOWispFireSpriteTemplate, ANIM_TARGET, 2, 0x7e + createsprite gWillOWispFireSpriteTemplate, ANIM_TARGET, 2, 0xa8 + createsprite gWillOWispFireSpriteTemplate, ANIM_TARGET, 2, 0xd2 + waitforvisualfinish + delay 0xC + restorebg + waitbgfadein + clearmonbg ANIM_TARGET + end +InfernalFlames: + createsprite gSpriteTemplate_InfernalParadeFlame, ANIM_TARGET, 2, -30, -30, -20 @;Top left + delay 0x3 + createsprite gSpriteTemplate_InfernalParadeFlame, ANIM_TARGET, 2, -30, 10, 20 @;Bottom left + delay 0x3 + createsprite gSpriteTemplate_InfernalParadeFlame, ANIM_TARGET, 2, 30, -30, -20 @;Top right + delay 0x3 + createsprite gSpriteTemplate_InfernalParadeFlame, ANIM_TARGET, 2, 30, 10, 20 @;Bottom right + delay 0x3 + return + + + +@Credits to Skeli +Move_CEASELESS_EDGE:: + loadspritegfx ANIM_TAG_SLASH + playsewithpan SE_M_JUMP_KICK, SOUND_PAN_ATTACKER + createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0x2C, 0x0, 0x0, 0x5 + waitforvisualfinish + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x0, 0x10, 0x10, 0x1F @;Fully to to, Red + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, (F_PAL_ATTACKER | F_PAL_TARGET), 0x0, 0x10, 0x10, 0x0 @;Fully to to, Black + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xa, + delay 0x10 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 3, 0, 48, 1 + call CeaselessEdgeSlashes + call CeaselessEdgeSlashes + call CeaselessEdgeSlashes + waitforvisualfinish + delay 0x8 + createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 0x0, 0x5 + waitforvisualfinish + createvisualtask AnimTask_AllBattlersVisible, 0xA, + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, (F_PAL_BG | F_PAL_BATTLERS), 0x1, 0x10, 0x0, 0x7FFF @;From White + waitforvisualfinish + end + +CeaselessEdgeSlashes: + playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET + createsprite gSpriteTemplate_CeaselessEdgeSlash, ANIM_TARGET, 2, 8, 0, FALSE, FALSE + delay 0x4 + playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET + createsprite gSpriteTemplate_CeaselessEdgeSlash, ANIM_TARGET, 2, -8, -8, TRUE, FALSE + delay 0x4 + playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET + createsprite gSpriteTemplate_CeaselessEdgeSlash, ANIM_TARGET, 2, -8, 0, TRUE, TRUE + delay 0x4 + playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET + createsprite gSpriteTemplate_CeaselessEdgeSlash, ANIM_TARGET, 2, 8, -4, FALSE, TRUE + return + + +@Credits to Skeli +Move_BLEAKWIND_STORM:: + loadspritegfx ANIM_TAG_GUST + loadspritegfx ANIM_TAG_ICE_CRYSTALS + playsewithpan SE_M_GUST, SOUND_PAN_TARGET + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 4, 88, 1 + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x4, 0x0, 0xB, 0x7FFF + call HurricaneGust + call BleakwindStormIceSwirl + call HurricaneGust + call BleakwindStormIceSwirl + call HurricaneGust + call BleakwindStormIceSwirl + call HurricaneGust + call BleakwindStormIceSwirl + call HurricaneGust + call BleakwindStormIceSwirl + call HurricaneGust + call BleakwindStormIceSwirl + waitforvisualfinish + stopsound + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x1, 0xB, 0x0, 0x7FFF + waitforvisualfinish + end +BleakwindStormIceSwirl: + createsprite gSpriteTemplate_BleakwindIce, ANIM_TARGET, 2, 0x0, 0x20, 0x210, 0x1e, 0xa, 0x32, ANIM_TARGET + delay 0x2 + createsprite gSpriteTemplate_BleakwindIce, ANIM_TARGET, 2, 0x0, 0x24, 0x1e0, 0x14, 0xd, 0xffd2, ANIM_TARGET + delay 0x2 + createsprite gSpriteTemplate_BleakwindIce, ANIM_TARGET, 2, 0x0, 0x25, 0x240, 0x14, 0x5, 0x2a, ANIM_TARGET + delay 0x2 + createsprite gSpriteTemplate_BleakwindIce, ANIM_TARGET, 2, 0x0, 0x23, 0x190, 0x19, 0x8, 0xffd6, ANIM_TARGET + delay 0x2 + createsprite gSpriteTemplate_BleakwindIce, ANIM_TARGET, 2, 0x0, 0x20, 0x200, 0x19, 0xd, 0x2e, ANIM_TARGET + delay 0x2 + createsprite gSpriteTemplate_BleakwindIce, ANIM_TARGET, 2, 0x0, 0x25, 0x1d0, 0x1e, 0xc, 0xffce, ANIM_TARGET + return + + +@Credits to Skeli +Move_WILDBOLT_STORM:: + loadspritegfx ANIM_TAG_GUST + loadspritegfx ANIM_TAG_SPARK_2 + fadetobg BG_MAX_LIGHTNING + waitbgfadeout + createvisualtask AnimTask_StartSlidingBg, 0x5, 0xff00, 0x0, 0x1, 0xffff + waitbgfadein + playsewithpan SE_M_GUST, SOUND_PAN_TARGET + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 4, 88, 1 + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x4, 0x0, 0xB, 0x07FE + call HurricaneGust + call WildboltStormSparkSwirl + call HurricaneGust + call WildboltStormSparkSwirl + call HurricaneGust + call WildboltStormSparkSwirl + call HurricaneGust + call WildboltStormSparkSwirl + call HurricaneGust + call WildboltStormSparkSwirl + call HurricaneGust + call WildboltStormSparkSwirl + waitforvisualfinish + stopsound + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x1, 0xB, 0x0, 0x07FE + call UnsetPsychicBg + waitforvisualfinish + end + +WildboltStormSparkSwirl: + createsprite gSpriteTemplate_WildboltStormSpark, ANIM_TARGET, 2, 0x0, 0x20, 0x210, 0x1e, 0xa, 0x32, ANIM_TARGET + delay 0x2 + createsprite gSpriteTemplate_WildboltStormSpark, ANIM_TARGET, 2, 0x0, 0x24, 0x1e0, 0x14, 0xd, 0xffd2, ANIM_TARGET + delay 0x2 + createsprite gSpriteTemplate_WildboltStormSpark, ANIM_TARGET, 2, 0x0, 0x25, 0x240, 0x14, 0x5, 0x2a, ANIM_TARGET + delay 0x2 + createsprite gSpriteTemplate_WildboltStormSpark, ANIM_TARGET, 2, 0x0, 0x23, 0x190, 0x19, 0x8, 0xffd6, ANIM_TARGET + delay 0x2 + createsprite gSpriteTemplate_WildboltStormSpark, ANIM_TARGET, 2, 0x0, 0x20, 0x200, 0x19, 0xd, 0x2e, ANIM_TARGET + delay 0x2 + createsprite gSpriteTemplate_WildboltStormSpark, ANIM_TARGET, 2, 0x0, 0x25, 0x1d0, 0x1e, 0xc, 0xffce, ANIM_TARGET + return + + +@Credits to Skeli +Move_SANDSEAR_STORM:: + loadspritegfx ANIM_TAG_GUST + loadspritegfx ANIM_TAG_SMALL_EMBER + createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_GUST, 0x0, 0xA, 0xA, 0x190B + playsewithpan SE_M_GUST, SOUND_PAN_TARGET + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 4, 88, 1 + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x4, 0x0, 0xB, 0x1F + call HurricaneGust + call SandsearStormFireSpin + call HurricaneGust + call SandsearStormFireSpin + call HurricaneGust + call SandsearStormFireSpin + call HurricaneGust + call SandsearStormFireSpin + call HurricaneGust + call SandsearStormFireSpin + call HurricaneGust + call SandsearStormFireSpin + waitforvisualfinish + stopsound + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x1, 0xB, 0x0, 0x1F + waitforvisualfinish + end + +SandsearStormFireSpin: + createsprite gFireSpinSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x1c, 0x210, 0x1e, 0xd, 0x32, ANIM_TARGET + delay 0x2 + createsprite gFireSpinSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x20, 0x1e0, 0x14, 0x10, 0xffd2, ANIM_TARGET + delay 0x2 + createsprite gFireSpinSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x21, 0x240, 0x14, 0x8, 0x2a, ANIM_TARGET + delay 0x2 + createsprite gFireSpinSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x1f, 0x190, 0x19, 0xb, 0xffd6, ANIM_TARGET + delay 0x2 + createsprite gFireSpinSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x1c, 0x200, 0x19, 0x10, 0x2e, ANIM_TARGET + delay 0x2 + createsprite gFireSpinSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x21, 0x1d0, 0x1e, 0xf, 0xffce, ANIM_TARGET + return + + +@Credits to Skeli +Move_LUNAR_BLESSING:: + loadspritegfx ANIM_TAG_MOON + loadspritegfx ANIM_TAG_SPARKLE_2 + loadspritegfx ANIM_TAG_GUARD_RING + loadspritegfx ANIM_TAG_SMALL_EMBER @Yellow colour for ring + loadspritegfx ANIM_TAG_BLUE_STAR + monbg ANIM_ATK_PARTNER + setalpha 16, 0 + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x0, 0x10, 0x0 + createvisualtask AnimTask_BlendNonAttackerPalettes, 0x2, 0x1, 0x0, 0x10, 0x0 + waitforvisualfinish + createsprite gMoonSpriteTemplate, ANIM_ATTACKER, 2, 0x78, 0x38 + createvisualtask AnimTask_AlphaFadeIn, 0x3, 0x0, 0x10, 0x10, 0x0, 0x1 + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x7, 0x0, 0x10, 0x0 + loopsewithpan SE_M_HEAL_BELL, SOUND_PAN_ATTACKER, 0x10, 0x3 + call HealingEffect2 + createsprite gSpriteTemplate_LunarDanceRing, ANIM_ATTACKER, 2, + delay 0x4 + createsprite gSpriteTemplate_LunarDanceRing, ANIM_ATTACKER, 2, + delay 0x4 + createsprite gSpriteTemplate_LunarDanceRing, ANIM_ATTACKER, 2, + delay 0x24 + clearmonbg ANIM_ATK_PARTNER + call HealingEffect + delay 0x28 + createvisualtask AnimTask_AllBattlersInvisible, 0xA, + createvisualtask AnimTask_MoonlightEndFade, 0x2, + delay 0x10 + createvisualtask AnimTask_AllBattlersVisible, 0xA, + waitforvisualfinish + blendoff + end + + +@Credits to Skeli +Move_TAKE_HEART:: + loadspritegfx ANIM_TAG_RED_HEART + loadspritegfx ANIM_TAG_SPARKLE_2 + loadspritegfx ANIM_TAG_GUARD_RING + playsewithpan SE_M_BUBBLE, SOUND_PAN_ATTACKER + createsprite gSpriteTemplate_TakeHeartFallingHeart, ANIM_ATTACKER, 2, 0, 0x3a, 4, ANIM_ATTACKER + delay 0x15 + loopsewithpan SE_M_HEAL_BELL, SOUND_PAN_ATTACKER, 0x10, 0x4 + createvisualtask AnimTask_StatusClearedEffect, 0x2, 0x0 + call TakeHeartRings + call TakeHeartRings + call TakeHeartRings + call TakeHeartRings + call TakeHeartRings + call TakeHeartRings + call TakeHeartRings + call TakeHeartRings + call TakeHeartRings + call TakeHeartRings + call TakeHeartRings + call TakeHeartRings + waitforvisualfinish + end + +TakeHeartRings: + createsprite gSpriteTemplate_TakeHeartRing, ANIM_ATTACKER, 2, + delay 0x4 + return -Move_POLTERGEIST:: - loadspritegfx ANIM_TAG_EYE_SPARKLE - loadspritegfx ANIM_TAG_WHITE_SHADOW @Destiny Bond - loadspritegfx ANIM_TAG_QUICK_GUARD_HAND @Black Colour +Move_BITTER_BLADE:: + loadspritegfx ANIM_TAG_FOCUS_ENERGY + loadspritegfx ANIM_TAG_CLAW_SLASH + loadspritegfx ANIM_TAG_POISON_BUBBLE + loadspritegfx ANIM_TAG_ORBS + loadspritegfx ANIM_TAG_BLUE_STAR loadspritegfx ANIM_TAG_IMPACT - loadspritegfx ANIM_TAG_POLTERGEIST - fadetobg BG_NIGHTMARE - waitbgfadein - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 2, 0, 0, 16, RGB_BLACK + monbg ANIM_DEF_PARTNER + splitbgprio_foes ANIM_TARGET + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 1, 3, 0, 12, RGB(14, 6, 24) + playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER waitforvisualfinish - createsprite gEyeSparkleSpriteTemplate, ANIM_ATTACKER, 0, -16, -8 - createsprite gEyeSparkleSpriteTemplate, ANIM_ATTACKER, 0, 16, -8 - playsewithpan SE_M_DETECT, SOUND_PAN_ATTACKER + call EndureEffect + delay 8 + call EndureEffect + delay 8 + call EndureEffect waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 2, 0, 16, 0, RGB_BLACK - playsewithpan SE_M_FAINT_ATTACK, SOUND_PAN_ATTACKER - delay 0x1 - createvisualtask AnimTask_DestinyBondWhiteShadow, 0x5, 0x0, 0x24 - delay 0x30 - playsewithpan SE_M_SAND_ATTACK, SOUND_PAN_TARGET - createvisualtask AnimTask_PoltergeistItem, 2 + delay 3 + playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET + createsprite gBitterBladeImpactTemplate ANIM_TARGET, 1, 0x0, 0xa, 0x0, 0xFF00, 0xA + delay 2 + createvisualtask AnimTask_ShakeMon, 0x2, 0x1, 0x0, 0x3, 0xa, 0x1 waitforvisualfinish - setalpha 12, 8 - createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x1, 0x1 - createvisualtask AnimTask_ShakeMon, 0x5, 0x1, 0x0, 0x5, 0x5, 0x1 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 0x7, 0x5, 0x1, 0x0, 0xa, 0x0, 0x0 - playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET + delay 3 + call GigaDrainAbsorbEffect waitforvisualfinish - createvisualtask AnimTask_NightmareClone, 0x2 - createvisualtask AnimTask_ShakeMon, 0x2, 0x1, 0x3, 0x0, 0x28, 0x1 - playsewithpan SE_M_NIGHTMARE, SOUND_PAN_TARGET + delay 15 + call HealingEffect waitforvisualfinish - restorebg - waitbgfadein - clearmonbg 0x3 + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 1, 3, 12, 0, RGB(14, 6, 24) + waitforvisualfinish + clearmonbg ANIM_DEF_PARTNER blendoff end -Move_CORROSIVE_GAS:: -Move_COACHING:: -Move_FLIP_TURN:: -Move_TRIPLE_AXEL:: -Move_DUAL_WINGBEAT:: -Move_SCORCHING_SANDS:: - end @to do - -Move_JUNGLE_HEALING:: - goto Move_AROMATHERAPY - -Move_SILK_TRAP:: - loadspritegfx ANIM_TAG_PROTECT - loadspritegfx ANIM_TAG_SPIDER_WEB - splitbgprio ANIM_ATTACKER - playsewithpan SE_M_STRING_SHOT2, SOUND_PAN_TARGET - createsprite gSpiderWebSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, FALSE +Move_DOUBLE_SHOCK:: + loadspritegfx ANIM_TAG_ELECTRIC_ORBS + loadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT + loadspritegfx ANIM_TAG_LIGHTNING + monbg ANIM_TARGET + setalpha 12, 8 + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 1, 3, 0, 12, RGB_BLACK waitforvisualfinish - createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_PROTECT, 0, 10, 10, RGB_LIME_GREEN - monbg ANIM_ATK_PARTNER - waitplaysewithpan SE_M_REFLECT, SOUND_PAN_ATTACKER, 0x10 - createsprite gProtectSpriteTemplate, ANIM_ATTACKER, 2, 24, 0, 90 + createvisualtask AnimTask_ElectricChargingParticles, 0x2, ANIM_ATTACKER, 30, 0, 3 @;Amount, Slowness, Slowness, Compaction + playsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER + delay 12 + createsprite gGrowingShockWaveOrbSpriteTemplate, ANIM_ATTACKER, 0, 0x0 waitforvisualfinish - clearmonbg ANIM_ATK_PARTNER - end - -@ Also used by Snow weather. Currently identical with Move_HAIL -Move_SNOWSCAPE:: - loadspritegfx ANIM_TAG_HAIL - loadspritegfx ANIM_TAG_ICE_CRYSTALS - createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 3, 0, 6, RGB_BLACK + delay 1 + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 16, 0, RGB_BLACK + delay 1 waitforvisualfinish - createvisualtask AnimTask_Hail, 5 - loopsewithpan SE_M_HAIL, 0, 8, 10 + playsewithpan SE_M_TRI_ATTACK2, SOUND_PAN_TARGET + createvisualtask AnimTask_InvertScreenColor, 2, 0x1 | 0x2 | 0x4 + delay 1 + createsprite gLightningSpriteTemplate, ANIM_TARGET, 6, -16, -32 + createsprite gLightningSpriteTemplate, ANIM_TARGET, 2, 24, -32 + delay 1 + createsprite gLightningSpriteTemplate, ANIM_TARGET, 2, -16, -16 + createsprite gLightningSpriteTemplate, ANIM_TARGET, 2, 24, -16 + delay 1 + createsprite gLightningSpriteTemplate, ANIM_TARGET, 6, -16, 16 + createsprite gLightningSpriteTemplate, ANIM_TARGET, 2, 24, 16 + delay 1 + playsewithpan SE_M_TRI_ATTACK2, SOUND_PAN_TARGET + createvisualtask AnimTask_InvertScreenColor, 2, 0x1 | 0x2 | 0x4 + delay 2 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 15, 1 + createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, ANIM_TARGET, 2 + delay 1 waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 3, 6, 0, RGB_BLACK + clearmonbg ANIM_TARGET + blendoff end -Move_WICKED_BLOW:: -Move_SURGING_STRIKES:: -Move_THUNDER_CAGE:: -Move_DRAGON_ENERGY:: -Move_FREEZING_GLARE:: -Move_FIERY_WRATH:: -Move_THUNDEROUS_KICK:: -Move_GLACIAL_LANCE:: -Move_ASTRAL_BARRAGE:: -Move_EERIE_SPELL:: -Move_DIRE_CLAW:: -Move_PSYSHIELD_BASH:: -Move_POWER_SHIFT:: -Move_STONE_AXE:: -Move_SPRINGTIDE_STORM:: -Move_MYSTICAL_POWER:: -Move_RAGING_FURY:: -Move_WAVE_CRASH:: -Move_CHLOROBLAST:: -Move_MOUNTAIN_GALE:: -Move_VICTORY_DANCE:: -Move_HEADLONG_RUSH:: -Move_BARB_BARRAGE:: -Move_ESPER_WING:: -Move_BITTER_MALICE:: -Move_SHELTER:: -Move_TRIPLE_ARROWS:: -Move_INFERNAL_PARADE:: -Move_CEASELESS_EDGE:: -Move_BLEAKWIND_STORM:: -Move_WILDBOLT_STORM:: -Move_SANDSEAR_STORM:: -Move_LUNAR_BLESSING:: -Move_TAKE_HEART:: Move_TERA_BLAST:: Move_AXE_KICK:: Move_LAST_RESPECTS:: @@ -14466,8 +16495,6 @@ Move_HYPER_DRILL:: Move_TWIN_BEAM:: Move_RAGE_FIST:: Move_ARMOR_CANNON:: -Move_BITTER_BLADE:: -Move_DOUBLE_SHOCK:: Move_GIGATON_HAMMER:: Move_COMEUPPANCE:: Move_AQUA_CUTTER:: @@ -15311,7 +17338,7 @@ Move_REVERSAL: createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 3, RGB_WHITE, 8, RGB_BLACK, 0 waitforvisualfinish delay 30 - createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 2, 0, 10, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_BATTLERS), 3, 2, 0, 10, RGB_WHITE delay 10 playsewithpan SE_M_REVERSAL, SOUND_PAN_ATTACKER createsprite gReversalOrbSpriteTemplate, ANIM_ATTACKER, 2, 26, 0 @@ -15609,6 +17636,17 @@ Move_WATERFALL: setalpha 12, 8 createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 0, 2, 23, 1 delay 5 + call WaterfallBubblesOnAttacker + delay 10 + createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 6, 5 + delay 6 + call RisingWaterHitEffect + waitforvisualfinish + clearmonbg ANIM_DEF_PARTNER + blendoff + end + +WaterfallBubblesOnAttacker: playsewithpan SE_M_CRABHAMMER, SOUND_PAN_ATTACKER createsprite gSmallBubblePairSpriteTemplate, ANIM_ATTACKER, 2, 10, 10, 25, ANIM_ATTACKER delay 4 @@ -15633,14 +17671,7 @@ Move_WATERFALL: playsewithpan SE_M_CRABHAMMER, SOUND_PAN_ATTACKER createsprite gSmallBubblePairSpriteTemplate, ANIM_ATTACKER, 2, 12, 0, 25, ANIM_ATTACKER waitforvisualfinish - delay 10 - createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 6, 5 - delay 6 - call RisingWaterHitEffect - waitforvisualfinish - clearmonbg ANIM_DEF_PARTNER - blendoff - end + return RisingWaterHitEffect: playsewithpan SE_M_WATERFALL, SOUND_PAN_TARGET @@ -15961,7 +17992,7 @@ Move_PAY_DAY: Move_OUTRAGE: loadspritegfx ANIM_TAG_SMALL_EMBER loopsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER, 8, 3 - createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG | F_PAL_ATTACKER | F_PAL_TARGET, 2, 5, 3, 8, RGB(14, 13, 0) + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_ATTACKER | F_PAL_TARGET), 2, 5, 3, 8, RGB(14, 13, 0) createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 12, 6, 5, 4 delay 0 createsprite gOutrageFlameSpriteTemplate, ANIM_TARGET, 2, 0, 0, 30, 1280, 0, 3 @@ -16658,8 +18689,8 @@ Move_LOW_KICK: end Move_EARTHQUAKE: - createvisualtask AnimTask_HorizontalShake, 5, (MAX_BATTLERS_COUNT + 1), 10, 50 - createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 10, 50 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 10, 50 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 10, 50 playsewithpan SE_M_EARTHQUAKE, 0 delay 10 createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 @@ -16669,7 +18700,7 @@ Move_EARTHQUAKE: Move_FISSURE: loadspritegfx ANIM_TAG_MUD_SAND - createvisualtask AnimTask_HorizontalShake, 3, (MAX_BATTLERS_COUNT + 1), 10, 50 + createvisualtask AnimTask_HorizontalShake, 3, ANIM_PLAYER_RIGHT, 10, 50 createvisualtask AnimTask_HorizontalShake, 3, ANIM_TARGET, 10, 50 playsewithpan SE_M_EARTHQUAKE, SOUND_PAN_TARGET delay 8 @@ -17049,7 +19080,7 @@ Move_FLASH: end Move_SPLASH: - createvisualtask AnimTask_Splash, 2, 0, 3 + createvisualtask AnimTask_Splash, 2, ANIM_ATTACKER, 3 delay 8 loopsewithpan SE_M_TAIL_WHIP, SOUND_PAN_ATTACKER, 38, 3 waitforvisualfinish @@ -17128,7 +19159,7 @@ Move_SKETCH: createsprite gPencilSpriteTemplate, ANIM_TARGET, 2 waitforvisualfinish clearmonbg ANIM_TARGET - createvisualtask AnimTask_Splash, 2, 0, 2 + createvisualtask AnimTask_Splash, 2, ANIM_ATTACKER, 2 loopsewithpan SE_M_TAIL_WHIP, SOUND_PAN_ATTACKER, 38, 2 end @@ -17392,13 +19423,13 @@ Move_MAGNITUDE: MagnitudeEnd: end MagnitudeRegular: - createvisualtask AnimTask_HorizontalShake, 5, (MAX_BATTLERS_COUNT + 1), 0, 50 - createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 0, 50 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 0, 50 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 0, 50 loopsewithpan SE_M_STRENGTH, SOUND_PAN_TARGET, 8, 10 goto MagnitudeEnd MagnitudeIntense: - createvisualtask AnimTask_HorizontalShake, 5, (MAX_BATTLERS_COUNT + 1), 0, 50 - createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 0, 50 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 0, 50 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 0, 50 loopsewithpan SE_M_STRENGTH, SOUND_PAN_TARGET, 8, 10 delay 10 createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 @@ -17871,8 +19902,8 @@ Move_ERUPTION: createsprite gEruptionFallingRockSpriteTemplate, ANIM_ATTACKER, 40, 110, -32, 64, 50, 0 createsprite gEruptionFallingRockSpriteTemplate, ANIM_ATTACKER, 40, 60, -32, 80, 70, 1 delay 22 - createvisualtask AnimTask_HorizontalShake, 5, (MAX_BATTLERS_COUNT + 1), 8, 60 - createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 8, 60 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 8, 60 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 8, 60 loopsewithpan SE_M_ROCK_THROW, SOUND_PAN_TARGET, 16, 12 delay 80 createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 40, F_PAL_BG | F_PAL_BATTLERS, 4, 4, 0, RGB_RED @@ -17902,7 +19933,7 @@ Move_IMPRISON: waitforvisualfinish delay 4 createsprite gRedXSpriteTemplate, ANIM_ATTACKER, 5, ANIM_ATTACKER, 40 - createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 1, 10 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 1, 10 playsewithpan SE_M_HYPER_BEAM, SOUND_PAN_ATTACKER clearmonbg ANIM_DEF_PARTNER call UnsetPsychicBg @@ -18067,7 +20098,7 @@ Move_TEETER_DANCE: Move_MUD_SPORT: loadspritegfx ANIM_TAG_MUD_SAND - createvisualtask AnimTask_Splash, 2, 0, 6 + createvisualtask AnimTask_Splash, 2, ANIM_ATTACKER, 6 delay 24 createsprite gMudsportMudSpriteTemplate, ANIM_TARGET, 2, 0, -4, -16 createsprite gMudsportMudSpriteTemplate, ANIM_TARGET, 2, 0, 4, -12 @@ -21969,7 +24000,7 @@ PresentHeal: Move_BATON_PASS: loadspritegfx ANIM_TAG_POKEBALL playsewithpan SE_M_BATON_PASS, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG | F_PAL_BATTLERS, 1, 2, 0, 11, RGB(31, 22, 30) + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_BG | F_PAL_BATTLERS), 1, 2, 0, 11, RGB(31, 22, 30) createsprite gBatonPassPokeballSpriteTemplate, ANIM_ATTACKER, 2 end @@ -22327,7 +24358,7 @@ Move_TRANSFORM: monbg ANIM_ATTACKER playsewithpan SE_M_TELEPORT, SOUND_PAN_ATTACKER waitplaysewithpan SE_M_MINIMIZE, SOUND_PAN_ATTACKER, 48 - createvisualtask AnimTask_TransformMon, 2, 0, 0, 1 + createvisualtask AnimTask_TransformMon, 2, 0, 1 waitforvisualfinish clearmonbg ANIM_ATTACKER end @@ -24409,22 +26440,6 @@ Status_Nightmare: Status_Powder: end -General_WeatherFormChange: - createvisualtask AnimTask_IsMonInvisible, 2 - jumpreteq TRUE, WeatherFormChangeSkipAnim - goto WeatherFormChangeContinue -WeatherFormChangeContinue: - monbg ANIM_ATTACKER - playsewithpan SE_M_TELEPORT, SOUND_PAN_ATTACKER - waitplaysewithpan SE_M_MINIMIZE, SOUND_PAN_ATTACKER, 48 - createvisualtask AnimTask_TransformMon, 2, 1, 0, 0 - waitforvisualfinish - clearmonbg ANIM_ATTACKER - end -WeatherFormChangeSkipAnim: - createvisualtask AnimTask_CastformGfxDataChange, 2, 1 - end - General_StatsChange: createvisualtask AnimTask_StatsChange, 5 waitforvisualfinish @@ -24509,13 +26524,13 @@ Status_MagmaStorm: loopsewithpan SE_M_SACRED_FIRE2, SOUND_PAN_TARGET, 5, 8 createvisualtask AnimTask_SeismicTossBgAccelerateDownAtEnd, 3 createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 2, 47, 1 - createvisualtask AnimTask_BlendColorCycle, 2, 6, 4, 2, 2, 0, 12, RGB(22, 9, 7) + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_ATTACKER | F_PAL_TARGET), 4, 2, 2, 0, 12, RGB(22, 9, 7) call FireSpinEffect call FireSpinEffect - createvisualtask AnimTask_BlendColorCycle, 2, 6, 4, 2, 2, 0, 12, RGB(22, 9, 7) + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_ATTACKER | F_PAL_TARGET), 4, 2, 2, 0, 12, RGB(22, 9, 7) call FireSpinEffect call FireSpinEffect - createvisualtask AnimTask_BlendColorCycle, 2, 6, 4, 2, 2, 0, 12, RGB(22, 9, 7) + createvisualtask AnimTask_BlendColorCycle, 2, (F_PAL_ATTACKER | F_PAL_TARGET), 4, 2, 2, 0, 12, RGB(22, 9, 7) call FireSpinEffect restorebg waitbgfadeout @@ -24587,7 +26602,7 @@ Status_Infestation: monbg ANIM_DEF_PARTNER splitbgprio ANIM_TARGET createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 0x2, 0x0, 0x9, 0x7320 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 30, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 30, 1 loopsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER, 0x0, 30 call InfestationVortex call InfestationVortex @@ -24843,20 +26858,20 @@ General_WishHeal: General_IllusionOff: monbg ANIM_TARGET - createvisualtask AnimTask_TransformMon, 2, 0, 1, 0 + createvisualtask AnimTask_TransformMon, 2, 1, 0 waitforvisualfinish clearmonbg ANIM_TARGET end General_FormChange: monbg ANIM_ATTACKER - createvisualtask AnimTask_TransformMon, 2, 0, 1, 0 + createvisualtask AnimTask_TransformMon, 2, 1, 0 waitforvisualfinish clearmonbg ANIM_ATTACKER end General_SlideOffScreen: - createvisualtask AnimTask_SlideOffScreen, 5, ANIM_TARGET, +3 + createvisualtask AnimTask_SlideOffScreen, 5, ANIM_TARGET, 3 waitforvisualfinish createvisualtask AnimTask_SetInvisible, 1, ANIM_TARGET, TRUE waitforvisualfinish @@ -24869,7 +26884,7 @@ General_MegaEvolution: monbg ANIM_ATTACKER setalpha 12, 8 loopsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER, 13, 3 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 0, 6, 0, 11, RGB(31, 31, 11) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 6, 0, 11, RGB(31, 31, 11) call MegaEvolutionParticles call MegaEvolutionParticles call MegaEvolutionParticles @@ -24879,9 +26894,9 @@ General_MegaEvolution: delay 20 createvisualtask AnimTask_BlendBattleAnimPalExclude, 5, 5, 2, 0, 16, RGB_WHITEALPHA waitforvisualfinish - createvisualtask AnimTask_TransformMon, 2, 0, 1, 0 + createvisualtask AnimTask_TransformMon, 2, 1, 0 createvisualtask AnimTask_BlendBattleAnimPalExclude, 5, 5, 2, 16, 0, RGB_WHITEALPHA - createvisualtask AnimTask_HorizontalShake, 5, 1, 5, 14 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 5, 14 waitforvisualfinish createvisualtask SoundTask_PlayNormalCry, 0 createsprite gMegaSymbolSpriteTemplate ANIM_ATTACKER, 2 @@ -24926,7 +26941,7 @@ General_ZMoveActivate: waitbgfadein createvisualtask AnimTask_StartSlidingBg, 0x5, 0x0, 0x0, 0x0, 0xFFFF playsewithpan SE_M_SOLAR_BEAM, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendColorCycle, 0x2, F_PAL_ATTACKER, 0x0, 0x6, 0x0, 0xb, 0x76BC + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 6, 0, 11, RGB(28, 21, 29) call ZMoveBuffEffect call ZMoveBuffEffect call ZMoveBuffEffect @@ -24957,7 +26972,7 @@ General_TotemFlare:: monbg ANIM_ATTACKER setalpha 12, 8 playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendColorCycle, 0x2, F_PAL_ATTACKER, 0x0, 0x6, 0x0, 0xb, 0x1f + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 6, 0, 11, RGB_RED call RainbowEndureEffect call RainbowEndureEffect call RainbowEndureEffect @@ -25015,7 +27030,7 @@ General_PrimalReversion_Alpha: monbg ANIM_ATTACKER setalpha 12, 8 loopsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER, 13, 3 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 0, 6, 0, 11, RGB(31, 31, 11) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 6, 0, 11, RGB(31, 31, 11) call MegaEvolutionParticles call MegaEvolutionParticles call MegaEvolutionParticles @@ -25025,9 +27040,9 @@ General_PrimalReversion_Alpha: delay 20 createvisualtask AnimTask_BlendBattleAnimPalExclude, 5, 5, 2, 0, 16, RGB_WHITEALPHA waitforvisualfinish - createvisualtask AnimTask_TransformMon, 2, 0, 1, 0 + createvisualtask AnimTask_TransformMon, 2, 1, 0 createvisualtask AnimTask_BlendBattleAnimPalExclude, 5, 5, 2, 16, 0, RGB_WHITEALPHA - createvisualtask AnimTask_HorizontalShake, 5, 1, 5, 14 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 5, 14 waitforvisualfinish createvisualtask SoundTask_PlayNormalCry, 0 createsprite gAlphaSymbolSpriteTemplate ANIM_ATTACKER, 2 @@ -25042,7 +27057,7 @@ General_PrimalReversion_Omega: monbg ANIM_ATTACKER setalpha 12, 8 loopsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER, 13, 3 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 0, 6, 0, 11, RGB(31, 31, 11) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 6, 0, 11, RGB(31, 31, 11) call MegaEvolutionParticles call MegaEvolutionParticles call MegaEvolutionParticles @@ -25052,9 +27067,9 @@ General_PrimalReversion_Omega: delay 20 createvisualtask AnimTask_BlendBattleAnimPalExclude, 5, 5, 2, 0, 16, RGB_WHITEALPHA waitforvisualfinish - createvisualtask AnimTask_TransformMon, 2, 0, 1, 0 + createvisualtask AnimTask_TransformMon, 2, 1, 0 createvisualtask AnimTask_BlendBattleAnimPalExclude, 5, 5, 2, 16, 0, RGB_WHITEALPHA - createvisualtask AnimTask_HorizontalShake, 5, 1, 5, 14 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 5, 14 waitforvisualfinish createvisualtask SoundTask_PlayNormalCry, 0 createsprite gOmegaSymbolSpriteTemplate ANIM_ATTACKER, 2 @@ -25063,6 +27078,43 @@ General_PrimalReversion_Omega: blendoff end +General_UltraBurst:: + loadspritegfx ANIM_TAG_ULTRA_BURST_SYMBOL + loadspritegfx ANIM_TAG_SPARK_2 @spark + loadspritegfx ANIM_TAG_LEAF @green + loadspritegfx ANIM_TAG_ELECTRIC_ORBS @charge particles + loadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT @psycho boost + monbg ANIM_ATTACKER + setalpha 12, 8 + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, (F_PAL_BG | F_PAL_ADJACENT), 0x2, 0x0, 0xF, 0x0000 + waitforvisualfinish + createvisualtask AnimTask_ElectricChargingParticles, 2, ANIM_ATTACKER, 60, 2, 12 @ charge particles to attacker + delay 0x1e + loopsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER, 0xe, 0xa + createsprite gSuperpowerOrbSpriteTemplate, ANIM_TARGET, 3, 0x0 + call LightThatBurnsTheSkyGreenSparks + call LightThatBurnsTheSkyGreenSparks + call LightThatBurnsTheSkyGreenSparks + call LightThatBurnsTheSkyGreenSparks + call LightThatBurnsTheSkyGreenSparks + call LightThatBurnsTheSkyGreenSparks + call LightThatBurnsTheSkyGreenSparks + call LightThatBurnsTheSkyGreenSparks + call LightThatBurnsTheSkyGreenSparks + delay 20 + createvisualtask AnimTask_BlendBattleAnimPalExclude, 5, 5, 2, 0, 16, RGB_WHITEALPHA + createvisualtask AnimTask_TransformMon, 2, 1, 0 + createsprite gUltraBurstSymbolSpriteTemplate, ANIM_ATTACKER, 0x0, 0x0, 0x0, 0x0, 0x0 + waitforvisualfinish + createvisualtask AnimTask_BlendBattleAnimPalExclude, 5, 5, 2, 16, 0, RGB_WHITEALPHA + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 5, 14 + waitforvisualfinish + createvisualtask SoundTask_PlayNormalCry, 0 + waitforvisualfinish + clearmonbg ANIM_ATK_PARTNER + blendoff + end + General_AffectionHangedOn:: loadspritegfx ANIM_TAG_RED_HEART loopsewithpan SE_M_CHARM, SOUND_PAN_ATTACKER, 12, 3 @@ -25084,6 +27136,9 @@ General_AffectionHangedOn_3Hearts: waitforvisualfinish end +General_SaltCureDamage:: + goto Status_Freeze + SnatchMoveTrySwapFromSubstitute: createvisualtask AnimTask_IsAttackerBehindSubstitute, 2 jumprettrue SnatchMoveSwapSubstituteForMon @@ -25185,8 +27240,8 @@ Move_BREAKNECK_BLITZ:: loadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT loadspritegfx ANIM_TAG_METEOR loadspritegfx ANIM_TAG_FLAT_ROCK - createvisualtask AnimTask_HorizontalShake, 0x5, 0x5, 0x5, 0x20 @ shake screen - createvisualtask AnimTask_HorizontalShake, 0x5, 0x4, 0x5, 0x20 @ shake banks + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 5, 32 @ shake screen + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 5, 32 @ shake banks playsewithpan SE_M_EARTHQUAKE, 0x0 monbg ANIM_ATTACKER splitbgprio ANIM_ATTACKER @@ -25207,7 +27262,7 @@ Move_BREAKNECK_BLITZ:: createsprite gBreakneckBlitzDanceSpriteTemplate, ANIM_ATTACKER, 2, 0xd5 waitforvisualfinish clearmonbg ANIM_ATTACKER - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 10 waitforvisualfinish fadetobg BG_DRILL waitbgfadeout @@ -25215,7 +27270,7 @@ Move_BREAKNECK_BLITZ:: waitbgfadein setalpha 12, 8 delay 0x10 - createvisualtask AnimTask_WindUpLunge, 0x5, 0x0, 0xffe8, 0x8, 0x17, 0xa, 0x28, 0xa + createvisualtask AnimTask_WindUpLunge, 5, ANIM_ATTACKER, -24, 8, 23, 10, 40, 10 delay 0x23 invisible ANIM_ATTACKER createsprite gGrowingSuperpowerTemplate, ANIM_TARGET, 3, 0x0 @@ -25238,12 +27293,12 @@ Move_BREAKNECK_BLITZ:: createsprite gBreakneckBlitzHitSpriteTemplate, ANIM_TARGET, 3, 0x19, 0xffe7, 0x1, 0x1 @ +25, -25 createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, ANIM_TARGET, 0xffe6, 0x10, 0x1, 0x4 waitforvisualfinish - createvisualtask AnimTask_RotateMonSpriteToSide, 0x2, 0x8, 0xfe00, 0x1, 0x0 - createvisualtask AnimTask_ShakeMonInPlace, 0x2, 0x0, 0x4, 0x0, 0xc, 0x1 - createvisualtask AnimTask_ShakeMonInPlace, 0x2, 0x1, 0x4, 0x0, 0xc, 0x1 + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -512, ANIM_TARGET, 0 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_ATTACKER, 4, 0, 12, 1 + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 4, 0, 12, 1 waitforvisualfinish delay 0x4 - createvisualtask AnimTask_RotateMonSpriteToSide, 0x2, 0x8, 0xfe00, 0x1, 0x1 + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -512, ANIM_TARGET, 1 delay 0xa delay 0x19 createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_TARGET, 0x0, 0x6 @@ -25253,7 +27308,7 @@ Move_BREAKNECK_BLITZ:: delay 0x10 blendoff clearmonbg ANIM_DEF_PARTNER - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA waitforvisualfinish call UnsetPsychicBg end @@ -25265,12 +27320,12 @@ Move_ALL_OUT_PUMMELING: loadspritegfx ANIM_TAG_METEOR loadspritegfx ANIM_TAG_FLAT_ROCK loadspritegfx ANIM_TAG_FOCUS_ENERGY - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish call EndureEffect loopsewithpan SE_M_TAKE_DOWN, SOUND_PAN_ATTACKER 0x9 0x2 - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x2, 0x2, 0x2, 0x0, 0xb, 0x1f - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x20, 0x1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB_RED + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 call EndureEffect waitforvisualfinish fadetobg BG_ROCK_WRECKER @@ -25279,7 +27334,7 @@ Move_ALL_OUT_PUMMELING: waitbgfadein setalpha 12, 8 monbg ANIM_DEF_PARTNER - createvisualtask AnimTask_ShakeMon, 0x5, 0x1, 0x0, 0x2, SOUND_PAN_TARGET, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 2, 63, 1 createsprite gAllOutPummelingOnslaughtSpriteTemplate, ANIM_ATTACKER, 2, 0xffd0, 0x18, 0x0, 0x0, 0xa, 0x1, ANIM_FOOT_1, 0x1 delay 0x2 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x1, 0x1 @@ -25326,7 +27381,7 @@ Move_ALL_OUT_PUMMELING: createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x1, 0x1 playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET delay 0x10 - createvisualtask AnimTask_WindUpLunge, 0x5, 0x0, 0xffe8, 0x8, 0x17, 0xa, 0x28, 0xa + createvisualtask AnimTask_WindUpLunge, 5, ANIM_ATTACKER, -24, 8, 23, 10, 40, 10 delay 0x23 invisible ANIM_ATTACKER createsprite gGrowingSuperpowerTemplate, ANIM_TARGET, 3, 0x0 @@ -25343,7 +27398,7 @@ Move_ALL_OUT_PUMMELING: delay 0x10 blendoff clearmonbg ANIM_DEF_PARTNER - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA waitforvisualfinish call UnsetPsychicBg end @@ -25355,11 +27410,11 @@ Move_SUPERSONIC_SKYSTRIKE: loadspritegfx ANIM_TAG_FOCUS_ENERGY @ focus energy loadspritegfx ANIM_TAG_BIRD @ sky attack bird loadspritegfx ANIM_TAG_IMPACT @ hit - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish monbg ANIM_DEF_PARTNER createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x1, 0x8, 0x0, 0x0 - createvisualtask AnimTask_HorizontalShake, 0x5, 0x0, 0x2, 0x10 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_ATTACKER, 2, 16 playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x1, 0xf, 0x0, 0x7fff clearmonbg ANIM_DEF_PARTNER @@ -25415,7 +27470,7 @@ FinishSupersonicSkystrike: delay 0x30 clearmonbg ANIM_DEF_PARTNER blendoff - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_TARGET, 0x0, 0x10 call UnsetPsychicBg waitforvisualfinish @@ -25440,13 +27495,13 @@ FinishAcidDownpour: setalpha 12, 8 monbg ANIM_ATTACKER loopsewithpan SE_M_TOXIC, SOUND_PAN_TARGET, 0xd, 0x6 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_ATTACKER, 0x0, 0x2, 0x32, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 0, 2, 50, 1 call AcidDownpourFlareOnAttacker call AcidDownpourFlareOnAttacker call AcidDownpourFlareOnAttacker delay 0x5 clearmonbg ANIM_ATTACKER - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish blendoff delay 0x20 @@ -25461,7 +27516,7 @@ FinishAcidDownpour: panse SE_M_WHIRLPOOL, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 0x2, 0x0 createvisualtask AnimTask_CreateSurfWave, 0x2, ANIM_SURF_PAL_SLUDGE_WAVE createvisualtask AnimTask_BlendBattleAnimPal, 0xa, 0x4, 0x2, 0x0, 0x7, 0xd87c - createvisualtask AnimTask_ShakeMon, 0x5, 0x1, 0x0, 0x2, 0x32, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 2, 50, 1 call AcidDownpourFlare call AcidDownpourFlare delay 0x15 @@ -25474,7 +27529,7 @@ FinishAcidDownpour: restorebg waitbgfadeout setarg 0x7 0xffff - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA waitbgfadein waitforvisualfinish end @@ -25535,7 +27590,7 @@ Move_TECTONIC_RAGE: delay 0xa waitforvisualfinish clearmonbg ANIM_TARGET - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish invisible ANIM_TARGET delay 0x5 @@ -25564,8 +27619,8 @@ Move_TECTONIC_RAGE: createsprite gEruptionFallingRockSpriteTemplate, ANIM_ATTACKER, 40, 0x6e, 0xffe0, 0x40, 0x32, 0x0 createsprite gEruptionFallingRockSpriteTemplate, ANIM_ATTACKER, 40, 0x3c, 0xffe0, 0x50, 0x46, 0x1 delay 0x16 - createvisualtask AnimTask_HorizontalShake, 0x5, 0x5, 0x8, 0x3c - createvisualtask AnimTask_HorizontalShake, 0x5, 0x4, 0x8, 0x3c + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 8, 60 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 8, 60 loopsewithpan SE_M_ROCK_THROW, SOUND_PAN_TARGET, 0x10, 0xc delay 0x30 call TectonicRageExplosion @@ -25602,7 +27657,7 @@ Move_TECTONIC_RAGE: waitforvisualfinish call UnsetPsychicBg waitbgfadein - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA waitforvisualfinish end TectonicRageExplosion: @@ -25631,13 +27686,13 @@ Move_CONTINENTAL_CRUSH:: loadspritegfx ANIM_TAG_FOCUS_ENERGY @ focus energy loadspritegfx ANIM_TAG_IMPACT @ hit loadspritegfx ANIM_TAG_REALLY_BIG_ROCK - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER call ContinentalCrashBuffEffect delay 0x8 - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x2, 0x2, 0x2, 0x0, 0xb, 0x2dd3 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x20, 0x1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB(19, 14, 11) + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 call ContinentalCrashBuffEffect delay 0x8 call ContinentalCrashBuffEffect @@ -25669,15 +27724,15 @@ FinishContinentalCrush: delay 0x5 visible ANIM_ATTACKER delay 0x4 - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x2, 0x2, 0x2, 0x0, 0xb, 0x2dd3 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x20, 0x1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB(19, 14, 11) + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 playsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER call ContinentalCrushStockpileRocks playsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER call ContinentalCrushStockpileRocks createsprite gContinentalCrushGrowingRockSpriteTemplate, ANIM_ATTACKER, 2, 0x0 - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x2, 0x2, 0x2, 0x0, 0xb, 0x2dd3 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x20, 0x1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB(19, 14, 11) + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 playsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER call ContinentalCrushStockpileRocks playsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER @@ -25698,8 +27753,8 @@ FinishContinentalCrush: createsprite gContinentalCrushEruptionSpriteTemplate, ANIM_ATTACKER, 40, 0x6e, 0xffe0, 0x40, 0x32, 0x0 createsprite gContinentalCrushEruptionSpriteTemplate, ANIM_ATTACKER, 40, 0x3c, 0xffe0, 0x50, 0x46, 0x1 delay 0x16 - createvisualtask AnimTask_HorizontalShake, 0x5, 0x5, 0x8, 0x1c - createvisualtask AnimTask_HorizontalShake, 0x5, 0x4, 0x8, 0x1c + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 8, 28 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 8, 28 unloadspritegfx ANIM_TAG_ROUND_SHADOW @ fly unloadspritegfx ANIM_TAG_MUD_SAND @ dig unloadspritegfx ANIM_TAG_FOCUS_ENERGY @ focus energy @@ -25728,7 +27783,7 @@ FinishContinentalCrush: restorebg waitbgfadeout setarg 0x7 0xffff - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA waitbgfadein delay 0x4 waitforvisualfinish @@ -25778,7 +27833,7 @@ Move_SAVAGE_SPIN_OUT:: loadspritegfx ANIM_TAG_STRING @string shot loadspritegfx ANIM_TAG_SPIDER_WEB @spider web loadspritegfx ANIM_TAG_MUD_SAND @rocks - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish monbg ANIM_ATTACKER setalpha 12, 8 @@ -25793,11 +27848,11 @@ Move_SAVAGE_SPIN_OUT:: waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x4, 0x0, 0x0 clearmonbg ANIM_ATTACKER - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish unloadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT call gSavageSpinOutStringBlastSpriteTemplateSHOT - createvisualtask AnimTask_ShakeMon, 0x5, 0x1, 0x5, 0x0, 0x32, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 5, 0, 50, 1 call gSavageSpinOutStringBlastSpriteTemplateSHOT call gSavageSpinOutStringBlastSpriteTemplateSHOT call gSavageSpinOutStringBlastSpriteTemplateSHOT @@ -25858,8 +27913,8 @@ FinishSavageSpinOut: loadspritegfx ANIM_TAG_CUT @cut loadspritegfx ANIM_TAG_EXPLOSION_2 @explosion loadspritegfx ANIM_TAG_AIR_WAVE_2 @white/gray - createvisualtask AnimTask_ShakeMonInPlace, 0x82, ANIM_TARGET, 0x4, 0x0, 0xc, 0x1 - createvisualtask AnimTask_ShakeMonInPlace, 0x82, ANIM_TARGET, 0x4, 0x0, 0xc, 0x1 + createvisualtask AnimTask_ShakeMonInPlace, 130, ANIM_TARGET, 4, 0, 12, 1 + createvisualtask AnimTask_ShakeMonInPlace, 130, ANIM_TARGET, 4, 0, 12, 1 createsprite gSavageSpinOutGreenCutSpriteTemplate, ANIM_TARGET, 2, 0x28, 0xffe0, 0x0 createsprite gSavageSpinOutGreenCutSpriteTemplate, ANIM_TARGET, 2, 0x28, 0xffd0, 0x0 playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET @@ -25882,7 +27937,7 @@ FinishSavageSpinOut: createsprite gSavageSpinOutWhiteExplosionSpriteTemplate, ANIM_TARGET, 3, 0x10, 0x10, ANIM_TARGET, 0x1 delay 0x6 waitforvisualfinish - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA waitforvisualfinish end gSavageSpinOutStringBlastSpriteTemplateSHOT: @@ -25932,13 +27987,13 @@ Move_NEVER_ENDING_NIGHTMARE:: loadspritegfx ANIM_TAG_FIRE_PLUME @blast burn loadspritegfx ANIM_TAG_POISON_BUBBLE @purple loadspritegfx ANIM_TAG_VERTICAL_HEX @hex - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER call NeverendingNightmareBuffEffect delay 0x8 - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x2, 0x2, 0x2, 0x0, 0xb, 0x40c0 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x20, 0x1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB(0, 6, 16) + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 call NeverendingNightmareBuffEffect delay 0x8 call NeverendingNightmareBuffEffect @@ -25959,7 +28014,7 @@ Move_NEVER_ENDING_NIGHTMARE:: waitforvisualfinish fadetobg BG_NEVERENDING_NIGHTMARE waitbgfadein - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_TARGET, 0x0, 0x4, 0x78, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 4, 120, 1 playsewithpan SE_M_WHIRLPOOL, SOUND_PAN_TARGET call NeverendingNightmareHands call NeverendingNightmareHands @@ -26007,7 +28062,7 @@ Move_NEVER_ENDING_NIGHTMARE:: waitforvisualfinish restorebg waitbgfadeout - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA waitforvisualfinish end NeverendingNightmareBuffEffect: @@ -26117,12 +28172,12 @@ Move_CORKSCREW_CRASH:: loadspritegfx ANIM_TAG_MUD_SAND @rock monbg ANIM_ATTACKER invisible ANIM_TARGET - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x2, 0x0, 0xb, 0x6318 @fade atker to gray createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_SPIKES, 0x0, 0xC, 0xC, 0x6318 @;Gray playsewithpan SE_ESCALATOR, SOUND_PAN_ATTACKER - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_ATTACKER, 0x0, 0x2, 0x4f, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 0, 2, 79, 1 createsprite gCorkscrewCrashChargeSpriteTemplate, ANIM_ATTACKER, 2, 0x0 call CorkscrewCrashMetalFlare call CorkscrewCrashMetalFlare @@ -26173,7 +28228,7 @@ FinishCorkscrewCrash: playsewithpan SE_M_DOUBLE_TEAM, SOUND_PAN_TARGET createsprite gCorkscrewCrashCorkscrewFlyDownSpriteTemplate, ANIM_TARGET, 3, 0x0, 0xffc0, 0x0f delay 0xf - createvisualtask AnimTask_HorizontalShake, 0x5, ANIM_TARGET, 0x2, 0x30 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 2, 48 createsprite gCorkscrewCrashCorkscrewFlyDownSpriteTemplate, ANIM_TARGET, 3, 0x0, 0xfffe, 0x03 call CorkscrewCrashSpinningWind call CorkscrewCrashSprayRocks @@ -26240,7 +28295,7 @@ Move_INFERNO_OVERDRIVE:: loadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT @charge loadspritegfx ANIM_TAG_SMALL_EMBER @fire createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_CIRCLE_OF_LIGHT, 0x0, 0xA, 0xA, 0x1F - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish fadetobg BG_INFERNO_OVERDRIVE waitbgfadeout @@ -26256,7 +28311,7 @@ FinishInfernoOverdrive: monbg ANIM_ATTACKER setalpha 12, 8 loopsewithpan SE_M_SACRED_FIRE2, SOUND_PAN_ATTACKER, 0x13, 0x8 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_ATTACKER, 0x0, 0x2, 0x4f, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 0, 2, 79, 1 createsprite gInfernoOverdriveChargeSpriteTemplate, ANIM_ATTACKER, 2, 0x0 call InfernoOverdriveFireSpin call InfernoOverdriveFireSpin @@ -26275,10 +28330,10 @@ FinishInfernoOverdrive: createsprite gInfernoOverdriveSuperpowerSpriteTemplate, ANIM_TARGET, 3, 0x0 @ super power shot playsewithpan SE_M_FLAME_WHEEL2, SOUND_PAN_ATTACKER delay 0x10 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x8, 0x0, 0x10, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 8, 0, 16, 1 playsewithpan SE_M_MEGA_KICK2, SOUND_PAN_TARGET unloadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_TARGET, 0x0, 0x2, 0x4f, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 2, 79, 1 call InfernoOverdriveExplosion delay 0x6 call InfernoOverdriveExplosion @@ -26353,7 +28408,7 @@ Move_HYDRO_VORTEX:: loadspritegfx ANIM_TAG_FOCUS_ENERGY @focus energy loadspritegfx ANIM_TAG_METEOR @superpower loadspritegfx ANIM_TAG_WATER_ORB @whirlpool - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish createvisualtask AnimTask_CreateSurfWave, 0x2, 0x0 delay 0x18 @@ -26385,8 +28440,8 @@ Move_HYDRO_VORTEX:: call HydroVortexBubbles loadspritegfx ANIM_TAG_FOCUS_ENERGY playsewithpan SE_M_WATERFALL, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x2, 0x2, 0x2, 0x0, 0xb, 0x5da0 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x20, 0x1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB(0, 13, 23) + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 waitforvisualfinish unloadspritegfx ANIM_TAG_SPLASH unloadspritegfx ANIM_TAG_SWEAT_BEAD @@ -26399,7 +28454,7 @@ Move_HYDRO_VORTEX:: playsewithpan SE_M_MEGA_KICK2, SOUND_PAN_TARGET createvisualtask AnimTask_BlendBattleAnimPal, 0xa, 0x4, 0x2, 0x0, 0x10, 0x5da0 loadspritegfx ANIM_TAG_GUST - createvisualtask AnimTask_HorizontalShake, 0x5, 0x1, 0x8, 0x3c + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 8, 60 call HydroVortexWhirlpoolHurricane call HydroVortexWhirlpoolHurricane call HydroVortexWhirlpoolHurricane @@ -26409,7 +28464,7 @@ Move_HYDRO_VORTEX:: waitforvisualfinish restorebg waitbgfadeout - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA waitforvisualfinish end HydroVortexBubbles: @@ -26467,7 +28522,7 @@ Move_BLOOM_DOOM:: loadspritegfx ANIM_TAG_GUST @hurricane loadspritegfx ANIM_TAG_VERTICAL_HEX @hex diamond monbg ANIM_ATTACKER - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish setalpha 12, 8 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x0, 0x4, 0x0 @@ -26529,13 +28584,13 @@ Move_BLOOM_DOOM:: createsprite gAromatherapyBigFlowerSpriteTemplate, ANIM_ATTACKER, 0, 0x10, 0x18, 0x0, 0x2, 0x1, 0x0, 0x0 delay 0x5 createsoundtask SoundTask_LoopSEAdjustPanning, 0xf0, 0xffc0, SOUND_PAN_TARGET, 0x1, 0xf, 0x0, 0x5 - createvisualtask AnimTask_ShakeMon, 0x2, 0x0, 0x0, 0x4, 0x32, 0x1 @ shake attacker + createvisualtask AnimTask_ShakeMon, 2, ANIM_ATTACKER, 0, 4, 50, 1 @ shake attacker call BloomDoomHyperBeam call BloomDoomHyperBeam call BloomDoomHyperBeam call BloomDoomHyperBeam call BloomDoomHyperBeam - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x4, 0x0, 0x72, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 114, 1 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, 0x4, 0x2, 0x0, 0xb, 0x33ed call BloomDoomHyperBeam call BloomDoomHyperBeam @@ -26639,13 +28694,13 @@ BloomDoomPetalBlast: delay 0x2 return ResetFromGreenScreen: - createvisualtask AnimTask_AllBanksInvisible, 0xA + createvisualtask AnimTask_AllBattlersInvisible, 0xA waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BATTLERS, 0x2, 0x0, 0x0, 0x33ED @Everything from green restorebg waitbgfadeout setarg 0x7 0xffff - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA waitbgfadein waitforvisualfinish delay 0x5 @@ -26662,7 +28717,7 @@ Move_GIGAVOLT_HAVOC:: loadspritegfx ANIM_TAG_SPARK_2 loadspritegfx ANIM_TAG_GRAY_SMOKE loadspritegfx ANIM_TAG_THIN_RING - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x6, 0x0, 0x10, 0x0000 playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER @@ -26695,7 +28750,7 @@ Move_GIGAVOLT_HAVOC:: playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER monbg ANIM_ATTACKER playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER -@ createvisualtask AnimTask_ElectricChargingParticles, 0x2, 0x0, 0x3c, 0x2, 0xc @charge particles to user +@ createvisualtask AnimTask_ElectricChargingParticles, 2, ANIM_ATTACKER, 60, 2, 12 @charge particles to user @ createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x0, 0x10, 0x2c, 0x20, 0x28, 0x0, 0x3 createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x0, 0x10, 0x2c, 0x60, 0x28, 0x1, 0x3 @ createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x0, 0x10, 0x2c, 0xa0, 0x28, 0x0, 0x3 @@ -26761,7 +28816,7 @@ Move_GIGAVOLT_HAVOC:: createsprite gElectricPuffSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0xfff0, 0xfff0 delay 0xe clearmonbg ANIM_ATTACKER - createvisualtask AnimTask_HorizontalShake, 0x5, ANIM_TARGET, 0x8, 0x1c @shake target + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 8, 28 @shake target unloadspritegfx ANIM_TAG_HAVOC_SPEAR loadspritegfx ANIM_TAG_SHOCK_3 @thunderbolt createsprite gThunderboltOrbSpriteTemplate, ANIM_TARGET, 3, 0x2c, 0x0, 0x0, 0x3 @@ -26803,7 +28858,7 @@ Move_GIGAVOLT_HAVOC:: waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x10, 0x0, 0x0000 waitforvisualfinish - createvisualtask AnimTask_AllBanksVisible, 0xa + createvisualtask AnimTask_AllBattlersVisible, 0xa waitforvisualfinish end HavocSpearGeyser: @@ -26835,7 +28890,7 @@ Move_SHATTERED_PSYCHE:: loadspritegfx ANIM_TAG_THIN_RING @ring loadspritegfx ANIM_TAG_PINK_PETAL @pink loadspritegfx ANIM_TAG_TORN_METAL @brick break shatter - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPalExclude, 0x5, 0x0, 0x0, 0x0, 0x10, 0x0 waitforvisualfinish @@ -26870,8 +28925,8 @@ Move_SHATTERED_PSYCHE:: createvisualtask AnimTask_BlendBattleAnimPalExclude, 0x5, 0x0, 0x0, 0x10, 0x0, 0x0 delay 0x7 playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER - createvisualtask AnimTask_ShakeMon, 0x2, 0x1, 0x3, 0x0, 0xf, 0x1 - createvisualtask AnimTask_ScaleMonAndRestore, 0x5, 0xfffc, 0xfffc, 0xf, 0x1, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 15, 1 + createvisualtask AnimTask_ScaleMonAndRestore, 5, -4, -4, 15, ANIM_TARGET, 1 waitforvisualfinish ShatteredPsycheCheckBattler: createvisualtask AnimTask_IsTargetPlayerSide, 0x2 @@ -26889,14 +28944,14 @@ ShatteredPsycheFinish: delay 0x8 playsewithpan SE_M_EXPLOSION, SOUND_PAN_TARGET restorebg - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 0xf, 0x1 - createvisualtask AnimTask_ScaleMonAndRestore, 0x5, 0xfffc, 0xfffc, 0xf, 0x1, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 15, 1 + createvisualtask AnimTask_ScaleMonAndRestore, 5, -4, -4, 15, ANIM_TARGET, 1 createsprite gBrickBreakWallShardSpriteTemplate ANIM_TARGET, 2, 0x1, 0x0, 0x0, 0x0 @ -8, -12 createsprite gBrickBreakWallShardSpriteTemplate ANIM_TARGET, 2, 0x1, 0x1, 0x0, 0x0 createsprite gBrickBreakWallShardSpriteTemplate ANIM_TARGET, 2, 0x1, 0x2, 0x0, 0x0 createsprite gBrickBreakWallShardSpriteTemplate ANIM_TARGET, 2, 0x1, 0x3, 0x0, 0x0 waitbgfadeout - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA waitforvisualfinish end ShatteredPsycheFlingOpponent: @@ -26994,7 +29049,7 @@ Move_SUBZERO_SLAMMER:: loadspritegfx ANIM_TAG_ICE_CUBE @glacier loadspritegfx ANIM_TAG_EXPLOSION_2 @explosion createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_EXPLOSION_2, 0x0, 0xC, 0xC, 0x6A23 - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish fadetobg BG_ICE waitbgfadeout @@ -27036,8 +29091,8 @@ SubzeroSlammerFinish: waitplaysewithpan SE_M_HAIL, SOUND_PAN_TARGET, 0x11 waitforvisualfinish call SubzeroSlammerIceSwirl - createvisualtask AnimTask_BlendColorCycle, 0x2, F_PAL_ATTACKER, 0x2, 0x2, 0x0, 0xb, 0x7e80 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x20, 0x1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB(0, 20, 31) + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 call SubzeroSlammerIceSwirl call SubzeroSlammerIceSwirl delay 0xa @@ -27050,7 +29105,7 @@ SubzeroSlammerFinish: call IceBeamCreateCrystals call IceBeamCreateCrystals createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x4, 0x0, 0x7, 0x7e80 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x2, 0x0, 0x19, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 25, 1 call IceBeamCreateCrystals call IceBeamCreateCrystals call IceBeamCreateCrystals @@ -27076,7 +29131,7 @@ SubzeroSlammerFinish: createsprite gBrickBreakWallShardSpriteTemplate ANIM_TARGET, 2, 0x1, 0x1, 0x0, 0x0 createsprite gBrickBreakWallShardSpriteTemplate ANIM_TARGET, 2, 0x1, 0x2, 0x0, 0x0 createsprite gBrickBreakWallShardSpriteTemplate ANIM_TARGET, 2, 0x1, 0x3, 0x0, 0x0 - createvisualtask AnimTask_HorizontalShake, 0x5, ANIM_TARGET, 0x8, 0x1c + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 8, 28 call SubzeroSlammerExplosion call SubzeroSlammerExplosion clearmonbg ANIM_DEF_PARTNER @@ -27085,7 +29140,7 @@ SubzeroSlammerFinish: restorebg waitbgfadeout setarg 0x7 0xffff - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA waitbgfadein waitforvisualfinish end @@ -27148,8 +29203,8 @@ Move_DEVASTATING_DRAKE:: playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER call DevastatingDrakeBuffEffect delay 0x8 - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x2, 0x2, 0x2, 0x0, 0xb, 0x40c0 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x20, 0x1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB(0, 6, 16) + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 call DevastatingDrakeBuffEffect delay 0x8 call DevastatingDrakeBuffEffect @@ -27166,7 +29221,7 @@ Move_DEVASTATING_DRAKE:: fadetobg BG_SKY invisible ANIM_ATTACKER invisible ANIM_TARGET - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitbgfadeout createvisualtask AnimTask_StartSlidingBg, 0x5, 0x0, 0x1000, 0x0, 0xffff waitbgfadein @@ -27206,7 +29261,7 @@ DevastatingDrakeFinish: playsewithpan SE_M_EXPLOSION, SOUND_PAN_ATTACKER loadspritegfx ANIM_TAG_EXPLOSION createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_EXPLOSION, 0x0, 0xC, 0xC, 0x502B - createvisualtask AnimTask_HorizontalShake, 0x5, 0x1, 0x5, 0x35 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 5, 53 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x2, 0x0, 0x10, 0x40c0 @ fade to purple call DevastatingDrakeExplosion delay 0x6 @@ -27225,7 +29280,7 @@ DevastatingDrakeUniversalEnding: createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_FIRE_PLUME, 0x0, 0xC, 0xC, 0x502B createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_VERTICAL_HEX, 0x0, 0xC, 0xC, 0x502B createvisualtask AnimTask_BlendParticle, 0x5, ANIM_TAG_EXPLOSION_2, 0x0, 0xC, 0xC, 0x502B - createvisualtask AnimTask_HorizontalShake, 0x5, 0x1, 0x5, 0x20 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 5, 32 playsewithpan SE_M_EXPLOSION, SOUND_PAN_ATTACKER call DevastatingDrakeGeyser playsewithpan SE_M_SACRED_FIRE, SOUND_PAN_ATTACKER @@ -27267,7 +29322,7 @@ DevastatingDrakeUniversalEnding: waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BATTLERS, 0x2, 0x0, 0x0, 0x0 @ reset all colours waitforvisualfinish - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA waitforvisualfinish end DevastatingDrakeFadeTargetPartner: @@ -27368,13 +29423,13 @@ Move_BLACK_HOLE_ECLIPSE:: loadspritegfx ANIM_TAG_ICE_CHUNK @blue loadspritegfx ANIM_TAG_BLACK_BALL_2 @black invisible ANIM_TARGET - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER call EndureEffect delay 0x8 - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x2, 0x2, 0x2, 0x0, 0xb, 0x0000 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x20, 0x1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB_BLACK + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 call EndureEffect delay 0x8 call EndureEffect @@ -27425,7 +29480,7 @@ Move_BLACK_HOLE_ECLIPSE:: delay 0x2 visible ANIM_TARGET loopsewithpan SE_M_SUPERSONIC, SOUND_PAN_TARGET, 0xa, 0x5 - createvisualtask AnimTask_RotateMonSpriteToSide, 0x2, 0x50, 0xfc00, ANIM_TARGET, 0x0 @ spin target around (0x50 (time), -0x400 (rot speed)) + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 80, -1024, ANIM_TARGET, 0 @ spin target around (0x50 (time), -0x400 (rot speed)) createsprite gBlackHoleEclipseBlueRingInwardsSpriteTemplate, ANIM_ATTACKER, 40, 0x0, 0x0, ANIM_TARGET, 0x0 delay 0x8 createsprite gBlackHoleEclipseRedRingInwardsSpriteTemplate, ANIM_ATTACKER, 40, 0x0, 0x0, ANIM_TARGET, 0x0 @@ -27463,7 +29518,7 @@ Move_BLACK_HOLE_ECLIPSE:: waitforvisualfinish delay 0x18 invisible ANIM_TARGET - createvisualtask AnimTask_RotateMonSpriteToSide, 0x2, 0x1, 0x0, ANIM_TARGET, 0x1 @ fix rotation + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 1, 0, ANIM_TARGET, 1 @ fix rotation invisible ANIM_TARGET delay 0x1 waitforvisualfinish @@ -27487,13 +29542,13 @@ BlackHoleEclipseExplosion: delay 0x6 return ResetFromWhiteScreen: - createvisualtask AnimTask_AllBanksInvisible, 0xA + createvisualtask AnimTask_AllBattlersInvisible, 0xA waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BATTLERS, 0x2, 0x0, 0x0, 0x7FFF @everything from white restorebg waitbgfadeout setarg 0x7 0xffff - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA waitbgfadein waitforvisualfinish delay 0x5 @@ -27506,7 +29561,7 @@ Move_TWINKLE_TACKLE:: loadspritegfx ANIM_TAG_SPARKLE_2 @star loadspritegfx ANIM_TAG_PINK_PETAL @pink loadspritegfx ANIM_TAG_THIN_RING @ring - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish playsewithpan SE_M_MORNING_SUN, SOUND_PAN_ATTACKER call TwinkleTacklePinkStars @@ -27531,10 +29586,10 @@ TwinkleTackleFinish: delay 0x5 visible ANIM_ATTACKER visible ANIM_TARGET - createvisualtask AnimTask_SwayMon, 0x5, 0x0, 0x8, 2048, 1, ANIM_ATTACKER + createvisualtask AnimTask_SwayMon, 5, 0, 8, 2048, 1, ANIM_ATTACKER call TwinkleTackleStars waitforvisualfinish - createvisualtask AnimTask_SwayMon, 0x5, 0x0, 0x8, 2048, 1, ANIM_ATTACKER + createvisualtask AnimTask_SwayMon, 5, 0, 8, 2048, 1, ANIM_ATTACKER call TwinkleTackleStars waitforvisualfinish loadspritegfx ANIM_TAG_SPARKLE_4 @detect @@ -27553,7 +29608,7 @@ TwinkleTackleFinish: delay 0x10 restorebg delay 0x18 - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA waitforvisualfinish end TwinkleTacklePinkStars: @@ -27664,13 +29719,13 @@ Move_CATASTROPIKA:: loadspritegfx ANIM_TAG_FOCUS_ENERGY @focus energy loadspritegfx ANIM_TAG_ROUND_SHADOW @fly invisible ANIM_TARGET - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER call EndureEffect delay 0x8 - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x2, 0x2, 0x2, 0x0, 0xb, 0x5bff - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x20, 0x1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB(31, 31, 22) + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 call EndureEffect delay 0x8 call EndureEffect @@ -27698,7 +29753,7 @@ CatastropikaFinish: loadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT @charge loadspritegfx ANIM_TAG_SPARK_2 @spark playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER - createvisualtask AnimTask_ElectricChargingParticles, 0x2, 0x0, 0x3c, 0x2, 0xc @charge particles to user + createvisualtask AnimTask_ElectricChargingParticles, 2, ANIM_ATTACKER, 60, 2, 12 @charge particles to user createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x10, 0x2c, 0x20, 0x28, 0x0, 0x3 createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x10, 0x2c, 0x60, 0x28, 0x1, 0x3 createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x10, 0x2c, 0xa0, 0x28, 0x0, 0x3 @@ -27814,7 +29869,7 @@ CatastropikaFinish: createvisualtask AnimTask_BlendBattleAnimPal, 0xa, (F_PAL_BG | F_PAL_BATTLERS), 0x4, 0x10, 0x0, 0x7fff @ bg to white createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_TARGET, 0x0, 0x10 @fix tgt position waitforvisualfinish - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA waitforvisualfinish end CatastropikaThundering: @@ -27841,7 +29896,7 @@ Move_10000000_VOLT_THUNDERBOLT:: loadspritegfx ANIM_TAG_SPARK_2 @sparks loadspritegfx ANIM_TAG_LIGHTNING @lightning invisible ANIM_TARGET - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER call EndureEffect @@ -27872,7 +29927,7 @@ Move_10000000_VOLT_THUNDERBOLT:: waitbgfadein visible ANIM_ATTACKER playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER - createvisualtask AnimTask_ElectricChargingParticles, 0x2, 0x0, 0x3c, 0x2, 0xc @charge particles to user + createvisualtask AnimTask_ElectricChargingParticles, 2, ANIM_ATTACKER, 60, 2, 12 @charge particles to user createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x10, 0x2c, 0x20, 0x28, 0x0, 0x3 createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x10, 0x2c, 0x60, 0x28, 0x1, 0x3 createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x10, 0x2c, 0xa0, 0x28, 0x0, 0x3 @@ -27951,16 +30006,16 @@ Move_10000000_VOLT_THUNDERBOLT:: loadspritegfx ANIM_TAG_LEAF @green loadspritegfx ANIM_TAG_POISON_BUBBLE @purple loopsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER, 0x5, 0xA - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_ATTACKER, 0x0, 0x4, 0x32, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_ATTACKER, 0, 4, 50, 1 @ createvisualtask AnimTask_FlashAnimTagWithColor, 0x2, ANIM_TAG_ORBS, 0x1, 0xc, 0x1f, 0x10, 0x0, 0x0 call TenMillionVoltThunderboltBeamRed call TenMillionVoltThunderboltBeamBlue - createvisualtask AnimTask_ShakeMon2, 0x2, ANIM_TARGET, 0x4, 0x0, 0x32, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 50, 1 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x2, 0x0, 0x9, 0x07FE call TenMillionVoltThunderboltBeamPink call TenMillionVoltThunderboltBeamYellow call TenMillionVoltThunderboltBeamGreen - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x4, 0x0, 0x32, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 50, 1 call TenMillionVoltThunderboltBeamPurple call TenMillionVoltThunderboltBeamRed call TenMillionVoltThunderboltBeamBlue @@ -28005,7 +30060,7 @@ Move_10000000_VOLT_THUNDERBOLT:: unloadspritegfx ANIM_TAG_LEAF @green unloadspritegfx ANIM_TAG_POISON_BUBBLE @purple loadspritegfx ANIM_TAG_EXPLOSION @explosion - createvisualtask AnimTask_HorizontalShake, 0x5, ANIM_TARGET, 0x2, 0x2c + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 2, 44 @ createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_TARGET, 4, 0x0, 0x0, 0x30, 0x2c, 0x0, 0x28, 0x0, 0x8003 @ createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_TARGET, 4, 0x0, 0x0, 0x30, 0x2c, 0x40, 0x28, 0x1, 0x8003 @ createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_TARGET, 4, 0x0, 0x0, 0x30, 0x2c, 0x80, 0x28, 0x0, 0x8003 @@ -28021,7 +30076,7 @@ Move_10000000_VOLT_THUNDERBOLT:: delay 0x10 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, (F_PAL_BG | F_PAL_BATTLERS), 0x3, 0x10, 0x0, 0x7fff waitforvisualfinish - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA waitforvisualfinish end TenMillionVoltThunderboltBeamRed: @@ -28102,7 +30157,7 @@ Move_STOKED_SPARKSURFER:: loadspritegfx ANIM_TAG_ROUND_SHADOW @fly loadspritegfx ANIM_TAG_SPARK_2 @spark invisible ANIM_TARGET - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish playsewithpan SE_M_FLY, SOUND_PAN_ATTACKER createsprite gStokedSparksurferFlySpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0xd, 0x150 @@ -28139,8 +30194,8 @@ StokedSparksurferFinish: loadspritegfx ANIM_TAG_ELECTRIC_ORBS @charge loadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT @charge playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER - createvisualtask AnimTask_ElectricChargingParticles, 0x2, 0x0, 0x1c, 0x2, 0xc - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x3c, 0x1 + createvisualtask AnimTask_ElectricChargingParticles, 2, ANIM_ATTACKER, 28, 2, 12 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 60, 1 call EndureEffect delay 0x8 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x5, 0x0, 0x10, 0x5bff @@ -28176,7 +30231,7 @@ StokedSparksurferFinish: unloadspritegfx ANIM_TAG_FOCUS_ENERGY unloadspritegfx ANIM_TAG_ELECTRIC_ORBS unloadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT - createvisualtask AnimTask_HorizontalShake, 0x5, ANIM_TARGET, 0x5, 0x1c + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 5, 28 createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_TARGET, 4, 0x0, 0x0, 0x30, 0x2c, 0x0, 0x28, 0x0, 0x8003 createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_TARGET, 4, 0x0, 0x0, 0x30, 0x2c, 0x40, 0x28, 0x1, 0x8003 createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_TARGET, 4, 0x0, 0x0, 0x30, 0x2c, 0x80, 0x28, 0x0, 0x8003 @@ -28199,7 +30254,7 @@ StokedSparksurferFinish: createvisualtask AnimTask_BlendBattleAnimPal, 0xa, (F_PAL_TARGET | F_PAL_ATTACKER), 0x2, 0x10, 0x0, 0x5bff restorebg delay 0x18 - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA waitforvisualfinish end @@ -28237,8 +30292,8 @@ Move_EXTREME_EVOBOOST:: loadspritegfx ANIM_TAG_LEER @leer createvisualtask AnimTask_BlendBattleAnimPal, 0xa, (F_PAL_BG | F_PAL_BATTLERS), 0x3, 0x0, 0x10, 0x0000 waitforvisualfinish - createvisualtask AnimTask_AllBanksInvisible, 0xA - createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BATTLERS, 3, 0, 0, 0 @;Remove fading on everyone + createvisualtask AnimTask_AllBattlersInvisible, 0xA + createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BATTLERS, 3, 0, 0, 0 @Remove fading on everyone waitforvisualfinish playsewithpan SE_M_DETECT, SOUND_PAN_ATTACKER createsprite gLeerSpriteTemplate, ANIM_ATTACKER, 2, 0x18, 0xfff4 @@ -28377,7 +30432,7 @@ Move_PULVERIZING_PANCAKE:: loadspritegfx ANIM_TAG_MUD_SAND @dig loadspritegfx ANIM_TAG_IMPACT @hit loadspritegfx ANIM_TAG_QUICK_GUARD_HAND @black colour - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish createvisualtask AnimTask_IsTargetPlayerSide, 0x2 jumpargeq 0x7 ANIM_TARGET PulverizingPancakeOnPlayer @@ -28392,7 +30447,7 @@ PulverizingPancakeFinish: waitforvisualfinish fadetobg BG_SOLAR_BEAM_OPPONENT waitbgfadeout - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_ATTACKER, 0x0, 0x2, 0x32, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 0, 2, 50, 1 call PulverizingPancakeDiggingRun call PulverizingPancakeDiggingRun call PulverizingPancakeDiggingRun @@ -28442,7 +30497,7 @@ PulverizingPancakeFinish: playsewithpan SE_M_EXPLOSION, SOUND_PAN_ATTACKER createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x0, 0x1, 0x0 @big hit marker delay 0x0 - createvisualtask AnimTask_HorizontalShake, 0x5, ANIM_TARGET, 0x4, 0x2c + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 4, 44 createsprite gPulverizingPancakeYellowRingSpriteTemplate, ANIM_TARGET, 3, 0x0, 0x0, 0x100, 0x0 delay 0x5 loadspritegfx ANIM_TAG_EXPLOSION @explosion @@ -28489,7 +30544,7 @@ Move_GENESIS_SUPERNOVA:: loadspritegfx ANIM_TAG_BLUE_ORB @reversal loadspritegfx ANIM_TAG_POISON_BUBBLE @poison bubble loadspritegfx ANIM_TAG_POISON_JAB @purple - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish call SetPsychicBackground loadspritegfx ANIM_TAG_FOCUS_ENERGY @focus energy @@ -28499,14 +30554,14 @@ Move_GENESIS_SUPERNOVA:: GenesisSupernovaOnOpponent: call GenesisSupernovaBuffEffectPlayer_1 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x2, 0x0, 0xb, 0xd87c - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x70, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 112, 1 call GenesisSupernovaBuffEffectPlayer_2 call GenesisSupernovaBuffEffectPlayer_1 goto GenesisSupernovaFinish GenesisSupernovaOnPlayer: call GenesisSupernovaBuffOpponent_1 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_ATTACKER, 0x2, 0x0, 0xb, 0xd87c - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x70, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 112, 1 call GenesisSupernovaBuffOpponent_2 call GenesisSupernovaBuffOpponent_1 GenesisSupernovaFinish: @@ -28677,7 +30732,7 @@ Move_SINISTER_ARROW_RAID:: loadspritegfx ANIM_TAG_SPIRIT_ARROW @arrow loadspritegfx ANIM_TAG_LEAF @green invisible ANIM_TARGET - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish playsewithpan SE_M_FLY, SOUND_PAN_ATTACKER createsprite gArrowRaidFlyUpSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0xd, 0x150 @@ -28749,7 +30804,7 @@ SinisterArrowRaidOnOpponent: createsprite gArrowRaidRightDownSpriteTemplate, ANIM_ATTACKER, 50, 0xfff0, 0x08, 0x100, 0xf, 0x15 waitforvisualfinish call SinisterArrowRaidFlyStrike - createvisualtask AnimTask_HorizontalShake, 0x5, ANIM_TARGET, 0x3, 0x4b + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 3, 75 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x4, 0x0, 0x10, 0x40c0 @ defender to purple call SinisterArrowRaidStrikeOpponent call SinisterArrowRaidOpponentExplosion @@ -28801,7 +30856,7 @@ SinisterArrowRaidOnPlayer: createsprite gArrowRaidLeftDownSpriteTemplate, ANIM_ATTACKER, 50, 0x100, 0x88, 0xfff0, 0x38, 0x15 waitforvisualfinish call SinisterArrowRaidFlyStrike - createvisualtask AnimTask_HorizontalShake, 0x5, ANIM_TARGET, 0x3, 0x4b + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 3, 75 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x4, 0x0, 0x10, 0x40c0 @ defender to purple call SinisterArrowRaidArrowsStrikePlayer call SinisterArrowRaidPlayerExplosion @@ -28814,7 +30869,7 @@ SinisterArrowRaidFinish: waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x10, 0x00, 0x388C @ bg to nrml delay 0x5 - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA waitforvisualfinish end SinisterArrowRaidFlyStrike: @@ -29008,7 +31063,7 @@ Move_MALICIOUS_MOONSAULT:: call MaliciousMoonsaultFireSpin call MaliciousMoonsaultFireSpin clearmonbg ANIM_ATTACKER - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish playsewithpan SE_M_FLY, SOUND_PAN_ATTACKER createsprite gMaliciousMoonsaultRedFlySpriteTemplate, ANIM_TARGET, 2, 0x0, 0x0, 0xd, 0x150 @@ -29101,7 +31156,7 @@ MaliciousMoonsaultExplosion: Move_OCEANIC_OPERETTA:: - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish loadspritegfx ANIM_TAG_SPOTLIGHT createvisualtask AnimTask_CreateSpotlight, 0x2 @@ -29113,8 +31168,8 @@ Move_OCEANIC_OPERETTA:: playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER call OceanicOperettaBuffEffect delay 0x8 - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x2, 0x2, 0x2, 0x0, 0xb, 0x7fff - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x20, 0x1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB_WHITE + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 call OceanicOperettaBuffEffect delay 0x8 call OceanicOperettaBuffEffect @@ -29131,7 +31186,7 @@ Move_OCEANIC_OPERETTA:: invisible ANIM_ATTACKER createsprite gOceanOperaBlueChargeSpriteTemplate, ANIM_ATTACKER, 2, 0x0 @charge delay 0x2 - createvisualtask AnimTask_ShakeMon, 0x5, ANIM_ATTACKER, 0x0, 0x2, 0x50, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 0, 2, 80, 1 createsprite gWhirlpoolSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x1c, 0x180, 0x32, 0x8, 0x32, ANIM_ATTACKER createsprite gOceanOperaBlueRingSpriteTemplate, ANIM_ATTACKER, 40, 0x0, 0x0, 0x0, 0x0 delay 0x2 @@ -29238,7 +31293,7 @@ Move_OCEANIC_OPERETTA:: loadspritegfx ANIM_TAG_EXPLOSION @explosion loadspritegfx ANIM_TAG_SPARKLE_2 @sparkle loadspritegfx ANIM_TAG_RAIN_DROPS @rain - createvisualtask AnimTask_HorizontalShake, 0x5, ANIM_TARGET, 0x8, 0x40 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 8, 64 call OceanicOperettaExplosion createvisualtask AnimTask_BlendBattleAnimPal, 0x2, F_PAL_TARGET, 0x2, 0x0, 0xb, 0x5da0 createvisualtask AnimTask_CreateRaindrops, 0x2, 0x0, 0x3, 0x78 @@ -29251,7 +31306,7 @@ Move_OCEANIC_OPERETTA:: waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x1, 0x6, 0x0, 0x5da0 waitforvisualfinish - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA waitforvisualfinish end OceanicOperettaBuffEffect: @@ -29289,7 +31344,7 @@ OceanicOperettaExplosion: Move_SPLINTERED_STORMSHARDS:: loadspritegfx ANIM_TAG_ROCKS @rock loadspritegfx ANIM_TAG_ICICLE_SPEAR @spear - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish createvisualtask AnimTask_GetLycanrocForm, 0x2 jumpargeq 0x0 0x1 SplinteredStormshardsNightForme @@ -29317,8 +31372,8 @@ SplinteredStormshardsByPlayer: visible ANIM_ATTACKER delay 0x1 createsprite gSplinteredShardsRisingSpearSpriteTemplate, ANIM_ATTACKER, 50, 0x60, 0x80, 0x60, 0x30, 0x30 - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x2, 0x2, 0x2, 0x0, 0xb, 0x5bff - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x20, 0x1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB(31, 31, 22) + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 delay 0x2 call SplinteredStormshardsPlayer_Rising2 call SplinteredStormshardsPlayer_Rising1 @@ -29334,7 +31389,7 @@ SplinteredStormshardsByPlayer: delay 0x2 invisible ANIM_ATTACKER createsprite gGrowingSuperpowerTemplate, ANIM_TARGET, 3, 0x0 @superpower - createvisualtask AnimTask_ShakeMon, 0x5, 0x1, 0x0, 0x4, 0x60, 0x1 @shake target up and down + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 4, 96, 1 @shake target up and down createsprite gSplinteredShardsSplinterOpponentSteepSpriteTemplate, ANIM_ATTACKER, 2, 0xffd0, 0x18, 0x0, 0x0, 0xa, 0x1, 0x0, 0x1 delay 0x4 playsewithpan SE_M_ROCK_THROW, SOUND_PAN_TARGET @@ -29351,7 +31406,7 @@ SplinteredStormshardsEnd: waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, (F_PAL_BG | F_PAL_BATTLERS), 0x4, 0x10, 0x0, 0x7fff waitforvisualfinish - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA waitforvisualfinish waitforvisualfinish end @@ -29399,8 +31454,8 @@ SplinteredStormshardsByOpponent: visible ANIM_ATTACKER delay 0x1 createsprite gSplinteredShardsRisingSpearSpriteTemplate, ANIM_ATTACKER, 50, 0xd0, 0x40, 0xd0, 0x0, 0x30 - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x2, 0x2, 0x2, 0x0, 0xb, 0x5bff - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x20, 0x1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB(31, 31, 22) + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 delay 0x2 call SplinteredStormshardsOpponent_Rising2 call SplinteredStormshardsOpponent_Rising1 @@ -29417,7 +31472,7 @@ SplinteredStormshardsByOpponent: delay 0x2 invisible ANIM_ATTACKER createsprite gGrowingSuperpowerTemplate, ANIM_TARGET, 3, 0x0 @superpower - createvisualtask AnimTask_ShakeMon, 0x5, 0x1, 0x0, 0x4, 0x60, 0x1 @shake target up and down + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 4, 96, 1 @shake target up and down createsprite gSplinteredShardsSplinterPlayerShallowSpriteTemplate, ANIM_TARGET, 2, 0xffd0, 0x18, 0x0, 0x0, 0xa, 0x1, 0x0, 0x1 delay 0x4 playsewithpan SE_M_ROCK_THROW, SOUND_PAN_TARGET @@ -29550,9 +31605,9 @@ Move_LETS_SNUGGLE_FOREVER:: loadspritegfx ANIM_TAG_MUSIC_NOTES @music note loadspritegfx ANIM_TAG_SMALL_BUBBLES @fake tears loadspritegfx ANIM_TAG_VERTICAL_HEX @red - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish - createvisualtask AnimTask_RockMonBackAndForth, 0x5, 0x0, 0x2, 0x0 + createvisualtask AnimTask_RockMonBackAndForth, 5, ANIM_ATTACKER, 2, 0 createsprite gSnuggleForeverHeartSpriteTemplate, ANIM_ATTACKER, 3, 0x0, 0x14 playsewithpan SE_M_CHARM, SOUND_PAN_ATTACKER createsprite gSlowFlyingMusicNotesSpriteTemplate, ANIM_ATTACKER, 2, 0x1, 0x1, 0x1, 0x0 @@ -29586,7 +31641,7 @@ Move_LETS_SNUGGLE_FOREVER:: createvisualtask AnimTask_SnatchOpposingMonMove, 0x2 delay 0x10 playsewithpan SE_M_FAINT_ATTACK, SOUND_PAN_ATTACKER - createvisualtask AnimTask_ShakeMon, 0x5, 0x1, 0x0, 0x2, 0x32, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 2, 50, 1 call LetsSnuggleForeverTears delay 0x8 call LetsSnuggleForeverTears @@ -29681,7 +31736,7 @@ Move_CLANGOROUS_SOULBLAZE:: loadspritegfx ANIM_TAG_SPARKLE_2 @stars fadetobg BG_CLANGOROUS_SOULBLAZE waitbgfadein - createvisualtask AnimTask_RockMonBackAndForth, 0x5, 0x0, 0x2, 0x0 + createvisualtask AnimTask_RockMonBackAndForth, 5, ANIM_ATTACKER, 2, 0 call ClangorousSoulblazeBuffEffect call ClangorousSoulblazeBuffEffect call ClangorousSoulblazeBuffEffect @@ -29736,8 +31791,8 @@ Move_CLANGOROUS_SOULBLAZE:: createsprite gClangoorousSoulblazePulseSpriteTemplate, ANIM_ATTACKER, 2, 0x10, 0x0, 0x0, 0x0, 0x1d, 0x0 createsprite gSlowFlyingMusicNotesSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 0x0, 0x0 @music note delay 0x5 - createvisualtask AnimTask_HorizontalShake, 0x5, ANIM_TARGET, 0x2, 0x3c - createvisualtask AnimTask_HorizontalShake, 0x5, ANIM_DEF_PARTNER, 0x2, 0x3c + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 2, 60 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_DEF_PARTNER, 2, 60 call ClangorousSoulblazePulse_1 delay 0x5 call ClangorousSoulblazePulse_2 @@ -29961,7 +32016,7 @@ Move_GUARDIAN_OF_ALOLA:: loadspritegfx ANIM_TAG_THIN_RING @ring loadspritegfx ANIM_TAG_MUD_SAND @dig loadspritegfx ANIM_TAG_SPEED_DUST @extremespeed - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish createsprite gThinRingExpandingSpriteTemplate, ANIM_ATTACKER, 3, 0x0, 0x0, 0x0, 0x0 playsewithpan SE_SHINY, SOUND_PAN_ATTACKER @@ -30000,14 +32055,14 @@ Move_GUARDIAN_OF_ALOLA:: fadetobg BG_FISSURE waitbgfadeout call GuardianOfAlolaRocksPlayer - createvisualtask AnimTask_PositionFissureBgOnBattler, 0x5, 0x1, 0x5, 0xffff + createvisualtask AnimTask_PositionFissureBgOnBattler, 5, ANIM_TARGET, 5, -1 waitbgfadein playsewithpan SE_M_DOUBLE_TEAM, SOUND_PAN_TARGET createsprite gGuardianOfAlolaFistSpriteTemplate, ANIM_TARGET, 3, 0x0, 0xffd0, 0x1f delay 0x24 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x0, 0xb, 0x0, 0x0000 playsewithpan SE_M_EXPLOSION, SOUND_PAN_TARGET - createvisualtask AnimTask_HorizontalShake, 0x3, ANIM_TARGET, 0xa, 0x25 + createvisualtask AnimTask_HorizontalShake, 3, ANIM_TARGET, 10, 0x25 loopsewithpan SE_M_ROCK_THROW SOUND_PAN_TARGET 0x10 0x9 call GuardianOfAlolaRocksTarget call GuardianOfAlolaRockGeyser @@ -30059,15 +32114,15 @@ Move_SEARING_SUNRAZE_SMASH:: loadspritegfx ANIM_TAG_FOCUS_ENERGY @focus energy loadspritegfx ANIM_TAG_SPARKLE_2 @sparkles invisible ANIM_TARGET - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x0, 0x0, 0xe, 0x001b playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER call SearingSunrazeSmashFlare delay 0x8 playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x2, 0x2, 0x2, 0x0, 0xb, 0x7fff - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x20, 0x1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB_WHITE + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 call SearingSunrazeSmashFlare delay 0x8 call SearingSunrazeSmashFlare @@ -30085,7 +32140,7 @@ Move_SEARING_SUNRAZE_SMASH:: delay 0x2 loadspritegfx ANIM_TAG_METEOR @superpower visible ANIM_TARGET - createvisualtask AnimTask_RotateMonSpriteToSide, 0x2, 0x50, 0xfc00, ANIM_TARGET, 0x0 @ spin up target + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 80, -1024, ANIM_TARGET, 0 @ spin up target call SearingSunrazeSmashRingsInward createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_TARGET, 0x0, 0x30 @ target back to origin (slowly) call SearingSunrazeSmashRingsInward @@ -30106,7 +32161,7 @@ Move_SEARING_SUNRAZE_SMASH:: fadetobg BG_COSMIC waitbgfadeout createvisualtask AnimTask_StartSlidingBg, 0x5, 0xf700, 0x0, 0x1, 0xffff - createvisualtask AnimTask_RotateMonSpriteToSide, 0x2, 0x1, 0x0, ANIM_TARGET, 0x1 @ fix tgt rotation + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 1, 0, ANIM_TARGET, 1 @ fix tgt rotation invisible ANIM_TARGET waitbgfadein visible ANIM_ATTACKER @@ -30153,7 +32208,7 @@ SearingSunrazeSmashImpact: delay 0x8 delay 0x1 unloadspritegfx ANIM_TAG_GOLD_RING @beam - createvisualtask AnimTask_HorizontalShake, 0x5, ANIM_TARGET, 0x4, 0x3c + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 4, 60 playsewithpan SE_M_CUT, SOUND_PAN_TARGET createsprite gSearingSunrazeSmashWhiteCutSpriteTemplate, ANIM_TARGET, 2, 0x20, 0xffe0, 0x0 delay 0x2 @@ -30271,13 +32326,13 @@ SearingSunrazeSmashCharge: delay 0x1 return ResetFromRedScreen: - createvisualtask AnimTask_AllBanksInvisible, 0xA + createvisualtask AnimTask_AllBattlersInvisible, 0xA waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BATTLERS, 0x2, 0x0, 0x0, 0x1B @Everything from red restorebg waitbgfadeout setarg 0x7 0xffff - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA waitbgfadein createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x0, 0x0, 0x0, 0x33ED waitforvisualfinish @@ -30291,14 +32346,14 @@ Move_MENACING_MOONRAZE_MAELSTROM:: loadspritegfx ANIM_TAG_SHADOW_BALL @shadow ball loadspritegfx ANIM_TAG_HANDS_AND_FEET @black invisible ANIM_TARGET - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BG, 0x0, 0x0, 0xe, 0x40c0 playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER call MenacingMoonrazeMaelstromFlare delay 0x8 - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x2, 0x2, 0x2, 0x0, 0xc, 0x0000 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x20, 0x1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 12, RGB_BLACK + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 call MenacingMoonrazeMaelstromFlare playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER delay 0x8 @@ -30314,7 +32369,7 @@ Move_MENACING_MOONRAZE_MAELSTROM:: delay 0x2 loadspritegfx ANIM_TAG_METEOR @superpower visible ANIM_TARGET - createvisualtask AnimTask_RotateMonSpriteToSide, 0x2, 0x50, 0xfc00, ANIM_TARGET, 0x0 @ spin up target + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 80, -1024, ANIM_TARGET, 0 @ spin up target call MenacingMoonrazeMaelstromRingsInward createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, ANIM_TARGET, 0x0, 0x30 @ target back to origin (slowly) call MenacingMoonrazeMaelstromRingsInward @@ -30342,7 +32397,7 @@ MenacingMoonrazeMaelstromOnOpponent: MenacingMoonrazeMaelstromOnPlayer: createvisualtask AnimTask_StartSlidingBg, 0x5, 0x200, 0xfd00, 0x1, 0xffff MenacingMoonrazeMaelstromFinish: - createvisualtask AnimTask_RotateMonSpriteToSide, 0x2, 0x1, 0x0, ANIM_TARGET, 0x1 @ fix tgt rotation + createvisualtask AnimTask_RotateMonSpriteToSide, 2, 1, 0, ANIM_TARGET, 1 @ fix tgt rotation invisible ANIM_TARGET waitbgfadein visible ANIM_ATTACKER @@ -30357,8 +32412,8 @@ MenacingMoonrazeMaelstromFinish: unloadspritegfx ANIM_TAG_METEOR @superpower playsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER call MenacingMoonrazeMaelstromChargeUp - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x2, 0x2, 0x2, 0x0, 0xc, 0x0000 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x20, 0x1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 12, RGB_BLACK + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 call MenacingMoonrazeMaelstromChargeUp call MenacingMoonrazeMaelstromChargeUp createsoundtask SoundTask_LoopSEAdjustPanning, 0xf0, 0xffc0, SOUND_PAN_TARGET, 0x1, 0xf, 0x0, 0x5 @@ -30367,7 +32422,7 @@ MenacingMoonrazeMaelstromFinish: call MenacingMoonrazeMaelstromBeam call MenacingMoonrazeMaelstromBeam call MenacingMoonrazeMaelstromBeam - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x4, 0x0, 0x3c, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 60, 1 createvisualtask AnimTask_BlendBattleAnimPal, 0x2, F_PAL_TARGET, 0x4, 0x0, 0xc, 0x0000 call MenacingMoonrazeMaelstromBeam call MenacingMoonrazeMaelstromBeam @@ -30400,7 +32455,7 @@ MenacingMoonrazeMaelstromFinish: unloadspritegfx ANIM_TAG_ORBS @hyper beam unloadspritegfx ANIM_TAG_HANDS_AND_FEET @black loadspritegfx ANIM_TAG_EXPLOSION_2 @explosion - createvisualtask AnimTask_ShakeMon2, 0x2, 0x1, 0x4, 0x0, 0x4c, 0x1 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 76, 1 call MenacingMoonrazeMaelstromExplosion call MenacingMoonrazeMaelstromExplosion createvisualtask AnimTask_BlendBattleAnimPal, 0x2, (F_PAL_BG | F_PAL_BATTLERS), 0x2, 0x0, 0x10, 0x7fff @@ -30486,8 +32541,8 @@ Move_LIGHT_THAT_BURNS_THE_SKY:: playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER call EndureEffect delay 0x8 - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x2, 0x2, 0x2, 0x0, 0xb, 0x5bff - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x20, 0x1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB(31, 31, 22) + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 call EndureEffect delay 0x8 call EndureEffect @@ -30497,7 +32552,7 @@ Move_LIGHT_THAT_BURNS_THE_SKY:: setalpha 12, 8 createvisualtask AnimTask_BlendBattleAnimPal, 0xa, (F_PAL_BG | F_PAL_ADJACENT), 0x2, 0x0, 0xF, 0x0000 waitforvisualfinish - createvisualtask AnimTask_ElectricChargingParticles, 0x2, 0x0, 0x3c, 0x2, 0xc @ charge particles to attacker + createvisualtask AnimTask_ElectricChargingParticles, 2, ANIM_ATTACKER, 60, 2, 12 @ charge particles to attacker delay 0x1e loopsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER, 0xe, 0xa createsprite gSuperpowerOrbSpriteTemplate, ANIM_TARGET, 3, 0x0 @@ -30530,7 +32585,7 @@ Move_LIGHT_THAT_BURNS_THE_SKY:: createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_ATTACKER, 2, 0xffc0, 0xffd8, 0x25, 0x2c, 0xa0, 0x8, 0x0, 0x3 createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_ATTACKER, 2, 0xffc0, 0xffd8, 0x25, 0x2c, 0xe0, 0x8, 0x2, 0x3 delay 0x6 - createvisualtask AnimTask_HorizontalShake, 0x5, ANIM_TARGET, 0x3, 0x3c + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 3, 60 unloadspritegfx ANIM_TAG_LEAF @green unloadspritegfx ANIM_TAG_ELECTRIC_ORBS @charge loadspritegfx ANIM_TAG_FIRE_PLUME @blast burn @@ -30639,7 +32694,7 @@ Move_SOUL_STEALING_7_STAR_STRIKE:: loadspritegfx ANIM_TAG_WISP_FIRE @will o wisp loadspritegfx ANIM_TAG_FIRE_PLUME @blast burn loadspritegfx ANIM_TAG_HANDS_AND_FEET @fist - createvisualtask AnimTask_AllBanksInvisibleExceptAttackerAndTarget, 0xA + createvisualtask AnimTask_AllBattlersInvisibleExceptAttackerAndTarget, 0xA waitforvisualfinish setalpha 12, 8 playsewithpan SE_M_FLAME_WHEEL2, SOUND_PAN_TARGET @@ -30663,8 +32718,8 @@ Move_SOUL_STEALING_7_STAR_STRIKE:: playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER call SoulStealingSevenStarStrikeBuffEffect delay 0x8 - createvisualtask AnimTask_BlendColorCycle, 0x2, 0x2, 0x2, 0x2, 0x0, 0xb, 0x0 - createvisualtask AnimTask_ShakeMon2, 0x2, 0x0, 0x1, 0x0, 0x20, 0x1 + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB_BLACK + createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 call SoulStealingSevenStarStrikeBuffEffect delay 0x8 call SoulStealingSevenStarStrikeBuffEffect @@ -30673,7 +32728,7 @@ Move_SOUL_STEALING_7_STAR_STRIKE:: waitforvisualfinish unloadspritegfx ANIM_TAG_FIRE_PLUME loadspritegfx ANIM_TAG_PAIN_SPLIT @pain split - createvisualtask AnimTask_ShakeMon, 0x5, 0x1, 0x0, 0x4, 0x25, 0x1 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 4, 37, 1 createsprite gSoulStealBlueFistSpriteTemplate, ANIM_TARGET, 2, 0xffc0, 0x14, 0x0, 0x0, 0xa, 0x1, 0x0, 0x1 delay 0x4 createsprite gSoulStealBlueStarSpriteTemplate, ANIM_TARGET, 4, 0x0, ANIM_TARGET, 0x2, 0x0, 0x0, 0x30 @@ -30726,7 +32781,7 @@ Move_SOUL_STEALING_7_STAR_STRIKE:: createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_TARGET, 0x0, 0x0, 0x10, 0x0000 delay 0x1 createsprite gSoulStealZStarSpriteTemplate, ANIM_TARGET, 2, 0x0, 0x0, 0x1, 0x24 - createvisualtask AnimTask_ShakeMon, 0x2, ANIM_TARGET, 0x3, 0x0, 0x6, 0x1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 createsprite gWillOWispFireSpriteTemplate, ANIM_TARGET, 2, 0x0 createsprite gWillOWispFireSpriteTemplate, ANIM_TARGET, 2, 0x2a createsprite gWillOWispFireSpriteTemplate, ANIM_TARGET, 2, 0x54 @@ -30744,7 +32799,7 @@ Move_SOUL_STEALING_7_STAR_STRIKE:: playsewithpan SE_M_DETECT, SOUND_PAN_ATTACKER createsprite gTargetTwinkleSpriteTemplate, ANIM_TARGET, 13, 0x0, 0x0, ANIM_TARGET @detect star delay 0xa - createvisualtask AnimTask_HorizontalShake, 0x5, ANIM_TARGET, 0x8, 0x20 + createvisualtask AnimTask_HorizontalShake, 5, ANIM_TARGET, 8, 32 call SoulStealingSevenStarStrikeExplosion call SoulStealingSevenStarStrikeExplosion createvisualtask AnimTask_BlendBattleAnimPal, 0xa, (F_PAL_BG | F_PAL_ALL_BUT_DEF), 0x2, 0x0, 0x10, 0x0 @everything to black @@ -30756,7 +32811,7 @@ Move_SOUL_STEALING_7_STAR_STRIKE:: waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPal, 0xa, F_PAL_BATTLERS, 0x2, 0x0, 0x0, 0x0 waitforvisualfinish - createvisualtask AnimTask_AllBanksVisible, 0xA + createvisualtask AnimTask_AllBattlersVisible, 0xA waitforvisualfinish end SoulStealingSevenStarStrikeBuffEffect: diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 62d619f9f0ba..d03e37085cfe 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -165,11 +165,9 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectPsychUp @ EFFECT_PSYCH_UP .4byte BattleScript_EffectMirrorCoat @ EFFECT_MIRROR_COAT .4byte BattleScript_EffectSkullBash @ EFFECT_SKULL_BASH - .4byte BattleScript_EffectTwister @ EFFECT_TWISTER .4byte BattleScript_EffectEarthquake @ EFFECT_EARTHQUAKE .4byte BattleScript_EffectFutureSight @ EFFECT_FUTURE_SIGHT .4byte BattleScript_EffectGust @ EFFECT_GUST - .4byte BattleScript_EffectStomp @ EFFECT_FLINCH_MINIMIZE_HIT .4byte BattleScript_EffectSolarBeam @ EFFECT_SOLAR_BEAM .4byte BattleScript_EffectThunder @ EFFECT_THUNDER .4byte BattleScript_EffectTeleport @ EFFECT_TELEPORT @@ -427,6 +425,109 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectRevivalBlessing @ EFFECT_REVIVAL_BLESSING .4byte BattleScript_EffectFrostbiteHit @ EFFECT_FROSTBITE_HIT .4byte BattleScript_EffectSnow @ EFFECT_SNOWSCAPE + .4byte BattleScript_EffectTripleArrows @ EFFECT_TRIPLE_ARROWS + .4byte BattleScript_EffectInfernalParade @ EFFECT_INFERNAL_PARADE + .4byte BattleScript_EffectTakeHeart @ EFFECT_TAKE_HEART + .4byte BattleScript_EffectAxeKick @ EFFECT_AXE_KICK + .4byte BattleScript_EffectHit @ EFFECT_COLLISION_COURSE + .4byte BattleScript_EffectSpinOut @ EFFECT_SPIN_OUT + .4byte BattleScript_EffectMakeItRain @ EFFECT_MAKE_IT_RAIN + .4byte BattleScript_EffectCorrosiveGas @ EFFECT_CORROSIVE_GAS + .4byte BattleScript_EffectHit @ EFFECT_POPULATION_BOMB + .4byte BattleScript_EffectMortalSpin @ EFFECT_MORTAL_SPIN + .4byte BattleScript_EffectHit @ EFFECT_GIGATON_HAMMER + .4byte BattleScript_EffectSaltCure @ EFFECT_SALT_CURE + +BattleScript_EffectSaltCure: + call BattleScript_EffectHit_Ret + jumpiffainted BS_TARGET, TRUE, BattleScript_EffectSaltCure_End + applysaltcure BS_TARGET + printstring STRINGID_TARGETISBEINGSALTCURED + waitmessage B_WAIT_TIME_LONG +BattleScript_EffectSaltCure_End: + goto BattleScript_MoveEnd + +BattleScript_SaltCureExtraDamage:: + playanimation BS_TARGET, B_ANIM_SALT_CURE_DAMAGE, NULL + waitanimation + call BattleScript_HurtTarget_NoString + printstring STRINGID_TARGETISHURTBYSALTCURE + waitmessage B_WAIT_TIME_LONG + end2 + +BattleScript_HurtTarget_NoString: + orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE + healthbarupdate BS_TARGET + datahpupdate BS_TARGET + tryfaintmon BS_TARGET + return + +BattleScript_EffectMortalSpin: + call BattleScript_EffectHit_Ret + rapidspinfree + setmoveeffect MOVE_EFFECT_POISON + seteffectwithchance + tryfaintmon BS_TARGET + moveendall + end + +BattleScript_EffectCorrosiveGas: + attackcanceler + accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE + attackstring + ppreduce + jumpifsubstituteblocks BattleScript_CorrosiveGasFail + jumpifcantloseitem BS_TARGET, BattleScript_CorrosiveGasFail + attackanimation + waitanimation + jumpifability BS_TARGET, ABILITY_STICKY_HOLD, BattleScript_StickyHoldActivates + setlastuseditem BS_TARGET + removeitem BS_TARGET + printstring STRINGID_PKMNITEMMELTED + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd + +BattleScript_CorrosiveGasFail: + pause B_WAIT_TIME_SHORT + orhalfword gMoveResultFlags, MOVE_RESULT_FAILED + printstring STRINGID_NOEFFECTONTARGET + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd + +BattleScript_EffectMakeItRain: + setmoveeffect MOVE_EFFECT_PAYDAY + call BattleScript_EffectHit_Ret + seteffectwithchance + tryfaintmon BS_TARGET + setmoveeffect MOVE_EFFECT_SP_ATK_MINUS_1 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN + seteffectprimary + goto BattleScript_MoveEnd + +BattleScript_EffectSpinOut:: + setmoveeffect MOVE_EFFECT_SPD_MINUS_2 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN + goto BattleScript_EffectHit + +BattleScript_EffectAxeKick:: + setmoveeffect MOVE_EFFECT_CONFUSION + goto BattleScript_EffectRecoilIfMiss + +BattleScript_EffectTakeHeart:: + attackcanceler + attackstring + ppreduce + cureifburnedparalysedorpoisoned BattleScript_CalmMindTryToRaiseStats + attackanimation + waitanimation + updatestatusicon BS_ATTACKER + printstring STRINGID_PKMNSTATUSNORMAL + waitmessage B_WAIT_TIME_LONG + jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPATK, MAX_STAT_STAGE, BattleScript_CalmMindStatRaise + jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPDEF, MAX_STAT_STAGE, BattleScript_CalmMindStatRaise + goto BattleScript_CantRaiseMultipleStats + +BattleScript_EffectTripleArrows:: + setmoveeffect MOVE_EFFECT_TRIPLE_ARROWS + goto BattleScript_EffectHit BattleScript_EffectRevivalBlessing:: attackcanceler @@ -511,11 +612,12 @@ BattleScript_EffectTeatime:: @ at least one battler is affected attackanimation waitanimation + setbyte gBattlerTarget, 0 BattleScript_TeatimeLoop: - jumpifteainvulnerable BS_TARGET, BattleScript_Teatimevul jumpifrodaffected BS_TARGET, BattleScript_Teatimerod jumpifabsorbaffected BS_TARGET, BattleScript_Teatimesorb jumpifmotoraffected BS_TARGET, BattleScript_Teatimemotor + jumpifteainvulnerable BS_TARGET, BattleScript_Teatimevul @ in semi-invulnerable state OR held item is not a Berry orword gHitMarker, HITMARKER_NO_ANIMATIONS | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_IGNORE_DISGUISE setbyte sBERRY_OVERRIDE, TRUE @ override the requirements for eating berries consumeberry BS_TARGET, TRUE @ consume the berry, then restore the item from changedItems @@ -533,6 +635,12 @@ BattleScript_Teatimevul: goto BattleScript_MoveEnd BattleScript_Teatimesorb: call BattleScript_AbilityPopUpTarget + tryhealquarterhealth BS_TARGET BattleScript_Teatimesorb_end + healthbarupdate BS_TARGET + datahpupdate BS_TARGET + printstring STRINGID_PKMNREGAINEDHEALTH + waitmessage B_WAIT_TIME_LONG +BattleScript_Teatimesorb_end: moveendto MOVEEND_NEXT_TARGET jumpifnexttargetvalid BattleScript_TeatimeLoop moveendcase MOVEEND_CLEAR_BITS @@ -1035,24 +1143,7 @@ BattleScript_HyperspaceFuryRemoveProtect:: return BattleScript_EffectPlasmaFists: - attackcanceler - accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE - attackstring - ppreduce - critcalc - damagecalc - adjustdamage - attackanimation - waitanimation - effectivenesssound - hitanimation BS_TARGET - waitstate - healthbarupdate BS_TARGET - datahpupdate BS_TARGET - critmessage - waitmessage B_WAIT_TIME_LONG - resultmessage - waitmessage B_WAIT_TIME_LONG + call BattleScript_EffectHit_Ret seteffectwithchance tryfaintmon BS_TARGET applyplasmafists @@ -1061,24 +1152,7 @@ BattleScript_EffectPlasmaFists: goto BattleScript_MoveEnd BattleScript_EffectSparklySwirl: - attackcanceler - accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE - attackstring - ppreduce - critcalc - damagecalc - adjustdamage - attackanimation - waitanimation - effectivenesssound - hitanimation BS_TARGET - waitstate - healthbarupdate BS_TARGET - datahpupdate BS_TARGET - critmessage - waitmessage B_WAIT_TIME_LONG - resultmessage - waitmessage B_WAIT_TIME_LONG + call BattleScript_EffectHit_Ret tryfaintmon BS_TARGET healpartystatus waitstate @@ -1087,24 +1161,7 @@ BattleScript_EffectSparklySwirl: goto BattleScript_MoveEnd BattleScript_EffectFreezyFrost: - attackcanceler - accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE - attackstring - ppreduce - critcalc - damagecalc - adjustdamage - attackanimation - waitanimation - effectivenesssound - hitanimation BS_TARGET - waitstate - healthbarupdate BS_TARGET - datahpupdate BS_TARGET - critmessage - waitmessage B_WAIT_TIME_LONG - resultmessage - waitmessage B_WAIT_TIME_LONG + call BattleScript_EffectHit_Ret tryfaintmon BS_TARGET normalisebuffs printstring STRINGID_STATCHANGESGONE @@ -1113,24 +1170,7 @@ BattleScript_EffectFreezyFrost: BattleScript_EffectSappySeed: jumpifstatus3 BS_TARGET, STATUS3_LEECHSEED, BattleScript_EffectHit - attackcanceler - accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE - attackstring - ppreduce - critcalc - damagecalc - adjustdamage - attackanimation - waitanimation - effectivenesssound - hitanimation BS_TARGET - waitstate - healthbarupdate BS_TARGET - datahpupdate BS_TARGET - critmessage - waitmessage B_WAIT_TIME_LONG - resultmessage - waitmessage B_WAIT_TIME_LONG + call BattleScript_EffectHit_Ret tryfaintmon BS_TARGET jumpifhasnohp BS_TARGET, BattleScript_MoveEnd setseeded @@ -1140,24 +1180,7 @@ BattleScript_EffectSappySeed: BattleScript_EffectBaddyBad: jumpifsideaffecting BS_ATTACKER, SIDE_STATUS_REFLECT, BattleScript_EffectHit - attackcanceler - accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE - attackstring - ppreduce - critcalc - damagecalc - adjustdamage - attackanimation - waitanimation - effectivenesssound - hitanimation BS_TARGET - waitstate - healthbarupdate BS_TARGET - datahpupdate BS_TARGET - critmessage - waitmessage B_WAIT_TIME_LONG - resultmessage - waitmessage B_WAIT_TIME_LONG + call BattleScript_EffectHit_Ret tryfaintmon BS_TARGET setreflect printfromtable gReflectLightScreenSafeguardStringIds @@ -1166,24 +1189,7 @@ BattleScript_EffectBaddyBad: BattleScript_EffectGlitzyGlow: jumpifsideaffecting BS_ATTACKER, SIDE_STATUS_LIGHTSCREEN, BattleScript_EffectHit - attackcanceler - accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE - attackstring - ppreduce - critcalc - damagecalc - adjustdamage - attackanimation - waitanimation - effectivenesssound - hitanimation BS_TARGET - waitstate - healthbarupdate BS_TARGET - datahpupdate BS_TARGET - critmessage - waitmessage B_WAIT_TIME_LONG - resultmessage - waitmessage B_WAIT_TIME_LONG + call BattleScript_EffectHit_Ret tryfaintmon BS_TARGET setlightscreen printfromtable gReflectLightScreenSafeguardStringIds @@ -1317,24 +1323,7 @@ BattleScript_NoMoveEffect: BattleScript_EffectRelicSong: setmoveeffect MOVE_EFFECT_RELIC_SONG | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN - attackcanceler - accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE - attackstring - ppreduce - critcalc - damagecalc - adjustdamage - attackanimation - waitanimation - effectivenesssound - hitanimation BS_TARGET - waitstate - healthbarupdate BS_TARGET - datahpupdate BS_TARGET - critmessage - waitmessage B_WAIT_TIME_LONG - resultmessage - waitmessage B_WAIT_TIME_LONG + call BattleScript_EffectHit_Ret seteffectwithchance argumentstatuseffect tryfaintmon BS_TARGET @@ -1400,6 +1389,11 @@ BattleScript_DoubleShockRemoveType:: waitmessage B_WAIT_TIME_LONG return +BattleScript_DefDown:: + modifybattlerstatstage BS_TARGET, STAT_DEF, DECREASE, 1, BattleScript_DefDown_Ret, ANIM_ON +BattleScript_DefDown_Ret: + return + BattleScript_EffectPurify: attackcanceler attackstring @@ -2096,24 +2090,7 @@ BattleScript_EffectFinalGambit: goto BattleScript_MoveEnd BattleScript_EffectHitSwitchTarget: - attackcanceler - accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE - attackstring - ppreduce - critcalc - damagecalc - adjustdamage - attackanimation - waitanimation - effectivenesssound - hitanimation BS_TARGET - waitstate - healthbarupdate BS_TARGET - datahpupdate BS_TARGET - critmessage - waitmessage B_WAIT_TIME_LONG - resultmessage - waitmessage B_WAIT_TIME_LONG + call BattleScript_EffectHit_Ret tryfaintmon BS_TARGET moveendall jumpifability BS_TARGET, ABILITY_SUCTION_CUPS, BattleScript_AbilityPreventsPhasingOut @@ -3070,24 +3047,7 @@ BattleScript_EffectThroatChop: goto BattleScript_EffectHit BattleScript_EffectHitEscape: - attackcanceler - accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE - attackstring - ppreduce - critcalc - damagecalc - adjustdamage - attackanimation - waitanimation - effectivenesssound - hitanimation BS_TARGET - waitstate - healthbarupdate BS_TARGET - datahpupdate BS_TARGET - critmessage - waitmessage B_WAIT_TIME_LONG - resultmessage - waitmessage B_WAIT_TIME_LONG + call BattleScript_EffectHit_Ret jumpifmovehadnoeffect BattleScript_MoveEnd jumpifability BS_TARGET, ABILITY_GUARD_DOG, BattleScript_MoveEnd seteffectwithchance @@ -3159,6 +3119,27 @@ BattleScript_MoveEnd:: moveendall end +BattleScript_EffectHit_Ret:: + attackcanceler + accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE + attackstring + ppreduce + critcalc + damagecalc + adjustdamage + attackanimation + waitanimation + effectivenesssound + hitanimation BS_TARGET + waitstate + healthbarupdate BS_TARGET + datahpupdate BS_TARGET + critmessage + waitmessage B_WAIT_TIME_LONG + resultmessage + waitmessage B_WAIT_TIME_LONG + return + BattleScript_EffectNaturalGift: attackcanceler attackstring @@ -3350,24 +3331,7 @@ BattleScript_EffectPoisonHit: goto BattleScript_EffectHit BattleScript_EffectAbsorb:: - attackcanceler - accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE - attackstring - ppreduce - critcalc - damagecalc - adjustdamage - attackanimation - waitanimation - effectivenesssound - hitanimation BS_TARGET - waitstate - healthbarupdate BS_TARGET - datahpupdate BS_TARGET - critmessage - waitmessage B_WAIT_TIME_LONG - resultmessage - waitmessage B_WAIT_TIME_LONG + call BattleScript_EffectHit_Ret jumpifstatus3 BS_ATTACKER, STATUS3_HEAL_BLOCK, BattleScript_AbsorbHealBlock setdrainedhp manipulatedamage DMG_BIG_ROOT @@ -3391,6 +3355,7 @@ BattleScript_AbsorbHealBlock:: tryfaintmon BS_TARGET goto BattleScript_MoveEnd +BattleScript_EffectInfernalParade:: BattleScript_EffectBurnHit:: setmoveeffect MOVE_EFFECT_BURN goto BattleScript_EffectHit @@ -3795,24 +3760,7 @@ BattleScript_EffectFlinchHit:: BattleScript_EffectFlinchStatus: setmoveeffect MOVE_EFFECT_FLINCH - attackcanceler - accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE - attackstring - ppreduce - critcalc - damagecalc - adjustdamage - attackanimation - waitanimation - effectivenesssound - hitanimation BS_TARGET - waitstate - healthbarupdate BS_TARGET - datahpupdate BS_TARGET - critmessage - waitmessage B_WAIT_TIME_LONG - resultmessage - waitmessage B_WAIT_TIME_LONG + call BattleScript_EffectHit_Ret seteffectwithchance argumentstatuseffect tryfaintmon BS_TARGET @@ -5047,24 +4995,7 @@ BattleScript_EffectBatonPass:: BattleScript_EffectRapidSpin:: .if B_SPEED_BUFFING_RAPID_SPIN >= GEN_8 - attackcanceler - accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE - attackstring - ppreduce - critcalc - damagecalc - adjustdamage - attackanimation - waitanimation - effectivenesssound - hitanimation BS_TARGET - waitstate - healthbarupdate BS_TARGET - datahpupdate BS_TARGET - critmessage - waitmessage B_WAIT_TIME_LONG - resultmessage - waitmessage B_WAIT_TIME_LONG + call BattleScript_EffectHit_Ret jumpifhalfword CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_MoveEnd setmoveeffect MOVE_EFFECT_RAPIDSPIN | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN seteffectwithchance @@ -5268,12 +5199,6 @@ BattleScript_SkullBashEnd:: call BattleScript_PowerHerbActivation goto BattleScript_TwoTurnMovesSecondTurn -BattleScript_EffectTwister: -BattleScript_FlinchEffect: -BattleScript_EffectStomp: - setmoveeffect MOVE_EFFECT_FLINCH - goto BattleScript_EffectHit - BattleScript_EffectBulldoze: setmoveeffect MOVE_EFFECT_SPD_MINUS_1 BattleScript_EffectEarthquake: @@ -5323,7 +5248,7 @@ BattleScript_EffectTeleport: jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_EffectBatonPass jumpifside BS_ATTACKER, B_SIDE_PLAYER, BattleScript_EffectBatonPass .else - jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_ButItFailedAtkCanceler + jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_FailedFromAtkCanceler .endif BattleScript_EffectTeleportTryToRunAway: attackcanceler @@ -5464,6 +5389,8 @@ BattleScript_EffectFakeOut:: setmoveeffect MOVE_EFFECT_FLINCH goto BattleScript_EffectHit +BattleScript_FailedFromAtkCanceler:: + attackcanceler BattleScript_FailedFromAtkString:: attackstring BattleScript_FailedFromPpReduce:: @@ -6235,11 +6162,13 @@ BattleScript_EffectCalmMind:: attackcanceler attackstring ppreduce +BattleScript_CalmMindTryToRaiseStats:: jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPATK, MAX_STAT_STAGE, BattleScript_CalmMindDoMoveAnim jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPDEF, MAX_STAT_STAGE, BattleScript_CantRaiseMultipleStats BattleScript_CalmMindDoMoveAnim:: attackanimation waitanimation +BattleScript_CalmMindStatRaise:: setbyte sSTAT_ANIM_PLAYED, FALSE playstatchangeanimation BS_ATTACKER, BIT_SPATK | BIT_SPDEF, 0 setstatchanger STAT_SPATK, 1, FALSE @@ -6686,8 +6615,7 @@ BattleScript_PursuitDmgOnSwitchOut:: waitmessage B_WAIT_TIME_LONG tryfaintmon BS_TARGET moveendfromto MOVEEND_ABILITIES, MOVEEND_CHOICE_MOVE - getbattlerfainted BS_TARGET - jumpifbyte CMP_EQUAL, gBattleCommunication, FALSE, BattleScript_PursuitDmgOnSwitchOutRet + jumpiffainted BS_TARGET, FALSE, BattleScript_PursuitDmgOnSwitchOutRet setbyte sGIVEEXP_STATE, 0 getexp BS_TARGET BattleScript_PursuitDmgOnSwitchOutRet: @@ -6799,14 +6727,14 @@ BattleScript_SunlightFaded:: BattleScript_OverworldWeatherStarts:: printfromtable gWeatherStartsStringIds waitmessage B_WAIT_TIME_LONG - playanimation_var BS_ATTACKER, sB_ANIM_ARG1 + playanimation_var BS_BATTLER_0, sB_ANIM_ARG1 call BattleScript_ActivateWeatherAbilities end3 BattleScript_OverworldTerrain:: printfromtable gTerrainStringIds waitmessage B_WAIT_TIME_LONG - playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG + playanimation BS_BATTLER_0, B_ANIM_RESTORE_BG call BattleScript_ActivateTerrainEffects end3 @@ -7200,8 +7128,7 @@ BattleScript_GulpMissileGorging:: healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER tryfaintmon BS_ATTACKER - getbattlerfainted BS_ATTACKER - jumpifbyte CMP_EQUAL, gBattleCommunication, TRUE, BattleScript_GulpMissileNoSecondEffectGorging + jumpiffainted BS_ATTACKER, TRUE, BattleScript_GulpMissileNoSecondEffectGorging BattleScript_GulpMissileNoDmgGorging: handleformchange BS_TARGET, 0 playanimation BS_TARGET, B_ANIM_FORM_CHANGE @@ -7229,8 +7156,7 @@ BattleScript_GulpMissileGulping:: healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER tryfaintmon BS_ATTACKER - getbattlerfainted BS_ATTACKER - jumpifbyte CMP_EQUAL, gBattleCommunication, TRUE, BattleScript_GulpMissileNoSecondEffectGulping + jumpiffainted BS_ATTACKER, TRUE, BattleScript_GulpMissileNoSecondEffectGulping jumpifholdeffect BS_ATTACKER, HOLD_EFFECT_CLEAR_AMULET, BattleScript_GulpMissileNoSecondEffectGulping jumpifability BS_ATTACKER, ABILITY_CLEAR_BODY, BattleScript_GulpMissileNoSecondEffectGulping jumpifability BS_ATTACKER, ABILITY_FULL_METAL_BODY, BattleScript_GulpMissileNoSecondEffectGulping @@ -7571,6 +7497,14 @@ BattleScript_SelectingNotAllowedMoveHealBlockInPalace:: printstring STRINGID_HEALBLOCKPREVENTSUSAGE goto BattleScript_SelectingUnusableMoveInPalace +BattleScript_SelectingNotAllowedCurrentMove:: + printselectionstring STRINGID_CURRENTMOVECANTSELECT + endselectionscript + +BattleScript_SelectingNotAllowedCurrentMoveInPalace:: + printstring STRINGID_CURRENTMOVECANTSELECT + goto BattleScript_SelectingUnusableMoveInPalace + BattleScript_WishComesTrue:: trywish 1, BattleScript_WishButFullHp playanimation BS_TARGET, B_ANIM_WISH_HEAL @@ -7816,6 +7750,21 @@ BattleScript_PrimalReversionRet:: switchinabilities BS_ATTACKER return +BattleScript_UltraBurst:: + printstring STRINGID_EMPTYSTRING3 + trytrainerslidezmovemsg BS_ATTACKER + printstring STRINGID_ULTRABURSTREACTING + waitmessage B_WAIT_TIME_LONG + setbyte gIsCriticalHit, 0 + handleultraburst BS_ATTACKER, 0 + playanimation BS_ATTACKER, B_ANIM_ULTRA_BURST + waitanimation + handleultraburst BS_ATTACKER, 1 + printstring STRINGID_ULTRABURSTCOMPLETED + waitmessage B_WAIT_TIME_LONG + switchinabilities BS_ATTACKER + end3 + BattleScript_AttackerFormChange:: pause 5 copybyte gBattlerAbility, gBattlerAttacker @@ -7929,8 +7878,7 @@ BattleScript_CottonDownActivates:: savetarget setbyte gBattlerTarget, 0 BattleScript_CottonDownLoop: - getbattlerfainted BS_TARGET - jumpifbyte CMP_EQUAL, gBattleCommunication, TRUE, BattleScript_CottonDownLoopIncrement + jumpiffainted BS_TARGET, TRUE, BattleScript_CottonDownLoopIncrement setstatchanger STAT_SPEED, 1, TRUE jumpifbyteequal gBattlerTarget, gEffectBattler, BattleScript_CottonDownLoopIncrement statbuffchange STAT_CHANGE_NOT_PROTECT_AFFECTED, BattleScript_CottonDownTargetSpeedCantGoLower diff --git a/data/battle_scripts_2.s b/data/battle_scripts_2.s index 0c6c133b50e4..5b0827ade62b 100644 --- a/data/battle_scripts_2.s +++ b/data/battle_scripts_2.s @@ -112,6 +112,7 @@ BattleScript_ItemSetFocusEnergy:: setfocusenergy playmoveanimation BS_ATTACKER, MOVE_FOCUS_ENERGY waitanimation + copybyte sBATTLER, gBattlerAttacker printstring STRINGID_PKMNUSEDXTOGETPUMPED waitmessage B_WAIT_TIME_LONG end diff --git a/data/maps/AbandonedShip_HiddenFloorRooms/map.json b/data/maps/AbandonedShip_HiddenFloorRooms/map.json index 905c853350b5..10fe7419b20d 100644 --- a/data/maps/AbandonedShip_HiddenFloorRooms/map.json +++ b/data/maps/AbandonedShip_HiddenFloorRooms/map.json @@ -50,8 +50,8 @@ "movement_range_y": 1, "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", - "script": "AbandonedShip_HiddenFloorRooms_EventScript_ItemTM18", - "flag": "FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_1_TM18" + "script": "AbandonedShip_HiddenFloorRooms_EventScript_ItemTMRainDance", + "flag": "FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_1_TM_RAIN_DANCE" }, { "graphics_id": "OBJ_EVENT_GFX_ITEM_BALL", diff --git a/data/maps/AbandonedShip_Room_B1F/map.json b/data/maps/AbandonedShip_Room_B1F/map.json index 2a296325c90a..ac9820a8ab2f 100644 --- a/data/maps/AbandonedShip_Room_B1F/map.json +++ b/data/maps/AbandonedShip_Room_B1F/map.json @@ -24,8 +24,8 @@ "movement_range_y": 1, "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", - "script": "AbandonedShip_Room_B1F_EventScript_ItemTM13", - "flag": "FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_TM13" + "script": "AbandonedShip_Room_B1F_EventScript_ItemTMIceBeam", + "flag": "FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_TM_ICE_BEAM" } ], "warp_events": [ diff --git a/data/maps/BattleFrontier_BattleArenaLobby/scripts.inc b/data/maps/BattleFrontier_BattleArenaLobby/scripts.inc index 9467f34197a6..5d9ee507ec85 100644 --- a/data/maps/BattleFrontier_BattleArenaLobby/scripts.inc +++ b/data/maps/BattleFrontier_BattleArenaLobby/scripts.inc @@ -15,11 +15,11 @@ BattleFrontier_BattleArenaLobby_EventScript_TurnPlayerNorth:: end BattleFrontier_BattleArenaLobby_OnFrame: - map_script_2 VAR_TEMP_0, 0, BattleFrontier_BattleArenaLobby_EventScript_GetChallengeStatus - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_SAVING, BattleFrontier_BattleArenaLobby_EventScript_QuitWithoutSaving - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_PAUSED, BattleFrontier_BattleArenaLobby_EventScript_ResumeChallenge - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_WON, BattleFrontier_BattleArenaLobby_EventScript_WonChallenge - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_LOST, BattleFrontier_BattleArenaLobby_EventScript_LostChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, 0, BattleFrontier_BattleArenaLobby_EventScript_GetChallengeStatus + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_SAVING, BattleFrontier_BattleArenaLobby_EventScript_QuitWithoutSaving + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_PAUSED, BattleFrontier_BattleArenaLobby_EventScript_ResumeChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_WON, BattleFrontier_BattleArenaLobby_EventScript_WonChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_LOST, BattleFrontier_BattleArenaLobby_EventScript_LostChallenge .2byte 0 BattleFrontier_BattleArenaLobby_EventScript_GetChallengeStatus:: @@ -33,7 +33,7 @@ BattleFrontier_BattleArenaLobby_EventScript_QuitWithoutSaving:: arena_set ARENA_DATA_WIN_STREAK, 0 arena_set ARENA_DATA_WIN_STREAK_ACTIVE, FALSE frontier_set FRONTIER_DATA_CHALLENGE_STATUS, 0 - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -55,7 +55,7 @@ BattleFrontier_BattleArenaLobby_EventScript_GiveBattlePoints:: call BattleFrontier_BattleArenaLobby_EventScript_SaveAfterChallenge msgbox BattleFrontier_BattleArenaLobby_Text_AwaitAnotherChallenge2, MSGBOX_DEFAULT closemessage - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -67,7 +67,7 @@ BattleFrontier_BattleArenaLobby_EventScript_LostChallenge:: call BattleFrontier_BattleArenaLobby_EventScript_SaveAfterChallenge msgbox BattleFrontier_BattleArenaLobby_Text_AwaitAnotherChallenge2, MSGBOX_DEFAULT closemessage - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -101,7 +101,7 @@ BattleFrontier_BattleArenaLobby_EventScript_ResumeChallenge:: playse SE_SAVE waitse frontier_set FRONTIER_DATA_PAUSED, FALSE - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 goto BattleFrontier_BattleArenaLobby_EventScript_EnterChallenge BattleFrontier_BattleArenaLobby_EventScript_Attendant:: @@ -146,7 +146,7 @@ BattleFrontier_BattleArenaLobby_EventScript_TryEnterChallenge:: case MULTI_B_PRESSED, BattleFrontier_BattleArenaLobby_EventScript_LoadPartyAndCancelChallenge BattleFrontier_BattleArenaLobby_EventScript_SaveBeforeChallenge:: - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 frontier_set FRONTIER_DATA_SELECTED_MON_ORDER arena_init arena_set ARENA_DATA_WIN_STREAK_ACTIVE, TRUE @@ -156,7 +156,7 @@ BattleFrontier_BattleArenaLobby_EventScript_SaveBeforeChallenge:: closemessage delay 2 call Common_EventScript_SaveGame - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 goto_if_eq VAR_RESULT, 0, BattleFrontier_BattleArenaLobby_EventScript_CancelChallengeSaveFailed BattleFrontier_BattleArenaLobby_EventScript_EnterChallenge:: special SavePlayerParty @@ -167,7 +167,7 @@ BattleFrontier_BattleArenaLobby_EventScript_EnterChallenge:: call_if_eq VAR_RESULT, FRONTIER_LVL_50, BattleFrontier_BattleArenaLobby_EventScript_WalkToDoorLv50 call_if_eq VAR_RESULT, FRONTIER_LVL_OPEN, BattleFrontier_BattleArenaLobby_EventScript_WalkToDoorLvOpen warp MAP_BATTLE_FRONTIER_BATTLE_ARENA_CORRIDOR, 9, 13 - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 waitstate end diff --git a/data/maps/BattleFrontier_BattleDomeLobby/scripts.inc b/data/maps/BattleFrontier_BattleDomeLobby/scripts.inc index b972a0814c3b..9801b19fe5b8 100644 --- a/data/maps/BattleFrontier_BattleDomeLobby/scripts.inc +++ b/data/maps/BattleFrontier_BattleDomeLobby/scripts.inc @@ -21,11 +21,11 @@ BattleFrontier_BattleDomeLobby_EventScript_TurnPlayerNorth:: end BattleFrontier_BattleDomeLobby_OnFrame: - map_script_2 VAR_TEMP_0, 0, BattleFrontier_BattleDomeLobby_EventScript_GetChallengeStatus - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_SAVING, BattleFrontier_BattleDomeLobby_EventScript_QuitWithoutSaving - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_PAUSED, BattleFrontier_BattleDomeLobby_EventScript_ResumeChallenge - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_WON, BattleFrontier_BattleDomeLobby_EventScript_WonChallenge - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_LOST, BattleFrontier_BattleDomeLobby_EventScript_LostChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, 0, BattleFrontier_BattleDomeLobby_EventScript_GetChallengeStatus + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_SAVING, BattleFrontier_BattleDomeLobby_EventScript_QuitWithoutSaving + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_PAUSED, BattleFrontier_BattleDomeLobby_EventScript_ResumeChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_WON, BattleFrontier_BattleDomeLobby_EventScript_WonChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_LOST, BattleFrontier_BattleDomeLobby_EventScript_LostChallenge .2byte 0 BattleFrontier_BattleDomeLobby_EventScript_GetChallengeStatus:: @@ -40,7 +40,7 @@ BattleFrontier_BattleDomeLobby_EventScript_QuitWithoutSaving:: dome_set DOME_DATA_WIN_STREAK_ACTIVE, FALSE dome_set DOME_DATA_ATTEMPTED_CHALLENGE, TRUE frontier_set FRONTIER_DATA_CHALLENGE_STATUS, 0 - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -101,7 +101,7 @@ BattleFrontier_BattleDomeLobby_EventScript_RecordBattle:: BattleFrontier_BattleDomeLobby_EventScript_EndChallenge:: msgbox BattleFrontier_BattleDomeLobby_Text_HopeToSeeYouAgain, MSGBOX_DEFAULT closemessage - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -114,7 +114,7 @@ BattleFrontier_BattleDomeLobby_EventScript_ResumeChallenge:: playse SE_SAVE waitse frontier_set FRONTIER_DATA_PAUSED, FALSE - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 goto BattleFrontier_BattleDomeLobby_EventScript_EnterChallenge BattleFrontier_BattleDomeLobby_EventScript_SinglesAttendant:: @@ -173,7 +173,7 @@ BattleFrontier_BattleDomeLobby_EventScript_TryEnterChallenge:: case MULTI_B_PRESSED, BattleFrontier_BattleDomeLobby_EventScript_LoadPartyCancelChallenge BattleFrontier_BattleDomeLobby_EventScript_SaveBeforeChallenge:: - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 frontier_set FRONTIER_DATA_SELECTED_MON_ORDER dome_init frontier_set FRONTIER_DATA_CHALLENGE_STATUS, CHALLENGE_STATUS_SAVING @@ -182,7 +182,7 @@ BattleFrontier_BattleDomeLobby_EventScript_SaveBeforeChallenge:: closemessage delay 2 call Common_EventScript_SaveGame - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 goto_if_eq VAR_RESULT, 0, BattleFrontier_BattleDomeLobby_EventScript_CancelChallengeSaveFailed dome_inittrainers BattleFrontier_BattleDomeLobby_EventScript_EnterChallenge:: @@ -194,7 +194,7 @@ BattleFrontier_BattleDomeLobby_EventScript_EnterChallenge:: call BattleFrontier_BattleDomeLobby_EventScript_WalkToDoor special HealPlayerParty warp MAP_BATTLE_FRONTIER_BATTLE_DOME_CORRIDOR, 23, 6 - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 waitstate end diff --git a/data/maps/BattleFrontier_BattleFactoryLobby/scripts.inc b/data/maps/BattleFrontier_BattleFactoryLobby/scripts.inc index 682b2c91d193..be9caa0cd7f2 100644 --- a/data/maps/BattleFrontier_BattleFactoryLobby/scripts.inc +++ b/data/maps/BattleFrontier_BattleFactoryLobby/scripts.inc @@ -16,11 +16,11 @@ BattleFrontier_BattleFactoryLobby_EventScript_TurnPlayerNorth:: end BattleFrontier_BattleFactoryLobby_OnFrame: - map_script_2 VAR_TEMP_0, 0, BattleFrontier_BattleFactoryLobby_EventScript_GetChallengeStatus - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_SAVING, BattleFrontier_BattleFactoryLobby_EventScript_QuitWithoutSaving - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_PAUSED, BattleFrontier_BattleFactoryLobby_EventScript_ResumeChallenge - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_WON, BattleFrontier_BattleFactoryLobby_EventScript_WonChallenge - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_LOST, BattleFrontier_BattleFactoryLobby_EventScript_LostChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, 0, BattleFrontier_BattleFactoryLobby_EventScript_GetChallengeStatus + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_SAVING, BattleFrontier_BattleFactoryLobby_EventScript_QuitWithoutSaving + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_PAUSED, BattleFrontier_BattleFactoryLobby_EventScript_ResumeChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_WON, BattleFrontier_BattleFactoryLobby_EventScript_WonChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_LOST, BattleFrontier_BattleFactoryLobby_EventScript_LostChallenge .2byte 0 BattleFrontier_BattleFactoryLobby_EventScript_GetChallengeStatus:: @@ -36,7 +36,7 @@ BattleFrontier_BattleFactoryLobby_EventScript_QuitWithoutSaving:: factory_set FACTORY_DATA_WIN_STREAK, 0 factory_set FACTORY_DATA_WIN_STREAK_ACTIVE, FALSE frontier_set FRONTIER_DATA_CHALLENGE_STATUS, 0 - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -92,7 +92,7 @@ BattleFrontier_BattleFactoryLobby_EventScript_RecordBattle:: BattleFrontier_BattleFactoryLobby_EventScript_EndRecordBattle:: msgbox BattleFrontier_BattleFactoryLobby_Text_LookForwardToNextVisit, MSGBOX_DEFAULT closemessage - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -104,7 +104,7 @@ BattleFrontier_BattleFactoryLobby_EventScript_ResumeChallenge:: playse SE_SAVE waitse frontier_set FRONTIER_DATA_PAUSED, FALSE - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 setvar VAR_0x8006, 2 goto BattleFrontier_BattleFactoryLobby_EventScript_EnterChallenge @@ -152,7 +152,7 @@ BattleFrontier_BattleFactoryLobby_EventScript_TryEnterChallenge:: case MULTI_B_PRESSED, BattleFrontier_BattleFactoryLobby_EventScript_LoadPartyAndCancelChallenge BattleFrontier_BattleFactoryLobby_EventScript_SaveBeforeChallenge:: - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 factory_init frontier_set FRONTIER_DATA_CHALLENGE_STATUS, CHALLENGE_STATUS_SAVING factory_set FACTORY_DATA_WIN_STREAK_ACTIVE, TRUE @@ -160,7 +160,7 @@ BattleFrontier_BattleFactoryLobby_EventScript_SaveBeforeChallenge:: closemessage delay 2 call Common_EventScript_SaveGame - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 goto_if_eq VAR_RESULT, 0, BattleFrontier_BattleFactoryLobby_EventScript_CancelChallengeSaveFailed setvar VAR_0x8006, 0 BattleFrontier_BattleFactoryLobby_EventScript_EnterChallenge:: @@ -173,7 +173,7 @@ BattleFrontier_BattleFactoryLobby_EventScript_EnterChallenge:: applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleFactoryLobby_Movement_PlayerEnterDoor waitmovement 0 warp MAP_BATTLE_FRONTIER_BATTLE_FACTORY_PRE_BATTLE_ROOM, 8, 13 - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 waitstate end diff --git a/data/maps/BattleFrontier_BattlePalaceLobby/scripts.inc b/data/maps/BattleFrontier_BattlePalaceLobby/scripts.inc index 2a8903fe6f32..e38ec6f7db72 100644 --- a/data/maps/BattleFrontier_BattlePalaceLobby/scripts.inc +++ b/data/maps/BattleFrontier_BattlePalaceLobby/scripts.inc @@ -16,11 +16,11 @@ BattleFrontier_BattlePalaceLobby_EventScript_TurnPlayerNorth:: end BattleFrontier_BattlePalaceLobby_OnFrame: - map_script_2 VAR_TEMP_0, 0, BattleFrontier_BattlePalaceLobby_EventScript_GetChallengeStatus - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_SAVING, BattleFrontier_BattlePalaceLobby_EventScript_QuitWithoutSaving - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_PAUSED, BattleFrontier_BattlePalaceLobby_EventScript_ResumeChallenge - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_WON, BattleFrontier_BattlePalaceLobby_EventScript_WonChallenge - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_LOST, BattleFrontier_BattlePalaceLobby_EventScript_LostChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, 0, BattleFrontier_BattlePalaceLobby_EventScript_GetChallengeStatus + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_SAVING, BattleFrontier_BattlePalaceLobby_EventScript_QuitWithoutSaving + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_PAUSED, BattleFrontier_BattlePalaceLobby_EventScript_ResumeChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_WON, BattleFrontier_BattlePalaceLobby_EventScript_WonChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_LOST, BattleFrontier_BattlePalaceLobby_EventScript_LostChallenge .2byte 0 BattleFrontier_BattlePalaceLobby_EventScript_GetChallengeStatus:: @@ -34,7 +34,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_QuitWithoutSaving:: palace_set PALACE_DATA_WIN_STREAK, 0 palace_set PALACE_DATA_WIN_STREAK_ACTIVE, FALSE frontier_set FRONTIER_DATA_CHALLENGE_STATUS, 0 - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -56,7 +56,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_GiveBattlePoints:: call BattleFrontier_BattlePalaceLobby_EventScript_SaveAfterChallenge msgbox BattleFrontier_BattlePalaceLobby_Text_ReturnWhenFortified, MSGBOX_DEFAULT closemessage - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -68,7 +68,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_LostChallenge:: call BattleFrontier_BattlePalaceLobby_EventScript_SaveAfterChallenge msgbox BattleFrontier_BattlePalaceLobby_Text_ReturnWhenFortified, MSGBOX_DEFAULT closemessage - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -103,7 +103,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_ResumeChallenge:: playse SE_SAVE waitse frontier_set FRONTIER_DATA_PAUSED, FALSE - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 goto BattleFrontier_BattlePalaceLobby_EventScript_EnterChallenge BattleFrontier_BattlePalaceLobby_EventScript_SinglesAttendant:: @@ -164,7 +164,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_TryEnterChallenge:: case MULTI_B_PRESSED, BattleFrontier_BattlePalaceLobby_EventScript_LoadPartyAndCancelChallenge BattleFrontier_BattlePalaceLobby_EventScript_SaveBeforeChallenge:: - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 frontier_set FRONTIER_DATA_SELECTED_MON_ORDER palace_init palace_set PALACE_DATA_WIN_STREAK_ACTIVE, TRUE @@ -174,7 +174,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_SaveBeforeChallenge:: closemessage delay 2 call Common_EventScript_SaveGame - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 goto_if_eq VAR_RESULT, 0, BattleFrontier_BattlePalaceLobby_EventScript_CancelChallengeSaveFailed BattleFrontier_BattlePalaceLobby_EventScript_EnterChallenge:: special SavePlayerParty @@ -183,7 +183,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_EnterChallenge:: closemessage call BattleFrontier_BattlePalaceLobby_EventScript_WalkToDoor warp MAP_BATTLE_FRONTIER_BATTLE_PALACE_CORRIDOR, 8, 13 - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 waitstate end diff --git a/data/maps/BattleFrontier_BattlePikeLobby/scripts.inc b/data/maps/BattleFrontier_BattlePikeLobby/scripts.inc index 3e729e21211f..faba545f0e94 100644 --- a/data/maps/BattleFrontier_BattlePikeLobby/scripts.inc +++ b/data/maps/BattleFrontier_BattlePikeLobby/scripts.inc @@ -6,10 +6,10 @@ BattleFrontier_BattlePikeLobby_MapScripts:: .byte 0 BattleFrontier_BattlePikeLobby_OnFrame: - map_script_2 VAR_TEMP_0, 0, BattleFrontier_BattlePikeLobby_EventScript_GetChallengeStatus - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_SAVING, BattleFrontier_BattlePikeLobby_EventScript_QuitWithoutSaving - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_WON, BattleFrontier_BattlePikeLobby_EventScript_WonChallenge - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_LOST, BattleFrontier_BattlePikeLobby_EventScript_LostChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, 0, BattleFrontier_BattlePikeLobby_EventScript_GetChallengeStatus + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_SAVING, BattleFrontier_BattlePikeLobby_EventScript_QuitWithoutSaving + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_WON, BattleFrontier_BattlePikeLobby_EventScript_WonChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_LOST, BattleFrontier_BattlePikeLobby_EventScript_LostChallenge .2byte 0 BattleFrontier_BattlePikeLobby_OnWarp: @@ -34,7 +34,7 @@ BattleFrontier_BattlePikeLobby_EventScript_QuitWithoutSaving:: pike_set PIKE_DATA_WIN_STREAK, 0 pike_set PIKE_DATA_WIN_STREAK_ACTIVE, FALSE frontier_set FRONTIER_DATA_CHALLENGE_STATUS, 0 - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -67,7 +67,7 @@ BattleFrontier_BattlePikeLobby_EventScript_GiveBattlePoints:: waitse msgbox BattleFrontier_BattlePikeLobby_Text_LookForwardToSeeingYou, MSGBOX_DEFAULT closemessage - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -86,7 +86,7 @@ BattleFrontier_BattlePikeLobby_EventScript_LostChallenge:: waitse msgbox BattleFrontier_BattlePikeLobby_Text_LookForwardToSeeingYou, MSGBOX_DEFAULT closemessage - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -132,7 +132,7 @@ BattleFrontier_BattlePikeLobby_EventScript_TryEnterChallenge:: case MULTI_B_PRESSED, BattleFrontier_BattlePikeLobby_EventScript_LoadPartyAndCancelChallenge BattleFrontier_BattlePikeLobby_EventScript_SaveBeforeChallenge:: - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 setvar VAR_TEMP_1, 0 frontier_set FRONTIER_DATA_SELECTED_MON_ORDER pike_init @@ -144,7 +144,7 @@ BattleFrontier_BattlePikeLobby_EventScript_SaveBeforeChallenge:: closemessage delay 2 call Common_EventScript_SaveGame - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 pike_savehelditems goto_if_eq VAR_RESULT, 0, BattleFrontier_BattlePikeLobby_EventScript_CancelChallengeSaveFailed special SavePlayerParty @@ -156,7 +156,7 @@ BattleFrontier_BattlePikeLobby_EventScript_SaveBeforeChallenge:: special HealPlayerParty call BattleFrontier_BattlePike_EventScript_CloseCurtain warpsilent MAP_BATTLE_FRONTIER_BATTLE_PIKE_CORRIDOR, 6, 7 - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 waitstate end diff --git a/data/maps/BattleFrontier_BattlePikeThreePathRoom/scripts.inc b/data/maps/BattleFrontier_BattlePikeThreePathRoom/scripts.inc index e95ca9dcea85..3547871444ab 100644 --- a/data/maps/BattleFrontier_BattlePikeThreePathRoom/scripts.inc +++ b/data/maps/BattleFrontier_BattlePikeThreePathRoom/scripts.inc @@ -7,9 +7,9 @@ BattleFrontier_BattlePikeThreePathRoom_MapScripts:: .byte 0 BattleFrontier_BattlePikeThreePathRoom_OnFrame: - map_script_2 VAR_TEMP_0, 0, BattleFrontier_BattlePikeThreePathRoom_EventScript_GetChallengeStatus - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_SAVING, BattleFrontier_BattlePikeThreePathRoom_EventScript_WarpToLobby - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_PAUSED, BattleFrontier_BattlePikeThreePathRoom_EventScript_ResumeChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, 0, BattleFrontier_BattlePikeThreePathRoom_EventScript_GetChallengeStatus + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_SAVING, BattleFrontier_BattlePikeThreePathRoom_EventScript_WarpToLobby + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_PAUSED, BattleFrontier_BattlePikeThreePathRoom_EventScript_ResumeChallenge map_script_2 VAR_TEMP_5, 0, BattleFrontier_BattlePikeThreePathRoom_EventScript_SetHintRoom map_script_2 VAR_TEMP_5, 1, BattleFrontier_BattlePikeThreePathRoom_EventScript_GivePikeQueenHint .2byte 0 @@ -40,7 +40,7 @@ BattleFrontier_BattlePikeThreePathRoom_EventScript_ResumeChallenge:: playse SE_SAVE waitse frontier_set FRONTIER_DATA_PAUSED, FALSE - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 special SavePlayerParty frontier_setpartyorder FRONTIER_PARTY_SIZE msgbox BattleFrontier_BattlePikeThreePathRoom_Text_PleaseEnjoyChallenge, MSGBOX_DEFAULT diff --git a/data/maps/BattleFrontier_BattlePyramidFloor/scripts.inc b/data/maps/BattleFrontier_BattlePyramidFloor/scripts.inc index a6b3f63c8e5f..ba9d9967062f 100644 --- a/data/maps/BattleFrontier_BattlePyramidFloor/scripts.inc +++ b/data/maps/BattleFrontier_BattlePyramidFloor/scripts.inc @@ -6,7 +6,7 @@ BattleFrontier_BattlePyramidFloor_MapScripts:: BattleFrontier_BattlePyramidFloor_OnFrame: map_script_2 VAR_TEMP_D, 1, BattleFrontier_BattlePyramidFloor_EventScript_UpdateLight - map_script_2 VAR_TEMP_E, 0, BattleFrontier_BattlePyramidFloor_EventScript_PlayPyramidMusic + map_script_2 VAR_TEMP_PLAYING_PYRAMID_MUSIC, 0, BattleFrontier_BattlePyramidFloor_EventScript_PlayPyramidMusic map_script_2 VAR_TEMP_F, 1, BattleFrontier_BattlePyramidFloor_EventScript_ShowMapName .2byte 0 @@ -33,13 +33,13 @@ BattleFrontier_BattlePyramidFloor_EventScript_ShowMapName:: BattleFrontier_BattlePyramidFloor_EventScript_PlayPyramidMusic:: playbgm MUS_B_PYRAMID, FALSE - setvar VAR_TEMP_E, 1 + setvar VAR_TEMP_PLAYING_PYRAMID_MUSIC, 1 end BattleFrontier_BattlePyramidFloor_OnResume: pyramid_setfloorpal frontier_getstatus - switch VAR_TEMP_0 + switch VAR_TEMP_CHALLENGE_STATUS case 0, BattleFrontier_BattlePyramidFloor_EventScript_ReadyChallenge case CHALLENGE_STATUS_SAVING, BattleFrontier_BattlePyramid_EventScript_WarpToLobby case CHALLENGE_STATUS_PAUSED, BattleFrontier_BattlePyramidFloor_EventScript_ReadyChallenge diff --git a/data/maps/BattleFrontier_BattlePyramidLobby/scripts.inc b/data/maps/BattleFrontier_BattlePyramidLobby/scripts.inc index 550644511b2d..25f5dc2b0445 100644 --- a/data/maps/BattleFrontier_BattlePyramidLobby/scripts.inc +++ b/data/maps/BattleFrontier_BattlePyramidLobby/scripts.inc @@ -17,11 +17,11 @@ BattleFrontier_BattlePyramidLobby_EventScript_TurnPlayerNorth: end BattleFrontier_BattlePyramidLobby_OnFrame: - map_script_2 VAR_TEMP_0, 0, BattleFrontier_BattlePyramidLobby_EventScript_GetChallengeStatus - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_SAVING, BattleFrontier_BattlePyramidLobby_EventScript_QuitWithoutSaving - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_PAUSED, BattleFrontier_BattlePyramidLobby_EventScript_ResumeChallenge - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_WON, BattleFrontier_BattlePyramidLobby_EventScript_WonChallenge - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_LOST, BattleFrontier_BattlePyramidLobby_EventScript_LostChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, 0, BattleFrontier_BattlePyramidLobby_EventScript_GetChallengeStatus + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_SAVING, BattleFrontier_BattlePyramidLobby_EventScript_QuitWithoutSaving + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_PAUSED, BattleFrontier_BattlePyramidLobby_EventScript_ResumeChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_WON, BattleFrontier_BattlePyramidLobby_EventScript_WonChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_LOST, BattleFrontier_BattlePyramidLobby_EventScript_LostChallenge .2byte 0 BattleFrontier_BattlePyramidLobby_EventScript_GetChallengeStatus:: @@ -38,7 +38,7 @@ BattleFrontier_BattlePyramidLobby_EventScript_QuitWithoutSaving:: pyramid_set PYRAMID_DATA_WIN_STREAK, 0 pyramid_set PYRAMID_DATA_WIN_STREAK_ACTIVE, FALSE frontier_set FRONTIER_DATA_CHALLENGE_STATUS, 0 - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -74,7 +74,7 @@ BattleFrontier_BattlePyramidLobby_EventScript_GiveBattlePoints:: waitse msgbox BattleFrontier_BattlePyramidLobby_Text_LookForwardToNextChallenge, MSGBOX_DEFAULT closemessage - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -96,7 +96,7 @@ BattleFrontier_BattlePyramidLobby_EventScript_LostChallenge:: waitse msgbox BattleFrontier_BattlePyramidLobby_Text_LookForwardToNextChallenge, MSGBOX_DEFAULT closemessage - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -145,7 +145,7 @@ BattleFrontier_BattlePyramidLobby_EventScript_TryEnterChallenge:: case MULTI_B_PRESSED, BattleFrontier_BattlePyramidLobby_EventScript_LoadPartyAndCancelChallenge BattleFrontier_BattlePyramidLobby_EventScript_SaveBeforeChallenge:: - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 frontier_set FRONTIER_DATA_SELECTED_MON_ORDER pyramid_init pyramid_set PYRAMID_DATA_WIN_STREAK_ACTIVE, TRUE @@ -157,7 +157,7 @@ BattleFrontier_BattlePyramidLobby_EventScript_SaveBeforeChallenge:: closemessage delay 2 call Common_EventScript_SaveGame - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 goto_if_eq VAR_RESULT, 0, BattleFrontier_BattlePyramidLobby_EventScript_CancelChallengeSaveFailed BattleFrontier_BattlePyramidLobby_EventScript_EnterChallenge:: special SavePlayerParty @@ -169,7 +169,7 @@ BattleFrontier_BattlePyramidLobby_EventScript_EnterChallenge:: setvar VAR_RESULT, 0 special HealPlayerParty warp MAP_BATTLE_FRONTIER_BATTLE_PYRAMID_FLOOR, 1, 1 - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 waitstate end diff --git a/data/maps/BattleFrontier_BattlePyramidTop/scripts.inc b/data/maps/BattleFrontier_BattlePyramidTop/scripts.inc index 385356c4badd..fa5763527163 100644 --- a/data/maps/BattleFrontier_BattlePyramidTop/scripts.inc +++ b/data/maps/BattleFrontier_BattlePyramidTop/scripts.inc @@ -32,7 +32,7 @@ BattleFrontier_BattlePyramidTop_OnResume: BattleFrontier_BattlePyramidTop_EventScript_CheckChallengeStatus:: copyvar VAR_TEMP_C, VAR_RESULT frontier_getstatus - switch VAR_TEMP_0 + switch VAR_TEMP_CHALLENGE_STATUS case 0, BattleFrontier_BattlePyramidTop_EventScript_ReadyChallenge case CHALLENGE_STATUS_SAVING, BattleFrontier_BattlePyramid_EventScript_WarpToLobby case CHALLENGE_STATUS_PAUSED, BattleFrontier_BattlePyramidTop_EventScript_ReadyChallenge @@ -43,13 +43,13 @@ BattleFrontier_BattlePyramidTop_EventScript_CheckChallengeStatus:: end BattleFrontier_BattlePyramidTop_OnFrame: - map_script_2 VAR_TEMP_E, 0, BattleFrontier_BattlePyramidTop_EventScript_PlayPyramidMusic + map_script_2 VAR_TEMP_PLAYING_PYRAMID_MUSIC, 0, BattleFrontier_BattlePyramidTop_EventScript_PlayPyramidMusic map_script_2 VAR_TEMP_F, 1, BattleFrontier_BattlePyramidTop_EventScript_ShowMapName .2byte 0 BattleFrontier_BattlePyramidTop_EventScript_PlayPyramidMusic:: playbgm MUS_B_PYRAMID_TOP, FALSE - setvar VAR_TEMP_E, 1 + setvar VAR_TEMP_PLAYING_PYRAMID_MUSIC, 1 end BattleFrontier_BattlePyramidTop_EventScript_ShowMapName:: diff --git a/data/maps/BattleFrontier_BattleTowerLobby/scripts.inc b/data/maps/BattleFrontier_BattleTowerLobby/scripts.inc index 8d60105bd30d..6162d0ada684 100644 --- a/data/maps/BattleFrontier_BattleTowerLobby/scripts.inc +++ b/data/maps/BattleFrontier_BattleTowerLobby/scripts.inc @@ -41,11 +41,11 @@ BattleFrontier_BattleTowerLobby_EventScript_PlayerFaceNorth:: end BattleFrontier_BattleTowerLobby_OnFrame: - map_script_2 VAR_TEMP_0, 0, BattleFrontier_BattleTowerLobby_EventScript_GetChallengeStatus - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_SAVING, BattleFrontier_BattleTowerLobby_EventScript_QuitWithoutSaving - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_PAUSED, BattleFrontier_BattleTowerLobby_EventScript_ResumeChallenge - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_WON, BattleFrontier_BattleTowerLobby_EventScript_WonChallenge - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_LOST, BattleFrontier_BattleTowerLobby_EventScript_LostChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, 0, BattleFrontier_BattleTowerLobby_EventScript_GetChallengeStatus + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_SAVING, BattleFrontier_BattleTowerLobby_EventScript_QuitWithoutSaving + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_PAUSED, BattleFrontier_BattleTowerLobby_EventScript_ResumeChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_WON, BattleFrontier_BattleTowerLobby_EventScript_WonChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_LOST, BattleFrontier_BattleTowerLobby_EventScript_LostChallenge .2byte 0 BattleFrontier_BattleTowerLobby_EventScript_GetChallengeStatus:: @@ -60,7 +60,7 @@ BattleFrontier_BattleTowerLobby_EventScript_QuitWithoutSaving:: tower_set TOWER_DATA_WIN_STREAK, 0 tower_set TOWER_DATA_WIN_STREAK_ACTIVE, FALSE frontier_set FRONTIER_DATA_CHALLENGE_STATUS, 0 - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 release end @@ -94,7 +94,7 @@ BattleFrontier_BattleTowerLobby_EventScript_GiveBattlePoints:: BattleFrontier_BattleTowerLobby_EventScript_LookForwardToChallenge:: msgbox BattleFrontier_BattleTowerLobby_Text_LookForwardToAnotherChallenge, MSGBOX_DEFAULT closemessage - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 release end @@ -113,7 +113,7 @@ BattleFrontier_BattleTowerLobby_EventScript_LostThanksForPlaying:: call BattleFrontier_BattleTowerLobby_EventScript_AskSaveBattle msgbox BattleFrontier_BattleTowerLobby_Text_LookForwardToAnotherChallenge, MSGBOX_DEFAULT closemessage - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 release end @@ -214,7 +214,7 @@ BattleFrontier_BattleTowerLobby_EventScript_TryEnterSinglesChallenge:: BattleFrontier_BattleTowerLobby_EventScript_SaveBeforeSinglesChallenge:: frontier_set FRONTIER_DATA_SELECTED_MON_ORDER - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 tower_init tower_set TOWER_DATA_WIN_STREAK_ACTIVE, TRUE frontier_set FRONTIER_DATA_PAUSED, FALSE @@ -222,7 +222,7 @@ BattleFrontier_BattleTowerLobby_EventScript_SaveBeforeSinglesChallenge:: closemessage delay 2 call Common_EventScript_SaveGame - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 goto_if_eq VAR_RESULT, 0, BattleFrontier_BattleTowerLobby_EventScript_CancelChallengeSaveFailed incrementgamestat GAME_STAT_ENTERED_BATTLE_TOWER setvar VAR_BRAVO_TRAINER_BATTLE_TOWER_ON, TRUE @@ -277,7 +277,7 @@ BattleFrontier_BattleTowerLobby_EventScript_TryEnterDoublesChallenge:: BattleFrontier_BattleTowerLobby_EventScript_SaveBeforeDoublesChallenge:: frontier_set FRONTIER_DATA_SELECTED_MON_ORDER - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 tower_init tower_set TOWER_DATA_WIN_STREAK_ACTIVE, TRUE frontier_set FRONTIER_DATA_PAUSED, FALSE @@ -285,7 +285,7 @@ BattleFrontier_BattleTowerLobby_EventScript_SaveBeforeDoublesChallenge:: closemessage delay 2 call Common_EventScript_SaveGame - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 goto_if_eq VAR_RESULT, 0, BattleFrontier_BattleTowerLobby_EventScript_CancelChallengeSaveFailed incrementgamestat GAME_STAT_ENTERED_BATTLE_TOWER setvar VAR_BRAVO_TRAINER_BATTLE_TOWER_ON, FALSE @@ -341,7 +341,7 @@ BattleFrontier_BattleTowerLobby_EventScript_TryEnterMultisChallenge:: BattleFrontier_BattleTowerLobby_EventScript_SaveBeforeMultisChallenge:: frontier_set FRONTIER_DATA_SELECTED_MON_ORDER - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 tower_init tower_set TOWER_DATA_WIN_STREAK_ACTIVE, TRUE frontier_set FRONTIER_DATA_PAUSED, FALSE @@ -349,7 +349,7 @@ BattleFrontier_BattleTowerLobby_EventScript_SaveBeforeMultisChallenge:: closemessage delay 2 call Common_EventScript_SaveGame - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 goto_if_eq VAR_RESULT, 0, BattleFrontier_BattleTowerLobby_EventScript_CancelChallengeSaveFailed incrementgamestat GAME_STAT_ENTERED_BATTLE_TOWER setvar VAR_BRAVO_TRAINER_BATTLE_TOWER_ON, FALSE @@ -404,7 +404,7 @@ BattleFrontier_BattleTowerLobby_EventScript_TryEnterLinkMultisChallenge:: BattleFrontier_BattleTowerLobby_EventScript_SaveBeforeLinkMultisChallenge:: frontier_set FRONTIER_DATA_SELECTED_MON_ORDER - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 tower_init tower_set TOWER_DATA_WIN_STREAK_ACTIVE, TRUE frontier_set FRONTIER_DATA_PAUSED, FALSE @@ -419,7 +419,7 @@ BattleFrontier_BattleTowerLobby_EventScript_SaveBeforeLinkMultisChallenge:: tower_save 0 .endif call Common_EventScript_SaveGame - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 goto_if_eq VAR_RESULT, 0, BattleFrontier_BattleTowerLobby_EventScript_CancelChallengeSaveFailed @ GAME_STAT_ENTERED_BATTLE_TOWER should not be incremented here, for two reasons: @ 1. It is incremented again in BattleFrontier_BattleTowerLobby_EventScript_CableLinkSuccessful or BattleFrontier_BattleTowerLobby_EventScript_WirelessLinkSuccessful @@ -602,7 +602,7 @@ BattleFrontier_BattleTowerLobby_EventScript_WaitForLinkOpponentLoad:: call BattleFrontier_BattleTowerLobby_EventScript_ShowYouToBattleRoom clearflag FLAG_CANCEL_BATTLE_ROOM_CHALLENGE warp MAP_BATTLE_FRONTIER_BATTLE_TOWER_ELEVATOR, 1, 6 - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 waitstate end diff --git a/data/maps/BattleFrontier_Lounge7/scripts.inc b/data/maps/BattleFrontier_Lounge7/scripts.inc index 467f6ba9ae44..3ff8005e1dd7 100644 --- a/data/maps/BattleFrontier_Lounge7/scripts.inc +++ b/data/maps/BattleFrontier_Lounge7/scripts.inc @@ -20,12 +20,12 @@ BattleFrontier_Lounge7_EventScript_ChooseLeftTutorMove:: message BattleFrontier_Lounge7_Text_TeachWhichMove waitmessage special ShowBattlePointsWindow - setvar VAR_TEMP_E, 0 + setvar VAR_TEMP_FRONTIER_TUTOR_ID, 0 setvar VAR_0x8004, SCROLL_MULTI_BF_MOVE_TUTOR_1 setvar VAR_0x8006, 0 special ShowScrollableMultichoice waitstate - copyvar VAR_TEMP_D, VAR_RESULT + copyvar VAR_TEMP_FRONTIER_TUTOR_SELECTION, VAR_RESULT switch VAR_RESULT case 0, BattleFrontier_Lounge7_EventScript_Softboiled case 1, BattleFrontier_Lounge7_EventScript_SeismicToss @@ -44,12 +44,12 @@ BattleFrontier_Lounge7_EventScript_ChooseLeftTutorMove:: BattleFrontier_Lounge7_EventScript_ChooseNewLeftTutorMove:: message BattleFrontier_Lounge7_Text_TeachWhichMove waitmessage - setvar VAR_TEMP_E, 0 + setvar VAR_TEMP_FRONTIER_TUTOR_ID, 0 setvar VAR_0x8004, SCROLL_MULTI_BF_MOVE_TUTOR_1 setvar VAR_0x8006, 1 special ShowScrollableMultichoice waitstate - copyvar VAR_TEMP_D, VAR_RESULT + copyvar VAR_TEMP_FRONTIER_TUTOR_SELECTION, VAR_RESULT switch VAR_RESULT case 0, BattleFrontier_Lounge7_EventScript_Softboiled case 1, BattleFrontier_Lounge7_EventScript_SeismicToss @@ -144,12 +144,12 @@ BattleFrontier_Lounge7_EventScript_ChooseRightTutorMove:: message BattleFrontier_Lounge7_Text_TeachWhichMove waitmessage special ShowBattlePointsWindow - setvar VAR_TEMP_E, 1 + setvar VAR_TEMP_FRONTIER_TUTOR_ID, 1 setvar VAR_0x8004, SCROLL_MULTI_BF_MOVE_TUTOR_2 setvar VAR_0x8006, 0 special ShowScrollableMultichoice waitstate - copyvar VAR_TEMP_D, VAR_RESULT + copyvar VAR_TEMP_FRONTIER_TUTOR_SELECTION, VAR_RESULT switch VAR_RESULT case 0, BattleFrontier_Lounge7_EventScript_DefenseCurl case 1, BattleFrontier_Lounge7_EventScript_Snore @@ -168,12 +168,12 @@ BattleFrontier_Lounge7_EventScript_ChooseRightTutorMove:: BattleFrontier_Lounge7_EventScript_ChooseNewRightTutorMove:: message BattleFrontier_Lounge7_Text_TeachWhichMove waitmessage - setvar VAR_TEMP_E, 1 + setvar VAR_TEMP_FRONTIER_TUTOR_ID, 1 setvar VAR_0x8004, SCROLL_MULTI_BF_MOVE_TUTOR_2 setvar VAR_0x8006, 1 special ShowScrollableMultichoice waitstate - copyvar VAR_TEMP_D, VAR_RESULT + copyvar VAR_TEMP_FRONTIER_TUTOR_SELECTION, VAR_RESULT switch VAR_RESULT case 0, BattleFrontier_Lounge7_EventScript_DefenseCurl case 1, BattleFrontier_Lounge7_EventScript_Snore @@ -263,8 +263,8 @@ BattleFrontier_Lounge7_EventScript_CancelChooseMon:: @ VAR_0x8008 is the price @ VAR_TEMP_C is the scroll multichoice ID -@ VAR_TEMP_D is the move selection -@ VAR_TEMP_E is which move tutor was spoken to +@ VAR_TEMP_FRONTIER_TUTOR_SELECTION is the move selection +@ VAR_TEMP_FRONTIER_TUTOR_ID is which move tutor was spoken to BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection:: special BufferBattleFrontierTutorMoveName buffernumberstring STR_VAR_2, VAR_0x8008 @@ -291,7 +291,7 @@ BattleFrontier_Lounge7_EventScript_TeachTutorMove:: end BattleFrontier_Lounge7_EventScript_ChooseNewMove:: - goto_if_eq VAR_TEMP_E, 0, BattleFrontier_Lounge7_EventScript_ChooseNewLeftTutorMove + goto_if_eq VAR_TEMP_FRONTIER_TUTOR_ID, 0, BattleFrontier_Lounge7_EventScript_ChooseNewLeftTutorMove goto BattleFrontier_Lounge7_EventScript_ChooseNewRightTutorMove end diff --git a/data/maps/DewfordTown_Gym/scripts.inc b/data/maps/DewfordTown_Gym/scripts.inc index 81474af7261c..c4258193047f 100644 --- a/data/maps/DewfordTown_Gym/scripts.inc +++ b/data/maps/DewfordTown_Gym/scripts.inc @@ -136,7 +136,7 @@ DewfordTown_Gym_EventScript_Brawly:: trainerbattle_single TRAINER_BRAWLY_1, DewfordTown_Gym_Text_BrawlyIntro, DewfordTown_Gym_Text_BrawlyDefeat, DewfordTown_Gym_EventScript_BrawlyDefeated, NO_MUSIC specialvar VAR_RESULT, ShouldTryRematchBattle goto_if_eq VAR_RESULT, TRUE, DewfordTown_Gym_EventScript_BrawlyRematch - goto_if_unset FLAG_RECEIVED_TM08, DewfordTown_Gym_EventScript_GiveBulkUp2 + goto_if_unset FLAG_RECEIVED_TM_BULK_UP, DewfordTown_Gym_EventScript_GiveBulkUp2 msgbox DewfordTown_Gym_Text_BrawlyPostBattle, MSGBOX_DEFAULT release end @@ -168,17 +168,17 @@ DewfordTown_Gym_EventScript_BrawlyDefeated:: end DewfordTown_Gym_EventScript_GiveBulkUp:: - giveitem ITEM_TM08 + giveitem ITEM_TM_BULK_UP goto_if_eq VAR_RESULT, 0, Common_EventScript_BagIsFull msgbox DewfordTown_Gym_Text_ExplainBulkUp, MSGBOX_DEFAULT - setflag FLAG_RECEIVED_TM08 + setflag FLAG_RECEIVED_TM_BULK_UP return DewfordTown_Gym_EventScript_GiveBulkUp2: - giveitem ITEM_TM08 + giveitem ITEM_TM_BULK_UP goto_if_eq VAR_RESULT, 0, Common_EventScript_ShowBagIsFull msgbox DewfordTown_Gym_Text_ExplainBulkUp, MSGBOX_DEFAULT - setflag FLAG_RECEIVED_TM08 + setflag FLAG_RECEIVED_TM_BULK_UP release end diff --git a/data/maps/DewfordTown_Hall/scripts.inc b/data/maps/DewfordTown_Hall/scripts.inc index 6249a7fac5ce..1472bebb243b 100644 --- a/data/maps/DewfordTown_Hall/scripts.inc +++ b/data/maps/DewfordTown_Hall/scripts.inc @@ -246,11 +246,11 @@ DewfordTown_Hall_EventScript_SludgeBombMan:: lock faceplayer call Common_EventScript_BufferTrendyPhrase - goto_if_set FLAG_RECEIVED_TM36, DewfordTown_Hall_EventScript_ReceivedSludgeBomb + goto_if_set FLAG_RECEIVED_TM_SLUDGE_BOMB, DewfordTown_Hall_EventScript_ReceivedSludgeBomb msgbox DewfordTown_Hall_Text_GiveYouSludgeBomb, MSGBOX_DEFAULT - giveitem ITEM_TM36 + giveitem ITEM_TM_SLUDGE_BOMB goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull - setflag FLAG_RECEIVED_TM36 + setflag FLAG_RECEIVED_TM_SLUDGE_BOMB release end diff --git a/data/maps/FallarborTown_BattleTentLobby/scripts.inc b/data/maps/FallarborTown_BattleTentLobby/scripts.inc index 1bcd04559c8d..8f705075c779 100644 --- a/data/maps/FallarborTown_BattleTentLobby/scripts.inc +++ b/data/maps/FallarborTown_BattleTentLobby/scripts.inc @@ -15,11 +15,11 @@ FallarborTown_BattleTentLobby_EventScript_TurnPlayerNorth:: end FallarborTown_BattleTentLobby_OnFrame: - map_script_2 VAR_TEMP_0, 0, FallarborTown_BattleTentLobby_EventScript_GetChallengeStatus - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_SAVING, FallarborTown_BattleTentLobby_EventScript_QuitWithoutSaving - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_PAUSED, FallarborTown_BattleTentLobby_EventScript_ResumeChallenge - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_WON, FallarborTown_BattleTentLobby_EventScript_WonChallenge - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_LOST, FallarborTown_BattleTentLobby_EventScript_LostChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, 0, FallarborTown_BattleTentLobby_EventScript_GetChallengeStatus + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_SAVING, FallarborTown_BattleTentLobby_EventScript_QuitWithoutSaving + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_PAUSED, FallarborTown_BattleTentLobby_EventScript_ResumeChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_WON, FallarborTown_BattleTentLobby_EventScript_WonChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_LOST, FallarborTown_BattleTentLobby_EventScript_LostChallenge .2byte 0 FallarborTown_BattleTentLobby_EventScript_GetChallengeStatus:: @@ -31,7 +31,7 @@ FallarborTown_BattleTentLobby_EventScript_QuitWithoutSaving:: msgbox FallarborTown_BattleTentLobby_Text_DidntSaveBeforeQuitting, MSGBOX_DEFAULT closemessage frontier_set FRONTIER_DATA_CHALLENGE_STATUS, 0 - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 frontier_set FRONTIER_DATA_LVL_MODE, FRONTIER_LVL_50 releaseall end @@ -59,7 +59,7 @@ FallarborTown_BattleTentLobby_EventScript_GivePrize:: waitfanfare msgbox FallarborTown_BattleTentLobby_Text_AwaitAnotherChallenge2, MSGBOX_DEFAULT closemessage - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -67,7 +67,7 @@ FallarborTown_BattleTentLobby_EventScript_NoRoomForPrize:: msgbox FallarborTown_BattleTentLobby_Text_BagFullReturnForPrize, MSGBOX_DEFAULT waitmessage closemessage - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -87,7 +87,7 @@ FallarborTown_BattleTentLobby_EventScript_LostChallenge:: waitse msgbox FallarborTown_BattleTentLobby_Text_AwaitAnotherChallenge2, MSGBOX_DEFAULT closemessage - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -99,7 +99,7 @@ FallarborTown_BattleTentLobby_EventScript_ResumeChallenge:: playse SE_SAVE waitse frontier_set FRONTIER_DATA_PAUSED, FALSE - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 goto FallarborTown_BattleTentLobby_EventScript_EnterChallenge FallarborTown_BattleTentLobby_EventScript_Attendant:: @@ -140,7 +140,7 @@ FallarborTown_BattleTentLobby_EventScript_TryEnterChallenge:: case MULTI_B_PRESSED, FallarborTown_BattleTentLobby_EventScript_LoadPartyCancelChallenge FallarborTown_BattleTentLobby_EventScript_SaveBeforeChallenge:: - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 frontier_set FRONTIER_DATA_SELECTED_MON_ORDER fallarbortent_init frontier_set FRONTIER_DATA_CHALLENGE_STATUS, CHALLENGE_STATUS_SAVING @@ -149,7 +149,7 @@ FallarborTown_BattleTentLobby_EventScript_SaveBeforeChallenge:: closemessage delay 2 call Common_EventScript_SaveGame - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 goto_if_eq VAR_RESULT, 0, FallarborTown_BattleTentLobby_EventScript_CancelChallengeSaveFailed FallarborTown_BattleTentLobby_EventScript_EnterChallenge:: special SavePlayerParty @@ -158,7 +158,7 @@ FallarborTown_BattleTentLobby_EventScript_EnterChallenge:: closemessage call FallarborTown_BattleTentLobby_EventScript_WalkToDoor warp MAP_FALLARBOR_TOWN_BATTLE_TENT_CORRIDOR, 2, 7 - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 waitstate end diff --git a/data/maps/FallarborTown_CozmosHouse/scripts.inc b/data/maps/FallarborTown_CozmosHouse/scripts.inc index 61f297e69d3b..27b03436da8b 100644 --- a/data/maps/FallarborTown_CozmosHouse/scripts.inc +++ b/data/maps/FallarborTown_CozmosHouse/scripts.inc @@ -4,7 +4,7 @@ FallarborTown_CozmosHouse_MapScripts:: FallarborTown_CozmosHouse_EventScript_ProfCozmo:: lock faceplayer - goto_if_set FLAG_RECEIVED_TM27, FallarborTown_CozmosHouse_EventScript_GaveMeteorite + goto_if_set FLAG_RECEIVED_TM_RETURN, FallarborTown_CozmosHouse_EventScript_GaveMeteorite checkitem ITEM_METEORITE goto_if_eq VAR_RESULT, TRUE, FallarborTown_CozmosHouse_EventScript_PlayerHasMeteorite msgbox FallarborTown_CozmosHouse_Text_MeteoriteWillNeverBeMineNow, MSGBOX_DEFAULT @@ -16,11 +16,11 @@ FallarborTown_CozmosHouse_EventScript_PlayerHasMeteorite:: call_if_set FLAG_TEMP_2, FallarborTown_CozmosHouse_EventScript_AskForMeteorite goto_if_eq VAR_RESULT, NO, FallarborTown_CozmosHouse_EventScript_DeclineGiveMeteorite msgbox FallarborTown_CozmosHouse_Text_PleaseUseThisTM, MSGBOX_DEFAULT - giveitem ITEM_TM27 + giveitem ITEM_TM_RETURN goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull setvar VAR_0x8004, ITEM_METEORITE call Common_EventScript_PlayerHandedOverTheItem - setflag FLAG_RECEIVED_TM27 + setflag FLAG_RECEIVED_TM_RETURN msgbox FallarborTown_CozmosHouse_Text_ReallyGoingToHelpMyResearch, MSGBOX_DEFAULT release end @@ -48,7 +48,7 @@ FallarborTown_CozmosHouse_EventScript_GaveMeteorite:: FallarborTown_CozmosHouse_EventScript_CozmosWife:: lock faceplayer - goto_if_set FLAG_RECEIVED_TM27, FallarborTown_CozmosHouse_EventScript_CozmoIsHappy + goto_if_set FLAG_RECEIVED_TM_RETURN, FallarborTown_CozmosHouse_EventScript_CozmoIsHappy goto_if_set FLAG_DEFEATED_EVIL_TEAM_MT_CHIMNEY, FallarborTown_CozmosHouse_EventScript_CozmoIsSad msgbox FallarborTown_CozmosHouse_Text_CozmoWentToMeteorFalls, MSGBOX_DEFAULT release diff --git a/data/maps/FieryPath/map.json b/data/maps/FieryPath/map.json index 38b9aff75e38..69f5050ad52a 100644 --- a/data/maps/FieryPath/map.json +++ b/data/maps/FieryPath/map.json @@ -24,8 +24,8 @@ "movement_range_y": 1, "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", - "script": "FieryPath_EventScript_ItemTM06", - "flag": "FLAG_ITEM_FIERY_PATH_TM06" + "script": "FieryPath_EventScript_ItemTMToxic", + "flag": "FLAG_ITEM_FIERY_PATH_TM_TOXIC" }, { "graphics_id": "OBJ_EVENT_GFX_PUSHABLE_BOULDER", diff --git a/data/maps/FortreeCity_Gym/scripts.inc b/data/maps/FortreeCity_Gym/scripts.inc index 1c729bc44ec9..bb1e32a93a2f 100644 --- a/data/maps/FortreeCity_Gym/scripts.inc +++ b/data/maps/FortreeCity_Gym/scripts.inc @@ -11,6 +11,7 @@ FortreeCity_Gym_OnWarp: map_script_2 VAR_TEMP_0, VAR_TEMP_0, FortreeCity_Gym_EventScript_InitRotatingGates .2byte 0 +@ NOTE: This rotating gate puzzle makes use of VAR_TEMP_0 - VAR_TEMP_3 FortreeCity_Gym_EventScript_InitRotatingGates:: special RotatingGate_InitPuzzleAndGraphics end @@ -19,7 +20,7 @@ FortreeCity_Gym_EventScript_Winona:: trainerbattle_single TRAINER_WINONA_1, FortreeCity_Gym_Text_WinonaIntro, FortreeCity_Gym_Text_WinonaDefeat, FortreeCity_Gym_EventScript_WinonaDefeated, NO_MUSIC specialvar VAR_RESULT, ShouldTryRematchBattle goto_if_eq VAR_RESULT, TRUE, FortreeCity_Gym_EventScript_WinonaRematch - goto_if_unset FLAG_RECEIVED_TM40, FortreeCity_Gym_EventScript_GiveAerialAce2 + goto_if_unset FLAG_RECEIVED_TM_AERIAL_ACE, FortreeCity_Gym_EventScript_GiveAerialAce2 msgbox FortreeCity_Gym_Text_WinonaPostBattle, MSGBOX_DEFAULT release end @@ -48,18 +49,18 @@ FortreeCity_Gym_EventScript_WinonaDefeated:: end FortreeCity_Gym_EventScript_GiveAerialAce2:: - giveitem ITEM_TM40 + giveitem ITEM_TM_AERIAL_ACE goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull msgbox FortreeCity_Gym_Text_ExplainAerialAce, MSGBOX_DEFAULT - setflag FLAG_RECEIVED_TM40 + setflag FLAG_RECEIVED_TM_AERIAL_ACE release end FortreeCity_Gym_EventScript_GiveAerialAce:: - giveitem ITEM_TM40 + giveitem ITEM_TM_AERIAL_ACE goto_if_eq VAR_RESULT, FALSE, Common_EventScript_BagIsFull msgbox FortreeCity_Gym_Text_ExplainAerialAce, MSGBOX_DEFAULT - setflag FLAG_RECEIVED_TM40 + setflag FLAG_RECEIVED_TM_AERIAL_ACE return FortreeCity_Gym_EventScript_WinonaRematch:: diff --git a/data/maps/FortreeCity_House2/scripts.inc b/data/maps/FortreeCity_House2/scripts.inc index cdd0fc99f71d..a81a7a8e0a35 100644 --- a/data/maps/FortreeCity_House2/scripts.inc +++ b/data/maps/FortreeCity_House2/scripts.inc @@ -4,7 +4,7 @@ FortreeCity_House2_MapScripts:: FortreeCity_House2_EventScript_HiddenPowerGiver:: lock faceplayer - goto_if_set FLAG_RECEIVED_TM10, FortreeCity_House2_EventScript_ExplainHiddenPower + goto_if_set FLAG_RECEIVED_TM_HIDDEN_POWER, FortreeCity_House2_EventScript_ExplainHiddenPower call_if_unset FLAG_MET_HIDDEN_POWER_GIVER, FortreeCity_House2_EventScript_Greeting msgbox FortreeCity_House2_Text_CoinInWhichHand, MSGBOX_DEFAULT multichoice 21, 8, MULTI_RIGHTLEFT, TRUE @@ -19,9 +19,9 @@ FortreeCity_House2_EventScript_HiddenPowerGiver:: switch VAR_RESULT case 0, FortreeCity_House2_EventScript_WrongGuess msgbox FortreeCity_House2_Text_YourHiddenPowerHasAwoken, MSGBOX_DEFAULT - giveitem ITEM_TM10 + giveitem ITEM_TM_HIDDEN_POWER goto_if_eq VAR_RESULT, 0, Common_EventScript_ShowBagIsFull - setflag FLAG_RECEIVED_TM10 + setflag FLAG_RECEIVED_TM_HIDDEN_POWER msgbox FortreeCity_House2_Text_ExplainHiddenPower, MSGBOX_DEFAULT release end diff --git a/data/maps/GraniteCave_1F/scripts.inc b/data/maps/GraniteCave_1F/scripts.inc index 1bf81b997b22..ab0ccac21c82 100644 --- a/data/maps/GraniteCave_1F/scripts.inc +++ b/data/maps/GraniteCave_1F/scripts.inc @@ -4,10 +4,10 @@ GraniteCave_1F_MapScripts:: GraniteCave_1F_EventScript_Hiker:: lock faceplayer - goto_if_set FLAG_RECEIVED_HM05, GraniteCave_1F_EventScript_ReceivedFlash + goto_if_set FLAG_RECEIVED_HM_FLASH, GraniteCave_1F_EventScript_ReceivedFlash msgbox GraniteCave_1F_Text_GetsDarkAheadHereYouGo, MSGBOX_DEFAULT - giveitem ITEM_HM05 - setflag FLAG_RECEIVED_HM05 + giveitem ITEM_HM_FLASH + setflag FLAG_RECEIVED_HM_FLASH msgbox GraniteCave_1F_Text_ExplainFlash, MSGBOX_DEFAULT release end diff --git a/data/maps/GraniteCave_StevensRoom/scripts.inc b/data/maps/GraniteCave_StevensRoom/scripts.inc index 384e648ee262..eb32c2629305 100644 --- a/data/maps/GraniteCave_StevensRoom/scripts.inc +++ b/data/maps/GraniteCave_StevensRoom/scripts.inc @@ -11,7 +11,7 @@ GraniteCave_StevensRoom_EventScript_Steven:: call Common_EventScript_PlayerHandedOverTheItem setflag FLAG_DELIVERED_STEVEN_LETTER msgbox GraniteCave_StevensRoom_Text_ThankYouTakeThis, MSGBOX_DEFAULT - giveitem ITEM_TM47 + giveitem ITEM_TM_STEEL_WING call_if_eq VAR_RESULT, FALSE, GraniteCave_StevensRoom_EventScript_BagFull msgbox GraniteCave_StevensRoom_Text_CouldBecomeChampionLetsRegister, MSGBOX_DEFAULT closemessage diff --git a/data/maps/IslandCave/scripts.inc b/data/maps/IslandCave/scripts.inc index d15802aaa8d0..1bfadb9f2e01 100644 --- a/data/maps/IslandCave/scripts.inc +++ b/data/maps/IslandCave/scripts.inc @@ -51,10 +51,10 @@ IslandCave_EventScript_OpenRegiEntrance:: IslandCave_EventScript_CaveEntranceMiddle:: lockall - call_if_set FLAG_TEMP_3, IslandCave_EventScript_ClearSteps + call_if_set FLAG_TEMP_REGICE_PUZZLE_FAILED, IslandCave_EventScript_ClearSteps goto_if_set FLAG_SYS_BRAILLE_REGICE_COMPLETED, IslandCave_EventScript_BigHoleInWall braillemessage IslandCave_Braille_RunLapAroundWall - setflag FLAG_TEMP_2 + setflag FLAG_TEMP_REGICE_PUZZLE_STARTED special ShouldDoBrailleRegicePuzzle goto IslandCave_EventScript_CloseBrailleMsg end @@ -66,10 +66,10 @@ IslandCave_EventScript_BigHoleInWall:: IslandCave_EventScript_CaveEntranceSide:: lockall - call_if_set FLAG_TEMP_3, IslandCave_EventScript_ClearSteps + call_if_set FLAG_TEMP_REGICE_PUZZLE_FAILED, IslandCave_EventScript_ClearSteps braillemessage IslandCave_Braille_RunLapAroundWall goto_if_set FLAG_SYS_BRAILLE_REGICE_COMPLETED, IslandCave_EventScript_CloseBrailleMsg - setflag FLAG_TEMP_2 + setflag FLAG_TEMP_REGICE_PUZZLE_STARTED special ShouldDoBrailleRegicePuzzle goto IslandCave_EventScript_CloseBrailleMsg end @@ -84,7 +84,7 @@ IslandCave_EventScript_ClearSteps:: setvar VAR_REGICE_STEPS_1, 0 setvar VAR_REGICE_STEPS_2, 0 setvar VAR_REGICE_STEPS_3, 0 - clearflag FLAG_TEMP_3 + clearflag FLAG_TEMP_REGICE_PUZZLE_FAILED return IslandCave_EventScript_Regice:: diff --git a/data/maps/LavaridgeTown_Gym_1F/scripts.inc b/data/maps/LavaridgeTown_Gym_1F/scripts.inc index 530d6e959850..b7db13f54a0e 100644 --- a/data/maps/LavaridgeTown_Gym_1F/scripts.inc +++ b/data/maps/LavaridgeTown_Gym_1F/scripts.inc @@ -52,7 +52,7 @@ LavaridgeTown_Gym_1F_EventScript_Flannery:: trainerbattle_single TRAINER_FLANNERY_1, LavaridgeTown_Gym_1F_Text_FlanneryIntro, LavaridgeTown_Gym_1F_Text_FlanneryDefeat, LavaridgeTown_Gym_1F_EventScript_FlanneryDefeated, NO_MUSIC specialvar VAR_RESULT, ShouldTryRematchBattle goto_if_eq VAR_RESULT, TRUE, LavaridgeTown_Gym_1F_EventScript_FlanneryRematch - goto_if_unset FLAG_RECEIVED_TM50, LavaridgeTown_Gym_1F_EventScript_GiveOverheat2 + goto_if_unset FLAG_RECEIVED_TM_OVERHEAT, LavaridgeTown_Gym_1F_EventScript_GiveOverheat2 msgbox LavaridgeTown_Gym_1F_Text_FlanneryPostBattle, MSGBOX_DEFAULT release end @@ -84,18 +84,18 @@ LavaridgeTown_Gym_1F_EventScript_FlanneryDefeated:: end LavaridgeTown_Gym_1F_EventScript_GiveOverheat2:: - giveitem ITEM_TM50 + giveitem ITEM_TM_OVERHEAT goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull msgbox LavaridgeTown_Gym_1F_Text_ExplainOverheat, MSGBOX_DEFAULT - setflag FLAG_RECEIVED_TM50 + setflag FLAG_RECEIVED_TM_OVERHEAT release end LavaridgeTown_Gym_1F_EventScript_GiveOverheat:: - giveitem ITEM_TM50 + giveitem ITEM_TM_OVERHEAT goto_if_eq VAR_RESULT, FALSE, Common_EventScript_BagIsFull msgbox LavaridgeTown_Gym_1F_Text_ExplainOverheat, MSGBOX_DEFAULT - setflag FLAG_RECEIVED_TM50 + setflag FLAG_RECEIVED_TM_OVERHEAT return LavaridgeTown_Gym_1F_EventScript_FlanneryRematch:: diff --git a/data/maps/LilycoveCity_DepartmentStore_4F/scripts.inc b/data/maps/LilycoveCity_DepartmentStore_4F/scripts.inc index d176781d6e62..760abc600d33 100644 --- a/data/maps/LilycoveCity_DepartmentStore_4F/scripts.inc +++ b/data/maps/LilycoveCity_DepartmentStore_4F/scripts.inc @@ -25,10 +25,10 @@ LilycoveCity_DepartmentStore_4F_EventScript_ClerkLeft:: .align 2 LilycoveCity_DepartmentStore_4F_Pokemart_AttackTMs: - .2byte ITEM_TM38 @ Fire Blast - .2byte ITEM_TM25 @ Thunder - .2byte ITEM_TM14 @ Blizzard - .2byte ITEM_TM15 @ Hyper Beam + .2byte ITEM_TM_FIRE_BLAST + .2byte ITEM_TM_THUNDER + .2byte ITEM_TM_BLIZZARD + .2byte ITEM_TM_HYPER_BEAM .2byte ITEM_NONE release end @@ -45,10 +45,10 @@ LilycoveCity_DepartmentStore_4F_EventScript_ClerkRight:: .align 2 LilycoveCity_DepartmentStore_4F_Pokemart_DefenseTMs: - .2byte ITEM_TM17 @ Protect - .2byte ITEM_TM20 @ Safeguard - .2byte ITEM_TM33 @ Reflect - .2byte ITEM_TM16 @ Light Screen + .2byte ITEM_TM_PROTECT + .2byte ITEM_TM_SAFEGUARD + .2byte ITEM_TM_REFLECT + .2byte ITEM_TM_LIGHT_SCREEN .2byte ITEM_NONE release end diff --git a/data/maps/LilycoveCity_House2/scripts.inc b/data/maps/LilycoveCity_House2/scripts.inc index 965d82acfbcb..5d1bc8eaa81b 100644 --- a/data/maps/LilycoveCity_House2/scripts.inc +++ b/data/maps/LilycoveCity_House2/scripts.inc @@ -4,11 +4,11 @@ LilycoveCity_House2_MapScripts:: LilycoveCity_House2_EventScript_FatMan:: lock faceplayer - goto_if_set FLAG_RECEIVED_TM44, LilycoveCity_House2_EventScript_ReceivedRest + goto_if_set FLAG_RECEIVED_TM_REST, LilycoveCity_House2_EventScript_ReceivedRest msgbox LilycoveCity_House2_Text_NotAwakeYetHaveThis, MSGBOX_DEFAULT - giveitem ITEM_TM44 + giveitem ITEM_TM_REST goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull - setflag FLAG_RECEIVED_TM44 + setflag FLAG_RECEIVED_TM_REST msgbox LilycoveCity_House2_Text_SleepIsEssential, MSGBOX_DEFAULT release end diff --git a/data/maps/LittlerootTown_ProfessorBirchsLab/scripts.inc b/data/maps/LittlerootTown_ProfessorBirchsLab/scripts.inc index acf80f0e4082..0c8a468ab04e 100644 --- a/data/maps/LittlerootTown_ProfessorBirchsLab/scripts.inc +++ b/data/maps/LittlerootTown_ProfessorBirchsLab/scripts.inc @@ -339,7 +339,7 @@ LittlerootTown_ProfessorBirchsLab_EventScript_TakeYourTime:: LittlerootTown_ProfessorBirchsLab_EventScript_GiveCyndaquil:: bufferspeciesname STR_VAR_1, SPECIES_CYNDAQUIL - setvar VAR_TEMP_1, SPECIES_CYNDAQUIL + setvar VAR_TEMP_TRANSFERRED_SPECIES, SPECIES_CYNDAQUIL givemon SPECIES_CYNDAQUIL, 5 goto_if_eq VAR_RESULT, MON_GIVEN_TO_PARTY, LittlerootTown_ProfessorBirchsLab_EventScript_SendCyndaquilToParty goto_if_eq VAR_RESULT, MON_GIVEN_TO_PC, LittlerootTown_ProfessorBirchsLab_EventScript_SendCyndaquilToPC @@ -380,7 +380,7 @@ LittlerootTown_ProfessorBirchsLab_EventScript_ReceivedCyndaquil:: LittlerootTown_ProfessorBirchsLab_EventScript_GiveTotodile:: bufferspeciesname STR_VAR_1, SPECIES_TOTODILE - setvar VAR_TEMP_1, SPECIES_TOTODILE + setvar VAR_TEMP_TRANSFERRED_SPECIES, SPECIES_TOTODILE givemon SPECIES_TOTODILE, 5 goto_if_eq VAR_RESULT, MON_GIVEN_TO_PARTY, LittlerootTown_ProfessorBirchsLab_EventScript_SendTotodileToParty goto_if_eq VAR_RESULT, MON_GIVEN_TO_PC, LittlerootTown_ProfessorBirchsLab_EventScript_SendTotodileToPC @@ -421,7 +421,7 @@ LittlerootTown_ProfessorBirchsLab_EventScript_ReceivedTotodile:: LittlerootTown_ProfessorBirchsLab_EventScript_GiveChikorita:: bufferspeciesname STR_VAR_1, SPECIES_CHIKORITA - setvar VAR_TEMP_1, SPECIES_CHIKORITA + setvar VAR_TEMP_TRANSFERRED_SPECIES, SPECIES_CHIKORITA givemon SPECIES_CHIKORITA, 5 goto_if_eq VAR_RESULT, MON_GIVEN_TO_PARTY, LittlerootTown_ProfessorBirchsLab_EventScript_SendChikoritaToParty goto_if_eq VAR_RESULT, MON_GIVEN_TO_PC, LittlerootTown_ProfessorBirchsLab_EventScript_SendChikoritaToPC diff --git a/data/maps/MauvilleCity/scripts.inc b/data/maps/MauvilleCity/scripts.inc index 2ad39aec1c9e..921140270505 100644 --- a/data/maps/MauvilleCity/scripts.inc +++ b/data/maps/MauvilleCity/scripts.inc @@ -13,7 +13,7 @@ MauvilleCity_OnTransition: setflag FLAG_SYS_TV_START clearflag FLAG_MAUVILLE_GYM_BARRIERS_STATE setvar VAR_MAUVILLE_GYM_STATE, 0 - call_if_set FLAG_GOT_TM24_FROM_WATTSON, MauvilleCity_EventScript_MoveWattsonBackToGym + call_if_set FLAG_GOT_TM_THUNDERBOLT_FROM_WATTSON, MauvilleCity_EventScript_MoveWattsonBackToGym end MauvilleCity_EventScript_MoveWattsonBackToGym:: @@ -418,7 +418,7 @@ MauvilleCity_Movement_ScottExitEast: MauvilleCity_EventScript_Wattson:: lock faceplayer - goto_if_set FLAG_GOT_TM24_FROM_WATTSON, MauvilleCity_EventScript_ReceivedThunderbolt + goto_if_set FLAG_GOT_TM_THUNDERBOLT_FROM_WATTSON, MauvilleCity_EventScript_ReceivedThunderbolt goto_if_eq VAR_NEW_MAUVILLE_STATE, 2, MauvilleCity_EventScript_CompletedNewMauville goto_if_set FLAG_GOT_BASEMENT_KEY_FROM_WATTSON, MauvilleCity_EventScript_BegunNewMauville msgbox MauvilleCity_Text_WattsonNeedFavorTakeKey, MSGBOX_DEFAULT @@ -435,9 +435,9 @@ MauvilleCity_EventScript_BegunNewMauville:: MauvilleCity_EventScript_CompletedNewMauville:: msgbox MauvilleCity_Text_WattsonThanksTakeTM, MSGBOX_DEFAULT - giveitem ITEM_TM24 + giveitem ITEM_TM_THUNDERBOLT goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull - setflag FLAG_GOT_TM24_FROM_WATTSON + setflag FLAG_GOT_TM_THUNDERBOLT_FROM_WATTSON msgbox MauvilleCity_Text_WattsonYoungTakeCharge, MSGBOX_DEFAULT release end diff --git a/data/maps/MauvilleCity_GameCorner/scripts.inc b/data/maps/MauvilleCity_GameCorner/scripts.inc index b7c8603a3340..c9e425be73d5 100644 --- a/data/maps/MauvilleCity_GameCorner/scripts.inc +++ b/data/maps/MauvilleCity_GameCorner/scripts.inc @@ -2,12 +2,12 @@ MauvilleCity_GameCorner_MapScripts:: .byte 0 @ Game Corner prices - .set TM32_COINS, 1500 - .set TM29_COINS, 3500 - .set TM35_COINS, 4000 - .set TM24_COINS, 4000 - .set TM13_COINS, 4000 - .set DOLL_COINS, 1000 + .set TM_DOUBLE_TEAM_COINS, 1500 + .set TM_PSYCHIC_COINS, 3500 + .set TM_FLAMETHROWER_COINS, 4000 + .set TM_THUNDERBOLT_COINS, 4000 + .set TM_ICE_BEAM_COINS, 4000 + .set DOLL_COINS, 1000 .set COINS_PRICE_50, 1000 .set COINS_PRICE_500, 10000 @@ -236,43 +236,43 @@ MauvilleCity_GameCorner_EventScript_ReturnToChooseTMPrize:: MauvilleCity_GameCorner_EventScript_ChooseTMPrize:: multichoice 12, 0, MULTI_GAME_CORNER_TMS, FALSE switch VAR_RESULT - case 0, MauvilleCity_GameCorner_EventScript_TM32 - case 1, MauvilleCity_GameCorner_EventScript_TM29 - case 2, MauvilleCity_GameCorner_EventScript_TM35 - case 3, MauvilleCity_GameCorner_EventScript_TM24 - case 4, MauvilleCity_GameCorner_EventScript_TM13 + case 0, MauvilleCity_GameCorner_EventScript_TMDoubleTeam + case 1, MauvilleCity_GameCorner_EventScript_TMPsychic + case 2, MauvilleCity_GameCorner_EventScript_TMFlamethrower + case 3, MauvilleCity_GameCorner_EventScript_TMThunderbolt + case 4, MauvilleCity_GameCorner_EventScript_TMIceBeam case 5, MauvilleCity_GameCorner_EventScript_CancelTMSelect goto MauvilleCity_GameCorner_EventScript_CancelTMSelect end -MauvilleCity_GameCorner_EventScript_TM32:: +MauvilleCity_GameCorner_EventScript_TMDoubleTeam:: setvar VAR_TEMP_1, 1 - bufferitemname STR_VAR_1, ITEM_TM32 - setvar VAR_0x8004, ITEM_TM32 + bufferitemname STR_VAR_1, ITEM_TM_DOUBLE_TEAM + setvar VAR_0x8004, ITEM_TM_DOUBLE_TEAM goto MauvilleCity_GameCorner_EventScript_ConfirmTMPrize -MauvilleCity_GameCorner_EventScript_TM29:: +MauvilleCity_GameCorner_EventScript_TMPsychic:: setvar VAR_TEMP_1, 2 - bufferitemname STR_VAR_1, ITEM_TM29 - setvar VAR_0x8004, ITEM_TM29 + bufferitemname STR_VAR_1, ITEM_TM_PSYCHIC + setvar VAR_0x8004, ITEM_TM_PSYCHIC goto MauvilleCity_GameCorner_EventScript_ConfirmTMPrize -MauvilleCity_GameCorner_EventScript_TM35:: +MauvilleCity_GameCorner_EventScript_TMFlamethrower:: setvar VAR_TEMP_1, 3 - bufferitemname STR_VAR_1, ITEM_TM35 - setvar VAR_0x8004, ITEM_TM35 + bufferitemname STR_VAR_1, ITEM_TM_FLAMETHROWER + setvar VAR_0x8004, ITEM_TM_FLAMETHROWER goto MauvilleCity_GameCorner_EventScript_ConfirmTMPrize -MauvilleCity_GameCorner_EventScript_TM24:: +MauvilleCity_GameCorner_EventScript_TMThunderbolt:: setvar VAR_TEMP_1, 4 - bufferitemname STR_VAR_1, ITEM_TM24 - setvar VAR_0x8004, ITEM_TM24 + bufferitemname STR_VAR_1, ITEM_TM_THUNDERBOLT + setvar VAR_0x8004, ITEM_TM_THUNDERBOLT goto MauvilleCity_GameCorner_EventScript_ConfirmTMPrize -MauvilleCity_GameCorner_EventScript_TM13:: +MauvilleCity_GameCorner_EventScript_TMIceBeam:: setvar VAR_TEMP_1, 5 - bufferitemname STR_VAR_1, ITEM_TM13 - setvar VAR_0x8004, ITEM_TM13 + bufferitemname STR_VAR_1, ITEM_TM_ICE_BEAM + setvar VAR_0x8004, ITEM_TM_ICE_BEAM goto MauvilleCity_GameCorner_EventScript_ConfirmTMPrize MauvilleCity_GameCorner_EventScript_ConfirmTMPrize:: @@ -280,72 +280,72 @@ MauvilleCity_GameCorner_EventScript_ConfirmTMPrize:: msgbox MauvilleCity_GameCorner_Text_SoYourChoiceIsTheTMX, MSGBOX_YESNO goto_if_eq VAR_RESULT, NO, MauvilleCity_GameCorner_EventScript_CancelTMSelect switch VAR_TEMP_1 - case 1, MauvilleCity_GameCorner_EventScript_BuyTM32 - case 2, MauvilleCity_GameCorner_EventScript_BuyTM29 - case 3, MauvilleCity_GameCorner_EventScript_BuyTM35 - case 4, MauvilleCity_GameCorner_EventScript_BuyTM24 - case 5, MauvilleCity_GameCorner_EventScript_BuyTM13 + case 1, MauvilleCity_GameCorner_EventScript_BuyTMDoubleTeam + case 2, MauvilleCity_GameCorner_EventScript_BuyTMPsychic + case 3, MauvilleCity_GameCorner_EventScript_BuyTMFlamethrower + case 4, MauvilleCity_GameCorner_EventScript_BuyTMThunderbolt + case 5, MauvilleCity_GameCorner_EventScript_BuyTMIceBeam end -MauvilleCity_GameCorner_EventScript_BuyTM32:: +MauvilleCity_GameCorner_EventScript_BuyTMDoubleTeam:: checkcoins VAR_TEMP_2 - goto_if_lt VAR_TEMP_2, TM32_COINS, MauvilleCity_GameCorner_EventScript_NotEnoughCoinsForTM - checkitemspace ITEM_TM32 + goto_if_lt VAR_TEMP_2, TM_DOUBLE_TEAM_COINS, MauvilleCity_GameCorner_EventScript_NotEnoughCoinsForTM + checkitemspace ITEM_TM_DOUBLE_TEAM goto_if_eq VAR_RESULT, FALSE, MauvilleCity_GameCorner_EventScript_NoRoomForTM - removecoins TM32_COINS - additem ITEM_TM32 + removecoins TM_DOUBLE_TEAM_COINS + additem ITEM_TM_DOUBLE_TEAM updatecoinsbox 1, 1 playse SE_SHOP msgbox MauvilleCity_GameCorner_Text_HereYouGo, MSGBOX_DEFAULT goto MauvilleCity_GameCorner_EventScript_ReturnToChooseTMPrize end -MauvilleCity_GameCorner_EventScript_BuyTM29:: +MauvilleCity_GameCorner_EventScript_BuyTMPsychic:: checkcoins VAR_TEMP_2 - goto_if_lt VAR_TEMP_2, TM29_COINS, MauvilleCity_GameCorner_EventScript_NotEnoughCoinsForTM - checkitemspace ITEM_TM29 + goto_if_lt VAR_TEMP_2, TM_PSYCHIC_COINS, MauvilleCity_GameCorner_EventScript_NotEnoughCoinsForTM + checkitemspace ITEM_TM_PSYCHIC goto_if_eq VAR_RESULT, FALSE, MauvilleCity_GameCorner_EventScript_NoRoomForTM - removecoins TM29_COINS - additem ITEM_TM29 + removecoins TM_PSYCHIC_COINS + additem ITEM_TM_PSYCHIC updatecoinsbox 1, 1 playse SE_SHOP msgbox MauvilleCity_GameCorner_Text_HereYouGo, MSGBOX_DEFAULT goto MauvilleCity_GameCorner_EventScript_ReturnToChooseTMPrize end -MauvilleCity_GameCorner_EventScript_BuyTM35:: +MauvilleCity_GameCorner_EventScript_BuyTMFlamethrower:: checkcoins VAR_TEMP_2 - goto_if_lt VAR_TEMP_2, TM35_COINS, MauvilleCity_GameCorner_EventScript_NotEnoughCoinsForTM - checkitemspace ITEM_TM35 + goto_if_lt VAR_TEMP_2, TM_FLAMETHROWER_COINS, MauvilleCity_GameCorner_EventScript_NotEnoughCoinsForTM + checkitemspace ITEM_TM_FLAMETHROWER goto_if_eq VAR_RESULT, FALSE, MauvilleCity_GameCorner_EventScript_NoRoomForTM - removecoins TM35_COINS - additem ITEM_TM35 + removecoins TM_FLAMETHROWER_COINS + additem ITEM_TM_FLAMETHROWER updatecoinsbox 1, 1 playse SE_SHOP msgbox MauvilleCity_GameCorner_Text_HereYouGo, MSGBOX_DEFAULT goto MauvilleCity_GameCorner_EventScript_ReturnToChooseTMPrize end -MauvilleCity_GameCorner_EventScript_BuyTM24:: +MauvilleCity_GameCorner_EventScript_BuyTMThunderbolt:: checkcoins VAR_TEMP_2 - goto_if_lt VAR_TEMP_2, TM24_COINS, MauvilleCity_GameCorner_EventScript_NotEnoughCoinsForTM - checkitemspace ITEM_TM24 + goto_if_lt VAR_TEMP_2, TM_THUNDERBOLT_COINS, MauvilleCity_GameCorner_EventScript_NotEnoughCoinsForTM + checkitemspace ITEM_TM_THUNDERBOLT goto_if_eq VAR_RESULT, FALSE, MauvilleCity_GameCorner_EventScript_NoRoomForTM - removecoins TM24_COINS - additem ITEM_TM24 + removecoins TM_THUNDERBOLT_COINS + additem ITEM_TM_THUNDERBOLT updatecoinsbox 1, 1 playse SE_SHOP msgbox MauvilleCity_GameCorner_Text_HereYouGo, MSGBOX_DEFAULT goto MauvilleCity_GameCorner_EventScript_ReturnToChooseTMPrize end -MauvilleCity_GameCorner_EventScript_BuyTM13:: +MauvilleCity_GameCorner_EventScript_BuyTMIceBeam:: checkcoins VAR_TEMP_2 - goto_if_lt VAR_TEMP_2, TM13_COINS, MauvilleCity_GameCorner_EventScript_NotEnoughCoinsForTM - checkitemspace ITEM_TM13 + goto_if_lt VAR_TEMP_2, TM_ICE_BEAM_COINS, MauvilleCity_GameCorner_EventScript_NotEnoughCoinsForTM + checkitemspace ITEM_TM_ICE_BEAM goto_if_eq VAR_RESULT, FALSE, MauvilleCity_GameCorner_EventScript_NoRoomForTM - removecoins TM13_COINS - additem ITEM_TM13 + removecoins TM_ICE_BEAM_COINS + additem ITEM_TM_ICE_BEAM updatecoinsbox 1, 1 playse SE_SHOP msgbox MauvilleCity_GameCorner_Text_HereYouGo, MSGBOX_DEFAULT diff --git a/data/maps/MauvilleCity_Gym/scripts.inc b/data/maps/MauvilleCity_Gym/scripts.inc index de924d7d93c3..433c45bf81d7 100644 --- a/data/maps/MauvilleCity_Gym/scripts.inc +++ b/data/maps/MauvilleCity_Gym/scripts.inc @@ -77,7 +77,7 @@ MauvilleCity_Gym_EventScript_Wattson:: trainerbattle_single TRAINER_WATTSON_1, MauvilleCity_Gym_Text_WattsonIntro, MauvilleCity_Gym_Text_WattsonDefeat, MauvilleCity_Gym_EventScript_WattsonDefeated, NO_MUSIC specialvar VAR_RESULT, ShouldTryRematchBattle goto_if_eq VAR_RESULT, TRUE, MauvilleCity_Gym_EventScript_WattsonRematch - goto_if_unset FLAG_RECEIVED_TM34, MauvilleCity_Gym_EventScript_GiveShockWave2 + goto_if_unset FLAG_RECEIVED_TM_SHOCK_WAVE, MauvilleCity_Gym_EventScript_GiveShockWave2 goto_if_eq VAR_NEW_MAUVILLE_STATE, 2, MauvilleCity_Gym_EventScript_CompletedNewMauville msgbox MauvilleCity_Gym_Text_WattsonPostBattle, MSGBOX_DEFAULT release @@ -112,18 +112,18 @@ MauvilleCity_Gym_EventScript_WattsonDefeated:: end MauvilleCity_Gym_EventScript_GiveShockWave2:: - giveitem ITEM_TM34 + giveitem ITEM_TM_SHOCK_WAVE goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull msgbox MauvilleCity_Gym_Text_ExplainShockWave, MSGBOX_DEFAULT - setflag FLAG_RECEIVED_TM34 + setflag FLAG_RECEIVED_TM_SHOCK_WAVE release end MauvilleCity_Gym_EventScript_GiveShockWave:: - giveitem ITEM_TM34 + giveitem ITEM_TM_SHOCK_WAVE goto_if_eq VAR_RESULT, FALSE, Common_EventScript_BagIsFull msgbox MauvilleCity_Gym_Text_ExplainShockWave, MSGBOX_DEFAULT - setflag FLAG_RECEIVED_TM34 + setflag FLAG_RECEIVED_TM_SHOCK_WAVE return MauvilleCity_Gym_EventScript_CompletedNewMauville:: diff --git a/data/maps/MauvilleCity_House1/scripts.inc b/data/maps/MauvilleCity_House1/scripts.inc index d0d3481a663a..2e4e9abcbc9d 100644 --- a/data/maps/MauvilleCity_House1/scripts.inc +++ b/data/maps/MauvilleCity_House1/scripts.inc @@ -4,10 +4,10 @@ MauvilleCity_House1_MapScripts:: MauvilleCity_House1_EventScript_RockSmashDude:: lock faceplayer - goto_if_set FLAG_RECEIVED_HM06, MauvilleCity_House1_EventScript_ReceivedRockSmash + goto_if_set FLAG_RECEIVED_HM_ROCK_SMASH, MauvilleCity_House1_EventScript_ReceivedRockSmash msgbox MauvilleCity_House1_Text_ImRockSmashDudeTakeThis, MSGBOX_DEFAULT - giveitem ITEM_HM06 - setflag FLAG_RECEIVED_HM06 + giveitem ITEM_HM_ROCK_SMASH + setflag FLAG_RECEIVED_HM_ROCK_SMASH setflag FLAG_HIDE_ROUTE_111_ROCK_SMASH_TIP_GUY msgbox MauvilleCity_House1_Text_ExplainRockSmash, MSGBOX_DEFAULT release diff --git a/data/maps/MeteorFalls_1F_1R/map.json b/data/maps/MeteorFalls_1F_1R/map.json index 71f1d1cc5bb8..e0d32c580480 100644 --- a/data/maps/MeteorFalls_1F_1R/map.json +++ b/data/maps/MeteorFalls_1F_1R/map.json @@ -24,8 +24,8 @@ "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", - "script": "MeteorFalls_1F_1R_EventScript_ItemTM23", - "flag": "FLAG_ITEM_METEOR_FALLS_1F_1R_TM23" + "script": "MeteorFalls_1F_1R_EventScript_ItemTMIronTail", + "flag": "FLAG_ITEM_METEOR_FALLS_1F_1R_TM_IRON_TAIL" }, { "graphics_id": "OBJ_EVENT_GFX_ITEM_BALL", diff --git a/data/maps/MeteorFalls_B1F_2R/map.json b/data/maps/MeteorFalls_B1F_2R/map.json index 8d153c423957..79a89874e958 100644 --- a/data/maps/MeteorFalls_B1F_2R/map.json +++ b/data/maps/MeteorFalls_B1F_2R/map.json @@ -24,8 +24,8 @@ "movement_range_y": 1, "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", - "script": "MeteorFalls_B1F_2R_EventScript_ItemTM02", - "flag": "FLAG_ITEM_METEOR_FALLS_B1F_2R_TM02" + "script": "MeteorFalls_B1F_2R_EventScript_ItemTMDragonClaw", + "flag": "FLAG_ITEM_METEOR_FALLS_B1F_2R_TM_DRAGON_CLAW" } ], "warp_events": [ diff --git a/data/maps/MossdeepCity/scripts.inc b/data/maps/MossdeepCity/scripts.inc index 836490cbddb2..a03b1db8201a 100644 --- a/data/maps/MossdeepCity/scripts.inc +++ b/data/maps/MossdeepCity/scripts.inc @@ -20,7 +20,7 @@ MossdeepCity_OnTransition: MossdeepCity_EventScript_PokefanF:: lock faceplayer - goto_if_set FLAG_RECEIVED_HM08, MossdeepCity_EventScript_PokefanFMagmaGone + goto_if_set FLAG_RECEIVED_HM_DIVE, MossdeepCity_EventScript_PokefanFMagmaGone msgbox MossdeepCity_Text_SpaceCenterReceivedLetter, MSGBOX_DEFAULT release end @@ -33,7 +33,7 @@ MossdeepCity_EventScript_PokefanFMagmaGone:: MossdeepCity_EventScript_Sailor:: lock faceplayer - goto_if_set FLAG_RECEIVED_HM08, MossdeepCity_EventScript_SailorMagmaGone + goto_if_set FLAG_RECEIVED_HM_DIVE, MossdeepCity_EventScript_SailorMagmaGone msgbox MossdeepCity_Text_MossdeepTargetedByMagma, MSGBOX_DEFAULT release end diff --git a/data/maps/MossdeepCity_Gym/scripts.inc b/data/maps/MossdeepCity_Gym/scripts.inc index 8892097dee48..f2d08c13b163 100644 --- a/data/maps/MossdeepCity_Gym/scripts.inc +++ b/data/maps/MossdeepCity_Gym/scripts.inc @@ -52,7 +52,7 @@ MossdeepCity_Gym_EventScript_TateAndLiza:: trainerbattle_double TRAINER_TATE_AND_LIZA_1, MossdeepCity_Gym_Text_TateAndLizaIntro, MossdeepCity_Gym_Text_TateAndLizaDefeat, MossdeepCity_Gym_Text_TateAndLizaNeedTwoMons, MossdeepCity_Gym_EventScript_TateAndLizaDefeated, NO_MUSIC specialvar VAR_RESULT, ShouldTryRematchBattle goto_if_eq VAR_RESULT, TRUE, MossdeepCity_Gym_EventScript_TateAndLizaRematch - goto_if_unset FLAG_RECEIVED_TM04, MossdeepCity_Gym_EventScript_GiveCalmMind2 + goto_if_unset FLAG_RECEIVED_TM_CALM_MIND, MossdeepCity_Gym_EventScript_GiveCalmMind2 msgbox MossdeepCity_Gym_Text_TateAndLizaPostBattle, MSGBOX_DEFAULT release end @@ -90,18 +90,18 @@ MossdeepCity_Gym_EventScript_TateAndLizaDefeated:: end MossdeepCity_Gym_EventScript_GiveCalmMind2:: - giveitem ITEM_TM04 + giveitem ITEM_TM_CALM_MIND goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull msgbox MossdeepCity_Gym_Text_ExplainCalmMind, MSGBOX_DEFAULT - setflag FLAG_RECEIVED_TM04 + setflag FLAG_RECEIVED_TM_CALM_MIND release end MossdeepCity_Gym_EventScript_GiveCalmMind:: - giveitem ITEM_TM04 + giveitem ITEM_TM_CALM_MIND goto_if_eq VAR_RESULT, FALSE, Common_EventScript_BagIsFull msgbox MossdeepCity_Gym_Text_ExplainCalmMind, MSGBOX_DEFAULT - setflag FLAG_RECEIVED_TM04 + setflag FLAG_RECEIVED_TM_CALM_MIND return MossdeepCity_Gym_EventScript_TateAndLizaRematch:: diff --git a/data/maps/MossdeepCity_StevensHouse/scripts.inc b/data/maps/MossdeepCity_StevensHouse/scripts.inc index 0470e977a6be..0f9255e5b664 100644 --- a/data/maps/MossdeepCity_StevensHouse/scripts.inc +++ b/data/maps/MossdeepCity_StevensHouse/scripts.inc @@ -40,8 +40,8 @@ MossdeepCity_StevensHouse_EventScript_StevenGivesDive:: applymovement LOCALID_STEVEN, MossdeepCity_StevensHouse_Movement_StevenApproachPlayer waitmovement 0 msgbox MossdeepCity_StevensHouse_Text_YouveEarnedHMDive, MSGBOX_DEFAULT - giveitem ITEM_HM08 - setflag FLAG_RECEIVED_HM08 + giveitem ITEM_HM_DIVE + setflag FLAG_RECEIVED_HM_DIVE setflag FLAG_OMIT_DIVE_FROM_STEVEN_LETTER msgbox MossdeepCity_StevensHouse_Text_ExplainDive, MSGBOX_DEFAULT closemessage @@ -85,7 +85,7 @@ MossdeepCity_StevensHouse_EventScript_LeaveBeldum:: end MossdeepCity_StevensHouse_EventScript_GiveBeldum:: - setvar VAR_TEMP_1, SPECIES_BELDUM + setvar VAR_TEMP_TRANSFERRED_SPECIES, SPECIES_BELDUM givemon SPECIES_BELDUM, 5 goto_if_eq VAR_RESULT, MON_GIVEN_TO_PARTY, MossdeepCity_StevensHouse_EventScript_SendBeldumParty goto_if_eq VAR_RESULT, MON_GIVEN_TO_PC, MossdeepCity_StevensHouse_EventScript_SendBeldumPC @@ -146,8 +146,8 @@ MossdeepCity_StevensHouse_EventScript_Letter:: @ Unused, leftover from RS MossdeepCity_StevensHouse_EventScript_DiveItemBall:: - finditem ITEM_HM08 - setflag FLAG_RECEIVED_HM08 + finditem ITEM_HM_DIVE + setflag FLAG_RECEIVED_HM_DIVE end MossdeepCity_StevensHouse_Text_YouveEarnedHMDive: diff --git a/data/maps/MtPyre_6F/map.json b/data/maps/MtPyre_6F/map.json index 9da33f4bc6bb..06bd940eac08 100644 --- a/data/maps/MtPyre_6F/map.json +++ b/data/maps/MtPyre_6F/map.json @@ -37,8 +37,8 @@ "movement_range_y": 1, "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", - "script": "MtPyre_6F_EventScript_ItemTM30", - "flag": "FLAG_ITEM_MT_PYRE_6F_TM30" + "script": "MtPyre_6F_EventScript_ItemTMShadowBall", + "flag": "FLAG_ITEM_MT_PYRE_6F_TM_SHADOW_BALL" }, { "graphics_id": "OBJ_EVENT_GFX_PSYCHIC_M", diff --git a/data/maps/MtPyre_Exterior/map.json b/data/maps/MtPyre_Exterior/map.json index 417a38d977be..a65f1259d4eb 100644 --- a/data/maps/MtPyre_Exterior/map.json +++ b/data/maps/MtPyre_Exterior/map.json @@ -37,8 +37,8 @@ "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", - "script": "MtPyre_Exterior_EventScript_ItemTM48", - "flag": "FLAG_ITEM_MT_PYRE_EXTERIOR_TM48" + "script": "MtPyre_Exterior_EventScript_ItemTMSkillSwap", + "flag": "FLAG_ITEM_MT_PYRE_EXTERIOR_TM_SKILL_SWAP" } ], "warp_events": [ diff --git a/data/maps/PacifidlogTown_House2/scripts.inc b/data/maps/PacifidlogTown_House2/scripts.inc index 175b477e7a4c..3acb7583e813 100644 --- a/data/maps/PacifidlogTown_House2/scripts.inc +++ b/data/maps/PacifidlogTown_House2/scripts.inc @@ -38,7 +38,7 @@ PacifidlogTown_House2_EventScript_ClearReceivedFanClubTM:: PacifidlogTown_House2_EventScript_GiveReturn:: msgbox PacifidlogTown_House2_Text_AdoringPokemonTakeThis, MSGBOX_DEFAULT - giveitem ITEM_TM27 + giveitem ITEM_TM_RETURN goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull setflag FLAG_RECEIVED_FANCLUB_TM_THIS_WEEK special SetPacifidlogTMReceivedDay @@ -53,7 +53,7 @@ PacifidlogTown_House2_EventScript_PutInEffort:: PacifidlogTown_House2_EventScript_GiveFrustration:: msgbox PacifidlogTown_House2_Text_ViciousPokemonTakeThis, MSGBOX_DEFAULT - giveitem ITEM_TM21 + giveitem ITEM_TM_FRUSTRATION goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull setflag FLAG_RECEIVED_FANCLUB_TM_THIS_WEEK special SetPacifidlogTMReceivedDay diff --git a/data/maps/PetalburgCity_Gym/scripts.inc b/data/maps/PetalburgCity_Gym/scripts.inc index f2489b7dbb9c..f61c518fe070 100644 --- a/data/maps/PetalburgCity_Gym/scripts.inc +++ b/data/maps/PetalburgCity_Gym/scripts.inc @@ -332,7 +332,7 @@ PetalburgCity_Gym_EventScript_NormanFaceDoorEast:: PetalburgCity_Gym_EventScript_NormanPostBattle:: call PetalburgCity_Gym_EventScript_ShouldGiveEnigmaBerry goto_if_eq VAR_RESULT, TRUE, PetalburgCity_Gym_EventScript_GiveEnigmaBerry - goto_if_unset FLAG_RECEIVED_TM42, PetalburgCity_Gym_EventScript_GiveFacade2 + goto_if_unset FLAG_RECEIVED_TM_FACADE, PetalburgCity_Gym_EventScript_GiveFacade2 goto_if_set FLAG_SYS_GAME_CLEAR, PetalburgCity_Gym_EventScript_NoAmountOfTrainingIsEnough msgbox PetalburgCity_Gym_Text_DadGoingToKeepTraining, MSGBOX_DEFAULT release @@ -405,9 +405,9 @@ PetalburgCity_Gym_EventScript_NormanBattle:: end PetalburgCity_Gym_EventScript_GiveFacade:: - giveitem ITEM_TM42 + giveitem ITEM_TM_FACADE goto_if_eq VAR_RESULT, FALSE, Common_EventScript_BagIsFull - setflag FLAG_RECEIVED_TM42 + setflag FLAG_RECEIVED_TM_FACADE msgbox PetalburgCity_Gym_Text_ExplainFacade, MSGBOX_DEFAULT return diff --git a/data/maps/PetalburgCity_WallysHouse/scripts.inc b/data/maps/PetalburgCity_WallysHouse/scripts.inc index 3a06208a78c9..f7e2e97828cb 100644 --- a/data/maps/PetalburgCity_WallysHouse/scripts.inc +++ b/data/maps/PetalburgCity_WallysHouse/scripts.inc @@ -15,14 +15,14 @@ PetalburgCity_WallysHouse_EventScript_PlayerWallysDadFaceEachOther:: end PetalburgCity_WallysHouse_OnFrame: - map_script_2 VAR_PETALBURG_CITY_STATE, 4, PetalburgCity_WallysHouse_EventScript_GiveHM03Surf + map_script_2 VAR_PETALBURG_CITY_STATE, 4, PetalburgCity_WallysHouse_EventScript_GiveHMSurf .2byte 0 -PetalburgCity_WallysHouse_EventScript_GiveHM03Surf:: +PetalburgCity_WallysHouse_EventScript_GiveHMSurf:: lockall msgbox PetalburgCity_WallysHouse_Text_PleaseExcuseUs, MSGBOX_DEFAULT - giveitem ITEM_HM03 - setflag FLAG_RECEIVED_HM03 + giveitem ITEM_HM_SURF + setflag FLAG_RECEIVED_HM_SURF msgbox PetalburgCity_WallysHouse_Text_SurfGoAllSortsOfPlaces, MSGBOX_DEFAULT setvar VAR_PETALBURG_CITY_STATE, 5 releaseall @@ -32,14 +32,14 @@ PetalburgCity_WallysHouse_EventScript_WallysDad:: lock faceplayer goto_if_set FLAG_DEFEATED_WALLY_VICTORY_ROAD, PetalburgCity_WallysHouse_EventScript_DefeatedWallyInVictoryRoad - goto_if_set FLAG_RECEIVED_HM03, PetalburgCity_WallysHouse_EventScript_ReceievedHM03Surf + goto_if_set FLAG_RECEIVED_HM_SURF, PetalburgCity_WallysHouse_EventScript_ReceievedHMSurf goto_if_set FLAG_THANKED_FOR_PLAYING_WITH_WALLY, PetalburgCity_WallysHouse_EventScript_PlayedWithWally msgbox PetalburgCity_WallysHouse_Text_ThanksForPlayingWithWally, MSGBOX_DEFAULT setflag FLAG_THANKED_FOR_PLAYING_WITH_WALLY release end -PetalburgCity_WallysHouse_EventScript_ReceievedHM03Surf:: +PetalburgCity_WallysHouse_EventScript_ReceievedHMSurf:: msgbox PetalburgCity_WallysHouse_Text_WallyIsComingHomeSoon, MSGBOX_DEFAULT release end @@ -57,12 +57,12 @@ PetalburgCity_WallysHouse_EventScript_PlayedWithWally:: PetalburgCity_WallysHouse_EventScript_WallysMom:: lock faceplayer - goto_if_set FLAG_RECEIVED_HM03, PetalburgCity_WallysHouse_EventScript_ReceivedHM03Surf + goto_if_set FLAG_RECEIVED_HM_SURF, PetalburgCity_WallysHouse_EventScript_ReceivedHMSurf msgbox PetalburgCity_WallysHouse_Text_WallyWasReallyHappy, MSGBOX_DEFAULT release end -PetalburgCity_WallysHouse_EventScript_ReceivedHM03Surf:: +PetalburgCity_WallysHouse_EventScript_ReceivedHMSurf:: msgbox PetalburgCity_WallysHouse_Text_WallyLeftWithoutTelling, MSGBOX_DEFAULT release end diff --git a/data/maps/Route104/scripts.inc b/data/maps/Route104/scripts.inc index 68aeb0a21258..dfb7675e9048 100644 --- a/data/maps/Route104/scripts.inc +++ b/data/maps/Route104/scripts.inc @@ -329,11 +329,11 @@ Route104_EventScript_Woman:: Route104_EventScript_Boy2:: lock faceplayer - goto_if_set FLAG_RECEIVED_TM09, Route104_EventScript_ReceivedBulletSeed + goto_if_set FLAG_RECEIVED_TM_BULLET_SEED, Route104_EventScript_ReceivedBulletSeed msgbox Route104_Text_LikeFillingMouthWithSeedsTakeThis, MSGBOX_DEFAULT - giveitem ITEM_TM09 + giveitem ITEM_TM_BULLET_SEED goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull - setflag FLAG_RECEIVED_TM09 + setflag FLAG_RECEIVED_TM_BULLET_SEED release end diff --git a/data/maps/Route110_TrickHouseEnd/scripts.inc b/data/maps/Route110_TrickHouseEnd/scripts.inc index be8f75e961ea..9f31d89e4cfb 100644 --- a/data/maps/Route110_TrickHouseEnd/scripts.inc +++ b/data/maps/Route110_TrickHouseEnd/scripts.inc @@ -109,7 +109,7 @@ Route110_TrickHouseEnd_EventScript_CompletedPuzzle5:: msgbox Route110_TrickHouseEnd_Text_AllNightToMakeMechadolls, MSGBOX_DEFAULT msgbox Route110_TrickHouseEnd_Text_YouHaveEarnedThisReward, MSGBOX_DEFAULT setvar VAR_TRICK_HOUSE_PRIZE_PICKUP, 0 - giveitem ITEM_TM12 + giveitem ITEM_TM_TAUNT call_if_eq VAR_RESULT, FALSE, Route110_TrickHouseEnd_EventScript_BagFull msgbox Route110_TrickHouseEnd_Text_MakeNewTricksToStumpYou, MSGBOX_DEFAULT closemessage diff --git a/data/maps/Route110_TrickHouseEntrance/scripts.inc b/data/maps/Route110_TrickHouseEntrance/scripts.inc index 52327553e34c..51135ac339c6 100644 --- a/data/maps/Route110_TrickHouseEntrance/scripts.inc +++ b/data/maps/Route110_TrickHouseEntrance/scripts.inc @@ -370,7 +370,7 @@ Route110_TrickHouseEntrance_EventScript_GivePuzzle4Reward:: end Route110_TrickHouseEntrance_EventScript_GivePuzzle5Reward:: - giveitem ITEM_TM12 + giveitem ITEM_TM_TAUNT goto_if_eq VAR_RESULT, TRUE, Route110_TrickHouseEntrance_EventScript_GotReward call_if_eq VAR_RESULT, FALSE, Common_EventScript_BagIsFull msgbox Route110_TrickHouseEntrance_Text_DidYouNotComeToClaimReward, MSGBOX_DEFAULT diff --git a/data/maps/Route110_TrickHousePuzzle6/scripts.inc b/data/maps/Route110_TrickHousePuzzle6/scripts.inc index e442d094d59f..3a6d221e4318 100644 --- a/data/maps/Route110_TrickHousePuzzle6/scripts.inc +++ b/data/maps/Route110_TrickHousePuzzle6/scripts.inc @@ -11,6 +11,7 @@ Route110_TrickHousePuzzle6_OnWarp: map_script_2 VAR_TEMP_0, VAR_TEMP_0, Route110_TrickHousePuzzle6_EventScript_InitPuzzle .2byte 0 +@ NOTE: This rotating gate puzzle makes use of VAR_TEMP_0 - VAR_TEMP_5 Route110_TrickHousePuzzle6_EventScript_InitPuzzle:: special RotatingGate_InitPuzzleAndGraphics end diff --git a/data/maps/Route111/map.json b/data/maps/Route111/map.json index bc476ebaafb5..6efa1770e280 100644 --- a/data/maps/Route111/map.json +++ b/data/maps/Route111/map.json @@ -261,8 +261,8 @@ "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", - "script": "Route111_EventScript_ItemTM37", - "flag": "FLAG_ITEM_ROUTE_111_TM37" + "script": "Route111_EventScript_ItemTMSandstorm", + "flag": "FLAG_ITEM_ROUTE_111_TM_SANDSTORM" }, { "graphics_id": "OBJ_EVENT_GFX_BERRY_TREE", diff --git a/data/maps/Route113/map.json b/data/maps/Route113/map.json index 4c45d904cb60..2e5890d656a1 100644 --- a/data/maps/Route113/map.json +++ b/data/maps/Route113/map.json @@ -450,8 +450,8 @@ "x": 22, "y": 5, "elevation": 3, - "item": "ITEM_TM32", - "flag": "FLAG_HIDDEN_ITEM_ROUTE_113_TM32" + "item": "ITEM_TM_DOUBLE_TEAM", + "flag": "FLAG_HIDDEN_ITEM_ROUTE_113_TM_DOUBLE_TEAM" }, { "type": "hidden_item", diff --git a/data/maps/Route114/scripts.inc b/data/maps/Route114/scripts.inc index abf70ea08163..db46f7bb80b3 100644 --- a/data/maps/Route114/scripts.inc +++ b/data/maps/Route114/scripts.inc @@ -43,11 +43,11 @@ Route114_EventScript_ReceivedBerry:: Route114_EventScript_RoarGentleman:: lock faceplayer - goto_if_set FLAG_RECEIVED_TM05, Route114_EventScript_ReceivedRoar + goto_if_set FLAG_RECEIVED_TM_ROAR, Route114_EventScript_ReceivedRoar msgbox Route114_Text_AllMyMonDoesIsRoarTakeThis, MSGBOX_DEFAULT - giveitem ITEM_TM05 + giveitem ITEM_TM_ROAR goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull - setflag FLAG_RECEIVED_TM05 + setflag FLAG_RECEIVED_TM_ROAR msgbox Route114_Text_ExplainRoar, MSGBOX_DEFAULT release end diff --git a/data/maps/Route114_FossilManiacsHouse/scripts.inc b/data/maps/Route114_FossilManiacsHouse/scripts.inc index ba3c0c60e591..2586ea1076b1 100644 --- a/data/maps/Route114_FossilManiacsHouse/scripts.inc +++ b/data/maps/Route114_FossilManiacsHouse/scripts.inc @@ -9,11 +9,11 @@ Route114_FossilManiacsHouse_OnTransition: Route114_FossilManiacsHouse_EventScript_FossilManiacsBrother:: lock faceplayer - goto_if_set FLAG_RECEIVED_TM28, Route114_FossilManiacsHouse_EventScript_ReceivedDig + goto_if_set FLAG_RECEIVED_TM_DIG, Route114_FossilManiacsHouse_EventScript_ReceivedDig msgbox Route114_FossilManiacsHouse_Text_HaveThisToDigLikeMyBrother, MSGBOX_DEFAULT - giveitem ITEM_TM28 + giveitem ITEM_TM_DIG goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull - setflag FLAG_RECEIVED_TM28 + setflag FLAG_RECEIVED_TM_DIG release end diff --git a/data/maps/Route115/map.json b/data/maps/Route115/map.json index a4143fad3001..ee0d71349dcf 100644 --- a/data/maps/Route115/map.json +++ b/data/maps/Route115/map.json @@ -165,8 +165,8 @@ "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", - "script": "Route115_EventScript_ItemTM01", - "flag": "FLAG_ITEM_ROUTE_115_TM01" + "script": "Route115_EventScript_ItemTMFocusPunch", + "flag": "FLAG_ITEM_ROUTE_115_TM_FOCUS_PUNCH" }, { "graphics_id": "OBJ_EVENT_GFX_ITEM_BALL", diff --git a/data/maps/Route119/scripts.inc b/data/maps/Route119/scripts.inc index 94094206c703..6c9767dcb625 100644 --- a/data/maps/Route119/scripts.inc +++ b/data/maps/Route119/scripts.inc @@ -132,8 +132,8 @@ Route119_EventScript_DefeatedBrendan:: end Route119_EventScript_GiveFlyHM:: - giveitem ITEM_HM02 - setflag FLAG_RECEIVED_HM02 + giveitem ITEM_HM_FLY + setflag FLAG_RECEIVED_HM_FLY return Route119_EventScript_RivalExitScottArrive:: diff --git a/data/maps/Route119_WeatherInstitute_2F/scripts.inc b/data/maps/Route119_WeatherInstitute_2F/scripts.inc index 2060cb03c9b7..e5df03d4a1ab 100644 --- a/data/maps/Route119_WeatherInstitute_2F/scripts.inc +++ b/data/maps/Route119_WeatherInstitute_2F/scripts.inc @@ -88,7 +88,7 @@ Route119_WeatherInstitute_2F_EventScript_ShellyDefeated:: Route119_WeatherInstitute_2F_EventScript_ReceiveCastform:: msgbox Route119_WeatherInstitute_2F_Text_ThanksPleaseTakePokemon, MSGBOX_DEFAULT - setvar VAR_TEMP_1, SPECIES_CASTFORM + setvar VAR_TEMP_TRANSFERRED_SPECIES, SPECIES_CASTFORM givemon SPECIES_CASTFORM, 25, ITEM_MYSTIC_WATER goto_if_eq VAR_RESULT, MON_GIVEN_TO_PARTY, Route119_WeatherInstitute_2F_EventScript_ReceiveCastformParty goto_if_eq VAR_RESULT, MON_GIVEN_TO_PC, Route119_WeatherInstitute_2F_EventScript_ReceiveCastformPC diff --git a/data/maps/Route123/scripts.inc b/data/maps/Route123/scripts.inc index fe63661261b3..92cfa627683b 100644 --- a/data/maps/Route123/scripts.inc +++ b/data/maps/Route123/scripts.inc @@ -9,14 +9,14 @@ Route123_OnTransition: Route123_EventScript_GigaDrainGirl:: lock faceplayer - goto_if_set FLAG_RECEIVED_TM19, Route123_EventScript_ReceivedGigaDrain + goto_if_set FLAG_RECEIVED_TM_GIGA_DRAIN, Route123_EventScript_ReceivedGigaDrain msgbox Route123_Text_LoveGrassMonsHaveAny, MSGBOX_DEFAULT special IsGrassTypeInParty goto_if_eq VAR_RESULT, FALSE, Route123_EventScript_NoGrassMons msgbox Route123_Text_YouLikeGrassMonsTooHaveThis, MSGBOX_DEFAULT - giveitem ITEM_TM19 + giveitem ITEM_TM_GIGA_DRAIN goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull - setflag FLAG_RECEIVED_TM19 + setflag FLAG_RECEIVED_TM_GIGA_DRAIN msgbox Route123_Text_CheckTreesWithMyGrassMon, MSGBOX_DEFAULT release end diff --git a/data/maps/Route130/map.json b/data/maps/Route130/map.json index 7b37a10edda6..bb79a2bb4a42 100644 --- a/data/maps/Route130/map.json +++ b/data/maps/Route130/map.json @@ -62,7 +62,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_130_LIECHI", "script": "BerryTreeScript", - "flag": "FLAG_TEMP_11" + "flag": "FLAG_TEMP_HIDE_MIRAGE_ISLAND_BERRY_TREE" }, { "graphics_id": "OBJ_EVENT_GFX_SWIMMER_M", diff --git a/data/maps/Route130/scripts.inc b/data/maps/Route130/scripts.inc index 7e0ecc8bd15b..b5b9227e844c 100644 --- a/data/maps/Route130/scripts.inc +++ b/data/maps/Route130/scripts.inc @@ -6,7 +6,8 @@ Route130_OnTransition: call_if_ge VAR_SOOTOPOLIS_CITY_STATE, 4, Route130_EventScript_CheckSetAbnormalWeather specialvar VAR_RESULT, IsMirageIslandPresent goto_if_eq VAR_RESULT, TRUE, Route130_EventScript_SetMirageIslandLayout - setflag FLAG_TEMP_11 +@ Mirage Island isn't currently visible, hide any objects on the island. Only the first flag is actually associated with anything. + setflag FLAG_TEMP_HIDE_MIRAGE_ISLAND_BERRY_TREE setflag FLAG_TEMP_12 setflag FLAG_TEMP_13 setflag FLAG_TEMP_14 diff --git a/data/maps/RustboroCity_CuttersHouse/scripts.inc b/data/maps/RustboroCity_CuttersHouse/scripts.inc index f1d6030761c3..11cd0f608f01 100644 --- a/data/maps/RustboroCity_CuttersHouse/scripts.inc +++ b/data/maps/RustboroCity_CuttersHouse/scripts.inc @@ -4,10 +4,10 @@ RustboroCity_CuttersHouse_MapScripts:: RustboroCity_CuttersHouse_EventScript_Cutter:: lock faceplayer - goto_if_set FLAG_RECEIVED_HM01, RustboroCity_CuttersHouse_EventScript_ExplainCut + goto_if_set FLAG_RECEIVED_HM_CUT, RustboroCity_CuttersHouse_EventScript_ExplainCut msgbox RustboroCity_CuttersHouse_Text_YouCanPutThisHMToGoodUse, MSGBOX_DEFAULT - giveitem ITEM_HM01 - setflag FLAG_RECEIVED_HM01 + giveitem ITEM_HM_CUT + setflag FLAG_RECEIVED_HM_CUT msgbox RustboroCity_CuttersHouse_Text_ExplainCut, MSGBOX_DEFAULT release end diff --git a/data/maps/RustboroCity_DevonCorp_2F/scripts.inc b/data/maps/RustboroCity_DevonCorp_2F/scripts.inc index 747070645c60..ba3a259ec33b 100644 --- a/data/maps/RustboroCity_DevonCorp_2F/scripts.inc +++ b/data/maps/RustboroCity_DevonCorp_2F/scripts.inc @@ -144,7 +144,7 @@ RustboroCity_DevonCorp_2F_EventScript_AnorithReady:: end RustboroCity_DevonCorp_2F_EventScript_ReceiveLileep:: - setvar VAR_TEMP_1, SPECIES_LILEEP + setvar VAR_TEMP_TRANSFERRED_SPECIES, SPECIES_LILEEP givemon SPECIES_LILEEP, 20 goto_if_eq VAR_RESULT, MON_GIVEN_TO_PARTY, RustboroCity_DevonCorp_2F_EventScript_ReceiveLileepParty goto_if_eq VAR_RESULT, MON_GIVEN_TO_PC, RustboroCity_DevonCorp_2F_EventScript_ReceiveLileepPC @@ -189,7 +189,7 @@ RustboroCity_DevonCorp_2F_EventScript_FinishReceivingLileep:: end RustboroCity_DevonCorp_2F_EventScript_ReceiveAnorith:: - setvar VAR_TEMP_1, SPECIES_ANORITH + setvar VAR_TEMP_TRANSFERRED_SPECIES, SPECIES_ANORITH givemon SPECIES_ANORITH, 20 goto_if_eq VAR_RESULT, MON_GIVEN_TO_PARTY, RustboroCity_DevonCorp_2F_EventScript_ReceiveAnorithParty goto_if_eq VAR_RESULT, MON_GIVEN_TO_PC, RustboroCity_DevonCorp_2F_EventScript_ReceiveAnorithPC diff --git a/data/maps/RustboroCity_Gym/scripts.inc b/data/maps/RustboroCity_Gym/scripts.inc index e1596a9730e7..53ed0b20be6c 100644 --- a/data/maps/RustboroCity_Gym/scripts.inc +++ b/data/maps/RustboroCity_Gym/scripts.inc @@ -5,7 +5,7 @@ RustboroCity_Gym_EventScript_Roxanne:: trainerbattle_single TRAINER_ROXANNE_1, RustboroCity_Gym_Text_RoxanneIntro, RustboroCity_Gym_Text_RoxanneDefeat, RustboroCity_Gym_EventScript_RoxanneDefeated, NO_MUSIC specialvar VAR_RESULT, ShouldTryRematchBattle goto_if_eq VAR_RESULT, TRUE, RustboroCity_Gym_EventScript_RoxanneRematch - goto_if_unset FLAG_RECEIVED_TM39, RustboroCity_Gym_EventScript_GiveRockTomb + goto_if_unset FLAG_RECEIVED_TM_ROCK_TOMB, RustboroCity_Gym_EventScript_GiveRockTomb msgbox RustboroCity_Gym_Text_RoxannePostBattle, MSGBOX_DEFAULT release end @@ -26,9 +26,9 @@ RustboroCity_Gym_EventScript_RoxanneDefeated:: end RustboroCity_Gym_EventScript_GiveRockTomb:: - giveitem ITEM_TM39 + giveitem ITEM_TM_ROCK_TOMB goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull - setflag FLAG_RECEIVED_TM39 + setflag FLAG_RECEIVED_TM_ROCK_TOMB msgbox RustboroCity_Gym_Text_ExplainRockTomb, MSGBOX_DEFAULT release end diff --git a/data/maps/RusturfTunnel/scripts.inc b/data/maps/RusturfTunnel/scripts.inc index 54e9574bd5fb..b806afe17f6d 100644 --- a/data/maps/RusturfTunnel/scripts.inc +++ b/data/maps/RusturfTunnel/scripts.inc @@ -62,8 +62,8 @@ RusturfTunnel_EventScript_ClearTunnelScene:: msgbox RusturfTunnel_Text_YouShatteredBoulderTakeHM, MSGBOX_DEFAULT call_if_eq VAR_TEMP_1, 2, RusturfTunnel_EventScript_WandasBoyfriendApproachPlayer call_if_eq VAR_TEMP_1, 3, RusturfTunnel_EventScript_WandasBoyfriendApproachPlayer - giveitem ITEM_HM04 - setflag FLAG_RECEIVED_HM04 + giveitem ITEM_HM_STRENGTH + setflag FLAG_RECEIVED_HM_STRENGTH msgbox RusturfTunnel_Text_ExplainStrength, MSGBOX_DEFAULT closemessage call_if_eq VAR_TEMP_1, 1, RusturfTunnel_EventScript_BoyfriendApproachWanda1 diff --git a/data/maps/SSTidalCorridor/scripts.inc b/data/maps/SSTidalCorridor/scripts.inc index b39b9a433630..0d425889a7aa 100644 --- a/data/maps/SSTidalCorridor/scripts.inc +++ b/data/maps/SSTidalCorridor/scripts.inc @@ -124,7 +124,7 @@ SSTidalCorridor_EventScript_ExitSailor:: SSTidalCorridor_EventScript_ExitLilycove:: setrespawn HEAL_LOCATION_LILYCOVE_CITY msgbox SSTidalCorridor_Text_WeveArrived, MSGBOX_DEFAULT - call_if_set FLAG_RECEIVED_TM49, SSTidalCorridor_EventScript_HideSnatchGiver + call_if_set FLAG_RECEIVED_TM_SNATCH, SSTidalCorridor_EventScript_HideSnatchGiver warp MAP_LILYCOVE_CITY_HARBOR, 8, 11 waitstate release @@ -133,7 +133,7 @@ SSTidalCorridor_EventScript_ExitLilycove:: SSTidalCorridor_EventScript_ExitSlateport:: setrespawn HEAL_LOCATION_SLATEPORT_CITY msgbox SSTidalCorridor_Text_WeveArrived, MSGBOX_DEFAULT - call_if_set FLAG_RECEIVED_TM49, SSTidalCorridor_EventScript_HideSnatchGiver + call_if_set FLAG_RECEIVED_TM_SNATCH, SSTidalCorridor_EventScript_HideSnatchGiver warp MAP_SLATEPORT_CITY_HARBOR, 8, 11 waitstate release diff --git a/data/maps/SSTidalRooms/scripts.inc b/data/maps/SSTidalRooms/scripts.inc index c3aa8ff8ab55..53596ba83893 100644 --- a/data/maps/SSTidalRooms/scripts.inc +++ b/data/maps/SSTidalRooms/scripts.inc @@ -4,11 +4,11 @@ SSTidalRooms_MapScripts:: SSTidalRooms_EventScript_SnatchGiver:: lock faceplayer - goto_if_set FLAG_RECEIVED_TM49, SSTidalRooms_EventScript_ExplainSnatch + goto_if_set FLAG_RECEIVED_TM_SNATCH, SSTidalRooms_EventScript_ExplainSnatch msgbox SSTidalRooms_Text_NotSuspiciousTakeThis, MSGBOX_DEFAULT - giveitem ITEM_TM49 + giveitem ITEM_TM_SNATCH goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull - setflag FLAG_RECEIVED_TM49 + setflag FLAG_RECEIVED_TM_SNATCH msgbox SSTidalRooms_Text_ExplainSnatch, MSGBOX_DEFAULT release end diff --git a/data/maps/SafariZone_Northwest/map.json b/data/maps/SafariZone_Northwest/map.json index 93f3d2a79cf9..f30ef030a024 100644 --- a/data/maps/SafariZone_Northwest/map.json +++ b/data/maps/SafariZone_Northwest/map.json @@ -48,8 +48,8 @@ "movement_range_y": 1, "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", - "script": "SafariZone_Northwest_EventScript_ItemTM22", - "flag": "FLAG_ITEM_SAFARI_ZONE_NORTH_WEST_TM22" + "script": "SafariZone_Northwest_EventScript_ItemTMSolarBeam", + "flag": "FLAG_ITEM_SAFARI_ZONE_NORTH_WEST_TM_SOLAR_BEAM" } ], "warp_events": [], diff --git a/data/maps/ScorchedSlab/map.json b/data/maps/ScorchedSlab/map.json index ca367b921554..5e0380b4e8bc 100644 --- a/data/maps/ScorchedSlab/map.json +++ b/data/maps/ScorchedSlab/map.json @@ -24,8 +24,8 @@ "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", - "script": "ScorchedSlab_EventScript_ItemTM11", - "flag": "FLAG_ITEM_SCORCHED_SLAB_TM11" + "script": "ScorchedSlab_EventScript_ItemTMSunnyDay", + "flag": "FLAG_ITEM_SCORCHED_SLAB_TM_SUNNY_DAY" } ], "warp_events": [ diff --git a/data/maps/SeafloorCavern_Room9/map.json b/data/maps/SeafloorCavern_Room9/map.json index f191941a2bae..04fb621df1a9 100644 --- a/data/maps/SeafloorCavern_Room9/map.json +++ b/data/maps/SeafloorCavern_Room9/map.json @@ -89,8 +89,8 @@ "movement_range_y": 1, "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", - "script": "SeafloorCavern_Room9_EventScript_ItemTM26", - "flag": "FLAG_ITEM_SEAFLOOR_CAVERN_ROOM_9_TM26" + "script": "SeafloorCavern_Room9_EventScript_ItemTMEarthquake", + "flag": "FLAG_ITEM_SEAFLOOR_CAVERN_ROOM_9_TM_EARTHQUAKE" }, { "graphics_id": "OBJ_EVENT_GFX_KYOGRE_ASLEEP", diff --git a/data/maps/ShoalCave_LowTideEntranceRoom/scripts.inc b/data/maps/ShoalCave_LowTideEntranceRoom/scripts.inc index 905a9a77a797..80368b1488ad 100644 --- a/data/maps/ShoalCave_LowTideEntranceRoom/scripts.inc +++ b/data/maps/ShoalCave_LowTideEntranceRoom/scripts.inc @@ -33,9 +33,9 @@ ShoalCave_LowTideEntranceRoom_EventScript_ShellBellExpert:: removeitem ITEM_SHOAL_SALT, 4 removeitem ITEM_SHOAL_SHELL, 4 giveitem ITEM_SHELL_BELL - goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull + goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull @ Never FALSE, we already made sure there will be room in the bag. msgbox ShoalCave_LowTideEntranceRoom_Text_ExplainShellBell, MSGBOX_DEFAULT - setflag FLAG_TEMP_2 + setflag FLAG_TEMP_2 @ Not read. Perhaps meant to stop him from re-explaining the Shell Bell if multiple are received in one sitting. release end diff --git a/data/maps/ShoalCave_LowTideIceRoom/map.json b/data/maps/ShoalCave_LowTideIceRoom/map.json index f87f88227ea9..dffa6d0de804 100644 --- a/data/maps/ShoalCave_LowTideIceRoom/map.json +++ b/data/maps/ShoalCave_LowTideIceRoom/map.json @@ -24,8 +24,8 @@ "movement_range_y": 1, "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", - "script": "ShoalCave_LowTideIceRoom_EventScript_ItemTM07", - "flag": "FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_TM07" + "script": "ShoalCave_LowTideIceRoom_EventScript_ItemTMHail", + "flag": "FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_TM_HAIL" }, { "graphics_id": "OBJ_EVENT_GFX_ITEM_BALL", diff --git a/data/maps/SlateportCity/scripts.inc b/data/maps/SlateportCity/scripts.inc index 653f405c4512..ae3910750e6c 100644 --- a/data/maps/SlateportCity/scripts.inc +++ b/data/maps/SlateportCity/scripts.inc @@ -566,8 +566,8 @@ SlateportCity_EventScript_PowerTMClerk:: .align 2 SlateportCity_Pokemart_PowerTMs: - .2byte ITEM_TM10 @ Hidden Power - .2byte ITEM_TM43 @ Secret Power + .2byte ITEM_TM_HIDDEN_POWER + .2byte ITEM_TM_SECRET_POWER .2byte ITEM_NONE release end diff --git a/data/maps/SlateportCity_BattleTentLobby/scripts.inc b/data/maps/SlateportCity_BattleTentLobby/scripts.inc index 0d3fae875f68..88dd323da0de 100644 --- a/data/maps/SlateportCity_BattleTentLobby/scripts.inc +++ b/data/maps/SlateportCity_BattleTentLobby/scripts.inc @@ -15,11 +15,11 @@ SlateportCity_BattleTentLobby_EventScript_TurnPlayerNorth:: end SlateportCity_BattleTentLobby_OnFrame: - map_script_2 VAR_TEMP_0, 0, SlateportCity_BattleTentLobby_EventScript_GetChallengeStatus - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_SAVING, SlateportCity_BattleTentLobby_EventScript_QuitWithoutSaving - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_PAUSED, SlateportCity_BattleTentLobby_EventScript_ResumeChallenge - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_WON, SlateportCity_BattleTentLobby_EventScript_WonChallenge - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_LOST, SlateportCity_BattleTentLobby_EventScript_LostChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, 0, SlateportCity_BattleTentLobby_EventScript_GetChallengeStatus + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_SAVING, SlateportCity_BattleTentLobby_EventScript_QuitWithoutSaving + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_PAUSED, SlateportCity_BattleTentLobby_EventScript_ResumeChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_WON, SlateportCity_BattleTentLobby_EventScript_WonChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_LOST, SlateportCity_BattleTentLobby_EventScript_LostChallenge .2byte 0 SlateportCity_BattleTentLobby_EventScript_GetChallengeStatus:: @@ -31,7 +31,7 @@ SlateportCity_BattleTentLobby_EventScript_QuitWithoutSaving:: msgbox SlateportCity_BattleTentLobby_Text_DidntSaveBeforeQuitting, MSGBOX_DEFAULT closemessage frontier_set FRONTIER_DATA_CHALLENGE_STATUS, 0 - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 frontier_set FRONTIER_DATA_LVL_MODE, FRONTIER_LVL_50 releaseall end @@ -73,7 +73,7 @@ SlateportCity_BattleTentLobby_EventScript_LostChallenge:: SlateportCity_BattleTentLobby_EventScript_EndGivePrize:: msgbox SlateportCity_BattleTentLobby_Text_LookForwardToNextVisit, MSGBOX_DEFAULT closemessage - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -85,7 +85,7 @@ SlateportCity_BattleTentLobby_EventScript_ResumeChallenge:: playse SE_SAVE waitse frontier_set FRONTIER_DATA_PAUSED, FALSE - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 setvar VAR_0x8006, 2 goto SlateportCity_BattleTentLobby_EventScript_EnterChallenge @@ -117,7 +117,7 @@ SlateportCity_BattleTentLobby_EventScript_TryEnterChallenge:: case MULTI_B_PRESSED, SlateportCity_BattleTentLobby_EventScript_LoadPartyCancelChallenge SlateportCity_BattleTentLobby_EventScript_SaveBeforeChallenge:: - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 frontier_set FRONTIER_DATA_SELECTED_MON_ORDER slateporttent_init frontier_set FRONTIER_DATA_CHALLENGE_STATUS, CHALLENGE_STATUS_SAVING @@ -125,7 +125,7 @@ SlateportCity_BattleTentLobby_EventScript_SaveBeforeChallenge:: closemessage delay 2 call Common_EventScript_SaveGame - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 goto_if_eq VAR_RESULT, 0, SlateportCity_BattleTentLobby_EventScript_CancelChallengeSaveFailed setvar VAR_0x8006, 0 SlateportCity_BattleTentLobby_EventScript_EnterChallenge:: @@ -133,7 +133,7 @@ SlateportCity_BattleTentLobby_EventScript_EnterChallenge:: closemessage call SlateportCity_BattleTentLobby_EventScript_WalkToDoor warp MAP_SLATEPORT_CITY_BATTLE_TENT_CORRIDOR, 2, 7 - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 waitstate end @@ -199,11 +199,11 @@ SlateportCity_BattleTentLobby_Movement_UnusedEnterDoor:: SlateportCity_BattleTentLobby_EventScript_TormentGiver:: lock faceplayer - goto_if_set FLAG_RECEIVED_TM41, SlateportCity_BattleTentLobby_EventScript_ReceivedTorment + goto_if_set FLAG_RECEIVED_TM_TORMENT, SlateportCity_BattleTentLobby_EventScript_ReceivedTorment msgbox SlateportCity_BattleTentLobby_Text_CouldntFindMonForMe, MSGBOX_DEFAULT - giveitem ITEM_TM41 + giveitem ITEM_TM_TORMENT goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull - setflag FLAG_RECEIVED_TM41 + setflag FLAG_RECEIVED_TM_TORMENT msgbox SlateportCity_BattleTentLobby_Text_ExplainTorment, MSGBOX_DEFAULT release end diff --git a/data/maps/SlateportCity_OceanicMuseum_1F/scripts.inc b/data/maps/SlateportCity_OceanicMuseum_1F/scripts.inc index 96892f948d99..8b464f73ae6c 100644 --- a/data/maps/SlateportCity_OceanicMuseum_1F/scripts.inc +++ b/data/maps/SlateportCity_OceanicMuseum_1F/scripts.inc @@ -151,9 +151,9 @@ SlateportCity_OceanicMuseum_1F_EventScript_FamiliarGrunt:: applymovement LOCALID_FAMILIAR_GRUNT, Common_Movement_Delay48 waitmovement 0 msgbox SlateportCity_OceanicMuseum_1F_Text_RememberMeTakeThis, MSGBOX_DEFAULT - giveitem ITEM_TM46 + giveitem ITEM_TM_THIEF goto_if_eq VAR_RESULT, 0, SlateportCity_OceanicMuseum_1F_EventScript_NoRoomForThief - setflag FLAG_RECEIVED_TM46 + setflag FLAG_RECEIVED_TM_THIEF msgbox SlateportCity_OceanicMuseum_1F_Text_HopeINeverSeeYouAgain, MSGBOX_DEFAULT closemessage goto_if_eq VAR_FACING, DIR_NORTH, SlateportCity_OceanicMuseum_1F_EventScript_FamiliarGruntExitNorth diff --git a/data/maps/SootopolisCity/scripts.inc b/data/maps/SootopolisCity/scripts.inc index 69f74880ecaa..16e2d0325276 100644 --- a/data/maps/SootopolisCity/scripts.inc +++ b/data/maps/SootopolisCity/scripts.inc @@ -1300,7 +1300,7 @@ SootopolisCity_EventScript_Wallace:: lock faceplayer goto_if_eq VAR_SOOTOPOLIS_CITY_STATE, 4, SootopolisCity_EventScript_GoToSkyPillar - goto_if_set FLAG_RECEIVED_HM07, SootopolisCity_EventScript_GoToGym + goto_if_set FLAG_RECEIVED_HM_WATERFALL, SootopolisCity_EventScript_GoToGym goto_if_set FLAG_SOOTOPOLIS_ARCHIE_MAXIE_LEAVE, SootopolisCity_EventScript_GiveWaterfall msgbox SootopolisCity_Text_AquaMagmaDidntMeanHarm, MSGBOX_DEFAULT release @@ -1308,8 +1308,8 @@ SootopolisCity_EventScript_Wallace:: SootopolisCity_EventScript_GiveWaterfall:: msgbox SootopolisCity_Text_ThankYouForHelpAcceptThis, MSGBOX_DEFAULT - giveitem ITEM_HM07 - setflag FLAG_RECEIVED_HM07 + giveitem ITEM_HM_WATERFALL + setflag FLAG_RECEIVED_HM_WATERFALL msgbox SootopolisCity_Text_ExplainWaterfallGoToGym, MSGBOX_DEFAULT closemessage call_if_eq VAR_FACING, DIR_NORTH, SootopolisCity_EventScript_WallaceMoveFromGym diff --git a/data/maps/SootopolisCity_Gym_1F/scripts.inc b/data/maps/SootopolisCity_Gym_1F/scripts.inc index 7f739935b133..5ae8145299da 100644 --- a/data/maps/SootopolisCity_Gym_1F/scripts.inc +++ b/data/maps/SootopolisCity_Gym_1F/scripts.inc @@ -83,7 +83,7 @@ SootopolisCity_Gym_1F_EventScript_Juan:: trainerbattle_single TRAINER_JUAN_1, SootopolisCity_Gym_1F_Text_JuanIntro, SootopolisCity_Gym_1F_Text_JuanDefeat, SootopolisCity_Gym_1F_EventScript_JuanDefeated, NO_MUSIC specialvar VAR_RESULT, ShouldTryRematchBattle goto_if_eq VAR_RESULT, TRUE, SootopolisCity_Gym_1F_EventScript_JuanRematch - goto_if_unset FLAG_RECEIVED_TM03, SootopolisCity_Gym_1F_EventScript_GiveWaterPulse2 + goto_if_unset FLAG_RECEIVED_TM_WATER_PULSE, SootopolisCity_Gym_1F_EventScript_GiveWaterPulse2 goto_if_unset FLAG_BADGE06_GET, SootopolisCity_Gym_1F_EventScript_GoGetFortreeBadge msgbox SootopolisCity_Gym_1F_Text_JuanPostBattle, MSGBOX_DEFAULT release @@ -116,17 +116,17 @@ SootopolisCity_Gym_1F_EventScript_JuanDefeated:: end SootopolisCity_Gym_1F_EventScript_GiveWaterPulse:: - giveitem ITEM_TM03 + giveitem ITEM_TM_WATER_PULSE goto_if_eq VAR_RESULT, FALSE, Common_EventScript_BagIsFull msgbox SootopolisCity_Gym_1F_Text_ExplainWaterPulse, MSGBOX_DEFAULT - setflag FLAG_RECEIVED_TM03 + setflag FLAG_RECEIVED_TM_WATER_PULSE return SootopolisCity_Gym_1F_EventScript_GiveWaterPulse2:: - giveitem ITEM_TM03 + giveitem ITEM_TM_WATER_PULSE goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull msgbox SootopolisCity_Gym_1F_Text_ExplainWaterPulse, MSGBOX_DEFAULT - setflag FLAG_RECEIVED_TM03 + setflag FLAG_RECEIVED_TM_WATER_PULSE release end diff --git a/data/maps/SootopolisCity_House1/scripts.inc b/data/maps/SootopolisCity_House1/scripts.inc index 40f22a9c1f3f..b298e51d533c 100644 --- a/data/maps/SootopolisCity_House1/scripts.inc +++ b/data/maps/SootopolisCity_House1/scripts.inc @@ -4,11 +4,11 @@ SootopolisCity_House1_MapScripts:: SootopolisCity_House1_EventScript_BrickBreakBlackBelt:: lock faceplayer - goto_if_set FLAG_RECEIVED_TM31, SootopolisCity_House1_EventScript_ReceivedBrickBreak + goto_if_set FLAG_RECEIVED_TM_BRICK_BREAK, SootopolisCity_House1_EventScript_ReceivedBrickBreak msgbox SootopolisCity_House1_Text_DevelopedThisTM, MSGBOX_DEFAULT - giveitem ITEM_TM31 + giveitem ITEM_TM_BRICK_BREAK goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull - setflag FLAG_RECEIVED_TM31 + setflag FLAG_RECEIVED_TM_BRICK_BREAK msgbox SootopolisCity_House1_Text_ExplainBrickBreak, MSGBOX_DEFAULT release end diff --git a/data/maps/VerdanturfTown_BattleTentLobby/scripts.inc b/data/maps/VerdanturfTown_BattleTentLobby/scripts.inc index a78a6a78edc2..f70baac84f96 100644 --- a/data/maps/VerdanturfTown_BattleTentLobby/scripts.inc +++ b/data/maps/VerdanturfTown_BattleTentLobby/scripts.inc @@ -15,11 +15,11 @@ VerdanturfTown_BattleTentLobby_EventScript_TurnPlayerNorth:: end VerdanturfTown_BattleTentLobby_OnFrame: - map_script_2 VAR_TEMP_0, 0, VerdanturfTown_BattleTentLobby_EventScript_GetChallengeStatus - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_SAVING, VerdanturfTown_BattleTentLobby_EventScript_QuitWithoutSaving - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_PAUSED, VerdanturfTown_BattleTentLobby_EventScript_ResumeChallenge - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_WON, VerdanturfTown_BattleTentLobby_EventScript_WonChallenge - map_script_2 VAR_TEMP_0, CHALLENGE_STATUS_LOST, VerdanturfTown_BattleTentLobby_EventScript_LostChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, 0, VerdanturfTown_BattleTentLobby_EventScript_GetChallengeStatus + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_SAVING, VerdanturfTown_BattleTentLobby_EventScript_QuitWithoutSaving + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_PAUSED, VerdanturfTown_BattleTentLobby_EventScript_ResumeChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_WON, VerdanturfTown_BattleTentLobby_EventScript_WonChallenge + map_script_2 VAR_TEMP_CHALLENGE_STATUS, CHALLENGE_STATUS_LOST, VerdanturfTown_BattleTentLobby_EventScript_LostChallenge .2byte 0 VerdanturfTown_BattleTentLobby_EventScript_GetChallengeStatus:: @@ -31,7 +31,7 @@ VerdanturfTown_BattleTentLobby_EventScript_QuitWithoutSaving:: msgbox BattleFrontier_BattlePalaceLobby_Text_FailedToSaveBeforeEndingChallenge, MSGBOX_DEFAULT closemessage frontier_set FRONTIER_DATA_CHALLENGE_STATUS, 0 - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 frontier_set FRONTIER_DATA_LVL_MODE, FRONTIER_LVL_50 releaseall end @@ -59,7 +59,7 @@ VerdanturfTown_BattleTentLobby_EventScript_GivePrize:: waitfanfare msgbox VerdanturfTown_BattleTentLobby_Text_ReturnFortified, MSGBOX_DEFAULT closemessage - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -67,7 +67,7 @@ VerdanturfTown_BattleTentLobby_EventScript_NoRoomForPrize:: msgbox BattleFrontier_BattlePalaceLobby_Text_NoSpaceForPrize, MSGBOX_DEFAULT waitmessage closemessage - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -87,7 +87,7 @@ VerdanturfTown_BattleTentLobby_EventScript_LostChallenge:: waitse msgbox VerdanturfTown_BattleTentLobby_Text_ReturnFortified, MSGBOX_DEFAULT closemessage - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 releaseall end @@ -100,7 +100,7 @@ VerdanturfTown_BattleTentLobby_EventScript_ResumeChallenge:: playse SE_SAVE waitse frontier_set FRONTIER_DATA_PAUSED, FALSE - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 goto VerdanturfTown_BattleTentLobby_EventScript_EnterChallenge VerdanturfTown_BattleTentLobby_EventScript_Attendant:: @@ -141,7 +141,7 @@ VerdanturfTown_BattleTentLobby_EventScript_TryEnterChallenge:: case MULTI_B_PRESSED, VerdanturfTown_BattleTentLobby_EventScript_LoadPartyCancelChallenge VerdanturfTown_BattleTentLobby_EventScript_SaveBeforeChallenge:: - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 frontier_set FRONTIER_DATA_SELECTED_MON_ORDER verdanturftent_init frontier_set FRONTIER_DATA_CHALLENGE_STATUS, CHALLENGE_STATUS_SAVING @@ -150,7 +150,7 @@ VerdanturfTown_BattleTentLobby_EventScript_SaveBeforeChallenge:: closemessage delay 2 call Common_EventScript_SaveGame - setvar VAR_TEMP_0, 255 + setvar VAR_TEMP_CHALLENGE_STATUS, 255 goto_if_eq VAR_RESULT, 0, VerdanturfTown_BattleTentLobby_EventScript_CancelChallengeSaveFailed VerdanturfTown_BattleTentLobby_EventScript_EnterChallenge:: special SavePlayerParty @@ -159,7 +159,7 @@ VerdanturfTown_BattleTentLobby_EventScript_EnterChallenge:: closemessage call VerdanturfTown_BattleTentLobby_EventScript_WalkToDoor warp MAP_VERDANTURF_TOWN_BATTLE_TENT_CORRIDOR, 2, 7 - setvar VAR_TEMP_0, 0 + setvar VAR_TEMP_CHALLENGE_STATUS, 0 waitstate end @@ -225,11 +225,11 @@ VerdanturfTown_BattleTentLobby_Movement_PlayerEnterDoor: VerdanturfTown_BattleTentLobby_EventScript_AttractGiver:: lock faceplayer - goto_if_set FLAG_RECEIVED_TM45, VerdanturfTown_BattleTentLobby_EventScript_ReceivedAttract + goto_if_set FLAG_RECEIVED_TM_ATTRACT, VerdanturfTown_BattleTentLobby_EventScript_ReceivedAttract msgbox VerdanturfTown_BattleTentLobby_Text_AttractionRunsDeep, MSGBOX_DEFAULT - giveitem ITEM_TM45 + giveitem ITEM_TM_ATTRACT goto_if_eq VAR_RESULT, 0, Common_EventScript_ShowBagIsFull - setflag FLAG_RECEIVED_TM45 + setflag FLAG_RECEIVED_TM_ATTRACT msgbox VerdanturfTown_BattleTentLobby_Text_AttractionMutual, MSGBOX_DEFAULT release end diff --git a/data/maps/VictoryRoad_B1F/map.json b/data/maps/VictoryRoad_B1F/map.json index 6f339a1c25e1..c6033354ced7 100644 --- a/data/maps/VictoryRoad_B1F/map.json +++ b/data/maps/VictoryRoad_B1F/map.json @@ -245,8 +245,8 @@ "movement_range_y": 1, "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", - "script": "VictoryRoad_B1F_EventScript_ItemTM29", - "flag": "FLAG_ITEM_VICTORY_ROAD_B1F_TM29" + "script": "VictoryRoad_B1F_EventScript_ItemTMPsychic", + "flag": "FLAG_ITEM_VICTORY_ROAD_B1F_TM_PSYCHIC" }, { "graphics_id": "OBJ_EVENT_GFX_ITEM_BALL", diff --git a/data/scripts/cable_club.inc b/data/scripts/cable_club.inc index 0ab93c40376f..e810e354a5b8 100644 --- a/data/scripts/cable_club.inc +++ b/data/scripts/cable_club.inc @@ -743,37 +743,36 @@ EventScript_TradeCenter_Chair3:: waitstate end -@ VAR_TEMP_1 for below scripts set by ReceiveGiftItem EventScript_RecordCenter_Spot0:: setvar VAR_0x8005, 0 special RecordMixingPlayerSpotTriggered waitstate - goto_if_ne VAR_TEMP_1, ITEM_NONE, RecordCorner_EventScript_ReceivedGiftItem + goto_if_ne VAR_TEMP_RECORD_MIX_GIFT_ITEM, ITEM_NONE, RecordCorner_EventScript_ReceivedGiftItem end EventScript_RecordCenter_Spot1:: setvar VAR_0x8005, 1 special RecordMixingPlayerSpotTriggered waitstate - goto_if_ne VAR_TEMP_1, ITEM_NONE, RecordCorner_EventScript_ReceivedGiftItem + goto_if_ne VAR_TEMP_RECORD_MIX_GIFT_ITEM, ITEM_NONE, RecordCorner_EventScript_ReceivedGiftItem end EventScript_RecordCenter_Spot2:: setvar VAR_0x8005, 2 special RecordMixingPlayerSpotTriggered waitstate - goto_if_ne VAR_TEMP_1, ITEM_NONE, RecordCorner_EventScript_ReceivedGiftItem + goto_if_ne VAR_TEMP_RECORD_MIX_GIFT_ITEM, ITEM_NONE, RecordCorner_EventScript_ReceivedGiftItem end EventScript_RecordCenter_Spot3:: setvar VAR_0x8005, 3 special RecordMixingPlayerSpotTriggered waitstate - goto_if_ne VAR_TEMP_1, ITEM_NONE, RecordCorner_EventScript_ReceivedGiftItem + goto_if_ne VAR_TEMP_RECORD_MIX_GIFT_ITEM, ITEM_NONE, RecordCorner_EventScript_ReceivedGiftItem end RecordCorner_EventScript_ReceivedGiftItem:: - bufferitemname STR_VAR_2, VAR_TEMP_1 + bufferitemname STR_VAR_2, VAR_TEMP_RECORD_MIX_GIFT_ITEM message RecordCorner_Text_PlayerSentOverOneX waitmessage waitbuttonpress @@ -814,7 +813,7 @@ TradeCenter_EventScript_Attendant:: end RecordCorner_EventScript_Attendant:: - goto_if_ne VAR_TEMP_0, 0, RecordCorner_EventScript_AlreadyMixed + goto_if_ne VAR_TEMP_MIXED_RECORDS, 0, RecordCorner_EventScript_AlreadyMixed special Script_FacePlayer message RecordCorner_Text_TakeSeatAndWait waitmessage diff --git a/data/scripts/debug.inc b/data/scripts/debug.inc index f9ec4eeffdfc..b29291a7f9e2 100644 --- a/data/scripts/debug.inc +++ b/data/scripts/debug.inc @@ -1,14 +1,15 @@ .if DEBUG_OVERWORLD_MENU == TRUE - -Debug_ShowFieldMessageStringVar4:: - special ShowFieldMessageStringVar4 +Debug_MessageEnd: waitmessage waitbuttonpress releaseall end +Debug_ShowFieldMessageStringVar4:: + special ShowFieldMessageStringVar4 + goto Debug_MessageEnd + Debug_CheatStart:: - lockall setflag FLAG_SYS_POKEMON_GET setflag FLAG_RESCUED_BIRCH setflag FLAG_HIDE_ROUTE_101_BIRCH_ZIGZAGOON_BATTLE @@ -44,12 +45,8 @@ Debug_CheatStart:: end Debug_FlagsNotSetOverworldConfigMessage:: - lockall message Debug_FlagsNotSetOverworldConfigMessage_Text - waitmessage - waitbuttonpress - releaseall - end + goto Debug_MessageEnd Debug_FlagsNotSetOverworldConfigMessage_Text: .string "Feature unavailable!\n" @@ -57,18 +54,21 @@ Debug_FlagsNotSetOverworldConfigMessage_Text: .string "'include/config/overworld.h'!$" Debug_FlagsNotSetBattleConfigMessage:: - lockall message Debug_FlagsNotSetBattleConfigMessage_Text - waitmessage - waitbuttonpress - releaseall - end + goto Debug_MessageEnd Debug_FlagsNotSetBattleConfigMessage_Text: .string "Feature unavailable!\n" .string "Please define a usable flag in:\l" .string "'include/config/battle.h'!$" +Debug_BoxFilledMessage:: + message Debug_BoxFilledMessage_Text + goto Debug_MessageEnd + +Debug_BoxFilledMessage_Text: + .string "Storage boxes filled!$" + Debug_Script_1:: end @@ -112,4 +112,59 @@ Debug_SaveBlock2Size:: Debug_PokemonStorageSize:: .string "{PKMN}Storage size: {STR_VAR_1}/{STR_VAR_2}.$" +Debug_HatchAnEgg:: + lockall + getpartysize + goto_if_eq VAR_RESULT, 0, Debug_HatchAnEgg_NoPokemon + special ChoosePartyMon + waitstate + goto_if_ge VAR_0x8004, PARTY_SIZE, Debug_HatchAnEgg_End + specialvar VAR_RESULT, ScriptGetPartyMonSpecies + goto_if_ne VAR_RESULT, SPECIES_EGG, DebugScript_HatchAnEgg_CantForceHatch + special EggHatch + waitstate +Debug_HatchAnEgg_End:: + releaseall + end + +Debug_HatchAnEgg_NoPokemon:: + msgbox DebugScript_HatchAnEgg_Text_EmptyParty, MSGBOX_DEFAULT + releaseall + end + +DebugScript_HatchAnEgg_CantForceHatch:: + msgbox DebugScript_HatchAnEgg_Text_NotAnEgg, MSGBOX_DEFAULT + releaseall + end + +DebugScript_HatchAnEgg_Text_EmptyParty:: + .string "You have no Pokémon nor Eggs.$" + +DebugScript_HatchAnEgg_Text_NotAnEgg:: + .string "That's not a Pokémon Egg.$" + +DebugScript_ZeroDaycareMons:: + msgbox DebugText_DaycareNoPokemon, MSGBOX_DEFAULT + releaseall + end + +DebugScript_OneDaycareMons:: + msgbox DebugText_DaycareOnePokemon, MSGBOX_DEFAULT + releaseall + end + +DebugScript_DaycareMonsNotCompatible:: + msgbox DebugText_DaycarePokemonNotCompatible, MSGBOX_DEFAULT + releaseall + end + +DebugText_DaycareNoPokemon: + .string "You have no Pokémon at Daycare.$" + +DebugText_DaycareOnePokemon: + .string "You have only one Pokémon at Daycare.$" + +DebugText_DaycarePokemonNotCompatible: + .string "Your Pokémon at Daycare can't\nhave babies together!$" + .endif diff --git a/data/scripts/gabby_and_ty.inc b/data/scripts/gabby_and_ty.inc index e3dbdfd665b1..260526c4b61f 100644 --- a/data/scripts/gabby_and_ty.inc +++ b/data/scripts/gabby_and_ty.inc @@ -202,7 +202,7 @@ GabbyAndTy_EventScript_FirstInterview:: call_if_eq VAR_FACING, DIR_NORTH, GabbyAndTy_EventScript_FacePlayerNorth call_if_eq VAR_FACING, DIR_SOUTH, GabbyAndTy_EventScript_FacePlayerSouth call_if_eq VAR_FACING, DIR_EAST, GabbyAndTy_EventScript_FacePlayerEast - goto_if_set FLAG_TEMP_1, GabbyAndTy_EventScript_KeepingAnEyeOutForYou + goto_if_set FLAG_TEMP_SKIP_GABBY_INTERVIEW, GabbyAndTy_EventScript_KeepingAnEyeOutForYou msgbox GabbyAndTy_Text_WhoAreYouInterview, MSGBOX_YESNO goto GabbyAndTy_EventScript_Interview end @@ -230,7 +230,7 @@ GabbyAndTy_EventScript_RequestInterview:: call_if_eq VAR_FACING, DIR_NORTH, GabbyAndTy_EventScript_FacePlayerNorth call_if_eq VAR_FACING, DIR_SOUTH, GabbyAndTy_EventScript_FacePlayerSouth call_if_eq VAR_FACING, DIR_EAST, GabbyAndTy_EventScript_FacePlayerEast - goto_if_set FLAG_TEMP_1, GabbyAndTy_EventScript_KeepingAnEyeOutForYou + goto_if_set FLAG_TEMP_SKIP_GABBY_INTERVIEW, GabbyAndTy_EventScript_KeepingAnEyeOutForYou specialvar VAR_RESULT, GabbyAndTyGetLastQuote goto_if_eq VAR_RESULT, 0, GabbyAndTy_EventScript_DidntInterviewLastTime msgbox GabbyAndTy_Text_QuoteFromLastInterview, MSGBOX_DEFAULT @@ -295,13 +295,13 @@ GabbyAndTy_EventScript_Interview:: goto_if_eq VAR_RESULT, 0, GabbyAndTy_EventScript_DontGiveUpKeepingEyeOut msgbox GabbyAndTy_Text_PerfectWellBeSeeingYou, MSGBOX_DEFAULT special GabbyAndTyAfterInterview - setflag FLAG_TEMP_1 + setflag FLAG_TEMP_SKIP_GABBY_INTERVIEW release end GabbyAndTy_EventScript_DontGiveUpKeepingEyeOut:: msgbox GabbyAndTy_Text_DontGiveUpKeepingEyeOut, MSGBOX_DEFAULT - setflag FLAG_TEMP_1 + setflag FLAG_TEMP_SKIP_GABBY_INTERVIEW release end diff --git a/data/scripts/item_ball_scripts.inc b/data/scripts/item_ball_scripts.inc index 5ad4037cbe03..44800dd556df 100644 --- a/data/scripts/item_ball_scripts.inc +++ b/data/scripts/item_ball_scripts.inc @@ -58,8 +58,8 @@ Route110_EventScript_ItemElixir:: finditem ITEM_ELIXIR end -Route111_EventScript_ItemTM37:: - finditem ITEM_TM37 +Route111_EventScript_ItemTMSandstorm:: + finditem ITEM_TM_SANDSTORM end Route111_EventScript_ItemStardust:: @@ -106,8 +106,8 @@ Route115_EventScript_ItemSuperPotion:: finditem ITEM_SUPER_POTION end -Route115_EventScript_ItemTM01:: - finditem ITEM_TM01 +Route115_EventScript_ItemTMFocusPunch:: + finditem ITEM_TM_FOCUS_PUNCH end Route115_EventScript_ItemIron:: @@ -374,12 +374,12 @@ FieryPath_EventScript_ItemFireStone:: finditem ITEM_FIRE_STONE end -FieryPath_EventScript_ItemTM06:: - finditem ITEM_TM06 +FieryPath_EventScript_ItemTMToxic:: + finditem ITEM_TM_TOXIC end -MeteorFalls_1F_1R_EventScript_ItemTM23:: - finditem ITEM_TM23 +MeteorFalls_1F_1R_EventScript_ItemTMIronTail:: + finditem ITEM_TM_IRON_TAIL end MeteorFalls_1F_1R_EventScript_ItemFullHeal:: @@ -394,8 +394,8 @@ MeteorFalls_1F_1R_EventScript_ItemPPUP:: finditem ITEM_PP_UP end -MeteorFalls_B1F_2R_EventScript_ItemTM02:: - finditem ITEM_TM02 +MeteorFalls_B1F_2R_EventScript_ItemTMDragonClaw:: + finditem ITEM_TM_DRAGON_CLAW end NewMauville_Inside_EventScript_ItemUltraBall:: @@ -430,8 +430,8 @@ AbandonedShip_Rooms2_B1F_EventScript_ItemDiveBall:: finditem ITEM_DIVE_BALL end -AbandonedShip_Room_B1F_EventScript_ItemTM13:: - finditem ITEM_TM13 +AbandonedShip_Room_B1F_EventScript_ItemTMIceBeam:: + finditem ITEM_TM_ICE_BEAM end AbandonedShip_Rooms2_1F_EventScript_ItemRevive:: @@ -454,16 +454,16 @@ AbandonedShip_HiddenFloorRooms_EventScript_ItemWaterStone:: finditem ITEM_WATER_STONE end -AbandonedShip_HiddenFloorRooms_EventScript_ItemTM18:: - finditem ITEM_TM18 +AbandonedShip_HiddenFloorRooms_EventScript_ItemTMRainDance:: + finditem ITEM_TM_RAIN_DANCE end -ScorchedSlab_EventScript_ItemTM11:: - finditem ITEM_TM11 +ScorchedSlab_EventScript_ItemTMSunnyDay:: + finditem ITEM_TM_SUNNY_DAY end -SafariZone_Northwest_EventScript_ItemTM22:: - finditem ITEM_TM22 +SafariZone_Northwest_EventScript_ItemTMSolarBeam:: + finditem ITEM_TM_SOLAR_BEAM end SafariZone_North_EventScript_ItemCalcium:: @@ -498,16 +498,16 @@ MtPyre_5F_EventScript_ItemLaxIncense:: finditem ITEM_LAX_INCENSE end -MtPyre_6F_EventScript_ItemTM30:: - finditem ITEM_TM30 +MtPyre_6F_EventScript_ItemTMShadowBall:: + finditem ITEM_TM_SHADOW_BALL end MtPyre_Exterior_EventScript_ItemMaxPotion:: finditem ITEM_MAX_POTION end -MtPyre_Exterior_EventScript_ItemTM48:: - finditem ITEM_TM48 +MtPyre_Exterior_EventScript_ItemTMSkillSwap:: + finditem ITEM_TM_SKILL_SWAP end AquaHideout_B1F_EventScript_ItemMasterBall:: @@ -554,16 +554,16 @@ ShoalCave_LowTideStairsRoom_EventScript_ItemIceHeal:: finditem ITEM_ICE_HEAL end -ShoalCave_LowTideIceRoom_EventScript_ItemTM07:: - finditem ITEM_TM07 +ShoalCave_LowTideIceRoom_EventScript_ItemTMHail:: + finditem ITEM_TM_HAIL end ShoalCave_LowTideIceRoom_EventScript_ItemNeverMeltIce:: finditem ITEM_NEVER_MELT_ICE end -SeafloorCavern_Room9_EventScript_ItemTM26:: - finditem ITEM_TM26 +SeafloorCavern_Room9_EventScript_ItemTMEarthquake:: + finditem ITEM_TM_EARTHQUAKE end Route110_TrickHousePuzzle1_EventScript_ItemOrangeMail:: @@ -610,8 +610,8 @@ VictoryRoad_1F_EventScript_ItemPPUp:: finditem ITEM_PP_UP end -VictoryRoad_B1F_EventScript_ItemTM29:: - finditem ITEM_TM29 +VictoryRoad_B1F_EventScript_ItemTMPsychic:: + finditem ITEM_TM_PSYCHIC end VictoryRoad_B1F_EventScript_ItemFullRestore:: diff --git a/data/scripts/pc_transfer.inc b/data/scripts/pc_transfer.inc index 1204bece3606..f279740caa3c 100644 --- a/data/scripts/pc_transfer.inc +++ b/data/scripts/pc_transfer.inc @@ -15,7 +15,7 @@ Common_EventScript_NameReceivedBoxMon:: Common_EventScript_TransferredToPC:: bufferboxname STR_VAR_1, VAR_PC_BOX_TO_SEND_MON - bufferspeciesname STR_VAR_2, VAR_TEMP_1 + bufferspeciesname STR_VAR_2, VAR_TEMP_TRANSFERRED_SPECIES call_if_unset FLAG_SYS_PC_LANETTE, EventScript_TransferredSomeonesPC call_if_set FLAG_SYS_PC_LANETTE, EventScript_TransferredLanettesPC return diff --git a/data/scripts/secret_power_tm.inc b/data/scripts/secret_power_tm.inc index 11a5d5b6680d..58ddc8ce5511 100644 --- a/data/scripts/secret_power_tm.inc +++ b/data/scripts/secret_power_tm.inc @@ -43,7 +43,7 @@ Route111_EventScript_SecretPowerMan:: end Route111_EventScript_GiveSecretPower:: - giveitem ITEM_TM43 + giveitem ITEM_TM_SECRET_POWER goto_if_eq VAR_RESULT, FALSE, Route111_EventScript_NoRoomForSecretPower msgbox Route111_Text_ExplainSecretPower, MSGBOX_DEFAULT closemessage diff --git a/gflib/bg.c b/gflib/bg.c index 968c46272f21..f363233a8586 100644 --- a/gflib/bg.c +++ b/gflib/bg.c @@ -421,13 +421,11 @@ u16 Unused_LoadBgPalette(u8 bg, const void *src, u16 size, u16 destOffset) if (!IsInvalidBg32(bg)) { - u16 paletteOffset = (sGpuBgConfigs2[bg].basePalette * 0x20) + (destOffset * 2); + u16 paletteOffset = PLTT_OFFSET_4BPP(sGpuBgConfigs2[bg].basePalette) + (destOffset * 2); cursor = RequestDma3Copy(src, (void *)(paletteOffset + BG_PLTT), size, 0); if (cursor == -1) - { return -1; - } } else { diff --git a/gflib/sprite.c b/gflib/sprite.c index 80fba81fe309..d75f6f7271d6 100644 --- a/gflib/sprite.c +++ b/gflib/sprite.c @@ -48,11 +48,7 @@ struct OamDimensions s8 height; }; -static void UpdateOamCoords(void); -static void BuildSpritePriorities(void); -static void SortSprites(void); -static void CopyMatricesToOamBuffer(void); -static void AddSpritesToOamBuffer(void); +static void SortSprites(u32 *spritePriorities, s32 n); static u8 CreateSpriteAt(u8 index, const struct SpriteTemplate *template, s16 x, s16 y, u8 subpriority); static void ResetOamMatrices(void); static void ResetSprite(struct Sprite *sprite); @@ -280,12 +276,12 @@ u32 gOamMatrixAllocBitmap; u8 gReservedSpritePaletteCount; EWRAM_DATA struct Sprite gSprites[MAX_SPRITES + 1] = {0}; -EWRAM_DATA static u16 sSpritePriorities[MAX_SPRITES] = {0}; EWRAM_DATA static u8 sSpriteOrder[MAX_SPRITES] = {0}; EWRAM_DATA static bool8 sShouldProcessSpriteCopyRequests = 0; EWRAM_DATA static u8 sSpriteCopyRequestCount = 0; EWRAM_DATA static struct SpriteCopyRequest sSpriteCopyRequests[MAX_SPRITES] = {0}; EWRAM_DATA u8 gOamLimit = 0; +static EWRAM_DATA u8 gOamDummyIndex = 0; EWRAM_DATA u16 gReservedSpriteTileCount = 0; EWRAM_DATA static u8 sSpriteTileAllocBitmap[128] = {0}; EWRAM_DATA s16 gSpriteCoordOffsetX = 0; @@ -296,6 +292,7 @@ EWRAM_DATA bool8 gAffineAnimsDisabled = FALSE; void ResetSpriteData(void) { ResetOamRange(0, 128); + gOamDummyIndex = 0; ResetAllSprites(); ClearSpriteCopyRequests(); ResetAffineAnimData(); @@ -326,179 +323,128 @@ void AnimateSprites(void) void BuildOamBuffer(void) { - u8 temp; - UpdateOamCoords(); - BuildSpritePriorities(); - SortSprites(); - temp = gMain.oamLoadDisabled; - gMain.oamLoadDisabled = TRUE; - AddSpritesToOamBuffer(); - CopyMatricesToOamBuffer(); - gMain.oamLoadDisabled = temp; - sShouldProcessSpriteCopyRequests = TRUE; -} + bool32 oamLoadDisabled; + u32 i, stride; + u8 oamIndex; + + // All attributes which affect sorting packed into a single u32: + // { priority:2, subpriority:8, y:9, :5, index:8 }. + // Index has its own byte even though it only needs 6 bits so that + // we can load it with a ldrb instead of having to mask out the + // bottom 6 bits. + u32 spritePriorities[MAX_SPRITES]; + s32 toSort = 0; + u8 skippedSprites[MAX_SPRITES]; + u32 skippedSpritesN = 0; + u32 matrices = 0; -void UpdateOamCoords(void) -{ - u8 i; for (i = 0; i < MAX_SPRITES; i++) { - struct Sprite *sprite = &gSprites[i]; - if (sprite->inUse && !sprite->invisible) + // Reuse existing sSpriteOrder because we expect the order to be + // relatively stable between frames. + u32 index = sSpriteOrder[i]; + struct Sprite *sprite = &gSprites[index]; + s32 y; + if (!sprite->inUse || sprite->invisible) { - if (sprite->coordOffsetEnabled) - { - sprite->oam.x = sprite->x + sprite->x2 + sprite->centerToCornerVecX + gSpriteCoordOffsetX; - sprite->oam.y = sprite->y + sprite->y2 + sprite->centerToCornerVecY + gSpriteCoordOffsetY; - } - else - { - sprite->oam.x = sprite->x + sprite->x2 + sprite->centerToCornerVecX; - sprite->oam.y = sprite->y + sprite->y2 + sprite->centerToCornerVecY; - } + skippedSprites[skippedSpritesN++] = index; + continue; } - } -} -void BuildSpritePriorities(void) -{ - u16 i; - for (i = 0; i < MAX_SPRITES; i++) - { - struct Sprite *sprite = &gSprites[i]; - u16 priority = sprite->subpriority | (sprite->oam.priority << 8); - sSpritePriorities[i] = priority; - } -} + if (sprite->oam.affineMode & ST_OAM_AFFINE_ON_MASK) + matrices |= 1 << sprite->oam.matrixNum; -void SortSprites(void) -{ - u8 i; - for (i = 1; i < MAX_SPRITES; i++) - { - u8 j = i; - struct Sprite *sprite1 = &gSprites[sSpriteOrder[i - 1]]; - struct Sprite *sprite2 = &gSprites[sSpriteOrder[i]]; - u16 sprite1Priority = sSpritePriorities[sSpriteOrder[i - 1]]; - u16 sprite2Priority = sSpritePriorities[sSpriteOrder[i]]; - s16 sprite1Y = sprite1->oam.y; - s16 sprite2Y = sprite2->oam.y; - - if (sprite1Y >= DISPLAY_HEIGHT) - sprite1Y = sprite1Y - 256; - - if (sprite2Y >= DISPLAY_HEIGHT) - sprite2Y = sprite2Y - 256; - - if (sprite1->oam.affineMode == ST_OAM_AFFINE_DOUBLE - && sprite1->oam.size == ST_OAM_SIZE_3) + if (sprite->coordOffsetEnabled) { - u32 shape = sprite1->oam.shape; - if (shape == ST_OAM_SQUARE || shape == ST_OAM_V_RECTANGLE) - { - if (sprite1Y > 128) - sprite1Y = sprite1Y - 256; - } + sprite->oam.x = sprite->x + sprite->x2 + sprite->centerToCornerVecX + gSpriteCoordOffsetX; + sprite->oam.y = sprite->y + sprite->y2 + sprite->centerToCornerVecY + gSpriteCoordOffsetY; + } + else + { + sprite->oam.x = sprite->x + sprite->x2 + sprite->centerToCornerVecX; + sprite->oam.y = sprite->y + sprite->y2 + sprite->centerToCornerVecY; } - if (sprite2->oam.affineMode == ST_OAM_AFFINE_DOUBLE - && sprite2->oam.size == ST_OAM_SIZE_3) + y = sprite->oam.y; + if (y >= DISPLAY_HEIGHT) + { + y -= 256; + } + else if (sprite->oam.affineMode == ST_OAM_AFFINE_DOUBLE + && sprite->oam.size == ST_OAM_SIZE_3) { - u32 shape = sprite2->oam.shape; + u32 shape = sprite->oam.shape; if (shape == ST_OAM_SQUARE || shape == ST_OAM_V_RECTANGLE) { - if (sprite2Y > 128) - sprite2Y = sprite2Y - 256; + if (y > 128) + y -= 256; } } - while (j > 0 - && ((sprite1Priority > sprite2Priority) - || (sprite1Priority == sprite2Priority && sprite1Y < sprite2Y))) - { - u8 temp = sSpriteOrder[j]; - sSpriteOrder[j] = sSpriteOrder[j - 1]; - sSpriteOrder[j - 1] = temp; - - // UB: If j equals 1, then j-- makes j equal 0. - // Then, sSpriteOrder[-1] gets accessed below. - // Although this doesn't result in a bug in the ROM, - // the behavior is undefined. - j--; -#ifdef UBFIX - if (j == 0) - break; -#endif - - sprite1 = &gSprites[sSpriteOrder[j - 1]]; - sprite2 = &gSprites[sSpriteOrder[j]]; - sprite1Priority = sSpritePriorities[sSpriteOrder[j - 1]]; - sprite2Priority = sSpritePriorities[sSpriteOrder[j]]; - sprite1Y = sprite1->oam.y; - sprite2Y = sprite2->oam.y; + // y in [-128...159], so (159 - y) in [0..287]. + spritePriorities[toSort++] + = (sprite->oam.priority << 30) + | (sprite->subpriority << 22) + | (((159 - y) & 0x1FF) << 13) + | (index << 0); + } - if (sprite1Y >= DISPLAY_HEIGHT) - sprite1Y = sprite1Y - 256; + SortSprites(spritePriorities, toSort); - if (sprite2Y >= DISPLAY_HEIGHT) - sprite2Y = sprite2Y - 256; + for (i = 0; i < toSort; i++) + sSpriteOrder[i] = spritePriorities[i] & 0xFF; + for (i = 0; i < skippedSpritesN; i++) + sSpriteOrder[toSort + i] = skippedSprites[i]; - if (sprite1->oam.affineMode == ST_OAM_AFFINE_DOUBLE - && sprite1->oam.size == ST_OAM_SIZE_3) - { - u32 shape = sprite1->oam.shape; - if (shape == ST_OAM_SQUARE || shape == ST_OAM_V_RECTANGLE) - { - if (sprite1Y > 128) - sprite1Y = sprite1Y - 256; - } - } + oamLoadDisabled = gMain.oamLoadDisabled; + gMain.oamLoadDisabled = TRUE; - if (sprite2->oam.affineMode == ST_OAM_AFFINE_DOUBLE - && sprite2->oam.size == ST_OAM_SIZE_3) - { - u32 shape = sprite2->oam.shape; - if (shape == ST_OAM_SQUARE || shape == ST_OAM_V_RECTANGLE) - { - if (sprite2Y > 128) - sprite2Y = sprite2Y - 256; - } - } - } + for (i = 0, oamIndex = 0; i < toSort; i++) + { + if (AddSpriteToOamBuffer(&gSprites[spritePriorities[i] & 0xFF], &oamIndex)) + break; } -} -void CopyMatricesToOamBuffer(void) -{ - u8 i; - for (i = 0; i < OAM_MATRIX_COUNT; i++) + for (i = oamIndex; i < gOamDummyIndex; i++) + gMain.oamBuffer[i] = gDummyOamData; + gOamDummyIndex = oamIndex; + + for (i = 0; matrices != 0; i++, matrices >>= 1) { - u32 base = 4 * i; - gMain.oamBuffer[base + 0].affineParam = gOamMatrices[i].a; - gMain.oamBuffer[base + 1].affineParam = gOamMatrices[i].b; - gMain.oamBuffer[base + 2].affineParam = gOamMatrices[i].c; - gMain.oamBuffer[base + 3].affineParam = gOamMatrices[i].d; + if (matrices & 1) + { + u32 base = 4 * i; + gMain.oamBuffer[base + 0].affineParam = gOamMatrices[i].a; + gMain.oamBuffer[base + 1].affineParam = gOamMatrices[i].b; + gMain.oamBuffer[base + 2].affineParam = gOamMatrices[i].c; + gMain.oamBuffer[base + 3].affineParam = gOamMatrices[i].d; + } } + + gMain.oamLoadDisabled = oamLoadDisabled; + sShouldProcessSpriteCopyRequests = TRUE; } -void AddSpritesToOamBuffer(void) +static inline void InsertionSort(u32 *spritePriorities, s32 n) { - u8 i = 0; - u8 oamIndex = 0; - - while (i < MAX_SPRITES) + s32 i = 1; + while (i < n) { - struct Sprite *sprite = &gSprites[sSpriteOrder[i]]; - if (sprite->inUse && !sprite->invisible && AddSpriteToOamBuffer(sprite, &oamIndex)) - return; + u32 x = spritePriorities[i]; + s32 j = i - 1; + while (j >= 0 && spritePriorities[j] > x) + { + spritePriorities[j + 1] = spritePriorities[j]; + j--; + } + spritePriorities[j + 1] = x; i++; } +} - while (oamIndex < gOamLimit) - { - gMain.oamBuffer[oamIndex] = gDummyOamData; - oamIndex++; - } +static void SortSprites(u32 *spritePriorities, s32 n) +{ + InsertionSort(spritePriorities, n); } u8 CreateSprite(const struct SpriteTemplate *template, s16 x, s16 y, u8 subpriority) @@ -849,7 +795,7 @@ void CopyToSprites(u8 *src) void ResetAllSprites(void) { - u8 i; + u32 i; for (i = 0; i < MAX_SPRITES; i++) { diff --git a/graphics/battle_anims/backgrounds/chloroblast.pal b/graphics/battle_anims/backgrounds/chloroblast.pal new file mode 100644 index 000000000000..8d40958f4b04 --- /dev/null +++ b/graphics/battle_anims/backgrounds/chloroblast.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 164 255 +16 123 41 +32 164 82 +57 205 131 +82 238 172 +139 246 205 +197 255 230 +238 255 238 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/battle_anims/sprites/monster_doll.png b/graphics/battle_anims/sprites/monster_doll.png index 55706275c551..7cac68e109c3 100644 Binary files a/graphics/battle_anims/sprites/monster_doll.png and b/graphics/battle_anims/sprites/monster_doll.png differ diff --git a/graphics/battle_anims/sprites/substitute.png b/graphics/battle_anims/sprites/substitute.png index 0b6dea85009d..d4835d86a77a 100644 Binary files a/graphics/battle_anims/sprites/substitute.png and b/graphics/battle_anims/sprites/substitute.png differ diff --git a/graphics/battle_anims/sprites/substitute_back.png b/graphics/battle_anims/sprites/substitute_back.png index 8ea1f7ff8b77..47c46d0f8925 100644 Binary files a/graphics/battle_anims/sprites/substitute_back.png and b/graphics/battle_anims/sprites/substitute_back.png differ diff --git a/graphics/battle_anims/sprites/substitute_back_new.png b/graphics/battle_anims/sprites/substitute_back_new.png deleted file mode 100644 index fd31e1063caf..000000000000 Binary files a/graphics/battle_anims/sprites/substitute_back_new.png and /dev/null differ diff --git a/graphics/battle_anims/sprites/substitute_new.png b/graphics/battle_anims/sprites/substitute_new.png deleted file mode 100644 index 5d563900c068..000000000000 Binary files a/graphics/battle_anims/sprites/substitute_new.png and /dev/null differ diff --git a/graphics/battle_anims/sprites/wood_hammer_hammer.png b/graphics/battle_anims/sprites/wood_hammer_hammer.png new file mode 100644 index 000000000000..00296d4c461b Binary files /dev/null and b/graphics/battle_anims/sprites/wood_hammer_hammer.png differ diff --git a/graphics/battle_anims/masks/stat3.pal b/graphics/battle_anims/stat_change/accuracy.pal similarity index 100% rename from graphics/battle_anims/masks/stat3.pal rename to graphics/battle_anims/stat_change/accuracy.pal diff --git a/graphics/battle_anims/masks/stat2.pal b/graphics/battle_anims/stat_change/attack.pal similarity index 100% rename from graphics/battle_anims/masks/stat2.pal rename to graphics/battle_anims/stat_change/attack.pal diff --git a/graphics/battle_anims/masks/stat_tilemap_2.bin b/graphics/battle_anims/stat_change/decrease.bin similarity index 100% rename from graphics/battle_anims/masks/stat_tilemap_2.bin rename to graphics/battle_anims/stat_change/decrease.bin diff --git a/graphics/battle_anims/masks/stat1.pal b/graphics/battle_anims/stat_change/defense.pal similarity index 100% rename from graphics/battle_anims/masks/stat1.pal rename to graphics/battle_anims/stat_change/defense.pal diff --git a/graphics/battle_anims/masks/stat6.pal b/graphics/battle_anims/stat_change/evasion.pal similarity index 100% rename from graphics/battle_anims/masks/stat6.pal rename to graphics/battle_anims/stat_change/evasion.pal diff --git a/graphics/battle_anims/masks/stat_tilemap_1.bin b/graphics/battle_anims/stat_change/increase.bin similarity index 100% rename from graphics/battle_anims/masks/stat_tilemap_1.bin rename to graphics/battle_anims/stat_change/increase.bin diff --git a/graphics/battle_anims/masks/stat5.pal b/graphics/battle_anims/stat_change/multiple.pal similarity index 100% rename from graphics/battle_anims/masks/stat5.pal rename to graphics/battle_anims/stat_change/multiple.pal diff --git a/graphics/battle_anims/masks/stat7.pal b/graphics/battle_anims/stat_change/sp_attack.pal similarity index 100% rename from graphics/battle_anims/masks/stat7.pal rename to graphics/battle_anims/stat_change/sp_attack.pal diff --git a/graphics/battle_anims/masks/stat8.pal b/graphics/battle_anims/stat_change/sp_defense.pal similarity index 100% rename from graphics/battle_anims/masks/stat8.pal rename to graphics/battle_anims/stat_change/sp_defense.pal diff --git a/graphics/battle_anims/masks/stat4.pal b/graphics/battle_anims/stat_change/speed.pal similarity index 100% rename from graphics/battle_anims/masks/stat4.pal rename to graphics/battle_anims/stat_change/speed.pal diff --git a/graphics/battle_anims/masks/stat.png b/graphics/battle_anims/stat_change/tiles.png similarity index 100% rename from graphics/battle_anims/masks/stat.png rename to graphics/battle_anims/stat_change/tiles.png diff --git a/graphics/battle_frontier/factory_menu1.png b/graphics/battle_frontier/factory_menu1.png deleted file mode 100644 index 52f073ff3081..000000000000 Binary files a/graphics/battle_frontier/factory_menu1.png and /dev/null differ diff --git a/graphics/battle_frontier/factory_menu2.png b/graphics/battle_frontier/factory_menu2.png deleted file mode 100644 index 0d103927e439..000000000000 Binary files a/graphics/battle_frontier/factory_menu2.png and /dev/null differ diff --git a/graphics/battle_frontier/factory_menu.bin b/graphics/battle_frontier/factory_screen/menu.bin similarity index 100% rename from graphics/battle_frontier/factory_menu.bin rename to graphics/battle_frontier/factory_screen/menu.bin diff --git a/graphics/battle_frontier/factory_screen/menu.png b/graphics/battle_frontier/factory_screen/menu.png new file mode 100644 index 000000000000..5271973b3109 Binary files /dev/null and b/graphics/battle_frontier/factory_screen/menu.png differ diff --git a/graphics/battle_frontier/tourney.pal b/graphics/battle_frontier/tourney.pal deleted file mode 100644 index eec4c7d71ada..000000000000 --- a/graphics/battle_frontier/tourney.pal +++ /dev/null @@ -1,259 +0,0 @@ -JASC-PAL -0100 -256 -0 0 0 -255 172 65 -255 255 131 -222 213 180 -255 255 255 -230 222 222 -197 197 197 -213 57 49 -230 230 213 -255 246 205 -255 82 49 -164 24 0 -0 0 0 -106 106 106 -0 0 0 -0 0 0 -0 0 0 -90 172 131 -106 156 123 -123 222 139 -246 255 255 -0 0 0 -246 255 246 -0 0 0 -0 0 0 -0 0 0 -230 238 246 -222 255 238 -189 238 197 -123 123 123 -115 197 156 -0 0 0 -0 0 0 -197 205 230 -32 115 139 -255 255 255 -222 238 222 -0 0 0 -131 197 139 -0 0 0 -139 156 197 -115 139 189 -0 90 82 -106 164 139 -57 115 90 -189 222 197 -0 0 0 -0 0 0 -0 0 0 -205 205 246 -230 238 230 -213 213 255 -156 156 222 -238 238 255 -189 189 238 -230 230 255 -222 222 255 -197 197 246 -189 189 238 -180 180 230 -172 172 230 -164 164 222 -156 156 222 -0 0 0 -0 0 0 -131 148 180 -213 230 246 -189 189 222 -90 98 115 -230 238 255 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -197 238 222 -255 205 205 -205 222 255 -222 255 255 -246 230 164 -0 0 0 -189 246 180 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -255 255 255 -0 0 0 -0 255 0 -164 180 180 -255 74 0 -246 255 246 -246 255 255 -0 0 0 -246 255 246 -0 0 0 -0 0 0 -0 0 0 -230 238 246 -0 0 0 -189 238 197 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -255 213 106 -255 74 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -246 255 255 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/battle_frontier/tourney_tree.png b/graphics/battle_frontier/tourney_tree.png index f60dd49d36b7..4dc8cecc13e0 100644 Binary files a/graphics/battle_frontier/tourney_tree.png and b/graphics/battle_frontier/tourney_tree.png differ diff --git a/graphics/battle_interface/burst_trigger.png b/graphics/battle_interface/burst_trigger.png new file mode 100644 index 000000000000..e3eb6384d4b4 Binary files /dev/null and b/graphics/battle_interface/burst_trigger.png differ diff --git a/graphics/battle_interface/last_used_ball_l_cycle.png b/graphics/battle_interface/last_used_ball_l_cycle.png new file mode 100644 index 000000000000..58115f5a578d Binary files /dev/null and b/graphics/battle_interface/last_used_ball_l_cycle.png differ diff --git a/graphics/battle_interface/last_used_ball_r_cycle.png b/graphics/battle_interface/last_used_ball_r_cycle.png new file mode 100644 index 000000000000..0a73148e15f5 Binary files /dev/null and b/graphics/battle_interface/last_used_ball_r_cycle.png differ diff --git a/graphics/berry_fix/gba_small.bin b/graphics/berry_fix/gba_connect.bin similarity index 100% rename from graphics/berry_fix/gba_small.bin rename to graphics/berry_fix/gba_connect.bin diff --git a/graphics/berry_fix/gba_connect.png b/graphics/berry_fix/gba_connect.png new file mode 100644 index 000000000000..78e29251940e Binary files /dev/null and b/graphics/berry_fix/gba_connect.png differ diff --git a/graphics/berry_fix/gba_small.pal b/graphics/berry_fix/gba_small.pal deleted file mode 100644 index 0e177217f57d..000000000000 --- a/graphics/berry_fix/gba_small.pal +++ /dev/null @@ -1,35 +0,0 @@ -JASC-PAL -0100 -32 -0 0 0 -255 255 255 -32 32 32 -172 172 172 -230 8 8 -255 189 115 -32 156 8 -148 246 148 -49 82 205 -164 197 246 -164 213 90 -238 230 197 -148 197 213 -32 57 98 -106 148 197 -90 106 156 -255 255 255 -164 213 90 -32 32 32 -123 123 205 -255 255 255 -74 74 115 -197 197 197 -98 98 189 -106 106 197 -98 123 57 -131 131 131 -222 41 0 -189 123 41 -180 180 222 -0 0 0 -0 0 0 diff --git a/graphics/berry_fix/gba_small.png b/graphics/berry_fix/gba_small.png deleted file mode 100644 index 3bf1f3e36125..000000000000 Binary files a/graphics/berry_fix/gba_small.png and /dev/null differ diff --git a/graphics/berry_fix/gba_transfer.pal b/graphics/berry_fix/gba_transfer.pal deleted file mode 100644 index 0e177217f57d..000000000000 --- a/graphics/berry_fix/gba_transfer.pal +++ /dev/null @@ -1,35 +0,0 @@ -JASC-PAL -0100 -32 -0 0 0 -255 255 255 -32 32 32 -172 172 172 -230 8 8 -255 189 115 -32 156 8 -148 246 148 -49 82 205 -164 197 246 -164 213 90 -238 230 197 -148 197 213 -32 57 98 -106 148 197 -90 106 156 -255 255 255 -164 213 90 -32 32 32 -123 123 205 -255 255 255 -74 74 115 -197 197 197 -98 98 189 -106 106 197 -98 123 57 -131 131 131 -222 41 0 -189 123 41 -180 180 222 -0 0 0 -0 0 0 diff --git a/graphics/berry_fix/gba_transfer.png b/graphics/berry_fix/gba_transfer.png index 9b7eb5571f9a..104227f8a745 100644 Binary files a/graphics/berry_fix/gba_transfer.png and b/graphics/berry_fix/gba_transfer.png differ diff --git a/graphics/berry_fix/gba_transfer_error.pal b/graphics/berry_fix/gba_transfer_error.pal deleted file mode 100644 index 0e177217f57d..000000000000 --- a/graphics/berry_fix/gba_transfer_error.pal +++ /dev/null @@ -1,35 +0,0 @@ -JASC-PAL -0100 -32 -0 0 0 -255 255 255 -32 32 32 -172 172 172 -230 8 8 -255 189 115 -32 156 8 -148 246 148 -49 82 205 -164 197 246 -164 213 90 -238 230 197 -148 197 213 -32 57 98 -106 148 197 -90 106 156 -255 255 255 -164 213 90 -32 32 32 -123 123 205 -255 255 255 -74 74 115 -197 197 197 -98 98 189 -106 106 197 -98 123 57 -131 131 131 -222 41 0 -189 123 41 -180 180 222 -0 0 0 -0 0 0 diff --git a/graphics/berry_fix/gba_transfer_error.png b/graphics/berry_fix/gba_transfer_error.png index d8db4bfb95fe..2154b1c4d2b5 100644 Binary files a/graphics/berry_fix/gba_transfer_error.png and b/graphics/berry_fix/gba_transfer_error.png differ diff --git a/graphics/berry_fix/gba_transfer_highlight.pal b/graphics/berry_fix/gba_transfer_highlight.pal deleted file mode 100644 index 0e177217f57d..000000000000 --- a/graphics/berry_fix/gba_transfer_highlight.pal +++ /dev/null @@ -1,35 +0,0 @@ -JASC-PAL -0100 -32 -0 0 0 -255 255 255 -32 32 32 -172 172 172 -230 8 8 -255 189 115 -32 156 8 -148 246 148 -49 82 205 -164 197 246 -164 213 90 -238 230 197 -148 197 213 -32 57 98 -106 148 197 -90 106 156 -255 255 255 -164 213 90 -32 32 32 -123 123 205 -255 255 255 -74 74 115 -197 197 197 -98 98 189 -106 106 197 -98 123 57 -131 131 131 -222 41 0 -189 123 41 -180 180 222 -0 0 0 -0 0 0 diff --git a/graphics/berry_fix/gba_transfer_highlight.png b/graphics/berry_fix/gba_transfer_highlight.png index 9fb9b6a48b22..f1845bdafd2f 100644 Binary files a/graphics/berry_fix/gba_transfer_highlight.png and b/graphics/berry_fix/gba_transfer_highlight.png differ diff --git a/graphics/berry_fix/logo.pal b/graphics/berry_fix/logo.pal deleted file mode 100644 index 4c76f3f9a8de..000000000000 --- a/graphics/berry_fix/logo.pal +++ /dev/null @@ -1,51 +0,0 @@ -JASC-PAL -0100 -48 -0 0 0 -255 255 255 -32 32 32 -172 172 172 -230 8 8 -255 189 115 -32 156 8 -148 246 148 -49 82 205 -164 197 246 -164 213 90 -238 230 197 -148 197 213 -32 57 98 -106 148 197 -90 106 156 -255 255 255 -164 213 90 -32 32 32 -123 123 205 -255 255 255 -74 74 115 -197 197 197 -98 98 189 -106 106 197 -98 123 57 -131 131 131 -222 41 0 -189 123 41 -180 180 222 -0 0 0 -0 0 0 -0 0 0 -255 255 255 -238 238 238 -222 222 230 -205 205 222 -197 197 205 -180 180 197 -164 164 189 -156 156 172 -139 139 164 -123 123 156 -115 115 139 -98 98 131 -82 82 123 -74 74 115 -32 32 32 diff --git a/graphics/berry_fix/logo.png b/graphics/berry_fix/logo.png index 29cda79b0a6c..189ca9780235 100644 Binary files a/graphics/berry_fix/logo.png and b/graphics/berry_fix/logo.png differ diff --git a/graphics/berry_fix/text.pal b/graphics/berry_fix/text.pal new file mode 100644 index 000000000000..28675e904d83 --- /dev/null +++ b/graphics/berry_fix/text.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +255 255 255 +255 255 255 +99 99 99 +214 214 206 +230 8 8 +255 189 115 +32 156 8 +148 246 148 +49 82 205 +164 197 246 +255 255 255 +99 99 99 +214 214 206 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/berry_fix/window.pal b/graphics/berry_fix/window.pal deleted file mode 100644 index 0e177217f57d..000000000000 --- a/graphics/berry_fix/window.pal +++ /dev/null @@ -1,35 +0,0 @@ -JASC-PAL -0100 -32 -0 0 0 -255 255 255 -32 32 32 -172 172 172 -230 8 8 -255 189 115 -32 156 8 -148 246 148 -49 82 205 -164 197 246 -164 213 90 -238 230 197 -148 197 213 -32 57 98 -106 148 197 -90 106 156 -255 255 255 -164 213 90 -32 32 32 -123 123 205 -255 255 255 -74 74 115 -197 197 197 -98 98 189 -106 106 197 -98 123 57 -131 131 131 -222 41 0 -189 123 41 -180 180 222 -0 0 0 -0 0 0 diff --git a/graphics/berry_fix/window.png b/graphics/berry_fix/window.png index 7b57701e3528..dd9f3b6af058 100644 Binary files a/graphics/berry_fix/window.png and b/graphics/berry_fix/window.png differ diff --git a/graphics/items/icon_palettes/bug_tera_shard.pal b/graphics/items/icon_palettes/bug_tera_shard.pal new file mode 100644 index 000000000000..548020fdf98e --- /dev/null +++ b/graphics/items/icon_palettes/bug_tera_shard.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 255 92 +0 0 0 +255 255 255 +241 247 180 +185 237 206 +153 229 190 +208 225 193 +107 164 67 +155 224 232 +110 219 159 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/items/icon_palettes/clear_amulet.pal b/graphics/items/icon_palettes/clear_amulet.pal new file mode 100644 index 000000000000..3a3de6d49a96 --- /dev/null +++ b/graphics/items/icon_palettes/clear_amulet.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 255 148 +86 46 12 +0 0 0 +231 114 114 +164 57 65 +179 83 91 +245 211 240 +234 173 227 +255 255 255 +239 218 139 +225 187 43 +127 97 27 +203 178 239 +140 200 244 +203 248 255 +150 240 255 diff --git a/graphics/items/icon_palettes/dark_tera_shard.pal b/graphics/items/icon_palettes/dark_tera_shard.pal new file mode 100644 index 000000000000..b855250a4f55 --- /dev/null +++ b/graphics/items/icon_palettes/dark_tera_shard.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 255 92 +0 0 0 +255 255 255 +177 181 211 +233 170 159 +168 164 170 +153 149 153 +45 44 49 +200 72 57 +100 108 167 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/items/icon_palettes/dragon_tera_shard.pal b/graphics/items/icon_palettes/dragon_tera_shard.pal new file mode 100644 index 000000000000..f86711a33475 --- /dev/null +++ b/graphics/items/icon_palettes/dragon_tera_shard.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 255 92 +0 0 0 +255 255 255 +199 221 235 +225 185 216 +202 138 188 +146 188 216 +32 75 132 +215 142 134 +173 57 140 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/items/icon_palettes/electric_tera_shard.pal b/graphics/items/icon_palettes/electric_tera_shard.pal new file mode 100644 index 000000000000..15b393c8508c --- /dev/null +++ b/graphics/items/icon_palettes/electric_tera_shard.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 255 92 +0 0 0 +255 255 255 +220 238 231 +249 247 189 +243 243 174 +242 227 174 +209 155 7 +173 214 99 +147 87 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/items/icon_palettes/fairy_tera_shard.pal b/graphics/items/icon_palettes/fairy_tera_shard.pal new file mode 100644 index 000000000000..58d6cae33ab7 --- /dev/null +++ b/graphics/items/icon_palettes/fairy_tera_shard.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 255 92 +0 0 0 +255 255 255 +213 224 243 +243 199 212 +139 131 164 +188 205 234 +187 54 111 +225 165 149 +226 147 172 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/items/icon_palettes/fighting_tera_shard.pal b/graphics/items/icon_palettes/fighting_tera_shard.pal new file mode 100644 index 000000000000..5ce8656904c2 --- /dev/null +++ b/graphics/items/icon_palettes/fighting_tera_shard.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 255 92 +0 0 0 +255 255 255 +248 191 188 +244 207 147 +241 188 105 +246 112 0 +178 63 0 +251 235 141 +233 157 39 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/items/icon_palettes/fire_tera_shard.pal b/graphics/items/icon_palettes/fire_tera_shard.pal new file mode 100644 index 000000000000..406b90e98124 --- /dev/null +++ b/graphics/items/icon_palettes/fire_tera_shard.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 255 92 +0 0 0 +255 255 255 +233 199 215 +243 181 145 +232 185 185 +186 38 40 +105 20 26 +253 245 121 +239 148 99 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/items/icon_palettes/flying_tera_shard.pal b/graphics/items/icon_palettes/flying_tera_shard.pal new file mode 100644 index 000000000000..461d9e5b8a7b --- /dev/null +++ b/graphics/items/icon_palettes/flying_tera_shard.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 255 92 +0 0 0 +255 255 255 +212 242 239 +198 191 239 +171 194 230 +157 239 231 +40 84 165 +215 175 232 +66 128 226 +171 202 223 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/items/icon_palettes/ghost_tera_shard.pal b/graphics/items/icon_palettes/ghost_tera_shard.pal new file mode 100644 index 000000000000..bba3a968f2e2 --- /dev/null +++ b/graphics/items/icon_palettes/ghost_tera_shard.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 255 92 +0 0 0 +255 255 255 +214 227 249 +208 175 239 +172 164 226 +188 183 231 +46 27 178 +234 76 104 +160 101 225 +171 202 223 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/items/icon_palettes/grass_tera_shard.pal b/graphics/items/icon_palettes/grass_tera_shard.pal new file mode 100644 index 000000000000..ce10ab10cec9 --- /dev/null +++ b/graphics/items/icon_palettes/grass_tera_shard.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 255 92 +0 0 0 +255 255 255 +211 233 194 +202 233 173 +171 225 199 +0 161 79 +255 239 132 +167 219 139 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/items/icon_palettes/ground_tera_shard.pal b/graphics/items/icon_palettes/ground_tera_shard.pal new file mode 100644 index 000000000000..b2168640b99d --- /dev/null +++ b/graphics/items/icon_palettes/ground_tera_shard.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 255 92 +0 0 0 +255 255 255 +232 214 212 +209 205 177 +216 198 174 +225 207 175 +159 104 0 +204 210 214 +188 182 142 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/items/icon_palettes/ice_tera_shard.pal b/graphics/items/icon_palettes/ice_tera_shard.pal new file mode 100644 index 000000000000..61ac07f67333 --- /dev/null +++ b/graphics/items/icon_palettes/ice_tera_shard.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 255 92 +0 0 0 +255 255 255 +237 235 231 +183 224 242 +76 171 182 +58 121 135 +137 157 224 +183 221 224 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/items/icon_palettes/normal_tera_shard.pal b/graphics/items/icon_palettes/normal_tera_shard.pal new file mode 100644 index 000000000000..5792b00342fd --- /dev/null +++ b/graphics/items/icon_palettes/normal_tera_shard.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 255 92 +0 0 0 +255 255 255 +241 241 229 +236 218 200 +221 219 215 +224 222 218 +159 146 133 +175 204 224 +223 197 166 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/items/icon_palettes/poison_tera_shard.pal b/graphics/items/icon_palettes/poison_tera_shard.pal new file mode 100644 index 000000000000..92eb2adafcc6 --- /dev/null +++ b/graphics/items/icon_palettes/poison_tera_shard.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 255 92 +0 0 0 +255 255 255 +188 233 208 +213 161 233 +202 138 188 +195 179 220 +74 23 153 +227 101 191 +165 72 209 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/items/icon_palettes/psychic_tera_shard.pal b/graphics/items/icon_palettes/psychic_tera_shard.pal new file mode 100644 index 000000000000..e4c7e586044f --- /dev/null +++ b/graphics/items/icon_palettes/psychic_tera_shard.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 255 92 +0 0 0 +255 255 255 +201 199 238 +225 181 237 +202 138 188 +228 181 216 +167 25 135 +217 120 165 +189 109 220 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/items/icon_palettes/rock_tera_shard.pal b/graphics/items/icon_palettes/rock_tera_shard.pal new file mode 100644 index 000000000000..8575ff4d73fd --- /dev/null +++ b/graphics/items/icon_palettes/rock_tera_shard.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 255 92 +0 0 0 +255 255 255 +227 210 173 +192 187 225 +171 164 209 +209 172 159 +159 57 18 +171 139 179 +123 123 198 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/items/icon_palettes/steel_tera_shard.pal b/graphics/items/icon_palettes/steel_tera_shard.pal new file mode 100644 index 000000000000..9dd861037d90 --- /dev/null +++ b/graphics/items/icon_palettes/steel_tera_shard.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 255 92 +0 0 0 +255 255 255 +220 227 225 +196 209 205 +168 183 189 +202 208 215 +57 67 89 +182 154 134 +121 147 155 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/items/icon_palettes/water_tera_shard.pal b/graphics/items/icon_palettes/water_tera_shard.pal new file mode 100644 index 000000000000..db62ce1e34ca --- /dev/null +++ b/graphics/items/icon_palettes/water_tera_shard.pal @@ -0,0 +1,13 @@ +JASC-PAL +0100 +10 +0 255 92 +0 0 0 +255 255 255 +221 246 229 +194 223 242 +166 174 226 +192 196 234 +57 67 189 +145 233 225 +137 195 227 diff --git a/graphics/items/icons/berserk_gene.png b/graphics/items/icons/berserk_gene.png index faac0f67690b..54007c804e9a 100644 Binary files a/graphics/items/icons/berserk_gene.png and b/graphics/items/icons/berserk_gene.png differ diff --git a/graphics/items/icons/black_augurite.png b/graphics/items/icons/black_augurite.png index 8be2bc188c9b..1d755a90560f 100644 Binary files a/graphics/items/icons/black_augurite.png and b/graphics/items/icons/black_augurite.png differ diff --git a/graphics/items/icons/clear_amulet.png b/graphics/items/icons/clear_amulet.png new file mode 100644 index 000000000000..a9c2b08c8c5d Binary files /dev/null and b/graphics/items/icons/clear_amulet.png differ diff --git a/graphics/items/icons/linking_cord.png b/graphics/items/icons/linking_cord.png index a3f92da04b75..079f1d8db3d5 100644 Binary files a/graphics/items/icons/linking_cord.png and b/graphics/items/icons/linking_cord.png differ diff --git a/graphics/items/icons/peat_block.png b/graphics/items/icons/peat_block.png index 9c106598756e..25a3c3bc0568 100644 Binary files a/graphics/items/icons/peat_block.png and b/graphics/items/icons/peat_block.png differ diff --git a/graphics/items/icons/tera_shard.png b/graphics/items/icons/tera_shard.png new file mode 100644 index 000000000000..c4e9854865ca Binary files /dev/null and b/graphics/items/icons/tera_shard.png differ diff --git a/graphics/pokemon/abomasnow/anim_frontf.png b/graphics/pokemon/abomasnow/anim_frontf.png new file mode 100644 index 000000000000..49fdfb706a5f Binary files /dev/null and b/graphics/pokemon/abomasnow/anim_frontf.png differ diff --git a/graphics/pokemon/abra/anim_front.png b/graphics/pokemon/abra/anim_front.png index fbbf2d583603..a87da90e0f5d 100644 Binary files a/graphics/pokemon/abra/anim_front.png and b/graphics/pokemon/abra/anim_front.png differ diff --git a/graphics/pokemon/abra/back.png b/graphics/pokemon/abra/back.png index 5de7d05205f6..7468d8f80ed4 100644 Binary files a/graphics/pokemon/abra/back.png and b/graphics/pokemon/abra/back.png differ diff --git a/graphics/pokemon/abra/normal.pal b/graphics/pokemon/abra/normal.pal index 8c4d72e5cd2b..b8ef761d351a 100644 --- a/graphics/pokemon/abra/normal.pal +++ b/graphics/pokemon/abra/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -88 56 8 -120 96 24 +255 0 255 +255 0 255 +255 0 255 +213 180 82 +172 131 41 +131 98 8 +90 57 0 +255 0 255 +246 246 164 255 230 41 -90 57 8 205 189 32 -246 246 164 -168 136 24 -172 131 41 +172 139 24 +131 90 16 +90 57 8 16 16 16 -131 98 8 -208 176 80 -176 160 152 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/pokemon/abra/shiny.pal b/graphics/pokemon/abra/shiny.pal index e8c79eea1d15..e72eec2b4485 100644 --- a/graphics/pokemon/abra/shiny.pal +++ b/graphics/pokemon/abra/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -136 80 24 -168 104 40 -248 240 128 -88 48 56 -232 200 48 -248 240 216 -200 152 32 -184 136 144 +255 0 255 +255 0 255 +255 0 255 +222 180 189 +189 139 148 +139 98 106 +90 49 57 +255 0 255 +255 246 222 +255 246 131 +238 205 49 +205 156 32 +172 106 41 +139 82 24 16 16 16 -136 96 104 -208 176 80 -216 176 184 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/pokemon/absol/anim_front.png b/graphics/pokemon/absol/anim_front.png index 9a53d575c960..15db59ab0802 100644 Binary files a/graphics/pokemon/absol/anim_front.png and b/graphics/pokemon/absol/anim_front.png differ diff --git a/graphics/pokemon/absol/icon.png b/graphics/pokemon/absol/icon.png index d58d208a7bd3..d32474c0d580 100644 Binary files a/graphics/pokemon/absol/icon.png and b/graphics/pokemon/absol/icon.png differ diff --git a/graphics/pokemon/accelgor/icon.png b/graphics/pokemon/accelgor/icon.png index 5d971a97b24c..25521ecbaf42 100644 Binary files a/graphics/pokemon/accelgor/icon.png and b/graphics/pokemon/accelgor/icon.png differ diff --git a/graphics/pokemon/aerodactyl/anim_front.png b/graphics/pokemon/aerodactyl/anim_front.png index 2d36a2ad26c2..be6abfd2b6f1 100644 Binary files a/graphics/pokemon/aerodactyl/anim_front.png and b/graphics/pokemon/aerodactyl/anim_front.png differ diff --git a/graphics/pokemon/aerodactyl/icon.png b/graphics/pokemon/aerodactyl/icon.png index 58c96d57c7fc..258db4b5b3f5 100644 Binary files a/graphics/pokemon/aerodactyl/icon.png and b/graphics/pokemon/aerodactyl/icon.png differ diff --git a/graphics/pokemon/aggron/icon.png b/graphics/pokemon/aggron/icon.png index 3eaa0605429f..26abbb44becb 100644 Binary files a/graphics/pokemon/aggron/icon.png and b/graphics/pokemon/aggron/icon.png differ diff --git a/graphics/pokemon/aipom/anim_front.png b/graphics/pokemon/aipom/anim_front.png index c3e884d875b7..d015b19b5292 100644 Binary files a/graphics/pokemon/aipom/anim_front.png and b/graphics/pokemon/aipom/anim_front.png differ diff --git a/graphics/pokemon/aipom/anim_frontf.png b/graphics/pokemon/aipom/anim_frontf.png new file mode 100644 index 000000000000..c4be36d2476c Binary files /dev/null and b/graphics/pokemon/aipom/anim_frontf.png differ diff --git a/graphics/pokemon/aipom/backf.png b/graphics/pokemon/aipom/backf.png new file mode 100644 index 000000000000..66e192be98fe Binary files /dev/null and b/graphics/pokemon/aipom/backf.png differ diff --git a/graphics/pokemon/aipom/icon.png b/graphics/pokemon/aipom/icon.png index 294ab74eb43d..fa771697a5f8 100644 Binary files a/graphics/pokemon/aipom/icon.png and b/graphics/pokemon/aipom/icon.png differ diff --git a/graphics/pokemon/alakazam/anim_front.png b/graphics/pokemon/alakazam/anim_front.png index 2f49747fb706..0bbc07a98256 100644 Binary files a/graphics/pokemon/alakazam/anim_front.png and b/graphics/pokemon/alakazam/anim_front.png differ diff --git a/graphics/pokemon/alakazam/anim_frontf.png b/graphics/pokemon/alakazam/anim_frontf.png new file mode 100644 index 000000000000..d89386990e30 Binary files /dev/null and b/graphics/pokemon/alakazam/anim_frontf.png differ diff --git a/graphics/pokemon/alakazam/back.png b/graphics/pokemon/alakazam/back.png index a33340b0e960..a26d52b3c1c6 100644 Binary files a/graphics/pokemon/alakazam/back.png and b/graphics/pokemon/alakazam/back.png differ diff --git a/graphics/pokemon/alakazam/backf.png b/graphics/pokemon/alakazam/backf.png new file mode 100644 index 000000000000..9e727e6520bf Binary files /dev/null and b/graphics/pokemon/alakazam/backf.png differ diff --git a/graphics/pokemon/alakazam/icon.png b/graphics/pokemon/alakazam/icon.png index e823e94cd36a..38329c0783e2 100644 Binary files a/graphics/pokemon/alakazam/icon.png and b/graphics/pokemon/alakazam/icon.png differ diff --git a/graphics/pokemon/alakazam/normal.pal b/graphics/pokemon/alakazam/normal.pal index de1ad1131ddc..3ec4f421c713 100644 --- a/graphics/pokemon/alakazam/normal.pal +++ b/graphics/pokemon/alakazam/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -112 88 8 -255 238 41 -213 189 16 -16 16 16 -255 246 172 -131 98 8 -82 49 8 +255 255 255 +222 222 222 +180 180 180 +90 90 90 213 180 82 180 131 41 -88 88 88 -248 248 248 -176 176 168 -216 216 216 -96 96 88 -80 48 8 +120 88 8 +82 49 8 +104 80 8 +152 112 0 +255 246 172 +255 238 24 +200 176 16 +112 88 8 +16 16 16 diff --git a/graphics/pokemon/alakazam/shiny.pal b/graphics/pokemon/alakazam/shiny.pal index e6518d11694e..9fcc9ad86579 100644 --- a/graphics/pokemon/alakazam/shiny.pal +++ b/graphics/pokemon/alakazam/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -160 104 0 -240 208 32 -200 144 24 +255 255 255 +222 222 222 +180 180 180 +90 90 90 +255 148 230 +222 74 172 +172 41 115 +115 16 82 +104 64 8 +152 104 0 +255 238 131 +255 213 0 +213 148 8 +164 106 0 16 16 16 -248 232 128 -152 48 112 -112 16 80 -248 144 224 -200 88 160 -88 88 88 -248 248 248 -176 176 176 -216 216 216 -88 88 88 -112 88 8 diff --git a/graphics/pokemon/alcremie/caramel_swirl/front.png b/graphics/pokemon/alcremie/caramel_swirl/front.png index 3b52242b14c3..4912e61d5051 100644 Binary files a/graphics/pokemon/alcremie/caramel_swirl/front.png and b/graphics/pokemon/alcremie/caramel_swirl/front.png differ diff --git a/graphics/pokemon/alcremie/lemon_cream/front.png b/graphics/pokemon/alcremie/lemon_cream/front.png index 4fff85bc541a..fefb952fd4dd 100644 Binary files a/graphics/pokemon/alcremie/lemon_cream/front.png and b/graphics/pokemon/alcremie/lemon_cream/front.png differ diff --git a/graphics/pokemon/alcremie/matcha_cream/back.png b/graphics/pokemon/alcremie/matcha_cream/back.png index 2ef7e2d3bdf0..7a422730b9f0 100644 Binary files a/graphics/pokemon/alcremie/matcha_cream/back.png and b/graphics/pokemon/alcremie/matcha_cream/back.png differ diff --git a/graphics/pokemon/alcremie/matcha_cream/front.png b/graphics/pokemon/alcremie/matcha_cream/front.png index 7dfe1b3073b5..28225df1a016 100644 Binary files a/graphics/pokemon/alcremie/matcha_cream/front.png and b/graphics/pokemon/alcremie/matcha_cream/front.png differ diff --git a/graphics/pokemon/alcremie/mint_cream/front.png b/graphics/pokemon/alcremie/mint_cream/front.png index e019cb098ac3..9d525253fa5b 100644 Binary files a/graphics/pokemon/alcremie/mint_cream/front.png and b/graphics/pokemon/alcremie/mint_cream/front.png differ diff --git a/graphics/pokemon/alcremie/rainbow_swirl/back.png b/graphics/pokemon/alcremie/rainbow_swirl/back.png index 06abc68128d0..065e4ab78102 100644 Binary files a/graphics/pokemon/alcremie/rainbow_swirl/back.png and b/graphics/pokemon/alcremie/rainbow_swirl/back.png differ diff --git a/graphics/pokemon/alcremie/ruby_cream/front.png b/graphics/pokemon/alcremie/ruby_cream/front.png index 3f59ec810787..e64880a8cf1d 100644 Binary files a/graphics/pokemon/alcremie/ruby_cream/front.png and b/graphics/pokemon/alcremie/ruby_cream/front.png differ diff --git a/graphics/pokemon/alcremie/salted_cream/front.png b/graphics/pokemon/alcremie/salted_cream/front.png index 13cc028c444a..7958715bccb2 100644 Binary files a/graphics/pokemon/alcremie/salted_cream/front.png and b/graphics/pokemon/alcremie/salted_cream/front.png differ diff --git a/graphics/pokemon/altaria/back.png b/graphics/pokemon/altaria/back.png index 77b89ed0b621..39f3889ecb27 100644 Binary files a/graphics/pokemon/altaria/back.png and b/graphics/pokemon/altaria/back.png differ diff --git a/graphics/pokemon/altaria/icon.png b/graphics/pokemon/altaria/icon.png index 8c9bf81982dd..68f3d2392079 100644 Binary files a/graphics/pokemon/altaria/icon.png and b/graphics/pokemon/altaria/icon.png differ diff --git a/graphics/pokemon/ambipom/anim_front.png b/graphics/pokemon/ambipom/anim_front.png index 0cfc584398a7..56ca2b37e8d0 100644 Binary files a/graphics/pokemon/ambipom/anim_front.png and b/graphics/pokemon/ambipom/anim_front.png differ diff --git a/graphics/pokemon/ambipom/anim_frontf.png b/graphics/pokemon/ambipom/anim_frontf.png new file mode 100644 index 000000000000..6754bcb233ee Binary files /dev/null and b/graphics/pokemon/ambipom/anim_frontf.png differ diff --git a/graphics/pokemon/ambipom/back.png b/graphics/pokemon/ambipom/back.png index e8cc58d5fab7..3c628daceaba 100644 Binary files a/graphics/pokemon/ambipom/back.png and b/graphics/pokemon/ambipom/back.png differ diff --git a/graphics/pokemon/ambipom/backf.png b/graphics/pokemon/ambipom/backf.png new file mode 100644 index 000000000000..357c4c40d49b Binary files /dev/null and b/graphics/pokemon/ambipom/backf.png differ diff --git a/graphics/pokemon/amoonguss/icon.png b/graphics/pokemon/amoonguss/icon.png index baf24220746f..bf225d187df1 100644 Binary files a/graphics/pokemon/amoonguss/icon.png and b/graphics/pokemon/amoonguss/icon.png differ diff --git a/graphics/pokemon/ampharos/anim_front.png b/graphics/pokemon/ampharos/anim_front.png index 4e71838b0078..fd9fd3e7b720 100644 Binary files a/graphics/pokemon/ampharos/anim_front.png and b/graphics/pokemon/ampharos/anim_front.png differ diff --git a/graphics/pokemon/ampharos/back.png b/graphics/pokemon/ampharos/back.png index 7cba18fe4780..6c9776946d99 100644 Binary files a/graphics/pokemon/ampharos/back.png and b/graphics/pokemon/ampharos/back.png differ diff --git a/graphics/pokemon/appletun/anim_front.png b/graphics/pokemon/appletun/anim_front.png new file mode 100644 index 000000000000..da5c23eb5402 Binary files /dev/null and b/graphics/pokemon/appletun/anim_front.png differ diff --git a/graphics/pokemon/appletun/front.png b/graphics/pokemon/appletun/front.png deleted file mode 100644 index 6d755f397ed1..000000000000 Binary files a/graphics/pokemon/appletun/front.png and /dev/null differ diff --git a/graphics/pokemon/applin/anim_front.png b/graphics/pokemon/applin/anim_front.png new file mode 100644 index 000000000000..b2ec38de2868 Binary files /dev/null and b/graphics/pokemon/applin/anim_front.png differ diff --git a/graphics/pokemon/applin/front.png b/graphics/pokemon/applin/front.png deleted file mode 100644 index bfbbf8eecc23..000000000000 Binary files a/graphics/pokemon/applin/front.png and /dev/null differ diff --git a/graphics/pokemon/araquanid/anim_front.png b/graphics/pokemon/araquanid/anim_front.png new file mode 100644 index 000000000000..d6bff38c76b0 Binary files /dev/null and b/graphics/pokemon/araquanid/anim_front.png differ diff --git a/graphics/pokemon/araquanid/front.png b/graphics/pokemon/araquanid/front.png deleted file mode 100644 index 44210755999d..000000000000 Binary files a/graphics/pokemon/araquanid/front.png and /dev/null differ diff --git a/graphics/pokemon/arbok/anim_front.png b/graphics/pokemon/arbok/anim_front.png index 351274bd8776..ba158f864100 100644 Binary files a/graphics/pokemon/arbok/anim_front.png and b/graphics/pokemon/arbok/anim_front.png differ diff --git a/graphics/pokemon/arbok/back.png b/graphics/pokemon/arbok/back.png index c8e78fccfbe8..b0da328c65e8 100644 Binary files a/graphics/pokemon/arbok/back.png and b/graphics/pokemon/arbok/back.png differ diff --git a/graphics/pokemon/arbok/normal.pal b/graphics/pokemon/arbok/normal.pal index 8ef9ad315018..6a516dc3dffc 100644 --- a/graphics/pokemon/arbok/normal.pal +++ b/graphics/pokemon/arbok/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 +255 172 131 +197 180 0 +246 115 74 +197 65 24 +246 115 74 +197 65 24 +156 16 0 16 16 16 -164 131 197 197 164 238 +164 131 197 123 98 172 82 57 123 +156 16 0 197 197 197 255 255 255 -156 16 0 -197 65 24 -156 16 0 -197 65 24 -246 115 74 -197 180 0 -120 96 168 -0 0 0 diff --git a/graphics/pokemon/arbok/shiny.pal b/graphics/pokemon/arbok/shiny.pal index 7498bf4b2e18..df9c4848a014 100644 --- a/graphics/pokemon/arbok/shiny.pal +++ b/graphics/pokemon/arbok/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 +255 172 131 +238 222 24 +240 112 72 +192 64 24 +90 164 255 +24 98 197 +0 49 148 16 16 16 -208 184 56 -224 224 144 -160 120 56 -104 80 24 -192 192 192 -248 248 248 -56 104 160 -120 160 208 -32 64 128 -48 112 184 -152 184 224 -232 216 56 -160 120 48 -0 0 0 +222 222 90 +213 180 32 +164 123 32 +131 90 0 +152 16 0 +197 197 197 +255 255 255 diff --git a/graphics/pokemon/arcanine/anim_front.png b/graphics/pokemon/arcanine/anim_front.png index 907e6d12b7c3..b1643339d72a 100644 Binary files a/graphics/pokemon/arcanine/anim_front.png and b/graphics/pokemon/arcanine/anim_front.png differ diff --git a/graphics/pokemon/arcanine/back.png b/graphics/pokemon/arcanine/back.png index feb3343d7195..98291f4044ac 100644 Binary files a/graphics/pokemon/arcanine/back.png and b/graphics/pokemon/arcanine/back.png differ diff --git a/graphics/pokemon/arcanine/hisuian/back.png b/graphics/pokemon/arcanine/hisuian/back.png index cf835c6f1d03..9cd51ee3cb32 100755 Binary files a/graphics/pokemon/arcanine/hisuian/back.png and b/graphics/pokemon/arcanine/hisuian/back.png differ diff --git a/graphics/pokemon/arcanine/hisuian/front.png b/graphics/pokemon/arcanine/hisuian/front.png index d546311f1359..1a60616afaf5 100755 Binary files a/graphics/pokemon/arcanine/hisuian/front.png and b/graphics/pokemon/arcanine/hisuian/front.png differ diff --git a/graphics/pokemon/arcanine/normal.pal b/graphics/pokemon/arcanine/normal.pal index 0d552ffc3b8f..621362d93be0 100644 --- a/graphics/pokemon/arcanine/normal.pal +++ b/graphics/pokemon/arcanine/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -148 98 32 -16 16 16 +255 255 246 +222 222 213 +131 106 98 +255 98 65 +197 49 32 +193 147 73 +255 255 197 255 246 148 238 197 115 -98 16 0 +148 98 32 +255 156 106 238 115 49 197 82 90 -216 216 208 -248 248 240 -88 104 112 -255 156 106 -168 48 16 -148 98 32 -0 0 0 -0 0 0 +98 16 0 +16 16 16 diff --git a/graphics/pokemon/arcanine/shiny.pal b/graphics/pokemon/arcanine/shiny.pal index e6ce73d7f126..b557f4e96cdf 100644 --- a/graphics/pokemon/arcanine/shiny.pal +++ b/graphics/pokemon/arcanine/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -120 112 56 +255 255 246 +222 222 213 +131 106 98 +255 98 65 +197 49 32 +160 136 112 +255 238 230 +246 230 189 +213 189 148 +104 88 80 +246 255 123 +230 213 41 +180 156 0 +88 72 16 16 16 16 -240 240 176 -208 192 120 -88 72 32 -216 200 56 -168 152 32 -216 216 208 -248 248 240 -128 104 96 -240 240 144 -181 78 66 -176 144 64 -0 0 0 -0 0 0 diff --git a/graphics/pokemon/arceus/icon.png b/graphics/pokemon/arceus/icon.png index 6141c35e8c92..7d2b2ceddc6f 100644 Binary files a/graphics/pokemon/arceus/icon.png and b/graphics/pokemon/arceus/icon.png differ diff --git a/graphics/pokemon/ariados/anim_front.png b/graphics/pokemon/ariados/anim_front.png index 024aa0bebf9e..945c4d188f30 100644 Binary files a/graphics/pokemon/ariados/anim_front.png and b/graphics/pokemon/ariados/anim_front.png differ diff --git a/graphics/pokemon/ariados/icon.png b/graphics/pokemon/ariados/icon.png index e6206a3cb5a3..b23d0467b395 100644 Binary files a/graphics/pokemon/ariados/icon.png and b/graphics/pokemon/ariados/icon.png differ diff --git a/graphics/pokemon/armaldo/icon.png b/graphics/pokemon/armaldo/icon.png index 1277dbbbe0ee..46f176196da9 100644 Binary files a/graphics/pokemon/armaldo/icon.png and b/graphics/pokemon/armaldo/icon.png differ diff --git a/graphics/pokemon/articuno/anim_front.png b/graphics/pokemon/articuno/anim_front.png index 80cacd7391f3..cd40ac4a2e49 100644 Binary files a/graphics/pokemon/articuno/anim_front.png and b/graphics/pokemon/articuno/anim_front.png differ diff --git a/graphics/pokemon/articuno/icon.png b/graphics/pokemon/articuno/icon.png index c50044963418..09e4048a1beb 100644 Binary files a/graphics/pokemon/articuno/icon.png and b/graphics/pokemon/articuno/icon.png differ diff --git a/graphics/pokemon/avalugg/hisuian/back.png b/graphics/pokemon/avalugg/hisuian/back.png index 6bf621584946..dc98bd9ebd08 100755 Binary files a/graphics/pokemon/avalugg/hisuian/back.png and b/graphics/pokemon/avalugg/hisuian/back.png differ diff --git a/graphics/pokemon/avalugg/hisuian/front.png b/graphics/pokemon/avalugg/hisuian/front.png index 58201f335fc7..63a13475c00d 100755 Binary files a/graphics/pokemon/avalugg/hisuian/front.png and b/graphics/pokemon/avalugg/hisuian/front.png differ diff --git a/graphics/pokemon/azelf/icon.png b/graphics/pokemon/azelf/icon.png index 816b6f5cc7b4..e3822194eb2d 100644 Binary files a/graphics/pokemon/azelf/icon.png and b/graphics/pokemon/azelf/icon.png differ diff --git a/graphics/pokemon/azumarill/icon.png b/graphics/pokemon/azumarill/icon.png index 8d1a6267602f..ecef25812255 100644 Binary files a/graphics/pokemon/azumarill/icon.png and b/graphics/pokemon/azumarill/icon.png differ diff --git a/graphics/pokemon/bagon/back.png b/graphics/pokemon/bagon/back.png index 1bab33f32c35..b2b33b15928b 100644 Binary files a/graphics/pokemon/bagon/back.png and b/graphics/pokemon/bagon/back.png differ diff --git a/graphics/pokemon/basculegion/back.png b/graphics/pokemon/basculegion/back.png index cb4e0c0883e7..97c2dd3d980f 100755 Binary files a/graphics/pokemon/basculegion/back.png and b/graphics/pokemon/basculegion/back.png differ diff --git a/graphics/pokemon/basculegion/female/back.png b/graphics/pokemon/basculegion/female/back.png index a1ce4263e250..95be1e80e8c1 100755 Binary files a/graphics/pokemon/basculegion/female/back.png and b/graphics/pokemon/basculegion/female/back.png differ diff --git a/graphics/pokemon/basculegion/female/front.png b/graphics/pokemon/basculegion/female/front.png index 5b91d3a84c45..ed6da5a68f49 100755 Binary files a/graphics/pokemon/basculegion/female/front.png and b/graphics/pokemon/basculegion/female/front.png differ diff --git a/graphics/pokemon/basculegion/front.png b/graphics/pokemon/basculegion/front.png index 4d46e3cbc637..7d147d198e98 100755 Binary files a/graphics/pokemon/basculegion/front.png and b/graphics/pokemon/basculegion/front.png differ diff --git a/graphics/pokemon/basculin/blue_striped/back.png b/graphics/pokemon/basculin/blue_striped/back.png index 9578c6665f90..df4ae78b6f53 100644 Binary files a/graphics/pokemon/basculin/blue_striped/back.png and b/graphics/pokemon/basculin/blue_striped/back.png differ diff --git a/graphics/pokemon/basculin/blue_striped/icon.png b/graphics/pokemon/basculin/blue_striped/icon.png index d84ec283fc60..31f020bde4de 100644 Binary files a/graphics/pokemon/basculin/blue_striped/icon.png and b/graphics/pokemon/basculin/blue_striped/icon.png differ diff --git a/graphics/pokemon/bayleef/anim_front.png b/graphics/pokemon/bayleef/anim_front.png index 05f44e73b544..46915d15c524 100644 Binary files a/graphics/pokemon/bayleef/anim_front.png and b/graphics/pokemon/bayleef/anim_front.png differ diff --git a/graphics/pokemon/beartic/back.png b/graphics/pokemon/beartic/back.png index ab4586f69eda..1eb01303014e 100644 Binary files a/graphics/pokemon/beartic/back.png and b/graphics/pokemon/beartic/back.png differ diff --git a/graphics/pokemon/beartic/icon.png b/graphics/pokemon/beartic/icon.png index 991f9f265d21..796a2aeefcd6 100644 Binary files a/graphics/pokemon/beartic/icon.png and b/graphics/pokemon/beartic/icon.png differ diff --git a/graphics/pokemon/beautifly/anim_front.png b/graphics/pokemon/beautifly/anim_front.png index 018925f0213c..0b7789662440 100644 Binary files a/graphics/pokemon/beautifly/anim_front.png and b/graphics/pokemon/beautifly/anim_front.png differ diff --git a/graphics/pokemon/beautifly/anim_frontf.png b/graphics/pokemon/beautifly/anim_frontf.png new file mode 100644 index 000000000000..ad466f6ce7a9 Binary files /dev/null and b/graphics/pokemon/beautifly/anim_frontf.png differ diff --git a/graphics/pokemon/beautifly/back.png b/graphics/pokemon/beautifly/back.png index eb47feeea41a..4755a86ab953 100644 Binary files a/graphics/pokemon/beautifly/back.png and b/graphics/pokemon/beautifly/back.png differ diff --git a/graphics/pokemon/beautifly/backf.png b/graphics/pokemon/beautifly/backf.png new file mode 100644 index 000000000000..f52187c9fdd4 Binary files /dev/null and b/graphics/pokemon/beautifly/backf.png differ diff --git a/graphics/pokemon/beedrill/anim_front.png b/graphics/pokemon/beedrill/anim_front.png index 05e48a56c9d0..b8b8eacbe309 100644 Binary files a/graphics/pokemon/beedrill/anim_front.png and b/graphics/pokemon/beedrill/anim_front.png differ diff --git a/graphics/pokemon/beedrill/back.png b/graphics/pokemon/beedrill/back.png index c08b67fb5558..e3ef11dce418 100644 Binary files a/graphics/pokemon/beedrill/back.png and b/graphics/pokemon/beedrill/back.png differ diff --git a/graphics/pokemon/beedrill/normal.pal b/graphics/pokemon/beedrill/normal.pal index 5dcebed760f5..c04b1878fc99 100644 --- a/graphics/pokemon/beedrill/normal.pal +++ b/graphics/pokemon/beedrill/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -139 123 148 -189 172 197 255 255 255 -24 24 24 -222 205 246 -82 90 123 -131 74 0 -230 148 32 255 246 164 255 205 74 -156 0 8 -213 24 49 -255 148 106 +230 148 32 180 98 16 -232 224 248 +131 74 0 +238 230 255 +222 205 246 +189 172 197 +139 123 148 +255 148 106 +213 24 49 +156 0 8 +82 90 123 +24 24 24 diff --git a/graphics/pokemon/beedrill/shiny.pal b/graphics/pokemon/beedrill/shiny.pal index 01f97d385427..7d03a33c12fd 100644 --- a/graphics/pokemon/beedrill/shiny.pal +++ b/graphics/pokemon/beedrill/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -136 128 144 -184 176 192 -248 248 248 +208 152 160 +255 255 255 +230 255 189 +189 238 0 +131 197 41 +90 164 0 +57 115 0 +238 238 255 +222 213 246 +189 180 197 +139 131 148 +123 148 255 +49 98 213 +16 32 164 +82 90 123 24 24 24 -216 208 240 -80 88 120 -56 112 0 -128 192 40 -224 248 184 -184 232 0 -16 32 160 -48 96 208 -120 144 248 -88 160 0 -232 224 248 diff --git a/graphics/pokemon/beldum/icon.png b/graphics/pokemon/beldum/icon.png index af22605458fe..17bd9af8b107 100644 Binary files a/graphics/pokemon/beldum/icon.png and b/graphics/pokemon/beldum/icon.png differ diff --git a/graphics/pokemon/bellsprout/anim_front.png b/graphics/pokemon/bellsprout/anim_front.png index d148f8134313..b6309f008c3f 100644 Binary files a/graphics/pokemon/bellsprout/anim_front.png and b/graphics/pokemon/bellsprout/anim_front.png differ diff --git a/graphics/pokemon/bellsprout/back.png b/graphics/pokemon/bellsprout/back.png index 0c6220c26dc0..8385882c2b0a 100644 Binary files a/graphics/pokemon/bellsprout/back.png and b/graphics/pokemon/bellsprout/back.png differ diff --git a/graphics/pokemon/bellsprout/icon.png b/graphics/pokemon/bellsprout/icon.png index ff6ca2c33716..abd4994fdb80 100644 Binary files a/graphics/pokemon/bellsprout/icon.png and b/graphics/pokemon/bellsprout/icon.png differ diff --git a/graphics/pokemon/bellsprout/normal.pal b/graphics/pokemon/bellsprout/normal.pal index 3a2a60032c9e..cb766b2a0bcf 100644 --- a/graphics/pokemon/bellsprout/normal.pal +++ b/graphics/pokemon/bellsprout/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -148 106 65 -255 255 255 -255 238 164 +152 160 208 +0 0 0 90 57 0 -230 189 131 -248 248 248 -16 16 16 -144 104 64 +148 106 65 +172 123 65 115 32 0 +180 65 49 +213 98 106 230 139 148 65 106 16 -213 98 106 -123 197 82 -180 65 49 98 164 65 +123 197 82 +172 238 148 +208 189 96 +240 224 112 +255 255 255 diff --git a/graphics/pokemon/bellsprout/shiny.pal b/graphics/pokemon/bellsprout/shiny.pal index 89668940d32b..366527e0c8e1 100644 --- a/graphics/pokemon/bellsprout/shiny.pal +++ b/graphics/pokemon/bellsprout/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -168 120 64 -248 248 216 -248 240 136 -88 56 0 -216 200 88 -248 248 248 -16 16 16 -144 104 64 -128 88 112 -240 192 224 -152 112 40 -208 168 192 -216 208 72 -168 128 160 -192 168 48 +0 0 0 +90 57 0 +148 106 65 +172 123 65 +131 90 115 +172 131 164 +213 172 197 +246 197 230 +156 106 8 +197 164 8 +222 213 57 +246 255 82 +222 197 24 +255 246 139 +255 255 255 diff --git a/graphics/pokemon/bewear/anim_front.png b/graphics/pokemon/bewear/anim_front.png new file mode 100644 index 000000000000..45ce9a290195 Binary files /dev/null and b/graphics/pokemon/bewear/anim_front.png differ diff --git a/graphics/pokemon/bewear/front.png b/graphics/pokemon/bewear/front.png deleted file mode 100644 index 8bcb1607b10d..000000000000 Binary files a/graphics/pokemon/bewear/front.png and /dev/null differ diff --git a/graphics/pokemon/bibarel/anim_front.png b/graphics/pokemon/bibarel/anim_front.png index c9a7d403186e..2143b6996fdd 100644 Binary files a/graphics/pokemon/bibarel/anim_front.png and b/graphics/pokemon/bibarel/anim_front.png differ diff --git a/graphics/pokemon/bibarel/anim_frontf.png b/graphics/pokemon/bibarel/anim_frontf.png new file mode 100644 index 000000000000..a15a6b5f895f Binary files /dev/null and b/graphics/pokemon/bibarel/anim_frontf.png differ diff --git a/graphics/pokemon/bibarel/normal.pal b/graphics/pokemon/bibarel/normal.pal index 71a5f280ae8d..cc531ec662ef 100644 --- a/graphics/pokemon/bibarel/normal.pal +++ b/graphics/pokemon/bibarel/normal.pal @@ -10,7 +10,7 @@ JASC-PAL 168 144 120 192 192 176 248 248 248 -56 48 40 +98 82 57 232 64 32 176 24 16 64 56 48 diff --git a/graphics/pokemon/bidoof/anim_frontf.png b/graphics/pokemon/bidoof/anim_frontf.png index a62f24b7d247..16f873bc2d81 100644 Binary files a/graphics/pokemon/bidoof/anim_frontf.png and b/graphics/pokemon/bidoof/anim_frontf.png differ diff --git a/graphics/pokemon/bidoof/backf.png b/graphics/pokemon/bidoof/backf.png index a76560fe473c..e5b18638df76 100644 Binary files a/graphics/pokemon/bidoof/backf.png and b/graphics/pokemon/bidoof/backf.png differ diff --git a/graphics/pokemon/blastoise/anim_front.png b/graphics/pokemon/blastoise/anim_front.png index 26034c90ed0c..7b5d21f78322 100644 Binary files a/graphics/pokemon/blastoise/anim_front.png and b/graphics/pokemon/blastoise/anim_front.png differ diff --git a/graphics/pokemon/blastoise/back.png b/graphics/pokemon/blastoise/back.png index 672de5497540..02b52f3db706 100644 Binary files a/graphics/pokemon/blastoise/back.png and b/graphics/pokemon/blastoise/back.png differ diff --git a/graphics/pokemon/blastoise/normal.pal b/graphics/pokemon/blastoise/normal.pal index 08c1997369f3..b8bd0893965a 100644 --- a/graphics/pokemon/blastoise/normal.pal +++ b/graphics/pokemon/blastoise/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -248 192 248 -32 98 172 -8 57 98 -148 172 230 -90 139 205 -74 74 74 -0 0 0 +152 208 160 +16 16 16 +255 255 255 205 205 213 -90 57 24 148 148 148 -139 98 65 -255 255 255 -213 172 74 +74 74 74 +148 172 230 +90 139 205 +32 98 172 +8 57 98 +152 48 40 246 213 156 +224 192 112 213 172 74 -156 136 80 +139 98 65 +90 57 24 diff --git a/graphics/pokemon/blastoise/shiny.pal b/graphics/pokemon/blastoise/shiny.pal index ff27dbbdc5b2..07c6360f4dff 100644 --- a/graphics/pokemon/blastoise/shiny.pal +++ b/graphics/pokemon/blastoise/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -160 120 184 -112 72 144 -232 216 248 -208 176 240 -72 72 72 -16 16 16 -200 200 208 -40 88 32 -144 144 144 -112 144 72 -248 248 248 -184 176 96 -240 224 192 -189 180 90 -112 144 72 +208 160 152 +0 0 0 +255 255 255 +205 205 213 +148 148 148 +74 74 74 +238 222 255 +213 180 246 +164 123 189 +115 82 148 +152 48 40 +240 208 152 +224 192 112 +184 176 88 +112 144 64 +32 90 24 diff --git a/graphics/pokemon/blaziken/anim_frontf.png b/graphics/pokemon/blaziken/anim_frontf.png new file mode 100644 index 000000000000..bc4905597300 Binary files /dev/null and b/graphics/pokemon/blaziken/anim_frontf.png differ diff --git a/graphics/pokemon/blaziken/backf.png b/graphics/pokemon/blaziken/backf.png new file mode 100644 index 000000000000..33651ce3824c Binary files /dev/null and b/graphics/pokemon/blaziken/backf.png differ diff --git a/graphics/pokemon/bouffalant/anim_front.png b/graphics/pokemon/bouffalant/anim_front.png index 116a6eebe75d..1a378a27143b 100644 Binary files a/graphics/pokemon/bouffalant/anim_front.png and b/graphics/pokemon/bouffalant/anim_front.png differ diff --git a/graphics/pokemon/breloom/back.png b/graphics/pokemon/breloom/back.png index 9616b079568c..a22ae9b09596 100644 Binary files a/graphics/pokemon/breloom/back.png and b/graphics/pokemon/breloom/back.png differ diff --git a/graphics/pokemon/budew/back.png b/graphics/pokemon/budew/back.png index 33a92ba75c2e..ebf3177f325b 100644 Binary files a/graphics/pokemon/budew/back.png and b/graphics/pokemon/budew/back.png differ diff --git a/graphics/pokemon/buizel/backf.png b/graphics/pokemon/buizel/backf.png new file mode 100644 index 000000000000..3d8a71f2a38f Binary files /dev/null and b/graphics/pokemon/buizel/backf.png differ diff --git a/graphics/pokemon/bulbasaur/anim_front.png b/graphics/pokemon/bulbasaur/anim_front.png index ad2a2f4eca0f..3ab471ea61f7 100644 Binary files a/graphics/pokemon/bulbasaur/anim_front.png and b/graphics/pokemon/bulbasaur/anim_front.png differ diff --git a/graphics/pokemon/bulbasaur/back.png b/graphics/pokemon/bulbasaur/back.png index a16779fc73d4..bbca57feac6b 100644 Binary files a/graphics/pokemon/bulbasaur/back.png and b/graphics/pokemon/bulbasaur/back.png differ diff --git a/graphics/pokemon/bulbasaur/normal.pal b/graphics/pokemon/bulbasaur/normal.pal index 2df2358d9e25..f18ccb705577 100644 --- a/graphics/pokemon/bulbasaur/normal.pal +++ b/graphics/pokemon/bulbasaur/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -248 192 248 -40 96 48 -96 192 112 +152 160 208 +255 255 255 +131 238 197 +98 213 180 +57 148 148 +24 74 74 +255 106 98 +232 32 56 +168 0 48 +205 205 205 16 16 16 -56 144 72 -144 216 144 -24 72 72 -56 144 144 -128 232 192 +189 255 115 +164 213 65 +115 172 49 +82 98 41 48 112 112 -96 208 176 -168 0 48 -248 248 248 -248 104 96 -160 48 16 -200 200 200 diff --git a/graphics/pokemon/bulbasaur/shiny.pal b/graphics/pokemon/bulbasaur/shiny.pal index 30895158bd89..696f091f4bfa 100644 --- a/graphics/pokemon/bulbasaur/shiny.pal +++ b/graphics/pokemon/bulbasaur/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -208 248 184 -8 88 8 -56 168 32 +152 160 208 +255 255 255 +197 246 82 +156 213 74 +115 164 49 +49 98 32 +255 106 98 +222 74 65 +189 41 32 +205 205 205 16 16 16 -8 128 40 -112 216 72 -56 96 40 -120 160 64 -200 240 104 +98 222 57 +41 172 16 +0 131 32 +0 90 0 80 128 40 -160 208 88 -184 56 48 -248 248 248 -248 128 120 -184 56 48 -200 200 200 diff --git a/graphics/pokemon/burmy/anim_front.png b/graphics/pokemon/burmy/anim_front.png index 8047a7896048..f8e9012cd855 100644 Binary files a/graphics/pokemon/burmy/anim_front.png and b/graphics/pokemon/burmy/anim_front.png differ diff --git a/graphics/pokemon/burmy/sandy_cloak/anim_front.png b/graphics/pokemon/burmy/sandy_cloak/anim_front.png index 32c1ceb46398..d0bedca63f86 100644 Binary files a/graphics/pokemon/burmy/sandy_cloak/anim_front.png and b/graphics/pokemon/burmy/sandy_cloak/anim_front.png differ diff --git a/graphics/pokemon/butterfree/anim_front.png b/graphics/pokemon/butterfree/anim_front.png index 27b059980170..3b4e35d61327 100644 Binary files a/graphics/pokemon/butterfree/anim_front.png and b/graphics/pokemon/butterfree/anim_front.png differ diff --git a/graphics/pokemon/butterfree/anim_frontf.png b/graphics/pokemon/butterfree/anim_frontf.png new file mode 100644 index 000000000000..4421e6bf2cd8 Binary files /dev/null and b/graphics/pokemon/butterfree/anim_frontf.png differ diff --git a/graphics/pokemon/butterfree/back.png b/graphics/pokemon/butterfree/back.png index a8dff2f333df..96fbf7300e39 100644 Binary files a/graphics/pokemon/butterfree/back.png and b/graphics/pokemon/butterfree/back.png differ diff --git a/graphics/pokemon/butterfree/backf.png b/graphics/pokemon/butterfree/backf.png new file mode 100644 index 000000000000..a68e2c0395f1 Binary files /dev/null and b/graphics/pokemon/butterfree/backf.png differ diff --git a/graphics/pokemon/butterfree/icon.png b/graphics/pokemon/butterfree/icon.png index 827ceee0d6a8..651a18646707 100644 Binary files a/graphics/pokemon/butterfree/icon.png and b/graphics/pokemon/butterfree/icon.png differ diff --git a/graphics/pokemon/butterfree/normal.pal b/graphics/pokemon/butterfree/normal.pal index ab84ea009923..bb638bf60c84 100644 --- a/graphics/pokemon/butterfree/normal.pal +++ b/graphics/pokemon/butterfree/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -0 0 0 49 49 82 90 74 115 -131 131 189 -238 238 255 115 98 172 -189 189 230 -230 98 131 -98 49 57 -255 156 180 -48 48 80 -222 49 49 +131 131 189 82 123 197 106 189 205 -240 248 248 +98 49 57 +222 49 49 +230 98 131 +255 156 180 +139 131 172 +156 156 180 +189 189 230 +238 238 255 +0 0 0 diff --git a/graphics/pokemon/butterfree/shiny.pal b/graphics/pokemon/butterfree/shiny.pal index 32264265b09d..0c9ae12cce15 100644 --- a/graphics/pokemon/butterfree/shiny.pal +++ b/graphics/pokemon/butterfree/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -16 16 16 -48 48 80 -88 72 112 -128 128 184 -232 232 248 -112 96 168 -224 184 192 -112 232 112 -48 96 56 -176 248 176 -48 48 80 -32 208 24 -216 80 96 -240 136 128 -240 248 248 +208 208 160 +49 49 82 +90 74 115 +115 98 172 +131 131 189 +222 82 98 +246 139 131 +49 98 57 +32 213 24 +115 238 115 +156 255 156 +180 123 131 +189 139 148 +230 180 189 +255 238 238 +0 0 0 diff --git a/graphics/pokemon/cacturne/anim_front.png b/graphics/pokemon/cacturne/anim_front.png index b9ab8625d1bf..812643a99452 100644 Binary files a/graphics/pokemon/cacturne/anim_front.png and b/graphics/pokemon/cacturne/anim_front.png differ diff --git a/graphics/pokemon/cacturne/anim_frontf.png b/graphics/pokemon/cacturne/anim_frontf.png new file mode 100644 index 000000000000..2dbdb477724b Binary files /dev/null and b/graphics/pokemon/cacturne/anim_frontf.png differ diff --git a/graphics/pokemon/cacturne/icon.png b/graphics/pokemon/cacturne/icon.png index 8dd74b291de3..59b4dfd5f5ab 100644 Binary files a/graphics/pokemon/cacturne/icon.png and b/graphics/pokemon/cacturne/icon.png differ diff --git a/graphics/pokemon/camerupt/anim_front.png b/graphics/pokemon/camerupt/anim_front.png index 394f96e9f11e..785798f764cb 100644 Binary files a/graphics/pokemon/camerupt/anim_front.png and b/graphics/pokemon/camerupt/anim_front.png differ diff --git a/graphics/pokemon/camerupt/anim_frontf.png b/graphics/pokemon/camerupt/anim_frontf.png new file mode 100644 index 000000000000..b746a2d18721 Binary files /dev/null and b/graphics/pokemon/camerupt/anim_frontf.png differ diff --git a/graphics/pokemon/camerupt/back.png b/graphics/pokemon/camerupt/back.png index 2188e4850fc9..4481f8262bb2 100644 Binary files a/graphics/pokemon/camerupt/back.png and b/graphics/pokemon/camerupt/back.png differ diff --git a/graphics/pokemon/camerupt/backf.png b/graphics/pokemon/camerupt/backf.png new file mode 100644 index 000000000000..f97031b2c00d Binary files /dev/null and b/graphics/pokemon/camerupt/backf.png differ diff --git a/graphics/pokemon/carkol/anim_front.png b/graphics/pokemon/carkol/anim_front.png new file mode 100644 index 000000000000..770b8799b2ea Binary files /dev/null and b/graphics/pokemon/carkol/anim_front.png differ diff --git a/graphics/pokemon/carkol/front.png b/graphics/pokemon/carkol/front.png deleted file mode 100644 index a16d60407369..000000000000 Binary files a/graphics/pokemon/carkol/front.png and /dev/null differ diff --git a/graphics/pokemon/carvanha/back.png b/graphics/pokemon/carvanha/back.png index e461b970c92b..fe571e27bc43 100644 Binary files a/graphics/pokemon/carvanha/back.png and b/graphics/pokemon/carvanha/back.png differ diff --git a/graphics/pokemon/castform/anim_front.png b/graphics/pokemon/castform/anim_front.png new file mode 100644 index 000000000000..b737a1d49bb5 Binary files /dev/null and b/graphics/pokemon/castform/anim_front.png differ diff --git a/graphics/pokemon/castform/back.png b/graphics/pokemon/castform/back.png new file mode 100644 index 000000000000..c63a11df996f Binary files /dev/null and b/graphics/pokemon/castform/back.png differ diff --git a/graphics/pokemon/castform/icon.png b/graphics/pokemon/castform/icon.png index 5e3c092919c8..83dad7f36883 100644 Binary files a/graphics/pokemon/castform/icon.png and b/graphics/pokemon/castform/icon.png differ diff --git a/graphics/pokemon/castform/normal/normal.pal b/graphics/pokemon/castform/normal.pal similarity index 57% rename from graphics/pokemon/castform/normal/normal.pal rename to graphics/pokemon/castform/normal.pal index 3fe2b769285c..39574e3b2d9f 100644 --- a/graphics/pokemon/castform/normal/normal.pal +++ b/graphics/pokemon/castform/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 197 197 148 -90 82 82 -205 189 189 -230 222 222 -246 246 238 +81 81 93 +176 183 186 +210 217 219 +221 232 233 0 0 0 255 255 255 222 222 246 -0 0 0 -0 0 0 +245 153 185 +200 65 142 0 0 0 0 0 0 148 148 148 -74 82 74 +75 76 83 255 255 255 24 24 24 diff --git a/graphics/pokemon/castform/normal/anim_front.png b/graphics/pokemon/castform/normal/anim_front.png deleted file mode 100644 index 39bfaf4266e5..000000000000 Binary files a/graphics/pokemon/castform/normal/anim_front.png and /dev/null differ diff --git a/graphics/pokemon/castform/normal/back.png b/graphics/pokemon/castform/normal/back.png deleted file mode 100644 index 6348a35e8662..000000000000 Binary files a/graphics/pokemon/castform/normal/back.png and /dev/null differ diff --git a/graphics/pokemon/castform/normal/front.png b/graphics/pokemon/castform/normal/front.png deleted file mode 100644 index 39bfaf4266e5..000000000000 Binary files a/graphics/pokemon/castform/normal/front.png and /dev/null differ diff --git a/graphics/pokemon/castform/normal/shiny.pal b/graphics/pokemon/castform/normal/shiny.pal deleted file mode 100644 index 2fa401dd6f36..000000000000 --- a/graphics/pokemon/castform/normal/shiny.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -197 197 148 -98 90 90 -205 164 189 -230 197 222 -255 222 255 -0 0 0 -255 246 65 -230 180 32 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -148 148 148 -74 82 74 -255 255 255 -24 24 24 diff --git a/graphics/pokemon/castform/rainy/anim_front.png b/graphics/pokemon/castform/rainy/anim_front.png index 15537403506f..b73f29d971b3 100644 Binary files a/graphics/pokemon/castform/rainy/anim_front.png and b/graphics/pokemon/castform/rainy/anim_front.png differ diff --git a/graphics/pokemon/castform/rainy/back.png b/graphics/pokemon/castform/rainy/back.png index 70bad9130b24..9fa76ba8af84 100644 Binary files a/graphics/pokemon/castform/rainy/back.png and b/graphics/pokemon/castform/rainy/back.png differ diff --git a/graphics/pokemon/castform/rainy/front.png b/graphics/pokemon/castform/rainy/front.png deleted file mode 100644 index 15537403506f..000000000000 Binary files a/graphics/pokemon/castform/rainy/front.png and /dev/null differ diff --git a/graphics/pokemon/castform/rainy/icon.png b/graphics/pokemon/castform/rainy/icon.png index c61d0e5f0928..31bc80984f25 100644 Binary files a/graphics/pokemon/castform/rainy/icon.png and b/graphics/pokemon/castform/rainy/icon.png differ diff --git a/graphics/pokemon/castform/rainy/normal.pal b/graphics/pokemon/castform/rainy/normal.pal index 914cdac62200..2b4089982bd4 100644 --- a/graphics/pokemon/castform/rainy/normal.pal +++ b/graphics/pokemon/castform/rainy/normal.pal @@ -3,17 +3,17 @@ JASC-PAL 16 197 197 148 57 65 90 -98 115 189 -115 139 213 -148 180 205 -0 0 0 -205 238 246 -180 197 222 -139 205 222 -131 180 197 -82 98 131 -197 197 197 -148 139 148 -90 90 82 +82 101 183 +98 146 208 +120 182 232 +238 160 209 +203 238 246 +173 196 230 +167 217 230 +130 167 196 +82 90 132 +191 200 202 +138 138 147 +82 83 91 255 255 255 24 24 24 diff --git a/graphics/pokemon/castform/rainy/shiny.pal b/graphics/pokemon/castform/rainy/shiny.pal index 914cdac62200..04f8babf699d 100644 --- a/graphics/pokemon/castform/rainy/shiny.pal +++ b/graphics/pokemon/castform/rainy/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 197 197 148 -57 65 90 -98 115 189 -115 139 213 -148 180 205 -0 0 0 -205 238 246 -180 197 222 -139 205 222 -131 180 197 -82 98 131 -197 197 197 -148 139 148 -90 90 82 +58 77 90 +66 133 158 +59 186 164 +170 228 208 +238 160 209 +148 251 101 +67 203 125 +123 220 239 +112 158 194 +72 88 142 +175 213 218 +110 136 175 +77 79 96 255 255 255 24 24 24 diff --git a/graphics/pokemon/castform/shiny.pal b/graphics/pokemon/castform/shiny.pal new file mode 100644 index 000000000000..ccdba4266690 --- /dev/null +++ b/graphics/pokemon/castform/shiny.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +197 197 148 +88 74 115 +192 163 204 +226 198 231 +255 222 255 +0 0 0 +242 236 110 +235 196 76 +245 153 185 +200 65 151 +0 0 0 +0 0 0 +161 116 180 +75 66 92 +255 255 255 +24 24 24 diff --git a/graphics/pokemon/castform/snowy/anim_front.png b/graphics/pokemon/castform/snowy/anim_front.png index a75bf647e6a6..eec381659507 100644 Binary files a/graphics/pokemon/castform/snowy/anim_front.png and b/graphics/pokemon/castform/snowy/anim_front.png differ diff --git a/graphics/pokemon/castform/snowy/back.png b/graphics/pokemon/castform/snowy/back.png index b4f27cbe6da8..d8ab4e38af2d 100644 Binary files a/graphics/pokemon/castform/snowy/back.png and b/graphics/pokemon/castform/snowy/back.png differ diff --git a/graphics/pokemon/castform/snowy/front.png b/graphics/pokemon/castform/snowy/front.png deleted file mode 100644 index a75bf647e6a6..000000000000 Binary files a/graphics/pokemon/castform/snowy/front.png and /dev/null differ diff --git a/graphics/pokemon/castform/snowy/icon.png b/graphics/pokemon/castform/snowy/icon.png index e8651ef4172f..9a8d45daf1a9 100644 Binary files a/graphics/pokemon/castform/snowy/icon.png and b/graphics/pokemon/castform/snowy/icon.png differ diff --git a/graphics/pokemon/castform/snowy/normal.pal b/graphics/pokemon/castform/snowy/normal.pal index d1c64ac75ca5..a32ac8fa02e2 100644 --- a/graphics/pokemon/castform/snowy/normal.pal +++ b/graphics/pokemon/castform/snowy/normal.pal @@ -5,15 +5,15 @@ JASC-PAL 41 82 57 123 82 189 139 115 213 -148 180 205 -0 0 0 +222 84 195 +242 156 214 197 180 255 156 156 197 -139 205 172 -115 164 139 +172 221 198 +124 182 168 98 74 115 -189 230 230 -82 115 106 -74 82 74 +214 245 229 +83 113 116 +75 83 81 255 255 255 24 24 24 diff --git a/graphics/pokemon/castform/snowy/shiny.pal b/graphics/pokemon/castform/snowy/shiny.pal index d1c64ac75ca5..95eba60731fd 100644 --- a/graphics/pokemon/castform/snowy/shiny.pal +++ b/graphics/pokemon/castform/snowy/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 197 197 148 -41 82 57 -123 82 189 -139 115 213 -148 180 205 -0 0 0 -197 180 255 -156 156 197 -139 205 172 -115 164 139 -98 74 115 -189 230 230 -82 115 106 +41 41 81 +88 81 189 +103 164 224 +222 84 195 +242 156 214 +246 255 178 +211 198 141 +170 201 212 +153 160 168 +74 74 115 +200 234 234 +110 120 135 74 82 74 255 255 255 24 24 24 diff --git a/graphics/pokemon/castform/sunny/anim_front.png b/graphics/pokemon/castform/sunny/anim_front.png index 7e14f9892e79..5f4a9ea78813 100644 Binary files a/graphics/pokemon/castform/sunny/anim_front.png and b/graphics/pokemon/castform/sunny/anim_front.png differ diff --git a/graphics/pokemon/castform/sunny/back.png b/graphics/pokemon/castform/sunny/back.png index 83b27298ad21..53e5a4b60fca 100644 Binary files a/graphics/pokemon/castform/sunny/back.png and b/graphics/pokemon/castform/sunny/back.png differ diff --git a/graphics/pokemon/castform/sunny/front.png b/graphics/pokemon/castform/sunny/front.png deleted file mode 100644 index 7e14f9892e79..000000000000 Binary files a/graphics/pokemon/castform/sunny/front.png and /dev/null differ diff --git a/graphics/pokemon/castform/sunny/icon.png b/graphics/pokemon/castform/sunny/icon.png index a59112839936..0596eeb2c9ee 100644 Binary files a/graphics/pokemon/castform/sunny/icon.png and b/graphics/pokemon/castform/sunny/icon.png differ diff --git a/graphics/pokemon/castform/sunny/normal.pal b/graphics/pokemon/castform/sunny/normal.pal index af0cfbb93bc4..11c6423859a3 100644 --- a/graphics/pokemon/castform/sunny/normal.pal +++ b/graphics/pokemon/castform/sunny/normal.pal @@ -3,17 +3,17 @@ JASC-PAL 16 197 197 148 98 49 41 -205 90 74 -238 123 74 -255 156 65 -0 0 0 +206 75 75 +238 101 73 +255 163 77 +245 151 182 255 246 106 -230 213 106 -255 156 98 -213 131 74 -148 90 65 -213 205 230 -0 0 0 -90 90 82 +234 196 83 +255 192 66 +222 128 33 +135 76 59 +206 210 222 +228 238 242 +87 82 91 255 255 255 24 24 24 diff --git a/graphics/pokemon/castform/sunny/shiny.pal b/graphics/pokemon/castform/sunny/shiny.pal index af0cfbb93bc4..bc0fdb44e2ec 100644 --- a/graphics/pokemon/castform/sunny/shiny.pal +++ b/graphics/pokemon/castform/sunny/shiny.pal @@ -3,17 +3,17 @@ JASC-PAL 16 197 197 148 98 49 41 -205 90 74 -238 123 74 -255 156 65 -0 0 0 -255 246 106 -230 213 106 -255 156 98 -213 131 74 +191 64 100 +238 73 103 +255 122 122 +245 151 182 +255 165 133 +230 107 107 +255 206 107 +222 138 63 148 90 65 -213 205 230 -0 0 0 +213 174 214 +238 211 231 90 90 82 255 255 255 24 24 24 diff --git a/graphics/pokemon/caterpie/anim_front.png b/graphics/pokemon/caterpie/anim_front.png index 1762f778d004..eab11dc995bb 100644 Binary files a/graphics/pokemon/caterpie/anim_front.png and b/graphics/pokemon/caterpie/anim_front.png differ diff --git a/graphics/pokemon/caterpie/back.png b/graphics/pokemon/caterpie/back.png index 3cff5a2e508f..8160f3cac61e 100644 Binary files a/graphics/pokemon/caterpie/back.png and b/graphics/pokemon/caterpie/back.png differ diff --git a/graphics/pokemon/caterpie/normal.pal b/graphics/pokemon/caterpie/normal.pal index 76bf98f547e5..1caf753e7ed4 100644 --- a/graphics/pokemon/caterpie/normal.pal +++ b/graphics/pokemon/caterpie/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 +152 160 208 +24 90 65 +32 123 74 +49 172 65 +74 197 41 +106 213 49 +172 246 65 +82 98 74 +123 131 74 +213 189 131 +246 238 139 123 57 74 +255 65 65 255 123 65 255 180 57 -255 65 65 -32 123 74 -172 246 65 0 0 0 -24 90 65 -106 213 49 -49 172 65 -246 238 139 -213 189 131 -123 131 74 -72 200 40 -240 232 136 diff --git a/graphics/pokemon/caterpie/shiny.pal b/graphics/pokemon/caterpie/shiny.pal index 3a5ff2866d86..0b489c968402 100644 --- a/graphics/pokemon/caterpie/shiny.pal +++ b/graphics/pokemon/caterpie/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -120 40 24 -240 80 16 -248 152 40 -224 32 16 -176 120 16 -248 248 112 -16 16 16 -144 80 32 -248 224 32 -232 168 40 -240 232 168 -232 208 128 -168 128 56 -240 192 24 -240 232 120 +148 82 32 +180 123 16 +238 172 41 +246 197 24 +255 230 32 +255 255 65 +123 98 57 +172 131 57 +238 213 131 +246 238 123 +123 41 24 +230 16 0 +246 82 16 +255 156 41 +0 0 0 diff --git a/graphics/pokemon/celebi/back.png b/graphics/pokemon/celebi/back.png index 759bfc96a42e..31345f8ad0bb 100644 Binary files a/graphics/pokemon/celebi/back.png and b/graphics/pokemon/celebi/back.png differ diff --git a/graphics/pokemon/centiskorch/anim_front.png b/graphics/pokemon/centiskorch/anim_front.png new file mode 100644 index 000000000000..a5dc3813f626 Binary files /dev/null and b/graphics/pokemon/centiskorch/anim_front.png differ diff --git a/graphics/pokemon/centiskorch/front.png b/graphics/pokemon/centiskorch/front.png deleted file mode 100644 index 091ef94b3f5c..000000000000 Binary files a/graphics/pokemon/centiskorch/front.png and /dev/null differ diff --git a/graphics/pokemon/chansey/anim_front.png b/graphics/pokemon/chansey/anim_front.png index ca17d1a70053..2e4e2f573f14 100644 Binary files a/graphics/pokemon/chansey/anim_front.png and b/graphics/pokemon/chansey/anim_front.png differ diff --git a/graphics/pokemon/charizard/anim_front.png b/graphics/pokemon/charizard/anim_front.png index f3b62d8fd530..9e9efadea91e 100644 Binary files a/graphics/pokemon/charizard/anim_front.png and b/graphics/pokemon/charizard/anim_front.png differ diff --git a/graphics/pokemon/charizard/back.png b/graphics/pokemon/charizard/back.png index 6782e1e752a6..dac2fa87c14b 100644 Binary files a/graphics/pokemon/charizard/back.png and b/graphics/pokemon/charizard/back.png differ diff --git a/graphics/pokemon/charizard/normal.pal b/graphics/pokemon/charizard/normal.pal index db32d4324cd4..45a645d2d420 100644 --- a/graphics/pokemon/charizard/normal.pal +++ b/graphics/pokemon/charizard/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -232 64 32 -128 48 24 -240 160 16 -232 176 88 -248 224 104 -205 82 65 -16 16 16 -238 131 41 -8 64 80 -32 112 144 -200 200 200 -248 248 248 -0 128 248 +0 0 0 +255 255 255 +205 205 205 +98 98 98 238 222 123 238 180 90 +238 131 41 +205 82 65 +131 49 24 +32 156 197 +32 115 148 +8 65 82 +255 213 16 +246 164 16 +230 65 16 diff --git a/graphics/pokemon/charizard/shiny.pal b/graphics/pokemon/charizard/shiny.pal index dce3f7832a17..a5c9dfcac29e 100644 --- a/graphics/pokemon/charizard/shiny.pal +++ b/graphics/pokemon/charizard/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -208 80 16 -32 40 48 -224 176 16 -168 160 176 -224 224 80 -80 80 96 0 0 0 -128 120 144 -128 16 40 -184 32 64 -200 200 200 -248 248 248 -192 0 0 -216 216 184 -184 184 168 +255 255 255 +205 205 205 +98 98 98 +222 222 172 +189 189 172 +131 123 148 +90 90 106 +49 57 65 +246 65 74 +189 32 65 +131 16 41 +230 230 16 +230 180 16 +213 82 16 diff --git a/graphics/pokemon/charjabug/anim_front.png b/graphics/pokemon/charjabug/anim_front.png new file mode 100644 index 000000000000..163ab2ba2d9d Binary files /dev/null and b/graphics/pokemon/charjabug/anim_front.png differ diff --git a/graphics/pokemon/charjabug/front.png b/graphics/pokemon/charjabug/front.png deleted file mode 100644 index 636c46738a78..000000000000 Binary files a/graphics/pokemon/charjabug/front.png and /dev/null differ diff --git a/graphics/pokemon/charjabug/normal.pal b/graphics/pokemon/charjabug/normal.pal index 3e58c79d17b9..b44500e78c0a 100644 --- a/graphics/pokemon/charjabug/normal.pal +++ b/graphics/pokemon/charjabug/normal.pal @@ -15,5 +15,5 @@ JASC-PAL 240 184 96 128 80 8 224 144 16 -0 0 0 -0 0 0 +8 64 88 +176 168 176 diff --git a/graphics/pokemon/charmander/anim_front.png b/graphics/pokemon/charmander/anim_front.png index 66904b580d8a..2126c56dce1a 100644 Binary files a/graphics/pokemon/charmander/anim_front.png and b/graphics/pokemon/charmander/anim_front.png differ diff --git a/graphics/pokemon/charmander/back.png b/graphics/pokemon/charmander/back.png index 555929a581fd..5415e18ed1a7 100644 Binary files a/graphics/pokemon/charmander/back.png and b/graphics/pokemon/charmander/back.png differ diff --git a/graphics/pokemon/charmander/normal.pal b/graphics/pokemon/charmander/normal.pal index d365db83085c..9a006c855ceb 100644 --- a/graphics/pokemon/charmander/normal.pal +++ b/graphics/pokemon/charmander/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -216 80 56 -136 40 0 -248 144 64 -248 192 96 16 16 16 -16 64 136 +180 180 180 +255 255 255 +255 213 123 +230 172 90 +255 197 98 +255 148 65 +222 82 57 +139 41 0 48 168 232 -248 248 248 -248 208 80 -232 56 24 -240 160 0 -192 96 104 -224 200 136 -248 232 200 -176 176 176 +24 136 176 +8 56 136 +255 213 8 +246 164 0 +230 57 0 diff --git a/graphics/pokemon/charmander/shiny.pal b/graphics/pokemon/charmander/shiny.pal index 934438a047cd..40ce4eb574d6 100644 --- a/graphics/pokemon/charmander/shiny.pal +++ b/graphics/pokemon/charmander/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -232 160 16 -144 80 8 -248 216 64 -248 248 184 16 16 16 -56 120 128 -128 168 200 -248 248 248 -248 216 16 -248 88 32 -248 176 16 -248 88 32 -224 200 104 -248 240 136 -176 176 176 +180 180 180 +255 255 255 +255 246 115 +230 205 82 +255 246 164 +255 222 41 +238 156 0 +148 74 0 +148 197 230 +65 139 148 +24 49 74 +255 222 16 +255 180 16 +255 90 32 diff --git a/graphics/pokemon/charmeleon/anim_front.png b/graphics/pokemon/charmeleon/anim_front.png index 570b506692ab..7432ebfda1db 100644 Binary files a/graphics/pokemon/charmeleon/anim_front.png and b/graphics/pokemon/charmeleon/anim_front.png differ diff --git a/graphics/pokemon/charmeleon/back.png b/graphics/pokemon/charmeleon/back.png index 3970a2e13e69..0eddbd1cfd02 100644 Binary files a/graphics/pokemon/charmeleon/back.png and b/graphics/pokemon/charmeleon/back.png differ diff --git a/graphics/pokemon/charmeleon/normal.pal b/graphics/pokemon/charmeleon/normal.pal index c72de3517e78..c0a7a8bfe3a3 100644 --- a/graphics/pokemon/charmeleon/normal.pal +++ b/graphics/pokemon/charmeleon/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -248 208 80 -248 160 0 -232 56 24 -144 32 16 -208 56 56 -248 80 72 +255 255 255 +180 180 180 +106 106 106 +248 128 104 +255 82 74 +200 56 56 +148 32 16 +224 200 168 +192 160 112 16 16 16 -104 104 104 -248 248 248 -176 176 176 0 88 248 -248 128 104 -232 200 176 -200 168 120 -184 152 104 +208 176 136 +255 222 41 +255 164 0 +255 65 0 diff --git a/graphics/pokemon/charmeleon/shiny.pal b/graphics/pokemon/charmeleon/shiny.pal index ba180ab6d162..bbeaa1bf6ea8 100644 --- a/graphics/pokemon/charmeleon/shiny.pal +++ b/graphics/pokemon/charmeleon/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -248 224 48 -248 176 16 -248 96 32 -144 88 8 -216 160 40 -248 232 48 +255 255 255 +180 180 180 +106 106 106 +255 238 139 +255 230 0 +222 164 41 +148 82 0 +255 246 172 +238 222 90 16 16 16 -104 104 104 -248 248 248 -176 176 176 -72 136 72 -248 240 184 -248 248 192 -240 232 152 -232 216 112 +40 112 40 +240 232 128 +255 230 49 +255 180 16 +255 98 32 diff --git a/graphics/pokemon/chatot/icon.png b/graphics/pokemon/chatot/icon.png index 9a8777c7ad17..b6cafc8dbcc3 100644 Binary files a/graphics/pokemon/chatot/icon.png and b/graphics/pokemon/chatot/icon.png differ diff --git a/graphics/pokemon/cherrim/icon.png b/graphics/pokemon/cherrim/icon.png index 6915d775b4e5..9b6e2776ff8a 100644 Binary files a/graphics/pokemon/cherrim/icon.png and b/graphics/pokemon/cherrim/icon.png differ diff --git a/graphics/pokemon/cherrim/normal/front.png b/graphics/pokemon/cherrim/normal/front.png deleted file mode 100644 index 5b10c48d1d9c..000000000000 Binary files a/graphics/pokemon/cherrim/normal/front.png and /dev/null differ diff --git a/graphics/pokemon/cherrim/sunshine/anim_front.png b/graphics/pokemon/cherrim/sunshine/anim_front.png index 42c7893893e3..f9530f0e0790 100644 Binary files a/graphics/pokemon/cherrim/sunshine/anim_front.png and b/graphics/pokemon/cherrim/sunshine/anim_front.png differ diff --git a/graphics/pokemon/cherrim/sunshine/front.png b/graphics/pokemon/cherrim/sunshine/front.png deleted file mode 100644 index 8c65c561c6d3..000000000000 Binary files a/graphics/pokemon/cherrim/sunshine/front.png and /dev/null differ diff --git a/graphics/pokemon/cherrim/sunshine/icon.png b/graphics/pokemon/cherrim/sunshine/icon.png index 333e22bb5920..48b8d641c01a 100644 Binary files a/graphics/pokemon/cherrim/sunshine/icon.png and b/graphics/pokemon/cherrim/sunshine/icon.png differ diff --git a/graphics/pokemon/cherubi/anim_front.png b/graphics/pokemon/cherubi/anim_front.png index c8908ed7757c..aae380b5e261 100644 Binary files a/graphics/pokemon/cherubi/anim_front.png and b/graphics/pokemon/cherubi/anim_front.png differ diff --git a/graphics/pokemon/chespin/anim_front.png b/graphics/pokemon/chespin/anim_front.png index af2f036fa8ad..172c75ec201d 100644 Binary files a/graphics/pokemon/chespin/anim_front.png and b/graphics/pokemon/chespin/anim_front.png differ diff --git a/graphics/pokemon/chewtle/anim_front.png b/graphics/pokemon/chewtle/anim_front.png new file mode 100644 index 000000000000..b340cf9ae2af Binary files /dev/null and b/graphics/pokemon/chewtle/anim_front.png differ diff --git a/graphics/pokemon/chewtle/front.png b/graphics/pokemon/chewtle/front.png deleted file mode 100644 index 7deb72994398..000000000000 Binary files a/graphics/pokemon/chewtle/front.png and /dev/null differ diff --git a/graphics/pokemon/chikorita/anim_front.png b/graphics/pokemon/chikorita/anim_front.png index c12f9f5f0242..78a236af054c 100644 Binary files a/graphics/pokemon/chikorita/anim_front.png and b/graphics/pokemon/chikorita/anim_front.png differ diff --git a/graphics/pokemon/chikorita/icon.png b/graphics/pokemon/chikorita/icon.png index ed1eac67f8bc..ef430db2961c 100644 Binary files a/graphics/pokemon/chikorita/icon.png and b/graphics/pokemon/chikorita/icon.png differ diff --git a/graphics/pokemon/chimecho/icon.png b/graphics/pokemon/chimecho/icon.png index d4d6b644855a..83376c46469c 100644 Binary files a/graphics/pokemon/chimecho/icon.png and b/graphics/pokemon/chimecho/icon.png differ diff --git a/graphics/pokemon/chinchou/anim_front.png b/graphics/pokemon/chinchou/anim_front.png index 1b7e9ee03a8b..b223f6da074a 100644 Binary files a/graphics/pokemon/chinchou/anim_front.png and b/graphics/pokemon/chinchou/anim_front.png differ diff --git a/graphics/pokemon/chingling/anim_front.png b/graphics/pokemon/chingling/anim_front.png index d564a3fa2988..7bb184c0a741 100644 Binary files a/graphics/pokemon/chingling/anim_front.png and b/graphics/pokemon/chingling/anim_front.png differ diff --git a/graphics/pokemon/cinccino/back.png b/graphics/pokemon/cinccino/back.png index b97531f9f2ca..bfc91fbc6e25 100644 Binary files a/graphics/pokemon/cinccino/back.png and b/graphics/pokemon/cinccino/back.png differ diff --git a/graphics/pokemon/cinderace/back.png b/graphics/pokemon/cinderace/back.png index 6af38da2b409..fc24345af07d 100644 Binary files a/graphics/pokemon/cinderace/back.png and b/graphics/pokemon/cinderace/back.png differ diff --git a/graphics/pokemon/cinderace/front.png b/graphics/pokemon/cinderace/front.png index d4b086a789ce..5b0fb17f6cc7 100644 Binary files a/graphics/pokemon/cinderace/front.png and b/graphics/pokemon/cinderace/front.png differ diff --git a/graphics/pokemon/clefable/anim_front.png b/graphics/pokemon/clefable/anim_front.png index 279172929aba..4c550c57537d 100644 Binary files a/graphics/pokemon/clefable/anim_front.png and b/graphics/pokemon/clefable/anim_front.png differ diff --git a/graphics/pokemon/clefable/back.png b/graphics/pokemon/clefable/back.png index 11b37f35f842..3363cf0c106d 100644 Binary files a/graphics/pokemon/clefable/back.png and b/graphics/pokemon/clefable/back.png differ diff --git a/graphics/pokemon/clefable/normal.pal b/graphics/pokemon/clefable/normal.pal index 242352f05361..5787db59f686 100644 --- a/graphics/pokemon/clefable/normal.pal +++ b/graphics/pokemon/clefable/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -82 65 57 -16 16 16 -123 106 98 -139 74 82 -222 98 98 +255 255 255 +197 197 197 +131 131 131 255 197 180 +208 120 160 238 148 148 -189 90 123 -82 49 74 -213 123 164 -248 248 248 -131 131 131 -213 123 139 +222 98 98 +139 74 82 +80 48 72 +184 88 120 222 57 90 -104 72 80 +123 106 98 +82 65 57 +208 120 136 +16 16 16 diff --git a/graphics/pokemon/clefable/shiny.pal b/graphics/pokemon/clefable/shiny.pal index 0ab423cdcb7b..dab1b12e7855 100644 --- a/graphics/pokemon/clefable/shiny.pal +++ b/graphics/pokemon/clefable/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -32 120 72 +152 160 208 +255 255 255 +197 197 197 +131 131 131 +255 222 222 +238 156 156 +246 181 181 +222 123 123 +205 90 90 16 16 16 -80 184 112 -184 96 96 -216 120 120 -248 216 216 -232 184 184 216 120 120 +216 112 144 +57 189 98 +8 131 65 +216 136 136 16 16 16 -232 152 152 -248 248 248 -128 128 128 -208 136 152 -222 57 90 -80 48 72 diff --git a/graphics/pokemon/clefairy/anim_front.png b/graphics/pokemon/clefairy/anim_front.png index 5f7e02a6e0bf..97d36a186c87 100644 Binary files a/graphics/pokemon/clefairy/anim_front.png and b/graphics/pokemon/clefairy/anim_front.png differ diff --git a/graphics/pokemon/clefairy/back.png b/graphics/pokemon/clefairy/back.png index eba4bc01e3d4..f02582cd8fe1 100644 Binary files a/graphics/pokemon/clefairy/back.png and b/graphics/pokemon/clefairy/back.png differ diff --git a/graphics/pokemon/clefairy/normal.pal b/graphics/pokemon/clefairy/normal.pal index ac2d66f749de..43177b7d1e74 100644 --- a/graphics/pokemon/clefairy/normal.pal +++ b/graphics/pokemon/clefairy/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -156 82 82 -230 123 123 -255 213 189 -115 74 57 -90 49 32 -156 131 115 -16 16 16 -255 172 172 -148 148 148 255 255 255 -238 65 57 +197 197 197 148 148 148 -176 56 40 -0 0 0 -0 0 0 +238 65 57 +180 57 41 +152 128 112 +112 72 56 +88 48 32 +112 40 8 +255 0 255 +248 208 184 +248 168 168 +230 123 123 +156 82 82 +16 16 16 diff --git a/graphics/pokemon/clefairy/shiny.pal b/graphics/pokemon/clefairy/shiny.pal index b6d39c3bc583..ef617d1ca9eb 100644 --- a/graphics/pokemon/clefairy/shiny.pal +++ b/graphics/pokemon/clefairy/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -136 64 64 -216 136 136 -248 216 216 -96 184 80 -56 128 32 -128 224 96 +152 160 208 +255 255 255 +197 197 197 +148 148 148 +238 65 57 +180 57 41 +96 224 56 +64 184 48 +41 131 8 +0 82 0 +255 0 255 +255 222 222 +246 172 172 +216 112 112 +160 64 64 16 16 16 -240 176 176 -144 144 144 -248 248 248 -216 120 112 -144 144 144 -176 80 72 -0 0 0 -0 0 0 diff --git a/graphics/pokemon/cleffa/anim_front.png b/graphics/pokemon/cleffa/anim_front.png index 9f2ee497fad3..cb2a33d5b0b7 100644 Binary files a/graphics/pokemon/cleffa/anim_front.png and b/graphics/pokemon/cleffa/anim_front.png differ diff --git a/graphics/pokemon/cloyster/icon.png b/graphics/pokemon/cloyster/icon.png index 9f50ad4dd9b2..908a2c97c622 100644 Binary files a/graphics/pokemon/cloyster/icon.png and b/graphics/pokemon/cloyster/icon.png differ diff --git a/graphics/pokemon/coalossal/anim_front.png b/graphics/pokemon/coalossal/anim_front.png new file mode 100644 index 000000000000..6ae1b3259945 Binary files /dev/null and b/graphics/pokemon/coalossal/anim_front.png differ diff --git a/graphics/pokemon/coalossal/front.png b/graphics/pokemon/coalossal/front.png deleted file mode 100644 index 53a0f5783647..000000000000 Binary files a/graphics/pokemon/coalossal/front.png and /dev/null differ diff --git a/graphics/pokemon/cobalion/icon.png b/graphics/pokemon/cobalion/icon.png index 5dcdd6cb0e91..d453e0e6a305 100644 Binary files a/graphics/pokemon/cobalion/icon.png and b/graphics/pokemon/cobalion/icon.png differ diff --git a/graphics/pokemon/cofagrigus/icon.png b/graphics/pokemon/cofagrigus/icon.png index 1ae2b6609952..ecf61cd6cf26 100644 Binary files a/graphics/pokemon/cofagrigus/icon.png and b/graphics/pokemon/cofagrigus/icon.png differ diff --git a/graphics/pokemon/combusken/anim_frontf.png b/graphics/pokemon/combusken/anim_frontf.png new file mode 100644 index 000000000000..2620c50e5ec3 Binary files /dev/null and b/graphics/pokemon/combusken/anim_frontf.png differ diff --git a/graphics/pokemon/combusken/backf.png b/graphics/pokemon/combusken/backf.png new file mode 100644 index 000000000000..06330c53001c Binary files /dev/null and b/graphics/pokemon/combusken/backf.png differ diff --git a/graphics/pokemon/combusken/icon.png b/graphics/pokemon/combusken/icon.png index 231252ccb5d3..e2b69e2b138c 100644 Binary files a/graphics/pokemon/combusken/icon.png and b/graphics/pokemon/combusken/icon.png differ diff --git a/graphics/pokemon/corsola/galarian/front.png b/graphics/pokemon/corsola/galarian/front.png index 19d22f3b89ed..f90ef1b20ed5 100644 Binary files a/graphics/pokemon/corsola/galarian/front.png and b/graphics/pokemon/corsola/galarian/front.png differ diff --git a/graphics/pokemon/corsola/icon.png b/graphics/pokemon/corsola/icon.png index e5ebe6c08d6a..e70ba179401f 100644 Binary files a/graphics/pokemon/corsola/icon.png and b/graphics/pokemon/corsola/icon.png differ diff --git a/graphics/pokemon/corviknight/anim_front.png b/graphics/pokemon/corviknight/anim_front.png new file mode 100644 index 000000000000..6f1842535267 Binary files /dev/null and b/graphics/pokemon/corviknight/anim_front.png differ diff --git a/graphics/pokemon/corviknight/front.png b/graphics/pokemon/corviknight/front.png deleted file mode 100644 index 741ad51fce28..000000000000 Binary files a/graphics/pokemon/corviknight/front.png and /dev/null differ diff --git a/graphics/pokemon/corvisquire/anim_front.png b/graphics/pokemon/corvisquire/anim_front.png new file mode 100644 index 000000000000..35ad0bdfbad1 Binary files /dev/null and b/graphics/pokemon/corvisquire/anim_front.png differ diff --git a/graphics/pokemon/corvisquire/front.png b/graphics/pokemon/corvisquire/front.png deleted file mode 100644 index 7ecde9beae3b..000000000000 Binary files a/graphics/pokemon/corvisquire/front.png and /dev/null differ diff --git a/graphics/pokemon/cottonee/anim_front.png b/graphics/pokemon/cottonee/anim_front.png index d2abe0c67a90..0afb0922c63d 100644 Binary files a/graphics/pokemon/cottonee/anim_front.png and b/graphics/pokemon/cottonee/anim_front.png differ diff --git a/graphics/pokemon/cranidos/back.png b/graphics/pokemon/cranidos/back.png index 39aacf0bad4e..2da3c50da025 100644 Binary files a/graphics/pokemon/cranidos/back.png and b/graphics/pokemon/cranidos/back.png differ diff --git a/graphics/pokemon/cresselia/icon.png b/graphics/pokemon/cresselia/icon.png index 8189ad7d1658..b482f263d8b7 100644 Binary files a/graphics/pokemon/cresselia/icon.png and b/graphics/pokemon/cresselia/icon.png differ diff --git a/graphics/pokemon/croagunk/anim_frontf.png b/graphics/pokemon/croagunk/anim_frontf.png new file mode 100644 index 000000000000..1d0ab61e1b82 Binary files /dev/null and b/graphics/pokemon/croagunk/anim_frontf.png differ diff --git a/graphics/pokemon/croagunk/backf.png b/graphics/pokemon/croagunk/backf.png new file mode 100644 index 000000000000..07292925c57d Binary files /dev/null and b/graphics/pokemon/croagunk/backf.png differ diff --git a/graphics/pokemon/crobat/anim_front.png b/graphics/pokemon/crobat/anim_front.png index 9275d8309426..e5d481ce1a24 100644 Binary files a/graphics/pokemon/crobat/anim_front.png and b/graphics/pokemon/crobat/anim_front.png differ diff --git a/graphics/pokemon/crobat/icon.png b/graphics/pokemon/crobat/icon.png index 2d42fa21b609..fd213218c342 100644 Binary files a/graphics/pokemon/crobat/icon.png and b/graphics/pokemon/crobat/icon.png differ diff --git a/graphics/pokemon/croconaw/anim_front.png b/graphics/pokemon/croconaw/anim_front.png index 3fc9ff81f287..049b0233a4fb 100644 Binary files a/graphics/pokemon/croconaw/anim_front.png and b/graphics/pokemon/croconaw/anim_front.png differ diff --git a/graphics/pokemon/crustle/icon.png b/graphics/pokemon/crustle/icon.png index 5b70147792e6..d53a86f2b10a 100644 Binary files a/graphics/pokemon/crustle/icon.png and b/graphics/pokemon/crustle/icon.png differ diff --git a/graphics/pokemon/cubone/anim_front.png b/graphics/pokemon/cubone/anim_front.png index 5b98b8d8abe2..e0f600c88ca9 100644 Binary files a/graphics/pokemon/cubone/anim_front.png and b/graphics/pokemon/cubone/anim_front.png differ diff --git a/graphics/pokemon/cursola/front.png b/graphics/pokemon/cursola/front.png index d4811ab1e711..2e4036381214 100644 Binary files a/graphics/pokemon/cursola/front.png and b/graphics/pokemon/cursola/front.png differ diff --git a/graphics/pokemon/cyndaquil/anim_front.png b/graphics/pokemon/cyndaquil/anim_front.png index 3649ae50efd7..2e41af42057a 100644 Binary files a/graphics/pokemon/cyndaquil/anim_front.png and b/graphics/pokemon/cyndaquil/anim_front.png differ diff --git a/graphics/pokemon/darkrai/icon.png b/graphics/pokemon/darkrai/icon.png index c31c365bdbc9..ee6ee5cd84e5 100644 Binary files a/graphics/pokemon/darkrai/icon.png and b/graphics/pokemon/darkrai/icon.png differ diff --git a/graphics/pokemon/darmanitan/zen_mode/anim_front.png b/graphics/pokemon/darmanitan/zen_mode/anim_front.png index 6cc10f7ac132..2e5e9cc33486 100644 Binary files a/graphics/pokemon/darmanitan/zen_mode/anim_front.png and b/graphics/pokemon/darmanitan/zen_mode/anim_front.png differ diff --git a/graphics/pokemon/darmanitan/zen_mode/back.png b/graphics/pokemon/darmanitan/zen_mode/back.png index 6396ada9fb1f..32fe22f590c4 100644 Binary files a/graphics/pokemon/darmanitan/zen_mode/back.png and b/graphics/pokemon/darmanitan/zen_mode/back.png differ diff --git a/graphics/pokemon/deerling/autumn/icon.png b/graphics/pokemon/deerling/autumn/icon.png index 4181194e1da1..268d65058ec0 100644 Binary files a/graphics/pokemon/deerling/autumn/icon.png and b/graphics/pokemon/deerling/autumn/icon.png differ diff --git a/graphics/pokemon/deerling/summer/icon.png b/graphics/pokemon/deerling/summer/icon.png index c3358ab9fce7..336a0dc2787c 100644 Binary files a/graphics/pokemon/deerling/summer/icon.png and b/graphics/pokemon/deerling/summer/icon.png differ diff --git a/graphics/pokemon/deerling/winter/icon.png b/graphics/pokemon/deerling/winter/icon.png index 6528ea971175..ead348bf03fa 100644 Binary files a/graphics/pokemon/deerling/winter/icon.png and b/graphics/pokemon/deerling/winter/icon.png differ diff --git a/graphics/pokemon/deino/icon.png b/graphics/pokemon/deino/icon.png index 0b5ec01ce0d8..0a308acd3e2b 100644 Binary files a/graphics/pokemon/deino/icon.png and b/graphics/pokemon/deino/icon.png differ diff --git a/graphics/pokemon/dewgong/anim_front.png b/graphics/pokemon/dewgong/anim_front.png index a767395501cf..a1594dbd3348 100644 Binary files a/graphics/pokemon/dewgong/anim_front.png and b/graphics/pokemon/dewgong/anim_front.png differ diff --git a/graphics/pokemon/dewgong/back.png b/graphics/pokemon/dewgong/back.png index 90b5ae680b02..bcb7242e3599 100644 Binary files a/graphics/pokemon/dewgong/back.png and b/graphics/pokemon/dewgong/back.png differ diff --git a/graphics/pokemon/dewott/anim_front.png b/graphics/pokemon/dewott/anim_front.png index 8ea90c880bb4..09e5fadadf04 100644 Binary files a/graphics/pokemon/dewott/anim_front.png and b/graphics/pokemon/dewott/anim_front.png differ diff --git a/graphics/pokemon/dewpider/anim_front.png b/graphics/pokemon/dewpider/anim_front.png new file mode 100644 index 000000000000..3689c24561f1 Binary files /dev/null and b/graphics/pokemon/dewpider/anim_front.png differ diff --git a/graphics/pokemon/dewpider/front.png b/graphics/pokemon/dewpider/front.png deleted file mode 100644 index 787842864370..000000000000 Binary files a/graphics/pokemon/dewpider/front.png and /dev/null differ diff --git a/graphics/pokemon/dialga/icon.png b/graphics/pokemon/dialga/icon.png index 232b9bf94540..d79b43da0cbc 100644 Binary files a/graphics/pokemon/dialga/icon.png and b/graphics/pokemon/dialga/icon.png differ diff --git a/graphics/pokemon/diglett/anim_front.png b/graphics/pokemon/diglett/anim_front.png index a652b66458b2..202a2a1788e7 100644 Binary files a/graphics/pokemon/diglett/anim_front.png and b/graphics/pokemon/diglett/anim_front.png differ diff --git a/graphics/pokemon/diglett/back.png b/graphics/pokemon/diglett/back.png index 8dca603b334c..b4f98c8d803d 100644 Binary files a/graphics/pokemon/diglett/back.png and b/graphics/pokemon/diglett/back.png differ diff --git a/graphics/pokemon/diglett/normal.pal b/graphics/pokemon/diglett/normal.pal index 0e0e4694ce87..1eff24bb316a 100644 --- a/graphics/pokemon/diglett/normal.pal +++ b/graphics/pokemon/diglett/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -164 90 90 -222 156 90 -197 115 65 -90 49 24 255 255 255 -16 16 16 -213 57 74 -115 0 24 255 172 148 255 106 90 -131 123 74 +213 57 74 +115 0 24 +230 230 180 180 172 115 +131 123 74 90 82 32 -230 230 180 -0 0 0 +123 123 123 +16 16 16 +222 156 90 +197 115 65 +164 90 90 +90 49 24 diff --git a/graphics/pokemon/diglett/shiny.pal b/graphics/pokemon/diglett/shiny.pal index b86a59ff4b08..8fef662bbf32 100644 --- a/graphics/pokemon/diglett/shiny.pal +++ b/graphics/pokemon/diglett/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -152 88 104 -208 152 104 -184 112 80 -88 48 24 -248 248 248 +255 255 255 +131 148 246 +90 106 205 +49 82 164 +8 41 123 +230 230 180 +180 172 115 +131 123 74 +90 82 32 +123 123 123 16 16 16 -48 80 160 -8 40 120 -128 144 240 -88 104 200 -128 120 72 -176 168 112 -88 80 32 -224 224 176 -0 0 0 +213 156 106 +189 115 82 +156 90 106 +82 49 41 diff --git a/graphics/pokemon/ditto/back.png b/graphics/pokemon/ditto/back.png index 5bea88a4aee6..790910ead2d5 100644 Binary files a/graphics/pokemon/ditto/back.png and b/graphics/pokemon/ditto/back.png differ diff --git a/graphics/pokemon/dodrio/anim_front.png b/graphics/pokemon/dodrio/anim_front.png index 43c37974feb8..5c970bf8e016 100644 Binary files a/graphics/pokemon/dodrio/anim_front.png and b/graphics/pokemon/dodrio/anim_front.png differ diff --git a/graphics/pokemon/dodrio/anim_frontf.png b/graphics/pokemon/dodrio/anim_frontf.png new file mode 100644 index 000000000000..c69ab602c0a9 Binary files /dev/null and b/graphics/pokemon/dodrio/anim_frontf.png differ diff --git a/graphics/pokemon/dodrio/back.png b/graphics/pokemon/dodrio/back.png index ad1f5bcf51de..a160615324e8 100644 Binary files a/graphics/pokemon/dodrio/back.png and b/graphics/pokemon/dodrio/back.png differ diff --git a/graphics/pokemon/dodrio/backf.png b/graphics/pokemon/dodrio/backf.png new file mode 100644 index 000000000000..ad1f5bcf51de Binary files /dev/null and b/graphics/pokemon/dodrio/backf.png differ diff --git a/graphics/pokemon/dodrio/icon.png b/graphics/pokemon/dodrio/icon.png index 19d1644a3cfb..dc4a7a96a7b9 100644 Binary files a/graphics/pokemon/dodrio/icon.png and b/graphics/pokemon/dodrio/icon.png differ diff --git a/graphics/pokemon/doduo/anim_frontf.png b/graphics/pokemon/doduo/anim_frontf.png new file mode 100644 index 000000000000..51d0d982e954 Binary files /dev/null and b/graphics/pokemon/doduo/anim_frontf.png differ diff --git a/graphics/pokemon/doduo/back.png b/graphics/pokemon/doduo/back.png index 15ccdeb78824..dc2b09bc9e50 100644 Binary files a/graphics/pokemon/doduo/back.png and b/graphics/pokemon/doduo/back.png differ diff --git a/graphics/pokemon/doduo/backf.png b/graphics/pokemon/doduo/backf.png new file mode 100644 index 000000000000..3e0ad49e509a Binary files /dev/null and b/graphics/pokemon/doduo/backf.png differ diff --git a/graphics/pokemon/doduo/shiny.pal b/graphics/pokemon/doduo/shiny.pal index 5afafcf4f13d..40d0d1146b38 100644 --- a/graphics/pokemon/doduo/shiny.pal +++ b/graphics/pokemon/doduo/shiny.pal @@ -12,8 +12,8 @@ JASC-PAL 96 96 96 160 152 72 232 224 168 -192 88 88 -64 64 56 216 200 136 0 0 0 0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/pokemon/donphan/anim_frontf.png b/graphics/pokemon/donphan/anim_frontf.png new file mode 100644 index 000000000000..f4be5dc018c0 Binary files /dev/null and b/graphics/pokemon/donphan/anim_frontf.png differ diff --git a/graphics/pokemon/donphan/backf.png b/graphics/pokemon/donphan/backf.png new file mode 100644 index 000000000000..3e2368563aab Binary files /dev/null and b/graphics/pokemon/donphan/backf.png differ diff --git a/graphics/pokemon/donphan/icon.png b/graphics/pokemon/donphan/icon.png index 32368b808dea..1f8f99da8f01 100644 Binary files a/graphics/pokemon/donphan/icon.png and b/graphics/pokemon/donphan/icon.png differ diff --git a/graphics/pokemon/dragonite/anim_front.png b/graphics/pokemon/dragonite/anim_front.png index 2e067903b80e..fb92b56aa835 100644 Binary files a/graphics/pokemon/dragonite/anim_front.png and b/graphics/pokemon/dragonite/anim_front.png differ diff --git a/graphics/pokemon/dragonite/icon.png b/graphics/pokemon/dragonite/icon.png index 12c2c141d680..b296dc10bb5f 100644 Binary files a/graphics/pokemon/dragonite/icon.png and b/graphics/pokemon/dragonite/icon.png differ diff --git a/graphics/pokemon/drapion/anim_front.png b/graphics/pokemon/drapion/anim_front.png index 624556e4e4fb..e4ff4d5070d4 100644 Binary files a/graphics/pokemon/drapion/anim_front.png and b/graphics/pokemon/drapion/anim_front.png differ diff --git a/graphics/pokemon/drednaw/anim_front.png b/graphics/pokemon/drednaw/anim_front.png new file mode 100644 index 000000000000..bc4ed3bf5aef Binary files /dev/null and b/graphics/pokemon/drednaw/anim_front.png differ diff --git a/graphics/pokemon/drednaw/front.png b/graphics/pokemon/drednaw/front.png deleted file mode 100644 index d5c746464d71..000000000000 Binary files a/graphics/pokemon/drednaw/front.png and /dev/null differ diff --git a/graphics/pokemon/drifblim/icon.png b/graphics/pokemon/drifblim/icon.png index df7c888d5f41..7ce9d7310f39 100644 Binary files a/graphics/pokemon/drifblim/icon.png and b/graphics/pokemon/drifblim/icon.png differ diff --git a/graphics/pokemon/dugtrio/anim_front.png b/graphics/pokemon/dugtrio/anim_front.png index 12a88a418bec..0119b370c4f7 100644 Binary files a/graphics/pokemon/dugtrio/anim_front.png and b/graphics/pokemon/dugtrio/anim_front.png differ diff --git a/graphics/pokemon/dugtrio/back.png b/graphics/pokemon/dugtrio/back.png index 91584d8dbd2e..bc74c0c97946 100644 Binary files a/graphics/pokemon/dugtrio/back.png and b/graphics/pokemon/dugtrio/back.png differ diff --git a/graphics/pokemon/dugtrio/normal.pal b/graphics/pokemon/dugtrio/normal.pal index 834d6d4db283..1eff24bb316a 100644 --- a/graphics/pokemon/dugtrio/normal.pal +++ b/graphics/pokemon/dugtrio/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -164 90 90 -222 156 90 -90 49 24 -197 115 65 255 255 255 -16 16 16 -115 0 24 255 172 148 255 106 90 213 57 74 -131 123 74 +115 0 24 +230 230 180 180 172 115 +131 123 74 90 82 32 -230 230 180 -0 0 0 +123 123 123 +16 16 16 +222 156 90 +197 115 65 +164 90 90 +90 49 24 diff --git a/graphics/pokemon/dugtrio/shiny.pal b/graphics/pokemon/dugtrio/shiny.pal index eeda85d9a18a..8fef662bbf32 100644 --- a/graphics/pokemon/dugtrio/shiny.pal +++ b/graphics/pokemon/dugtrio/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -152 88 104 -208 152 104 -80 48 40 -184 112 80 -248 248 248 +255 255 255 +131 148 246 +90 106 205 +49 82 164 +8 41 123 +230 230 180 +180 172 115 +131 123 74 +90 82 32 +123 123 123 16 16 16 -8 40 120 -128 144 240 -88 104 200 -48 80 160 -128 120 72 -176 168 112 -88 80 32 -224 224 176 -0 0 0 +213 156 106 +189 115 82 +156 90 106 +82 49 41 diff --git a/graphics/pokemon/dunsparce/back.png b/graphics/pokemon/dunsparce/back.png index c19d4b5dbeda..b14ae2d77b8b 100644 Binary files a/graphics/pokemon/dunsparce/back.png and b/graphics/pokemon/dunsparce/back.png differ diff --git a/graphics/pokemon/duosion/anim_front.png b/graphics/pokemon/duosion/anim_front.png index c265b42524e8..6e71d083dbe8 100644 Binary files a/graphics/pokemon/duosion/anim_front.png and b/graphics/pokemon/duosion/anim_front.png differ diff --git a/graphics/pokemon/duosion/icon.png b/graphics/pokemon/duosion/icon.png index 9385bf6140a4..a674bbaf3a6c 100644 Binary files a/graphics/pokemon/duosion/icon.png and b/graphics/pokemon/duosion/icon.png differ diff --git a/graphics/pokemon/duskull/anim_front.png b/graphics/pokemon/duskull/anim_front.png index b873ffbb7c93..2312b874788c 100644 Binary files a/graphics/pokemon/duskull/anim_front.png and b/graphics/pokemon/duskull/anim_front.png differ diff --git a/graphics/pokemon/duskull/back.png b/graphics/pokemon/duskull/back.png index 82b1266c5c49..eeeac31f8d40 100644 Binary files a/graphics/pokemon/duskull/back.png and b/graphics/pokemon/duskull/back.png differ diff --git a/graphics/pokemon/dustox/anim_frontf.png b/graphics/pokemon/dustox/anim_frontf.png new file mode 100644 index 000000000000..59abf6ddb14d Binary files /dev/null and b/graphics/pokemon/dustox/anim_frontf.png differ diff --git a/graphics/pokemon/dustox/backf.png b/graphics/pokemon/dustox/backf.png new file mode 100644 index 000000000000..87be14e3071a Binary files /dev/null and b/graphics/pokemon/dustox/backf.png differ diff --git a/graphics/pokemon/dwebble/icon.png b/graphics/pokemon/dwebble/icon.png index 4b356d5aaa9f..19f9257ba14f 100644 Binary files a/graphics/pokemon/dwebble/icon.png and b/graphics/pokemon/dwebble/icon.png differ diff --git a/graphics/pokemon/eevee/anim_front.png b/graphics/pokemon/eevee/anim_front.png index 7f45d8592eef..d8ba89dc11d4 100644 Binary files a/graphics/pokemon/eevee/anim_front.png and b/graphics/pokemon/eevee/anim_front.png differ diff --git a/graphics/pokemon/eevee/anim_frontf.png b/graphics/pokemon/eevee/anim_frontf.png index 2f9da3756e18..877fcafe69a5 100644 Binary files a/graphics/pokemon/eevee/anim_frontf.png and b/graphics/pokemon/eevee/anim_frontf.png differ diff --git a/graphics/pokemon/eevee/back.png b/graphics/pokemon/eevee/back.png index 423006f0baa1..b475174f2ff2 100644 Binary files a/graphics/pokemon/eevee/back.png and b/graphics/pokemon/eevee/back.png differ diff --git a/graphics/pokemon/eevee/backf.png b/graphics/pokemon/eevee/backf.png index 6c265361f5fb..4aa6ba28df4d 100644 Binary files a/graphics/pokemon/eevee/backf.png and b/graphics/pokemon/eevee/backf.png differ diff --git a/graphics/pokemon/ekans/anim_front.png b/graphics/pokemon/ekans/anim_front.png index 1441532a474e..15ad69a160b9 100644 Binary files a/graphics/pokemon/ekans/anim_front.png and b/graphics/pokemon/ekans/anim_front.png differ diff --git a/graphics/pokemon/ekans/back.png b/graphics/pokemon/ekans/back.png index 2c0e0c02644e..9b2c3b9debb8 100644 Binary files a/graphics/pokemon/ekans/back.png and b/graphics/pokemon/ekans/back.png differ diff --git a/graphics/pokemon/ekans/normal.pal b/graphics/pokemon/ekans/normal.pal index 54db617b6ded..ecc9977f603a 100644 --- a/graphics/pokemon/ekans/normal.pal +++ b/graphics/pokemon/ekans/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -90 16 74 -164 74 139 +255 255 255 +246 115 74 +197 65 24 +156 16 0 +255 230 156 +255 213 106 +230 172 90 +180 123 49 +131 82 16 +16 16 16 238 164 213 205 98 180 +164 74 139 123 49 106 -180 123 49 -255 213 106 -16 16 16 -230 172 90 -156 16 0 -88 72 48 -197 65 24 -246 115 74 -248 224 152 -0 0 0 +90 16 74 diff --git a/graphics/pokemon/ekans/shiny.pal b/graphics/pokemon/ekans/shiny.pal index d094cd0b84e4..b3e1a7e962cf 100644 --- a/graphics/pokemon/ekans/shiny.pal +++ b/graphics/pokemon/ekans/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -56 56 8 -128 136 56 -216 216 144 -176 176 88 -88 96 24 -176 120 48 -240 216 136 +152 160 208 +255 255 255 +246 115 74 +197 65 24 +156 16 0 +255 230 156 +255 213 106 +230 172 90 +180 123 49 +131 82 16 16 16 16 -208 160 80 -152 24 16 -128 80 16 -192 80 40 -240 144 120 -248 224 152 -0 0 0 +238 238 156 +172 172 57 +131 139 32 +106 115 16 +90 90 0 diff --git a/graphics/pokemon/electivire/anim_front.png b/graphics/pokemon/electivire/anim_front.png index 9aae7e5b5c7e..686bb3d746a1 100644 Binary files a/graphics/pokemon/electivire/anim_front.png and b/graphics/pokemon/electivire/anim_front.png differ diff --git a/graphics/pokemon/electrode/anim_front.png b/graphics/pokemon/electrode/anim_front.png index f5fee30396ec..bf91ac0eb8e6 100644 Binary files a/graphics/pokemon/electrode/anim_front.png and b/graphics/pokemon/electrode/anim_front.png differ diff --git a/graphics/pokemon/elekid/back.png b/graphics/pokemon/elekid/back.png index c0b5f8cb79f5..8b1b5fe51875 100644 Binary files a/graphics/pokemon/elekid/back.png and b/graphics/pokemon/elekid/back.png differ diff --git a/graphics/pokemon/elgyem/anim_front.png b/graphics/pokemon/elgyem/anim_front.png index 2900d3b3e813..e6cfa5fe3816 100644 Binary files a/graphics/pokemon/elgyem/anim_front.png and b/graphics/pokemon/elgyem/anim_front.png differ diff --git a/graphics/pokemon/emboar/icon.png b/graphics/pokemon/emboar/icon.png index d79f6f004ba6..ca977e67600d 100644 Binary files a/graphics/pokemon/emboar/icon.png and b/graphics/pokemon/emboar/icon.png differ diff --git a/graphics/pokemon/empoleon/icon.png b/graphics/pokemon/empoleon/icon.png index 1e6e30582824..0eea08d3d2b6 100644 Binary files a/graphics/pokemon/empoleon/icon.png and b/graphics/pokemon/empoleon/icon.png differ diff --git a/graphics/pokemon/enamorus/front.png b/graphics/pokemon/enamorus/front.png index f6b93019966b..c679b07e571f 100755 Binary files a/graphics/pokemon/enamorus/front.png and b/graphics/pokemon/enamorus/front.png differ diff --git a/graphics/pokemon/entei/icon.png b/graphics/pokemon/entei/icon.png index eeb80f46047d..fdd0e3ac967b 100644 Binary files a/graphics/pokemon/entei/icon.png and b/graphics/pokemon/entei/icon.png differ diff --git a/graphics/pokemon/escavalier/icon.png b/graphics/pokemon/escavalier/icon.png index 94f646ecf70a..92558c0fd24d 100644 Binary files a/graphics/pokemon/escavalier/icon.png and b/graphics/pokemon/escavalier/icon.png differ diff --git a/graphics/pokemon/espeon/back.png b/graphics/pokemon/espeon/back.png index e88821875b43..95096adb8be8 100644 Binary files a/graphics/pokemon/espeon/back.png and b/graphics/pokemon/espeon/back.png differ diff --git a/graphics/pokemon/espeon/icon.png b/graphics/pokemon/espeon/icon.png index ebb9fd328b25..da3b6fa9ab36 100644 Binary files a/graphics/pokemon/espeon/icon.png and b/graphics/pokemon/espeon/icon.png differ diff --git a/graphics/pokemon/exeggcute/anim_front.png b/graphics/pokemon/exeggcute/anim_front.png index dc17ffb12b8e..429248b6eb17 100644 Binary files a/graphics/pokemon/exeggcute/anim_front.png and b/graphics/pokemon/exeggcute/anim_front.png differ diff --git a/graphics/pokemon/exeggutor/alolan/anim_front.png b/graphics/pokemon/exeggutor/alolan/anim_front.png new file mode 100644 index 000000000000..33f0caa36604 Binary files /dev/null and b/graphics/pokemon/exeggutor/alolan/anim_front.png differ diff --git a/graphics/pokemon/exeggutor/alolan/back.png b/graphics/pokemon/exeggutor/alolan/back.png index d39d09a4b632..09b1bad270bc 100644 Binary files a/graphics/pokemon/exeggutor/alolan/back.png and b/graphics/pokemon/exeggutor/alolan/back.png differ diff --git a/graphics/pokemon/exeggutor/alolan/front.png b/graphics/pokemon/exeggutor/alolan/front.png deleted file mode 100644 index 186ee8b95305..000000000000 Binary files a/graphics/pokemon/exeggutor/alolan/front.png and /dev/null differ diff --git a/graphics/pokemon/exeggutor/alolan/normal.pal b/graphics/pokemon/exeggutor/alolan/normal.pal index dfcbbf246646..f7b4bc50d250 100644 --- a/graphics/pokemon/exeggutor/alolan/normal.pal +++ b/graphics/pokemon/exeggutor/alolan/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -0 176 232 -56 160 64 -40 96 48 -136 224 112 +192 216 224 +64 48 32 16 16 16 -80 192 96 -80 72 56 +192 168 128 +160 128 88 208 184 104 -248 240 184 136 128 48 -248 248 248 -200 104 136 232 160 200 -144 120 96 -192 176 152 -136 168 64 +200 104 136 +248 248 248 +248 240 184 +56 160 64 +248 248 200 +40 96 48 +80 192 96 +136 224 112 diff --git a/graphics/pokemon/exeggutor/alolan/shiny.pal b/graphics/pokemon/exeggutor/alolan/shiny.pal index c55c7f591734..1cfefbdd6966 100644 --- a/graphics/pokemon/exeggutor/alolan/shiny.pal +++ b/graphics/pokemon/exeggutor/alolan/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -0 176 232 -192 96 56 -152 56 16 -248 184 104 +192 216 224 +120 96 24 16 16 16 -224 128 72 -136 104 0 +240 232 96 +200 176 40 224 168 88 -248 216 104 -160 104 32 -248 248 248 -200 104 136 +120 80 16 232 160 200 -192 160 0 -248 240 40 -136 168 64 +200 104 136 +248 248 248 +248 224 136 +192 104 64 +248 248 200 +136 56 24 +224 144 96 +232 168 136 diff --git a/graphics/pokemon/exeggutor/anim_front.png b/graphics/pokemon/exeggutor/anim_front.png index c55e603a0fe5..a7fa012b1772 100644 Binary files a/graphics/pokemon/exeggutor/anim_front.png and b/graphics/pokemon/exeggutor/anim_front.png differ diff --git a/graphics/pokemon/exeggutor/icon.png b/graphics/pokemon/exeggutor/icon.png index 007641b095d8..c1689c15651d 100644 Binary files a/graphics/pokemon/exeggutor/icon.png and b/graphics/pokemon/exeggutor/icon.png differ diff --git a/graphics/pokemon/exploud/icon.png b/graphics/pokemon/exploud/icon.png index 3cb142dde2af..d0ea5a5b62fb 100644 Binary files a/graphics/pokemon/exploud/icon.png and b/graphics/pokemon/exploud/icon.png differ diff --git a/graphics/pokemon/farfetchd/anim_front.png b/graphics/pokemon/farfetchd/anim_front.png index c96acae39a80..ac702abdd4eb 100644 Binary files a/graphics/pokemon/farfetchd/anim_front.png and b/graphics/pokemon/farfetchd/anim_front.png differ diff --git a/graphics/pokemon/fearow/anim_front.png b/graphics/pokemon/fearow/anim_front.png index 9a9e669e09c0..036efc242832 100644 Binary files a/graphics/pokemon/fearow/anim_front.png and b/graphics/pokemon/fearow/anim_front.png differ diff --git a/graphics/pokemon/fearow/back.png b/graphics/pokemon/fearow/back.png index 6ab9e169eff2..a9c5d7d07227 100644 Binary files a/graphics/pokemon/fearow/back.png and b/graphics/pokemon/fearow/back.png differ diff --git a/graphics/pokemon/fearow/normal.pal b/graphics/pokemon/fearow/normal.pal index 43c311727d1b..b183d51537ff 100644 --- a/graphics/pokemon/fearow/normal.pal +++ b/graphics/pokemon/fearow/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -139 82 49 -98 57 32 -213 164 90 0 0 0 +238 213 180 +213 164 90 180 115 32 -123 32 32 +139 82 49 +98 57 32 +255 213 189 +255 131 106 230 65 65 180 32 32 -255 131 106 -98 90 57 -230 213 180 +123 32 32 255 255 255 -238 213 180 +230 213 180 172 164 106 -208 128 128 +98 90 57 diff --git a/graphics/pokemon/fearow/shiny.pal b/graphics/pokemon/fearow/shiny.pal index 7b60073d713c..c60a6e80dbc0 100644 --- a/graphics/pokemon/fearow/shiny.pal +++ b/graphics/pokemon/fearow/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -139 139 49 -98 57 32 -213 222 90 +152 160 208 0 0 0 +238 246 197 +213 222 90 180 189 32 -139 49 0 +139 139 49 +98 57 32 +255 255 164 +255 238 65 255 164 0 213 123 0 -255 238 65 -98 98 57 -230 222 180 +139 49 0 255 255 255 -238 246 197 +230 222 180 172 172 106 -208 128 128 +98 98 57 diff --git a/graphics/pokemon/feraligatr/anim_front.png b/graphics/pokemon/feraligatr/anim_front.png index 26df70b9e134..02f31d679c4b 100644 Binary files a/graphics/pokemon/feraligatr/anim_front.png and b/graphics/pokemon/feraligatr/anim_front.png differ diff --git a/graphics/pokemon/feraligatr/icon.png b/graphics/pokemon/feraligatr/icon.png index 74aca6aea47a..cb699e05c744 100644 Binary files a/graphics/pokemon/feraligatr/icon.png and b/graphics/pokemon/feraligatr/icon.png differ diff --git a/graphics/pokemon/finneon/anim_frontf.png b/graphics/pokemon/finneon/anim_frontf.png new file mode 100644 index 000000000000..26a385af4634 Binary files /dev/null and b/graphics/pokemon/finneon/anim_frontf.png differ diff --git a/graphics/pokemon/finneon/backf.png b/graphics/pokemon/finneon/backf.png new file mode 100644 index 000000000000..2e05aecb68cf Binary files /dev/null and b/graphics/pokemon/finneon/backf.png differ diff --git a/graphics/pokemon/flaaffy/anim_front.png b/graphics/pokemon/flaaffy/anim_front.png index c09ccf4922e5..e1239d819365 100644 Binary files a/graphics/pokemon/flaaffy/anim_front.png and b/graphics/pokemon/flaaffy/anim_front.png differ diff --git a/graphics/pokemon/flabebe/back.png b/graphics/pokemon/flabebe/back.png index 9a2a8367a79e..088f00af5a13 100644 Binary files a/graphics/pokemon/flabebe/back.png and b/graphics/pokemon/flabebe/back.png differ diff --git a/graphics/pokemon/flabebe/blue_flower/icon.png b/graphics/pokemon/flabebe/blue_flower/icon.png index bdac1f46eda0..bc9018bac136 100644 Binary files a/graphics/pokemon/flabebe/blue_flower/icon.png and b/graphics/pokemon/flabebe/blue_flower/icon.png differ diff --git a/graphics/pokemon/flabebe/orange_flower/icon.png b/graphics/pokemon/flabebe/orange_flower/icon.png index 1c34927aa1ff..ed8bd1c42717 100644 Binary files a/graphics/pokemon/flabebe/orange_flower/icon.png and b/graphics/pokemon/flabebe/orange_flower/icon.png differ diff --git a/graphics/pokemon/flabebe/white_flower/icon.png b/graphics/pokemon/flabebe/white_flower/icon.png index 85aebadd1f52..88c2284c5a86 100644 Binary files a/graphics/pokemon/flabebe/white_flower/icon.png and b/graphics/pokemon/flabebe/white_flower/icon.png differ diff --git a/graphics/pokemon/flabebe/yellow_flower/icon.png b/graphics/pokemon/flabebe/yellow_flower/icon.png index 2ad8437e3eab..2971d628a59a 100644 Binary files a/graphics/pokemon/flabebe/yellow_flower/icon.png and b/graphics/pokemon/flabebe/yellow_flower/icon.png differ diff --git a/graphics/pokemon/flapple/anim_front.png b/graphics/pokemon/flapple/anim_front.png new file mode 100644 index 000000000000..1020b08dd36f Binary files /dev/null and b/graphics/pokemon/flapple/anim_front.png differ diff --git a/graphics/pokemon/flapple/front.png b/graphics/pokemon/flapple/front.png deleted file mode 100644 index 61f567dc423e..000000000000 Binary files a/graphics/pokemon/flapple/front.png and /dev/null differ diff --git a/graphics/pokemon/flareon/anim_front.png b/graphics/pokemon/flareon/anim_front.png index 1a13e5df4da9..1f9a8b9df869 100644 Binary files a/graphics/pokemon/flareon/anim_front.png and b/graphics/pokemon/flareon/anim_front.png differ diff --git a/graphics/pokemon/flareon/icon.png b/graphics/pokemon/flareon/icon.png index 92f4dad53244..027651e685f2 100644 Binary files a/graphics/pokemon/flareon/icon.png and b/graphics/pokemon/flareon/icon.png differ diff --git a/graphics/pokemon/floatzel/anim_front.png b/graphics/pokemon/floatzel/anim_front.png index d5dd3a61f6b8..e6f56514c409 100644 Binary files a/graphics/pokemon/floatzel/anim_front.png and b/graphics/pokemon/floatzel/anim_front.png differ diff --git a/graphics/pokemon/floatzel/backf.png b/graphics/pokemon/floatzel/backf.png new file mode 100644 index 000000000000..82005cbd298c Binary files /dev/null and b/graphics/pokemon/floatzel/backf.png differ diff --git a/graphics/pokemon/floette/blue_flower/icon.png b/graphics/pokemon/floette/blue_flower/icon.png index aa2227c430a1..86f12bae510e 100644 Binary files a/graphics/pokemon/floette/blue_flower/icon.png and b/graphics/pokemon/floette/blue_flower/icon.png differ diff --git a/graphics/pokemon/floette/eternal_flower/back.png b/graphics/pokemon/floette/eternal_flower/back.png index 450120721173..e67e882c442a 100644 Binary files a/graphics/pokemon/floette/eternal_flower/back.png and b/graphics/pokemon/floette/eternal_flower/back.png differ diff --git a/graphics/pokemon/floette/eternal_flower/front.png b/graphics/pokemon/floette/eternal_flower/front.png index 5d0a8c7df71b..61b4419b7e35 100644 Binary files a/graphics/pokemon/floette/eternal_flower/front.png and b/graphics/pokemon/floette/eternal_flower/front.png differ diff --git a/graphics/pokemon/floette/eternal_flower/icon.png b/graphics/pokemon/floette/eternal_flower/icon.png index a1e0d3c5134c..32f7face1f8b 100644 Binary files a/graphics/pokemon/floette/eternal_flower/icon.png and b/graphics/pokemon/floette/eternal_flower/icon.png differ diff --git a/graphics/pokemon/floette/orange_flower/icon.png b/graphics/pokemon/floette/orange_flower/icon.png index 07b6d9a09a4f..23092f1963ef 100644 Binary files a/graphics/pokemon/floette/orange_flower/icon.png and b/graphics/pokemon/floette/orange_flower/icon.png differ diff --git a/graphics/pokemon/floette/white_flower/icon.png b/graphics/pokemon/floette/white_flower/icon.png index 5c86b2634558..8f910f723f1b 100644 Binary files a/graphics/pokemon/floette/white_flower/icon.png and b/graphics/pokemon/floette/white_flower/icon.png differ diff --git a/graphics/pokemon/floette/yellow_flower/icon.png b/graphics/pokemon/floette/yellow_flower/icon.png index 29049f106a76..96da8a44e77b 100644 Binary files a/graphics/pokemon/floette/yellow_flower/icon.png and b/graphics/pokemon/floette/yellow_flower/icon.png differ diff --git a/graphics/pokemon/florges/back.png b/graphics/pokemon/florges/back.png index d0d918fab2ce..b971942fb7c2 100644 Binary files a/graphics/pokemon/florges/back.png and b/graphics/pokemon/florges/back.png differ diff --git a/graphics/pokemon/florges/blue_flower/icon.png b/graphics/pokemon/florges/blue_flower/icon.png index 8a4743f4f56d..c5e0a88c89eb 100644 Binary files a/graphics/pokemon/florges/blue_flower/icon.png and b/graphics/pokemon/florges/blue_flower/icon.png differ diff --git a/graphics/pokemon/florges/orange_flower/icon.png b/graphics/pokemon/florges/orange_flower/icon.png index a8239748c4d6..412f13b38198 100644 Binary files a/graphics/pokemon/florges/orange_flower/icon.png and b/graphics/pokemon/florges/orange_flower/icon.png differ diff --git a/graphics/pokemon/florges/white_flower/icon.png b/graphics/pokemon/florges/white_flower/icon.png index 11b04c54e019..65c16c0b0e2c 100644 Binary files a/graphics/pokemon/florges/white_flower/icon.png and b/graphics/pokemon/florges/white_flower/icon.png differ diff --git a/graphics/pokemon/florges/yellow_flower/icon.png b/graphics/pokemon/florges/yellow_flower/icon.png index 8fab7804fce0..12b6272e8a79 100644 Binary files a/graphics/pokemon/florges/yellow_flower/icon.png and b/graphics/pokemon/florges/yellow_flower/icon.png differ diff --git a/graphics/pokemon/flygon/icon.png b/graphics/pokemon/flygon/icon.png index f0c4e165ad0a..7a00375de790 100644 Binary files a/graphics/pokemon/flygon/icon.png and b/graphics/pokemon/flygon/icon.png differ diff --git a/graphics/pokemon/foongus/icon.png b/graphics/pokemon/foongus/icon.png index c6e4ab426bdb..ad61793a1c05 100644 Binary files a/graphics/pokemon/foongus/icon.png and b/graphics/pokemon/foongus/icon.png differ diff --git a/graphics/pokemon/froslass/icon.png b/graphics/pokemon/froslass/icon.png index 2869fb8de14d..d76d4095a8d6 100644 Binary files a/graphics/pokemon/froslass/icon.png and b/graphics/pokemon/froslass/icon.png differ diff --git a/graphics/pokemon/furfrou/dandy_trim/icon.png b/graphics/pokemon/furfrou/dandy_trim/icon.png index 9e20ab1c4026..a54f4fa4a4a9 100644 Binary files a/graphics/pokemon/furfrou/dandy_trim/icon.png and b/graphics/pokemon/furfrou/dandy_trim/icon.png differ diff --git a/graphics/pokemon/furfrou/debutante_trim/icon.png b/graphics/pokemon/furfrou/debutante_trim/icon.png index 04860b16d25e..02a350fb2e15 100644 Binary files a/graphics/pokemon/furfrou/debutante_trim/icon.png and b/graphics/pokemon/furfrou/debutante_trim/icon.png differ diff --git a/graphics/pokemon/furfrou/diamond_trim/icon.png b/graphics/pokemon/furfrou/diamond_trim/icon.png index f5ce645e4ee9..2acd3220d359 100644 Binary files a/graphics/pokemon/furfrou/diamond_trim/icon.png and b/graphics/pokemon/furfrou/diamond_trim/icon.png differ diff --git a/graphics/pokemon/furfrou/heart_trim/icon.png b/graphics/pokemon/furfrou/heart_trim/icon.png index 70049dc53f9a..e065e47667a0 100644 Binary files a/graphics/pokemon/furfrou/heart_trim/icon.png and b/graphics/pokemon/furfrou/heart_trim/icon.png differ diff --git a/graphics/pokemon/furfrou/kabuki_trim/icon.png b/graphics/pokemon/furfrou/kabuki_trim/icon.png index bc81044fb034..b3cad982e8bb 100644 Binary files a/graphics/pokemon/furfrou/kabuki_trim/icon.png and b/graphics/pokemon/furfrou/kabuki_trim/icon.png differ diff --git a/graphics/pokemon/furfrou/la_reine_trim/icon.png b/graphics/pokemon/furfrou/la_reine_trim/icon.png index 4451c0c16139..15aeb37e1b35 100644 Binary files a/graphics/pokemon/furfrou/la_reine_trim/icon.png and b/graphics/pokemon/furfrou/la_reine_trim/icon.png differ diff --git a/graphics/pokemon/furfrou/matron_trim/icon.png b/graphics/pokemon/furfrou/matron_trim/icon.png index 6d379a8cae66..88384830e866 100644 Binary files a/graphics/pokemon/furfrou/matron_trim/icon.png and b/graphics/pokemon/furfrou/matron_trim/icon.png differ diff --git a/graphics/pokemon/furfrou/pharaoh_trim/icon.png b/graphics/pokemon/furfrou/pharaoh_trim/icon.png index f674c8b47ef3..cecb8f1655fb 100644 Binary files a/graphics/pokemon/furfrou/pharaoh_trim/icon.png and b/graphics/pokemon/furfrou/pharaoh_trim/icon.png differ diff --git a/graphics/pokemon/furfrou/star_trim/icon.png b/graphics/pokemon/furfrou/star_trim/icon.png index 7d571808e94d..acb3a5ed6ce3 100644 Binary files a/graphics/pokemon/furfrou/star_trim/icon.png and b/graphics/pokemon/furfrou/star_trim/icon.png differ diff --git a/graphics/pokemon/furret/anim_front.png b/graphics/pokemon/furret/anim_front.png index 6e84d7410355..085f303c9c25 100644 Binary files a/graphics/pokemon/furret/anim_front.png and b/graphics/pokemon/furret/anim_front.png differ diff --git a/graphics/pokemon/gabite/anim_frontf.png b/graphics/pokemon/gabite/anim_frontf.png new file mode 100644 index 000000000000..bbcc77102057 Binary files /dev/null and b/graphics/pokemon/gabite/anim_frontf.png differ diff --git a/graphics/pokemon/gabite/backf.png b/graphics/pokemon/gabite/backf.png new file mode 100644 index 000000000000..a22d49ec4947 Binary files /dev/null and b/graphics/pokemon/gabite/backf.png differ diff --git a/graphics/pokemon/gallade/icon.png b/graphics/pokemon/gallade/icon.png index fce5123d9be4..ed0334e7f412 100644 Binary files a/graphics/pokemon/gallade/icon.png and b/graphics/pokemon/gallade/icon.png differ diff --git a/graphics/pokemon/galvantula/back.png b/graphics/pokemon/galvantula/back.png index 4d872ac6bae7..58146978e948 100644 Binary files a/graphics/pokemon/galvantula/back.png and b/graphics/pokemon/galvantula/back.png differ diff --git a/graphics/pokemon/garchomp/anim_frontf.png b/graphics/pokemon/garchomp/anim_frontf.png new file mode 100644 index 000000000000..c28766a70c08 Binary files /dev/null and b/graphics/pokemon/garchomp/anim_frontf.png differ diff --git a/graphics/pokemon/gastly/anim_front.png b/graphics/pokemon/gastly/anim_front.png index ff6c6591aee7..6bb1447c32f3 100644 Binary files a/graphics/pokemon/gastly/anim_front.png and b/graphics/pokemon/gastly/anim_front.png differ diff --git a/graphics/pokemon/gastly/icon.png b/graphics/pokemon/gastly/icon.png index a5dc4527d668..26c52fb0305a 100644 Binary files a/graphics/pokemon/gastly/icon.png and b/graphics/pokemon/gastly/icon.png differ diff --git a/graphics/pokemon/gastrodon/east_sea/icon.png b/graphics/pokemon/gastrodon/east_sea/icon.png index 33ba3c5c51be..2afcb90138d9 100644 Binary files a/graphics/pokemon/gastrodon/east_sea/icon.png and b/graphics/pokemon/gastrodon/east_sea/icon.png differ diff --git a/graphics/pokemon/genesect/icon.png b/graphics/pokemon/genesect/icon.png index a448db60332e..5c6e90d62d48 100644 Binary files a/graphics/pokemon/genesect/icon.png and b/graphics/pokemon/genesect/icon.png differ diff --git a/graphics/pokemon/gengar/anim_front.png b/graphics/pokemon/gengar/anim_front.png index 038bc71fcbc1..4b1e614ab322 100644 Binary files a/graphics/pokemon/gengar/anim_front.png and b/graphics/pokemon/gengar/anim_front.png differ diff --git a/graphics/pokemon/geodude/anim_front.png b/graphics/pokemon/geodude/anim_front.png index e5e28131d6e8..bec411d1e24e 100644 Binary files a/graphics/pokemon/geodude/anim_front.png and b/graphics/pokemon/geodude/anim_front.png differ diff --git a/graphics/pokemon/geodude/back.png b/graphics/pokemon/geodude/back.png index bd2cbeac6cc9..6aba658f6cc0 100644 Binary files a/graphics/pokemon/geodude/back.png and b/graphics/pokemon/geodude/back.png differ diff --git a/graphics/pokemon/geodude/normal.pal b/graphics/pokemon/geodude/normal.pal index 29e9e7409564..e484e96953bd 100644 --- a/graphics/pokemon/geodude/normal.pal +++ b/graphics/pokemon/geodude/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -106 106 82 +152 160 208 +16 16 16 65 57 49 -197 213 172 -180 180 156 +106 106 82 156 148 131 -16 16 16 -205 222 205 +180 180 156 +197 213 172 +123 24 32 +197 49 49 +230 74 65 255 255 255 -56 40 56 -136 16 16 -232 128 120 -0 0 0 +205 222 205 +148 156 156 0 0 0 0 0 0 0 0 0 diff --git a/graphics/pokemon/geodude/shiny.pal b/graphics/pokemon/geodude/shiny.pal index be09a9dc1a83..0e259715a4b9 100644 --- a/graphics/pokemon/geodude/shiny.pal +++ b/graphics/pokemon/geodude/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -176 120 32 -136 72 24 -248 240 96 -240 200 56 -208 152 40 16 16 16 -200 216 200 -248 248 248 -56 40 56 -122 36 43 -229 96 89 -0 0 0 +156 65 0 +189 115 0 +213 148 0 +246 197 8 +255 238 49 +123 24 32 +197 49 49 +230 74 65 +255 255 255 +205 222 205 +148 156 156 0 0 0 0 0 0 0 0 0 diff --git a/graphics/pokemon/gible/anim_front.png b/graphics/pokemon/gible/anim_front.png index 459d543f28d8..be19deebff3e 100644 Binary files a/graphics/pokemon/gible/anim_front.png and b/graphics/pokemon/gible/anim_front.png differ diff --git a/graphics/pokemon/gible/anim_frontf.png b/graphics/pokemon/gible/anim_frontf.png new file mode 100644 index 000000000000..ee2e0216bdac Binary files /dev/null and b/graphics/pokemon/gible/anim_frontf.png differ diff --git a/graphics/pokemon/gible/backf.png b/graphics/pokemon/gible/backf.png new file mode 100644 index 000000000000..e1ad84430c05 Binary files /dev/null and b/graphics/pokemon/gible/backf.png differ diff --git a/graphics/pokemon/girafarig/anim_frontf.png b/graphics/pokemon/girafarig/anim_frontf.png new file mode 100644 index 000000000000..82d972b21c97 Binary files /dev/null and b/graphics/pokemon/girafarig/anim_frontf.png differ diff --git a/graphics/pokemon/girafarig/back.png b/graphics/pokemon/girafarig/back.png index 568c284012a5..333ed70dfdaa 100644 Binary files a/graphics/pokemon/girafarig/back.png and b/graphics/pokemon/girafarig/back.png differ diff --git a/graphics/pokemon/girafarig/backf.png b/graphics/pokemon/girafarig/backf.png new file mode 100644 index 000000000000..6645ff99b817 Binary files /dev/null and b/graphics/pokemon/girafarig/backf.png differ diff --git a/graphics/pokemon/giratina/icon.png b/graphics/pokemon/giratina/icon.png index 235ea4721e6c..f4685acbb9cf 100644 Binary files a/graphics/pokemon/giratina/icon.png and b/graphics/pokemon/giratina/icon.png differ diff --git a/graphics/pokemon/glaceon/back.png b/graphics/pokemon/glaceon/back.png index 1acee66de988..73237ce09fc1 100644 Binary files a/graphics/pokemon/glaceon/back.png and b/graphics/pokemon/glaceon/back.png differ diff --git a/graphics/pokemon/gligar/anim_front.png b/graphics/pokemon/gligar/anim_front.png index d3daf460fcbd..3f2a0c4f5450 100644 Binary files a/graphics/pokemon/gligar/anim_front.png and b/graphics/pokemon/gligar/anim_front.png differ diff --git a/graphics/pokemon/gligar/anim_frontf.png b/graphics/pokemon/gligar/anim_frontf.png new file mode 100644 index 000000000000..945e909484d4 Binary files /dev/null and b/graphics/pokemon/gligar/anim_frontf.png differ diff --git a/graphics/pokemon/gligar/backf.png b/graphics/pokemon/gligar/backf.png new file mode 100644 index 000000000000..31e8fcf4052c Binary files /dev/null and b/graphics/pokemon/gligar/backf.png differ diff --git a/graphics/pokemon/gliscor/icon.png b/graphics/pokemon/gliscor/icon.png index 74f4126d9810..47033bbcaee3 100644 Binary files a/graphics/pokemon/gliscor/icon.png and b/graphics/pokemon/gliscor/icon.png differ diff --git a/graphics/pokemon/gloom/anim_front.png b/graphics/pokemon/gloom/anim_front.png index 9f9ea94c6b77..4ad5cb643d05 100644 Binary files a/graphics/pokemon/gloom/anim_front.png and b/graphics/pokemon/gloom/anim_front.png differ diff --git a/graphics/pokemon/gloom/anim_frontf.png b/graphics/pokemon/gloom/anim_frontf.png new file mode 100644 index 000000000000..c2cfc555170d Binary files /dev/null and b/graphics/pokemon/gloom/anim_frontf.png differ diff --git a/graphics/pokemon/gloom/back.png b/graphics/pokemon/gloom/back.png index 299e0d3d544b..e1d47e9b16fa 100644 Binary files a/graphics/pokemon/gloom/back.png and b/graphics/pokemon/gloom/back.png differ diff --git a/graphics/pokemon/gloom/backf.png b/graphics/pokemon/gloom/backf.png new file mode 100644 index 000000000000..8b57986c909a Binary files /dev/null and b/graphics/pokemon/gloom/backf.png differ diff --git a/graphics/pokemon/gloom/normal.pal b/graphics/pokemon/gloom/normal.pal index 6d66df35cad0..0400114f39c3 100644 --- a/graphics/pokemon/gloom/normal.pal +++ b/graphics/pokemon/gloom/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -88 40 0 -131 57 24 -205 115 74 -172 82 57 -16 16 16 +246 238 189 255 189 65 255 115 0 -240 232 184 197 115 41 139 57 24 -74 106 123 -16 49 74 -123 131 164 +205 115 74 +172 82 57 +131 57 24 +90 41 0 180 90 197 156 164 205 +123 131 164 +74 106 123 +16 49 74 +16 16 16 diff --git a/graphics/pokemon/gloom/shiny.pal b/graphics/pokemon/gloom/shiny.pal index d9714b7bad6a..50af6341d24f 100644 --- a/graphics/pokemon/gloom/shiny.pal +++ b/graphics/pokemon/gloom/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -112 64 0 -136 104 32 -240 216 128 -184 136 64 +152 160 208 +246 238 189 +246 213 106 +230 172 65 +164 123 24 +123 74 0 +230 180 106 +189 139 65 +139 106 24 +115 65 0 +222 123 32 +180 222 139 +148 180 82 +82 123 32 +41 82 8 16 16 16 -240 216 128 -216 168 80 -240 232 184 -160 120 40 -120 72 0 -80 112 40 -48 80 24 -144 168 88 -216 136 64 -176 216 136 diff --git a/graphics/pokemon/golbat/anim_front.png b/graphics/pokemon/golbat/anim_front.png index 661f81d46b72..73d663e8261d 100644 Binary files a/graphics/pokemon/golbat/anim_front.png and b/graphics/pokemon/golbat/anim_front.png differ diff --git a/graphics/pokemon/golbat/anim_frontf.png b/graphics/pokemon/golbat/anim_frontf.png new file mode 100644 index 000000000000..a4e223a122ec Binary files /dev/null and b/graphics/pokemon/golbat/anim_frontf.png differ diff --git a/graphics/pokemon/golbat/back.png b/graphics/pokemon/golbat/back.png index 20647d1e9d12..78275bb278a7 100644 Binary files a/graphics/pokemon/golbat/back.png and b/graphics/pokemon/golbat/back.png differ diff --git a/graphics/pokemon/golbat/backf.png b/graphics/pokemon/golbat/backf.png new file mode 100644 index 000000000000..56b0d7a9f819 Binary files /dev/null and b/graphics/pokemon/golbat/backf.png differ diff --git a/graphics/pokemon/golbat/normal.pal b/graphics/pokemon/golbat/normal.pal index 048e118a7986..d10763584be5 100644 --- a/graphics/pokemon/golbat/normal.pal +++ b/graphics/pokemon/golbat/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -98 131 205 -57 57 123 +255 255 255 +213 213 213 +98 98 98 0 0 0 172 205 255 90 172 238 +98 131 205 +57 57 123 +205 106 180 172 82 172 148 57 123 98 16 82 -205 106 180 -98 98 98 -213 213 213 -255 255 255 -0 0 0 -0 0 0 -0 0 0 +255 0 255 +255 0 255 +255 0 255 diff --git a/graphics/pokemon/golbat/shiny.pal b/graphics/pokemon/golbat/shiny.pal index 78263a17a672..8260295cfed4 100644 --- a/graphics/pokemon/golbat/shiny.pal +++ b/graphics/pokemon/golbat/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -56 112 16 -16 72 8 -16 16 16 -136 208 88 -112 152 56 -200 120 128 -184 88 96 -168 48 56 -224 176 168 -96 96 96 -208 208 208 -248 248 248 -96 96 96 -0 0 0 +152 160 208 +255 255 255 +213 213 213 +98 98 98 0 0 0 +131 213 74 +106 156 41 +49 115 0 +8 74 0 +255 172 164 +230 115 123 +213 82 90 +197 41 49 +255 0 255 +255 0 255 +255 0 255 diff --git a/graphics/pokemon/goldeen/anim_frontf.png b/graphics/pokemon/goldeen/anim_frontf.png new file mode 100644 index 000000000000..8ddb9d7527d9 Binary files /dev/null and b/graphics/pokemon/goldeen/anim_frontf.png differ diff --git a/graphics/pokemon/goldeen/backf.png b/graphics/pokemon/goldeen/backf.png new file mode 100644 index 000000000000..4ffefc3168bd Binary files /dev/null and b/graphics/pokemon/goldeen/backf.png differ diff --git a/graphics/pokemon/golduck/anim_front.png b/graphics/pokemon/golduck/anim_front.png index e48d067353e4..4490ae18472f 100644 Binary files a/graphics/pokemon/golduck/anim_front.png and b/graphics/pokemon/golduck/anim_front.png differ diff --git a/graphics/pokemon/golduck/back.png b/graphics/pokemon/golduck/back.png index 987395bcfa01..79c8b611bc91 100644 Binary files a/graphics/pokemon/golduck/back.png and b/graphics/pokemon/golduck/back.png differ diff --git a/graphics/pokemon/golduck/normal.pal b/graphics/pokemon/golduck/normal.pal index 9caf6c3b4dbb..63a96f8cf3f7 100644 --- a/graphics/pokemon/golduck/normal.pal +++ b/graphics/pokemon/golduck/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -49 82 106 -139 172 213 -16 16 16 -123 123 180 -222 24 24 255 255 255 -139 0 0 -255 172 172 213 213 213 -115 106 16 +240 104 104 +222 24 24 +139 0 0 255 255 164 -164 164 57 213 213 106 -139 0 0 -160 216 248 +164 164 57 +115 106 16 +255 0 255 +164 197 255 +139 172 213 +123 123 180 +49 82 106 +16 16 16 diff --git a/graphics/pokemon/golduck/shiny.pal b/graphics/pokemon/golduck/shiny.pal index 34873747f122..ee2de391e7ec 100644 --- a/graphics/pokemon/golduck/shiny.pal +++ b/graphics/pokemon/golduck/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -48 80 136 -112 184 248 +255 255 255 +213 213 213 +255 172 172 +222 24 24 +139 0 0 +255 197 197 +246 148 148 +230 115 123 +152 64 64 +255 0 255 +148 222 255 +106 180 255 +98 123 213 +56 80 104 16 16 16 -96 120 200 -216 64 64 -248 248 248 -136 40 24 -248 168 168 -208 208 208 -184 104 104 -248 200 200 -216 112 120 -232 152 152 -136 40 24 -144 216 248 diff --git a/graphics/pokemon/golem/anim_front.png b/graphics/pokemon/golem/anim_front.png index cd5af1012fd2..b40b3edff855 100644 Binary files a/graphics/pokemon/golem/anim_front.png and b/graphics/pokemon/golem/anim_front.png differ diff --git a/graphics/pokemon/golem/back.png b/graphics/pokemon/golem/back.png index dd4f8bb18771..febc2ab3dc5e 100644 Binary files a/graphics/pokemon/golem/back.png and b/graphics/pokemon/golem/back.png differ diff --git a/graphics/pokemon/golem/normal.pal b/graphics/pokemon/golem/normal.pal index 0006a7dca597..afe12d63b859 100644 --- a/graphics/pokemon/golem/normal.pal +++ b/graphics/pokemon/golem/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -65 74 16 -139 148 65 -98 106 32 -180 189 98 -16 16 16 -115 115 115 +152 160 208 255 255 255 -90 74 16 205 205 205 +115 115 115 +255 82 82 +180 0 0 +180 189 98 +139 148 65 +98 106 32 +65 74 16 +246 222 139 213 180 90 156 139 82 -246 222 139 -180 0 0 -255 82 82 -168 32 0 +90 74 16 +255 0 255 +16 16 16 diff --git a/graphics/pokemon/golem/shiny.pal b/graphics/pokemon/golem/shiny.pal index f9556290ddb4..ebc6e44a228e 100644 --- a/graphics/pokemon/golem/shiny.pal +++ b/graphics/pokemon/golem/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -104 56 8 -176 136 48 -144 96 16 -208 168 80 +255 255 255 +205 205 205 +115 115 115 +255 82 82 +180 0 0 +213 172 82 +180 139 49 +148 98 8 +115 57 0 +238 222 197 +230 205 164 +197 156 123 +139 98 74 +255 0 255 16 16 16 -112 112 112 -248 248 248 -136 96 72 -200 200 200 -224 200 160 -192 152 120 -232 216 192 -176 32 32 -248 104 104 -176 32 32 diff --git a/graphics/pokemon/golett/back.png b/graphics/pokemon/golett/back.png index 5a2ae220887b..88c22165e840 100644 Binary files a/graphics/pokemon/golett/back.png and b/graphics/pokemon/golett/back.png differ diff --git a/graphics/pokemon/golett/icon.png b/graphics/pokemon/golett/icon.png index a3513174898f..81fdf7c751da 100644 Binary files a/graphics/pokemon/golett/icon.png and b/graphics/pokemon/golett/icon.png differ diff --git a/graphics/pokemon/golisopod/anim_front.png b/graphics/pokemon/golisopod/anim_front.png new file mode 100644 index 000000000000..67701cffc624 Binary files /dev/null and b/graphics/pokemon/golisopod/anim_front.png differ diff --git a/graphics/pokemon/golisopod/front.png b/graphics/pokemon/golisopod/front.png deleted file mode 100644 index 4242b148e563..000000000000 Binary files a/graphics/pokemon/golisopod/front.png and /dev/null differ diff --git a/graphics/pokemon/goodra/hisuian/back.png b/graphics/pokemon/goodra/hisuian/back.png index 27025835f1ab..41417eaf2ca4 100755 Binary files a/graphics/pokemon/goodra/hisuian/back.png and b/graphics/pokemon/goodra/hisuian/back.png differ diff --git a/graphics/pokemon/goodra/hisuian/front.png b/graphics/pokemon/goodra/hisuian/front.png index 1b53bfacf35c..b4722fda29b9 100755 Binary files a/graphics/pokemon/goodra/hisuian/front.png and b/graphics/pokemon/goodra/hisuian/front.png differ diff --git a/graphics/pokemon/gothita/icon.png b/graphics/pokemon/gothita/icon.png index 8d280f51746d..98b0eb16a93e 100644 Binary files a/graphics/pokemon/gothita/icon.png and b/graphics/pokemon/gothita/icon.png differ diff --git a/graphics/pokemon/gothorita/icon.png b/graphics/pokemon/gothorita/icon.png index 9036dc6fc568..9dce5fb7c885 100644 Binary files a/graphics/pokemon/gothorita/icon.png and b/graphics/pokemon/gothorita/icon.png differ diff --git a/graphics/pokemon/gourgeist/back.png b/graphics/pokemon/gourgeist/back.png index 76da39f2278e..a9c249e5a79d 100644 Binary files a/graphics/pokemon/gourgeist/back.png and b/graphics/pokemon/gourgeist/back.png differ diff --git a/graphics/pokemon/gourgeist/large/back.png b/graphics/pokemon/gourgeist/large/back.png index a84d9aa5161b..b6f7575bd88a 100644 Binary files a/graphics/pokemon/gourgeist/large/back.png and b/graphics/pokemon/gourgeist/large/back.png differ diff --git a/graphics/pokemon/gourgeist/small/back.png b/graphics/pokemon/gourgeist/small/back.png index 97a44f72bf63..2ce3f57d7d15 100644 Binary files a/graphics/pokemon/gourgeist/small/back.png and b/graphics/pokemon/gourgeist/small/back.png differ diff --git a/graphics/pokemon/gourgeist/super/back.png b/graphics/pokemon/gourgeist/super/back.png index 3d6a97ef5fc3..dc9f5f87c272 100644 Binary files a/graphics/pokemon/gourgeist/super/back.png and b/graphics/pokemon/gourgeist/super/back.png differ diff --git a/graphics/pokemon/graveler/anim_front.png b/graphics/pokemon/graveler/anim_front.png index f00ad98d8f11..d00a5294966d 100644 Binary files a/graphics/pokemon/graveler/anim_front.png and b/graphics/pokemon/graveler/anim_front.png differ diff --git a/graphics/pokemon/graveler/back.png b/graphics/pokemon/graveler/back.png index 9704c55fe050..b6cfed49af5f 100644 Binary files a/graphics/pokemon/graveler/back.png and b/graphics/pokemon/graveler/back.png differ diff --git a/graphics/pokemon/graveler/normal.pal b/graphics/pokemon/graveler/normal.pal index 7a0929c16fb7..c8a0885b4c02 100644 --- a/graphics/pokemon/graveler/normal.pal +++ b/graphics/pokemon/graveler/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 +152 160 208 +0 0 0 74 65 49 -213 213 172 -180 180 156 -148 139 123 106 106 82 -0 0 0 +148 139 123 +180 180 156 +213 213 172 +131 123 131 +222 213 222 255 255 255 -189 74 57 -0 0 0 -0 0 0 0 0 0 0 0 0 +189 74 57 0 0 0 0 0 0 0 0 0 diff --git a/graphics/pokemon/graveler/shiny.pal b/graphics/pokemon/graveler/shiny.pal index b00659cb79aa..ee926f5178df 100644 --- a/graphics/pokemon/graveler/shiny.pal +++ b/graphics/pokemon/graveler/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -80 24 16 -200 176 64 -184 136 32 -152 96 24 -112 56 16 -16 16 16 -248 248 248 -184 72 56 -0 0 0 0 0 0 +90 16 0 +123 57 0 +156 90 0 +189 131 0 +197 172 32 +131 123 131 +222 213 222 +255 255 255 0 0 0 0 0 0 +189 74 57 0 0 0 0 0 0 0 0 0 diff --git a/graphics/pokemon/greninja/ash/icon.png b/graphics/pokemon/greninja/ash/icon.png index ac461847cc18..df9595619fa4 100644 Binary files a/graphics/pokemon/greninja/ash/icon.png and b/graphics/pokemon/greninja/ash/icon.png differ diff --git a/graphics/pokemon/grimer/anim_front.png b/graphics/pokemon/grimer/anim_front.png index 7cc6b2453dab..a2363840e719 100644 Binary files a/graphics/pokemon/grimer/anim_front.png and b/graphics/pokemon/grimer/anim_front.png differ diff --git a/graphics/pokemon/groudon/icon.png b/graphics/pokemon/groudon/icon.png index 69326145ca14..81f8aa5d5031 100644 Binary files a/graphics/pokemon/groudon/icon.png and b/graphics/pokemon/groudon/icon.png differ diff --git a/graphics/pokemon/growlithe/anim_front.png b/graphics/pokemon/growlithe/anim_front.png index a3e0fbe5bdd7..d0f170ea84fe 100644 Binary files a/graphics/pokemon/growlithe/anim_front.png and b/graphics/pokemon/growlithe/anim_front.png differ diff --git a/graphics/pokemon/growlithe/back.png b/graphics/pokemon/growlithe/back.png index 7c7d03df432a..835d9d88a248 100644 Binary files a/graphics/pokemon/growlithe/back.png and b/graphics/pokemon/growlithe/back.png differ diff --git a/graphics/pokemon/growlithe/hisuian/back.png b/graphics/pokemon/growlithe/hisuian/back.png index 16dcaefc3846..1f19b91bd568 100755 Binary files a/graphics/pokemon/growlithe/hisuian/back.png and b/graphics/pokemon/growlithe/hisuian/back.png differ diff --git a/graphics/pokemon/growlithe/hisuian/front.png b/graphics/pokemon/growlithe/hisuian/front.png index 7eea5e1cb329..4081e54a168d 100755 Binary files a/graphics/pokemon/growlithe/hisuian/front.png and b/graphics/pokemon/growlithe/hisuian/front.png differ diff --git a/graphics/pokemon/growlithe/normal.pal b/graphics/pokemon/growlithe/normal.pal index 7517c292900d..49e3d09b20b6 100644 --- a/graphics/pokemon/growlithe/normal.pal +++ b/graphics/pokemon/growlithe/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -115 98 32 +255 255 246 +222 222 213 +106 106 106 +246 123 65 +205 74 74 +123 49 8 255 246 164 -197 172 98 -16 16 16 222 205 123 +192 168 96 +115 98 32 +248 176 80 +238 139 74 197 82 82 115 57 16 -255 180 82 -238 139 74 -115 98 32 -106 106 106 -88 88 120 -248 248 240 -216 216 208 -168 48 16 +16 16 16 diff --git a/graphics/pokemon/growlithe/shiny.pal b/graphics/pokemon/growlithe/shiny.pal index d59ffd9502c2..97fda151dbce 100644 --- a/graphics/pokemon/growlithe/shiny.pal +++ b/graphics/pokemon/growlithe/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -104 96 48 -240 240 176 -192 176 112 -16 16 16 -208 200 136 -184 168 64 -120 88 24 -248 248 168 -232 224 64 -136 128 72 -80 80 80 -88 88 120 -248 248 240 -216 216 208 +255 255 246 +222 222 213 +106 106 106 246 123 65 +205 74 74 +123 49 8 +246 246 180 +213 205 139 +197 180 115 +106 98 49 +255 255 156 +246 238 49 +197 180 49 +139 98 8 +16 16 16 diff --git a/graphics/pokemon/grubbin/anim_front.png b/graphics/pokemon/grubbin/anim_front.png new file mode 100644 index 000000000000..f144cb10f063 Binary files /dev/null and b/graphics/pokemon/grubbin/anim_front.png differ diff --git a/graphics/pokemon/grubbin/front.png b/graphics/pokemon/grubbin/front.png deleted file mode 100644 index 4ae58b3c0e06..000000000000 Binary files a/graphics/pokemon/grubbin/front.png and /dev/null differ diff --git a/graphics/pokemon/gulpin/anim_frontf.png b/graphics/pokemon/gulpin/anim_frontf.png new file mode 100644 index 000000000000..c8b4d13d1e78 Binary files /dev/null and b/graphics/pokemon/gulpin/anim_frontf.png differ diff --git a/graphics/pokemon/gulpin/backf.png b/graphics/pokemon/gulpin/backf.png new file mode 100644 index 000000000000..5d73b0d24ff0 Binary files /dev/null and b/graphics/pokemon/gulpin/backf.png differ diff --git a/graphics/pokemon/gurdurr/back.png b/graphics/pokemon/gurdurr/back.png index 9888f01b5983..7b36dded0228 100644 Binary files a/graphics/pokemon/gurdurr/back.png and b/graphics/pokemon/gurdurr/back.png differ diff --git a/graphics/pokemon/gurdurr/icon.png b/graphics/pokemon/gurdurr/icon.png index b445d735c203..698ee8b4436c 100644 Binary files a/graphics/pokemon/gurdurr/icon.png and b/graphics/pokemon/gurdurr/icon.png differ diff --git a/graphics/pokemon/gyarados/anim_front.png b/graphics/pokemon/gyarados/anim_front.png index 688fed9fecc5..e6cc875e50a6 100644 Binary files a/graphics/pokemon/gyarados/anim_front.png and b/graphics/pokemon/gyarados/anim_front.png differ diff --git a/graphics/pokemon/gyarados/anim_frontf.png b/graphics/pokemon/gyarados/anim_frontf.png new file mode 100644 index 000000000000..46dc45b31d5a Binary files /dev/null and b/graphics/pokemon/gyarados/anim_frontf.png differ diff --git a/graphics/pokemon/gyarados/backf.png b/graphics/pokemon/gyarados/backf.png new file mode 100644 index 000000000000..e211e82b9b58 Binary files /dev/null and b/graphics/pokemon/gyarados/backf.png differ diff --git a/graphics/pokemon/hakamo_o/anim_front.png b/graphics/pokemon/hakamo_o/anim_front.png new file mode 100644 index 000000000000..2b5112a2d5b4 Binary files /dev/null and b/graphics/pokemon/hakamo_o/anim_front.png differ diff --git a/graphics/pokemon/hakamo_o/front.png b/graphics/pokemon/hakamo_o/front.png deleted file mode 100644 index 842821c5a205..000000000000 Binary files a/graphics/pokemon/hakamo_o/front.png and /dev/null differ diff --git a/graphics/pokemon/hariyama/anim_front.png b/graphics/pokemon/hariyama/anim_front.png index 751b2cac4d8a..c4ad6f962850 100644 Binary files a/graphics/pokemon/hariyama/anim_front.png and b/graphics/pokemon/hariyama/anim_front.png differ diff --git a/graphics/pokemon/haunter/icon.png b/graphics/pokemon/haunter/icon.png index ea52910dd724..95c429b90038 100644 Binary files a/graphics/pokemon/haunter/icon.png and b/graphics/pokemon/haunter/icon.png differ diff --git a/graphics/pokemon/heracross/anim_frontf.png b/graphics/pokemon/heracross/anim_frontf.png new file mode 100644 index 000000000000..955bc628b850 Binary files /dev/null and b/graphics/pokemon/heracross/anim_frontf.png differ diff --git a/graphics/pokemon/heracross/backf.png b/graphics/pokemon/heracross/backf.png new file mode 100644 index 000000000000..2efbc549ddd6 Binary files /dev/null and b/graphics/pokemon/heracross/backf.png differ diff --git a/graphics/pokemon/hippowdon/back.png b/graphics/pokemon/hippowdon/back.png index b2f8daff3825..4f31c1d7af98 100644 Binary files a/graphics/pokemon/hippowdon/back.png and b/graphics/pokemon/hippowdon/back.png differ diff --git a/graphics/pokemon/hitmonchan/anim_front.png b/graphics/pokemon/hitmonchan/anim_front.png index 71d40fb78516..ee3725e0ee1a 100644 Binary files a/graphics/pokemon/hitmonchan/anim_front.png and b/graphics/pokemon/hitmonchan/anim_front.png differ diff --git a/graphics/pokemon/hitmonchan/back.png b/graphics/pokemon/hitmonchan/back.png index d87ab20f740f..8f5bd8ded7f3 100644 Binary files a/graphics/pokemon/hitmonchan/back.png and b/graphics/pokemon/hitmonchan/back.png differ diff --git a/graphics/pokemon/hitmonlee/anim_front.png b/graphics/pokemon/hitmonlee/anim_front.png index 89d69129da82..305a858f8345 100644 Binary files a/graphics/pokemon/hitmonlee/anim_front.png and b/graphics/pokemon/hitmonlee/anim_front.png differ diff --git a/graphics/pokemon/hitmontop/icon.png b/graphics/pokemon/hitmontop/icon.png index 7f8d63f91561..b8386b25a961 100644 Binary files a/graphics/pokemon/hitmontop/icon.png and b/graphics/pokemon/hitmontop/icon.png differ diff --git a/graphics/pokemon/ho_oh/icon.png b/graphics/pokemon/ho_oh/icon.png index 315683cc5e8e..d8148fa51942 100644 Binary files a/graphics/pokemon/ho_oh/icon.png and b/graphics/pokemon/ho_oh/icon.png differ diff --git a/graphics/pokemon/hoopa/back.png b/graphics/pokemon/hoopa/back.png index 64912b323617..64c0fad421c7 100644 Binary files a/graphics/pokemon/hoopa/back.png and b/graphics/pokemon/hoopa/back.png differ diff --git a/graphics/pokemon/hoothoot/anim_front.png b/graphics/pokemon/hoothoot/anim_front.png index e25d4a4fc7cf..09943cac2f63 100644 Binary files a/graphics/pokemon/hoothoot/anim_front.png and b/graphics/pokemon/hoothoot/anim_front.png differ diff --git a/graphics/pokemon/hoppip/anim_front.png b/graphics/pokemon/hoppip/anim_front.png index bea636b46f47..cb964bf326a0 100644 Binary files a/graphics/pokemon/hoppip/anim_front.png and b/graphics/pokemon/hoppip/anim_front.png differ diff --git a/graphics/pokemon/hoppip/icon.png b/graphics/pokemon/hoppip/icon.png index ba010a365321..8de4fbc5117f 100644 Binary files a/graphics/pokemon/hoppip/icon.png and b/graphics/pokemon/hoppip/icon.png differ diff --git a/graphics/pokemon/horsea/anim_front.png b/graphics/pokemon/horsea/anim_front.png index 3094e370429e..c003f4cc2acd 100644 Binary files a/graphics/pokemon/horsea/anim_front.png and b/graphics/pokemon/horsea/anim_front.png differ diff --git a/graphics/pokemon/houndoom/anim_front.png b/graphics/pokemon/houndoom/anim_front.png index b2cfcd7029cc..3f2c75a39bf9 100644 Binary files a/graphics/pokemon/houndoom/anim_front.png and b/graphics/pokemon/houndoom/anim_front.png differ diff --git a/graphics/pokemon/houndoom/anim_frontf.png b/graphics/pokemon/houndoom/anim_frontf.png new file mode 100644 index 000000000000..f5f3b6b9e68e Binary files /dev/null and b/graphics/pokemon/houndoom/anim_frontf.png differ diff --git a/graphics/pokemon/houndoom/backf.png b/graphics/pokemon/houndoom/backf.png new file mode 100644 index 000000000000..dfbf43c952f6 Binary files /dev/null and b/graphics/pokemon/houndoom/backf.png differ diff --git a/graphics/pokemon/huntail/icon.png b/graphics/pokemon/huntail/icon.png index 42a800657e49..a3b9e02c9346 100644 Binary files a/graphics/pokemon/huntail/icon.png and b/graphics/pokemon/huntail/icon.png differ diff --git a/graphics/pokemon/hydreigon/icon.png b/graphics/pokemon/hydreigon/icon.png index 540b136372cf..a7ee63021c10 100644 Binary files a/graphics/pokemon/hydreigon/icon.png and b/graphics/pokemon/hydreigon/icon.png differ diff --git a/graphics/pokemon/hypno/anim_frontf.png b/graphics/pokemon/hypno/anim_frontf.png new file mode 100644 index 000000000000..692bb8933b3c Binary files /dev/null and b/graphics/pokemon/hypno/anim_frontf.png differ diff --git a/graphics/pokemon/hypno/backf.png b/graphics/pokemon/hypno/backf.png new file mode 100644 index 000000000000..a92c0b9917e9 Binary files /dev/null and b/graphics/pokemon/hypno/backf.png differ diff --git a/graphics/pokemon/hypno/icon.png b/graphics/pokemon/hypno/icon.png index 647e829d3f39..422f47926af2 100644 Binary files a/graphics/pokemon/hypno/icon.png and b/graphics/pokemon/hypno/icon.png differ diff --git a/graphics/pokemon/igglybuff/anim_front.png b/graphics/pokemon/igglybuff/anim_front.png index 79068d36f631..bd34fb18490f 100644 Binary files a/graphics/pokemon/igglybuff/anim_front.png and b/graphics/pokemon/igglybuff/anim_front.png differ diff --git a/graphics/pokemon/infernape/icon.png b/graphics/pokemon/infernape/icon.png index 8eb9e955c604..157d645084bf 100644 Binary files a/graphics/pokemon/infernape/icon.png and b/graphics/pokemon/infernape/icon.png differ diff --git a/graphics/pokemon/ivysaur/anim_front.png b/graphics/pokemon/ivysaur/anim_front.png index 35c0596b2c8b..1fe645853ac8 100644 Binary files a/graphics/pokemon/ivysaur/anim_front.png and b/graphics/pokemon/ivysaur/anim_front.png differ diff --git a/graphics/pokemon/ivysaur/back.png b/graphics/pokemon/ivysaur/back.png index 4ec8a61a17cb..004cf339b47f 100644 Binary files a/graphics/pokemon/ivysaur/back.png and b/graphics/pokemon/ivysaur/back.png differ diff --git a/graphics/pokemon/ivysaur/normal.pal b/graphics/pokemon/ivysaur/normal.pal index 8ce5c7c84573..30f8e8be5a43 100644 --- a/graphics/pokemon/ivysaur/normal.pal +++ b/graphics/pokemon/ivysaur/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -120 48 40 -216 64 88 -248 176 168 -248 120 120 -16 16 16 -16 64 72 -120 216 112 -48 128 80 -96 176 88 -128 232 216 -88 208 184 +152 160 208 +255 255 255 +255 172 164 +255 123 123 +213 65 90 +128 224 208 +88 200 184 32 144 128 -248 248 248 -160 48 16 -224 80 56 +16 65 74 +120 208 112 +96 168 88 +48 120 80 +16 72 56 +197 115 57 +123 49 41 +16 16 16 diff --git a/graphics/pokemon/ivysaur/shiny.pal b/graphics/pokemon/ivysaur/shiny.pal index 27e7a2bed71e..cf39cdcf6432 100644 --- a/graphics/pokemon/ivysaur/shiny.pal +++ b/graphics/pokemon/ivysaur/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -153 210 164 -107 77 48 -205 139 16 +152 160 208 +255 255 255 255 255 156 255 213 0 -16 16 16 -49 90 16 -139 222 74 -49 131 49 -90 172 32 +205 139 16 205 246 82 164 213 74 123 164 49 -255 255 255 -160 48 16 -224 80 56 +57 98 32 +139 222 74 +90 172 32 +49 131 49 +49 90 16 +213 98 57 +139 32 41 +16 16 16 diff --git a/graphics/pokemon/jangmo_o/anim_front.png b/graphics/pokemon/jangmo_o/anim_front.png new file mode 100644 index 000000000000..d462c0adb83c Binary files /dev/null and b/graphics/pokemon/jangmo_o/anim_front.png differ diff --git a/graphics/pokemon/jangmo_o/front.png b/graphics/pokemon/jangmo_o/front.png deleted file mode 100644 index f6be8a056ad9..000000000000 Binary files a/graphics/pokemon/jangmo_o/front.png and /dev/null differ diff --git a/graphics/pokemon/jellicent/backf.png b/graphics/pokemon/jellicent/backf.png index f6f0b060582a..4e40570c49d4 100644 Binary files a/graphics/pokemon/jellicent/backf.png and b/graphics/pokemon/jellicent/backf.png differ diff --git a/graphics/pokemon/jellicent/icon.png b/graphics/pokemon/jellicent/icon.png index 0a6f313cec9e..2b8f126204f6 100644 Binary files a/graphics/pokemon/jellicent/icon.png and b/graphics/pokemon/jellicent/icon.png differ diff --git a/graphics/pokemon/jellicent/iconf.png b/graphics/pokemon/jellicent/iconf.png index f9caf9f13f12..1dc556bb9d9b 100644 Binary files a/graphics/pokemon/jellicent/iconf.png and b/graphics/pokemon/jellicent/iconf.png differ diff --git a/graphics/pokemon/jigglypuff/anim_front.png b/graphics/pokemon/jigglypuff/anim_front.png index d6eb61c1ded4..17173331d865 100644 Binary files a/graphics/pokemon/jigglypuff/anim_front.png and b/graphics/pokemon/jigglypuff/anim_front.png differ diff --git a/graphics/pokemon/jigglypuff/back.png b/graphics/pokemon/jigglypuff/back.png index 1cf980c173d2..0c12a83007ab 100644 Binary files a/graphics/pokemon/jigglypuff/back.png and b/graphics/pokemon/jigglypuff/back.png differ diff --git a/graphics/pokemon/jigglypuff/normal.pal b/graphics/pokemon/jigglypuff/normal.pal index 6f4d96e9d23e..5ab3f9079771 100644 --- a/graphics/pokemon/jigglypuff/normal.pal +++ b/graphics/pokemon/jigglypuff/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -164 16 32 +255 255 255 +200 232 248 +16 176 232 +24 112 192 +16 72 136 +104 80 96 +72 56 88 +230 230 230 +164 49 0 +213 57 49 +16 16 16 +255 205 197 255 172 164 230 115 131 -16 16 16 -115 65 24 -255 255 255 -115 98 222 -65 49 156 -148 131 255 -205 189 255 -168 16 0 -232 64 48 -0 0 0 -0 0 0 -0 0 0 +164 16 32 diff --git a/graphics/pokemon/jigglypuff/shiny.pal b/graphics/pokemon/jigglypuff/shiny.pal index 36b8d0ce563b..3bfdb77e581b 100644 --- a/graphics/pokemon/jigglypuff/shiny.pal +++ b/graphics/pokemon/jigglypuff/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -153 210 164 -123 90 115 -246 205 238 -222 156 197 -16 16 16 -140 99 43 +152 160 208 255 255 255 -24 172 74 -41 123 49 -24 222 164 -212 213 216 -163 69 32 -211 97 93 -0 0 0 -0 0 0 -0 0 0 +205 255 189 +24 216 160 +24 168 72 +40 120 48 +156 106 32 +115 65 24 +230 230 230 +164 49 0 +213 57 49 +16 16 16 +255 230 255 +240 200 232 +216 152 192 +120 88 112 diff --git a/graphics/pokemon/jolteon/anim_front.png b/graphics/pokemon/jolteon/anim_front.png index b5c8be0af95e..bb262313f11c 100644 Binary files a/graphics/pokemon/jolteon/anim_front.png and b/graphics/pokemon/jolteon/anim_front.png differ diff --git a/graphics/pokemon/jynx/anim_front.png b/graphics/pokemon/jynx/anim_front.png index de426d41a553..d21527af7d81 100644 Binary files a/graphics/pokemon/jynx/anim_front.png and b/graphics/pokemon/jynx/anim_front.png differ diff --git a/graphics/pokemon/kadabra/anim_front.png b/graphics/pokemon/kadabra/anim_front.png index 67f232894c12..2096f22335fb 100644 Binary files a/graphics/pokemon/kadabra/anim_front.png and b/graphics/pokemon/kadabra/anim_front.png differ diff --git a/graphics/pokemon/kadabra/anim_frontf.png b/graphics/pokemon/kadabra/anim_frontf.png new file mode 100644 index 000000000000..e78ff9e7062b Binary files /dev/null and b/graphics/pokemon/kadabra/anim_frontf.png differ diff --git a/graphics/pokemon/kadabra/back.png b/graphics/pokemon/kadabra/back.png index b3a7b06994cb..4ea3df19ddf1 100644 Binary files a/graphics/pokemon/kadabra/back.png and b/graphics/pokemon/kadabra/back.png differ diff --git a/graphics/pokemon/kadabra/backf.png b/graphics/pokemon/kadabra/backf.png new file mode 100644 index 000000000000..45a60bf7dbef Binary files /dev/null and b/graphics/pokemon/kadabra/backf.png differ diff --git a/graphics/pokemon/kadabra/normal.pal b/graphics/pokemon/kadabra/normal.pal index a69a8d21ceee..c607508da9c0 100644 --- a/graphics/pokemon/kadabra/normal.pal +++ b/graphics/pokemon/kadabra/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -139 115 16 -98 74 8 -255 238 41 -213 189 8 -16 16 16 +255 255 255 +222 222 222 +180 180 180 +90 90 90 230 57 41 -90 57 8 +197 164 82 164 115 41 -216 216 216 -248 248 248 -88 88 88 123 82 8 -176 176 176 -248 248 184 -200 168 168 +90 57 8 +255 255 189 +255 238 41 +213 189 8 +139 115 16 +98 74 8 +16 16 16 diff --git a/graphics/pokemon/kadabra/shiny.pal b/graphics/pokemon/kadabra/shiny.pal index 1d0d44c74e6d..f0c824094dfc 100644 --- a/graphics/pokemon/kadabra/shiny.pal +++ b/graphics/pokemon/kadabra/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -176 112 16 -128 88 24 -248 240 128 -224 176 64 +255 255 255 +222 222 222 +180 180 180 +90 90 90 +222 49 41 +222 180 189 +180 123 131 +131 82 90 +90 49 57 +255 246 230 +255 246 131 +230 180 65 +180 115 16 +131 90 24 16 16 16 -224 72 64 -88 48 56 -176 120 128 -216 216 216 -248 248 248 -88 88 88 -128 80 88 -176 176 176 -248 240 224 -216 176 184 diff --git a/graphics/pokemon/kakuna/anim_front.png b/graphics/pokemon/kakuna/anim_front.png index e86330ea38fe..78f7fd26965f 100644 Binary files a/graphics/pokemon/kakuna/anim_front.png and b/graphics/pokemon/kakuna/anim_front.png differ diff --git a/graphics/pokemon/kakuna/back.png b/graphics/pokemon/kakuna/back.png index b33f6ca6b2a1..ef55df0be0db 100644 Binary files a/graphics/pokemon/kakuna/back.png and b/graphics/pokemon/kakuna/back.png differ diff --git a/graphics/pokemon/kakuna/normal.pal b/graphics/pokemon/kakuna/normal.pal index 91ff072e5530..3dd39c3ee6f0 100644 --- a/graphics/pokemon/kakuna/normal.pal +++ b/graphics/pokemon/kakuna/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -222 164 82 -180 123 0 -246 213 74 +255 255 255 255 246 205 -139 90 0 -90 57 0 -57 57 57 +240 200 48 +200 152 16 +152 120 0 +120 88 0 +72 56 0 +255 0 255 +255 0 255 106 106 106 +57 57 57 16 16 16 -255 255 255 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 +255 0 255 +255 0 255 +255 0 255 diff --git a/graphics/pokemon/kakuna/shiny.pal b/graphics/pokemon/kakuna/shiny.pal index 970c6af70106..5a6bb2de01e0 100644 --- a/graphics/pokemon/kakuna/shiny.pal +++ b/graphics/pokemon/kakuna/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -128 184 40 -80 136 0 -168 248 0 -208 248 152 -48 104 16 -24 64 0 -56 56 56 -104 104 104 +152 160 208 +255 255 255 +213 255 156 +172 255 0 +131 189 41 +82 139 0 +49 106 16 +24 65 0 +255 0 255 +255 0 255 +106 106 106 +57 57 57 16 16 16 -248 248 248 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 +255 0 255 +255 0 255 +255 0 255 diff --git a/graphics/pokemon/kangaskhan/anim_front.png b/graphics/pokemon/kangaskhan/anim_front.png index d0b912052008..e4f4404c8f16 100644 Binary files a/graphics/pokemon/kangaskhan/anim_front.png and b/graphics/pokemon/kangaskhan/anim_front.png differ diff --git a/graphics/pokemon/karrablast/icon.png b/graphics/pokemon/karrablast/icon.png index 9db6f2f4d390..9d99fc657aa2 100644 Binary files a/graphics/pokemon/karrablast/icon.png and b/graphics/pokemon/karrablast/icon.png differ diff --git a/graphics/pokemon/keldeo/icon.png b/graphics/pokemon/keldeo/icon.png index a7b3f96ab5d9..965c3859d02c 100644 Binary files a/graphics/pokemon/keldeo/icon.png and b/graphics/pokemon/keldeo/icon.png differ diff --git a/graphics/pokemon/keldeo/resolute/back.png b/graphics/pokemon/keldeo/resolute/back.png index 28654de7dd7e..b51a9c028637 100644 Binary files a/graphics/pokemon/keldeo/resolute/back.png and b/graphics/pokemon/keldeo/resolute/back.png differ diff --git a/graphics/pokemon/keldeo/resolute/icon.png b/graphics/pokemon/keldeo/resolute/icon.png index 8da8ea26c874..4246d60445bd 100644 Binary files a/graphics/pokemon/keldeo/resolute/icon.png and b/graphics/pokemon/keldeo/resolute/icon.png differ diff --git a/graphics/pokemon/kingdra/icon.png b/graphics/pokemon/kingdra/icon.png index 0873dedb4fa0..15e84fbdc54e 100644 Binary files a/graphics/pokemon/kingdra/icon.png and b/graphics/pokemon/kingdra/icon.png differ diff --git a/graphics/pokemon/kingler/anim_front.png b/graphics/pokemon/kingler/anim_front.png index d2544716323c..d60fedc19037 100644 Binary files a/graphics/pokemon/kingler/anim_front.png and b/graphics/pokemon/kingler/anim_front.png differ diff --git a/graphics/pokemon/kingler/icon.png b/graphics/pokemon/kingler/icon.png index 3f9d0b8b78e4..d297ee90a39a 100644 Binary files a/graphics/pokemon/kingler/icon.png and b/graphics/pokemon/kingler/icon.png differ diff --git a/graphics/pokemon/koffing/anim_front.png b/graphics/pokemon/koffing/anim_front.png index fbe8c25e6ef0..891ee864d6a3 100644 Binary files a/graphics/pokemon/koffing/anim_front.png and b/graphics/pokemon/koffing/anim_front.png differ diff --git a/graphics/pokemon/koffing/icon.png b/graphics/pokemon/koffing/icon.png index 0c5b36150286..bf9e075fd4fa 100644 Binary files a/graphics/pokemon/koffing/icon.png and b/graphics/pokemon/koffing/icon.png differ diff --git a/graphics/pokemon/kommo_o/anim_front.png b/graphics/pokemon/kommo_o/anim_front.png new file mode 100644 index 000000000000..5f1a7382ba0d Binary files /dev/null and b/graphics/pokemon/kommo_o/anim_front.png differ diff --git a/graphics/pokemon/kommo_o/front.png b/graphics/pokemon/kommo_o/front.png deleted file mode 100644 index 7946cfa72010..000000000000 Binary files a/graphics/pokemon/kommo_o/front.png and /dev/null differ diff --git a/graphics/pokemon/krabby/anim_front.png b/graphics/pokemon/krabby/anim_front.png index 294beebb2ae7..69d4f372d17a 100644 Binary files a/graphics/pokemon/krabby/anim_front.png and b/graphics/pokemon/krabby/anim_front.png differ diff --git a/graphics/pokemon/krabby/icon.png b/graphics/pokemon/krabby/icon.png index 8cedc348d056..27d5f212cf9e 100644 Binary files a/graphics/pokemon/krabby/icon.png and b/graphics/pokemon/krabby/icon.png differ diff --git a/graphics/pokemon/kricketot/anim_front.png b/graphics/pokemon/kricketot/anim_front.png index 7bf0fd3973c2..e9a485ef0c91 100644 Binary files a/graphics/pokemon/kricketot/anim_front.png and b/graphics/pokemon/kricketot/anim_front.png differ diff --git a/graphics/pokemon/kricketot/anim_frontf.png b/graphics/pokemon/kricketot/anim_frontf.png index f7403b91c83f..ef0ca6d8797d 100644 Binary files a/graphics/pokemon/kricketot/anim_frontf.png and b/graphics/pokemon/kricketot/anim_frontf.png differ diff --git a/graphics/pokemon/kricketot/backf.png b/graphics/pokemon/kricketot/backf.png index 7726df0d680a..effaf04f32fe 100644 Binary files a/graphics/pokemon/kricketot/backf.png and b/graphics/pokemon/kricketot/backf.png differ diff --git a/graphics/pokemon/kricketune/anim_front.png b/graphics/pokemon/kricketune/anim_front.png index 47cefb0a6a8d..01894506aa76 100644 Binary files a/graphics/pokemon/kricketune/anim_front.png and b/graphics/pokemon/kricketune/anim_front.png differ diff --git a/graphics/pokemon/kricketune/anim_frontf.png b/graphics/pokemon/kricketune/anim_frontf.png index 530ec9f767fb..745caacaf525 100644 Binary files a/graphics/pokemon/kricketune/anim_frontf.png and b/graphics/pokemon/kricketune/anim_frontf.png differ diff --git a/graphics/pokemon/kricketune/backf.png b/graphics/pokemon/kricketune/backf.png index fb9e5ca8553c..b07e1451b975 100644 Binary files a/graphics/pokemon/kricketune/backf.png and b/graphics/pokemon/kricketune/backf.png differ diff --git a/graphics/pokemon/krokorok/anim_front.png b/graphics/pokemon/krokorok/anim_front.png index 43af22d239b5..009bfdf996aa 100644 Binary files a/graphics/pokemon/krokorok/anim_front.png and b/graphics/pokemon/krokorok/anim_front.png differ diff --git a/graphics/pokemon/kyurem/icon.png b/graphics/pokemon/kyurem/icon.png index 9883000b012b..e241c9d6e207 100644 Binary files a/graphics/pokemon/kyurem/icon.png and b/graphics/pokemon/kyurem/icon.png differ diff --git a/graphics/pokemon/lairon/icon.png b/graphics/pokemon/lairon/icon.png index 27cb6edaa3ed..421f41a3d20a 100644 Binary files a/graphics/pokemon/lairon/icon.png and b/graphics/pokemon/lairon/icon.png differ diff --git a/graphics/pokemon/landorus/icon.png b/graphics/pokemon/landorus/icon.png index 4b2ec8d4f791..58d8673c37f9 100644 Binary files a/graphics/pokemon/landorus/icon.png and b/graphics/pokemon/landorus/icon.png differ diff --git a/graphics/pokemon/lanturn/anim_front.png b/graphics/pokemon/lanturn/anim_front.png index b84c0a77fddd..000127ce1a55 100644 Binary files a/graphics/pokemon/lanturn/anim_front.png and b/graphics/pokemon/lanturn/anim_front.png differ diff --git a/graphics/pokemon/lapras/anim_front.png b/graphics/pokemon/lapras/anim_front.png index ac69884f41db..368eda943ac5 100644 Binary files a/graphics/pokemon/lapras/anim_front.png and b/graphics/pokemon/lapras/anim_front.png differ diff --git a/graphics/pokemon/lapras/back.png b/graphics/pokemon/lapras/back.png index 60d5f840d3bd..e1939be7b64e 100644 Binary files a/graphics/pokemon/lapras/back.png and b/graphics/pokemon/lapras/back.png differ diff --git a/graphics/pokemon/larvesta/icon.png b/graphics/pokemon/larvesta/icon.png index 8050f8bfdf77..f15edb00ba04 100644 Binary files a/graphics/pokemon/larvesta/icon.png and b/graphics/pokemon/larvesta/icon.png differ diff --git a/graphics/pokemon/larvitar/back.png b/graphics/pokemon/larvitar/back.png index 2facd5cb5e2f..4493ddd7e977 100644 Binary files a/graphics/pokemon/larvitar/back.png and b/graphics/pokemon/larvitar/back.png differ diff --git a/graphics/pokemon/latias/icon.png b/graphics/pokemon/latias/icon.png index 9c79f1e187c2..ddd9b829a285 100644 Binary files a/graphics/pokemon/latias/icon.png and b/graphics/pokemon/latias/icon.png differ diff --git a/graphics/pokemon/latios/icon.png b/graphics/pokemon/latios/icon.png index d63fb4710ea4..875922e5aaec 100644 Binary files a/graphics/pokemon/latios/icon.png and b/graphics/pokemon/latios/icon.png differ diff --git a/graphics/pokemon/leafeon/icon.png b/graphics/pokemon/leafeon/icon.png index 2aabf8025716..0586ce2fcfdd 100644 Binary files a/graphics/pokemon/leafeon/icon.png and b/graphics/pokemon/leafeon/icon.png differ diff --git a/graphics/pokemon/ledian/anim_front.png b/graphics/pokemon/ledian/anim_front.png index c866d2769f9d..f5fa8dec90e3 100644 Binary files a/graphics/pokemon/ledian/anim_front.png and b/graphics/pokemon/ledian/anim_front.png differ diff --git a/graphics/pokemon/ledian/anim_frontf.png b/graphics/pokemon/ledian/anim_frontf.png new file mode 100644 index 000000000000..7379d49fa8d9 Binary files /dev/null and b/graphics/pokemon/ledian/anim_frontf.png differ diff --git a/graphics/pokemon/ledian/backf.png b/graphics/pokemon/ledian/backf.png new file mode 100644 index 000000000000..269c5739c316 Binary files /dev/null and b/graphics/pokemon/ledian/backf.png differ diff --git a/graphics/pokemon/ledyba/anim_front.png b/graphics/pokemon/ledyba/anim_front.png index 4239a277602d..ad0592645edd 100644 Binary files a/graphics/pokemon/ledyba/anim_front.png and b/graphics/pokemon/ledyba/anim_front.png differ diff --git a/graphics/pokemon/ledyba/anim_frontf.png b/graphics/pokemon/ledyba/anim_frontf.png new file mode 100644 index 000000000000..1fd7a521efeb Binary files /dev/null and b/graphics/pokemon/ledyba/anim_frontf.png differ diff --git a/graphics/pokemon/ledyba/backf.png b/graphics/pokemon/ledyba/backf.png new file mode 100644 index 000000000000..5c157420a3fd Binary files /dev/null and b/graphics/pokemon/ledyba/backf.png differ diff --git a/graphics/pokemon/lileep/icon.png b/graphics/pokemon/lileep/icon.png index 034453bf99a5..f74fb0921bb1 100644 Binary files a/graphics/pokemon/lileep/icon.png and b/graphics/pokemon/lileep/icon.png differ diff --git a/graphics/pokemon/lombre/anim_front.png b/graphics/pokemon/lombre/anim_front.png index cb0fef9c4d22..b3a54b99484d 100644 Binary files a/graphics/pokemon/lombre/anim_front.png and b/graphics/pokemon/lombre/anim_front.png differ diff --git a/graphics/pokemon/lucario/back.png b/graphics/pokemon/lucario/back.png index 24e8a6023612..819aee16786c 100644 Binary files a/graphics/pokemon/lucario/back.png and b/graphics/pokemon/lucario/back.png differ diff --git a/graphics/pokemon/ludicolo/anim_frontf.png b/graphics/pokemon/ludicolo/anim_frontf.png new file mode 100644 index 000000000000..5dcb282b07f3 Binary files /dev/null and b/graphics/pokemon/ludicolo/anim_frontf.png differ diff --git a/graphics/pokemon/ludicolo/backf.png b/graphics/pokemon/ludicolo/backf.png new file mode 100644 index 000000000000..00b79eb4724c Binary files /dev/null and b/graphics/pokemon/ludicolo/backf.png differ diff --git a/graphics/pokemon/lugia/icon.png b/graphics/pokemon/lugia/icon.png index fda93844eecf..d0eadd642bc1 100644 Binary files a/graphics/pokemon/lugia/icon.png and b/graphics/pokemon/lugia/icon.png differ diff --git a/graphics/pokemon/lumineon/anim_frontf.png b/graphics/pokemon/lumineon/anim_frontf.png new file mode 100644 index 000000000000..ac511018d4a8 Binary files /dev/null and b/graphics/pokemon/lumineon/anim_frontf.png differ diff --git a/graphics/pokemon/lumineon/backf.png b/graphics/pokemon/lumineon/backf.png new file mode 100644 index 000000000000..f94e5d1daf44 Binary files /dev/null and b/graphics/pokemon/lumineon/backf.png differ diff --git a/graphics/pokemon/luxio/anim_front.png b/graphics/pokemon/luxio/anim_front.png index 8b9ffd23381c..691f23e60a13 100644 Binary files a/graphics/pokemon/luxio/anim_front.png and b/graphics/pokemon/luxio/anim_front.png differ diff --git a/graphics/pokemon/luxio/anim_frontf.png b/graphics/pokemon/luxio/anim_frontf.png new file mode 100644 index 000000000000..30ec79e6cd8b Binary files /dev/null and b/graphics/pokemon/luxio/anim_frontf.png differ diff --git a/graphics/pokemon/luxio/back.png b/graphics/pokemon/luxio/back.png index 8ee3ca65bbf8..4662c081f589 100644 Binary files a/graphics/pokemon/luxio/back.png and b/graphics/pokemon/luxio/back.png differ diff --git a/graphics/pokemon/luxio/backf.png b/graphics/pokemon/luxio/backf.png new file mode 100644 index 000000000000..e1b5e4bb9a3b Binary files /dev/null and b/graphics/pokemon/luxio/backf.png differ diff --git a/graphics/pokemon/luxray/anim_front.png b/graphics/pokemon/luxray/anim_front.png index 93a073ce4413..b2de7e12e63c 100644 Binary files a/graphics/pokemon/luxray/anim_front.png and b/graphics/pokemon/luxray/anim_front.png differ diff --git a/graphics/pokemon/luxray/anim_frontf.png b/graphics/pokemon/luxray/anim_frontf.png new file mode 100644 index 000000000000..49d83d6b758a Binary files /dev/null and b/graphics/pokemon/luxray/anim_frontf.png differ diff --git a/graphics/pokemon/luxray/back.png b/graphics/pokemon/luxray/back.png index b8625a41a015..3c40f6f73d34 100644 Binary files a/graphics/pokemon/luxray/back.png and b/graphics/pokemon/luxray/back.png differ diff --git a/graphics/pokemon/luxray/backf.png b/graphics/pokemon/luxray/backf.png new file mode 100644 index 000000000000..ce0fe29e44d9 Binary files /dev/null and b/graphics/pokemon/luxray/backf.png differ diff --git a/graphics/pokemon/luxray/icon.png b/graphics/pokemon/luxray/icon.png index 9514dbc9b212..b6b6e08c9340 100644 Binary files a/graphics/pokemon/luxray/icon.png and b/graphics/pokemon/luxray/icon.png differ diff --git a/graphics/pokemon/luxray/normal.pal b/graphics/pokemon/luxray/normal.pal index 302dceb37327..c81dbd367791 100644 --- a/graphics/pokemon/luxray/normal.pal +++ b/graphics/pokemon/luxray/normal.pal @@ -15,5 +15,5 @@ JASC-PAL 144 56 80 72 72 112 168 56 80 -0 0 0 +255 255 255 0 0 0 diff --git a/graphics/pokemon/lycanroc/dusk/front.png b/graphics/pokemon/lycanroc/dusk/front.png index 0784c7bafde0..8e8beb2311ce 100644 Binary files a/graphics/pokemon/lycanroc/dusk/front.png and b/graphics/pokemon/lycanroc/dusk/front.png differ diff --git a/graphics/pokemon/lycanroc/midnight/front.png b/graphics/pokemon/lycanroc/midnight/front.png index 2a792d2afbfc..73a49530dd43 100644 Binary files a/graphics/pokemon/lycanroc/midnight/front.png and b/graphics/pokemon/lycanroc/midnight/front.png differ diff --git a/graphics/pokemon/machamp/anim_front.png b/graphics/pokemon/machamp/anim_front.png index 8778b19b1864..4b4c47e885b0 100644 Binary files a/graphics/pokemon/machamp/anim_front.png and b/graphics/pokemon/machamp/anim_front.png differ diff --git a/graphics/pokemon/machamp/back.png b/graphics/pokemon/machamp/back.png index a5744c58c286..7b9f905cf2c3 100644 Binary files a/graphics/pokemon/machamp/back.png and b/graphics/pokemon/machamp/back.png differ diff --git a/graphics/pokemon/machamp/normal.pal b/graphics/pokemon/machamp/normal.pal index b08105e3080d..c91323082777 100644 --- a/graphics/pokemon/machamp/normal.pal +++ b/graphics/pokemon/machamp/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 +0 0 0 +74 74 98 65 82 98 131 139 148 164 180 180 -0 0 0 -112 96 72 -74 74 98 +197 213 222 +82 65 0 +131 115 41 172 156 65 -184 0 0 -248 248 248 -128 112 40 -240 232 152 -80 64 0 -200 192 96 -224 80 56 -168 48 16 +205 197 98 +246 238 156 +255 74 57 +189 0 0 +205 222 238 +255 255 255 diff --git a/graphics/pokemon/machamp/shiny.pal b/graphics/pokemon/machamp/shiny.pal index 3bbeb67226bb..20887b0aaeab 100644 --- a/graphics/pokemon/machamp/shiny.pal +++ b/graphics/pokemon/machamp/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -56 80 24 -104 136 56 -152 184 88 -8 8 8 -80 64 24 +152 160 208 +0 0 0 49 74 0 -160 152 80 -184 32 32 -248 248 248 -128 112 40 -216 208 144 -80 64 24 -200 192 96 -248 104 88 -184 32 32 +74 106 16 +106 139 41 +148 189 74 +172 222 106 +82 65 0 +131 115 41 +172 156 65 +205 197 98 +246 238 156 +255 74 57 +189 0 0 +205 222 238 +255 255 255 diff --git a/graphics/pokemon/machoke/anim_front.png b/graphics/pokemon/machoke/anim_front.png index 3286b07fcbfd..d770f9910c66 100644 Binary files a/graphics/pokemon/machoke/anim_front.png and b/graphics/pokemon/machoke/anim_front.png differ diff --git a/graphics/pokemon/machoke/back.png b/graphics/pokemon/machoke/back.png index a5f819669fe4..0403e37adaa9 100644 Binary files a/graphics/pokemon/machoke/back.png and b/graphics/pokemon/machoke/back.png differ diff --git a/graphics/pokemon/machoke/normal.pal b/graphics/pokemon/machoke/normal.pal index 1dab6bec2d0d..60348197e4e8 100644 --- a/graphics/pokemon/machoke/normal.pal +++ b/graphics/pokemon/machoke/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -82 57 0 -16 16 16 -238 230 139 -205 189 98 +0 0 0 +74 74 98 +106 49 131 139 115 180 +164 139 205 189 156 230 -106 49 131 205 189 230 -197 0 0 -248 248 248 -156 57 123 -240 224 120 -72 72 96 -200 176 96 +82 57 0 131 115 41 +205 189 98 +238 230 139 +156 57 123 +197 0 0 +205 222 238 +255 255 255 diff --git a/graphics/pokemon/machoke/shiny.pal b/graphics/pokemon/machoke/shiny.pal index 0a5c93d31246..640441c2232d 100644 --- a/graphics/pokemon/machoke/shiny.pal +++ b/graphics/pokemon/machoke/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -248 160 176 -96 72 24 -16 16 16 -232 224 136 -200 184 96 -104 136 56 -144 184 112 -40 88 0 -176 216 144 -32 120 176 -248 248 248 -24 96 136 -232 224 136 -72 72 96 -200 184 96 -128 112 40 +208 152 160 +0 0 0 +16 65 0 +41 90 0 +82 115 41 +123 156 90 +148 189 115 +180 222 148 +82 57 0 +131 115 41 +205 189 98 +238 230 139 +0 98 156 +0 115 197 +205 222 238 +255 255 255 diff --git a/graphics/pokemon/machop/anim_front.png b/graphics/pokemon/machop/anim_front.png index ed54423a33e8..3cd8f1210551 100644 Binary files a/graphics/pokemon/machop/anim_front.png and b/graphics/pokemon/machop/anim_front.png differ diff --git a/graphics/pokemon/machop/back.png b/graphics/pokemon/machop/back.png index 6556f497794b..2d4cdb60741c 100644 Binary files a/graphics/pokemon/machop/back.png and b/graphics/pokemon/machop/back.png differ diff --git a/graphics/pokemon/machop/normal.pal b/graphics/pokemon/machop/normal.pal index 7274f6250ef6..8a8b66f91327 100644 --- a/graphics/pokemon/machop/normal.pal +++ b/graphics/pokemon/machop/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -107 82 33 -239 230 140 -173 156 90 -206 189 99 +160 152 208 0 0 0 -148 189 189 -90 123 107 -173 214 197 41 74 82 +90 123 106 +115 164 164 +148 189 189 +172 213 197 +255 0 255 +106 82 32 +172 156 90 +205 189 98 +238 230 139 255 255 255 -239 82 82 -181 0 0 -115 165 165 -240 80 80 -255 132 140 +180 0 0 +238 82 82 +255 131 139 diff --git a/graphics/pokemon/machop/shiny.pal b/graphics/pokemon/machop/shiny.pal index 620971b69ad8..10b8e11c7a23 100644 --- a/graphics/pokemon/machop/shiny.pal +++ b/graphics/pokemon/machop/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -104 80 32 -232 224 136 -168 152 88 -200 184 96 -16 16 16 -176 168 120 -96 88 56 -208 208 152 -64 56 16 -248 248 248 -224 96 88 -160 40 40 -136 128 88 -224 96 88 -248 128 136 +0 0 0 +65 57 16 +106 98 57 +148 139 90 +189 180 123 +222 222 156 +255 0 255 +106 82 32 +172 156 90 +205 189 98 +238 230 139 +255 255 255 +180 0 0 +238 82 82 +255 131 139 diff --git a/graphics/pokemon/magearna/back.png b/graphics/pokemon/magearna/back.png index e29c4ad6c572..17568f8bb230 100644 Binary files a/graphics/pokemon/magearna/back.png and b/graphics/pokemon/magearna/back.png differ diff --git a/graphics/pokemon/magearna/front.png b/graphics/pokemon/magearna/front.png index 20db67ab6ed5..26dcbd557820 100644 Binary files a/graphics/pokemon/magearna/front.png and b/graphics/pokemon/magearna/front.png differ diff --git a/graphics/pokemon/magearna/original_color/back.png b/graphics/pokemon/magearna/original_color/back.png index cf9c0e3236ea..b2ffe7de9c96 100644 Binary files a/graphics/pokemon/magearna/original_color/back.png and b/graphics/pokemon/magearna/original_color/back.png differ diff --git a/graphics/pokemon/magearna/original_color/front.png b/graphics/pokemon/magearna/original_color/front.png index afeb78daed2f..a4e54587e2cd 100644 Binary files a/graphics/pokemon/magearna/original_color/front.png and b/graphics/pokemon/magearna/original_color/front.png differ diff --git a/graphics/pokemon/magearna/original_color/icon.png b/graphics/pokemon/magearna/original_color/icon.png index 057698e414a0..5e97b3ccb37d 100644 Binary files a/graphics/pokemon/magearna/original_color/icon.png and b/graphics/pokemon/magearna/original_color/icon.png differ diff --git a/graphics/pokemon/magikarp/anim_front.png b/graphics/pokemon/magikarp/anim_front.png index 6b7d130f6b04..1351be507fbe 100644 Binary files a/graphics/pokemon/magikarp/anim_front.png and b/graphics/pokemon/magikarp/anim_front.png differ diff --git a/graphics/pokemon/magikarp/anim_frontf.png b/graphics/pokemon/magikarp/anim_frontf.png new file mode 100644 index 000000000000..a7fc99406960 Binary files /dev/null and b/graphics/pokemon/magikarp/anim_frontf.png differ diff --git a/graphics/pokemon/magikarp/backf.png b/graphics/pokemon/magikarp/backf.png new file mode 100644 index 000000000000..edf58cb1fbd7 Binary files /dev/null and b/graphics/pokemon/magikarp/backf.png differ diff --git a/graphics/pokemon/magmar/anim_front.png b/graphics/pokemon/magmar/anim_front.png index a57d2c848c12..282f5ae8c6c1 100644 Binary files a/graphics/pokemon/magmar/anim_front.png and b/graphics/pokemon/magmar/anim_front.png differ diff --git a/graphics/pokemon/magnemite/anim_front.png b/graphics/pokemon/magnemite/anim_front.png index cca53cadd956..d240d64bca45 100644 Binary files a/graphics/pokemon/magnemite/anim_front.png and b/graphics/pokemon/magnemite/anim_front.png differ diff --git a/graphics/pokemon/magnemite/icon.png b/graphics/pokemon/magnemite/icon.png index 95b81cae03d1..1c0ebe8f1c7a 100644 Binary files a/graphics/pokemon/magnemite/icon.png and b/graphics/pokemon/magnemite/icon.png differ diff --git a/graphics/pokemon/magneton/anim_front.png b/graphics/pokemon/magneton/anim_front.png index f54516b9585f..72a8aa907e66 100644 Binary files a/graphics/pokemon/magneton/anim_front.png and b/graphics/pokemon/magneton/anim_front.png differ diff --git a/graphics/pokemon/magneton/icon.png b/graphics/pokemon/magneton/icon.png index bde234ea1132..f6af64f8cad9 100644 Binary files a/graphics/pokemon/magneton/icon.png and b/graphics/pokemon/magneton/icon.png differ diff --git a/graphics/pokemon/mamoswine/anim_frontf.png b/graphics/pokemon/mamoswine/anim_frontf.png new file mode 100644 index 000000000000..b3f9010c7baf Binary files /dev/null and b/graphics/pokemon/mamoswine/anim_frontf.png differ diff --git a/graphics/pokemon/manaphy/icon.png b/graphics/pokemon/manaphy/icon.png index 97dbb79c00f1..101dabbab835 100644 Binary files a/graphics/pokemon/manaphy/icon.png and b/graphics/pokemon/manaphy/icon.png differ diff --git a/graphics/pokemon/manectric/icon.png b/graphics/pokemon/manectric/icon.png index 5d7f3e950852..c7a9e75060fc 100644 Binary files a/graphics/pokemon/manectric/icon.png and b/graphics/pokemon/manectric/icon.png differ diff --git a/graphics/pokemon/mankey/anim_front.png b/graphics/pokemon/mankey/anim_front.png index 453750f97fcb..435869073d5e 100644 Binary files a/graphics/pokemon/mankey/anim_front.png and b/graphics/pokemon/mankey/anim_front.png differ diff --git a/graphics/pokemon/mankey/back.png b/graphics/pokemon/mankey/back.png index dc2e7c53a71b..283dac52d12a 100644 Binary files a/graphics/pokemon/mankey/back.png and b/graphics/pokemon/mankey/back.png differ diff --git a/graphics/pokemon/mankey/normal.pal b/graphics/pokemon/mankey/normal.pal index b0b0e0fbf553..c25dd02a67df 100644 --- a/graphics/pokemon/mankey/normal.pal +++ b/graphics/pokemon/mankey/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -115 65 0 -222 164 115 +255 255 255 +222 222 222 +255 230 189 +238 180 139 +238 115 98 +180 65 49 16 16 16 +255 197 131 +222 164 115 197 115 74 +115 65 0 +255 246 205 246 222 180 213 172 156 -248 248 248 -248 120 104 -180 65 49 -238 115 98 -238 115 98 -238 180 139 -248 192 168 -248 232 224 -104 72 48 +106 74 41 diff --git a/graphics/pokemon/mankey/shiny.pal b/graphics/pokemon/mankey/shiny.pal index 6daaf349af0d..d4ad43c9c80a 100644 --- a/graphics/pokemon/mankey/shiny.pal +++ b/graphics/pokemon/mankey/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -104 88 32 -200 176 112 +152 160 208 +255 255 255 +222 222 222 +255 230 189 +238 180 139 +238 115 98 +180 65 49 16 16 16 -176 128 72 -192 224 160 -152 168 112 -248 248 248 -248 120 104 -152 80 72 -200 88 64 -224 128 112 -232 176 136 -216 208 128 -224 248 200 -80 104 48 +222 213 131 +205 180 115 +180 131 74 +106 82 0 +230 255 205 +197 238 156 +164 180 115 +90 123 41 diff --git a/graphics/pokemon/mareep/anim_front.png b/graphics/pokemon/mareep/anim_front.png index 47961b201aa0..93017a3cd7d5 100644 Binary files a/graphics/pokemon/mareep/anim_front.png and b/graphics/pokemon/mareep/anim_front.png differ diff --git a/graphics/pokemon/mareep/back.png b/graphics/pokemon/mareep/back.png index c0d26a07b66d..7a70f4b207f5 100644 Binary files a/graphics/pokemon/mareep/back.png and b/graphics/pokemon/mareep/back.png differ diff --git a/graphics/pokemon/marowak/anim_front.png b/graphics/pokemon/marowak/anim_front.png index f1a22033ed46..696a9633a987 100644 Binary files a/graphics/pokemon/marowak/anim_front.png and b/graphics/pokemon/marowak/anim_front.png differ diff --git a/graphics/pokemon/marowak/icon.png b/graphics/pokemon/marowak/icon.png index af56d377c599..7f01570cc5d8 100644 Binary files a/graphics/pokemon/marowak/icon.png and b/graphics/pokemon/marowak/icon.png differ diff --git a/graphics/pokemon/marshtomp/back.png b/graphics/pokemon/marshtomp/back.png index baa4e481b4c8..941fdd6993f6 100644 Binary files a/graphics/pokemon/marshtomp/back.png and b/graphics/pokemon/marshtomp/back.png differ diff --git a/graphics/pokemon/masquerain/anim_front.png b/graphics/pokemon/masquerain/anim_front.png index 190c8d079d24..aeec769bd600 100644 Binary files a/graphics/pokemon/masquerain/anim_front.png and b/graphics/pokemon/masquerain/anim_front.png differ diff --git a/graphics/pokemon/mawile/icon.png b/graphics/pokemon/mawile/icon.png index f6605a6470c7..b666200fb1c6 100644 Binary files a/graphics/pokemon/mawile/icon.png and b/graphics/pokemon/mawile/icon.png differ diff --git a/graphics/pokemon/medicham/anim_front.png b/graphics/pokemon/medicham/anim_front.png index ca6c359703de..612910203fdd 100644 Binary files a/graphics/pokemon/medicham/anim_front.png and b/graphics/pokemon/medicham/anim_front.png differ diff --git a/graphics/pokemon/medicham/anim_frontf.png b/graphics/pokemon/medicham/anim_frontf.png new file mode 100644 index 000000000000..29940c980e44 Binary files /dev/null and b/graphics/pokemon/medicham/anim_frontf.png differ diff --git a/graphics/pokemon/medicham/backf.png b/graphics/pokemon/medicham/backf.png new file mode 100644 index 000000000000..fb4a0f9fab18 Binary files /dev/null and b/graphics/pokemon/medicham/backf.png differ diff --git a/graphics/pokemon/medicham/icon.png b/graphics/pokemon/medicham/icon.png index 79883928382f..d5a60d6c1a98 100644 Binary files a/graphics/pokemon/medicham/icon.png and b/graphics/pokemon/medicham/icon.png differ diff --git a/graphics/pokemon/meditite/anim_front.png b/graphics/pokemon/meditite/anim_front.png index 2059f18cb3fd..370244207085 100644 Binary files a/graphics/pokemon/meditite/anim_front.png and b/graphics/pokemon/meditite/anim_front.png differ diff --git a/graphics/pokemon/meditite/anim_frontf.png b/graphics/pokemon/meditite/anim_frontf.png new file mode 100644 index 000000000000..820cc8513b9b Binary files /dev/null and b/graphics/pokemon/meditite/anim_frontf.png differ diff --git a/graphics/pokemon/meditite/back.png b/graphics/pokemon/meditite/back.png index bae1cd032c97..9fac7c183477 100644 Binary files a/graphics/pokemon/meditite/back.png and b/graphics/pokemon/meditite/back.png differ diff --git a/graphics/pokemon/meditite/backf.png b/graphics/pokemon/meditite/backf.png new file mode 100644 index 000000000000..e3f37ccd6488 Binary files /dev/null and b/graphics/pokemon/meditite/backf.png differ diff --git a/graphics/pokemon/meganium/anim_front.png b/graphics/pokemon/meganium/anim_front.png index b89016f3c32f..e9868059fb6b 100644 Binary files a/graphics/pokemon/meganium/anim_front.png and b/graphics/pokemon/meganium/anim_front.png differ diff --git a/graphics/pokemon/meganium/anim_frontf.png b/graphics/pokemon/meganium/anim_frontf.png new file mode 100644 index 000000000000..7faedcabefb6 Binary files /dev/null and b/graphics/pokemon/meganium/anim_frontf.png differ diff --git a/graphics/pokemon/meganium/backf.png b/graphics/pokemon/meganium/backf.png new file mode 100644 index 000000000000..062ce4840252 Binary files /dev/null and b/graphics/pokemon/meganium/backf.png differ diff --git a/graphics/pokemon/meganium/icon.png b/graphics/pokemon/meganium/icon.png index d7d390fe9c13..b62b422f3ec5 100644 Binary files a/graphics/pokemon/meganium/icon.png and b/graphics/pokemon/meganium/icon.png differ diff --git a/graphics/pokemon/meganium/normal.pal b/graphics/pokemon/meganium/normal.pal index 75da9204bb18..c668ecdaa562 100644 --- a/graphics/pokemon/meganium/normal.pal +++ b/graphics/pokemon/meganium/normal.pal @@ -11,9 +11,9 @@ JASC-PAL 139 222 49 16 16 16 255 255 255 -255 57 90 +205 32 57 123 16 57 246 164 156 -205 32 57 +255 57 90 205 205 205 106 106 106 diff --git a/graphics/pokemon/meloetta/icon.png b/graphics/pokemon/meloetta/icon.png index f640f80999ea..3c6099b5df0b 100644 Binary files a/graphics/pokemon/meloetta/icon.png and b/graphics/pokemon/meloetta/icon.png differ diff --git a/graphics/pokemon/meowth/anim_front.png b/graphics/pokemon/meowth/anim_front.png index b6ebbfab9a3a..ff750a7cb69c 100644 Binary files a/graphics/pokemon/meowth/anim_front.png and b/graphics/pokemon/meowth/anim_front.png differ diff --git a/graphics/pokemon/meowth/back.png b/graphics/pokemon/meowth/back.png index 7c87e642fdb4..acf5ae7c2068 100644 Binary files a/graphics/pokemon/meowth/back.png and b/graphics/pokemon/meowth/back.png differ diff --git a/graphics/pokemon/meowth/icon.png b/graphics/pokemon/meowth/icon.png index b721e3440e81..726382742052 100644 Binary files a/graphics/pokemon/meowth/icon.png and b/graphics/pokemon/meowth/icon.png differ diff --git a/graphics/pokemon/meowth/normal.pal b/graphics/pokemon/meowth/normal.pal index 13334947014e..f49558023e67 100644 --- a/graphics/pokemon/meowth/normal.pal +++ b/graphics/pokemon/meowth/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -152 104 0 -248 224 128 -16 16 16 +255 255 255 +230 230 230 +255 213 0 +205 164 0 148 90 0 -248 248 248 -248 208 0 -200 160 0 -192 120 8 -216 184 56 -216 216 216 255 115 82 -232 152 48 -148 65 0 213 90 57 -0 0 0 +16 16 16 +238 156 49 +197 123 8 +148 65 0 +255 255 180 +255 230 131 +222 189 57 +136 104 0 diff --git a/graphics/pokemon/meowth/shiny.pal b/graphics/pokemon/meowth/shiny.pal index 0aba58a22852..4c6c84229a9d 100644 --- a/graphics/pokemon/meowth/shiny.pal +++ b/graphics/pokemon/meowth/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -144 72 24 -255 205 131 +255 255 255 +230 230 230 +255 213 0 +205 164 0 +148 90 0 +255 115 82 +213 90 57 16 16 16 -136 72 24 -248 248 248 -248 208 0 -200 160 0 -208 88 112 -216 160 64 -224 224 224 -248 112 80 -248 128 144 +246 123 139 +213 82 106 172 41 57 -213 90 57 -0 0 0 +255 238 180 +255 205 131 +222 156 57 +156 65 0 diff --git a/graphics/pokemon/mesprit/icon.png b/graphics/pokemon/mesprit/icon.png index 2e5343d28541..dca7ab167be1 100644 Binary files a/graphics/pokemon/mesprit/icon.png and b/graphics/pokemon/mesprit/icon.png differ diff --git a/graphics/pokemon/metagross/mega/back.png b/graphics/pokemon/metagross/mega/back.png index 86c2b6e14565..90bae35eba06 100644 Binary files a/graphics/pokemon/metagross/mega/back.png and b/graphics/pokemon/metagross/mega/back.png differ diff --git a/graphics/pokemon/metagross/mega/front.png b/graphics/pokemon/metagross/mega/front.png index 1ebb0470aad1..4822f67b8252 100644 Binary files a/graphics/pokemon/metagross/mega/front.png and b/graphics/pokemon/metagross/mega/front.png differ diff --git a/graphics/pokemon/metang/icon.png b/graphics/pokemon/metang/icon.png index 8d27afff4f3f..e4ff2de81978 100644 Binary files a/graphics/pokemon/metang/icon.png and b/graphics/pokemon/metang/icon.png differ diff --git a/graphics/pokemon/metapod/anim_front.png b/graphics/pokemon/metapod/anim_front.png index ae952f0b0370..d5ebef9a6eff 100644 Binary files a/graphics/pokemon/metapod/anim_front.png and b/graphics/pokemon/metapod/anim_front.png differ diff --git a/graphics/pokemon/metapod/back.png b/graphics/pokemon/metapod/back.png index fbe5a68cc252..7649fae75d14 100644 Binary files a/graphics/pokemon/metapod/back.png and b/graphics/pokemon/metapod/back.png differ diff --git a/graphics/pokemon/metapod/normal.pal b/graphics/pokemon/metapod/normal.pal index 8bdd97c5e614..8147ad328986 100644 --- a/graphics/pokemon/metapod/normal.pal +++ b/graphics/pokemon/metapod/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -72 104 80 -176 224 80 -56 80 56 -128 192 72 -104 136 88 -0 0 0 -104 160 72 -248 248 248 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 +152 160 208 +57 74 65 +74 106 82 +106 139 90 +106 164 74 +131 197 74 +180 230 82 +255 0 255 +255 0 255 +255 0 255 +255 0 255 +255 0 255 +255 0 255 +255 0 255 +255 255 255 0 0 0 diff --git a/graphics/pokemon/metapod/shiny.pal b/graphics/pokemon/metapod/shiny.pal index bf33e8df691d..900c80de0e52 100644 --- a/graphics/pokemon/metapod/shiny.pal +++ b/graphics/pokemon/metapod/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -144 56 24 -248 168 120 -96 24 0 -248 112 56 -192 88 24 -16 16 16 -224 104 48 -248 248 248 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 +98 24 0 +148 57 24 +197 90 24 +230 106 49 +255 115 57 +255 172 123 +255 0 255 +255 0 255 +255 0 255 +255 0 255 +255 0 255 +255 0 255 +255 0 255 +255 255 255 0 0 0 diff --git a/graphics/pokemon/mew/anim_front.png b/graphics/pokemon/mew/anim_front.png index 8ce4efeb2147..6e794816c06e 100644 Binary files a/graphics/pokemon/mew/anim_front.png and b/graphics/pokemon/mew/anim_front.png differ diff --git a/graphics/pokemon/mew/icon.png b/graphics/pokemon/mew/icon.png index d4b6ec9a72ce..229cd355dfc1 100644 Binary files a/graphics/pokemon/mew/icon.png and b/graphics/pokemon/mew/icon.png differ diff --git a/graphics/pokemon/mewtwo/anim_front.png b/graphics/pokemon/mewtwo/anim_front.png index 149ec23227fe..ddd9997ad598 100644 Binary files a/graphics/pokemon/mewtwo/anim_front.png and b/graphics/pokemon/mewtwo/anim_front.png differ diff --git a/graphics/pokemon/mewtwo/icon.png b/graphics/pokemon/mewtwo/icon.png index b0dc901658c6..5a011283ae47 100644 Binary files a/graphics/pokemon/mewtwo/icon.png and b/graphics/pokemon/mewtwo/icon.png differ diff --git a/graphics/pokemon/mienfoo/icon.png b/graphics/pokemon/mienfoo/icon.png index e5c5367eeff7..cabf839e7471 100644 Binary files a/graphics/pokemon/mienfoo/icon.png and b/graphics/pokemon/mienfoo/icon.png differ diff --git a/graphics/pokemon/mienshao/icon.png b/graphics/pokemon/mienshao/icon.png index ff001b212fc4..9f1d14f8f928 100644 Binary files a/graphics/pokemon/mienshao/icon.png and b/graphics/pokemon/mienshao/icon.png differ diff --git a/graphics/pokemon/milotic/anim_front.png b/graphics/pokemon/milotic/anim_front.png index ac2450522d9c..56543bff7e62 100644 Binary files a/graphics/pokemon/milotic/anim_front.png and b/graphics/pokemon/milotic/anim_front.png differ diff --git a/graphics/pokemon/milotic/anim_frontf.png b/graphics/pokemon/milotic/anim_frontf.png new file mode 100644 index 000000000000..a7c8fe0c2b91 Binary files /dev/null and b/graphics/pokemon/milotic/anim_frontf.png differ diff --git a/graphics/pokemon/milotic/back.png b/graphics/pokemon/milotic/back.png index 74525da17889..98dadef06adf 100644 Binary files a/graphics/pokemon/milotic/back.png and b/graphics/pokemon/milotic/back.png differ diff --git a/graphics/pokemon/milotic/backf.png b/graphics/pokemon/milotic/backf.png new file mode 100644 index 000000000000..0519c4b01644 Binary files /dev/null and b/graphics/pokemon/milotic/backf.png differ diff --git a/graphics/pokemon/milotic/icon.png b/graphics/pokemon/milotic/icon.png index f67de29314da..3cd6b2f24eff 100644 Binary files a/graphics/pokemon/milotic/icon.png and b/graphics/pokemon/milotic/icon.png differ diff --git a/graphics/pokemon/mimikyu/busted/back.png b/graphics/pokemon/mimikyu/busted/back.png index 1d18044351be..e0b3719792cc 100644 Binary files a/graphics/pokemon/mimikyu/busted/back.png and b/graphics/pokemon/mimikyu/busted/back.png differ diff --git a/graphics/pokemon/mimikyu/busted/front.png b/graphics/pokemon/mimikyu/busted/front.png index 09e78fac9093..348495dc4453 100644 Binary files a/graphics/pokemon/mimikyu/busted/front.png and b/graphics/pokemon/mimikyu/busted/front.png differ diff --git a/graphics/pokemon/mimikyu/busted/icon.png b/graphics/pokemon/mimikyu/busted/icon.png index 3ba567ab3be3..46bc43005958 100644 Binary files a/graphics/pokemon/mimikyu/busted/icon.png and b/graphics/pokemon/mimikyu/busted/icon.png differ diff --git a/graphics/pokemon/minccino/back.png b/graphics/pokemon/minccino/back.png index 92eb266fd132..64cae43e63a5 100644 Binary files a/graphics/pokemon/minccino/back.png and b/graphics/pokemon/minccino/back.png differ diff --git a/graphics/pokemon/minccino/icon.png b/graphics/pokemon/minccino/icon.png index fbddf0e08a90..9c2c9b1ee43b 100644 Binary files a/graphics/pokemon/minccino/icon.png and b/graphics/pokemon/minccino/icon.png differ diff --git a/graphics/pokemon/minior/core/back.png b/graphics/pokemon/minior/core/back.png index af768d469c18..f93b5fd8fd05 100644 Binary files a/graphics/pokemon/minior/core/back.png and b/graphics/pokemon/minior/core/back.png differ diff --git a/graphics/pokemon/minior/core/blue/icon.png b/graphics/pokemon/minior/core/blue/icon.png index 0dbb8fe0e71d..85ee89151770 100644 Binary files a/graphics/pokemon/minior/core/blue/icon.png and b/graphics/pokemon/minior/core/blue/icon.png differ diff --git a/graphics/pokemon/minior/core/front.png b/graphics/pokemon/minior/core/front.png index ab7e8961565a..cf21d88dbc90 100644 Binary files a/graphics/pokemon/minior/core/front.png and b/graphics/pokemon/minior/core/front.png differ diff --git a/graphics/pokemon/minior/core/green/icon.png b/graphics/pokemon/minior/core/green/icon.png index dc36402deb0a..f724e86aeb85 100644 Binary files a/graphics/pokemon/minior/core/green/icon.png and b/graphics/pokemon/minior/core/green/icon.png differ diff --git a/graphics/pokemon/minior/core/indigo/icon.png b/graphics/pokemon/minior/core/indigo/icon.png index a27482ea1154..4f2e531cedba 100644 Binary files a/graphics/pokemon/minior/core/indigo/icon.png and b/graphics/pokemon/minior/core/indigo/icon.png differ diff --git a/graphics/pokemon/minior/core/orange/icon.png b/graphics/pokemon/minior/core/orange/icon.png index 6dea4aca6f32..40509d6b5116 100644 Binary files a/graphics/pokemon/minior/core/orange/icon.png and b/graphics/pokemon/minior/core/orange/icon.png differ diff --git a/graphics/pokemon/minior/core/violet/icon.png b/graphics/pokemon/minior/core/violet/icon.png index 609ace524c68..4392bdf3b9e2 100644 Binary files a/graphics/pokemon/minior/core/violet/icon.png and b/graphics/pokemon/minior/core/violet/icon.png differ diff --git a/graphics/pokemon/minior/core/yellow/icon.png b/graphics/pokemon/minior/core/yellow/icon.png index b0cfaa1c3985..f7dfb73362a7 100644 Binary files a/graphics/pokemon/minior/core/yellow/icon.png and b/graphics/pokemon/minior/core/yellow/icon.png differ diff --git a/graphics/pokemon/minun/back.png b/graphics/pokemon/minun/back.png index f8b11aba90b7..4e265d8cebac 100644 Binary files a/graphics/pokemon/minun/back.png and b/graphics/pokemon/minun/back.png differ diff --git a/graphics/pokemon/mismagius/icon.png b/graphics/pokemon/mismagius/icon.png index 07e075c1e88c..24e266e40a0c 100644 Binary files a/graphics/pokemon/mismagius/icon.png and b/graphics/pokemon/mismagius/icon.png differ diff --git a/graphics/pokemon/moltres/anim_front.png b/graphics/pokemon/moltres/anim_front.png index 15a0232230f9..99e0fdb3ac13 100644 Binary files a/graphics/pokemon/moltres/anim_front.png and b/graphics/pokemon/moltres/anim_front.png differ diff --git a/graphics/pokemon/moltres/icon.png b/graphics/pokemon/moltres/icon.png index 70de8545068f..51cefcbc4116 100644 Binary files a/graphics/pokemon/moltres/icon.png and b/graphics/pokemon/moltres/icon.png differ diff --git a/graphics/pokemon/monferno/icon.png b/graphics/pokemon/monferno/icon.png index 9fbfd125584f..6815b20f0f16 100644 Binary files a/graphics/pokemon/monferno/icon.png and b/graphics/pokemon/monferno/icon.png differ diff --git a/graphics/pokemon/mothim/anim_front.png b/graphics/pokemon/mothim/anim_front.png index 591ffd651232..96859ccb2834 100644 Binary files a/graphics/pokemon/mothim/anim_front.png and b/graphics/pokemon/mothim/anim_front.png differ diff --git a/graphics/pokemon/mothim/icon.png b/graphics/pokemon/mothim/icon.png index 33124586818e..c7302bff2e10 100644 Binary files a/graphics/pokemon/mothim/icon.png and b/graphics/pokemon/mothim/icon.png differ diff --git a/graphics/pokemon/mr_mime/anim_front.png b/graphics/pokemon/mr_mime/anim_front.png index 0b80ad02be5e..c4db5e51ec73 100644 Binary files a/graphics/pokemon/mr_mime/anim_front.png and b/graphics/pokemon/mr_mime/anim_front.png differ diff --git a/graphics/pokemon/mr_mime/back.png b/graphics/pokemon/mr_mime/back.png index b9e15eacf68d..8abdddba2809 100644 Binary files a/graphics/pokemon/mr_mime/back.png and b/graphics/pokemon/mr_mime/back.png differ diff --git a/graphics/pokemon/muk/anim_front.png b/graphics/pokemon/muk/anim_front.png index 8f78e22e91cf..0f9c23f51b91 100644 Binary files a/graphics/pokemon/muk/anim_front.png and b/graphics/pokemon/muk/anim_front.png differ diff --git a/graphics/pokemon/muk/icon.png b/graphics/pokemon/muk/icon.png index 3168d1be4642..f08bdb62bb55 100644 Binary files a/graphics/pokemon/muk/icon.png and b/graphics/pokemon/muk/icon.png differ diff --git a/graphics/pokemon/munna/icon.png b/graphics/pokemon/munna/icon.png index c97d44e6d62c..2a2cba657c09 100644 Binary files a/graphics/pokemon/munna/icon.png and b/graphics/pokemon/munna/icon.png differ diff --git a/graphics/pokemon/murkrow/anim_frontf.png b/graphics/pokemon/murkrow/anim_frontf.png new file mode 100644 index 000000000000..8981a26774f4 Binary files /dev/null and b/graphics/pokemon/murkrow/anim_frontf.png differ diff --git a/graphics/pokemon/murkrow/backf.png b/graphics/pokemon/murkrow/backf.png new file mode 100644 index 000000000000..fe946114d378 Binary files /dev/null and b/graphics/pokemon/murkrow/backf.png differ diff --git a/graphics/pokemon/musharna/icon.png b/graphics/pokemon/musharna/icon.png index c51d8ade6462..54927f674249 100644 Binary files a/graphics/pokemon/musharna/icon.png and b/graphics/pokemon/musharna/icon.png differ diff --git a/graphics/pokemon/natu/anim_front.png b/graphics/pokemon/natu/anim_front.png index 8ac7b53c0243..10c3f6936577 100644 Binary files a/graphics/pokemon/natu/anim_front.png and b/graphics/pokemon/natu/anim_front.png differ diff --git a/graphics/pokemon/necrozma/dawn_wings/back.png b/graphics/pokemon/necrozma/dawn_wings/back.png index be258fb089c2..24bb31694717 100644 Binary files a/graphics/pokemon/necrozma/dawn_wings/back.png and b/graphics/pokemon/necrozma/dawn_wings/back.png differ diff --git a/graphics/pokemon/necrozma/dawn_wings/front.png b/graphics/pokemon/necrozma/dawn_wings/front.png index a5c75ea2b5b7..7b433277dce6 100644 Binary files a/graphics/pokemon/necrozma/dawn_wings/front.png and b/graphics/pokemon/necrozma/dawn_wings/front.png differ diff --git a/graphics/pokemon/necrozma/dawn_wings/icon.png b/graphics/pokemon/necrozma/dawn_wings/icon.png index c5fde92c441b..25d24cb024eb 100644 Binary files a/graphics/pokemon/necrozma/dawn_wings/icon.png and b/graphics/pokemon/necrozma/dawn_wings/icon.png differ diff --git a/graphics/pokemon/necrozma/dusk_mane/back.png b/graphics/pokemon/necrozma/dusk_mane/back.png index 96621697c5d4..b5843a6a6e11 100644 Binary files a/graphics/pokemon/necrozma/dusk_mane/back.png and b/graphics/pokemon/necrozma/dusk_mane/back.png differ diff --git a/graphics/pokemon/necrozma/dusk_mane/front.png b/graphics/pokemon/necrozma/dusk_mane/front.png index f2b88ee0c565..b0cef6ecdfb7 100644 Binary files a/graphics/pokemon/necrozma/dusk_mane/front.png and b/graphics/pokemon/necrozma/dusk_mane/front.png differ diff --git a/graphics/pokemon/necrozma/dusk_mane/icon.png b/graphics/pokemon/necrozma/dusk_mane/icon.png index e0e4ef479e9e..c188b1e3ca04 100644 Binary files a/graphics/pokemon/necrozma/dusk_mane/icon.png and b/graphics/pokemon/necrozma/dusk_mane/icon.png differ diff --git a/graphics/pokemon/necrozma/ultra/back.png b/graphics/pokemon/necrozma/ultra/back.png index 1dcdc3835c09..b5a63acaa56d 100644 Binary files a/graphics/pokemon/necrozma/ultra/back.png and b/graphics/pokemon/necrozma/ultra/back.png differ diff --git a/graphics/pokemon/necrozma/ultra/front.png b/graphics/pokemon/necrozma/ultra/front.png index 0eac6b0fe58e..dca2cdfdaca4 100644 Binary files a/graphics/pokemon/necrozma/ultra/front.png and b/graphics/pokemon/necrozma/ultra/front.png differ diff --git a/graphics/pokemon/necrozma/ultra/icon.png b/graphics/pokemon/necrozma/ultra/icon.png index 8adcbb3f53b3..1c63345bc858 100644 Binary files a/graphics/pokemon/necrozma/ultra/icon.png and b/graphics/pokemon/necrozma/ultra/icon.png differ diff --git a/graphics/pokemon/nidoking/anim_front.png b/graphics/pokemon/nidoking/anim_front.png index 79d0a35426e8..a08514474997 100644 Binary files a/graphics/pokemon/nidoking/anim_front.png and b/graphics/pokemon/nidoking/anim_front.png differ diff --git a/graphics/pokemon/nidoking/back.png b/graphics/pokemon/nidoking/back.png index cad43a47d643..6291e963e107 100644 Binary files a/graphics/pokemon/nidoking/back.png and b/graphics/pokemon/nidoking/back.png differ diff --git a/graphics/pokemon/nidoking/icon.png b/graphics/pokemon/nidoking/icon.png index 93d0b5f80e5f..131f02bb5537 100644 Binary files a/graphics/pokemon/nidoking/icon.png and b/graphics/pokemon/nidoking/icon.png differ diff --git a/graphics/pokemon/nidoking/normal.pal b/graphics/pokemon/nidoking/normal.pal index 84b8d0f6c69a..e78c26819fd4 100644 --- a/graphics/pokemon/nidoking/normal.pal +++ b/graphics/pokemon/nidoking/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -90 41 106 -222 148 246 -16 16 16 -213 115 238 -164 82 148 -41 123 148 -0 74 98 -65 148 197 255 255 255 +230 230 213 197 197 164 -172 16 0 115 115 90 230 65 49 -230 230 213 -232 232 216 +172 16 0 +197 115 189 +64 144 192 +40 120 144 +0 72 96 +216 144 240 +213 115 238 +164 82 148 +90 41 106 +16 16 16 diff --git a/graphics/pokemon/nidoking/shiny.pal b/graphics/pokemon/nidoking/shiny.pal index e4d7cdea6ffb..201c7fcc706e 100644 --- a/graphics/pokemon/nidoking/shiny.pal +++ b/graphics/pokemon/nidoking/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -40 80 128 -160 240 248 +255 255 255 +230 213 213 +197 180 164 +115 98 90 +230 65 49 +172 16 0 +197 115 189 +189 148 74 +148 98 32 +115 74 0 +139 238 255 +90 189 255 +56 136 200 +24 82 156 16 16 16 -112 192 248 -72 144 200 -144 104 40 -96 72 16 -184 152 88 -248 248 248 -192 176 160 -168 40 32 -112 96 88 -224 80 72 -248 232 232 -224 208 208 diff --git a/graphics/pokemon/nidoqueen/anim_front.png b/graphics/pokemon/nidoqueen/anim_front.png index 0f69643ebb62..58c6901a7b05 100644 Binary files a/graphics/pokemon/nidoqueen/anim_front.png and b/graphics/pokemon/nidoqueen/anim_front.png differ diff --git a/graphics/pokemon/nidoqueen/back.png b/graphics/pokemon/nidoqueen/back.png index 90a8cca1cd22..243b801a00e8 100644 Binary files a/graphics/pokemon/nidoqueen/back.png and b/graphics/pokemon/nidoqueen/back.png differ diff --git a/graphics/pokemon/nidoqueen/normal.pal b/graphics/pokemon/nidoqueen/normal.pal index 3901338e3740..fbc98e54c5d6 100644 --- a/graphics/pokemon/nidoqueen/normal.pal +++ b/graphics/pokemon/nidoqueen/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -98 139 172 +255 255 255 +208 200 200 +238 230 164 +230 205 139 +192 168 88 +115 90 41 +255 156 139 +200 104 104 +160 40 64 +222 255 255 +156 213 222 90 180 205 +98 139 172 49 74 74 16 16 16 -189 172 90 -115 90 41 -115 90 41 -156 213 222 -208 208 208 -248 248 248 -189 172 90 -230 205 139 -238 230 164 -112 40 40 -232 128 120 diff --git a/graphics/pokemon/nidoqueen/shiny.pal b/graphics/pokemon/nidoqueen/shiny.pal index 08199f12a230..3af2e0347d65 100644 --- a/graphics/pokemon/nidoqueen/shiny.pal +++ b/graphics/pokemon/nidoqueen/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -104 120 48 -136 160 80 -56 72 8 +152 160 208 +255 255 255 +213 213 213 +246 205 213 +255 172 180 +230 131 148 +189 90 98 +255 156 139 +230 65 49 +172 16 0 +222 246 172 +197 222 123 +131 164 65 +106 123 41 +57 74 0 16 16 16 -224 128 144 -136 64 72 -184 88 96 -200 216 144 -208 208 208 -248 248 248 -224 136 152 -248 168 176 -240 200 208 -168 44 32 -240 124 112 diff --git a/graphics/pokemon/nidoran_f/anim_front.png b/graphics/pokemon/nidoran_f/anim_front.png index 8261f4d77368..a097c3a49e2d 100644 Binary files a/graphics/pokemon/nidoran_f/anim_front.png and b/graphics/pokemon/nidoran_f/anim_front.png differ diff --git a/graphics/pokemon/nidoran_f/back.png b/graphics/pokemon/nidoran_f/back.png index 601a2ecdd146..95e0c30e5821 100644 Binary files a/graphics/pokemon/nidoran_f/back.png and b/graphics/pokemon/nidoran_f/back.png differ diff --git a/graphics/pokemon/nidoran_f/normal.pal b/graphics/pokemon/nidoran_f/normal.pal index 6f2e8898b310..b90fb5570f2a 100644 --- a/graphics/pokemon/nidoran_f/normal.pal +++ b/graphics/pokemon/nidoran_f/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -115 131 172 -90 65 131 -172 172 205 -213 213 255 -52 109 179 -65 139 230 -16 16 16 -248 248 248 -189 49 74 238 238 255 +213 213 255 +172 172 205 +115 131 172 +64 64 128 255 82 65 +189 49 74 +24 152 144 +82 139 180 +57 106 148 +255 0 255 +255 0 255 +255 255 255 222 222 222 -0 0 0 -0 0 0 -0 0 0 +16 16 16 diff --git a/graphics/pokemon/nidoran_f/shiny.pal b/graphics/pokemon/nidoran_f/shiny.pal index 7c10b617d010..722554334a1d 100644 --- a/graphics/pokemon/nidoran_f/shiny.pal +++ b/graphics/pokemon/nidoran_f/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -152 104 168 -112 40 128 -184 144 192 -224 184 232 -64 96 0 -112 144 16 +208 208 160 +238 222 255 +230 189 238 +189 148 197 +156 106 172 +115 41 131 +255 82 65 +189 49 74 +115 148 16 +90 123 8 +65 98 0 +255 0 255 +255 0 255 +255 255 255 +222 222 222 16 16 16 -248 248 248 -160 40 32 -232 232 248 -248 80 64 -216 216 216 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/pokemon/nidoran_m/anim_front.png b/graphics/pokemon/nidoran_m/anim_front.png index 5f0990c40292..6dea62a97110 100644 Binary files a/graphics/pokemon/nidoran_m/anim_front.png and b/graphics/pokemon/nidoran_m/anim_front.png differ diff --git a/graphics/pokemon/nidoran_m/back.png b/graphics/pokemon/nidoran_m/back.png index 2be290922ad1..0b72bd73dab6 100644 Binary files a/graphics/pokemon/nidoran_m/back.png and b/graphics/pokemon/nidoran_m/back.png differ diff --git a/graphics/pokemon/nidoran_m/normal.pal b/graphics/pokemon/nidoran_m/normal.pal index 711acdb79fea..3261195baca0 100644 --- a/graphics/pokemon/nidoran_m/normal.pal +++ b/graphics/pokemon/nidoran_m/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -189 98 197 -230 156 213 -98 65 106 +152 160 208 +255 255 255 16 16 16 -238 189 238 -0 98 65 -0 164 115 -205 205 205 255 106 82 -255 255 255 222 65 41 -176 24 0 -0 0 0 -0 0 0 -0 0 0 +180 24 0 +24 205 156 +0 164 115 +0 98 65 +152 72 168 +238 189 238 +230 156 213 +189 98 197 +98 65 106 +205 205 205 +131 131 131 diff --git a/graphics/pokemon/nidoran_m/shiny.pal b/graphics/pokemon/nidoran_m/shiny.pal index 843ad1eaf8af..da856f827dee 100644 --- a/graphics/pokemon/nidoran_m/shiny.pal +++ b/graphics/pokemon/nidoran_m/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -144 160 200 -176 200 248 -72 88 152 +255 255 255 16 16 16 -208 224 248 -120 56 40 -144 104 64 -200 200 200 -248 104 80 -248 248 248 -216 40 56 -0 0 0 -0 0 0 -0 0 0 -0 0 0 +255 106 82 +222 65 41 +180 24 0 +180 123 90 +139 90 49 +123 49 32 +120 136 200 +213 230 255 +180 205 255 +148 164 205 +74 90 156 +205 205 205 +131 131 131 diff --git a/graphics/pokemon/nidorina/anim_front.png b/graphics/pokemon/nidorina/anim_front.png index 51ba5cb07041..2759f85b5ee8 100644 Binary files a/graphics/pokemon/nidorina/anim_front.png and b/graphics/pokemon/nidorina/anim_front.png differ diff --git a/graphics/pokemon/nidorina/back.png b/graphics/pokemon/nidorina/back.png index 88bcaf5dbaee..c17843af534b 100644 Binary files a/graphics/pokemon/nidorina/back.png and b/graphics/pokemon/nidorina/back.png differ diff --git a/graphics/pokemon/nidorina/normal.pal b/graphics/pokemon/nidorina/normal.pal index bab15d82f2ad..e49d1f4514b9 100644 --- a/graphics/pokemon/nidorina/normal.pal +++ b/graphics/pokemon/nidorina/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -153 210 164 -90 148 180 -197 230 238 -57 90 98 -16 16 16 -139 197 205 -24 57 115 -55 95 176 -72 128 240 +152 208 160 255 255 255 -214 214 214 -197 32 16 +213 213 213 +131 131 131 +74 131 246 +16 98 180 +24 57 115 255 156 139 238 74 57 -131 131 131 -0 0 0 +197 32 16 +222 255 255 +197 230 238 +139 197 205 +90 148 180 +57 90 98 +16 16 16 diff --git a/graphics/pokemon/nidorina/shiny.pal b/graphics/pokemon/nidorina/shiny.pal index ee67585e0384..d259eff81a60 100644 --- a/graphics/pokemon/nidorina/shiny.pal +++ b/graphics/pokemon/nidorina/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -153 210 164 -178 116 166 -255 198 247 -98 82 90 -16 16 16 -204 157 197 -40 73 14 -65 106 16 -93 131 40 +152 160 208 255 255 255 -214 214 214 -197 32 16 -255 156 140 -238 74 57 +213 213 213 131 131 131 -0 0 0 +90 131 32 +65 106 16 +32 74 0 +255 156 139 +238 74 57 +197 32 16 +255 238 246 +238 222 230 +205 148 197 +180 106 164 +98 82 90 +16 16 16 diff --git a/graphics/pokemon/nidorino/anim_front.png b/graphics/pokemon/nidorino/anim_front.png index 9fd1786bc33f..94847a3c937c 100644 Binary files a/graphics/pokemon/nidorino/anim_front.png and b/graphics/pokemon/nidorino/anim_front.png differ diff --git a/graphics/pokemon/nidorino/back.png b/graphics/pokemon/nidorino/back.png index a7078074e43c..1b1a13d47e9b 100644 Binary files a/graphics/pokemon/nidorino/back.png and b/graphics/pokemon/nidorino/back.png differ diff --git a/graphics/pokemon/nidorino/normal.pal b/graphics/pokemon/nidorino/normal.pal index a668ac118cf8..b6d01ea679ab 100644 --- a/graphics/pokemon/nidorino/normal.pal +++ b/graphics/pokemon/nidorino/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -90 57 98 -205 131 222 +152 160 208 +255 255 255 +255 106 82 +222 65 41 +180 24 0 +57 238 189 +74 205 164 +0 148 98 +128 88 80 16 16 16 230 172 238 +205 131 222 148 90 180 -0 148 98 -74 205 164 -248 248 248 -128 128 128 -192 192 192 -144 88 176 -168 40 40 -232 128 120 -0 0 0 -0 0 0 +90 57 98 +197 197 197 +131 131 131 diff --git a/graphics/pokemon/nidorino/shiny.pal b/graphics/pokemon/nidorino/shiny.pal index 4c4ca0cc257e..aaa9beee95b1 100644 --- a/graphics/pokemon/nidorino/shiny.pal +++ b/graphics/pokemon/nidorino/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -64 72 136 -168 176 240 -16 16 16 -208 208 248 -128 120 176 -104 56 80 +255 255 255 +255 106 82 +222 65 41 +180 24 0 +180 131 156 +148 98 123 +106 57 82 144 96 120 -248 248 248 -128 128 128 -192 192 192 -64 72 136 -178 70 53 -247 127 111 -0 0 0 -0 0 0 +16 16 16 +213 213 255 +172 180 246 +131 123 189 +65 74 139 +197 197 197 +131 131 131 diff --git a/graphics/pokemon/ninetales/anim_front.png b/graphics/pokemon/ninetales/anim_front.png index 2959ce9fe588..3cc6d2db5de6 100644 Binary files a/graphics/pokemon/ninetales/anim_front.png and b/graphics/pokemon/ninetales/anim_front.png differ diff --git a/graphics/pokemon/ninetales/back.png b/graphics/pokemon/ninetales/back.png index 507b278595de..247f7ad87c4f 100644 Binary files a/graphics/pokemon/ninetales/back.png and b/graphics/pokemon/ninetales/back.png differ diff --git a/graphics/pokemon/ninetales/normal.pal b/graphics/pokemon/ninetales/normal.pal index 021c1577538e..0153dceb7395 100644 --- a/graphics/pokemon/ninetales/normal.pal +++ b/graphics/pokemon/ninetales/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 +255 255 255 +255 106 41 +222 32 16 +180 16 0 +255 0 255 +248 160 56 +232 128 40 +238 222 115 +205 156 98 +255 238 180 +246 230 123 +230 197 82 205 156 74 131 98 24 -246 230 123 16 16 16 -230 197 82 -180 16 0 -255 255 255 -255 106 41 -255 172 49 -255 148 16 -168 16 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/pokemon/ninetales/shiny.pal b/graphics/pokemon/ninetales/shiny.pal index dc02c553bc2e..7a30db18a22d 100644 --- a/graphics/pokemon/ninetales/shiny.pal +++ b/graphics/pokemon/ninetales/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -152 128 168 -120 88 128 -216 216 224 +255 255 255 +255 106 41 +222 32 16 +180 16 0 +255 0 255 +148 172 230 +98 156 255 +238 222 115 +205 156 98 +246 238 255 +222 222 230 +189 180 205 +156 131 172 +123 90 131 16 16 16 -184 176 200 -176 40 32 -248 248 248 -248 120 64 -144 168 224 -96 152 248 -175 79 70 -0 0 0 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/pokemon/noctowl/anim_front.png b/graphics/pokemon/noctowl/anim_front.png index 751b21e93163..fbcdc69e7ae8 100644 Binary files a/graphics/pokemon/noctowl/anim_front.png and b/graphics/pokemon/noctowl/anim_front.png differ diff --git a/graphics/pokemon/nosepass/anim_front.png b/graphics/pokemon/nosepass/anim_front.png index accd29014787..5513a040c99c 100644 Binary files a/graphics/pokemon/nosepass/anim_front.png and b/graphics/pokemon/nosepass/anim_front.png differ diff --git a/graphics/pokemon/numel/anim_front.png b/graphics/pokemon/numel/anim_front.png index b94c34a1aebe..1cea61e9932d 100644 Binary files a/graphics/pokemon/numel/anim_front.png and b/graphics/pokemon/numel/anim_front.png differ diff --git a/graphics/pokemon/numel/anim_frontf.png b/graphics/pokemon/numel/anim_frontf.png new file mode 100644 index 000000000000..6ef4e7954110 Binary files /dev/null and b/graphics/pokemon/numel/anim_frontf.png differ diff --git a/graphics/pokemon/numel/back.png b/graphics/pokemon/numel/back.png index 26ab257b4158..a631f1c2a9e2 100644 Binary files a/graphics/pokemon/numel/back.png and b/graphics/pokemon/numel/back.png differ diff --git a/graphics/pokemon/numel/backf.png b/graphics/pokemon/numel/backf.png new file mode 100644 index 000000000000..e895fefbb02d Binary files /dev/null and b/graphics/pokemon/numel/backf.png differ diff --git a/graphics/pokemon/nuzleaf/anim_front.png b/graphics/pokemon/nuzleaf/anim_front.png index 796a50b3144f..c1327b4357ba 100644 Binary files a/graphics/pokemon/nuzleaf/anim_front.png and b/graphics/pokemon/nuzleaf/anim_front.png differ diff --git a/graphics/pokemon/nuzleaf/anim_frontf.png b/graphics/pokemon/nuzleaf/anim_frontf.png new file mode 100644 index 000000000000..73cd1bbe30f3 Binary files /dev/null and b/graphics/pokemon/nuzleaf/anim_frontf.png differ diff --git a/graphics/pokemon/nuzleaf/backf.png b/graphics/pokemon/nuzleaf/backf.png new file mode 100644 index 000000000000..2fa63c61c8ae Binary files /dev/null and b/graphics/pokemon/nuzleaf/backf.png differ diff --git a/graphics/pokemon/octillery/anim_frontf.png b/graphics/pokemon/octillery/anim_frontf.png new file mode 100644 index 000000000000..ab94a95cc88d Binary files /dev/null and b/graphics/pokemon/octillery/anim_frontf.png differ diff --git a/graphics/pokemon/octillery/backf.png b/graphics/pokemon/octillery/backf.png new file mode 100644 index 000000000000..9bc3b37886b5 Binary files /dev/null and b/graphics/pokemon/octillery/backf.png differ diff --git a/graphics/pokemon/oddish/anim_front.png b/graphics/pokemon/oddish/anim_front.png index 9634703b10ff..8b82826b84a1 100644 Binary files a/graphics/pokemon/oddish/anim_front.png and b/graphics/pokemon/oddish/anim_front.png differ diff --git a/graphics/pokemon/oddish/back.png b/graphics/pokemon/oddish/back.png index 7d96a680fa93..63e8d68512d4 100644 Binary files a/graphics/pokemon/oddish/back.png and b/graphics/pokemon/oddish/back.png differ diff --git a/graphics/pokemon/oddish/icon.png b/graphics/pokemon/oddish/icon.png index bef94316f2fb..232b704e024e 100644 Binary files a/graphics/pokemon/oddish/icon.png and b/graphics/pokemon/oddish/icon.png differ diff --git a/graphics/pokemon/oddish/normal.pal b/graphics/pokemon/oddish/normal.pal index 30c3a26452fe..7458d45c1f50 100644 --- a/graphics/pokemon/oddish/normal.pal +++ b/graphics/pokemon/oddish/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -248 192 192 +208 208 160 +255 255 255 +180 41 49 +238 57 49 +197 230 123 +156 213 74 139 172 49 74 90 32 -156 213 74 -197 230 123 -16 16 16 -90 106 131 -115 148 164 +255 0 255 +255 0 255 +255 0 255 148 180 197 -238 57 49 +115 148 164 +90 106 131 41 57 74 -178 92 121 -214 149 172 -0 0 0 -0 0 0 -0 0 0 +16 16 16 diff --git a/graphics/pokemon/oddish/shiny.pal b/graphics/pokemon/oddish/shiny.pal index f62a3b4a403a..a524e2b16cca 100644 --- a/graphics/pokemon/oddish/shiny.pal +++ b/graphics/pokemon/oddish/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -153 210 164 -146 188 56 -104 130 26 -191 229 78 -219 244 144 +152 160 208 +255 255 255 +180 41 49 +238 57 49 +222 255 123 +197 246 57 +148 197 49 +98 131 0 +255 0 255 +255 0 255 +255 0 255 +139 246 65 +90 197 0 +57 148 0 +16 98 0 16 16 16 -76 147 29 -112 196 39 -154 226 81 -224 72 64 -32 96 19 -234 72 60 -255 136 132 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/pokemon/omanyte/anim_front.png b/graphics/pokemon/omanyte/anim_front.png index 9a51401e8de3..9135a7cc9047 100644 Binary files a/graphics/pokemon/omanyte/anim_front.png and b/graphics/pokemon/omanyte/anim_front.png differ diff --git a/graphics/pokemon/onix/anim_front.png b/graphics/pokemon/onix/anim_front.png index ea35bcfc9b81..6aab94e97fbb 100644 Binary files a/graphics/pokemon/onix/anim_front.png and b/graphics/pokemon/onix/anim_front.png differ diff --git a/graphics/pokemon/onix/icon.png b/graphics/pokemon/onix/icon.png index b4de2a1cd226..0d17f7241182 100644 Binary files a/graphics/pokemon/onix/icon.png and b/graphics/pokemon/onix/icon.png differ diff --git a/graphics/pokemon/oricorio/pau/back.png b/graphics/pokemon/oricorio/pau/back.png index 7969b5019f8d..2f860442a51b 100644 Binary files a/graphics/pokemon/oricorio/pau/back.png and b/graphics/pokemon/oricorio/pau/back.png differ diff --git a/graphics/pokemon/oricorio/pau/front.png b/graphics/pokemon/oricorio/pau/front.png index 004b8cc9cc87..c1c47492a8e0 100644 Binary files a/graphics/pokemon/oricorio/pau/front.png and b/graphics/pokemon/oricorio/pau/front.png differ diff --git a/graphics/pokemon/oricorio/pau/icon.png b/graphics/pokemon/oricorio/pau/icon.png index c3353a92493b..98040bf38dd0 100644 Binary files a/graphics/pokemon/oricorio/pau/icon.png and b/graphics/pokemon/oricorio/pau/icon.png differ diff --git a/graphics/pokemon/oricorio/pom_pom/back.png b/graphics/pokemon/oricorio/pom_pom/back.png index f6f22ae1be88..f307c41f0399 100644 Binary files a/graphics/pokemon/oricorio/pom_pom/back.png and b/graphics/pokemon/oricorio/pom_pom/back.png differ diff --git a/graphics/pokemon/oricorio/pom_pom/front.png b/graphics/pokemon/oricorio/pom_pom/front.png index 5ed6c71b5611..c57283440cc2 100644 Binary files a/graphics/pokemon/oricorio/pom_pom/front.png and b/graphics/pokemon/oricorio/pom_pom/front.png differ diff --git a/graphics/pokemon/oricorio/pom_pom/icon.png b/graphics/pokemon/oricorio/pom_pom/icon.png index 9f83917ba16f..b60855f9188f 100644 Binary files a/graphics/pokemon/oricorio/pom_pom/icon.png and b/graphics/pokemon/oricorio/pom_pom/icon.png differ diff --git a/graphics/pokemon/oricorio/sensu/back.png b/graphics/pokemon/oricorio/sensu/back.png index 25ed57b0cd41..f2a372c64d49 100644 Binary files a/graphics/pokemon/oricorio/sensu/back.png and b/graphics/pokemon/oricorio/sensu/back.png differ diff --git a/graphics/pokemon/oricorio/sensu/front.png b/graphics/pokemon/oricorio/sensu/front.png index 5abc5e547ef1..4a9994c97e28 100644 Binary files a/graphics/pokemon/oricorio/sensu/front.png and b/graphics/pokemon/oricorio/sensu/front.png differ diff --git a/graphics/pokemon/oricorio/sensu/icon.png b/graphics/pokemon/oricorio/sensu/icon.png index 9828bb2067e4..b8423c31fc13 100644 Binary files a/graphics/pokemon/oricorio/sensu/icon.png and b/graphics/pokemon/oricorio/sensu/icon.png differ diff --git a/graphics/pokemon/oshawott/anim_front.png b/graphics/pokemon/oshawott/anim_front.png index d1fbab7f97f6..9fb481088722 100644 Binary files a/graphics/pokemon/oshawott/anim_front.png and b/graphics/pokemon/oshawott/anim_front.png differ diff --git a/graphics/pokemon/pachirisu/anim_frontf.png b/graphics/pokemon/pachirisu/anim_frontf.png new file mode 100644 index 000000000000..55d20e4922e2 Binary files /dev/null and b/graphics/pokemon/pachirisu/anim_frontf.png differ diff --git a/graphics/pokemon/palkia/icon.png b/graphics/pokemon/palkia/icon.png index 1476f20af5f8..e371dd2a6a6d 100644 Binary files a/graphics/pokemon/palkia/icon.png and b/graphics/pokemon/palkia/icon.png differ diff --git a/graphics/pokemon/paras/anim_front.png b/graphics/pokemon/paras/anim_front.png index 3b00df10a2b8..b22fccb1484f 100644 Binary files a/graphics/pokemon/paras/anim_front.png and b/graphics/pokemon/paras/anim_front.png differ diff --git a/graphics/pokemon/paras/back.png b/graphics/pokemon/paras/back.png index 8e22aadc51bd..34c882480fa8 100644 Binary files a/graphics/pokemon/paras/back.png and b/graphics/pokemon/paras/back.png differ diff --git a/graphics/pokemon/paras/icon.png b/graphics/pokemon/paras/icon.png index 6bc817d0be64..8371252b4a5b 100644 Binary files a/graphics/pokemon/paras/icon.png and b/graphics/pokemon/paras/icon.png differ diff --git a/graphics/pokemon/paras/normal.pal b/graphics/pokemon/paras/normal.pal index 08c060f7a121..731359747e04 100644 --- a/graphics/pokemon/paras/normal.pal +++ b/graphics/pokemon/paras/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -189 65 65 -98 41 41 -246 106 106 -197 180 32 -255 213 82 -16 16 16 -112 72 24 -57 41 16 -230 131 41 -255 246 255 -180 98 32 -255 172 98 +255 247 255 +206 206 206 90 90 90 -205 205 205 -164 164 205 +255 214 82 +197 181 33 +247 107 107 +189 66 66 +99 41 41 +165 165 206 +255 173 99 +230 132 41 +181 99 33 +115 74 25 +58 41 16 +16 16 16 diff --git a/graphics/pokemon/paras/shiny.pal b/graphics/pokemon/paras/shiny.pal index d5b733479a1e..9a99b14b8001 100644 --- a/graphics/pokemon/paras/shiny.pal +++ b/graphics/pokemon/paras/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -224 56 80 -152 16 40 -248 120 144 -192 176 32 -248 208 80 +255 247 255 +206 206 206 +90 90 90 +255 247 90 +206 189 33 +255 123 148 +230 58 82 +156 0 25 +165 165 206 +255 132 58 +239 82 25 +197 49 33 +107 41 16 +58 33 8 16 16 16 -104 40 16 -56 32 8 -224 96 48 -255 246 255 -176 48 40 -240 144 96 -88 88 88 -248 240 248 -200 200 200 diff --git a/graphics/pokemon/parasect/anim_front.png b/graphics/pokemon/parasect/anim_front.png index f424edf0c331..963b1485a175 100644 Binary files a/graphics/pokemon/parasect/anim_front.png and b/graphics/pokemon/parasect/anim_front.png differ diff --git a/graphics/pokemon/parasect/back.png b/graphics/pokemon/parasect/back.png index 0f082d8ece46..3a5d5a806953 100644 Binary files a/graphics/pokemon/parasect/back.png and b/graphics/pokemon/parasect/back.png differ diff --git a/graphics/pokemon/parasect/icon.png b/graphics/pokemon/parasect/icon.png index 27b8e098932c..2af90ddcc8f4 100644 Binary files a/graphics/pokemon/parasect/icon.png and b/graphics/pokemon/parasect/icon.png differ diff --git a/graphics/pokemon/parasect/normal.pal b/graphics/pokemon/parasect/normal.pal index 0d82fc25c7a3..9aec34687b65 100644 --- a/graphics/pokemon/parasect/normal.pal +++ b/graphics/pokemon/parasect/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -120 8 8 -248 104 104 -240 48 48 -248 208 80 +255 246 255 +213 213 213 +156 139 164 +255 213 82 +213 205 49 +255 106 106 +238 49 49 +189 49 65 +123 8 8 +255 0 255 +255 131 82 +222 106 49 +180 65 57 +98 16 0 16 16 16 -240 152 152 -208 200 48 -192 48 64 -96 16 0 -176 64 56 -248 240 248 -216 104 48 -208 208 208 -152 136 160 -0 0 0 diff --git a/graphics/pokemon/parasect/shiny.pal b/graphics/pokemon/parasect/shiny.pal index ef2a4d63f719..a2ea6ecd906a 100644 --- a/graphics/pokemon/parasect/shiny.pal +++ b/graphics/pokemon/parasect/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -120 64 8 -248 168 96 -232 136 48 -248 208 80 +255 246 255 +213 213 213 +156 139 164 +255 213 82 +213 205 49 +255 172 98 +238 139 49 +180 98 49 +123 65 8 +255 0 255 +255 197 82 +222 164 49 +172 106 65 +98 57 0 16 16 16 -248 192 80 -208 200 48 -176 96 48 -96 56 16 -168 112 80 -248 240 248 -216 168 72 -208 208 208 -152 136 160 -0 0 0 diff --git a/graphics/pokemon/pelipper/icon.png b/graphics/pokemon/pelipper/icon.png index 49debae71774..d50da0bbbd0b 100644 Binary files a/graphics/pokemon/pelipper/icon.png and b/graphics/pokemon/pelipper/icon.png differ diff --git a/graphics/pokemon/persian/anim_front.png b/graphics/pokemon/persian/anim_front.png index ed960deab5b5..72e34fad1367 100644 Binary files a/graphics/pokemon/persian/anim_front.png and b/graphics/pokemon/persian/anim_front.png differ diff --git a/graphics/pokemon/persian/back.png b/graphics/pokemon/persian/back.png index 1ec5e999399f..9dc29f554b5b 100644 Binary files a/graphics/pokemon/persian/back.png and b/graphics/pokemon/persian/back.png differ diff --git a/graphics/pokemon/persian/normal.pal b/graphics/pokemon/persian/normal.pal index 073415db2d01..02c30235ba29 100644 --- a/graphics/pokemon/persian/normal.pal +++ b/graphics/pokemon/persian/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 +255 255 255 +222 222 222 16 16 16 -128 80 0 -144 120 32 -216 176 104 -184 160 72 -176 128 40 -248 224 128 -240 80 64 -248 248 248 -248 184 152 -160 16 0 -216 216 216 -248 248 168 -136 0 0 -232 64 48 +255 189 156 +246 82 65 +164 16 0 +189 164 74 +148 123 32 +115 90 16 +255 0 255 +255 255 172 +255 230 131 +222 180 106 +180 131 41 +131 82 0 diff --git a/graphics/pokemon/persian/shiny.pal b/graphics/pokemon/persian/shiny.pal index ba2fdc3fecd2..0fe2913277bd 100644 --- a/graphics/pokemon/persian/shiny.pal +++ b/graphics/pokemon/persian/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 +255 255 255 +222 222 222 16 16 16 -120 96 16 -208 136 136 -232 200 128 -240 184 184 -168 144 48 -248 240 144 -240 96 88 -248 248 248 -248 184 152 -160 40 32 -216 216 216 -248 248 200 -163 43 32 -244 103 90 +255 189 156 +246 82 65 +164 16 0 +255 180 180 +238 131 131 +222 98 98 +255 0 255 +255 255 205 +255 246 148 +238 205 131 +189 156 49 +139 106 8 diff --git a/graphics/pokemon/phanpy/back.png b/graphics/pokemon/phanpy/back.png index a46f6d774952..97f7cfc0ca15 100644 Binary files a/graphics/pokemon/phanpy/back.png and b/graphics/pokemon/phanpy/back.png differ diff --git a/graphics/pokemon/phione/icon.png b/graphics/pokemon/phione/icon.png index c24a936ffcdf..5202c8087cf3 100644 Binary files a/graphics/pokemon/phione/icon.png and b/graphics/pokemon/phione/icon.png differ diff --git a/graphics/pokemon/pichu/anim_front.png b/graphics/pokemon/pichu/anim_front.png index 4421c167d616..463e0d6dd5b6 100644 Binary files a/graphics/pokemon/pichu/anim_front.png and b/graphics/pokemon/pichu/anim_front.png differ diff --git a/graphics/pokemon/pichu/icon.png b/graphics/pokemon/pichu/icon.png index d29fa7fb4a57..4785f29342f9 100644 Binary files a/graphics/pokemon/pichu/icon.png and b/graphics/pokemon/pichu/icon.png differ diff --git a/graphics/pokemon/pichu/spiky_eared/anim_front.png b/graphics/pokemon/pichu/spiky_eared/anim_front.png index 2721dc8bf2b2..2088681d1d17 100644 Binary files a/graphics/pokemon/pichu/spiky_eared/anim_front.png and b/graphics/pokemon/pichu/spiky_eared/anim_front.png differ diff --git a/graphics/pokemon/pichu/spiky_eared/back.png b/graphics/pokemon/pichu/spiky_eared/back.png index 7ab9bb92fbbc..50554b7bca3a 100644 Binary files a/graphics/pokemon/pichu/spiky_eared/back.png and b/graphics/pokemon/pichu/spiky_eared/back.png differ diff --git a/graphics/pokemon/pichu/spiky_eared/front.png b/graphics/pokemon/pichu/spiky_eared/front.png index c16e4c56fe5a..15b9201a2701 100644 Binary files a/graphics/pokemon/pichu/spiky_eared/front.png and b/graphics/pokemon/pichu/spiky_eared/front.png differ diff --git a/graphics/pokemon/pichu/spiky_eared/icon.png b/graphics/pokemon/pichu/spiky_eared/icon.png index 3a407bc6cb2d..acd0234e0f11 100644 Binary files a/graphics/pokemon/pichu/spiky_eared/icon.png and b/graphics/pokemon/pichu/spiky_eared/icon.png differ diff --git a/graphics/pokemon/pidgeot/anim_front.png b/graphics/pokemon/pidgeot/anim_front.png index e926c550cec2..2a9f7c588779 100644 Binary files a/graphics/pokemon/pidgeot/anim_front.png and b/graphics/pokemon/pidgeot/anim_front.png differ diff --git a/graphics/pokemon/pidgeot/back.png b/graphics/pokemon/pidgeot/back.png index fabbbefe27f3..183b1254b36c 100644 Binary files a/graphics/pokemon/pidgeot/back.png and b/graphics/pokemon/pidgeot/back.png differ diff --git a/graphics/pokemon/pidgeot/normal.pal b/graphics/pokemon/pidgeot/normal.pal index c387bd5b868e..43afea2f11b1 100644 --- a/graphics/pokemon/pidgeot/normal.pal +++ b/graphics/pokemon/pidgeot/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -90 57 41 -16 16 16 -172 123 90 -115 82 74 -230 180 98 +255 255 255 +197 180 197 +255 246 189 255 230 139 -248 240 120 -248 152 112 +230 180 98 +255 172 115 238 98 65 -139 57 32 213 49 24 -197 180 197 -255 255 255 +139 57 32 230 164 156 189 123 123 +172 123 90 +115 82 74 +90 57 41 +16 16 16 diff --git a/graphics/pokemon/pidgeot/shiny.pal b/graphics/pokemon/pidgeot/shiny.pal index 5b47a0d5d27a..d97921941b97 100644 --- a/graphics/pokemon/pidgeot/shiny.pal +++ b/graphics/pokemon/pidgeot/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -96 56 0 +255 255 255 +197 180 197 +255 255 164 +255 255 123 +255 213 82 +255 238 115 +255 213 0 +246 164 0 +197 98 0 +255 205 90 +205 148 57 +180 131 16 +139 98 8 +115 74 0 16 16 16 -184 144 48 -136 96 16 -232 200 96 -248 248 144 -248 248 144 -248 248 96 -248 216 48 -192 96 0 -240 168 32 -192 176 192 -248 248 248 -248 200 88 -200 144 56 diff --git a/graphics/pokemon/pidgeotto/anim_front.png b/graphics/pokemon/pidgeotto/anim_front.png index ddae428c4784..49fc12c0bc42 100644 Binary files a/graphics/pokemon/pidgeotto/anim_front.png and b/graphics/pokemon/pidgeotto/anim_front.png differ diff --git a/graphics/pokemon/pidgeotto/back.png b/graphics/pokemon/pidgeotto/back.png index bf79cc14a7a4..43aaed915c89 100644 Binary files a/graphics/pokemon/pidgeotto/back.png and b/graphics/pokemon/pidgeotto/back.png differ diff --git a/graphics/pokemon/pidgeotto/normal.pal b/graphics/pokemon/pidgeotto/normal.pal index 6c8b9ef6f057..30dbaad1b2e1 100644 --- a/graphics/pokemon/pidgeotto/normal.pal +++ b/graphics/pokemon/pidgeotto/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -123 49 32 -197 49 41 -238 98 65 -32 32 32 -144 64 72 -131 82 49 -248 248 248 -65 41 32 -120 120 128 -255 172 115 +255 255 255 213 213 222 -172 123 90 -230 189 90 +123 123 131 +16 16 16 +240 152 232 255 230 139 +230 189 90 +216 112 200 172 123 90 +131 82 49 +65 41 32 +255 172 115 +238 98 65 +197 49 41 +123 49 32 diff --git a/graphics/pokemon/pidgeotto/shiny.pal b/graphics/pokemon/pidgeotto/shiny.pal index 8281977d4588..1af35cfe23ae 100644 --- a/graphics/pokemon/pidgeotto/shiny.pal +++ b/graphics/pokemon/pidgeotto/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -184 96 0 -232 152 16 -248 216 48 -16 16 16 -112 104 16 -112 128 48 -248 248 248 -48 56 16 -120 120 128 +152 160 208 +255 255 255 +213 213 222 +123 123 131 +32 32 32 248 248 120 -224 192 40 -176 176 72 -208 208 128 -240 248 168 -144 152 80 +246 255 172 +222 222 148 +224 184 0 +148 156 82 +115 131 49 +82 98 16 +255 255 172 +255 213 0 +238 148 0 +189 98 0 diff --git a/graphics/pokemon/pidgey/anim_front.png b/graphics/pokemon/pidgey/anim_front.png index 393024270e18..77cd7c2ba9ac 100644 Binary files a/graphics/pokemon/pidgey/anim_front.png and b/graphics/pokemon/pidgey/anim_front.png differ diff --git a/graphics/pokemon/pidgey/back.png b/graphics/pokemon/pidgey/back.png index 2097d2dee8ff..e5510fe080c0 100644 Binary files a/graphics/pokemon/pidgey/back.png and b/graphics/pokemon/pidgey/back.png differ diff --git a/graphics/pokemon/pidgey/normal.pal b/graphics/pokemon/pidgey/normal.pal index da639746deca..4081f468a21e 100644 --- a/graphics/pokemon/pidgey/normal.pal +++ b/graphics/pokemon/pidgey/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -128 72 48 -205 131 90 -164 98 90 -164 98 90 -230 189 98 +255 255 255 +189 189 189 +131 131 131 16 16 16 -255 238 156 -128 128 128 -189 41 32 -184 184 184 255 172 115 -248 248 248 238 98 65 +189 41 32 +255 246 189 +255 238 156 +230 189 98 205 131 90 -64 32 16 +164 98 90 +115 74 49 +65 41 24 +255 0 255 diff --git a/graphics/pokemon/pidgey/shiny.pal b/graphics/pokemon/pidgey/shiny.pal index 37d1fed4b225..48ea08bf6869 100644 --- a/graphics/pokemon/pidgey/shiny.pal +++ b/graphics/pokemon/pidgey/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -96 88 0 -176 160 32 -136 136 24 -136 136 24 -200 200 80 +152 160 208 +255 255 255 +189 189 189 +131 131 131 16 16 16 -232 232 128 -128 128 128 -192 112 0 -184 184 184 -248 232 112 -248 248 248 -232 192 64 -168 160 64 -72 56 0 +255 238 115 +255 205 41 +197 115 0 +238 255 238 +230 230 131 +205 205 24 +180 164 16 +139 139 16 +115 123 0 +82 106 0 +255 0 255 diff --git a/graphics/pokemon/pignite/icon.png b/graphics/pokemon/pignite/icon.png index 1190d639af41..e9edb020a460 100644 Binary files a/graphics/pokemon/pignite/icon.png and b/graphics/pokemon/pignite/icon.png differ diff --git a/graphics/pokemon/pikachu/alola_cap/back.png b/graphics/pokemon/pikachu/alola_cap/back.png index 110eab45bfba..4600e6ed55e4 100644 Binary files a/graphics/pokemon/pikachu/alola_cap/back.png and b/graphics/pokemon/pikachu/alola_cap/back.png differ diff --git a/graphics/pokemon/pikachu/alola_cap/front.png b/graphics/pokemon/pikachu/alola_cap/front.png index 2de876f50076..3e4d1d2a8139 100644 Binary files a/graphics/pokemon/pikachu/alola_cap/front.png and b/graphics/pokemon/pikachu/alola_cap/front.png differ diff --git a/graphics/pokemon/pikachu/alola_cap/icon.png b/graphics/pokemon/pikachu/alola_cap/icon.png index c2ad26a4be7d..b9ba5f757f90 100644 Binary files a/graphics/pokemon/pikachu/alola_cap/icon.png and b/graphics/pokemon/pikachu/alola_cap/icon.png differ diff --git a/graphics/pokemon/pikachu/anim_front.png b/graphics/pokemon/pikachu/anim_front.png index 6deb20d71bb8..89538a8612ac 100644 Binary files a/graphics/pokemon/pikachu/anim_front.png and b/graphics/pokemon/pikachu/anim_front.png differ diff --git a/graphics/pokemon/pikachu/anim_frontf.png b/graphics/pokemon/pikachu/anim_frontf.png new file mode 100644 index 000000000000..27780be98a4b Binary files /dev/null and b/graphics/pokemon/pikachu/anim_frontf.png differ diff --git a/graphics/pokemon/pikachu/back.png b/graphics/pokemon/pikachu/back.png index 43280778131f..c18078cfd634 100644 Binary files a/graphics/pokemon/pikachu/back.png and b/graphics/pokemon/pikachu/back.png differ diff --git a/graphics/pokemon/pikachu/backf.png b/graphics/pokemon/pikachu/backf.png new file mode 100644 index 000000000000..9f0166b3d353 Binary files /dev/null and b/graphics/pokemon/pikachu/backf.png differ diff --git a/graphics/pokemon/pikachu/belle/back.png b/graphics/pokemon/pikachu/belle/back.png index b9b18756583a..80409a56e554 100644 Binary files a/graphics/pokemon/pikachu/belle/back.png and b/graphics/pokemon/pikachu/belle/back.png differ diff --git a/graphics/pokemon/pikachu/belle/front.png b/graphics/pokemon/pikachu/belle/front.png index 27e11f42eb53..4813a85d1d6d 100644 Binary files a/graphics/pokemon/pikachu/belle/front.png and b/graphics/pokemon/pikachu/belle/front.png differ diff --git a/graphics/pokemon/pikachu/belle/icon.png b/graphics/pokemon/pikachu/belle/icon.png index c3374c4bb018..b3c0f00b37d1 100644 Binary files a/graphics/pokemon/pikachu/belle/icon.png and b/graphics/pokemon/pikachu/belle/icon.png differ diff --git a/graphics/pokemon/pikachu/cosplay/back.png b/graphics/pokemon/pikachu/cosplay/back.png index 524417f1cba3..71e79cbc561c 100644 Binary files a/graphics/pokemon/pikachu/cosplay/back.png and b/graphics/pokemon/pikachu/cosplay/back.png differ diff --git a/graphics/pokemon/pikachu/cosplay/front.png b/graphics/pokemon/pikachu/cosplay/front.png index bcbe13ee8f61..c47855529d06 100644 Binary files a/graphics/pokemon/pikachu/cosplay/front.png and b/graphics/pokemon/pikachu/cosplay/front.png differ diff --git a/graphics/pokemon/pikachu/cosplay/icon.png b/graphics/pokemon/pikachu/cosplay/icon.png index 38d9443a453f..c826dacab095 100644 Binary files a/graphics/pokemon/pikachu/cosplay/icon.png and b/graphics/pokemon/pikachu/cosplay/icon.png differ diff --git a/graphics/pokemon/pikachu/hoenn_cap/back.png b/graphics/pokemon/pikachu/hoenn_cap/back.png index a257b1e99425..7d2d583cc4b6 100644 Binary files a/graphics/pokemon/pikachu/hoenn_cap/back.png and b/graphics/pokemon/pikachu/hoenn_cap/back.png differ diff --git a/graphics/pokemon/pikachu/hoenn_cap/front.png b/graphics/pokemon/pikachu/hoenn_cap/front.png index 2c9749ee2e35..d45c2fb54e68 100644 Binary files a/graphics/pokemon/pikachu/hoenn_cap/front.png and b/graphics/pokemon/pikachu/hoenn_cap/front.png differ diff --git a/graphics/pokemon/pikachu/hoenn_cap/icon.png b/graphics/pokemon/pikachu/hoenn_cap/icon.png index c9f88f5e3026..e5f8bfe206c6 100644 Binary files a/graphics/pokemon/pikachu/hoenn_cap/icon.png and b/graphics/pokemon/pikachu/hoenn_cap/icon.png differ diff --git a/graphics/pokemon/pikachu/kalos_cap/back.png b/graphics/pokemon/pikachu/kalos_cap/back.png index c0a4b7526186..5d15d09d17bb 100644 Binary files a/graphics/pokemon/pikachu/kalos_cap/back.png and b/graphics/pokemon/pikachu/kalos_cap/back.png differ diff --git a/graphics/pokemon/pikachu/kalos_cap/front.png b/graphics/pokemon/pikachu/kalos_cap/front.png index b8d995d8794c..3107c90997f6 100644 Binary files a/graphics/pokemon/pikachu/kalos_cap/front.png and b/graphics/pokemon/pikachu/kalos_cap/front.png differ diff --git a/graphics/pokemon/pikachu/kalos_cap/icon.png b/graphics/pokemon/pikachu/kalos_cap/icon.png index 0e93d93b74cb..c903ea9f3f8c 100644 Binary files a/graphics/pokemon/pikachu/kalos_cap/icon.png and b/graphics/pokemon/pikachu/kalos_cap/icon.png differ diff --git a/graphics/pokemon/pikachu/libre/back.png b/graphics/pokemon/pikachu/libre/back.png index f92d401f76af..f87ec5361673 100644 Binary files a/graphics/pokemon/pikachu/libre/back.png and b/graphics/pokemon/pikachu/libre/back.png differ diff --git a/graphics/pokemon/pikachu/libre/front.png b/graphics/pokemon/pikachu/libre/front.png index 234ad40f955e..09acd7433c1f 100644 Binary files a/graphics/pokemon/pikachu/libre/front.png and b/graphics/pokemon/pikachu/libre/front.png differ diff --git a/graphics/pokemon/pikachu/libre/icon.png b/graphics/pokemon/pikachu/libre/icon.png index 38ce2cc69b49..c1163a161970 100644 Binary files a/graphics/pokemon/pikachu/libre/icon.png and b/graphics/pokemon/pikachu/libre/icon.png differ diff --git a/graphics/pokemon/pikachu/normal.pal b/graphics/pokemon/pikachu/normal.pal index 8f402fd44720..057bc45b8a95 100644 --- a/graphics/pokemon/pikachu/normal.pal +++ b/graphics/pokemon/pikachu/normal.pal @@ -3,17 +3,17 @@ JASC-PAL 16 152 208 160 0 0 0 -41 41 41 -99 49 8 -82 82 90 -247 189 33 -156 82 0 -247 230 82 +255 246 164 +246 230 82 +246 189 32 222 148 0 -255 247 165 +156 82 0 +98 49 8 +230 148 131 +230 90 65 +197 32 24 +123 41 8 +123 123 139 +64 64 72 +41 41 41 255 255 255 -230 90 66 -197 33 25 -168 48 16 -224 80 56 -0 0 0 diff --git a/graphics/pokemon/pikachu/original_cap/back.png b/graphics/pokemon/pikachu/original_cap/back.png index 4f5d09e274c8..da5adcbfbaf0 100644 Binary files a/graphics/pokemon/pikachu/original_cap/back.png and b/graphics/pokemon/pikachu/original_cap/back.png differ diff --git a/graphics/pokemon/pikachu/original_cap/front.png b/graphics/pokemon/pikachu/original_cap/front.png index bb8d5931ec9d..6f19b36d4c91 100644 Binary files a/graphics/pokemon/pikachu/original_cap/front.png and b/graphics/pokemon/pikachu/original_cap/front.png differ diff --git a/graphics/pokemon/pikachu/original_cap/icon.png b/graphics/pokemon/pikachu/original_cap/icon.png index 6a356991e95a..d84764b65c1b 100644 Binary files a/graphics/pokemon/pikachu/original_cap/icon.png and b/graphics/pokemon/pikachu/original_cap/icon.png differ diff --git a/graphics/pokemon/pikachu/partner_cap/icon.png b/graphics/pokemon/pikachu/partner_cap/icon.png index 78630c66431e..09ae0c691aa0 100644 Binary files a/graphics/pokemon/pikachu/partner_cap/icon.png and b/graphics/pokemon/pikachu/partner_cap/icon.png differ diff --git a/graphics/pokemon/pikachu/ph_d/back.png b/graphics/pokemon/pikachu/ph_d/back.png index 83ee2a559694..faa265cc05c3 100644 Binary files a/graphics/pokemon/pikachu/ph_d/back.png and b/graphics/pokemon/pikachu/ph_d/back.png differ diff --git a/graphics/pokemon/pikachu/ph_d/front.png b/graphics/pokemon/pikachu/ph_d/front.png index 75034ed9ded3..97b0603886b8 100644 Binary files a/graphics/pokemon/pikachu/ph_d/front.png and b/graphics/pokemon/pikachu/ph_d/front.png differ diff --git a/graphics/pokemon/pikachu/ph_d/icon.png b/graphics/pokemon/pikachu/ph_d/icon.png index 50357beb5b1f..f0b66bccf844 100644 Binary files a/graphics/pokemon/pikachu/ph_d/icon.png and b/graphics/pokemon/pikachu/ph_d/icon.png differ diff --git a/graphics/pokemon/pikachu/pop_star/back.png b/graphics/pokemon/pikachu/pop_star/back.png index 6840627cde25..fae0e872b902 100644 Binary files a/graphics/pokemon/pikachu/pop_star/back.png and b/graphics/pokemon/pikachu/pop_star/back.png differ diff --git a/graphics/pokemon/pikachu/pop_star/front.png b/graphics/pokemon/pikachu/pop_star/front.png index e092dfa5caac..d57a9695ca48 100644 Binary files a/graphics/pokemon/pikachu/pop_star/front.png and b/graphics/pokemon/pikachu/pop_star/front.png differ diff --git a/graphics/pokemon/pikachu/pop_star/icon.png b/graphics/pokemon/pikachu/pop_star/icon.png index c22ef85a4c1c..eb9b49e70af9 100644 Binary files a/graphics/pokemon/pikachu/pop_star/icon.png and b/graphics/pokemon/pikachu/pop_star/icon.png differ diff --git a/graphics/pokemon/pikachu/rock_star/back.png b/graphics/pokemon/pikachu/rock_star/back.png index fd86f4d59ce7..4609337111f8 100644 Binary files a/graphics/pokemon/pikachu/rock_star/back.png and b/graphics/pokemon/pikachu/rock_star/back.png differ diff --git a/graphics/pokemon/pikachu/rock_star/front.png b/graphics/pokemon/pikachu/rock_star/front.png index 17a102c0b32f..289b6f4cdedf 100644 Binary files a/graphics/pokemon/pikachu/rock_star/front.png and b/graphics/pokemon/pikachu/rock_star/front.png differ diff --git a/graphics/pokemon/pikachu/rock_star/icon.png b/graphics/pokemon/pikachu/rock_star/icon.png index 96a73279067d..2c8d144d6074 100644 Binary files a/graphics/pokemon/pikachu/rock_star/icon.png and b/graphics/pokemon/pikachu/rock_star/icon.png differ diff --git a/graphics/pokemon/pikachu/shiny.pal b/graphics/pokemon/pikachu/shiny.pal index b2149ed68d7c..524daf09fa05 100644 --- a/graphics/pokemon/pikachu/shiny.pal +++ b/graphics/pokemon/pikachu/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -16 16 16 -40 40 40 -112 24 8 -80 80 88 -240 160 24 -176 56 16 -248 200 72 -224 128 0 -248 232 152 -248 248 248 -224 96 64 -192 40 24 -192 40 24 -224 96 64 0 0 0 +255 230 131 +255 197 49 +255 164 0 +230 131 0 +180 49 0 +115 16 0 +230 156 131 +230 98 65 +197 41 24 +123 49 8 +115 115 131 +82 82 90 +41 41 41 +255 255 255 diff --git a/graphics/pokemon/pikachu/sinnoh_cap/back.png b/graphics/pokemon/pikachu/sinnoh_cap/back.png index 24d429bc42e1..7dc1230ac03e 100644 Binary files a/graphics/pokemon/pikachu/sinnoh_cap/back.png and b/graphics/pokemon/pikachu/sinnoh_cap/back.png differ diff --git a/graphics/pokemon/pikachu/sinnoh_cap/front.png b/graphics/pokemon/pikachu/sinnoh_cap/front.png index 91d91acc28c3..611120c3905f 100644 Binary files a/graphics/pokemon/pikachu/sinnoh_cap/front.png and b/graphics/pokemon/pikachu/sinnoh_cap/front.png differ diff --git a/graphics/pokemon/pikachu/sinnoh_cap/icon.png b/graphics/pokemon/pikachu/sinnoh_cap/icon.png index a127ebcb3a04..081ee6aae3a6 100644 Binary files a/graphics/pokemon/pikachu/sinnoh_cap/icon.png and b/graphics/pokemon/pikachu/sinnoh_cap/icon.png differ diff --git a/graphics/pokemon/pikachu/unova_cap/back.png b/graphics/pokemon/pikachu/unova_cap/back.png index 2191a0f4c91a..3c7d7adfd373 100644 Binary files a/graphics/pokemon/pikachu/unova_cap/back.png and b/graphics/pokemon/pikachu/unova_cap/back.png differ diff --git a/graphics/pokemon/pikachu/unova_cap/front.png b/graphics/pokemon/pikachu/unova_cap/front.png index fbc8a3a6129c..bf9f81437a47 100644 Binary files a/graphics/pokemon/pikachu/unova_cap/front.png and b/graphics/pokemon/pikachu/unova_cap/front.png differ diff --git a/graphics/pokemon/pikachu/unova_cap/icon.png b/graphics/pokemon/pikachu/unova_cap/icon.png index 1dbc18cfae63..b6427a5ec2a7 100644 Binary files a/graphics/pokemon/pikachu/unova_cap/icon.png and b/graphics/pokemon/pikachu/unova_cap/icon.png differ diff --git a/graphics/pokemon/piloswine/anim_frontf.png b/graphics/pokemon/piloswine/anim_frontf.png new file mode 100644 index 000000000000..4be264c83a68 Binary files /dev/null and b/graphics/pokemon/piloswine/anim_frontf.png differ diff --git a/graphics/pokemon/piloswine/backf.png b/graphics/pokemon/piloswine/backf.png new file mode 100644 index 000000000000..952d0bf99038 Binary files /dev/null and b/graphics/pokemon/piloswine/backf.png differ diff --git a/graphics/pokemon/pincurchin/anim_front.png b/graphics/pokemon/pincurchin/anim_front.png new file mode 100644 index 000000000000..b8ed4964e484 Binary files /dev/null and b/graphics/pokemon/pincurchin/anim_front.png differ diff --git a/graphics/pokemon/pincurchin/back.png b/graphics/pokemon/pincurchin/back.png index b4e6261f48d7..b444c850b15a 100644 Binary files a/graphics/pokemon/pincurchin/back.png and b/graphics/pokemon/pincurchin/back.png differ diff --git a/graphics/pokemon/pincurchin/front.png b/graphics/pokemon/pincurchin/front.png deleted file mode 100644 index 1114260e3142..000000000000 Binary files a/graphics/pokemon/pincurchin/front.png and /dev/null differ diff --git a/graphics/pokemon/pincurchin/normal.pal b/graphics/pokemon/pincurchin/normal.pal index 5b791f23ee2b..8598a846610d 100644 --- a/graphics/pokemon/pincurchin/normal.pal +++ b/graphics/pokemon/pincurchin/normal.pal @@ -13,7 +13,7 @@ JASC-PAL 248 184 40 248 240 40 208 136 16 -0 0 0 -0 0 0 +173 255 239 +20 255 210 0 0 0 0 0 0 diff --git a/graphics/pokemon/pinsir/anim_front.png b/graphics/pokemon/pinsir/anim_front.png index 9dd53e423fd9..7d5d17388d56 100644 Binary files a/graphics/pokemon/pinsir/anim_front.png and b/graphics/pokemon/pinsir/anim_front.png differ diff --git a/graphics/pokemon/politoed/anim_front.png b/graphics/pokemon/politoed/anim_front.png index 15378c27c8f9..4ec0c4cb9042 100644 Binary files a/graphics/pokemon/politoed/anim_front.png and b/graphics/pokemon/politoed/anim_front.png differ diff --git a/graphics/pokemon/politoed/anim_frontf.png b/graphics/pokemon/politoed/anim_frontf.png new file mode 100644 index 000000000000..88c007e8a91d Binary files /dev/null and b/graphics/pokemon/politoed/anim_frontf.png differ diff --git a/graphics/pokemon/politoed/backf.png b/graphics/pokemon/politoed/backf.png new file mode 100644 index 000000000000..80bbd233f4cf Binary files /dev/null and b/graphics/pokemon/politoed/backf.png differ diff --git a/graphics/pokemon/poliwag/anim_front.png b/graphics/pokemon/poliwag/anim_front.png index 53a5e3754018..b0e5aac1cf32 100644 Binary files a/graphics/pokemon/poliwag/anim_front.png and b/graphics/pokemon/poliwag/anim_front.png differ diff --git a/graphics/pokemon/poliwag/back.png b/graphics/pokemon/poliwag/back.png index b7d603b2e9ee..d85f353b2ff6 100644 Binary files a/graphics/pokemon/poliwag/back.png and b/graphics/pokemon/poliwag/back.png differ diff --git a/graphics/pokemon/poliwag/normal.pal b/graphics/pokemon/poliwag/normal.pal index 09bad1cd360f..3fddb21d156d 100644 --- a/graphics/pokemon/poliwag/normal.pal +++ b/graphics/pokemon/poliwag/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -24 57 115 -139 164 230 -82 131 197 -57 90 131 255 255 255 -16 16 16 -98 98 98 +200 200 200 180 172 189 +98 98 98 +255 0 255 +255 0 255 +56 112 168 255 189 172 255 106 106 189 90 74 -205 205 205 -57 115 172 -0 0 0 -0 0 0 +136 160 224 +80 128 192 +56 88 128 +24 56 112 +16 16 16 diff --git a/graphics/pokemon/poliwag/shiny.pal b/graphics/pokemon/poliwag/shiny.pal index 9a526f806ab9..065f2ac3c000 100644 --- a/graphics/pokemon/poliwag/shiny.pal +++ b/graphics/pokemon/poliwag/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -56 88 144 -160 208 232 -128 176 232 -72 104 192 -248 248 248 -16 16 16 -96 96 96 -192 184 200 -248 184 168 -248 128 128 -184 104 88 -224 224 224 +255 255 255 +222 222 222 +180 172 189 +98 98 98 +255 0 255 +255 0 255 96 144 232 -0 0 0 -0 0 0 +255 189 172 +255 106 106 +189 90 74 +164 213 246 +115 172 255 +82 115 213 +32 74 164 +16 16 16 diff --git a/graphics/pokemon/poliwhirl/anim_front.png b/graphics/pokemon/poliwhirl/anim_front.png index 87cb52b3a54a..e3dbb03ce805 100644 Binary files a/graphics/pokemon/poliwhirl/anim_front.png and b/graphics/pokemon/poliwhirl/anim_front.png differ diff --git a/graphics/pokemon/poliwhirl/back.png b/graphics/pokemon/poliwhirl/back.png index 17ea206d8f60..b0c6138b14ed 100644 Binary files a/graphics/pokemon/poliwhirl/back.png and b/graphics/pokemon/poliwhirl/back.png differ diff --git a/graphics/pokemon/poliwhirl/normal.pal b/graphics/pokemon/poliwhirl/normal.pal index ac25d75a660a..741a92a08c50 100644 --- a/graphics/pokemon/poliwhirl/normal.pal +++ b/graphics/pokemon/poliwhirl/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -32 57 98 -82 90 131 -115 131 197 -248 248 248 -115 131 197 -80 80 80 -184 184 192 -15 15 15 -136 160 224 -120 120 120 -136 152 160 -240 240 248 +255 255 255 213 213 222 -0 0 0 -0 0 0 +189 189 189 +164 164 164 +255 0 255 +255 0 255 +255 0 255 +123 123 123 +82 82 82 +56 112 168 +136 160 224 +80 128 192 +56 88 128 +24 56 112 +16 16 16 diff --git a/graphics/pokemon/poliwhirl/shiny.pal b/graphics/pokemon/poliwhirl/shiny.pal index 46d11fec3e99..0fcd67b82dd8 100644 --- a/graphics/pokemon/poliwhirl/shiny.pal +++ b/graphics/pokemon/poliwhirl/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -56 88 144 -72 128 192 -104 192 240 -248 248 248 +255 255 255 +213 213 222 +189 189 189 +164 164 164 +255 0 255 +255 0 255 +255 0 255 +123 123 123 +82 82 82 64 160 232 -80 80 80 -184 184 184 +123 222 255 +82 189 255 +57 131 213 +32 90 172 16 16 16 -160 224 240 -120 120 120 -160 160 160 -248 248 248 -208 208 216 -0 0 0 -0 0 0 diff --git a/graphics/pokemon/poliwrath/anim_front.png b/graphics/pokemon/poliwrath/anim_front.png index 3e63a0c1a6dc..5051a0445c2a 100644 Binary files a/graphics/pokemon/poliwrath/anim_front.png and b/graphics/pokemon/poliwrath/anim_front.png differ diff --git a/graphics/pokemon/poliwrath/back.png b/graphics/pokemon/poliwrath/back.png index ce2fbc07ce2c..0e39599c9ff2 100644 Binary files a/graphics/pokemon/poliwrath/back.png and b/graphics/pokemon/poliwrath/back.png differ diff --git a/graphics/pokemon/poliwrath/normal.pal b/graphics/pokemon/poliwrath/normal.pal index e1f44100ad60..ab89bed15bb7 100644 --- a/graphics/pokemon/poliwrath/normal.pal +++ b/graphics/pokemon/poliwrath/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -82 90 131 -180 189 230 -32 57 90 -115 131 197 -16 16 16 255 255 255 213 213 222 189 189 189 -82 82 82 -123 123 123 -232 232 248 164 164 164 -0 0 0 -0 0 0 -0 0 0 +255 0 255 +255 0 255 +56 112 168 +123 123 123 +82 82 82 +16 16 16 +136 160 224 +80 128 192 +56 88 128 +24 57 112 +16 16 16 diff --git a/graphics/pokemon/poliwrath/shiny.pal b/graphics/pokemon/poliwrath/shiny.pal index 3b92345e72e6..cbfca2817774 100644 --- a/graphics/pokemon/poliwrath/shiny.pal +++ b/graphics/pokemon/poliwrath/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -248 160 176 -104 136 72 -184 216 160 -48 80 24 -136 184 112 +152 160 208 +255 255 255 +213 213 222 +189 189 189 +164 164 164 +255 0 255 +255 0 255 +120 160 88 +123 123 123 +82 82 82 +16 16 16 +189 222 164 +139 189 115 +106 139 74 +49 82 24 16 16 16 -248 248 248 -208 208 216 -184 184 184 -80 80 80 -120 120 120 -248 248 248 -160 160 160 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/pokemon/ponyta/anim_front.png b/graphics/pokemon/ponyta/anim_front.png index d46f4d1637c1..abb69bd7e3bb 100644 Binary files a/graphics/pokemon/ponyta/anim_front.png and b/graphics/pokemon/ponyta/anim_front.png differ diff --git a/graphics/pokemon/ponyta/back.png b/graphics/pokemon/ponyta/back.png index 145f7e1f26c9..64f3ae87ec28 100644 Binary files a/graphics/pokemon/ponyta/back.png and b/graphics/pokemon/ponyta/back.png differ diff --git a/graphics/pokemon/ponyta/normal.pal b/graphics/pokemon/ponyta/normal.pal index d2af3d8c90a5..59e2afebe539 100644 --- a/graphics/pokemon/ponyta/normal.pal +++ b/graphics/pokemon/ponyta/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -230 90 41 -255 156 24 -255 222 82 -238 49 49 -139 82 49 -115 49 49 +0 0 0 +255 255 255 255 238 205 -16 16 16 -160 72 72 230 205 139 197 156 106 -255 255 255 -65 74 131 -115 123 164 -197 197 213 +139 82 49 +115 49 49 +238 49 49 +230 90 41 +255 156 24 +255 222 82 +197 197 208 +115 123 160 +65 74 128 +0 0 0 diff --git a/graphics/pokemon/ponyta/shiny.pal b/graphics/pokemon/ponyta/shiny.pal index 99c81ff10667..b778aec8adf0 100644 --- a/graphics/pokemon/ponyta/shiny.pal +++ b/graphics/pokemon/ponyta/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -72 144 232 -112 168 240 -192 216 248 -40 88 224 +0 0 0 +255 255 255 +255 255 222 +238 222 156 +205 172 123 176 128 112 -128 80 64 -248 248 216 -16 16 16 -176 128 112 -232 216 152 -200 168 120 -248 248 248 -64 72 80 -112 120 128 -192 192 192 +131 82 65 +41 88 230 +74 148 238 +115 172 246 +197 222 255 +197 197 197 +115 123 131 +65 74 82 +0 0 0 diff --git a/graphics/pokemon/primeape/anim_front.png b/graphics/pokemon/primeape/anim_front.png index dbb5d7f0d926..85cec2952402 100644 Binary files a/graphics/pokemon/primeape/anim_front.png and b/graphics/pokemon/primeape/anim_front.png differ diff --git a/graphics/pokemon/primeape/back.png b/graphics/pokemon/primeape/back.png index b0cff330db76..e5880490d176 100644 Binary files a/graphics/pokemon/primeape/back.png and b/graphics/pokemon/primeape/back.png differ diff --git a/graphics/pokemon/primeape/normal.pal b/graphics/pokemon/primeape/normal.pal index 015a68508115..ef74715fdcfb 100644 --- a/graphics/pokemon/primeape/normal.pal +++ b/graphics/pokemon/primeape/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -90 49 0 -156 106 106 +255 255 255 +197 197 197 +123 123 123 +65 65 65 +255 148 90 +189 74 49 +230 180 139 205 139 90 +156 106 106 +90 49 0 0 0 0 -98 74 32 +255 255 213 255 230 180 -65 65 65 230 189 156 -123 123 123 -255 255 213 -255 148 90 -248 248 248 -189 74 49 -255 148 90 -224 176 136 +98 74 32 diff --git a/graphics/pokemon/primeape/shiny.pal b/graphics/pokemon/primeape/shiny.pal index d1ae31aed8ae..1e9e677301ee 100644 --- a/graphics/pokemon/primeape/shiny.pal +++ b/graphics/pokemon/primeape/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -88 72 0 -128 120 40 -168 168 88 -16 16 16 -168 96 56 -248 208 152 -64 64 64 -216 160 112 -120 120 120 -248 232 184 -248 144 88 -248 248 248 -184 96 72 -248 160 112 -200 216 128 +152 160 208 +255 255 255 +197 197 197 +123 123 123 +65 65 65 +255 148 90 +189 74 49 +205 222 131 +172 172 90 +131 123 32 +90 74 0 +0 0 0 +255 230 172 +255 205 139 +222 156 106 +172 98 57 diff --git a/graphics/pokemon/probopass/icon.png b/graphics/pokemon/probopass/icon.png index dbbe9c16a367..a10a6c0b5c43 100644 Binary files a/graphics/pokemon/probopass/icon.png and b/graphics/pokemon/probopass/icon.png differ diff --git a/graphics/pokemon/psyduck/anim_front.png b/graphics/pokemon/psyduck/anim_front.png index 0b89ba3742e9..561b367a763d 100644 Binary files a/graphics/pokemon/psyduck/anim_front.png and b/graphics/pokemon/psyduck/anim_front.png differ diff --git a/graphics/pokemon/psyduck/back.png b/graphics/pokemon/psyduck/back.png index 45a3f41042f9..855d8aa43e10 100644 Binary files a/graphics/pokemon/psyduck/back.png and b/graphics/pokemon/psyduck/back.png differ diff --git a/graphics/pokemon/psyduck/normal.pal b/graphics/pokemon/psyduck/normal.pal index 7e2179a0b27c..56e9584cf31b 100644 --- a/graphics/pokemon/psyduck/normal.pal +++ b/graphics/pokemon/psyduck/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -123 123 123 -16 16 16 -148 90 16 -230 164 82 -255 213 74 -255 230 164 -222 180 82 -255 255 255 -131 90 0 255 238 189 246 222 139 -248 232 184 -0 0 0 -0 0 0 -0 0 0 +222 180 82 +131 90 0 +255 255 255 +222 222 222 +123 123 123 +255 0 255 +255 0 255 +255 0 255 +255 230 164 +255 213 74 +230 164 82 +148 90 16 +16 16 16 diff --git a/graphics/pokemon/psyduck/shiny.pal b/graphics/pokemon/psyduck/shiny.pal index 5151358e5223..8f51e6fa702d 100644 --- a/graphics/pokemon/psyduck/shiny.pal +++ b/graphics/pokemon/psyduck/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -120 120 120 +230 255 255 +180 222 246 +156 180 205 +123 131 156 +255 255 255 +222 222 222 +123 123 123 +255 0 255 +255 0 255 +255 0 255 +197 246 246 +156 222 230 +123 180 156 +65 106 115 16 16 16 -64 104 112 -120 176 152 -152 216 224 -192 240 240 -152 176 200 -248 248 248 -120 128 152 -224 248 248 -176 216 240 -0 0 0 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/pokemon/pumpkaboo/back.png b/graphics/pokemon/pumpkaboo/back.png index 9744f396645c..9eb5592bf25e 100644 Binary files a/graphics/pokemon/pumpkaboo/back.png and b/graphics/pokemon/pumpkaboo/back.png differ diff --git a/graphics/pokemon/pumpkaboo/large/back.png b/graphics/pokemon/pumpkaboo/large/back.png index e5deba0d7d62..3faac8b9ab08 100644 Binary files a/graphics/pokemon/pumpkaboo/large/back.png and b/graphics/pokemon/pumpkaboo/large/back.png differ diff --git a/graphics/pokemon/pumpkaboo/small/back.png b/graphics/pokemon/pumpkaboo/small/back.png index 5d7c21e3465d..5110542800dd 100644 Binary files a/graphics/pokemon/pumpkaboo/small/back.png and b/graphics/pokemon/pumpkaboo/small/back.png differ diff --git a/graphics/pokemon/pumpkaboo/super/back.png b/graphics/pokemon/pumpkaboo/super/back.png index 85cc83e2c0cf..d25fd4dffb96 100644 Binary files a/graphics/pokemon/pumpkaboo/super/back.png and b/graphics/pokemon/pumpkaboo/super/back.png differ diff --git a/graphics/pokemon/pyroar/icon.png b/graphics/pokemon/pyroar/icon.png index e00595a15955..2b750a93d2bc 100644 Binary files a/graphics/pokemon/pyroar/icon.png and b/graphics/pokemon/pyroar/icon.png differ diff --git a/graphics/pokemon/pyukumuku/anim_front.png b/graphics/pokemon/pyukumuku/anim_front.png new file mode 100644 index 000000000000..93363fa8319a Binary files /dev/null and b/graphics/pokemon/pyukumuku/anim_front.png differ diff --git a/graphics/pokemon/pyukumuku/front.png b/graphics/pokemon/pyukumuku/front.png deleted file mode 100644 index 0234bcce2dcb..000000000000 Binary files a/graphics/pokemon/pyukumuku/front.png and /dev/null differ diff --git a/graphics/pokemon/quagsire/anim_front.png b/graphics/pokemon/quagsire/anim_front.png index a940e3378c5b..3a2c50113987 100644 Binary files a/graphics/pokemon/quagsire/anim_front.png and b/graphics/pokemon/quagsire/anim_front.png differ diff --git a/graphics/pokemon/quagsire/anim_frontf.png b/graphics/pokemon/quagsire/anim_frontf.png new file mode 100644 index 000000000000..26fd56317663 Binary files /dev/null and b/graphics/pokemon/quagsire/anim_frontf.png differ diff --git a/graphics/pokemon/quagsire/back.png b/graphics/pokemon/quagsire/back.png index b961bbb22b39..0673d4b1d165 100644 Binary files a/graphics/pokemon/quagsire/back.png and b/graphics/pokemon/quagsire/back.png differ diff --git a/graphics/pokemon/quagsire/backf.png b/graphics/pokemon/quagsire/backf.png new file mode 100644 index 000000000000..f2f4406ea609 Binary files /dev/null and b/graphics/pokemon/quagsire/backf.png differ diff --git a/graphics/pokemon/question_mark/circled/anim_front.png b/graphics/pokemon/question_mark/circled/anim_front.png index 9eb27931eb83..adc8ca4a0423 100644 Binary files a/graphics/pokemon/question_mark/circled/anim_front.png and b/graphics/pokemon/question_mark/circled/anim_front.png differ diff --git a/graphics/pokemon/question_mark/circled/back.png b/graphics/pokemon/question_mark/circled/back.png index 3056402db40a..1b944339669c 100644 Binary files a/graphics/pokemon/question_mark/circled/back.png and b/graphics/pokemon/question_mark/circled/back.png differ diff --git a/graphics/pokemon/question_mark/icon.png b/graphics/pokemon/question_mark/icon.png index b31ebacf7191..97407de0d3cd 100644 Binary files a/graphics/pokemon/question_mark/icon.png and b/graphics/pokemon/question_mark/icon.png differ diff --git a/graphics/pokemon/quilava/anim_front.png b/graphics/pokemon/quilava/anim_front.png index e65df16880e2..6299ffb22f95 100644 Binary files a/graphics/pokemon/quilava/anim_front.png and b/graphics/pokemon/quilava/anim_front.png differ diff --git a/graphics/pokemon/quilava/back.png b/graphics/pokemon/quilava/back.png index 282cfea2094f..e313aba362ea 100644 Binary files a/graphics/pokemon/quilava/back.png and b/graphics/pokemon/quilava/back.png differ diff --git a/graphics/pokemon/qwilfish/hisuian/back.png b/graphics/pokemon/qwilfish/hisuian/back.png index 7504a692af0e..5b522e32eb96 100755 Binary files a/graphics/pokemon/qwilfish/hisuian/back.png and b/graphics/pokemon/qwilfish/hisuian/back.png differ diff --git a/graphics/pokemon/qwilfish/hisuian/front.png b/graphics/pokemon/qwilfish/hisuian/front.png index 0de50b786090..3b4906077f7b 100755 Binary files a/graphics/pokemon/qwilfish/hisuian/front.png and b/graphics/pokemon/qwilfish/hisuian/front.png differ diff --git a/graphics/pokemon/raichu/anim_front.png b/graphics/pokemon/raichu/anim_front.png index 792c3ffa63ea..5466c93f49a6 100644 Binary files a/graphics/pokemon/raichu/anim_front.png and b/graphics/pokemon/raichu/anim_front.png differ diff --git a/graphics/pokemon/raichu/anim_frontf.png b/graphics/pokemon/raichu/anim_frontf.png new file mode 100644 index 000000000000..59d4b43535ac Binary files /dev/null and b/graphics/pokemon/raichu/anim_frontf.png differ diff --git a/graphics/pokemon/raichu/back.png b/graphics/pokemon/raichu/back.png index b738ceab8ac2..8cf42c3a020e 100644 Binary files a/graphics/pokemon/raichu/back.png and b/graphics/pokemon/raichu/back.png differ diff --git a/graphics/pokemon/raichu/normal.pal b/graphics/pokemon/raichu/normal.pal index 6594ba18bbd2..d29868af5acb 100644 --- a/graphics/pokemon/raichu/normal.pal +++ b/graphics/pokemon/raichu/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -90 41 41 -139 98 16 0 0 0 -115 65 49 -255 189 0 -148 65 65 -255 222 90 +255 238 213 +230 205 164 246 172 41 222 123 49 -255 238 213 189 90 49 +148 65 65 +90 41 41 +255 222 90 +255 189 0 +139 98 16 +115 65 49 189 24 8 -255 213 90 98 98 106 57 57 65 diff --git a/graphics/pokemon/raichu/shiny.pal b/graphics/pokemon/raichu/shiny.pal index 5177b62f932e..385105d2913c 100644 --- a/graphics/pokemon/raichu/shiny.pal +++ b/graphics/pokemon/raichu/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -80 16 16 -136 104 32 -16 16 16 -112 64 48 -184 160 104 -144 40 32 -216 208 152 -240 128 56 -216 88 64 -248 232 208 -176 64 48 -184 40 24 -224 184 128 -96 96 104 -56 56 64 +0 0 0 +255 230 213 +230 197 156 +246 123 32 +222 74 49 +189 57 32 +148 41 32 +82 16 16 +222 205 131 +189 164 90 +139 98 16 +115 65 49 +189 24 8 +98 98 106 +57 57 65 diff --git a/graphics/pokemon/raikou/icon.png b/graphics/pokemon/raikou/icon.png index 77cc29d7e9f2..4c3c91819876 100644 Binary files a/graphics/pokemon/raikou/icon.png and b/graphics/pokemon/raikou/icon.png differ diff --git a/graphics/pokemon/rapidash/anim_front.png b/graphics/pokemon/rapidash/anim_front.png index c4ee2d83f1a6..34d8eda27262 100644 Binary files a/graphics/pokemon/rapidash/anim_front.png and b/graphics/pokemon/rapidash/anim_front.png differ diff --git a/graphics/pokemon/rapidash/back.png b/graphics/pokemon/rapidash/back.png index 18af4e46a900..58330ba9833e 100644 Binary files a/graphics/pokemon/rapidash/back.png and b/graphics/pokemon/rapidash/back.png differ diff --git a/graphics/pokemon/rapidash/icon.png b/graphics/pokemon/rapidash/icon.png index a15a0a18a207..606cb7234e0f 100644 Binary files a/graphics/pokemon/rapidash/icon.png and b/graphics/pokemon/rapidash/icon.png differ diff --git a/graphics/pokemon/rapidash/normal.pal b/graphics/pokemon/rapidash/normal.pal index a55c358abd7f..9adbea5028f8 100644 --- a/graphics/pokemon/rapidash/normal.pal +++ b/graphics/pokemon/rapidash/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -255 156 24 -230 98 41 -222 16 16 -255 222 82 -139 82 49 +0 0 0 +255 255 255 255 230 197 -16 16 16 -197 148 106 238 197 139 -168 72 64 +197 148 106 +139 82 49 +115 49 49 +222 16 16 +230 98 41 +255 156 24 +255 222 82 197 197 197 -255 255 255 -248 160 152 115 123 131 65 74 82 +0 0 0 diff --git a/graphics/pokemon/rapidash/shiny.pal b/graphics/pokemon/rapidash/shiny.pal index e879ee424bab..0d72a91bd6e9 100644 --- a/graphics/pokemon/rapidash/shiny.pal +++ b/graphics/pokemon/rapidash/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -168 168 184 -136 136 160 -104 104 120 -192 192 216 -128 80 64 -248 240 208 -16 16 16 -200 168 120 -232 216 152 -104 104 120 -192 192 192 -248 248 248 -168 168 184 -112 120 128 -64 72 80 +0 0 0 +255 255 255 +255 246 213 +238 222 164 +189 172 106 +156 115 74 +131 82 65 +106 106 123 +131 131 148 +156 156 172 +197 197 222 +197 197 197 +115 123 131 +65 74 82 +0 0 0 diff --git a/graphics/pokemon/raticate/anim_front.png b/graphics/pokemon/raticate/anim_front.png index c6d38b5c2256..749a46a485cb 100644 Binary files a/graphics/pokemon/raticate/anim_front.png and b/graphics/pokemon/raticate/anim_front.png differ diff --git a/graphics/pokemon/raticate/anim_frontf.png b/graphics/pokemon/raticate/anim_frontf.png new file mode 100644 index 000000000000..4fe376077483 Binary files /dev/null and b/graphics/pokemon/raticate/anim_frontf.png differ diff --git a/graphics/pokemon/raticate/back.png b/graphics/pokemon/raticate/back.png index dadf090ba067..3131c485df7e 100644 Binary files a/graphics/pokemon/raticate/back.png and b/graphics/pokemon/raticate/back.png differ diff --git a/graphics/pokemon/raticate/backf.png b/graphics/pokemon/raticate/backf.png new file mode 100644 index 000000000000..dbf7f8bef3b3 Binary files /dev/null and b/graphics/pokemon/raticate/backf.png differ diff --git a/graphics/pokemon/raticate/normal.pal b/graphics/pokemon/raticate/normal.pal index b02c703c29c6..2bf8c9eba1dc 100644 --- a/graphics/pokemon/raticate/normal.pal +++ b/graphics/pokemon/raticate/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -148 82 16 -197 131 82 +255 255 255 255 205 156 -16 16 16 -106 57 0 +197 131 82 +148 82 16 +246 246 164 +238 205 115 +164 131 49 +131 90 41 +222 180 74 197 148 57 164 115 41 -222 180 74 +106 57 0 180 180 180 -255 255 255 -131 90 41 -246 246 164 -238 205 115 115 115 115 -164 131 49 +16 16 16 diff --git a/graphics/pokemon/raticate/shiny.pal b/graphics/pokemon/raticate/shiny.pal index 96b6128bb88f..bf3ef687efad 100644 --- a/graphics/pokemon/raticate/shiny.pal +++ b/graphics/pokemon/raticate/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -144 80 16 -192 128 80 -248 200 152 +152 160 208 +255 255 255 +255 205 156 +197 131 82 +148 82 16 +230 246 189 +213 230 139 +156 172 65 +131 131 49 +238 148 74 +213 115 57 +180 82 41 +123 24 0 +180 180 180 +115 115 115 16 16 16 -120 24 0 -208 112 56 -176 80 40 -232 144 72 -176 176 176 -248 248 248 -128 128 48 -224 240 184 -208 224 136 -112 112 112 -152 168 64 diff --git a/graphics/pokemon/rattata/anim_front.png b/graphics/pokemon/rattata/anim_front.png index 47d2ebff134e..dd52fb08f372 100644 Binary files a/graphics/pokemon/rattata/anim_front.png and b/graphics/pokemon/rattata/anim_front.png differ diff --git a/graphics/pokemon/rattata/anim_frontf.png b/graphics/pokemon/rattata/anim_frontf.png new file mode 100644 index 000000000000..a941ba16423d Binary files /dev/null and b/graphics/pokemon/rattata/anim_frontf.png differ diff --git a/graphics/pokemon/rattata/back.png b/graphics/pokemon/rattata/back.png index ff3dc10fc332..9e8c699bbc57 100644 Binary files a/graphics/pokemon/rattata/back.png and b/graphics/pokemon/rattata/back.png differ diff --git a/graphics/pokemon/rattata/backf.png b/graphics/pokemon/rattata/backf.png new file mode 100644 index 000000000000..c8d1a3de888f Binary files /dev/null and b/graphics/pokemon/rattata/backf.png differ diff --git a/graphics/pokemon/rattata/normal.pal b/graphics/pokemon/rattata/normal.pal index 8c69af29f783..d36de4ac5d91 100644 --- a/graphics/pokemon/rattata/normal.pal +++ b/graphics/pokemon/rattata/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -139 74 139 +255 255 255 +230 90 115 +164 24 57 +208 152 208 180 115 189 -213 148 213 +139 74 139 74 41 65 -16 16 16 -205 172 98 238 222 180 -205 205 205 +230 205 115 +205 172 98 164 115 8 -230 90 115 -255 255 255 -164 24 57 98 74 8 +205 205 205 90 90 90 -0 0 0 +16 16 16 diff --git a/graphics/pokemon/rattata/shiny.pal b/graphics/pokemon/rattata/shiny.pal index e0d5ee48e96d..fcba5ae25a92 100644 --- a/graphics/pokemon/rattata/shiny.pal +++ b/graphics/pokemon/rattata/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -144 136 56 -192 192 104 -224 224 136 -104 88 16 +208 152 208 +255 255 255 +123 139 222 +65 82 164 +230 230 139 +197 197 106 +148 139 57 +106 90 16 +230 213 197 +222 197 131 +197 164 115 +156 106 32 +90 65 32 +205 205 205 +90 90 90 16 16 16 -192 160 112 -224 208 192 -200 200 200 -152 104 32 -120 136 216 -248 248 248 -64 80 160 -88 64 32 -88 88 88 -144 136 56 diff --git a/graphics/pokemon/relicanth/anim_front.png b/graphics/pokemon/relicanth/anim_front.png index 575db345cbe7..c93761ec3df2 100644 Binary files a/graphics/pokemon/relicanth/anim_front.png and b/graphics/pokemon/relicanth/anim_front.png differ diff --git a/graphics/pokemon/relicanth/anim_frontf.png b/graphics/pokemon/relicanth/anim_frontf.png new file mode 100644 index 000000000000..1ff9f7ba30df Binary files /dev/null and b/graphics/pokemon/relicanth/anim_frontf.png differ diff --git a/graphics/pokemon/relicanth/back.png b/graphics/pokemon/relicanth/back.png index 678602343ae7..e4d80ab976ee 100644 Binary files a/graphics/pokemon/relicanth/back.png and b/graphics/pokemon/relicanth/back.png differ diff --git a/graphics/pokemon/relicanth/backf.png b/graphics/pokemon/relicanth/backf.png new file mode 100644 index 000000000000..f900aa794f4f Binary files /dev/null and b/graphics/pokemon/relicanth/backf.png differ diff --git a/graphics/pokemon/reshiram/back.png b/graphics/pokemon/reshiram/back.png index 2738d144eede..ed5787f954a0 100644 Binary files a/graphics/pokemon/reshiram/back.png and b/graphics/pokemon/reshiram/back.png differ diff --git a/graphics/pokemon/reshiram/icon.png b/graphics/pokemon/reshiram/icon.png index 9bd6457f3ea9..503be04a9b82 100644 Binary files a/graphics/pokemon/reshiram/icon.png and b/graphics/pokemon/reshiram/icon.png differ diff --git a/graphics/pokemon/reuniclus/anim_front.png b/graphics/pokemon/reuniclus/anim_front.png index c635f0befa06..77213921fc8e 100644 Binary files a/graphics/pokemon/reuniclus/anim_front.png and b/graphics/pokemon/reuniclus/anim_front.png differ diff --git a/graphics/pokemon/rhydon/anim_front.png b/graphics/pokemon/rhydon/anim_front.png index bd8e5391e0b3..758a245b5891 100644 Binary files a/graphics/pokemon/rhydon/anim_front.png and b/graphics/pokemon/rhydon/anim_front.png differ diff --git a/graphics/pokemon/rhydon/anim_frontf.png b/graphics/pokemon/rhydon/anim_frontf.png new file mode 100644 index 000000000000..31fdb1e04f6b Binary files /dev/null and b/graphics/pokemon/rhydon/anim_frontf.png differ diff --git a/graphics/pokemon/rhydon/backf.png b/graphics/pokemon/rhydon/backf.png new file mode 100644 index 000000000000..4e40dc7798cf Binary files /dev/null and b/graphics/pokemon/rhydon/backf.png differ diff --git a/graphics/pokemon/rhyhorn/anim_front.png b/graphics/pokemon/rhyhorn/anim_front.png index 99cdb4107d0d..589b7c2f98d5 100644 Binary files a/graphics/pokemon/rhyhorn/anim_front.png and b/graphics/pokemon/rhyhorn/anim_front.png differ diff --git a/graphics/pokemon/rhyhorn/anim_frontf.png b/graphics/pokemon/rhyhorn/anim_frontf.png new file mode 100644 index 000000000000..c086ed4d96f2 Binary files /dev/null and b/graphics/pokemon/rhyhorn/anim_frontf.png differ diff --git a/graphics/pokemon/rhyhorn/backf.png b/graphics/pokemon/rhyhorn/backf.png new file mode 100644 index 000000000000..c5a253b3bec9 Binary files /dev/null and b/graphics/pokemon/rhyhorn/backf.png differ diff --git a/graphics/pokemon/rhyperior/anim_frontf.png b/graphics/pokemon/rhyperior/anim_frontf.png new file mode 100644 index 000000000000..a7f373393240 Binary files /dev/null and b/graphics/pokemon/rhyperior/anim_frontf.png differ diff --git a/graphics/pokemon/rhyperior/backf.png b/graphics/pokemon/rhyperior/backf.png new file mode 100644 index 000000000000..a976be2244de Binary files /dev/null and b/graphics/pokemon/rhyperior/backf.png differ diff --git a/graphics/pokemon/riolu/back.png b/graphics/pokemon/riolu/back.png index 10d47dfd5835..faf590fde0ae 100644 Binary files a/graphics/pokemon/riolu/back.png and b/graphics/pokemon/riolu/back.png differ diff --git a/graphics/pokemon/rolycoly/anim_front.png b/graphics/pokemon/rolycoly/anim_front.png new file mode 100644 index 000000000000..0bd7ab0822dc Binary files /dev/null and b/graphics/pokemon/rolycoly/anim_front.png differ diff --git a/graphics/pokemon/rolycoly/front.png b/graphics/pokemon/rolycoly/front.png deleted file mode 100644 index b379710ca4b4..000000000000 Binary files a/graphics/pokemon/rolycoly/front.png and /dev/null differ diff --git a/graphics/pokemon/rookidee/anim_front.png b/graphics/pokemon/rookidee/anim_front.png new file mode 100644 index 000000000000..c9447052d1a5 Binary files /dev/null and b/graphics/pokemon/rookidee/anim_front.png differ diff --git a/graphics/pokemon/rookidee/front.png b/graphics/pokemon/rookidee/front.png deleted file mode 100644 index cb5da9a9ab71..000000000000 Binary files a/graphics/pokemon/rookidee/front.png and /dev/null differ diff --git a/graphics/pokemon/roselia/anim_front.png b/graphics/pokemon/roselia/anim_front.png index 270ab0bf0a99..218bac70d9ab 100644 Binary files a/graphics/pokemon/roselia/anim_front.png and b/graphics/pokemon/roselia/anim_front.png differ diff --git a/graphics/pokemon/roselia/anim_frontf.png b/graphics/pokemon/roselia/anim_frontf.png new file mode 100644 index 000000000000..ba9bec276437 Binary files /dev/null and b/graphics/pokemon/roselia/anim_frontf.png differ diff --git a/graphics/pokemon/roselia/backf.png b/graphics/pokemon/roselia/backf.png new file mode 100644 index 000000000000..27ff84ec68c5 Binary files /dev/null and b/graphics/pokemon/roselia/backf.png differ diff --git a/graphics/pokemon/roserade/anim_front.png b/graphics/pokemon/roserade/anim_front.png index b34276d0eff7..5630199f799e 100644 Binary files a/graphics/pokemon/roserade/anim_front.png and b/graphics/pokemon/roserade/anim_front.png differ diff --git a/graphics/pokemon/roserade/anim_frontf.png b/graphics/pokemon/roserade/anim_frontf.png new file mode 100644 index 000000000000..b6bcee6a9bbd Binary files /dev/null and b/graphics/pokemon/roserade/anim_frontf.png differ diff --git a/graphics/pokemon/roserade/backf.png b/graphics/pokemon/roserade/backf.png new file mode 100644 index 000000000000..1b037aada617 Binary files /dev/null and b/graphics/pokemon/roserade/backf.png differ diff --git a/graphics/pokemon/rotom/icon.png b/graphics/pokemon/rotom/icon.png index e2ecc8b804e0..9e54da11af61 100644 Binary files a/graphics/pokemon/rotom/icon.png and b/graphics/pokemon/rotom/icon.png differ diff --git a/graphics/pokemon/rufflet/icon.png b/graphics/pokemon/rufflet/icon.png index f9129355a3bb..94bba65e24f3 100644 Binary files a/graphics/pokemon/rufflet/icon.png and b/graphics/pokemon/rufflet/icon.png differ diff --git a/graphics/pokemon/salamence/icon.png b/graphics/pokemon/salamence/icon.png index 74b4ae776abf..76b1f448e5d1 100644 Binary files a/graphics/pokemon/salamence/icon.png and b/graphics/pokemon/salamence/icon.png differ diff --git a/graphics/pokemon/salandit/anim_front.png b/graphics/pokemon/salandit/anim_front.png new file mode 100644 index 000000000000..6bcd63d4d314 Binary files /dev/null and b/graphics/pokemon/salandit/anim_front.png differ diff --git a/graphics/pokemon/salandit/back.png b/graphics/pokemon/salandit/back.png index 36a623c94126..461f7015a3ad 100644 Binary files a/graphics/pokemon/salandit/back.png and b/graphics/pokemon/salandit/back.png differ diff --git a/graphics/pokemon/salandit/front.png b/graphics/pokemon/salandit/front.png deleted file mode 100644 index 33f5fa26fe68..000000000000 Binary files a/graphics/pokemon/salandit/front.png and /dev/null differ diff --git a/graphics/pokemon/salazzle/anim_front.png b/graphics/pokemon/salazzle/anim_front.png new file mode 100644 index 000000000000..d169166ecdbf Binary files /dev/null and b/graphics/pokemon/salazzle/anim_front.png differ diff --git a/graphics/pokemon/salazzle/front.png b/graphics/pokemon/salazzle/front.png deleted file mode 100644 index ca66daa78e74..000000000000 Binary files a/graphics/pokemon/salazzle/front.png and /dev/null differ diff --git a/graphics/pokemon/samurott/hisuian/back.png b/graphics/pokemon/samurott/hisuian/back.png index 36ed737d3e1c..92c787cda0d6 100755 Binary files a/graphics/pokemon/samurott/hisuian/back.png and b/graphics/pokemon/samurott/hisuian/back.png differ diff --git a/graphics/pokemon/sandile/anim_front.png b/graphics/pokemon/sandile/anim_front.png index 40d559ea2078..24d3545a42c0 100644 Binary files a/graphics/pokemon/sandile/anim_front.png and b/graphics/pokemon/sandile/anim_front.png differ diff --git a/graphics/pokemon/sandshrew/anim_front.png b/graphics/pokemon/sandshrew/anim_front.png index be1d37650342..cd573e51f87b 100644 Binary files a/graphics/pokemon/sandshrew/anim_front.png and b/graphics/pokemon/sandshrew/anim_front.png differ diff --git a/graphics/pokemon/sandshrew/back.png b/graphics/pokemon/sandshrew/back.png index f8a0c9ce2431..42c6f96595f0 100644 Binary files a/graphics/pokemon/sandshrew/back.png and b/graphics/pokemon/sandshrew/back.png differ diff --git a/graphics/pokemon/sandshrew/normal.pal b/graphics/pokemon/sandshrew/normal.pal index a2d45c33be98..fe0c6179e1b5 100644 --- a/graphics/pokemon/sandshrew/normal.pal +++ b/graphics/pokemon/sandshrew/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -131 98 16 +255 255 255 +255 0 255 238 222 16 -205 189 180 -16 16 16 205 180 0 -176 128 16 -232 232 200 -16 56 120 -248 248 248 -40 120 200 -232 216 200 -128 128 128 -200 200 200 +180 131 16 +131 98 16 115 74 24 -0 0 0 +40 120 200 +16 56 120 +205 189 180 +230 213 197 +238 238 222 +131 131 131 +82 82 82 +16 16 16 diff --git a/graphics/pokemon/sandshrew/shiny.pal b/graphics/pokemon/sandshrew/shiny.pal index 4ee0966b0502..dbba31d65df5 100644 --- a/graphics/pokemon/sandshrew/shiny.pal +++ b/graphics/pokemon/sandshrew/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -64 96 64 -168 216 72 -192 184 184 -16 16 16 -136 176 64 -104 128 72 -224 232 224 -24 48 88 -248 248 248 +208 152 160 +255 255 255 +255 0 255 +172 222 74 +139 180 65 +106 131 74 +65 98 65 +49 74 49 48 96 144 -216 208 200 -128 128 128 -200 200 200 -0 0 0 -0 0 0 +24 44 88 +197 189 189 +222 213 205 +230 238 230 +131 131 131 +82 82 82 +16 16 16 diff --git a/graphics/pokemon/sandslash/anim_front.png b/graphics/pokemon/sandslash/anim_front.png index 99b6417fb9eb..b43561b116fc 100644 Binary files a/graphics/pokemon/sandslash/anim_front.png and b/graphics/pokemon/sandslash/anim_front.png differ diff --git a/graphics/pokemon/sandslash/back.png b/graphics/pokemon/sandslash/back.png index cb4b5697c867..0813bc9f987f 100644 Binary files a/graphics/pokemon/sandslash/back.png and b/graphics/pokemon/sandslash/back.png differ diff --git a/graphics/pokemon/sandslash/icon.png b/graphics/pokemon/sandslash/icon.png index 18970df1555d..aff0689d42ca 100644 Binary files a/graphics/pokemon/sandslash/icon.png and b/graphics/pokemon/sandslash/icon.png differ diff --git a/graphics/pokemon/sandslash/normal.pal b/graphics/pokemon/sandslash/normal.pal index ff473ca5e1ec..5ede9a66692d 100644 --- a/graphics/pokemon/sandslash/normal.pal +++ b/graphics/pokemon/sandslash/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -74 57 16 -172 131 49 -16 16 16 -148 123 0 -139 98 24 +255 238 115 +246 213 32 213 172 32 +148 123 0 90 74 0 -246 213 32 255 255 255 -139 139 139 222 213 180 -200 200 208 -48 48 72 +197 180 123 +139 139 139 82 82 82 -0 0 0 +205 164 74 +172 131 49 +139 98 24 +74 57 16 +16 16 16 diff --git a/graphics/pokemon/sandslash/shiny.pal b/graphics/pokemon/sandslash/shiny.pal index 86e888dbb7cd..63da4f4e7119 100644 --- a/graphics/pokemon/sandslash/shiny.pal +++ b/graphics/pokemon/sandslash/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -112 0 16 -216 48 64 +255 246 189 +213 197 123 +172 148 98 +131 115 41 +90 74 0 +255 255 255 +222 205 189 +197 172 131 +139 139 139 +82 82 82 +255 98 98 +222 49 65 +189 8 32 +74 57 16 16 16 16 -120 104 56 -184 8 32 -168 144 96 -72 56 16 -208 192 120 -248 248 248 -136 136 136 -216 200 184 -200 200 208 -48 48 72 -80 80 80 -255 0 0 diff --git a/graphics/pokemon/sawsbuck/autumn/back.png b/graphics/pokemon/sawsbuck/autumn/back.png index 3d32c819b4b6..59a0520be59b 100644 Binary files a/graphics/pokemon/sawsbuck/autumn/back.png and b/graphics/pokemon/sawsbuck/autumn/back.png differ diff --git a/graphics/pokemon/sawsbuck/autumn/icon.png b/graphics/pokemon/sawsbuck/autumn/icon.png index bbbabecf1eb1..7c38538a3816 100644 Binary files a/graphics/pokemon/sawsbuck/autumn/icon.png and b/graphics/pokemon/sawsbuck/autumn/icon.png differ diff --git a/graphics/pokemon/sawsbuck/summer/back.png b/graphics/pokemon/sawsbuck/summer/back.png index aee6937c4bd5..b9ff2e903a54 100644 Binary files a/graphics/pokemon/sawsbuck/summer/back.png and b/graphics/pokemon/sawsbuck/summer/back.png differ diff --git a/graphics/pokemon/sawsbuck/summer/icon.png b/graphics/pokemon/sawsbuck/summer/icon.png index 6d46101dd17c..94d78a99df80 100644 Binary files a/graphics/pokemon/sawsbuck/summer/icon.png and b/graphics/pokemon/sawsbuck/summer/icon.png differ diff --git a/graphics/pokemon/sawsbuck/winter/icon.png b/graphics/pokemon/sawsbuck/winter/icon.png index ecb6ce1adef5..e5cdbd2a1173 100644 Binary files a/graphics/pokemon/sawsbuck/winter/icon.png and b/graphics/pokemon/sawsbuck/winter/icon.png differ diff --git a/graphics/pokemon/scizor/anim_frontf.png b/graphics/pokemon/scizor/anim_frontf.png new file mode 100644 index 000000000000..161c28cb5b6a Binary files /dev/null and b/graphics/pokemon/scizor/anim_frontf.png differ diff --git a/graphics/pokemon/scraggy/icon.png b/graphics/pokemon/scraggy/icon.png index f1baf8d0783d..de0377438a3d 100644 Binary files a/graphics/pokemon/scraggy/icon.png and b/graphics/pokemon/scraggy/icon.png differ diff --git a/graphics/pokemon/scyther/anim_front.png b/graphics/pokemon/scyther/anim_front.png index c253d771b796..6307f27b02ee 100644 Binary files a/graphics/pokemon/scyther/anim_front.png and b/graphics/pokemon/scyther/anim_front.png differ diff --git a/graphics/pokemon/scyther/anim_frontf.png b/graphics/pokemon/scyther/anim_frontf.png new file mode 100644 index 000000000000..38d5b859e75e Binary files /dev/null and b/graphics/pokemon/scyther/anim_frontf.png differ diff --git a/graphics/pokemon/seadra/anim_front.png b/graphics/pokemon/seadra/anim_front.png index 5c64799f7bcb..66aada562044 100644 Binary files a/graphics/pokemon/seadra/anim_front.png and b/graphics/pokemon/seadra/anim_front.png differ diff --git a/graphics/pokemon/seaking/anim_front.png b/graphics/pokemon/seaking/anim_front.png index d67854c5182f..aa403fca8a8a 100644 Binary files a/graphics/pokemon/seaking/anim_front.png and b/graphics/pokemon/seaking/anim_front.png differ diff --git a/graphics/pokemon/seaking/anim_frontf.png b/graphics/pokemon/seaking/anim_frontf.png new file mode 100644 index 000000000000..0ed5b9a2722c Binary files /dev/null and b/graphics/pokemon/seaking/anim_frontf.png differ diff --git a/graphics/pokemon/seaking/backf.png b/graphics/pokemon/seaking/backf.png new file mode 100644 index 000000000000..390a13592682 Binary files /dev/null and b/graphics/pokemon/seaking/backf.png differ diff --git a/graphics/pokemon/sealeo/back.png b/graphics/pokemon/sealeo/back.png index 84a89788b3f7..ea0d8f473b00 100644 Binary files a/graphics/pokemon/sealeo/back.png and b/graphics/pokemon/sealeo/back.png differ diff --git a/graphics/pokemon/seedot/anim_front.png b/graphics/pokemon/seedot/anim_front.png index 8f99f309031e..299c833ca96c 100644 Binary files a/graphics/pokemon/seedot/anim_front.png and b/graphics/pokemon/seedot/anim_front.png differ diff --git a/graphics/pokemon/seel/anim_front.png b/graphics/pokemon/seel/anim_front.png index 4361b9086a6c..9626b88941e7 100644 Binary files a/graphics/pokemon/seel/anim_front.png and b/graphics/pokemon/seel/anim_front.png differ diff --git a/graphics/pokemon/sentret/anim_front.png b/graphics/pokemon/sentret/anim_front.png index 9986d9d940e0..c5a365dee04b 100644 Binary files a/graphics/pokemon/sentret/anim_front.png and b/graphics/pokemon/sentret/anim_front.png differ diff --git a/graphics/pokemon/sentret/icon.png b/graphics/pokemon/sentret/icon.png index e95d75ccd41e..7656279a00ec 100644 Binary files a/graphics/pokemon/sentret/icon.png and b/graphics/pokemon/sentret/icon.png differ diff --git a/graphics/pokemon/seviper/icon.png b/graphics/pokemon/seviper/icon.png index f6beb9f8561b..02ca999991db 100644 Binary files a/graphics/pokemon/seviper/icon.png and b/graphics/pokemon/seviper/icon.png differ diff --git a/graphics/pokemon/sewaddle/icon.png b/graphics/pokemon/sewaddle/icon.png index ae517307b41e..047285e9f18a 100644 Binary files a/graphics/pokemon/sewaddle/icon.png and b/graphics/pokemon/sewaddle/icon.png differ diff --git a/graphics/pokemon/sharpedo/icon.png b/graphics/pokemon/sharpedo/icon.png index 87a1c7e40948..1f3d9ebf5a0d 100644 Binary files a/graphics/pokemon/sharpedo/icon.png and b/graphics/pokemon/sharpedo/icon.png differ diff --git a/graphics/pokemon/shellder/icon.png b/graphics/pokemon/shellder/icon.png index 8ffeb3edfa95..a7f4b52e5e5f 100644 Binary files a/graphics/pokemon/shellder/icon.png and b/graphics/pokemon/shellder/icon.png differ diff --git a/graphics/pokemon/shellos/east_sea/back.png b/graphics/pokemon/shellos/east_sea/back.png index 2cb650a28c56..bc1250a0da3c 100644 Binary files a/graphics/pokemon/shellos/east_sea/back.png and b/graphics/pokemon/shellos/east_sea/back.png differ diff --git a/graphics/pokemon/shellos/east_sea/icon.png b/graphics/pokemon/shellos/east_sea/icon.png index 35610eb27c3f..7fdf5db7a24b 100644 Binary files a/graphics/pokemon/shellos/east_sea/icon.png and b/graphics/pokemon/shellos/east_sea/icon.png differ diff --git a/graphics/pokemon/shiftry/anim_frontf.png b/graphics/pokemon/shiftry/anim_frontf.png new file mode 100644 index 000000000000..2559dff82ffe Binary files /dev/null and b/graphics/pokemon/shiftry/anim_frontf.png differ diff --git a/graphics/pokemon/shiftry/backf.png b/graphics/pokemon/shiftry/backf.png new file mode 100644 index 000000000000..226d98cfd320 Binary files /dev/null and b/graphics/pokemon/shiftry/backf.png differ diff --git a/graphics/pokemon/shiftry/icon.png b/graphics/pokemon/shiftry/icon.png index 3d2be13a6852..2d615818a6c9 100644 Binary files a/graphics/pokemon/shiftry/icon.png and b/graphics/pokemon/shiftry/icon.png differ diff --git a/graphics/pokemon/shinx/anim_front.png b/graphics/pokemon/shinx/anim_front.png index c46f6c259ff9..064589b33614 100644 Binary files a/graphics/pokemon/shinx/anim_front.png and b/graphics/pokemon/shinx/anim_front.png differ diff --git a/graphics/pokemon/shinx/anim_frontf.png b/graphics/pokemon/shinx/anim_frontf.png index 2ee34f09682b..8ebfd688f9d6 100644 Binary files a/graphics/pokemon/shinx/anim_frontf.png and b/graphics/pokemon/shinx/anim_frontf.png differ diff --git a/graphics/pokemon/shinx/back.png b/graphics/pokemon/shinx/back.png index 5d693fca8ae4..8232bcc72cdb 100644 Binary files a/graphics/pokemon/shinx/back.png and b/graphics/pokemon/shinx/back.png differ diff --git a/graphics/pokemon/shinx/backf.png b/graphics/pokemon/shinx/backf.png index 805ee62ee39b..cc02626f8a5b 100644 Binary files a/graphics/pokemon/shinx/backf.png and b/graphics/pokemon/shinx/backf.png differ diff --git a/graphics/pokemon/shuppet/anim_front.png b/graphics/pokemon/shuppet/anim_front.png index fe5e682d36a9..2a90da2637ca 100644 Binary files a/graphics/pokemon/shuppet/anim_front.png and b/graphics/pokemon/shuppet/anim_front.png differ diff --git a/graphics/pokemon/shuppet/back.png b/graphics/pokemon/shuppet/back.png index c25c8567e03b..d1f0b8b8cbee 100644 Binary files a/graphics/pokemon/shuppet/back.png and b/graphics/pokemon/shuppet/back.png differ diff --git a/graphics/pokemon/sigilyph/icon.png b/graphics/pokemon/sigilyph/icon.png index afaf880d5401..bcc249d783e2 100644 Binary files a/graphics/pokemon/sigilyph/icon.png and b/graphics/pokemon/sigilyph/icon.png differ diff --git a/graphics/pokemon/silvally/back.png b/graphics/pokemon/silvally/back.png index 94c3826cbd69..dffe1c87bd6c 100644 Binary files a/graphics/pokemon/silvally/back.png and b/graphics/pokemon/silvally/back.png differ diff --git a/graphics/pokemon/silvally/front.png b/graphics/pokemon/silvally/front.png index 01d9f14a9c39..1376731e6d95 100644 Binary files a/graphics/pokemon/silvally/front.png and b/graphics/pokemon/silvally/front.png differ diff --git a/graphics/pokemon/sirfetchd/front.png b/graphics/pokemon/sirfetchd/front.png index 3ae79de6e604..4613cd935d58 100644 Binary files a/graphics/pokemon/sirfetchd/front.png and b/graphics/pokemon/sirfetchd/front.png differ diff --git a/graphics/pokemon/sizzlipede/anim_front.png b/graphics/pokemon/sizzlipede/anim_front.png new file mode 100644 index 000000000000..21b275df39e3 Binary files /dev/null and b/graphics/pokemon/sizzlipede/anim_front.png differ diff --git a/graphics/pokemon/sizzlipede/front.png b/graphics/pokemon/sizzlipede/front.png deleted file mode 100644 index a5d40b987fa2..000000000000 Binary files a/graphics/pokemon/sizzlipede/front.png and /dev/null differ diff --git a/graphics/pokemon/slakoth/icon.png b/graphics/pokemon/slakoth/icon.png index e11811efe10b..ffca28d04d29 100644 Binary files a/graphics/pokemon/slakoth/icon.png and b/graphics/pokemon/slakoth/icon.png differ diff --git a/graphics/pokemon/sliggoo/hisuian/back.png b/graphics/pokemon/sliggoo/hisuian/back.png index 276ac9915232..362f66414f2a 100755 Binary files a/graphics/pokemon/sliggoo/hisuian/back.png and b/graphics/pokemon/sliggoo/hisuian/back.png differ diff --git a/graphics/pokemon/sliggoo/hisuian/front.png b/graphics/pokemon/sliggoo/hisuian/front.png index 3b9edc41cfba..7db0386772d4 100755 Binary files a/graphics/pokemon/sliggoo/hisuian/front.png and b/graphics/pokemon/sliggoo/hisuian/front.png differ diff --git a/graphics/pokemon/slowbro/anim_front.png b/graphics/pokemon/slowbro/anim_front.png index 0030c95633ba..3e05e62035c7 100644 Binary files a/graphics/pokemon/slowbro/anim_front.png and b/graphics/pokemon/slowbro/anim_front.png differ diff --git a/graphics/pokemon/slowbro/back.png b/graphics/pokemon/slowbro/back.png index 48ad3fbcb6ff..88d6cf1a8307 100644 Binary files a/graphics/pokemon/slowbro/back.png and b/graphics/pokemon/slowbro/back.png differ diff --git a/graphics/pokemon/slowbro/normal.pal b/graphics/pokemon/slowbro/normal.pal index ae4d12a99203..acd3ce77c428 100644 --- a/graphics/pokemon/slowbro/normal.pal +++ b/graphics/pokemon/slowbro/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -123 49 49 -230 106 123 -255 148 148 -24 24 24 -255 189 172 -248 248 248 -216 216 208 -82 82 90 -139 148 148 -131 90 32 -180 189 189 +255 255 255 255 238 180 238 213 131 205 164 98 -232 80 40 +131 90 32 +222 222 213 +180 189 189 +139 148 148 +82 82 90 +230 82 41 +255 189 172 +255 148 148 +230 104 120 +120 48 48 +24 24 24 diff --git a/graphics/pokemon/slowbro/shiny.pal b/graphics/pokemon/slowbro/shiny.pal index 477035fb4346..e129fdff3b52 100644 --- a/graphics/pokemon/slowbro/shiny.pal +++ b/graphics/pokemon/slowbro/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -80 56 128 -136 112 184 -168 144 248 +255 255 255 +246 238 189 +230 205 139 +197 156 106 +123 90 41 +230 205 98 +205 172 74 +164 123 41 +123 82 41 +230 82 41 +205 189 255 +172 148 255 +131 106 189 +106 65 172 24 24 24 -200 184 248 -248 248 248 -216 216 208 -96 64 40 -152 120 64 -120 88 40 -200 176 104 -240 232 184 -224 200 136 -192 152 104 -224 112 80 diff --git a/graphics/pokemon/slowking/icon.png b/graphics/pokemon/slowking/icon.png index 8527e8982de1..78d912cff911 100644 Binary files a/graphics/pokemon/slowking/icon.png and b/graphics/pokemon/slowking/icon.png differ diff --git a/graphics/pokemon/slowpoke/anim_front.png b/graphics/pokemon/slowpoke/anim_front.png index 61740747b518..8b709c6e4e85 100644 Binary files a/graphics/pokemon/slowpoke/anim_front.png and b/graphics/pokemon/slowpoke/anim_front.png differ diff --git a/graphics/pokemon/slowpoke/back.png b/graphics/pokemon/slowpoke/back.png index e2ff691a06f3..d3558871264f 100644 Binary files a/graphics/pokemon/slowpoke/back.png and b/graphics/pokemon/slowpoke/back.png differ diff --git a/graphics/pokemon/slowpoke/normal.pal b/graphics/pokemon/slowpoke/normal.pal index b07163f93aa1..402c21c4a14c 100644 --- a/graphics/pokemon/slowpoke/normal.pal +++ b/graphics/pokemon/slowpoke/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -168 64 80 -216 96 120 -248 160 160 -248 128 144 -120 32 48 -104 96 96 -208 200 200 -248 248 248 16 16 16 -216 160 96 -136 88 24 -248 224 176 -232 192 136 -248 224 176 -0 0 0 +255 255 255 +213 205 205 +106 98 98 +255 230 180 +238 197 139 +222 164 98 +139 90 24 +255 164 164 +255 131 148 +222 98 123 +172 65 82 +123 32 49 +255 131 148 +222 98 123 diff --git a/graphics/pokemon/slowpoke/shiny.pal b/graphics/pokemon/slowpoke/shiny.pal index eba9b8ae4c47..b830d7165232 100644 --- a/graphics/pokemon/slowpoke/shiny.pal +++ b/graphics/pokemon/slowpoke/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -168 112 120 -192 136 160 -248 208 224 -224 176 192 -128 72 80 -104 96 96 -208 200 200 -248 248 248 16 16 16 -216 176 88 -136 104 16 -248 240 176 -232 208 128 -248 248 248 -232 208 224 +255 255 255 +213 205 205 +106 98 98 +255 246 180 +238 213 131 +222 180 90 +139 106 16 +255 213 230 +230 180 197 +197 139 164 +172 115 123 +131 74 82 +255 131 148 +222 98 123 diff --git a/graphics/pokemon/sneasel/anim_frontf.png b/graphics/pokemon/sneasel/anim_frontf.png new file mode 100644 index 000000000000..8b9a6a3e4df6 Binary files /dev/null and b/graphics/pokemon/sneasel/anim_frontf.png differ diff --git a/graphics/pokemon/sneasel/backf.png b/graphics/pokemon/sneasel/backf.png new file mode 100644 index 000000000000..29a6650ec541 Binary files /dev/null and b/graphics/pokemon/sneasel/backf.png differ diff --git a/graphics/pokemon/sneasel/hisuian/back.png b/graphics/pokemon/sneasel/hisuian/back.png index b37d22011839..168f1c7e5264 100755 Binary files a/graphics/pokemon/sneasel/hisuian/back.png and b/graphics/pokemon/sneasel/hisuian/back.png differ diff --git a/graphics/pokemon/sneasel/hisuian/backf.png b/graphics/pokemon/sneasel/hisuian/backf.png new file mode 100644 index 000000000000..7b6cc3a3f091 Binary files /dev/null and b/graphics/pokemon/sneasel/hisuian/backf.png differ diff --git a/graphics/pokemon/sneasel/hisuian/front.png b/graphics/pokemon/sneasel/hisuian/front.png index 75f42547e2b1..1d1c48c0488a 100755 Binary files a/graphics/pokemon/sneasel/hisuian/front.png and b/graphics/pokemon/sneasel/hisuian/front.png differ diff --git a/graphics/pokemon/sneasel/hisuian/frontf.png b/graphics/pokemon/sneasel/hisuian/frontf.png new file mode 100644 index 000000000000..3bf48c156481 Binary files /dev/null and b/graphics/pokemon/sneasel/hisuian/frontf.png differ diff --git a/graphics/pokemon/snorlax/anim_front.png b/graphics/pokemon/snorlax/anim_front.png index cfcd8e4aedc4..c49627333a6c 100644 Binary files a/graphics/pokemon/snorlax/anim_front.png and b/graphics/pokemon/snorlax/anim_front.png differ diff --git a/graphics/pokemon/snorlax/icon.png b/graphics/pokemon/snorlax/icon.png index 36aeeabee2f6..0b1aea4082cf 100644 Binary files a/graphics/pokemon/snorlax/icon.png and b/graphics/pokemon/snorlax/icon.png differ diff --git a/graphics/pokemon/snover/anim_frontf.png b/graphics/pokemon/snover/anim_frontf.png new file mode 100644 index 000000000000..64606881f88c Binary files /dev/null and b/graphics/pokemon/snover/anim_frontf.png differ diff --git a/graphics/pokemon/snover/backf.png b/graphics/pokemon/snover/backf.png new file mode 100644 index 000000000000..8a3ed308e4cf Binary files /dev/null and b/graphics/pokemon/snover/backf.png differ diff --git a/graphics/pokemon/snubbull/back.png b/graphics/pokemon/snubbull/back.png index fa403eba3e7e..0d558afdb2fe 100644 Binary files a/graphics/pokemon/snubbull/back.png and b/graphics/pokemon/snubbull/back.png differ diff --git a/graphics/pokemon/solrock/icon.png b/graphics/pokemon/solrock/icon.png index 07a416c28324..7133fc89a608 100644 Binary files a/graphics/pokemon/solrock/icon.png and b/graphics/pokemon/solrock/icon.png differ diff --git a/graphics/pokemon/spearow/anim_front.png b/graphics/pokemon/spearow/anim_front.png index c52e1ce2af7c..5b45394456be 100644 Binary files a/graphics/pokemon/spearow/anim_front.png and b/graphics/pokemon/spearow/anim_front.png differ diff --git a/graphics/pokemon/spearow/back.png b/graphics/pokemon/spearow/back.png index 6d5395837577..6e456b4da3ca 100644 Binary files a/graphics/pokemon/spearow/back.png and b/graphics/pokemon/spearow/back.png differ diff --git a/graphics/pokemon/spearow/normal.pal b/graphics/pokemon/spearow/normal.pal index 8eda920f0433..157c5d2f44ea 100644 --- a/graphics/pokemon/spearow/normal.pal +++ b/graphics/pokemon/spearow/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -156 82 24 -197 106 32 -106 65 24 -238 172 82 0 0 0 -238 82 74 -172 65 74 230 213 180 -255 255 255 +197 180 156 +139 123 98 +72 64 56 +238 172 82 +197 106 32 +156 82 24 +106 65 24 255 213 205 255 164 139 -197 180 156 +238 82 74 +172 65 74 123 41 41 -139 123 98 -98 82 74 +255 255 255 diff --git a/graphics/pokemon/spearow/shiny.pal b/graphics/pokemon/spearow/shiny.pal index 9f44b1ba5bdb..beaad33da136 100644 --- a/graphics/pokemon/spearow/shiny.pal +++ b/graphics/pokemon/spearow/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -144 160 24 -184 168 32 -128 120 16 -224 232 80 -16 16 16 -248 216 24 -224 160 40 -224 208 176 -248 248 248 -248 248 160 -240 232 96 -201 191 147 -160 104 32 -144 136 104 -80 72 56 +152 160 208 +0 0 0 +230 222 180 +197 189 156 +139 131 98 +98 90 74 +230 238 82 +189 172 32 +148 164 24 +131 123 16 +255 255 197 +255 246 115 +255 213 0 +238 164 0 +189 106 0 +255 255 255 diff --git a/graphics/pokemon/spheal/anim_front.png b/graphics/pokemon/spheal/anim_front.png index 31c4d81d1a4f..5ea0504180ee 100644 Binary files a/graphics/pokemon/spheal/anim_front.png and b/graphics/pokemon/spheal/anim_front.png differ diff --git a/graphics/pokemon/spheal/back.png b/graphics/pokemon/spheal/back.png index 5c23636edef6..d78b859d055e 100644 Binary files a/graphics/pokemon/spheal/back.png and b/graphics/pokemon/spheal/back.png differ diff --git a/graphics/pokemon/spinarak/anim_front.png b/graphics/pokemon/spinarak/anim_front.png index 0e2d525c4d70..3b2d405a747e 100644 Binary files a/graphics/pokemon/spinarak/anim_front.png and b/graphics/pokemon/spinarak/anim_front.png differ diff --git a/graphics/pokemon/spinda/anim_front.png b/graphics/pokemon/spinda/anim_front.png index 7ddfbef5171b..fb794df1d8d2 100644 Binary files a/graphics/pokemon/spinda/anim_front.png and b/graphics/pokemon/spinda/anim_front.png differ diff --git a/graphics/pokemon/spinda/back.png b/graphics/pokemon/spinda/back.png index c5f699e2cf61..4b4bc7ad3d61 100644 Binary files a/graphics/pokemon/spinda/back.png and b/graphics/pokemon/spinda/back.png differ diff --git a/graphics/pokemon/spinda/normal.pal b/graphics/pokemon/spinda/normal.pal index 9b0ad5bfc42d..3c347b1a361d 100644 --- a/graphics/pokemon/spinda/normal.pal +++ b/graphics/pokemon/spinda/normal.pal @@ -2,17 +2,17 @@ JASC-PAL 0100 16 49 164 82 -246 230 172 -230 213 164 -197 180 131 -172 148 106 -222 139 74 +251 245 223 +231 218 192 +209 186 158 +172 131 108 +242 136 54 222 106 57 -180 90 41 -156 57 24 +179 66 41 +154 35 24 115 65 16 -172 65 90 -255 255 0 +170 65 119 +242 115 166 255 255 0 123 98 74 90 65 49 diff --git a/graphics/pokemon/spinda/shiny.pal b/graphics/pokemon/spinda/shiny.pal index 6aa748129609..e44ef5181640 100644 --- a/graphics/pokemon/spinda/shiny.pal +++ b/graphics/pokemon/spinda/shiny.pal @@ -2,17 +2,17 @@ JASC-PAL 0100 16 49 164 82 -246 230 172 -230 213 164 -197 180 131 -172 148 106 +251 245 223 +231 218 192 +209 186 158 +172 131 108 180 197 90 -148 164 57 -115 131 24 -82 98 0 +134 162 57 +87 129 24 +46 97 0 49 65 0 -172 65 90 -255 255 0 +170 65 119 +242 115 166 255 255 0 123 98 74 90 65 49 diff --git a/graphics/pokemon/squirtle/anim_front.png b/graphics/pokemon/squirtle/anim_front.png index 5c32cf67fa27..fb84be176f64 100644 Binary files a/graphics/pokemon/squirtle/anim_front.png and b/graphics/pokemon/squirtle/anim_front.png differ diff --git a/graphics/pokemon/squirtle/back.png b/graphics/pokemon/squirtle/back.png index a57207153f15..6158ad507690 100644 Binary files a/graphics/pokemon/squirtle/back.png and b/graphics/pokemon/squirtle/back.png differ diff --git a/graphics/pokemon/squirtle/normal.pal b/graphics/pokemon/squirtle/normal.pal index b2282cee8b17..8be6934217e8 100644 --- a/graphics/pokemon/squirtle/normal.pal +++ b/graphics/pokemon/squirtle/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -90 156 164 -41 115 131 -180 230 238 -139 197 205 -16 16 16 -208 200 200 -248 248 248 -131 41 0 -88 64 32 +255 255 255 +205 197 197 +213 148 82 189 106 0 -205 123 41 -230 172 90 -255 213 106 98 41 0 -213 148 82 +255 230 156 +255 213 106 +230 172 90 +205 123 41 +123 49 8 +176 224 232 +136 192 200 +88 152 160 +40 112 128 +16 16 16 diff --git a/graphics/pokemon/squirtle/shiny.pal b/graphics/pokemon/squirtle/shiny.pal index ff20b8f51586..7ae46ab43d50 100644 --- a/graphics/pokemon/squirtle/shiny.pal +++ b/graphics/pokemon/squirtle/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -120 160 224 -64 96 128 -208 232 248 -176 200 248 +208 152 160 +255 255 255 +213 205 205 +156 222 123 +90 172 41 +16 90 16 +255 246 148 +255 230 98 +230 189 82 +205 139 32 +131 57 0 +230 246 255 +180 205 255 +123 164 230 +65 98 131 16 16 16 -208 200 200 -248 248 248 -128 56 0 -128 56 0 -88 168 40 -200 136 32 -224 184 80 -248 240 144 -16 88 16 -152 216 120 diff --git a/graphics/pokemon/staraptor/anim_frontf.png b/graphics/pokemon/staraptor/anim_frontf.png index 9bfd99e8074d..37e8b5cfe139 100644 Binary files a/graphics/pokemon/staraptor/anim_frontf.png and b/graphics/pokemon/staraptor/anim_frontf.png differ diff --git a/graphics/pokemon/staraptor/icon.png b/graphics/pokemon/staraptor/icon.png index ecad4e21bf6a..6753951d630f 100644 Binary files a/graphics/pokemon/staraptor/icon.png and b/graphics/pokemon/staraptor/icon.png differ diff --git a/graphics/pokemon/staravia/anim_frontf.png b/graphics/pokemon/staravia/anim_frontf.png index 1d4359a4d2d4..40de79a60864 100644 Binary files a/graphics/pokemon/staravia/anim_frontf.png and b/graphics/pokemon/staravia/anim_frontf.png differ diff --git a/graphics/pokemon/staravia/back.png b/graphics/pokemon/staravia/back.png index 672f9ca5605e..c5bdcb0a1fa1 100644 Binary files a/graphics/pokemon/staravia/back.png and b/graphics/pokemon/staravia/back.png differ diff --git a/graphics/pokemon/staravia/backf.png b/graphics/pokemon/staravia/backf.png index eab9fd834bdd..51fec5992db3 100644 Binary files a/graphics/pokemon/staravia/backf.png and b/graphics/pokemon/staravia/backf.png differ diff --git a/graphics/pokemon/staravia/icon.png b/graphics/pokemon/staravia/icon.png index 8fcb75d87903..c013e5aa7a26 100644 Binary files a/graphics/pokemon/staravia/icon.png and b/graphics/pokemon/staravia/icon.png differ diff --git a/graphics/pokemon/starly/anim_front.png b/graphics/pokemon/starly/anim_front.png index 1235ff408fce..b897ef874ac2 100644 Binary files a/graphics/pokemon/starly/anim_front.png and b/graphics/pokemon/starly/anim_front.png differ diff --git a/graphics/pokemon/starly/anim_frontf.png b/graphics/pokemon/starly/anim_frontf.png index f604a83871d3..7209679bfaa6 100644 Binary files a/graphics/pokemon/starly/anim_frontf.png and b/graphics/pokemon/starly/anim_frontf.png differ diff --git a/graphics/pokemon/starly/back.png b/graphics/pokemon/starly/back.png index 89148bc9f85e..abea0fd5ed50 100644 Binary files a/graphics/pokemon/starly/back.png and b/graphics/pokemon/starly/back.png differ diff --git a/graphics/pokemon/starly/backf.png b/graphics/pokemon/starly/backf.png index c65bf27b0e44..f1c45a7bc69c 100644 Binary files a/graphics/pokemon/starly/backf.png and b/graphics/pokemon/starly/backf.png differ diff --git a/graphics/pokemon/starly/shiny.pal b/graphics/pokemon/starly/shiny.pal index f077f7974690..c49fb7aed34a 100644 --- a/graphics/pokemon/starly/shiny.pal +++ b/graphics/pokemon/starly/shiny.pal @@ -4,7 +4,7 @@ JASC-PAL 152 208 160 96 64 48 16 16 16 -136 104 80 +164 115 82 56 24 24 216 200 160 248 248 248 @@ -14,6 +14,6 @@ JASC-PAL 208 152 0 192 152 128 160 112 80 -112 96 96 +139 98 74 247 82 66 0 0 0 diff --git a/graphics/pokemon/starmie/anim_front.png b/graphics/pokemon/starmie/anim_front.png index 0a912a022536..40dbb53866a7 100644 Binary files a/graphics/pokemon/starmie/anim_front.png and b/graphics/pokemon/starmie/anim_front.png differ diff --git a/graphics/pokemon/staryu/anim_front.png b/graphics/pokemon/staryu/anim_front.png index 38d62ffc8a00..a245451e7a0d 100644 Binary files a/graphics/pokemon/staryu/anim_front.png and b/graphics/pokemon/staryu/anim_front.png differ diff --git a/graphics/pokemon/steelix/anim_frontf.png b/graphics/pokemon/steelix/anim_frontf.png new file mode 100644 index 000000000000..7f4dc508ac85 Binary files /dev/null and b/graphics/pokemon/steelix/anim_frontf.png differ diff --git a/graphics/pokemon/steelix/backf.png b/graphics/pokemon/steelix/backf.png new file mode 100644 index 000000000000..5d1469b1139e Binary files /dev/null and b/graphics/pokemon/steelix/backf.png differ diff --git a/graphics/pokemon/steelix/icon.png b/graphics/pokemon/steelix/icon.png index defe78d7d6f5..c7a5c62bba6a 100644 Binary files a/graphics/pokemon/steelix/icon.png and b/graphics/pokemon/steelix/icon.png differ diff --git a/graphics/pokemon/stufful/anim_front.png b/graphics/pokemon/stufful/anim_front.png new file mode 100644 index 000000000000..2863d3849323 Binary files /dev/null and b/graphics/pokemon/stufful/anim_front.png differ diff --git a/graphics/pokemon/stufful/front.png b/graphics/pokemon/stufful/front.png deleted file mode 100644 index 606e99ef87f1..000000000000 Binary files a/graphics/pokemon/stufful/front.png and /dev/null differ diff --git a/graphics/pokemon/sudowoodo/anim_frontf.png b/graphics/pokemon/sudowoodo/anim_frontf.png new file mode 100644 index 000000000000..a88c9cc97c5f Binary files /dev/null and b/graphics/pokemon/sudowoodo/anim_frontf.png differ diff --git a/graphics/pokemon/sudowoodo/backf.png b/graphics/pokemon/sudowoodo/backf.png new file mode 100644 index 000000000000..2dc2b39938a0 Binary files /dev/null and b/graphics/pokemon/sudowoodo/backf.png differ diff --git a/graphics/pokemon/suicune/icon.png b/graphics/pokemon/suicune/icon.png index fbaff5a8cd76..2fb873ac70cc 100644 Binary files a/graphics/pokemon/suicune/icon.png and b/graphics/pokemon/suicune/icon.png differ diff --git a/graphics/pokemon/swablu/back.png b/graphics/pokemon/swablu/back.png index e146b2c0c5ac..54258f5e47d6 100644 Binary files a/graphics/pokemon/swablu/back.png and b/graphics/pokemon/swablu/back.png differ diff --git a/graphics/pokemon/swablu/icon.png b/graphics/pokemon/swablu/icon.png index 46be1f4033f1..d7d360bfbd26 100644 Binary files a/graphics/pokemon/swablu/icon.png and b/graphics/pokemon/swablu/icon.png differ diff --git a/graphics/pokemon/swalot/anim_frontf.png b/graphics/pokemon/swalot/anim_frontf.png new file mode 100644 index 000000000000..da17817ece8f Binary files /dev/null and b/graphics/pokemon/swalot/anim_frontf.png differ diff --git a/graphics/pokemon/swalot/back.png b/graphics/pokemon/swalot/back.png index ec9fdaef2c9d..364efbee5909 100644 Binary files a/graphics/pokemon/swalot/back.png and b/graphics/pokemon/swalot/back.png differ diff --git a/graphics/pokemon/swalot/backf.png b/graphics/pokemon/swalot/backf.png new file mode 100644 index 000000000000..fcd92c887a0b Binary files /dev/null and b/graphics/pokemon/swalot/backf.png differ diff --git a/graphics/pokemon/swalot/icon.png b/graphics/pokemon/swalot/icon.png index 09f7162d2a33..d74fb6141255 100644 Binary files a/graphics/pokemon/swalot/icon.png and b/graphics/pokemon/swalot/icon.png differ diff --git a/graphics/pokemon/swanna/anim_front.png b/graphics/pokemon/swanna/anim_front.png index 354bebb26ee6..a982a7ed2eb8 100644 Binary files a/graphics/pokemon/swanna/anim_front.png and b/graphics/pokemon/swanna/anim_front.png differ diff --git a/graphics/pokemon/swellow/anim_front.png b/graphics/pokemon/swellow/anim_front.png index 83d0ae8ec60e..3e2148b1230b 100644 Binary files a/graphics/pokemon/swellow/anim_front.png and b/graphics/pokemon/swellow/anim_front.png differ diff --git a/graphics/pokemon/swinub/anim_front.png b/graphics/pokemon/swinub/anim_front.png index ee4dae2537cd..22990ec29d90 100644 Binary files a/graphics/pokemon/swinub/anim_front.png and b/graphics/pokemon/swinub/anim_front.png differ diff --git a/graphics/pokemon/taillow/anim_front.png b/graphics/pokemon/taillow/anim_front.png index 7e5c544439d6..20f98a12727d 100644 Binary files a/graphics/pokemon/taillow/anim_front.png and b/graphics/pokemon/taillow/anim_front.png differ diff --git a/graphics/pokemon/tangela/anim_front.png b/graphics/pokemon/tangela/anim_front.png index 9785af465da7..a42e81c244f9 100644 Binary files a/graphics/pokemon/tangela/anim_front.png and b/graphics/pokemon/tangela/anim_front.png differ diff --git a/graphics/pokemon/tangrowth/anim_frontf.png b/graphics/pokemon/tangrowth/anim_frontf.png new file mode 100644 index 000000000000..59c3e104668d Binary files /dev/null and b/graphics/pokemon/tangrowth/anim_frontf.png differ diff --git a/graphics/pokemon/tauros/anim_front.png b/graphics/pokemon/tauros/anim_front.png index 1b0092dd3a88..6bc23e4e79b2 100644 Binary files a/graphics/pokemon/tauros/anim_front.png and b/graphics/pokemon/tauros/anim_front.png differ diff --git a/graphics/pokemon/tauros/icon.png b/graphics/pokemon/tauros/icon.png index de4bdd330d43..91275e72b757 100644 Binary files a/graphics/pokemon/tauros/icon.png and b/graphics/pokemon/tauros/icon.png differ diff --git a/graphics/pokemon/teddiursa/anim_front.png b/graphics/pokemon/teddiursa/anim_front.png index 2c6e3f3b10e4..e1a9e1c98add 100644 Binary files a/graphics/pokemon/teddiursa/anim_front.png and b/graphics/pokemon/teddiursa/anim_front.png differ diff --git a/graphics/pokemon/tentacool/anim_front.png b/graphics/pokemon/tentacool/anim_front.png index e6ff75c7ab95..ad3f1fa28ea6 100644 Binary files a/graphics/pokemon/tentacool/anim_front.png and b/graphics/pokemon/tentacool/anim_front.png differ diff --git a/graphics/pokemon/tentacool/back.png b/graphics/pokemon/tentacool/back.png index 74d89b0dd939..3847409a40a2 100644 Binary files a/graphics/pokemon/tentacool/back.png and b/graphics/pokemon/tentacool/back.png differ diff --git a/graphics/pokemon/tentacool/icon.png b/graphics/pokemon/tentacool/icon.png index 64a9ef364532..22f21f50af60 100644 Binary files a/graphics/pokemon/tentacool/icon.png and b/graphics/pokemon/tentacool/icon.png differ diff --git a/graphics/pokemon/tentacool/normal.pal b/graphics/pokemon/tentacool/normal.pal index ab750d2edfa2..be1a6b52b926 100644 --- a/graphics/pokemon/tentacool/normal.pal +++ b/graphics/pokemon/tentacool/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 +0 0 0 +255 255 255 +213 213 213 32 82 131 -106 16 16 -131 213 246 +65 148 172 106 180 230 +131 213 246 +106 16 16 180 41 32 -255 255 255 -255 197 189 255 82 74 -65 148 172 -0 0 0 -213 213 213 +255 197 189 82 82 32 -213 197 148 131 131 65 180 172 115 +213 197 148 diff --git a/graphics/pokemon/tentacool/shiny.pal b/graphics/pokemon/tentacool/shiny.pal index 57149a02b8b9..2059850de692 100644 --- a/graphics/pokemon/tentacool/shiny.pal +++ b/graphics/pokemon/tentacool/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -0 176 232 +208 152 160 +0 0 0 +255 255 255 +213 213 213 80 72 112 -0 96 24 -224 208 248 -192 176 224 -0 152 80 -248 248 248 -120 240 200 -24 192 136 144 120 168 -16 16 16 -208 208 208 -80 80 48 -208 192 144 -128 128 64 -176 168 112 +197 180 230 +230 213 255 +0 98 24 +0 156 82 +24 197 139 +74 246 189 +82 82 32 +131 131 65 +180 172 115 +213 197 148 diff --git a/graphics/pokemon/tentacruel/anim_front.png b/graphics/pokemon/tentacruel/anim_front.png index e4e7c3cc8e92..b4c5ed3004f3 100644 Binary files a/graphics/pokemon/tentacruel/anim_front.png and b/graphics/pokemon/tentacruel/anim_front.png differ diff --git a/graphics/pokemon/tentacruel/back.png b/graphics/pokemon/tentacruel/back.png index dbec071a900e..407e89132e9d 100644 Binary files a/graphics/pokemon/tentacruel/back.png and b/graphics/pokemon/tentacruel/back.png differ diff --git a/graphics/pokemon/tentacruel/icon.png b/graphics/pokemon/tentacruel/icon.png index e6a797e5291b..81ba44550b21 100644 Binary files a/graphics/pokemon/tentacruel/icon.png and b/graphics/pokemon/tentacruel/icon.png differ diff --git a/graphics/pokemon/tentacruel/normal.pal b/graphics/pokemon/tentacruel/normal.pal index 878043437b85..1f8e690b4ae1 100644 --- a/graphics/pokemon/tentacruel/normal.pal +++ b/graphics/pokemon/tentacruel/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -32 82 131 -131 205 230 +255 255 255 +255 189 172 +246 65 82 +180 41 32 131 16 16 +168 160 176 +128 120 136 +120 112 120 +96 96 104 +200 200 200 +131 205 230 106 180 230 65 148 172 +32 82 131 16 16 16 -246 65 82 -255 189 172 -255 255 255 -180 41 32 -213 213 213 -82 82 32 -180 172 115 -131 131 65 -230 213 164 diff --git a/graphics/pokemon/tentacruel/shiny.pal b/graphics/pokemon/tentacruel/shiny.pal index bfd3f5057171..4849df7cd914 100644 --- a/graphics/pokemon/tentacruel/shiny.pal +++ b/graphics/pokemon/tentacruel/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -248 160 176 -56 72 112 -192 208 248 -64 80 32 -152 168 224 -120 128 192 +208 152 160 +255 255 255 +189 230 172 +148 197 131 +98 156 90 +82 98 41 +238 213 164 +189 172 115 +139 131 65 +90 82 32 +213 213 213 +205 230 255 +156 172 230 +123 131 197 +82 98 156 16 16 16 -144 192 128 -200 224 184 -248 248 248 -80 152 72 -208 208 208 -88 80 40 -184 168 112 -136 128 64 -232 208 160 diff --git a/graphics/pokemon/thundurus/icon.png b/graphics/pokemon/thundurus/icon.png index 9b1166511607..3dc7d31db5e5 100644 Binary files a/graphics/pokemon/thundurus/icon.png and b/graphics/pokemon/thundurus/icon.png differ diff --git a/graphics/pokemon/tirtouga/icon.png b/graphics/pokemon/tirtouga/icon.png index dfb2983764bf..9209298dc57b 100644 Binary files a/graphics/pokemon/tirtouga/icon.png and b/graphics/pokemon/tirtouga/icon.png differ diff --git a/graphics/pokemon/togepi/anim_front.png b/graphics/pokemon/togepi/anim_front.png index 9fc22b9f843f..203183bea9ff 100644 Binary files a/graphics/pokemon/togepi/anim_front.png and b/graphics/pokemon/togepi/anim_front.png differ diff --git a/graphics/pokemon/togetic/anim_front.png b/graphics/pokemon/togetic/anim_front.png index c88c0e4d61ee..d487a148b56e 100644 Binary files a/graphics/pokemon/togetic/anim_front.png and b/graphics/pokemon/togetic/anim_front.png differ diff --git a/graphics/pokemon/togetic/back.png b/graphics/pokemon/togetic/back.png index 76312f9b8257..427a118da439 100644 Binary files a/graphics/pokemon/togetic/back.png and b/graphics/pokemon/togetic/back.png differ diff --git a/graphics/pokemon/torchic/back.png b/graphics/pokemon/torchic/back.png index 8c23c6266329..6b10fc5e9ac9 100644 Binary files a/graphics/pokemon/torchic/back.png and b/graphics/pokemon/torchic/back.png differ diff --git a/graphics/pokemon/torchic/backf.png b/graphics/pokemon/torchic/backf.png new file mode 100644 index 000000000000..15a3990a0205 Binary files /dev/null and b/graphics/pokemon/torchic/backf.png differ diff --git a/graphics/pokemon/tornadus/icon.png b/graphics/pokemon/tornadus/icon.png index 271e4c6b691a..b0e984db64ee 100644 Binary files a/graphics/pokemon/tornadus/icon.png and b/graphics/pokemon/tornadus/icon.png differ diff --git a/graphics/pokemon/totodile/anim_front.png b/graphics/pokemon/totodile/anim_front.png index 25e0a234e6d0..84940ba3ab75 100644 Binary files a/graphics/pokemon/totodile/anim_front.png and b/graphics/pokemon/totodile/anim_front.png differ diff --git a/graphics/pokemon/toxicroak/anim_frontf.png b/graphics/pokemon/toxicroak/anim_frontf.png new file mode 100644 index 000000000000..40f86c45ecca Binary files /dev/null and b/graphics/pokemon/toxicroak/anim_frontf.png differ diff --git a/graphics/pokemon/toxicroak/backf.png b/graphics/pokemon/toxicroak/backf.png new file mode 100644 index 000000000000..dde6b0be2248 Binary files /dev/null and b/graphics/pokemon/toxicroak/backf.png differ diff --git a/graphics/pokemon/tropius/icon.png b/graphics/pokemon/tropius/icon.png index 9e7b61b531a1..e429e125e004 100644 Binary files a/graphics/pokemon/tropius/icon.png and b/graphics/pokemon/tropius/icon.png differ diff --git a/graphics/pokemon/trubbish/icon.png b/graphics/pokemon/trubbish/icon.png index b7fa282cd8f8..f90f0a2c8c09 100644 Binary files a/graphics/pokemon/trubbish/icon.png and b/graphics/pokemon/trubbish/icon.png differ diff --git a/graphics/pokemon/turtonator/anim_front.png b/graphics/pokemon/turtonator/anim_front.png new file mode 100644 index 000000000000..6f2a3c456d8e Binary files /dev/null and b/graphics/pokemon/turtonator/anim_front.png differ diff --git a/graphics/pokemon/turtonator/front.png b/graphics/pokemon/turtonator/front.png deleted file mode 100644 index dda785cb1fb7..000000000000 Binary files a/graphics/pokemon/turtonator/front.png and /dev/null differ diff --git a/graphics/pokemon/tynamo/anim_front.png b/graphics/pokemon/tynamo/anim_front.png index 827e650ac7c4..c723eaee85e0 100644 Binary files a/graphics/pokemon/tynamo/anim_front.png and b/graphics/pokemon/tynamo/anim_front.png differ diff --git a/graphics/pokemon/typhlosion/anim_front.png b/graphics/pokemon/typhlosion/anim_front.png index bc4b7c45cccb..3906e52738f7 100644 Binary files a/graphics/pokemon/typhlosion/anim_front.png and b/graphics/pokemon/typhlosion/anim_front.png differ diff --git a/graphics/pokemon/typhlosion/back.png b/graphics/pokemon/typhlosion/back.png index 81bcbd42b6d1..023d85cc2da9 100644 Binary files a/graphics/pokemon/typhlosion/back.png and b/graphics/pokemon/typhlosion/back.png differ diff --git a/graphics/pokemon/typhlosion/hisuian/front.png b/graphics/pokemon/typhlosion/hisuian/front.png index 0b1095e4d52f..dc6f804f255b 100755 Binary files a/graphics/pokemon/typhlosion/hisuian/front.png and b/graphics/pokemon/typhlosion/hisuian/front.png differ diff --git a/graphics/pokemon/typhlosion/icon.png b/graphics/pokemon/typhlosion/icon.png index e5e5ea51c1b5..e720eed99706 100644 Binary files a/graphics/pokemon/typhlosion/icon.png and b/graphics/pokemon/typhlosion/icon.png differ diff --git a/graphics/pokemon/tyranitar/icon.png b/graphics/pokemon/tyranitar/icon.png index b692b9976967..471dd5e627fa 100644 Binary files a/graphics/pokemon/tyranitar/icon.png and b/graphics/pokemon/tyranitar/icon.png differ diff --git a/graphics/pokemon/unfezant/backf.png b/graphics/pokemon/unfezant/backf.png index f9624417f0e8..161f304dd14a 100644 Binary files a/graphics/pokemon/unfezant/backf.png and b/graphics/pokemon/unfezant/backf.png differ diff --git a/graphics/pokemon/unfezant/icon.png b/graphics/pokemon/unfezant/icon.png index 785bd89a9b4c..7d0fa254a827 100644 Binary files a/graphics/pokemon/unfezant/icon.png and b/graphics/pokemon/unfezant/icon.png differ diff --git a/graphics/pokemon/ursaring/anim_frontf.png b/graphics/pokemon/ursaring/anim_frontf.png new file mode 100644 index 000000000000..55f350609541 Binary files /dev/null and b/graphics/pokemon/ursaring/anim_frontf.png differ diff --git a/graphics/pokemon/ursaring/backf.png b/graphics/pokemon/ursaring/backf.png new file mode 100644 index 000000000000..27c4ba931185 Binary files /dev/null and b/graphics/pokemon/ursaring/backf.png differ diff --git a/graphics/pokemon/vanilluxe/icon.png b/graphics/pokemon/vanilluxe/icon.png index c2f85c1e31a6..59d6f43ca293 100644 Binary files a/graphics/pokemon/vanilluxe/icon.png and b/graphics/pokemon/vanilluxe/icon.png differ diff --git a/graphics/pokemon/vaporeon/anim_front.png b/graphics/pokemon/vaporeon/anim_front.png index de15a8c7c8e1..d5e46c70f3a3 100644 Binary files a/graphics/pokemon/vaporeon/anim_front.png and b/graphics/pokemon/vaporeon/anim_front.png differ diff --git a/graphics/pokemon/venomoth/anim_front.png b/graphics/pokemon/venomoth/anim_front.png index 834bf6fbcbcd..aafa830fd003 100644 Binary files a/graphics/pokemon/venomoth/anim_front.png and b/graphics/pokemon/venomoth/anim_front.png differ diff --git a/graphics/pokemon/venomoth/back.png b/graphics/pokemon/venomoth/back.png index b20a85374351..d648e3e04aee 100644 Binary files a/graphics/pokemon/venomoth/back.png and b/graphics/pokemon/venomoth/back.png differ diff --git a/graphics/pokemon/venomoth/normal.pal b/graphics/pokemon/venomoth/normal.pal index 92234d0a0c64..56c25c37b14b 100644 --- a/graphics/pokemon/venomoth/normal.pal +++ b/graphics/pokemon/venomoth/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -112 88 120 -156 139 189 -246 222 255 -213 172 222 +255 255 255 +230 230 230 +172 197 197 +230 213 172 +197 172 139 +164 131 123 +98 82 57 +255 0 255 +255 0 255 16 16 16 -213 172 222 -98 74 115 +246 222 255 238 197 255 +213 172 222 156 139 189 -248 248 248 -172 197 197 -98 82 57 -164 131 123 -197 172 139 -224 224 224 +98 74 115 diff --git a/graphics/pokemon/venomoth/shiny.pal b/graphics/pokemon/venomoth/shiny.pal index 5f3aaa6986b9..75da213e0d6d 100644 --- a/graphics/pokemon/venomoth/shiny.pal +++ b/graphics/pokemon/venomoth/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -56 72 120 -104 136 192 -192 224 248 -168 192 248 +255 255 255 +230 222 230 +180 189 197 +230 205 172 +197 164 139 +164 123 123 +98 74 57 +255 0 255 +255 0 255 16 16 16 -168 192 248 -56 72 120 -192 224 248 -104 136 192 -248 248 248 -176 184 192 -104 80 72 -168 128 128 -208 176 152 -224 224 224 +180 222 255 +156 189 255 +131 164 230 +98 131 197 +49 65 123 diff --git a/graphics/pokemon/venonat/anim_front.png b/graphics/pokemon/venonat/anim_front.png index 11187e0e127b..87ff5d52616c 100644 Binary files a/graphics/pokemon/venonat/anim_front.png and b/graphics/pokemon/venonat/anim_front.png differ diff --git a/graphics/pokemon/venonat/back.png b/graphics/pokemon/venonat/back.png index 933313bcbad9..90b1898a1624 100644 Binary files a/graphics/pokemon/venonat/back.png and b/graphics/pokemon/venonat/back.png differ diff --git a/graphics/pokemon/venonat/normal.pal b/graphics/pokemon/venonat/normal.pal index 237a56d2635e..385b31ce6427 100644 --- a/graphics/pokemon/venonat/normal.pal +++ b/graphics/pokemon/venonat/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -123 123 123 255 255 255 213 213 213 -16 16 16 -98 74 123 -139 106 164 -82 16 16 -180 65 90 -255 90 90 +123 123 123 255 172 180 -49 41 82 -115 65 41 +255 90 90 +180 65 90 +82 16 16 238 189 156 189 148 106 -144 136 200 +115 65 41 +164 139 189 +139 106 164 +98 74 123 +49 41 82 +16 16 16 diff --git a/graphics/pokemon/venonat/shiny.pal b/graphics/pokemon/venonat/shiny.pal index 731050656037..deff2ef88381 100644 --- a/graphics/pokemon/venonat/shiny.pal +++ b/graphics/pokemon/venonat/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -112 112 120 -248 248 248 -200 200 208 +255 255 255 +205 205 213 +115 115 123 +172 230 255 +90 156 255 +41 98 197 +0 41 148 +246 189 156 +197 148 106 +123 65 41 +164 139 197 +139 106 172 +98 74 131 +49 41 90 16 16 16 -96 72 128 -136 104 168 -0 40 144 -40 96 192 -88 152 248 -168 224 248 -48 40 88 -120 64 40 -240 184 152 -192 144 104 -160 136 192 diff --git a/graphics/pokemon/venusaur/anim_front.png b/graphics/pokemon/venusaur/anim_front.png index 9ba3e62add18..e224c3741b45 100644 Binary files a/graphics/pokemon/venusaur/anim_front.png and b/graphics/pokemon/venusaur/anim_front.png differ diff --git a/graphics/pokemon/venusaur/anim_frontf.png b/graphics/pokemon/venusaur/anim_frontf.png new file mode 100644 index 000000000000..b32f1dd45662 Binary files /dev/null and b/graphics/pokemon/venusaur/anim_frontf.png differ diff --git a/graphics/pokemon/venusaur/back.png b/graphics/pokemon/venusaur/back.png index 6b1430b8e11c..f00ff70ae1b9 100644 Binary files a/graphics/pokemon/venusaur/back.png and b/graphics/pokemon/venusaur/back.png differ diff --git a/graphics/pokemon/venusaur/backf.png b/graphics/pokemon/venusaur/backf.png new file mode 100644 index 000000000000..ff3d45016018 Binary files /dev/null and b/graphics/pokemon/venusaur/backf.png differ diff --git a/graphics/pokemon/venusaur/icon.png b/graphics/pokemon/venusaur/icon.png index ce3b2290ac95..b52902ff8e3a 100644 Binary files a/graphics/pokemon/venusaur/icon.png and b/graphics/pokemon/venusaur/icon.png differ diff --git a/graphics/pokemon/venusaur/mega/icon.png b/graphics/pokemon/venusaur/mega/icon.png index e9e662b0d74d..bd0bff126c09 100644 Binary files a/graphics/pokemon/venusaur/mega/icon.png and b/graphics/pokemon/venusaur/mega/icon.png differ diff --git a/graphics/pokemon/venusaur/normal.pal b/graphics/pokemon/venusaur/normal.pal index d6751ffe01f0..9fef14fcead9 100644 --- a/graphics/pokemon/venusaur/normal.pal +++ b/graphics/pokemon/venusaur/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -248 192 248 -128 48 0 -248 184 184 +152 160 208 +16 82 65 +16 120 104 +32 176 152 +88 208 192 +222 65 65 248 120 112 -216 64 64 -184 104 48 -216 184 40 +131 49 0 +189 106 49 +222 189 41 +255 238 82 16 16 16 -248 232 80 -16 80 64 +248 184 184 88 152 56 128 216 120 -88 208 192 -32 176 152 -16 120 104 -248 248 248 +255 255 255 diff --git a/graphics/pokemon/venusaur/shiny.pal b/graphics/pokemon/venusaur/shiny.pal index 82c1e516769d..35e0d10255fb 100644 --- a/graphics/pokemon/venusaur/shiny.pal +++ b/graphics/pokemon/venusaur/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -208 248 184 -128 48 8 -248 248 216 -248 216 24 -224 144 16 -184 112 64 -216 184 40 -16 16 16 +152 160 208 +57 90 32 +120 152 40 +164 213 74 +205 238 82 +230 139 0 +255 213 0 +128 48 0 +189 106 49 +192 160 32 248 232 80 -56 88 32 +16 16 16 +248 248 216 88 152 56 128 216 120 -200 232 80 -160 208 72 -120 152 40 -248 248 248 +255 255 255 diff --git a/graphics/pokemon/vibrava/anim_front.png b/graphics/pokemon/vibrava/anim_front.png index 553f82207937..1f6f0c7b12f3 100644 Binary files a/graphics/pokemon/vibrava/anim_front.png and b/graphics/pokemon/vibrava/anim_front.png differ diff --git a/graphics/pokemon/victini/icon.png b/graphics/pokemon/victini/icon.png index 686f4a499f37..219407dbcef3 100644 Binary files a/graphics/pokemon/victini/icon.png and b/graphics/pokemon/victini/icon.png differ diff --git a/graphics/pokemon/victreebel/anim_front.png b/graphics/pokemon/victreebel/anim_front.png index a8ecbdb468da..b633b6f4b6a5 100644 Binary files a/graphics/pokemon/victreebel/anim_front.png and b/graphics/pokemon/victreebel/anim_front.png differ diff --git a/graphics/pokemon/victreebel/back.png b/graphics/pokemon/victreebel/back.png index 0626c35344ad..a8eaef0d0f6e 100644 Binary files a/graphics/pokemon/victreebel/back.png and b/graphics/pokemon/victreebel/back.png differ diff --git a/graphics/pokemon/victreebel/normal.pal b/graphics/pokemon/victreebel/normal.pal index ef9c409828cf..4e2238e77f6a 100644 --- a/graphics/pokemon/victreebel/normal.pal +++ b/graphics/pokemon/victreebel/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -0 176 232 +152 160 208 +0 0 0 +189 197 197 +255 255 255 98 82 41 -16 98 57 164 123 49 -0 0 0 -139 197 123 -74 164 123 -197 90 32 -238 139 82 -248 248 248 -200 216 208 222 189 82 -144 152 32 238 213 106 246 238 148 131 24 0 +197 90 32 +238 139 82 +16 98 57 +74 164 123 +139 197 123 +180 230 156 diff --git a/graphics/pokemon/victreebel/shiny.pal b/graphics/pokemon/victreebel/shiny.pal index 1aac75ff4b54..173dbf31fef1 100644 --- a/graphics/pokemon/victreebel/shiny.pal +++ b/graphics/pokemon/victreebel/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -96 80 40 -80 64 24 -160 120 48 -16 16 16 -192 176 88 -144 128 80 -72 104 176 -96 152 240 -248 248 248 -184 192 192 -176 224 72 -144 152 32 -216 248 88 -232 248 152 -0 40 152 +208 152 160 +0 0 0 +189 197 197 +255 255 255 +98 82 41 +164 123 49 +180 230 57 +222 255 90 +230 255 131 +0 41 156 +41 90 197 +74 139 246 +98 82 24 +164 148 90 +197 180 90 +230 213 123 diff --git a/graphics/pokemon/vikavolt/anim_front.png b/graphics/pokemon/vikavolt/anim_front.png new file mode 100644 index 000000000000..e3bf6f06615c Binary files /dev/null and b/graphics/pokemon/vikavolt/anim_front.png differ diff --git a/graphics/pokemon/vikavolt/front.png b/graphics/pokemon/vikavolt/front.png deleted file mode 100644 index d13a41201b06..000000000000 Binary files a/graphics/pokemon/vikavolt/front.png and /dev/null differ diff --git a/graphics/pokemon/vileplume/anim_front.png b/graphics/pokemon/vileplume/anim_front.png index 0169b8f347ff..ca062889d2b7 100644 Binary files a/graphics/pokemon/vileplume/anim_front.png and b/graphics/pokemon/vileplume/anim_front.png differ diff --git a/graphics/pokemon/vileplume/anim_frontf.png b/graphics/pokemon/vileplume/anim_frontf.png new file mode 100644 index 000000000000..9ba0298e1dce Binary files /dev/null and b/graphics/pokemon/vileplume/anim_frontf.png differ diff --git a/graphics/pokemon/vileplume/back.png b/graphics/pokemon/vileplume/back.png index e5aff098d3ed..2ddd23e8f1bc 100644 Binary files a/graphics/pokemon/vileplume/back.png and b/graphics/pokemon/vileplume/back.png differ diff --git a/graphics/pokemon/vileplume/backf.png b/graphics/pokemon/vileplume/backf.png new file mode 100644 index 000000000000..ff5be8baf7ab Binary files /dev/null and b/graphics/pokemon/vileplume/backf.png differ diff --git a/graphics/pokemon/vileplume/icon.png b/graphics/pokemon/vileplume/icon.png index 3dcf11ce3912..7967deda58b4 100644 Binary files a/graphics/pokemon/vileplume/icon.png and b/graphics/pokemon/vileplume/icon.png differ diff --git a/graphics/pokemon/vileplume/normal.pal b/graphics/pokemon/vileplume/normal.pal index f7f01cae2a8f..425069bf0c6a 100644 --- a/graphics/pokemon/vileplume/normal.pal +++ b/graphics/pokemon/vileplume/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -189 49 74 -123 24 16 -255 98 98 +240 112 112 +248 128 40 +200 96 24 +144 72 0 +240 136 136 +152 56 64 +216 72 88 +112 24 16 255 205 213 -238 49 49 246 172 180 -16 16 16 -255 164 41 -180 98 32 -40 40 40 -197 139 32 -24 41 74 -57 82 82 +115 131 164 90 98 131 -40 40 40 +56 64 96 +24 41 74 +16 16 16 diff --git a/graphics/pokemon/vileplume/shiny.pal b/graphics/pokemon/vileplume/shiny.pal index 1480c0cb63bf..fd75dec7d223 100644 --- a/graphics/pokemon/vileplume/shiny.pal +++ b/graphics/pokemon/vileplume/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -0 176 232 -184 96 40 -128 64 16 -248 184 80 -248 232 208 -232 144 64 -240 208 176 +152 160 208 +248 176 64 +255 164 41 +192 152 40 +176 104 32 +248 184 96 +197 115 57 +232 136 48 +131 65 16 +255 238 213 +246 213 180 +139 213 164 +98 172 106 +65 123 65 +32 74 24 16 16 16 -248 184 104 -136 112 56 -16 16 16 -184 152 64 -32 72 24 -64 120 64 -104 160 112 -40 40 40 diff --git a/graphics/pokemon/virizion/anim_front.png b/graphics/pokemon/virizion/anim_front.png index 0b7ef3bb8d9d..1bdeab36a598 100644 Binary files a/graphics/pokemon/virizion/anim_front.png and b/graphics/pokemon/virizion/anim_front.png differ diff --git a/graphics/pokemon/virizion/icon.png b/graphics/pokemon/virizion/icon.png index 68c0abd73026..5f712a611c37 100644 Binary files a/graphics/pokemon/virizion/icon.png and b/graphics/pokemon/virizion/icon.png differ diff --git a/graphics/pokemon/vivillon/continental/icon.png b/graphics/pokemon/vivillon/continental/icon.png index e4fdf6d2191e..482c27febab0 100644 Binary files a/graphics/pokemon/vivillon/continental/icon.png and b/graphics/pokemon/vivillon/continental/icon.png differ diff --git a/graphics/pokemon/vivillon/elegant/icon.png b/graphics/pokemon/vivillon/elegant/icon.png index f6c4772ae0e8..fc23f4335ab8 100644 Binary files a/graphics/pokemon/vivillon/elegant/icon.png and b/graphics/pokemon/vivillon/elegant/icon.png differ diff --git a/graphics/pokemon/vivillon/fancy/icon.png b/graphics/pokemon/vivillon/fancy/icon.png index 10d9a2e9b246..2e75d4c340b7 100644 Binary files a/graphics/pokemon/vivillon/fancy/icon.png and b/graphics/pokemon/vivillon/fancy/icon.png differ diff --git a/graphics/pokemon/vivillon/garden/icon.png b/graphics/pokemon/vivillon/garden/icon.png index 868f8c7fe31a..bcf56d0ef4f9 100644 Binary files a/graphics/pokemon/vivillon/garden/icon.png and b/graphics/pokemon/vivillon/garden/icon.png differ diff --git a/graphics/pokemon/vivillon/jungle/icon.png b/graphics/pokemon/vivillon/jungle/icon.png index 1a3249596c47..e759b4f789eb 100644 Binary files a/graphics/pokemon/vivillon/jungle/icon.png and b/graphics/pokemon/vivillon/jungle/icon.png differ diff --git a/graphics/pokemon/vivillon/marine/icon.png b/graphics/pokemon/vivillon/marine/icon.png index 72ef85f218f1..69b2eab4dec1 100644 Binary files a/graphics/pokemon/vivillon/marine/icon.png and b/graphics/pokemon/vivillon/marine/icon.png differ diff --git a/graphics/pokemon/vivillon/modern/icon.png b/graphics/pokemon/vivillon/modern/icon.png index 2aa35c48e30b..dedc1aa19f97 100644 Binary files a/graphics/pokemon/vivillon/modern/icon.png and b/graphics/pokemon/vivillon/modern/icon.png differ diff --git a/graphics/pokemon/vivillon/monsoon/icon.png b/graphics/pokemon/vivillon/monsoon/icon.png index 2eb6221ef4cb..22fcc286d508 100644 Binary files a/graphics/pokemon/vivillon/monsoon/icon.png and b/graphics/pokemon/vivillon/monsoon/icon.png differ diff --git a/graphics/pokemon/vivillon/ocean/icon.png b/graphics/pokemon/vivillon/ocean/icon.png index ac083f289585..47609a6b591c 100644 Binary files a/graphics/pokemon/vivillon/ocean/icon.png and b/graphics/pokemon/vivillon/ocean/icon.png differ diff --git a/graphics/pokemon/vivillon/poke_ball/icon.png b/graphics/pokemon/vivillon/poke_ball/icon.png index 9305c2b8ad50..1ca199b96b8a 100644 Binary files a/graphics/pokemon/vivillon/poke_ball/icon.png and b/graphics/pokemon/vivillon/poke_ball/icon.png differ diff --git a/graphics/pokemon/vivillon/polar/icon.png b/graphics/pokemon/vivillon/polar/icon.png index dd12dbd25d27..e52390387324 100644 Binary files a/graphics/pokemon/vivillon/polar/icon.png and b/graphics/pokemon/vivillon/polar/icon.png differ diff --git a/graphics/pokemon/vivillon/river/icon.png b/graphics/pokemon/vivillon/river/icon.png index d33d8271c375..5cb09d29bd5b 100644 Binary files a/graphics/pokemon/vivillon/river/icon.png and b/graphics/pokemon/vivillon/river/icon.png differ diff --git a/graphics/pokemon/vivillon/sandstorm/icon.png b/graphics/pokemon/vivillon/sandstorm/icon.png index e5e0b987ebea..40822af8664b 100644 Binary files a/graphics/pokemon/vivillon/sandstorm/icon.png and b/graphics/pokemon/vivillon/sandstorm/icon.png differ diff --git a/graphics/pokemon/vivillon/savanna/icon.png b/graphics/pokemon/vivillon/savanna/icon.png index 37fc6570df34..cc12705dd82a 100644 Binary files a/graphics/pokemon/vivillon/savanna/icon.png and b/graphics/pokemon/vivillon/savanna/icon.png differ diff --git a/graphics/pokemon/vivillon/sun/icon.png b/graphics/pokemon/vivillon/sun/icon.png index 0a8af5e68ffd..95d3c84e5bed 100644 Binary files a/graphics/pokemon/vivillon/sun/icon.png and b/graphics/pokemon/vivillon/sun/icon.png differ diff --git a/graphics/pokemon/vivillon/tundra/icon.png b/graphics/pokemon/vivillon/tundra/icon.png index 711ae44ee5ef..fa937ff7ca46 100644 Binary files a/graphics/pokemon/vivillon/tundra/icon.png and b/graphics/pokemon/vivillon/tundra/icon.png differ diff --git a/graphics/pokemon/volcarona/icon.png b/graphics/pokemon/volcarona/icon.png index a37d965d9860..31e08b921121 100644 Binary files a/graphics/pokemon/volcarona/icon.png and b/graphics/pokemon/volcarona/icon.png differ diff --git a/graphics/pokemon/voltorb/anim_front.png b/graphics/pokemon/voltorb/anim_front.png index 740cfa4f3d34..28c443a3a353 100644 Binary files a/graphics/pokemon/voltorb/anim_front.png and b/graphics/pokemon/voltorb/anim_front.png differ diff --git a/graphics/pokemon/voltorb/icon.png b/graphics/pokemon/voltorb/icon.png index f0113355b0b8..98942ec8bcb7 100644 Binary files a/graphics/pokemon/voltorb/icon.png and b/graphics/pokemon/voltorb/icon.png differ diff --git a/graphics/pokemon/vulpix/anim_front.png b/graphics/pokemon/vulpix/anim_front.png index 0b9401e5078f..53119cae2ab2 100644 Binary files a/graphics/pokemon/vulpix/anim_front.png and b/graphics/pokemon/vulpix/anim_front.png differ diff --git a/graphics/pokemon/vulpix/back.png b/graphics/pokemon/vulpix/back.png index 304618ed33e5..bf02a4e4987b 100644 Binary files a/graphics/pokemon/vulpix/back.png and b/graphics/pokemon/vulpix/back.png differ diff --git a/graphics/pokemon/vulpix/normal.pal b/graphics/pokemon/vulpix/normal.pal index aefc8e87cfec..4c352ac2f3d8 100644 --- a/graphics/pokemon/vulpix/normal.pal +++ b/graphics/pokemon/vulpix/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -115 32 0 +255 255 255 +255 230 180 +255 222 148 +16 16 16 +238 156 74 +160 112 64 +128 80 48 255 148 90 222 115 41 189 74 41 -16 16 16 -115 49 0 -189 115 90 -230 148 106 -172 90 8 -205 123 41 -255 255 255 -160 120 112 -168 0 0 +115 32 0 246 189 123 -0 0 0 +230 148 106 +189 115 90 +88 48 0 diff --git a/graphics/pokemon/vulpix/shiny.pal b/graphics/pokemon/vulpix/shiny.pal index bf8fadc0c5c0..6096470d21fc 100644 --- a/graphics/pokemon/vulpix/shiny.pal +++ b/graphics/pokemon/vulpix/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -128 64 24 -248 232 128 -240 200 48 -208 136 40 +152 160 208 +255 255 255 +246 238 180 +246 230 148 16 16 16 +189 205 98 +156 164 49 +104 128 24 +255 238 131 +246 197 0 +213 131 24 +131 57 0 +255 255 164 +238 238 57 +197 180 32 80 88 48 -192 176 64 -232 232 88 -104 128 32 -152 160 48 -248 248 248 -152 136 104 -208 136 40 -240 224 144 -0 0 0 diff --git a/graphics/pokemon/wailmer/anim_front.png b/graphics/pokemon/wailmer/anim_front.png index b2f2a2690983..ecfe4cd7b7f4 100644 Binary files a/graphics/pokemon/wailmer/anim_front.png and b/graphics/pokemon/wailmer/anim_front.png differ diff --git a/graphics/pokemon/wailord/icon.png b/graphics/pokemon/wailord/icon.png index de5a2c70782e..0d82ae1ade08 100644 Binary files a/graphics/pokemon/wailord/icon.png and b/graphics/pokemon/wailord/icon.png differ diff --git a/graphics/pokemon/wartortle/anim_front.png b/graphics/pokemon/wartortle/anim_front.png index 3cd3f59e1807..7d01eb2577ec 100644 Binary files a/graphics/pokemon/wartortle/anim_front.png and b/graphics/pokemon/wartortle/anim_front.png differ diff --git a/graphics/pokemon/wartortle/back.png b/graphics/pokemon/wartortle/back.png index 9bb691ccbc16..485fda6461af 100644 Binary files a/graphics/pokemon/wartortle/back.png and b/graphics/pokemon/wartortle/back.png differ diff --git a/graphics/pokemon/wartortle/normal.pal b/graphics/pokemon/wartortle/normal.pal index c2c7c0db7ebe..26b0e2dc87d6 100644 --- a/graphics/pokemon/wartortle/normal.pal +++ b/graphics/pokemon/wartortle/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -153 210 164 -139 172 246 +152 208 160 255 255 255 -16 16 16 -189 197 230 -41 65 106 -98 123 197 -213 238 246 -172 197 255 -106 74 24 +208 232 240 +184 192 224 +197 49 0 +205 131 32 148 98 98 -172 139 98 -49 65 74 +90 57 8 222 197 139 -200 48 0 +168 136 96 139 90 32 +168 192 248 +136 168 240 +96 120 192 +40 64 104 +16 16 16 diff --git a/graphics/pokemon/wartortle/shiny.pal b/graphics/pokemon/wartortle/shiny.pal index b8ca2cfbc1ca..6b16c8bb4173 100644 --- a/graphics/pokemon/wartortle/shiny.pal +++ b/graphics/pokemon/wartortle/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -153 210 164 -188 188 244 +208 152 160 255 255 255 -16 16 16 -180 222 189 -98 82 148 -145 132 188 213 246 197 -222 222 255 -57 90 16 +180 222 189 +197 49 0 +156 197 49 90 139 16 -222 164 65 -65 65 82 +57 90 16 246 213 123 -192 24 0 -136 96 24 +222 164 65 +164 98 32 +222 222 255 +180 180 246 +139 123 189 +98 82 148 +16 16 16 diff --git a/graphics/pokemon/watchog/icon.png b/graphics/pokemon/watchog/icon.png index 4051ebde8b71..8c7f1b92029e 100644 Binary files a/graphics/pokemon/watchog/icon.png and b/graphics/pokemon/watchog/icon.png differ diff --git a/graphics/pokemon/weavile/anim_frontf.png b/graphics/pokemon/weavile/anim_frontf.png new file mode 100644 index 000000000000..0a072200f1f6 Binary files /dev/null and b/graphics/pokemon/weavile/anim_frontf.png differ diff --git a/graphics/pokemon/weavile/backf.png b/graphics/pokemon/weavile/backf.png new file mode 100644 index 000000000000..632fbfc25733 Binary files /dev/null and b/graphics/pokemon/weavile/backf.png differ diff --git a/graphics/pokemon/weedle/anim_front.png b/graphics/pokemon/weedle/anim_front.png index da10f827fc06..684677599603 100644 Binary files a/graphics/pokemon/weedle/anim_front.png and b/graphics/pokemon/weedle/anim_front.png differ diff --git a/graphics/pokemon/weedle/back.png b/graphics/pokemon/weedle/back.png index 4d47423390a1..53a6242fc743 100644 Binary files a/graphics/pokemon/weedle/back.png and b/graphics/pokemon/weedle/back.png differ diff --git a/graphics/pokemon/weedle/normal.pal b/graphics/pokemon/weedle/normal.pal index b1d97250eba3..ac1acc09ba4a 100644 --- a/graphics/pokemon/weedle/normal.pal +++ b/graphics/pokemon/weedle/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -139 139 148 255 255 255 -90 90 98 197 197 197 -148 90 8 +139 139 148 +90 90 98 +24 24 24 +255 213 123 238 172 65 205 115 16 +148 90 8 106 57 8 -255 230 123 -24 24 24 -156 41 32 -222 90 82 -238 156 139 255 222 205 +238 156 139 +222 90 82 +156 41 32 0 0 0 diff --git a/graphics/pokemon/weedle/shiny.pal b/graphics/pokemon/weedle/shiny.pal index b7150af41818..060a627e5ec1 100644 --- a/graphics/pokemon/weedle/shiny.pal +++ b/graphics/pokemon/weedle/shiny.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -136 136 144 -248 248 248 -88 88 96 -192 192 192 -216 136 16 -248 240 48 -240 176 48 -184 120 32 -248 248 184 +255 255 255 +197 197 197 +139 139 148 +90 90 98 24 24 24 -168 80 120 -224 152 168 -224 200 208 -0 0 0 +255 255 172 +255 238 0 +255 180 0 +222 139 16 +189 106 0 +230 238 246 +230 205 213 +230 156 172 +172 82 123 0 0 0 diff --git a/graphics/pokemon/weepinbell/anim_front.png b/graphics/pokemon/weepinbell/anim_front.png index 56d2b201225d..0a17971686d9 100644 Binary files a/graphics/pokemon/weepinbell/anim_front.png and b/graphics/pokemon/weepinbell/anim_front.png differ diff --git a/graphics/pokemon/weepinbell/back.png b/graphics/pokemon/weepinbell/back.png index 1f9ccd1a9553..3062fb2051d3 100644 Binary files a/graphics/pokemon/weepinbell/back.png and b/graphics/pokemon/weepinbell/back.png differ diff --git a/graphics/pokemon/weepinbell/normal.pal b/graphics/pokemon/weepinbell/normal.pal index 27931063f3f4..8bc872b29afd 100644 --- a/graphics/pokemon/weepinbell/normal.pal +++ b/graphics/pokemon/weepinbell/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -0 176 232 -8 90 49 -57 172 90 -156 222 131 +152 160 208 +0 0 0 +255 255 255 98 74 49 164 123 49 -0 0 0 -255 246 172 -255 230 106 -106 197 82 213 197 82 +255 230 106 +255 246 172 123 41 41 -255 255 255 180 65 74 -238 156 172 205 106 131 +238 156 172 +8 90 49 +57 152 80 +106 197 82 +156 222 131 diff --git a/graphics/pokemon/weepinbell/shiny.pal b/graphics/pokemon/weepinbell/shiny.pal index 87c68f5b221b..b64d3917ca27 100644 --- a/graphics/pokemon/weepinbell/shiny.pal +++ b/graphics/pokemon/weepinbell/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -0 176 232 -96 136 0 -144 184 24 -216 248 96 -104 80 48 -160 128 64 -16 16 16 -240 248 160 -216 248 88 -184 224 64 -184 200 56 -144 88 104 -248 248 248 -152 104 120 -232 200 208 -192 152 168 +152 160 208 +0 0 0 +255 255 255 +98 74 49 +164 123 49 +189 205 49 +222 255 90 +246 255 164 +148 90 106 +172 123 139 +197 156 172 +238 205 213 +98 139 0 +139 189 8 +189 238 49 +222 255 98 diff --git a/graphics/pokemon/weezing/anim_front.png b/graphics/pokemon/weezing/anim_front.png index 096b1f911246..3bc2cb26f614 100644 Binary files a/graphics/pokemon/weezing/anim_front.png and b/graphics/pokemon/weezing/anim_front.png differ diff --git a/graphics/pokemon/weezing/icon.png b/graphics/pokemon/weezing/icon.png index 5c2421a2a9f8..802a73fbe2dc 100644 Binary files a/graphics/pokemon/weezing/icon.png and b/graphics/pokemon/weezing/icon.png differ diff --git a/graphics/pokemon/whimsicott/anim_front.png b/graphics/pokemon/whimsicott/anim_front.png index 07001cccde79..d2b830524024 100644 Binary files a/graphics/pokemon/whimsicott/anim_front.png and b/graphics/pokemon/whimsicott/anim_front.png differ diff --git a/graphics/pokemon/whiscash/back.png b/graphics/pokemon/whiscash/back.png index 07e3fb0f6864..a2015a14bc25 100644 Binary files a/graphics/pokemon/whiscash/back.png and b/graphics/pokemon/whiscash/back.png differ diff --git a/graphics/pokemon/wigglytuff/anim_front.png b/graphics/pokemon/wigglytuff/anim_front.png index 232f9c38c9c4..43d9a2e2349e 100644 Binary files a/graphics/pokemon/wigglytuff/anim_front.png and b/graphics/pokemon/wigglytuff/anim_front.png differ diff --git a/graphics/pokemon/wigglytuff/back.png b/graphics/pokemon/wigglytuff/back.png index 2d5ac12a708a..d093212b975e 100644 Binary files a/graphics/pokemon/wigglytuff/back.png and b/graphics/pokemon/wigglytuff/back.png differ diff --git a/graphics/pokemon/wigglytuff/normal.pal b/graphics/pokemon/wigglytuff/normal.pal index 9e5a19944915..ef750b0d7308 100644 --- a/graphics/pokemon/wigglytuff/normal.pal +++ b/graphics/pokemon/wigglytuff/normal.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -139 65 65 +152 160 208 255 255 255 -115 115 115 230 222 230 -16 16 16 -255 172 189 -246 123 148 -205 106 98 -255 222 205 +115 115 115 +148 222 205 82 164 139 32 90 98 -148 222 205 -115 65 24 230 49 49 -0 0 0 +156 106 32 +115 65 24 +255 222 205 +255 172 189 +246 123 148 +205 106 98 +139 65 65 +16 16 16 diff --git a/graphics/pokemon/wigglytuff/shiny.pal b/graphics/pokemon/wigglytuff/shiny.pal index d781c0acc665..a9c87f98f6d2 100644 --- a/graphics/pokemon/wigglytuff/shiny.pal +++ b/graphics/pokemon/wigglytuff/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 -128 56 128 -248 248 248 -104 104 112 -216 216 224 +152 160 208 +255 255 255 +222 222 230 +115 115 115 +180 255 139 +139 213 98 +74 164 49 +230 49 49 +148 106 65 +106 65 57 +255 222 205 +238 180 246 +213 148 205 +164 106 172 +131 57 131 16 16 16 -232 176 240 -208 144 200 -160 104 168 -216 216 224 -136 208 96 -72 160 48 -176 248 136 -112 72 40 -224 96 96 -0 0 0 diff --git a/graphics/pokemon/wimpod/anim_front.png b/graphics/pokemon/wimpod/anim_front.png new file mode 100644 index 000000000000..b1c46e5ae615 Binary files /dev/null and b/graphics/pokemon/wimpod/anim_front.png differ diff --git a/graphics/pokemon/wimpod/front.png b/graphics/pokemon/wimpod/front.png deleted file mode 100644 index 39b3d2c03cf8..000000000000 Binary files a/graphics/pokemon/wimpod/front.png and /dev/null differ diff --git a/graphics/pokemon/wingull/back.png b/graphics/pokemon/wingull/back.png index b419bf6410b2..79658946bd2c 100644 Binary files a/graphics/pokemon/wingull/back.png and b/graphics/pokemon/wingull/back.png differ diff --git a/graphics/pokemon/wobbuffet/anim_frontf.png b/graphics/pokemon/wobbuffet/anim_frontf.png new file mode 100644 index 000000000000..571e354cfd56 Binary files /dev/null and b/graphics/pokemon/wobbuffet/anim_frontf.png differ diff --git a/graphics/pokemon/wobbuffet/backf.png b/graphics/pokemon/wobbuffet/backf.png new file mode 100644 index 000000000000..db6b3f9b0231 Binary files /dev/null and b/graphics/pokemon/wobbuffet/backf.png differ diff --git a/graphics/pokemon/woobat/icon.png b/graphics/pokemon/woobat/icon.png index c3640d5ad078..f47e2d827d12 100644 Binary files a/graphics/pokemon/woobat/icon.png and b/graphics/pokemon/woobat/icon.png differ diff --git a/graphics/pokemon/wooper/anim_frontf.png b/graphics/pokemon/wooper/anim_frontf.png new file mode 100644 index 000000000000..5c3c46d7b4d0 Binary files /dev/null and b/graphics/pokemon/wooper/anim_frontf.png differ diff --git a/graphics/pokemon/wooper/backf.png b/graphics/pokemon/wooper/backf.png new file mode 100644 index 000000000000..79b566a4bbc9 Binary files /dev/null and b/graphics/pokemon/wooper/backf.png differ diff --git a/graphics/pokemon/wormadam/anim_front.png b/graphics/pokemon/wormadam/anim_front.png index ebd4710346b4..2b2b7a5c0274 100644 Binary files a/graphics/pokemon/wormadam/anim_front.png and b/graphics/pokemon/wormadam/anim_front.png differ diff --git a/graphics/pokemon/wormadam/icon.png b/graphics/pokemon/wormadam/icon.png index 866acd17ba64..ca2499305178 100644 Binary files a/graphics/pokemon/wormadam/icon.png and b/graphics/pokemon/wormadam/icon.png differ diff --git a/graphics/pokemon/wormadam/sandy_cloak/anim_front.png b/graphics/pokemon/wormadam/sandy_cloak/anim_front.png index 51990c1a3086..1508f2ba664b 100644 Binary files a/graphics/pokemon/wormadam/sandy_cloak/anim_front.png and b/graphics/pokemon/wormadam/sandy_cloak/anim_front.png differ diff --git a/graphics/pokemon/wormadam/sandy_cloak/icon.png b/graphics/pokemon/wormadam/sandy_cloak/icon.png index a45417a61621..e6270c93e027 100644 Binary files a/graphics/pokemon/wormadam/sandy_cloak/icon.png and b/graphics/pokemon/wormadam/sandy_cloak/icon.png differ diff --git a/graphics/pokemon/wormadam/trash_cloak/anim_front.png b/graphics/pokemon/wormadam/trash_cloak/anim_front.png index d0b41b9df347..5bf453541f55 100644 Binary files a/graphics/pokemon/wormadam/trash_cloak/anim_front.png and b/graphics/pokemon/wormadam/trash_cloak/anim_front.png differ diff --git a/graphics/pokemon/wormadam/trash_cloak/icon.png b/graphics/pokemon/wormadam/trash_cloak/icon.png index 6834629e9ab3..49c84433326f 100644 Binary files a/graphics/pokemon/wormadam/trash_cloak/icon.png and b/graphics/pokemon/wormadam/trash_cloak/icon.png differ diff --git a/graphics/pokemon/wynaut/icon.png b/graphics/pokemon/wynaut/icon.png index c3f81995e64e..b94ecb52d760 100644 Binary files a/graphics/pokemon/wynaut/icon.png and b/graphics/pokemon/wynaut/icon.png differ diff --git a/graphics/pokemon/xatu/anim_front.png b/graphics/pokemon/xatu/anim_front.png index c3d3143846d7..828f993dab2a 100644 Binary files a/graphics/pokemon/xatu/anim_front.png and b/graphics/pokemon/xatu/anim_front.png differ diff --git a/graphics/pokemon/xatu/anim_frontf.png b/graphics/pokemon/xatu/anim_frontf.png new file mode 100644 index 000000000000..ca2e1166ff32 Binary files /dev/null and b/graphics/pokemon/xatu/anim_frontf.png differ diff --git a/graphics/pokemon/xerneas/back.png b/graphics/pokemon/xerneas/back.png index 5f38d48dd36b..81a91bd13711 100644 Binary files a/graphics/pokemon/xerneas/back.png and b/graphics/pokemon/xerneas/back.png differ diff --git a/graphics/pokemon/xerneas/front.png b/graphics/pokemon/xerneas/front.png index 357f3b4294af..85a22af42b6f 100644 Binary files a/graphics/pokemon/xerneas/front.png and b/graphics/pokemon/xerneas/front.png differ diff --git a/graphics/pokemon/xerneas/icon.png b/graphics/pokemon/xerneas/icon.png index 31036c9ee11e..6d0b56b3b673 100644 Binary files a/graphics/pokemon/xerneas/icon.png and b/graphics/pokemon/xerneas/icon.png differ diff --git a/graphics/pokemon/yanmega/anim_front.png b/graphics/pokemon/yanmega/anim_front.png index f5b4db9afab2..a8f685745e21 100644 Binary files a/graphics/pokemon/yanmega/anim_front.png and b/graphics/pokemon/yanmega/anim_front.png differ diff --git a/graphics/pokemon/zangoose/anim_front.png b/graphics/pokemon/zangoose/anim_front.png index a7a863feba36..3b7e3c2da862 100644 Binary files a/graphics/pokemon/zangoose/anim_front.png and b/graphics/pokemon/zangoose/anim_front.png differ diff --git a/graphics/pokemon/zangoose/icon.png b/graphics/pokemon/zangoose/icon.png index 80f3b7c450e2..96e7d99a3f23 100644 Binary files a/graphics/pokemon/zangoose/icon.png and b/graphics/pokemon/zangoose/icon.png differ diff --git a/graphics/pokemon/zapdos/anim_front.png b/graphics/pokemon/zapdos/anim_front.png index f1079f7b70bd..20f0c0e71a1a 100644 Binary files a/graphics/pokemon/zapdos/anim_front.png and b/graphics/pokemon/zapdos/anim_front.png differ diff --git a/graphics/pokemon/zapdos/back.png b/graphics/pokemon/zapdos/back.png index 0b7cc3c7b335..330d2d9f217c 100644 Binary files a/graphics/pokemon/zapdos/back.png and b/graphics/pokemon/zapdos/back.png differ diff --git a/graphics/pokemon/zekrom/icon.png b/graphics/pokemon/zekrom/icon.png index c4380ec69a67..b2f707bb1249 100644 Binary files a/graphics/pokemon/zekrom/icon.png and b/graphics/pokemon/zekrom/icon.png differ diff --git a/graphics/pokemon/zigzagoon/anim_front.png b/graphics/pokemon/zigzagoon/anim_front.png index 9acce5453f03..54c3de9925ef 100644 Binary files a/graphics/pokemon/zigzagoon/anim_front.png and b/graphics/pokemon/zigzagoon/anim_front.png differ diff --git a/graphics/pokemon/zoroark/icon.png b/graphics/pokemon/zoroark/icon.png index 338a576a4a19..126ce6fe3692 100644 Binary files a/graphics/pokemon/zoroark/icon.png and b/graphics/pokemon/zoroark/icon.png differ diff --git a/graphics/pokemon/zubat/anim_front.png b/graphics/pokemon/zubat/anim_front.png index 6cdc6af981ca..3ef6a453ab56 100644 Binary files a/graphics/pokemon/zubat/anim_front.png and b/graphics/pokemon/zubat/anim_front.png differ diff --git a/graphics/pokemon/zubat/anim_frontf.png b/graphics/pokemon/zubat/anim_frontf.png new file mode 100644 index 000000000000..b9383adb4812 Binary files /dev/null and b/graphics/pokemon/zubat/anim_frontf.png differ diff --git a/graphics/pokemon/zubat/back.png b/graphics/pokemon/zubat/back.png index 27ee2727967d..d4ab3b87aedb 100644 Binary files a/graphics/pokemon/zubat/back.png and b/graphics/pokemon/zubat/back.png differ diff --git a/graphics/pokemon/zubat/backf.png b/graphics/pokemon/zubat/backf.png new file mode 100644 index 000000000000..a8bed93d0abf Binary files /dev/null and b/graphics/pokemon/zubat/backf.png differ diff --git a/graphics/pokemon/zubat/normal.pal b/graphics/pokemon/zubat/normal.pal index 13f001cc1316..2994d59602db 100644 --- a/graphics/pokemon/zubat/normal.pal +++ b/graphics/pokemon/zubat/normal.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 152 208 160 -16 16 16 -99 123 181 -189 206 255 -140 181 239 -74 66 123 -99 123 181 -181 82 156 -115 33 90 -214 115 189 255 255 255 -208 208 208 -99 99 99 -0 0 0 -0 0 0 -0 0 0 +213 213 213 +98 98 98 +16 16 16 +255 0 255 +189 205 255 +139 180 238 +98 123 180 +74 65 123 +246 131 222 +213 115 189 +180 82 156 +115 32 90 +255 0 255 +255 0 255 diff --git a/graphics/pokemon/zubat/shiny.pal b/graphics/pokemon/zubat/shiny.pal index 290d12c52a07..508d47898f93 100644 --- a/graphics/pokemon/zubat/shiny.pal +++ b/graphics/pokemon/zubat/shiny.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -152 208 160 +152 160 208 +255 255 255 +213 213 213 +98 98 98 16 16 16 -64 120 24 -144 200 104 -112 152 56 -8 72 0 -64 120 24 -184 152 112 -120 96 48 -224 200 168 -248 248 248 -208 208 208 -96 96 96 -0 0 0 -0 0 0 -0 0 0 +255 0 255 +131 213 74 +106 156 41 +49 115 0 +8 74 0 +246 131 222 +238 213 156 +189 156 115 +139 115 57 +255 0 255 +255 0 255 diff --git a/graphics/pokemon/zweilous/icon.png b/graphics/pokemon/zweilous/icon.png index 1c0a166af90e..ee0fa15115ed 100644 Binary files a/graphics/pokemon/zweilous/icon.png and b/graphics/pokemon/zweilous/icon.png differ diff --git a/graphics/pokemon/zygarde/10_percent/icon.png b/graphics/pokemon/zygarde/10_percent/icon.png index 222eb1b80a5a..c1fd251535ee 100644 Binary files a/graphics/pokemon/zygarde/10_percent/icon.png and b/graphics/pokemon/zygarde/10_percent/icon.png differ diff --git a/graphics/pokemon/zygarde/complete/icon.png b/graphics/pokemon/zygarde/complete/icon.png index 663b98fd74fc..454af5dcac37 100644 Binary files a/graphics/pokemon/zygarde/complete/icon.png and b/graphics/pokemon/zygarde/complete/icon.png differ diff --git a/graphics_file_rules.mk b/graphics_file_rules.mk index cfe5c62578b0..b565c0e914ca 100644 --- a/graphics_file_rules.mk +++ b/graphics_file_rules.mk @@ -1,5 +1,3 @@ -CASTFORMGFXDIR := graphics/pokemon/castform -CHERRIMGFXDIR := graphics/pokemon/cherrim TILESETGFXDIR := data/tilesets FONTGFXDIR := graphics/fonts INTERFACEGFXDIR := graphics/interface @@ -27,60 +25,6 @@ SPINDAGFXDIR := graphics/spinda_spots types := normal fight flying poison ground rock bug ghost steel mystery fire water grass electric psychic ice dragon dark fairy contest_types := cool beauty cute smart tough -### Cherrim ### - -$(CHERRIMGFXDIR)/front.4bpp: $(CHERRIMGFXDIR)/normal/front.4bpp \ - $(CHERRIMGFXDIR)/sunshine/front.4bpp - @cat $^ >$@ - -$(CHERRIMGFXDIR)/back.4bpp: $(CHERRIMGFXDIR)/normal/back.4bpp \ - $(CHERRIMGFXDIR)/sunshine/back.4bpp - @cat $^ >$@ - -$(CHERRIMGFXDIR)/anim_front.4bpp: $(CHERRIMGFXDIR)/normal/anim_front.4bpp \ - $(CHERRIMGFXDIR)/sunshine/anim_front.4bpp - @cat $^ >$@ - -$(CHERRIMGFXDIR)/normal.gbapal: $(CHERRIMGFXDIR)/normal/normal.gbapal \ - $(CHERRIMGFXDIR)/sunshine/normal.gbapal - @cat $^ >$@ - -$(CHERRIMGFXDIR)/shiny.gbapal: $(CHERRIMGFXDIR)/normal/shiny.gbapal \ - $(CHERRIMGFXDIR)/sunshine/shiny.gbapal - @cat $^ >$@ - -### Castform ### - -$(CASTFORMGFXDIR)/front.4bpp: $(CASTFORMGFXDIR)/normal/front.4bpp \ - $(CASTFORMGFXDIR)/sunny/front.4bpp \ - $(CASTFORMGFXDIR)/rainy/front.4bpp \ - $(CASTFORMGFXDIR)/snowy/front.4bpp - @cat $^ >$@ - -$(CASTFORMGFXDIR)/back.4bpp: $(CASTFORMGFXDIR)/normal/back.4bpp \ - $(CASTFORMGFXDIR)/sunny/back.4bpp \ - $(CASTFORMGFXDIR)/rainy/back.4bpp \ - $(CASTFORMGFXDIR)/snowy/back.4bpp - @cat $^ >$@ - -$(CASTFORMGFXDIR)/anim_front.4bpp: $(CASTFORMGFXDIR)/normal/anim_front.4bpp \ - $(CASTFORMGFXDIR)/sunny/anim_front.4bpp \ - $(CASTFORMGFXDIR)/rainy/anim_front.4bpp \ - $(CASTFORMGFXDIR)/snowy/anim_front.4bpp - @cat $^ >$@ - -$(CASTFORMGFXDIR)/normal.gbapal: $(CASTFORMGFXDIR)/normal/normal.gbapal \ - $(CASTFORMGFXDIR)/sunny/normal.gbapal \ - $(CASTFORMGFXDIR)/rainy/normal.gbapal \ - $(CASTFORMGFXDIR)/snowy/normal.gbapal - @cat $^ >$@ - -$(CASTFORMGFXDIR)/shiny.gbapal: $(CASTFORMGFXDIR)/normal/shiny.gbapal \ - $(CASTFORMGFXDIR)/sunny/shiny.gbapal \ - $(CASTFORMGFXDIR)/rainy/shiny.gbapal \ - $(CASTFORMGFXDIR)/snowy/shiny.gbapal - @cat $^ >$@ - ### Tilesets ### $(TILESETGFXDIR)/secondary/petalburg/tiles.4bpp: %.4bpp: %.png diff --git a/include/battle.h b/include/battle.h index e3f2e90d0faa..60c583e5035c 100644 --- a/include/battle.h +++ b/include/battle.h @@ -15,9 +15,6 @@ #include "pokeball.h" #include "battle_debug.h" -#define GET_BATTLER_SIDE(battler) (GetBattlerPosition(battler) & BIT_SIDE) -#define GET_BATTLER_SIDE2(battler) (gBattlerPositions[battler] & BIT_SIDE) - // Used to exclude moves learned temporarily by Transform or Mimic #define MOVE_IS_PERMANENT(battler, moveSlot) \ (!(gBattleMons[battler].status2 & STATUS2_TRANSFORMED) \ @@ -280,6 +277,7 @@ struct AIPartyData // Opposing battlers - party mons. u8 count[NUM_BATTLE_SIDES]; }; +// Ai Data used when deciding which move to use, computed only once before each turn's start. struct AiLogicData { u16 abilities[MAX_BATTLERS_COUNT]; @@ -289,9 +287,14 @@ struct AiLogicData u16 predictedMoves[MAX_BATTLERS_COUNT]; u8 hpPercents[MAX_BATTLERS_COUNT]; u16 partnerMove; + u16 speedStats[MAX_BATTLERS_COUNT]; // Speed stats for all battles, calculated only once, same way as damages + u8 moveDmgResult[MAX_BATTLERS_COUNT][MAX_BATTLERS_COUNT][MAX_MON_MOVES]; // MOVE_POWER defines for GetMoveDamageResult ; attacker, target, moveIndex s32 simulatedDmg[MAX_BATTLERS_COUNT][MAX_BATTLERS_COUNT][MAX_MON_MOVES]; // attacker, target, moveIndex u8 effectiveness[MAX_BATTLERS_COUNT][MAX_BATTLERS_COUNT][MAX_MON_MOVES]; // attacker, target, moveIndex u8 moveLimitations[MAX_BATTLERS_COUNT]; + bool8 shouldSwitchMon; // Because all available moves have no/little effect. Each bit per battler. + u8 monToSwitchId[MAX_BATTLERS_COUNT]; // ID of the mon to switch. + bool8 weatherHasEffect; // The same as WEATHER_HAS_EFFECT. Stored here, so it's called only once. }; struct AI_ThinkingStruct @@ -299,13 +302,12 @@ struct AI_ThinkingStruct u8 aiState; u8 movesetIndex; u16 moveConsidered; - s8 score[MAX_MON_MOVES]; + s32 score[MAX_MON_MOVES]; u32 funcResult; u32 aiFlags; u8 aiAction; u8 aiLogicId; - struct AI_SavedBattleMon saved[4]; - bool8 switchMon; // Because all available moves have no/little effect. + struct AI_SavedBattleMon saved[MAX_BATTLERS_COUNT]; }; #define AI_MOVE_HISTORY_COUNT 3 @@ -352,6 +354,7 @@ struct BattleResources struct BattleHistory *battleHistory; u8 bufferA[MAX_BATTLERS_COUNT][0x200]; u8 bufferB[MAX_BATTLERS_COUNT][0x200]; + u8 transferBuffer[0x100]; }; #define AI_THINKING_STRUCT ((struct AI_ThinkingStruct *)(gBattleResources->ai)) @@ -487,6 +490,15 @@ struct MegaEvolutionData u8 triggerSpriteId; }; +struct UltraBurstData +{ + u8 toBurst; // As flags using gBitTable. + bool8 alreadyBursted[4]; // Array id is used for mon position. + u8 battlerId; + bool8 playerSelect; + u8 triggerSpriteId; +}; + struct Illusion { u8 on; @@ -528,7 +540,15 @@ struct BattleStruct u8 turnCountersTracker; u16 wrappedMove[MAX_BATTLERS_COUNT]; u16 moveTarget[MAX_BATTLERS_COUNT]; + u32 expShareExpValue; + u32 expValue; + u8 expGettersOrder[PARTY_SIZE]; // First battlers which were sent out, then via exp-share u8 expGetterMonId; + u8 expOrderId:3; + u8 expGetterBattlerId:2; + u8 teamGotExpMsgPrinted:1; // The 'Rest of your team got msg' has been printed. + u8 givenExpMons; // Bits for enemy party's pokemon that gave exp to player's party. + u8 expSentInMons; // As bits for player party mons - not including exp share mons. u8 wildVictorySong; u8 dynamicMoveType; u8 wrappedBy[MAX_BATTLERS_COUNT]; @@ -541,9 +561,7 @@ struct BattleStruct u8 switchInAbilitiesCounter; u8 faintedActionsState; u8 faintedActionsBattlerId; - u32 expValue; u8 scriptPartyIdx; // for printing the nickname - u8 sentInPokes; bool8 selectionScriptFinished[MAX_BATTLERS_COUNT]; u8 battlerPartyIndexes[MAX_BATTLERS_COUNT]; u8 monToSwitchIntoId[MAX_BATTLERS_COUNT]; @@ -561,9 +579,8 @@ struct BattleStruct u8 stateIdAfterSelScript[MAX_BATTLERS_COUNT]; u8 prevSelectedPartySlot; u8 stringMoveType; - u8 expGetterBattlerId; u8 absentBattlerFlags; - u8 palaceFlags; // First 4 bits are "is < 50% HP and not asleep" for each battler, last 4 bits are selected moves to pass to AI + u8 palaceFlags; // First 4 bits are "is <= 50% HP and not asleep" for each battler, last 4 bits are selected moves to pass to AI u8 field_93; // related to choosing pokemon? u8 wallyBattleState; u8 wallyMovesState; @@ -584,9 +601,7 @@ struct BattleStruct u8 switchInItemsCounter; u8 arenaTurnCounter; u8 turnSideTracker; - u8 givenExpMons; // Bits for enemy party's pokemon that gave exp to player's party. u16 lastTakenMoveFrom[MAX_BATTLERS_COUNT][MAX_BATTLERS_COUNT]; // a 2-D array [target][attacker] - u16 castformPalette[NUM_CASTFORM_FORMS][16]; union { struct LinkBattlerHeader linkBattlerHeader; u32 battleVideo[2]; @@ -616,6 +631,7 @@ struct BattleStruct u8 abilityPopUpSpriteIds[MAX_BATTLERS_COUNT][2]; // two per battler bool8 throwingPokeBall; struct MegaEvolutionData mega; + struct UltraBurstData burst; struct ZMoveData zmove; const u8 *trainerSlideMsg; bool8 trainerSlideLowHpMsgDone; @@ -624,12 +640,11 @@ struct BattleStruct u8 stolenStats[NUM_BATTLE_STATS]; // hp byte is used for which stats to raise, other inform about by how many stages u8 lastMoveFailed; // as bits for each battler, for the sake of Stomping Tantrum u8 lastMoveTarget[MAX_BATTLERS_COUNT]; // The last target on which each mon used a move, for the sake of Instruct - u8 debugHoldEffects[MAX_BATTLERS_COUNT]; // These override actual items' hold effects. u16 tracedAbility[MAX_BATTLERS_COUNT]; u16 hpBefore[MAX_BATTLERS_COUNT]; // Hp of battlers before using a move. For Berserk bool8 spriteIgnore0Hp; struct Illusion illusion[MAX_BATTLERS_COUNT]; - s8 aiFinalScore[MAX_BATTLERS_COUNT][MAX_BATTLERS_COUNT][MAX_MON_MOVES]; // AI, target, moves to make debugging easier + s32 aiFinalScore[MAX_BATTLERS_COUNT][MAX_BATTLERS_COUNT][MAX_MON_MOVES]; // AI, target, moves to make debugging easier u8 aiMoveOrAction[MAX_BATTLERS_COUNT]; u8 aiChosenTarget[MAX_BATTLERS_COUNT]; u8 soulheartBattlerId; @@ -658,7 +673,7 @@ struct BattleStruct u8 battleBondTransformed[NUM_BATTLE_SIDES]; // Bitfield for each party. u8 storedHealingWish:4; // Each battler as a bit. u8 storedLunarDance:4; // Each battler as a bit. - u16 supremeOverlordModifier[MAX_BATTLERS_COUNT]; + uq4_12_t supremeOverlordModifier[MAX_BATTLERS_COUNT]; u8 itemPartyIndex[MAX_BATTLERS_COUNT]; u8 itemMoveIndex[MAX_BATTLERS_COUNT]; bool8 trainerSlideHalfHpMsgDone; @@ -669,8 +684,15 @@ struct BattleStruct bool8 trainerSlideMegaEvolutionMsgDone; bool8 trainerSlideZMoveMsgDone; bool8 trainerSlideBeforeFirstTurnMsgDone; + u32 aiDelayTimer; // Counts number of frames AI takes to choose an action. + u32 aiDelayFrames; // Number of frames it took to choose an action. }; +// The palaceFlags member of struct BattleStruct contains 1 flag per move to indicate which moves the AI should consider, +// and 1 flag per battler to indicate whether the battler is awake and at <= 50% HP (which affects move choice). +// The assert below is to ensure palaceFlags is large enough to store these flags without overlap. +STATIC_ASSERT(sizeof(((struct BattleStruct *)0)->palaceFlags) * 8 >= MAX_BATTLERS_COUNT + MAX_MON_MOVES, PalaceFlagsTooSmall) + #define F_DYNAMIC_TYPE_1 (1 << 6) #define F_DYNAMIC_TYPE_2 (1 << 7) #define DYNAMIC_TYPE_MASK (F_DYNAMIC_TYPE_1 - 1) @@ -687,6 +709,12 @@ struct BattleStruct #define IS_MOVE_SPECIAL(move)(GetBattleMoveSplit(move) == SPLIT_SPECIAL) #define IS_MOVE_STATUS(move)(gBattleMoves[move].split == SPLIT_STATUS) +#define IS_MOVE_RECOIL(move)(gBattleMoves[move].effect == EFFECT_RECOIL_25 \ + || gBattleMoves[move].effect == EFFECT_RECOIL_IF_MISS \ + || gBattleMoves[move].effect == EFFECT_RECOIL_50 \ + || gBattleMoves[move].effect == EFFECT_RECOIL_33 \ + || gBattleMoves[move].effect == EFFECT_RECOIL_33_STATUS) + #define BATTLER_MAX_HP(battlerId)(gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP) #define TARGET_TURN_DAMAGED ((gSpecialStatuses[gBattlerTarget].physicalDmg != 0 || gSpecialStatuses[gBattlerTarget].specialDmg != 0)) #define BATTLER_DAMAGED(battlerId) ((gSpecialStatuses[battlerId].physicalDmg != 0 || gSpecialStatuses[battlerId].specialDmg != 0)) @@ -705,7 +733,6 @@ struct BattleStruct gBattleMons[battlerId].type3 = TYPE_MYSTERY; \ } - #define IS_BATTLER_PROTECTED(battlerId)(gProtectStructs[battlerId].protected \ || gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_WIDE_GUARD \ || gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_QUICK_GUARD \ @@ -727,17 +754,6 @@ struct BattleStruct #define SET_STATCHANGER(statId, stage, goesDown)(gBattleScripting.statChanger = (statId) + ((stage) << 3) + (goesDown << 7)) #define SET_STATCHANGER2(dst, statId, stage, goesDown)(dst = (statId) + ((stage) << 3) + (goesDown << 7)) -static inline struct Pokemon *GetSideParty(u32 side) -{ - return side == B_SIDE_PLAYER ? gPlayerParty : gEnemyParty; -} - -static inline struct Pokemon *GetBattlerParty(u32 battlerId) -{ - extern u8 GetBattlerSide(u8 battler); - return GetSideParty(GetBattlerSide(battlerId)); -} - // NOTE: The members of this struct have hard-coded offsets // in include/constants/battle_script_commands.h struct BattleScripting @@ -906,7 +922,6 @@ extern u8 gBattleTerrain; extern u32 gUnusedFirstBattleVar1; extern u8 *gBattleAnimBgTileBuffer; extern u8 *gBattleAnimBgTilemapBuffer; -extern u8 gActiveBattler; extern u32 gBattleControllerExecFlags; extern u8 gBattlersCount; extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; @@ -968,7 +983,6 @@ extern u16 gBattleWeather; extern struct WishFutureKnock gWishFutureKnock; extern u16 gIntroSlideFlags; extern u8 gSentPokesToOpponent[2]; -extern u16 gExpShareExp; extern struct BattleEnigmaBerry gEnigmaBerries[MAX_BATTLERS_COUNT]; extern struct BattleScripting gBattleScripting; extern struct BattleStruct *gBattleStruct; @@ -989,7 +1003,6 @@ extern struct BattleHealthboxInfo *gBattleControllerOpponentHealthboxData; extern struct BattleHealthboxInfo *gBattleControllerOpponentFlankHealthboxData; extern u16 gBattleMovePower; extern u16 gMoveToLearn; -extern u8 gBattleMonForms[MAX_BATTLERS_COUNT]; extern u32 gFieldStatuses; extern struct FieldTimer gFieldTimers; extern u8 gBattlerAbility; @@ -1000,14 +1013,34 @@ extern void (*gPreBattleCallback1)(void); extern void (*gBattleMainFunc)(void); extern struct BattleResults gBattleResults; extern u8 gLeveledUpInBattle; -extern void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(void); extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gMultiUsePlayerCursor; extern u8 gNumberOfMovesToChoose; -extern u8 gBattleControllerData[MAX_BATTLERS_COUNT]; extern bool8 gHasFetchedBall; extern u8 gLastUsedBall; extern u16 gLastThrownBall; +extern u16 gBallToDisplay; +extern bool8 gLastUsedBallMenuPresent; extern u8 gPartyCriticalHits[PARTY_SIZE]; +static inline u32 GetBattlerPosition(u32 battler) +{ + return gBattlerPositions[battler]; +} + +static inline u32 GetBattlerSide(u32 battler) +{ + return GetBattlerPosition(battler) & BIT_SIDE; +} + +static inline struct Pokemon *GetSideParty(u32 side) +{ + return (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty; +} + +static inline struct Pokemon *GetBattlerParty(u32 battler) +{ + return GetSideParty(GetBattlerSide(battler)); +} + #endif // GUARD_BATTLE_H diff --git a/include/battle_ai_main.h b/include/battle_ai_main.h index 1d53a3f398ff..8bb2293e9b66 100644 --- a/include/battle_ai_main.h +++ b/include/battle_ai_main.h @@ -19,15 +19,15 @@ return score; \ } -u8 ComputeBattleAiScores(u8 battler); +u32 ComputeBattleAiScores(u32 battler); void BattleAI_SetupItems(void); void BattleAI_SetupFlags(void); -void BattleAI_SetupAIData(u8 defaultScoreMoves); -u8 BattleAI_ChooseMoveOrAction(void); +void BattleAI_SetupAIData(u8 defaultScoreMoves, u32 battler); +u32 BattleAI_ChooseMoveOrAction(void); void Ai_InitPartyStruct(void); void Ai_UpdateSwitchInData(u32 battler); void Ai_UpdateFaintData(u32 battler); -void GetAiLogicData(void); +void SetAiLogicDataForTurn(struct AiLogicData *aiData); extern u8 sBattler_AI; diff --git a/include/battle_ai_switch_items.h b/include/battle_ai_switch_items.h index 622593b6ddd0..9a7e5f7e74d5 100644 --- a/include/battle_ai_switch_items.h +++ b/include/battle_ai_switch_items.h @@ -2,8 +2,8 @@ #define GUARD_BATTLE_AI_SWITCH_ITEMS_H void GetAIPartyIndexes(u32 battlerId, s32 *firstId, s32 *lastId); -void AI_TrySwitchOrUseItem(void); -u8 GetMostSuitableMonToSwitchInto(void); -bool32 ShouldSwitch(void); +void AI_TrySwitchOrUseItem(u32 battler); +u8 GetMostSuitableMonToSwitchInto(u32 battler); +bool32 ShouldSwitch(u32 battler); #endif // GUARD_BATTLE_AI_SWITCH_ITEMS_H diff --git a/include/battle_ai_util.h b/include/battle_ai_util.h index 284022092c80..b91865a08a7b 100644 --- a/include/battle_ai_util.h +++ b/include/battle_ai_util.h @@ -7,178 +7,186 @@ #define FOE(battler) ((BATTLE_OPPOSITE(battler)) & BIT_SIDE) -bool32 AI_RandLessThan(u8 val); -void RecordLastUsedMoveByTarget(void); +#define AI_STRIKES_FIRST(battlerAi, battlerDef, move)((AI_WhoStrikesFirst(battlerAi, battlerDef, move) == AI_IS_FASTER)) + +bool32 AI_RandLessThan(u32 val); +bool32 IsAiVsAiBattle(void); bool32 BattlerHasAi(u32 battlerId); bool32 IsAiBattlerAware(u32 battlerId); -void ClearBattlerMoveHistory(u8 battlerId); +void ClearBattlerMoveHistory(u32 battlerId); void RecordLastUsedMoveBy(u32 battlerId, u32 move); -void RecordKnownMove(u8 battlerId, u32 move); -void RecordAbilityBattle(u8 battlerId, u16 abilityId); -void ClearBattlerAbilityHistory(u8 battlerId); -void RecordItemEffectBattle(u8 battlerId, u8 itemEffect); -void ClearBattlerItemEffectHistory(u8 battlerId); -void SaveBattlerData(u8 battlerId); -void SetBattlerData(u8 battlerId); -void RestoreBattlerData(u8 battlerId); -u16 GetAIChosenMove(u8 battlerId); - -bool32 WillAIStrikeFirst(void); +void RecordAllMoves(u32 battler); +void RecordKnownMove(u32 battlerId, u32 move); +void RecordAbilityBattle(u32 battlerId, u32 abilityId); +void ClearBattlerAbilityHistory(u32 battlerId); +void RecordItemEffectBattle(u32 battlerId, u32 itemEffect); +void ClearBattlerItemEffectHistory(u32 battlerId); +void SaveBattlerData(u32 battlerId); +void SetBattlerData(u32 battlerId); +void RestoreBattlerData(u32 battlerId); +u32 GetAIChosenMove(u32 battlerId); u32 GetTotalBaseStat(u32 species); bool32 IsTruantMonVulnerable(u32 battlerAI, u32 opposingBattler); -bool32 AtMaxHp(u8 battler); -u32 GetHealthPercentage(u8 battler); -bool32 IsBattlerTrapped(u8 battler, bool8 switching); -u8 AI_WhoStrikesFirst(u8 battlerAI, u8 battler2, u16 consideredMove); -bool32 CanTargetFaintAi(u8 battlerDef, u8 battlerAtk); -bool32 CanMoveFaintBattler(u16 move, u8 battlerDef, u8 battlerAtk, u8 nHits); -bool32 CanTargetFaintAiWithMod(u8 battlerDef, u8 battlerAtk, s32 hpMod, s32 dmgMod); +bool32 AtMaxHp(u32 battler); +u32 GetHealthPercentage(u32 battler); +bool32 IsBattlerTrapped(u32 battler, bool32 switching); +u32 AI_WhoStrikesFirst(u32 battlerAI, u32 battler2, u32 moveConsidered); +bool32 CanTargetFaintAi(u32 battlerDef, u32 battlerAtk); +bool32 CanTargetMoveFaintAi(u32 move, u32 battlerDef, u32 battlerAtk, u32 nHits); +bool32 CanTargetFaintAiWithMod(u32 battlerDef, u32 battlerAtk, s32 hpMod, s32 dmgMod); s32 AI_GetAbility(u32 battlerId); -u16 AI_GetHoldEffect(u32 battlerId); -u32 AI_GetMoveAccuracy(u8 battlerAtk, u8 battlerDef, u16 move); -bool32 DoesBattlerIgnoreAbilityChecks(u16 atkAbility, u16 move); -bool32 AI_WeatherHasEffect(void); -bool32 CanAIFaintTarget(u8 battlerAtk, u8 battlerDef, u8 numHits); -bool32 CanIndexMoveFaintTarget(u8 battlerAtk, u8 battlerDef, u8 index, u8 numHits); -bool32 AI_IsTerrainAffected(u8 battlerId, u32 flags); -bool32 AI_IsBattlerGrounded(u8 battlerId); -bool32 HasDamagingMove(u8 battlerId); -bool32 HasDamagingMoveOfType(u8 battlerId, u8 type); -u32 GetBattlerSecondaryDamage(u8 battlerId); -bool32 BattlerWillFaintFromWeather(u8 battler, u16 ability); -bool32 BattlerWillFaintFromSecondaryDamage(u8 battler, u16 ability); -bool32 ShouldTryOHKO(u8 battlerAtk, u8 battlerDef, u16 atkAbility, u16 defAbility, u16 move); -bool32 ShouldUseRecoilMove(u8 battlerAtk, u8 battlerDef, u32 recoilDmg, u8 moveIndex); -u16 GetBattlerSideSpeedAverage(u8 battler); -bool32 ShouldAbsorb(u8 battlerAtk, u8 battlerDef, u16 move, s32 damage); -bool32 ShouldRecover(u8 battlerAtk, u8 battlerDef, u16 move, u8 healPercent); -bool32 ShouldSetScreen(u8 battlerAtk, u8 battlerDef, u16 moveEffect); -bool32 ShouldPivot(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u8 moveIndex); -bool32 IsRecycleEncouragedItem(u16 item); -bool32 ShouldRestoreHpBerry(u8 battlerAtk, u16 item); -bool32 IsStatBoostingBerry(u16 item); -bool32 CanKnockOffItem(u8 battler, u16 item); -bool32 IsAbilityOfRating(u16 ability, s8 rating); -s8 GetAbilityRating(u16 ability); +u32 AI_GetHoldEffect(u32 battlerId); +u32 AI_GetMoveAccuracy(u32 battlerAtk, u32 battlerDef, u32 move); +bool32 DoesBattlerIgnoreAbilityChecks(u32 atkAbility, u32 move); +u32 AI_GetWeather(struct AiLogicData *aiData); +bool32 CanAIFaintTarget(u32 battlerAtk, u32 battlerDef, u32 numHits); +bool32 CanIndexMoveFaintTarget(u32 battlerAtk, u32 battlerDef, u32 index, u32 numHits); +bool32 AI_IsTerrainAffected(u32 battlerId, u32 flags); +bool32 AI_IsBattlerGrounded(u32 battlerId); +bool32 HasDamagingMove(u32 battlerId); +bool32 HasDamagingMoveOfType(u32 battlerId, u32 type); +u32 GetBattlerSecondaryDamage(u32 battlerId); +bool32 BattlerWillFaintFromWeather(u32 battler, u32 ability); +bool32 BattlerWillFaintFromSecondaryDamage(u32 battler, u32 ability); +bool32 ShouldTryOHKO(u32 battlerAtk, u32 battlerDef, u32 atkAbility, u32 defAbility, u32 move); +bool32 ShouldUseRecoilMove(u32 battlerAtk, u32 battlerDef, u32 recoilDmg, u32 moveIndex); +u32 GetBattlerSideSpeedAverage(u32 battler); +bool32 ShouldAbsorb(u32 battlerAtk, u32 battlerDef, u32 move, s32 damage); +bool32 ShouldRecover(u32 battlerAtk, u32 battlerDef, u32 move, u32 healPercent); +bool32 ShouldSetScreen(u32 battlerAtk, u32 battlerDef, u32 moveEffect); +bool32 ShouldPivot(u32 battlerAtk, u32 battlerDef, u32 defAbility, u32 move, u32 moveIndex); +bool32 IsRecycleEncouragedItem(u32 item); +bool32 ShouldRestoreHpBerry(u32 battlerAtk, u32 item); +bool32 IsStatBoostingBerry(u32 item); +bool32 CanKnockOffItem(u32 battler, u32 item); +bool32 IsAbilityOfRating(u32 ability, s8 rating); +s8 GetAbilityRating(u32 ability); bool32 AI_IsAbilityOnSide(u32 battlerId, u32 ability); -bool32 AI_MoveMakesContact(u32 ability, u32 holdEffect, u16 move); -u32 AI_GetBattlerMoveTargetType(u8 battlerId, u16 move); -bool32 ShouldUseZMove(u8 activeId, u8 targetId, u16 chosenMove); +bool32 AI_MoveMakesContact(u32 ability, u32 holdEffect, u32 move); +u32 AI_GetBattlerMoveTargetType(u32 battlerId, u32 move); +bool32 ShouldUseZMove(u32 battlerAtk, u32 battlerDef, u32 chosenMove); // stat stage checks -bool32 AnyStatIsRaised(u8 battlerId); -bool32 ShouldLowerStat(u8 battler, u16 battlerAbility, u8 stat); -bool32 BattlerStatCanRise(u8 battler, u16 battlerAbility, u8 stat); -bool32 AreBattlersStatsMaxed(u8 battler); -bool32 BattlerHasAnyStatRaised(u8 battlerId); -u32 CountPositiveStatStages(u8 battlerId); -u32 CountNegativeStatStages(u8 battlerId); -bool32 ShouldLowerAttack(u8 battlerAtk, u8 battlerDef, u16 defAbility); -bool32 ShouldLowerDefense(u8 battlerAtk, u8 battlerDef, u16 defAbility); -bool32 ShouldLowerSpeed(u8 battlerAtk, u8 battlerDef, u16 defAbility); -bool32 ShouldLowerSpAtk(u8 battlerAtk, u8 battlerDef, u16 defAbility); -bool32 ShouldLowerSpDef(u8 battlerAtk, u8 battlerDef, u16 defAbility); -bool32 ShouldLowerAccuracy(u8 battlerAtk, u8 battlerDef, u16 defAbility); -bool32 ShouldLowerEvasion(u8 battlerAtk, u8 battlerDef, u16 defAbility); +bool32 AnyStatIsRaised(u32 battlerId); +bool32 ShouldLowerStat(u32 battler, u32 battlerAbility, u32 stat); +bool32 BattlerStatCanRise(u32 battler, u32 battlerAbility, u32 stat); +bool32 AreBattlersStatsMaxed(u32 battler); +bool32 BattlerHasAnyStatRaised(u32 battlerId); +u32 CountPositiveStatStages(u32 battlerId); +u32 CountNegativeStatStages(u32 battlerId); +bool32 ShouldLowerAttack(u32 battlerAtk, u32 battlerDef, u32 defAbility); +bool32 ShouldLowerDefense(u32 battlerAtk, u32 battlerDef, u32 defAbility); +bool32 ShouldLowerSpeed(u32 battlerAtk, u32 battlerDef, u32 defAbility); +bool32 ShouldLowerSpAtk(u32 battlerAtk, u32 battlerDef, u32 defAbility); +bool32 ShouldLowerSpDef(u32 battlerAtk, u32 battlerDef, u32 defAbility); +bool32 ShouldLowerAccuracy(u32 battlerAtk, u32 battlerDef, u32 defAbility); +bool32 ShouldLowerEvasion(u32 battlerAtk, u32 battlerDef, u32 defAbility); // move checks -bool32 IsAffectedByPowder(u8 battler, u16 ability, u16 holdEffect); +bool32 IsAffectedByPowder(u32 battler, u32 ability, u32 holdEffect); bool32 MovesWithSplitUnusable(u32 attacker, u32 target, u32 split); -s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 *effectiveness, bool32 considerZPower); +s32 AI_CalcDamageSaveBattlers(u32 move, u32 battlerAtk, u32 battlerDef, u8 *typeEffectiveness, bool32 considerZPower); +s32 AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u8 *typeEffectiveness, bool32 considerZPower, u32 weather); u32 GetNoOfHitsToKO(u32 dmg, s32 hp); -u8 GetMoveDamageResult(u16 move); -u32 GetCurrDamageHpPercent(u8 battlerAtk, u8 battlerDef); -u16 AI_GetTypeEffectiveness(u16 move, u8 battlerAtk, u8 battlerDef); -u32 AI_GetMoveEffectiveness(u16 move, u8 battlerAtk, u8 battlerDef); +void SetMoveDamageResult(u32 battlerAtk, u16 *moves); +u32 GetMoveDamageResult(u32 battlerAtk, u32 battlerDef, u32 moveIndex); +u32 GetCurrDamageHpPercent(u32 battlerAtk, u32 battlerDef); +uq4_12_t AI_GetTypeEffectiveness(u32 move, u32 battlerAtk, u32 battlerDef); +u32 AI_GetMoveEffectiveness(u32 move, u32 battlerAtk, u32 battlerDef); u16 *GetMovesArray(u32 battler); -bool32 IsConfusionMoveEffect(u16 moveEffect); +bool32 IsConfusionMoveEffect(u32 moveEffect); bool32 HasMove(u32 battlerId, u32 move); bool32 HasOnlyMovesWithSplit(u32 battlerId, u32 split, bool32 onlyOffensive); bool32 HasMoveWithSplit(u32 battler, u32 split); -bool32 HasMoveWithType(u32 battler, u8 type); -bool32 HasMoveWithTypeAndSplit(u32 battler, u8 type, u8 split); -bool32 HasMoveEffect(u32 battlerId, u16 moveEffect); -bool32 HasMoveWithLowAccuracy(u8, u8, u8, bool32, u16, u16, u16, u16); -bool32 TestMoveFlagsInMoveset(u8 battler, u32 flags); -bool32 IsAromaVeilProtectedMove(u16 move); -bool32 IsNonVolatileStatusMoveEffect(u16 moveEffect); -bool32 IsStatLoweringMoveEffect(u16 moveEffect); -bool32 IsMoveRedirectionPrevented(u16 move, u16 atkAbility); -bool32 IsMoveEncouragedToHit(u8 battlerAtk, u8 battlerDef, u16 move); -bool32 IsHazardMoveEffect(u16 moveEffect); -bool32 MoveCallsOtherMove(u16 move); -bool32 MoveRequiresRecharging(u16 move); -bool32 IsInstructBannedMove(u16 move); -bool32 IsEncoreEncouragedEffect(u16 moveEffect); -void ProtectChecks(u8 battlerAtk, u8 battlerDef, u16 move, u16 predictedMove, s16 *score); -bool32 ShouldSetSandstorm(u8 battler, u16 ability, u16 holdEffect); -bool32 ShouldSetHail(u8 battler, u16 ability, u16 holdEffect); -bool32 ShouldSetSnow(u8 battler, u16 ability, u16 holdEffect); -bool32 ShouldSetRain(u8 battlerAtk, u16 ability, u16 holdEffect); -bool32 ShouldSetSun(u8 battlerAtk, u16 atkAbility, u16 holdEffect); -bool32 HasSleepMoveWithLowAccuracy(u8 battlerAtk, u8 battlerDef); -bool32 IsHealingMoveEffect(u16 effect); +bool32 HasMoveWithType(u32 battler, u32 type); +bool32 HasMoveWithTypeAndSplit(u32 battler, u32 type, u32 split); +bool32 HasMoveEffect(u32 battlerId, u32 moveEffect); +bool32 HasMoveWithLowAccuracy(u32 battlerAtk, u32 battlerDef, u32 accCheck, bool32 ignoreStatus, u32 atkAbility, u32 defAbility, u32 atkHoldEffect, u32 defHoldEffect); +bool32 IsAromaVeilProtectedMove(u32 move); +bool32 IsNonVolatileStatusMoveEffect(u32 moveEffect); +bool32 IsStatLoweringMoveEffect(u32 moveEffect); +bool32 IsMoveRedirectionPrevented(u32 move, u32 atkAbility); +bool32 IsMoveEncouragedToHit(u32 battlerAtk, u32 battlerDef, u32 move); +bool32 IsHazardMoveEffect(u32 moveEffect); +bool32 MoveCallsOtherMove(u32 move); +bool32 MoveRequiresRecharging(u32 move); +bool32 IsEncoreEncouragedEffect(u32 moveEffect); +void ProtectChecks(u32 battlerAtk, u32 battlerDef, u32 move, u32 predictedMove, s32 *score); +bool32 ShouldSetSandstorm(u32 battler, u32 ability, u32 holdEffect); +bool32 ShouldSetHail(u32 battler, u32 ability, u32 holdEffect); +bool32 ShouldSetSnow(u32 battler, u32 ability, u32 holdEffect); +bool32 ShouldSetRain(u32 battlerAtk, u32 ability, u32 holdEffect); +bool32 ShouldSetSun(u32 battlerAtk, u32 atkAbility, u32 holdEffect); +bool32 HasSleepMoveWithLowAccuracy(u32 battlerAtk, u32 battlerDef); +bool32 IsHealingMoveEffect(u32 effect); bool32 HasHealingEffect(u32 battler); -bool32 IsTrappingMoveEffect(u16 effect); -bool32 HasTrappingMoveEffect(u8 battler); -bool32 ShouldFakeOut(u8 battlerAtk, u8 battlerDef, u16 move); -bool32 HasThawingMove(u8 battlerId); -bool32 IsStatRaisingEffect(u16 effect); -bool32 IsStatLoweringEffect(u16 effect); -bool32 IsStatRaisingEffect(u16 effect); -bool32 IsAttackBoostMoveEffect(u16 effect); -bool32 IsUngroundingEffect(u16 effect); -bool32 IsSemiInvulnerable(u8 battlerDef, u16 move); +bool32 IsTrappingMoveEffect(u32 effect); +bool32 HasTrappingMoveEffect(u32 battler); +bool32 ShouldFakeOut(u32 battlerAtk, u32 battlerDef, u32 move); +bool32 HasThawingMove(u32 battler); +bool32 IsStatRaisingEffect(u32 effect); +bool32 IsStatLoweringEffect(u32 effect); +bool32 IsStatRaisingEffect(u32 effect); +bool32 IsAttackBoostMoveEffect(u32 effect); +bool32 IsUngroundingEffect(u32 effect); +bool32 IsSemiInvulnerable(u32 battlerDef, u32 move); +bool32 HasSoundMove(u32 battler); +bool32 HasHighCritRatioMove(u32 battler); +bool32 HasMagicCoatAffectedMove(u32 battler); +bool32 HasSnatchAffectedMove(u32 battler); // status checks -bool32 AI_CanBeBurned(u8 battler, u16 ability); -bool32 AI_CanGetFrostbite(u8 battler, u16 ability); -bool32 AI_CanBeConfused(u8 battler, u16 ability); -bool32 AI_CanSleep(u8 battler, u16 ability); -bool32 IsBattlerIncapacitated(u8 battler, u16 ability); -bool32 AI_CanPutToSleep(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove); -bool32 ShouldPoisonSelf(u8 battler, u16 ability); -bool32 AI_CanPoison(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove); -bool32 AI_CanParalyze(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove); -bool32 AI_CanConfuse(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 battlerAtkPartner, u16 move, u16 partnerMove); -bool32 ShouldBurnSelf(u8 battler, u16 ability); -bool32 AI_CanBurn(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 battlerAtkPartner, u16 move, u16 partnerMove); -bool32 AI_CanGiveFrostbite(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 battlerAtkPartner, u16 move, u16 partnerMove); -bool32 AI_CanBeInfatuated(u8 battlerAtk, u8 battlerDef, u16 defAbility); -bool32 AnyPartyMemberStatused(u8 battlerId, bool32 checkSoundproof); -u32 ShouldTryToFlinch(u8 battlerAtk, u8 battlerDef, u16 atkAbility, u16 defAbility, u16 move); -bool32 ShouldTrap(u8 battlerAtk, u8 battlerDef, u16 move); -bool32 IsWakeupTurn(u8 battler); -bool32 AI_IsBattlerAsleepOrComatose(u8 battlerId); +bool32 AI_CanBeBurned(u32 battler, u32 ability); +bool32 AI_CanGetFrostbite(u32 battler, u32 ability); +bool32 AI_CanBeConfused(u32 battler, u32 ability); +bool32 AI_CanSleep(u32 battler, u32 ability); +bool32 IsBattlerIncapacitated(u32 battler, u32 ability); +bool32 AI_CanPutToSleep(u32 battlerAtk, u32 battlerDef, u32 defAbility, u32 move, u32 partnerMove); +bool32 ShouldPoisonSelf(u32 battler, u32 ability); +bool32 AI_CanPoison(u32 battlerAtk, u32 battlerDef, u32 defAbility, u32 move, u32 partnerMove); +bool32 AI_CanParalyze(u32 battlerAtk, u32 battlerDef, u32 defAbility, u32 move, u32 partnerMove); +bool32 AI_CanConfuse(u32 battlerAtk, u32 battlerDef, u32 defAbility, u32 battlerAtkPartner, u32 move, u32 partnerMove); +bool32 ShouldBurnSelf(u32 battler, u32 ability); +bool32 AI_CanBurn(u32 battlerAtk, u32 battlerDef, u32 defAbility, u32 battlerAtkPartner, u32 move, u32 partnerMove); +bool32 AI_CanGiveFrostbite(u32 battlerAtk, u32 battlerDef, u32 defAbility, u32 battlerAtkPartner, u32 move, u32 partnerMove); +bool32 AI_CanBeInfatuated(u32 battlerAtk, u32 battlerDef, u32 defAbility); +bool32 AnyPartyMemberStatused(u32 battlerId, bool32 checkSoundproof); +u32 ShouldTryToFlinch(u32 battlerAtk, u32 battlerDef, u32 atkAbility, u32 defAbility, u32 move); +bool32 ShouldTrap(u32 battlerAtk, u32 battlerDef, u32 move); +bool32 IsWakeupTurn(u32 battler); +bool32 AI_IsBattlerAsleepOrComatose(u32 battlerId); // partner logic -u16 GetAllyChosenMove(u8 battlerId); -bool32 IsValidDoubleBattle(u8 battlerAtk); -bool32 IsTargetingPartner(u8 battlerAtk, u8 battlerDef); -bool32 DoesPartnerHaveSameMoveEffect(u8 battlerAtkPartner, u8 battlerDef, u16 move, u16 partnerMove); -bool32 PartnerHasSameMoveEffectWithoutTarget(u8 battlerAtkPartner, u16 move, u16 partnerMove); -bool32 PartnerMoveEffectIsStatusSameTarget(u8 battlerAtkPartner, u8 battlerDef, u16 partnerMove); -bool32 PartnerMoveEffectIsWeather(u8 battlerAtkPartner, u16 partnerMove); -bool32 PartnerMoveEffectIsTerrain(u8 battlerAtkPartner, u16 partnerMove); -bool32 PartnerMoveIs(u8 battlerAtkPartner, u16 partnerMove, u16 moveCheck); -bool32 PartnerMoveIsSameAsAttacker(u8 battlerAtkPartner, u8 battlerDef, u16 move, u16 partnerMove); -bool32 PartnerMoveIsSameNoTarget(u8 battlerAtkPartner, u16 move, u16 partnerMove); -bool32 ShouldUseWishAromatherapy(u8 battlerAtk, u8 battlerDef, u16 move); +#define IS_TARGETING_PARTNER(battlerAtk, battlerDef)((battlerAtk) == (battlerDef ^ BIT_FLANK)) +u32 GetAllyChosenMove(u32 battlerId); +bool32 IsValidDoubleBattle(u32 battlerAtk); +bool32 IsTargetingPartner(u32 battlerAtk, u32 battlerDef); +bool32 DoesPartnerHaveSameMoveEffect(u32 battlerAtkPartner, u32 battlerDef, u32 move, u32 partnerMove); +bool32 PartnerHasSameMoveEffectWithoutTarget(u32 battlerAtkPartner, u32 move, u32 partnerMove); +bool32 PartnerMoveEffectIsStatusSameTarget(u32 battlerAtkPartner, u32 battlerDef, u32 partnerMove); +bool32 PartnerMoveEffectIsWeather(u32 battlerAtkPartner, u32 partnerMove); +bool32 PartnerMoveEffectIsTerrain(u32 battlerAtkPartner, u32 partnerMove); +bool32 PartnerMoveIs(u32 battlerAtkPartner, u32 partnerMove, u32 moveCheck); +bool32 PartnerMoveIsSameAsAttacker(u32 battlerAtkPartner, u32 battlerDef, u32 move, u32 partnerMove); +bool32 PartnerMoveIsSameNoTarget(u32 battlerAtkPartner, u32 move, u32 partnerMove); +bool32 ShouldUseWishAromatherapy(u32 battlerAtk, u32 battlerDef, u32 move); // party logic -s32 AI_CalcPartyMonDamage(u16 move, u8 battlerAtk, u8 battlerDef, struct Pokemon *mon); -s32 CountUsablePartyMons(u8 battlerId); -bool32 IsPartyFullyHealedExceptBattler(u8 battler); -bool32 PartyHasMoveSplit(u8 battlerId, u8 split); -bool32 SideHasMoveSplit(u8 battlerId, u8 split); +struct BattlePokemon *AllocSaveBattleMons(void); +void FreeRestoreBattleMons(struct BattlePokemon *savedBattleMons); +s32 AI_CalcPartyMonBestMoveDamage(u32 battlerAtk, u32 battlerDef, struct Pokemon *attackerMon, struct Pokemon *targetMon); +s32 CountUsablePartyMons(u32 battlerId); +bool32 IsPartyFullyHealedExceptBattler(u32 battler); +bool32 PartyHasMoveSplit(u32 battlerId, u32 split); +bool32 SideHasMoveSplit(u32 battlerId, u32 split); // score increases -void IncreaseStatUpScore(u8 battlerAtk, u8 battlerDef, u8 statId, s16 *score); -void IncreasePoisonScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score); -void IncreaseBurnScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score); -void IncreaseParalyzeScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score); -void IncreaseSleepScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score); -void IncreaseConfusionScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score); -void IncreaseFrostbiteScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score); +void IncreaseStatUpScore(u32 battlerAtk, u32 battlerDef, u32 statId, s32 *score); +void IncreasePoisonScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score); +void IncreaseBurnScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score); +void IncreaseParalyzeScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score); +void IncreaseSleepScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score); +void IncreaseConfusionScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score); +void IncreaseFrostbiteScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score); #endif //GUARD_BATTLE_AI_UTIL_H diff --git a/include/battle_anim.h b/include/battle_anim.h index 28096d603ede..7aaa09951809 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -165,8 +165,6 @@ void Trade_MoveSelectedMonToTarget(struct Sprite *sprite); void DestroyAnimVisualTaskAndDisableBlend(u8 taskId); void DestroySpriteAndFreeResources_(struct Sprite *sprite); void SetBattlerSpriteYOffsetFromOtherYScale(u8 spriteId, u8 otherSpriteId); -u8 GetBattlerSide(u8 battler); -u8 GetBattlerPosition(u8 battler); u8 GetBattlerAtPosition(u8 position); void ConvertPosDataToTranslateLinearData(struct Sprite *sprite); void InitAnimFastLinearTranslationWithSpeedAndPos(struct Sprite *sprite); @@ -205,16 +203,28 @@ u8 GetBattlerSpriteDefault_Y(u8 battlerId); u8 GetSubstituteSpriteDefault_Y(u8 battlerId); // battle_anim_status_effects.c -#define STAT_ANIM_PLUS1 MOVE_EFFECT_ATK_PLUS_1 -#define STAT_ANIM_PLUS2 MOVE_EFFECT_ATK_PLUS_2 -#define STAT_ANIM_MINUS1 MOVE_EFFECT_ATK_MINUS_1 -#define STAT_ANIM_MINUS2 MOVE_EFFECT_ATK_MINUS_2 +#define STAT_ANIM_PLUS1 MOVE_EFFECT_ATK_PLUS_1 - 1 +#define STAT_ANIM_PLUS2 MOVE_EFFECT_ATK_PLUS_2 - 1 +#define STAT_ANIM_MINUS1 MOVE_EFFECT_ATK_MINUS_1 - 1 +#define STAT_ANIM_MINUS2 MOVE_EFFECT_ATK_MINUS_2 - 1 #define STAT_ANIM_MULTIPLE_PLUS1 55 #define STAT_ANIM_MULTIPLE_PLUS2 56 #define STAT_ANIM_MULTIPLE_MINUS1 57 #define STAT_ANIM_MULTIPLE_MINUS2 58 + +enum { + STAT_ANIM_PAL_ATK, + STAT_ANIM_PAL_DEF, + STAT_ANIM_PAL_ACC, + STAT_ANIM_PAL_SPEED, + STAT_ANIM_PAL_EVASION, + STAT_ANIM_PAL_SPATK, + STAT_ANIM_PAL_SPDEF, + STAT_ANIM_PAL_MULTIPLE = 0xFF +}; + void LaunchStatusAnimation(u8 battlerId, u8 statusAnimId); -extern const union AnimCmd *const sAnims_SpinningSparkle[]; +extern const union AnimCmd *const gAnims_SpinningSparkle[]; // battle_anim_ground.c void AnimTask_HorizontalShake(u8 taskId); @@ -236,6 +246,7 @@ void InitStatsChangeAnimation(u8); void StartMonScrollingBgMask(u8 taskId, int unused, u16 scrollSpeed, u8 battler, bool8 includePartner, u8 numFadeSteps, u8 fadeStepDelay, u8 duration, const u32 *gfx, const u32 *tilemap, const u32 *palette); // battle_anim_effects_1.c +void AnimFalseSwipeSlice_Step3(struct Sprite *); void SetSpriteNextToMonHead(u8 battler, struct Sprite *sprite); void AnimMoveTwisterParticle(struct Sprite *sprite); void AnimParticleBurst(struct Sprite *); @@ -284,6 +295,7 @@ extern const union AnimCmd *const gIngrainRootAnimTable[]; extern const union AffineAnimCmd *const gSwiftStarAffineAnimTable[]; extern const union AnimCmd *const gMetronomeThroughtBubbleAnimTable[]; extern const union AffineAnimCmd *const gStockpileAbsorptionOrbAffineAnimTable[]; +extern const union AnimCmd *const gSlashSliceAnimTable[]; // battle_anim_effects_2.c void AnimUproarRing(struct Sprite *sprite); @@ -302,8 +314,10 @@ extern const union AffineAnimCmd *const gWaterPulseRingAffineAnimTable[]; extern const union AffineAnimCmd *const gHyperVoiceRingAffineAnimTable[]; extern const union AnimCmd *const gCoinAnimTable[]; extern const union AffineAnimCmd *const gHiddenPowerOrbAffineAnimTable[]; +extern const union AffineAnimCmd *const gBulletSeedAffineAnimTable[]; // battle_anim_effects_3.c +void AnimKnockOffStrike_Step(struct Sprite *sprite); void AnimBlackSmoke(struct Sprite *sprite); void AnimSweetScentPetal(struct Sprite *sprite); void AnimTealAlert(struct Sprite *sprite); @@ -315,6 +329,10 @@ void AnimFlatterSpotlight_Step(struct Sprite *sprite); extern const union AnimCmd *const gOpeningEyeAnimTable[]; extern const union AnimCmd *const gEclipsingOrbAnimTable[]; extern const union AffineAnimCmd *const gSpotlightAffineAnimTable[]; +extern const union AffineAnimCmd *const gSmokeBallEscapeCloudAffineAnimTable[]; +extern void AnimSmokeBallEscapeCloud(struct Sprite *sprite); +extern const union AffineAnimCmd *const gKnockOffStrikeAffineAnimTable[]; +extern const union AnimCmd *const gKnockOffStrikeAnimTable[]; // battle_anim_water.c void AnimWaterPulseRing(struct Sprite *sprite); @@ -338,6 +356,7 @@ extern const union AnimCmd *const gAffineAnims_AirWaveCrescent[]; extern const union AffineAnimCmd *const gAffineAnims_FlyBallUp[]; extern const union AffineAnimCmd *const gAffineAnims_FlyBallAttack[]; extern const union AffineAnimCmd *const gAffineAnims_BounceBallLand[]; +extern const union AnimCmd *const gAnims_FallingFeather[]; // battle_anim_poison.c void AnimSludgeBombHitParticle(struct Sprite *); @@ -353,6 +372,7 @@ void AnimGhostStatusSprite(struct Sprite *sprite); void AnimShadowBall(struct Sprite *sprite); void AnimTask_GrudgeFlames_Step(u8 taskId); extern const union AffineAnimCmd *const gAffineAnims_ShadowBall[]; +extern const union AnimCmd *const gAnims_GrudgeFlame[]; // battle_anim_psychic.c extern const union AffineAnimCmd *const gAffineAnims_PsychoBoostOrb[]; @@ -475,6 +495,7 @@ void AnimRaiseSprite(struct Sprite *sprite); void AnimFallingRock_Step(struct Sprite *sprite); void AnimFlyingSandCrescent(struct Sprite *sprite); void AnimRockFragment(struct Sprite *); +void AnimRockBlastRock(struct Sprite *sprite); // battle_anim_dark.c void AnimClawSlash(struct Sprite *sprite); @@ -497,6 +518,7 @@ void AnimSwirlingSnowball_Step1(struct Sprite *sprite); extern const union AnimCmd *const gAnims_Snowball[]; extern const union AffineAnimCmd *const gAffineAnims_IceCrystalHit[]; extern const union AnimCmd *const gAnims_IceCrystalLarge[]; +extern const union AnimCmd *const gAnims_IceCrystalSmall[]; extern const union AnimCmd *const gAnims_IceBallChunk[]; extern const union AnimCmd *const gAnims_BlizzardIceCrystal[]; @@ -521,6 +543,7 @@ void AnimDragonRageFirePlume(struct Sprite *sprite); void AnimDragonFireToTarget(struct Sprite *sprite); void AnimDragonDanceOrb(struct Sprite *sprite); void AnimOverheatFlame(struct Sprite *sprite); +void AnimOutrageFlame(struct Sprite *sprite); // battle_anim_new.c void CoreEnforcerLoadBeamTarget(struct Sprite *sprite); diff --git a/include/battle_controllers.h b/include/battle_controllers.h index e1ab98b0c75b..4e3ab7eb05c3 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -99,6 +99,7 @@ enum { // Special return values in gBattleBufferB from Battle Controller functions. #define RET_VALUE_LEVELED_UP 11 #define RET_MEGA_EVOLUTION 0x80 +#define RET_ULTRA_BURST 0x70 struct UnusedControllerStruct { @@ -129,6 +130,7 @@ struct ChooseMoveStruct u8 monType2; u8 monType3; struct MegaEvolutionData mega; + struct UltraBurstData burst; struct ZMoveData zmove; }; @@ -197,6 +199,9 @@ enum }; extern struct UnusedControllerStruct gUnusedControllerStruct; +extern void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(u32 battler); +extern void (*gBattlerControllerEndFuncs[MAX_BATTLERS_COUNT])(u32 battler); +extern u8 gBattleControllerData[MAX_BATTLERS_COUNT]; // general functions void HandleLinkBattleSetup(void); @@ -204,90 +209,135 @@ void SetUpBattleVarsAndBirchZigzagoon(void); void InitBattleControllers(void); bool32 IsValidForBattle(struct Pokemon *mon); void TryReceiveLinkBattleData(void); -void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data); +void PrepareBufferDataTransferLink(u32 battler, u32 bufferId, u16 size, u8 *data); // emitters -void BtlController_EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck); -void BtlController_EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data); -void BtlController_EmitLoadMonSprite(u8 bufferId); -void BtlController_EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit); -void BtlController_EmitReturnMonToBall(u8 bufferId, bool8 skipAnim); -void BtlController_EmitDrawTrainerPic(u8 bufferId); -void BtlController_EmitTrainerSlide(u8 bufferId); -void BtlController_EmitTrainerSlideBack(u8 bufferId); -void BtlController_EmitFaintAnimation(u8 bufferId); -void BtlController_EmitBallThrowAnim(u8 bufferId, u8 caseId); -void BtlController_EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 dmg, u8 friendship, struct DisableStruct *disableStructPtr, u8 multihit); -void BtlController_EmitPrintString(u8 bufferId, u16 stringId); -void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringId); -void BtlController_EmitChooseAction(u8 bufferId, u8 action, u16 itemId); -void BtlController_EmitYesNoBox(u8 bufferId); -void BtlController_EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData); -void BtlController_EmitChooseItem(u8 bufferId, u8 *battlePartyOrder); -void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 slotId, u16 abilityId, u8 *data); -void BtlController_EmitHealthBarUpdate(u8 bufferId, u16 hpValue); -void BtlController_EmitExpUpdate(u8 bufferId, u8 partyId, s32 expPoints); -void BtlController_EmitStatusIconUpdate(u8 bufferId, u32 status1, u32 status2); -void BtlController_EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status); -void BtlController_EmitDataTransfer(u8 bufferId, u16 size, void *data); -void BtlController_EmitTwoReturnValues(u8 bufferId, u8 ret8, u32 ret32); -void BtlController_EmitChosenMonReturnValue(u8 bufferId, u8 partyId, u8 *battlePartyOrder); -void BtlController_EmitOneReturnValue(u8 bufferId, u16 ret); -void BtlController_EmitOneReturnValue_Duplicate(u8 bufferId, u16 ret); -void BtlController_EmitHitAnimation(u8 bufferId); -void BtlController_EmitCantSwitch(u8 bufferId); -void BtlController_EmitPlaySE(u8 bufferId, u16 songId); -void BtlController_EmitPlayFanfareOrBGM(u8 bufferId, u16 songId, bool8 playBGM); -void BtlController_EmitFaintingCry(u8 bufferId); -void BtlController_EmitIntroSlide(u8 bufferId, u8 terrainId); -void BtlController_EmitIntroTrainerBallThrow(u8 bufferId); -void BtlController_EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 flags); -void BtlController_EmitHidePartyStatusSummary(u8 bufferId); -void BtlController_EmitEndBounceEffect(u8 bufferId); -void BtlController_EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible); -void BtlController_EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument); -void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 mode, bool32 record); -void BtlController_EmitResetActionMoveSelection(u8 bufferId, u8 caseId); -void BtlController_EmitEndLinkBattle(u8 bufferId, u8 battleOutcome); -void BtlController_EmitDebugMenu(u8 bufferId); +void BtlController_EmitGetMonData(u32 battler, u32 bufferId, u8 requestId, u8 monToCheck); +void BtlController_EmitSetMonData(u32 battler, u32 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data); +void BtlController_EmitLoadMonSprite(u32 battler, u32 bufferId); +void BtlController_EmitSwitchInAnim(u32 battler, u32 bufferId, u8 partyId, bool8 dontClearSubstituteBit); +void BtlController_EmitReturnMonToBall(u32 battler, u32 bufferId, bool8 skipAnim); +void BtlController_EmitDrawTrainerPic(u32 battler, u32 bufferId); +void BtlController_EmitTrainerSlide(u32 battler, u32 bufferId); +void BtlController_EmitTrainerSlideBack(u32 battler, u32 bufferId); +void BtlController_EmitFaintAnimation(u32 battler, u32 bufferId); +void BtlController_EmitBallThrowAnim(u32 battler, u32 bufferId, u8 caseId); +void BtlController_EmitMoveAnimation(u32 battler, u32 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 dmg, u8 friendship, struct DisableStruct *disableStructPtr, u8 multihit); +void BtlController_EmitPrintString(u32 battler, u32 bufferId, u16 stringId); +void BtlController_EmitPrintSelectionString(u32 battler, u32 bufferId, u16 stringId); +void BtlController_EmitChooseAction(u32 battler, u32 bufferId, u8 action, u16 itemId); +void BtlController_EmitYesNoBox(u32 battler, u32 bufferId); +void BtlController_EmitChooseMove(u32 battler, u32 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData); +void BtlController_EmitChooseItem(u32 battler, u32 bufferId, u8 *battlePartyOrder); +void BtlController_EmitChoosePokemon(u32 battler, u32 bufferId, u8 caseId, u8 slotId, u16 abilityId, u8 *data); +void BtlController_EmitHealthBarUpdate(u32 battler, u32 bufferId, u16 hpValue); +void BtlController_EmitExpUpdate(u32 battler, u32 bufferId, u8 partyId, s32 expPoints); +void BtlController_EmitStatusIconUpdate(u32 battler, u32 bufferId, u32 status1, u32 status2); +void BtlController_EmitStatusAnimation(u32 battler, u32 bufferId, bool8 status2, u32 status); +void BtlController_EmitDataTransfer(u32 battler, u32 bufferId, u16 size, void *data); +void BtlController_EmitTwoReturnValues(u32 battler, u32 bufferId, u8 ret8, u32 ret32); +void BtlController_EmitChosenMonReturnValue(u32 battler, u32 bufferId, u8 partyId, u8 *battlePartyOrder); +void BtlController_EmitOneReturnValue(u32 battler, u32 bufferId, u16 ret); +void BtlController_EmitOneReturnValue_Duplicate(u32 battler, u32 bufferId, u16 ret); +void BtlController_EmitHitAnimation(u32 battler, u32 bufferId); +void BtlController_EmitCantSwitch(u32 battler, u32 bufferId); +void BtlController_EmitPlaySE(u32 battler, u32 bufferId, u16 songId); +void BtlController_EmitPlayFanfareOrBGM(u32 battler, u32 bufferId, u16 songId, bool8 playBGM); +void BtlController_EmitFaintingCry(u32 battler, u32 bufferId); +void BtlController_EmitIntroSlide(u32 battler, u32 bufferId, u8 terrainId); +void BtlController_EmitIntroTrainerBallThrow(u32 battler, u32 bufferId); +void BtlController_EmitDrawPartyStatusSummary(u32 battler, u32 bufferId, struct HpAndStatus* hpAndStatus, u8 flags); +void BtlController_EmitHidePartyStatusSummary(u32 battler, u32 bufferId); +void BtlController_EmitEndBounceEffect(u32 battler, u32 bufferId); +void BtlController_EmitSpriteInvisibility(u32 battler, u32 bufferId, bool8 isInvisible); +void BtlController_EmitBattleAnimation(u32 battler, u32 bufferId, u8 animationId, u16 argument); +void BtlController_EmitLinkStandbyMsg(u32 battler, u32 bufferId, u8 mode, bool32 record); +void BtlController_EmitResetActionMoveSelection(u32 battler, u32 bufferId, u8 caseId); +void BtlController_EmitEndLinkBattle(u32 battler, u32 bufferId, u8 battleOutcome); +void BtlController_EmitDebugMenu(u32 battler, u32 bufferId); + +void BattleControllerComplete(u32 battler); // Can be used for all the controllers. +void BtlController_Empty(u32 battler); // Empty command, does nothing, only completes the execution. +void BtlController_TerminatorNop(u32 battler); // Dummy function at the end of the table. +void BattleControllerDummy(u32 battler); +void StartSendOutAnim(u32 battler, bool32 dontClearSubstituteBit); +void Controller_WaitForString(u32 battler); +void Controller_WaitForHealthBar(u32 battler); + +// handlers +void BtlController_HandleGetMonData(u32 battler); +void BtlController_HandleGetRawMonData(u32 battler); +void BtlController_HandleSetMonData(u32 battler); +void BtlController_HandleSetRawMonData(u32 battler); +void BtlController_HandleLoadMonSprite(u32 battler, void (*controllerCallback)(u32 battler)); +void BtlController_HandleSwitchInAnim(u32 battler, bool32 isPlayerSide, void (*controllerCallback)(u32 battler)); +void BtlController_HandleReturnMonToBall(u32 battler); +void BtlController_HandleDrawTrainerPic(u32 battlerId, u32 trainerPicId, bool32 isFrontPic, s16 xPos, s16 yPos, s32 subpriority); +void BtlController_HandleTrainerSlide(u32 battler, u32 trainerPicId); +void BtlController_HandleTrainerSlideBack(u32 battlerId, s16 data0, bool32 startAnim); +void BtlController_HandleFaintAnimation(u32 battler); +void BtlController_HandleSuccessBallThrowAnim(u32 battler, u32 target, u32 animId, bool32 allowCriticalCapture); +void BtlController_HandleBallThrowAnim(u32 battler, u32 target, u32 animId, bool32 allowCriticalCapture); +void BtlController_HandleMoveAnimation(u32 battler, bool32 updateTvData); +void BtlController_HandlePrintString(u32 battler, bool32 updateTvData, bool32 arenaPtsDeduct); +void BtlController_HandleHealthBarUpdate(u32 battler, bool32 updateHpText); +void DoStatusIconUpdate(u32 battler); +void BtlController_HandleStatusIconUpdate(u32 battler); +void BtlController_HandleStatusAnimation(u32 battler); +void BtlController_HandleClearUnkVar(u32 battler); +void BtlController_HandleSetUnkVar(u32 battler); +void BtlController_HandleClearUnkFlag(u32 battler); +void BtlController_HandleToggleUnkFlag(u32 battler); +void BtlController_HandleHitAnimation(u32 battler); +void BtlController_HandlePlaySE(u32 battler); +void BtlController_HandlePlayFanfareOrBGM(u32 battler); +void BtlController_HandleFaintingCry(u32 battler); +void BtlController_HandleIntroSlide(u32 battler); +void BtlController_HandleSpriteInvisibility(u32 battler); +bool32 TwoPlayerIntroMons(u32 battlerId); // Double battle with both player pokemon active. +bool32 TwoOpponentIntroMons(u32 battlerId); // Double battle with both opponent pokemon active. +void BtlController_HandleIntroTrainerBallThrow(u32 battler, u16 tagTrainerPal, const u32 *trainerPal, s16 framesToWait, void (*controllerCallback)(u32 battler)); +void BtlController_HandleDrawPartyStatusSummary(u32 battler, u32 side, bool32 considerDelay); +void BtlController_HandleHidePartyStatusSummary(u32 battler); +void BtlController_HandleBattleAnimation(u32 battler, bool32 ignoreSE, bool32 updateTvData); // player controller -void SetControllerToPlayer(void); -void BattleControllerDummy(void); -void PlayerHandleGetRawMonData(void); -void SetBattleEndCallbacks(void); -void SpriteCB_FreePlayerSpriteLoadMonSprite(struct Sprite *sprite); +void SetControllerToPlayer(u32 battler); +void SetBattleEndCallbacks(u32 battler); +void PlayerHandleExpUpdate(u32 battler); +u32 LinkPlayerGetTrainerPicId(u32 multiplayerId); void CB2_SetUpReshowBattleScreenAfterMenu(void); void CB2_SetUpReshowBattleScreenAfterMenu2(void); void Task_PlayerController_RestoreBgmAfterCry(u8 taskId); void ActionSelectionCreateCursorAt(u8 cursorPos, u8 unused); void ActionSelectionDestroyCursorAt(u8 cursorPos); -void InitMoveSelectionsVarsAndStrings(void); +void InitMoveSelectionsVarsAndStrings(u32 battler); void MoveSelectionCreateCursorAt(u8 cursorPos, u8 arg1); void MoveSelectionDestroyCursorAt(u8 cursorPosition); // recorded player controller -void SetControllerToRecordedPlayer(void); +void SetControllerToRecordedPlayer(u32 battler); // opponent controller -void SetControllerToOpponent(void); +void SetControllerToOpponent(u32 battler); // player partner controller -void SetControllerToPlayerPartner(void); +void Controller_PlayerPartnerShowIntroHealthbox(u32 battler); // Also used by the link partner. +void SetControllerToPlayerPartner(u32 battler); // safari controller -void SetControllerToSafari(void); +void SetControllerToSafari(u32 battler); // wally controller -void SetControllerToWally(void); +void SetControllerToWally(u32 battler); // recorded opponent controller -void SetControllerToRecordedOpponent(void); +void SetControllerToRecordedOpponent(u32 battler); // link opponent -void SetControllerToLinkOpponent(void); +void SetControllerToLinkOpponent(u32 battler); // link partner -void SetControllerToLinkPartner(void); +void SetControllerToLinkPartner(u32 battler); #endif // GUARD_BATTLE_CONTROLLERS_H diff --git a/include/battle_dome.h b/include/battle_dome.h index 900508c4bf3e..b7572451cab2 100644 --- a/include/battle_dome.h +++ b/include/battle_dome.h @@ -1,8 +1,6 @@ #ifndef GUARD_BATTLE_DOME_H #define GUARD_BATTLE_DOME_H -extern u32 gPlayerPartyLostHP; - int GetDomeTrainerSelectedMons(u16 tournamentTrainerId); int TrainerIdToDomeTournamentId(u16 trainerId); diff --git a/include/battle_gfx_sfx_util.h b/include/battle_gfx_sfx_util.h index 9a0b79c31375..95c97cabaa23 100644 --- a/include/battle_gfx_sfx_util.h +++ b/include/battle_gfx_sfx_util.h @@ -3,42 +3,40 @@ void AllocateBattleSpritesData(void); void FreeBattleSpritesData(void); -u16 ChooseMoveAndTargetInBattlePalace(void); +u16 ChooseMoveAndTargetInBattlePalace(u32 battler); void SpriteCB_WaitForBattlerBallReleaseAnim(struct Sprite *sprite); void SpriteCB_TrainerSlideIn(struct Sprite *sprite); -void InitAndLaunchChosenStatusAnimation(bool8 isStatus2, u32 status); +void InitAndLaunchChosenStatusAnimation(u32 battler, bool32 isStatus2, u32 status); bool8 TryHandleLaunchBattleTableAnimation(u8 activeBattlerId, u8 attacker, u8 target, u8 tableId, u16 argument); void InitAndLaunchSpecialAnimation(u8 activeBattlerId, u8 attacker, u8 target, u8 tableId); -bool8 IsBattleSEPlaying(u8 battlerId); -void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 battlerId); -void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 battlerId); +bool8 IsBattleSEPlaying(u8 battler); +void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battler); void BattleGfxSfxDummy2(u16 species); -void DecompressTrainerFrontPic(u16 frontPicId, u8 battlerId); -void DecompressTrainerBackPic(u16 backPicId, u8 battlerId); -void BattleGfxSfxDummy3(u8 gender); +void DecompressTrainerFrontPic(u16 frontPicId, u8 battler); +void DecompressTrainerBackPic(u16 backPicId, u8 battler); void FreeTrainerFrontPicPalette(u16 frontPicId); bool8 BattleLoadAllHealthBoxesGfx(u8 state); void LoadBattleBarGfx(u8 unused); -bool8 BattleInitAllSprites(u8 *state1, u8 *battlerId); +bool8 BattleInitAllSprites(u8 *state1, u8 *battler); void ClearSpritesHealthboxAnimData(void); void CopyAllBattleSpritesInvisibilities(void); -void CopyBattleSpriteInvisibility(u8 battlerId); -void HandleSpeciesGfxDataChange(u8 attacker, u8 target, bool8 castform, bool32 megaEvo, bool8 trackEnemyPersonality); -void BattleLoadSubstituteOrMonSpriteGfx(u8 battlerId, bool8 loadMonSprite); -void LoadBattleMonGfxAndAnimate(u8 battlerId, bool8 loadMonSprite, u8 spriteId); -void TrySetBehindSubstituteSpriteBit(u8 battlerId, u16 move); -void ClearBehindSubstituteBit(u8 battlerId); -void HandleLowHpMusicChange(struct Pokemon *mon, u8 battlerId); +void CopyBattleSpriteInvisibility(u8 battler); +void HandleSpeciesGfxDataChange(u8 attacker, u8 target, bool32 megaEvo, bool8 trackEnemyPersonality); +void BattleLoadSubstituteOrMonSpriteGfx(u8 battler, bool8 loadMonSprite); +void LoadBattleMonGfxAndAnimate(u8 battler, bool8 loadMonSprite, u8 spriteId); +void TrySetBehindSubstituteSpriteBit(u8 battler, u16 move); +void ClearBehindSubstituteBit(u8 battler); +void HandleLowHpMusicChange(struct Pokemon *mon, u8 battler); void BattleStopLowHpSound(void); u8 GetMonHPBarLevel(struct Pokemon *mon); void HandleBattleLowHpMusicChange(void); void SetBattlerSpriteAffineMode(u8 affineMode); void LoadAndCreateEnemyShadowSprites(void); void SpriteCB_SetInvisible(struct Sprite *sprite); -void SetBattlerShadowSpriteCallback(u8 battlerId, u16 species); -void HideBattlerShadowSprite(u8 battlerId); +void SetBattlerShadowSpriteCallback(u8 battler, u16 species); +void HideBattlerShadowSprite(u8 battler); void FillAroundBattleWindows(void); -void ClearTemporarySpeciesSpriteData(u8 battlerId, bool8 dontClearSubstitute); +void ClearTemporarySpeciesSpriteData(u8 battler, bool8 dontClearSubstitute); void AllocateMonSpritesGfx(void); void FreeMonSpritesGfx(void); bool32 ShouldPlayNormalMonCry(struct Pokemon *mon); diff --git a/include/battle_interface.h b/include/battle_interface.h index e2937748a4a6..2c8747db02be 100644 --- a/include/battle_interface.h +++ b/include/battle_interface.h @@ -53,11 +53,13 @@ enum #define TAG_ALPHA_INDICATOR_TILE 0xD779 #define TAG_OMEGA_INDICATOR_TILE 0xD77A #define TAG_ZMOVE_TRIGGER_TILE 0xD77B +#define TAG_BURST_TRIGGER_TILE 0xD77C #define TAG_MEGA_TRIGGER_PAL 0xD777 #define TAG_MEGA_INDICATOR_PAL 0xD778 #define TAG_ALPHA_OMEGA_INDICATOR_PAL 0xD779 // Alpha and Omega indicators use the same palette as each of them only uses 4 different colors. #define TAG_ZMOVE_TRIGGER_PAL 0xD77B +#define TAG_BURST_TRIGGER_PAL 0xD77C enum { @@ -91,6 +93,11 @@ void CreateMegaTriggerSprite(u8 battlerId, u8 palId); bool32 IsMegaTriggerSpriteActive(void); void HideMegaTriggerSprite(void); void DestroyMegaTriggerSprite(void); +void ChangeBurstTriggerSprite(u8 spriteId, u8 animId); +void CreateBurstTriggerSprite(u8 battlerId, u8 palId); +bool32 IsBurstTriggerSpriteActive(void); +void HideBurstTriggerSprite(void); +void DestroyBurstTriggerSprite(void); void MegaIndicator_LoadSpritesGfx(void); u8 CreatePartyStatusSummarySprites(u8 battler, struct HpAndStatus *partyInfo, bool8 skipPlayer, bool8 isBattleStart); void Task_HidePartyStatusSummary(u8 taskId); @@ -105,6 +112,8 @@ bool32 CanThrowLastUsedBall(void); void TryHideLastUsedBall(void); void TryRestoreLastUsedBall(void); void TryAddLastUsedBallItemSprites(void); +void SwapBallToDisplay(bool32 sameBall); +void ArrowsChangeColorLastBallCycle(bool32 showArrows); void UpdateAbilityPopup(u8 battlerId); #endif // GUARD_BATTLE_INTERFACE_H diff --git a/include/battle_main.h b/include/battle_main.h index 5f603654bc33..91e9fd90ebd1 100644 --- a/include/battle_main.h +++ b/include/battle_main.h @@ -53,26 +53,28 @@ void SpriteCB_TrainerThrowObject(struct Sprite *sprite); void AnimSetCenterToCornerVecX(struct Sprite *sprite); void BeginBattleIntroDummy(void); void BeginBattleIntro(void); -void SwitchInClearSetData(void); -void FaintClearSetData(void); +void SwitchInClearSetData(u32 battler); +void FaintClearSetData(u32 battler); void BattleTurnPassed(void); -u8 IsRunningFromBattleImpossible(void); -void SwitchPartyOrder(u8 battlerId); +u8 IsRunningFromBattleImpossible(u32 battler); +void SwitchPartyOrder(u32 battlerId); void SwapTurnOrder(u8 id1, u8 id2); -u32 GetBattlerTotalSpeedStat(u8 battlerId); +u32 GetBattlerTotalSpeedStatArgs(u32 battler, u32 ability, u32 holdEffect); +u32 GetBattlerTotalSpeedStat(u32 battler); s8 GetChosenMovePriority(u32 battlerId); s8 GetMovePriority(u32 battlerId, u16 move); -u8 GetWhoStrikesFirst(u8 battlerId1, u8 battlerId2, bool8 ignoreChosenMoves); +u32 GetWhichBattlerFasterArgs(u32 battler1, u32 battler2, bool32 ignoreChosenMoves, u32 ability1, u32 ability2, + u32 holdEffectBattler1, u32 holdEffectBattler2, u32 speedBattler1, u32 speedBattler2, s32 priority1, s32 priority2); +u32 GetWhichBattlerFaster(u32 battler1, u32 battler2, bool32 ignoreChosenMoves); void RunBattleScriptCommands_PopCallbacksStack(void); void RunBattleScriptCommands(void); -bool8 TryRunFromBattle(u8 battlerId); void SpecialStatusesClear(void); -void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk); +void SetTypeBeforeUsingMove(u32 move, u32 battlerAtk); bool32 IsWildMonSmart(void); u8 CreateNPCTrainerPartyFromTrainer(struct Pokemon *party, const struct Trainer *trainer, bool32 firstTrainer, u32 battleTypeFlags); void ModifyPersonalityForNature(u32 *personality, u32 newNature); u32 GeneratePersonalityForGender(u32 gender, u32 species); -void CustomTrainerPartyAssignMoves(struct Pokemon *mon, const struct TrainerMonCustomized *partyEntry); +void CustomTrainerPartyAssignMoves(struct Pokemon *mon, const struct TrainerMon *partyEntry); extern struct MultiPartnerMenuPokemon gMultiPartnerParty[MULTI_PARTY_SIZE]; diff --git a/include/battle_message.h b/include/battle_message.h index 93bb63022b43..e01c916c3c57 100644 --- a/include/battle_message.h +++ b/include/battle_message.h @@ -1,11 +1,12 @@ #ifndef GUARD_BATTLE_MESSAGE_H #define GUARD_BATTLE_MESSAGE_H -#if B_EXPANDED_ABILITY_NAMES == TRUE - #define TEXT_BUFF_ARRAY_COUNT 17 -#else - #define TEXT_BUFF_ARRAY_COUNT 16 -#endif +// This buffer can hold many different things. Some of the things it can hold +// that have explicit sizes are listed below to ensure it can contain them. +#define TEXT_BUFF_ARRAY_COUNT max(16, \ + max(MOVE_NAME_LENGTH + 2, /* +2 to hold the "!" and EOS. */ \ + max(POKEMON_NAME_LENGTH + 1, \ + ABILITY_NAME_LENGTH + 1))) // for 0xFD #define B_TXT_BUFF1 0x0 @@ -26,7 +27,7 @@ #define B_TXT_ATK_NAME_WITH_PREFIX 0xF #define B_TXT_DEF_NAME_WITH_PREFIX 0x10 #define B_TXT_EFF_NAME_WITH_PREFIX 0x11 // EFF = short for gEffectBank -#define B_TXT_ACTIVE_NAME_WITH_PREFIX 0x12 +// #define B_TXT_ACTIVE_NAME_WITH_PREFIX 0x12 - removed #define B_TXT_SCR_ACTIVE_NAME_WITH_PREFIX 0x13 #define B_TXT_CURRENT_MOVE 0x14 #define B_TXT_LAST_MOVE 0x15 @@ -68,8 +69,8 @@ #define B_TXT_DEF_NAME 0x39 #define B_TXT_DEF_TEAM1 0x3A // Your/The opposing #define B_TXT_DEF_TEAM2 0x3B // your/the opposing -#define B_TXT_ACTIVE_NAME 0x3C -#define B_TXT_ACTIVE_NAME2 0x3D // no Illusion check +// #define B_TXT_SELECTION_NAME 0x3C - removed +// #define B_TXT_SELECTION_NAME2 0x3D no Illusion check - removed // for B_TXT_BUFF1, B_TXT_BUFF2 and B_TXT_BUFF3 @@ -239,13 +240,13 @@ enum TRAINER_SLIDE_BEFORE_FIRST_TURN, }; -void BufferStringBattle(u16 stringID); +void BufferStringBattle(u16 stringID, u32 battler); u32 BattleStringExpandPlaceholdersToDisplayedString(const u8 *src); u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst); void BattlePutTextOnWindow(const u8 *text, u8 windowId); -void SetPpNumbersPaletteInMoveSelection(void); +void SetPpNumbersPaletteInMoveSelection(u32 battler); u8 GetCurrentPpToMaxPpState(u8 currentPp, u8 maxPp); -u32 ShouldDoTrainerSlide(u32 battlerId, u32 which); // return 1 for TrainerA, 2 forTrainerB +u32 ShouldDoTrainerSlide(u32 battler, u32 which); // return 1 for TrainerA, 2 forTrainerB void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst); extern struct BattleMsgData *gBattleMsgDataPtr; diff --git a/include/battle_script_commands.h b/include/battle_script_commands.h index dcf601e8040d..ed08b5eb4ffb 100644 --- a/include/battle_script_commands.h +++ b/include/battle_script_commands.h @@ -16,8 +16,9 @@ struct StatFractions u8 divisor; }; -s32 CalcCritChanceStage(u8 battlerAtk, u8 battlerDef, u32 move, bool32 recordAbility); -s8 GetInverseCritChance(u8 battlerAtk, u8 battlerDef, u32 move); +s32 CalcCritChanceStageArgs(u32 battlerAtk, u32 battlerDef, u32 move, bool32 recordAbility, u32 abilityAtk, u32 abilityDef, u32 holdEffectAtk); +s32 CalcCritChanceStage(u32 battlerAtk, u32 battlerDef, u32 move, bool32 recordAbility); +s32 GetCritHitChance(s32 critChanceIndex); u32 GetTotalAccuracy(u32 battlerAtk, u32 battlerDef, u32 move, u32 atkAbility, u32 defAbility, u32 atkHoldEffect, u32 defHoldEffect); u8 GetBattlerTurnOrderNum(u8 battlerId); bool32 NoAliveMonsForEitherParty(void); @@ -28,8 +29,8 @@ void BattleCreateYesNoCursorAt(u8 cursorPosition); void BufferMoveToLearnIntoBattleTextBuff2(void); void HandleBattleWindow(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags); bool8 UproarWakeUpCheck(u8 battlerId); -bool32 DoesSubstituteBlockMove(u8 battlerAtk, u8 battlerDef, u32 move); -bool32 DoesDisguiseBlockMove(u8 battlerAtk, u8 battlerDef, u32 move); +bool32 DoesSubstituteBlockMove(u32 battlerAtk, u32 battlerDef, u32 move); +bool32 DoesDisguiseBlockMove(u32 battlerAtk, u32 battlerDef, u32 move); bool32 CanPoisonType(u8 battlerAttacker, u8 battlerTarget); bool32 CanParalyzeType(u8 battlerAttacker, u8 battlerTarget); bool32 CanUseLastResort(u8 battlerId); @@ -47,6 +48,7 @@ u32 GetHighestStatId(u32 battlerId); bool32 ProteanTryChangeType(u32 battler, u32 ability, u32 move, u32 moveType); bool32 DoSwitchInAbilitiesItems(u32 battlerId); u8 GetFirstFaintedPartyIndex(u8 battlerId); +bool32 IsMoveAffectedByParentalBond(u32 move, u32 battler); extern void (* const gBattleScriptingCommandsTable[])(void); extern const u8 gBattlePalaceNatureToMoveGroupLikelihood[NUM_NATURES][4]; diff --git a/include/battle_scripts.h b/include/battle_scripts.h index e08032a7fc49..335aafb589ed 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -473,7 +473,11 @@ extern const u8 BattleScript_StealthRockActivates[]; extern const u8 BattleScript_SpikesActivates[]; extern const u8 BattleScript_BerserkGeneRet[]; extern const u8 BattleScript_TargetFormChangeWithStringNoPopup[]; -extern const u8 BattleScript_ButItFailedAtkCanceler[]; +extern const u8 BattleScript_DefDown[]; +extern const u8 BattleScript_UltraBurst[]; +extern const u8 BattleScript_SelectingNotAllowedCurrentMove[]; +extern const u8 BattleScript_SelectingNotAllowedCurrentMoveInPalace[]; +extern const u8 BattleScript_SaltCureExtraDamage[]; // zmoves extern const u8 BattleScript_ZMoveActivateDamaging[]; diff --git a/include/battle_setup.h b/include/battle_setup.h index e29b3155fe01..96aeb4b761a4 100644 --- a/include/battle_setup.h +++ b/include/battle_setup.h @@ -68,4 +68,7 @@ bool8 IsTrainerReadyForRematch(void); void ShouldTryGetTrainerScript(void); u16 CountBattledRematchTeams(u16 trainerId); +void DoStandardWildBattle_Debug(void); +void BattleSetup_StartTrainerBattle_Debug(void); + #endif // GUARD_BATTLE_SETUP_H diff --git a/include/battle_util.h b/include/battle_util.h index 925a21a8af64..9cdd41cab58b 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -15,6 +15,7 @@ #define MOVE_LIMITATION_BELCH (1 << 11) #define MOVE_LIMITATION_THROAT_CHOP (1 << 12) #define MOVE_LIMITATION_STUFF_CHEEKS (1 << 13) +#define MOVE_LIMITATION_GIGATON_HAMMER (1 << 14) #define MOVE_LIMITATION_PLACEHOLDER (1 << 15) #define MOVE_LIMITATIONS_ALL 0xFFFF @@ -35,11 +36,11 @@ #define ABILITYEFFECT_FIELD_SPORT 13 // Only used if B_SPORT_TURNS < GEN_6 #define ABILITYEFFECT_ON_WEATHER 14 #define ABILITYEFFECT_ON_TERRAIN 15 +#define ABILITYEFFECT_SWITCH_IN_TERRAIN 16 +#define ABILITYEFFECT_SWITCH_IN_WEATHER 17 // Special cases #define ABILITYEFFECT_MUD_SPORT 252 // Only used if B_SPORT_TURNS < GEN_6 #define ABILITYEFFECT_WATER_SPORT 253 // Only used if B_SPORT_TURNS < GEN_6 -#define ABILITYEFFECT_SWITCH_IN_TERRAIN 254 -#define ABILITYEFFECT_SWITCH_IN_WEATHER 255 // For the first argument of ItemBattleEffects, to deteremine which block of item effects to try #define ITEMEFFECT_ON_SWITCH_IN 0 @@ -54,7 +55,8 @@ #define WEATHER_HAS_EFFECT ((!IsAbilityOnField(ABILITY_CLOUD_NINE) && !IsAbilityOnField(ABILITY_AIR_LOCK))) -#define IS_WHOLE_SIDE_ALIVE(battler)((IsBattlerAlive(battler) && IsBattlerAlive(BATTLE_PARTNER(battler)))) +#define IS_WHOLE_SIDE_ALIVE(battler) ((IsBattlerAlive(battler) && IsBattlerAlive(BATTLE_PARTNER(battler)))) +#define IS_ALIVE_AND_PRESENT(battler) (IsBattlerAlive(battler) && IsBattlerSpritePresent(battler)) // for Natural Gift and Fling struct TypePower @@ -100,6 +102,7 @@ bool32 IsAffectedByFollowMe(u32 battlerAtk, u32 defSide, u32 move); void HandleAction_UseMove(void); void HandleAction_Switch(void); void HandleAction_UseItem(void); +bool32 TryRunFromBattle(u32 battler); void HandleAction_Run(void); void HandleAction_WatchesCarefully(void); void HandleAction_SafariZoneBallThrow(void); @@ -114,110 +117,111 @@ u8 GetBattlerForBattleScript(u8 caseId); void PressurePPLose(u8 target, u8 attacker, u16 move); void PressurePPLoseOnUsingPerishSong(u8 attacker); void PressurePPLoseOnUsingImprison(u8 attacker); -bool32 IsBattlerMarkedForControllerExec(u8 battlerId); -void MarkBattlerForControllerExec(u8 battlerId); -void MarkBattlerReceivedLinkData(u8 battlerId); -void CancelMultiTurnMoves(u8 battlerId); -bool8 WasUnableToUseMove(u8 battlerId); -void PrepareStringBattle(u16 stringId, u8 battlerId); +bool32 IsBattlerMarkedForControllerExec(u32 battler); +void MarkBattlerForControllerExec(u32 battler); +void MarkBattlerReceivedLinkData(u32 battler); +void CancelMultiTurnMoves(u32 battler); +bool32 WasUnableToUseMove(u32 battler); +void PrepareStringBattle(u16 stringId, u32 battler); void ResetSentPokesToOpponentValue(void); -void OpponentSwitchInResetSentPokesToOpponentValue(u8 battlerId); -void UpdateSentPokesToOpponentValue(u8 battlerId); +void OpponentSwitchInResetSentPokesToOpponentValue(u32 battler); +void UpdateSentPokesToOpponentValue(u32 battler); void BattleScriptPush(const u8 *bsPtr); void BattleScriptPushCursor(void); void BattleScriptPop(void); -u8 TrySetCantSelectMoveBattleScript(void); -u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u16 check); -bool8 AreAllMovesUnusable(void); -u8 GetImprisonedMovesCount(u8 battlerId, u16 move); +u32 TrySetCantSelectMoveBattleScript(u32 battler); +u8 CheckMoveLimitations(u32 battler, u8 unusableMoves, u16 check); +bool32 AreAllMovesUnusable(u32 battler); +u8 GetImprisonedMovesCount(u32 battler, u16 move); u8 DoFieldEndTurnEffects(void); s32 GetDrainedBigRootHp(u32 battler, s32 hp); u8 DoBattlerEndTurnEffects(void); -bool8 HandleWishPerishSongOnTurnEnd(void); -bool8 HandleFaintedMonActions(void); +bool32 HandleWishPerishSongOnTurnEnd(void); +bool32 HandleFaintedMonActions(void); void TryClearRageAndFuryCutter(void); u8 AtkCanceller_UnableToUseMove(u32 moveType); void SetAtkCancellerForCalledMove(void); u8 AtkCanceller_UnableToUseMove2(void); -bool8 HasNoMonsToSwitch(u8 battlerId, u8 r1, u8 r2); -bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility); -u8 AbilityBattleEffects(u8 caseID, u8 battlerId, u16 ability, u8 special, u16 moveArg); -bool32 TryPrimalReversion(u8 battlerId); +bool32 HasNoMonsToSwitch(u32 battler, u8 r1, u8 r2); +bool32 TryChangeBattleWeather(u32 battler, u32 weatherEnumId, bool32 viaAbility); +u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 moveArg); +bool32 TryPrimalReversion(u32 battler); bool32 IsNeutralizingGasOnField(void); -u32 GetBattlerAbility(u8 battlerId); -u32 IsAbilityOnSide(u32 battlerId, u32 ability); -u32 IsAbilityOnOpposingSide(u32 battlerId, u32 ability); +u32 GetBattlerAbility(u32 battler); +u32 IsAbilityOnSide(u32 battler, u32 ability); +u32 IsAbilityOnOpposingSide(u32 battler, u32 ability); u32 IsAbilityOnField(u32 ability); -u32 IsAbilityOnFieldExcept(u32 battlerId, u32 ability); -u32 IsAbilityPreventingEscape(u32 battlerId); -bool32 IsBattlerProtected(u8 battlerId, u16 move); -bool32 CanBattlerEscape(u32 battlerId); // no ability check +u32 IsAbilityOnFieldExcept(u32 battler, u32 ability); +u32 IsAbilityPreventingEscape(u32 battler); +bool32 IsBattlerProtected(u32 battler, u32 move); +bool32 CanBattlerEscape(u32 battler); // no ability check void BattleScriptExecute(const u8 *BS_ptr); void BattleScriptPushCursorAndCallback(const u8 *BS_ptr); -u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn); -void ClearFuryCutterDestinyBondGrudge(u8 battlerId); +u8 ItemBattleEffects(u8 caseID, u32 battler, bool32 moveTurn); +void ClearFuryCutterDestinyBondGrudge(u32 battler); void HandleAction_RunBattleScript(void); -u32 SetRandomTarget(u32 battlerId); +u32 SetRandomTarget(u32 battler); u32 GetMoveTarget(u16 move, u8 setTarget); u8 IsMonDisobedient(void); -u32 GetBattlerHoldEffect(u8 battlerId, bool32 checkNegating); -u32 GetBattlerHoldEffectParam(u8 battlerId); -bool32 IsMoveMakingContact(u16 move, u8 battlerAtk); -bool32 IsBattlerGrounded(u8 battlerId); -bool32 IsBattlerAlive(u8 battlerId); -u8 GetBattleMonMoveSlot(struct BattlePokemon *battleMon, u16 move); -u32 GetBattlerWeight(u8 battlerId); +u32 GetBattlerHoldEffect(u32 battler, bool32 checkNegating); +u32 GetBattlerHoldEffectParam(u32 battler); +bool32 IsMoveMakingContact(u32 move, u32 battlerAtk); +bool32 IsBattlerGrounded(u32 battler); +bool32 IsBattlerAlive(u32 battler); +u32 GetMoveSlot(u16 *moves, u32 move); +u32 GetBattlerWeight(u32 battler); u32 CalcRolloutBasePower(u32 battlerAtk, u32 basePower, u32 rolloutTimer); u32 CalcFuryCutterBasePower(u32 basePower, u32 furyCutterCounter); -s32 CalculateMoveDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, s32 fixedBasePower, bool32 isCrit, bool32 randomFactor, bool32 updateFlags); -s32 CalculateMoveDamageAndEffectiveness(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, s32 fixedBasePower, u16 *typeEffectivenessModifier); -u16 CalcTypeEffectivenessMultiplier(u16 move, u8 moveType, u8 battlerAtk, u8 battlerDef, bool32 recordAbilities); -u16 CalcPartyMonTypeEffectivenessMultiplier(u16 move, u16 speciesDef, u16 abilityDef); -u16 GetTypeModifier(u8 atkType, u8 defType); -s32 GetStealthHazardDamage(u8 hazardType, u8 battlerId); +s32 CalculateMoveDamage(u32 move, u32 battlerAtk, u32 battlerDef, u32 moveType, s32 fixedBasePower, bool32 isCrit, bool32 randomFactor, bool32 updateFlags); +s32 CalculateMoveDamageVars(u32 move, u32 battlerAtk, u32 battlerDef, u32 moveType, s32 fixedBasePower, uq4_12_t typeEffectivenessModifier, + u32 weather, bool32 isCrit, u32 holdEffectAtk, u32 holdEffectDef, u32 abilityAtk, u32 abilityDef); +uq4_12_t CalcTypeEffectivenessMultiplier(u32 move, u32 moveType, u32 battlerAtk, u32 battlerDef, u32 defAbility, bool32 recordAbilities); +uq4_12_t CalcPartyMonTypeEffectivenessMultiplier(u16 move, u16 speciesDef, u16 abilityDef); +uq4_12_t GetTypeModifier(u32 atkType, u32 defType); +s32 GetStealthHazardDamage(u8 hazardType, u32 battler); s32 GetStealthHazardDamageByTypesAndHP(u8 hazardType, u8 type1, u8 type2, u32 maxHp); -bool32 CanMegaEvolve(u8 battlerId); -bool32 IsBattlerMegaEvolved(u8 battlerId); -bool32 IsBattlerPrimalReverted(u8 battlerId); -u16 GetBattleFormChangeTargetSpecies(u8 battlerId, u16 method); -bool32 TryBattleFormChange(u8 battlerId, u16 method); +bool32 CanMegaEvolve(u32 battler); +bool32 CanUltraBurst(u32 battler); +bool32 IsBattlerMegaEvolved(u32 battler); +bool32 IsBattlerPrimalReverted(u32 battler); +bool32 IsBattlerUltraBursted(u32 battler); +u16 GetBattleFormChangeTargetSpecies(u32 battler, u16 method); +bool32 TryBattleFormChange(u32 battler, u16 method); bool32 DoBattlersShareType(u32 battler1, u32 battler2); -bool32 CanBattlerGetOrLoseItem(u8 battlerId, u16 itemId); -u32 GetIllusionMonSpecies(u32 battlerId); -struct Pokemon *GetIllusionMonPtr(u32 battlerId); -void ClearIllusionMon(u32 battlerId); -bool32 SetIllusionMon(struct Pokemon *mon, u32 battlerId); -bool8 ShouldGetStatBadgeBoost(u16 flagId, u8 battlerId); +bool32 CanBattlerGetOrLoseItem(u32 battler, u16 itemId); +u32 GetIllusionMonSpecies(u32 battler); +struct Pokemon *GetIllusionMonPtr(u32 battler); +void ClearIllusionMon(u32 battler); +bool32 SetIllusionMon(struct Pokemon *mon, u32 battler); +bool32 ShouldGetStatBadgeBoost(u16 flagId, u32 battler); u8 GetBattleMoveSplit(u32 moveId); -bool32 TestMoveFlags(u16 move, u32 flag); -bool32 CanFling(u32 battlerId); +bool32 CanFling(u32 battler); bool32 IsTelekinesisBannedSpecies(u16 species); bool32 IsHealBlockPreventingMove(u32 battler, u32 move); -bool32 HasEnoughHpToEatBerry(u32 battlerId, u32 hpFraction, u32 itemId); -bool32 IsPartnerMonFromSameTrainer(u8 battlerId); -u8 GetSplitBasedOnStats(u8 battlerId); -bool32 TestSheerForceFlag(u8 battler, u16 move); +bool32 HasEnoughHpToEatBerry(u32 battler, u32 hpFraction, u32 itemId); +bool32 IsPartnerMonFromSameTrainer(u32 battler); +u8 GetSplitBasedOnStats(u32 battler); +bool32 TestSheerForceFlag(u32 battler, u16 move); void TryRestoreHeldItems(void); -bool32 CanStealItem(u8 battlerStealing, u8 battlerItem, u16 item); -void TrySaveExchangedItem(u8 battlerId, u16 stolenItem); -bool32 IsPartnerMonFromSameTrainer(u8 battlerId); -u8 TryHandleSeed(u8 battler, u32 terrainFlag, u8 statId, u16 itemId, bool32 execute); -bool32 IsBattlerAffectedByHazards(u8 battlerId, bool32 toxicSpikes); -void SortBattlersBySpeed(u8 *battlers, bool8 slowToFast); -bool32 CompareStat(u8 battlerId, u8 statId, u8 cmpTo, u8 cmpKind); -bool32 TryRoomService(u8 battlerId); -void BufferStatChange(u8 battlerId, u8 statId, u8 stringId); -bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef, bool32 checkTarget); -u16 GetUsedHeldItem(u8 battler); -bool32 IsBattlerWeatherAffected(u8 battlerId, u32 weatherFlags); -u32 ApplyWeatherDamageMultiplier(u8 battlerAtk, u16 move, u8 moveType, u32 dmg, u16 holdEffectAtk, u16 holdEffectDef); -u32 GetBattlerMoveTargetType(u8 battlerId, u16 move); -bool32 CanTargetBattler(u8 battlerAtk, u8 battlerDef, u16 move); -bool8 IsMoveAffectedByParentalBond(u16 move, u8 battlerId); +bool32 CanStealItem(u32 battlerStealing, u32 battlerItem, u16 item); +void TrySaveExchangedItem(u32 battler, u16 stolenItem); +bool32 IsPartnerMonFromSameTrainer(u32 battler); +u8 TryHandleSeed(u32 battler, u32 terrainFlag, u8 statId, u16 itemId, bool32 execute); +bool32 IsBattlerAffectedByHazards(u32 battler, bool32 toxicSpikes); +void SortBattlersBySpeed(u8 *battlers, bool32 slowToFast); +bool32 CompareStat(u32 battler, u8 statId, u8 cmpTo, u8 cmpKind); +bool32 TryRoomService(u32 battler); +void BufferStatChange(u32 battler, u8 statId, u8 stringId); +bool32 BlocksPrankster(u16 move, u32 battlerPrankster, u32 battlerDef, bool32 checkTarget); +u16 GetUsedHeldItem(u32 battler); +bool32 IsBattlerWeatherAffected(u32 battler, u32 weatherFlags); +u32 GetBattlerMoveTargetType(u32 battler, u32 move); +bool32 CanTargetBattler(u32 battlerAtk, u32 battlerDef, u16 move); void CopyMonLevelAndBaseStatsToBattleMon(u32 battler, struct Pokemon *mon); void CopyMonAbilityAndTypesToBattleMon(u32 battler, struct Pokemon *mon); void RecalcBattlerStats(u32 battler, struct Pokemon *mon); -void MulModifier(u16 *modifier, u16 val); +bool32 IsAlly(u32 battlerAtk, u32 battlerDef); +bool32 IsGen6ExpShareEnabled(void); // Ability checks bool32 IsRolePlayBannedAbilityAtk(u16 ability); @@ -228,20 +232,21 @@ bool32 IsGastroAcidBannedAbility(u16 ability); bool32 IsEntrainmentBannedAbilityAttacker(u16 ability); bool32 IsEntrainmentTargetOrSimpleBeamBannedAbility(u16 ability); -bool32 CanSleep(u8 battlerId); -bool32 CanBePoisoned(u8 battlerAttacker, u8 battlerTarget); -bool32 CanBeBurned(u8 battlerId); -bool32 CanBeParalyzed(u8 battlerId); -bool32 CanBeFrozen(u8 battlerId); -bool32 CanGetFrostbite(u8 battlerId); -bool32 CanBeConfused(u8 battlerId); -bool32 IsBattlerTerrainAffected(u8 battlerId, u32 terrainFlag); -u32 GetBattlerFriendshipScore(u8 battlerId); -u32 CountBattlerStatIncreases(u8 battlerId, bool32 countEvasionAcc); +bool32 CanSleep(u32 battler); +bool32 CanBePoisoned(u32 battlerAttacker, u32 battlerTarget); +bool32 CanBeBurned(u32 battler); +bool32 CanBeParalyzed(u32 battler); +bool32 CanBeFrozen(u32 battler); +bool32 CanGetFrostbite(u32 battler); +bool32 CanBeConfused(u32 battler); +bool32 IsBattlerTerrainAffected(u32 battler, u32 terrainFlag); +u32 GetBattlerFriendshipScore(u32 battler); +u32 CountBattlerStatIncreases(u32 battler, bool32 countEvasionAcc); bool32 IsMyceliumMightOnField(void); -bool8 ChangeTypeBasedOnTerrain(u8 battlerId); -void RemoveConfusionStatus(u8 battlerId); -u8 GetBattlerGender(u8 battlerId); -bool8 AreBattlersOfOppositeGender(u8 battler1, u8 battler2); +bool32 ChangeTypeBasedOnTerrain(u32 battler); +void RemoveConfusionStatus(u32 battler); +u8 GetBattlerGender(u32 battler); +bool32 AreBattlersOfOppositeGender(u32 battler1, u32 battler2); +u32 CalcSecondaryEffectChance(u32 battler, u8 secondaryEffectChance); #endif // GUARD_BATTLE_UTIL_H diff --git a/include/battle_z_move.h b/include/battle_z_move.h index 44ed434549b2..8dea0bd7dc7c 100644 --- a/include/battle_z_move.h +++ b/include/battle_z_move.h @@ -14,18 +14,18 @@ struct SignatureZMove }; bool8 IsZMove(u16 move); -void QueueZMove(u8 battlerId, u16 baseMove); -bool32 IsViableZMove(u8 battlerId, u16 move); -bool32 TryChangeZIndicator(u8 battlerId, u8 moveIndex); +void QueueZMove(u8 battler, u16 baseMove); +bool32 IsViableZMove(u8 battler, u16 move); +bool32 TryChangeZIndicator(u8 battler, u8 moveIndex); void CreateZMoveTriggerSprite(u8, bool8); void HideZMoveTriggerSprite(void); bool32 IsZMoveTriggerSpriteActive(void); void DestroyZMoveTriggerSprite(void); -bool32 MoveSelectionDisplayZMove(u16 zmove); +bool32 MoveSelectionDisplayZMove(u16 zmove, u32 battler); const u8 *GetZMoveName(u16 move); void SetZEffect(void); -bool32 IsZMoveUsable(u8 battlerId, u16 moveIndex); -void GetUsableZMoves(u8 battlerId, u16 *moves); +bool32 IsZMoveUsable(u8 battler, u16 moveIndex); +void GetUsableZMoves(u8 battler, u16 *moves); u16 GetZMovePower(u16 move); #endif // GUARD_BATTLE_Z_MOVE_H diff --git a/include/config.h b/include/config.h index 2ad84f29cd43..5115a9936e9a 100644 --- a/include/config.h +++ b/include/config.h @@ -71,7 +71,7 @@ #define GEN_7 4 #define GEN_8 5 #define GEN_9 6 -#define GEN_LATEST GEN_8 +#define GEN_LATEST GEN_9 // General settings #define EXPANSION_INTRO TRUE // If TRUE, a custom RHH intro will play after the vanilla copyright screen. diff --git a/include/config/battle.h b/include/config/battle.h index 10d2648a82b2..aee79daee5a9 100644 --- a/include/config/battle.h +++ b/include/config/battle.h @@ -9,12 +9,16 @@ #define B_MULTI_HIT_CHANCE GEN_LATEST // In Gen5+, multi-hit moves have different %. See Cmd_setmultihitcounter for values. #define B_WHITEOUT_MONEY GEN_LATEST // In Gen4+, the amount of money lost by losing a battle is determined by the amount of badges earned. Previously, it would cut the current money by half. (While this change was also in FRLG, for the sake of simplicity, setting this to GEN_3 will result in RSE behavior.) -// Exp and stat settings +// Experience settings #define B_EXP_CATCH GEN_LATEST // In Gen6+, Pokémon get experience from catching. #define B_TRAINER_EXP_MULTIPLIER GEN_LATEST // In Gen7+, trainer battles no longer give a 1.5 multiplier to EXP gain. #define B_SPLIT_EXP GEN_LATEST // In Gen6+, all participating mon get full experience. #define B_SCALED_EXP GEN_LATEST // In Gen5 and Gen7+, experience is weighted by level difference. +#define B_UNEVOLVED_EXP_MULTIPLIER GEN_LATEST // In Gen6+, if the Pokémon is at or past the level where it would be able to evolve, but it has not, it gets a ~1.2 multiplier to EXP gain. Only applies to Pokémon with EVO_LEVEL method. + +// Stat settings #define B_BADGE_BOOST GEN_LATEST // In Gen4+, Gym Badges no longer boost a Pokémon's stats. +#define B_FRIENDSHIP_BOOST FALSE // In LGPE only, all stats except HP are boosted up to 10% based on Friendship. Unlike B_BADGE_BOOST, these boosts are accounted when calculating base stats. #define B_MAX_LEVEL_EV_GAINS GEN_LATEST // In Gen5+, Lv100 Pokémon can obtain Effort Values normally. #define B_RECALCULATE_STATS GEN_LATEST // In Gen5+, the stats of the Pokémon who participate in battle are recalculated at the end of each battle. @@ -56,6 +60,7 @@ // Move data settings #define B_UPDATED_MOVE_DATA GEN_LATEST // Updates move data in gBattleMoves, including Power, Accuracy, PP, stat changes, targets and chances of secondary effects. #define B_UPDATED_MOVE_TYPES GEN_LATEST // Updates move types. +#define B_UPDATED_MOVE_FLAGS GEN_LATEST // Updates move flags. #define B_PHYSICAL_SPECIAL_SPLIT GEN_LATEST // In Gen3, the move's type determines if it will do physical or special damage. The split icon in the summary will reflect this. #define B_RECOIL_IF_MISS_DMG GEN_LATEST // In Gen5+, Jump Kick and High Jump Kick will always do half of the user's max HP when missing. #define B_KLUTZ_FLING_INTERACTION GEN_LATEST // In Gen5+, Pokémon with the Klutz ability can't use Fling. @@ -152,6 +157,7 @@ #define B_SMART_WILD_AI_FLAG 0 // If not 0, you can set this flag in a script to enable smart wild pokemon #define B_FLAG_NO_BAG_USE 0 // If this flag is set, the ability to use the bag in battle is disabled. #define B_FLAG_NO_CATCHING 0 // If this flag is set, the ability to catch wild Pokémon is disabled. +#define B_FLAG_AI_VS_AI_BATTLE 0 // If this flag is set, the player's mons will be controlled by the ai next battles. // Var Settings // To use the following features in scripting, replace the 0s with the var ID you're assigning it to. @@ -165,6 +171,7 @@ // Terrain settings #define B_TERRAIN_BG_CHANGE TRUE // If set to TRUE, terrain moves permanently change the default battle background until the effect fades. #define B_THUNDERSTORM_TERRAIN TRUE // If TRUE, overworld Thunderstorm generates Rain and Electric Terrain as in Gen 8. +#define B_FOG_TERRAIN TRUE // If TRUE, overworld Fog generates Misty Terrain as in Gen 8. #define B_TERRAIN_TYPE_BOOST GEN_LATEST // In Gen8, damage is boosted by 30% instead of 50%. #define B_SECRET_POWER_EFFECT GEN_LATEST // Secret Power's effects change depending on terrain and generation. See GetSecretPowerMoveEffect. #define B_SECRET_POWER_ANIMATION GEN_LATEST // Secret Power's animations change depending on terrain and generation. @@ -187,6 +194,7 @@ #define B_CRITICAL_CAPTURE TRUE // If set to TRUE, Critical Capture will be enabled. #define B_LAST_USED_BALL TRUE // If TRUE, the "last used ball" feature from Gen 7 will be implemented #define B_LAST_USED_BALL_BUTTON R_BUTTON // If last used ball is implemented, this button (or button combo) will trigger throwing the last used ball. +#define B_LAST_USED_BALL_CYCLE TRUE // If TRUE, then holding B_LAST_USED_BALL_BUTTON while pressing the D-Pad cycles through the balls // Other settings #define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter. @@ -198,6 +206,7 @@ #define B_TRAINER_CLASS_POKE_BALLS GEN_LATEST // In Gen7+, trainers will use certain types of Poké Balls depending on their trainer class. #define B_OBEDIENCE_MECHANICS GEN_7 // In PLA+ (here Gen8+), obedience restrictions also apply to non-outsider Pokémon, albeit based on their level met rather than actual level #define B_USE_FROSTBITE FALSE // In PLA, Frostbite replaces Freeze. Enabling this flag does the same here. Moves can still be cherry-picked to either Freeze or Frostbite. Freeze-Dry, Secret Power & Tri Attack depend on this config. +#define B_OVERWORLD_SNOW GEN_LATEST // In Gen9+, overworld Snow will summon snow instead of hail. // Animation Settings #define B_NEW_SWORD_PARTICLE TRUE // If set to TRUE, it updates Swords Dance's particle. diff --git a/include/config/debug.h b/include/config/debug.h index 43d74380183a..eea676b3070c 100644 --- a/include/config/debug.h +++ b/include/config/debug.h @@ -9,6 +9,7 @@ // Battle Debug Menu #define DEBUG_BATTLE_MENU TRUE // If set to TRUE, enables a debug menu to use in battles by pressing the Select button. +#define DEBUG_AI_DELAY_TIMER FALSE // If set to TRUE, displays the number of frames it takes for the AI to choose a move. Replaces the "What will PKMN do" text. Useful for devs or anyone who modifies the AI code and wants to see if it doesn't take too long to run. // Pokémon Debug #define DEBUG_POKEMON_MENU TRUE // Enables a debug menu for pokemon sprites and icons, accessed by pressing SELECT in the summary screen. diff --git a/include/config/item.h b/include/config/item.h index ad205f0034d3..0cd89b612de0 100644 --- a/include/config/item.h +++ b/include/config/item.h @@ -12,10 +12,15 @@ #define I_GRISEOUS_ORB_FORM_CHANGE GEN_LATEST // In Gen9+, the Griseous Orb no longer changes Giratina's form when held. #define I_GEM_BOOST_POWER GEN_LATEST // In Gen5+, the Gem boost power was reduced from 50% to 30%. #define I_USE_EVO_HELD_ITEMS_FROM_BAG FALSE // If TRUE, items such as Razor Claw or Electirizer will be usable from the bag to evolve a Pokémon just like in LA. +#define I_TYPE_BOOST_POWER GEN_LATEST // In Gen4+, all regular type boosting held items had their power increased from 10% to 20%. eg. Charcoal // TM config #define I_REUSABLE_TMS FALSE // In Gen5-8, TMs are reusable. Setting this to TRUE will make all vanilla TMs reusable, though they can also be cherry-picked by setting their importance to 1. +// Exp. Share config +#define I_EXP_SHARE_FLAG 0 // If this flag is set, every Pokémon in the party will gain experience, regardless if they participated in the battle or not. +#define I_EXP_SHARE_ITEM GEN_5 // In Gen6+, the Exp. Share was changed from a held item to a Key item that toggles the effect described above. + // Repel/Lure config // These two settings are both independent and complementary. #define VAR_LAST_REPEL_LURE_USED 0 // If this var has been assigned, last Repel/Lure used will be saved and the player will get prompted with the vanilla repel YES/NO option, unless I_REPEL_LURE_MENU is set to TRUE. diff --git a/include/config/overworld.h b/include/config/overworld.h index f62588b5fd75..e8056236a014 100644 --- a/include/config/overworld.h +++ b/include/config/overworld.h @@ -7,6 +7,9 @@ // Other settings #define OW_POISON_DAMAGE GEN_LATEST // In Gen4, Pokémon no longer faint from Poison in the overworld. In Gen5+, they no longer take damage at all. +// PC settings +#define OW_PC_PRESS_B GEN_LATEST // In Gen4, pressing B when holding a Pokémon is equivalent to placing it. In Gen3, it gives the "You're holding a Pokémon!" error. + // Overworld flags // To use the following features in scripting, replace the 0s with the flag ID you're assigning it to. // Eg: Replace with FLAG_UNUSED_0x264 so you can use that flag to toggle the feature. diff --git a/include/constants/battle.h b/include/constants/battle.h index 80810498c10f..0f0d39db8d5b 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -187,6 +187,7 @@ #define STATUS4_MUD_SPORT (1 << 2) // Only used if B_SPORT_TURNS < GEN_6 #define STATUS4_WATER_SPORT (1 << 3) // Only used if B_SPORT_TURNS < GEN_6 #define STATUS4_INFINITE_CONFUSION (1 << 4) // Used for Berserk Gene +#define STATUS4_SALT_CURE (1 << 5) #define HITMARKER_WAKE_UP_CLEAR (1 << 4) // Cleared when waking up. Never set or checked. #define HITMARKER_SKIP_DMG_TRACK (1 << 5) @@ -384,8 +385,9 @@ #define MOVE_EFFECT_DIRE_CLAW 75 #define MOVE_EFFECT_STEALTH_ROCK 76 #define MOVE_EFFECT_SPIKES 77 +#define MOVE_EFFECT_TRIPLE_ARROWS 78 -#define NUM_MOVE_EFFECTS 78 +#define NUM_MOVE_EFFECTS 79 #define MOVE_EFFECT_AFFECTS_USER 0x4000 #define MOVE_EFFECT_CERTAIN 0x8000 @@ -422,16 +424,6 @@ #define B_WAIT_TIME_SHORT (B_WAIT_TIME_MULTIPLIER * 2) #define B_WAIT_TIME_SHORTEST (B_WAIT_TIME_MULTIPLIER) -#define CHERRIM_OVERCAST 0 -#define CHERRIM_SUNSHINE 1 - -#define CASTFORM_NORMAL 0 -#define CASTFORM_FIRE 1 -#define CASTFORM_WATER 2 -#define CASTFORM_ICE 3 -#define NUM_CASTFORM_FORMS 4 -#define CASTFORM_SUBSTITUTE (1 << 7) - #define FLEE_ITEM 1 #define FLEE_ABILITY 2 @@ -504,4 +496,9 @@ #define PARENTAL_BOND_2ND_HIT 1 #define PARENTAL_BOND_OFF 0 +// Constants for if HandleScriptMegaPrimalBurst should handle Mega Evolution, Primal Reversion, or Ultra Burst. +#define HANDLE_TYPE_MEGA_EVOLUTION 0 +#define HANDLE_TYPE_PRIMAL_REVERSION 1 +#define HANDLE_TYPE_ULTRA_BURST 2 + #endif // GUARD_CONSTANTS_BATTLE_H diff --git a/include/constants/battle_ai.h b/include/constants/battle_ai.h index 81dbdad16393..32b7f7d10c3c 100644 --- a/include/constants/battle_ai.h +++ b/include/constants/battle_ai.h @@ -60,6 +60,8 @@ #define AI_FLAG_ACE_POKEMON (1 << 16) // AI has an Ace Pokemon. The last Pokemon in the party will not be used until it's the last one remaining. #define AI_FLAG_OMNISCIENT (1 << 17) // AI has full knowledge of player moves, abilities, hold items +#define AI_FLAG_COUNT 18 + // 'other' ai logic flags #define AI_FLAG_ROAMING (1 << 29) #define AI_FLAG_SAFARI (1 << 30) diff --git a/include/constants/battle_anim.h b/include/constants/battle_anim.h index dd91b42c8ec9..9876652b6563 100644 --- a/include/constants/battle_anim.h +++ b/include/constants/battle_anim.h @@ -1,6 +1,8 @@ #ifndef GUARD_CONSTANTS_BATTLE_ANIM_H #define GUARD_CONSTANTS_BATTLE_ANIM_H +#include "battle_anim_scripts.h" + // Sprites start at 10000 and thus must be subtracted of 10000 to account for the true index. #define GET_TRUE_SPRITE_INDEX(i) ((i - ANIM_SPRITES_START)) @@ -395,6 +397,7 @@ #define ANIM_TAG_STEEL_BEAM (ANIM_SPRITES_START + 383) #define ANIM_TAG_POLTERGEIST (ANIM_SPRITES_START + 384) #define ANIM_TAG_TEAPOT (ANIM_SPRITES_START + 385) +#define ANIM_TAG_WOOD_HAMMER_HAMMER (ANIM_SPRITES_START + 386) // battlers @@ -505,46 +508,48 @@ #define BG_AURA_SPHERE 77 #define BG_STEEL_BEAM_OPPONENT 78 #define BG_STEEL_BEAM_PLAYER 79 +#define BG_CHLOROBLAST 80 // table ids for general animations (gBattleAnims_General) -#define B_ANIM_CASTFORM_CHANGE 0 -#define B_ANIM_STATS_CHANGE 1 -#define B_ANIM_SUBSTITUTE_FADE 2 -#define B_ANIM_SUBSTITUTE_APPEAR 3 -#define B_ANIM_POKEBLOCK_THROW 4 -#define B_ANIM_ITEM_KNOCKOFF 5 -#define B_ANIM_TURN_TRAP 6 -#define B_ANIM_HELD_ITEM_EFFECT 7 -#define B_ANIM_SMOKEBALL_ESCAPE 8 -#define B_ANIM_HANGED_ON 9 -#define B_ANIM_RAIN_CONTINUES 10 -#define B_ANIM_SUN_CONTINUES 11 -#define B_ANIM_SANDSTORM_CONTINUES 12 -#define B_ANIM_HAIL_CONTINUES 13 -#define B_ANIM_LEECH_SEED_DRAIN 14 -#define B_ANIM_MON_HIT 15 -#define B_ANIM_ITEM_STEAL 16 -#define B_ANIM_SNATCH_MOVE 17 -#define B_ANIM_FUTURE_SIGHT_HIT 18 -#define B_ANIM_DOOM_DESIRE_HIT 19 -#define B_ANIM_FOCUS_PUNCH_SETUP 20 -#define B_ANIM_INGRAIN_HEAL 21 -#define B_ANIM_WISH_HEAL 22 -#define B_ANIM_MEGA_EVOLUTION 23 -#define B_ANIM_ILLUSION_OFF 24 -#define B_ANIM_FORM_CHANGE 25 -#define B_ANIM_SLIDE_OFFSCREEN 26 // for Emergency Exit -#define B_ANIM_RESTORE_BG 27 // for Terrain Endings -#define B_ANIM_TOTEM_FLARE 28 // Totem boosts aura flare -#define B_ANIM_GULP_MISSILE 29 -#define B_ANIM_STRONG_WINDS 30 -#define B_ANIM_PRIMAL_REVERSION 31 -#define B_ANIM_AQUA_RING_HEAL 32 -#define B_ANIM_BEAK_BLAST_SETUP 33 -#define B_ANIM_SHELL_TRAP_SETUP 34 -#define B_ANIM_ZMOVE_ACTIVATE 35 // Using Z Moves -#define B_ANIM_AFFECTION_HANGED_ON 36 -#define B_ANIM_SNOW_CONTINUES 37 +#define B_ANIM_STATS_CHANGE 0 +#define B_ANIM_SUBSTITUTE_FADE 1 +#define B_ANIM_SUBSTITUTE_APPEAR 2 +#define B_ANIM_POKEBLOCK_THROW 3 +#define B_ANIM_ITEM_KNOCKOFF 4 +#define B_ANIM_TURN_TRAP 5 +#define B_ANIM_HELD_ITEM_EFFECT 6 +#define B_ANIM_SMOKEBALL_ESCAPE 7 +#define B_ANIM_HANGED_ON 8 +#define B_ANIM_RAIN_CONTINUES 9 +#define B_ANIM_SUN_CONTINUES 10 +#define B_ANIM_SANDSTORM_CONTINUES 11 +#define B_ANIM_HAIL_CONTINUES 12 +#define B_ANIM_LEECH_SEED_DRAIN 13 +#define B_ANIM_MON_HIT 14 +#define B_ANIM_ITEM_STEAL 15 +#define B_ANIM_SNATCH_MOVE 16 +#define B_ANIM_FUTURE_SIGHT_HIT 17 +#define B_ANIM_DOOM_DESIRE_HIT 18 +#define B_ANIM_FOCUS_PUNCH_SETUP 19 +#define B_ANIM_INGRAIN_HEAL 20 +#define B_ANIM_WISH_HEAL 21 +#define B_ANIM_MEGA_EVOLUTION 22 +#define B_ANIM_ILLUSION_OFF 23 +#define B_ANIM_FORM_CHANGE 24 +#define B_ANIM_SLIDE_OFFSCREEN 25 // for Emergency Exit +#define B_ANIM_RESTORE_BG 26 // for Terrain Endings +#define B_ANIM_TOTEM_FLARE 27 // Totem boosts aura flare +#define B_ANIM_GULP_MISSILE 28 +#define B_ANIM_STRONG_WINDS 29 +#define B_ANIM_PRIMAL_REVERSION 30 +#define B_ANIM_AQUA_RING_HEAL 31 +#define B_ANIM_BEAK_BLAST_SETUP 32 +#define B_ANIM_SHELL_TRAP_SETUP 33 +#define B_ANIM_ZMOVE_ACTIVATE 34 // Using Z Moves +#define B_ANIM_AFFECTION_HANGED_ON 35 +#define B_ANIM_SNOW_CONTINUES 36 +#define B_ANIM_ULTRA_BURST 37 +#define B_ANIM_SALT_CURE_DAMAGE 38 // special animations table (gBattleAnims_Special) #define B_ANIM_LVL_UP 0 diff --git a/include/constants/battle_anim_scripts.h b/include/constants/battle_anim_scripts.h new file mode 100644 index 000000000000..49184bb45d01 --- /dev/null +++ b/include/constants/battle_anim_scripts.h @@ -0,0 +1,28 @@ +#ifndef GUARD_CONSTANTS_BATTLE_ANIM_SCRIPTS_H +#define GUARD_CONSTANTS_BATTLE_ANIM_SCRIPTS_H + +// shell smash +#define SHELL_SMASH_STARTING_X 40 +#define SHELL_SMASH_MOVEMENT_DISTANCE 34 +#define SHELL_SMASH_SHELL_MOVE_IN_DURATION 16 +#define SHELL_SMASH_PAUSE_DURATION 48 + +// thunder cage +#define THUNDER_CAGE_BALL_TIME 0x64 + +// power shift +#define POWER_SHIFT_LEFT_X -20 +#define POWER_SHIFT_RIGHT_X 20 +#define POWER_SHIFT_DELAY 0x30 +#define POWER_SHIFT_ARC -50 + +// mysitcal power +#define MYSTICAL_POWER_RING_PAUSE 7 + +// esper wing +#define ESPER_WING_SPEED 16 + +// triple arrows +#define TRIPLE_ARROW_FLY_TIME 9 + +#endif // GUARD_CONSTANTS_BATTLE_ANIM_SCRIPTS_H diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 6b18efb1753e..90d14d58fb7e 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -124,7 +124,6 @@ #define EFFECT_PRESENT 120 #define EFFECT_FRUSTRATION 121 #define EFFECT_SAFEGUARD 122 - #define EFFECT_MAGNITUDE 123 #define EFFECT_BATON_PASS 124 #define EFFECT_PURSUIT 125 @@ -145,267 +144,277 @@ #define EFFECT_PSYCH_UP 140 #define EFFECT_MIRROR_COAT 141 #define EFFECT_SKULL_BASH 142 -#define EFFECT_TWISTER 143 -#define EFFECT_EARTHQUAKE 144 -#define EFFECT_FUTURE_SIGHT 145 -#define EFFECT_GUST 146 -#define EFFECT_FLINCH_MINIMIZE_HIT 147 -#define EFFECT_SOLAR_BEAM 148 -#define EFFECT_THUNDER 149 -#define EFFECT_TELEPORT 150 -#define EFFECT_BEAT_UP 151 -#define EFFECT_SEMI_INVULNERABLE 152 -#define EFFECT_DEFENSE_CURL 153 -#define EFFECT_SOFTBOILED 154 -#define EFFECT_FAKE_OUT 155 -#define EFFECT_UPROAR 156 -#define EFFECT_STOCKPILE 157 -#define EFFECT_SPIT_UP 158 -#define EFFECT_SWALLOW 159 -#define EFFECT_WORRY_SEED 160 -#define EFFECT_HAIL 161 -#define EFFECT_TORMENT 162 -#define EFFECT_FLATTER 163 -#define EFFECT_WILL_O_WISP 164 -#define EFFECT_MEMENTO 165 -#define EFFECT_FACADE 166 -#define EFFECT_FOCUS_PUNCH 167 -#define EFFECT_SMELLINGSALT 168 -#define EFFECT_FOLLOW_ME 169 -#define EFFECT_NATURE_POWER 170 -#define EFFECT_CHARGE 171 -#define EFFECT_TAUNT 172 -#define EFFECT_HELPING_HAND 173 -#define EFFECT_TRICK 174 -#define EFFECT_ROLE_PLAY 175 -#define EFFECT_WISH 176 -#define EFFECT_ASSIST 177 -#define EFFECT_INGRAIN 178 -#define EFFECT_SUPERPOWER 179 -#define EFFECT_MAGIC_COAT 180 -#define EFFECT_RECYCLE 181 -#define EFFECT_REVENGE 182 -#define EFFECT_BRICK_BREAK 183 -#define EFFECT_YAWN 184 -#define EFFECT_KNOCK_OFF 185 -#define EFFECT_ENDEAVOR 186 -#define EFFECT_ERUPTION 187 -#define EFFECT_SKILL_SWAP 188 -#define EFFECT_IMPRISON 189 -#define EFFECT_REFRESH 190 -#define EFFECT_GRUDGE 191 -#define EFFECT_SNATCH 192 -#define EFFECT_LOW_KICK 193 -#define EFFECT_SECRET_POWER 194 -#define EFFECT_RECOIL_33 195 -#define EFFECT_TEETER_DANCE 196 -#define EFFECT_HIT_ESCAPE 197 -#define EFFECT_MUD_SPORT 198 -#define EFFECT_POISON_FANG 199 -#define EFFECT_WEATHER_BALL 200 -#define EFFECT_OVERHEAT 201 -#define EFFECT_TICKLE 202 -#define EFFECT_COSMIC_POWER 203 -#define EFFECT_SKY_UPPERCUT 204 -#define EFFECT_BULK_UP 205 -#define EFFECT_PLACEHOLDER 206 -#define EFFECT_WATER_SPORT 207 -#define EFFECT_CALM_MIND 208 -#define EFFECT_DRAGON_DANCE 209 -#define EFFECT_CAMOUFLAGE 210 +#define EFFECT_EARTHQUAKE 143 +#define EFFECT_FUTURE_SIGHT 144 +#define EFFECT_GUST 145 +#define EFFECT_SOLAR_BEAM 146 +#define EFFECT_THUNDER 147 +#define EFFECT_TELEPORT 148 +#define EFFECT_BEAT_UP 149 +#define EFFECT_SEMI_INVULNERABLE 150 +#define EFFECT_DEFENSE_CURL 151 +#define EFFECT_SOFTBOILED 152 +#define EFFECT_FAKE_OUT 153 +#define EFFECT_UPROAR 154 +#define EFFECT_STOCKPILE 155 +#define EFFECT_SPIT_UP 156 +#define EFFECT_SWALLOW 157 +#define EFFECT_WORRY_SEED 158 +#define EFFECT_HAIL 159 +#define EFFECT_TORMENT 160 +#define EFFECT_FLATTER 161 +#define EFFECT_WILL_O_WISP 162 +#define EFFECT_MEMENTO 163 +#define EFFECT_FACADE 164 +#define EFFECT_FOCUS_PUNCH 165 +#define EFFECT_SMELLINGSALT 166 +#define EFFECT_FOLLOW_ME 167 +#define EFFECT_NATURE_POWER 168 +#define EFFECT_CHARGE 169 +#define EFFECT_TAUNT 170 +#define EFFECT_HELPING_HAND 171 +#define EFFECT_TRICK 172 +#define EFFECT_ROLE_PLAY 173 +#define EFFECT_WISH 174 +#define EFFECT_ASSIST 175 +#define EFFECT_INGRAIN 176 +#define EFFECT_SUPERPOWER 177 +#define EFFECT_MAGIC_COAT 178 +#define EFFECT_RECYCLE 179 +#define EFFECT_REVENGE 180 +#define EFFECT_BRICK_BREAK 181 +#define EFFECT_YAWN 182 +#define EFFECT_KNOCK_OFF 183 +#define EFFECT_ENDEAVOR 184 +#define EFFECT_ERUPTION 185 +#define EFFECT_SKILL_SWAP 186 +#define EFFECT_IMPRISON 187 +#define EFFECT_REFRESH 188 +#define EFFECT_GRUDGE 189 +#define EFFECT_SNATCH 190 +#define EFFECT_LOW_KICK 191 +#define EFFECT_SECRET_POWER 192 +#define EFFECT_RECOIL_33 193 +#define EFFECT_TEETER_DANCE 194 +#define EFFECT_HIT_ESCAPE 195 +#define EFFECT_MUD_SPORT 196 +#define EFFECT_POISON_FANG 197 +#define EFFECT_WEATHER_BALL 198 +#define EFFECT_OVERHEAT 199 +#define EFFECT_TICKLE 200 +#define EFFECT_COSMIC_POWER 201 +#define EFFECT_SKY_UPPERCUT 202 +#define EFFECT_BULK_UP 203 +#define EFFECT_PLACEHOLDER 204 +#define EFFECT_WATER_SPORT 205 +#define EFFECT_CALM_MIND 206 +#define EFFECT_DRAGON_DANCE 207 +#define EFFECT_CAMOUFLAGE 208 // New move effects -#define EFFECT_PLEDGE 211 -#define EFFECT_FLING 212 -#define EFFECT_NATURAL_GIFT 213 -#define EFFECT_WAKE_UP_SLAP 214 -#define EFFECT_WRING_OUT 215 -#define EFFECT_HEX 216 -#define EFFECT_ASSURANCE 217 -#define EFFECT_TRUMP_CARD 218 -#define EFFECT_ACROBATICS 219 -#define EFFECT_HEAT_CRASH 220 -#define EFFECT_PUNISHMENT 221 -#define EFFECT_STORED_POWER 222 -#define EFFECT_ELECTRO_BALL 223 -#define EFFECT_GYRO_BALL 224 -#define EFFECT_ECHOED_VOICE 225 -#define EFFECT_PAYBACK 226 -#define EFFECT_ROUND 227 -#define EFFECT_BRINE 228 -#define EFFECT_VENOSHOCK 229 -#define EFFECT_RETALIATE 230 -#define EFFECT_BULLDOZE 231 -#define EFFECT_FOUL_PLAY 232 -#define EFFECT_PSYSHOCK 233 -#define EFFECT_ROOST 234 -#define EFFECT_GRAVITY 235 -#define EFFECT_MIRACLE_EYE 236 -#define EFFECT_TAILWIND 237 -#define EFFECT_EMBARGO 238 -#define EFFECT_AQUA_RING 239 -#define EFFECT_TRICK_ROOM 240 -#define EFFECT_WONDER_ROOM 241 -#define EFFECT_MAGIC_ROOM 242 -#define EFFECT_MAGNET_RISE 243 -#define EFFECT_TOXIC_SPIKES 244 -#define EFFECT_GASTRO_ACID 245 -#define EFFECT_STEALTH_ROCK 246 -#define EFFECT_TELEKINESIS 247 -#define EFFECT_POWER_SWAP 248 -#define EFFECT_GUARD_SWAP 249 -#define EFFECT_HEART_SWAP 250 -#define EFFECT_POWER_SPLIT 251 -#define EFFECT_GUARD_SPLIT 252 -#define EFFECT_STICKY_WEB 253 -#define EFFECT_METAL_BURST 254 -#define EFFECT_LUCKY_CHANT 255 -#define EFFECT_SUCKER_PUNCH 256 -#define EFFECT_SPECIAL_DEFENSE_DOWN_HIT_2 257 -#define EFFECT_SIMPLE_BEAM 258 -#define EFFECT_ENTRAINMENT 259 -#define EFFECT_HEAL_PULSE 260 -#define EFFECT_QUASH 261 -#define EFFECT_ION_DELUGE 262 -#define EFFECT_FREEZE_DRY 263 -#define EFFECT_TOPSY_TURVY 264 -#define EFFECT_MISTY_TERRAIN 265 -#define EFFECT_GRASSY_TERRAIN 266 -#define EFFECT_ELECTRIC_TERRAIN 267 -#define EFFECT_PSYCHIC_TERRAIN 268 -#define EFFECT_ATTACK_ACCURACY_UP 269 -#define EFFECT_ATTACK_SPATK_UP 270 -#define EFFECT_HURRICANE 271 -#define EFFECT_TWO_TYPED_MOVE 272 -#define EFFECT_ME_FIRST 273 -#define EFFECT_SPEED_UP_HIT 274 -#define EFFECT_QUIVER_DANCE 275 -#define EFFECT_COIL 276 -#define EFFECT_ELECTRIFY 277 -#define EFFECT_REFLECT_TYPE 278 -#define EFFECT_SOAK 279 -#define EFFECT_GROWTH 280 -#define EFFECT_CLOSE_COMBAT 281 -#define EFFECT_LAST_RESORT 282 -#define EFFECT_RECOIL_33_STATUS 283 -#define EFFECT_FLINCH_STATUS 284 -#define EFFECT_RECOIL_50 285 -#define EFFECT_SHELL_SMASH 286 -#define EFFECT_SHIFT_GEAR 287 -#define EFFECT_DEFENSE_UP_3 288 -#define EFFECT_NOBLE_ROAR 289 -#define EFFECT_VENOM_DRENCH 290 -#define EFFECT_TOXIC_THREAD 291 -#define EFFECT_CLEAR_SMOG 292 -#define EFFECT_HIT_SWITCH_TARGET 293 -#define EFFECT_FINAL_GAMBIT 294 -#define EFFECT_CHANGE_TYPE_ON_ITEM 295 -#define EFFECT_AUTOTOMIZE 296 -#define EFFECT_COPYCAT 297 -#define EFFECT_DEFOG 298 -#define EFFECT_HIT_ENEMY_HEAL_ALLY 299 -#define EFFECT_SMACK_DOWN 300 -#define EFFECT_SYNCHRONOISE 301 -#define EFFECT_PSYCHO_SHIFT 302 -#define EFFECT_POWER_TRICK 303 -#define EFFECT_FLAME_BURST 304 -#define EFFECT_AFTER_YOU 305 -#define EFFECT_BESTOW 306 -#define EFFECT_ROTOTILLER 307 -#define EFFECT_FLOWER_SHIELD 308 -#define EFFECT_HIT_PREVENT_ESCAPE 309 -#define EFFECT_SPEED_SWAP 310 -#define EFFECT_DEFENSE_UP2_HIT 311 -#define EFFECT_REVELATION_DANCE 312 -#define EFFECT_AURORA_VEIL 313 -#define EFFECT_THIRD_TYPE 314 -#define EFFECT_FEINT 315 -#define EFFECT_SPARKLING_ARIA 316 -#define EFFECT_ACUPRESSURE 317 -#define EFFECT_AROMATIC_MIST 318 -#define EFFECT_POWDER 319 -#define EFFECT_SP_ATTACK_UP_HIT 320 -#define EFFECT_BELCH 321 -#define EFFECT_PARTING_SHOT 322 -#define EFFECT_SPECTRAL_THIEF 323 -#define EFFECT_V_CREATE 324 -#define EFFECT_MAT_BLOCK 325 -#define EFFECT_STOMPING_TANTRUM 326 -#define EFFECT_CORE_ENFORCER 327 -#define EFFECT_INSTRUCT 328 -#define EFFECT_THROAT_CHOP 329 -#define EFFECT_LASER_FOCUS 330 -#define EFFECT_MAGNETIC_FLUX 331 -#define EFFECT_GEAR_UP 332 -#define EFFECT_INCINERATE 333 -#define EFFECT_BUG_BITE 334 -#define EFFECT_STRENGTH_SAP 335 -#define EFFECT_MIND_BLOWN 336 -#define EFFECT_PURIFY 337 -#define EFFECT_BURN_UP 338 -#define EFFECT_SHORE_UP 339 -#define EFFECT_GEOMANCY 340 -#define EFFECT_FAIRY_LOCK 341 -#define EFFECT_ALLY_SWITCH 342 -#define EFFECT_RELIC_SONG 343 -#define EFFECT_ATTACKER_DEFENSE_DOWN_HIT 344 -#define EFFECT_BODY_PRESS 345 -#define EFFECT_EERIE_SPELL 346 -#define EFFECT_JUNGLE_HEALING 347 -#define EFFECT_COACHING 348 -#define EFFECT_LASH_OUT 349 -#define EFFECT_GRASSY_GLIDE 350 -#define EFFECT_DYNAMAX_DOUBLE_DMG 351 -#define EFFECT_DECORATE 352 -#define EFFECT_SNIPE_SHOT 353 -#define EFFECT_RECOIL_HP_25 354 -#define EFFECT_STUFF_CHEEKS 355 -#define EFFECT_GRAV_APPLE 356 -#define EFFECT_EVASION_UP_HIT 357 -#define EFFECT_GLITZY_GLOW 358 -#define EFFECT_BADDY_BAD 359 -#define EFFECT_SAPPY_SEED 360 -#define EFFECT_FREEZY_FROST 361 -#define EFFECT_SPARKLY_SWIRL 362 -#define EFFECT_PLASMA_FISTS 363 -#define EFFECT_HYPERSPACE_FURY 364 -#define EFFECT_AURA_WHEEL 365 -#define EFFECT_PHOTON_GEYSER 366 -#define EFFECT_SHELL_SIDE_ARM 367 -#define EFFECT_TERRAIN_PULSE 368 -#define EFFECT_JAW_LOCK 369 -#define EFFECT_NO_RETREAT 370 -#define EFFECT_TAR_SHOT 371 -#define EFFECT_POLTERGEIST 372 -#define EFFECT_OCTOLOCK 373 -#define EFFECT_CLANGOROUS_SOUL 374 -#define EFFECT_BOLT_BEAK 375 -#define EFFECT_SKY_DROP 376 -#define EFFECT_EXPANDING_FORCE 377 -#define EFFECT_METEOR_BEAM 378 -#define EFFECT_RISING_VOLTAGE 379 -#define EFFECT_BEAK_BLAST 380 -#define EFFECT_COURT_CHANGE 381 -#define EFFECT_STEEL_BEAM 382 -#define EFFECT_EXTREME_EVOBOOST 383 -#define EFFECT_HIT_SET_REMOVE_TERRAIN 384 // genesis supernova -#define EFFECT_DARK_VOID 385 -#define EFFECT_SLEEP_HIT 386 -#define EFFECT_DOUBLE_SHOCK 387 -#define EFFECT_SPECIAL_ATTACK_UP_HIT 388 -#define EFFECT_VICTORY_DANCE 389 -#define EFFECT_TEATIME 390 -#define EFFECT_ATTACK_UP_USER_ALLY 391 // Howl 8th Gen -#define EFFECT_SHELL_TRAP 392 -#define EFFECT_PSYBLADE 393 -#define EFFECT_HYDRO_STEAM 394 -#define EFFECT_HIT_SET_ENTRY_HAZARD 395 -#define EFFECT_DIRE_CLAW 396 -#define EFFECT_BARB_BARRAGE 397 -#define EFFECT_REVIVAL_BLESSING 398 -#define EFFECT_FROSTBITE_HIT 399 -#define EFFECT_SNOWSCAPE 400 +#define EFFECT_PLEDGE 209 +#define EFFECT_FLING 210 +#define EFFECT_NATURAL_GIFT 211 +#define EFFECT_WAKE_UP_SLAP 212 +#define EFFECT_WRING_OUT 213 +#define EFFECT_HEX 214 +#define EFFECT_ASSURANCE 215 +#define EFFECT_TRUMP_CARD 216 +#define EFFECT_ACROBATICS 217 +#define EFFECT_HEAT_CRASH 218 +#define EFFECT_PUNISHMENT 219 +#define EFFECT_STORED_POWER 220 +#define EFFECT_ELECTRO_BALL 221 +#define EFFECT_GYRO_BALL 222 +#define EFFECT_ECHOED_VOICE 223 +#define EFFECT_PAYBACK 224 +#define EFFECT_ROUND 225 +#define EFFECT_BRINE 226 +#define EFFECT_VENOSHOCK 227 +#define EFFECT_RETALIATE 228 +#define EFFECT_BULLDOZE 229 +#define EFFECT_FOUL_PLAY 230 +#define EFFECT_PSYSHOCK 231 +#define EFFECT_ROOST 232 +#define EFFECT_GRAVITY 233 +#define EFFECT_MIRACLE_EYE 234 +#define EFFECT_TAILWIND 235 +#define EFFECT_EMBARGO 236 +#define EFFECT_AQUA_RING 237 +#define EFFECT_TRICK_ROOM 238 +#define EFFECT_WONDER_ROOM 239 +#define EFFECT_MAGIC_ROOM 240 +#define EFFECT_MAGNET_RISE 241 +#define EFFECT_TOXIC_SPIKES 242 +#define EFFECT_GASTRO_ACID 243 +#define EFFECT_STEALTH_ROCK 244 +#define EFFECT_TELEKINESIS 245 +#define EFFECT_POWER_SWAP 246 +#define EFFECT_GUARD_SWAP 247 +#define EFFECT_HEART_SWAP 248 +#define EFFECT_POWER_SPLIT 249 +#define EFFECT_GUARD_SPLIT 250 +#define EFFECT_STICKY_WEB 251 +#define EFFECT_METAL_BURST 252 +#define EFFECT_LUCKY_CHANT 253 +#define EFFECT_SUCKER_PUNCH 254 +#define EFFECT_SPECIAL_DEFENSE_DOWN_HIT_2 255 +#define EFFECT_SIMPLE_BEAM 256 +#define EFFECT_ENTRAINMENT 257 +#define EFFECT_HEAL_PULSE 258 +#define EFFECT_QUASH 259 +#define EFFECT_ION_DELUGE 260 +#define EFFECT_FREEZE_DRY 261 +#define EFFECT_TOPSY_TURVY 262 +#define EFFECT_MISTY_TERRAIN 263 +#define EFFECT_GRASSY_TERRAIN 264 +#define EFFECT_ELECTRIC_TERRAIN 265 +#define EFFECT_PSYCHIC_TERRAIN 266 +#define EFFECT_ATTACK_ACCURACY_UP 267 +#define EFFECT_ATTACK_SPATK_UP 268 +#define EFFECT_HURRICANE 269 +#define EFFECT_TWO_TYPED_MOVE 270 +#define EFFECT_ME_FIRST 271 +#define EFFECT_SPEED_UP_HIT 272 +#define EFFECT_QUIVER_DANCE 273 +#define EFFECT_COIL 274 +#define EFFECT_ELECTRIFY 275 +#define EFFECT_REFLECT_TYPE 276 +#define EFFECT_SOAK 277 +#define EFFECT_GROWTH 278 +#define EFFECT_CLOSE_COMBAT 279 +#define EFFECT_LAST_RESORT 280 +#define EFFECT_RECOIL_33_STATUS 281 +#define EFFECT_FLINCH_STATUS 282 +#define EFFECT_RECOIL_50 283 +#define EFFECT_SHELL_SMASH 284 +#define EFFECT_SHIFT_GEAR 285 +#define EFFECT_DEFENSE_UP_3 286 +#define EFFECT_NOBLE_ROAR 287 +#define EFFECT_VENOM_DRENCH 288 +#define EFFECT_TOXIC_THREAD 289 +#define EFFECT_CLEAR_SMOG 290 +#define EFFECT_HIT_SWITCH_TARGET 291 +#define EFFECT_FINAL_GAMBIT 292 +#define EFFECT_CHANGE_TYPE_ON_ITEM 293 +#define EFFECT_AUTOTOMIZE 294 +#define EFFECT_COPYCAT 295 +#define EFFECT_DEFOG 296 +#define EFFECT_HIT_ENEMY_HEAL_ALLY 297 +#define EFFECT_SMACK_DOWN 298 +#define EFFECT_SYNCHRONOISE 299 +#define EFFECT_PSYCHO_SHIFT 300 +#define EFFECT_POWER_TRICK 301 +#define EFFECT_FLAME_BURST 302 +#define EFFECT_AFTER_YOU 303 +#define EFFECT_BESTOW 304 +#define EFFECT_ROTOTILLER 305 +#define EFFECT_FLOWER_SHIELD 306 +#define EFFECT_HIT_PREVENT_ESCAPE 307 +#define EFFECT_SPEED_SWAP 308 +#define EFFECT_DEFENSE_UP2_HIT 309 +#define EFFECT_REVELATION_DANCE 310 +#define EFFECT_AURORA_VEIL 311 +#define EFFECT_THIRD_TYPE 312 +#define EFFECT_FEINT 313 +#define EFFECT_SPARKLING_ARIA 314 +#define EFFECT_ACUPRESSURE 315 +#define EFFECT_AROMATIC_MIST 316 +#define EFFECT_POWDER 317 +#define EFFECT_SP_ATTACK_UP_HIT 318 +#define EFFECT_BELCH 319 +#define EFFECT_PARTING_SHOT 320 +#define EFFECT_SPECTRAL_THIEF 321 +#define EFFECT_V_CREATE 322 +#define EFFECT_MAT_BLOCK 323 +#define EFFECT_STOMPING_TANTRUM 324 +#define EFFECT_CORE_ENFORCER 325 +#define EFFECT_INSTRUCT 326 +#define EFFECT_THROAT_CHOP 327 +#define EFFECT_LASER_FOCUS 328 +#define EFFECT_MAGNETIC_FLUX 329 +#define EFFECT_GEAR_UP 330 +#define EFFECT_INCINERATE 331 +#define EFFECT_BUG_BITE 332 +#define EFFECT_STRENGTH_SAP 333 +#define EFFECT_MIND_BLOWN 334 +#define EFFECT_PURIFY 335 +#define EFFECT_BURN_UP 336 +#define EFFECT_SHORE_UP 337 +#define EFFECT_GEOMANCY 338 +#define EFFECT_FAIRY_LOCK 339 +#define EFFECT_ALLY_SWITCH 340 +#define EFFECT_RELIC_SONG 341 +#define EFFECT_ATTACKER_DEFENSE_DOWN_HIT 342 +#define EFFECT_BODY_PRESS 343 +#define EFFECT_EERIE_SPELL 344 +#define EFFECT_JUNGLE_HEALING 345 +#define EFFECT_COACHING 346 +#define EFFECT_LASH_OUT 347 +#define EFFECT_GRASSY_GLIDE 348 +#define EFFECT_DYNAMAX_DOUBLE_DMG 349 +#define EFFECT_DECORATE 350 +#define EFFECT_SNIPE_SHOT 351 +#define EFFECT_RECOIL_HP_25 352 +#define EFFECT_STUFF_CHEEKS 353 +#define EFFECT_GRAV_APPLE 354 +#define EFFECT_EVASION_UP_HIT 355 +#define EFFECT_GLITZY_GLOW 356 +#define EFFECT_BADDY_BAD 357 +#define EFFECT_SAPPY_SEED 358 +#define EFFECT_FREEZY_FROST 359 +#define EFFECT_SPARKLY_SWIRL 360 +#define EFFECT_PLASMA_FISTS 361 +#define EFFECT_HYPERSPACE_FURY 362 +#define EFFECT_AURA_WHEEL 363 +#define EFFECT_PHOTON_GEYSER 364 +#define EFFECT_SHELL_SIDE_ARM 365 +#define EFFECT_TERRAIN_PULSE 366 +#define EFFECT_JAW_LOCK 367 +#define EFFECT_NO_RETREAT 368 +#define EFFECT_TAR_SHOT 369 +#define EFFECT_POLTERGEIST 370 +#define EFFECT_OCTOLOCK 371 +#define EFFECT_CLANGOROUS_SOUL 372 +#define EFFECT_BOLT_BEAK 373 +#define EFFECT_SKY_DROP 374 +#define EFFECT_EXPANDING_FORCE 375 +#define EFFECT_METEOR_BEAM 376 +#define EFFECT_RISING_VOLTAGE 377 +#define EFFECT_BEAK_BLAST 378 +#define EFFECT_COURT_CHANGE 379 +#define EFFECT_STEEL_BEAM 380 +#define EFFECT_EXTREME_EVOBOOST 381 +#define EFFECT_HIT_SET_REMOVE_TERRAIN 382 // genesis supernova +#define EFFECT_DARK_VOID 383 +#define EFFECT_SLEEP_HIT 384 +#define EFFECT_DOUBLE_SHOCK 385 +#define EFFECT_SPECIAL_ATTACK_UP_HIT 386 +#define EFFECT_VICTORY_DANCE 387 +#define EFFECT_TEATIME 388 +#define EFFECT_ATTACK_UP_USER_ALLY 389 // Howl 8th Gen +#define EFFECT_SHELL_TRAP 390 +#define EFFECT_PSYBLADE 391 +#define EFFECT_HYDRO_STEAM 392 +#define EFFECT_HIT_SET_ENTRY_HAZARD 393 +#define EFFECT_DIRE_CLAW 394 +#define EFFECT_BARB_BARRAGE 395 +#define EFFECT_REVIVAL_BLESSING 396 +#define EFFECT_FROSTBITE_HIT 397 +#define EFFECT_SNOWSCAPE 398 +#define EFFECT_TRIPLE_ARROWS 399 +#define EFFECT_INFERNAL_PARADE 400 +#define EFFECT_TAKE_HEART 401 +#define EFFECT_AXE_KICK 402 +#define EFFECT_COLLISION_COURSE 403 +#define EFFECT_SPIN_OUT 404 +#define EFFECT_MAKE_IT_RAIN 405 +#define EFFECT_CORROSIVE_GAS 406 +#define EFFECT_POPULATION_BOMB 407 +#define EFFECT_MORTAL_SPIN 408 +#define EFFECT_GIGATON_HAMMER 409 +#define EFFECT_SALT_CURE 410 -#define NUM_BATTLE_MOVE_EFFECTS 401 +#define NUM_BATTLE_MOVE_EFFECTS 411 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 1b0bfba3c396..ee98bccec7e9 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -197,6 +197,7 @@ #define VARIOUS_TERRAIN_SEED 105 #define VARIOUS_MAKE_INVISIBLE 106 #define VARIOUS_ROOM_SERVICE 107 + #define VARIOUS_EERIE_SPELL_PP_REDUCE 108 #define VARIOUS_JUMP_IF_TEAM_HEALTHY 109 #define VARIOUS_TRY_HEAL_QUARTER_HP 110 @@ -208,52 +209,46 @@ #define VARIOUS_TRY_ACTIVATE_BATTLE_BOND 116 #define VARIOUS_CONSUME_BERRY 117 #define VARIOUS_JUMP_IF_CANT_REVERT_TO_PRIMAL 118 -#define VARIOUS_HANDLE_PRIMAL_REVERSION 119 -#define VARIOUS_APPLY_PLASMA_FISTS 120 -#define VARIOUS_JUMP_IF_SPECIES 121 -#define VARIOUS_UPDATE_ABILITY_POPUP 122 -#define VARIOUS_JUMP_IF_WEATHER_AFFECTED 123 -#define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 124 -#define VARIOUS_SET_ATTACKER_STICKY_WEB_USER 125 -#define VARIOUS_PHOTON_GEYSER_CHECK 126 -#define VARIOUS_SHELL_SIDE_ARM_CHECK 127 -#define VARIOUS_TRY_NO_RETREAT 128 -#define VARIOUS_TRY_TAR_SHOT 129 -#define VARIOUS_CAN_TAR_SHOT_WORK 130 -#define VARIOUS_CHECK_POLTERGEIST 131 -#define VARIOUS_SET_OCTOLOCK 132 -#define VARIOUS_CUT_1_3_HP_RAISE_STATS 133 -#define VARIOUS_TRY_END_NEUTRALIZING_GAS 134 -#define VARIOUS_JUMP_IF_UNDER_200 135 -#define VARIOUS_SET_SKY_DROP 136 -#define VARIOUS_CLEAR_SKY_DROP 137 -#define VARIOUS_SKY_DROP_YAWN 138 -#define VARIOUS_JUMP_IF_HOLD_EFFECT 139 -#define VARIOUS_CURE_CERTAIN_STATUSES 140 -#define VARIOUS_TRY_RESET_NEGATIVE_STAT_STAGES 141 -#define VARIOUS_JUMP_IF_LAST_USED_ITEM_BERRY 142 -#define VARIOUS_JUMP_IF_LAST_USED_ITEM_HOLD_EFFECT 143 -#define VARIOUS_SAVE_BATTLER_ITEM 144 -#define VARIOUS_RESTORE_BATTLER_ITEM 145 -#define VARIOUS_BATTLER_ITEM_TO_LAST_USED_ITEM 146 -#define VARIOUS_SET_BEAK_BLAST 147 -#define VARIOUS_SWAP_SIDE_STATUSES 148 -#define VARIOUS_SWAP_STATS 149 -#define VARIOUS_JUMP_IF_ROD 150 -#define VARIOUS_JUMP_IF_ABSORB 151 -#define VARIOUS_JUMP_IF_MOTOR 152 -#define VARIOUS_TEATIME_INVUL 153 -#define VARIOUS_TEATIME_TARGETS 154 -#define VARIOUS_TRY_WIND_RIDER_POWER 155 -#define VARIOUS_ACTIVATE_WEATHER_CHANGE_ABILITIES 156 -#define VARIOUS_ACTIVATE_TERRAIN_CHANGE_ABILITIES 157 -#define VARIOUS_JUMP_IF_EMERGENCY_EXITED 158 -#define VARIOUS_STORE_HEALING_WISH 159 -#define VARIOUS_HIT_SWITCH_TARGET_FAILED 160 -#define VARIOUS_JUMP_IF_SHELL_TRAP 161 -#define VARIOUS_TRY_REVIVAL_BLESSING 162 -#define VARIOUS_TRY_TRAINER_SLIDE_MSG_Z_MOVE 163 -#define VARIOUS_TRY_TRAINER_SLIDE_MSG_MEGA_EVOLUTION 164 +#define VARIOUS_APPLY_PLASMA_FISTS 119 +#define VARIOUS_JUMP_IF_SPECIES 120 +#define VARIOUS_UPDATE_ABILITY_POPUP 121 +#define VARIOUS_JUMP_IF_WEATHER_AFFECTED 122 +#define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 123 +#define VARIOUS_SET_ATTACKER_STICKY_WEB_USER 124 +#define VARIOUS_PHOTON_GEYSER_CHECK 125 +#define VARIOUS_SHELL_SIDE_ARM_CHECK 126 +#define VARIOUS_TRY_NO_RETREAT 127 +#define VARIOUS_TRY_TAR_SHOT 128 +#define VARIOUS_CAN_TAR_SHOT_WORK 129 +#define VARIOUS_CHECK_POLTERGEIST 130 +#define VARIOUS_SET_OCTOLOCK 131 +#define VARIOUS_CUT_1_3_HP_RAISE_STATS 132 +#define VARIOUS_TRY_END_NEUTRALIZING_GAS 133 +#define VARIOUS_JUMP_IF_UNDER_200 134 +#define VARIOUS_SET_SKY_DROP 135 +#define VARIOUS_CLEAR_SKY_DROP 136 +#define VARIOUS_SKY_DROP_YAWN 137 +#define VARIOUS_JUMP_IF_HOLD_EFFECT 138 +#define VARIOUS_CURE_CERTAIN_STATUSES 139 +#define VARIOUS_TRY_RESET_NEGATIVE_STAT_STAGES 140 +#define VARIOUS_JUMP_IF_LAST_USED_ITEM_BERRY 141 +#define VARIOUS_JUMP_IF_LAST_USED_ITEM_HOLD_EFFECT 142 +#define VARIOUS_SAVE_BATTLER_ITEM 143 +#define VARIOUS_RESTORE_BATTLER_ITEM 144 +#define VARIOUS_BATTLER_ITEM_TO_LAST_USED_ITEM 145 +#define VARIOUS_SET_BEAK_BLAST 146 +#define VARIOUS_SWAP_SIDE_STATUSES 147 +#define VARIOUS_SWAP_STATS 148 +#define VARIOUS_TEATIME_INVUL 149 +#define VARIOUS_TEATIME_TARGETS 150 +#define VARIOUS_TRY_WIND_RIDER_POWER 151 +#define VARIOUS_ACTIVATE_WEATHER_CHANGE_ABILITIES 152 +#define VARIOUS_ACTIVATE_TERRAIN_CHANGE_ABILITIES 153 +#define VARIOUS_STORE_HEALING_WISH 154 +#define VARIOUS_HIT_SWITCH_TARGET_FAILED 155 +#define VARIOUS_TRY_REVIVAL_BLESSING 156 +#define VARIOUS_TRY_TRAINER_SLIDE_MSG_Z_MOVE 157 +#define VARIOUS_TRY_TRAINER_SLIDE_MSG_MEGA_EVOLUTION 158 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index a122e617a45d..86a80c33cb77 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -663,8 +663,15 @@ #define STRINGID_SNOWCONTINUES 661 #define STRINGID_SNOWSTOPPED 662 #define STRINGID_SNOWWARNINGSNOW 663 - -#define BATTLESTRINGS_COUNT 664 +#define STRINGID_PKMNITEMMELTED 664 +#define STRINGID_ULTRABURSTREACTING 665 +#define STRINGID_ULTRABURSTCOMPLETED 666 +#define STRINGID_TEAMGAINEDEXP 667 +#define STRINGID_CURRENTMOVECANTSELECT 668 +#define STRINGID_TARGETISBEINGSALTCURED 669 +#define STRINGID_TARGETISHURTBYSALTCURE 670 + +#define BATTLESTRINGS_COUNT 671 // This is the string id that gBattleStringsTable starts with. // String ids before this (e.g. STRINGID_INTROMSG) are not in the table, diff --git a/include/constants/contest.h b/include/constants/contest.h index f7b858c4a3b9..c9e11cd99265 100644 --- a/include/constants/contest.h +++ b/include/constants/contest.h @@ -6,6 +6,8 @@ #define CONTEST_LAST_APPEAL (CONTEST_NUM_APPEALS - 1) #define MAX_CONTEST_MOVE_HEARTS 8 +#define CONTESTANT_NONE 0xFF + #define LINK_CONTEST_FLAG_IS_LINK (1 << 0) #define LINK_CONTEST_FLAG_IS_WIRELESS (1 << 1) #define LINK_CONTEST_FLAG_HAS_RS_PLAYER (1 << 2) diff --git a/include/constants/flags.h b/include/constants/flags.h index 59bde846c557..8d98e3aa0491 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -40,6 +40,7 @@ #define FLAG_TEMP_1E (TEMP_FLAGS_START + 0x1E) #define FLAG_TEMP_1F (TEMP_FLAGS_START + 0x1F) #define TEMP_FLAGS_END FLAG_TEMP_1F +#define NUM_TEMP_FLAGS (TEMP_FLAGS_END - TEMP_FLAGS_START + 1) #define FLAG_UNUSED_0x020 0x20 // Unused Flag #define FLAG_UNUSED_0x021 0x21 // Unused Flag @@ -121,11 +122,11 @@ #define FLAG_UNUSED_0x068 0x68 // Unused Flag #define FLAG_OCEANIC_MUSEUM_MET_REPORTER 0x69 -#define FLAG_RECEIVED_HM04 0x6A -#define FLAG_RECEIVED_HM06 0x6B +#define FLAG_RECEIVED_HM_STRENGTH 0x6A +#define FLAG_RECEIVED_HM_ROCK_SMASH 0x6B #define FLAG_WHITEOUT_TO_LAVARIDGE 0x6C // Set after defeating Flannery, so the player cant white out from poison before receiving Go Goggles -#define FLAG_RECEIVED_HM05 0x6D -#define FLAG_RECEIVED_HM02 0x6E +#define FLAG_RECEIVED_HM_FLASH 0x6D +#define FLAG_RECEIVED_HM_FLY 0x6E #define FLAG_GROUDON_AWAKENED_MAGMA_HIDEOUT 0x6F #define FLAG_TEAM_AQUA_ESCAPED_IN_SUBMARINE 0x70 #define FLAG_UNUSED_RS_LEGENDARY_BATTLE_DONE 0x71 // Unused Flag. Used in R/S to indicate whether player defeated or caught Groudon/Kyogre in Cave of Origin. @@ -138,9 +139,9 @@ #define FLAG_CANCEL_BATTLE_ROOM_CHALLENGE 0x77 #define FLAG_LANDMARK_MIRAGE_TOWER 0x78 -#define FLAG_RECEIVED_TM31 0x79 -#define FLAG_RECEIVED_HM03 0x7A -#define FLAG_RECEIVED_HM08 0x7B +#define FLAG_RECEIVED_TM_BRICK_BREAK 0x79 +#define FLAG_RECEIVED_HM_SURF 0x7A +#define FLAG_RECEIVED_HM_DIVE 0x7B #define FLAG_REGISTER_RIVAL_POKENAV 0x7C #define FLAG_DEFEATED_RIVAL_ROUTE_104 0x7D #define FLAG_DEFEATED_WALLY_VICTORY_ROAD 0x7E @@ -154,7 +155,7 @@ #define FLAG_PENDING_DAYCARE_EGG 0x86 #define FLAG_THANKED_FOR_PLAYING_WITH_WALLY 0x87 #define FLAG_ENABLE_FIRST_WALLY_POKENAV_CALL 0x88 // Set after defeating Wally outside Mauville Gym. Will activate a call later to register Wally. -#define FLAG_RECEIVED_HM01 0x89 +#define FLAG_RECEIVED_HM_CUT 0x89 #define FLAG_SCOTT_CALL_FORTREE_GYM 0x8A // Triggers call from Scott after defeating Winona #define FLAG_DEFEATED_EVIL_TEAM_MT_CHIMNEY 0x8B #define FLAG_RECEIVED_6_SODA_POP 0x8C @@ -182,14 +183,14 @@ #define FLAG_CUTE_PAINTING_MADE 0xA2 #define FLAG_SMART_PAINTING_MADE 0xA3 #define FLAG_TOUGH_PAINTING_MADE 0xA4 -#define FLAG_RECEIVED_TM39 0xA5 -#define FLAG_RECEIVED_TM08 0xA6 -#define FLAG_RECEIVED_TM34 0xA7 -#define FLAG_RECEIVED_TM50 0xA8 -#define FLAG_RECEIVED_TM42 0xA9 -#define FLAG_RECEIVED_TM40 0xAA -#define FLAG_RECEIVED_TM04 0xAB -#define FLAG_RECEIVED_TM03 0xAC +#define FLAG_RECEIVED_TM_ROCK_TOMB 0xA5 +#define FLAG_RECEIVED_TM_BULK_UP 0xA6 +#define FLAG_RECEIVED_TM_SHOCK_WAVE 0xA7 +#define FLAG_RECEIVED_TM_OVERHEAT 0xA8 +#define FLAG_RECEIVED_TM_FACADE 0xA9 +#define FLAG_RECEIVED_TM_AERIAL_ACE 0xAA +#define FLAG_RECEIVED_TM_CALM_MIND 0xAB +#define FLAG_RECEIVED_TM_WATER_PULSE 0xAC #define FLAG_HIDE_SECRET_BASE_TRAINER 0xAD #define FLAG_DECORATION_1 0xAE #define FLAG_DECORATION_2 0xAF @@ -226,7 +227,7 @@ #define FLAG_ENCOUNTERED_LATIAS_OR_LATIOS 0xCE #define FLAG_MET_ARCHIE_METEOR_FALLS 0xCF #define FLAG_GOT_BASEMENT_KEY_FROM_WATTSON 0xD0 -#define FLAG_GOT_TM24_FROM_WATTSON 0xD1 +#define FLAG_GOT_TM_THUNDERBOLT_FROM_WATTSON 0xD1 #define FLAG_FAN_CLUB_STRENGTH_SHARED 0xD2 // Set when you rate the strength of another trainer in Lilycove's Trainer Fan Club. #define FLAG_DEFEATED_RIVAL_RUSTBORO 0xD3 #define FLAG_RECEIVED_RED_OR_BLUE_ORB 0xD4 @@ -248,15 +249,15 @@ #define FLAG_RECEIVED_STARTER_DOLL 0xE2 #define FLAG_RECEIVED_GOOD_ROD 0xE3 #define FLAG_REGI_DOORS_OPENED 0xE4 -#define FLAG_RECEIVED_TM27 0xE5 -#define FLAG_RECEIVED_TM36 0xE6 -#define FLAG_RECEIVED_TM05 0xE7 -#define FLAG_RECEIVED_TM19 0xE8 +#define FLAG_RECEIVED_TM_RETURN 0xE5 +#define FLAG_RECEIVED_TM_SLUDGE_BOMB 0xE6 +#define FLAG_RECEIVED_TM_ROAR 0xE7 +#define FLAG_RECEIVED_TM_GIGA_DRAIN 0xE8 #define FLAG_UNUSED_0x0E9 0xE9 // Unused Flag -#define FLAG_RECEIVED_TM44 0xEA -#define FLAG_RECEIVED_TM45 0xEB +#define FLAG_RECEIVED_TM_REST 0xEA +#define FLAG_RECEIVED_TM_ATTRACT 0xEB #define FLAG_RECEIVED_GLASS_ORNAMENT 0xEC #define FLAG_RECEIVED_SILVER_SHIELD 0xED #define FLAG_RECEIVED_GOLD_SHIELD 0xEE @@ -281,16 +282,16 @@ #define FLAG_RECEIVED_OLD_ROD 0x101 #define FLAG_RECEIVED_COIN_CASE 0x102 #define FLAG_RETURNED_RED_OR_BLUE_ORB 0x103 -#define FLAG_RECEIVED_TM49 0x104 -#define FLAG_RECEIVED_TM28 0x105 -#define FLAG_RECEIVED_TM09 0x106 +#define FLAG_RECEIVED_TM_SNATCH 0x104 +#define FLAG_RECEIVED_TM_DIG 0x105 +#define FLAG_RECEIVED_TM_BULLET_SEED 0x106 #define FLAG_ENTERED_ELITE_FOUR 0x107 -#define FLAG_RECEIVED_TM10 0x108 -#define FLAG_RECEIVED_TM41 0x109 +#define FLAG_RECEIVED_TM_HIDDEN_POWER 0x108 +#define FLAG_RECEIVED_TM_TORMENT 0x109 #define FLAG_RECEIVED_LAVARIDGE_EGG 0x10A #define FLAG_RECEIVED_REVIVED_FOSSIL_MON 0x10B #define FLAG_SECRET_BASE_REGISTRY_ENABLED 0x10C -#define FLAG_RECEIVED_TM46 0x10D +#define FLAG_RECEIVED_TM_THIEF 0x10D #define FLAG_CONTEST_SKETCH_CREATED 0x10E // Set but never read #define FLAG_EVIL_TEAM_ESCAPED_STERN_SPOKE 0x10F #define FLAG_RECEIVED_EXP_SHARE 0x110 @@ -333,7 +334,7 @@ #define FLAG_MET_MAXIE_SOOTOPOLIS 0x135 #define FLAG_MET_SCOTT_RUSTBORO 0x136 #define FLAG_WALLACE_GOES_TO_SKY_PILLAR 0x137 // Set after speaking to Wallace within the Cave of Origin. -#define FLAG_RECEIVED_HM07 0x138 +#define FLAG_RECEIVED_HM_WATERFALL 0x138 #define FLAG_BEAT_MAGMA_GRUNT_JAGGED_PASS 0x139 #define FLAG_RECEIVED_AURORA_TICKET 0x13A #define FLAG_RECEIVED_MYSTIC_TICKET 0x13B @@ -568,7 +569,7 @@ #define FLAG_HIDDEN_ITEM_LILYCOVE_CITY_HEART_SCALE (FLAG_HIDDEN_ITEMS_START + 0x1B) #define FLAG_HIDDEN_ITEM_FALLARBOR_TOWN_NUGGET (FLAG_HIDDEN_ITEMS_START + 0x1C) #define FLAG_HIDDEN_ITEM_MT_PYRE_EXTERIOR_ULTRA_BALL (FLAG_HIDDEN_ITEMS_START + 0x1D) -#define FLAG_HIDDEN_ITEM_ROUTE_113_TM32 (FLAG_HIDDEN_ITEMS_START + 0x1E) +#define FLAG_HIDDEN_ITEM_ROUTE_113_TM_DOUBLE_TEAM (FLAG_HIDDEN_ITEMS_START + 0x1E) #define FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_1_KEY (FLAG_HIDDEN_ITEMS_START + 0x1F) #define FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_2_KEY (FLAG_HIDDEN_ITEMS_START + 0x20) #define FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_4_KEY (FLAG_HIDDEN_ITEMS_START + 0x21) @@ -1053,7 +1054,7 @@ #define FLAG_ITEM_ROUTE_109_PP_UP 0x3ED #define FLAG_ITEM_ROUTE_110_RARE_CANDY 0x3EE #define FLAG_ITEM_ROUTE_110_DIRE_HIT 0x3EF -#define FLAG_ITEM_ROUTE_111_TM37 0x3F0 +#define FLAG_ITEM_ROUTE_111_TM_SANDSTORM 0x3F0 #define FLAG_ITEM_ROUTE_111_STARDUST 0x3F1 #define FLAG_ITEM_ROUTE_111_HP_UP 0x3F2 #define FLAG_ITEM_ROUTE_112_NUGGET 0x3F3 @@ -1062,7 +1063,7 @@ #define FLAG_ITEM_ROUTE_114_RARE_CANDY 0x3F6 #define FLAG_ITEM_ROUTE_114_PROTEIN 0x3F7 #define FLAG_ITEM_ROUTE_115_SUPER_POTION 0x3F8 -#define FLAG_ITEM_ROUTE_115_TM01 0x3F9 +#define FLAG_ITEM_ROUTE_115_TM_FOCUS_PUNCH 0x3F9 #define FLAG_ITEM_ROUTE_115_IRON 0x3FA #define FLAG_ITEM_ROUTE_116_ETHER 0x3FB #define FLAG_ITEM_ROUTE_116_REPEL 0x3FC @@ -1089,7 +1090,7 @@ #define FLAG_ITEM_RUSTBORO_CITY_X_DEFEND 0x411 #define FLAG_ITEM_LILYCOVE_CITY_MAX_REPEL 0x412 #define FLAG_ITEM_MOSSDEEP_CITY_NET_BALL 0x413 -#define FLAG_ITEM_METEOR_FALLS_1F_1R_TM23 0x414 +#define FLAG_ITEM_METEOR_FALLS_1F_1R_TM_IRON_TAIL 0x414 #define FLAG_ITEM_METEOR_FALLS_1F_1R_FULL_HEAL 0x415 #define FLAG_ITEM_METEOR_FALLS_1F_1R_MOON_STONE 0x416 #define FLAG_ITEM_METEOR_FALLS_1F_1R_PP_UP 0x417 @@ -1119,35 +1120,35 @@ #define FLAG_ITEM_AQUA_HIDEOUT_B1F_MAX_ELIXIR 0x42F #define FLAG_ITEM_AQUA_HIDEOUT_B2F_NEST_BALL 0x430 #define FLAG_ITEM_MT_PYRE_EXTERIOR_MAX_POTION 0x431 -#define FLAG_ITEM_MT_PYRE_EXTERIOR_TM48 0x432 +#define FLAG_ITEM_MT_PYRE_EXTERIOR_TM_SKILL_SWAP 0x432 #define FLAG_ITEM_NEW_MAUVILLE_ULTRA_BALL 0x433 #define FLAG_ITEM_NEW_MAUVILLE_ESCAPE_ROPE 0x434 #define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_6_LUXURY_BALL 0x435 #define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_2_SCANNER 0x436 -#define FLAG_ITEM_SCORCHED_SLAB_TM11 0x437 -#define FLAG_ITEM_METEOR_FALLS_B1F_2R_TM02 0x438 +#define FLAG_ITEM_SCORCHED_SLAB_TM_SUNNY_DAY 0x437 +#define FLAG_ITEM_METEOR_FALLS_B1F_2R_TM_DRAGON_CLAW 0x438 #define FLAG_ITEM_SHOAL_CAVE_ENTRANCE_BIG_PEARL 0x439 #define FLAG_ITEM_SHOAL_CAVE_INNER_ROOM_RARE_CANDY 0x43A #define FLAG_ITEM_SHOAL_CAVE_STAIRS_ROOM_ICE_HEAL 0x43B #define FLAG_ITEM_VICTORY_ROAD_1F_MAX_ELIXIR 0x43C #define FLAG_ITEM_VICTORY_ROAD_1F_PP_UP 0x43D -#define FLAG_ITEM_VICTORY_ROAD_B1F_TM29 0x43E +#define FLAG_ITEM_VICTORY_ROAD_B1F_TM_PSYCHIC 0x43E #define FLAG_ITEM_VICTORY_ROAD_B1F_FULL_RESTORE 0x43F #define FLAG_ITEM_VICTORY_ROAD_B2F_FULL_HEAL 0x440 -#define FLAG_ITEM_MT_PYRE_6F_TM30 0x441 -#define FLAG_ITEM_SEAFLOOR_CAVERN_ROOM_9_TM26 0x442 -#define FLAG_ITEM_FIERY_PATH_TM06 0x443 +#define FLAG_ITEM_MT_PYRE_6F_TM_SHADOW_BALL 0x441 +#define FLAG_ITEM_SEAFLOOR_CAVERN_ROOM_9_TM_EARTHQUAKE 0x442 +#define FLAG_ITEM_FIERY_PATH_TM_TOXIC 0x443 #define FLAG_ITEM_ROUTE_124_RED_SHARD 0x444 #define FLAG_ITEM_ROUTE_124_BLUE_SHARD 0x445 -#define FLAG_ITEM_SAFARI_ZONE_NORTH_WEST_TM22 0x446 +#define FLAG_ITEM_SAFARI_ZONE_NORTH_WEST_TM_SOLAR_BEAM 0x446 #define FLAG_ITEM_ABANDONED_SHIP_ROOMS_1F_HARBOR_MAIL 0x447 #define FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_ESCAPE_ROPE 0x448 #define FLAG_ITEM_ABANDONED_SHIP_ROOMS_2_B1F_DIVE_BALL 0x449 -#define FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_TM13 0x44A +#define FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_TM_ICE_BEAM 0x44A #define FLAG_ITEM_ABANDONED_SHIP_ROOMS_2_1F_REVIVE 0x44B #define FLAG_ITEM_ABANDONED_SHIP_CAPTAINS_OFFICE_STORAGE_KEY 0x44C #define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_3_WATER_STONE 0x44D -#define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_1_TM18 0x44E +#define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_1_TM_RAIN_DANCE 0x44E #define FLAG_ITEM_ROUTE_121_CARBOS 0x44F #define FLAG_ITEM_ROUTE_123_ULTRA_BALL 0x450 #define FLAG_ITEM_ROUTE_126_GREEN_SHARD 0x451 @@ -1157,7 +1158,7 @@ #define FLAG_ITEM_ROUTE_123_ELIXIR 0x455 #define FLAG_ITEM_NEW_MAUVILLE_THUNDER_STONE 0x456 #define FLAG_ITEM_FIERY_PATH_FIRE_STONE 0x457 -#define FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_TM07 0x458 +#define FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_TM_HAIL 0x458 #define FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_NEVER_MELT_ICE 0x459 #define FLAG_ITEM_ROUTE_103_GUARD_SPEC 0x45A #define FLAG_ITEM_ROUTE_104_X_ACCURACY 0x45B @@ -1631,6 +1632,7 @@ #define FLAG_UNUSED_0x95E (DAILY_FLAGS_START + 0x3E) // Unused Flag #define FLAG_UNUSED_0x95F (DAILY_FLAGS_START + 0x3F) // Unused Flag #define DAILY_FLAGS_END (FLAG_UNUSED_0x95F + (7 - FLAG_UNUSED_0x95F % 8)) +#define NUM_DAILY_FLAGS (DAILY_FLAGS_END - DAILY_FLAGS_START + 1) #define FLAGS_COUNT (DAILY_FLAGS_END + 1) @@ -1643,5 +1645,12 @@ #define FLAG_STORING_ITEMS_IN_PYRAMID_BAG (SPECIAL_FLAGS_START + 0x4) // FLAG_SPECIAL_FLAG_0x4005 - 0x407F also exist and are unused #define SPECIAL_FLAGS_END (SPECIAL_FLAGS_START + 0x7F) +#define NUM_SPECIAL_FLAGS (SPECIAL_FLAGS_END - SPECIAL_FLAGS_START + 1) + +// Temp flag aliases +#define FLAG_TEMP_SKIP_GABBY_INTERVIEW FLAG_TEMP_1 +#define FLAG_TEMP_REGICE_PUZZLE_STARTED FLAG_TEMP_2 +#define FLAG_TEMP_REGICE_PUZZLE_FAILED FLAG_TEMP_3 +#define FLAG_TEMP_HIDE_MIRAGE_ISLAND_BERRY_TREE FLAG_TEMP_11 #endif // GUARD_CONSTANTS_FLAGS_H diff --git a/include/constants/form_change_types.h b/include/constants/form_change_types.h index 81d1b045b050..db96b065742d 100644 --- a/include/constants/form_change_types.h +++ b/include/constants/form_change_types.h @@ -96,4 +96,9 @@ // param1: ability to check. #define FORM_CHANGE_BATTLE_TURN_END 15 +// Form change that activates when the mon has the defined item. +// If it's on the player's side, it also requires for the player to trigger it by pressing START before selecting a move. +// param1: item to hold. +#define FORM_CHANGE_BATTLE_ULTRA_BURST 16 + #endif // GUARD_CONSTANTS_FORM_CHANGE_TYPES_H diff --git a/include/constants/global.h b/include/constants/global.h index 2f150246b241..7f4d8ccd3a47 100644 --- a/include/constants/global.h +++ b/include/constants/global.h @@ -87,6 +87,7 @@ #define TRAINER_ID_LENGTH 4 #define MAX_MON_MOVES 4 +#define ALL_MOVES_MASK ((1 << MAX_MON_MOVES) - 1) #define CONTESTANT_COUNT 4 #define CONTEST_CATEGORY_COOL 0 @@ -99,6 +100,7 @@ // string lengths #define ITEM_NAME_LENGTH 14 #define POKEMON_NAME_LENGTH 10 +#define POKEMON_NAME_BUFFER_SIZE max(20, POKEMON_NAME_LENGTH + 1) // Frequently used buffer size. Larger than necessary #define PLAYER_NAME_LENGTH 7 #define MAIL_WORDS_COUNT 9 #define EASY_CHAT_BATTLE_WORDS_COUNT 6 diff --git a/include/constants/items.h b/include/constants/items.h index 57ed63feb4ec..20cbc6379b69 100644 --- a/include/constants/items.h +++ b/include/constants/items.h @@ -790,66 +790,6 @@ #define ITEM_HM07 688 #define ITEM_HM08 689 -#define ITEM_TM01_FOCUS_PUNCH ITEM_TM01 -#define ITEM_TM02_DRAGON_CLAW ITEM_TM02 -#define ITEM_TM03_WATER_PULSE ITEM_TM03 -#define ITEM_TM04_CALM_MIND ITEM_TM04 -#define ITEM_TM05_ROAR ITEM_TM05 -#define ITEM_TM06_TOXIC ITEM_TM06 -#define ITEM_TM07_HAIL ITEM_TM07 -#define ITEM_TM08_BULK_UP ITEM_TM08 -#define ITEM_TM09_BULLET_SEED ITEM_TM09 -#define ITEM_TM10_HIDDEN_POWER ITEM_TM10 -#define ITEM_TM11_SUNNY_DAY ITEM_TM11 -#define ITEM_TM12_TAUNT ITEM_TM12 -#define ITEM_TM13_ICE_BEAM ITEM_TM13 -#define ITEM_TM14_BLIZZARD ITEM_TM14 -#define ITEM_TM15_HYPER_BEAM ITEM_TM15 -#define ITEM_TM16_LIGHT_SCREEN ITEM_TM16 -#define ITEM_TM17_PROTECT ITEM_TM17 -#define ITEM_TM18_RAIN_DANCE ITEM_TM18 -#define ITEM_TM19_GIGA_DRAIN ITEM_TM19 -#define ITEM_TM20_SAFEGUARD ITEM_TM20 -#define ITEM_TM21_FRUSTRATION ITEM_TM21 -#define ITEM_TM22_SOLAR_BEAM ITEM_TM22 -#define ITEM_TM23_IRON_TAIL ITEM_TM23 -#define ITEM_TM24_THUNDERBOLT ITEM_TM24 -#define ITEM_TM25_THUNDER ITEM_TM25 -#define ITEM_TM26_EARTHQUAKE ITEM_TM26 -#define ITEM_TM27_RETURN ITEM_TM27 -#define ITEM_TM28_DIG ITEM_TM28 -#define ITEM_TM29_PSYCHIC ITEM_TM29 -#define ITEM_TM30_SHADOW_BALL ITEM_TM30 -#define ITEM_TM31_BRICK_BREAK ITEM_TM31 -#define ITEM_TM32_DOUBLE_TEAM ITEM_TM32 -#define ITEM_TM33_REFLECT ITEM_TM33 -#define ITEM_TM34_SHOCK_WAVE ITEM_TM34 -#define ITEM_TM35_FLAMETHROWER ITEM_TM35 -#define ITEM_TM36_SLUDGE_BOMB ITEM_TM36 -#define ITEM_TM37_SANDSTORM ITEM_TM37 -#define ITEM_TM38_FIRE_BLAST ITEM_TM38 -#define ITEM_TM39_ROCK_TOMB ITEM_TM39 -#define ITEM_TM40_AERIAL_ACE ITEM_TM40 -#define ITEM_TM41_TORMENT ITEM_TM41 -#define ITEM_TM42_FACADE ITEM_TM42 -#define ITEM_TM43_SECRET_POWER ITEM_TM43 -#define ITEM_TM44_REST ITEM_TM44 -#define ITEM_TM45_ATTRACT ITEM_TM45 -#define ITEM_TM46_THIEF ITEM_TM46 -#define ITEM_TM47_STEEL_WING ITEM_TM47 -#define ITEM_TM48_SKILL_SWAP ITEM_TM48 -#define ITEM_TM49_SNATCH ITEM_TM49 -#define ITEM_TM50_OVERHEAT ITEM_TM50 - -#define ITEM_HM01_CUT ITEM_HM01 -#define ITEM_HM02_FLY ITEM_HM02 -#define ITEM_HM03_SURF ITEM_HM03 -#define ITEM_HM04_STRENGTH ITEM_HM04 -#define ITEM_HM05_FLASH ITEM_HM05 -#define ITEM_HM06_ROCK_SMASH ITEM_HM06 -#define ITEM_HM07_WATERFALL ITEM_HM07 -#define ITEM_HM08_DIVE ITEM_HM08 - // Charms #define ITEM_OVAL_CHARM 690 #define ITEM_SHINY_CHARM 691 diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 510d48271c23..e3dd15000fb0 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -213,39 +213,6 @@ #define EV_ITEM_RAISE_LIMIT 100 #endif -// Battle move flags -#define FLAG_MAKES_CONTACT (1 << 0) -#define FLAG_PROTECT_AFFECTED (1 << 1) -#define FLAG_MAGIC_COAT_AFFECTED (1 << 2) -#define FLAG_SNATCH_AFFECTED (1 << 3) -#define FLAG_MIRROR_MOVE_AFFECTED (1 << 4) -#define FLAG_KINGS_ROCK_AFFECTED (1 << 5) -#define FLAG_HIGH_CRIT (1 << 6) -#define FLAG_RECKLESS_BOOST (1 << 7) -#define FLAG_IRON_FIST_BOOST (1 << 8) -#define FLAG_SHEER_FORCE_BOOST (1 << 9) -#define FLAG_STRONG_JAW_BOOST (1 << 10) -#define FLAG_MEGA_LAUNCHER_BOOST (1 << 11) -#define FLAG_STAT_STAGES_IGNORED (1 << 12) -#define FLAG_DMG_MINIMIZE (1 << 13) -#define FLAG_DMG_UNDERGROUND (1 << 14) -#define FLAG_DMG_UNDERWATER (1 << 15) -#define FLAG_SOUND (1 << 16) -#define FLAG_BALLISTIC (1 << 17) -#define FLAG_PROTECTION_MOVE (1 << 18) -#define FLAG_POWDER (1 << 19) -#define FLAG_TARGET_ABILITY_IGNORED (1 << 20) -#define FLAG_DANCE (1 << 21) -#define FLAG_DMG_2X_IN_AIR (1 << 22) // If target is in the air, can hit and deal double damage. -#define FLAG_DMG_IN_AIR (1 << 23) // If target is in the air, can hit. -#define FLAG_DMG_UNGROUNDED_IGNORE_TYPE_IF_FLYING (1 << 24) // Makes a Ground type move do 1x damage to flying and levitating targets -#define FLAG_THAW_USER (1 << 25) -#define FLAG_HIT_IN_SUBSTITUTE (1 << 26) // Hyperspace Fury -#define FLAG_TWO_STRIKES (1 << 27) // A move with this flag will strike twice, and may apply its effect on each hit -#define FLAG_THREE_STRIKES (1 << 28) // A move with this flag will strike thrice, and may apply its effect on each hit -#define FLAG_WIND_MOVE (1 << 29) -#define FLAG_SLICING_MOVE (1 << 30) - // Split defines. #define SPLIT_PHYSICAL 0x0 #define SPLIT_SPECIAL 0x1 @@ -302,7 +269,7 @@ #define EVO_MAPSEC 25 // Pokémon levels up on specified mapsec #define EVO_ITEM_MALE 26 // specified item is used on a male Pokémon #define EVO_ITEM_FEMALE 27 // specified item is used on a female Pokémon -#define EVO_LEVEL_RAIN 28 // Pokémon reaches the specified level while it's raining +#define EVO_LEVEL_RAIN 28 // Pokémon reaches the specified level during rain in the overworld #define EVO_SPECIFIC_MON_IN_PARTY 29 // Pokémon levels up with a specified Pokémon in party #define EVO_LEVEL_DARK_TYPE_MON_IN_PARTY 30 // Pokémon reaches the specified level with a Dark Type Pokémon in party #define EVO_TRADE_SPECIFIC_MON 31 // Pokémon is traded for a specified Pokémon @@ -316,6 +283,7 @@ #define EVO_ITEM_NIGHT 39 // specified item is used on Pokémon, is night #define EVO_ITEM_DAY 40 // specified item is used on Pokémon, is day #define EVO_ITEM_HOLD 41 // Pokémon levels up, holds specified item +#define EVO_LEVEL_FOG 42 // Pokémon reaches the specified level during fog in the overworld #define EVOS_PER_MON 10 @@ -333,16 +301,13 @@ // Most pokemon have 2 frames (a default and an alternate for their animation). // There are 4 exceptions: -// - Castform has 4 frames, 1 for each form // - Deoxys has 2 frames, 1 for each form // - Spinda has 1 frame, presumably to avoid the work of animating its spots // - Unown has 1 frame, presumably to avoid the work of animating all 28 of its forms -#define MAX_MON_PIC_FRAMES 4 +#define MAX_MON_PIC_FRAMES 2 -#define BATTLE_ALIVE_EXCEPT_ACTIVE 0 -#define BATTLE_ALIVE_ATK_SIDE 1 -#define BATTLE_ALIVE_DEF_SIDE 2 -#define BATTLE_ALIVE_EXCEPT_ATTACKER 3 +#define BATTLE_ALIVE_EXCEPT_BATTLER 0 +#define BATTLE_ALIVE_SIDE 1 #define SKIP_FRONT_ANIM (1 << 7) @@ -359,9 +324,9 @@ #define SPECIES_FLAG_ALOLAN_FORM (1 << 5) #define SPECIES_FLAG_GALARIAN_FORM (1 << 6) #define SPECIES_FLAG_HISUIAN_FORM (1 << 7) -#define SPECIES_FLAG_GENDER_DIFFERENCE (1 << 8) -#define SPECIES_FLAG_ALL_PERFECT_IVS (1 << 9) -#define SPECIES_FLAG_CANNOT_BE_TRADED (1 << 10) +#define SPECIES_FLAG_ALL_PERFECT_IVS (1 << 8) +#define SPECIES_FLAG_CANNOT_BE_TRADED (1 << 9) +#define SPECIES_FLAG_ULTRA_BURST (1 << 10) #define LEGENDARY_PERFECT_IV_COUNT 3 diff --git a/include/constants/tms_hms.h b/include/constants/tms_hms.h new file mode 100644 index 000000000000..03fb9341393d --- /dev/null +++ b/include/constants/tms_hms.h @@ -0,0 +1,70 @@ +#ifndef GUARD_CONSTANTS_TMS_HMS_H +#define GUARD_CONSTANTS_TMS_HMS_H + +#define FOREACH_TM(F) \ + F(FOCUS_PUNCH) \ + F(DRAGON_CLAW) \ + F(WATER_PULSE) \ + F(CALM_MIND) \ + F(ROAR) \ + F(TOXIC) \ + F(HAIL) \ + F(BULK_UP) \ + F(BULLET_SEED) \ + F(HIDDEN_POWER) \ + F(SUNNY_DAY) \ + F(TAUNT) \ + F(ICE_BEAM) \ + F(BLIZZARD) \ + F(HYPER_BEAM) \ + F(LIGHT_SCREEN) \ + F(PROTECT) \ + F(RAIN_DANCE) \ + F(GIGA_DRAIN) \ + F(SAFEGUARD) \ + F(FRUSTRATION) \ + F(SOLAR_BEAM) \ + F(IRON_TAIL) \ + F(THUNDERBOLT) \ + F(THUNDER) \ + F(EARTHQUAKE) \ + F(RETURN) \ + F(DIG) \ + F(PSYCHIC) \ + F(SHADOW_BALL) \ + F(BRICK_BREAK) \ + F(DOUBLE_TEAM) \ + F(REFLECT) \ + F(SHOCK_WAVE) \ + F(FLAMETHROWER) \ + F(SLUDGE_BOMB) \ + F(SANDSTORM) \ + F(FIRE_BLAST) \ + F(ROCK_TOMB) \ + F(AERIAL_ACE) \ + F(TORMENT) \ + F(FACADE) \ + F(SECRET_POWER) \ + F(REST) \ + F(ATTRACT) \ + F(THIEF) \ + F(STEEL_WING) \ + F(SKILL_SWAP) \ + F(SNATCH) \ + F(OVERHEAT) + +#define FOREACH_HM(F) \ + F(CUT) \ + F(FLY) \ + F(SURF) \ + F(STRENGTH) \ + F(FLASH) \ + F(ROCK_SMASH) \ + F(WATERFALL) \ + F(DIVE) + +#define FOREACH_TMHM(F) \ + FOREACH_TM(F) \ + FOREACH_HM(F) + +#endif diff --git a/include/constants/trainer_hill.h b/include/constants/trainer_hill.h index e0f660b6f004..610cb81c68db 100644 --- a/include/constants/trainer_hill.h +++ b/include/constants/trainer_hill.h @@ -55,7 +55,7 @@ #define TRAINER_HILL_OTID 0x10000000 // The full map of each Trainer Hill floor is 16x21. -// The first 5x21 at the top is the entrance/exit area, +// The first 16x5 at the top is the entrance/exit area, // and the remaining 16x16 is the randomized portion of // the room where the trainers are. #define HILL_FLOOR_WIDTH 16 diff --git a/include/constants/trainers.h b/include/constants/trainers.h index 25660ac073d6..16904bcd1221 100644 --- a/include/constants/trainers.h +++ b/include/constants/trainers.h @@ -371,13 +371,6 @@ #define F_TRAINER_FEMALE (1 << 7) -// All trainer parties specify the IV, level, and species for each Pokémon in the -// party. Some trainer parties also specify held items and custom moves for each -// Pokémon. -#define F_TRAINER_PARTY_CUSTOM_MOVESET (1 << 0) -#define F_TRAINER_PARTY_HELD_ITEM (1 << 1) -#define F_TRAINER_PARTY_EVERYTHING_CUSTOMIZED (1 << 3) - // Trainer party defines #define TRAINER_MON_MALE 1 #define TRAINER_MON_FEMALE 2 diff --git a/include/constants/vars.h b/include/constants/vars.h index e0b08f4475b3..e79919c329f1 100644 --- a/include/constants/vars.h +++ b/include/constants/vars.h @@ -9,7 +9,7 @@ #define VAR_TEMP_0 (TEMP_VARS_START + 0x0) #define VAR_TEMP_1 (TEMP_VARS_START + 0x1) #define VAR_TEMP_2 (TEMP_VARS_START + 0x2) -#define VAR_TEMP_3 (TEMP_VARS_START + 0x3) +#define VAR_TEMP_3 (TEMP_VARS_START + 0x3) // Note: Used when the player checks a TV #define VAR_TEMP_4 (TEMP_VARS_START + 0x4) #define VAR_TEMP_5 (TEMP_VARS_START + 0x5) #define VAR_TEMP_6 (TEMP_VARS_START + 0x6) @@ -23,6 +23,7 @@ #define VAR_TEMP_E (TEMP_VARS_START + 0xE) #define VAR_TEMP_F (TEMP_VARS_START + 0xF) #define TEMP_VARS_END VAR_TEMP_F +#define NUM_TEMP_VARS (TEMP_VARS_END - TEMP_VARS_START + 1) // object gfx id vars // These 0x10 vars are used to dynamically control a map object's sprite. @@ -310,4 +311,17 @@ // cutscenes nor call a wait command. Used for weather effects in vanilla. #define TRIGGER_RUN_IMMEDIATELY 0 +// Temp var aliases +#define VAR_TEMP_CHALLENGE_STATUS VAR_TEMP_0 + +#define VAR_TEMP_MIXED_RECORDS VAR_TEMP_0 +#define VAR_TEMP_RECORD_MIX_GIFT_ITEM VAR_TEMP_1 + +#define VAR_TEMP_PLAYING_PYRAMID_MUSIC VAR_TEMP_E + +#define VAR_TEMP_FRONTIER_TUTOR_SELECTION VAR_TEMP_D +#define VAR_TEMP_FRONTIER_TUTOR_ID VAR_TEMP_E + +#define VAR_TEMP_TRANSFERRED_SPECIES VAR_TEMP_1 + #endif // GUARD_CONSTANTS_VARS_H diff --git a/include/credits.h b/include/credits.h index 2e8c7e0c3cac..43f26c3744ea 100644 --- a/include/credits.h +++ b/include/credits.h @@ -1,7 +1,7 @@ #ifndef GUARD_CREDITS_H #define GUARD_CREDITS_H -extern EWRAM_DATA bool8 gHasHallOfFameRecords; +extern bool8 gHasHallOfFameRecords; void CB2_StartCreditsSequence(void); diff --git a/include/data.h b/include/data.h index 6e41ac703a44..d2248820eaef 100644 --- a/include/data.h +++ b/include/data.h @@ -35,7 +35,7 @@ struct MonCoords #define TRAINER_PARTY_EVS(hp, atk, def, speed, spatk, spdef) ((const u8[6]){hp,atk,def,spatk,spdef,speed}) #define TRAINER_PARTY_NATURE(nature) (nature+1) -struct TrainerMonCustomized +struct TrainerMon { const u8 *nickname; const u8 *ev; @@ -52,64 +52,19 @@ struct TrainerMonCustomized bool8 isShiny : 1; }; -struct TrainerMonNoItemDefaultMoves -{ - u16 iv; - u8 lvl; - u16 species; -}; - -struct TrainerMonItemDefaultMoves -{ - u16 iv; - u8 lvl; - u16 species; - u16 heldItem; -}; - -struct TrainerMonNoItemCustomMoves -{ - u16 iv; - u8 lvl; - u16 species; - u16 moves[MAX_MON_MOVES]; -}; - -struct TrainerMonItemCustomMoves -{ - u16 iv; - u8 lvl; - u16 species; - u16 heldItem; - u16 moves[MAX_MON_MOVES]; -}; - -#define NO_ITEM_DEFAULT_MOVES(party) { .NoItemDefaultMoves = party }, .partySize = ARRAY_COUNT(party), .partyFlags = 0 -#define NO_ITEM_CUSTOM_MOVES(party) { .NoItemCustomMoves = party }, .partySize = ARRAY_COUNT(party), .partyFlags = F_TRAINER_PARTY_CUSTOM_MOVESET -#define ITEM_DEFAULT_MOVES(party) { .ItemDefaultMoves = party }, .partySize = ARRAY_COUNT(party), .partyFlags = F_TRAINER_PARTY_HELD_ITEM -#define ITEM_CUSTOM_MOVES(party) { .ItemCustomMoves = party }, .partySize = ARRAY_COUNT(party), .partyFlags = F_TRAINER_PARTY_CUSTOM_MOVESET | F_TRAINER_PARTY_HELD_ITEM -#define EVERYTHING_CUSTOMIZED(party) { .EverythingCustomized = party}, .partySize = ARRAY_COUNT(party), .partyFlags = F_TRAINER_PARTY_EVERYTHING_CUSTOMIZED - -union TrainerMonPtr -{ - const struct TrainerMonNoItemDefaultMoves *NoItemDefaultMoves; - const struct TrainerMonNoItemCustomMoves *NoItemCustomMoves; - const struct TrainerMonItemDefaultMoves *ItemDefaultMoves; - const struct TrainerMonItemCustomMoves *ItemCustomMoves; - const struct TrainerMonCustomized *EverythingCustomized; -}; +#define TRAINER_PARTY(partyArray) partyArray, .partySize = ARRAY_COUNT(partyArray) struct Trainer { /*0x00*/ u32 aiFlags; - /*0x04*/ union TrainerMonPtr party; + /*0x04*/ const struct TrainerMon *party; /*0x08*/ u16 items[MAX_TRAINER_ITEMS]; /*0x10*/ u8 trainerClass; /*0x11*/ u8 encounterMusic_gender; // last bit is gender /*0x12*/ u8 trainerPic; /*0x13*/ u8 trainerName[TRAINER_NAME_LENGTH + 1]; /*0x1E*/ bool8 doubleBattle:1; - u8 partyFlags:7; + u8 padding:7; /*0x1F*/ u8 partySize; }; @@ -153,7 +108,7 @@ extern const struct MonCoords gTrainerBackPicCoords[]; extern const struct CompressedSpriteSheet gTrainerBackPicTable[]; // functionally unused extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; -extern const u8 gEnemyMonElevation[NUM_SPECIES]; +extern const u8 gEnemyMonElevation[NUM_SPECIES + 1]; extern const union AnimCmd *const *const gMonFrontAnimsPtrTable[]; extern const struct CompressedSpriteSheet gMonFrontPicTable[]; @@ -161,7 +116,7 @@ extern const struct CompressedSpriteSheet gMonFrontPicTableFemale[]; extern const struct Trainer gTrainers[]; extern const u8 gTrainerClassNames[][13]; -extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1]; +extern const u8 gSpeciesNames[NUM_SPECIES][POKEMON_NAME_LENGTH + 1]; extern const u8 gMoveNames[MOVES_COUNT][MOVE_NAME_LENGTH + 1]; extern const u8 *const gZMoveNames[]; diff --git a/include/daycare.h b/include/daycare.h index 62a7918ff370..066499fd417d 100644 --- a/include/daycare.h +++ b/include/daycare.h @@ -14,6 +14,7 @@ u8 *GetMonNickname2(struct Pokemon *mon, u8 *dest); u8 *GetBoxMonNickname(struct BoxPokemon *mon, u8 *dest); u8 CountPokemonInDaycare(struct DayCare *daycare); void InitDaycareMailRecordMixing(struct DayCare *daycare, struct RecordMixingDaycareMail *mixMail); +s8 Daycare_FindEmptySpot(struct DayCare *daycare); void StoreSelectedPokemonInDaycare(void); u16 TakePokemonFromDaycare(void); void GetDaycareCost(void); @@ -26,6 +27,7 @@ bool8 ShouldEggHatch(void); u16 GetSelectedMonNicknameAndSpecies(void); void GetDaycareMonNicknames(void); u8 GetDaycareState(void); +u8 GetDaycareCompatibilityScore(struct DayCare *daycare); void SetDaycareCompatibilityString(void); bool8 NameHasGenderSymbol(const u8 *name, u8 genderRatio); void ShowDaycareLevelMenu(void); diff --git a/include/debug.h b/include/debug.h index 88f5f666205c..d89c7994b860 100644 --- a/include/debug.h +++ b/include/debug.h @@ -3,4 +3,7 @@ void Debug_ShowMainMenu(void); +extern EWRAM_DATA bool8 gIsDebugBattle; +extern EWRAM_DATA u32 gDebugAIFlags; + #endif // GUARD_DEBUG_H diff --git a/include/decoration.h b/include/decoration.h index b00dd42f12c7..db0f337f4d8b 100644 --- a/include/decoration.h +++ b/include/decoration.h @@ -53,8 +53,8 @@ struct Decoration }; extern const struct Decoration gDecorations[]; -extern EWRAM_DATA u8 *gCurDecorationItems; -extern EWRAM_DATA u8 gCurDecorationIndex; +extern u8 *gCurDecorationItems; +extern u8 gCurDecorationIndex; void InitDecorationContextItems(void); void DoSecretBaseDecorationMenu(u8 taskId); diff --git a/include/fpmath.h b/include/fpmath.h new file mode 100644 index 000000000000..6e3edd64e0a8 --- /dev/null +++ b/include/fpmath.h @@ -0,0 +1,81 @@ +#ifndef FPMATH_H_ +#define FPMATH_H_ + +typedef s16 q4_12_t; +typedef u32 uq4_12_t; + +#define Q_4_12_SHIFT (12) +#define UQ_4_12_SHIFT (12) + +// Converts a number to Q8.8 fixed-point format +#define Q_8_8(n) ((s16)((n) * 256)) + +// Converts a number to Q4.12 fixed-point format +#define Q_4_12(n) ((q4_12_t)((n) * 4096)) +#define UQ_4_12(n) ((uq4_12_t)((n) * 4096)) + +// Converts a number to Q24.8 fixed-point format +#define Q_24_8(n) ((s32)((n) << 8)) + +// Converts a Q8.8 fixed-point format number to a regular integer +#define Q_8_8_TO_INT(n) ((s32)((n) / 256)) + +// Converts a Q4.12 fixed-point format number to a regular integer +#define Q_4_12_TO_INT(n) ((s32)((n) / 4096)) +#define UQ_4_12_TO_INT(n) ((u32)((n) / 4096)) + +// Converts a Q24.8 fixed-point format number to a regular integer +#define Q_24_8_TO_INT(n) ((s32)((n) >> 8)) + +// Rounding value for Q4.12 fixed-point format +#define Q_4_12_ROUND ((1) << (Q_4_12_SHIFT - 1)) +#define UQ_4_12_ROUND ((1) << (UQ_4_12_SHIFT - 1)) + +// Basic arithmetic for fixed point number formats +// Consumers should use encapsulated functions where possible + +// FP API does not provide sanity checks against overflows + +static inline uq4_12_t uq4_12_add(uq4_12_t a, uq4_12_t b) +{ + return a + b; +} + +static inline uq4_12_t uq4_12_subtract(uq4_12_t a, uq4_12_t b) +{ + return a - b; +} + +static inline uq4_12_t uq4_12_multiply(uq4_12_t a, uq4_12_t b) +{ + u32 product = (u32) a * b; + return (product + UQ_4_12_ROUND) >> UQ_4_12_SHIFT; +} + +static inline uq4_12_t uq4_12_multiply_half_down(uq4_12_t a, uq4_12_t b) +{ + u32 product = (u32) a * b; + return (product + UQ_4_12_ROUND - 1) >> UQ_4_12_SHIFT; +} + +static inline uq4_12_t uq4_12_divide(uq4_12_t dividend, uq4_12_t divisor) +{ + if (divisor == UQ_4_12(0.0)) return UQ_4_12(0); + return (dividend << UQ_4_12_SHIFT) / divisor; +} + +// Multiplies value by the UQ_4_12 number modifier. +// Returns an integer, rounded to nearest (rounding down on n.5) +static inline u32 uq4_12_multiply_by_int_half_down(uq4_12_t modifier, u32 value) +{ + return UQ_4_12_TO_INT((modifier * value) + UQ_4_12_ROUND - 1); +} + +// Multiplies value by the UQ_4_12 number modifier. +// Returns an integer, rounded to nearest (rounding up on n.5) +static inline u32 uq4_12_multiply_by_int_half_up(uq4_12_t modifier, u32 value) +{ + return UQ_4_12_TO_INT((modifier * value) + UQ_4_12_ROUND); +} + +#endif // FPMATH_H_ diff --git a/include/gba/io_reg.h b/include/gba/io_reg.h index 148ce31db432..db219aeb3596 100644 --- a/include/gba/io_reg.h +++ b/include/gba/io_reg.h @@ -664,6 +664,7 @@ #define TIMER_64CLK 0x01 #define TIMER_256CLK 0x02 #define TIMER_1024CLK 0x03 +#define TIMER_COUNTUP 0x04 #define TIMER_INTR_ENABLE 0x40 #define TIMER_ENABLE 0x80 @@ -707,7 +708,7 @@ #define R_BUTTON 0x0100 #define L_BUTTON 0x0200 #define KEYS_MASK 0x03FF -#define KEY_INTR_ENABLE 0x0400 +#define KEY_INTR_ENABLE 0x4000 #define KEY_OR_INTR 0x0000 #define KEY_AND_INTR 0x8000 #define DPAD_ANY ((DPAD_RIGHT | DPAD_LEFT | DPAD_UP | DPAD_DOWN)) diff --git a/include/global.h b/include/global.h index 1638ec840d50..60abf094af3e 100644 --- a/include/global.h +++ b/include/global.h @@ -5,6 +5,7 @@ #include #include "config.h" // we need to define config before gba headers as print stuff needs the functions nulled before defines. #include "gba/gba.h" +#include "fpmath.h" #include "constants/global.h" #include "constants/flags.h" #include "constants/vars.h" @@ -50,32 +51,6 @@ b = temp; \ } -// useful math macros - -// Converts a number to Q8.8 fixed-point format -#define Q_8_8(n) ((s16)((n) * 256)) - -// Converts a number to Q4.12 fixed-point format -#define Q_4_12(n) ((s16)((n) * 4096)) -#define UQ_4_12(n) ((u16)((n) * 4096)) - -// Converts a number to Q24.8 fixed-point format -#define Q_24_8(n) ((s32)((n) << 8)) - -// Converts a Q8.8 fixed-point format number to a regular integer -#define Q_8_8_TO_INT(n) ((int)((n) / 256)) - -// Converts a Q4.12 fixed-point format number to a regular integer -#define Q_4_12_TO_INT(n) ((int)((n) / 4096)) -#define UQ_4_12_TO_INT(n) ((int)((n) / 4096)) - -// Converts a Q24.8 fixed-point format number to a regular integer -#define Q_24_8_TO_INT(n) ((int)((n) >> 8)) - -// Rounding value for Q4.12 fixed-point format -#define Q_4_12_ROUND ((1) << (12 - 1)) -#define UQ_4_12_ROUND ((1) << (12 - 1)) - #define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) >= (b) ? (a) : (b)) @@ -91,6 +66,12 @@ #define SAFE_DIV(a, b) ((a) / (b)) #endif +// The below macro does a%n, but (to match) will switch to a&(n-1) if n is a power of 2. +// There are cases where GF does a&(n-1) where we would really like to have a%n, because +// if n is changed to a value that isn't a power of 2 then a&(n-1) is unlikely to work as +// intended, and a%n for powers of 2 isn't always optimized to use &. +#define MOD(a, n)(((n) & ((n)-1)) ? ((a) % (n)) : ((a) & ((n)-1))) + // Extracts the upper 16 bits of a 32-bit number #define HIHALF(n) (((n) & 0xFFFF0000) >> 16) @@ -158,6 +139,8 @@ // It looks like file.c:line: size of array `id' is negative #define STATIC_ASSERT(expr, id) typedef char id[(expr) ? 1 : -1]; +#define FEATURE_FLAG_ASSERT(flag, id) STATIC_ASSERT(flag > TEMP_FLAGS_END || flag == 0, id) + struct Coords8 { s8 x; diff --git a/include/global.tv.h b/include/global.tv.h index 3729562cd6db..9c3902e7cca4 100644 --- a/include/global.tv.h +++ b/include/global.tv.h @@ -113,17 +113,17 @@ typedef union // size = 0x24 struct { /*0x00*/ u8 kind; /*0x01*/ bool8 active; - /*0x02*/ u8 trainerName[PLAYER_NAME_LENGTH + 1]; + /*0x02*/ u8 playerName[PLAYER_NAME_LENGTH + 1]; /*0x0A*/ u16 species; - /*0x0C*/ u8 pokemonName[8]; + /*0x0C*/ u8 opponentName[PLAYER_NAME_LENGTH + 1]; /*0x14*/ u16 defeatedSpecies; /*0x16*/ u16 numFights; /*0x18*/ u16 words[1]; /*0x1A*/ u8 btLevel; /*0x1B*/ u8 interviewResponse; /*0x1C*/ bool8 wonTheChallenge; - /*0x1D*/ u8 language; - /*0x1E*/ u8 pokemonNameLanguage; + /*0x1D*/ u8 playerLanguage; + /*0x1E*/ u8 opponentLanguage; /*0x1F*/ //u8 padding; } bravoTrainerTower; diff --git a/include/graphics.h b/include/graphics.h index 472c314b2ee3..00727abacdc6 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -70,6 +70,7 @@ extern const u32 gMonFrontPic_DoubleQuestionMark[]; extern const u32 gMonFrontPic_Bulbasaur[]; extern const u32 gMonFrontPic_Ivysaur[]; extern const u32 gMonFrontPic_Venusaur[]; +extern const u32 gMonFrontPic_VenusaurF[]; extern const u32 gMonFrontPic_Charmander[]; extern const u32 gMonFrontPic_Charmeleon[]; extern const u32 gMonFrontPic_Charizard[]; @@ -79,6 +80,7 @@ extern const u32 gMonFrontPic_Blastoise[]; extern const u32 gMonFrontPic_Caterpie[]; extern const u32 gMonFrontPic_Metapod[]; extern const u32 gMonFrontPic_Butterfree[]; +extern const u32 gMonFrontPic_ButterfreeF[]; extern const u32 gMonFrontPic_Weedle[]; extern const u32 gMonFrontPic_Kakuna[]; extern const u32 gMonFrontPic_Beedrill[]; @@ -86,13 +88,17 @@ extern const u32 gMonFrontPic_Pidgey[]; extern const u32 gMonFrontPic_Pidgeotto[]; extern const u32 gMonFrontPic_Pidgeot[]; extern const u32 gMonFrontPic_Rattata[]; +extern const u32 gMonFrontPic_RattataF[]; extern const u32 gMonFrontPic_Raticate[]; +extern const u32 gMonFrontPic_RaticateF[]; extern const u32 gMonFrontPic_Spearow[]; extern const u32 gMonFrontPic_Fearow[]; extern const u32 gMonFrontPic_Ekans[]; extern const u32 gMonFrontPic_Arbok[]; extern const u32 gMonFrontPic_Pikachu[]; +extern const u32 gMonFrontPic_PikachuF[]; extern const u32 gMonFrontPic_Raichu[]; +extern const u32 gMonFrontPic_RaichuF[]; extern const u32 gMonFrontPic_Sandshrew[]; extern const u32 gMonFrontPic_Sandslash[]; extern const u32 gMonFrontPic_NidoranF[]; @@ -108,10 +114,14 @@ extern const u32 gMonFrontPic_Ninetales[]; extern const u32 gMonFrontPic_Jigglypuff[]; extern const u32 gMonFrontPic_Wigglytuff[]; extern const u32 gMonFrontPic_Zubat[]; +extern const u32 gMonFrontPic_ZubatF[]; extern const u32 gMonFrontPic_Golbat[]; +extern const u32 gMonFrontPic_GolbatF[]; extern const u32 gMonFrontPic_Oddish[]; extern const u32 gMonFrontPic_Gloom[]; +extern const u32 gMonFrontPic_GloomF[]; extern const u32 gMonFrontPic_Vileplume[]; +extern const u32 gMonFrontPic_VileplumeF[]; extern const u32 gMonFrontPic_Paras[]; extern const u32 gMonFrontPic_Parasect[]; extern const u32 gMonFrontPic_Venonat[]; @@ -131,7 +141,9 @@ extern const u32 gMonFrontPic_Poliwhirl[]; extern const u32 gMonFrontPic_Poliwrath[]; extern const u32 gMonFrontPic_Abra[]; extern const u32 gMonFrontPic_Kadabra[]; +extern const u32 gMonFrontPic_KadabraF[]; extern const u32 gMonFrontPic_Alakazam[]; +extern const u32 gMonFrontPic_AlakazamF[]; extern const u32 gMonFrontPic_Machop[]; extern const u32 gMonFrontPic_Machoke[]; extern const u32 gMonFrontPic_Machamp[]; @@ -151,7 +163,9 @@ extern const u32 gMonFrontPic_Magnemite[]; extern const u32 gMonFrontPic_Magneton[]; extern const u32 gMonFrontPic_Farfetchd[]; extern const u32 gMonFrontPic_Doduo[]; +extern const u32 gMonFrontPic_DoduoF[]; extern const u32 gMonFrontPic_Dodrio[]; +extern const u32 gMonFrontPic_DodrioF[]; extern const u32 gMonFrontPic_Seel[]; extern const u32 gMonFrontPic_Dewgong[]; extern const u32 gMonFrontPic_Grimer[]; @@ -164,6 +178,7 @@ extern const u32 gMonFrontPic_Gengar[]; extern const u32 gMonFrontPic_Onix[]; extern const u32 gMonFrontPic_Drowzee[]; extern const u32 gMonFrontPic_Hypno[]; +extern const u32 gMonFrontPic_HypnoF[]; extern const u32 gMonFrontPic_Krabby[]; extern const u32 gMonFrontPic_Kingler[]; extern const u32 gMonFrontPic_Voltorb[]; @@ -178,25 +193,32 @@ extern const u32 gMonFrontPic_Lickitung[]; extern const u32 gMonFrontPic_Koffing[]; extern const u32 gMonFrontPic_Weezing[]; extern const u32 gMonFrontPic_Rhyhorn[]; +extern const u32 gMonFrontPic_RhyhornF[]; extern const u32 gMonFrontPic_Rhydon[]; +extern const u32 gMonFrontPic_RhydonF[]; extern const u32 gMonFrontPic_Chansey[]; extern const u32 gMonFrontPic_Tangela[]; extern const u32 gMonFrontPic_Kangaskhan[]; extern const u32 gMonFrontPic_Horsea[]; extern const u32 gMonFrontPic_Seadra[]; extern const u32 gMonFrontPic_Goldeen[]; +extern const u32 gMonFrontPic_GoldeenF[]; extern const u32 gMonFrontPic_Seaking[]; +extern const u32 gMonFrontPic_SeakingF[]; extern const u32 gMonFrontPic_Staryu[]; extern const u32 gMonFrontPic_Starmie[]; extern const u32 gMonFrontPic_MrMime[]; extern const u32 gMonFrontPic_Scyther[]; +extern const u32 gMonFrontPic_ScytherF[]; extern const u32 gMonFrontPic_Jynx[]; extern const u32 gMonFrontPic_Electabuzz[]; extern const u32 gMonFrontPic_Magmar[]; extern const u32 gMonFrontPic_Pinsir[]; extern const u32 gMonFrontPic_Tauros[]; extern const u32 gMonFrontPic_Magikarp[]; +extern const u32 gMonFrontPic_MagikarpF[]; extern const u32 gMonFrontPic_Gyarados[]; +extern const u32 gMonFrontPic_GyaradosF[]; extern const u32 gMonFrontPic_Lapras[]; extern const u32 gMonFrontPic_Ditto[]; extern const u32 gMonFrontPic_Eevee[]; @@ -222,6 +244,7 @@ extern const u32 gMonFrontPic_Mew[]; extern const u32 gMonFrontPic_Chikorita[]; extern const u32 gMonFrontPic_Bayleef[]; extern const u32 gMonFrontPic_Meganium[]; +extern const u32 gMonFrontPic_MeganiumF[]; extern const u32 gMonFrontPic_Cyndaquil[]; extern const u32 gMonFrontPic_Quilava[]; extern const u32 gMonFrontPic_Typhlosion[]; @@ -233,7 +256,9 @@ extern const u32 gMonFrontPic_Furret[]; extern const u32 gMonFrontPic_Hoothoot[]; extern const u32 gMonFrontPic_Noctowl[]; extern const u32 gMonFrontPic_Ledyba[]; +extern const u32 gMonFrontPic_LedybaF[]; extern const u32 gMonFrontPic_Ledian[]; +extern const u32 gMonFrontPic_LedianF[]; extern const u32 gMonFrontPic_Spinarak[]; extern const u32 gMonFrontPic_Ariados[]; extern const u32 gMonFrontPic_Crobat[]; @@ -246,6 +271,7 @@ extern const u32 gMonFrontPic_Togepi[]; extern const u32 gMonFrontPic_Togetic[]; extern const u32 gMonFrontPic_Natu[]; extern const u32 gMonFrontPic_Xatu[]; +extern const u32 gMonFrontPic_XatuF[]; extern const u32 gMonFrontPic_Mareep[]; extern const u32 gMonFrontPic_Flaaffy[]; extern const u32 gMonFrontPic_Ampharos[]; @@ -253,53 +279,71 @@ extern const u32 gMonFrontPic_Bellossom[]; extern const u32 gMonFrontPic_Marill[]; extern const u32 gMonFrontPic_Azumarill[]; extern const u32 gMonFrontPic_Sudowoodo[]; +extern const u32 gMonFrontPic_SudowoodoF[]; extern const u32 gMonFrontPic_Politoed[]; +extern const u32 gMonFrontPic_PolitoedF[]; extern const u32 gMonFrontPic_Hoppip[]; extern const u32 gMonFrontPic_Skiploom[]; extern const u32 gMonFrontPic_Jumpluff[]; extern const u32 gMonFrontPic_Aipom[]; +extern const u32 gMonFrontPic_AipomF[]; extern const u32 gMonFrontPic_Sunkern[]; extern const u32 gMonFrontPic_Sunflora[]; extern const u32 gMonFrontPic_Yanma[]; extern const u32 gMonFrontPic_Wooper[]; +extern const u32 gMonFrontPic_WooperF[]; extern const u32 gMonFrontPic_Quagsire[]; +extern const u32 gMonFrontPic_QuagsireF[]; extern const u32 gMonFrontPic_Espeon[]; extern const u32 gMonFrontPic_Umbreon[]; extern const u32 gMonFrontPic_Murkrow[]; +extern const u32 gMonFrontPic_MurkrowF[]; extern const u32 gMonFrontPic_Slowking[]; extern const u32 gMonFrontPic_Misdreavus[]; extern const u32 gMonFrontPic_Unown[]; extern const u32 gMonFrontPic_Wobbuffet[]; +extern const u32 gMonFrontPic_WobbuffetF[]; extern const u32 gMonFrontPic_Girafarig[]; +extern const u32 gMonFrontPic_GirafarigF[]; extern const u32 gMonFrontPic_Pineco[]; extern const u32 gMonFrontPic_Forretress[]; extern const u32 gMonFrontPic_Dunsparce[]; extern const u32 gMonFrontPic_Gligar[]; +extern const u32 gMonFrontPic_GligarF[]; extern const u32 gMonFrontPic_Steelix[]; +extern const u32 gMonFrontPic_SteelixF[]; extern const u32 gMonFrontPic_Snubbull[]; extern const u32 gMonFrontPic_Granbull[]; extern const u32 gMonFrontPic_Qwilfish[]; extern const u32 gMonFrontPic_Scizor[]; +extern const u32 gMonFrontPic_ScizorF[]; extern const u32 gMonFrontPic_Shuckle[]; extern const u32 gMonFrontPic_Heracross[]; +extern const u32 gMonFrontPic_HeracrossF[]; extern const u32 gMonFrontPic_Sneasel[]; +extern const u32 gMonFrontPic_SneaselF[]; extern const u32 gMonFrontPic_Teddiursa[]; extern const u32 gMonFrontPic_Ursaring[]; +extern const u32 gMonFrontPic_UrsaringF[]; extern const u32 gMonFrontPic_Slugma[]; extern const u32 gMonFrontPic_Magcargo[]; extern const u32 gMonFrontPic_Swinub[]; extern const u32 gMonFrontPic_Piloswine[]; +extern const u32 gMonFrontPic_PiloswineF[]; extern const u32 gMonFrontPic_Corsola[]; extern const u32 gMonFrontPic_Remoraid[]; extern const u32 gMonFrontPic_Octillery[]; +extern const u32 gMonFrontPic_OctilleryF[]; extern const u32 gMonFrontPic_Delibird[]; extern const u32 gMonFrontPic_Mantine[]; extern const u32 gMonFrontPic_Skarmory[]; extern const u32 gMonFrontPic_Houndour[]; extern const u32 gMonFrontPic_Houndoom[]; +extern const u32 gMonFrontPic_HoundoomF[]; extern const u32 gMonFrontPic_Kingdra[]; extern const u32 gMonFrontPic_Phanpy[]; extern const u32 gMonFrontPic_Donphan[]; +extern const u32 gMonFrontPic_DonphanF[]; extern const u32 gMonFrontPic_Porygon2[]; extern const u32 gMonFrontPic_Stantler[]; extern const u32 gMonFrontPic_Smeargle[]; @@ -324,7 +368,9 @@ extern const u32 gMonFrontPic_Grovyle[]; extern const u32 gMonFrontPic_Sceptile[]; extern const u32 gMonFrontPic_Torchic[]; extern const u32 gMonFrontPic_Combusken[]; +extern const u32 gMonFrontPic_CombuskenF[]; extern const u32 gMonFrontPic_Blaziken[]; +extern const u32 gMonFrontPic_BlazikenF[]; extern const u32 gMonFrontPic_Mudkip[]; extern const u32 gMonFrontPic_Marshtomp[]; extern const u32 gMonFrontPic_Swampert[]; @@ -335,14 +381,19 @@ extern const u32 gMonFrontPic_Linoone[]; extern const u32 gMonFrontPic_Wurmple[]; extern const u32 gMonFrontPic_Silcoon[]; extern const u32 gMonFrontPic_Beautifly[]; +extern const u32 gMonFrontPic_BeautiflyF[]; extern const u32 gMonFrontPic_Cascoon[]; extern const u32 gMonFrontPic_Dustox[]; +extern const u32 gMonFrontPic_DustoxF[]; extern const u32 gMonFrontPic_Lotad[]; extern const u32 gMonFrontPic_Lombre[]; extern const u32 gMonFrontPic_Ludicolo[]; +extern const u32 gMonFrontPic_LudicoloF[]; extern const u32 gMonFrontPic_Seedot[]; extern const u32 gMonFrontPic_Nuzleaf[]; +extern const u32 gMonFrontPic_NuzleafF[]; extern const u32 gMonFrontPic_Shiftry[]; +extern const u32 gMonFrontPic_ShiftryF[]; extern const u32 gMonFrontPic_Taillow[]; extern const u32 gMonFrontPic_Swellow[]; extern const u32 gMonFrontPic_Wingull[]; @@ -375,7 +426,9 @@ extern const u32 gMonFrontPic_Aron[]; extern const u32 gMonFrontPic_Lairon[]; extern const u32 gMonFrontPic_Aggron[]; extern const u32 gMonFrontPic_Meditite[]; +extern const u32 gMonFrontPic_MedititeF[]; extern const u32 gMonFrontPic_Medicham[]; +extern const u32 gMonFrontPic_MedichamF[]; extern const u32 gMonFrontPic_Electrike[]; extern const u32 gMonFrontPic_Manectric[]; extern const u32 gMonFrontPic_Plusle[]; @@ -383,14 +436,19 @@ extern const u32 gMonFrontPic_Minun[]; extern const u32 gMonFrontPic_Volbeat[]; extern const u32 gMonFrontPic_Illumise[]; extern const u32 gMonFrontPic_Roselia[]; +extern const u32 gMonFrontPic_RoseliaF[]; extern const u32 gMonFrontPic_Gulpin[]; +extern const u32 gMonFrontPic_GulpinF[]; extern const u32 gMonFrontPic_Swalot[]; +extern const u32 gMonFrontPic_SwalotF[]; extern const u32 gMonFrontPic_Carvanha[]; extern const u32 gMonFrontPic_Sharpedo[]; extern const u32 gMonFrontPic_Wailmer[]; extern const u32 gMonFrontPic_Wailord[]; extern const u32 gMonFrontPic_Numel[]; +extern const u32 gMonFrontPic_NumelF[]; extern const u32 gMonFrontPic_Camerupt[]; +extern const u32 gMonFrontPic_CameruptF[]; extern const u32 gMonFrontPic_Torkoal[]; extern const u32 gMonFrontPic_Spoink[]; extern const u32 gMonFrontPic_Grumpig[]; @@ -400,6 +458,7 @@ extern const u32 gMonFrontPic_Vibrava[]; extern const u32 gMonFrontPic_Flygon[]; extern const u32 gMonFrontPic_Cacnea[]; extern const u32 gMonFrontPic_Cacturne[]; +extern const u32 gMonFrontPic_CacturneF[]; extern const u32 gMonFrontPic_Swablu[]; extern const u32 gMonFrontPic_Altaria[]; extern const u32 gMonFrontPic_Zangoose[]; @@ -418,6 +477,7 @@ extern const u32 gMonFrontPic_Anorith[]; extern const u32 gMonFrontPic_Armaldo[]; extern const u32 gMonFrontPic_Feebas[]; extern const u32 gMonFrontPic_Milotic[]; +extern const u32 gMonFrontPic_MiloticF[]; extern const u32 gMonFrontPic_Castform[]; extern const u32 gMonFrontPic_Kecleon[]; extern const u32 gMonFrontPic_Shuppet[]; @@ -437,6 +497,7 @@ extern const u32 gMonFrontPic_Clamperl[]; extern const u32 gMonFrontPic_Huntail[]; extern const u32 gMonFrontPic_Gorebyss[]; extern const u32 gMonFrontPic_Relicanth[]; +extern const u32 gMonFrontPic_RelicanthF[]; extern const u32 gMonFrontPic_Luvdisc[]; extern const u32 gMonFrontPic_Bagon[]; extern const u32 gMonFrontPic_Shelgon[]; @@ -473,6 +534,7 @@ extern const u32 gMonFrontPic_StaraptorF[]; extern const u32 gMonFrontPic_Bidoof[]; extern const u32 gMonFrontPic_BidoofF[]; extern const u32 gMonFrontPic_Bibarel[]; +extern const u32 gMonFrontPic_BibarelF[]; extern const u32 gMonFrontPic_Kricketot[]; extern const u32 gMonFrontPic_KricketotF[]; extern const u32 gMonFrontPic_Kricketune[]; @@ -480,9 +542,12 @@ extern const u32 gMonFrontPic_KricketuneF[]; extern const u32 gMonFrontPic_Shinx[]; extern const u32 gMonFrontPic_ShinxF[]; extern const u32 gMonFrontPic_Luxio[]; +extern const u32 gMonFrontPic_LuxioF[]; extern const u32 gMonFrontPic_Luxray[]; +extern const u32 gMonFrontPic_LuxrayF[]; extern const u32 gMonFrontPic_Budew[]; extern const u32 gMonFrontPic_Roserade[]; +extern const u32 gMonFrontPic_RoseradeF[]; extern const u32 gMonFrontPic_Cranidos[]; extern const u32 gMonFrontPic_Rampardos[]; extern const u32 gMonFrontPic_Shieldon[]; @@ -493,6 +558,7 @@ extern const u32 gMonFrontPic_Mothim[]; extern const u32 gMonFrontPic_Combee[]; extern const u32 gMonFrontPic_Vespiquen[]; extern const u32 gMonFrontPic_Pachirisu[]; +extern const u32 gMonFrontPic_PachirisuF[]; extern const u32 gMonFrontPic_Buizel[]; extern const u32 gMonFrontPic_Floatzel[]; extern const u32 gMonFrontPic_Cherubi[]; @@ -500,6 +566,7 @@ extern const u32 gMonFrontPic_Cherrim[]; extern const u32 gMonFrontPic_Shellos[]; extern const u32 gMonFrontPic_Gastrodon[]; extern const u32 gMonFrontPic_Ambipom[]; +extern const u32 gMonFrontPic_AmbipomF[]; extern const u32 gMonFrontPic_Drifloon[]; extern const u32 gMonFrontPic_Drifblim[]; extern const u32 gMonFrontPic_Buneary[]; @@ -519,8 +586,11 @@ extern const u32 gMonFrontPic_Happiny[]; extern const u32 gMonFrontPic_Chatot[]; extern const u32 gMonFrontPic_Spiritomb[]; extern const u32 gMonFrontPic_Gible[]; +extern const u32 gMonFrontPic_GibleF[]; extern const u32 gMonFrontPic_Gabite[]; +extern const u32 gMonFrontPic_GabiteF[]; extern const u32 gMonFrontPic_Garchomp[]; +extern const u32 gMonFrontPic_GarchompF[]; extern const u32 gMonFrontPic_Munchlax[]; extern const u32 gMonFrontPic_Riolu[]; extern const u32 gMonFrontPic_Lucario[]; @@ -529,18 +599,27 @@ extern const u32 gMonFrontPic_Hippowdon[]; extern const u32 gMonFrontPic_Skorupi[]; extern const u32 gMonFrontPic_Drapion[]; extern const u32 gMonFrontPic_Croagunk[]; +extern const u32 gMonFrontPic_CroagunkF[]; extern const u32 gMonFrontPic_Toxicroak[]; +extern const u32 gMonFrontPic_ToxicroakF[]; extern const u32 gMonFrontPic_Carnivine[]; extern const u32 gMonFrontPic_Finneon[]; +extern const u32 gMonFrontPic_FinneonF[]; extern const u32 gMonFrontPic_Lumineon[]; +extern const u32 gMonFrontPic_LumineonF[]; extern const u32 gMonFrontPic_Mantyke[]; extern const u32 gMonFrontPic_Snover[]; +extern const u32 gMonFrontPic_SnoverF[]; extern const u32 gMonFrontPic_Abomasnow[]; +extern const u32 gMonFrontPic_AbomasnowF[]; extern const u32 gMonFrontPic_Weavile[]; +extern const u32 gMonFrontPic_WeavileF[]; extern const u32 gMonFrontPic_Magnezone[]; extern const u32 gMonFrontPic_Lickilicky[]; extern const u32 gMonFrontPic_Rhyperior[]; +extern const u32 gMonFrontPic_RhyperiorF[]; extern const u32 gMonFrontPic_Tangrowth[]; +extern const u32 gMonFrontPic_TangrowthF[]; extern const u32 gMonFrontPic_Electivire[]; extern const u32 gMonFrontPic_Magmortar[]; extern const u32 gMonFrontPic_Togekiss[]; @@ -549,6 +628,7 @@ extern const u32 gMonFrontPic_Leafeon[]; extern const u32 gMonFrontPic_Glaceon[]; extern const u32 gMonFrontPic_Gliscor[]; extern const u32 gMonFrontPic_Mamoswine[]; +extern const u32 gMonFrontPic_MamoswineF[]; extern const u32 gMonFrontPic_PorygonZ[]; extern const u32 gMonFrontPic_Gallade[]; extern const u32 gMonFrontPic_Probopass[]; @@ -1096,6 +1176,7 @@ extern const u32 gMonFrontPic_ElectrodeHisuian[]; extern const u32 gMonFrontPic_TyphlosionHisuian[]; extern const u32 gMonFrontPic_QwilfishHisuian[]; extern const u32 gMonFrontPic_SneaselHisuian[]; +extern const u32 gMonFrontPic_SneaselHisuianF[]; #if P_GEN_5_POKEMON == TRUE extern const u32 gMonFrontPic_SamurottHisuian[]; extern const u32 gMonFrontPic_LilligantHisuian[]; @@ -1285,6 +1366,7 @@ extern const u32 gMonBackPic_DoubleQuestionMark[]; extern const u32 gMonBackPic_Bulbasaur[]; extern const u32 gMonBackPic_Ivysaur[]; extern const u32 gMonBackPic_Venusaur[]; +extern const u32 gMonBackPic_VenusaurF[]; extern const u32 gMonBackPic_Charmander[]; extern const u32 gMonBackPic_Charmeleon[]; extern const u32 gMonBackPic_Charizard[]; @@ -1294,6 +1376,7 @@ extern const u32 gMonBackPic_Blastoise[]; extern const u32 gMonBackPic_Caterpie[]; extern const u32 gMonBackPic_Metapod[]; extern const u32 gMonBackPic_Butterfree[]; +extern const u32 gMonBackPic_ButterfreeF[]; extern const u32 gMonBackPic_Weedle[]; extern const u32 gMonBackPic_Kakuna[]; extern const u32 gMonBackPic_Beedrill[]; @@ -1301,12 +1384,15 @@ extern const u32 gMonBackPic_Pidgey[]; extern const u32 gMonBackPic_Pidgeotto[]; extern const u32 gMonBackPic_Pidgeot[]; extern const u32 gMonBackPic_Rattata[]; +extern const u32 gMonBackPic_RattataF[]; extern const u32 gMonBackPic_Raticate[]; +extern const u32 gMonBackPic_RaticateF[]; extern const u32 gMonBackPic_Spearow[]; extern const u32 gMonBackPic_Fearow[]; extern const u32 gMonBackPic_Ekans[]; extern const u32 gMonBackPic_Arbok[]; extern const u32 gMonBackPic_Pikachu[]; +extern const u32 gMonBackPic_PikachuF[]; extern const u32 gMonBackPic_Raichu[]; extern const u32 gMonBackPic_Sandshrew[]; extern const u32 gMonBackPic_Sandslash[]; @@ -1323,10 +1409,14 @@ extern const u32 gMonBackPic_Ninetales[]; extern const u32 gMonBackPic_Jigglypuff[]; extern const u32 gMonBackPic_Wigglytuff[]; extern const u32 gMonBackPic_Zubat[]; +extern const u32 gMonBackPic_ZubatF[]; extern const u32 gMonBackPic_Golbat[]; +extern const u32 gMonBackPic_GolbatF[]; extern const u32 gMonBackPic_Oddish[]; extern const u32 gMonBackPic_Gloom[]; +extern const u32 gMonBackPic_GloomF[]; extern const u32 gMonBackPic_Vileplume[]; +extern const u32 gMonBackPic_VileplumeF[]; extern const u32 gMonBackPic_Paras[]; extern const u32 gMonBackPic_Parasect[]; extern const u32 gMonBackPic_Venonat[]; @@ -1346,7 +1436,9 @@ extern const u32 gMonBackPic_Poliwhirl[]; extern const u32 gMonBackPic_Poliwrath[]; extern const u32 gMonBackPic_Abra[]; extern const u32 gMonBackPic_Kadabra[]; +extern const u32 gMonBackPic_KadabraF[]; extern const u32 gMonBackPic_Alakazam[]; +extern const u32 gMonBackPic_AlakazamF[]; extern const u32 gMonBackPic_Machop[]; extern const u32 gMonBackPic_Machoke[]; extern const u32 gMonBackPic_Machamp[]; @@ -1366,7 +1458,9 @@ extern const u32 gMonBackPic_Magnemite[]; extern const u32 gMonBackPic_Magneton[]; extern const u32 gMonBackPic_Farfetchd[]; extern const u32 gMonBackPic_Doduo[]; +extern const u32 gMonBackPic_DoduoF[]; extern const u32 gMonBackPic_Dodrio[]; +extern const u32 gMonBackPic_DodrioF[]; extern const u32 gMonBackPic_Seel[]; extern const u32 gMonBackPic_Dewgong[]; extern const u32 gMonBackPic_Grimer[]; @@ -1379,6 +1473,7 @@ extern const u32 gMonBackPic_Gengar[]; extern const u32 gMonBackPic_Onix[]; extern const u32 gMonBackPic_Drowzee[]; extern const u32 gMonBackPic_Hypno[]; +extern const u32 gMonBackPic_HypnoF[]; extern const u32 gMonBackPic_Krabby[]; extern const u32 gMonBackPic_Kingler[]; extern const u32 gMonBackPic_Voltorb[]; @@ -1393,14 +1488,18 @@ extern const u32 gMonBackPic_Lickitung[]; extern const u32 gMonBackPic_Koffing[]; extern const u32 gMonBackPic_Weezing[]; extern const u32 gMonBackPic_Rhyhorn[]; +extern const u32 gMonBackPic_RhyhornF[]; extern const u32 gMonBackPic_Rhydon[]; +extern const u32 gMonBackPic_RhydonF[]; extern const u32 gMonBackPic_Chansey[]; extern const u32 gMonBackPic_Tangela[]; extern const u32 gMonBackPic_Kangaskhan[]; extern const u32 gMonBackPic_Horsea[]; extern const u32 gMonBackPic_Seadra[]; extern const u32 gMonBackPic_Goldeen[]; +extern const u32 gMonBackPic_GoldeenF[]; extern const u32 gMonBackPic_Seaking[]; +extern const u32 gMonBackPic_SeakingF[]; extern const u32 gMonBackPic_Staryu[]; extern const u32 gMonBackPic_Starmie[]; extern const u32 gMonBackPic_MrMime[]; @@ -1411,7 +1510,9 @@ extern const u32 gMonBackPic_Magmar[]; extern const u32 gMonBackPic_Pinsir[]; extern const u32 gMonBackPic_Tauros[]; extern const u32 gMonBackPic_Magikarp[]; +extern const u32 gMonBackPic_MagikarpF[]; extern const u32 gMonBackPic_Gyarados[]; +extern const u32 gMonBackPic_GyaradosF[]; extern const u32 gMonBackPic_Lapras[]; extern const u32 gMonBackPic_Ditto[]; extern const u32 gMonBackPic_Eevee[]; @@ -1437,6 +1538,7 @@ extern const u32 gMonBackPic_Mew[]; extern const u32 gMonBackPic_Chikorita[]; extern const u32 gMonBackPic_Bayleef[]; extern const u32 gMonBackPic_Meganium[]; +extern const u32 gMonBackPic_MeganiumF[]; extern const u32 gMonBackPic_Cyndaquil[]; extern const u32 gMonBackPic_Quilava[]; extern const u32 gMonBackPic_Typhlosion[]; @@ -1448,7 +1550,9 @@ extern const u32 gMonBackPic_Furret[]; extern const u32 gMonBackPic_Hoothoot[]; extern const u32 gMonBackPic_Noctowl[]; extern const u32 gMonBackPic_Ledyba[]; +extern const u32 gMonBackPic_LedybaF[]; extern const u32 gMonBackPic_Ledian[]; +extern const u32 gMonBackPic_LedianF[]; extern const u32 gMonBackPic_Spinarak[]; extern const u32 gMonBackPic_Ariados[]; extern const u32 gMonBackPic_Crobat[]; @@ -1468,53 +1572,70 @@ extern const u32 gMonBackPic_Bellossom[]; extern const u32 gMonBackPic_Marill[]; extern const u32 gMonBackPic_Azumarill[]; extern const u32 gMonBackPic_Sudowoodo[]; +extern const u32 gMonBackPic_SudowoodoF[]; extern const u32 gMonBackPic_Politoed[]; +extern const u32 gMonBackPic_PolitoedF[]; extern const u32 gMonBackPic_Hoppip[]; extern const u32 gMonBackPic_Skiploom[]; extern const u32 gMonBackPic_Jumpluff[]; extern const u32 gMonBackPic_Aipom[]; +extern const u32 gMonBackPic_AipomF[]; extern const u32 gMonBackPic_Sunkern[]; extern const u32 gMonBackPic_Sunflora[]; extern const u32 gMonBackPic_Yanma[]; extern const u32 gMonBackPic_Wooper[]; +extern const u32 gMonBackPic_WooperF[]; extern const u32 gMonBackPic_Quagsire[]; +extern const u32 gMonBackPic_QuagsireF[]; extern const u32 gMonBackPic_Espeon[]; extern const u32 gMonBackPic_Umbreon[]; extern const u32 gMonBackPic_Murkrow[]; +extern const u32 gMonBackPic_MurkrowF[]; extern const u32 gMonBackPic_Slowking[]; extern const u32 gMonBackPic_Misdreavus[]; extern const u32 gMonBackPic_Unown[]; extern const u32 gMonBackPic_Wobbuffet[]; +extern const u32 gMonBackPic_WobbuffetF[]; extern const u32 gMonBackPic_Girafarig[]; +extern const u32 gMonBackPic_GirafarigF[]; extern const u32 gMonBackPic_Pineco[]; extern const u32 gMonBackPic_Forretress[]; extern const u32 gMonBackPic_Dunsparce[]; extern const u32 gMonBackPic_Gligar[]; +extern const u32 gMonBackPic_GligarF[]; extern const u32 gMonBackPic_Steelix[]; +extern const u32 gMonBackPic_SteelixF[]; extern const u32 gMonBackPic_Snubbull[]; extern const u32 gMonBackPic_Granbull[]; extern const u32 gMonBackPic_Qwilfish[]; extern const u32 gMonBackPic_Scizor[]; extern const u32 gMonBackPic_Shuckle[]; extern const u32 gMonBackPic_Heracross[]; +extern const u32 gMonBackPic_HeracrossF[]; extern const u32 gMonBackPic_Sneasel[]; +extern const u32 gMonBackPic_SneaselF[]; extern const u32 gMonBackPic_Teddiursa[]; extern const u32 gMonBackPic_Ursaring[]; +extern const u32 gMonBackPic_UrsaringF[]; extern const u32 gMonBackPic_Slugma[]; extern const u32 gMonBackPic_Magcargo[]; extern const u32 gMonBackPic_Swinub[]; extern const u32 gMonBackPic_Piloswine[]; +extern const u32 gMonBackPic_PiloswineF[]; extern const u32 gMonBackPic_Corsola[]; extern const u32 gMonBackPic_Remoraid[]; extern const u32 gMonBackPic_Octillery[]; +extern const u32 gMonBackPic_OctilleryF[]; extern const u32 gMonBackPic_Delibird[]; extern const u32 gMonBackPic_Mantine[]; extern const u32 gMonBackPic_Skarmory[]; extern const u32 gMonBackPic_Houndour[]; extern const u32 gMonBackPic_Houndoom[]; +extern const u32 gMonBackPic_HoundoomF[]; extern const u32 gMonBackPic_Kingdra[]; extern const u32 gMonBackPic_Phanpy[]; extern const u32 gMonBackPic_Donphan[]; +extern const u32 gMonBackPic_DonphanF[]; extern const u32 gMonBackPic_Porygon2[]; extern const u32 gMonBackPic_Stantler[]; extern const u32 gMonBackPic_Smeargle[]; @@ -1538,8 +1659,11 @@ extern const u32 gMonBackPic_Treecko[]; extern const u32 gMonBackPic_Grovyle[]; extern const u32 gMonBackPic_Sceptile[]; extern const u32 gMonBackPic_Torchic[]; +extern const u32 gMonBackPic_TorchicF[]; extern const u32 gMonBackPic_Combusken[]; +extern const u32 gMonBackPic_CombuskenF[]; extern const u32 gMonBackPic_Blaziken[]; +extern const u32 gMonBackPic_BlazikenF[]; extern const u32 gMonBackPic_Mudkip[]; extern const u32 gMonBackPic_Marshtomp[]; extern const u32 gMonBackPic_Swampert[]; @@ -1550,14 +1674,19 @@ extern const u32 gMonBackPic_Linoone[]; extern const u32 gMonBackPic_Wurmple[]; extern const u32 gMonBackPic_Silcoon[]; extern const u32 gMonBackPic_Beautifly[]; +extern const u32 gMonBackPic_BeautiflyF[]; extern const u32 gMonBackPic_Cascoon[]; extern const u32 gMonBackPic_Dustox[]; +extern const u32 gMonBackPic_DustoxF[]; extern const u32 gMonBackPic_Lotad[]; extern const u32 gMonBackPic_Lombre[]; extern const u32 gMonBackPic_Ludicolo[]; +extern const u32 gMonBackPic_LudicoloF[]; extern const u32 gMonBackPic_Seedot[]; extern const u32 gMonBackPic_Nuzleaf[]; +extern const u32 gMonBackPic_NuzleafF[]; extern const u32 gMonBackPic_Shiftry[]; +extern const u32 gMonBackPic_ShiftryF[]; extern const u32 gMonBackPic_Taillow[]; extern const u32 gMonBackPic_Swellow[]; extern const u32 gMonBackPic_Wingull[]; @@ -1590,7 +1719,9 @@ extern const u32 gMonBackPic_Aron[]; extern const u32 gMonBackPic_Lairon[]; extern const u32 gMonBackPic_Aggron[]; extern const u32 gMonBackPic_Meditite[]; +extern const u32 gMonBackPic_MedititeF[]; extern const u32 gMonBackPic_Medicham[]; +extern const u32 gMonBackPic_MedichamF[]; extern const u32 gMonBackPic_Electrike[]; extern const u32 gMonBackPic_Manectric[]; extern const u32 gMonBackPic_Plusle[]; @@ -1598,14 +1729,19 @@ extern const u32 gMonBackPic_Minun[]; extern const u32 gMonBackPic_Volbeat[]; extern const u32 gMonBackPic_Illumise[]; extern const u32 gMonBackPic_Roselia[]; +extern const u32 gMonBackPic_RoseliaF[]; extern const u32 gMonBackPic_Gulpin[]; +extern const u32 gMonBackPic_GulpinF[]; extern const u32 gMonBackPic_Swalot[]; +extern const u32 gMonBackPic_SwalotF[]; extern const u32 gMonBackPic_Carvanha[]; extern const u32 gMonBackPic_Sharpedo[]; extern const u32 gMonBackPic_Wailmer[]; extern const u32 gMonBackPic_Wailord[]; extern const u32 gMonBackPic_Numel[]; +extern const u32 gMonBackPic_NumelF[]; extern const u32 gMonBackPic_Camerupt[]; +extern const u32 gMonBackPic_CameruptF[]; extern const u32 gMonBackPic_Torkoal[]; extern const u32 gMonBackPic_Spoink[]; extern const u32 gMonBackPic_Grumpig[]; @@ -1633,6 +1769,7 @@ extern const u32 gMonBackPic_Anorith[]; extern const u32 gMonBackPic_Armaldo[]; extern const u32 gMonBackPic_Feebas[]; extern const u32 gMonBackPic_Milotic[]; +extern const u32 gMonBackPic_MiloticF[]; extern const u32 gMonBackPic_Castform[]; extern const u32 gMonBackPic_Kecleon[]; extern const u32 gMonBackPic_Shuppet[]; @@ -1652,6 +1789,7 @@ extern const u32 gMonBackPic_Clamperl[]; extern const u32 gMonBackPic_Huntail[]; extern const u32 gMonBackPic_Gorebyss[]; extern const u32 gMonBackPic_Relicanth[]; +extern const u32 gMonBackPic_RelicanthF[]; extern const u32 gMonBackPic_Luvdisc[]; extern const u32 gMonBackPic_Bagon[]; extern const u32 gMonBackPic_Shelgon[]; @@ -1694,9 +1832,12 @@ extern const u32 gMonBackPic_KricketuneF[]; extern const u32 gMonBackPic_Shinx[]; extern const u32 gMonBackPic_ShinxF[]; extern const u32 gMonBackPic_Luxio[]; +extern const u32 gMonBackPic_LuxioF[]; extern const u32 gMonBackPic_Luxray[]; +extern const u32 gMonBackPic_LuxrayF[]; extern const u32 gMonBackPic_Budew[]; extern const u32 gMonBackPic_Roserade[]; +extern const u32 gMonBackPic_RoseradeF[]; extern const u32 gMonBackPic_Cranidos[]; extern const u32 gMonBackPic_Rampardos[]; extern const u32 gMonBackPic_Shieldon[]; @@ -1708,12 +1849,15 @@ extern const u32 gMonBackPic_Combee[]; extern const u32 gMonBackPic_Vespiquen[]; extern const u32 gMonBackPic_Pachirisu[]; extern const u32 gMonBackPic_Buizel[]; +extern const u32 gMonBackPic_BuizelF[]; extern const u32 gMonBackPic_Floatzel[]; +extern const u32 gMonBackPic_FloatzelF[]; extern const u32 gMonBackPic_Cherubi[]; extern const u32 gMonBackPic_Cherrim[]; extern const u32 gMonBackPic_Shellos[]; extern const u32 gMonBackPic_Gastrodon[]; extern const u32 gMonBackPic_Ambipom[]; +extern const u32 gMonBackPic_AmbipomF[]; extern const u32 gMonBackPic_Drifloon[]; extern const u32 gMonBackPic_Drifblim[]; extern const u32 gMonBackPic_Buneary[]; @@ -1733,7 +1877,9 @@ extern const u32 gMonBackPic_Happiny[]; extern const u32 gMonBackPic_Chatot[]; extern const u32 gMonBackPic_Spiritomb[]; extern const u32 gMonBackPic_Gible[]; +extern const u32 gMonBackPic_GibleF[]; extern const u32 gMonBackPic_Gabite[]; +extern const u32 gMonBackPic_GabiteF[]; extern const u32 gMonBackPic_Garchomp[]; extern const u32 gMonBackPic_Munchlax[]; extern const u32 gMonBackPic_Riolu[]; @@ -1743,17 +1889,24 @@ extern const u32 gMonBackPic_Hippowdon[]; extern const u32 gMonBackPic_Skorupi[]; extern const u32 gMonBackPic_Drapion[]; extern const u32 gMonBackPic_Croagunk[]; +extern const u32 gMonBackPic_CroagunkF[]; extern const u32 gMonBackPic_Toxicroak[]; +extern const u32 gMonBackPic_ToxicroakF[]; extern const u32 gMonBackPic_Carnivine[]; extern const u32 gMonBackPic_Finneon[]; +extern const u32 gMonBackPic_FinneonF[]; extern const u32 gMonBackPic_Lumineon[]; +extern const u32 gMonBackPic_LumineonF[]; extern const u32 gMonBackPic_Mantyke[]; extern const u32 gMonBackPic_Snover[]; +extern const u32 gMonBackPic_SnoverF[]; extern const u32 gMonBackPic_Abomasnow[]; extern const u32 gMonBackPic_Weavile[]; +extern const u32 gMonBackPic_WeavileF[]; extern const u32 gMonBackPic_Magnezone[]; extern const u32 gMonBackPic_Lickilicky[]; extern const u32 gMonBackPic_Rhyperior[]; +extern const u32 gMonBackPic_RhyperiorF[]; extern const u32 gMonBackPic_Tangrowth[]; extern const u32 gMonBackPic_Electivire[]; extern const u32 gMonBackPic_Magmortar[]; @@ -2310,6 +2463,7 @@ extern const u32 gMonBackPic_ElectrodeHisuian[]; extern const u32 gMonBackPic_TyphlosionHisuian[]; extern const u32 gMonBackPic_QwilfishHisuian[]; extern const u32 gMonBackPic_SneaselHisuian[]; +extern const u32 gMonBackPic_SneaselHisuianF[]; #if P_GEN_5_POKEMON == TRUE extern const u32 gMonBackPic_SamurottHisuian[]; extern const u32 gMonBackPic_LilligantHisuian[]; @@ -7406,9 +7560,9 @@ extern const u16 gWallClockFemale_Pal[]; extern const u32 gWallClockStart_Tilemap[]; extern const u32 gWallClockView_Tilemap[]; -extern const u32 gBerryFixGameboy_Gfx[]; -extern const u32 gBerryFixGameboy_Tilemap[]; -extern const u16 gBerryFixGameboy_Pal[]; +extern const u32 gBerryFixGbaConnect_Gfx[]; +extern const u32 gBerryFixGbaConnect_Tilemap[]; +extern const u16 gBerryFixGbaConnect_Pal[]; extern const u32 gBerryFixGameboyLogo_Gfx[]; extern const u32 gBerryFixGameboyLogo_Tilemap[]; extern const u16 gBerryFixGameboyLogo_Pal[]; @@ -8843,6 +8997,8 @@ extern const u32 gItemIconPalette_Sapphire[]; // GEN IX ITEMS extern const u32 gItemIcon_AbilityShield[]; extern const u32 gItemIconPalette_AbilityShield[]; +extern const u32 gItemIcon_ClearAmulet[]; +extern const u32 gItemIconPalette_ClearAmulet[]; extern const u32 gItemIcon_AuspiciousArmor[]; extern const u32 gItemIconPalette_AuspiciousArmor[]; extern const u32 gItemIcon_BigBambooShoot[]; @@ -8872,6 +9028,27 @@ extern const u32 gItemIconPalette_TeraOrb[]; extern const u32 gItemIcon_TinyBambooShoot[]; extern const u32 gItemIconPalette_TinyBambooShoot[]; +// Tera Shards +extern const u32 gItemIcon_TeraShard[]; +extern const u32 gItemIconPalette_NormalTeraShard[]; +extern const u32 gItemIconPalette_FireTeraShard[]; +extern const u32 gItemIconPalette_WaterTeraShard[]; +extern const u32 gItemIconPalette_GrassTeraShard[]; +extern const u32 gItemIconPalette_ElectricTeraShard[]; +extern const u32 gItemIconPalette_IceTeraShard[]; +extern const u32 gItemIconPalette_FightingTeraShard[]; +extern const u32 gItemIconPalette_PoisonTeraShard[]; +extern const u32 gItemIconPalette_GroundTeraShard[]; +extern const u32 gItemIconPalette_FlyingTeraShard[]; +extern const u32 gItemIconPalette_PsychicTeraShard[]; +extern const u32 gItemIconPalette_BugTeraShard[]; +extern const u32 gItemIconPalette_RockTeraShard[]; +extern const u32 gItemIconPalette_GhostTeraShard[]; +extern const u32 gItemIconPalette_DarkTeraShard[]; +extern const u32 gItemIconPalette_DragonTeraShard[]; +extern const u32 gItemIconPalette_SteelTeraShard[]; +extern const u32 gItemIconPalette_FairyTeraShard[]; + extern const u32 gItemIcon_AdamantCrystal[]; extern const u32 gItemIconPalette_AdamantCrystal[]; extern const u32 gItemIcon_GriseousCore[]; @@ -9166,9 +9343,9 @@ extern const u32 gConfetti_Gfx[]; extern const u32 gConfetti_Pal[]; extern const u32 gBattleInterfaceGfx_BattleBar[]; -extern const u32 gSubstituteDollBackGfx[]; -extern const u32 gSubstituteDollFrontGfx[]; -extern const u32 gSubstituteDollPal[]; +extern const u32 gBattleAnimSpriteGfx_Substitute[]; +extern const u32 gBattleAnimSpriteGfx_SubstituteBack[]; +extern const u32 gBattleAnimSpritePal_Substitute[]; extern const u32 gHealthboxSinglesPlayerGfx[]; extern const u32 gHealthboxSinglesOpponentGfx[]; extern const u32 gHealthboxDoublesPlayerGfx[]; @@ -9989,9 +10166,6 @@ extern const u32 gBattleAnimSpritePal_StonePillar[]; extern const u32 gBattleAnimSpriteGfx_StraightBeam[]; extern const u32 gBattleAnimSpritePal_StraightBeam[]; extern const u32 gBattleAnimSpritePal_Poltergeist[]; -extern const u32 gBattleAnimSpriteGfx_SubstituteBack[]; -extern const u32 gBattleAnimSpriteGfx_SubstituteFront[]; -extern const u32 gBattleAnimSpritePal_SubstituteFront[]; extern const u32 gBattleAnimSpritePal_NewSurf[]; extern const u32 gBattleAnimSpriteGfx_NewSword[]; extern const u32 gBattleAnimSpritePal_NewSword[]; @@ -10005,6 +10179,8 @@ extern const u32 gBattleAnimSpriteGfx_ZMoveSymbol[]; extern const u32 gBattleAnimSpritePal_ZMoveSymbol[]; extern const u32 gBattleAnimSpriteGfx_Teapot[]; extern const u32 gBattleAnimSpritePal_Teapot[]; +extern const u32 gBattleAnimSpriteGfx_WoodHammerHammer[]; +extern const u32 gBattleAnimSpritePal_WoodHammerHammer[]; extern const u32 gBattleAnimBgImage_Dark[]; extern const u32 gBattleAnimBgImage_Ghost[]; @@ -10111,6 +10287,7 @@ extern const u32 gBattleAnimBgPalette_GunkShot[]; extern const u32 gBattleAnimBgImage_HydroCannon[]; extern const u32 gBattleAnimBgPalette_HydroCannon[]; extern const u32 gBattleAnimBgTilemap_HydroCannon[]; +extern const u32 gBattleAnimBgPalette_Chloroblast[]; extern const u32 gBattleAnimBgImage_HydroPump[]; extern const u32 gBattleAnimBgPalette_HydroPump[]; extern const u32 gBattleAnimBgTilemap_HydroPump[]; @@ -10183,17 +10360,18 @@ extern const u32 gMetalShineTilemap[]; extern const u32 gBattleAnimMaskImage_Curse[]; extern const u32 gBattleAnimMaskTilemap_Curse[]; -extern const u32 gBattleStatMask_Gfx[]; -extern const u32 gBattleStatMask1_Tilemap[]; -extern const u32 gBattleStatMask2_Tilemap[]; -extern const u32 gBattleStatMask1_Pal[]; -extern const u32 gBattleStatMask2_Pal[]; -extern const u32 gBattleStatMask3_Pal[]; -extern const u32 gBattleStatMask4_Pal[]; -extern const u32 gBattleStatMask5_Pal[]; -extern const u32 gBattleStatMask6_Pal[]; -extern const u32 gBattleStatMask7_Pal[]; -extern const u32 gBattleStatMask8_Pal[]; + +extern const u32 gStatAnim_Gfx[]; +extern const u32 gStatAnim_Increase_Tilemap[]; +extern const u32 gStatAnim_Decrease_Tilemap[]; +extern const u32 gStatAnim_Defense_Pal[]; +extern const u32 gStatAnim_Attack_Pal[]; +extern const u32 gStatAnim_Accuracy_Pal[]; +extern const u32 gStatAnim_Speed_Pal[]; +extern const u32 gStatAnim_Multiple_Pal[]; +extern const u32 gStatAnim_Evasion_Pal[]; +extern const u32 gStatAnim_SpAttack_Pal[]; +extern const u32 gStatAnim_SpDefense_Pal[]; extern const u32 gContestInterfaceGfx[]; extern const u32 gContestAudienceGfx[]; @@ -10432,9 +10610,9 @@ extern const u32 gPokenavOptions_Gfx[]; extern const u16 gPokenavOptions_Pal[]; // Battle Factory Screen -extern const u16 gFrontierFactorySelectMenu_Gfx[]; -extern const u16 gFrontierFactorySelectMenu_Tilemap[]; -extern const u16 gFrontierFactorySelectMenu_Pal[]; +extern const u16 gFrontierFactoryMenu_Gfx[34 * TILE_SIZE_4BPP / 2]; +extern const u16 gFrontierFactoryMenu_Tilemap[]; +extern const u16 gFrontierFactoryMenu_Pal[]; // Object event pals extern const u16 gObjectEventPal_Brendan[]; diff --git a/include/item.h b/include/item.h index a99782f80376..d130500c0747 100644 --- a/include/item.h +++ b/include/item.h @@ -2,24 +2,24 @@ #define GUARD_ITEM_H #include "constants/item.h" +#include "constants/items.h" +#include "constants/tms_hms.h" typedef void (*ItemUseFunc)(u8); struct Item { u8 name[ITEM_NAME_LENGTH]; - u16 itemId; u16 price; u8 holdEffect; u8 holdEffectParam; const u8 *description; u8 importance; - bool8 registrability; // unused u8 pocket; u8 type; ItemUseFunc fieldUseFunc; u8 battleUsage; - u8 secondaryId; + u16 secondaryId; u8 flingPower; }; @@ -63,8 +63,8 @@ bool8 AddPyramidBagItem(u16 itemId, u16 count); bool8 RemovePyramidBagItem(u16 itemId, u16 count); const u8 *ItemId_GetName(u16 itemId); u16 ItemId_GetPrice(u16 itemId); -u8 ItemId_GetHoldEffect(u16 itemId); -u8 ItemId_GetHoldEffectParam(u16 itemId); +u32 ItemId_GetHoldEffect(u32 itemId); +u32 ItemId_GetHoldEffectParam(u32 itemId); const u8 *ItemId_GetDescription(u16 itemId); u8 ItemId_GetImportance(u16 itemId); u8 ItemId_GetPocket(u16 itemId); @@ -72,8 +72,29 @@ u8 ItemId_GetType(u16 itemId); ItemUseFunc ItemId_GetFieldFunc(u16 itemId); u8 ItemId_GetBattleUsage(u16 itemId); u8 ItemId_GetSecondaryId(u16 itemId); -u8 ItemId_GetFlingPower(u16 itemId); +u32 ItemId_GetFlingPower(u32 itemId); u32 GetItemStatus1Mask(u16 itemId); u32 GetItemStatus2Mask(u16 itemId); +/* Expands to: + * enum + * { + * ITEM_TM_FOCUS_PUNCH, + * ... + * ITEM_HM_CUT, + * ... + * }; */ +#define ENUM_TM(id) CAT(ITEM_TM_, id), +#define ENUM_HM(id) CAT(ITEM_HM_, id), +enum +{ + ENUM_TM_START_ = ITEM_TM01 - 1, + FOREACH_TM(ENUM_TM) + + ENUM_HM_START_ = ITEM_HM01 - 1, + FOREACH_HM(ENUM_HM) +}; +#undef ENUM_TM +#undef ENUM_HM + #endif // GUARD_ITEM_H diff --git a/include/item_use.h b/include/item_use.h index afa87c69732c..6b3d0c590e22 100644 --- a/include/item_use.h +++ b/include/item_use.h @@ -30,6 +30,7 @@ void ItemUseOutOfBattle_FormChange(u8); void ItemUseOutOfBattle_FormChange_ConsumedOnUse(u8); void ItemUseOutOfBattle_Honey(u8); void ItemUseOutOfBattle_CannotUse(u8); +void ItemUseOutOfBattle_ExpShare(u8); void ItemUseInBattle_BagMenu(u8 taskId); void ItemUseInBattle_PartyMenu(u8 taskId); void ItemUseInBattle_PartyMenuChooseMove(u8 taskId); diff --git a/include/overworld.h b/include/overworld.h index adaa6aad04fc..bda2046ec70d 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -67,7 +67,7 @@ void LoadObjEventTemplatesFromHeader(void); void LoadSaveblockObjEventScripts(void); void SetObjEventTemplateCoords(u8 localId, s16 x, s16 y); void SetObjEventTemplateMovementType(u8 localId, u8 movementType); -const struct MapLayout *GetMapLayout(void); +const struct MapLayout *GetMapLayout(u16 mapLayoutId); void ApplyCurrentWarp(void); struct MapHeader const *const Overworld_GetMapHeaderByGroupAndId(u16 mapGroup, u16 mapNum); struct MapHeader const *const GetDestinationWarpMapHeader(void); diff --git a/include/party_menu.h b/include/party_menu.h index 31e591074844..38139cc9622b 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -57,7 +57,6 @@ void ItemUseCB_ReduceEV(u8 taskId, TaskFunc task); void ItemUseCB_PPRecovery(u8 taskId, TaskFunc task); void ItemUseCB_PPUp(u8 taskId, TaskFunc task); u16 ItemIdToBattleMoveId(u16 item); -bool8 IsMoveHm(u16 move); bool8 MonKnowsMove(struct Pokemon *mon, u16 move); bool8 BoxMonKnowsMove(struct BoxPokemon *boxMon, u16 move); void ItemUseCB_TMHM(u8 taskId, TaskFunc task); diff --git a/include/pokeball.h b/include/pokeball.h index 602e9f973638..498fa4dd1c70 100644 --- a/include/pokeball.h +++ b/include/pokeball.h @@ -48,7 +48,7 @@ extern const struct SpriteTemplate gBallSpriteTemplates[]; #define POKEBALL_PLAYER_SENDOUT 0xFF #define POKEBALL_OPPONENT_SENDOUT 0xFE -u8 DoPokeballSendOutAnimation(s16 pan, u8 kindOfThrow); +u8 DoPokeballSendOutAnimation(u32 battler, s16 pan, u8 kindOfThrow); void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 monPalNum, u8 x, u8 y, u8 oamPriority, u8 subpriority, u8 delay, u32 fadePalettes, u16 species); u8 CreateTradePokeballSprite(u8 monSpriteId, u8 monPalNum, u8 x, u8 y, u8 oamPriority, u8 subPriority, u8 delay, u32 fadePalettes); void StartHealthboxSlideIn(u8 battler); diff --git a/include/pokemon.h b/include/pokemon.h index c62cbe132524..526103e58a3a 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -210,7 +210,8 @@ struct BoxPokemon u8 isBadEgg:1; u8 hasSpecies:1; u8 isEgg:1; - u8 unused:5; + u8 blockBoxRS:1; // Unused, but Pokémon Box Ruby & Sapphire will refuse to deposit a Pokémon with this flag set + u8 unused:4; u8 otName[PLAYER_NAME_LENGTH]; u8 markings; u16 checksum; @@ -337,17 +338,53 @@ struct SpeciesInfo /*0x24*/ struct BattleMove { u16 effect; - u16 power; //higher than 255 for z moves + u8 power; u8 type; u8 accuracy; u8 pp; u8 secondaryEffectChance; u16 target; s8 priority; - u32 flags; u8 split; u16 argument; u8 zMoveEffect; + // Flags + u32 makesContact:1; + u32 ignoresProtect:1; + u32 magicCoatAffected:1; + u32 snatchAffected:1; + u32 mirrorMoveBanned:1; + u32 ignoresKingsRock:1; + u32 highCritRatio:1; + u32 punchingMove:1; + u32 sheerForceBoost:1; + u32 bitingMove:1; + u32 pulseMove:1; + u32 soundMove:1; + u32 ballisticMove:1; + u32 protectionMove:1; + u32 powderMove:1; + u32 danceMove:1; + u32 windMove:1; + u32 slicingMove:1; + u32 minimizeDoubleDamage:1; + u32 ignoresTargetAbility:1; + u32 ignoresTargetDefenseEvasionStages:1; + u32 damagesUnderground:1; + u32 damagesUnderwater:1; + u32 damagesAirborne:1; + u32 damagesAirborneDoubleDamage:1; + u32 ignoreTypeIfFlyingAndUngrounded:1; + u32 thawsUser:1; + u32 ignoresSubstitute:1; + u32 strikeCount:4; // Max 15 hits. Defaults to 1 if not set. May apply its effect on each hit. + u32 meFirstBanned:1; + u32 gravityBanned:1; + u32 mimicBanned:1; + u32 metronomeBanned:1; + u32 copycatBanned:1; + u32 sleepTalkBanned:1; + u32 instructBanned:1; }; #define SPINDA_SPOT_WIDTH 16 @@ -449,14 +486,17 @@ void SetMonMoveSlot(struct Pokemon *mon, u16 move, u8 slot); void SetBattleMonMoveSlot(struct BattlePokemon *mon, u16 move, u8 slot); void GiveMonInitialMoveset(struct Pokemon *mon); void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon); +void GiveMonInitialMoveset_Fast(struct Pokemon *mon); +void GiveBoxMonInitialMoveset_Fast(struct BoxPokemon *boxMon); u16 MonTryLearningNewMove(struct Pokemon *mon, bool8 firstMove); void DeleteFirstMoveAndGiveMoveToMon(struct Pokemon *mon, u16 move); void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); -u8 CountAliveMonsInBattle(u8 caseId); +u8 CountAliveMonsInBattle(u8 caseId, u32 battler); u8 GetDefaultMoveTarget(u8 battlerId); u8 GetMonGender(struct Pokemon *mon); u8 GetBoxMonGender(struct BoxPokemon *boxMon); u8 GetGenderFromSpeciesAndPersonality(u16 species, u32 personality); +bool32 IsPersonalityFemale(u16 species, u32 personality); u32 GetUnownSpeciesId(u32 personality); void SetMultiuseSpriteTemplateToPokemon(u16 speciesTag, u8 battlerPosition); void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerSpriteId, u8 battlerPosition); @@ -490,7 +530,7 @@ u8 GetSecretBaseTrainerPicIndex(void); u8 GetSecretBaseTrainerClass(void); bool8 IsPlayerPartyAndPokemonStorageFull(void); bool8 IsPokemonStorageFull(void); -void GetSpeciesName(u8 *name, u16 species); +const u8 *GetSpeciesName(u16 species); u8 CalculatePPWithBonus(u16 move, u8 ppBonuses, u8 moveIndex); void RemoveMonPPBonus(struct Pokemon *mon, u8 moveIndex); void RemoveBattleMonPPBonus(struct BattlePokemon *mon, u8 moveIndex); @@ -499,18 +539,19 @@ void CopyPlayerPartyMonToBattleData(u8 battlerId, u8 partyIndex); bool8 ExecuteTableBasedItemEffect(struct Pokemon *mon, u16 item, u8 partyIndex, u8 moveIndex); bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 moveIndex, u8 e); bool8 HealStatusConditions(struct Pokemon *mon, u32 battlePartyId, u32 healMask, u8 battlerId); -u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit); +u8 GetItemEffectParamOffset(u32 battler, u16 itemId, u8 effectByte, u8 effectBit); u8 *UseStatIncreaseItem(u16 itemId); u8 GetNature(struct Pokemon *mon); u8 GetNatureFromPersonality(u32 personality); u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem, struct Pokemon *tradePartner); +bool8 IsMonPastEvolutionLevel(struct Pokemon *mon); u16 HoennPokedexNumToSpecies(u16 hoennNum); u16 NationalPokedexNumToSpecies(u16 nationalNum); u16 NationalToHoennOrder(u16 nationalNum); u16 SpeciesToNationalPokedexNum(u16 species); u16 SpeciesToHoennPokedexNum(u16 species); u16 HoennToNationalOrder(u16 hoennNum); -void DrawSpindaSpots(u16 species, u32 personality, u8 *dest, bool8 isFrontPic); +void DrawSpindaSpots(u32 personality, u8 *dest, bool32 isSecondFrame); void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies); u8 GetPlayerFlankId(void); u16 GetLinkTrainerFlankId(u8 id); @@ -532,7 +573,6 @@ u8 GetLevelUpMovesBySpecies(u16 species, u16 *moves); u8 GetNumberOfRelearnableMoves(struct Pokemon *mon); u16 SpeciesToPokedexNum(u16 species); bool32 IsSpeciesInHoennDex(u16 species); -void ClearBattleMonForms(void); u16 GetBattleBGM(void); void PlayBattleBGM(void); void PlayMapChosenOrBattleBGM(u16 songId); @@ -541,7 +581,7 @@ const u32 *GetMonFrontSpritePal(struct Pokemon *mon); const u32 *GetMonSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32 personality); const struct CompressedSpritePalette *GetMonSpritePalStruct(struct Pokemon *mon); const struct CompressedSpritePalette *GetMonSpritePalStructFromOtIdPersonality(u16 species, u32 otId , u32 personality); -bool32 IsHMMove2(u16 move); +bool8 IsMoveHM(u16 move); bool8 IsMonSpriteNotFlipped(u16 species); s8 GetMonFlavorRelation(struct Pokemon *mon, u8 flavor); s8 GetFlavorRelationByPersonality(u32 personality, u8 flavor); @@ -575,10 +615,13 @@ u16 GetFormChangeTargetSpecies(struct Pokemon *mon, u16 method, u32 arg); u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, u16 method, u32 arg); bool32 DoesSpeciesHaveFormChangeMethod(u16 species, u16 method); u16 MonTryLearningNewMoveEvolution(struct Pokemon *mon, bool8 firstMove); -bool32 ShouldShowFemaleDifferences(u16 species, u32 personality); +bool32 SpeciesHasGenderDifferences(u16 species); bool32 TryFormChange(u32 monId, u32 side, u16 method); void TryToSetBattleFormChangeMoves(struct Pokemon *mon, u16 method); u32 GetMonFriendshipScore(struct Pokemon *pokemon); void UpdateMonPersonality(struct BoxPokemon *boxMon, u32 personality); +u8 CalculatePartyCount(struct Pokemon *party); +u16 SanitizeSpeciesId(u16 species); +bool32 IsSpeciesEnabled(u16 species); #endif // GUARD_POKEMON_H diff --git a/include/pokemon_icon.h b/include/pokemon_icon.h index 6e27689f911e..08e905fef628 100644 --- a/include/pokemon_icon.h +++ b/include/pokemon_icon.h @@ -3,7 +3,8 @@ extern const u8 gMonIconPaletteIndices[]; extern const u8 gMonIconPaletteIndicesFemale[]; -extern const u8 *const gMonIconTable[]; +extern const u8 *const gMonIconTable[NUM_SPECIES + 1]; +extern const u8 *const gMonIconTableFemale[NUM_SPECIES + 1]; extern const struct SpritePalette gMonIconPaletteTable[]; const u8 *GetMonIconTiles(u16 species, u32 personality); diff --git a/include/random.h b/include/random.h index 83bc3e0d5612..db1dea39837b 100644 --- a/include/random.h +++ b/include/random.h @@ -20,6 +20,22 @@ u16 Random2(void); void SeedRng(u16 seed); void SeedRng2(u16 seed); +void Shuffle8(void *data, size_t n); +void Shuffle16(void *data, size_t n); +void Shuffle32(void *data, size_t n); +void ShuffleN(void *data, size_t n, size_t size); + +static inline void Shuffle(void *data, size_t n, size_t size) +{ + switch (size) + { + case 1: Shuffle8(data, n); break; + case 2: Shuffle16(data, n); break; + case 4: Shuffle32(data, n); break; + default: ShuffleN(data, n, size); break; + } +} + /* Structured random number generator. * Instead of the caller converting bits from Random() to a meaningful * value, the caller provides metadata that is used to return the @@ -74,6 +90,8 @@ enum RandomTag RNG_STATIC, RNG_STENCH, RNG_TRI_ATTACK, + RNG_TRIPLE_ARROWS_DEFENSE_DOWN, + RNG_TRIPLE_ARROWS_FLINCH, }; #define RandomWeighted(tag, ...) \ diff --git a/include/recorded_battle.h b/include/recorded_battle.h index 02bbe8fc3f86..e4fa1deb406a 100644 --- a/include/recorded_battle.h +++ b/include/recorded_battle.h @@ -70,13 +70,13 @@ void PlayRecordedBattle(void (*CB2_After)(void)); u8 GetRecordedBattleFrontierFacility(void); u8 GetRecordedBattleFronterBrainSymbol(void); void RecordedBattle_SaveParties(void); -u8 GetActiveBattlerLinkPlayerGender(void); +u8 GetBattlerLinkPlayerGender(u32 battler); void RecordedBattle_ClearFrontierPassFlag(void); void RecordedBattle_SetFrontierPassFlagFromHword(u16 flags); u8 RecordedBattle_GetFrontierPassFlag(void); u8 GetBattleSceneInRecordedBattle(void); u8 GetTextSpeedInRecordedBattle(void); -void RecordedBattle_CopyBattlerMoves(void); +void RecordedBattle_CopyBattlerMoves(u32 battler); void RecordedBattle_CheckMovesetChanges(u8 mode); u32 GetAiScriptsInRecordedBattle(void); void RecordedBattle_SetPlaybackFinished(void); diff --git a/include/script_menu.h b/include/script_menu.h index 36b66bf987be..734c717cff0f 100644 --- a/include/script_menu.h +++ b/include/script_menu.h @@ -1,6 +1,8 @@ #ifndef GUARD_SCRIPT_MENU_H #define GUARD_SCRIPT_MENU_H +#include "constants/script_menu.h" + extern const u8 *const gStdStrings[]; bool8 ScriptMenu_Multichoice(u8 left, u8 top, u8 multichoiceId, bool8 ignoreBPress); diff --git a/include/shop.h b/include/shop.h index 7fd7669ea551..6644ba0aa04c 100644 --- a/include/shop.h +++ b/include/shop.h @@ -1,7 +1,7 @@ #ifndef GUARD_SHOP_H #define GUARD_SHOP_H -extern EWRAM_DATA struct ItemSlot gMartPurchaseHistory[3]; +extern struct ItemSlot gMartPurchaseHistory[3]; void CreatePokemartMenu(const u16 *); void CreateDecorationShop1Menu(const u16 *); diff --git a/include/strings.h b/include/strings.h index 4019dee0b147..845e16e9f164 100644 --- a/include/strings.h +++ b/include/strings.h @@ -3034,4 +3034,8 @@ extern const u8 gText_BoxName[]; extern const u8 gText_PkmnsNickname[]; extern const u8 gText_TellHimTheWords[]; +// Exp. Share +extern const u8 gText_ExpShareOn[]; +extern const u8 gText_ExpShareOff[]; + #endif // GUARD_STRINGS_H diff --git a/include/test/battle.h b/include/test/battle.h index 57727b84f295..e1b00efbdd20 100644 --- a/include/test/battle.h +++ b/include/test/battle.h @@ -87,7 +87,7 @@ * SINGLE_BATTLE_TEST("Stun Spore does not affect Grass-types") * { * GIVEN { - * ASSUME(gBattleMoves[MOVE_STUN_SPORE].flags & FLAG_POWDER); + * ASSUME(gBattleMoves[MOVE_STUN_SPORE].powderMove); * ASSUME(gSpeciesInfo[SPECIES_ODDISH].types[0] == TYPE_GRASS); * PLAYER(SPECIES_ODDISH); // 1. * OPPONENT(SPECIES_ODDISH); // 2. @@ -796,6 +796,8 @@ struct MoveContext u16 explicitSecondaryEffect:1; u16 megaEvolve:1; u16 explicitMegaEvolve:1; + u16 ultraBurst:1; + u16 explicitUltraBurst:1; // TODO: u8 zMove:1; u16 allowed:1; u16 explicitAllowed:1; @@ -835,7 +837,8 @@ void SendOut(u32 sourceLine, struct BattlePokemon *, u32 partyIndex); #define ABILITY_POPUP(battler, ...) QueueAbility(__LINE__, battler, (struct AbilityEventContext) { __VA_ARGS__ }) #define ANIMATION(type, id, ...) QueueAnimation(__LINE__, type, id, (struct AnimationEventContext) { __VA_ARGS__ }) #define HP_BAR(battler, ...) QueueHP(__LINE__, battler, (struct HPEventContext) { APPEND_TRUE(__VA_ARGS__) }) -#define MESSAGE(pattern) QueueMessage(__LINE__, (const u8 []) _(pattern)) +// Static const is needed to make the modern compiler put the pattern variable in the .rodata section, instead of putting it on stack(which can break the game). +#define MESSAGE(pattern) do {static const u8 msg[] = _(pattern); QueueMessage(__LINE__, msg);} while (0) #define STATUS_ICON(battler, status) QueueStatus(__LINE__, battler, (struct StatusEventContext) { status }) enum QueueGroupType diff --git a/include/test/test.h b/include/test/test.h index 24abca60dc95..5b3ab8af0c3d 100644 --- a/include/test/test.h +++ b/include/test/test.h @@ -46,6 +46,7 @@ struct TestRunnerState u8 result; u8 expectedResult; bool8 expectLeaks:1; + bool8 inBenchmark:1; u32 timeoutSeconds; }; @@ -158,6 +159,49 @@ s32 MgbaPrintf_(const char *fmt, ...); Test_ExitWithResult(TEST_RESULT_FAIL, "%s:%d: EXPECT_GE(%d, %d) failed", gTestRunnerState.test->filename, __LINE__, _a, _b); \ } while (0) +struct Benchmark { s32 ticks; }; + +static inline void BenchmarkStart(void) +{ + gTestRunnerState.inBenchmark = TRUE; + REG_TM3CNT = (TIMER_ENABLE | TIMER_64CLK) << 16; +} + +static inline struct Benchmark BenchmarkStop(void) +{ + REG_TM3CNT_H = 0; + gTestRunnerState.inBenchmark = FALSE; + return (struct Benchmark) { REG_TM3CNT_L }; +} + +#define BENCHMARK(id) \ + for (BenchmarkStart(); gTestRunnerState.inBenchmark; *(id) = BenchmarkStop()) + +// An approximation of how much overhead benchmarks introduce. +#define BENCHMARK_ABS 2 + +// An approximation for what percentage faster a benchmark has to be for +// us to be confident that it's faster than another. +#define BENCHMARK_REL 95 + +#define EXPECT_FASTER(a, b) \ + do \ + { \ + u32 a_ = (a).ticks; u32 b_ = (b).ticks; \ + MgbaPrintf_(#a ": %d ticks, " #b ": %d ticks", a_, b_); \ + if (((a_ - BENCHMARK_ABS) * BENCHMARK_REL) >= (b_ * 100)) \ + Test_ExitWithResult(TEST_RESULT_FAIL, "%s:%d: EXPECT_FASTER(" #a ", " #b ") failed", gTestRunnerState.test->filename, __LINE__); \ + } while (0) + +#define EXPECT_SLOWER(a, b) \ + do \ + { \ + u32 a_ = (a).ticks; u32 b_ = (b).ticks; \ + MgbaPrintf_(#a ": %d ticks, " #b ": %d ticks", a_, b_); \ + if ((a_ * 100) <= ((b_ - BENCHMARK_ABS) * BENCHMARK_REL)) \ + Test_ExitWithResult(TEST_RESULT_FAIL, "%s:%d: EXPECT_SLOWER(" #a ", " #b ") failed", gTestRunnerState.test->filename, __LINE__); \ + } while (0) + #define KNOWN_FAILING \ Test_ExpectedResult(TEST_RESULT_FAIL) diff --git a/include/wild_encounter.h b/include/wild_encounter.h index e853efbadc89..bef89d8950a7 100644 --- a/include/wild_encounter.h +++ b/include/wild_encounter.h @@ -39,5 +39,6 @@ u16 GetLocalWildMon(bool8 *isWaterMon); u16 GetLocalWaterMon(void); bool8 UpdateRepelCounter(void); bool8 TryDoDoubleWildBattle(void); +bool8 StandardWildEncounter_Debug(void); #endif // GUARD_WILD_ENCOUNTER_H diff --git a/ld_script_test.txt b/ld_script_test.txt index f7a74e0863e7..f4abad98ab2a 100644 --- a/ld_script_test.txt +++ b/ld_script_test.txt @@ -84,9 +84,9 @@ SECTIONS { .rodata : ALIGN(4) { - src/*.o(.rodata); - gflib/*.o(.rodata); - data/*.o(.rodata); + src/*.o(.rodata*); + gflib/*.o(.rodata*); + data/*.o(.rodata*); } =0 song_data : @@ -111,7 +111,7 @@ SECTIONS { test/*.o(.tests); __stop_tests = .; test/*.o(.text); - test/*.o(.rodata); + test/*.o(.rodata*); } =0 /* DWARF debug sections. diff --git a/src/apprentice.c b/src/apprentice.c index ad7568a76fee..05601423079e 100644 --- a/src/apprentice.c +++ b/src/apprentice.c @@ -346,11 +346,10 @@ static u16 GetRandomAlternateMove(u8 monId) learnset = gLevelUpLearnsets[species]; j = 0; - // Despite being open level, level up moves are only read up to level 60 if (PLAYER_APPRENTICE.lvlMode == APPRENTICE_LVL_MODE_50) - level = 50; + level = FRONTIER_MAX_LEVEL_50; else // == APPRENTICE_LVL_MODE_OPEN - level = 60; + level = 60; // Despite being open level, level up moves are only read up to level 60 for (j = 0; learnset[j].move != LEVEL_UP_END; j++) { @@ -464,7 +463,7 @@ static void GetLatestLearnedMoves(u16 species, u16 *moves) const struct LevelUpMove *learnset; if (PLAYER_APPRENTICE.lvlMode == APPRENTICE_LVL_MODE_50) - level = 50; + level = FRONTIER_MAX_LEVEL_50; else // == APPRENTICE_LVL_MODE_OPEN level = 60; @@ -592,7 +591,7 @@ static void CreateApprenticeMenu(u8 menu) speciesTableId = APPRENTICE_SPECIES_ID(i); species = gApprentices[PLAYER_APPRENTICE.id].species[speciesTableId]; - strings[i] = gSpeciesNames[species]; + strings[i] = GetSpeciesName(species); } break; case APPRENTICE_ASK_2SPECIES: @@ -600,8 +599,8 @@ static void CreateApprenticeMenu(u8 menu) top = 8; if (PLAYER_APPRENTICE.questionsAnswered >= NUM_WHICH_MON_QUESTIONS) return; - strings[1] = gSpeciesNames[gApprenticeQuestionData->altSpeciesId]; - strings[0] = gSpeciesNames[gApprenticeQuestionData->speciesId]; + strings[1] = GetSpeciesName(gApprenticeQuestionData->altSpeciesId); + strings[0] = GetSpeciesName(gApprenticeQuestionData->speciesId); break; case APPRENTICE_ASK_MOVES: left = 17; @@ -666,11 +665,12 @@ static void Task_ChooseAnswer(u8 taskId) case MENU_NOTHING_CHOSEN: return; case MENU_B_PRESSED: + // Only ever true. Answering Apprentice questions is required. if (tNoBButton) return; PlaySE(SE_SELECT); - gSpecialVar_Result = 0x7F; + gSpecialVar_Result = MULTI_B_PRESSED; break; default: gSpecialVar_Result = input; @@ -1050,13 +1050,13 @@ static void ApprenticeBufferString(void) switch (gSpecialVar_0x8006) { case APPRENTICE_BUFF_SPECIES1: - StringCopy(stringDst, gSpeciesNames[gApprenticeQuestionData->speciesId]); + StringCopy(stringDst, GetSpeciesName(gApprenticeQuestionData->speciesId)); break; case APPRENTICE_BUFF_SPECIES2: - StringCopy(stringDst, gSpeciesNames[gApprenticeQuestionData->altSpeciesId]); + StringCopy(stringDst, GetSpeciesName(gApprenticeQuestionData->altSpeciesId)); break; case APPRENTICE_BUFF_SPECIES3: - StringCopy(stringDst, gSpeciesNames[gApprenticeQuestionData->speciesId]); + StringCopy(stringDst, GetSpeciesName(gApprenticeQuestionData->speciesId)); break; case APPRENTICE_BUFF_MOVE1: StringCopy(stringDst, gMoveNames[gApprenticeQuestionData->moveId1]); @@ -1083,7 +1083,7 @@ static void ApprenticeBufferString(void) break; case APPRENTICE_BUFF_LEAD_MON_SPECIES: speciesArrayId = APPRENTICE_SPECIES_ID(PLAYER_APPRENTICE.leadMonId); - StringCopy(stringDst, gSpeciesNames[gApprentices[PLAYER_APPRENTICE.id].species[speciesArrayId]]); + StringCopy(stringDst, GetSpeciesName(gApprentices[PLAYER_APPRENTICE.id].species[speciesArrayId])); break; } } diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index c40d8a649ed2..4f778530d5de 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -1,4 +1,5 @@ #include "global.h" +#include "main.h" #include "malloc.h" #include "battle.h" #include "battle_anim.h" @@ -8,6 +9,7 @@ #include "battle_setup.h" #include "battle_z_move.h" #include "data.h" +#include "debug.h" #include "event_data.h" #include "item.h" #include "pokemon.h" @@ -21,48 +23,35 @@ #include "constants/moves.h" #include "constants/items.h" -#define AI_ACTION_DONE 0x0001 -#define AI_ACTION_FLEE 0x0002 -#define AI_ACTION_WATCH 0x0004 -#define AI_ACTION_DO_NOT_ATTACK 0x0008 -#define AI_ACTION_UNK5 0x0010 -#define AI_ACTION_UNK6 0x0020 -#define AI_ACTION_UNK7 0x0040 -#define AI_ACTION_UNK8 0x0080 - -// AI states -enum -{ - AIState_SettingUp, - AIState_Processing, - AIState_FinishedProcessing, - AIState_DoNotProcess -}; +#define AI_ACTION_DONE (1 << 0) +#define AI_ACTION_FLEE (1 << 1) +#define AI_ACTION_WATCH (1 << 2) +#define AI_ACTION_DO_NOT_ATTACK (1 << 3) -static u8 ChooseMoveOrAction_Singles(void); -static u8 ChooseMoveOrAction_Doubles(void); -static void BattleAI_DoAIProcessing(void); -static bool32 IsPinchBerryItemEffect(u16 holdEffect); +static u32 ChooseMoveOrAction_Singles(u32 battlerAi); +static u32 ChooseMoveOrAction_Doubles(u32 battlerAi); +static inline void BattleAI_DoAIProcessing(struct AI_ThinkingStruct *aiThink, u32 battler); +static bool32 IsPinchBerryItemEffect(u32 holdEffect); // ewram EWRAM_DATA const u8 *gAIScriptPtr = NULL; // Still used in contests EWRAM_DATA u8 sBattler_AI = 0; // const rom data -static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score); -static s16 AI_TryToFaint(u8 battlerAtk, u8 battlerDef, u16 move, s16 score); -static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score); -static s16 AI_SetupFirstTurn(u8 battlerAtk, u8 battlerDef, u16 move, s16 score); -static s16 AI_Risky(u8 battlerAtk, u8 battlerDef, u16 move, s16 score); -static s16 AI_PreferStrongestMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score); -static s16 AI_PreferBatonPass(u8 battlerAtk, u8 battlerDef, u16 move, s16 score); -static s16 AI_HPAware(u8 battlerAtk, u8 battlerDef, u16 move, s16 score); -static s16 AI_Roaming(u8 battlerAtk, u8 battlerDef, u16 move, s16 score); -static s16 AI_Safari(u8 battlerAtk, u8 battlerDef, u16 move, s16 score); -static s16 AI_FirstBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score); -static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score); - -static s16 (*const sBattleAiFuncTable[])(u8, u8, u16, s16) = +static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score); +static s32 AI_TryToFaint(u32 battlerAtk, u32 battlerDef, u32 move, s32 score); +static s32 AI_CheckViability(u32 battlerAtk, u32 battlerDef, u32 move, s32 score); +static s32 AI_SetupFirstTurn(u32 battlerAtk, u32 battlerDef, u32 move, s32 score); +static s32 AI_Risky(u32 battlerAtk, u32 battlerDef, u32 move, s32 score); +static s32 AI_PreferStrongestMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score); +static s32 AI_PreferBatonPass(u32 battlerAtk, u32 battlerDef, u32 move, s32 score); +static s32 AI_HPAware(u32 battlerAtk, u32 battlerDef, u32 move, s32 score); +static s32 AI_Roaming(u32 battlerAtk, u32 battlerDef, u32 move, s32 score); +static s32 AI_Safari(u32 battlerAtk, u32 battlerDef, u32 move, s32 score); +static s32 AI_FirstBattle(u32 battlerAtk, u32 battlerDef, u32 move, s32 score); +static s32 AI_DoubleBattle(u32 battlerAtk, u32 battlerDef, u32 move, s32 score); + +static s32 (*const sBattleAiFuncTable[])(u32, u32, u32, s32) = { [0] = AI_CheckBadMove, // AI_FLAG_CHECK_BAD_MOVE [1] = AI_TryToFaint, // AI_FLAG_TRY_TO_FAINT @@ -128,7 +117,7 @@ void BattleAI_SetupItems(void) static u32 GetWildAiFlags(void) { - u8 avgLevel = GetMonData(&gEnemyParty[0], MON_DATA_LEVEL); + u32 avgLevel = GetMonData(&gEnemyParty[0], MON_DATA_LEVEL); u32 flags; if (IsDoubleBattle()) @@ -152,6 +141,11 @@ static u32 GetWildAiFlags(void) void BattleAI_SetupFlags(void) { +#if DEBUG_OVERWORLD_MENU == TRUE + if (gIsDebugBattle) + AI_THINKING_STRUCT->aiFlags = gDebugAIFlags; + else +#endif if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) AI_THINKING_STRUCT->aiFlags = GetAiScriptsInRecordedBattle(); else if (gBattleTypeFlags & BATTLE_TYPE_SAFARI) @@ -178,7 +172,7 @@ void BattleAI_SetupFlags(void) } // sBattler_AI set in ComputeBattleAiScores -void BattleAI_SetupAIData(u8 defaultScoreMoves) +void BattleAI_SetupAIData(u8 defaultScoreMoves, u32 battler) { s32 i, move, dmg; u8 moveLimitations; @@ -199,7 +193,7 @@ void BattleAI_SetupAIData(u8 defaultScoreMoves) defaultScoreMoves >>= 1; } - moveLimitations = AI_DATA->moveLimitations[gActiveBattler]; + moveLimitations = AI_DATA->moveLimitations[battler]; // Ignore moves that aren't possible to use. for (i = 0; i < MAX_MON_MOVES; i++) @@ -208,34 +202,31 @@ void BattleAI_SetupAIData(u8 defaultScoreMoves) AI_THINKING_STRUCT->score[i] = 0; } - //sBattler_AI = gActiveBattler; + //sBattler_AI = battler; gBattlerTarget = SetRandomTarget(sBattler_AI); gBattleStruct->aiChosenTarget[sBattler_AI] = gBattlerTarget; } -u8 BattleAI_ChooseMoveOrAction(void) +u32 BattleAI_ChooseMoveOrAction(void) { - u32 savedCurrentMove = gCurrentMove; - u8 ret; + u32 ret; if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) - ret = ChooseMoveOrAction_Singles(); + ret = ChooseMoveOrAction_Singles(sBattler_AI); else - ret = ChooseMoveOrAction_Doubles(); + ret = ChooseMoveOrAction_Doubles(sBattler_AI); // Clear protect structures, some flags may be set during AI calcs // e.g. pranksterElevated from GetMovePriority memset(&gProtectStructs, 0, MAX_BATTLERS_COUNT * sizeof(struct ProtectStruct)); - - gCurrentMove = savedCurrentMove; return ret; } // damages/other info computed in GetAIDataAndCalcDmg -u8 ComputeBattleAiScores(u8 battler) +u32 ComputeBattleAiScores(u32 battler) { sBattler_AI = battler; - BattleAI_SetupAIData(0xF); + BattleAI_SetupAIData(0xF, sBattler_AI); return BattleAI_ChooseMoveOrAction(); } @@ -326,78 +317,159 @@ void Ai_UpdateSwitchInData(u32 battler) void Ai_UpdateFaintData(u32 battler) { - struct AiPartyMon *aiMon = &AI_PARTY->mons[GET_BATTLER_SIDE(battler)][gBattlerPartyIndexes[battler]]; + struct AiPartyMon *aiMon = &AI_PARTY->mons[GetBattlerSide(battler)][gBattlerPartyIndexes[battler]]; ClearBattlerMoveHistory(battler); ClearBattlerAbilityHistory(battler); ClearBattlerItemEffectHistory(battler); aiMon->isFainted = TRUE; } -static void SetBattlerAiData(u8 battlerId) +static void SetBattlerAiData(u32 battler, struct AiLogicData *aiData) { - AI_DATA->abilities[battlerId] = AI_GetAbility(battlerId); - AI_DATA->items[battlerId] = gBattleMons[battlerId].item; - AI_DATA->holdEffects[battlerId] = AI_GetHoldEffect(battlerId); - AI_DATA->holdEffectParams[battlerId] = GetBattlerHoldEffectParam(battlerId); - AI_DATA->predictedMoves[battlerId] = gLastMoves[battlerId]; - AI_DATA->hpPercents[battlerId] = GetHealthPercentage(battlerId); - AI_DATA->moveLimitations[battlerId] = CheckMoveLimitations(battlerId, 0, MOVE_LIMITATIONS_ALL); + u32 ability, holdEffect; + + ability = aiData->abilities[battler] = AI_GetAbility(battler); + aiData->items[battler] = gBattleMons[battler].item; + holdEffect = aiData->holdEffects[battler] = AI_GetHoldEffect(battler); + aiData->holdEffectParams[battler] = GetBattlerHoldEffectParam(battler); + aiData->predictedMoves[battler] = gLastMoves[battler]; + aiData->hpPercents[battler] = GetHealthPercentage(battler); + aiData->moveLimitations[battler] = CheckMoveLimitations(battler, 0, MOVE_LIMITATIONS_ALL); + aiData->speedStats[battler] = GetBattlerTotalSpeedStatArgs(battler, ability, holdEffect); } -void GetAiLogicData(void) +static void SetBattlerAiMovesData(struct AiLogicData *aiData, u32 battlerAtk, u32 battlersCount) { - u32 battlerAtk, battlerDef, i, move; - u8 effectiveness; - s32 dmg; + u32 battlerDef, i, weather; + u16 *moves; + + // Simulate dmg for both ai controlled mons and for player controlled mons. + SaveBattlerData(battlerAtk); + moves = GetMovesArray(battlerAtk); + weather = AI_GetWeather(aiData); + for (battlerDef = 0; battlerDef < battlersCount; battlerDef++) + { + if (battlerAtk == battlerDef) + continue; + + SaveBattlerData(battlerDef); + for (i = 0; i < MAX_MON_MOVES; i++) + { + s32 dmg = 0; + u8 effectiveness = AI_EFFECTIVENESS_x0; + u32 move = moves[i]; + + if (move != 0 + && move != 0xFFFF + //&& gBattleMoves[move].power != 0 /* we want to get effectiveness of status moves */ + && !(aiData->moveLimitations[battlerAtk] & gBitTable[i])) { + dmg = AI_CalcDamage(move, battlerAtk, battlerDef, &effectiveness, TRUE, weather); + } - memset(AI_DATA, 0, sizeof(struct AiLogicData)); + aiData->simulatedDmg[battlerAtk][battlerDef][i] = dmg; + aiData->effectiveness[battlerAtk][battlerDef][i] = effectiveness; + } + } + SetMoveDamageResult(battlerAtk, moves); +} +void SetAiLogicDataForTurn(struct AiLogicData *aiData) +{ + u32 battlerAtk, battlersCount; + + memset(aiData, 0, sizeof(struct AiLogicData)); if (!(gBattleTypeFlags & BATTLE_TYPE_HAS_AI) && !IsWildMonSmart()) return; - // get/assume all battler data - for (i = 0; i < gBattlersCount; i++) + // Set delay timer to count how long it takes for AI to choose action/move + gBattleStruct->aiDelayTimer = gMain.vblankCounter1; + + aiData->weatherHasEffect = WEATHER_HAS_EFFECT; + // get/assume all battler data and simulate AI damage + battlersCount = gBattlersCount; + for (battlerAtk = 0; battlerAtk < battlersCount; battlerAtk++) { - if (IsBattlerAlive(i)) { - SetBattlerAiData(i); - } + if (!IsBattlerAlive(battlerAtk)) + continue; + + SetBattlerAiData(battlerAtk, aiData); + SetBattlerAiMovesData(aiData, battlerAtk, battlersCount); } +} - // simulate AI damage - for (battlerAtk = 0; battlerAtk < gBattlersCount; battlerAtk++) +static bool32 AI_SwitchMonIfSuitable(u32 battler) +{ + u32 monToSwitchId = GetMostSuitableMonToSwitchInto(battler); + if (monToSwitchId != PARTY_SIZE) { - if (!IsBattlerAlive(battlerAtk) - || !IsAiBattlerAware(battlerAtk)) { - continue; - } + AI_DATA->shouldSwitchMon |= gBitTable[battler]; + AI_DATA->monToSwitchId[battler] = monToSwitchId; + return TRUE; + } + return FALSE; +} - for (battlerDef = 0; battlerDef < gBattlersCount; battlerDef++) +static bool32 AI_ShouldSwitchIfBadMoves(u32 battler, bool32 doubleBattle) +{ + u32 i, j; + // If can switch. + if (CountUsablePartyMons(battler) > 0 + && !IsBattlerTrapped(battler, TRUE) + && !(gBattleTypeFlags & (BATTLE_TYPE_ARENA | BATTLE_TYPE_PALACE)) + && AI_THINKING_STRUCT->aiFlags & (AI_FLAG_CHECK_VIABILITY | AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_PREFER_BATON_PASS)) + { + // Consider switching if all moves are worthless to use. + if (GetTotalBaseStat(gBattleMons[battler].species) >= 310 // Mon is not weak. + && gBattleMons[battler].hp >= gBattleMons[battler].maxHP / 2) // Mon has more than 50% of its HP { - if (battlerAtk == battlerDef) - continue; - - RecordKnownMove(battlerDef, gLastMoves[battlerDef]); - for (i = 0; i < MAX_MON_MOVES; i++) + s32 cap = AI_THINKING_STRUCT->aiFlags & (AI_FLAG_CHECK_VIABILITY) ? 95 : 93; + if (doubleBattle) { - dmg = 0; - effectiveness = AI_EFFECTIVENESS_x0; - move = gBattleMons[battlerAtk].moves[i]; - - if (move != 0 - && move != 0xFFFF - //&& gBattleMoves[move].power != 0 /* we want to get effectiveness of status moves */ - && !(AI_DATA->moveLimitations[battlerAtk] & gBitTable[i])) { - dmg = AI_CalcDamage(move, battlerAtk, battlerDef, &effectiveness, TRUE); + for (i = 0; i < MAX_BATTLERS_COUNT; i++) + { + if (i != battler && IsBattlerAlive(i)) + { + for (j = 0; j < MAX_MON_MOVES; j++) + { + if (gBattleStruct->aiFinalScore[battler][i][j] > cap) + break; + } + if (j != MAX_MON_MOVES) + break; + } + } + if (i == MAX_BATTLERS_COUNT && AI_SwitchMonIfSuitable(battler)) + return TRUE; + } + else + { + for (i = 0; i < MAX_MON_MOVES; i++) + { + if (AI_THINKING_STRUCT->score[i] > cap) + break; } - AI_DATA->simulatedDmg[battlerAtk][battlerDef][i] = dmg; - AI_DATA->effectiveness[battlerAtk][battlerDef][i] = effectiveness; + if (i == MAX_MON_MOVES && AI_SwitchMonIfSuitable(battler)) + return TRUE; } + + } + + // Consider switching if your mon with truant is bodied by Protect spam. + // Or is using a double turn semi invulnerable move(such as Fly) and is faster. + if (GetBattlerAbility(battler) == ABILITY_TRUANT + && IsTruantMonVulnerable(battler, gBattlerTarget) + && gDisableStructs[battler].truantCounter + && gBattleMons[battler].hp >= gBattleMons[battler].maxHP / 2 + && AI_SwitchMonIfSuitable(battler)) + { + return TRUE; } } + return FALSE; } -static u8 ChooseMoveOrAction_Singles(void) +static u32 ChooseMoveOrAction_Singles(u32 battlerAi) { u8 currentMoveArray[MAX_MON_MOVES]; u8 consideredMoveArray[MAX_MON_MOVES]; @@ -410,16 +482,14 @@ static u8 ChooseMoveOrAction_Singles(void) { if (flags & 1) { - AI_THINKING_STRUCT->aiState = AIState_SettingUp; - BattleAI_DoAIProcessing(); + BattleAI_DoAIProcessing(AI_THINKING_STRUCT, battlerAi); } flags >>= 1; AI_THINKING_STRUCT->aiLogicId++; - AI_THINKING_STRUCT->movesetIndex = 0; } for (i = 0; i < MAX_MON_MOVES; i++) { - gBattleStruct->aiFinalScore[sBattler_AI][gBattlerTarget][i] = AI_THINKING_STRUCT->score[i]; + gBattleStruct->aiFinalScore[battlerAi][gBattlerTarget][i] = AI_THINKING_STRUCT->score[i]; } // Check special AI actions. @@ -428,48 +498,9 @@ static u8 ChooseMoveOrAction_Singles(void) if (AI_THINKING_STRUCT->aiAction & AI_ACTION_WATCH) return AI_CHOICE_WATCH; - gActiveBattler = sBattler_AI; - - // If can switch. - if (CountUsablePartyMons(sBattler_AI) > 0 - && !IsAbilityPreventingEscape(sBattler_AI) - && !(gBattleMons[gActiveBattler].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION)) - && !(gStatuses3[gActiveBattler] & STATUS3_ROOTED) - && !(gBattleTypeFlags & (BATTLE_TYPE_ARENA | BATTLE_TYPE_PALACE)) - && AI_THINKING_STRUCT->aiFlags & (AI_FLAG_CHECK_VIABILITY | AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_PREFER_BATON_PASS)) - { - // Consider switching if all moves are worthless to use. - if (GetTotalBaseStat(gBattleMons[sBattler_AI].species) >= 310 // Mon is not weak. - && gBattleMons[sBattler_AI].hp >= gBattleMons[sBattler_AI].maxHP / 2) - { - s32 cap = AI_THINKING_STRUCT->aiFlags & (AI_FLAG_CHECK_VIABILITY) ? 95 : 93; - for (i = 0; i < MAX_MON_MOVES; i++) - { - if (AI_THINKING_STRUCT->score[i] > cap) - break; - } - - if (i == MAX_MON_MOVES && GetMostSuitableMonToSwitchInto() != PARTY_SIZE) - { - AI_THINKING_STRUCT->switchMon = TRUE; - return AI_CHOICE_SWITCH; - } - } - - // Consider switching if your mon with truant is bodied by Protect spam. - // Or is using a double turn semi invulnerable move(such as Fly) and is faster. - if (GetBattlerAbility(sBattler_AI) == ABILITY_TRUANT - && IsTruantMonVulnerable(sBattler_AI, gBattlerTarget) - && gDisableStructs[sBattler_AI].truantCounter - && gBattleMons[sBattler_AI].hp >= gBattleMons[sBattler_AI].maxHP / 2) - { - if (GetMostSuitableMonToSwitchInto() != PARTY_SIZE) - { - AI_THINKING_STRUCT->switchMon = TRUE; - return AI_CHOICE_SWITCH; - } - } - } + // Switch mon if there are no good moves to use. + if (AI_ShouldSwitchIfBadMoves(battlerAi, FALSE)) + return AI_CHOICE_SWITCH; numOfBestMoves = 1; currentMoveArray[0] = AI_THINKING_STRUCT->score[0]; @@ -477,7 +508,7 @@ static u8 ChooseMoveOrAction_Singles(void) for (i = 1; i < MAX_MON_MOVES; i++) { - if (gBattleMons[sBattler_AI].moves[i] != MOVE_NONE) + if (gBattleMons[battlerAi].moves[i] != MOVE_NONE) { // In ruby, the order of these if statements is reversed. if (currentMoveArray[0] == AI_THINKING_STRUCT->score[i]) @@ -496,22 +527,22 @@ static u8 ChooseMoveOrAction_Singles(void) return consideredMoveArray[Random() % numOfBestMoves]; } -static u8 ChooseMoveOrAction_Doubles(void) +static u32 ChooseMoveOrAction_Doubles(u32 battlerAi) { s32 i, j; u32 flags; - s16 bestMovePointsForTarget[MAX_BATTLERS_COUNT]; - s8 mostViableTargetsArray[MAX_BATTLERS_COUNT]; + s32 bestMovePointsForTarget[MAX_BATTLERS_COUNT]; + u8 mostViableTargetsArray[MAX_BATTLERS_COUNT]; u8 actionOrMoveIndex[MAX_BATTLERS_COUNT]; - u8 mostViableMovesScores[MAX_MON_MOVES]; + s32 mostViableMovesScores[MAX_MON_MOVES]; u8 mostViableMovesIndices[MAX_MON_MOVES]; - s32 mostViableTargetsNo; - s32 mostViableMovesNo; - s16 mostMovePoints; + u32 mostViableTargetsNo; + u32 mostViableMovesNo; + s32 mostMovePoints; for (i = 0; i < MAX_BATTLERS_COUNT; i++) { - if (i == sBattler_AI || gBattleMons[i].hp == 0) + if (i == battlerAi || gBattleMons[i].hp == 0) { actionOrMoveIndex[i] = 0xFF; bestMovePointsForTarget[i] = -1; @@ -519,13 +550,11 @@ static u8 ChooseMoveOrAction_Doubles(void) else { if (gBattleTypeFlags & BATTLE_TYPE_PALACE) - BattleAI_SetupAIData(gBattleStruct->palaceFlags >> 4); + BattleAI_SetupAIData(gBattleStruct->palaceFlags >> 4, battlerAi); else - BattleAI_SetupAIData(0xF); + BattleAI_SetupAIData(0xF, battlerAi); gBattlerTarget = i; - if ((i & BIT_SIDE) != (sBattler_AI & BIT_SIDE)) - RecordLastUsedMoveByTarget(); AI_DATA->partnerMove = GetAllyChosenMove(i); AI_THINKING_STRUCT->aiLogicId = 0; @@ -535,12 +564,10 @@ static u8 ChooseMoveOrAction_Doubles(void) { if (flags & 1) { - AI_THINKING_STRUCT->aiState = AIState_SettingUp; - BattleAI_DoAIProcessing(); + BattleAI_DoAIProcessing(AI_THINKING_STRUCT, battlerAi); } flags >>= 1; AI_THINKING_STRUCT->aiLogicId++; - AI_THINKING_STRUCT->movesetIndex = 0; } if (AI_THINKING_STRUCT->aiAction & AI_ACTION_FLEE) @@ -558,9 +585,9 @@ static u8 ChooseMoveOrAction_Doubles(void) mostViableMovesNo = 1; for (j = 1; j < MAX_MON_MOVES; j++) { - if (gBattleMons[sBattler_AI].moves[j] != 0) + if (gBattleMons[battlerAi].moves[j] != 0) { - if (!CanTargetBattler(sBattler_AI, i, gBattleMons[sBattler_AI].moves[j])) + if (!CanTargetBattler(battlerAi, i, gBattleMons[battlerAi].moves[j])) continue; if (mostViableMovesScores[0] == AI_THINKING_STRUCT->score[j]) @@ -581,19 +608,22 @@ static u8 ChooseMoveOrAction_Doubles(void) bestMovePointsForTarget[i] = mostViableMovesScores[0]; // Don't use a move against ally if it has less than 100 points. - if (i == BATTLE_PARTNER(sBattler_AI) && bestMovePointsForTarget[i] < 100) + if (i == BATTLE_PARTNER(battlerAi) && bestMovePointsForTarget[i] < 100) { bestMovePointsForTarget[i] = -1; - mostViableMovesScores[0] = mostViableMovesScores[0]; // Needed to match. } } for (j = 0; j < MAX_MON_MOVES; j++) { - gBattleStruct->aiFinalScore[sBattler_AI][gBattlerTarget][j] = AI_THINKING_STRUCT->score[j]; + gBattleStruct->aiFinalScore[battlerAi][gBattlerTarget][j] = AI_THINKING_STRUCT->score[j]; } } } + // Switch mon if all of the moves are bad to use against any of the target. + if (AI_ShouldSwitchIfBadMoves(battlerAi, TRUE)) + return AI_CHOICE_SWITCH; + mostMovePoints = bestMovePointsForTarget[0]; mostViableTargetsArray[0] = 0; mostViableTargetsNo = 1; @@ -614,80 +644,64 @@ static u8 ChooseMoveOrAction_Doubles(void) } gBattlerTarget = mostViableTargetsArray[Random() % mostViableTargetsNo]; - gBattleStruct->aiChosenTarget[sBattler_AI] = gBattlerTarget; + gBattleStruct->aiChosenTarget[battlerAi] = gBattlerTarget; return actionOrMoveIndex[gBattlerTarget]; } -static void BattleAI_DoAIProcessing(void) +static inline void BattleAI_DoAIProcessing(struct AI_ThinkingStruct *aiThink, u32 battler) { - while (AI_THINKING_STRUCT->aiState != AIState_FinishedProcessing) + do { - switch (AI_THINKING_STRUCT->aiState) - { - case AIState_DoNotProcess: // Needed to match. - break; - case AIState_SettingUp: - if (gBattleMons[sBattler_AI].pp[AI_THINKING_STRUCT->movesetIndex] == 0) - { - AI_THINKING_STRUCT->moveConsidered = 0; - } - else - { - AI_THINKING_STRUCT->moveConsidered = gBattleMons[sBattler_AI].moves[AI_THINKING_STRUCT->movesetIndex]; - } - AI_THINKING_STRUCT->aiState++; - break; - case AIState_Processing: - if (AI_THINKING_STRUCT->moveConsidered != MOVE_NONE - && AI_THINKING_STRUCT->score[AI_THINKING_STRUCT->movesetIndex] > 0) - { - if (AI_THINKING_STRUCT->aiLogicId < ARRAY_COUNT(sBattleAiFuncTable) - && sBattleAiFuncTable[AI_THINKING_STRUCT->aiLogicId] != NULL) - { - // Call AI function - AI_THINKING_STRUCT->score[AI_THINKING_STRUCT->movesetIndex] = - sBattleAiFuncTable[AI_THINKING_STRUCT->aiLogicId](sBattler_AI, - gBattlerTarget, - AI_THINKING_STRUCT->moveConsidered, - AI_THINKING_STRUCT->score[AI_THINKING_STRUCT->movesetIndex]); - } - } - else - { - AI_THINKING_STRUCT->score[AI_THINKING_STRUCT->movesetIndex] = 0; - } + if (gBattleMons[battler].pp[aiThink->movesetIndex] == 0) + aiThink->moveConsidered = MOVE_NONE; + else + aiThink->moveConsidered = gBattleMons[battler].moves[aiThink->movesetIndex]; - AI_THINKING_STRUCT->movesetIndex++; - if (AI_THINKING_STRUCT->movesetIndex < MAX_MON_MOVES && !(AI_THINKING_STRUCT->aiAction & AI_ACTION_DO_NOT_ATTACK)) - AI_THINKING_STRUCT->aiState = AIState_SettingUp; - else - AI_THINKING_STRUCT->aiState++; - break; + if (aiThink->moveConsidered != MOVE_NONE + && aiThink->score[aiThink->movesetIndex] > 0) + { + if (aiThink->aiLogicId < ARRAY_COUNT(sBattleAiFuncTable) + && sBattleAiFuncTable[aiThink->aiLogicId] != NULL) + { + // Call AI function + aiThink->score[aiThink->movesetIndex] = + sBattleAiFuncTable[aiThink->aiLogicId](battler, + gBattlerTarget, + aiThink->moveConsidered, + aiThink->score[aiThink->movesetIndex]); + } } - } + else + { + aiThink->score[aiThink->movesetIndex] = 0; + } + aiThink->movesetIndex++; + } while (aiThink->movesetIndex < MAX_MON_MOVES && !(aiThink->aiAction & AI_ACTION_DO_NOT_ATTACK)); + + aiThink->movesetIndex = 0; } // AI Score Functions // AI_FLAG_CHECK_BAD_MOVE - decreases move scores -static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) +static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) { // move data - u8 atkPriority = GetMovePriority(battlerAtk, move); - u16 moveEffect = gBattleMoves[move].effect; + s8 atkPriority = GetMovePriority(battlerAtk, move); + u32 moveEffect = gBattleMoves[move].effect; s32 moveType; - u16 moveTarget = AI_GetBattlerMoveTargetType(battlerAtk, move); - u16 accuracy = AI_GetMoveAccuracy(battlerAtk, battlerDef, move); - u32 effectiveness = AI_DATA->effectiveness[battlerAtk][battlerDef][AI_THINKING_STRUCT->movesetIndex]; + u32 moveTarget = AI_GetBattlerMoveTargetType(battlerAtk, move); + u32 accuracy = AI_GetMoveAccuracy(battlerAtk, battlerDef, move); + struct AiLogicData *aiData = AI_DATA; + u32 effectiveness = aiData->effectiveness[battlerAtk][battlerDef][AI_THINKING_STRUCT->movesetIndex]; bool32 isDoubleBattle = IsValidDoubleBattle(battlerAtk); u32 i; - u16 predictedMove = AI_DATA->predictedMoves[battlerDef]; + u32 weather; + u32 predictedMove = aiData->predictedMoves[battlerDef]; - SetTypeBeforeUsingMove(move, battlerAtk); - GET_MOVE_TYPE(move, moveType); - - if (IsTargetingPartner(battlerAtk, battlerDef)) + if (IS_TARGETING_PARTNER(battlerAtk, battlerDef)) return score; + SetTypeBeforeUsingMove(move, battlerAtk); GET_MOVE_TYPE(move, moveType); // check non-user target @@ -695,7 +709,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { // handle negative checks on non-user target // check powder moves - if (TestMoveFlags(move, FLAG_POWDER) && !IsAffectedByPowder(battlerDef, AI_DATA->abilities[battlerDef], AI_DATA->holdEffects[battlerDef])) + if (gBattleMoves[move].powderMove && !IsAffectedByPowder(battlerDef, aiData->abilities[battlerDef], aiData->holdEffects[battlerDef])) { RETURN_SCORE_MINUS(20); } @@ -703,9 +717,9 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) // check ground immunities if (moveType == TYPE_GROUND && !IsBattlerGrounded(battlerDef) - && ((AI_DATA->abilities[battlerDef] == ABILITY_LEVITATE - && DoesBattlerIgnoreAbilityChecks(AI_DATA->abilities[battlerAtk], move)) - || AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_AIR_BALLOON + && ((aiData->abilities[battlerDef] == ABILITY_LEVITATE + && DoesBattlerIgnoreAbilityChecks(aiData->abilities[battlerAtk], move)) + || aiData->holdEffects[battlerDef] == HOLD_EFFECT_AIR_BALLOON || (gStatuses3[battlerDef] & (STATUS3_MAGNET_RISE | STATUS3_TELEKINESIS))) && move != MOVE_THOUSAND_ARROWS) { @@ -729,9 +743,9 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } // target ability checks - if (!DoesBattlerIgnoreAbilityChecks(AI_DATA->abilities[battlerAtk], move)) + if (!DoesBattlerIgnoreAbilityChecks(aiData->abilities[battlerAtk], move)) { - switch (AI_DATA->abilities[battlerDef]) + switch (aiData->abilities[battlerDef]) { case ABILITY_MAGIC_GUARD: switch (moveEffect) @@ -782,11 +796,11 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) RETURN_SCORE_MINUS(10); break; case ABILITY_SOUNDPROOF: - if (TestMoveFlags(move, FLAG_SOUND)) + if (gBattleMoves[move].soundMove) RETURN_SCORE_MINUS(10); break; case ABILITY_BULLETPROOF: - if (TestMoveFlags(move, FLAG_BALLISTIC)) + if (gBattleMoves[move].ballisticMove) RETURN_SCORE_MINUS(10); break; case ABILITY_DAZZLING: @@ -807,7 +821,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) RETURN_SCORE_MINUS(10); break; case ABILITY_MAGIC_BOUNCE: - if (TestMoveFlags(move, FLAG_MAGIC_COAT_AFFECTED)) + if (gBattleMoves[move].magicCoatAffected) RETURN_SCORE_MINUS(20); break; case ABILITY_CONTRARY: @@ -835,7 +849,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case ABILITY_DEFIANT: case ABILITY_COMPETITIVE: - if (IsStatLoweringMoveEffect(moveEffect) && !IsTargetingPartner(battlerAtk, battlerDef)) + if (IsStatLoweringMoveEffect(moveEffect) && !IS_TARGETING_PARTNER(battlerAtk, battlerDef)) RETURN_SCORE_MINUS(8); break; case ABILITY_COMATOSE: @@ -847,8 +861,8 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) RETURN_SCORE_MINUS(10); break; case ABILITY_LEAF_GUARD: - if (AI_WeatherHasEffect() && (gBattleWeather & B_WEATHER_SUN) - && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_UTILITY_UMBRELLA + if ((AI_GetWeather(aiData) & B_WEATHER_SUN) + && aiData->holdEffects[battlerDef] != HOLD_EFFECT_UTILITY_UMBRELLA && IsNonVolatileStatusMoveEffect(moveEffect)) RETURN_SCORE_MINUS(10); break; @@ -857,18 +871,18 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) // target partner ability checks & not attacking partner if (isDoubleBattle) { - switch (AI_DATA->abilities[BATTLE_PARTNER(battlerDef)]) + switch (aiData->abilities[BATTLE_PARTNER(battlerDef)]) { case ABILITY_LIGHTNING_ROD: - if (moveType == TYPE_ELECTRIC && !IsMoveRedirectionPrevented(move, AI_DATA->abilities[battlerAtk])) + if (moveType == TYPE_ELECTRIC && !IsMoveRedirectionPrevented(move, aiData->abilities[battlerAtk])) RETURN_SCORE_MINUS(20); break; case ABILITY_STORM_DRAIN: - if (moveType == TYPE_WATER && !IsMoveRedirectionPrevented(move, AI_DATA->abilities[battlerAtk])) + if (moveType == TYPE_WATER && !IsMoveRedirectionPrevented(move, aiData->abilities[battlerAtk])) RETURN_SCORE_MINUS(20); break; case ABILITY_MAGIC_BOUNCE: - if (TestMoveFlags(move, FLAG_MAGIC_COAT_AFFECTED) && moveTarget & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY | MOVE_TARGET_OPPONENTS_FIELD)) + if (gBattleMoves[move].magicCoatAffected && moveTarget & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY | MOVE_TARGET_OPPONENTS_FIELD)) RETURN_SCORE_MINUS(20); break; case ABILITY_SWEET_VEIL: @@ -894,7 +908,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) // gen7+ dark type mons immune to priority->elevated moves from prankster #if B_PRANKSTER_DARK_TYPES >= GEN_7 - if (AI_DATA->abilities[battlerAtk] == ABILITY_PRANKSTER && IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK) && IS_MOVE_STATUS(move) + if (aiData->abilities[battlerAtk] == ABILITY_PRANKSTER && IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK) && IS_MOVE_STATUS(move) && !(moveTarget & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_USER))) RETURN_SCORE_MINUS(10); #endif @@ -921,34 +935,33 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) // the following checks apply to any target (including user) // throat chop check - if (gDisableStructs[battlerAtk].throatChopTimer && TestMoveFlags(move, FLAG_SOUND)) + if (gDisableStructs[battlerAtk].throatChopTimer && gBattleMoves[move].soundMove) return 0; // Can't even select move at all // heal block check if (gStatuses3[battlerAtk] & STATUS3_HEAL_BLOCK && IsHealBlockPreventingMove(battlerAtk, move)) return 0; // Can't even select heal blocked move + // primal weather check - if (WEATHER_HAS_EFFECT) + weather = AI_GetWeather(aiData); + if (weather & B_WEATHER_PRIMAL_ANY) { - if (gBattleWeather & B_WEATHER_PRIMAL_ANY) + switch (move) { - switch (move) - { - case MOVE_SUNNY_DAY: - case MOVE_RAIN_DANCE: - case MOVE_HAIL: - case MOVE_SANDSTORM: - RETURN_SCORE_MINUS(30); - } + case MOVE_SUNNY_DAY: + case MOVE_RAIN_DANCE: + case MOVE_HAIL: + case MOVE_SANDSTORM: + RETURN_SCORE_MINUS(30); } if (!IS_MOVE_STATUS(move)) { - if (gBattleWeather & B_WEATHER_SUN_PRIMAL) + if (weather & B_WEATHER_SUN_PRIMAL) { if (moveType == TYPE_WATER) RETURN_SCORE_MINUS(30); } - else if (gBattleWeather & B_WEATHER_RAIN_PRIMAL) + else if (weather & B_WEATHER_RAIN_PRIMAL) { if (moveType == TYPE_FIRE) RETURN_SCORE_MINUS(30); @@ -963,7 +976,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) default: break; // check move damage case EFFECT_SLEEP: - if (!AI_CanPutToSleep(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], move, AI_DATA->partnerMove)) + if (!AI_CanPutToSleep(battlerAtk, battlerDef, aiData->abilities[battlerDef], move, aiData->partnerMove)) score -= 10; break; case EFFECT_EXPLOSION: @@ -974,7 +987,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { score -= 10; } - else if (IsAbilityOnField(ABILITY_DAMP) && !DoesBattlerIgnoreAbilityChecks(AI_DATA->abilities[battlerAtk], move)) + else if (IsAbilityOnField(ABILITY_DAMP) && !DoesBattlerIgnoreAbilityChecks(aiData->abilities[battlerAtk], move)) { score -= 10; } @@ -996,7 +1009,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_ATTACK_UP: case EFFECT_ATTACK_UP_2: case EFFECT_ATTACK_UP_USER_ALLY: - if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_ATK) || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) + if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_ATK) || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) score -= 10; break; case EFFECT_STUFF_CHEEKS: @@ -1007,65 +1020,65 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_DEFENSE_UP_2: case EFFECT_DEFENSE_UP_3: case EFFECT_DEFENSE_CURL: - if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_DEF)) + if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_DEF)) score -= 10; break; case EFFECT_SPECIAL_ATTACK_UP: case EFFECT_SPECIAL_ATTACK_UP_2: case EFFECT_SPECIAL_ATTACK_UP_3: - if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPATK) || !HasMoveWithSplit(battlerAtk, SPLIT_SPECIAL)) + if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPATK) || !HasMoveWithSplit(battlerAtk, SPLIT_SPECIAL)) score -= 10; break; case EFFECT_SPECIAL_DEFENSE_UP: case EFFECT_SPECIAL_DEFENSE_UP_2: - if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPDEF)) + if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPDEF)) score -= 10; break; case EFFECT_ACCURACY_UP: case EFFECT_ACCURACY_UP_2: - if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_ACC)) + if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_ACC)) score -= 10; break; case EFFECT_EVASION_UP: case EFFECT_EVASION_UP_2: case EFFECT_MINIMIZE: - if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_EVASION)) + if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_EVASION)) score -= 10; break; case EFFECT_COSMIC_POWER: - if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_DEF)) + if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_DEF)) score -= 10; - else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPDEF)) + else if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPDEF)) score -= 8; break; case EFFECT_BULK_UP: - if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_ATK) || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) + if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_ATK) || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) score -= 10; - else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_DEF)) + else if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_DEF)) score -= 8; break; case EFFECT_CALM_MIND: - if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPATK)) + if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPATK)) score -= 10; - else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPDEF)) + else if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPDEF)) score -= 8; break; case EFFECT_DRAGON_DANCE: - if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_ATK) || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) + if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_ATK) || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) score -= 10; - else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPEED)) + else if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPEED)) score -= 8; break; case EFFECT_COIL: - if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_ACC)) + if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_ACC)) score -= 10; - else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_ATK) || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) + else if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_ATK) || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) score -= 8; - else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_DEF)) + else if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_DEF)) score -= 6; break; case EFFECT_ATTACK_ACCURACY_UP: //hone claws - if (AI_DATA->abilities[battlerAtk] != ABILITY_CONTRARY) + if (aiData->abilities[battlerAtk] != ABILITY_CONTRARY) { if (gBattleMons[battlerAtk].statStages[STAT_ATK] >= MAX_STAT_STAGE && (gBattleMons[battlerAtk].statStages[STAT_ACC] >= MAX_STAT_STAGE || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL))) @@ -1083,7 +1096,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) else if (!HasMoveWithType(battlerAtk, TYPE_ELECTRIC)) score -= 10; #if B_CHARGE_SPDEF_RAISE >= GEN_5 - else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPDEF)) + else if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPDEF)) score -= 5; #endif break; @@ -1091,46 +1104,46 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_GEOMANCY: if (gBattleMons[battlerAtk].statStages[STAT_SPATK] >= MAX_STAT_STAGE || !HasMoveWithSplit(battlerAtk, SPLIT_SPECIAL)) score -= 10; - else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPEED)) + else if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPEED)) score -= 8; - else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPDEF)) + else if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPDEF)) score -= 6; break; case EFFECT_VICTORY_DANCE: if (gBattleMons[battlerAtk].statStages[STAT_ATK] >= MAX_STAT_STAGE || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) score -= 10; - else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPEED)) + else if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPEED)) score -= 8; - else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_DEF)) + else if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_DEF)) score -= 6; break; case EFFECT_SHIFT_GEAR: - if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_ATK) || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) + if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_ATK) || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) score -= 10; - else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPEED)) + else if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPEED)) score -= 8; break; case EFFECT_SHELL_SMASH: - if (AI_DATA->abilities[battlerAtk] == ABILITY_CONTRARY) + if (aiData->abilities[battlerAtk] == ABILITY_CONTRARY) { - if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_DEF)) + if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_DEF)) score -= 10; - else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPDEF)) + else if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPDEF)) score -= 8; } else { - if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_ATK) || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) + if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_ATK) || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) score -= 10; - else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPATK) || !HasMoveWithSplit(battlerAtk, SPLIT_SPECIAL)) + else if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPATK) || !HasMoveWithSplit(battlerAtk, SPLIT_SPECIAL)) score -= 8; - else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPEED)) + else if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPEED)) score -= 6; } break; case EFFECT_GROWTH: case EFFECT_ATTACK_SPATK_UP: // work up - if ((!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_ATK) && !BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPATK)) + if ((!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_ATK) && !BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPATK)) || (!HasDamagingMove(battlerAtk))) score -= 10; break; @@ -1139,30 +1152,30 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { if (!(IS_BATTLER_OF_TYPE(battlerAtk, TYPE_GRASS) && AI_IsBattlerGrounded(battlerAtk) - && (BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_ATK) || BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPATK))) + && (BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_ATK) || BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPATK))) && !(IS_BATTLER_OF_TYPE(BATTLE_PARTNER(battlerAtk), TYPE_GRASS) && AI_IsBattlerGrounded(BATTLE_PARTNER(battlerAtk)) - && AI_DATA->abilities[BATTLE_PARTNER(battlerAtk)] != ABILITY_CONTRARY - && (BattlerStatCanRise(BATTLE_PARTNER(battlerAtk), AI_DATA->abilities[BATTLE_PARTNER(battlerAtk)], STAT_ATK) - || BattlerStatCanRise(BATTLE_PARTNER(battlerAtk), AI_DATA->abilities[BATTLE_PARTNER(battlerAtk)], STAT_SPATK)))) + && aiData->abilities[BATTLE_PARTNER(battlerAtk)] != ABILITY_CONTRARY + && (BattlerStatCanRise(BATTLE_PARTNER(battlerAtk), aiData->abilities[BATTLE_PARTNER(battlerAtk)], STAT_ATK) + || BattlerStatCanRise(BATTLE_PARTNER(battlerAtk), aiData->abilities[BATTLE_PARTNER(battlerAtk)], STAT_SPATK)))) { score -= 10; } } else if (!(IS_BATTLER_OF_TYPE(battlerAtk, TYPE_GRASS) && AI_IsBattlerGrounded(battlerAtk) - && (BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_ATK) || BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPATK)))) + && (BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_ATK) || BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPATK)))) { score -= 10; } break; case EFFECT_GEAR_UP: - if (AI_DATA->abilities[battlerAtk] == ABILITY_PLUS || AI_DATA->abilities[battlerAtk] == ABILITY_MINUS) + if (aiData->abilities[battlerAtk] == ABILITY_PLUS || aiData->abilities[battlerAtk] == ABILITY_MINUS) { // same as growth, work up - if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_ATK) || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) + if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_ATK) || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) score -= 10; - else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPATK) || !HasMoveWithSplit(battlerAtk, SPLIT_SPECIAL)) + else if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPATK) || !HasMoveWithSplit(battlerAtk, SPLIT_SPECIAL)) score -= 8; break; } @@ -1173,13 +1186,13 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (isDoubleBattle) { - if (AI_DATA->abilities[BATTLE_PARTNER(battlerAtk)] == ABILITY_PLUS || AI_DATA->abilities[BATTLE_PARTNER(battlerAtk)] == ABILITY_MINUS) + if (aiData->abilities[BATTLE_PARTNER(battlerAtk)] == ABILITY_PLUS || aiData->abilities[BATTLE_PARTNER(battlerAtk)] == ABILITY_MINUS) { - if ((!BattlerStatCanRise(BATTLE_PARTNER(battlerAtk), AI_DATA->abilities[BATTLE_PARTNER(battlerAtk)], STAT_ATK) || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) - && (!BattlerStatCanRise(BATTLE_PARTNER(battlerAtk), AI_DATA->abilities[BATTLE_PARTNER(battlerAtk)], STAT_SPATK) || !HasMoveWithSplit(battlerAtk, SPLIT_SPECIAL))) + if ((!BattlerStatCanRise(BATTLE_PARTNER(battlerAtk), aiData->abilities[BATTLE_PARTNER(battlerAtk)], STAT_ATK) || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) + && (!BattlerStatCanRise(BATTLE_PARTNER(battlerAtk), aiData->abilities[BATTLE_PARTNER(battlerAtk)], STAT_SPATK) || !HasMoveWithSplit(battlerAtk, SPLIT_SPECIAL))) score -= 10; } - else if (AI_DATA->abilities[battlerAtk] != ABILITY_PLUS && AI_DATA->abilities[battlerAtk] != ABILITY_MINUS) + else if (aiData->abilities[battlerAtk] != ABILITY_PLUS && aiData->abilities[battlerAtk] != ABILITY_MINUS) { score -= 10; // nor our or our partner's ability is plus/minus } @@ -1190,11 +1203,11 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 10; break; case EFFECT_MAGNETIC_FLUX: - if (AI_DATA->abilities[battlerAtk] == ABILITY_PLUS || AI_DATA->abilities[battlerAtk] == ABILITY_MINUS) + if (aiData->abilities[battlerAtk] == ABILITY_PLUS || aiData->abilities[battlerAtk] == ABILITY_MINUS) { - if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_DEF)) + if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_DEF)) score -= 10; - else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPDEF)) + else if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPDEF)) score -= 8; } else if (!isDoubleBattle) @@ -1204,14 +1217,14 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (isDoubleBattle) { - if (AI_DATA->abilities[BATTLE_PARTNER(battlerAtk)] == ABILITY_PLUS || AI_DATA->abilities[BATTLE_PARTNER(battlerAtk)] == ABILITY_MINUS) + if (aiData->abilities[BATTLE_PARTNER(battlerAtk)] == ABILITY_PLUS || aiData->abilities[BATTLE_PARTNER(battlerAtk)] == ABILITY_MINUS) { - if (!BattlerStatCanRise(BATTLE_PARTNER(battlerAtk), AI_DATA->abilities[BATTLE_PARTNER(battlerAtk)], STAT_DEF)) + if (!BattlerStatCanRise(BATTLE_PARTNER(battlerAtk), aiData->abilities[BATTLE_PARTNER(battlerAtk)], STAT_DEF)) score -= 10; - else if (!BattlerStatCanRise(BATTLE_PARTNER(battlerAtk), AI_DATA->abilities[BATTLE_PARTNER(battlerAtk)], STAT_SPDEF)) + else if (!BattlerStatCanRise(BATTLE_PARTNER(battlerAtk), aiData->abilities[BATTLE_PARTNER(battlerAtk)], STAT_SPDEF)) score -= 8; } - else if (AI_DATA->abilities[battlerAtk] != ABILITY_PLUS && AI_DATA->abilities[battlerAtk] != ABILITY_MINUS) + else if (aiData->abilities[battlerAtk] != ABILITY_PLUS && aiData->abilities[battlerAtk] != ABILITY_MINUS) { score -= 10; // nor our or our partner's ability is plus/minus } @@ -1220,49 +1233,49 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) // stat lowering effects case EFFECT_ATTACK_DOWN: case EFFECT_ATTACK_DOWN_2: - if (!ShouldLowerStat(battlerDef, AI_DATA->abilities[battlerDef], STAT_ATK)) //|| !HasMoveWithSplit(battlerDef, SPLIT_PHYSICAL)) + if (!ShouldLowerStat(battlerDef, aiData->abilities[battlerDef], STAT_ATK)) //|| !HasMoveWithSplit(battlerDef, SPLIT_PHYSICAL)) score -= 10; - else if (AI_DATA->abilities[battlerDef] == ABILITY_HYPER_CUTTER) + else if (aiData->abilities[battlerDef] == ABILITY_HYPER_CUTTER) score -= 10; break; case EFFECT_DEFENSE_DOWN: case EFFECT_DEFENSE_DOWN_2: - if (!ShouldLowerStat(battlerDef, AI_DATA->abilities[battlerDef], STAT_DEF)) + if (!ShouldLowerStat(battlerDef, aiData->abilities[battlerDef], STAT_DEF)) score -= 10; break; case EFFECT_SPEED_DOWN: case EFFECT_SPEED_DOWN_2: - if (!ShouldLowerStat(battlerDef, AI_DATA->abilities[battlerDef], STAT_SPEED)) + if (!ShouldLowerStat(battlerDef, aiData->abilities[battlerDef], STAT_SPEED)) score -= 10; - else if (AI_DATA->abilities[battlerDef] == ABILITY_SPEED_BOOST) + else if (aiData->abilities[battlerDef] == ABILITY_SPEED_BOOST) score -= 10; break; case EFFECT_SPECIAL_ATTACK_DOWN: case EFFECT_SPECIAL_ATTACK_DOWN_2: - if (!ShouldLowerStat(battlerDef, AI_DATA->abilities[battlerDef], STAT_SPATK)) //|| !HasMoveWithSplit(battlerDef, SPLIT_SPECIAL)) + if (!ShouldLowerStat(battlerDef, aiData->abilities[battlerDef], STAT_SPATK)) //|| !HasMoveWithSplit(battlerDef, SPLIT_SPECIAL)) score -= 10; break; case EFFECT_SPECIAL_DEFENSE_DOWN: case EFFECT_SPECIAL_DEFENSE_DOWN_2: - if (!ShouldLowerStat(battlerDef, AI_DATA->abilities[battlerDef], STAT_SPDEF)) + if (!ShouldLowerStat(battlerDef, aiData->abilities[battlerDef], STAT_SPDEF)) score -= 10; break; case EFFECT_ACCURACY_DOWN: case EFFECT_ACCURACY_DOWN_2: - if (!ShouldLowerStat(battlerDef, AI_DATA->abilities[battlerDef], STAT_ACC)) + if (!ShouldLowerStat(battlerDef, aiData->abilities[battlerDef], STAT_ACC)) score -= 10; - else if (AI_DATA->abilities[battlerDef] == ABILITY_KEEN_EYE) + else if (aiData->abilities[battlerDef] == ABILITY_KEEN_EYE) score -= 8; break; case EFFECT_EVASION_DOWN: case EFFECT_EVASION_DOWN_2: - if (!ShouldLowerStat(battlerDef, AI_DATA->abilities[battlerDef], STAT_EVASION)) + if (!ShouldLowerStat(battlerDef, aiData->abilities[battlerDef], STAT_EVASION)) score -= 10; break; case EFFECT_TICKLE: - if (!ShouldLowerStat(battlerDef, AI_DATA->abilities[battlerDef], STAT_ATK)) + if (!ShouldLowerStat(battlerDef, aiData->abilities[battlerDef], STAT_ATK)) score -= 10; - else if (!ShouldLowerStat(battlerDef, AI_DATA->abilities[battlerDef], STAT_DEF)) + else if (!ShouldLowerStat(battlerDef, aiData->abilities[battlerDef], STAT_DEF)) score -= 8; break; case EFFECT_VENOM_DRENCH: @@ -1272,18 +1285,18 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } else { - if (!ShouldLowerStat(battlerDef, AI_DATA->abilities[battlerDef], STAT_SPEED)) + if (!ShouldLowerStat(battlerDef, aiData->abilities[battlerDef], STAT_SPEED)) score -= 10; - else if (!ShouldLowerStat(battlerDef, AI_DATA->abilities[battlerDef], STAT_SPATK)) + else if (!ShouldLowerStat(battlerDef, aiData->abilities[battlerDef], STAT_SPATK)) score -= 8; - else if (!ShouldLowerStat(battlerDef, AI_DATA->abilities[battlerDef], STAT_ATK)) + else if (!ShouldLowerStat(battlerDef, aiData->abilities[battlerDef], STAT_ATK)) score -= 6; } break; case EFFECT_NOBLE_ROAR: - if (!ShouldLowerStat(battlerDef, AI_DATA->abilities[battlerDef], STAT_SPATK)) + if (!ShouldLowerStat(battlerDef, aiData->abilities[battlerDef], STAT_SPATK)) score -= 10; - else if (!ShouldLowerStat(battlerDef, AI_DATA->abilities[battlerDef], STAT_ATK)) + else if (!ShouldLowerStat(battlerDef, aiData->abilities[battlerDef], STAT_ATK)) score -= 8; break; case EFFECT_CAPTIVATE: @@ -1292,7 +1305,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; // other case EFFECT_HAZE: - if (PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + if (PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) { score -= 10; // partner already using haze } @@ -1328,12 +1341,12 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) //case EFFECT_ENDEAVOR: case EFFECT_LOW_KICK: // AI_CBM_HighRiskForDamage - if (AI_DATA->abilities[battlerDef] == ABILITY_WONDER_GUARD && effectiveness < AI_EFFECTIVENESS_x2) + if (aiData->abilities[battlerDef] == ABILITY_WONDER_GUARD && effectiveness < AI_EFFECTIVENESS_x2) score -= 10; break; case EFFECT_COUNTER: case EFFECT_MIRROR_COAT: - if (IsBattlerIncapacitated(battlerDef, AI_DATA->abilities[battlerDef]) || gBattleMons[battlerDef].status2 & (STATUS2_INFATUATION | STATUS2_CONFUSION)) + if (IsBattlerIncapacitated(battlerDef, aiData->abilities[battlerDef]) || gBattleMons[battlerDef].status2 & (STATUS2_INFATUATION | STATUS2_CONFUSION)) score--; if (predictedMove == MOVE_NONE || GetBattleMoveSplit(predictedMove) == SPLIT_STATUS || DoesSubstituteBlockMove(battlerAtk, BATTLE_PARTNER(battlerDef), predictedMove)) @@ -1343,32 +1356,32 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_ROAR: if (CountUsablePartyMons(battlerDef) == 0) score -= 10; - else if (AI_DATA->abilities[battlerDef] == ABILITY_SUCTION_CUPS) + else if (aiData->abilities[battlerDef] == ABILITY_SUCTION_CUPS) score -= 10; break; case EFFECT_TOXIC_THREAD: - if (!ShouldLowerStat(battlerDef, AI_DATA->abilities[battlerDef], STAT_SPEED)) + if (!ShouldLowerStat(battlerDef, aiData->abilities[battlerDef], STAT_SPEED)) score--; // may still want to just poison //fallthrough case EFFECT_POISON: case EFFECT_TOXIC: - if (!AI_CanPoison(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], move, AI_DATA->partnerMove)) + if (!AI_CanPoison(battlerAtk, battlerDef, aiData->abilities[battlerDef], move, aiData->partnerMove)) score -= 10; break; case EFFECT_LIGHT_SCREEN: if (gSideStatuses[GetBattlerSide(battlerAtk)] & SIDE_STATUS_LIGHTSCREEN - || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) score -= 10; break; case EFFECT_REFLECT: if (gSideStatuses[GetBattlerSide(battlerAtk)] & SIDE_STATUS_REFLECT - || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) score -= 10; break; case EFFECT_AURORA_VEIL: if (gSideStatuses[GetBattlerSide(battlerAtk)] & SIDE_STATUS_AURORA_VEIL - || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove) - || !(gBattleWeather & (B_WEATHER_HAIL | B_WEATHER_SNOW))) + || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove) + || !(weather & (B_WEATHER_HAIL | B_WEATHER_SNOW))) score -= 10; break; case EFFECT_OHKO: @@ -1376,12 +1389,12 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (move == MOVE_SHEER_COLD && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE)) return 0; #endif - if (!ShouldTryOHKO(battlerAtk, battlerDef, AI_DATA->abilities[battlerAtk], AI_DATA->abilities[battlerDef], move)) + if (!ShouldTryOHKO(battlerAtk, battlerDef, aiData->abilities[battlerAtk], aiData->abilities[battlerDef], move)) score -= 10; break; case EFFECT_MIST: if (gSideStatuses[GetBattlerSide(battlerAtk)] & SIDE_STATUS_MIST - || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) score -= 10; break; case EFFECT_FOCUS_ENERGY: @@ -1391,37 +1404,37 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_CONFUSE: case EFFECT_SWAGGER: case EFFECT_FLATTER: - if (!AI_CanConfuse(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + if (!AI_CanConfuse(battlerAtk, battlerDef, aiData->abilities[battlerDef], BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) score -= 10; break; case EFFECT_PARALYZE: - if (!AI_CanParalyze(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], move, AI_DATA->partnerMove)) + if (!AI_CanParalyze(battlerAtk, battlerDef, aiData->abilities[battlerDef], move, aiData->partnerMove)) score -= 10; break; case EFFECT_SUBSTITUTE: - if (gBattleMons[battlerAtk].status2 & STATUS2_SUBSTITUTE || AI_DATA->abilities[battlerDef] == ABILITY_INFILTRATOR) + if (gBattleMons[battlerAtk].status2 & STATUS2_SUBSTITUTE || aiData->abilities[battlerDef] == ABILITY_INFILTRATOR) score -= 8; - else if (AI_DATA->hpPercents[battlerAtk] <= 25) + else if (aiData->hpPercents[battlerAtk] <= 25) score -= 10; #if B_SOUND_SUBSTITUTE >= GEN_6 - else if (TestMoveFlagsInMoveset(battlerDef, FLAG_SOUND)) + else if (HasSoundMove(battlerDef)) score -= 8; #endif break; case EFFECT_LEECH_SEED: if (gStatuses3[battlerDef] & STATUS3_LEECHSEED || IS_BATTLER_OF_TYPE(battlerDef, TYPE_GRASS) - || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) score -= 10; - else if (AI_DATA->abilities[battlerDef] == ABILITY_LIQUID_OOZE) + else if (aiData->abilities[battlerDef] == ABILITY_LIQUID_OOZE) score -= 3; break; case EFFECT_DISABLE: if (gDisableStructs[battlerDef].disableTimer == 0 #if B_MENTAL_HERB >= GEN_5 - && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB + && aiData->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB #endif - && !PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + && !PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) { if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // Attacker should go first { @@ -1441,9 +1454,9 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_ENCORE: if (gDisableStructs[battlerDef].encoreTimer == 0 #if B_MENTAL_HERB >= GEN_5 - && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB + && aiData->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB #endif - && !DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + && !DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) { if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // Attacker should go first { @@ -1466,7 +1479,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 10; // if mon will wake up, is not asleep, or is not comatose break; case EFFECT_MEAN_LOOK: - if (IsBattlerTrapped(battlerDef, TRUE) || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + if (IsBattlerTrapped(battlerDef, TRUE) || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) score -= 10; break; case EFFECT_NIGHTMARE: @@ -1474,48 +1487,48 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 10; else if (!AI_IsBattlerAsleepOrComatose(battlerDef)) score -= 8; - else if (DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + else if (DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) score -= 10; break; case EFFECT_CURSE: if (IS_BATTLER_OF_TYPE(battlerAtk, TYPE_GHOST)) { if (gBattleMons[battlerDef].status2 & STATUS2_CURSED - || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) score -= 10; - else if (AI_DATA->hpPercents[battlerAtk] <= 50) + else if (aiData->hpPercents[battlerAtk] <= 50) score -= 6; } else // regular curse { - if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_ATK) || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) + if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_ATK) || !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) score -= 10; - else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_DEF)) + else if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_DEF)) score -= 8; } break; case EFFECT_SPIKES: if (gSideTimers[GetBattlerSide(battlerDef)].spikesAmount >= 3) score -= 10; - else if (PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove) + else if (PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove) && gSideTimers[GetBattlerSide(battlerDef)].spikesAmount == 2) score -= 10; // only one mon needs to set up the last layer of Spikes break; case EFFECT_STEALTH_ROCK: if (gSideTimers[GetBattlerSide(battlerDef)].stealthRockAmount > 0 - || PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) //Only one mon needs to set up Stealth Rocks + || PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) //Only one mon needs to set up Stealth Rocks score -= 10; break; case EFFECT_TOXIC_SPIKES: if (gSideTimers[GetBattlerSide(battlerDef)].toxicSpikesAmount >= 2) score -= 10; - else if (PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove) && gSideTimers[GetBattlerSide(battlerDef)].toxicSpikesAmount == 1) + else if (PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove) && gSideTimers[GetBattlerSide(battlerDef)].toxicSpikesAmount == 1) score -= 10; // only one mon needs to set up the last layer of Toxic Spikes break; case EFFECT_STICKY_WEB: if (gSideTimers[GetBattlerSide(battlerDef)].stickyWebAmount) score -= 10; - else if (PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove) && gSideTimers[GetBattlerSide(battlerDef)].stickyWebAmount) + else if (PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove) && gSideTimers[GetBattlerSide(battlerDef)].stickyWebAmount) score -= 10; // only one mon needs to set up Sticky Web break; case EFFECT_FORESIGHT: @@ -1523,81 +1536,81 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 10; else if (gBattleMons[battlerDef].statStages[STAT_EVASION] <= 4 || !(IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST)) - || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) score -= 9; break; case EFFECT_PERISH_SONG: if (isDoubleBattle) { if (CountUsablePartyMons(battlerAtk) == 0 - && AI_DATA->abilities[battlerAtk] != ABILITY_SOUNDPROOF - && AI_DATA->abilities[BATTLE_PARTNER(battlerAtk)] != ABILITY_SOUNDPROOF + && aiData->abilities[battlerAtk] != ABILITY_SOUNDPROOF + && aiData->abilities[BATTLE_PARTNER(battlerAtk)] != ABILITY_SOUNDPROOF && CountUsablePartyMons(FOE(battlerAtk)) >= 1) { score -= 10; //Don't wipe your team if you're going to lose } - else if ((!IsBattlerAlive(FOE(battlerAtk)) || AI_DATA->abilities[FOE(battlerAtk)] == ABILITY_SOUNDPROOF + else if ((!IsBattlerAlive(FOE(battlerAtk)) || aiData->abilities[FOE(battlerAtk)] == ABILITY_SOUNDPROOF || gStatuses3[FOE(battlerAtk)] & STATUS3_PERISH_SONG) - && (!IsBattlerAlive(BATTLE_PARTNER(FOE(battlerAtk))) || AI_DATA->abilities[BATTLE_PARTNER(FOE(battlerAtk))] == ABILITY_SOUNDPROOF + && (!IsBattlerAlive(BATTLE_PARTNER(FOE(battlerAtk))) || aiData->abilities[BATTLE_PARTNER(FOE(battlerAtk))] == ABILITY_SOUNDPROOF || gStatuses3[BATTLE_PARTNER(FOE(battlerAtk))] & STATUS3_PERISH_SONG)) { score -= 10; //Both enemies are perish songed } - else if (DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + else if (DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) { score -= 10; } } else { - if (CountUsablePartyMons(battlerAtk) == 0 && AI_DATA->abilities[battlerAtk] != ABILITY_SOUNDPROOF + if (CountUsablePartyMons(battlerAtk) == 0 && aiData->abilities[battlerAtk] != ABILITY_SOUNDPROOF && CountUsablePartyMons(battlerDef) >= 1) score -= 10; - if (gStatuses3[FOE(battlerAtk)] & STATUS3_PERISH_SONG || AI_DATA->abilities[FOE(battlerAtk)] == ABILITY_SOUNDPROOF) + if (gStatuses3[FOE(battlerAtk)] & STATUS3_PERISH_SONG || aiData->abilities[FOE(battlerAtk)] == ABILITY_SOUNDPROOF) score -= 10; } break; case EFFECT_SANDSTORM: - if (gBattleWeather & (B_WEATHER_SANDSTORM | B_WEATHER_PRIMAL_ANY) - || PartnerMoveEffectIsWeather(BATTLE_PARTNER(battlerAtk), AI_DATA->partnerMove)) + if (weather & (B_WEATHER_SANDSTORM | B_WEATHER_PRIMAL_ANY) + || PartnerMoveEffectIsWeather(BATTLE_PARTNER(battlerAtk), aiData->partnerMove)) score -= 8; break; case EFFECT_SUNNY_DAY: - if (gBattleWeather & (B_WEATHER_SUN | B_WEATHER_PRIMAL_ANY) - || PartnerMoveEffectIsWeather(BATTLE_PARTNER(battlerAtk), AI_DATA->partnerMove)) + if (weather & (B_WEATHER_SUN | B_WEATHER_PRIMAL_ANY) + || PartnerMoveEffectIsWeather(BATTLE_PARTNER(battlerAtk), aiData->partnerMove)) score -= 8; break; case EFFECT_RAIN_DANCE: - if (gBattleWeather & (B_WEATHER_RAIN | B_WEATHER_PRIMAL_ANY) - || PartnerMoveEffectIsWeather(BATTLE_PARTNER(battlerAtk), AI_DATA->partnerMove)) + if (weather & (B_WEATHER_RAIN | B_WEATHER_PRIMAL_ANY) + || PartnerMoveEffectIsWeather(BATTLE_PARTNER(battlerAtk), aiData->partnerMove)) score -= 8; break; case EFFECT_HAIL: - if (gBattleWeather & (B_WEATHER_HAIL | B_WEATHER_PRIMAL_ANY) - || PartnerMoveEffectIsWeather(BATTLE_PARTNER(battlerAtk), AI_DATA->partnerMove)) + if (weather & (B_WEATHER_HAIL | B_WEATHER_PRIMAL_ANY) + || PartnerMoveEffectIsWeather(BATTLE_PARTNER(battlerAtk), aiData->partnerMove)) score -= 8; - else if (gBattleWeather & B_WEATHER_SNOW) + else if (weather & B_WEATHER_SNOW) score -= 2; // mainly to prevent looping between hail and snow break; case EFFECT_SNOWSCAPE: - if (gBattleWeather & (B_WEATHER_SNOW | B_WEATHER_PRIMAL_ANY) - || PartnerMoveEffectIsWeather(BATTLE_PARTNER(battlerAtk), AI_DATA->partnerMove)) + if (weather & (B_WEATHER_SNOW | B_WEATHER_PRIMAL_ANY) + || PartnerMoveEffectIsWeather(BATTLE_PARTNER(battlerAtk), aiData->partnerMove)) score -= 8; - else if (gBattleWeather & B_WEATHER_HAIL) + else if (weather & B_WEATHER_HAIL) score -= 2; // mainly to prevent looping between hail and snow break; case EFFECT_ATTRACT: - if (!AI_CanBeInfatuated(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef])) + if (!AI_CanBeInfatuated(battlerAtk, battlerDef, aiData->abilities[battlerDef])) score -= 10; break; case EFFECT_SAFEGUARD: if (gSideStatuses[GetBattlerSide(battlerAtk)] & SIDE_STATUS_SAFEGUARD - || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) score -= 10; break; case EFFECT_MAGNITUDE: - if (AI_DATA->abilities[battlerDef] == ABILITY_LEVITATE) + if (aiData->abilities[battlerDef] == ABILITY_LEVITATE) score -= 10; break; case EFFECT_PARTING_SHOT: @@ -1624,9 +1637,9 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 6; break; case EFFECT_BELLY_DRUM: - if (AI_DATA->abilities[battlerAtk] == ABILITY_CONTRARY) + if (aiData->abilities[battlerAtk] == ABILITY_CONTRARY) score -= 10; - else if (AI_DATA->hpPercents[battlerAtk] <= 60) + else if (aiData->hpPercents[battlerAtk] <= 60) score -= 10; break; case EFFECT_FUTURE_SIGHT: @@ -1641,18 +1654,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_FAKE_OUT: if (!gDisableStructs[battlerAtk].isFirstTurn) - { score -= 10; - } - else if (move == MOVE_FAKE_OUT) // filter out first impression - { - if ((AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_CHOICE_BAND || AI_DATA->abilities[battlerAtk] == ABILITY_GORILLA_TACTICS) - && (CountUsablePartyMons(battlerDef) > 0 || !CanIndexMoveFaintTarget(battlerAtk, battlerDef, AI_THINKING_STRUCT->movesetIndex, 0))) - { - if (CountUsablePartyMons(battlerAtk) == 0) - score -= 10; // Don't lock the attacker into Fake Out if they can't switch out afterwards. - } - } break; case EFFECT_STOCKPILE: if (gDisableStructs[battlerAtk].stockpileCounter >= 3) @@ -1671,28 +1673,28 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { if (AtMaxHp(battlerAtk)) score -= 10; - else if (AI_DATA->hpPercents[battlerAtk] >= 80) + else if (aiData->hpPercents[battlerAtk] >= 80) score -= 5; // do it if nothing better } break; case EFFECT_TORMENT: if (gBattleMons[battlerDef].status2 & STATUS2_TORMENT - || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) { score -= 10; break; } #if B_MENTAL_HERB >= GEN_5 - if (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_MENTAL_HERB) + if (aiData->holdEffects[battlerDef] == HOLD_EFFECT_MENTAL_HERB) score -= 6; #endif break; case EFFECT_WILL_O_WISP: - if (!AI_CanBurn(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + if (!AI_CanBurn(battlerAtk, battlerDef, aiData->abilities[battlerDef], BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) score -= 10; break; case EFFECT_MEMENTO: - if (CountUsablePartyMons(battlerAtk) == 0 || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + if (CountUsablePartyMons(battlerAtk) == 0 || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) score -= 10; else if (gBattleMons[battlerDef].statStages[STAT_ATK] == MIN_STAT_STAGE && gBattleMons[battlerDef].statStages[STAT_SPATK] == MIN_STAT_STAGE) score -= 10; @@ -1701,14 +1703,14 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_HELPING_HAND: if (!isDoubleBattle || !IsBattlerAlive(BATTLE_PARTNER(battlerAtk)) - || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove) - || (AI_DATA->partnerMove != MOVE_NONE && IS_MOVE_STATUS(AI_DATA->partnerMove)) + || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove) + || (aiData->partnerMove != MOVE_NONE && IS_MOVE_STATUS(aiData->partnerMove)) || *(gBattleStruct->monToSwitchIntoId + BATTLE_PARTNER(battlerAtk)) != PARTY_SIZE) //Partner is switching out. score -= 10; break; case EFFECT_TRICK: case EFFECT_KNOCK_OFF: - if (AI_DATA->abilities[battlerDef] == ABILITY_STICKY_HOLD) + if (aiData->abilities[battlerDef] == ABILITY_STICKY_HOLD) score -= 10; break; case EFFECT_INGRAIN: @@ -1732,17 +1734,17 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 10; break; case EFFECT_PSYCHO_SHIFT: - if (gBattleMons[battlerAtk].status1 & STATUS1_PSN_ANY && !AI_CanPoison(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], move, AI_DATA->partnerMove)) + if (gBattleMons[battlerAtk].status1 & STATUS1_PSN_ANY && !AI_CanPoison(battlerAtk, battlerDef, aiData->abilities[battlerDef], move, aiData->partnerMove)) score -= 10; else if (gBattleMons[battlerAtk].status1 & STATUS1_BURN && !AI_CanBurn(battlerAtk, battlerDef, - AI_DATA->abilities[battlerDef], BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + aiData->abilities[battlerDef], BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) score -= 10; else if (gBattleMons[battlerAtk].status1 & STATUS1_FROSTBITE && !AI_CanGiveFrostbite(battlerAtk, battlerDef, - AI_DATA->abilities[battlerDef], BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + aiData->abilities[battlerDef], BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) score -= 10; - else if (gBattleMons[battlerAtk].status1 & STATUS1_PARALYSIS && !AI_CanParalyze(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], move, AI_DATA->partnerMove)) + else if (gBattleMons[battlerAtk].status1 & STATUS1_PARALYSIS && !AI_CanParalyze(battlerAtk, battlerDef, aiData->abilities[battlerDef], move, aiData->partnerMove)) score -= 10; - else if (gBattleMons[battlerAtk].status1 & STATUS1_SLEEP && !AI_CanPutToSleep(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], move, AI_DATA->partnerMove)) + else if (gBattleMons[battlerAtk].status1 & STATUS1_SLEEP && !AI_CanPutToSleep(battlerAtk, battlerDef, aiData->abilities[battlerDef], move, aiData->partnerMove)) score -= 10; else score -= 10; // attacker has no status to transmit @@ -1750,23 +1752,23 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_MUD_SPORT: if (gFieldStatuses & STATUS_FIELD_MUDSPORT || gStatuses4[battlerAtk] & STATUS4_MUD_SPORT - || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) score -= 10; break; case EFFECT_WATER_SPORT: if (gFieldStatuses & STATUS_FIELD_WATERSPORT || gStatuses4[battlerAtk] & STATUS4_WATER_SPORT - || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) score -= 10; break; case EFFECT_ABSORB: - if (AI_DATA->abilities[battlerDef] == ABILITY_LIQUID_OOZE) + if (aiData->abilities[battlerDef] == ABILITY_LIQUID_OOZE) score -= 6; break; case EFFECT_STRENGTH_SAP: - if (AI_DATA->abilities[battlerDef] == ABILITY_CONTRARY) + if (aiData->abilities[battlerDef] == ABILITY_CONTRARY) score -= 10; - else if (!ShouldLowerStat(battlerDef, AI_DATA->abilities[battlerDef], STAT_ATK)) + else if (!ShouldLowerStat(battlerDef, aiData->abilities[battlerDef], STAT_ATK)) score -= 10; break; case EFFECT_COPYCAT: @@ -1778,19 +1780,19 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 10; break; case EFFECT_AROMATIC_MIST: - if (!isDoubleBattle || gBattleMons[BATTLE_PARTNER(battlerAtk)].hp == 0 || !BattlerStatCanRise(BATTLE_PARTNER(battlerAtk), AI_DATA->abilities[BATTLE_PARTNER(battlerAtk)], STAT_SPDEF)) + if (!isDoubleBattle || gBattleMons[BATTLE_PARTNER(battlerAtk)].hp == 0 || !BattlerStatCanRise(BATTLE_PARTNER(battlerAtk), aiData->abilities[BATTLE_PARTNER(battlerAtk)], STAT_SPDEF)) score -= 10; break; case EFFECT_BIDE: if (!HasDamagingMove(battlerDef) - || AI_DATA->hpPercents[battlerAtk] < 30 //Close to death + || aiData->hpPercents[battlerAtk] < 30 //Close to death || gBattleMons[battlerDef].status1 & (STATUS1_SLEEP | STATUS1_FREEZE)) //No point in biding if can't take damage score -= 10; break; case EFFECT_HIT_SWITCH_TARGET: - if (DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + if (DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) score -= 10; // don't scare away pokemon twice - else if (AI_DATA->hpPercents[battlerDef] < 10 && GetBattlerSecondaryDamage(battlerDef)) + else if (aiData->hpPercents[battlerDef] < 10 && GetBattlerSecondaryDamage(battlerDef)) score -= 10; // don't blow away mon that will faint soon else if (gStatuses3[battlerDef] & STATUS3_PERISH_SONG) score -= 10; @@ -1801,7 +1803,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 10; break; case EFFECT_REST: - if (!AI_CanSleep(battlerAtk, AI_DATA->abilities[battlerAtk])) + if (!AI_CanSleep(battlerAtk, aiData->abilities[battlerAtk])) score -= 10; //fallthrough case EFFECT_RESTORE_HP: @@ -1809,17 +1811,17 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_ROOST: if (AtMaxHp(battlerAtk)) score -= 10; - else if (AI_DATA->hpPercents[battlerAtk] >= 90) + else if (aiData->hpPercents[battlerAtk] >= 90) score -= 9; //No point in healing, but should at least do it if nothing better break; case EFFECT_MORNING_SUN: case EFFECT_SYNTHESIS: case EFFECT_MOONLIGHT: - if (AI_WeatherHasEffect() && (gBattleWeather & (B_WEATHER_RAIN | B_WEATHER_SANDSTORM | B_WEATHER_HAIL))) + if ((AI_GetWeather(aiData) & (B_WEATHER_RAIN | B_WEATHER_SANDSTORM | B_WEATHER_HAIL))) score -= 3; else if (AtMaxHp(battlerAtk)) score -= 10; - else if (AI_DATA->hpPercents[battlerAtk] >= 90) + else if (aiData->hpPercents[battlerAtk] >= 90) score -= 9; //No point in healing, but should at least do it if nothing better break; case EFFECT_PURIFY: @@ -1829,21 +1831,21 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; //Always heal your ally else if (AtMaxHp(battlerAtk)) score -= 10; - else if (AI_DATA->hpPercents[battlerAtk] >= 90) + else if (aiData->hpPercents[battlerAtk] >= 90) score -= 8; //No point in healing, but should at least do it if nothing better break; case EFFECT_SUPER_FANG: - if (AI_DATA->hpPercents[battlerDef] < 50) + if (aiData->hpPercents[battlerDef] < 50) score -= 4; break; case EFFECT_RECOIL_IF_MISS: - if (AI_DATA->abilities[battlerAtk] != ABILITY_MAGIC_GUARD && AI_GetMoveAccuracy(battlerAtk, battlerDef, move) < 75) + if (aiData->abilities[battlerAtk] != ABILITY_MAGIC_GUARD && AI_GetMoveAccuracy(battlerAtk, battlerDef, move) < 75) score -= 6; break; case EFFECT_RECOIL_25: - if (AI_DATA->abilities[battlerAtk] != ABILITY_MAGIC_GUARD && AI_DATA->abilities[battlerAtk] != ABILITY_ROCK_HEAD) + if (aiData->abilities[battlerAtk] != ABILITY_MAGIC_GUARD && aiData->abilities[battlerAtk] != ABILITY_ROCK_HEAD) { - u32 recoilDmg = max(1, AI_DATA->simulatedDmg[battlerAtk][battlerDef][AI_THINKING_STRUCT->movesetIndex] / 4); + u32 recoilDmg = max(1, aiData->simulatedDmg[battlerAtk][battlerDef][AI_THINKING_STRUCT->movesetIndex] / 4); if (!ShouldUseRecoilMove(battlerAtk, battlerDef, recoilDmg, AI_THINKING_STRUCT->movesetIndex)) score -= 10; break; @@ -1851,18 +1853,18 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_RECOIL_33: case EFFECT_RECOIL_33_STATUS: - if (AI_DATA->abilities[battlerAtk] != ABILITY_MAGIC_GUARD && AI_DATA->abilities[battlerAtk] != ABILITY_ROCK_HEAD) + if (aiData->abilities[battlerAtk] != ABILITY_MAGIC_GUARD && aiData->abilities[battlerAtk] != ABILITY_ROCK_HEAD) { - u32 recoilDmg = max(1, AI_DATA->simulatedDmg[battlerAtk][battlerDef][AI_THINKING_STRUCT->movesetIndex] / 3); + u32 recoilDmg = max(1, aiData->simulatedDmg[battlerAtk][battlerDef][AI_THINKING_STRUCT->movesetIndex] / 3); if (!ShouldUseRecoilMove(battlerAtk, battlerDef, recoilDmg, AI_THINKING_STRUCT->movesetIndex)) score -= 10; break; } break; case EFFECT_RECOIL_50: - if (AI_DATA->abilities[battlerAtk] != ABILITY_MAGIC_GUARD && AI_DATA->abilities[battlerAtk] != ABILITY_ROCK_HEAD) + if (aiData->abilities[battlerAtk] != ABILITY_MAGIC_GUARD && aiData->abilities[battlerAtk] != ABILITY_ROCK_HEAD) { - u32 recoilDmg = max(1, AI_DATA->simulatedDmg[battlerAtk][battlerDef][AI_THINKING_STRUCT->movesetIndex] / 2); + u32 recoilDmg = max(1, aiData->simulatedDmg[battlerAtk][battlerDef][AI_THINKING_STRUCT->movesetIndex] / 2); if (!ShouldUseRecoilMove(battlerAtk, battlerDef, recoilDmg, AI_THINKING_STRUCT->movesetIndex)) score -= 10; break; @@ -1870,11 +1872,11 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_TEETER_DANCE: if (((gBattleMons[battlerDef].status2 & STATUS2_CONFUSION) - || (!DoesBattlerIgnoreAbilityChecks(AI_DATA->abilities[battlerAtk], move) && AI_DATA->abilities[battlerDef] == ABILITY_OWN_TEMPO) + || (!DoesBattlerIgnoreAbilityChecks(aiData->abilities[battlerAtk], move) && aiData->abilities[battlerDef] == ABILITY_OWN_TEMPO) || (IsBattlerGrounded(battlerDef) && AI_IsTerrainAffected(battlerDef, STATUS_FIELD_MISTY_TERRAIN)) || (DoesSubstituteBlockMove(battlerAtk, battlerDef, move))) && ((gBattleMons[BATTLE_PARTNER(battlerDef)].status2 & STATUS2_CONFUSION) - || (!DoesBattlerIgnoreAbilityChecks(AI_DATA->abilities[battlerAtk], move) && AI_DATA->abilities[BATTLE_PARTNER(battlerDef)] == ABILITY_OWN_TEMPO) + || (!DoesBattlerIgnoreAbilityChecks(aiData->abilities[battlerAtk], move) && aiData->abilities[BATTLE_PARTNER(battlerDef)] == ABILITY_OWN_TEMPO) || (IsBattlerGrounded(BATTLE_PARTNER(battlerDef)) && AI_IsTerrainAffected(BATTLE_PARTNER(battlerDef), STATUS_FIELD_MISTY_TERRAIN)) || (DoesSubstituteBlockMove(battlerAtk, BATTLE_PARTNER(battlerDef), move)))) { @@ -1887,13 +1889,13 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 10; break; case EFFECT_TWO_TURNS_ATTACK: - if (AI_DATA->holdEffects[battlerAtk] != HOLD_EFFECT_POWER_HERB && CanTargetFaintAi(battlerDef, battlerAtk)) + if (aiData->holdEffects[battlerAtk] != HOLD_EFFECT_POWER_HERB && CanTargetFaintAi(battlerDef, battlerAtk)) score -= 6; break; case EFFECT_RECHARGE: - if (AI_DATA->abilities[battlerDef] == ABILITY_WONDER_GUARD && effectiveness < AI_EFFECTIVENESS_x2) + if (aiData->abilities[battlerDef] == ABILITY_WONDER_GUARD && effectiveness < AI_EFFECTIVENESS_x2) score -= 10; - else if (AI_DATA->abilities[battlerAtk] != ABILITY_TRUANT + else if (aiData->abilities[battlerAtk] != ABILITY_TRUANT && !CanIndexMoveFaintTarget(battlerAtk, battlerDef, AI_THINKING_STRUCT->movesetIndex, 0)) score -= 2; break; @@ -1924,15 +1926,15 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_LOCK_ON: if (gStatuses3[battlerDef] & STATUS3_ALWAYS_HITS - || AI_DATA->abilities[battlerAtk] == ABILITY_NO_GUARD - || AI_DATA->abilities[battlerDef] == ABILITY_NO_GUARD - || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + || aiData->abilities[battlerAtk] == ABILITY_NO_GUARD + || aiData->abilities[battlerDef] == ABILITY_NO_GUARD + || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) score -= 10; break; case EFFECT_LASER_FOCUS: if (gStatuses3[battlerAtk] & STATUS3_LASER_FOCUS) score -= 10; - else if (AI_DATA->abilities[battlerDef] == ABILITY_SHELL_ARMOR || AI_DATA->abilities[battlerDef] == ABILITY_BATTLE_ARMOR) + else if (aiData->abilities[battlerDef] == ABILITY_SHELL_ARMOR || aiData->abilities[battlerDef] == ABILITY_BATTLE_ARMOR) score -= 8; break; case EFFECT_SKETCH: @@ -1947,7 +1949,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) // TODO break; case EFFECT_HEAL_BELL: - if (!AnyPartyMemberStatused(battlerAtk, TestMoveFlags(move, FLAG_SOUND)) || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + if (!AnyPartyMemberStatused(battlerAtk, gBattleMoves[move].soundMove) || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) score -= 10; break; case EFFECT_HIT_PREVENT_ESCAPE: @@ -1981,7 +1983,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (decreased) break; - if (IsBattlerIncapacitated(battlerDef, AI_DATA->abilities[battlerDef])) + if (IsBattlerIncapacitated(battlerDef, aiData->abilities[battlerDef])) { score -= 10; break; @@ -1992,8 +1994,8 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) && move != MOVE_CRAFTY_SHIELD) //These moves have infinite usage { if (GetBattlerSecondaryDamage(battlerAtk) >= gBattleMons[battlerAtk].hp - && AI_DATA->abilities[battlerDef] != ABILITY_MOXIE - && AI_DATA->abilities[battlerDef] != ABILITY_BEAST_BOOST) + && aiData->abilities[battlerDef] != ABILITY_MOXIE + && aiData->abilities[battlerDef] != ABILITY_BEAST_BOOST) { score -= 10; //Don't protect if you're going to faint after protecting } @@ -2027,7 +2029,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (gBattleMons[battlerDef].statStages[STAT_EVASION] <= 4 || !(IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK)) - || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) score -= 9; break; case EFFECT_BURN_UP: @@ -2044,7 +2046,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) || gSideTimers[GetBattlerSide(battlerDef)].auroraVeilTimer != 0 || gSideStatuses[GetBattlerSide(battlerAtk)] & SIDE_STATUS_HAZARDS_ANY) { - if (PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + if (PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) { score -= 10; //Only need one hazards removal break; @@ -2059,8 +2061,8 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (isDoubleBattle) { - if (IsHazardMoveEffect(gBattleMoves[AI_DATA->partnerMove].effect) // partner is going to set up hazards - && AI_WhoStrikesFirst(BATTLE_PARTNER(battlerAtk), battlerAtk, AI_DATA->partnerMove) == AI_IS_FASTER) // partner is going to set up before the potential Defog + if (IsHazardMoveEffect(gBattleMoves[aiData->partnerMove].effect) // partner is going to set up hazards + && AI_WhoStrikesFirst(BATTLE_PARTNER(battlerAtk), battlerAtk, aiData->partnerMove) == AI_IS_FASTER) // partner is going to set up before the potential Defog { score -= 10; break; // Don't use Defog if partner is going to set up hazards @@ -2069,7 +2071,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) // evasion check if (gBattleMons[battlerDef].statStages[STAT_EVASION] == MIN_STAT_STAGE - || ((AI_DATA->abilities[battlerDef] == ABILITY_CONTRARY) && !IsTargetingPartner(battlerAtk, battlerDef))) // don't want to raise target stats unless its your partner + || ((aiData->abilities[battlerDef] == ABILITY_CONTRARY) && !IS_TARGETING_PARTNER(battlerAtk, battlerDef))) // don't want to raise target stats unless its your partner score -= 10; break; @@ -2090,8 +2092,8 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_SPECTRAL_THIEF: break; case EFFECT_SOLAR_BEAM: - if (AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_POWER_HERB - || (AI_WeatherHasEffect() && gBattleWeather & B_WEATHER_SUN && AI_DATA->holdEffects[battlerAtk] != HOLD_EFFECT_UTILITY_UMBRELLA)) + if (aiData->holdEffects[battlerAtk] == HOLD_EFFECT_POWER_HERB + || ((AI_GetWeather(aiData) & B_WEATHER_SUN) && aiData->holdEffects[battlerAtk] != HOLD_EFFECT_UTILITY_UMBRELLA)) break; if (CanTargetFaintAi(battlerDef, battlerAtk)) //Attacker can be knocked out score -= 4; @@ -2102,39 +2104,39 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) && gBattleMoves[predictedMove].effect == EFFECT_SEMI_INVULNERABLE) score -= 10; // Don't Fly/dig/etc if opponent is going to fly/dig/etc after you - if (BattlerWillFaintFromWeather(battlerAtk, AI_DATA->abilities[battlerAtk]) + if (BattlerWillFaintFromWeather(battlerAtk, aiData->abilities[battlerAtk]) && (move == MOVE_FLY || move == MOVE_BOUNCE)) score -= 10; // Attacker will faint while in the air break; case EFFECT_HEALING_WISH: //healing wish, lunar dance - if (CountUsablePartyMons(battlerAtk) == 0 || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + if (CountUsablePartyMons(battlerAtk) == 0 || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) score -= 10; else if (IsPartyFullyHealedExceptBattler(battlerAtk)) score -= 10; break; case EFFECT_FINAL_GAMBIT: - if (CountUsablePartyMons(battlerAtk) == 0 || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + if (CountUsablePartyMons(battlerAtk) == 0 || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) score -= 10; break; case EFFECT_NATURE_POWER: return AI_CheckBadMove(battlerAtk, battlerDef, GetNaturePowerMove(), score); case EFFECT_TAUNT: if (gDisableStructs[battlerDef].tauntTimer > 0 - || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + || DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) score--; break; case EFFECT_BESTOW: - if (AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_NONE + if (aiData->holdEffects[battlerAtk] == HOLD_EFFECT_NONE || !CanBattlerGetOrLoseItem(battlerAtk, gBattleMons[battlerAtk].item)) // AI knows its own item score -= 10; break; case EFFECT_ROLE_PLAY: - if (AI_DATA->abilities[battlerAtk] == AI_DATA->abilities[battlerDef] - || AI_DATA->abilities[battlerDef] == ABILITY_NONE - || IsRolePlayBannedAbilityAtk(AI_DATA->abilities[battlerAtk]) - || IsRolePlayBannedAbility(AI_DATA->abilities[battlerDef])) + if (aiData->abilities[battlerAtk] == aiData->abilities[battlerDef] + || aiData->abilities[battlerDef] == ABILITY_NONE + || IsRolePlayBannedAbilityAtk(aiData->abilities[battlerAtk]) + || IsRolePlayBannedAbility(aiData->abilities[battlerDef])) score -= 10; - else if (IsAbilityOfRating(AI_DATA->abilities[battlerAtk], 5)) + else if (IsAbilityOfRating(aiData->abilities[battlerAtk], 5)) score -= 4; break; case EFFECT_WISH: @@ -2146,7 +2148,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 10; // no teammates to assist from break; case EFFECT_MAGIC_COAT: - if (!TestMoveFlagsInMoveset(battlerDef, FLAG_MAGIC_COAT_AFFECTED)) + if (!HasMagicCoatAffectedMove(battlerDef)) score -= 10; break; case EFFECT_BELCH: @@ -2156,68 +2158,68 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_YAWN: if (gStatuses3[battlerDef] & STATUS3_YAWN) score -= 10; - else if (!AI_CanPutToSleep(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], move, AI_DATA->partnerMove)) + else if (!AI_CanPutToSleep(battlerAtk, battlerDef, aiData->abilities[battlerDef], move, aiData->partnerMove)) score -= 10; break; case EFFECT_SKILL_SWAP: - if (AI_DATA->abilities[battlerAtk] == ABILITY_NONE || AI_DATA->abilities[battlerDef] == ABILITY_NONE - || IsSkillSwapBannedAbility(AI_DATA->abilities[battlerAtk]) || IsSkillSwapBannedAbility(AI_DATA->abilities[battlerDef]) - || AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_ABILITY_SHIELD) + if (aiData->abilities[battlerAtk] == ABILITY_NONE || aiData->abilities[battlerDef] == ABILITY_NONE + || IsSkillSwapBannedAbility(aiData->abilities[battlerAtk]) || IsSkillSwapBannedAbility(aiData->abilities[battlerDef]) + || aiData->holdEffects[battlerDef] == HOLD_EFFECT_ABILITY_SHIELD) score -= 10; break; case EFFECT_WORRY_SEED: - if (AI_DATA->abilities[battlerDef] == ABILITY_INSOMNIA - || IsWorrySeedBannedAbility(AI_DATA->abilities[battlerDef]) - || AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_ABILITY_SHIELD) + if (aiData->abilities[battlerDef] == ABILITY_INSOMNIA + || IsWorrySeedBannedAbility(aiData->abilities[battlerDef]) + || aiData->holdEffects[battlerDef] == HOLD_EFFECT_ABILITY_SHIELD) score -= 10; break; case EFFECT_GASTRO_ACID: if (gStatuses3[battlerDef] & STATUS3_GASTRO_ACID - || IsGastroAcidBannedAbility(AI_DATA->abilities[battlerDef])) + || IsGastroAcidBannedAbility(aiData->abilities[battlerDef])) score -= 10; break; case EFFECT_ENTRAINMENT: - if (AI_DATA->abilities[battlerAtk] == ABILITY_NONE - || IsEntrainmentBannedAbilityAttacker(AI_DATA->abilities[battlerAtk]) - || IsEntrainmentTargetOrSimpleBeamBannedAbility(AI_DATA->abilities[battlerDef]) - || AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_ABILITY_SHIELD) + if (aiData->abilities[battlerAtk] == ABILITY_NONE + || IsEntrainmentBannedAbilityAttacker(aiData->abilities[battlerAtk]) + || IsEntrainmentTargetOrSimpleBeamBannedAbility(aiData->abilities[battlerDef]) + || aiData->holdEffects[battlerAtk] == HOLD_EFFECT_ABILITY_SHIELD) score -= 10; break; case EFFECT_CORE_ENFORCER: break; case EFFECT_SIMPLE_BEAM: - if (AI_DATA->abilities[battlerDef] == ABILITY_SIMPLE - || IsEntrainmentTargetOrSimpleBeamBannedAbility(AI_DATA->abilities[battlerDef]) - || AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_ABILITY_SHIELD) + if (aiData->abilities[battlerDef] == ABILITY_SIMPLE + || IsEntrainmentTargetOrSimpleBeamBannedAbility(aiData->abilities[battlerDef]) + || aiData->holdEffects[battlerDef] == HOLD_EFFECT_ABILITY_SHIELD) score -= 10; break; case EFFECT_SNATCH: - if (!TestMoveFlagsInMoveset(battlerDef, FLAG_SNATCH_AFFECTED) - || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + if (!HasSnatchAffectedMove(battlerDef) + || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) score -= 10; break; case EFFECT_POWER_TRICK: - if (IsTargetingPartner(battlerAtk, battlerDef)) + if (IS_TARGETING_PARTNER(battlerAtk, battlerDef)) score -= 10; else if (gBattleMons[battlerAtk].defense >= gBattleMons[battlerAtk].attack && !HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) score -= 10; break; case EFFECT_POWER_SWAP: // Don't use if attacker's stat stages are higher than opponents - if (IsTargetingPartner(battlerAtk, battlerDef)) + if (IS_TARGETING_PARTNER(battlerAtk, battlerDef)) score -= 10; else if (gBattleMons[battlerAtk].statStages[STAT_ATK] >= gBattleMons[battlerDef].statStages[STAT_ATK] && gBattleMons[battlerAtk].statStages[STAT_SPATK] >= gBattleMons[battlerDef].statStages[STAT_SPATK]) score -= 10; break; case EFFECT_GUARD_SWAP: // Don't use if attacker's stat stages are higher than opponents - if (IsTargetingPartner(battlerAtk, battlerDef)) + if (IS_TARGETING_PARTNER(battlerAtk, battlerDef)) score -= 10; else if (gBattleMons[battlerAtk].statStages[STAT_DEF] >= gBattleMons[battlerDef].statStages[STAT_DEF] && gBattleMons[battlerAtk].statStages[STAT_SPDEF] >= gBattleMons[battlerDef].statStages[STAT_SPDEF]) score -= 10; break; case EFFECT_SPEED_SWAP: - if (IsTargetingPartner(battlerAtk, battlerDef)) + if (IS_TARGETING_PARTNER(battlerAtk, battlerDef)) { score -= 10; } @@ -2230,7 +2232,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_HEART_SWAP: - if (IsTargetingPartner(battlerAtk, battlerDef)) + if (IS_TARGETING_PARTNER(battlerAtk, battlerDef)) { score -= 10; } @@ -2247,16 +2249,16 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_POWER_SPLIT: - if (IsTargetingPartner(battlerAtk, battlerDef)) + if (IS_TARGETING_PARTNER(battlerAtk, battlerDef)) { score -= 10; } else { - u8 atkAttack = gBattleMons[battlerAtk].attack; - u8 defAttack = gBattleMons[battlerDef].attack; - u8 atkSpAttack = gBattleMons[battlerAtk].spAttack; - u8 defSpAttack = gBattleMons[battlerDef].spAttack; + u32 atkAttack = gBattleMons[battlerAtk].attack; + u32 defAttack = gBattleMons[battlerDef].attack; + u32 atkSpAttack = gBattleMons[battlerAtk].spAttack; + u32 defSpAttack = gBattleMons[battlerDef].spAttack; if (atkAttack + atkSpAttack >= defAttack + defSpAttack) // Combined attacker stats are > than combined target stats score -= 10; @@ -2264,16 +2266,16 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_GUARD_SPLIT: - if (IsTargetingPartner(battlerAtk, battlerDef)) + if (IS_TARGETING_PARTNER(battlerAtk, battlerDef)) { score -= 10; } else { - u8 atkDefense = gBattleMons[battlerAtk].defense; - u8 defDefense = gBattleMons[battlerDef].defense; - u8 atkSpDefense = gBattleMons[battlerAtk].spDefense; - u8 defSpDefense = gBattleMons[battlerDef].spDefense; + u32 atkDefense = gBattleMons[battlerAtk].defense; + u32 defDefense = gBattleMons[battlerDef].defense; + u32 atkSpDefense = gBattleMons[battlerAtk].spDefense; + u32 defSpDefense = gBattleMons[battlerDef].spDefense; if (atkDefense + atkSpDefense >= defDefense + defSpDefense) //Combined attacker stats are > than combined target stats score -= 10; @@ -2294,33 +2296,33 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_NATURAL_GIFT: - if (AI_DATA->abilities[battlerAtk] == ABILITY_KLUTZ + if (aiData->abilities[battlerAtk] == ABILITY_KLUTZ || gFieldStatuses & STATUS_FIELD_MAGIC_ROOM || GetPocketByItemId(gBattleMons[battlerAtk].item) != POCKET_BERRIES) score -= 10; break; case EFFECT_GRASSY_TERRAIN: - if (PartnerMoveEffectIsTerrain(BATTLE_PARTNER(battlerAtk), AI_DATA->partnerMove) || gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN) + if (PartnerMoveEffectIsTerrain(BATTLE_PARTNER(battlerAtk), aiData->partnerMove) || gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN) score -= 10; break; case EFFECT_ELECTRIC_TERRAIN: - if (PartnerMoveEffectIsTerrain(BATTLE_PARTNER(battlerAtk), AI_DATA->partnerMove) || gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN) + if (PartnerMoveEffectIsTerrain(BATTLE_PARTNER(battlerAtk), aiData->partnerMove) || gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN) score -= 10; break; case EFFECT_PSYCHIC_TERRAIN: - if (PartnerMoveEffectIsTerrain(BATTLE_PARTNER(battlerAtk), AI_DATA->partnerMove) || gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN) + if (PartnerMoveEffectIsTerrain(BATTLE_PARTNER(battlerAtk), aiData->partnerMove) || gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN) score -= 10; break; case EFFECT_MISTY_TERRAIN: - if (PartnerMoveEffectIsTerrain(BATTLE_PARTNER(battlerAtk), AI_DATA->partnerMove) || gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN) + if (PartnerMoveEffectIsTerrain(BATTLE_PARTNER(battlerAtk), aiData->partnerMove) || gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN) score -= 10; break; case EFFECT_PLEDGE: if (isDoubleBattle && gBattleMons[BATTLE_PARTNER(battlerAtk)].hp > 0) { - if (AI_DATA->partnerMove != MOVE_NONE - && gBattleMoves[AI_DATA->partnerMove].effect == EFFECT_PLEDGE - && move != AI_DATA->partnerMove) // Different pledge moves + if (aiData->partnerMove != MOVE_NONE + && gBattleMoves[aiData->partnerMove].effect == EFFECT_PLEDGE + && move != aiData->partnerMove) // Different pledge moves { if (gBattleMons[BATTLE_PARTNER(battlerAtk)].status1 & (STATUS1_SLEEP | STATUS1_FREEZE)) // && gBattleMons[BATTLE_PARTNER(battlerAtk)].status1 != 1) // Will wake up this turn - how would AI know @@ -2329,7 +2331,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_TRICK_ROOM: - if (PartnerMoveIs(BATTLE_PARTNER(battlerAtk), AI_DATA->partnerMove, MOVE_TRICK_ROOM)) + if (PartnerMoveIs(BATTLE_PARTNER(battlerAtk), aiData->partnerMove, MOVE_TRICK_ROOM)) { score -= 10; } @@ -2345,23 +2347,23 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_MAGIC_ROOM: - if (gFieldStatuses & STATUS_FIELD_MAGIC_ROOM || PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + if (gFieldStatuses & STATUS_FIELD_MAGIC_ROOM || PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) score -= 10; break; case EFFECT_WONDER_ROOM: - if (gFieldStatuses & STATUS_FIELD_WONDER_ROOM || PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + if (gFieldStatuses & STATUS_FIELD_WONDER_ROOM || PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) score -= 10; break; case EFFECT_GRAVITY: if ((gFieldStatuses & STATUS_FIELD_GRAVITY && !IS_BATTLER_OF_TYPE(battlerAtk, TYPE_FLYING) - && AI_DATA->holdEffects[battlerAtk] != HOLD_EFFECT_AIR_BALLOON) // Should revert Gravity in this case - || PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + && aiData->holdEffects[battlerAtk] != HOLD_EFFECT_AIR_BALLOON) // Should revert Gravity in this case + || PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) score -= 10; break; case EFFECT_ION_DELUGE: if (gFieldStatuses & STATUS_FIELD_ION_DELUGE - || PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + || PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) score -= 10; break; case EFFECT_FLING: @@ -2376,19 +2378,19 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) switch (effect) { case MOVE_EFFECT_BURN: - if (!AI_CanBurn(battlerAtk, battlerDef, BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + if (!AI_CanBurn(battlerAtk, battlerDef, BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) score -= 10; break; case MOVE_EFFECT_PARALYSIS: - if (!AI_CanParalyze(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], move, AI_DATA->partnerMove)) + if (!AI_CanParalyze(battlerAtk, battlerDef, aiData->abilities[battlerDef], move, aiData->partnerMove)) score -= 10; break; case MOVE_EFFECT_POISON: - if (!AI_CanPoison(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], move, AI_DATA->partnerMove)) + if (!AI_CanPoison(battlerAtk, battlerDef, aiData->abilities[battlerDef], move, aiData->partnerMove)) score -= 10; break; case MOVE_EFFECT_TOXIC: - if (!AI_CanPoison(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], move, AI_DATA->partnerMove)) + if (!AI_CanPoison(battlerAtk, battlerDef, aiData->abilities[battlerDef], move, aiData->partnerMove)) score -= 10; break; case MOVE_EFFECT_FREEZE: @@ -2400,34 +2402,34 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_EMBARGO: - if (AI_DATA->abilities[battlerDef] == ABILITY_KLUTZ + if (aiData->abilities[battlerDef] == ABILITY_KLUTZ || gFieldStatuses & STATUS_FIELD_MAGIC_ROOM || gDisableStructs[battlerDef].embargoTimer != 0 - || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) score -= 10; break; case EFFECT_POWDER: if (!HasMoveWithType(battlerDef, TYPE_FIRE) - || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) score -= 10; break; case EFFECT_TELEKINESIS: if (gStatuses3[battlerDef] & (STATUS3_TELEKINESIS | STATUS3_ROOTED | STATUS3_SMACKED_DOWN) || gFieldStatuses & STATUS_FIELD_GRAVITY - || AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_IRON_BALL + || aiData->holdEffects[battlerDef] == HOLD_EFFECT_IRON_BALL || IsTelekinesisBannedSpecies(gBattleMons[battlerDef].species) - || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) score -= 10; break; case EFFECT_THROAT_CHOP: break; case EFFECT_HEAL_BLOCK: if (gDisableStructs[battlerDef].healBlockTimer != 0 - || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) score -= 10; break; case EFFECT_SOAK: - if (PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove) + if (PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove) || (gBattleMons[battlerDef].type1 == TYPE_WATER && gBattleMons[battlerDef].type2 == TYPE_WATER && gBattleMons[battlerDef].type3 == TYPE_MYSTERY)) @@ -2437,24 +2439,24 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) switch (move) { case MOVE_TRICK_OR_TREAT: - if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST) || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST) || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) score -= 10; break; case MOVE_FORESTS_CURSE: - if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_GRASS) || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_GRASS) || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) score -= 10; break; } break; case EFFECT_HEAL_PULSE: // and floral healing - if (!IsTargetingPartner(battlerAtk, battlerDef)) // Don't heal enemies + if (!IS_TARGETING_PARTNER(battlerAtk, battlerDef)) // Don't heal enemies { score -= 10; break; } // fallthrough case EFFECT_HIT_ENEMY_HEAL_ALLY: // pollen puff - if (IsTargetingPartner(battlerAtk, battlerDef)) + if (IS_TARGETING_PARTNER(battlerAtk, battlerDef)) { if (gStatuses3[battlerDef] & STATUS3_HEAL_BLOCK) return 0; @@ -2467,17 +2469,17 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_ELECTRIFY: if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_SLOWER //|| GetMoveTypeSpecial(battlerDef, predictedMove) == TYPE_ELECTRIC // Move will already be electric type - || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) score -= 10; break; case EFFECT_TOPSY_TURVY: - if (!IsTargetingPartner(battlerAtk, battlerDef)) + if (!IS_TARGETING_PARTNER(battlerAtk, battlerDef)) { - u8 targetPositiveStages = CountPositiveStatStages(battlerDef); - u8 targetNegativeStages = CountNegativeStatStages(battlerDef); + u32 targetPositiveStages = CountPositiveStatStages(battlerDef); + u32 targetNegativeStages = CountNegativeStatStages(battlerDef); if (targetPositiveStages == 0 //No good stat changes to make bad - || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) score -= 10; else if (targetNegativeStages < targetPositiveStages) @@ -2485,7 +2487,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_FAIRY_LOCK: - if ((gFieldStatuses & STATUS_FIELD_FAIRY_LOCK) || PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + if ((gFieldStatuses & STATUS_FIELD_FAIRY_LOCK) || PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) score -= 10; break; case EFFECT_DO_NOTHING: @@ -2500,19 +2502,19 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) instructedMove = gLastMoves[battlerDef]; if (instructedMove == MOVE_NONE - || IsInstructBannedMove(instructedMove) + || gBattleMoves[instructedMove].instructBanned || MoveRequiresRecharging(instructedMove) || MoveCallsOtherMove(instructedMove) || IsZMove(instructedMove) || (gLockedMoves[battlerDef] != 0 && gLockedMoves[battlerDef] != 0xFFFF) || gBattleMons[battlerDef].status2 & STATUS2_MULTIPLETURNS - || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) { score -= 10; } else if (isDoubleBattle) { - if (!IsTargetingPartner(battlerAtk, battlerDef)) + if (!IS_TARGETING_PARTNER(battlerAtk, battlerDef)) score -= 10; } else @@ -2533,14 +2535,14 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_QUASH: if (!isDoubleBattle || AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_SLOWER - || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) score -= 10; break; case EFFECT_AFTER_YOU: - if (!IsTargetingPartner(battlerAtk, battlerDef) + if (!IS_TARGETING_PARTNER(battlerAtk, battlerDef) || !isDoubleBattle || AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_SLOWER - || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + || PartnerMoveIsSameAsAttacker(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove)) score -= 10; break; case EFFECT_SUCKER_PUNCH: @@ -2552,19 +2554,19 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_TAILWIND: if (gSideTimers[GetBattlerSide(battlerAtk)].tailwindTimer != 0 - || PartnerMoveIs(BATTLE_PARTNER(battlerAtk), AI_DATA->partnerMove, MOVE_TAILWIND) + || PartnerMoveIs(BATTLE_PARTNER(battlerAtk), aiData->partnerMove, MOVE_TAILWIND) || (gFieldStatuses & STATUS_FIELD_TRICK_ROOM && gFieldTimers.trickRoomTimer > 1)) // Trick Room active and not ending this turn score -= 10; break; case EFFECT_LUCKY_CHANT: - if (gSideTimers[GET_BATTLER_SIDE(battlerAtk)].luckyChantTimer != 0 - || PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + if (gSideTimers[GetBattlerSide(battlerAtk)].luckyChantTimer != 0 + || PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) score -= 10; break; case EFFECT_MAGNET_RISE: if (gFieldStatuses & STATUS_FIELD_GRAVITY || gDisableStructs[battlerAtk].magnetRiseTimer != 0 - || AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_IRON_BALL + || aiData->holdEffects[battlerAtk] == HOLD_EFFECT_IRON_BALL || gStatuses3[battlerAtk] & (STATUS3_ROOTED | STATUS3_MAGNET_RISE | STATUS3_SMACKED_DOWN) || !IsBattlerGrounded(battlerAtk)) score -= 10; @@ -2579,7 +2581,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_SYNCHRONOISE: //Check holding ring target or is of same type - if (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_RING_TARGET + if (aiData->holdEffects[battlerDef] == HOLD_EFFECT_RING_TARGET || IS_BATTLER_OF_TYPE(battlerDef, gBattleMons[battlerAtk].type1) || IS_BATTLER_OF_TYPE(battlerDef, gBattleMons[battlerAtk].type2) || IS_BATTLER_OF_TYPE(battlerDef, gBattleMons[battlerAtk].type3)) @@ -2590,16 +2592,16 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_ERUPTION: if (effectiveness <= AI_EFFECTIVENESS_x0_5) score--; - if (AI_DATA->hpPercents[battlerDef] < 50) + if (aiData->hpPercents[battlerDef] < 50) score--; break; case EFFECT_VITAL_THROW: - if (WillAIStrikeFirst() && AI_DATA->hpPercents[battlerAtk] < 40) + if (AI_STRIKES_FIRST(battlerAtk, battlerDef, move) && aiData->hpPercents[battlerAtk] < 40) score--; // don't want to move last break; case EFFECT_FLAIL: if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_SLOWER // Opponent should go first - || AI_DATA->hpPercents[battlerAtk] > 50) + || aiData->hpPercents[battlerAtk] > 50) score -= 4; break; //TODO @@ -2612,7 +2614,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_SKY_DROP: if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_FLYING)) score -= 10; - if (BattlerWillFaintFromWeather(battlerAtk, AI_DATA->abilities[battlerAtk]) + if (BattlerWillFaintFromWeather(battlerAtk, aiData->abilities[battlerAtk]) || DoesSubstituteBlockMove(battlerAtk, battlerDef, move) || GetBattlerWeight(battlerDef) >= 2000) //200.0 kg score -= 10; @@ -2638,6 +2640,22 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) && AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_SLOWER) score -= 10; break; + case EFFECT_JUNGLE_HEALING: + if (AtMaxHp(battlerAtk) + && AtMaxHp(BATTLE_PARTNER(battlerAtk)) + && !(gBattleMons[battlerAtk].status1 & STATUS1_ANY) + && !(gBattleMons[BATTLE_PARTNER(battlerAtk)].status1 & STATUS1_ANY)) + score -= 10; + break; + case EFFECT_TAKE_HEART: + if ((!(gBattleMons[battlerAtk].status1 & STATUS1_ANY) + || PartnerMoveIs(BATTLE_PARTNER(battlerAtk), aiData->partnerMove, MOVE_JUNGLE_HEALING) + || PartnerMoveIs(BATTLE_PARTNER(battlerAtk), aiData->partnerMove, MOVE_HEAL_BELL) + || PartnerMoveIs(BATTLE_PARTNER(battlerAtk), aiData->partnerMove, MOVE_AROMATHERAPY)) + && !BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPATK) + && !BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPDEF)) + score -= 10; + break; case EFFECT_PLACEHOLDER: return 0; // cannot even select } // move effect checks @@ -2648,18 +2666,22 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) return score; } -static s16 AI_TryToFaint(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) +static s32 AI_TryToFaint(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) { - if (IsTargetingPartner(battlerAtk, battlerDef)) + u32 movesetIndex = AI_THINKING_STRUCT->movesetIndex; + bool32 aiFaster; + + if (IS_TARGETING_PARTNER(battlerAtk, battlerDef)) return score; if (gBattleMoves[move].power == 0) return score; // can't make anything faint with no power - if (CanIndexMoveFaintTarget(battlerAtk, battlerDef, AI_THINKING_STRUCT->movesetIndex, 0) && gBattleMoves[move].effect != EFFECT_EXPLOSION) + aiFaster = AI_STRIKES_FIRST(battlerAtk, battlerDef, move); + if (CanIndexMoveFaintTarget(battlerAtk, battlerDef, movesetIndex, 0) && gBattleMoves[move].effect != EFFECT_EXPLOSION) { // this move can faint the target - if (WillAIStrikeFirst() || GetMovePriority(battlerAtk, move) > 0) + if (aiFaster || GetMovePriority(battlerAtk, move) > 0) score += 4; // we go first or we're using priority move else score += 2; @@ -2667,13 +2689,13 @@ static s16 AI_TryToFaint(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) else { // this move isn't expected to faint the target - if (TestMoveFlags(move, FLAG_HIGH_CRIT)) + if (gBattleMoves[move].highCritRatio) score += 2; // crit makes it more likely to make them faint - if (GetMoveDamageResult(move) == MOVE_POWER_OTHER) + if (GetMoveDamageResult(battlerAtk, battlerDef, movesetIndex) == MOVE_POWER_OTHER) score--; - switch (AI_DATA->effectiveness[battlerAtk][battlerDef][AI_THINKING_STRUCT->movesetIndex]) + switch (AI_DATA->effectiveness[battlerAtk][battlerDef][movesetIndex]) { case AI_EFFECTIVENESS_x8: score += 8; @@ -2691,9 +2713,9 @@ static s16 AI_TryToFaint(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } //AI_TryToFaint_CheckIfDanger - if (!WillAIStrikeFirst() && CanTargetFaintAi(battlerDef, battlerAtk)) + if (!aiFaster && CanTargetFaintAi(battlerDef, battlerAtk)) { // AI_TryToFaint_Danger - if (GetMoveDamageResult(move) != MOVE_POWER_BEST) + if (GetMoveDamageResult(battlerAtk, battlerDef, movesetIndex) != MOVE_POWER_BEST) score--; else score++; @@ -2703,28 +2725,29 @@ static s16 AI_TryToFaint(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } // double battle logic -static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) +static s32 AI_DoubleBattle(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) { // move data - u8 moveType = gBattleMoves[move].type; - u16 effect = gBattleMoves[move].effect; - u16 moveTarget = AI_GetBattlerMoveTargetType(battlerAtk, move); + u32 moveType = gBattleMoves[move].type; + u32 effect = gBattleMoves[move].effect; + u32 moveTarget = AI_GetBattlerMoveTargetType(battlerAtk, move); // ally data - u8 battlerAtkPartner = BATTLE_PARTNER(battlerAtk); - u16 atkPartnerAbility = AI_DATA->abilities[BATTLE_PARTNER(battlerAtk)]; - u16 atkPartnerHoldEffect = AI_DATA->holdEffects[BATTLE_PARTNER(battlerAtk)]; - bool32 partnerProtecting = (gBattleMoves[AI_DATA->partnerMove].effect == EFFECT_PROTECT); - bool32 attackerHasBadAbility = (GetAbilityRating(AI_DATA->abilities[battlerAtk]) < 0); + u32 battlerAtkPartner = BATTLE_PARTNER(battlerAtk); + struct AiLogicData *aiData = AI_DATA; + u32 atkPartnerAbility = aiData->abilities[BATTLE_PARTNER(battlerAtk)]; + u32 atkPartnerHoldEffect = aiData->holdEffects[BATTLE_PARTNER(battlerAtk)]; + bool32 partnerProtecting = (gBattleMoves[aiData->partnerMove].effect == EFFECT_PROTECT); + bool32 attackerHasBadAbility = (GetAbilityRating(aiData->abilities[battlerAtk]) < 0); bool32 partnerHasBadAbility = (GetAbilityRating(atkPartnerAbility) < 0); - u16 predictedMove = AI_DATA->predictedMoves[battlerDef]; + u32 predictedMove = aiData->predictedMoves[battlerDef]; SetTypeBeforeUsingMove(move, battlerAtk); GET_MOVE_TYPE(move, moveType); // check what effect partner is using - if (AI_DATA->partnerMove != 0) + if (aiData->partnerMove != 0) { - switch (gBattleMoves[AI_DATA->partnerMove].effect) + switch (gBattleMoves[aiData->partnerMove].effect) { case EFFECT_HELPING_HAND: if (!IS_MOVE_STATUS(move)) @@ -2739,7 +2762,7 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_ALWAYS_CRIT: // Ally decided to use Frost Breath on us. we must have Anger Point as our ability - if (AI_DATA->abilities[battlerAtk] == ABILITY_ANGER_POINT) + if (aiData->abilities[battlerAtk] == ABILITY_ANGER_POINT) { if (AI_WhoStrikesFirst(battlerAtk, battlerAtkPartner, move) == AI_IS_SLOWER) // Partner moving first { @@ -2755,16 +2778,15 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } } // check partner move effect - // consider our move effect relative to partner state switch (effect) { case EFFECT_HELPING_HAND: - if (AI_DATA->partnerMove != 0 && !HasDamagingMove(battlerAtkPartner)) + if (aiData->partnerMove != 0 && !HasDamagingMove(battlerAtkPartner)) score -= 5; break; case EFFECT_PERISH_SONG: - if (AI_DATA->partnerMove != 0 && HasTrappingMoveEffect(battlerAtkPartner)) + if (aiData->partnerMove != 0 && HasTrappingMoveEffect(battlerAtkPartner)) score++; break; case EFFECT_MAGNET_RISE: @@ -2777,7 +2799,6 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; } // our effect relative to partner - // consider global move effects switch (effect) { @@ -2815,14 +2836,13 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; } // global move effect check - // check specific target - if (IsTargetingPartner(battlerAtk, battlerDef)) + if (IS_TARGETING_PARTNER(battlerAtk, battlerDef)) { - if (GetMoveDamageResult(move) == MOVE_POWER_OTHER) + if (GetMoveDamageResult(battlerAtk, battlerDef, AI_THINKING_STRUCT->movesetIndex) == MOVE_POWER_OTHER) { // partner ability checks - if (!partnerProtecting && moveTarget != MOVE_TARGET_BOTH && !DoesBattlerIgnoreAbilityChecks(AI_DATA->abilities[battlerAtk], move)) + if (!partnerProtecting && moveTarget != MOVE_TARGET_BOTH && !DoesBattlerIgnoreAbilityChecks(aiData->abilities[battlerAtk], move)) { switch (atkPartnerAbility) { @@ -2862,7 +2882,7 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case ABILITY_WATER_COMPACTION: - if (moveType == TYPE_WATER && GetMoveDamageResult(move) == MOVE_POWER_WEAK) + if (moveType == TYPE_WATER && GetMoveDamageResult(battlerAtk, battlerDef, AI_THINKING_STRUCT->movesetIndex) == MOVE_POWER_WEAK) { RETURN_SCORE_PLUS(1); // only mon with this ability is weak to water so only make it okay if we do very little damage } @@ -2970,14 +2990,14 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_SKILL_SWAP: - if (AI_DATA->abilities[battlerAtk] != AI_DATA->abilities[BATTLE_PARTNER(battlerAtk)] && !attackerHasBadAbility) + if (aiData->abilities[battlerAtk] != aiData->abilities[BATTLE_PARTNER(battlerAtk)] && !attackerHasBadAbility) { - if (AI_DATA->abilities[BATTLE_PARTNER(battlerAtk)] == ABILITY_TRUANT) + if (aiData->abilities[BATTLE_PARTNER(battlerAtk)] == ABILITY_TRUANT) { RETURN_SCORE_PLUS(10); } - else if (AI_DATA->abilities[battlerAtk] == ABILITY_COMPOUND_EYES - && HasMoveWithLowAccuracy(battlerAtkPartner, FOE(battlerAtkPartner), 90, TRUE, atkPartnerAbility, AI_DATA->abilities[FOE(battlerAtkPartner)], atkPartnerHoldEffect, AI_DATA->holdEffects[FOE(battlerAtkPartner)])) + else if (aiData->abilities[battlerAtk] == ABILITY_COMPOUND_EYES + && HasMoveWithLowAccuracy(battlerAtkPartner, FOE(battlerAtkPartner), 90, TRUE, atkPartnerAbility, aiData->abilities[FOE(battlerAtkPartner)], atkPartnerHoldEffect, aiData->holdEffects[FOE(battlerAtkPartner)])) { RETURN_SCORE_PLUS(3); } @@ -2998,7 +3018,7 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_ENTRAINMENT: - if (partnerHasBadAbility && IsAbilityOfRating(AI_DATA->abilities[battlerAtk], 0)) + if (partnerHasBadAbility && IsAbilityOfRating(aiData->abilities[battlerAtk], 0)) { RETURN_SCORE_PLUS(1); } @@ -3016,7 +3036,7 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { u16 instructedMove; if (AI_WhoStrikesFirst(battlerAtk, battlerAtkPartner, move) == AI_IS_FASTER) - instructedMove = AI_DATA->partnerMove; + instructedMove = aiData->partnerMove; else instructedMove = gLastMoves[battlerAtkPartner]; @@ -3029,10 +3049,10 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_AFTER_YOU: - if (AI_WhoStrikesFirst(battlerAtkPartner, FOE(battlerAtkPartner), AI_DATA->partnerMove) == AI_IS_SLOWER // Opponent mon 1 goes before partner - || AI_WhoStrikesFirst(battlerAtkPartner, BATTLE_PARTNER(FOE(battlerAtkPartner)), AI_DATA->partnerMove) == AI_IS_SLOWER) // Opponent mon 2 goes before partner + if (AI_WhoStrikesFirst(battlerAtkPartner, FOE(battlerAtkPartner), aiData->partnerMove) == AI_IS_SLOWER // Opponent mon 1 goes before partner + || AI_WhoStrikesFirst(battlerAtkPartner, BATTLE_PARTNER(FOE(battlerAtkPartner)), aiData->partnerMove) == AI_IS_SLOWER) // Opponent mon 2 goes before partner { - if (gBattleMoves[AI_DATA->partnerMove].effect == EFFECT_COUNTER || gBattleMoves[AI_DATA->partnerMove].effect == EFFECT_MIRROR_COAT) + if (gBattleMoves[aiData->partnerMove].effect == EFFECT_COUNTER || gBattleMoves[aiData->partnerMove].effect == EFFECT_MIRROR_COAT) break; // These moves need to go last RETURN_SCORE_PLUS(1); } @@ -3055,9 +3075,9 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) switch (effect) { case EFFECT_SKILL_SWAP: - if (AI_DATA->abilities[battlerAtk] == ABILITY_TRUANT) + if (aiData->abilities[battlerAtk] == ABILITY_TRUANT) score += 5; - else if (IsAbilityOfRating(AI_DATA->abilities[battlerAtk], 0) || IsAbilityOfRating(AI_DATA->abilities[battlerDef], 10)) + else if (IsAbilityOfRating(aiData->abilities[battlerAtk], 0) || IsAbilityOfRating(aiData->abilities[battlerDef], 10)) score += 2; // we want to transfer our bad ability or take their awesome ability break; case EFFECT_EARTHQUAKE: @@ -3065,14 +3085,14 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (!IsBattlerGrounded(battlerAtkPartner) || (IsBattlerGrounded(battlerAtkPartner) && AI_WhoStrikesFirst(battlerAtk, battlerAtkPartner, move) == AI_IS_SLOWER - && IsUngroundingEffect(gBattleMoves[AI_DATA->partnerMove].effect))) + && IsUngroundingEffect(gBattleMoves[aiData->partnerMove].effect))) score += 2; else if (IS_BATTLER_OF_TYPE(battlerAtkPartner, TYPE_FIRE) || IS_BATTLER_OF_TYPE(battlerAtkPartner, TYPE_ELECTRIC) || IS_BATTLER_OF_TYPE(battlerAtkPartner, TYPE_POISON) || IS_BATTLER_OF_TYPE(battlerAtkPartner, TYPE_ROCK)) score -= 10; // partner will be hit by earthquake and is weak to it - else + else if (IsBattlerAlive(battlerAtkPartner)) score -= 3; break; } @@ -3083,7 +3103,7 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) return score; } -static bool32 IsPinchBerryItemEffect(u16 holdEffect) +static bool32 IsPinchBerryItemEffect(u32 holdEffect) { switch (holdEffect) { @@ -3102,7 +3122,7 @@ static bool32 IsPinchBerryItemEffect(u16 holdEffect) return FALSE; } -static u32 GetAIMostDamagingMoveId(u8 battlerAtk, u8 battlerDef) +static u32 GetAIMostDamagingMoveId(u32 battlerAtk, u32 battlerDef) { u32 i, id = 0; u32 mostDmg = 0; @@ -3116,20 +3136,22 @@ static u32 GetAIMostDamagingMoveId(u8 battlerAtk, u8 battlerDef) } // AI_FLAG_CHECK_VIABILITY - a weird mix of increasing and decreasing scores -static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) +static s32 AI_CheckViability(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) { // move data - u16 moveEffect = gBattleMoves[move].effect; - u32 effectiveness = AI_DATA->effectiveness[battlerAtk][battlerDef][AI_THINKING_STRUCT->movesetIndex]; - u8 atkPriority = GetMovePriority(battlerAtk, move); - u16 predictedMove = AI_DATA->predictedMoves[battlerDef]; + u32 moveEffect = gBattleMoves[move].effect; + struct AiLogicData *aiData = AI_DATA; + u32 effectiveness = aiData->effectiveness[battlerAtk][battlerDef][AI_THINKING_STRUCT->movesetIndex]; + s8 atkPriority = GetMovePriority(battlerAtk, move); + u32 predictedMove = aiData->predictedMoves[battlerDef]; + u32 predictedMoveSlot = GetMoveSlot(GetMovesArray(battlerDef), predictedMove); bool32 isDoubleBattle = IsValidDoubleBattle(battlerAtk); u32 i; // We only check for moves that have a 20% chance or more for their secondary effect to happen because moves with a smaller chance are rather worthless. We don't want the AI to use those. - bool32 sereneGraceBoost = (AI_DATA->abilities[battlerAtk] == ABILITY_SERENE_GRACE && (gBattleMoves[move].secondaryEffectChance >= 20 && gBattleMoves[move].secondaryEffectChance < 100)); + bool32 sereneGraceBoost = (aiData->abilities[battlerAtk] == ABILITY_SERENE_GRACE && (gBattleMoves[move].secondaryEffectChance >= 20 && gBattleMoves[move].secondaryEffectChance < 100)); // Targeting partner, check benefits of doing that instead - if (IsTargetingPartner(battlerAtk, battlerDef)) + if (IS_TARGETING_PARTNER(battlerAtk, battlerDef)) return score; // check always hits @@ -3139,7 +3161,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (gBattleMons[battlerDef].statStages[STAT_EVASION] > 6 || gBattleMons[battlerAtk].statStages[STAT_ACC] < 6) { u32 mostDmgMoveId = GetAIMostDamagingMoveId(battlerAtk, battlerDef); - u32 *dmgs = AI_DATA->simulatedDmg[battlerAtk][battlerDef]; + u32 *dmgs = aiData->simulatedDmg[battlerAtk][battlerDef]; if (GetNoOfHitsToKO(dmgs[mostDmgMoveId], gBattleMons[battlerDef].hp) == GetNoOfHitsToKO(dmgs[AI_THINKING_STRUCT->movesetIndex], gBattleMons[battlerDef].hp)) score++; } @@ -3150,11 +3172,11 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } // check high crit - if (TestMoveFlags(move, FLAG_HIGH_CRIT) && effectiveness >= AI_EFFECTIVENESS_x2 && AI_RandLessThan(128)) + if (gBattleMoves[move].highCritRatio && effectiveness >= AI_EFFECTIVENESS_x2 && AI_RandLessThan(128)) score++; // check already dead - if (!IsBattlerIncapacitated(battlerDef, AI_DATA->abilities[battlerDef]) + if (!IsBattlerIncapacitated(battlerDef, aiData->abilities[battlerDef]) && CanTargetFaintAi(battlerAtk, battlerDef) && AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_SLOWER) // Opponent should go first { @@ -3165,7 +3187,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } // check damage - if (gBattleMoves[move].power != 0 && GetMoveDamageResult(move) == MOVE_POWER_WEAK) + if (gBattleMoves[move].power != 0 && GetMoveDamageResult(battlerAtk, battlerDef, AI_THINKING_STRUCT->movesetIndex) == MOVE_POWER_WEAK) score--; // check status move preference @@ -3173,13 +3195,13 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score++; // check thawing moves - if ((gBattleMons[battlerAtk].status1 & (STATUS1_FREEZE | STATUS1_FROSTBITE)) && TestMoveFlags(move, FLAG_THAW_USER)) + if ((gBattleMons[battlerAtk].status1 & (STATUS1_FREEZE | STATUS1_FROSTBITE)) && gBattleMoves[move].thawsUser) score += (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) ? 20 : 10; // check burn if (gBattleMons[battlerAtk].status1 & STATUS1_BURN) { - switch (AI_DATA->abilities[battlerAtk]) + switch (aiData->abilities[battlerAtk]) { case ABILITY_GUTS: break; @@ -3198,7 +3220,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) // check frostbite if (gBattleMons[battlerAtk].status1 & STATUS1_FROSTBITE) { - switch (AI_DATA->abilities[battlerAtk]) + switch (aiData->abilities[battlerAtk]) { case ABILITY_GUTS: break; @@ -3215,7 +3237,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } // attacker ability checks - switch (AI_DATA->abilities[battlerAtk]) + switch (aiData->abilities[battlerAtk]) { case ABILITY_MOXIE: case ABILITY_BEAST_BOOST: @@ -3242,7 +3264,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) IncreaseSleepScore(battlerAtk, battlerDef, move, &score); break; case EFFECT_ABSORB: - if (AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_BIG_ROOT) + if (aiData->holdEffects[battlerAtk] == HOLD_EFFECT_BIG_ROOT) score++; if (effectiveness <= AI_EFFECTIVENESS_x0_5 && AI_RandLessThan(50)) score -= 3; @@ -3251,7 +3273,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_MEMENTO: if (AI_THINKING_STRUCT->aiFlags & AI_FLAG_WILL_SUICIDE && gBattleMons[battlerDef].statStages[STAT_EVASION] < 7) { - if (AI_DATA->hpPercents[battlerAtk] < 50 && AI_RandLessThan(128)) + if (aiData->hpPercents[battlerAtk] < 50 && AI_RandLessThan(128)) score++; } break; @@ -3270,7 +3292,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } else if (gBattleMons[battlerAtk].statStages[STAT_ATK] < 9) { - if (AI_DATA->hpPercents[battlerAtk] > 90 && AI_RandLessThan(128)) + if (aiData->hpPercents[battlerAtk] > 90 && AI_RandLessThan(128)) { score += 2; break; @@ -3287,16 +3309,16 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_DEFENSE_UP_3: if (!HasMoveWithSplit(battlerDef, SPLIT_PHYSICAL)) score -= 2; - if (AI_DATA->hpPercents[battlerAtk] > 90 && AI_RandLessThan(128)) + if (aiData->hpPercents[battlerAtk] > 90 && AI_RandLessThan(128)) score += 2; - else if (AI_DATA->hpPercents[battlerAtk] > 70 && AI_RandLessThan(200)) + else if (aiData->hpPercents[battlerAtk] > 70 && AI_RandLessThan(200)) break; - else if (AI_DATA->hpPercents[battlerAtk] < 40) + else if (aiData->hpPercents[battlerAtk] < 40) score -= 2; break; case EFFECT_SPEED_UP: case EFFECT_SPEED_UP_2: - if (!WillAIStrikeFirst()) + if (!AI_STRIKES_FIRST(battlerAtk, battlerDef, move)) { if (!AI_RandLessThan(70)) score += 3; @@ -3316,7 +3338,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } else if (gBattleMons[battlerAtk].statStages[STAT_SPATK] < 9) { - if (AI_DATA->hpPercents[battlerAtk] > 90 && AI_RandLessThan(128)) + if (aiData->hpPercents[battlerAtk] > 90 && AI_RandLessThan(128)) { score += 2; break; @@ -3332,29 +3354,29 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_SPECIAL_DEFENSE_UP_2: if (!HasMoveWithSplit(battlerDef, SPLIT_SPECIAL)) score -= 2; - if (AI_DATA->hpPercents[battlerAtk] > 90 && AI_RandLessThan(128)) + if (aiData->hpPercents[battlerAtk] > 90 && AI_RandLessThan(128)) score += 2; - else if (AI_DATA->hpPercents[battlerAtk] > 70 && AI_RandLessThan(200)) + else if (aiData->hpPercents[battlerAtk] > 70 && AI_RandLessThan(200)) break; - else if (AI_DATA->hpPercents[battlerAtk] < 40) + else if (aiData->hpPercents[battlerAtk] < 40) score -= 2; break; case EFFECT_ACCURACY_UP: case EFFECT_ACCURACY_UP_2: if (gBattleMons[battlerAtk].statStages[STAT_ACC] >= 9 && !AI_RandLessThan(50)) score -= 2; - else if (AI_DATA->hpPercents[battlerAtk] <= 70) + else if (aiData->hpPercents[battlerAtk] <= 70) score -= 2; else score++; break; case EFFECT_EVASION_UP: case EFFECT_EVASION_UP_2: - if (AI_DATA->hpPercents[battlerAtk] > 90 && !AI_RandLessThan(100)) + if (aiData->hpPercents[battlerAtk] > 90 && !AI_RandLessThan(100)) score += 3; if (gBattleMons[battlerAtk].statStages[STAT_EVASION] > 9 && AI_RandLessThan(128)) score--; - if ((gBattleMons[battlerDef].status1 & STATUS1_PSN_ANY) && AI_DATA->hpPercents[battlerAtk] >= 50 && !AI_RandLessThan(80)) + if ((gBattleMons[battlerDef].status1 & STATUS1_PSN_ANY) && aiData->hpPercents[battlerAtk] >= 50 && !AI_RandLessThan(80)) score += 3; if (gStatuses3[battlerDef] & STATUS3_LEECHSEED && !AI_RandLessThan(70)) score += 3; @@ -3362,9 +3384,9 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score += 2; if (gBattleMons[battlerDef].status2 & STATUS2_CURSED && !AI_RandLessThan(70)) score += 3; - if (AI_DATA->hpPercents[battlerAtk] < 70 || gBattleMons[battlerAtk].statStages[STAT_EVASION] == DEFAULT_STAT_STAGE) + if (aiData->hpPercents[battlerAtk] < 70 || gBattleMons[battlerAtk].statStages[STAT_EVASION] == DEFAULT_STAT_STAGE) break; - else if (AI_DATA->hpPercents[battlerAtk] < 40 || AI_DATA->hpPercents[battlerDef] < 40) + else if (aiData->hpPercents[battlerAtk] < 40 || aiData->hpPercents[battlerDef] < 40) score -= 2; else if (!AI_RandLessThan(70)) score -= 2; @@ -3372,61 +3394,61 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) // stat lowering effects case EFFECT_ATTACK_DOWN: case EFFECT_ATTACK_DOWN_2: - if (!ShouldLowerAttack(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef])) + if (!ShouldLowerAttack(battlerAtk, battlerDef, aiData->abilities[battlerDef])) score -= 2; if (gBattleMons[battlerDef].statStages[STAT_ATK] < DEFAULT_STAT_STAGE) score--; - else if (AI_DATA->hpPercents[battlerAtk] <= 90) + else if (aiData->hpPercents[battlerAtk] <= 90) score--; if (gBattleMons[battlerDef].statStages[STAT_ATK] > 3 && !AI_RandLessThan(50)) score -= 2; - else if (AI_DATA->hpPercents[battlerDef] < 70) + else if (aiData->hpPercents[battlerDef] < 70) score -= 2; break; case EFFECT_DEFENSE_DOWN: case EFFECT_DEFENSE_DOWN_2: - if (!ShouldLowerDefense(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef])) + if (!ShouldLowerDefense(battlerAtk, battlerDef, aiData->abilities[battlerDef])) score -= 2; - if ((AI_DATA->hpPercents[battlerAtk] < 70 && !AI_RandLessThan(50)) || (gBattleMons[battlerDef].statStages[STAT_DEF] <= 3 && !AI_RandLessThan(50))) + if ((aiData->hpPercents[battlerAtk] < 70 && !AI_RandLessThan(50)) || (gBattleMons[battlerDef].statStages[STAT_DEF] <= 3 && !AI_RandLessThan(50))) score -= 2; - if (AI_DATA->hpPercents[battlerDef] <= 70) + if (aiData->hpPercents[battlerDef] <= 70) score -= 2; break; case EFFECT_SPEED_DOWN: case EFFECT_SPEED_DOWN_2: - if (WillAIStrikeFirst()) + if (AI_STRIKES_FIRST(battlerAtk, battlerDef, move)) score -= 3; else if (!AI_RandLessThan(70)) score += 2; break; case EFFECT_SPECIAL_ATTACK_DOWN: case EFFECT_SPECIAL_ATTACK_DOWN_2: - if (!ShouldLowerSpAtk(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef])) + if (!ShouldLowerSpAtk(battlerAtk, battlerDef, aiData->abilities[battlerDef])) score -= 2; if (gBattleMons[battlerDef].statStages[STAT_SPATK] < DEFAULT_STAT_STAGE) score--; - else if (AI_DATA->hpPercents[battlerAtk] <= 90) + else if (aiData->hpPercents[battlerAtk] <= 90) score--; if (gBattleMons[battlerDef].statStages[STAT_SPATK] > 3 && !AI_RandLessThan(50)) score -= 2; - else if (AI_DATA->hpPercents[battlerDef] < 70) + else if (aiData->hpPercents[battlerDef] < 70) score -= 2; break; case EFFECT_SPECIAL_DEFENSE_DOWN: case EFFECT_SPECIAL_DEFENSE_DOWN_2: - if (!ShouldLowerSpDef(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef])) + if (!ShouldLowerSpDef(battlerAtk, battlerDef, aiData->abilities[battlerDef])) score -= 2; - if ((AI_DATA->hpPercents[battlerAtk] < 70 && !AI_RandLessThan(50)) + if ((aiData->hpPercents[battlerAtk] < 70 && !AI_RandLessThan(50)) || (gBattleMons[battlerDef].statStages[STAT_SPDEF] <= 3 && !AI_RandLessThan(50))) score -= 2; - if (AI_DATA->hpPercents[battlerDef] <= 70) + if (aiData->hpPercents[battlerDef] <= 70) score -= 2; break; case EFFECT_ACCURACY_DOWN: case EFFECT_ACCURACY_DOWN_2: - if (ShouldLowerAccuracy(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef])) + if (ShouldLowerAccuracy(battlerAtk, battlerDef, aiData->abilities[battlerDef])) score -= 2; - if ((AI_DATA->hpPercents[battlerAtk] < 70 || AI_DATA->hpPercents[battlerDef] < 70) && AI_RandLessThan(100)) + if ((aiData->hpPercents[battlerAtk] < 70 || aiData->hpPercents[battlerDef] < 70) && AI_RandLessThan(100)) score--; if (gBattleMons[battlerDef].statStages[STAT_ACC] <= 4 && !AI_RandLessThan(80)) score -= 2; @@ -3438,26 +3460,26 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score++; if (gBattleMons[battlerDef].status2 & STATUS2_CURSED && !AI_RandLessThan(70)) score += 2; - if (AI_DATA->hpPercents[battlerAtk] > 70 || gBattleMons[battlerDef].statStages[STAT_ACC] < DEFAULT_STAT_STAGE) + if (aiData->hpPercents[battlerAtk] > 70 || gBattleMons[battlerDef].statStages[STAT_ACC] < DEFAULT_STAT_STAGE) break; - else if (AI_DATA->hpPercents[battlerAtk] < 40 || AI_DATA->hpPercents[battlerDef] < 40 || !AI_RandLessThan(70)) + else if (aiData->hpPercents[battlerAtk] < 40 || aiData->hpPercents[battlerDef] < 40 || !AI_RandLessThan(70)) score -= 2; break; case EFFECT_EVASION_DOWN: case EFFECT_EVASION_DOWN_2: - if (!ShouldLowerEvasion(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef])) + if (!ShouldLowerEvasion(battlerAtk, battlerDef, aiData->abilities[battlerDef])) score -= 2; - if ((AI_DATA->hpPercents[battlerAtk] < 70 || gBattleMons[battlerDef].statStages[STAT_EVASION] <= 3) && !AI_RandLessThan(50)) + if ((aiData->hpPercents[battlerAtk] < 70 || gBattleMons[battlerDef].statStages[STAT_EVASION] <= 3) && !AI_RandLessThan(50)) score -= 2; - if (AI_DATA->hpPercents[battlerDef] <= 70) + if (aiData->hpPercents[battlerDef] <= 70) score -= 2; if (gBattleMons[battlerAtk].statStages[STAT_ACC] < DEFAULT_STAT_STAGE) score++; - if (gBattleMons[battlerDef].statStages[STAT_EVASION] < 7 || AI_DATA->abilities[battlerAtk] == ABILITY_NO_GUARD) + if (gBattleMons[battlerDef].statStages[STAT_EVASION] < 7 || aiData->abilities[battlerAtk] == ABILITY_NO_GUARD) score -= 2; break; case EFFECT_BIDE: - if (AI_DATA->hpPercents[battlerAtk] < 90) + if (aiData->hpPercents[battlerAtk] < 90) score -= 2; break; case EFFECT_DREAM_EATER: @@ -3473,7 +3495,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_GROWTH: case EFFECT_ATTACK_SPATK_UP: // work up - if (AI_DATA->hpPercents[battlerAtk] <= 40 || AI_DATA->abilities[battlerAtk] == ABILITY_CONTRARY) + if (aiData->hpPercents[battlerAtk] <= 40 || aiData->abilities[battlerAtk] == ABILITY_CONTRARY) break; if (HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) @@ -3483,7 +3505,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_HAZE: if (AnyStatIsRaised(BATTLE_PARTNER(battlerAtk)) - || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + || PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove)) score -= 3; break; // fallthrough @@ -3496,9 +3518,9 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_MULTI_HIT: case EFFECT_TRIPLE_KICK: - if (AI_MoveMakesContact(AI_DATA->abilities[battlerAtk], AI_DATA->holdEffects[battlerAtk], move) - && AI_DATA->abilities[battlerAtk] != ABILITY_MAGIC_GUARD - && AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_ROCKY_HELMET) + if (AI_MoveMakesContact(aiData->abilities[battlerAtk], aiData->holdEffects[battlerAtk], move) + && aiData->abilities[battlerAtk] != ABILITY_MAGIC_GUARD + && aiData->holdEffects[battlerDef] == HOLD_EFFECT_ROCKY_HELMET) score -= 2; break; case EFFECT_CONVERSION: @@ -3506,7 +3528,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score++; break; case EFFECT_FLINCH_HIT: - score += ShouldTryToFlinch(battlerAtk, battlerDef, AI_DATA->abilities[battlerAtk], AI_DATA->abilities[battlerDef], move); + score += ShouldTryToFlinch(battlerAtk, battlerDef, aiData->abilities[battlerAtk], aiData->abilities[battlerDef], move); break; case EFFECT_SWALLOW: if (gDisableStructs[battlerAtk].stockpileCounter == 0) @@ -3543,12 +3565,13 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_MOONLIGHT: if (ShouldRecover(battlerAtk, battlerDef, move, 50)) score += 3; - if (AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_BIG_ROOT) + if (aiData->holdEffects[battlerAtk] == HOLD_EFFECT_BIG_ROOT) score++; break; case EFFECT_TOXIC: case EFFECT_POISON: case EFFECT_BARB_BARRAGE: + case EFFECT_MORTAL_SPIN: IncreasePoisonScore(battlerAtk, battlerDef, move, &score); break; case EFFECT_LIGHT_SCREEN: @@ -3557,26 +3580,26 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (ShouldSetScreen(battlerAtk, battlerDef, moveEffect)) { score += 5; - if (AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_LIGHT_CLAY) + if (aiData->holdEffects[battlerAtk] == HOLD_EFFECT_LIGHT_CLAY) score += 2; if (AI_THINKING_STRUCT->aiFlags & AI_FLAG_SCREENER) score += 2; } break; case EFFECT_REST: - if (!(AI_CanSleep(battlerAtk, AI_DATA->abilities[battlerAtk]))) + if (!(AI_CanSleep(battlerAtk, aiData->abilities[battlerAtk]))) { break; } else if (ShouldRecover(battlerAtk, battlerDef, move, 100)) { - if (AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_CURE_SLP - || AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_CURE_STATUS + if (aiData->holdEffects[battlerAtk] == HOLD_EFFECT_CURE_SLP + || aiData->holdEffects[battlerAtk] == HOLD_EFFECT_CURE_STATUS || HasMoveEffect(EFFECT_SLEEP_TALK, battlerAtk) || HasMoveEffect(EFFECT_SNORE, battlerAtk) - || AI_DATA->abilities[battlerAtk] == ABILITY_SHED_SKIN - || AI_DATA->abilities[battlerAtk] == ABILITY_EARLY_BIRD - || (gBattleWeather & B_WEATHER_RAIN && gWishFutureKnock.weatherDuration != 1 && AI_DATA->abilities[battlerAtk] == ABILITY_HYDRATION && AI_DATA->holdEffects[battlerAtk] != HOLD_EFFECT_UTILITY_UMBRELLA)) + || aiData->abilities[battlerAtk] == ABILITY_SHED_SKIN + || aiData->abilities[battlerAtk] == ABILITY_EARLY_BIRD + || (AI_GetWeather(aiData) & B_WEATHER_RAIN && gWishFutureKnock.weatherDuration != 1 && aiData->abilities[battlerAtk] == ABILITY_HYDRATION && aiData->holdEffects[battlerAtk] != HOLD_EFFECT_UTILITY_UMBRELLA)) { score += 2; } @@ -3606,10 +3629,10 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_FOCUS_ENERGY: case EFFECT_LASER_FOCUS: - if (AI_DATA->abilities[battlerAtk] == ABILITY_SUPER_LUCK - || AI_DATA->abilities[battlerAtk] == ABILITY_SNIPER - || AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_SCOPE_LENS - || TestMoveFlagsInMoveset(battlerAtk, FLAG_HIGH_CRIT)) + if (aiData->abilities[battlerAtk] == ABILITY_SUPER_LUCK + || aiData->abilities[battlerAtk] == ABILITY_SNIPER + || aiData->holdEffects[battlerAtk] == HOLD_EFFECT_SCOPE_LENS + || HasHighCritRatioMove(battlerAtk)) score += 2; break; case EFFECT_CONFUSE_HIT: @@ -3632,17 +3655,17 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_SPECIAL_DEFENSE_DOWN_HIT: case EFFECT_ACCURACY_DOWN_HIT: case EFFECT_EVASION_DOWN_HIT: - if (sereneGraceBoost && AI_DATA->abilities[battlerDef] != ABILITY_CONTRARY) + if (sereneGraceBoost && aiData->abilities[battlerDef] != ABILITY_CONTRARY) score += 2; break; case EFFECT_SPEED_DOWN_HIT: - if (WillAIStrikeFirst()) + if (AI_STRIKES_FIRST(battlerAtk, battlerDef, move)) score -= 2; else if (!AI_RandLessThan(70)) score++; - if (ShouldLowerSpeed(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef])) + if (ShouldLowerSpeed(battlerAtk, battlerDef, aiData->abilities[battlerDef])) { - if (sereneGraceBoost && AI_DATA->abilities[battlerDef] != ABILITY_CONTRARY) + if (sereneGraceBoost && aiData->abilities[battlerDef] != ABILITY_CONTRARY) score += 5; else score += 2; @@ -3661,7 +3684,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) || HasMoveEffect(battlerDef, EFFECT_CONFUSE) || HasMoveEffect(battlerDef, EFFECT_LEECH_SEED)) score += 2; - if (!gBattleMons[battlerDef].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION && AI_DATA->hpPercents[battlerAtk] > 70)) + if (!gBattleMons[battlerDef].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION && aiData->hpPercents[battlerAtk] > 70)) score++; break; case EFFECT_MIMIC: @@ -3675,8 +3698,8 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_GRASS) || gStatuses3[battlerDef] & STATUS3_LEECHSEED || HasMoveEffect(battlerDef, EFFECT_RAPID_SPIN) - || AI_DATA->abilities[battlerDef] == ABILITY_LIQUID_OOZE - || AI_DATA->abilities[battlerDef] == ABILITY_MAGIC_GUARD) + || aiData->abilities[battlerDef] == ABILITY_LIQUID_OOZE + || aiData->abilities[battlerDef] == ABILITY_MAGIC_GUARD) break; score += 3; if (!HasDamagingMove(battlerDef) || IsBattlerTrapped(battlerDef, FALSE)) @@ -3693,7 +3716,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_PARTING_SHOT: if (!IsDoubleBattle()) { - switch (ShouldPivot(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], move, AI_THINKING_STRUCT->movesetIndex)) + switch (ShouldPivot(battlerAtk, battlerDef, aiData->abilities[battlerDef], move, AI_THINKING_STRUCT->movesetIndex)) { case 0: // no score -= 10; // technically should go in CheckBadMove, but this is easier/less computationally demanding @@ -3715,7 +3738,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_BATON_PASS: - if (ShouldSwitch() && (gBattleMons[battlerAtk].status2 & STATUS2_SUBSTITUTE + if (ShouldSwitch(battlerAtk) && (gBattleMons[battlerAtk].status2 & STATUS2_SUBSTITUTE || (gStatuses3[battlerAtk] & (STATUS3_ROOTED | STATUS3_AQUA_RING | STATUS3_MAGNET_RISE | STATUS3_POWER_TRICK)) || AnyStatIsRaised(battlerAtk))) score += 5; @@ -3723,7 +3746,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_DISABLE: if (gDisableStructs[battlerDef].disableTimer == 0 #if B_MENTAL_HERB >= GEN_5 - && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB // mental herb + && aiData->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB // mental herb #endif ) { @@ -3732,10 +3755,9 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (gLastMoves[battlerDef] != MOVE_NONE && gLastMoves[battlerDef] != 0xFFFF) { - /* TODO predicted moves if (gLastMoves[battlerDef] == predictedMove) score += 3; - else */if (CanMoveFaintBattler(gLastMoves[battlerDef], battlerDef, battlerAtk, 1)) + else if (CanTargetMoveFaintAi(gLastMoves[battlerDef], battlerDef, battlerAtk, 1)) score += 2; //Disable move that can kill attacker } } @@ -3748,7 +3770,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_ENCORE: if (gDisableStructs[battlerDef].encoreTimer == 0 #if B_MENTAL_HERB >= GEN_5 - && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB // mental herb + && aiData->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB // mental herb #endif ) { @@ -3758,9 +3780,9 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_PAIN_SPLIT: { - u16 newHp = (gBattleMons[battlerAtk].hp + gBattleMons[battlerDef].hp) / 2; - u16 healthBenchmark = (gBattleMons[battlerAtk].hp * 12) / 10; - if (newHp > healthBenchmark && ShouldAbsorb(battlerAtk, battlerDef, move, AI_DATA->simulatedDmg[battlerAtk][battlerDef][AI_THINKING_STRUCT->movesetIndex])) + u32 newHp = (gBattleMons[battlerAtk].hp + gBattleMons[battlerDef].hp) / 2; + u32 healthBenchmark = (gBattleMons[battlerAtk].hp * 12) / 10; + if (newHp > healthBenchmark && ShouldAbsorb(battlerAtk, battlerDef, move, aiData->simulatedDmg[battlerAtk][battlerDef][AI_THINKING_STRUCT->movesetIndex])) score += 2; } break; @@ -3772,15 +3794,15 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_LOCK_ON: if (HasMoveEffect(battlerAtk, EFFECT_OHKO)) score += 3; - else if (AI_DATA->abilities[battlerAtk] == ABILITY_COMPOUND_EYES && HasMoveWithLowAccuracy(battlerAtk, battlerDef, 80, TRUE, AI_DATA->abilities[battlerAtk], AI_DATA->abilities[battlerDef], AI_DATA->holdEffects[battlerAtk], AI_DATA->holdEffects[battlerDef])) + else if (aiData->abilities[battlerAtk] == ABILITY_COMPOUND_EYES && HasMoveWithLowAccuracy(battlerAtk, battlerDef, 80, TRUE, aiData->abilities[battlerAtk], aiData->abilities[battlerDef], aiData->holdEffects[battlerAtk], aiData->holdEffects[battlerDef])) score += 3; - else if (HasMoveWithLowAccuracy(battlerAtk, battlerDef, 85, TRUE, AI_DATA->abilities[battlerAtk], AI_DATA->abilities[battlerDef], AI_DATA->holdEffects[battlerAtk], AI_DATA->holdEffects[battlerDef])) + else if (HasMoveWithLowAccuracy(battlerAtk, battlerDef, 85, TRUE, aiData->abilities[battlerAtk], aiData->abilities[battlerDef], aiData->holdEffects[battlerAtk], aiData->holdEffects[battlerDef])) score += 3; - else if (HasMoveWithLowAccuracy(battlerAtk, battlerDef, 90, TRUE, AI_DATA->abilities[battlerAtk], AI_DATA->abilities[battlerDef], AI_DATA->holdEffects[battlerAtk], AI_DATA->holdEffects[battlerDef])) + else if (HasMoveWithLowAccuracy(battlerAtk, battlerDef, 90, TRUE, aiData->abilities[battlerAtk], aiData->abilities[battlerDef], aiData->holdEffects[battlerAtk], aiData->holdEffects[battlerDef])) score++; break; case EFFECT_SPEED_UP_HIT: - if (sereneGraceBoost && AI_DATA->abilities[battlerDef] != ABILITY_CONTRARY && !WillAIStrikeFirst()) + if (sereneGraceBoost && aiData->abilities[battlerDef] != ABILITY_CONTRARY && !AI_STRIKES_FIRST(battlerAtk, battlerDef, move)) score += 3; break; case EFFECT_DESTINY_BOND: @@ -3793,7 +3815,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_WISH: case EFFECT_HEAL_BELL: if (ShouldUseWishAromatherapy(battlerAtk, battlerDef, move)) - score += 7; + score += 3; break; case EFFECT_THIEF: { @@ -3805,14 +3827,14 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER || GetBattlerSide(battlerAtk) == B_SIDE_PLAYER) canSteal = TRUE; - if (canSteal && AI_DATA->items[battlerAtk] == ITEM_NONE - && AI_DATA->items[battlerDef] != ITEM_NONE - && CanBattlerGetOrLoseItem(battlerDef, AI_DATA->items[battlerDef]) - && CanBattlerGetOrLoseItem(battlerAtk, AI_DATA->items[battlerDef]) + if (canSteal && aiData->items[battlerAtk] == ITEM_NONE + && aiData->items[battlerDef] != ITEM_NONE + && CanBattlerGetOrLoseItem(battlerDef, aiData->items[battlerDef]) + && CanBattlerGetOrLoseItem(battlerAtk, aiData->items[battlerDef]) && !HasMoveEffect(battlerAtk, EFFECT_ACROBATICS) - && AI_DATA->abilities[battlerDef] != ABILITY_STICKY_HOLD) + && aiData->abilities[battlerDef] != ABILITY_STICKY_HOLD) { - switch (AI_DATA->holdEffects[battlerDef]) + switch (aiData->holdEffects[battlerDef]) { case HOLD_EFFECT_NONE: break; @@ -3822,11 +3844,11 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score += 2; break; case HOLD_EFFECT_TOXIC_ORB: - if (ShouldPoisonSelf(battlerAtk, AI_DATA->abilities[battlerAtk])) + if (ShouldPoisonSelf(battlerAtk, aiData->abilities[battlerAtk])) score += 2; break; case HOLD_EFFECT_FLAME_ORB: - if (ShouldBurnSelf(battlerAtk, AI_DATA->abilities[battlerAtk])) + if (ShouldBurnSelf(battlerAtk, aiData->abilities[battlerAtk])) score += 2; break; case HOLD_EFFECT_BLACK_SLUDGE: @@ -3849,7 +3871,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_NIGHTMARE: - if (AI_DATA->abilities[battlerDef] != ABILITY_MAGIC_GUARD + if (aiData->abilities[battlerDef] != ABILITY_MAGIC_GUARD && !(gBattleMons[battlerDef].status2 & STATUS2_NIGHTMARE) && AI_IsBattlerAsleepOrComatose(battlerDef)) { @@ -3869,7 +3891,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } else { - if (AI_DATA->abilities[battlerAtk] == ABILITY_CONTRARY || AI_DATA->abilities[battlerDef] == ABILITY_MAGIC_GUARD) + if (aiData->abilities[battlerAtk] == ABILITY_CONTRARY || aiData->abilities[battlerDef] == ABILITY_MAGIC_GUARD) break; else if (gBattleMons[battlerAtk].statStages[STAT_ATK] < 8) score += (8 - gBattleMons[battlerAtk].statStages[STAT_ATK]); @@ -3893,9 +3915,9 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { ProtectChecks(battlerAtk, battlerDef, move, predictedMove, &score); } - else if (isDoubleBattle && AI_GetBattlerMoveTargetType(BATTLE_PARTNER(battlerAtk), AI_DATA->partnerMove) & MOVE_TARGET_FOES_AND_ALLY) + else if (isDoubleBattle && AI_GetBattlerMoveTargetType(BATTLE_PARTNER(battlerAtk), aiData->partnerMove) & MOVE_TARGET_FOES_AND_ALLY) { - if (AI_DATA->abilities[battlerAtk] != ABILITY_TELEPATHY) + if (aiData->abilities[battlerAtk] != ABILITY_TELEPATHY) ProtectChecks(battlerAtk, battlerDef, move, predictedMove, &score); } break; @@ -3910,9 +3932,9 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) ProtectChecks(battlerAtk, battlerDef, move, predictedMove, &score); break; case MOVE_KINGS_SHIELD: - if (AI_DATA->abilities[battlerAtk] == ABILITY_STANCE_CHANGE //Special logic for Aegislash + if (aiData->abilities[battlerAtk] == ABILITY_STANCE_CHANGE //Special logic for Aegislash && gBattleMons[battlerAtk].species == SPECIES_AEGISLASH_BLADE - && !IsBattlerIncapacitated(battlerDef, AI_DATA->abilities[battlerDef])) + && !IsBattlerIncapacitated(battlerDef, aiData->abilities[battlerDef])) { score += 3; break; @@ -3927,7 +3949,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (CanTargetFaintAi(battlerDef, battlerAtk)) { if (gBattleMons[battlerAtk].hp > gBattleMons[battlerAtk].maxHP / 4 // Pinch berry couldn't have activated yet - && IsPinchBerryItemEffect(AI_DATA->holdEffects[battlerAtk])) + && IsPinchBerryItemEffect(aiData->holdEffects[battlerAtk])) { score += 3; } @@ -3944,14 +3966,14 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_STEALTH_ROCK: case EFFECT_STICKY_WEB: case EFFECT_TOXIC_SPIKES: - if (AI_DATA->abilities[battlerDef] == ABILITY_MAGIC_BOUNCE || CountUsablePartyMons(battlerDef) == 0) + if (aiData->abilities[battlerDef] == ABILITY_MAGIC_BOUNCE || CountUsablePartyMons(battlerDef) == 0) break; if (gDisableStructs[battlerAtk].isFirstTurn) score += 2; //TODO - track entire opponent party data to determine hazard effectiveness break; case EFFECT_FORESIGHT: - if (AI_DATA->abilities[battlerAtk] == ABILITY_SCRAPPY) + if (aiData->abilities[battlerAtk] == ABILITY_SCRAPPY) break; else if (gBattleMons[battlerDef].statStages[STAT_EVASION] > DEFAULT_STAT_STAGE || (IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST) @@ -3969,10 +3991,10 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score += 3; break; case EFFECT_SANDSTORM: - if (ShouldSetSandstorm(battlerAtk, AI_DATA->holdEffects[battlerAtk], AI_DATA->holdEffects[battlerAtk])) + if (ShouldSetSandstorm(battlerAtk, aiData->holdEffects[battlerAtk], aiData->holdEffects[battlerAtk])) { score++; - if (AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_SMOOTH_ROCK) + if (aiData->holdEffects[battlerAtk] == HOLD_EFFECT_SMOOTH_ROCK) score++; if (HasMoveEffect(battlerDef, EFFECT_MORNING_SUN) || HasMoveEffect(battlerDef, EFFECT_SYNTHESIS) @@ -3981,14 +4003,14 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_HAIL: - if (ShouldSetHail(battlerAtk, AI_DATA->abilities[battlerAtk], AI_DATA->holdEffects[battlerAtk])) + if (ShouldSetHail(battlerAtk, aiData->abilities[battlerAtk], aiData->holdEffects[battlerAtk])) { if ((HasMoveEffect(battlerAtk, EFFECT_AURORA_VEIL) || HasMoveEffect(BATTLE_PARTNER(battlerAtk), EFFECT_AURORA_VEIL)) && ShouldSetScreen(battlerAtk, battlerDef, EFFECT_AURORA_VEIL)) score += 3; score++; - if (AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_ICY_ROCK) + if (aiData->holdEffects[battlerAtk] == HOLD_EFFECT_ICY_ROCK) score++; if (HasMoveEffect(battlerDef, EFFECT_MORNING_SUN) || HasMoveEffect(battlerDef, EFFECT_SYNTHESIS) @@ -3997,14 +4019,14 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_SNOWSCAPE: - if (ShouldSetSnow(battlerAtk, AI_DATA->abilities[battlerAtk], AI_DATA->holdEffects[battlerAtk])) + if (ShouldSetSnow(battlerAtk, aiData->abilities[battlerAtk], aiData->holdEffects[battlerAtk])) { if ((HasMoveEffect(battlerAtk, EFFECT_AURORA_VEIL) || HasMoveEffect(BATTLE_PARTNER(battlerAtk), EFFECT_AURORA_VEIL)) && ShouldSetScreen(battlerAtk, battlerDef, EFFECT_AURORA_VEIL)) score += 3; score++; - if (AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_ICY_ROCK) + if (aiData->holdEffects[battlerAtk] == HOLD_EFFECT_ICY_ROCK) score++; if (HasMoveEffect(battlerDef, EFFECT_MORNING_SUN) || HasMoveEffect(battlerDef, EFFECT_SYNTHESIS) @@ -4013,10 +4035,10 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_RAIN_DANCE: - if (ShouldSetRain(battlerAtk, AI_DATA->abilities[battlerAtk], AI_DATA->holdEffects[battlerAtk])) + if (ShouldSetRain(battlerAtk, aiData->abilities[battlerAtk], aiData->holdEffects[battlerAtk])) { score++; - if (AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_DAMP_ROCK) + if (aiData->holdEffects[battlerAtk] == HOLD_EFFECT_DAMP_ROCK) score++; if (HasMoveEffect(battlerDef, EFFECT_MORNING_SUN) || HasMoveEffect(battlerDef, EFFECT_SYNTHESIS) @@ -4027,10 +4049,10 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_SUNNY_DAY: - if (ShouldSetSun(battlerAtk, AI_DATA->abilities[battlerAtk], AI_DATA->holdEffects[battlerAtk])) + if (ShouldSetSun(battlerAtk, aiData->abilities[battlerAtk], aiData->holdEffects[battlerAtk])) { score++; - if (AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_HEAT_ROCK) + if (aiData->holdEffects[battlerAtk] == HOLD_EFFECT_HEAT_ROCK) score++; if (HasMoveWithType(battlerDef, TYPE_WATER) || HasMoveWithType(BATTLE_PARTNER(battlerDef), TYPE_WATER)) score++; @@ -4048,7 +4070,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_FELL_STINGER: if (gBattleMons[battlerAtk].statStages[STAT_ATK] < MAX_STAT_STAGE - && AI_DATA->abilities[battlerAtk] != ABILITY_CONTRARY + && aiData->abilities[battlerAtk] != ABILITY_CONTRARY && CanIndexMoveFaintTarget(battlerAtk, battlerDef, AI_THINKING_STRUCT->movesetIndex, 0)) { if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // Attacker goes first @@ -4058,7 +4080,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_BELLY_DRUM: - if (!CanTargetFaintAi(battlerDef, battlerAtk) && HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL) && AI_DATA->abilities[battlerAtk] != ABILITY_CONTRARY) + if (!CanTargetFaintAi(battlerDef, battlerAtk) && HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL) && aiData->abilities[battlerAtk] != ABILITY_CONTRARY) score += (MAX_STAT_STAGE - gBattleMons[battlerAtk].statStages[STAT_ATK]); break; case EFFECT_PSYCH_UP: @@ -4114,12 +4136,16 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) IncreaseStatUpScore(battlerAtk, battlerDef, STAT_DEF, &score); break; case EFFECT_FAKE_OUT: - if (move == MOVE_FAKE_OUT // filter out first impression - && ShouldFakeOut(battlerAtk, battlerDef, move)) - score += 8; + if (move == MOVE_FAKE_OUT) // filter out first impression + { + if (ShouldFakeOut(battlerAtk, battlerDef, move)) + score += 4; + else + score -= 10; + } break; case EFFECT_STOCKPILE: - if (AI_DATA->abilities[battlerAtk] == ABILITY_CONTRARY) + if (aiData->abilities[battlerAtk] == ABILITY_CONTRARY) break; if (HasMoveEffect(battlerAtk, EFFECT_SWALLOW) || HasMoveEffect(battlerAtk, EFFECT_SPIT_UP)) @@ -4142,7 +4168,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) || HasMoveEffect(battlerAtk, EFFECT_SPECTRAL_THIEF)) score++; - if (AI_DATA->abilities[battlerDef] == ABILITY_CONTRARY) + if (aiData->abilities[battlerDef] == ABILITY_CONTRARY) score += 2; IncreaseConfusionScore(battlerAtk, battlerDef, move, &score); @@ -4152,17 +4178,17 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) || HasMoveEffect(battlerAtk, EFFECT_SPECTRAL_THIEF)) score += 2; - if (AI_DATA->abilities[battlerDef] == ABILITY_CONTRARY) + if (aiData->abilities[battlerDef] == ABILITY_CONTRARY) score += 2; IncreaseConfusionScore(battlerAtk, battlerDef, move, &score); break; case EFFECT_FURY_CUTTER: - if (!isDoubleBattle && AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_METRONOME) + if (!isDoubleBattle && aiData->holdEffects[battlerAtk] == HOLD_EFFECT_METRONOME) score += 3; break; case EFFECT_ATTRACT: - if (!isDoubleBattle && BattlerWillFaintFromSecondaryDamage(battlerDef, AI_DATA->abilities[battlerDef]) + if (!isDoubleBattle && BattlerWillFaintFromSecondaryDamage(battlerDef, aiData->abilities[battlerDef]) && AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_SLOWER) // Target goes first break; // Don't use if the attract won't have a change to activate @@ -4207,16 +4233,16 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { if (isDoubleBattle) { - if (IsHazardMoveEffect(gBattleMoves[AI_DATA->partnerMove].effect) // Partner is going to set up hazards + if (IsHazardMoveEffect(gBattleMoves[aiData->partnerMove].effect) // Partner is going to set up hazards && AI_WhoStrikesFirst(battlerAtk, BATTLE_PARTNER(battlerAtk), move) == AI_IS_SLOWER) // Partner going first break; // Don't use Defog if partner is going to set up hazards } // check defog lowering evasion - if (ShouldLowerEvasion(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef])) + if (ShouldLowerEvasion(battlerAtk, battlerDef, aiData->abilities[battlerDef])) { if (gBattleMons[battlerDef].statStages[STAT_EVASION] > 7 - || HasMoveWithLowAccuracy(battlerAtk, battlerDef, 90, TRUE, AI_DATA->abilities[battlerAtk], AI_DATA->abilities[battlerDef], AI_DATA->holdEffects[battlerAtk], AI_DATA->holdEffects[battlerDef])) + || HasMoveWithLowAccuracy(battlerAtk, battlerDef, 90, TRUE, aiData->abilities[battlerAtk], aiData->abilities[battlerDef], aiData->holdEffects[battlerAtk], aiData->holdEffects[battlerDef])) score += 2; // encourage lowering evasion if they are evasive or we have a move with low accuracy else score++; @@ -4224,6 +4250,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case MOVE_RAPID_SPIN: + case MOVE_MORTAL_SPIN: if (gStatuses3[battlerAtk] & STATUS3_LEECHSEED || gBattleMons[battlerAtk].status2 & STATUS2_WRAPPED) score += 3; break; @@ -4237,11 +4264,11 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_FOLLOW_ME: if (isDoubleBattle && move != MOVE_SPOTLIGHT - && !IsBattlerIncapacitated(battlerDef, AI_DATA->abilities[battlerDef]) - && (move != MOVE_RAGE_POWDER || IsAffectedByPowder(battlerDef, AI_DATA->abilities[battlerDef], AI_DATA->holdEffects[battlerDef])) // Rage Powder doesn't affect powder immunities + && !IsBattlerIncapacitated(battlerDef, aiData->abilities[battlerDef]) + && (move != MOVE_RAGE_POWDER || IsAffectedByPowder(battlerDef, aiData->abilities[battlerDef], aiData->holdEffects[battlerDef])) // Rage Powder doesn't affect powder immunities && IsBattlerAlive(BATTLE_PARTNER(battlerAtk))) { - u16 predictedMoveOnPartner = gLastMoves[BATTLE_PARTNER(battlerAtk)]; + u32 predictedMoveOnPartner = gLastMoves[BATTLE_PARTNER(battlerAtk)]; if (predictedMoveOnPartner != MOVE_NONE && !IS_MOVE_STATUS(predictedMoveOnPartner)) score += 3; } @@ -4263,7 +4290,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_TRICK: case EFFECT_BESTOW: - switch (AI_DATA->holdEffects[battlerAtk]) + switch (aiData->holdEffects[battlerAtk]) { case HOLD_EFFECT_CHOICE_SCARF: score += 2; // assume its beneficial @@ -4277,15 +4304,15 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score += 2; break; case HOLD_EFFECT_TOXIC_ORB: - if (!ShouldPoisonSelf(battlerAtk, AI_DATA->abilities[battlerAtk])) + if (!ShouldPoisonSelf(battlerAtk, aiData->abilities[battlerAtk])) score += 2; break; case HOLD_EFFECT_FLAME_ORB: - if (!ShouldBurnSelf(battlerAtk, AI_DATA->abilities[battlerAtk]) && AI_CanBeBurned(battlerAtk, AI_DATA->abilities[battlerDef])) + if (!ShouldBurnSelf(battlerAtk, aiData->abilities[battlerAtk]) && AI_CanBeBurned(battlerAtk, aiData->abilities[battlerDef])) score += 2; break; case HOLD_EFFECT_BLACK_SLUDGE: - if (!IS_BATTLER_OF_TYPE(battlerDef, TYPE_POISON) && AI_DATA->abilities[battlerDef] != ABILITY_MAGIC_GUARD) + if (!IS_BATTLER_OF_TYPE(battlerDef, TYPE_POISON) && aiData->abilities[battlerDef] != ABILITY_MAGIC_GUARD) score += 3; break; case HOLD_EFFECT_IRON_BALL: @@ -4297,17 +4324,17 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score += 3; break; case HOLD_EFFECT_UTILITY_UMBRELLA: - if (AI_DATA->abilities[battlerAtk] != ABILITY_SOLAR_POWER && AI_DATA->abilities[battlerAtk] != ABILITY_DRY_SKIN && AI_WeatherHasEffect()) + if (aiData->abilities[battlerAtk] != ABILITY_SOLAR_POWER && aiData->abilities[battlerAtk] != ABILITY_DRY_SKIN) { - switch (AI_DATA->abilities[battlerDef]) + switch (aiData->abilities[battlerDef]) { case ABILITY_SWIFT_SWIM: - if (gBattleWeather & B_WEATHER_RAIN) + if (AI_GetWeather(aiData) & B_WEATHER_RAIN) score += 3; // Slow 'em down break; case ABILITY_CHLOROPHYLL: case ABILITY_FLOWER_GIFT: - if (gBattleWeather & B_WEATHER_SUN) + if (AI_GetWeather(aiData) & B_WEATHER_SUN) score += 3; // Slow 'em down break; } @@ -4320,22 +4347,22 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score += 2; // Force 'em out next turn break; default: - if (move != MOVE_BESTOW && AI_DATA->items[battlerAtk] == ITEM_NONE) + if (move != MOVE_BESTOW && aiData->items[battlerAtk] == ITEM_NONE) { - switch (AI_DATA->holdEffects[battlerDef]) + switch (aiData->holdEffects[battlerDef]) { case HOLD_EFFECT_CHOICE_BAND: break; case HOLD_EFFECT_TOXIC_ORB: - if (ShouldPoisonSelf(battlerAtk, AI_DATA->abilities[battlerAtk])) + if (ShouldPoisonSelf(battlerAtk, aiData->abilities[battlerAtk])) score += 2; break; case HOLD_EFFECT_FLAME_ORB: - if (ShouldBurnSelf(battlerAtk, AI_DATA->abilities[battlerAtk])) + if (ShouldBurnSelf(battlerAtk, aiData->abilities[battlerAtk])) score += 2; break; case HOLD_EFFECT_BLACK_SLUDGE: - if (IS_BATTLER_OF_TYPE(battlerAtk, TYPE_POISON) || AI_DATA->abilities[battlerAtk] == ABILITY_MAGIC_GUARD) + if (IS_BATTLER_OF_TYPE(battlerAtk, TYPE_POISON) || aiData->abilities[battlerAtk] == ABILITY_MAGIC_GUARD) score += 3; break; case HOLD_EFFECT_IRON_BALL: @@ -4353,22 +4380,23 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_ROLE_PLAY: - if (!IsRolePlayBannedAbilityAtk(AI_DATA->abilities[battlerAtk]) - && !IsRolePlayBannedAbility(AI_DATA->abilities[battlerDef]) - && !IsAbilityOfRating(AI_DATA->abilities[battlerAtk], 5) - && IsAbilityOfRating(AI_DATA->abilities[battlerDef], 5)) + if (!IsRolePlayBannedAbilityAtk(aiData->abilities[battlerAtk]) + && !IsRolePlayBannedAbility(aiData->abilities[battlerDef]) + && !IsAbilityOfRating(aiData->abilities[battlerAtk], 5) + && IsAbilityOfRating(aiData->abilities[battlerDef], 5)) score += 2; break; case EFFECT_INGRAIN: - if (AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_BIG_ROOT) + if (aiData->holdEffects[battlerAtk] == HOLD_EFFECT_BIG_ROOT) score += 3; else score++; break; case EFFECT_SUPERPOWER: case EFFECT_OVERHEAT: - if (AI_DATA->abilities[battlerAtk] == ABILITY_CONTRARY) - score += 10; + case EFFECT_MAKE_IT_RAIN: + if (aiData->abilities[battlerAtk] == ABILITY_CONTRARY) + score += 3; break; case EFFECT_MAGIC_COAT: if (IS_MOVE_STATUS(predictedMove) && AI_GetBattlerMoveTargetType(battlerDef, predictedMove) & (MOVE_TARGET_SELECTED | MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_BOTH)) @@ -4379,15 +4407,15 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score++; if (IsRecycleEncouragedItem(GetUsedHeldItem(battlerAtk))) score++; - if (AI_DATA->abilities[battlerAtk] == ABILITY_RIPEN) + if (aiData->abilities[battlerAtk] == ABILITY_RIPEN) { - u16 item = GetUsedHeldItem(battlerAtk); - u16 toHeal = (ItemId_GetHoldEffectParam(item) == 10) ? 10 : gBattleMons[battlerAtk].maxHP / ItemId_GetHoldEffectParam(item); + u32 item = GetUsedHeldItem(battlerAtk); + u32 toHeal = (ItemId_GetHoldEffectParam(item) == 10) ? 10 : gBattleMons[battlerAtk].maxHP / ItemId_GetHoldEffectParam(item); - if (IsStatBoostingBerry(item) && AI_DATA->hpPercents[battlerAtk] > 60) + if (IsStatBoostingBerry(item) && aiData->hpPercents[battlerAtk] > 60) score++; else if (ShouldRestoreHpBerry(battlerAtk, item) && !CanAIFaintTarget(battlerAtk, battlerDef, 0) - && ((GetWhoStrikesFirst(battlerAtk, battlerDef, TRUE) == 0 && CanTargetFaintAiWithMod(battlerDef, battlerAtk, 0, 0)) + && ((GetWhichBattlerFaster(battlerAtk, battlerDef, TRUE) == 0 && CanTargetFaintAiWithMod(battlerDef, battlerAtk, 0, 0)) || !CanTargetFaintAiWithMod(battlerDef, battlerAtk, toHeal, 0))) score++; // Recycle healing berry if we can't otherwise faint the target and the target wont kill us after we activate the berry } @@ -4401,9 +4429,9 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score++; break; case EFFECT_KNOCK_OFF: - if (CanKnockOffItem(battlerDef, AI_DATA->items[battlerDef])) + if (CanKnockOffItem(battlerDef, aiData->items[battlerDef])) { - switch (AI_DATA->holdEffects[battlerDef]) + switch (aiData->holdEffects[battlerDef]) { case HOLD_EFFECT_IRON_BALL: if (HasMoveEffect(battlerDef, EFFECT_FLING)) @@ -4419,19 +4447,19 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_SKILL_SWAP: - if (GetAbilityRating(AI_DATA->abilities[battlerDef]) > GetAbilityRating(AI_DATA->abilities[battlerAtk])) + if (GetAbilityRating(aiData->abilities[battlerDef]) > GetAbilityRating(aiData->abilities[battlerAtk])) score++; break; case EFFECT_WORRY_SEED: case EFFECT_GASTRO_ACID: case EFFECT_SIMPLE_BEAM: - if (IsAbilityOfRating(AI_DATA->abilities[battlerDef], 5)) + if (IsAbilityOfRating(aiData->abilities[battlerDef], 5)) score += 2; break; case EFFECT_ENTRAINMENT: - if (IsAbilityOfRating(AI_DATA->abilities[battlerDef], 5) || GetAbilityRating(AI_DATA->abilities[battlerAtk]) <= 0) + if (IsAbilityOfRating(aiData->abilities[battlerDef], 5) || GetAbilityRating(aiData->abilities[battlerAtk]) <= 0) { - if (AI_DATA->abilities[battlerDef] != AI_DATA->abilities[battlerAtk] && !(gStatuses3[battlerDef] & STATUS3_GASTRO_ACID)) + if (aiData->abilities[battlerDef] != aiData->abilities[battlerAtk] && !(gStatuses3[battlerDef] & STATUS3_GASTRO_ACID)) score += 2; } break; @@ -4445,6 +4473,12 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (gBattleMons[battlerAtk].status1 & STATUS1_ANY) score += 2; break; + case EFFECT_TAKE_HEART: + if (gBattleMons[battlerAtk].status1 & STATUS1_ANY + || BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPATK) + || BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPDEF)) + score += 2; + break; case EFFECT_PSYCHO_SHIFT: if (gBattleMons[battlerAtk].status1 & STATUS1_PSN_ANY) IncreasePoisonScore(battlerAtk, battlerDef, move, &score); @@ -4460,7 +4494,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_GRUDGE: break; case EFFECT_SNATCH: - if (predictedMove != MOVE_NONE && TestMoveFlags(predictedMove, FLAG_SNATCH_AFFECTED)) + if (predictedMove != MOVE_NONE && gBattleMoves[predictedMove].snatchAffected) score += 3; // Steal move break; case EFFECT_MUD_SPORT: @@ -4473,11 +4507,11 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_TICKLE: if (gBattleMons[battlerDef].statStages[STAT_DEF] > 4 && HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL) - && AI_DATA->abilities[battlerDef] != ABILITY_CONTRARY && ShouldLowerDefense(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef])) + && aiData->abilities[battlerDef] != ABILITY_CONTRARY && ShouldLowerDefense(battlerAtk, battlerDef, aiData->abilities[battlerDef])) { score += 2; } - else if (ShouldLowerAttack(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef])) + else if (ShouldLowerAttack(battlerAtk, battlerDef, aiData->abilities[battlerDef])) { score += 2; } @@ -4495,7 +4529,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) IncreaseStatUpScore(battlerAtk, battlerDef, STAT_SPDEF, &score); break; case EFFECT_GEOMANCY: - if (AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_POWER_HERB) + if (aiData->holdEffects[battlerAtk] == HOLD_EFFECT_POWER_HERB) score += 3; //fallthrough case EFFECT_QUIVER_DANCE: @@ -4509,7 +4543,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) IncreaseStatUpScore(battlerAtk, battlerDef, STAT_DEF, &score); break; case EFFECT_SHELL_SMASH: - if (AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_RESTORE_STATS) + if (aiData->holdEffects[battlerAtk] == HOLD_EFFECT_RESTORE_STATS) score += 1; IncreaseStatUpScore(battlerAtk, battlerDef, STAT_SPEED, &score); @@ -4568,8 +4602,8 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_GUARD_SPLIT: { // TODO also kind of cheating... - u16 newDefense = (gBattleMons[battlerAtk].defense + gBattleMons[battlerDef].defense) / 2; - u16 newSpDef = (gBattleMons[battlerAtk].spDefense + gBattleMons[battlerDef].spDefense) / 2; + u32 newDefense = (gBattleMons[battlerAtk].defense + gBattleMons[battlerDef].defense) / 2; + u32 newSpDef = (gBattleMons[battlerAtk].spDefense + gBattleMons[battlerDef].spDefense) / 2; if ((newDefense > gBattleMons[battlerAtk].defense && newSpDef >= gBattleMons[battlerAtk].spDefense) || (newSpDef > gBattleMons[battlerAtk].spDefense && newDefense >= gBattleMons[battlerAtk].defense)) @@ -4578,8 +4612,8 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_POWER_SPLIT: { - u16 newAttack = (gBattleMons[battlerAtk].attack + gBattleMons[battlerDef].attack) / 2; - u16 newSpAtk = (gBattleMons[battlerAtk].spAttack + gBattleMons[battlerDef].spAttack) / 2; + u32 newAttack = (gBattleMons[battlerAtk].attack + gBattleMons[battlerDef].attack) / 2; + u32 newSpAtk = (gBattleMons[battlerAtk].spAttack + gBattleMons[battlerDef].spAttack) / 2; if ((newAttack > gBattleMons[battlerAtk].attack && newSpAtk >= gBattleMons[battlerAtk].spAttack) || (newSpAtk > gBattleMons[battlerAtk].spAttack && newAttack >= gBattleMons[battlerAtk].attack)) @@ -4587,15 +4621,15 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_BUG_BITE: // And pluck - if (gBattleMons[battlerDef].status2 & STATUS2_SUBSTITUTE || AI_DATA->abilities[battlerDef] == ABILITY_STICKY_HOLD) + if (gBattleMons[battlerDef].status2 & STATUS2_SUBSTITUTE || aiData->abilities[battlerDef] == ABILITY_STICKY_HOLD) break; - else if (ItemId_GetPocket(AI_DATA->items[battlerDef]) == POCKET_BERRIES) + else if (ItemId_GetPocket(aiData->items[battlerDef]) == POCKET_BERRIES) score += 3; break; case EFFECT_INCINERATE: - if (gBattleMons[battlerDef].status2 & STATUS2_SUBSTITUTE || AI_DATA->abilities[battlerDef] == ABILITY_STICKY_HOLD) + if (gBattleMons[battlerDef].status2 & STATUS2_SUBSTITUTE || aiData->abilities[battlerDef] == ABILITY_STICKY_HOLD) break; - else if (ItemId_GetPocket(AI_DATA->items[battlerDef]) == POCKET_BERRIES || AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_GEMS) + else if (ItemId_GetPocket(aiData->items[battlerDef]) == POCKET_BERRIES || aiData->holdEffects[battlerDef] == HOLD_EFFECT_GEMS) score += 3; break; case EFFECT_SMACK_DOWN: @@ -4619,7 +4653,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_GRASSY_TERRAIN: case EFFECT_PSYCHIC_TERRAIN: score += 2; - if (AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_TERRAIN_EXTENDER) + if (aiData->holdEffects[battlerAtk] == HOLD_EFFECT_TERRAIN_EXTENDER) score += 2; break; case EFFECT_PLEDGE: @@ -4637,9 +4671,9 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_MAGIC_ROOM: score++; - if (AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_NONE && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_NONE) + if (aiData->holdEffects[battlerAtk] == HOLD_EFFECT_NONE && aiData->holdEffects[battlerDef] != HOLD_EFFECT_NONE) score++; - if (isDoubleBattle && AI_DATA->holdEffects[BATTLE_PARTNER(battlerAtk)] == HOLD_EFFECT_NONE && AI_DATA->holdEffects[BATTLE_PARTNER(battlerDef)] != HOLD_EFFECT_NONE) + if (isDoubleBattle && aiData->holdEffects[BATTLE_PARTNER(battlerAtk)] == HOLD_EFFECT_NONE && aiData->holdEffects[BATTLE_PARTNER(battlerDef)] != HOLD_EFFECT_NONE) score++; break; case EFFECT_WONDER_ROOM: @@ -4652,28 +4686,28 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { if (HasSleepMoveWithLowAccuracy(battlerAtk, battlerDef)) // Has Gravity for a move like Hypnosis IncreaseSleepScore(battlerAtk, battlerDef, move, &score); - else if (HasMoveWithLowAccuracy(battlerAtk, battlerDef, 90, FALSE, AI_DATA->abilities[battlerAtk], AI_DATA->abilities[battlerDef], AI_DATA->holdEffects[battlerAtk], AI_DATA->holdEffects[battlerDef])) + else if (HasMoveWithLowAccuracy(battlerAtk, battlerDef, 90, FALSE, aiData->abilities[battlerAtk], aiData->abilities[battlerDef], aiData->holdEffects[battlerAtk], aiData->holdEffects[battlerDef])) score += 2; else score++; } break; case EFFECT_ION_DELUGE: - if ((AI_DATA->abilities[battlerAtk] == ABILITY_VOLT_ABSORB - || AI_DATA->abilities[battlerAtk] == ABILITY_MOTOR_DRIVE - || AI_DATA->abilities[battlerAtk] == ABILITY_LIGHTNING_ROD) + if ((aiData->abilities[battlerAtk] == ABILITY_VOLT_ABSORB + || aiData->abilities[battlerAtk] == ABILITY_MOTOR_DRIVE + || aiData->abilities[battlerAtk] == ABILITY_LIGHTNING_ROD) && gBattleMoves[predictedMove].type == TYPE_NORMAL) score += 2; break; case EFFECT_FLING: /* TODO - switch (gFlingTable[AI_DATA->items[battlerAtk]].effect) + switch (gFlingTable[aiData->items[battlerAtk]].effect) { case MOVE_EFFECT_BURN: IncreaseBurnScore(battlerAtk, battlerDef, move, &score); break; case MOVE_EFFECT_FLINCH: - score += ShouldTryToFlinch(battlerAtk, battlerDef, AI_DATA->abilities[battlerAtk], AI_DATA->abilities[battlerDef], move); + score += ShouldTryToFlinch(battlerAtk, battlerDef, aiData->abilities[battlerAtk], aiData->abilities[battlerDef], move); break; case MOVE_EFFECT_PARALYSIS: IncreaseParalyzeScore(battlerAtk, battlerDef, move, &score); @@ -4693,7 +4727,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score += 3; break; case EFFECT_EMBARGO: - if (AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_NONE) + if (aiData->holdEffects[battlerDef] != HOLD_EFFECT_NONE) score++; break; case EFFECT_POWDER: @@ -4701,21 +4735,21 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score += 3; break; case EFFECT_TELEKINESIS: - if (HasMoveWithLowAccuracy(battlerAtk, battlerDef, 90, FALSE, AI_DATA->abilities[battlerAtk], AI_DATA->abilities[battlerDef], AI_DATA->holdEffects[battlerAtk], AI_DATA->holdEffects[battlerDef]) + if (HasMoveWithLowAccuracy(battlerAtk, battlerDef, 90, FALSE, aiData->abilities[battlerAtk], aiData->abilities[battlerDef], aiData->holdEffects[battlerAtk], aiData->holdEffects[battlerDef]) || !IsBattlerGrounded(battlerDef)) score++; break; case EFFECT_THROAT_CHOP: - if (predictedMove != MOVE_NONE && TestMoveFlags(predictedMove, FLAG_SOUND) && AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) + if (predictedMove != MOVE_NONE && gBattleMoves[predictedMove].soundMove && AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) score += 3; // Ai goes first and predicts the target will use a sound move - else if (TestMoveFlagsInMoveset(battlerDef, FLAG_SOUND)) + else if (HasSoundMove(battlerDef)) score += 3; break; case EFFECT_HEAL_BLOCK: if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER && predictedMove != MOVE_NONE && IsHealingMoveEffect(gBattleMoves[predictedMove].effect)) score += 3; // Try to cancel healing move - else if (HasHealingEffect(battlerDef) || AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_LEFTOVERS - || (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_BLACK_SLUDGE && IS_BATTLER_OF_TYPE(battlerDef, TYPE_POISON))) + else if (HasHealingEffect(battlerDef) || aiData->holdEffects[battlerDef] == HOLD_EFFECT_LEFTOVERS + || (aiData->holdEffects[battlerDef] == HOLD_EFFECT_BLACK_SLUDGE && IS_BATTLER_OF_TYPE(battlerDef, TYPE_POISON))) score += 2; break; case EFFECT_SOAK: @@ -4723,14 +4757,14 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score += 2; // Get some super effective moves break; case EFFECT_THIRD_TYPE: - if (AI_DATA->abilities[battlerDef] == ABILITY_WONDER_GUARD) + if (aiData->abilities[battlerDef] == ABILITY_WONDER_GUARD) score += 2; // Give target more weaknesses break; case EFFECT_ELECTRIFY: if (predictedMove != MOVE_NONE - && (AI_DATA->abilities[battlerAtk] == ABILITY_VOLT_ABSORB - || AI_DATA->abilities[battlerAtk] == ABILITY_MOTOR_DRIVE - || AI_DATA->abilities[battlerAtk] == ABILITY_LIGHTNING_ROD)) + && (aiData->abilities[battlerAtk] == ABILITY_VOLT_ABSORB + || aiData->abilities[battlerAtk] == ABILITY_MOTOR_DRIVE + || aiData->abilities[battlerAtk] == ABILITY_LIGHTNING_ROD)) { score += 3; } @@ -4748,7 +4782,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_QUASH: if (isDoubleBattle - && AI_WhoStrikesFirst(BATTLE_PARTNER(battlerAtk), battlerDef, AI_DATA->partnerMove) == AI_IS_SLOWER) // Attacker partner wouldn't go before target + && AI_WhoStrikesFirst(BATTLE_PARTNER(battlerAtk), battlerDef, aiData->partnerMove) == AI_IS_SLOWER) // Attacker partner wouldn't go before target score++; break; case EFFECT_TAILWIND: @@ -4793,8 +4827,8 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (isDoubleBattle) { if (IsBattlerAlive(BATTLE_PARTNER(battlerDef)) - && AI_DATA->hpPercents[BATTLE_PARTNER(battlerDef)] < 12 - && AI_DATA->abilities[BATTLE_PARTNER(battlerDef)] != ABILITY_MAGIC_GUARD + && aiData->hpPercents[BATTLE_PARTNER(battlerDef)] < 12 + && aiData->abilities[BATTLE_PARTNER(battlerDef)] != ABILITY_MAGIC_GUARD && !IS_BATTLER_OF_TYPE(BATTLE_PARTNER(battlerDef), TYPE_FIRE)) score++; } @@ -4806,38 +4840,38 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_TWO_TURNS_ATTACK: case EFFECT_SKULL_BASH: case EFFECT_SOLAR_BEAM: - if (AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_POWER_HERB) + if (aiData->holdEffects[battlerAtk] == HOLD_EFFECT_POWER_HERB) score += 2; break; case EFFECT_COUNTER: - if (!IsBattlerIncapacitated(battlerDef, AI_DATA->abilities[battlerDef]) && predictedMove != MOVE_NONE) + if (!IsBattlerIncapacitated(battlerDef, aiData->abilities[battlerDef]) && predictedMove != MOVE_NONE) { if (gDisableStructs[battlerDef].tauntTimer != 0) score++; // target must use damaging move - if (GetMoveDamageResult(predictedMove) >= MOVE_POWER_GOOD && GetBattleMoveSplit(predictedMove) == SPLIT_PHYSICAL) + if (GetMoveDamageResult(battlerDef, battlerAtk, predictedMoveSlot) >= MOVE_POWER_GOOD && GetBattleMoveSplit(predictedMove) == SPLIT_PHYSICAL) score += 3; } break; case EFFECT_MIRROR_COAT: - if (!IsBattlerIncapacitated(battlerDef, AI_DATA->abilities[battlerDef]) && predictedMove != MOVE_NONE) + if (!IsBattlerIncapacitated(battlerDef, aiData->abilities[battlerDef]) && predictedMove != MOVE_NONE) { if (gDisableStructs[battlerDef].tauntTimer != 0) score++; // target must use damaging move - if (GetMoveDamageResult(predictedMove) >= MOVE_POWER_GOOD && GetBattleMoveSplit(predictedMove) == SPLIT_SPECIAL) + if (GetMoveDamageResult(battlerDef, battlerAtk, predictedMoveSlot) >= MOVE_POWER_GOOD && GetBattleMoveSplit(predictedMove) == SPLIT_SPECIAL) score += 3; } break; case EFFECT_FLAIL: if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // Ai goes first { - if (AI_DATA->hpPercents[battlerAtk] < 20) + if (aiData->hpPercents[battlerAtk] < 20) score++; - else if (AI_DATA->hpPercents[battlerAtk] < 8) + else if (aiData->hpPercents[battlerAtk] < 8) score += 2; } break; case EFFECT_SHORE_UP: - if (AI_WeatherHasEffect() && (gBattleWeather & B_WEATHER_SANDSTORM) + if ((AI_GetWeather(aiData) & B_WEATHER_SANDSTORM) && ShouldRecover(battlerAtk, battlerDef, move, 67)) score += 3; else if (ShouldRecover(battlerAtk, battlerDef, move, 50)) @@ -4850,7 +4884,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_FOCUS_PUNCH: if (!isDoubleBattle && effectiveness > AI_EFFECTIVENESS_x0_5) { - if (IsBattlerIncapacitated(battlerDef, AI_DATA->abilities[battlerDef])) + if (IsBattlerIncapacitated(battlerDef, aiData->abilities[battlerDef])) score += 2; else if (gBattleMons[battlerDef].status2 & (STATUS2_INFATUATION | STATUS2_CONFUSION)) score++; @@ -4872,10 +4906,10 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_ENDEAVOR: if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_SLOWER) // Opponent faster { - if (AI_DATA->hpPercents[battlerAtk] < 40) + if (aiData->hpPercents[battlerAtk] < 40) score++; } - else if (AI_DATA->hpPercents[battlerAtk] < 50) + else if (aiData->hpPercents[battlerAtk] < 50) { score++; } @@ -4892,15 +4926,26 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) //break; //case EFFECT_SKY_DROP //break; + case EFFECT_JUNGLE_HEALING: + if (ShouldRecover(battlerAtk, battlerDef, move, 25) + || ShouldRecover(BATTLE_PARTNER(battlerAtk), battlerDef, move, 25) + || gBattleMons[battlerAtk].status1 & STATUS1_ANY + || gBattleMons[BATTLE_PARTNER(battlerAtk)].status1 & STATUS1_ANY) + score += 3; + break; + case EFFECT_SALT_CURE: + if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_WATER) || IS_BATTLER_OF_TYPE(battlerDef, TYPE_STEEL)) + score += 2; + break; } // move effect checks return score; } // Effects that are encouraged on the first turn of battle -static s16 AI_SetupFirstTurn(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) +static s32 AI_SetupFirstTurn(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) { - if (IsTargetingPartner(battlerAtk, battlerDef) + if (IS_TARGETING_PARTNER(battlerAtk, battlerDef) || gBattleResults.battleTurnCounter != 0) return score; @@ -5009,12 +5054,12 @@ static s16 AI_SetupFirstTurn(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } // Adds score bonus to 'riskier' move effects and high crit moves -static s16 AI_Risky(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) +static s32 AI_Risky(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) { - if (IsTargetingPartner(battlerAtk, battlerDef)) + if (IS_TARGETING_PARTNER(battlerAtk, battlerDef)) return score; - if (TestMoveFlags(move, FLAG_HIGH_CRIT)) + if (gBattleMoves[move].highCritRatio) score += 2; switch (gBattleMoves[move].effect) @@ -5048,25 +5093,25 @@ static s16 AI_Risky(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } // Adds score bonus to best powered move -static s16 AI_PreferStrongestMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) +static s32 AI_PreferStrongestMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) { - if (IsTargetingPartner(battlerAtk, battlerDef)) + if (IS_TARGETING_PARTNER(battlerAtk, battlerDef)) return score; - if (GetMoveDamageResult(move) == MOVE_POWER_BEST) + if (GetMoveDamageResult(battlerAtk, battlerDef, AI_THINKING_STRUCT->movesetIndex) == MOVE_POWER_BEST) score += 2; return score; } // Prefers moves that are good for baton pass -static s16 AI_PreferBatonPass(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) +static s32 AI_PreferBatonPass(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) { u32 i; - if (IsTargetingPartner(battlerAtk, battlerDef) + if (IS_TARGETING_PARTNER(battlerAtk, battlerDef) || CountUsablePartyMons(battlerAtk) == 0 - || GetMoveDamageResult(move) != MOVE_POWER_OTHER + || GetMoveDamageResult(battlerAtk, battlerDef, AI_THINKING_STRUCT->movesetIndex) != MOVE_POWER_OTHER || !HasMoveEffect(battlerAtk, EFFECT_BATON_PASS) || IsBattlerTrapped(battlerAtk, TRUE)) return score; @@ -5115,15 +5160,15 @@ static s16 AI_PreferBatonPass(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) return score; } -static s16 AI_HPAware(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) +static s32 AI_HPAware(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) { - u16 effect = gBattleMoves[move].effect; - u8 moveType = gBattleMoves[move].type; + u32 effect = gBattleMoves[move].effect; + u32 moveType = gBattleMoves[move].type; SetTypeBeforeUsingMove(move, battlerAtk); GET_MOVE_TYPE(move, moveType); - if (IsTargetingPartner(battlerAtk, battlerDef)) + if (IS_TARGETING_PARTNER(battlerAtk, battlerDef)) { if ((effect == EFFECT_HEAL_PULSE || effect == EFFECT_HIT_ENEMY_HEAL_ALLY) || (moveType == TYPE_ELECTRIC && AI_DATA->abilities[BATTLE_PARTNER(battlerAtk)] == ABILITY_VOLT_ABSORB) @@ -5162,7 +5207,6 @@ static s16 AI_HPAware(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_ROOST: case EFFECT_MEMENTO: case EFFECT_GRUDGE: - case EFFECT_OVERHEAT: score -= 2; break; default: @@ -5319,7 +5363,7 @@ static void AI_Watch(void) } // Roaming pokemon logic -static s16 AI_Roaming(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) +static s32 AI_Roaming(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) { if (IsBattlerTrapped(battlerAtk, FALSE)) return score; @@ -5329,9 +5373,9 @@ static s16 AI_Roaming(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } // Safari pokemon logic -static s16 AI_Safari(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) +static s32 AI_Safari(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) { - u8 safariFleeRate = gBattleStruct->safariEscapeFactor * 5; // Safari flee rate, from 0-20. + u32 safariFleeRate = gBattleStruct->safariEscapeFactor * 5; // Safari flee rate, from 0-20. if ((Random() % 100) < safariFleeRate) AI_Flee(); @@ -5342,7 +5386,7 @@ static s16 AI_Safari(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } // First battle logic -static s16 AI_FirstBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) +static s32 AI_FirstBattle(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) { if (AI_DATA->hpPercents[battlerDef] <= 20) AI_Flee(); diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 48ca258a8945..b2f56326f7d6 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -22,31 +22,32 @@ #include "constants/moves.h" // this file's functions -static bool8 HasSuperEffectiveMoveAgainstOpponents(bool8 noRng); -static bool8 FindMonWithFlagsAndSuperEffective(u16 flags, u8 moduloPercent); -static bool8 ShouldUseItem(void); -static bool32 AiExpectsToFaintPlayer(void); -static bool32 AI_ShouldHeal(u32 healAmount); -static bool32 AI_OpponentCanFaintAiWithMod(u32 healAmount); - -static bool32 IsAceMon(u32 battlerId, u32 monPartyId) +static bool8 HasSuperEffectiveMoveAgainstOpponents(u32 battler, bool8 noRng); +static bool8 FindMonWithFlagsAndSuperEffective(u32 battler, u16 flags, u8 moduloPercent); +static bool8 ShouldUseItem(u32 battler); +static bool32 AiExpectsToFaintPlayer(u32 battler); +static bool32 AI_ShouldHeal(u32 battler, u32 healAmount); +static bool32 AI_OpponentCanFaintAiWithMod(u32 battler, u32 healAmount); +static bool32 IsAiPartyMonOHKOBy(u32 battlerAi, u32 battlerAtk, struct Pokemon *aiMon); + +static bool32 IsAceMon(u32 battler, u32 monPartyId) { if (AI_THINKING_STRUCT->aiFlags & AI_FLAG_ACE_POKEMON - && !(gBattleStruct->forcedSwitch & gBitTable[battlerId]) + && !(gBattleStruct->forcedSwitch & gBitTable[battler]) && monPartyId == CalculateEnemyPartyCount()-1) return TRUE; return FALSE; } -void GetAIPartyIndexes(u32 battlerId, s32 *firstId, s32 *lastId) +void GetAIPartyIndexes(u32 battler, s32 *firstId, s32 *lastId) { - if (BATTLE_TWO_VS_ONE_OPPONENT && (battlerId & BIT_SIDE) == B_SIDE_OPPONENT) + if (BATTLE_TWO_VS_ONE_OPPONENT && (battler & BIT_SIDE) == B_SIDE_OPPONENT) { *firstId = 0, *lastId = PARTY_SIZE; } else if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_INGAME_PARTNER | BATTLE_TYPE_TOWER_LINK_MULTI)) { - if ((battlerId & BIT_FLANK) == B_FLANK_LEFT) + if ((battler & BIT_FLANK) == B_FLANK_LEFT) *firstId = 0, *lastId = PARTY_SIZE / 2; else *firstId = PARTY_SIZE / 2, *lastId = PARTY_SIZE; @@ -57,13 +58,13 @@ void GetAIPartyIndexes(u32 battlerId, s32 *firstId, s32 *lastId) } } -static bool8 ShouldSwitchIfAllBadMoves(void) +static bool8 ShouldSwitchIfAllBadMoves(u32 battler) { - if (gBattleResources->ai->switchMon) + if (AI_DATA->shouldSwitchMon & gBitTable[battler]) { - gBattleResources->ai->switchMon = 0; - *(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = PARTY_SIZE; - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SWITCH, 0); + AI_DATA->shouldSwitchMon &= ~(gBitTable[battler]); + gBattleStruct->AI_monToSwitchIntoId[battler] = AI_DATA->monToSwitchId[battler]; + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_SWITCH, 0); return TRUE; } else @@ -72,7 +73,7 @@ static bool8 ShouldSwitchIfAllBadMoves(void) } } -static bool8 ShouldSwitchIfWonderGuard(void) +static bool8 ShouldSwitchIfWonderGuard(u32 battler) { u8 opposingPosition; u8 opposingBattler; @@ -85,7 +86,7 @@ static bool8 ShouldSwitchIfWonderGuard(void) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) return FALSE; - opposingPosition = BATTLE_OPPOSITE(GetBattlerPosition(gActiveBattler)); + opposingPosition = BATTLE_OPPOSITE(GetBattlerPosition(battler)); if (GetBattlerAbility(GetBattlerAtPosition(opposingPosition)) != ABILITY_WONDER_GUARD) return FALSE; @@ -93,18 +94,18 @@ static bool8 ShouldSwitchIfWonderGuard(void) // Check if Pokemon has a super effective move. for (opposingBattler = GetBattlerAtPosition(opposingPosition), i = 0; i < MAX_MON_MOVES; i++) { - move = gBattleMons[gActiveBattler].moves[i]; + move = gBattleMons[battler].moves[i]; if (move != MOVE_NONE) { - if (AI_GetTypeEffectiveness(move, gActiveBattler, opposingBattler) >= UQ_4_12(2.0)) + if (AI_GetTypeEffectiveness(move, battler, opposingBattler) >= UQ_4_12(2.0)) return FALSE; } } // Get party information. - GetAIPartyIndexes(gActiveBattler, &firstId, &lastId); + GetAIPartyIndexes(battler, &firstId, &lastId); - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) party = gPlayerParty; else party = gEnemyParty; @@ -112,15 +113,11 @@ static bool8 ShouldSwitchIfWonderGuard(void) // Find a Pokemon in the party that has a super effective move. for (i = firstId; i < lastId; i++) { - if (GetMonData(&party[i], MON_DATA_HP) == 0) + if (!IsValidForBattle(&party[i])) continue; - if (GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG) == SPECIES_NONE) + if (i == gBattlerPartyIndexes[battler]) continue; - if (GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG) == SPECIES_EGG) - continue; - if (i == gBattlerPartyIndexes[gActiveBattler]) - continue; - if (IsAceMon(gActiveBattler, i)) + if (IsAceMon(battler, i)) continue; for (opposingBattler = GetBattlerAtPosition(opposingPosition), j = 0; j < MAX_MON_MOVES; j++) @@ -128,11 +125,11 @@ static bool8 ShouldSwitchIfWonderGuard(void) move = GetMonData(&party[i], MON_DATA_MOVE1 + j); if (move != MOVE_NONE) { - if (AI_GetTypeEffectiveness(move, gActiveBattler, opposingBattler) >= UQ_4_12(2.0) && Random() % 3 < 2) + if (AI_GetTypeEffectiveness(move, battler, opposingBattler) >= UQ_4_12(2.0) && Random() % 3 < 2) { // We found a mon. - *(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = i; - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SWITCH, 0); + *(gBattleStruct->AI_monToSwitchIntoId + battler) = i; + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_SWITCH, 0); return TRUE; } } @@ -142,66 +139,88 @@ static bool8 ShouldSwitchIfWonderGuard(void) return FALSE; // There is not a single Pokemon in the party that has a super effective move against a mon with Wonder Guard. } -static bool8 FindMonThatAbsorbsOpponentsMove(void) +static bool8 FindMonThatAbsorbsOpponentsMove(u32 battler) { u8 battlerIn1, battlerIn2; - u16 absorbingTypeAbility; + u8 numAbsorbingAbilities = 0; + u16 absorbingTypeAbilities[3]; // Array size is maximum number of absorbing abilities for a single type s32 firstId; s32 lastId; // + 1 struct Pokemon *party; - s32 i; + s32 i, j; - if (HasSuperEffectiveMoveAgainstOpponents(TRUE) && Random() % 3 != 0) + if (HasSuperEffectiveMoveAgainstOpponents(battler, TRUE) && Random() % 3 != 0) return FALSE; - if (gLastLandedMoves[gActiveBattler] == MOVE_NONE) + if (gLastLandedMoves[battler] == MOVE_NONE) return FALSE; - if (gLastLandedMoves[gActiveBattler] == MOVE_UNAVAILABLE) + if (gLastLandedMoves[battler] == MOVE_UNAVAILABLE) return FALSE; - if (IS_MOVE_STATUS(gLastLandedMoves[gActiveBattler])) + if (IS_MOVE_STATUS(gLastLandedMoves[battler])) return FALSE; if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { - battlerIn1 = gActiveBattler; - if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))]) - battlerIn2 = gActiveBattler; + battlerIn1 = battler; + if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler)))]) + battlerIn2 = battler; else - battlerIn2 = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler))); + battlerIn2 = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler))); } else { - battlerIn1 = gActiveBattler; - battlerIn2 = gActiveBattler; + battlerIn1 = battler; + battlerIn2 = battler; } - if (gBattleMoves[gLastLandedMoves[gActiveBattler]].type == TYPE_FIRE) - absorbingTypeAbility = ABILITY_FLASH_FIRE; - else if (gBattleMoves[gLastLandedMoves[gActiveBattler]].type == TYPE_WATER) - absorbingTypeAbility = ABILITY_WATER_ABSORB; - else if (gBattleMoves[gLastLandedMoves[gActiveBattler]].type == TYPE_ELECTRIC) - absorbingTypeAbility = ABILITY_VOLT_ABSORB; + // Create an array of possible absorb abilities so the AI considers all of them + if (gBattleMoves[gLastLandedMoves[battler]].type == TYPE_FIRE) + { + absorbingTypeAbilities[0] = ABILITY_FLASH_FIRE; + numAbsorbingAbilities = 1; + } + else if (gBattleMoves[gLastLandedMoves[battler]].type == TYPE_WATER) + { + absorbingTypeAbilities[0] = ABILITY_WATER_ABSORB; + absorbingTypeAbilities[1] = ABILITY_STORM_DRAIN; + absorbingTypeAbilities[2] = ABILITY_DRY_SKIN; + numAbsorbingAbilities = 3; + } + else if (gBattleMoves[gLastLandedMoves[battler]].type == TYPE_ELECTRIC) + { + absorbingTypeAbilities[0] = ABILITY_VOLT_ABSORB; + absorbingTypeAbilities[1] = ABILITY_MOTOR_DRIVE; + absorbingTypeAbilities[2] = ABILITY_LIGHTNING_ROD; + numAbsorbingAbilities = 3; + } + else if (gBattleMoves[gLastLandedMoves[battler]].type == TYPE_GRASS) + { + absorbingTypeAbilities[0] = ABILITY_SAP_SIPPER; + numAbsorbingAbilities = 1; + } else + { return FALSE; + } - if (AI_DATA->abilities[gActiveBattler] == absorbingTypeAbility) - return FALSE; + // Check current mon for all absorbing abilities + for (i = 0; i < numAbsorbingAbilities; i++) + { + if (AI_DATA->abilities[battler] == absorbingTypeAbilities[i]) + return FALSE; + } - GetAIPartyIndexes(gActiveBattler, &firstId, &lastId); + GetAIPartyIndexes(battler, &firstId, &lastId); - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) party = gPlayerParty; else party = gEnemyParty; for (i = firstId; i < lastId; i++) { - u16 species; u16 monAbility; - if (GetMonData(&party[i], MON_DATA_HP) == 0) - continue; - species = GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG); - if (species == SPECIES_NONE || species == SPECIES_EGG) + if (!IsValidForBattle(&party[i])) continue; if (i == gBattlerPartyIndexes[battlerIn1]) continue; @@ -211,29 +230,31 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void) continue; if (i == *(gBattleStruct->monToSwitchIntoId + battlerIn2)) continue; - if (IsAceMon(gActiveBattler, i)) + if (IsAceMon(battler, i)) continue; monAbility = GetMonAbility(&party[i]); - if (absorbingTypeAbility == monAbility && Random() & 1) + for (j = 0; j < numAbsorbingAbilities; j++) { - // we found a mon. - *(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = i; - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SWITCH, 0); - return TRUE; + if (absorbingTypeAbilities[j] == monAbility && Random() & 1) + { + // we found a mon. + *(gBattleStruct->AI_monToSwitchIntoId + battler) = i; + BtlController_EmitTwoReturnValues(battler, 1, B_ACTION_SWITCH, 0); + return TRUE; + } } } - return FALSE; } -static bool8 ShouldSwitchIfGameStatePrompt(void) +static bool8 ShouldSwitchIfGameStatePrompt(u32 battler) { bool8 switchMon = FALSE; - u16 monAbility = AI_DATA->abilities[gActiveBattler]; - u16 holdEffect = AI_DATA->holdEffects[gActiveBattler]; - u8 opposingPosition = BATTLE_OPPOSITE(GetBattlerPosition(gActiveBattler)); + u16 monAbility = AI_DATA->abilities[battler]; + u16 holdEffect = AI_DATA->holdEffects[battler]; + u8 opposingPosition = BATTLE_OPPOSITE(GetBattlerPosition(battler)); u8 opposingBattler = GetBattlerAtPosition(opposingPosition); s32 moduloChance = 4; //25% Chance Default s32 chanceReducer = 1; //No Reduce default. Increase to reduce @@ -242,22 +263,21 @@ static bool8 ShouldSwitchIfGameStatePrompt(void) s32 i; struct Pokemon *party; - - if (AnyStatIsRaised(gActiveBattler)) + if (AnyStatIsRaised(battler)) chanceReducer = 5; // Reduce switchout probability by factor of 5 if setup //Perish Song - if (gStatuses3[gActiveBattler] & STATUS3_PERISH_SONG - && gDisableStructs[gActiveBattler].perishSongTimer == 0 + if (gStatuses3[battler] & STATUS3_PERISH_SONG + && gDisableStructs[battler].perishSongTimer == 0 && monAbility != ABILITY_SOUNDPROOF) switchMon = TRUE; if (AI_THINKING_STRUCT->aiFlags & AI_FLAG_SMART_SWITCHING) { //Yawn - if (gStatuses3[gActiveBattler] & STATUS3_YAWN - && AI_CanSleep(gActiveBattler, monAbility) - && gBattleMons[gActiveBattler].hp > gBattleMons[gActiveBattler].maxHP / 3) + if (gStatuses3[battler] & STATUS3_YAWN + && AI_CanSleep(battler, monAbility) + && gBattleMons[battler].hp > gBattleMons[battler].maxHP / 3) { switchMon = TRUE; @@ -265,42 +285,40 @@ static bool8 ShouldSwitchIfGameStatePrompt(void) //Check if partner can prevent sleep if (IsDoubleBattle()) { - if (IsBattlerAlive(BATTLE_PARTNER(gActiveBattler)) - && (GetAIChosenMove(BATTLE_PARTNER(gActiveBattler)) == MOVE_UPROAR) + if (IsBattlerAlive(BATTLE_PARTNER(battler)) + && (GetAIChosenMove(BATTLE_PARTNER(battler)) == MOVE_UPROAR) ) switchMon = FALSE; - if (IsBattlerAlive(BATTLE_PARTNER(gActiveBattler)) + if (IsBattlerAlive(BATTLE_PARTNER(battler)) && (gBattleMoves[AI_DATA->partnerMove].effect == EFFECT_MISTY_TERRAIN || gBattleMoves[AI_DATA->partnerMove].effect == EFFECT_ELECTRIC_TERRAIN) - && IsBattlerGrounded(gActiveBattler) + && IsBattlerGrounded(battler) ) switchMon = FALSE; - if (*(gBattleStruct->AI_monToSwitchIntoId + BATTLE_PARTNER(gActiveBattler)) != PARTY_SIZE) //Partner is switching + if (*(gBattleStruct->AI_monToSwitchIntoId + BATTLE_PARTNER(battler)) != PARTY_SIZE) //Partner is switching { - GetAIPartyIndexes(gActiveBattler, &firstId, &lastId); + GetAIPartyIndexes(battler, &firstId, &lastId); - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) party = gPlayerParty; for (i = firstId; i < lastId; i++) { - if (IsAceMon(gActiveBattler, i)) + if (IsAceMon(battler, i)) continue; //Look for mon in party that is able to be switched into and has ability that sets terrain - if (GetMonData(&party[i], MON_DATA_HP) != 0 - && GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG) != SPECIES_NONE - && GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG) != SPECIES_EGG - && i != gBattlerPartyIndexes[gActiveBattler] - && i != gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)] - && IsBattlerGrounded(gActiveBattler) + if (IsValidForBattle(&party[i]) + && i != gBattlerPartyIndexes[battler] + && i != gBattlerPartyIndexes[BATTLE_PARTNER(battler)] + && IsBattlerGrounded(battler) && (GetMonAbility(&party[i]) == ABILITY_MISTY_SURGE || GetMonAbility(&party[i]) == ABILITY_ELECTRIC_SURGE)) //Ally has Misty or Electric Surge { - *(gBattleStruct->AI_monToSwitchIntoId + BATTLE_PARTNER(gActiveBattler)) = i; - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SWITCH, 0); + *(gBattleStruct->AI_monToSwitchIntoId + BATTLE_PARTNER(battler)) = i; + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_SWITCH, 0); switchMon = FALSE; break; } @@ -310,7 +328,7 @@ static bool8 ShouldSwitchIfGameStatePrompt(void) //Check if Active Pokemon can KO opponent instead of switching //Will still fall asleep, but take out opposing Pokemon first - if (AiExpectsToFaintPlayer()) + if (AiExpectsToFaintPlayer(battler)) switchMon = FALSE; //Checks to see if active Pokemon can do something against sleep @@ -318,56 +336,56 @@ static bool8 ShouldSwitchIfGameStatePrompt(void) || monAbility == ABILITY_SHED_SKIN || monAbility == ABILITY_EARLY_BIRD) || holdEffect == (HOLD_EFFECT_CURE_SLP | HOLD_EFFECT_CURE_STATUS) - || HasMove(gActiveBattler, MOVE_SLEEP_TALK) - || (HasMoveEffect(gActiveBattler, MOVE_SNORE) && AI_GetTypeEffectiveness(MOVE_SNORE, gActiveBattler, opposingBattler) >= UQ_4_12(1.0)) - || (IsBattlerGrounded(gActiveBattler) - && (HasMove(gActiveBattler, MOVE_MISTY_TERRAIN) || HasMove(gActiveBattler, MOVE_ELECTRIC_TERRAIN))) + || HasMove(battler, MOVE_SLEEP_TALK) + || (HasMoveEffect(battler, MOVE_SNORE) && AI_GetTypeEffectiveness(MOVE_SNORE, battler, opposingBattler) >= UQ_4_12(1.0)) + || (IsBattlerGrounded(battler) + && (HasMove(battler, MOVE_MISTY_TERRAIN) || HasMove(battler, MOVE_ELECTRIC_TERRAIN))) ) switchMon = FALSE; //Check if Active Pokemon evasion boosted and might be able to dodge until awake - if (gBattleMons[gActiveBattler].statStages[STAT_EVASION] > (DEFAULT_STAT_STAGE + 3) + if (gBattleMons[battler].statStages[STAT_EVASION] > (DEFAULT_STAT_STAGE + 3) && AI_DATA->abilities[opposingBattler] != ABILITY_UNAWARE && AI_DATA->abilities[opposingBattler] != ABILITY_KEEN_EYE - && !(gBattleMons[gActiveBattler].status2 & STATUS2_FORESIGHT) - && !(gStatuses3[gActiveBattler] & STATUS3_MIRACLE_EYED)) + && !(gBattleMons[battler].status2 & STATUS2_FORESIGHT) + && !(gStatuses3[battler] & STATUS3_MIRACLE_EYED)) switchMon = FALSE; } //Secondary Damage if (monAbility != ABILITY_MAGIC_GUARD - && !AiExpectsToFaintPlayer()) + && !AiExpectsToFaintPlayer(battler)) { //Toxic moduloChance = 2; //50% - if (((gBattleMons[gActiveBattler].status1 & STATUS1_TOXIC_COUNTER) >= STATUS1_TOXIC_TURN(2)) - && gBattleMons[gActiveBattler].hp >= (gBattleMons[gActiveBattler].maxHP / 3) + if (((gBattleMons[battler].status1 & STATUS1_TOXIC_COUNTER) >= STATUS1_TOXIC_TURN(2)) + && gBattleMons[battler].hp >= (gBattleMons[battler].maxHP / 3) && (Random() % (moduloChance*chanceReducer)) == 0) switchMon = TRUE; //Cursed moduloChance = 2; //50% - if (gBattleMons[gActiveBattler].status2 & STATUS2_CURSED + if (gBattleMons[battler].status2 & STATUS2_CURSED && (Random() % (moduloChance*chanceReducer)) == 0) switchMon = TRUE; //Nightmare moduloChance = 3; //33.3% - if (gBattleMons[gActiveBattler].status2 & STATUS2_NIGHTMARE + if (gBattleMons[battler].status2 & STATUS2_NIGHTMARE && (Random() % (moduloChance*chanceReducer)) == 0) switchMon = TRUE; //Leech Seed moduloChance = 4; //25% - if (gStatuses3[gActiveBattler] & STATUS3_LEECHSEED + if (gStatuses3[battler] & STATUS3_LEECHSEED && (Random() % (moduloChance*chanceReducer)) == 0) switchMon = TRUE; } //Infatuation - if (gBattleMons[gActiveBattler].status2 & STATUS2_INFATUATION - && !AiExpectsToFaintPlayer()) + if (gBattleMons[battler].status2 & STATUS2_INFATUATION + && !AiExpectsToFaintPlayer(battler)) switchMon = TRUE; //Todo @@ -376,22 +394,22 @@ static bool8 ShouldSwitchIfGameStatePrompt(void) //Semi-Invulnerable if (gStatuses3[opposingBattler] & STATUS3_SEMI_INVULNERABLE) { - if (FindMonThatAbsorbsOpponentsMove()) //If find absorber default to switch + if (FindMonThatAbsorbsOpponentsMove(battler)) //If find absorber default to switch switchMon = TRUE; - if (!AI_OpponentCanFaintAiWithMod(0) - && AnyStatIsRaised(gActiveBattler)) + if (!AI_OpponentCanFaintAiWithMod(battler, 0) + && AnyStatIsRaised(battler)) switchMon = FALSE; - if (AiExpectsToFaintPlayer() - && !WillAIStrikeFirst() - && !AI_OpponentCanFaintAiWithMod(0)) + if (AiExpectsToFaintPlayer(battler) + && !AI_STRIKES_FIRST(battler, opposingBattler, 0) + && !AI_OpponentCanFaintAiWithMod(battler, 0)) switchMon = FALSE; } } if (switchMon) { - *(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = PARTY_SIZE; - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SWITCH, 0); + *(gBattleStruct->AI_monToSwitchIntoId + battler) = PARTY_SIZE; + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_SWITCH, 0); return TRUE; } else @@ -400,32 +418,31 @@ static bool8 ShouldSwitchIfGameStatePrompt(void) } } -static bool8 ShouldSwitchIfAbilityBenefit(void) +static bool8 ShouldSwitchIfAbilityBenefit(u32 battler) { s32 monToSwitchId; s32 moduloChance = 4; //25% Chance Default s32 chanceReducer = 1; //No Reduce default. Increase to reduce - u8 battlerId = GetBattlerPosition(gActiveBattler); - if (AnyStatIsRaised(battlerId)) + if (AnyStatIsRaised(battler)) chanceReducer = 5; // Reduce switchout probability by factor of 5 if setup //Check if ability is blocked - if (gStatuses3[gActiveBattler] & STATUS3_GASTRO_ACID + if (gStatuses3[battler] & STATUS3_GASTRO_ACID ||IsNeutralizingGasOnField()) return FALSE; - switch(AI_DATA->abilities[gActiveBattler]) { + switch(AI_DATA->abilities[battler]) { case ABILITY_NATURAL_CURE: moduloChance = 4; //25% //Attempt to cure bad ailment - if (gBattleMons[gActiveBattler].status1 & (STATUS1_SLEEP | STATUS1_FREEZE | STATUS1_TOXIC_POISON) - && GetMostSuitableMonToSwitchInto() != PARTY_SIZE) + if (gBattleMons[battler].status1 & (STATUS1_SLEEP | STATUS1_FREEZE | STATUS1_TOXIC_POISON) + && GetMostSuitableMonToSwitchInto(battler) != PARTY_SIZE) break; //Attempt to cure lesser ailment - if ((gBattleMons[gActiveBattler].status1 & STATUS1_ANY) - && (gBattleMons[gActiveBattler].hp >= gBattleMons[gActiveBattler].maxHP / 2) - && GetMostSuitableMonToSwitchInto() != PARTY_SIZE + if ((gBattleMons[battler].status1 & STATUS1_ANY) + && (gBattleMons[battler].hp >= gBattleMons[battler].maxHP / 2) + && GetMostSuitableMonToSwitchInto(battler) != PARTY_SIZE && Random() % (moduloChance*chanceReducer) == 0) break; @@ -434,10 +451,10 @@ static bool8 ShouldSwitchIfAbilityBenefit(void) case ABILITY_REGENERATOR: moduloChance = 2; //50% //Don't switch if ailment - if (gBattleMons[gActiveBattler].status1 & STATUS1_ANY) + if (gBattleMons[battler].status1 & STATUS1_ANY) return FALSE; - if ((gBattleMons[gActiveBattler].hp <= ((gBattleMons[gActiveBattler].maxHP * 2) / 3)) - && GetMostSuitableMonToSwitchInto() != PARTY_SIZE + if ((gBattleMons[battler].hp <= ((gBattleMons[battler].maxHP * 2) / 3)) + && GetMostSuitableMonToSwitchInto(battler) != PARTY_SIZE && Random() % (moduloChance*chanceReducer) == 0) break; @@ -447,31 +464,31 @@ static bool8 ShouldSwitchIfAbilityBenefit(void) return FALSE; } - *(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = PARTY_SIZE; - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SWITCH, 0); + *(gBattleStruct->AI_monToSwitchIntoId + battler) = PARTY_SIZE; + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_SWITCH, 0); return TRUE; } -static bool8 HasSuperEffectiveMoveAgainstOpponents(bool8 noRng) +static bool8 HasSuperEffectiveMoveAgainstOpponents(u32 battler, bool8 noRng) { u8 opposingPosition; u8 opposingBattler; s32 i; u16 move; - opposingPosition = BATTLE_OPPOSITE(GetBattlerPosition(gActiveBattler)); + opposingPosition = BATTLE_OPPOSITE(GetBattlerPosition(battler)); opposingBattler = GetBattlerAtPosition(opposingPosition); if (!(gAbsentBattlerFlags & gBitTable[opposingBattler])) { for (i = 0; i < MAX_MON_MOVES; i++) { - move = gBattleMons[gActiveBattler].moves[i]; + move = gBattleMons[battler].moves[i]; if (move == MOVE_NONE) continue; - if (AI_GetTypeEffectiveness(move, gActiveBattler, opposingBattler) >= UQ_4_12(2.0)) + if (AI_GetTypeEffectiveness(move, battler, opposingBattler) >= UQ_4_12(2.0)) { if (noRng) return TRUE; @@ -489,11 +506,11 @@ static bool8 HasSuperEffectiveMoveAgainstOpponents(bool8 noRng) { for (i = 0; i < MAX_MON_MOVES; i++) { - move = gBattleMons[gActiveBattler].moves[i]; + move = gBattleMons[battler].moves[i]; if (move == MOVE_NONE) continue; - if (AI_GetTypeEffectiveness(move, gActiveBattler, opposingBattler) >= UQ_4_12(2.0)) + if (AI_GetTypeEffectiveness(move, battler, opposingBattler) >= UQ_4_12(2.0)) { if (noRng) return TRUE; @@ -506,21 +523,21 @@ static bool8 HasSuperEffectiveMoveAgainstOpponents(bool8 noRng) return FALSE; } -static bool8 AreStatsRaised(void) +static bool8 AreStatsRaised(u32 battler) { u8 buffedStatsValue = 0; s32 i; for (i = 0; i < NUM_BATTLE_STATS; i++) { - if (gBattleMons[gActiveBattler].statStages[i] > DEFAULT_STAT_STAGE) - buffedStatsValue += gBattleMons[gActiveBattler].statStages[i] - DEFAULT_STAT_STAGE; + if (gBattleMons[battler].statStages[i] > DEFAULT_STAT_STAGE) + buffedStatsValue += gBattleMons[battler].statStages[i] - DEFAULT_STAT_STAGE; } return (buffedStatsValue > 3); } -static bool8 FindMonWithFlagsAndSuperEffective(u16 flags, u8 moduloPercent) +static bool8 FindMonWithFlagsAndSuperEffective(u32 battler, u16 flags, u8 moduloPercent) { u8 battlerIn1, battlerIn2; s32 firstId; @@ -529,45 +546,41 @@ static bool8 FindMonWithFlagsAndSuperEffective(u16 flags, u8 moduloPercent) s32 i, j; u16 move; - if (gLastLandedMoves[gActiveBattler] == MOVE_NONE) + if (gLastLandedMoves[battler] == MOVE_NONE) return FALSE; - if (gLastLandedMoves[gActiveBattler] == MOVE_UNAVAILABLE) + if (gLastLandedMoves[battler] == MOVE_UNAVAILABLE) return FALSE; - if (gLastHitBy[gActiveBattler] == 0xFF) + if (gLastHitBy[battler] == 0xFF) return FALSE; - if (IS_MOVE_STATUS(gLastLandedMoves[gActiveBattler])) + if (IS_MOVE_STATUS(gLastLandedMoves[battler])) return FALSE; if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { - battlerIn1 = gActiveBattler; - if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))]) - battlerIn2 = gActiveBattler; + battlerIn1 = battler; + if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler)))]) + battlerIn2 = battler; else - battlerIn2 = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler))); + battlerIn2 = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler))); } else { - battlerIn1 = gActiveBattler; - battlerIn2 = gActiveBattler; + battlerIn1 = battler; + battlerIn2 = battler; } - GetAIPartyIndexes(gActiveBattler, &firstId, &lastId); + GetAIPartyIndexes(battler, &firstId, &lastId); - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) party = gPlayerParty; else party = gEnemyParty; for (i = firstId; i < lastId; i++) { - u16 species; - u16 monAbility; + u16 species, monAbility; - if (GetMonData(&party[i], MON_DATA_HP) == 0) - continue; - species = GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG); - if (species == SPECIES_NONE || species == SPECIES_EGG) + if (!IsValidForBattle(&party[i])) continue; if (i == gBattlerPartyIndexes[battlerIn1]) continue; @@ -577,15 +590,15 @@ static bool8 FindMonWithFlagsAndSuperEffective(u16 flags, u8 moduloPercent) continue; if (i == *(gBattleStruct->monToSwitchIntoId + battlerIn2)) continue; - if (IsAceMon(gActiveBattler, i)) + if (IsAceMon(battler, i)) continue; + species = GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG); monAbility = GetMonAbility(&party[i]); - - CalcPartyMonTypeEffectivenessMultiplier(gLastLandedMoves[gActiveBattler], species, monAbility); + CalcPartyMonTypeEffectivenessMultiplier(gLastLandedMoves[battler], species, monAbility); if (gMoveResultFlags & flags) { - battlerIn1 = gLastHitBy[gActiveBattler]; + battlerIn1 = gLastHitBy[battler]; for (j = 0; j < MAX_MON_MOVES; j++) { @@ -593,10 +606,10 @@ static bool8 FindMonWithFlagsAndSuperEffective(u16 flags, u8 moduloPercent) if (move == 0) continue; - if (AI_GetTypeEffectiveness(move, gActiveBattler, battlerIn1) >= UQ_4_12(2.0) && Random() % moduloPercent == 0) + if (AI_GetTypeEffectiveness(move, battler, battlerIn1) >= UQ_4_12(2.0) && Random() % moduloPercent == 0) { - *(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = i; - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SWITCH, 0); + *(gBattleStruct->AI_monToSwitchIntoId + battler) = i; + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_SWITCH, 0); return TRUE; } } @@ -606,7 +619,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u16 flags, u8 moduloPercent) return FALSE; } -bool32 ShouldSwitch(void) +bool32 ShouldSwitch(u32 battler) { u8 battlerIn1, battlerIn2; s32 firstId; @@ -616,11 +629,11 @@ bool32 ShouldSwitch(void) s32 availableToSwitch; bool32 hasAceMon = FALSE; - if (gBattleMons[gActiveBattler].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION)) + if (gBattleMons[battler].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION)) return FALSE; - if (gStatuses3[gActiveBattler] & STATUS3_ROOTED) + if (gStatuses3[battler] & STATUS3_ROOTED) return FALSE; - if (IsAbilityPreventingEscape(gActiveBattler)) + if (IsAbilityPreventingEscape(battler)) return FALSE; if (gBattleTypeFlags & BATTLE_TYPE_ARENA) return FALSE; @@ -629,32 +642,28 @@ bool32 ShouldSwitch(void) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { - battlerIn1 = gActiveBattler; - if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))]) - battlerIn2 = gActiveBattler; + battlerIn1 = battler; + if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler)))]) + battlerIn2 = battler; else - battlerIn2 = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler))); + battlerIn2 = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler))); } else { - battlerIn1 = gActiveBattler; - battlerIn2 = gActiveBattler; + battlerIn1 = battler; + battlerIn2 = battler; } - GetAIPartyIndexes(gActiveBattler, &firstId, &lastId); + GetAIPartyIndexes(battler, &firstId, &lastId); - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) party = gPlayerParty; else party = gEnemyParty; for (i = firstId; i < lastId; i++) { - if (GetMonData(&party[i], MON_DATA_HP) == 0) - continue; - if (GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG) == SPECIES_NONE) - continue; - if (GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG) == SPECIES_EGG) + if (!IsValidForBattle(&party[i])) continue; if (i == gBattlerPartyIndexes[battlerIn1]) continue; @@ -664,7 +673,7 @@ bool32 ShouldSwitch(void) continue; if (i == *(gBattleStruct->monToSwitchIntoId + battlerIn2)) continue; - if (IsAceMon(gActiveBattler, i)) + if (IsAceMon(battler, i)) { hasAceMon = TRUE; continue; @@ -685,73 +694,73 @@ bool32 ShouldSwitch(void) //Since the order is sequencial, and some of these functions prompt switch to specific party members. //These Functions can prompt switch to specific party members - if (ShouldSwitchIfWonderGuard()) + if (ShouldSwitchIfWonderGuard(battler)) return TRUE; - if (ShouldSwitchIfGameStatePrompt()) + if (ShouldSwitchIfGameStatePrompt(battler)) return TRUE; - if (FindMonThatAbsorbsOpponentsMove()) + if (FindMonThatAbsorbsOpponentsMove(battler)) return TRUE; //These Functions can prompt switch to generic pary members - if (ShouldSwitchIfAllBadMoves()) + if (ShouldSwitchIfAllBadMoves(battler)) return TRUE; - if (ShouldSwitchIfAbilityBenefit()) + if (ShouldSwitchIfAbilityBenefit(battler)) return TRUE; //Removing switch capabilites under specific conditions //These Functions prevent the "FindMonWithFlagsAndSuperEffective" from getting out of hand. - if (HasSuperEffectiveMoveAgainstOpponents(FALSE)) + if (HasSuperEffectiveMoveAgainstOpponents(battler, FALSE)) return FALSE; - if (AreStatsRaised()) + if (AreStatsRaised(battler)) return FALSE; //Default Function //Can prompt switch if AI has a pokemon in party that resists current opponent & has super effective move - if (FindMonWithFlagsAndSuperEffective(MOVE_RESULT_DOESNT_AFFECT_FOE, 2) - || FindMonWithFlagsAndSuperEffective(MOVE_RESULT_NOT_VERY_EFFECTIVE, 3)) + if (FindMonWithFlagsAndSuperEffective(battler, MOVE_RESULT_DOESNT_AFFECT_FOE, 2) + || FindMonWithFlagsAndSuperEffective(battler, MOVE_RESULT_NOT_VERY_EFFECTIVE, 3)) return TRUE; return FALSE; } -void AI_TrySwitchOrUseItem(void) +void AI_TrySwitchOrUseItem(u32 battler) { struct Pokemon *party; u8 battlerIn1, battlerIn2; s32 firstId; s32 lastId; // + 1 - u8 battlerIdentity = GetBattlerPosition(gActiveBattler); + u8 battlerPosition = GetBattlerPosition(battler); - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) party = gPlayerParty; else party = gEnemyParty; if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) { - if (ShouldSwitch()) + if (ShouldSwitch(battler)) { - if (*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) == PARTY_SIZE) + if (*(gBattleStruct->AI_monToSwitchIntoId + battler) == PARTY_SIZE) { - s32 monToSwitchId = GetMostSuitableMonToSwitchInto(); + s32 monToSwitchId = GetMostSuitableMonToSwitchInto(battler); if (monToSwitchId == PARTY_SIZE) { if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) { - battlerIn1 = GetBattlerAtPosition(battlerIdentity); + battlerIn1 = GetBattlerAtPosition(battlerPosition); battlerIn2 = battlerIn1; } else { - battlerIn1 = GetBattlerAtPosition(battlerIdentity); - battlerIn2 = GetBattlerAtPosition(BATTLE_PARTNER(battlerIdentity)); + battlerIn1 = GetBattlerAtPosition(battlerPosition); + battlerIn2 = GetBattlerAtPosition(BATTLE_PARTNER(battlerPosition)); } - GetAIPartyIndexes(gActiveBattler, &firstId, &lastId); + GetAIPartyIndexes(battler, &firstId, &lastId); for (monToSwitchId = (lastId-1); monToSwitchId >= firstId; monToSwitchId--) { - if (GetMonData(&party[monToSwitchId], MON_DATA_HP) == 0) + if (!IsValidForBattle(&party[monToSwitchId])) continue; if (monToSwitchId == gBattlerPartyIndexes[battlerIn1]) continue; @@ -761,31 +770,31 @@ void AI_TrySwitchOrUseItem(void) continue; if (monToSwitchId == *(gBattleStruct->monToSwitchIntoId + battlerIn2)) continue; - if (IsAceMon(gActiveBattler, monToSwitchId)) + if (IsAceMon(battler, monToSwitchId)) continue; break; } } - *(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = monToSwitchId; + *(gBattleStruct->AI_monToSwitchIntoId + battler) = monToSwitchId; } - *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = *(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler); + *(gBattleStruct->monToSwitchIntoId + battler) = *(gBattleStruct->AI_monToSwitchIntoId + battler); return; } - else if (ShouldUseItem()) + else if (ShouldUseItem(battler)) { return; } } - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_USE_MOVE, BATTLE_OPPOSITE(gActiveBattler) << 8); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_USE_MOVE, BATTLE_OPPOSITE(battler) << 8); } // If there are two(or more) mons to choose from, always choose one that has baton pass // as most often it can't do much on its own. -static u32 GetBestMonBatonPass(struct Pokemon *party, int firstId, int lastId, u8 invalidMons, int aliveCount) +static u32 GetBestMonBatonPass(struct Pokemon *party, int firstId, int lastId, u8 invalidMons, int aliveCount, u32 battler, u32 opposingBattler) { int i, j, bits = 0; @@ -793,6 +802,8 @@ static u32 GetBestMonBatonPass(struct Pokemon *party, int firstId, int lastId, u { if (invalidMons & gBitTable[i]) continue; + if (IsAiPartyMonOHKOBy(battler, opposingBattler, &party[i])) + continue; for (j = 0; j < MAX_MON_MOVES; j++) { @@ -816,13 +827,13 @@ static u32 GetBestMonBatonPass(struct Pokemon *party, int firstId, int lastId, u return PARTY_SIZE; } -static u32 GetBestMonTypeMatchup(struct Pokemon *party, int firstId, int lastId, u8 invalidMons, u32 opposingBattler) +static u32 GetBestMonTypeMatchup(struct Pokemon *party, int firstId, int lastId, u8 invalidMons, u32 battler, u32 opposingBattler) { int i, bits = 0; while (bits != 0x3F) // All mons were checked. { - u16 bestResist = UQ_4_12(1.0); + uq4_12_t bestResist = UQ_4_12(1.0); int bestMonId = PARTY_SIZE; // Find the mon whose type is the most suitable defensively. for (i = firstId; i < lastId; i++) @@ -830,21 +841,24 @@ static u32 GetBestMonTypeMatchup(struct Pokemon *party, int firstId, int lastId, if (!(gBitTable[i] & invalidMons) && !(gBitTable[i] & bits)) { u16 species = GetMonData(&party[i], MON_DATA_SPECIES); - u16 typeEffectiveness = UQ_4_12(1.0); + uq4_12_t typeEffectiveness = UQ_4_12(1.0); u8 atkType1 = gBattleMons[opposingBattler].type1; u8 atkType2 = gBattleMons[opposingBattler].type2; u8 defType1 = gSpeciesInfo[species].types[0]; u8 defType2 = gSpeciesInfo[species].types[1]; - MulModifier(&typeEffectiveness, (GetTypeModifier(atkType1, defType1))); + if (IsAiPartyMonOHKOBy(battler, opposingBattler, &party[i])) + continue; + + typeEffectiveness = uq4_12_multiply(typeEffectiveness, (GetTypeModifier(atkType1, defType1))); if (atkType2 != atkType1) - MulModifier(&typeEffectiveness, (GetTypeModifier(atkType2, defType1))); + typeEffectiveness = uq4_12_multiply(typeEffectiveness, (GetTypeModifier(atkType2, defType1))); if (defType2 != defType1) { - MulModifier(&typeEffectiveness, (GetTypeModifier(atkType1, defType2))); + typeEffectiveness = uq4_12_multiply(typeEffectiveness, (GetTypeModifier(atkType1, defType2))); if (atkType2 != atkType1) - MulModifier(&typeEffectiveness, (GetTypeModifier(atkType2, defType2))); + typeEffectiveness = uq4_12_multiply(typeEffectiveness, (GetTypeModifier(atkType2, defType2))); } if (typeEffectiveness < bestResist) { @@ -860,7 +874,7 @@ static u32 GetBestMonTypeMatchup(struct Pokemon *party, int firstId, int lastId, for (i = 0; i < MAX_MON_MOVES; i++) { u32 move = GetMonData(&party[bestMonId], MON_DATA_MOVE1 + i); - if (move != MOVE_NONE && AI_GetTypeEffectiveness(move, gActiveBattler, opposingBattler) >= UQ_4_12(2.0)) + if (move != MOVE_NONE && AI_GetTypeEffectiveness(move, battler, opposingBattler) >= UQ_4_12(2.0)) break; } @@ -878,10 +892,10 @@ static u32 GetBestMonTypeMatchup(struct Pokemon *party, int firstId, int lastId, return PARTY_SIZE; } -static u32 GetBestMonDmg(struct Pokemon *party, int firstId, int lastId, u8 invalidMons, u32 opposingBattler) +static u32 GetBestMonDmg(struct Pokemon *party, int firstId, int lastId, u8 invalidMons, u32 battler, u32 opposingBattler) { int i, j; - int bestDmg = 0; + int dmg, bestDmg = 0; int bestMonId = PARTY_SIZE; gMoveResultFlags = 0; @@ -890,29 +904,24 @@ static u32 GetBestMonDmg(struct Pokemon *party, int firstId, int lastId, u8 inva { if (gBitTable[i] & invalidMons) continue; + if (IsAiPartyMonOHKOBy(battler, opposingBattler, &party[i])) + continue; - for (j = 0; j < MAX_MON_MOVES; j++) + dmg = AI_CalcPartyMonBestMoveDamage(battler, opposingBattler, &party[i], NULL); + if (bestDmg < dmg) { - u32 move = GetMonData(&party[i], MON_DATA_MOVE1 + j); - if (move != MOVE_NONE && gBattleMoves[move].power != 0) - { - s32 dmg = AI_CalcPartyMonDamage(move, gActiveBattler, opposingBattler, &party[i]); - if (bestDmg < dmg) - { - bestDmg = dmg; - bestMonId = i; - } - } + bestDmg = dmg; + bestMonId = i; } } return bestMonId; } -u8 GetMostSuitableMonToSwitchInto(void) +u8 GetMostSuitableMonToSwitchInto(u32 battler) { u32 opposingBattler = 0; - u32 bestMonId = 0; + u32 bestMonId = PARTY_SIZE; u8 battlerIn1 = 0, battlerIn2 = 0; s32 firstId = 0; s32 lastId = 0; // + 1 @@ -920,18 +929,18 @@ u8 GetMostSuitableMonToSwitchInto(void) s32 i, j, aliveCount = 0; u32 invalidMons = 0, aceMonId = PARTY_SIZE; - if (*(gBattleStruct->monToSwitchIntoId + gActiveBattler) != PARTY_SIZE) - return *(gBattleStruct->monToSwitchIntoId + gActiveBattler); + if (*(gBattleStruct->monToSwitchIntoId + battler) != PARTY_SIZE) + return *(gBattleStruct->monToSwitchIntoId + battler); if (gBattleTypeFlags & BATTLE_TYPE_ARENA) - return gBattlerPartyIndexes[gActiveBattler] + 1; + return gBattlerPartyIndexes[battler] + 1; if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { - battlerIn1 = gActiveBattler; - if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))]) - battlerIn2 = gActiveBattler; + battlerIn1 = battler; + if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler)))]) + battlerIn2 = battler; else - battlerIn2 = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler))); + battlerIn2 = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler))); opposingBattler = BATTLE_OPPOSITE(battlerIn1); if (gAbsentBattlerFlags & gBitTable[opposingBattler]) @@ -939,14 +948,14 @@ u8 GetMostSuitableMonToSwitchInto(void) } else { - opposingBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(gActiveBattler))); - battlerIn1 = gActiveBattler; - battlerIn2 = gActiveBattler; + opposingBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(battler))); + battlerIn1 = battler; + battlerIn2 = battler; } - GetAIPartyIndexes(gActiveBattler, &firstId, &lastId); + GetAIPartyIndexes(battler, &firstId, &lastId); - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) party = gPlayerParty; else party = gEnemyParty; @@ -954,19 +963,16 @@ u8 GetMostSuitableMonToSwitchInto(void) // Get invalid slots ids. for (i = firstId; i < lastId; i++) { - u16 species = GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG); - if (species == SPECIES_NONE - || species == SPECIES_EGG - || GetMonData(&party[i], MON_DATA_HP) == 0 + if (!IsValidForBattle(&party[i]) || gBattlerPartyIndexes[battlerIn1] == i || gBattlerPartyIndexes[battlerIn2] == i || i == *(gBattleStruct->monToSwitchIntoId + battlerIn1) || i == *(gBattleStruct->monToSwitchIntoId + battlerIn2) - || (GetMonAbility(&party[i]) == ABILITY_TRUANT && IsTruantMonVulnerable(gActiveBattler, opposingBattler))) // While not really invalid per say, not really wise to switch into this mon.) + || (GetMonAbility(&party[i]) == ABILITY_TRUANT && IsTruantMonVulnerable(battler, opposingBattler))) // While not really invalid per say, not really wise to switch into this mon.) { invalidMons |= gBitTable[i]; } - else if (IsAceMon(gActiveBattler, i))// Save Ace Pokemon for last. + else if (IsAceMon(battler, i))// Save Ace Pokemon for last. { aceMonId = i; invalidMons |= gBitTable[i]; @@ -977,15 +983,15 @@ u8 GetMostSuitableMonToSwitchInto(void) } } - bestMonId = GetBestMonBatonPass(party, firstId, lastId, invalidMons, aliveCount); + bestMonId = GetBestMonBatonPass(party, firstId, lastId, invalidMons, aliveCount, battler, opposingBattler); if (bestMonId != PARTY_SIZE) return bestMonId; - bestMonId = GetBestMonTypeMatchup(party, firstId, lastId, invalidMons, opposingBattler); + bestMonId = GetBestMonTypeMatchup(party, firstId, lastId, invalidMons, battler, opposingBattler); if (bestMonId != PARTY_SIZE) return bestMonId; - bestMonId = GetBestMonDmg(party, firstId, lastId, invalidMons, opposingBattler); + bestMonId = GetBestMonDmg(party, firstId, lastId, invalidMons, battler, opposingBattler); if (bestMonId != PARTY_SIZE) return bestMonId; @@ -996,18 +1002,18 @@ u8 GetMostSuitableMonToSwitchInto(void) return PARTY_SIZE; } -static bool32 AiExpectsToFaintPlayer(void) +static bool32 AiExpectsToFaintPlayer(u32 battler) { bool32 canFaintPlayer; u32 i; - u8 target = gBattleStruct->aiChosenTarget[gActiveBattler]; + u8 target = gBattleStruct->aiChosenTarget[battler]; - if (gBattleStruct->aiMoveOrAction[gActiveBattler] > 3) + if (gBattleStruct->aiMoveOrAction[battler] > 3) return FALSE; // AI not planning to use move - if (GetBattlerSide(target) != GetBattlerSide(gActiveBattler) - && CanIndexMoveFaintTarget(gActiveBattler, target, gBattleStruct->aiMoveOrAction[gActiveBattler], 0) - && AI_WhoStrikesFirst(gActiveBattler, target, GetAIChosenMove(gActiveBattler)) == AI_IS_FASTER) { + if (GetBattlerSide(target) != GetBattlerSide(battler) + && CanIndexMoveFaintTarget(battler, target, gBattleStruct->aiMoveOrAction[battler], 0) + && AI_WhoStrikesFirst(battler, target, GetAIChosenMove(battler)) == AI_IS_FASTER) { // We expect to faint the target and move first -> dont use an item return TRUE; } @@ -1015,34 +1021,35 @@ static bool32 AiExpectsToFaintPlayer(void) return FALSE; } -static bool8 ShouldUseItem(void) +static bool8 ShouldUseItem(u32 battler) { struct Pokemon *party; s32 i; u8 validMons = 0; bool8 shouldUse = FALSE; + if (IsAiVsAiBattle()) + return FALSE; + // If teaming up with player and Pokemon is on the right, or Pokemon is currently held by Sky Drop - if ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT) - || gStatuses3[gActiveBattler] & STATUS3_SKY_DROPPED) + if ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && GetBattlerPosition(battler) == B_POSITION_PLAYER_RIGHT) + || gStatuses3[battler] & STATUS3_SKY_DROPPED) return FALSE; - if (gStatuses3[gActiveBattler] & STATUS3_EMBARGO) + if (gStatuses3[battler] & STATUS3_EMBARGO) return FALSE; - if (AiExpectsToFaintPlayer()) + if (AiExpectsToFaintPlayer(battler)) return FALSE; - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) party = gPlayerParty; else party = gEnemyParty; for (i = 0; i < PARTY_SIZE; i++) { - if (GetMonData(&party[i], MON_DATA_HP) != 0 - && GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG) != SPECIES_NONE - && GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG) != SPECIES_EGG) + if (IsValidForBattle(&party[i])) { validMons++; } @@ -1065,48 +1072,48 @@ static bool8 ShouldUseItem(void) switch (ItemId_GetBattleUsage(item)) { case EFFECT_ITEM_HEAL_AND_CURE_STATUS: - shouldUse = AI_ShouldHeal(0); + shouldUse = AI_ShouldHeal(battler, 0); break; case EFFECT_ITEM_RESTORE_HP: - shouldUse = AI_ShouldHeal(itemEffects[GetItemEffectParamOffset(item, 4, 4)]); + shouldUse = AI_ShouldHeal(battler, itemEffects[GetItemEffectParamOffset(battler, item, 4, ITEM4_HEAL_HP)]); break; case EFFECT_ITEM_CURE_STATUS: - if (itemEffects[3] & ITEM3_SLEEP && gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP) + if (itemEffects[3] & ITEM3_SLEEP && gBattleMons[battler].status1 & STATUS1_SLEEP) shouldUse = TRUE; - if (itemEffects[3] & ITEM3_POISON && (gBattleMons[gActiveBattler].status1 & STATUS1_POISON - || gBattleMons[gActiveBattler].status1 & STATUS1_TOXIC_POISON)) + if (itemEffects[3] & ITEM3_POISON && (gBattleMons[battler].status1 & STATUS1_POISON + || gBattleMons[battler].status1 & STATUS1_TOXIC_POISON)) shouldUse = TRUE; - if (itemEffects[3] & ITEM3_BURN && gBattleMons[gActiveBattler].status1 & STATUS1_BURN) + if (itemEffects[3] & ITEM3_BURN && gBattleMons[battler].status1 & STATUS1_BURN) shouldUse = TRUE; - if (itemEffects[3] & ITEM3_FREEZE && (gBattleMons[gActiveBattler].status1 & STATUS1_FREEZE || gBattleMons[gActiveBattler].status1 & STATUS1_FROSTBITE)) + if (itemEffects[3] & ITEM3_FREEZE && (gBattleMons[battler].status1 & STATUS1_FREEZE || gBattleMons[battler].status1 & STATUS1_FROSTBITE)) shouldUse = TRUE; - if (itemEffects[3] & ITEM3_PARALYSIS && gBattleMons[gActiveBattler].status1 & STATUS1_PARALYSIS) + if (itemEffects[3] & ITEM3_PARALYSIS && gBattleMons[battler].status1 & STATUS1_PARALYSIS) shouldUse = TRUE; - if (itemEffects[3] & ITEM3_CONFUSION && gBattleMons[gActiveBattler].status2 & STATUS2_CONFUSION) + if (itemEffects[3] & ITEM3_CONFUSION && gBattleMons[battler].status2 & STATUS2_CONFUSION) shouldUse = TRUE; break; case EFFECT_ITEM_INCREASE_STAT: case EFFECT_ITEM_INCREASE_ALL_STATS: - if (!gDisableStructs[gActiveBattler].isFirstTurn - || AI_OpponentCanFaintAiWithMod(0)) + if (!gDisableStructs[battler].isFirstTurn + || AI_OpponentCanFaintAiWithMod(battler, 0)) break; shouldUse = TRUE; break; case EFFECT_ITEM_SET_FOCUS_ENERGY: - if (!gDisableStructs[gActiveBattler].isFirstTurn - || gBattleMons[gActiveBattler].status2 & STATUS2_FOCUS_ENERGY - || AI_OpponentCanFaintAiWithMod(0)) + if (!gDisableStructs[battler].isFirstTurn + || gBattleMons[battler].status2 & STATUS2_FOCUS_ENERGY + || AI_OpponentCanFaintAiWithMod(battler, 0)) break; shouldUse = TRUE; break; case EFFECT_ITEM_SET_MIST: - battlerSide = GetBattlerSide(gActiveBattler); - if (gDisableStructs[gActiveBattler].isFirstTurn && gSideTimers[battlerSide].mistTimer == 0) + battlerSide = GetBattlerSide(battler); + if (gDisableStructs[battler].isFirstTurn && gSideTimers[battlerSide].mistTimer == 0) shouldUse = TRUE; break; case EFFECT_ITEM_REVIVE: - gBattleStruct->itemPartyIndex[gActiveBattler] = GetFirstFaintedPartyIndex(gActiveBattler); - if (gBattleStruct->itemPartyIndex[gActiveBattler] != PARTY_SIZE) // Revive if possible. + gBattleStruct->itemPartyIndex[battler] = GetFirstFaintedPartyIndex(battler); + if (gBattleStruct->itemPartyIndex[battler] != PARTY_SIZE) // Revive if possible. shouldUse = TRUE; break; default: @@ -1115,10 +1122,10 @@ static bool8 ShouldUseItem(void) if (shouldUse) { // Set selected party ID to current battler if none chosen. - if (gBattleStruct->itemPartyIndex[gActiveBattler] == PARTY_SIZE) - gBattleStruct->itemPartyIndex[gActiveBattler] = gBattlerPartyIndexes[gActiveBattler]; - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_USE_ITEM, 0); - gBattleStruct->chosenItem[gActiveBattler] = item; + if (gBattleStruct->itemPartyIndex[battler] == PARTY_SIZE) + gBattleStruct->itemPartyIndex[battler] = gBattlerPartyIndexes[battler]; + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_USE_ITEM, 0); + gBattleStruct->chosenItem[battler] = item; gBattleResources->battleHistory->trainerItems[i] = 0; return shouldUse; } @@ -1127,27 +1134,27 @@ static bool8 ShouldUseItem(void) return FALSE; } -static bool32 AI_ShouldHeal(u32 healAmount) +static bool32 AI_ShouldHeal(u32 battler, u32 healAmount) { bool32 shouldHeal = FALSE; - if (gBattleMons[gActiveBattler].hp < gBattleMons[gActiveBattler].maxHP / 4 - || gBattleMons[gActiveBattler].hp == 0 - || (healAmount != 0 && gBattleMons[gActiveBattler].maxHP - gBattleMons[gActiveBattler].hp > healAmount)) { + if (gBattleMons[battler].hp < gBattleMons[battler].maxHP / 4 + || gBattleMons[battler].hp == 0 + || (healAmount != 0 && gBattleMons[battler].maxHP - gBattleMons[battler].hp > healAmount)) { // We have low enough HP to consider healing - shouldHeal = !AI_OpponentCanFaintAiWithMod(healAmount); // if target can kill us even after we heal, why bother + shouldHeal = !AI_OpponentCanFaintAiWithMod(battler, healAmount); // if target can kill us even after we heal, why bother } return shouldHeal; } -static bool32 AI_OpponentCanFaintAiWithMod(u32 healAmount) +static bool32 AI_OpponentCanFaintAiWithMod(u32 battler, u32 healAmount) { u32 i; // Check special cases to NOT heal for (i = 0; i < gBattlersCount; i++) { if (GetBattlerSide(i) == B_SIDE_PLAYER) { - if (CanTargetFaintAiWithMod(i, gActiveBattler, healAmount, 0)) { + if (CanTargetFaintAiWithMod(i, battler, healAmount, 0)) { // Target is expected to faint us return TRUE; } @@ -1155,3 +1162,29 @@ static bool32 AI_OpponentCanFaintAiWithMod(u32 healAmount) } return FALSE; } + +static bool32 IsAiPartyMonOHKOBy(u32 battlerAi, u32 battlerAtk, struct Pokemon *aiMon) +{ + bool32 ret = FALSE; + struct BattlePokemon *savedBattleMons; + s32 hp = GetMonData(aiMon, MON_DATA_HP); + s32 bestDmg = AI_CalcPartyMonBestMoveDamage(battlerAtk, battlerAi, NULL, aiMon); + + switch (GetNoOfHitsToKO(bestDmg, hp)) + { + case 1: + ret = TRUE; + break; + case 2: // if AI mon is faster allow 2 turns + savedBattleMons = AllocSaveBattleMons(); + PokemonToBattleMon(aiMon, &gBattleMons[battlerAi]); + if (AI_WhoStrikesFirst(battlerAi, battlerAtk, 0) == AI_IS_SLOWER) + ret = TRUE; + else + ret = FALSE; + FreeRestoreBattleMons(savedBattleMons); + break; + } + + return ret; +} diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index aff8ba91afc3..0a65f40833e4 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -8,6 +8,7 @@ #include "battle_ai_switch_items.h" #include "battle_factory.h" #include "battle_setup.h" +#include "event_data.h" #include "data.h" #include "item.h" #include "pokemon.h" @@ -21,7 +22,17 @@ #include "constants/moves.h" #include "constants/items.h" -static u32 AI_GetEffectiveness(u16 multiplier); +#define CHECK_MOVE_FLAG(flag) \ + s32 i; \ + u16 *moves = GetMovesArray(battler); \ + for (i = 0; i < MAX_MON_MOVES; i++) \ + { \ + if (moves[i] != MOVE_NONE && moves[i] != MOVE_UNAVAILABLE && gBattleMoves[moves[i]].flag) \ + return TRUE; \ + } \ + return FALSE + +static u32 AI_GetEffectiveness(uq4_12_t multiplier); // Const Data static const s8 sAiAbilityRatings[ABILITIES_COUNT] = @@ -368,6 +379,7 @@ static const u16 sIgnoredPowerfulMoveEffects[] = EFFECT_ERUPTION, EFFECT_OVERHEAT, EFFECT_MIND_BLOWN, + EFFECT_MAKE_IT_RAIN, IGNORED_MOVES_END }; @@ -381,35 +393,6 @@ static const u16 sIgnoreMoldBreakerMoves[] = MOVE_SEARING_SUNRAZE_SMASH, }; -static const u16 sInstructBannedMoves[] = -{ - MOVE_INSTRUCT, - MOVE_BIDE, - MOVE_FOCUS_PUNCH, - MOVE_BEAK_BLAST, - MOVE_SHELL_TRAP, - MOVE_SKETCH, - MOVE_TRANSFORM, - MOVE_MIMIC, - MOVE_KINGS_SHIELD, - MOVE_STRUGGLE, - MOVE_BOUNCE, - MOVE_DIG, - MOVE_DIVE, - MOVE_FLY, - MOVE_FREEZE_SHOCK, - MOVE_GEOMANCY, - MOVE_ICE_BURN, - MOVE_PHANTOM_FORCE, - MOVE_RAZOR_WIND, - MOVE_SHADOW_FORCE, - MOVE_SKULL_BASH, - MOVE_SKY_ATTACK, - MOVE_SKY_DROP, - MOVE_SOLAR_BEAM, - MOVE_SOLAR_BLADE, -}; - static const u16 sRechargeMoves[] = { MOVE_HYPER_BEAM, @@ -436,26 +419,21 @@ static const u16 sOtherMoveCallingMoves[] = }; // Functions -u16 GetAIChosenMove(u8 battlerId) +u32 GetAIChosenMove(u32 battlerId) { return (gBattleMons[battlerId].moves[gBattleStruct->aiMoveOrAction[battlerId]]); } -bool32 WillAIStrikeFirst(void) -{ - return (AI_WhoStrikesFirst(sBattler_AI, gBattlerTarget, AI_THINKING_STRUCT->moveConsidered) == AI_IS_FASTER); -} - -bool32 AI_RandLessThan(u8 val) +bool32 AI_RandLessThan(u32 val) { if ((Random() % 0xFF) < val) return TRUE; return FALSE; } -void RecordLastUsedMoveByTarget(void) +bool32 IsAiVsAiBattle(void) { - RecordKnownMove(gBattlerTarget, gLastMoves[gBattlerTarget]); + return (B_FLAG_AI_VS_AI_BATTLE && FlagGet(B_FLAG_AI_VS_AI_BATTLE)); } bool32 BattlerHasAi(u32 battlerId) @@ -463,12 +441,17 @@ bool32 BattlerHasAi(u32 battlerId) switch (GetBattlerPosition(battlerId)) { case B_POSITION_PLAYER_LEFT: + if (IsAiVsAiBattle()) + return TRUE; default: return FALSE; case B_POSITION_OPPONENT_LEFT: return TRUE; case B_POSITION_PLAYER_RIGHT: - return ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) != 0); + if ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) || IsAiVsAiBattle()) + return TRUE; + else + return FALSE; case B_POSITION_OPPONENT_RIGHT: return TRUE; } @@ -482,7 +465,7 @@ bool32 IsAiBattlerAware(u32 battlerId) return BattlerHasAi(battlerId); } -void ClearBattlerMoveHistory(u8 battlerId) +void ClearBattlerMoveHistory(u32 battlerId) { memset(BATTLE_HISTORY->usedMoves[battlerId], 0, sizeof(BATTLE_HISTORY->usedMoves[battlerId])); memset(BATTLE_HISTORY->moveHistory[battlerId], 0, sizeof(BATTLE_HISTORY->moveHistory[battlerId])); @@ -498,7 +481,7 @@ void RecordLastUsedMoveBy(u32 battlerId, u32 move) BATTLE_HISTORY->moveHistory[battlerId][*index] = move; } -void RecordKnownMove(u8 battlerId, u32 move) +void RecordKnownMove(u32 battlerId, u32 move) { s32 i; for (i = 0; i < MAX_MON_MOVES; i++) @@ -514,29 +497,34 @@ void RecordKnownMove(u8 battlerId, u32 move) } } -void RecordAbilityBattle(u8 battlerId, u16 abilityId) +void RecordAllMoves(u32 battler) +{ + memcpy(AI_PARTY->mons[GetBattlerSide(battler)][gBattlerPartyIndexes[battler]].moves, gBattleMons[battler].moves, MAX_MON_MOVES * sizeof(u16)); +} + +void RecordAbilityBattle(u32 battlerId, u32 abilityId) { BATTLE_HISTORY->abilities[battlerId] = abilityId; AI_PARTY->mons[GetBattlerSide(battlerId)][gBattlerPartyIndexes[battlerId]].ability = abilityId; } -void ClearBattlerAbilityHistory(u8 battlerId) +void ClearBattlerAbilityHistory(u32 battlerId) { BATTLE_HISTORY->abilities[battlerId] = ABILITY_NONE; } -void RecordItemEffectBattle(u8 battlerId, u8 itemEffect) +void RecordItemEffectBattle(u32 battlerId, u32 itemEffect) { BATTLE_HISTORY->itemEffects[battlerId] = itemEffect; AI_PARTY->mons[GetBattlerSide(battlerId)][gBattlerPartyIndexes[battlerId]].heldEffect = itemEffect; } -void ClearBattlerItemEffectHistory(u8 battlerId) +void ClearBattlerItemEffectHistory(u32 battlerId) { BATTLE_HISTORY->itemEffects[battlerId] = 0; } -void SaveBattlerData(u8 battlerId) +void SaveBattlerData(u32 battlerId) { if (!BattlerHasAi(battlerId)) { @@ -553,7 +541,7 @@ void SaveBattlerData(u8 battlerId) AI_THINKING_STRUCT->saved[battlerId].types[1] = gBattleMons[battlerId].type2; } -static bool32 ShouldFailForIllusion(u16 illusionSpecies, u32 battlerId) +static bool32 ShouldFailForIllusion(u32 illusionSpecies, u32 battlerId) { u32 i, j; @@ -563,7 +551,7 @@ static bool32 ShouldFailForIllusion(u16 illusionSpecies, u32 battlerId) // Don't fall for Illusion if the mon used a move it cannot know. for (i = 0; i < MAX_MON_MOVES; i++) { - u16 move = BATTLE_HISTORY->usedMoves[battlerId][i]; + u32 move = BATTLE_HISTORY->usedMoves[battlerId][i]; if (move == MOVE_NONE) continue; @@ -587,7 +575,7 @@ static bool32 ShouldFailForIllusion(u16 illusionSpecies, u32 battlerId) return TRUE; } -void SetBattlerData(u8 battlerId) +void SetBattlerData(u32 battlerId) { if (!BattlerHasAi(battlerId)) { @@ -631,7 +619,7 @@ void SetBattlerData(u8 battlerId) } } -void RestoreBattlerData(u8 battlerId) +void RestoreBattlerData(u32 battlerId) { if (!BattlerHasAi(battlerId)) { @@ -647,21 +635,21 @@ void RestoreBattlerData(u8 battlerId) gBattleMons[battlerId].type2 = AI_THINKING_STRUCT->saved[battlerId].types[1]; } -u32 GetHealthPercentage(u8 battlerId) +u32 GetHealthPercentage(u32 battlerId) { return (u32)((100 * gBattleMons[battlerId].hp) / gBattleMons[battlerId].maxHP); } -bool32 AtMaxHp(u8 battlerId) +bool32 AtMaxHp(u32 battlerId) { if (AI_DATA->hpPercents[battlerId] == 100) return TRUE; return FALSE; } -bool32 IsBattlerTrapped(u8 battler, bool8 checkSwitch) +bool32 IsBattlerTrapped(u32 battler, bool32 checkSwitch) { - u8 holdEffect = AI_DATA->holdEffects[battler]; + u32 holdEffect = AI_DATA->holdEffects[battler]; #if B_GHOSTS_ESCAPE >= GEN_6 if (IS_BATTLER_OF_TYPE(battler, TYPE_GHOST)) @@ -711,7 +699,7 @@ bool32 IsTruantMonVulnerable(u32 battlerAI, u32 opposingBattler) } // move checks -bool32 IsAffectedByPowder(u8 battler, u16 ability, u16 holdEffect) +bool32 IsAffectedByPowder(u32 battler, u32 ability, u32 holdEffect) { if (ability == ABILITY_OVERCOAT #if B_POWDER_GRASS >= GEN_6 @@ -734,13 +722,13 @@ bool32 MovesWithSplitUnusable(u32 attacker, u32 target, u32 split) for (i = 0; i < MAX_MON_MOVES; i++) { if (moves[i] != MOVE_NONE - && moves[i] != 0xFFFF + && moves[i] != MOVE_UNAVAILABLE && GetBattleMoveSplit(moves[i]) == split && !(unusable & gBitTable[i])) { SetTypeBeforeUsingMove(moves[i], attacker); GET_MOVE_TYPE(moves[i], moveType); - if (CalcTypeEffectivenessMultiplier(moves[i], moveType, attacker, target, FALSE) != 0) + if (CalcTypeEffectivenessMultiplier(moves[i], moveType, attacker, target, AI_DATA->abilities[target], FALSE) != 0) usable |= gBitTable[i]; } } @@ -748,46 +736,22 @@ bool32 MovesWithSplitUnusable(u32 attacker, u32 target, u32 split) return (usable == 0); } -static bool32 AI_GetIfCrit(u32 move, u8 battlerAtk, u8 battlerDef) +// To save computation time this function has 2 variants. One saves, sets and restores battlers, while the other doesn't. +s32 AI_CalcDamageSaveBattlers(u32 move, u32 battlerAtk, u32 battlerDef, u8 *typeEffectiveness, bool32 considerZPower) { - bool32 isCrit; - - switch (CalcCritChanceStage(battlerAtk, battlerDef, move, FALSE)) - { - case -1: - case 0: - default: - isCrit = FALSE; - break; - case 1: - if (gBattleMoves[move].flags & FLAG_HIGH_CRIT && (Random() % 5 == 0)) - isCrit = TRUE; - else - isCrit = FALSE; - break; - case 2: - if (gBattleMoves[move].flags & FLAG_HIGH_CRIT && (Random() % 2 == 0)) - isCrit = TRUE; - else if (!(gBattleMoves[move].flags & FLAG_HIGH_CRIT) && (Random() % 4) == 0) - isCrit = TRUE; - else - isCrit = FALSE; - break; - case -2: - case 3: - case 4: - isCrit = TRUE; - break; - } - - return isCrit; + SaveBattlerData(battlerAtk); + SaveBattlerData(battlerDef); + AI_CalcDamage(move, battlerAtk, battlerDef, typeEffectiveness, considerZPower, AI_GetWeather(AI_DATA)); } -s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 *typeEffectiveness, bool32 considerZPower) +s32 AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u8 *typeEffectiveness, bool32 considerZPower, u32 weather) { - s32 dmg, moveType, critDmg, normalDmg, fixedBasePower, n; - s8 critChance; - u16 effectivenessMultiplier; + s32 dmg, moveType; + uq4_12_t effectivenessMultiplier; + struct AiLogicData *aiData = AI_DATA; + + SetBattlerData(battlerAtk); + SetBattlerData(battlerDef); if (considerZPower && IsViableZMove(battlerAtk, move)) { @@ -796,12 +760,6 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 *typeEffectiveness, gBattleStruct->zmove.active = TRUE; } - SaveBattlerData(battlerAtk); - SaveBattlerData(battlerDef); - - SetBattlerData(battlerAtk); - SetBattlerData(battlerDef); - gBattleStruct->dynamicMoveType = 0; if (move == MOVE_NATURE_POWER) @@ -810,10 +768,12 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 *typeEffectiveness, SetTypeBeforeUsingMove(move, battlerAtk); GET_MOVE_TYPE(move, moveType); + effectivenessMultiplier = CalcTypeEffectivenessMultiplier(move, moveType, battlerAtk, battlerDef, aiData->abilities[battlerDef], FALSE); if (gBattleMoves[move].power) { - ProteanTryChangeType(battlerAtk, AI_DATA->abilities[battlerAtk], move, moveType); - critChance = GetInverseCritChance(battlerAtk, battlerDef, move); + s32 critChanceIndex, normalDmg, fixedBasePower, n; + + ProteanTryChangeType(battlerAtk, aiData->abilities[battlerAtk], move, moveType); // Certain moves like Rollout calculate damage based on values which change during the move execution, but before calling dmg calc. switch (gBattleMoves[move].effect) { @@ -828,13 +788,26 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 *typeEffectiveness, fixedBasePower = 0; break; } - normalDmg = CalculateMoveDamageAndEffectiveness(move, battlerAtk, battlerDef, moveType, fixedBasePower, &effectivenessMultiplier); - critDmg = CalculateMoveDamage(move, battlerAtk, battlerDef, moveType, fixedBasePower, TRUE, FALSE, FALSE); + normalDmg = CalculateMoveDamageVars(move, battlerAtk, battlerDef, moveType, fixedBasePower, + effectivenessMultiplier, weather, FALSE, + aiData->holdEffects[battlerAtk], aiData->holdEffects[battlerDef], + aiData->abilities[battlerAtk], aiData->abilities[battlerDef]); - if (critChance == -1) - dmg = normalDmg; + critChanceIndex = CalcCritChanceStageArgs(battlerAtk, battlerDef, move, FALSE, aiData->abilities[battlerAtk], aiData->abilities[battlerDef], aiData->holdEffects[battlerAtk]); + if (critChanceIndex > 1) // Consider crit damage only if a move has at least +1 crit chance + { + s32 critDmg = CalculateMoveDamageVars(move, battlerAtk, battlerDef, moveType, fixedBasePower, + effectivenessMultiplier, weather, TRUE, + aiData->holdEffects[battlerAtk], aiData->holdEffects[battlerDef], + aiData->abilities[battlerAtk], aiData->abilities[battlerDef]); + u32 critChance = GetCritHitChance(critChanceIndex); + // With critChance getting closer to 1, dmg gets closer to critDmg. + dmg = (critDmg + normalDmg * (critChance - 1)) / (critChance); + } else - dmg = (critDmg + normalDmg * (critChance - 1)) / critChance; + { + dmg = normalDmg; + } if (!gBattleStruct->zmove.active) { @@ -843,35 +816,49 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 *typeEffectiveness, { case EFFECT_LEVEL_DAMAGE: case EFFECT_PSYWAVE: - dmg = gBattleMons[battlerAtk].level * (AI_DATA->abilities[battlerAtk] == ABILITY_PARENTAL_BOND ? 2 : 1); + dmg = gBattleMons[battlerAtk].level * (aiData->abilities[battlerAtk] == ABILITY_PARENTAL_BOND ? 2 : 1); break; case EFFECT_DRAGON_RAGE: - dmg = 40 * (AI_DATA->abilities[battlerAtk] == ABILITY_PARENTAL_BOND ? 2 : 1); + dmg = 40 * (aiData->abilities[battlerAtk] == ABILITY_PARENTAL_BOND ? 2 : 1); break; case EFFECT_SONICBOOM: - dmg = 20 * (AI_DATA->abilities[battlerAtk] == ABILITY_PARENTAL_BOND ? 2 : 1); + dmg = 20 * (aiData->abilities[battlerAtk] == ABILITY_PARENTAL_BOND ? 2 : 1); break; case EFFECT_MULTI_HIT: - dmg *= (AI_DATA->abilities[battlerAtk] == ABILITY_SKILL_LINK ? 5 : 3); + dmg *= (aiData->abilities[battlerAtk] == ABILITY_SKILL_LINK ? 5 : 3); break; case EFFECT_ENDEAVOR: // If target has less HP than user, Endeavor does no damage dmg = max(0, gBattleMons[battlerDef].hp - gBattleMons[battlerAtk].hp); break; case EFFECT_SUPER_FANG: - dmg = (AI_DATA->abilities[battlerAtk] == ABILITY_PARENTAL_BOND + dmg = (aiData->abilities[battlerAtk] == ABILITY_PARENTAL_BOND ? max(2, gBattleMons[battlerDef].hp * 3 / 4) : max(1, gBattleMons[battlerDef].hp / 2)); break; case EFFECT_FINAL_GAMBIT: dmg = gBattleMons[battlerAtk].hp; break; + #if B_BEAT_UP >= GEN_5 + case EFFECT_BEAT_UP: + { + u32 partyCount = CalculatePartyCount(GetBattlerParty(battlerAtk)); + u32 i; + gBattleStruct->beatUpSlot = 0; + dmg = 0; + for (i = 0; i < partyCount; i++) { + dmg += CalculateMoveDamage(move, battlerAtk, battlerDef, moveType, 0, FALSE, FALSE, FALSE); + } + gBattleStruct->beatUpSlot = 0; + } + break; + #endif } // Handle other multi-strike moves - if (gBattleMoves[move].flags & FLAG_TWO_STRIKES) - dmg *= 2; - else if (gBattleMoves[move].flags & FLAG_THREE_STRIKES || (move == MOVE_WATER_SHURIKEN && gBattleMons[battlerAtk].species == SPECIES_GRENINJA_ASH)) + if (gBattleMoves[move].strikeCount > 1 && gBattleMoves[move].effect != EFFECT_TRIPLE_KICK) + dmg *= gBattleMoves[move].strikeCount; + else if (move == MOVE_WATER_SHURIKEN && gBattleMons[battlerAtk].species == SPECIES_GRENINJA_ASH) dmg *= 3; if (dmg == 0) @@ -880,7 +867,6 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 *typeEffectiveness, } else { - effectivenessMultiplier = CalcTypeEffectivenessMultiplier(move, moveType, battlerAtk, battlerDef, FALSE); dmg = 0; } @@ -913,30 +899,10 @@ static u32 WhichMoveBetter(u32 move1, u32 move2) // Check recoil if (GetBattlerAbility(sBattler_AI) != ABILITY_ROCK_HEAD) { - if (((gBattleMoves[move1].effect == EFFECT_RECOIL_25 - || gBattleMoves[move1].effect == EFFECT_RECOIL_IF_MISS - || gBattleMoves[move1].effect == EFFECT_RECOIL_50 - || gBattleMoves[move1].effect == EFFECT_RECOIL_33 - || gBattleMoves[move1].effect == EFFECT_RECOIL_33_STATUS) - && (gBattleMoves[move2].effect != EFFECT_RECOIL_25 - && gBattleMoves[move2].effect != EFFECT_RECOIL_IF_MISS - && gBattleMoves[move2].effect != EFFECT_RECOIL_50 - && gBattleMoves[move2].effect != EFFECT_RECOIL_33 - && gBattleMoves[move2].effect != EFFECT_RECOIL_33_STATUS - && gBattleMoves[move2].effect != EFFECT_RECHARGE))) + if (IS_MOVE_RECOIL(move1) && !IS_MOVE_RECOIL(move2) && gBattleMoves[move2].effect != EFFECT_RECHARGE) return 1; - if (((gBattleMoves[move2].effect == EFFECT_RECOIL_25 - || gBattleMoves[move2].effect == EFFECT_RECOIL_IF_MISS - || gBattleMoves[move2].effect == EFFECT_RECOIL_50 - || gBattleMoves[move2].effect == EFFECT_RECOIL_33 - || gBattleMoves[move2].effect == EFFECT_RECOIL_33_STATUS) - && (gBattleMoves[move1].effect != EFFECT_RECOIL_25 - && gBattleMoves[move1].effect != EFFECT_RECOIL_IF_MISS - && gBattleMoves[move1].effect != EFFECT_RECOIL_50 - && gBattleMoves[move1].effect != EFFECT_RECOIL_33 - && gBattleMoves[move1].effect != EFFECT_RECOIL_33_STATUS - && gBattleMoves[move1].effect != EFFECT_RECHARGE))) + if (IS_MOVE_RECOIL(move2) && !IS_MOVE_RECOIL(move1) && gBattleMoves[move1].effect != EFFECT_RECHARGE) return 0; } // Check recharge @@ -958,97 +924,104 @@ u32 GetNoOfHitsToKO(u32 dmg, s32 hp) return hp / (dmg + 1) + 1; } -u8 GetMoveDamageResult(u16 move) +void SetMoveDamageResult(u32 battlerAtk, u16 *moves) { - s32 i, checkedMove, bestId, currId, hp; + s32 i, j, battlerDef, bestId, currId, hp, result; s32 moveDmgs[MAX_MON_MOVES]; - u8 result; + bool32 isNotConsidered[MAX_MON_MOVES]; - for (i = 0; sIgnoredPowerfulMoveEffects[i] != IGNORED_MOVES_END; i++) + for (i = 0; i < MAX_MON_MOVES; i++) { - if (gBattleMoves[move].effect == sIgnoredPowerfulMoveEffects[i]) - break; - } + u32 move = moves[i]; + for (j = 0; sIgnoredPowerfulMoveEffects[j] != IGNORED_MOVES_END; j++) + { + if (gBattleMoves[move].effect == sIgnoredPowerfulMoveEffects[j]) + break; + } + if (move == 0 || move == 0xFFFF || gBattleMoves[move].power == 0 || sIgnoredPowerfulMoveEffects[j] != IGNORED_MOVES_END) + isNotConsidered[i] = TRUE; + else + isNotConsidered[i] = FALSE; - if (gBattleMoves[move].power != 0 && sIgnoredPowerfulMoveEffects[i] == IGNORED_MOVES_END) - { - // Considered move has power and is not in sIgnoredPowerfulMoveEffects - // Check all other moves and calculate their power - for (checkedMove = 0; checkedMove < MAX_MON_MOVES; checkedMove++) + for (battlerDef = 0; battlerDef < MAX_BATTLERS_COUNT; battlerDef++) { - for (i = 0; sIgnoredPowerfulMoveEffects[i] != IGNORED_MOVES_END; i++) - { - if (gBattleMoves[gBattleMons[sBattler_AI].moves[checkedMove]].effect == sIgnoredPowerfulMoveEffects[i]) - break; - } + if (battlerDef == battlerAtk) + continue; - if (gBattleMons[sBattler_AI].moves[checkedMove] != MOVE_NONE - && sIgnoredPowerfulMoveEffects[i] == IGNORED_MOVES_END - && gBattleMoves[gBattleMons[sBattler_AI].moves[checkedMove]].power != 0) + if (isNotConsidered[i]) { - moveDmgs[checkedMove] = AI_DATA->simulatedDmg[sBattler_AI][gBattlerTarget][checkedMove]; + AI_DATA->moveDmgResult[battlerAtk][battlerDef][i] = MOVE_POWER_OTHER; // Move has a power of 0/1, or is in the group sIgnoredPowerfulMoveEffects } else { - moveDmgs[checkedMove] = 0; - } - } + // Considered move has power and is not in sIgnoredPowerfulMoveEffects + // Check all other moves and calculate their power + for (j = 0; j < MAX_MON_MOVES; j++) + { + if (!isNotConsidered[j]) + moveDmgs[j] = AI_DATA->simulatedDmg[battlerAtk][battlerDef][j]; + else + moveDmgs[j] = 0; + } - hp = gBattleMons[gBattlerTarget].hp + (20 * gBattleMons[gBattlerTarget].hp / 100); // 20 % add to make sure the battler is always fainted - // If a move can faint battler, it doesn't matter how much damage it does - for (i = 0; i < MAX_MON_MOVES; i++) - { - if (moveDmgs[i] > hp) - moveDmgs[i] = hp; - } + hp = gBattleMons[battlerDef].hp + (20 * gBattleMons[battlerDef].hp / 100); // 20 % add to make sure the battler is always fainted + // If a move can faint battler, it doesn't matter how much damage it does + for (j = 0; j < MAX_MON_MOVES; j++) + { + if (moveDmgs[j] > hp) + moveDmgs[j] = hp; + } - for (bestId = 0, i = 1; i < MAX_MON_MOVES; i++) - { - if (moveDmgs[i] > moveDmgs[bestId]) - bestId = i; - if (moveDmgs[i] == moveDmgs[bestId]) - { - switch (WhichMoveBetter(gBattleMons[sBattler_AI].moves[bestId], gBattleMons[sBattler_AI].moves[i])) + for (bestId = 0, j = 1; j < MAX_MON_MOVES; j++) { - case 2: - if (Random() & 1) - break; - case 1: - bestId = i; - break; + if (moveDmgs[j] > moveDmgs[bestId]) + bestId = j; + if (moveDmgs[j] == moveDmgs[bestId]) + { + switch (WhichMoveBetter(gBattleMons[battlerAtk].moves[bestId], gBattleMons[battlerAtk].moves[j])) + { + case 2: + if (Random() & 1) + break; + case 1: + bestId = j; + break; + } + } } + + currId = i; + if (currId == bestId) + result = MOVE_POWER_BEST; + else if ((moveDmgs[currId] >= hp || moveDmgs[bestId] < hp) // If current move can faint as well, or if neither can + && GetNoOfHitsToKO(moveDmgs[currId], hp) - GetNoOfHitsToKO(moveDmgs[bestId], hp) <= 2 // Consider a move weak if it needs to be used at least 2 times more to faint the target, compared to the best move. + && WhichMoveBetter(gBattleMons[battlerAtk].moves[bestId], gBattleMons[battlerAtk].moves[currId]) != 0) + result = MOVE_POWER_GOOD; + else + result = MOVE_POWER_WEAK; + + AI_DATA->moveDmgResult[battlerAtk][battlerDef][i] = result; } } - - currId = AI_THINKING_STRUCT->movesetIndex; - if (currId == bestId) - AI_THINKING_STRUCT->funcResult = MOVE_POWER_BEST; - else if ((moveDmgs[currId] >= hp || moveDmgs[bestId] < hp) // If current move can faint as well, or if neither can - && GetNoOfHitsToKO(moveDmgs[currId], hp) - GetNoOfHitsToKO(moveDmgs[bestId], hp) <= 2 // Consider a move weak if it needs to be used at least 2 times more to faint the target, compared to the best move. - && WhichMoveBetter(gBattleMons[sBattler_AI].moves[bestId], gBattleMons[sBattler_AI].moves[currId]) != 0) - AI_THINKING_STRUCT->funcResult = MOVE_POWER_GOOD; - else - AI_THINKING_STRUCT->funcResult = MOVE_POWER_WEAK; - } - else - { - // Move has a power of 0/1, or is in the group sIgnoredPowerfulMoveEffects - AI_THINKING_STRUCT->funcResult = MOVE_POWER_OTHER; } +} - return AI_THINKING_STRUCT->funcResult; +u32 GetMoveDamageResult(u32 battlerAtk, u32 battlerDef, u32 moveIndex) +{ + return AI_DATA->moveDmgResult[battlerAtk][battlerDef][moveIndex]; } -u32 GetCurrDamageHpPercent(u8 battlerAtk, u8 battlerDef) +u32 GetCurrDamageHpPercent(u32 battlerAtk, u32 battlerDef) { int bestDmg = AI_DATA->simulatedDmg[battlerAtk][battlerDef][AI_THINKING_STRUCT->movesetIndex]; return (bestDmg * 100) / gBattleMons[battlerDef].maxHP; } -u16 AI_GetTypeEffectiveness(u16 move, u8 battlerAtk, u8 battlerDef) +uq4_12_t AI_GetTypeEffectiveness(u32 move, u32 battlerAtk, u32 battlerDef) { - u16 typeEffectiveness, moveType; + uq4_12_t typeEffectiveness; + u32 moveType; SaveBattlerData(battlerAtk); SaveBattlerData(battlerDef); @@ -1059,7 +1032,7 @@ u16 AI_GetTypeEffectiveness(u16 move, u8 battlerAtk, u8 battlerDef) gBattleStruct->dynamicMoveType = 0; SetTypeBeforeUsingMove(move, battlerAtk); GET_MOVE_TYPE(move, moveType); - typeEffectiveness = CalcTypeEffectivenessMultiplier(move, moveType, battlerAtk, battlerDef, FALSE); + typeEffectiveness = CalcTypeEffectivenessMultiplier(move, moveType, battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], FALSE); RestoreBattlerData(battlerAtk); RestoreBattlerData(battlerDef); @@ -1067,13 +1040,13 @@ u16 AI_GetTypeEffectiveness(u16 move, u8 battlerAtk, u8 battlerDef) return typeEffectiveness; } -u32 AI_GetMoveEffectiveness(u16 move, u8 battlerAtk, u8 battlerDef) +u32 AI_GetMoveEffectiveness(u32 move, u32 battlerAtk, u32 battlerDef) { gMoveResultFlags = 0; return AI_GetEffectiveness(AI_GetTypeEffectiveness(move, battlerAtk, battlerDef)); } -static u32 AI_GetEffectiveness(u16 multiplier) +static u32 AI_GetEffectiveness(uq4_12_t multiplier) { switch (multiplier) { @@ -1102,7 +1075,7 @@ static u32 AI_GetEffectiveness(u16 multiplier) * AI_IS_FASTER: is user(ai) faster * AI_IS_SLOWER: is target faster */ -u8 AI_WhoStrikesFirst(u8 battlerAI, u8 battler2, u16 moveConsidered) +u32 AI_WhoStrikesFirst(u32 battlerAI, u32 battler2, u32 moveConsidered) { u32 fasterAI = 0, fasterPlayer = 0, i; s8 prioAI = 0; @@ -1114,10 +1087,11 @@ u8 AI_WhoStrikesFirst(u8 battlerAI, u8 battler2, u16 moveConsidered) prioAI = GetMovePriority(battlerAI, moveConsidered); for (i = 0; i < MAX_MON_MOVES; i++) { - if (battler2Moves[i] == 0 || battler2Moves[i] == 0xFFFF) + prioBattler2 = GetMovePriority(battler2, battler2Moves[i]); + if (battler2Moves[i] == MOVE_NONE || battler2Moves[i] == MOVE_UNAVAILABLE + || (prioBattler2 > prioAI && !CanIndexMoveFaintTarget(battler2, battlerAI, i , 2))) continue; - prioBattler2 = GetMovePriority(battler2, battler2Moves[i]); if (prioAI > prioBattler2) fasterAI++; else if (prioBattler2 > prioAI) @@ -1137,7 +1111,11 @@ u8 AI_WhoStrikesFirst(u8 battlerAI, u8 battler2, u16 moveConsidered) if (prioAI > prioBattler2) return AI_IS_FASTER; // if we didn't know any of battler 2's moves to compare priorities, assume they don't have a prio+ move // Priorities are the same(at least comparing to moves the AI is aware of), decide by speed. - if (GetWhoStrikesFirst(battlerAI, battler2, TRUE) == 0) + if (GetWhichBattlerFasterArgs(battlerAI, battler2, TRUE, + AI_DATA->abilities[battlerAI], AI_DATA->abilities[battler2], + AI_DATA->holdEffects[battlerAI], AI_DATA->holdEffects[battler2], + AI_DATA->speedStats[battlerAI], AI_DATA->speedStats[battler2], + prioAI, prioBattler2) == 0) return AI_IS_FASTER; else return AI_IS_SLOWER; @@ -1145,7 +1123,7 @@ u8 AI_WhoStrikesFirst(u8 battlerAI, u8 battler2, u16 moveConsidered) } // Check if target has means to faint ai mon. -bool32 CanTargetFaintAi(u8 battlerDef, u8 battlerAtk) +bool32 CanTargetFaintAi(u32 battlerDef, u32 battlerAtk) { s32 i, dmg; u32 unusable = AI_DATA->moveLimitations[battlerDef]; @@ -1153,7 +1131,7 @@ bool32 CanTargetFaintAi(u8 battlerDef, u8 battlerAtk) for (i = 0; i < MAX_MON_MOVES; i++) { - if (moves[i] != MOVE_NONE && moves[i] != 0xFFFF && !(unusable & gBitTable[i]) + if (moves[i] != MOVE_NONE && moves[i] != MOVE_UNAVAILABLE && !(unusable & gBitTable[i]) && AI_DATA->simulatedDmg[battlerDef][battlerAtk][i] >= gBattleMons[battlerAtk].hp) { return TRUE; @@ -1165,7 +1143,7 @@ bool32 CanTargetFaintAi(u8 battlerDef, u8 battlerAtk) // Check if AI mon has the means to faint the target with any of its moves. // If numHits > 1, check if the target will be KO'ed by that number of hits (ignoring healing effects) -bool32 CanAIFaintTarget(u8 battlerAtk, u8 battlerDef, u8 numHits) +bool32 CanAIFaintTarget(u32 battlerAtk, u32 battlerDef, u32 numHits) { s32 i, dmg; u32 moveLimitations = AI_DATA->moveLimitations[battlerAtk]; @@ -1173,7 +1151,7 @@ bool32 CanAIFaintTarget(u8 battlerAtk, u8 battlerDef, u8 numHits) for (i = 0; i < MAX_MON_MOVES; i++) { - if (moves[i] != MOVE_NONE && moves[i] != 0xFFFF && !(moveLimitations & gBitTable[i])) + if (moves[i] != MOVE_NONE && moves[i] != MOVE_UNAVAILABLE && !(moveLimitations & gBitTable[i])) { // Use the pre-calculated value in simulatedDmg instead of re-calculating it dmg = AI_DATA->simulatedDmg[battlerAtk][battlerDef][i]; @@ -1189,23 +1167,19 @@ bool32 CanAIFaintTarget(u8 battlerAtk, u8 battlerDef, u8 numHits) return FALSE; } -bool32 CanMoveFaintBattler(u16 move, u8 battlerDef, u8 battlerAtk, u8 nHits) +bool32 CanTargetMoveFaintAi(u32 move, u32 battlerDef, u32 battlerAtk, u32 nHits) { - s32 i, dmg; - u8 effectiveness; - u32 unusable = AI_DATA->moveLimitations[battlerDef]; - - if (move != MOVE_NONE - && move != 0xFFFF - && !(unusable & gBitTable[i]) - && AI_CalcDamage(move, battlerDef, battlerAtk, &effectiveness, FALSE) >= gBattleMons[battlerAtk].hp) - return TRUE; - + u32 indexSlot = GetMoveSlot(GetMovesArray(battlerDef), move); + if (indexSlot < MAX_MON_MOVES) + { + if (GetNoOfHitsToKO(AI_DATA->simulatedDmg[battlerDef][battlerAtk][indexSlot], gBattleMons[battlerAtk].hp) <= nHits) + return TRUE; + } return FALSE; } // Check if target has means to faint ai mon after modding hp/dmg -bool32 CanTargetFaintAiWithMod(u8 battlerDef, u8 battlerAtk, s32 hpMod, s32 dmgMod) +bool32 CanTargetFaintAiWithMod(u32 battlerDef, u32 battlerAtk, s32 hpMod, s32 dmgMod) { u32 i; u32 unusable = AI_DATA->moveLimitations[battlerDef]; @@ -1222,7 +1196,7 @@ bool32 CanTargetFaintAiWithMod(u8 battlerDef, u8 battlerAtk, s32 hpMod, s32 dmgM if (dmgMod) dmg *= dmgMod; - if (moves[i] != MOVE_NONE && moves[i] != 0xFFFF && !(unusable & gBitTable[i]) && dmg >= hpCheck) + if (moves[i] != MOVE_NONE && moves[i] != MOVE_UNAVAILABLE && !(unusable & gBitTable[i]) && dmg >= hpCheck) { return TRUE; } @@ -1268,7 +1242,7 @@ s32 AI_GetAbility(u32 battlerId) // Else, guess the ability if (gSpeciesInfo[gBattleMons[battlerId].species].abilities[0] != ABILITY_NONE) { - u16 abilityGuess = ABILITY_NONE; + u32 abilityGuess = ABILITY_NONE; while (abilityGuess == ABILITY_NONE) { abilityGuess = gSpeciesInfo[gBattleMons[battlerId].species].abilities[Random() % NUM_ABILITY_SLOTS]; @@ -1280,7 +1254,7 @@ s32 AI_GetAbility(u32 battlerId) return ABILITY_NONE; // Unknown. } -u16 AI_GetHoldEffect(u32 battlerId) +u32 AI_GetHoldEffect(u32 battlerId) { u32 holdEffect; @@ -1302,7 +1276,7 @@ u16 AI_GetHoldEffect(u32 battlerId) return holdEffect; } -bool32 AI_IsTerrainAffected(u8 battlerId, u32 flags) +bool32 AI_IsTerrainAffected(u32 battlerId, u32 flags) { if (gStatuses3[battlerId] & STATUS3_SEMI_INVULNERABLE) return FALSE; @@ -1312,7 +1286,7 @@ bool32 AI_IsTerrainAffected(u8 battlerId, u32 flags) } // different from IsBattlerGrounded in that we don't always know battler's hold effect or ability -bool32 AI_IsBattlerGrounded(u8 battlerId) +bool32 AI_IsBattlerGrounded(u32 battlerId) { u32 holdEffect = AI_DATA->holdEffects[battlerId]; @@ -1338,7 +1312,7 @@ bool32 AI_IsBattlerGrounded(u8 battlerId) return TRUE; } -bool32 DoesBattlerIgnoreAbilityChecks(u16 atkAbility, u16 move) +bool32 DoesBattlerIgnoreAbilityChecks(u32 atkAbility, u32 move) { u32 i; @@ -1359,16 +1333,24 @@ bool32 DoesBattlerIgnoreAbilityChecks(u16 atkAbility, u16 move) return FALSE; } -bool32 AI_WeatherHasEffect(void) +static inline bool32 AI_WeatherHasEffect(struct AiLogicData *aiData) { - u32 i; if (AI_THINKING_STRUCT->aiFlags & AI_FLAG_NEGATE_UNAWARE) return TRUE; // AI doesn't understand weather supression (handicap) - return WEATHER_HAS_EFFECT; // weather damping abilities are announced + return aiData->weatherHasEffect; // weather damping abilities are announced } -u32 AI_GetBattlerMoveTargetType(u8 battlerId, u16 move) +u32 AI_GetWeather(struct AiLogicData *aiData) +{ + if (gBattleWeather == B_WEATHER_NONE) + return B_WEATHER_NONE; + if (!AI_WeatherHasEffect(aiData)) + return B_WEATHER_NONE; + return gBattleWeather; +} + +u32 AI_GetBattlerMoveTargetType(u32 battlerId, u32 move) { u32 target; @@ -1378,7 +1360,7 @@ u32 AI_GetBattlerMoveTargetType(u8 battlerId, u16 move) return gBattleMoves[move].target; } -bool32 IsAromaVeilProtectedMove(u16 move) +bool32 IsAromaVeilProtectedMove(u32 move) { u32 i; @@ -1396,7 +1378,7 @@ bool32 IsAromaVeilProtectedMove(u16 move) } } -bool32 IsNonVolatileStatusMoveEffect(u16 moveEffect) +bool32 IsNonVolatileStatusMoveEffect(u32 moveEffect) { switch (moveEffect) { @@ -1412,7 +1394,7 @@ bool32 IsNonVolatileStatusMoveEffect(u16 moveEffect) } } -bool32 IsConfusionMoveEffect(u16 moveEffect) +bool32 IsConfusionMoveEffect(u32 moveEffect) { switch (moveEffect) { @@ -1426,7 +1408,7 @@ bool32 IsConfusionMoveEffect(u16 moveEffect) } } -bool32 IsStatLoweringMoveEffect(u16 moveEffect) +bool32 IsStatLoweringMoveEffect(u32 moveEffect) { switch (moveEffect) { @@ -1450,7 +1432,7 @@ bool32 IsStatLoweringMoveEffect(u16 moveEffect) } } -bool32 IsHazardMoveEffect(u16 moveEffect) +bool32 IsHazardMoveEffect(u32 moveEffect) { switch (moveEffect) { @@ -1464,7 +1446,7 @@ bool32 IsHazardMoveEffect(u16 moveEffect) } } -bool32 IsMoveRedirectionPrevented(u16 move, u16 atkAbility) +bool32 IsMoveRedirectionPrevented(u32 move, u32 atkAbility) { if (AI_THINKING_STRUCT->aiFlags & AI_FLAG_NEGATE_UNAWARE) return FALSE; @@ -1477,28 +1459,29 @@ bool32 IsMoveRedirectionPrevented(u16 move, u16 atkAbility) return FALSE; } -u32 AI_GetMoveAccuracy(u8 battlerAtk, u8 battlerDef, u16 move) +u32 AI_GetMoveAccuracy(u32 battlerAtk, u32 battlerDef, u32 move) { return GetTotalAccuracy(battlerAtk, battlerDef, move, AI_DATA->abilities[battlerAtk], AI_DATA->abilities[battlerDef], AI_DATA->holdEffects[battlerAtk], AI_DATA->holdEffects[battlerDef]); } -bool32 IsSemiInvulnerable(u8 battlerDef, u16 move) +bool32 IsSemiInvulnerable(u32 battlerDef, u32 move) { if (gStatuses3[battlerDef] & STATUS3_PHANTOM_FORCE) return TRUE; - else if (!TestMoveFlags(move, FLAG_DMG_IN_AIR) && gStatuses3[battlerDef] & STATUS3_ON_AIR) + else if (!gBattleMoves[move].damagesAirborne && gStatuses3[battlerDef] & STATUS3_ON_AIR) return TRUE; - else if (!TestMoveFlags(move, FLAG_DMG_UNDERWATER) && gStatuses3[battlerDef] & STATUS3_UNDERWATER) + else if (!gBattleMoves[move].damagesUnderwater && gStatuses3[battlerDef] & STATUS3_UNDERWATER) return TRUE; - else if (!TestMoveFlags(move, FLAG_DMG_UNDERGROUND) && gStatuses3[battlerDef] & STATUS3_UNDERGROUND) + else if (!gBattleMoves[move].damagesUnderground && gStatuses3[battlerDef] & STATUS3_UNDERGROUND) return TRUE; else return FALSE; } -bool32 IsMoveEncouragedToHit(u8 battlerAtk, u8 battlerDef, u16 move) +bool32 IsMoveEncouragedToHit(u32 battlerAtk, u32 battlerDef, u32 move) { + u32 weather; if (IsSemiInvulnerable(battlerDef, move)) return FALSE; @@ -1517,17 +1500,17 @@ bool32 IsMoveEncouragedToHit(u8 battlerAtk, u8 battlerDef, u16 move) #endif // discouraged from hitting - if (AI_WeatherHasEffect() && (gBattleWeather & B_WEATHER_SUN) + weather = AI_GetWeather(AI_DATA); + if ((weather & B_WEATHER_SUN) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE)) return FALSE; // increased accuracy but don't always hit - if ((AI_WeatherHasEffect() && - (((gBattleWeather & B_WEATHER_RAIN) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE)) - || (((gBattleWeather & (B_WEATHER_HAIL | B_WEATHER_SNOW)) && move == MOVE_BLIZZARD)))) + if ((((weather & B_WEATHER_RAIN) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE)) + || (((weather & (B_WEATHER_HAIL | B_WEATHER_SNOW)) && move == MOVE_BLIZZARD))) || (gBattleMoves[move].effect == EFFECT_VITAL_THROW) #if B_MINIMIZE_DMG_ACC >= GEN_6 - || ((gStatuses3[battlerDef] & STATUS3_MINIMIZED) && (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE)) + || ((gStatuses3[battlerDef] & STATUS3_MINIMIZED) && gBattleMoves[move].minimizeDoubleDamage) #endif || (gBattleMoves[move].accuracy == 0)) { @@ -1537,7 +1520,7 @@ bool32 IsMoveEncouragedToHit(u8 battlerAtk, u8 battlerDef, u16 move) return FALSE; } -bool32 ShouldTryOHKO(u8 battlerAtk, u8 battlerDef, u16 atkAbility, u16 defAbility, u16 move) +bool32 ShouldTryOHKO(u32 battlerAtk, u32 battlerDef, u32 atkAbility, u32 defAbility, u32 move) { u32 holdEffect = AI_DATA->holdEffects[battlerDef]; u32 accuracy = AI_GetMoveAccuracy(battlerAtk, battlerDef, move); @@ -1560,9 +1543,9 @@ bool32 ShouldTryOHKO(u8 battlerAtk, u8 battlerDef, u16 atkAbility, u16 defAbilit } else // test the odds { - u16 odds = accuracy + (gBattleMons[battlerAtk].level - gBattleMons[battlerDef].level); + u32 odds = accuracy + (gBattleMons[battlerAtk].level - gBattleMons[battlerDef].level); #if B_SHEER_COLD_ACC >= GEN_7 - if (gCurrentMove == MOVE_SHEER_COLD && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE)) + if (move == MOVE_SHEER_COLD && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE)) odds -= 10; #endif if (Random() % 100 + 1 < odds && gBattleMons[battlerAtk].level >= gBattleMons[battlerDef].level) @@ -1571,11 +1554,10 @@ bool32 ShouldTryOHKO(u8 battlerAtk, u8 battlerDef, u16 atkAbility, u16 defAbilit return FALSE; } -bool32 ShouldSetSandstorm(u8 battler, u16 ability, u16 holdEffect) +bool32 ShouldSetSandstorm(u32 battler, u32 ability, u32 holdEffect) { - if (!AI_WeatherHasEffect()) - return FALSE; - else if (gBattleWeather & B_WEATHER_SANDSTORM) + u32 weather = AI_GetWeather(AI_DATA); + if (weather & B_WEATHER_SANDSTORM) return FALSE; if (ability == ABILITY_SAND_VEIL @@ -1595,11 +1577,10 @@ bool32 ShouldSetSandstorm(u8 battler, u16 ability, u16 holdEffect) return FALSE; } -bool32 ShouldSetHail(u8 battler, u16 ability, u16 holdEffect) +bool32 ShouldSetHail(u32 battler, u32 ability, u32 holdEffect) { - if (!AI_WeatherHasEffect()) - return FALSE; - else if (gBattleWeather & (B_WEATHER_HAIL | B_WEATHER_SNOW)) + u32 weather = AI_GetWeather(AI_DATA); + if (weather & (B_WEATHER_HAIL | B_WEATHER_SNOW)) return FALSE; if (ability == ABILITY_SNOW_CLOAK @@ -1619,11 +1600,10 @@ bool32 ShouldSetHail(u8 battler, u16 ability, u16 holdEffect) return FALSE; } -bool32 ShouldSetRain(u8 battlerAtk, u16 atkAbility, u16 holdEffect) +bool32 ShouldSetRain(u32 battlerAtk, u32 atkAbility, u32 holdEffect) { - if (!AI_WeatherHasEffect()) - return FALSE; - else if (gBattleWeather & B_WEATHER_RAIN) + u32 weather = AI_GetWeather(AI_DATA); + if (weather & B_WEATHER_RAIN) return FALSE; if (holdEffect != HOLD_EFFECT_UTILITY_UMBRELLA @@ -1642,11 +1622,10 @@ bool32 ShouldSetRain(u8 battlerAtk, u16 atkAbility, u16 holdEffect) return FALSE; } -bool32 ShouldSetSun(u8 battlerAtk, u16 atkAbility, u16 holdEffect) +bool32 ShouldSetSun(u32 battlerAtk, u32 atkAbility, u32 holdEffect) { - if (!AI_WeatherHasEffect()) - return FALSE; - else if (gBattleWeather & B_WEATHER_SUN) + u32 weather = AI_GetWeather(AI_DATA); + if (weather & B_WEATHER_SUN) return FALSE; if (holdEffect != HOLD_EFFECT_UTILITY_UMBRELLA @@ -1669,11 +1648,10 @@ bool32 ShouldSetSun(u8 battlerAtk, u16 atkAbility, u16 holdEffect) return FALSE; } -bool32 ShouldSetSnow(u8 battler, u16 ability, u16 holdEffect) +bool32 ShouldSetSnow(u32 battler, u32 ability, u32 holdEffect) { - if (!AI_WeatherHasEffect()) - return FALSE; - else if (gBattleWeather & (B_WEATHER_SNOW | B_WEATHER_HAIL)) + u32 weather = AI_GetWeather(AI_DATA); + if (weather & (B_WEATHER_SNOW | B_WEATHER_HAIL)) return FALSE; if (ability == ABILITY_SNOW_CLOAK @@ -1690,11 +1668,11 @@ bool32 ShouldSetSnow(u8 battler, u16 ability, u16 holdEffect) return FALSE; } -void ProtectChecks(u8 battlerAtk, u8 battlerDef, u16 move, u16 predictedMove, s16 *score) +void ProtectChecks(u32 battlerAtk, u32 battlerDef, u32 move, u32 predictedMove, s32 *score) { // TODO more sophisticated logic - u16 predictedEffect = gBattleMoves[predictedMove].effect; - u8 defAbility = AI_DATA->abilities[battlerDef]; + u32 predictedEffect = gBattleMoves[predictedMove].effect; + u32 defAbility = AI_DATA->abilities[battlerDef]; u32 uses = gDisableStructs[battlerAtk].protectUses; /*if (GetMoveResultFlags(predictedMove) & (MOVE_RESULT_NO_EFFECT | MOVE_RESULT_MISSED)) @@ -1732,7 +1710,7 @@ void ProtectChecks(u8 battlerAtk, u8 battlerDef, u16 move, u16 predictedMove, s1 } // stat stages -bool32 ShouldLowerStat(u8 battler, u16 battlerAbility, u8 stat) +bool32 ShouldLowerStat(u32 battler, u32 battlerAbility, u32 stat) { if ((gBattleMons[battler].statStages[stat] > MIN_STAT_STAGE && battlerAbility != ABILITY_CONTRARY) || (battlerAbility == ABILITY_CONTRARY && gBattleMons[battler].statStages[stat] < MAX_STAT_STAGE)) @@ -1749,7 +1727,7 @@ bool32 ShouldLowerStat(u8 battler, u16 battlerAbility, u8 stat) return FALSE; } -bool32 BattlerStatCanRise(u8 battler, u16 battlerAbility, u8 stat) +bool32 BattlerStatCanRise(u32 battler, u32 battlerAbility, u32 stat) { if ((gBattleMons[battler].statStages[stat] < MAX_STAT_STAGE && battlerAbility != ABILITY_CONTRARY) || (battlerAbility == ABILITY_CONTRARY && gBattleMons[battler].statStages[stat] > MIN_STAT_STAGE)) @@ -1757,7 +1735,7 @@ bool32 BattlerStatCanRise(u8 battler, u16 battlerAbility, u8 stat) return FALSE; } -bool32 AreBattlersStatsMaxed(u8 battlerId) +bool32 AreBattlersStatsMaxed(u32 battlerId) { u32 i; for (i = STAT_ATK; i < NUM_BATTLE_STATS; i++) @@ -1768,7 +1746,7 @@ bool32 AreBattlersStatsMaxed(u8 battlerId) return TRUE; } -bool32 AnyStatIsRaised(u8 battlerId) +bool32 AnyStatIsRaised(u32 battlerId) { u32 i; @@ -1780,7 +1758,7 @@ bool32 AnyStatIsRaised(u8 battlerId) return FALSE; } -u32 CountPositiveStatStages(u8 battlerId) +u32 CountPositiveStatStages(u32 battlerId) { u32 count = 0; u32 i; @@ -1792,7 +1770,7 @@ u32 CountPositiveStatStages(u8 battlerId) return count; } -u32 CountNegativeStatStages(u8 battlerId) +u32 CountNegativeStatStages(u32 battlerId) { u32 count = 0; u32 i; @@ -1804,9 +1782,9 @@ u32 CountNegativeStatStages(u8 battlerId) return count; } -bool32 ShouldLowerAttack(u8 battlerAtk, u8 battlerDef, u16 defAbility) +bool32 ShouldLowerAttack(u32 battlerAtk, u32 battlerDef, u32 defAbility) { - if (WillAIStrikeFirst() && (AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) + if (AI_STRIKES_FIRST(battlerAtk, battlerDef, AI_THINKING_STRUCT->moveConsidered) && (AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) return FALSE; // Don't bother lowering stats if can kill enemy. if (gBattleMons[battlerDef].statStages[STAT_ATK] > 4 @@ -1821,9 +1799,9 @@ bool32 ShouldLowerAttack(u8 battlerAtk, u8 battlerDef, u16 defAbility) return FALSE; } -bool32 ShouldLowerDefense(u8 battlerAtk, u8 battlerDef, u16 defAbility) +bool32 ShouldLowerDefense(u32 battlerAtk, u32 battlerDef, u32 defAbility) { - if (WillAIStrikeFirst() && (AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) + if (AI_STRIKES_FIRST(battlerAtk, battlerDef, AI_THINKING_STRUCT->moveConsidered) && (AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) return FALSE; // Don't bother lowering stats if can kill enemy. if (gBattleMons[battlerDef].statStages[STAT_DEF] > 4 @@ -1838,12 +1816,12 @@ bool32 ShouldLowerDefense(u8 battlerAtk, u8 battlerDef, u16 defAbility) return FALSE; } -bool32 ShouldLowerSpeed(u8 battlerAtk, u8 battlerDef, u16 defAbility) +bool32 ShouldLowerSpeed(u32 battlerAtk, u32 battlerDef, u32 defAbility) { - if (WillAIStrikeFirst() && (AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) + if (AI_STRIKES_FIRST(battlerAtk, battlerDef, AI_THINKING_STRUCT->moveConsidered) && (AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) return FALSE; // Don't bother lowering stats if can kill enemy. - if (!WillAIStrikeFirst() + if (!AI_STRIKES_FIRST(battlerAtk, battlerDef, AI_THINKING_STRUCT->moveConsidered) && defAbility != ABILITY_CONTRARY && defAbility != ABILITY_CLEAR_BODY && defAbility != ABILITY_FULL_METAL_BODY @@ -1853,9 +1831,9 @@ bool32 ShouldLowerSpeed(u8 battlerAtk, u8 battlerDef, u16 defAbility) return FALSE; } -bool32 ShouldLowerSpAtk(u8 battlerAtk, u8 battlerDef, u16 defAbility) +bool32 ShouldLowerSpAtk(u32 battlerAtk, u32 battlerDef, u32 defAbility) { - if (WillAIStrikeFirst() && (AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) + if (AI_STRIKES_FIRST(battlerAtk, battlerDef, AI_THINKING_STRUCT->moveConsidered) && (AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) return FALSE; // Don't bother lowering stats if can kill enemy. if (gBattleMons[battlerDef].statStages[STAT_SPATK] > 4 @@ -1869,9 +1847,9 @@ bool32 ShouldLowerSpAtk(u8 battlerAtk, u8 battlerDef, u16 defAbility) return FALSE; } -bool32 ShouldLowerSpDef(u8 battlerAtk, u8 battlerDef, u16 defAbility) +bool32 ShouldLowerSpDef(u32 battlerAtk, u32 battlerDef, u32 defAbility) { - if (WillAIStrikeFirst() && (AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) + if (AI_STRIKES_FIRST(battlerAtk, battlerDef, AI_THINKING_STRUCT->moveConsidered) && (AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) return FALSE; // Don't bother lowering stats if can kill enemy. if (gBattleMons[battlerDef].statStages[STAT_SPDEF] > 4 @@ -1885,9 +1863,9 @@ bool32 ShouldLowerSpDef(u8 battlerAtk, u8 battlerDef, u16 defAbility) return FALSE; } -bool32 ShouldLowerAccuracy(u8 battlerAtk, u8 battlerDef, u16 defAbility) +bool32 ShouldLowerAccuracy(u32 battlerAtk, u32 battlerDef, u32 defAbility) { - if (WillAIStrikeFirst() && (AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) + if (AI_STRIKES_FIRST(battlerAtk, battlerDef, AI_THINKING_STRUCT->moveConsidered) && (AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) return FALSE; // Don't bother lowering stats if can kill enemy. if (defAbility != ABILITY_CONTRARY @@ -1900,9 +1878,9 @@ bool32 ShouldLowerAccuracy(u8 battlerAtk, u8 battlerDef, u16 defAbility) return FALSE; } -bool32 ShouldLowerEvasion(u8 battlerAtk, u8 battlerDef, u16 defAbility) +bool32 ShouldLowerEvasion(u32 battlerAtk, u32 battlerDef, u32 defAbility) { - if (WillAIStrikeFirst() && (AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) + if (AI_STRIKES_FIRST(battlerAtk, battlerDef, AI_THINKING_STRUCT->moveConsidered) && (AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) return FALSE; // Don't bother lowering stats if can kill enemy. if (gBattleMons[battlerDef].statStages[STAT_EVASION] > DEFAULT_STAT_STAGE @@ -1915,7 +1893,7 @@ bool32 ShouldLowerEvasion(u8 battlerAtk, u8 battlerDef, u16 defAbility) return FALSE; } -bool32 CanIndexMoveFaintTarget(u8 battlerAtk, u8 battlerDef, u8 index, u8 numHits) +bool32 CanIndexMoveFaintTarget(u32 battlerAtk, u32 battlerDef, u32 index, u32 numHits) { s32 dmg = AI_DATA->simulatedDmg[battlerAtk][battlerDef][index]; @@ -1944,7 +1922,7 @@ bool32 HasOnlyMovesWithSplit(u32 battlerId, u32 split, bool32 onlyOffensive) { if (onlyOffensive && IS_MOVE_STATUS(moves[i])) continue; - if (moves[i] != MOVE_NONE && moves[i] != 0xFFFF && GetBattleMoveSplit(moves[i]) != split) + if (moves[i] != MOVE_NONE && moves[i] != MOVE_UNAVAILABLE && GetBattleMoveSplit(moves[i]) != split) return FALSE; } @@ -1958,35 +1936,35 @@ bool32 HasMoveWithSplit(u32 battler, u32 split) for (i = 0; i < MAX_MON_MOVES; i++) { - if (moves[i] != MOVE_NONE && moves[i] != 0xFFFF && GetBattleMoveSplit(moves[i]) == split) + if (moves[i] != MOVE_NONE && moves[i] != MOVE_UNAVAILABLE && GetBattleMoveSplit(moves[i]) == split) return TRUE; } return FALSE; } -bool32 HasMoveWithType(u32 battler, u8 type) +bool32 HasMoveWithType(u32 battler, u32 type) { s32 i; u16 *moves = GetMovesArray(battler); for (i = 0; i < MAX_MON_MOVES; i++) { - if (moves[i] != MOVE_NONE && moves[i] != 0xFFFF && gBattleMoves[moves[i]].type == type) + if (moves[i] != MOVE_NONE && moves[i] != MOVE_UNAVAILABLE && gBattleMoves[moves[i]].type == type) return TRUE; } return FALSE; } -bool32 HasMoveEffect(u32 battlerId, u16 moveEffect) +bool32 HasMoveEffect(u32 battlerId, u32 moveEffect) { s32 i; u16 *moves = GetMovesArray(battlerId); for (i = 0; i < MAX_MON_MOVES; i++) { - if (moves[i] != MOVE_NONE && moves[i] != 0xFFFF && gBattleMoves[moves[i]].effect == moveEffect) + if (moves[i] != MOVE_NONE && moves[i] != MOVE_UNAVAILABLE && gBattleMoves[moves[i]].effect == moveEffect) return TRUE; } @@ -2000,22 +1978,22 @@ bool32 HasMove(u32 battlerId, u32 move) for (i = 0; i < MAX_MON_MOVES; i++) { - if (moves[i] != MOVE_NONE && moves[i] != 0xFFFF && moves[i] == move) + if (moves[i] != MOVE_NONE && moves[i] != MOVE_UNAVAILABLE && moves[i] == move) return TRUE; } return FALSE; } -bool32 HasMoveWithLowAccuracy(u8 battlerAtk, u8 battlerDef, u8 accCheck, bool32 ignoreStatus, u16 atkAbility, u16 defAbility, u16 atkHoldEffect, u16 defHoldEffect) +bool32 HasMoveWithLowAccuracy(u32 battlerAtk, u32 battlerDef, u32 accCheck, bool32 ignoreStatus, u32 atkAbility, u32 defAbility, u32 atkHoldEffect, u32 defHoldEffect) { s32 i; u16 *moves = GetMovesArray(battlerAtk); - u8 moveLimitations = AI_DATA->moveLimitations[battlerAtk]; + u32 moveLimitations = AI_DATA->moveLimitations[battlerAtk]; for (i = 0; i < MAX_MON_MOVES; i++) { - if (moves[i] == MOVE_NONE || moves[i] == 0xFFFF) + if (moves[i] == MOVE_NONE || moves[i] == MOVE_UNAVAILABLE) continue; if (!(gBitTable[i] & moveLimitations)) @@ -2034,9 +2012,9 @@ bool32 HasMoveWithLowAccuracy(u8 battlerAtk, u8 battlerDef, u8 accCheck, bool32 return FALSE; } -bool32 HasSleepMoveWithLowAccuracy(u8 battlerAtk, u8 battlerDef) +bool32 HasSleepMoveWithLowAccuracy(u32 battlerAtk, u32 battlerDef) { - u8 moveLimitations = AI_DATA->moveLimitations[battlerAtk]; + u32 moveLimitations = AI_DATA->moveLimitations[battlerAtk]; u32 i; u16 *moves = GetMovesArray(battlerAtk); @@ -2054,7 +2032,7 @@ bool32 HasSleepMoveWithLowAccuracy(u8 battlerAtk, u8 battlerDef) return FALSE; } -bool32 IsHealingMoveEffect(u16 effect) +bool32 IsHealingMoveEffect(u32 effect) { switch (effect) { @@ -2069,6 +2047,7 @@ bool32 IsHealingMoveEffect(u16 effect) case EFFECT_HEALING_WISH: case EFFECT_HEAL_PULSE: case EFFECT_REST: + case EFFECT_JUNGLE_HEALING: return TRUE; default: return FALSE; @@ -2082,14 +2061,14 @@ bool32 HasHealingEffect(u32 battlerId) for (i = 0; i < MAX_MON_MOVES; i++) { - if (moves[i] != MOVE_NONE && moves[i] != 0xFFFF && IsHealingMoveEffect(gBattleMoves[moves[i]].effect)) + if (moves[i] != MOVE_NONE && moves[i] != MOVE_UNAVAILABLE && IsHealingMoveEffect(gBattleMoves[moves[i]].effect)) return TRUE; } return FALSE; } -bool32 IsTrappingMoveEffect(u16 effect) +bool32 IsTrappingMoveEffect(u32 effect) { switch (effect) { @@ -2104,35 +2083,26 @@ bool32 IsTrappingMoveEffect(u16 effect) } } -bool32 HasTrappingMoveEffect(u8 battler) +bool32 HasTrappingMoveEffect(u32 battler) { s32 i; u16 *moves = GetMovesArray(battler); for (i = 0; i < MAX_MON_MOVES; i++) { - if (moves[i] != MOVE_NONE && moves[i] != 0xFFFF && IsTrappingMoveEffect(gBattleMoves[moves[i]].effect)) + if (moves[i] != MOVE_NONE && moves[i] != MOVE_UNAVAILABLE && IsTrappingMoveEffect(gBattleMoves[moves[i]].effect)) return TRUE; } return FALSE; } -bool32 HasThawingMove(u8 battlerId) +bool32 HasThawingMove(u32 battler) { - s32 i; - u16 *moves = GetMovesArray(battlerId); - - for (i = 0; i < MAX_MON_MOVES; i++) - { - if (moves[i] != MOVE_NONE && moves[i] != 0xFFFF && TestMoveFlags(moves[i], FLAG_THAW_USER)) - return TRUE; - } - - return FALSE; + CHECK_MOVE_FLAG(thawsUser); } -bool32 IsUngroundingEffect(u16 effect) +bool32 IsUngroundingEffect(u32 effect) { switch (effect) { @@ -2144,7 +2114,7 @@ bool32 IsUngroundingEffect(u16 effect) } // for anger point -bool32 IsAttackBoostMoveEffect(u16 effect) +bool32 IsAttackBoostMoveEffect(u32 effect) { switch (effect) { @@ -2163,7 +2133,7 @@ bool32 IsAttackBoostMoveEffect(u16 effect) } } -bool32 IsStatRaisingEffect(u16 effect) +bool32 IsStatRaisingEffect(u32 effect) { switch (effect) { @@ -2209,7 +2179,7 @@ bool32 IsStatRaisingEffect(u16 effect) } } -bool32 IsStatLoweringEffect(u16 effect) +bool32 IsStatLoweringEffect(u32 effect) { // ignore other potentially-beneficial effects like defog, gravity switch (effect) @@ -2237,28 +2207,28 @@ bool32 IsStatLoweringEffect(u16 effect) } } -bool32 HasDamagingMove(u8 battlerId) +bool32 HasDamagingMove(u32 battlerId) { u32 i; u16 *moves = GetMovesArray(battlerId); for (i = 0; i < MAX_MON_MOVES; i++) { - if (moves[i] != MOVE_NONE && moves[i] != 0xFFFF && gBattleMoves[moves[i]].power != 0) + if (moves[i] != MOVE_NONE && moves[i] != MOVE_UNAVAILABLE && gBattleMoves[moves[i]].power != 0) return TRUE; } return FALSE; } -bool32 HasDamagingMoveOfType(u8 battlerId, u8 type) +bool32 HasDamagingMoveOfType(u32 battlerId, u32 type) { s32 i; u16 *moves = GetMovesArray(battlerId); for (i = 0; i < MAX_MON_MOVES; i++) { - if (moves[i] != MOVE_NONE && moves[i] != 0xFFFF + if (moves[i] != MOVE_NONE && moves[i] != MOVE_UNAVAILABLE && gBattleMoves[moves[i]].type == type && gBattleMoves[moves[i]].power != 0) return TRUE; } @@ -2266,18 +2236,27 @@ bool32 HasDamagingMoveOfType(u8 battlerId, u8 type) return FALSE; } -bool32 IsInstructBannedMove(u16 move) +bool32 HasSoundMove(u32 battler) { - u32 i; - for (i = 0; i < ARRAY_COUNT(sInstructBannedMoves); i++) - { - if (move == sInstructBannedMoves[i]) - return TRUE; - } - return FALSE; + CHECK_MOVE_FLAG(soundMove); +} + +bool32 HasHighCritRatioMove(u32 battler) +{ + CHECK_MOVE_FLAG(highCritRatio); +} + +bool32 HasMagicCoatAffectedMove(u32 battler) +{ + CHECK_MOVE_FLAG(magicCoatAffected); } -bool32 IsEncoreEncouragedEffect(u16 moveEffect) +bool32 HasSnatchAffectedMove(u32 battler) +{ + CHECK_MOVE_FLAG(snatchAffected); +} + +bool32 IsEncoreEncouragedEffect(u32 moveEffect) { u32 i; @@ -2289,7 +2268,7 @@ bool32 IsEncoreEncouragedEffect(u16 moveEffect) return FALSE; } -bool32 MoveRequiresRecharging(u16 move) +bool32 MoveRequiresRecharging(u32 move) { u32 i; for (i = 0; i < ARRAY_COUNT(sRechargeMoves); i++) @@ -2300,7 +2279,7 @@ bool32 MoveRequiresRecharging(u16 move) return FALSE; } -bool32 MoveCallsOtherMove(u16 move) +bool32 MoveCallsOtherMove(u32 move) { u32 i; for (i = 0; i < ARRAY_COUNT(sOtherMoveCallingMoves); i++) @@ -2311,20 +2290,7 @@ bool32 MoveCallsOtherMove(u16 move) return FALSE; } -bool32 TestMoveFlagsInMoveset(u8 battler, u32 flags) -{ - s32 i; - u16 *moves = GetMovesArray(battler); - - for (i = 0; i < MAX_MON_MOVES; i++) - { - if (moves[i] != MOVE_NONE && moves[i] != 0xFFFF && TestMoveFlags(moves[i], flags)) - return TRUE; - } - return FALSE; -} - -static u32 GetLeechSeedDamage(u8 battlerId) +static u32 GetLeechSeedDamage(u32 battlerId) { u32 damage = 0; if ((gStatuses3[battlerId] & STATUS3_LEECHSEED) @@ -2337,7 +2303,7 @@ static u32 GetLeechSeedDamage(u8 battlerId) return damage; } -static u32 GetNightmareDamage(u8 battlerId) +static u32 GetNightmareDamage(u32 battlerId) { u32 damage = 0; if ((gBattleMons[battlerId].status2 & STATUS2_NIGHTMARE) && gBattleMons[battlerId].status1 & STATUS1_SLEEP) @@ -2349,7 +2315,7 @@ static u32 GetNightmareDamage(u8 battlerId) return damage; } -static u32 GetCurseDamage(u8 battlerId) +static u32 GetCurseDamage(u32 battlerId) { u32 damage = 0; if (gBattleMons[battlerId].status2 & STATUS2_CURSED) @@ -2361,7 +2327,7 @@ static u32 GetCurseDamage(u8 battlerId) return damage; } -static u32 GetTrapDamage(u8 battlerId) +static u32 GetTrapDamage(u32 battlerId) { // ai has no knowledge about turns remaining u32 damage = 0; @@ -2384,7 +2350,7 @@ static u32 GetTrapDamage(u8 battlerId) return damage; } -static u32 GetPoisonDamage(u8 battlerId) +static u32 GetPoisonDamage(u32 battlerId) { u32 damage = 0; @@ -2409,7 +2375,7 @@ static u32 GetPoisonDamage(u8 battlerId) return damage; } -static bool32 BattlerAffectedBySandstorm(u8 battlerId, u16 ability) +static bool32 BattlerAffectedBySandstorm(u32 battlerId, u32 ability) { if (!IS_BATTLER_OF_TYPE(battlerId, TYPE_ROCK) && !IS_BATTLER_OF_TYPE(battlerId, TYPE_GROUND) @@ -2422,7 +2388,7 @@ static bool32 BattlerAffectedBySandstorm(u8 battlerId, u16 ability) return FALSE; } -static bool32 BattlerAffectedByHail(u8 battlerId, u16 ability) +static bool32 BattlerAffectedByHail(u32 battlerId, u32 ability) { if (!IS_BATTLER_OF_TYPE(battlerId, TYPE_ICE) && ability != ABILITY_SNOW_CLOAK @@ -2432,15 +2398,16 @@ static bool32 BattlerAffectedByHail(u8 battlerId, u16 ability) return FALSE; } -static u32 GetWeatherDamage(u8 battlerId) +static u32 GetWeatherDamage(u32 battlerId) { u32 ability = AI_DATA->abilities[battlerId]; u32 holdEffect = AI_DATA->holdEffects[battlerId]; u32 damage = 0; - if (!AI_WeatherHasEffect()) + u32 weather = AI_GetWeather(AI_DATA); + if (!weather) return 0; - if (gBattleWeather & B_WEATHER_SANDSTORM) + if (weather & B_WEATHER_SANDSTORM) { if (BattlerAffectedBySandstorm(battlerId, ability) && !(gStatuses3[battlerId] & (STATUS3_UNDERGROUND | STATUS3_UNDERWATER)) @@ -2451,7 +2418,7 @@ static u32 GetWeatherDamage(u8 battlerId) damage = 1; } } - if ((gBattleWeather & B_WEATHER_HAIL) && ability != ABILITY_ICE_BODY) + if ((weather & B_WEATHER_HAIL) && ability != ABILITY_ICE_BODY) { if (BattlerAffectedByHail(battlerId, ability) && !(gStatuses3[battlerId] & (STATUS3_UNDERGROUND | STATUS3_UNDERWATER)) @@ -2465,7 +2432,7 @@ static u32 GetWeatherDamage(u8 battlerId) return damage; } -u32 GetBattlerSecondaryDamage(u8 battlerId) +u32 GetBattlerSecondaryDamage(u32 battlerId) { u32 secondaryDamage; @@ -2482,7 +2449,7 @@ u32 GetBattlerSecondaryDamage(u8 battlerId) return secondaryDamage; } -bool32 BattlerWillFaintFromWeather(u8 battler, u16 ability) +bool32 BattlerWillFaintFromWeather(u32 battler, u32 ability) { if ((BattlerAffectedBySandstorm(battler, ability) || BattlerAffectedByHail(battler, ability)) && gBattleMons[battler].hp <= gBattleMons[battler].maxHP / 16) @@ -2491,7 +2458,7 @@ bool32 BattlerWillFaintFromWeather(u8 battler, u16 ability) return FALSE; } -bool32 BattlerWillFaintFromSecondaryDamage(u8 battler, u16 ability) +bool32 BattlerWillFaintFromSecondaryDamage(u32 battler, u32 ability) { if (GetBattlerSecondaryDamage(battler) != 0 && gBattleMons[battler].hp <= gBattleMons[battler].maxHP / 16) @@ -2499,9 +2466,9 @@ bool32 BattlerWillFaintFromSecondaryDamage(u8 battler, u16 ability) return FALSE; } -static bool32 AnyUsefulStatIsRaised(u8 battler) +static bool32 AnyUsefulStatIsRaised(u32 battler) { - u8 statId; + u32 statId; for (statId = STAT_ATK; statId < NUM_BATTLE_STATS; statId++) { @@ -2526,7 +2493,7 @@ static bool32 AnyUsefulStatIsRaised(u8 battler) return FALSE; } -struct Pokemon *GetPartyBattlerPartyData(u8 battlerId, u8 switchBattler) +struct Pokemon *GetPartyBattlerPartyData(u32 battlerId, u32 switchBattler) { struct Pokemon *mon; if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) @@ -2536,16 +2503,16 @@ struct Pokemon *GetPartyBattlerPartyData(u8 battlerId, u8 switchBattler) return mon; } -static bool32 PartyBattlerShouldAvoidHazards(u8 currBattler, u8 switchBattler) +static bool32 PartyBattlerShouldAvoidHazards(u32 currBattler, u32 switchBattler) { struct Pokemon *mon = GetPartyBattlerPartyData(currBattler, switchBattler); - u16 ability = GetMonAbility(mon); // we know our own party data - u16 holdEffect; - u16 species = GetMonData(mon, MON_DATA_SPECIES); + u32 ability = GetMonAbility(mon); // we know our own party data + u32 holdEffect; + u32 species = GetMonData(mon, MON_DATA_SPECIES); u32 flags = gSideStatuses[GetBattlerSide(currBattler)] & (SIDE_STATUS_SPIKES | SIDE_STATUS_STEALTH_ROCK | SIDE_STATUS_STICKY_WEB | SIDE_STATUS_TOXIC_SPIKES); s32 hazardDamage = 0; - u8 type1 = gSpeciesInfo[species].types[0]; - u8 type2 = gSpeciesInfo[species].types[1]; + u32 type1 = gSpeciesInfo[species].types[0]; + u32 type2 = gSpeciesInfo[species].types[1]; u32 maxHp = GetMonData(mon, MON_DATA_MAX_HP); if (flags == 0) @@ -2567,7 +2534,7 @@ static bool32 PartyBattlerShouldAvoidHazards(u8 currBattler, u8 switchBattler) && ability != ABILITY_LEVITATE && holdEffect != HOLD_EFFECT_AIR_BALLOON) || holdEffect == HOLD_EFFECT_IRON_BALL || gFieldStatuses & STATUS_FIELD_GRAVITY)) { - u8 spikesDmg = maxHp / ((5 - gSideTimers[GetBattlerSide(currBattler)].spikesAmount) * 2); + s32 spikesDmg = maxHp / ((5 - gSideTimers[GetBattlerSide(currBattler)].spikesAmount) * 2); if (spikesDmg == 0) spikesDmg = 1; hazardDamage += spikesDmg; @@ -2583,17 +2550,14 @@ enum { CAN_TRY_PIVOT, PIVOT, }; -bool32 ShouldPivot(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u8 moveIndex) +bool32 ShouldPivot(u32 battlerAtk, u32 battlerDef, u32 defAbility, u32 move, u32 moveIndex) { - bool8 hasStatBoost = AnyUsefulStatIsRaised(battlerAtk) || gBattleMons[battlerDef].statStages[STAT_EVASION] >= 9; //Significant boost in evasion for any class - u8 backupBattler = gActiveBattler; + bool32 hasStatBoost = AnyUsefulStatIsRaised(battlerAtk) || gBattleMons[battlerDef].statStages[STAT_EVASION] >= 9; //Significant boost in evasion for any class bool32 shouldSwitch; - u8 battlerToSwitch; + u32 battlerToSwitch; - gActiveBattler = battlerAtk; - shouldSwitch = ShouldSwitch(); - battlerToSwitch = *(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler); - gActiveBattler = backupBattler; + shouldSwitch = ShouldSwitch(battlerAtk); + battlerToSwitch = *(gBattleStruct->AI_monToSwitchIntoId + battlerAtk); if (PartyBattlerShouldAvoidHazards(battlerAtk, battlerToSwitch)) return DONT_PIVOT; @@ -2648,8 +2612,8 @@ bool32 ShouldPivot(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u8 mo /*if (IsClassDamager(class) && switchScore >= SWITCHING_INCREASE_HAS_SUPER_EFFECTIVE_MOVE) { - bool8 physMoveInMoveset = PhysicalMoveInMoveset(battlerAtk); - bool8 specMoveInMoveset = SpecialMoveInMoveset(battlerAtk); + bool32 physMoveInMoveset = PhysicalMoveInMoveset(battlerAtk); + bool32 specMoveInMoveset = SpecialMoveInMoveset(battlerAtk); //Pivot if attacking stats are bad if (physMoveInMoveset && !specMoveInMoveset) @@ -2731,8 +2695,8 @@ bool32 ShouldPivot(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u8 mo /*if (IsClassDamager(class) && switchScore >= SWITCHING_INCREASE_HAS_SUPER_EFFECTIVE_MOVE) { - bool8 physMoveInMoveset = PhysicalMoveInMoveset(battlerAtk); - bool8 specMoveInMoveset = SpecialMoveInMoveset(battlerAtk); + bool32 physMoveInMoveset = PhysicalMoveInMoveset(battlerAtk); + bool32 specMoveInMoveset = SpecialMoveInMoveset(battlerAtk); //Pivot if attacking stats are bad if (physMoveInMoveset && !specMoveInMoveset) @@ -2762,7 +2726,7 @@ bool32 ShouldPivot(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u8 mo return DONT_PIVOT; } -bool32 CanKnockOffItem(u8 battler, u16 item) +bool32 CanKnockOffItem(u32 battler, u32 item) { if (item == ITEM_NONE) return FALSE; @@ -2788,7 +2752,7 @@ bool32 CanKnockOffItem(u8 battler, u16 item) } // status checks -bool32 IsBattlerIncapacitated(u8 battler, u16 ability) +bool32 IsBattlerIncapacitated(u32 battler, u32 ability) { if ((gBattleMons[battler].status1 & STATUS1_FREEZE) && !HasThawingMove(battler)) return TRUE; // if battler has thawing move we assume they will definitely use it, and thus being frozen should be neglected @@ -2802,7 +2766,7 @@ bool32 IsBattlerIncapacitated(u8 battler, u16 ability) return FALSE; } -bool32 AI_CanSleep(u8 battler, u16 ability) +bool32 AI_CanSleep(u32 battler, u32 ability) { if (ability == ABILITY_INSOMNIA || ability == ABILITY_VITAL_SPIRIT @@ -2815,7 +2779,7 @@ bool32 AI_CanSleep(u8 battler, u16 ability) return TRUE; } -bool32 AI_CanPutToSleep(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove) +bool32 AI_CanPutToSleep(u32 battlerAtk, u32 battlerDef, u32 defAbility, u32 move, u32 partnerMove) { if (!AI_CanSleep(battlerDef, defAbility) || DoesSubstituteBlockMove(battlerAtk, battlerDef, move) @@ -2824,17 +2788,17 @@ bool32 AI_CanPutToSleep(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, return TRUE; } -static bool32 AI_CanPoisonType(u8 battlerAttacker, u8 battlerTarget) +static bool32 AI_CanPoisonType(u32 battlerAttacker, u32 battlerTarget, u32 move) { - return ((AI_DATA->abilities[battlerAttacker] == ABILITY_CORROSION && gBattleMoves[gCurrentMove].split == SPLIT_STATUS) + return ((AI_DATA->abilities[battlerAttacker] == ABILITY_CORROSION && gBattleMoves[move].split == SPLIT_STATUS) || !(IS_BATTLER_OF_TYPE(battlerTarget, TYPE_POISON) || IS_BATTLER_OF_TYPE(battlerTarget, TYPE_STEEL))); } -static bool32 AI_CanBePoisoned(u8 battlerAtk, u8 battlerDef) +static bool32 AI_CanBePoisoned(u32 battlerAtk, u32 battlerDef, u32 move) { - u16 ability = AI_DATA->abilities[battlerDef]; + u32 ability = AI_DATA->abilities[battlerDef]; - if (!(AI_CanPoisonType(battlerAtk, battlerDef)) + if (!(AI_CanPoisonType(battlerAtk, battlerDef, move)) || gSideStatuses[GetBattlerSide(battlerDef)] & SIDE_STATUS_SAFEGUARD || gBattleMons[battlerDef].status1 & STATUS1_ANY || ability == ABILITY_IMMUNITY @@ -2847,9 +2811,9 @@ static bool32 AI_CanBePoisoned(u8 battlerAtk, u8 battlerDef) return TRUE; } -bool32 ShouldPoisonSelf(u8 battler, u16 ability) +bool32 ShouldPoisonSelf(u32 battler, u32 ability) { - if (AI_CanBePoisoned(battler, battler) && ( + if (AI_CanBePoisoned(battler, battler, 0) && ( ability == ABILITY_MARVEL_SCALE || ability == ABILITY_POISON_HEAL || ability == ABILITY_QUICK_FEET @@ -2862,9 +2826,9 @@ bool32 ShouldPoisonSelf(u8 battler, u16 ability) return FALSE; } -bool32 AI_CanPoison(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove) +bool32 AI_CanPoison(u32 battlerAtk, u32 battlerDef, u32 defAbility, u32 move, u32 partnerMove) { - if (!AI_CanBePoisoned(battlerAtk, battlerDef) + if (!AI_CanBePoisoned(battlerAtk, battlerDef, move) || AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0 || DoesSubstituteBlockMove(battlerAtk, battlerDef, move) || PartnerMoveEffectIsStatusSameTarget(BATTLE_PARTNER(battlerAtk), battlerDef, partnerMove)) @@ -2877,7 +2841,7 @@ bool32 AI_CanPoison(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 return TRUE; } -static bool32 AI_CanBeParalyzed(u8 battler, u16 ability) +static bool32 AI_CanBeParalyzed(u32 battler, u32 ability) { if (ability == ABILITY_LIMBER || ability == ABILITY_COMATOSE @@ -2888,7 +2852,7 @@ static bool32 AI_CanBeParalyzed(u8 battler, u16 ability) return TRUE; } -bool32 AI_CanParalyze(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove) +bool32 AI_CanParalyze(u32 battlerAtk, u32 battlerDef, u32 defAbility, u32 move, u32 partnerMove) { if (!AI_CanBeParalyzed(battlerDef, defAbility) || AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0 @@ -2899,7 +2863,7 @@ bool32 AI_CanParalyze(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u1 return TRUE; } -bool32 AI_CanBeConfused(u8 battler, u16 ability) +bool32 AI_CanBeConfused(u32 battler, u32 ability) { if ((gBattleMons[battler].status2 & STATUS2_CONFUSION) || (ability == ABILITY_OWN_TEMPO) @@ -2908,7 +2872,7 @@ bool32 AI_CanBeConfused(u8 battler, u16 ability) return TRUE; } -bool32 AI_CanConfuse(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 battlerAtkPartner, u16 move, u16 partnerMove) +bool32 AI_CanConfuse(u32 battlerAtk, u32 battlerDef, u32 defAbility, u32 battlerAtkPartner, u32 move, u32 partnerMove) { if (!AI_CanBeConfused(battlerDef, defAbility) || AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0 @@ -2922,7 +2886,7 @@ bool32 AI_CanConfuse(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 battlerAtk return TRUE; } -bool32 AI_CanBeBurned(u8 battler, u16 ability) +bool32 AI_CanBeBurned(u32 battler, u32 ability) { if (ability == ABILITY_WATER_VEIL || ability == ABILITY_WATER_BUBBLE @@ -2935,7 +2899,7 @@ bool32 AI_CanBeBurned(u8 battler, u16 ability) return TRUE; } -bool32 AI_CanGetFrostbite(u8 battler, u16 ability) +bool32 AI_CanGetFrostbite(u32 battler, u32 ability) { if (ability == ABILITY_MAGMA_ARMOR || ability == ABILITY_COMATOSE @@ -2947,7 +2911,7 @@ bool32 AI_CanGetFrostbite(u8 battler, u16 ability) return TRUE; } -bool32 ShouldBurnSelf(u8 battler, u16 ability) +bool32 ShouldBurnSelf(u32 battler, u32 ability) { if (AI_CanBeBurned(battler, ability) && ( ability == ABILITY_QUICK_FEET @@ -2961,7 +2925,7 @@ bool32 ShouldBurnSelf(u8 battler, u16 ability) return FALSE; } -bool32 AI_CanBurn(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 battlerAtkPartner, u16 move, u16 partnerMove) +bool32 AI_CanBurn(u32 battlerAtk, u32 battlerDef, u32 defAbility, u32 battlerAtkPartner, u32 move, u32 partnerMove) { if (!AI_CanBeBurned(battlerDef, defAbility) || AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0 @@ -2973,7 +2937,7 @@ bool32 AI_CanBurn(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 battlerAtkPar return TRUE; } -bool32 AI_CanGiveFrostbite(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 battlerAtkPartner, u16 move, u16 partnerMove) +bool32 AI_CanGiveFrostbite(u32 battlerAtk, u32 battlerDef, u32 defAbility, u32 battlerAtkPartner, u32 move, u32 partnerMove) { if (!AI_CanGetFrostbite(battlerDef, defAbility) || AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0 @@ -2985,7 +2949,7 @@ bool32 AI_CanGiveFrostbite(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 batt return TRUE; } -bool32 AI_CanBeInfatuated(u8 battlerAtk, u8 battlerDef, u16 defAbility) +bool32 AI_CanBeInfatuated(u32 battlerAtk, u32 battlerDef, u32 defAbility) { if ((gBattleMons[battlerDef].status2 & STATUS2_INFATUATION) || AI_GetMoveEffectiveness(AI_THINKING_STRUCT->moveConsidered, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0 @@ -2996,29 +2960,28 @@ bool32 AI_CanBeInfatuated(u8 battlerAtk, u8 battlerDef, u16 defAbility) return TRUE; } -u32 ShouldTryToFlinch(u8 battlerAtk, u8 battlerDef, u16 atkAbility, u16 defAbility, u16 move) +u32 ShouldTryToFlinch(u32 battlerAtk, u32 battlerDef, u32 atkAbility, u32 defAbility, u32 move) { - if (defAbility == ABILITY_INNER_FOCUS + if (((AI_DATA->abilities[battlerAtk] != ABILITY_MOLD_BREAKER && (defAbility == ABILITY_SHIELD_DUST || defAbility == ABILITY_INNER_FOCUS)) + || AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_COVERT_CLOAK || DoesSubstituteBlockMove(battlerAtk, battlerDef, move) - || AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_SLOWER) // Opponent goes first + || AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_SLOWER)) // Opponent goes first { - return 0; // don't try to flinch - } - else if ((gBattleMons[battlerDef].status1 & STATUS1_SLEEP) && !HasMoveEffect(battlerDef, EFFECT_SLEEP_TALK) && !HasMoveEffect(battlerDef, EFFECT_SNORE)) - { - return 0; // don't try to flinch sleeping pokemon + return 0; } - else if (atkAbility == ABILITY_SERENE_GRACE + else if ((atkAbility == ABILITY_SERENE_GRACE || gBattleMons[battlerDef].status1 & STATUS1_PARALYSIS || gBattleMons[battlerDef].status2 & STATUS2_INFATUATION || gBattleMons[battlerDef].status2 & STATUS2_CONFUSION) + || ((AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) && CanTargetFaintAi(battlerDef, battlerAtk))) { return 2; // good idea to flinch } - return 1; // decent idea to flinch + + return 0; // don't try to flinch } -bool32 ShouldTrap(u8 battlerAtk, u8 battlerDef, u16 move) +bool32 ShouldTrap(u32 battlerAtk, u32 battlerDef, u32 move) { if (BattlerWillFaintFromSecondaryDamage(battlerDef, AI_DATA->abilities[battlerDef])) return TRUE; // battler is taking secondary damage with low HP @@ -3032,17 +2995,18 @@ bool32 ShouldTrap(u8 battlerAtk, u8 battlerDef, u16 move) return FALSE; } -bool32 ShouldFakeOut(u8 battlerAtk, u8 battlerDef, u16 move) +bool32 ShouldFakeOut(u32 battlerAtk, u32 battlerDef, u32 move) { - if (AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_CHOICE_BAND && CountUsablePartyMons(battlerAtk) == 0) - return FALSE; // don't lock attacker into fake out if can't switch out - - if (gDisableStructs[battlerAtk].isFirstTurn - && ShouldTryToFlinch(battlerAtk, battlerDef, AI_DATA->abilities[battlerAtk], AI_DATA->abilities[battlerDef], move) - && !DoesSubstituteBlockMove(battlerAtk, battlerDef, move)) - return TRUE; + if (!gDisableStructs[battlerAtk].isFirstTurn + || AI_DATA->abilities[battlerAtk] == ABILITY_GORILLA_TACTICS + || AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_CHOICE_BAND + || AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_COVERT_CLOAK + || DoesSubstituteBlockMove(battlerAtk, battlerDef, move) + || (AI_DATA->abilities[battlerAtk] != ABILITY_MOLD_BREAKER + && (AI_DATA->abilities[battlerDef] == ABILITY_SHIELD_DUST || AI_DATA->abilities[battlerDef] == ABILITY_INNER_FOCUS))) + return FALSE; - return FALSE; + return TRUE; } static u32 FindMoveUsedXTurnsAgo(u32 battlerId, u32 x) @@ -3056,7 +3020,7 @@ static u32 FindMoveUsedXTurnsAgo(u32 battlerId, u32 x) return BATTLE_HISTORY->moveHistory[battlerId][index]; } -bool32 IsWakeupTurn(u8 battler) +bool32 IsWakeupTurn(u32 battler) { // Check if rest was used 2 turns ago if ((gBattleMons[battler].status1 & STATUS1_SLEEP) == 1 && FindMoveUsedXTurnsAgo(battler, 2) == MOVE_REST) @@ -3065,7 +3029,7 @@ bool32 IsWakeupTurn(u8 battler) return FALSE; } -bool32 AnyPartyMemberStatused(u8 battlerId, bool32 checkSoundproof) +bool32 AnyPartyMemberStatused(u32 battlerId, bool32 checkSoundproof) { struct Pokemon *party; u32 i; @@ -3087,28 +3051,28 @@ bool32 AnyPartyMemberStatused(u8 battlerId, bool32 checkSoundproof) return FALSE; } -u16 GetBattlerSideSpeedAverage(u8 battler) +u32 GetBattlerSideSpeedAverage(u32 battler) { - u16 speed1 = 0; - u16 speed2 = 0; - u8 numBattlersAlive = 0; + u32 speed1 = 0; + u32 speed2 = 0; + u32 numBattlersAlive = 0; if (IsBattlerAlive(battler)) { - speed1 = GetBattlerTotalSpeedStat(battler); + speed1 = AI_DATA->speedStats[battler]; numBattlersAlive++; } if (IsDoubleBattle() && IsBattlerAlive(BATTLE_PARTNER(battler))) { - speed2 = GetBattlerTotalSpeedStat(BATTLE_PARTNER(battler)); + speed2 = AI_DATA->speedStats[BATTLE_PARTNER(battler)]; numBattlersAlive++; } return (speed1 + speed2) / numBattlersAlive; } -bool32 ShouldUseRecoilMove(u8 battlerAtk, u8 battlerDef, u32 recoilDmg, u8 moveIndex) +bool32 ShouldUseRecoilMove(u32 battlerAtk, u32 battlerDef, u32 recoilDmg, u32 moveIndex) { if (recoilDmg >= gBattleMons[battlerAtk].hp //Recoil kills attacker && CountUsablePartyMons(battlerDef) != 0) //Foe has more than 1 target left @@ -3122,12 +3086,12 @@ bool32 ShouldUseRecoilMove(u8 battlerAtk, u8 battlerDef, u32 recoilDmg, u8 moveI return TRUE; } -bool32 ShouldAbsorb(u8 battlerAtk, u8 battlerDef, u16 move, s32 damage) +bool32 ShouldAbsorb(u32 battlerAtk, u32 battlerDef, u32 move, s32 damage) { if (move == 0xFFFF || AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) { // using item or user goes first - u8 healPercent = (gBattleMoves[move].argument == 0) ? 50 : gBattleMoves[move].argument; + u32 healPercent = (gBattleMoves[move].argument == 0) ? 50 : gBattleMoves[move].argument; s32 healDmg = (healPercent * damage) / 100; if (gStatuses3[battlerAtk] & STATUS3_HEAL_BLOCK) @@ -3149,7 +3113,7 @@ bool32 ShouldAbsorb(u8 battlerAtk, u8 battlerDef, u16 move, s32 damage) return FALSE; } -bool32 ShouldRecover(u8 battlerAtk, u8 battlerDef, u16 move, u8 healPercent) +bool32 ShouldRecover(u32 battlerAtk, u32 battlerDef, u32 move, u32 healPercent) { if (move == 0xFFFF || AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) { @@ -3168,14 +3132,14 @@ bool32 ShouldRecover(u8 battlerAtk, u8 battlerDef, u16 move, u8 healPercent) return FALSE; } -bool32 ShouldSetScreen(u8 battlerAtk, u8 battlerDef, u16 moveEffect) +bool32 ShouldSetScreen(u32 battlerAtk, u32 battlerDef, u32 moveEffect) { - u8 atkSide = GetBattlerSide(battlerAtk); + u32 atkSide = GetBattlerSide(battlerAtk); switch (moveEffect) { case EFFECT_AURORA_VEIL: // Use only in Hail and only if AI doesn't already have Reflect, Light Screen or Aurora Veil itself active. - if ((gBattleWeather & (B_WEATHER_HAIL | B_WEATHER_SNOW)) + if ((AI_GetWeather(AI_DATA) & (B_WEATHER_HAIL | B_WEATHER_SNOW)) && !(gSideStatuses[atkSide] & (SIDE_STATUS_REFLECT | SIDE_STATUS_LIGHTSCREEN | SIDE_STATUS_AURORA_VEIL))) return TRUE; break; @@ -3197,7 +3161,7 @@ bool32 ShouldSetScreen(u8 battlerAtk, u8 battlerDef, u16 moveEffect) } // Partner Logic -bool32 IsValidDoubleBattle(u8 battlerAtk) +bool32 IsValidDoubleBattle(u32 battlerAtk) { if (IsDoubleBattle() && ((IsBattlerAlive(BATTLE_OPPOSITE(battlerAtk)) && IsBattlerAlive(BATTLE_PARTNER(BATTLE_OPPOSITE(battlerAtk)))) || IsBattlerAlive(BATTLE_PARTNER(battlerAtk)))) @@ -3205,9 +3169,9 @@ bool32 IsValidDoubleBattle(u8 battlerAtk) return FALSE; } -u16 GetAllyChosenMove(u8 battlerId) +u32 GetAllyChosenMove(u32 battlerId) { - u8 partnerBattler = BATTLE_PARTNER(battlerId); + u32 partnerBattler = BATTLE_PARTNER(battlerId); if (!IsBattlerAlive(partnerBattler) || !IsAiBattlerAware(partnerBattler)) return MOVE_NONE; @@ -3217,16 +3181,8 @@ u16 GetAllyChosenMove(u8 battlerId) return gBattleMons[partnerBattler].moves[gBattleStruct->chosenMovePositions[partnerBattler]]; } -bool32 IsTargetingPartner(u8 battlerAtk, u8 battlerDef) -{ - if ((battlerAtk & BIT_SIDE) == (battlerDef & BIT_SIDE)) - return TRUE; - - return FALSE; -} - //PARTNER_MOVE_EFFECT_IS_SAME -bool32 DoesPartnerHaveSameMoveEffect(u8 battlerAtkPartner, u8 battlerDef, u16 move, u16 partnerMove) +bool32 DoesPartnerHaveSameMoveEffect(u32 battlerAtkPartner, u32 battlerDef, u32 move, u32 partnerMove) { if (!IsDoubleBattle()) return FALSE; @@ -3241,7 +3197,7 @@ bool32 DoesPartnerHaveSameMoveEffect(u8 battlerAtkPartner, u8 battlerDef, u16 mo } //PARTNER_MOVE_EFFECT_IS_SAME_NO_TARGET -bool32 PartnerHasSameMoveEffectWithoutTarget(u8 battlerAtkPartner, u16 move, u16 partnerMove) +bool32 PartnerHasSameMoveEffectWithoutTarget(u32 battlerAtkPartner, u32 move, u32 partnerMove) { if (!IsDoubleBattle()) return FALSE; @@ -3253,7 +3209,7 @@ bool32 PartnerHasSameMoveEffectWithoutTarget(u8 battlerAtkPartner, u16 move, u16 } //PARTNER_MOVE_EFFECT_IS_STATUS_SAME_TARGET -bool32 PartnerMoveEffectIsStatusSameTarget(u8 battlerAtkPartner, u8 battlerDef, u16 partnerMove) +bool32 PartnerMoveEffectIsStatusSameTarget(u32 battlerAtkPartner, u32 battlerDef, u32 partnerMove) { if (!IsDoubleBattle()) return FALSE; @@ -3271,7 +3227,7 @@ bool32 PartnerMoveEffectIsStatusSameTarget(u8 battlerAtkPartner, u8 battlerDef, } //PARTNER_MOVE_EFFECT_IS_WEATHER -bool32 PartnerMoveEffectIsWeather(u8 battlerAtkPartner, u16 partnerMove) +bool32 PartnerMoveEffectIsWeather(u32 battlerAtkPartner, u32 partnerMove) { if (!IsDoubleBattle()) return FALSE; @@ -3288,7 +3244,7 @@ bool32 PartnerMoveEffectIsWeather(u8 battlerAtkPartner, u16 partnerMove) } //PARTNER_MOVE_EFFECT_IS_TERRAIN -bool32 PartnerMoveEffectIsTerrain(u8 battlerAtkPartner, u16 partnerMove) +bool32 PartnerMoveEffectIsTerrain(u32 battlerAtkPartner, u32 partnerMove) { if (!IsDoubleBattle()) return FALSE; @@ -3304,7 +3260,7 @@ bool32 PartnerMoveEffectIsTerrain(u8 battlerAtkPartner, u16 partnerMove) } //PARTNER_MOVE_IS_TAILWIND_TRICKROOM -bool32 PartnerMoveIs(u8 battlerAtkPartner, u16 partnerMove, u16 moveCheck) +bool32 PartnerMoveIs(u32 battlerAtkPartner, u32 partnerMove, u32 moveCheck) { if (!IsDoubleBattle()) return FALSE; @@ -3315,7 +3271,7 @@ bool32 PartnerMoveIs(u8 battlerAtkPartner, u16 partnerMove, u16 moveCheck) } //PARTNER_MOVE_IS_SAME -bool32 PartnerMoveIsSameAsAttacker(u8 battlerAtkPartner, u8 battlerDef, u16 move, u16 partnerMove) +bool32 PartnerMoveIsSameAsAttacker(u32 battlerAtkPartner, u32 battlerDef, u32 move, u32 partnerMove) { if (!IsDoubleBattle()) return FALSE; @@ -3326,7 +3282,7 @@ bool32 PartnerMoveIsSameAsAttacker(u8 battlerAtkPartner, u8 battlerDef, u16 move } //PARTNER_MOVE_IS_SAME_NO_TARGET -bool32 PartnerMoveIsSameNoTarget(u8 battlerAtkPartner, u16 move, u16 partnerMove) +bool32 PartnerMoveIsSameNoTarget(u32 battlerAtkPartner, u32 move, u32 partnerMove) { if (!IsDoubleBattle()) return FALSE; @@ -3335,7 +3291,7 @@ bool32 PartnerMoveIsSameNoTarget(u8 battlerAtkPartner, u16 move, u16 partnerMove return FALSE; } -bool32 ShouldUseWishAromatherapy(u8 battlerAtk, u8 battlerDef, u16 move) +bool32 ShouldUseWishAromatherapy(u32 battlerAtk, u32 battlerDef, u32 move) { u32 i; u32 firstId, lastId; @@ -3345,7 +3301,7 @@ bool32 ShouldUseWishAromatherapy(u8 battlerAtk, u8 battlerDef, u16 move) GetAIPartyIndexes(battlerAtk, &firstId, &lastId); - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) + if (GetBattlerSide(battlerAtk) == B_SIDE_PLAYER) party = gPlayerParty; else party = gEnemyParty; @@ -3356,8 +3312,8 @@ bool32 ShouldUseWishAromatherapy(u8 battlerAtk, u8 battlerDef, u16 move) for (i = 0; i < PARTY_SIZE; i++) { - u16 currHp = GetMonData(&party[i], MON_DATA_HP); - u16 maxHp = GetMonData(&party[i], MON_DATA_MAX_HP); + u32 currHp = GetMonData(&party[i], MON_DATA_HP); + u32 maxHp = GetMonData(&party[i], MON_DATA_MAX_HP); if (!GetMonData(&party[i], MON_DATA_IS_EGG, NULL) && currHp > 0) { @@ -3403,29 +3359,53 @@ bool32 ShouldUseWishAromatherapy(u8 battlerAtk, u8 battlerDef, u16 move) return FALSE; } +#define SIZE_G_BATTLE_MONS (sizeof(struct BattlePokemon) * MAX_BATTLERS_COUNT) + +struct BattlePokemon *AllocSaveBattleMons(void) +{ + struct BattlePokemon *savedBattleMons = Alloc(SIZE_G_BATTLE_MONS); + memcpy(savedBattleMons, gBattleMons, SIZE_G_BATTLE_MONS); + return savedBattleMons; +} + +void FreeRestoreBattleMons(struct BattlePokemon *savedBattleMons) +{ + memcpy(gBattleMons, savedBattleMons, SIZE_G_BATTLE_MONS); + Free(savedBattleMons); +} + // party logic -s32 AI_CalcPartyMonDamage(u16 move, u8 battlerAtk, u8 battlerDef, struct Pokemon *mon) +s32 AI_CalcPartyMonBestMoveDamage(u32 battlerAtk, u32 battlerDef, struct Pokemon *attackerMon, struct Pokemon *targetMon) { - s32 dmg; - u32 i; + s32 i, move, bestDmg, dmg; u8 effectiveness; - struct BattlePokemon *battleMons = Alloc(sizeof(struct BattlePokemon) * MAX_BATTLERS_COUNT); - - for (i = 0; i < MAX_BATTLERS_COUNT; i++) - battleMons[i] = gBattleMons[i]; + struct BattlePokemon *savedBattleMons = AllocSaveBattleMons(); - PokemonToBattleMon(mon, &gBattleMons[battlerAtk]); - dmg = AI_CalcDamage(move, battlerAtk, battlerDef, &effectiveness, FALSE); + if (attackerMon != NULL) + PokemonToBattleMon(attackerMon, &gBattleMons[battlerAtk]); + if (targetMon != NULL) + PokemonToBattleMon(targetMon, &gBattleMons[battlerDef]); - for (i = 0; i < MAX_BATTLERS_COUNT; i++) - gBattleMons[i] = battleMons[i]; + for (bestDmg = 0, i = 0; i < MAX_MON_MOVES; i++) + { + if (BattlerHasAi(battlerAtk)) + move = GetMonData(attackerMon, MON_DATA_MOVE1 + i); + else + move = AI_PARTY->mons[GetBattlerSide(battlerAtk)][gBattlerPartyIndexes[battlerAtk]].moves[i]; - Free(battleMons); + if (move != MOVE_NONE && gBattleMoves[move].power != 0) + { + dmg = AI_CalcDamageSaveBattlers(move, battlerAtk, battlerDef, &effectiveness, FALSE); + if (dmg > bestDmg) + bestDmg = dmg; + } + } + FreeRestoreBattleMons(savedBattleMons); return dmg; } -s32 CountUsablePartyMons(u8 battlerId) +s32 CountUsablePartyMons(u32 battlerId) { s32 battlerOnField1, battlerOnField2, i, ret; struct Pokemon *party; @@ -3461,7 +3441,7 @@ s32 CountUsablePartyMons(u8 battlerId) return ret; } -bool32 IsPartyFullyHealedExceptBattler(u8 battlerId) +bool32 IsPartyFullyHealedExceptBattler(u32 battlerId) { struct Pokemon *party; u32 i; @@ -3483,9 +3463,9 @@ bool32 IsPartyFullyHealedExceptBattler(u8 battlerId) return TRUE; } -bool32 PartyHasMoveSplit(u8 battlerId, u8 split) +bool32 PartyHasMoveSplit(u32 battlerId, u32 split) { - u8 firstId, lastId; + u32 firstId, lastId; struct Pokemon *party = GetBattlerParty(battlerId); u32 i, j; @@ -3496,8 +3476,8 @@ bool32 PartyHasMoveSplit(u8 battlerId, u8 split) for (j = 0; j < MAX_MON_MOVES; j++) { - u16 move = GetMonData(&party[i], MON_DATA_MOVE1 + j, NULL); - u16 pp = GetMonData(&party[i], MON_DATA_PP1 + j, NULL); + u32 move = GetMonData(&party[i], MON_DATA_MOVE1 + j, NULL); + u32 pp = GetMonData(&party[i], MON_DATA_PP1 + j, NULL); if (pp > 0 && move != MOVE_NONE) { @@ -3511,7 +3491,7 @@ bool32 PartyHasMoveSplit(u8 battlerId, u8 split) return FALSE; } -bool32 SideHasMoveSplit(u8 battlerId, u8 split) +bool32 SideHasMoveSplit(u32 battlerId, u32 split) { if (IsDoubleBattle()) { @@ -3526,14 +3506,14 @@ bool32 SideHasMoveSplit(u8 battlerId, u8 split) return FALSE; } -bool32 IsAbilityOfRating(u16 ability, s8 rating) +bool32 IsAbilityOfRating(u32 ability, s8 rating) { if (sAiAbilityRatings[ability] >= rating) return TRUE; return FALSE; } -s8 GetAbilityRating(u16 ability) +s8 GetAbilityRating(u32 ability) { return sAiAbilityRatings[ability]; } @@ -3552,7 +3532,7 @@ static const u16 sRecycleEncouragedItems[] = }; // Its assumed that the berry is strategically given, so no need to check benefits of the berry -bool32 IsStatBoostingBerry(u16 item) +bool32 IsStatBoostingBerry(u32 item) { switch (item) { @@ -3570,7 +3550,7 @@ bool32 IsStatBoostingBerry(u16 item) } } -bool32 ShouldRestoreHpBerry(u8 battlerAtk, u16 item) +bool32 ShouldRestoreHpBerry(u32 battlerAtk, u32 item) { switch (item) { @@ -3590,7 +3570,7 @@ bool32 ShouldRestoreHpBerry(u8 battlerAtk, u16 item) } } -bool32 IsRecycleEncouragedItem(u16 item) +bool32 IsRecycleEncouragedItem(u32 item) { u32 i; for (i = 0; i < ARRAY_COUNT(sRecycleEncouragedItems); i++) @@ -3604,7 +3584,7 @@ bool32 IsRecycleEncouragedItem(u16 item) // score increases #define STAT_UP_2_STAGE 8 #define STAT_UP_STAGE 10 -void IncreaseStatUpScore(u8 battlerAtk, u8 battlerDef, u8 statId, s16 *score) +void IncreaseStatUpScore(u32 battlerAtk, u32 battlerDef, u32 statId, s32 *score) { if (AI_DATA->abilities[battlerAtk] == ABILITY_CONTRARY) return; @@ -3639,7 +3619,7 @@ void IncreaseStatUpScore(u8 battlerAtk, u8 battlerDef, u8 statId, s16 *score) } break; case STAT_SPEED: - if (!WillAIStrikeFirst()) + if (!AI_STRIKES_FIRST(battlerAtk, battlerDef, AI_THINKING_STRUCT->moveConsidered)) { if (gBattleMons[battlerAtk].statStages[STAT_SPEED] < STAT_UP_2_STAGE) *score += 2; @@ -3684,9 +3664,10 @@ void IncreaseStatUpScore(u8 battlerAtk, u8 battlerDef, u8 statId, s16 *score) } } -void IncreasePoisonScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score) +void IncreasePoisonScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score) { - if ((AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) + if (((AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) + || AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_CURE_PSN || AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_CURE_STATUS) return; if (AI_CanPoison(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], move, AI_DATA->partnerMove) && AI_DATA->hpPercents[battlerDef] > 20) @@ -3707,9 +3688,10 @@ void IncreasePoisonScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score) } } -void IncreaseBurnScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score) +void IncreaseBurnScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score) { - if ((AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) + if (((AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) + || AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_CURE_BRN || AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_CURE_STATUS) return; if (AI_CanBurn(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) @@ -3726,15 +3708,16 @@ void IncreaseBurnScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score) } } -void IncreaseParalyzeScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score) +void IncreaseParalyzeScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score) { - if ((AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) + if (((AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) + || AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_CURE_PAR || AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_CURE_STATUS) return; if (AI_CanParalyze(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], move, AI_DATA->partnerMove)) { - u8 atkSpeed = GetBattlerTotalSpeedStat(battlerAtk); - u8 defSpeed = GetBattlerTotalSpeedStat(battlerDef); + u32 atkSpeed = AI_DATA->speedStats[battlerAtk]; + u32 defSpeed = AI_DATA->speedStats[battlerDef]; if ((defSpeed >= atkSpeed && defSpeed / 2 < atkSpeed) // You'll go first after paralyzing foe || HasMoveEffect(battlerAtk, EFFECT_HEX) @@ -3747,9 +3730,10 @@ void IncreaseParalyzeScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score) } } -void IncreaseSleepScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score) +void IncreaseSleepScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score) { - if ((AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) + if (((AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) + || AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_CURE_SLP || AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_CURE_STATUS) return; if (AI_CanPutToSleep(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], move, AI_DATA->partnerMove)) @@ -3765,9 +3749,10 @@ void IncreaseSleepScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score) (*score)++; } -void IncreaseConfusionScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score) +void IncreaseConfusionScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score) { - if ((AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) + if (((AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) + || AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_CURE_CONFUSION || AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_CURE_STATUS) return; if (AI_CanConfuse(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove) @@ -3783,7 +3768,7 @@ void IncreaseConfusionScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score) } } -void IncreaseFrostbiteScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score) +void IncreaseFrostbiteScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score) { if ((AI_THINKING_STRUCT->aiFlags & AI_FLAG_TRY_TO_FAINT) && CanAIFaintTarget(battlerAtk, battlerDef, 0)) return; @@ -3802,9 +3787,9 @@ void IncreaseFrostbiteScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score) } } -bool32 AI_MoveMakesContact(u32 ability, u32 holdEffect, u16 move) +bool32 AI_MoveMakesContact(u32 ability, u32 holdEffect, u32 move) { - if (TestMoveFlags(move, FLAG_MAKES_CONTACT) + if (gBattleMoves[move].makesContact && ability != ABILITY_LONG_REACH && holdEffect != HOLD_EFFECT_PROTECTIVE_PADS) return TRUE; @@ -3812,7 +3797,7 @@ bool32 AI_MoveMakesContact(u32 ability, u32 holdEffect, u16 move) } //TODO - this could use some more sophisticated logic -bool32 ShouldUseZMove(u8 battlerAtk, u8 battlerDef, u16 chosenMove) +bool32 ShouldUseZMove(u32 battlerAtk, u32 battlerDef, u32 chosenMove) { // simple logic. just upgrades chosen move to z move if possible, unless regular move would kill opponent if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && battlerDef == BATTLE_PARTNER(battlerAtk)) @@ -3834,7 +3819,7 @@ bool32 ShouldUseZMove(u8 battlerAtk, u8 battlerDef, u16 chosenMove) else if (!IS_MOVE_STATUS(chosenMove) && IS_MOVE_STATUS(gBattleStruct->zmove.chosenZMove)) return FALSE; - if (!IS_MOVE_STATUS(chosenMove) && AI_CalcDamage(chosenMove, battlerAtk, battlerDef, &effectiveness, FALSE) >= gBattleMons[battlerDef].hp) + if (!IS_MOVE_STATUS(chosenMove) && AI_CalcDamageSaveBattlers(chosenMove, battlerAtk, battlerDef, &effectiveness, FALSE) >= gBattleMons[battlerDef].hp) return FALSE; // don't waste damaging z move if can otherwise faint target return TRUE; @@ -3843,7 +3828,7 @@ bool32 ShouldUseZMove(u8 battlerAtk, u8 battlerDef, u16 chosenMove) return FALSE; } -bool32 AI_IsBattlerAsleepOrComatose(u8 battlerId) +bool32 AI_IsBattlerAsleepOrComatose(u32 battlerId) { return (gBattleMons[battlerId].status1 & STATUS1_SLEEP) || AI_DATA->abilities[battlerId] == ABILITY_COMATOSE; } diff --git a/src/battle_anim.c b/src/battle_anim.c index 5691e21e2a2a..9d0c9d77add2 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -216,7 +216,7 @@ void DoMoveAnim(u16 move) // Make sure the anim target of moves hitting everyone is at the opposite side. if (GetBattlerMoveTargetType(gBattlerAttacker, move) & MOVE_TARGET_FOES_AND_ALLY && IsDoubleBattle()) { - while (GET_BATTLER_SIDE(gBattleAnimAttacker) == GET_BATTLER_SIDE(gBattleAnimTarget)) + while (GetBattlerSide(gBattleAnimAttacker) == GetBattlerSide(gBattleAnimTarget)) { if (++gBattleAnimTarget >= MAX_BATTLERS_COUNT) gBattleAnimTarget = 0; @@ -275,6 +275,7 @@ void LaunchBattleAnimation(u32 animType, u32 animId) case B_ANIM_WISH_HEAL: case B_ANIM_MEGA_EVOLUTION: case B_ANIM_PRIMAL_REVERSION: + case B_ANIM_ULTRA_BURST: case B_ANIM_GULP_MISSILE: sAnimHideHpBoxes = TRUE; break; @@ -434,32 +435,27 @@ static void Cmd_unloadspritegfx(void) static u8 GetBattleAnimMoveTargets(u8 battlerArgIndex, u8 *targets) { - u8 numTargets = 1; + u8 numTargets = 0; + int idx = 0; + u32 battler = gBattleAnimArgs[battlerArgIndex]; switch (GetBattlerMoveTargetType(gBattleAnimAttacker, gAnimMoveIndex)) { - case MOVE_TARGET_BOTH: - targets[0] = gBattleAnimArgs[battlerArgIndex]; - numTargets = 1; - if (IsBattlerAlive(BATTLE_PARTNER(targets[0]))) - { - targets[1] = BATTLE_PARTNER(targets[0]); - numTargets = 2; - } - break; case MOVE_TARGET_FOES_AND_ALLY: - targets[0] = gBattleAnimArgs[battlerArgIndex]; - numTargets = 1; - if (IsBattlerAlive(BATTLE_PARTNER(targets[0]))) - { - targets[1] = BATTLE_PARTNER(targets[0]); + if (IS_ALIVE_AND_PRESENT(BATTLE_PARTNER(BATTLE_OPPOSITE(battler)))) { + targets[idx++] = BATTLE_PARTNER(BATTLE_OPPOSITE(battler)); numTargets++; } - - if (IsBattlerAlive(BATTLE_PARTNER(BATTLE_OPPOSITE(targets[0])))) - { - targets[2] = BATTLE_PARTNER(BATTLE_OPPOSITE(targets[0])); + // fallthrough + case MOVE_TARGET_BOTH: + if (IS_ALIVE_AND_PRESENT(battler)) { + targets[idx++] = battler; numTargets++; } + battler = BATTLE_PARTNER(battler); + if (IS_ALIVE_AND_PRESENT(battler)) { + targets[idx++] = battler; + numTargets++; + } break; default: targets[0] = gBattleAnimArgs[battlerArgIndex]; // original @@ -550,7 +546,9 @@ static void CreateSpriteOnTargets(const struct SpriteTemplate *template, u8 argV subpriority = GetSubpriorityForMoveAnim(argVar); ntargets = GetBattleAnimMoveTargets(battlerArgIndex, targets); - + if (ntargets == 0) + return; + for (i = 0; i < ntargets; i++) { if (overwriteAnimTgt) @@ -675,7 +673,9 @@ static void Cmd_createvisualtaskontargets(void) } numArgs = GetBattleAnimMoveTargets(battlerArgIndex, targets); - + if (numArgs == 0) + return; + for (i = 0; i < numArgs; i++) { gBattleAnimArgs[battlerArgIndex] = targets[i]; diff --git a/src/battle_anim_dragon.c b/src/battle_anim_dragon.c index 54304732e600..376fb6dd4a5f 100644 --- a/src/battle_anim_dragon.c +++ b/src/battle_anim_dragon.c @@ -5,7 +5,6 @@ #include "trig.h" #include "constants/rgb.h" -static void AnimOutrageFlame(struct Sprite *); static void AnimDragonDanceOrb_Step(struct Sprite *); static void AnimOverheatFlame_Step(struct Sprite *); static void AnimTask_DragonDanceWaver_Step(u8); @@ -316,7 +315,7 @@ static void AnimSpinningDracoMeteor(struct Sprite *sprite) StoreSpriteCallbackInData6(sprite, AnimSpinningDracoMeteorFinish); } -static void AnimOutrageFlame(struct Sprite *sprite) +void AnimOutrageFlame(struct Sprite *sprite) { sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2); sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET); diff --git a/src/battle_anim_effects_1.c b/src/battle_anim_effects_1.c index a9111bce3ad9..4464559ab726 100644 --- a/src/battle_anim_effects_1.c +++ b/src/battle_anim_effects_1.c @@ -97,7 +97,6 @@ static void AnimSlashSlice(struct Sprite *); static void AnimFalseSwipeSlice(struct Sprite *); static void AnimFalseSwipeSlice_Step1(struct Sprite *); static void AnimFalseSwipeSlice_Step2(struct Sprite *); -static void AnimFalseSwipeSlice_Step3(struct Sprite *); static void AnimFalseSwipePositionedSlice(struct Sprite *); static void AnimEndureEnergy_Step(struct Sprite *); static void AnimSharpenSphere(struct Sprite *); @@ -148,6 +147,9 @@ static void AnimGrassKnotStep(struct Sprite *); static void AnimGrassKnot(struct Sprite *); static void AnimWoodHammerSmall(struct Sprite *); static void AnimWoodHammerBig(struct Sprite *); +static void AnimWoodHammerHammer(struct Sprite *); +static void AnimWoodHammerHammer_WaitForPunch(struct Sprite *); +static void AnimWoodHammerHammer_WaitForDestruction(struct Sprite *); static void AnimTask_DoubleTeam_Step(u8); static void AnimDoubleTeam(struct Sprite *); static void AnimNightSlash(struct Sprite *); @@ -1325,10 +1327,10 @@ const struct SpriteTemplate gSilverWindSmallSparkSpriteTemplate = const u16 gMagicalLeafBlendColors[] = { - RGB(31, 0, 0), + RGB_RED, RGB(31, 19, 0), - RGB(31, 31, 0), - RGB(0, 31, 0), + RGB_YELLOW, + RGB_GREEN, RGB(5, 14, 31), RGB(22, 10, 31), RGB(22, 21, 31), @@ -2284,10 +2286,10 @@ const struct SpriteTemplate gWavyMusicNotesSpriteTemplate = const u16 gParticlesColorBlendTable[][6] = { - {ANIM_TAG_MUSIC_NOTES, RGB(31, 31, 31), RGB(31, 26, 28), RGB(31, 22, 26), RGB(31, 17, 24), RGB(31, 13, 22)}, - {ANIM_TAG_BENT_SPOON, RGB(31, 31, 31), RGB(25, 31, 26), RGB(20, 31, 21), RGB(15, 31, 16), RGB(10, 31, 12)}, - {ANIM_TAG_SPHERE_TO_CUBE, RGB(31, 31, 31), RGB(31, 31, 24), RGB(31, 31, 17), RGB(31, 31, 10), RGB(31, 31, 3)}, - {ANIM_TAG_LARGE_FRESH_EGG, RGB(31, 31, 31), RGB(26, 28, 31), RGB(21, 26, 31), RGB(16, 24, 31), RGB(12, 22, 31)}, + {ANIM_TAG_MUSIC_NOTES, RGB_WHITE, RGB(31, 26, 28), RGB(31, 22, 26), RGB(31, 17, 24), RGB(31, 13, 22)}, + {ANIM_TAG_BENT_SPOON, RGB_WHITE, RGB(25, 31, 26), RGB(20, 31, 21), RGB(15, 31, 16), RGB(10, 31, 12)}, + {ANIM_TAG_SPHERE_TO_CUBE, RGB_WHITE, RGB(31, 31, 24), RGB(31, 31, 17), RGB(31, 31, 10), RGB(31, 31, 3)}, + {ANIM_TAG_LARGE_FRESH_EGG, RGB_WHITE, RGB(26, 28, 31), RGB(21, 26, 31), RGB(16, 24, 31), RGB(12, 22, 31)}, }; const struct SpriteTemplate gFastFlyingMusicNotesSpriteTemplate = @@ -2848,21 +2850,64 @@ const union AffineAnimCmd *const gWoodHammerBigAffineAnims[] = gWoodHammerBigAffineAnimCmd_2, }; +#define WOOD_HAMMER_SCALE_STEP 5 +#define WOOD_HAMMER_CC_ROTATION_STEP 2 +#define WOOD_HAMMER_BACKWARDS_DURATION 40 +#define WOOD_HAMMER_ROTATED_AMOUNT (WOOD_HAMMER_CC_ROTATION_STEP * WOOD_HAMMER_BACKWARDS_DURATION) +#define WOOD_HAMMER_SCALED_AMOUNT (WOOD_HAMMER_SCALE_STEP * WOOD_HAMMER_BACKWARDS_DURATION) + +const union AffineAnimCmd gWoodHammerHammerAffineAnimCmd_BackwardsRotateAndScale[] = +{ + AFFINEANIMCMD_FRAME(WOOD_HAMMER_SCALE_STEP, WOOD_HAMMER_SCALE_STEP, WOOD_HAMMER_CC_ROTATION_STEP, WOOD_HAMMER_BACKWARDS_DURATION), + AFFINEANIMCMD_END +}; + +const union AffineAnimCmd gWoodHammerHammerAffineAnimCmd_BackwardsRotateAndScaleFlipped[] = +{ + AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0), + AFFINEANIMCMD_FRAME(-WOOD_HAMMER_SCALE_STEP, WOOD_HAMMER_SCALE_STEP, -WOOD_HAMMER_CC_ROTATION_STEP, WOOD_HAMMER_BACKWARDS_DURATION), + AFFINEANIMCMD_END +}; + +const union AffineAnimCmd gWoodHammerHammerAffineAnimCmd_PunchClockwise[] = +{ + AFFINEANIMCMD_FRAME(0x100 + WOOD_HAMMER_SCALED_AMOUNT, 0x100 + WOOD_HAMMER_SCALED_AMOUNT, WOOD_HAMMER_ROTATED_AMOUNT, 0), + AFFINEANIMCMD_FRAME(0, 0, -16, 7), + AFFINEANIMCMD_END +}; + +const union AffineAnimCmd gWoodHammerHammerAffineAnimCmd_PunchCounterClockwise[] = +{ + AFFINEANIMCMD_FRAME(-0x100 - WOOD_HAMMER_SCALED_AMOUNT, 0x100 + WOOD_HAMMER_SCALED_AMOUNT, -WOOD_HAMMER_ROTATED_AMOUNT, 0), + AFFINEANIMCMD_FRAME(0, 0, 16, 7), + AFFINEANIMCMD_END +}; + +// Animations 0, 2 are for the player side attacking +// Animations 1, 3 are for the opponent side attacking (flipped) +const union AffineAnimCmd *const gWoodHammerHammerAffineAnims[] = +{ + gWoodHammerHammerAffineAnimCmd_BackwardsRotateAndScale, + gWoodHammerHammerAffineAnimCmd_BackwardsRotateAndScaleFlipped, + gWoodHammerHammerAffineAnimCmd_PunchClockwise, + gWoodHammerHammerAffineAnimCmd_PunchCounterClockwise, +}; + const union AnimCmd gWoodHammerSmallAnimCmd_1[] = { - ANIMCMD_FRAME(32, 1), + ANIMCMD_FRAME(48, 1), ANIMCMD_END, }; const union AnimCmd gWoodHammerSmallAnimCmd_2[] = { - ANIMCMD_FRAME(48, 1), + ANIMCMD_FRAME(64, 1), ANIMCMD_END, }; const union AnimCmd gWoodHammerSmallAnimCmd_3[] = { - ANIMCMD_FRAME(64, 1), + ANIMCMD_FRAME(80, 1), ANIMCMD_END, }; @@ -2906,6 +2951,17 @@ const struct SpriteTemplate gWoodHammerSmallSpriteTemplate = .callback = AnimWoodHammerSmall, }; +const struct SpriteTemplate gWoodHammerHammerSpriteTemplate = +{ + .tileTag = ANIM_TAG_WOOD_HAMMER_HAMMER, + .paletteTag = ANIM_TAG_WOOD_HAMMER_HAMMER, + .oam = &gOamData_AffineDouble_ObjNormal_64x64, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gWoodHammerHammerAffineAnims, + .callback = AnimWoodHammerHammer, +}; + const struct SpriteTemplate gJudgmentGrayOutwardSpikesTemplate = { .tileTag = ANIM_TAG_GREEN_SPIKE, @@ -3023,6 +3079,65 @@ static void AnimWoodHammerSmall(struct Sprite *sprite) StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix); } +#define HAMMER_X_OFFSET 40 +#define HAMMER_PUNCH_WAIT_FRAMES 37 + +static void AnimWoodHammerHammer(struct Sprite *sprite) +{ + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + { + sprite->x += HAMMER_X_OFFSET; + StartSpriteAffineAnim(sprite, 1); + } + else + { + sprite->x -= HAMMER_X_OFFSET; + StartSpriteAffineAnim(sprite, 0); + } + sprite->data[6] = HAMMER_PUNCH_WAIT_FRAMES; + sprite->callback = AnimWoodHammerHammer_WaitForPunch; +} + +static void AnimWoodHammerHammer_WaitForPunch(struct Sprite *sprite) +{ + if (!sprite->affineAnimEnded) + return; + + if (sprite->data[6] != 0) + { + sprite->data[6]--; + if (sprite->data[6] & 1) + { + if ((sprite->data[6] / 2) & 1) + sprite->x2++; + else + sprite->x2--; + } + return; + } + + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + { + StartSpriteAffineAnim(sprite, 3); + } + else + { + StartSpriteAffineAnim(sprite, 2); + } + sprite->callback = AnimWoodHammerHammer_WaitForDestruction; +} + +static void AnimWoodHammerHammer_WaitForDestruction(struct Sprite *sprite) +{ + if (sprite->affineAnimEnded) + { + DestroySpriteAndMatrix(sprite); + } +} + +#undef HAMMER_X_OFFSET +#undef HAMMER_PUNCH_WAIT_FRAMES + // Animates the falling particles that horizontally wave back and forth. // Used by Sleep Powder, Stun Spore, and Poison Powder. // arg 0: initial x pixel offset @@ -4717,13 +4832,13 @@ static void AnimFlyingParticle(struct Sprite *sprite) { sprite->data[4] = 0; sprite->data[2] = gBattleAnimArgs[3]; - sprite->x = 0xFFF0; + sprite->x = -16; } else { sprite->data[4] = 1; sprite->data[2] = -gBattleAnimArgs[3]; - sprite->x = 0x100; + sprite->x = DISPLAY_WIDTH + 16; } sprite->data[1] = gBattleAnimArgs[1]; @@ -4762,7 +4877,7 @@ static void AnimFlyingParticle_Step(struct Sprite *sprite) sprite->data[0] = (sprite->data[3] * a) & 0xFF; if (!sprite->data[4]) { - if (sprite->x2 + sprite->x <= 0xF7) + if (sprite->x2 + sprite->x < DISPLAY_WIDTH + 8) return; } else @@ -5496,7 +5611,7 @@ static void AnimLockOnTarget_Step4(struct Sprite *sprite) sprite->data[1] = 0; } - BlendPalettes(GetBattlePalettesMask(TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE), sprite->data[1], RGB(31, 31, 31)); + BlendPalettes(GetBattlePalettesMask(TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE), sprite->data[1], RGB_WHITE); if (sprite->data[1] == 16) { int pal; @@ -5914,7 +6029,7 @@ static void AnimFalseSwipeSlice_Step2(struct Sprite *sprite) sprite->callback = AnimFalseSwipeSlice_Step3; } -static void AnimFalseSwipeSlice_Step3(struct Sprite *sprite) +void AnimFalseSwipeSlice_Step3(struct Sprite *sprite) { if (++sprite->data[0] > 1) { @@ -6331,7 +6446,7 @@ void AnimTask_DoubleTeam(u8 taskId) for (i = 1; i < 16; i++) gPlttBufferUnfaded[r3 + i] = gPlttBufferUnfaded[r4 + i]; - BlendPalette(r3, 16, 11, RGB(0, 0, 0)); + BlendPalette(r3, 16, 11, RGB_BLACK); task->data[3] = 0; i = 0; while (i < 2 && (obj = CloneBattlerSpriteWithBlend(0)) >= 0) diff --git a/src/battle_anim_effects_2.c b/src/battle_anim_effects_2.c index b3aedb300cb4..cd7f4221bae9 100755 --- a/src/battle_anim_effects_2.c +++ b/src/battle_anim_effects_2.c @@ -15,6 +15,7 @@ #include "util.h" #include "constants/rgb.h" #include "constants/songs.h" +#include "constants/moves.h" static void AnimCirclingFinger(struct Sprite *); static void AnimBouncingMusicNote(struct Sprite *); @@ -1703,7 +1704,7 @@ void AnimTask_AirCutterProjectile(u8 taskId) } else { - if (GET_BATTLER_SIDE2(gBattleAnimTarget) == B_SIDE_PLAYER) + if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER) { gTasks[taskId].data[4] = 1; gBattleAnimArgs[0] = -gBattleAnimArgs[0]; @@ -3150,7 +3151,7 @@ static void AnimTask_FakeOut_Step2(u8 taskId) { gTasks[taskId].data[11] = 0x88; SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG3 | BLDCNT_EFFECT_LIGHTEN); - BlendPalettes(GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE), 16, RGB(31, 31, 31)); + BlendPalettes(GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE), 16, RGB_WHITE); } else if (gTasks[taskId].data[10] > 4) { @@ -3358,6 +3359,12 @@ static void AnimTask_HeartsBackground_Step(u8 taskId) void AnimTask_ScaryFace(u8 taskId) { struct BattleAnimBgData animBg; + bool32 onPlayer; + + if (gAnimMoveIndex == MOVE_BITTER_MALICE) + onPlayer = GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER; + else + onPlayer = GetBattlerSide(gBattleAnimTarget) == B_SIDE_OPPONENT; SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_TGT1_BG1 | BLDCNT_EFFECT_BLEND); SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16)); @@ -3373,7 +3380,7 @@ void AnimTask_ScaryFace(u8 taskId) GetBattleAnimBg1Data(&animBg); if (IsContest()) AnimLoadCompressedBgTilemapHandleContest(&animBg, &gBattleAnimBgTilemap_ScaryFaceContest, FALSE); - else if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_OPPONENT) + else if (onPlayer) AnimLoadCompressedBgTilemapHandleContest(&animBg, &gBattleAnimBgTilemap_ScaryFacePlayer, FALSE); else AnimLoadCompressedBgTilemapHandleContest(&animBg, &gBattleAnimBgTilemap_ScaryFaceOpponent, FALSE); diff --git a/src/battle_anim_effects_3.c b/src/battle_anim_effects_3.c index 513a992fe08e..82653c1406ea 100755 --- a/src/battle_anim_effects_3.c +++ b/src/battle_anim_effects_3.c @@ -69,7 +69,6 @@ static void AnimFlatterSpotlight(struct Sprite *); static void AnimReversalOrb_Step(struct Sprite *); static void AnimYawnCloud(struct Sprite *); static void AnimYawnCloud_Step(struct Sprite *); -static void AnimSmokeBallEscapeCloud(struct Sprite *); static void AnimFacadeSweatDrop(struct Sprite *); static void AnimRoarNoiseLine(struct Sprite *); static void AnimRoarNoiseLine_Step(struct Sprite *); @@ -87,7 +86,6 @@ static void AnimMeteorMashStar_Step(struct Sprite *sprite); static void AnimBlockX_Step(struct Sprite *); static void AnimUnusedItemBagSteal(struct Sprite *); static void AnimKnockOffStrike(struct Sprite *); -static void AnimKnockOffStrike_Step(struct Sprite *sprite); static void AnimRecycle(struct Sprite *); static void AnimRecycle_Step(struct Sprite *); static void SetPsychicBackground_Step(u8); @@ -2351,7 +2349,6 @@ void AnimTask_TransformMon(u8 taskId) gTasks[taskId].data[10] = gBattleAnimArgs[0]; gTasks[taskId].data[11] = gBattleAnimArgs[1]; - gTasks[taskId].data[12] = gBattleAnimArgs[2]; gTasks[taskId].data[0]++; break; case 1: @@ -2366,7 +2363,7 @@ void AnimTask_TransformMon(u8 taskId) } break; case 2: - HandleSpeciesGfxDataChange(gBattleAnimAttacker, gBattleAnimTarget, gTasks[taskId].data[10], gTasks[taskId].data[11], gTasks[taskId].data[12]); + HandleSpeciesGfxDataChange(gBattleAnimAttacker, gBattleAnimTarget, gTasks[taskId].data[10], gTasks[taskId].data[11]); GetBgDataForTransform(&animBg, gBattleAnimAttacker); if (IsContest()) @@ -2374,7 +2371,7 @@ void AnimTask_TransformMon(u8 taskId) else position = GetBattlerPosition(gBattleAnimAttacker); - src = gMonSpritesGfxPtr->sprites.ptr[position] + (gBattleMonForms[gBattleAnimAttacker] << 11); + src = gMonSpritesGfxPtr->sprites.ptr[position]; dest = animBg.bgTiles; CpuCopy32(src, dest, MON_PIC_SIZE); LoadBgTiles(1, animBg.bgTiles, 0x800, animBg.tilesOffset); @@ -2451,12 +2448,6 @@ void AnimTask_IsMonInvisible(u8 taskId) DestroyAnimVisualTask(taskId); } -void AnimTask_CastformGfxDataChange(u8 taskId) -{ - HandleSpeciesGfxDataChange(gBattleAnimAttacker, gBattleAnimTarget, TRUE, FALSE, FALSE); - DestroyAnimVisualTask(taskId); -} - void AnimTask_MorningSunLightBeam(u8 taskId) { struct BattleAnimBgData animBg; @@ -3140,7 +3131,7 @@ static void AnimFlatterConfetti(struct Sprite *sprite) if (sprite->data[2] == ANIM_ATTACKER) sprite->x = -8; else - sprite->x = 248; + sprite->x = DISPLAY_WIDTH + 8; sprite->y = 104; sprite->callback = AnimFlatterConfetti_Step; @@ -3498,8 +3489,8 @@ static void AnimTask_AcidArmor_Step(u8 taskId) var0 *= 2; while (var0 >= 0) { - gScanlineEffectRegBuffers[0][var0] = bgX + 240; - gScanlineEffectRegBuffers[1][var0] = bgX + 240; + gScanlineEffectRegBuffers[0][var0] = bgX + DISPLAY_WIDTH; + gScanlineEffectRegBuffers[1][var0] = bgX + DISPLAY_WIDTH; var0 -= 2; } @@ -3652,7 +3643,7 @@ static void AnimYawnCloud_Step(struct Sprite *sprite) // arg 1: initial x pixel offset // arg 2: initial y pixel offset // arg 3: time until destroyed -static void AnimSmokeBallEscapeCloud(struct Sprite *sprite) +void AnimSmokeBallEscapeCloud(struct Sprite *sprite) { sprite->data[0] = gBattleAnimArgs[3]; StartSpriteAffineAnim(sprite, gBattleAnimArgs[0]); @@ -3980,7 +3971,7 @@ static void AnimTask_FacadeColorBlend_Step(u8 taskId) } else { - BlendPalette(gTasks[taskId].data[2], 16, 0, RGB(0, 0, 0)); + BlendPalette(gTasks[taskId].data[2], 16, 0, RGB_BLACK); DestroyAnimVisualTask(taskId); } } @@ -5469,7 +5460,7 @@ static void AnimTask_TeeterDanceMovement_Step(u8 taskId) } } -static void AnimKnockOffStrike_Step(struct Sprite *sprite) +void AnimKnockOffStrike_Step(struct Sprite *sprite) { // These two cases are identical. if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER) diff --git a/src/battle_anim_electric.c b/src/battle_anim_electric.c index aee824b39c91..415f112d30c2 100644 --- a/src/battle_anim_electric.c +++ b/src/battle_anim_electric.c @@ -874,7 +874,7 @@ void AnimThunderWave(struct Sprite *sprite) sprite->x += gBattleAnimArgs[0]; sprite->y += gBattleAnimArgs[1]; - if (gAnimMoveIndex == MOVE_THUNDER_WAVE) + if (gAnimMoveIndex != MOVE_ANCHOR_SHOT) spriteId = CreateSprite(&gThunderWaveSpriteTemplate, sprite->x + 32, sprite->y, sprite->subpriority); else spriteId = CreateSprite(&gAnchorShotChainTemplate, sprite->x + 32, sprite->y, sprite->subpriority); diff --git a/src/battle_anim_fight.c b/src/battle_anim_fight.c index 9ffe2d3c22ca..90bd9391e3fe 100644 --- a/src/battle_anim_fight.c +++ b/src/battle_anim_fight.c @@ -564,7 +564,7 @@ static void AnimFistOrFootRandomPos(struct Sprite *sprite) if (Random2() & 1) y *= -1; - if (GET_BATTLER_SIDE2(battler) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) y += 0xFFF0; sprite->x += x; diff --git a/src/battle_anim_flying.c b/src/battle_anim_flying.c index f595de962c4c..8dd5a7ff7f9f 100644 --- a/src/battle_anim_flying.c +++ b/src/battle_anim_flying.c @@ -157,7 +157,7 @@ static const union AnimCmd sAnim_FallingFeather_1[] = ANIMCMD_END, }; -static const union AnimCmd *const sAnims_FallingFeather[] = +const union AnimCmd *const gAnims_FallingFeather[] = { sAnim_FallingFeather_0, sAnim_FallingFeather_1, @@ -168,7 +168,7 @@ const struct SpriteTemplate gFallingFeatherSpriteTemplate = .tileTag = ANIM_TAG_WHITE_FEATHER, .paletteTag = ANIM_TAG_WHITE_FEATHER, .oam = &gOamData_AffineNormal_ObjNormal_32x32, - .anims = sAnims_FallingFeather, + .anims = gAnims_FallingFeather, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimFallingFeather, diff --git a/src/battle_anim_ghost.c b/src/battle_anim_ghost.c index 870c83f60886..e49d2411de36 100644 --- a/src/battle_anim_ghost.c +++ b/src/battle_anim_ghost.c @@ -233,7 +233,7 @@ static const union AnimCmd sAnim_GrudgeFlame[] = ANIMCMD_JUMP(0), }; -static const union AnimCmd *const sAnims_GrudgeFlame[] = +const union AnimCmd *const gAnims_GrudgeFlame[] = { sAnim_GrudgeFlame, }; @@ -243,7 +243,7 @@ const struct SpriteTemplate gGrudgeFlameSpriteTemplate = .tileTag = ANIM_TAG_PURPLE_FLAME, .paletteTag = ANIM_TAG_PURPLE_FLAME, .oam = &gOamData_AffineOff_ObjBlend_16x32, - .anims = sAnims_GrudgeFlame, + .anims = gAnims_GrudgeFlame, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimGrudgeFlame, @@ -1080,7 +1080,7 @@ static void AnimTask_CurseStretchingBlackBg_Step1(u8 taskId) top = 0; bottom = 112; selectedPalettes = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE); - BeginNormalPaletteFade(selectedPalettes, 0, 16, 16, RGB(0, 0, 0)); + BeginNormalPaletteFade(selectedPalettes, 0, 16, 16, RGB_BLACK); gTasks[taskId].func = AnimTask_CurseStretchingBlackBg_Step2; } diff --git a/src/battle_anim_ground.c b/src/battle_anim_ground.c index 184107d4885a..a89800492fce 100644 --- a/src/battle_anim_ground.c +++ b/src/battle_anim_ground.c @@ -499,10 +499,10 @@ static void SetDigScanlineEffect(u8 useBG1, s16 y, s16 endY) y++; } - while (y < 160) + while (y < DISPLAY_HEIGHT) { - gScanlineEffectRegBuffers[0][y] = bgX + 240; - gScanlineEffectRegBuffers[1][y] = bgX + 240; + gScanlineEffectRegBuffers[0][y] = bgX + DISPLAY_WIDTH; + gScanlineEffectRegBuffers[1][y] = bgX + DISPLAY_WIDTH; y++; } diff --git a/src/battle_anim_ice.c b/src/battle_anim_ice.c index e6a5607b5aee..41566d04713e 100644 --- a/src/battle_anim_ice.c +++ b/src/battle_anim_ice.c @@ -119,7 +119,7 @@ const union AnimCmd *const gAnims_IceCrystalLarge[] = sAnim_IceCrystalLarge, }; -static const union AnimCmd *const sAnims_IceCrystalSmall[] = +const union AnimCmd *const gAnims_IceCrystalSmall[] = { sAnim_IceCrystalSmall, }; @@ -166,7 +166,7 @@ const struct SpriteTemplate gIceCrystalSpiralInwardSmall = .tileTag = ANIM_TAG_ICE_CRYSTALS, .paletteTag = ANIM_TAG_ICE_CRYSTALS, .oam = &gOamData_AffineOff_ObjBlend_8x8, - .anims = sAnims_IceCrystalSmall, + .anims = gAnims_IceCrystalSmall, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimIcePunchSwirlingParticle, @@ -199,7 +199,7 @@ const struct SpriteTemplate gIceBeamOuterCrystalSpriteTemplate = .tileTag = ANIM_TAG_ICE_CRYSTALS, .paletteTag = ANIM_TAG_ICE_CRYSTALS, .oam = &gOamData_AffineOff_ObjBlend_8x8, - .anims = sAnims_IceCrystalSmall, + .anims = gAnims_IceCrystalSmall, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimIceBeamParticle, @@ -234,7 +234,7 @@ const struct SpriteTemplate gIceCrystalHitSmallSpriteTemplate = .tileTag = ANIM_TAG_ICE_CRYSTALS, .paletteTag = ANIM_TAG_ICE_CRYSTALS, .oam = &gOamData_AffineNormal_ObjBlend_8x8, - .anims = sAnims_IceCrystalSmall, + .anims = gAnims_IceCrystalSmall, .images = NULL, .affineAnims = gAffineAnims_IceCrystalHit, .callback = AnimIceEffectParticle, @@ -515,7 +515,7 @@ const struct SpriteTemplate gIceBallImpactShardSpriteTemplate = .tileTag = ANIM_TAG_ICE_CRYSTALS, .paletteTag = ANIM_TAG_ICE_CRYSTALS, .oam = &gOamData_AffineOff_ObjNormal_8x8, - .anims = sAnims_IceCrystalSmall, + .anims = gAnims_IceCrystalSmall, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = InitIceBallParticle, @@ -1276,12 +1276,12 @@ static void InitPoisonGasCloudAnim(struct Sprite *sprite) if (GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) < GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2)) sprite->data[7] = 0x8000; - if (GET_BATTLER_SIDE2(gBattleAnimTarget) == B_SIDE_PLAYER) + if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER) { gBattleAnimArgs[1] = -gBattleAnimArgs[1]; gBattleAnimArgs[3] = -gBattleAnimArgs[3]; - if ((sprite->data[7] & 0x8000) && GET_BATTLER_SIDE2(gBattleAnimAttacker) == B_SIDE_PLAYER) + if ((sprite->data[7] & 0x8000) && GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) sprite->subpriority = gSprites[GetAnimBattlerSpriteId(ANIM_TARGET)].subpriority + 1; sprite->data[6] = 1; @@ -1362,7 +1362,7 @@ static void MovePoisonGasCloud(struct Sprite *sprite) sprite->data[7]++; if (IsContest()) sprite->data[5] = 80; - else if (GET_BATTLER_SIDE2(gBattleAnimTarget) != B_SIDE_PLAYER) + else if (GetBattlerSide(gBattleAnimTarget) != B_SIDE_PLAYER) sprite->data[5] = 204; else sprite->data[5] = 80; @@ -1407,11 +1407,11 @@ static void MovePoisonGasCloud(struct Sprite *sprite) sprite->data[3] = sprite->y += sprite->y2; sprite->data[4] = sprite->y + 4; if (IsContest()) - sprite->data[2] = -0x10; - else if (GET_BATTLER_SIDE2(gBattleAnimTarget) != B_SIDE_PLAYER) - sprite->data[2] = 0x100; + sprite->data[2] = -16; + else if (GetBattlerSide(gBattleAnimTarget) != B_SIDE_PLAYER) + sprite->data[2] = DISPLAY_WIDTH + 16; else - sprite->data[2] = -0x10; + sprite->data[2] = -16; sprite->data[7]++; sprite->x2 = sprite->y2 = 0; diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index ca338791c15e..4d97cd2c7565 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -52,32 +52,6 @@ const struct UCoords8 sBattlerCoords[][MAX_BATTLERS_COUNT] = }, }; -// One entry for each of the four Castform forms. -const struct MonCoords gCastformFrontSpriteCoords[NUM_CASTFORM_FORMS] = -{ - [CASTFORM_NORMAL] = { .size = MON_COORDS_SIZE(32, 32), .y_offset = 17 }, - [CASTFORM_FIRE] = { .size = MON_COORDS_SIZE(48, 48), .y_offset = 9 }, - [CASTFORM_WATER] = { .size = MON_COORDS_SIZE(32, 48), .y_offset = 9 }, - [CASTFORM_ICE] = { .size = MON_COORDS_SIZE(64, 48), .y_offset = 8 }, -}; - -const u8 sCastformElevations[NUM_CASTFORM_FORMS] = -{ - [CASTFORM_NORMAL] = 13, - [CASTFORM_FIRE] = 14, - [CASTFORM_WATER] = 13, - [CASTFORM_ICE] = 13, -}; - -// Y position of the backsprite for each of the four Castform forms. -static const u8 sCastformBackSpriteYCoords[NUM_CASTFORM_FORMS] = -{ - [CASTFORM_NORMAL] = 0, - [CASTFORM_FIRE] = 0, - [CASTFORM_WATER] = 0, - [CASTFORM_ICE] = 0, -}; - // Placeholders for pokemon sprites to be created for a move animation effect (e.g. Role Play / Snatch) #define TAG_MOVE_EFFECT_MON_1 55125 #define TAG_MOVE_EFFECT_MON_2 55126 @@ -197,10 +171,6 @@ u8 GetBattlerYDelta(u8 battlerId, u16 species) coordSpecies = GetUnownSpeciesId(personality); ret = gMonBackPicCoords[coordSpecies].y_offset; } - else if (species == SPECIES_CASTFORM) - { - ret = sCastformBackSpriteYCoords[gBattleMonForms[battlerId]]; - } else if (species > NUM_SPECIES) { ret = gMonBackPicCoords[0].y_offset; @@ -223,10 +193,6 @@ u8 GetBattlerYDelta(u8 battlerId, u16 species) coordSpecies = GetUnownSpeciesId(personality); ret = gMonFrontPicCoords[coordSpecies].y_offset; } - else if (species == SPECIES_CASTFORM) - { - ret = gCastformFrontSpriteCoords[gBattleMonForms[battlerId]].y_offset; - } else if (species > NUM_SPECIES) { ret = gMonFrontPicCoords[0].y_offset; @@ -246,9 +212,7 @@ u8 GetBattlerElevation(u8 battlerId, u16 species) { if (!IsContest()) { - if (species == SPECIES_CASTFORM) - ret = sCastformElevations[gBattleMonForms[battlerId]]; - else if (species > NUM_SPECIES) + if (species > NUM_SPECIES) ret = gEnemyMonElevation[0]; else ret = gEnemyMonElevation[species]; @@ -881,23 +845,13 @@ bool32 InitSpritePosToAnimBattler(u32 animBattlerId, struct Sprite *sprite, bool return TRUE; } -u8 GetBattlerSide(u8 battlerId) -{ - return GET_BATTLER_SIDE2(battlerId); -} - -u8 GetBattlerPosition(u8 battlerId) -{ - return gBattlerPositions[battlerId]; -} - u8 GetBattlerAtPosition(u8 position) { u8 i; for (i = 0; i < gBattlersCount; i++) { - if (gBattlerPositions[i] == position) + if (GetBattlerPosition(i) == position) break; } return i; @@ -916,7 +870,7 @@ bool8 IsBattlerSpritePresent(u8 battlerId) } else { - if (gBattlerPositions[battlerId] == 0xff) + if (GetBattlerPosition(battlerId) == 0xff) return FALSE; if (!gBattleStruct->spriteIgnore0Hp) @@ -1963,10 +1917,7 @@ static u16 GetBattlerYDeltaFromSpriteId(u8 spriteId) else species = spriteInfo[battlerId].transformSpecies; - if (species == SPECIES_CASTFORM) - return sCastformBackSpriteYCoords[gBattleMonForms[battlerId]]; - else - return gMonBackPicCoords[species].y_offset; + return gMonBackPicCoords[species].y_offset; } else { @@ -1976,10 +1927,7 @@ static u16 GetBattlerYDeltaFromSpriteId(u8 spriteId) else species = spriteInfo[battlerId].transformSpecies; - if (species == SPECIES_CASTFORM) - return sCastformElevations[gBattleMonForms[battlerId]]; - else - return gMonFrontPicCoords[species].y_offset; + return gMonFrontPicCoords[species].y_offset; } } } @@ -2201,10 +2149,6 @@ s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr) species = GetUnownSpeciesId(personality); coords = &gMonBackPicCoords[species]; } - else if (species == SPECIES_CASTFORM) - { - coords = &gCastformFrontSpriteCoords[gBattleMonForms[battlerId]]; - } else if (species <= SPECIES_EGG) { coords = &gMonBackPicCoords[species]; @@ -2263,10 +2207,6 @@ s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr) species = GetUnownSpeciesId(personality); coords = &gMonFrontPicCoords[species]; } - else if (species == SPECIES_CASTFORM) - { - coords = &gCastformFrontSpriteCoords[gBattleMonForms[battlerId]]; - } else if (species > NUM_SPECIES) { coords = &gMonFrontPicCoords[0]; diff --git a/src/battle_anim_new.c b/src/battle_anim_new.c index 715e5b3e26d6..1f04e0169766 100644 --- a/src/battle_anim_new.c +++ b/src/battle_anim_new.c @@ -20,8 +20,10 @@ #include "constants/items.h" #include "constants/pokemon.h" #include "battle_util.h" +#include "constants/songs.h" // function declarations +static void AnimTask_DynamaxGrowthStep(u8 taskId); static void SpriteCB_SpriteToCentreOfSide(struct Sprite *sprite); static void SpriteCB_SpriteOnMonForDuration(struct Sprite *sprite); static void SpriteCB_ToxicThreadWrap(struct Sprite *sprite); @@ -73,6 +75,32 @@ static void AnimOceanicOperettaSpotlight(struct Sprite *sprite); static void AnimSoulStealingStar(struct Sprite *sprite); static void AnimSoulStealingStar_Step1(struct Sprite *sprite); static void AnimSoulStealingStar_Step2(struct Sprite *sprite); +static void SpriteCB_PowerShiftBallStep(struct Sprite *sprite); +static void SpriteCB_PowerShiftBall(struct Sprite* sprite); +static void SpriteCB_HorizontalSliceStep(struct Sprite *sprite); +static void SpriteCB_HorizontalSlice(struct Sprite *sprite); +static void SpriteCB_LashOutStrike(struct Sprite* sprite); +static void AnimTask_TwinkleTackleLaunchStep(u8 taskId); +static void SpriteCB_ShellSmashShell(struct Sprite* sprite); +static void SpriteCB_ShellSmashShell_DestroyDuringFadeOut(struct Sprite* sprite); +static void SpriteCB_AnimSpriteOnTargetSideCentre(struct Sprite *sprite); +static void SpriteCB_SpriteOnMonUntilAffineAnimEnds(struct Sprite* sprite); +static void SpriteCB_MoveSpriteUpwardsForDurationStep(struct Sprite* sprite); +static void SpriteCB_MoveSpriteUpwardsForDuration(struct Sprite* sprite); +static void SpriteCB_SpriteOnMonForDurationUseY(struct Sprite *sprite); +static void SpriteCB_SurgingStrikes(struct Sprite* sprite); +static void SpriteCB_SteelRoller_Down(struct Sprite *sprite); +static void SpriteCB_SteelRoller_LeftRight(struct Sprite* sprite); +static void SpriteCB_SteelRoller(struct Sprite* sprite); +static void SpriteCB_FlippableSlash(struct Sprite* sprite); +static void SpriteCB_DragonEnergyShot(struct Sprite* sprite); +static void SpriteCB_MaxFlutterbyStep1(struct Sprite* sprite); +static void SpriteCB_MaxFlutterbyStep2(struct Sprite* sprite); +static void SpriteCB_MaxFlutterby(struct Sprite* sprite); +static void SpriteCB_GlacialLance_Step1(struct Sprite* sprite); +static void SpriteCB_GlacialLance_Step2(struct Sprite* sprite); +static void SpriteCB_GlacialLance(struct Sprite* sprite); +static void SpriteCB_TripleArrowKick(struct Sprite* sprite); // const data // general @@ -120,7 +148,7 @@ const struct SpriteTemplate gShellSmashLeftShellSpriteTemplate = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gAffineAnims_Bite, - .callback = AnimBite + .callback = SpriteCB_LockingJaw }; const struct SpriteTemplate gShellSmashRightShellSpriteTemplate = @@ -131,7 +159,7 @@ const struct SpriteTemplate gShellSmashRightShellSpriteTemplate = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gAffineAnims_Bite, - .callback = AnimBite + .callback = SpriteCB_LockingJaw }; const struct SpriteTemplate gShellSmashPurpleRocksSpriteTemplate = @@ -4110,137 +4138,101 @@ const struct SpriteTemplate gSteelBeamSpikeShardTemplate = .callback = AnimDirtScatter }; -// Z MOVES -//activate -const struct SpriteTemplate gZMoveSymbolSpriteTemplate = +// skitter smack +const struct SpriteTemplate gSkitterSmackImpactTemplate = { - .tileTag = ANIM_TAG_Z_MOVE_SYMBOL, - .paletteTag = ANIM_TAG_Z_MOVE_SYMBOL, - .oam = &gOamData_AffineNormal_ObjBlend_64x64, + .tileTag = ANIM_TAG_IMPACT, + .paletteTag = ANIM_TAG_RAZOR_LEAF, + .oam = &gOamData_AffineNormal_ObjBlend_32x32, .anims = gDummySpriteAnimTable, .images = NULL, - .affineAnims = gAffineAnims_LusterPurgeCircle, - .callback = AnimSpriteOnMonPos + .affineAnims = gAffineAnims_IceCrystalHit, + .callback = AnimIceEffectParticle }; -const struct SpriteTemplate gBlueZMoveEnergySpriteTemplate = + +// triple axel +const struct SpriteTemplate gTripleAxelIceCrystalSpriteTemplate = { - .tileTag = ANIM_TAG_FOCUS_ENERGY, - .paletteTag = ANIM_TAG_SWEAT_BEAD, - .oam = &gOamData_AffineOff_ObjNormal_16x32, - .anims = gEndureEnergyAnimTable, + .tileTag = ANIM_TAG_ICE_CRYSTALS, + .paletteTag = ANIM_TAG_ICE_CRYSTALS, + .oam = &gOamData_AffineOff_ObjBlend_8x8, + .anims = gAnims_IceCrystalSmall, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = AnimEndureEnergy, + .callback = AnimDizzyPunchDuck }; -const struct SpriteTemplate gGreenZMoveEnergySpriteTemplate = + +// dual wingbeat +static const union AffineAnimCmd sSpriteAffineAnim_WingAttackFeather[] = { - .tileTag = ANIM_TAG_FOCUS_ENERGY, - .paletteTag = ANIM_TAG_WHIP_HIT, - .oam = &gOamData_AffineOff_ObjNormal_16x32, - .anims = gEndureEnergyAnimTable, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = AnimEndureEnergy, + AFFINEANIMCMD_FRAME(0, 0, -1, 14), //Rotate a little right + AFFINEANIMCMD_FRAME(0, 0, 1, 28), //Rotate a little left + AFFINEANIMCMD_END, }; -const struct SpriteTemplate gYellowZMoveEnergySpriteTemplate = +static const union AffineAnimCmd* const sSpriteAffineAnimTable_WingAttackFeather[] = { - .tileTag = ANIM_TAG_FOCUS_ENERGY, - .paletteTag = ANIM_TAG_PAW_PRINT, - .oam = &gOamData_AffineOff_ObjNormal_16x32, - .anims = gEndureEnergyAnimTable, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = AnimEndureEnergy, + sSpriteAffineAnim_WingAttackFeather, }; -// breakneck blitz -const struct SpriteTemplate gBreakneckBlitzDanceSpriteTemplate = +const struct SpriteTemplate gDualWingbeatFeatherSpriteTemplate = { - .tileTag = ANIM_TAG_HOLLOW_ORB, - .paletteTag = ANIM_TAG_FLAT_ROCK, - .oam = &gOamData_AffineOff_ObjNormal_16x16, - .anims = gDummySpriteAnimTable, + .tileTag = ANIM_TAG_WHITE_FEATHER, + .paletteTag = ANIM_TAG_WHITE_FEATHER, + .oam = &gOamData_AffineNormal_ObjNormal_32x32, + .anims = gAnims_FallingFeather, .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = AnimDragonDanceOrb + .affineAnims = sSpriteAffineAnimTable_WingAttackFeather, + .callback = AnimDizzyPunchDuck }; -const struct SpriteTemplate gBreakneckBlitzHitSpriteTemplate = -{ - .tileTag = ANIM_TAG_IMPACT, - .paletteTag = ANIM_TAG_FLAT_ROCK, - .oam = &gOamData_AffineNormal_ObjBlend_32x32, + +// false surrender +const struct SpriteTemplate gSpriteTemplate_LargeCrossImpact = { + .tileTag = ANIM_TAG_CROSS_IMPACT, + .paletteTag = ANIM_TAG_CROSS_IMPACT, + .oam = &gOamData_AffineDouble_ObjBlend_32x32, .anims = gDummySpriteAnimTable, .images = NULL, - .affineAnims = gAffineAnims_HitSplat, - .callback = AnimHitSplatBasic + .affineAnims = sSpriteAffineAnimTable_LargeHailRock, + .callback = AnimCrossImpact }; -// all out pummelling -const struct SpriteTemplate gAllOutPummelingOnslaughtSpriteTemplate = -{ - .tileTag = ANIM_TAG_HANDS_AND_FEET, - .paletteTag = ANIM_TAG_IMPACT, - .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gAnims_HandsAndFeet, + +// expanding force +static const struct OamData sGeyserOam = { + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .shape = SPRITE_SHAPE(32x32), + .size = SPRITE_SIZE(32x32), + .priority = 1, //Above sprites +}; +const struct SpriteTemplate gSpriteTemplate_ExpandingForceExplode = { + .tileTag = ANIM_TAG_EXPLOSION_2, + .paletteTag = ANIM_TAG_EXPLOSION_2, + .oam = &sGeyserOam, + .anims = gExplosionAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = AnimJumpKick -}; -// supersonic skystrike -static const union AffineAnimCmd sSupersonicSkystrikeAffinePlayerSide[] = { - AFFINEANIMCMD_FRAME(0, 0, 0xb9, 1), - AFFINEANIMCMD_END, + .callback = SpriteCB_AnimSpriteOnTargetSideCentre }; -static const union AffineAnimCmd sSupersonicSkystrikeAffineOpponentSide[] = { - AFFINEANIMCMD_FRAME(0, 0, 0x50, 1), - AFFINEANIMCMD_END, + +// spirit break +static const union AffineAnimCmd sSpriteAffineAnim_SpiritBreakBall[] = { + AFFINEANIMCMD_FRAME(16, 16, 0, 0), + AFFINEANIMCMD_FRAME(2, 2, 0, 50), //Grow slowly to half size + AFFINEANIMCMD_END, }; -static const union AffineAnimCmd* const sSupersonicSkystrikeAffineAnimTable[] = { - sSupersonicSkystrikeAffinePlayerSide, - sSupersonicSkystrikeAffineOpponentSide, +static const union AffineAnimCmd* const sSpriteAffineAnimTable_SpiritBreakBall[] = { + sSpriteAffineAnim_SpiritBreakBall, }; -const struct SpriteTemplate gSupersonicSkystrikeFlySpriteTemplate = -{ - .tileTag = ANIM_TAG_BIRD, - .paletteTag = ANIM_TAG_BIRD, +const struct SpriteTemplate gSpriteTemplate_SpiritBreakChargeBall = { + .tileTag = ANIM_TAG_CIRCLE_OF_LIGHT, + .paletteTag = ANIM_TAG_CIRCLE_OF_LIGHT, .oam = &gOamData_AffineNormal_ObjNormal_64x64, .anims = gDummySpriteAnimTable, .images = NULL, - .affineAnims = sSupersonicSkystrikeAffineAnimTable, - .callback = AnimFlyBallAttack -}; -//acid downpour -const struct SpriteTemplate gAcidDownpourReversalSpriteTemplate = -{ - .tileTag = ANIM_TAG_POISON_BUBBLE, - .paletteTag = ANIM_TAG_POISON_BUBBLE, - .oam = &gOamData_AffineNormal_ObjNormal_16x16, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = AnimReversalOrb -}; -const struct SpriteTemplate gAcidDownpourAuraSpriteTemplate = -{ - .tileTag = ANIM_TAG_POISON_BUBBLE, - .paletteTag = ANIM_TAG_POISON_BUBBLE, - .oam = &gOamData_AffineNormal_ObjNormal_16x16, - .anims = gDummySpriteAnimTable, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = AnimParticleInVortex -}; -//tectonic rage -const struct SpriteTemplate gTectonicRageBlastBurnSpriteTemplate = -{ - .tileTag = ANIM_TAG_FIRE_PLUME, - .paletteTag = ANIM_TAG_FIRE_PLUME, - .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gAnims_FirePlume, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = AnimBlastBurnTargetPlume + .affineAnims = sSpriteAffineAnimTable_SpiritBreakBall, + .callback = SpriteCB_SpriteOnMonUntilAffineAnimEnds }; -const struct SpriteTemplate gTectonicRageExplosionSpriteTemplate = -{ + +const struct SpriteTemplate gSpriteTemplate_SpiritBreakExplode = { .tileTag = ANIM_TAG_EXPLOSION_2, .paletteTag = ANIM_TAG_EXPLOSION_2, .oam = &gOamData_AffineOff_ObjNormal_32x32, @@ -4250,113 +4242,784 @@ const struct SpriteTemplate gTectonicRageExplosionSpriteTemplate = .callback = AnimSpriteOnMonPos }; -// continental crush -const struct SpriteTemplate gContinentalCrushNeedleArmSpriteTemplate = -{ - .tileTag = ANIM_TAG_ROCKS, - .paletteTag = ANIM_TAG_ROCKS, - .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gAnims_FlyingRock, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = AnimNeedleArmSpike +// chloroblast +static const union AffineAnimCmd sSpriteAffineAnim_HydroCannonBall[] = { + AFFINEANIMCMD_FRAME(16, 16, 0, 16), //Double in size + AFFINEANIMCMD_END }; -const struct SpriteTemplate gContinentalCrushBigRockStompSpriteTemplate = -{ - .tileTag = ANIM_TAG_REALLY_BIG_ROCK, - .paletteTag = ANIM_TAG_REALLY_BIG_ROCK, - .oam = &gOamData_AffineDouble_ObjNormal_64x64, +static const union AffineAnimCmd* const sSpriteAffineAnimTable_HydroCannonBall[] = { + sSpriteAffineAnim_HydroCannonBall, +}; +const struct SpriteTemplate gSpriteTemplate_ChloroblastShot = { + .tileTag = ANIM_TAG_HYDRO_PUMP, + .paletteTag = ANIM_TAG_HYDRO_PUMP, + .oam = &gOamData_AffineDouble_ObjNormal_16x16, .anims = gDummySpriteAnimTable, .images = NULL, - .affineAnims = sSpriteAffineAnimTable_LargeHailRock, - .callback = SpriteCB_FallingObject + .affineAnims = sSpriteAffineAnimTable_HydroCannonBall, + .callback = AnimShadowBall }; -const struct SpriteTemplate gContinentalCrushFocusEnergySpriteTemplate = -{ - .tileTag = ANIM_TAG_FOCUS_ENERGY, - .paletteTag = ANIM_TAG_ROCKS, - .oam = &gOamData_AffineOff_ObjNormal_16x32, - .anims = gEndureEnergyAnimTable, + +// steel roller +const struct SpriteTemplate gSpriteTemplate_SteelRoller = { + .tileTag = ANIM_TAG_STEAMROLLER, + .paletteTag = ANIM_TAG_STEAMROLLER, + .oam = &gOamData_AffineOff_ObjNormal_64x64, + .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = AnimEndureEnergy + .callback = SpriteCB_SteelRoller }; -const struct SpriteTemplate gContinentalCrushGrowingRockSpriteTemplate = -{ - .tileTag = ANIM_TAG_REALLY_BIG_ROCK, - .paletteTag = ANIM_TAG_REALLY_BIG_ROCK, + +// scale shot +const struct SpriteTemplate gSpriteTemplate_ScaleShotScale = { + .tileTag = ANIM_TAG_SHELL_RIGHT, + .paletteTag = ANIM_TAG_SHELL_RIGHT, .oam = &gOamData_AffineNormal_ObjNormal_64x64, .anims = gDummySpriteAnimTable, .images = NULL, - .affineAnims = gAffineAnims_GrowingElectricOrb, - .callback = AnimGrowingChargeOrb + .affineAnims = gAffineAnims_BasicRock, + .callback = AnimRockBlastRock }; -const struct SpriteTemplate gContinentalCrushEruptionSpriteTemplate = -{ + +// meteor beam +const struct SpriteTemplate gSpriteTemplate_MeteorBeamRock = { .tileTag = ANIM_TAG_ROCKS, .paletteTag = ANIM_TAG_ROCKS, + .oam = &gOamData_AffineDouble_ObjNormal_32x32, + .anims = gAnims_FlyingRock, + .images = NULL, + .affineAnims = sSpriteAffineAnimTable_HydroCannonBall, + .callback = AnimShadowBall +}; + +// burning jealousy +const struct SpriteTemplate gSpriteTemplate_BurningJealousyFireBuff = { + .tileTag = ANIM_TAG_SMALL_EMBER, + .paletteTag = ANIM_TAG_SMALL_EMBER, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gDummySpriteAnimTable, + .anims = gAnims_FireBlastCross, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = AnimEruptionFallingRock + .callback = SpriteCB_MoveSpriteUpwardsForDuration }; - -// savage spin out -const struct SpriteTemplate gSavageSpinOutStringBlastSpriteTemplate = -{ - .tileTag = ANIM_TAG_STRING, - .paletteTag = ANIM_TAG_STRING, - .oam = &gOamData_AffineOff_ObjNormal_64x32, - .anims = gAffineAnims_AirWaveCrescent, +const struct SpriteTemplate gSpriteTemplate_BurningJealousyEmit = { + .tileTag = ANIM_TAG_SMALL_EMBER, + .paletteTag = ANIM_TAG_SMALL_EMBER, + .oam = &gOamData_AffineOff_ObjNormal_32x32, + .anims = gAnims_FireBlastCross, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = AnimAirWaveCrescent + .callback = AnimOutrageFlame }; -const struct SpriteTemplate gSavageSpinOutCacoonSpriteTemplate = -{ - .tileTag = ANIM_TAG_COCOON, - .paletteTag = ANIM_TAG_COCOON, - .oam = &gOamData_AffineNormal_ObjBlend_64x64, - .anims = gDummySpriteAnimTable, + +// lash out +const struct SpriteTemplate gSpriteTemplate_LashOutStrike = { + .tileTag = ANIM_TAG_SLAM_HIT_2, + .paletteTag = ANIM_TAG_SLAM_HIT_2, + .oam = &gOamData_AffineNormal_ObjNormal_64x64, + .anims = gKnockOffStrikeAnimTable, .images = NULL, - .affineAnims = gAffineAnims_Bite, - .callback = AnimBite + .affineAnims = gKnockOffStrikeAffineAnimTable, + .callback = SpriteCB_LashOutStrike }; -const struct SpriteTemplate gSavageSpinOutGreenChargeSpriteTemplate = -{ - .tileTag = ANIM_TAG_CIRCLE_OF_LIGHT, - .paletteTag = ANIM_TAG_RAZOR_LEAF, - .oam = &gOamData_AffineNormal_ObjBlend_64x64, + +// corrosize gas +const struct SpriteTemplate gSpriteTemplate_CorrosiveGasSmoke = { + .tileTag = ANIM_TAG_PINK_CLOUD, + .paletteTag = ANIM_TAG_PINK_CLOUD, + .oam = &gOamData_AffineDouble_ObjNormal_32x32, .anims = gDummySpriteAnimTable, .images = NULL, - .affineAnims = gAffineAnims_GrowingElectricOrb, - .callback = AnimGrowingChargeOrb + .affineAnims = gSmokeBallEscapeCloudAffineAnimTable, + .callback = AnimSmokeBallEscapeCloud }; -const struct SpriteTemplate gSavageSpinOutGreenCutSpriteTemplate = -{ - .tileTag = ANIM_TAG_CUT, - .paletteTag = ANIM_TAG_RAZOR_LEAF, - .oam = &gOamData_AffineOff_ObjBlend_32x32, - .anims = gCuttingSliceAnimTable, + +// flip turn +const struct SpriteTemplate gSpriteTemplate_FlipTurnThere = { + .tileTag = ANIM_TAG_HYDRO_PUMP, + .paletteTag = ANIM_TAG_HYDRO_PUMP, + .oam = &gOamData_AffineOff_ObjNormal_16x16, + .anims = gDummySpriteAnimTable, .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = AnimCuttingSlice + .affineAnims = gAffineAnims_ShadowBall, + .callback = AnimShadowBall }; -const struct SpriteTemplate gSavageSpinOutWhiteExplosionSpriteTemplate = -{ - .tileTag = ANIM_TAG_EXPLOSION_2, - .paletteTag = ANIM_TAG_AIR_WAVE_2, - .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gExplosionAnimTable, +const struct SpriteTemplate gSpriteTemplate_FlipTurnBack = { + .tileTag = ANIM_TAG_HYDRO_PUMP, + .paletteTag = ANIM_TAG_HYDRO_PUMP, + .oam = &gOamData_AffineOff_ObjNormal_16x16, + .anims = gDummySpriteAnimTable, .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = AnimSpriteOnMonPos + .affineAnims = gAffineAnims_ShadowBall, + .callback = AnimAbsorptionOrb }; -// never ending nightmare -const struct SpriteTemplate gNeverEndingNightmareRingAttackerSpriteTemplate = -{ +// wicked blow +static const union AffineAnimCmd sSpriteAffineAnim_DrainPunchFist[] = { + AFFINEANIMCMD_FRAME(256, 256, 0, 1), //Double sprite size + AFFINEANIMCMD_FRAME(-32, -32, 0, 8), + AFFINEANIMCMD_END, +}; +static const union AffineAnimCmd* const sSpriteAffineAnimTable_DrainPunchFist[] = { + sSpriteAffineAnim_DrainPunchFist, +}; + +const struct SpriteTemplate gSpriteTemplate_WickedBlowFist = { + .tileTag = ANIM_TAG_HANDS_AND_FEET, + .paletteTag = ANIM_TAG_HANDS_AND_FEET, + .oam = &gOamData_AffineDouble_ObjNormal_32x32, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = sSpriteAffineAnimTable_DrainPunchFist, + .callback = SpriteCB_SpriteOnMonForDurationUseY +}; +const struct SpriteTemplate gSpriteTemplate_WickedBlowBlackStars = { + .tileTag = ANIM_TAG_PAIN_SPLIT, + .paletteTag = ANIM_TAG_HANDS_AND_FEET, + .oam = &gOamData_AffineOff_ObjNormal_16x16, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimDizzyPunchDuck +}; +const struct SpriteTemplate gSpriteTemplate_WickedBlowRedStars = { + .tileTag = ANIM_TAG_PAIN_SPLIT, + .paletteTag = ANIM_TAG_PAIN_SPLIT, + .oam = &gOamData_AffineOff_ObjNormal_16x16, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimDizzyPunchDuck +}; + +// surging strikes +static const union AnimCmd sAnimCmdSurgingStrike[] = { + //Only tthe first three frames of the animation + ANIMCMD_FRAME(64, 4), + ANIMCMD_FRAME(48, 4), + ANIMCMD_FRAME(32, 4), + ANIMCMD_END, +}; +static const union AnimCmd *const sAnimCmdTable_SurgingStrike[] = { + sAnimCmdSurgingStrike, +}; +const struct SpriteTemplate gSpriteTemplate_SurgingStrikesImpact = { + .tileTag = ANIM_TAG_IMPACT_2, + .paletteTag = ANIM_TAG_IMPACT_2, + .oam = &gOamData_AffineNormal_ObjNormal_32x32, + .anims = sAnimCmdTable_SurgingStrike, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_SurgingStrikes +}; + +// dragon energy +const struct SpriteTemplate gSpriteTemplate_DragonEnergyShot = { + .tileTag = ANIM_TAG_HYDRO_PUMP, + .paletteTag = ANIM_TAG_HYDRO_PUMP, + .oam = &gOamData_AffineDouble_ObjNormal_16x16, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = sSpriteAffineAnimTable_HydroCannonBall, + .callback = SpriteCB_DragonEnergyShot +}; + +// fiery wrath +const struct SpriteTemplate gSpriteTemplate_FieryWrathGeyser = { + .tileTag = ANIM_TAG_PURPLE_RING, + .paletteTag = ANIM_TAG_PURPLE_RING, + .oam = &gOamData_AffineDouble_ObjNormal_16x32, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gAffineAnims_ShadowBall, + .callback = SpriteCB_Geyser +}; + +// glacial lance +static const union AffineAnimCmd sSpriteAffineAnim_GlacialLance_Grow[] = { + AFFINEANIMCMD_FRAME(0x20, 0x20, 0, 0), + AFFINEANIMCMD_FRAME(0x10, 0x10, 0, 30), //Double sprite size + AFFINEANIMCMD_END, +}; +static const union AffineAnimCmd sSpriteAffineAnim_GlacialLance_OnFoe[] = { + AFFINEANIMCMD_FRAME(256, 256, 0, 1), //Double sprite size + AFFINEANIMCMD_FRAME(0, 0, -8, 4), //Rotate 45 degrees right + AFFINEANIMCMD_END, +}; +static const union AffineAnimCmd sSpriteAffineAnim_GlacialLance_OnPlayer[] = { + AFFINEANIMCMD_FRAME(256, 256, 0, 1), //Double sprite size + AFFINEANIMCMD_FRAME(0, 0, 24, 4), //Rotate 135 degrees left + AFFINEANIMCMD_END, +}; +static const union AffineAnimCmd* const sSpriteAffineAnimTable_GlacialLance[] = { + sSpriteAffineAnim_GlacialLance_Grow, + sSpriteAffineAnim_GlacialLance_OnFoe, + sSpriteAffineAnim_GlacialLance_OnPlayer, +}; +const struct SpriteTemplate gSpriteTemplate_GlacialLance = { + .tileTag = ANIM_TAG_ICICLE_SPEAR, + .paletteTag = ANIM_TAG_ICICLE_SPEAR, + .oam = &gOamData_AffineDouble_ObjNormal_32x32, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = sSpriteAffineAnimTable_GlacialLance, + .callback = SpriteCB_GlacialLance +}; + +// eerie spell +static const struct OamData sOamData_EerieSpellFlame = { + .y = 0, + .affineMode = ST_OAM_AFFINE_NORMAL, + .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, + .shape = SPRITE_SHAPE(32x16), + .x = 0, + .size = SPRITE_SIZE(32x16), + .tileNum = 0, + .priority = 2, + .paletteNum = 0, +}; +const struct SpriteTemplate gSpriteTemplate_EerieSpellFlame = { + .tileTag = ANIM_TAG_PURPLE_FLAME, + .paletteTag = ANIM_TAG_PURPLE_FLAME, + .oam = &sOamData_EerieSpellFlame, + .anims = gAnims_GrudgeFlame, + .images = NULL, + .affineAnims = gAffineAnims_ShadowBall, + .callback = AnimNeedleArmSpike +}; + + +//// GEN 9 +// Psyshield bash +const struct SpriteTemplate gSpriteTemplate_PsyshieldBashHit = { + .tileTag = ANIM_TAG_IMPACT, + .paletteTag = ANIM_TAG_WATER_GUN, + .oam = &gOamData_AffineNormal_ObjBlend_32x32, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gAffineAnims_HitSplat, + .callback = AnimHitSplatBasic +}; + +// power shift +const struct SpriteTemplate gSpriteTemplate_PowerShiftOffenseBall = { + .tileTag = ANIM_TAG_BLUEGREEN_ORB, + .paletteTag = ANIM_TAG_RED_HEART, + .oam = &gOamData_AffineDouble_ObjNormal_16x16, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = sSpriteAffineAnimTable_LargeHailRock, + .callback = SpriteCB_PowerShiftBall +}; +const struct SpriteTemplate gSpriteTemplate_PowerShiftDefenseBall = { + .tileTag = ANIM_TAG_BLUEGREEN_ORB, + .paletteTag = ANIM_TAG_BLUEGREEN_ORB, + .oam = &gOamData_AffineDouble_ObjNormal_16x16, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = sSpriteAffineAnimTable_LargeHailRock, + .callback = SpriteCB_PowerShiftBall +}; + +// stone axe +static const union AnimCmd sAnimCmdFlippedX[] = { + ANIMCMD_FRAME(0, 1, .hFlip = TRUE), + ANIMCMD_END, +}; +static const union AnimCmd *const sAnimCmdTable_FlippedX[] = { + sAnimCmdFlippedX, +}; +const struct SpriteTemplate gSpriteTemplate_StoneAxeSlash = { + .tileTag = ANIM_TAG_SLAM_HIT_2, + .paletteTag = ANIM_TAG_SLAM_HIT_2, + .oam = &gOamData_AffineOff_ObjNormal_64x64, + .anims = sAnimCmdTable_FlippedX, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_HorizontalSlice, +}; + +// springtide storm +const struct SpriteTemplate gSpriteTemplate_SpringtideHeart = { + .tileTag = ANIM_TAG_RED_HEART, + .paletteTag = ANIM_TAG_RED_HEART, + .oam = &gOamData_AffineOff_ObjNormal_16x16, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimParticleInVortex +}; + +// mystical power +const struct SpriteTemplate gSpriteTemplate_VioletMind = { // also psystrike + .tileTag = ANIM_TAG_THIN_RING, + .paletteTag = ANIM_TAG_POISON_BUBBLE, + .oam = &gOamData_AffineDouble_ObjBlend_64x64, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gThinRingShrinkingAffineAnimTable, + .callback = AnimSpriteOnMonPos +}; +static const union AffineAnimCmd sSpriteAffineAnim_MysticalPowerRing[] = { + AFFINEANIMCMD_FRAME(16, 16, 0, 0), //Start small + AFFINEANIMCMD_FRAME(16, 16, 0, 15), //Grow sprite + AFFINEANIMCMD_END, +}; +static const union AffineAnimCmd* const sSpriteAffineAnimTable_MysticalPowerRing[] = { + sSpriteAffineAnim_MysticalPowerRing, +}; +const struct SpriteTemplate gSpriteTemplate_MysticalPowerRing = { + .tileTag = ANIM_TAG_THIN_RING, + .paletteTag = ANIM_TAG_HYDRO_PUMP, + .oam = &gOamData_AffineNormal_ObjNormal_64x64, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = sSpriteAffineAnimTable_MysticalPowerRing, + .callback = AnimHitSplatBasic +}; + +// mountain gale +const struct SpriteTemplate gSpriteTemplate_MountainGaleRock = { + .tileTag = ANIM_TAG_ROCKS, + .paletteTag = ANIM_TAG_DRAGON_ASCENT_FOE, + .oam = &gOamData_AffineOff_ObjNormal_32x32, + .anims = gAnims_FlyingRock, + .images = NULL, + .affineAnims = gBulletSeedAffineAnimTable, + .callback = AnimMissileArc +}; + +// bleakwind storm +const struct SpriteTemplate gSpriteTemplate_BleakwindIce = { + .tileTag = ANIM_TAG_ICE_CRYSTALS, + .paletteTag = ANIM_TAG_ICE_CRYSTALS, + .oam = &gOamData_AffineOff_ObjNormal_8x16, + .anims = gAnims_IceCrystalLarge, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimParticleInVortex +}; + +// headlong rush +const struct SpriteTemplate gSpriteTemplate_HeadlongRushImpact = { + .tileTag = ANIM_TAG_IMPACT, + .paletteTag = ANIM_TAG_IMPACT, + .oam = &gOamData_AffineDouble_ObjBlend_32x32, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = sSpriteAffineAnimTable_DrainPunchFist, + .callback = AnimHitSplatBasic +}; +const struct SpriteTemplate gSpriteTemplate_MaxQuakeDirtGeyser = { + .tileTag = ANIM_TAG_MUD_SAND, + .paletteTag = ANIM_TAG_MUD_SAND, + .oam = &gOamData_AffineOff_ObjNormal_16x16, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimMudSportDirt +}; +const struct SpriteTemplate gSpriteTemplate_MaxQuakeRockGeyser = { + .tileTag = ANIM_TAG_ROCKS, + .paletteTag = ANIM_TAG_ROCKS, + .oam = &gOamData_AffineOff_ObjNormal_32x32, + .anims = gAnims_FlyingRock, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_Geyser +}; + +// barb barrage +const struct SpriteTemplate gSpriteTemplate_BarbBarrage = { + .tileTag = ANIM_TAG_SPIKES, + .paletteTag = ANIM_TAG_SHADOW_BALL, + .oam = &gOamData_AffineOff_ObjNormal_16x16, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimOutrageFlame +}; + +// esper wing +const struct SpriteTemplate gSpriteTemplate_WingAttackFeather = { // TODo update wing attaack anim + .tileTag = ANIM_TAG_WHITE_FEATHER, + .paletteTag = ANIM_TAG_WHITE_FEATHER, + .oam = &gOamData_AffineNormal_ObjNormal_32x32, + .anims = gAnims_FallingFeather, + .images = NULL, + .affineAnims = sSpriteAffineAnimTable_WingAttackFeather, + .callback = AnimDizzyPunchDuck +}; + +// triple arrows +const struct SpriteTemplate gSpriteTemplate_TripleArrowKick = { + .tileTag = ANIM_TAG_HANDS_AND_FEET, + .paletteTag = ANIM_TAG_HANDS_AND_FEET, + .oam = &gOamData_AffineOff_ObjNormal_32x32, + .anims = gAnims_HandsAndFeet, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_TripleArrowKick +}; + +// infernal parade +static const union AffineAnimCmd sSpriteAffineAnim_FlutterbyPulsate[] = { + AFFINEANIMCMD_FRAME(16, 16, 0, 4), + AFFINEANIMCMD_FRAME(-16, -16, 0, 4), + AFFINEANIMCMD_JUMP(0), +}; +static const union AffineAnimCmd sSpriteAffineAnim_FlutterbyGrow[] = { + AFFINEANIMCMD_FRAME(8, 8, 0, 16), //Double in size + AFFINEANIMCMD_END, +}; +static const union AffineAnimCmd* const sSpriteAffineAnimTable_Flutterby[] = { + sSpriteAffineAnim_FlutterbyPulsate, + sSpriteAffineAnim_FlutterbyGrow, +}; +const struct SpriteTemplate gSpriteTemplate_InfernalParadeFlame = { + .tileTag = ANIM_TAG_PURPLE_FLAME, + .paletteTag = ANIM_TAG_PURPLE_FLAME, + .oam = &gOamData_AffineDouble_ObjBlend_32x16, + .anims = gAnims_GrudgeFlame, + .images = NULL, + .affineAnims = sSpriteAffineAnimTable_Flutterby, + .callback = SpriteCB_MaxFlutterby +}; + +// ceaseless edge +const struct SpriteTemplate gSpriteTemplate_CeaselessEdgeSlash = { + .tileTag = ANIM_TAG_SLASH, + .paletteTag = ANIM_TAG_SLASH, + .oam = &gOamData_AffineOff_ObjNormal_32x32, + .anims = gSlashSliceAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_FlippableSlash +}; + +// wildbolt storm +static const union AnimCmd sAnimCmdAnimatedSpark2[] = { + ANIMCMD_FRAME((16 * 16) / (8 * 8) * 0, 8), + ANIMCMD_FRAME((16 * 16) / (8 * 8) * 1, 8), + ANIMCMD_FRAME((16 * 16) / (8 * 8) * 2, 8), + ANIMCMD_JUMP(0) +}; +static const union AnimCmd *const sAnimCmdTable_AnimatedSpark2[] = { + sAnimCmdAnimatedSpark2, +}; +const struct SpriteTemplate gSpriteTemplate_WildboltStormSpark = { + .tileTag = ANIM_TAG_SPARK_2, + .paletteTag = ANIM_TAG_SPARK_2, + .oam = &gOamData_AffineOff_ObjNormal_16x16, + .anims = sAnimCmdTable_AnimatedSpark2, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimParticleInVortex +}; + +// lunar blessing/dance +const struct SpriteTemplate gSpriteTemplate_LunarDanceRing = { + .tileTag = ANIM_TAG_GUARD_RING, + .paletteTag = ANIM_TAG_SMALL_EMBER, + .oam = &gOamData_AffineDouble_ObjBlend_64x32, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gGuardRingAffineAnimTable, + .callback = SpriteCB_SurroundingRing +}; + +// take heart +const struct SpriteTemplate gSpriteTemplate_TakeHeartFallingHeart = { + .tileTag = ANIM_TAG_RED_HEART, + .paletteTag = ANIM_TAG_RED_HEART, + .oam = &gOamData_AffineOff_ObjNormal_16x16, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_FallingObject +}; +const struct SpriteTemplate gSpriteTemplate_TakeHeartRing = { + .tileTag = ANIM_TAG_GUARD_RING, + .paletteTag = ANIM_TAG_RED_HEART, + .oam = &gOamData_AffineDouble_ObjBlend_64x32, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gGuardRingAffineAnimTable, + .callback = SpriteCB_SurroundingRing +}; + +// bitter malice +const struct SpriteTemplate gSpriteTemplate_BitterMaliceRing = { + .tileTag = ANIM_TAG_PURPLE_RING, + .paletteTag = ANIM_TAG_PURPLE_RING, + .oam = &gOamData_AffineDouble_ObjNormal_16x32, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gAffineAnims_ShadowBall, + .callback = AnimParticleInVortex +}; + +//ultra burst +const struct SpriteTemplate gUltraBurstSymbolSpriteTemplate = +{ + .tileTag = ANIM_TAG_ULTRA_BURST_SYMBOL, + .paletteTag = ANIM_TAG_ULTRA_BURST_SYMBOL, + .oam = &gOamData_AffineDouble_ObjBlend_32x32, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gAffineAnims_LusterPurgeCircle, + .callback = AnimSpriteOnMonPos +}; + +// Z MOVES +//activate +const struct SpriteTemplate gZMoveSymbolSpriteTemplate = +{ + .tileTag = ANIM_TAG_Z_MOVE_SYMBOL, + .paletteTag = ANIM_TAG_Z_MOVE_SYMBOL, + .oam = &gOamData_AffineNormal_ObjBlend_64x64, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gAffineAnims_LusterPurgeCircle, + .callback = AnimSpriteOnMonPos +}; +const struct SpriteTemplate gBlueZMoveEnergySpriteTemplate = +{ + .tileTag = ANIM_TAG_FOCUS_ENERGY, + .paletteTag = ANIM_TAG_SWEAT_BEAD, + .oam = &gOamData_AffineOff_ObjNormal_16x32, + .anims = gEndureEnergyAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimEndureEnergy, +}; +const struct SpriteTemplate gGreenZMoveEnergySpriteTemplate = +{ + .tileTag = ANIM_TAG_FOCUS_ENERGY, + .paletteTag = ANIM_TAG_WHIP_HIT, + .oam = &gOamData_AffineOff_ObjNormal_16x32, + .anims = gEndureEnergyAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimEndureEnergy, +}; +const struct SpriteTemplate gYellowZMoveEnergySpriteTemplate = +{ + .tileTag = ANIM_TAG_FOCUS_ENERGY, + .paletteTag = ANIM_TAG_PAW_PRINT, + .oam = &gOamData_AffineOff_ObjNormal_16x32, + .anims = gEndureEnergyAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimEndureEnergy, +}; +// breakneck blitz +const struct SpriteTemplate gBreakneckBlitzDanceSpriteTemplate = +{ + .tileTag = ANIM_TAG_HOLLOW_ORB, + .paletteTag = ANIM_TAG_FLAT_ROCK, + .oam = &gOamData_AffineOff_ObjNormal_16x16, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimDragonDanceOrb +}; +const struct SpriteTemplate gBreakneckBlitzHitSpriteTemplate = +{ + .tileTag = ANIM_TAG_IMPACT, + .paletteTag = ANIM_TAG_FLAT_ROCK, + .oam = &gOamData_AffineNormal_ObjBlend_32x32, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gAffineAnims_HitSplat, + .callback = AnimHitSplatBasic +}; +// all out pummelling +const struct SpriteTemplate gAllOutPummelingOnslaughtSpriteTemplate = +{ + .tileTag = ANIM_TAG_HANDS_AND_FEET, + .paletteTag = ANIM_TAG_IMPACT, + .oam = &gOamData_AffineOff_ObjNormal_32x32, + .anims = gAnims_HandsAndFeet, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimJumpKick +}; +// supersonic skystrike +static const union AffineAnimCmd sSupersonicSkystrikeAffinePlayerSide[] = { + AFFINEANIMCMD_FRAME(0, 0, 0xb9, 1), + AFFINEANIMCMD_END, +}; +static const union AffineAnimCmd sSupersonicSkystrikeAffineOpponentSide[] = { + AFFINEANIMCMD_FRAME(0, 0, 0x50, 1), + AFFINEANIMCMD_END, +}; +static const union AffineAnimCmd* const sSupersonicSkystrikeAffineAnimTable[] = { + sSupersonicSkystrikeAffinePlayerSide, + sSupersonicSkystrikeAffineOpponentSide, +}; +const struct SpriteTemplate gSupersonicSkystrikeFlySpriteTemplate = +{ + .tileTag = ANIM_TAG_BIRD, + .paletteTag = ANIM_TAG_BIRD, + .oam = &gOamData_AffineNormal_ObjNormal_64x64, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = sSupersonicSkystrikeAffineAnimTable, + .callback = AnimFlyBallAttack +}; +//acid downpour +const struct SpriteTemplate gAcidDownpourReversalSpriteTemplate = +{ + .tileTag = ANIM_TAG_POISON_BUBBLE, + .paletteTag = ANIM_TAG_POISON_BUBBLE, + .oam = &gOamData_AffineNormal_ObjNormal_16x16, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimReversalOrb +}; +const struct SpriteTemplate gAcidDownpourAuraSpriteTemplate = +{ + .tileTag = ANIM_TAG_POISON_BUBBLE, + .paletteTag = ANIM_TAG_POISON_BUBBLE, + .oam = &gOamData_AffineNormal_ObjNormal_16x16, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimParticleInVortex +}; +//tectonic rage +const struct SpriteTemplate gTectonicRageBlastBurnSpriteTemplate = +{ + .tileTag = ANIM_TAG_FIRE_PLUME, + .paletteTag = ANIM_TAG_FIRE_PLUME, + .oam = &gOamData_AffineOff_ObjNormal_32x32, + .anims = gAnims_FirePlume, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimBlastBurnTargetPlume +}; +const struct SpriteTemplate gTectonicRageExplosionSpriteTemplate = +{ + .tileTag = ANIM_TAG_EXPLOSION_2, + .paletteTag = ANIM_TAG_EXPLOSION_2, + .oam = &gOamData_AffineOff_ObjNormal_32x32, + .anims = gExplosionAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimSpriteOnMonPos +}; + +// continental crush +const struct SpriteTemplate gContinentalCrushNeedleArmSpriteTemplate = +{ + .tileTag = ANIM_TAG_ROCKS, + .paletteTag = ANIM_TAG_ROCKS, + .oam = &gOamData_AffineOff_ObjNormal_32x32, + .anims = gAnims_FlyingRock, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimNeedleArmSpike +}; +const struct SpriteTemplate gContinentalCrushBigRockStompSpriteTemplate = +{ + .tileTag = ANIM_TAG_REALLY_BIG_ROCK, + .paletteTag = ANIM_TAG_REALLY_BIG_ROCK, + .oam = &gOamData_AffineDouble_ObjNormal_64x64, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = sSpriteAffineAnimTable_LargeHailRock, + .callback = SpriteCB_FallingObject +}; +const struct SpriteTemplate gContinentalCrushFocusEnergySpriteTemplate = +{ + .tileTag = ANIM_TAG_FOCUS_ENERGY, + .paletteTag = ANIM_TAG_ROCKS, + .oam = &gOamData_AffineOff_ObjNormal_16x32, + .anims = gEndureEnergyAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimEndureEnergy +}; +const struct SpriteTemplate gContinentalCrushGrowingRockSpriteTemplate = +{ + .tileTag = ANIM_TAG_REALLY_BIG_ROCK, + .paletteTag = ANIM_TAG_REALLY_BIG_ROCK, + .oam = &gOamData_AffineNormal_ObjNormal_64x64, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gAffineAnims_GrowingElectricOrb, + .callback = AnimGrowingChargeOrb +}; +const struct SpriteTemplate gContinentalCrushEruptionSpriteTemplate = +{ + .tileTag = ANIM_TAG_ROCKS, + .paletteTag = ANIM_TAG_ROCKS, + .oam = &gOamData_AffineOff_ObjNormal_32x32, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimEruptionFallingRock +}; + +// savage spin out +const struct SpriteTemplate gSavageSpinOutStringBlastSpriteTemplate = +{ + .tileTag = ANIM_TAG_STRING, + .paletteTag = ANIM_TAG_STRING, + .oam = &gOamData_AffineOff_ObjNormal_64x32, + .anims = gAffineAnims_AirWaveCrescent, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimAirWaveCrescent +}; +const struct SpriteTemplate gSavageSpinOutCacoonSpriteTemplate = +{ + .tileTag = ANIM_TAG_COCOON, + .paletteTag = ANIM_TAG_COCOON, + .oam = &gOamData_AffineNormal_ObjBlend_64x64, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gAffineAnims_Bite, + .callback = AnimBite +}; +const struct SpriteTemplate gSavageSpinOutGreenChargeSpriteTemplate = +{ + .tileTag = ANIM_TAG_CIRCLE_OF_LIGHT, + .paletteTag = ANIM_TAG_RAZOR_LEAF, + .oam = &gOamData_AffineNormal_ObjBlend_64x64, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gAffineAnims_GrowingElectricOrb, + .callback = AnimGrowingChargeOrb +}; +const struct SpriteTemplate gSavageSpinOutGreenCutSpriteTemplate = +{ + .tileTag = ANIM_TAG_CUT, + .paletteTag = ANIM_TAG_RAZOR_LEAF, + .oam = &gOamData_AffineOff_ObjBlend_32x32, + .anims = gCuttingSliceAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimCuttingSlice +}; +const struct SpriteTemplate gSavageSpinOutWhiteExplosionSpriteTemplate = +{ + .tileTag = ANIM_TAG_EXPLOSION_2, + .paletteTag = ANIM_TAG_AIR_WAVE_2, + .oam = &gOamData_AffineOff_ObjNormal_32x32, + .anims = gExplosionAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimSpriteOnMonPos +}; + +// never ending nightmare +const struct SpriteTemplate gNeverEndingNightmareRingAttackerSpriteTemplate = +{ .tileTag = ANIM_TAG_THIN_RING, .paletteTag = ANIM_TAG_POISON_BUBBLE, .oam = &gOamData_AffineDouble_ObjNormal_64x64, @@ -5078,7 +5741,7 @@ const struct SpriteTemplate gTargetTwinkleSpriteTemplate = .tileTag = ANIM_TAG_SPARKLE_4, .paletteTag = ANIM_TAG_SPARKLE_4, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = sAnims_SpinningSparkle, + .anims = gAnims_SpinningSparkle, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCB_TwinkleOnBattler @@ -5134,7 +5797,7 @@ const struct SpriteTemplate gTwinkleTackleTwinkleSpriteTemplate = .tileTag = ANIM_TAG_SPARKLE_4, .paletteTag = ANIM_TAG_SPARKLE_4, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = sAnims_SpinningSparkle, + .anims = gAnims_SpinningSparkle, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCB_TwinkleOnBattler @@ -5524,7 +6187,7 @@ const struct SpriteTemplate gPulverizingPancakeRedDetectSpriteTemplate = .tileTag = ANIM_TAG_SPARKLE_4, .paletteTag = ANIM_TAG_VERTICAL_HEX, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = sAnims_SpinningSparkle, + .anims = gAnims_SpinningSparkle, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimSpinningSparkle @@ -6088,7 +6751,7 @@ const struct SpriteTemplate gSnuggleForeverEyesSpriteTemplate = .tileTag = ANIM_TAG_SPARKLE_4, .paletteTag = ANIM_TAG_VERTICAL_HEX, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = sAnims_SpinningSparkle, + .anims = gAnims_SpinningSparkle, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimSpinningSparkle @@ -6419,14 +7082,6 @@ const struct SpriteTemplate gLightThatBurnsTheSkyBlastBurnSpriteTemplate = .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimBlastBurnTargetPlume }; -static const struct OamData sGeyserOam = -{ - .affineMode = ST_OAM_AFFINE_OFF, - .objMode = ST_OAM_OBJ_NORMAL, - .shape = SPRITE_SHAPE(32x32), - .size = SPRITE_SIZE(32x32), - .priority = 1, //Above sprites -}; const struct SpriteTemplate gLightThatBurnsTheSkyExplosionSpriteTemplate = { .tileTag = ANIM_TAG_EXPLOSION_2, @@ -6520,6 +7175,18 @@ const struct SpriteTemplate gSoulStealZStarSpriteTemplate = .callback = AnimCrossImpact }; +// Bitter Blade +const struct SpriteTemplate gBitterBladeImpactTemplate = +{ + .tileTag = ANIM_TAG_CLAW_SLASH, + .paletteTag = ANIM_TAG_POISON_BUBBLE, + .oam = &gOamData_AffineOff_ObjNormal_32x32, + .anims = gAnims_ClawSlash, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimClawSlash +}; + // functions //general void AnimTask_IsTargetPartner(u8 taskId) @@ -6532,44 +7199,6 @@ void AnimTask_IsTargetPartner(u8 taskId) DestroyAnimVisualTask(taskId); } -void AnimTask_AllBanksInvisible(u8 taskId) -{ - u32 i; - for (i = 0; i < gBattlersCount; i++) - { - u8 spriteId = gBattlerSpriteIds[i]; - if (spriteId != 0xFF) - gSprites[spriteId].invisible = TRUE; - } - DestroyAnimVisualTask(taskId); -} - -void AnimTask_AllBanksVisible(u8 taskId) -{ - u32 i; - for (i = 0; i < gBattlersCount; i++) - { - u8 spriteId = gBattlerSpriteIds[i]; - if (spriteId != 0xFF) - gSprites[spriteId].invisible = FALSE; - } - DestroyAnimVisualTask(taskId); -} - -void AnimTask_AllBanksInvisibleExceptAttackerAndTarget(u8 taskId) -{ - u32 i; - for (i = 0; i < gBattlersCount; ++i) - { - u8 spriteId = gBattlerSpriteIds[i]; - if (spriteId == GetAnimBattlerSpriteId(ANIM_ATTACKER) || spriteId == GetAnimBattlerSpriteId(ANIM_TARGET)) - continue; - if (spriteId != 0xFF || !IsBattlerSpriteVisible(i)) //Pokemon that are already hidden - gSprites[spriteId].invisible = TRUE; - } - DestroyAnimVisualTask(taskId); -} - static u8 LoadBattleAnimTarget(u8 arg) { u8 battler; @@ -7593,7 +8222,113 @@ static void SpriteCB_GeyserTarget(struct Sprite *sprite) sprite->callback = AnimMudSportDirtRising; } -// Anim Tasks Functions +//// Anim Tasks Functions +void AnimTask_IsAttackerPlayerSide(u8 taskId) +{ + if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT) + gBattleAnimArgs[7] = 0; + else + gBattleAnimArgs[7] = 1; + + DestroyAnimVisualTask(taskId); +} + +static void AnimTask_FadeOutParticlesHelper(u8 taskId) +{ + if (gTasks[taskId].data[1] == 0) //Target reached + { + DestroyAnimVisualTask(taskId); + } + else if (gTasks[taskId].data[4]++ >= gTasks[taskId].data[3]) + { + gTasks[taskId].data[4] = 0; //Reset timer + gTasks[taskId].data[1]--; + gTasks[taskId].data[2]++; + SetGpuReg(REG_OFFSET_BLDALPHA, (gTasks[taskId].data[2] * 256) + gTasks[taskId].data[1]); + } +} + +void AnimTask_FadeOutParticles(u8 taskId) +{ + u8 existingTaskId = FindTaskIdByFunc(AnimTask_FadeOutParticlesHelper); + if (existingTaskId != 0xFF) + DestroyAnimVisualTask(existingTaskId); //Can only have one of these tasks going at a time + + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 0)); + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL); //Blend sprites out + gTasks[taskId].data[1] = 16; + gTasks[taskId].data[2] = 0; + gTasks[taskId].data[3] = gBattleAnimArgs[0]; //Delay + gTasks[taskId].data[4] = 0; //Delay Timer + gTasks[taskId].func = AnimTask_FadeOutParticlesHelper; +} + + +static const union AffineAnimCmd sShellSmashShrinkAffineAnimCmds[] = +{ + AFFINEANIMCMD_FRAME(64, 64, 0, 16), //Flatten + AFFINEANIMCMD_FRAME(0, 0, 0, 48), + AFFINEANIMCMD_FRAME(-64, -64, 0, 16), + AFFINEANIMCMD_END, +}; +//Shrinks the attacker, pauses, then scales up the attacker again +void AnimTask_ShellSmashShrinkAttacker(u8 taskId) +{ + struct Task* task = &gTasks[taskId]; + u8 spriteId; + + task->data[0] = gBattleAnimArgs[0]; //Pause + spriteId = GetAnimBattlerSpriteId(ANIM_TARGET); + PrepareAffineAnimInTaskData(task, spriteId, sShellSmashShrinkAffineAnimCmds); + task->func = AnimTask_DynamaxGrowthStep; +} + +static void AnimTask_DynamaxGrowthStep(u8 taskId) +{ + struct Task* task = &gTasks[taskId]; + if (!RunAffineAnimFromTaskData(task)) + DestroyAnimVisualTask(taskId); +} + +void AnimTask_AllBattlersInvisible(u8 taskId) +{ + u32 i, spriteId; + for (i = 0; i < gBattlersCount; i++) + { + spriteId = gBattlerSpriteIds[i]; + if (spriteId != 0xFF) + gSprites[spriteId].invisible = TRUE; + } + DestroyAnimVisualTask(taskId); +} + +void AnimTask_AllBattlersVisible(u8 taskId) +{ + u32 i, spriteId; + for (i = 0; i < gBattlersCount; ++i) + { + spriteId = gBattlerSpriteIds[i]; + if (IsBattlerSpriteVisible(i) && spriteId != 0xFF) + gSprites[spriteId].invisible = FALSE; + } + + DestroyAnimVisualTask(taskId); +} + +void AnimTask_AllBattlersInvisibleExceptAttackerAndTarget(u8 taskId) +{ + u32 i; + for (i = 0; i < gBattlersCount; ++i) + { + u8 spriteId = gBattlerSpriteIds[i]; + if (spriteId == GetAnimBattlerSpriteId(ANIM_ATTACKER) || spriteId == GetAnimBattlerSpriteId(ANIM_TARGET)) + continue; + if (spriteId != 0xFF || !IsBattlerSpriteVisible(i)) //Pokemon that are already hidden + gSprites[spriteId].invisible = TRUE; + } + DestroyAnimVisualTask(taskId); +} + #define tSpriteId data[0] #define tTimer data[1] #define tInitialXPos data[2] @@ -7900,3 +8635,467 @@ void AnimTask_AffectionHangedOn(u8 taskId) gBattleAnimArgs[0] = GetBattlerFriendshipScore(gBattleAnimTarget); DestroyAnimVisualTask(taskId); } + + +//Launches the stat ball for Power Shift +//arg 0: X starting offset +//arg 1: Y starting offset +//arg 2: X finishing offset +//arg 3: Y finishing offset +//arg 4: Duration +//arg 5: Wave Amplitude +static void SpriteCB_PowerShiftBall(struct Sprite* sprite) +{ + InitSpritePosToAnimAttacker(sprite, TRUE); + + if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT) + gBattleAnimArgs[2] *= -1; //Flip X + + sprite->data[0] = gBattleAnimArgs[4]; //Duration + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) + gBattleAnimArgs[2]; //Target X + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[3]; //Target Y + sprite->data[5] = gBattleAnimArgs[5]; //Wave Amplitude + + InitAnimArcTranslation(sprite); + sprite->callback = SpriteCB_PowerShiftBallStep; +} + +static void SpriteCB_PowerShiftBallStep(struct Sprite* sprite) // Also used by Triple Arrows +{ + if (TranslateAnimHorizontalArc(sprite)) + DestroySpriteAndMatrix(sprite); +} + +//Creates a sprite that moves left or right along the target. +//arg 0: Initial x-pixel offset +//arg 1: Initial y-pixel offset +//arg 2: Slice distance +//arg 3: Speed +//arg 4: direction +static void SpriteCB_HorizontalSlice(struct Sprite *sprite) +{ + sprite->x2 = gBattleAnimArgs[0]; + sprite->y2 = gBattleAnimArgs[1]; + + sprite->data[0] = gBattleAnimArgs[2]; //Slice distance + sprite->data[1] = gBattleAnimArgs[3]; //Slice speed + sprite->data[2] = gBattleAnimArgs[4]; //Slice direction + sprite->data[3] = 0; //Timer + + sprite->callback = SpriteCB_HorizontalSliceStep; +} + +void SpriteCB_HorizontalSliceStep(struct Sprite *sprite) +{ + if (sprite->data[2] == 1) //Move left + sprite->x2 -= sprite->data[1]; + else + sprite->x2 += sprite->data[1]; + + sprite->data[3] += sprite->data[1]; + + if (sprite->data[3] >= sprite->data[0]) + DestroySpriteAndMatrix(sprite); +} + +//Creates the slam hit for LashOut +//arg 0: initial x pixel offset +//arg 1: initial y pixel offset +//arg 2: flip +static void SpriteCB_LashOutStrike(struct Sprite* sprite) +{ + bool8 flip = GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER; + + if (gBattleAnimArgs[2]) + flip ^= 1; + + sprite->data[0] = 11; + + if (flip) + { + sprite->x -= gBattleAnimArgs[0]; + sprite->data[0] *= -1; + StartSpriteAffineAnim(sprite, 1); + } + else + { + sprite->x += gBattleAnimArgs[0]; + } + + sprite->y += gBattleAnimArgs[1]; + sprite->data[1] = 192; + sprite->callback = AnimKnockOffStrike_Step; +} + +//Moves the shells towards the attacker and leaves them there until they fade out +//arg 0: Initial x-pos +//arg 1: Final x-pos +//arg 2: Movement duration +//arg 3: Affine anim +static void SpriteCB_ShellSmashShell(struct Sprite* sprite) +{ + //Init Position + sprite->x = GetBattlerSpriteCoord2(gBattleAnimAttacker, BATTLER_COORD_X_2) + gBattleAnimArgs[0]; + sprite->y = GetBattlerSpriteCoord2(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) + 2; //2 to slightly encompass the entire sprite + + //Prepare linear movement + sprite->data[0] = gBattleAnimArgs[2]; //Duration + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) + gBattleAnimArgs[1]; + sprite->data[4] = sprite->y; + sprite->callback = StartAnimLinearTranslation; + StoreSpriteCallbackInData6(sprite, SpriteCB_ShellSmashShell_DestroyDuringFadeOut); + + //Rotate properly + StartSpriteAffineAnim(sprite, gBattleAnimArgs[3]); +} + +static void SpriteCB_ShellSmashShell_DestroyDuringFadeOut(struct Sprite* sprite) +{ + if (GetGpuReg(REG_OFFSET_BLDALPHA) >= BLDALPHA_BLEND(0, 8)) //Fade out 1/2 done + DestroyAnimSprite(sprite); +} + +static void SpriteCB_AnimSpriteOnTargetSideCentre(struct Sprite *sprite) +{ + u8 target = LoadBattleAnimTarget(2); + + if (!sprite->data[0]) + { + if (IsAlly(gBattleAnimAttacker, target)) + { + if (IsDoubleBattle()) + InitSpritePosToAnimAttackersCentre(sprite, FALSE); + else + InitSpritePosToAnimAttacker(sprite, FALSE); + } + else + { + if (IsDoubleBattle()) + InitSpritePosToAnimTargetsCentre(sprite, FALSE); + else + InitSpritePosToAnimTarget(sprite, FALSE); + } + + sprite->data[0]++; + } + else if (sprite->animEnded || sprite->affineAnimEnded) + { + DestroySpriteAndMatrix(sprite); + } +} + +static void SpriteCB_SpriteOnMonUntilAffineAnimEnds(struct Sprite* sprite) +{ + u8 target = LoadBattleAnimTarget(0); + + if (!IsBattlerSpriteVisible(target)) + DestroyAnimSprite(sprite); + else + { + sprite->x = GetBattlerSpriteCoord(target, BATTLER_COORD_X_2); + sprite->y = GetBattlerSpriteCoord(target, BATTLER_COORD_Y_PIC_OFFSET); + StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix); + sprite->callback = RunStoredCallbackWhenAffineAnimEnds; + } +} + +static void SpriteCB_SpriteOnMonForDurationUseY(struct Sprite *sprite) +{ + u8 target = LoadBattleAnimTarget(0); + + if (!IsBattlerSpriteVisible(target)) + DestroyAnimSprite(sprite); + else + { + sprite->x = GetBattlerSpriteCoord(target, BATTLER_COORD_X); + sprite->y = GetBattlerSpriteCoord(target, BATTLER_COORD_Y_PIC_OFFSET); + + sprite->x2 = gBattleAnimArgs[1]; + sprite->y2 = gBattleAnimArgs[2]; + sprite->data[0] = 0; + sprite->data[1] = gBattleAnimArgs[3]; + sprite->data[2] = gBattleAnimArgs[4]; + sprite->data[3] = 0; + sprite->callback = AnimBrickBreakWall_Step; + } +} + +//Moves a sprite upward for set amount of time +//arg 0: Bank +//arg 1: X-Offset +//arg 2: Y-Offset +//arg 3: Speed +//arg 4: Duration +static void SpriteCB_MoveSpriteUpwardsForDuration(struct Sprite* sprite) +{ + if (gBattleAnimArgs[0] == ANIM_ATTACKER) + { + sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0) + gBattleAnimArgs[1]; + sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + gBattleAnimArgs[2]; + } + else + { + sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, 0) + gBattleAnimArgs[1]; + sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + gBattleAnimArgs[2]; + } + + sprite->data[0] = 0; + sprite->data[1] = gBattleAnimArgs[3]; //Speed + sprite->data[2] = gBattleAnimArgs[4]; //Duration + sprite->callback = SpriteCB_MoveSpriteUpwardsForDurationStep; +} + +static void SpriteCB_MoveSpriteUpwardsForDurationStep(struct Sprite* sprite) +{ + sprite->y -= sprite->data[1]; + if (sprite->data[0]++ > sprite->data[2]) + DestroyAnimSprite(sprite); +} + +//Creates arc impacts for Surging Strikes +//arg 0: initial x pixel offset (from target) +//arg 1: initial y pixel offset (from target) +//arg 2: target x pixel offset (from target) +//arg 3: target y pixel offset (from target) +//arg 4: duration +//arg 5: wave amplitude +static void SpriteCB_SurgingStrikes(struct Sprite* sprite) +{ + InitSpritePosToAnimTarget(sprite, TRUE); + sprite->data[0] = gBattleAnimArgs[4]; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[2]; //Target X + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[3]; //Target Y + sprite->data[5] = gBattleAnimArgs[5]; + InitAnimArcTranslation(sprite); + sprite->callback = AnimMissileArc_Step; +} + +//Creates the moving Steel Wheel for Steel Roller +//arg 0: initial x pixel offset +//arg 1: initial y pixel offset +//arg 2: falling speed +//arg 3: horizontal distance +//arg 4: horizontal speed +static void SpriteCB_SteelRoller(struct Sprite* sprite) +{ + sprite->x = GetBattlerSpriteCoord2(gBattleAnimTarget, BATTLER_COORD_X); + sprite->y = GetBattlerSpriteCoord2(gBattleAnimTarget, BATTLER_COORD_Y); + + sprite->x2 = gBattleAnimArgs[0]; + sprite->y2 += gBattleAnimArgs[1]; + + sprite->data[4] = gBattleAnimArgs[3]; //Left/Right distance + sprite->data[5] = gBattleAnimArgs[4]; //Left/Right speed + + sprite->data[3] = gBattleAnimArgs[2]; //Falling Speed + sprite->callback = SpriteCB_SteelRoller_Down; +} + +static void SpriteCB_SteelRoller_Down(struct Sprite *sprite) +{ + sprite->y2 += sprite->data[3]; + if (sprite->y2 >= 0) + { + sprite->y2 = 0; + sprite->callback = SpriteCB_SteelRoller_LeftRight; + } +} + +static void SpriteCB_SteelRoller_LeftRight(struct Sprite* sprite) +{ + sprite->data[0] = -sprite->data[4]; //Slice distance + sprite->data[1] = sprite->data[5]; //Slice speed + sprite->callback = SpriteCB_LeftRightSliceStep0; +} + +//Creates slashes that can be flipped. +//arg 0: x pixel offset (from target) +//arg 1: y pixel offset (from target) +//arg 2: flip x +//arg 3: flip y +static void SpriteCB_FlippableSlash(struct Sprite* sprite) +{ + InitSpritePosToAnimTarget(sprite, TRUE); + + if (gBattleAnimArgs[2]) //Flip X + sprite->hFlip = TRUE; + + if (gBattleAnimArgs[3]) //Flip Y + sprite->vFlip = TRUE; + + sprite->data[0] = 0; + sprite->data[1] = 0; + StoreSpriteCallbackInData6(sprite, AnimFalseSwipeSlice_Step3); + sprite->callback = RunStoredCallbackWhenAnimEnds; +} + +//Moves the balls for Dragon Energy sideways along the target side +//arg 0: Duration +static void SpriteCB_DragonEnergyShot(struct Sprite* sprite) +{ + s16 startingX, finishingX, y; + u8 def1 = gBattleAnimTarget; + u8 def2 = BATTLE_PARTNER(def1); + + if (!IsDoubleBattle() || IsAlly(gBattleAnimAttacker, gBattleAnimTarget)) + y = GetBattlerSpriteCoord(def1, BATTLER_COORD_Y_PIC_OFFSET); + else + { + y = 0; + + if (IsBattlerSpritePresent(def1)) + y = GetBattlerSpriteCoord(def1, BATTLER_COORD_Y_PIC_OFFSET); + + if (IsBattlerSpritePresent(def2)) + y += GetBattlerSpriteCoord(def2, BATTLER_COORD_Y_PIC_OFFSET); + + if (IsBattlerSpritePresent(def1) && IsBattlerSpritePresent(def2)) //Both targets are visible + y /= 2; + } + + if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_OPPONENT) + { + startingX = 0; + finishingX = 255; + } + else + { + startingX = 255; + finishingX = 0; + } + + sprite->x = startingX; + sprite->y = y; + sprite->x2 = 0; + sprite->data[0] = gBattleAnimArgs[0]; + sprite->data[2] = finishingX; + sprite->data[4] = y; + sprite->callback = StartAnimLinearTranslation; + StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix); +} + +//Moves the butterflies created in Max Flutterby +//arg 0: initial x pixel offset +//arg 1: initial y pixel offset +//arg 2: wave amplitude +static void SpriteCB_MaxFlutterby(struct Sprite* sprite) +{ + InitSpritePosToAnimAttacker(sprite, FALSE); + + sprite->data[0] = 0x10; //Speed delay + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); //Target X + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); //Target Y + sprite->data[5] = gBattleAnimArgs[2]; //Wave amplitude + + sprite->callback = SpriteCB_MaxFlutterbyStep1; +} + +//The butterflies prepare to move towards the target +static void SpriteCB_MaxFlutterbyStep1(struct Sprite* sprite) +{ + if (!FuncIsActiveTask(AnimTask_DynamaxGrowthStep)) + { + if (gAnimMoveIndex != MOVE_INFERNAL_PARADE) + PlaySE(SE_M_SAND_ATTACK); + + StartSpriteAffineAnim(sprite, 1); + InitAnimArcTranslation(sprite); + sprite->callback = SpriteCB_MaxFlutterbyStep2; + } +} + +//Destroys the butterflies when they reach the target +static void SpriteCB_MaxFlutterbyStep2(struct Sprite* sprite) +{ + sprite->invisible = FALSE; + + if (TranslateAnimHorizontalArc(sprite)) + { + if (gAnimMoveIndex == MOVE_INFERNAL_PARADE) + PlaySE(SE_M_FLAME_WHEEL2); + + DestroySpriteAndMatrix(sprite); + } +} + +//Moves the ice lance for Glacial Lance +//arg 0: initial x pixel offset (from attacker) +//arg 1: initial y pixel offset (from attacker) +//arg 2: target x pixel offset (from target) +//arg 3: target y pixel offset (from target) +//arg 4: distance moved up +//arg 5: pause in middle +//arg 6: duration to target +static void SpriteCB_GlacialLance(struct Sprite* sprite) +{ + u8 def1 = gBattleAnimTarget; + u8 def2 = BATTLE_PARTNER(def1); + + InitSpritePosToAnimAttacker(sprite, TRUE); + sprite->data[5] = gBattleAnimArgs[4]; + sprite->data[6] = gBattleAnimArgs[5]; + + sprite->data[0] = gBattleAnimArgs[6]; + + if (!IsDoubleBattle() || IsAlly(gBattleAnimAttacker, gBattleAnimTarget)) + { + sprite->data[2] = GetBattlerSpriteCoord(def1, BATTLER_COORD_X_2) + gBattleAnimArgs[2]; //Converge on target + sprite->data[4] = GetBattlerSpriteCoord(def1, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[3]; + } + else + { + sprite->data[2] = (GetBattlerSpriteCoord(def1, BATTLER_COORD_X_2) + GetBattlerSpriteCoord(def2, BATTLER_COORD_X_2)) / 2 + gBattleAnimArgs[2]; //Converge on target + sprite->data[4] = (GetBattlerSpriteCoord(def1, BATTLER_COORD_Y_PIC_OFFSET) + GetBattlerSpriteCoord(def2, BATTLER_COORD_Y_PIC_OFFSET)) / 2 + gBattleAnimArgs[3]; + } + + sprite->oam.priority = 1; //Above the ice cube + sprite->callback = SpriteCB_GlacialLance_Step1; +} + +static void SpriteCB_GlacialLance_Step1(struct Sprite* sprite) +{ + if (sprite->data[7]++ >= sprite->data[5]) + { + sprite->data[7] = 0; + sprite->callback = SpriteCB_GlacialLance_Step2; + } + else + --sprite->y; //Move up +} + +static void SpriteCB_GlacialLance_Step2(struct Sprite* sprite) +{ + if (sprite->data[7]++ >= sprite->data[6]) + { + if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER) + StartSpriteAffineAnim(sprite, 2); + else + StartSpriteAffineAnim(sprite, 1); + + sprite->data[5] = 0; + sprite->data[6] = 0; + sprite->data[7] = 0; + sprite->callback = StartAnimLinearTranslation; + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); + } +} + + +//Delivers a rainbow kick for Triple Arrows +//arg 0: Initial x pixel offset +//arg 1: Initial y pixel offset +//arg 2: Duration +//arg 3: Wave Amplitude +static void SpriteCB_TripleArrowKick(struct Sprite* sprite) +{ + InitSpritePosToAnimTarget(sprite, TRUE); + StartSpriteAnim(sprite, 1); //Feet + + sprite->data[0] = gBattleAnimArgs[2]; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); //Target X + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); //Target Y + sprite->data[5] = gBattleAnimArgs[3]; + + InitAnimArcTranslation(sprite); + sprite->callback = SpriteCB_PowerShiftBallStep; //Arc until complete +} diff --git a/src/battle_anim_normal.c b/src/battle_anim_normal.c index f43dd6e9b088..f710409229c9 100644 --- a/src/battle_anim_normal.c +++ b/src/battle_anim_normal.c @@ -794,7 +794,7 @@ static void AnimTask_FlashAnimTagWithColor_Step2(u8 taskId) if (!gPaletteFade.active) { selectedPalettes = 1 << (IndexOfSpritePaletteTag(gTasks[taskId].data[7]) + 16); - BeginNormalPaletteFade(selectedPalettes, 0, 0, 0, RGB(0, 0, 0)); + BeginNormalPaletteFade(selectedPalettes, 0, 0, 0, RGB_BLACK); DestroyAnimVisualTask(taskId); } } diff --git a/src/battle_anim_rock.c b/src/battle_anim_rock.c index 2257f9c04ad0..c1dc754c1f71 100644 --- a/src/battle_anim_rock.c +++ b/src/battle_anim_rock.c @@ -13,7 +13,6 @@ static void AnimTask_Rollout_Step(u8 taskId); static void AnimRolloutParticle(struct Sprite *); static void AnimRockTomb(struct Sprite *); static void AnimRockTomb_Step(struct Sprite *sprite); -static void AnimRockBlastRock(struct Sprite *); static void AnimRockScatter(struct Sprite *); static void AnimRockScatter_Step(struct Sprite *sprite); static void AnimParticleInVortex_Step(struct Sprite *sprite); @@ -921,7 +920,7 @@ static void AnimRockTomb_Step(struct Sprite *sprite) } } -static void AnimRockBlastRock(struct Sprite *sprite) +void AnimRockBlastRock(struct Sprite *sprite) { if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT) StartSpriteAffineAnim(sprite, 1); diff --git a/src/battle_anim_status_effects.c b/src/battle_anim_status_effects.c index da5cd346ef0f..b2a1378ac1e0 100644 --- a/src/battle_anim_status_effects.c +++ b/src/battle_anim_status_effects.c @@ -106,7 +106,7 @@ static const union AnimCmd sAnim_SpinningSparkle[] = ANIMCMD_END }; -const union AnimCmd *const sAnims_SpinningSparkle[] = +const union AnimCmd *const gAnims_SpinningSparkle[] = { sAnim_SpinningSparkle }; @@ -116,7 +116,7 @@ const struct SpriteTemplate gSpinningSparkleSpriteTemplate = .tileTag = ANIM_TAG_SPARKLE_4, .paletteTag = ANIM_TAG_SPARKLE_4, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = sAnims_SpinningSparkle, + .anims = gAnims_SpinningSparkle, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimSpinningSparkle, @@ -396,6 +396,36 @@ void AnimTask_FrozenIceCubeAttacker(u8 taskId) gTasks[taskId].func = AnimTask_FrozenIceCube_Step1; } +void AnimTask_CentredFrozenIceCube(u8 taskId) +{ + // same as AnimTask_FrozenIceCube but center position on target(s) + s16 x, y; + u8 spriteId; + u8 battler1 = gBattleAnimTarget; + u8 battler2 = BATTLE_PARTNER(battler1); + + if (!IsDoubleBattle() || IsAlly(gBattleAnimAttacker, gBattleAnimTarget)) + { + x = GetBattlerSpriteCoord(battler1, BATTLER_COORD_X_2); + y = GetBattlerSpriteCoord(battler1, BATTLER_COORD_Y_PIC_OFFSET); + } + else + { + x = (GetBattlerSpriteCoord(battler1, BATTLER_COORD_X_2) + GetBattlerSpriteCoord(battler2, BATTLER_COORD_X_2)) / 2; + y = (GetBattlerSpriteCoord(battler1, BATTLER_COORD_Y_PIC_OFFSET) + GetBattlerSpriteCoord(battler2, BATTLER_COORD_Y_PIC_OFFSET)) / 2; + } + + x -= 32; + y -= 36; + + spriteId = CreateSprite(&sFrozenIceCubeSpriteTemplate, x, y, 4); + if (GetSpriteTileStartByTag(ANIM_TAG_ICE_CUBE) == 0xFFFF) + gSprites[spriteId].invisible = TRUE; + + SetSubspriteTables(&gSprites[spriteId], sFrozenIceCubeSubspriteTable); + gTasks[taskId].data[15] = spriteId; + gTasks[taskId].func = AnimTask_FrozenIceCube_Step1; +} void AnimTask_FrozenIceCube(u8 taskId) { @@ -498,8 +528,6 @@ static void AnimTask_FrozenIceCube_Step4(u8 taskId) } } -#define CASE(by, stat) case (STAT_ANIM_##by + stat - 1) - void AnimTask_StatsChange(u8 taskId) { bool16 goesDown = FALSE; @@ -508,42 +536,42 @@ void AnimTask_StatsChange(u8 taskId) switch (gBattleSpritesDataPtr->animationData->animArg) { - CASE(PLUS1, STAT_ATK): goesDown = FALSE; animStatId = 0; break; - CASE(PLUS1, STAT_DEF): goesDown = FALSE; animStatId = 1; break; - CASE(PLUS1, STAT_SPEED): goesDown = FALSE; animStatId = 3; break; - CASE(PLUS1, STAT_SPATK): goesDown = FALSE; animStatId = 5; break; - CASE(PLUS1, STAT_SPDEF): goesDown = FALSE; animStatId = 6; break; - CASE(PLUS1, STAT_ACC): goesDown = FALSE; animStatId = 2; break; - CASE(PLUS1, STAT_EVASION): goesDown = FALSE; animStatId = 4; break; - - CASE(MINUS1, STAT_ATK): goesDown = TRUE; animStatId = 0; break; - CASE(MINUS1, STAT_DEF): goesDown = TRUE; animStatId = 1; break; - CASE(MINUS1, STAT_SPEED): goesDown = TRUE; animStatId = 3; break; - CASE(MINUS1, STAT_SPATK): goesDown = TRUE; animStatId = 5; break; - CASE(MINUS1, STAT_SPDEF): goesDown = TRUE; animStatId = 6; break; - CASE(MINUS1, STAT_ACC): goesDown = TRUE; animStatId = 2; break; - CASE(MINUS1, STAT_EVASION): goesDown = TRUE; animStatId = 4; break; - - CASE(PLUS2, STAT_ATK): goesDown = FALSE; animStatId = 0; sharply = TRUE; break; - CASE(PLUS2, STAT_DEF): goesDown = FALSE; animStatId = 1; sharply = TRUE; break; - CASE(PLUS2, STAT_SPEED): goesDown = FALSE; animStatId = 3; sharply = TRUE; break; - CASE(PLUS2, STAT_SPATK): goesDown = FALSE; animStatId = 5; sharply = TRUE; break; - CASE(PLUS2, STAT_SPDEF): goesDown = FALSE; animStatId = 6; sharply = TRUE; break; - CASE(PLUS2, STAT_ACC): goesDown = FALSE; animStatId = 2; sharply = TRUE; break; - CASE(PLUS2, STAT_EVASION): goesDown = FALSE; animStatId = 4; sharply = TRUE; break; - - CASE(MINUS2, STAT_ATK): goesDown = TRUE; animStatId = 0; sharply = TRUE; break; - CASE(MINUS2, STAT_DEF): goesDown = TRUE; animStatId = 1; sharply = TRUE; break; - CASE(MINUS2, STAT_SPEED): goesDown = TRUE; animStatId = 3; sharply = TRUE; break; - CASE(MINUS2, STAT_SPATK): goesDown = TRUE; animStatId = 5; sharply = TRUE; break; - CASE(MINUS2, STAT_SPDEF): goesDown = TRUE; animStatId = 6; sharply = TRUE; break; - CASE(MINUS2, STAT_ACC): goesDown = TRUE; animStatId = 2; sharply = TRUE; break; - CASE(MINUS2, STAT_EVASION): goesDown = TRUE; animStatId = 4; sharply = TRUE; break; - - case STAT_ANIM_MULTIPLE_PLUS1: goesDown = FALSE; animStatId = 0xFF; sharply = FALSE; break; - case STAT_ANIM_MULTIPLE_PLUS2: goesDown = FALSE; animStatId = 0xFF; sharply = TRUE; break; - case STAT_ANIM_MULTIPLE_MINUS1: goesDown = TRUE; animStatId = 0xFF; sharply = FALSE; break; - case STAT_ANIM_MULTIPLE_MINUS2: goesDown = TRUE; animStatId = 0xFF; sharply = TRUE; break; + case STAT_ANIM_PLUS1 + STAT_ATK: goesDown = FALSE; animStatId = STAT_ANIM_PAL_ATK; break; + case STAT_ANIM_PLUS1 + STAT_DEF: goesDown = FALSE; animStatId = STAT_ANIM_PAL_DEF; break; + case STAT_ANIM_PLUS1 + STAT_SPEED: goesDown = FALSE; animStatId = STAT_ANIM_PAL_SPEED; break; + case STAT_ANIM_PLUS1 + STAT_SPATK: goesDown = FALSE; animStatId = STAT_ANIM_PAL_SPATK; break; + case STAT_ANIM_PLUS1 + STAT_SPDEF: goesDown = FALSE; animStatId = STAT_ANIM_PAL_SPDEF; break; + case STAT_ANIM_PLUS1 + STAT_ACC: goesDown = FALSE; animStatId = STAT_ANIM_PAL_ACC; break; + case STAT_ANIM_PLUS1 + STAT_EVASION: goesDown = FALSE; animStatId = STAT_ANIM_PAL_EVASION; break; + + case STAT_ANIM_MINUS1 + STAT_ATK: goesDown = TRUE; animStatId = STAT_ANIM_PAL_ATK; break; + case STAT_ANIM_MINUS1 + STAT_DEF: goesDown = TRUE; animStatId = STAT_ANIM_PAL_DEF; break; + case STAT_ANIM_MINUS1 + STAT_SPEED: goesDown = TRUE; animStatId = STAT_ANIM_PAL_SPEED; break; + case STAT_ANIM_MINUS1 + STAT_SPATK: goesDown = TRUE; animStatId = STAT_ANIM_PAL_SPATK; break; + case STAT_ANIM_MINUS1 + STAT_SPDEF: goesDown = TRUE; animStatId = STAT_ANIM_PAL_SPDEF; break; + case STAT_ANIM_MINUS1 + STAT_ACC: goesDown = TRUE; animStatId = STAT_ANIM_PAL_ACC; break; + case STAT_ANIM_MINUS1 + STAT_EVASION: goesDown = TRUE; animStatId = STAT_ANIM_PAL_EVASION; break; + + case STAT_ANIM_PLUS2 + STAT_ATK: goesDown = FALSE; animStatId = STAT_ANIM_PAL_ATK; sharply = TRUE; break; + case STAT_ANIM_PLUS2 + STAT_DEF: goesDown = FALSE; animStatId = STAT_ANIM_PAL_DEF; sharply = TRUE; break; + case STAT_ANIM_PLUS2 + STAT_SPEED: goesDown = FALSE; animStatId = STAT_ANIM_PAL_SPEED; sharply = TRUE; break; + case STAT_ANIM_PLUS2 + STAT_SPATK: goesDown = FALSE; animStatId = STAT_ANIM_PAL_SPATK; sharply = TRUE; break; + case STAT_ANIM_PLUS2 + STAT_SPDEF: goesDown = FALSE; animStatId = STAT_ANIM_PAL_SPDEF; sharply = TRUE; break; + case STAT_ANIM_PLUS2 + STAT_ACC: goesDown = FALSE; animStatId = STAT_ANIM_PAL_ACC; sharply = TRUE; break; + case STAT_ANIM_PLUS2 + STAT_EVASION: goesDown = FALSE; animStatId = STAT_ANIM_PAL_EVASION; sharply = TRUE; break; + + case STAT_ANIM_MINUS2 + STAT_ATK: goesDown = TRUE; animStatId = STAT_ANIM_PAL_ATK; sharply = TRUE; break; + case STAT_ANIM_MINUS2 + STAT_DEF: goesDown = TRUE; animStatId = STAT_ANIM_PAL_DEF; sharply = TRUE; break; + case STAT_ANIM_MINUS2 + STAT_SPEED: goesDown = TRUE; animStatId = STAT_ANIM_PAL_SPEED; sharply = TRUE; break; + case STAT_ANIM_MINUS2 + STAT_SPATK: goesDown = TRUE; animStatId = STAT_ANIM_PAL_SPATK; sharply = TRUE; break; + case STAT_ANIM_MINUS2 + STAT_SPDEF: goesDown = TRUE; animStatId = STAT_ANIM_PAL_SPDEF; sharply = TRUE; break; + case STAT_ANIM_MINUS2 + STAT_ACC: goesDown = TRUE; animStatId = STAT_ANIM_PAL_ACC; sharply = TRUE; break; + case STAT_ANIM_MINUS2 + STAT_EVASION: goesDown = TRUE; animStatId = STAT_ANIM_PAL_EVASION; sharply = TRUE; break; + + case STAT_ANIM_MULTIPLE_PLUS1: goesDown = FALSE; animStatId = STAT_ANIM_PAL_MULTIPLE; sharply = FALSE; break; + case STAT_ANIM_MULTIPLE_PLUS2: goesDown = FALSE; animStatId = STAT_ANIM_PAL_MULTIPLE; sharply = TRUE; break; + case STAT_ANIM_MULTIPLE_MINUS1: goesDown = TRUE; animStatId = STAT_ANIM_PAL_MULTIPLE; sharply = FALSE; break; + case STAT_ANIM_MULTIPLE_MINUS2: goesDown = TRUE; animStatId = STAT_ANIM_PAL_MULTIPLE; sharply = TRUE; break; default: DestroyAnimVisualTask(taskId); @@ -552,11 +580,11 @@ void AnimTask_StatsChange(u8 taskId) gBattleAnimArgs[0] = goesDown; gBattleAnimArgs[1] = animStatId; - gBattleAnimArgs[2] = 0; - gBattleAnimArgs[3] = 0; + gBattleAnimArgs[2] = FALSE; // Whether it's the target, rather than attacker + gBattleAnimArgs[3] = FALSE; // Whether it hits multiple battlers gBattleAnimArgs[4] = sharply; gTasks[taskId].func = InitStatsChangeAnimation; - InitStatsChangeAnimation(taskId); + gTasks[taskId].func(taskId); } #undef CASE diff --git a/src/battle_anim_throw.c b/src/battle_anim_throw.c index 8f244717ac61..86e832e8ec6a 100644 --- a/src/battle_anim_throw.c +++ b/src/battle_anim_throw.c @@ -1574,12 +1574,12 @@ static void SpriteCB_Ball_Capture_Step(struct Sprite *sprite) if (sprite->sTimer == 40) { PlaySE(SE_RG_BALL_CLICK); - BlendPalettes(0x10000 << sprite->oam.paletteNum, 6, RGB(0, 0, 0)); + BlendPalettes(0x10000 << sprite->oam.paletteNum, 6, RGB_BLACK); MakeCaptureStars(sprite); } else if (sprite->sTimer == 60) { - BeginNormalPaletteFade(0x10000 << sprite->oam.paletteNum, 2, 6, 0, RGB(0, 0, 0)); + BeginNormalPaletteFade(0x10000 << sprite->oam.paletteNum, 2, 6, 0, RGB_BLACK); } else if (sprite->sTimer == 95) { @@ -1617,7 +1617,7 @@ static void SpriteCB_Ball_FadeOut(struct Sprite *sprite) SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL); SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 0)); paletteIndex = IndexOfSpritePaletteTag(sprite->template->paletteTag); - BeginNormalPaletteFade(1 << (paletteIndex + 0x10), 0, 0, 16, RGB(31, 31, 31)); + BeginNormalPaletteFade(1 << (paletteIndex + 0x10), 0, 0, 16, RGB_WHITE); sprite->sState++; break; case 1: @@ -2306,7 +2306,7 @@ u8 LaunchBallFadeMonTask(bool8 unfadeLater, u8 spritePalNum, u32 selectedPalette gTasks[taskId].func = Task_FadeMon_ToNormal; } - BeginNormalPaletteFade(selectedPalettes, 0, 0, 16, RGB(31, 31, 31)); + BeginNormalPaletteFade(selectedPalettes, 0, 0, 16, RGB_WHITE); return taskId; } @@ -2382,7 +2382,7 @@ void AnimTask_SwapMonSpriteToFromSubstitute(u8 taskId) gTasks[taskId].data[0] &= 0xFF; x = gSprites[spriteId].x + gSprites[spriteId].x2 + 32; - if (x > 304) + if (x > DISPLAY_WIDTH + 64) gTasks[taskId].data[10]++; break; case 1: diff --git a/src/battle_anim_utility_funcs.c b/src/battle_anim_utility_funcs.c index 4885a7ef371b..d49d645c07bb 100644 --- a/src/battle_anim_utility_funcs.c +++ b/src/battle_anim_utility_funcs.c @@ -16,7 +16,7 @@ struct AnimStatsChangeData { u8 battler1; u8 battler2; - u8 higherPriority; + bool8 hidBattler2; s16 data[8]; u16 species; }; @@ -133,11 +133,11 @@ void AnimTask_SetCamouflageBlend(u8 taskId) gBattleAnimArgs[4] = RGB(14, 9, 3); break; case BATTLE_TERRAIN_BUILDING: - gBattleAnimArgs[4] = RGB(31, 31, 31); + gBattleAnimArgs[4] = RGB_WHITE; break; case BATTLE_TERRAIN_PLAIN: default: - gBattleAnimArgs[4] = RGB(31, 31, 31); + gBattleAnimArgs[4] = RGB_WHITE; break; } @@ -389,12 +389,33 @@ static void AnimTask_DrawFallingWhiteLinesOnAttacker_Step(u8 taskId) } } +// Defines for data array in sAnimStatsChangeData +#define aDecrease data[0] +#define aAnimStatId data[1] +#define aIsTarget data[2] +#define aMultipleBattlers data[3] // Always false. Changes for multiple battlers are instead run sequentially. +#define aSharply data[4] + +// Task data defines for InitStatsChangeAnimation +#define tAnimSpriteId1 data[0] +#define tVelocity data[1] +#define tMultipleBattlers data[2] +#define tAnimSpriteId2 data[3] +#define tTargetBlend data[4] +#define tWaitTime data[5] +#define tHidBattler2 data[6] +#define tBattler2SpriteId data[7] +#define tWaitTimer data[10] +#define tFadeTimer data[11] +#define tBlend data[12] +#define tState data[15] + void InitStatsChangeAnimation(u8 taskId) { u8 i; sAnimStatsChangeData = AllocZeroed(sizeof(struct AnimStatsChangeData)); - for (i = 0; i < 8; i++) + for (i = 0; i < ARRAY_COUNT(sAnimStatsChangeData->data); i++) sAnimStatsChangeData->data[i] = gBattleAnimArgs[i]; gTasks[taskId].func = StatsChangeAnimation_Step1; @@ -402,21 +423,19 @@ void InitStatsChangeAnimation(u8 taskId) static void StatsChangeAnimation_Step1(u8 taskId) { - if (sAnimStatsChangeData->data[2] == 0) + if (!sAnimStatsChangeData->aIsTarget) sAnimStatsChangeData->battler1 = gBattleAnimAttacker; else sAnimStatsChangeData->battler1 = gBattleAnimTarget; sAnimStatsChangeData->battler2 = BATTLE_PARTNER(sAnimStatsChangeData->battler1); - if (IsContest() || (sAnimStatsChangeData->data[3] && !IsBattlerSpriteVisible(sAnimStatsChangeData->battler2))) - sAnimStatsChangeData->data[3] = 0; + if (IsContest() || (sAnimStatsChangeData->aMultipleBattlers && !IsBattlerSpriteVisible(sAnimStatsChangeData->battler2))) + sAnimStatsChangeData->aMultipleBattlers = FALSE; gBattle_WIN0H = 0; gBattle_WIN0V = 0; - SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR - | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR); - SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG0 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR - | WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR); + SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_ALL | WININ_WIN1_ALL); + SetGpuReg(REG_OFFSET_WINOUT, (WINOUT_WIN01_ALL & ~WINOUT_WIN01_BG1) | WINOUT_WINOBJ_ALL); SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJWIN_ON); SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND); SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16)); @@ -425,16 +444,17 @@ static void StatsChangeAnimation_Step1(u8 taskId) if (!IsContest()) SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1); - if (IsDoubleBattle() && sAnimStatsChangeData->data[3] == 0) + if (IsDoubleBattle() && !sAnimStatsChangeData->aMultipleBattlers) { if (GetBattlerPosition(sAnimStatsChangeData->battler1) == B_POSITION_OPPONENT_RIGHT || GetBattlerPosition(sAnimStatsChangeData->battler1) == B_POSITION_PLAYER_LEFT) { if (IsBattlerSpriteVisible(sAnimStatsChangeData->battler2) == TRUE) { - gSprites[gBattlerSpriteIds[sAnimStatsChangeData->battler2]].oam.priority -= 1; + // Push the battler not being animated back so it doesn't receive the animation. + gSprites[gBattlerSpriteIds[sAnimStatsChangeData->battler2]].oam.priority--; SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1); - sAnimStatsChangeData->higherPriority = 1; + sAnimStatsChangeData->hidBattler2 = TRUE; } } } @@ -463,79 +483,80 @@ static void StatsChangeAnimation_Step2(u8 taskId) spriteId2 = 0; battlerSpriteId = gBattlerSpriteIds[sAnimStatsChangeData->battler1]; spriteId = CreateInvisibleSpriteCopy(sAnimStatsChangeData->battler1, battlerSpriteId, sAnimStatsChangeData->species); - if (sAnimStatsChangeData->data[3]) + if (sAnimStatsChangeData->aMultipleBattlers) { battlerSpriteId = gBattlerSpriteIds[sAnimStatsChangeData->battler2]; spriteId2 = CreateInvisibleSpriteCopy(sAnimStatsChangeData->battler2, battlerSpriteId, sAnimStatsChangeData->species); } GetBattleAnimBg1Data(&animBgData); - if (sAnimStatsChangeData->data[0] == 0) - AnimLoadCompressedBgTilemapHandleContest(&animBgData, gBattleStatMask1_Tilemap, FALSE); + if (!sAnimStatsChangeData->aDecrease) + AnimLoadCompressedBgTilemapHandleContest(&animBgData, gStatAnim_Increase_Tilemap, FALSE); else - AnimLoadCompressedBgTilemapHandleContest(&animBgData, gBattleStatMask2_Tilemap, FALSE); + AnimLoadCompressedBgTilemapHandleContest(&animBgData, gStatAnim_Decrease_Tilemap, FALSE); - AnimLoadCompressedBgGfx(animBgData.bgId, gBattleStatMask_Gfx, animBgData.tilesOffset); - switch (sAnimStatsChangeData->data[1]) + AnimLoadCompressedBgGfx(animBgData.bgId, gStatAnim_Gfx, animBgData.tilesOffset); + switch (sAnimStatsChangeData->aAnimStatId) { - case 0: - LoadCompressedPalette(gBattleStatMask2_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP); + case STAT_ANIM_PAL_ATK: + LoadCompressedPalette(gStatAnim_Attack_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP); break; - case 1: - LoadCompressedPalette(gBattleStatMask1_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP); + case STAT_ANIM_PAL_DEF: + LoadCompressedPalette(gStatAnim_Defense_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP); break; - case 2: - LoadCompressedPalette(gBattleStatMask3_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP); + case STAT_ANIM_PAL_ACC: + LoadCompressedPalette(gStatAnim_Accuracy_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP); break; - case 3: - LoadCompressedPalette(gBattleStatMask4_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP); + case STAT_ANIM_PAL_SPEED: + LoadCompressedPalette(gStatAnim_Speed_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP); break; - case 4: - LoadCompressedPalette(gBattleStatMask6_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP); + case STAT_ANIM_PAL_EVASION: + LoadCompressedPalette(gStatAnim_Evasion_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP); break; - case 5: - LoadCompressedPalette(gBattleStatMask7_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP); + case STAT_ANIM_PAL_SPATK: + LoadCompressedPalette(gStatAnim_SpAttack_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP); break; - case 6: - LoadCompressedPalette(gBattleStatMask8_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP); + case STAT_ANIM_PAL_SPDEF: + LoadCompressedPalette(gStatAnim_SpDefense_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP); break; default: - LoadCompressedPalette(gBattleStatMask5_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP); + // case STAT_ANIM_PAL_MULTIPLE: + LoadCompressedPalette(gStatAnim_Multiple_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP); break; } gBattle_BG1_X = 0; gBattle_BG1_Y = 0; - if (sAnimStatsChangeData->data[0] == 1) + if (sAnimStatsChangeData->aDecrease == TRUE) { gBattle_BG1_X = 64; - gTasks[taskId].data[1] = -3; + gTasks[taskId].tVelocity = -3; } else { - gTasks[taskId].data[1] = 3; + gTasks[taskId].tVelocity = 3; } - if (sAnimStatsChangeData->data[4] == 0) + if (!sAnimStatsChangeData->aSharply) { - gTasks[taskId].data[4] = 10; - gTasks[taskId].data[5] = 20; + gTasks[taskId].tTargetBlend = 10; + gTasks[taskId].tWaitTime = 20; } else { - gTasks[taskId].data[4] = 13; - gTasks[taskId].data[5] = 30; + gTasks[taskId].tTargetBlend = 13; + gTasks[taskId].tWaitTime = 30; } - gTasks[taskId].data[0] = spriteId; - gTasks[taskId].data[2] = sAnimStatsChangeData->data[3]; - gTasks[taskId].data[3] = spriteId2; - gTasks[taskId].data[6] = sAnimStatsChangeData->higherPriority; - gTasks[taskId].data[7] = gBattlerSpriteIds[sAnimStatsChangeData->battler2]; + gTasks[taskId].tAnimSpriteId1 = spriteId; + gTasks[taskId].tMultipleBattlers = sAnimStatsChangeData->aMultipleBattlers; + gTasks[taskId].tAnimSpriteId2 = spriteId2; + gTasks[taskId].tHidBattler2 = sAnimStatsChangeData->hidBattler2; + gTasks[taskId].tBattler2SpriteId = gBattlerSpriteIds[sAnimStatsChangeData->battler2]; gTasks[taskId].func = StatsChangeAnimation_Step3; - if (sAnimStatsChangeData->data[0] == 0) + if (!sAnimStatsChangeData->aDecrease) PlaySE12WithPanning(SE_M_STAT_INCREASE, BattleAnimAdjustPanning2(SOUND_PAN_ATTACKER)); else PlaySE12WithPanning(SE_M_STAT_DECREASE, BattleAnimAdjustPanning2(SOUND_PAN_ATTACKER)); @@ -543,44 +564,46 @@ static void StatsChangeAnimation_Step2(u8 taskId) static void StatsChangeAnimation_Step3(u8 taskId) { - gBattle_BG1_Y += gTasks[taskId].data[1]; + gBattle_BG1_Y += gTasks[taskId].tVelocity; - switch (gTasks[taskId].data[15]) + switch (gTasks[taskId].tState) { case 0: - if (gTasks[taskId].data[11]++ > 0) + // Fade in + if (gTasks[taskId].tFadeTimer++ > 0) { - gTasks[taskId].data[11] = 0; - gTasks[taskId].data[12]++; - SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[12], 16 - gTasks[taskId].data[12])); - if (gTasks[taskId].data[12] == gTasks[taskId].data[4]) - gTasks[taskId].data[15]++; + gTasks[taskId].tFadeTimer = 0; + gTasks[taskId].tBlend++; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].tBlend, 16 - gTasks[taskId].tBlend)); + if (gTasks[taskId].tBlend == gTasks[taskId].tTargetBlend) + gTasks[taskId].tState++; } break; case 1: - if (++gTasks[taskId].data[10] == gTasks[taskId].data[5]) - gTasks[taskId].data[15]++; + // Wait + if (++gTasks[taskId].tWaitTimer == gTasks[taskId].tWaitTime) + gTasks[taskId].tState++; break; case 2: - if (gTasks[taskId].data[11]++ > 0) + // Fade out + if (gTasks[taskId].tFadeTimer++ > 0) { - gTasks[taskId].data[11] = 0; - gTasks[taskId].data[12]--; - SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[12], 16 - gTasks[taskId].data[12])); - if (gTasks[taskId].data[12] == 0) + gTasks[taskId].tFadeTimer = 0; + gTasks[taskId].tBlend--; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].tBlend, 16 - gTasks[taskId].tBlend)); + if (gTasks[taskId].tBlend == 0) { ResetBattleAnimBg(FALSE); - gTasks[taskId].data[15]++; + gTasks[taskId].tState++; } } break; case 3: + // Reset gBattle_WIN0H = 0; gBattle_WIN0V = 0; - SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR - | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR); - SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR - | WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR); + SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_ALL | WININ_WIN1_ALL); + SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_ALL | WINOUT_WINOBJ_ALL); if (!IsContest()) SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 0); @@ -588,12 +611,14 @@ static void StatsChangeAnimation_Step3(u8 taskId) SetGpuReg(REG_OFFSET_DISPCNT, GetGpuReg(REG_OFFSET_DISPCNT) ^ DISPCNT_OBJWIN_ON); SetGpuReg(REG_OFFSET_BLDCNT, 0); SetGpuReg(REG_OFFSET_BLDALPHA, 0); - DestroySprite(&gSprites[gTasks[taskId].data[0]]); - if (gTasks[taskId].data[2]) - DestroySprite(&gSprites[gTasks[taskId].data[3]]); - if (gTasks[taskId].data[6] == 1) - gSprites[gTasks[taskId].data[7]].oam.priority++; + DestroySprite(&gSprites[gTasks[taskId].tAnimSpriteId1]); + if (gTasks[taskId].tMultipleBattlers) + DestroySprite(&gSprites[gTasks[taskId].tAnimSpriteId2]); + + // Restore battler 2's priority + if (gTasks[taskId].tHidBattler2 == TRUE) + gSprites[gTasks[taskId].tBattler2SpriteId].oam.priority++; FREE_AND_SET_NULL(sAnimStatsChangeData); DestroyAnimVisualTask(taskId); @@ -601,6 +626,24 @@ static void StatsChangeAnimation_Step3(u8 taskId) } } +#undef aDecrease +#undef aAnimStatId +#undef aIsTarget +#undef aMultipleBattlers +#undef aSharply +#undef tAnimSpriteId1 +#undef tVelocity +#undef tMultipleBattlers +#undef tAnimSpriteId2 +#undef tTargetBlend +#undef tWaitTime +#undef tHidBattler2 +#undef tBattler2SpriteId +#undef tWaitTimer +#undef tFadeTimer +#undef tBlend +#undef tState + void AnimTask_Flash(u8 taskId) { u32 selectedPalettes = GetBattleMonSpritePalettesMask(1, 1, 1, 1); diff --git a/src/battle_arena.c b/src/battle_arena.c index de34b423f698..37c7406ce131 100644 --- a/src/battle_arena.c +++ b/src/battle_arena.c @@ -531,7 +531,7 @@ static void SetArenaData(void) static void SaveArenaChallenge(void) { gSaveBlock2Ptr->frontier.challengeStatus = gSpecialVar_0x8005; - VarSet(VAR_TEMP_0, 0); + VarSet(VAR_TEMP_CHALLENGE_STATUS, 0); gSaveBlock2Ptr->frontier.challengePaused = TRUE; SaveGameFrontier(); } diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index b4936da5c20c..3a3cb7e8ce33 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -29,205 +29,126 @@ #include "constants/trainers.h" #include "recorded_battle.h" -static void LinkOpponentHandleGetMonData(void); -static void LinkOpponentHandleGetRawMonData(void); -static void LinkOpponentHandleSetMonData(void); -static void LinkOpponentHandleSetRawMonData(void); -static void LinkOpponentHandleLoadMonSprite(void); -static void LinkOpponentHandleSwitchInAnim(void); -static void LinkOpponentHandleReturnMonToBall(void); -static void LinkOpponentHandleDrawTrainerPic(void); -static void LinkOpponentHandleTrainerSlide(void); -static void LinkOpponentHandleTrainerSlideBack(void); -static void LinkOpponentHandleFaintAnimation(void); -static void LinkOpponentHandlePaletteFade(void); -static void LinkOpponentHandleSuccessBallThrowAnim(void); -static void LinkOpponentHandleBallThrowAnim(void); -static void LinkOpponentHandlePause(void); -static void LinkOpponentHandleMoveAnimation(void); -static void LinkOpponentHandlePrintString(void); -static void LinkOpponentHandlePrintSelectionString(void); -static void LinkOpponentHandleChooseAction(void); -static void LinkOpponentHandleYesNoBox(void); -static void LinkOpponentHandleChooseMove(void); -static void LinkOpponentHandleChooseItem(void); -static void LinkOpponentHandleChoosePokemon(void); -static void LinkOpponentHandleCmd23(void); -static void LinkOpponentHandleHealthBarUpdate(void); -static void LinkOpponentHandleExpUpdate(void); -static void LinkOpponentHandleStatusIconUpdate(void); -static void LinkOpponentHandleStatusAnimation(void); -static void LinkOpponentHandleStatusXor(void); -static void LinkOpponentHandleDataTransfer(void); -static void LinkOpponentHandleDMA3Transfer(void); -static void LinkOpponentHandlePlayBGM(void); -static void LinkOpponentHandleCmd32(void); -static void LinkOpponentHandleTwoReturnValues(void); -static void LinkOpponentHandleChosenMonReturnValue(void); -static void LinkOpponentHandleOneReturnValue(void); -static void LinkOpponentHandleOneReturnValue_Duplicate(void); -static void LinkOpponentHandleClearUnkVar(void); -static void LinkOpponentHandleSetUnkVar(void); -static void LinkOpponentHandleClearUnkFlag(void); -static void LinkOpponentHandleToggleUnkFlag(void); -static void LinkOpponentHandleHitAnimation(void); -static void LinkOpponentHandleCantSwitch(void); -static void LinkOpponentHandlePlaySE(void); -static void LinkOpponentHandlePlayFanfareOrBGM(void); -static void LinkOpponentHandleFaintingCry(void); -static void LinkOpponentHandleIntroSlide(void); -static void LinkOpponentHandleIntroTrainerBallThrow(void); -static void LinkOpponentHandleDrawPartyStatusSummary(void); -static void LinkOpponentHandleHidePartyStatusSummary(void); -static void LinkOpponentHandleEndBounceEffect(void); -static void LinkOpponentHandleSpriteInvisibility(void); -static void LinkOpponentHandleBattleAnimation(void); -static void LinkOpponentHandleLinkStandbyMsg(void); -static void LinkOpponentHandleResetActionMoveSelection(void); -static void LinkOpponentHandleEndLinkBattle(void); -static void LinkOpponentHandleBattleDebug(void); -static void LinkOpponentCmdEnd(void); - -static void LinkOpponentBufferRunCommand(void); -static void LinkOpponentBufferExecCompleted(void); -static void SwitchIn_HandleSoundAndEnd(void); -static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst); -static void SetLinkOpponentMonData(u8 monId); -static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit); -static void DoSwitchOutAnimation(void); -static void LinkOpponentDoMoveAnimation(void); -static void Task_StartSendOutAnim(u8 taskId); -static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite); -static void EndDrawPartyStatusSummary(void); - -static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = -{ - [CONTROLLER_GETMONDATA] = LinkOpponentHandleGetMonData, - [CONTROLLER_GETRAWMONDATA] = LinkOpponentHandleGetRawMonData, - [CONTROLLER_SETMONDATA] = LinkOpponentHandleSetMonData, - [CONTROLLER_SETRAWMONDATA] = LinkOpponentHandleSetRawMonData, +static void LinkOpponentHandleLoadMonSprite(u32 battler); +static void LinkOpponentHandleSwitchInAnim(u32 battler); +static void LinkOpponentHandleDrawTrainerPic(u32 battler); +static void LinkOpponentHandleTrainerSlide(u32 battler); +static void LinkOpponentHandleTrainerSlideBack(u32 battler); +static void LinkOpponentHandleMoveAnimation(u32 battler); +static void LinkOpponentHandlePrintString(u32 battler); +static void LinkOpponentHandleHealthBarUpdate(u32 battler); +static void LinkOpponentHandleIntroTrainerBallThrow(u32 battler); +static void LinkOpponentHandleDrawPartyStatusSummary(u32 battler); +static void LinkOpponentHandleBattleAnimation(u32 battler); +static void LinkOpponentHandleLinkStandbyMsg(u32 battler); +static void LinkOpponentHandleEndLinkBattle(u32 battler); + +static void LinkOpponentBufferRunCommand(u32 battler); +static void LinkOpponentBufferExecCompleted(u32 battler); +static void SwitchIn_HandleSoundAndEnd(u32 battler); + +static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(u32 battler) = +{ + [CONTROLLER_GETMONDATA] = BtlController_HandleGetMonData, + [CONTROLLER_GETRAWMONDATA] = BtlController_Empty, + [CONTROLLER_SETMONDATA] = BtlController_HandleSetMonData, + [CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData, [CONTROLLER_LOADMONSPRITE] = LinkOpponentHandleLoadMonSprite, [CONTROLLER_SWITCHINANIM] = LinkOpponentHandleSwitchInAnim, - [CONTROLLER_RETURNMONTOBALL] = LinkOpponentHandleReturnMonToBall, + [CONTROLLER_RETURNMONTOBALL] = BtlController_HandleReturnMonToBall, [CONTROLLER_DRAWTRAINERPIC] = LinkOpponentHandleDrawTrainerPic, [CONTROLLER_TRAINERSLIDE] = LinkOpponentHandleTrainerSlide, [CONTROLLER_TRAINERSLIDEBACK] = LinkOpponentHandleTrainerSlideBack, - [CONTROLLER_FAINTANIMATION] = LinkOpponentHandleFaintAnimation, - [CONTROLLER_PALETTEFADE] = LinkOpponentHandlePaletteFade, - [CONTROLLER_SUCCESSBALLTHROWANIM] = LinkOpponentHandleSuccessBallThrowAnim, - [CONTROLLER_BALLTHROWANIM] = LinkOpponentHandleBallThrowAnim, - [CONTROLLER_PAUSE] = LinkOpponentHandlePause, + [CONTROLLER_FAINTANIMATION] = BtlController_HandleFaintAnimation, + [CONTROLLER_PALETTEFADE] = BtlController_Empty, + [CONTROLLER_SUCCESSBALLTHROWANIM] = BtlController_Empty, + [CONTROLLER_BALLTHROWANIM] = BtlController_Empty, + [CONTROLLER_PAUSE] = BtlController_Empty, [CONTROLLER_MOVEANIMATION] = LinkOpponentHandleMoveAnimation, [CONTROLLER_PRINTSTRING] = LinkOpponentHandlePrintString, - [CONTROLLER_PRINTSTRINGPLAYERONLY] = LinkOpponentHandlePrintSelectionString, - [CONTROLLER_CHOOSEACTION] = LinkOpponentHandleChooseAction, - [CONTROLLER_YESNOBOX] = LinkOpponentHandleYesNoBox, - [CONTROLLER_CHOOSEMOVE] = LinkOpponentHandleChooseMove, - [CONTROLLER_OPENBAG] = LinkOpponentHandleChooseItem, - [CONTROLLER_CHOOSEPOKEMON] = LinkOpponentHandleChoosePokemon, - [CONTROLLER_23] = LinkOpponentHandleCmd23, + [CONTROLLER_PRINTSTRINGPLAYERONLY] = BtlController_Empty, + [CONTROLLER_CHOOSEACTION] = BtlController_Empty, + [CONTROLLER_YESNOBOX] = BtlController_Empty, + [CONTROLLER_CHOOSEMOVE] = BtlController_Empty, + [CONTROLLER_OPENBAG] = BtlController_Empty, + [CONTROLLER_CHOOSEPOKEMON] = BtlController_Empty, + [CONTROLLER_23] = BtlController_Empty, [CONTROLLER_HEALTHBARUPDATE] = LinkOpponentHandleHealthBarUpdate, - [CONTROLLER_EXPUPDATE] = LinkOpponentHandleExpUpdate, - [CONTROLLER_STATUSICONUPDATE] = LinkOpponentHandleStatusIconUpdate, - [CONTROLLER_STATUSANIMATION] = LinkOpponentHandleStatusAnimation, - [CONTROLLER_STATUSXOR] = LinkOpponentHandleStatusXor, - [CONTROLLER_DATATRANSFER] = LinkOpponentHandleDataTransfer, - [CONTROLLER_DMA3TRANSFER] = LinkOpponentHandleDMA3Transfer, - [CONTROLLER_PLAYBGM] = LinkOpponentHandlePlayBGM, - [CONTROLLER_32] = LinkOpponentHandleCmd32, - [CONTROLLER_TWORETURNVALUES] = LinkOpponentHandleTwoReturnValues, - [CONTROLLER_CHOSENMONRETURNVALUE] = LinkOpponentHandleChosenMonReturnValue, - [CONTROLLER_ONERETURNVALUE] = LinkOpponentHandleOneReturnValue, - [CONTROLLER_ONERETURNVALUE_DUPLICATE] = LinkOpponentHandleOneReturnValue_Duplicate, - [CONTROLLER_CLEARUNKVAR] = LinkOpponentHandleClearUnkVar, - [CONTROLLER_SETUNKVAR] = LinkOpponentHandleSetUnkVar, - [CONTROLLER_CLEARUNKFLAG] = LinkOpponentHandleClearUnkFlag, - [CONTROLLER_TOGGLEUNKFLAG] = LinkOpponentHandleToggleUnkFlag, - [CONTROLLER_HITANIMATION] = LinkOpponentHandleHitAnimation, - [CONTROLLER_CANTSWITCH] = LinkOpponentHandleCantSwitch, - [CONTROLLER_PLAYSE] = LinkOpponentHandlePlaySE, - [CONTROLLER_PLAYFANFAREORBGM] = LinkOpponentHandlePlayFanfareOrBGM, - [CONTROLLER_FAINTINGCRY] = LinkOpponentHandleFaintingCry, - [CONTROLLER_INTROSLIDE] = LinkOpponentHandleIntroSlide, + [CONTROLLER_EXPUPDATE] = BtlController_Empty, + [CONTROLLER_STATUSICONUPDATE] = BtlController_HandleStatusIconUpdate, + [CONTROLLER_STATUSANIMATION] = BtlController_HandleStatusAnimation, + [CONTROLLER_STATUSXOR] = BtlController_Empty, + [CONTROLLER_DATATRANSFER] = BtlController_Empty, + [CONTROLLER_DMA3TRANSFER] = BtlController_Empty, + [CONTROLLER_PLAYBGM] = BtlController_Empty, + [CONTROLLER_32] = BtlController_Empty, + [CONTROLLER_TWORETURNVALUES] = BtlController_Empty, + [CONTROLLER_CHOSENMONRETURNVALUE] = BtlController_Empty, + [CONTROLLER_ONERETURNVALUE] = BtlController_Empty, + [CONTROLLER_ONERETURNVALUE_DUPLICATE] = BtlController_Empty, + [CONTROLLER_CLEARUNKVAR] = BtlController_HandleClearUnkVar, + [CONTROLLER_SETUNKVAR] = BtlController_HandleSetUnkVar, + [CONTROLLER_CLEARUNKFLAG] = BtlController_HandleClearUnkFlag, + [CONTROLLER_TOGGLEUNKFLAG] = BtlController_HandleToggleUnkFlag, + [CONTROLLER_HITANIMATION] = BtlController_HandleHitAnimation, + [CONTROLLER_CANTSWITCH] = BtlController_Empty, + [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, + [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, + [CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry, + [CONTROLLER_INTROSLIDE] = BtlController_HandleIntroSlide, [CONTROLLER_INTROTRAINERBALLTHROW] = LinkOpponentHandleIntroTrainerBallThrow, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = LinkOpponentHandleDrawPartyStatusSummary, - [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = LinkOpponentHandleHidePartyStatusSummary, - [CONTROLLER_ENDBOUNCE] = LinkOpponentHandleEndBounceEffect, - [CONTROLLER_SPRITEINVISIBILITY] = LinkOpponentHandleSpriteInvisibility, + [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = BtlController_HandleHidePartyStatusSummary, + [CONTROLLER_ENDBOUNCE] = BtlController_Empty, + [CONTROLLER_SPRITEINVISIBILITY] = BtlController_HandleSpriteInvisibility, [CONTROLLER_BATTLEANIMATION] = LinkOpponentHandleBattleAnimation, [CONTROLLER_LINKSTANDBYMSG] = LinkOpponentHandleLinkStandbyMsg, - [CONTROLLER_RESETACTIONMOVESELECTION] = LinkOpponentHandleResetActionMoveSelection, + [CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty, [CONTROLLER_ENDLINKBATTLE] = LinkOpponentHandleEndLinkBattle, - [CONTROLLER_DEBUGMENU] = LinkOpponentHandleBattleDebug, - [CONTROLLER_TERMINATOR_NOP] = LinkOpponentCmdEnd + [CONTROLLER_DEBUGMENU] = BtlController_Empty, + [CONTROLLER_TERMINATOR_NOP] = BtlController_TerminatorNop }; -static void LinkOpponentDummy(void) -{ -} - -void SetControllerToLinkOpponent(void) +void SetControllerToLinkOpponent(u32 battler) { - gBattlerControllerFuncs[gActiveBattler] = LinkOpponentBufferRunCommand; + gBattlerControllerEndFuncs[battler] = LinkOpponentBufferExecCompleted; + gBattlerControllerFuncs[battler] = LinkOpponentBufferRunCommand; } -static void LinkOpponentBufferRunCommand(void) +static void LinkOpponentBufferRunCommand(u32 battler) { - if (gBattleControllerExecFlags & gBitTable[gActiveBattler]) + if (gBattleControllerExecFlags & gBitTable[battler]) { - if (gBattleResources->bufferA[gActiveBattler][0] < ARRAY_COUNT(sLinkOpponentBufferCommands)) - sLinkOpponentBufferCommands[gBattleResources->bufferA[gActiveBattler][0]](); + if (gBattleResources->bufferA[battler][0] < ARRAY_COUNT(sLinkOpponentBufferCommands)) + sLinkOpponentBufferCommands[gBattleResources->bufferA[battler][0]](battler); else - LinkOpponentBufferExecCompleted(); + LinkOpponentBufferExecCompleted(battler); } } -static void CompleteOnBattlerSpriteCallbackDummy(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - LinkOpponentBufferExecCompleted(); -} - -static void CompleteOnBankSpriteCallbackDummy2(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - LinkOpponentBufferExecCompleted(); -} - -static void FreeTrainerSpriteAfterSlide(void) +static void Intro_DelayAndEnd(u32 battler) { - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (--gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay == (u8)-1) { - FreeTrainerFrontPicPalette(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam); - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - LinkOpponentBufferExecCompleted(); + gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay = 0; + LinkOpponentBufferExecCompleted(battler); } } -static void Intro_DelayAndEnd(void) -{ - if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay == (u8)-1) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0; - LinkOpponentBufferExecCompleted(); - } -} - -static void Intro_WaitForShinyAnimAndHealthbox(void) +static void Intro_WaitForShinyAnimAndHealthbox(u32 battler) { bool32 healthboxAnimDone = FALSE; bool32 twoMons = FALSE; if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy) healthboxAnimDone = TRUE; } else { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy + && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(battler)]].callback == SpriteCallbackDummy) { healthboxAnimDone = TRUE; } @@ -236,88 +157,87 @@ static void Intro_WaitForShinyAnimAndHealthbox(void) if (healthboxAnimDone) { - if (twoMons || !IsBattlerSpriteVisible(BATTLE_PARTNER(gActiveBattler))) + if (twoMons || !IsBattlerSpriteVisible(BATTLE_PARTNER(battler))) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim) return; - if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) + if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].finishedShinyMonAnim) return; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); } else { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim) return; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE; - if (GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT) + if (GetBattlerPosition(battler) == B_POSITION_OPPONENT_RIGHT) { FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); } } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; - gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; + gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay = 3; + gBattlerControllerFuncs[battler] = Intro_DelayAndEnd; } } -static void Intro_TryShinyAnimShowHealthbox(void) +static void Intro_TryShinyAnimShowHealthbox(u32 battler) { bool32 bgmRestored = FALSE; - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive + && !gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim) { - TryShinyAnimation(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); + TryShinyAnimation(battler, &gEnemyParty[gBattlerPartyIndexes[battler]]); } if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].ballAnimActive + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].finishedShinyMonAnim) { - TryShinyAnimation(BATTLE_PARTNER(gActiveBattler), &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]); + TryShinyAnimation(BATTLE_PARTNER(battler), &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]]); } - - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].ballAnimActive) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].healthboxSlideInStarted) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); - StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(battler)], &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]], HEALTHBOX_ALL); + StartHealthboxSlideIn(BATTLE_PARTNER(battler)); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(battler)]); } - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], &gEnemyParty[gBattlerPartyIndexes[battler]], HEALTHBOX_ALL); + StartHealthboxSlideIn(battler); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[battler]); } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = TRUE; + gBattleSpritesDataPtr->healthBoxesData[battler].healthboxSlideInStarted = TRUE; } - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry - && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].waitForCry + if (!gBattleSpritesDataPtr->healthBoxesData[battler].waitForCry + && gBattleSpritesDataPtr->healthBoxesData[battler].healthboxSlideInStarted + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].waitForCry && !IsCryPlayingOrClearCrySongs()) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].bgmRestored) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) { - if (GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_LEFT) + if (GetBattlerPosition(battler) == B_POSITION_OPPONENT_LEFT) m4aMPlayContinue(&gMPlayInfo_BGM); } else @@ -326,937 +246,189 @@ static void Intro_TryShinyAnimShowHealthbox(void) } } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = TRUE; + gBattleSpritesDataPtr->healthBoxesData[battler].bgmRestored = TRUE; bgmRestored = TRUE; } if (bgmRestored) { - if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattleControllerData[battler]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy) { - if (gBattleTypeFlags & BATTLE_TYPE_MULTI && GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT) + if (gBattleTypeFlags & BATTLE_TYPE_MULTI && GetBattlerPosition(battler) == B_POSITION_OPPONENT_RIGHT) { - if (++gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay == 1) + if (++gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay == 1) return; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0; + gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay = 0; } if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); - SetBattlerShadowSpriteCallback(BATTLE_PARTNER(gActiveBattler), GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], MON_DATA_SPECIES)); + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(battler)]]); + SetBattlerShadowSpriteCallback(BATTLE_PARTNER(battler), GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]], MON_DATA_SPECIES)); } - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); - SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); + DestroySprite(&gSprites[gBattleControllerData[battler]]); + SetBattlerShadowSpriteCallback(battler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES)); gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].bgmRestored = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].healthboxSlideInStarted = FALSE; - gBattlerControllerFuncs[gActiveBattler] = Intro_WaitForShinyAnimAndHealthbox; + gBattlerControllerFuncs[battler] = Intro_WaitForShinyAnimAndHealthbox; } } } -static void TryShinyAnimAfterMonAnim(void) +static void TryShinyAnimAfterMonAnim(u32 battler) { - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[gActiveBattler]].x2 == 0) + if (gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[battler]].x2 == 0) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim) { - TryShinyAnimation(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); + TryShinyAnimation(battler, &gEnemyParty[gBattlerPartyIndexes[battler]]); } - else if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) + else if (gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); - LinkOpponentBufferExecCompleted(); + LinkOpponentBufferExecCompleted(battler); } } } -static void CompleteOnHealthbarDone(void) -{ - s16 hpValue = MoveBattleBar(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0); - - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - - if (hpValue != -1) - UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], HP_CURRENT, hpValue, gBattleMons[gActiveBattler].maxHP); - else - LinkOpponentBufferExecCompleted(); -} - -static void HideHealthboxAfterMonFaint(void) -{ - if (!gSprites[gBattlerSpriteIds[gActiveBattler]].inUse) - { - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - LinkOpponentBufferExecCompleted(); - } -} - -static void FreeMonSpriteAfterSwitchOutAnim(void) -{ - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - HideBattlerShadowSprite(gActiveBattler); - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - LinkOpponentBufferExecCompleted(); - } -} - -static void CompleteOnInactiveTextPrinter(void) -{ - if (!IsTextPrinterActive(B_WIN_MSG)) - LinkOpponentBufferExecCompleted(); -} - -static void DoHitAnimBlinkSpriteEffect(void) -{ - u8 spriteId = gBattlerSpriteIds[gActiveBattler]; - - if (gSprites[spriteId].data[1] == 32) - { - gSprites[spriteId].data[1] = 0; - gSprites[spriteId].invisible = FALSE; - gDoingBattleAnim = FALSE; - LinkOpponentBufferExecCompleted(); - } - else - { - if ((gSprites[spriteId].data[1] % 4) == 0) - gSprites[spriteId].invisible ^= 1; - gSprites[spriteId].data[1]++; - } -} - -static void SwitchIn_ShowSubstitute(void) +static void SwitchIn_ShowSubstitute(u32 battler) { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy) { - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); + if (gBattleSpritesDataPtr->battlerData[battler].behindSubstitute) + InitAndLaunchSpecialAnimation(battler, battler, battler, B_ANIM_MON_TO_SUBSTITUTE); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_HandleSoundAndEnd; + gBattlerControllerFuncs[battler] = SwitchIn_HandleSoundAndEnd; } } -static void SwitchIn_HandleSoundAndEnd(void) +static void SwitchIn_HandleSoundAndEnd(u32 battler) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive && !IsCryPlayingOrClearCrySongs()) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].specialAnimActive && !IsCryPlayingOrClearCrySongs()) { - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - || gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy_2) + if (gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy + || gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy_2) { m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 0x100); - LinkOpponentBufferExecCompleted(); + LinkOpponentBufferExecCompleted(battler); } } } -static void SwitchIn_ShowHealthbox(void) +static void SwitchIn_ShowHealthbox(u32 battler) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim - && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim + && gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); - StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[battler]], 0); - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - CopyBattleSpriteInvisibility(gActiveBattler); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowSubstitute; + UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], &gEnemyParty[gBattlerPartyIndexes[battler]], HEALTHBOX_ALL); + StartHealthboxSlideIn(battler); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[battler]); + CopyBattleSpriteInvisibility(battler); + gBattlerControllerFuncs[battler] = SwitchIn_ShowSubstitute; } } -static void SwitchIn_TryShinyAnim(void) +static void SwitchIn_TryShinyAnim(u32 battler) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive + && !gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim) { - TryShinyAnimation(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); + TryShinyAnimation(battler, &gEnemyParty[gBattlerPartyIndexes[battler]]); } - if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) + if (gSprites[gBattleControllerData[battler]].callback == SpriteCallbackDummy + && !gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive) { - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); - SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowHealthbox; + DestroySprite(&gSprites[gBattleControllerData[battler]]); + SetBattlerShadowSpriteCallback(battler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES)); + gBattlerControllerFuncs[battler] = SwitchIn_ShowHealthbox; } } -static void CompleteOnFinishedStatusAnimation(void) +static void LinkOpponentBufferExecCompleted(u32 battler) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].statusAnimActive) - LinkOpponentBufferExecCompleted(); -} - -static void CompleteOnFinishedBattleAnimation(void) -{ - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive) - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentBufferExecCompleted(void) -{ - gBattlerControllerFuncs[gActiveBattler] = LinkOpponentBufferRunCommand; + gBattlerControllerFuncs[battler] = LinkOpponentBufferRunCommand; if (gBattleTypeFlags & BATTLE_TYPE_LINK) { u8 playerId = GetMultiplayerId(); - PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleResources->bufferA[gActiveBattler][0] = CONTROLLER_TERMINATOR_NOP; - } - else - { - gBattleControllerExecFlags &= ~gBitTable[gActiveBattler]; - } -} - -static void LinkOpponentHandleGetMonData(void) -{ - u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data - u32 size = 0; - u8 monToCheck; - s32 i; - - if (gBattleResources->bufferA[gActiveBattler][2] == 0) - { - size += CopyLinkOpponentMonData(gBattlerPartyIndexes[gActiveBattler], monData); - } - else - { - monToCheck = gBattleResources->bufferA[gActiveBattler][2]; - for (i = 0; i < PARTY_SIZE; i++) - { - if (monToCheck & 1) - size += CopyLinkOpponentMonData(i, monData + size); - monToCheck >>= 1; - } - } - BtlController_EmitDataTransfer(BUFFER_B, size, monData); - LinkOpponentBufferExecCompleted(); -} - -static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst) -{ - struct BattlePokemon battleMon; - struct MovePpInfo moveData; - u8 nickname[20]; - u8 *src; - s16 data16; - u32 data32; - s32 size = 0; - - switch (gBattleResources->bufferA[gActiveBattler][1]) - { - case REQUEST_ALL_BATTLE: - battleMon.species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES); - battleMon.item = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM); - for (size = 0; size < MAX_MON_MOVES; size++) - { - battleMon.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size); - battleMon.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); - } - battleMon.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); - battleMon.friendship = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP); - battleMon.experience = GetMonData(&gEnemyParty[monId], MON_DATA_EXP); - battleMon.hpIV = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); - battleMon.attackIV = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); - battleMon.defenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); - battleMon.speedIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); - battleMon.spAttackIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); - battleMon.spDefenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); - battleMon.personality = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY); - battleMon.status1 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS); - battleMon.level = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL); - battleMon.hp = GetMonData(&gEnemyParty[monId], MON_DATA_HP); - battleMon.maxHP = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP); - battleMon.attack = GetMonData(&gEnemyParty[monId], MON_DATA_ATK); - battleMon.defense = GetMonData(&gEnemyParty[monId], MON_DATA_DEF); - battleMon.speed = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED); - battleMon.spAttack = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK); - battleMon.spDefense = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF); - battleMon.abilityNum = GetMonData(&gEnemyParty[monId], MON_DATA_ABILITY_NUM); - battleMon.otId = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID); - battleMon.metLevel = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL); - GetMonData(&gEnemyParty[monId], MON_DATA_NICKNAME, nickname); - StringCopy_Nickname(battleMon.nickname, nickname); - GetMonData(&gEnemyParty[monId], MON_DATA_OT_NAME, battleMon.otName); - src = (u8 *)&battleMon; - for (size = 0; size < sizeof(battleMon); size++) - dst[size] = src[size]; - break; - case REQUEST_SPECIES_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_HELDITEM_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_MOVES_PP_BATTLE: - for (size = 0; size < MAX_MON_MOVES; size++) - { - moveData.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size); - moveData.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); - } - moveData.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); - src = (u8 *)(&moveData); - for (size = 0; size < sizeof(moveData); size++) - dst[size] = src[size]; - break; - case REQUEST_MOVE1_BATTLE: - case REQUEST_MOVE2_BATTLE: - case REQUEST_MOVE3_BATTLE: - case REQUEST_MOVE4_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_PP_DATA_BATTLE: - for (size = 0; size < MAX_MON_MOVES; size++) - dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); - dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); - size++; - break; - case REQUEST_PPMOVE1_BATTLE: - case REQUEST_PPMOVE2_BATTLE: - case REQUEST_PPMOVE3_BATTLE: - case REQUEST_PPMOVE4_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE); - size = 1; - break; - case REQUEST_OTID_BATTLE: - data32 = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - size = 3; - break; - case REQUEST_EXP_BATTLE: - data32 = GetMonData(&gEnemyParty[monId], MON_DATA_EXP); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - size = 3; - break; - case REQUEST_HP_EV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_EV); - size = 1; - break; - case REQUEST_ATK_EV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV); - size = 1; - break; - case REQUEST_DEF_EV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV); - size = 1; - break; - case REQUEST_SPEED_EV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV); - size = 1; - break; - case REQUEST_SPATK_EV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV); - size = 1; - break; - case REQUEST_SPDEF_EV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV); - size = 1; - break; - case REQUEST_FRIENDSHIP_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP); - size = 1; - break; - case REQUEST_POKERUS_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKERUS); - size = 1; - break; - case REQUEST_MET_LOCATION_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION); - size = 1; - break; - case REQUEST_MET_LEVEL_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL); - size = 1; - break; - case REQUEST_MET_GAME_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME); - size = 1; - break; - case REQUEST_POKEBALL_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL); - size = 1; - break; - case REQUEST_ALL_IVS_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); - dst[1] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); - dst[2] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); - dst[3] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); - dst[4] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); - dst[5] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); - size = 6; - break; - case REQUEST_HP_IV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); - size = 1; - break; - case REQUEST_ATK_IV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); - size = 1; - break; - case REQUEST_DEF_IV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); - size = 1; - break; - case REQUEST_SPEED_IV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); - size = 1; - break; - case REQUEST_SPATK_IV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); - size = 1; - break; - case REQUEST_SPDEF_IV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); - size = 1; - break; - case REQUEST_PERSONALITY_BATTLE: - data32 = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - dst[3] = (data32 & 0xFF000000) >> 24; - size = 4; - break; - case REQUEST_CHECKSUM_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_STATUS_BATTLE: - data32 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - dst[3] = (data32 & 0xFF000000) >> 24; - size = 4; - break; - case REQUEST_LEVEL_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL); - size = 1; - break; - case REQUEST_HP_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HP); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_MAX_HP_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_ATK_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_ATK); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_DEF_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_DEF); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPEED_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPATK_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPDEF_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_COOL_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL); - size = 1; - break; - case REQUEST_BEAUTY_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY); - size = 1; - break; - case REQUEST_CUTE_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE); - size = 1; - break; - case REQUEST_SMART_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART); - size = 1; - break; - case REQUEST_TOUGH_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH); - size = 1; - break; - case REQUEST_SHEEN_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SHEEN); - size = 1; - break; - case REQUEST_COOL_RIBBON_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON); - size = 1; - break; - case REQUEST_BEAUTY_RIBBON_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON); - size = 1; - break; - case REQUEST_CUTE_RIBBON_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON); - size = 1; - break; - case REQUEST_SMART_RIBBON_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON); - size = 1; - break; - case REQUEST_TOUGH_RIBBON_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON); - size = 1; - break; - } - - return size; -} - -static void LinkOpponentHandleGetRawMonData(void) -{ - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleSetMonData(void) -{ - u8 monToCheck; - u8 i; - - if (gBattleResources->bufferA[gActiveBattler][2] == 0) - { - SetLinkOpponentMonData(gBattlerPartyIndexes[gActiveBattler]); + PrepareBufferDataTransferLink(battler, 2, 4, &playerId); + gBattleResources->bufferA[battler][0] = CONTROLLER_TERMINATOR_NOP; } else { - monToCheck = gBattleResources->bufferA[gActiveBattler][2]; - for (i = 0; i < PARTY_SIZE; i++) - { - if (monToCheck & 1) - SetLinkOpponentMonData(i); - monToCheck >>= 1; - } - } - LinkOpponentBufferExecCompleted(); -} - -static void SetLinkOpponentMonData(u8 monId) -{ - struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleResources->bufferA[gActiveBattler][3]; - struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleResources->bufferA[gActiveBattler][3]; - s32 i; - - switch (gBattleResources->bufferA[gActiveBattler][1]) - { - case REQUEST_ALL_BATTLE: - { - u8 iv; - - SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &battlePokemon->species); - SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); - for (i = 0; i < MAX_MON_MOVES; i++) - { - SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); - SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); - } - SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); - SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); - SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &battlePokemon->experience); - iv = battlePokemon->hpIV; - SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &iv); - iv = battlePokemon->attackIV; - SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &iv); - iv = battlePokemon->defenseIV; - SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &iv); - iv = battlePokemon->speedIV; - SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &iv); - iv = battlePokemon->spAttackIV; - SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &iv); - iv = battlePokemon->spDefenseIV; - SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &iv); - SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); - SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &battlePokemon->status1); - SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &battlePokemon->level); - SetMonData(&gEnemyParty[monId], MON_DATA_HP, &battlePokemon->hp); - SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); - SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &battlePokemon->attack); - SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &battlePokemon->defense); - SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &battlePokemon->speed); - SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); - SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); - } - break; - case REQUEST_SPECIES_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HELDITEM_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MOVES_PP_BATTLE: - for (i = 0; i < MAX_MON_MOVES; i++) - { - SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); - SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); - } - SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); - break; - case REQUEST_MOVE1_BATTLE: - case REQUEST_MOVE2_BATTLE: - case REQUEST_MOVE3_BATTLE: - case REQUEST_MOVE4_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_PP_DATA_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_PP1, &gBattleResources->bufferA[gActiveBattler][3]); - SetMonData(&gEnemyParty[monId], MON_DATA_PP2, &gBattleResources->bufferA[gActiveBattler][4]); - SetMonData(&gEnemyParty[monId], MON_DATA_PP3, &gBattleResources->bufferA[gActiveBattler][5]); - SetMonData(&gEnemyParty[monId], MON_DATA_PP4, &gBattleResources->bufferA[gActiveBattler][6]); - SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &gBattleResources->bufferA[gActiveBattler][7]); - break; - case REQUEST_PPMOVE1_BATTLE: - case REQUEST_PPMOVE2_BATTLE: - case REQUEST_PPMOVE3_BATTLE: - case REQUEST_PPMOVE4_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_OTID_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_OT_ID, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_EXP_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HP_EV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_HP_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_EV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_EV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_EV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_EV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_EV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_FRIENDSHIP_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_POKERUS_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_POKERUS, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_LOCATION_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_LEVEL_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_GAME_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_POKEBALL_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ALL_IVS_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]); - SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][4]); - SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][5]); - SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][6]); - SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][7]); - SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][8]); - break; - case REQUEST_HP_IV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_IV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_IV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_IV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_IV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_IV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_PERSONALITY_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CHECKSUM_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_STATUS_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_LEVEL_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HP_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_HP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MAX_HP_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_COOL_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_COOL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_BEAUTY_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CUTE_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_CUTE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SMART_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SMART, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_TOUGH_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SHEEN_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SHEEN, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_COOL_RIBBON_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_BEAUTY_RIBBON_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CUTE_RIBBON_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SMART_RIBBON_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_TOUGH_RIBBON_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; + gBattleControllerExecFlags &= ~gBitTable[battler]; } } -static void LinkOpponentHandleSetRawMonData(void) -{ - u8 *dst = (u8 *)&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleResources->bufferA[gActiveBattler][1]; - u8 i; - - for (i = 0; i < gBattleResources->bufferA[gActiveBattler][2]; i++) - dst[i] = gBattleResources->bufferA[gActiveBattler][3 + i]; - - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleLoadMonSprite(void) -{ - u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - - BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler)); - - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(gActiveBattler, BATTLER_COORD_X_2), - GetBattlerSpriteDefault_Y(gActiveBattler), - GetBattlerSpriteSubpriority(gActiveBattler)); - - gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = -DISPLAY_WIDTH; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); - - SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - - gBattlerControllerFuncs[gActiveBattler] = TryShinyAnimAfterMonAnim; -} - -static void LinkOpponentHandleSwitchInAnim(void) -{ - gBattlerPartyIndexes[gActiveBattler] = gBattleResources->bufferA[gActiveBattler][1]; - StartSendOutAnim(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_TryShinyAnim; -} - -static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) +static void LinkOpponentHandleLoadMonSprite(u32 battler) { - u16 species; - - ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit); - gBattlerPartyIndexes[battlerId] = gBattleResources->bufferA[battlerId][1]; - species = GetIllusionMonSpecies(battlerId); - if (species == SPECIES_NONE) - species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); - gBattleControllerData[battlerId] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim); - BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId); - SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId)); - - gBattlerSpriteIds[battlerId] = CreateSprite( - &gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2), - GetBattlerSpriteDefault_Y(battlerId), - GetBattlerSpriteSubpriority(battlerId)); - - gSprites[gBattleControllerData[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; - gSprites[gBattleControllerData[battlerId]].data[2] = battlerId; - - gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId; - gSprites[gBattlerSpriteIds[battlerId]].data[2] = species; - gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId; - - StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]); - - gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE; - gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy; - - gSprites[gBattleControllerData[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT); + BtlController_HandleLoadMonSprite(battler, TryShinyAnimAfterMonAnim); } -static void LinkOpponentHandleReturnMonToBall(void) +static void LinkOpponentHandleSwitchInAnim(u32 battler) { - if (gBattleResources->bufferA[gActiveBattler][1] == 0) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation; - } - else - { - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - HideBattlerShadowSprite(gActiveBattler); - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - LinkOpponentBufferExecCompleted(); - } + BtlController_HandleSwitchInAnim(battler, FALSE, SwitchIn_TryShinyAnim); } -static void DoSwitchOutAnimation(void) -{ - switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState) - { - case 0: - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON); - - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1; - break; - case 1: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_OPPONENT_MON); - gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim; - } - break; - } -} - -#define sSpeedX data[0] - -static void LinkOpponentHandleDrawTrainerPic(void) +static void LinkOpponentHandleDrawTrainerPic(u32 battler) { s16 xPos; u32 trainerPicId; if (gBattleTypeFlags & BATTLE_TYPE_MULTI) { - if ((GetBattlerPosition(gActiveBattler) & BIT_FLANK) != 0) // second mon + if ((GetBattlerPosition(battler) & BIT_FLANK) != 0) // second mon xPos = 152; else // first mon xPos = 200; if (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER) { - if (gActiveBattler == B_POSITION_OPPONENT_LEFT) + if (battler == B_POSITION_OPPONENT_LEFT) trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); else trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_B); } else { - if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_FIRE_RED - || (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_LEAF_GREEN) + if ((gLinkPlayers[GetBattlerMultiplayerId(battler)].version & 0xFF) == VERSION_FIRE_RED + || (gLinkPlayers[GetBattlerMultiplayerId(battler)].version & 0xFF) == VERSION_LEAF_GREEN) { - if (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender != MALE) + if (gLinkPlayers[GetBattlerMultiplayerId(battler)].gender != MALE) trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_LEAF]; else trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_RED]; } - else if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_RUBY - || (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_SAPPHIRE) + else if ((gLinkPlayers[GetBattlerMultiplayerId(battler)].version & 0xFF) == VERSION_RUBY + || (gLinkPlayers[GetBattlerMultiplayerId(battler)].version & 0xFF) == VERSION_SAPPHIRE) { - if (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender != MALE) + if (gLinkPlayers[GetBattlerMultiplayerId(battler)].gender != MALE) trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_RS_MAY]; else trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_RS_BRENDAN]; } else { - trainerPicId = PlayerGenderToFrontTrainerPicId(gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender); + trainerPicId = PlayerGenderToFrontTrainerPicId(gLinkPlayers[GetBattlerMultiplayerId(battler)].gender); } } } @@ -1289,566 +461,77 @@ static void LinkOpponentHandleDrawTrainerPic(void) } } - DecompressTrainerFrontPic(trainerPicId, gActiveBattler); - SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, - xPos, - (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 40, - GetBattlerSpriteSubpriority(gActiveBattler)); - - gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = -DISPLAY_WIDTH; - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 2; - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; - - gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy; + BtlController_HandleDrawTrainerPic(battler, trainerPicId, TRUE, + xPos, 40 + 4 * (8 - gTrainerFrontPicCoords[trainerPicId].size), + -1); } -static void LinkOpponentHandleTrainerSlide(void) +static void LinkOpponentHandleTrainerSlide(u32 battler) { u32 trainerPicId; - if (gActiveBattler == 1) + if (battler == B_POSITION_OPPONENT_LEFT) trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); else trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_B); - DecompressTrainerFrontPic(trainerPicId, gActiveBattler); - SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, 176, (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 40, 0x1E); - - gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = 96; - gSprites[gBattlerSpriteIds[gActiveBattler]].x += 32; - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; - - gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy2; // this line is redundant, because LinkOpponentBufferExecCompleted changes the battle battlerId function - LinkOpponentBufferExecCompleted(); -} - -#undef sSpeedX - -static void LinkOpponentHandleTrainerSlideBack(void) -{ - SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 280; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].y; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); - gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; -} - -static void LinkOpponentHandleFaintAnimation(void) -{ - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState == 0) - { - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState++; - } - else - { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - PlaySE12WithPanning(SE_FAINT, SOUND_PAN_TARGET); - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintOpponentMon; - gBattlerControllerFuncs[gActiveBattler] = HideHealthboxAfterMonFaint; - } - } -} - -static void LinkOpponentHandlePaletteFade(void) -{ - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleSuccessBallThrowAnim(void) -{ - LinkOpponentBufferExecCompleted(); + BtlController_HandleTrainerSlide(battler, trainerPicId); + LinkOpponentBufferExecCompleted(battler); // Possibly a bug, because execution should be completed after the slide in finishes. See Controller_WaitForTrainerPic. } -static void LinkOpponentHandleBallThrowAnim(void) +static void LinkOpponentHandleTrainerSlideBack(u32 battler) { - LinkOpponentBufferExecCompleted(); + BtlController_HandleTrainerSlideBack(battler, 35, FALSE); } -static void LinkOpponentHandlePause(void) +static void LinkOpponentHandleMoveAnimation(u32 battler) { - LinkOpponentBufferExecCompleted(); + BtlController_HandleMoveAnimation(battler, TRUE); } -static void LinkOpponentHandleMoveAnimation(void) +static void LinkOpponentHandlePrintString(u32 battler) { - if (!IsBattleSEPlaying(gActiveBattler)) - { - u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); - - gAnimMoveTurn = gBattleResources->bufferA[gActiveBattler][3]; - gAnimMovePower = gBattleResources->bufferA[gActiveBattler][4] | (gBattleResources->bufferA[gActiveBattler][5] << 8); - gAnimMoveDmg = gBattleResources->bufferA[gActiveBattler][6] | (gBattleResources->bufferA[gActiveBattler][7] << 8) | (gBattleResources->bufferA[gActiveBattler][8] << 16) | (gBattleResources->bufferA[gActiveBattler][9] << 24); - gAnimFriendship = gBattleResources->bufferA[gActiveBattler][10]; - gWeatherMoveAnim = gBattleResources->bufferA[gActiveBattler][12] | (gBattleResources->bufferA[gActiveBattler][13] << 8); - gAnimDisableStructPtr = (struct DisableStruct *)&gBattleResources->bufferA[gActiveBattler][16]; - gTransformedPersonalities[gActiveBattler] = gAnimDisableStructPtr->transformedMonPersonality; - gTransformedOtIds[gActiveBattler] = gAnimDisableStructPtr->transformedMonOtId; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerControllerFuncs[gActiveBattler] = LinkOpponentDoMoveAnimation; - BattleTv_SetDataBasedOnMove(move, gWeatherMoveAnim, gAnimDisableStructPtr); - } + BtlController_HandlePrintString(battler, TRUE, FALSE); } -static void LinkOpponentDoMoveAnimation(void) +static void LinkOpponentHandleHealthBarUpdate(u32 battler) { - u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); - u8 multihit = gBattleResources->bufferA[gActiveBattler][11]; - - switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState) - { - case 0: - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute - && !gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8) - { - gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 1; - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON); - } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1; - break; - case 1: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF); - DoMoveAnim(move); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2; - } - break; - case 2: - gAnimScriptCallback(); - if (!gAnimScriptActive) - { - SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL); - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2) - { - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 0; - } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 3; - } - break; - case 3: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - CopyAllBattleSpritesInvisibilities(); - TrySetBehindSubstituteSpriteBit(gActiveBattler, gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - LinkOpponentBufferExecCompleted(); - } - break; - } + BtlController_HandleHealthBarUpdate(battler, FALSE); } -static void LinkOpponentHandlePrintString(void) +static void LinkOpponentHandleIntroTrainerBallThrow(u32 battler) { - u16 *stringId; - - gBattle_BG0_X = 0; - gBattle_BG0_Y = 0; - stringId = (u16 *)(&gBattleResources->bufferA[gActiveBattler][2]); - BufferStringBattle(*stringId); - BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG); - gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; - BattleTv_SetDataBasedOnString(*stringId); + BtlController_HandleIntroTrainerBallThrow(battler, 0, NULL, 0, Intro_TryShinyAnimShowHealthbox); } -static void LinkOpponentHandlePrintSelectionString(void) +static void LinkOpponentHandleDrawPartyStatusSummary(u32 battler) { - LinkOpponentBufferExecCompleted(); + BtlController_HandleDrawPartyStatusSummary(battler, B_SIDE_OPPONENT, TRUE); } -static void LinkOpponentHandleChooseAction(void) +static void LinkOpponentHandleBattleAnimation(u32 battler) { - LinkOpponentBufferExecCompleted(); + BtlController_HandleBattleAnimation(battler, FALSE, TRUE); } -static void LinkOpponentHandleYesNoBox(void) +static void LinkOpponentHandleLinkStandbyMsg(u32 battler) { - LinkOpponentBufferExecCompleted(); + RecordedBattle_RecordAllBattlerData(&gBattleResources->bufferA[battler][2]); + LinkOpponentBufferExecCompleted(battler); } -static void LinkOpponentHandleChooseMove(void) +static void LinkOpponentHandleEndLinkBattle(u32 battler) { - LinkOpponentBufferExecCompleted(); -} + RecordedBattle_RecordAllBattlerData(&gBattleResources->bufferA[battler][4]); -static void LinkOpponentHandleChooseItem(void) -{ - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleChoosePokemon(void) -{ - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleCmd23(void) -{ - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleHealthBarUpdate(void) -{ - s16 hpVal; - - LoadBattleBarGfx(0); - hpVal = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); - - if (hpVal != INSTANT_HP_BAR_DROP) - { - u32 maxHP = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); - u32 curHP = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_HP); - - SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, curHP, hpVal); - } - else - { - u32 maxHP = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); - - SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, 0, hpVal); - } - - gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthbarDone; -} - -static void LinkOpponentHandleExpUpdate(void) -{ - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleStatusIconUpdate(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) - { - u8 battlerId; - - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON); - battlerId = gActiveBattler; - gBattleSpritesDataPtr->healthBoxesData[battlerId].statusAnimActive = 0; - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; - } -} - -static void LinkOpponentHandleStatusAnimation(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) - { - InitAndLaunchChosenStatusAnimation(gBattleResources->bufferA[gActiveBattler][1], - gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8) | (gBattleResources->bufferA[gActiveBattler][4] << 16) | (gBattleResources->bufferA[gActiveBattler][5] << 24)); - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; - } -} - -static void LinkOpponentHandleStatusXor(void) -{ - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleDataTransfer(void) -{ - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleDMA3Transfer(void) -{ - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandlePlayBGM(void) -{ - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleCmd32(void) -{ - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleTwoReturnValues(void) -{ - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleChosenMonReturnValue(void) -{ - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleOneReturnValue(void) -{ - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleOneReturnValue_Duplicate(void) -{ - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleClearUnkVar(void) -{ - gUnusedControllerStruct.unk = 0; - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleSetUnkVar(void) -{ - gUnusedControllerStruct.unk = gBattleResources->bufferA[gActiveBattler][1]; - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleClearUnkFlag(void) -{ - gUnusedControllerStruct.flag = 0; - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleToggleUnkFlag(void) -{ - gUnusedControllerStruct.flag ^= 1; - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleHitAnimation(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE) - { - LinkOpponentBufferExecCompleted(); - } + if (gBattleResources->bufferA[battler][1] == B_OUTCOME_DREW) + gBattleOutcome = gBattleResources->bufferA[battler][1]; else - { - gDoingBattleAnim = TRUE; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; - DoHitAnimHealthboxEffect(gActiveBattler); - gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; - } -} - -static void LinkOpponentHandleCantSwitch(void) -{ - LinkOpponentBufferExecCompleted(); -} + gBattleOutcome = gBattleResources->bufferA[battler][1] ^ B_OUTCOME_DREW; -static void LinkOpponentHandlePlaySE(void) -{ - s8 pan; - - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - pan = SOUND_PAN_ATTACKER; - else - pan = SOUND_PAN_TARGET; - - PlaySE12WithPanning(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8), pan); - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandlePlayFanfareOrBGM(void) -{ - if (gBattleResources->bufferA[gActiveBattler][3]) - { - BattleStopLowHpSound(); - PlayBGM(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - else - { - PlayFanfare(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleFaintingCry(void) -{ - u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - - PlayCry_ByMode(species, 25, CRY_MODE_FAINT); - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleIntroSlide(void) -{ - HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]); - gIntroSlideFlags |= 1; - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleIntroTrainerBallThrow(void) -{ - u8 taskId; - - SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 280; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].y; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; - - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCB_FreeOpponentSprite); - - taskId = CreateTask(Task_StartSendOutAnim, 5); - gTasks[taskId].data[0] = gActiveBattler; - - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) - gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - - gBattleSpritesDataPtr->animationData->introAnimActive = TRUE; - gBattlerControllerFuncs[gActiveBattler] = LinkOpponentDummy; -} - -static void Task_StartSendOutAnim(u8 taskId) -{ - u8 savedActiveBank = gActiveBattler; - - gActiveBattler = gTasks[taskId].data[0]; - if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) - { - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - StartSendOutAnim(gActiveBattler, FALSE); - } - else - { - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - StartSendOutAnim(gActiveBattler, FALSE); - gActiveBattler = BATTLE_PARTNER(gActiveBattler); - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - StartSendOutAnim(gActiveBattler, FALSE); - gActiveBattler = BATTLE_PARTNER(gActiveBattler); - } - gBattlerControllerFuncs[gActiveBattler] = Intro_TryShinyAnimShowHealthbox; - gActiveBattler = savedActiveBank; - DestroyTask(taskId); -} - -static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite) -{ - FreeTrainerFrontPicPalette(sprite->oam.affineParam); - FreeSpriteOamMatrix(sprite); - DestroySprite(sprite); -} - -static void LinkOpponentHandleDrawPartyStatusSummary(void) -{ - if (gBattleResources->bufferA[gActiveBattler][1] != 0 && GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - { - LinkOpponentBufferExecCompleted(); - } - else - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1; - - if (gBattleResources->bufferA[gActiveBattler][2] != 0) - { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay < 2) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay++; - return; - } - else - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay = 0; - } - } - - gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleResources->bufferA[gActiveBattler][4], gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2]); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; - - if (gBattleResources->bufferA[gActiveBattler][2] != 0) - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 93; - - gBattlerControllerFuncs[gActiveBattler] = EndDrawPartyStatusSummary; - } -} - -static void EndDrawPartyStatusSummary(void) -{ - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer++ > 92) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; - LinkOpponentBufferExecCompleted(); - } -} - -static void LinkOpponentHandleHidePartyStatusSummary(void) -{ - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) - gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleEndBounceEffect(void) -{ - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleSpriteInvisibility(void) -{ - if (IsBattlerSpritePresent(gActiveBattler)) - { - gSprites[gBattlerSpriteIds[gActiveBattler]].invisible = gBattleResources->bufferA[gActiveBattler][1]; - CopyBattleSpriteInvisibility(gActiveBattler); - } - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleBattleAnimation(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) - { - u8 animationId = gBattleResources->bufferA[gActiveBattler][1]; - u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); - - if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument)) - LinkOpponentBufferExecCompleted(); - else - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; - - BattleTv_SetDataBasedOnAnimation(animationId); - } -} - -static void LinkOpponentHandleLinkStandbyMsg(void) -{ - RecordedBattle_RecordAllBattlerData(&gBattleResources->bufferA[gActiveBattler][2]); - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleResetActionMoveSelection(void) -{ - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleEndLinkBattle(void) -{ - RecordedBattle_RecordAllBattlerData(&gBattleResources->bufferA[gActiveBattler][4]); - - if (gBattleResources->bufferA[gActiveBattler][1] == B_OUTCOME_DREW) - gBattleOutcome = gBattleResources->bufferA[gActiveBattler][1]; - else - gBattleOutcome = gBattleResources->bufferA[gActiveBattler][1] ^ B_OUTCOME_DREW; - - gSaveBlock2Ptr->frontier.disableRecordBattle = gBattleResources->bufferA[gActiveBattler][2]; + gSaveBlock2Ptr->frontier.disableRecordBattle = gBattleResources->bufferA[battler][2]; FadeOutMapMusic(5); BeginFastPaletteFade(3); - LinkOpponentBufferExecCompleted(); - gBattlerControllerFuncs[gActiveBattler] = SetBattleEndCallbacks; -} - -static void LinkOpponentHandleBattleDebug(void) -{ - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentCmdEnd(void) -{ + LinkOpponentBufferExecCompleted(battler); + gBattlerControllerFuncs[battler] = SetBattleEndCallbacks; } diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index d07a92e93f71..4b8daeb1e1fd 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -29,1093 +29,200 @@ #include "constants/trainers.h" #include "recorded_battle.h" -static void LinkPartnerHandleGetMonData(void); -static void LinkPartnerHandleGetRawMonData(void); -static void LinkPartnerHandleSetMonData(void); -static void LinkPartnerHandleSetRawMonData(void); -static void LinkPartnerHandleLoadMonSprite(void); -static void LinkPartnerHandleSwitchInAnim(void); -static void LinkPartnerHandleReturnMonToBall(void); -static void LinkPartnerHandleDrawTrainerPic(void); -static void LinkPartnerHandleTrainerSlide(void); -static void LinkPartnerHandleTrainerSlideBack(void); -static void LinkPartnerHandleFaintAnimation(void); -static void LinkPartnerHandlePaletteFade(void); -static void LinkPartnerHandleSuccessBallThrowAnim(void); -static void LinkPartnerHandleBallThrowAnim(void); -static void LinkPartnerHandlePause(void); -static void LinkPartnerHandleMoveAnimation(void); -static void LinkPartnerHandlePrintString(void); -static void LinkPartnerHandlePrintSelectionString(void); -static void LinkPartnerHandleChooseAction(void); -static void LinkPartnerHandleYesNoBox(void); -static void LinkPartnerHandleChooseMove(void); -static void LinkPartnerHandleChooseItem(void); -static void LinkPartnerHandleChoosePokemon(void); -static void LinkPartnerHandleCmd23(void); -static void LinkPartnerHandleHealthBarUpdate(void); -static void LinkPartnerHandleExpUpdate(void); -static void LinkPartnerHandleStatusIconUpdate(void); -static void LinkPartnerHandleStatusAnimation(void); -static void LinkPartnerHandleStatusXor(void); -static void LinkPartnerHandleDataTransfer(void); -static void LinkPartnerHandleDMA3Transfer(void); -static void LinkPartnerHandlePlayBGM(void); -static void LinkPartnerHandleCmd32(void); -static void LinkPartnerHandleTwoReturnValues(void); -static void LinkPartnerHandleChosenMonReturnValue(void); -static void LinkPartnerHandleOneReturnValue(void); -static void LinkPartnerHandleOneReturnValue_Duplicate(void); -static void LinkPartnerHandleClearUnkVar(void); -static void LinkPartnerHandleSetUnkVar(void); -static void LinkPartnerHandleClearUnkFlag(void); -static void LinkPartnerHandleToggleUnkFlag(void); -static void LinkPartnerHandleHitAnimation(void); -static void LinkPartnerHandleCantSwitch(void); -static void LinkPartnerHandlePlaySE(void); -static void LinkPartnerHandlePlayFanfareOrBGM(void); -static void LinkPartnerHandleFaintingCry(void); -static void LinkPartnerHandleIntroSlide(void); -static void LinkPartnerHandleIntroTrainerBallThrow(void); -static void LinkPartnerHandleDrawPartyStatusSummary(void); -static void LinkPartnerHandleHidePartyStatusSummary(void); -static void LinkPartnerHandleEndBounceEffect(void); -static void LinkPartnerHandleSpriteInvisibility(void); -static void LinkPartnerHandleBattleAnimation(void); -static void LinkPartnerHandleLinkStandbyMsg(void); -static void LinkPartnerHandleResetActionMoveSelection(void); -static void LinkPartnerHandleEndLinkBattle(void); -static void LinkPartnerHandleBattleDebug(void); -static void LinkPartnerCmdEnd(void); - -static void LinkPartnerBufferRunCommand(void); -static void LinkPartnerBufferExecCompleted(void); -static void SwitchIn_WaitAndEnd(void); -static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst); -static void SetLinkPartnerMonData(u8 monId); -static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit); -static void DoSwitchOutAnimation(void); -static void LinkPartnerDoMoveAnimation(void); -static void Task_StartSendOutAnim(u8 taskId); -static void EndDrawPartyStatusSummary(void); - -static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = -{ - [CONTROLLER_GETMONDATA] = LinkPartnerHandleGetMonData, - [CONTROLLER_GETRAWMONDATA] = LinkPartnerHandleGetRawMonData, - [CONTROLLER_SETMONDATA] = LinkPartnerHandleSetMonData, - [CONTROLLER_SETRAWMONDATA] = LinkPartnerHandleSetRawMonData, +static void LinkPartnerHandleLoadMonSprite(u32 battler); +static void LinkPartnerHandleSwitchInAnim(u32 battler); +static void LinkPartnerHandleDrawTrainerPic(u32 battler); +static void LinkPartnerHandleTrainerSlideBack(u32 battler); +static void LinkPartnerHandleMoveAnimation(u32 battler); +static void LinkPartnerHandlePrintString(u32 battler); +static void LinkPartnerHandleHealthBarUpdate(u32 battler); +static void LinkPartnerHandleIntroTrainerBallThrow(u32 battler); +static void LinkPartnerHandleDrawPartyStatusSummary(u32 battler); +static void LinkPartnerHandleBattleAnimation(u32 battler); +static void LinkPartnerHandleLinkStandbyMsg(u32 battler); +static void LinkPartnerHandleEndLinkBattle(u32 battler); + +static void LinkPartnerBufferRunCommand(u32 battler); +static void LinkPartnerBufferExecCompleted(u32 battler); +static void SwitchIn_WaitAndEnd(u32 battler); + +static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(u32 battler) = +{ + [CONTROLLER_GETMONDATA] = BtlController_HandleGetMonData, + [CONTROLLER_GETRAWMONDATA] = BtlController_Empty, + [CONTROLLER_SETMONDATA] = BtlController_HandleSetMonData, + [CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData, [CONTROLLER_LOADMONSPRITE] = LinkPartnerHandleLoadMonSprite, [CONTROLLER_SWITCHINANIM] = LinkPartnerHandleSwitchInAnim, - [CONTROLLER_RETURNMONTOBALL] = LinkPartnerHandleReturnMonToBall, + [CONTROLLER_RETURNMONTOBALL] = BtlController_HandleReturnMonToBall, [CONTROLLER_DRAWTRAINERPIC] = LinkPartnerHandleDrawTrainerPic, - [CONTROLLER_TRAINERSLIDE] = LinkPartnerHandleTrainerSlide, + [CONTROLLER_TRAINERSLIDE] = BtlController_Empty, [CONTROLLER_TRAINERSLIDEBACK] = LinkPartnerHandleTrainerSlideBack, - [CONTROLLER_FAINTANIMATION] = LinkPartnerHandleFaintAnimation, - [CONTROLLER_PALETTEFADE] = LinkPartnerHandlePaletteFade, - [CONTROLLER_SUCCESSBALLTHROWANIM] = LinkPartnerHandleSuccessBallThrowAnim, - [CONTROLLER_BALLTHROWANIM] = LinkPartnerHandleBallThrowAnim, - [CONTROLLER_PAUSE] = LinkPartnerHandlePause, + [CONTROLLER_FAINTANIMATION] = BtlController_HandleFaintAnimation, + [CONTROLLER_PALETTEFADE] = BtlController_Empty, + [CONTROLLER_SUCCESSBALLTHROWANIM] = BtlController_Empty, + [CONTROLLER_BALLTHROWANIM] = BtlController_Empty, + [CONTROLLER_PAUSE] = BtlController_Empty, [CONTROLLER_MOVEANIMATION] = LinkPartnerHandleMoveAnimation, [CONTROLLER_PRINTSTRING] = LinkPartnerHandlePrintString, - [CONTROLLER_PRINTSTRINGPLAYERONLY] = LinkPartnerHandlePrintSelectionString, - [CONTROLLER_CHOOSEACTION] = LinkPartnerHandleChooseAction, - [CONTROLLER_YESNOBOX] = LinkPartnerHandleYesNoBox, - [CONTROLLER_CHOOSEMOVE] = LinkPartnerHandleChooseMove, - [CONTROLLER_OPENBAG] = LinkPartnerHandleChooseItem, - [CONTROLLER_CHOOSEPOKEMON] = LinkPartnerHandleChoosePokemon, - [CONTROLLER_23] = LinkPartnerHandleCmd23, + [CONTROLLER_PRINTSTRINGPLAYERONLY] = BtlController_Empty, + [CONTROLLER_CHOOSEACTION] = BtlController_Empty, + [CONTROLLER_YESNOBOX] = BtlController_Empty, + [CONTROLLER_CHOOSEMOVE] = BtlController_Empty, + [CONTROLLER_OPENBAG] = BtlController_Empty, + [CONTROLLER_CHOOSEPOKEMON] = BtlController_Empty, + [CONTROLLER_23] = BtlController_Empty, [CONTROLLER_HEALTHBARUPDATE] = LinkPartnerHandleHealthBarUpdate, - [CONTROLLER_EXPUPDATE] = LinkPartnerHandleExpUpdate, - [CONTROLLER_STATUSICONUPDATE] = LinkPartnerHandleStatusIconUpdate, - [CONTROLLER_STATUSANIMATION] = LinkPartnerHandleStatusAnimation, - [CONTROLLER_STATUSXOR] = LinkPartnerHandleStatusXor, - [CONTROLLER_DATATRANSFER] = LinkPartnerHandleDataTransfer, - [CONTROLLER_DMA3TRANSFER] = LinkPartnerHandleDMA3Transfer, - [CONTROLLER_PLAYBGM] = LinkPartnerHandlePlayBGM, - [CONTROLLER_32] = LinkPartnerHandleCmd32, - [CONTROLLER_TWORETURNVALUES] = LinkPartnerHandleTwoReturnValues, - [CONTROLLER_CHOSENMONRETURNVALUE] = LinkPartnerHandleChosenMonReturnValue, - [CONTROLLER_ONERETURNVALUE] = LinkPartnerHandleOneReturnValue, - [CONTROLLER_ONERETURNVALUE_DUPLICATE] = LinkPartnerHandleOneReturnValue_Duplicate, - [CONTROLLER_CLEARUNKVAR] = LinkPartnerHandleClearUnkVar, - [CONTROLLER_SETUNKVAR] = LinkPartnerHandleSetUnkVar, - [CONTROLLER_CLEARUNKFLAG] = LinkPartnerHandleClearUnkFlag, - [CONTROLLER_TOGGLEUNKFLAG] = LinkPartnerHandleToggleUnkFlag, - [CONTROLLER_HITANIMATION] = LinkPartnerHandleHitAnimation, - [CONTROLLER_CANTSWITCH] = LinkPartnerHandleCantSwitch, - [CONTROLLER_PLAYSE] = LinkPartnerHandlePlaySE, - [CONTROLLER_PLAYFANFAREORBGM] = LinkPartnerHandlePlayFanfareOrBGM, - [CONTROLLER_FAINTINGCRY] = LinkPartnerHandleFaintingCry, - [CONTROLLER_INTROSLIDE] = LinkPartnerHandleIntroSlide, + [CONTROLLER_EXPUPDATE] = BtlController_Empty, + [CONTROLLER_STATUSICONUPDATE] = BtlController_HandleStatusIconUpdate, + [CONTROLLER_STATUSANIMATION] = BtlController_HandleStatusAnimation, + [CONTROLLER_STATUSXOR] = BtlController_Empty, + [CONTROLLER_DATATRANSFER] = BtlController_Empty, + [CONTROLLER_DMA3TRANSFER] = BtlController_Empty, + [CONTROLLER_PLAYBGM] = BtlController_Empty, + [CONTROLLER_32] = BtlController_Empty, + [CONTROLLER_TWORETURNVALUES] = BtlController_Empty, + [CONTROLLER_CHOSENMONRETURNVALUE] = BtlController_Empty, + [CONTROLLER_ONERETURNVALUE] = BtlController_Empty, + [CONTROLLER_ONERETURNVALUE_DUPLICATE] = BtlController_Empty, + [CONTROLLER_CLEARUNKVAR] = BtlController_HandleClearUnkVar, + [CONTROLLER_SETUNKVAR] = BtlController_HandleSetUnkVar, + [CONTROLLER_CLEARUNKFLAG] = BtlController_HandleClearUnkFlag, + [CONTROLLER_TOGGLEUNKFLAG] = BtlController_HandleToggleUnkFlag, + [CONTROLLER_HITANIMATION] = BtlController_HandleHitAnimation, + [CONTROLLER_CANTSWITCH] = BtlController_Empty, + [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, + [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, + [CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry, + [CONTROLLER_INTROSLIDE] = BtlController_HandleIntroSlide, [CONTROLLER_INTROTRAINERBALLTHROW] = LinkPartnerHandleIntroTrainerBallThrow, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = LinkPartnerHandleDrawPartyStatusSummary, - [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = LinkPartnerHandleHidePartyStatusSummary, - [CONTROLLER_ENDBOUNCE] = LinkPartnerHandleEndBounceEffect, - [CONTROLLER_SPRITEINVISIBILITY] = LinkPartnerHandleSpriteInvisibility, + [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = BtlController_HandleHidePartyStatusSummary, + [CONTROLLER_ENDBOUNCE] = BtlController_Empty, + [CONTROLLER_SPRITEINVISIBILITY] = BtlController_HandleSpriteInvisibility, [CONTROLLER_BATTLEANIMATION] = LinkPartnerHandleBattleAnimation, [CONTROLLER_LINKSTANDBYMSG] = LinkPartnerHandleLinkStandbyMsg, - [CONTROLLER_RESETACTIONMOVESELECTION] = LinkPartnerHandleResetActionMoveSelection, + [CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty, [CONTROLLER_ENDLINKBATTLE] = LinkPartnerHandleEndLinkBattle, - [CONTROLLER_DEBUGMENU] = LinkPartnerHandleBattleDebug, - [CONTROLLER_TERMINATOR_NOP] = LinkPartnerCmdEnd + [CONTROLLER_DEBUGMENU] = BtlController_Empty, + [CONTROLLER_TERMINATOR_NOP] = BtlController_TerminatorNop }; -static void SpriteCB_Null2(void) -{ -} - -void SetControllerToLinkPartner(void) +void SetControllerToLinkPartner(u32 battler) { - gBattlerControllerFuncs[gActiveBattler] = LinkPartnerBufferRunCommand; + gBattlerControllerEndFuncs[battler] = LinkPartnerBufferExecCompleted; + gBattlerControllerFuncs[battler] = LinkPartnerBufferRunCommand; } -static void LinkPartnerBufferRunCommand(void) +static void LinkPartnerBufferRunCommand(u32 battler) { - if (gBattleControllerExecFlags & gBitTable[gActiveBattler]) + if (gBattleControllerExecFlags & gBitTable[battler]) { - if (gBattleResources->bufferA[gActiveBattler][0] < ARRAY_COUNT(sLinkPartnerBufferCommands)) - sLinkPartnerBufferCommands[gBattleResources->bufferA[gActiveBattler][0]](); + if (gBattleResources->bufferA[battler][0] < ARRAY_COUNT(sLinkPartnerBufferCommands)) + sLinkPartnerBufferCommands[gBattleResources->bufferA[battler][0]](battler); else - LinkPartnerBufferExecCompleted(); - } -} - -static void CompleteOnBattlerSpriteCallbackDummy(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - LinkPartnerBufferExecCompleted(); -} - -static void FreeTrainerSpriteAfterSlide(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - { - BattleGfxSfxDummy3(MALE); - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - LinkPartnerBufferExecCompleted(); - } -} - -static void Intro_DelayAndEnd(void) -{ - if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay == (u8)-1) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0; - LinkPartnerBufferExecCompleted(); - } -} - -static void Intro_WaitForHealthbox(void) -{ - bool32 finished = FALSE; - - if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) - { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - finished = TRUE; - } - else - { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) - { - finished = TRUE; - } - } - - if (IsCryPlayingOrClearCrySongs()) - finished = FALSE; - - if (finished) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; - gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; - } -} - -static void Intro_ShowHealthbox(void) -{ - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive - && gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && ++gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay != 1) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0; - - if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) - { - DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); - UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); - StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); - } - - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - - gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; - - gBattlerControllerFuncs[gActiveBattler] = Intro_WaitForHealthbox; - } -} - -static void WaitForMonAnimAfterLoad(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].animEnded && gSprites[gBattlerSpriteIds[gActiveBattler]].x2 == 0) - LinkPartnerBufferExecCompleted(); -} - -static void CompleteOnHealthbarDone(void) -{ - s16 hpValue = MoveBattleBar(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0); - - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - - if (hpValue != -1) - { - UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], HP_CURRENT, hpValue, gBattleMons[gActiveBattler].maxHP); - } - else - { - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - LinkPartnerBufferExecCompleted(); + LinkPartnerBufferExecCompleted(battler); } } -static void FreeMonSpriteAfterFaintAnim(void) +static void WaitForMonAnimAfterLoad(u32 battler) { - if (gSprites[gBattlerSpriteIds[gActiveBattler]].y + gSprites[gBattlerSpriteIds[gActiveBattler]].y2 > DISPLAY_HEIGHT) - { - u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - - BattleGfxSfxDummy2(species); - FreeOamMatrix(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.matrixNum); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - LinkPartnerBufferExecCompleted(); - } + if (gSprites[gBattlerSpriteIds[battler]].animEnded && gSprites[gBattlerSpriteIds[battler]].x2 == 0) + LinkPartnerBufferExecCompleted(battler); } -static void FreeMonSpriteAfterSwitchOutAnim(void) +static void SwitchIn_ShowSubstitute(u32 battler) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy) { - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - LinkPartnerBufferExecCompleted(); - } -} + CopyBattleSpriteInvisibility(battler); + if (gBattleSpritesDataPtr->battlerData[battler].behindSubstitute) + InitAndLaunchSpecialAnimation(battler, battler, battler, B_ANIM_MON_TO_SUBSTITUTE); -static void CompleteOnInactiveTextPrinter(void) -{ - if (!IsTextPrinterActive(B_WIN_MSG)) - LinkPartnerBufferExecCompleted(); -} - -static void DoHitAnimBlinkSpriteEffect(void) -{ - u8 spriteId = gBattlerSpriteIds[gActiveBattler]; - - if (gSprites[spriteId].data[1] == 32) - { - gSprites[spriteId].data[1] = 0; - gSprites[spriteId].invisible = FALSE; - gDoingBattleAnim = FALSE; - LinkPartnerBufferExecCompleted(); - } - else - { - if ((gSprites[spriteId].data[1] % 4) == 0) - gSprites[spriteId].invisible ^= 1; - gSprites[spriteId].data[1]++; + gBattlerControllerFuncs[battler] = SwitchIn_WaitAndEnd; } } -static void SwitchIn_ShowSubstitute(void) +static void SwitchIn_WaitAndEnd(u32 battler) { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].specialAnimActive + && gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy) { - CopyBattleSpriteInvisibility(gActiveBattler); - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_WaitAndEnd; + LinkPartnerBufferExecCompleted(battler); } } -static void SwitchIn_WaitAndEnd(void) +static void SwitchIn_ShowHealthbox(u32 battler) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive - && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim) { - LinkPartnerBufferExecCompleted(); - } -} - -static void SwitchIn_ShowHealthbox(void) -{ - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); CreateTask(Task_PlayerController_RestoreBgmAfterCry, 10); - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0); - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[battler]], battler); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[battler]], 0); + UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], &gPlayerParty[gBattlerPartyIndexes[battler]], HEALTHBOX_ALL); + StartHealthboxSlideIn(battler); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[battler]); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowSubstitute; + gBattlerControllerFuncs[battler] = SwitchIn_ShowSubstitute; } } -static void SwitchIn_TryShinyAnim(void) +static void SwitchIn_TryShinyAnim(u32 battler) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive) { - TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); + TryShinyAnimation(battler, &gPlayerParty[gBattlerPartyIndexes[battler]]); } - if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) + if (gSprites[gBattleControllerData[battler]].callback == SpriteCallbackDummy + && !gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive) { - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowHealthbox; + DestroySprite(&gSprites[gBattleControllerData[battler]]); + gBattlerControllerFuncs[battler] = SwitchIn_ShowHealthbox; } } -static void LinkPartnerBufferExecCompleted(void) +static void LinkPartnerBufferExecCompleted(u32 battler) { - gBattlerControllerFuncs[gActiveBattler] = LinkPartnerBufferRunCommand; + gBattlerControllerFuncs[battler] = LinkPartnerBufferRunCommand; if (gBattleTypeFlags & BATTLE_TYPE_LINK) { u8 playerId = GetMultiplayerId(); - PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleResources->bufferA[gActiveBattler][0] = CONTROLLER_TERMINATOR_NOP; - } - else - { - gBattleControllerExecFlags &= ~gBitTable[gActiveBattler]; - } -} - -static void CompleteOnFinishedStatusAnimation(void) -{ - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].statusAnimActive) - LinkPartnerBufferExecCompleted(); -} - -static void CompleteOnFinishedBattleAnimation(void) -{ - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive) - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleGetMonData(void) -{ - u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data - u32 size = 0; - u8 monToCheck; - s32 i; - - if (gBattleResources->bufferA[gActiveBattler][2] == 0) - { - size += CopyLinkPartnerMonData(gBattlerPartyIndexes[gActiveBattler], monData); - } - else - { - monToCheck = gBattleResources->bufferA[gActiveBattler][2]; - for (i = 0; i < PARTY_SIZE; i++) - { - if (monToCheck & 1) - size += CopyLinkPartnerMonData(i, monData + size); - monToCheck >>= 1; - } - } - BtlController_EmitDataTransfer(BUFFER_B, size, monData); - LinkPartnerBufferExecCompleted(); -} - -static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst) -{ - struct BattlePokemon battleMon; - struct MovePpInfo moveData; - u8 nickname[20]; - u8 *src; - s16 data16; - u32 data32; - s32 size = 0; - - switch (gBattleResources->bufferA[gActiveBattler][1]) - { - case REQUEST_ALL_BATTLE: - battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); - battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); - for (size = 0; size < MAX_MON_MOVES; size++) - { - battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); - battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); - } - battleMon.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); - battleMon.friendship = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); - battleMon.experience = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); - battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); - battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); - battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); - battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); - battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); - battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); - battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); - battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); - battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP); - battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); - battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); - battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); - battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); - battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); - battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); - battleMon.abilityNum = GetMonData(&gPlayerParty[monId], MON_DATA_ABILITY_NUM); - battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); - battleMon.metLevel = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL); - GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname); - StringCopy_Nickname(battleMon.nickname, nickname); - GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName); - src = (u8 *)&battleMon; - for (size = 0; size < sizeof(battleMon); size++) - dst[size] = src[size]; - break; - case REQUEST_SPECIES_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_HELDITEM_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_MOVES_PP_BATTLE: - for (size = 0; size < MAX_MON_MOVES; size++) - { - moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); - moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); - } - moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); - src = (u8 *)(&moveData); - for (size = 0; size < sizeof(moveData); size++) - dst[size] = src[size]; - break; - case REQUEST_MOVE1_BATTLE: - case REQUEST_MOVE2_BATTLE: - case REQUEST_MOVE3_BATTLE: - case REQUEST_MOVE4_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_PP_DATA_BATTLE: - for (size = 0; size < MAX_MON_MOVES; size++) - dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); - dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); - size++; - break; - case REQUEST_PPMOVE1_BATTLE: - case REQUEST_PPMOVE2_BATTLE: - case REQUEST_PPMOVE3_BATTLE: - case REQUEST_PPMOVE4_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE); - size = 1; - break; - case REQUEST_OTID_BATTLE: - data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - size = 3; - break; - case REQUEST_EXP_BATTLE: - data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - size = 3; - break; - case REQUEST_HP_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV); - size = 1; - break; - case REQUEST_ATK_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV); - size = 1; - break; - case REQUEST_DEF_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV); - size = 1; - break; - case REQUEST_SPEED_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV); - size = 1; - break; - case REQUEST_SPATK_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV); - size = 1; - break; - case REQUEST_SPDEF_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV); - size = 1; - break; - case REQUEST_FRIENDSHIP_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); - size = 1; - break; - case REQUEST_POKERUS_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS); - size = 1; - break; - case REQUEST_MET_LOCATION_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION); - size = 1; - break; - case REQUEST_MET_LEVEL_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL); - size = 1; - break; - case REQUEST_MET_GAME_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME); - size = 1; - break; - case REQUEST_POKEBALL_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL); - size = 1; - break; - case REQUEST_ALL_IVS_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); - dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); - dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); - dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); - dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); - size = 6; - break; - case REQUEST_HP_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); - size = 1; - break; - case REQUEST_ATK_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); - size = 1; - break; - case REQUEST_DEF_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - size = 1; - break; - case REQUEST_SPEED_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); - size = 1; - break; - case REQUEST_SPATK_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); - size = 1; - break; - case REQUEST_SPDEF_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); - size = 1; - break; - case REQUEST_PERSONALITY_BATTLE: - data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - dst[3] = (data32 & 0xFF000000) >> 24; - size = 4; - break; - case REQUEST_CHECKSUM_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_STATUS_BATTLE: - data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - dst[3] = (data32 & 0xFF000000) >> 24; - size = 4; - break; - case REQUEST_LEVEL_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); - size = 1; - break; - case REQUEST_HP_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_MAX_HP_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_ATK_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_DEF_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPEED_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPATK_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPDEF_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_COOL_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL); - size = 1; - break; - case REQUEST_BEAUTY_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY); - size = 1; - break; - case REQUEST_CUTE_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE); - size = 1; - break; - case REQUEST_SMART_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART); - size = 1; - break; - case REQUEST_TOUGH_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH); - size = 1; - break; - case REQUEST_SHEEN_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN); - size = 1; - break; - case REQUEST_COOL_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON); - size = 1; - break; - case REQUEST_BEAUTY_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON); - size = 1; - break; - case REQUEST_CUTE_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON); - size = 1; - break; - case REQUEST_SMART_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON); - size = 1; - break; - case REQUEST_TOUGH_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON); - size = 1; - break; - } - - return size; -} - -static void LinkPartnerHandleGetRawMonData(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleSetMonData(void) -{ - u8 monToCheck; - u8 i; - - if (gBattleResources->bufferA[gActiveBattler][2] == 0) - { - SetLinkPartnerMonData(gBattlerPartyIndexes[gActiveBattler]); + PrepareBufferDataTransferLink(battler, 2, 4, &playerId); + gBattleResources->bufferA[battler][0] = CONTROLLER_TERMINATOR_NOP; } else { - monToCheck = gBattleResources->bufferA[gActiveBattler][2]; - for (i = 0; i < PARTY_SIZE; i++) - { - if (monToCheck & 1) - SetLinkPartnerMonData(i); - monToCheck >>= 1; - } - } - LinkPartnerBufferExecCompleted(); -} - -static void SetLinkPartnerMonData(u8 monId) -{ - struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleResources->bufferA[gActiveBattler][3]; - struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleResources->bufferA[gActiveBattler][3]; - s32 i; - - switch (gBattleResources->bufferA[gActiveBattler][1]) - { - case REQUEST_ALL_BATTLE: - { - u8 iv; - - SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species); - SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); - for (i = 0; i < MAX_MON_MOVES; i++) - { - SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); - } - SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); - SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); - SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &battlePokemon->experience); - iv = battlePokemon->hpIV; - SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &iv); - iv = battlePokemon->attackIV; - SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &iv); - iv = battlePokemon->defenseIV; - SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv); - iv = battlePokemon->speedIV; - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &iv); - iv = battlePokemon->spAttackIV; - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv); - iv = battlePokemon->spDefenseIV; - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv); - SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); - SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1); - SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level); - SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp); - SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); - SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack); - SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense); - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &battlePokemon->speed); - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); - } - break; - case REQUEST_SPECIES_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HELDITEM_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MOVES_PP_BATTLE: - for (i = 0; i < MAX_MON_MOVES; i++) - { - SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); - } - SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); - break; - case REQUEST_MOVE1_BATTLE: - case REQUEST_MOVE2_BATTLE: - case REQUEST_MOVE3_BATTLE: - case REQUEST_MOVE4_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_PP_DATA_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleResources->bufferA[gActiveBattler][3]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleResources->bufferA[gActiveBattler][4]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleResources->bufferA[gActiveBattler][5]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleResources->bufferA[gActiveBattler][6]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleResources->bufferA[gActiveBattler][7]); - break; - case REQUEST_PPMOVE1_BATTLE: - case REQUEST_PPMOVE2_BATTLE: - case REQUEST_PPMOVE3_BATTLE: - case REQUEST_PPMOVE4_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_OTID_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_EXP_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HP_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_FRIENDSHIP_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_POKERUS_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_LOCATION_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_LEVEL_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_GAME_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_POKEBALL_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ALL_IVS_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]); - SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][4]); - SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][5]); - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][6]); - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][7]); - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][8]); - break; - case REQUEST_HP_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_PERSONALITY_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CHECKSUM_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_STATUS_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_LEVEL_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HP_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MAX_HP_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_COOL_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_BEAUTY_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CUTE_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SMART_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_TOUGH_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SHEEN_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_COOL_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_BEAUTY_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CUTE_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SMART_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_TOUGH_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; + gBattleControllerExecFlags &= ~gBitTable[battler]; } - - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); } -static void LinkPartnerHandleSetRawMonData(void) +static void LinkPartnerHandleLoadMonSprite(u32 battler) { - u8 *dst = (u8 *)&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleResources->bufferA[gActiveBattler][1]; - u8 i; - - for (i = 0; i < gBattleResources->bufferA[gActiveBattler][2]; i++) - dst[i] = gBattleResources->bufferA[gActiveBattler][3 + i]; - - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleLoadMonSprite(void) -{ - u16 species; - - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler)); - - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(gActiveBattler, BATTLER_COORD_X_2), - GetBattlerSpriteDefault_Y(gActiveBattler), - GetBattlerSpriteSubpriority(gActiveBattler)); - gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = -DISPLAY_WIDTH; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); - gBattlerControllerFuncs[gActiveBattler] = WaitForMonAnimAfterLoad; -} - -static void LinkPartnerHandleSwitchInAnim(void) -{ - ClearTemporarySpeciesSpriteData(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); - gBattlerPartyIndexes[gActiveBattler] = gBattleResources->bufferA[gActiveBattler][1]; - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - StartSendOutAnim(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_TryShinyAnim; -} - -static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) -{ - u16 species; - - ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit); - gBattlerPartyIndexes[battlerId] = gBattleResources->bufferA[battlerId][1]; - species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); - gBattleControllerData[battlerId] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim); - SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId)); - - gBattlerSpriteIds[battlerId] = CreateSprite( - &gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2), - GetBattlerSpriteDefault_Y(battlerId), - GetBattlerSpriteSubpriority(battlerId)); - - gSprites[gBattleControllerData[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; - gSprites[gBattleControllerData[battlerId]].data[2] = battlerId; - - gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId; - gSprites[gBattlerSpriteIds[battlerId]].data[2] = species; - gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId; - - StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]); - - gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE; - gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy; - - gSprites[gBattleControllerData[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT); -} - -static void LinkPartnerHandleReturnMonToBall(void) -{ - if (gBattleResources->bufferA[gActiveBattler][1] == 0) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation; - } - else - { - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - LinkPartnerBufferExecCompleted(); - } + BtlController_HandleLoadMonSprite(battler, WaitForMonAnimAfterLoad); } -static void DoSwitchOutAnimation(void) +static void LinkPartnerHandleSwitchInAnim(u32 battler) { - switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState) - { - case 0: - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON); - - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1; - break; - case 1: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON); - gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim; - } - break; - } + BtlController_HandleSwitchInAnim(battler, TRUE, SwitchIn_TryShinyAnim); } -#define sSpeedX data[0] - -static void LinkPartnerHandleDrawTrainerPic(void) +static void LinkPartnerHandleDrawTrainerPic(u32 battler) { s16 xPos; u32 trainerPicId; if (gBattleTypeFlags & BATTLE_TYPE_MULTI) { - if ((GetBattlerPosition(gActiveBattler) & BIT_FLANK) != 0) // second mon + if ((GetBattlerPosition(battler) & BIT_FLANK) != 0) // second mon xPos = 90; else // first mon xPos = 32; @@ -1125,574 +232,63 @@ static void LinkPartnerHandleDrawTrainerPic(void) xPos = 80; } - if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_FIRE_RED - || (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_LEAF_GREEN) - { - trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + TRAINER_BACK_PIC_RED; - } - else if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_RUBY - || (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_SAPPHIRE) - { - trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN; - } - else - { - trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender; - } - - DecompressTrainerBackPic(trainerPicId, gActiveBattler); - SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80, GetBattlerSpriteSubpriority(gActiveBattler)); - - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = DISPLAY_WIDTH; - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; - - gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy; -} - -#undef sSpeedX - -static void LinkPartnerHandleTrainerSlide(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleTrainerSlideBack(void) -{ - SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].y; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); - gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; -} - -#define sSpeedX data[1] -#define sSpeedY data[2] - -static void LinkPartnerHandleFaintAnimation(void) -{ - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState == 0) - { - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState++; - } - else - { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - PlaySE12WithPanning(SE_FAINT, SOUND_PAN_ATTACKER); - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 0; - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedY = 5; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintSlideAnim; - gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterFaintAnim; - } - } -} - -#undef sSpeedX -#undef sSpeedY - -static void LinkPartnerHandlePaletteFade(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleSuccessBallThrowAnim(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleBallThrowAnim(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandlePause(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleMoveAnimation(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) - { - u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); - - gAnimMoveTurn = gBattleResources->bufferA[gActiveBattler][3]; - gAnimMovePower = gBattleResources->bufferA[gActiveBattler][4] | (gBattleResources->bufferA[gActiveBattler][5] << 8); - gAnimMoveDmg = gBattleResources->bufferA[gActiveBattler][6] | (gBattleResources->bufferA[gActiveBattler][7] << 8) | (gBattleResources->bufferA[gActiveBattler][8] << 16) | (gBattleResources->bufferA[gActiveBattler][9] << 24); - gAnimFriendship = gBattleResources->bufferA[gActiveBattler][10]; - gWeatherMoveAnim = gBattleResources->bufferA[gActiveBattler][12] | (gBattleResources->bufferA[gActiveBattler][13] << 8); - gAnimDisableStructPtr = (struct DisableStruct *)&gBattleResources->bufferA[gActiveBattler][16]; - gTransformedPersonalities[gActiveBattler] = gAnimDisableStructPtr->transformedMonPersonality; - gTransformedOtIds[gActiveBattler] = gAnimDisableStructPtr->transformedMonOtId; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerControllerFuncs[gActiveBattler] = LinkPartnerDoMoveAnimation; - BattleTv_SetDataBasedOnMove(move, gWeatherMoveAnim, gAnimDisableStructPtr); - } -} - -static void LinkPartnerDoMoveAnimation(void) -{ - u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); - u8 multihit = gBattleResources->bufferA[gActiveBattler][11]; - - switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState) - { - case 0: - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute - && !gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8) - { - gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 1; - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON); - } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1; - break; - case 1: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF); - DoMoveAnim(move); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2; - } - break; - case 2: - gAnimScriptCallback(); - if (!gAnimScriptActive) - { - SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL); - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2) - { - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 0; - } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 3; - } - break; - case 3: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - CopyAllBattleSpritesInvisibilities(); - TrySetBehindSubstituteSpriteBit(gActiveBattler, gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - LinkPartnerBufferExecCompleted(); - } - break; - } -} - -static void LinkPartnerHandlePrintString(void) -{ - u16 *stringId; - - gBattle_BG0_X = 0; - gBattle_BG0_Y = 0; - stringId = (u16 *)(&gBattleResources->bufferA[gActiveBattler][2]); - BufferStringBattle(*stringId); - BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG); - gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; - BattleTv_SetDataBasedOnString(*stringId); -} - -static void LinkPartnerHandlePrintSelectionString(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleChooseAction(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleYesNoBox(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleChooseMove(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleChooseItem(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleChoosePokemon(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleCmd23(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleHealthBarUpdate(void) -{ - s16 hpVal; - - LoadBattleBarGfx(0); - hpVal = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); - - if (hpVal != INSTANT_HP_BAR_DROP) - { - u32 maxHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); - u32 curHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_HP); - - SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, curHP, hpVal); - } - else - { - u32 maxHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); - - SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, 0, hpVal); - } - - gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthbarDone; -} - -static void LinkPartnerHandleExpUpdate(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleStatusIconUpdate(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) - { - u8 battlerId; - - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON); - battlerId = gActiveBattler; - gBattleSpritesDataPtr->healthBoxesData[battlerId].statusAnimActive = 0; - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; - } -} - -static void LinkPartnerHandleStatusAnimation(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) - { - InitAndLaunchChosenStatusAnimation(gBattleResources->bufferA[gActiveBattler][1], - gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8) | (gBattleResources->bufferA[gActiveBattler][4] << 16) | (gBattleResources->bufferA[gActiveBattler][5] << 24)); - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; - } -} - -static void LinkPartnerHandleStatusXor(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleDataTransfer(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleDMA3Transfer(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandlePlayBGM(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleCmd32(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleTwoReturnValues(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleChosenMonReturnValue(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleOneReturnValue(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleOneReturnValue_Duplicate(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleClearUnkVar(void) -{ - gUnusedControllerStruct.unk = 0; - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleSetUnkVar(void) -{ - gUnusedControllerStruct.unk = gBattleResources->bufferA[gActiveBattler][1]; - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleClearUnkFlag(void) -{ - gUnusedControllerStruct.flag = 0; - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleToggleUnkFlag(void) -{ - gUnusedControllerStruct.flag ^= 1; - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleHitAnimation(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE) - { - LinkPartnerBufferExecCompleted(); - } - else - { - gDoingBattleAnim = TRUE; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; - DoHitAnimHealthboxEffect(gActiveBattler); - gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; - } -} - -static void LinkPartnerHandleCantSwitch(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandlePlaySE(void) -{ - s8 pan; - - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - pan = SOUND_PAN_ATTACKER; - else - pan = SOUND_PAN_TARGET; - - PlaySE12WithPanning(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8), pan); - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandlePlayFanfareOrBGM(void) -{ - if (gBattleResources->bufferA[gActiveBattler][3]) - { - BattleStopLowHpSound(); - PlayBGM(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - else - { - PlayFanfare(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleFaintingCry(void) -{ - u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - - PlayCry_ByMode(species, -25, CRY_MODE_FAINT); - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleIntroSlide(void) -{ - HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]); - gIntroSlideFlags |= 1; - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleIntroTrainerBallThrow(void) -{ - u8 paletteNum; - u8 taskId; - u32 trainerPicId; - - SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 50; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].y; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[5] = gActiveBattler; - - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCB_FreePlayerSpriteLoadMonSprite); - StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1); - - paletteNum = AllocSpritePalette(0xD6F9); - - if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_FIRE_RED - || (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_LEAF_GREEN) - { - trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + TRAINER_BACK_PIC_RED; - } - else if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_RUBY - || (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_SAPPHIRE) - { - trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN; - } - else - { - trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender; - } - - LoadCompressedPalette(gTrainerBackPicPaletteTable[trainerPicId].data, OBJ_PLTT_ID(paletteNum), PLTT_SIZE_4BPP); - - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum; - - taskId = CreateTask(Task_StartSendOutAnim, 5); - gTasks[taskId].data[0] = gActiveBattler; - - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) - gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - - gBattleSpritesDataPtr->animationData->introAnimActive = TRUE; - gBattlerControllerFuncs[gActiveBattler] = SpriteCB_Null2; + trainerPicId = LinkPlayerGetTrainerPicId(GetBattlerMultiplayerId(battler)); + BtlController_HandleDrawTrainerPic(battler, trainerPicId, FALSE, + xPos, 80 + 4 * (8 - gTrainerBackPicCoords[trainerPicId].size), + -1); } -static void Task_StartSendOutAnim(u8 taskId) +static void LinkPartnerHandleTrainerSlideBack(u32 battler) { - if (gTasks[taskId].data[1] < 24) - { - gTasks[taskId].data[1]++; - } - else - { - u8 savedActiveBank = gActiveBattler; - - gActiveBattler = gTasks[taskId].data[0]; - if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) - { - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - StartSendOutAnim(gActiveBattler, FALSE); - } - else - { - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - StartSendOutAnim(gActiveBattler, FALSE); - gActiveBattler ^= BIT_FLANK; - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - StartSendOutAnim(gActiveBattler, FALSE); - gActiveBattler ^= BIT_FLANK; - } - gBattlerControllerFuncs[gActiveBattler] = Intro_ShowHealthbox; - gActiveBattler = savedActiveBank; - DestroyTask(taskId); - } + BtlController_HandleTrainerSlideBack(battler, 35, FALSE); } -static void LinkPartnerHandleDrawPartyStatusSummary(void) +static void LinkPartnerHandleMoveAnimation(u32 battler) { - if (gBattleResources->bufferA[gActiveBattler][1] != 0 && GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - { - LinkPartnerBufferExecCompleted(); - } - else - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1; - gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleResources->bufferA[gActiveBattler][4], gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2]); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; - - if (gBattleResources->bufferA[gActiveBattler][2] != 0) - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 93; - - gBattlerControllerFuncs[gActiveBattler] = EndDrawPartyStatusSummary; - } + BtlController_HandleMoveAnimation(battler, TRUE); } -static void EndDrawPartyStatusSummary(void) +static void LinkPartnerHandlePrintString(u32 battler) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer++ > 92) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; - LinkPartnerBufferExecCompleted(); - } + BtlController_HandlePrintString(battler, TRUE, FALSE); } -static void LinkPartnerHandleHidePartyStatusSummary(void) +static void LinkPartnerHandleHealthBarUpdate(u32 battler) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) - gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - LinkPartnerBufferExecCompleted(); + BtlController_HandleHealthBarUpdate(battler, FALSE); } -static void LinkPartnerHandleEndBounceEffect(void) +static void LinkPartnerHandleIntroTrainerBallThrow(u32 battler) { - LinkPartnerBufferExecCompleted(); + u32 trainerPicId = LinkPlayerGetTrainerPicId(GetBattlerMultiplayerId(battler)); + const u32 *trainerPal = gTrainerBackPicPaletteTable[trainerPicId].data; + // Link partner uses the same intro sequence as the player partner. + BtlController_HandleIntroTrainerBallThrow(battler, 0xD6F9, trainerPal, 24, Controller_PlayerPartnerShowIntroHealthbox); } -static void LinkPartnerHandleSpriteInvisibility(void) +static void LinkPartnerHandleDrawPartyStatusSummary(u32 battler) { - if (IsBattlerSpritePresent(gActiveBattler)) - { - gSprites[gBattlerSpriteIds[gActiveBattler]].invisible = gBattleResources->bufferA[gActiveBattler][1]; - CopyBattleSpriteInvisibility(gActiveBattler); - } - LinkPartnerBufferExecCompleted(); + BtlController_HandleDrawPartyStatusSummary(battler, B_SIDE_PLAYER, TRUE); } -static void LinkPartnerHandleBattleAnimation(void) +static void LinkPartnerHandleBattleAnimation(u32 battler) { - if (!IsBattleSEPlaying(gActiveBattler)) - { - u8 animationId = gBattleResources->bufferA[gActiveBattler][1]; - u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); - - if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument)) - LinkPartnerBufferExecCompleted(); - else - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; - - BattleTv_SetDataBasedOnAnimation(animationId); - } -} - -static void LinkPartnerHandleLinkStandbyMsg(void) -{ - RecordedBattle_RecordAllBattlerData(&gBattleResources->bufferA[gActiveBattler][2]); - LinkPartnerBufferExecCompleted(); + BtlController_HandleBattleAnimation(battler, FALSE, TRUE); } -static void LinkPartnerHandleResetActionMoveSelection(void) +static void LinkPartnerHandleLinkStandbyMsg(u32 battler) { - LinkPartnerBufferExecCompleted(); + RecordedBattle_RecordAllBattlerData(&gBattleResources->bufferA[battler][2]); + LinkPartnerBufferExecCompleted(battler); } -static void LinkPartnerHandleEndLinkBattle(void) +static void LinkPartnerHandleEndLinkBattle(u32 battler) { - RecordedBattle_RecordAllBattlerData(&gBattleResources->bufferA[gActiveBattler][4]); - gBattleOutcome = gBattleResources->bufferA[gActiveBattler][1]; - gSaveBlock2Ptr->frontier.disableRecordBattle = gBattleResources->bufferA[gActiveBattler][2]; + RecordedBattle_RecordAllBattlerData(&gBattleResources->bufferA[battler][4]); + gBattleOutcome = gBattleResources->bufferA[battler][1]; + gSaveBlock2Ptr->frontier.disableRecordBattle = gBattleResources->bufferA[battler][2]; FadeOutMapMusic(5); BeginFastPaletteFade(3); - LinkPartnerBufferExecCompleted(); - gBattlerControllerFuncs[gActiveBattler] = SetBattleEndCallbacks; -} - -static void LinkPartnerHandleBattleDebug(void) -{ - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerCmdEnd(void) -{ + LinkPartnerBufferExecCompleted(battler); + gBattlerControllerFuncs[battler] = SetBattleEndCallbacks; } diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index c3e4a9037418..a74ca529b629 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -39,248 +39,162 @@ #include "constants/trainers.h" #include "trainer_hill.h" -static void OpponentHandleGetMonData(void); -static void OpponentHandleGetRawMonData(void); -static void OpponentHandleSetMonData(void); -static void OpponentHandleSetRawMonData(void); -static void OpponentHandleLoadMonSprite(void); -static void OpponentHandleSwitchInAnim(void); -static void OpponentHandleReturnMonToBall(void); -static void OpponentHandleDrawTrainerPic(void); -static void OpponentHandleTrainerSlide(void); -static void OpponentHandleTrainerSlideBack(void); -static void OpponentHandleFaintAnimation(void); -static void OpponentHandlePaletteFade(void); -static void OpponentHandleSuccessBallThrowAnim(void); -static void OpponentHandleBallThrow(void); -static void OpponentHandlePause(void); -static void OpponentHandleMoveAnimation(void); -static void OpponentHandlePrintString(void); -static void OpponentHandlePrintSelectionString(void); -static void OpponentHandleChooseAction(void); -static void OpponentHandleYesNoBox(void); -static void OpponentHandleChooseMove(void); -static void OpponentHandleChooseItem(void); -static void OpponentHandleChoosePokemon(void); -static void OpponentHandleCmd23(void); -static void OpponentHandleHealthBarUpdate(void); -static void OpponentHandleExpUpdate(void); -static void OpponentHandleStatusIconUpdate(void); -static void OpponentHandleStatusAnimation(void); -static void OpponentHandleStatusXor(void); -static void OpponentHandleDataTransfer(void); -static void OpponentHandleDMA3Transfer(void); -static void OpponentHandlePlayBGM(void); -static void OpponentHandleCmd32(void); -static void OpponentHandleTwoReturnValues(void); -static void OpponentHandleChosenMonReturnValue(void); -static void OpponentHandleOneReturnValue(void); -static void OpponentHandleOneReturnValue_Duplicate(void); -static void OpponentHandleClearUnkVar(void); -static void OpponentHandleSetUnkVar(void); -static void OpponentHandleClearUnkFlag(void); -static void OpponentHandleToggleUnkFlag(void); -static void OpponentHandleHitAnimation(void); -static void OpponentHandleCantSwitch(void); -static void OpponentHandlePlaySE(void); -static void OpponentHandlePlayFanfareOrBGM(void); -static void OpponentHandleFaintingCry(void); -static void OpponentHandleIntroSlide(void); -static void OpponentHandleIntroTrainerBallThrow(void); -static void OpponentHandleDrawPartyStatusSummary(void); -static void OpponentHandleHidePartyStatusSummary(void); -static void OpponentHandleEndBounceEffect(void); -static void OpponentHandleSpriteInvisibility(void); -static void OpponentHandleBattleAnimation(void); -static void OpponentHandleLinkStandbyMsg(void); -static void OpponentHandleResetActionMoveSelection(void); -static void OpponentHandleEndLinkBattle(void); -static void OpponentHandleDebugMenu(void); -static void OpponentCmdEnd(void); +static void OpponentHandleLoadMonSprite(u32 battler); +static void OpponentHandleSwitchInAnim(u32 battler); +static void OpponentHandleDrawTrainerPic(u32 battler); +static void OpponentHandleTrainerSlide(u32 battler); +static void OpponentHandleTrainerSlideBack(u32 battler); +static void OpponentHandleMoveAnimation(u32 battler); +static void OpponentHandlePrintString(u32 battler); +static void OpponentHandleChooseAction(u32 battler); +static void OpponentHandleChooseMove(u32 battler); +static void OpponentHandleChooseItem(u32 battler); +static void OpponentHandleChoosePokemon(u32 battler); +static void OpponentHandleHealthBarUpdate(u32 battler); +static void OpponentHandleIntroTrainerBallThrow(u32 battler); +static void OpponentHandleDrawPartyStatusSummary(u32 battler); +static void OpponentHandleBattleAnimation(u32 battler); +static void OpponentHandleEndLinkBattle(u32 battler); static u8 CountAIAliveNonEggMonsExcept(u8 slotToIgnore); -static void OpponentBufferRunCommand(void); -static void OpponentBufferExecCompleted(void); -static void SwitchIn_HandleSoundAndEnd(void); -static u32 GetOpponentMonData(u8 monId, u8 *dst); -static void SetOpponentMonData(u8 monId); -static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit); -static void DoSwitchOutAnimation(void); -static void OpponentDoMoveAnimation(void); -static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite); -static void Task_StartSendOutAnim(u8 taskId); -static void EndDrawPartyStatusSummary(void); - -static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = +static void OpponentBufferRunCommand(u32 battler); +static void OpponentBufferExecCompleted(u32 battler); +static void SwitchIn_HandleSoundAndEnd(u32 battler); + +static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(u32 battler) = { - [CONTROLLER_GETMONDATA] = OpponentHandleGetMonData, - [CONTROLLER_GETRAWMONDATA] = OpponentHandleGetRawMonData, - [CONTROLLER_SETMONDATA] = OpponentHandleSetMonData, - [CONTROLLER_SETRAWMONDATA] = OpponentHandleSetRawMonData, + [CONTROLLER_GETMONDATA] = BtlController_HandleGetMonData, + [CONTROLLER_GETRAWMONDATA] = BtlController_HandleGetRawMonData, + [CONTROLLER_SETMONDATA] = BtlController_HandleSetMonData, + [CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData, [CONTROLLER_LOADMONSPRITE] = OpponentHandleLoadMonSprite, [CONTROLLER_SWITCHINANIM] = OpponentHandleSwitchInAnim, - [CONTROLLER_RETURNMONTOBALL] = OpponentHandleReturnMonToBall, + [CONTROLLER_RETURNMONTOBALL] = BtlController_HandleReturnMonToBall, [CONTROLLER_DRAWTRAINERPIC] = OpponentHandleDrawTrainerPic, [CONTROLLER_TRAINERSLIDE] = OpponentHandleTrainerSlide, [CONTROLLER_TRAINERSLIDEBACK] = OpponentHandleTrainerSlideBack, - [CONTROLLER_FAINTANIMATION] = OpponentHandleFaintAnimation, - [CONTROLLER_PALETTEFADE] = OpponentHandlePaletteFade, - [CONTROLLER_SUCCESSBALLTHROWANIM] = OpponentHandleSuccessBallThrowAnim, - [CONTROLLER_BALLTHROWANIM] = OpponentHandleBallThrow, - [CONTROLLER_PAUSE] = OpponentHandlePause, + [CONTROLLER_FAINTANIMATION] = BtlController_HandleFaintAnimation, + [CONTROLLER_PALETTEFADE] = BtlController_Empty, + [CONTROLLER_SUCCESSBALLTHROWANIM] = BtlController_Empty, + [CONTROLLER_BALLTHROWANIM] = BtlController_Empty, + [CONTROLLER_PAUSE] = BtlController_Empty, [CONTROLLER_MOVEANIMATION] = OpponentHandleMoveAnimation, [CONTROLLER_PRINTSTRING] = OpponentHandlePrintString, - [CONTROLLER_PRINTSTRINGPLAYERONLY] = OpponentHandlePrintSelectionString, + [CONTROLLER_PRINTSTRINGPLAYERONLY] = BtlController_Empty, [CONTROLLER_CHOOSEACTION] = OpponentHandleChooseAction, - [CONTROLLER_YESNOBOX] = OpponentHandleYesNoBox, + [CONTROLLER_YESNOBOX] = BtlController_Empty, [CONTROLLER_CHOOSEMOVE] = OpponentHandleChooseMove, [CONTROLLER_OPENBAG] = OpponentHandleChooseItem, [CONTROLLER_CHOOSEPOKEMON] = OpponentHandleChoosePokemon, - [CONTROLLER_23] = OpponentHandleCmd23, + [CONTROLLER_23] = BtlController_Empty, [CONTROLLER_HEALTHBARUPDATE] = OpponentHandleHealthBarUpdate, - [CONTROLLER_EXPUPDATE] = OpponentHandleExpUpdate, - [CONTROLLER_STATUSICONUPDATE] = OpponentHandleStatusIconUpdate, - [CONTROLLER_STATUSANIMATION] = OpponentHandleStatusAnimation, - [CONTROLLER_STATUSXOR] = OpponentHandleStatusXor, - [CONTROLLER_DATATRANSFER] = OpponentHandleDataTransfer, - [CONTROLLER_DMA3TRANSFER] = OpponentHandleDMA3Transfer, - [CONTROLLER_PLAYBGM] = OpponentHandlePlayBGM, - [CONTROLLER_32] = OpponentHandleCmd32, - [CONTROLLER_TWORETURNVALUES] = OpponentHandleTwoReturnValues, - [CONTROLLER_CHOSENMONRETURNVALUE] = OpponentHandleChosenMonReturnValue, - [CONTROLLER_ONERETURNVALUE] = OpponentHandleOneReturnValue, - [CONTROLLER_ONERETURNVALUE_DUPLICATE] = OpponentHandleOneReturnValue_Duplicate, - [CONTROLLER_CLEARUNKVAR] = OpponentHandleClearUnkVar, - [CONTROLLER_SETUNKVAR] = OpponentHandleSetUnkVar, - [CONTROLLER_CLEARUNKFLAG] = OpponentHandleClearUnkFlag, - [CONTROLLER_TOGGLEUNKFLAG] = OpponentHandleToggleUnkFlag, - [CONTROLLER_HITANIMATION] = OpponentHandleHitAnimation, - [CONTROLLER_CANTSWITCH] = OpponentHandleCantSwitch, - [CONTROLLER_PLAYSE] = OpponentHandlePlaySE, - [CONTROLLER_PLAYFANFAREORBGM] = OpponentHandlePlayFanfareOrBGM, - [CONTROLLER_FAINTINGCRY] = OpponentHandleFaintingCry, - [CONTROLLER_INTROSLIDE] = OpponentHandleIntroSlide, + [CONTROLLER_EXPUPDATE] = BtlController_Empty, + [CONTROLLER_STATUSICONUPDATE] = BtlController_HandleStatusIconUpdate, + [CONTROLLER_STATUSANIMATION] = BtlController_HandleStatusAnimation, + [CONTROLLER_STATUSXOR] = BtlController_Empty, + [CONTROLLER_DATATRANSFER] = BtlController_Empty, + [CONTROLLER_DMA3TRANSFER] = BtlController_Empty, + [CONTROLLER_PLAYBGM] = BtlController_Empty, + [CONTROLLER_32] = BtlController_Empty, + [CONTROLLER_TWORETURNVALUES] = BtlController_Empty, + [CONTROLLER_CHOSENMONRETURNVALUE] = BtlController_Empty, + [CONTROLLER_ONERETURNVALUE] = BtlController_Empty, + [CONTROLLER_ONERETURNVALUE_DUPLICATE] = BtlController_Empty, + [CONTROLLER_CLEARUNKVAR] = BtlController_HandleClearUnkVar, + [CONTROLLER_SETUNKVAR] = BtlController_HandleSetUnkVar, + [CONTROLLER_CLEARUNKFLAG] = BtlController_HandleClearUnkFlag, + [CONTROLLER_TOGGLEUNKFLAG] = BtlController_HandleToggleUnkFlag, + [CONTROLLER_HITANIMATION] = BtlController_HandleHitAnimation, + [CONTROLLER_CANTSWITCH] = BtlController_Empty, + [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, + [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, + [CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry, + [CONTROLLER_INTROSLIDE] = BtlController_HandleIntroSlide, [CONTROLLER_INTROTRAINERBALLTHROW] = OpponentHandleIntroTrainerBallThrow, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = OpponentHandleDrawPartyStatusSummary, - [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = OpponentHandleHidePartyStatusSummary, - [CONTROLLER_ENDBOUNCE] = OpponentHandleEndBounceEffect, - [CONTROLLER_SPRITEINVISIBILITY] = OpponentHandleSpriteInvisibility, + [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = BtlController_HandleHidePartyStatusSummary, + [CONTROLLER_ENDBOUNCE] = BtlController_Empty, + [CONTROLLER_SPRITEINVISIBILITY] = BtlController_HandleSpriteInvisibility, [CONTROLLER_BATTLEANIMATION] = OpponentHandleBattleAnimation, - [CONTROLLER_LINKSTANDBYMSG] = OpponentHandleLinkStandbyMsg, - [CONTROLLER_RESETACTIONMOVESELECTION] = OpponentHandleResetActionMoveSelection, + [CONTROLLER_LINKSTANDBYMSG] = BtlController_Empty, + [CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty, [CONTROLLER_ENDLINKBATTLE] = OpponentHandleEndLinkBattle, - [CONTROLLER_DEBUGMENU] = OpponentHandleDebugMenu, - [CONTROLLER_TERMINATOR_NOP] = OpponentCmdEnd + [CONTROLLER_DEBUGMENU] = BtlController_Empty, + [CONTROLLER_TERMINATOR_NOP] = BtlController_TerminatorNop }; -// unknown unused data -static const u8 sUnused[] = {0xB0, 0xB0, 0xC8, 0x98, 0x28, 0x28, 0x28, 0x20}; - -static void OpponentDummy(void) +void SetControllerToOpponent(u32 battler) { + gBattlerControllerEndFuncs[battler] = OpponentBufferExecCompleted; + gBattlerControllerFuncs[battler] = OpponentBufferRunCommand; } -void SetControllerToOpponent(void) +static void OpponentBufferRunCommand(u32 battler) { - gBattlerControllerFuncs[gActiveBattler] = OpponentBufferRunCommand; -} - -static void OpponentBufferRunCommand(void) -{ - if (gBattleControllerExecFlags & gBitTable[gActiveBattler]) + if (gBattleControllerExecFlags & gBitTable[battler]) { - if (gBattleResources->bufferA[gActiveBattler][0] < ARRAY_COUNT(sOpponentBufferCommands)) - sOpponentBufferCommands[gBattleResources->bufferA[gActiveBattler][0]](); + if (gBattleResources->bufferA[battler][0] < ARRAY_COUNT(sOpponentBufferCommands)) + sOpponentBufferCommands[gBattleResources->bufferA[battler][0]](battler); else - OpponentBufferExecCompleted(); - } -} - -static void CompleteOnBattlerSpriteCallbackDummy(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - OpponentBufferExecCompleted(); -} - -static void CompleteOnBankSpriteCallbackDummy2(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - OpponentBufferExecCompleted(); -} - -static void FreeTrainerSpriteAfterSlide(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - { - FreeTrainerFrontPicPalette(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam); - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - OpponentBufferExecCompleted(); + OpponentBufferExecCompleted(battler); } } -static void Intro_DelayAndEnd(void) +static void Intro_DelayAndEnd(u32 battler) { - if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay == (u8)-1) + if (--gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay == (u8)-1) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0; - OpponentBufferExecCompleted(); + gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay = 0; + OpponentBufferExecCompleted(battler); } } -static bool32 TwoIntroMons(u32 battlerId) // Double battle with both opponent pokemon active. -{ - return (IsDoubleBattle() - && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[battlerId]]) - && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]])); -} - -static void Intro_WaitForShinyAnimAndHealthbox(void) +static void Intro_WaitForShinyAnimAndHealthbox(u32 battler) { bool8 healthboxAnimDone = FALSE; bool8 twoMons; - twoMons = TwoIntroMons(gActiveBattler); + twoMons = TwoOpponentIntroMons(battler); if (!twoMons || ((twoMons && (gBattleTypeFlags & BATTLE_TYPE_MULTI) && !BATTLE_TWO_VS_ONE_OPPONENT) || (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS))) { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy) healthboxAnimDone = TRUE; twoMons = FALSE; } else { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy + && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(battler)]].callback == SpriteCallbackDummy) healthboxAnimDone = TRUE; twoMons = TRUE; } - gBattleControllerOpponentHealthboxData = &gBattleSpritesDataPtr->healthBoxesData[gActiveBattler]; - gBattleControllerOpponentFlankHealthboxData = &gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)]; + gBattleControllerOpponentHealthboxData = &gBattleSpritesDataPtr->healthBoxesData[battler]; + gBattleControllerOpponentFlankHealthboxData = &gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)]; if (healthboxAnimDone) { if (twoMons == TRUE) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim - && gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) + if (gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim + && gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].finishedShinyMonAnim) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); } else return; } - else if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) + else if (gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim) { - if (GetBattlerPosition(gActiveBattler) == 3) + if (GetBattlerPosition(battler) == 3) { - if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) + if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].finishedShinyMonAnim) { FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); @@ -288,87 +202,87 @@ static void Intro_WaitForShinyAnimAndHealthbox(void) else return; } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE; } else return; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; - gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; + gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay = 3; + gBattlerControllerFuncs[battler] = Intro_DelayAndEnd; } } -static void Intro_TryShinyAnimShowHealthbox(void) +static void Intro_TryShinyAnimShowHealthbox(u32 battler) { bool32 bgmRestored = FALSE; bool32 battlerAnimsDone = FALSE; bool32 twoMons; - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) - TryShinyAnimation(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); + if (!gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive + && !gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim) + TryShinyAnimation(battler, &gEnemyParty[gBattlerPartyIndexes[battler]]); - twoMons = TwoIntroMons(gActiveBattler); + twoMons = TwoOpponentIntroMons(battler); if (!(gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) && (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) || BATTLE_TWO_VS_ONE_OPPONENT) && twoMons - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) - TryShinyAnimation(BATTLE_PARTNER(gActiveBattler), &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]); + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].ballAnimActive + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].finishedShinyMonAnim) + TryShinyAnimation(BATTLE_PARTNER(battler), &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]]); - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].ballAnimActive) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].healthboxSlideInStarted) { if (twoMons && (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) || BATTLE_TWO_VS_ONE_OPPONENT)) { - UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); - StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(battler)], &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]], HEALTHBOX_ALL); + StartHealthboxSlideIn(BATTLE_PARTNER(battler)); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(battler)]); } - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], &gEnemyParty[gBattlerPartyIndexes[battler]], HEALTHBOX_ALL); + StartHealthboxSlideIn(battler); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[battler]); } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = TRUE; + gBattleSpritesDataPtr->healthBoxesData[battler].healthboxSlideInStarted = TRUE; } - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry - && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].waitForCry + if (!gBattleSpritesDataPtr->healthBoxesData[battler].waitForCry + && gBattleSpritesDataPtr->healthBoxesData[battler].healthboxSlideInStarted + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].waitForCry && !IsCryPlayingOrClearCrySongs()) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].bgmRestored) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) { - if (GetBattlerPosition(gActiveBattler) == 1) + if (GetBattlerPosition(battler) == 1) m4aMPlayContinue(&gMPlayInfo_BGM); } else m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 0x100); } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = TRUE; + gBattleSpritesDataPtr->healthBoxesData[battler].bgmRestored = TRUE; bgmRestored = TRUE; } if (!twoMons || (twoMons && gBattleTypeFlags & BATTLE_TYPE_MULTI && !BATTLE_TWO_VS_ONE_OPPONENT)) { - if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattleControllerData[battler]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy) { battlerAnimsDone = TRUE; } } else { - if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) + if (gSprites[gBattleControllerData[battler]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy + && gSprites[gBattleControllerData[BATTLE_PARTNER(battler)]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[BATTLE_PARTNER(battler)]].callback == SpriteCallbackDummy) { battlerAnimsDone = TRUE; } @@ -378,881 +292,124 @@ static void Intro_TryShinyAnimShowHealthbox(void) { if (twoMons && (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) || BATTLE_TWO_VS_ONE_OPPONENT)) { - DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); - SetBattlerShadowSpriteCallback(BATTLE_PARTNER(gActiveBattler), GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], MON_DATA_SPECIES)); + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(battler)]]); + SetBattlerShadowSpriteCallback(BATTLE_PARTNER(battler), GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]], MON_DATA_SPECIES)); } - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); - SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); + DestroySprite(&gSprites[gBattleControllerData[battler]]); + SetBattlerShadowSpriteCallback(battler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES)); gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].bgmRestored = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].healthboxSlideInStarted = FALSE; - gBattlerControllerFuncs[gActiveBattler] = Intro_WaitForShinyAnimAndHealthbox; + gBattlerControllerFuncs[battler] = Intro_WaitForShinyAnimAndHealthbox; } } -static void TryShinyAnimAfterMonAnim(void) +static void TryShinyAnimAfterMonAnim(u32 battler) { - if (gSprites[gBattlerSpriteIds[gActiveBattler]].x2 == 0 - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) - TryShinyAnimation(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); + if (gSprites[gBattlerSpriteIds[battler]].x2 == 0 + && !gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim) + TryShinyAnimation(battler, &gEnemyParty[gBattlerPartyIndexes[battler]]); - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) + if (gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy + && gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); - OpponentBufferExecCompleted(); - } -} - -static void CompleteOnHealthbarDone(void) -{ - s16 hpValue = MoveBattleBar(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - if (hpValue != -1) - UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], HP_CURRENT, hpValue, gBattleMons[gActiveBattler].maxHP); - else - OpponentBufferExecCompleted(); -} - -static void HideHealthboxAfterMonFaint(void) -{ - if (!gSprites[gBattlerSpriteIds[gActiveBattler]].inUse) - { - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - OpponentBufferExecCompleted(); - } -} - -static void FreeMonSpriteAfterSwitchOutAnim(void) -{ - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - HideBattlerShadowSprite(gActiveBattler); - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - OpponentBufferExecCompleted(); - } -} - -static void CompleteOnInactiveTextPrinter(void) -{ - if (!IsTextPrinterActive(B_WIN_MSG)) - OpponentBufferExecCompleted(); -} - -static void DoHitAnimBlinkSpriteEffect(void) -{ - u8 spriteId = gBattlerSpriteIds[gActiveBattler]; - - if (gSprites[spriteId].data[1] == 32) - { - gSprites[spriteId].data[1] = 0; - gSprites[spriteId].invisible = FALSE; - gDoingBattleAnim = FALSE; - OpponentBufferExecCompleted(); - } - else - { - if ((gSprites[spriteId].data[1] % 4) == 0) - gSprites[spriteId].invisible ^= 1; - gSprites[spriteId].data[1]++; + OpponentBufferExecCompleted(battler); } } -static void SwitchIn_ShowSubstitute(void) +static void SwitchIn_ShowSubstitute(u32 battler) { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy) { - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_HandleSoundAndEnd; + if (gBattleSpritesDataPtr->battlerData[battler].behindSubstitute) + InitAndLaunchSpecialAnimation(battler, battler, battler, B_ANIM_MON_TO_SUBSTITUTE); + gBattlerControllerFuncs[battler] = SwitchIn_HandleSoundAndEnd; } } -static void SwitchIn_HandleSoundAndEnd(void) +static void SwitchIn_HandleSoundAndEnd(u32 battler) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive && !IsCryPlayingOrClearCrySongs()) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].specialAnimActive && !IsCryPlayingOrClearCrySongs()) { - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - || gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy_2) + if (gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy + || gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy_2) { m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 0x100); - OpponentBufferExecCompleted(); + OpponentBufferExecCompleted(battler); } } } -static void SwitchIn_ShowHealthbox(void) +static void SwitchIn_ShowHealthbox(u32 battler) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim - && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim + && gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); - StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0); - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - CopyBattleSpriteInvisibility(gActiveBattler); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowSubstitute; + StartSpriteAnim(&gSprites[gBattlerSpriteIds[battler]], 0); + UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], &gEnemyParty[gBattlerPartyIndexes[battler]], HEALTHBOX_ALL); + StartHealthboxSlideIn(battler); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[battler]); + CopyBattleSpriteInvisibility(battler); + gBattlerControllerFuncs[battler] = SwitchIn_ShowSubstitute; } } -static void SwitchIn_TryShinyAnim(void) +static void SwitchIn_TryShinyAnim(u32 battler) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) - TryShinyAnimation(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); + if (!gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive) + TryShinyAnimation(battler, &gEnemyParty[gBattlerPartyIndexes[battler]]); - if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) + if (gSprites[gBattleControllerData[battler]].callback == SpriteCallbackDummy + && !gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive) { - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); - SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowHealthbox; + DestroySprite(&gSprites[gBattleControllerData[battler]]); + SetBattlerShadowSpriteCallback(battler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES)); + gBattlerControllerFuncs[battler] = SwitchIn_ShowHealthbox; } } -static void CompleteOnFinishedStatusAnimation(void) +static void OpponentBufferExecCompleted(u32 battler) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].statusAnimActive) - OpponentBufferExecCompleted(); -} - -static void CompleteOnFinishedBattleAnimation(void) -{ - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive) - OpponentBufferExecCompleted(); -} - -static void OpponentBufferExecCompleted(void) -{ - gBattlerControllerFuncs[gActiveBattler] = OpponentBufferRunCommand; + gBattlerControllerFuncs[battler] = OpponentBufferRunCommand; if (gBattleTypeFlags & BATTLE_TYPE_LINK) { u8 playerId = GetMultiplayerId(); - PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleResources->bufferA[gActiveBattler][0] = CONTROLLER_TERMINATOR_NOP; - } - else - { - gBattleControllerExecFlags &= ~gBitTable[gActiveBattler]; - } -} - -static void OpponentHandleGetMonData(void) -{ - u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data - u32 size = 0; - u8 monToCheck; - s32 i; - - if (gBattleResources->bufferA[gActiveBattler][2] == 0) - { - size += GetOpponentMonData(gBattlerPartyIndexes[gActiveBattler], monData); - } - else - { - monToCheck = gBattleResources->bufferA[gActiveBattler][2]; - for (i = 0; i < PARTY_SIZE; i++) - { - if (monToCheck & 1) - size += GetOpponentMonData(i, monData + size); - monToCheck >>= 1; - } - } - BtlController_EmitDataTransfer(BUFFER_B, size, monData); - OpponentBufferExecCompleted(); -} - -static u32 GetOpponentMonData(u8 monId, u8 *dst) -{ - struct BattlePokemon battleMon; - struct MovePpInfo moveData; - u8 nickname[20]; - u8 *src; - s16 data16; - u32 data32; - s32 size = 0; - - switch (gBattleResources->bufferA[gActiveBattler][1]) - { - case REQUEST_ALL_BATTLE: - battleMon.species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES); - battleMon.item = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM); - for (size = 0; size < MAX_MON_MOVES; size++) - { - battleMon.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size); - battleMon.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); - } - battleMon.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); - battleMon.friendship = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP); - battleMon.experience = GetMonData(&gEnemyParty[monId], MON_DATA_EXP); - battleMon.hpIV = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); - battleMon.attackIV = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); - battleMon.defenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); - battleMon.speedIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); - battleMon.spAttackIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); - battleMon.spDefenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); - battleMon.personality = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY); - battleMon.status1 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS); - battleMon.level = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL); - battleMon.hp = GetMonData(&gEnemyParty[monId], MON_DATA_HP); - battleMon.maxHP = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP); - battleMon.attack = GetMonData(&gEnemyParty[monId], MON_DATA_ATK); - battleMon.defense = GetMonData(&gEnemyParty[monId], MON_DATA_DEF); - battleMon.speed = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED); - battleMon.spAttack = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK); - battleMon.spDefense = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF); - battleMon.abilityNum = GetMonData(&gEnemyParty[monId], MON_DATA_ABILITY_NUM); - battleMon.otId = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID); - battleMon.metLevel = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL); - GetMonData(&gEnemyParty[monId], MON_DATA_NICKNAME, nickname); - StringCopy_Nickname(battleMon.nickname, nickname); - GetMonData(&gEnemyParty[monId], MON_DATA_OT_NAME, battleMon.otName); - src = (u8 *)&battleMon; - for (size = 0; size < sizeof(battleMon); size++) - dst[size] = src[size]; - break; - case REQUEST_SPECIES_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_HELDITEM_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_MOVES_PP_BATTLE: - for (size = 0; size < MAX_MON_MOVES; size++) - { - moveData.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size); - moveData.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); - } - moveData.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); - src = (u8 *)(&moveData); - for (size = 0; size < sizeof(moveData); size++) - dst[size] = src[size]; - break; - case REQUEST_MOVE1_BATTLE: - case REQUEST_MOVE2_BATTLE: - case REQUEST_MOVE3_BATTLE: - case REQUEST_MOVE4_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_PP_DATA_BATTLE: - for (size = 0; size < MAX_MON_MOVES; size++) - dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); - dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); - size++; - break; - case REQUEST_PPMOVE1_BATTLE: - case REQUEST_PPMOVE2_BATTLE: - case REQUEST_PPMOVE3_BATTLE: - case REQUEST_PPMOVE4_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE); - size = 1; - break; - case REQUEST_OTID_BATTLE: - data32 = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - size = 3; - break; - case REQUEST_EXP_BATTLE: - data32 = GetMonData(&gEnemyParty[monId], MON_DATA_EXP); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - size = 3; - break; - case REQUEST_HP_EV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_EV); - size = 1; - break; - case REQUEST_ATK_EV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV); - size = 1; - break; - case REQUEST_DEF_EV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV); - size = 1; - break; - case REQUEST_SPEED_EV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV); - size = 1; - break; - case REQUEST_SPATK_EV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV); - size = 1; - break; - case REQUEST_SPDEF_EV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV); - size = 1; - break; - case REQUEST_FRIENDSHIP_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP); - size = 1; - break; - case REQUEST_POKERUS_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKERUS); - size = 1; - break; - case REQUEST_MET_LOCATION_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION); - size = 1; - break; - case REQUEST_MET_LEVEL_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL); - size = 1; - break; - case REQUEST_MET_GAME_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME); - size = 1; - break; - case REQUEST_POKEBALL_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL); - size = 1; - break; - case REQUEST_ALL_IVS_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); - dst[1] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); - dst[2] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); - dst[3] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); - dst[4] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); - dst[5] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); - size = 6; - break; - case REQUEST_HP_IV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); - size = 1; - break; - case REQUEST_ATK_IV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); - size = 1; - break; - case REQUEST_DEF_IV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); - size = 1; - break; - case REQUEST_SPEED_IV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); - size = 1; - break; - case REQUEST_SPATK_IV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); - size = 1; - break; - case REQUEST_SPDEF_IV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); - size = 1; - break; - case REQUEST_PERSONALITY_BATTLE: - data32 = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - dst[3] = (data32 & 0xFF000000) >> 24; - size = 4; - break; - case REQUEST_CHECKSUM_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_STATUS_BATTLE: - data32 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - dst[3] = (data32 & 0xFF000000) >> 24; - size = 4; - break; - case REQUEST_LEVEL_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL); - size = 1; - break; - case REQUEST_HP_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HP); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_MAX_HP_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_ATK_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_ATK); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_DEF_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_DEF); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPEED_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPATK_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPDEF_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_COOL_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL); - size = 1; - break; - case REQUEST_BEAUTY_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY); - size = 1; - break; - case REQUEST_CUTE_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE); - size = 1; - break; - case REQUEST_SMART_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART); - size = 1; - break; - case REQUEST_TOUGH_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH); - size = 1; - break; - case REQUEST_SHEEN_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SHEEN); - size = 1; - break; - case REQUEST_COOL_RIBBON_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON); - size = 1; - break; - case REQUEST_BEAUTY_RIBBON_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON); - size = 1; - break; - case REQUEST_CUTE_RIBBON_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON); - size = 1; - break; - case REQUEST_SMART_RIBBON_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON); - size = 1; - break; - case REQUEST_TOUGH_RIBBON_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON); - size = 1; - break; - } - - return size; -} - -static void OpponentHandleGetRawMonData(void) -{ - struct BattlePokemon battleMon; - u8 *src = (u8 *)&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleResources->bufferA[gActiveBattler][1]; - u8 *dst = (u8 *)&battleMon + gBattleResources->bufferA[gActiveBattler][1]; - u8 i; - - for (i = 0; i < gBattleResources->bufferA[gActiveBattler][2]; i++) - dst[i] = src[i]; - - BtlController_EmitDataTransfer(BUFFER_B, gBattleResources->bufferA[gActiveBattler][2], dst); - OpponentBufferExecCompleted(); -} - -static void OpponentHandleSetMonData(void) -{ - u8 monToCheck; - u8 i; - - if (gBattleResources->bufferA[gActiveBattler][2] == 0) - { - SetOpponentMonData(gBattlerPartyIndexes[gActiveBattler]); + PrepareBufferDataTransferLink(battler, 2, 4, &playerId); + gBattleResources->bufferA[battler][0] = CONTROLLER_TERMINATOR_NOP; } else { - monToCheck = gBattleResources->bufferA[gActiveBattler][2]; - for (i = 0; i < PARTY_SIZE; i++) - { - if (monToCheck & 1) - SetOpponentMonData(i); - monToCheck >>= 1; - } - } - OpponentBufferExecCompleted(); -} - -static void SetOpponentMonData(u8 monId) -{ - struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleResources->bufferA[gActiveBattler][3]; - struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleResources->bufferA[gActiveBattler][3]; - s32 i; - - switch (gBattleResources->bufferA[gActiveBattler][1]) - { - case REQUEST_ALL_BATTLE: - { - u8 iv; - - SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &battlePokemon->species); - SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); - for (i = 0; i < MAX_MON_MOVES; i++) - { - SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); - SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); - } - SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); - SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); - SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &battlePokemon->experience); - iv = battlePokemon->hpIV; - SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &iv); - iv = battlePokemon->attackIV; - SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &iv); - iv = battlePokemon->defenseIV; - SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &iv); - iv = battlePokemon->speedIV; - SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &iv); - iv = battlePokemon->spAttackIV; - SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &iv); - iv = battlePokemon->spDefenseIV; - SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &iv); - SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); - SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &battlePokemon->status1); - SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &battlePokemon->level); - SetMonData(&gEnemyParty[monId], MON_DATA_HP, &battlePokemon->hp); - SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); - SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &battlePokemon->attack); - SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &battlePokemon->defense); - SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &battlePokemon->speed); - SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); - SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); - } - break; - case REQUEST_SPECIES_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HELDITEM_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MOVES_PP_BATTLE: - for (i = 0; i < MAX_MON_MOVES; i++) - { - SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); - SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); - } - SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); - break; - case REQUEST_MOVE1_BATTLE: - case REQUEST_MOVE2_BATTLE: - case REQUEST_MOVE3_BATTLE: - case REQUEST_MOVE4_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_PP_DATA_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_PP1, &gBattleResources->bufferA[gActiveBattler][3]); - SetMonData(&gEnemyParty[monId], MON_DATA_PP2, &gBattleResources->bufferA[gActiveBattler][4]); - SetMonData(&gEnemyParty[monId], MON_DATA_PP3, &gBattleResources->bufferA[gActiveBattler][5]); - SetMonData(&gEnemyParty[monId], MON_DATA_PP4, &gBattleResources->bufferA[gActiveBattler][6]); - SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &gBattleResources->bufferA[gActiveBattler][7]); - break; - case REQUEST_PPMOVE1_BATTLE: - case REQUEST_PPMOVE2_BATTLE: - case REQUEST_PPMOVE3_BATTLE: - case REQUEST_PPMOVE4_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_OTID_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_OT_ID, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_EXP_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HP_EV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_HP_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_EV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_EV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_EV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_EV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_EV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_FRIENDSHIP_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_POKERUS_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_POKERUS, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_LOCATION_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_LEVEL_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_GAME_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_POKEBALL_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ALL_IVS_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]); - SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][4]); - SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][5]); - SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][6]); - SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][7]); - SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][8]); - break; - case REQUEST_HP_IV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_IV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_IV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_IV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_IV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_IV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_PERSONALITY_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CHECKSUM_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_STATUS_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_LEVEL_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HP_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_HP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MAX_HP_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_COOL_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_COOL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_BEAUTY_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CUTE_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_CUTE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SMART_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SMART, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_TOUGH_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SHEEN_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SHEEN, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_COOL_RIBBON_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_BEAUTY_RIBBON_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CUTE_RIBBON_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SMART_RIBBON_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_TOUGH_RIBBON_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; + gBattleControllerExecFlags &= ~gBitTable[battler]; } } -static void OpponentHandleSetRawMonData(void) -{ - u8 *dst = (u8 *)&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleResources->bufferA[gActiveBattler][1]; - u8 i; - - for (i = 0; i < gBattleResources->bufferA[gActiveBattler][2]; i++) - dst[i] = gBattleResources->bufferA[gActiveBattler][3 + i]; - - OpponentBufferExecCompleted(); -} - -static void OpponentHandleLoadMonSprite(void) -{ - u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - - BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler)); - - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(gActiveBattler, BATTLER_COORD_X_2), - GetBattlerSpriteDefault_Y(gActiveBattler), - GetBattlerSpriteSubpriority(gActiveBattler)); - - gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = -DISPLAY_WIDTH; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = species; - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); - - SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - - gBattlerControllerFuncs[gActiveBattler] = TryShinyAnimAfterMonAnim; -} - -static void OpponentHandleSwitchInAnim(void) -{ - *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = PARTY_SIZE; - gBattlerPartyIndexes[gActiveBattler] = gBattleResources->bufferA[gActiveBattler][1]; - StartSendOutAnim(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_TryShinyAnim; -} - -static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) +static void OpponentHandleLoadMonSprite(u32 battler) { - u16 species; - - ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit); - gBattlerPartyIndexes[battlerId] = gBattleResources->bufferA[battlerId][1]; - species = GetIllusionMonSpecies(battlerId); - if (species == SPECIES_NONE) - species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); - gBattleControllerData[battlerId] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim); - BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId); - SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId)); - - gBattlerSpriteIds[battlerId] = CreateSprite(&gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2), - GetBattlerSpriteDefault_Y(battlerId), - GetBattlerSpriteSubpriority(battlerId)); - - gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId; - gSprites[gBattlerSpriteIds[battlerId]].data[2] = species; - - gSprites[gBattleControllerData[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; - gSprites[gBattleControllerData[battlerId]].data[2] = battlerId; - - gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId; - - StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]); - - gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE; - gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy; - - gSprites[gBattleControllerData[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT); -} - -static void OpponentHandleReturnMonToBall(void) -{ - if (gBattleResources->bufferA[gActiveBattler][1] == 0) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation; - } - else - { - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - HideBattlerShadowSprite(gActiveBattler); - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - OpponentBufferExecCompleted(); - } + BtlController_HandleLoadMonSprite(battler, TryShinyAnimAfterMonAnim); } -static void DoSwitchOutAnimation(void) +static void OpponentHandleSwitchInAnim(u32 battler) { - switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState) - { - case 0: - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON); - - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1; - break; - case 1: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_OPPONENT_MON); - gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim; - } - break; - } + gBattleStruct->monToSwitchIntoId[battler] = PARTY_SIZE; + BtlController_HandleSwitchInAnim(battler, FALSE, SwitchIn_TryShinyAnim); } -#define sSpeedX data[0] - -static void OpponentHandleDrawTrainerPic(void) +static u32 OpponentGetTrainerPicId(u32 battlerId) { u32 trainerPicId; - s16 xPos; if (gBattleTypeFlags & BATTLE_TYPE_SECRET_BASE) { @@ -1266,7 +423,7 @@ static void OpponentHandleDrawTrainerPic(void) { if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) { - if (gActiveBattler == 1) + if (battlerId == 1) trainerPicId = GetTrainerHillTrainerFrontSpriteId(gTrainerBattleOpponent_A); else trainerPicId = GetTrainerHillTrainerFrontSpriteId(gTrainerBattleOpponent_B); @@ -1280,7 +437,7 @@ static void OpponentHandleDrawTrainerPic(void) { if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_TOWER_LINK_MULTI)) { - if (gActiveBattler == 1) + if (battlerId == 1) trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); else trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_B); @@ -1296,7 +453,7 @@ static void OpponentHandleDrawTrainerPic(void) } else if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) { - if (gActiveBattler != 1) + if (battlerId != 1) trainerPicId = gTrainers[gTrainerBattleOpponent_B].trainerPic; else trainerPicId = gTrainers[gTrainerBattleOpponent_A].trainerPic; @@ -1306,9 +463,17 @@ static void OpponentHandleDrawTrainerPic(void) trainerPicId = gTrainers[gTrainerBattleOpponent_A].trainerPic; } + return trainerPicId; +} + +static void OpponentHandleDrawTrainerPic(u32 battler) +{ + s16 xPos; + u32 trainerPicId = OpponentGetTrainerPicId(battler); + if (gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_TWO_OPPONENTS) && !BATTLE_TWO_VS_ONE_OPPONENT) { - if ((GetBattlerPosition(gActiveBattler) & BIT_FLANK) != 0) // second mon + if ((GetBattlerPosition(battler) & BIT_FLANK) != 0) // second mon xPos = 152; else // first mon xPos = 200; @@ -1318,295 +483,93 @@ static void OpponentHandleDrawTrainerPic(void) xPos = 176; } - DecompressTrainerFrontPic(trainerPicId, gActiveBattler); - SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, - xPos, - (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 40, - GetBattlerSpriteSubpriority(gActiveBattler)); - - gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = -DISPLAY_WIDTH; - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 2; - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; - - gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy; -} - -static void OpponentHandleTrainerSlide(void) -{ - u32 trainerPicId; - - if (gBattleTypeFlags & BATTLE_TYPE_SECRET_BASE) - { - trainerPicId = GetSecretBaseTrainerPicIndex(); - } - else if (gTrainerBattleOpponent_A == TRAINER_FRONTIER_BRAIN) - { - trainerPicId = GetFrontierBrainTrainerPicIndex(); - } - else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL) - { - if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) - { - if (gActiveBattler == 1) - trainerPicId = GetTrainerHillTrainerFrontSpriteId(gTrainerBattleOpponent_A); - else - trainerPicId = GetTrainerHillTrainerFrontSpriteId(gTrainerBattleOpponent_B); - } - else - { - trainerPicId = GetTrainerHillTrainerFrontSpriteId(gTrainerBattleOpponent_A); - } - } - else if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER) - { - if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_TOWER_LINK_MULTI)) - { - if (gActiveBattler == 1) - trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); - else - trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_B); - } - else - { - trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); - } - } - else if (gBattleTypeFlags & BATTLE_TYPE_EREADER_TRAINER) - { - trainerPicId = GetEreaderTrainerFrontSpriteId(); - } - else if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) - { - if (gActiveBattler != 1) - trainerPicId = gTrainers[gTrainerBattleOpponent_B].trainerPic; - else - trainerPicId = gTrainers[gTrainerBattleOpponent_A].trainerPic; - } - else - { - trainerPicId = gTrainers[gTrainerBattleOpponent_A].trainerPic; - } - - DecompressTrainerFrontPic(trainerPicId, gActiveBattler); - SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, 176, (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 40, 0x1E); - - gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = 96; - gSprites[gBattlerSpriteIds[gActiveBattler]].x += 32; - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; - - gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy2; -} - -#undef sSpeedX - -static void OpponentHandleTrainerSlideBack(void) -{ - SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 280; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].y; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); - gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; -} - -static void OpponentHandleFaintAnimation(void) -{ - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState == 0) - { - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState++; - } - else - { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - PlaySE12WithPanning(SE_FAINT, SOUND_PAN_TARGET); - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintOpponentMon; - gBattlerControllerFuncs[gActiveBattler] = HideHealthboxAfterMonFaint; - } - } -} - -static void OpponentHandlePaletteFade(void) -{ - OpponentBufferExecCompleted(); -} - -static void OpponentHandleSuccessBallThrowAnim(void) -{ - OpponentBufferExecCompleted(); -} - -static void OpponentHandleBallThrow(void) -{ - OpponentBufferExecCompleted(); -} - -static void OpponentHandlePause(void) -{ - OpponentBufferExecCompleted(); + BtlController_HandleDrawTrainerPic(battler, trainerPicId, TRUE, + xPos, 40 + 4 * (8 - gTrainerFrontPicCoords[trainerPicId].size), + -1); } -static void OpponentHandleMoveAnimation(void) +static void OpponentHandleTrainerSlide(u32 battler) { - if (!IsBattleSEPlaying(gActiveBattler)) - { - u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); - - gAnimMoveTurn = gBattleResources->bufferA[gActiveBattler][3]; - gAnimMovePower = gBattleResources->bufferA[gActiveBattler][4] | (gBattleResources->bufferA[gActiveBattler][5] << 8); - gAnimMoveDmg = gBattleResources->bufferA[gActiveBattler][6] | (gBattleResources->bufferA[gActiveBattler][7] << 8) | (gBattleResources->bufferA[gActiveBattler][8] << 16) | (gBattleResources->bufferA[gActiveBattler][9] << 24); - gAnimFriendship = gBattleResources->bufferA[gActiveBattler][10]; - gWeatherMoveAnim = gBattleResources->bufferA[gActiveBattler][12] | (gBattleResources->bufferA[gActiveBattler][13] << 8); - gAnimDisableStructPtr = (struct DisableStruct *)&gBattleResources->bufferA[gActiveBattler][16]; - gTransformedPersonalities[gActiveBattler] = gAnimDisableStructPtr->transformedMonPersonality; - gTransformedOtIds[gActiveBattler] = gAnimDisableStructPtr->transformedMonOtId; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerControllerFuncs[gActiveBattler] = OpponentDoMoveAnimation; - } -} - -static void OpponentDoMoveAnimation(void) -{ - u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); - u8 multihit = gBattleResources->bufferA[gActiveBattler][11]; - - switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState) - { - case 0: - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute - && !gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8) - { - gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 1; - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON); - } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1; - break; - case 1: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF); - DoMoveAnim(move); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2; - } - break; - case 2: - gAnimScriptCallback(); - if (!gAnimScriptActive) - { - SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL); - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2) - { - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 0; - } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 3; - } - break; - case 3: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - CopyAllBattleSpritesInvisibilities(); - TrySetBehindSubstituteSpriteBit(gActiveBattler, gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - OpponentBufferExecCompleted(); - } - break; - } + u32 trainerPicId = OpponentGetTrainerPicId(battler); + BtlController_HandleTrainerSlide(battler, trainerPicId); } -static void OpponentHandlePrintString(void) +static void OpponentHandleTrainerSlideBack(u32 battler) { - u16 *stringId; - - gBattle_BG0_X = 0; - gBattle_BG0_Y = 0; - stringId = (u16 *)(&gBattleResources->bufferA[gActiveBattler][2]); - BufferStringBattle(*stringId); - BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG); - gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; - BattleArena_DeductSkillPoints(gActiveBattler, *stringId); + BtlController_HandleTrainerSlideBack(battler, 35, FALSE); } -static void OpponentHandlePrintSelectionString(void) +static void OpponentHandleMoveAnimation(u32 battler) { - OpponentBufferExecCompleted(); + BtlController_HandleMoveAnimation(battler, FALSE); } -static void OpponentHandleChooseAction(void) +static void OpponentHandlePrintString(u32 battler) { - AI_TrySwitchOrUseItem(); - OpponentBufferExecCompleted(); + BtlController_HandlePrintString(battler, FALSE, TRUE); } -static void OpponentHandleYesNoBox(void) +static void OpponentHandleChooseAction(u32 battler) { - OpponentBufferExecCompleted(); + AI_TrySwitchOrUseItem(battler); + OpponentBufferExecCompleted(battler); } -static void OpponentHandleChooseMove(void) +static void OpponentHandleChooseMove(u32 battler) { u8 chosenMoveId; - struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[gActiveBattler][4]); + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]); if (gBattleTypeFlags & (BATTLE_TYPE_TRAINER | BATTLE_TYPE_FIRST_BATTLE | BATTLE_TYPE_SAFARI | BATTLE_TYPE_ROAMER) || IsWildMonSmart()) { if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - BtlController_EmitTwoReturnValues(BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace()); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace(battler)); } else { - chosenMoveId = gBattleStruct->aiMoveOrAction[gActiveBattler]; - gBattlerTarget = gBattleStruct->aiChosenTarget[gActiveBattler]; + chosenMoveId = gBattleStruct->aiMoveOrAction[battler]; + gBattlerTarget = gBattleStruct->aiChosenTarget[battler]; switch (chosenMoveId) { case AI_CHOICE_WATCH: - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SAFARI_WATCH_CAREFULLY, 0); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_SAFARI_WATCH_CAREFULLY, 0); break; case AI_CHOICE_FLEE: - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_RUN, 0); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_RUN, 0); break; case AI_CHOICE_SWITCH: - BtlController_EmitTwoReturnValues(BUFFER_B, 10, 0xFFFF); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, 0xFFFF); break; case 6: - BtlController_EmitTwoReturnValues(BUFFER_B, 15, gBattlerTarget); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 15, gBattlerTarget); break; default: { u16 chosenMove = moveInfo->moves[chosenMoveId]; - if (GetBattlerMoveTargetType(gActiveBattler, chosenMove) & (MOVE_TARGET_USER_OR_SELECTED | MOVE_TARGET_USER)) - gBattlerTarget = gActiveBattler; - if (GetBattlerMoveTargetType(gActiveBattler, chosenMove) & MOVE_TARGET_BOTH) + if (GetBattlerMoveTargetType(battler, chosenMove) & (MOVE_TARGET_USER_OR_SELECTED | MOVE_TARGET_USER)) + gBattlerTarget = battler; + if (GetBattlerMoveTargetType(battler, chosenMove) & MOVE_TARGET_BOTH) { gBattlerTarget = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); if (gAbsentBattlerFlags & gBitTable[gBattlerTarget]) gBattlerTarget = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); } - if (ShouldUseZMove(gActiveBattler, gBattlerTarget, chosenMove)) - QueueZMove(gActiveBattler, chosenMove); - if (CanMegaEvolve(gActiveBattler)) // If opponent can mega evolve, do it. - BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (RET_MEGA_EVOLUTION) | (gBattlerTarget << 8)); + if (ShouldUseZMove(battler, gBattlerTarget, chosenMove)) + QueueZMove(battler, chosenMove); + if (CanMegaEvolve(battler)) // If opponent can mega evolve, do it. + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (RET_MEGA_EVOLUTION) | (gBattlerTarget << 8)); + else if (CanUltraBurst(battler)) + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (RET_ULTRA_BURST) | (gBattlerTarget << 8)); else - BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (gBattlerTarget << 8)); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (gBattlerTarget << 8)); } break; } } - OpponentBufferExecCompleted(); + OpponentBufferExecCompleted(battler); } else // Wild pokemon - use random move { @@ -1618,13 +581,13 @@ static void OpponentHandleChooseMove(void) move = moveInfo->moves[chosenMoveId]; } while (move == MOVE_NONE); - if (GetBattlerMoveTargetType(gActiveBattler, move) & (MOVE_TARGET_USER_OR_SELECTED | MOVE_TARGET_USER)) - BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (gActiveBattler << 8)); + if (GetBattlerMoveTargetType(battler, move) & (MOVE_TARGET_USER_OR_SELECTED | MOVE_TARGET_USER)) + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (battler << 8)); else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { do { target = GetBattlerAtPosition(Random() & 2); - } while (!CanTargetBattler(gActiveBattler, target, move)); + } while (!CanTargetBattler(battler, target, move)); #if B_WILD_NATURAL_ENEMIES == TRUE // Don't bother to loop through table if the move can't attack ally @@ -1641,8 +604,8 @@ static void OpponentHandleChooseMove(void) {SPECIES_SABLEYE, SPECIES_CARBINK}, {SPECIES_MAREANIE, SPECIES_CORSOLA}, }; - speciesAttacker = gBattleMons[gActiveBattler].species; - speciesTarget = gBattleMons[GetBattlerAtPosition(BATTLE_PARTNER(gActiveBattler))].species; + speciesAttacker = gBattleMons[battler].species; + speciesTarget = gBattleMons[GetBattlerAtPosition(BATTLE_PARTNER(battler))].species; for (i = 0; i < ARRAY_COUNT(naturalEnemies); i++) { @@ -1652,43 +615,42 @@ static void OpponentHandleChooseMove(void) break; } } - if (isPartnerEnemy && CanTargetBattler(gActiveBattler, target, move)) - BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (GetBattlerAtPosition(BATTLE_PARTNER(gActiveBattler)) << 8)); + if (isPartnerEnemy && CanTargetBattler(battler, target, move)) + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (GetBattlerAtPosition(BATTLE_PARTNER(battler)) << 8)); else - BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (target << 8)); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (target << 8)); } else #endif - BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (target << 8)); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (target << 8)); } else - BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) << 8)); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) << 8)); - OpponentBufferExecCompleted(); + OpponentBufferExecCompleted(battler); } } -static void OpponentHandleChooseItem(void) +static void OpponentHandleChooseItem(u32 battler) { - BtlController_EmitOneReturnValue(BUFFER_B, gBattleStruct->chosenItem[gActiveBattler]); - OpponentBufferExecCompleted(); + BtlController_EmitOneReturnValue(battler, BUFFER_B, gBattleStruct->chosenItem[battler]); + OpponentBufferExecCompleted(battler); } -static void OpponentHandleChoosePokemon(void) +static void OpponentHandleChoosePokemon(u32 battler) { s32 chosenMonId; s32 pokemonInBattle = 1; // Choosing Revival Blessing target - if ((gBattleResources->bufferA[gActiveBattler][1] & 0xF) == PARTY_ACTION_CHOOSE_FAINTED_MON) + if ((gBattleResources->bufferA[battler][1] & 0xF) == PARTY_ACTION_CHOOSE_FAINTED_MON) { - chosenMonId = gSelectedMonPartyId = GetFirstFaintedPartyIndex(gActiveBattler); + chosenMonId = gSelectedMonPartyId = GetFirstFaintedPartyIndex(battler); } // Switching out - else if (*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) == PARTY_SIZE) + else if (*(gBattleStruct->AI_monToSwitchIntoId + battler) == PARTY_SIZE) { - chosenMonId = GetMostSuitableMonToSwitchInto(); - + chosenMonId = GetMostSuitableMonToSwitchInto(battler); if (chosenMonId == PARTY_SIZE) { s32 battler1, battler2, firstId, lastId; @@ -1702,14 +664,13 @@ static void OpponentHandleChoosePokemon(void) battler1 = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); battler2 = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); pokemonInBattle = 2; - } - GetAIPartyIndexes(gActiveBattler, &firstId, &lastId); + GetAIPartyIndexes(battler, &firstId, &lastId); for (chosenMonId = (lastId-1); chosenMonId >= firstId; chosenMonId--) { - if (GetMonData(&gEnemyParty[chosenMonId], MON_DATA_HP) != 0 + if (IsValidForBattle(&gEnemyParty[chosenMonId]) && chosenMonId != gBattlerPartyIndexes[battler1] && chosenMonId != gBattlerPartyIndexes[battler2] && (!(AI_THINKING_STRUCT->aiFlags & AI_FLAG_ACE_POKEMON) @@ -1720,16 +681,16 @@ static void OpponentHandleChoosePokemon(void) } } } - *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = chosenMonId; + *(gBattleStruct->monToSwitchIntoId + battler) = chosenMonId; } else { - chosenMonId = *(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler); - *(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = PARTY_SIZE; - *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = chosenMonId; + chosenMonId = *(gBattleStruct->AI_monToSwitchIntoId + battler); + *(gBattleStruct->AI_monToSwitchIntoId + battler) = PARTY_SIZE; + *(gBattleStruct->monToSwitchIntoId + battler) = chosenMonId; } - BtlController_EmitChosenMonReturnValue(BUFFER_B, chosenMonId, NULL); - OpponentBufferExecCompleted(); + BtlController_EmitChosenMonReturnValue(battler, BUFFER_B, chosenMonId, NULL); + OpponentBufferExecCompleted(battler); } @@ -1740,9 +701,7 @@ static u8 CountAIAliveNonEggMonsExcept(u8 slotToIgnore) for (i = 0, count = 0; i < PARTY_SIZE; i++) { if (i != slotToIgnore - && GetMonData(&gEnemyParty[i], MON_DATA_SPECIES) != SPECIES_NONE - && !GetMonData(&gEnemyParty[i], MON_DATA_IS_EGG) - && GetMonData(&gEnemyParty[i], MON_DATA_HP) != 0) + && IsValidForBattle(&gEnemyParty[i])) { count++; } @@ -1751,343 +710,27 @@ static u8 CountAIAliveNonEggMonsExcept(u8 slotToIgnore) return count; } -static void OpponentHandleCmd23(void) -{ - OpponentBufferExecCompleted(); -} - -static void OpponentHandleHealthBarUpdate(void) -{ - s16 hpVal; - - LoadBattleBarGfx(0); - hpVal = (gBattleResources->bufferA[gActiveBattler][3] << 8) | gBattleResources->bufferA[gActiveBattler][2]; - - if (hpVal != INSTANT_HP_BAR_DROP) - { - u32 maxHP = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); - u32 curHP = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_HP); - - SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, curHP, hpVal); - } - else - { - u32 maxHP = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); - - SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, 0, hpVal); - } - - gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthbarDone; -} - -static void OpponentHandleExpUpdate(void) -{ - OpponentBufferExecCompleted(); -} - -static void OpponentHandleStatusIconUpdate(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) - { - u8 battlerId; - - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON); - battlerId = gActiveBattler; - gBattleSpritesDataPtr->healthBoxesData[battlerId].statusAnimActive = 0; - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; - } -} - -static void OpponentHandleStatusAnimation(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) - { - InitAndLaunchChosenStatusAnimation(gBattleResources->bufferA[gActiveBattler][1], - gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8) | (gBattleResources->bufferA[gActiveBattler][4] << 16) | (gBattleResources->bufferA[gActiveBattler][5] << 24)); - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; - } -} - -static void OpponentHandleStatusXor(void) -{ - OpponentBufferExecCompleted(); -} - -static void OpponentHandleDataTransfer(void) -{ - OpponentBufferExecCompleted(); -} - -static void OpponentHandleDMA3Transfer(void) -{ - OpponentBufferExecCompleted(); -} - -static void OpponentHandlePlayBGM(void) -{ - OpponentBufferExecCompleted(); -} - -static void OpponentHandleCmd32(void) -{ - OpponentBufferExecCompleted(); -} - -static void OpponentHandleTwoReturnValues(void) -{ - OpponentBufferExecCompleted(); -} - -static void OpponentHandleChosenMonReturnValue(void) -{ - OpponentBufferExecCompleted(); -} - -static void OpponentHandleOneReturnValue(void) -{ - OpponentBufferExecCompleted(); -} - -static void OpponentHandleOneReturnValue_Duplicate(void) -{ - OpponentBufferExecCompleted(); -} - -static void OpponentHandleClearUnkVar(void) -{ - gUnusedControllerStruct.unk = 0; - OpponentBufferExecCompleted(); -} - -static void OpponentHandleSetUnkVar(void) -{ - gUnusedControllerStruct.unk = gBattleResources->bufferA[gActiveBattler][1]; - OpponentBufferExecCompleted(); -} - -static void OpponentHandleClearUnkFlag(void) -{ - gUnusedControllerStruct.flag = 0; - OpponentBufferExecCompleted(); -} - -static void OpponentHandleToggleUnkFlag(void) -{ - gUnusedControllerStruct.flag ^= 1; - OpponentBufferExecCompleted(); -} - -static void OpponentHandleHitAnimation(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE) - { - OpponentBufferExecCompleted(); - } - else - { - gDoingBattleAnim = TRUE; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; - DoHitAnimHealthboxEffect(gActiveBattler); - gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; - } -} - -static void OpponentHandleCantSwitch(void) -{ - OpponentBufferExecCompleted(); -} - -static void OpponentHandlePlaySE(void) -{ - s8 pan; - - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - pan = SOUND_PAN_ATTACKER; - else - pan = SOUND_PAN_TARGET; - - PlaySE12WithPanning(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8), pan); - OpponentBufferExecCompleted(); -} - -static void OpponentHandlePlayFanfareOrBGM(void) -{ - if (gBattleResources->bufferA[gActiveBattler][3]) - { - BattleStopLowHpSound(); - PlayBGM(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - else - { - PlayFanfare(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - - OpponentBufferExecCompleted(); -} - -static void OpponentHandleFaintingCry(void) -{ - u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - - PlayCry_ByMode(species, 25, CRY_MODE_FAINT); - OpponentBufferExecCompleted(); -} - -static void OpponentHandleIntroSlide(void) -{ - HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]); - gIntroSlideFlags |= 1; - OpponentBufferExecCompleted(); -} - -static void OpponentHandleIntroTrainerBallThrow(void) -{ - u8 taskId; - - SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 280; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].y; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; - - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCB_FreeOpponentSprite); - - taskId = CreateTask(Task_StartSendOutAnim, 5); - gTasks[taskId].data[0] = gActiveBattler; - - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) - gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - - gBattleSpritesDataPtr->animationData->introAnimActive = TRUE; - gBattlerControllerFuncs[gActiveBattler] = OpponentDummy; -} - -static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite) -{ - FreeTrainerFrontPicPalette(sprite->oam.affineParam); - FreeSpriteOamMatrix(sprite); - DestroySprite(sprite); -} - -static void Task_StartSendOutAnim(u8 taskId) -{ - u8 savedActiveBattler = gActiveBattler; - - gActiveBattler = gTasks[taskId].data[0]; - if ((!TwoIntroMons(gActiveBattler) || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) && !BATTLE_TWO_VS_ONE_OPPONENT) - { - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - StartSendOutAnim(gActiveBattler, FALSE); - } - else if ((gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) || (BATTLE_TWO_VS_ONE_OPPONENT && !TwoIntroMons(gActiveBattler))) - { - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - StartSendOutAnim(gActiveBattler, FALSE); - } - else - { - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - StartSendOutAnim(gActiveBattler, FALSE); - gActiveBattler ^= BIT_FLANK; - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - StartSendOutAnim(gActiveBattler, FALSE); - gActiveBattler ^= BIT_FLANK; - } - gBattlerControllerFuncs[gActiveBattler] = Intro_TryShinyAnimShowHealthbox; - gActiveBattler = savedActiveBattler; - DestroyTask(taskId); -} - -static void OpponentHandleDrawPartyStatusSummary(void) -{ - if (gBattleResources->bufferA[gActiveBattler][1] != 0 && GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - { - OpponentBufferExecCompleted(); - } - else - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1; - - if (gBattleResources->bufferA[gActiveBattler][2] != 0) - { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay < 2) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay++; - return; - } - else - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay = 0; - } - } - - gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleResources->bufferA[gActiveBattler][4], gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2]); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; - - if (gBattleResources->bufferA[gActiveBattler][2] != 0) - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 93; - - gBattlerControllerFuncs[gActiveBattler] = EndDrawPartyStatusSummary; - } -} - -static void EndDrawPartyStatusSummary(void) -{ - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer++ > 92) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; - OpponentBufferExecCompleted(); - } -} - -static void OpponentHandleHidePartyStatusSummary(void) -{ - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) - gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - OpponentBufferExecCompleted(); -} - -static void OpponentHandleEndBounceEffect(void) -{ - OpponentBufferExecCompleted(); -} - -static void OpponentHandleSpriteInvisibility(void) +static void OpponentHandleHealthBarUpdate(u32 battler) { - if (IsBattlerSpritePresent(gActiveBattler)) - { - gSprites[gBattlerSpriteIds[gActiveBattler]].invisible = gBattleResources->bufferA[gActiveBattler][1]; - CopyBattleSpriteInvisibility(gActiveBattler); - } - OpponentBufferExecCompleted(); + BtlController_HandleHealthBarUpdate(battler, FALSE); } -static void OpponentHandleBattleAnimation(void) +static void OpponentHandleIntroTrainerBallThrow(u32 battler) { - if (!IsBattleSEPlaying(gActiveBattler)) - { - u8 animationId = gBattleResources->bufferA[gActiveBattler][1]; - u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); - - if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument)) - OpponentBufferExecCompleted(); - else - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; - } + BtlController_HandleIntroTrainerBallThrow(battler, 0, NULL, 0, Intro_TryShinyAnimShowHealthbox); } -static void OpponentHandleLinkStandbyMsg(void) +static void OpponentHandleDrawPartyStatusSummary(u32 battler) { - OpponentBufferExecCompleted(); + BtlController_HandleDrawPartyStatusSummary(battler, B_SIDE_OPPONENT, TRUE); } -static void OpponentHandleResetActionMoveSelection(void) +static void OpponentHandleBattleAnimation(u32 battler) { - OpponentBufferExecCompleted(); + BtlController_HandleBattleAnimation(battler, FALSE, FALSE); } -static void OpponentHandleEndLinkBattle(void) +static void OpponentHandleEndLinkBattle(u32 battler) { if (gBattleTypeFlags & BATTLE_TYPE_LINK && !(gBattleTypeFlags & BATTLE_TYPE_IS_MASTER)) { @@ -2095,14 +738,5 @@ static void OpponentHandleEndLinkBattle(void) gMain.callback1 = gPreBattleCallback1; SetMainCallback2(gMain.savedCallback); } - OpponentBufferExecCompleted(); -} - -static void OpponentHandleDebugMenu(void) -{ - OpponentBufferExecCompleted(); -} - -static void OpponentCmdEnd(void) -{ + OpponentBufferExecCompleted(battler); } diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 294eee9aa8f6..3a464910e0c9 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -37,104 +37,75 @@ #include "constants/trainers.h" #include "constants/rgb.h" -static void PlayerHandleGetMonData(void); -static void PlayerHandleSetMonData(void); -static void PlayerHandleSetRawMonData(void); -static void PlayerHandleLoadMonSprite(void); -static void PlayerHandleSwitchInAnim(void); -static void PlayerHandleReturnMonToBall(void); -static void PlayerHandleDrawTrainerPic(void); -static void PlayerHandleTrainerSlide(void); -static void PlayerHandleTrainerSlideBack(void); -static void PlayerHandleFaintAnimation(void); -static void PlayerHandlePaletteFade(void); -static void PlayerHandleSuccessBallThrowAnim(void); -static void PlayerHandleBallThrowAnim(void); -static void PlayerHandlePause(void); -static void PlayerHandleMoveAnimation(void); -static void PlayerHandlePrintString(void); -static void PlayerHandlePrintSelectionString(void); -static void PlayerHandleChooseAction(void); -static void PlayerHandleYesNoBox(void); -static void PlayerHandleChooseMove(void); -static void PlayerHandleChooseItem(void); -static void PlayerHandleChoosePokemon(void); -static void PlayerHandleCmd23(void); -static void PlayerHandleHealthBarUpdate(void); -static void PlayerHandleExpUpdate(void); -static void PlayerHandleStatusIconUpdate(void); -static void PlayerHandleStatusAnimation(void); -static void PlayerHandleStatusXor(void); -static void PlayerHandleDataTransfer(void); -static void PlayerHandleDMA3Transfer(void); -static void PlayerHandlePlayBGM(void); -static void PlayerHandleCmd32(void); -static void PlayerHandleTwoReturnValues(void); -static void PlayerHandleChosenMonReturnValue(void); -static void PlayerHandleOneReturnValue(void); -static void PlayerHandleOneReturnValue_Duplicate(void); -static void PlayerHandleClearUnkVar(void); -static void PlayerHandleSetUnkVar(void); -static void PlayerHandleClearUnkFlag(void); -static void PlayerHandleToggleUnkFlag(void); -static void PlayerHandleHitAnimation(void); -static void PlayerHandleCantSwitch(void); -static void PlayerHandlePlaySE(void); -static void PlayerHandlePlayFanfareOrBGM(void); -static void PlayerHandleFaintingCry(void); -static void PlayerHandleIntroSlide(void); -static void PlayerHandleIntroTrainerBallThrow(void); -static void PlayerHandleDrawPartyStatusSummary(void); -static void PlayerHandleHidePartyStatusSummary(void); -static void PlayerHandleEndBounceEffect(void); -static void PlayerHandleSpriteInvisibility(void); -static void PlayerHandleBattleAnimation(void); -static void PlayerHandleLinkStandbyMsg(void); -static void PlayerHandleResetActionMoveSelection(void); -static void PlayerHandleEndLinkBattle(void); -static void PlayerHandleBattleDebug(void); -static void PlayerCmdEnd(void); - -static void PlayerBufferRunCommand(void); -static void HandleInputChooseTarget(void); -static void HandleInputChooseMove(void); -static void MoveSelectionDisplayPpNumber(void); -static void MoveSelectionDisplayPpString(void); -static void MoveSelectionDisplayMoveType(void); -static void MoveSelectionDisplayMoveNames(void); -static void HandleMoveSwitching(void); -static void SwitchIn_HandleSoundAndEnd(void); -static void WaitForMonSelection(void); -static void CompleteWhenChoseItem(void); +static void PlayerBufferExecCompleted(u32 battler); +static void PlayerHandleLoadMonSprite(u32 battler); +static void PlayerHandleSwitchInAnim(u32 battler); +static void PlayerHandleDrawTrainerPic(u32 battler); +static void PlayerHandleTrainerSlide(u32 battler); +static void PlayerHandleTrainerSlideBack(u32 battler); +static void PlayerHandlePaletteFade(u32 battler); +static void PlayerHandleSuccessBallThrowAnim(u32 battler); +static void PlayerHandleBallThrowAnim(u32 battler); +static void PlayerHandlePause(u32 battler); +static void PlayerHandleMoveAnimation(u32 battler); +static void PlayerHandlePrintString(u32 battler); +static void PlayerHandlePrintSelectionString(u32 battler); +static void PlayerHandleChooseAction(u32 battler); +static void PlayerHandleYesNoBox(u32 battler); +static void PlayerHandleChooseMove(u32 battler); +static void PlayerHandleChooseItem(u32 battler); +static void PlayerHandleChoosePokemon(u32 battler); +static void PlayerHandleCmd23(u32 battler); +static void PlayerHandleHealthBarUpdate(u32 battler); +static void PlayerHandleStatusXor(u32 battler); +static void PlayerHandleDMA3Transfer(u32 battler); +static void PlayerHandlePlayBGM(u32 battler); +static void PlayerHandleTwoReturnValues(u32 battler); +static void PlayerHandleChosenMonReturnValue(u32 battler); +static void PlayerHandleOneReturnValue(u32 battler); +static void PlayerHandleOneReturnValue_Duplicate(u32 battler); +static void PlayerHandleIntroTrainerBallThrow(u32 battler); +static void PlayerHandleDrawPartyStatusSummary(u32 battler); +static void PlayerHandleEndBounceEffect(u32 battler); +static void PlayerHandleBattleAnimation(u32 battler); +static void PlayerHandleLinkStandbyMsg(u32 battler); +static void PlayerHandleResetActionMoveSelection(u32 battler); +static void PlayerHandleEndLinkBattle(u32 battler); +static void PlayerHandleBattleDebug(u32 battler); + +static void PlayerBufferRunCommand(u32 battler); +static void HandleInputChooseTarget(u32 battler); +static void HandleInputChooseMove(u32 battler); +static void MoveSelectionDisplayPpNumber(u32 battler); +static void MoveSelectionDisplayPpString(u32 battler); +static void MoveSelectionDisplayMoveType(u32 battler); +static void MoveSelectionDisplayMoveNames(u32 battler); +static void HandleMoveSwitching(u32 battler); +static void SwitchIn_HandleSoundAndEnd(u32 battler); +static void WaitForMonSelection(u32 battler); +static void CompleteWhenChoseItem(u32 battler); static void Task_LaunchLvlUpAnim(u8); static void Task_PrepareToGiveExpWithExpBar(u8); -static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8); +static void Task_SetControllerToWaitForString(u8); static void Task_GiveExpWithExpBar(u8); static void Task_UpdateLvlInHealthbox(u8); static void PrintLinkStandbyMsg(void); -static u32 CopyPlayerMonData(u8, u8 *); -static void SetPlayerMonData(u8); -static void StartSendOutAnim(u8, bool8); -static void DoSwitchOutAnimation(void); -static void PlayerDoMoveAnimation(void); -static void Task_StartSendOutAnim(u8); -static void EndDrawPartyStatusSummary(void); - -static void ReloadMoveNames(void); - -static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = -{ - [CONTROLLER_GETMONDATA] = PlayerHandleGetMonData, - [CONTROLLER_GETRAWMONDATA] = PlayerHandleGetRawMonData, - [CONTROLLER_SETMONDATA] = PlayerHandleSetMonData, - [CONTROLLER_SETRAWMONDATA] = PlayerHandleSetRawMonData, + +static void ReloadMoveNames(u32 battler); + +static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(u32 battler) = +{ + [CONTROLLER_GETMONDATA] = BtlController_HandleGetMonData, + [CONTROLLER_GETRAWMONDATA] = BtlController_HandleGetRawMonData, + [CONTROLLER_SETMONDATA] = BtlController_HandleSetMonData, + [CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData, [CONTROLLER_LOADMONSPRITE] = PlayerHandleLoadMonSprite, [CONTROLLER_SWITCHINANIM] = PlayerHandleSwitchInAnim, - [CONTROLLER_RETURNMONTOBALL] = PlayerHandleReturnMonToBall, + [CONTROLLER_RETURNMONTOBALL] = BtlController_HandleReturnMonToBall, [CONTROLLER_DRAWTRAINERPIC] = PlayerHandleDrawTrainerPic, [CONTROLLER_TRAINERSLIDE] = PlayerHandleTrainerSlide, [CONTROLLER_TRAINERSLIDEBACK] = PlayerHandleTrainerSlideBack, - [CONTROLLER_FAINTANIMATION] = PlayerHandleFaintAnimation, + [CONTROLLER_FAINTANIMATION] = BtlController_HandleFaintAnimation, [CONTROLLER_PALETTEFADE] = PlayerHandlePaletteFade, [CONTROLLER_SUCCESSBALLTHROWANIM] = PlayerHandleSuccessBallThrowAnim, [CONTROLLER_BALLTHROWANIM] = PlayerHandleBallThrowAnim, @@ -150,176 +121,272 @@ static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_23] = PlayerHandleCmd23, [CONTROLLER_HEALTHBARUPDATE] = PlayerHandleHealthBarUpdate, [CONTROLLER_EXPUPDATE] = PlayerHandleExpUpdate, - [CONTROLLER_STATUSICONUPDATE] = PlayerHandleStatusIconUpdate, - [CONTROLLER_STATUSANIMATION] = PlayerHandleStatusAnimation, + [CONTROLLER_STATUSICONUPDATE] = BtlController_HandleStatusIconUpdate, + [CONTROLLER_STATUSANIMATION] = BtlController_HandleStatusAnimation, [CONTROLLER_STATUSXOR] = PlayerHandleStatusXor, - [CONTROLLER_DATATRANSFER] = PlayerHandleDataTransfer, + [CONTROLLER_DATATRANSFER] = BtlController_Empty, [CONTROLLER_DMA3TRANSFER] = PlayerHandleDMA3Transfer, [CONTROLLER_PLAYBGM] = PlayerHandlePlayBGM, - [CONTROLLER_32] = PlayerHandleCmd32, + [CONTROLLER_32] = BtlController_Empty, [CONTROLLER_TWORETURNVALUES] = PlayerHandleTwoReturnValues, [CONTROLLER_CHOSENMONRETURNVALUE] = PlayerHandleChosenMonReturnValue, [CONTROLLER_ONERETURNVALUE] = PlayerHandleOneReturnValue, [CONTROLLER_ONERETURNVALUE_DUPLICATE] = PlayerHandleOneReturnValue_Duplicate, - [CONTROLLER_CLEARUNKVAR] = PlayerHandleClearUnkVar, - [CONTROLLER_SETUNKVAR] = PlayerHandleSetUnkVar, - [CONTROLLER_CLEARUNKFLAG] = PlayerHandleClearUnkFlag, - [CONTROLLER_TOGGLEUNKFLAG] = PlayerHandleToggleUnkFlag, - [CONTROLLER_HITANIMATION] = PlayerHandleHitAnimation, - [CONTROLLER_CANTSWITCH] = PlayerHandleCantSwitch, - [CONTROLLER_PLAYSE] = PlayerHandlePlaySE, - [CONTROLLER_PLAYFANFAREORBGM] = PlayerHandlePlayFanfareOrBGM, - [CONTROLLER_FAINTINGCRY] = PlayerHandleFaintingCry, - [CONTROLLER_INTROSLIDE] = PlayerHandleIntroSlide, + [CONTROLLER_CLEARUNKVAR] = BtlController_HandleClearUnkVar, + [CONTROLLER_SETUNKVAR] = BtlController_HandleSetUnkVar, + [CONTROLLER_CLEARUNKFLAG] = BtlController_HandleClearUnkFlag, + [CONTROLLER_TOGGLEUNKFLAG] = BtlController_HandleToggleUnkFlag, + [CONTROLLER_HITANIMATION] = BtlController_HandleHitAnimation, + [CONTROLLER_CANTSWITCH] = BtlController_Empty, + [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, + [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, + [CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry, + [CONTROLLER_INTROSLIDE] = BtlController_HandleIntroSlide, [CONTROLLER_INTROTRAINERBALLTHROW] = PlayerHandleIntroTrainerBallThrow, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = PlayerHandleDrawPartyStatusSummary, - [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = PlayerHandleHidePartyStatusSummary, + [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = BtlController_HandleHidePartyStatusSummary, [CONTROLLER_ENDBOUNCE] = PlayerHandleEndBounceEffect, - [CONTROLLER_SPRITEINVISIBILITY] = PlayerHandleSpriteInvisibility, + [CONTROLLER_SPRITEINVISIBILITY] = BtlController_HandleSpriteInvisibility, [CONTROLLER_BATTLEANIMATION] = PlayerHandleBattleAnimation, [CONTROLLER_LINKSTANDBYMSG] = PlayerHandleLinkStandbyMsg, [CONTROLLER_RESETACTIONMOVESELECTION] = PlayerHandleResetActionMoveSelection, [CONTROLLER_ENDLINKBATTLE] = PlayerHandleEndLinkBattle, [CONTROLLER_DEBUGMENU] = PlayerHandleBattleDebug, - [CONTROLLER_TERMINATOR_NOP] = PlayerCmdEnd + [CONTROLLER_TERMINATOR_NOP] = BtlController_TerminatorNop }; -// unknown unused data -static const u8 sUnused[] = {0x48, 0x48, 0x20, 0x5a, 0x50, 0x50, 0x50, 0x58}; - -void BattleControllerDummy(void) -{ -} +static EWRAM_DATA bool8 sAckBallUseBtn = FALSE; +static EWRAM_DATA bool8 sBallSwapped = FALSE; -void SetControllerToPlayer(void) +void SetControllerToPlayer(u32 battler) { - gBattlerControllerFuncs[gActiveBattler] = PlayerBufferRunCommand; + gBattlerControllerEndFuncs[battler] = PlayerBufferExecCompleted; + gBattlerControllerFuncs[battler] = PlayerBufferRunCommand; gDoingBattleAnim = FALSE; gPlayerDpadHoldFrames = 0; } -static void PlayerBufferExecCompleted(void) +static void PlayerBufferExecCompleted(u32 battler) { - gBattlerControllerFuncs[gActiveBattler] = PlayerBufferRunCommand; + gBattlerControllerFuncs[battler] = PlayerBufferRunCommand; if (gBattleTypeFlags & BATTLE_TYPE_LINK) { u8 playerId = GetMultiplayerId(); - PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleResources->bufferA[gActiveBattler][0] = CONTROLLER_TERMINATOR_NOP; + PrepareBufferDataTransferLink(battler, 2, 4, &playerId); + gBattleResources->bufferA[battler][0] = CONTROLLER_TERMINATOR_NOP; } else { - gBattleControllerExecFlags &= ~gBitTable[gActiveBattler]; + gBattleControllerExecFlags &= ~gBitTable[battler]; } } -static void PlayerBufferRunCommand(void) +static void PlayerBufferRunCommand(u32 battler) { - if (gBattleControllerExecFlags & gBitTable[gActiveBattler]) + if (gBattleControllerExecFlags & gBitTable[battler]) { - if (gBattleResources->bufferA[gActiveBattler][0] < ARRAY_COUNT(sPlayerBufferCommands)) - sPlayerBufferCommands[gBattleResources->bufferA[gActiveBattler][0]](); + if (gBattleResources->bufferA[battler][0] < ARRAY_COUNT(sPlayerBufferCommands)) + sPlayerBufferCommands[gBattleResources->bufferA[battler][0]](battler); else - PlayerBufferExecCompleted(); + PlayerBufferExecCompleted(battler); + } +} + +static void CompleteOnBattlerSpritePosX_0(u32 battler) +{ + if (gSprites[gBattlerSpriteIds[battler]].x2 == 0) + PlayerBufferExecCompleted(battler); +} + +static u16 GetPrevBall(u16 ballId) +{ + u16 ballPrev; + u32 i, j; + CompactItemsInBagPocket(&gBagPockets[BALLS_POCKET]); + for (i = 0; i < gBagPockets[BALLS_POCKET].capacity; i++) + { + if (ballId == gBagPockets[BALLS_POCKET].itemSlots[i].itemId) + { + if (i <= 0) + { + for (j = gBagPockets[BALLS_POCKET].capacity - 1; j >= 0; j--) + { + ballPrev = gBagPockets[BALLS_POCKET].itemSlots[j].itemId; + if (ballPrev != ITEM_NONE) + return ballPrev; + } + } + i--; + return gBagPockets[BALLS_POCKET].itemSlots[i].itemId; + } } } -static void CompleteOnBankSpritePosX_0(void) +static u16 GetNextBall(u16 ballId) { - if (gSprites[gBattlerSpriteIds[gActiveBattler]].x2 == 0) - PlayerBufferExecCompleted(); + u16 ballNext; + u32 i; + CompactItemsInBagPocket(&gBagPockets[BALLS_POCKET]); + for (i = 0; i < gBagPockets[BALLS_POCKET].capacity; i++) + { + if (ballId == gBagPockets[BALLS_POCKET].itemSlots[i].itemId) + { + i++; + ballNext = gBagPockets[BALLS_POCKET].itemSlots[i].itemId; + if (ballNext == ITEM_NONE) + return gBagPockets[BALLS_POCKET].itemSlots[0].itemId; // Zeroth slot + else + return ballNext; + } + } } -static void HandleInputChooseAction(void) +static void HandleInputChooseAction(u32 battler) { - u16 itemId = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); + u16 itemId = gBattleResources->bufferA[battler][2] | (gBattleResources->bufferA[battler][3] << 8); - DoBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX, 7, 1); - DoBounceEffect(gActiveBattler, BOUNCE_MON, 7, 1); + DoBounceEffect(battler, BOUNCE_HEALTHBOX, 7, 1); + DoBounceEffect(battler, BOUNCE_MON, 7, 1); if (JOY_REPEAT(DPAD_ANY) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A) gPlayerDpadHoldFrames++; else gPlayerDpadHoldFrames = 0; +#if B_LAST_USED_BALL == TRUE && B_LAST_USED_BALL_CYCLE == TRUE + if (!gLastUsedBallMenuPresent) + { + sAckBallUseBtn = FALSE; + } + else if (JOY_NEW(B_LAST_USED_BALL_BUTTON)) + { + sAckBallUseBtn = TRUE; + sBallSwapped = FALSE; + ArrowsChangeColorLastBallCycle(TRUE); + } + if (sAckBallUseBtn) + { + if (JOY_HELD(B_LAST_USED_BALL_BUTTON) && (JOY_NEW(DPAD_DOWN) || JOY_NEW(DPAD_RIGHT))) + { + bool8 sameBall = FALSE; + u16 nextBall = GetNextBall(gBallToDisplay); + sBallSwapped = TRUE; + if (gBallToDisplay == nextBall) + sameBall = TRUE; + else + gBallToDisplay = nextBall; + SwapBallToDisplay(sameBall); + PlaySE(SE_SELECT); + } + else if (JOY_HELD(B_LAST_USED_BALL_BUTTON) && (JOY_NEW(DPAD_UP) || JOY_NEW(DPAD_LEFT))) + { + bool8 sameBall = FALSE; + u16 prevBall = GetPrevBall(gBallToDisplay); + sBallSwapped = TRUE; + if (gBallToDisplay == prevBall) + sameBall = TRUE; + else + gBallToDisplay = prevBall; + SwapBallToDisplay(sameBall); + PlaySE(SE_SELECT); + } + else if (JOY_NEW(B_BUTTON) || (!JOY_HELD(B_LAST_USED_BALL_BUTTON) && sBallSwapped)) + { + sAckBallUseBtn = FALSE; + sBallSwapped = FALSE; + ArrowsChangeColorLastBallCycle(FALSE); + } + else if (!JOY_HELD(B_LAST_USED_BALL_BUTTON) && CanThrowLastUsedBall()) + { + sAckBallUseBtn = FALSE; + PlaySE(SE_SELECT); + ArrowsChangeColorLastBallCycle(FALSE); + TryHideLastUsedBall(); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_THROW_BALL, 0); + PlayerBufferExecCompleted(battler); + } + return; + } +#endif + if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); TryHideLastUsedBall(); - switch (gActionSelectionCursor[gActiveBattler]) + switch (gActionSelectionCursor[battler]) { case 0: // Top left - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_USE_MOVE, 0); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_USE_MOVE, 0); break; case 1: // Top right - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_USE_ITEM, 0); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_USE_ITEM, 0); break; case 2: // Bottom left - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SWITCH, 0); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_SWITCH, 0); break; case 3: // Bottom right - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_RUN, 0); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_RUN, 0); break; } - PlayerBufferExecCompleted(); + PlayerBufferExecCompleted(battler); } else if (JOY_NEW(DPAD_LEFT)) { - if (gActionSelectionCursor[gActiveBattler] & 1) // if is B_ACTION_USE_ITEM or B_ACTION_RUN + if (gActionSelectionCursor[battler] & 1) // if is B_ACTION_USE_ITEM or B_ACTION_RUN { PlaySE(SE_SELECT); - ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBattler]); - gActionSelectionCursor[gActiveBattler] ^= 1; - ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[battler]); + gActionSelectionCursor[battler] ^= 1; + ActionSelectionCreateCursorAt(gActionSelectionCursor[battler], 0); } } else if (JOY_NEW(DPAD_RIGHT)) { - if (!(gActionSelectionCursor[gActiveBattler] & 1)) // if is B_ACTION_USE_MOVE or B_ACTION_SWITCH + if (!(gActionSelectionCursor[battler] & 1)) // if is B_ACTION_USE_MOVE or B_ACTION_SWITCH { PlaySE(SE_SELECT); - ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBattler]); - gActionSelectionCursor[gActiveBattler] ^= 1; - ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[battler]); + gActionSelectionCursor[battler] ^= 1; + ActionSelectionCreateCursorAt(gActionSelectionCursor[battler], 0); } } else if (JOY_NEW(DPAD_UP)) { - if (gActionSelectionCursor[gActiveBattler] & 2) // if is B_ACTION_SWITCH or B_ACTION_RUN + if (gActionSelectionCursor[battler] & 2) // if is B_ACTION_SWITCH or B_ACTION_RUN { PlaySE(SE_SELECT); - ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBattler]); - gActionSelectionCursor[gActiveBattler] ^= 2; - ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[battler]); + gActionSelectionCursor[battler] ^= 2; + ActionSelectionCreateCursorAt(gActionSelectionCursor[battler], 0); } } else if (JOY_NEW(DPAD_DOWN)) { - if (!(gActionSelectionCursor[gActiveBattler] & 2)) // if is B_ACTION_USE_MOVE or B_ACTION_USE_ITEM + if (!(gActionSelectionCursor[battler] & 2)) // if is B_ACTION_USE_MOVE or B_ACTION_USE_ITEM { PlaySE(SE_SELECT); - ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBattler]); - gActionSelectionCursor[gActiveBattler] ^= 2; - ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[battler]); + gActionSelectionCursor[battler] ^= 2; + ActionSelectionCreateCursorAt(gActionSelectionCursor[battler], 0); } } else if (JOY_NEW(B_BUTTON) || gPlayerDpadHoldFrames > 59) { if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) - && GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT + && GetBattlerPosition(battler) == B_POSITION_PLAYER_RIGHT && !(gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(B_POSITION_PLAYER_LEFT)]) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { // Return item to bag if partner had selected one. - if (gBattleResources->bufferA[gActiveBattler][1] == B_ACTION_USE_ITEM) + if (gBattleResources->bufferA[battler][1] == B_ACTION_USE_ITEM) { AddBagItem(itemId, 1); } PlaySE(SE_SELECT); - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_CANCEL_PARTNER, 0); - PlayerBufferExecCompleted(); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_CANCEL_PARTNER, 0); + PlayerBufferExecCompleted(battler); } } else if (JOY_NEW(START_BUTTON)) @@ -329,34 +396,27 @@ static void HandleInputChooseAction(void) #if DEBUG_BATTLE_MENU == TRUE else if (JOY_NEW(SELECT_BUTTON)) { - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_DEBUG, 0); - PlayerBufferExecCompleted(); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_DEBUG, 0); + PlayerBufferExecCompleted(battler); } #endif -#if B_LAST_USED_BALL == TRUE +#if B_LAST_USED_BALL == TRUE && B_LAST_USED_BALL_CYCLE == FALSE else if (JOY_NEW(B_LAST_USED_BALL_BUTTON) && CanThrowLastUsedBall()) { PlaySE(SE_SELECT); TryHideLastUsedBall(); - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_THROW_BALL, 0); - PlayerBufferExecCompleted(); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_THROW_BALL, 0); + PlayerBufferExecCompleted(battler); } #endif } -static void UnusedEndBounceEffect(void) -{ - EndBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX); - EndBounceEffect(gActiveBattler, BOUNCE_MON); - gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseTarget; -} - -static void HandleInputChooseTarget(void) +static void HandleInputChooseTarget(u32 battler) { s32 i; static const u8 identities[MAX_BATTLERS_COUNT] = {B_POSITION_PLAYER_LEFT, B_POSITION_PLAYER_RIGHT, B_POSITION_OPPONENT_RIGHT, B_POSITION_OPPONENT_LEFT}; - u16 move = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBattler]); - u16 moveTarget = GetBattlerMoveTargetType(gActiveBattler, move); + u16 move = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_MOVE1 + gMoveSelectionCursor[battler]); + u16 moveTarget = GetBattlerMoveTargetType(battler, move); DoBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX, 15, 1); for (i = 0; i < gBattlersCount; i++) @@ -375,21 +435,23 @@ static void HandleInputChooseTarget(void) PlaySE(SE_SELECT); gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCB_HideAsMoveTarget; if (gBattleStruct->mega.playerSelect) - BtlController_EmitTwoReturnValues(BUFFER_B, 10, gMoveSelectionCursor[gActiveBattler] | RET_MEGA_EVOLUTION | (gMultiUsePlayerCursor << 8)); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | RET_MEGA_EVOLUTION | (gMultiUsePlayerCursor << 8)); + else if (gBattleStruct->burst.playerSelect) + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | RET_ULTRA_BURST | (gMultiUsePlayerCursor << 8)); else - BtlController_EmitTwoReturnValues(BUFFER_B, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8)); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | (gMultiUsePlayerCursor << 8)); EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX); TryHideLastUsedBall(); HideTriggerSprites(); - PlayerBufferExecCompleted(); + PlayerBufferExecCompleted(battler); } else if (JOY_NEW(B_BUTTON) || gPlayerDpadHoldFrames > 59) { PlaySE(SE_SELECT); gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCB_HideAsMoveTarget; - gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseMove; - DoBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX, 7, 1); - DoBounceEffect(gActiveBattler, BOUNCE_MON, 7, 1); + gBattlerControllerFuncs[battler] = HandleInputChooseMove; + DoBounceEffect(battler, BOUNCE_HEALTHBOX, 7, 1); + DoBounceEffect(battler, BOUNCE_MON, 7, 1); EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX); } else if (JOY_NEW(DPAD_LEFT | DPAD_UP)) @@ -424,7 +486,7 @@ static void HandleInputChooseTarget(void) { case B_POSITION_PLAYER_LEFT: case B_POSITION_PLAYER_RIGHT: - if (gActiveBattler != gMultiUsePlayerCursor) + if (battler != gMultiUsePlayerCursor) i++; else if (moveTarget & MOVE_TARGET_USER_OR_SELECTED) i++; @@ -436,7 +498,7 @@ static void HandleInputChooseTarget(void) } if (gAbsentBattlerFlags & gBitTable[gMultiUsePlayerCursor] - || !CanTargetBattler(gActiveBattler, gMultiUsePlayerCursor, move)) + || !CanTargetBattler(battler, gMultiUsePlayerCursor, move)) i = 0; } while (i == 0); } @@ -474,7 +536,7 @@ static void HandleInputChooseTarget(void) { case B_POSITION_PLAYER_LEFT: case B_POSITION_PLAYER_RIGHT: - if (gActiveBattler != gMultiUsePlayerCursor) + if (battler != gMultiUsePlayerCursor) i++; else if (moveTarget & MOVE_TARGET_USER_OR_SELECTED) i++; @@ -486,7 +548,7 @@ static void HandleInputChooseTarget(void) } if (gAbsentBattlerFlags & gBitTable[gMultiUsePlayerCursor] - || !CanTargetBattler(gActiveBattler, gMultiUsePlayerCursor, move)) + || !CanTargetBattler(battler, gMultiUsePlayerCursor, move)) i = 0; } while (i == 0); } @@ -508,12 +570,12 @@ static void HideAllTargets(void) } } -static void HideShownTargets(void) +static void HideShownTargets(u32 battler) { s32 i; for (i = 0; i < MAX_BATTLERS_COUNT; i++) { - if (IsBattlerAlive(i) && gBattleSpritesDataPtr->healthBoxesData[i].healthboxIsBouncing && i != gActiveBattler) + if (IsBattlerAlive(i) && gBattleSpritesDataPtr->healthBoxesData[i].healthboxIsBouncing && i != battler) { gSprites[gBattlerSpriteIds[i]].callback = SpriteCB_HideAsMoveTarget; EndBounceEffect(i, BOUNCE_HEALTHBOX); @@ -521,7 +583,7 @@ static void HideShownTargets(void) } } -static void HandleInputShowEntireFieldTargets(void) +static void HandleInputShowEntireFieldTargets(u32 battler) { if (JOY_HELD(DPAD_ANY) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A) gPlayerDpadHoldFrames++; @@ -533,23 +595,25 @@ static void HandleInputShowEntireFieldTargets(void) PlaySE(SE_SELECT); HideAllTargets(); if (gBattleStruct->mega.playerSelect) - BtlController_EmitTwoReturnValues(BUFFER_B, 10, gMoveSelectionCursor[gActiveBattler] | RET_MEGA_EVOLUTION | (gMultiUsePlayerCursor << 8)); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | RET_MEGA_EVOLUTION | (gMultiUsePlayerCursor << 8)); + else if (gBattleStruct->burst.playerSelect) + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | RET_ULTRA_BURST | (gMultiUsePlayerCursor << 8)); else - BtlController_EmitTwoReturnValues(BUFFER_B, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8)); - HideMegaTriggerSprite(); - PlayerBufferExecCompleted(); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | (gMultiUsePlayerCursor << 8)); + HideTriggerSprites(); + PlayerBufferExecCompleted(battler); } else if (JOY_NEW(B_BUTTON) || gPlayerDpadHoldFrames > 59) { PlaySE(SE_SELECT); HideAllTargets(); - gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseMove; - DoBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX, 7, 1); - DoBounceEffect(gActiveBattler, BOUNCE_MON, 7, 1); + gBattlerControllerFuncs[battler] = HandleInputChooseMove; + DoBounceEffect(battler, BOUNCE_HEALTHBOX, 7, 1); + DoBounceEffect(battler, BOUNCE_MON, 7, 1); } } -static void HandleInputShowTargets(void) +static void HandleInputShowTargets(u32 battler) { if (JOY_HELD(DPAD_ANY) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A) gPlayerDpadHoldFrames++; @@ -559,39 +623,41 @@ static void HandleInputShowTargets(void) if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); - HideShownTargets(); + HideShownTargets(battler); if (gBattleStruct->mega.playerSelect) - BtlController_EmitTwoReturnValues(BUFFER_B, 10, gMoveSelectionCursor[gActiveBattler] | RET_MEGA_EVOLUTION | (gMultiUsePlayerCursor << 8)); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | RET_MEGA_EVOLUTION | (gMultiUsePlayerCursor << 8)); + else if (gBattleStruct->burst.playerSelect) + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | RET_ULTRA_BURST | (gMultiUsePlayerCursor << 8)); else - BtlController_EmitTwoReturnValues(BUFFER_B, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8)); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | (gMultiUsePlayerCursor << 8)); HideTriggerSprites(); TryHideLastUsedBall(); - PlayerBufferExecCompleted(); + PlayerBufferExecCompleted(battler); } else if (JOY_NEW(B_BUTTON) || gPlayerDpadHoldFrames > 59) { PlaySE(SE_SELECT); - HideShownTargets(); - gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseMove; - DoBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX, 7, 1); - DoBounceEffect(gActiveBattler, BOUNCE_MON, 7, 1); + HideShownTargets(battler); + gBattlerControllerFuncs[battler] = HandleInputChooseMove; + DoBounceEffect(battler, BOUNCE_HEALTHBOX, 7, 1); + DoBounceEffect(battler, BOUNCE_MON, 7, 1); } } -static void TryShowAsTarget(u32 battlerId) +static void TryShowAsTarget(u32 battler) { - if (IsBattlerAlive(battlerId)) + if (IsBattlerAlive(battler)) { - DoBounceEffect(battlerId, BOUNCE_HEALTHBOX, 15, 1); - gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCB_ShowAsMoveTarget; + DoBounceEffect(battler, BOUNCE_HEALTHBOX, 15, 1); + gSprites[gBattlerSpriteIds[battler]].callback = SpriteCB_ShowAsMoveTarget; } } -static void HandleInputChooseMove(void) +static void HandleInputChooseMove(u32 battler) { u16 moveTarget; u32 canSelectTarget = 0; - struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[gActiveBattler][4]); + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]); if (JOY_HELD(DPAD_ANY) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A) gPlayerDpadHoldFrames++; @@ -601,7 +667,7 @@ static void HandleInputChooseMove(void) if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); - if (moveInfo->moves[gMoveSelectionCursor[gActiveBattler]] == MOVE_CURSE) + if (moveInfo->moves[gMoveSelectionCursor[battler]] == MOVE_CURSE) { if (moveInfo->monType1 != TYPE_GHOST && moveInfo->monType2 != TYPE_GHOST && moveInfo->monType3 != TYPE_GHOST) moveTarget = MOVE_TARGET_USER; @@ -610,43 +676,43 @@ static void HandleInputChooseMove(void) } else { - moveTarget = GetBattlerMoveTargetType(gActiveBattler, moveInfo->moves[gMoveSelectionCursor[gActiveBattler]]); + moveTarget = GetBattlerMoveTargetType(battler, moveInfo->moves[gMoveSelectionCursor[battler]]); } if (gBattleStruct->zmove.viewing) { - u16 chosenMove = moveInfo->moves[gMoveSelectionCursor[gActiveBattler]]; + u16 chosenMove = moveInfo->moves[gMoveSelectionCursor[battler]]; - QueueZMove(gActiveBattler, chosenMove); + QueueZMove(battler, chosenMove); gBattleStruct->zmove.viewing = FALSE; - if (gBattleMoves[moveInfo->moves[gMoveSelectionCursor[gActiveBattler]]].split != SPLIT_STATUS) + if (gBattleMoves[moveInfo->moves[gMoveSelectionCursor[battler]]].split != SPLIT_STATUS) moveTarget = MOVE_TARGET_SELECTED; //damaging z moves always have selected target } if (moveTarget & MOVE_TARGET_USER) - gMultiUsePlayerCursor = gActiveBattler; + gMultiUsePlayerCursor = battler; else - gMultiUsePlayerCursor = GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gActiveBattler))); + gMultiUsePlayerCursor = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerSide(battler))); - if (!gBattleResources->bufferA[gActiveBattler][1]) // not a double battle + if (!gBattleResources->bufferA[battler][1]) // not a double battle { - if (moveTarget & MOVE_TARGET_USER_OR_SELECTED && !gBattleResources->bufferA[gActiveBattler][2]) + if (moveTarget & MOVE_TARGET_USER_OR_SELECTED && !gBattleResources->bufferA[battler][2]) canSelectTarget = 1; } else // double battle { if (!(moveTarget & (MOVE_TARGET_RANDOM | MOVE_TARGET_BOTH | MOVE_TARGET_DEPENDS | MOVE_TARGET_FOES_AND_ALLY | MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_USER | MOVE_TARGET_ALLY))) canSelectTarget = 1; // either selected or user - if (moveTarget == (MOVE_TARGET_USER | MOVE_TARGET_ALLY) && IsBattlerAlive(BATTLE_PARTNER(gActiveBattler))) + if (moveTarget == (MOVE_TARGET_USER | MOVE_TARGET_ALLY) && IsBattlerAlive(BATTLE_PARTNER(battler))) canSelectTarget = 1; - if (moveInfo->currentPp[gMoveSelectionCursor[gActiveBattler]] == 0) + if (moveInfo->currentPp[gMoveSelectionCursor[battler]] == 0) { canSelectTarget = 0; } - else if (!(moveTarget & (MOVE_TARGET_USER | MOVE_TARGET_USER_OR_SELECTED)) && CountAliveMonsInBattle(BATTLE_ALIVE_EXCEPT_ACTIVE) <= 1) + else if (!(moveTarget & (MOVE_TARGET_USER | MOVE_TARGET_USER_OR_SELECTED)) && CountAliveMonsInBattle(BATTLE_ALIVE_EXCEPT_BATTLER, battler) <= 1) { - gMultiUsePlayerCursor = GetDefaultMoveTarget(gActiveBattler); + gMultiUsePlayerCursor = GetDefaultMoveTarget(battler); canSelectTarget = 0; } @@ -665,7 +731,7 @@ static void HandleInputChooseMove(void) TryShowAsTarget(gMultiUsePlayerCursor); TryShowAsTarget(BATTLE_PARTNER(gMultiUsePlayerCursor)); if (moveTarget & MOVE_TARGET_FOES_AND_ALLY) - TryShowAsTarget(BATTLE_PARTNER(gActiveBattler)); + TryShowAsTarget(BATTLE_PARTNER(battler)); canSelectTarget = 2; } #endif @@ -676,18 +742,20 @@ static void HandleInputChooseMove(void) case 0: default: if (gBattleStruct->mega.playerSelect) - BtlController_EmitTwoReturnValues(BUFFER_B, 10, gMoveSelectionCursor[gActiveBattler] | RET_MEGA_EVOLUTION | (gMultiUsePlayerCursor << 8)); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | RET_MEGA_EVOLUTION | (gMultiUsePlayerCursor << 8)); + else if (gBattleStruct->burst.playerSelect) + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | RET_ULTRA_BURST | (gMultiUsePlayerCursor << 8)); else - BtlController_EmitTwoReturnValues(BUFFER_B, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8)); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | (gMultiUsePlayerCursor << 8)); HideTriggerSprites(); TryHideLastUsedBall(); - PlayerBufferExecCompleted(); + PlayerBufferExecCompleted(battler); break; case 1: - gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseTarget; + gBattlerControllerFuncs[battler] = HandleInputChooseTarget; if (moveTarget & (MOVE_TARGET_USER | MOVE_TARGET_USER_OR_SELECTED)) - gMultiUsePlayerCursor = gActiveBattler; + gMultiUsePlayerCursor = battler; else if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)]) gMultiUsePlayerCursor = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); else @@ -696,10 +764,10 @@ static void HandleInputChooseMove(void) gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCB_ShowAsMoveTarget; break; case 2: - gBattlerControllerFuncs[gActiveBattler] = HandleInputShowTargets; + gBattlerControllerFuncs[battler] = HandleInputShowTargets; break; case 3: // Entire field - gBattlerControllerFuncs[gActiveBattler] = HandleInputShowEntireFieldTargets; + gBattlerControllerFuncs[battler] = HandleInputShowEntireFieldTargets; break; } } @@ -708,120 +776,128 @@ static void HandleInputChooseMove(void) PlaySE(SE_SELECT); if (gBattleStruct->zmove.viewing) { - ReloadMoveNames(); + ReloadMoveNames(battler); } else { gBattleStruct->mega.playerSelect = FALSE; + gBattleStruct->burst.playerSelect = FALSE; gBattleStruct->zmove.viable = FALSE; - BtlController_EmitTwoReturnValues(BUFFER_B, 10, 0xFFFF); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, 0xFFFF); HideTriggerSprites(); - PlayerBufferExecCompleted(); + PlayerBufferExecCompleted(battler); } } else if (JOY_NEW(DPAD_LEFT) && !gBattleStruct->zmove.viewing) { - if (gMoveSelectionCursor[gActiveBattler] & 1) + if (gMoveSelectionCursor[battler] & 1) { - MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBattler]); - gMoveSelectionCursor[gActiveBattler] ^= 1; + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[battler]); + gMoveSelectionCursor[battler] ^= 1; PlaySE(SE_SELECT); - MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0); - MoveSelectionDisplayPpNumber(); - MoveSelectionDisplayMoveType(); - TryChangeZIndicator(gActiveBattler, gMoveSelectionCursor[gActiveBattler]); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 0); + MoveSelectionDisplayPpNumber(battler); + MoveSelectionDisplayMoveType(battler); + TryChangeZIndicator(battler, gMoveSelectionCursor[battler]); } } else if (JOY_NEW(DPAD_RIGHT) && !gBattleStruct->zmove.viewing) { - if (!(gMoveSelectionCursor[gActiveBattler] & 1) - && (gMoveSelectionCursor[gActiveBattler] ^ 1) < gNumberOfMovesToChoose) + if (!(gMoveSelectionCursor[battler] & 1) + && (gMoveSelectionCursor[battler] ^ 1) < gNumberOfMovesToChoose) { - MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBattler]); - gMoveSelectionCursor[gActiveBattler] ^= 1; + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[battler]); + gMoveSelectionCursor[battler] ^= 1; PlaySE(SE_SELECT); - MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0); - MoveSelectionDisplayPpNumber(); - MoveSelectionDisplayMoveType(); - TryChangeZIndicator(gActiveBattler, gMoveSelectionCursor[gActiveBattler]); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 0); + MoveSelectionDisplayPpNumber(battler); + MoveSelectionDisplayMoveType(battler); + TryChangeZIndicator(battler, gMoveSelectionCursor[battler]); } } else if (JOY_NEW(DPAD_UP) && !gBattleStruct->zmove.viewing) { - if (gMoveSelectionCursor[gActiveBattler] & 2) + if (gMoveSelectionCursor[battler] & 2) { - MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBattler]); - gMoveSelectionCursor[gActiveBattler] ^= 2; + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[battler]); + gMoveSelectionCursor[battler] ^= 2; PlaySE(SE_SELECT); - MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0); - MoveSelectionDisplayPpNumber(); - MoveSelectionDisplayMoveType(); - TryChangeZIndicator(gActiveBattler, gMoveSelectionCursor[gActiveBattler]); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 0); + MoveSelectionDisplayPpNumber(battler); + MoveSelectionDisplayMoveType(battler); + TryChangeZIndicator(battler, gMoveSelectionCursor[battler]); } } else if (JOY_NEW(DPAD_DOWN) && !gBattleStruct->zmove.viewing) { - if (!(gMoveSelectionCursor[gActiveBattler] & 2) - && (gMoveSelectionCursor[gActiveBattler] ^ 2) < gNumberOfMovesToChoose) + if (!(gMoveSelectionCursor[battler] & 2) + && (gMoveSelectionCursor[battler] ^ 2) < gNumberOfMovesToChoose) { - MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBattler]); - gMoveSelectionCursor[gActiveBattler] ^= 2; + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[battler]); + gMoveSelectionCursor[battler] ^= 2; PlaySE(SE_SELECT); - MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0); - MoveSelectionDisplayPpNumber(); - MoveSelectionDisplayMoveType(); - TryChangeZIndicator(gActiveBattler, gMoveSelectionCursor[gActiveBattler]); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 0); + MoveSelectionDisplayPpNumber(battler); + MoveSelectionDisplayMoveType(battler); + TryChangeZIndicator(battler, gMoveSelectionCursor[battler]); } } else if (JOY_NEW(SELECT_BUTTON) && !gBattleStruct->zmove.viewing) { if (gNumberOfMovesToChoose > 1 && !(gBattleTypeFlags & BATTLE_TYPE_LINK)) { - MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 29); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 29); - if (gMoveSelectionCursor[gActiveBattler] != 0) + if (gMoveSelectionCursor[battler] != 0) gMultiUsePlayerCursor = 0; else - gMultiUsePlayerCursor = gMoveSelectionCursor[gActiveBattler] + 1; + gMultiUsePlayerCursor = gMoveSelectionCursor[battler] + 1; MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27); BattlePutTextOnWindow(gText_BattleSwitchWhich, B_WIN_SWITCH_PROMPT); - gBattlerControllerFuncs[gActiveBattler] = HandleMoveSwitching; + gBattlerControllerFuncs[battler] = HandleMoveSwitching; } } else if (JOY_NEW(START_BUTTON)) { - if (CanMegaEvolve(gActiveBattler)) + if (CanMegaEvolve(battler)) { gBattleStruct->mega.playerSelect ^= 1; ChangeMegaTriggerSprite(gBattleStruct->mega.triggerSpriteId, gBattleStruct->mega.playerSelect); PlaySE(SE_SELECT); } + else if (CanUltraBurst(battler)) + { + gBattleStruct->burst.playerSelect ^= 1; + ChangeBurstTriggerSprite(gBattleStruct->burst.triggerSpriteId, gBattleStruct->burst.playerSelect); + PlaySE(SE_SELECT); + } else if (gBattleStruct->zmove.viable) { // show z move name / info //TODO: brighten z move symbol PlaySE(SE_SELECT); if (!gBattleStruct->zmove.viewing) - MoveSelectionDisplayZMove(gBattleStruct->zmove.chosenZMove); + MoveSelectionDisplayZMove(gBattleStruct->zmove.chosenZMove, battler); else - ReloadMoveNames(); + ReloadMoveNames(battler); } } } -static void ReloadMoveNames(void) +static void ReloadMoveNames(u32 battler) { gBattleStruct->mega.playerSelect = FALSE; + gBattleStruct->burst.playerSelect = FALSE; gBattleStruct->zmove.viewing = FALSE; - MoveSelectionDestroyCursorAt(0); - MoveSelectionDisplayMoveNames(); - MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0); - MoveSelectionDisplayPpNumber(); - MoveSelectionDisplayMoveType(); + MoveSelectionDestroyCursorAt(battler); + MoveSelectionDisplayMoveNames(battler); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 0); + MoveSelectionDisplayPpNumber(battler); + MoveSelectionDisplayMoveType(battler); } -static u32 HandleMoveInputUnused(void) +static u32 HandleMoveInputUnused(u32 battler) { u32 var = 0; @@ -837,41 +913,41 @@ static u32 HandleMoveInputUnused(void) gBattle_BG0_Y = DISPLAY_HEIGHT * 2; var = 0xFF; } - if (JOY_NEW(DPAD_LEFT) && gMoveSelectionCursor[gActiveBattler] & 1) + if (JOY_NEW(DPAD_LEFT) && gMoveSelectionCursor[battler] & 1) { - MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBattler]); - gMoveSelectionCursor[gActiveBattler] ^= 1; + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[battler]); + gMoveSelectionCursor[battler] ^= 1; PlaySE(SE_SELECT); - MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 0); } - if (JOY_NEW(DPAD_RIGHT) && !(gMoveSelectionCursor[gActiveBattler] & 1) - && (gMoveSelectionCursor[gActiveBattler] ^ 1) < gNumberOfMovesToChoose) + if (JOY_NEW(DPAD_RIGHT) && !(gMoveSelectionCursor[battler] & 1) + && (gMoveSelectionCursor[battler] ^ 1) < gNumberOfMovesToChoose) { - MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBattler]); - gMoveSelectionCursor[gActiveBattler] ^= 1; + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[battler]); + gMoveSelectionCursor[battler] ^= 1; PlaySE(SE_SELECT); - MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 0); } - if (JOY_NEW(DPAD_UP) && gMoveSelectionCursor[gActiveBattler] & 2) + if (JOY_NEW(DPAD_UP) && gMoveSelectionCursor[battler] & 2) { - MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBattler]); - gMoveSelectionCursor[gActiveBattler] ^= 2; + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[battler]); + gMoveSelectionCursor[battler] ^= 2; PlaySE(SE_SELECT); - MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 0); } - if (JOY_NEW(DPAD_DOWN) && !(gMoveSelectionCursor[gActiveBattler] & 2) - && (gMoveSelectionCursor[gActiveBattler] ^ 2) < gNumberOfMovesToChoose) + if (JOY_NEW(DPAD_DOWN) && !(gMoveSelectionCursor[battler] & 2) + && (gMoveSelectionCursor[battler] ^ 2) < gNumberOfMovesToChoose) { - MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBattler]); - gMoveSelectionCursor[gActiveBattler] ^= 2; + MoveSelectionDestroyCursorAt(gMoveSelectionCursor[battler]); + gMoveSelectionCursor[battler] ^= 2; PlaySE(SE_SELECT); - MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 0); } return var; } -static void HandleMoveSwitching(void) +static void HandleMoveSwitching(u32 battler) { u8 perMovePPBonuses[MAX_MON_MOVES]; struct ChooseMoveStruct moveStruct; @@ -879,76 +955,76 @@ static void HandleMoveSwitching(void) if (JOY_NEW(A_BUTTON | SELECT_BUTTON)) { - struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[gActiveBattler][4]); + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]); PlaySE(SE_SELECT); - if (gMoveSelectionCursor[gActiveBattler] != gMultiUsePlayerCursor) + if (gMoveSelectionCursor[battler] != gMultiUsePlayerCursor) { - struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[gActiveBattler][4]); + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]); s32 i; // swap moves and pp - i = moveInfo->moves[gMoveSelectionCursor[gActiveBattler]]; - moveInfo->moves[gMoveSelectionCursor[gActiveBattler]] = moveInfo->moves[gMultiUsePlayerCursor]; + i = moveInfo->moves[gMoveSelectionCursor[battler]]; + moveInfo->moves[gMoveSelectionCursor[battler]] = moveInfo->moves[gMultiUsePlayerCursor]; moveInfo->moves[gMultiUsePlayerCursor] = i; - i = moveInfo->currentPp[gMoveSelectionCursor[gActiveBattler]]; - moveInfo->currentPp[gMoveSelectionCursor[gActiveBattler]] = moveInfo->currentPp[gMultiUsePlayerCursor]; + i = moveInfo->currentPp[gMoveSelectionCursor[battler]]; + moveInfo->currentPp[gMoveSelectionCursor[battler]] = moveInfo->currentPp[gMultiUsePlayerCursor]; moveInfo->currentPp[gMultiUsePlayerCursor] = i; - i = moveInfo->maxPp[gMoveSelectionCursor[gActiveBattler]]; - moveInfo->maxPp[gMoveSelectionCursor[gActiveBattler]] = moveInfo->maxPp[gMultiUsePlayerCursor]; + i = moveInfo->maxPp[gMoveSelectionCursor[battler]]; + moveInfo->maxPp[gMoveSelectionCursor[battler]] = moveInfo->maxPp[gMultiUsePlayerCursor]; moveInfo->maxPp[gMultiUsePlayerCursor] = i; - if (gDisableStructs[gActiveBattler].mimickedMoves & gBitTable[gMoveSelectionCursor[gActiveBattler]]) + if (gDisableStructs[battler].mimickedMoves & gBitTable[gMoveSelectionCursor[battler]]) { - gDisableStructs[gActiveBattler].mimickedMoves &= (~gBitTable[gMoveSelectionCursor[gActiveBattler]]); - gDisableStructs[gActiveBattler].mimickedMoves |= gBitTable[gMultiUsePlayerCursor]; + gDisableStructs[battler].mimickedMoves &= (~gBitTable[gMoveSelectionCursor[battler]]); + gDisableStructs[battler].mimickedMoves |= gBitTable[gMultiUsePlayerCursor]; } - MoveSelectionDisplayMoveNames(); + MoveSelectionDisplayMoveNames(battler); for (i = 0; i < MAX_MON_MOVES; i++) - perMovePPBonuses[i] = (gBattleMons[gActiveBattler].ppBonuses & (3 << (i * 2))) >> (i * 2); + perMovePPBonuses[i] = (gBattleMons[battler].ppBonuses & (3 << (i * 2))) >> (i * 2); - totalPPBonuses = perMovePPBonuses[gMoveSelectionCursor[gActiveBattler]]; - perMovePPBonuses[gMoveSelectionCursor[gActiveBattler]] = perMovePPBonuses[gMultiUsePlayerCursor]; + totalPPBonuses = perMovePPBonuses[gMoveSelectionCursor[battler]]; + perMovePPBonuses[gMoveSelectionCursor[battler]] = perMovePPBonuses[gMultiUsePlayerCursor]; perMovePPBonuses[gMultiUsePlayerCursor] = totalPPBonuses; totalPPBonuses = 0; for (i = 0; i < MAX_MON_MOVES; i++) totalPPBonuses |= perMovePPBonuses[i] << (i * 2); - gBattleMons[gActiveBattler].ppBonuses = totalPPBonuses; + gBattleMons[battler].ppBonuses = totalPPBonuses; for (i = 0; i < MAX_MON_MOVES; i++) { - gBattleMons[gActiveBattler].moves[i] = moveInfo->moves[i]; - gBattleMons[gActiveBattler].pp[i] = moveInfo->currentPp[i]; + gBattleMons[battler].moves[i] = moveInfo->moves[i]; + gBattleMons[battler].pp[i] = moveInfo->currentPp[i]; } - if (!(gBattleMons[gActiveBattler].status2 & STATUS2_TRANSFORMED)) + if (!(gBattleMons[battler].status2 & STATUS2_TRANSFORMED)) { for (i = 0; i < MAX_MON_MOVES; i++) { - moveStruct.moves[i] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + i); - moveStruct.currentPp[i] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_PP1 + i); + moveStruct.moves[i] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_MOVE1 + i); + moveStruct.currentPp[i] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_PP1 + i); } - totalPPBonuses = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_PP_BONUSES); + totalPPBonuses = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_PP_BONUSES); for (i = 0; i < MAX_MON_MOVES; i++) perMovePPBonuses[i] = (totalPPBonuses & (3 << (i * 2))) >> (i * 2); - i = moveStruct.moves[gMoveSelectionCursor[gActiveBattler]]; - moveStruct.moves[gMoveSelectionCursor[gActiveBattler]] = moveStruct.moves[gMultiUsePlayerCursor]; + i = moveStruct.moves[gMoveSelectionCursor[battler]]; + moveStruct.moves[gMoveSelectionCursor[battler]] = moveStruct.moves[gMultiUsePlayerCursor]; moveStruct.moves[gMultiUsePlayerCursor] = i; - i = moveStruct.currentPp[gMoveSelectionCursor[gActiveBattler]]; - moveStruct.currentPp[gMoveSelectionCursor[gActiveBattler]] = moveStruct.currentPp[gMultiUsePlayerCursor]; + i = moveStruct.currentPp[gMoveSelectionCursor[battler]]; + moveStruct.currentPp[gMoveSelectionCursor[battler]] = moveStruct.currentPp[gMultiUsePlayerCursor]; moveStruct.currentPp[gMultiUsePlayerCursor] = i; - totalPPBonuses = perMovePPBonuses[gMoveSelectionCursor[gActiveBattler]]; - perMovePPBonuses[gMoveSelectionCursor[gActiveBattler]] = perMovePPBonuses[gMultiUsePlayerCursor]; + totalPPBonuses = perMovePPBonuses[gMoveSelectionCursor[battler]]; + perMovePPBonuses[gMoveSelectionCursor[battler]] = perMovePPBonuses[gMultiUsePlayerCursor]; perMovePPBonuses[gMultiUsePlayerCursor] = totalPPBonuses; totalPPBonuses = 0; @@ -957,45 +1033,45 @@ static void HandleMoveSwitching(void) for (i = 0; i < MAX_MON_MOVES; i++) { - SetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + i, &moveStruct.moves[i]); - SetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_PP1 + i, &moveStruct.currentPp[i]); + SetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_MOVE1 + i, &moveStruct.moves[i]); + SetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_PP1 + i, &moveStruct.currentPp[i]); } - SetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_PP_BONUSES, &totalPPBonuses); + SetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_PP_BONUSES, &totalPPBonuses); } } - gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseMove; - gMoveSelectionCursor[gActiveBattler] = gMultiUsePlayerCursor; - MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0); - MoveSelectionDisplayPpString(); - MoveSelectionDisplayPpNumber(); - MoveSelectionDisplayMoveType(); - GetUsableZMoves(gActiveBattler, moveInfo->moves); + gBattlerControllerFuncs[battler] = HandleInputChooseMove; + gMoveSelectionCursor[battler] = gMultiUsePlayerCursor; + MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 0); + MoveSelectionDisplayPpString(battler); + MoveSelectionDisplayPpNumber(battler); + MoveSelectionDisplayMoveType(battler); + GetUsableZMoves(battler, moveInfo->moves); } else if (JOY_NEW(B_BUTTON | SELECT_BUTTON)) { PlaySE(SE_SELECT); MoveSelectionDestroyCursorAt(gMultiUsePlayerCursor); - MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0); - gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseMove; - MoveSelectionDisplayPpString(); - MoveSelectionDisplayPpNumber(); - MoveSelectionDisplayMoveType(); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 0); + gBattlerControllerFuncs[battler] = HandleInputChooseMove; + MoveSelectionDisplayPpString(battler); + MoveSelectionDisplayPpNumber(battler); + MoveSelectionDisplayMoveType(battler); } else if (JOY_NEW(DPAD_LEFT)) { if (gMultiUsePlayerCursor & 1) { - if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBattler]) - MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 29); + if (gMultiUsePlayerCursor == gMoveSelectionCursor[battler]) + MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 29); else MoveSelectionDestroyCursorAt(gMultiUsePlayerCursor); gMultiUsePlayerCursor ^= 1; PlaySE(SE_SELECT); - if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBattler]) + if (gMultiUsePlayerCursor == gMoveSelectionCursor[battler]) MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 0); else MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27); @@ -1005,15 +1081,15 @@ static void HandleMoveSwitching(void) { if (!(gMultiUsePlayerCursor & 1) && (gMultiUsePlayerCursor ^ 1) < gNumberOfMovesToChoose) { - if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBattler]) - MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 29); + if (gMultiUsePlayerCursor == gMoveSelectionCursor[battler]) + MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 29); else MoveSelectionDestroyCursorAt(gMultiUsePlayerCursor); gMultiUsePlayerCursor ^= 1; PlaySE(SE_SELECT); - if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBattler]) + if (gMultiUsePlayerCursor == gMoveSelectionCursor[battler]) MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 0); else MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27); @@ -1023,15 +1099,15 @@ static void HandleMoveSwitching(void) { if (gMultiUsePlayerCursor & 2) { - if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBattler]) - MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 29); + if (gMultiUsePlayerCursor == gMoveSelectionCursor[battler]) + MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 29); else MoveSelectionDestroyCursorAt(gMultiUsePlayerCursor); gMultiUsePlayerCursor ^= 2; PlaySE(SE_SELECT); - if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBattler]) + if (gMultiUsePlayerCursor == gMoveSelectionCursor[battler]) MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 0); else MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27); @@ -1041,15 +1117,15 @@ static void HandleMoveSwitching(void) { if (!(gMultiUsePlayerCursor & 2) && (gMultiUsePlayerCursor ^ 2) < gNumberOfMovesToChoose) { - if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBattler]) - MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 29); + if (gMultiUsePlayerCursor == gMoveSelectionCursor[battler]) + MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 29); else MoveSelectionDestroyCursorAt(gMultiUsePlayerCursor); gMultiUsePlayerCursor ^= 2; PlaySE(SE_SELECT); - if (gMultiUsePlayerCursor == gMoveSelectionCursor[gActiveBattler]) + if (gMultiUsePlayerCursor == gMoveSelectionCursor[battler]) MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 0); else MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27); @@ -1057,7 +1133,7 @@ static void HandleMoveSwitching(void) } } -static void SetLinkBattleEndCallbacks(void) +static void SetLinkBattleEndCallbacks(u32 battler) { if (gWirelessCommType == 0) { @@ -1088,7 +1164,7 @@ static void SetLinkBattleEndCallbacks(void) } // Despite handling link battles separately, this is only ever used by link battles -void SetBattleEndCallbacks(void) +void SetBattleEndCallbacks(u32 battler) { if (!gPaletteFade.active) { @@ -1101,7 +1177,7 @@ void SetBattleEndCallbacks(void) else SetLinkStandbyCallback(); - gBattlerControllerFuncs[gActiveBattler] = SetLinkBattleEndCallbacks; + gBattlerControllerFuncs[battler] = SetLinkBattleEndCallbacks; } } else @@ -1114,148 +1190,120 @@ void SetBattleEndCallbacks(void) } } -static void CompleteOnBattlerSpriteCallbackDummy(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - PlayerBufferExecCompleted(); -} - -static void CompleteOnBankSpriteCallbackDummy2(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - PlayerBufferExecCompleted(); -} - -static void FreeTrainerSpriteAfterSlide(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - { - BattleGfxSfxDummy3(gSaveBlock2Ptr->playerGender); - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - PlayerBufferExecCompleted(); - } -} - -static void Intro_DelayAndEnd(void) +static void Intro_DelayAndEnd(u32 battler) { - if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay == (u8)-1) + if (--gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay == (u8)-1) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0; - PlayerBufferExecCompleted(); + gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay = 0; + PlayerBufferExecCompleted(battler); } } -static bool32 TwoIntroMons(u32 battlerId) // Double battle with both player pokemon active. -{ - return (IsDoubleBattle() && IsValidForBattle(&gPlayerParty[gBattlerPartyIndexes[battlerId ^ BIT_FLANK]])); -} - -static void Intro_WaitForShinyAnimAndHealthbox(void) +static void Intro_WaitForShinyAnimAndHealthbox(u32 battler) { bool8 healthboxAnimDone = FALSE; // Check if healthbox has finished sliding in - if (TwoIntroMons(gActiveBattler) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + if (TwoPlayerIntroMons(battler) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy + && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(battler)]].callback == SpriteCallbackDummy) healthboxAnimDone = TRUE; } else { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy) healthboxAnimDone = TRUE; } // If healthbox and shiny anim are done - if (healthboxAnimDone && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim - && gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) + if (healthboxAnimDone && gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim + && gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].finishedShinyMonAnim) { // Reset shiny anim (even if it didn't occur) - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[battler]], battler); - if (TwoIntroMons(gActiveBattler)) - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], BATTLE_PARTNER(gActiveBattler)); + if (TwoPlayerIntroMons(battler)) + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]], BATTLE_PARTNER(battler)); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; - gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; + gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay = 3; + gBattlerControllerFuncs[battler] = Intro_DelayAndEnd; } } -static void Intro_TryShinyAnimShowHealthbox(void) +static void Intro_TryShinyAnimShowHealthbox(u32 battler) { bool32 bgmRestored = FALSE; bool32 battlerAnimsDone = FALSE; // Start shiny animation if applicable for 1st pokemon - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) - TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); + if (!gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive) + TryShinyAnimation(battler, &gPlayerParty[gBattlerPartyIndexes[battler]]); // Start shiny animation if applicable for 2nd pokemon - if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) - TryShinyAnimation(BATTLE_PARTNER(gActiveBattler), &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]); + if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].ballAnimActive) + TryShinyAnimation(BATTLE_PARTNER(battler), &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]]); // Show healthbox after ball anim - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].ballAnimActive) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].healthboxSlideInStarted) { - if (TwoIntroMons(gActiveBattler) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + if (TwoPlayerIntroMons(battler) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); - StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(battler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]], HEALTHBOX_ALL); + StartHealthboxSlideIn(BATTLE_PARTNER(battler)); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(battler)]); } - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], &gPlayerParty[gBattlerPartyIndexes[battler]], HEALTHBOX_ALL); + StartHealthboxSlideIn(battler); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[battler]); } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = TRUE; + gBattleSpritesDataPtr->healthBoxesData[battler].healthboxSlideInStarted = TRUE; } // Restore bgm after cry has played and healthbox anim is started - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry - && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].waitForCry + if (!gBattleSpritesDataPtr->healthBoxesData[battler].waitForCry + && gBattleSpritesDataPtr->healthBoxesData[battler].healthboxSlideInStarted + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].waitForCry && !IsCryPlayingOrClearCrySongs()) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].bgmRestored) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) m4aMPlayContinue(&gMPlayInfo_BGM); else m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 0x100); } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = TRUE; + gBattleSpritesDataPtr->healthBoxesData[battler].bgmRestored = TRUE; bgmRestored = TRUE; } // Wait for battler anims - if (TwoIntroMons(gActiveBattler) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + if (TwoPlayerIntroMons(battler) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) + if (gSprites[gBattleControllerData[battler]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy + && gSprites[gBattleControllerData[BATTLE_PARTNER(battler)]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[BATTLE_PARTNER(battler)]].callback == SpriteCallbackDummy) { battlerAnimsDone = TRUE; } } else { - if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattleControllerData[battler]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy) { battlerAnimsDone = TRUE; } @@ -1264,67 +1312,67 @@ static void Intro_TryShinyAnimShowHealthbox(void) // Clean up if (bgmRestored && battlerAnimsDone) { - if (TwoIntroMons(gActiveBattler) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) - DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); + if (TwoPlayerIntroMons(battler) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(battler)]]); + DestroySprite(&gSprites[gBattleControllerData[battler]]); gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].bgmRestored = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].healthboxSlideInStarted = FALSE; - gBattlerControllerFuncs[gActiveBattler] = Intro_WaitForShinyAnimAndHealthbox; + gBattlerControllerFuncs[battler] = Intro_WaitForShinyAnimAndHealthbox; } } -static void SwitchIn_CleanShinyAnimShowSubstitute(void) +static void SwitchIn_CleanShinyAnimShowSubstitute(u32 battler) { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim - && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy + && gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim + && gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy) { - CopyBattleSpriteInvisibility(gActiveBattler); + CopyBattleSpriteInvisibility(battler); // Reset shiny anim (even if it didn't occur) - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); // Check if Substitute should be shown - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); + if (gBattleSpritesDataPtr->battlerData[battler].behindSubstitute) + InitAndLaunchSpecialAnimation(battler, battler, battler, B_ANIM_MON_TO_SUBSTITUTE); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_HandleSoundAndEnd; + gBattlerControllerFuncs[battler] = SwitchIn_HandleSoundAndEnd; } } -static void SwitchIn_HandleSoundAndEnd(void) +static void SwitchIn_HandleSoundAndEnd(u32 battler) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive + if (!gBattleSpritesDataPtr->healthBoxesData[battler].specialAnimActive && !IsCryPlayingOrClearCrySongs()) { m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 0x100); - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - PlayerBufferExecCompleted(); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[battler]], battler); + PlayerBufferExecCompleted(battler); } } -static void SwitchIn_TryShinyAnimShowHealthbox(void) +static void SwitchIn_TryShinyAnimShowHealthbox(u32 battler) { // Start shiny animation if applicable - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) - TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); + if (!gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive) + TryShinyAnimation(battler, &gPlayerParty[gBattlerPartyIndexes[battler]]); // Wait for ball anim, then show healthbox - if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) + if (gSprites[gBattleControllerData[battler]].callback == SpriteCallbackDummy + && !gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive) { - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_CleanShinyAnimShowSubstitute; + DestroySprite(&gSprites[gBattleControllerData[battler]]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], &gPlayerParty[gBattlerPartyIndexes[battler]], HEALTHBOX_ALL); + StartHealthboxSlideIn(battler); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[battler]); + gBattlerControllerFuncs[battler] = SwitchIn_CleanShinyAnimShowSubstitute; } } @@ -1337,29 +1385,6 @@ void Task_PlayerController_RestoreBgmAfterCry(u8 taskId) } } -static void CompleteOnHealthbarDone(void) -{ - s16 hpValue = MoveBattleBar(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0); - - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - - if (hpValue != -1) - { - UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], HP_CURRENT, hpValue, gBattleMons[gActiveBattler].maxHP); - } - else - { - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - PlayerBufferExecCompleted(); - } -} - -static void CompleteOnInactiveTextPrinter(void) -{ - if (!IsTextPrinterActive(B_WIN_MSG)) - PlayerBufferExecCompleted(); -} - #define tExpTask_monId data[0] #define tExpTask_battler data[2] #define tExpTask_gainedExp_1 data[3] @@ -1374,10 +1399,10 @@ static s32 GetTaskExpValue(u8 taskId) static void Task_GiveExpToMon(u8 taskId) { u32 monId = (u8)(gTasks[taskId].tExpTask_monId); - u8 battlerId = gTasks[taskId].tExpTask_battler; + u8 battler = gTasks[taskId].tExpTask_battler; s32 gainedExp = GetTaskExpValue(taskId); - if (WhichBattleCoords(battlerId) == 1 || monId != gBattlerPartyIndexes[battlerId]) // Give exp without moving the expbar. + if (WhichBattleCoords(battler) == 1 || monId != gBattlerPartyIndexes[battler]) // Give exp without moving the expbar. { struct Pokemon *mon = &gPlayerParty[monId]; u16 species = GetMonData(mon, MON_DATA_SPECIES); @@ -1387,27 +1412,22 @@ static void Task_GiveExpToMon(u8 taskId) if (currExp + gainedExp >= nextLvlExp) { - u8 savedActiveBattler; - SetMonData(mon, MON_DATA_EXP, &nextLvlExp); CalculateMonStats(mon); gainedExp -= nextLvlExp - currExp; - savedActiveBattler = gActiveBattler; - gActiveBattler = battlerId; - BtlController_EmitTwoReturnValues(BUFFER_B, RET_VALUE_LEVELED_UP, gainedExp); - gActiveBattler = savedActiveBattler; + BtlController_EmitTwoReturnValues(battler, BUFFER_B, RET_VALUE_LEVELED_UP, gainedExp); if (IsDoubleBattle() == TRUE - && ((u16)(monId) == gBattlerPartyIndexes[battlerId] || (u16)(monId) == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)])) + && (monId == gBattlerPartyIndexes[battler] || monId == gBattlerPartyIndexes[BATTLE_PARTNER(battler)])) gTasks[taskId].func = Task_LaunchLvlUpAnim; else - gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter; + gTasks[taskId].func = Task_SetControllerToWaitForString; } else { currExp += gainedExp; SetMonData(mon, MON_DATA_EXP, &currExp); - gBattlerControllerFuncs[battlerId] = CompleteOnInactiveTextPrinter; + gBattlerControllerFuncs[battler] = Controller_WaitForString; DestroyTask(taskId); } } @@ -1421,7 +1441,7 @@ static void Task_PrepareToGiveExpWithExpBar(u8 taskId) { u8 monIndex = gTasks[taskId].tExpTask_monId; s32 gainedExp = GetTaskExpValue(taskId); - u8 battlerId = gTasks[taskId].tExpTask_battler; + u8 battler = gTasks[taskId].tExpTask_battler; struct Pokemon *mon = &gPlayerParty[monIndex]; u8 level = GetMonData(mon, MON_DATA_LEVEL); u16 species = GetMonData(mon, MON_DATA_SPECIES); @@ -1431,13 +1451,17 @@ static void Task_PrepareToGiveExpWithExpBar(u8 taskId) exp -= currLvlExp; expToNextLvl = gExperienceTables[gSpeciesInfo[species].growthRate][level + 1] - currLvlExp; - SetBattleBarStruct(battlerId, gHealthboxSpriteIds[battlerId], expToNextLvl, exp, -gainedExp); + SetBattleBarStruct(battler, gHealthboxSpriteIds[battler], expToNextLvl, exp, -gainedExp); PlaySE(SE_EXP); gTasks[taskId].func = Task_GiveExpWithExpBar; } static void Task_GiveExpWithExpBar(u8 taskId) { + u8 level; + u16 species; + s32 currExp, expOnNextLvl, newExpPoints; + if (gTasks[taskId].tExpTask_frames < 13) { gTasks[taskId].tExpTask_frames++; @@ -1446,18 +1470,12 @@ static void Task_GiveExpWithExpBar(u8 taskId) { u8 monId = gTasks[taskId].tExpTask_monId; s32 gainedExp = GetTaskExpValue(taskId); - u8 battlerId = gTasks[taskId].tExpTask_battler; - s32 newExpPoints; + u8 battler = gTasks[taskId].tExpTask_battler; - newExpPoints = MoveBattleBar(battlerId, gHealthboxSpriteIds[battlerId], EXP_BAR, 0); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[battlerId]); + newExpPoints = MoveBattleBar(battler, gHealthboxSpriteIds[battler], EXP_BAR, 0); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[battler]); if (newExpPoints == -1) // The bar has been filled with given exp points. { - u8 level; - s32 currExp; - u16 species; - s32 expOnNextLvl; - m4aSongNumStop(SE_EXP); level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); currExp = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); @@ -1466,22 +1484,17 @@ static void Task_GiveExpWithExpBar(u8 taskId) if (currExp + gainedExp >= expOnNextLvl) { - u8 savedActiveBattler; - SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &expOnNextLvl); CalculateMonStats(&gPlayerParty[monId]); gainedExp -= expOnNextLvl - currExp; - savedActiveBattler = gActiveBattler; - gActiveBattler = battlerId; - BtlController_EmitTwoReturnValues(BUFFER_B, RET_VALUE_LEVELED_UP, gainedExp); - gActiveBattler = savedActiveBattler; + BtlController_EmitTwoReturnValues(battler, BUFFER_B, RET_VALUE_LEVELED_UP, gainedExp); gTasks[taskId].func = Task_LaunchLvlUpAnim; } else { currExp += gainedExp; SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &currExp); - gBattlerControllerFuncs[battlerId] = CompleteOnInactiveTextPrinter; + gBattlerControllerFuncs[battler] = Controller_WaitForString; DestroyTask(taskId); } } @@ -1490,154 +1503,91 @@ static void Task_GiveExpWithExpBar(u8 taskId) static void Task_LaunchLvlUpAnim(u8 taskId) { - u8 battlerId = gTasks[taskId].tExpTask_battler; + u8 battler = gTasks[taskId].tExpTask_battler; u8 monIndex = gTasks[taskId].tExpTask_monId; - if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]) - battlerId ^= BIT_FLANK; + if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[BATTLE_PARTNER(battler)]) + battler ^= BIT_FLANK; - InitAndLaunchSpecialAnimation(battlerId, battlerId, battlerId, B_ANIM_LVL_UP); + InitAndLaunchSpecialAnimation(battler, battler, battler, B_ANIM_LVL_UP); gTasks[taskId].func = Task_UpdateLvlInHealthbox; } static void Task_UpdateLvlInHealthbox(u8 taskId) { - u8 battlerId = gTasks[taskId].tExpTask_battler; + u8 battler = gTasks[taskId].tExpTask_battler; - if (!gBattleSpritesDataPtr->healthBoxesData[battlerId].specialAnimActive) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].specialAnimActive) { u8 monIndex = gTasks[taskId].tExpTask_monId; - GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value. - - if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]) - UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(battlerId)], &gPlayerParty[monIndex], HEALTHBOX_ALL); + if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[BATTLE_PARTNER(battler)]) + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(battler)], &gPlayerParty[monIndex], HEALTHBOX_ALL); else - UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId], &gPlayerParty[monIndex], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], &gPlayerParty[monIndex], HEALTHBOX_ALL); - gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter; + gTasks[taskId].func = Task_SetControllerToWaitForString; } } -static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId) +static void Task_SetControllerToWaitForString(u8 taskId) { - u8 monIndex; - u8 battlerId; - - monIndex = gTasks[taskId].tExpTask_monId; - GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value. - battlerId = gTasks[taskId].tExpTask_battler; - gBattlerControllerFuncs[battlerId] = CompleteOnInactiveTextPrinter; + u8 battler = gTasks[taskId].tExpTask_battler; + gBattlerControllerFuncs[battler] = Controller_WaitForString; DestroyTask(taskId); } -static void FreeMonSpriteAfterFaintAnim(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].y + gSprites[gBattlerSpriteIds[gActiveBattler]].y2 > DISPLAY_HEIGHT) - { - u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - - BattleGfxSfxDummy2(species); - FreeOamMatrix(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.matrixNum); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - PlayerBufferExecCompleted(); - } -} - -static void FreeMonSpriteAfterSwitchOutAnim(void) -{ - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - PlayerBufferExecCompleted(); - } -} - -static void CompleteOnInactiveTextPrinter2(void) -{ - if (!IsTextPrinterActive(B_WIN_MSG)) - PlayerBufferExecCompleted(); -} - -static void OpenPartyMenuToChooseMon(void) +static void OpenPartyMenuToChooseMon(u32 battler) { if (!gPaletteFade.active) { u8 caseId; - gBattlerControllerFuncs[gActiveBattler] = WaitForMonSelection; - caseId = gTasks[gBattleControllerData[gActiveBattler]].data[0]; - DestroyTask(gBattleControllerData[gActiveBattler]); + gBattlerControllerFuncs[battler] = WaitForMonSelection; + caseId = gTasks[gBattleControllerData[battler]].data[0]; + DestroyTask(gBattleControllerData[battler]); FreeAllWindowBuffers(); OpenPartyMenuInBattle(caseId); } } -static void WaitForMonSelection(void) +static void WaitForMonSelection(u32 battler) { if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) { if (gPartyMenuUseExitCallback == TRUE) - BtlController_EmitChosenMonReturnValue(BUFFER_B, gSelectedMonPartyId, gBattlePartyCurrentOrder); + BtlController_EmitChosenMonReturnValue(battler, BUFFER_B, gSelectedMonPartyId, gBattlePartyCurrentOrder); else - BtlController_EmitChosenMonReturnValue(BUFFER_B, PARTY_SIZE, NULL); + BtlController_EmitChosenMonReturnValue(battler, BUFFER_B, PARTY_SIZE, NULL); - if ((gBattleResources->bufferA[gActiveBattler][1] & 0xF) == 1) + if ((gBattleResources->bufferA[battler][1] & 0xF) == 1) PrintLinkStandbyMsg(); - PlayerBufferExecCompleted(); + PlayerBufferExecCompleted(battler); } } -static void OpenBagAndChooseItem(void) +static void OpenBagAndChooseItem(u32 battler) { if (!gPaletteFade.active) { - gBattlerControllerFuncs[gActiveBattler] = CompleteWhenChoseItem; + gBattlerControllerFuncs[battler] = CompleteWhenChoseItem; ReshowBattleScreenDummy(); FreeAllWindowBuffers(); CB2_BagMenuFromBattle(); } } -static void CompleteWhenChoseItem(void) +static void CompleteWhenChoseItem(u32 battler) { if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) { - BtlController_EmitOneReturnValue(BUFFER_B, gSpecialVar_ItemId); - PlayerBufferExecCompleted(); - } -} - -static void CompleteOnSpecialAnimDone(void) -{ - if (!gDoingBattleAnim || !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - PlayerBufferExecCompleted(); -} - -static void DoHitAnimBlinkSpriteEffect(void) -{ - u8 spriteId = gBattlerSpriteIds[gActiveBattler]; - - if (gSprites[spriteId].data[1] == 32) - { - gSprites[spriteId].data[1] = 0; - gSprites[spriteId].invisible = FALSE; - gDoingBattleAnim = FALSE; - PlayerBufferExecCompleted(); - } - else - { - if ((gSprites[spriteId].data[1] % 4) == 0) - gSprites[spriteId].invisible ^= 1; - gSprites[spriteId].data[1]++; + BtlController_EmitOneReturnValue(battler, BUFFER_B, gSpecialVar_ItemId); + PlayerBufferExecCompleted(battler); } } -static void PlayerHandleYesNoInput(void) +static void PlayerHandleYesNoInput(u32 battler) { if (JOY_NEW(DPAD_UP) && gMultiUsePlayerCursor != 0) { @@ -1659,24 +1609,24 @@ static void PlayerHandleYesNoInput(void) PlaySE(SE_SELECT); if (gMultiUsePlayerCursor != 0) - BtlController_EmitTwoReturnValues(BUFFER_B, 0xE, 0); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 0xE, 0); else - BtlController_EmitTwoReturnValues(BUFFER_B, 0xD, 0); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 0xD, 0); - PlayerBufferExecCompleted(); + PlayerBufferExecCompleted(battler); } if (JOY_NEW(B_BUTTON)) { HandleBattleWindow(YESNOBOX_X_Y, WINDOW_CLEAR); PlaySE(SE_SELECT); - PlayerBufferExecCompleted(); + PlayerBufferExecCompleted(battler); } } -static void MoveSelectionDisplayMoveNames(void) +static void MoveSelectionDisplayMoveNames(u32 battler) { s32 i; - struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[gActiveBattler][4]); + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]); gNumberOfMovesToChoose = 0; for (i = 0; i < MAX_MON_MOVES; i++) @@ -1690,40 +1640,40 @@ static void MoveSelectionDisplayMoveNames(void) } } -static void MoveSelectionDisplayPpString(void) +static void MoveSelectionDisplayPpString(u32 battler) { StringCopy(gDisplayedStringBattle, gText_MoveInterfacePP); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_PP); } -static void MoveSelectionDisplayPpNumber(void) +static void MoveSelectionDisplayPpNumber(u32 battler) { u8 *txtPtr; struct ChooseMoveStruct *moveInfo; - if (gBattleResources->bufferA[gActiveBattler][2] == TRUE) // check if we didn't want to display pp number + if (gBattleResources->bufferA[battler][2] == TRUE) // check if we didn't want to display pp number return; - SetPpNumbersPaletteInMoveSelection(); - moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[gActiveBattler][4]); - txtPtr = ConvertIntToDecimalStringN(gDisplayedStringBattle, moveInfo->currentPp[gMoveSelectionCursor[gActiveBattler]], STR_CONV_MODE_RIGHT_ALIGN, 2); + SetPpNumbersPaletteInMoveSelection(battler); + moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]); + txtPtr = ConvertIntToDecimalStringN(gDisplayedStringBattle, moveInfo->currentPp[gMoveSelectionCursor[battler]], STR_CONV_MODE_RIGHT_ALIGN, 2); *(txtPtr)++ = CHAR_SLASH; - ConvertIntToDecimalStringN(txtPtr, moveInfo->maxPp[gMoveSelectionCursor[gActiveBattler]], STR_CONV_MODE_RIGHT_ALIGN, 2); + ConvertIntToDecimalStringN(txtPtr, moveInfo->maxPp[gMoveSelectionCursor[battler]], STR_CONV_MODE_RIGHT_ALIGN, 2); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_PP_REMAINING); } -static void MoveSelectionDisplayMoveType(void) +static void MoveSelectionDisplayMoveType(u32 battler) { u8 *txtPtr; - struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[gActiveBattler][4]); + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]); txtPtr = StringCopy(gDisplayedStringBattle, gText_MoveInterfaceType); *(txtPtr)++ = EXT_CTRL_CODE_BEGIN; *(txtPtr)++ = EXT_CTRL_CODE_FONT; *(txtPtr)++ = FONT_NORMAL; - StringCopy(txtPtr, gTypeNames[gBattleMoves[moveInfo->moves[gMoveSelectionCursor[gActiveBattler]]].type]); + StringCopy(txtPtr, gTypeNames[gBattleMoves[moveInfo->moves[gMoveSelectionCursor[battler]]].type]); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MOVE_TYPE); } @@ -1777,18 +1727,6 @@ void CB2_SetUpReshowBattleScreenAfterMenu2(void) SetMainCallback2(ReshowBattleScreenAfterMenu); } -static void CompleteOnFinishedStatusAnimation(void) -{ - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].statusAnimActive) - PlayerBufferExecCompleted(); -} - -static void CompleteOnFinishedBattleAnimation(void) -{ - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive) - PlayerBufferExecCompleted(); -} - static void PrintLinkStandbyMsg(void) { if (gBattleTypeFlags & BATTLE_TYPE_LINK) @@ -1799,1006 +1737,180 @@ static void PrintLinkStandbyMsg(void) } } -static void PlayerHandleGetMonData(void) +static void PlayerHandleLoadMonSprite(u32 battler) { - u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data - u32 size = 0; - u8 monToCheck; - s32 i; + BattleLoadMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battler]], battler); + gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler; + gBattlerControllerFuncs[battler] = CompleteOnBattlerSpritePosX_0; +} - if (gBattleResources->bufferA[gActiveBattler][2] == 0) - { - size += CopyPlayerMonData(gBattlerPartyIndexes[gActiveBattler], monData); - } +static void PlayerHandleSwitchInAnim(u32 battler) +{ + gActionSelectionCursor[battler] = 0; + gMoveSelectionCursor[battler] = 0; + BtlController_HandleSwitchInAnim(battler, TRUE, SwitchIn_TryShinyAnimShowHealthbox); +} + +u32 LinkPlayerGetTrainerPicId(u32 multiplayerId) +{ + u32 trainerPicId; + + u8 gender = gLinkPlayers[multiplayerId].gender; + u8 version = gLinkPlayers[multiplayerId].version & 0xFF; + + if (version == VERSION_FIRE_RED || version == VERSION_LEAF_GREEN) + trainerPicId = gender + TRAINER_BACK_PIC_RED; + else if (version == VERSION_RUBY || version == VERSION_SAPPHIRE) + trainerPicId = gender + TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN; else - { - monToCheck = gBattleResources->bufferA[gActiveBattler][2]; - for (i = 0; i < PARTY_SIZE; i++) - { - if (monToCheck & 1) - size += CopyPlayerMonData(i, monData + size); - monToCheck >>= 1; - } - } - BtlController_EmitDataTransfer(BUFFER_B, size, monData); - PlayerBufferExecCompleted(); + trainerPicId = gender + TRAINER_BACK_PIC_BRENDAN; + + return trainerPicId; +} + +static u32 PlayerGetTrainerBackPicId(void) +{ + u32 trainerPicId; + + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + trainerPicId = LinkPlayerGetTrainerPicId(GetMultiplayerId()); + else + trainerPicId = gSaveBlock2Ptr->playerGender + TRAINER_BACK_PIC_BRENDAN; + + return trainerPicId; } -static u32 CopyPlayerMonData(u8 monId, u8 *dst) +// In emerald it's possible to have a tag battle in the battle frontier facilities with AI +// which use the front sprite for both the player and the partner as opposed to any other battles (including the one with Steven) +// that use an animated back pic. +static void PlayerHandleDrawTrainerPic(u32 battler) { - struct BattlePokemon battleMon; - struct MovePpInfo moveData; - u8 nickname[20]; - u8 *src; - s16 data16; - u32 data32; - s32 size = 0; + bool32 isFrontPic; + s16 xPos, yPos; + u32 trainerPicId, gender; - switch (gBattleResources->bufferA[gActiveBattler][1]) + trainerPicId = PlayerGetTrainerBackPicId(); + if (gBattleTypeFlags & BATTLE_TYPE_MULTI) { - case REQUEST_ALL_BATTLE: - battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); - battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); - for (size = 0; size < MAX_MON_MOVES; size++) + if ((GetBattlerPosition(battler) & BIT_FLANK) != B_FLANK_LEFT) // Second mon, on the right. + xPos = 90; + else // First mon, on the left. + xPos = 32; + + if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != TRAINER_STEVEN_PARTNER && gPartnerTrainerId < TRAINER_CUSTOM_PARTNER) { - battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); - battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + xPos = 90; + yPos = (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 80; } - battleMon.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); - battleMon.friendship = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); - battleMon.experience = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); - battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); - battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); - battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); - battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); - battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); - battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); - battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); - battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); - battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP); - battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); - battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); - battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); - battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); - battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); - battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); - battleMon.abilityNum = GetMonData(&gPlayerParty[monId], MON_DATA_ABILITY_NUM); - battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); - battleMon.metLevel = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL); - GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname); - StringCopy_Nickname(battleMon.nickname, nickname); - GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName); - src = (u8 *)&battleMon; - for (size = 0; size < sizeof(battleMon); size++) - dst[size] = src[size]; - break; - case REQUEST_SPECIES_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_HELDITEM_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_MOVES_PP_BATTLE: - for (size = 0; size < MAX_MON_MOVES; size++) + else { - moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); - moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); + yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80; } - moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); - src = (u8 *)(&moveData); - for (size = 0; size < sizeof(moveData); size++) - dst[size] = src[size]; - break; - case REQUEST_MOVE1_BATTLE: - case REQUEST_MOVE2_BATTLE: - case REQUEST_MOVE3_BATTLE: - case REQUEST_MOVE4_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_PP_DATA_BATTLE: - for (size = 0; size < MAX_MON_MOVES; size++) - dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); - dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); - size++; - break; - case REQUEST_PPMOVE1_BATTLE: - case REQUEST_PPMOVE2_BATTLE: - case REQUEST_PPMOVE3_BATTLE: - case REQUEST_PPMOVE4_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE); - size = 1; - break; - case REQUEST_OTID_BATTLE: - data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - size = 3; - break; - case REQUEST_EXP_BATTLE: - data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - size = 3; - break; - case REQUEST_HP_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV); - size = 1; - break; - case REQUEST_ATK_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV); - size = 1; - break; - case REQUEST_DEF_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV); - size = 1; - break; - case REQUEST_SPEED_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV); - size = 1; - break; - case REQUEST_SPATK_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV); - size = 1; - break; - case REQUEST_SPDEF_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV); - size = 1; - break; - case REQUEST_FRIENDSHIP_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); - size = 1; - break; - case REQUEST_POKERUS_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS); - size = 1; - break; - case REQUEST_MET_LOCATION_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION); - size = 1; - break; - case REQUEST_MET_LEVEL_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL); - size = 1; - break; - case REQUEST_MET_GAME_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME); - size = 1; - break; - case REQUEST_POKEBALL_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL); - size = 1; - break; - case REQUEST_ALL_IVS_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); - dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); - dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); - dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); - dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); - size = 6; - break; - case REQUEST_HP_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); - size = 1; - break; - case REQUEST_ATK_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); - size = 1; - break; - case REQUEST_DEF_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - size = 1; - break; - case REQUEST_SPEED_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); - size = 1; - break; - case REQUEST_SPATK_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); - size = 1; - break; - case REQUEST_SPDEF_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); - size = 1; - break; - case REQUEST_PERSONALITY_BATTLE: - data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - dst[3] = (data32 & 0xFF000000) >> 24; - size = 4; - break; - case REQUEST_CHECKSUM_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_STATUS_BATTLE: - data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - dst[3] = (data32 & 0xFF000000) >> 24; - size = 4; - break; - case REQUEST_LEVEL_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); - size = 1; - break; - case REQUEST_HP_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_MAX_HP_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_ATK_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_DEF_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPEED_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPATK_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPDEF_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_COOL_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL); - size = 1; - break; - case REQUEST_BEAUTY_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY); - size = 1; - break; - case REQUEST_CUTE_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE); - size = 1; - break; - case REQUEST_SMART_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART); - size = 1; - break; - case REQUEST_TOUGH_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH); - size = 1; - break; - case REQUEST_SHEEN_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN); - size = 1; - break; - case REQUEST_COOL_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON); - size = 1; - break; - case REQUEST_BEAUTY_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON); - size = 1; - break; - case REQUEST_CUTE_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON); - size = 1; - break; - case REQUEST_SMART_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON); - size = 1; - break; - case REQUEST_TOUGH_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON); - size = 1; - break; + + } + else + { + xPos = 80; + yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80; } - return size; + // Use front pic table for any tag battles unless your partner is Steven or a custom partner. + if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != TRAINER_STEVEN_PARTNER && gPartnerTrainerId < TRAINER_CUSTOM_PARTNER) + { + trainerPicId = PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender); + isFrontPic = TRUE; + } + else // Use back pic in all the other usual circumstances. + { + isFrontPic = FALSE; + } + + BtlController_HandleDrawTrainerPic(battler, trainerPicId, isFrontPic, xPos, yPos, -1); +} + +static void PlayerHandleTrainerSlide(u32 battler) +{ + u32 trainerPicId = PlayerGetTrainerBackPicId(); + BtlController_HandleTrainerSlide(battler, trainerPicId); +} + +static void PlayerHandleTrainerSlideBack(u32 battler) +{ + BtlController_HandleTrainerSlideBack(battler, 50, TRUE); } -void PlayerHandleGetRawMonData(void) +static void PlayerHandlePaletteFade(u32 battler) { - struct BattlePokemon battleMon; - u8 *src = (u8 *)&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleResources->bufferA[gActiveBattler][1]; - u8 *dst = (u8 *)&battleMon + gBattleResources->bufferA[gActiveBattler][1]; - u8 i; + BeginNormalPaletteFade(PALETTES_ALL, 2, 0, 16, RGB_BLACK); + PlayerBufferExecCompleted(battler); +} - for (i = 0; i < gBattleResources->bufferA[gActiveBattler][2]; i++) - dst[i] = src[i]; +static void PlayerHandleSuccessBallThrowAnim(u32 battler) +{ + BtlController_HandleSuccessBallThrowAnim(battler, gBattlerTarget, B_ANIM_BALL_THROW, TRUE); +} - BtlController_EmitDataTransfer(BUFFER_B, gBattleResources->bufferA[gActiveBattler][2], dst); - PlayerBufferExecCompleted(); +static void PlayerHandleBallThrowAnim(u32 battler) +{ + BtlController_HandleBallThrowAnim(battler, gBattlerTarget, B_ANIM_BALL_THROW, TRUE); } -static void PlayerHandleSetMonData(void) +static void PlayerHandlePause(u32 battler) { - u8 monToCheck; - u8 i; + u8 timer = gBattleResources->bufferA[battler][1]; - if (gBattleResources->bufferA[gActiveBattler][2] == 0) - { - SetPlayerMonData(gBattlerPartyIndexes[gActiveBattler]); - } + while (timer != 0) + timer--; + + PlayerBufferExecCompleted(battler); +} + +static void PlayerHandleMoveAnimation(u32 battler) +{ + BtlController_HandleMoveAnimation(battler, TRUE); +} + +static void PlayerHandlePrintString(u32 battler) +{ + BtlController_HandlePrintString(battler, TRUE, TRUE); +} + +static void PlayerHandlePrintSelectionString(u32 battler) +{ + if (GetBattlerSide(battler) == B_SIDE_PLAYER) + PlayerHandlePrintString(battler); else + PlayerBufferExecCompleted(battler); +} + +static void HandleChooseActionAfterDma3(u32 battler) +{ + if (!IsDma3ManagerBusyWithBgCopy()) { - monToCheck = gBattleResources->bufferA[gActiveBattler][2]; - for (i = 0; i < PARTY_SIZE; i++) + gBattle_BG0_X = 0; + gBattle_BG0_Y = DISPLAY_HEIGHT; + if (gBattleStruct->aiDelayTimer != 0) { - if (monToCheck & 1) - SetPlayerMonData(i); - monToCheck >>= 1; + gBattleStruct->aiDelayFrames = gMain.vblankCounter1 - gBattleStruct->aiDelayTimer; + gBattleStruct->aiDelayTimer = 0; + #if DEBUG_AI_DELAY_TIMER + { + static const u8 sText_AIDelay[] = _("AI delay:\n{B_BUFF1} frames"); + PREPARE_HWORD_NUMBER_BUFFER(gBattleTextBuff1, 3, gBattleStruct->aiDelayFrames); + BattleStringExpandPlaceholdersToDisplayedString(sText_AIDelay); + BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_ACTION_PROMPT); + } + #endif // DEBUG_AI_DELAY_TIMER } + gBattlerControllerFuncs[battler] = HandleInputChooseAction; } - PlayerBufferExecCompleted(); } -static void SetPlayerMonData(u8 monId) +static void PlayerHandleChooseAction(u32 battler) { - struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleResources->bufferA[gActiveBattler][3]; - struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleResources->bufferA[gActiveBattler][3]; s32 i; - switch (gBattleResources->bufferA[gActiveBattler][1]) - { - case REQUEST_ALL_BATTLE: - { - u8 iv; - - SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species); - SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); - for (i = 0; i < MAX_MON_MOVES; i++) - { - SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); - } - SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); - SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); - SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &battlePokemon->experience); - iv = battlePokemon->hpIV; - SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &iv); - iv = battlePokemon->attackIV; - SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &iv); - iv = battlePokemon->defenseIV; - SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv); - iv = battlePokemon->speedIV; - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &iv); - iv = battlePokemon->spAttackIV; - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv); - iv = battlePokemon->spDefenseIV; - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv); - SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); - SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1); - SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level); - SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp); - SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); - SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack); - SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense); - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &battlePokemon->speed); - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); - } - break; - case REQUEST_SPECIES_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HELDITEM_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MOVES_PP_BATTLE: - for (i = 0; i < MAX_MON_MOVES; i++) - { - SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); - } - SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); - break; - case REQUEST_MOVE1_BATTLE: - case REQUEST_MOVE2_BATTLE: - case REQUEST_MOVE3_BATTLE: - case REQUEST_MOVE4_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_PP_DATA_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleResources->bufferA[gActiveBattler][3]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleResources->bufferA[gActiveBattler][4]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleResources->bufferA[gActiveBattler][5]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleResources->bufferA[gActiveBattler][6]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleResources->bufferA[gActiveBattler][7]); - break; - case REQUEST_PPMOVE1_BATTLE: - case REQUEST_PPMOVE2_BATTLE: - case REQUEST_PPMOVE3_BATTLE: - case REQUEST_PPMOVE4_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_OTID_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_EXP_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HP_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_FRIENDSHIP_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_POKERUS_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_LOCATION_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_LEVEL_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_GAME_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_POKEBALL_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ALL_IVS_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]); - SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][4]); - SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][5]); - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][6]); - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][7]); - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][8]); - break; - case REQUEST_HP_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_PERSONALITY_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CHECKSUM_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_STATUS_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_LEVEL_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HP_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MAX_HP_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_COOL_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_BEAUTY_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CUTE_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SMART_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_TOUGH_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SHEEN_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_COOL_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_BEAUTY_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CUTE_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SMART_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_TOUGH_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - } - - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); -} - -static void PlayerHandleSetRawMonData(void) -{ - u8 *dst = (u8 *)&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleResources->bufferA[gActiveBattler][1]; - u8 i; - - for (i = 0; i < gBattleResources->bufferA[gActiveBattler][2]; i++) - dst[i] = gBattleResources->bufferA[gActiveBattler][3 + i]; - - PlayerBufferExecCompleted(); -} - -static void PlayerHandleLoadMonSprite(void) -{ - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpritePosX_0; -} - -static void PlayerHandleSwitchInAnim(void) -{ - ClearTemporarySpeciesSpriteData(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); - gBattlerPartyIndexes[gActiveBattler] = gBattleResources->bufferA[gActiveBattler][1]; - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - gActionSelectionCursor[gActiveBattler] = 0; - gMoveSelectionCursor[gActiveBattler] = 0; - StartSendOutAnim(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_TryShinyAnimShowHealthbox; -} - -static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) -{ - u16 species; - - ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit); - gBattlerPartyIndexes[battlerId] = gBattleResources->bufferA[battlerId][1]; - species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); - gBattleControllerData[battlerId] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim); - SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId)); - - gBattlerSpriteIds[battlerId] = CreateSprite( - &gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2), - GetBattlerSpriteDefault_Y(battlerId), - GetBattlerSpriteSubpriority(battlerId)); - - gSprites[gBattleControllerData[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; - gSprites[gBattleControllerData[battlerId]].data[2] = battlerId; - - gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId; - gSprites[gBattlerSpriteIds[battlerId]].data[2] = species; - gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId; - - StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]); - - gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE; - gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy; - - gSprites[gBattleControllerData[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT); -} - -static void PlayerHandleReturnMonToBall(void) -{ - if (!gBattleResources->bufferA[gActiveBattler][1]) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation; - } - else - { - // Skip animation, just remove battler - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - PlayerBufferExecCompleted(); - } -} - -static void DoSwitchOutAnimation(void) -{ - switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState) - { - case 0: - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON); - - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1; - break; - case 1: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON); - gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim; - } - break; - } -} - -#define sSpeedX data[0] - -// In emerald it's possible to have a tag battle in the battle frontier facilities with AI -// which use the front sprite for both the player and the partner as opposed to any other battles (including the one with Steven) -// that use an animated back pic. -static void PlayerHandleDrawTrainerPic(void) -{ - s16 xPos, yPos; - u32 trainerPicId; - - if (gBattleTypeFlags & BATTLE_TYPE_LINK) - { - if ((gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_FIRE_RED - || (gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_LEAF_GREEN) - { - trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + TRAINER_BACK_PIC_RED; - } - else if ((gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_RUBY - || (gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_SAPPHIRE) - { - trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN; - } - else - { - trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + TRAINER_BACK_PIC_BRENDAN; - } - } - else - { - trainerPicId = gSaveBlock2Ptr->playerGender; - } - - if (gBattleTypeFlags & BATTLE_TYPE_MULTI) - { - if ((GetBattlerPosition(gActiveBattler) & BIT_FLANK) != B_FLANK_LEFT) // Second mon, on the right. - xPos = 90; - else // First mon, on the left. - xPos = 32; - - if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != TRAINER_STEVEN_PARTNER && gPartnerTrainerId < TRAINER_CUSTOM_PARTNER) - { - xPos = 90; - yPos = (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 80; - } - else - { - yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80; - } - - } - else - { - xPos = 80; - yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80; - } - - // Use front pic table for any tag battles unless your partner is Steven. - if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != TRAINER_STEVEN_PARTNER && gPartnerTrainerId < TRAINER_CUSTOM_PARTNER) - { - trainerPicId = PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender); - DecompressTrainerFrontPic(trainerPicId, gActiveBattler); - SetMultiuseSpriteTemplateToTrainerFront(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, GetBattlerSpriteSubpriority(gActiveBattler)); - - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); - gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = DISPLAY_WIDTH; - gSprites[gBattlerSpriteIds[gActiveBattler]].y2 = 48; - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineMode = ST_OAM_AFFINE_OFF; - gSprites[gBattlerSpriteIds[gActiveBattler]].hFlip = 1; - } - // Use the back pic in any other scenario. - else - { - DecompressTrainerBackPic(trainerPicId, gActiveBattler); - SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, GetBattlerSpriteSubpriority(gActiveBattler)); - - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = DISPLAY_WIDTH; - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; - } - - gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy; -} - -static void PlayerHandleTrainerSlide(void) -{ - u32 trainerPicId; - - if (gBattleTypeFlags & BATTLE_TYPE_LINK) - { - if ((gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_FIRE_RED - || (gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_LEAF_GREEN) - { - trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + TRAINER_BACK_PIC_RED; - } - else if ((gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_RUBY - || (gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_SAPPHIRE) - { - trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN; - } - else - { - trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + TRAINER_BACK_PIC_BRENDAN; - } - } - else - { - trainerPicId = gSaveBlock2Ptr->playerGender + TRAINER_BACK_PIC_BRENDAN; - } - - DecompressTrainerBackPic(trainerPicId, gActiveBattler); - SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, 80, (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80, 30); - - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = -96; - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; - - gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy2; -} - -#undef sSpeedX - -static void PlayerHandleTrainerSlideBack(void) -{ - SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 50; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].y; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); - StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1); - gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; -} - -#define sSpeedX data[1] -#define sSpeedY data[2] - -static void PlayerHandleFaintAnimation(void) -{ - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState == 0) - { - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState++; - } - else - { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - PlaySE12WithPanning(SE_FAINT, SOUND_PAN_ATTACKER); - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 0; - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedY = 5; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintSlideAnim; - gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterFaintAnim; - } - } -} - -#undef sSpeedX -#undef sSpeedY - -static void PlayerHandlePaletteFade(void) -{ - BeginNormalPaletteFade(PALETTES_ALL, 2, 0, 16, RGB_BLACK); - PlayerBufferExecCompleted(); -} - -static void PlayerHandleSuccessBallThrowAnim(void) -{ - gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS; - gDoingBattleAnim = TRUE; - if (IsCriticalCapture()) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gBattlerTarget, B_ANIM_CRITICAL_CAPTURE_THROW); - else - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gBattlerTarget, B_ANIM_BALL_THROW); - - gBattlerControllerFuncs[gActiveBattler] = CompleteOnSpecialAnimDone; -} - -static void PlayerHandleBallThrowAnim(void) -{ - u8 ballThrowCaseId = gBattleResources->bufferA[gActiveBattler][1]; - - gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId; - gDoingBattleAnim = TRUE; - if (IsCriticalCapture()) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gBattlerTarget, B_ANIM_CRITICAL_CAPTURE_THROW); - else - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gBattlerTarget, B_ANIM_BALL_THROW); - - gBattlerControllerFuncs[gActiveBattler] = CompleteOnSpecialAnimDone; -} - -static void PlayerHandlePause(void) -{ - u8 timer = gBattleResources->bufferA[gActiveBattler][1]; - - while (timer != 0) - timer--; - - PlayerBufferExecCompleted(); -} - -static void PlayerHandleMoveAnimation(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) - { - u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); - - gAnimMoveTurn = gBattleResources->bufferA[gActiveBattler][3]; - gAnimMovePower = gBattleResources->bufferA[gActiveBattler][4] | (gBattleResources->bufferA[gActiveBattler][5] << 8); - gAnimMoveDmg = gBattleResources->bufferA[gActiveBattler][6] | (gBattleResources->bufferA[gActiveBattler][7] << 8) | (gBattleResources->bufferA[gActiveBattler][8] << 16) | (gBattleResources->bufferA[gActiveBattler][9] << 24); - gAnimFriendship = gBattleResources->bufferA[gActiveBattler][10]; - gWeatherMoveAnim = gBattleResources->bufferA[gActiveBattler][12] | (gBattleResources->bufferA[gActiveBattler][13] << 8); - gAnimDisableStructPtr = (struct DisableStruct *)&gBattleResources->bufferA[gActiveBattler][16]; - gTransformedPersonalities[gActiveBattler] = gAnimDisableStructPtr->transformedMonPersonality; - gTransformedOtIds[gActiveBattler] = gAnimDisableStructPtr->transformedMonOtId; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerControllerFuncs[gActiveBattler] = PlayerDoMoveAnimation; - BattleTv_SetDataBasedOnMove(move, gWeatherMoveAnim, gAnimDisableStructPtr); - } -} - -static void PlayerDoMoveAnimation(void) -{ - u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); - u8 multihit = gBattleResources->bufferA[gActiveBattler][11]; - - switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState) - { - case 0: - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute - && !gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8) - { - gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 1; - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON); - } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1; - break; - case 1: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF); - DoMoveAnim(move); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2; - } - break; - case 2: - gAnimScriptCallback(); - if (!gAnimScriptActive) - { - SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL); - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2) - { - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 0; - } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 3; - } - break; - case 3: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - CopyAllBattleSpritesInvisibilities(); - TrySetBehindSubstituteSpriteBit(gActiveBattler, gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - PlayerBufferExecCompleted(); - } - break; - } -} - -static void PlayerHandlePrintString(void) -{ - u16 *stringId; - - gBattle_BG0_X = 0; - gBattle_BG0_Y = 0; - stringId = (u16 *)(&gBattleResources->bufferA[gActiveBattler][2]); - BufferStringBattle(*stringId); - BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG); - gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter2; - BattleTv_SetDataBasedOnString(*stringId); - BattleArena_DeductSkillPoints(gActiveBattler, *stringId); -} - -static void PlayerHandlePrintSelectionString(void) -{ - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - PlayerHandlePrintString(); - else - PlayerBufferExecCompleted(); -} - -static void HandleChooseActionAfterDma3(void) -{ - if (!IsDma3ManagerBusyWithBgCopy()) - { - gBattle_BG0_X = 0; - gBattle_BG0_Y = DISPLAY_HEIGHT; - gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseAction; - } -} - -static void PlayerHandleChooseAction(void) -{ - s32 i; - - gBattlerControllerFuncs[gActiveBattler] = HandleChooseActionAfterDma3; + gBattlerControllerFuncs[battler] = HandleChooseActionAfterDma3; BattleTv_ClearExplosionFaintCause(); BattlePutTextOnWindow(gText_BattleMenu, B_WIN_ACTION_MENU); @@ -2806,180 +1918,161 @@ static void PlayerHandleChooseAction(void) ActionSelectionDestroyCursorAt(i); TryRestoreLastUsedBall(); - ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0); + ActionSelectionCreateCursorAt(gActionSelectionCursor[battler], 0); + PREPARE_MON_NICK_BUFFER(gBattleTextBuff1, battler, gBattlerPartyIndexes[battler]); BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillPkmnDo); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_ACTION_PROMPT); } -static void PlayerHandleYesNoBox(void) +static void PlayerHandleYesNoBox(u32 battler) { - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) { HandleBattleWindow(YESNOBOX_X_Y, 0); BattlePutTextOnWindow(gText_BattleYesNoChoice, B_WIN_YESNO); gMultiUsePlayerCursor = 1; BattleCreateYesNoCursorAt(1); - gBattlerControllerFuncs[gActiveBattler] = PlayerHandleYesNoInput; + gBattlerControllerFuncs[battler] = PlayerHandleYesNoInput; } else { - PlayerBufferExecCompleted(); + PlayerBufferExecCompleted(battler); } } -static void HandleChooseMoveAfterDma3(void) +static void HandleChooseMoveAfterDma3(u32 battler) { if (!IsDma3ManagerBusyWithBgCopy()) { gBattle_BG0_X = 0; gBattle_BG0_Y = DISPLAY_HEIGHT * 2; - gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseMove; + gBattlerControllerFuncs[battler] = HandleInputChooseMove; } } // arenaMindPoints is used here as a placeholder for a timer. -static void PlayerChooseMoveInBattlePalace(void) +static void PlayerChooseMoveInBattlePalace(u32 battler) { - if (--*(gBattleStruct->arenaMindPoints + gActiveBattler) == 0) + if (--*(gBattleStruct->arenaMindPoints + battler) == 0) { gBattlePalaceMoveSelectionRngValue = gRngValue; - BtlController_EmitTwoReturnValues(BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace()); - PlayerBufferExecCompleted(); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace(battler)); + PlayerBufferExecCompleted(battler); } } -static void PlayerHandleChooseMove(void) +static void PlayerHandleChooseMove(u32 battler) { if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - *(gBattleStruct->arenaMindPoints + gActiveBattler) = 8; - gBattlerControllerFuncs[gActiveBattler] = PlayerChooseMoveInBattlePalace; + *(gBattleStruct->arenaMindPoints + battler) = 8; + gBattlerControllerFuncs[battler] = PlayerChooseMoveInBattlePalace; } else { - struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[gActiveBattler][4]); + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]); - InitMoveSelectionsVarsAndStrings(); + InitMoveSelectionsVarsAndStrings(battler); gBattleStruct->mega.playerSelect = FALSE; + gBattleStruct->burst.playerSelect = FALSE; if (!IsMegaTriggerSpriteActive()) gBattleStruct->mega.triggerSpriteId = 0xFF; - if (CanMegaEvolve(gActiveBattler)) - CreateMegaTriggerSprite(gActiveBattler, 0); + if (CanMegaEvolve(battler)) + CreateMegaTriggerSprite(battler, 0); + if (!IsBurstTriggerSpriteActive()) + gBattleStruct->burst.triggerSpriteId = 0xFF; + if (CanUltraBurst(battler)) + CreateBurstTriggerSprite(battler, 0); if (!IsZMoveTriggerSpriteActive()) gBattleStruct->zmove.triggerSpriteId = 0xFF; - GetUsableZMoves(gActiveBattler, moveInfo->moves); - gBattleStruct->zmove.viable = IsZMoveUsable(gActiveBattler, gMoveSelectionCursor[gActiveBattler]); - CreateZMoveTriggerSprite(gActiveBattler, gBattleStruct->zmove.viable); - gBattlerControllerFuncs[gActiveBattler] = HandleChooseMoveAfterDma3; + GetUsableZMoves(battler, moveInfo->moves); + gBattleStruct->zmove.viable = IsZMoveUsable(battler, gMoveSelectionCursor[battler]); + CreateZMoveTriggerSprite(battler, gBattleStruct->zmove.viable); + gBattlerControllerFuncs[battler] = HandleChooseMoveAfterDma3; } } -void InitMoveSelectionsVarsAndStrings(void) +void InitMoveSelectionsVarsAndStrings(u32 battler) { - MoveSelectionDisplayMoveNames(); + MoveSelectionDisplayMoveNames(battler); gMultiUsePlayerCursor = 0xFF; - MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0); - MoveSelectionDisplayPpString(); - MoveSelectionDisplayPpNumber(); - MoveSelectionDisplayMoveType(); + MoveSelectionCreateCursorAt(gMoveSelectionCursor[battler], 0); + MoveSelectionDisplayPpString(battler); + MoveSelectionDisplayPpNumber(battler); + MoveSelectionDisplayMoveType(battler); } -static void PlayerHandleChooseItem(void) +static void PlayerHandleChooseItem(u32 battler) { s32 i; BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); - gBattlerControllerFuncs[gActiveBattler] = OpenBagAndChooseItem; - gBattlerInMenuId = gActiveBattler; + gBattlerControllerFuncs[battler] = OpenBagAndChooseItem; + gBattlerInMenuId = battler; for (i = 0; i < ARRAY_COUNT(gBattlePartyCurrentOrder); i++) - gBattlePartyCurrentOrder[i] = gBattleResources->bufferA[gActiveBattler][1 + i]; + gBattlePartyCurrentOrder[i] = gBattleResources->bufferA[battler][1 + i]; } -static void PlayerHandleChoosePokemon(void) +static void PlayerHandleChoosePokemon(u32 battler) { s32 i; for (i = 0; i < ARRAY_COUNT(gBattlePartyCurrentOrder); i++) - gBattlePartyCurrentOrder[i] = gBattleResources->bufferA[gActiveBattler][4 + i]; + gBattlePartyCurrentOrder[i] = gBattleResources->bufferA[battler][4 + i]; - if (gBattleTypeFlags & BATTLE_TYPE_ARENA && (gBattleResources->bufferA[gActiveBattler][1] & 0xF) != PARTY_ACTION_CANT_SWITCH - && (gBattleResources->bufferA[gActiveBattler][1] & 0xF) != PARTY_ACTION_CHOOSE_FAINTED_MON) + if (gBattleTypeFlags & BATTLE_TYPE_ARENA && (gBattleResources->bufferA[battler][1] & 0xF) != PARTY_ACTION_CANT_SWITCH + && (gBattleResources->bufferA[battler][1] & 0xF) != PARTY_ACTION_CHOOSE_FAINTED_MON) { - BtlController_EmitChosenMonReturnValue(BUFFER_B, gBattlerPartyIndexes[gActiveBattler] + 1, gBattlePartyCurrentOrder); - PlayerBufferExecCompleted(); + BtlController_EmitChosenMonReturnValue(battler, BUFFER_B, gBattlerPartyIndexes[battler] + 1, gBattlePartyCurrentOrder); + PlayerBufferExecCompleted(battler); } else { - gBattleControllerData[gActiveBattler] = CreateTask(TaskDummy, 0xFF); - gTasks[gBattleControllerData[gActiveBattler]].data[0] = gBattleResources->bufferA[gActiveBattler][1] & 0xF; - *(&gBattleStruct->battlerPreventingSwitchout) = gBattleResources->bufferA[gActiveBattler][1] >> 4; - *(&gBattleStruct->prevSelectedPartySlot) = gBattleResources->bufferA[gActiveBattler][2]; - *(&gBattleStruct->abilityPreventingSwitchout) = (gBattleResources->bufferA[gActiveBattler][3] & 0xFF) | (gBattleResources->bufferA[gActiveBattler][7] << 8); + gBattleControllerData[battler] = CreateTask(TaskDummy, 0xFF); + gTasks[gBattleControllerData[battler]].data[0] = gBattleResources->bufferA[battler][1] & 0xF; + *(&gBattleStruct->battlerPreventingSwitchout) = gBattleResources->bufferA[battler][1] >> 4; + *(&gBattleStruct->prevSelectedPartySlot) = gBattleResources->bufferA[battler][2]; + *(&gBattleStruct->abilityPreventingSwitchout) = (gBattleResources->bufferA[battler][3] & 0xFF) | (gBattleResources->bufferA[battler][7] << 8); BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); - gBattlerControllerFuncs[gActiveBattler] = OpenPartyMenuToChooseMon; - gBattlerInMenuId = gActiveBattler; + gBattlerControllerFuncs[battler] = OpenPartyMenuToChooseMon; + gBattlerInMenuId = battler; } } -static void PlayerHandleCmd23(void) +static void PlayerHandleCmd23(u32 battler) { BattleStopLowHpSound(); BeginNormalPaletteFade(PALETTES_ALL, 2, 0, 16, RGB_BLACK); - PlayerBufferExecCompleted(); + PlayerBufferExecCompleted(battler); } -static void PlayerHandleHealthBarUpdate(void) +static void PlayerHandleHealthBarUpdate(u32 battler) { - s16 hpVal; - - LoadBattleBarGfx(0); - hpVal = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); - - // gPlayerPartyLostHP used by Battle Dome, but never read - if (hpVal > 0) - gPlayerPartyLostHP += hpVal; - - if (hpVal != INSTANT_HP_BAR_DROP) - { - u32 maxHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); - u32 curHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_HP); - - SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, curHP, hpVal); - } - else - { - u32 maxHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); - - SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, 0, hpVal); - UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], HP_CURRENT, 0, maxHP); - } - - gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthbarDone; + BtlController_HandleHealthBarUpdate(battler, TRUE); } -static void PlayerHandleExpUpdate(void) +void PlayerHandleExpUpdate(u32 battler) { - u8 monId = gBattleResources->bufferA[gActiveBattler][1]; + u8 monId = gBattleResources->bufferA[battler][1]; s32 taskId, expPointsToGive; if (GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL) >= MAX_LEVEL) { - PlayerBufferExecCompleted(); + PlayerBufferExecCompleted(battler); } else { LoadBattleBarGfx(1); - GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); // Unused return value. - expPointsToGive = T1_READ_32(&gBattleResources->bufferA[gActiveBattler][2]); + expPointsToGive = T1_READ_32(&gBattleResources->bufferA[battler][2]); taskId = CreateTask(Task_GiveExpToMon, 10); gTasks[taskId].tExpTask_monId = monId; gTasks[taskId].tExpTask_gainedExp_1 = expPointsToGive; gTasks[taskId].tExpTask_gainedExp_2 = expPointsToGive >> 16; - gTasks[taskId].tExpTask_battler = gActiveBattler; - gBattlerControllerFuncs[gActiveBattler] = BattleControllerDummy; + gTasks[taskId].tExpTask_battler = battler; + gBattlerControllerFuncs[battler] = BattleControllerDummy; } } @@ -2989,51 +2082,23 @@ static void PlayerHandleExpUpdate(void) #undef tExpTask_gainedExp_2 #undef tExpTask_frames -static void PlayerHandleStatusIconUpdate(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) - { - u8 battlerId; - - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON); - battlerId = gActiveBattler; - gBattleSpritesDataPtr->healthBoxesData[battlerId].statusAnimActive = 0; - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; - } -} - -static void PlayerHandleStatusAnimation(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) - { - InitAndLaunchChosenStatusAnimation(gBattleResources->bufferA[gActiveBattler][1], - gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8) | (gBattleResources->bufferA[gActiveBattler][4] << 16) | (gBattleResources->bufferA[gActiveBattler][5] << 24)); - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; - } -} - -static void PlayerHandleStatusXor(void) +static void PlayerHandleStatusXor(u32 battler) { - u8 val = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_STATUS) ^ gBattleResources->bufferA[gActiveBattler][1]; + u8 val = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_STATUS) ^ gBattleResources->bufferA[battler][1]; - SetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_STATUS, &val); - PlayerBufferExecCompleted(); + SetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_STATUS, &val); + PlayerBufferExecCompleted(battler); } -static void PlayerHandleDataTransfer(void) +static void PlayerHandleDMA3Transfer(u32 battler) { - PlayerBufferExecCompleted(); -} - -static void PlayerHandleDMA3Transfer(void) -{ - u32 dstArg = gBattleResources->bufferA[gActiveBattler][1] - | (gBattleResources->bufferA[gActiveBattler][2] << 8) - | (gBattleResources->bufferA[gActiveBattler][3] << 16) - | (gBattleResources->bufferA[gActiveBattler][4] << 24); - u16 sizeArg = gBattleResources->bufferA[gActiveBattler][5] | (gBattleResources->bufferA[gActiveBattler][6] << 8); + u32 dstArg = gBattleResources->bufferA[battler][1] + | (gBattleResources->bufferA[battler][2] << 8) + | (gBattleResources->bufferA[battler][3] << 16) + | (gBattleResources->bufferA[battler][4] << 24); + u16 sizeArg = gBattleResources->bufferA[battler][5] | (gBattleResources->bufferA[battler][6] << 8); - const u8 *src = &gBattleResources->bufferA[gActiveBattler][7]; + const u8 *src = &gBattleResources->bufferA[battler][7]; u8 *dst = (u8 *)(dstArg); u32 size = sizeArg; @@ -3049,351 +2114,121 @@ static void PlayerHandleDMA3Transfer(void) dst += 0x1000; size -= 0x1000; } - PlayerBufferExecCompleted(); -} - -static void PlayerHandlePlayBGM(void) -{ - PlayBGM(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - PlayerBufferExecCompleted(); + PlayerBufferExecCompleted(battler); } -static void PlayerHandleCmd32(void) +static void PlayerHandlePlayBGM(u32 battler) { - PlayerBufferExecCompleted(); + PlayBGM(gBattleResources->bufferA[battler][1] | (gBattleResources->bufferA[battler][2] << 8)); + PlayerBufferExecCompleted(battler); } -static void PlayerHandleTwoReturnValues(void) +static void PlayerHandleTwoReturnValues(u32 battler) { - BtlController_EmitTwoReturnValues(BUFFER_B, 0, 0); - PlayerBufferExecCompleted(); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 0, 0); + PlayerBufferExecCompleted(battler); } -static void PlayerHandleChosenMonReturnValue(void) +static void PlayerHandleChosenMonReturnValue(u32 battler) { - BtlController_EmitChosenMonReturnValue(BUFFER_B, 0, NULL); - PlayerBufferExecCompleted(); + BtlController_EmitChosenMonReturnValue(battler, BUFFER_B, 0, NULL); + PlayerBufferExecCompleted(battler); } -static void PlayerHandleOneReturnValue(void) +static void PlayerHandleOneReturnValue(u32 battler) { - BtlController_EmitOneReturnValue(BUFFER_B, 0); - PlayerBufferExecCompleted(); + BtlController_EmitOneReturnValue(battler, BUFFER_B, 0); + PlayerBufferExecCompleted(battler); } -static void PlayerHandleOneReturnValue_Duplicate(void) +static void PlayerHandleOneReturnValue_Duplicate(u32 battler) { - BtlController_EmitOneReturnValue_Duplicate(BUFFER_B, 0); - PlayerBufferExecCompleted(); + BtlController_EmitOneReturnValue_Duplicate(battler, BUFFER_B, 0); + PlayerBufferExecCompleted(battler); } -static void PlayerHandleClearUnkVar(void) +static void PlayerHandleIntroTrainerBallThrow(u32 battler) { - gUnusedControllerStruct.unk = 0; - PlayerBufferExecCompleted(); + const u32 *trainerPal = gTrainerBackPicPaletteTable[gSaveBlock2Ptr->playerGender].data; + BtlController_HandleIntroTrainerBallThrow(battler, 0xD6F8, trainerPal, 31, Intro_TryShinyAnimShowHealthbox); } -static void PlayerHandleSetUnkVar(void) +static void PlayerHandleDrawPartyStatusSummary(u32 battler) { - gUnusedControllerStruct.unk = gBattleResources->bufferA[gActiveBattler][1]; - PlayerBufferExecCompleted(); + BtlController_HandleDrawPartyStatusSummary(battler, B_SIDE_PLAYER, TRUE); } -static void PlayerHandleClearUnkFlag(void) +static void PlayerHandleEndBounceEffect(u32 battler) { - gUnusedControllerStruct.flag = 0; - PlayerBufferExecCompleted(); + EndBounceEffect(battler, BOUNCE_HEALTHBOX); + EndBounceEffect(battler, BOUNCE_MON); + PlayerBufferExecCompleted(battler); } -static void PlayerHandleToggleUnkFlag(void) +static void PlayerHandleBattleAnimation(u32 battler) { - gUnusedControllerStruct.flag ^= 1; - PlayerBufferExecCompleted(); + BtlController_HandleBattleAnimation(battler, FALSE, TRUE); } -static void PlayerHandleHitAnimation(void) +static void PlayerHandleLinkStandbyMsg(u32 battler) { - if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE) - { - PlayerBufferExecCompleted(); - } - else - { - gDoingBattleAnim = TRUE; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; - DoHitAnimHealthboxEffect(gActiveBattler); - gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; - } -} - -static void PlayerHandleCantSwitch(void) -{ - PlayerBufferExecCompleted(); -} - -static void PlayerHandlePlaySE(void) -{ - s8 pan; - - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - pan = SOUND_PAN_ATTACKER; - else - pan = SOUND_PAN_TARGET; - - PlaySE12WithPanning(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8), pan); - PlayerBufferExecCompleted(); -} - -static void PlayerHandlePlayFanfareOrBGM(void) -{ - if (gBattleResources->bufferA[gActiveBattler][3]) - { - BattleStopLowHpSound(); - PlayBGM(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - else - { - PlayFanfare(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - - PlayerBufferExecCompleted(); -} - -static void PlayerHandleFaintingCry(void) -{ - u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - - PlayCry_ByMode(species, -25, CRY_MODE_FAINT); - PlayerBufferExecCompleted(); -} - -static void PlayerHandleIntroSlide(void) -{ - HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]); - gIntroSlideFlags |= 1; - PlayerBufferExecCompleted(); -} - -// Task data for Task_StartSendOutAnim -#define tBattlerId data[0] -#define tStartTimer data[1] - -#define sBattlerId data[5] - -static void PlayerHandleIntroTrainerBallThrow(void) -{ - u8 paletteNum; - u8 taskId; - - SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 50; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].y; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; - gSprites[gBattlerSpriteIds[gActiveBattler]].sBattlerId = gActiveBattler; - - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCB_FreePlayerSpriteLoadMonSprite); - StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1); - - paletteNum = AllocSpritePalette(0xD6F8); - LoadCompressedPalette(gTrainerBackPicPaletteTable[gSaveBlock2Ptr->playerGender].data, OBJ_PLTT_ID(paletteNum), PLTT_SIZE_4BPP); - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum; - - taskId = CreateTask(Task_StartSendOutAnim, 5); - gTasks[taskId].tBattlerId = gActiveBattler; - - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) - gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - - gBattleSpritesDataPtr->animationData->introAnimActive = TRUE; - gBattlerControllerFuncs[gActiveBattler] = BattleControllerDummy; -} - -void SpriteCB_FreePlayerSpriteLoadMonSprite(struct Sprite *sprite) -{ - u8 battlerId = sprite->sBattlerId; - - // Free player trainer sprite - FreeSpriteOamMatrix(sprite); - FreeSpritePaletteByTag(GetSpritePaletteTagByPaletteNum(sprite->oam.paletteNum)); - DestroySprite(sprite); - - // Load mon sprite - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battlerId]], battlerId); - StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], 0); -} - -#undef sBattlerId - -// Send out at start of battle -static void Task_StartSendOutAnim(u8 taskId) -{ - if (gTasks[taskId].tStartTimer < 31) - { - gTasks[taskId].tStartTimer++; - } - else - { - u8 savedActiveBattler = gActiveBattler; - - gActiveBattler = gTasks[taskId].tBattlerId; - if (TwoIntroMons(gActiveBattler) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) - { - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - StartSendOutAnim(gActiveBattler, FALSE); - gActiveBattler ^= BIT_FLANK; - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - StartSendOutAnim(gActiveBattler, FALSE); - gActiveBattler ^= BIT_FLANK; - } - else - { - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - StartSendOutAnim(gActiveBattler, FALSE); - } - gBattlerControllerFuncs[gActiveBattler] = Intro_TryShinyAnimShowHealthbox; - gActiveBattler = savedActiveBattler; - DestroyTask(taskId); - } -} - -#undef tBattlerId -#undef tStartTimer - -static void PlayerHandleDrawPartyStatusSummary(void) -{ - if (gBattleResources->bufferA[gActiveBattler][1] != 0 && GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - { - PlayerBufferExecCompleted(); - } - else - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1; - gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleResources->bufferA[gActiveBattler][4], gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2]); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; - - // If intro, skip the delay after drawing - if (gBattleResources->bufferA[gActiveBattler][2] != 0) - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 93; - - gBattlerControllerFuncs[gActiveBattler] = EndDrawPartyStatusSummary; - } -} - -static void EndDrawPartyStatusSummary(void) -{ - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer++ > 92) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; - PlayerBufferExecCompleted(); - } -} - -static void PlayerHandleHidePartyStatusSummary(void) -{ - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) - gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - PlayerBufferExecCompleted(); -} - -static void PlayerHandleEndBounceEffect(void) -{ - EndBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX); - EndBounceEffect(gActiveBattler, BOUNCE_MON); - PlayerBufferExecCompleted(); -} - -static void PlayerHandleSpriteInvisibility(void) -{ - if (IsBattlerSpritePresent(gActiveBattler)) - { - gSprites[gBattlerSpriteIds[gActiveBattler]].invisible = gBattleResources->bufferA[gActiveBattler][1]; - CopyBattleSpriteInvisibility(gActiveBattler); - } - PlayerBufferExecCompleted(); -} - -static void PlayerHandleBattleAnimation(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) - { - u8 animationId = gBattleResources->bufferA[gActiveBattler][1]; - u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); - - if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument)) - PlayerBufferExecCompleted(); - else - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; - - BattleTv_SetDataBasedOnAnimation(animationId); - } -} - -static void PlayerHandleLinkStandbyMsg(void) -{ - RecordedBattle_RecordAllBattlerData(&gBattleResources->bufferA[gActiveBattler][2]); - switch (gBattleResources->bufferA[gActiveBattler][1]) + RecordedBattle_RecordAllBattlerData(&gBattleResources->bufferA[battler][2]); + switch (gBattleResources->bufferA[battler][1]) { case LINK_STANDBY_MSG_STOP_BOUNCE: PrintLinkStandbyMsg(); // fall through case LINK_STANDBY_STOP_BOUNCE_ONLY: - EndBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX); - EndBounceEffect(gActiveBattler, BOUNCE_MON); + EndBounceEffect(battler, BOUNCE_HEALTHBOX); + EndBounceEffect(battler, BOUNCE_MON); break; case LINK_STANDBY_MSG_ONLY: PrintLinkStandbyMsg(); break; } - PlayerBufferExecCompleted(); + PlayerBufferExecCompleted(battler); } -static void PlayerHandleResetActionMoveSelection(void) +static void PlayerHandleResetActionMoveSelection(u32 battler) { - switch (gBattleResources->bufferA[gActiveBattler][1]) + switch (gBattleResources->bufferA[battler][1]) { case RESET_ACTION_MOVE_SELECTION: - gActionSelectionCursor[gActiveBattler] = 0; - gMoveSelectionCursor[gActiveBattler] = 0; + gActionSelectionCursor[battler] = 0; + gMoveSelectionCursor[battler] = 0; break; case RESET_ACTION_SELECTION: - gActionSelectionCursor[gActiveBattler] = 0; + gActionSelectionCursor[battler] = 0; break; case RESET_MOVE_SELECTION: - gMoveSelectionCursor[gActiveBattler] = 0; + gMoveSelectionCursor[battler] = 0; break; } - PlayerBufferExecCompleted(); + PlayerBufferExecCompleted(battler); } -static void PlayerHandleEndLinkBattle(void) +static void PlayerHandleEndLinkBattle(u32 battler) { - RecordedBattle_RecordAllBattlerData(&gBattleResources->bufferA[gActiveBattler][4]); - gBattleOutcome = gBattleResources->bufferA[gActiveBattler][1]; - gSaveBlock2Ptr->frontier.disableRecordBattle = gBattleResources->bufferA[gActiveBattler][2]; + RecordedBattle_RecordAllBattlerData(&gBattleResources->bufferA[battler][4]); + gBattleOutcome = gBattleResources->bufferA[battler][1]; + gSaveBlock2Ptr->frontier.disableRecordBattle = gBattleResources->bufferA[battler][2]; FadeOutMapMusic(5); BeginFastPaletteFade(3); - PlayerBufferExecCompleted(); - gBattlerControllerFuncs[gActiveBattler] = SetBattleEndCallbacks; + PlayerBufferExecCompleted(battler); + gBattlerControllerFuncs[battler] = SetBattleEndCallbacks; } -static void WaitForDebug(void) +static void Controller_WaitForDebug(u32 battler) { if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) { - PlayerBufferExecCompleted(); + PlayerBufferExecCompleted(battler); } } -static void PlayerHandleBattleDebug(void) +static void PlayerHandleBattleDebug(u32 battler) { BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); SetMainCallback2(CB2_BattleDebugMenu); - gBattlerControllerFuncs[gActiveBattler] = WaitForDebug; -} - -static void PlayerCmdEnd(void) -{ + gBattlerControllerFuncs[battler] = Controller_WaitForDebug; } diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index b94d5347aa75..361460ac72e8 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -31,211 +31,126 @@ #include "constants/party_menu.h" #include "constants/trainers.h" -static void PlayerPartnerHandleGetMonData(void); -static void PlayerPartnerHandleGetRawMonData(void); -static void PlayerPartnerHandleSetMonData(void); -static void PlayerPartnerHandleSetRawMonData(void); -static void PlayerPartnerHandleLoadMonSprite(void); -static void PlayerPartnerHandleSwitchInAnim(void); -static void PlayerPartnerHandleReturnMonToBall(void); -static void PlayerPartnerHandleDrawTrainerPic(void); -static void PlayerPartnerHandleTrainerSlide(void); -static void PlayerPartnerHandleTrainerSlideBack(void); -static void PlayerPartnerHandleFaintAnimation(void); -static void PlayerPartnerHandlePaletteFade(void); -static void PlayerPartnerHandleSuccessBallThrowAnim(void); -static void PlayerPartnerHandleBallThrowAnim(void); -static void PlayerPartnerHandlePause(void); -static void PlayerPartnerHandleMoveAnimation(void); -static void PlayerPartnerHandlePrintString(void); -static void PlayerPartnerHandlePrintSelectionString(void); -static void PlayerPartnerHandleChooseAction(void); -static void PlayerPartnerHandleYesNoBox(void); -static void PlayerPartnerHandleChooseMove(void); -static void PlayerPartnerHandleChooseItem(void); -static void PlayerPartnerHandleChoosePokemon(void); -static void PlayerPartnerHandleCmd23(void); -static void PlayerPartnerHandleHealthBarUpdate(void); -static void PlayerPartnerHandleExpUpdate(void); -static void PlayerPartnerHandleStatusIconUpdate(void); -static void PlayerPartnerHandleStatusAnimation(void); -static void PlayerPartnerHandleStatusXor(void); -static void PlayerPartnerHandleDataTransfer(void); -static void PlayerPartnerHandleDMA3Transfer(void); -static void PlayerPartnerHandlePlayBGM(void); -static void PlayerPartnerHandleCmd32(void); -static void PlayerPartnerHandleTwoReturnValues(void); -static void PlayerPartnerHandleChosenMonReturnValue(void); -static void PlayerPartnerHandleOneReturnValue(void); -static void PlayerPartnerHandleOneReturnValue_Duplicate(void); -static void PlayerPartnerHandleClearUnkVar(void); -static void PlayerPartnerHandleSetUnkVar(void); -static void PlayerPartnerHandleClearUnkFlag(void); -static void PlayerPartnerHandleToggleUnkFlag(void); -static void PlayerPartnerHandleHitAnimation(void); -static void PlayerPartnerHandleCantSwitch(void); -static void PlayerPartnerHandlePlaySE(void); -static void PlayerPartnerHandlePlayFanfareOrBGM(void); -static void PlayerPartnerHandleFaintingCry(void); -static void PlayerPartnerHandleIntroSlide(void); -static void PlayerPartnerHandleIntroTrainerBallThrow(void); -static void PlayerPartnerHandleDrawPartyStatusSummary(void); -static void PlayerPartnerHandleHidePartyStatusSummary(void); -static void PlayerPartnerHandleEndBounceEffect(void); -static void PlayerPartnerHandleSpriteInvisibility(void); -static void PlayerPartnerHandleBattleAnimation(void); -static void PlayerPartnerHandleLinkStandbyMsg(void); -static void PlayerPartnerHandleResetActionMoveSelection(void); -static void PlayerPartnerHandleEndLinkBattle(void); -static void PlayerPartnerHandleBattleDebug(void); -static void PlayerPartnerCmdEnd(void); - -static void PlayerPartnerBufferRunCommand(void); -static void PlayerPartnerBufferExecCompleted(void); -static void Task_LaunchLvlUpAnim(u8 taskId); -static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId); -static void Task_PrepareToGiveExpWithExpBar(u8 taskId); -static void Task_GiveExpWithExpBar(u8 taskId); -static void Task_UpdateLvlInHealthbox(u8 taskId); -static void SwitchIn_WaitAndEnd(void); -static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst); -static void SetPlayerPartnerMonData(u8 monId); -static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit); -static void DoSwitchOutAnimation(void); -static void PlayerPartnerDoMoveAnimation(void); -static void Task_StartSendOutAnim(u8 taskId); -static void EndDrawPartyStatusSummary(void); - -static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = -{ - [CONTROLLER_GETMONDATA] = PlayerPartnerHandleGetMonData, - [CONTROLLER_GETRAWMONDATA] = PlayerPartnerHandleGetRawMonData, - [CONTROLLER_SETMONDATA] = PlayerPartnerHandleSetMonData, - [CONTROLLER_SETRAWMONDATA] = PlayerPartnerHandleSetRawMonData, +static void PlayerPartnerHandleLoadMonSprite(u32 battler); +static void PlayerPartnerHandleSwitchInAnim(u32 battler); +static void PlayerPartnerHandleDrawTrainerPic(u32 battler); +static void PlayerPartnerHandleTrainerSlideBack(u32 battler); +static void PlayerPartnerHandleMoveAnimation(u32 battler); +static void PlayerPartnerHandlePrintString(u32 battler); +static void PlayerPartnerHandleChooseAction(u32 battler); +static void PlayerPartnerHandleChooseMove(u32 battler); +static void PlayerPartnerHandleChoosePokemon(u32 battler); +static void PlayerPartnerHandleHealthBarUpdate(u32 battler); +static void PlayerPartnerHandleIntroTrainerBallThrow(u32 battler); +static void PlayerPartnerHandleDrawPartyStatusSummary(u32 battler); +static void PlayerPartnerHandleBattleAnimation(u32 battler); +static void PlayerPartnerHandleEndLinkBattle(u32 battler); + +static void PlayerPartnerBufferRunCommand(u32 battler); +static void PlayerPartnerBufferExecCompleted(u32 battler); +static void SwitchIn_WaitAndEnd(u32 battler); + +static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(u32 battler) = +{ + [CONTROLLER_GETMONDATA] = BtlController_HandleGetMonData, + [CONTROLLER_GETRAWMONDATA] = BtlController_Empty, + [CONTROLLER_SETMONDATA] = BtlController_HandleSetMonData, + [CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData, [CONTROLLER_LOADMONSPRITE] = PlayerPartnerHandleLoadMonSprite, [CONTROLLER_SWITCHINANIM] = PlayerPartnerHandleSwitchInAnim, - [CONTROLLER_RETURNMONTOBALL] = PlayerPartnerHandleReturnMonToBall, + [CONTROLLER_RETURNMONTOBALL] = BtlController_HandleReturnMonToBall, [CONTROLLER_DRAWTRAINERPIC] = PlayerPartnerHandleDrawTrainerPic, - [CONTROLLER_TRAINERSLIDE] = PlayerPartnerHandleTrainerSlide, + [CONTROLLER_TRAINERSLIDE] = BtlController_Empty, [CONTROLLER_TRAINERSLIDEBACK] = PlayerPartnerHandleTrainerSlideBack, - [CONTROLLER_FAINTANIMATION] = PlayerPartnerHandleFaintAnimation, - [CONTROLLER_PALETTEFADE] = PlayerPartnerHandlePaletteFade, - [CONTROLLER_SUCCESSBALLTHROWANIM] = PlayerPartnerHandleSuccessBallThrowAnim, - [CONTROLLER_BALLTHROWANIM] = PlayerPartnerHandleBallThrowAnim, - [CONTROLLER_PAUSE] = PlayerPartnerHandlePause, + [CONTROLLER_FAINTANIMATION] = BtlController_HandleFaintAnimation, + [CONTROLLER_PALETTEFADE] = BtlController_Empty, + [CONTROLLER_SUCCESSBALLTHROWANIM] = BtlController_Empty, + [CONTROLLER_BALLTHROWANIM] = BtlController_Empty, + [CONTROLLER_PAUSE] = BtlController_Empty, [CONTROLLER_MOVEANIMATION] = PlayerPartnerHandleMoveAnimation, [CONTROLLER_PRINTSTRING] = PlayerPartnerHandlePrintString, - [CONTROLLER_PRINTSTRINGPLAYERONLY] = PlayerPartnerHandlePrintSelectionString, + [CONTROLLER_PRINTSTRINGPLAYERONLY] = BtlController_Empty, [CONTROLLER_CHOOSEACTION] = PlayerPartnerHandleChooseAction, - [CONTROLLER_YESNOBOX] = PlayerPartnerHandleYesNoBox, + [CONTROLLER_YESNOBOX] = BtlController_Empty, [CONTROLLER_CHOOSEMOVE] = PlayerPartnerHandleChooseMove, - [CONTROLLER_OPENBAG] = PlayerPartnerHandleChooseItem, + [CONTROLLER_OPENBAG] = BtlController_Empty, [CONTROLLER_CHOOSEPOKEMON] = PlayerPartnerHandleChoosePokemon, - [CONTROLLER_23] = PlayerPartnerHandleCmd23, + [CONTROLLER_23] = BtlController_Empty, [CONTROLLER_HEALTHBARUPDATE] = PlayerPartnerHandleHealthBarUpdate, - [CONTROLLER_EXPUPDATE] = PlayerPartnerHandleExpUpdate, - [CONTROLLER_STATUSICONUPDATE] = PlayerPartnerHandleStatusIconUpdate, - [CONTROLLER_STATUSANIMATION] = PlayerPartnerHandleStatusAnimation, - [CONTROLLER_STATUSXOR] = PlayerPartnerHandleStatusXor, - [CONTROLLER_DATATRANSFER] = PlayerPartnerHandleDataTransfer, - [CONTROLLER_DMA3TRANSFER] = PlayerPartnerHandleDMA3Transfer, - [CONTROLLER_PLAYBGM] = PlayerPartnerHandlePlayBGM, - [CONTROLLER_32] = PlayerPartnerHandleCmd32, - [CONTROLLER_TWORETURNVALUES] = PlayerPartnerHandleTwoReturnValues, - [CONTROLLER_CHOSENMONRETURNVALUE] = PlayerPartnerHandleChosenMonReturnValue, - [CONTROLLER_ONERETURNVALUE] = PlayerPartnerHandleOneReturnValue, - [CONTROLLER_ONERETURNVALUE_DUPLICATE] = PlayerPartnerHandleOneReturnValue_Duplicate, - [CONTROLLER_CLEARUNKVAR] = PlayerPartnerHandleClearUnkVar, - [CONTROLLER_SETUNKVAR] = PlayerPartnerHandleSetUnkVar, - [CONTROLLER_CLEARUNKFLAG] = PlayerPartnerHandleClearUnkFlag, - [CONTROLLER_TOGGLEUNKFLAG] = PlayerPartnerHandleToggleUnkFlag, - [CONTROLLER_HITANIMATION] = PlayerPartnerHandleHitAnimation, - [CONTROLLER_CANTSWITCH] = PlayerPartnerHandleCantSwitch, - [CONTROLLER_PLAYSE] = PlayerPartnerHandlePlaySE, - [CONTROLLER_PLAYFANFAREORBGM] = PlayerPartnerHandlePlayFanfareOrBGM, - [CONTROLLER_FAINTINGCRY] = PlayerPartnerHandleFaintingCry, - [CONTROLLER_INTROSLIDE] = PlayerPartnerHandleIntroSlide, + [CONTROLLER_EXPUPDATE] = PlayerHandleExpUpdate, // Partner's player gets experience the same way as the player. + [CONTROLLER_STATUSICONUPDATE] = BtlController_HandleStatusIconUpdate, + [CONTROLLER_STATUSANIMATION] = BtlController_HandleStatusAnimation, + [CONTROLLER_STATUSXOR] = BtlController_Empty, + [CONTROLLER_DATATRANSFER] = BtlController_Empty, + [CONTROLLER_DMA3TRANSFER] = BtlController_Empty, + [CONTROLLER_PLAYBGM] = BtlController_Empty, + [CONTROLLER_32] = BtlController_Empty, + [CONTROLLER_TWORETURNVALUES] = BtlController_Empty, + [CONTROLLER_CHOSENMONRETURNVALUE] = BtlController_Empty, + [CONTROLLER_ONERETURNVALUE] = BtlController_Empty, + [CONTROLLER_ONERETURNVALUE_DUPLICATE] = BtlController_Empty, + [CONTROLLER_CLEARUNKVAR] = BtlController_HandleClearUnkVar, + [CONTROLLER_SETUNKVAR] = BtlController_HandleSetUnkVar, + [CONTROLLER_CLEARUNKFLAG] = BtlController_HandleClearUnkFlag, + [CONTROLLER_TOGGLEUNKFLAG] = BtlController_HandleToggleUnkFlag, + [CONTROLLER_HITANIMATION] = BtlController_HandleHitAnimation, + [CONTROLLER_CANTSWITCH] = BtlController_Empty, + [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, + [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, + [CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry, + [CONTROLLER_INTROSLIDE] = BtlController_HandleIntroSlide, [CONTROLLER_INTROTRAINERBALLTHROW] = PlayerPartnerHandleIntroTrainerBallThrow, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = PlayerPartnerHandleDrawPartyStatusSummary, - [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = PlayerPartnerHandleHidePartyStatusSummary, - [CONTROLLER_ENDBOUNCE] = PlayerPartnerHandleEndBounceEffect, - [CONTROLLER_SPRITEINVISIBILITY] = PlayerPartnerHandleSpriteInvisibility, + [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = BtlController_HandleHidePartyStatusSummary, + [CONTROLLER_ENDBOUNCE] = BtlController_Empty, + [CONTROLLER_SPRITEINVISIBILITY] = BtlController_HandleSpriteInvisibility, [CONTROLLER_BATTLEANIMATION] = PlayerPartnerHandleBattleAnimation, - [CONTROLLER_LINKSTANDBYMSG] = PlayerPartnerHandleLinkStandbyMsg, - [CONTROLLER_RESETACTIONMOVESELECTION] = PlayerPartnerHandleResetActionMoveSelection, + [CONTROLLER_LINKSTANDBYMSG] = BtlController_Empty, + [CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty, [CONTROLLER_ENDLINKBATTLE] = PlayerPartnerHandleEndLinkBattle, - [CONTROLLER_DEBUGMENU] = PlayerPartnerHandleBattleDebug, - [CONTROLLER_TERMINATOR_NOP] = PlayerPartnerCmdEnd + [CONTROLLER_DEBUGMENU] = BtlController_Empty, + [CONTROLLER_TERMINATOR_NOP] = BtlController_TerminatorNop }; -// unknown unused data -static const u8 sUnused[] = -{ - 0x83, 0x4d, 0xf3, 0x5f, 0x6f, 0x4f, 0xeb, 0x3e, - 0x67, 0x2e, 0x10, 0x46, 0x8c, 0x3d, 0x28, 0x35, - 0xc5, 0x2c, 0x15, 0x7f, 0xb5, 0x56, 0x9d, 0x53, - 0x3b, 0x43, 0xda, 0x36, 0x79, 0x2a, 0x0e, 0x53, -}; - -static void PlayerPartnerDummy(void) -{ -} - -void SetControllerToPlayerPartner(void) +void SetControllerToPlayerPartner(u32 battler) { - gBattlerControllerFuncs[gActiveBattler] = PlayerPartnerBufferRunCommand; + gBattlerControllerEndFuncs[battler] = PlayerPartnerBufferExecCompleted; + gBattlerControllerFuncs[battler] = PlayerPartnerBufferRunCommand; } -static void PlayerPartnerBufferRunCommand(void) +static void PlayerPartnerBufferRunCommand(u32 battler) { - if (gBattleControllerExecFlags & gBitTable[gActiveBattler]) + if (gBattleControllerExecFlags & gBitTable[battler]) { - if (gBattleResources->bufferA[gActiveBattler][0] < ARRAY_COUNT(sPlayerPartnerBufferCommands)) - sPlayerPartnerBufferCommands[gBattleResources->bufferA[gActiveBattler][0]](); + if (gBattleResources->bufferA[battler][0] < ARRAY_COUNT(sPlayerPartnerBufferCommands)) + sPlayerPartnerBufferCommands[gBattleResources->bufferA[battler][0]](battler); else - PlayerPartnerBufferExecCompleted(); - } -} - -static void CompleteOnBattlerSpriteCallbackDummy(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - PlayerPartnerBufferExecCompleted(); -} - -static void FreeTrainerSpriteAfterSlide(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - { - BattleGfxSfxDummy3(MALE); - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - PlayerPartnerBufferExecCompleted(); + PlayerPartnerBufferExecCompleted(battler); } } -static void Intro_DelayAndEnd(void) +static void Intro_DelayAndEnd(u32 battler) { - if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay == (u8)-1) + if (--gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay == (u8)-1) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0; - PlayerPartnerBufferExecCompleted(); + gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay = 0; + BattleControllerComplete(battler); } } -static void Intro_WaitForHealthbox(void) +static void Intro_WaitForHealthbox(u32 battler) { bool32 finished = FALSE; if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy) finished = TRUE; } else { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy + && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(battler)]].callback == SpriteCallbackDummy) { finished = TRUE; } @@ -246,1061 +161,137 @@ static void Intro_WaitForHealthbox(void) if (finished) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; - gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; + gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay = 3; + gBattlerControllerFuncs[battler] = Intro_DelayAndEnd; } } -static void Intro_ShowHealthbox(void) +// Also used by the link partner. +void Controller_PlayerPartnerShowIntroHealthbox(u32 battler) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive - && gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && ++gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay != 1) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].ballAnimActive + && gSprites[gBattleControllerData[battler]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy + && ++gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay != 1) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0; + gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay = 0; if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); - UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); - StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(battler)]]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(battler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]], HEALTHBOX_ALL); + StartHealthboxSlideIn(BATTLE_PARTNER(battler)); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(battler)]); } - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); + DestroySprite(&gSprites[gBattleControllerData[battler]]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], &gPlayerParty[gBattlerPartyIndexes[battler]], HEALTHBOX_ALL); + StartHealthboxSlideIn(battler); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[battler]); gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; - gBattlerControllerFuncs[gActiveBattler] = Intro_WaitForHealthbox; - } -} - -static void WaitForMonAnimAfterLoad(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].animEnded && gSprites[gBattlerSpriteIds[gActiveBattler]].x2 == 0) - PlayerPartnerBufferExecCompleted(); -} - -static void CompleteOnHealthbarDone(void) -{ - s16 hpValue = MoveBattleBar(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0); - - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - - if (hpValue != -1) - { - UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], HP_CURRENT, hpValue, gBattleMons[gActiveBattler].maxHP); - } - else - { - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - PlayerPartnerBufferExecCompleted(); - } -} - -static void CompleteOnInactiveTextPrinter(void) -{ - if (!IsTextPrinterActive(B_WIN_MSG)) - PlayerPartnerBufferExecCompleted(); -} - -// the whole exp task is copied&pasted from player controller -#define tExpTask_monId data[0] -#define tExpTask_gainedExp data[1] -#define tExpTask_bank data[2] -#define tExpTask_frames data[10] - -static void Task_GiveExpToMon(u8 taskId) -{ - u32 monId = (u8)(gTasks[taskId].tExpTask_monId); - u8 battlerId = gTasks[taskId].tExpTask_bank; - s16 gainedExp = gTasks[taskId].tExpTask_gainedExp; - - if (IsDoubleBattle() == TRUE || monId != gBattlerPartyIndexes[battlerId]) // give exp without the expbar - { - struct Pokemon *mon = &gPlayerParty[monId]; - u16 species = GetMonData(mon, MON_DATA_SPECIES); - u8 level = GetMonData(mon, MON_DATA_LEVEL); - u32 currExp = GetMonData(mon, MON_DATA_EXP); - u32 nextLvlExp = gExperienceTables[gSpeciesInfo[species].growthRate][level + 1]; - - if (currExp + gainedExp >= nextLvlExp) - { - u8 savedActiveBank; - - SetMonData(mon, MON_DATA_EXP, &nextLvlExp); - CalculateMonStats(mon); - gainedExp -= nextLvlExp - currExp; - savedActiveBank = gActiveBattler; - gActiveBattler = battlerId; - BtlController_EmitTwoReturnValues(BUFFER_B, RET_VALUE_LEVELED_UP, gainedExp); - gActiveBattler = savedActiveBank; - - if (IsDoubleBattle() == TRUE - && ((u16)(monId) == gBattlerPartyIndexes[battlerId] || (u16)(monId) == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)])) - gTasks[taskId].func = Task_LaunchLvlUpAnim; - else - gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter; - } - else - { - currExp += gainedExp; - SetMonData(mon, MON_DATA_EXP, &currExp); - gBattlerControllerFuncs[battlerId] = CompleteOnInactiveTextPrinter; - DestroyTask(taskId); - } - } - else - { - gTasks[taskId].func = Task_PrepareToGiveExpWithExpBar; + gBattlerControllerFuncs[battler] = Intro_WaitForHealthbox; } } -static void Task_PrepareToGiveExpWithExpBar(u8 taskId) +static void WaitForMonAnimAfterLoad(u32 battler) { - u8 monIndex = gTasks[taskId].tExpTask_monId; - s32 gainedExp = gTasks[taskId].tExpTask_gainedExp; - u8 battlerId = gTasks[taskId].tExpTask_bank; - struct Pokemon *mon = &gPlayerParty[monIndex]; - u8 level = GetMonData(mon, MON_DATA_LEVEL); - u16 species = GetMonData(mon, MON_DATA_SPECIES); - u32 exp = GetMonData(mon, MON_DATA_EXP); - u32 currLvlExp = gExperienceTables[gSpeciesInfo[species].growthRate][level]; - u32 expToNextLvl; - - exp -= currLvlExp; - expToNextLvl = gExperienceTables[gSpeciesInfo[species].growthRate][level + 1] - currLvlExp; - SetBattleBarStruct(battlerId, gHealthboxSpriteIds[battlerId], expToNextLvl, exp, -gainedExp); - PlaySE(SE_EXP); - gTasks[taskId].func = Task_GiveExpWithExpBar; -} - -static void Task_GiveExpWithExpBar(u8 taskId) -{ - if (gTasks[taskId].tExpTask_frames < 13) - { - gTasks[taskId].tExpTask_frames++; - } - else - { - u8 monId = gTasks[taskId].tExpTask_monId; - s16 gainedExp = gTasks[taskId].tExpTask_gainedExp; - u8 battlerId = gTasks[taskId].tExpTask_bank; - s16 r4; - - r4 = MoveBattleBar(battlerId, gHealthboxSpriteIds[battlerId], EXP_BAR, 0); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[battlerId]); - if (r4 == -1) - { - u8 level; - s32 currExp; - u16 species; - s32 expOnNextLvl; - - m4aSongNumStop(SE_EXP); - level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); - currExp = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); - species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); - expOnNextLvl = gExperienceTables[gSpeciesInfo[species].growthRate][level + 1]; - - if (currExp + gainedExp >= expOnNextLvl) - { - u8 savedActiveBank; - - SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &expOnNextLvl); - CalculateMonStats(&gPlayerParty[monId]); - gainedExp -= expOnNextLvl - currExp; - savedActiveBank = gActiveBattler; - gActiveBattler = battlerId; - BtlController_EmitTwoReturnValues(BUFFER_B, RET_VALUE_LEVELED_UP, gainedExp); - gActiveBattler = savedActiveBank; - gTasks[taskId].func = Task_LaunchLvlUpAnim; - } - else - { - currExp += gainedExp; - SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &currExp); - gBattlerControllerFuncs[battlerId] = CompleteOnInactiveTextPrinter; - DestroyTask(taskId); - } - } - } -} - -static void Task_LaunchLvlUpAnim(u8 taskId) -{ - u8 battlerId = gTasks[taskId].tExpTask_bank; - u8 monIndex = gTasks[taskId].tExpTask_monId; - - if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]) - battlerId ^= BIT_FLANK; - - InitAndLaunchSpecialAnimation(battlerId, battlerId, battlerId, B_ANIM_LVL_UP); - gTasks[taskId].func = Task_UpdateLvlInHealthbox; -} - -static void Task_UpdateLvlInHealthbox(u8 taskId) -{ - u8 battlerId = gTasks[taskId].tExpTask_bank; - - if (!gBattleSpritesDataPtr->healthBoxesData[battlerId].specialAnimActive) - { - u8 monIndex = gTasks[taskId].tExpTask_monId; - - GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value - - if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]) - UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(battlerId)], &gPlayerParty[monIndex], HEALTHBOX_ALL); - else - UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId], &gPlayerParty[monIndex], HEALTHBOX_ALL); - - gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter; - } -} - -static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId) -{ - u8 monIndex; - u8 battlerId; - - monIndex = gTasks[taskId].tExpTask_monId; - GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value - battlerId = gTasks[taskId].tExpTask_bank; - gBattlerControllerFuncs[battlerId] = CompleteOnInactiveTextPrinter; - DestroyTask(taskId); -} - -static void FreeMonSpriteAfterFaintAnim(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].y + gSprites[gBattlerSpriteIds[gActiveBattler]].y2 > DISPLAY_HEIGHT) - { - u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - - BattleGfxSfxDummy2(species); - FreeOamMatrix(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.matrixNum); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - PlayerPartnerBufferExecCompleted(); - } -} - -static void FreeMonSpriteAfterSwitchOutAnim(void) -{ - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - PlayerPartnerBufferExecCompleted(); - } -} - -static void CompleteOnInactiveTextPrinter2(void) -{ - if (!IsTextPrinterActive(B_WIN_MSG)) - PlayerPartnerBufferExecCompleted(); -} - -static void DoHitAnimBlinkSpriteEffect(void) -{ - u8 spriteId = gBattlerSpriteIds[gActiveBattler]; - - if (gSprites[spriteId].data[1] == 32) - { - gSprites[spriteId].data[1] = 0; - gSprites[spriteId].invisible = FALSE; - gDoingBattleAnim = FALSE; - PlayerPartnerBufferExecCompleted(); - } - else - { - if ((gSprites[spriteId].data[1] % 4) == 0) - gSprites[spriteId].invisible ^= 1; - gSprites[spriteId].data[1]++; - } + if (gSprites[gBattlerSpriteIds[battler]].animEnded && gSprites[gBattlerSpriteIds[battler]].x2 == 0) + PlayerPartnerBufferExecCompleted(battler); } -static void SwitchIn_ShowSubstitute(void) +static void SwitchIn_ShowSubstitute(u32 battler) { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy) { - CopyBattleSpriteInvisibility(gActiveBattler); - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); + CopyBattleSpriteInvisibility(battler); + if (gBattleSpritesDataPtr->battlerData[battler].behindSubstitute) + InitAndLaunchSpecialAnimation(battler, battler, battler, B_ANIM_MON_TO_SUBSTITUTE); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_WaitAndEnd; + gBattlerControllerFuncs[battler] = SwitchIn_WaitAndEnd; } } -static void SwitchIn_WaitAndEnd(void) +static void SwitchIn_WaitAndEnd(u32 battler) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive - && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].specialAnimActive + && gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy) { - PlayerPartnerBufferExecCompleted(); + PlayerPartnerBufferExecCompleted(battler); } } -static void SwitchIn_ShowHealthbox(void) +static void SwitchIn_ShowHealthbox(u32 battler) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) + if (gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); CreateTask(Task_PlayerController_RestoreBgmAfterCry, 10); - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0); - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[battler]], battler); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[battler]], 0); + UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], &gPlayerParty[gBattlerPartyIndexes[battler]], HEALTHBOX_ALL); + StartHealthboxSlideIn(battler); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[battler]); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowSubstitute; + gBattlerControllerFuncs[battler] = SwitchIn_ShowSubstitute; } } -static void SwitchIn_TryShinyAnim(void) +static void SwitchIn_TryShinyAnim(u32 battler) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive) { - TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); + TryShinyAnimation(battler, &gPlayerParty[gBattlerPartyIndexes[battler]]); } - if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) + if (gSprites[gBattleControllerData[battler]].callback == SpriteCallbackDummy + && !gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive) { - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowHealthbox; + DestroySprite(&gSprites[gBattleControllerData[battler]]); + gBattlerControllerFuncs[battler] = SwitchIn_ShowHealthbox; } } -static void PlayerPartnerBufferExecCompleted(void) +static void PlayerPartnerBufferExecCompleted(u32 battler) { - gBattlerControllerFuncs[gActiveBattler] = PlayerPartnerBufferRunCommand; + gBattlerControllerFuncs[battler] = PlayerPartnerBufferRunCommand; if (gBattleTypeFlags & BATTLE_TYPE_LINK) { u8 playerId = GetMultiplayerId(); - PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleResources->bufferA[gActiveBattler][0] = CONTROLLER_TERMINATOR_NOP; - } - else - { - gBattleControllerExecFlags &= ~gBitTable[gActiveBattler]; - } -} - -static void CompleteOnFinishedStatusAnimation(void) -{ - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].statusAnimActive) - PlayerPartnerBufferExecCompleted(); -} - -static void CompleteOnFinishedBattleAnimation(void) -{ - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive) - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleGetMonData(void) -{ - u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data - u32 size = 0; - u8 monToCheck; - s32 i; - - if (gBattleResources->bufferA[gActiveBattler][2] == 0) - { - size += CopyPlayerPartnerMonData(gBattlerPartyIndexes[gActiveBattler], monData); - } - else - { - monToCheck = gBattleResources->bufferA[gActiveBattler][2]; - for (i = 0; i < PARTY_SIZE; i++) - { - if (monToCheck & 1) - size += CopyPlayerPartnerMonData(i, monData + size); - monToCheck >>= 1; - } - } - BtlController_EmitDataTransfer(BUFFER_B, size, monData); - PlayerPartnerBufferExecCompleted(); -} - -static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst) -{ - struct BattlePokemon battleMon; - struct MovePpInfo moveData; - u8 nickname[20]; - u8 *src; - s16 data16; - u32 data32; - s32 size = 0; - - switch (gBattleResources->bufferA[gActiveBattler][1]) - { - case REQUEST_ALL_BATTLE: - battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); - battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); - for (size = 0; size < MAX_MON_MOVES; size++) - { - battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); - battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); - } - battleMon.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); - battleMon.friendship = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); - battleMon.experience = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); - battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); - battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); - battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); - battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); - battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); - battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); - battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); - battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); - battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP); - battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); - battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); - battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); - battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); - battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); - battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); - battleMon.abilityNum = GetMonData(&gPlayerParty[monId], MON_DATA_ABILITY_NUM); - battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); - battleMon.metLevel = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL); - GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname); - StringCopy_Nickname(battleMon.nickname, nickname); - GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName); - src = (u8 *)&battleMon; - for (size = 0; size < sizeof(battleMon); size++) - dst[size] = src[size]; - break; - case REQUEST_SPECIES_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_HELDITEM_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_MOVES_PP_BATTLE: - for (size = 0; size < MAX_MON_MOVES; size++) - { - moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); - moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); - } - moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); - src = (u8 *)(&moveData); - for (size = 0; size < sizeof(moveData); size++) - dst[size] = src[size]; - break; - case REQUEST_MOVE1_BATTLE: - case REQUEST_MOVE2_BATTLE: - case REQUEST_MOVE3_BATTLE: - case REQUEST_MOVE4_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_PP_DATA_BATTLE: - for (size = 0; size < MAX_MON_MOVES; size++) - dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); - dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); - size++; - break; - case REQUEST_PPMOVE1_BATTLE: - case REQUEST_PPMOVE2_BATTLE: - case REQUEST_PPMOVE3_BATTLE: - case REQUEST_PPMOVE4_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE); - size = 1; - break; - case REQUEST_OTID_BATTLE: - data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - size = 3; - break; - case REQUEST_EXP_BATTLE: - data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - size = 3; - break; - case REQUEST_HP_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV); - size = 1; - break; - case REQUEST_ATK_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV); - size = 1; - break; - case REQUEST_DEF_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV); - size = 1; - break; - case REQUEST_SPEED_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV); - size = 1; - break; - case REQUEST_SPATK_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV); - size = 1; - break; - case REQUEST_SPDEF_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV); - size = 1; - break; - case REQUEST_FRIENDSHIP_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); - size = 1; - break; - case REQUEST_POKERUS_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS); - size = 1; - break; - case REQUEST_MET_LOCATION_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION); - size = 1; - break; - case REQUEST_MET_LEVEL_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL); - size = 1; - break; - case REQUEST_MET_GAME_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME); - size = 1; - break; - case REQUEST_POKEBALL_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL); - size = 1; - break; - case REQUEST_ALL_IVS_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); - dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); - dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); - dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); - dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); - size = 6; - break; - case REQUEST_HP_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); - size = 1; - break; - case REQUEST_ATK_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); - size = 1; - break; - case REQUEST_DEF_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - size = 1; - break; - case REQUEST_SPEED_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); - size = 1; - break; - case REQUEST_SPATK_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); - size = 1; - break; - case REQUEST_SPDEF_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); - size = 1; - break; - case REQUEST_PERSONALITY_BATTLE: - data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - dst[3] = (data32 & 0xFF000000) >> 24; - size = 4; - break; - case REQUEST_CHECKSUM_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_STATUS_BATTLE: - data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - dst[3] = (data32 & 0xFF000000) >> 24; - size = 4; - break; - case REQUEST_LEVEL_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); - size = 1; - break; - case REQUEST_HP_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_MAX_HP_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_ATK_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_DEF_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPEED_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPATK_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPDEF_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_COOL_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL); - size = 1; - break; - case REQUEST_BEAUTY_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY); - size = 1; - break; - case REQUEST_CUTE_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE); - size = 1; - break; - case REQUEST_SMART_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART); - size = 1; - break; - case REQUEST_TOUGH_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH); - size = 1; - break; - case REQUEST_SHEEN_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN); - size = 1; - break; - case REQUEST_COOL_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON); - size = 1; - break; - case REQUEST_BEAUTY_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON); - size = 1; - break; - case REQUEST_CUTE_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON); - size = 1; - break; - case REQUEST_SMART_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON); - size = 1; - break; - case REQUEST_TOUGH_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON); - size = 1; - break; - } - - return size; -} - -static void PlayerPartnerHandleGetRawMonData(void) -{ - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleSetMonData(void) -{ - u8 monToCheck; - u8 i; - - if (gBattleResources->bufferA[gActiveBattler][2] == 0) - { - SetPlayerPartnerMonData(gBattlerPartyIndexes[gActiveBattler]); + PrepareBufferDataTransferLink(battler, 2, 4, &playerId); + gBattleResources->bufferA[battler][0] = CONTROLLER_TERMINATOR_NOP; } else { - monToCheck = gBattleResources->bufferA[gActiveBattler][2]; - for (i = 0; i < PARTY_SIZE; i++) - { - if (monToCheck & 1) - SetPlayerPartnerMonData(i); - monToCheck >>= 1; - } + gBattleControllerExecFlags &= ~gBitTable[battler]; } - PlayerPartnerBufferExecCompleted(); } -static void SetPlayerPartnerMonData(u8 monId) +static void PlayerPartnerHandleLoadMonSprite(u32 battler) { - struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleResources->bufferA[gActiveBattler][3]; - struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleResources->bufferA[gActiveBattler][3]; - s32 i; - - switch (gBattleResources->bufferA[gActiveBattler][1]) - { - case REQUEST_ALL_BATTLE: - { - u8 iv; - - SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species); - SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); - for (i = 0; i < MAX_MON_MOVES; i++) - { - SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); - } - SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); - SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); - SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &battlePokemon->experience); - iv = battlePokemon->hpIV; - SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &iv); - iv = battlePokemon->attackIV; - SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &iv); - iv = battlePokemon->defenseIV; - SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv); - iv = battlePokemon->speedIV; - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &iv); - iv = battlePokemon->spAttackIV; - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv); - iv = battlePokemon->spDefenseIV; - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv); - SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); - SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1); - SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level); - SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp); - SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); - SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack); - SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense); - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &battlePokemon->speed); - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); - } - break; - case REQUEST_SPECIES_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HELDITEM_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MOVES_PP_BATTLE: - for (i = 0; i < MAX_MON_MOVES; i++) - { - SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); - } - SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); - break; - case REQUEST_MOVE1_BATTLE: - case REQUEST_MOVE2_BATTLE: - case REQUEST_MOVE3_BATTLE: - case REQUEST_MOVE4_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_PP_DATA_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleResources->bufferA[gActiveBattler][3]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleResources->bufferA[gActiveBattler][4]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleResources->bufferA[gActiveBattler][5]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleResources->bufferA[gActiveBattler][6]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleResources->bufferA[gActiveBattler][7]); - break; - case REQUEST_PPMOVE1_BATTLE: - case REQUEST_PPMOVE2_BATTLE: - case REQUEST_PPMOVE3_BATTLE: - case REQUEST_PPMOVE4_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_OTID_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_EXP_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HP_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_FRIENDSHIP_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_POKERUS_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_LOCATION_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_LEVEL_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_GAME_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_POKEBALL_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ALL_IVS_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]); - SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][4]); - SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][5]); - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][6]); - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][7]); - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][8]); - break; - case REQUEST_HP_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_PERSONALITY_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CHECKSUM_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_STATUS_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_LEVEL_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HP_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MAX_HP_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_COOL_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_BEAUTY_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CUTE_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SMART_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_TOUGH_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SHEEN_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_COOL_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_BEAUTY_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CUTE_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SMART_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_TOUGH_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - } - - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); + BtlController_HandleLoadMonSprite(battler, WaitForMonAnimAfterLoad); } -static void PlayerPartnerHandleSetRawMonData(void) +static void PlayerPartnerHandleSwitchInAnim(u32 battler) { - u8 *dst = (u8 *)&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleResources->bufferA[gActiveBattler][1]; - u8 i; - - for (i = 0; i < gBattleResources->bufferA[gActiveBattler][2]; i++) - dst[i] = gBattleResources->bufferA[gActiveBattler][3 + i]; - - PlayerPartnerBufferExecCompleted(); + BtlController_HandleSwitchInAnim(battler, TRUE, SwitchIn_TryShinyAnim); } -static void PlayerPartnerHandleLoadMonSprite(void) -{ - u16 species; - - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler)); - - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(gActiveBattler, BATTLER_COORD_X_2), - GetBattlerSpriteDefault_Y(gActiveBattler), - GetBattlerSpriteSubpriority(gActiveBattler)); - gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = -DISPLAY_WIDTH; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); - gBattlerControllerFuncs[gActiveBattler] = WaitForMonAnimAfterLoad; -} - -static void PlayerPartnerHandleSwitchInAnim(void) -{ - ClearTemporarySpeciesSpriteData(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); - gBattlerPartyIndexes[gActiveBattler] = gBattleResources->bufferA[gActiveBattler][1]; - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - StartSendOutAnim(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_TryShinyAnim; -} - -static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) -{ - u16 species; - - ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit); - gBattlerPartyIndexes[battlerId] = gBattleResources->bufferA[battlerId][1]; - species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); - gBattleControllerData[battlerId] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim); - SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId)); - - gBattlerSpriteIds[battlerId] = CreateSprite( - &gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2), - GetBattlerSpriteDefault_Y(battlerId), - GetBattlerSpriteSubpriority(battlerId)); - - gSprites[gBattleControllerData[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; - gSprites[gBattleControllerData[battlerId]].data[2] = battlerId; - - gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId; - gSprites[gBattlerSpriteIds[battlerId]].data[2] = species; - gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId; - - StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]); - - gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE; - gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy; - - gSprites[gBattleControllerData[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT); -} - -static void PlayerPartnerHandleReturnMonToBall(void) -{ - if (gBattleResources->bufferA[gActiveBattler][1] == 0) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation; - } - else - { - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - PlayerPartnerBufferExecCompleted(); - } -} - -static void DoSwitchOutAnimation(void) -{ - switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState) - { - case 0: - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON); - - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1; - break; - case 1: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON); - gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim; - } - break; - } -} - -#define sSpeedX data[0] - // some explanation here // in emerald it's possible to have a tag battle in the battle frontier facilities with AI // which use the front sprite for both the player and the partner as opposed to any other battles (including the one with Steven) that use the back pic as well as animate it -static void PlayerPartnerHandleDrawTrainerPic(void) +static void PlayerPartnerHandleDrawTrainerPic(u32 battler) { + bool32 isFrontPic; s16 xPos, yPos; u32 trainerPicId; @@ -1316,6 +307,12 @@ static void PlayerPartnerHandleDrawTrainerPic(void) xPos = 90; yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80; } + else if (IsAiVsAiBattle()) + { + trainerPicId = gTrainers[gPartnerTrainerId].trainerPic; + xPos = 60; + yPos = (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 80; + } else { trainerPicId = GetFrontierTrainerFrontSpriteId(gPartnerTrainerId); @@ -1323,645 +320,151 @@ static void PlayerPartnerHandleDrawTrainerPic(void) yPos = (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 80; } - // Use back pic only if the partner is Steven + // Use back pic only if the partner is Steven or a custom partner. if (gPartnerTrainerId == TRAINER_STEVEN_PARTNER || gPartnerTrainerId >= TRAINER_CUSTOM_PARTNER) - { - DecompressTrainerBackPic(trainerPicId, gActiveBattler); - SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, GetBattlerSpriteSubpriority(gActiveBattler)); - - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = DISPLAY_WIDTH; - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; - } - else // otherwise use front sprite - { - DecompressTrainerFrontPic(trainerPicId, gActiveBattler); - SetMultiuseSpriteTemplateToTrainerFront(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, GetBattlerSpriteSubpriority(gActiveBattler)); - - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); - gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = DISPLAY_WIDTH; - gSprites[gBattlerSpriteIds[gActiveBattler]].y2 = 48; - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineMode = ST_OAM_AFFINE_OFF; - gSprites[gBattlerSpriteIds[gActiveBattler]].hFlip = 1; - } + isFrontPic = FALSE; + else + isFrontPic = TRUE; - gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy; + BtlController_HandleDrawTrainerPic(battler, trainerPicId, isFrontPic, xPos, yPos, -1); } -#undef sSpeedX - -static void PlayerPartnerHandleTrainerSlide(void) +static void PlayerPartnerHandleTrainerSlideBack(u32 battler) { - PlayerPartnerBufferExecCompleted(); + BtlController_HandleTrainerSlideBack(battler, 35, FALSE); } -static void PlayerPartnerHandleTrainerSlideBack(void) +static void PlayerPartnerHandleMoveAnimation(u32 battler) { - SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].y; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); - gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; -} - -#define sSpeedX data[1] -#define sSpeedY data[2] - -static void PlayerPartnerHandleFaintAnimation(void) -{ - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState == 0) - { - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState++; - } - else - { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - PlaySE12WithPanning(SE_FAINT, SOUND_PAN_ATTACKER); - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 0; - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedY = 5; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintSlideAnim; - gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterFaintAnim; - } - } + BtlController_HandleMoveAnimation(battler, FALSE); } -#undef sSpeedX -#undef sSpeedY - -static void PlayerPartnerHandlePaletteFade(void) +static void PlayerPartnerHandlePrintString(u32 battler) { - PlayerPartnerBufferExecCompleted(); + BtlController_HandlePrintString(battler, FALSE, FALSE); } -static void PlayerPartnerHandleSuccessBallThrowAnim(void) +static void PlayerPartnerHandleChooseAction(u32 battler) { - PlayerPartnerBufferExecCompleted(); + AI_TrySwitchOrUseItem(battler); + PlayerPartnerBufferExecCompleted(battler); } -static void PlayerPartnerHandleBallThrowAnim(void) +static void PlayerPartnerHandleChooseMove(u32 battler) { - PlayerPartnerBufferExecCompleted(); -} + u8 chosenMoveId; + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]); -static void PlayerPartnerHandlePause(void) -{ - PlayerPartnerBufferExecCompleted(); -} + chosenMoveId = gBattleStruct->aiMoveOrAction[battler]; + gBattlerTarget = gBattleStruct->aiChosenTarget[battler]; -static void PlayerPartnerHandleMoveAnimation(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) + if (chosenMoveId == AI_CHOICE_SWITCH) { - u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); - - gAnimMoveTurn = gBattleResources->bufferA[gActiveBattler][3]; - gAnimMovePower = gBattleResources->bufferA[gActiveBattler][4] | (gBattleResources->bufferA[gActiveBattler][5] << 8); - gAnimMoveDmg = gBattleResources->bufferA[gActiveBattler][6] | (gBattleResources->bufferA[gActiveBattler][7] << 8) | (gBattleResources->bufferA[gActiveBattler][8] << 16) | (gBattleResources->bufferA[gActiveBattler][9] << 24); - gAnimFriendship = gBattleResources->bufferA[gActiveBattler][10]; - gWeatherMoveAnim = gBattleResources->bufferA[gActiveBattler][12] | (gBattleResources->bufferA[gActiveBattler][13] << 8); - gAnimDisableStructPtr = (struct DisableStruct *)&gBattleResources->bufferA[gActiveBattler][16]; - gTransformedPersonalities[gActiveBattler] = gAnimDisableStructPtr->transformedMonPersonality; - gTransformedOtIds[gActiveBattler] = gAnimDisableStructPtr->transformedMonOtId; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerControllerFuncs[gActiveBattler] = PlayerPartnerDoMoveAnimation; + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, 0xFFFF); } -} - -static void PlayerPartnerDoMoveAnimation(void) -{ - u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); - u8 multihit = gBattleResources->bufferA[gActiveBattler][11]; - - switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState) + else { - case 0: - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute - && !gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8) + if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & (MOVE_TARGET_USER | MOVE_TARGET_USER_OR_SELECTED)) + gBattlerTarget = battler; + if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & MOVE_TARGET_BOTH) { - gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 1; - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON); + gBattlerTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + if (gAbsentBattlerFlags & gBitTable[gBattlerTarget]) + gBattlerTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1; - break; - case 1: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF); - DoMoveAnim(move); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2; - } - break; - case 2: - gAnimScriptCallback(); - if (!gAnimScriptActive) - { - SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL); - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2) - { - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 0; - } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 3; - } - break; - case 3: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - CopyAllBattleSpritesInvisibilities(); - TrySetBehindSubstituteSpriteBit(gActiveBattler, gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - PlayerPartnerBufferExecCompleted(); - } - break; - } -} - -static void PlayerPartnerHandlePrintString(void) -{ - u16 *stringId; - - gBattle_BG0_X = 0; - gBattle_BG0_Y = 0; - stringId = (u16 *)(&gBattleResources->bufferA[gActiveBattler][2]); - BufferStringBattle(*stringId); - BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG); - gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter2; -} -static void PlayerPartnerHandlePrintSelectionString(void) -{ - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleChooseAction(void) -{ - AI_TrySwitchOrUseItem(); - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleYesNoBox(void) -{ - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleChooseMove(void) -{ - u8 chosenMoveId; - struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[gActiveBattler][4]); + if (ShouldUseZMove(battler, gBattlerTarget, moveInfo->moves[chosenMoveId])) + QueueZMove(battler, moveInfo->moves[chosenMoveId]); - chosenMoveId = gBattleStruct->aiMoveOrAction[gActiveBattler]; - gBattlerTarget = gBattleStruct->aiChosenTarget[gActiveBattler]; - - if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & (MOVE_TARGET_USER | MOVE_TARGET_USER_OR_SELECTED)) - gBattlerTarget = gActiveBattler; - if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & MOVE_TARGET_BOTH) - { - gBattlerTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); - if (gAbsentBattlerFlags & gBitTable[gBattlerTarget]) - gBattlerTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); + // If partner can mega evolve, do it. + if (CanMegaEvolve(battler)) + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (RET_MEGA_EVOLUTION) | (gBattlerTarget << 8)); + else if (CanUltraBurst(battler)) + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (RET_ULTRA_BURST) | (gBattlerTarget << 8)); + else + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (gBattlerTarget << 8)); } - if (ShouldUseZMove(gActiveBattler, gBattlerTarget, moveInfo->moves[chosenMoveId])) - QueueZMove(gActiveBattler, moveInfo->moves[chosenMoveId]); - - // If partner can mega evolve, do it. - if (CanMegaEvolve(gActiveBattler)) - BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (RET_MEGA_EVOLUTION) | (gBattlerTarget << 8)); - else - BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (gBattlerTarget << 8)); - - PlayerPartnerBufferExecCompleted(); + PlayerPartnerBufferExecCompleted(battler); } -static void PlayerPartnerHandleChooseItem(void) -{ - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleChoosePokemon(void) +static void PlayerPartnerHandleChoosePokemon(u32 battler) { s32 chosenMonId; // Choosing Revival Blessing target - if ((gBattleResources->bufferA[gActiveBattler][1] & 0xF) == PARTY_ACTION_CHOOSE_FAINTED_MON) + if ((gBattleResources->bufferA[battler][1] & 0xF) == PARTY_ACTION_CHOOSE_FAINTED_MON) { - chosenMonId = gSelectedMonPartyId = GetFirstFaintedPartyIndex(gActiveBattler); + chosenMonId = gSelectedMonPartyId = GetFirstFaintedPartyIndex(battler); } // Switching out - else + else if (gBattleStruct->monToSwitchIntoId[battler] >= PARTY_SIZE || !IsValidForBattle(&gPlayerParty[gBattleStruct->monToSwitchIntoId[battler]])) { - chosenMonId = GetMostSuitableMonToSwitchInto(); - if (chosenMonId == PARTY_SIZE) // just switch to the next mon + chosenMonId = GetMostSuitableMonToSwitchInto(battler); + + if (chosenMonId == PARTY_SIZE || !IsValidForBattle(&gPlayerParty[chosenMonId])) // just switch to the next mon { - u8 playerMonIdentity = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); - u8 selfIdentity = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); + s32 firstId = (IsAiVsAiBattle()) ? 0 : (PARTY_SIZE / 2); + u32 battler1 = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + u32 battler2 = IsDoubleBattle() ? GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT) : battler1; - for (chosenMonId = PARTY_SIZE / 2; chosenMonId < PARTY_SIZE; chosenMonId++) + for (chosenMonId = firstId; chosenMonId < PARTY_SIZE; chosenMonId++) { if (GetMonData(&gPlayerParty[chosenMonId], MON_DATA_HP) != 0 - && chosenMonId != gBattlerPartyIndexes[playerMonIdentity] - && chosenMonId != gBattlerPartyIndexes[selfIdentity]) + && chosenMonId != gBattlerPartyIndexes[battler1] + && chosenMonId != gBattlerPartyIndexes[battler2]) { break; } } } - *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = chosenMonId; - } - BtlController_EmitChosenMonReturnValue(BUFFER_B, chosenMonId, NULL); - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleCmd23(void) -{ - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleHealthBarUpdate(void) -{ - s16 hpVal; - - LoadBattleBarGfx(0); - hpVal = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); - - if (hpVal != INSTANT_HP_BAR_DROP) - { - u32 maxHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); - u32 curHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_HP); - - SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, curHP, hpVal); - } - else - { - u32 maxHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); - - SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, 0, hpVal); - } - - gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthbarDone; -} - -static void PlayerPartnerHandleExpUpdate(void) -{ - u8 monId = gBattleResources->bufferA[gActiveBattler][1]; - - if (GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL) >= MAX_LEVEL) - { - PlayerPartnerBufferExecCompleted(); - } - else - { - s16 expPointsToGive; - u8 taskId; - - LoadBattleBarGfx(1); - GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); // unused return value - expPointsToGive = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); - taskId = CreateTask(Task_GiveExpToMon, 10); - gTasks[taskId].tExpTask_monId = monId; - gTasks[taskId].tExpTask_gainedExp = expPointsToGive; - gTasks[taskId].tExpTask_bank = gActiveBattler; - gBattlerControllerFuncs[gActiveBattler] = BattleControllerDummy; - } -} - -#undef tExpTask_monId -#undef tExpTask_gainedExp -#undef tExpTask_bank -#undef tExpTask_frames - -static void PlayerPartnerHandleStatusIconUpdate(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) - { - u8 battlerId; - - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON); - battlerId = gActiveBattler; - gBattleSpritesDataPtr->healthBoxesData[battlerId].statusAnimActive = 0; - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; - } -} - -static void PlayerPartnerHandleStatusAnimation(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) - { - InitAndLaunchChosenStatusAnimation(gBattleResources->bufferA[gActiveBattler][1], - gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8) | (gBattleResources->bufferA[gActiveBattler][4] << 16) | (gBattleResources->bufferA[gActiveBattler][5] << 24)); - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; - } -} - -static void PlayerPartnerHandleStatusXor(void) -{ - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleDataTransfer(void) -{ - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleDMA3Transfer(void) -{ - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandlePlayBGM(void) -{ - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleCmd32(void) -{ - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleTwoReturnValues(void) -{ - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleChosenMonReturnValue(void) -{ - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleOneReturnValue(void) -{ - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleOneReturnValue_Duplicate(void) -{ - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleClearUnkVar(void) -{ - gUnusedControllerStruct.unk = 0; - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleSetUnkVar(void) -{ - gUnusedControllerStruct.unk = gBattleResources->bufferA[gActiveBattler][1]; - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleClearUnkFlag(void) -{ - gUnusedControllerStruct.flag = 0; - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleToggleUnkFlag(void) -{ - gUnusedControllerStruct.flag ^= 1; - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleHitAnimation(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE) - { - PlayerPartnerBufferExecCompleted(); - } - else - { - gDoingBattleAnim = TRUE; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; - DoHitAnimHealthboxEffect(gActiveBattler); - gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; - } -} - -static void PlayerPartnerHandleCantSwitch(void) -{ - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandlePlaySE(void) -{ - s8 pan; - - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - pan = SOUND_PAN_ATTACKER; - else - pan = SOUND_PAN_TARGET; - - PlaySE12WithPanning(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8), pan); - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandlePlayFanfareOrBGM(void) -{ - if (gBattleResources->bufferA[gActiveBattler][3]) - { - BattleStopLowHpSound(); - PlayBGM(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); + *(gBattleStruct->monToSwitchIntoId + battler) = chosenMonId; } - else + else // Mon to switch out has been already chosen. { - PlayFanfare(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); + chosenMonId = gBattleStruct->monToSwitchIntoId[battler]; + gBattleStruct->AI_monToSwitchIntoId[battler] = PARTY_SIZE; + gBattleStruct->monToSwitchIntoId[battler] = chosenMonId; } - - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleFaintingCry(void) -{ - u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - - PlayCry_ByMode(species, -25, CRY_MODE_FAINT); - PlayerPartnerBufferExecCompleted(); + BtlController_EmitChosenMonReturnValue(battler, BUFFER_B, chosenMonId, NULL); + PlayerPartnerBufferExecCompleted(battler); } -static void PlayerPartnerHandleIntroSlide(void) +static void PlayerPartnerHandleHealthBarUpdate(u32 battler) { - HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]); - gIntroSlideFlags |= 1; - PlayerPartnerBufferExecCompleted(); + BtlController_HandleHealthBarUpdate(battler, FALSE); } -static void PlayerPartnerHandleIntroTrainerBallThrow(void) +static void PlayerPartnerHandleIntroTrainerBallThrow(u32 battler) { - u8 paletteNum; - u8 taskId; - - SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 50; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].y; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[5] = gActiveBattler; + const u32 *trainerPal; - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCB_FreePlayerSpriteLoadMonSprite); - StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1); - - paletteNum = AllocSpritePalette(0xD6F9); if (gPartnerTrainerId == TRAINER_STEVEN_PARTNER) - { - u8 spriteId = TRAINER_BACK_PIC_STEVEN; - LoadCompressedPalette(gTrainerBackPicPaletteTable[spriteId].data, OBJ_PLTT_ID(paletteNum), PLTT_SIZE_4BPP); - } - else if (gPartnerTrainerId >= TRAINER_CUSTOM_PARTNER) - { - u8 spriteId = gPartnerSpriteId; - LoadCompressedPalette(gTrainerBackPicPaletteTable[spriteId].data, 0x100 + paletteNum * 16, 32); - } + trainerPal = gTrainerBackPicPaletteTable[TRAINER_STEVEN_PARTNER].data; + else if (gPartnerTrainerId >= TRAINER_CUSTOM_PARTNER) // Custom multi battle. + trainerPal = gTrainerBackPicPaletteTable[gPartnerSpriteId].data; + else if (IsAiVsAiBattle()) + trainerPal = gTrainerFrontPicPaletteTable[gTrainers[gPartnerTrainerId].trainerPic].data; else - { - u8 spriteId = GetFrontierTrainerFrontSpriteId(gPartnerTrainerId); - LoadCompressedPalette(gTrainerFrontPicPaletteTable[spriteId].data, OBJ_PLTT_ID(paletteNum), PLTT_SIZE_4BPP); - } - - - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum; + trainerPal = gTrainerFrontPicPaletteTable[GetFrontierTrainerFrontSpriteId(gPartnerTrainerId)].data; // 2 vs 2 multi battle in Battle Frontier, load front sprite and pal. - taskId = CreateTask(Task_StartSendOutAnim, 5); - gTasks[taskId].data[0] = gActiveBattler; - - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) - gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - - gBattleSpritesDataPtr->animationData->introAnimActive = TRUE; - gBattlerControllerFuncs[gActiveBattler] = PlayerPartnerDummy; -} - -static void Task_StartSendOutAnim(u8 taskId) -{ - if (gTasks[taskId].data[1] < 24) - { - gTasks[taskId].data[1]++; - } - else - { - u8 savedActiveBank = gActiveBattler; - - gActiveBattler = gTasks[taskId].data[0]; - if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) - { - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - StartSendOutAnim(gActiveBattler, FALSE); - } - else - { - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - StartSendOutAnim(gActiveBattler, FALSE); - gActiveBattler ^= BIT_FLANK; - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - StartSendOutAnim(gActiveBattler, FALSE); - gActiveBattler ^= BIT_FLANK; - } - gBattlerControllerFuncs[gActiveBattler] = Intro_ShowHealthbox; - gActiveBattler = savedActiveBank; - DestroyTask(taskId); - } -} - -static void PlayerPartnerHandleDrawPartyStatusSummary(void) -{ - if (gBattleResources->bufferA[gActiveBattler][1] != 0 && GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - { - PlayerPartnerBufferExecCompleted(); - } - else - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1; - gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleResources->bufferA[gActiveBattler][4], gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2]); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; - - if (gBattleResources->bufferA[gActiveBattler][2] != 0) - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 93; - - gBattlerControllerFuncs[gActiveBattler] = EndDrawPartyStatusSummary; - } + BtlController_HandleIntroTrainerBallThrow(battler, 0xD6F9, trainerPal, 24, Controller_PlayerPartnerShowIntroHealthbox); } -static void EndDrawPartyStatusSummary(void) +static void PlayerPartnerHandleDrawPartyStatusSummary(u32 battler) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer++ > 92) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; - PlayerPartnerBufferExecCompleted(); - } + BtlController_HandleDrawPartyStatusSummary(battler, B_SIDE_PLAYER, TRUE); } -static void PlayerPartnerHandleHidePartyStatusSummary(void) +static void PlayerPartnerHandleBattleAnimation(u32 battler) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) - gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - PlayerPartnerBufferExecCompleted(); + BtlController_HandleBattleAnimation(battler, FALSE, FALSE); } -static void PlayerPartnerHandleEndBounceEffect(void) +static void PlayerPartnerHandleEndLinkBattle(u32 battler) { - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleSpriteInvisibility(void) -{ - if (IsBattlerSpritePresent(gActiveBattler)) - { - gSprites[gBattlerSpriteIds[gActiveBattler]].invisible = gBattleResources->bufferA[gActiveBattler][1]; - CopyBattleSpriteInvisibility(gActiveBattler); - } - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleBattleAnimation(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) - { - u8 animationId = gBattleResources->bufferA[gActiveBattler][1]; - u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); - - if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument)) - PlayerPartnerBufferExecCompleted(); - else - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; - } -} - -static void PlayerPartnerHandleLinkStandbyMsg(void) -{ - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleResetActionMoveSelection(void) -{ - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleEndLinkBattle(void) -{ - gBattleOutcome = gBattleResources->bufferA[gActiveBattler][1]; + gBattleOutcome = gBattleResources->bufferA[battler][1]; FadeOutMapMusic(5); BeginFastPaletteFade(3); - PlayerPartnerBufferExecCompleted(); - gBattlerControllerFuncs[gActiveBattler] = SetBattleEndCallbacks; -} - -static void PlayerPartnerHandleBattleDebug(void) -{ - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerCmdEnd(void) -{ + PlayerPartnerBufferExecCompleted(battler); + gBattlerControllerFuncs[battler] = SetBattleEndCallbacks; } diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index d1c60343acd8..2443b56f7445 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -32,273 +32,214 @@ #include "constants/songs.h" #include "constants/trainers.h" -static void RecordedOpponentHandleGetMonData(void); -static void RecordedOpponentHandleGetRawMonData(void); -static void RecordedOpponentHandleSetMonData(void); -static void RecordedOpponentHandleSetRawMonData(void); -static void RecordedOpponentHandleLoadMonSprite(void); -static void RecordedOpponentHandleSwitchInAnim(void); -static void RecordedOpponentHandleReturnMonToBall(void); -static void RecordedOpponentHandleDrawTrainerPic(void); -static void RecordedOpponentHandleTrainerSlide(void); -static void RecordedOpponentHandleTrainerSlideBack(void); -static void RecordedOpponentHandleFaintAnimation(void); -static void RecordedOpponentHandlePaletteFade(void); -static void RecordedOpponentHandleSuccessBallThrowAnim(void); -static void RecordedOpponentHandleBallThrowAnim(void); -static void RecordedOpponentHandlePause(void); -static void RecordedOpponentHandleMoveAnimation(void); -static void RecordedOpponentHandlePrintString(void); -static void RecordedOpponentHandlePrintSelectionString(void); -static void RecordedOpponentHandleChooseAction(void); -static void RecordedOpponentHandleYesNoBox(void); -static void RecordedOpponentHandleChooseMove(void); -static void RecordedOpponentHandleChooseItem(void); -static void RecordedOpponentHandleChoosePokemon(void); -static void RecordedOpponentHandleCmd23(void); -static void RecordedOpponentHandleHealthBarUpdate(void); -static void RecordedOpponentHandleExpUpdate(void); -static void RecordedOpponentHandleStatusIconUpdate(void); -static void RecordedOpponentHandleStatusAnimation(void); -static void RecordedOpponentHandleStatusXor(void); -static void RecordedOpponentHandleDataTransfer(void); -static void RecordedOpponentHandleDMA3Transfer(void); -static void RecordedOpponentHandlePlayBGM(void); -static void RecordedOpponentHandleCmd32(void); -static void RecordedOpponentHandleTwoReturnValues(void); -static void RecordedOpponentHandleChosenMonReturnValue(void); -static void RecordedOpponentHandleOneReturnValue(void); -static void RecordedOpponentHandleOneReturnValue_Duplicate(void); -static void RecordedOpponentHandleClearUnkVar(void); -static void RecordedOpponentHandleSetUnkVar(void); -static void RecordedOpponentHandleClearUnkFlag(void); -static void RecordedOpponentHandleToggleUnkFlag(void); -static void RecordedOpponentHandleHitAnimation(void); -static void RecordedOpponentHandleCantSwitch(void); -static void RecordedOpponentHandlePlaySE(void); -static void RecordedOpponentHandlePlayFanfareOrBGM(void); -static void RecordedOpponentHandleFaintingCry(void); -static void RecordedOpponentHandleIntroSlide(void); -static void RecordedOpponentHandleIntroTrainerBallThrow(void); -static void RecordedOpponentHandleDrawPartyStatusSummary(void); -static void RecordedOpponentHandleHidePartyStatusSummary(void); -static void RecordedOpponentHandleEndBounceEffect(void); -static void RecordedOpponentHandleSpriteInvisibility(void); -static void RecordedOpponentHandleBattleAnimation(void); -static void RecordedOpponentHandleLinkStandbyMsg(void); -static void RecordedOpponentHandleResetActionMoveSelection(void); -static void RecordedOpponentHandleEndLinkBattle(void); -static void RecordedOpponentHandleBattleDebug(void); -static void RecordedOpponentCmdEnd(void); - -static void RecordedOpponentBufferRunCommand(void); -static void RecordedOpponentBufferExecCompleted(void); -static void SwitchIn_HandleSoundAndEnd(void); -static u32 CopyRecordedOpponentMonData(u8 monId, u8 *dst); -static void SetRecordedOpponentMonData(u8 monId); -static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit); -static void DoSwitchOutAnimation(void); -static void RecordedOpponentDoMoveAnimation(void); -static void Task_StartSendOutAnim(u8 taskId); -static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite); -static void EndDrawPartyStatusSummary(void); - -static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = -{ - [CONTROLLER_GETMONDATA] = RecordedOpponentHandleGetMonData, - [CONTROLLER_GETRAWMONDATA] = RecordedOpponentHandleGetRawMonData, - [CONTROLLER_SETMONDATA] = RecordedOpponentHandleSetMonData, - [CONTROLLER_SETRAWMONDATA] = RecordedOpponentHandleSetRawMonData, +static void RecordedOpponentHandleLoadMonSprite(u32 battler); +static void RecordedOpponentHandleSwitchInAnim(u32 battler); +static void RecordedOpponentHandleDrawTrainerPic(u32 battler); +static void RecordedOpponentHandleTrainerSlideBack(u32 battler); +static void RecordedOpponentHandleMoveAnimation(u32 battler); +static void RecordedOpponentHandlePrintString(u32 battler); +static void RecordedOpponentHandleChooseAction(u32 battler); +static void RecordedOpponentHandleChooseMove(u32 battler); +static void RecordedOpponentHandleChooseItem(u32 battler); +static void RecordedOpponentHandleChoosePokemon(u32 battler); +static void RecordedOpponentHandleHealthBarUpdate(u32 battler); +static void RecordedOpponentHandleStatusIconUpdate(u32 battler); +static void RecordedOpponentHandleStatusAnimation(u32 battler); +static void RecordedOpponentHandleIntroTrainerBallThrow(u32 battler); +static void RecordedOpponentHandleDrawPartyStatusSummary(u32 battler); +static void RecordedOpponentHandleBattleAnimation(u32 battler); +static void RecordedOpponentHandleEndLinkBattle(u32 battler); + +static void RecordedOpponentBufferRunCommand(u32 battler); +static void RecordedOpponentBufferExecCompleted(u32 battler); +static void SwitchIn_HandleSoundAndEnd(u32 battler); + +static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(u32 battler) = +{ + [CONTROLLER_GETMONDATA] = BtlController_HandleGetMonData, + [CONTROLLER_GETRAWMONDATA] = BtlController_Empty, + [CONTROLLER_SETMONDATA] = BtlController_HandleSetMonData, + [CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData, [CONTROLLER_LOADMONSPRITE] = RecordedOpponentHandleLoadMonSprite, [CONTROLLER_SWITCHINANIM] = RecordedOpponentHandleSwitchInAnim, - [CONTROLLER_RETURNMONTOBALL] = RecordedOpponentHandleReturnMonToBall, + [CONTROLLER_RETURNMONTOBALL] = BtlController_HandleReturnMonToBall, [CONTROLLER_DRAWTRAINERPIC] = RecordedOpponentHandleDrawTrainerPic, - [CONTROLLER_TRAINERSLIDE] = RecordedOpponentHandleTrainerSlide, + [CONTROLLER_TRAINERSLIDE] = BtlController_Empty, [CONTROLLER_TRAINERSLIDEBACK] = RecordedOpponentHandleTrainerSlideBack, - [CONTROLLER_FAINTANIMATION] = RecordedOpponentHandleFaintAnimation, - [CONTROLLER_PALETTEFADE] = RecordedOpponentHandlePaletteFade, - [CONTROLLER_SUCCESSBALLTHROWANIM] = RecordedOpponentHandleSuccessBallThrowAnim, - [CONTROLLER_BALLTHROWANIM] = RecordedOpponentHandleBallThrowAnim, - [CONTROLLER_PAUSE] = RecordedOpponentHandlePause, + [CONTROLLER_FAINTANIMATION] = BtlController_HandleFaintAnimation, + [CONTROLLER_PALETTEFADE] = BtlController_Empty, + [CONTROLLER_SUCCESSBALLTHROWANIM] = BtlController_Empty, + [CONTROLLER_BALLTHROWANIM] = BtlController_Empty, + [CONTROLLER_PAUSE] = BtlController_Empty, [CONTROLLER_MOVEANIMATION] = RecordedOpponentHandleMoveAnimation, [CONTROLLER_PRINTSTRING] = RecordedOpponentHandlePrintString, - [CONTROLLER_PRINTSTRINGPLAYERONLY] = RecordedOpponentHandlePrintSelectionString, + [CONTROLLER_PRINTSTRINGPLAYERONLY] = BtlController_Empty, [CONTROLLER_CHOOSEACTION] = RecordedOpponentHandleChooseAction, - [CONTROLLER_YESNOBOX] = RecordedOpponentHandleYesNoBox, + [CONTROLLER_YESNOBOX] = BtlController_Empty, [CONTROLLER_CHOOSEMOVE] = RecordedOpponentHandleChooseMove, [CONTROLLER_OPENBAG] = RecordedOpponentHandleChooseItem, [CONTROLLER_CHOOSEPOKEMON] = RecordedOpponentHandleChoosePokemon, - [CONTROLLER_23] = RecordedOpponentHandleCmd23, + [CONTROLLER_23] = BtlController_Empty, [CONTROLLER_HEALTHBARUPDATE] = RecordedOpponentHandleHealthBarUpdate, - [CONTROLLER_EXPUPDATE] = RecordedOpponentHandleExpUpdate, + [CONTROLLER_EXPUPDATE] = BtlController_Empty, [CONTROLLER_STATUSICONUPDATE] = RecordedOpponentHandleStatusIconUpdate, [CONTROLLER_STATUSANIMATION] = RecordedOpponentHandleStatusAnimation, - [CONTROLLER_STATUSXOR] = RecordedOpponentHandleStatusXor, - [CONTROLLER_DATATRANSFER] = RecordedOpponentHandleDataTransfer, - [CONTROLLER_DMA3TRANSFER] = RecordedOpponentHandleDMA3Transfer, - [CONTROLLER_PLAYBGM] = RecordedOpponentHandlePlayBGM, - [CONTROLLER_32] = RecordedOpponentHandleCmd32, - [CONTROLLER_TWORETURNVALUES] = RecordedOpponentHandleTwoReturnValues, - [CONTROLLER_CHOSENMONRETURNVALUE] = RecordedOpponentHandleChosenMonReturnValue, - [CONTROLLER_ONERETURNVALUE] = RecordedOpponentHandleOneReturnValue, - [CONTROLLER_ONERETURNVALUE_DUPLICATE] = RecordedOpponentHandleOneReturnValue_Duplicate, - [CONTROLLER_CLEARUNKVAR] = RecordedOpponentHandleClearUnkVar, - [CONTROLLER_SETUNKVAR] = RecordedOpponentHandleSetUnkVar, - [CONTROLLER_CLEARUNKFLAG] = RecordedOpponentHandleClearUnkFlag, - [CONTROLLER_TOGGLEUNKFLAG] = RecordedOpponentHandleToggleUnkFlag, - [CONTROLLER_HITANIMATION] = RecordedOpponentHandleHitAnimation, - [CONTROLLER_CANTSWITCH] = RecordedOpponentHandleCantSwitch, - [CONTROLLER_PLAYSE] = RecordedOpponentHandlePlaySE, - [CONTROLLER_PLAYFANFAREORBGM] = RecordedOpponentHandlePlayFanfareOrBGM, - [CONTROLLER_FAINTINGCRY] = RecordedOpponentHandleFaintingCry, - [CONTROLLER_INTROSLIDE] = RecordedOpponentHandleIntroSlide, + [CONTROLLER_STATUSXOR] = BtlController_Empty, + [CONTROLLER_DATATRANSFER] = BtlController_Empty, + [CONTROLLER_DMA3TRANSFER] = BtlController_Empty, + [CONTROLLER_PLAYBGM] = BtlController_Empty, + [CONTROLLER_32] = BtlController_Empty, + [CONTROLLER_TWORETURNVALUES] = BtlController_Empty, + [CONTROLLER_CHOSENMONRETURNVALUE] = BtlController_Empty, + [CONTROLLER_ONERETURNVALUE] = BtlController_Empty, + [CONTROLLER_ONERETURNVALUE_DUPLICATE] = BtlController_Empty, + [CONTROLLER_CLEARUNKVAR] = BtlController_HandleClearUnkVar, + [CONTROLLER_SETUNKVAR] = BtlController_HandleSetUnkVar, + [CONTROLLER_CLEARUNKFLAG] = BtlController_HandleClearUnkFlag, + [CONTROLLER_TOGGLEUNKFLAG] = BtlController_HandleToggleUnkFlag, + [CONTROLLER_HITANIMATION] = BtlController_HandleHitAnimation, + [CONTROLLER_CANTSWITCH] = BtlController_Empty, + [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, + [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, + [CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry, + [CONTROLLER_INTROSLIDE] = BtlController_HandleIntroSlide, [CONTROLLER_INTROTRAINERBALLTHROW] = RecordedOpponentHandleIntroTrainerBallThrow, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = RecordedOpponentHandleDrawPartyStatusSummary, - [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = RecordedOpponentHandleHidePartyStatusSummary, - [CONTROLLER_ENDBOUNCE] = RecordedOpponentHandleEndBounceEffect, - [CONTROLLER_SPRITEINVISIBILITY] = RecordedOpponentHandleSpriteInvisibility, + [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = BtlController_HandleHidePartyStatusSummary, + [CONTROLLER_ENDBOUNCE] = BtlController_Empty, + [CONTROLLER_SPRITEINVISIBILITY] = BtlController_HandleSpriteInvisibility, [CONTROLLER_BATTLEANIMATION] = RecordedOpponentHandleBattleAnimation, - [CONTROLLER_LINKSTANDBYMSG] = RecordedOpponentHandleLinkStandbyMsg, - [CONTROLLER_RESETACTIONMOVESELECTION] = RecordedOpponentHandleResetActionMoveSelection, + [CONTROLLER_LINKSTANDBYMSG] = BtlController_Empty, + [CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty, [CONTROLLER_ENDLINKBATTLE] = RecordedOpponentHandleEndLinkBattle, - [CONTROLLER_DEBUGMENU] = RecordedOpponentHandleBattleDebug, - [CONTROLLER_TERMINATOR_NOP] = RecordedOpponentCmdEnd + [CONTROLLER_DEBUGMENU] = BtlController_Empty, + [CONTROLLER_TERMINATOR_NOP] = BtlController_TerminatorNop }; -static void RecordedOpponentDummy(void) -{ -} - -void SetControllerToRecordedOpponent(void) +void SetControllerToRecordedOpponent(u32 battler) { - gBattlerControllerFuncs[gActiveBattler] = RecordedOpponentBufferRunCommand; + gBattlerControllerEndFuncs[battler] = RecordedOpponentBufferExecCompleted; + gBattlerControllerFuncs[battler] = RecordedOpponentBufferRunCommand; } -static void RecordedOpponentBufferRunCommand(void) +static void RecordedOpponentBufferRunCommand(u32 battler) { - if (gBattleControllerExecFlags & gBitTable[gActiveBattler]) + if (gBattleControllerExecFlags & gBitTable[battler]) { - if (gBattleResources->bufferA[gActiveBattler][0] < ARRAY_COUNT(sRecordedOpponentBufferCommands)) - sRecordedOpponentBufferCommands[gBattleResources->bufferA[gActiveBattler][0]](); + if (gBattleResources->bufferA[battler][0] < ARRAY_COUNT(sRecordedOpponentBufferCommands)) + sRecordedOpponentBufferCommands[gBattleResources->bufferA[battler][0]](battler); else - RecordedOpponentBufferExecCompleted(); + RecordedOpponentBufferExecCompleted(battler); } } -static void CompleteOnBattlerSpriteCallbackDummy(void) +static void RecordedOpponentBufferExecCompleted(u32 battler) { - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - RecordedOpponentBufferExecCompleted(); -} - -static void CompleteOnBankSpriteCallbackDummy2(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - RecordedOpponentBufferExecCompleted(); -} + gBattlerControllerFuncs[battler] = RecordedOpponentBufferRunCommand; + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + u8 playerId = GetMultiplayerId(); -static void FreeTrainerSpriteAfterSlide(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + PrepareBufferDataTransferLink(battler, 2, 4, &playerId); + gBattleResources->bufferA[battler][0] = CONTROLLER_TERMINATOR_NOP; + } + else { - FreeTrainerFrontPicPalette(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam); - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - RecordedOpponentBufferExecCompleted(); + gBattleControllerExecFlags &= ~gBitTable[battler]; } } -static void Intro_DelayAndEnd(void) +static void Intro_DelayAndEnd(u32 battler) { - if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay == (u8)-1) + if (--gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay == (u8)-1) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0; - RecordedOpponentBufferExecCompleted(); + gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay = 0; + RecordedOpponentBufferExecCompleted(battler); } } -static void Intro_WaitForShinyAnimAndHealthbox(void) +static void Intro_WaitForShinyAnimAndHealthbox(u32 battler) { bool8 healthboxAnimDone = FALSE; if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[gActiveBattler]].animEnded) + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[battler]].animEnded) healthboxAnimDone = TRUE; } else { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[gActiveBattler]].animEnded - && gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gActiveBattler)]].animEnded) + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy + && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(battler)]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[battler]].animEnded + && gSprites[gBattlerSpriteIds[BATTLE_PARTNER(battler)]].animEnded) healthboxAnimDone = TRUE; } if (healthboxAnimDone) { - if (GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_LEFT) + if (GetBattlerPosition(battler) == B_POSITION_OPPONENT_LEFT) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim) return; - if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) + if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].finishedShinyMonAnim) return; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; - gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; + gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay = 3; + gBattlerControllerFuncs[battler] = Intro_DelayAndEnd; } } -static void Intro_TryShinyAnimShowHealthbox(void) +static void Intro_TryShinyAnimShowHealthbox(u32 battler) { bool32 bgmRestored = FALSE; bool32 battlerAnimsDone = FALSE; - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) - TryShinyAnimation(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); + if (!gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive) + TryShinyAnimation(battler, &gEnemyParty[gBattlerPartyIndexes[battler]]); - if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) - TryShinyAnimation(BATTLE_PARTNER(gActiveBattler), &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]); + if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].ballAnimActive) + TryShinyAnimation(BATTLE_PARTNER(battler), &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]]); - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].ballAnimActive) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].healthboxSlideInStarted) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); - StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(battler)], &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]], HEALTHBOX_ALL); + StartHealthboxSlideIn(BATTLE_PARTNER(battler)); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(battler)]); } - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], &gEnemyParty[gBattlerPartyIndexes[battler]], HEALTHBOX_ALL); + StartHealthboxSlideIn(battler); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[battler]); } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = TRUE; + gBattleSpritesDataPtr->healthBoxesData[battler].healthboxSlideInStarted = TRUE; } - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry - && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].waitForCry + if (!gBattleSpritesDataPtr->healthBoxesData[battler].waitForCry + && gBattleSpritesDataPtr->healthBoxesData[battler].healthboxSlideInStarted + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].waitForCry && !IsCryPlayingOrClearCrySongs()) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].bgmRestored) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) { - if (GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_LEFT) + if (GetBattlerPosition(battler) == B_POSITION_OPPONENT_LEFT) m4aMPlayContinue(&gMPlayInfo_BGM); } else @@ -306,24 +247,24 @@ static void Intro_TryShinyAnimShowHealthbox(void) m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 0x100); } } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = TRUE; + gBattleSpritesDataPtr->healthBoxesData[battler].bgmRestored = TRUE; bgmRestored = TRUE; } if (!IsDoubleBattle()) { - if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattleControllerData[battler]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy) { battlerAnimsDone = TRUE; } } else { - if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) + if (gSprites[gBattleControllerData[battler]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy + && gSprites[gBattleControllerData[BATTLE_PARTNER(battler)]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[BATTLE_PARTNER(battler)]].callback == SpriteCallbackDummy) { battlerAnimsDone = TRUE; } @@ -333,898 +274,137 @@ static void Intro_TryShinyAnimShowHealthbox(void) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); - SetBattlerShadowSpriteCallback(BATTLE_PARTNER(gActiveBattler), GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], MON_DATA_SPECIES)); + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(battler)]]); + SetBattlerShadowSpriteCallback(BATTLE_PARTNER(battler), GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]], MON_DATA_SPECIES)); } - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); - SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); + DestroySprite(&gSprites[gBattleControllerData[battler]]); + SetBattlerShadowSpriteCallback(battler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES)); gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].bgmRestored = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].healthboxSlideInStarted = FALSE; - gBattlerControllerFuncs[gActiveBattler] = Intro_WaitForShinyAnimAndHealthbox; + gBattlerControllerFuncs[battler] = Intro_WaitForShinyAnimAndHealthbox; } } -static void TryShinyAnimAfterMonAnim(void) +static void TryShinyAnimAfterMonAnim(u32 battler) { - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[gActiveBattler]].x2 == 0) + if (gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[battler]].x2 == 0) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim) { - TryShinyAnimation(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); + TryShinyAnimation(battler, &gEnemyParty[gBattlerPartyIndexes[battler]]); } else { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) + if (gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); - RecordedOpponentBufferExecCompleted(); + RecordedOpponentBufferExecCompleted(battler); } } } } -static void CompleteOnHealthbarDone(void) -{ - s16 hpValue = MoveBattleBar(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0); - - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - - if (hpValue != -1) - UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], HP_CURRENT, hpValue, gBattleMons[gActiveBattler].maxHP); - else - RecordedOpponentBufferExecCompleted(); -} - -static void HideHealthboxAfterMonFaint(void) -{ - if (!gSprites[gBattlerSpriteIds[gActiveBattler]].inUse) - { - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - RecordedOpponentBufferExecCompleted(); - } -} - -static void FreeMonSpriteAfterSwitchOutAnim(void) -{ - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - HideBattlerShadowSprite(gActiveBattler); - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - RecordedOpponentBufferExecCompleted(); - } -} - -static void CompleteOnInactiveTextPrinter(void) -{ - if (!IsTextPrinterActive(B_WIN_MSG)) - RecordedOpponentBufferExecCompleted(); -} - -static void DoHitAnimBlinkSpriteEffect(void) -{ - u8 spriteId = gBattlerSpriteIds[gActiveBattler]; - - if (gSprites[spriteId].data[1] == 32) - { - gSprites[spriteId].data[1] = 0; - gSprites[spriteId].invisible = FALSE; - gDoingBattleAnim = FALSE; - RecordedOpponentBufferExecCompleted(); - } - else - { - if ((gSprites[spriteId].data[1] % 4) == 0) - gSprites[spriteId].invisible ^= 1; - gSprites[spriteId].data[1]++; - } -} - -static void SwitchIn_ShowSubstitute(void) +static void SwitchIn_ShowSubstitute(u32 battler) { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy) { - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); + if (gBattleSpritesDataPtr->battlerData[battler].behindSubstitute) + InitAndLaunchSpecialAnimation(battler, battler, battler, B_ANIM_MON_TO_SUBSTITUTE); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_HandleSoundAndEnd; + gBattlerControllerFuncs[battler] = SwitchIn_HandleSoundAndEnd; } } -static void SwitchIn_HandleSoundAndEnd(void) +static void SwitchIn_HandleSoundAndEnd(u32 battler) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive + if (!gBattleSpritesDataPtr->healthBoxesData[battler].specialAnimActive && !IsCryPlayingOrClearCrySongs()) { - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - || gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy_2) + if (gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy + || gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy_2) { m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 0x100); - RecordedOpponentBufferExecCompleted(); + RecordedOpponentBufferExecCompleted(battler); } } } -static void SwitchIn_ShowHealthbox(void) +static void SwitchIn_ShowHealthbox(u32 battler) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim - && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim + && gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); - StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[battler]], 0); - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - CopyBattleSpriteInvisibility(gActiveBattler); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowSubstitute; + UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], &gEnemyParty[gBattlerPartyIndexes[battler]], HEALTHBOX_ALL); + StartHealthboxSlideIn(battler); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[battler]); + CopyBattleSpriteInvisibility(battler); + gBattlerControllerFuncs[battler] = SwitchIn_ShowSubstitute; } } -static void SwitchIn_TryShinyAnim(void) +static void SwitchIn_TryShinyAnim(u32 battler) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim) - TryShinyAnimation(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); + if (!gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive + && !gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim) + TryShinyAnimation(battler, &gEnemyParty[gBattlerPartyIndexes[battler]]); - if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) + if (gSprites[gBattleControllerData[battler]].callback == SpriteCallbackDummy + && !gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive) { - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); - SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowHealthbox; + DestroySprite(&gSprites[gBattleControllerData[battler]]); + SetBattlerShadowSpriteCallback(battler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES)); + gBattlerControllerFuncs[battler] = SwitchIn_ShowHealthbox; } } -static void CompleteOnFinishedStatusAnimation(void) +static void RecordedOpponentHandleLoadMonSprite(u32 battler) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].statusAnimActive) - RecordedOpponentBufferExecCompleted(); + BtlController_HandleLoadMonSprite(battler, TryShinyAnimAfterMonAnim); } -static void CompleteOnFinishedBattleAnimation(void) +static void RecordedOpponentHandleSwitchInAnim(u32 battler) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive) - RecordedOpponentBufferExecCompleted(); + BtlController_HandleSwitchInAnim(battler, FALSE, SwitchIn_TryShinyAnim); } -static void RecordedOpponentBufferExecCompleted(void) -{ - gBattlerControllerFuncs[gActiveBattler] = RecordedOpponentBufferRunCommand; - if (gBattleTypeFlags & BATTLE_TYPE_LINK) - { - u8 playerId = GetMultiplayerId(); - - PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleResources->bufferA[gActiveBattler][0] = CONTROLLER_TERMINATOR_NOP; - } - else - { - gBattleControllerExecFlags &= ~gBitTable[gActiveBattler]; - } -} - -static void RecordedOpponentHandleGetMonData(void) -{ - u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data - u32 size = 0; - u8 monToCheck; - s32 i; - - if (gBattleResources->bufferA[gActiveBattler][2] == 0) - { - size += CopyRecordedOpponentMonData(gBattlerPartyIndexes[gActiveBattler], monData); - } - else - { - monToCheck = gBattleResources->bufferA[gActiveBattler][2]; - for (i = 0; i < PARTY_SIZE; i++) - { - if (monToCheck & 1) - size += CopyRecordedOpponentMonData(i, monData + size); - monToCheck >>= 1; - } - } - BtlController_EmitDataTransfer(BUFFER_B, size, monData); - RecordedOpponentBufferExecCompleted(); -} - -static u32 CopyRecordedOpponentMonData(u8 monId, u8 *dst) -{ - struct BattlePokemon battleMon; - struct MovePpInfo moveData; - u8 nickname[20]; - u8 *src; - s16 data16; - u32 data32; - s32 size = 0; - - switch (gBattleResources->bufferA[gActiveBattler][1]) - { - case REQUEST_ALL_BATTLE: - battleMon.species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES); - battleMon.item = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM); - for (size = 0; size < MAX_MON_MOVES; size++) - { - battleMon.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size); - battleMon.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); - } - battleMon.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); - battleMon.friendship = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP); - battleMon.experience = GetMonData(&gEnemyParty[monId], MON_DATA_EXP); - battleMon.hpIV = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); - battleMon.attackIV = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); - battleMon.defenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); - battleMon.speedIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); - battleMon.spAttackIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); - battleMon.spDefenseIV = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); - battleMon.personality = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY); - battleMon.status1 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS); - battleMon.level = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL); - battleMon.hp = GetMonData(&gEnemyParty[monId], MON_DATA_HP); - battleMon.maxHP = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP); - battleMon.attack = GetMonData(&gEnemyParty[monId], MON_DATA_ATK); - battleMon.defense = GetMonData(&gEnemyParty[monId], MON_DATA_DEF); - battleMon.speed = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED); - battleMon.spAttack = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK); - battleMon.spDefense = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF); - battleMon.abilityNum = GetMonData(&gEnemyParty[monId], MON_DATA_ABILITY_NUM); - battleMon.otId = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID); - battleMon.metLevel = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL); - GetMonData(&gEnemyParty[monId], MON_DATA_NICKNAME, nickname); - StringCopy_Nickname(battleMon.nickname, nickname); - GetMonData(&gEnemyParty[monId], MON_DATA_OT_NAME, battleMon.otName); - src = (u8 *)&battleMon; - for (size = 0; size < sizeof(battleMon); size++) - dst[size] = src[size]; - break; - case REQUEST_SPECIES_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_HELDITEM_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_MOVES_PP_BATTLE: - for (size = 0; size < MAX_MON_MOVES; size++) - { - moveData.moves[size] = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + size); - moveData.pp[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); - } - moveData.ppBonuses = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); - src = (u8 *)(&moveData); - for (size = 0; size < sizeof(moveData); size++) - dst[size] = src[size]; - break; - case REQUEST_MOVE1_BATTLE: - case REQUEST_MOVE2_BATTLE: - case REQUEST_MOVE3_BATTLE: - case REQUEST_MOVE4_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_PP_DATA_BATTLE: - for (size = 0; size < MAX_MON_MOVES; size++) - dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + size); - dst[size] = GetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES); - size++; - break; - case REQUEST_PPMOVE1_BATTLE: - case REQUEST_PPMOVE2_BATTLE: - case REQUEST_PPMOVE3_BATTLE: - case REQUEST_PPMOVE4_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE); - size = 1; - break; - case REQUEST_OTID_BATTLE: - data32 = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - size = 3; - break; - case REQUEST_EXP_BATTLE: - data32 = GetMonData(&gEnemyParty[monId], MON_DATA_EXP); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - size = 3; - break; - case REQUEST_HP_EV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_EV); - size = 1; - break; - case REQUEST_ATK_EV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV); - size = 1; - break; - case REQUEST_DEF_EV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV); - size = 1; - break; - case REQUEST_SPEED_EV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV); - size = 1; - break; - case REQUEST_SPATK_EV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV); - size = 1; - break; - case REQUEST_SPDEF_EV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV); - size = 1; - break; - case REQUEST_FRIENDSHIP_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP); - size = 1; - break; - case REQUEST_POKERUS_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKERUS); - size = 1; - break; - case REQUEST_MET_LOCATION_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION); - size = 1; - break; - case REQUEST_MET_LEVEL_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL); - size = 1; - break; - case REQUEST_MET_GAME_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME); - size = 1; - break; - case REQUEST_POKEBALL_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL); - size = 1; - break; - case REQUEST_ALL_IVS_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); - dst[1] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); - dst[2] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); - dst[3] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); - dst[4] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); - dst[5] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); - size = 6; - break; - case REQUEST_HP_IV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_HP_IV); - size = 1; - break; - case REQUEST_ATK_IV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV); - size = 1; - break; - case REQUEST_DEF_IV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV); - size = 1; - break; - case REQUEST_SPEED_IV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV); - size = 1; - break; - case REQUEST_SPATK_IV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV); - size = 1; - break; - case REQUEST_SPDEF_IV_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV); - size = 1; - break; - case REQUEST_PERSONALITY_BATTLE: - data32 = GetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - dst[3] = (data32 & 0xFF000000) >> 24; - size = 4; - break; - case REQUEST_CHECKSUM_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_STATUS_BATTLE: - data32 = GetMonData(&gEnemyParty[monId], MON_DATA_STATUS); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - dst[3] = (data32 & 0xFF000000) >> 24; - size = 4; - break; - case REQUEST_LEVEL_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_LEVEL); - size = 1; - break; - case REQUEST_HP_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_HP); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_MAX_HP_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_ATK_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_ATK); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_DEF_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_DEF); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPEED_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPEED); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPATK_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPDEF_BATTLE: - data16 = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_COOL_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL); - size = 1; - break; - case REQUEST_BEAUTY_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY); - size = 1; - break; - case REQUEST_CUTE_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE); - size = 1; - break; - case REQUEST_SMART_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART); - size = 1; - break; - case REQUEST_TOUGH_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH); - size = 1; - break; - case REQUEST_SHEEN_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SHEEN); - size = 1; - break; - case REQUEST_COOL_RIBBON_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON); - size = 1; - break; - case REQUEST_BEAUTY_RIBBON_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON); - size = 1; - break; - case REQUEST_CUTE_RIBBON_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON); - size = 1; - break; - case REQUEST_SMART_RIBBON_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON); - size = 1; - break; - case REQUEST_TOUGH_RIBBON_BATTLE: - dst[0] = GetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON); - size = 1; - break; - } - - return size; -} - -static void RecordedOpponentHandleGetRawMonData(void) -{ - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleSetMonData(void) -{ - u8 monToCheck; - u8 i; - - if (gBattleResources->bufferA[gActiveBattler][2] == 0) - { - SetRecordedOpponentMonData(gBattlerPartyIndexes[gActiveBattler]); - } - else - { - monToCheck = gBattleResources->bufferA[gActiveBattler][2]; - for (i = 0; i < PARTY_SIZE; i++) - { - if (monToCheck & 1) - SetRecordedOpponentMonData(i); - monToCheck >>= 1; - } - } - RecordedOpponentBufferExecCompleted(); -} - -static void SetRecordedOpponentMonData(u8 monId) -{ - struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleResources->bufferA[gActiveBattler][3]; - struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleResources->bufferA[gActiveBattler][3]; - s32 i; - - switch (gBattleResources->bufferA[gActiveBattler][1]) - { - case REQUEST_ALL_BATTLE: - { - u8 iv; - - SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &battlePokemon->species); - SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); - for (i = 0; i < MAX_MON_MOVES; i++) - { - SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); - SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); - } - SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); - SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); - SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &battlePokemon->experience); - iv = battlePokemon->hpIV; - SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &iv); - iv = battlePokemon->attackIV; - SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &iv); - iv = battlePokemon->defenseIV; - SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &iv); - iv = battlePokemon->speedIV; - SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &iv); - iv = battlePokemon->spAttackIV; - SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &iv); - iv = battlePokemon->spDefenseIV; - SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &iv); - SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); - SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &battlePokemon->status1); - SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &battlePokemon->level); - SetMonData(&gEnemyParty[monId], MON_DATA_HP, &battlePokemon->hp); - SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); - SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &battlePokemon->attack); - SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &battlePokemon->defense); - SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &battlePokemon->speed); - SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); - SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); - } - break; - case REQUEST_SPECIES_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HELDITEM_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_HELD_ITEM, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MOVES_PP_BATTLE: - for (i = 0; i < MAX_MON_MOVES; i++) - { - SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); - SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); - } - SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); - break; - case REQUEST_MOVE1_BATTLE: - case REQUEST_MOVE2_BATTLE: - case REQUEST_MOVE3_BATTLE: - case REQUEST_MOVE4_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_PP_DATA_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_PP1, &gBattleResources->bufferA[gActiveBattler][3]); - SetMonData(&gEnemyParty[monId], MON_DATA_PP2, &gBattleResources->bufferA[gActiveBattler][4]); - SetMonData(&gEnemyParty[monId], MON_DATA_PP3, &gBattleResources->bufferA[gActiveBattler][5]); - SetMonData(&gEnemyParty[monId], MON_DATA_PP4, &gBattleResources->bufferA[gActiveBattler][6]); - SetMonData(&gEnemyParty[monId], MON_DATA_PP_BONUSES, &gBattleResources->bufferA[gActiveBattler][7]); - break; - case REQUEST_PPMOVE1_BATTLE: - case REQUEST_PPMOVE2_BATTLE: - case REQUEST_PPMOVE3_BATTLE: - case REQUEST_PPMOVE4_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_OTID_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_OT_ID, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_EXP_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_EXP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HP_EV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_HP_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_EV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_ATK_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_EV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_DEF_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_EV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_EV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_EV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_FRIENDSHIP_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_FRIENDSHIP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_POKERUS_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_POKERUS, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_LOCATION_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_MET_LOCATION, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_LEVEL_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_MET_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_GAME_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_MET_GAME, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_POKEBALL_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_POKEBALL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ALL_IVS_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]); - SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][4]); - SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][5]); - SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][6]); - SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][7]); - SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][8]); - break; - case REQUEST_HP_IV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_IV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_IV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_IV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_IV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_IV_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_PERSONALITY_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_PERSONALITY, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CHECKSUM_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_CHECKSUM, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_STATUS_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_STATUS, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_LEVEL_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HP_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_HP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MAX_HP_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_MAX_HP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_ATK, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_DEF, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPEED, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPATK, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SPDEF, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_COOL_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_COOL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_BEAUTY_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CUTE_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_CUTE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SMART_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SMART, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_TOUGH_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SHEEN_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SHEEN, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_COOL_RIBBON_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_COOL_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_BEAUTY_RIBBON_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CUTE_RIBBON_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_CUTE_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SMART_RIBBON_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_SMART_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_TOUGH_RIBBON_BATTLE: - SetMonData(&gEnemyParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - } -} - -static void RecordedOpponentHandleSetRawMonData(void) -{ - u8 *dst = (u8 *)&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleResources->bufferA[gActiveBattler][1]; - u8 i; - - for (i = 0; i < gBattleResources->bufferA[gActiveBattler][2]; i++) - dst[i] = gBattleResources->bufferA[gActiveBattler][3 + i]; - - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleLoadMonSprite(void) -{ - u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - - BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler)); - - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(gActiveBattler, BATTLER_COORD_X_2), - GetBattlerSpriteDefault_Y(gActiveBattler), - GetBattlerSpriteSubpriority(gActiveBattler)); - - gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = -DISPLAY_WIDTH; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); - - SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - - gBattlerControllerFuncs[gActiveBattler] = TryShinyAnimAfterMonAnim; -} - -static void RecordedOpponentHandleSwitchInAnim(void) -{ - gBattlerPartyIndexes[gActiveBattler] = gBattleResources->bufferA[gActiveBattler][1]; - StartSendOutAnim(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_TryShinyAnim; -} - -static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) -{ - u16 species; - - ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit); - gBattlerPartyIndexes[battlerId] = gBattleResources->bufferA[battlerId][1]; - species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); - gBattleControllerData[battlerId] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim); - BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId); - SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId)); - - gBattlerSpriteIds[battlerId] = CreateSprite(&gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2), - GetBattlerSpriteDefault_Y(battlerId), - GetBattlerSpriteSubpriority(battlerId)); - - gSprites[gBattleControllerData[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; - gSprites[gBattleControllerData[battlerId]].data[2] = battlerId; - - gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId; - gSprites[gBattlerSpriteIds[battlerId]].data[2] = species; - gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId; - - StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]); - - gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE; - gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy; - - gSprites[gBattleControllerData[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT); -} - -static void RecordedOpponentHandleReturnMonToBall(void) -{ - if (gBattleResources->bufferA[gActiveBattler][1] == 0) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation; - } - else - { - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - HideBattlerShadowSprite(gActiveBattler); - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - RecordedOpponentBufferExecCompleted(); - } -} - -static void DoSwitchOutAnimation(void) -{ - switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState) - { - case 0: - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON); - - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1; - break; - case 1: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_OPPONENT_MON); - gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim; - } - break; - } -} - -#define sSpeedX data[0] - -static void RecordedOpponentHandleDrawTrainerPic(void) +static void RecordedOpponentHandleDrawTrainerPic(u32 battler) { s16 xPos; u32 trainerPicId; if (gBattleTypeFlags & BATTLE_TYPE_MULTI) { - if ((GetBattlerPosition(gActiveBattler) & BIT_FLANK) != 0) // second mon + if ((GetBattlerPosition(battler) & BIT_FLANK) != 0) // second mon xPos = 152; else // first mon xPos = 200; if (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER) { - if (gActiveBattler == 1) + if (battler == B_POSITION_OPPONENT_LEFT) trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); else trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_B); } else { - trainerPicId = PlayerGenderToFrontTrainerPicId(GetActiveBattlerLinkPlayerGender()); + trainerPicId = PlayerGenderToFrontTrainerPicId(GetBattlerLinkPlayerGender(battler)); } } else @@ -1240,575 +420,149 @@ static void RecordedOpponentHandleDrawTrainerPic(void) } } - DecompressTrainerFrontPic(trainerPicId, gActiveBattler); - SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, - xPos, - (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 40, - GetBattlerSpriteSubpriority(gActiveBattler)); - - gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = -DISPLAY_WIDTH; - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 2; - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; - - gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy; + BtlController_HandleDrawTrainerPic(battler, trainerPicId, TRUE, + xPos, 40 + 4 * (8 - gTrainerFrontPicCoords[trainerPicId].size), + -1); } -#undef sSpeedX - -static void RecordedOpponentHandleTrainerSlide(void) +static void RecordedOpponentHandleTrainerSlideBack(u32 battler) { - RecordedOpponentBufferExecCompleted(); + BtlController_HandleTrainerSlideBack(battler, 35, FALSE); } -static void RecordedOpponentHandleTrainerSlideBack(void) +static void RecordedOpponentHandleMoveAnimation(u32 battler) { - SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 280; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].y; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); - gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; + BtlController_HandleMoveAnimation(battler, FALSE); } -static void RecordedOpponentHandleFaintAnimation(void) -{ - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState == 0) - { - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState++; - } - else - { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - PlaySE12WithPanning(SE_FAINT, SOUND_PAN_TARGET); - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintOpponentMon; - gBattlerControllerFuncs[gActiveBattler] = HideHealthboxAfterMonFaint; - } - } -} - -static void RecordedOpponentHandlePaletteFade(void) -{ - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleSuccessBallThrowAnim(void) -{ - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleBallThrowAnim(void) -{ - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandlePause(void) -{ - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleMoveAnimation(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) - { - u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); - - gAnimMoveTurn = gBattleResources->bufferA[gActiveBattler][3]; - gAnimMovePower = gBattleResources->bufferA[gActiveBattler][4] | (gBattleResources->bufferA[gActiveBattler][5] << 8); - gAnimMoveDmg = gBattleResources->bufferA[gActiveBattler][6] | (gBattleResources->bufferA[gActiveBattler][7] << 8) | (gBattleResources->bufferA[gActiveBattler][8] << 16) | (gBattleResources->bufferA[gActiveBattler][9] << 24); - gAnimFriendship = gBattleResources->bufferA[gActiveBattler][10]; - gWeatherMoveAnim = gBattleResources->bufferA[gActiveBattler][12] | (gBattleResources->bufferA[gActiveBattler][13] << 8); - gAnimDisableStructPtr = (struct DisableStruct *)&gBattleResources->bufferA[gActiveBattler][16]; - gTransformedPersonalities[gActiveBattler] = gAnimDisableStructPtr->transformedMonPersonality; - gTransformedOtIds[gActiveBattler] = gAnimDisableStructPtr->transformedMonOtId; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerControllerFuncs[gActiveBattler] = RecordedOpponentDoMoveAnimation; - } -} - -static void RecordedOpponentDoMoveAnimation(void) -{ - u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); - u8 multihit = gBattleResources->bufferA[gActiveBattler][11]; - - switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState) - { - case 0: - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute - && !gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8) - { - gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 1; - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON); - } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1; - break; - case 1: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF); - DoMoveAnim(move); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2; - } - break; - case 2: - gAnimScriptCallback(); - if (!gAnimScriptActive) - { - SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL); - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2) - { - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 0; - } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 3; - } - break; - case 3: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - CopyAllBattleSpritesInvisibilities(); - TrySetBehindSubstituteSpriteBit(gActiveBattler, gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - RecordedOpponentBufferExecCompleted(); - } - break; - } -} - -static void RecordedOpponentHandlePrintString(void) +static void RecordedOpponentHandlePrintString(u32 battler) { u16 *stringId; gBattle_BG0_X = 0; gBattle_BG0_Y = 0; - stringId = (u16 *)(&gBattleResources->bufferA[gActiveBattler][2]); - BufferStringBattle(*stringId); + stringId = (u16 *)(&gBattleResources->bufferA[battler][2]); + BufferStringBattle(*stringId, battler); if (gTestRunnerEnabled) { TestRunner_Battle_RecordMessage(gDisplayedStringBattle); if (gTestRunnerHeadless) { - RecordedOpponentBufferExecCompleted(); + RecordedOpponentBufferExecCompleted(battler); return; } } BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG); - gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; -} - -static void RecordedOpponentHandlePrintSelectionString(void) -{ - RecordedOpponentBufferExecCompleted(); + gBattlerControllerFuncs[battler] = Controller_WaitForString; } -static void RecordedOpponentHandleChooseAction(void) +static void RecordedOpponentHandleChooseAction(u32 battler) { - BtlController_EmitTwoReturnValues(BUFFER_B, RecordedBattle_GetBattlerAction(RECORDED_ACTION_TYPE, gActiveBattler), 0); - RecordedOpponentBufferExecCompleted(); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, RecordedBattle_GetBattlerAction(RECORDED_ACTION_TYPE, battler), 0); + RecordedOpponentBufferExecCompleted(battler); } -static void RecordedOpponentHandleYesNoBox(void) -{ - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleChooseMove(void) +static void RecordedOpponentHandleChooseMove(u32 battler) { if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - BtlController_EmitTwoReturnValues(BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace()); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace(battler)); } else { - u8 moveId = RecordedBattle_GetBattlerAction(RECORDED_MOVE_SLOT, gActiveBattler); - u8 target = RecordedBattle_GetBattlerAction(RECORDED_MOVE_TARGET, gActiveBattler); - BtlController_EmitTwoReturnValues(BUFFER_B, 10, moveId | (target << 8)); + u8 moveId = RecordedBattle_GetBattlerAction(RECORDED_MOVE_SLOT, battler); + u8 target = RecordedBattle_GetBattlerAction(RECORDED_MOVE_TARGET, battler); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, moveId | (target << 8)); } - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleChooseItem(void) -{ - u8 byte1 = RecordedBattle_GetBattlerAction(RECORDED_ITEM_ID, gActiveBattler); - u8 byte2 = RecordedBattle_GetBattlerAction(RECORDED_ITEM_ID, gActiveBattler); - gBattleStruct->chosenItem[gActiveBattler] = (byte1 << 8) | byte2; - gBattleStruct->itemPartyIndex[gActiveBattler] = RecordedBattle_GetBattlerAction(RECORDED_ITEM_TARGET, gActiveBattler); - gBattleStruct->itemMoveIndex[gActiveBattler] = RecordedBattle_GetBattlerAction(RECORDED_ITEM_MOVE, gActiveBattler); - BtlController_EmitOneReturnValue(BUFFER_B, gBattleStruct->chosenItem[gActiveBattler]); - RecordedOpponentBufferExecCompleted(); + RecordedOpponentBufferExecCompleted(battler); } -static void RecordedOpponentHandleChoosePokemon(void) +static void RecordedOpponentHandleChooseItem(u32 battler) { - *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = RecordedBattle_GetBattlerAction(RECORDED_PARTY_INDEX, gActiveBattler); - gSelectedMonPartyId = gBattleStruct->monToSwitchIntoId[gActiveBattler]; // Revival Blessing - BtlController_EmitChosenMonReturnValue(BUFFER_B, *(gBattleStruct->monToSwitchIntoId + gActiveBattler), NULL); - RecordedOpponentBufferExecCompleted(); + u8 byte1 = RecordedBattle_GetBattlerAction(RECORDED_ITEM_ID, battler); + u8 byte2 = RecordedBattle_GetBattlerAction(RECORDED_ITEM_ID, battler); + gBattleStruct->chosenItem[battler] = (byte1 << 8) | byte2; + gBattleStruct->itemPartyIndex[battler] = RecordedBattle_GetBattlerAction(RECORDED_ITEM_TARGET, battler); + gBattleStruct->itemMoveIndex[battler] = RecordedBattle_GetBattlerAction(RECORDED_ITEM_MOVE, battler); + BtlController_EmitOneReturnValue(battler, BUFFER_B, gBattleStruct->chosenItem[battler]); + RecordedOpponentBufferExecCompleted(battler); } -static void RecordedOpponentHandleCmd23(void) +static void RecordedOpponentHandleChoosePokemon(u32 battler) { - RecordedOpponentBufferExecCompleted(); + *(gBattleStruct->monToSwitchIntoId + battler) = RecordedBattle_GetBattlerAction(RECORDED_PARTY_INDEX, battler); + gSelectedMonPartyId = gBattleStruct->monToSwitchIntoId[battler]; // Revival Blessing + BtlController_EmitChosenMonReturnValue(battler, BUFFER_B, *(gBattleStruct->monToSwitchIntoId + battler), NULL); + RecordedOpponentBufferExecCompleted(battler); } -static void RecordedOpponentHandleHealthBarUpdate(void) +static void RecordedOpponentHandleHealthBarUpdate(u32 battler) { s16 hpVal; s32 maxHP, curHP; LoadBattleBarGfx(0); - hpVal = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); + hpVal = gBattleResources->bufferA[battler][2] | (gBattleResources->bufferA[battler][3] << 8); - maxHP = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); - curHP = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_HP); + maxHP = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_MAX_HP); + curHP = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_HP); if (hpVal != INSTANT_HP_BAR_DROP) { - SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, curHP, hpVal); - TestRunner_Battle_RecordHP(gActiveBattler, curHP, min(maxHP, max(0, curHP - hpVal))); + SetBattleBarStruct(battler, gHealthboxSpriteIds[battler], maxHP, curHP, hpVal); + TestRunner_Battle_RecordHP(battler, curHP, min(maxHP, max(0, curHP - hpVal))); } else { - SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, 0, hpVal); - TestRunner_Battle_RecordHP(gActiveBattler, curHP, 0); + SetBattleBarStruct(battler, gHealthboxSpriteIds[battler], maxHP, 0, hpVal); + TestRunner_Battle_RecordHP(battler, curHP, 0); } - gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthbarDone; + gBattlerControllerFuncs[battler] = Controller_WaitForHealthBar; } -static void RecordedOpponentHandleExpUpdate(void) +static void RecordedOpponentHandleStatusIconUpdate(u32 battler) { - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleStatusIconUpdate(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) + if (!IsBattleSEPlaying(battler)) { - u8 battlerId; - - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON); - battlerId = gActiveBattler; - gBattleSpritesDataPtr->healthBoxesData[battlerId].statusAnimActive = 0; - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; - + DoStatusIconUpdate(battler); if (gTestRunnerEnabled) - TestRunner_Battle_RecordStatus1(battlerId, GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_STATUS)); - } -} - -static void RecordedOpponentHandleStatusAnimation(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) - { - InitAndLaunchChosenStatusAnimation(gBattleResources->bufferA[gActiveBattler][1], - gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8) | (gBattleResources->bufferA[gActiveBattler][4] << 16) | (gBattleResources->bufferA[gActiveBattler][5] << 24)); - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; - } -} - -static void RecordedOpponentHandleStatusXor(void) -{ - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleDataTransfer(void) -{ - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleDMA3Transfer(void) -{ - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandlePlayBGM(void) -{ - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleCmd32(void) -{ - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleTwoReturnValues(void) -{ - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleChosenMonReturnValue(void) -{ - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleOneReturnValue(void) -{ - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleOneReturnValue_Duplicate(void) -{ - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleClearUnkVar(void) -{ - gUnusedControllerStruct.unk = 0; - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleSetUnkVar(void) -{ - gUnusedControllerStruct.unk = gBattleResources->bufferA[gActiveBattler][1]; - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleClearUnkFlag(void) -{ - gUnusedControllerStruct.flag = 0; - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleToggleUnkFlag(void) -{ - gUnusedControllerStruct.flag ^= 1; - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleHitAnimation(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE) - { - RecordedOpponentBufferExecCompleted(); - } - else - { - gDoingBattleAnim = TRUE; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; - DoHitAnimHealthboxEffect(gActiveBattler); - gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; - } -} - -static void RecordedOpponentHandleCantSwitch(void) -{ - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandlePlaySE(void) -{ - s8 pan; - - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - pan = SOUND_PAN_ATTACKER; - else - pan = SOUND_PAN_TARGET; - - PlaySE12WithPanning(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8), pan); - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandlePlayFanfareOrBGM(void) -{ - if (gBattleResources->bufferA[gActiveBattler][3]) - { - BattleStopLowHpSound(); - PlayBGM(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - else - { - PlayFanfare(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); + TestRunner_Battle_RecordStatus1(battler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_STATUS)); } - - RecordedOpponentBufferExecCompleted(); } -static void RecordedOpponentHandleFaintingCry(void) +static void RecordedOpponentHandleStatusAnimation(u32 battler) { - u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - - PlayCry_ByMode(species, 25, CRY_MODE_FAINT); - RecordedOpponentBufferExecCompleted(); + BtlController_HandleStatusAnimation(battler); } -static void RecordedOpponentHandleIntroSlide(void) +static void RecordedOpponentHandleIntroTrainerBallThrow(u32 battler) { - HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]); - gIntroSlideFlags |= 1; - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleIntroTrainerBallThrow(void) -{ - u8 taskId; - - SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 280; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].y; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; - - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCB_FreeOpponentSprite); - - taskId = CreateTask(Task_StartSendOutAnim, 5); - gTasks[taskId].data[0] = gActiveBattler; - - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) - gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - - gBattleSpritesDataPtr->animationData->introAnimActive = TRUE; - gBattlerControllerFuncs[gActiveBattler] = RecordedOpponentDummy; + BtlController_HandleIntroTrainerBallThrow(battler, 0, NULL, 0, Intro_TryShinyAnimShowHealthbox); } -static void Task_StartSendOutAnim(u8 taskId) +static void RecordedOpponentHandleDrawPartyStatusSummary(u32 battler) { - u8 savedActiveBank = gActiveBattler; - - gActiveBattler = gTasks[taskId].data[0]; - if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) - { - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - StartSendOutAnim(gActiveBattler, FALSE); - } - else - { - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - StartSendOutAnim(gActiveBattler, FALSE); - gActiveBattler ^= BIT_FLANK; - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - StartSendOutAnim(gActiveBattler, FALSE); - gActiveBattler ^= BIT_FLANK; - } - gBattlerControllerFuncs[gActiveBattler] = Intro_TryShinyAnimShowHealthbox; - gActiveBattler = savedActiveBank; - DestroyTask(taskId); + BtlController_HandleDrawPartyStatusSummary(battler, B_SIDE_OPPONENT, TRUE); } -static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite) +static void RecordedOpponentHandleBattleAnimation(u32 battler) { - FreeTrainerFrontPicPalette(sprite->oam.affineParam); - FreeSpriteOamMatrix(sprite); - DestroySprite(sprite); + BtlController_HandleBattleAnimation(battler, FALSE, FALSE); } -static void RecordedOpponentHandleDrawPartyStatusSummary(void) +static void RecordedOpponentHandleEndLinkBattle(u32 battler) { - if (gBattleResources->bufferA[gActiveBattler][1] != 0 && GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - { - RecordedOpponentBufferExecCompleted(); - } + if (gBattleResources->bufferA[battler][1] == B_OUTCOME_DREW) + gBattleOutcome = gBattleResources->bufferA[battler][1]; else - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1; - - if (gBattleResources->bufferA[gActiveBattler][2] != 0) - { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay < 2) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay++; - return; - } - else - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].opponentDrawPartyStatusSummaryDelay = 0; - } - } - - gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleResources->bufferA[gActiveBattler][4], gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2]); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; - - if (gBattleResources->bufferA[gActiveBattler][2] != 0) - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 93; - - gBattlerControllerFuncs[gActiveBattler] = EndDrawPartyStatusSummary; - } -} - -static void EndDrawPartyStatusSummary(void) -{ - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer++ > 92) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; - RecordedOpponentBufferExecCompleted(); - } -} - -static void RecordedOpponentHandleHidePartyStatusSummary(void) -{ - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) - gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleEndBounceEffect(void) -{ - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleSpriteInvisibility(void) -{ - if (IsBattlerSpritePresent(gActiveBattler)) - { - gSprites[gBattlerSpriteIds[gActiveBattler]].invisible = gBattleResources->bufferA[gActiveBattler][1]; - CopyBattleSpriteInvisibility(gActiveBattler); - } - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleBattleAnimation(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) - { - u8 animationId = gBattleResources->bufferA[gActiveBattler][1]; - u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); - - if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument)) - RecordedOpponentBufferExecCompleted(); - else - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; - } -} - -static void RecordedOpponentHandleLinkStandbyMsg(void) -{ - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleResetActionMoveSelection(void) -{ - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleEndLinkBattle(void) -{ - if (gBattleResources->bufferA[gActiveBattler][1] == B_OUTCOME_DREW) - gBattleOutcome = gBattleResources->bufferA[gActiveBattler][1]; - else - gBattleOutcome = gBattleResources->bufferA[gActiveBattler][1] ^ B_OUTCOME_DREW; + gBattleOutcome = gBattleResources->bufferA[battler][1] ^ B_OUTCOME_DREW; FadeOutMapMusic(5); BeginFastPaletteFade(3); - RecordedOpponentBufferExecCompleted(); - gBattlerControllerFuncs[gActiveBattler] = SetBattleEndCallbacks; -} - -static void RecordedOpponentHandleBattleDebug(void) -{ - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentCmdEnd(void) -{ + RecordedOpponentBufferExecCompleted(battler); + gBattlerControllerFuncs[battler] = SetBattleEndCallbacks; } diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 46f3de4f1251..9c8acdbd1747 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -27,234 +27,169 @@ #include "window.h" #include "constants/battle_anim.h" #include "constants/songs.h" - -static void RecordedPlayerHandleGetMonData(void); -static void RecordedPlayerHandleGetRawMonData(void); -static void RecordedPlayerHandleSetMonData(void); -static void RecordedPlayerHandleSetRawMonData(void); -static void RecordedPlayerHandleLoadMonSprite(void); -static void RecordedPlayerHandleSwitchInAnim(void); -static void RecordedPlayerHandleReturnMonToBall(void); -static void RecordedPlayerHandleDrawTrainerPic(void); -static void RecordedPlayerHandleTrainerSlide(void); -static void RecordedPlayerHandleTrainerSlideBack(void); -static void RecordedPlayerHandleFaintAnimation(void); -static void RecordedPlayerHandlePaletteFade(void); -static void RecordedPlayerHandleSuccessBallThrowAnim(void); -static void RecordedPlayerHandleBallThrowAnim(void); -static void RecordedPlayerHandlePause(void); -static void RecordedPlayerHandleMoveAnimation(void); -static void RecordedPlayerHandlePrintString(void); -static void RecordedPlayerHandlePrintSelectionString(void); -static void RecordedPlayerHandleChooseAction(void); -static void RecordedPlayerHandleYesNoBox(void); -static void RecordedPlayerHandleChooseMove(void); -static void RecordedPlayerHandleChooseItem(void); -static void RecordedPlayerHandleChoosePokemon(void); -static void RecordedPlayerHandleCmd23(void); -static void RecordedPlayerHandleHealthBarUpdate(void); -static void RecordedPlayerHandleExpUpdate(void); -static void RecordedPlayerHandleStatusIconUpdate(void); -static void RecordedPlayerHandleStatusAnimation(void); -static void RecordedPlayerHandleStatusXor(void); -static void RecordedPlayerHandleDataTransfer(void); -static void RecordedPlayerHandleDMA3Transfer(void); -static void RecordedPlayerHandlePlayBGM(void); -static void RecordedPlayerHandleCmd32(void); -static void RecordedPlayerHandleTwoReturnValues(void); -static void RecordedPlayerHandleChosenMonReturnValue(void); -static void RecordedPlayerHandleOneReturnValue(void); -static void RecordedPlayerHandleOneReturnValue_Duplicate(void); -static void RecordedPlayerHandleClearUnkVar(void); -static void RecordedPlayerHandleSetUnkVar(void); -static void RecordedPlayerHandleClearUnkFlag(void); -static void RecordedPlayerHandleToggleUnkFlag(void); -static void RecordedPlayerHandleHitAnimation(void); -static void RecordedPlayerHandleCantSwitch(void); -static void RecordedPlayerHandlePlaySE(void); -static void RecordedPlayerHandlePlayFanfareOrBGM(void); -static void RecordedPlayerHandleFaintingCry(void); -static void RecordedPlayerHandleIntroSlide(void); -static void RecordedPlayerHandleIntroTrainerBallThrow(void); -static void RecordedPlayerHandleDrawPartyStatusSummary(void); -static void RecordedPlayerHandleHidePartyStatusSummary(void); -static void RecordedPlayerHandleEndBounceEffect(void); -static void RecordedPlayerHandleSpriteInvisibility(void); -static void RecordedPlayerHandleBattleAnimation(void); -static void RecordedPlayerHandleLinkStandbyMsg(void); -static void RecordedPlayerHandleResetActionMoveSelection(void); -static void RecordedPlayerHandleEndLinkBattle(void); -static void RecordedPlayerCmdEnd(void); - -static void RecordedPlayerBufferRunCommand(void); -static void RecordedPlayerBufferExecCompleted(void); -static void SwitchIn_WaitAndEnd(void); -static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst); -static void SetRecordedPlayerMonData(u8 monId); -static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit); -static void DoSwitchOutAnimation(void); -static void RecordedPlayerDoMoveAnimation(void); -static void Task_StartSendOutAnim(u8 taskId); -static void EndDrawPartyStatusSummary(void); - -static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = -{ - [CONTROLLER_GETMONDATA] = RecordedPlayerHandleGetMonData, - [CONTROLLER_GETRAWMONDATA] = RecordedPlayerHandleGetRawMonData, - [CONTROLLER_SETMONDATA] = RecordedPlayerHandleSetMonData, - [CONTROLLER_SETRAWMONDATA] = RecordedPlayerHandleSetRawMonData, +#include "constants/trainers.h" + +static void RecordedPlayerHandleLoadMonSprite(u32 battler); +static void RecordedPlayerHandleSwitchInAnim(u32 battler); +static void RecordedPlayerHandleDrawTrainerPic(u32 battler); +static void RecordedPlayerHandleTrainerSlideBack(u32 battler); +static void RecordedPlayerHandleMoveAnimation(u32 battler); +static void RecordedPlayerHandlePrintString(u32 battler); +static void RecordedPlayerHandleChooseAction(u32 battler); +static void RecordedPlayerHandleChooseMove(u32 battler); +static void RecordedPlayerHandleChooseItem(u32 battler); +static void RecordedPlayerHandleChoosePokemon(u32 battler); +static void RecordedPlayerHandleHealthBarUpdate(u32 battler); +static void RecordedPlayerHandleStatusIconUpdate(u32 battler); +static void RecordedPlayerHandleStatusAnimation(u32 battler); +static void RecordedPlayerHandleIntroTrainerBallThrow(u32 battler); +static void RecordedPlayerHandleDrawPartyStatusSummary(u32 battler); +static void RecordedPlayerHandleBattleAnimation(u32 battler); +static void RecordedPlayerHandleEndLinkBattle(u32 battler); + +static void RecordedPlayerBufferRunCommand(u32 battler); +static void RecordedPlayerBufferExecCompleted(u32 battler); +static void SwitchIn_WaitAndEnd(u32 battler); + +static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(u32 battler) = +{ + [CONTROLLER_GETMONDATA] = BtlController_HandleGetMonData, + [CONTROLLER_GETRAWMONDATA] = BtlController_Empty, + [CONTROLLER_SETMONDATA] = BtlController_HandleSetMonData, + [CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData, [CONTROLLER_LOADMONSPRITE] = RecordedPlayerHandleLoadMonSprite, [CONTROLLER_SWITCHINANIM] = RecordedPlayerHandleSwitchInAnim, - [CONTROLLER_RETURNMONTOBALL] = RecordedPlayerHandleReturnMonToBall, + [CONTROLLER_RETURNMONTOBALL] = BtlController_HandleReturnMonToBall, [CONTROLLER_DRAWTRAINERPIC] = RecordedPlayerHandleDrawTrainerPic, - [CONTROLLER_TRAINERSLIDE] = RecordedPlayerHandleTrainerSlide, + [CONTROLLER_TRAINERSLIDE] = BtlController_Empty, [CONTROLLER_TRAINERSLIDEBACK] = RecordedPlayerHandleTrainerSlideBack, - [CONTROLLER_FAINTANIMATION] = RecordedPlayerHandleFaintAnimation, - [CONTROLLER_PALETTEFADE] = RecordedPlayerHandlePaletteFade, - [CONTROLLER_SUCCESSBALLTHROWANIM] = RecordedPlayerHandleSuccessBallThrowAnim, - [CONTROLLER_BALLTHROWANIM] = RecordedPlayerHandleBallThrowAnim, - [CONTROLLER_PAUSE] = RecordedPlayerHandlePause, + [CONTROLLER_FAINTANIMATION] = BtlController_HandleFaintAnimation, + [CONTROLLER_PALETTEFADE] = BtlController_Empty, + [CONTROLLER_SUCCESSBALLTHROWANIM] = BtlController_Empty, + [CONTROLLER_BALLTHROWANIM] = BtlController_Empty, + [CONTROLLER_PAUSE] = BtlController_Empty, [CONTROLLER_MOVEANIMATION] = RecordedPlayerHandleMoveAnimation, [CONTROLLER_PRINTSTRING] = RecordedPlayerHandlePrintString, - [CONTROLLER_PRINTSTRINGPLAYERONLY] = RecordedPlayerHandlePrintSelectionString, + [CONTROLLER_PRINTSTRINGPLAYERONLY] = BtlController_Empty, [CONTROLLER_CHOOSEACTION] = RecordedPlayerHandleChooseAction, - [CONTROLLER_YESNOBOX] = RecordedPlayerHandleYesNoBox, + [CONTROLLER_YESNOBOX] = BtlController_Empty, [CONTROLLER_CHOOSEMOVE] = RecordedPlayerHandleChooseMove, [CONTROLLER_OPENBAG] = RecordedPlayerHandleChooseItem, [CONTROLLER_CHOOSEPOKEMON] = RecordedPlayerHandleChoosePokemon, - [CONTROLLER_23] = RecordedPlayerHandleCmd23, + [CONTROLLER_23] = BtlController_Empty, [CONTROLLER_HEALTHBARUPDATE] = RecordedPlayerHandleHealthBarUpdate, - [CONTROLLER_EXPUPDATE] = RecordedPlayerHandleExpUpdate, + [CONTROLLER_EXPUPDATE] = BtlController_Empty, [CONTROLLER_STATUSICONUPDATE] = RecordedPlayerHandleStatusIconUpdate, [CONTROLLER_STATUSANIMATION] = RecordedPlayerHandleStatusAnimation, - [CONTROLLER_STATUSXOR] = RecordedPlayerHandleStatusXor, - [CONTROLLER_DATATRANSFER] = RecordedPlayerHandleDataTransfer, - [CONTROLLER_DMA3TRANSFER] = RecordedPlayerHandleDMA3Transfer, - [CONTROLLER_PLAYBGM] = RecordedPlayerHandlePlayBGM, - [CONTROLLER_32] = RecordedPlayerHandleCmd32, - [CONTROLLER_TWORETURNVALUES] = RecordedPlayerHandleTwoReturnValues, - [CONTROLLER_CHOSENMONRETURNVALUE] = RecordedPlayerHandleChosenMonReturnValue, - [CONTROLLER_ONERETURNVALUE] = RecordedPlayerHandleOneReturnValue, - [CONTROLLER_ONERETURNVALUE_DUPLICATE] = RecordedPlayerHandleOneReturnValue_Duplicate, - [CONTROLLER_CLEARUNKVAR] = RecordedPlayerHandleClearUnkVar, - [CONTROLLER_SETUNKVAR] = RecordedPlayerHandleSetUnkVar, - [CONTROLLER_CLEARUNKFLAG] = RecordedPlayerHandleClearUnkFlag, - [CONTROLLER_TOGGLEUNKFLAG] = RecordedPlayerHandleToggleUnkFlag, - [CONTROLLER_HITANIMATION] = RecordedPlayerHandleHitAnimation, - [CONTROLLER_CANTSWITCH] = RecordedPlayerHandleCantSwitch, - [CONTROLLER_PLAYSE] = RecordedPlayerHandlePlaySE, - [CONTROLLER_PLAYFANFAREORBGM] = RecordedPlayerHandlePlayFanfareOrBGM, - [CONTROLLER_FAINTINGCRY] = RecordedPlayerHandleFaintingCry, - [CONTROLLER_INTROSLIDE] = RecordedPlayerHandleIntroSlide, + [CONTROLLER_STATUSXOR] = BtlController_Empty, + [CONTROLLER_DATATRANSFER] = BtlController_Empty, + [CONTROLLER_DMA3TRANSFER] = BtlController_Empty, + [CONTROLLER_PLAYBGM] = BtlController_Empty, + [CONTROLLER_32] = BtlController_Empty, + [CONTROLLER_TWORETURNVALUES] = BtlController_Empty, + [CONTROLLER_CHOSENMONRETURNVALUE] = BtlController_Empty, + [CONTROLLER_ONERETURNVALUE] = BtlController_Empty, + [CONTROLLER_ONERETURNVALUE_DUPLICATE] = BtlController_Empty, + [CONTROLLER_CLEARUNKVAR] = BtlController_HandleClearUnkVar, + [CONTROLLER_SETUNKVAR] = BtlController_HandleSetUnkVar, + [CONTROLLER_CLEARUNKFLAG] = BtlController_HandleClearUnkFlag, + [CONTROLLER_TOGGLEUNKFLAG] = BtlController_HandleToggleUnkFlag, + [CONTROLLER_HITANIMATION] = BtlController_HandleHitAnimation, + [CONTROLLER_CANTSWITCH] = BtlController_Empty, + [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, + [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, + [CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry, + [CONTROLLER_INTROSLIDE] = BtlController_HandleIntroSlide, [CONTROLLER_INTROTRAINERBALLTHROW] = RecordedPlayerHandleIntroTrainerBallThrow, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = RecordedPlayerHandleDrawPartyStatusSummary, - [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = RecordedPlayerHandleHidePartyStatusSummary, - [CONTROLLER_ENDBOUNCE] = RecordedPlayerHandleEndBounceEffect, - [CONTROLLER_SPRITEINVISIBILITY] = RecordedPlayerHandleSpriteInvisibility, + [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = BtlController_HandleHidePartyStatusSummary, + [CONTROLLER_ENDBOUNCE] = BtlController_Empty, + [CONTROLLER_SPRITEINVISIBILITY] = BtlController_HandleSpriteInvisibility, [CONTROLLER_BATTLEANIMATION] = RecordedPlayerHandleBattleAnimation, - [CONTROLLER_LINKSTANDBYMSG] = RecordedPlayerHandleLinkStandbyMsg, - [CONTROLLER_RESETACTIONMOVESELECTION] = RecordedPlayerHandleResetActionMoveSelection, + [CONTROLLER_LINKSTANDBYMSG] = BtlController_Empty, + [CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty, [CONTROLLER_ENDLINKBATTLE] = RecordedPlayerHandleEndLinkBattle, - [CONTROLLER_TERMINATOR_NOP] = RecordedPlayerCmdEnd + [CONTROLLER_DEBUGMENU] = BtlController_Empty, + [CONTROLLER_TERMINATOR_NOP] = BtlController_TerminatorNop }; -static void RecordedPlayerDummy(void) -{ -} - -void SetControllerToRecordedPlayer(void) +void SetControllerToRecordedPlayer(u32 battler) { - gBattlerControllerFuncs[gActiveBattler] = RecordedPlayerBufferRunCommand; + gBattlerControllerEndFuncs[battler] = RecordedPlayerBufferExecCompleted; + gBattlerControllerFuncs[battler] = RecordedPlayerBufferRunCommand; } -static void RecordedPlayerBufferRunCommand(void) +static void RecordedPlayerBufferRunCommand(u32 battler) { - if (gBattleControllerExecFlags & gBitTable[gActiveBattler]) + if (gBattleControllerExecFlags & gBitTable[battler]) { - if (gBattleResources->bufferA[gActiveBattler][0] < ARRAY_COUNT(sRecordedPlayerBufferCommands)) - sRecordedPlayerBufferCommands[gBattleResources->bufferA[gActiveBattler][0]](); + if (gBattleResources->bufferA[battler][0] < ARRAY_COUNT(sRecordedPlayerBufferCommands)) + sRecordedPlayerBufferCommands[gBattleResources->bufferA[battler][0]](battler); else - RecordedPlayerBufferExecCompleted(); + RecordedPlayerBufferExecCompleted(battler); } } -static void CompleteOnBattlerSpriteCallbackDummy(void) +static void Intro_DelayAndEnd(u32 battler) { - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - RecordedPlayerBufferExecCompleted(); -} - -static void FreeTrainerSpriteAfterSlide(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (--gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay == (u8)-1) { - BattleGfxSfxDummy3(MALE); - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - RecordedPlayerBufferExecCompleted(); + gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay = 0; + RecordedPlayerBufferExecCompleted(battler); } } -static void Intro_DelayAndEnd(void) -{ - if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay == (u8)-1) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0; - RecordedPlayerBufferExecCompleted(); - } -} - -static void Intro_WaitForShinyAnimAndHealthbox(void) +static void Intro_WaitForShinyAnimAndHealthbox(u32 battler) { bool32 healthboxAnimDone = FALSE; - if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_LEFT) + if (GetBattlerPosition(battler) == B_POSITION_PLAYER_LEFT) { if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy) healthboxAnimDone = TRUE; } else { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy + && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(battler)]].callback == SpriteCallbackDummy) { healthboxAnimDone = TRUE; } } - if (healthboxAnimDone && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim - && gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) + if (healthboxAnimDone && gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim + && gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].finishedShinyMonAnim) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[battler]], battler); if (IsDoubleBattle()) - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], BATTLE_PARTNER(gActiveBattler)); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]], BATTLE_PARTNER(battler)); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; - gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; + gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay = 3; + gBattlerControllerFuncs[battler] = Intro_DelayAndEnd; } } else { if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy) healthboxAnimDone = TRUE; } else { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy + && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(battler)]].callback == SpriteCallbackDummy) { healthboxAnimDone = TRUE; } @@ -265,55 +200,55 @@ static void Intro_WaitForShinyAnimAndHealthbox(void) if (healthboxAnimDone) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; - gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; + gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay = 3; + gBattlerControllerFuncs[battler] = Intro_DelayAndEnd; } } } -static void Intro_TryShinyAnimShowHealthbox(void) +static void Intro_TryShinyAnimShowHealthbox(u32 battler) { bool32 bgmRestored = FALSE; - if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_LEFT) + if (GetBattlerPosition(battler) == B_POSITION_PLAYER_LEFT) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) - TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); + if (!gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive) + TryShinyAnimation(battler, &gPlayerParty[gBattlerPartyIndexes[battler]]); - if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) - TryShinyAnimation(BATTLE_PARTNER(gActiveBattler), &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]); + if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].ballAnimActive) + TryShinyAnimation(BATTLE_PARTNER(battler), &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]]); } - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].ballAnimActive) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].healthboxSlideInStarted) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); - StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(battler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]], HEALTHBOX_ALL); + StartHealthboxSlideIn(BATTLE_PARTNER(battler)); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(battler)]); } - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], &gPlayerParty[gBattlerPartyIndexes[battler]], HEALTHBOX_ALL); + StartHealthboxSlideIn(battler); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[battler]); } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = TRUE; + gBattleSpritesDataPtr->healthBoxesData[battler].healthboxSlideInStarted = TRUE; } - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].waitForCry + if (gBattleSpritesDataPtr->healthBoxesData[battler].healthboxSlideInStarted + && !gBattleSpritesDataPtr->healthBoxesData[battler].waitForCry + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].waitForCry && !IsCryPlayingOrClearCrySongs()) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].bgmRestored) { if ((gBattleTypeFlags & BATTLE_TYPE_LINK) && (gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_LEFT) + if (GetBattlerPosition(battler) == B_POSITION_PLAYER_LEFT) m4aMPlayContinue(&gMPlayInfo_BGM); } else @@ -322,877 +257,124 @@ static void Intro_TryShinyAnimShowHealthbox(void) } } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = TRUE; + gBattleSpritesDataPtr->healthBoxesData[battler].bgmRestored = TRUE; bgmRestored = TRUE; } - if (bgmRestored && gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (bgmRestored && gSprites[gBattleControllerData[battler]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) - DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(battler)]]); - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); + DestroySprite(&gSprites[gBattleControllerData[battler]]); gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = FALSE; - gBattlerControllerFuncs[gActiveBattler] = Intro_WaitForShinyAnimAndHealthbox; + gBattleSpritesDataPtr->healthBoxesData[battler].bgmRestored = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].healthboxSlideInStarted = FALSE; + gBattlerControllerFuncs[battler] = Intro_WaitForShinyAnimAndHealthbox; } } -static void WaitForMonAnimAfterLoad(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].animEnded && gSprites[gBattlerSpriteIds[gActiveBattler]].x2 == 0) - RecordedPlayerBufferExecCompleted(); -} - -static void CompleteOnHealthbarDone(void) +static void WaitForMonAnimAfterLoad(u32 battler) { - s16 hpValue = MoveBattleBar(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0); - - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - - if (hpValue != -1) - { - UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], HP_CURRENT, hpValue, gBattleMons[gActiveBattler].maxHP); - } - else - { - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - RecordedPlayerBufferExecCompleted(); - } -} - -static void FreeMonSpriteAfterFaintAnim(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].y + gSprites[gBattlerSpriteIds[gActiveBattler]].y2 > DISPLAY_HEIGHT) - { - u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - - BattleGfxSfxDummy2(species); - FreeOamMatrix(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.matrixNum); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - RecordedPlayerBufferExecCompleted(); - } -} - -static void FreeMonSpriteAfterSwitchOutAnim(void) -{ - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - RecordedPlayerBufferExecCompleted(); - } -} - -static void CompleteOnInactiveTextPrinter(void) -{ - if (!IsTextPrinterActive(B_WIN_MSG)) - RecordedPlayerBufferExecCompleted(); -} - -static void DoHitAnimBlinkSpriteEffect(void) -{ - u8 spriteId = gBattlerSpriteIds[gActiveBattler]; - - if (gSprites[spriteId].data[1] == 32) - { - gSprites[spriteId].data[1] = 0; - gSprites[spriteId].invisible = FALSE; - gDoingBattleAnim = FALSE; - RecordedPlayerBufferExecCompleted(); - } - else - { - if ((gSprites[spriteId].data[1] % 4) == 0) - gSprites[spriteId].invisible ^= 1; - gSprites[spriteId].data[1]++; - } + if (gSprites[gBattlerSpriteIds[battler]].animEnded && gSprites[gBattlerSpriteIds[battler]].x2 == 0) + RecordedPlayerBufferExecCompleted(battler); } -static void SwitchIn_ShowSubstitute(void) +static void SwitchIn_ShowSubstitute(u32 battler) { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy) { - CopyBattleSpriteInvisibility(gActiveBattler); - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); + CopyBattleSpriteInvisibility(battler); + if (gBattleSpritesDataPtr->battlerData[battler].behindSubstitute) + InitAndLaunchSpecialAnimation(battler, battler, battler, B_ANIM_MON_TO_SUBSTITUTE); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_WaitAndEnd; + gBattlerControllerFuncs[battler] = SwitchIn_WaitAndEnd; } } -static void SwitchIn_WaitAndEnd(void) +static void SwitchIn_WaitAndEnd(u32 battler) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive - && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].specialAnimActive + && gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy) { - RecordedPlayerBufferExecCompleted(); + RecordedPlayerBufferExecCompleted(battler); } } -static void SwitchIn_ShowHealthbox(void) +static void SwitchIn_ShowHealthbox(u32 battler) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) + if (gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); CreateTask(Task_PlayerController_RestoreBgmAfterCry, 10); - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0); - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[battler]], battler); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[battler]], 0); + UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], &gPlayerParty[gBattlerPartyIndexes[battler]], HEALTHBOX_ALL); + StartHealthboxSlideIn(battler); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[battler]); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowSubstitute; + gBattlerControllerFuncs[battler] = SwitchIn_ShowSubstitute; } } -static void SwitchIn_TryShinyAnim(void) +static void SwitchIn_TryShinyAnim(u32 battler) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive) { - TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); + TryShinyAnimation(battler, &gPlayerParty[gBattlerPartyIndexes[battler]]); } - if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) + if (gSprites[gBattleControllerData[battler]].callback == SpriteCallbackDummy + && !gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive) { - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowHealthbox; + DestroySprite(&gSprites[gBattleControllerData[battler]]); + gBattlerControllerFuncs[battler] = SwitchIn_ShowHealthbox; } } -static void RecordedPlayerBufferExecCompleted(void) +static void RecordedPlayerBufferExecCompleted(u32 battler) { - gBattlerControllerFuncs[gActiveBattler] = RecordedPlayerBufferRunCommand; + gBattlerControllerFuncs[battler] = RecordedPlayerBufferRunCommand; if (gBattleTypeFlags & BATTLE_TYPE_LINK) { u8 playerId = GetMultiplayerId(); - PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleResources->bufferA[gActiveBattler][0] = CONTROLLER_TERMINATOR_NOP; - } - else - { - gBattleControllerExecFlags &= ~gBitTable[gActiveBattler]; - } -} - -static void CompleteOnFinishedStatusAnimation(void) -{ - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].statusAnimActive) - RecordedPlayerBufferExecCompleted(); -} - -static void CompleteOnFinishedBattleAnimation(void) -{ - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive) - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleGetMonData(void) -{ - u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data - u32 size = 0; - u8 monToCheck; - s32 i; - - if (gBattleResources->bufferA[gActiveBattler][2] == 0) - { - size += CopyRecordedPlayerMonData(gBattlerPartyIndexes[gActiveBattler], monData); - } - else - { - monToCheck = gBattleResources->bufferA[gActiveBattler][2]; - for (i = 0; i < PARTY_SIZE; i++) - { - if (monToCheck & 1) - size += CopyRecordedPlayerMonData(i, monData + size); - monToCheck >>= 1; - } - } - BtlController_EmitDataTransfer(BUFFER_B, size, monData); - RecordedPlayerBufferExecCompleted(); -} - -static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst) -{ - struct BattlePokemon battleMon; - struct MovePpInfo moveData; - u8 nickname[20]; - u8 *src; - s16 data16; - u32 data32; - s32 size = 0; - - switch (gBattleResources->bufferA[gActiveBattler][1]) - { - case REQUEST_ALL_BATTLE: - battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); - battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); - for (size = 0; size < MAX_MON_MOVES; size++) - { - battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); - battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); - } - battleMon.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); - battleMon.friendship = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); - battleMon.experience = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); - battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); - battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); - battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); - battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); - battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); - battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); - battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); - battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); - battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP); - battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); - battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); - battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); - battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); - battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); - battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); - battleMon.abilityNum = GetMonData(&gPlayerParty[monId], MON_DATA_ABILITY_NUM); - battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); - battleMon.metLevel = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL); - GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname); - StringCopy_Nickname(battleMon.nickname, nickname); - GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName); - src = (u8 *)&battleMon; - for (size = 0; size < sizeof(battleMon); size++) - dst[size] = src[size]; - break; - case REQUEST_SPECIES_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_HELDITEM_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_MOVES_PP_BATTLE: - for (size = 0; size < MAX_MON_MOVES; size++) - { - moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); - moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); - } - moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); - src = (u8 *)(&moveData); - for (size = 0; size < sizeof(moveData); size++) - dst[size] = src[size]; - break; - case REQUEST_MOVE1_BATTLE: - case REQUEST_MOVE2_BATTLE: - case REQUEST_MOVE3_BATTLE: - case REQUEST_MOVE4_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_PP_DATA_BATTLE: - for (size = 0; size < MAX_MON_MOVES; size++) - dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); - dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); - size++; - break; - case REQUEST_PPMOVE1_BATTLE: - case REQUEST_PPMOVE2_BATTLE: - case REQUEST_PPMOVE3_BATTLE: - case REQUEST_PPMOVE4_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE); - size = 1; - break; - case REQUEST_OTID_BATTLE: - data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - size = 3; - break; - case REQUEST_EXP_BATTLE: - data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - size = 3; - break; - case REQUEST_HP_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV); - size = 1; - break; - case REQUEST_ATK_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV); - size = 1; - break; - case REQUEST_DEF_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV); - size = 1; - break; - case REQUEST_SPEED_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV); - size = 1; - break; - case REQUEST_SPATK_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV); - size = 1; - break; - case REQUEST_SPDEF_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV); - size = 1; - break; - case REQUEST_FRIENDSHIP_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); - size = 1; - break; - case REQUEST_POKERUS_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS); - size = 1; - break; - case REQUEST_MET_LOCATION_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION); - size = 1; - break; - case REQUEST_MET_LEVEL_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL); - size = 1; - break; - case REQUEST_MET_GAME_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME); - size = 1; - break; - case REQUEST_POKEBALL_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL); - size = 1; - break; - case REQUEST_ALL_IVS_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); - dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); - dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); - dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); - dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); - size = 6; - break; - case REQUEST_HP_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); - size = 1; - break; - case REQUEST_ATK_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); - size = 1; - break; - case REQUEST_DEF_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - size = 1; - break; - case REQUEST_SPEED_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); - size = 1; - break; - case REQUEST_SPATK_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); - size = 1; - break; - case REQUEST_SPDEF_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); - size = 1; - break; - case REQUEST_PERSONALITY_BATTLE: - data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - dst[3] = (data32 & 0xFF000000) >> 24; - size = 4; - break; - case REQUEST_CHECKSUM_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_STATUS_BATTLE: - data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - dst[3] = (data32 & 0xFF000000) >> 24; - size = 4; - break; - case REQUEST_LEVEL_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); - size = 1; - break; - case REQUEST_HP_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_MAX_HP_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_ATK_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_DEF_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPEED_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPATK_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPDEF_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_COOL_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL); - size = 1; - break; - case REQUEST_BEAUTY_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY); - size = 1; - break; - case REQUEST_CUTE_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE); - size = 1; - break; - case REQUEST_SMART_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART); - size = 1; - break; - case REQUEST_TOUGH_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH); - size = 1; - break; - case REQUEST_SHEEN_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN); - size = 1; - break; - case REQUEST_COOL_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON); - size = 1; - break; - case REQUEST_BEAUTY_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON); - size = 1; - break; - case REQUEST_CUTE_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON); - size = 1; - break; - case REQUEST_SMART_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON); - size = 1; - break; - case REQUEST_TOUGH_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON); - size = 1; - break; - } - - return size; -} - -static void RecordedPlayerHandleGetRawMonData(void) -{ - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleSetMonData(void) -{ - u8 monToCheck; - u8 i; - - if (gBattleResources->bufferA[gActiveBattler][2] == 0) - { - SetRecordedPlayerMonData(gBattlerPartyIndexes[gActiveBattler]); + PrepareBufferDataTransferLink(battler, 2, 4, &playerId); + gBattleResources->bufferA[battler][0] = CONTROLLER_TERMINATOR_NOP; } else { - monToCheck = gBattleResources->bufferA[gActiveBattler][2]; - for (i = 0; i < PARTY_SIZE; i++) - { - if (monToCheck & 1) - SetRecordedPlayerMonData(i); - monToCheck >>= 1; - } + gBattleControllerExecFlags &= ~gBitTable[battler]; } - RecordedPlayerBufferExecCompleted(); } -static void SetRecordedPlayerMonData(u8 monId) +static void RecordedPlayerHandleLoadMonSprite(u32 battler) { - struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleResources->bufferA[gActiveBattler][3]; - struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleResources->bufferA[gActiveBattler][3]; - s32 i; - - switch (gBattleResources->bufferA[gActiveBattler][1]) - { - case REQUEST_ALL_BATTLE: - { - u8 iv; - - SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species); - SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); - for (i = 0; i < MAX_MON_MOVES; i++) - { - SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); - } - SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); - SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); - SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &battlePokemon->experience); - iv = battlePokemon->hpIV; - SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &iv); - iv = battlePokemon->attackIV; - SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &iv); - iv = battlePokemon->defenseIV; - SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv); - iv = battlePokemon->speedIV; - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &iv); - iv = battlePokemon->spAttackIV; - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv); - iv = battlePokemon->spDefenseIV; - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv); - SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); - SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1); - SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level); - SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp); - SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); - SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack); - SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense); - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &battlePokemon->speed); - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); - } - break; - case REQUEST_SPECIES_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HELDITEM_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MOVES_PP_BATTLE: - for (i = 0; i < MAX_MON_MOVES; i++) - { - SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); - } - SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); - break; - case REQUEST_MOVE1_BATTLE: - case REQUEST_MOVE2_BATTLE: - case REQUEST_MOVE3_BATTLE: - case REQUEST_MOVE4_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_PP_DATA_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleResources->bufferA[gActiveBattler][3]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleResources->bufferA[gActiveBattler][4]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleResources->bufferA[gActiveBattler][5]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleResources->bufferA[gActiveBattler][6]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleResources->bufferA[gActiveBattler][7]); - break; - case REQUEST_PPMOVE1_BATTLE: - case REQUEST_PPMOVE2_BATTLE: - case REQUEST_PPMOVE3_BATTLE: - case REQUEST_PPMOVE4_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_OTID_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_EXP_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HP_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_FRIENDSHIP_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_POKERUS_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_LOCATION_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_LEVEL_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_GAME_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_POKEBALL_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ALL_IVS_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]); - SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][4]); - SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][5]); - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][6]); - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][7]); - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][8]); - break; - case REQUEST_HP_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_PERSONALITY_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CHECKSUM_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_STATUS_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_LEVEL_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HP_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MAX_HP_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_COOL_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_BEAUTY_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CUTE_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SMART_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_TOUGH_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SHEEN_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_COOL_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_BEAUTY_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CUTE_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SMART_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_TOUGH_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - } - - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); -} - -static void RecordedPlayerHandleSetRawMonData(void) -{ - u8 *dst = (u8 *)&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleResources->bufferA[gActiveBattler][1]; - u8 i; - - for (i = 0; i < gBattleResources->bufferA[gActiveBattler][2]; i++) - dst[i] = gBattleResources->bufferA[gActiveBattler][3 + i]; - - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleLoadMonSprite(void) -{ - u16 species; - - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler)); - - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(gActiveBattler, BATTLER_COORD_X_2), - GetBattlerSpriteDefault_Y(gActiveBattler), - GetBattlerSpriteSubpriority(gActiveBattler)); - gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = -DISPLAY_WIDTH; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); - gBattlerControllerFuncs[gActiveBattler] = WaitForMonAnimAfterLoad; -} - -static void RecordedPlayerHandleSwitchInAnim(void) -{ - ClearTemporarySpeciesSpriteData(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); - gBattlerPartyIndexes[gActiveBattler] = gBattleResources->bufferA[gActiveBattler][1]; - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - StartSendOutAnim(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); - gBattlerControllerFuncs[gActiveBattler] = SwitchIn_TryShinyAnim; -} - -static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) -{ - u16 species; - - ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit); - gBattlerPartyIndexes[battlerId] = gBattleResources->bufferA[battlerId][1]; - species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); - gBattleControllerData[battlerId] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim); - SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId)); - - gBattlerSpriteIds[battlerId] = CreateSprite( - &gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2), - GetBattlerSpriteDefault_Y(battlerId), - GetBattlerSpriteSubpriority(battlerId)); - - gSprites[gBattleControllerData[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; - gSprites[gBattleControllerData[battlerId]].data[2] = battlerId; - - gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId; - gSprites[gBattlerSpriteIds[battlerId]].data[2] = species; - gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId; - - StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]); - - gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE; - gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy; - - gSprites[gBattleControllerData[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT); -} - -static void RecordedPlayerHandleReturnMonToBall(void) -{ - if (gBattleResources->bufferA[gActiveBattler][1] == 0) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation; - } - else - { - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - RecordedPlayerBufferExecCompleted(); - } + BtlController_HandleLoadMonSprite(battler, WaitForMonAnimAfterLoad); } -static void DoSwitchOutAnimation(void) +static void RecordedPlayerHandleSwitchInAnim(u32 battler) { - switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState) - { - case 0: - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON); - - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1; - break; - case 1: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON); - gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim; - } - break; - } + BtlController_HandleSwitchInAnim(battler, TRUE, SwitchIn_TryShinyAnim); } -#define sSpeedX data[0] - -static void RecordedPlayerHandleDrawTrainerPic(void) +static void RecordedPlayerHandleDrawTrainerPic(u32 battler) { + bool32 isFrontPic; s16 xPos, yPos; u32 trainerPicId; if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI) - trainerPicId = GetActiveBattlerLinkPlayerGender(); + trainerPicId = GetBattlerLinkPlayerGender(battler); else trainerPicId = gLinkPlayers[gRecordedBattleMultiplayerId].gender; } @@ -1203,7 +385,7 @@ static void RecordedPlayerHandleDrawTrainerPic(void) if (gBattleTypeFlags & BATTLE_TYPE_MULTI) { - if ((GetBattlerPosition(gActiveBattler) & BIT_FLANK) != 0) // second mon + if ((GetBattlerPosition(battler) & BIT_FLANK) != 0) // second mon xPos = 90; else // first mon xPos = 32; @@ -1226,606 +408,173 @@ static void RecordedPlayerHandleDrawTrainerPic(void) } if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) - { - trainerPicId = PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender); - DecompressTrainerFrontPic(trainerPicId, gActiveBattler); - SetMultiuseSpriteTemplateToTrainerFront(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, GetBattlerSpriteSubpriority(gActiveBattler)); - - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); - gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = DISPLAY_WIDTH; - gSprites[gBattlerSpriteIds[gActiveBattler]].y2 = 48; - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineMode = ST_OAM_AFFINE_OFF; - gSprites[gBattlerSpriteIds[gActiveBattler]].hFlip = 1; - } + isFrontPic = TRUE; else - { - DecompressTrainerBackPic(trainerPicId, gActiveBattler); - SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, GetBattlerSpriteSubpriority(gActiveBattler)); - - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = DISPLAY_WIDTH; - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; - } + isFrontPic = FALSE; - gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy; + BtlController_HandleDrawTrainerPic(battler, trainerPicId, isFrontPic, xPos, yPos, -1); } -#undef sSpeedX - -static void RecordedPlayerHandleTrainerSlide(void) +static void RecordedPlayerHandleTrainerSlideBack(u32 battler) { - RecordedPlayerBufferExecCompleted(); + BtlController_HandleTrainerSlideBack(battler, 35, FALSE); } -static void RecordedPlayerHandleTrainerSlideBack(void) +static void RecordedPlayerHandleMoveAnimation(u32 battler) { - SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].y; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); - gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; + BtlController_HandleMoveAnimation(battler, FALSE); } -#define sSpeedX data[1] -#define sSpeedY data[2] - -static void RecordedPlayerHandleFaintAnimation(void) -{ - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState == 0) - { - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState++; - } - else - { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - PlaySE12WithPanning(SE_FAINT, -64); - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 0; - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedY = 5; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintSlideAnim; - gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterFaintAnim; - } - } -} - -#undef sSpeedX -#undef sSpeedY - -static void RecordedPlayerHandlePaletteFade(void) -{ - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleSuccessBallThrowAnim(void) -{ - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleBallThrowAnim(void) -{ - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandlePause(void) -{ - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleMoveAnimation(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) - { - u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); - - gAnimMoveTurn = gBattleResources->bufferA[gActiveBattler][3]; - gAnimMovePower = gBattleResources->bufferA[gActiveBattler][4] | (gBattleResources->bufferA[gActiveBattler][5] << 8); - gAnimMoveDmg = gBattleResources->bufferA[gActiveBattler][6] | (gBattleResources->bufferA[gActiveBattler][7] << 8) | (gBattleResources->bufferA[gActiveBattler][8] << 16) | (gBattleResources->bufferA[gActiveBattler][9] << 24); - gAnimFriendship = gBattleResources->bufferA[gActiveBattler][10]; - gWeatherMoveAnim = gBattleResources->bufferA[gActiveBattler][12] | (gBattleResources->bufferA[gActiveBattler][13] << 8); - gAnimDisableStructPtr = (struct DisableStruct *)&gBattleResources->bufferA[gActiveBattler][16]; - gTransformedPersonalities[gActiveBattler] = gAnimDisableStructPtr->transformedMonPersonality; - gTransformedOtIds[gActiveBattler] = gAnimDisableStructPtr->transformedMonOtId; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerControllerFuncs[gActiveBattler] = RecordedPlayerDoMoveAnimation; - } -} - -static void RecordedPlayerDoMoveAnimation(void) -{ - u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); - u8 multihit = gBattleResources->bufferA[gActiveBattler][11]; - - switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState) - { - case 0: - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute - && !gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8) - { - gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 1; - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON); - } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1; - break; - case 1: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF); - DoMoveAnim(move); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2; - } - break; - case 2: - gAnimScriptCallback(); - if (!gAnimScriptActive) - { - SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL); - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2) - { - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 0; - } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 3; - } - break; - case 3: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - CopyAllBattleSpritesInvisibilities(); - TrySetBehindSubstituteSpriteBit(gActiveBattler, gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - RecordedPlayerBufferExecCompleted(); - } - break; - } -} - -static void RecordedPlayerHandlePrintString(void) +static void RecordedPlayerHandlePrintString(u32 battler) { u16 *stringId; gBattle_BG0_X = 0; gBattle_BG0_Y = 0; - stringId = (u16 *)(&gBattleResources->bufferA[gActiveBattler][2]); - BufferStringBattle(*stringId); + stringId = (u16 *)(&gBattleResources->bufferA[battler][2]); + BufferStringBattle(*stringId, battler); if (gTestRunnerEnabled) { TestRunner_Battle_RecordMessage(gDisplayedStringBattle); if (gTestRunnerHeadless) { - RecordedPlayerBufferExecCompleted(); + RecordedPlayerBufferExecCompleted(battler); return; } } BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG); - gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; -} - -static void RecordedPlayerHandlePrintSelectionString(void) -{ - RecordedPlayerBufferExecCompleted(); + gBattlerControllerFuncs[battler] = Controller_WaitForString; } -static void ChooseActionInBattlePalace(void) +static void ChooseActionInBattlePalace(u32 battler) { if (gBattleCommunication[4] >= gBattlersCount / 2) { - BtlController_EmitTwoReturnValues(BUFFER_B, RecordedBattle_GetBattlerAction(RECORDED_BATTLE_PALACE_ACTION, gActiveBattler), 0); - RecordedPlayerBufferExecCompleted(); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, RecordedBattle_GetBattlerAction(RECORDED_BATTLE_PALACE_ACTION, battler), 0); + RecordedPlayerBufferExecCompleted(battler); } } -static void RecordedPlayerHandleChooseAction(void) +static void RecordedPlayerHandleChooseAction(u32 battler) { if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gBattlerControllerFuncs[gActiveBattler] = ChooseActionInBattlePalace; + gBattlerControllerFuncs[battler] = ChooseActionInBattlePalace; } else { - BtlController_EmitTwoReturnValues(BUFFER_B, RecordedBattle_GetBattlerAction(RECORDED_ACTION_TYPE, gActiveBattler), 0); - RecordedPlayerBufferExecCompleted(); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, RecordedBattle_GetBattlerAction(RECORDED_ACTION_TYPE, battler), 0); + RecordedPlayerBufferExecCompleted(battler); } } -static void RecordedPlayerHandleYesNoBox(void) -{ - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleChooseMove(void) +static void RecordedPlayerHandleChooseMove(u32 battler) { if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - BtlController_EmitTwoReturnValues(BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace()); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace(battler)); } else { - u8 moveId = RecordedBattle_GetBattlerAction(RECORDED_MOVE_SLOT, gActiveBattler); - u8 target = RecordedBattle_GetBattlerAction(RECORDED_MOVE_TARGET, gActiveBattler); - BtlController_EmitTwoReturnValues(BUFFER_B, 10, moveId | (target << 8)); + u8 moveId = RecordedBattle_GetBattlerAction(RECORDED_MOVE_SLOT, battler); + u8 target = RecordedBattle_GetBattlerAction(RECORDED_MOVE_TARGET, battler); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, moveId | (target << 8)); } - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleChooseItem(void) -{ - u8 byte1 = RecordedBattle_GetBattlerAction(RECORDED_ITEM_ID, gActiveBattler); - u8 byte2 = RecordedBattle_GetBattlerAction(RECORDED_ITEM_ID, gActiveBattler); - gBattleStruct->chosenItem[gActiveBattler] = (byte1 << 8) | byte2; - gBattleStruct->itemPartyIndex[gActiveBattler] = RecordedBattle_GetBattlerAction(RECORDED_ITEM_TARGET, gActiveBattler); - gBattleStruct->itemMoveIndex[gActiveBattler] = RecordedBattle_GetBattlerAction(RECORDED_ITEM_MOVE, gActiveBattler); - BtlController_EmitOneReturnValue(BUFFER_B, gBattleStruct->chosenItem[gActiveBattler]); - RecordedPlayerBufferExecCompleted(); + RecordedPlayerBufferExecCompleted(battler); } -static void RecordedPlayerHandleChoosePokemon(void) +static void RecordedPlayerHandleChooseItem(u32 battler) { - *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = RecordedBattle_GetBattlerAction(RECORDED_PARTY_INDEX, gActiveBattler); - gSelectedMonPartyId = gBattleStruct->monToSwitchIntoId[gActiveBattler]; // Revival Blessing - BtlController_EmitChosenMonReturnValue(BUFFER_B, *(gBattleStruct->monToSwitchIntoId + gActiveBattler), NULL); - RecordedPlayerBufferExecCompleted(); + u8 byte1 = RecordedBattle_GetBattlerAction(RECORDED_ITEM_ID, battler); + u8 byte2 = RecordedBattle_GetBattlerAction(RECORDED_ITEM_ID, battler); + gBattleStruct->chosenItem[battler] = (byte1 << 8) | byte2; + gBattleStruct->itemPartyIndex[battler] = RecordedBattle_GetBattlerAction(RECORDED_ITEM_TARGET, battler); + gBattleStruct->itemMoveIndex[battler] = RecordedBattle_GetBattlerAction(RECORDED_ITEM_MOVE, battler); + BtlController_EmitOneReturnValue(battler, BUFFER_B, gBattleStruct->chosenItem[battler]); + RecordedPlayerBufferExecCompleted(battler); } -static void RecordedPlayerHandleCmd23(void) +static void RecordedPlayerHandleChoosePokemon(u32 battler) { - RecordedPlayerBufferExecCompleted(); + *(gBattleStruct->monToSwitchIntoId + battler) = RecordedBattle_GetBattlerAction(RECORDED_PARTY_INDEX, battler); + gSelectedMonPartyId = gBattleStruct->monToSwitchIntoId[battler]; // Revival Blessing + BtlController_EmitChosenMonReturnValue(battler, BUFFER_B, *(gBattleStruct->monToSwitchIntoId + battler), NULL); + RecordedPlayerBufferExecCompleted(battler); } -static void RecordedPlayerHandleHealthBarUpdate(void) +static void RecordedPlayerHandleHealthBarUpdate(u32 battler) { s16 hpVal; s32 maxHP, curHP; LoadBattleBarGfx(0); - hpVal = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); + hpVal = gBattleResources->bufferA[battler][2] | (gBattleResources->bufferA[battler][3] << 8); - maxHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); - curHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_HP); + maxHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_MAX_HP); + curHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_HP); if (hpVal != INSTANT_HP_BAR_DROP) { - SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, curHP, hpVal); - TestRunner_Battle_RecordHP(gActiveBattler, curHP, min(maxHP, max(0, curHP - hpVal))); + SetBattleBarStruct(battler, gHealthboxSpriteIds[battler], maxHP, curHP, hpVal); + TestRunner_Battle_RecordHP(battler, curHP, min(maxHP, max(0, curHP - hpVal))); } else { - SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, 0, hpVal); - UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], HP_CURRENT, 0, maxHP); - TestRunner_Battle_RecordHP(gActiveBattler, curHP, 0); + SetBattleBarStruct(battler, gHealthboxSpriteIds[battler], maxHP, 0, hpVal); + UpdateHpTextInHealthbox(gHealthboxSpriteIds[battler], HP_CURRENT, 0, maxHP); + TestRunner_Battle_RecordHP(battler, curHP, 0); } - gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthbarDone; + gBattlerControllerFuncs[battler] = Controller_WaitForHealthBar; } -static void RecordedPlayerHandleExpUpdate(void) +static void RecordedPlayerHandleStatusIconUpdate(u32 battler) { - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleStatusIconUpdate(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) + if (!IsBattleSEPlaying(battler)) { - u8 battlerId; - - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON); - battlerId = gActiveBattler; - gBattleSpritesDataPtr->healthBoxesData[battlerId].statusAnimActive = 0; - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; - + DoStatusIconUpdate(battler); if (gTestRunnerEnabled) - TestRunner_Battle_RecordStatus1(battlerId, GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_STATUS)); - } -} - -static void RecordedPlayerHandleStatusAnimation(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) - { - InitAndLaunchChosenStatusAnimation(gBattleResources->bufferA[gActiveBattler][1], - gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8) | (gBattleResources->bufferA[gActiveBattler][4] << 16) | (gBattleResources->bufferA[gActiveBattler][5] << 24)); - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; + TestRunner_Battle_RecordStatus1(battler, GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_STATUS)); } } -static void RecordedPlayerHandleStatusXor(void) -{ - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleDataTransfer(void) -{ - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleDMA3Transfer(void) -{ - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandlePlayBGM(void) -{ - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleCmd32(void) -{ - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleTwoReturnValues(void) +static void RecordedPlayerHandleStatusAnimation(u32 battler) { - RecordedPlayerBufferExecCompleted(); + BtlController_HandleStatusAnimation(battler); } -static void RecordedPlayerHandleChosenMonReturnValue(void) +static void RecordedPlayerHandleIntroTrainerBallThrow(u32 battler) { - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleOneReturnValue(void) -{ - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleOneReturnValue_Duplicate(void) -{ - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleClearUnkVar(void) -{ - gUnusedControllerStruct.unk = 0; - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleSetUnkVar(void) -{ - gUnusedControllerStruct.unk = gBattleResources->bufferA[gActiveBattler][1]; - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleClearUnkFlag(void) -{ - gUnusedControllerStruct.flag = 0; - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleToggleUnkFlag(void) -{ - gUnusedControllerStruct.flag ^= 1; - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleHitAnimation(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE) - { - RecordedPlayerBufferExecCompleted(); - } - else - { - gDoingBattleAnim = TRUE; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; - DoHitAnimHealthboxEffect(gActiveBattler); - gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; - } -} - -static void RecordedPlayerHandleCantSwitch(void) -{ - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandlePlaySE(void) -{ - s8 pan; - - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - pan = SOUND_PAN_ATTACKER; - else - pan = SOUND_PAN_TARGET; - - PlaySE12WithPanning(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8), pan); - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandlePlayFanfareOrBGM(void) -{ - if (gBattleResources->bufferA[gActiveBattler][3]) - { - BattleStopLowHpSound(); - PlayBGM(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - else - { - PlayFanfare(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleFaintingCry(void) -{ - u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - - PlayCry_ByMode(species, -25, CRY_MODE_FAINT); - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleIntroSlide(void) -{ - HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]); - gIntroSlideFlags |= 1; - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleIntroTrainerBallThrow(void) -{ - u8 paletteNum; - u8 taskId; u32 trainerPicId; + const u32 *trainerPal; - SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 50; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].y; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[5] = gActiveBattler; - - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCB_FreePlayerSpriteLoadMonSprite); - StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1); - - paletteNum = AllocSpritePalette(0xD6F9); if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK) - trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender; + trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(battler)].gender + TRAINER_BACK_PIC_BRENDAN; else - trainerPicId = gSaveBlock2Ptr->playerGender; - - LoadCompressedPalette(gTrainerBackPicPaletteTable[trainerPicId].data, OBJ_PLTT_ID(paletteNum), PLTT_SIZE_4BPP); - - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum; - - taskId = CreateTask(Task_StartSendOutAnim, 5); - gTasks[taskId].data[0] = gActiveBattler; - - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) - gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; + trainerPicId = gSaveBlock2Ptr->playerGender + TRAINER_BACK_PIC_BRENDAN; - gBattleSpritesDataPtr->animationData->introAnimActive = TRUE; - gBattlerControllerFuncs[gActiveBattler] = RecordedPlayerDummy; + trainerPal = gTrainerFrontPicPaletteTable[trainerPicId].data; + BtlController_HandleIntroTrainerBallThrow(battler, 0xD6F9, trainerPal, 24, Intro_TryShinyAnimShowHealthbox); } -static void Task_StartSendOutAnim(u8 taskId) +static void RecordedPlayerHandleDrawPartyStatusSummary(u32 battler) { - if (gTasks[taskId].data[1] < 24) - { - gTasks[taskId].data[1]++; - } - else - { - u8 savedActiveBank = gActiveBattler; - - gActiveBattler = gTasks[taskId].data[0]; - if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) - { - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - StartSendOutAnim(gActiveBattler, FALSE); - } - else - { - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - StartSendOutAnim(gActiveBattler, FALSE); - gActiveBattler ^= BIT_FLANK; - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - StartSendOutAnim(gActiveBattler, FALSE); - gActiveBattler ^= BIT_FLANK; - } - gBattlerControllerFuncs[gActiveBattler] = Intro_TryShinyAnimShowHealthbox; - gActiveBattler = savedActiveBank; - DestroyTask(taskId); - } -} - -static void RecordedPlayerHandleDrawPartyStatusSummary(void) -{ - if (gBattleResources->bufferA[gActiveBattler][1] != 0 && GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - { - RecordedPlayerBufferExecCompleted(); - } - else - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1; - gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleResources->bufferA[gActiveBattler][4], gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2]); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; - - if (gBattleResources->bufferA[gActiveBattler][2] != 0) - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 93; - - gBattlerControllerFuncs[gActiveBattler] = EndDrawPartyStatusSummary; - } -} - -static void EndDrawPartyStatusSummary(void) -{ - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer++ > 92) - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; - RecordedPlayerBufferExecCompleted(); - } -} - -static void RecordedPlayerHandleHidePartyStatusSummary(void) -{ - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) - gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleEndBounceEffect(void) -{ - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleSpriteInvisibility(void) -{ - if (IsBattlerSpritePresent(gActiveBattler)) - { - gSprites[gBattlerSpriteIds[gActiveBattler]].invisible = gBattleResources->bufferA[gActiveBattler][1]; - CopyBattleSpriteInvisibility(gActiveBattler); - } - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleBattleAnimation(void) -{ - if (!IsBattleSEPlaying(gActiveBattler)) - { - u8 animationId = gBattleResources->bufferA[gActiveBattler][1]; - u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); - - if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument)) - RecordedPlayerBufferExecCompleted(); - else - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; - } -} - -static void RecordedPlayerHandleLinkStandbyMsg(void) -{ - RecordedPlayerBufferExecCompleted(); + BtlController_HandleDrawPartyStatusSummary(battler, B_SIDE_PLAYER, TRUE); } -static void RecordedPlayerHandleResetActionMoveSelection(void) +static void RecordedPlayerHandleBattleAnimation(u32 battler) { - RecordedPlayerBufferExecCompleted(); + BtlController_HandleBattleAnimation(battler, FALSE, FALSE); } -static void RecordedPlayerHandleEndLinkBattle(void) +static void RecordedPlayerHandleEndLinkBattle(u32 battler) { - gBattleOutcome = gBattleResources->bufferA[gActiveBattler][1]; + gBattleOutcome = gBattleResources->bufferA[battler][1]; FadeOutMapMusic(5); BeginFastPaletteFade(3); - RecordedPlayerBufferExecCompleted(); - gBattlerControllerFuncs[gActiveBattler] = SetBattleEndCallbacks; -} - -static void RecordedPlayerCmdEnd(void) -{ + RecordedPlayerBufferExecCompleted(battler); + gBattlerControllerFuncs[battler] = SetBattleEndCallbacks; } diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c index 1542838dbb07..2069082d8c0c 100644 --- a/src/battle_controller_safari.c +++ b/src/battle_controller_safari.c @@ -22,237 +22,177 @@ #include "window.h" #include "constants/battle_anim.h" #include "constants/songs.h" +#include "constants/trainers.h" #include "constants/rgb.h" -static void SafariHandleGetMonData(void); -static void SafariHandleGetRawMonData(void); -static void SafariHandleSetMonData(void); -static void SafariHandleSetRawMonData(void); -static void SafariHandleLoadMonSprite(void); -static void SafariHandleSwitchInAnim(void); -static void SafariHandleReturnMonToBall(void); -static void SafariHandleDrawTrainerPic(void); -static void SafariHandleTrainerSlide(void); -static void SafariHandleTrainerSlideBack(void); -static void SafariHandleFaintAnimation(void); -static void SafariHandlePaletteFade(void); -static void SafariHandleSuccessBallThrowAnim(void); -static void SafariHandleBallThrowAnim(void); -static void SafariHandlePause(void); -static void SafariHandleMoveAnimation(void); -static void SafariHandlePrintString(void); -static void SafariHandlePrintSelectionString(void); -static void SafariHandleChooseAction(void); -static void SafariHandleYesNoBox(void); -static void SafariHandleChooseMove(void); -static void SafariHandleChooseItem(void); -static void SafariHandleChoosePokemon(void); -static void SafariHandleCmd23(void); -static void SafariHandleHealthBarUpdate(void); -static void SafariHandleExpUpdate(void); -static void SafariHandleStatusIconUpdate(void); -static void SafariHandleStatusAnimation(void); -static void SafariHandleStatusXor(void); -static void SafariHandleDataTransfer(void); -static void SafariHandleDMA3Transfer(void); -static void SafariHandlePlayBGM(void); -static void SafariHandleCmd32(void); -static void SafariHandleTwoReturnValues(void); -static void SafariHandleChosenMonReturnValue(void); -static void SafariHandleOneReturnValue(void); -static void SafariHandleOneReturnValue_Duplicate(void); -static void SafariHandleClearUnkVar(void); -static void SafariHandleSetUnkVar(void); -static void SafariHandleClearUnkFlag(void); -static void SafariHandleToggleUnkFlag(void); -static void SafariHandleHitAnimation(void); -static void SafariHandleCantSwitch(void); -static void SafariHandlePlaySE(void); -static void SafariHandlePlayFanfareOrBGM(void); -static void SafariHandleFaintingCry(void); -static void SafariHandleIntroSlide(void); -static void SafariHandleIntroTrainerBallThrow(void); -static void SafariHandleDrawPartyStatusSummary(void); -static void SafariHandleHidePartyStatusSummary(void); -static void SafariHandleEndBounceEffect(void); -static void SafariHandleSpriteInvisibility(void); -static void SafariHandleBattleAnimation(void); -static void SafariHandleLinkStandbyMsg(void); -static void SafariHandleResetActionMoveSelection(void); -static void SafariHandleEndLinkBattle(void); -static void SafariHandleBattleDebug(void); -static void SafariCmdEnd(void); - -static void SafariBufferRunCommand(void); -static void SafariBufferExecCompleted(void); -static void CompleteWhenChosePokeblock(void); - -static void (*const sSafariBufferCommands[CONTROLLER_CMDS_COUNT])(void) = -{ - [CONTROLLER_GETMONDATA] = SafariHandleGetMonData, - [CONTROLLER_GETRAWMONDATA] = SafariHandleGetRawMonData, - [CONTROLLER_SETMONDATA] = SafariHandleSetMonData, - [CONTROLLER_SETRAWMONDATA] = SafariHandleSetRawMonData, - [CONTROLLER_LOADMONSPRITE] = SafariHandleLoadMonSprite, - [CONTROLLER_SWITCHINANIM] = SafariHandleSwitchInAnim, - [CONTROLLER_RETURNMONTOBALL] = SafariHandleReturnMonToBall, +static void SafariHandleDrawTrainerPic(u32 battler); +static void SafariHandleSuccessBallThrowAnim(u32 battler); +static void SafariHandleBallThrowAnim(u32 battler); +static void SafariHandlePrintString(u32 battler); +static void SafariHandlePrintSelectionString(u32 battler); +static void SafariHandleChooseAction(u32 battler); +static void SafariHandleChooseItem(u32 battler); +static void SafariHandleStatusIconUpdate(u32 battler); +static void SafariHandleFaintingCry(u32 battler); +static void SafariHandleIntroTrainerBallThrow(u32 battler); +static void SafariHandleBattleAnimation(u32 battler); +static void SafariHandleEndLinkBattle(u32 battler); + +static void SafariBufferRunCommand(u32 battler); +static void SafariBufferExecCompleted(u32 battler); +static void CompleteWhenChosePokeblock(u32 battler); + +static void (*const sSafariBufferCommands[CONTROLLER_CMDS_COUNT])(u32 battler) = +{ + [CONTROLLER_GETMONDATA] = BtlController_Empty, + [CONTROLLER_GETRAWMONDATA] = BtlController_Empty, + [CONTROLLER_SETMONDATA] = BtlController_Empty, + [CONTROLLER_SETRAWMONDATA] = BtlController_Empty, + [CONTROLLER_LOADMONSPRITE] = BtlController_Empty, + [CONTROLLER_SWITCHINANIM] = BtlController_Empty, + [CONTROLLER_RETURNMONTOBALL] = BtlController_Empty, [CONTROLLER_DRAWTRAINERPIC] = SafariHandleDrawTrainerPic, - [CONTROLLER_TRAINERSLIDE] = SafariHandleTrainerSlide, - [CONTROLLER_TRAINERSLIDEBACK] = SafariHandleTrainerSlideBack, - [CONTROLLER_FAINTANIMATION] = SafariHandleFaintAnimation, - [CONTROLLER_PALETTEFADE] = SafariHandlePaletteFade, + [CONTROLLER_TRAINERSLIDE] = BtlController_Empty, + [CONTROLLER_TRAINERSLIDEBACK] = BtlController_Empty, + [CONTROLLER_FAINTANIMATION] = BtlController_Empty, + [CONTROLLER_PALETTEFADE] = BtlController_Empty, [CONTROLLER_SUCCESSBALLTHROWANIM] = SafariHandleSuccessBallThrowAnim, [CONTROLLER_BALLTHROWANIM] = SafariHandleBallThrowAnim, - [CONTROLLER_PAUSE] = SafariHandlePause, - [CONTROLLER_MOVEANIMATION] = SafariHandleMoveAnimation, + [CONTROLLER_PAUSE] = BtlController_Empty, + [CONTROLLER_MOVEANIMATION] = BtlController_Empty, [CONTROLLER_PRINTSTRING] = SafariHandlePrintString, [CONTROLLER_PRINTSTRINGPLAYERONLY] = SafariHandlePrintSelectionString, [CONTROLLER_CHOOSEACTION] = SafariHandleChooseAction, - [CONTROLLER_YESNOBOX] = SafariHandleYesNoBox, - [CONTROLLER_CHOOSEMOVE] = SafariHandleChooseMove, + [CONTROLLER_YESNOBOX] = BtlController_Empty, + [CONTROLLER_CHOOSEMOVE] = BtlController_Empty, [CONTROLLER_OPENBAG] = SafariHandleChooseItem, - [CONTROLLER_CHOOSEPOKEMON] = SafariHandleChoosePokemon, - [CONTROLLER_23] = SafariHandleCmd23, - [CONTROLLER_HEALTHBARUPDATE] = SafariHandleHealthBarUpdate, - [CONTROLLER_EXPUPDATE] = SafariHandleExpUpdate, + [CONTROLLER_CHOOSEPOKEMON] = BtlController_Empty, + [CONTROLLER_23] = BtlController_Empty, + [CONTROLLER_HEALTHBARUPDATE] = BtlController_Empty, + [CONTROLLER_EXPUPDATE] = BtlController_Empty, [CONTROLLER_STATUSICONUPDATE] = SafariHandleStatusIconUpdate, - [CONTROLLER_STATUSANIMATION] = SafariHandleStatusAnimation, - [CONTROLLER_STATUSXOR] = SafariHandleStatusXor, - [CONTROLLER_DATATRANSFER] = SafariHandleDataTransfer, - [CONTROLLER_DMA3TRANSFER] = SafariHandleDMA3Transfer, - [CONTROLLER_PLAYBGM] = SafariHandlePlayBGM, - [CONTROLLER_32] = SafariHandleCmd32, - [CONTROLLER_TWORETURNVALUES] = SafariHandleTwoReturnValues, - [CONTROLLER_CHOSENMONRETURNVALUE] = SafariHandleChosenMonReturnValue, - [CONTROLLER_ONERETURNVALUE] = SafariHandleOneReturnValue, - [CONTROLLER_ONERETURNVALUE_DUPLICATE] = SafariHandleOneReturnValue_Duplicate, - [CONTROLLER_CLEARUNKVAR] = SafariHandleClearUnkVar, - [CONTROLLER_SETUNKVAR] = SafariHandleSetUnkVar, - [CONTROLLER_CLEARUNKFLAG] = SafariHandleClearUnkFlag, - [CONTROLLER_TOGGLEUNKFLAG] = SafariHandleToggleUnkFlag, - [CONTROLLER_HITANIMATION] = SafariHandleHitAnimation, - [CONTROLLER_CANTSWITCH] = SafariHandleCantSwitch, - [CONTROLLER_PLAYSE] = SafariHandlePlaySE, - [CONTROLLER_PLAYFANFAREORBGM] = SafariHandlePlayFanfareOrBGM, + [CONTROLLER_STATUSANIMATION] = BtlController_Empty, + [CONTROLLER_STATUSXOR] = BtlController_Empty, + [CONTROLLER_DATATRANSFER] = BtlController_Empty, + [CONTROLLER_DMA3TRANSFER] = BtlController_Empty, + [CONTROLLER_PLAYBGM] = BtlController_Empty, + [CONTROLLER_32] = BtlController_Empty, + [CONTROLLER_TWORETURNVALUES] = BtlController_Empty, + [CONTROLLER_CHOSENMONRETURNVALUE] = BtlController_Empty, + [CONTROLLER_ONERETURNVALUE] = BtlController_Empty, + [CONTROLLER_ONERETURNVALUE_DUPLICATE] = BtlController_Empty, + [CONTROLLER_CLEARUNKVAR] = BtlController_Empty, + [CONTROLLER_SETUNKVAR] = BtlController_Empty, + [CONTROLLER_CLEARUNKFLAG] = BtlController_Empty, + [CONTROLLER_TOGGLEUNKFLAG] = BtlController_Empty, + [CONTROLLER_HITANIMATION] = BtlController_Empty, + [CONTROLLER_CANTSWITCH] = BtlController_Empty, + [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, + [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, [CONTROLLER_FAINTINGCRY] = SafariHandleFaintingCry, - [CONTROLLER_INTROSLIDE] = SafariHandleIntroSlide, + [CONTROLLER_INTROSLIDE] = BtlController_HandleIntroSlide, [CONTROLLER_INTROTRAINERBALLTHROW] = SafariHandleIntroTrainerBallThrow, - [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = SafariHandleDrawPartyStatusSummary, - [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = SafariHandleHidePartyStatusSummary, - [CONTROLLER_ENDBOUNCE] = SafariHandleEndBounceEffect, - [CONTROLLER_SPRITEINVISIBILITY] = SafariHandleSpriteInvisibility, + [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = BtlController_Empty, + [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = BtlController_Empty, + [CONTROLLER_ENDBOUNCE] = BtlController_Empty, + [CONTROLLER_SPRITEINVISIBILITY] = BtlController_Empty, [CONTROLLER_BATTLEANIMATION] = SafariHandleBattleAnimation, - [CONTROLLER_LINKSTANDBYMSG] = SafariHandleLinkStandbyMsg, - [CONTROLLER_RESETACTIONMOVESELECTION] = SafariHandleResetActionMoveSelection, + [CONTROLLER_LINKSTANDBYMSG] = BtlController_Empty, + [CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty, [CONTROLLER_ENDLINKBATTLE] = SafariHandleEndLinkBattle, - [CONTROLLER_DEBUGMENU] = SafariHandleBattleDebug, - [CONTROLLER_TERMINATOR_NOP] = SafariCmdEnd + [CONTROLLER_DEBUGMENU] = BtlController_Empty, + [CONTROLLER_TERMINATOR_NOP] = BtlController_TerminatorNop }; -static void SpriteCB_Null4(void) -{ -} - -void SetControllerToSafari(void) +void SetControllerToSafari(u32 battler) { - gBattlerControllerFuncs[gActiveBattler] = SafariBufferRunCommand; + gBattlerControllerEndFuncs[battler] = SafariBufferExecCompleted; + gBattlerControllerFuncs[battler] = SafariBufferRunCommand; } -static void SafariBufferRunCommand(void) +static void SafariBufferRunCommand(u32 battler) { - if (gBattleControllerExecFlags & gBitTable[gActiveBattler]) + if (gBattleControllerExecFlags & gBitTable[battler]) { - if (gBattleResources->bufferA[gActiveBattler][0] < ARRAY_COUNT(sSafariBufferCommands)) - sSafariBufferCommands[gBattleResources->bufferA[gActiveBattler][0]](); + if (gBattleResources->bufferA[battler][0] < ARRAY_COUNT(sSafariBufferCommands)) + sSafariBufferCommands[gBattleResources->bufferA[battler][0]](battler); else - SafariBufferExecCompleted(); + SafariBufferExecCompleted(battler); } } -static void HandleInputChooseAction(void) +static void HandleInputChooseAction(u32 battler) { if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); - switch (gActionSelectionCursor[gActiveBattler]) + switch (gActionSelectionCursor[battler]) { case 0: - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SAFARI_BALL, 0); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_SAFARI_BALL, 0); break; case 1: - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SAFARI_POKEBLOCK, 0); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_SAFARI_POKEBLOCK, 0); break; case 2: - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SAFARI_GO_NEAR, 0); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_SAFARI_GO_NEAR, 0); break; case 3: - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SAFARI_RUN, 0); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_SAFARI_RUN, 0); break; } - SafariBufferExecCompleted(); + SafariBufferExecCompleted(battler); } else if (JOY_NEW(DPAD_LEFT)) { - if (gActionSelectionCursor[gActiveBattler] & 1) + if (gActionSelectionCursor[battler] & 1) { PlaySE(SE_SELECT); - ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBattler]); - gActionSelectionCursor[gActiveBattler] ^= 1; - ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[battler]); + gActionSelectionCursor[battler] ^= 1; + ActionSelectionCreateCursorAt(gActionSelectionCursor[battler], 0); } } else if (JOY_NEW(DPAD_RIGHT)) { - if (!(gActionSelectionCursor[gActiveBattler] & 1)) + if (!(gActionSelectionCursor[battler] & 1)) { PlaySE(SE_SELECT); - ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBattler]); - gActionSelectionCursor[gActiveBattler] ^= 1; - ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[battler]); + gActionSelectionCursor[battler] ^= 1; + ActionSelectionCreateCursorAt(gActionSelectionCursor[battler], 0); } } else if (JOY_NEW(DPAD_UP)) { - if (gActionSelectionCursor[gActiveBattler] & 2) + if (gActionSelectionCursor[battler] & 2) { PlaySE(SE_SELECT); - ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBattler]); - gActionSelectionCursor[gActiveBattler] ^= 2; - ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[battler]); + gActionSelectionCursor[battler] ^= 2; + ActionSelectionCreateCursorAt(gActionSelectionCursor[battler], 0); } } else if (JOY_NEW(DPAD_DOWN)) { - if (!(gActionSelectionCursor[gActiveBattler] & 2)) + if (!(gActionSelectionCursor[battler] & 2)) { PlaySE(SE_SELECT); - ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBattler]); - gActionSelectionCursor[gActiveBattler] ^= 2; - ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0); + ActionSelectionDestroyCursorAt(gActionSelectionCursor[battler]); + gActionSelectionCursor[battler] ^= 2; + ActionSelectionCreateCursorAt(gActionSelectionCursor[battler], 0); } } } -static void CompleteOnBattlerSpriteCallbackDummy(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - SafariBufferExecCompleted(); -} - -static void CompleteOnInactiveTextPrinter(void) -{ - if (!IsTextPrinterActive(B_WIN_MSG)) - SafariBufferExecCompleted(); -} - -static void CompleteOnHealthboxSpriteCallbackDummy(void) +static void Controller_WaitForHealthbox(u32 battler) { - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - SafariBufferExecCompleted(); + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy) + SafariBufferExecCompleted(battler); } -static void SafariSetBattleEndCallbacks(void) +static void SafariSetBattleEndCallbacks(u32 battler) { if (!gPaletteFade.active) { @@ -262,437 +202,141 @@ static void SafariSetBattleEndCallbacks(void) } } -static void CompleteOnSpecialAnimDone(void) -{ - if (!gDoingBattleAnim || !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - SafariBufferExecCompleted(); -} - -static void SafariOpenPokeblockCase(void) +static void SafariOpenPokeblockCase(u32 battler) { if (!gPaletteFade.active) { - gBattlerControllerFuncs[gActiveBattler] = CompleteWhenChosePokeblock; + gBattlerControllerFuncs[battler] = CompleteWhenChosePokeblock; FreeAllWindowBuffers(); OpenPokeblockCaseInBattle(); } } -static void CompleteWhenChosePokeblock(void) +static void CompleteWhenChosePokeblock(u32 battler) { if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) { - BtlController_EmitOneReturnValue(BUFFER_B, gSpecialVar_ItemId); - SafariBufferExecCompleted(); + BtlController_EmitOneReturnValue(battler, BUFFER_B, gSpecialVar_ItemId); + SafariBufferExecCompleted(battler); } } -static void CompleteOnFinishedBattleAnimation(void) +static void SafariBufferExecCompleted(u32 battler) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive) - SafariBufferExecCompleted(); -} - -static void SafariBufferExecCompleted(void) -{ - gBattlerControllerFuncs[gActiveBattler] = SafariBufferRunCommand; + gBattlerControllerFuncs[battler] = SafariBufferRunCommand; if (gBattleTypeFlags & BATTLE_TYPE_LINK) { u8 playerId = GetMultiplayerId(); - PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleResources->bufferA[gActiveBattler][0] = CONTROLLER_TERMINATOR_NOP; + PrepareBufferDataTransferLink(battler, 2, 4, &playerId); + gBattleResources->bufferA[battler][0] = CONTROLLER_TERMINATOR_NOP; } else { - gBattleControllerExecFlags &= ~gBitTable[gActiveBattler]; + gBattleControllerExecFlags &= ~gBitTable[battler]; } } -static void CompleteOnFinishedStatusAnimation(void) -{ - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].statusAnimActive) - SafariBufferExecCompleted(); -} - -static void SafariHandleGetMonData(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleGetRawMonData(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleSetMonData(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleSetRawMonData(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleLoadMonSprite(void) +static void SafariHandleDrawTrainerPic(u32 battler) { - SafariBufferExecCompleted(); -} + u32 trainerPicId = gSaveBlock2Ptr->playerGender + TRAINER_BACK_PIC_BRENDAN; -static void SafariHandleSwitchInAnim(void) -{ - SafariBufferExecCompleted(); + BtlController_HandleDrawTrainerPic(battler, trainerPicId, FALSE, + 80, 80 + 4 * (8 - gTrainerBackPicCoords[trainerPicId].size), + 30); } -static void SafariHandleReturnMonToBall(void) +static void SafariHandleSuccessBallThrowAnim(u32 battler) { - SafariBufferExecCompleted(); + BtlController_HandleSuccessBallThrowAnim(battler, GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_BALL_THROW_WITH_TRAINER, FALSE); } -#define sSpeedX data[0] - -static void SafariHandleDrawTrainerPic(void) +static void SafariHandleBallThrowAnim(u32 battler) { - DecompressTrainerBackPic(gSaveBlock2Ptr->playerGender, gActiveBattler); - SetMultiuseSpriteTemplateToTrainerBack(gSaveBlock2Ptr->playerGender, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite( - &gMultiuseSpriteTemplate, - 80, - (8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].size) * 4 + 80, - 30); - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = DISPLAY_WIDTH; - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; - gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy; + BtlController_HandleBallThrowAnim(battler, GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_BALL_THROW_WITH_TRAINER, FALSE); } -#undef sSpeedX - -static void SafariHandleTrainerSlide(void) +static void SafariHandlePrintString(u32 battler) { - SafariBufferExecCompleted(); + BtlController_HandlePrintString(battler, FALSE, FALSE); } -static void SafariHandleTrainerSlideBack(void) +static void SafariHandlePrintSelectionString(u32 battler) { - SafariBufferExecCompleted(); -} - -static void SafariHandleFaintAnimation(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandlePaletteFade(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleSuccessBallThrowAnim(void) -{ - gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS; - gDoingBattleAnim = TRUE; - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_BALL_THROW_WITH_TRAINER); - gBattlerControllerFuncs[gActiveBattler] = CompleteOnSpecialAnimDone; -} - -static void SafariHandleBallThrowAnim(void) -{ - u8 ballThrowCaseId = gBattleResources->bufferA[gActiveBattler][1]; - - gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId; - gDoingBattleAnim = TRUE; - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_BALL_THROW_WITH_TRAINER); - gBattlerControllerFuncs[gActiveBattler] = CompleteOnSpecialAnimDone; -} - -static void SafariHandlePause(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleMoveAnimation(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandlePrintString(void) -{ - u16 *stringId; - - gBattle_BG0_X = 0; - gBattle_BG0_Y = 0; - stringId = (u16 *)(&gBattleResources->bufferA[gActiveBattler][2]); - BufferStringBattle(*stringId); - BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG); - gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; -} - -static void SafariHandlePrintSelectionString(void) -{ - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - SafariHandlePrintString(); + if (GetBattlerSide(battler) == B_SIDE_PLAYER) + SafariHandlePrintString(battler); else - SafariBufferExecCompleted(); + SafariBufferExecCompleted(battler); } -static void HandleChooseActionAfterDma3(void) +static void HandleChooseActionAfterDma3(u32 battler) { if (!IsDma3ManagerBusyWithBgCopy()) { gBattle_BG0_X = 0; gBattle_BG0_Y = DISPLAY_HEIGHT; - gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseAction; + gBattlerControllerFuncs[battler] = HandleInputChooseAction; } } -static void SafariHandleChooseAction(void) +static void SafariHandleChooseAction(u32 battler) { s32 i; - gBattlerControllerFuncs[gActiveBattler] = HandleChooseActionAfterDma3; + gBattlerControllerFuncs[battler] = HandleChooseActionAfterDma3; BattlePutTextOnWindow(gText_SafariZoneMenu, B_WIN_ACTION_MENU); for (i = 0; i < 4; i++) ActionSelectionDestroyCursorAt(i); - ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0); + ActionSelectionCreateCursorAt(gActionSelectionCursor[battler], 0); BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillPkmnDo2); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_ACTION_PROMPT); } -static void SafariHandleYesNoBox(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleChooseMove(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleChooseItem(void) +static void SafariHandleChooseItem(u32 battler) { BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); - gBattlerControllerFuncs[gActiveBattler] = SafariOpenPokeblockCase; - gBattlerInMenuId = gActiveBattler; + gBattlerControllerFuncs[battler] = SafariOpenPokeblockCase; + gBattlerInMenuId = battler; } -static void SafariHandleChoosePokemon(void) +static void SafariHandleStatusIconUpdate(u32 battler) { - SafariBufferExecCompleted(); + UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], &gPlayerParty[gBattlerPartyIndexes[battler]], HEALTHBOX_SAFARI_BALLS_TEXT); + SafariBufferExecCompleted(battler); } -static void SafariHandleCmd23(void) +// All of the other controllers(except Wally's) use CRY_MODE_FAINT. +// Player is not a pokemon, so it can't really faint in the Safari anyway. +static void SafariHandleFaintingCry(u32 battler) { - SafariBufferExecCompleted(); -} - -static void SafariHandleHealthBarUpdate(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleExpUpdate(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleStatusIconUpdate(void) -{ - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_SAFARI_BALLS_TEXT); - SafariBufferExecCompleted(); -} - -static void SafariHandleStatusAnimation(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleStatusXor(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleDataTransfer(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleDMA3Transfer(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandlePlayBGM(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleCmd32(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleTwoReturnValues(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleChosenMonReturnValue(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleOneReturnValue(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleOneReturnValue_Duplicate(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleClearUnkVar(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleSetUnkVar(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleClearUnkFlag(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleToggleUnkFlag(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleHitAnimation(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleCantSwitch(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandlePlaySE(void) -{ - s8 pan; - - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - pan = SOUND_PAN_ATTACKER; - else - pan = SOUND_PAN_TARGET; - - PlaySE12WithPanning(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8), pan); - SafariBufferExecCompleted(); -} - -static void SafariHandlePlayFanfareOrBGM(void) -{ - if (gBattleResources->bufferA[gActiveBattler][3]) - { - BattleStopLowHpSound(); - PlayBGM(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - else - { - PlayFanfare(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - - SafariBufferExecCompleted(); -} - -static void SafariHandleFaintingCry(void) -{ - u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); + u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES); PlayCry_Normal(species, 25); - SafariBufferExecCompleted(); -} - -static void SafariHandleIntroSlide(void) -{ - HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]); - gIntroSlideFlags |= 1; - SafariBufferExecCompleted(); + SafariBufferExecCompleted(battler); + SafariBufferExecCompleted(battler); } -static void SafariHandleIntroTrainerBallThrow(void) +static void SafariHandleIntroTrainerBallThrow(u32 battler) { - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_SAFARI_ALL_TEXT); - StartHealthboxSlideIn(gActiveBattler); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthboxSpriteCallbackDummy; + UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], &gPlayerParty[gBattlerPartyIndexes[battler]], HEALTHBOX_SAFARI_ALL_TEXT); + StartHealthboxSlideIn(battler); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[battler]); + gBattlerControllerFuncs[battler] = Controller_WaitForHealthbox; } -static void SafariHandleDrawPartyStatusSummary(void) +static void SafariHandleBattleAnimation(u32 battler) { - SafariBufferExecCompleted(); + BtlController_HandleBattleAnimation(battler, TRUE, FALSE); } -static void SafariHandleHidePartyStatusSummary(void) +static void SafariHandleEndLinkBattle(u32 battler) { - SafariBufferExecCompleted(); -} - -static void SafariHandleEndBounceEffect(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleSpriteInvisibility(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleBattleAnimation(void) -{ - u8 animationId = gBattleResources->bufferA[gActiveBattler][1]; - u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); - - if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument)) - SafariBufferExecCompleted(); - else - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; -} - -static void SafariHandleLinkStandbyMsg(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleResetActionMoveSelection(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariHandleEndLinkBattle(void) -{ - gBattleOutcome = gBattleResources->bufferA[gActiveBattler][1]; + gBattleOutcome = gBattleResources->bufferA[battler][1]; FadeOutMapMusic(5); BeginFastPaletteFade(3); - SafariBufferExecCompleted(); + SafariBufferExecCompleted(battler); if ((gBattleTypeFlags & BATTLE_TYPE_LINK) && !(gBattleTypeFlags & BATTLE_TYPE_IS_MASTER)) - gBattlerControllerFuncs[gActiveBattler] = SafariSetBattleEndCallbacks; -} - -static void SafariHandleBattleDebug(void) -{ - SafariBufferExecCompleted(); -} - -static void SafariCmdEnd(void) -{ + gBattlerControllerFuncs[battler] = SafariSetBattleEndCallbacks; } diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index fa1fa00fb2a0..a262886f4614 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -32,162 +32,113 @@ #include "constants/trainers.h" #include "constants/rgb.h" -// this file's functions -static void WallyHandleGetMonData(void); -static void WallyHandleGetRawMonData(void); -static void WallyHandleSetMonData(void); -static void WallyHandleSetRawMonData(void); -static void WallyHandleLoadMonSprite(void); -static void WallyHandleSwitchInAnim(void); -static void WallyHandleReturnMonToBall(void); -static void WallyHandleDrawTrainerPic(void); -static void WallyHandleTrainerSlide(void); -static void WallyHandleTrainerSlideBack(void); -static void WallyHandleFaintAnimation(void); -static void WallyHandlePaletteFade(void); -static void WallyHandleSuccessBallThrowAnim(void); -static void WallyHandleBallThrowAnim(void); -static void WallyHandlePause(void); -static void WallyHandleMoveAnimation(void); -static void WallyHandlePrintString(void); -static void WallyHandlePrintSelectionString(void); -static void WallyHandleChooseAction(void); -static void WallyHandleYesNoBox(void); -static void WallyHandleChooseMove(void); -static void WallyHandleChooseItem(void); -static void WallyHandleChoosePokemon(void); -static void WallyHandleCmd23(void); -static void WallyHandleHealthBarUpdate(void); -static void WallyHandleExpUpdate(void); -static void WallyHandleStatusIconUpdate(void); -static void WallyHandleStatusAnimation(void); -static void WallyHandleStatusXor(void); -static void WallyHandleDataTransfer(void); -static void WallyHandleDMA3Transfer(void); -static void WallyHandlePlayBGM(void); -static void WallyHandleCmd32(void); -static void WallyHandleTwoReturnValues(void); -static void WallyHandleChosenMonReturnValue(void); -static void WallyHandleOneReturnValue(void); -static void WallyHandleOneReturnValue_Duplicate(void); -static void WallyHandleClearUnkVar(void); -static void WallyHandleSetUnkVar(void); -static void WallyHandleClearUnkFlag(void); -static void WallyHandleToggleUnkFlag(void); -static void WallyHandleHitAnimation(void); -static void WallyHandleCantSwitch(void); -static void WallyHandlePlaySE(void); -static void WallyHandlePlayFanfareOrBGM(void); -static void WallyHandleFaintingCry(void); -static void WallyHandleIntroSlide(void); -static void WallyHandleIntroTrainerBallThrow(void); -static void WallyHandleDrawPartyStatusSummary(void); -static void WallyHandleHidePartyStatusSummary(void); -static void WallyHandleEndBounceEffect(void); -static void WallyHandleSpriteInvisibility(void); -static void WallyHandleBattleAnimation(void); -static void WallyHandleLinkStandbyMsg(void); -static void WallyHandleResetActionMoveSelection(void); -static void WallyHandleEndLinkBattle(void); -static void WallyHandleBattleDebug(void); -static void WallyCmdEnd(void); - -static void WallyBufferRunCommand(void); -static void WallyBufferExecCompleted(void); -static void CompleteOnChosenItem(void); -static void Intro_WaitForShinyAnimAndHealthbox(void); -static u32 CopyWallyMonData(u8 monId, u8 *dst); -static void SetWallyMonData(u8 monId); -static void WallyDoMoveAnimation(void); -static void Task_StartSendOutAnim(u8 taskId); - -static void (*const sWallyBufferCommands[CONTROLLER_CMDS_COUNT])(void) = -{ - [CONTROLLER_GETMONDATA] = WallyHandleGetMonData, - [CONTROLLER_GETRAWMONDATA] = WallyHandleGetRawMonData, - [CONTROLLER_SETMONDATA] = WallyHandleSetMonData, - [CONTROLLER_SETRAWMONDATA] = WallyHandleSetRawMonData, - [CONTROLLER_LOADMONSPRITE] = WallyHandleLoadMonSprite, - [CONTROLLER_SWITCHINANIM] = WallyHandleSwitchInAnim, - [CONTROLLER_RETURNMONTOBALL] = WallyHandleReturnMonToBall, +static void WallyHandleDrawTrainerPic(u32 battler); +static void WallyHandleTrainerSlide(u32 battler); +static void WallyHandleSuccessBallThrowAnim(u32 battler); +static void WallyHandleBallThrowAnim(u32 battler); +static void WallyHandleMoveAnimation(u32 battler); +static void WallyHandlePrintString(u32 battler); +static void WallyHandlePrintSelectionString(u32 battler); +static void WallyHandleChooseAction(u32 battler); +static void WallyHandleChooseMove(u32 battler); +static void WallyHandleChooseItem(u32 battler); +static void WallyHandleHealthBarUpdate(u32 battler); +static void WallyHandlePlaySE(u32 battler); +static void WallyHandleFaintingCry(u32 battler); +static void WallyHandleIntroTrainerBallThrow(u32 battler); +static void WallyHandleDrawPartyStatusSummary(u32 battler); +static void WallyHandleBattleAnimation(u32 battler); +static void WallyHandleEndLinkBattle(u32 battler); + +static void WallyBufferRunCommand(u32 battler); +static void WallyBufferExecCompleted(u32 battler); +static void CompleteOnChosenItem(u32 battler); +static void Intro_WaitForShinyAnimAndHealthbox(u32 battler); + +static void (*const sWallyBufferCommands[CONTROLLER_CMDS_COUNT])(u32 battler) = +{ + [CONTROLLER_GETMONDATA] = BtlController_HandleGetMonData, + [CONTROLLER_GETRAWMONDATA] = BtlController_HandleGetRawMonData, + [CONTROLLER_SETMONDATA] = BtlController_HandleSetMonData, + [CONTROLLER_SETRAWMONDATA] = BtlController_Empty, + [CONTROLLER_LOADMONSPRITE] = BtlController_Empty, + [CONTROLLER_SWITCHINANIM] = BtlController_Empty, + [CONTROLLER_RETURNMONTOBALL] = BtlController_HandleReturnMonToBall, [CONTROLLER_DRAWTRAINERPIC] = WallyHandleDrawTrainerPic, [CONTROLLER_TRAINERSLIDE] = WallyHandleTrainerSlide, - [CONTROLLER_TRAINERSLIDEBACK] = WallyHandleTrainerSlideBack, - [CONTROLLER_FAINTANIMATION] = WallyHandleFaintAnimation, - [CONTROLLER_PALETTEFADE] = WallyHandlePaletteFade, + [CONTROLLER_TRAINERSLIDEBACK] = BtlController_Empty, + [CONTROLLER_FAINTANIMATION] = BtlController_Empty, + [CONTROLLER_PALETTEFADE] = BtlController_Empty, [CONTROLLER_SUCCESSBALLTHROWANIM] = WallyHandleSuccessBallThrowAnim, [CONTROLLER_BALLTHROWANIM] = WallyHandleBallThrowAnim, - [CONTROLLER_PAUSE] = WallyHandlePause, + [CONTROLLER_PAUSE] = BtlController_Empty, [CONTROLLER_MOVEANIMATION] = WallyHandleMoveAnimation, [CONTROLLER_PRINTSTRING] = WallyHandlePrintString, [CONTROLLER_PRINTSTRINGPLAYERONLY] = WallyHandlePrintSelectionString, [CONTROLLER_CHOOSEACTION] = WallyHandleChooseAction, - [CONTROLLER_YESNOBOX] = WallyHandleYesNoBox, + [CONTROLLER_YESNOBOX] = BtlController_Empty, [CONTROLLER_CHOOSEMOVE] = WallyHandleChooseMove, [CONTROLLER_OPENBAG] = WallyHandleChooseItem, - [CONTROLLER_CHOOSEPOKEMON] = WallyHandleChoosePokemon, - [CONTROLLER_23] = WallyHandleCmd23, + [CONTROLLER_CHOOSEPOKEMON] = BtlController_Empty, + [CONTROLLER_23] = BtlController_Empty, [CONTROLLER_HEALTHBARUPDATE] = WallyHandleHealthBarUpdate, - [CONTROLLER_EXPUPDATE] = WallyHandleExpUpdate, - [CONTROLLER_STATUSICONUPDATE] = WallyHandleStatusIconUpdate, - [CONTROLLER_STATUSANIMATION] = WallyHandleStatusAnimation, - [CONTROLLER_STATUSXOR] = WallyHandleStatusXor, - [CONTROLLER_DATATRANSFER] = WallyHandleDataTransfer, - [CONTROLLER_DMA3TRANSFER] = WallyHandleDMA3Transfer, - [CONTROLLER_PLAYBGM] = WallyHandlePlayBGM, - [CONTROLLER_32] = WallyHandleCmd32, - [CONTROLLER_TWORETURNVALUES] = WallyHandleTwoReturnValues, - [CONTROLLER_CHOSENMONRETURNVALUE] = WallyHandleChosenMonReturnValue, - [CONTROLLER_ONERETURNVALUE] = WallyHandleOneReturnValue, - [CONTROLLER_ONERETURNVALUE_DUPLICATE] = WallyHandleOneReturnValue_Duplicate, - [CONTROLLER_CLEARUNKVAR] = WallyHandleClearUnkVar, - [CONTROLLER_SETUNKVAR] = WallyHandleSetUnkVar, - [CONTROLLER_CLEARUNKFLAG] = WallyHandleClearUnkFlag, - [CONTROLLER_TOGGLEUNKFLAG] = WallyHandleToggleUnkFlag, - [CONTROLLER_HITANIMATION] = WallyHandleHitAnimation, - [CONTROLLER_CANTSWITCH] = WallyHandleCantSwitch, + [CONTROLLER_EXPUPDATE] = BtlController_Empty, + [CONTROLLER_STATUSICONUPDATE] = BtlController_Empty, + [CONTROLLER_STATUSANIMATION] = BtlController_Empty, + [CONTROLLER_STATUSXOR] = BtlController_Empty, + [CONTROLLER_DATATRANSFER] = BtlController_Empty, + [CONTROLLER_DMA3TRANSFER] = BtlController_Empty, + [CONTROLLER_PLAYBGM] = BtlController_Empty, + [CONTROLLER_32] = BtlController_Empty, + [CONTROLLER_TWORETURNVALUES] = BtlController_Empty, + [CONTROLLER_CHOSENMONRETURNVALUE] = BtlController_Empty, + [CONTROLLER_ONERETURNVALUE] = BtlController_Empty, + [CONTROLLER_ONERETURNVALUE_DUPLICATE] = BtlController_Empty, + [CONTROLLER_CLEARUNKVAR] = BtlController_Empty, + [CONTROLLER_SETUNKVAR] = BtlController_Empty, + [CONTROLLER_CLEARUNKFLAG] = BtlController_Empty, + [CONTROLLER_TOGGLEUNKFLAG] = BtlController_Empty, + [CONTROLLER_HITANIMATION] = BtlController_HandleHitAnimation, + [CONTROLLER_CANTSWITCH] = BtlController_Empty, [CONTROLLER_PLAYSE] = WallyHandlePlaySE, - [CONTROLLER_PLAYFANFAREORBGM] = WallyHandlePlayFanfareOrBGM, + [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, [CONTROLLER_FAINTINGCRY] = WallyHandleFaintingCry, - [CONTROLLER_INTROSLIDE] = WallyHandleIntroSlide, + [CONTROLLER_INTROSLIDE] = BtlController_HandleIntroSlide, [CONTROLLER_INTROTRAINERBALLTHROW] = WallyHandleIntroTrainerBallThrow, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = WallyHandleDrawPartyStatusSummary, - [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = WallyHandleHidePartyStatusSummary, - [CONTROLLER_ENDBOUNCE] = WallyHandleEndBounceEffect, - [CONTROLLER_SPRITEINVISIBILITY] = WallyHandleSpriteInvisibility, + [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = BtlController_Empty, + [CONTROLLER_ENDBOUNCE] = BtlController_Empty, + [CONTROLLER_SPRITEINVISIBILITY] = BtlController_Empty, [CONTROLLER_BATTLEANIMATION] = WallyHandleBattleAnimation, - [CONTROLLER_LINKSTANDBYMSG] = WallyHandleLinkStandbyMsg, - [CONTROLLER_RESETACTIONMOVESELECTION] = WallyHandleResetActionMoveSelection, + [CONTROLLER_LINKSTANDBYMSG] = BtlController_Empty, + [CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty, [CONTROLLER_ENDLINKBATTLE] = WallyHandleEndLinkBattle, - [CONTROLLER_DEBUGMENU] = WallyHandleBattleDebug, - [CONTROLLER_TERMINATOR_NOP] = WallyCmdEnd + [CONTROLLER_DEBUGMENU] = BtlController_Empty, + [CONTROLLER_TERMINATOR_NOP] = BtlController_TerminatorNop }; -static void SpriteCB_Null7(void) +void SetControllerToWally(u32 battler) { -} - -void SetControllerToWally(void) -{ - gBattlerControllerFuncs[gActiveBattler] = WallyBufferRunCommand; + gBattlerControllerEndFuncs[battler] = WallyBufferExecCompleted; + gBattlerControllerFuncs[battler] = WallyBufferRunCommand; gBattleStruct->wallyBattleState = 0; gBattleStruct->wallyMovesState = 0; gBattleStruct->wallyWaitFrames = 0; gBattleStruct->wallyMoveFrames = 0; } -static void WallyBufferRunCommand(void) +static void WallyBufferRunCommand(u32 battler) { - if (gBattleControllerExecFlags & gBitTable[gActiveBattler]) + if (gBattleControllerExecFlags & gBitTable[battler]) { - if (gBattleResources->bufferA[gActiveBattler][0] < ARRAY_COUNT(sWallyBufferCommands)) - sWallyBufferCommands[gBattleResources->bufferA[gActiveBattler][0]](); + if (gBattleResources->bufferA[battler][0] < ARRAY_COUNT(sWallyBufferCommands)) + sWallyBufferCommands[gBattleResources->bufferA[battler][0]](battler); else - WallyBufferExecCompleted(); + WallyBufferExecCompleted(battler); } } -static void WallyHandleActions(void) +static void WallyHandleActions(u32 battler) { switch (gBattleStruct->wallyBattleState) { @@ -198,8 +149,8 @@ static void WallyHandleActions(void) if (--gBattleStruct->wallyWaitFrames == 0) { PlaySE(SE_SELECT); - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_USE_MOVE, 0); - WallyBufferExecCompleted(); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_USE_MOVE, 0); + WallyBufferExecCompleted(battler); gBattleStruct->wallyBattleState++; gBattleStruct->wallyMovesState = 0; gBattleStruct->wallyWaitFrames = B_WAIT_TIME_LONG; @@ -209,8 +160,8 @@ static void WallyHandleActions(void) if (--gBattleStruct->wallyWaitFrames == 0) { PlaySE(SE_SELECT); - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_USE_MOVE, 0); - WallyBufferExecCompleted(); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_USE_MOVE, 0); + WallyBufferExecCompleted(battler); gBattleStruct->wallyBattleState++; gBattleStruct->wallyMovesState = 0; gBattleStruct->wallyWaitFrames = B_WAIT_TIME_LONG; @@ -219,8 +170,8 @@ static void WallyHandleActions(void) case 3: if (--gBattleStruct->wallyWaitFrames == 0) { - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_WALLY_THROW, 0); - WallyBufferExecCompleted(); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_WALLY_THROW, 0); + WallyBufferExecCompleted(battler); gBattleStruct->wallyBattleState++; gBattleStruct->wallyMovesState = 0; gBattleStruct->wallyWaitFrames = B_WAIT_TIME_LONG; @@ -240,987 +191,182 @@ static void WallyHandleActions(void) if (--gBattleStruct->wallyWaitFrames == 0) { PlaySE(SE_SELECT); - BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_USE_ITEM, 0); - WallyBufferExecCompleted(); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_USE_ITEM, 0); + WallyBufferExecCompleted(battler); } break; } } -static void CompleteOnBattlerSpriteCallbackDummy(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - WallyBufferExecCompleted(); -} - -static void CompleteOnInactiveTextPrinter(void) -{ - if (!IsTextPrinterActive(B_WIN_MSG)) - WallyBufferExecCompleted(); -} - -static void CompleteOnFinishedAnimation(void) -{ - if (!gDoingBattleAnim) - WallyBufferExecCompleted(); -} - -static void OpenBagAfterPaletteFade(void) +static void OpenBagAfterPaletteFade(u32 battler) { if (!gPaletteFade.active) { - gBattlerControllerFuncs[gActiveBattler] = CompleteOnChosenItem; + gBattlerControllerFuncs[battler] = CompleteOnChosenItem; ReshowBattleScreenDummy(); FreeAllWindowBuffers(); DoWallyTutorialBagMenu(); } } -static void CompleteOnChosenItem(void) +static void CompleteOnChosenItem(u32 battler) { if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) { - BtlController_EmitOneReturnValue(BUFFER_B, gSpecialVar_ItemId); - WallyBufferExecCompleted(); + BtlController_EmitOneReturnValue(battler, BUFFER_B, gSpecialVar_ItemId); + WallyBufferExecCompleted(battler); } } -static void Intro_TryShinyAnimShowHealthbox(void) +static void Intro_TryShinyAnimShowHealthbox(u32 battler) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) - TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); + if (!gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive) + TryShinyAnimation(battler, &gPlayerParty[gBattlerPartyIndexes[battler]]); - if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) - TryShinyAnimation(BATTLE_PARTNER(gActiveBattler), &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]); + if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].triedShinyMonAnim + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].ballAnimActive) + TryShinyAnimation(BATTLE_PARTNER(battler), &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]]); - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive - && gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (!gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].ballAnimActive + && gSprites[gBattleControllerData[battler]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); - UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); - StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(battler)]]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(battler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]], HEALTHBOX_ALL); + StartHealthboxSlideIn(BATTLE_PARTNER(battler)); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(battler)]); } - DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - StartHealthboxSlideIn(gActiveBattler); - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); + DestroySprite(&gSprites[gBattleControllerData[battler]]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], &gPlayerParty[gBattlerPartyIndexes[battler]], HEALTHBOX_ALL); + StartHealthboxSlideIn(battler); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[battler]); gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; - gBattlerControllerFuncs[gActiveBattler] = Intro_WaitForShinyAnimAndHealthbox; + gBattlerControllerFuncs[battler] = Intro_WaitForShinyAnimAndHealthbox; } - } -static void Intro_WaitForShinyAnimAndHealthbox(void) +static void Intro_WaitForShinyAnimAndHealthbox(u32 battler) { bool32 healthboxAnimDone = FALSE; - if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[battler]].callback == SpriteCallbackDummy) healthboxAnimDone = TRUE; - if (healthboxAnimDone && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim - && gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim) + if (healthboxAnimDone && gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim + && gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].finishedShinyMonAnim) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE; - gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].triedShinyMonAnim = FALSE; + gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].finishedShinyMonAnim = FALSE; FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); CreateTask(Task_PlayerController_RestoreBgmAfterCry, 10); - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - - WallyBufferExecCompleted(); - } -} - -static void CompleteOnHealthbarDone(void) -{ - s16 hpValue = MoveBattleBar(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0); - - SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - - if (hpValue != -1) - { - UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], HP_CURRENT, hpValue, gBattleMons[gActiveBattler].maxHP); - } - else - { - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - WallyBufferExecCompleted(); - } -} + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[battler]], battler); -static void DoHitAnimBlinkSpriteEffect(void) -{ - u8 spriteId = gBattlerSpriteIds[gActiveBattler]; - - if (gSprites[spriteId].data[1] == 32) - { - gSprites[spriteId].data[1] = 0; - gSprites[spriteId].invisible = FALSE; - gDoingBattleAnim = FALSE; - WallyBufferExecCompleted(); - } - else - { - if ((gSprites[spriteId].data[1] % 4) == 0) - gSprites[spriteId].invisible ^= 1; - gSprites[spriteId].data[1]++; + WallyBufferExecCompleted(battler); } } -static void DoSwitchOutAnimation(void) +static void WallyBufferExecCompleted(u32 battler) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - WallyBufferExecCompleted(); - } -} - -static void CompleteOnBankSpriteCallbackDummy2(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - WallyBufferExecCompleted(); -} - -static void CompleteOnFinishedBattleAnimation(void) -{ - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive) - WallyBufferExecCompleted(); -} - -static void WallyBufferExecCompleted(void) -{ - gBattlerControllerFuncs[gActiveBattler] = WallyBufferRunCommand; + gBattlerControllerFuncs[battler] = WallyBufferRunCommand; if (gBattleTypeFlags & BATTLE_TYPE_LINK) { u8 playerId = GetMultiplayerId(); - PrepareBufferDataTransferLink(2, 4, &playerId); - gBattleResources->bufferA[gActiveBattler][0] = CONTROLLER_TERMINATOR_NOP; - } - else - { - gBattleControllerExecFlags &= ~gBitTable[gActiveBattler]; - } -} - -static void CompleteOnFinishedStatusAnimation(void) -{ - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].statusAnimActive) - WallyBufferExecCompleted(); -} - -static void WallyHandleGetMonData(void) -{ - u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data - u32 size = 0; - u8 monToCheck; - s32 i; - - if (gBattleResources->bufferA[gActiveBattler][2] == 0) - { - size += CopyWallyMonData(gBattlerPartyIndexes[gActiveBattler], monData); - } - else - { - monToCheck = gBattleResources->bufferA[gActiveBattler][2]; - for (i = 0; i < PARTY_SIZE; i++) - { - if (monToCheck & 1) - size += CopyWallyMonData(i, monData + size); - monToCheck >>= 1; - } - } - BtlController_EmitDataTransfer(BUFFER_B, size, monData); - WallyBufferExecCompleted(); -} - -static u32 CopyWallyMonData(u8 monId, u8 *dst) -{ - struct BattlePokemon battleMon; - struct MovePpInfo moveData; - u8 nickname[20]; - u8 *src; - s16 data16; - u32 data32; - s32 size = 0; - - switch (gBattleResources->bufferA[gActiveBattler][1]) - { - case REQUEST_ALL_BATTLE: - battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); - battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); - for (size = 0; size < MAX_MON_MOVES; size++) - { - battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); - battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); - } - battleMon.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); - battleMon.friendship = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); - battleMon.experience = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); - battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); - battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); - battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); - battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); - battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); - battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); - battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); - battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); - battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP); - battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); - battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); - battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); - battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); - battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); - battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); - battleMon.abilityNum = GetMonData(&gPlayerParty[monId], MON_DATA_ABILITY_NUM); - battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); - battleMon.metLevel = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL); - GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname); - StringCopy_Nickname(battleMon.nickname, nickname); - GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName); - src = (u8 *)&battleMon; - for (size = 0; size < sizeof(battleMon); size++) - dst[size] = src[size]; - break; - case REQUEST_SPECIES_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_HELDITEM_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_MOVES_PP_BATTLE: - for (size = 0; size < MAX_MON_MOVES; size++) - { - moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size); - moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); - } - moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); - src = (u8 *)(&moveData); - for (size = 0; size < sizeof(moveData); size++) - dst[size] = src[size]; - break; - case REQUEST_MOVE1_BATTLE: - case REQUEST_MOVE2_BATTLE: - case REQUEST_MOVE3_BATTLE: - case REQUEST_MOVE4_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_PP_DATA_BATTLE: - for (size = 0; size < MAX_MON_MOVES; size++) - dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size); - dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES); - size++; - break; - case REQUEST_PPMOVE1_BATTLE: - case REQUEST_PPMOVE2_BATTLE: - case REQUEST_PPMOVE3_BATTLE: - case REQUEST_PPMOVE4_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE); - size = 1; - break; - case REQUEST_OTID_BATTLE: - data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - size = 3; - break; - case REQUEST_EXP_BATTLE: - data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - size = 3; - break; - case REQUEST_HP_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV); - size = 1; - break; - case REQUEST_ATK_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV); - size = 1; - break; - case REQUEST_DEF_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV); - size = 1; - break; - case REQUEST_SPEED_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV); - size = 1; - break; - case REQUEST_SPATK_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV); - size = 1; - break; - case REQUEST_SPDEF_EV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV); - size = 1; - break; - case REQUEST_FRIENDSHIP_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP); - size = 1; - break; - case REQUEST_POKERUS_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS); - size = 1; - break; - case REQUEST_MET_LOCATION_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION); - size = 1; - break; - case REQUEST_MET_LEVEL_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL); - size = 1; - break; - case REQUEST_MET_GAME_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME); - size = 1; - break; - case REQUEST_POKEBALL_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL); - size = 1; - break; - case REQUEST_ALL_IVS_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); - dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); - dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); - dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); - dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); - size = 6; - break; - case REQUEST_HP_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV); - size = 1; - break; - case REQUEST_ATK_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV); - size = 1; - break; - case REQUEST_DEF_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV); - size = 1; - break; - case REQUEST_SPEED_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV); - size = 1; - break; - case REQUEST_SPATK_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV); - size = 1; - break; - case REQUEST_SPDEF_IV_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV); - size = 1; - break; - case REQUEST_PERSONALITY_BATTLE: - data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - dst[3] = (data32 & 0xFF000000) >> 24; - size = 4; - break; - case REQUEST_CHECKSUM_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_STATUS_BATTLE: - data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS); - dst[0] = (data32 & 0x000000FF); - dst[1] = (data32 & 0x0000FF00) >> 8; - dst[2] = (data32 & 0x00FF0000) >> 16; - dst[3] = (data32 & 0xFF000000) >> 24; - size = 4; - break; - case REQUEST_LEVEL_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); - size = 1; - break; - case REQUEST_HP_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_MAX_HP_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_ATK_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_DEF_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPEED_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPATK_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_SPDEF_BATTLE: - data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF); - dst[0] = data16; - dst[1] = data16 >> 8; - size = 2; - break; - case REQUEST_COOL_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL); - size = 1; - break; - case REQUEST_BEAUTY_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY); - size = 1; - break; - case REQUEST_CUTE_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE); - size = 1; - break; - case REQUEST_SMART_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART); - size = 1; - break; - case REQUEST_TOUGH_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH); - size = 1; - break; - case REQUEST_SHEEN_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN); - size = 1; - break; - case REQUEST_COOL_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON); - size = 1; - break; - case REQUEST_BEAUTY_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON); - size = 1; - break; - case REQUEST_CUTE_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON); - size = 1; - break; - case REQUEST_SMART_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON); - size = 1; - break; - case REQUEST_TOUGH_RIBBON_BATTLE: - dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON); - size = 1; - break; - } - - return size; -} - -static void WallyHandleGetRawMonData(void) -{ - PlayerHandleGetRawMonData(); -} - -static void WallyHandleSetMonData(void) -{ - u8 monToCheck; - u8 i; - - if (gBattleResources->bufferA[gActiveBattler][2] == 0) - { - SetWallyMonData(gBattlerPartyIndexes[gActiveBattler]); - } - else - { - monToCheck = gBattleResources->bufferA[gActiveBattler][2]; - for (i = 0; i < PARTY_SIZE; i++) - { - if (monToCheck & 1) - SetWallyMonData(i); - monToCheck >>= 1; - } - } - WallyBufferExecCompleted(); -} - -static void SetWallyMonData(u8 monId) -{ - struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleResources->bufferA[gActiveBattler][3]; - struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleResources->bufferA[gActiveBattler][3]; - s32 i; - - switch (gBattleResources->bufferA[gActiveBattler][1]) - { - case REQUEST_ALL_BATTLE: - { - u8 iv; - - SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species); - SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); - for (i = 0; i < MAX_MON_MOVES; i++) - { - SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); - } - SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); - SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); - SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &battlePokemon->experience); - iv = battlePokemon->hpIV; - SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &iv); - iv = battlePokemon->attackIV; - SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &iv); - iv = battlePokemon->defenseIV; - SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv); - iv = battlePokemon->speedIV; - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &iv); - iv = battlePokemon->spAttackIV; - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv); - iv = battlePokemon->spDefenseIV; - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv); - SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); - SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1); - SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level); - SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp); - SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); - SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack); - SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense); - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &battlePokemon->speed); - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack); - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); - } - break; - case REQUEST_SPECIES_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HELDITEM_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MOVES_PP_BATTLE: - for (i = 0; i < MAX_MON_MOVES; i++) - { - SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]); - } - SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); - break; - case REQUEST_MOVE1_BATTLE: - case REQUEST_MOVE2_BATTLE: - case REQUEST_MOVE3_BATTLE: - case REQUEST_MOVE4_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_PP_DATA_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleResources->bufferA[gActiveBattler][3]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleResources->bufferA[gActiveBattler][4]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleResources->bufferA[gActiveBattler][5]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleResources->bufferA[gActiveBattler][6]); - SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleResources->bufferA[gActiveBattler][7]); - break; - case REQUEST_PPMOVE1_BATTLE: - case REQUEST_PPMOVE2_BATTLE: - case REQUEST_PPMOVE3_BATTLE: - case REQUEST_PPMOVE4_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleResources->bufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_OTID_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_EXP_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HP_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_EV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_FRIENDSHIP_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_POKERUS_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_LOCATION_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_LEVEL_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MET_GAME_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_POKEBALL_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ALL_IVS_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]); - SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][4]); - SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][5]); - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][6]); - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][7]); - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][8]); - break; - case REQUEST_HP_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_IV_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_PERSONALITY_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CHECKSUM_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_STATUS_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_LEVEL_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_HP_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_MAX_HP_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_ATK_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_DEF_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPEED_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPATK_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SPDEF_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_COOL_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_BEAUTY_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CUTE_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SMART_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_TOUGH_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SHEEN_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_COOL_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_BEAUTY_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_CUTE_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_SMART_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - case REQUEST_TOUGH_RIBBON_BATTLE: - SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleResources->bufferA[gActiveBattler][3]); - break; - } - - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); -} - -static void WallyHandleSetRawMonData(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleLoadMonSprite(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleSwitchInAnim(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleReturnMonToBall(void) -{ - if (gBattleResources->bufferA[gActiveBattler][1] == 0) - { - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON); - gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation; + PrepareBufferDataTransferLink(battler, 2, 4, &playerId); + gBattleResources->bufferA[battler][0] = CONTROLLER_TERMINATOR_NOP; } else { - FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - WallyBufferExecCompleted(); + gBattleControllerExecFlags &= ~gBitTable[battler]; } } #define sSpeedX data[0] -static void WallyHandleDrawTrainerPic(void) +static void WallyHandleDrawTrainerPic(u32 battler) { - DecompressTrainerBackPic(TRAINER_BACK_PIC_WALLY, gActiveBattler); - SetMultiuseSpriteTemplateToTrainerBack(TRAINER_BACK_PIC_WALLY, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, - 80, - 80 + 4 * (8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].size), - 30); - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = DISPLAY_WIDTH; - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; - gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy; + BtlController_HandleDrawTrainerPic(battler, TRAINER_BACK_PIC_WALLY, FALSE, + 80, 80 + 4 * (8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].size), + 30); } -static void WallyHandleTrainerSlide(void) +static void WallyHandleTrainerSlide(u32 battler) { - DecompressTrainerBackPic(TRAINER_BACK_PIC_WALLY, gActiveBattler); - SetMultiuseSpriteTemplateToTrainerBack(TRAINER_BACK_PIC_WALLY, GetBattlerPosition(gActiveBattler)); - gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, - 80, - 80 + 4 * (8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].size), - 30); - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = -96; - gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; - gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy2; + BtlController_HandleTrainerSlide(battler, TRAINER_BACK_PIC_WALLY); } #undef sSpeedX -static void WallyHandleTrainerSlideBack(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleFaintAnimation(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandlePaletteFade(void) +static void WallyHandleSuccessBallThrowAnim(u32 battler) { - WallyBufferExecCompleted(); + BtlController_HandleSuccessBallThrowAnim(battler, GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_BALL_THROW_WITH_TRAINER, FALSE); } -static void WallyHandleSuccessBallThrowAnim(void) +static void WallyHandleBallThrowAnim(u32 battler) { - gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS; - gDoingBattleAnim = TRUE; - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_BALL_THROW_WITH_TRAINER); - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedAnimation; + BtlController_HandleBallThrowAnim(battler, GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_BALL_THROW_WITH_TRAINER, FALSE); } -static void WallyHandleBallThrowAnim(void) +static void WallyHandleMoveAnimation(u32 battler) { - u8 ballThrowCaseId = gBattleResources->bufferA[gActiveBattler][1]; - - gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId; - gDoingBattleAnim = TRUE; - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_BALL_THROW_WITH_TRAINER); - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedAnimation; + BtlController_HandleMoveAnimation(battler, FALSE); } -static void WallyHandlePause(void) +static void WallyHandlePrintString(u32 battler) { - WallyBufferExecCompleted(); + BtlController_HandlePrintString(battler, FALSE, FALSE); } -static void WallyHandleMoveAnimation(void) +static void WallyHandlePrintSelectionString(u32 battler) { - u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); - - gAnimMoveTurn = gBattleResources->bufferA[gActiveBattler][3]; - gAnimMovePower = gBattleResources->bufferA[gActiveBattler][4] | (gBattleResources->bufferA[gActiveBattler][5] << 8); - gAnimMoveDmg = gBattleResources->bufferA[gActiveBattler][6] | (gBattleResources->bufferA[gActiveBattler][7] << 8) | (gBattleResources->bufferA[gActiveBattler][8] << 16) | (gBattleResources->bufferA[gActiveBattler][9] << 24); - gAnimFriendship = gBattleResources->bufferA[gActiveBattler][10]; - gWeatherMoveAnim = gBattleResources->bufferA[gActiveBattler][12] | (gBattleResources->bufferA[gActiveBattler][13] << 8); - gAnimDisableStructPtr = (struct DisableStruct *)&gBattleResources->bufferA[gActiveBattler][16]; - gTransformedPersonalities[gActiveBattler] = gAnimDisableStructPtr->transformedMonPersonality; - gTransformedOtIds[gActiveBattler] = gAnimDisableStructPtr->transformedMonOtId; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerControllerFuncs[gActiveBattler] = WallyDoMoveAnimation; -} - -static void WallyDoMoveAnimation(void) -{ - u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); - - switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState) - { - case 0: - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - { - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON); - } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1; - break; - case 1: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF); - DoMoveAnim(move); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2; - } - break; - case 2: - gAnimScriptCallback(); - if (!gAnimScriptActive) - { - SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL); - if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) - { - InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 3; - } - break; - case 3: - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) - { - CopyAllBattleSpritesInvisibilities(); - TrySetBehindSubstituteSpriteBit(gActiveBattler, gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - WallyBufferExecCompleted(); - } - break; - } -} - -static void WallyHandlePrintString(void) -{ - u16 *stringId; - - gBattle_BG0_X = 0; - gBattle_BG0_Y = 0; - stringId = (u16 *)(&gBattleResources->bufferA[gActiveBattler][2]); - BufferStringBattle(*stringId); - BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG); - gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; -} - -static void WallyHandlePrintSelectionString(void) -{ - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - WallyHandlePrintString(); + if (GetBattlerSide(battler) == B_SIDE_PLAYER) + WallyHandlePrintString(battler); else - WallyBufferExecCompleted(); + WallyBufferExecCompleted(battler); } -static void HandleChooseActionAfterDma3(void) +static void HandleChooseActionAfterDma3(u32 battler) { if (!IsDma3ManagerBusyWithBgCopy()) { gBattle_BG0_X = 0; gBattle_BG0_Y = DISPLAY_HEIGHT; - gBattlerControllerFuncs[gActiveBattler] = WallyHandleActions; + gBattlerControllerFuncs[battler] = WallyHandleActions; } } -static void WallyHandleChooseAction(void) +static void WallyHandleChooseAction(u32 battler) { s32 i; - gBattlerControllerFuncs[gActiveBattler] = HandleChooseActionAfterDma3; + gBattlerControllerFuncs[battler] = HandleChooseActionAfterDma3; BattlePutTextOnWindow(gText_BattleMenu, B_WIN_ACTION_MENU); for (i = 0; i < 4; i++) ActionSelectionDestroyCursorAt(i); - ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0); + ActionSelectionCreateCursorAt(gActionSelectionCursor[battler], 0); BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillWallyDo); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_ACTION_PROMPT); } -static void WallyHandleYesNoBox(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleChooseMove(void) +static void WallyHandleChooseMove(u32 battler) { switch (gBattleStruct->wallyMovesState) { case 0: - InitMoveSelectionsVarsAndStrings(); + InitMoveSelectionsVarsAndStrings(battler); gBattleStruct->wallyMovesState++; gBattleStruct->wallyMoveFrames = 80; break; @@ -1236,335 +382,65 @@ static void WallyHandleChooseMove(void) if (--gBattleStruct->wallyMoveFrames == 0) { PlaySE(SE_SELECT); - BtlController_EmitTwoReturnValues(BUFFER_B, 10, 0x100); - WallyBufferExecCompleted(); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, 0x100); + WallyBufferExecCompleted(battler); } break; } } -static void WallyHandleChooseItem(void) +static void WallyHandleChooseItem(u32 battler) { BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); - gBattlerControllerFuncs[gActiveBattler] = OpenBagAfterPaletteFade; - gBattlerInMenuId = gActiveBattler; + gBattlerControllerFuncs[battler] = OpenBagAfterPaletteFade; + gBattlerInMenuId = battler; } -static void WallyHandleChoosePokemon(void) +static void WallyHandleHealthBarUpdate(u32 battler) { - WallyBufferExecCompleted(); + BtlController_HandleHealthBarUpdate(battler, TRUE); } -static void WallyHandleCmd23(void) +// For some reason Wally's SE don't take side into account and pan is always the same. Possibly a bug +static void WallyHandlePlaySE(u32 battler) { - WallyBufferExecCompleted(); + PlaySE(gBattleResources->bufferA[battler][1] | (gBattleResources->bufferA[battler][2] << 8)); + WallyBufferExecCompleted(battler); } -static void WallyHandleHealthBarUpdate(void) +// All of the other controllers use CRY_MODE_FAINT. +// Wally's Pokémon during the tutorial is never intended to faint, so that's probably why it's different here. +static void WallyHandleFaintingCry(u32 battler) { - s16 hpVal; - - LoadBattleBarGfx(0); - hpVal = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); + u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES); - if (hpVal != INSTANT_HP_BAR_DROP) - { - u32 maxHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); - u32 curHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_HP); - - SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, curHP, hpVal); - } - else - { - u32 maxHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); - - SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, 0, hpVal); - UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], HP_CURRENT, 0, maxHP); - } - - gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthbarDone; -} - -static void WallyHandleExpUpdate(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleStatusIconUpdate(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleStatusAnimation(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleStatusXor(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleDataTransfer(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleDMA3Transfer(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandlePlayBGM(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleCmd32(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleTwoReturnValues(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleChosenMonReturnValue(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleOneReturnValue(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleOneReturnValue_Duplicate(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleClearUnkVar(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleSetUnkVar(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleClearUnkFlag(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleToggleUnkFlag(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleHitAnimation(void) -{ - if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE) - { - WallyBufferExecCompleted(); - } - else - { - gDoingBattleAnim = TRUE; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; - DoHitAnimHealthboxEffect(gActiveBattler); - gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; - } -} - -static void WallyHandleCantSwitch(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandlePlaySE(void) -{ - PlaySE(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - WallyBufferExecCompleted(); -} - -static void WallyHandlePlayFanfareOrBGM(void) -{ - if (gBattleResources->bufferA[gActiveBattler][3]) - { - BattleStopLowHpSound(); - PlayBGM(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - else - { - PlayFanfare(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - - WallyBufferExecCompleted(); -} - -static void WallyHandleFaintingCry(void) -{ - u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - - // Seems that it doesn't bother using CRY_MODE_FAINT because - // Wally's Pokémon during the tutorial is never intended to faint. PlayCry_Normal(species, 25); - WallyBufferExecCompleted(); -} - -static void WallyHandleIntroSlide(void) -{ - HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]); - gIntroSlideFlags |= 1; - WallyBufferExecCompleted(); -} - -static void WallyHandleIntroTrainerBallThrow(void) -{ - u8 paletteNum; - u8 taskId; - - SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 50; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].y; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[5] = gActiveBattler; - - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCB_FreePlayerSpriteLoadMonSprite); - StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1); - - paletteNum = AllocSpritePalette(0xD6F8); - LoadCompressedPalette(gTrainerBackPicPaletteTable[TRAINER_BACK_PIC_WALLY].data, OBJ_PLTT_ID(paletteNum), PLTT_SIZE_4BPP); - gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum; - - taskId = CreateTask(Task_StartSendOutAnim, 5); - gTasks[taskId].data[0] = gActiveBattler; - - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) - gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - - gBattleSpritesDataPtr->animationData->introAnimActive = TRUE; - gBattlerControllerFuncs[gActiveBattler] = BattleControllerDummy; + WallyBufferExecCompleted(battler); } -static void StartSendOutAnim(u8 battlerId) +static void WallyHandleIntroTrainerBallThrow(u32 battler) { - u16 species; - - gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies = 0; - gBattlerPartyIndexes[battlerId] = gBattleResources->bufferA[battlerId][1]; - species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); - gBattleControllerData[battlerId] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim); - SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId)); - gBattlerSpriteIds[battlerId] = CreateSprite(&gMultiuseSpriteTemplate, - GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2), - GetBattlerSpriteDefault_Y(battlerId), - GetBattlerSpriteSubpriority(battlerId)); - - gSprites[gBattleControllerData[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; - gSprites[gBattleControllerData[battlerId]].data[2] = battlerId; - - gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId; - gSprites[gBattlerSpriteIds[battlerId]].data[2] = species; - gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId; - - StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]); - gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE; - gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy; - gSprites[gBattleControllerData[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT); + const u32 *trainerPal = gTrainerBackPicPaletteTable[TRAINER_BACK_PIC_WALLY].data; + BtlController_HandleIntroTrainerBallThrow(battler, 0xD6F8, trainerPal, 31, Intro_TryShinyAnimShowHealthbox); } -static void Task_StartSendOutAnim(u8 taskId) +static void WallyHandleDrawPartyStatusSummary(u32 battler) { - if (gTasks[taskId].data[1] < 31) - { - gTasks[taskId].data[1]++; - } - else - { - u8 savedActiveBank = gActiveBattler; - - gActiveBattler = gTasks[taskId].data[0]; - gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - StartSendOutAnim(gActiveBattler); - gBattlerControllerFuncs[gActiveBattler] = Intro_TryShinyAnimShowHealthbox; - gActiveBattler = savedActiveBank; - DestroyTask(taskId); - } + BtlController_HandleDrawPartyStatusSummary(battler, B_SIDE_PLAYER, FALSE); } -static void WallyHandleDrawPartyStatusSummary(void) +static void WallyHandleBattleAnimation(u32 battler) { - if (gBattleResources->bufferA[gActiveBattler][1] != 0 && GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - { - WallyBufferExecCompleted(); - } - else - { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1; - gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleResources->bufferA[gActiveBattler][4], gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2]); - WallyBufferExecCompleted(); - } + BtlController_HandleBattleAnimation(battler, TRUE, FALSE); } -static void WallyHandleHidePartyStatusSummary(void) +static void WallyHandleEndLinkBattle(u32 battler) { - WallyBufferExecCompleted(); -} - -static void WallyHandleEndBounceEffect(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleSpriteInvisibility(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleBattleAnimation(void) -{ - u8 animationId = gBattleResources->bufferA[gActiveBattler][1]; - u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); - - if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument)) - WallyBufferExecCompleted(); - else - gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; -} - -static void WallyHandleLinkStandbyMsg(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleResetActionMoveSelection(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyHandleEndLinkBattle(void) -{ - gBattleOutcome = gBattleResources->bufferA[gActiveBattler][1]; + gBattleOutcome = gBattleResources->bufferA[battler][1]; FadeOutMapMusic(5); BeginFastPaletteFade(3); - WallyBufferExecCompleted(); + WallyBufferExecCompleted(battler); if (!(gBattleTypeFlags & BATTLE_TYPE_IS_MASTER) && gBattleTypeFlags & BATTLE_TYPE_LINK) - gBattlerControllerFuncs[gActiveBattler] = SetBattleEndCallbacks; -} - -static void WallyHandleBattleDebug(void) -{ - WallyBufferExecCompleted(); -} - -static void WallyCmdEnd(void) -{ + gBattlerControllerFuncs[battler] = SetBattleEndCallbacks; } diff --git a/src/battle_controllers.c b/src/battle_controllers.c index 6424bee41ec4..5deadd26edfc 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -1,24 +1,36 @@ #include "global.h" #include "battle.h" #include "battle_ai_main.h" +#include "battle_ai_util.h" #include "battle_anim.h" +#include "battle_arena.h" #include "battle_controllers.h" +#include "battle_gfx_sfx_util.h" +#include "battle_interface.h" #include "battle_message.h" #include "battle_setup.h" +#include "battle_tv.h" #include "cable_club.h" #include "link.h" #include "link_rfu.h" +#include "palette.h" #include "party_menu.h" #include "recorded_battle.h" +#include "string_util.h" +#include "sound.h" #include "task.h" #include "util.h" +#include "text.h" #include "constants/abilities.h" +#include "constants/songs.h" static EWRAM_DATA u8 sLinkSendTaskId = 0; static EWRAM_DATA u8 sLinkReceiveTaskId = 0; -static EWRAM_DATA u8 sUnused = 0; // Debug? Never read EWRAM_DATA struct UnusedControllerStruct gUnusedControllerStruct = {}; // Debug? Unused code that writes to it, never read -static EWRAM_DATA u8 sBattleBuffersTransferData[0x100] = {}; + +void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(u32 battler); +u8 gBattleControllerData[MAX_BATTLERS_COUNT]; // Used by the battle controllers to store misc sprite/task IDs for each battler +void (*gBattlerControllerEndFuncs[MAX_BATTLERS_COUNT])(u32 battler); // Controller's buffer complete function for each battler static void CreateTasksForSendRecvLinkBuffers(void); static void InitLinkBtlControllers(void); @@ -26,6 +38,9 @@ static void InitSinglePlayerBtlControllers(void); static void SetBattlePartyIds(void); static void Task_HandleSendLinkBuffersData(u8 taskId); static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId); +static void Task_StartSendOutAnim(u8 taskId); +static void SpriteCB_FreePlayerSpriteLoadMonSprite(struct Sprite *sprite); +static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite); void HandleLinkBattleSetup(void) { @@ -57,7 +72,6 @@ void SetUpBattleVarsAndBirchZigzagoon(void) HandleLinkBattleSetup(); gBattleControllerExecFlags = 0; ClearBattleAnimationVars(); - ClearBattleMonForms(); BattleAI_SetupItems(); BattleAI_SetupFlags(); @@ -171,6 +185,8 @@ static void InitSinglePlayerBtlControllers(void) gBattlerControllerFuncs[0] = SetControllerToSafari; else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL) gBattlerControllerFuncs[0] = SetControllerToWally; + else if (IsAiVsAiBattle()) + gBattlerControllerFuncs[0] = SetControllerToPlayerPartner; else gBattlerControllerFuncs[0] = SetControllerToPlayer; @@ -222,13 +238,19 @@ static void InitSinglePlayerBtlControllers(void) { gBattleMainFunc = BeginBattleIntro; - gBattlerControllerFuncs[0] = SetControllerToPlayer; + if (IsAiVsAiBattle()) + gBattlerControllerFuncs[0] = SetControllerToPlayerPartner; + else + gBattlerControllerFuncs[0] = SetControllerToPlayer; gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; gBattlerControllerFuncs[1] = SetControllerToOpponent; gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; - gBattlerControllerFuncs[2] = SetControllerToPlayer; + if (IsAiVsAiBattle()) + gBattlerControllerFuncs[2] = SetControllerToPlayerPartner; + else + gBattlerControllerFuncs[2] = SetControllerToPlayer; gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT; gBattlerControllerFuncs[3] = SetControllerToOpponent; @@ -607,7 +629,7 @@ static void SetBattlePartyIds(void) { if (i < 2) { - if (GET_BATTLER_SIDE2(i) == B_SIDE_PLAYER) + if (GetBattlerSide(i) == B_SIDE_PLAYER) { if (IsValidForBattle(&gPlayerParty[j])) { @@ -626,7 +648,7 @@ static void SetBattlePartyIds(void) } else { - if (GET_BATTLER_SIDE2(i) == B_SIDE_PLAYER) + if (GetBattlerSide(i) == B_SIDE_PLAYER) { if (IsValidForBattle(&gPlayerParty[j]) && gBattlerPartyIndexes[i - 2] != j) { @@ -657,13 +679,13 @@ static void SetBattlePartyIds(void) } } -static void PrepareBufferDataTransfer(u8 bufferId, u8 *data, u16 size) +static void PrepareBufferDataTransfer(u32 battler, u32 bufferId, u8 *data, u16 size) { s32 i; if (gBattleTypeFlags & BATTLE_TYPE_LINK) { - PrepareBufferDataTransferLink(bufferId, size, data); + PrepareBufferDataTransferLink(battler, bufferId, size, data); } else { @@ -671,11 +693,11 @@ static void PrepareBufferDataTransfer(u8 bufferId, u8 *data, u16 size) { case BUFFER_A: for (i = 0; i < size; data++, i++) - gBattleResources->bufferA[gActiveBattler][i] = *data; + gBattleResources->bufferA[battler][i] = *data; break; case BUFFER_B: for (i = 0; i < size; data++, i++) - gBattleResources->bufferB[gActiveBattler][i] = *data; + gBattleResources->bufferB[battler][i] = *data; break; } } @@ -695,8 +717,6 @@ static void CreateTasksForSendRecvLinkBuffers(void) gTasks[sLinkReceiveTaskId].data[13] = 0; gTasks[sLinkReceiveTaskId].data[14] = 0; gTasks[sLinkReceiveTaskId].data[15] = 0; - - sUnused = 0; } enum @@ -712,7 +732,7 @@ enum LINK_BUFF_DATA, }; -void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data) +void PrepareBufferDataTransferLink(u32 battler, u32 bufferId, u16 size, u8 *data) { s32 alignedSize; s32 i; @@ -724,7 +744,7 @@ void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data) gTasks[sLinkSendTaskId].data[14] = 0; } gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_BUFFER_ID] = bufferId; - gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_ACTIVE_BATTLER] = gActiveBattler; + gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_ACTIVE_BATTLER] = battler; gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_ATTACKER] = gBattlerAttacker; gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_TARGET] = gBattlerTarget; gLinkBattleSendBuffer[gTasks[sLinkSendTaskId].data[14] + LINK_BUFF_SIZE_LO] = alignedSize; @@ -862,7 +882,7 @@ void TryReceiveLinkBattleData(void) static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId) { u16 blockSize; - u8 battlerId; + u8 battler; u8 var; if (gTasks[taskId].data[15] != gTasks[taskId].data[14]) @@ -873,17 +893,17 @@ static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId) gTasks[taskId].data[12] = 0; gTasks[taskId].data[15] = 0; } - battlerId = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_ACTIVE_BATTLER]; + battler = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_ACTIVE_BATTLER]; blockSize = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_SIZE_LO] | (gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_SIZE_HI] << 8); switch (gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 0]) { case 0: - if (gBattleControllerExecFlags & gBitTable[battlerId]) + if (gBattleControllerExecFlags & gBitTable[battler]) return; - memcpy(gBattleResources->bufferA[battlerId], &gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_DATA], blockSize); - MarkBattlerReceivedLinkData(battlerId); + memcpy(gBattleResources->bufferA[battler], &gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_DATA], blockSize); + MarkBattlerReceivedLinkData(battler); if (!(gBattleTypeFlags & BATTLE_TYPE_IS_MASTER)) { @@ -894,11 +914,11 @@ static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId) } break; case 1: - memcpy(gBattleResources->bufferB[battlerId], &gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_DATA], blockSize); + memcpy(gBattleResources->bufferB[battler], &gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_DATA], blockSize); break; case 2: var = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_DATA]; - gBattleControllerExecFlags &= ~(gBitTable[battlerId] << (var * 4)); + gBattleControllerExecFlags &= ~(gBitTable[battler] << (var * 4)); break; } @@ -906,191 +926,191 @@ static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId) } } -void BtlController_EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck) +void BtlController_EmitGetMonData(u32 battler, u32 bufferId, u8 requestId, u8 monToCheck) { - sBattleBuffersTransferData[0] = CONTROLLER_GETMONDATA; - sBattleBuffersTransferData[1] = requestId; - sBattleBuffersTransferData[2] = monToCheck; - sBattleBuffersTransferData[3] = 0; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_GETMONDATA; + gBattleResources->transferBuffer[1] = requestId; + gBattleResources->transferBuffer[2] = monToCheck; + gBattleResources->transferBuffer[3] = 0; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } // Unused -static void BtlController_EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes) +static void BtlController_EmitGetRawMonData(u32 battler, u32 bufferId, u8 monId, u8 bytes) { - sBattleBuffersTransferData[0] = CONTROLLER_GETRAWMONDATA; - sBattleBuffersTransferData[1] = monId; - sBattleBuffersTransferData[2] = bytes; - sBattleBuffersTransferData[3] = 0; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_GETRAWMONDATA; + gBattleResources->transferBuffer[1] = monId; + gBattleResources->transferBuffer[2] = bytes; + gBattleResources->transferBuffer[3] = 0; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data) +void BtlController_EmitSetMonData(u32 battler, u32 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data) { s32 i; - sBattleBuffersTransferData[0] = CONTROLLER_SETMONDATA; - sBattleBuffersTransferData[1] = requestId; - sBattleBuffersTransferData[2] = monToCheck; + gBattleResources->transferBuffer[0] = CONTROLLER_SETMONDATA; + gBattleResources->transferBuffer[1] = requestId; + gBattleResources->transferBuffer[2] = monToCheck; for (i = 0; i < bytes; i++) - sBattleBuffersTransferData[3 + i] = *(u8 *)(data++); - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 3 + bytes); + gBattleResources->transferBuffer[3 + i] = *(u8 *)(data++); + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 3 + bytes); } // Unused -static void BtlController_EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data) +static void BtlController_EmitSetRawMonData(u32 battler, u32 bufferId, u8 monId, u8 bytes, void *data) { s32 i; - sBattleBuffersTransferData[0] = CONTROLLER_SETRAWMONDATA; - sBattleBuffersTransferData[1] = monId; - sBattleBuffersTransferData[2] = bytes; + gBattleResources->transferBuffer[0] = CONTROLLER_SETRAWMONDATA; + gBattleResources->transferBuffer[1] = monId; + gBattleResources->transferBuffer[2] = bytes; for (i = 0; i < bytes; i++) - sBattleBuffersTransferData[3 + i] = *(u8 *)(data++); - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, bytes + 3); + gBattleResources->transferBuffer[3 + i] = *(u8 *)(data++); + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, bytes + 3); } -void BtlController_EmitLoadMonSprite(u8 bufferId) +void BtlController_EmitLoadMonSprite(u32 battler, u32 bufferId) { - sBattleBuffersTransferData[0] = CONTROLLER_LOADMONSPRITE; - sBattleBuffersTransferData[1] = CONTROLLER_LOADMONSPRITE; - sBattleBuffersTransferData[2] = CONTROLLER_LOADMONSPRITE; - sBattleBuffersTransferData[3] = CONTROLLER_LOADMONSPRITE; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_LOADMONSPRITE; + gBattleResources->transferBuffer[1] = CONTROLLER_LOADMONSPRITE; + gBattleResources->transferBuffer[2] = CONTROLLER_LOADMONSPRITE; + gBattleResources->transferBuffer[3] = CONTROLLER_LOADMONSPRITE; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit) +void BtlController_EmitSwitchInAnim(u32 battler, u32 bufferId, u8 partyId, bool8 dontClearSubstituteBit) { - sBattleBuffersTransferData[0] = CONTROLLER_SWITCHINANIM; - sBattleBuffersTransferData[1] = partyId; - sBattleBuffersTransferData[2] = dontClearSubstituteBit; - sBattleBuffersTransferData[3] = 5; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_SWITCHINANIM; + gBattleResources->transferBuffer[1] = partyId; + gBattleResources->transferBuffer[2] = dontClearSubstituteBit; + gBattleResources->transferBuffer[3] = 5; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitReturnMonToBall(u8 bufferId, bool8 skipAnim) +void BtlController_EmitReturnMonToBall(u32 battler, u32 bufferId, bool8 skipAnim) { - sBattleBuffersTransferData[0] = CONTROLLER_RETURNMONTOBALL; - sBattleBuffersTransferData[1] = skipAnim; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2); + gBattleResources->transferBuffer[0] = CONTROLLER_RETURNMONTOBALL; + gBattleResources->transferBuffer[1] = skipAnim; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 2); } -void BtlController_EmitDrawTrainerPic(u8 bufferId) +void BtlController_EmitDrawTrainerPic(u32 battler, u32 bufferId) { - sBattleBuffersTransferData[0] = CONTROLLER_DRAWTRAINERPIC; - sBattleBuffersTransferData[1] = CONTROLLER_DRAWTRAINERPIC; - sBattleBuffersTransferData[2] = CONTROLLER_DRAWTRAINERPIC; - sBattleBuffersTransferData[3] = CONTROLLER_DRAWTRAINERPIC; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_DRAWTRAINERPIC; + gBattleResources->transferBuffer[1] = CONTROLLER_DRAWTRAINERPIC; + gBattleResources->transferBuffer[2] = CONTROLLER_DRAWTRAINERPIC; + gBattleResources->transferBuffer[3] = CONTROLLER_DRAWTRAINERPIC; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitTrainerSlide(u8 bufferId) +void BtlController_EmitTrainerSlide(u32 battler, u32 bufferId) { - sBattleBuffersTransferData[0] = CONTROLLER_TRAINERSLIDE; - sBattleBuffersTransferData[1] = CONTROLLER_TRAINERSLIDE; - sBattleBuffersTransferData[2] = CONTROLLER_TRAINERSLIDE; - sBattleBuffersTransferData[3] = CONTROLLER_TRAINERSLIDE; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_TRAINERSLIDE; + gBattleResources->transferBuffer[1] = CONTROLLER_TRAINERSLIDE; + gBattleResources->transferBuffer[2] = CONTROLLER_TRAINERSLIDE; + gBattleResources->transferBuffer[3] = CONTROLLER_TRAINERSLIDE; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitTrainerSlideBack(u8 bufferId) +void BtlController_EmitTrainerSlideBack(u32 battler, u32 bufferId) { - sBattleBuffersTransferData[0] = CONTROLLER_TRAINERSLIDEBACK; - sBattleBuffersTransferData[1] = CONTROLLER_TRAINERSLIDEBACK; - sBattleBuffersTransferData[2] = CONTROLLER_TRAINERSLIDEBACK; - sBattleBuffersTransferData[3] = CONTROLLER_TRAINERSLIDEBACK; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_TRAINERSLIDEBACK; + gBattleResources->transferBuffer[1] = CONTROLLER_TRAINERSLIDEBACK; + gBattleResources->transferBuffer[2] = CONTROLLER_TRAINERSLIDEBACK; + gBattleResources->transferBuffer[3] = CONTROLLER_TRAINERSLIDEBACK; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitFaintAnimation(u8 bufferId) +void BtlController_EmitFaintAnimation(u32 battler, u32 bufferId) { - sBattleBuffersTransferData[0] = CONTROLLER_FAINTANIMATION; - sBattleBuffersTransferData[1] = CONTROLLER_FAINTANIMATION; - sBattleBuffersTransferData[2] = CONTROLLER_FAINTANIMATION; - sBattleBuffersTransferData[3] = CONTROLLER_FAINTANIMATION; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_FAINTANIMATION; + gBattleResources->transferBuffer[1] = CONTROLLER_FAINTANIMATION; + gBattleResources->transferBuffer[2] = CONTROLLER_FAINTANIMATION; + gBattleResources->transferBuffer[3] = CONTROLLER_FAINTANIMATION; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } // Unused -static void BtlController_EmitPaletteFade(u8 bufferId) +static void BtlController_EmitPaletteFade(u32 battler, u32 bufferId) { - sBattleBuffersTransferData[0] = CONTROLLER_PALETTEFADE; - sBattleBuffersTransferData[1] = CONTROLLER_PALETTEFADE; - sBattleBuffersTransferData[2] = CONTROLLER_PALETTEFADE; - sBattleBuffersTransferData[3] = CONTROLLER_PALETTEFADE; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_PALETTEFADE; + gBattleResources->transferBuffer[1] = CONTROLLER_PALETTEFADE; + gBattleResources->transferBuffer[2] = CONTROLLER_PALETTEFADE; + gBattleResources->transferBuffer[3] = CONTROLLER_PALETTEFADE; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } // Unused -static void BtlController_EmitSuccessBallThrowAnim(u8 bufferId) +static void BtlController_EmitSuccessBallThrowAnim(u32 battler, u32 bufferId) { - sBattleBuffersTransferData[0] = CONTROLLER_SUCCESSBALLTHROWANIM; - sBattleBuffersTransferData[1] = CONTROLLER_SUCCESSBALLTHROWANIM; - sBattleBuffersTransferData[2] = CONTROLLER_SUCCESSBALLTHROWANIM; - sBattleBuffersTransferData[3] = CONTROLLER_SUCCESSBALLTHROWANIM; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_SUCCESSBALLTHROWANIM; + gBattleResources->transferBuffer[1] = CONTROLLER_SUCCESSBALLTHROWANIM; + gBattleResources->transferBuffer[2] = CONTROLLER_SUCCESSBALLTHROWANIM; + gBattleResources->transferBuffer[3] = CONTROLLER_SUCCESSBALLTHROWANIM; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitBallThrowAnim(u8 bufferId, u8 caseId) +void BtlController_EmitBallThrowAnim(u32 battler, u32 bufferId, u8 caseId) { - sBattleBuffersTransferData[0] = CONTROLLER_BALLTHROWANIM; - sBattleBuffersTransferData[1] = caseId; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2); + gBattleResources->transferBuffer[0] = CONTROLLER_BALLTHROWANIM; + gBattleResources->transferBuffer[1] = caseId; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 2); } // Unused -static void BtlController_EmitPause(u8 bufferId, u8 toWait, void *data) +static void BtlController_EmitPause(u32 battler, u32 bufferId, u8 toWait, void *data) { s32 i; - sBattleBuffersTransferData[0] = CONTROLLER_PAUSE; - sBattleBuffersTransferData[1] = toWait; + gBattleResources->transferBuffer[0] = CONTROLLER_PAUSE; + gBattleResources->transferBuffer[1] = toWait; for (i = 0; i < toWait * 3; i++) - sBattleBuffersTransferData[2 + i] = *(u8 *)(data++); - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, toWait * 3 + 2); -} - -void BtlController_EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 dmg, u8 friendship, struct DisableStruct *disableStructPtr, u8 multihit) -{ - sBattleBuffersTransferData[0] = CONTROLLER_MOVEANIMATION; - sBattleBuffersTransferData[1] = move; - sBattleBuffersTransferData[2] = (move & 0xFF00) >> 8; - sBattleBuffersTransferData[3] = turnOfMove; - sBattleBuffersTransferData[4] = movePower; - sBattleBuffersTransferData[5] = (movePower & 0xFF00) >> 8; - sBattleBuffersTransferData[6] = dmg; - sBattleBuffersTransferData[7] = (dmg & 0x0000FF00) >> 8; - sBattleBuffersTransferData[8] = (dmg & 0x00FF0000) >> 16; - sBattleBuffersTransferData[9] = (dmg & 0xFF000000) >> 24; - sBattleBuffersTransferData[10] = friendship; - sBattleBuffersTransferData[11] = multihit; + gBattleResources->transferBuffer[2 + i] = *(u8 *)(data++); + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, toWait * 3 + 2); +} + +void BtlController_EmitMoveAnimation(u32 battler, u32 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 dmg, u8 friendship, struct DisableStruct *disableStructPtr, u8 multihit) +{ + gBattleResources->transferBuffer[0] = CONTROLLER_MOVEANIMATION; + gBattleResources->transferBuffer[1] = move; + gBattleResources->transferBuffer[2] = (move & 0xFF00) >> 8; + gBattleResources->transferBuffer[3] = turnOfMove; + gBattleResources->transferBuffer[4] = movePower; + gBattleResources->transferBuffer[5] = (movePower & 0xFF00) >> 8; + gBattleResources->transferBuffer[6] = dmg; + gBattleResources->transferBuffer[7] = (dmg & 0x0000FF00) >> 8; + gBattleResources->transferBuffer[8] = (dmg & 0x00FF0000) >> 16; + gBattleResources->transferBuffer[9] = (dmg & 0xFF000000) >> 24; + gBattleResources->transferBuffer[10] = friendship; + gBattleResources->transferBuffer[11] = multihit; if (WEATHER_HAS_EFFECT) { - sBattleBuffersTransferData[12] = gBattleWeather; - sBattleBuffersTransferData[13] = (gBattleWeather & 0xFF00) >> 8; + gBattleResources->transferBuffer[12] = gBattleWeather; + gBattleResources->transferBuffer[13] = (gBattleWeather & 0xFF00) >> 8; } else { - sBattleBuffersTransferData[12] = 0; - sBattleBuffersTransferData[13] = 0; + gBattleResources->transferBuffer[12] = 0; + gBattleResources->transferBuffer[13] = 0; } - sBattleBuffersTransferData[14] = 0; - sBattleBuffersTransferData[15] = 0; - memcpy(&sBattleBuffersTransferData[16], disableStructPtr, sizeof(struct DisableStruct)); - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 16 + sizeof(struct DisableStruct)); + gBattleResources->transferBuffer[14] = 0; + gBattleResources->transferBuffer[15] = 0; + memcpy(&gBattleResources->transferBuffer[16], disableStructPtr, sizeof(struct DisableStruct)); + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 16 + sizeof(struct DisableStruct)); } -void BtlController_EmitPrintString(u8 bufferId, u16 stringID) +void BtlController_EmitPrintString(u32 battler, u32 bufferId, u16 stringID) { s32 i; struct BattleMsgData *stringInfo; - sBattleBuffersTransferData[0] = CONTROLLER_PRINTSTRING; - sBattleBuffersTransferData[1] = gBattleOutcome; - sBattleBuffersTransferData[2] = stringID; - sBattleBuffersTransferData[3] = (stringID & 0xFF00) >> 8; + gBattleResources->transferBuffer[0] = CONTROLLER_PRINTSTRING; + gBattleResources->transferBuffer[1] = gBattleOutcome; + gBattleResources->transferBuffer[2] = stringID; + gBattleResources->transferBuffer[3] = (stringID & 0xFF00) >> 8; - stringInfo = (struct BattleMsgData *)(&sBattleBuffersTransferData[4]); + stringInfo = (struct BattleMsgData *)(&gBattleResources->transferBuffer[4]); stringInfo->currentMove = gCurrentMove; stringInfo->originallyUsedMove = gChosenMove; stringInfo->lastItem = gLastUsedItem; @@ -1109,20 +1129,20 @@ void BtlController_EmitPrintString(u8 bufferId, u16 stringID) stringInfo->textBuffs[1][i] = gBattleTextBuff2[i]; stringInfo->textBuffs[2][i] = gBattleTextBuff3[i]; } - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(struct BattleMsgData) + 4); + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, sizeof(struct BattleMsgData) + 4); } -void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringID) +void BtlController_EmitPrintSelectionString(u32 battler, u32 bufferId, u16 stringID) { s32 i; struct BattleMsgData *stringInfo; - sBattleBuffersTransferData[0] = CONTROLLER_PRINTSTRINGPLAYERONLY; - sBattleBuffersTransferData[1] = CONTROLLER_PRINTSTRINGPLAYERONLY; - sBattleBuffersTransferData[2] = stringID; - sBattleBuffersTransferData[3] = (stringID & 0xFF00) >> 8; + gBattleResources->transferBuffer[0] = CONTROLLER_PRINTSTRINGPLAYERONLY; + gBattleResources->transferBuffer[1] = CONTROLLER_PRINTSTRINGPLAYERONLY; + gBattleResources->transferBuffer[2] = stringID; + gBattleResources->transferBuffer[3] = (stringID & 0xFF00) >> 8; - stringInfo = (struct BattleMsgData *)(&sBattleBuffersTransferData[4]); + stringInfo = (struct BattleMsgData *)(&gBattleResources->transferBuffer[4]); stringInfo->currentMove = gCurrentMove; stringInfo->originallyUsedMove = gChosenMove; stringInfo->lastItem = gLastUsedItem; @@ -1138,412 +1158,1891 @@ void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringID) stringInfo->textBuffs[1][i] = gBattleTextBuff2[i]; stringInfo->textBuffs[2][i] = gBattleTextBuff3[i]; } - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(struct BattleMsgData) + 4); + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, sizeof(struct BattleMsgData) + 4); } // itemId only relevant for B_ACTION_USE_ITEM -void BtlController_EmitChooseAction(u8 bufferId, u8 action, u16 itemId) +void BtlController_EmitChooseAction(u32 battler, u32 bufferId, u8 action, u16 itemId) { - sBattleBuffersTransferData[0] = CONTROLLER_CHOOSEACTION; - sBattleBuffersTransferData[1] = action; - sBattleBuffersTransferData[2] = itemId; - sBattleBuffersTransferData[3] = (itemId & 0xFF00) >> 8; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_CHOOSEACTION; + gBattleResources->transferBuffer[1] = action; + gBattleResources->transferBuffer[2] = itemId; + gBattleResources->transferBuffer[3] = (itemId & 0xFF00) >> 8; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } // Only used by the forfeit prompt in the Battle Frontier // For other Yes/No boxes in battle, see Cmd_yesnobox -void BtlController_EmitYesNoBox(u8 bufferId) +void BtlController_EmitYesNoBox(u32 battler, u32 bufferId) { - sBattleBuffersTransferData[0] = CONTROLLER_YESNOBOX; - sBattleBuffersTransferData[1] = CONTROLLER_YESNOBOX; - sBattleBuffersTransferData[2] = CONTROLLER_YESNOBOX; - sBattleBuffersTransferData[3] = CONTROLLER_YESNOBOX; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_YESNOBOX; + gBattleResources->transferBuffer[1] = CONTROLLER_YESNOBOX; + gBattleResources->transferBuffer[2] = CONTROLLER_YESNOBOX; + gBattleResources->transferBuffer[3] = CONTROLLER_YESNOBOX; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData) +void BtlController_EmitChooseMove(u32 battler, u32 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData) { s32 i; - sBattleBuffersTransferData[0] = CONTROLLER_CHOOSEMOVE; - sBattleBuffersTransferData[1] = isDoubleBattle; - sBattleBuffersTransferData[2] = NoPpNumber; - sBattleBuffersTransferData[3] = 0; + gBattleResources->transferBuffer[0] = CONTROLLER_CHOOSEMOVE; + gBattleResources->transferBuffer[1] = isDoubleBattle; + gBattleResources->transferBuffer[2] = NoPpNumber; + gBattleResources->transferBuffer[3] = 0; for (i = 0; i < sizeof(*movePpData); i++) - sBattleBuffersTransferData[4 + i] = *((u8 *)(movePpData) + i); - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(*movePpData) + 4); + gBattleResources->transferBuffer[4 + i] = *((u8 *)(movePpData) + i); + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, sizeof(*movePpData) + 4); } -void BtlController_EmitChooseItem(u8 bufferId, u8 *battlePartyOrder) +void BtlController_EmitChooseItem(u32 battler, u32 bufferId, u8 *battlePartyOrder) { s32 i; - sBattleBuffersTransferData[0] = CONTROLLER_OPENBAG; + gBattleResources->transferBuffer[0] = CONTROLLER_OPENBAG; for (i = 0; i < PARTY_SIZE / 2; i++) - sBattleBuffersTransferData[1 + i] = battlePartyOrder[i]; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[1 + i] = battlePartyOrder[i]; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 slotId, u16 abilityId, u8 *data) +void BtlController_EmitChoosePokemon(u32 battler, u32 bufferId, u8 caseId, u8 slotId, u16 abilityId, u8 *data) { s32 i; - sBattleBuffersTransferData[0] = CONTROLLER_CHOOSEPOKEMON; - sBattleBuffersTransferData[1] = caseId; - sBattleBuffersTransferData[2] = slotId; - sBattleBuffersTransferData[3] = abilityId & 0xFF; - sBattleBuffersTransferData[7] = (abilityId >> 8) & 0xFF; + gBattleResources->transferBuffer[0] = CONTROLLER_CHOOSEPOKEMON; + gBattleResources->transferBuffer[1] = caseId; + gBattleResources->transferBuffer[2] = slotId; + gBattleResources->transferBuffer[3] = abilityId & 0xFF; + gBattleResources->transferBuffer[7] = (abilityId >> 8) & 0xFF; for (i = 0; i < 3; i++) - sBattleBuffersTransferData[4 + i] = data[i]; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 8); // Only 7 bytes were written. + gBattleResources->transferBuffer[4 + i] = data[i]; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 8); // Only 7 bytes were written. } // Unused -static void BtlController_EmitCmd23(u8 bufferId) +static void BtlController_EmitCmd23(u32 battler, u32 bufferId) { - sBattleBuffersTransferData[0] = CONTROLLER_23; - sBattleBuffersTransferData[1] = CONTROLLER_23; - sBattleBuffersTransferData[2] = CONTROLLER_23; - sBattleBuffersTransferData[3] = CONTROLLER_23; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_23; + gBattleResources->transferBuffer[1] = CONTROLLER_23; + gBattleResources->transferBuffer[2] = CONTROLLER_23; + gBattleResources->transferBuffer[3] = CONTROLLER_23; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } // why is the argument u16 if it's being cast to s16 anyway? -void BtlController_EmitHealthBarUpdate(u8 bufferId, u16 hpValue) +void BtlController_EmitHealthBarUpdate(u32 battler, u32 bufferId, u16 hpValue) { - sBattleBuffersTransferData[0] = CONTROLLER_HEALTHBARUPDATE; - sBattleBuffersTransferData[1] = 0; - sBattleBuffersTransferData[2] = (s16)hpValue; - sBattleBuffersTransferData[3] = ((s16)hpValue & 0xFF00) >> 8; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_HEALTHBARUPDATE; + gBattleResources->transferBuffer[1] = 0; + gBattleResources->transferBuffer[2] = (s16)hpValue; + gBattleResources->transferBuffer[3] = ((s16)hpValue & 0xFF00) >> 8; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitExpUpdate(u8 bufferId, u8 partyId, s32 expPoints) +void BtlController_EmitExpUpdate(u32 battler, u32 bufferId, u8 partyId, s32 expPoints) { - sBattleBuffersTransferData[0] = CONTROLLER_EXPUPDATE; - sBattleBuffersTransferData[1] = partyId; - sBattleBuffersTransferData[2] = expPoints; - sBattleBuffersTransferData[3] = (expPoints & 0x0000FF00) >> 8; - sBattleBuffersTransferData[4] = (expPoints & 0x00FF0000) >> 16; - sBattleBuffersTransferData[5] = (expPoints & 0xFF000000) >> 24; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 6); + gBattleResources->transferBuffer[0] = CONTROLLER_EXPUPDATE; + gBattleResources->transferBuffer[1] = partyId; + gBattleResources->transferBuffer[2] = expPoints; + gBattleResources->transferBuffer[3] = (expPoints & 0x0000FF00) >> 8; + gBattleResources->transferBuffer[4] = (expPoints & 0x00FF0000) >> 16; + gBattleResources->transferBuffer[5] = (expPoints & 0xFF000000) >> 24; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 6); } -void BtlController_EmitStatusIconUpdate(u8 bufferId, u32 status1, u32 status2) +void BtlController_EmitStatusIconUpdate(u32 battler, u32 bufferId, u32 status1, u32 status2) { - sBattleBuffersTransferData[0] = CONTROLLER_STATUSICONUPDATE; - sBattleBuffersTransferData[1] = status1; - sBattleBuffersTransferData[2] = (status1 & 0x0000FF00) >> 8; - sBattleBuffersTransferData[3] = (status1 & 0x00FF0000) >> 16; - sBattleBuffersTransferData[4] = (status1 & 0xFF000000) >> 24; - sBattleBuffersTransferData[5] = status2; - sBattleBuffersTransferData[6] = (status2 & 0x0000FF00) >> 8; - sBattleBuffersTransferData[7] = (status2 & 0x00FF0000) >> 16; - sBattleBuffersTransferData[8] = (status2 & 0xFF000000) >> 24; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 9); + gBattleResources->transferBuffer[0] = CONTROLLER_STATUSICONUPDATE; + gBattleResources->transferBuffer[1] = status1; + gBattleResources->transferBuffer[2] = (status1 & 0x0000FF00) >> 8; + gBattleResources->transferBuffer[3] = (status1 & 0x00FF0000) >> 16; + gBattleResources->transferBuffer[4] = (status1 & 0xFF000000) >> 24; + gBattleResources->transferBuffer[5] = status2; + gBattleResources->transferBuffer[6] = (status2 & 0x0000FF00) >> 8; + gBattleResources->transferBuffer[7] = (status2 & 0x00FF0000) >> 16; + gBattleResources->transferBuffer[8] = (status2 & 0xFF000000) >> 24; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 9); } -void BtlController_EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status) +void BtlController_EmitStatusAnimation(u32 battler, u32 bufferId, bool8 status2, u32 status) { - sBattleBuffersTransferData[0] = CONTROLLER_STATUSANIMATION; - sBattleBuffersTransferData[1] = status2; - sBattleBuffersTransferData[2] = status; - sBattleBuffersTransferData[3] = (status & 0x0000FF00) >> 8; - sBattleBuffersTransferData[4] = (status & 0x00FF0000) >> 16; - sBattleBuffersTransferData[5] = (status & 0xFF000000) >> 24; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 6); + gBattleResources->transferBuffer[0] = CONTROLLER_STATUSANIMATION; + gBattleResources->transferBuffer[1] = status2; + gBattleResources->transferBuffer[2] = status; + gBattleResources->transferBuffer[3] = (status & 0x0000FF00) >> 8; + gBattleResources->transferBuffer[4] = (status & 0x00FF0000) >> 16; + gBattleResources->transferBuffer[5] = (status & 0xFF000000) >> 24; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 6); } // Unused -static void BtlController_EmitStatusXor(u8 bufferId, u8 b) +static void BtlController_EmitStatusXor(u32 battler, u32 bufferId, u8 b) { - sBattleBuffersTransferData[0] = CONTROLLER_STATUSXOR; - sBattleBuffersTransferData[1] = b; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2); + gBattleResources->transferBuffer[0] = CONTROLLER_STATUSXOR; + gBattleResources->transferBuffer[1] = b; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 2); } -void BtlController_EmitDataTransfer(u8 bufferId, u16 size, void *data) +void BtlController_EmitDataTransfer(u32 battler, u32 bufferId, u16 size, void *data) { s32 i; - sBattleBuffersTransferData[0] = CONTROLLER_DATATRANSFER; - sBattleBuffersTransferData[1] = CONTROLLER_DATATRANSFER; - sBattleBuffersTransferData[2] = size; - sBattleBuffersTransferData[3] = (size & 0xFF00) >> 8; + gBattleResources->transferBuffer[0] = CONTROLLER_DATATRANSFER; + gBattleResources->transferBuffer[1] = CONTROLLER_DATATRANSFER; + gBattleResources->transferBuffer[2] = size; + gBattleResources->transferBuffer[3] = (size & 0xFF00) >> 8; for (i = 0; i < size; i++) - sBattleBuffersTransferData[4 + i] = *(u8 *)(data++); - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, size + 4); + gBattleResources->transferBuffer[4 + i] = *(u8 *)(data++); + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, size + 4); } // Unused -static void BtlController_EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data) +static void BtlController_EmitDMA3Transfer(u32 battler, u32 bufferId, void *dst, u16 size, void *data) { s32 i; - sBattleBuffersTransferData[0] = CONTROLLER_DMA3TRANSFER; - sBattleBuffersTransferData[1] = (u32)(dst); - sBattleBuffersTransferData[2] = ((u32)(dst) & 0x0000FF00) >> 8; - sBattleBuffersTransferData[3] = ((u32)(dst) & 0x00FF0000) >> 16; - sBattleBuffersTransferData[4] = ((u32)(dst) & 0xFF000000) >> 24; - sBattleBuffersTransferData[5] = size; - sBattleBuffersTransferData[6] = (size & 0xFF00) >> 8; + gBattleResources->transferBuffer[0] = CONTROLLER_DMA3TRANSFER; + gBattleResources->transferBuffer[1] = (u32)(dst); + gBattleResources->transferBuffer[2] = ((u32)(dst) & 0x0000FF00) >> 8; + gBattleResources->transferBuffer[3] = ((u32)(dst) & 0x00FF0000) >> 16; + gBattleResources->transferBuffer[4] = ((u32)(dst) & 0xFF000000) >> 24; + gBattleResources->transferBuffer[5] = size; + gBattleResources->transferBuffer[6] = (size & 0xFF00) >> 8; for (i = 0; i < size; i++) - sBattleBuffersTransferData[7 + i] = *(u8 *)(data++); - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, size + 7); + gBattleResources->transferBuffer[7 + i] = *(u8 *)(data++); + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, size + 7); } // Unused -static void BtlController_EmitPlayBGM(u8 bufferId, u16 songId, void *data) +static void BtlController_EmitPlayBGM(u32 battler, u32 bufferId, u16 songId, void *data) { s32 i; - sBattleBuffersTransferData[0] = CONTROLLER_PLAYBGM; - sBattleBuffersTransferData[1] = songId; - sBattleBuffersTransferData[2] = (songId & 0xFF00) >> 8; + gBattleResources->transferBuffer[0] = CONTROLLER_PLAYBGM; + gBattleResources->transferBuffer[1] = songId; + gBattleResources->transferBuffer[2] = (songId & 0xFF00) >> 8; // Nonsense loop using songId as a size // Would go out of bounds for any song id after SE_RG_BAG_POCKET (253) for (i = 0; i < songId; i++) - sBattleBuffersTransferData[3 + i] = *(u8 *)(data++); - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, songId + 3); + gBattleResources->transferBuffer[3 + i] = *(u8 *)(data++); + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, songId + 3); } // Unused -static void BtlController_EmitCmd32(u8 bufferId, u16 size, void *data) +static void BtlController_EmitCmd32(u32 battler, u32 bufferId, u16 size, void *data) { s32 i; - sBattleBuffersTransferData[0] = CONTROLLER_32; - sBattleBuffersTransferData[1] = size; - sBattleBuffersTransferData[2] = (size & 0xFF00) >> 8; + gBattleResources->transferBuffer[0] = CONTROLLER_32; + gBattleResources->transferBuffer[1] = size; + gBattleResources->transferBuffer[2] = (size & 0xFF00) >> 8; for (i = 0; i < size; i++) - sBattleBuffersTransferData[3 + i] = *(u8 *)(data++); - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, size + 3); + gBattleResources->transferBuffer[3 + i] = *(u8 *)(data++); + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, size + 3); } -void BtlController_EmitTwoReturnValues(u8 bufferId, u8 ret8, u32 ret32) +void BtlController_EmitTwoReturnValues(u32 battler, u32 bufferId, u8 ret8, u32 ret32) { - sBattleBuffersTransferData[0] = CONTROLLER_TWORETURNVALUES; - sBattleBuffersTransferData[1] = ret8; - sBattleBuffersTransferData[2] = ret32; - sBattleBuffersTransferData[3] = (ret32 & 0x0000FF00) >> 8; - sBattleBuffersTransferData[4] = (ret32 & 0x00FF0000) >> 16; - sBattleBuffersTransferData[5] = (ret32 & 0xFF000000) >> 24; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 6); + gBattleResources->transferBuffer[0] = CONTROLLER_TWORETURNVALUES; + gBattleResources->transferBuffer[1] = ret8; + gBattleResources->transferBuffer[2] = ret32; + gBattleResources->transferBuffer[3] = (ret32 & 0x0000FF00) >> 8; + gBattleResources->transferBuffer[4] = (ret32 & 0x00FF0000) >> 16; + gBattleResources->transferBuffer[5] = (ret32 & 0xFF000000) >> 24; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 6); } -void BtlController_EmitChosenMonReturnValue(u8 bufferId, u8 partyId, u8 *battlePartyOrder) +void BtlController_EmitChosenMonReturnValue(u32 battler, u32 bufferId, u8 partyId, u8 *battlePartyOrder) { s32 i; - sBattleBuffersTransferData[0] = CONTROLLER_CHOSENMONRETURNVALUE; - sBattleBuffersTransferData[1] = partyId; + gBattleResources->transferBuffer[0] = CONTROLLER_CHOSENMONRETURNVALUE; + gBattleResources->transferBuffer[1] = partyId; for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++) - sBattleBuffersTransferData[2 + i] = battlePartyOrder[i]; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 5); + gBattleResources->transferBuffer[2 + i] = battlePartyOrder[i]; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 5); } -void BtlController_EmitOneReturnValue(u8 bufferId, u16 ret) +void BtlController_EmitOneReturnValue(u32 battler, u32 bufferId, u16 ret) { - sBattleBuffersTransferData[0] = CONTROLLER_ONERETURNVALUE; - sBattleBuffersTransferData[1] = ret; - sBattleBuffersTransferData[2] = (ret & 0xFF00) >> 8; - sBattleBuffersTransferData[3] = 0; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_ONERETURNVALUE; + gBattleResources->transferBuffer[1] = ret; + gBattleResources->transferBuffer[2] = (ret & 0xFF00) >> 8; + gBattleResources->transferBuffer[3] = 0; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitOneReturnValue_Duplicate(u8 bufferId, u16 ret) +void BtlController_EmitOneReturnValue_Duplicate(u32 battler, u32 bufferId, u16 ret) { - sBattleBuffersTransferData[0] = CONTROLLER_ONERETURNVALUE_DUPLICATE; - sBattleBuffersTransferData[1] = ret; - sBattleBuffersTransferData[2] = (ret & 0xFF00) >> 8; - sBattleBuffersTransferData[3] = 0; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_ONERETURNVALUE_DUPLICATE; + gBattleResources->transferBuffer[1] = ret; + gBattleResources->transferBuffer[2] = (ret & 0xFF00) >> 8; + gBattleResources->transferBuffer[3] = 0; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } // Unused -static void BtlController_EmitClearUnkVar(u8 bufferId) +static void BtlController_EmitClearUnkVar(u32 battler, u32 bufferId) { - sBattleBuffersTransferData[0] = CONTROLLER_CLEARUNKVAR; - sBattleBuffersTransferData[1] = CONTROLLER_CLEARUNKVAR; - sBattleBuffersTransferData[2] = CONTROLLER_CLEARUNKVAR; - sBattleBuffersTransferData[3] = CONTROLLER_CLEARUNKVAR; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_CLEARUNKVAR; + gBattleResources->transferBuffer[1] = CONTROLLER_CLEARUNKVAR; + gBattleResources->transferBuffer[2] = CONTROLLER_CLEARUNKVAR; + gBattleResources->transferBuffer[3] = CONTROLLER_CLEARUNKVAR; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } // Unused -static void BtlController_EmitSetUnkVar(u8 bufferId, u8 b) +static void BtlController_EmitSetUnkVar(u32 battler, u32 bufferId, u8 b) { - sBattleBuffersTransferData[0] = CONTROLLER_SETUNKVAR; - sBattleBuffersTransferData[1] = b; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2); + gBattleResources->transferBuffer[0] = CONTROLLER_SETUNKVAR; + gBattleResources->transferBuffer[1] = b; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 2); } // Unused -static void BtlController_EmitClearUnkFlag(u8 bufferId) +static void BtlController_EmitClearUnkFlag(u32 battler, u32 bufferId) { - sBattleBuffersTransferData[0] = CONTROLLER_CLEARUNKFLAG; - sBattleBuffersTransferData[1] = CONTROLLER_CLEARUNKFLAG; - sBattleBuffersTransferData[2] = CONTROLLER_CLEARUNKFLAG; - sBattleBuffersTransferData[3] = CONTROLLER_CLEARUNKFLAG; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_CLEARUNKFLAG; + gBattleResources->transferBuffer[1] = CONTROLLER_CLEARUNKFLAG; + gBattleResources->transferBuffer[2] = CONTROLLER_CLEARUNKFLAG; + gBattleResources->transferBuffer[3] = CONTROLLER_CLEARUNKFLAG; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } // Unused -static void BtlController_EmitToggleUnkFlag(u8 bufferId) +static void BtlController_EmitToggleUnkFlag(u32 battler, u32 bufferId) { - sBattleBuffersTransferData[0] = CONTROLLER_TOGGLEUNKFLAG; - sBattleBuffersTransferData[1] = CONTROLLER_TOGGLEUNKFLAG; - sBattleBuffersTransferData[2] = CONTROLLER_TOGGLEUNKFLAG; - sBattleBuffersTransferData[3] = CONTROLLER_TOGGLEUNKFLAG; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_TOGGLEUNKFLAG; + gBattleResources->transferBuffer[1] = CONTROLLER_TOGGLEUNKFLAG; + gBattleResources->transferBuffer[2] = CONTROLLER_TOGGLEUNKFLAG; + gBattleResources->transferBuffer[3] = CONTROLLER_TOGGLEUNKFLAG; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitHitAnimation(u8 bufferId) +void BtlController_EmitHitAnimation(u32 battler, u32 bufferId) { - sBattleBuffersTransferData[0] = CONTROLLER_HITANIMATION; - sBattleBuffersTransferData[1] = CONTROLLER_HITANIMATION; - sBattleBuffersTransferData[2] = CONTROLLER_HITANIMATION; - sBattleBuffersTransferData[3] = CONTROLLER_HITANIMATION; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_HITANIMATION; + gBattleResources->transferBuffer[1] = CONTROLLER_HITANIMATION; + gBattleResources->transferBuffer[2] = CONTROLLER_HITANIMATION; + gBattleResources->transferBuffer[3] = CONTROLLER_HITANIMATION; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitCantSwitch(u8 bufferId) +void BtlController_EmitCantSwitch(u32 battler, u32 bufferId) { - sBattleBuffersTransferData[0] = CONTROLLER_CANTSWITCH; - sBattleBuffersTransferData[1] = CONTROLLER_CANTSWITCH; - sBattleBuffersTransferData[2] = CONTROLLER_CANTSWITCH; - sBattleBuffersTransferData[3] = CONTROLLER_CANTSWITCH; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_CANTSWITCH; + gBattleResources->transferBuffer[1] = CONTROLLER_CANTSWITCH; + gBattleResources->transferBuffer[2] = CONTROLLER_CANTSWITCH; + gBattleResources->transferBuffer[3] = CONTROLLER_CANTSWITCH; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitPlaySE(u8 bufferId, u16 songId) +void BtlController_EmitPlaySE(u32 battler, u32 bufferId, u16 songId) { - sBattleBuffersTransferData[0] = CONTROLLER_PLAYSE; - sBattleBuffersTransferData[1] = songId; - sBattleBuffersTransferData[2] = (songId & 0xFF00) >> 8; - sBattleBuffersTransferData[3] = 0; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_PLAYSE; + gBattleResources->transferBuffer[1] = songId; + gBattleResources->transferBuffer[2] = (songId & 0xFF00) >> 8; + gBattleResources->transferBuffer[3] = 0; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitPlayFanfareOrBGM(u8 bufferId, u16 songId, bool8 playBGM) +void BtlController_EmitPlayFanfareOrBGM(u32 battler, u32 bufferId, u16 songId, bool8 playBGM) { - sBattleBuffersTransferData[0] = CONTROLLER_PLAYFANFAREORBGM; - sBattleBuffersTransferData[1] = songId; - sBattleBuffersTransferData[2] = (songId & 0xFF00) >> 8; - sBattleBuffersTransferData[3] = playBGM; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_PLAYFANFAREORBGM; + gBattleResources->transferBuffer[1] = songId; + gBattleResources->transferBuffer[2] = (songId & 0xFF00) >> 8; + gBattleResources->transferBuffer[3] = playBGM; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitFaintingCry(u8 bufferId) +void BtlController_EmitFaintingCry(u32 battler, u32 bufferId) { - sBattleBuffersTransferData[0] = CONTROLLER_FAINTINGCRY; - sBattleBuffersTransferData[1] = CONTROLLER_FAINTINGCRY; - sBattleBuffersTransferData[2] = CONTROLLER_FAINTINGCRY; - sBattleBuffersTransferData[3] = CONTROLLER_FAINTINGCRY; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_FAINTINGCRY; + gBattleResources->transferBuffer[1] = CONTROLLER_FAINTINGCRY; + gBattleResources->transferBuffer[2] = CONTROLLER_FAINTINGCRY; + gBattleResources->transferBuffer[3] = CONTROLLER_FAINTINGCRY; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitIntroSlide(u8 bufferId, u8 terrainId) +void BtlController_EmitIntroSlide(u32 battler, u32 bufferId, u8 terrainId) { - sBattleBuffersTransferData[0] = CONTROLLER_INTROSLIDE; - sBattleBuffersTransferData[1] = terrainId; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2); + gBattleResources->transferBuffer[0] = CONTROLLER_INTROSLIDE; + gBattleResources->transferBuffer[1] = terrainId; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 2); } -void BtlController_EmitIntroTrainerBallThrow(u8 bufferId) +void BtlController_EmitIntroTrainerBallThrow(u32 battler, u32 bufferId) { - sBattleBuffersTransferData[0] = CONTROLLER_INTROTRAINERBALLTHROW; - sBattleBuffersTransferData[1] = CONTROLLER_INTROTRAINERBALLTHROW; - sBattleBuffersTransferData[2] = CONTROLLER_INTROTRAINERBALLTHROW; - sBattleBuffersTransferData[3] = CONTROLLER_INTROTRAINERBALLTHROW; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_INTROTRAINERBALLTHROW; + gBattleResources->transferBuffer[1] = CONTROLLER_INTROTRAINERBALLTHROW; + gBattleResources->transferBuffer[2] = CONTROLLER_INTROTRAINERBALLTHROW; + gBattleResources->transferBuffer[3] = CONTROLLER_INTROTRAINERBALLTHROW; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 flags) +void BtlController_EmitDrawPartyStatusSummary(u32 battler, u32 bufferId, struct HpAndStatus* hpAndStatus, u8 flags) { s32 i; - sBattleBuffersTransferData[0] = CONTROLLER_DRAWPARTYSTATUSSUMMARY; - sBattleBuffersTransferData[1] = flags & ~PARTY_SUMM_SKIP_DRAW_DELAY; // If true, skip player side - sBattleBuffersTransferData[2] = (flags & PARTY_SUMM_SKIP_DRAW_DELAY) >> 7; // If true, skip delay after drawing. True during intro - sBattleBuffersTransferData[3] = CONTROLLER_DRAWPARTYSTATUSSUMMARY; + gBattleResources->transferBuffer[0] = CONTROLLER_DRAWPARTYSTATUSSUMMARY; + gBattleResources->transferBuffer[1] = flags & ~PARTY_SUMM_SKIP_DRAW_DELAY; // If true, skip player side + gBattleResources->transferBuffer[2] = (flags & PARTY_SUMM_SKIP_DRAW_DELAY) >> 7; // If true, skip delay after drawing. True during intro + gBattleResources->transferBuffer[3] = CONTROLLER_DRAWPARTYSTATUSSUMMARY; for (i = 0; i < (s32)(sizeof(struct HpAndStatus) * PARTY_SIZE); i++) - sBattleBuffersTransferData[4 + i] = *(i + (u8 *)(hpAndStatus)); - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(struct HpAndStatus) * PARTY_SIZE + 4); + gBattleResources->transferBuffer[4 + i] = *(i + (u8 *)(hpAndStatus)); + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, sizeof(struct HpAndStatus) * PARTY_SIZE + 4); } -void BtlController_EmitHidePartyStatusSummary(u8 bufferId) +void BtlController_EmitHidePartyStatusSummary(u32 battler, u32 bufferId) { - sBattleBuffersTransferData[0] = CONTROLLER_HIDEPARTYSTATUSSUMMARY; - sBattleBuffersTransferData[1] = CONTROLLER_HIDEPARTYSTATUSSUMMARY; - sBattleBuffersTransferData[2] = CONTROLLER_HIDEPARTYSTATUSSUMMARY; - sBattleBuffersTransferData[3] = CONTROLLER_HIDEPARTYSTATUSSUMMARY; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_HIDEPARTYSTATUSSUMMARY; + gBattleResources->transferBuffer[1] = CONTROLLER_HIDEPARTYSTATUSSUMMARY; + gBattleResources->transferBuffer[2] = CONTROLLER_HIDEPARTYSTATUSSUMMARY; + gBattleResources->transferBuffer[3] = CONTROLLER_HIDEPARTYSTATUSSUMMARY; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitEndBounceEffect(u8 bufferId) +void BtlController_EmitEndBounceEffect(u32 battler, u32 bufferId) { - sBattleBuffersTransferData[0] = CONTROLLER_ENDBOUNCE; - sBattleBuffersTransferData[1] = CONTROLLER_ENDBOUNCE; - sBattleBuffersTransferData[2] = CONTROLLER_ENDBOUNCE; - sBattleBuffersTransferData[3] = CONTROLLER_ENDBOUNCE; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_ENDBOUNCE; + gBattleResources->transferBuffer[1] = CONTROLLER_ENDBOUNCE; + gBattleResources->transferBuffer[2] = CONTROLLER_ENDBOUNCE; + gBattleResources->transferBuffer[3] = CONTROLLER_ENDBOUNCE; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible) +void BtlController_EmitSpriteInvisibility(u32 battler, u32 bufferId, bool8 isInvisible) { - sBattleBuffersTransferData[0] = CONTROLLER_SPRITEINVISIBILITY; - sBattleBuffersTransferData[1] = isInvisible; - sBattleBuffersTransferData[2] = CONTROLLER_SPRITEINVISIBILITY; - sBattleBuffersTransferData[3] = CONTROLLER_SPRITEINVISIBILITY; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_SPRITEINVISIBILITY; + gBattleResources->transferBuffer[1] = isInvisible; + gBattleResources->transferBuffer[2] = CONTROLLER_SPRITEINVISIBILITY; + gBattleResources->transferBuffer[3] = CONTROLLER_SPRITEINVISIBILITY; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } -void BtlController_EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument) +void BtlController_EmitBattleAnimation(u32 battler, u32 bufferId, u8 animationId, u16 argument) { - sBattleBuffersTransferData[0] = CONTROLLER_BATTLEANIMATION; - sBattleBuffersTransferData[1] = animationId; - sBattleBuffersTransferData[2] = argument; - sBattleBuffersTransferData[3] = (argument & 0xFF00) >> 8; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); + gBattleResources->transferBuffer[0] = CONTROLLER_BATTLEANIMATION; + gBattleResources->transferBuffer[1] = animationId; + gBattleResources->transferBuffer[2] = argument; + gBattleResources->transferBuffer[3] = (argument & 0xFF00) >> 8; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4); } // mode is a LINK_STANDBY_* constant -void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 mode, bool32 record) +void BtlController_EmitLinkStandbyMsg(u32 battler, u32 bufferId, u8 mode, bool32 record) +{ + gBattleResources->transferBuffer[0] = CONTROLLER_LINKSTANDBYMSG; + gBattleResources->transferBuffer[1] = mode; + + if (record) + gBattleResources->transferBuffer[3] = gBattleResources->transferBuffer[2] = RecordedBattle_BufferNewBattlerData(&gBattleResources->transferBuffer[4]); + else + gBattleResources->transferBuffer[3] = gBattleResources->transferBuffer[2] = 0; + + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, gBattleResources->transferBuffer[2] + 4); +} + +void BtlController_EmitResetActionMoveSelection(u32 battler, u32 bufferId, u8 caseId) +{ + gBattleResources->transferBuffer[0] = CONTROLLER_RESETACTIONMOVESELECTION; + gBattleResources->transferBuffer[1] = caseId; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 2); +} + +void BtlController_EmitEndLinkBattle(u32 battler, u32 bufferId, u8 battleOutcome) +{ + gBattleResources->transferBuffer[0] = CONTROLLER_ENDLINKBATTLE; + gBattleResources->transferBuffer[1] = battleOutcome; + gBattleResources->transferBuffer[2] = gSaveBlock2Ptr->frontier.disableRecordBattle; + gBattleResources->transferBuffer[3] = gSaveBlock2Ptr->frontier.disableRecordBattle; + gBattleResources->transferBuffer[5] = gBattleResources->transferBuffer[4] = RecordedBattle_BufferNewBattlerData(&gBattleResources->transferBuffer[6]); + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, gBattleResources->transferBuffer[4] + 6); +} + +void BtlController_EmitDebugMenu(u32 battler, u32 bufferId) +{ + gBattleResources->transferBuffer[0] = CONTROLLER_DEBUGMENU; + PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 1); +} + +// Standardized Controller functions + +// Can be used for all the controllers. +void BattleControllerComplete(u32 battler) +{ + gBattlerControllerEndFuncs[battler](battler); +} + +static u32 GetBattlerMonData(u32 battler, struct Pokemon *party, u32 monId, u8 *dst) +{ + struct BattlePokemon battleMon; + struct MovePpInfo moveData; + u8 nickname[POKEMON_NAME_LENGTH * 2]; + u8 *src; + s16 data16; + u32 data32; + s32 size = 0; + + switch (gBattleResources->bufferA[battler][1]) + { + case REQUEST_ALL_BATTLE: + battleMon.species = GetMonData(&party[monId], MON_DATA_SPECIES); + battleMon.item = GetMonData(&party[monId], MON_DATA_HELD_ITEM); + for (size = 0; size < MAX_MON_MOVES; size++) + { + battleMon.moves[size] = GetMonData(&party[monId], MON_DATA_MOVE1 + size); + battleMon.pp[size] = GetMonData(&party[monId], MON_DATA_PP1 + size); + } + battleMon.ppBonuses = GetMonData(&party[monId], MON_DATA_PP_BONUSES); + battleMon.friendship = GetMonData(&party[monId], MON_DATA_FRIENDSHIP); + battleMon.experience = GetMonData(&party[monId], MON_DATA_EXP); + battleMon.hpIV = GetMonData(&party[monId], MON_DATA_HP_IV); + battleMon.attackIV = GetMonData(&party[monId], MON_DATA_ATK_IV); + battleMon.defenseIV = GetMonData(&party[monId], MON_DATA_DEF_IV); + battleMon.speedIV = GetMonData(&party[monId], MON_DATA_SPEED_IV); + battleMon.spAttackIV = GetMonData(&party[monId], MON_DATA_SPATK_IV); + battleMon.spDefenseIV = GetMonData(&party[monId], MON_DATA_SPDEF_IV); + battleMon.personality = GetMonData(&party[monId], MON_DATA_PERSONALITY); + battleMon.status1 = GetMonData(&party[monId], MON_DATA_STATUS); + battleMon.level = GetMonData(&party[monId], MON_DATA_LEVEL); + battleMon.hp = GetMonData(&party[monId], MON_DATA_HP); + battleMon.maxHP = GetMonData(&party[monId], MON_DATA_MAX_HP); + battleMon.attack = GetMonData(&party[monId], MON_DATA_ATK); + battleMon.defense = GetMonData(&party[monId], MON_DATA_DEF); + battleMon.speed = GetMonData(&party[monId], MON_DATA_SPEED); + battleMon.spAttack = GetMonData(&party[monId], MON_DATA_SPATK); + battleMon.spDefense = GetMonData(&party[monId], MON_DATA_SPDEF); + battleMon.abilityNum = GetMonData(&party[monId], MON_DATA_ABILITY_NUM); + battleMon.otId = GetMonData(&party[monId], MON_DATA_OT_ID); + battleMon.metLevel = GetMonData(&party[monId], MON_DATA_MET_LEVEL); + GetMonData(&party[monId], MON_DATA_NICKNAME, nickname); + StringCopy_Nickname(battleMon.nickname, nickname); + GetMonData(&party[monId], MON_DATA_OT_NAME, battleMon.otName); + src = (u8 *)&battleMon; + for (size = 0; size < sizeof(battleMon); size++) + dst[size] = src[size]; + break; + case REQUEST_SPECIES_BATTLE: + data16 = GetMonData(&party[monId], MON_DATA_SPECIES); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_HELDITEM_BATTLE: + data16 = GetMonData(&party[monId], MON_DATA_HELD_ITEM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MOVES_PP_BATTLE: + for (size = 0; size < MAX_MON_MOVES; size++) + { + moveData.moves[size] = GetMonData(&party[monId], MON_DATA_MOVE1 + size); + moveData.pp[size] = GetMonData(&party[monId], MON_DATA_PP1 + size); + } + moveData.ppBonuses = GetMonData(&party[monId], MON_DATA_PP_BONUSES); + src = (u8 *)(&moveData); + for (size = 0; size < sizeof(moveData); size++) + dst[size] = src[size]; + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + data16 = GetMonData(&party[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[battler][1] - REQUEST_MOVE1_BATTLE); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_PP_DATA_BATTLE: + for (size = 0; size < MAX_MON_MOVES; size++) + dst[size] = GetMonData(&party[monId], MON_DATA_PP1 + size); + dst[size] = GetMonData(&party[monId], MON_DATA_PP_BONUSES); + size++; + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_PP1 + gBattleResources->bufferA[battler][1] - REQUEST_PPMOVE1_BATTLE); + size = 1; + break; + case REQUEST_OTID_BATTLE: + data32 = GetMonData(&party[monId], MON_DATA_OT_ID); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_EXP_BATTLE: + data32 = GetMonData(&party[monId], MON_DATA_EXP); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + size = 3; + break; + case REQUEST_HP_EV_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_HP_EV); + size = 1; + break; + case REQUEST_ATK_EV_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_ATK_EV); + size = 1; + break; + case REQUEST_DEF_EV_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_DEF_EV); + size = 1; + break; + case REQUEST_SPEED_EV_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_SPEED_EV); + size = 1; + break; + case REQUEST_SPATK_EV_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_SPATK_EV); + size = 1; + break; + case REQUEST_SPDEF_EV_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_SPDEF_EV); + size = 1; + break; + case REQUEST_FRIENDSHIP_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_FRIENDSHIP); + size = 1; + break; + case REQUEST_POKERUS_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_POKERUS); + size = 1; + break; + case REQUEST_MET_LOCATION_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_MET_LOCATION); + size = 1; + break; + case REQUEST_MET_LEVEL_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_MET_LEVEL); + size = 1; + break; + case REQUEST_MET_GAME_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_MET_GAME); + size = 1; + break; + case REQUEST_POKEBALL_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_POKEBALL); + size = 1; + break; + case REQUEST_ALL_IVS_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_HP_IV); + dst[1] = GetMonData(&party[monId], MON_DATA_ATK_IV); + dst[2] = GetMonData(&party[monId], MON_DATA_DEF_IV); + dst[3] = GetMonData(&party[monId], MON_DATA_SPEED_IV); + dst[4] = GetMonData(&party[monId], MON_DATA_SPATK_IV); + dst[5] = GetMonData(&party[monId], MON_DATA_SPDEF_IV); + size = 6; + break; + case REQUEST_HP_IV_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_HP_IV); + size = 1; + break; + case REQUEST_ATK_IV_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_ATK_IV); + size = 1; + break; + case REQUEST_DEF_IV_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_DEF_IV); + size = 1; + break; + case REQUEST_SPEED_IV_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_SPEED_IV); + size = 1; + break; + case REQUEST_SPATK_IV_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_SPATK_IV); + size = 1; + break; + case REQUEST_SPDEF_IV_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_SPDEF_IV); + size = 1; + break; + case REQUEST_PERSONALITY_BATTLE: + data32 = GetMonData(&party[monId], MON_DATA_PERSONALITY); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_CHECKSUM_BATTLE: + data16 = GetMonData(&party[monId], MON_DATA_CHECKSUM); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_STATUS_BATTLE: + data32 = GetMonData(&party[monId], MON_DATA_STATUS); + dst[0] = (data32 & 0x000000FF); + dst[1] = (data32 & 0x0000FF00) >> 8; + dst[2] = (data32 & 0x00FF0000) >> 16; + dst[3] = (data32 & 0xFF000000) >> 24; + size = 4; + break; + case REQUEST_LEVEL_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_LEVEL); + size = 1; + break; + case REQUEST_HP_BATTLE: + data16 = GetMonData(&party[monId], MON_DATA_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_MAX_HP_BATTLE: + data16 = GetMonData(&party[monId], MON_DATA_MAX_HP); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_ATK_BATTLE: + data16 = GetMonData(&party[monId], MON_DATA_ATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_DEF_BATTLE: + data16 = GetMonData(&party[monId], MON_DATA_DEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPEED_BATTLE: + data16 = GetMonData(&party[monId], MON_DATA_SPEED); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPATK_BATTLE: + data16 = GetMonData(&party[monId], MON_DATA_SPATK); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_SPDEF_BATTLE: + data16 = GetMonData(&party[monId], MON_DATA_SPDEF); + dst[0] = data16; + dst[1] = data16 >> 8; + size = 2; + break; + case REQUEST_COOL_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_COOL); + size = 1; + break; + case REQUEST_BEAUTY_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_BEAUTY); + size = 1; + break; + case REQUEST_CUTE_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_CUTE); + size = 1; + break; + case REQUEST_SMART_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_SMART); + size = 1; + break; + case REQUEST_TOUGH_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_TOUGH); + size = 1; + break; + case REQUEST_SHEEN_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_SHEEN); + size = 1; + break; + case REQUEST_COOL_RIBBON_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_COOL_RIBBON); + size = 1; + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_BEAUTY_RIBBON); + size = 1; + break; + case REQUEST_CUTE_RIBBON_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_CUTE_RIBBON); + size = 1; + break; + case REQUEST_SMART_RIBBON_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_SMART_RIBBON); + size = 1; + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + dst[0] = GetMonData(&party[monId], MON_DATA_TOUGH_RIBBON); + size = 1; + break; + } + + return size; +} + +static void SetBattlerMonData(u32 battler, struct Pokemon *party, u32 monId) +{ + struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleResources->bufferA[battler][3]; + struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleResources->bufferA[battler][3]; + s32 i; + + switch (gBattleResources->bufferA[battler][1]) + { + case REQUEST_ALL_BATTLE: + { + u8 iv; + + SetMonData(&party[monId], MON_DATA_SPECIES, &battlePokemon->species); + SetMonData(&party[monId], MON_DATA_HELD_ITEM, &battlePokemon->item); + for (i = 0; i < MAX_MON_MOVES; i++) + { + SetMonData(&party[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]); + SetMonData(&party[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]); + } + SetMonData(&party[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses); + SetMonData(&party[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship); + SetMonData(&party[monId], MON_DATA_EXP, &battlePokemon->experience); + iv = battlePokemon->hpIV; + SetMonData(&party[monId], MON_DATA_HP_IV, &iv); + iv = battlePokemon->attackIV; + SetMonData(&party[monId], MON_DATA_ATK_IV, &iv); + iv = battlePokemon->defenseIV; + SetMonData(&party[monId], MON_DATA_DEF_IV, &iv); + iv = battlePokemon->speedIV; + SetMonData(&party[monId], MON_DATA_SPEED_IV, &iv); + iv = battlePokemon->spAttackIV; + SetMonData(&party[monId], MON_DATA_SPATK_IV, &iv); + iv = battlePokemon->spDefenseIV; + SetMonData(&party[monId], MON_DATA_SPDEF_IV, &iv); + SetMonData(&party[monId], MON_DATA_PERSONALITY, &battlePokemon->personality); + SetMonData(&party[monId], MON_DATA_STATUS, &battlePokemon->status1); + SetMonData(&party[monId], MON_DATA_LEVEL, &battlePokemon->level); + SetMonData(&party[monId], MON_DATA_HP, &battlePokemon->hp); + SetMonData(&party[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP); + SetMonData(&party[monId], MON_DATA_ATK, &battlePokemon->attack); + SetMonData(&party[monId], MON_DATA_DEF, &battlePokemon->defense); + SetMonData(&party[monId], MON_DATA_SPEED, &battlePokemon->speed); + SetMonData(&party[monId], MON_DATA_SPATK, &battlePokemon->spAttack); + SetMonData(&party[monId], MON_DATA_SPDEF, &battlePokemon->spDefense); + } + break; + case REQUEST_SPECIES_BATTLE: + SetMonData(&party[monId], MON_DATA_SPECIES, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_HELDITEM_BATTLE: + SetMonData(&party[monId], MON_DATA_HELD_ITEM, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_MOVES_PP_BATTLE: + for (i = 0; i < MAX_MON_MOVES; i++) + { + SetMonData(&party[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]); + SetMonData(&party[monId], MON_DATA_PP1 + i, &moveData->pp[i]); + } + SetMonData(&party[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses); + break; + case REQUEST_MOVE1_BATTLE: + case REQUEST_MOVE2_BATTLE: + case REQUEST_MOVE3_BATTLE: + case REQUEST_MOVE4_BATTLE: + SetMonData(&party[monId], MON_DATA_MOVE1 + gBattleResources->bufferA[battler][1] - REQUEST_MOVE1_BATTLE, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_PP_DATA_BATTLE: + SetMonData(&party[monId], MON_DATA_PP1, &gBattleResources->bufferA[battler][3]); + SetMonData(&party[monId], MON_DATA_PP2, &gBattleResources->bufferA[battler][4]); + SetMonData(&party[monId], MON_DATA_PP3, &gBattleResources->bufferA[battler][5]); + SetMonData(&party[monId], MON_DATA_PP4, &gBattleResources->bufferA[battler][6]); + SetMonData(&party[monId], MON_DATA_PP_BONUSES, &gBattleResources->bufferA[battler][7]); + break; + case REQUEST_PPMOVE1_BATTLE: + case REQUEST_PPMOVE2_BATTLE: + case REQUEST_PPMOVE3_BATTLE: + case REQUEST_PPMOVE4_BATTLE: + SetMonData(&party[monId], MON_DATA_PP1 + gBattleResources->bufferA[battler][1] - REQUEST_PPMOVE1_BATTLE, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_OTID_BATTLE: + SetMonData(&party[monId], MON_DATA_OT_ID, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_EXP_BATTLE: + SetMonData(&party[monId], MON_DATA_EXP, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_HP_EV_BATTLE: + SetMonData(&party[monId], MON_DATA_HP_EV, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_ATK_EV_BATTLE: + SetMonData(&party[monId], MON_DATA_ATK_EV, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_DEF_EV_BATTLE: + SetMonData(&party[monId], MON_DATA_DEF_EV, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_SPEED_EV_BATTLE: + SetMonData(&party[monId], MON_DATA_SPEED_EV, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_SPATK_EV_BATTLE: + SetMonData(&party[monId], MON_DATA_SPATK_EV, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_SPDEF_EV_BATTLE: + SetMonData(&party[monId], MON_DATA_SPDEF_EV, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_FRIENDSHIP_BATTLE: + SetMonData(&party[monId], MON_DATA_FRIENDSHIP, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_POKERUS_BATTLE: + SetMonData(&party[monId], MON_DATA_POKERUS, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_MET_LOCATION_BATTLE: + SetMonData(&party[monId], MON_DATA_MET_LOCATION, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_MET_LEVEL_BATTLE: + SetMonData(&party[monId], MON_DATA_MET_LEVEL, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_MET_GAME_BATTLE: + SetMonData(&party[monId], MON_DATA_MET_GAME, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_POKEBALL_BATTLE: + SetMonData(&party[monId], MON_DATA_POKEBALL, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_ALL_IVS_BATTLE: + SetMonData(&party[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[battler][3]); + SetMonData(&party[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[battler][4]); + SetMonData(&party[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[battler][5]); + SetMonData(&party[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[battler][6]); + SetMonData(&party[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[battler][7]); + SetMonData(&party[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[battler][8]); + break; + case REQUEST_HP_IV_BATTLE: + SetMonData(&party[monId], MON_DATA_HP_IV, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_ATK_IV_BATTLE: + SetMonData(&party[monId], MON_DATA_ATK_IV, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_DEF_IV_BATTLE: + SetMonData(&party[monId], MON_DATA_DEF_IV, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_SPEED_IV_BATTLE: + SetMonData(&party[monId], MON_DATA_SPEED_IV, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_SPATK_IV_BATTLE: + SetMonData(&party[monId], MON_DATA_SPATK_IV, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_SPDEF_IV_BATTLE: + SetMonData(&party[monId], MON_DATA_SPDEF_IV, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_PERSONALITY_BATTLE: + SetMonData(&party[monId], MON_DATA_PERSONALITY, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_CHECKSUM_BATTLE: + SetMonData(&party[monId], MON_DATA_CHECKSUM, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_STATUS_BATTLE: + SetMonData(&party[monId], MON_DATA_STATUS, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_LEVEL_BATTLE: + SetMonData(&party[monId], MON_DATA_LEVEL, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_HP_BATTLE: + SetMonData(&party[monId], MON_DATA_HP, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_MAX_HP_BATTLE: + SetMonData(&party[monId], MON_DATA_MAX_HP, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_ATK_BATTLE: + SetMonData(&party[monId], MON_DATA_ATK, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_DEF_BATTLE: + SetMonData(&party[monId], MON_DATA_DEF, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_SPEED_BATTLE: + SetMonData(&party[monId], MON_DATA_SPEED, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_SPATK_BATTLE: + SetMonData(&party[monId], MON_DATA_SPATK, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_SPDEF_BATTLE: + SetMonData(&party[monId], MON_DATA_SPDEF, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_COOL_BATTLE: + SetMonData(&party[monId], MON_DATA_COOL, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_BEAUTY_BATTLE: + SetMonData(&party[monId], MON_DATA_BEAUTY, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_CUTE_BATTLE: + SetMonData(&party[monId], MON_DATA_CUTE, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_SMART_BATTLE: + SetMonData(&party[monId], MON_DATA_SMART, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_TOUGH_BATTLE: + SetMonData(&party[monId], MON_DATA_TOUGH, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_SHEEN_BATTLE: + SetMonData(&party[monId], MON_DATA_SHEEN, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_COOL_RIBBON_BATTLE: + SetMonData(&party[monId], MON_DATA_COOL_RIBBON, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_BEAUTY_RIBBON_BATTLE: + SetMonData(&party[monId], MON_DATA_BEAUTY_RIBBON, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_CUTE_RIBBON_BATTLE: + SetMonData(&party[monId], MON_DATA_CUTE_RIBBON, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_SMART_RIBBON_BATTLE: + SetMonData(&party[monId], MON_DATA_SMART_RIBBON, &gBattleResources->bufferA[battler][3]); + break; + case REQUEST_TOUGH_RIBBON_BATTLE: + SetMonData(&party[monId], MON_DATA_TOUGH_RIBBON, &gBattleResources->bufferA[battler][3]); + break; + } + + if (GetBattlerSide(battler) == B_SIDE_PLAYER) + HandleLowHpMusicChange(&party[gBattlerPartyIndexes[battler]], battler); +} + +void StartSendOutAnim(u32 battler, bool32 dontClearSubstituteBit) +{ + u16 species; + u32 side = GetBattlerSide(battler); + struct Pokemon *party = GetBattlerParty(battler); + + ClearTemporarySpeciesSpriteData(battler, dontClearSubstituteBit); + gBattlerPartyIndexes[battler] = gBattleResources->bufferA[battler][1]; + species = GetIllusionMonSpecies(battler); + if (species == SPECIES_NONE) + species = GetMonData(&party[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES); + gBattleControllerData[battler] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim); + // Load sprite for opponent only, player sprite is expected to be already loaded. + if (side == B_SIDE_OPPONENT) + BattleLoadMonSpriteGfx(&party[gBattlerPartyIndexes[battler]], battler); + SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battler)); + + gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, + GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2), + GetBattlerSpriteDefault_Y(battler), + GetBattlerSpriteSubpriority(battler)); + + gSprites[gBattlerSpriteIds[battler]].data[0] = battler; + gSprites[gBattlerSpriteIds[battler]].data[2] = species; + gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler; + StartSpriteAnim(&gSprites[gBattlerSpriteIds[battler]], 0); + gSprites[gBattlerSpriteIds[battler]].invisible = TRUE; + gSprites[gBattlerSpriteIds[battler]].callback = SpriteCallbackDummy; + + gSprites[gBattleControllerData[battler]].data[1] = gBattlerSpriteIds[battler]; + gSprites[gBattleControllerData[battler]].data[2] = battler; + gSprites[gBattleControllerData[battler]].data[0] = DoPokeballSendOutAnimation(battler, 0, (side == B_SIDE_OPPONENT) ? POKEBALL_OPPONENT_SENDOUT : POKEBALL_PLAYER_SENDOUT); +} + +static void FreeMonSprite(u32 battler) +{ + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[battler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[battler]]); + if (GetBattlerSide(battler) == B_SIDE_OPPONENT) + HideBattlerShadowSprite(battler); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[battler]); +} + +static void Controller_ReturnMonToBall2(u32 battler) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[battler].specialAnimActive) + { + FreeMonSprite(battler); + BattleControllerComplete(battler); + } +} + +static void Controller_ReturnMonToBall(u32 battler) +{ + switch (gBattleSpritesDataPtr->healthBoxesData[battler].animationState) + { + case 0: + if (gBattleSpritesDataPtr->battlerData[battler].behindSubstitute) + InitAndLaunchSpecialAnimation(battler, battler, battler, B_ANIM_SUBSTITUTE_TO_MON); + + gBattleSpritesDataPtr->healthBoxesData[battler].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[battler].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[battler].animationState = 0; + InitAndLaunchSpecialAnimation(battler, battler, battler, (GetBattlerSide(battler) == B_SIDE_OPPONENT) ? B_ANIM_SWITCH_OUT_OPPONENT_MON : B_ANIM_SWITCH_OUT_PLAYER_MON); + gBattlerControllerFuncs[battler] = Controller_ReturnMonToBall2; + } + break; + } +} + +static void Controller_FaintPlayerMon(u32 battler) +{ + u32 spriteId = gBattlerSpriteIds[battler]; + if (gSprites[spriteId].y + gSprites[spriteId].y2 > DISPLAY_HEIGHT) + { + BattleGfxSfxDummy2(GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES)); + FreeOamMatrix(gSprites[spriteId].oam.matrixNum); + DestroySprite(&gSprites[spriteId]); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[battler]); + BattleControllerComplete(battler); + } +} + +static void Controller_FaintOpponentMon(u32 battler) +{ + if (!gSprites[gBattlerSpriteIds[battler]].inUse) + { + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[battler]); + BattleControllerComplete(battler); + } +} + +static void Controller_DoMoveAnimation(u32 battler) +{ + u16 move = gBattleResources->bufferA[battler][1] | (gBattleResources->bufferA[battler][2] << 8); + + switch (gBattleSpritesDataPtr->healthBoxesData[battler].animationState) + { + case 0: + if (gBattleSpritesDataPtr->battlerData[battler].behindSubstitute + && !gBattleSpritesDataPtr->battlerData[battler].flag_x8) + { + gBattleSpritesDataPtr->battlerData[battler].flag_x8 = 1; + InitAndLaunchSpecialAnimation(battler, battler, battler, B_ANIM_SUBSTITUTE_TO_MON); + } + gBattleSpritesDataPtr->healthBoxesData[battler].animationState = 1; + break; + case 1: + if (!gBattleSpritesDataPtr->healthBoxesData[battler].specialAnimActive) + { + SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF); + DoMoveAnim(move); + gBattleSpritesDataPtr->healthBoxesData[battler].animationState = 2; + } + break; + case 2: + gAnimScriptCallback(); + if (!gAnimScriptActive) + { + u8 multihit = gBattleResources->bufferA[battler][11]; + + SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL); + if (gBattleSpritesDataPtr->battlerData[battler].behindSubstitute && multihit < 2) + { + InitAndLaunchSpecialAnimation(battler, battler, battler, B_ANIM_MON_TO_SUBSTITUTE); + gBattleSpritesDataPtr->battlerData[battler].flag_x8 = 0; + } + gBattleSpritesDataPtr->healthBoxesData[battler].animationState = 3; + } + break; + case 3: + if (!gBattleSpritesDataPtr->healthBoxesData[battler].specialAnimActive) + { + CopyAllBattleSpritesInvisibilities(); + TrySetBehindSubstituteSpriteBit(battler, gBattleResources->bufferA[battler][1] | (gBattleResources->bufferA[battler][2] << 8)); + gBattleSpritesDataPtr->healthBoxesData[battler].animationState = 0; + BattleControllerComplete(battler); + } + break; + } +} + +static void Controller_HandleTrainerSlideBack(u32 battler) +{ + if (gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy) + { + if (GetBattlerSide(battler) == B_SIDE_OPPONENT) + FreeTrainerFrontPicPalette(gSprites[gBattlerSpriteIds[battler]].oam.affineParam); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[battler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[battler]]); + BattleControllerComplete(battler); + } +} + +void Controller_WaitForHealthBar(u32 battler) +{ + s16 hpValue = MoveBattleBar(battler, gHealthboxSpriteIds[battler], HEALTH_BAR, 0); + + SetHealthboxSpriteVisible(gHealthboxSpriteIds[battler]); + if (hpValue != -1) + { + UpdateHpTextInHealthbox(gHealthboxSpriteIds[battler], HP_CURRENT, hpValue, gBattleMons[battler].maxHP); + } + else + { + if (GetBattlerSide(battler) == B_SIDE_PLAYER) + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[battler]], battler); + BattleControllerComplete(battler); + } +} + +static void Controller_WaitForBallThrow(u32 battler) +{ + if (!gDoingBattleAnim || !gBattleSpritesDataPtr->healthBoxesData[battler].specialAnimActive) + BattleControllerComplete(battler); +} + +static void Controller_WaitForBattleAnimation(u32 battler) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[battler].animFromTableActive) + BattleControllerComplete(battler); +} + +static void Controller_WaitForStatusAnimation(u32 battler) +{ + if (!gBattleSpritesDataPtr->healthBoxesData[battler].statusAnimActive) + BattleControllerComplete(battler); +} + +static void Controller_WaitForTrainerPic(u32 battler) +{ + if (gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy) + BattleControllerComplete(battler); +} + +void Controller_WaitForString(u32 battler) { - bool8 record_ = record; - sBattleBuffersTransferData[0] = CONTROLLER_LINKSTANDBYMSG; - sBattleBuffersTransferData[1] = mode; + if (!IsTextPrinterActive(B_WIN_MSG)) + BattleControllerComplete(battler); +} + +static void Controller_WaitForPartyStatusSummary(u32 battler) +{ + if (gBattleSpritesDataPtr->healthBoxesData[battler].partyStatusDelayTimer++ > 92) + { + gBattleSpritesDataPtr->healthBoxesData[battler].partyStatusDelayTimer = 0; + BattleControllerComplete(battler); + } +} + +static void Controller_HitAnimation(u32 battler) +{ + u32 spriteId = gBattlerSpriteIds[battler]; - if (record_) - sBattleBuffersTransferData[3] = sBattleBuffersTransferData[2] = RecordedBattle_BufferNewBattlerData(&sBattleBuffersTransferData[4]); + if (gSprites[spriteId].data[1] == 32) + { + gSprites[spriteId].data[1] = 0; + gSprites[spriteId].invisible = FALSE; + gDoingBattleAnim = FALSE; + BattleControllerComplete(battler); + } else - sBattleBuffersTransferData[3] = sBattleBuffersTransferData[2] = 0; + { + if ((gSprites[spriteId].data[1] % 4) == 0) + gSprites[spriteId].invisible ^= 1; + gSprites[spriteId].data[1]++; + } +} - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sBattleBuffersTransferData[2] + 4); +// Used for all the commands which do nothing. +void BtlController_Empty(u32 battler) +{ + BattleControllerComplete(battler); } -void BtlController_EmitResetActionMoveSelection(u8 bufferId, u8 caseId) +// Dummy function at the end of the table. +void BtlController_TerminatorNop(u32 battler) { - sBattleBuffersTransferData[0] = CONTROLLER_RESETACTIONMOVESELECTION; - sBattleBuffersTransferData[1] = caseId; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2); } -void BtlController_EmitEndLinkBattle(u8 bufferId, u8 battleOutcome) +void BattleControllerDummy(u32 battler) { - sBattleBuffersTransferData[0] = CONTROLLER_ENDLINKBATTLE; - sBattleBuffersTransferData[1] = battleOutcome; - sBattleBuffersTransferData[2] = gSaveBlock2Ptr->frontier.disableRecordBattle; - sBattleBuffersTransferData[3] = gSaveBlock2Ptr->frontier.disableRecordBattle; - sBattleBuffersTransferData[5] = sBattleBuffersTransferData[4] = RecordedBattle_BufferNewBattlerData(&sBattleBuffersTransferData[6]); - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sBattleBuffersTransferData[4] + 6); } -void BtlController_EmitDebugMenu(u8 bufferId) +// Handlers of the controller commands +void BtlController_HandleGetMonData(u32 battler) { - sBattleBuffersTransferData[0] = CONTROLLER_DEBUGMENU; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 1); + u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data + struct Pokemon *party = GetBattlerParty(battler); + u32 size = 0; + u8 monToCheck; + s32 i; + + if (gBattleResources->bufferA[battler][2] == 0) + { + size += GetBattlerMonData(battler, party, gBattlerPartyIndexes[battler], monData); + } + else + { + monToCheck = gBattleResources->bufferA[battler][2]; + for (i = 0; i < PARTY_SIZE; i++) + { + if (monToCheck & 1) + size += GetBattlerMonData(battler, party, i, monData + size); + monToCheck >>= 1; + } + } + BtlController_EmitDataTransfer(battler, BUFFER_B, size, monData); + BattleControllerComplete(battler); +} + +void BtlController_HandleGetRawMonData(u32 battler) +{ + struct BattlePokemon battleMon; + struct Pokemon *party = GetBattlerParty(battler); + + u8 *src = (u8 *)&party[gBattlerPartyIndexes[battler]] + gBattleResources->bufferA[battler][1]; + u8 *dst = (u8 *)&battleMon + gBattleResources->bufferA[battler][1]; + u8 i; + + for (i = 0; i < gBattleResources->bufferA[battler][2]; i++) + dst[i] = src[i]; + + BtlController_EmitDataTransfer(battler, BUFFER_B, gBattleResources->bufferA[battler][2], dst); + BattleControllerComplete(battler); +} + +void BtlController_HandleSetMonData(u32 battler) +{ + struct Pokemon *party = GetBattlerParty(battler); + u32 i, monToCheck; + + if (gBattleResources->bufferA[battler][2] == 0) + { + SetBattlerMonData(battler, party, gBattlerPartyIndexes[battler]); + } + else + { + monToCheck = gBattleResources->bufferA[battler][2]; + for (i = 0; i < PARTY_SIZE; i++) + { + if (monToCheck & 1) + SetBattlerMonData(battler, party, i); + monToCheck >>= 1; + } + } + BattleControllerComplete(battler); +} + +void BtlController_HandleSetRawMonData(u32 battler) +{ + u32 i; + struct Pokemon *party = GetBattlerParty(battler); + u8 *dst = (u8 *)&party[gBattlerPartyIndexes[battler]] + gBattleResources->bufferA[battler][1]; + + for (i = 0; i < gBattleResources->bufferA[battler][2]; i++) + dst[i] = gBattleResources->bufferA[battler][3 + i]; + + BattleControllerComplete(battler); +} + +void BtlController_HandleLoadMonSprite(u32 battler, void (*controllerCallback)(u32 battler)) +{ + struct Pokemon *party = GetBattlerParty(battler); + u16 species = GetMonData(&party[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES); + + BattleLoadMonSpriteGfx(&party[gBattlerPartyIndexes[battler]], battler); + SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battler)); + + gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, + GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2), + GetBattlerSpriteDefault_Y(battler), + GetBattlerSpriteSubpriority(battler)); + + gSprites[gBattlerSpriteIds[battler]].x2 = -DISPLAY_WIDTH; + gSprites[gBattlerSpriteIds[battler]].data[0] = battler; + gSprites[gBattlerSpriteIds[battler]].data[2] = species; + gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler; + StartSpriteAnim(&gSprites[gBattlerSpriteIds[battler]], 0); + + SetBattlerShadowSpriteCallback(battler, species); + + gBattlerControllerFuncs[battler] = controllerCallback; +} + +void BtlController_HandleSwitchInAnim(u32 battler, bool32 isPlayerSide, void (*controllerCallback)(u32 battler)) +{ + if (isPlayerSide) + ClearTemporarySpeciesSpriteData(battler, gBattleResources->bufferA[battler][2]); + gBattlerPartyIndexes[battler] = gBattleResources->bufferA[battler][1]; + if (isPlayerSide) + BattleLoadMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battler]], battler); + StartSendOutAnim(battler, gBattleResources->bufferA[battler][2]); + gBattlerControllerFuncs[battler] = controllerCallback; +} + +void BtlController_HandleReturnMonToBall(u32 battler) +{ + if (gBattleResources->bufferA[battler][1] == 0) + { + gBattleSpritesDataPtr->healthBoxesData[battler].animationState = 0; + gBattlerControllerFuncs[battler] = Controller_ReturnMonToBall; + } + else + { + FreeMonSprite(battler); + BattleControllerComplete(battler); + } +} + +// In emerald it's possible to have a tag battle in the battle frontier facilities with AI +// which use the front sprite for both the player and the partner as opposed to any other battles (including the one with Steven) +// that use an animated back pic. + +#define sSpeedX data[0] + +void BtlController_HandleDrawTrainerPic(u32 battler, u32 trainerPicId, bool32 isFrontPic, s16 xPos, s16 yPos, s32 subpriority) +{ + if (GetBattlerSide(battler) == B_SIDE_OPPONENT) // Always the front sprite for the opponent. + { + DecompressTrainerFrontPic(trainerPicId, battler); + SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(battler)); + if (subpriority == -1) + subpriority = GetBattlerSpriteSubpriority(battler); + gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, + xPos, + yPos, + subpriority); + + gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBattlerSpriteIds[battler]].x2 = -DISPLAY_WIDTH; + gSprites[gBattlerSpriteIds[battler]].sSpeedX = 2; + gSprites[gBattlerSpriteIds[battler]].oam.affineParam = trainerPicId; + } + else // Player's side + { + if (isFrontPic) + { + DecompressTrainerFrontPic(trainerPicId, battler); + SetMultiuseSpriteTemplateToTrainerFront(trainerPicId, GetBattlerPosition(battler)); + if (subpriority == -1) + subpriority = GetBattlerSpriteSubpriority(battler); + gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, + xPos, + yPos, + subpriority); + + gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBattlerSpriteIds[battler]].oam.affineMode = ST_OAM_AFFINE_OFF; + gSprites[gBattlerSpriteIds[battler]].hFlip = 1; + gSprites[gBattlerSpriteIds[battler]].y2 = 48; + } + else + { + DecompressTrainerBackPic(trainerPicId, battler); + SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(battler)); + if (subpriority == -1) + subpriority = GetBattlerSpriteSubpriority(battler); + gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, + xPos, + yPos, + subpriority); + + gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler; + } + gSprites[gBattlerSpriteIds[battler]].x2 = DISPLAY_WIDTH; + gSprites[gBattlerSpriteIds[battler]].sSpeedX = -2; + } + gSprites[gBattlerSpriteIds[battler]].callback = SpriteCB_TrainerSlideIn; + + gBattlerControllerFuncs[battler] = Controller_WaitForTrainerPic; +} + +void BtlController_HandleTrainerSlide(u32 battler, u32 trainerPicId) +{ + if (GetBattlerSide(battler) == B_SIDE_PLAYER) + { + DecompressTrainerBackPic(trainerPicId, battler); + SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(battler)); + gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, + 80, + (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80, + 30); + gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler; + gSprites[gBattlerSpriteIds[battler]].x2 = -96; + gSprites[gBattlerSpriteIds[battler]].sSpeedX = 2; + } + else + { + DecompressTrainerFrontPic(trainerPicId, battler); + SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(battler)); + gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, + 176, + (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 40, + 30); + gSprites[gBattlerSpriteIds[battler]].oam.affineParam = trainerPicId; + gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBattlerSpriteIds[battler]].x2 = 96; + gSprites[gBattlerSpriteIds[battler]].x += 32; + gSprites[gBattlerSpriteIds[battler]].sSpeedX = -2; + } + gSprites[gBattlerSpriteIds[battler]].callback = SpriteCB_TrainerSlideIn; + + gBattlerControllerFuncs[battler] = Controller_WaitForTrainerPic; +} + +#undef sSpeedX + +void BtlController_HandleTrainerSlideBack(u32 battler, s16 data0, bool32 startAnim) +{ + u32 side = GetBattlerSide(battler); + + SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[battler]]); + gSprites[gBattlerSpriteIds[battler]].data[0] = data0; + gSprites[gBattlerSpriteIds[battler]].data[2] = (side == B_SIDE_PLAYER) ? -40 : 280; + gSprites[gBattlerSpriteIds[battler]].data[4] = gSprites[gBattlerSpriteIds[battler]].y; + gSprites[gBattlerSpriteIds[battler]].callback = StartAnimLinearTranslation; + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[battler]], SpriteCallbackDummy); + if (startAnim) + StartSpriteAnim(&gSprites[gBattlerSpriteIds[battler]], 1); + gBattlerControllerFuncs[battler] = Controller_HandleTrainerSlideBack; +} + +#define sSpeedX data[1] +#define sSpeedY data[2] + +void BtlController_HandleFaintAnimation(u32 battler) +{ + if (gBattleSpritesDataPtr->healthBoxesData[battler].animationState == 0) + { + if (gBattleSpritesDataPtr->battlerData[battler].behindSubstitute) + InitAndLaunchSpecialAnimation(battler, battler, battler, B_ANIM_SUBSTITUTE_TO_MON); + gBattleSpritesDataPtr->healthBoxesData[battler].animationState++; + } + else + { + if (!gBattleSpritesDataPtr->healthBoxesData[battler].specialAnimActive) + { + gBattleSpritesDataPtr->healthBoxesData[battler].animationState = 0; + if (GetBattlerSide(battler) == B_SIDE_PLAYER) + { + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[battler]], battler); + gSprites[gBattlerSpriteIds[battler]].sSpeedX = 0; + gSprites[gBattlerSpriteIds[battler]].sSpeedY = 5; + PlaySE12WithPanning(SE_FAINT, SOUND_PAN_ATTACKER); + gSprites[gBattlerSpriteIds[battler]].callback = SpriteCB_FaintSlideAnim; + gBattlerControllerFuncs[battler] = Controller_FaintPlayerMon; + } + else + { + PlaySE12WithPanning(SE_FAINT, SOUND_PAN_TARGET); + gSprites[gBattlerSpriteIds[battler]].callback = SpriteCB_FaintOpponentMon; + gBattlerControllerFuncs[battler] = Controller_FaintOpponentMon; + } + // The player's sprite callback just slides the mon, the opponent's removes the sprite. + // The player's sprite is removed in Controller_FaintPlayerMon. Controller_FaintOpponentMon only removes the healthbox once the sprite is removed by SpriteCB_FaintOpponentMon. + } + } +} + +#undef sSpeedX +#undef sSpeedY + +static void HandleBallThrow(u32 battler, u32 target, u32 animId, bool32 allowCriticalCapture) +{ + gDoingBattleAnim = TRUE; + if (allowCriticalCapture && IsCriticalCapture()) + animId = B_ANIM_CRITICAL_CAPTURE_THROW; + InitAndLaunchSpecialAnimation(battler, battler, target, animId); + + gBattlerControllerFuncs[battler] = Controller_WaitForBallThrow; +} + +void BtlController_HandleSuccessBallThrowAnim(u32 battler, u32 target, u32 animId, bool32 allowCriticalCapture) +{ + gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS; + HandleBallThrow(battler, target, animId, allowCriticalCapture); +} + +void BtlController_HandleBallThrowAnim(u32 battler, u32 target, u32 animId, bool32 allowCriticalCapture) +{ + gBattleSpritesDataPtr->animationData->ballThrowCaseId = gBattleResources->bufferA[battler][1]; + HandleBallThrow(battler, target, animId, allowCriticalCapture); +} + +void BtlController_HandleMoveAnimation(u32 battler, bool32 updateTvData) +{ + if (!IsBattleSEPlaying(battler)) + { + u16 move = gBattleResources->bufferA[battler][1] | (gBattleResources->bufferA[battler][2] << 8); + + gAnimMoveTurn = gBattleResources->bufferA[battler][3]; + gAnimMovePower = gBattleResources->bufferA[battler][4] | (gBattleResources->bufferA[battler][5] << 8); + gAnimMoveDmg = gBattleResources->bufferA[battler][6] | (gBattleResources->bufferA[battler][7] << 8) | (gBattleResources->bufferA[battler][8] << 16) | (gBattleResources->bufferA[battler][9] << 24); + gAnimFriendship = gBattleResources->bufferA[battler][10]; + gWeatherMoveAnim = gBattleResources->bufferA[battler][12] | (gBattleResources->bufferA[battler][13] << 8); + gAnimDisableStructPtr = (struct DisableStruct *)&gBattleResources->bufferA[battler][16]; + gTransformedPersonalities[battler] = gAnimDisableStructPtr->transformedMonPersonality; + gTransformedOtIds[battler] = gAnimDisableStructPtr->transformedMonOtId; + gBattleSpritesDataPtr->healthBoxesData[battler].animationState = 0; + gBattlerControllerFuncs[battler] = Controller_DoMoveAnimation; + if (updateTvData) + BattleTv_SetDataBasedOnMove(move, gWeatherMoveAnim, gAnimDisableStructPtr); + } +} + +void BtlController_HandlePrintString(u32 battler, bool32 updateTvData, bool32 arenaPtsDeduct) +{ + u16 *stringId; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + stringId = (u16 *)(&gBattleResources->bufferA[battler][2]); + BufferStringBattle(*stringId, battler); + BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG); + gBattlerControllerFuncs[battler] = Controller_WaitForString; + if (updateTvData) + BattleTv_SetDataBasedOnString(*stringId); + if (arenaPtsDeduct) + BattleArena_DeductSkillPoints(battler, *stringId); +} + +void BtlController_HandleHealthBarUpdate(u32 battler, bool32 updateHpText) +{ + s16 hpVal; + struct Pokemon *party = GetBattlerParty(battler); + + LoadBattleBarGfx(0); + hpVal = gBattleResources->bufferA[battler][2] | (gBattleResources->bufferA[battler][3] << 8); + + if (hpVal != INSTANT_HP_BAR_DROP) + { + u32 maxHP = GetMonData(&party[gBattlerPartyIndexes[battler]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&party[gBattlerPartyIndexes[battler]], MON_DATA_HP); + + SetBattleBarStruct(battler, gHealthboxSpriteIds[battler], maxHP, curHP, hpVal); + } + else + { + u32 maxHP = GetMonData(&party[gBattlerPartyIndexes[battler]], MON_DATA_MAX_HP); + + SetBattleBarStruct(battler, gHealthboxSpriteIds[battler], maxHP, 0, hpVal); + if (updateHpText) + UpdateHpTextInHealthbox(gHealthboxSpriteIds[battler], HP_CURRENT, 0, maxHP); + } + + gBattlerControllerFuncs[battler] = Controller_WaitForHealthBar; +} + +void DoStatusIconUpdate(u32 battler) +{ + struct Pokemon *party = GetBattlerParty(battler); + + UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], &party[gBattlerPartyIndexes[battler]], HEALTHBOX_STATUS_ICON); + gBattleSpritesDataPtr->healthBoxesData[battler].statusAnimActive = 0; + gBattlerControllerFuncs[battler] = Controller_WaitForStatusAnimation; +} + +void BtlController_HandleStatusIconUpdate(u32 battler) +{ + if (!IsBattleSEPlaying(battler)) + { + DoStatusIconUpdate(battler); + } +} + +void BtlController_HandleStatusAnimation(u32 battler) +{ + if (!IsBattleSEPlaying(battler)) + { + InitAndLaunchChosenStatusAnimation(battler, gBattleResources->bufferA[battler][1], + gBattleResources->bufferA[battler][2] | (gBattleResources->bufferA[battler][3] << 8) | (gBattleResources->bufferA[battler][4] << 16) | (gBattleResources->bufferA[battler][5] << 24)); + gBattlerControllerFuncs[battler] = Controller_WaitForStatusAnimation; + } +} + +void BtlController_HandleClearUnkVar(u32 battler) +{ + gUnusedControllerStruct.unk = 0; + BattleControllerComplete(battler); +} + +void BtlController_HandleSetUnkVar(u32 battler) +{ + gUnusedControllerStruct.unk = gBattleResources->bufferA[battler][1]; + BattleControllerComplete(battler); +} + +void BtlController_HandleClearUnkFlag(u32 battler) +{ + gUnusedControllerStruct.flag = 0; + BattleControllerComplete(battler); +} + +void BtlController_HandleToggleUnkFlag(u32 battler) +{ + gUnusedControllerStruct.flag ^= 1; + BattleControllerComplete(battler); +} + +void BtlController_HandleHitAnimation(u32 battler) +{ + if (gSprites[gBattlerSpriteIds[battler]].invisible == TRUE) + { + BattleControllerComplete(battler); + } + else + { + gDoingBattleAnim = TRUE; + gSprites[gBattlerSpriteIds[battler]].data[1] = 0; + DoHitAnimHealthboxEffect(battler); + gBattlerControllerFuncs[battler] = Controller_HitAnimation; + } +} + +void BtlController_HandlePlaySE(u32 battler) +{ + s8 pan = (GetBattlerSide(battler) == B_SIDE_PLAYER) ? SOUND_PAN_ATTACKER : SOUND_PAN_TARGET; + + PlaySE12WithPanning(gBattleResources->bufferA[battler][1] | (gBattleResources->bufferA[battler][2] << 8), pan); + BattleControllerComplete(battler); +} + +void BtlController_HandlePlayFanfareOrBGM(u32 battler) +{ + if (gBattleResources->bufferA[battler][3]) + { + BattleStopLowHpSound(); + PlayBGM(gBattleResources->bufferA[battler][1] | (gBattleResources->bufferA[battler][2] << 8)); + } + else + { + PlayFanfare(gBattleResources->bufferA[battler][1] | (gBattleResources->bufferA[battler][2] << 8)); + } + + BattleControllerComplete(battler); +} + +void BtlController_HandleFaintingCry(u32 battler) +{ + struct Pokemon *party; + s8 pan; + + if (GetBattlerSide(battler) == B_SIDE_PLAYER) + { + party = gPlayerParty; + pan = -25; + } + else + { + party = gEnemyParty; + pan = 25; + } + + PlayCry_ByMode(GetMonData(&party[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES), pan, CRY_MODE_FAINT); + BattleControllerComplete(battler); +} + +void BtlController_HandleIntroSlide(u32 battler) +{ + HandleIntroSlide(gBattleResources->bufferA[battler][1]); + gIntroSlideFlags |= 1; + BattleControllerComplete(battler); +} + +void BtlController_HandleSpriteInvisibility(u32 battler) +{ + if (IsBattlerSpritePresent(battler)) + { + gSprites[gBattlerSpriteIds[battler]].invisible = gBattleResources->bufferA[battler][1]; + CopyBattleSpriteInvisibility(battler); + } + BattleControllerComplete(battler); +} + +bool32 TwoPlayerIntroMons(u32 battler) // Double battle with both player pokemon active. +{ + return (IsDoubleBattle() && IsValidForBattle(&gPlayerParty[gBattlerPartyIndexes[battler ^ BIT_FLANK]])); +} + +bool32 TwoOpponentIntroMons(u32 battler) // Double battle with both opponent pokemon active. +{ + return (IsDoubleBattle() + && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[battler]]) + && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]])); +} + +// Task data for Task_StartSendOutAnim +#define tBattlerId data[0] +#define tStartTimer data[1] +#define tFramesToWait data[2] +#define tControllerFunc_1 3 // Stored as two halfwords +#define tControllerFunc_2 4 + +// Sprite data for SpriteCB_FreePlayerSpriteLoadMonSprite +#define sBattlerId data[5] + +void BtlController_HandleIntroTrainerBallThrow(u32 battler, u16 tagTrainerPal, const u32 *trainerPal, s16 framesToWait, void (*controllerCallback)(u32 battler)) +{ + u8 paletteNum, taskId; + u32 side = GetBattlerSide(battler); + + SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[battler]]); + if (side == B_SIDE_PLAYER) + { + gSprites[gBattlerSpriteIds[battler]].data[0] = 50; + gSprites[gBattlerSpriteIds[battler]].data[2] = -40; + } + else + { + gSprites[gBattlerSpriteIds[battler]].data[0] = 35; + gSprites[gBattlerSpriteIds[battler]].data[2] = 280; + } + + gSprites[gBattlerSpriteIds[battler]].data[4] = gSprites[gBattlerSpriteIds[battler]].y; + gSprites[gBattlerSpriteIds[battler]].callback = StartAnimLinearTranslation; + gSprites[gBattlerSpriteIds[battler]].sBattlerId = battler; + + if (side == B_SIDE_PLAYER) + { + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[battler]], SpriteCB_FreePlayerSpriteLoadMonSprite); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[battler]], 1); + + paletteNum = AllocSpritePalette(tagTrainerPal); + LoadCompressedPalette(trainerPal, OBJ_PLTT_ID(paletteNum), PLTT_SIZE_4BPP); + gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = paletteNum; + } + else + { + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[battler]], SpriteCB_FreeOpponentSprite); + } + + taskId = CreateTask(Task_StartSendOutAnim, 5); + gTasks[taskId].tBattlerId = battler; + gTasks[taskId].tFramesToWait = framesToWait; + SetWordTaskArg(taskId, tControllerFunc_1, (uint32_t)(controllerCallback)); + + if (gBattleSpritesDataPtr->healthBoxesData[battler].partyStatusSummaryShown) + gTasks[gBattlerStatusSummaryTaskId[battler]].func = Task_HidePartyStatusSummary; + + gBattleSpritesDataPtr->animationData->introAnimActive = TRUE; + gBattlerControllerFuncs[battler] = BattleControllerDummy; +} + +static bool32 TwoMonsAtSendOut(u32 battler) +{ + if (GetBattlerSide(battler) == B_SIDE_PLAYER) + { + if (TwoPlayerIntroMons(battler) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + return TRUE; + else + return FALSE; + } + else + { + if ((!TwoOpponentIntroMons(battler) || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) && !BATTLE_TWO_VS_ONE_OPPONENT) + return FALSE; + else if ((gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) || (BATTLE_TWO_VS_ONE_OPPONENT && !TwoOpponentIntroMons(battler))) + return FALSE; + else + return TRUE; + } + return FALSE; +} + +// Send out at start of battle +static void Task_StartSendOutAnim(u8 taskId) +{ + if (gTasks[taskId].tFramesToWait != 0 && gTasks[taskId].tStartTimer < gTasks[taskId].tFramesToWait) + { + gTasks[taskId].tStartTimer++; + } + else + { + u32 battlerPartner; + u32 battler = gTasks[taskId].tBattlerId; + + if (TwoMonsAtSendOut(battler)) + { + gBattleResources->bufferA[battler][1] = gBattlerPartyIndexes[battler]; + StartSendOutAnim(battler, FALSE); + + battlerPartner = battler ^ BIT_FLANK; + gBattleResources->bufferA[battlerPartner][1] = gBattlerPartyIndexes[battlerPartner]; + BattleLoadMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battlerPartner]], battlerPartner); + StartSendOutAnim(battlerPartner, FALSE); + } + else + { + gBattleResources->bufferA[battler][1] = gBattlerPartyIndexes[battler]; + StartSendOutAnim(battler, FALSE); + } + gBattlerControllerFuncs[battler] = (void*)(GetWordTaskArg(taskId, tControllerFunc_1)); + DestroyTask(taskId); + } +} + +#undef tBattlerId +#undef tStartTimer +#undef tFramesToWait +#undef tControllerFunc_1 +#undef tControllerFunc_2 + +static void SpriteCB_FreePlayerSpriteLoadMonSprite(struct Sprite *sprite) +{ + u8 battler = sprite->sBattlerId; + + // Free player trainer sprite + FreeSpriteOamMatrix(sprite); + FreeSpritePaletteByTag(GetSpritePaletteTagByPaletteNum(sprite->oam.paletteNum)); + DestroySprite(sprite); + + // Load mon sprite + BattleLoadMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battler]], battler); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[battler]], 0); +} + +static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite) +{ + FreeTrainerFrontPicPalette(sprite->oam.affineParam); + FreeSpriteOamMatrix(sprite); + DestroySprite(sprite); +} + +#undef sBattlerId + +void BtlController_HandleDrawPartyStatusSummary(u32 battler, u32 side, bool32 considerDelay) +{ + if (gBattleResources->bufferA[battler][1] != 0 && GetBattlerSide(battler) == B_SIDE_PLAYER) + { + BattleControllerComplete(battler); + } + else + { + gBattleSpritesDataPtr->healthBoxesData[battler].partyStatusSummaryShown = 1; + + if (side == B_SIDE_OPPONENT && gBattleResources->bufferA[battler][2] != 0) + { + if (gBattleSpritesDataPtr->healthBoxesData[battler].opponentDrawPartyStatusSummaryDelay < 2) + { + gBattleSpritesDataPtr->healthBoxesData[battler].opponentDrawPartyStatusSummaryDelay++; + return; + } + else + { + gBattleSpritesDataPtr->healthBoxesData[battler].opponentDrawPartyStatusSummaryDelay = 0; + } + } + + gBattlerStatusSummaryTaskId[battler] = CreatePartyStatusSummarySprites(battler, (struct HpAndStatus *)&gBattleResources->bufferA[battler][4], gBattleResources->bufferA[battler][1], gBattleResources->bufferA[battler][2]); + gBattleSpritesDataPtr->healthBoxesData[battler].partyStatusDelayTimer = 0; + + // If intro, skip the delay after drawing + if (considerDelay && gBattleResources->bufferA[battler][2] != 0) + gBattleSpritesDataPtr->healthBoxesData[battler].partyStatusDelayTimer = 93; + + gBattlerControllerFuncs[battler] = Controller_WaitForPartyStatusSummary; + } +} + +void BtlController_HandleHidePartyStatusSummary(u32 battler) +{ + if (gBattleSpritesDataPtr->healthBoxesData[battler].partyStatusSummaryShown) + gTasks[gBattlerStatusSummaryTaskId[battler]].func = Task_HidePartyStatusSummary; + BattleControllerComplete(battler); +} + +void BtlController_HandleBattleAnimation(u32 battler, bool32 ignoreSE, bool32 updateTvData) +{ + if (ignoreSE || !IsBattleSEPlaying(battler)) + { + u8 animationId = gBattleResources->bufferA[battler][1]; + u16 argument = gBattleResources->bufferA[battler][2] | (gBattleResources->bufferA[battler][3] << 8); + + if (TryHandleLaunchBattleTableAnimation(battler, battler, battler, animationId, argument)) + BattleControllerComplete(battler); + else + gBattlerControllerFuncs[battler] = Controller_WaitForBattleAnimation; + + if (updateTvData) + BattleTv_SetDataBasedOnAnimation(animationId); + } } diff --git a/src/battle_debug.c b/src/battle_debug.c index 5712c98819af..92c108238332 100644 --- a/src/battle_debug.c +++ b/src/battle_debug.c @@ -137,7 +137,6 @@ enum VAR_IN_LOVE, VAR_U16_4_ENTRIES, VAL_S8, - VAL_ITEM, VAL_ALL_STAT_STAGES, }; @@ -246,7 +245,6 @@ static const u8 sText_InLove[] = _("In Love"); static const u8 sText_AIMovePts[] = _("AI Pts/Dmg"); static const u8 sText_AiKnowledge[] = _("AI Info"); static const u8 sText_AiParty[] = _("AI Party"); -static const u8 sText_EffectOverride[] = _("Effect Override"); static const u8 sText_EmptyString[] = _(""); @@ -857,7 +855,7 @@ static void PutAiInfoText(struct BattleDebugMenu *data) // items info for (i = 0; i < gBattlersCount; i++) { - if (GET_BATTLER_SIDE(i) == B_SIDE_PLAYER && IsBattlerAlive(i)) + if (GetBattlerSide(i) == B_SIDE_PLAYER && IsBattlerAlive(i)) { u16 ability = AI_GetAbility(i); u16 holdEffect = AI_GetHoldEffect(i); @@ -877,10 +875,10 @@ static void PutAiPartyText(struct BattleDebugMenu *data) { u32 i, j, count; u8 *text = Alloc(0x50), *txtPtr; - struct AiPartyMon *aiMons = AI_PARTY->mons[GET_BATTLER_SIDE(data->aiBattlerId)]; + struct AiPartyMon *aiMons = AI_PARTY->mons[GetBattlerSide(data->aiBattlerId)]; FillWindowPixelBuffer(data->aiMovesWindowId, 0x11); - count = AI_PARTY->count[GET_BATTLER_SIDE(data->aiBattlerId)]; + count = AI_PARTY->count[GetBattlerSide(data->aiBattlerId)]; for (i = 0; i < count; i++) { if (aiMons[i].wasSentInBattle) @@ -943,7 +941,7 @@ static void Task_ShowAiKnowledge(u8 taskId) LoadMonIconPalettes(); for (count = 0, i = 0; i < MAX_BATTLERS_COUNT; i++) { - if (GET_BATTLER_SIDE(i) == B_SIDE_PLAYER && IsBattlerAlive(i)) + if (GetBattlerSide(i) == B_SIDE_PLAYER && IsBattlerAlive(i)) { data->spriteIds.aiIconSpriteIds[i] = CreateMonIcon(gBattleMons[i].species, SpriteCallbackDummy, @@ -1002,8 +1000,8 @@ static void Task_ShowAiParty(u8 taskId) LoadMonIconPalettes(); LoadPartyMenuAilmentGfx(); data->aiBattlerId = data->battlerId; - aiMons = AI_PARTY->mons[GET_BATTLER_SIDE(data->aiBattlerId)]; - for (i = 0; i < AI_PARTY->count[GET_BATTLER_SIDE(data->aiBattlerId)]; i++) + aiMons = AI_PARTY->mons[GetBattlerSide(data->aiBattlerId)]; + for (i = 0; i < AI_PARTY->count[GetBattlerSide(data->aiBattlerId)]; i++) { u16 species = SPECIES_NONE; // Question mark if (aiMons[i].wasSentInBattle && aiMons[i].species) @@ -1302,7 +1300,7 @@ static void CreateSecondaryListMenu(struct BattleDebugMenu *data) itemsCount = 1; break; case LIST_ITEM_HELD_ITEM: - itemsCount = 2; + itemsCount = 1; break; case LIST_ITEM_TYPES: itemsCount = 3; @@ -1440,11 +1438,6 @@ static void PrintSecondaryEntries(struct BattleDebugMenu *data) PadString(ItemId_GetName(gBattleMons[data->battlerId].item), text); printer.currentY = printer.y = sSecondaryListTemplate.upText_Y; AddTextPrinter(&printer, 0, NULL); - - PadString(sText_EffectOverride, text); - printer.fontId = 0; - printer.currentY = printer.y = sSecondaryListTemplate.upText_Y + yMultiplier; - AddTextPrinter(&printer, 0, NULL); break; case LIST_ITEM_TYPES: for (i = 0; i < 3; i++) @@ -1586,12 +1579,6 @@ static void UpdateBattlerValue(struct BattleDebugMenu *data) gBattleMons[data->battlerId].status2 &= ~STATUS2_INFATUATION; } break; - case VAL_ITEM: - if (data->currentSecondaryListItemId == 0) - *(u16 *)(data->modifyArrows.modifiedValPtr) = data->modifyArrows.currValue; - else if (data->currentSecondaryListItemId == 1) - gBattleStruct->debugHoldEffects[data->battlerId] = data->modifyArrows.currValue; - break; } data->battlerWasChanged[data->battlerId] = TRUE; } @@ -1639,7 +1626,7 @@ static void ValueToCharDigits(u8 *charDigits, u32 newValue, u8 maxDigits) static u8 *GetSideStatusValue(struct BattleDebugMenu *data, bool32 changeStatus, bool32 statusTrue) { - struct SideTimer *sideTimer = &gSideTimers[GET_BATTLER_SIDE(data->battlerId)]; + struct SideTimer *sideTimer = &gSideTimers[GetBattlerSide(data->battlerId)]; switch (data->currentSecondaryListItemId) { @@ -1800,11 +1787,8 @@ static void SetUpModifyArrows(struct BattleDebugMenu *data) data->modifyArrows.maxValue = ITEMS_COUNT - 1; data->modifyArrows.maxDigits = 3; data->modifyArrows.modifiedValPtr = &gBattleMons[data->battlerId].item; - data->modifyArrows.typeOfVal = VAL_ITEM; - if (data->currentSecondaryListItemId == 0) - data->modifyArrows.currValue = gBattleMons[data->battlerId].item; - else - data->modifyArrows.currValue = gBattleStruct->debugHoldEffects[data->battlerId]; + data->modifyArrows.typeOfVal = VAL_U16; + data->modifyArrows.currValue = gBattleMons[data->battlerId].item; break; case LIST_ITEM_TYPES: data->modifyArrows.minValue = 0; @@ -1925,7 +1909,7 @@ static void SetUpModifyArrows(struct BattleDebugMenu *data) data->modifyArrows.maxValue = 9; data->modifyArrows.maxDigits = 2; - data->modifyArrows.modifiedValPtr = &gSideStatuses[GET_BATTLER_SIDE(data->battlerId)]; + data->modifyArrows.modifiedValPtr = &gSideStatuses[GetBattlerSide(data->battlerId)]; data->modifyArrows.typeOfVal = VAR_SIDE_STATUS; data->modifyArrows.currValue = *GetSideStatusValue(data, FALSE, FALSE); break; diff --git a/src/battle_dome.c b/src/battle_dome.c index deae7e64f5c0..917200ac67ed 100644 --- a/src/battle_dome.c +++ b/src/battle_dome.c @@ -40,6 +40,8 @@ #include "constants/battle_frontier.h" #include "constants/rgb.h" +#define TAG_BUTTONS 0 + // Enough space to hold 2 match info cards worth of trainers and their parties #define NUM_INFOCARD_SPRITES ((FRONTIER_PARTY_SIZE + 1) * 4) #define NUM_INFOCARD_TRAINERS 2 @@ -56,7 +58,7 @@ struct TourneyTreeLineSection { u8 x; u8 y; - u16 src; + u16 tile; }; #define DOME_TRAINERS gSaveBlock2Ptr->frontier.domeTrainers @@ -157,8 +159,6 @@ static void BufferLastDomeWinnerName(void); static void InitRandomTourneyTreeResults(void); static void InitDomeTrainers(void); -EWRAM_DATA u32 gPlayerPartyLostHP = 0; // never read -static EWRAM_DATA u32 sPlayerPartyMaxHP = 0; // never read static EWRAM_DATA struct TourneyTreeInfoCard *sInfoCard = {0}; static EWRAM_DATA u8 *sTilemapBuffer = NULL; @@ -904,14 +904,14 @@ static const struct ScanlineEffectParams sTourneyTreeScanlineEffectParams = static const struct CompressedSpriteSheet sTourneyTreeButtonsSpriteSheet[] = { - {gDomeTourneyTreeButtons_Gfx, 0x0600, 0x0000}, + {.data = gDomeTourneyTreeButtons_Gfx, .size = 0x0600, .tag = TAG_BUTTONS}, {}, }; // Unused static const struct CompressedSpritePalette sTourneyTreeButtonsSpritePal[] = { - {gDomeTourneyTreeButtons_Pal, 0x0000}, + {.data = gDomeTourneyTreeButtons_Pal, .tag = TAG_BUTTONS}, {}, }; @@ -1004,7 +1004,7 @@ static const union AnimCmd * const sSpriteAnimTable_TourneyTreePokeball[] = // Sprite template for the pokeballs on the tourney tree that act as buttons to view a trainer/match info card static const struct SpriteTemplate sTourneyTreePokeballSpriteTemplate = { - .tileTag = 0x0000, + .tileTag = TAG_BUTTONS, .paletteTag = TAG_NONE, .oam = &sOamData_TourneyTreePokeball, .anims = sSpriteAnimTable_TourneyTreePokeball, @@ -1033,7 +1033,7 @@ static const union AnimCmd * const sSpriteAnimTable_TourneyTreeCancelButton[] = static const struct SpriteTemplate sCancelButtonSpriteTemplate = { - .tileTag = 0x0000, + .tileTag = TAG_BUTTONS, .paletteTag = TAG_NONE, .oam = &sOamData_TourneyTreeCloseButton, .anims = sSpriteAnimTable_TourneyTreeCancelButton, @@ -1062,7 +1062,7 @@ static const union AnimCmd * const sSpriteAnimTable_TourneyTreeExitButton[] = static const struct SpriteTemplate sExitButtonSpriteTemplate = { - .tileTag = 0x0000, + .tileTag = TAG_BUTTONS, .paletteTag = TAG_NONE, .oam = &sOamData_TourneyTreeCloseButton, .anims = sSpriteAnimTable_TourneyTreeExitButton, @@ -1109,7 +1109,7 @@ static const union AnimCmd * const sSpriteAnimTable_HorizontalScrollArrow[] = static const struct SpriteTemplate sHorizontalScrollArrowSpriteTemplate = { - .tileTag = 0x0000, + .tileTag = TAG_BUTTONS, .paletteTag = TAG_NONE, .oam = &sOamData_HorizontalScrollArrow, .anims = sSpriteAnimTable_HorizontalScrollArrow, @@ -1120,7 +1120,7 @@ static const struct SpriteTemplate sHorizontalScrollArrowSpriteTemplate = static const struct SpriteTemplate sVerticalScrollArrowSpriteTemplate = { - .tileTag = 0x0000, + .tileTag = TAG_BUTTONS, .paletteTag = TAG_NONE, .oam = &sOamData_VerticalScrollArrow, .anims = sSpriteAnimTable_VerticalScrollArrow, @@ -1482,589 +1482,617 @@ static const u8 sTourneyTreePokeballCoords[DOME_TOURNAMENT_TRAINERS_COUNT + DOME {120, 89}, // Final match }; +// Tile values from tourney_tree.png for the highlighted lines of the tourney tree. +// These tiles will be used to replace the existing, unhighlighted line tiles on the tourney tree tilemap. +#define LINE_PAL (6 << 12) +#define LINE_H (LINE_PAL | 0x21) // Horizontal +#define LINE_CORNER_R (LINE_PAL | 0x23) // Horizontal into a right-side vertical +#define LINE_CORNER_L (LINE_PAL | 0x25) // Horizontal into a left-side vertical +#define LINE_V_R (LINE_PAL | 0x27) // Right-side vertical +#define LINE_V_L (LINE_PAL | 0x29) // Left-side vertical +#define LINE_H_BOTTOM (LINE_PAL | 0x2B) // Horizontal on the bottom of the tree +#define LINE_H_LOGO1 (LINE_PAL | 0x2C) // Horizontal, logo behind +#define LINE_H_LOGO2 (LINE_PAL | 0x2D) // Horizontal, logo behind +#define LINE_H_LOGO3 (LINE_PAL | 0x2E) // Horizontal, logo behind +#define LINE_H_LOGO4 (LINE_PAL | 0x2F) // Horizontal, logo behind +#define LINE_V_R_LOGO1 (LINE_PAL | 0x30) // Right-side vertical, logo behind +#define LINE_V_R_LOGO2 (LINE_PAL | 0x31) // Right-side vertical, logo behind +#define LINE_V_R_LOGO3 (LINE_PAL | 0x32) // Right-side vertical, logo behind +#define LINE_V_R_LOGO4 (LINE_PAL | 0x33) // Right-side vertical, logo behind +#define LINE_V_L_LOGO1 (LINE_PAL | 0x35) // Left-side vertical, logo behind +#define LINE_V_L_LOGO2 (LINE_PAL | 0x36) // Left-side vertical, logo behind +#define LINE_V_L_LOGO3 (LINE_PAL | 0x37) // Left-side vertical, logo behind +#define LINE_V_L_LOGO4 (LINE_PAL | 0x38) // Left-side vertical, logo behind +#define LINE_V_R_HALF_LOGO (LINE_PAL | 0x3B) // Right-side vertical, half lit from the top, logo behind +#define LINE_V_L_HALF_LOGO (LINE_PAL | 0x3C) // Left-side vertical, half lit from the top, logo behind +#define LINE_CORNER_R_HALF (LINE_PAL | 0x43) // Lit horizontal, unlit right-side vertical +#define LINE_CORNER_L_HALF (LINE_PAL | 0x45) // Lit horizontal, unlit left-side vertical +#define LINE_V_R_HALF (LINE_PAL | 0x47) // Right-side vertical, half lit from the top +#define LINE_V_L_HALF (LINE_PAL | 0x49) // Left-side vertical, half lit from the top + // Each of these line sections define the position of the advancement line on the tourney tree for the victor of that round // The trainers here are numbered by tourney ID (rank/seed) and ordered according to where they start on the tourney tree -#define LINESECTION_ROUND1_TRAINER1(lastSrc) \ - {.src = 0x6021, .y = 0x04, .x = 0x09}, \ - {.src = 0x6023, .y = 0x04, .x = 0x0a}, \ - {.src = 0x6047, .y = 0x05, .x = 0x0a}, \ - {.src = lastSrc, .y = 0x05, .x = 0x0b}, - -#define LINESECTION_ROUND1_TRAINER9(lastSrc) \ - {.src = 0x6021, .y = 0x06, .x = 0x09}, \ - {.src = 0x6021, .y = 0x06, .x = 0x0a}, \ - {.src = 0x6027, .y = 0x05, .x = 0x0a}, \ - {.src = lastSrc, .y = 0x05, .x = 0x0b}, - -#define LINESECTION_ROUND1_TRAINER13(lastSrc) \ - {.src = 0x6021, .y = 0x08, .x = 0x09}, \ - {.src = 0x6023, .y = 0x08, .x = 0x0a}, \ - {.src = 0x6047, .y = 0x09, .x = 0x0a}, \ - {.src = lastSrc, .y = 0x09, .x = 0x0b}, - -#define LINESECTION_ROUND1_TRAINER5(lastSrc) \ - {.src = 0x6021, .y = 0x0a, .x = 0x09}, \ - {.src = 0x6021, .y = 0x0a, .x = 0x0a}, \ - {.src = 0x6027, .y = 0x09, .x = 0x0a}, \ - {.src = lastSrc, .y = 0x09, .x = 0x0b}, - -#define LINESECTION_ROUND1_TRAINER8(lastSrc) \ - {.src = 0x6021, .y = 0x0c, .x = 0x09}, \ - {.src = 0x6023, .y = 0x0c, .x = 0x0a}, \ - {.src = 0x6047, .y = 0x0d, .x = 0x0a}, \ - {.src = lastSrc, .y = 0x0d, .x = 0x0b}, - -#define LINESECTION_ROUND1_TRAINER16(lastSrc) \ - {.src = 0x6021, .y = 0x0e, .x = 0x09}, \ - {.src = 0x6021, .y = 0x0e, .x = 0x0a}, \ - {.src = 0x6027, .y = 0x0d, .x = 0x0a}, \ - {.src = lastSrc, .y = 0x0d, .x = 0x0b}, - -#define LINESECTION_ROUND1_TRAINER12(lastSrc) \ - {.src = 0x6021, .y = 0x10, .x = 0x09}, \ - {.src = 0x6023, .y = 0x10, .x = 0x0a}, \ - {.src = 0x6047, .y = 0x11, .x = 0x0a}, \ - {.src = lastSrc, .y = 0x11, .x = 0x0b}, - -#define LINESECTION_ROUND1_TRAINER4(lastSrc) \ - {.src = 0x602b, .y = 0x12, .x = 0x09}, \ - {.src = 0x602b, .y = 0x12, .x = 0x0a}, \ - {.src = 0x6027, .y = 0x11, .x = 0x0a}, \ - {.src = lastSrc, .y = 0x11, .x = 0x0b}, - -#define LINESECTION_ROUND1_TRAINER3(lastSrc) \ - {.src = 0x6021, .y = 0x04, .x = 0x14}, \ - {.src = 0x6025, .y = 0x04, .x = 0x13}, \ - {.src = 0x6049, .y = 0x05, .x = 0x13}, \ - {.src = lastSrc, .y = 0x05, .x = 0x12}, - -#define LINESECTION_ROUND1_TRAINER11(lastSrc) \ - {.src = 0x6021, .y = 0x06, .x = 0x14}, \ - {.src = 0x6021, .y = 0x06, .x = 0x13}, \ - {.src = 0x6029, .y = 0x05, .x = 0x13}, \ - {.src = lastSrc, .y = 0x05, .x = 0x12}, - -#define LINESECTION_ROUND1_TRAINER15(lastSrc) \ - {.src = 0x6021, .y = 0x08, .x = 0x14}, \ - {.src = 0x6025, .y = 0x08, .x = 0x13}, \ - {.src = 0x6049, .y = 0x09, .x = 0x13}, \ - {.src = lastSrc, .y = 0x09, .x = 0x12}, - -#define LINESECTION_ROUND1_TRAINER7(lastSrc) \ - {.src = 0x6021, .y = 0x0a, .x = 0x14}, \ - {.src = 0x6021, .y = 0x0a, .x = 0x13}, \ - {.src = 0x6029, .y = 0x09, .x = 0x13}, \ - {.src = lastSrc, .y = 0x09, .x = 0x12}, - -#define LINESECTION_ROUND1_TRAINER6(lastSrc) \ - {.src = 0x6021, .y = 0x0c, .x = 0x14}, \ - {.src = 0x6025, .y = 0x0c, .x = 0x13}, \ - {.src = 0x6049, .y = 0x0d, .x = 0x13}, \ - {.src = lastSrc, .y = 0x0d, .x = 0x12}, - -#define LINESECTION_ROUND1_TRAINER14(lastSrc) \ - {.src = 0x6021, .y = 0x0e, .x = 0x14}, \ - {.src = 0x6021, .y = 0x0e, .x = 0x13}, \ - {.src = 0x6029, .y = 0x0d, .x = 0x13}, \ - {.src = lastSrc, .y = 0x0d, .x = 0x12}, - -#define LINESECTION_ROUND1_TRAINER10(lastSrc) \ - {.src = 0x6021, .y = 0x10, .x = 0x14}, \ - {.src = 0x6025, .y = 0x10, .x = 0x13}, \ - {.src = 0x6049, .y = 0x11, .x = 0x13}, \ - {.src = lastSrc, .y = 0x11, .x = 0x12}, - -#define LINESECTION_ROUND1_TRAINER2(lastSrc) \ - {.src = 0x602b, .y = 0x12, .x = 0x14}, \ - {.src = 0x602b, .y = 0x12, .x = 0x13}, \ - {.src = 0x6029, .y = 0x11, .x = 0x13}, \ - {.src = lastSrc, .y = 0x11, .x = 0x12}, - -#define LINESECTION_ROUND2_MATCH1(lastSrc) \ - {.src = 0x6027, .y = 0x06, .x = 0x0b}, \ - {.src = 0x6047, .y = 0x07, .x = 0x0b}, \ - {.src = lastSrc, .y = 0x07, .x = 0x0c}, - -#define LINESECTION_ROUND2_MATCH2(lastSrc) \ - {.src = 0x6027, .y = 0x08, .x = 0x0b}, \ - {.src = 0x6027, .y = 0x07, .x = 0x0b}, \ - {.src = lastSrc, .y = 0x07, .x = 0x0c}, - -#define LINESECTION_ROUND2_MATCH3(lastSrc) \ - {.src = 0x6027, .y = 0x0e, .x = 0x0b}, \ - {.src = 0x6047, .y = 0x0f, .x = 0x0b}, \ - {.src = lastSrc, .y = 0x0f, .x = 0x0c}, - -#define LINESECTION_ROUND2_MATCH4(lastSrc) \ - {.src = 0x6027, .y = 0x10, .x = 0x0b}, \ - {.src = 0x6027, .y = 0x0f, .x = 0x0b}, \ - {.src = lastSrc, .y = 0x0f, .x = 0x0c}, - -#define LINESECTION_ROUND2_MATCH5(lastSrc) \ - {.src = 0x6029, .y = 0x06, .x = 0x12}, \ - {.src = 0x6049, .y = 0x07, .x = 0x12}, \ - {.src = lastSrc, .y = 0x07, .x = 0x11}, - -#define LINESECTION_ROUND2_MATCH6(lastSrc) \ - {.src = 0x6029, .y = 0x08, .x = 0x12}, \ - {.src = 0x6029, .y = 0x07, .x = 0x12}, \ - {.src = lastSrc, .y = 0x07, .x = 0x11}, - -#define LINESECTION_ROUND2_MATCH7(lastSrc) \ - {.src = 0x6029, .y = 0x0e, .x = 0x12}, \ - {.src = 0x6049, .y = 0x0f, .x = 0x12}, \ - {.src = lastSrc, .y = 0x0f, .x = 0x11}, - -#define LINESECTION_ROUND2_MATCH8(lastSrc) \ - {.src = 0x6029, .y = 0x10, .x = 0x12}, \ - {.src = 0x6029, .y = 0x0f, .x = 0x12}, \ - {.src = lastSrc, .y = 0x0f, .x = 0x11}, - -#define LINESECTION_SEMIFINAL_TOP_LEFT \ - {.src = 0x6027, .y = 0x08, .x = 0x0c}, \ - {.src = 0x6027, .y = 0x09, .x = 0x0c}, \ - {.src = 0x6027, .y = 0x0a, .x = 0x0c}, \ - {.src = 0x603b, .y = 0x0b, .x = 0x0c}, - -#define LINESECTION_SEMIFINAL_BOTTOM_LEFT \ - {.src = 0x6033, .y = 0x0e, .x = 0x0c}, \ - {.src = 0x6032, .y = 0x0d, .x = 0x0c}, \ - {.src = 0x6031, .y = 0x0c, .x = 0x0c}, \ - {.src = 0x6030, .y = 0x0b, .x = 0x0c}, - -#define LINESECTION_SEMIFINAL_TOP_RIGHT \ - {.src = 0x6029, .y = 0x08, .x = 0x11}, \ - {.src = 0x6029, .y = 0x09, .x = 0x11}, \ - {.src = 0x6029, .y = 0x0a, .x = 0x11}, \ - {.src = 0x603c, .y = 0x0b, .x = 0x11}, - +#define LINESECTION_ROUND1_TRAINER1(lastTile) \ + {.tile = LINE_H, .y = 4, .x = 9}, \ + {.tile = LINE_CORNER_R, .y = 4, .x = 10}, \ + {.tile = LINE_V_R_HALF, .y = 5, .x = 10}, \ + {.tile = lastTile, .y = 5, .x = 11}, + +#define LINESECTION_ROUND1_TRAINER9(lastTile) \ + {.tile = LINE_H, .y = 6, .x = 9}, \ + {.tile = LINE_H, .y = 6, .x = 10}, \ + {.tile = LINE_V_R, .y = 5, .x = 10}, \ + {.tile = lastTile, .y = 5, .x = 11}, + +#define LINESECTION_ROUND1_TRAINER13(lastTile) \ + {.tile = LINE_H, .y = 8, .x = 9}, \ + {.tile = LINE_CORNER_R, .y = 8, .x = 10}, \ + {.tile = LINE_V_R_HALF, .y = 9, .x = 10}, \ + {.tile = lastTile, .y = 9, .x = 11}, + +#define LINESECTION_ROUND1_TRAINER5(lastTile) \ + {.tile = LINE_H, .y = 10, .x = 9}, \ + {.tile = LINE_H, .y = 10, .x = 10}, \ + {.tile = LINE_V_R, .y = 9, .x = 10}, \ + {.tile = lastTile, .y = 9, .x = 11}, + +#define LINESECTION_ROUND1_TRAINER8(lastTile) \ + {.tile = LINE_H, .y = 12, .x = 9}, \ + {.tile = LINE_CORNER_R, .y = 12, .x = 10}, \ + {.tile = LINE_V_R_HALF, .y = 13, .x = 10}, \ + {.tile = lastTile, .y = 13, .x = 11}, + +#define LINESECTION_ROUND1_TRAINER16(lastTile) \ + {.tile = LINE_H, .y = 14, .x = 9}, \ + {.tile = LINE_H, .y = 14, .x = 10}, \ + {.tile = LINE_V_R, .y = 13, .x = 10}, \ + {.tile = lastTile, .y = 13, .x = 11}, + +#define LINESECTION_ROUND1_TRAINER12(lastTile) \ + {.tile = LINE_H, .y = 16, .x = 9}, \ + {.tile = LINE_CORNER_R, .y = 16, .x = 10}, \ + {.tile = LINE_V_R_HALF, .y = 17, .x = 10}, \ + {.tile = lastTile, .y = 17, .x = 11}, + +#define LINESECTION_ROUND1_TRAINER4(lastTile) \ + {.tile = LINE_H_BOTTOM, .y = 18, .x = 9}, \ + {.tile = LINE_H_BOTTOM, .y = 18, .x = 10}, \ + {.tile = LINE_V_R, .y = 17, .x = 10}, \ + {.tile = lastTile, .y = 17, .x = 11}, + +#define LINESECTION_ROUND1_TRAINER3(lastTile) \ + {.tile = LINE_H, .y = 4, .x = 20}, \ + {.tile = LINE_CORNER_L, .y = 4, .x = 19}, \ + {.tile = LINE_V_L_HALF, .y = 5, .x = 19}, \ + {.tile = lastTile, .y = 5, .x = 18}, + +#define LINESECTION_ROUND1_TRAINER11(lastTile) \ + {.tile = LINE_H, .y = 6, .x = 20}, \ + {.tile = LINE_H, .y = 6, .x = 19}, \ + {.tile = LINE_V_L, .y = 5, .x = 19}, \ + {.tile = lastTile, .y = 5, .x = 18}, + +#define LINESECTION_ROUND1_TRAINER15(lastTile) \ + {.tile = LINE_H, .y = 8, .x = 20}, \ + {.tile = LINE_CORNER_L, .y = 8, .x = 19}, \ + {.tile = LINE_V_L_HALF, .y = 9, .x = 19}, \ + {.tile = lastTile, .y = 9, .x = 18}, + +#define LINESECTION_ROUND1_TRAINER7(lastTile) \ + {.tile = LINE_H, .y = 10, .x = 20}, \ + {.tile = LINE_H, .y = 10, .x = 19}, \ + {.tile = LINE_V_L, .y = 9, .x = 19}, \ + {.tile = lastTile, .y = 9, .x = 18}, + +#define LINESECTION_ROUND1_TRAINER6(lastTile) \ + {.tile = LINE_H, .y = 12, .x = 20}, \ + {.tile = LINE_CORNER_L, .y = 12, .x = 19}, \ + {.tile = LINE_V_L_HALF, .y = 13, .x = 19}, \ + {.tile = lastTile, .y = 13, .x = 18}, + +#define LINESECTION_ROUND1_TRAINER14(lastTile) \ + {.tile = LINE_H, .y = 14, .x = 20}, \ + {.tile = LINE_H, .y = 14, .x = 19}, \ + {.tile = LINE_V_L, .y = 13, .x = 19}, \ + {.tile = lastTile, .y = 13, .x = 18}, + +#define LINESECTION_ROUND1_TRAINER10(lastTile) \ + {.tile = LINE_H, .y = 16, .x = 20}, \ + {.tile = LINE_CORNER_L, .y = 16, .x = 19}, \ + {.tile = LINE_V_L_HALF, .y = 17, .x = 19}, \ + {.tile = lastTile, .y = 17, .x = 18}, + +#define LINESECTION_ROUND1_TRAINER2(lastTile) \ + {.tile = LINE_H_BOTTOM, .y = 18, .x = 20}, \ + {.tile = LINE_H_BOTTOM, .y = 18, .x = 19}, \ + {.tile = LINE_V_L, .y = 17, .x = 19}, \ + {.tile = lastTile, .y = 17, .x = 18}, + +#define LINESECTION_ROUND2_MATCH1(lastTile) \ + {.tile = LINE_V_R, .y = 6, .x = 11}, \ + {.tile = LINE_V_R_HALF, .y = 7, .x = 11}, \ + {.tile = lastTile, .y = 7, .x = 12}, + +#define LINESECTION_ROUND2_MATCH2(lastTile) \ + {.tile = LINE_V_R, .y = 8, .x = 11}, \ + {.tile = LINE_V_R, .y = 7, .x = 11}, \ + {.tile = lastTile, .y = 7, .x = 12}, + +#define LINESECTION_ROUND2_MATCH3(lastTile) \ + {.tile = LINE_V_R, .y = 14, .x = 11}, \ + {.tile = LINE_V_R_HALF, .y = 15, .x = 11}, \ + {.tile = lastTile, .y = 15, .x = 12}, + +#define LINESECTION_ROUND2_MATCH4(lastTile) \ + {.tile = LINE_V_R, .y = 16, .x = 11}, \ + {.tile = LINE_V_R, .y = 15, .x = 11}, \ + {.tile = lastTile, .y = 15, .x = 12}, + +#define LINESECTION_ROUND2_MATCH5(lastTile) \ + {.tile = LINE_V_L, .y = 6, .x = 18}, \ + {.tile = LINE_V_L_HALF, .y = 7, .x = 18}, \ + {.tile = lastTile, .y = 7, .x = 17}, + +#define LINESECTION_ROUND2_MATCH6(lastTile) \ + {.tile = LINE_V_L, .y = 8, .x = 18}, \ + {.tile = LINE_V_L, .y = 7, .x = 18}, \ + {.tile = lastTile, .y = 7, .x = 17}, + +#define LINESECTION_ROUND2_MATCH7(lastTile) \ + {.tile = LINE_V_L, .y = 14, .x = 18}, \ + {.tile = LINE_V_L_HALF, .y = 15, .x = 18}, \ + {.tile = lastTile, .y = 15, .x = 17}, + +#define LINESECTION_ROUND2_MATCH8(lastTile) \ + {.tile = LINE_V_L, .y = 16, .x = 18}, \ + {.tile = LINE_V_L, .y = 15, .x = 18}, \ + {.tile = lastTile, .y = 15, .x = 17}, + +#define LINESECTION_SEMIFINAL_TOP_LEFT \ + {.tile = LINE_V_R, .y = 8, .x = 12}, \ + {.tile = LINE_V_R, .y = 9, .x = 12}, \ + {.tile = LINE_V_R, .y = 10, .x = 12}, \ + {.tile = LINE_V_R_HALF_LOGO, .y = 11, .x = 12}, + +#define LINESECTION_SEMIFINAL_BOTTOM_LEFT \ + {.tile = LINE_V_R_LOGO4, .y = 14, .x = 12}, \ + {.tile = LINE_V_R_LOGO3, .y = 13, .x = 12}, \ + {.tile = LINE_V_R_LOGO2, .y = 12, .x = 12}, \ + {.tile = LINE_V_R_LOGO1, .y = 11, .x = 12}, + +#define LINESECTION_SEMIFINAL_TOP_RIGHT \ + {.tile = LINE_V_L, .y = 8, .x = 17}, \ + {.tile = LINE_V_L, .y = 9, .x = 17}, \ + {.tile = LINE_V_L, .y = 10, .x = 17}, \ + {.tile = LINE_V_L_HALF_LOGO, .y = 11, .x = 17}, + #define LINESECTION_SEMIFINAL_BOTTOM_RIGHT \ - {.src = 0x6038, .y = 0x0e, .x = 0x11}, \ - {.src = 0x6037, .y = 0x0d, .x = 0x11}, \ - {.src = 0x6036, .y = 0x0c, .x = 0x11}, \ - {.src = 0x6035, .y = 0x0b, .x = 0x11}, - -#define LINESECTION_FINAL_LEFT \ - {.src = 0x602c, .y = 0x0b, .x = 0x0d}, \ - {.src = 0x602d, .y = 0x0b, .x = 0x0e}, + {.tile = LINE_V_L_LOGO4, .y = 14, .x = 17}, \ + {.tile = LINE_V_L_LOGO3, .y = 13, .x = 17}, \ + {.tile = LINE_V_L_LOGO2, .y = 12, .x = 17}, \ + {.tile = LINE_V_L_LOGO1, .y = 11, .x = 17}, + +#define LINESECTION_FINAL_LEFT \ + {.tile = LINE_H_LOGO1, .y = 11, .x = 13}, \ + {.tile = LINE_H_LOGO2, .y = 11, .x = 14}, -#define LINESECTION_FINAL_RIGHT \ - {.src = 0x602f, .y = 0x0b, .x = 0x10}, \ - {.src = 0x602e, .y = 0x0b, .x = 0x0f}, +#define LINESECTION_FINAL_RIGHT \ + {.tile = LINE_H_LOGO4, .y = 11, .x = 16}, \ + {.tile = LINE_H_LOGO3, .y = 11, .x = 15}, static const struct TourneyTreeLineSection sLineSectionTrainer1Round1[] = { - LINESECTION_ROUND1_TRAINER1(0x6043) + LINESECTION_ROUND1_TRAINER1(LINE_CORNER_R_HALF) }; static const struct TourneyTreeLineSection sLineSectionTrainer1Round2[] = { - LINESECTION_ROUND1_TRAINER1(0x6023) - LINESECTION_ROUND2_MATCH1(0x6043) + LINESECTION_ROUND1_TRAINER1(LINE_CORNER_R) + LINESECTION_ROUND2_MATCH1(LINE_CORNER_R_HALF) }; static const struct TourneyTreeLineSection sLineSectionTrainer1Semifinal[] = { - LINESECTION_ROUND1_TRAINER1(0x6023) - LINESECTION_ROUND2_MATCH1(0x6023) + LINESECTION_ROUND1_TRAINER1(LINE_CORNER_R) + LINESECTION_ROUND2_MATCH1(LINE_CORNER_R) LINESECTION_SEMIFINAL_TOP_LEFT }; static const struct TourneyTreeLineSection sLineSectionTrainer1Final[] = { - LINESECTION_ROUND1_TRAINER1(0x6023) - LINESECTION_ROUND2_MATCH1(0x6023) + LINESECTION_ROUND1_TRAINER1(LINE_CORNER_R) + LINESECTION_ROUND2_MATCH1(LINE_CORNER_R) LINESECTION_SEMIFINAL_TOP_LEFT LINESECTION_FINAL_LEFT }; static const struct TourneyTreeLineSection sLineSectionTrainer9Round1[] = { - LINESECTION_ROUND1_TRAINER9(0x6043) + LINESECTION_ROUND1_TRAINER9(LINE_CORNER_R_HALF) }; static const struct TourneyTreeLineSection sLineSectionTrainer9Round2[] = { - LINESECTION_ROUND1_TRAINER9(0x6023) - LINESECTION_ROUND2_MATCH1(0x6043) + LINESECTION_ROUND1_TRAINER9(LINE_CORNER_R) + LINESECTION_ROUND2_MATCH1(LINE_CORNER_R_HALF) }; static const struct TourneyTreeLineSection sLineSectionTrainer9Semifinal[] = { - LINESECTION_ROUND1_TRAINER9(0x6023) - LINESECTION_ROUND2_MATCH1(0x6023) + LINESECTION_ROUND1_TRAINER9(LINE_CORNER_R) + LINESECTION_ROUND2_MATCH1(LINE_CORNER_R) LINESECTION_SEMIFINAL_TOP_LEFT }; static const struct TourneyTreeLineSection sLineSectionTrainer9Final[] = { - LINESECTION_ROUND1_TRAINER9(0x6023) - LINESECTION_ROUND2_MATCH1(0x6023) + LINESECTION_ROUND1_TRAINER9(LINE_CORNER_R) + LINESECTION_ROUND2_MATCH1(LINE_CORNER_R) LINESECTION_SEMIFINAL_TOP_LEFT LINESECTION_FINAL_LEFT }; static const struct TourneyTreeLineSection sLineSectionTrainer13Round1[] = { - LINESECTION_ROUND1_TRAINER13(0x6021) + LINESECTION_ROUND1_TRAINER13(LINE_H) }; static const struct TourneyTreeLineSection sLineSectionTrainer13Round2[] = { - LINESECTION_ROUND1_TRAINER13(0x6021) - LINESECTION_ROUND2_MATCH2(0x6043) + LINESECTION_ROUND1_TRAINER13(LINE_H) + LINESECTION_ROUND2_MATCH2(LINE_CORNER_R_HALF) }; static const struct TourneyTreeLineSection sLineSectionTrainer13Semifinal[] = { - LINESECTION_ROUND1_TRAINER13(0x6021) - LINESECTION_ROUND2_MATCH2(0x6023) + LINESECTION_ROUND1_TRAINER13(LINE_H) + LINESECTION_ROUND2_MATCH2(LINE_CORNER_R) LINESECTION_SEMIFINAL_TOP_LEFT }; static const struct TourneyTreeLineSection sLineSectionTrainer13Final[] = { - LINESECTION_ROUND1_TRAINER13(0x6021) - LINESECTION_ROUND2_MATCH2(0x6023) + LINESECTION_ROUND1_TRAINER13(LINE_H) + LINESECTION_ROUND2_MATCH2(LINE_CORNER_R) LINESECTION_SEMIFINAL_TOP_LEFT LINESECTION_FINAL_LEFT }; static const struct TourneyTreeLineSection sLineSectionTrainer5Round1[] = { - LINESECTION_ROUND1_TRAINER5(0x6021) + LINESECTION_ROUND1_TRAINER5(LINE_H) }; static const struct TourneyTreeLineSection sLineSectionTrainer5Round2[] = { - LINESECTION_ROUND1_TRAINER5(0x6021) - LINESECTION_ROUND2_MATCH2(0x6043) + LINESECTION_ROUND1_TRAINER5(LINE_H) + LINESECTION_ROUND2_MATCH2(LINE_CORNER_R_HALF) }; static const struct TourneyTreeLineSection sLineSectionTrainer5Semifinal[] = { - LINESECTION_ROUND1_TRAINER5(0x6021) - LINESECTION_ROUND2_MATCH2(0x6023) + LINESECTION_ROUND1_TRAINER5(LINE_H) + LINESECTION_ROUND2_MATCH2(LINE_CORNER_R) LINESECTION_SEMIFINAL_TOP_LEFT }; static const struct TourneyTreeLineSection sLineSectionTrainer5Final[] = { - LINESECTION_ROUND1_TRAINER5(0x6021) - LINESECTION_ROUND2_MATCH2(0x6023) + LINESECTION_ROUND1_TRAINER5(LINE_H) + LINESECTION_ROUND2_MATCH2(LINE_CORNER_R) LINESECTION_SEMIFINAL_TOP_LEFT LINESECTION_FINAL_LEFT }; static const struct TourneyTreeLineSection sLineSectionTrainer8Round1[] = { - LINESECTION_ROUND1_TRAINER8(0x6043) + LINESECTION_ROUND1_TRAINER8(LINE_CORNER_R_HALF) }; static const struct TourneyTreeLineSection sLineSectionTrainer8Round2[] = { - LINESECTION_ROUND1_TRAINER8(0x6023) - LINESECTION_ROUND2_MATCH3(0x6021) + LINESECTION_ROUND1_TRAINER8(LINE_CORNER_R) + LINESECTION_ROUND2_MATCH3(LINE_H) }; static const struct TourneyTreeLineSection sLineSectionTrainer8Semifinal[] = { - LINESECTION_ROUND1_TRAINER8(0x6023) - LINESECTION_ROUND2_MATCH3(0x6021) + LINESECTION_ROUND1_TRAINER8(LINE_CORNER_R) + LINESECTION_ROUND2_MATCH3(LINE_H) LINESECTION_SEMIFINAL_BOTTOM_LEFT }; static const struct TourneyTreeLineSection sLineSectionTrainer8Final[] = { - LINESECTION_ROUND1_TRAINER8(0x6023) - LINESECTION_ROUND2_MATCH3(0x6021) + LINESECTION_ROUND1_TRAINER8(LINE_CORNER_R) + LINESECTION_ROUND2_MATCH3(LINE_H) LINESECTION_SEMIFINAL_BOTTOM_LEFT LINESECTION_FINAL_LEFT }; static const struct TourneyTreeLineSection sLineSectionTrainer16Round1[] = { - LINESECTION_ROUND1_TRAINER16(0x6043) + LINESECTION_ROUND1_TRAINER16(LINE_CORNER_R_HALF) }; static const struct TourneyTreeLineSection sLineSectionTrainer16Round2[] = { - LINESECTION_ROUND1_TRAINER16(0x6023) - LINESECTION_ROUND2_MATCH3(0x6021) + LINESECTION_ROUND1_TRAINER16(LINE_CORNER_R) + LINESECTION_ROUND2_MATCH3(LINE_H) }; static const struct TourneyTreeLineSection sLineSectionTrainer16Semifinal[] = { - LINESECTION_ROUND1_TRAINER16(0x6023) - LINESECTION_ROUND2_MATCH3(0x6021) + LINESECTION_ROUND1_TRAINER16(LINE_CORNER_R) + LINESECTION_ROUND2_MATCH3(LINE_H) LINESECTION_SEMIFINAL_BOTTOM_LEFT }; static const struct TourneyTreeLineSection sLineSectionTrainer16Final[] = { - LINESECTION_ROUND1_TRAINER16(0x6023) - LINESECTION_ROUND2_MATCH3(0x6021) + LINESECTION_ROUND1_TRAINER16(LINE_CORNER_R) + LINESECTION_ROUND2_MATCH3(LINE_H) LINESECTION_SEMIFINAL_BOTTOM_LEFT LINESECTION_FINAL_LEFT }; static const struct TourneyTreeLineSection sLineSectionTrainer12Round1[] = { - LINESECTION_ROUND1_TRAINER12(0x6021) + LINESECTION_ROUND1_TRAINER12(LINE_H) }; static const struct TourneyTreeLineSection sLineSectionTrainer12Round2[] = { - LINESECTION_ROUND1_TRAINER12(0x6021) - LINESECTION_ROUND2_MATCH4(0x6021) + LINESECTION_ROUND1_TRAINER12(LINE_H) + LINESECTION_ROUND2_MATCH4(LINE_H) }; static const struct TourneyTreeLineSection sLineSectionTrainer12Semifinal[] = { - LINESECTION_ROUND1_TRAINER12(0x6021) - LINESECTION_ROUND2_MATCH4(0x6021) + LINESECTION_ROUND1_TRAINER12(LINE_H) + LINESECTION_ROUND2_MATCH4(LINE_H) LINESECTION_SEMIFINAL_BOTTOM_LEFT }; static const struct TourneyTreeLineSection sLineSectionTrainer12Final[] = { - LINESECTION_ROUND1_TRAINER12(0x6021) - LINESECTION_ROUND2_MATCH4(0x6021) + LINESECTION_ROUND1_TRAINER12(LINE_H) + LINESECTION_ROUND2_MATCH4(LINE_H) LINESECTION_SEMIFINAL_BOTTOM_LEFT LINESECTION_FINAL_LEFT }; static const struct TourneyTreeLineSection sLineSectionTrainer4Round1[] = { - LINESECTION_ROUND1_TRAINER4(0x6021) + LINESECTION_ROUND1_TRAINER4(LINE_H) }; static const struct TourneyTreeLineSection sLineSectionTrainer4Round2[] = { - LINESECTION_ROUND1_TRAINER4(0x6021) - LINESECTION_ROUND2_MATCH4(0x6021) + LINESECTION_ROUND1_TRAINER4(LINE_H) + LINESECTION_ROUND2_MATCH4(LINE_H) }; static const struct TourneyTreeLineSection sLineSectionTrainer4Semifinal[] = { - LINESECTION_ROUND1_TRAINER4(0x6021) - LINESECTION_ROUND2_MATCH4(0x6021) + LINESECTION_ROUND1_TRAINER4(LINE_H) + LINESECTION_ROUND2_MATCH4(LINE_H) LINESECTION_SEMIFINAL_BOTTOM_LEFT }; static const struct TourneyTreeLineSection sLineSectionTrainer4Final[] = { - LINESECTION_ROUND1_TRAINER4(0x6021) - LINESECTION_ROUND2_MATCH4(0x6021) + LINESECTION_ROUND1_TRAINER4(LINE_H) + LINESECTION_ROUND2_MATCH4(LINE_H) LINESECTION_SEMIFINAL_BOTTOM_LEFT LINESECTION_FINAL_LEFT }; static const struct TourneyTreeLineSection sLineSectionTrainer3Round1[] = { - LINESECTION_ROUND1_TRAINER3(0x6045) + LINESECTION_ROUND1_TRAINER3(LINE_CORNER_L_HALF) }; static const struct TourneyTreeLineSection sLineSectionTrainer3Round2[] = { - LINESECTION_ROUND1_TRAINER3(0x6025) - LINESECTION_ROUND2_MATCH5(0x6045) + LINESECTION_ROUND1_TRAINER3(LINE_CORNER_L) + LINESECTION_ROUND2_MATCH5(LINE_CORNER_L_HALF) }; static const struct TourneyTreeLineSection sLineSectionTrainer3Semifinal[] = { - LINESECTION_ROUND1_TRAINER3(0x6025) - LINESECTION_ROUND2_MATCH5(0x6025) + LINESECTION_ROUND1_TRAINER3(LINE_CORNER_L) + LINESECTION_ROUND2_MATCH5(LINE_CORNER_L) LINESECTION_SEMIFINAL_TOP_RIGHT }; static const struct TourneyTreeLineSection sLineSectionTrainer3Final[] = { - LINESECTION_ROUND1_TRAINER3(0x6025) - LINESECTION_ROUND2_MATCH5(0x6025) + LINESECTION_ROUND1_TRAINER3(LINE_CORNER_L) + LINESECTION_ROUND2_MATCH5(LINE_CORNER_L) LINESECTION_SEMIFINAL_TOP_RIGHT LINESECTION_FINAL_RIGHT }; static const struct TourneyTreeLineSection sLineSectionTrainer11Round1[] = { - LINESECTION_ROUND1_TRAINER11(0x6045) + LINESECTION_ROUND1_TRAINER11(LINE_CORNER_L_HALF) }; static const struct TourneyTreeLineSection sLineSectionTrainer11Round2[] = { - LINESECTION_ROUND1_TRAINER11(0x6025) - LINESECTION_ROUND2_MATCH5(0x6045) + LINESECTION_ROUND1_TRAINER11(LINE_CORNER_L) + LINESECTION_ROUND2_MATCH5(LINE_CORNER_L_HALF) }; static const struct TourneyTreeLineSection sLineSectionTrainer11Semifinal[] = { - LINESECTION_ROUND1_TRAINER11(0x6025) - LINESECTION_ROUND2_MATCH5(0x6025) + LINESECTION_ROUND1_TRAINER11(LINE_CORNER_L) + LINESECTION_ROUND2_MATCH5(LINE_CORNER_L) LINESECTION_SEMIFINAL_TOP_RIGHT }; static const struct TourneyTreeLineSection sLineSectionTrainer11Final[] = { - LINESECTION_ROUND1_TRAINER11(0x6025) - LINESECTION_ROUND2_MATCH5(0x6025) + LINESECTION_ROUND1_TRAINER11(LINE_CORNER_L) + LINESECTION_ROUND2_MATCH5(LINE_CORNER_L) LINESECTION_SEMIFINAL_TOP_RIGHT LINESECTION_FINAL_RIGHT }; static const struct TourneyTreeLineSection sLineSectionTrainer15Round1[] = { - LINESECTION_ROUND1_TRAINER15(0x6021) + LINESECTION_ROUND1_TRAINER15(LINE_H) }; static const struct TourneyTreeLineSection sLineSectionTrainer15Round2[] = { - LINESECTION_ROUND1_TRAINER15(0x6021) - LINESECTION_ROUND2_MATCH6(0x6045) + LINESECTION_ROUND1_TRAINER15(LINE_H) + LINESECTION_ROUND2_MATCH6(LINE_CORNER_L_HALF) }; static const struct TourneyTreeLineSection sLineSectionTrainer15Semifinal[] = { - LINESECTION_ROUND1_TRAINER15(0x6021) - LINESECTION_ROUND2_MATCH6(0x6025) + LINESECTION_ROUND1_TRAINER15(LINE_H) + LINESECTION_ROUND2_MATCH6(LINE_CORNER_L) LINESECTION_SEMIFINAL_TOP_RIGHT }; static const struct TourneyTreeLineSection sLineSectionTrainer15Final[] = { - LINESECTION_ROUND1_TRAINER15(0x6021) - LINESECTION_ROUND2_MATCH6(0x6025) + LINESECTION_ROUND1_TRAINER15(LINE_H) + LINESECTION_ROUND2_MATCH6(LINE_CORNER_L) LINESECTION_SEMIFINAL_TOP_RIGHT LINESECTION_FINAL_RIGHT }; static const struct TourneyTreeLineSection sLineSectionTrainer7Round1[] = { - LINESECTION_ROUND1_TRAINER7(0x6021) + LINESECTION_ROUND1_TRAINER7(LINE_H) }; static const struct TourneyTreeLineSection sLineSectionTrainer7Round2[] = { - LINESECTION_ROUND1_TRAINER7(0x6021) - LINESECTION_ROUND2_MATCH6(0x6045) + LINESECTION_ROUND1_TRAINER7(LINE_H) + LINESECTION_ROUND2_MATCH6(LINE_CORNER_L_HALF) }; static const struct TourneyTreeLineSection sLineSectionTrainer7Semifinal[] = { - LINESECTION_ROUND1_TRAINER7(0x6021) - LINESECTION_ROUND2_MATCH6(0x6025) + LINESECTION_ROUND1_TRAINER7(LINE_H) + LINESECTION_ROUND2_MATCH6(LINE_CORNER_L) LINESECTION_SEMIFINAL_TOP_RIGHT }; static const struct TourneyTreeLineSection sLineSectionTrainer7Final[] = { - LINESECTION_ROUND1_TRAINER7(0x6021) - LINESECTION_ROUND2_MATCH6(0x6025) + LINESECTION_ROUND1_TRAINER7(LINE_H) + LINESECTION_ROUND2_MATCH6(LINE_CORNER_L) LINESECTION_SEMIFINAL_TOP_RIGHT LINESECTION_FINAL_RIGHT }; static const struct TourneyTreeLineSection sLineSectionTrainer6Round1[] = { - LINESECTION_ROUND1_TRAINER6(0x6045) + LINESECTION_ROUND1_TRAINER6(LINE_CORNER_L_HALF) }; static const struct TourneyTreeLineSection sLineSectionTrainer6Round2[] = { - LINESECTION_ROUND1_TRAINER6(0x6025) - LINESECTION_ROUND2_MATCH7(0x6021) + LINESECTION_ROUND1_TRAINER6(LINE_CORNER_L) + LINESECTION_ROUND2_MATCH7(LINE_H) }; static const struct TourneyTreeLineSection sLineSectionTrainer6Semifinal[] = { - LINESECTION_ROUND1_TRAINER6(0x6025) - LINESECTION_ROUND2_MATCH7(0x6021) + LINESECTION_ROUND1_TRAINER6(LINE_CORNER_L) + LINESECTION_ROUND2_MATCH7(LINE_H) LINESECTION_SEMIFINAL_BOTTOM_RIGHT }; static const struct TourneyTreeLineSection sLineSectionTrainer6Final[] = { - LINESECTION_ROUND1_TRAINER6(0x6025) - LINESECTION_ROUND2_MATCH7(0x6021) + LINESECTION_ROUND1_TRAINER6(LINE_CORNER_L) + LINESECTION_ROUND2_MATCH7(LINE_H) LINESECTION_SEMIFINAL_BOTTOM_RIGHT LINESECTION_FINAL_RIGHT }; static const struct TourneyTreeLineSection sLineSectionTrainer14Round1[] = { - LINESECTION_ROUND1_TRAINER14(0x6045) + LINESECTION_ROUND1_TRAINER14(LINE_CORNER_L_HALF) }; static const struct TourneyTreeLineSection sLineSectionTrainer14Round2[] = { - LINESECTION_ROUND1_TRAINER14(0x6025) - LINESECTION_ROUND2_MATCH7(0x6021) + LINESECTION_ROUND1_TRAINER14(LINE_CORNER_L) + LINESECTION_ROUND2_MATCH7(LINE_H) }; static const struct TourneyTreeLineSection sLineSectionTrainer14Semifinal[] = { - LINESECTION_ROUND1_TRAINER14(0x6025) - LINESECTION_ROUND2_MATCH7(0x6021) + LINESECTION_ROUND1_TRAINER14(LINE_CORNER_L) + LINESECTION_ROUND2_MATCH7(LINE_H) LINESECTION_SEMIFINAL_BOTTOM_RIGHT }; static const struct TourneyTreeLineSection sLineSectionTrainer14Final[] = { - LINESECTION_ROUND1_TRAINER14(0x6025) - LINESECTION_ROUND2_MATCH7(0x6021) + LINESECTION_ROUND1_TRAINER14(LINE_CORNER_L) + LINESECTION_ROUND2_MATCH7(LINE_H) LINESECTION_SEMIFINAL_BOTTOM_RIGHT LINESECTION_FINAL_RIGHT }; static const struct TourneyTreeLineSection sLineSectionTrainer10Round1[] = { - LINESECTION_ROUND1_TRAINER10(0x6021) + LINESECTION_ROUND1_TRAINER10(LINE_H) }; static const struct TourneyTreeLineSection sLineSectionTrainer10Round2[] = { - LINESECTION_ROUND1_TRAINER10(0x6021) - LINESECTION_ROUND2_MATCH8(0x6021) + LINESECTION_ROUND1_TRAINER10(LINE_H) + LINESECTION_ROUND2_MATCH8(LINE_H) }; static const struct TourneyTreeLineSection sLineSectionTrainer10Semifinal[] = { - LINESECTION_ROUND1_TRAINER10(0x6021) - LINESECTION_ROUND2_MATCH8(0x6021) + LINESECTION_ROUND1_TRAINER10(LINE_H) + LINESECTION_ROUND2_MATCH8(LINE_H) LINESECTION_SEMIFINAL_BOTTOM_RIGHT }; static const struct TourneyTreeLineSection sLineSectionTrainer10Final[] = { - LINESECTION_ROUND1_TRAINER10(0x6021) - LINESECTION_ROUND2_MATCH8(0x6021) + LINESECTION_ROUND1_TRAINER10(LINE_H) + LINESECTION_ROUND2_MATCH8(LINE_H) LINESECTION_SEMIFINAL_BOTTOM_RIGHT LINESECTION_FINAL_RIGHT }; static const struct TourneyTreeLineSection sLineSectionTrainer2Round1[] = { - LINESECTION_ROUND1_TRAINER2(0x6021) + LINESECTION_ROUND1_TRAINER2(LINE_H) }; static const struct TourneyTreeLineSection sLineSectionTrainer2Round2[] = { - LINESECTION_ROUND1_TRAINER2(0x6021) - LINESECTION_ROUND2_MATCH8(0x6021) + LINESECTION_ROUND1_TRAINER2(LINE_H) + LINESECTION_ROUND2_MATCH8(LINE_H) }; static const struct TourneyTreeLineSection sLineSectionTrainer2Semifinal[] = { - LINESECTION_ROUND1_TRAINER2(0x6021) - LINESECTION_ROUND2_MATCH8(0x6021) + LINESECTION_ROUND1_TRAINER2(LINE_H) + LINESECTION_ROUND2_MATCH8(LINE_H) LINESECTION_SEMIFINAL_BOTTOM_RIGHT }; static const struct TourneyTreeLineSection sLineSectionTrainer2Final[] = { - LINESECTION_ROUND1_TRAINER2(0x6021) - LINESECTION_ROUND2_MATCH8(0x6021) + LINESECTION_ROUND1_TRAINER2(LINE_H) + LINESECTION_ROUND2_MATCH8(LINE_H) LINESECTION_SEMIFINAL_BOTTOM_RIGHT LINESECTION_FINAL_RIGHT }; @@ -2544,9 +2572,6 @@ static void BufferDomeOpponentName(void) static void InitDomeOpponentParty(void) { - gPlayerPartyLostHP = 0; - sPlayerPartyMaxHP = GetMonData(&gPlayerParty[0], MON_DATA_MAX_HP, NULL); - sPlayerPartyMaxHP += GetMonData(&gPlayerParty[1], MON_DATA_MAX_HP, NULL); CalculatePlayerPartyCount(); CreateDomeOpponentMons(TrainerIdToTournamentId(gTrainerBattleOpponent_A)); } @@ -2973,7 +2998,7 @@ static void SetDomeOpponentGraphicsId(void) static void SaveDomeChallenge(void) { gSaveBlock2Ptr->frontier.challengeStatus = gSpecialVar_0x8005; - VarSet(VAR_TEMP_0, 0); + VarSet(VAR_TEMP_CHALLENGE_STATUS, 0); gSaveBlock2Ptr->frontier.challengePaused = TRUE; SaveGameFrontier(); } @@ -4392,11 +4417,11 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId) { textPrinter.currentY = sSpeciesNameTextYCoords[i]; if (trainerId == TRAINER_PLAYER) - textPrinter.currentChar = gSpeciesNames[DOME_MONS[trainerTourneyId][i]]; + textPrinter.currentChar = GetSpeciesName(DOME_MONS[trainerTourneyId][i]); else if (trainerId == TRAINER_FRONTIER_BRAIN) - textPrinter.currentChar = gSpeciesNames[DOME_MONS[trainerTourneyId][i]]; + textPrinter.currentChar = GetSpeciesName(DOME_MONS[trainerTourneyId][i]); else - textPrinter.currentChar = gSpeciesNames[gFacilityTrainerMons[DOME_MONS[trainerTourneyId][i]].species]; + textPrinter.currentChar = GetSpeciesName(gFacilityTrainerMons[DOME_MONS[trainerTourneyId][i]].species); textPrinter.windowId = WIN_TRAINER_MON1_NAME + i + windowId; if (i == 1) @@ -5206,7 +5231,7 @@ static u16 GetWinningMove(int winnerTournamentId, int loserTournamentId, u8 roun u32 personality = 0; u32 targetSpecies = 0; u32 targetAbility = 0; - u32 typeMultiplier = 0; + uq4_12_t typeMultiplier = 0; do { personality = Random32(); @@ -5520,7 +5545,7 @@ static void DrawTourneyAdvancementLine(u8 tournamentId, u8 roundId) const struct TourneyTreeLineSection *lineSection = sTourneyTreeLineSections[tournamentId][roundId]; for (i = 0; i < sTourneyTreeLineSectionArrayCounts[tournamentId][roundId]; i++) - CopyToBgTilemapBufferRect_ChangePalette(1, &lineSection[i].src, lineSection[i].x, lineSection[i].y, 1, 1, 17); + CopyToBgTilemapBufferRect_ChangePalette(1, &lineSection[i].tile, lineSection[i].x, lineSection[i].y, 1, 1, 17); CopyBgTilemapBufferToVram(1); } diff --git a/src/battle_factory.c b/src/battle_factory.c index 667b6c606a15..5d7a199dc300 100644 --- a/src/battle_factory.c +++ b/src/battle_factory.c @@ -269,7 +269,7 @@ static void SetBattleFactoryData(void) static void SaveFactoryChallenge(void) { gSaveBlock2Ptr->frontier.challengeStatus = gSpecialVar_0x8005; - VarSet(VAR_TEMP_0, 0); + VarSet(VAR_TEMP_CHALLENGE_STATUS, 0); gSaveBlock2Ptr->frontier.challengePaused = TRUE; SaveGameFrontier(); } @@ -525,13 +525,13 @@ static void GenerateInitialRentalMons(void) gFacilityTrainers = gBattleFrontierTrainers; for (i = 0; i < PARTY_SIZE; i++) { - species[i] = 0; + species[i] = SPECIES_NONE; monIds[i] = 0; - heldItems[i] = 0; + heldItems[i] = ITEM_NONE; } lvlMode = gSaveBlock2Ptr->frontier.lvlMode; battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); - challengeNum = gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] / 7; + challengeNum = gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] / FRONTIER_STAGES_PER_CHALLENGE; if (VarGet(VAR_FRONTIER_BATTLE_MODE) == FRONTIER_MODE_DOUBLES) factoryBattleMode = FRONTIER_MODE_DOUBLES; else @@ -582,7 +582,7 @@ static void GenerateInitialRentalMons(void) // Cannot have two same held items. for (j = firstMonId; j < firstMonId + i; j++) { - if (heldItems[j] != 0 && heldItems[j] == gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]) + if (heldItems[j] != ITEM_NONE && heldItems[j] == gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]) { if (gFacilityTrainerMons[monId].species == currSpecies) currSpecies = SPECIES_NONE; @@ -761,7 +761,7 @@ void FillFactoryBrainParty(void) u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); - u8 challengeNum = gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] / 7; + u8 challengeNum = gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] / FRONTIER_STAGES_PER_CHALLENGE; fixedIV = GetFactoryMonFixedIV(challengeNum + 2, FALSE); monLevel = SetFacilityPtrsGetLevel(); i = 0; @@ -890,7 +890,7 @@ u32 GetAiScriptsInBattleFactory(void) else { int battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); - int challengeNum = gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] / 7; + int challengeNum = gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] / FRONTIER_STAGES_PER_CHALLENGE; if (gTrainerBattleOpponent_A == TRAINER_FRONTIER_BRAIN) return AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY; diff --git a/src/battle_factory_screen.c b/src/battle_factory_screen.c index 83075a4ce7fb..8cba2bceef6a 100644 --- a/src/battle_factory_screen.c +++ b/src/battle_factory_screen.c @@ -28,6 +28,7 @@ #include "strings.h" #include "graphics.h" #include "constants/battle_frontier.h" +#include "constants/battle_tent.h" #include "constants/songs.h" #include "constants/rgb.h" @@ -43,6 +44,9 @@ #define SELECTABLE_MONS_COUNT 6 +#define PALNUM_FADE_TEXT 14 +#define PALNUM_TEXT 15 + enum { PALTAG_BALL_GRAY = 100, PALTAG_BALL_SELECTED, @@ -350,7 +354,7 @@ static const struct WindowTemplate sSelect_WindowTemplates[] = .tilemapTop = 2, .width = 12, .height = 2, - .paletteNum = 15, + .paletteNum = PALNUM_TEXT, .baseBlock = 0x0001, }, [SELECT_WIN_SPECIES] = { @@ -359,7 +363,7 @@ static const struct WindowTemplate sSelect_WindowTemplates[] = .tilemapTop = 2, .width = 11, .height = 2, - .paletteNum = 14, + .paletteNum = PALNUM_FADE_TEXT, .baseBlock = 0x0019, }, [SELECT_WIN_INFO] = { @@ -368,7 +372,7 @@ static const struct WindowTemplate sSelect_WindowTemplates[] = .tilemapTop = 15, .width = 20, .height = 3, - .paletteNum = 15, + .paletteNum = PALNUM_TEXT, .baseBlock = 0x002f, }, [SELECT_WIN_OPTIONS] = { @@ -377,7 +381,7 @@ static const struct WindowTemplate sSelect_WindowTemplates[] = .tilemapTop = 14, .width = 8, .height = 6, - .paletteNum = 15, + .paletteNum = PALNUM_TEXT, .baseBlock = 0x006b, }, [SELECT_WIN_YES_NO] = { @@ -386,7 +390,7 @@ static const struct WindowTemplate sSelect_WindowTemplates[] = .tilemapTop = 14, .width = 8, .height = 4, - .paletteNum = 15, + .paletteNum = PALNUM_TEXT, .baseBlock = 0x009b, }, [SELECT_WIN_MON_CATEGORY] = { @@ -395,7 +399,7 @@ static const struct WindowTemplate sSelect_WindowTemplates[] = .tilemapTop = 0, .width = 15, .height = 2, - .paletteNum = 15, + .paletteNum = PALNUM_TEXT, .baseBlock = 0x00bb, }, DUMMY_WIN_TEMPLATE, @@ -634,7 +638,11 @@ static const struct SpriteSheet sSwap_SpriteSheets[] = {sMenuHighlightRight_Gfx, sizeof(sMenuHighlightRight_Gfx), GFXTAG_MENU_HIGHLIGHT_RIGHT}, {sActionBoxLeft_Gfx, sizeof(sActionBoxLeft_Gfx), GFXTAG_ACTION_BOX_LEFT}, {sActionBoxRight_Gfx, sizeof(sActionBoxRight_Gfx), GFXTAG_ACTION_BOX_RIGHT}, - {sActionHighlightLeft_Gfx, 0x100, GFXTAG_ACTION_HIGHLIGHT_LEFT}, +#ifdef BUGFIX + {sActionHighlightLeft_Gfx, sizeof(sActionHighlightLeft_Gfx), GFXTAG_ACTION_HIGHLIGHT_LEFT}, +#else + {sActionHighlightLeft_Gfx, 8 * TILE_SIZE_4BPP, /* Incorrect size */ GFXTAG_ACTION_HIGHLIGHT_LEFT}, +#endif {sActionHighlightMiddle_Gfx, sizeof(sActionHighlightMiddle_Gfx), GFXTAG_ACTION_HIGHLIGHT_MIDDLE}, {sActionHighlightRight_Gfx, sizeof(sActionHighlightRight_Gfx), GFXTAG_ACTION_HIGHLIGHT_RIGHT}, {sMonPicBgAnim_Gfx, sizeof(sMonPicBgAnim_Gfx), GFXTAG_MON_PIC_BG_ANIM}, @@ -945,7 +953,7 @@ static const struct WindowTemplate sSwap_WindowTemplates[] = .tilemapTop = 2, .width = 12, .height = 2, - .paletteNum = 15, + .paletteNum = PALNUM_TEXT, .baseBlock = 0x0001, }, [SWAP_WIN_SPECIES] = { @@ -954,7 +962,7 @@ static const struct WindowTemplate sSwap_WindowTemplates[] = .tilemapTop = 2, .width = 11, .height = 2, - .paletteNum = 14, + .paletteNum = PALNUM_FADE_TEXT, .baseBlock = 0x0019, }, [SWAP_WIN_INFO] = { @@ -963,7 +971,7 @@ static const struct WindowTemplate sSwap_WindowTemplates[] = .tilemapTop = 15, .width = 20, .height = 3, - .paletteNum = 15, + .paletteNum = PALNUM_TEXT, .baseBlock = 0x002f, }, [SWAP_WIN_OPTIONS] = { @@ -972,7 +980,7 @@ static const struct WindowTemplate sSwap_WindowTemplates[] = .tilemapTop = 14, .width = 9, .height = 6, - .paletteNum = 15, + .paletteNum = PALNUM_TEXT, .baseBlock = 0x006b, }, [SWAP_WIN_YES_NO] = { @@ -981,7 +989,7 @@ static const struct WindowTemplate sSwap_WindowTemplates[] = .tilemapTop = 14, .width = 8, .height = 4, - .paletteNum = 15, + .paletteNum = PALNUM_TEXT, .baseBlock = 0x00a1, }, [SWAP_WIN_ACTION_FADE] = { @@ -990,7 +998,7 @@ static const struct WindowTemplate sSwap_WindowTemplates[] = .tilemapTop = 15, .width = 9, .height = 5, - .paletteNum = 14, + .paletteNum = PALNUM_FADE_TEXT, .baseBlock = 0x006b, }, [SWAP_WIN_UNUSED] = { @@ -999,7 +1007,7 @@ static const struct WindowTemplate sSwap_WindowTemplates[] = .tilemapTop = 2, .width = 4, .height = 2, - .paletteNum = 14, + .paletteNum = PALNUM_FADE_TEXT, .baseBlock = 0x00c1, }, [SWAP_WIN_SPECIES_AT_FADE] = { @@ -1008,7 +1016,7 @@ static const struct WindowTemplate sSwap_WindowTemplates[] = .tilemapTop = 2, .width = 11, .height = 2, - .paletteNum = 15, + .paletteNum = PALNUM_TEXT, .baseBlock = 0x00c9, }, [SWAP_WIN_MON_CATEGORY] = { @@ -1017,7 +1025,7 @@ static const struct WindowTemplate sSwap_WindowTemplates[] = .tilemapTop = 0, .width = 15, .height = 2, - .paletteNum = 15, + .paletteNum = PALNUM_TEXT, .baseBlock = 0x00df, }, DUMMY_WIN_TEMPLATE, @@ -1142,8 +1150,12 @@ static void CB2_InitSelectScreen(void) gMain.state++; break; case 1: - sSelectMenuTilesetBuffer = Alloc(0x440); - sSelectMonPicBgTilesetBuffer = AllocZeroed(0x440); + sSelectMenuTilesetBuffer = Alloc(sizeof(gFrontierFactoryMenu_Gfx)); +#ifdef BUGFIX + sSelectMonPicBgTilesetBuffer = AllocZeroed(sizeof(sMonPicBg_Gfx)); +#else + sSelectMonPicBgTilesetBuffer = AllocZeroed(sizeof(gFrontierFactoryMenu_Gfx)); // Incorrect size +#endif sSelectMenuTilemapBuffer = Alloc(BG_SCREEN_SIZE); sSelectMonPicBgTilemapBuffer = AllocZeroed(BG_SCREEN_SIZE); ChangeBgX(0, 0, BG_COORD_SET); @@ -1169,21 +1181,21 @@ static void CB2_InitSelectScreen(void) ResetSpriteData(); ResetTasks(); FreeAllSpritePalettes(); - CpuCopy16(gFrontierFactorySelectMenu_Gfx, sSelectMenuTilesetBuffer, 0x440); - CpuCopy16(sMonPicBg_Gfx, sSelectMonPicBgTilesetBuffer, 0x60); - LoadBgTiles(1, sSelectMenuTilesetBuffer, 0x440, 0); - LoadBgTiles(3, sSelectMonPicBgTilesetBuffer, 0x60, 0); - CpuCopy16(gFrontierFactorySelectMenu_Tilemap, sSelectMenuTilemapBuffer, BG_SCREEN_SIZE); + CpuCopy16(gFrontierFactoryMenu_Gfx, sSelectMenuTilesetBuffer, sizeof(gFrontierFactoryMenu_Gfx)); + CpuCopy16(sMonPicBg_Gfx, sSelectMonPicBgTilesetBuffer, sizeof(sMonPicBg_Gfx)); + LoadBgTiles(1, sSelectMenuTilesetBuffer, sizeof(gFrontierFactoryMenu_Gfx), 0); + LoadBgTiles(3, sSelectMonPicBgTilesetBuffer, sizeof(sMonPicBg_Gfx), 0); + CpuCopy16(gFrontierFactoryMenu_Tilemap, sSelectMenuTilemapBuffer, BG_SCREEN_SIZE); LoadBgTilemap(1, sSelectMenuTilemapBuffer, BG_SCREEN_SIZE, 0); - LoadPalette(gFrontierFactorySelectMenu_Pal, 0, 2 * PLTT_SIZE_4BPP); - LoadPalette(sSelectText_Pal, BG_PLTT_ID(15), PLTT_SIZEOF(4)); - LoadPalette(sSelectText_Pal, BG_PLTT_ID(14), PLTT_SIZEOF(5)); + LoadPalette(gFrontierFactoryMenu_Pal, 0, 2 * PLTT_SIZE_4BPP); + LoadPalette(sSelectText_Pal, BG_PLTT_ID(PALNUM_TEXT), PLTT_SIZEOF(4)); + LoadPalette(sSelectText_Pal, BG_PLTT_ID(PALNUM_FADE_TEXT), PLTT_SIZEOF(5)); #ifdef UBFIX if (sFactorySelectScreen && sFactorySelectScreen->fromSummaryScreen) #else if (sFactorySelectScreen->fromSummaryScreen == TRUE) #endif - gPlttBufferUnfaded[BG_PLTT_ID(14) + 4] = sFactorySelectScreen->speciesNameColorBackup; + gPlttBufferUnfaded[BG_PLTT_ID(PALNUM_FADE_TEXT) + 4] = sFactorySelectScreen->speciesNameColorBackup; LoadPalette(sMonPicBg_Pal, BG_PLTT_ID(2), PLTT_SIZEOF(2)); gMain.state++; break; @@ -1449,7 +1461,7 @@ static void Select_Task_OpenSummaryScreen(u8 taskId) switch (gTasks[taskId].tState) { case STATE_SUMMARY_FADE: - gPlttBufferUnfaded[BG_PLTT_ID(14) + 4] = gPlttBufferFaded[BG_PLTT_ID(14) + 4]; + gPlttBufferUnfaded[BG_PLTT_ID(PALNUM_FADE_TEXT) + 4] = gPlttBufferFaded[BG_PLTT_ID(PALNUM_FADE_TEXT) + 4]; BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gTasks[taskId].tState = STATE_SUMMARY_CLEAN; break; @@ -1468,7 +1480,7 @@ static void Select_Task_OpenSummaryScreen(u8 taskId) } break; case STATE_SUMMARY_SHOW: - sFactorySelectScreen->speciesNameColorBackup = gPlttBufferUnfaded[BG_PLTT_ID(14) + 4]; + sFactorySelectScreen->speciesNameColorBackup = gPlttBufferUnfaded[BG_PLTT_ID(PALNUM_FADE_TEXT) + 4]; DestroyTask(taskId); sFactorySelectScreen->fromSummaryScreen = TRUE; currMonId = sFactorySelectScreen->cursorPos; @@ -1641,8 +1653,8 @@ static void Select_Task_HandleMenu(u8 taskId) { if (sFactorySelectScreen->fromSummaryScreen == TRUE) { - gPlttBufferFaded[BG_PLTT_ID(14) + 4] = sFactorySelectScreen->speciesNameColorBackup; - gPlttBufferUnfaded[BG_PLTT_ID(14) + 4] = gPlttBufferUnfaded[BG_PLTT_ID(15) + 4]; + gPlttBufferFaded[BG_PLTT_ID(PALNUM_FADE_TEXT) + 4] = sFactorySelectScreen->speciesNameColorBackup; + gPlttBufferUnfaded[BG_PLTT_ID(PALNUM_FADE_TEXT) + 4] = gPlttBufferUnfaded[BG_PLTT_ID(PALNUM_TEXT) + 4]; } sFactorySelectScreen->fromSummaryScreen = FALSE; gTasks[taskId].tState = STATE_MENU_HANDLE_INPUT; @@ -1735,9 +1747,9 @@ static void CreateFrontierFactorySelectableMons(u8 firstMonId) gFacilityTrainerMons = gBattleFrontierMons; if (gSaveBlock2Ptr->frontier.lvlMode != FRONTIER_LVL_50) - level = 100; + level = FRONTIER_MAX_LEVEL_OPEN; else - level = 50; + level = FRONTIER_MAX_LEVEL_50; rentalRank = GetNumPastRentalsRank(battleMode, lvlMode); otId = T1_READ_32(gSaveBlock2Ptr->playerTrainerId); @@ -1769,7 +1781,7 @@ static void CreateSlateportTentSelectableMons(u8 firstMonId) { u8 i, j; u8 ivs = 0; - u8 level = 30; + u8 level = TENT_MIN_LEVEL; u8 friendship = 0; u32 otId = 0; @@ -1872,7 +1884,7 @@ static void Select_PrintMonSpecies(void) FillWindowPixelBuffer(SELECT_WIN_SPECIES, PIXEL_FILL(0)); species = GetMonData(&sFactorySelectScreen->mons[monId].monData, MON_DATA_SPECIES, NULL); - StringCopy(gStringVar4, gSpeciesNames[species]); + StringCopy(gStringVar4, GetSpeciesName(species)); x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 86); AddTextPrinterParameterized3(SELECT_WIN_SPECIES, FONT_NORMAL, x, 1, sSpeciesNameTextColors, 0, gStringVar4); CopyWindowToVram(SELECT_WIN_SPECIES, COPYWIN_GFX); @@ -1993,7 +2005,7 @@ static void Select_PrintMonCategory(void) FillWindowPixelBuffer(SELECT_WIN_MON_CATEGORY, PIXEL_FILL(0)); species = GetMonData(&sFactorySelectScreen->mons[monId].monData, MON_DATA_SPECIES, NULL); CopyMonCategoryText(SpeciesToNationalPokedexNum(species), text); - x = GetStringRightAlignXOffset(FONT_NORMAL, text, 0x76); + x = GetStringRightAlignXOffset(FONT_NORMAL, text, 118); AddTextPrinterParameterized(SELECT_WIN_MON_CATEGORY, FONT_NORMAL, text, x, 1, 0, NULL); CopyWindowToVram(SELECT_WIN_MON_CATEGORY, COPYWIN_GFX); } @@ -2290,7 +2302,7 @@ static void Select_Task_FadeSpeciesName(u8 taskId) else sFactorySelectScreen->fadeSpeciesNameCoeff++; } - BlendPalettes(0x4000, sFactorySelectScreen->fadeSpeciesNameCoeff, 0); + BlendPalettes(1 << PALNUM_FADE_TEXT, sFactorySelectScreen->fadeSpeciesNameCoeff, 0); if (sFactorySelectScreen->fadeSpeciesNameCoeff > 5) { sFactorySelectScreen->fadeSpeciesNameFadeOut = FALSE; @@ -2388,7 +2400,7 @@ static void Swap_Task_OpenSummaryScreen(u8 taskId) case STATE_SUMMARY_SHOW: DestroyTask(taskId); sFactorySwapScreen->fromSummaryScreen = TRUE; - sFactorySwapScreen->speciesNameColorBackup = gPlttBufferUnfaded[BG_PLTT_ID(15) + 4]; + sFactorySwapScreen->speciesNameColorBackup = gPlttBufferUnfaded[BG_PLTT_ID(PALNUM_TEXT) + 4]; ShowPokemonSummaryScreen(SUMMARY_MODE_NORMAL, gPlayerParty, sFactorySwapScreen->cursorPos, FRONTIER_PARTY_SIZE - 1, CB2_InitSwapScreen); break; } @@ -2709,7 +2721,7 @@ static void Swap_Task_FadeSpeciesName(u8 taskId) else sFactorySwapScreen->fadeSpeciesNameCoeff++; } - BlendPalettes(0x4000, sFactorySwapScreen->fadeSpeciesNameCoeff, 0); + BlendPalettes(1 << PALNUM_FADE_TEXT, sFactorySwapScreen->fadeSpeciesNameCoeff, 0); if (sFactorySwapScreen->fadeSpeciesNameCoeff > 5) { sFactorySwapScreen->fadeSpeciesNameFadeOut = FALSE; @@ -2748,7 +2760,7 @@ static void Swap_Task_FadeOutSpeciesName(u8 taskId) gTasks[taskId].tState++; break; case 1: - LoadPalette(&gPlttBufferUnfaded[BG_PLTT_ID(15)], BG_PLTT_ID(14), PLTT_SIZEOF(5)); + LoadPalette(&gPlttBufferUnfaded[BG_PLTT_ID(PALNUM_TEXT)], BG_PLTT_ID(PALNUM_FADE_TEXT), PLTT_SIZEOF(5)); gTasks[taskId].tState++; break; case 2: @@ -2761,10 +2773,10 @@ static void Swap_Task_FadeOutSpeciesName(u8 taskId) if (sFactorySwapScreen->fadeSpeciesNameCoeffDelay > 3) { sFactorySwapScreen->fadeSpeciesNameCoeffDelay = 0; - gPlttBufferUnfaded[BG_PLTT_ID(15) + 4] = gPlttBufferFaded[BG_PLTT_ID(14) + 4]; + gPlttBufferUnfaded[BG_PLTT_ID(PALNUM_TEXT) + 4] = gPlttBufferFaded[BG_PLTT_ID(PALNUM_FADE_TEXT) + 4]; sFactorySwapScreen->fadeSpeciesNameCoeff++; } - BlendPalettes(0x4000, sFactorySwapScreen->fadeSpeciesNameCoeff, 0); + BlendPalettes(1 << PALNUM_FADE_TEXT, sFactorySwapScreen->fadeSpeciesNameCoeff, 0); break; } } @@ -2994,7 +3006,7 @@ static void Swap_Task_ScreenInfoTransitionOut(u8 taskId) switch (gTasks[taskId].tState) { case 0: - LoadPalette(sSwapText_Pal, BG_PLTT_ID(14), sizeof(sSwapText_Pal)); + LoadPalette(sSwapText_Pal, BG_PLTT_ID(PALNUM_FADE_TEXT), sizeof(sSwapText_Pal)); Swap_PrintActionStrings(); PutWindowTilemap(SWAP_WIN_ACTION_FADE); gTasks[taskId].tState++; @@ -3004,7 +3016,7 @@ static void Swap_Task_ScreenInfoTransitionOut(u8 taskId) gTasks[taskId].tState++; break; case 2: - BeginNormalPaletteFade(0x4000, 0, 0, 16, sPokeballGray_Pal[37]); + BeginNormalPaletteFade(1 << PALNUM_FADE_TEXT, 0, 0, 16, sPokeballGray_Pal[37]); gTasks[taskId].tState++; break; case 3: @@ -3125,14 +3137,14 @@ static void Swap_Task_ScreenInfoTransitionIn(u8 taskId) if (gTasks[taskId].tSlideFinishedPkmn == TRUE && gTasks[taskId].tSlideFinishedCancel == TRUE) { - gPlttBufferFaded[BG_PLTT_ID(14) + 2] = sPokeballGray_Pal[37]; + gPlttBufferFaded[BG_PLTT_ID(PALNUM_FADE_TEXT) + 2] = sPokeballGray_Pal[37]; Swap_PrintActionStrings(); PutWindowTilemap(SWAP_WIN_ACTION_FADE); gTasks[taskId].tState++; } break; case 3: - BeginNormalPaletteFade(0x4000, 0, 16, 0, sPokeballGray_Pal[37]); + BeginNormalPaletteFade(1 << PALNUM_FADE_TEXT, 0, 16, 0, sPokeballGray_Pal[37]); gTasks[taskId].tState++; break; case 4: @@ -3275,8 +3287,12 @@ static void CB2_InitSwapScreen(void) gMain.state++; break; case 1: - sSwapMenuTilesetBuffer = Alloc(0x440); - sSwapMonPicBgTilesetBuffer = AllocZeroed(0x440); + sSwapMenuTilesetBuffer = Alloc(sizeof(gFrontierFactoryMenu_Gfx)); +#ifdef BUGFIX + sSwapMonPicBgTilesetBuffer = AllocZeroed(sizeof(sMonPicBg_Gfx)); +#else + sSwapMonPicBgTilesetBuffer = AllocZeroed(sizeof(gFrontierFactoryMenu_Gfx)); // Incorrect size +#endif sSwapMenuTilemapBuffer = Alloc(BG_SCREEN_SIZE); sSwapMonPicBgTilemapBuffer = AllocZeroed(BG_SCREEN_SIZE); ChangeBgX(0, 0, BG_COORD_SET); @@ -3303,15 +3319,15 @@ static void CB2_InitSwapScreen(void) ResetTasks(); FreeAllSpritePalettes(); ResetAllPicSprites(); - CpuCopy16(gFrontierFactorySelectMenu_Gfx, sSwapMenuTilesetBuffer, 0x440); - CpuCopy16(sMonPicBg_Gfx, sSwapMonPicBgTilesetBuffer, 0x60); - LoadBgTiles(1, sSwapMenuTilesetBuffer, 0x440, 0); - LoadBgTiles(3, sSwapMonPicBgTilesetBuffer, 0x60, 0); - CpuCopy16(gFrontierFactorySelectMenu_Tilemap, sSwapMenuTilemapBuffer, BG_SCREEN_SIZE); + CpuCopy16(gFrontierFactoryMenu_Gfx, sSwapMenuTilesetBuffer, sizeof(gFrontierFactoryMenu_Gfx)); + CpuCopy16(sMonPicBg_Gfx, sSwapMonPicBgTilesetBuffer, sizeof(sMonPicBg_Gfx)); + LoadBgTiles(1, sSwapMenuTilesetBuffer, sizeof(gFrontierFactoryMenu_Gfx), 0); + LoadBgTiles(3, sSwapMonPicBgTilesetBuffer, sizeof(sMonPicBg_Gfx), 0); + CpuCopy16(gFrontierFactoryMenu_Tilemap, sSwapMenuTilemapBuffer, BG_SCREEN_SIZE); LoadBgTilemap(1, sSwapMenuTilemapBuffer, BG_SCREEN_SIZE, 0); - LoadPalette(gFrontierFactorySelectMenu_Pal, 0, 2 * PLTT_SIZE_4BPP); - LoadPalette(sSwapText_Pal, BG_PLTT_ID(15), sizeof(sSwapText_Pal)); - LoadPalette(sSwapText_Pal, BG_PLTT_ID(14), sizeof(sSwapText_Pal)); + LoadPalette(gFrontierFactoryMenu_Pal, 0, 2 * PLTT_SIZE_4BPP); + LoadPalette(sSwapText_Pal, BG_PLTT_ID(PALNUM_TEXT), sizeof(sSwapText_Pal)); + LoadPalette(sSwapText_Pal, BG_PLTT_ID(PALNUM_FADE_TEXT), sizeof(sSwapText_Pal)); LoadPalette(sMonPicBg_Pal, BG_PLTT_ID(2), PLTT_SIZEOF(2)); gMain.state++; break; @@ -3773,7 +3789,7 @@ static void Swap_PrintMonSpecies(void) species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, NULL); else species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, NULL); - StringCopy(gStringVar4, gSpeciesNames[species]); + StringCopy(gStringVar4, GetSpeciesName(species)); x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 86); AddTextPrinterParameterized3(SWAP_WIN_SPECIES, FONT_NORMAL, x, 1, sSwapSpeciesNameTextColors, 0, gStringVar4); CopyWindowToVram(SWAP_WIN_SPECIES, COPYWIN_FULL); @@ -3808,7 +3824,7 @@ static void Swap_PrintYesNoOptions(void) static void Swap_PrintActionString(const u8 *str, u32 y, u32 windowId) { - s32 x = GetStringRightAlignXOffset(FONT_SMALL, str, 0x46); + s32 x = GetStringRightAlignXOffset(FONT_SMALL, str, 70); AddTextPrinterParameterized3(windowId, FONT_SMALL, x, y, sSwapMenuOptionsTextColors, 0, str); } @@ -3864,10 +3880,10 @@ static void Swap_PrintMonSpeciesAtFade(void) CpuCopy16(sSwapText_Pal, pal, 8); if (!sFactorySwapScreen->fromSummaryScreen) - pal[4] = gPlttBufferFaded[BG_PLTT_ID(14) + 4]; + pal[4] = gPlttBufferFaded[BG_PLTT_ID(PALNUM_FADE_TEXT) + 4]; else pal[4] = sFactorySwapScreen->speciesNameColorBackup; - LoadPalette(pal, BG_PLTT_ID(15), sizeof(sSwapText_Pal)); + LoadPalette(pal, BG_PLTT_ID(PALNUM_TEXT), sizeof(sSwapText_Pal)); PutWindowTilemap(SWAP_WIN_SPECIES_AT_FADE); FillWindowPixelBuffer(SWAP_WIN_SPECIES_AT_FADE, PIXEL_FILL(0)); @@ -3882,7 +3898,7 @@ static void Swap_PrintMonSpeciesAtFade(void) species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, NULL); else species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, NULL); - StringCopy(gStringVar4, gSpeciesNames[species]); + StringCopy(gStringVar4, GetSpeciesName(species)); x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 86); AddTextPrinterParameterized3(SWAP_WIN_SPECIES_AT_FADE, FONT_NORMAL, x, 1, sSwapSpeciesNameTextColors, 0, gStringVar4); CopyWindowToVram(SWAP_WIN_SPECIES_AT_FADE, COPYWIN_FULL); @@ -3895,8 +3911,8 @@ static void Swap_PrintMonSpeciesForTransition(void) u16 species; u8 x; - LoadPalette(sSwapText_Pal, BG_PLTT_ID(14), sizeof(sSwapText_Pal)); - CpuCopy16(&gPlttBufferUnfaded[BG_PLTT_ID(15)], &gPlttBufferFaded[BG_PLTT_ID(14)], PLTT_SIZEOF(5)); + LoadPalette(sSwapText_Pal, BG_PLTT_ID(PALNUM_FADE_TEXT), sizeof(sSwapText_Pal)); + CpuCopy16(&gPlttBufferUnfaded[BG_PLTT_ID(PALNUM_TEXT)], &gPlttBufferFaded[BG_PLTT_ID(PALNUM_FADE_TEXT)], PLTT_SIZEOF(5)); if (sFactorySwapScreen->cursorPos >= FRONTIER_PARTY_SIZE) { @@ -3909,7 +3925,7 @@ static void Swap_PrintMonSpeciesForTransition(void) species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, NULL); else species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, NULL); - StringCopy(gStringVar4, gSpeciesNames[species]); + StringCopy(gStringVar4, GetSpeciesName(species)); x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 86); AddTextPrinterParameterized3(SWAP_WIN_SPECIES, FONT_NORMAL, x, 1, sSwapSpeciesNameTextColors, 0, gStringVar4); CopyWindowToVram(SWAP_WIN_SPECIES, COPYWIN_FULL); @@ -3936,7 +3952,7 @@ static void Swap_PrintMonCategory(void) else species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, NULL); CopyMonCategoryText(SpeciesToNationalPokedexNum(species), text); - x = GetStringRightAlignXOffset(FONT_NORMAL, text, 0x76); + x = GetStringRightAlignXOffset(FONT_NORMAL, text, 118); AddTextPrinterParameterized(SWAP_WIN_MON_CATEGORY, FONT_NORMAL, text, x, 1, 0, NULL); CopyWindowToVram(SWAP_WIN_MON_CATEGORY, COPYWIN_GFX); } diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index 06fc26f740f4..3e48a014760a 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -31,8 +31,8 @@ extern const struct CompressedSpriteSheet gSpriteSheet_EnemyShadow; extern const struct SpriteTemplate gSpriteTemplate_EnemyShadow; // this file's functions -static u8 GetBattlePalaceMoveGroup(u8 battlerId, u16 move); -static u16 GetBattlePalaceTarget(void); +static u8 GetBattlePalaceMoveGroup(u8 battler, u16 move); +static u16 GetBattlePalaceTarget(u32 battler); static void SpriteCB_TrainerSlideVertical(struct Sprite *sprite); static bool8 ShouldAnimBeDoneRegardlessOfSubstitute(u8 animId); static void Task_ClearBitWhenBattleTableAnimDone(u8 taskId); @@ -104,12 +104,12 @@ void FreeBattleSpritesData(void) } // Pokemon chooses move to use in Battle Palace rather than player -u16 ChooseMoveAndTargetInBattlePalace(void) +u16 ChooseMoveAndTargetInBattlePalace(u32 battler) { s32 i, var1, var2; s32 chosenMoveId = -1; - struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[gActiveBattler][4]); - u8 unusableMovesBits = CheckMoveLimitations(gActiveBattler, 0, MOVE_LIMITATIONS_ALL); + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]); + u8 unusableMovesBits = CheckMoveLimitations(battler, 0, MOVE_LIMITATIONS_ALL); s32 percent = Random() % 100; // Heavy variable re-use here makes this hard to read without defines @@ -119,13 +119,13 @@ u16 ChooseMoveAndTargetInBattlePalace(void) #define selectedGroup percent #define selectedMoves var2 #define moveTarget var1 - #define validMoveFlags var1 - #define numValidMoveGroups var2 - #define validMoveGroup var2 + #define numMovesPerGroup var1 + #define numMultipleMoveGroups var2 + #define randSelectGroup var2 // If battler is < 50% HP and not asleep, use second set of move group likelihoods // otherwise use first set - i = (gBattleStruct->palaceFlags & gBitTable[gActiveBattler]) ? 2 : 0; + i = (gBattleStruct->palaceFlags & gBitTable[battler]) ? 2 : 0; minGroupNum = i; maxGroupNum = i + 2; // + 2 because there are two percentages per set of likelihoods @@ -136,7 +136,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void) // Otherwise use move from "Support" group for (; i < maxGroupNum; i++) { - if (gBattlePalaceNatureToMoveGroupLikelihood[GetNatureFromPersonality(gBattleMons[gActiveBattler].personality)][i] > percent) + if (gBattlePalaceNatureToMoveGroupLikelihood[GetNatureFromPersonality(gBattleMons[battler].personality)][i] > percent) break; } selectedGroup = i - minGroupNum; @@ -148,17 +148,18 @@ u16 ChooseMoveAndTargetInBattlePalace(void) { if (moveInfo->moves[i] == MOVE_NONE) break; - if (selectedGroup == GetBattlePalaceMoveGroup(gActiveBattler, moveInfo->moves[i]) && moveInfo->currentPp[i] != 0) + if (selectedGroup == GetBattlePalaceMoveGroup(battler, moveInfo->moves[i]) && moveInfo->currentPp[i] != 0) selectedMoves |= gBitTable[i]; } // Pass selected moves to AI, pick one if (selectedMoves != 0) { - gBattleStruct->palaceFlags &= 0xF; - gBattleStruct->palaceFlags |= (selectedMoves << 4); - sBattler_AI = gActiveBattler; - BattleAI_SetupAIData(selectedMoves); + // Lower 4 bits of palaceFlags are flags for each battler. + // Clear the rest of palaceFlags, then set the selected moves in the upper 4 bits. + gBattleStruct->palaceFlags &= (1 << MAX_BATTLERS_COUNT) - 1; + gBattleStruct->palaceFlags |= (selectedMoves << MAX_BATTLERS_COUNT); + BattleAI_SetupAIData(selectedMoves, battler); chosenMoveId = BattleAI_ChooseMoveOrAction(); } @@ -168,34 +169,47 @@ u16 ChooseMoveAndTargetInBattlePalace(void) if (chosenMoveId == -1 || chosenMoveId >= MAX_MON_MOVES) { chosenMoveId = -1; - if (unusableMovesBits != 0xF) + if (unusableMovesBits != ALL_MOVES_MASK) { - validMoveFlags = 0, numValidMoveGroups = 0; + numMovesPerGroup = 0, numMultipleMoveGroups = 0; for (i = 0; i < MAX_MON_MOVES; i++) { - // validMoveFlags is used here as a bitfield for which moves can be used for each move group type - // first 4 bits are for attack (1 for each move), then 4 bits for defense, and 4 for support - if (GetBattlePalaceMoveGroup(gActiveBattler, moveInfo->moves[i]) == PALACE_MOVE_GROUP_ATTACK && !(gBitTable[i] & unusableMovesBits)) - validMoveFlags += (1 << 0); - if (GetBattlePalaceMoveGroup(gActiveBattler, moveInfo->moves[i]) == PALACE_MOVE_GROUP_DEFENSE && !(gBitTable[i] & unusableMovesBits)) - validMoveFlags += (1 << 4); - if (GetBattlePalaceMoveGroup(gActiveBattler, moveInfo->moves[i]) == PALACE_MOVE_GROUP_SUPPORT && !(gBitTable[i] & unusableMovesBits)) - validMoveFlags += (1 << 8); + // Count the number of usable moves the battler has in each move group. + // The totals will be stored separately in 3 groups of 4 bits each in numMovesPerGroup. + if (GetBattlePalaceMoveGroup(battler, moveInfo->moves[i]) == PALACE_MOVE_GROUP_ATTACK && !(gBitTable[i] & unusableMovesBits)) + numMovesPerGroup += (1 << 0); + if (GetBattlePalaceMoveGroup(battler, moveInfo->moves[i]) == PALACE_MOVE_GROUP_DEFENSE && !(gBitTable[i] & unusableMovesBits)) + numMovesPerGroup += (1 << 4); + if (GetBattlePalaceMoveGroup(battler, moveInfo->moves[i]) == PALACE_MOVE_GROUP_SUPPORT && !(gBitTable[i] & unusableMovesBits)) + numMovesPerGroup += (1 << 8); } - // Count the move groups the pokemon has - if ((validMoveFlags & 0xF) > 1) - numValidMoveGroups++; - if ((validMoveFlags & 0xF0) > 0x1F) - numValidMoveGroups++; - if ((validMoveFlags & 0xF0) > 0x1FF) - numValidMoveGroups++; - - - // If more than 1 possible move group, or no possible move groups - // then choose move randomly - if (numValidMoveGroups > 1 || numValidMoveGroups == 0) + // Count the number of move groups for which the battler has at least 2 usable moves. + // This is a roundabout way to determine if there is a move group that should be + // preferred, because it has multiple move options and the others do not. + // The condition intended to check the total for the Support group is accidentally + // checking the Defense total, and is never true. As a result the preferences for + // random move selection here will skew away from the Support move group. + if ((numMovesPerGroup & 0xF) >= 2) + numMultipleMoveGroups++; + if ((numMovesPerGroup & (0xF << 4)) >= (2 << 4)) + numMultipleMoveGroups++; +#ifdef BUGFIX + if ((numMovesPerGroup & (0xF << 8)) >= (2 << 8)) +#else + if ((numMovesPerGroup & (0xF << 4)) >= (2 << 8)) +#endif + numMultipleMoveGroups++; + + + // By this point we already know the battler only has usable moves from at most 2 of the 3 move groups, + // because they had no usable moves from the move group that was selected based on Nature. + // + // The below condition is effectively 'numMultipleMoveGroups != 1'. + // There is no stand-out group with multiple moves to choose from, so we pick randomly. + // Note that because of the bug above the battler may actually have any number of Support moves. + if (numMultipleMoveGroups > 1 || numMultipleMoveGroups == 0) { do { @@ -204,35 +218,45 @@ u16 ChooseMoveAndTargetInBattlePalace(void) chosenMoveId = i; } while (chosenMoveId == -1); } - // Otherwise randomly choose move of only available move group else { - if ((validMoveFlags & 0xF) > 1) - validMoveGroup = PALACE_MOVE_GROUP_ATTACK; - if ((validMoveFlags & 0xF0) > 0x1F) - validMoveGroup = PALACE_MOVE_GROUP_DEFENSE; - if ((validMoveFlags & 0xF0) > 0x1FF) - validMoveGroup = PALACE_MOVE_GROUP_SUPPORT; + // The battler has just 1 move group with multiple move options to choose from. + // Choose a move randomly from this group. + + // Same bug as the previous set of conditions (the condition for Support is never true). + // This bug won't cause a softlock below, because if Support is the only group with multiple + // moves then it won't have been counted, and the 'numMultipleMoveGroups == 0' above will be true. + if ((numMovesPerGroup & 0xF) >= 2) + randSelectGroup = PALACE_MOVE_GROUP_ATTACK; + if ((numMovesPerGroup & (0xF << 4)) >= (2 << 4)) + randSelectGroup = PALACE_MOVE_GROUP_DEFENSE; +#ifdef BUGFIX + if ((numMovesPerGroup & (0xF << 8)) >= (2 << 8)) +#else + if ((numMovesPerGroup & (0xF << 4)) >= (2 << 8)) +#endif + randSelectGroup = PALACE_MOVE_GROUP_SUPPORT; do { i = Random() % MAX_MON_MOVES; - if (!(gBitTable[i] & unusableMovesBits) && validMoveGroup == GetBattlePalaceMoveGroup(gActiveBattler, moveInfo->moves[i])) + if (!(gBitTable[i] & unusableMovesBits) && randSelectGroup == GetBattlePalaceMoveGroup(battler, moveInfo->moves[i])) chosenMoveId = i; } while (chosenMoveId == -1); } - // If a move was selected (and in this case was not from the Nature-chosen group) - // then there's a 50% chance it won't be used anyway - if (Random() % 100 > 49) + // Because the selected move was not from the Nature-chosen move group there's a 50% chance + // that it will be unable to use it. This could have been checked earlier to avoid the above work. + if (Random() % 100 >= 50) { - gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; + gProtectStructs[battler].palaceUnableToUseMove = TRUE; return 0; } } else { - gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; + // All the battler's moves were flagged as unusable. + gProtectStructs[battler].palaceUnableToUseMove = TRUE; return 0; } } @@ -246,15 +270,15 @@ u16 ChooseMoveAndTargetInBattlePalace(void) } else { - moveTarget = GetBattlerMoveTargetType(gActiveBattler, moveInfo->moves[chosenMoveId]); + moveTarget = GetBattlerMoveTargetType(battler, moveInfo->moves[chosenMoveId]); } if (moveTarget & MOVE_TARGET_USER) - chosenMoveId |= (gActiveBattler << 8); + chosenMoveId |= (battler << 8); else if (moveTarget == MOVE_TARGET_SELECTED) - chosenMoveId |= GetBattlePalaceTarget(); + chosenMoveId |= GetBattlePalaceTarget(battler); else - chosenMoveId |= (GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gActiveBattler))) << 8); + chosenMoveId |= (GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerSide(battler))) << 8); return chosenMoveId; } @@ -264,13 +288,13 @@ u16 ChooseMoveAndTargetInBattlePalace(void) #undef selectedGroup #undef selectedMoves #undef moveTarget -#undef validMoveFlags -#undef numValidMoveGroups -#undef validMoveGroup +#undef numMovesPerGroup +#undef numMultipleMoveGroups +#undef randSelectGroup -static u8 GetBattlePalaceMoveGroup(u8 battlerId, u16 move) +static u8 GetBattlePalaceMoveGroup(u8 battler, u16 move) { - switch (GetBattlerMoveTargetType(battlerId, move)) + switch (GetBattlerMoveTargetType(battler, move)) { case MOVE_TARGET_SELECTED: case MOVE_TARGET_USER_OR_SELECTED: @@ -292,13 +316,13 @@ static u8 GetBattlePalaceMoveGroup(u8 battlerId, u16 move) } } -static u16 GetBattlePalaceTarget(void) +static u16 GetBattlePalaceTarget(u32 battler) { if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { u8 opposing1, opposing2; - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) { opposing1 = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); opposing2 = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); @@ -310,9 +334,9 @@ static u16 GetBattlePalaceTarget(void) } if (gBattleMons[opposing1].hp == gBattleMons[opposing2].hp) - return (BATTLE_OPPOSITE(gActiveBattler & BIT_SIDE) + (Random() & 2)) << 8; + return (BATTLE_OPPOSITE(battler & BIT_SIDE) + (Random() & 2)) << 8; - switch (gBattlePalaceNatureToMoveTarget[GetNatureFromPersonality(gBattleMons[gActiveBattler].personality)]) + switch (gBattlePalaceNatureToMoveTarget[GetNatureFromPersonality(gBattleMons[battler].personality)]) { case PALACE_TARGET_STRONGER: if (gBattleMons[opposing1].hp > gBattleMons[opposing2].hp) @@ -325,11 +349,11 @@ static u16 GetBattlePalaceTarget(void) else return opposing2 << 8; case PALACE_TARGET_RANDOM: - return (BATTLE_OPPOSITE(gActiveBattler & BIT_SIDE) + (Random() & 2)) << 8; + return (BATTLE_OPPOSITE(battler & BIT_SIDE) + (Random() & 2)) << 8; } } - return BATTLE_OPPOSITE(gActiveBattler) << 8; + return BATTLE_OPPOSITE(battler) << 8; } // Wait for the pokemon to finish appearing out from the pokeball on send out @@ -393,38 +417,38 @@ static void SpriteCB_TrainerSlideVertical(struct Sprite *sprite) #undef sSpeedX -void InitAndLaunchChosenStatusAnimation(bool8 isStatus2, u32 status) +void InitAndLaunchChosenStatusAnimation(u32 battler, bool32 isStatus2, u32 status) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].statusAnimActive = 1; + gBattleSpritesDataPtr->healthBoxesData[battler].statusAnimActive = 1; if (!isStatus2) { if (status == STATUS1_FREEZE || status == STATUS1_FROSTBITE) - LaunchStatusAnimation(gActiveBattler, B_ANIM_STATUS_FRZ); + LaunchStatusAnimation(battler, B_ANIM_STATUS_FRZ); else if (status == STATUS1_POISON || status & STATUS1_TOXIC_POISON) - LaunchStatusAnimation(gActiveBattler, B_ANIM_STATUS_PSN); + LaunchStatusAnimation(battler, B_ANIM_STATUS_PSN); else if (status == STATUS1_BURN) - LaunchStatusAnimation(gActiveBattler, B_ANIM_STATUS_BRN); + LaunchStatusAnimation(battler, B_ANIM_STATUS_BRN); else if (status & STATUS1_SLEEP) - LaunchStatusAnimation(gActiveBattler, B_ANIM_STATUS_SLP); + LaunchStatusAnimation(battler, B_ANIM_STATUS_SLP); else if (status == STATUS1_PARALYSIS) - LaunchStatusAnimation(gActiveBattler, B_ANIM_STATUS_PRZ); + LaunchStatusAnimation(battler, B_ANIM_STATUS_PRZ); else // no animation - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].statusAnimActive = 0; + gBattleSpritesDataPtr->healthBoxesData[battler].statusAnimActive = 0; } else { if (status & STATUS2_INFATUATION) - LaunchStatusAnimation(gActiveBattler, B_ANIM_STATUS_INFATUATION); + LaunchStatusAnimation(battler, B_ANIM_STATUS_INFATUATION); else if (status & STATUS2_CONFUSION) - LaunchStatusAnimation(gActiveBattler, B_ANIM_STATUS_CONFUSION); + LaunchStatusAnimation(battler, B_ANIM_STATUS_CONFUSION); else if (status & STATUS2_CURSED) - LaunchStatusAnimation(gActiveBattler, B_ANIM_STATUS_CURSED); + LaunchStatusAnimation(battler, B_ANIM_STATUS_CURSED); else if (status & STATUS2_NIGHTMARE) - LaunchStatusAnimation(gActiveBattler, B_ANIM_STATUS_NIGHTMARE); + LaunchStatusAnimation(battler, B_ANIM_STATUS_NIGHTMARE); else if (status & STATUS2_WRAPPED) - LaunchStatusAnimation(gActiveBattler, B_ANIM_STATUS_WRAPPED); // this animation doesn't actually exist + LaunchStatusAnimation(battler, B_ANIM_STATUS_WRAPPED); // this animation doesn't actually exist else // no animation - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].statusAnimActive = 0; + gBattleSpritesDataPtr->healthBoxesData[battler].statusAnimActive = 0; } } @@ -434,12 +458,6 @@ bool8 TryHandleLaunchBattleTableAnimation(u8 activeBattler, u8 atkBattler, u8 de { u8 taskId; - if (tableId == B_ANIM_CASTFORM_CHANGE && (argument & CASTFORM_SUBSTITUTE)) - { - // If Castform is behind substitute, set the new form but skip the animation - gBattleMonForms[activeBattler] = (argument & ~CASTFORM_SUBSTITUTE); - return TRUE; - } if (gBattleSpritesDataPtr->battlerData[activeBattler].behindSubstitute && !ShouldAnimBeDoneRegardlessOfSubstitute(tableId)) { @@ -527,14 +545,14 @@ static void Task_ClearBitWhenSpecialAnimDone(u8 taskId) #undef tBattlerId // Check if SE has finished or 30 calls, whichever comes first -bool8 IsBattleSEPlaying(u8 battlerId) +bool8 IsBattleSEPlaying(u8 battler) { u8 zero = 0; if (IsSEPlaying()) { - gBattleSpritesDataPtr->healthBoxesData[battlerId].soundTimer++; - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].soundTimer < 30) + gBattleSpritesDataPtr->healthBoxesData[battler].soundTimer++; + if (gBattleSpritesDataPtr->healthBoxesData[battler].soundTimer < 30) return TRUE; m4aMPlayStop(&gMPlayInfo_SE1); @@ -542,7 +560,7 @@ bool8 IsBattleSEPlaying(u8 battlerId) } if (zero == 0) { - gBattleSpritesDataPtr->healthBoxesData[battlerId].soundTimer = 0; + gBattleSpritesDataPtr->healthBoxesData[battler].soundTimer = 0; return FALSE; } @@ -550,11 +568,11 @@ bool8 IsBattleSEPlaying(u8 battlerId) return TRUE; } -static void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battlerId, bool32 opponent) +void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battler) { u32 monsPersonality, currentPersonality, otId, currentOtId, species, paletteOffset, position; const void *lzPaletteData; - struct Pokemon *illusionMon = GetIllusionMonPtr(battlerId); + struct Pokemon *illusionMon = GetIllusionMonPtr(battler); if (illusionMon != NULL) mon = illusionMon; @@ -564,7 +582,7 @@ static void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battlerId, bool32 op monsPersonality = GetMonData(mon, MON_DATA_PERSONALITY); otId = GetMonData(mon, MON_DATA_OT_ID); - if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies == SPECIES_NONE) + if (gBattleSpritesDataPtr->battlerData[battler].transformSpecies == SPECIES_NONE) { species = GetMonData(mon, MON_DATA_SPECIES); currentPersonality = monsPersonality; @@ -572,18 +590,18 @@ static void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battlerId, bool32 op } else { - species = gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies; + species = gBattleSpritesDataPtr->battlerData[battler].transformSpecies; #if B_TRANSFORM_SHINY >= GEN_4 - currentPersonality = gTransformedPersonalities[battlerId]; - currentOtId = gTransformedOtIds[battlerId]; + currentPersonality = gTransformedPersonalities[battler]; + currentOtId = gTransformedOtIds[battler]; #else currentPersonality = monsPersonality; currentOtId = otId; #endif } - position = GetBattlerPosition(battlerId); - if (opponent) + position = GetBattlerPosition(battler); + if (GetBattlerSide(battler) == B_SIDE_OPPONENT) { HandleLoadSpecialPokePic(TRUE, gMonSpritesGfxPtr->sprites.ptr[position], @@ -596,67 +614,46 @@ static void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battlerId, bool32 op species, currentPersonality); } - paletteOffset = OBJ_PLTT_ID(battlerId); + paletteOffset = OBJ_PLTT_ID(battler); - if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies == SPECIES_NONE) + if (gBattleSpritesDataPtr->battlerData[battler].transformSpecies == SPECIES_NONE) lzPaletteData = GetMonFrontSpritePal(mon); else lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(species, currentOtId, currentPersonality); LZDecompressWram(lzPaletteData, gDecompressionBuffer); LoadPalette(gDecompressionBuffer, paletteOffset, PLTT_SIZE_4BPP); - LoadPalette(gDecompressionBuffer, BG_PLTT_ID(8) + BG_PLTT_ID(battlerId), PLTT_SIZE_4BPP); - - if (species == SPECIES_CASTFORM || species == SPECIES_CHERRIM) - { - paletteOffset = OBJ_PLTT_ID(battlerId); - LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette); - LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerId]], paletteOffset, PLTT_SIZE_4BPP); - } + LoadPalette(gDecompressionBuffer, BG_PLTT_ID(8) + BG_PLTT_ID(battler), PLTT_SIZE_4BPP); // transform's pink color - if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != SPECIES_NONE) + if (gBattleSpritesDataPtr->battlerData[battler].transformSpecies != SPECIES_NONE) { BlendPalette(paletteOffset, 16, 6, RGB_WHITE); CpuCopy32(&gPlttBufferFaded[paletteOffset], &gPlttBufferUnfaded[paletteOffset], PLTT_SIZEOF(16)); } } -void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 battlerId) -{ - BattleLoadMonSpriteGfx(mon, battlerId, TRUE); -} - -void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 battlerId) -{ - BattleLoadMonSpriteGfx(mon, battlerId, FALSE); -} - void BattleGfxSfxDummy2(u16 species) { } -void DecompressTrainerFrontPic(u16 frontPicId, u8 battlerId) +void DecompressTrainerFrontPic(u16 frontPicId, u8 battler) { - u8 position = GetBattlerPosition(battlerId); + u8 position = GetBattlerPosition(battler); DecompressPicFromTable(&gTrainerFrontPicTable[frontPicId], gMonSpritesGfxPtr->sprites.ptr[position], SPECIES_NONE); LoadCompressedSpritePalette(&gTrainerFrontPicPaletteTable[frontPicId]); } -void DecompressTrainerBackPic(u16 backPicId, u8 battlerId) +void DecompressTrainerBackPic(u16 backPicId, u8 battler) { - u8 position = GetBattlerPosition(battlerId); + u8 position = GetBattlerPosition(battler); DecompressPicFromTable(&gTrainerBackPicTable[backPicId], gMonSpritesGfxPtr->sprites.ptr[position], SPECIES_NONE); LoadCompressedPalette(gTrainerBackPicPaletteTable[backPicId].data, - OBJ_PLTT_ID(battlerId), PLTT_SIZE_4BPP); -} - -void BattleGfxSfxDummy3(u8 gender) -{ + OBJ_PLTT_ID(battler), PLTT_SIZE_4BPP); } void FreeTrainerFrontPicPalette(u16 frontPicId) @@ -687,7 +684,7 @@ void BattleLoadAllHealthBoxesGfxAtOnce(void) numberOfBattlers = MAX_BATTLERS_COUNT; } for (i = 0; i < numberOfBattlers; i++) - LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[i]]); + LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(i)]); } bool8 BattleLoadAllHealthBoxesGfx(u8 state) @@ -714,9 +711,9 @@ bool8 BattleLoadAllHealthBoxesGfx(u8 state) else if (state == 3) LoadCompressedSpriteSheet(&sSpriteSheet_SinglesOpponentHealthbox); else if (state == 4) - LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[0]]); + LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(0)]); else if (state == 5) - LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[1]]); + LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(1)]); else retVal = TRUE; } @@ -736,13 +733,13 @@ bool8 BattleLoadAllHealthBoxesGfx(u8 state) else if (state == 5) LoadCompressedSpriteSheet(&sSpriteSheets_DoublesOpponentHealthbox[1]); else if (state == 6) - LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[0]]); + LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(0)]); else if (state == 7) - LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[1]]); + LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(1)]); else if (state == 8) - LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[2]]); + LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(2)]); else if (state == 9) - LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[3]]); + LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(3)]); else retVal = TRUE; } @@ -756,7 +753,7 @@ void LoadBattleBarGfx(u8 unused) LZDecompressWram(gBattleInterfaceGfx_BattleBar, gMonSpritesGfxPtr->barFontGfx); } -bool8 BattleInitAllSprites(u8 *state1, u8 *battlerId) +bool8 BattleInitAllSprites(u8 *state1, u8 *battler) { bool8 retVal = FALSE; @@ -767,13 +764,13 @@ bool8 BattleInitAllSprites(u8 *state1, u8 *battlerId) (*state1)++; break; case 1: - if (!BattleLoadAllHealthBoxesGfx(*battlerId)) + if (!BattleLoadAllHealthBoxesGfx(*battler)) { - (*battlerId)++; + (*battler)++; } else { - *battlerId = 0; + *battler = 0; (*state1)++; } break; @@ -781,47 +778,47 @@ bool8 BattleInitAllSprites(u8 *state1, u8 *battlerId) (*state1)++; break; case 3: - if ((gBattleTypeFlags & BATTLE_TYPE_SAFARI) && *battlerId == 0) - gHealthboxSpriteIds[*battlerId] = CreateSafariPlayerHealthboxSprites(); + if ((gBattleTypeFlags & BATTLE_TYPE_SAFARI) && *battler == 0) + gHealthboxSpriteIds[*battler] = CreateSafariPlayerHealthboxSprites(); else - gHealthboxSpriteIds[*battlerId] = CreateBattlerHealthboxSprites(*battlerId); + gHealthboxSpriteIds[*battler] = CreateBattlerHealthboxSprites(*battler); - (*battlerId)++; - if (*battlerId == gBattlersCount) + (*battler)++; + if (*battler == gBattlersCount) { - *battlerId = 0; + *battler = 0; (*state1)++; } break; case 4: - InitBattlerHealthboxCoords(*battlerId); - if (gBattlerPositions[*battlerId] <= B_POSITION_OPPONENT_LEFT) - DummyBattleInterfaceFunc(gHealthboxSpriteIds[*battlerId], FALSE); + InitBattlerHealthboxCoords(*battler); + if (GetBattlerPosition(*battler) <= B_POSITION_OPPONENT_LEFT) + DummyBattleInterfaceFunc(gHealthboxSpriteIds[*battler], FALSE); else - DummyBattleInterfaceFunc(gHealthboxSpriteIds[*battlerId], TRUE); + DummyBattleInterfaceFunc(gHealthboxSpriteIds[*battler], TRUE); - (*battlerId)++; - if (*battlerId == gBattlersCount) + (*battler)++; + if (*battler == gBattlersCount) { - *battlerId = 0; + *battler = 0; (*state1)++; } break; case 5: - if (GetBattlerSide(*battlerId) == B_SIDE_PLAYER) + if (GetBattlerSide(*battler) == B_SIDE_PLAYER) { if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI)) - UpdateHealthboxAttribute(gHealthboxSpriteIds[*battlerId], &gPlayerParty[gBattlerPartyIndexes[*battlerId]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[*battler], &gPlayerParty[gBattlerPartyIndexes[*battler]], HEALTHBOX_ALL); } else { - UpdateHealthboxAttribute(gHealthboxSpriteIds[*battlerId], &gEnemyParty[gBattlerPartyIndexes[*battlerId]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[*battler], &gEnemyParty[gBattlerPartyIndexes[*battler]], HEALTHBOX_ALL); } - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[*battlerId]); - (*battlerId)++; - if (*battlerId == gBattlersCount) + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[*battler]); + (*battler)++; + if (*battler == gBattlersCount) { - *battlerId = 0; + *battler = 0; (*state1)++; } break; @@ -855,12 +852,12 @@ void CopyAllBattleSpritesInvisibilities(void) gBattleSpritesDataPtr->battlerData[i].invisible = gSprites[gBattlerSpriteIds[i]].invisible; } -void CopyBattleSpriteInvisibility(u8 battlerId) +void CopyBattleSpriteInvisibility(u8 battler) { - gBattleSpritesDataPtr->battlerData[battlerId].invisible = gSprites[gBattlerSpriteIds[battlerId]].invisible; + gBattleSpritesDataPtr->battlerData[battler].invisible = gSprites[gBattlerSpriteIds[battler]].invisible; } -void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 castform, bool32 megaEvo, bool8 trackEnemyPersonality) +void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool32 megaEvo, bool8 trackEnemyPersonality) { u32 personalityValue, otId, position, paletteOffset, targetSpecies; const void *lzPaletteData, *src; @@ -930,139 +927,107 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 castform, bo gTransformedPersonalities[battlerAtk]); } } + src = gMonSpritesGfxPtr->sprites.ptr[position]; + dst = (void *)(OBJ_VRAM0 + gSprites[gBattlerSpriteIds[battlerAtk]].oam.tileNum * 32); + DmaCopy32(3, src, dst, MON_PIC_SIZE); + paletteOffset = OBJ_PLTT_ID(battlerAtk); + lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(targetSpecies, otId, personalityValue); + LZDecompressWram(lzPaletteData, gDecompressionBuffer); + LoadPalette(gDecompressionBuffer, paletteOffset, PLTT_SIZE_4BPP); - if (castform) + if (!megaEvo) { - StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerAtk]], gBattleSpritesDataPtr->animationData->animArg); - paletteOffset = OBJ_PLTT_ID(battlerAtk); - lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(targetSpecies, otId, personalityValue); - LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette); - LoadPalette(gBattleStruct->castformPalette[gBattleSpritesDataPtr->animationData->animArg], paletteOffset, PLTT_SIZE_4BPP); - gBattleMonForms[battlerAtk] = gBattleSpritesDataPtr->animationData->animArg; - if (gBattleSpritesDataPtr->battlerData[battlerAtk].transformSpecies != SPECIES_NONE) - { - BlendPalette(paletteOffset, 16, 6, RGB_WHITE); - CpuCopy32(&gPlttBufferFaded[paletteOffset], &gPlttBufferUnfaded[paletteOffset], PLTT_SIZEOF(16)); - } - gSprites[gBattlerSpriteIds[battlerAtk]].y = GetBattlerSpriteDefault_Y(battlerAtk); - } - else - { - src = gMonSpritesGfxPtr->sprites.ptr[position]; - dst = (void *)(OBJ_VRAM0 + gSprites[gBattlerSpriteIds[battlerAtk]].oam.tileNum * 32); - DmaCopy32(3, src, dst, MON_PIC_SIZE); - paletteOffset = OBJ_PLTT_ID(battlerAtk); - lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(targetSpecies, otId, personalityValue); - LZDecompressWram(lzPaletteData, gDecompressionBuffer); - LoadPalette(gDecompressionBuffer, paletteOffset, PLTT_SIZE_4BPP); - - if (targetSpecies == SPECIES_CASTFORM || targetSpecies == SPECIES_CHERRIM) - { - gSprites[gBattlerSpriteIds[battlerAtk]].anims = gMonFrontAnimsPtrTable[targetSpecies]; - LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette); - LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerDef]], paletteOffset, PLTT_SIZE_4BPP); - } - - if (!megaEvo) - { - BlendPalette(paletteOffset, 16, 6, RGB_WHITE); - CpuCopy32(&gPlttBufferFaded[paletteOffset], &gPlttBufferUnfaded[paletteOffset], PLTT_SIZEOF(16)); - } - - if (!IsContest() && !megaEvo) + BlendPalette(paletteOffset, 16, 6, RGB_WHITE); + CpuCopy32(&gPlttBufferFaded[paletteOffset], &gPlttBufferUnfaded[paletteOffset], PLTT_SIZEOF(16)); + if (!IsContest()) { gBattleSpritesDataPtr->battlerData[battlerAtk].transformSpecies = targetSpecies; - gBattleMonForms[battlerAtk] = gBattleMonForms[battlerDef]; } - - gSprites[gBattlerSpriteIds[battlerAtk]].y = GetBattlerSpriteDefault_Y(battlerAtk); - StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerAtk]], gBattleMonForms[battlerAtk]); } + + gSprites[gBattlerSpriteIds[battlerAtk]].y = GetBattlerSpriteDefault_Y(battlerAtk); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerAtk]], 0); } -void BattleLoadSubstituteOrMonSpriteGfx(u8 battlerId, bool8 loadMonSprite) +void BattleLoadSubstituteOrMonSpriteGfx(u8 battler, bool8 loadMonSprite) { s32 i, position, palOffset; if (!loadMonSprite) { + if (IsContest()) position = B_POSITION_PLAYER_LEFT; else - position = GetBattlerPosition(battlerId); + position = GetBattlerPosition(battler); if (IsContest()) - LZDecompressVram(gSubstituteDollBackGfx, gMonSpritesGfxPtr->sprites.ptr[position]); - else if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) - LZDecompressVram(gSubstituteDollFrontGfx, gMonSpritesGfxPtr->sprites.ptr[position]); + LZDecompressVram(gBattleAnimSpriteGfx_SubstituteBack, gMonSpritesGfxPtr->sprites.ptr[position]); + else if (GetBattlerSide(battler) != B_SIDE_PLAYER) + LZDecompressVram(gBattleAnimSpriteGfx_Substitute, gMonSpritesGfxPtr->sprites.ptr[position]); else - LZDecompressVram(gSubstituteDollBackGfx, gMonSpritesGfxPtr->sprites.ptr[position]); + LZDecompressVram(gBattleAnimSpriteGfx_SubstituteBack, gMonSpritesGfxPtr->sprites.ptr[position]); for (i = 1; i < 4; i++) { Dma3CopyLarge32_(gMonSpritesGfxPtr->sprites.ptr[position], &gMonSpritesGfxPtr->sprites.byte[position][MON_PIC_SIZE * i], MON_PIC_SIZE); } - palOffset = OBJ_PLTT_ID(battlerId); - LoadCompressedPalette(gSubstituteDollPal, palOffset, PLTT_SIZE_4BPP); + palOffset = OBJ_PLTT_ID(battler); + LoadCompressedPalette(gBattleAnimSpritePal_Substitute, palOffset, PLTT_SIZE_4BPP); } else { if (!IsContest()) - { - if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) - BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId); - else - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battlerId]], battlerId); - } + BattleLoadMonSpriteGfx(&GetBattlerParty(battler)[gBattlerPartyIndexes[battler]], battler); } } -void LoadBattleMonGfxAndAnimate(u8 battlerId, bool8 loadMonSprite, u8 spriteId) +void LoadBattleMonGfxAndAnimate(u8 battler, bool8 loadMonSprite, u8 spriteId) { - BattleLoadSubstituteOrMonSpriteGfx(battlerId, loadMonSprite); - StartSpriteAnim(&gSprites[spriteId], gBattleMonForms[battlerId]); + BattleLoadSubstituteOrMonSpriteGfx(battler, loadMonSprite); + StartSpriteAnim(&gSprites[spriteId], 0); if (!loadMonSprite) - gSprites[spriteId].y = GetSubstituteSpriteDefault_Y(battlerId); + gSprites[spriteId].y = GetSubstituteSpriteDefault_Y(battler); else - gSprites[spriteId].y = GetBattlerSpriteDefault_Y(battlerId); + gSprites[spriteId].y = GetBattlerSpriteDefault_Y(battler); } -void TrySetBehindSubstituteSpriteBit(u8 battlerId, u16 move) +void TrySetBehindSubstituteSpriteBit(u8 battler, u16 move) { if (move == MOVE_SUBSTITUTE) - gBattleSpritesDataPtr->battlerData[battlerId].behindSubstitute = 1; + gBattleSpritesDataPtr->battlerData[battler].behindSubstitute = 1; } -void ClearBehindSubstituteBit(u8 battlerId) +void ClearBehindSubstituteBit(u8 battler) { - gBattleSpritesDataPtr->battlerData[battlerId].behindSubstitute = 0; + gBattleSpritesDataPtr->battlerData[battler].behindSubstitute = 0; } -void HandleLowHpMusicChange(struct Pokemon *mon, u8 battlerId) +void HandleLowHpMusicChange(struct Pokemon *mon, u8 battler) { u16 hp = GetMonData(mon, MON_DATA_HP); u16 maxHP = GetMonData(mon, MON_DATA_MAX_HP); if (GetHPBarLevel(hp, maxHP) == HP_BAR_RED) { - if (!gBattleSpritesDataPtr->battlerData[battlerId].lowHpSong) + if (!gBattleSpritesDataPtr->battlerData[battler].lowHpSong) { - if (!gBattleSpritesDataPtr->battlerData[BATTLE_PARTNER(battlerId)].lowHpSong) + if (!gBattleSpritesDataPtr->battlerData[BATTLE_PARTNER(battler)].lowHpSong) PlaySE(SE_LOW_HEALTH); - gBattleSpritesDataPtr->battlerData[battlerId].lowHpSong = 1; + gBattleSpritesDataPtr->battlerData[battler].lowHpSong = 1; } } else { - gBattleSpritesDataPtr->battlerData[battlerId].lowHpSong = 0; + gBattleSpritesDataPtr->battlerData[battler].lowHpSong = 0; if (!IsDoubleBattle()) { m4aSongNumStop(SE_LOW_HEALTH); return; } - if (IsDoubleBattle() && !gBattleSpritesDataPtr->battlerData[BATTLE_PARTNER(battlerId)].lowHpSong) + if (IsDoubleBattle() && !gBattleSpritesDataPtr->battlerData[BATTLE_PARTNER(battler)].lowHpSong) { m4aSongNumStop(SE_LOW_HEALTH); return; @@ -1131,46 +1096,46 @@ void SetBattlerSpriteAffineMode(u8 affineMode) void LoadAndCreateEnemyShadowSprites(void) { - u8 battlerId; + u8 battler; LoadCompressedSpriteSheet(&gSpriteSheet_EnemyShadow); - battlerId = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); - gBattleSpritesDataPtr->healthBoxesData[battlerId].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, - GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X), - GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y) + 29, + battler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + gBattleSpritesDataPtr->healthBoxesData[battler].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, + GetBattlerSpriteCoord(battler, BATTLER_COORD_X), + GetBattlerSpriteCoord(battler, BATTLER_COORD_Y) + 29, 0xC8); - gSprites[gBattleSpritesDataPtr->healthBoxesData[battlerId].shadowSpriteId].data[0] = battlerId; + gSprites[gBattleSpritesDataPtr->healthBoxesData[battler].shadowSpriteId].data[0] = battler; if (IsDoubleBattle()) { - battlerId = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); - gBattleSpritesDataPtr->healthBoxesData[battlerId].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, - GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X), - GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y) + 29, + battler = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); + gBattleSpritesDataPtr->healthBoxesData[battler].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, + GetBattlerSpriteCoord(battler, BATTLER_COORD_X), + GetBattlerSpriteCoord(battler, BATTLER_COORD_Y) + 29, 0xC8); - gSprites[gBattleSpritesDataPtr->healthBoxesData[battlerId].shadowSpriteId].data[0] = battlerId; + gSprites[gBattleSpritesDataPtr->healthBoxesData[battler].shadowSpriteId].data[0] = battler; } } void SpriteCB_EnemyShadow(struct Sprite *shadowSprite) { bool8 invisible = FALSE; - u8 battlerId = shadowSprite->tBattlerId; - struct Sprite *battlerSprite = &gSprites[gBattlerSpriteIds[battlerId]]; + u8 battler = shadowSprite->tBattlerId; + struct Sprite *battlerSprite = &gSprites[gBattlerSpriteIds[battler]]; - if (!battlerSprite->inUse || !IsBattlerSpritePresent(battlerId)) + if (!battlerSprite->inUse || !IsBattlerSpritePresent(battler)) { shadowSprite->callback = SpriteCB_SetInvisible; return; } if (gAnimScriptActive || battlerSprite->invisible) invisible = TRUE; - else if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != SPECIES_NONE - && gEnemyMonElevation[gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies] == 0) + else if (gBattleSpritesDataPtr->battlerData[battler].transformSpecies != SPECIES_NONE + && gEnemyMonElevation[gBattleSpritesDataPtr->battlerData[battler].transformSpecies] == 0) invisible = TRUE; - if (gBattleSpritesDataPtr->battlerData[battlerId].behindSubstitute) + if (gBattleSpritesDataPtr->battlerData[battler].behindSubstitute) invisible = TRUE; shadowSprite->x = battlerSprite->x; @@ -1185,24 +1150,24 @@ void SpriteCB_SetInvisible(struct Sprite *sprite) sprite->invisible = TRUE; } -void SetBattlerShadowSpriteCallback(u8 battlerId, u16 species) +void SetBattlerShadowSpriteCallback(u8 battler, u16 species) { // The player's shadow is never seen. - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER || gBattleScripting.monCaught) + if (GetBattlerSide(battler) == B_SIDE_PLAYER || gBattleScripting.monCaught) return; - if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != SPECIES_NONE) - species = gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies; + if (gBattleSpritesDataPtr->battlerData[battler].transformSpecies != SPECIES_NONE) + species = gBattleSpritesDataPtr->battlerData[battler].transformSpecies; if (gEnemyMonElevation[species] != 0) - gSprites[gBattleSpritesDataPtr->healthBoxesData[battlerId].shadowSpriteId].callback = SpriteCB_EnemyShadow; + gSprites[gBattleSpritesDataPtr->healthBoxesData[battler].shadowSpriteId].callback = SpriteCB_EnemyShadow; else - gSprites[gBattleSpritesDataPtr->healthBoxesData[battlerId].shadowSpriteId].callback = SpriteCB_SetInvisible; + gSprites[gBattleSpritesDataPtr->healthBoxesData[battler].shadowSpriteId].callback = SpriteCB_SetInvisible; } -void HideBattlerShadowSprite(u8 battlerId) +void HideBattlerShadowSprite(u8 battler) { - gSprites[gBattleSpritesDataPtr->healthBoxesData[battlerId].shadowSpriteId].callback = SpriteCB_SetInvisible; + gSprites[gBattleSpritesDataPtr->healthBoxesData[battler].shadowSpriteId].callback = SpriteCB_SetInvisible; } // Color the background tiles surrounding the action selection and move windows @@ -1229,12 +1194,11 @@ void FillAroundBattleWindows(void) } } -void ClearTemporarySpeciesSpriteData(u8 battlerId, bool8 dontClearSubstitute) +void ClearTemporarySpeciesSpriteData(u8 battler, bool8 dontClearSubstitute) { - gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies = SPECIES_NONE; - gBattleMonForms[battlerId] = 0; + gBattleSpritesDataPtr->battlerData[battler].transformSpecies = SPECIES_NONE; if (!dontClearSubstitute) - ClearBehindSubstituteBit(battlerId); + ClearBehindSubstituteBit(battler); } void AllocateMonSpritesGfx(void) @@ -1252,8 +1216,11 @@ void AllocateMonSpritesGfx(void) for (j = 0; j < 4; j++) { - gMonSpritesGfxPtr->frameImages[i][j].data = gMonSpritesGfxPtr->sprites.ptr[i] + (j * MON_PIC_SIZE); - gMonSpritesGfxPtr->frameImages[i][j].size = MON_PIC_SIZE; + if (gMonSpritesGfxPtr->sprites.ptr[i]) + { + gMonSpritesGfxPtr->frameImages[i][j].data = gMonSpritesGfxPtr->sprites.ptr[i] + (j * MON_PIC_SIZE); + gMonSpritesGfxPtr->frameImages[i][j].size = MON_PIC_SIZE; + } } gMonSpritesGfxPtr->templates[i].images = gMonSpritesGfxPtr->frameImages[i]; diff --git a/src/battle_interface.c b/src/battle_interface.c index 196e6050f243..d1e5757fb9b9 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -194,6 +194,7 @@ static void SpriteCB_StatusSummaryBalls_Exit(struct Sprite *); static void SpriteCB_StatusSummaryBalls_OnSwitchout(struct Sprite *); static void SpriteCb_MegaTrigger(struct Sprite *); +static void SpriteCb_BurstTrigger(struct Sprite *); static void MegaIndicator_SetVisibilities(u32 healthboxId, bool32 invisible); static void MegaIndicator_UpdateLevel(u32 healthboxId, u32 level); static void MegaIndicator_CreateSprite(u32 battlerId, u32 healthboxSpriteId); @@ -676,6 +677,64 @@ static const struct SpriteTemplate sSpriteTemplate_MegaTrigger = .callback = SpriteCb_MegaTrigger }; +static const u8 ALIGNED(4) sBurstTriggerGfx[] = INCBIN_U8("graphics/battle_interface/burst_trigger.4bpp"); +static const u16 sBurstTriggerPal[] = INCBIN_U16("graphics/battle_interface/burst_trigger.gbapal"); + +static const struct SpriteSheet sSpriteSheet_BurstTrigger = +{ + sBurstTriggerGfx, sizeof(sBurstTriggerGfx), TAG_BURST_TRIGGER_TILE +}; +static const struct SpritePalette sSpritePalette_BurstTrigger = +{ + sBurstTriggerPal, TAG_BURST_TRIGGER_PAL +}; + +static const struct OamData sOamData_BurstTrigger = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = ST_OAM_SQUARE, + .x = 0, + .matrixNum = 0, + .size = 2, + .tileNum = 0, + .priority = 1, + .paletteNum = 0, + .affineParam = 0, +}; + +static const union AnimCmd sSpriteAnim_BurstTriggerOff[] = +{ + ANIMCMD_FRAME(0, 0), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_BurstTriggerOn[] = +{ + ANIMCMD_FRAME(16, 0), + ANIMCMD_END +}; + +static const union AnimCmd *const sSpriteAnimTable_BurstTrigger[] = +{ + sSpriteAnim_BurstTriggerOff, + sSpriteAnim_BurstTriggerOn, +}; + +static const struct SpriteTemplate sSpriteTemplate_BurstTrigger = +{ + .tileTag = TAG_BURST_TRIGGER_TILE, + .paletteTag = TAG_BURST_TRIGGER_PAL, + .oam = &sOamData_BurstTrigger, + .anims = sSpriteAnimTable_BurstTrigger, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCb_BurstTrigger +}; + // Because the healthbox is too large to fit into one sprite, it is divided into two sprites. // healthboxLeft or healthboxMain is the left part that is used as the 'main' sprite. // healthboxRight or healthboxOther is the right part of the healthbox. @@ -1418,6 +1477,7 @@ void HideMegaTriggerSprite(void) void HideTriggerSprites(void) { HideMegaTriggerSprite(); + HideBurstTriggerSprite(); HideZMoveTriggerSprite(); } @@ -1433,6 +1493,128 @@ void DestroyMegaTriggerSprite(void) #undef tBattler #undef tHide +// Ultra Burst Trigger icon functions. +void ChangeBurstTriggerSprite(u8 spriteId, u8 animId) +{ + StartSpriteAnim(&gSprites[spriteId], animId); +} + +#define SINGLES_BURST_TRIGGER_POS_X_OPTIMAL (30) +#define SINGLES_BURST_TRIGGER_POS_X_PRIORITY (31) +#define SINGLES_BURST_TRIGGER_POS_X_SLIDE (15) +#define SINGLES_BURST_TRIGGER_POS_Y_DIFF (-11) + +#define DOUBLES_BURST_TRIGGER_POS_X_OPTIMAL (30) +#define DOUBLES_BURST_TRIGGER_POS_X_PRIORITY (31) +#define DOUBLES_BURST_TRIGGER_POS_X_SLIDE (15) +#define DOUBLES_BURST_TRIGGER_POS_Y_DIFF (-4) + +#define tBattler data[0] +#define tHide data[1] + +void CreateBurstTriggerSprite(u8 battlerId, u8 palId) +{ + LoadSpritePalette(&sSpritePalette_BurstTrigger); + if (GetSpriteTileStartByTag(TAG_BURST_TRIGGER_TILE) == 0xFFFF) + LoadSpriteSheet(&sSpriteSheet_BurstTrigger); + if (gBattleStruct->burst.triggerSpriteId == 0xFF) + { + if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) + gBattleStruct->burst.triggerSpriteId = CreateSprite(&sSpriteTemplate_BurstTrigger, + gSprites[gHealthboxSpriteIds[battlerId]].x - DOUBLES_BURST_TRIGGER_POS_X_SLIDE, + gSprites[gHealthboxSpriteIds[battlerId]].y - DOUBLES_BURST_TRIGGER_POS_Y_DIFF, 0); + else + gBattleStruct->burst.triggerSpriteId = CreateSprite(&sSpriteTemplate_BurstTrigger, + gSprites[gHealthboxSpriteIds[battlerId]].x - SINGLES_BURST_TRIGGER_POS_X_SLIDE, + gSprites[gHealthboxSpriteIds[battlerId]].y - SINGLES_BURST_TRIGGER_POS_Y_DIFF, 0); + } + gSprites[gBattleStruct->burst.triggerSpriteId].tBattler = battlerId; + gSprites[gBattleStruct->burst.triggerSpriteId].tHide = FALSE; + + ChangeBurstTriggerSprite(gBattleStruct->burst.triggerSpriteId, palId); +} + +static void SpriteCb_BurstTrigger(struct Sprite *sprite) +{ + s32 xSlide, xPriority, xOptimal; + s32 yDiff; + + if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) + { + xSlide = DOUBLES_BURST_TRIGGER_POS_X_SLIDE; + xPriority = DOUBLES_BURST_TRIGGER_POS_X_PRIORITY; + xOptimal = DOUBLES_BURST_TRIGGER_POS_X_OPTIMAL; + yDiff = DOUBLES_BURST_TRIGGER_POS_Y_DIFF; + } + else + { + xSlide = SINGLES_BURST_TRIGGER_POS_X_SLIDE; + xPriority = SINGLES_BURST_TRIGGER_POS_X_PRIORITY; + xOptimal = SINGLES_BURST_TRIGGER_POS_X_OPTIMAL; + yDiff = SINGLES_BURST_TRIGGER_POS_Y_DIFF; + } + + if (sprite->tHide) + { + if (sprite->x != gSprites[gHealthboxSpriteIds[sprite->tBattler]].x - xSlide) + sprite->x++; + + if (sprite->x >= gSprites[gHealthboxSpriteIds[sprite->tBattler]].x - xPriority) + sprite->oam.priority = 2; + else + sprite->oam.priority = 1; + + sprite->y = gSprites[gHealthboxSpriteIds[sprite->tBattler]].y - yDiff; + sprite->y2 = gSprites[gHealthboxSpriteIds[sprite->tBattler]].y2 - yDiff; + if (sprite->x == gSprites[gHealthboxSpriteIds[sprite->tBattler]].x - xSlide) + DestroyBurstTriggerSprite(); + } + else + { + if (sprite->x != gSprites[gHealthboxSpriteIds[sprite->tBattler]].x - xOptimal) + sprite->x--; + + if (sprite->x >= gSprites[gHealthboxSpriteIds[sprite->tBattler]].x - xPriority) + sprite->oam.priority = 2; + else + sprite->oam.priority = 1; + + sprite->y = gSprites[gHealthboxSpriteIds[sprite->tBattler]].y - yDiff; + sprite->y2 = gSprites[gHealthboxSpriteIds[sprite->tBattler]].y2 - yDiff; + } +} + +bool32 IsBurstTriggerSpriteActive(void) +{ + if (GetSpriteTileStartByTag(TAG_BURST_TRIGGER_TILE) == 0xFFFF) + return FALSE; + else if (IndexOfSpritePaletteTag(TAG_BURST_TRIGGER_PAL) != 0xFF) + return TRUE; + else + return FALSE; +} + +void HideBurstTriggerSprite(void) +{ + if (gBattleStruct->burst.triggerSpriteId >= MAX_SPRITES) + return; + ChangeBurstTriggerSprite(gBattleStruct->burst.triggerSpriteId, 0); + gSprites[gBattleStruct->burst.triggerSpriteId].tHide = TRUE; +} + +void DestroyBurstTriggerSprite(void) +{ + FreeSpritePaletteByTag(TAG_BURST_TRIGGER_PAL); + FreeSpriteTilesByTag(TAG_BURST_TRIGGER_TILE); + if (gBattleStruct->burst.triggerSpriteId != 0xFF) + DestroySprite(&gSprites[gBattleStruct->burst.triggerSpriteId]); + gBattleStruct->burst.triggerSpriteId = 0xFF; +} + +#undef tBattler +#undef tHide + + // Code for Mega Evolution (And Alpha/Omega) Trigger icon visible on the battler's healthbox. enum { @@ -2095,7 +2277,7 @@ static void UpdateNickInHealthbox(u8 healthboxSpriteId, struct Pokemon *mon) gender = GetMonGender(mon); species = GetMonData(mon, MON_DATA_SPECIES); - if ((species == SPECIES_NIDORAN_F || species == SPECIES_NIDORAN_M) && StringCompare(nickname, gSpeciesNames[species]) == 0) + if ((species == SPECIES_NIDORAN_F || species == SPECIES_NIDORAN_M) && StringCompare(nickname, GetSpeciesName(species)) == 0) gender = 100; // AddTextPrinterAndCreateWindowOnHealthbox's arguments are the same in all 3 cases. @@ -3213,10 +3395,18 @@ static const struct OamData sOamData_LastUsedBall = .objMode = 0, .mosaic = 0, .bpp = 0, +#if B_LAST_USED_BALL_CYCLE == TRUE + .shape = SPRITE_SHAPE(32x64), +#else .shape = SPRITE_SHAPE(32x32), +#endif .x = 0, .matrixNum = 0, +#if B_LAST_USED_BALL_CYCLE == TRUE + .size = SPRITE_SIZE(32x64), +#else .size = SPRITE_SIZE(32x32), +#endif .tileNum = 0, .priority = 1, .paletteNum = 0, @@ -3234,7 +3424,11 @@ static const struct SpriteTemplate sSpriteTemplate_LastUsedBallWindow = .callback = SpriteCB_LastUsedBallWin }; -#if B_LAST_USED_BALL_BUTTON == R_BUTTON +#if B_LAST_USED_BALL_BUTTON == R_BUTTON && B_LAST_USED_BALL_CYCLE == TRUE + static const u8 ALIGNED(4) sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball_r_cycle.4bpp"); +#elif B_LAST_USED_BALL_CYCLE == TRUE + static const u8 ALIGNED(4) sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball_l_cycle.4bpp"); +#elif B_LAST_USED_BALL_BUTTON == R_BUTTON static const u8 ALIGNED(4) sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball_r.4bpp"); #else static const u8 ALIGNED(4) sLastUsedBallWindowGfx[] = INCBIN_U8("graphics/battle_interface/last_used_ball_l.4bpp"); @@ -3244,15 +3438,22 @@ static const struct SpriteSheet sSpriteSheet_LastUsedBallWindow = sLastUsedBallWindowGfx, sizeof(sLastUsedBallWindowGfx), LAST_BALL_WINDOW_TAG }; -#define LAST_USED_BALL_X_F 15 -#define LAST_USED_BALL_X_0 -15 +#define LAST_USED_BALL_X_F 14 +#define LAST_USED_BALL_X_0 -14 #define LAST_USED_BALL_Y ((IsDoubleBattle()) ? 78 : 68) +#define LAST_USED_BALL_Y_BNC ((IsDoubleBattle()) ? 76 : 66) -#define LAST_BALL_WIN_X_F (LAST_USED_BALL_X_F - 1) -#define LAST_BALL_WIN_X_0 (LAST_USED_BALL_X_0 - 1) +#define LAST_BALL_WIN_X_F (LAST_USED_BALL_X_F - 0) +#define LAST_BALL_WIN_X_0 (LAST_USED_BALL_X_0 - 0) #define LAST_USED_WIN_Y (LAST_USED_BALL_Y - 8) #define sHide data[0] +#define sTimer data[1] +#define sMoving data[2] +#define sBounce data[3] // 0 = Bounce down; 1 = Bounce up + +#define sState data[0] +#define sSameBall data[1] bool32 CanThrowLastUsedBall(void) { @@ -3263,7 +3464,7 @@ bool32 CanThrowLastUsedBall(void) return FALSE; if (gBattleTypeFlags & (BATTLE_TYPE_TRAINER | BATTLE_TYPE_FRONTIER)) return FALSE; - if (!CheckBagHasItem(gLastThrownBall, 1)) + if (!CheckBagHasItem(gBallToDisplay, 1)) return FALSE; return TRUE; @@ -3279,7 +3480,7 @@ void TryAddLastUsedBallItemSprites(void) // we're out of the last used ball, so just set it to the first ball in the bag // we have to compact the bag first bc it is typically only compacted when you open it CompactItemsInBagPocket(&gBagPockets[BALLS_POCKET]); - gLastThrownBall = gBagPockets[BALLS_POCKET].itemSlots[0].itemId; + gBallToDisplay = gBagPockets[BALLS_POCKET].itemSlots[0].itemId; } if (!CanThrowLastUsedBall()) @@ -3288,10 +3489,11 @@ void TryAddLastUsedBallItemSprites(void) // ball if (gBattleStruct->ballSpriteIds[0] == MAX_SPRITES) { - gBattleStruct->ballSpriteIds[0] = AddItemIconSprite(102, 102, gLastThrownBall); + gBattleStruct->ballSpriteIds[0] = AddItemIconSprite(102, 102, gBallToDisplay); gSprites[gBattleStruct->ballSpriteIds[0]].x = LAST_USED_BALL_X_0; gSprites[gBattleStruct->ballSpriteIds[0]].y = LAST_USED_BALL_Y; gSprites[gBattleStruct->ballSpriteIds[0]].sHide = FALSE; // restore + gLastUsedBallMenuPresent = TRUE; gSprites[gBattleStruct->ballSpriteIds[0]].callback = SpriteCB_LastUsedBall; } @@ -3306,7 +3508,11 @@ void TryAddLastUsedBallItemSprites(void) LAST_BALL_WIN_X_0, LAST_USED_WIN_Y, 5); gSprites[gBattleStruct->ballSpriteIds[1]].sHide = FALSE; // restore + gLastUsedBallMenuPresent = TRUE; } +#if B_LAST_USED_BALL_CYCLE == TRUE + ArrowsChangeColorLastBallCycle(0); //Default the arrows to be invisible +#endif #endif } @@ -3347,6 +3553,9 @@ static void SpriteCB_LastUsedBall(struct Sprite *sprite) { if (sprite->sHide) { + if (sprite->y < LAST_USED_BALL_Y) // Used to recover from an incomplete bounce before hiding the window + sprite->y++; + if (sprite->x != LAST_USED_BALL_X_0) sprite->x--; @@ -3373,14 +3582,19 @@ static void TryHideOrRestoreLastUsedBall(u8 caseId) gSprites[gBattleStruct->ballSpriteIds[0]].sHide = TRUE; // hide if (gBattleStruct->ballSpriteIds[1] != MAX_SPRITES) gSprites[gBattleStruct->ballSpriteIds[1]].sHide = TRUE; // hide + gLastUsedBallMenuPresent = FALSE; break; case 1: // restore if (gBattleStruct->ballSpriteIds[0] != MAX_SPRITES) gSprites[gBattleStruct->ballSpriteIds[0]].sHide = FALSE; // restore if (gBattleStruct->ballSpriteIds[1] != MAX_SPRITES) gSprites[gBattleStruct->ballSpriteIds[1]].sHide = FALSE; // restore + gLastUsedBallMenuPresent = TRUE; break; } +#if B_LAST_USED_BALL_CYCLE == TRUE + ArrowsChangeColorLastBallCycle(0); //Default the arrows to be invisible +#endif #endif } @@ -3400,3 +3614,120 @@ void TryRestoreLastUsedBall(void) TryAddLastUsedBallItemSprites(); #endif } + +static void SpriteCB_LastUsedBallBounce(struct Sprite *sprite) +{ + if ((sprite->sTimer++ % 4) != 0) // Change the image every 4 frame + return; + if (sprite->sBounce) + { + if (sprite->y > LAST_USED_BALL_Y_BNC) + sprite->y--; + else + sprite->sMoving = FALSE; + } + else + { + if (sprite->y < LAST_USED_BALL_Y) + sprite->y++; + else + sprite->sMoving = FALSE; + } +} + +static void Task_BounceBall(u8 taskId) +{ + struct Sprite *sprite = &gSprites[gBattleStruct->ballSpriteIds[0]]; + struct Task *task = &gTasks[taskId]; + switch(task->sState) + { + case 0: // Bounce up + sprite->sBounce = TRUE; + sprite->sMoving = TRUE; + sprite->callback = SpriteCB_LastUsedBallBounce; + if (task->sSameBall) + task->sState = 3; + else + task->sState = 1; + break; + case 1: // Destroy Icon + if (!sprite->sMoving) + { + DestroyLastUsedBallGfx(sprite); + task->sState++; + } // Passthrough + case 2: //Create New Icon + if (!sprite->inUse) + { + gBattleStruct->ballSpriteIds[0] = AddItemIconSprite(102, 102, gBallToDisplay); + gSprites[gBattleStruct->ballSpriteIds[0]].x = LAST_USED_BALL_X_F; + gSprites[gBattleStruct->ballSpriteIds[0]].y = LAST_USED_BALL_Y_BNC; + task->sState++; + } // Fallthrough + case 3: // Bounce Down + if (!sprite->sMoving) + { + sprite->sBounce = FALSE; + sprite->sMoving = TRUE; + sprite->callback = SpriteCB_LastUsedBallBounce; //Show and bounce down + task->sState++; + } + break; + case 4: // Destroy Task + if(!sprite->sMoving) + { + sprite->callback = SpriteCB_LastUsedBall; + DestroyTask(taskId); + } + } + if (!gLastUsedBallMenuPresent) + { + // Used to check if the R button was released before the animation was complete + sprite->callback = SpriteCB_LastUsedBall; + DestroyTask(taskId); + } +} + +void SwapBallToDisplay(bool32 sameBall) +{ + u8 taskId; + taskId = CreateTask(Task_BounceBall, 10); + gTasks[taskId].sSameBall = sameBall; +} + +void ArrowsChangeColorLastBallCycle(bool32 showArrows) +{ +#if B_LAST_USED_BALL == TRUE && B_LAST_USED_BALL_CYCLE == TRUE + u16 paletteNum = 16 + gSprites[gBattleStruct->ballSpriteIds[1]].oam.paletteNum; + struct PlttData *defaultPlttArrow; + struct PlttData *defaultPlttOutline; + struct PlttData *pltArrow; + struct PlttData *pltOutline; + if (gBattleStruct->ballSpriteIds[1] == MAX_SPRITES) + return; + paletteNum *= 16; + pltArrow = (struct PlttData *)&gPlttBufferFaded[paletteNum + 9]; // Arrow color is in idx 9 + pltOutline = (struct PlttData *)&gPlttBufferFaded[paletteNum + 8]; // Arrow outline is in idx 8 + if (!showArrows) //Make invisible + { + defaultPlttArrow = (struct PlttData *)&gPlttBufferFaded[paletteNum + 13]; // Background color is idx 13 + pltArrow->r = defaultPlttArrow->r; + pltArrow->g = defaultPlttArrow->g; + pltArrow->b = defaultPlttArrow->b; + pltOutline->r = defaultPlttArrow->r; + pltOutline->g = defaultPlttArrow->g; + pltOutline->b = defaultPlttArrow->b; + } + else // Make gray + { + defaultPlttArrow = (struct PlttData *)&gPlttBufferFaded[paletteNum + 11]; // Grey color is idx 11 + defaultPlttOutline = (struct PlttData *)&gPlttBufferFaded[paletteNum + 10]; //Light grey color for outline is idx 10 + pltArrow->r = defaultPlttArrow->r; + pltArrow->g = defaultPlttArrow->g; + pltArrow->b = defaultPlttArrow->b; + pltOutline->r = defaultPlttOutline->r; + pltOutline->g = defaultPlttOutline->g; + pltOutline->b = defaultPlttOutline->b; + } +#endif +} diff --git a/src/battle_intro.c b/src/battle_intro.c index 78982ca4c35f..490aa940616c 100644 --- a/src/battle_intro.c +++ b/src/battle_intro.c @@ -182,7 +182,7 @@ static void BattleIntroSlide1(u8 taskId) if ((gBattle_WIN0V & 0xFF00) == 0x3000) { gTasks[taskId].tState++; - gTasks[taskId].data[2] = 240; + gTasks[taskId].data[2] = DISPLAY_WIDTH; gTasks[taskId].data[3] = 32; gIntroSlideFlags &= ~1; } @@ -213,13 +213,13 @@ static void BattleIntroSlide1(u8 taskId) gTasks[taskId].data[2] -= 2; // Scanline settings have already been set in CB2_InitBattleInternal() - for (i = 0; i < 80; i++) + for (i = 0; i < DISPLAY_HEIGHT / 2; i++) gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = gTasks[taskId].data[2]; - for (; i < 160; i++) + for (; i < DISPLAY_HEIGHT; i++) gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = -gTasks[taskId].data[2]; - if (!gTasks[taskId].data[2]) + if (gTasks[taskId].data[2] == 0) { gScanlineEffect.state = 3; gTasks[taskId].tState++; @@ -290,7 +290,7 @@ static void BattleIntroSlide2(u8 taskId) if ((gBattle_WIN0V & 0xFF00) == 0x3000) { gTasks[taskId].tState++; - gTasks[taskId].data[2] = 240; + gTasks[taskId].data[2] = DISPLAY_WIDTH; gTasks[taskId].data[3] = 32; gTasks[taskId].data[5] = 1; gIntroSlideFlags &= ~1; @@ -322,13 +322,13 @@ static void BattleIntroSlide2(u8 taskId) gTasks[taskId].data[2] -= 2; // Scanline settings have already been set in CB2_InitBattleInternal() - for (i = 0; i < 80; i++) + for (i = 0; i < DISPLAY_HEIGHT / 2; i++) gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = gTasks[taskId].data[2]; - for (; i < 160; i++) + for (; i < DISPLAY_HEIGHT; i++) gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = -gTasks[taskId].data[2]; - if (!gTasks[taskId].data[2]) + if (gTasks[taskId].data[2] == 0) { gScanlineEffect.state = 3; gTasks[taskId].tState++; @@ -383,7 +383,7 @@ static void BattleIntroSlide3(u8 taskId) if ((gBattle_WIN0V & 0xFF00) == 0x3000) { gTasks[taskId].tState++; - gTasks[taskId].data[2] = 240; + gTasks[taskId].data[2] = DISPLAY_WIDTH; gTasks[taskId].data[3] = 32; gTasks[taskId].data[5] = 1; gIntroSlideFlags &= ~1; @@ -410,13 +410,13 @@ static void BattleIntroSlide3(u8 taskId) gTasks[taskId].data[2] -= 2; // Scanline settings have already been set in CB2_InitBattleInternal() - for (i = 0; i < 80; i++) + for (i = 0; i < DISPLAY_HEIGHT / 2; i++) gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = gTasks[taskId].data[2]; - for (; i < 160; i++) + for (; i < DISPLAY_HEIGHT; i++) gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = -gTasks[taskId].data[2]; - if (!gTasks[taskId].data[2]) + if (gTasks[taskId].data[2] == 0) { gScanlineEffect.state = 3; gTasks[taskId].tState++; @@ -479,7 +479,7 @@ static void BattleIntroSlideLink(u8 taskId) if ((gBattle_WIN0V & 0xFF00) == 0x3000) { gTasks[taskId].tState++; - gTasks[taskId].data[2] = 240; + gTasks[taskId].data[2] = DISPLAY_WIDTH; gTasks[taskId].data[3] = 32; gIntroSlideFlags &= ~1; } @@ -492,13 +492,13 @@ static void BattleIntroSlideLink(u8 taskId) gTasks[taskId].data[2] -= 2; // Scanline settings have already been set in CB2_InitBattleInternal() - for (i = 0; i < 80; i++) + for (i = 0; i < DISPLAY_HEIGHT / 2; i++) gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = gTasks[taskId].data[2]; - for (; i < 160; i++) + for (; i < DISPLAY_HEIGHT; i++) gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = -gTasks[taskId].data[2]; - if (!gTasks[taskId].data[2]) + if (gTasks[taskId].data[2] == 0) { gScanlineEffect.state = 3; gTasks[taskId].tState++; @@ -544,7 +544,7 @@ static void BattleIntroSlidePartner(u8 taskId) if ((gBattle_WIN0V & 0xFF00) == 0x2000) { gTasks[taskId].tState++; - gTasks[taskId].data[2] = 240; + gTasks[taskId].data[2] = DISPLAY_WIDTH; gIntroSlideFlags &= ~1; } break; @@ -557,7 +557,7 @@ static void BattleIntroSlidePartner(u8 taskId) gBattle_BG1_X = gTasks[taskId].data[2]; gBattle_BG2_X = -gTasks[taskId].data[2]; - if (!gTasks[taskId].data[2]) + if (gTasks[taskId].data[2] == 0) gTasks[taskId].tState++; break; case 4: @@ -589,7 +589,7 @@ void DrawBattlerOnBg(int bgId, u8 x, u8 y, u8 battlerPosition, u8 paletteId, u8 int i, j; u8 battler = GetBattlerAtPosition(battlerPosition); int offset = tilesOffset; - CpuCopy16(gMonSpritesGfxPtr->sprites.ptr[battlerPosition] + BG_SCREEN_SIZE * gBattleMonForms[battler], tiles, BG_SCREEN_SIZE); + CpuCopy16(gMonSpritesGfxPtr->sprites.ptr[battlerPosition], tiles, BG_SCREEN_SIZE); LoadBgTiles(bgId, tiles, 0x1000, tilesOffset); for (i = y; i < y + 8; i++) { diff --git a/src/battle_main.c b/src/battle_main.c index 25736731c7dd..8461873f059b 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -16,6 +16,7 @@ #include "berry.h" #include "bg.h" #include "data.h" +#include "debug.h" #include "decompress.h" #include "dma3.h" #include "event_data.h" @@ -99,7 +100,7 @@ static void TryDoEventsBeforeFirstTurn(void); static void HandleTurnActionSelectionState(void); static void RunTurnActionsFunctions(void); static void SetActionsAndBattlersTurnOrder(void); -static void UpdateBattlerPartyOrdersOnSwitch(void); +static void UpdateBattlerPartyOrdersOnSwitch(u32 battler); static bool8 AllAtActionConfirmed(void); static void TryChangeTurnOrder(void); static void CheckChosenMoveForEffectsBeforeTurnStarts(void); @@ -150,7 +151,6 @@ EWRAM_DATA struct MultiPartnerMenuPokemon gMultiPartnerParty[MULTI_PARTY_SIZE] = EWRAM_DATA static struct MultiPartnerMenuPokemon* sMultiPartnerPartyBuffer = NULL; EWRAM_DATA u8 *gBattleAnimBgTileBuffer = NULL; EWRAM_DATA u8 *gBattleAnimBgTilemapBuffer = NULL; -EWRAM_DATA u8 gActiveBattler = 0; EWRAM_DATA u32 gBattleControllerExecFlags = 0; EWRAM_DATA u8 gBattlersCount = 0; EWRAM_DATA u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT] = {0}; @@ -212,7 +212,6 @@ EWRAM_DATA u16 gBattleWeather = 0; EWRAM_DATA struct WishFutureKnock gWishFutureKnock = {0}; EWRAM_DATA u16 gIntroSlideFlags = 0; EWRAM_DATA u8 gSentPokesToOpponent[2] = {0}; -EWRAM_DATA u16 gExpShareExp = 0; EWRAM_DATA struct BattleEnigmaBerry gEnigmaBerries[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA struct BattleScripting gBattleScripting = {0}; EWRAM_DATA struct BattleStruct *gBattleStruct = NULL; @@ -233,7 +232,6 @@ EWRAM_DATA struct BattleHealthboxInfo *gBattleControllerOpponentHealthboxData = EWRAM_DATA struct BattleHealthboxInfo *gBattleControllerOpponentFlankHealthboxData = NULL; // Never read EWRAM_DATA u16 gBattleMovePower = 0; EWRAM_DATA u16 gMoveToLearn = 0; -EWRAM_DATA u8 gBattleMonForms[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA u32 gFieldStatuses = 0; EWRAM_DATA struct FieldTimer gFieldTimers = {0}; EWRAM_DATA u8 gBattlerAbility = 0; @@ -242,6 +240,8 @@ EWRAM_DATA struct TotemBoost gTotemBoosts[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA bool8 gHasFetchedBall = FALSE; EWRAM_DATA u8 gLastUsedBall = 0; EWRAM_DATA u16 gLastThrownBall = 0; +EWRAM_DATA u16 gBallToDisplay = 0; +EWRAM_DATA bool8 gLastUsedBallMenuPresent = FALSE; EWRAM_DATA u8 gPartyCriticalHits[PARTY_SIZE] = {0}; EWRAM_DATA static u8 sTriedEvolving = 0; @@ -249,11 +249,9 @@ void (*gPreBattleCallback1)(void); void (*gBattleMainFunc)(void); struct BattleResults gBattleResults; u8 gLeveledUpInBattle; -void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(void); u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; u8 gMultiUsePlayerCursor; u8 gNumberOfMovesToChoose; -u8 gBattleControllerData[MAX_BATTLERS_COUNT]; // Used by the battle controllers to store misc sprite/task IDs for each battler static const struct ScanlineEffectParams sIntroScanlineParams16Bit = { @@ -537,19 +535,16 @@ static void CB2_InitBattleInternal(void) gBattle_WIN0V = WIN_RANGE(DISPLAY_HEIGHT / 2, DISPLAY_HEIGHT / 2 + 1); ScanlineEffect_Clear(); - i = 0; - while (i < 80) + for (i = 0; i < DISPLAY_HEIGHT / 2; i++) { gScanlineEffectRegBuffers[0][i] = 0xF0; gScanlineEffectRegBuffers[1][i] = 0xF0; - i++; } - while (i < 160) + for (; i < DISPLAY_HEIGHT; i++) { gScanlineEffectRegBuffers[0][i] = 0xFF10; gScanlineEffectRegBuffers[1][i] = 0xFF10; - i++; } ScanlineEffect_SetParams(sIntroScanlineParams16Bit); @@ -565,7 +560,12 @@ static void CB2_InitBattleInternal(void) gBattle_BG3_X = 0; gBattle_BG3_Y = 0; - gBattleTerrain = BattleSetup_GetTerrainId(); +#if DEBUG_OVERWORLD_MENU == TRUE + if (!gIsDebugBattle) +#endif + { + gBattleTerrain = BattleSetup_GetTerrainId(); + } if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) gBattleTerrain = BATTLE_TERRAIN_BUILDING; @@ -588,13 +588,18 @@ static void CB2_InitBattleInternal(void) else SetMainCallback2(CB2_HandleStartBattle); - if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED))) +#if DEBUG_OVERWORLD_MENU == TRUE + if (!gIsDebugBattle) +#endif { - CreateNPCTrainerParty(&gEnemyParty[0], gTrainerBattleOpponent_A, TRUE); - if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS && !BATTLE_TWO_VS_ONE_OPPONENT) - CreateNPCTrainerParty(&gEnemyParty[PARTY_SIZE / 2], gTrainerBattleOpponent_B, FALSE); - SetWildMonHeldItem(); - CalculateEnemyPartyCount(); + if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED))) + { + CreateNPCTrainerParty(&gEnemyParty[0], gTrainerBattleOpponent_A, TRUE); + if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS && !BATTLE_TWO_VS_ONE_OPPONENT) + CreateNPCTrainerParty(&gEnemyParty[PARTY_SIZE / 2], gTrainerBattleOpponent_B, FALSE); + SetWildMonHeldItem(); + CalculateEnemyPartyCount(); + } } gMain.inBattle = TRUE; @@ -745,7 +750,7 @@ static void SetAllPlayersBerryData(void) { s32 numPlayers; struct BattleEnigmaBerry *src; - u8 battlerId; + u32 battler; if (gBattleTypeFlags & BATTLE_TYPE_MULTI) { @@ -757,17 +762,17 @@ static void SetAllPlayersBerryData(void) for (i = 0; i < numPlayers; i++) { src = (struct BattleEnigmaBerry *)(gBlockRecvBuffer[i] + 2); - battlerId = gLinkPlayers[i].id; + battler = gLinkPlayers[i].id; for (j = 0; j < BERRY_NAME_LENGTH; j++) - gEnigmaBerries[battlerId].name[j] = src->name[j]; - gEnigmaBerries[battlerId].name[j] = EOS; + gEnigmaBerries[battler].name[j] = src->name[j]; + gEnigmaBerries[battler].name[j] = EOS; for (j = 0; j < BERRY_ITEM_EFFECT_COUNT; j++) - gEnigmaBerries[battlerId].itemEffect[j] = src->itemEffect[j]; + gEnigmaBerries[battler].itemEffect[j] = src->itemEffect[j]; - gEnigmaBerries[battlerId].holdEffect = src->holdEffect; - gEnigmaBerries[battlerId].holdEffectParam = src->holdEffectParam; + gEnigmaBerries[battler].holdEffect = src->holdEffect; + gEnigmaBerries[battler].holdEffectParam = src->holdEffectParam; } } else @@ -1883,33 +1888,8 @@ static u32 Crc32B (const u8 *data, u32 size) static u32 GeneratePartyHash(const struct Trainer *trainer, u32 i) { - const u8 *buffer; - u32 n; - if (trainer->partyFlags == 0) - { - buffer = (const u8 *) &trainer->party.NoItemDefaultMoves[i]; - n = sizeof(*trainer->party.NoItemDefaultMoves); - } - else if (trainer->partyFlags == F_TRAINER_PARTY_CUSTOM_MOVESET) - { - buffer = (const u8 *) &trainer->party.NoItemCustomMoves[i]; - n = sizeof(*trainer->party.NoItemCustomMoves); - } - else if (trainer->partyFlags == F_TRAINER_PARTY_HELD_ITEM) - { - buffer = (const u8 *) &trainer->party.ItemDefaultMoves[i]; - n = sizeof(*trainer->party.ItemDefaultMoves); - } - else if (trainer->partyFlags == (F_TRAINER_PARTY_HELD_ITEM | F_TRAINER_PARTY_CUSTOM_MOVESET)) - { - buffer = (const u8 *) &trainer->party.ItemCustomMoves[i]; - n = sizeof(*trainer->party.ItemCustomMoves); - } - else if (trainer->partyFlags == F_TRAINER_PARTY_EVERYTHING_CUSTOMIZED) - { - buffer = (const u8 *) &trainer->party.EverythingCustomized[i]; - n = sizeof(*trainer->party.EverythingCustomized); - } + const u8 *buffer = (const u8 *) &trainer->party[i]; + u32 n = sizeof(*trainer->party); return Crc32B(buffer, n); } @@ -1935,7 +1915,7 @@ u32 GeneratePersonalityForGender(u32 gender, u32 species) return speciesInfo->genderRatio / 2; } -void CustomTrainerPartyAssignMoves(struct Pokemon *mon, const struct TrainerMonCustomized *partyEntry) +void CustomTrainerPartyAssignMoves(struct Pokemon *mon, const struct TrainerMon *partyEntry) { bool32 noMoveSet = TRUE; u32 j; @@ -1987,6 +1967,10 @@ u8 CreateNPCTrainerPartyFromTrainer(struct Pokemon *party, const struct Trainer { s32 ball = -1; u32 personalityHash = GeneratePartyHash(trainer, i); + const struct TrainerMon *partyData = trainer->party; + u32 otIdType = OT_ID_RANDOM_NO_SHINY; + u32 fixedOtId = 0; + if (trainer->doubleBattle == TRUE) personalityValue = 0x80; else if (trainer->encounterMusic_gender & F_TRAINER_FEMALE) @@ -1995,107 +1979,54 @@ u8 CreateNPCTrainerPartyFromTrainer(struct Pokemon *party, const struct Trainer personalityValue = 0x88; // Use personality more likely to result in a male Pokémon personalityValue += personalityHash << 8; - switch (trainer->partyFlags) - { - case 0: + if (partyData[i].gender == TRAINER_MON_MALE) + personalityValue = (personalityValue & 0xFFFFFF00) | GeneratePersonalityForGender(MON_MALE, partyData[i].species); + else if (partyData[i].gender == TRAINER_MON_FEMALE) + personalityValue = (personalityValue & 0xFFFFFF00) | GeneratePersonalityForGender(MON_FEMALE, partyData[i].species); + if (partyData[i].nature != 0) + ModifyPersonalityForNature(&personalityValue, partyData[i].nature - 1); + if (partyData[i].isShiny) { - const struct TrainerMonNoItemDefaultMoves *partyData = trainer->party.NoItemDefaultMoves; - fixedIV = partyData[i].iv * MAX_PER_STAT_IVS / 255; - CreateMon(&party[i], partyData[i].species, partyData[i].lvl, fixedIV, TRUE, personalityValue, OT_ID_RANDOM_NO_SHINY, 0); - break; + otIdType = OT_ID_PRESET; + fixedOtId = HIHALF(personalityValue) ^ LOHALF(personalityValue); } - case F_TRAINER_PARTY_CUSTOM_MOVESET: - { - const struct TrainerMonNoItemCustomMoves *partyData = trainer->party.NoItemCustomMoves; - fixedIV = partyData[i].iv * MAX_PER_STAT_IVS / 255; - CreateMon(&party[i], partyData[i].species, partyData[i].lvl, fixedIV, TRUE, personalityValue, OT_ID_RANDOM_NO_SHINY, 0); + CreateMon(&party[i], partyData[i].species, partyData[i].lvl, 0, TRUE, personalityValue, otIdType, fixedOtId); + SetMonData(&party[i], MON_DATA_HELD_ITEM, &partyData[i].heldItem); - for (j = 0; j < MAX_MON_MOVES; j++) - { - SetMonData(&party[i], MON_DATA_MOVE1 + j, &partyData[i].moves[j]); - SetMonData(&party[i], MON_DATA_PP1 + j, &gBattleMoves[partyData[i].moves[j]].pp); - } - break; - } - case F_TRAINER_PARTY_HELD_ITEM: + CustomTrainerPartyAssignMoves(&party[i], &partyData[i]); + SetMonData(&party[i], MON_DATA_IVS, &(partyData[i].iv)); + if (partyData[i].ev != NULL) { - const struct TrainerMonItemDefaultMoves *partyData = trainer->party.ItemDefaultMoves; - fixedIV = partyData[i].iv * MAX_PER_STAT_IVS / 255; - CreateMon(&party[i], partyData[i].species, partyData[i].lvl, fixedIV, TRUE, personalityValue, OT_ID_RANDOM_NO_SHINY, 0); - - SetMonData(&party[i], MON_DATA_HELD_ITEM, &partyData[i].heldItem); - break; + SetMonData(&party[i], MON_DATA_HP_EV, &(partyData[i].ev[0])); + SetMonData(&party[i], MON_DATA_ATK_EV, &(partyData[i].ev[1])); + SetMonData(&party[i], MON_DATA_DEF_EV, &(partyData[i].ev[2])); + SetMonData(&party[i], MON_DATA_SPATK_EV, &(partyData[i].ev[3])); + SetMonData(&party[i], MON_DATA_SPDEF_EV, &(partyData[i].ev[4])); + SetMonData(&party[i], MON_DATA_SPEED_EV, &(partyData[i].ev[5])); } - case F_TRAINER_PARTY_CUSTOM_MOVESET | F_TRAINER_PARTY_HELD_ITEM: + if (partyData[i].ability != ABILITY_NONE) { - const struct TrainerMonItemCustomMoves *partyData = trainer->party.ItemCustomMoves; - fixedIV = partyData[i].iv * MAX_PER_STAT_IVS / 255; - CreateMon(&party[i], partyData[i].species, partyData[i].lvl, fixedIV, TRUE, personalityValue, OT_ID_RANDOM_NO_SHINY, 0); - - SetMonData(&party[i], MON_DATA_HELD_ITEM, &partyData[i].heldItem); - - for (j = 0; j < MAX_MON_MOVES; j++) + const struct SpeciesInfo *speciesInfo = &gSpeciesInfo[partyData[i].species]; + u32 maxAbilities = ARRAY_COUNT(speciesInfo->abilities); + for (j = 0; j < maxAbilities; ++j) { - SetMonData(&party[i], MON_DATA_MOVE1 + j, &partyData[i].moves[j]); - SetMonData(&party[i], MON_DATA_PP1 + j, &gBattleMoves[partyData[i].moves[j]].pp); + if (speciesInfo->abilities[j] == partyData[i].ability) + break; } - break; + if (j < maxAbilities) + SetMonData(&party[i], MON_DATA_ABILITY_NUM, &j); } - case F_TRAINER_PARTY_EVERYTHING_CUSTOMIZED: + SetMonData(&party[i], MON_DATA_FRIENDSHIP, &(partyData[i].friendship)); + if (partyData[i].ball != ITEM_NONE) { - const struct TrainerMonCustomized *partyData = trainer->party.EverythingCustomized; - u32 otIdType = OT_ID_RANDOM_NO_SHINY; - u32 fixedOtId = 0; - if (partyData[i].gender == TRAINER_MON_MALE) - personalityValue = (personalityValue & 0xFFFFFF00) | GeneratePersonalityForGender(MON_MALE, partyData[i].species); - else if (partyData[i].gender == TRAINER_MON_FEMALE) - personalityValue = (personalityValue & 0xFFFFFF00) | GeneratePersonalityForGender(MON_FEMALE, partyData[i].species); - if (partyData[i].nature != 0) - ModifyPersonalityForNature(&personalityValue, partyData[i].nature - 1); - if (partyData[i].isShiny) - { - otIdType = OT_ID_PRESET; - fixedOtId = HIHALF(personalityValue) ^ LOHALF(personalityValue); - } - CreateMon(&party[i], partyData[i].species, partyData[i].lvl, 0, TRUE, personalityValue, otIdType, fixedOtId); - SetMonData(&party[i], MON_DATA_HELD_ITEM, &partyData[i].heldItem); - - CustomTrainerPartyAssignMoves(&party[i], &partyData[i]); - SetMonData(&party[i], MON_DATA_IVS, &(partyData[i].iv)); - if (partyData[i].ev != NULL) - { - SetMonData(&party[i], MON_DATA_HP_EV, &(partyData[i].ev[0])); - SetMonData(&party[i], MON_DATA_ATK_EV, &(partyData[i].ev[1])); - SetMonData(&party[i], MON_DATA_DEF_EV, &(partyData[i].ev[2])); - SetMonData(&party[i], MON_DATA_SPATK_EV, &(partyData[i].ev[3])); - SetMonData(&party[i], MON_DATA_SPDEF_EV, &(partyData[i].ev[4])); - SetMonData(&party[i], MON_DATA_SPEED_EV, &(partyData[i].ev[5])); - } - if (partyData[i].ability != ABILITY_NONE) - { - const struct SpeciesInfo *speciesInfo = &gSpeciesInfo[partyData[i].species]; - u32 maxAbilities = ARRAY_COUNT(speciesInfo->abilities); - for (j = 0; j < maxAbilities; ++j) - { - if (speciesInfo->abilities[j] == partyData[i].ability) - break; - } - if (j < maxAbilities) - SetMonData(&party[i], MON_DATA_ABILITY_NUM, &j); - } - SetMonData(&party[i], MON_DATA_FRIENDSHIP, &(partyData[i].friendship)); - if (partyData[i].ball != ITEM_NONE) - { - ball = partyData[i].ball; - SetMonData(&party[i], MON_DATA_POKEBALL, &ball); - } - if (partyData[i].nickname != NULL) - { - SetMonData(&party[i], MON_DATA_NICKNAME, partyData[i].nickname); - } - CalculateMonStats(&party[i]); + ball = partyData[i].ball; + SetMonData(&party[i], MON_DATA_POKEBALL, &ball); } + if (partyData[i].nickname != NULL) + { + SetMonData(&party[i], MON_DATA_NICKNAME, partyData[i].nickname); } + CalculateMonStats(&party[i]); #if B_TRAINER_CLASS_POKE_BALLS >= GEN_7 if (ball == -1) @@ -2126,6 +2057,13 @@ static u8 CreateNPCTrainerParty(struct Pokemon *party, u16 trainerNum, bool8 fir return retVal; } +void CreateTrainerPartyForPlayer(void) +{ + ZeroPlayerPartyMons(); + gPartnerTrainerId = gSpecialVar_0x8004; + CreateNPCTrainerPartyFromTrainer(gPlayerParty, &gTrainers[gSpecialVar_0x8004], TRUE, BATTLE_TYPE_TRAINER); +} + void VBlankCB_Battle(void) { // Change gRngSeed every vblank unless the battle could be recorded. @@ -2329,7 +2267,7 @@ static void EndLinkBattleInSteps(void) case 2: if (!gPaletteFade.active) { - u8 battlerCount; + u32 battlerCount; gMain.anyLinkBattlerHasFrontierPass = RecordedBattle_GetFrontierPassFlag(); @@ -2783,7 +2721,6 @@ static void SpriteCB_Flicker(struct Sprite *sprite) #undef sDelay extern const struct MonCoords gMonFrontPicCoords[]; -extern const struct MonCoords gCastformFrontSpriteCoords[]; void SpriteCB_FaintOpponentMon(struct Sprite *sprite) { @@ -2797,17 +2734,11 @@ void SpriteCB_FaintOpponentMon(struct Sprite *sprite) else species = sprite->sSpeciesId; - GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_PERSONALITY); // Unused return value. - if (species == SPECIES_UNOWN) { species = GetUnownSpeciesId(personality); yOffset = gMonFrontPicCoords[species].y_offset; } - else if (species == SPECIES_CASTFORM) - { - yOffset = gCastformFrontSpriteCoords[gBattleMonForms[battler]].y_offset; - } else if (species > NUM_SPECIES) { yOffset = gMonFrontPicCoords[SPECIES_NONE].y_offset; @@ -2837,12 +2768,12 @@ static void SpriteCB_AnimFaintOpponent(struct Sprite *sprite) } else // Erase bottom part of the sprite to create a smooth illusion of mon falling down. { - u8 *dst = gMonSpritesGfxPtr->sprites.byte[GetBattlerPosition(sprite->sBattler)] + (gBattleMonForms[sprite->sBattler] << 11) + (sprite->data[3] << 8); + u8 *dst = gMonSpritesGfxPtr->sprites.byte[GetBattlerPosition(sprite->sBattler)] + (sprite->data[3] << 8); for (i = 0; i < 0x100; i++) *(dst++) = 0; - StartSpriteAnim(sprite, gBattleMonForms[sprite->sBattler]); + StartSpriteAnim(sprite, 0); } } } @@ -3061,10 +2992,11 @@ void BeginBattleIntro(void) static void BattleMainCB1(void) { - gBattleMainFunc(); + u32 battler; - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) - gBattlerControllerFuncs[gActiveBattler](); + gBattleMainFunc(); + for (battler = 0; battler < gBattlersCount; battler++) + gBattlerControllerFuncs[battler](battler); } static void BattleStartClearSetData(void) @@ -3115,6 +3047,9 @@ static void BattleStartClearSetData(void) gBattlerAttacker = 0; gBattlerTarget = 0; + gEffectBattler = 0; + gBattleScripting.battler = 0; + gBattlerAbility = 0; gBattleWeather = 0; gHitMarker = 0; @@ -3169,6 +3104,7 @@ static void BattleStartClearSetData(void) gBattleStruct->arenaLostOpponentMons = 0; gBattleStruct->mega.triggerSpriteId = 0xFF; + gBattleStruct->burst.triggerSpriteId = 0xFF; for (i = 0; i < ARRAY_COUNT(gSideTimers); i++) { @@ -3191,21 +3127,21 @@ static void BattleStartClearSetData(void) gSelectedMonPartyId = PARTY_SIZE; // Revival Blessing } -void SwitchInClearSetData(void) +void SwitchInClearSetData(u32 battler) { s32 i; - struct DisableStruct disableStructCopy = gDisableStructs[gActiveBattler]; + struct DisableStruct disableStructCopy = gDisableStructs[battler]; - ClearIllusionMon(gActiveBattler); + ClearIllusionMon(battler); if (gBattleMoves[gCurrentMove].effect != EFFECT_BATON_PASS) { for (i = 0; i < NUM_BATTLE_STATS; i++) - gBattleMons[gActiveBattler].statStages[i] = DEFAULT_STAT_STAGE; + gBattleMons[battler].statStages[i] = DEFAULT_STAT_STAGE; for (i = 0; i < gBattlersCount; i++) { - if ((gBattleMons[i].status2 & STATUS2_ESCAPE_PREVENTION) && gDisableStructs[i].battlerPreventingEscape == gActiveBattler) + if ((gBattleMons[i].status2 & STATUS2_ESCAPE_PREVENTION) && gDisableStructs[i].battlerPreventingEscape == battler) gBattleMons[i].status2 &= ~STATUS2_ESCAPE_PREVENTION; - if ((gStatuses3[i] & STATUS3_ALWAYS_HITS) && gDisableStructs[i].battlerWithSureHit == gActiveBattler) + if ((gStatuses3[i] & STATUS3_ALWAYS_HITS) && gDisableStructs[i].battlerWithSureHit == battler) { gStatuses3[i] &= ~STATUS3_ALWAYS_HITS; gDisableStructs[i].battlerWithSureHit = 0; @@ -3214,96 +3150,96 @@ void SwitchInClearSetData(void) } if (gBattleMoves[gCurrentMove].effect == EFFECT_BATON_PASS) { - gBattleMons[gActiveBattler].status2 &= (STATUS2_CONFUSION | STATUS2_FOCUS_ENERGY | STATUS2_SUBSTITUTE | STATUS2_ESCAPE_PREVENTION | STATUS2_CURSED); - gStatuses3[gActiveBattler] &= (STATUS3_LEECHSEED_BATTLER | STATUS3_LEECHSEED | STATUS3_ALWAYS_HITS | STATUS3_PERISH_SONG | STATUS3_ROOTED + gBattleMons[battler].status2 &= (STATUS2_CONFUSION | STATUS2_FOCUS_ENERGY | STATUS2_SUBSTITUTE | STATUS2_ESCAPE_PREVENTION | STATUS2_CURSED); + gStatuses3[battler] &= (STATUS3_LEECHSEED_BATTLER | STATUS3_LEECHSEED | STATUS3_ALWAYS_HITS | STATUS3_PERISH_SONG | STATUS3_ROOTED | STATUS3_GASTRO_ACID | STATUS3_EMBARGO | STATUS3_TELEKINESIS | STATUS3_MAGNET_RISE | STATUS3_HEAL_BLOCK | STATUS3_AQUA_RING | STATUS3_POWER_TRICK); - gStatuses4[gActiveBattler] &= (STATUS4_MUD_SPORT | STATUS4_WATER_SPORT | STATUS4_INFINITE_CONFUSION); + gStatuses4[battler] &= (STATUS4_MUD_SPORT | STATUS4_WATER_SPORT | STATUS4_INFINITE_CONFUSION); for (i = 0; i < gBattlersCount; i++) { - if (GetBattlerSide(gActiveBattler) != GetBattlerSide(i) + if (GetBattlerSide(battler) != GetBattlerSide(i) && (gStatuses3[i] & STATUS3_ALWAYS_HITS) != 0 - && (gDisableStructs[i].battlerWithSureHit == gActiveBattler)) + && (gDisableStructs[i].battlerWithSureHit == battler)) { gStatuses3[i] &= ~STATUS3_ALWAYS_HITS; gStatuses3[i] |= STATUS3_ALWAYS_HITS_TURN(2); } } - if (gStatuses3[gActiveBattler] & STATUS3_POWER_TRICK) - SWAP(gBattleMons[gActiveBattler].attack, gBattleMons[gActiveBattler].defense, i); + if (gStatuses3[battler] & STATUS3_POWER_TRICK) + SWAP(gBattleMons[battler].attack, gBattleMons[battler].defense, i); } else { - gBattleMons[gActiveBattler].status2 = 0; - gStatuses3[gActiveBattler] = 0; - gStatuses4[gActiveBattler] = 0; + gBattleMons[battler].status2 = 0; + gStatuses3[battler] = 0; + gStatuses4[battler] = 0; } for (i = 0; i < gBattlersCount; i++) { - if (gBattleMons[i].status2 & STATUS2_INFATUATED_WITH(gActiveBattler)) - gBattleMons[i].status2 &= ~STATUS2_INFATUATED_WITH(gActiveBattler); - if ((gBattleMons[i].status2 & STATUS2_WRAPPED) && *(gBattleStruct->wrappedBy + i) == gActiveBattler) + if (gBattleMons[i].status2 & STATUS2_INFATUATED_WITH(battler)) + gBattleMons[i].status2 &= ~STATUS2_INFATUATED_WITH(battler); + if ((gBattleMons[i].status2 & STATUS2_WRAPPED) && *(gBattleStruct->wrappedBy + i) == battler) gBattleMons[i].status2 &= ~STATUS2_WRAPPED; } - gActionSelectionCursor[gActiveBattler] = 0; - gMoveSelectionCursor[gActiveBattler] = 0; + gActionSelectionCursor[battler] = 0; + gMoveSelectionCursor[battler] = 0; - memset(&gDisableStructs[gActiveBattler], 0, sizeof(struct DisableStruct)); + memset(&gDisableStructs[battler], 0, sizeof(struct DisableStruct)); if (gBattleMoves[gCurrentMove].effect == EFFECT_BATON_PASS) { - gDisableStructs[gActiveBattler].substituteHP = disableStructCopy.substituteHP; - gDisableStructs[gActiveBattler].battlerWithSureHit = disableStructCopy.battlerWithSureHit; - gDisableStructs[gActiveBattler].perishSongTimer = disableStructCopy.perishSongTimer; - gDisableStructs[gActiveBattler].battlerPreventingEscape = disableStructCopy.battlerPreventingEscape; + gDisableStructs[battler].substituteHP = disableStructCopy.substituteHP; + gDisableStructs[battler].battlerWithSureHit = disableStructCopy.battlerWithSureHit; + gDisableStructs[battler].perishSongTimer = disableStructCopy.perishSongTimer; + gDisableStructs[battler].battlerPreventingEscape = disableStructCopy.battlerPreventingEscape; } gMoveResultFlags = 0; - gDisableStructs[gActiveBattler].isFirstTurn = 2; - gDisableStructs[gActiveBattler].truantSwitchInHack = disableStructCopy.truantSwitchInHack; - gLastMoves[gActiveBattler] = MOVE_NONE; - gLastLandedMoves[gActiveBattler] = MOVE_NONE; - gLastHitByType[gActiveBattler] = 0; - gLastResultingMoves[gActiveBattler] = MOVE_NONE; - gLastPrintedMoves[gActiveBattler] = MOVE_NONE; - gLastHitBy[gActiveBattler] = 0xFF; - - gBattleStruct->lastTakenMove[gActiveBattler] = 0; - gBattleStruct->sameMoveTurns[gActiveBattler] = 0; - gBattleStruct->lastTakenMoveFrom[gActiveBattler][0] = 0; - gBattleStruct->lastTakenMoveFrom[gActiveBattler][1] = 0; - gBattleStruct->lastTakenMoveFrom[gActiveBattler][2] = 0; - gBattleStruct->lastTakenMoveFrom[gActiveBattler][3] = 0; - gBattleStruct->lastMoveFailed &= ~(gBitTable[gActiveBattler]); - gBattleStruct->palaceFlags &= ~(gBitTable[gActiveBattler]); + gDisableStructs[battler].isFirstTurn = 2; + gDisableStructs[battler].truantSwitchInHack = disableStructCopy.truantSwitchInHack; + gLastMoves[battler] = MOVE_NONE; + gLastLandedMoves[battler] = MOVE_NONE; + gLastHitByType[battler] = 0; + gLastResultingMoves[battler] = MOVE_NONE; + gLastPrintedMoves[battler] = MOVE_NONE; + gLastHitBy[battler] = 0xFF; + + gBattleStruct->lastTakenMove[battler] = 0; + gBattleStruct->sameMoveTurns[battler] = 0; + gBattleStruct->lastTakenMoveFrom[battler][0] = 0; + gBattleStruct->lastTakenMoveFrom[battler][1] = 0; + gBattleStruct->lastTakenMoveFrom[battler][2] = 0; + gBattleStruct->lastTakenMoveFrom[battler][3] = 0; + gBattleStruct->lastMoveFailed &= ~(gBitTable[battler]); + gBattleStruct->palaceFlags &= ~(gBitTable[battler]); for (i = 0; i < ARRAY_COUNT(gSideTimers); i++) { // Switched into sticky web user slot, so reset stored battler ID - if (gSideTimers[i].stickyWebBattlerId == gActiveBattler) + if (gSideTimers[i].stickyWebBattlerId == battler) gSideTimers[i].stickyWebBattlerId = 0xFF; } for (i = 0; i < gBattlersCount; i++) { - if (i != gActiveBattler && GetBattlerSide(i) != GetBattlerSide(gActiveBattler)) + if (i != battler && GetBattlerSide(i) != GetBattlerSide(battler)) gBattleStruct->lastTakenMove[i] = MOVE_NONE; - gBattleStruct->lastTakenMoveFrom[i][gActiveBattler] = 0; + gBattleStruct->lastTakenMoveFrom[i][battler] = 0; } - gBattleStruct->choicedMove[gActiveBattler] = MOVE_NONE; - gBattleResources->flags->flags[gActiveBattler] = 0; + gBattleStruct->choicedMove[battler] = MOVE_NONE; + gBattleResources->flags->flags[battler] = 0; gCurrentMove = MOVE_NONE; gBattleStruct->arenaTurnCounter = 0xFF; // Reset damage to prevent things like red card activating if the switched-in mon is holding it - gSpecialStatuses[gActiveBattler].physicalDmg = 0; - gSpecialStatuses[gActiveBattler].specialDmg = 0; + gSpecialStatuses[battler].physicalDmg = 0; + gSpecialStatuses[battler].specialDmg = 0; - gBattleStruct->overwrittenAbilities[gActiveBattler] = ABILITY_NONE; + gBattleStruct->overwrittenAbilities[battler] = ABILITY_NONE; // Clear selected party ID so Revival Blessing doesn't get confused. gSelectedMonPartyId = PARTY_SIZE; @@ -3311,126 +3247,126 @@ void SwitchInClearSetData(void) // Allow for illegal abilities within tests. if (gTestRunnerEnabled) { - u32 side = GetBattlerSide(gActiveBattler); - u32 partyIndex = gBattlerPartyIndexes[gActiveBattler]; + u32 side = GetBattlerSide(battler); + u32 partyIndex = gBattlerPartyIndexes[battler]; if (TestRunner_Battle_GetForcedAbility(side, partyIndex)) gBattleMons[i].ability = gBattleStruct->overwrittenAbilities[i] = TestRunner_Battle_GetForcedAbility(side, partyIndex); } - Ai_UpdateSwitchInData(gActiveBattler); + Ai_UpdateSwitchInData(battler); } -void FaintClearSetData(void) +void FaintClearSetData(u32 battler) { s32 i; for (i = 0; i < NUM_BATTLE_STATS; i++) - gBattleMons[gActiveBattler].statStages[i] = DEFAULT_STAT_STAGE; + gBattleMons[battler].statStages[i] = DEFAULT_STAT_STAGE; - gBattleMons[gActiveBattler].status2 = 0; - gStatuses3[gActiveBattler] = 0; - gStatuses4[gActiveBattler] = 0; + gBattleMons[battler].status2 = 0; + gStatuses3[battler] = 0; + gStatuses4[battler] = 0; for (i = 0; i < gBattlersCount; i++) { - if ((gBattleMons[i].status2 & STATUS2_ESCAPE_PREVENTION) && gDisableStructs[i].battlerPreventingEscape == gActiveBattler) + if ((gBattleMons[i].status2 & STATUS2_ESCAPE_PREVENTION) && gDisableStructs[i].battlerPreventingEscape == battler) gBattleMons[i].status2 &= ~STATUS2_ESCAPE_PREVENTION; - if (gBattleMons[i].status2 & STATUS2_INFATUATED_WITH(gActiveBattler)) - gBattleMons[i].status2 &= ~STATUS2_INFATUATED_WITH(gActiveBattler); - if ((gBattleMons[i].status2 & STATUS2_WRAPPED) && *(gBattleStruct->wrappedBy + i) == gActiveBattler) + if (gBattleMons[i].status2 & STATUS2_INFATUATED_WITH(battler)) + gBattleMons[i].status2 &= ~STATUS2_INFATUATED_WITH(battler); + if ((gBattleMons[i].status2 & STATUS2_WRAPPED) && *(gBattleStruct->wrappedBy + i) == battler) gBattleMons[i].status2 &= ~STATUS2_WRAPPED; } - gActionSelectionCursor[gActiveBattler] = 0; - gMoveSelectionCursor[gActiveBattler] = 0; - - memset(&gDisableStructs[gActiveBattler], 0, sizeof(struct DisableStruct)); - - gProtectStructs[gActiveBattler].protected = FALSE; - gProtectStructs[gActiveBattler].spikyShielded = FALSE; - gProtectStructs[gActiveBattler].kingsShielded = FALSE; - gProtectStructs[gActiveBattler].banefulBunkered = FALSE; - gProtectStructs[gActiveBattler].quash = FALSE; - gProtectStructs[gActiveBattler].obstructed = FALSE; - gProtectStructs[gActiveBattler].silkTrapped = FALSE; - gProtectStructs[gActiveBattler].endured = FALSE; - gProtectStructs[gActiveBattler].noValidMoves = FALSE; - gProtectStructs[gActiveBattler].helpingHand = FALSE; - gProtectStructs[gActiveBattler].bounceMove = FALSE; - gProtectStructs[gActiveBattler].stealMove = FALSE; - gProtectStructs[gActiveBattler].prlzImmobility = FALSE; - gProtectStructs[gActiveBattler].confusionSelfDmg = FALSE; - gProtectStructs[gActiveBattler].targetAffected = FALSE; - gProtectStructs[gActiveBattler].chargingTurn = FALSE; - gProtectStructs[gActiveBattler].fleeType = 0; - gProtectStructs[gActiveBattler].usedImprisonedMove = FALSE; - gProtectStructs[gActiveBattler].loveImmobility = FALSE; - gProtectStructs[gActiveBattler].usedDisabledMove = FALSE; - gProtectStructs[gActiveBattler].usedTauntedMove = FALSE; - gProtectStructs[gActiveBattler].flag2Unknown = FALSE; - gProtectStructs[gActiveBattler].flinchImmobility = FALSE; - gProtectStructs[gActiveBattler].notFirstStrike = FALSE; - gProtectStructs[gActiveBattler].usedHealBlockedMove = FALSE; - gProtectStructs[gActiveBattler].usesBouncedMove = FALSE; - gProtectStructs[gActiveBattler].usedGravityPreventedMove = FALSE; - gProtectStructs[gActiveBattler].usedThroatChopPreventedMove = FALSE; - gProtectStructs[gActiveBattler].statRaised = FALSE; - gProtectStructs[gActiveBattler].statFell = FALSE; - gProtectStructs[gActiveBattler].pranksterElevated = FALSE; - - gDisableStructs[gActiveBattler].isFirstTurn = 2; - - gLastMoves[gActiveBattler] = MOVE_NONE; - gLastLandedMoves[gActiveBattler] = MOVE_NONE; - gLastHitByType[gActiveBattler] = 0; - gLastResultingMoves[gActiveBattler] = MOVE_NONE; - gLastPrintedMoves[gActiveBattler] = MOVE_NONE; - gLastHitBy[gActiveBattler] = 0xFF; - - gBattleStruct->choicedMove[gActiveBattler] = MOVE_NONE; - gBattleStruct->sameMoveTurns[gActiveBattler] = 0; - gBattleStruct->lastTakenMove[gActiveBattler] = MOVE_NONE; - gBattleStruct->lastTakenMoveFrom[gActiveBattler][0] = 0; - gBattleStruct->lastTakenMoveFrom[gActiveBattler][1] = 0; - gBattleStruct->lastTakenMoveFrom[gActiveBattler][2] = 0; - gBattleStruct->lastTakenMoveFrom[gActiveBattler][3] = 0; - - gBattleStruct->palaceFlags &= ~(gBitTable[gActiveBattler]); + gActionSelectionCursor[battler] = 0; + gMoveSelectionCursor[battler] = 0; + + memset(&gDisableStructs[battler], 0, sizeof(struct DisableStruct)); + + gProtectStructs[battler].protected = FALSE; + gProtectStructs[battler].spikyShielded = FALSE; + gProtectStructs[battler].kingsShielded = FALSE; + gProtectStructs[battler].banefulBunkered = FALSE; + gProtectStructs[battler].quash = FALSE; + gProtectStructs[battler].obstructed = FALSE; + gProtectStructs[battler].silkTrapped = FALSE; + gProtectStructs[battler].endured = FALSE; + gProtectStructs[battler].noValidMoves = FALSE; + gProtectStructs[battler].helpingHand = FALSE; + gProtectStructs[battler].bounceMove = FALSE; + gProtectStructs[battler].stealMove = FALSE; + gProtectStructs[battler].prlzImmobility = FALSE; + gProtectStructs[battler].confusionSelfDmg = FALSE; + gProtectStructs[battler].targetAffected = FALSE; + gProtectStructs[battler].chargingTurn = FALSE; + gProtectStructs[battler].fleeType = 0; + gProtectStructs[battler].usedImprisonedMove = FALSE; + gProtectStructs[battler].loveImmobility = FALSE; + gProtectStructs[battler].usedDisabledMove = FALSE; + gProtectStructs[battler].usedTauntedMove = FALSE; + gProtectStructs[battler].flag2Unknown = FALSE; + gProtectStructs[battler].flinchImmobility = FALSE; + gProtectStructs[battler].notFirstStrike = FALSE; + gProtectStructs[battler].usedHealBlockedMove = FALSE; + gProtectStructs[battler].usesBouncedMove = FALSE; + gProtectStructs[battler].usedGravityPreventedMove = FALSE; + gProtectStructs[battler].usedThroatChopPreventedMove = FALSE; + gProtectStructs[battler].statRaised = FALSE; + gProtectStructs[battler].statFell = FALSE; + gProtectStructs[battler].pranksterElevated = FALSE; + + gDisableStructs[battler].isFirstTurn = 2; + + gLastMoves[battler] = MOVE_NONE; + gLastLandedMoves[battler] = MOVE_NONE; + gLastHitByType[battler] = 0; + gLastResultingMoves[battler] = MOVE_NONE; + gLastPrintedMoves[battler] = MOVE_NONE; + gLastHitBy[battler] = 0xFF; + + gBattleStruct->choicedMove[battler] = MOVE_NONE; + gBattleStruct->sameMoveTurns[battler] = 0; + gBattleStruct->lastTakenMove[battler] = MOVE_NONE; + gBattleStruct->lastTakenMoveFrom[battler][0] = 0; + gBattleStruct->lastTakenMoveFrom[battler][1] = 0; + gBattleStruct->lastTakenMoveFrom[battler][2] = 0; + gBattleStruct->lastTakenMoveFrom[battler][3] = 0; + + gBattleStruct->palaceFlags &= ~(gBitTable[battler]); for (i = 0; i < ARRAY_COUNT(gSideTimers); i++) { // User of sticky web fainted, so reset the stored battler ID - if (gSideTimers[i].stickyWebBattlerId == gActiveBattler) + if (gSideTimers[i].stickyWebBattlerId == battler) gSideTimers[i].stickyWebBattlerId = 0xFF; } for (i = 0; i < gBattlersCount; i++) { - if (i != gActiveBattler && GetBattlerSide(i) != GetBattlerSide(gActiveBattler)) + if (i != battler && GetBattlerSide(i) != GetBattlerSide(battler)) gBattleStruct->lastTakenMove[i] = MOVE_NONE; - gBattleStruct->lastTakenMoveFrom[i][gActiveBattler] = 0; + gBattleStruct->lastTakenMoveFrom[i][battler] = 0; } - gBattleResources->flags->flags[gActiveBattler] = 0; + gBattleResources->flags->flags[battler] = 0; - gBattleMons[gActiveBattler].type1 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0]; - gBattleMons[gActiveBattler].type2 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1]; - gBattleMons[gActiveBattler].type3 = TYPE_MYSTERY; + gBattleMons[battler].type1 = gSpeciesInfo[gBattleMons[battler].species].types[0]; + gBattleMons[battler].type2 = gSpeciesInfo[gBattleMons[battler].species].types[1]; + gBattleMons[battler].type3 = TYPE_MYSTERY; - Ai_UpdateFaintData(gActiveBattler); - TryBattleFormChange(gActiveBattler, FORM_CHANGE_FAINT); + Ai_UpdateFaintData(battler); + TryBattleFormChange(battler, FORM_CHANGE_FAINT); - gBattleStruct->overwrittenAbilities[gActiveBattler] = ABILITY_NONE; + gBattleStruct->overwrittenAbilities[battler] = ABILITY_NONE; // If the fainted mon was involved in a Sky Drop - if (gBattleStruct->skyDropTargets[gActiveBattler] != 0xFF) + if (gBattleStruct->skyDropTargets[battler] != 0xFF) { // Get battler id of the other Pokemon involved in this Sky Drop - u8 otherSkyDropper = gBattleStruct->skyDropTargets[gActiveBattler]; + u8 otherSkyDropper = gBattleStruct->skyDropTargets[battler]; // Clear Sky Drop data - gBattleStruct->skyDropTargets[gActiveBattler] = 0xFF; + gBattleStruct->skyDropTargets[battler] = 0xFF; gBattleStruct->skyDropTargets[otherSkyDropper] = 0xFF; // If the other Pokemon involved in this Sky Drop was the target, not the attacker @@ -3464,21 +3400,22 @@ void FaintClearSetData(void) // Clear Z-Move data gBattleStruct->zmove.active = FALSE; - gBattleStruct->zmove.toBeUsed[gActiveBattler] = MOVE_NONE; + gBattleStruct->zmove.toBeUsed[battler] = MOVE_NONE; gBattleStruct->zmove.effect = EFFECT_HIT; } static void DoBattleIntro(void) { s32 i; + u32 battler; u8 *state = &gBattleStruct->introState; switch (*state) { case 0: // Get Data of all battlers. - gActiveBattler = gBattleCommunication[1]; - BtlController_EmitGetMonData(BUFFER_A, REQUEST_ALL_BATTLE, 0); - MarkBattlerForControllerExec(gActiveBattler); + battler = gBattleCommunication[1]; + BtlController_EmitGetMonData(battler, BUFFER_A, REQUEST_ALL_BATTLE, 0); + MarkBattlerForControllerExec(battler); (*state)++; break; case 1: // Loop through all battlers. @@ -3493,9 +3430,9 @@ static void DoBattleIntro(void) case 2: // Start graphical intro slide. if (!gBattleControllerExecFlags) { - gActiveBattler = GetBattlerAtPosition(0); - BtlController_EmitIntroSlide(BUFFER_A, gBattleTerrain); - MarkBattlerForControllerExec(gActiveBattler); + battler = GetBattlerAtPosition(0); + BtlController_EmitIntroSlide(battler, BUFFER_A, gBattleTerrain); + MarkBattlerForControllerExec(battler); gBattleCommunication[0] = 0; gBattleCommunication[1] = 0; (*state)++; @@ -3506,50 +3443,50 @@ static void DoBattleIntro(void) (*state)++; break; case 4: // Copy battler data gotten in cases 0 and 1. Draw trainer/mon sprite. - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) + for (battler = 0; battler < gBattlersCount; battler++) { - if ((gBattleTypeFlags & BATTLE_TYPE_SAFARI) && GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) + if ((gBattleTypeFlags & BATTLE_TYPE_SAFARI) && GetBattlerSide(battler) == B_SIDE_PLAYER) { - memset(&gBattleMons[gActiveBattler], 0, sizeof(struct BattlePokemon)); + memset(&gBattleMons[battler], 0, sizeof(struct BattlePokemon)); } else { - memcpy(&gBattleMons[gActiveBattler], &gBattleResources->bufferB[gActiveBattler][4], sizeof(struct BattlePokemon)); - gBattleMons[gActiveBattler].type1 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0]; - gBattleMons[gActiveBattler].type2 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1]; - gBattleMons[gActiveBattler].type3 = TYPE_MYSTERY; - gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].abilityNum); - gBattleStruct->hpOnSwitchout[GetBattlerSide(gActiveBattler)] = gBattleMons[gActiveBattler].hp; - gBattleMons[gActiveBattler].status2 = 0; + memcpy(&gBattleMons[battler], &gBattleResources->bufferB[battler][4], sizeof(struct BattlePokemon)); + gBattleMons[battler].type1 = gSpeciesInfo[gBattleMons[battler].species].types[0]; + gBattleMons[battler].type2 = gSpeciesInfo[gBattleMons[battler].species].types[1]; + gBattleMons[battler].type3 = TYPE_MYSTERY; + gBattleMons[battler].ability = GetAbilityBySpecies(gBattleMons[battler].species, gBattleMons[battler].abilityNum); + gBattleStruct->hpOnSwitchout[GetBattlerSide(battler)] = gBattleMons[battler].hp; + gBattleMons[battler].status2 = 0; for (i = 0; i < NUM_BATTLE_STATS; i++) - gBattleMons[gActiveBattler].statStages[i] = DEFAULT_STAT_STAGE; + gBattleMons[battler].statStages[i] = DEFAULT_STAT_STAGE; } // Draw sprite. - switch (GetBattlerPosition(gActiveBattler)) + switch (GetBattlerPosition(battler)) { case B_POSITION_PLAYER_LEFT: // player sprite - BtlController_EmitDrawTrainerPic(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitDrawTrainerPic(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); break; case B_POSITION_OPPONENT_LEFT: if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) // opponent 1 sprite { - BtlController_EmitDrawTrainerPic(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitDrawTrainerPic(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); } else // wild mon 1 { - BtlController_EmitLoadMonSprite(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); - gBattleResults.lastOpponentSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES, NULL); + BtlController_EmitLoadMonSprite(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); + gBattleResults.lastOpponentSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES, NULL); } break; case B_POSITION_PLAYER_RIGHT: if (gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_INGAME_PARTNER)) // partner sprite { - BtlController_EmitDrawTrainerPic(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitDrawTrainerPic(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); } break; case B_POSITION_OPPONENT_RIGHT: @@ -3557,15 +3494,15 @@ static void DoBattleIntro(void) { if (gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_TWO_OPPONENTS) && !BATTLE_TWO_VS_ONE_OPPONENT) // opponent 2 if exists { - BtlController_EmitDrawTrainerPic(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitDrawTrainerPic(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); } } - else if (IsBattlerAlive(gActiveBattler)) // wild mon 2 if alive + else if (IsBattlerAlive(battler)) // wild mon 2 if alive { - BtlController_EmitLoadMonSprite(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); - gBattleResults.lastOpponentSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES, NULL); + BtlController_EmitLoadMonSprite(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); + gBattleResults.lastOpponentSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES, NULL); } break; } @@ -3607,9 +3544,9 @@ static void DoBattleIntro(void) } } - gActiveBattler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); - BtlController_EmitDrawPartyStatusSummary(BUFFER_A, hpStatus, PARTY_SUMM_SKIP_DRAW_DELAY); - MarkBattlerForControllerExec(gActiveBattler); + battler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + BtlController_EmitDrawPartyStatusSummary(battler, BUFFER_A, hpStatus, PARTY_SUMM_SKIP_DRAW_DELAY); + MarkBattlerForControllerExec(battler); for (i = 0; i < PARTY_SIZE; i++) { @@ -3626,9 +3563,9 @@ static void DoBattleIntro(void) } } - gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); - BtlController_EmitDrawPartyStatusSummary(BUFFER_A, hpStatus, PARTY_SUMM_SKIP_DRAW_DELAY); - MarkBattlerForControllerExec(gActiveBattler); + battler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + BtlController_EmitDrawPartyStatusSummary(battler, BUFFER_A, hpStatus, PARTY_SUMM_SKIP_DRAW_DELAY); + MarkBattlerForControllerExec(battler); (*state)++; } @@ -3674,12 +3611,12 @@ static void DoBattleIntro(void) break; case 11: // first opponent's mon send out animation if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK && !(gBattleTypeFlags & BATTLE_TYPE_RECORDED_IS_MASTER)) - gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + battler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); else - gActiveBattler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + battler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); - BtlController_EmitIntroTrainerBallThrow(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitIntroTrainerBallThrow(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); (*state)++; break; case 12: // nothing @@ -3688,12 +3625,12 @@ static void DoBattleIntro(void) if (gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_TWO_OPPONENTS) && !BATTLE_TWO_VS_ONE_OPPONENT) { if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK && !(gBattleTypeFlags & BATTLE_TYPE_RECORDED_IS_MASTER)) - gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); + battler = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); else - gActiveBattler = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); + battler = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); - BtlController_EmitIntroTrainerBallThrow(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitIntroTrainerBallThrow(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); } #if B_FAST_INTRO == TRUE if (!(gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_IS_MASTER | BATTLE_TYPE_LINK))) @@ -3714,21 +3651,21 @@ static void DoBattleIntro(void) if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI)) { if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK && !(gBattleTypeFlags & BATTLE_TYPE_RECORDED_IS_MASTER)) - gActiveBattler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + battler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); else - gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + battler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); // A hack that makes fast intro work in trainer battles too. #if B_FAST_INTRO == TRUE if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && !(gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_IS_MASTER | BATTLE_TYPE_LINK)) - && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_SIDE]].callback == SpriteCallbackDummy) + && gSprites[gHealthboxSpriteIds[battler ^ BIT_SIDE]].callback == SpriteCallbackDummy) { return; } #endif - PrepareStringBattle(STRINGID_INTROSENDOUT, gActiveBattler); + PrepareStringBattle(STRINGID_INTROSENDOUT, battler); } (*state)++; break; @@ -3736,57 +3673,57 @@ static void DoBattleIntro(void) if (!(gBattleTypeFlags & BATTLE_TYPE_LINK && gBattleControllerExecFlags)) { if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK && !(gBattleTypeFlags & BATTLE_TYPE_RECORDED_IS_MASTER)) - gActiveBattler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + battler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); else - gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + battler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); - if (!IsBattlerMarkedForControllerExec(gActiveBattler)) + if (!IsBattlerMarkedForControllerExec(battler)) (*state)++; } break; case 18: // player 1 send out if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK && !(gBattleTypeFlags & BATTLE_TYPE_RECORDED_IS_MASTER)) - gActiveBattler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + battler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); else - gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + battler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); - BtlController_EmitIntroTrainerBallThrow(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitIntroTrainerBallThrow(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); (*state)++; break; case 19: // player 2 send out if (gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_INGAME_PARTNER)) { if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK && !(gBattleTypeFlags & BATTLE_TYPE_RECORDED_IS_MASTER)) - gActiveBattler = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); + battler = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); else - gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); + battler = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); - BtlController_EmitIntroTrainerBallThrow(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitIntroTrainerBallThrow(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); } (*state)++; break; case 20: // set dex and battle vars if (!gBattleControllerExecFlags) { - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) + for (battler = 0; battler < gBattlersCount; battler++) { - if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT + if (GetBattlerSide(battler) == B_SIDE_OPPONENT && !(gBattleTypeFlags & (BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_TRAINER_HILL))) { - HandleSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gActiveBattler].species), FLAG_SET_SEEN, gBattleMons[gActiveBattler].personality); + HandleSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[battler].species), FLAG_SET_SEEN, gBattleMons[battler].personality); } } gBattleStruct->switchInAbilitiesCounter = 0; gBattleStruct->switchInItemsCounter = 0; gBattleStruct->overworldWeatherDone = FALSE; - GetAiLogicData(); // get assumed abilities, hold effects, etc of all battlers + SetAiLogicDataForTurn(AI_DATA); // get assumed abilities, hold effects, etc of all battlers Ai_InitPartyStruct(); // Save mons party counts, and first 2/4 mons on the battlefield. gBattleMainFunc = TryDoEventsBeforeFirstTurn; } @@ -3833,19 +3770,19 @@ static void TryDoEventsBeforeFirstTurn(void) { for (j = i + 1; j < gBattlersCount; j++) { - if (GetWhoStrikesFirst(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], TRUE) != 0) + if (GetWhichBattlerFaster(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], TRUE) != 0) SwapTurnOrder(i, j); } } } if (!gBattleStruct->overworldWeatherDone - && AbilityBattleEffects(0, 0, 0, ABILITYEFFECT_SWITCH_IN_WEATHER, 0) != 0) + && AbilityBattleEffects(ABILITYEFFECT_SWITCH_IN_WEATHER, 0, 0, ABILITYEFFECT_SWITCH_IN_WEATHER, 0) != 0) { gBattleStruct->overworldWeatherDone = TRUE; return; } - if (!gBattleStruct->terrainDone && AbilityBattleEffects(0, 0, 0, ABILITYEFFECT_SWITCH_IN_TERRAIN, 0) != 0) + if (!gBattleStruct->terrainDone && AbilityBattleEffects(ABILITYEFFECT_SWITCH_IN_TERRAIN, 0, 0, ABILITYEFFECT_SWITCH_IN_TERRAIN, 0) != 0) { gBattleStruct->terrainDone = TRUE; return; @@ -3919,7 +3856,7 @@ static void TryDoEventsBeforeFirstTurn(void) gRandomTurnNumber = Random(); - GetAiLogicData(); // get assumed abilities, hold effects, etc of all battlers + SetAiLogicDataForTurn(AI_DATA); // get assumed abilities, hold effects, etc of all battlers if (gBattleTypeFlags & BATTLE_TYPE_ARENA) { @@ -4011,7 +3948,7 @@ void BattleTurnPassed(void) *(&gBattleStruct->absentBattlerFlags) = gAbsentBattlerFlags; BattlePutTextOnWindow(gText_EmptyString3, B_WIN_MSG); - GetAiLogicData(); // get assumed abilities, hold effects, etc of all battlers + SetAiLogicDataForTurn(AI_DATA); // get assumed abilities, hold effects, etc of all battlers gBattleMainFunc = HandleTurnActionSelectionState; gRandomTurnNumber = Random(); @@ -4033,23 +3970,23 @@ void BattleTurnPassed(void) BattleScriptExecute(i == 1 ? BattleScript_TrainerASlideMsgEnd2 : BattleScript_TrainerBSlideMsgEnd2); } -u8 IsRunningFromBattleImpossible(void) +u8 IsRunningFromBattleImpossible(u32 battler) { u32 holdEffect, i; - if (gBattleMons[gActiveBattler].item == ITEM_ENIGMA_BERRY_E_READER) - holdEffect = gEnigmaBerries[gActiveBattler].holdEffect; + if (gBattleMons[battler].item == ITEM_ENIGMA_BERRY_E_READER) + holdEffect = gEnigmaBerries[battler].holdEffect; else - holdEffect = ItemId_GetHoldEffect(gBattleMons[gActiveBattler].item); + holdEffect = ItemId_GetHoldEffect(gBattleMons[battler].item); - gPotentialItemEffectBattler = gActiveBattler; + gPotentialItemEffectBattler = battler; if (gBattleTypeFlags & BATTLE_TYPE_FIRST_BATTLE) // Cannot ever run from saving Birch's battle. { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DONT_LEAVE_BIRCH; return BATTLE_RUN_FORBIDDEN; } - if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT && WILD_DOUBLE_BATTLE + if (GetBattlerPosition(battler) == B_POSITION_PLAYER_RIGHT && WILD_DOUBLE_BATTLE && IsBattlerAlive(GetBattlerAtPosition(B_POSITION_PLAYER_LEFT))) // The second pokemon cannot run from a double wild battle, unless it's the only alive mon. { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CANT_ESCAPE; @@ -4059,15 +3996,15 @@ u8 IsRunningFromBattleImpossible(void) if (holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN) return BATTLE_RUN_SUCCESS; #if B_GHOSTS_ESCAPE >= GEN_6 - if (IS_BATTLER_OF_TYPE(gActiveBattler, TYPE_GHOST)) + if (IS_BATTLER_OF_TYPE(battler, TYPE_GHOST)) return BATTLE_RUN_SUCCESS; #endif if (gBattleTypeFlags & BATTLE_TYPE_LINK) return BATTLE_RUN_SUCCESS; - if (GetBattlerAbility(gActiveBattler) == ABILITY_RUN_AWAY) + if (GetBattlerAbility(battler) == ABILITY_RUN_AWAY) return BATTLE_RUN_SUCCESS; - if ((i = IsAbilityPreventingEscape(gActiveBattler))) + if ((i = IsAbilityPreventingEscape(battler))) { gBattleScripting.battler = i - 1; gLastUsedAbility = gBattleMons[i - 1].ability; @@ -4075,7 +4012,7 @@ u8 IsRunningFromBattleImpossible(void) return BATTLE_RUN_FAILURE; } - if (!CanBattlerEscape(gActiveBattler)) + if (!CanBattlerEscape(battler)) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CANT_ESCAPE; return BATTLE_RUN_FORBIDDEN; @@ -4083,11 +4020,10 @@ u8 IsRunningFromBattleImpossible(void) return BATTLE_RUN_SUCCESS; } -void SwitchPartyOrder(u8 battler) +void SwitchPartyOrder(u32 battler) { s32 i; - u8 partyId1; - u8 partyId2; + u32 partyId1, partyId2; for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++) gBattlePartyCurrentOrder[i] = *(battler * 3 + i + (u8 *)(gBattleStruct->battlerPartyOrders)); @@ -4128,47 +4064,47 @@ enum static void HandleTurnActionSelectionState(void) { - s32 i; + s32 i, battler; gBattleCommunication[ACTIONS_CONFIRMED_COUNT] = 0; - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) + for (battler = 0; battler < gBattlersCount; battler++) { - u8 position = GetBattlerPosition(gActiveBattler); - switch (gBattleCommunication[gActiveBattler]) + u32 position = GetBattlerPosition(battler); + switch (gBattleCommunication[battler]) { case STATE_TURN_START_RECORD: // Recorded battle related action on start of every turn. - RecordedBattle_CopyBattlerMoves(); - gBattleCommunication[gActiveBattler] = STATE_BEFORE_ACTION_CHOSEN; + RecordedBattle_CopyBattlerMoves(battler); + gBattleCommunication[battler] = STATE_BEFORE_ACTION_CHOSEN; // Do AI score computations here so we can use them in AI_TrySwitchOrUseItem if ((gBattleTypeFlags & BATTLE_TYPE_HAS_AI || IsWildMonSmart()) - && (BattlerHasAi(gActiveBattler) && !(gBattleTypeFlags & BATTLE_TYPE_PALACE))) + && (BattlerHasAi(battler) && !(gBattleTypeFlags & BATTLE_TYPE_PALACE))) { - gBattleStruct->aiMoveOrAction[gActiveBattler] = ComputeBattleAiScores(gActiveBattler); + gBattleStruct->aiMoveOrAction[battler] = ComputeBattleAiScores(battler); } - break; + // fallthrough case STATE_BEFORE_ACTION_CHOSEN: // Choose an action. - *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = PARTY_SIZE; + *(gBattleStruct->monToSwitchIntoId + battler) = PARTY_SIZE; if (gBattleTypeFlags & BATTLE_TYPE_MULTI || (position & BIT_FLANK) == B_FLANK_LEFT || gBattleStruct->absentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(position))] || gBattleCommunication[GetBattlerAtPosition(BATTLE_PARTNER(position))] == STATE_WAIT_ACTION_CONFIRMED) { - if (gBattleStruct->absentBattlerFlags & gBitTable[gActiveBattler]) + if (gBattleStruct->absentBattlerFlags & gBitTable[battler]) { - gChosenActionByBattler[gActiveBattler] = B_ACTION_NOTHING_FAINTED; + gChosenActionByBattler[battler] = B_ACTION_NOTHING_FAINTED; if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI)) - gBattleCommunication[gActiveBattler] = STATE_WAIT_ACTION_CONFIRMED; + gBattleCommunication[battler] = STATE_WAIT_ACTION_CONFIRMED; else - gBattleCommunication[gActiveBattler] = STATE_WAIT_ACTION_CONFIRMED_STANDBY; + gBattleCommunication[battler] = STATE_WAIT_ACTION_CONFIRMED_STANDBY; } else { - if (gBattleMons[gActiveBattler].status2 & STATUS2_MULTIPLETURNS - || gBattleMons[gActiveBattler].status2 & STATUS2_RECHARGE) + if (gBattleMons[battler].status2 & STATUS2_MULTIPLETURNS + || gBattleMons[battler].status2 & STATUS2_RECHARGE) { - gChosenActionByBattler[gActiveBattler] = B_ACTION_USE_MOVE; - gBattleCommunication[gActiveBattler] = STATE_WAIT_ACTION_CONFIRMED_STANDBY; + gChosenActionByBattler[battler] = B_ACTION_USE_MOVE; + gBattleCommunication[battler] = STATE_WAIT_ACTION_CONFIRMED_STANDBY; } else if (WILD_DOUBLE_BATTLE && position == B_POSITION_PLAYER_RIGHT @@ -4176,41 +4112,41 @@ static void HandleTurnActionSelectionState(void) && gChosenActionByBattler[GetBattlerAtPosition(B_POSITION_PLAYER_LEFT)] != B_ACTION_NOTHING_FAINTED) { gBattleStruct->throwingPokeBall = FALSE; - gChosenActionByBattler[gActiveBattler] = B_ACTION_NOTHING_FAINTED; // Not fainted, but it cannot move, because of the throwing ball. - gBattleCommunication[gActiveBattler] = STATE_WAIT_ACTION_CONFIRMED_STANDBY; + gChosenActionByBattler[battler] = B_ACTION_NOTHING_FAINTED; // Not fainted, but it cannot move, because of the throwing ball. + gBattleCommunication[battler] = STATE_WAIT_ACTION_CONFIRMED_STANDBY; } else { - gBattleStruct->itemPartyIndex[gActiveBattler] = PARTY_SIZE; - BtlController_EmitChooseAction(BUFFER_A, gChosenActionByBattler[0], gBattleResources->bufferB[0][1] | (gBattleResources->bufferB[0][2] << 8)); - MarkBattlerForControllerExec(gActiveBattler); - gBattleCommunication[gActiveBattler]++; + gBattleStruct->itemPartyIndex[battler] = PARTY_SIZE; + BtlController_EmitChooseAction(battler, BUFFER_A, gChosenActionByBattler[0], gBattleResources->bufferB[0][1] | (gBattleResources->bufferB[0][2] << 8)); + MarkBattlerForControllerExec(battler); + gBattleCommunication[battler]++; } } } break; case STATE_WAIT_ACTION_CHOSEN: // Try to perform an action. - if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF << 28) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 12)))) + if (!(gBattleControllerExecFlags & ((gBitTable[battler]) | (0xF << 28) | (gBitTable[battler] << 4) | (gBitTable[battler] << 8) | (gBitTable[battler] << 12)))) { - RecordedBattle_SetBattlerAction(gActiveBattler, gBattleResources->bufferB[gActiveBattler][1]); - gChosenActionByBattler[gActiveBattler] = gBattleResources->bufferB[gActiveBattler][1]; + RecordedBattle_SetBattlerAction(battler, gBattleResources->bufferB[battler][1]); + gChosenActionByBattler[battler] = gBattleResources->bufferB[battler][1]; - switch (gBattleResources->bufferB[gActiveBattler][1]) + switch (gBattleResources->bufferB[battler][1]) { case B_ACTION_USE_MOVE: - if (AreAllMovesUnusable()) + if (AreAllMovesUnusable(battler)) { - gBattleCommunication[gActiveBattler] = STATE_SELECTION_SCRIPT; - *(gBattleStruct->selectionScriptFinished + gActiveBattler) = FALSE; - *(gBattleStruct->stateIdAfterSelScript + gActiveBattler) = STATE_WAIT_ACTION_CONFIRMED_STANDBY; - *(gBattleStruct->moveTarget + gActiveBattler) = gBattleResources->bufferB[gActiveBattler][3]; + gBattleCommunication[battler] = STATE_SELECTION_SCRIPT; + *(gBattleStruct->selectionScriptFinished + battler) = FALSE; + *(gBattleStruct->stateIdAfterSelScript + battler) = STATE_WAIT_ACTION_CONFIRMED_STANDBY; + *(gBattleStruct->moveTarget + battler) = gBattleResources->bufferB[battler][3]; return; } - else if (gDisableStructs[gActiveBattler].encoredMove != 0) + else if (gDisableStructs[battler].encoredMove != 0) { - gChosenMoveByBattler[gActiveBattler] = gDisableStructs[gActiveBattler].encoredMove; - *(gBattleStruct->chosenMovePositions + gActiveBattler) = gDisableStructs[gActiveBattler].encoredMovePos; - gBattleCommunication[gActiveBattler] = STATE_WAIT_ACTION_CONFIRMED_STANDBY; + gChosenMoveByBattler[battler] = gDisableStructs[battler].encoredMove; + *(gBattleStruct->chosenMovePositions + battler) = gDisableStructs[battler].encoredMovePos; + gBattleCommunication[battler] = STATE_WAIT_ACTION_CONFIRMED_STANDBY; return; } else @@ -4219,33 +4155,33 @@ static void HandleTurnActionSelectionState(void) moveInfo.zmove = gBattleStruct->zmove; moveInfo.mega = gBattleStruct->mega; - moveInfo.species = gBattleMons[gActiveBattler].species; - moveInfo.monType1 = gBattleMons[gActiveBattler].type1; - moveInfo.monType2 = gBattleMons[gActiveBattler].type2; - moveInfo.monType3 = gBattleMons[gActiveBattler].type3; + moveInfo.species = gBattleMons[battler].species; + moveInfo.monType1 = gBattleMons[battler].type1; + moveInfo.monType2 = gBattleMons[battler].type2; + moveInfo.monType3 = gBattleMons[battler].type3; for (i = 0; i < MAX_MON_MOVES; i++) { - moveInfo.moves[i] = gBattleMons[gActiveBattler].moves[i]; - moveInfo.currentPp[i] = gBattleMons[gActiveBattler].pp[i]; + moveInfo.moves[i] = gBattleMons[battler].moves[i]; + moveInfo.currentPp[i] = gBattleMons[battler].pp[i]; moveInfo.maxPp[i] = CalculatePPWithBonus( - gBattleMons[gActiveBattler].moves[i], - gBattleMons[gActiveBattler].ppBonuses, + gBattleMons[battler].moves[i], + gBattleMons[battler].ppBonuses, i); } - BtlController_EmitChooseMove(BUFFER_A, (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) != 0, FALSE, &moveInfo); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitChooseMove(battler, BUFFER_A, (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) != 0, FALSE, &moveInfo); + MarkBattlerForControllerExec(battler); } break; case B_ACTION_USE_ITEM: if (FlagGet(B_FLAG_NO_BAG_USE)) { - RecordedBattle_ClearBattlerAction(gActiveBattler, 1); - gSelectionBattleScripts[gActiveBattler] = BattleScript_ActionSelectionItemsCantBeUsed; - gBattleCommunication[gActiveBattler] = STATE_SELECTION_SCRIPT; - *(gBattleStruct->selectionScriptFinished + gActiveBattler) = FALSE; - *(gBattleStruct->stateIdAfterSelScript + gActiveBattler) = STATE_BEFORE_ACTION_CHOSEN; + RecordedBattle_ClearBattlerAction(battler, 1); + gSelectionBattleScripts[battler] = BattleScript_ActionSelectionItemsCantBeUsed; + gBattleCommunication[battler] = STATE_SELECTION_SCRIPT; + *(gBattleStruct->selectionScriptFinished + battler) = FALSE; + *(gBattleStruct->stateIdAfterSelScript + battler) = STATE_BEFORE_ACTION_CHOSEN; return; } @@ -4255,144 +4191,145 @@ static void HandleTurnActionSelectionState(void) | BATTLE_TYPE_RECORDED_LINK)) && !gTestRunnerEnabled) // Or if currently held by Sky Drop - || gStatuses3[gActiveBattler] & STATUS3_SKY_DROPPED) + || gStatuses3[battler] & STATUS3_SKY_DROPPED) { - RecordedBattle_ClearBattlerAction(gActiveBattler, 1); - gSelectionBattleScripts[gActiveBattler] = BattleScript_ActionSelectionItemsCantBeUsed; - gBattleCommunication[gActiveBattler] = STATE_SELECTION_SCRIPT; - *(gBattleStruct->selectionScriptFinished + gActiveBattler) = FALSE; - *(gBattleStruct->stateIdAfterSelScript + gActiveBattler) = STATE_BEFORE_ACTION_CHOSEN; + RecordedBattle_ClearBattlerAction(battler, 1); + gSelectionBattleScripts[battler] = BattleScript_ActionSelectionItemsCantBeUsed; + gBattleCommunication[battler] = STATE_SELECTION_SCRIPT; + *(gBattleStruct->selectionScriptFinished + battler) = FALSE; + *(gBattleStruct->stateIdAfterSelScript + battler) = STATE_BEFORE_ACTION_CHOSEN; return; } else { - BtlController_EmitChooseItem(BUFFER_A, gBattleStruct->battlerPartyOrders[gActiveBattler]); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitChooseItem(battler, BUFFER_A, gBattleStruct->battlerPartyOrders[battler]); + MarkBattlerForControllerExec(battler); } break; case B_ACTION_SWITCH: - *(gBattleStruct->battlerPartyIndexes + gActiveBattler) = gBattlerPartyIndexes[gActiveBattler]; + *(gBattleStruct->battlerPartyIndexes + battler) = gBattlerPartyIndexes[battler]; if (gBattleTypeFlags & BATTLE_TYPE_ARENA - || !CanBattlerEscape(gActiveBattler)) + || !CanBattlerEscape(battler)) { - BtlController_EmitChoosePokemon(BUFFER_A, PARTY_ACTION_CANT_SWITCH, PARTY_SIZE, ABILITY_NONE, gBattleStruct->battlerPartyOrders[gActiveBattler]); + BtlController_EmitChoosePokemon(battler, BUFFER_A, PARTY_ACTION_CANT_SWITCH, PARTY_SIZE, ABILITY_NONE, gBattleStruct->battlerPartyOrders[battler]); } - else if (ItemId_GetHoldEffect(gBattleMons[gActiveBattler].item) != HOLD_EFFECT_SHED_SHELL - && (i = IsAbilityPreventingEscape(gActiveBattler))) // must be last to keep i value integrity + else if (ItemId_GetHoldEffect(gBattleMons[battler].item) != HOLD_EFFECT_SHED_SHELL + && (i = IsAbilityPreventingEscape(battler))) // must be last to keep i value integrity { - BtlController_EmitChoosePokemon(BUFFER_A, ((i - 1) << 4) | PARTY_ACTION_ABILITY_PREVENTS, PARTY_SIZE, gBattleMons[i - 1].ability, gBattleStruct->battlerPartyOrders[gActiveBattler]); + BtlController_EmitChoosePokemon(battler, BUFFER_A, ((i - 1) << 4) | PARTY_ACTION_ABILITY_PREVENTS, PARTY_SIZE, gBattleMons[i - 1].ability, gBattleStruct->battlerPartyOrders[battler]); } else { - if (gActiveBattler == 2 && gChosenActionByBattler[0] == B_ACTION_SWITCH) - BtlController_EmitChoosePokemon(BUFFER_A, PARTY_ACTION_CHOOSE_MON, *(gBattleStruct->monToSwitchIntoId + 0), ABILITY_NONE, gBattleStruct->battlerPartyOrders[gActiveBattler]); - else if (gActiveBattler == 3 && gChosenActionByBattler[1] == B_ACTION_SWITCH) - BtlController_EmitChoosePokemon(BUFFER_A, PARTY_ACTION_CHOOSE_MON, *(gBattleStruct->monToSwitchIntoId + 1), ABILITY_NONE, gBattleStruct->battlerPartyOrders[gActiveBattler]); + if (battler == 2 && gChosenActionByBattler[0] == B_ACTION_SWITCH) + BtlController_EmitChoosePokemon(battler, BUFFER_A, PARTY_ACTION_CHOOSE_MON, *(gBattleStruct->monToSwitchIntoId + 0), ABILITY_NONE, gBattleStruct->battlerPartyOrders[battler]); + else if (battler == 3 && gChosenActionByBattler[1] == B_ACTION_SWITCH) + BtlController_EmitChoosePokemon(battler, BUFFER_A, PARTY_ACTION_CHOOSE_MON, *(gBattleStruct->monToSwitchIntoId + 1), ABILITY_NONE, gBattleStruct->battlerPartyOrders[battler]); else - BtlController_EmitChoosePokemon(BUFFER_A, PARTY_ACTION_CHOOSE_MON, PARTY_SIZE, ABILITY_NONE, gBattleStruct->battlerPartyOrders[gActiveBattler]); + BtlController_EmitChoosePokemon(battler, BUFFER_A, PARTY_ACTION_CHOOSE_MON, PARTY_SIZE, ABILITY_NONE, gBattleStruct->battlerPartyOrders[battler]); } - MarkBattlerForControllerExec(gActiveBattler); + MarkBattlerForControllerExec(battler); break; case B_ACTION_SAFARI_BALL: if (IsPlayerPartyAndPokemonStorageFull()) { - gSelectionBattleScripts[gActiveBattler] = BattleScript_PrintFullBox; - gBattleCommunication[gActiveBattler] = STATE_SELECTION_SCRIPT; - *(gBattleStruct->selectionScriptFinished + gActiveBattler) = FALSE; - *(gBattleStruct->stateIdAfterSelScript + gActiveBattler) = STATE_BEFORE_ACTION_CHOSEN; + gSelectionBattleScripts[battler] = BattleScript_PrintFullBox; + gBattleCommunication[battler] = STATE_SELECTION_SCRIPT; + *(gBattleStruct->selectionScriptFinished + battler) = FALSE; + *(gBattleStruct->stateIdAfterSelScript + battler) = STATE_BEFORE_ACTION_CHOSEN; return; } break; case B_ACTION_SAFARI_POKEBLOCK: - BtlController_EmitChooseItem(BUFFER_A, gBattleStruct->battlerPartyOrders[gActiveBattler]); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitChooseItem(battler, BUFFER_A, gBattleStruct->battlerPartyOrders[battler]); + MarkBattlerForControllerExec(battler); break; case B_ACTION_CANCEL_PARTNER: - gBattleCommunication[gActiveBattler] = STATE_WAIT_SET_BEFORE_ACTION; - gBattleCommunication[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))] = STATE_BEFORE_ACTION_CHOSEN; - RecordedBattle_ClearBattlerAction(gActiveBattler, 1); - if (gBattleMons[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))].status2 & STATUS2_MULTIPLETURNS - || gBattleMons[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))].status2 & STATUS2_RECHARGE) + gBattleCommunication[battler] = STATE_WAIT_SET_BEFORE_ACTION; + gBattleCommunication[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler)))] = STATE_BEFORE_ACTION_CHOSEN; + RecordedBattle_ClearBattlerAction(battler, 1); + if (gBattleMons[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler)))].status2 & STATUS2_MULTIPLETURNS + || gBattleMons[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler)))].status2 & STATUS2_RECHARGE) { - BtlController_EmitEndBounceEffect(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitEndBounceEffect(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); return; } - else if (gChosenActionByBattler[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))] == B_ACTION_SWITCH) + else if (gChosenActionByBattler[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler)))] == B_ACTION_SWITCH) { - RecordedBattle_ClearBattlerAction(GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler))), 2); + RecordedBattle_ClearBattlerAction(GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler))), 2); } - else if (gChosenActionByBattler[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))] == B_ACTION_RUN) + else if (gChosenActionByBattler[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler)))] == B_ACTION_RUN) { - RecordedBattle_ClearBattlerAction(GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler))), 1); + RecordedBattle_ClearBattlerAction(GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler))), 1); } - else if (gChosenActionByBattler[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))] == B_ACTION_USE_MOVE - && (gProtectStructs[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))].noValidMoves - || gDisableStructs[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))].encoredMove)) + else if (gChosenActionByBattler[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler)))] == B_ACTION_USE_MOVE + && (gProtectStructs[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler)))].noValidMoves + || gDisableStructs[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler)))].encoredMove)) { - RecordedBattle_ClearBattlerAction(GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler))), 1); + RecordedBattle_ClearBattlerAction(GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler))), 1); } else if (gBattleTypeFlags & BATTLE_TYPE_PALACE - && gChosenActionByBattler[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))] == B_ACTION_USE_MOVE) + && gChosenActionByBattler[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler)))] == B_ACTION_USE_MOVE) { gRngValue = gBattlePalaceMoveSelectionRngValue; - RecordedBattle_ClearBattlerAction(GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler))), 1); + RecordedBattle_ClearBattlerAction(GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler))), 1); } else { - RecordedBattle_ClearBattlerAction(GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler))), 3); + RecordedBattle_ClearBattlerAction(GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battler))), 3); } - gBattleStruct->mega.toEvolve &= ~(gBitTable[BATTLE_PARTNER(GetBattlerPosition(gActiveBattler))]); - gBattleStruct->zmove.toBeUsed[BATTLE_PARTNER(GetBattlerPosition(gActiveBattler))] = MOVE_NONE; - BtlController_EmitEndBounceEffect(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + gBattleStruct->mega.toEvolve &= ~(gBitTable[BATTLE_PARTNER(GetBattlerPosition(battler))]); + gBattleStruct->burst.toBurst &= ~(gBitTable[BATTLE_PARTNER(GetBattlerPosition(battler))]); + gBattleStruct->zmove.toBeUsed[BATTLE_PARTNER(GetBattlerPosition(battler))] = MOVE_NONE; + BtlController_EmitEndBounceEffect(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); return; case B_ACTION_DEBUG: - BtlController_EmitDebugMenu(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitDebugMenu(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); break; } if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_TRAINER_HILL) - && gBattleResources->bufferB[gActiveBattler][1] == B_ACTION_RUN) + && gBattleResources->bufferB[battler][1] == B_ACTION_RUN) { - gSelectionBattleScripts[gActiveBattler] = BattleScript_AskIfWantsToForfeitMatch; - gBattleCommunication[gActiveBattler] = STATE_SELECTION_SCRIPT_MAY_RUN; - *(gBattleStruct->selectionScriptFinished + gActiveBattler) = FALSE; - *(gBattleStruct->stateIdAfterSelScript + gActiveBattler) = STATE_BEFORE_ACTION_CHOSEN; + gSelectionBattleScripts[battler] = BattleScript_AskIfWantsToForfeitMatch; + gBattleCommunication[battler] = STATE_SELECTION_SCRIPT_MAY_RUN; + *(gBattleStruct->selectionScriptFinished + battler) = FALSE; + *(gBattleStruct->stateIdAfterSelScript + battler) = STATE_BEFORE_ACTION_CHOSEN; return; } else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) - && gBattleResources->bufferB[gActiveBattler][1] == B_ACTION_RUN) + && gBattleResources->bufferB[battler][1] == B_ACTION_RUN) { BattleScriptExecute(BattleScript_PrintCantRunFromTrainer); - gBattleCommunication[gActiveBattler] = STATE_BEFORE_ACTION_CHOSEN; + gBattleCommunication[battler] = STATE_BEFORE_ACTION_CHOSEN; } - else if (IsRunningFromBattleImpossible() != BATTLE_RUN_SUCCESS - && gBattleResources->bufferB[gActiveBattler][1] == B_ACTION_RUN) + else if (IsRunningFromBattleImpossible(battler) != BATTLE_RUN_SUCCESS + && gBattleResources->bufferB[battler][1] == B_ACTION_RUN) { - gSelectionBattleScripts[gActiveBattler] = BattleScript_PrintCantEscapeFromBattle; - gBattleCommunication[gActiveBattler] = STATE_SELECTION_SCRIPT; - *(gBattleStruct->selectionScriptFinished + gActiveBattler) = FALSE; - *(gBattleStruct->stateIdAfterSelScript + gActiveBattler) = STATE_BEFORE_ACTION_CHOSEN; + gSelectionBattleScripts[battler] = BattleScript_PrintCantEscapeFromBattle; + gBattleCommunication[battler] = STATE_SELECTION_SCRIPT; + *(gBattleStruct->selectionScriptFinished + battler) = FALSE; + *(gBattleStruct->stateIdAfterSelScript + battler) = STATE_BEFORE_ACTION_CHOSEN; return; } else { - gBattleCommunication[gActiveBattler]++; + gBattleCommunication[battler]++; } } break; case STATE_WAIT_ACTION_CASE_CHOSEN: - if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF << 28) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 12)))) + if (!(gBattleControllerExecFlags & ((gBitTable[battler]) | (0xF << 28) | (gBitTable[battler] << 4) | (gBitTable[battler] << 8) | (gBitTable[battler] << 12)))) { - switch (gChosenActionByBattler[gActiveBattler]) + switch (gChosenActionByBattler[battler]) { case B_ACTION_USE_MOVE: - switch (gBattleResources->bufferB[gActiveBattler][1]) + switch (gBattleResources->bufferB[battler][1]) { case 3: case 4: @@ -4401,112 +4338,115 @@ static void HandleTurnActionSelectionState(void) case 7: case 8: case 9: - gChosenActionByBattler[gActiveBattler] = gBattleResources->bufferB[gActiveBattler][1]; + gChosenActionByBattler[battler] = gBattleResources->bufferB[battler][1]; return; case 15: - gChosenActionByBattler[gActiveBattler] = B_ACTION_SWITCH; - UpdateBattlerPartyOrdersOnSwitch(); + gChosenActionByBattler[battler] = B_ACTION_SWITCH; + UpdateBattlerPartyOrdersOnSwitch(battler); return; default: RecordedBattle_CheckMovesetChanges(B_RECORD_MODE_PLAYBACK); - if ((gBattleResources->bufferB[gActiveBattler][2] | (gBattleResources->bufferB[gActiveBattler][3] << 8)) == 0xFFFF) + if ((gBattleResources->bufferB[battler][2] | (gBattleResources->bufferB[battler][3] << 8)) == 0xFFFF) { - gBattleCommunication[gActiveBattler] = STATE_BEFORE_ACTION_CHOSEN; - RecordedBattle_ClearBattlerAction(gActiveBattler, 1); + gBattleCommunication[battler] = STATE_BEFORE_ACTION_CHOSEN; + RecordedBattle_ClearBattlerAction(battler, 1); } - else if (TrySetCantSelectMoveBattleScript()) + else if (TrySetCantSelectMoveBattleScript(battler)) { - RecordedBattle_ClearBattlerAction(gActiveBattler, 1); - gBattleCommunication[gActiveBattler] = STATE_SELECTION_SCRIPT; - *(gBattleStruct->selectionScriptFinished + gActiveBattler) = FALSE; - gBattleResources->bufferB[gActiveBattler][1] = B_ACTION_USE_MOVE; - *(gBattleStruct->stateIdAfterSelScript + gActiveBattler) = STATE_WAIT_ACTION_CHOSEN; + RecordedBattle_ClearBattlerAction(battler, 1); + gBattleCommunication[battler] = STATE_SELECTION_SCRIPT; + *(gBattleStruct->selectionScriptFinished + battler) = FALSE; + gBattleResources->bufferB[battler][1] = B_ACTION_USE_MOVE; + *(gBattleStruct->stateIdAfterSelScript + battler) = STATE_WAIT_ACTION_CHOSEN; return; } else { if (!(gBattleTypeFlags & BATTLE_TYPE_PALACE)) { - RecordedBattle_SetBattlerAction(gActiveBattler, gBattleResources->bufferB[gActiveBattler][2]); - RecordedBattle_SetBattlerAction(gActiveBattler, gBattleResources->bufferB[gActiveBattler][3]); + RecordedBattle_SetBattlerAction(battler, gBattleResources->bufferB[battler][2]); + RecordedBattle_SetBattlerAction(battler, gBattleResources->bufferB[battler][3]); } - *(gBattleStruct->chosenMovePositions + gActiveBattler) = gBattleResources->bufferB[gActiveBattler][2] & ~RET_MEGA_EVOLUTION; - gChosenMoveByBattler[gActiveBattler] = gBattleMons[gActiveBattler].moves[*(gBattleStruct->chosenMovePositions + gActiveBattler)]; - *(gBattleStruct->moveTarget + gActiveBattler) = gBattleResources->bufferB[gActiveBattler][3]; - if (gBattleResources->bufferB[gActiveBattler][2] & RET_MEGA_EVOLUTION) - gBattleStruct->mega.toEvolve |= gBitTable[gActiveBattler]; - gBattleCommunication[gActiveBattler]++; + + gBattleStruct->chosenMovePositions[battler] = gBattleResources->bufferB[battler][2] & ~(RET_MEGA_EVOLUTION | RET_ULTRA_BURST); + gChosenMoveByBattler[battler] = gBattleMons[battler].moves[gBattleStruct->chosenMovePositions[battler]]; + gBattleStruct->moveTarget[battler] = gBattleResources->bufferB[battler][3]; + if (gBattleResources->bufferB[battler][2] & RET_MEGA_EVOLUTION) + gBattleStruct->mega.toEvolve |= gBitTable[battler]; + else if (gBattleResources->bufferB[battler][2] & RET_ULTRA_BURST) + gBattleStruct->burst.toBurst |= gBitTable[battler]; + gBattleCommunication[battler]++; } break; } break; case B_ACTION_USE_ITEM: - if ((gBattleResources->bufferB[gActiveBattler][1] | (gBattleResources->bufferB[gActiveBattler][2] << 8)) == 0) + if ((gBattleResources->bufferB[battler][1] | (gBattleResources->bufferB[battler][2] << 8)) == 0) { - gBattleCommunication[gActiveBattler] = STATE_BEFORE_ACTION_CHOSEN; + gBattleCommunication[battler] = STATE_BEFORE_ACTION_CHOSEN; } else { - gLastUsedItem = (gBattleResources->bufferB[gActiveBattler][1] | (gBattleResources->bufferB[gActiveBattler][2] << 8)); + gLastUsedItem = (gBattleResources->bufferB[battler][1] | (gBattleResources->bufferB[battler][2] << 8)); if (ItemId_GetPocket(gLastUsedItem) == POCKET_POKE_BALLS) gBattleStruct->throwingPokeBall = TRUE; - gBattleCommunication[gActiveBattler]++; + gBattleCommunication[battler]++; } break; case B_ACTION_SWITCH: - if (gBattleResources->bufferB[gActiveBattler][1] == PARTY_SIZE) + if (gBattleResources->bufferB[battler][1] == PARTY_SIZE) { - gBattleCommunication[gActiveBattler] = STATE_BEFORE_ACTION_CHOSEN; - RecordedBattle_ClearBattlerAction(gActiveBattler, 1); + gBattleCommunication[battler] = STATE_BEFORE_ACTION_CHOSEN; + RecordedBattle_ClearBattlerAction(battler, 1); } else { - UpdateBattlerPartyOrdersOnSwitch(); - gBattleCommunication[gActiveBattler]++; + UpdateBattlerPartyOrdersOnSwitch(battler); + gBattleCommunication[battler]++; } break; case B_ACTION_RUN: gHitMarker |= HITMARKER_RUN; - gBattleCommunication[gActiveBattler]++; + gBattleCommunication[battler]++; break; case B_ACTION_SAFARI_WATCH_CAREFULLY: - gBattleCommunication[gActiveBattler]++; + gBattleCommunication[battler]++; break; case B_ACTION_SAFARI_BALL: - gBattleCommunication[gActiveBattler]++; + gBattleCommunication[battler]++; break; case B_ACTION_THROW_BALL: gBattleStruct->throwingPokeBall = TRUE; - gBattleCommunication[gActiveBattler]++; + gBattleCommunication[battler]++; break; case B_ACTION_SAFARI_POKEBLOCK: - if ((gBattleResources->bufferB[gActiveBattler][1] | (gBattleResources->bufferB[gActiveBattler][2] << 8)) != 0) - gBattleCommunication[gActiveBattler]++; + if ((gBattleResources->bufferB[battler][1] | (gBattleResources->bufferB[battler][2] << 8)) != 0) + gBattleCommunication[battler]++; else - gBattleCommunication[gActiveBattler] = STATE_BEFORE_ACTION_CHOSEN; + gBattleCommunication[battler] = STATE_BEFORE_ACTION_CHOSEN; break; case B_ACTION_SAFARI_GO_NEAR: - gBattleCommunication[gActiveBattler]++; + gBattleCommunication[battler]++; break; case B_ACTION_SAFARI_RUN: gHitMarker |= HITMARKER_RUN; - gBattleCommunication[gActiveBattler]++; + gBattleCommunication[battler]++; break; case B_ACTION_WALLY_THROW: - gBattleCommunication[gActiveBattler]++; + gBattleCommunication[battler]++; break; case B_ACTION_DEBUG: - gBattleCommunication[gActiveBattler] = STATE_BEFORE_ACTION_CHOSEN; + gBattleCommunication[battler] = STATE_BEFORE_ACTION_CHOSEN; break; } } break; case STATE_WAIT_ACTION_CONFIRMED_STANDBY: - if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) + if (!(gBattleControllerExecFlags & ((gBitTable[battler]) | (0xF << 28) - | (gBitTable[gActiveBattler] << 4) - | (gBitTable[gActiveBattler] << 8) - | (gBitTable[gActiveBattler] << 12)))) + | (gBitTable[battler] << 4) + | (gBitTable[battler] << 8) + | (gBitTable[battler] << 12)))) { if (AllAtActionConfirmed()) i = TRUE; @@ -4517,68 +4457,68 @@ static void HandleTurnActionSelectionState(void) || (position & BIT_FLANK) != B_FLANK_LEFT || (*(&gBattleStruct->absentBattlerFlags) & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(position))])) { - BtlController_EmitLinkStandbyMsg(BUFFER_A, LINK_STANDBY_MSG_STOP_BOUNCE, i); + BtlController_EmitLinkStandbyMsg(battler, BUFFER_A, LINK_STANDBY_MSG_STOP_BOUNCE, i); } else { - BtlController_EmitLinkStandbyMsg(BUFFER_A, LINK_STANDBY_STOP_BOUNCE_ONLY, i); + BtlController_EmitLinkStandbyMsg(battler, BUFFER_A, LINK_STANDBY_STOP_BOUNCE_ONLY, i); } - MarkBattlerForControllerExec(gActiveBattler); - gBattleCommunication[gActiveBattler]++; + MarkBattlerForControllerExec(battler); + gBattleCommunication[battler]++; } break; case STATE_WAIT_ACTION_CONFIRMED: - if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF << 28) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 12)))) + if (!(gBattleControllerExecFlags & ((gBitTable[battler]) | (0xF << 28) | (gBitTable[battler] << 4) | (gBitTable[battler] << 8) | (gBitTable[battler] << 12)))) { gBattleCommunication[ACTIONS_CONFIRMED_COUNT]++; } break; case STATE_SELECTION_SCRIPT: - if (*(gBattleStruct->selectionScriptFinished + gActiveBattler)) + if (*(gBattleStruct->selectionScriptFinished + battler)) { - gBattleCommunication[gActiveBattler] = *(gBattleStruct->stateIdAfterSelScript + gActiveBattler); + gBattleCommunication[battler] = *(gBattleStruct->stateIdAfterSelScript + battler); } else { - gBattlerAttacker = gActiveBattler; - gBattlescriptCurrInstr = gSelectionBattleScripts[gActiveBattler]; - if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF << 28) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 12)))) + gBattlerAttacker = battler; + gBattlescriptCurrInstr = gSelectionBattleScripts[battler]; + if (!(gBattleControllerExecFlags & ((gBitTable[battler]) | (0xF << 28) | (gBitTable[battler] << 4) | (gBitTable[battler] << 8) | (gBitTable[battler] << 12)))) { gBattleScriptingCommandsTable[gBattlescriptCurrInstr[0]](); } - gSelectionBattleScripts[gActiveBattler] = gBattlescriptCurrInstr; + gSelectionBattleScripts[battler] = gBattlescriptCurrInstr; } break; case STATE_WAIT_SET_BEFORE_ACTION: - if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF << 28) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 12)))) + if (!(gBattleControllerExecFlags & ((gBitTable[battler]) | (0xF << 28) | (gBitTable[battler] << 4) | (gBitTable[battler] << 8) | (gBitTable[battler] << 12)))) { - gBattleCommunication[gActiveBattler] = STATE_BEFORE_ACTION_CHOSEN; + gBattleCommunication[battler] = STATE_BEFORE_ACTION_CHOSEN; } break; case STATE_SELECTION_SCRIPT_MAY_RUN: - if (*(gBattleStruct->selectionScriptFinished + gActiveBattler)) + if (*(gBattleStruct->selectionScriptFinished + battler)) { - if (gBattleResources->bufferB[gActiveBattler][1] == B_ACTION_NOTHING_FAINTED) + if (gBattleResources->bufferB[battler][1] == B_ACTION_NOTHING_FAINTED) { gHitMarker |= HITMARKER_RUN; - gChosenActionByBattler[gActiveBattler] = B_ACTION_RUN; - gBattleCommunication[gActiveBattler] = STATE_WAIT_ACTION_CONFIRMED_STANDBY; + gChosenActionByBattler[battler] = B_ACTION_RUN; + gBattleCommunication[battler] = STATE_WAIT_ACTION_CONFIRMED_STANDBY; } else { - RecordedBattle_ClearBattlerAction(gActiveBattler, 1); - gBattleCommunication[gActiveBattler] = *(gBattleStruct->stateIdAfterSelScript + gActiveBattler); + RecordedBattle_ClearBattlerAction(battler, 1); + gBattleCommunication[battler] = *(gBattleStruct->stateIdAfterSelScript + battler); } } else { - gBattlerAttacker = gActiveBattler; - gBattlescriptCurrInstr = gSelectionBattleScripts[gActiveBattler]; - if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF << 28) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 12)))) + gBattlerAttacker = battler; + gBattlescriptCurrInstr = gSelectionBattleScripts[battler]; + if (!(gBattleControllerExecFlags & ((gBitTable[battler]) | (0xF << 28) | (gBitTable[battler] << 4) | (gBitTable[battler] << 8) | (gBitTable[battler] << 12)))) { gBattleScriptingCommandsTable[gBattlescriptCurrInstr[0]](); } - gSelectionBattleScripts[gActiveBattler] = gBattlescriptCurrInstr; + gSelectionBattleScripts[battler] = gBattlescriptCurrInstr; } break; } @@ -4631,20 +4571,20 @@ static bool8 AllAtActionConfirmed(void) return FALSE; } -static void UpdateBattlerPartyOrdersOnSwitch(void) +static void UpdateBattlerPartyOrdersOnSwitch(u32 battler) { - *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = gBattleResources->bufferB[gActiveBattler][1]; - RecordedBattle_SetBattlerAction(gActiveBattler, gBattleResources->bufferB[gActiveBattler][1]); + gBattleStruct->monToSwitchIntoId[battler] = gBattleResources->bufferB[battler][1]; + RecordedBattle_SetBattlerAction(battler, gBattleResources->bufferB[battler][1]); if (gBattleTypeFlags & BATTLE_TYPE_LINK && gBattleTypeFlags & BATTLE_TYPE_MULTI) { - *(gActiveBattler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) &= 0xF; - *(gActiveBattler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleResources->bufferB[gActiveBattler][2] & 0xF0); - *(gActiveBattler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 1) = gBattleResources->bufferB[gActiveBattler][3]; + *(battler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) &= 0xF; + *(battler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleResources->bufferB[battler][2] & 0xF0); + *(battler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 1) = gBattleResources->bufferB[battler][3]; - *((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) &= (0xF0); - *((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleResources->bufferB[gActiveBattler][2] & 0xF0) >> 4; - *((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 2) = gBattleResources->bufferB[gActiveBattler][3]; + *((BATTLE_PARTNER(battler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) &= (0xF0); + *((BATTLE_PARTNER(battler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleResources->bufferB[battler][2] & 0xF0) >> 4; + *((BATTLE_PARTNER(battler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 2) = gBattleResources->bufferB[battler][3]; } } @@ -4656,12 +4596,11 @@ void SwapTurnOrder(u8 id1, u8 id2) SWAP(gBattlerByTurnOrder[id1], gBattlerByTurnOrder[id2], temp); } -u32 GetBattlerTotalSpeedStat(u8 battlerId) +// For AI, so it doesn't 'cheat' by knowing player's ability +u32 GetBattlerTotalSpeedStatArgs(u32 battler, u32 ability, u32 holdEffect) { - u32 speed = gBattleMons[battlerId].speed; - u32 ability = GetBattlerAbility(battlerId); - u32 holdEffect = GetBattlerHoldEffect(battlerId, TRUE); - u32 highestStat = GetHighestStatId(battlerId); + u32 speed = gBattleMons[battler].speed; + u32 highestStat = GetHighestStatId(battler); // weather abilities if (WEATHER_HAS_EFFECT) @@ -4677,11 +4616,11 @@ u32 GetBattlerTotalSpeedStat(u8 battlerId) } // other abilities - if (ability == ABILITY_QUICK_FEET && gBattleMons[battlerId].status1 & STATUS1_ANY) + if (ability == ABILITY_QUICK_FEET && gBattleMons[battler].status1 & STATUS1_ANY) speed = (speed * 150) / 100; else if (ability == ABILITY_SURGE_SURFER && gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN) speed *= 2; - else if (ability == ABILITY_SLOW_START && gDisableStructs[battlerId].slowStartTimer != 0) + else if (ability == ABILITY_SLOW_START && gDisableStructs[battler].slowStartTimer != 0) speed /= 2; else if (ability == ABILITY_PROTOSYNTHESIS && gBattleWeather & B_WEATHER_SUN && highestStat == STAT_SPEED) speed = (speed * 150) / 100; @@ -4689,13 +4628,13 @@ u32 GetBattlerTotalSpeedStat(u8 battlerId) speed = (speed * 150) / 100; // stat stages - speed *= gStatStageRatios[gBattleMons[battlerId].statStages[STAT_SPEED]][0]; - speed /= gStatStageRatios[gBattleMons[battlerId].statStages[STAT_SPEED]][1]; + speed *= gStatStageRatios[gBattleMons[battler].statStages[STAT_SPEED]][0]; + speed /= gStatStageRatios[gBattleMons[battler].statStages[STAT_SPEED]][1]; // player's badge boost if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_FRONTIER)) - && ShouldGetStatBadgeBoost(FLAG_BADGE03_GET, battlerId) - && GetBattlerSide(battlerId) == B_SIDE_PLAYER) + && ShouldGetStatBadgeBoost(FLAG_BADGE03_GET, battler) + && GetBattlerSide(battler) == B_SIDE_PLAYER) { speed = (speed * 110) / 100; } @@ -4707,17 +4646,17 @@ u32 GetBattlerTotalSpeedStat(u8 battlerId) speed /= 2; else if (holdEffect == HOLD_EFFECT_CHOICE_SCARF) speed = (speed * 150) / 100; - else if (holdEffect == HOLD_EFFECT_QUICK_POWDER && gBattleMons[battlerId].species == SPECIES_DITTO && !(gBattleMons[battlerId].status2 & STATUS2_TRANSFORMED)) + else if (holdEffect == HOLD_EFFECT_QUICK_POWDER && gBattleMons[battler].species == SPECIES_DITTO && !(gBattleMons[battler].status2 & STATUS2_TRANSFORMED)) speed *= 2; // various effects - if (gSideStatuses[GET_BATTLER_SIDE(battlerId)] & SIDE_STATUS_TAILWIND) + if (gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_TAILWIND) speed *= 2; - if (gBattleResources->flags->flags[battlerId] & RESOURCE_FLAG_UNBURDEN) + if (gBattleResources->flags->flags[battler] & RESOURCE_FLAG_UNBURDEN) speed *= 2; // paralysis drop - if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && ability != ABILITY_QUICK_FEET) + if (gBattleMons[battler].status1 & STATUS1_PARALYSIS && ability != ABILITY_QUICK_FEET) #if B_PARALYSIS_SPEED >= GEN_7 speed /= 2; #else @@ -4727,28 +4666,35 @@ u32 GetBattlerTotalSpeedStat(u8 battlerId) return speed; } -s8 GetChosenMovePriority(u32 battlerId) +u32 GetBattlerTotalSpeedStat(u32 battler) +{ + u32 ability = GetBattlerAbility(battler); + u32 holdEffect = GetBattlerHoldEffect(battler, TRUE); + return GetBattlerTotalSpeedStatArgs(battler, ability, holdEffect); +} + +s8 GetChosenMovePriority(u32 battler) { u16 move; - gProtectStructs[battlerId].pranksterElevated = 0; - if (gProtectStructs[battlerId].noValidMoves) + gProtectStructs[battler].pranksterElevated = 0; + if (gProtectStructs[battler].noValidMoves) move = MOVE_STRUGGLE; else - move = gBattleMons[battlerId].moves[*(gBattleStruct->chosenMovePositions + battlerId)]; + move = gBattleMons[battler].moves[*(gBattleStruct->chosenMovePositions + battler)]; - return GetMovePriority(battlerId, move); + return GetMovePriority(battler, move); } -s8 GetMovePriority(u32 battlerId, u16 move) +s8 GetMovePriority(u32 battler, u16 move) { s8 priority; - u16 ability = GetBattlerAbility(battlerId); + u16 ability = GetBattlerAbility(battler); priority = gBattleMoves[move].priority; if (ability == ABILITY_GALE_WINGS #if B_GALE_WINGS >= GEN_7 - && BATTLER_MAX_HP(battlerId) + && BATTLER_MAX_HP(battler) #endif && gBattleMoves[move].type == TYPE_FLYING) { @@ -4756,10 +4702,10 @@ s8 GetMovePriority(u32 battlerId, u16 move) } else if (ability == ABILITY_PRANKSTER && IS_MOVE_STATUS(move)) { - gProtectStructs[battlerId].pranksterElevated = 1; + gProtectStructs[battler].pranksterElevated = 1; priority++; } - else if (gBattleMoves[move].effect == EFFECT_GRASSY_GLIDE && gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN && IsBattlerGrounded(battlerId)) + else if (gBattleMoves[move].effect == EFFECT_GRASSY_GLIDE && gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN && IsBattlerGrounded(battler)) { priority++; } @@ -4779,28 +4725,25 @@ s8 GetMovePriority(u32 battlerId, u16 move) case EFFECT_SOFTBOILED: case EFFECT_ABSORB: case EFFECT_ROOST: + case EFFECT_JUNGLE_HEALING: priority += 3; break; } } - if (gProtectStructs[battlerId].quash) + if (gProtectStructs[battler].quash) priority = -8; return priority; } -u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) +// Function for AI with variables provided as arguments to speed the computation time +u32 GetWhichBattlerFasterArgs(u32 battler1, u32 battler2, bool32 ignoreChosenMoves, u32 ability1, u32 ability2, + u32 holdEffectBattler1, u32 holdEffectBattler2, u32 speedBattler1, u32 speedBattler2, s32 priority1, s32 priority2) { - u8 strikesFirst = 0; - u32 speedBattler1 = 0, speedBattler2 = 0; - u32 holdEffectBattler1 = 0, holdEffectBattler2 = 0; - s8 priority1 = 0, priority2 = 0; - u16 ability1 = GetBattlerAbility(battler1), ability2 = GetBattlerAbility(battler2); + u32 strikesFirst = 0; // Battler 1 - speedBattler1 = GetBattlerTotalSpeedStat(battler1); - holdEffectBattler1 = GetBattlerHoldEffect(battler1, TRUE); // Quick Draw if (!ignoreChosenMoves && ability1 == ABILITY_QUICK_DRAW && !IS_MOVE_STATUS(gChosenMoveByBattler[battler1]) && Random() % 100 < 30) gProtectStructs[battler1].quickDraw = TRUE; @@ -4811,8 +4754,6 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) gProtectStructs[battler1].usedCustapBerry = TRUE; // Battler 2 - speedBattler2 = GetBattlerTotalSpeedStat(battler2); - holdEffectBattler2 = GetBattlerHoldEffect(battler2, TRUE); // Quick Draw if (!ignoreChosenMoves && ability2 == ABILITY_QUICK_DRAW && !IS_MOVE_STATUS(gChosenMoveByBattler[battler2]) && Random() % 100 < 30) gProtectStructs[battler2].quickDraw = TRUE; @@ -4822,14 +4763,6 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) || (holdEffectBattler2 == HOLD_EFFECT_CUSTAP_BERRY && HasEnoughHpToEatBerry(battler2, 4, gBattleMons[battler2].item)))) gProtectStructs[battler2].usedCustapBerry = TRUE; - if (!ignoreChosenMoves) - { - if (gChosenActionByBattler[battler1] == B_ACTION_USE_MOVE) - priority1 = GetChosenMovePriority(battler1); - if (gChosenActionByBattler[battler2] == B_ACTION_USE_MOVE) - priority2 = GetChosenMovePriority(battler2); - } - if (priority1 == priority2) { // QUICK CLAW / CUSTAP - always first @@ -4892,17 +4825,39 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) return strikesFirst; } +u32 GetWhichBattlerFaster(u32 battler1, u32 battler2, bool32 ignoreChosenMoves) +{ + s32 priority1 = 0, priority2 = 0; + u32 ability1 = GetBattlerAbility(battler1); + u32 speedBattler1 = GetBattlerTotalSpeedStat(battler1); + u32 holdEffectBattler1 = GetBattlerHoldEffect(battler1, TRUE); + u32 speedBattler2 = GetBattlerTotalSpeedStat(battler2); + u32 holdEffectBattler2 = GetBattlerHoldEffect(battler2, TRUE); + u32 ability2 = GetBattlerAbility(battler2); + + if (!ignoreChosenMoves) + { + if (gChosenActionByBattler[battler1] == B_ACTION_USE_MOVE) + priority1 = GetChosenMovePriority(battler1); + if (gChosenActionByBattler[battler2] == B_ACTION_USE_MOVE) + priority2 = GetChosenMovePriority(battler2); + } + + return GetWhichBattlerFasterArgs(battler1, battler2, ignoreChosenMoves, ability1, ability2, + holdEffectBattler1, holdEffectBattler2, speedBattler1, speedBattler2, priority1, priority2); +} + static void SetActionsAndBattlersTurnOrder(void) { s32 turnOrderId = 0; - s32 i, j; + s32 i, j, battler; if (gBattleTypeFlags & BATTLE_TYPE_SAFARI) { - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) + for (battler = 0; battler < gBattlersCount; battler++) { - gActionsByTurnOrder[turnOrderId] = gChosenActionByBattler[gActiveBattler]; - gBattlerByTurnOrder[turnOrderId] = gActiveBattler; + gActionsByTurnOrder[turnOrderId] = gChosenActionByBattler[battler]; + gBattlerByTurnOrder[turnOrderId] = battler; turnOrderId++; } } @@ -4910,9 +4865,9 @@ static void SetActionsAndBattlersTurnOrder(void) { if (gBattleTypeFlags & BATTLE_TYPE_LINK) { - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) + for (battler = 0; battler < gBattlersCount; battler++) { - if (gChosenActionByBattler[gActiveBattler] == B_ACTION_RUN) + if (gChosenActionByBattler[battler] == B_ACTION_RUN) { turnOrderId = 5; break; @@ -4923,24 +4878,24 @@ static void SetActionsAndBattlersTurnOrder(void) { if (gChosenActionByBattler[0] == B_ACTION_RUN) { - gActiveBattler = 0; + battler = 0; turnOrderId = 5; } if (gChosenActionByBattler[2] == B_ACTION_RUN) { - gActiveBattler = 2; + battler = 2; turnOrderId = 5; } } if (turnOrderId == 5) // One of battlers wants to run. { - gActionsByTurnOrder[0] = gChosenActionByBattler[gActiveBattler]; - gBattlerByTurnOrder[0] = gActiveBattler; + gActionsByTurnOrder[0] = gChosenActionByBattler[battler]; + gBattlerByTurnOrder[0] = battler; turnOrderId = 1; for (i = 0; i < gBattlersCount; i++) { - if (i != gActiveBattler) + if (i != battler) { gActionsByTurnOrder[turnOrderId] = gChosenActionByBattler[i]; gBattlerByTurnOrder[turnOrderId] = i; @@ -4950,25 +4905,25 @@ static void SetActionsAndBattlersTurnOrder(void) } else { - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) + for (battler = 0; battler < gBattlersCount; battler++) { - if (gChosenActionByBattler[gActiveBattler] == B_ACTION_USE_ITEM - || gChosenActionByBattler[gActiveBattler] == B_ACTION_SWITCH - || gChosenActionByBattler[gActiveBattler] == B_ACTION_THROW_BALL) + if (gChosenActionByBattler[battler] == B_ACTION_USE_ITEM + || gChosenActionByBattler[battler] == B_ACTION_SWITCH + || gChosenActionByBattler[battler] == B_ACTION_THROW_BALL) { - gActionsByTurnOrder[turnOrderId] = gChosenActionByBattler[gActiveBattler]; - gBattlerByTurnOrder[turnOrderId] = gActiveBattler; + gActionsByTurnOrder[turnOrderId] = gChosenActionByBattler[battler]; + gBattlerByTurnOrder[turnOrderId] = battler; turnOrderId++; } } - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) + for (battler = 0; battler < gBattlersCount; battler++) { - if (gChosenActionByBattler[gActiveBattler] != B_ACTION_USE_ITEM - && gChosenActionByBattler[gActiveBattler] != B_ACTION_SWITCH - && gChosenActionByBattler[gActiveBattler] != B_ACTION_THROW_BALL) + if (gChosenActionByBattler[battler] != B_ACTION_USE_ITEM + && gChosenActionByBattler[battler] != B_ACTION_SWITCH + && gChosenActionByBattler[battler] != B_ACTION_THROW_BALL) { - gActionsByTurnOrder[turnOrderId] = gChosenActionByBattler[gActiveBattler]; - gBattlerByTurnOrder[turnOrderId] = gActiveBattler; + gActionsByTurnOrder[turnOrderId] = gChosenActionByBattler[battler]; + gBattlerByTurnOrder[turnOrderId] = battler; turnOrderId++; } } @@ -4985,7 +4940,7 @@ static void SetActionsAndBattlersTurnOrder(void) && gActionsByTurnOrder[i] != B_ACTION_THROW_BALL && gActionsByTurnOrder[j] != B_ACTION_THROW_BALL) { - if (GetWhoStrikesFirst(battler1, battler2, FALSE)) + if (GetWhichBattlerFaster(battler1, battler2, FALSE)) SwapTurnOrder(i, j); } } @@ -5000,35 +4955,35 @@ static void TurnValuesCleanUp(bool8 var0) { s32 i; - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) + for (i = 0; i < gBattlersCount; i++) { if (var0) { - gProtectStructs[gActiveBattler].protected = FALSE; - gProtectStructs[gActiveBattler].spikyShielded = FALSE; - gProtectStructs[gActiveBattler].kingsShielded = FALSE; - gProtectStructs[gActiveBattler].banefulBunkered = FALSE; - gProtectStructs[gActiveBattler].quash = FALSE; + gProtectStructs[i].protected = FALSE; + gProtectStructs[i].spikyShielded = FALSE; + gProtectStructs[i].kingsShielded = FALSE; + gProtectStructs[i].banefulBunkered = FALSE; + gProtectStructs[i].quash = FALSE; } else { - memset(&gProtectStructs[gActiveBattler], 0, sizeof(struct ProtectStruct)); + memset(&gProtectStructs[i], 0, sizeof(struct ProtectStruct)); - if (gDisableStructs[gActiveBattler].isFirstTurn) - gDisableStructs[gActiveBattler].isFirstTurn--; + if (gDisableStructs[i].isFirstTurn) + gDisableStructs[i].isFirstTurn--; - if (gDisableStructs[gActiveBattler].rechargeTimer) + if (gDisableStructs[i].rechargeTimer) { - gDisableStructs[gActiveBattler].rechargeTimer--; - if (gDisableStructs[gActiveBattler].rechargeTimer == 0) - gBattleMons[gActiveBattler].status2 &= ~STATUS2_RECHARGE; + gDisableStructs[i].rechargeTimer--; + if (gDisableStructs[i].rechargeTimer == 0) + gBattleMons[i].status2 &= ~STATUS2_RECHARGE; } } - if (gDisableStructs[gActiveBattler].substituteHP == 0) - gBattleMons[gActiveBattler].status2 &= ~STATUS2_SUBSTITUTE; + if (gDisableStructs[i].substituteHP == 0) + gBattleMons[i].status2 &= ~STATUS2_SUBSTITUTE; - gSpecialStatuses[gActiveBattler].parentalBondState = PARENTAL_BOND_OFF; + gSpecialStatuses[i].parentalBondState = PARENTAL_BOND_OFF; } gSideStatuses[B_SIDE_PLAYER] &= ~(SIDE_STATUS_QUICK_GUARD | SIDE_STATUS_WIDE_GUARD | SIDE_STATUS_CRAFTY_SHIELD | SIDE_STATUS_MAT_BLOCK); @@ -5051,9 +5006,9 @@ static void PopulateArrayWithBattlers(u8 *battlers) static bool32 TryDoMegaEvosBeforeMoves(void) { - if (!(gHitMarker & HITMARKER_RUN) && gBattleStruct->mega.toEvolve) + if (!(gHitMarker & HITMARKER_RUN) && (gBattleStruct->mega.toEvolve || gBattleStruct->burst.toBurst)) { - u32 i; + u32 i, battler; struct Pokemon *party; struct Pokemon *mon; u8 megaOrder[MAX_BATTLERS_COUNT]; @@ -5065,17 +5020,29 @@ static bool32 TryDoMegaEvosBeforeMoves(void) if (gBattleStruct->mega.toEvolve & gBitTable[megaOrder[i]] && !(gProtectStructs[megaOrder[i]].noValidMoves)) { - gActiveBattler = gBattlerAttacker = megaOrder[i]; - gBattleStruct->mega.toEvolve &= ~(gBitTable[gActiveBattler]); - gLastUsedItem = gBattleMons[gActiveBattler].item; - party = GetBattlerParty(gActiveBattler); - mon = &party[gBattlerPartyIndexes[gActiveBattler]]; - if (GetBattleFormChangeTargetSpecies(gActiveBattler, FORM_CHANGE_BATTLE_MEGA_EVOLUTION_MOVE) != SPECIES_NONE) + gBattlerAttacker = megaOrder[i]; + gBattleStruct->mega.toEvolve &= ~(gBitTable[gBattlerAttacker]); + gLastUsedItem = gBattleMons[gBattlerAttacker].item; + party = GetBattlerParty(gBattlerAttacker); + mon = &party[gBattlerPartyIndexes[gBattlerAttacker]]; + if (GetBattleFormChangeTargetSpecies(gBattlerAttacker, FORM_CHANGE_BATTLE_MEGA_EVOLUTION_MOVE) != SPECIES_NONE) BattleScriptExecute(BattleScript_WishMegaEvolution); else BattleScriptExecute(BattleScript_MegaEvolution); return TRUE; } + + if (gBattleStruct->burst.toBurst & gBitTable[megaOrder[i]] + && !(gProtectStructs[megaOrder[i]].noValidMoves)) + { + battler = gBattlerAttacker = megaOrder[i]; + gBattleStruct->burst.toBurst &= ~(gBitTable[battler]); + gLastUsedItem = gBattleMons[battler].item; + party = GetBattlerParty(battler); + mon = &party[gBattlerPartyIndexes[battler]]; + BattleScriptExecute(BattleScript_UltraBurst); + return TRUE; + } } } @@ -5103,8 +5070,8 @@ static bool32 TryDoMoveEffectsBeforeMoves(void) && !(gProtectStructs[battlers[i]].noValidMoves)) { gBattleStruct->focusPunchBattlers |= gBitTable[battlers[i]]; - gActiveBattler = gBattlerAttacker = battlers[i]; - switch (gChosenMoveByBattler[gActiveBattler]) + gBattlerAttacker = battlers[i]; + switch (gChosenMoveByBattler[gBattlerAttacker]) { case MOVE_FOCUS_PUNCH: BattleScriptExecute(BattleScript_FocusPunchSetUp); @@ -5137,7 +5104,7 @@ static void TryChangeTurnOrder(void) if (gActionsByTurnOrder[i] == B_ACTION_USE_MOVE && gActionsByTurnOrder[j] == B_ACTION_USE_MOVE) { - if (GetWhoStrikesFirst(battler1, battler2, FALSE)) + if (GetWhichBattlerFaster(battler1, battler2, FALSE)) SwapTurnOrder(i, j); } } @@ -5146,44 +5113,44 @@ static void TryChangeTurnOrder(void) static void CheckQuickClaw_CustapBerryActivation(void) { - u32 i; + u32 i, battler; if (!(gHitMarker & HITMARKER_RUN)) { while (gBattleStruct->quickClawBattlerId < gBattlersCount) { - gActiveBattler = gBattlerAttacker = gBattleStruct->quickClawBattlerId; + battler = gBattlerAttacker = gBattleStruct->quickClawBattlerId; gBattleStruct->quickClawBattlerId++; - if (gChosenActionByBattler[gActiveBattler] == B_ACTION_USE_MOVE - && gChosenMoveByBattler[gActiveBattler] != MOVE_FOCUS_PUNCH // quick claw message doesn't need to activate here - && (gProtectStructs[gActiveBattler].usedCustapBerry || gProtectStructs[gActiveBattler].quickDraw) - && !(gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP) + if (gChosenActionByBattler[battler] == B_ACTION_USE_MOVE + && gChosenMoveByBattler[battler] != MOVE_FOCUS_PUNCH // quick claw message doesn't need to activate here + && (gProtectStructs[battler].usedCustapBerry || gProtectStructs[battler].quickDraw) + && !(gBattleMons[battler].status1 & STATUS1_SLEEP) && !(gDisableStructs[gBattlerAttacker].truantCounter) - && !(gProtectStructs[gActiveBattler].noValidMoves)) + && !(gProtectStructs[battler].noValidMoves)) { - if (gProtectStructs[gActiveBattler].usedCustapBerry) + if (gProtectStructs[battler].usedCustapBerry) { - gProtectStructs[gActiveBattler].usedCustapBerry = FALSE; - gLastUsedItem = gBattleMons[gActiveBattler].item; + gProtectStructs[battler].usedCustapBerry = FALSE; + gLastUsedItem = gBattleMons[battler].item; PREPARE_ITEM_BUFFER(gBattleTextBuff1, gLastUsedItem); - if (GetBattlerHoldEffect(gActiveBattler, FALSE) == HOLD_EFFECT_CUSTAP_BERRY) + if (GetBattlerHoldEffect(battler, FALSE) == HOLD_EFFECT_CUSTAP_BERRY) { // don't record berry since its gone now BattleScriptExecute(BattleScript_CustapBerryActivation); } else { - RecordItemEffectBattle(gActiveBattler, GetBattlerHoldEffect(gActiveBattler, FALSE)); + RecordItemEffectBattle(battler, GetBattlerHoldEffect(battler, FALSE)); BattleScriptExecute(BattleScript_QuickClawActivation); } } - else if (gProtectStructs[gActiveBattler].quickDraw) + else if (gProtectStructs[battler].quickDraw) { - gBattlerAbility = gActiveBattler; - gProtectStructs[gActiveBattler].quickDraw = FALSE; - gLastUsedAbility = gBattleMons[gActiveBattler].ability; + gBattlerAbility = battler; + gProtectStructs[battler].quickDraw = FALSE; + gLastUsedAbility = gBattleMons[battler].ability; PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gLastUsedAbility); - RecordAbilityBattle(gActiveBattler, gLastUsedAbility); + RecordAbilityBattle(battler, gLastUsedAbility); BattleScriptExecute(BattleScript_QuickDrawActivation); } return; @@ -5236,7 +5203,7 @@ static void RunTurnActionsFunctions(void) } else { - if (gBattleStruct->savedTurnActionNumber != gCurrentTurnActionNumber) // action turn has been done, clear hitmarker bits for another battlerId + if (gBattleStruct->savedTurnActionNumber != gCurrentTurnActionNumber) // action turn has been done, clear hitmarker bits for another battler { gHitMarker &= ~HITMARKER_NO_ATTACKSTRING; gHitMarker &= ~HITMARKER_UNABLE_TO_USE_MOVE; @@ -5384,7 +5351,7 @@ static void HandleEndTurn_MonFled(void) static void HandleEndTurn_FinishBattle(void) { - u32 i; + u32 i, battler; if (gCurrentActionFuncId == B_ACTION_TRY_FINISH || gCurrentActionFuncId == B_ACTION_FINISHED) { @@ -5396,19 +5363,19 @@ static void HandleEndTurn_FinishBattle(void) | BATTLE_TYPE_WALLY_TUTORIAL | BATTLE_TYPE_FRONTIER))) { - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) + for (battler = 0; battler < gBattlersCount; battler++) { - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) { if (gBattleResults.playerMon1Species == SPECIES_NONE) { - gBattleResults.playerMon1Species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES, NULL); - GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_NICKNAME, gBattleResults.playerMon1Name); + gBattleResults.playerMon1Species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES, NULL); + GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_NICKNAME, gBattleResults.playerMon1Name); } else { - gBattleResults.playerMon2Species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES, NULL); - GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_NICKNAME, gBattleResults.playerMon2Name); + gBattleResults.playerMon2Species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES, NULL); + GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_NICKNAME, gBattleResults.playerMon2Name); } } } @@ -5620,7 +5587,7 @@ void RunBattleScriptCommands(void) gBattleScriptingCommandsTable[gBattlescriptCurrInstr[0]](); } -void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk) +void SetTypeBeforeUsingMove(u32 move, u32 battlerAtk) { u32 moveType, ateType, attackerAbility; u16 holdEffect = GetBattlerHoldEffect(battlerAtk, TRUE); @@ -5730,8 +5697,7 @@ void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk) gBattleStruct->dynamicMoveType = TYPE_NORMAL | F_DYNAMIC_TYPE_2; gBattleStruct->ateBoost[battlerAtk] = 1; } - else if (gBattleMoves[move].flags & FLAG_SOUND - && attackerAbility == ABILITY_LIQUID_VOICE) + else if (gBattleMoves[move].soundMove && attackerAbility == ABILITY_LIQUID_VOICE) { gBattleStruct->dynamicMoveType = TYPE_WATER | F_DYNAMIC_TYPE_2; } @@ -5756,20 +5722,20 @@ void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk) // special to set a field's totem boost(s) // inputs: -// var8000: battlerId +// var8000: battler // var8001 - var8007: stat changes void SetTotemBoost(void) { - u8 battlerId = gSpecialVar_0x8000; - u8 i; + u32 battler = gSpecialVar_0x8000; + u32 i; for (i = 0; i < (NUM_BATTLE_STATS - 1); i++) { if (*(&gSpecialVar_0x8001 + i)) { - gTotemBoosts[battlerId].stats |= (1 << i); - gTotemBoosts[battlerId].statChanges[i] = *(&gSpecialVar_0x8001 + i); - gTotemBoosts[battlerId].stats |= 0x80; // used as a flag for the "totem flared to life" script + gTotemBoosts[battler].stats |= (1 << i); + gTotemBoosts[battler].statChanges[i] = *(&gSpecialVar_0x8001 + i); + gTotemBoosts[battler].stats |= 0x80; // used as a flag for the "totem flared to life" script } } } diff --git a/src/battle_message.c b/src/battle_message.c index 2a51761b3586..a1c862beb473 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -266,17 +266,17 @@ static const u8 sText_XFoundOneY[] = _("{B_ATK_NAME_WITH_PREFIX} found\none {B_L static const u8 sText_SoothingAroma[] = _("A soothing aroma wafted\nthrough the area!"); static const u8 sText_ItemsCantBeUsedNow[] = _("Items can't be used now.{PAUSE 64}"); static const u8 sText_ForXCommaYZ[] = _("For {B_SCR_ACTIVE_NAME_WITH_PREFIX},\n{B_LAST_ITEM} {B_BUFF1}"); -static const u8 sText_PkmnUsedXToGetPumped[] = _("{B_ACTIVE_NAME_WITH_PREFIX} used\n{B_LAST_ITEM} to get pumped!"); +static const u8 sText_PkmnUsedXToGetPumped[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} used\n{B_LAST_ITEM} to get pumped!"); static const u8 sText_PkmnLostFocus[] = _("{B_ATK_NAME_WITH_PREFIX} lost its\nfocus and couldn't move!"); static const u8 sText_PkmnWasDraggedOut[] = _("{B_DEF_NAME_WITH_PREFIX} was\ndragged out!\p"); static const u8 sText_TheWallShattered[] = _("The wall shattered!"); static const u8 sText_ButNoEffect[] = _("But it had no effect!"); -static const u8 sText_PkmnHasNoMovesLeft[] = _("{B_ACTIVE_NAME_WITH_PREFIX} has no\nmoves left!\p"); -static const u8 sText_PkmnMoveIsDisabled[] = _("{B_ACTIVE_NAME_WITH_PREFIX}'s {B_CURRENT_MOVE}\nis disabled!\p"); -static const u8 sText_PkmnCantUseMoveTorment[] = _("{B_ACTIVE_NAME_WITH_PREFIX} can't use the same\nmove in a row due to the Torment!\p"); -static const u8 sText_PkmnCantUseMoveTaunt[] = _("{B_ACTIVE_NAME_WITH_PREFIX} can't use\n{B_CURRENT_MOVE} after the Taunt!\p"); -static const u8 sText_PkmnCantUseMoveSealed[] = _("{B_ACTIVE_NAME_WITH_PREFIX} can't use the\nsealed {B_CURRENT_MOVE}!\p"); -static const u8 sText_PkmnCantUseMoveThroatChop[] = _("{B_ACTIVE_NAME_WITH_PREFIX} can't use\n{B_CURRENT_MOVE} due to Throat Chop!\p"); +static const u8 sText_PkmnHasNoMovesLeft[] = _("{B_ATK_NAME_WITH_PREFIX} has no\nmoves left!\p"); +static const u8 sText_PkmnMoveIsDisabled[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_CURRENT_MOVE}\nis disabled!\p"); +static const u8 sText_PkmnCantUseMoveTorment[] = _("{B_ATK_NAME_WITH_PREFIX} can't use the same\nmove in a row due to the Torment!\p"); +static const u8 sText_PkmnCantUseMoveTaunt[] = _("{B_ATK_NAME_WITH_PREFIX} can't use\n{B_CURRENT_MOVE} after the Taunt!\p"); +static const u8 sText_PkmnCantUseMoveSealed[] = _("{B_ATK_NAME_WITH_PREFIX} can't use the\nsealed {B_CURRENT_MOVE}!\p"); +static const u8 sText_PkmnCantUseMoveThroatChop[] = _("{B_ATK_NAME_WITH_PREFIX} can't use\n{B_CURRENT_MOVE} due to Throat Chop!\p"); static const u8 sText_PkmnMadeItRain[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\nmade it rain!"); static const u8 sText_PkmnRaisedSpeed[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\nraised its SPEED!"); static const u8 sText_PkmnProtectedBy[] = _("{B_DEF_NAME_WITH_PREFIX} was protected\nby {B_DEF_ABILITY}!"); @@ -800,9 +800,20 @@ static const u8 sText_ItemCuredSpeciesStatus[] = _("{B_BUFF1} had\nits status he static const u8 sText_ItemRestoredSpeciesPP[] = _("{B_BUFF1} had its\nPP restored!"); static const u8 sText_AtkTrappedDef[] = _("{B_ATK_NAME_WITH_PREFIX} trapped\nthe {B_DEF_NAME_WITH_PREFIX}!"); static const u8 sText_MirrorHerbCopied[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} used its {B_LAST_ITEM}\nto mirror its opponent's stat changes!"); +static const u8 sText_PkmnItemMelted[] = _("{B_ATK_NAME_WITH_PREFIX} corroded\n{B_DEF_NAME_WITH_PREFIX}'s {B_LAST_ITEM}!"); +static const u8 sText_UltraBurstReacting[] = _("Bright light is about to\nburst out of {B_ATK_NAME_WITH_PREFIX}!"); +static const u8 sText_UltraBurstCompleted[] = _("{B_ATK_NAME_WITH_PREFIX} regained its\ntrue power through Ultra Burst!"); +static const u8 sText_TeamGainedEXP[] = _("The rest of your team gained EXP.\nPoints thanks to the {B_LAST_ITEM}!\p"); +static const u8 sText_CurrentMoveCantSelect[] = _("{B_BUFF1} cannot be used!\p"); +static const u8 sText_TargetIsBeingSaltCured[] = _("{B_DEF_NAME_WITH_PREFIX} is being salt cured!"); +static const u8 sText_TargetIsHurtBySaltCure[] = _("{B_DEF_NAME_WITH_PREFIX} is hurt by {B_BUFF1}!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_TARGETISHURTBYSALTCURE - BATTLESTRINGS_TABLE_START] = sText_TargetIsHurtBySaltCure, + [STRINGID_TARGETISBEINGSALTCURED - BATTLESTRINGS_TABLE_START] = sText_TargetIsBeingSaltCured, + [STRINGID_CURRENTMOVECANTSELECT - BATTLESTRINGS_TABLE_START] = sText_CurrentMoveCantSelect, + [STRINGID_PKMNITEMMELTED - BATTLESTRINGS_TABLE_START] = sText_PkmnItemMelted, [STRINGID_MIRRORHERBCOPIED - BATTLESTRINGS_TABLE_START] = sText_MirrorHerbCopied, [STRINGID_THUNDERCAGETRAPPED - BATTLESTRINGS_TABLE_START] = sText_AtkTrappedDef, [STRINGID_ITEMRESTOREDSPECIESHEALTH - BATTLESTRINGS_TABLE_START] = sText_ItemRestoredSpeciesHealth, @@ -1455,6 +1466,9 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = [STRINGID_PKMNFROSTBITEHEALED - BATTLESTRINGS_TABLE_START] = sText_PkmnFrostbiteHealed, [STRINGID_PKMNFROSTBITEHEALED2 - BATTLESTRINGS_TABLE_START] = sText_PkmnFrostbiteHealed2, [STRINGID_PKMNFROSTBITEHEALEDBY - BATTLESTRINGS_TABLE_START] = sText_PkmnFrostbiteHealedBy, + [STRINGID_ULTRABURSTREACTING - BATTLESTRINGS_TABLE_START] = sText_UltraBurstReacting, + [STRINGID_ULTRABURSTCOMPLETED - BATTLESTRINGS_TABLE_START] = sText_UltraBurstCompleted, + [STRINGID_TEAMGAINEDEXP - BATTLESTRINGS_TABLE_START] = sText_TeamGainedEXP, }; const u16 gTrainerUsedItemStringIds[] = @@ -1836,7 +1850,11 @@ const u16 gWeatherStartsStringIds[] = [WEATHER_SUNNY_CLOUDS] = STRINGID_ITISRAINING, [WEATHER_SUNNY] = STRINGID_ITISRAINING, [WEATHER_RAIN] = STRINGID_ITISRAINING, - [WEATHER_SNOW] = STRINGID_ITISRAINING, +#if B_OVERWORLD_SNOW >= GEN_9 + [WEATHER_SNOW] = STRINGID_STARTEDSNOW, +#else + [WEATHER_SNOW] = STRINGID_STARTEDHAIL, +#endif [WEATHER_RAIN_THUNDERSTORM] = STRINGID_ITISRAINING, [WEATHER_FOG_HORIZONTAL] = STRINGID_ITISRAINING, [WEATHER_VOLCANIC_ASH] = STRINGID_ITISRAINING, @@ -1943,7 +1961,7 @@ const u8 gText_PkmnIsEvolving[] = _("What?\n{STR_VAR_1} is evolving!"); const u8 gText_CongratsPkmnEvolved[] = _("Congratulations! Your {STR_VAR_1}\nevolved into {STR_VAR_2}!{WAIT_SE}\p"); const u8 gText_PkmnStoppedEvolving[] = _("Huh? {STR_VAR_1}\nstopped evolving!\p"); const u8 gText_EllipsisQuestionMark[] = _("……?\p"); -const u8 gText_WhatWillPkmnDo[] = _("What will\n{B_ACTIVE_NAME2} do?"); +const u8 gText_WhatWillPkmnDo[] = _("What will\n{B_BUFF1} do?"); const u8 gText_WhatWillPkmnDo2[] = _("What will\n{B_PLAYER_NAME} do?"); const u8 gText_WhatWillWallyDo[] = _("What will\nWALLY do?"); const u8 gText_LinkStandby[] = _("{PAUSE 16}Link standby…"); @@ -1992,7 +2010,8 @@ const u8 gText_Draw[] = _("{HIGHLIGHT TRANSPARENT}Draw"); static const u8 sText_SpaceIs[] = _(" is"); static const u8 sText_ApostropheS[] = _("'s"); -// For displaying names of invalid moves +// For displaying names of invalid moves. +// This is large enough that the text for TYPE_ELECTRIC will exceed TEXT_BUFF_ARRAY_COUNT. static const u8 sATypeMove_Table[NUMBER_OF_MON_TYPES][17] = { [TYPE_NORMAL] = _("a NORMAL move"), @@ -2146,7 +2165,7 @@ static const u16 sGrammarMoveUsedTable[] = MOVE_COVET, 0 }; -static const u8 sDummyWeirdStatusString[] = {EOS, EOS, EOS, EOS, EOS, EOS, EOS, EOS, 0, 0}; +static const u8 sText_EmptyStatus[] = _("$$$$$$$"); static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = { @@ -2629,12 +2648,12 @@ static const struct BattleWindowText *const sBattleTextOnWindowsInfo[] = static const u8 sRecordedBattleTextSpeeds[] = {8, 4, 1, 0}; -void BufferStringBattle(u16 stringID) +void BufferStringBattle(u16 stringID, u32 battler) { s32 i; const u8 *stringPtr = NULL; - gBattleMsgDataPtr = (struct BattleMsgData *)(&gBattleResources->bufferA[gActiveBattler][4]); + gBattleMsgDataPtr = (struct BattleMsgData *)(&gBattleResources->bufferA[battler][4]); gLastUsedItem = gBattleMsgDataPtr->lastItem; gLastUsedAbility = gBattleMsgDataPtr->lastAbility; gBattleScripting.battler = gBattleMsgDataPtr->scrActive; @@ -2707,9 +2726,9 @@ void BufferStringBattle(u16 stringID) } break; case STRINGID_INTROSENDOUT: // poke first send-out - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) { - if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]])) + if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]])) { if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) stringPtr = sText_InGamePartnerSentOutZGoN; @@ -2727,7 +2746,7 @@ void BufferStringBattle(u16 stringID) } else { - if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]])) + if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]])) { if (BATTLE_TWO_VS_ONE_OPPONENT) stringPtr = sText_Trainer1SentOutTwoPkmn; @@ -2754,7 +2773,7 @@ void BufferStringBattle(u16 stringID) } break; case STRINGID_RETURNMON: // sending poke to ball msg - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) { if (*(&gBattleStruct->hpScale) == 0) stringPtr = sText_PkmnThatsEnough; @@ -2843,7 +2862,7 @@ void BufferStringBattle(u16 stringID) if (gBattleTextBuff1[0] & B_OUTCOME_LINK_BATTLE_RAN) { gBattleTextBuff1[0] &= ~(B_OUTCOME_LINK_BATTLE_RAN); - if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT && gBattleTextBuff1[0] != B_OUTCOME_DREW) + if (GetBattlerSide(battler) == B_SIDE_OPPONENT && gBattleTextBuff1[0] != B_OUTCOME_DREW) gBattleTextBuff1[0] ^= (B_OUTCOME_LOST | B_OUTCOME_WON); if (gBattleTextBuff1[0] == B_OUTCOME_LOST || gBattleTextBuff1[0] == B_OUTCOME_DREW) @@ -2855,7 +2874,7 @@ void BufferStringBattle(u16 stringID) } else { - if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT && gBattleTextBuff1[0] != B_OUTCOME_DREW) + if (GetBattlerSide(battler) == B_SIDE_OPPONENT && gBattleTextBuff1[0] != B_OUTCOME_DREW) gBattleTextBuff1[0] ^= (B_OUTCOME_LOST | B_OUTCOME_WON); if (gBattleTypeFlags & BATTLE_TYPE_MULTI) @@ -2939,10 +2958,10 @@ static const u8 *TryGetStatusString(u8 *src) u32 chars1, chars2; u8 *statusPtr; - memcpy(status, sDummyWeirdStatusString, 8); + memcpy(status, sText_EmptyStatus, min(ARRAY_COUNT(status), ARRAY_COUNT(sText_EmptyStatus))); statusPtr = status; - for (i = 0; i < 8; i++) + for (i = 0; i < ARRAY_COUNT(status); i++) { if (*src == EOS) break; // one line required to match -g *statusPtr = *src; @@ -2962,24 +2981,24 @@ static const u8 *TryGetStatusString(u8 *src) return NULL; } -static void GetBattlerNick(u32 battlerId, u8 *dst) +static void GetBattlerNick(u32 battler, u8 *dst) { struct Pokemon *mon, *illusionMon; - if (GET_BATTLER_SIDE(battlerId) == B_SIDE_PLAYER) - mon = &gPlayerParty[gBattlerPartyIndexes[battlerId]]; + if (GetBattlerSide(battler) == B_SIDE_PLAYER) + mon = &gPlayerParty[gBattlerPartyIndexes[battler]]; else - mon = &gEnemyParty[gBattlerPartyIndexes[battlerId]]; + mon = &gEnemyParty[gBattlerPartyIndexes[battler]]; - illusionMon = GetIllusionMonPtr(battlerId); + illusionMon = GetIllusionMonPtr(battler); if (illusionMon != NULL) mon = illusionMon; GetMonData(mon, MON_DATA_NICKNAME, dst); StringGet_Nickname(dst); } -#define HANDLE_NICKNAME_STRING_CASE(battlerId) \ - if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) \ +#define HANDLE_NICKNAME_STRING_CASE(battler) \ + if (GetBattlerSide(battler) != B_SIDE_PLAYER) \ { \ if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) \ toCpy = sText_FoePkmnPrefix; \ @@ -2992,10 +3011,10 @@ static void GetBattlerNick(u32 battlerId, u8 *dst) toCpy++; \ } \ } \ - GetBattlerNick(battlerId, text); \ + GetBattlerNick(battler, text); \ toCpy = text; -static const u8 *BattleStringGetOpponentNameByTrainerId(u16 trainerId, u8 *text, u8 multiplayerId, u8 battlerId) +static const u8 *BattleStringGetOpponentNameByTrainerId(u16 trainerId, u8 *text, u8 multiplayerId, u8 battler) { const u8 *toCpy; @@ -3015,9 +3034,9 @@ static const u8 *BattleStringGetOpponentNameByTrainerId(u16 trainerId, u8 *text, else if (trainerId == TRAINER_LINK_OPPONENT) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI) - toCpy = gLinkPlayers[GetBattlerMultiplayerId(battlerId)].name; + toCpy = gLinkPlayers[GetBattlerMultiplayerId(battler)].name; else - toCpy = gLinkPlayers[GetBattlerMultiplayerId(battlerId) & BIT_SIDE].name; + toCpy = gLinkPlayers[GetBattlerMultiplayerId(battler) & BIT_SIDE].name; } else if (trainerId == TRAINER_FRONTIER_BRAIN) { @@ -3047,31 +3066,31 @@ static const u8 *BattleStringGetOpponentNameByTrainerId(u16 trainerId, u8 *text, return toCpy; } -static const u8 *BattleStringGetOpponentName(u8 *text, u8 multiplayerId, u8 battlerId) +static const u8 *BattleStringGetOpponentName(u8 *text, u8 multiplayerId, u8 battler) { const u8 *toCpy; - switch (GetBattlerPosition(battlerId)) + switch (GetBattlerPosition(battler)) { case B_POSITION_OPPONENT_LEFT: - toCpy = BattleStringGetOpponentNameByTrainerId(gTrainerBattleOpponent_A, text, multiplayerId, battlerId); + toCpy = BattleStringGetOpponentNameByTrainerId(gTrainerBattleOpponent_A, text, multiplayerId, battler); break; case B_POSITION_OPPONENT_RIGHT: if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_MULTI) && !BATTLE_TWO_VS_ONE_OPPONENT) - toCpy = BattleStringGetOpponentNameByTrainerId(gTrainerBattleOpponent_B, text, multiplayerId, battlerId); + toCpy = BattleStringGetOpponentNameByTrainerId(gTrainerBattleOpponent_B, text, multiplayerId, battler); else - toCpy = BattleStringGetOpponentNameByTrainerId(gTrainerBattleOpponent_A, text, multiplayerId, battlerId); + toCpy = BattleStringGetOpponentNameByTrainerId(gTrainerBattleOpponent_A, text, multiplayerId, battler); break; } return toCpy; } -static const u8 *BattleStringGetPlayerName(u8 *text, u8 battlerId) +static const u8 *BattleStringGetPlayerName(u8 *text, u8 battler) { const u8 *toCpy; - switch (GetBattlerPosition(battlerId)) + switch (GetBattlerPosition(battler)) { case B_POSITION_PLAYER_LEFT: if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) @@ -3104,12 +3123,12 @@ static const u8 *BattleStringGetPlayerName(u8 *text, u8 battlerId) return toCpy; } -static const u8 *BattleStringGetTrainerName(u8 *text, u8 multiplayerId, u8 battlerId) +static const u8 *BattleStringGetTrainerName(u8 *text, u8 multiplayerId, u8 battler) { - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) - return BattleStringGetPlayerName(text, battlerId); + if (GetBattlerSide(battler) == B_SIDE_PLAYER) + return BattleStringGetPlayerName(text, battler); else - return BattleStringGetOpponentName(text, multiplayerId, battlerId); + return BattleStringGetOpponentName(text, multiplayerId, battler); } static const u8 *BattleStringGetOpponentClassByTrainerId(u16 trainerId) @@ -3134,11 +3153,16 @@ static const u8 *BattleStringGetOpponentClassByTrainerId(u16 trainerId) return toCpy; } +// Ensure the defined length for an item name can contain the full defined length of a berry name. +// This ensures that custom Enigma Berry names will fit in the text buffer at the top of BattleStringExpandPlaceholders. +STATIC_ASSERT(BERRY_NAME_LENGTH + ARRAY_COUNT(sText_BerrySuffix) <= ITEM_NAME_LENGTH, BerryNameTooLong); + u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst) { u32 dstID = 0; // if they used dstID, why not use srcID as well? const u8 *toCpy = NULL; - u8 text[30]; + // This buffer may hold either the name of a trainer, pokemon, or item. + u8 text[max(max(max(32, TRAINER_NAME_LENGTH + 1), POKEMON_NAME_LENGTH + 1), ITEM_NAME_LENGTH)]; u8 multiplayerId; s32 i; @@ -3243,25 +3267,10 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst) GetBattlerNick(gBattlerTarget, text); toCpy = text; break; - case B_TXT_ACTIVE_NAME: // active name - GetBattlerNick(gActiveBattler, text); - toCpy = text; - break; - case B_TXT_ACTIVE_NAME2: // active battlerId name with prefix, no illusion - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_NICKNAME, text); - else - GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_NICKNAME, text); - StringGet_Nickname(text); - toCpy = text; - break; - case B_TXT_EFF_NAME_WITH_PREFIX: // effect battlerId name with prefix + case B_TXT_EFF_NAME_WITH_PREFIX: // effect battler name with prefix HANDLE_NICKNAME_STRING_CASE(gEffectBattler) break; - case B_TXT_ACTIVE_NAME_WITH_PREFIX: // active battlerId name with prefix - HANDLE_NICKNAME_STRING_CASE(gActiveBattler) - break; - case B_TXT_SCR_ACTIVE_NAME_WITH_PREFIX: // scripting active battlerId name with prefix + case B_TXT_SCR_ACTIVE_NAME_WITH_PREFIX: // scripting active battler name with prefix HANDLE_NICKNAME_STRING_CASE(gBattleScripting.battler) break; case B_TXT_CURRENT_MOVE: // current move name @@ -3335,7 +3344,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst) case B_TXT_SCR_ACTIVE_ABILITY: // scripting active ability toCpy = gAbilityNames[sBattlerAbilities[gBattleScripting.battler]]; break; - case B_TXT_EFF_ABILITY: // effect battlerId ability + case B_TXT_EFF_ABILITY: // effect battler ability toCpy = gAbilityNames[sBattlerAbilities[gEffectBattler]]; break; case B_TXT_TRAINER1_CLASS: // trainer class name @@ -3574,7 +3583,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst) return dstID; } -static void IllusionNickHack(u32 battlerId, u32 partyId, u8 *dst) +static void IllusionNickHack(u32 battler, u32 partyId, u8 *dst) { s32 id, i; // we know it's gEnemyParty @@ -3582,8 +3591,8 @@ static void IllusionNickHack(u32 battlerId, u32 partyId, u8 *dst) if (GetMonAbility(mon) == ABILITY_ILLUSION) { - if (IsBattlerAlive(BATTLE_PARTNER(battlerId))) - partnerMon = &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]]; + if (IsBattlerAlive(BATTLE_PARTNER(battler))) + partnerMon = &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]]; else partnerMon = mon; @@ -3609,7 +3618,7 @@ void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst) { u32 srcID = 1; u32 value = 0; - u8 text[12]; + u8 nickname[POKEMON_NAME_LENGTH + 1]; u16 hword; *dst = EOS; @@ -3649,7 +3658,7 @@ void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst) case B_BUFF_MON_NICK_WITH_PREFIX: // poke nick with prefix if (GetBattlerSide(src[srcID + 1]) == B_SIDE_PLAYER) { - GetMonData(&gPlayerParty[src[srcID + 2]], MON_DATA_NICKNAME, text); + GetMonData(&gPlayerParty[src[srcID + 2]], MON_DATA_NICKNAME, nickname); } else { @@ -3658,10 +3667,10 @@ void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst) else StringAppend(dst, sText_WildPkmnPrefix); - GetMonData(&gEnemyParty[src[srcID + 2]], MON_DATA_NICKNAME, text); + GetMonData(&gEnemyParty[src[srcID + 2]], MON_DATA_NICKNAME, nickname); } - StringGet_Nickname(text); - StringAppend(dst, text); + StringGet_Nickname(nickname); + StringAppend(dst, nickname); srcID += 3; break; case B_BUFF_STAT: // stats @@ -3669,7 +3678,7 @@ void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst) srcID += 2; break; case B_BUFF_SPECIES: // species name - GetSpeciesName(dst, T1_READ_16(&src[srcID + 1])); + StringCopy(dst, GetSpeciesName(T1_READ_16(&src[srcID + 1]))); srcID += 3; break; case B_BUFF_MON_NICK: // poke nick without prefix @@ -3887,17 +3896,17 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId) } } -void SetPpNumbersPaletteInMoveSelection(void) +void SetPpNumbersPaletteInMoveSelection(u32 battler) { - struct ChooseMoveStruct *chooseMoveStruct = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[gActiveBattler][4]); + struct ChooseMoveStruct *chooseMoveStruct = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]); const u16 *palPtr = gPPTextPalette; u8 var; if (!gBattleStruct->zmove.viewing) - var = GetCurrentPpToMaxPpState(chooseMoveStruct->currentPp[gMoveSelectionCursor[gActiveBattler]], - chooseMoveStruct->maxPp[gMoveSelectionCursor[gActiveBattler]]); + var = GetCurrentPpToMaxPpState(chooseMoveStruct->currentPp[gMoveSelectionCursor[battler]], + chooseMoveStruct->maxPp[gMoveSelectionCursor[battler]]); else - var = GetCurrentPpToMaxPpState(chooseMoveStruct->currentPp[gMoveSelectionCursor[gActiveBattler]], gBattleMoves[gMoveSelectionCursor[gActiveBattler]].pp); + var = GetCurrentPpToMaxPpState(chooseMoveStruct->currentPp[gMoveSelectionCursor[battler]], gBattleMoves[gMoveSelectionCursor[battler]].pp); gPlttBufferUnfaded[BG_PLTT_ID(5) + 12] = palPtr[(var * 2) + 0]; gPlttBufferUnfaded[BG_PLTT_ID(5) + 11] = palPtr[(var * 2) + 1]; @@ -4004,38 +4013,38 @@ enum NOT_EQUAL, }; -u32 BattlerHPPercentage(u32 battlerId, u32 operation, u32 threshold) +u32 BattlerHPPercentage(u32 battler, u32 operation, u32 threshold) { switch (operation) { case LESS_THAN: - return gBattleMons[battlerId].hp < (gBattleMons[battlerId].maxHP / threshold); + return gBattleMons[battler].hp < (gBattleMons[battler].maxHP / threshold); case EQUAL: - return gBattleMons[battlerId].hp == (gBattleMons[battlerId].maxHP / threshold); + return gBattleMons[battler].hp == (gBattleMons[battler].maxHP / threshold); case GREATER_THAN: - return gBattleMons[battlerId].hp > (gBattleMons[battlerId].maxHP / threshold); + return gBattleMons[battler].hp > (gBattleMons[battler].maxHP / threshold); case LESS_THAN_OR_EQUAL: - return gBattleMons[battlerId].hp <= (gBattleMons[battlerId].maxHP / threshold); + return gBattleMons[battler].hp <= (gBattleMons[battler].maxHP / threshold); case GREATER_THAN_OR_EQUAL: - return gBattleMons[battlerId].hp >= (gBattleMons[battlerId].maxHP / threshold); + return gBattleMons[battler].hp >= (gBattleMons[battler].maxHP / threshold); case NOT_EQUAL: - return gBattleMons[battlerId].hp != (gBattleMons[battlerId].maxHP / threshold); + return gBattleMons[battler].hp != (gBattleMons[battler].maxHP / threshold); default: break; } } -u32 ShouldDoTrainerSlide(u32 battlerId, u32 which) +u32 ShouldDoTrainerSlide(u32 battler, u32 which) { u32 i, firstId, lastId, trainerId, retValue = 1; - if (!(gBattleTypeFlags & BATTLE_TYPE_TRAINER) || GetBattlerSide(battlerId) != B_SIDE_OPPONENT) + if (!(gBattleTypeFlags & BATTLE_TYPE_TRAINER) || GetBattlerSide(battler) != B_SIDE_OPPONENT) return 0; // Two opponents support. if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) { - if (gBattlerPartyIndexes[battlerId] >= 3) + if (gBattlerPartyIndexes[battler] >= 3) { firstId = 3, lastId = PARTY_SIZE; trainerId = gTrainerBattleOpponent_B; @@ -4059,11 +4068,11 @@ u32 ShouldDoTrainerSlide(u32 battlerId, u32 which) && (((gBattleTypeFlags & BATTLE_TYPE_FRONTIER) && sTrainerSlides[i].isFrontierTrainer) || (!(gBattleTypeFlags & BATTLE_TYPE_FRONTIER) && !sTrainerSlides[i].isFrontierTrainer))) { - gBattleScripting.battler = battlerId; + gBattleScripting.battler = battler; switch (which) { case TRAINER_SLIDE_LAST_SWITCHIN: - if (sTrainerSlides[i].msgLastSwitchIn != NULL && !CanBattlerSwitch(battlerId)) + if (sTrainerSlides[i].msgLastSwitchIn != NULL && !CanBattlerSwitch(battler)) { gBattleStruct->trainerSlideMsg = sTrainerSlides[i].msgLastSwitchIn; return retValue; @@ -4072,7 +4081,7 @@ u32 ShouldDoTrainerSlide(u32 battlerId, u32 which) case TRAINER_SLIDE_LAST_LOW_HP: if (sTrainerSlides[i].msgLastLowHp != NULL && GetEnemyMonCount(firstId, lastId, TRUE) == 1 - && BattlerHPPercentage(battlerId, GREATER_THAN_OR_EQUAL, 4) + && BattlerHPPercentage(battler, GREATER_THAN_OR_EQUAL, 4) && !gBattleStruct->trainerSlideLowHpMsgDone) { gBattleStruct->trainerSlideLowHpMsgDone = TRUE; @@ -4090,7 +4099,7 @@ u32 ShouldDoTrainerSlide(u32 battlerId, u32 which) case TRAINER_SLIDE_LAST_HALF_HP: if (sTrainerSlides[i].msgLastHalfHp != NULL && GetEnemyMonCount(firstId, lastId, TRUE) == GetEnemyMonCount(firstId, lastId, FALSE) - 1 - && BattlerHPPercentage(battlerId, LESS_THAN_OR_EQUAL, 2) && BattlerHPPercentage(battlerId, GREATER_THAN, 4) + && BattlerHPPercentage(battler, LESS_THAN_OR_EQUAL, 2) && BattlerHPPercentage(battler, GREATER_THAN, 4) && !gBattleStruct->trainerSlideHalfHpMsgDone) { gBattleStruct->trainerSlideHalfHpMsgDone = TRUE; @@ -4109,7 +4118,7 @@ u32 ShouldDoTrainerSlide(u32 battlerId, u32 which) case TRAINER_SLIDE_FIRST_SUPER_EFFECTIVE_HIT: if (sTrainerSlides[i].msgFirstSuperEffectiveHit != NULL && gBattleStruct->trainerSlideFirstSuperEffectiveHitMsgState == 1 - && gBattleMons[battlerId].hp) + && gBattleMons[battler].hp) { gBattleStruct->trainerSlideFirstSuperEffectiveHitMsgState = 2; gBattleStruct->trainerSlideMsg = sTrainerSlides[i].msgFirstSuperEffectiveHit; diff --git a/src/battle_palace.c b/src/battle_palace.c index 0fa65200a6f0..a521acea2bf1 100644 --- a/src/battle_palace.c +++ b/src/battle_palace.c @@ -181,7 +181,7 @@ static void IncrementPalaceStreak(void) static void SavePalaceChallenge(void) { gSaveBlock2Ptr->frontier.challengeStatus = gSpecialVar_0x8005; - VarSet(VAR_TEMP_0, 0); + VarSet(VAR_TEMP_CHALLENGE_STATUS, 0); gSaveBlock2Ptr->frontier.challengePaused = TRUE; SaveGameFrontier(); } diff --git a/src/battle_pike.c b/src/battle_pike.c index 37dfd9997d19..34aaf2a76986 100644 --- a/src/battle_pike.c +++ b/src/battle_pike.c @@ -708,7 +708,7 @@ static void ClearInWildMonRoom(void) static void SavePikeChallenge(void) { gSaveBlock2Ptr->frontier.challengeStatus = gSpecialVar_0x8005; - VarSet(VAR_TEMP_0, 0); + VarSet(VAR_TEMP_CHALLENGE_STATUS, 0); gSaveBlock2Ptr->frontier.challengePaused = TRUE; SaveMapView(); TrySavingData(SAVE_LINK); @@ -1281,6 +1281,10 @@ static void TryHealMons(u8 healCount) for (i = 0; i < FRONTIER_PARTY_SIZE; i++) indices[i] = i; + + // Only 'healCount' number of pokemon will be healed. + // The order in which they're (attempted to be) healed is random, + // and determined by performing 10 random swaps to this index array. for (k = 0; k < 10; k++) { u8 temp; @@ -1437,6 +1441,7 @@ static void PrepareTwoTrainers(void) gFacilityTrainers = gBattleFrontierTrainers; do { + // Pick the 1st trainer, making sure it's not one that's been encountered yet in this challenge. trainerId = GetRandomScaledFrontierTrainerId(challengeNum, 1); for (i = 0; i < gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1; i++) { @@ -1452,6 +1457,7 @@ static void PrepareTwoTrainers(void) do { + // Pick the 2nd trainer, making sure it's not one that's been encountered yet in this challenge. trainerId = GetRandomScaledFrontierTrainerId(challengeNum, 1); for (i = 0; i < gSaveBlock2Ptr->frontier.curChallengeBattleNum; i++) { diff --git a/src/battle_pyramid.c b/src/battle_pyramid.c index 211488ee560f..31f8fa6b81bb 100644 --- a/src/battle_pyramid.c +++ b/src/battle_pyramid.c @@ -38,6 +38,8 @@ #include "constants/moves.h" #include "constants/trainers.h" +#define NUM_LAYOUT_OFFSETS 8 + extern const struct MapLayout *const gMapLayouts[]; struct PyramidWildMon @@ -55,7 +57,7 @@ struct PyramidFloorTemplate u8 itemPositions; u8 trainerPositions; u8 runMultiplier; - u8 layoutOffsets[8]; + u8 layoutOffsets[NUM_LAYOUT_OFFSETS]; }; struct PyramidTrainerEncounterMusic @@ -929,7 +931,7 @@ static void SetBattlePyramidData(void) static void SavePyramidChallenge(void) { gSaveBlock2Ptr->frontier.challengeStatus = gSpecialVar_0x8005; - VarSet(VAR_TEMP_0, 0); + VarSet(VAR_TEMP_CHALLENGE_STATUS, 0); gSaveBlock2Ptr->frontier.challengePaused = TRUE; SaveMapView(); TrySavingData(SAVE_LINK); @@ -1357,7 +1359,7 @@ void GenerateBattlePyramidWildMon(void) id = GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, NULL) - 1; SetMonData(&gEnemyParty[0], MON_DATA_SPECIES, &wildMons[id].species); - GetSpeciesName(name, wildMons[id].species); + StringCopy(name, GetSpeciesName(wildMons[id].species)); SetMonData(&gEnemyParty[0], MON_DATA_NICKNAME, &name); if (lvl != FRONTIER_LVL_50) { @@ -1439,7 +1441,7 @@ void PausePyramidChallenge(void) { RestorePyramidPlayerParty(); gSaveBlock2Ptr->frontier.challengeStatus = CHALLENGE_STATUS_PAUSED; - VarSet(VAR_TEMP_E, 0); + VarSet(VAR_TEMP_PLAYING_PYRAMID_MUSIC, 0); LoadPlayerParty(); } } @@ -1902,7 +1904,7 @@ static void GetPyramidFloorLayoutOffsets(u8 *layoutOffsets) for (i = 0; i < NUM_PYRAMID_FLOOR_SQUARES; i++) { - layoutOffsets[i] = sPyramidFloorTemplates[id].layoutOffsets[rand & 0x7]; + layoutOffsets[i] = sPyramidFloorTemplates[id].layoutOffsets[MOD(rand, NUM_LAYOUT_OFFSETS)]; rand >>= 3; if (i == 7) { diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 164021555f72..588150e5e255 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -338,7 +338,7 @@ static const u16 sWhiteOutBadgeMoney[9] = { 8, 16, 24, 36, 48, 64, 80, 100, 120 static bool8 IsTwoTurnsMove(u16 move); static void TrySetDestinyBondToHappen(void); -static u8 AttacksThisTurn(u8 battlerId, u16 move); // Note: returns 1 if it's a charging turn, otherwise 2. +static u8 AttacksThisTurn(u8 battler, u16 move); // Note: returns 1 if it's a charging turn, otherwise 2. static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr); static bool32 IsMonGettingExpSentOut(void); static void InitLevelUpBanner(void); @@ -354,6 +354,7 @@ static void BestowItem(u32 battlerAtk, u32 battlerDef); static bool8 IsFinalStrikeEffect(u16 move); static void TryUpdateRoundTurnOrder(void); static bool32 ChangeOrderTargetAfterAttacker(void); +void ApplyExperienceMultipliers(s32 *expAmount, u8 expGetterMonId, u8 faintedBattler); static void RemoveAllTerrains(void); static void Cmd_attackcanceler(void); @@ -586,8 +587,8 @@ static void Cmd_switchoutabilities(void); static void Cmd_jumpifhasnohp(void); static void Cmd_getsecretpowereffect(void); static void Cmd_pickup(void); -static void Cmd_doweatherformchangeanimation(void); -static void Cmd_tryweatherformdatachange(void); +static void Cmd_unused3(void); +static void Cmd_unused4(void); static void Cmd_settypebasedhalvers(void); static void Cmd_jumpifsubstituteblocks(void); static void Cmd_tryrecycleitem(void); @@ -845,8 +846,8 @@ void (* const gBattleScriptingCommandsTable[])(void) = Cmd_jumpifhasnohp, //0xE3 Cmd_getsecretpowereffect, //0xE4 Cmd_pickup, //0xE5 - Cmd_doweatherformchangeanimation, //0xE6 - Cmd_tryweatherformdatachange, //0xE7 + Cmd_unused3, //0xE6 + Cmd_unused4, //0xE7 Cmd_settypebasedhalvers, //0xE8 Cmd_jumpifsubstituteblocks, //0xE9 Cmd_tryrecycleitem, //0xEA @@ -969,236 +970,6 @@ static const struct SpriteTemplate sSpriteTemplate_MonIconOnLvlUpBanner = static const u16 sProtectSuccessRates[] = {USHRT_MAX, USHRT_MAX / 2, USHRT_MAX / 4, USHRT_MAX / 8}; -#define FORBIDDEN_MIMIC (1 << 0) -#define FORBIDDEN_METRONOME (1 << 1) -#define FORBIDDEN_ASSIST (1 << 2) -#define FORBIDDEN_COPYCAT (1 << 3) -#define FORBIDDEN_SLEEP_TALK (1 << 4) -#define FORBIDDEN_INSTRUCT (1 << 5) -#define FORBIDDEN_PARENTAL_BOND (1 << 6) - -static const u8 sForbiddenMoves[MOVES_COUNT] = -{ - [MOVE_NONE] = 0xFF, // Can't use a non-move lol - [MOVE_STRUGGLE] = 0xFF, // Neither Struggle - [MOVE_AFTER_YOU] = FORBIDDEN_METRONOME, - [MOVE_APPLE_ACID] = FORBIDDEN_METRONOME, - [MOVE_ARMOR_CANNON] = FORBIDDEN_METRONOME, - [MOVE_ARM_THRUST] = FORBIDDEN_PARENTAL_BOND, - [MOVE_ASSIST] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT, - [MOVE_ASTRAL_BARRAGE] = FORBIDDEN_METRONOME, - [MOVE_AURA_WHEEL] = FORBIDDEN_METRONOME, - [MOVE_BADDY_BAD] = FORBIDDEN_METRONOME, - [MOVE_BANEFUL_BUNKER] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_BARRAGE] = FORBIDDEN_PARENTAL_BOND, - [MOVE_BEAK_BLAST] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT, - [MOVE_BEAT_UP] = FORBIDDEN_PARENTAL_BOND, - [MOVE_BEHEMOTH_BASH] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_BEHEMOTH_BLADE] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_BELCH] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT, - [MOVE_BESTOW] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_BIDE] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND, // Note: Bide should work with Parental Bond. This will be addressed in future. - [MOVE_BLAST_BURN] = FORBIDDEN_INSTRUCT, - [MOVE_BLAZING_TORQUE] = FORBIDDEN_MIMIC | FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT, - [MOVE_BODY_PRESS] = FORBIDDEN_METRONOME, - [MOVE_BONE_RUSH] = FORBIDDEN_PARENTAL_BOND, - [MOVE_BONEMERANG] = FORBIDDEN_PARENTAL_BOND, - [MOVE_BOUNCE] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND, - [MOVE_BOUNCY_BUBBLE] = FORBIDDEN_METRONOME, - [MOVE_BRANCH_POKE] = FORBIDDEN_METRONOME, - [MOVE_BREAKING_SWIPE] = FORBIDDEN_METRONOME, - [MOVE_BULLET_SEED] = FORBIDDEN_PARENTAL_BOND, - [MOVE_BUZZY_BUZZ] = FORBIDDEN_METRONOME, - [MOVE_CELEBRATE] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT, - [MOVE_CHATTER] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_MIMIC | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT, - [MOVE_CHILLING_WATER] = FORBIDDEN_METRONOME, - [MOVE_CHILLY_RECEPTION] = FORBIDDEN_METRONOME, - [MOVE_CIRCLE_THROW] = FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_CLANGOROUS_SOUL] = FORBIDDEN_METRONOME, - [MOVE_COLLISION_COURSE] = FORBIDDEN_METRONOME, - [MOVE_COMBAT_TORQUE] = FORBIDDEN_MIMIC | FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT, - [MOVE_COMET_PUNCH] = FORBIDDEN_PARENTAL_BOND, - [MOVE_COMEUPPANCE] = FORBIDDEN_METRONOME, - [MOVE_COPYCAT] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT, - [MOVE_COUNTER] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_COVET] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_CRAFTY_SHIELD] = FORBIDDEN_METRONOME, - [MOVE_DECORATE] = FORBIDDEN_METRONOME, - [MOVE_DESTINY_BOND] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_DETECT] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_DIAMOND_STORM] = FORBIDDEN_METRONOME, - [MOVE_DIG] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND, - [MOVE_DIVE] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND, - [MOVE_DOODLE] = FORBIDDEN_METRONOME, - [MOVE_DOUBLE_IRON_BASH] = FORBIDDEN_METRONOME | FORBIDDEN_PARENTAL_BOND, - [MOVE_DOUBLE_HIT] = FORBIDDEN_PARENTAL_BOND, - [MOVE_DOUBLE_KICK] = FORBIDDEN_PARENTAL_BOND, - [MOVE_DOUBLE_SHOCK] = FORBIDDEN_METRONOME, - [MOVE_DOUBLE_SLAP] = FORBIDDEN_PARENTAL_BOND, - [MOVE_DRAGON_ASCENT] = FORBIDDEN_METRONOME, - [MOVE_DRAGON_ENERGY] = FORBIDDEN_METRONOME, - [MOVE_DRAGON_DARTS] = FORBIDDEN_PARENTAL_BOND, - [MOVE_DRAGON_TAIL] = FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_DRUM_BEATING] = FORBIDDEN_METRONOME, - [MOVE_DUAL_CHOP] = FORBIDDEN_PARENTAL_BOND, - [MOVE_DUAL_WINGBEAT] = FORBIDDEN_PARENTAL_BOND, - [MOVE_DYNAMAX_CANNON] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT, - [MOVE_ELECTRO_DRIFT] = FORBIDDEN_METRONOME, - [MOVE_ENDEAVOR] = FORBIDDEN_PARENTAL_BOND, - [MOVE_ENDURE] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_ETERNABEAM] = FORBIDDEN_METRONOME | FORBIDDEN_INSTRUCT, - [MOVE_EXPLOSION] = FORBIDDEN_PARENTAL_BOND, - [MOVE_FALSE_SURRENDER] = FORBIDDEN_METRONOME, - [MOVE_FEINT] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_FIERY_WRATH] = FORBIDDEN_METRONOME, - [MOVE_FILLET_AWAY] = FORBIDDEN_METRONOME, - [MOVE_FINAL_GAMBIT] = FORBIDDEN_PARENTAL_BOND, - [MOVE_FISSURE] = FORBIDDEN_PARENTAL_BOND, - [MOVE_FLEUR_CANNON] = FORBIDDEN_METRONOME, - [MOVE_FLING] = FORBIDDEN_PARENTAL_BOND, - [MOVE_FLOATY_FALL] = FORBIDDEN_METRONOME, - [MOVE_FLY] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND, - [MOVE_FOCUS_PUNCH] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT, - [MOVE_FOLLOW_ME] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_FREEZE_SHOCK] = FORBIDDEN_METRONOME | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT| FORBIDDEN_PARENTAL_BOND, - [MOVE_FREEZING_GLARE] = FORBIDDEN_METRONOME, - [MOVE_FREEZY_FROST] = FORBIDDEN_METRONOME, - [MOVE_FURY_ATTACK] = FORBIDDEN_PARENTAL_BOND, - [MOVE_FURY_SWIPES] = FORBIDDEN_PARENTAL_BOND, - [MOVE_GEAR_GRIND] = FORBIDDEN_PARENTAL_BOND, - [MOVE_GEOMANCY] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND, - [MOVE_GIGA_IMPACT] = FORBIDDEN_INSTRUCT, - [MOVE_GLACIAL_LANCE] = FORBIDDEN_METRONOME, - [MOVE_GLITZY_GLOW] = FORBIDDEN_METRONOME, - [MOVE_GRAV_APPLE] = FORBIDDEN_METRONOME, - [MOVE_GUILLOTINE] = FORBIDDEN_PARENTAL_BOND, - [MOVE_HELPING_HAND] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_HOLD_HANDS] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT, - [MOVE_HORN_DRILL] = FORBIDDEN_PARENTAL_BOND, - [MOVE_HYDRO_CANNON] = FORBIDDEN_INSTRUCT, - [MOVE_HYPER_BEAM] = FORBIDDEN_INSTRUCT, - [MOVE_HYPER_DRILL] = FORBIDDEN_METRONOME, - [MOVE_HYPERSPACE_FURY] = FORBIDDEN_METRONOME, - [MOVE_HYPERSPACE_HOLE] = FORBIDDEN_METRONOME, - [MOVE_ICE_BALL] = FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND, - [MOVE_ICE_BURN] = FORBIDDEN_METRONOME | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND, - [MOVE_ICICLE_SPEAR] = FORBIDDEN_PARENTAL_BOND, - [MOVE_INSTRUCT] = FORBIDDEN_METRONOME | FORBIDDEN_INSTRUCT, - [MOVE_JET_PUNCH] = FORBIDDEN_METRONOME, - [MOVE_JUNGLE_HEALING] = FORBIDDEN_METRONOME, - [MOVE_KINGS_SHIELD] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_INSTRUCT, - [MOVE_LIFE_DEW] = FORBIDDEN_METRONOME, - [MOVE_LIGHT_OF_RUIN] = FORBIDDEN_METRONOME, - [MOVE_MAKE_IT_RAIN] = FORBIDDEN_METRONOME, - [MOVE_MAGICAL_TORQUE] = FORBIDDEN_MIMIC | FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT, - [MOVE_MAT_BLOCK] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_ME_FIRST] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT, - [MOVE_METEOR_ASSAULT] = FORBIDDEN_METRONOME | FORBIDDEN_INSTRUCT, - [MOVE_METEOR_BEAM] = FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND, - [MOVE_METRONOME] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT, - [MOVE_MIMIC] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_MIMIC | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT, - [MOVE_MIND_BLOWN] = FORBIDDEN_METRONOME, - [MOVE_MIRROR_COAT] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_MIRROR_MOVE] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT, - [MOVE_MISTY_EXPLOSION] = FORBIDDEN_PARENTAL_BOND, - [MOVE_MOONGEIST_BEAM] = FORBIDDEN_METRONOME, - [MOVE_NATURE_POWER] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT, - [MOVE_NATURES_MADNESS] = FORBIDDEN_METRONOME, - [MOVE_NOXIOUS_TORQUE] = FORBIDDEN_MIMIC | FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT, - [MOVE_OBSTRUCT] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_INSTRUCT, - [MOVE_ORDER_UP] = FORBIDDEN_METRONOME, - [MOVE_ORIGIN_PULSE] = FORBIDDEN_METRONOME, - [MOVE_OUTRAGE] = FORBIDDEN_INSTRUCT, - [MOVE_OVERDRIVE] = FORBIDDEN_METRONOME, - [MOVE_PHANTOM_FORCE] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND, - [MOVE_PHOTON_GEYSER] = FORBIDDEN_METRONOME, - [MOVE_PLASMA_FISTS] = FORBIDDEN_METRONOME, - [MOVE_POPULATION_BOMB] = FORBIDDEN_METRONOME, - [MOVE_POUNCE] = FORBIDDEN_METRONOME, - [MOVE_POWER_SHIFT] = FORBIDDEN_METRONOME, - [MOVE_PRECIPICE_BLADES] = FORBIDDEN_METRONOME, - [MOVE_PRISMATIC_LASER] = FORBIDDEN_INSTRUCT, - [MOVE_PROTECT] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_PYRO_BALL] = FORBIDDEN_METRONOME, - [MOVE_QUASH] = FORBIDDEN_METRONOME, - [MOVE_QUICK_GUARD] = FORBIDDEN_METRONOME, - [MOVE_RAGE_FIST] = FORBIDDEN_METRONOME, - [MOVE_RAGE_POWDER] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_RAGING_BULL] = FORBIDDEN_METRONOME, - [MOVE_RAGING_FURY] = FORBIDDEN_METRONOME, - [MOVE_RAZOR_WIND] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND, - [MOVE_RELIC_SONG] = FORBIDDEN_METRONOME, - [MOVE_REVIVAL_BLESSING] = FORBIDDEN_METRONOME, - [MOVE_ROAR] = FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_ROAR_OF_TIME] = FORBIDDEN_INSTRUCT, - [MOVE_ROCK_BLAST] = FORBIDDEN_PARENTAL_BOND, - [MOVE_ROCK_WRECKER] = FORBIDDEN_INSTRUCT, - [MOVE_ROLLOUT] = FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND, - [MOVE_RUINATION] = FORBIDDEN_METRONOME, - [MOVE_SAPPY_SEED] = FORBIDDEN_METRONOME, - [MOVE_SALT_CURE] = FORBIDDEN_METRONOME, - [MOVE_SCALE_SHOT] = FORBIDDEN_PARENTAL_BOND, - [MOVE_SECRET_SWORD] = FORBIDDEN_METRONOME, - [MOVE_SELF_DESTRUCT] = FORBIDDEN_PARENTAL_BOND, - [MOVE_SHADOW_FORCE] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND, - [MOVE_SHED_TAIL] = FORBIDDEN_METRONOME, - [MOVE_SHEER_COLD] = FORBIDDEN_PARENTAL_BOND, - [MOVE_SHELL_TRAP] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT, - [MOVE_SILK_TRAP] = FORBIDDEN_METRONOME, - [MOVE_SIZZLY_SLIDE] = FORBIDDEN_METRONOME, - [MOVE_SKETCH] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_MIMIC | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT, - [MOVE_SKULL_BASH] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND, - [MOVE_SKY_ATTACK] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND, - [MOVE_SKY_DROP] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND, - [MOVE_SLEEP_TALK] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT, - [MOVE_SNAP_TRAP] = FORBIDDEN_METRONOME, - [MOVE_SNARL] = FORBIDDEN_METRONOME, - [MOVE_SNATCH] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_INSTRUCT, - [MOVE_SNORE] = FORBIDDEN_METRONOME, - [MOVE_SNOWSCAPE] = FORBIDDEN_METRONOME, - [MOVE_SOLAR_BEAM] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND, - [MOVE_SOLAR_BLADE] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND, - [MOVE_SPARKLY_SWIRL] = FORBIDDEN_METRONOME, - [MOVE_SPECTRAL_THIEF] = FORBIDDEN_METRONOME, - [MOVE_SPICY_EXTRACT] = FORBIDDEN_METRONOME, - [MOVE_SPIKE_CANNON] = FORBIDDEN_PARENTAL_BOND, - [MOVE_SPIKY_SHIELD] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_SPIRIT_BREAK] = FORBIDDEN_METRONOME, - [MOVE_SPLISHY_SPLASH] = FORBIDDEN_METRONOME, - [MOVE_SPOTLIGHT] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_STEAM_ERUPTION] = FORBIDDEN_METRONOME, - [MOVE_STEEL_BEAM] = FORBIDDEN_METRONOME, - [MOVE_STRANGE_STEAM] = FORBIDDEN_METRONOME, - [MOVE_SUNSTEEL_STRIKE] = FORBIDDEN_METRONOME, - [MOVE_SURGING_STRIKES] = FORBIDDEN_METRONOME | FORBIDDEN_PARENTAL_BOND, - [MOVE_SWITCHEROO] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_TAIL_SLAP] = FORBIDDEN_PARENTAL_BOND, - [MOVE_TECHNO_BLAST] = FORBIDDEN_METRONOME, - [MOVE_THIEF] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_THOUSAND_ARROWS] = FORBIDDEN_METRONOME, - [MOVE_THOUSAND_WAVES] = FORBIDDEN_METRONOME, - [MOVE_THRASH] = FORBIDDEN_INSTRUCT, - [MOVE_THUNDER_CAGE] = FORBIDDEN_METRONOME, - [MOVE_THUNDEROUS_KICK] = FORBIDDEN_METRONOME, - [MOVE_TIDY_UP] = FORBIDDEN_METRONOME, - [MOVE_TRAILBLAZE] = FORBIDDEN_METRONOME, - [MOVE_TRANSFORM] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_MIMIC | FORBIDDEN_INSTRUCT, - [MOVE_TRICK] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_TRIPLE_AXEL] = FORBIDDEN_PARENTAL_BOND, - [MOVE_TRIPLE_KICK] = FORBIDDEN_PARENTAL_BOND, - [MOVE_TWINEEDLE] = FORBIDDEN_PARENTAL_BOND, - [MOVE_TWIN_BEAM] = FORBIDDEN_METRONOME, - [MOVE_UPROAR] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND, - [MOVE_V_CREATE] = FORBIDDEN_METRONOME, - [MOVE_VEEVEE_VOLLEY] = FORBIDDEN_METRONOME, - [MOVE_WATER_SHURIKEN] = FORBIDDEN_PARENTAL_BOND, - [MOVE_WHIRLWIND] = FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT, - [MOVE_WICKED_BLOW] = FORBIDDEN_METRONOME, - [MOVE_WICKED_TORQUE] = FORBIDDEN_MIMIC | FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT, - [MOVE_WIDE_GUARD] = FORBIDDEN_METRONOME, - [MOVE_ZIPPY_ZAP] = FORBIDDEN_METRONOME, -}; - static const u16 sFinalStrikeOnlyEffects[] = { EFFECT_RELIC_SONG, @@ -1319,11 +1090,11 @@ static const u16 sRarePickupItems[] = ITEM_FULL_RESTORE, ITEM_ETHER, ITEM_WHITE_HERB, - ITEM_TM44_REST, + ITEM_TM_REST, ITEM_ELIXIR, - ITEM_TM01_FOCUS_PUNCH, + ITEM_TM_FOCUS_PUNCH, ITEM_LEFTOVERS, - ITEM_TM26_EARTHQUAKE, + ITEM_TM_EARTHQUAKE, }; static const u8 sPickupProbabilities[] = @@ -1368,7 +1139,7 @@ static const u8 sTerrainToType[BATTLE_TERRAIN_COUNT] = // In Battle Palace, moves are chosen based on the pokemons nature rather than by the player // Moves are grouped into "Attack", "Defense", or "Support" (see PALACE_MOVE_GROUP_*) // Each nature has a certain percent chance of selecting a move from a particular group -// and a separate percent chance for each group when below 50% HP +// and a separate percent chance for each group when at or below 50% HP // The table below doesn't list percentages for Support because you can subtract the other two // Support percentages are listed in comments off to the side instead #define PALACE_STYLE(atk, def, atkLow, defLow) {atk, atk + def, atkLow, atkLow + defLow} @@ -1431,12 +1202,12 @@ static const u8 sBattlePalaceNatureToFlavorTextId[NUM_NATURES] = [NATURE_QUIRKY] = B_MSG_EAGER_FOR_MORE, }; -static bool32 NoTargetPresent(u8 battlerId, u32 move) +static bool32 NoTargetPresent(u8 battler, u32 move) { if (!IsBattlerAlive(gBattlerTarget)) gBattlerTarget = GetMoveTarget(move, NO_TARGET_OVERRIDE); - switch (GetBattlerMoveTargetType(battlerId, move)) + switch (GetBattlerMoveTargetType(battler, move)) { case MOVE_TARGET_SELECTED: case MOVE_TARGET_DEPENDS: @@ -1616,7 +1387,7 @@ static void Cmd_attackcanceler(void) } if (gProtectStructs[gBattlerTarget].bounceMove - && gBattleMoves[gCurrentMove].flags & FLAG_MAGIC_COAT_AFFECTED + && gBattleMoves[gCurrentMove].magicCoatAffected && !gProtectStructs[gBattlerAttacker].usesBouncedMove) { PressurePPLose(gBattlerAttacker, gBattlerTarget, MOVE_MAGIC_COAT); @@ -1638,7 +1409,7 @@ static void Cmd_attackcanceler(void) return; } else if (GetBattlerAbility(gBattlerTarget) == ABILITY_MAGIC_BOUNCE - && gBattleMoves[gCurrentMove].flags & FLAG_MAGIC_COAT_AFFECTED + && gBattleMoves[gCurrentMove].magicCoatAffected && !gProtectStructs[gBattlerAttacker].usesBouncedMove) { gProtectStructs[gBattlerTarget].usesBouncedMove = TRUE; @@ -1651,7 +1422,7 @@ static void Cmd_attackcanceler(void) return; } - // Z-moves and Max Moves bypass protection, but deal reduced damage (factored in CalcFinalDmg) + // Z-moves and Max Moves bypass protection, but deal reduced damage (factored in AccumulateOtherModifiers) if (gBattleStruct->zmove.active && IS_BATTLER_PROTECTED(gBattlerTarget)) { BattleScriptPush(cmd->nextInstr); @@ -1661,7 +1432,7 @@ static void Cmd_attackcanceler(void) for (i = 0; i < gBattlersCount; i++) { - if ((gProtectStructs[gBattlerByTurnOrder[i]].stealMove) && gBattleMoves[gCurrentMove].flags & FLAG_SNATCH_AFFECTED) + if ((gProtectStructs[gBattlerByTurnOrder[i]].stealMove) && gBattleMoves[gCurrentMove].snatchAffected) { PressurePPLose(gBattlerAttacker, gBattlerByTurnOrder[i], MOVE_SNATCH); gProtectStructs[gBattlerByTurnOrder[i]].stealMove = FALSE; @@ -1804,9 +1575,9 @@ static bool32 AccuracyCalcHelper(u16 move) } if ((gStatuses3[gBattlerTarget] & STATUS3_PHANTOM_FORCE) - || (!(gBattleMoves[move].flags & (FLAG_DMG_IN_AIR | FLAG_DMG_2X_IN_AIR)) && gStatuses3[gBattlerTarget] & STATUS3_ON_AIR) - || (!(gBattleMoves[move].flags & FLAG_DMG_UNDERGROUND) && gStatuses3[gBattlerTarget] & STATUS3_UNDERGROUND) - || (!(gBattleMoves[move].flags & FLAG_DMG_UNDERWATER) && gStatuses3[gBattlerTarget] & STATUS3_UNDERWATER)) + || ((gStatuses3[gBattlerTarget] & STATUS3_ON_AIR) && !(gBattleMoves[move].damagesAirborne || gBattleMoves[move].damagesAirborneDoubleDamage)) + || ((gStatuses3[gBattlerTarget] & STATUS3_UNDERGROUND) && !gBattleMoves[move].damagesUnderground) + || ((gStatuses3[gBattlerTarget] & STATUS3_UNDERWATER) && !gBattleMoves[move].damagesUnderwater)) { gMoveResultFlags |= MOVE_RESULT_MISSED; JumpIfMoveFailed(7, move); @@ -1838,7 +1609,7 @@ static bool32 AccuracyCalcHelper(u16 move) } #if B_MINIMIZE_DMG_ACC >= GEN_6 - if ((gStatuses3[gBattlerTarget] & STATUS3_MINIMIZED) && (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE)) + if ((gStatuses3[gBattlerTarget] & STATUS3_MINIMIZED) && gBattleMoves[move].minimizeDoubleDamage) { JumpIfMoveFailed(7, move); return TRUE; @@ -1868,7 +1639,7 @@ u32 GetTotalAccuracy(u32 battlerAtk, u32 battlerDef, u32 move, u32 atkAbility, u evasionStage = gBattleMons[battlerDef].statStages[STAT_EVASION]; if (atkAbility == ABILITY_UNAWARE || atkAbility == ABILITY_KEEN_EYE) evasionStage = DEFAULT_STAT_STAGE; - if (gBattleMoves[move].flags & FLAG_STAT_STAGES_IGNORED) + if (gBattleMoves[move].ignoresTargetDefenseEvasionStages) evasionStage = DEFAULT_STAT_STAGE; if (defAbility == ABILITY_UNAWARE) accStage = DEFAULT_STAT_STAGE; @@ -1982,8 +1753,11 @@ static void Cmd_accuracycheck(void) { CMD_ARGS(const u8 *failInstr, u16 move); - u16 type, move = cmd->move; - u16 moveTarget = GetBattlerMoveTargetType(gBattlerAttacker, move); + u32 type, move = cmd->move; + u32 moveTarget = GetBattlerMoveTargetType(gBattlerAttacker, move); + u32 abilityAtk = GetBattlerAbility(gBattlerAttacker); + u32 abilityDef = GetBattlerAbility(gBattlerTarget); + u32 holdEffectAtk = GetBattlerHoldEffect(gBattlerAttacker, TRUE); if (move == ACC_CURR_MOVE) move = gCurrentMove; @@ -1998,10 +1772,11 @@ static void Cmd_accuracycheck(void) gBattlescriptCurrInstr = cmd->nextInstr; } else if (gSpecialStatuses[gBattlerAttacker].parentalBondState == PARENTAL_BOND_2ND_HIT - || (gSpecialStatuses[gBattlerAttacker].multiHitOn && (gBattleMoves[move].effect != EFFECT_TRIPLE_KICK - || GetBattlerAbility(gBattlerAttacker) == ABILITY_SKILL_LINK))) + || (gSpecialStatuses[gBattlerAttacker].multiHitOn + && (abilityAtk == ABILITY_SKILL_LINK || holdEffectAtk == HOLD_EFFECT_LOADED_DICE + || !(gBattleMoves[move].effect == EFFECT_TRIPLE_KICK || gBattleMoves[move].effect == EFFECT_POPULATION_BOMB)))) { - // No acc checks for second hit of Parental Bond or multi hit moves, except Triple Kick/Triple Axel + // No acc checks for second hit of Parental Bond or multi hit moves, except Triple Kick/Triple Axel/Population Bomb gBattlescriptCurrInstr = cmd->nextInstr; } else @@ -2018,16 +1793,16 @@ static void Cmd_accuracycheck(void) gBattlerAttacker, gBattlerTarget, move, - GetBattlerAbility(gBattlerAttacker), - GetBattlerAbility(gBattlerTarget), - GetBattlerHoldEffect(gBattlerAttacker, TRUE), + abilityAtk, + abilityDef, + holdEffectAtk, GetBattlerHoldEffect(gBattlerTarget, TRUE) ); if (!RandomPercentage(RNG_ACCURACY, accuracy)) { gMoveResultFlags |= MOVE_RESULT_MISSED; - if (GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_BLUNDER_POLICY) + if (holdEffectAtk == HOLD_EFFECT_BLUNDER_POLICY) gBattleStruct->blunderPolicy = TRUE; // Only activates from missing through acc/evasion checks if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && @@ -2037,7 +1812,7 @@ static void Cmd_accuracycheck(void) gBattleCommunication[MISS_TYPE] = B_MSG_MISSED; if (gBattleMoves[move].power) - CalcTypeEffectivenessMultiplier(move, type, gBattlerAttacker, gBattlerTarget, TRUE); + CalcTypeEffectivenessMultiplier(move, type, gBattlerAttacker, gBattlerTarget, abilityDef, TRUE); } JumpIfMoveFailed(7, move); } @@ -2113,8 +1888,7 @@ static void Cmd_ppreduce(void) if (MOVE_IS_PERMANENT(gBattlerAttacker, gCurrMovePos)) { - gActiveBattler = gBattlerAttacker; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_PPMOVE1_BATTLE + gCurrMovePos, 0, + BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_PPMOVE1_BATTLE + gCurrMovePos, 0, sizeof(gBattleMons[gBattlerAttacker].pp[gCurrMovePos]), &gBattleMons[gBattlerAttacker].pp[gCurrMovePos]); MarkBattlerForControllerExec(gBattlerAttacker); @@ -2135,22 +1909,13 @@ static void Cmd_ppreduce(void) #endif // B_CRIT_CHANCE #define BENEFITS_FROM_LEEK(battler, holdEffect)((holdEffect == HOLD_EFFECT_LEEK) && (GET_BASE_SPECIES_ID(gBattleMons[battler].species) == SPECIES_FARFETCHD || gBattleMons[battler].species == SPECIES_SIRFETCHD)) -s32 CalcCritChanceStage(u8 battlerAtk, u8 battlerDef, u32 move, bool32 recordAbility) +s32 CalcCritChanceStageArgs(u32 battlerAtk, u32 battlerDef, u32 move, bool32 recordAbility, u32 abilityAtk, u32 abilityDef, u32 holdEffectAtk) { s32 critChance = 0; - u32 abilityAtk = GetBattlerAbility(gBattlerAttacker); - u32 abilityDef = GetBattlerAbility(gBattlerTarget); - u32 holdEffectAtk = GetBattlerHoldEffect(battlerAtk, TRUE); if (gSideStatuses[battlerDef] & SIDE_STATUS_LUCKY_CHANT - || gStatuses3[gBattlerAttacker] & STATUS3_CANT_SCORE_A_CRIT) - { - critChance = -1; - } - else if (abilityDef == ABILITY_BATTLE_ARMOR || abilityDef == ABILITY_SHELL_ARMOR) + || gStatuses3[battlerAtk] & STATUS3_CANT_SCORE_A_CRIT) { - if (recordAbility) - RecordAbilityBattle(battlerDef, abilityDef); critChance = -1; } else if (gStatuses3[battlerAtk] & STATUS3_LASER_FOCUS @@ -2162,28 +1927,42 @@ s32 CalcCritChanceStage(u8 battlerAtk, u8 battlerDef, u32 move, bool32 recordAbi } else { - critChance = 2 * ((gBattleMons[gBattlerAttacker].status2 & STATUS2_FOCUS_ENERGY) != 0) - + ((gBattleMoves[gCurrentMove].flags & FLAG_HIGH_CRIT) != 0) + critChance = 2 * ((gBattleMons[battlerAtk].status2 & STATUS2_FOCUS_ENERGY) != 0) + + (gBattleMoves[gCurrentMove].highCritRatio) + (holdEffectAtk == HOLD_EFFECT_SCOPE_LENS) - + 2 * (holdEffectAtk == HOLD_EFFECT_LUCKY_PUNCH && gBattleMons[gBattlerAttacker].species == SPECIES_CHANSEY) + + 2 * (holdEffectAtk == HOLD_EFFECT_LUCKY_PUNCH && gBattleMons[battlerAtk].species == SPECIES_CHANSEY) + 2 * BENEFITS_FROM_LEEK(battlerAtk, holdEffectAtk) #if B_AFFECTION_MECHANICS == TRUE - + 2 * (GetBattlerFriendshipScore(gBattlerAttacker) >= FRIENDSHIP_200_TO_254) + + 2 * (GetBattlerFriendshipScore(battlerAtk) >= FRIENDSHIP_200_TO_254) #endif + (abilityAtk == ABILITY_SUPER_LUCK); + if (abilityDef == ABILITY_BATTLE_ARMOR || abilityDef == ABILITY_SHELL_ARMOR) + { + if (recordAbility && critChance >= 2) // Record ability only if move had at least +1 chance to get a crit. + RecordAbilityBattle(battlerDef, abilityDef); + critChance = -1; + } + if (critChance >= ARRAY_COUNT(sCriticalHitChance)) critChance = ARRAY_COUNT(sCriticalHitChance) - 1; } return critChance; } + +s32 CalcCritChanceStage(u32 battlerAtk, u32 battlerDef, u32 move, bool32 recordAbility) +{ + u32 abilityAtk = GetBattlerAbility(gBattlerAttacker); + u32 abilityDef = GetBattlerAbility(gBattlerTarget); + u32 holdEffectAtk = GetBattlerHoldEffect(battlerAtk, TRUE); + return CalcCritChanceStageArgs(battlerAtk, battlerDef, move, recordAbility, abilityAtk, abilityDef, holdEffectAtk); +} #undef BENEFITS_FROM_LEEK -s8 GetInverseCritChance(u8 battlerAtk, u8 battlerDef, u32 move) +s32 GetCritHitChance(s32 critChanceIndex) { - s32 critChanceIndex = CalcCritChanceStage(battlerAtk, battlerDef, move, FALSE); - if(critChanceIndex < 0) + if (critChanceIndex < 0) return -1; else return sCriticalHitChance[critChanceIndex]; @@ -2233,7 +2012,7 @@ static void Cmd_typecalc(void) u8 moveType; GET_MOVE_TYPE(gCurrentMove, moveType); - CalcTypeEffectivenessMultiplier(gCurrentMove, moveType, gBattlerAttacker, gBattlerTarget, TRUE); + CalcTypeEffectivenessMultiplier(gCurrentMove, moveType, gBattlerAttacker, gBattlerTarget, GetBattlerAbility(gBattlerTarget), TRUE); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -2446,8 +2225,6 @@ static void Cmd_attackanimation(void) { u8 multihit; - gActiveBattler = gBattlerAttacker; - if (gBattleMons[gBattlerTarget].status2 & STATUS2_SUBSTITUTE) multihit = gMultiHitCounter; else if (gMultiHitCounter != 0 && gMultiHitCounter != 1) @@ -2460,7 +2237,7 @@ static void Cmd_attackanimation(void) else multihit = gMultiHitCounter; - BtlController_EmitMoveAnimation(BUFFER_A, gCurrentMove, gBattleScripting.animTurn, gBattleMovePower, gBattleMoveDamage, gBattleMons[gBattlerAttacker].friendship, &gDisableStructs[gBattlerAttacker], multihit); + BtlController_EmitMoveAnimation(gBattlerAttacker, BUFFER_A, gCurrentMove, gBattleScripting.animTurn, gBattleMovePower, gBattleMoveDamage, gBattleMons[gBattlerAttacker].friendship, &gDisableStructs[gBattlerAttacker], multihit); gBattleScripting.animTurn++; gBattleScripting.animTargetsHit++; MarkBattlerForControllerExec(gBattlerAttacker); @@ -2491,20 +2268,20 @@ static void Cmd_healthbarupdate(void) if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) || (gHitMarker & HITMARKER_PASSIVE_DAMAGE)) { - gActiveBattler = GetBattlerForBattleScript(cmd->battler); + u32 battler = GetBattlerForBattleScript(cmd->battler); - if (DoesSubstituteBlockMove(gBattlerAttacker, gActiveBattler, gCurrentMove) && gDisableStructs[gActiveBattler].substituteHP && !(gHitMarker & HITMARKER_IGNORE_SUBSTITUTE)) + if (DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove) && gDisableStructs[battler].substituteHP && !(gHitMarker & HITMARKER_IGNORE_SUBSTITUTE)) { - PrepareStringBattle(STRINGID_SUBSTITUTEDAMAGED, gActiveBattler); + PrepareStringBattle(STRINGID_SUBSTITUTEDAMAGED, battler); } - else if (!DoesDisguiseBlockMove(gBattlerAttacker, gActiveBattler, gCurrentMove)) + else if (!DoesDisguiseBlockMove(gBattlerAttacker, battler, gCurrentMove)) { s16 healthValue = min(gBattleMoveDamage, 10000); // Max damage (10000) not present in R/S, ensures that huge damage values don't change sign - BtlController_EmitHealthBarUpdate(BUFFER_A, healthValue); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitHealthBarUpdate(battler, BUFFER_A, healthValue); + MarkBattlerForControllerExec(battler); - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER && gBattleMoveDamage > 0) + if (GetBattlerSide(battler) == B_SIDE_PLAYER && gBattleMoveDamage > 0) gBattleResults.playerMonWasDamaged = TRUE; } } @@ -2516,7 +2293,7 @@ static void Cmd_datahpupdate(void) { CMD_ARGS(u8 battler); - u32 moveType; + u32 battler, moveType; if (gBattleControllerExecFlags) return; @@ -2530,25 +2307,25 @@ static void Cmd_datahpupdate(void) if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) || (gHitMarker & HITMARKER_PASSIVE_DAMAGE)) { - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - if (DoesSubstituteBlockMove(gBattlerAttacker, gActiveBattler, gCurrentMove) && gDisableStructs[gActiveBattler].substituteHP && !(gHitMarker & HITMARKER_IGNORE_SUBSTITUTE)) + battler = GetBattlerForBattleScript(cmd->battler); + if (DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove) && gDisableStructs[battler].substituteHP && !(gHitMarker & HITMARKER_IGNORE_SUBSTITUTE)) { - if (gDisableStructs[gActiveBattler].substituteHP >= gBattleMoveDamage) + if (gDisableStructs[battler].substituteHP >= gBattleMoveDamage) { - if (gSpecialStatuses[gActiveBattler].dmg == 0) - gSpecialStatuses[gActiveBattler].dmg = gBattleMoveDamage; - gDisableStructs[gActiveBattler].substituteHP -= gBattleMoveDamage; + if (gSpecialStatuses[battler].dmg == 0) + gSpecialStatuses[battler].dmg = gBattleMoveDamage; + gDisableStructs[battler].substituteHP -= gBattleMoveDamage; gHpDealt = gBattleMoveDamage; } else { - if (gSpecialStatuses[gActiveBattler].dmg == 0) - gSpecialStatuses[gActiveBattler].dmg = gDisableStructs[gActiveBattler].substituteHP; - gHpDealt = gDisableStructs[gActiveBattler].substituteHP; - gDisableStructs[gActiveBattler].substituteHP = 0; + if (gSpecialStatuses[battler].dmg == 0) + gSpecialStatuses[battler].dmg = gDisableStructs[battler].substituteHP; + gHpDealt = gDisableStructs[battler].substituteHP; + gDisableStructs[battler].substituteHP = 0; } // check substitute fading - if (gDisableStructs[gActiveBattler].substituteHP == 0) + if (gDisableStructs[battler].substituteHP == 0) { gBattlescriptCurrInstr = cmd->nextInstr; BattleScriptPushCursor(); @@ -2556,9 +2333,9 @@ static void Cmd_datahpupdate(void) return; } } - else if (DoesDisguiseBlockMove(gBattlerAttacker, gActiveBattler, gCurrentMove)) + else if (DoesDisguiseBlockMove(gBattlerAttacker, battler, gCurrentMove)) { - gBattleMons[gActiveBattler].species = SPECIES_MIMIKYU_BUSTED; + gBattleMons[battler].species = SPECIES_MIMIKYU_BUSTED; BattleScriptPush(cmd->nextInstr); gBattlescriptCurrInstr = BattleScript_TargetFormChange; return; @@ -2568,9 +2345,9 @@ static void Cmd_datahpupdate(void) gHitMarker &= ~HITMARKER_IGNORE_SUBSTITUTE; if (gBattleMoveDamage < 0) // hp goes up { - gBattleMons[gActiveBattler].hp -= gBattleMoveDamage; - if (gBattleMons[gActiveBattler].hp > gBattleMons[gActiveBattler].maxHP) - gBattleMons[gActiveBattler].hp = gBattleMons[gActiveBattler].maxHP; + gBattleMons[battler].hp -= gBattleMoveDamage; + if (gBattleMons[battler].hp > gBattleMons[battler].maxHP) + gBattleMons[battler].hp = gBattleMons[battler].maxHP; } else // hp goes down @@ -2581,68 +2358,68 @@ static void Cmd_datahpupdate(void) } else { - gTakenDmg[gActiveBattler] += gBattleMoveDamage; + gTakenDmg[battler] += gBattleMoveDamage; if (cmd->battler == BS_TARGET) - gTakenDmgByBattler[gActiveBattler] = gBattlerAttacker; + gTakenDmgByBattler[battler] = gBattlerAttacker; else - gTakenDmgByBattler[gActiveBattler] = gBattlerTarget; + gTakenDmgByBattler[battler] = gBattlerTarget; } - if (gBattleMons[gActiveBattler].hp > gBattleMoveDamage) + if (gBattleMons[battler].hp > gBattleMoveDamage) { - gBattleMons[gActiveBattler].hp -= gBattleMoveDamage; + gBattleMons[battler].hp -= gBattleMoveDamage; gHpDealt = gBattleMoveDamage; } else { - gHpDealt = gBattleMons[gActiveBattler].hp; - gBattleMons[gActiveBattler].hp = 0; + gHpDealt = gBattleMons[battler].hp; + gBattleMons[battler].hp = 0; } - if (!gSpecialStatuses[gActiveBattler].dmg && !(gHitMarker & HITMARKER_PASSIVE_DAMAGE)) - gSpecialStatuses[gActiveBattler].dmg = gHpDealt; + if (!gSpecialStatuses[battler].dmg && !(gHitMarker & HITMARKER_PASSIVE_DAMAGE)) + gSpecialStatuses[battler].dmg = gHpDealt; if (IS_MOVE_PHYSICAL(gCurrentMove) && !(gHitMarker & HITMARKER_PASSIVE_DAMAGE) && gCurrentMove != MOVE_PAIN_SPLIT) { - gProtectStructs[gActiveBattler].physicalDmg = gHpDealt; - gSpecialStatuses[gActiveBattler].physicalDmg = gHpDealt; + gProtectStructs[battler].physicalDmg = gHpDealt; + gSpecialStatuses[battler].physicalDmg = gHpDealt; if (cmd->battler == BS_TARGET) { - gProtectStructs[gActiveBattler].physicalBattlerId = gBattlerAttacker; - gSpecialStatuses[gActiveBattler].physicalBattlerId = gBattlerAttacker; + gProtectStructs[battler].physicalBattlerId = gBattlerAttacker; + gSpecialStatuses[battler].physicalBattlerId = gBattlerAttacker; } else { - gProtectStructs[gActiveBattler].physicalBattlerId = gBattlerTarget; - gSpecialStatuses[gActiveBattler].physicalBattlerId = gBattlerTarget; + gProtectStructs[battler].physicalBattlerId = gBattlerTarget; + gSpecialStatuses[battler].physicalBattlerId = gBattlerTarget; } } else if (!IS_MOVE_PHYSICAL(gCurrentMove) && !(gHitMarker & HITMARKER_PASSIVE_DAMAGE)) { - gProtectStructs[gActiveBattler].specialDmg = gHpDealt; - gSpecialStatuses[gActiveBattler].specialDmg = gHpDealt; + gProtectStructs[battler].specialDmg = gHpDealt; + gSpecialStatuses[battler].specialDmg = gHpDealt; if (cmd->battler == BS_TARGET) { - gProtectStructs[gActiveBattler].specialBattlerId = gBattlerAttacker; - gSpecialStatuses[gActiveBattler].specialBattlerId = gBattlerAttacker; + gProtectStructs[battler].specialBattlerId = gBattlerAttacker; + gSpecialStatuses[battler].specialBattlerId = gBattlerAttacker; } else { - gProtectStructs[gActiveBattler].specialBattlerId = gBattlerTarget; - gSpecialStatuses[gActiveBattler].specialBattlerId = gBattlerTarget; + gProtectStructs[battler].specialBattlerId = gBattlerTarget; + gSpecialStatuses[battler].specialBattlerId = gBattlerTarget; } } } gHitMarker &= ~HITMARKER_PASSIVE_DAMAGE; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_HP_BATTLE, 0, sizeof(gBattleMons[gActiveBattler].hp), &gBattleMons[gActiveBattler].hp); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_HP_BATTLE, 0, sizeof(gBattleMons[battler].hp), &gBattleMons[battler].hp); + MarkBattlerForControllerExec(battler); } } else { - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - if (gSpecialStatuses[gActiveBattler].dmg == 0) - gSpecialStatuses[gActiveBattler].dmg = 0xFFFF; + battler = GetBattlerForBattleScript(cmd->battler); + if (gSpecialStatuses[battler].dmg == 0) + gSpecialStatuses[battler].dmg = 0xFFFF; } gBattlescriptCurrInstr = cmd->nextInstr; } @@ -2674,18 +2451,17 @@ static void Cmd_effectivenesssound(void) if (gBattleControllerExecFlags) return; - gActiveBattler = gBattlerTarget; if (!(gMoveResultFlags & MOVE_RESULT_MISSED)) { switch (gMoveResultFlags & ~MOVE_RESULT_MISSED) { case MOVE_RESULT_SUPER_EFFECTIVE: - BtlController_EmitPlaySE(BUFFER_A, SE_SUPER_EFFECTIVE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitPlaySE(gBattlerTarget, BUFFER_A, SE_SUPER_EFFECTIVE); + MarkBattlerForControllerExec(gBattlerTarget); break; case MOVE_RESULT_NOT_VERY_EFFECTIVE: - BtlController_EmitPlaySE(BUFFER_A, SE_NOT_EFFECTIVE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitPlaySE(gBattlerTarget, BUFFER_A, SE_NOT_EFFECTIVE); + MarkBattlerForControllerExec(gBattlerTarget); break; case MOVE_RESULT_DOESNT_AFFECT_FOE: case MOVE_RESULT_FAILED: @@ -2698,18 +2474,18 @@ static void Cmd_effectivenesssound(void) default: if (gMoveResultFlags & MOVE_RESULT_SUPER_EFFECTIVE) { - BtlController_EmitPlaySE(BUFFER_A, SE_SUPER_EFFECTIVE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitPlaySE(gBattlerTarget, BUFFER_A, SE_SUPER_EFFECTIVE); + MarkBattlerForControllerExec(gBattlerTarget); } else if (gMoveResultFlags & MOVE_RESULT_NOT_VERY_EFFECTIVE) { - BtlController_EmitPlaySE(BUFFER_A, SE_NOT_EFFECTIVE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitPlaySE(gBattlerTarget, BUFFER_A, SE_NOT_EFFECTIVE); + MarkBattlerForControllerExec(gBattlerTarget); } else if (!(gMoveResultFlags & (MOVE_RESULT_DOESNT_AFFECT_FOE | MOVE_RESULT_FAILED))) { - BtlController_EmitPlaySE(BUFFER_A, SE_EFFECTIVE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitPlaySE(gBattlerTarget, BUFFER_A, SE_EFFECTIVE); + MarkBattlerForControllerExec(gBattlerTarget); } break; } @@ -2863,10 +2639,8 @@ static void Cmd_printselectionstring(void) { CMD_ARGS(u16 id); - gActiveBattler = gBattlerAttacker; - - BtlController_EmitPrintSelectionString(BUFFER_A, cmd->id); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitPrintSelectionString(gBattlerAttacker, BUFFER_A, cmd->id); + MarkBattlerForControllerExec(gBattlerAttacker); gBattlescriptCurrInstr = cmd->nextInstr; gBattleCommunication[MSG_DISPLAY] = 1; @@ -2919,32 +2693,31 @@ static void Cmd_printselectionstringfromtable(void) const u16 *ptr = cmd->ptr; ptr += gBattleCommunication[MULTISTRING_CHOOSER]; - gActiveBattler = gBattlerAttacker; - BtlController_EmitPrintSelectionString(BUFFER_A, *ptr); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitPrintSelectionString(gBattlerAttacker, BUFFER_A, *ptr); + MarkBattlerForControllerExec(gBattlerAttacker); gBattlescriptCurrInstr = cmd->nextInstr; gBattleCommunication[MSG_DISPLAY] = 1; } } -u8 GetBattlerTurnOrderNum(u8 battlerId) +u8 GetBattlerTurnOrderNum(u8 battler) { s32 i; for (i = 0; i < gBattlersCount; i++) { - if (gBattlerByTurnOrder[i] == battlerId) + if (gBattlerByTurnOrder[i] == battler) break; } return i; } -static void CheckSetUnburden(u8 battlerId) +static void CheckSetUnburden(u8 battler) { - if (GetBattlerAbility(battlerId) == ABILITY_UNBURDEN) + if (GetBattlerAbility(battler) == ABILITY_UNBURDEN) { - gBattleResources->flags->flags[battlerId] |= RESOURCE_FLAG_UNBURDEN; - RecordAbilityBattle(battlerId, ABILITY_UNBURDEN); + gBattleResources->flags->flags[battler] |= RESOURCE_FLAG_UNBURDEN; + RecordAbilityBattle(battler, ABILITY_UNBURDEN); } } @@ -2961,12 +2734,10 @@ void StealTargetItem(u8 battlerStealer, u8 battlerItem) CheckSetUnburden(battlerItem); gBattleResources->flags->flags[battlerStealer] &= ~RESOURCE_FLAG_UNBURDEN; - gActiveBattler = battlerStealer; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gLastUsedItem), &gLastUsedItem); // set attacker item + BtlController_EmitSetMonData(battlerStealer, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gLastUsedItem), &gLastUsedItem); // set attacker item MarkBattlerForControllerExec(battlerStealer); - gActiveBattler = battlerItem; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].item), &gBattleMons[battlerItem].item); // remove target item + BtlController_EmitSetMonData(battlerItem, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].item), &gBattleMons[battlerItem].item); // remove target item MarkBattlerForControllerExec(battlerItem); gBattleStruct->choicedMove[battlerItem] = 0; @@ -3024,7 +2795,7 @@ void SetMoveEffect(bool32 primary, u32 certain) if (gBattleScripting.moveEffect & MOVE_EFFECT_AFFECTS_USER) { - gEffectBattler = gBattlerAttacker; // battlerId that effects get applied on + gEffectBattler = gBattlerAttacker; // battler that effects get applied on gBattleScripting.moveEffect &= ~MOVE_EFFECT_AFFECTS_USER; affectsUser = MOVE_EFFECT_AFFECTS_USER; gBattleScripting.battler = gBattlerTarget; // theoretically the attacker @@ -3053,7 +2824,7 @@ void SetMoveEffect(bool32 primary, u32 certain) INCREMENT_RESET_RETURN } - if (gSideStatuses[GET_BATTLER_SIDE(gEffectBattler)] & SIDE_STATUS_SAFEGUARD && !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + if (gSideStatuses[GetBattlerSide(gEffectBattler)] & SIDE_STATUS_SAFEGUARD && !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD) && !primary && gBattleScripting.moveEffect <= MOVE_EFFECT_CONFUSION) INCREMENT_RESET_RETURN @@ -3074,15 +2845,15 @@ void SetMoveEffect(bool32 primary, u32 certain) // check active uproar if (battlerAbility != ABILITY_SOUNDPROOF) { - for (gActiveBattler = 0; - gActiveBattler < gBattlersCount && !(gBattleMons[gActiveBattler].status2 & STATUS2_UPROAR); - gActiveBattler++) + for (i = 0; i < gBattlersCount && !(gBattleMons[i].status2 & STATUS2_UPROAR); i++) ; } else - gActiveBattler = gBattlersCount; + { + i = gBattlersCount; + } - if (gActiveBattler != gBattlersCount) + if (i != gBattlersCount) break; if (!CanSleep(gEffectBattler)) break; @@ -3282,9 +3053,8 @@ void SetMoveEffect(bool32 primary, u32 certain) gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect]; - gActiveBattler = gEffectBattler; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gEffectBattler].status1), &gBattleMons[gEffectBattler].status1); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(gEffectBattler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gEffectBattler].status1), &gBattleMons[gEffectBattler].status1); + MarkBattlerForControllerExec(gEffectBattler); if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) { @@ -3394,7 +3164,7 @@ void SetMoveEffect(bool32 primary, u32 certain) break; case MOVE_EFFECT_PAYDAY: // Don't scatter coins on the second hit of Parental Bond - if (GET_BATTLER_SIDE(gBattlerAttacker) == B_SIDE_PLAYER && gSpecialStatuses[gBattlerAttacker].parentalBondState!= PARENTAL_BOND_2ND_HIT) + if (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER && gSpecialStatuses[gBattlerAttacker].parentalBondState!= PARENTAL_BOND_2ND_HIT) { u16 payday = gPaydayMoney; gPaydayMoney += (gBattleMons[gBattlerAttacker].level * 5); @@ -3410,7 +3180,7 @@ void SetMoveEffect(bool32 primary, u32 certain) } break; case MOVE_EFFECT_HAPPY_HOUR: - if (GET_BATTLER_SIDE(gBattlerAttacker) == B_SIDE_PLAYER && !gBattleStruct->moneyMultiplierMove) + if (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER && !gBattleStruct->moneyMultiplierMove) { gBattleStruct->moneyMultiplier *= 2; gBattleStruct->moneyMultiplierMove = 1; @@ -3761,9 +3531,9 @@ void SetMoveEffect(bool32 primary, u32 certain) if (gBattleScripting.animArg1 == 0) { if (byTwo) - gBattleScripting.animArg1 = STAT_ANIM_PLUS2 - 1 + i; + gBattleScripting.animArg1 = STAT_ANIM_PLUS2 + i; else - gBattleScripting.animArg1 = STAT_ANIM_PLUS1 - 1 + i; + gBattleScripting.animArg1 = STAT_ANIM_PLUS1 + i; } else { @@ -3812,9 +3582,8 @@ void SetMoveEffect(bool32 primary, u32 certain) gBattleMons[gEffectBattler].item = 0; CheckSetUnburden(gEffectBattler); - gActiveBattler = gEffectBattler; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gEffectBattler].item), &gBattleMons[gEffectBattler].item); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(gEffectBattler, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gEffectBattler].item), &gBattleMons[gEffectBattler].item); + MarkBattlerForControllerExec(gEffectBattler); BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_MoveEffectIncinerate; } @@ -3827,10 +3596,9 @@ void SetMoveEffect(bool32 primary, u32 certain) gLastUsedItem = gBattleMons[gEffectBattler].item; gBattleMons[gEffectBattler].item = 0; CheckSetUnburden(gEffectBattler); - gActiveBattler = gEffectBattler; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gEffectBattler].item), &gBattleMons[gEffectBattler].item); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(gEffectBattler, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gEffectBattler].item), &gBattleMons[gEffectBattler].item); + MarkBattlerForControllerExec(gEffectBattler); BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_MoveEffectBugBite; } @@ -3903,6 +3671,25 @@ void SetMoveEffect(bool32 primary, u32 certain) gBattlescriptCurrInstr = BattleScript_SpikesActivates; } break; + case MOVE_EFFECT_TRIPLE_ARROWS: + { + u8 randomLowerDefenseChance = RandomPercentage(RNG_TRIPLE_ARROWS_DEFENSE_DOWN, CalcSecondaryEffectChance(gBattlerAttacker, 50)); + u8 randomFlinchChance = RandomPercentage(RNG_TRIPLE_ARROWS_FLINCH, CalcSecondaryEffectChance(gBattlerAttacker, 30)); + + if (randomFlinchChance && battlerAbility != ABILITY_INNER_FOCUS && GetBattlerTurnOrderNum(gEffectBattler) > gCurrentTurnActionNumber) + gBattleMons[gEffectBattler].status2 |= sStatusFlagsForMoveEffects[MOVE_EFFECT_FLINCH]; + + if (randomLowerDefenseChance) + { + BattleScriptPush(gBattlescriptCurrInstr + 1); + gBattlescriptCurrInstr = BattleScript_DefDown; + } + else + { + gBattlescriptCurrInstr++; + } + } + break; } } } @@ -3914,12 +3701,7 @@ static void Cmd_seteffectwithchance(void) { CMD_ARGS(); - u32 percentChance; - - if (GetBattlerAbility(gBattlerAttacker) == ABILITY_SERENE_GRACE) - percentChance = gBattleMoves[gCurrentMove].secondaryEffectChance * 2; - else - percentChance = gBattleMoves[gCurrentMove].secondaryEffectChance; + u32 percentChance = CalcSecondaryEffectChance(gBattlerAttacker, gBattleMoves[gCurrentMove].secondaryEffectChance); if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && gBattleScripting.moveEffect) @@ -3966,12 +3748,12 @@ static void Cmd_clearstatusfromeffect(void) { CMD_ARGS(u8 battler); - gActiveBattler = GetBattlerForBattleScript(cmd->battler); + u32 battler = GetBattlerForBattleScript(cmd->battler); if (gBattleScripting.moveEffect <= PRIMARY_STATUS_MOVE_EFFECT) - gBattleMons[gActiveBattler].status1 &= (~sStatusFlagsForMoveEffects[gBattleScripting.moveEffect]); + gBattleMons[battler].status1 &= (~sStatusFlagsForMoveEffects[gBattleScripting.moveEffect]); else - gBattleMons[gActiveBattler].status2 &= (~sStatusFlagsForMoveEffects[gBattleScripting.moveEffect]); + gBattleMons[battler].status2 &= (~sStatusFlagsForMoveEffects[gBattleScripting.moveEffect]); gBattleScripting.moveEffect = 0; gBattlescriptCurrInstr = cmd->nextInstr; @@ -3981,18 +3763,17 @@ static void Cmd_clearstatusfromeffect(void) static void Cmd_tryfaintmon(void) { CMD_ARGS(u8 battler, bool8 isSpikes, const u8 *instr); - const u8 *instr; + u32 battler, destinyBondBattler; + const u8 *faintScript; + battler = GetBattlerForBattleScript(cmd->battler); if (cmd->isSpikes != 0) { - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - if (gHitMarker & HITMARKER_FAINTED(gActiveBattler)) + if (gHitMarker & HITMARKER_FAINTED(battler)) { - instr = cmd->instr; - BattleScriptPop(); - gBattlescriptCurrInstr = instr; - gSideStatuses[GetBattlerSide(gActiveBattler)] &= ~(SIDE_STATUS_SPIKES_DAMAGED | SIDE_STATUS_TOXIC_SPIKES_DAMAGED | SIDE_STATUS_STEALTH_ROCK_DAMAGED | SIDE_STATUS_STICKY_WEB_DAMAGED); + gBattlescriptCurrInstr = cmd->instr; + gSideStatuses[GetBattlerSide(battler)] &= ~(SIDE_STATUS_SPIKES_DAMAGED | SIDE_STATUS_TOXIC_SPIKES_DAMAGED | SIDE_STATUS_STEALTH_ROCK_DAMAGED | SIDE_STATUS_STICKY_WEB_DAMAGED); } else { @@ -4001,46 +3782,42 @@ static void Cmd_tryfaintmon(void) } else { - u8 battlerId; - if (cmd->battler == BS_ATTACKER) { - gActiveBattler = gBattlerAttacker; - battlerId = gBattlerTarget; - instr = BattleScript_FaintAttacker; + destinyBondBattler = gBattlerTarget; + faintScript = BattleScript_FaintAttacker; } else { - gActiveBattler = gBattlerTarget; - battlerId = gBattlerAttacker; - instr = BattleScript_FaintTarget; + destinyBondBattler = gBattlerAttacker; + faintScript = BattleScript_FaintTarget; } - if (!(gAbsentBattlerFlags & gBitTable[gActiveBattler]) - && gBattleMons[gActiveBattler].hp == 0) + if (!(gAbsentBattlerFlags & gBitTable[battler]) + && gBattleMons[battler].hp == 0) { - gHitMarker |= HITMARKER_FAINTED(gActiveBattler); + gHitMarker |= HITMARKER_FAINTED(battler); BattleScriptPush(cmd->nextInstr); - gBattlescriptCurrInstr = instr; - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) + gBattlescriptCurrInstr = faintScript; + if (GetBattlerSide(battler) == B_SIDE_PLAYER) { gHitMarker |= HITMARKER_PLAYER_FAINTED; if (gBattleResults.playerFaintCounter < 255) gBattleResults.playerFaintCounter++; - AdjustFriendshipOnBattleFaint(gActiveBattler); + AdjustFriendshipOnBattleFaint(battler); gSideTimers[B_SIDE_PLAYER].retaliateTimer = 2; } else { if (gBattleResults.opponentFaintCounter < 255) gBattleResults.opponentFaintCounter++; - gBattleResults.lastOpponentSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES, NULL); + gBattleResults.lastOpponentSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES, NULL); gSideTimers[B_SIDE_OPPONENT].retaliateTimer = 2; } if ((gHitMarker & HITMARKER_DESTINYBOND) && gBattleMons[gBattlerAttacker].hp != 0) { gHitMarker &= ~HITMARKER_DESTINYBOND; BattleScriptPush(gBattlescriptCurrInstr); - gBattleMoveDamage = gBattleMons[battlerId].hp; + gBattleMoveDamage = gBattleMons[destinyBondBattler].hp; gBattlescriptCurrInstr = BattleScript_DestinyBondTakesLife; } if ((gStatuses3[gBattlerTarget] & STATUS3_GRUDGE) @@ -4054,9 +3831,8 @@ static void Cmd_tryfaintmon(void) gBattleMons[gBattlerAttacker].pp[moveIndex] = 0; BattleScriptPush(gBattlescriptCurrInstr); gBattlescriptCurrInstr = BattleScript_GrudgeTakesPp; - gActiveBattler = gBattlerAttacker; - BtlController_EmitSetMonData(BUFFER_A, moveIndex + REQUEST_PPMOVE1_BATTLE, 0, sizeof(gBattleMons[gActiveBattler].pp[moveIndex]), &gBattleMons[gActiveBattler].pp[moveIndex]); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, moveIndex + REQUEST_PPMOVE1_BATTLE, 0, sizeof(gBattleMons[gBattlerAttacker].pp[moveIndex]), &gBattleMons[gBattlerAttacker].pp[moveIndex]); + MarkBattlerForControllerExec(gBattlerAttacker); PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerAttacker].moves[moveIndex]) } @@ -4074,9 +3850,9 @@ static void Cmd_dofaintanimation(void) if (gBattleControllerExecFlags == 0) { - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - BtlController_EmitFaintAnimation(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + u32 battler = GetBattlerForBattleScript(cmd->battler); + BtlController_EmitFaintAnimation(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; } } @@ -4087,16 +3863,16 @@ static void Cmd_cleareffectsonfaint(void) if (gBattleControllerExecFlags == 0) { - gActiveBattler = GetBattlerForBattleScript(cmd->battler); + u32 battler = GetBattlerForBattleScript(cmd->battler); - if (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || gBattleMons[gActiveBattler].hp == 0) + if (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || gBattleMons[battler].hp == 0) { - gBattleMons[gActiveBattler].status1 = 0; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gActiveBattler].status1), &gBattleMons[gActiveBattler].status1); - MarkBattlerForControllerExec(gActiveBattler); + gBattleMons[battler].status1 = 0; + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[battler].status1), &gBattleMons[battler].status1); + MarkBattlerForControllerExec(battler); } - FaintClearSetData(); // Effects like attractions, trapping, etc. + FaintClearSetData(battler); // Effects like attractions, trapping, etc. gBattlescriptCurrInstr = cmd->nextInstr; } } @@ -4105,11 +3881,11 @@ static void Cmd_jumpifstatus(void) { CMD_ARGS(u8 battler, u32 flags, const u8 *jumpInstr); - u8 battlerId = GetBattlerForBattleScript(cmd->battler); + u8 battler = GetBattlerForBattleScript(cmd->battler); u32 flags = cmd->flags; const u8 *jumpInstr = cmd->jumpInstr; - if (gBattleMons[battlerId].status1 & flags && gBattleMons[battlerId].hp != 0) + if (gBattleMons[battler].status1 & flags && gBattleMons[battler].hp != 0) gBattlescriptCurrInstr = jumpInstr; else gBattlescriptCurrInstr = cmd->nextInstr; @@ -4119,11 +3895,11 @@ static void Cmd_jumpifstatus2(void) { CMD_ARGS(u8 battler, u32 flags, const u8 *jumpInstr); - u8 battlerId = GetBattlerForBattleScript(cmd->battler); + u8 battler = GetBattlerForBattleScript(cmd->battler); u32 flags = cmd->flags; const u8 *jumpInstr = cmd->jumpInstr; - if (gBattleMons[battlerId].status2 & flags && gBattleMons[battlerId].hp != 0) + if (gBattleMons[battler].status2 & flags && gBattleMons[battler].hp != 0) gBattlescriptCurrInstr = jumpInstr; else gBattlescriptCurrInstr = cmd->nextInstr; @@ -4133,30 +3909,30 @@ static void Cmd_jumpifability(void) { CMD_ARGS(u8 battler, u16 ability, const u8 *jumpInstr); - u32 battlerId; + u32 battler; bool32 hasAbility = FALSE; u32 ability = cmd->ability; switch (cmd->battler) { default: - battlerId = GetBattlerForBattleScript(cmd->battler); - if (GetBattlerAbility(battlerId) == ability) + battler = GetBattlerForBattleScript(cmd->battler); + if (GetBattlerAbility(battler) == ability) hasAbility = TRUE; break; case BS_ATTACKER_SIDE: - battlerId = IsAbilityOnSide(gBattlerAttacker, ability); - if (battlerId) + battler = IsAbilityOnSide(gBattlerAttacker, ability); + if (battler) { - battlerId--; + battler--; hasAbility = TRUE; } break; case BS_TARGET_SIDE: - battlerId = IsAbilityOnOpposingSide(gBattlerAttacker, ability); - if (battlerId) + battler = IsAbilityOnOpposingSide(gBattlerAttacker, ability); + if (battler) { - battlerId--; + battler--; hasAbility = TRUE; } break; @@ -4166,8 +3942,8 @@ static void Cmd_jumpifability(void) { gLastUsedAbility = ability; gBattlescriptCurrInstr = cmd->jumpInstr; - RecordAbilityBattle(battlerId, gLastUsedAbility); - gBattlerAbility = battlerId; + RecordAbilityBattle(battler, gLastUsedAbility); + gBattlerAbility = battler; } else { @@ -4179,16 +3955,10 @@ static void Cmd_jumpifsideaffecting(void) { CMD_ARGS(u8 battler, u32 flags, const u8 *jumpInstr); - u8 side; - u32 flags; - const u8 *jumpInstr; - - side = GET_BATTLER_SIDE(GetBattlerForBattleScript(cmd->battler)); - flags = cmd->flags; - jumpInstr = cmd->jumpInstr; + u32 side = GetBattlerSide(GetBattlerForBattleScript(cmd->battler)); - if (gSideStatuses[side] & flags) - gBattlescriptCurrInstr = jumpInstr; + if (gSideStatuses[side] & cmd->flags) + gBattlescriptCurrInstr = cmd->jumpInstr; else gBattlescriptCurrInstr = cmd->nextInstr; } @@ -4198,12 +3968,12 @@ static void Cmd_jumpifstat(void) CMD_ARGS(u8 battler, u8 comparison, u8 stat, u8 value, const u8 *jumpInstr); bool32 ret = 0; - u8 battlerId = GetBattlerForBattleScript(cmd->battler); + u8 battler = GetBattlerForBattleScript(cmd->battler); u8 stat = cmd->stat; u8 value = cmd->value; u8 comparison = cmd->comparison; - ret = CompareStat(battlerId, stat, value, comparison); + ret = CompareStat(battler, stat, value, comparison); if (ret) gBattlescriptCurrInstr = cmd->jumpInstr; @@ -4215,24 +3985,18 @@ static void Cmd_jumpifstatus3condition(void) { CMD_ARGS(u8 battler, u32 flags, bool8 jumpIfTrue, const u8 *jumpInstr); - u32 flags; - const u8 *jumpInstr; - - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - flags = cmd->flags; - jumpInstr = cmd->jumpInstr; - + u32 battler = GetBattlerForBattleScript(cmd->battler); if (cmd->jumpIfTrue) { - if ((gStatuses3[gActiveBattler] & flags) != 0) + if ((gStatuses3[battler] & cmd->flags) != 0) gBattlescriptCurrInstr = cmd->nextInstr; else - gBattlescriptCurrInstr = jumpInstr; + gBattlescriptCurrInstr = cmd->jumpInstr; } else { - if ((gStatuses3[gActiveBattler] & flags) != 0) - gBattlescriptCurrInstr = jumpInstr; + if ((gStatuses3[battler] & cmd->flags) != 0) + gBattlescriptCurrInstr = cmd->jumpInstr; else gBattlescriptCurrInstr = cmd->nextInstr; } @@ -4242,14 +4006,14 @@ static void Cmd_jumpbasedontype(void) { CMD_ARGS(u8 battler, u8 type, u8 jumpIfType, const u8 *jumpInstr); - u8 battlerId = GetBattlerForBattleScript(cmd->battler); + u8 battler = GetBattlerForBattleScript(cmd->battler); u8 type = cmd->type; const u8 *jumpInstr = cmd->jumpInstr; // jumpiftype if (cmd->jumpIfType) { - if (IS_BATTLER_OF_TYPE(battlerId, type)) + if (IS_BATTLER_OF_TYPE(battler, type)) gBattlescriptCurrInstr = jumpInstr; else gBattlescriptCurrInstr = cmd->nextInstr; @@ -4257,31 +4021,44 @@ static void Cmd_jumpbasedontype(void) // jumpifnottype else { - if (!IS_BATTLER_OF_TYPE(battlerId, type)) + if (!IS_BATTLER_OF_TYPE(battler, type)) gBattlescriptCurrInstr = jumpInstr; else gBattlescriptCurrInstr = cmd->nextInstr; } } +FEATURE_FLAG_ASSERT(I_EXP_SHARE_FLAG, YouNeedToSetTheExpShareFlagToAnUnusedFlag); + +static u32 GetMonHoldEffect(struct Pokemon *mon) +{ + u32 holdEffect; + u32 item = GetMonData(mon, MON_DATA_HELD_ITEM); + + if (item == ITEM_ENIGMA_BERRY_E_READER) + holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect; + else + holdEffect = ItemId_GetHoldEffect(item); + + return holdEffect; +} + static void Cmd_getexp(void) { CMD_ARGS(u8 battler); - u16 item; + u32 holdEffect; s32 i; // also used as stringId - u8 holdEffect; - s32 sentIn; - s32 viaExpShare = 0; - u32 *exp = &gBattleStruct->expValue; + u8 *expMonId = &gBattleStruct->expGetterMonId; gBattlerFainted = GetBattlerForBattleScript(cmd->battler); - sentIn = gSentPokesToOpponent[(gBattlerFainted & 2) >> 1]; switch (gBattleScripting.getexpState) { case 0: // check if should receive exp at all - if (GetBattlerSide(gBattlerFainted) != B_SIDE_OPPONENT || (gBattleTypeFlags & + if (GetBattlerSide(gBattlerFainted) != B_SIDE_OPPONENT + || IsAiVsAiBattle() + || (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_TRAINER_HILL @@ -4300,32 +4077,51 @@ static void Cmd_getexp(void) break; case 1: // calculate experience points to redistribute { - u32 calculatedExp; - s32 viaSentIn; + u32 orderId = 0; + u32 calculatedExp = 0; + u32 *exp = &gBattleStruct->expValue; + u32 sentInBits = gSentPokesToOpponent[(gBattlerFainted & 2) >> 1]; + u32 expShareBits = 0; + s32 viaSentIn = 0; + s32 viaExpShare = 0; - for (viaSentIn = 0, i = 0; i < PARTY_SIZE; i++) + for (i = 0; i < PARTY_SIZE; i++) { if (!IsValidForBattle(&gPlayerParty[i])) continue; - if (gBitTable[i] & sentIn) + if (gBitTable[i] & sentInBits) viaSentIn++; - item = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); - - if (item == ITEM_ENIGMA_BERRY_E_READER) - holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect; - else - holdEffect = ItemId_GetHoldEffect(item); - - if (holdEffect == HOLD_EFFECT_EXP_SHARE) + holdEffect = GetMonHoldEffect(&gPlayerParty[i]); + if (holdEffect == HOLD_EFFECT_EXP_SHARE || IsGen6ExpShareEnabled()) + { + expShareBits |= gBitTable[i]; viaExpShare++; + } } + // Get order of mons getting exp: 1. all mons via sent in, 2. all mons via exp share + for (i = 0; i < PARTY_SIZE; i++) + { + if (gBitTable[i] & sentInBits) + gBattleStruct->expGettersOrder[orderId++] = i; + } + for (i = 0; i < PARTY_SIZE; i++) + { + if (!(gBitTable[i] & sentInBits) && gBitTable[i] & expShareBits) + gBattleStruct->expGettersOrder[orderId++] = i; + } + if (orderId < PARTY_SIZE) + gBattleStruct->expGettersOrder[orderId] = PARTY_SIZE; + #if (B_SCALED_EXP >= GEN_5) && (B_SCALED_EXP != GEN_6) calculatedExp = gSpeciesInfo[gBattleMons[gBattlerFainted].species].expYield * gBattleMons[gBattlerFainted].level / 5; #else calculatedExp = gSpeciesInfo[gBattleMons[gBattlerFainted].species].expYield * gBattleMons[gBattlerFainted].level / 7; #endif + if (B_TRAINER_EXP_MULTIPLIER <= GEN_7 && gBattleTypeFlags & BATTLE_TYPE_TRAINER) + calculatedExp = (calculatedExp * 150) / 100; + #if B_SPLIT_EXP < GEN_6 if (viaExpShare) // at least one mon is getting exp via exp share { @@ -4333,53 +4129,49 @@ static void Cmd_getexp(void) if (*exp == 0) *exp = 1; - gExpShareExp = calculatedExp / 2 / viaExpShare; - if (gExpShareExp == 0) - gExpShareExp = 1; + gBattleStruct->expShareExpValue = calculatedExp / 2 / viaExpShare; + if (gBattleStruct->expShareExpValue == 0) + gBattleStruct->expShareExpValue = 1; } else { *exp = SAFE_DIV(calculatedExp, viaSentIn); if (*exp == 0) *exp = 1; - gExpShareExp = 0; + gBattleStruct->expShareExpValue = 0; } #else *exp = calculatedExp; - gExpShareExp = calculatedExp / 2; - if (gExpShareExp == 0) - gExpShareExp = 1; + gBattleStruct->expShareExpValue = calculatedExp / 2; + if (gBattleStruct->expShareExpValue == 0) + gBattleStruct->expShareExpValue = 1; #endif gBattleScripting.getexpState++; - gBattleStruct->expGetterMonId = 0; - gBattleStruct->sentInPokes = sentIn; + gBattleStruct->expOrderId = 0; + *expMonId = gBattleStruct->expGettersOrder[0]; + gBattleStruct->expSentInMons = sentInBits; } // fall through case 2: // set exp value to the poke in expgetter_id and print message if (gBattleControllerExecFlags == 0) { - item = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HELD_ITEM); - - if (item == ITEM_ENIGMA_BERRY_E_READER) - holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect; - else - holdEffect = ItemId_GetHoldEffect(item); + bool32 wasSentOut = ((gBattleStruct->expSentInMons & gBitTable[*expMonId]) != 0); + holdEffect = GetMonHoldEffect(&gPlayerParty[*expMonId]); - if (holdEffect != HOLD_EFFECT_EXP_SHARE && !(gBattleStruct->sentInPokes & 1)) + if ((holdEffect != HOLD_EFFECT_EXP_SHARE && !wasSentOut && !IsGen6ExpShareEnabled()) + || GetMonData(&gPlayerParty[*expMonId], MON_DATA_SPECIES_OR_EGG) == SPECIES_EGG) { - *(&gBattleStruct->sentInPokes) >>= 1; gBattleScripting.getexpState = 5; gBattleMoveDamage = 0; // used for exp } - else if ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gBattleStruct->expGetterMonId >= 3) - || GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL) == MAX_LEVEL) + else if ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && *expMonId >= 3) + || GetMonData(&gPlayerParty[*expMonId], MON_DATA_LEVEL) == MAX_LEVEL) { - *(&gBattleStruct->sentInPokes) >>= 1; gBattleScripting.getexpState = 5; gBattleMoveDamage = 0; // used for exp #if B_MAX_LEVEL_EV_GAINS >= GEN_5 - MonGainEVs(&gPlayerParty[gBattleStruct->expGetterMonId], gBattleMons[gBattlerFainted].species); + MonGainEVs(&gPlayerParty[*expMonId], gBattleMons[gBattlerFainted].species); #endif } else @@ -4396,64 +4188,42 @@ static void Cmd_getexp(void) gBattleStruct->wildVictorySong++; } - if (IsValidForBattle(&gPlayerParty[gBattleStruct->expGetterMonId])) + if (IsValidForBattle(&gPlayerParty[*expMonId])) { - if (gBattleStruct->sentInPokes & 1) - gBattleMoveDamage = *exp; + if (wasSentOut) + gBattleMoveDamage = gBattleStruct->expValue; else gBattleMoveDamage = 0; - // only give exp share bonus in later gens if the mon wasn't sent out - #if B_SPLIT_EXP < GEN_6 - if (holdEffect == HOLD_EFFECT_EXP_SHARE) - gBattleMoveDamage += gExpShareExp; - #else - if (holdEffect == HOLD_EFFECT_EXP_SHARE && gBattleMoveDamage == 0) - gBattleMoveDamage += gExpShareExp; - #endif - if (holdEffect == HOLD_EFFECT_LUCKY_EGG) - gBattleMoveDamage = (gBattleMoveDamage * 150) / 100; - #if B_TRAINER_EXP_MULTIPLIER <= GEN_7 - if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) - gBattleMoveDamage = (gBattleMoveDamage * 150) / 100; - #endif - #if (B_SCALED_EXP >= GEN_5) && (B_SCALED_EXP != GEN_6) + if ((holdEffect == HOLD_EFFECT_EXP_SHARE || IsGen6ExpShareEnabled()) +#if B_SPLIT_EXP >= GEN_6 + // only give exp share bonus in later gens if the mon wasn't sent out + && gBattleMoveDamage == 0 +#endif + ) { - // Note: There is an edge case where if a pokemon receives a large amount of exp, it wouldn't be properly calculated - // because of multiplying by scaling factor(the value would simply be larger than an u32 can hold). Hence u64 is needed. - u64 value = gBattleMoveDamage; - value *= sExperienceScalingFactors[(gBattleMons[gBattlerFainted].level * 2) + 10]; - value /= sExperienceScalingFactors[gBattleMons[gBattlerFainted].level + GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL) + 10]; - gBattleMoveDamage = value + 1; + gBattleMoveDamage += gBattleStruct->expShareExpValue; } - #endif - #if B_AFFECTION_MECHANICS == TRUE - if (GetBattlerFriendshipScore(gBattleStruct->expGetterMonId) >= FRIENDSHIP_50_TO_99) - gBattleMoveDamage = (gBattleMoveDamage * 120) / 100; - #endif - if (IsTradedMon(&gPlayerParty[gBattleStruct->expGetterMonId])) + ApplyExperienceMultipliers(&gBattleMoveDamage, *expMonId, gBattlerFainted); + + if (IsTradedMon(&gPlayerParty[*expMonId])) { // check if the pokemon doesn't belong to the player - if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gBattleStruct->expGetterMonId >= 3) - { + if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && *expMonId >= 3) i = STRINGID_EMPTYSTRING4; - } else - { - gBattleMoveDamage = (gBattleMoveDamage * 150) / 100; i = STRINGID_ABOOSTED; - } } else { i = STRINGID_EMPTYSTRING4; } - // get exp getter battlerId + // get exp getter battler if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { - if (gBattlerPartyIndexes[2] == gBattleStruct->expGetterMonId && !(gAbsentBattlerFlags & gBitTable[2])) + if (gBattlerPartyIndexes[2] == *expMonId && !(gAbsentBattlerFlags & gBitTable[2])) gBattleStruct->expGetterBattlerId = 2; else { @@ -4468,15 +4238,24 @@ static void Cmd_getexp(void) gBattleStruct->expGetterBattlerId = 0; } - PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattleStruct->expGetterBattlerId, gBattleStruct->expGetterMonId); + PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattleStruct->expGetterBattlerId, *expMonId); // buffer 'gained' or 'gained a boosted' PREPARE_STRING_BUFFER(gBattleTextBuff2, i); PREPARE_WORD_NUMBER_BUFFER(gBattleTextBuff3, 6, gBattleMoveDamage); - PrepareStringBattle(STRINGID_PKMNGAINEDEXP, gBattleStruct->expGetterBattlerId); - MonGainEVs(&gPlayerParty[gBattleStruct->expGetterMonId], gBattleMons[gBattlerFainted].species); + if (wasSentOut || holdEffect == HOLD_EFFECT_EXP_SHARE) + { + PrepareStringBattle(STRINGID_PKMNGAINEDEXP, gBattleStruct->expGetterBattlerId); + } + else if (IsGen6ExpShareEnabled() && !gBattleStruct->teamGotExpMsgPrinted) // Print 'the rest of your team got exp' message once, when all of the sent-in mons were given experience + { + gLastUsedItem = ITEM_EXP_SHARE; + PrepareStringBattle(STRINGID_TEAMGAINEDEXP, gBattleStruct->expGetterBattlerId); + gBattleStruct->teamGotExpMsgPrinted = TRUE; + } + + MonGainEVs(&gPlayerParty[*expMonId], gBattleMons[gBattlerFainted].species); } - gBattleStruct->sentInPokes >>= 1; gBattleScripting.getexpState++; } } @@ -4485,18 +4264,17 @@ static void Cmd_getexp(void) if (gBattleControllerExecFlags == 0) { gBattleResources->bufferB[gBattleStruct->expGetterBattlerId][0] = 0; - if (GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HP) && GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL) != MAX_LEVEL) + if (GetMonData(&gPlayerParty[*expMonId], MON_DATA_HP) && GetMonData(&gPlayerParty[*expMonId], MON_DATA_LEVEL) != MAX_LEVEL) { - gBattleResources->beforeLvlUp->stats[STAT_HP] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_MAX_HP); - gBattleResources->beforeLvlUp->stats[STAT_ATK] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_ATK); - gBattleResources->beforeLvlUp->stats[STAT_DEF] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_DEF); - gBattleResources->beforeLvlUp->stats[STAT_SPEED] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPEED); - gBattleResources->beforeLvlUp->stats[STAT_SPATK] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPATK); - gBattleResources->beforeLvlUp->stats[STAT_SPDEF] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPDEF); - - gActiveBattler = gBattleStruct->expGetterBattlerId; - BtlController_EmitExpUpdate(BUFFER_A, gBattleStruct->expGetterMonId, gBattleMoveDamage); - MarkBattlerForControllerExec(gActiveBattler); + gBattleResources->beforeLvlUp->stats[STAT_HP] = GetMonData(&gPlayerParty[*expMonId], MON_DATA_MAX_HP); + gBattleResources->beforeLvlUp->stats[STAT_ATK] = GetMonData(&gPlayerParty[*expMonId], MON_DATA_ATK); + gBattleResources->beforeLvlUp->stats[STAT_DEF] = GetMonData(&gPlayerParty[*expMonId], MON_DATA_DEF); + gBattleResources->beforeLvlUp->stats[STAT_SPEED] = GetMonData(&gPlayerParty[*expMonId], MON_DATA_SPEED); + gBattleResources->beforeLvlUp->stats[STAT_SPATK] = GetMonData(&gPlayerParty[*expMonId], MON_DATA_SPATK); + gBattleResources->beforeLvlUp->stats[STAT_SPDEF] = GetMonData(&gPlayerParty[*expMonId], MON_DATA_SPDEF); + + BtlController_EmitExpUpdate(gBattleStruct->expGetterBattlerId, BUFFER_A, *expMonId, gBattleMoveDamage); + MarkBattlerForControllerExec(gBattleStruct->expGetterBattlerId); } gBattleScripting.getexpState++; } @@ -4504,33 +4282,33 @@ static void Cmd_getexp(void) case 4: // lvl up if necessary if (gBattleControllerExecFlags == 0) { - gActiveBattler = gBattleStruct->expGetterBattlerId; - if (gBattleResources->bufferB[gActiveBattler][0] == CONTROLLER_TWORETURNVALUES && gBattleResources->bufferB[gActiveBattler][1] == RET_VALUE_LEVELED_UP) + u32 expBattler = gBattleStruct->expGetterBattlerId; + if (gBattleResources->bufferB[expBattler][0] == CONTROLLER_TWORETURNVALUES && gBattleResources->bufferB[expBattler][1] == RET_VALUE_LEVELED_UP) { - u16 temp, battlerId = 0xFF; - if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterMonId) - HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); + u16 temp, battler = 0xFF; + if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gBattlerPartyIndexes[expBattler] == *expMonId) + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[expBattler]], expBattler); - PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gActiveBattler, gBattleStruct->expGetterMonId); - PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff2, 3, GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL)); + PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, expBattler, *expMonId); + PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff2, 3, GetMonData(&gPlayerParty[*expMonId], MON_DATA_LEVEL)); BattleScriptPushCursor(); - gLeveledUpInBattle |= gBitTable[gBattleStruct->expGetterMonId]; + gLeveledUpInBattle |= gBitTable[*expMonId]; gBattlescriptCurrInstr = BattleScript_LevelUp; - gBattleMoveDamage = T1_READ_32(&gBattleResources->bufferB[gActiveBattler][2]); - AdjustFriendship(&gPlayerParty[gBattleStruct->expGetterMonId], FRIENDSHIP_EVENT_GROW_LEVEL); + gBattleMoveDamage = T1_READ_32(&gBattleResources->bufferB[expBattler][2]); + AdjustFriendship(&gPlayerParty[*expMonId], FRIENDSHIP_EVENT_GROW_LEVEL); // update battle mon structure after level up - if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterMonId && gBattleMons[0].hp) - battlerId = 0; - else if (gBattlerPartyIndexes[2] == gBattleStruct->expGetterMonId && gBattleMons[2].hp && (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) - battlerId = 2; + if (gBattlerPartyIndexes[0] == *expMonId && gBattleMons[0].hp) + battler = 0; + else if (gBattlerPartyIndexes[2] == *expMonId && gBattleMons[2].hp && (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) + battler = 2; - if (battlerId != 0xFF) + if (battler != 0xFF) { - CopyMonLevelAndBaseStatsToBattleMon(battlerId, &gPlayerParty[gBattleStruct->expGetterMonId]); - if (gStatuses3[battlerId] & STATUS3_POWER_TRICK) - SWAP(gBattleMons[battlerId].attack, gBattleMons[battlerId].defense, temp); + CopyMonLevelAndBaseStatsToBattleMon(battler, &gPlayerParty[*expMonId]); + if (gStatuses3[battler] & STATUS3_POWER_TRICK) + SWAP(gBattleMons[battler].attack, gBattleMons[battler].defense, temp); } gBattleScripting.getexpState = 5; @@ -4549,17 +4327,24 @@ static void Cmd_getexp(void) } else { - gBattleStruct->expGetterMonId++; - if (gBattleStruct->expGetterMonId < PARTY_SIZE) - gBattleScripting.getexpState = 2; // loop again - else - gBattleScripting.getexpState = 6; // we're done + if ((++gBattleStruct->expOrderId) < PARTY_SIZE) + { + *expMonId = gBattleStruct->expGettersOrder[gBattleStruct->expOrderId]; + if (*expMonId < PARTY_SIZE) + { + gBattleScripting.getexpState = 2; // loop again + break; + } + } + gBattleScripting.getexpState = 6; // we're done } break; case 6: // increment instruction if (gBattleControllerExecFlags == 0) { // not sure why gf clears the item and ability here + gBattleStruct->expOrderId = 0; + gBattleStruct->teamGotExpMsgPrinted = FALSE; gBattleMons[gBattlerFainted].item = ITEM_NONE; gBattleMons[gBattlerFainted].ability = ABILITY_NONE; gBattlescriptCurrInstr = cmd->nextInstr; @@ -5070,14 +4855,15 @@ static void Cmd_waitstate(void) static void Cmd_healthbar_update(void) { CMD_ARGS(u8 battler); + u32 battler; if (cmd->battler == BS_TARGET) - gActiveBattler = gBattlerTarget; + battler = gBattlerTarget; else - gActiveBattler = gBattlerAttacker; + battler = gBattlerAttacker; - BtlController_EmitHealthBarUpdate(BUFFER_A, gBattleMoveDamage); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitHealthBarUpdate(battler, BUFFER_A, gBattleMoveDamage); + MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -5094,7 +4880,6 @@ static void Cmd_end(void) BattleArena_AddSkillPoints(gBattlerAttacker); gMoveResultFlags = 0; - gActiveBattler = 0; gCurrentActionFuncId = B_ACTION_TRY_FINISH; } @@ -5102,7 +4887,6 @@ static void Cmd_end2(void) { CMD_ARGS(); - gActiveBattler = 0; gCurrentActionFuncId = B_ACTION_TRY_FINISH; } @@ -5186,21 +4970,13 @@ static void Cmd_endselectionscript(void) *(gBattlerAttacker + gBattleStruct->selectionScriptFinished) = TRUE; } -static void Cmd_playanimation(void) +static void PlayAnimation(u32 battler, u8 animId, const u16 *argPtr, const u8 *nextInstr) { - CMD_ARGS(u8 battler, u8 animId, const u16 *argPtr); - - const u16 *argPtr; - u8 animId = cmd->animId; - - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - argPtr = cmd->argPtr; - #if B_TERRAIN_BG_CHANGE == FALSE if (animId == B_ANIM_RESTORE_BG) { // workaround for .if not working - gBattlescriptCurrInstr = cmd->nextInstr; + gBattlescriptCurrInstr = nextInstr; return; } #endif @@ -5211,15 +4987,16 @@ static void Cmd_playanimation(void) || animId == B_ANIM_ILLUSION_OFF || animId == B_ANIM_FORM_CHANGE || animId == B_ANIM_SUBSTITUTE_FADE - || animId == B_ANIM_PRIMAL_REVERSION) + || animId == B_ANIM_PRIMAL_REVERSION + || animId == B_ANIM_ULTRA_BURST) { - BtlController_EmitBattleAnimation(BUFFER_A, animId, *argPtr); - MarkBattlerForControllerExec(gActiveBattler); - gBattlescriptCurrInstr = cmd->nextInstr; + BtlController_EmitBattleAnimation(battler, BUFFER_A, animId, *argPtr); + MarkBattlerForControllerExec(battler); + gBattlescriptCurrInstr = nextInstr; } else if (gHitMarker & HITMARKER_NO_ANIMATIONS && animId != B_ANIM_RESTORE_BG) { - BattleScriptPush(cmd->nextInstr); + BattleScriptPush(nextInstr); gBattlescriptCurrInstr = BattleScript_Pausex20; } else if (animId == B_ANIM_RAIN_CONTINUES @@ -5228,70 +5005,37 @@ static void Cmd_playanimation(void) || animId == B_ANIM_HAIL_CONTINUES || animId == B_ANIM_SNOW_CONTINUES) { - BtlController_EmitBattleAnimation(BUFFER_A, animId, *argPtr); - MarkBattlerForControllerExec(gActiveBattler); - gBattlescriptCurrInstr = cmd->nextInstr; + BtlController_EmitBattleAnimation(battler, BUFFER_A, animId, *argPtr); + MarkBattlerForControllerExec(battler); + gBattlescriptCurrInstr = nextInstr; } - else if (gStatuses3[gActiveBattler] & STATUS3_SEMI_INVULNERABLE) + else if (gStatuses3[battler] & STATUS3_SEMI_INVULNERABLE) { - gBattlescriptCurrInstr = cmd->nextInstr; + gBattlescriptCurrInstr = nextInstr; } else { - BtlController_EmitBattleAnimation(BUFFER_A, animId, *argPtr); - MarkBattlerForControllerExec(gActiveBattler); - gBattlescriptCurrInstr = cmd->nextInstr; + BtlController_EmitBattleAnimation(battler, BUFFER_A, animId, *argPtr); + MarkBattlerForControllerExec(battler); + gBattlescriptCurrInstr = nextInstr; } } +static void Cmd_playanimation(void) +{ + CMD_ARGS(u8 battler, u8 animId, const u16 *argPtr); + + u32 battler = GetBattlerForBattleScript(cmd->battler); + PlayAnimation(battler, cmd->animId, cmd->argPtr, cmd->nextInstr); +} + // Same as playanimation, except it takes a pointer to some animation id, instead of taking the value directly static void Cmd_playanimation_var(void) { CMD_ARGS(u8 battler, const u8 *animIdPtr, const u16 *argPtr); - const u16 *argPtr; - const u8 *animIdPtr; - - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - animIdPtr = cmd->animIdPtr; - argPtr = cmd->argPtr; - - if (*animIdPtr == B_ANIM_STATS_CHANGE - || *animIdPtr == B_ANIM_SNATCH_MOVE - || *animIdPtr == B_ANIM_MEGA_EVOLUTION - || *animIdPtr == B_ANIM_ILLUSION_OFF - || *animIdPtr == B_ANIM_FORM_CHANGE - || *animIdPtr == B_ANIM_SUBSTITUTE_FADE - || *animIdPtr == B_ANIM_PRIMAL_REVERSION) - { - BtlController_EmitBattleAnimation(BUFFER_A, *animIdPtr, *argPtr); - MarkBattlerForControllerExec(gActiveBattler); - gBattlescriptCurrInstr = cmd->nextInstr; - } - else if (gHitMarker & HITMARKER_NO_ANIMATIONS) - { - gBattlescriptCurrInstr = cmd->nextInstr; - } - else if (*animIdPtr == B_ANIM_RAIN_CONTINUES - || *animIdPtr == B_ANIM_SUN_CONTINUES - || *animIdPtr == B_ANIM_SANDSTORM_CONTINUES - || *animIdPtr == B_ANIM_HAIL_CONTINUES - || *animIdPtr == B_ANIM_SNOW_CONTINUES) - { - BtlController_EmitBattleAnimation(BUFFER_A, *animIdPtr, *argPtr); - MarkBattlerForControllerExec(gActiveBattler); - gBattlescriptCurrInstr = cmd->nextInstr; - } - else if (gStatuses3[gActiveBattler] & STATUS3_SEMI_INVULNERABLE) - { - gBattlescriptCurrInstr = cmd->nextInstr; - } - else - { - BtlController_EmitBattleAnimation(BUFFER_A, *animIdPtr, *argPtr); - MarkBattlerForControllerExec(gActiveBattler); - gBattlescriptCurrInstr = cmd->nextInstr; - } + u32 battler = GetBattlerForBattleScript(cmd->battler); + PlayAnimation(battler, *(cmd->animIdPtr), cmd->argPtr, cmd->nextInstr); } static void Cmd_setgraphicalstatchangevalues(void) @@ -5303,28 +5047,28 @@ static void Cmd_setgraphicalstatchangevalues(void) switch (value) { case SET_STAT_BUFF_VALUE(1): // +1 - value = STAT_ANIM_PLUS1; + value = STAT_ANIM_PLUS1 + 1; break; case SET_STAT_BUFF_VALUE(2): // +2 - value = STAT_ANIM_PLUS2; + value = STAT_ANIM_PLUS2 + 1; break; case SET_STAT_BUFF_VALUE(3): // +3 - value = STAT_ANIM_PLUS2; + value = STAT_ANIM_PLUS2 + 1; break; case SET_STAT_BUFF_VALUE(1) | STAT_BUFF_NEGATIVE: // -1 - value = STAT_ANIM_MINUS1; + value = STAT_ANIM_MINUS1 + 1; break; case SET_STAT_BUFF_VALUE(2) | STAT_BUFF_NEGATIVE: // -2 - value = STAT_ANIM_MINUS2; + value = STAT_ANIM_MINUS2 + 1; break; case SET_STAT_BUFF_VALUE(3) | STAT_BUFF_NEGATIVE: // -3 - value = STAT_ANIM_MINUS2; + value = STAT_ANIM_MINUS2 + 1; break; default: // <-12,-4> and <4, 12> if (value & STAT_BUFF_NEGATIVE) - value = STAT_ANIM_MINUS2; + value = STAT_ANIM_MINUS2 + 1; else - value = STAT_ANIM_PLUS2; + value = STAT_ANIM_PLUS2 + 1; break; } gBattleScripting.animArg1 = GET_STAT_BUFF_ID(gBattleScripting.statChanger) + value - 1; @@ -5336,17 +5080,14 @@ static void Cmd_playstatchangeanimation(void) { CMD_ARGS(u8 battler, u8 stats, u8 flags); - u32 ability; u32 currStat = 0; u32 statAnimId = 0; u32 changeableStatsCount = 0; - u32 stats = 0; u32 startingStatAnimId = 0; u32 flags = cmd->flags; - - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - ability = GetBattlerAbility(gActiveBattler); - stats = cmd->stats; + u32 battler = GetBattlerForBattleScript(cmd->battler); + u32 ability = GetBattlerAbility(battler); + u32 stats = cmd->stats; // Handle Contrary and Simple if (ability == ABILITY_CONTRARY) @@ -5357,9 +5098,9 @@ static void Cmd_playstatchangeanimation(void) if (flags & STAT_CHANGE_NEGATIVE) // goes down { if (flags & STAT_CHANGE_BY_TWO) - startingStatAnimId = STAT_ANIM_MINUS2 - 1; + startingStatAnimId = STAT_ANIM_MINUS2; else - startingStatAnimId = STAT_ANIM_MINUS1 - 1; + startingStatAnimId = STAT_ANIM_MINUS1; while (stats != 0) { @@ -5367,14 +5108,14 @@ static void Cmd_playstatchangeanimation(void) { if (flags & STAT_CHANGE_CANT_PREVENT) { - if (gBattleMons[gActiveBattler].statStages[currStat] > MIN_STAT_STAGE) + if (gBattleMons[battler].statStages[currStat] > MIN_STAT_STAGE) { statAnimId = startingStatAnimId + currStat; changeableStatsCount++; } } - else if (!gSideTimers[GET_BATTLER_SIDE(gActiveBattler)].mistTimer - && GetBattlerHoldEffect(gActiveBattler, TRUE) != HOLD_EFFECT_CLEAR_AMULET + else if (!gSideTimers[GetBattlerSide(battler)].mistTimer + && GetBattlerHoldEffect(battler, TRUE) != HOLD_EFFECT_CLEAR_AMULET && ability != ABILITY_CLEAR_BODY && ability != ABILITY_FULL_METAL_BODY && ability != ABILITY_WHITE_SMOKE @@ -5382,7 +5123,7 @@ static void Cmd_playstatchangeanimation(void) && !(ability == ABILITY_HYPER_CUTTER && currStat == STAT_ATK) && !(ability == ABILITY_BIG_PECKS && currStat == STAT_DEF)) { - if (gBattleMons[gActiveBattler].statStages[currStat] > MIN_STAT_STAGE) + if (gBattleMons[battler].statStages[currStat] > MIN_STAT_STAGE) { statAnimId = startingStatAnimId + currStat; changeableStatsCount++; @@ -5403,13 +5144,13 @@ static void Cmd_playstatchangeanimation(void) else // goes up { if (flags & STAT_CHANGE_BY_TWO) - startingStatAnimId = STAT_ANIM_PLUS2 - 1; + startingStatAnimId = STAT_ANIM_PLUS2; else - startingStatAnimId = STAT_ANIM_PLUS1 - 1; + startingStatAnimId = STAT_ANIM_PLUS1; while (stats != 0) { - if (stats & 1 && gBattleMons[gActiveBattler].statStages[currStat] < MAX_STAT_STAGE) + if (stats & 1 && gBattleMons[battler].statStages[currStat] < MAX_STAT_STAGE) { statAnimId = startingStatAnimId + currStat; changeableStatsCount++; @@ -5432,8 +5173,8 @@ static void Cmd_playstatchangeanimation(void) } else if (changeableStatsCount != 0 && !gBattleScripting.statAnimPlayed) { - BtlController_EmitBattleAnimation(BUFFER_A, B_ANIM_STATS_CHANGE, statAnimId); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitBattleAnimation(battler, BUFFER_A, B_ANIM_STATS_CHANGE, statAnimId); + MarkBattlerForControllerExec(battler); if (flags & STAT_CHANGE_MULTIPLE_STATS && changeableStatsCount > 1) gBattleScripting.statAnimPlayed = TRUE; gBattlescriptCurrInstr = cmd->nextInstr; @@ -5597,9 +5338,8 @@ static void Cmd_moveend(void) { gProtectStructs[gBattlerAttacker].touchedProtectLike = FALSE; gBattleMons[gBattlerAttacker].status1 = STATUS1_BURN; - gActiveBattler = gBattlerAttacker; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gActiveBattler].status1), &gBattleMons[gActiveBattler].status1); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerAttacker].status1), &gBattleMons[gBattlerAttacker].status1); + MarkBattlerForControllerExec(gBattlerAttacker); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_BeakBlastBurn; effect = 1; @@ -5636,9 +5376,8 @@ static void Cmd_moveend(void) && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) { gBattleMons[gBattlerTarget].status1 &= ~STATUS1_FREEZE; - gActiveBattler = gBattlerTarget; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].status1), &gBattleMons[gBattlerTarget].status1); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(gBattlerTarget, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].status1), &gBattleMons[gBattlerTarget].status1); + MarkBattlerForControllerExec(gBattlerTarget); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_DefrostedViaFireMove; effect = TRUE; @@ -5646,13 +5385,12 @@ static void Cmd_moveend(void) if (gBattleMons[gBattlerTarget].status1 & STATUS1_FROSTBITE && gBattleMons[gBattlerTarget].hp != 0 && gBattlerAttacker != gBattlerTarget - && gBattleMoves[originallyUsedMove].flags & FLAG_THAW_USER + && gBattleMoves[originallyUsedMove].thawsUser && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) { gBattleMons[gBattlerTarget].status1 &= ~STATUS1_FROSTBITE; - gActiveBattler = gBattlerTarget; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].status1), &gBattleMons[gBattlerTarget].status1); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(gBattlerTarget, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].status1), &gBattleMons[gBattlerTarget].status1); + MarkBattlerForControllerExec(gBattlerTarget); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_FrostbiteHealedViaFireMove; effect = TRUE; @@ -5792,9 +5530,8 @@ static void Cmd_moveend(void) { gBattleMons[gBattlerTarget].status1 &= ~(gBattleMoves[gCurrentMove].argument); - gActiveBattler = gBattlerTarget; - BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(gBattlerTarget, 0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gBattlerTarget].status1); + MarkBattlerForControllerExec(gBattlerTarget); effect = TRUE; BattleScriptPush(gBattlescriptCurrInstr); switch (gBattleMoves[gCurrentMove].argument) @@ -5832,9 +5569,8 @@ static void Cmd_moveend(void) if (gStatuses3[gBattlerAttacker] & (STATUS3_SEMI_INVULNERABLE) && gHitMarker & HITMARKER_NO_ANIMATIONS) { - gActiveBattler = gBattlerAttacker; - BtlController_EmitSpriteInvisibility(BUFFER_A, TRUE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSpriteInvisibility(gBattlerAttacker, BUFFER_A, TRUE); + MarkBattlerForControllerExec(gBattlerAttacker); gBattleScripting.moveendState++; return; } @@ -5845,9 +5581,8 @@ static void Cmd_moveend(void) || !(gStatuses3[gBattlerAttacker] & (STATUS3_SEMI_INVULNERABLE)) || WasUnableToUseMove(gBattlerAttacker)) { - gActiveBattler = gBattlerAttacker; - BtlController_EmitSpriteInvisibility(BUFFER_A, FALSE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSpriteInvisibility(gBattlerAttacker, BUFFER_A, FALSE); + MarkBattlerForControllerExec(gBattlerAttacker); gStatuses3[gBattlerAttacker] &= ~STATUS3_SEMI_INVULNERABLE; gSpecialStatuses[gBattlerAttacker].restoredBattlerSprite = TRUE; gBattleScripting.moveendState++; @@ -5859,9 +5594,8 @@ static void Cmd_moveend(void) if (!gSpecialStatuses[gBattlerTarget].restoredBattlerSprite && gBattlerTarget < gBattlersCount && !(gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE)) { - gActiveBattler = gBattlerTarget; - BtlController_EmitSpriteInvisibility(BUFFER_A, FALSE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSpriteInvisibility(gBattlerTarget, BUFFER_A, FALSE); + MarkBattlerForControllerExec(gBattlerTarget); gStatuses3[gBattlerTarget] &= ~STATUS3_SEMI_INVULNERABLE; gBattleScripting.moveendState++; return; @@ -5927,9 +5661,8 @@ static void Cmd_moveend(void) if (gHitMarker & HITMARKER_SWAP_ATTACKER_TARGET) { - gActiveBattler = gBattlerAttacker; - gBattlerAttacker = gBattlerTarget; - gBattlerTarget = gActiveBattler; + u8 temp; + SWAP(gBattlerAttacker, gBattlerTarget, temp); gHitMarker &= ~HITMARKER_SWAP_ATTACKER_TARGET; } if (!gSpecialStatuses[gBattlerAttacker].dancerUsedMove) @@ -5952,6 +5685,7 @@ static void Cmd_moveend(void) if (!gSpecialStatuses[gBattlerAttacker].dancerUsedMove) { gLastMoves[gBattlerAttacker] = gChosenMove; + RecordKnownMove(gBattlerAttacker, gChosenMove); gLastResultingMoves[gBattlerAttacker] = gCurrentMove; } } @@ -5986,7 +5720,7 @@ static void Cmd_moveend(void) case MOVEEND_MIRROR_MOVE: // mirror move if (!(gAbsentBattlerFlags & gBitTable[gBattlerAttacker]) && !(gBattleStruct->absentBattlerFlags & gBitTable[gBattlerAttacker]) - && gBattleMoves[originallyUsedMove].flags & FLAG_MIRROR_MOVE_AFFECTED + && !gBattleMoves[originallyUsedMove].mirrorMoveBanned && gHitMarker & HITMARKER_OBEYS && gBattlerAttacker != gBattlerTarget && !(gHitMarker & HITMARKER_FAINTED(gBattlerTarget)) @@ -6160,7 +5894,7 @@ static void Cmd_moveend(void) && (gSpecialStatuses[battler].physicalDmg != 0 || gSpecialStatuses[battler].specialDmg != 0) && CountUsablePartyMons(battler) > 0) // Has mon to switch into { - gActiveBattler = gBattleScripting.battler = battler; + gBattleScripting.battler = battler; gLastUsedItem = gBattleMons[battler].item; if (gBattleMoves[gCurrentMove].effect == EFFECT_HIT_ESCAPE) gBattlescriptCurrInstr = BattleScript_MoveEnd; // Prevent user switch-in selection @@ -6196,7 +5930,7 @@ static void Cmd_moveend(void) && CanBattlerSwitch(gBattlerAttacker)) { gLastUsedItem = gBattleMons[battler].item; - gActiveBattler = gBattleStruct->savedBattlerTarget = gBattleScripting.battler = battler; // Battler with red card + gBattleStruct->savedBattlerTarget = gBattleScripting.battler = battler; // Battler with red card gEffectBattler = gBattlerAttacker; if (gBattleMoves[gCurrentMove].effect == EFFECT_HIT_ESCAPE) gBattlescriptCurrInstr = BattleScript_MoveEnd; // Prevent user switch-in selection @@ -6224,7 +5958,7 @@ static void Cmd_moveend(void) && CountUsablePartyMons(battler) > 0) // Has mon to switch into { gProtectStructs[battler].statFell = FALSE; - gActiveBattler = gBattleScripting.battler = battler; + gBattleScripting.battler = battler; gLastUsedItem = gBattleMons[battler].item; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_EjectPackActivates; @@ -6278,7 +6012,7 @@ static void Cmd_moveend(void) gBattleScripting.moveendState++; break; case MOVEEND_DANCER: // Special case because it's so annoying - if (gBattleMoves[gCurrentMove].flags & FLAG_DANCE) + if (gBattleMoves[gCurrentMove].danceMove) { u8 battler, nextDancer = 0; @@ -6423,11 +6157,10 @@ static void Cmd_returnatktoball(void) { CMD_ARGS(); - gActiveBattler = gBattlerAttacker; - if (!(gHitMarker & HITMARKER_FAINTED(gActiveBattler))) + if (!(gHitMarker & HITMARKER_FAINTED(gBattlerAttacker))) { - BtlController_EmitReturnMonToBall(BUFFER_A, FALSE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitReturnMonToBall(gBattlerAttacker, BUFFER_A, FALSE); + MarkBattlerForControllerExec(gBattlerAttacker); } gBattlescriptCurrInstr = cmd->nextInstr; } @@ -6436,15 +6169,14 @@ static void Cmd_getswitchedmondata(void) { CMD_ARGS(u8 battler); + u32 battler = GetBattlerForBattleScript(cmd->battler); if (gBattleControllerExecFlags) return; - gActiveBattler = GetBattlerForBattleScript(cmd->battler); + gBattlerPartyIndexes[battler] = gBattleStruct->monToSwitchIntoId[battler]; - gBattlerPartyIndexes[gActiveBattler] = *(gBattleStruct->monToSwitchIntoId + gActiveBattler); - - BtlController_EmitGetMonData(BUFFER_A, REQUEST_ALL_BATTLE, gBitTable[gBattlerPartyIndexes[gActiveBattler]]); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitGetMonData(battler, BUFFER_A, REQUEST_ALL_BATTLE, gBitTable[gBattlerPartyIndexes[battler]]); + MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -6454,78 +6186,80 @@ static void Cmd_switchindataupdate(void) CMD_ARGS(u8 battler); struct BattlePokemon oldData; - s32 i; + u32 battler, i; u8 *monData; if (gBattleControllerExecFlags) return; - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - oldData = gBattleMons[gActiveBattler]; - monData = (u8 *)(&gBattleMons[gActiveBattler]); + battler = GetBattlerForBattleScript(cmd->battler); + oldData = gBattleMons[battler]; + monData = (u8 *)(&gBattleMons[battler]); for (i = 0; i < sizeof(struct BattlePokemon); i++) - monData[i] = gBattleResources->bufferB[gActiveBattler][4 + i]; + monData[i] = gBattleResources->bufferB[battler][4 + i]; - gBattleMons[gActiveBattler].type1 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0]; - gBattleMons[gActiveBattler].type2 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1]; - gBattleMons[gActiveBattler].type3 = TYPE_MYSTERY; - gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].abilityNum); + gBattleMons[battler].type1 = gSpeciesInfo[gBattleMons[battler].species].types[0]; + gBattleMons[battler].type2 = gSpeciesInfo[gBattleMons[battler].species].types[1]; + gBattleMons[battler].type3 = TYPE_MYSTERY; + gBattleMons[battler].ability = GetAbilityBySpecies(gBattleMons[battler].species, gBattleMons[battler].abilityNum); // check knocked off item - i = GetBattlerSide(gActiveBattler); - if (gWishFutureKnock.knockedOffMons[i] & gBitTable[gBattlerPartyIndexes[gActiveBattler]]) + i = GetBattlerSide(battler); + if (gWishFutureKnock.knockedOffMons[i] & gBitTable[gBattlerPartyIndexes[battler]]) { - gBattleMons[gActiveBattler].item = ITEM_NONE; + gBattleMons[battler].item = ITEM_NONE; } if (gBattleMoves[gCurrentMove].effect == EFFECT_BATON_PASS) { for (i = 0; i < NUM_BATTLE_STATS; i++) { - gBattleMons[gActiveBattler].statStages[i] = oldData.statStages[i]; + gBattleMons[battler].statStages[i] = oldData.statStages[i]; } - gBattleMons[gActiveBattler].status2 = oldData.status2; + gBattleMons[battler].status2 = oldData.status2; } - SwitchInClearSetData(); + SwitchInClearSetData(battler); if (gBattleTypeFlags & BATTLE_TYPE_PALACE - && gBattleMons[gActiveBattler].maxHP / 2 >= gBattleMons[gActiveBattler].hp - && gBattleMons[gActiveBattler].hp != 0 - && !(gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP)) + && gBattleMons[battler].maxHP / 2 >= gBattleMons[battler].hp + && gBattleMons[battler].hp != 0 + && !(gBattleMons[battler].status1 & STATUS1_SLEEP)) { - gBattleStruct->palaceFlags |= gBitTable[gActiveBattler]; + gBattleStruct->palaceFlags |= gBitTable[battler]; } - gBattleScripting.battler = gActiveBattler; + gBattleScripting.battler = battler; - PREPARE_MON_NICK_BUFFER(gBattleTextBuff1, gActiveBattler, gBattlerPartyIndexes[gActiveBattler]); + PREPARE_MON_NICK_BUFFER(gBattleTextBuff1, battler, gBattlerPartyIndexes[battler]); gBattlescriptCurrInstr = cmd->nextInstr; } static void Cmd_switchinanim(void) { + u32 battler; + CMD_ARGS(u8 battler, bool8 dontClearSubstitute); if (gBattleControllerExecFlags) return; - gActiveBattler = GetBattlerForBattleScript(cmd->battler); + battler = GetBattlerForBattleScript(cmd->battler); - if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT + if (GetBattlerSide(battler) == B_SIDE_OPPONENT && !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_TRAINER_HILL | BATTLE_TYPE_FRONTIER))) - HandleSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gActiveBattler].species), FLAG_SET_SEEN, gBattleMons[gActiveBattler].personality); + HandleSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[battler].species), FLAG_SET_SEEN, gBattleMons[battler].personality); - gAbsentBattlerFlags &= ~(gBitTable[gActiveBattler]); + gAbsentBattlerFlags &= ~(gBitTable[battler]); - BtlController_EmitSwitchInAnim(BUFFER_A, gBattlerPartyIndexes[gActiveBattler], cmd->dontClearSubstitute); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSwitchInAnim(battler, BUFFER_A, gBattlerPartyIndexes[battler], cmd->dontClearSubstitute); + MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; @@ -6533,13 +6267,13 @@ static void Cmd_switchinanim(void) BattleArena_InitPoints(); } -bool32 CanBattlerSwitch(u32 battlerId) +bool32 CanBattlerSwitch(u32 battler) { s32 i, lastMonId, battlerIn1, battlerIn2; bool32 ret = FALSE; struct Pokemon *party; - if (BATTLE_TWO_VS_ONE_OPPONENT && GetBattlerSide(battlerId) == B_SIDE_OPPONENT) + if (BATTLE_TWO_VS_ONE_OPPONENT && GetBattlerSide(battler) == B_SIDE_OPPONENT) { battlerIn1 = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); battlerIn2 = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); @@ -6558,10 +6292,10 @@ bool32 CanBattlerSwitch(u32 battlerId) } else if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) { - party = GetBattlerParty(battlerId); + party = GetBattlerParty(battler); lastMonId = 0; - if (battlerId & 2) + if (battler & 2) lastMonId = MULTI_PARTY_SIZE; for (i = lastMonId; i < lastMonId + MULTI_PARTY_SIZE; i++) @@ -6569,7 +6303,7 @@ bool32 CanBattlerSwitch(u32 battlerId) if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE && !GetMonData(&party[i], MON_DATA_IS_EGG) && GetMonData(&party[i], MON_DATA_HP) != 0 - && gBattlerPartyIndexes[battlerId] != i) + && gBattlerPartyIndexes[battler] != i) break; } @@ -6579,19 +6313,19 @@ bool32 CanBattlerSwitch(u32 battlerId) { if (gBattleTypeFlags & BATTLE_TYPE_TOWER_LINK_MULTI) { - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) + if (GetBattlerSide(battler) == B_SIDE_PLAYER) { party = gPlayerParty; lastMonId = 0; - if (GetLinkTrainerFlankId(GetBattlerMultiplayerId(battlerId)) == TRUE) + if (GetLinkTrainerFlankId(GetBattlerMultiplayerId(battler)) == TRUE) lastMonId = MULTI_PARTY_SIZE; } else { party = gEnemyParty; - if (battlerId == 1) + if (battler == 1) lastMonId = 0; else lastMonId = MULTI_PARTY_SIZE; @@ -6599,10 +6333,10 @@ bool32 CanBattlerSwitch(u32 battlerId) } else { - party = GetBattlerParty(battlerId); + party = GetBattlerParty(battler); lastMonId = 0; - if (GetLinkTrainerFlankId(GetBattlerMultiplayerId(battlerId)) == TRUE) + if (GetLinkTrainerFlankId(GetBattlerMultiplayerId(battler)) == TRUE) lastMonId = MULTI_PARTY_SIZE; } @@ -6611,18 +6345,18 @@ bool32 CanBattlerSwitch(u32 battlerId) if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE && !GetMonData(&party[i], MON_DATA_IS_EGG) && GetMonData(&party[i], MON_DATA_HP) != 0 - && gBattlerPartyIndexes[battlerId] != i) + && gBattlerPartyIndexes[battler] != i) break; } ret = (i != lastMonId + MULTI_PARTY_SIZE); } - else if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS && GetBattlerSide(battlerId) == B_SIDE_OPPONENT) + else if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS && GetBattlerSide(battler) == B_SIDE_OPPONENT) { party = gEnemyParty; lastMonId = 0; - if (battlerId == B_POSITION_OPPONENT_RIGHT) + if (battler == B_POSITION_OPPONENT_RIGHT) lastMonId = PARTY_SIZE / 2; for (i = lastMonId; i < lastMonId + (PARTY_SIZE / 2); i++) @@ -6630,7 +6364,7 @@ bool32 CanBattlerSwitch(u32 battlerId) if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE && !GetMonData(&party[i], MON_DATA_IS_EGG) && GetMonData(&party[i], MON_DATA_HP) != 0 - && gBattlerPartyIndexes[battlerId] != i) + && gBattlerPartyIndexes[battler] != i) break; } @@ -6638,7 +6372,7 @@ bool32 CanBattlerSwitch(u32 battlerId) } else { - if (GetBattlerSide(battlerId) == B_SIDE_OPPONENT) + if (GetBattlerSide(battler) == B_SIDE_OPPONENT) { battlerIn1 = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); @@ -6680,15 +6414,14 @@ static void Cmd_jumpifcantswitch(void) { CMD_ARGS(u8 battler:7, u8 ignoreEscapePrevention:1, const u8 *jumpInstr); - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - - if (!cmd->ignoreEscapePrevention && !CanBattlerEscape(gActiveBattler)) + u32 battler = GetBattlerForBattleScript(cmd->battler); + if (!cmd->ignoreEscapePrevention && !CanBattlerEscape(battler)) { gBattlescriptCurrInstr = cmd->jumpInstr; } else { - if (CanBattlerSwitch(gActiveBattler)) + if (CanBattlerSwitch(battler)) gBattlescriptCurrInstr = cmd->nextInstr; else gBattlescriptCurrInstr = cmd->jumpInstr; @@ -6698,54 +6431,50 @@ static void Cmd_jumpifcantswitch(void) // Opens the party screen to choose a new Pokémon to send out. // slotId is the Pokémon to replace. // Note that this is not used by the Switch action, only replacing fainted Pokémon or Baton Pass -static void ChooseMonToSendOut(u8 slotId) +static void ChooseMonToSendOut(u32 battler, u8 slotId) { - *(gBattleStruct->battlerPartyIndexes + gActiveBattler) = gBattlerPartyIndexes[gActiveBattler]; - *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = PARTY_SIZE; - gBattleStruct->field_93 &= ~(gBitTable[gActiveBattler]); + gBattleStruct->battlerPartyIndexes[battler] = gBattlerPartyIndexes[battler]; + gBattleStruct->monToSwitchIntoId[battler] = PARTY_SIZE; + gBattleStruct->field_93 &= ~(gBitTable[battler]); - BtlController_EmitChoosePokemon(BUFFER_A, PARTY_ACTION_SEND_OUT, slotId, ABILITY_NONE, gBattleStruct->battlerPartyOrders[gActiveBattler]); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitChoosePokemon(battler, BUFFER_A, PARTY_ACTION_SEND_OUT, slotId, ABILITY_NONE, gBattleStruct->battlerPartyOrders[battler]); + MarkBattlerForControllerExec(battler); } static void Cmd_openpartyscreen(void) { CMD_ARGS(u8 battler:7, u8 partyScreenOptional:1, const u8 *failInstr); - u32 flags; - u8 hitmarkerFaintBits; - u8 battlerId; - const u8 *failInstr; - - battlerId = 0; - flags = 0; - failInstr = cmd->failInstr; + u32 flags = 0; + u8 hitmarkerFaintBits = 0; + u32 i, battler = 0; + const u8 *failInstr = cmd->failInstr; if (cmd->battler == BS_FAINTED_LINK_MULTIPLE_1) { if ((gBattleTypeFlags & BATTLE_TYPE_MULTI) || !(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) { - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) + for (battler = 0; battler < gBattlersCount; battler++) { - if (gHitMarker & HITMARKER_FAINTED(gActiveBattler)) + if (gHitMarker & HITMARKER_FAINTED(battler)) { - if (HasNoMonsToSwitch(gActiveBattler, PARTY_SIZE, PARTY_SIZE)) + if (HasNoMonsToSwitch(battler, PARTY_SIZE, PARTY_SIZE)) { - gAbsentBattlerFlags |= gBitTable[gActiveBattler]; - gHitMarker &= ~HITMARKER_FAINTED(gActiveBattler); - BtlController_EmitLinkStandbyMsg(BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); - MarkBattlerForControllerExec(gActiveBattler); + gAbsentBattlerFlags |= gBitTable[battler]; + gHitMarker &= ~HITMARKER_FAINTED(battler); + BtlController_EmitLinkStandbyMsg(battler, BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); + MarkBattlerForControllerExec(battler); } - else if (!gSpecialStatuses[gActiveBattler].faintedHasReplacement) + else if (!gSpecialStatuses[battler].faintedHasReplacement) { - ChooseMonToSendOut(PARTY_SIZE); - gSpecialStatuses[gActiveBattler].faintedHasReplacement = TRUE; + ChooseMonToSendOut(battler, PARTY_SIZE); + gSpecialStatuses[battler].faintedHasReplacement = TRUE; } } else { - BtlController_EmitLinkStandbyMsg(BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitLinkStandbyMsg(battler, BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); + MarkBattlerForControllerExec(battler); } } } @@ -6757,88 +6486,88 @@ static void Cmd_openpartyscreen(void) if (gBitTable[0] & hitmarkerFaintBits) { - gActiveBattler = 0; - if (HasNoMonsToSwitch(gActiveBattler, PARTY_SIZE, PARTY_SIZE)) + battler = 0; + if (HasNoMonsToSwitch(battler, PARTY_SIZE, PARTY_SIZE)) { - gAbsentBattlerFlags |= gBitTable[gActiveBattler]; - gHitMarker &= ~HITMARKER_FAINTED(gActiveBattler); - BtlController_EmitCantSwitch(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + gAbsentBattlerFlags |= gBitTable[battler]; + gHitMarker &= ~HITMARKER_FAINTED(battler); + BtlController_EmitCantSwitch(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); } - else if (!gSpecialStatuses[gActiveBattler].faintedHasReplacement) + else if (!gSpecialStatuses[battler].faintedHasReplacement) { - ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[2]); - gSpecialStatuses[gActiveBattler].faintedHasReplacement = TRUE; + ChooseMonToSendOut(battler, gBattleStruct->monToSwitchIntoId[2]); + gSpecialStatuses[battler].faintedHasReplacement = TRUE; } else { - BtlController_EmitLinkStandbyMsg(BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitLinkStandbyMsg(battler, BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); + MarkBattlerForControllerExec(battler); flags |= 1; } } if (gBitTable[2] & hitmarkerFaintBits && !(gBitTable[0] & hitmarkerFaintBits)) { - gActiveBattler = 2; - if (HasNoMonsToSwitch(gActiveBattler, PARTY_SIZE, PARTY_SIZE)) + battler = 2; + if (HasNoMonsToSwitch(battler, PARTY_SIZE, PARTY_SIZE)) { - gAbsentBattlerFlags |= gBitTable[gActiveBattler]; - gHitMarker &= ~HITMARKER_FAINTED(gActiveBattler); - BtlController_EmitCantSwitch(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + gAbsentBattlerFlags |= gBitTable[battler]; + gHitMarker &= ~HITMARKER_FAINTED(battler); + BtlController_EmitCantSwitch(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); } - else if (!gSpecialStatuses[gActiveBattler].faintedHasReplacement) + else if (!gSpecialStatuses[battler].faintedHasReplacement) { - ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[0]); - gSpecialStatuses[gActiveBattler].faintedHasReplacement = TRUE; + ChooseMonToSendOut(battler, gBattleStruct->monToSwitchIntoId[0]); + gSpecialStatuses[battler].faintedHasReplacement = TRUE; } else if (!(flags & 1)) { - BtlController_EmitLinkStandbyMsg(BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitLinkStandbyMsg(battler, BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); + MarkBattlerForControllerExec(battler); } } if (gBitTable[1] & hitmarkerFaintBits) { - gActiveBattler = 1; - if (HasNoMonsToSwitch(gActiveBattler, PARTY_SIZE, PARTY_SIZE)) + battler = 1; + if (HasNoMonsToSwitch(battler, PARTY_SIZE, PARTY_SIZE)) { - gAbsentBattlerFlags |= gBitTable[gActiveBattler]; - gHitMarker &= ~HITMARKER_FAINTED(gActiveBattler); - BtlController_EmitCantSwitch(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + gAbsentBattlerFlags |= gBitTable[battler]; + gHitMarker &= ~HITMARKER_FAINTED(battler); + BtlController_EmitCantSwitch(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); } - else if (!gSpecialStatuses[gActiveBattler].faintedHasReplacement) + else if (!gSpecialStatuses[battler].faintedHasReplacement) { - ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[3]); - gSpecialStatuses[gActiveBattler].faintedHasReplacement = TRUE; + ChooseMonToSendOut(battler, gBattleStruct->monToSwitchIntoId[3]); + gSpecialStatuses[battler].faintedHasReplacement = TRUE; } else { - BtlController_EmitLinkStandbyMsg(BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitLinkStandbyMsg(battler, BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); + MarkBattlerForControllerExec(battler); flags |= 2; } } if (gBitTable[3] & hitmarkerFaintBits && !(gBitTable[1] & hitmarkerFaintBits)) { - gActiveBattler = 3; - if (HasNoMonsToSwitch(gActiveBattler, PARTY_SIZE, PARTY_SIZE)) + battler = 3; + if (HasNoMonsToSwitch(battler, PARTY_SIZE, PARTY_SIZE)) { - gAbsentBattlerFlags |= gBitTable[gActiveBattler]; - gHitMarker &= ~HITMARKER_FAINTED(gActiveBattler); - BtlController_EmitCantSwitch(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + gAbsentBattlerFlags |= gBitTable[battler]; + gHitMarker &= ~HITMARKER_FAINTED(battler); + BtlController_EmitCantSwitch(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); } - else if (!gSpecialStatuses[gActiveBattler].faintedHasReplacement) + else if (!gSpecialStatuses[battler].faintedHasReplacement) { - ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[1]); - gSpecialStatuses[gActiveBattler].faintedHasReplacement = TRUE; + ChooseMonToSendOut(battler, gBattleStruct->monToSwitchIntoId[1]); + gSpecialStatuses[battler].faintedHasReplacement = TRUE; } else if (!(flags & 2)) { - BtlController_EmitLinkStandbyMsg(BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitLinkStandbyMsg(battler, BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); + MarkBattlerForControllerExec(battler); } } @@ -6849,12 +6578,12 @@ static void Cmd_openpartyscreen(void) if (!hasReplacement_2 && hitmarkerFaintBits != 0) { if (gAbsentBattlerFlags & gBitTable[0]) - gActiveBattler = 2; + battler = 2; else - gActiveBattler = 0; + battler = 0; - BtlController_EmitLinkStandbyMsg(BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitLinkStandbyMsg(battler, BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); + MarkBattlerForControllerExec(battler); } } @@ -6865,12 +6594,12 @@ static void Cmd_openpartyscreen(void) if (!hasReplacement_3 && hitmarkerFaintBits != 0) { if (gAbsentBattlerFlags & gBitTable[1]) - gActiveBattler = 3; + battler = 3; else - gActiveBattler = 1; + battler = 1; - BtlController_EmitLinkStandbyMsg(BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitLinkStandbyMsg(battler, BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); + MarkBattlerForControllerExec(battler); } } } @@ -6885,34 +6614,34 @@ static void Cmd_openpartyscreen(void) hitmarkerFaintBits = gHitMarker >> 28; if (gBitTable[2] & hitmarkerFaintBits && gBitTable[0] & hitmarkerFaintBits) { - gActiveBattler = 2; - if (HasNoMonsToSwitch(gActiveBattler, gBattleResources->bufferB[0][1], PARTY_SIZE)) + battler = 2; + if (HasNoMonsToSwitch(battler, gBattleResources->bufferB[0][1], PARTY_SIZE)) { - gAbsentBattlerFlags |= gBitTable[gActiveBattler]; - gHitMarker &= ~HITMARKER_FAINTED(gActiveBattler); - BtlController_EmitCantSwitch(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + gAbsentBattlerFlags |= gBitTable[battler]; + gHitMarker &= ~HITMARKER_FAINTED(battler); + BtlController_EmitCantSwitch(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); } - else if (!gSpecialStatuses[gActiveBattler].faintedHasReplacement) + else if (!gSpecialStatuses[battler].faintedHasReplacement) { - ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[0]); - gSpecialStatuses[gActiveBattler].faintedHasReplacement = TRUE; + ChooseMonToSendOut(battler, gBattleStruct->monToSwitchIntoId[0]); + gSpecialStatuses[battler].faintedHasReplacement = TRUE; } } if (gBitTable[3] & hitmarkerFaintBits && hitmarkerFaintBits & gBitTable[1]) { - gActiveBattler = 3; - if (HasNoMonsToSwitch(gActiveBattler, gBattleResources->bufferB[1][1], PARTY_SIZE)) + battler = 3; + if (HasNoMonsToSwitch(battler, gBattleResources->bufferB[1][1], PARTY_SIZE)) { - gAbsentBattlerFlags |= gBitTable[gActiveBattler]; - gHitMarker &= ~HITMARKER_FAINTED(gActiveBattler); - BtlController_EmitCantSwitch(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + gAbsentBattlerFlags |= gBitTable[battler]; + gHitMarker &= ~HITMARKER_FAINTED(battler); + BtlController_EmitCantSwitch(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); } - else if (!gSpecialStatuses[gActiveBattler].faintedHasReplacement) + else if (!gSpecialStatuses[battler].faintedHasReplacement) { - ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[1]); - gSpecialStatuses[gActiveBattler].faintedHasReplacement = TRUE; + ChooseMonToSendOut(battler, gBattleStruct->monToSwitchIntoId[1]); + gSpecialStatuses[battler].faintedHasReplacement = TRUE; } } gBattlescriptCurrInstr = cmd->nextInstr; @@ -6946,52 +6675,50 @@ static void Cmd_openpartyscreen(void) else hitmarkerFaintBits = PARTY_ACTION_SEND_OUT; - battlerId = GetBattlerForBattleScript(cmd->battler); - if (gSpecialStatuses[battlerId].faintedHasReplacement) + battler = GetBattlerForBattleScript(cmd->battler); + if (gSpecialStatuses[battler].faintedHasReplacement) { gBattlescriptCurrInstr = cmd->nextInstr; } - else if (HasNoMonsToSwitch(battlerId, PARTY_SIZE, PARTY_SIZE)) + else if (HasNoMonsToSwitch(battler, PARTY_SIZE, PARTY_SIZE)) { - gActiveBattler = battlerId; - gAbsentBattlerFlags |= gBitTable[gActiveBattler]; - gHitMarker &= ~HITMARKER_FAINTED(gActiveBattler); + gAbsentBattlerFlags |= gBitTable[battler]; + gHitMarker &= ~HITMARKER_FAINTED(battler); gBattlescriptCurrInstr = failInstr; } else { - gActiveBattler = battlerId; - *(gBattleStruct->battlerPartyIndexes + gActiveBattler) = gBattlerPartyIndexes[gActiveBattler]; - *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = PARTY_SIZE; - gBattleStruct->field_93 &= ~(gBitTable[gActiveBattler]); + *(gBattleStruct->battlerPartyIndexes + battler) = gBattlerPartyIndexes[battler]; + *(gBattleStruct->monToSwitchIntoId + battler) = PARTY_SIZE; + gBattleStruct->field_93 &= ~(gBitTable[battler]); - BtlController_EmitChoosePokemon(BUFFER_A, hitmarkerFaintBits, *(gBattleStruct->monToSwitchIntoId + BATTLE_PARTNER(gActiveBattler)), ABILITY_NONE, gBattleStruct->battlerPartyOrders[gActiveBattler]); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitChoosePokemon(battler, BUFFER_A, hitmarkerFaintBits, *(gBattleStruct->monToSwitchIntoId + BATTLE_PARTNER(battler)), ABILITY_NONE, gBattleStruct->battlerPartyOrders[battler]); + MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; - if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_LEFT && gBattleResults.playerSwitchesCounter < 255) + if (GetBattlerPosition(battler) == B_POSITION_PLAYER_LEFT && gBattleResults.playerSwitchesCounter < 255) gBattleResults.playerSwitchesCounter++; if (gBattleTypeFlags & BATTLE_TYPE_MULTI) { - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) + for (i = 0; i < gBattlersCount; i++) { - if (gActiveBattler != battlerId) + if (i != battler) { - BtlController_EmitLinkStandbyMsg(BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitLinkStandbyMsg(i, BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); + MarkBattlerForControllerExec(i); } } } else { - gActiveBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(battlerId))); - if (gAbsentBattlerFlags & gBitTable[gActiveBattler]) - gActiveBattler ^= BIT_FLANK; + u32 battlerOpposite = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(battler))); + if (gAbsentBattlerFlags & gBitTable[battlerOpposite]) + battlerOpposite ^= BIT_FLANK; - BtlController_EmitLinkStandbyMsg(BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitLinkStandbyMsg(battlerOpposite, BUFFER_A, LINK_STANDBY_MSG_ONLY, FALSE); + MarkBattlerForControllerExec(battlerOpposite); } } } @@ -7001,11 +6728,11 @@ static void Cmd_switchhandleorder(void) { CMD_ARGS(u8 battler, u8 state); - s32 i; + u32 battler, i; if (gBattleControllerExecFlags) return; - gActiveBattler = GetBattlerForBattleScript(cmd->battler); + battler = GetBattlerForBattleScript(cmd->battler); switch (cmd->state) { @@ -7025,51 +6752,51 @@ static void Cmd_switchhandleorder(void) break; case 1: if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI)) - SwitchPartyOrder(gActiveBattler); + SwitchPartyOrder(battler); break; case 2: - if (!(gBattleStruct->field_93 & gBitTable[gActiveBattler])) + if (!(gBattleStruct->field_93 & gBitTable[battler])) { - RecordedBattle_SetBattlerAction(gActiveBattler, gBattleResources->bufferB[gActiveBattler][1]); - gBattleStruct->field_93 |= gBitTable[gActiveBattler]; + RecordedBattle_SetBattlerAction(battler, gBattleResources->bufferB[battler][1]); + gBattleStruct->field_93 |= gBitTable[battler]; } // fall through case 3: - gBattleCommunication[0] = gBattleResources->bufferB[gActiveBattler][1]; - *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = gBattleResources->bufferB[gActiveBattler][1]; + gBattleCommunication[0] = gBattleResources->bufferB[battler][1]; + *(gBattleStruct->monToSwitchIntoId + battler) = gBattleResources->bufferB[battler][1]; if (gBattleTypeFlags & BATTLE_TYPE_LINK && gBattleTypeFlags & BATTLE_TYPE_MULTI) { - *(gActiveBattler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) &= 0xF; - *(gActiveBattler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleResources->bufferB[gActiveBattler][2] & 0xF0); - *(gActiveBattler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 1) = gBattleResources->bufferB[gActiveBattler][3]; + *(battler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) &= 0xF; + *(battler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleResources->bufferB[battler][2] & 0xF0); + *(battler * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 1) = gBattleResources->bufferB[battler][3]; - *((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) &= (0xF0); - *((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleResources->bufferB[gActiveBattler][2] & 0xF0) >> 4; - *((BATTLE_PARTNER(gActiveBattler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 2) = gBattleResources->bufferB[gActiveBattler][3]; + *((BATTLE_PARTNER(battler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) &= (0xF0); + *((BATTLE_PARTNER(battler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleResources->bufferB[battler][2] & 0xF0) >> 4; + *((BATTLE_PARTNER(battler)) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 2) = gBattleResources->bufferB[battler][3]; } else if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) { - SwitchPartyOrderInGameMulti(gActiveBattler, *(gBattleStruct->monToSwitchIntoId + gActiveBattler)); + SwitchPartyOrderInGameMulti(battler, *(gBattleStruct->monToSwitchIntoId + battler)); } else { - SwitchPartyOrder(gActiveBattler); + SwitchPartyOrder(battler); } PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerAttacker].species) - PREPARE_MON_NICK_BUFFER(gBattleTextBuff2, gActiveBattler, gBattleResources->bufferB[gActiveBattler][1]) + PREPARE_MON_NICK_BUFFER(gBattleTextBuff2, battler, gBattleResources->bufferB[battler][1]) break; } gBattlescriptCurrInstr = cmd->nextInstr; } -static void SetDmgHazardsBattlescript(u8 battlerId, u8 multistringId) +static void SetDmgHazardsBattlescript(u8 battler, u8 multistringId) { - gBattleMons[battlerId].status2 &= ~STATUS2_DESTINY_BOND; + gBattleMons[battler].status2 &= ~STATUS2_DESTINY_BOND; gHitMarker &= ~HITMARKER_DESTINYBOND; - gBattleScripting.battler = battlerId; + gBattleScripting.battler = battler; gBattleCommunication[MULTISTRING_CHOOSER] = multistringId; BattleScriptPushCursor(); @@ -7081,20 +6808,20 @@ static void SetDmgHazardsBattlescript(u8 battlerId, u8 multistringId) gBattlescriptCurrInstr = BattleScript_DmgHazardsOnFaintedBattler; } -bool32 DoSwitchInAbilitiesItems(u32 battlerId) +bool32 DoSwitchInAbilitiesItems(u32 battler) { - return (TryPrimalReversion(battlerId) - || AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, battlerId, 0, 0, 0) - || (gBattleWeather & B_WEATHER_ANY && WEATHER_HAS_EFFECT && AbilityBattleEffects(ABILITYEFFECT_ON_WEATHER, battlerId, 0, 0, 0)) - || (gFieldStatuses & STATUS_FIELD_TERRAIN_ANY && AbilityBattleEffects(ABILITYEFFECT_ON_TERRAIN, battlerId, 0, 0, 0)) - || ItemBattleEffects(ITEMEFFECT_ON_SWITCH_IN, battlerId, FALSE) + return (TryPrimalReversion(battler) + || AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, battler, 0, 0, 0) + || (gBattleWeather & B_WEATHER_ANY && WEATHER_HAS_EFFECT && AbilityBattleEffects(ABILITYEFFECT_ON_WEATHER, battler, 0, 0, 0)) + || (gFieldStatuses & STATUS_FIELD_TERRAIN_ANY && AbilityBattleEffects(ABILITYEFFECT_ON_TERRAIN, battler, 0, 0, 0)) + || ItemBattleEffects(ITEMEFFECT_ON_SWITCH_IN, battler, FALSE) || AbilityBattleEffects(ABILITYEFFECT_TRACE2, 0, 0, 0, 0)); } -bool32 ShouldPostponeSwitchInAbilities(u32 battlerId) +bool32 ShouldPostponeSwitchInAbilities(u32 battler) { - bool32 aliveOpposing1 = IsBattlerAlive(BATTLE_OPPOSITE(battlerId)); - bool32 aliveOpposing2 = IsBattlerAlive(BATTLE_PARTNER(BATTLE_OPPOSITE(battlerId))); + bool32 aliveOpposing1 = IsBattlerAlive(BATTLE_OPPOSITE(battler)); + bool32 aliveOpposing2 = IsBattlerAlive(BATTLE_PARTNER(BATTLE_OPPOSITE(battler))); // No pokemon on opposing side - postpone. if (!aliveOpposing1 && !aliveOpposing2) return TRUE; @@ -7102,9 +6829,9 @@ bool32 ShouldPostponeSwitchInAbilities(u32 battlerId) // Checks for double battle, so abilities like Intimidate wait until all battlers are switched-in before activating. if (IsDoubleBattle()) { - if (aliveOpposing1 && !aliveOpposing2 && !HasNoMonsToSwitch(BATTLE_PARTNER(BATTLE_OPPOSITE(battlerId)), PARTY_SIZE, PARTY_SIZE)) + if (aliveOpposing1 && !aliveOpposing2 && !HasNoMonsToSwitch(BATTLE_PARTNER(BATTLE_OPPOSITE(battler)), PARTY_SIZE, PARTY_SIZE)) return TRUE; - if (!aliveOpposing1 && aliveOpposing2 && !HasNoMonsToSwitch(BATTLE_OPPOSITE(battlerId), PARTY_SIZE, PARTY_SIZE)) + if (!aliveOpposing1 && aliveOpposing2 && !HasNoMonsToSwitch(BATTLE_OPPOSITE(battler), PARTY_SIZE, PARTY_SIZE)) return TRUE; } @@ -7116,119 +6843,119 @@ static void Cmd_switchineffects(void) CMD_ARGS(u8 battler); s32 i; + u32 battler = GetBattlerForBattleScript(cmd->battler); - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - UpdateSentPokesToOpponentValue(gActiveBattler); + UpdateSentPokesToOpponentValue(battler); - gHitMarker &= ~HITMARKER_FAINTED(gActiveBattler); - gSpecialStatuses[gActiveBattler].faintedHasReplacement = FALSE; + gHitMarker &= ~HITMARKER_FAINTED(battler); + gSpecialStatuses[battler].faintedHasReplacement = FALSE; - if (!BattlerHasAi(gActiveBattler)) - gBattleStruct->appearedInBattle |= gBitTable[gBattlerPartyIndexes[gActiveBattler]]; + if (!BattlerHasAi(battler)) + gBattleStruct->appearedInBattle |= gBitTable[gBattlerPartyIndexes[battler]]; // Neutralizing Gas announces itself before hazards - if (gBattleMons[gActiveBattler].ability == ABILITY_NEUTRALIZING_GAS && gSpecialStatuses[gActiveBattler].announceNeutralizingGas == 0) + if (gBattleMons[battler].ability == ABILITY_NEUTRALIZING_GAS && gSpecialStatuses[battler].announceNeutralizingGas == 0) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_NEUTRALIZING_GAS; - gSpecialStatuses[gActiveBattler].announceNeutralizingGas = TRUE; - gBattlerAbility = gActiveBattler; + gSpecialStatuses[battler].announceNeutralizingGas = TRUE; + gBattlerAbility = battler; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SwitchInAbilityMsgRet; } // Healing Wish activates before hazards. // Starting from Gen8 - it heals only pokemon which can be healed. In gens 5,6,7 the effect activates anyways. - else if (((gBattleStruct->storedHealingWish & gBitTable[gActiveBattler]) || (gBattleStruct->storedLunarDance & gBitTable[gActiveBattler])) - && (gBattleMons[gActiveBattler].hp != gBattleMons[gActiveBattler].maxHP || gBattleMons[gActiveBattler].status1 != 0 || B_HEALING_WISH_SWITCH < GEN_8)) + else if (((gBattleStruct->storedHealingWish & gBitTable[battler]) || (gBattleStruct->storedLunarDance & gBitTable[battler])) + && (gBattleMons[battler].hp != gBattleMons[battler].maxHP || gBattleMons[battler].status1 != 0 || B_HEALING_WISH_SWITCH < GEN_8)) { - if (gBattleStruct->storedHealingWish & gBitTable[gActiveBattler]) + if (gBattleStruct->storedHealingWish & gBitTable[battler]) { BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_HealingWishActivates; - gBattleStruct->storedHealingWish &= ~(gBitTable[gActiveBattler]); + gBattleStruct->storedHealingWish &= ~(gBitTable[battler]); } else // Lunar Dance { BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_LunarDanceActivates; - gBattleStruct->storedLunarDance &= ~(gBitTable[gActiveBattler]); + gBattleStruct->storedLunarDance &= ~(gBitTable[battler]); } } - else if (!(gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_SPIKES_DAMAGED) - && (gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_SPIKES) - && GetBattlerAbility(gActiveBattler) != ABILITY_MAGIC_GUARD - && IsBattlerAffectedByHazards(gActiveBattler, FALSE) - && IsBattlerGrounded(gActiveBattler)) + else if (!(gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_SPIKES_DAMAGED) + && (gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_SPIKES) + && GetBattlerAbility(battler) != ABILITY_MAGIC_GUARD + && IsBattlerAffectedByHazards(battler, FALSE) + && IsBattlerGrounded(battler)) { - u8 spikesDmg = (5 - gSideTimers[GetBattlerSide(gActiveBattler)].spikesAmount) * 2; - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / (spikesDmg); + u8 spikesDmg = (5 - gSideTimers[GetBattlerSide(battler)].spikesAmount) * 2; + gBattleMoveDamage = gBattleMons[battler].maxHP / (spikesDmg); if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; - gSideStatuses[GetBattlerSide(gActiveBattler)] |= SIDE_STATUS_SPIKES_DAMAGED; - SetDmgHazardsBattlescript(gActiveBattler, B_MSG_PKMNHURTBYSPIKES); + gSideStatuses[GetBattlerSide(battler)] |= SIDE_STATUS_SPIKES_DAMAGED; + SetDmgHazardsBattlescript(battler, B_MSG_PKMNHURTBYSPIKES); } - else if (!(gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_STEALTH_ROCK_DAMAGED) - && (gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_STEALTH_ROCK) - && IsBattlerAffectedByHazards(gActiveBattler, FALSE) - && GetBattlerAbility(gActiveBattler) != ABILITY_MAGIC_GUARD) + else if (!(gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_STEALTH_ROCK_DAMAGED) + && (gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_STEALTH_ROCK) + && IsBattlerAffectedByHazards(battler, FALSE) + && GetBattlerAbility(battler) != ABILITY_MAGIC_GUARD) { - gSideStatuses[GetBattlerSide(gActiveBattler)] |= SIDE_STATUS_STEALTH_ROCK_DAMAGED; - gBattleMoveDamage = GetStealthHazardDamage(gBattleMoves[MOVE_STEALTH_ROCK].type, gActiveBattler); + gSideStatuses[GetBattlerSide(battler)] |= SIDE_STATUS_STEALTH_ROCK_DAMAGED; + gBattleMoveDamage = GetStealthHazardDamage(gBattleMoves[MOVE_STEALTH_ROCK].type, battler); if (gBattleMoveDamage != 0) - SetDmgHazardsBattlescript(gActiveBattler, B_MSG_STEALTHROCKDMG); + SetDmgHazardsBattlescript(battler, B_MSG_STEALTHROCKDMG); } - else if (!(gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_TOXIC_SPIKES_DAMAGED) - && (gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_TOXIC_SPIKES) - && IsBattlerGrounded(gActiveBattler)) + else if (!(gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_TOXIC_SPIKES_DAMAGED) + && (gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_TOXIC_SPIKES) + && IsBattlerGrounded(battler)) { - gSideStatuses[GetBattlerSide(gActiveBattler)] |= SIDE_STATUS_TOXIC_SPIKES_DAMAGED; - if (IS_BATTLER_OF_TYPE(gActiveBattler, TYPE_POISON)) // Absorb the toxic spikes. + gSideStatuses[GetBattlerSide(battler)] |= SIDE_STATUS_TOXIC_SPIKES_DAMAGED; + if (IS_BATTLER_OF_TYPE(battler, TYPE_POISON)) // Absorb the toxic spikes. { - gSideStatuses[GetBattlerSide(gActiveBattler)] &= ~SIDE_STATUS_TOXIC_SPIKES; - gSideTimers[GetBattlerSide(gActiveBattler)].toxicSpikesAmount = 0; - gBattleScripting.battler = gActiveBattler; + gSideStatuses[GetBattlerSide(battler)] &= ~SIDE_STATUS_TOXIC_SPIKES; + gSideTimers[GetBattlerSide(battler)].toxicSpikesAmount = 0; + gBattleScripting.battler = battler; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ToxicSpikesAbsorbed; } - else if (IsBattlerAffectedByHazards(gActiveBattler, TRUE)) + else if (IsBattlerAffectedByHazards(battler, TRUE)) { - if (!(gBattleMons[gActiveBattler].status1 & STATUS1_ANY) - && !IS_BATTLER_OF_TYPE(gActiveBattler, TYPE_STEEL) - && GetBattlerAbility(gActiveBattler) != ABILITY_IMMUNITY - && !IsAbilityOnSide(gActiveBattler, ABILITY_PASTEL_VEIL) - && !(gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_SAFEGUARD) + if (!(gBattleMons[battler].status1 & STATUS1_ANY) + && !IS_BATTLER_OF_TYPE(battler, TYPE_STEEL) + && GetBattlerAbility(battler) != ABILITY_IMMUNITY + && !IsAbilityOnSide(battler, ABILITY_PASTEL_VEIL) + && !(gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_SAFEGUARD) && !(gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN)) { - if (gSideTimers[GetBattlerSide(gActiveBattler)].toxicSpikesAmount >= 2) - gBattleMons[gActiveBattler].status1 |= STATUS1_TOXIC_POISON; + if (gSideTimers[GetBattlerSide(battler)].toxicSpikesAmount >= 2) + gBattleMons[battler].status1 |= STATUS1_TOXIC_POISON; else - gBattleMons[gActiveBattler].status1 |= STATUS1_POISON; + gBattleMons[battler].status1 |= STATUS1_POISON; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gActiveBattler].status1), &gBattleMons[gActiveBattler].status1); - MarkBattlerForControllerExec(gActiveBattler); - gBattleScripting.battler = gActiveBattler; + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[battler].status1), &gBattleMons[battler].status1); + MarkBattlerForControllerExec(battler); + gBattleScripting.battler = battler; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ToxicSpikesPoisoned; } } } - else if (!(gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_STICKY_WEB_DAMAGED) - && (gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_STICKY_WEB) - && IsBattlerAffectedByHazards(gActiveBattler, FALSE) - && IsBattlerGrounded(gActiveBattler)) + else if (!(gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_STICKY_WEB_DAMAGED) + && (gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_STICKY_WEB) + && IsBattlerAffectedByHazards(battler, FALSE) + && IsBattlerGrounded(battler)) { - gSideStatuses[GetBattlerSide(gActiveBattler)] |= SIDE_STATUS_STICKY_WEB_DAMAGED; - gBattleScripting.battler = gActiveBattler; + gSideStatuses[GetBattlerSide(battler)] |= SIDE_STATUS_STICKY_WEB_DAMAGED; + gBattleScripting.battler = battler; SET_STATCHANGER(STAT_SPEED, 1, TRUE); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_StickyWebOnSwitchIn; } - else if (gBattleMons[gActiveBattler].hp != gBattleMons[gActiveBattler].maxHP && gBattleStruct->zmove.healReplacement) + else if (gBattleMons[battler].hp != gBattleMons[battler].maxHP && gBattleStruct->zmove.healReplacement) { gBattleStruct->zmove.healReplacement = FALSE; - gBattleMoveDamage = -1 * (gBattleMons[gActiveBattler].maxHP); - gBattleScripting.battler = gActiveBattler; + gBattleMoveDamage = -1 * (gBattleMons[battler].maxHP); + gBattleScripting.battler = battler; BattleScriptPushCursor(); gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_Z_HP_TRAP; gBattlescriptCurrInstr = BattleScript_HealReplacementZMove; @@ -7238,30 +6965,30 @@ static void Cmd_switchineffects(void) { // There is a hack here to ensure the truant counter will be 0 when the battler's next turn starts. // The truant counter is not updated in the case where a mon switches in after a lost judgment in the battle arena. - if (GetBattlerAbility(gActiveBattler) == ABILITY_TRUANT + if (GetBattlerAbility(battler) == ABILITY_TRUANT && gCurrentActionFuncId != B_ACTION_USE_MOVE - && !gDisableStructs[gActiveBattler].truantSwitchInHack) - gDisableStructs[gActiveBattler].truantCounter = 1; + && !gDisableStructs[battler].truantSwitchInHack) + gDisableStructs[battler].truantCounter = 1; - gDisableStructs[gActiveBattler].truantSwitchInHack = 0; + gDisableStructs[battler].truantSwitchInHack = 0; // Don't activate switch-in abilities if the opposing field is empty. // This could happen when a mon uses explosion and causes everyone to faint. - if (ShouldPostponeSwitchInAbilities(gActiveBattler) || gBattleStruct->switchInAbilityPostponed) + if (ShouldPostponeSwitchInAbilities(battler) || gBattleStruct->switchInAbilityPostponed) { - gBattleStruct->switchInAbilityPostponed |= gBitTable[gActiveBattler]; + gBattleStruct->switchInAbilityPostponed |= gBitTable[battler]; } else { - if (DoSwitchInAbilitiesItems(gActiveBattler)) + if (DoSwitchInAbilitiesItems(battler)) return; } - gSideStatuses[GetBattlerSide(gActiveBattler)] &= ~(SIDE_STATUS_SPIKES_DAMAGED | SIDE_STATUS_TOXIC_SPIKES_DAMAGED | SIDE_STATUS_STEALTH_ROCK_DAMAGED | SIDE_STATUS_STICKY_WEB_DAMAGED); + gSideStatuses[GetBattlerSide(battler)] &= ~(SIDE_STATUS_SPIKES_DAMAGED | SIDE_STATUS_TOXIC_SPIKES_DAMAGED | SIDE_STATUS_STEALTH_ROCK_DAMAGED | SIDE_STATUS_STICKY_WEB_DAMAGED); for (i = 0; i < gBattlersCount; i++) { - if (gBattlerByTurnOrder[i] == gActiveBattler) + if (gBattlerByTurnOrder[i] == battler) gActionsByTurnOrder[i] = B_ACTION_CANCEL_PARTNER; gBattleStruct->hpOnSwitchout[GetBattlerSide(i)] = gBattleMons[i].hp; @@ -7281,7 +7008,7 @@ static void Cmd_switchineffects(void) gBattlerFainted++; } } - gBattleStruct->forcedSwitch &= ~(gBitTable[gActiveBattler]); + gBattleStruct->forcedSwitch &= ~(gBitTable[battler]); gBattlescriptCurrInstr = cmd->nextInstr; } } @@ -7290,9 +7017,9 @@ static void Cmd_trainerslidein(void) { CMD_ARGS(u8 battler); - gActiveBattler = GetBattlerAtPosition(cmd->battler); - BtlController_EmitTrainerSlide(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + u32 battler = GetBattlerAtPosition(cmd->battler); + BtlController_EmitTrainerSlide(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -7301,9 +7028,8 @@ static void Cmd_playse(void) { CMD_ARGS(u16 song); - gActiveBattler = gBattlerAttacker; - BtlController_EmitPlaySE(BUFFER_A, cmd->song); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitPlaySE(gBattlerAttacker, BUFFER_A, cmd->song); + MarkBattlerForControllerExec(gBattlerAttacker); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -7312,9 +7038,8 @@ static void Cmd_fanfare(void) { CMD_ARGS(u16 song); - gActiveBattler = gBattlerAttacker; - BtlController_EmitPlayFanfareOrBGM(BUFFER_A, cmd->song, FALSE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitPlayFanfareOrBGM(gBattlerAttacker, BUFFER_A, cmd->song, FALSE); + MarkBattlerForControllerExec(gBattlerAttacker); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -7323,9 +7048,9 @@ static void Cmd_playfaintcry(void) { CMD_ARGS(u8 battler); - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - BtlController_EmitFaintingCry(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + u32 battler = GetBattlerForBattleScript(cmd->battler); + BtlController_EmitFaintingCry(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -7334,9 +7059,9 @@ static void Cmd_endlinkbattle(void) { CMD_ARGS(); - gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); - BtlController_EmitEndLinkBattle(BUFFER_A, gBattleOutcome); - MarkBattlerForControllerExec(gActiveBattler); + u32 battler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + BtlController_EmitEndLinkBattle(battler, BUFFER_A, gBattleOutcome); + MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -7345,9 +7070,9 @@ static void Cmd_returntoball(void) { CMD_ARGS(u8 battler); - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - BtlController_EmitReturnMonToBall(BUFFER_A, TRUE); - MarkBattlerForControllerExec(gActiveBattler); + u32 battler = GetBattlerForBattleScript(cmd->battler); + BtlController_EmitReturnMonToBall(battler, BUFFER_A, TRUE); + MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -7356,16 +7081,14 @@ static void Cmd_handlelearnnewmove(void) { CMD_ARGS(const u8 *learnedMovePtr, const u8 *nothingToLearnPtr, bool8 isFirstMove); - const u8 *learnedMovePtr = cmd->learnedMovePtr; - const u8 *nothingToLearnPtr = cmd->nothingToLearnPtr; - - u16 learnMove = MonTryLearningNewMove(&gPlayerParty[gBattleStruct->expGetterMonId], cmd->isFirstMove); + u32 monId = gBattleStruct->expGetterMonId; + u16 learnMove = MonTryLearningNewMove(&gPlayerParty[monId], cmd->isFirstMove); while (learnMove == MON_ALREADY_KNOWS_MOVE) - learnMove = MonTryLearningNewMove(&gPlayerParty[gBattleStruct->expGetterMonId], FALSE); + learnMove = MonTryLearningNewMove(&gPlayerParty[monId], FALSE); if (learnMove == MOVE_NONE) { - gBattlescriptCurrInstr = nothingToLearnPtr; + gBattlescriptCurrInstr = cmd->nothingToLearnPtr; } else if (learnMove == MON_HAS_MAX_MOVES) { @@ -7373,24 +7096,24 @@ static void Cmd_handlelearnnewmove(void) } else { - gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + u32 battler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); - if (gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterMonId - && !(gBattleMons[gActiveBattler].status2 & STATUS2_TRANSFORMED)) + if (gBattlerPartyIndexes[battler] == monId + && !(gBattleMons[battler].status2 & STATUS2_TRANSFORMED)) { - GiveMoveToBattleMon(&gBattleMons[gActiveBattler], learnMove); + GiveMoveToBattleMon(&gBattleMons[battler], learnMove); } if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { - gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); - if (gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterMonId - && !(gBattleMons[gActiveBattler].status2 & STATUS2_TRANSFORMED)) + battler = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); + if (gBattlerPartyIndexes[battler] == monId + && !(gBattleMons[battler].status2 & STATUS2_TRANSFORMED)) { - GiveMoveToBattleMon(&gBattleMons[gActiveBattler], learnMove); + GiveMoveToBattleMon(&gBattleMons[battler], learnMove); } } - gBattlescriptCurrInstr = learnedMovePtr; + gBattlescriptCurrInstr = cmd->learnedMovePtr; } } @@ -7398,8 +7121,6 @@ static void Cmd_yesnoboxlearnmove(void) { CMD_ARGS(const u8 *forgotMovePtr); - gActiveBattler = 0; - switch (gBattleScripting.learnMoveState) { case 0: @@ -7469,9 +7190,9 @@ static void Cmd_yesnoboxlearnmove(void) else { u16 moveId = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_MOVE1 + movePosition); - if (IsHMMove2(moveId)) + if (IsMoveHM(moveId)) { - PrepareStringBattle(STRINGID_HMMOVESCANTBEFORGOTTEN, gActiveBattler); + PrepareStringBattle(STRINGID_HMMOVESCANTBEFORGOTTEN, B_POSITION_PLAYER_LEFT); gBattleScripting.learnMoveState = 6; } else @@ -7565,16 +7286,15 @@ static void Cmd_hitanimation(void) { CMD_ARGS(u8 battler); - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - + u32 battler = GetBattlerForBattleScript(cmd->battler); if (gMoveResultFlags & MOVE_RESULT_NO_EFFECT) { gBattlescriptCurrInstr = cmd->nextInstr; } - else if (!(gHitMarker & HITMARKER_IGNORE_SUBSTITUTE) || !(DoesSubstituteBlockMove(gBattlerAttacker, gActiveBattler, gCurrentMove)) || gDisableStructs[gActiveBattler].substituteHP == 0) + else if (!(gHitMarker & HITMARKER_IGNORE_SUBSTITUTE) || !(DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove)) || gDisableStructs[battler].substituteHP == 0) { - BtlController_EmitHitAnimation(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitHitAnimation(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; } else @@ -7595,39 +7315,8 @@ static u32 GetTrainerMoneyToGive(u16 trainerId) } else { - switch (gTrainers[trainerId].partyFlags) - { - case 0: - { - const struct TrainerMonNoItemDefaultMoves *party = gTrainers[trainerId].party.NoItemDefaultMoves; - lastMonLevel = party[gTrainers[trainerId].partySize - 1].lvl; - } - break; - case F_TRAINER_PARTY_CUSTOM_MOVESET: - { - const struct TrainerMonNoItemCustomMoves *party = gTrainers[trainerId].party.NoItemCustomMoves; - lastMonLevel = party[gTrainers[trainerId].partySize - 1].lvl; - } - break; - case F_TRAINER_PARTY_HELD_ITEM: - { - const struct TrainerMonItemDefaultMoves *party = gTrainers[trainerId].party.ItemDefaultMoves; - lastMonLevel = party[gTrainers[trainerId].partySize - 1].lvl; - } - break; - case F_TRAINER_PARTY_CUSTOM_MOVESET | F_TRAINER_PARTY_HELD_ITEM: - { - const struct TrainerMonItemCustomMoves *party = gTrainers[trainerId].party.ItemCustomMoves; - lastMonLevel = party[gTrainers[trainerId].partySize - 1].lvl; - } - break; - case F_TRAINER_PARTY_EVERYTHING_CUSTOMIZED: - { - const struct TrainerMonCustomized *party = gTrainers[trainerId].party.EverythingCustomized; - lastMonLevel = party[gTrainers[trainerId].partySize - 1].lvl; - } - break; - } + const struct TrainerMon *party = gTrainers[trainerId].party; + lastMonLevel = party[gTrainers[trainerId].partySize - 1].lvl; for (; gTrainerMoneyTable[i].classId != 0xFF; i++) { @@ -7690,24 +7379,24 @@ static void Cmd_updatebattlermoves(void) { CMD_ARGS(u8 battler); - gActiveBattler = GetBattlerForBattleScript(cmd->battler); + u32 battler = GetBattlerForBattleScript(cmd->battler); switch (gBattleCommunication[0]) { case 0: - BtlController_EmitGetMonData(BUFFER_A, REQUEST_ALL_BATTLE, 0); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitGetMonData(battler, BUFFER_A, REQUEST_ALL_BATTLE, 0); + MarkBattlerForControllerExec(battler); gBattleCommunication[0]++; break; case 1: if (gBattleControllerExecFlags == 0) { s32 i; - struct BattlePokemon *bufferPoke = (struct BattlePokemon *) &gBattleResources->bufferB[gActiveBattler][4]; + struct BattlePokemon *bufferPoke = (struct BattlePokemon *) &gBattleResources->bufferB[battler][4]; for (i = 0; i < MAX_MON_MOVES; i++) { - gBattleMons[gActiveBattler].moves[i] = bufferPoke->moves[i]; - gBattleMons[gActiveBattler].pp[i] = bufferPoke->pp[i]; + gBattleMons[battler].moves[i] = bufferPoke->moves[i]; + gBattleMons[battler].pp[i] = bufferPoke->pp[i]; } gBattlescriptCurrInstr = cmd->nextInstr; } @@ -7719,9 +7408,8 @@ static void Cmd_swapattackerwithtarget(void) { CMD_ARGS(); - gActiveBattler = gBattlerAttacker; - gBattlerAttacker = gBattlerTarget; - gBattlerTarget = gActiveBattler; + u8 temp; + SWAP(gBattlerAttacker, gBattlerTarget, temp); if (gHitMarker & HITMARKER_SWAP_ATTACKER_TARGET) gHitMarker &= ~HITMARKER_SWAP_ATTACKER_TARGET; @@ -7745,16 +7433,15 @@ static void Cmd_drawpartystatussummary(void) { CMD_ARGS(u8 battler); - s32 i; + u32 battler, i; struct Pokemon *party; struct HpAndStatus hpStatuses[PARTY_SIZE]; if (gBattleControllerExecFlags) return; - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - - party = GetBattlerParty(gActiveBattler); + battler = GetBattlerForBattleScript(cmd->battler); + party = GetBattlerParty(battler); for (i = 0; i < PARTY_SIZE; i++) { @@ -7771,8 +7458,8 @@ static void Cmd_drawpartystatussummary(void) } } - BtlController_EmitDrawPartyStatusSummary(BUFFER_A, hpStatuses, 1); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitDrawPartyStatusSummary(battler, BUFFER_A, hpStatuses, 1); + MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -7781,9 +7468,9 @@ static void Cmd_hidepartystatussummary(void) { CMD_ARGS(u8 battler); - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - BtlController_EmitHidePartyStatusSummary(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + u32 battler = GetBattlerForBattleScript(cmd->battler); + BtlController_EmitHidePartyStatusSummary(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -7806,13 +7493,13 @@ static void Cmd_statusanimation(void) if (gBattleControllerExecFlags == 0) { - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - if (!(gStatuses3[gActiveBattler] & STATUS3_SEMI_INVULNERABLE) - && gDisableStructs[gActiveBattler].substituteHP == 0 + u32 battler = GetBattlerForBattleScript(cmd->battler); + if (!(gStatuses3[battler] & STATUS3_SEMI_INVULNERABLE) + && gDisableStructs[battler].substituteHP == 0 && !(gHitMarker & HITMARKER_NO_ANIMATIONS)) { - BtlController_EmitStatusAnimation(BUFFER_A, FALSE, gBattleMons[gActiveBattler].status1); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitStatusAnimation(battler, BUFFER_A, FALSE, gBattleMons[battler].status1); + MarkBattlerForControllerExec(battler); } gBattlescriptCurrInstr = cmd->nextInstr; } @@ -7822,18 +7509,16 @@ static void Cmd_status2animation(void) { CMD_ARGS(u8 battler, u32 status2); - u32 wantedToAnimate; - if (gBattleControllerExecFlags == 0) { - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - wantedToAnimate = cmd->status2; - if (!(gStatuses3[gActiveBattler] & STATUS3_SEMI_INVULNERABLE) - && gDisableStructs[gActiveBattler].substituteHP == 0 + u32 battler = GetBattlerForBattleScript(cmd->battler); + u32 status2ToAnim = cmd->status2; + if (!(gStatuses3[battler] & STATUS3_SEMI_INVULNERABLE) + && gDisableStructs[battler].substituteHP == 0 && !(gHitMarker & HITMARKER_NO_ANIMATIONS)) { - BtlController_EmitStatusAnimation(BUFFER_A, TRUE, gBattleMons[gActiveBattler].status2 & wantedToAnimate); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitStatusAnimation(battler, BUFFER_A, TRUE, gBattleMons[battler].status2 & status2ToAnim); + MarkBattlerForControllerExec(battler); } gBattlescriptCurrInstr = cmd->nextInstr; } @@ -7843,18 +7528,16 @@ static void Cmd_chosenstatusanimation(void) { CMD_ARGS(u8 battler, bool8 isStatus2, u32 status); - u32 wantedStatus; - if (gBattleControllerExecFlags == 0) { - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - wantedStatus = cmd->status; - if (!(gStatuses3[gActiveBattler] & STATUS3_SEMI_INVULNERABLE) - && gDisableStructs[gActiveBattler].substituteHP == 0 + u32 battler = GetBattlerForBattleScript(cmd->battler); + u32 wantedStatus = cmd->status; + if (!(gStatuses3[battler] & STATUS3_SEMI_INVULNERABLE) + && gDisableStructs[battler].substituteHP == 0 && !(gHitMarker & HITMARKER_NO_ANIMATIONS)) { - BtlController_EmitStatusAnimation(BUFFER_A, cmd->isStatus2, wantedStatus); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitStatusAnimation(battler, BUFFER_A, cmd->isStatus2, wantedStatus); + MarkBattlerForControllerExec(battler); } gBattlescriptCurrInstr = cmd->nextInstr; } @@ -7933,19 +7616,19 @@ static void Cmd_setgravity(void) } } -static bool32 TryCheekPouch(u32 battlerId, u32 itemId) +static bool32 TryCheekPouch(u32 battler, u32 itemId) { if (ItemId_GetPocket(itemId) == POCKET_BERRIES - && GetBattlerAbility(battlerId) == ABILITY_CHEEK_POUCH - && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) - && gBattleStruct->ateBerry[GetBattlerSide(battlerId)] & gBitTable[gBattlerPartyIndexes[battlerId]] - && !BATTLER_MAX_HP(battlerId)) + && GetBattlerAbility(battler) == ABILITY_CHEEK_POUCH + && !(gStatuses3[battler] & STATUS3_HEAL_BLOCK) + && gBattleStruct->ateBerry[GetBattlerSide(battler)] & gBitTable[gBattlerPartyIndexes[battler]] + && !BATTLER_MAX_HP(battler)) { - gBattleMoveDamage = gBattleMons[battlerId].maxHP / 3; + gBattleMoveDamage = gBattleMons[battler].maxHP / 3; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; gBattleMoveDamage *= -1; - gBattlerAbility = battlerId; + gBattlerAbility = battler; BattleScriptPush(gBattlescriptCurrInstr + 2); gBattlescriptCurrInstr = BattleScript_CheekPouchActivates; return TRUE; @@ -7958,15 +7641,13 @@ static void BestowItem(u32 battlerAtk, u32 battlerDef) { gLastUsedItem = gBattleMons[battlerAtk].item; - gActiveBattler = battlerAtk; gBattleMons[battlerAtk].item = ITEM_NONE; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[battlerAtk].item), &gBattleMons[battlerAtk].item); + BtlController_EmitSetMonData(battlerAtk, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[battlerAtk].item), &gBattleMons[battlerAtk].item); MarkBattlerForControllerExec(battlerAtk); CheckSetUnburden(battlerAtk); - gActiveBattler = battlerDef; gBattleMons[battlerDef].item = gLastUsedItem; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[battlerDef].item), &gBattleMons[battlerDef].item); + BtlController_EmitSetMonData(battlerDef, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[battlerDef].item), &gBattleMons[battlerDef].item); MarkBattlerForControllerExec(battlerDef); gBattleResources->flags->flags[battlerDef] &= ~RESOURCE_FLAG_UNBURDEN; } @@ -8000,6 +7681,7 @@ static void Cmd_removeitem(void) { CMD_ARGS(u8 battler); + u32 battler; u16 itemId = 0; if (gBattleScripting.overrideBerryRequirements) @@ -8009,21 +7691,23 @@ static void Cmd_removeitem(void) return; } - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - itemId = gBattleMons[gActiveBattler].item; + battler = GetBattlerForBattleScript(cmd->battler); + itemId = gBattleMons[battler].item; // Popped Air Balloon cannot be restored by any means. - if (GetBattlerHoldEffect(gActiveBattler, TRUE) != HOLD_EFFECT_AIR_BALLOON) - gBattleStruct->usedHeldItems[gBattlerPartyIndexes[gActiveBattler]][GetBattlerSide(gActiveBattler)] = itemId; // Remember if switched out + // Corroded items cannot be restored either. + if (GetBattlerHoldEffect(battler, TRUE) != HOLD_EFFECT_AIR_BALLOON + && gBattleMoves[gCurrentMove].effect != EFFECT_CORROSIVE_GAS) + gBattleStruct->usedHeldItems[gBattlerPartyIndexes[battler]][GetBattlerSide(battler)] = itemId; // Remember if switched out - gBattleMons[gActiveBattler].item = ITEM_NONE; - CheckSetUnburden(gActiveBattler); + gBattleMons[battler].item = ITEM_NONE; + CheckSetUnburden(battler); - BtlController_EmitSetMonData(BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gActiveBattler].item), &gBattleMons[gActiveBattler].item); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[battler].item), &gBattleMons[battler].item); + MarkBattlerForControllerExec(battler); - ClearBattlerItemEffectHistory(gActiveBattler); - if (!TryCheekPouch(gActiveBattler, itemId) && !TrySymbiosis(gActiveBattler, itemId)) + ClearBattlerItemEffectHistory(battler); + if (!TryCheekPouch(battler, itemId) && !TrySymbiosis(battler, itemId)) gBattlescriptCurrInstr = cmd->nextInstr; } @@ -8188,15 +7872,14 @@ static bool8 SlideInLevelUpBanner(void) static void DrawLevelUpBannerText(void) { - u16 monLevel; - u8 monGender; struct TextPrinterTemplate printerTemplate; u8 *txtPtr; u32 var; - monLevel = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL); - monGender = GetMonGender(&gPlayerParty[gBattleStruct->expGetterMonId]); - GetMonNickname(&gPlayerParty[gBattleStruct->expGetterMonId], gStringVar4); + struct Pokemon *mon = &gPlayerParty[gBattleStruct->expGetterMonId]; + u32 monLevel = GetMonData(mon, MON_DATA_LEVEL); + u8 monGender = GetMonGender(mon); + GetMonNickname(mon, gStringVar4); printerTemplate.currentChar = gStringVar4; printerTemplate.windowId = B_WIN_LEVEL_UP_BANNER; @@ -8266,20 +7949,18 @@ static bool8 SlideOutLevelUpBanner(void) static void PutMonIconOnLvlUpBanner(void) { u8 spriteId; - const u16 *iconPal; struct SpriteSheet iconSheet; struct SpritePalette iconPalSheet; - u16 species = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPECIES); - u32 personality = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_PERSONALITY); + struct Pokemon *mon = &gPlayerParty[gBattleStruct->expGetterMonId]; + u32 species = GetMonData(mon, MON_DATA_SPECIES); + u32 personality = GetMonData(mon, MON_DATA_PERSONALITY); - const u8 *iconPtr = GetMonIconPtr(species, personality); - iconSheet.data = iconPtr; + iconSheet.data = GetMonIconPtr(species, personality); iconSheet.size = 0x200; iconSheet.tag = TAG_LVLUP_BANNER_MON_ICON; - iconPal = GetValidMonIconPalettePtr(species); - iconPalSheet.data = iconPal; + iconPalSheet.data = GetValidMonIconPalettePtr(species); iconPalSheet.tag = TAG_LVLUP_BANNER_MON_ICON; LoadSpriteSheet(&iconSheet); @@ -8338,13 +8019,14 @@ static void Cmd_setatktoplayer0(void) static void Cmd_makevisible(void) { CMD_ARGS(u8 battler); + u32 battler; if (gBattleControllerExecFlags) return; - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - BtlController_EmitSpriteInvisibility(BUFFER_A, FALSE); - MarkBattlerForControllerExec(gActiveBattler); + battler = GetBattlerForBattleScript(cmd->battler); + BtlController_EmitSpriteInvisibility(battler, BUFFER_A, FALSE); + MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -8385,15 +8067,12 @@ static void Cmd_hpthresholds(void) { CMD_ARGS(u8 battler); - u8 opposingBattler; - s32 result; - if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) { - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - opposingBattler = BATTLE_OPPOSITE(gActiveBattler); + u32 battler = GetBattlerForBattleScript(cmd->battler); + u32 opposingBattler = BATTLE_OPPOSITE(battler); - result = gBattleMons[opposingBattler].hp * 100 / gBattleMons[opposingBattler].maxHP; + s32 result = gBattleMons[opposingBattler].hp * 100 / gBattleMons[opposingBattler].maxHP; if (result == 0) result = 1; @@ -8414,16 +8093,12 @@ static void Cmd_hpthresholds2(void) { CMD_ARGS(u8 battler); - u8 opposingBattler; - s32 result; - u8 hpSwitchout; - if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) { - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - opposingBattler = BATTLE_OPPOSITE(gActiveBattler); - hpSwitchout = *(gBattleStruct->hpOnSwitchout + GetBattlerSide(opposingBattler)); - result = (hpSwitchout - gBattleMons[opposingBattler].hp) * 100 / hpSwitchout; + u32 battler = GetBattlerForBattleScript(cmd->battler); + u32 opposingBattler = BATTLE_OPPOSITE(battler); + u8 hpSwitchout = *(gBattleStruct->hpOnSwitchout + GetBattlerSide(opposingBattler)); + s32 result = (hpSwitchout - gBattleMons[opposingBattler].hp) * 100 / hpSwitchout; if (gBattleMons[opposingBattler].hp >= hpSwitchout) gBattleStruct->hpScale = 0; @@ -8472,16 +8147,16 @@ bool32 CanParalyzeType(u8 battlerAttacker, u8 battlerTarget) return !(B_PARALYZE_ELECTRIC >= GEN_6 && IS_BATTLER_OF_TYPE(battlerTarget, TYPE_ELECTRIC)); } -bool32 CanUseLastResort(u8 battlerId) +bool32 CanUseLastResort(u8 battler) { u32 i; u32 knownMovesCount = 0, usedMovesCount = 0; for (i = 0; i < 4; i++) { - if (gBattleMons[battlerId].moves[i] != MOVE_NONE) + if (gBattleMons[battler].moves[i] != MOVE_NONE) knownMovesCount++; - if (i != gCurrMovePos && gDisableStructs[battlerId].usedMoves & gBitTable[i]) // Increment used move count for all moves except current Last Resort. + if (i != gCurrMovePos && gDisableStructs[battler].usedMoves & gBitTable[i]) // Increment used move count for all moves except current Last Resort. usedMovesCount++; } @@ -8529,7 +8204,7 @@ static void RemoveAllTerrains(void) } \ } -static bool32 TryDefogClear(u8 battlerAtk, bool32 clear) +static bool32 TryDefogClear(u32 battlerAtk, bool32 clear) { s32 i; for (i = 0; i < 2; i++) @@ -8593,13 +8268,13 @@ u32 IsAbilityStatusProtected(u32 battler) || IsShieldsDownProtected(battler); } -u32 GetHighestStatId(u32 battlerId) +u32 GetHighestStatId(u32 battler) { - u32 i, highestId = STAT_ATK, highestStat = gBattleMons[battlerId].attack; + u32 i, highestId = STAT_ATK, highestStat = gBattleMons[battler].attack; for (i = STAT_DEF; i < NUM_STATS; i++) { - u16 *statVal = &gBattleMons[battlerId].attack + (i - 1); + u16 *statVal = &gBattleMons[battler].attack + (i - 1); if (*statVal > highestStat) { highestStat = *statVal; @@ -8609,17 +8284,17 @@ u32 GetHighestStatId(u32 battlerId) return highestId; } -static bool32 IsRototillerAffected(u32 battlerId) +static bool32 IsRototillerAffected(u32 battler) { - if (!IsBattlerAlive(battlerId)) + if (!IsBattlerAlive(battler)) return FALSE; - if (!IsBattlerGrounded(battlerId)) + if (!IsBattlerGrounded(battler)) return FALSE; // Only grounded battlers affected - if (!IS_BATTLER_OF_TYPE(battlerId, TYPE_GRASS)) + if (!IS_BATTLER_OF_TYPE(battler, TYPE_GRASS)) return FALSE; // Only grass types affected - if (gStatuses3[battlerId] & STATUS3_SEMI_INVULNERABLE) + if (gStatuses3[battler] & STATUS3_SEMI_INVULNERABLE) return FALSE; // Rototiller doesn't affected semi-invulnerable battlers - if (BlocksPrankster(MOVE_ROTOTILLER, gBattlerAttacker, battlerId, FALSE)) + if (BlocksPrankster(MOVE_ROTOTILLER, gBattlerAttacker, battler, FALSE)) return FALSE; return TRUE; } @@ -8631,8 +8306,8 @@ static bool32 IsAbilityRodAffected(void) if (gBattleStruct->dynamicMoveType == 0) moveType = gBattleMoves[gCurrentMove].type; - else if (!(gBattleStruct->dynamicMoveType & 0x40)) - moveType = gBattleStruct->dynamicMoveType & 0x3F; + else if (!(gBattleStruct->dynamicMoveType & F_DYNAMIC_TYPE_1)) + moveType = gBattleStruct->dynamicMoveType & DYNAMIC_TYPE_MASK; else moveType = gBattleMoves[gCurrentMove].type; @@ -8648,8 +8323,8 @@ static bool32 IsAbilityMotorAffected(void) if (gBattleStruct->dynamicMoveType == 0) moveType = gBattleMoves[gCurrentMove].type; - else if (!(gBattleStruct->dynamicMoveType & 0x40)) - moveType = gBattleStruct->dynamicMoveType & 0x3F; + else if (!(gBattleStruct->dynamicMoveType & F_DYNAMIC_TYPE_1)) + moveType = gBattleStruct->dynamicMoveType & DYNAMIC_TYPE_MASK; else moveType = gBattleMoves[gCurrentMove].type; @@ -8665,8 +8340,8 @@ static bool32 IsAbilityAbsorbAffected(void) if (gBattleStruct->dynamicMoveType == 0) moveType = gBattleMoves[gCurrentMove].type; - else if (!(gBattleStruct->dynamicMoveType & 0x40)) - moveType = gBattleStruct->dynamicMoveType & 0x3F; + else if (!(gBattleStruct->dynamicMoveType & F_DYNAMIC_TYPE_1)) + moveType = gBattleStruct->dynamicMoveType & DYNAMIC_TYPE_MASK; else moveType = gBattleMoves[gCurrentMove].type; @@ -8676,11 +8351,11 @@ static bool32 IsAbilityAbsorbAffected(void) return FALSE; } -static bool32 IsTeatimeAffected(u32 battlerId) +static bool32 IsTeatimeAffected(u32 battler) { - if (ItemId_GetPocket(gBattleMons[battlerId].item) != POCKET_BERRIES) + if (ItemId_GetPocket(gBattleMons[battler].item) != POCKET_BERRIES) return FALSE; // Only berries - if (gStatuses3[battlerId] & STATUS3_SEMI_INVULNERABLE) + if (gStatuses3[battler] & STATUS3_SEMI_INVULNERABLE) return FALSE; // Teatime doesn't affected semi-invulnerable battlers return TRUE; } @@ -8744,37 +8419,41 @@ static bool32 CourtChangeSwapSideStatuses(void) SWAP(sideTimerPlayer->stickyWebBattlerSide, sideTimerOpp->stickyWebBattlerSide, temp); } -static void HandleScriptMegaPrimal(u32 caseId, u32 battlerId, bool32 isMega) +static void HandleScriptMegaPrimalBurst(u32 caseId, u32 battler, u32 type) { - struct Pokemon *party = GetBattlerParty(battlerId); - struct Pokemon *mon = &party[gBattlerPartyIndexes[battlerId]]; - u32 position = GetBattlerPosition(battlerId); - u32 side = GET_BATTLER_SIDE(battlerId); + struct Pokemon *party = GetBattlerParty(battler); + struct Pokemon *mon = &party[gBattlerPartyIndexes[battler]]; + u32 position = GetBattlerPosition(battler); + u32 side = GetBattlerSide(battler); // Change species. if (caseId == 0) { - if (isMega) + if (type == HANDLE_TYPE_MEGA_EVOLUTION) { - if (!TryBattleFormChange(battlerId, FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM)) - TryBattleFormChange(battlerId, FORM_CHANGE_BATTLE_MEGA_EVOLUTION_MOVE); + if (!TryBattleFormChange(battler, FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM)) + TryBattleFormChange(battler, FORM_CHANGE_BATTLE_MEGA_EVOLUTION_MOVE); } + else if (type == HANDLE_TYPE_PRIMAL_REVERSION) + TryBattleFormChange(battler, FORM_CHANGE_BATTLE_PRIMAL_REVERSION); else - TryBattleFormChange(battlerId, FORM_CHANGE_BATTLE_PRIMAL_REVERSION); + TryBattleFormChange(battler, FORM_CHANGE_BATTLE_ULTRA_BURST); - PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[battlerId].species); + PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[battler].species); - BtlController_EmitSetMonData(BUFFER_A, REQUEST_SPECIES_BATTLE, gBitTable[gBattlerPartyIndexes[battlerId]], sizeof(gBattleMons[battlerId].species), &gBattleMons[battlerId].species); - MarkBattlerForControllerExec(battlerId); + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_SPECIES_BATTLE, gBitTable[gBattlerPartyIndexes[battler]], sizeof(gBattleMons[battler].species), &gBattleMons[battler].species); + MarkBattlerForControllerExec(battler); } // Update healthbox and elevation and play cry. else { - UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId], mon, HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], mon, HEALTHBOX_ALL); if (side == B_SIDE_OPPONENT) - SetBattlerShadowSpriteCallback(battlerId, gBattleMons[battlerId].species); - if (isMega) + SetBattlerShadowSpriteCallback(battler, gBattleMons[battler].species); + if (type == HANDLE_TYPE_MEGA_EVOLUTION) gBattleStruct->mega.alreadyEvolved[position] = TRUE; + if (type == HANDLE_TYPE_ULTRA_BURST) + gBattleStruct->burst.alreadyBursted[position] = TRUE; } } @@ -8827,12 +8506,12 @@ static void Cmd_various(void) struct Pokemon *mon; s32 i, j; u8 data[10]; - u32 side, bits; + u32 side, battler, bits; if (gBattleControllerExecFlags) return; - gActiveBattler = GetBattlerForBattleScript(cmd->battler); + battler = GetBattlerForBattleScript(cmd->battler); switch (cmd->id) { @@ -8857,7 +8536,7 @@ static void Cmd_various(void) case VARIOUS_JUMP_IF_ABSENT: { VARIOUS_ARGS(const u8 *jumpInstr); - if (!IsBattlerAlive(gActiveBattler)) + if (!IsBattlerAlive(battler)) gBattlescriptCurrInstr = cmd->jumpInstr; else gBattlescriptCurrInstr = cmd->nextInstr; @@ -8866,9 +8545,9 @@ static void Cmd_various(void) case VARIOUS_JUMP_IF_SHIELDS_DOWN_PROTECTED: { VARIOUS_ARGS(const u8 *jumpInstr); - if (IsShieldsDownProtected(gActiveBattler)) + if (IsShieldsDownProtected(battler)) { - gBattlerAbility = gActiveBattler; + gBattlerAbility = battler; gBattlescriptCurrInstr = cmd->jumpInstr; } else @@ -8880,13 +8559,13 @@ static void Cmd_various(void) case VARIOUS_JUMP_IF_NO_HOLD_EFFECT: { VARIOUS_ARGS(u8 holdEffect, const u8 *jumpInstr); - if (GetBattlerHoldEffect(gActiveBattler, TRUE) != cmd->holdEffect) + if (GetBattlerHoldEffect(battler, TRUE) != cmd->holdEffect) { gBattlescriptCurrInstr = cmd->jumpInstr; } else { - gLastUsedItem = gBattleMons[gActiveBattler].item; // For B_LAST_USED_ITEM + gLastUsedItem = gBattleMons[battler].item; // For B_LAST_USED_ITEM gBattlescriptCurrInstr = cmd->nextInstr; } return; @@ -8894,7 +8573,7 @@ static void Cmd_various(void) case VARIOUS_JUMP_IF_NO_ALLY: { VARIOUS_ARGS(const u8 *jumpInstr); - if (!IsBattlerAlive(BATTLE_PARTNER(gActiveBattler))) + if (!IsBattlerAlive(BATTLE_PARTNER(battler))) gBattlescriptCurrInstr = cmd->jumpInstr; else gBattlescriptCurrInstr = cmd->nextInstr; @@ -8903,15 +8582,15 @@ static void Cmd_various(void) case VARIOUS_INFATUATE_WITH_BATTLER: { VARIOUS_ARGS(u8 infatuateWith); - gBattleScripting.battler = gActiveBattler; - gBattleMons[gActiveBattler].status2 |= STATUS2_INFATUATED_WITH(GetBattlerForBattleScript(cmd->infatuateWith)); + gBattleScripting.battler = battler; + gBattleMons[battler].status2 |= STATUS2_INFATUATED_WITH(GetBattlerForBattleScript(cmd->infatuateWith)); gBattlescriptCurrInstr = cmd->nextInstr; return; } case VARIOUS_SET_LAST_USED_ITEM: { VARIOUS_ARGS(); - gLastUsedItem = gBattleMons[gActiveBattler].item; + gLastUsedItem = gBattleMons[battler].item; break; } case VARIOUS_TRY_FAIRY_LOCK: @@ -8933,16 +8612,16 @@ static void Cmd_various(void) { VARIOUS_ARGS(u8 stat); i = cmd->stat; - gBattleMoveDamage = *(u16 *)(&gBattleMons[gActiveBattler].attack) + (i - 1); - gBattleMoveDamage *= gStatStageRatios[gBattleMons[gActiveBattler].statStages[i]][0]; - gBattleMoveDamage /= gStatStageRatios[gBattleMons[gActiveBattler].statStages[i]][1]; + gBattleMoveDamage = *(u16 *)(&gBattleMons[battler].attack) + (i - 1); + gBattleMoveDamage *= gStatStageRatios[gBattleMons[battler].statStages[i]][0]; + gBattleMoveDamage /= gStatStageRatios[gBattleMons[battler].statStages[i]][1]; gBattlescriptCurrInstr = cmd->nextInstr; return; } case VARIOUS_JUMP_IF_FULL_HP: { VARIOUS_ARGS(const u8 *jumpInstr); - if (BATTLER_MAX_HP(gActiveBattler)) + if (BATTLER_MAX_HP(battler)) gBattlescriptCurrInstr = cmd->jumpInstr; else gBattlescriptCurrInstr = cmd->nextInstr; @@ -8954,7 +8633,7 @@ static void Cmd_various(void) while (gBattleStruct->friskedBattler < gBattlersCount) { gBattlerTarget = gBattleStruct->friskedBattler++; - if (GET_BATTLER_SIDE2(gActiveBattler) != GET_BATTLER_SIDE2(gBattlerTarget) + if (GetBattlerSide(battler) != GetBattlerSide(gBattlerTarget) && IsBattlerAlive(gBattlerTarget) && gBattleMons[gBattlerTarget].item != ITEM_NONE) { @@ -8981,7 +8660,7 @@ static void Cmd_various(void) case VARIOUS_POISON_TYPE_IMMUNITY: { VARIOUS_ARGS(u8 target, const u8 *failInstr); - if (!CanPoisonType(gActiveBattler, GetBattlerForBattleScript(cmd->target))) + if (!CanPoisonType(battler, GetBattlerForBattleScript(cmd->target))) gBattlescriptCurrInstr = cmd->failInstr; else gBattlescriptCurrInstr = cmd->nextInstr; @@ -8990,7 +8669,7 @@ static void Cmd_various(void) case VARIOUS_PARALYZE_TYPE_IMMUNITY: { VARIOUS_ARGS(u8 target, const u8 *failInstr); - if (!CanParalyzeType(gActiveBattler, GetBattlerForBattleScript(cmd->target))) + if (!CanParalyzeType(battler, GetBattlerForBattleScript(cmd->target))) gBattlescriptCurrInstr = cmd->failInstr; else gBattlescriptCurrInstr = cmd->nextInstr; @@ -8999,13 +8678,13 @@ static void Cmd_various(void) case VARIOUS_TRACE_ABILITY: { VARIOUS_ARGS(); - gBattleMons[gActiveBattler].ability = gBattleStruct->overwrittenAbilities[gActiveBattler] = gBattleStruct->tracedAbility[gActiveBattler]; + gBattleMons[battler].ability = gBattleStruct->overwrittenAbilities[battler] = gBattleStruct->tracedAbility[battler]; break; } case VARIOUS_TRY_ILLUSION_OFF: { VARIOUS_ARGS(); - if (GetIllusionMonPtr(gActiveBattler) != NULL) + if (GetIllusionMonPtr(battler) != NULL) { gBattlescriptCurrInstr = cmd->nextInstr; BattleScriptPushCursor(); @@ -9024,17 +8703,17 @@ static void Cmd_various(void) case VARIOUS_UPDATE_NICK: { VARIOUS_ARGS(); - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - mon = &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]; + if (GetBattlerSide(battler) == B_SIDE_PLAYER) + mon = &gPlayerParty[gBattlerPartyIndexes[battler]]; else - mon = &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]; - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], mon, HEALTHBOX_NICK); + mon = &gEnemyParty[gBattlerPartyIndexes[battler]]; + UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], mon, HEALTHBOX_NICK); break; } case VARIOUS_JUMP_IF_NOT_BERRY: { VARIOUS_ARGS(const u8 *jumpInstr); - if (ItemId_GetPocket(gBattleMons[gActiveBattler].item) == POCKET_BERRIES) + if (ItemId_GetPocket(gBattleMons[battler].item) == POCKET_BERRIES) gBattlescriptCurrInstr = cmd->nextInstr; else gBattlescriptCurrInstr = cmd->jumpInstr; @@ -9043,16 +8722,16 @@ static void Cmd_various(void) case VARIOUS_CHECK_IF_GRASSY_TERRAIN_HEALS: { VARIOUS_ARGS(const u8 *failInstr); - if ((gStatuses3[gActiveBattler] & (STATUS3_SEMI_INVULNERABLE | STATUS3_HEAL_BLOCK)) - || BATTLER_MAX_HP(gActiveBattler) - || !gBattleMons[gActiveBattler].hp - || !(IsBattlerGrounded(gActiveBattler))) + if ((gStatuses3[battler] & (STATUS3_SEMI_INVULNERABLE | STATUS3_HEAL_BLOCK)) + || BATTLER_MAX_HP(battler) + || !gBattleMons[battler].hp + || !(IsBattlerGrounded(battler))) { gBattlescriptCurrInstr = cmd->failInstr; } else { - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 16; + gBattleMoveDamage = gBattleMons[battler].maxHP / 16; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; gBattleMoveDamage *= -1; @@ -9065,10 +8744,10 @@ static void Cmd_various(void) { VARIOUS_ARGS(); // Cancel all multiturn moves of IN_AIR Pokemon except those being targeted by Sky Drop. - if (gStatuses3[gActiveBattler] & STATUS3_ON_AIR && !(gStatuses3[gActiveBattler] & STATUS3_SKY_DROPPED)) - CancelMultiTurnMoves(gActiveBattler); + if (gStatuses3[battler] & STATUS3_ON_AIR && !(gStatuses3[battler] & STATUS3_SKY_DROPPED)) + CancelMultiTurnMoves(battler); - gStatuses3[gActiveBattler] &= ~(STATUS3_MAGNET_RISE | STATUS3_TELEKINESIS | STATUS3_ON_AIR | STATUS3_SKY_DROPPED); + gStatuses3[battler] &= ~(STATUS3_MAGNET_RISE | STATUS3_TELEKINESIS | STATUS3_ON_AIR | STATUS3_SKY_DROPPED); break; } case VARIOUS_SPECTRAL_THIEF: @@ -9094,7 +8773,7 @@ static void Cmd_various(void) case VARIOUS_SET_POWDER: { VARIOUS_ARGS(); - gBattleMons[gActiveBattler].status2 |= STATUS2_POWDER; + gBattleMons[battler].status2 |= STATUS2_POWDER; break; } case VARIOUS_ACUPRESSURE: @@ -9103,7 +8782,7 @@ static void Cmd_various(void) bits = 0; for (i = STAT_ATK; i < NUM_BATTLE_STATS; i++) { - if (CompareStat(gActiveBattler, i, MAX_STAT_STAGE, CMP_LESS_THAN)) + if (CompareStat(battler, i, MAX_STAT_STAGE, CMP_LESS_THAN)) bits |= gBitTable[i]; } if (bits) @@ -9126,25 +8805,25 @@ static void Cmd_various(void) case VARIOUS_CANCEL_MULTI_TURN_MOVES: { VARIOUS_ARGS(); - CancelMultiTurnMoves(gActiveBattler); + CancelMultiTurnMoves(battler); break; } case VARIOUS_SET_MAGIC_COAT_TARGET: { VARIOUS_ARGS(); - gBattleStruct->attackerBeforeBounce = gActiveBattler; + gBattleStruct->attackerBeforeBounce = battler; gBattlerAttacker = gBattlerTarget; side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker)); if (IsAffectedByFollowMe(gBattlerAttacker, side, gCurrentMove)) gBattlerTarget = gSideTimers[side].followmeTarget; else - gBattlerTarget = gActiveBattler; + gBattlerTarget = battler; break; } case VARIOUS_IS_RUNNING_IMPOSSIBLE: { VARIOUS_ARGS(); - gBattleCommunication[0] = IsRunningFromBattleImpossible(); + gBattleCommunication[0] = IsRunningFromBattleImpossible(battler); break; } case VARIOUS_GET_MOVE_TARGET: @@ -9156,7 +8835,7 @@ static void Cmd_various(void) case VARIOUS_GET_BATTLER_FAINTED: { VARIOUS_ARGS(); - if (gHitMarker & HITMARKER_FAINTED(gActiveBattler)) + if (gHitMarker & HITMARKER_FAINTED(battler)) gBattleCommunication[0] = TRUE; else gBattleCommunication[0] = FALSE; @@ -9165,8 +8844,8 @@ static void Cmd_various(void) case VARIOUS_RESET_SWITCH_IN_ABILITY_BITS: { VARIOUS_ARGS(); - gSpecialStatuses[gActiveBattler].traced = FALSE; - gSpecialStatuses[gActiveBattler].switchInAbilityDone = FALSE; + gSpecialStatuses[battler].traced = FALSE; + gSpecialStatuses[battler].switchInAbilityDone = FALSE; break; } case VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP: @@ -9175,17 +8854,17 @@ static void Cmd_various(void) if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterMonId || gBattlerPartyIndexes[2] == gBattleStruct->expGetterMonId) { if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterMonId) - gActiveBattler = 0; + battler = 0; else - gActiveBattler = 2; + battler = 2; for (i = 0; i < MAX_MON_MOVES; i++) { - if (gBattleMons[gActiveBattler].moves[i] == gBattleStruct->choicedMove[gActiveBattler]) + if (gBattleMons[battler].moves[i] == gBattleStruct->choicedMove[battler]) break; } if (i == MAX_MON_MOVES) - gBattleStruct->choicedMove[gActiveBattler] = MOVE_NONE; + gBattleStruct->choicedMove[battler] = MOVE_NONE; } break; } @@ -9206,15 +8885,15 @@ static void Cmd_various(void) VARIOUS_ARGS(); // Try and print end-of-turn Battle Palace flavor text (e.g. "A glint appears in mon's eyes") gBattleCommunication[0] = FALSE; // whether or not msg should be printed - gBattleScripting.battler = gActiveBattler = gBattleCommunication[1]; - if (!(gBattleStruct->palaceFlags & gBitTable[gActiveBattler]) - && gBattleMons[gActiveBattler].maxHP / 2 >= gBattleMons[gActiveBattler].hp - && gBattleMons[gActiveBattler].hp != 0 - && !(gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP)) + gBattleScripting.battler = battler = gBattleCommunication[1]; + if (!(gBattleStruct->palaceFlags & gBitTable[battler]) + && gBattleMons[battler].maxHP / 2 >= gBattleMons[battler].hp + && gBattleMons[battler].hp != 0 + && !(gBattleMons[battler].status1 & STATUS1_SLEEP)) { - gBattleStruct->palaceFlags |= gBitTable[gActiveBattler]; + gBattleStruct->palaceFlags |= gBitTable[battler]; gBattleCommunication[0] = TRUE; - gBattleCommunication[MULTISTRING_CHOOSER] = sBattlePalaceNatureToFlavorTextId[GetNatureFromPersonality(gBattleMons[gActiveBattler].personality)]; + gBattleCommunication[MULTISTRING_CHOOSER] = sBattlePalaceNatureToFlavorTextId[GetNatureFromPersonality(gBattleMons[battler].personality)]; } break; } @@ -9268,8 +8947,8 @@ static void Cmd_various(void) case VARIOUS_EMIT_YESNOBOX: { VARIOUS_ARGS(); - BtlController_EmitYesNoBox(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitYesNoBox(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); break; } case VARIOUS_DRAW_ARENA_REF_TEXT_BOX: @@ -9308,11 +8987,11 @@ static void Cmd_various(void) case VARIOUS_RETURN_OPPONENT_MON1: { VARIOUS_ARGS(); - gActiveBattler = 1; - if (gBattleMons[gActiveBattler].hp != 0) + battler = 1; + if (gBattleMons[battler].hp != 0) { - BtlController_EmitReturnMonToBall(BUFFER_A, FALSE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitReturnMonToBall(battler, BUFFER_A, FALSE); + MarkBattlerForControllerExec(battler); } break; } @@ -9321,11 +9000,11 @@ static void Cmd_various(void) VARIOUS_ARGS(); if (gBattlersCount > 3) { - gActiveBattler = 3; - if (gBattleMons[gActiveBattler].hp != 0) + battler = 3; + if (gBattleMons[battler].hp != 0) { - BtlController_EmitReturnMonToBall(BUFFER_A, FALSE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitReturnMonToBall(battler, BUFFER_A, FALSE); + MarkBattlerForControllerExec(battler); } } break; @@ -9345,13 +9024,13 @@ static void Cmd_various(void) case VARIOUS_SET_ALREADY_STATUS_MOVE_ATTEMPT: { VARIOUS_ARGS(); - gBattleStruct->alreadyStatusedMoveAttempt |= gBitTable[gActiveBattler]; + gBattleStruct->alreadyStatusedMoveAttempt |= gBitTable[battler]; break; } case VARIOUS_PALACE_TRY_ESCAPE_STATUS: { VARIOUS_ARGS(); - if (BattlePalace_TryEscapeStatus(gActiveBattler)) + if (BattlePalace_TryEscapeStatus(battler)) return; break; } @@ -9360,16 +9039,16 @@ static void Cmd_various(void) VARIOUS_ARGS(); // Don't end the battle if one of the wild mons teleported from the wild double battle // and its partner is still alive. - if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT && IsBattlerAlive(BATTLE_PARTNER(gActiveBattler))) + if (GetBattlerSide(battler) == B_SIDE_OPPONENT && IsBattlerAlive(BATTLE_PARTNER(battler))) { - gAbsentBattlerFlags |= gBitTable[gActiveBattler]; - gHitMarker |= HITMARKER_FAINTED(gActiveBattler); - gBattleMons[gActiveBattler].hp = 0; - SetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_HP, &gBattleMons[gActiveBattler].hp); - SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); - FaintClearSetData(); + gAbsentBattlerFlags |= gBitTable[battler]; + gHitMarker |= HITMARKER_FAINTED(battler); + gBattleMons[battler].hp = 0; + SetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_HP, &gBattleMons[battler].hp); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[battler]); + FaintClearSetData(battler); } - else if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) + else if (GetBattlerSide(battler) == B_SIDE_PLAYER) { gBattleOutcome = B_OUTCOME_PLAYER_TELEPORTED; } @@ -9382,8 +9061,8 @@ static void Cmd_various(void) case VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC: { VARIOUS_ARGS(); - BtlController_EmitPlayFanfareOrBGM(BUFFER_A, MUS_VICTORY_TRAINER, TRUE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitPlayFanfareOrBGM(battler, BUFFER_A, MUS_VICTORY_TRAINER, TRUE); + MarkBattlerForControllerExec(battler); break; } case VARIOUS_STAT_TEXT_BUFFER: @@ -9396,9 +9075,9 @@ static void Cmd_various(void) { VARIOUS_ARGS(); gBattlescriptCurrInstr = cmd->nextInstr; - AbilityBattleEffects(ABILITYEFFECT_NEUTRALIZINGGAS, gActiveBattler, 0, 0, 0); - AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, gActiveBattler, 0, 0, 0); - AbilityBattleEffects(ABILITYEFFECT_TRACE2, gActiveBattler, 0, 0, 0); + AbilityBattleEffects(ABILITYEFFECT_NEUTRALIZINGGAS, battler, 0, 0, 0); + AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, battler, 0, 0, 0); + AbilityBattleEffects(ABILITYEFFECT_TRACE2, battler, 0, 0, 0); return; } case VARIOUS_SAVE_TARGET: @@ -9416,16 +9095,16 @@ static void Cmd_various(void) case VARIOUS_INSTANT_HP_DROP: { VARIOUS_ARGS(); - BtlController_EmitHealthBarUpdate(BUFFER_A, INSTANT_HP_BAR_DROP); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitHealthBarUpdate(battler, BUFFER_A, INSTANT_HP_BAR_DROP); + MarkBattlerForControllerExec(battler); break; } case VARIOUS_CLEAR_STATUS: { VARIOUS_ARGS(); - gBattleMons[gActiveBattler].status1 = 0; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gActiveBattler].status1), &gBattleMons[gActiveBattler].status1); - MarkBattlerForControllerExec(gActiveBattler); + gBattleMons[battler].status1 = 0; + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[battler].status1), &gBattleMons[battler].status1); + MarkBattlerForControllerExec(battler); break; } case VARIOUS_RESTORE_PP: @@ -9433,19 +9112,19 @@ static void Cmd_various(void) VARIOUS_ARGS(); for (i = 0; i < 4; i++) { - gBattleMons[gActiveBattler].pp[i] = CalculatePPWithBonus(gBattleMons[gActiveBattler].moves[i], gBattleMons[gActiveBattler].ppBonuses, i); - data[i] = gBattleMons[gActiveBattler].pp[i]; + gBattleMons[battler].pp[i] = CalculatePPWithBonus(gBattleMons[battler].moves[i], gBattleMons[battler].ppBonuses, i); + data[i] = gBattleMons[battler].pp[i]; } - data[i] = gBattleMons[gActiveBattler].ppBonuses; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_PP_DATA_BATTLE, 0, 5, data); - MarkBattlerForControllerExec(gActiveBattler); + data[i] = gBattleMons[battler].ppBonuses; + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_PP_DATA_BATTLE, 0, 5, data); + MarkBattlerForControllerExec(battler); break; } case VARIOUS_TRY_ACTIVATE_MOXIE: // and chilling neigh + as one ice rider { VARIOUS_ARGS(); - u16 battlerAbility = GetBattlerAbility(gActiveBattler); + u16 battlerAbility = GetBattlerAbility(battler); if ((battlerAbility == ABILITY_MOXIE || battlerAbility == ABILITY_CHILLING_NEIGH @@ -9469,7 +9148,7 @@ static void Cmd_various(void) { VARIOUS_ARGS(); - u16 battlerAbility = GetBattlerAbility(gActiveBattler); + u16 battlerAbility = GetBattlerAbility(battler); if ((battlerAbility == ABILITY_GRIM_NEIGH || battlerAbility == ABILITY_AS_ONE_SHADOW_RIDER) @@ -9491,13 +9170,13 @@ static void Cmd_various(void) case VARIOUS_TRY_ACTIVATE_RECEIVER: // Partner gets fainted's ally ability { VARIOUS_ARGS(); - gBattlerAbility = BATTLE_PARTNER(gActiveBattler); + gBattlerAbility = BATTLE_PARTNER(battler); i = GetBattlerAbility(gBattlerAbility); if (IsBattlerAlive(gBattlerAbility) && (i == ABILITY_RECEIVER || i == ABILITY_POWER_OF_ALCHEMY) - && GetBattlerHoldEffect(gActiveBattler, TRUE) != HOLD_EFFECT_ABILITY_SHIELD) + && GetBattlerHoldEffect(battler, TRUE) != HOLD_EFFECT_ABILITY_SHIELD) { - switch (gBattleMons[gActiveBattler].ability) + switch (gBattleMons[battler].ability) { // Can't copy these abilities. case ABILITY_POWER_OF_ALCHEMY: case ABILITY_RECEIVER: case ABILITY_FORECAST: case ABILITY_MULTITYPE: @@ -9510,8 +9189,8 @@ static void Cmd_various(void) case ABILITY_RKS_SYSTEM: case ABILITY_TRACE: break; default: - gBattleStruct->tracedAbility[gBattlerAbility] = gBattleMons[gActiveBattler].ability; // re-using the variable for trace - gBattleScripting.battler = gActiveBattler; + gBattleStruct->tracedAbility[gBattlerAbility] = gBattleMons[battler].ability; // re-using the variable for trace + gBattleScripting.battler = battler; BattleScriptPush(cmd->nextInstr); gBattlescriptCurrInstr = BattleScript_ReceiverActivates; return; @@ -9522,8 +9201,8 @@ static void Cmd_various(void) case VARIOUS_TRY_ACTIVATE_BEAST_BOOST: { VARIOUS_ARGS(); - i = GetHighestStatId(gActiveBattler); - if (GetBattlerAbility(gActiveBattler) == ABILITY_BEAST_BOOST + i = GetHighestStatId(battler); + if (GetBattlerAbility(battler) == ABILITY_BEAST_BOOST && HasAttackerFaintedTarget() && !NoAliveMonsForEitherParty() && CompareStat(gBattlerAttacker, i, MAX_STAT_STAGE, CMP_LESS_THAN)) @@ -9580,19 +9259,19 @@ static void Cmd_various(void) case VARIOUS_PLAY_MOVE_ANIMATION: { VARIOUS_ARGS(u16 move); - BtlController_EmitMoveAnimation(BUFFER_A, cmd->move, gBattleScripting.animTurn, 0, 0, gBattleMons[gActiveBattler].friendship, &gDisableStructs[gActiveBattler], gMultiHitCounter); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitMoveAnimation(battler, BUFFER_A, cmd->move, gBattleScripting.animTurn, 0, 0, gBattleMons[battler].friendship, &gDisableStructs[battler], gMultiHitCounter); + MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; return; } case VARIOUS_SET_LUCKY_CHANT: { VARIOUS_ARGS(const u8 *failInstr); - if (!(gSideStatuses[GET_BATTLER_SIDE(gActiveBattler)] & SIDE_STATUS_LUCKY_CHANT)) + if (!(gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_LUCKY_CHANT)) { - gSideStatuses[GET_BATTLER_SIDE(gActiveBattler)] |= SIDE_STATUS_LUCKY_CHANT; - gSideTimers[GET_BATTLER_SIDE(gActiveBattler)].luckyChantBattlerId = gActiveBattler; - gSideTimers[GET_BATTLER_SIDE(gActiveBattler)].luckyChantTimer = 5; + gSideStatuses[GetBattlerSide(battler)] |= SIDE_STATUS_LUCKY_CHANT; + gSideTimers[GetBattlerSide(battler)].luckyChantBattlerId = battler; + gSideTimers[GetBattlerSide(battler)].luckyChantTimer = 5; gBattlescriptCurrInstr = cmd->nextInstr; } else @@ -9669,22 +9348,22 @@ static void Cmd_various(void) case VARIOUS_SET_LAST_USED_ABILITY: { VARIOUS_ARGS(); - gLastUsedAbility = gBattleMons[gActiveBattler].ability; + gLastUsedAbility = gBattleMons[battler].ability; break; } case VARIOUS_TRY_HEAL_PULSE: { VARIOUS_ARGS(const u8 *failInstr); - if (BATTLER_MAX_HP(gActiveBattler)) + if (BATTLER_MAX_HP(battler)) { gBattlescriptCurrInstr = cmd->failInstr; } else { - if (GetBattlerAbility(gBattlerAttacker) == ABILITY_MEGA_LAUNCHER && gBattleMoves[gCurrentMove].flags & FLAG_MEGA_LAUNCHER_BOOST) - gBattleMoveDamage = -(gBattleMons[gActiveBattler].maxHP * 75 / 100); + if (GetBattlerAbility(gBattlerAttacker) == ABILITY_MEGA_LAUNCHER && gBattleMoves[gCurrentMove].pulseMove) + gBattleMoveDamage = -(gBattleMons[battler].maxHP * 75 / 100); else - gBattleMoveDamage = -(gBattleMons[gActiveBattler].maxHP / 2); + gBattleMoveDamage = -(gBattleMons[battler].maxHP / 2); if (gBattleMoveDamage == 0) gBattleMoveDamage = -1; @@ -9711,45 +9390,27 @@ static void Cmd_various(void) VARIOUS_ARGS(); for (i = 0; i < NUM_BATTLE_STATS; i++) { - if (gBattleMons[gActiveBattler].statStages[i] < DEFAULT_STAT_STAGE) // Negative becomes positive. - gBattleMons[gActiveBattler].statStages[i] = DEFAULT_STAT_STAGE + (DEFAULT_STAT_STAGE - gBattleMons[gActiveBattler].statStages[i]); - else if (gBattleMons[gActiveBattler].statStages[i] > DEFAULT_STAT_STAGE) // Positive becomes negative. - gBattleMons[gActiveBattler].statStages[i] = DEFAULT_STAT_STAGE - (gBattleMons[gActiveBattler].statStages[i] - DEFAULT_STAT_STAGE); + if (gBattleMons[battler].statStages[i] < DEFAULT_STAT_STAGE) // Negative becomes positive. + gBattleMons[battler].statStages[i] = DEFAULT_STAT_STAGE + (DEFAULT_STAT_STAGE - gBattleMons[battler].statStages[i]); + else if (gBattleMons[battler].statStages[i] > DEFAULT_STAT_STAGE) // Positive becomes negative. + gBattleMons[battler].statStages[i] = DEFAULT_STAT_STAGE - (gBattleMons[battler].statStages[i] - DEFAULT_STAT_STAGE); } break; } case VARIOUS_TRY_ME_FIRST: { VARIOUS_ARGS(const u8 *failInstr); - if (GetBattlerTurnOrderNum(gBattlerAttacker) > GetBattlerTurnOrderNum(gBattlerTarget)) - gBattlescriptCurrInstr = cmd->failInstr; - else if (IS_MOVE_STATUS(gBattleMons[gBattlerTarget].moves[gBattleStruct->chosenMovePositions[gBattlerTarget]])) + u16 move = gBattleMons[gBattlerTarget].moves[gBattleStruct->chosenMovePositions[gBattlerTarget]]; + if (IS_MOVE_STATUS(move) || gBattleMoves[move].meFirstBanned + || GetBattlerTurnOrderNum(gBattlerAttacker) > GetBattlerTurnOrderNum(gBattlerTarget)) gBattlescriptCurrInstr = cmd->failInstr; else { - u16 move = gBattleMons[gBattlerTarget].moves[gBattleStruct->chosenMovePositions[gBattlerTarget]]; - switch (move) - { - case MOVE_STRUGGLE: - case MOVE_CHATTER: - case MOVE_FOCUS_PUNCH: - case MOVE_THIEF: - case MOVE_COVET: - case MOVE_COUNTER: - case MOVE_MIRROR_COAT: - case MOVE_METAL_BURST: - case MOVE_ME_FIRST: - case MOVE_BEAK_BLAST: - gBattlescriptCurrInstr = cmd->failInstr; - break; - default: - gCalledMove = move; - gHitMarker &= ~HITMARKER_ATTACKSTRING_PRINTED; - gBattlerTarget = GetMoveTarget(gCalledMove, NO_TARGET_OVERRIDE); - gStatuses3[gBattlerAttacker] |= STATUS3_ME_FIRST; - gBattlescriptCurrInstr = cmd->nextInstr; - break; - } + gCalledMove = move; + gHitMarker &= ~HITMARKER_ATTACKSTRING_PRINTED; + gBattlerTarget = GetMoveTarget(gCalledMove, NO_TARGET_OVERRIDE); + gStatuses3[gBattlerAttacker] |= STATUS3_ME_FIRST; + gBattlescriptCurrInstr = cmd->nextInstr; } return; } @@ -9823,45 +9484,31 @@ static void Cmd_various(void) } return; } - case VARIOUS_HANDLE_MEGA_EVO: - { - VARIOUS_ARGS(u8 case_); - HandleScriptMegaPrimal(cmd->case_, gActiveBattler, TRUE); - gBattlescriptCurrInstr = cmd->nextInstr; - return; - } - case VARIOUS_HANDLE_PRIMAL_REVERSION: - { - VARIOUS_ARGS(u8 case_); - HandleScriptMegaPrimal(cmd->case_, gActiveBattler, FALSE); - gBattlescriptCurrInstr = cmd->nextInstr; - return; - } case VARIOUS_HANDLE_FORM_CHANGE: { VARIOUS_ARGS(u8 case_); - if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT) - mon = &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]; + if (GetBattlerSide(battler) == B_SIDE_OPPONENT) + mon = &gEnemyParty[gBattlerPartyIndexes[battler]]; else - mon = &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]; + mon = &gPlayerParty[gBattlerPartyIndexes[battler]]; // Change species. if (cmd->case_ == 0) { if (!gBattleTextBuff1) - PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gActiveBattler].species); - BtlController_EmitSetMonData(BUFFER_A, REQUEST_SPECIES_BATTLE, gBitTable[gBattlerPartyIndexes[gActiveBattler]], sizeof(gBattleMons[gActiveBattler].species), &gBattleMons[gActiveBattler].species); - MarkBattlerForControllerExec(gActiveBattler); + PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[battler].species); + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_SPECIES_BATTLE, gBitTable[gBattlerPartyIndexes[battler]], sizeof(gBattleMons[battler].species), &gBattleMons[battler].species); + MarkBattlerForControllerExec(battler); } // Change stats. else if (cmd->case_ == 1) { - RecalcBattlerStats(gActiveBattler, mon); + RecalcBattlerStats(battler, mon); } // Update healthbox. else { - UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], mon, HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], mon, HEALTHBOX_ALL); } gBattlescriptCurrInstr = cmd->nextInstr; return; @@ -9869,7 +9516,7 @@ static void Cmd_various(void) case VARIOUS_TRY_LAST_RESORT: { VARIOUS_ARGS(const u8 *failInstr); - if (CanUseLastResort(gActiveBattler)) + if (CanUseLastResort(battler)) gBattlescriptCurrInstr = cmd->nextInstr; else gBattlescriptCurrInstr = cmd->failInstr; @@ -9934,9 +9581,9 @@ static void Cmd_various(void) case VARIOUS_TRY_AUTOTOMIZE: { VARIOUS_ARGS(const u8 *failInstr); - if (GetBattlerWeight(gActiveBattler) > 1) + if (GetBattlerWeight(battler) > 1) { - gDisableStructs[gActiveBattler].autotomizeCount++; + gDisableStructs[battler].autotomizeCount++; gBattlescriptCurrInstr = cmd->nextInstr; } else @@ -9948,7 +9595,7 @@ static void Cmd_various(void) case VARIOUS_TRY_COPYCAT: { VARIOUS_ARGS(const u8 *failInstr); - if (gLastUsedMove == 0xFFFF || (sForbiddenMoves[gLastUsedMove] & FORBIDDEN_COPYCAT)) + if (gLastUsedMove == MOVE_UNAVAILABLE || gBattleMoves[gLastUsedMove].copycatBanned) { gBattlescriptCurrInstr = cmd->failInstr; } @@ -9964,8 +9611,8 @@ static void Cmd_various(void) case VARIOUS_TRY_INSTRUCT: { VARIOUS_ARGS(const u8 *failInstr); - if ((sForbiddenMoves[gLastMoves[gBattlerTarget]] & FORBIDDEN_INSTRUCT) - || gLastMoves[gBattlerTarget] == 0xFFFF) + u16 move = gLastMoves[gBattlerTarget]; + if (move == MOVE_UNAVAILABLE || gBattleMoves[move].instructBanned) { gBattlescriptCurrInstr = cmd->failInstr; } @@ -9989,7 +9636,7 @@ static void Cmd_various(void) { gBattlerTarget = gBattleStruct->lastMoveTarget[gBattlerAttacker]; gHitMarker &= ~HITMARKER_ATTACKSTRING_PRINTED; - PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gActiveBattler, gBattlerPartyIndexes[gActiveBattler]); + PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, battler, gBattlerPartyIndexes[battler]); gBattlescriptCurrInstr = cmd->nextInstr; } } @@ -9998,13 +9645,13 @@ static void Cmd_various(void) case VARIOUS_ABILITY_POPUP: { VARIOUS_ARGS(); - CreateAbilityPopUp(gActiveBattler, gBattleMons[gActiveBattler].ability, (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) != 0); + CreateAbilityPopUp(battler, gBattleMons[battler].ability, (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) != 0); break; } case VARIOUS_UPDATE_ABILITY_POPUP: { VARIOUS_ARGS(); - UpdateAbilityPopup(gActiveBattler); + UpdateAbilityPopup(battler); break; } case VARIOUS_DEFOG: @@ -10019,7 +9666,7 @@ static void Cmd_various(void) } else { - if (TryDefogClear(gActiveBattler, FALSE)) + if (TryDefogClear(battler, FALSE)) gBattlescriptCurrInstr = cmd->nextInstr; else gBattlescriptCurrInstr = cmd->failInstr; @@ -10049,8 +9696,8 @@ static void Cmd_various(void) VARIOUS_ARGS(u8 type); for (i = 0; i < 3; i++) { - if (*(u8 *)(&gBattleMons[gActiveBattler].type1 + i) == cmd->type) - *(u8 *)(&gBattleMons[gActiveBattler].type1 + i) = TYPE_MYSTERY; + if (*(u8 *)(&gBattleMons[battler].type1 + i) == cmd->type) + *(u8 *)(&gBattleMons[battler].type1 + i) = TYPE_MYSTERY; } gBattlescriptCurrInstr = cmd->nextInstr; return; @@ -10077,25 +9724,25 @@ static void Cmd_various(void) return; } gBattleMons[gBattlerTarget].status1 = gBattleMons[gBattlerAttacker].status1 & STATUS1_ANY; - gActiveBattler = gBattlerTarget; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gActiveBattler].status1), &gBattleMons[gActiveBattler].status1); - MarkBattlerForControllerExec(gActiveBattler); + battler = gBattlerTarget; + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[battler].status1), &gBattleMons[battler].status1); + MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; return; } case VARIOUS_CURE_STATUS: { VARIOUS_ARGS(); - gBattleMons[gActiveBattler].status1 = 0; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gActiveBattler].status1), &gBattleMons[gActiveBattler].status1); - MarkBattlerForControllerExec(gActiveBattler); + gBattleMons[battler].status1 = 0; + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[battler].status1), &gBattleMons[battler].status1); + MarkBattlerForControllerExec(battler); break; } case VARIOUS_POWER_TRICK: { VARIOUS_ARGS(); - gStatuses3[gActiveBattler] ^= STATUS3_POWER_TRICK; - SWAP(gBattleMons[gActiveBattler].attack, gBattleMons[gActiveBattler].defense, i); + gStatuses3[battler] ^= STATUS3_POWER_TRICK; + SWAP(gBattleMons[battler].attack, gBattleMons[battler].defense, i); break; } case VARIOUS_AFTER_YOU: @@ -10118,7 +9765,8 @@ static void Cmd_various(void) if (gBattleMons[gBattlerAttacker].item == ITEM_NONE || gBattleMons[gBattlerTarget].item != ITEM_NONE || !CanBattlerGetOrLoseItem(gBattlerAttacker, gBattleMons[gBattlerAttacker].item) - || !CanBattlerGetOrLoseItem(gBattlerTarget, gBattleMons[gBattlerAttacker].item)) + || !CanBattlerGetOrLoseItem(gBattlerTarget, gBattleMons[gBattlerAttacker].item) + || gWishFutureKnock.knockedOffMons[GetBattlerSide(gBattlerTarget)] & gBitTable[gBattlerPartyIndexes[gBattlerTarget]]) { gBattlescriptCurrInstr = cmd->failInstr; } @@ -10138,7 +9786,7 @@ static void Cmd_various(void) case VARIOUS_JUMP_IF_NOT_GROUNDED: { VARIOUS_ARGS(const u8 *jumpInstr); - if (!IsBattlerGrounded(gActiveBattler)) + if (!IsBattlerGrounded(battler)) gBattlescriptCurrInstr = gBattlescriptCurrInstr = cmd->jumpInstr; else gBattlescriptCurrInstr = cmd->nextInstr; @@ -10150,28 +9798,28 @@ static void Cmd_various(void) if (cmd->case_ == 0) { // Save sprite IDs, because trainer slide in will overwrite gBattlerSpriteIds variable. - gBattleScripting.savedDmg = (gBattlerSpriteIds[gActiveBattler] & 0xFF) | (gBattlerSpriteIds[BATTLE_PARTNER(gActiveBattler)] << 8); - HideBattlerShadowSprite(gActiveBattler); + gBattleScripting.savedDmg = (gBattlerSpriteIds[battler] & 0xFF) | (gBattlerSpriteIds[BATTLE_PARTNER(battler)] << 8); + HideBattlerShadowSprite(battler); } else if (cmd->case_ == 1) { - BtlController_EmitPrintString(BUFFER_A, STRINGID_TRAINERSLIDE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitPrintString(battler, BUFFER_A, STRINGID_TRAINERSLIDE); + MarkBattlerForControllerExec(battler); } else { - gBattlerSpriteIds[BATTLE_PARTNER(gActiveBattler)] = gBattleScripting.savedDmg >> 8; - gBattlerSpriteIds[gActiveBattler] = gBattleScripting.savedDmg & 0xFF; - if (IsBattlerAlive(gActiveBattler)) + gBattlerSpriteIds[BATTLE_PARTNER(battler)] = gBattleScripting.savedDmg >> 8; + gBattlerSpriteIds[battler] = gBattleScripting.savedDmg & 0xFF; + if (IsBattlerAlive(battler)) { - SetBattlerShadowSpriteCallback(gActiveBattler, gBattleMons[gActiveBattler].species); - BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); + SetBattlerShadowSpriteCallback(battler, gBattleMons[battler].species); + BattleLoadMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battler]], battler); } - i = BATTLE_PARTNER(gActiveBattler); + i = BATTLE_PARTNER(battler); if (IsBattlerAlive(i)) { SetBattlerShadowSpriteCallback(i, gBattleMons[i].species); - BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[i]], i); + BattleLoadMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[i]], i); } } gBattlescriptCurrInstr = cmd->nextInstr; @@ -10180,9 +9828,9 @@ static void Cmd_various(void) case VARIOUS_TRY_TRAINER_SLIDE_MSG_FIRST_OFF: { VARIOUS_ARGS(); - if ((i = ShouldDoTrainerSlide(gActiveBattler, TRAINER_SLIDE_FIRST_DOWN))) + if ((i = ShouldDoTrainerSlide(battler, TRAINER_SLIDE_FIRST_DOWN))) { - gBattleScripting.battler = gActiveBattler; + gBattleScripting.battler = battler; BattleScriptPush(cmd->nextInstr); gBattlescriptCurrInstr = (i == 1 ? BattleScript_TrainerASlideMsgRet : BattleScript_TrainerBSlideMsgRet); return; @@ -10192,9 +9840,9 @@ static void Cmd_various(void) case VARIOUS_TRY_TRAINER_SLIDE_MSG_LAST_ON: { VARIOUS_ARGS(); - if ((i = ShouldDoTrainerSlide(gActiveBattler, TRAINER_SLIDE_LAST_SWITCHIN))) + if ((i = ShouldDoTrainerSlide(battler, TRAINER_SLIDE_LAST_SWITCHIN))) { - gBattleScripting.battler = gActiveBattler; + gBattleScripting.battler = battler; BattleScriptPush(cmd->nextInstr); gBattlescriptCurrInstr = (i == 1 ? BattleScript_TrainerASlideMsgRet : BattleScript_TrainerBSlideMsgRet); return; @@ -10204,7 +9852,7 @@ static void Cmd_various(void) case VARIOUS_SET_AURORA_VEIL: { VARIOUS_ARGS(); - if (gSideStatuses[GET_BATTLER_SIDE(gActiveBattler)] & SIDE_STATUS_AURORA_VEIL + if (gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_AURORA_VEIL || !(WEATHER_HAS_EFFECT && gBattleWeather & (B_WEATHER_HAIL | B_WEATHER_SNOW))) { gMoveResultFlags |= MOVE_RESULT_MISSED; @@ -10212,14 +9860,14 @@ static void Cmd_various(void) } else { - gSideStatuses[GET_BATTLER_SIDE(gActiveBattler)] |= SIDE_STATUS_AURORA_VEIL; - if (GetBattlerHoldEffect(gActiveBattler, TRUE) == HOLD_EFFECT_LIGHT_CLAY) - gSideTimers[GET_BATTLER_SIDE(gActiveBattler)].auroraVeilTimer = 8; + gSideStatuses[GetBattlerSide(battler)] |= SIDE_STATUS_AURORA_VEIL; + if (GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_LIGHT_CLAY) + gSideTimers[GetBattlerSide(battler)].auroraVeilTimer = 8; else - gSideTimers[GET_BATTLER_SIDE(gActiveBattler)].auroraVeilTimer = 5; - gSideTimers[GET_BATTLER_SIDE(gActiveBattler)].auroraVeilBattlerId = gActiveBattler; + gSideTimers[GetBattlerSide(battler)].auroraVeilTimer = 5; + gSideTimers[GetBattlerSide(battler)].auroraVeilBattlerId = battler; - if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_ATK_SIDE) == 2) + if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_SIDE, gBattlerAttacker) == 2) gBattleCommunication[MULTISTRING_CHOOSER] = 5; else gBattleCommunication[MULTISTRING_CHOOSER] = 5; @@ -10229,13 +9877,13 @@ static void Cmd_various(void) case VARIOUS_TRY_THIRD_TYPE: { VARIOUS_ARGS(const u8 *failInstr); - if (IS_BATTLER_OF_TYPE(gActiveBattler, gBattleMoves[gCurrentMove].argument)) + if (IS_BATTLER_OF_TYPE(battler, gBattleMoves[gCurrentMove].argument)) { gBattlescriptCurrInstr = cmd->failInstr; } else { - gBattleMons[gActiveBattler].type3 = gBattleMoves[gCurrentMove].argument; + gBattleMons[battler].type3 = gBattleMoves[gCurrentMove].argument; PREPARE_TYPE_BUFFER(gBattleTextBuff1, gBattleMoves[gCurrentMove].argument); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -10244,14 +9892,14 @@ static void Cmd_various(void) case VARIOUS_DESTROY_ABILITY_POPUP: { VARIOUS_ARGS(); - DestroyAbilityPopUp(gActiveBattler); + DestroyAbilityPopUp(battler); break; } case VARIOUS_TOTEM_BOOST: { VARIOUS_ARGS(const u8 *jumpInstr); - gActiveBattler = gBattlerAttacker; - if (gTotemBoosts[gActiveBattler].stats == 0) + battler = gBattlerAttacker; + if (gTotemBoosts[battler].stats == 0) { gBattlescriptCurrInstr = cmd->nextInstr; // stats done, exit } @@ -10259,19 +9907,19 @@ static void Cmd_various(void) { for (i = 0; i < (NUM_BATTLE_STATS - 1); i++) { - if (gTotemBoosts[gActiveBattler].stats & (1 << i)) + if (gTotemBoosts[battler].stats & (1 << i)) { - if (gTotemBoosts[gActiveBattler].statChanges[i] <= -1) - SET_STATCHANGER(i + 1, abs(gTotemBoosts[gActiveBattler].statChanges[i]), TRUE); + if (gTotemBoosts[battler].statChanges[i] <= -1) + SET_STATCHANGER(i + 1, abs(gTotemBoosts[battler].statChanges[i]), TRUE); else - SET_STATCHANGER(i + 1, gTotemBoosts[gActiveBattler].statChanges[i], FALSE); + SET_STATCHANGER(i + 1, gTotemBoosts[battler].statChanges[i], FALSE); - gTotemBoosts[gActiveBattler].stats &= ~(1 << i); - gBattleScripting.battler = gActiveBattler; - gBattlerTarget = gActiveBattler; - if (gTotemBoosts[gActiveBattler].stats & 0x80) + gTotemBoosts[battler].stats &= ~(1 << i); + gBattleScripting.battler = battler; + gBattlerTarget = battler; + if (gTotemBoosts[battler].stats & 0x80) { - gTotemBoosts[gActiveBattler].stats &= ~0x80; // set 'aura flared to life' flag + gTotemBoosts[battler].stats &= ~0x80; // set 'aura flared to life' flag gBattlescriptCurrInstr = BattleScript_TotemFlaredToLife; } else @@ -10288,14 +9936,14 @@ static void Cmd_various(void) case VARIOUS_MOVEEND_ITEM_EFFECTS: { VARIOUS_ARGS(); - if (ItemBattleEffects(ITEMEFFECT_NORMAL, gActiveBattler, FALSE)) + if (ItemBattleEffects(ITEMEFFECT_NORMAL, battler, FALSE)) return; break; } case VARIOUS_ROOM_SERVICE: { VARIOUS_ARGS(const u8 *failInstr); - if (GetBattlerHoldEffect(gActiveBattler, TRUE) == HOLD_EFFECT_ROOM_SERVICE && TryRoomService(gActiveBattler)) + if (GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_ROOM_SERVICE && TryRoomService(battler)) { BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_BerryStatRaiseRet; @@ -10309,23 +9957,23 @@ static void Cmd_various(void) case VARIOUS_TERRAIN_SEED: { VARIOUS_ARGS(const u8 *failInstr); - if (GetBattlerHoldEffect(gActiveBattler, TRUE) == HOLD_EFFECT_SEEDS) + if (GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_SEEDS) { u8 effect = 0; - u16 item = gBattleMons[gActiveBattler].item; - switch (GetBattlerHoldEffectParam(gActiveBattler)) + u16 item = gBattleMons[battler].item; + switch (GetBattlerHoldEffectParam(battler)) { case HOLD_EFFECT_PARAM_ELECTRIC_TERRAIN: - effect = TryHandleSeed(gActiveBattler, STATUS_FIELD_ELECTRIC_TERRAIN, STAT_DEF, item, FALSE); + effect = TryHandleSeed(battler, STATUS_FIELD_ELECTRIC_TERRAIN, STAT_DEF, item, FALSE); break; case HOLD_EFFECT_PARAM_GRASSY_TERRAIN: - effect = TryHandleSeed(gActiveBattler, STATUS_FIELD_GRASSY_TERRAIN, STAT_DEF, item, FALSE); + effect = TryHandleSeed(battler, STATUS_FIELD_GRASSY_TERRAIN, STAT_DEF, item, FALSE); break; case HOLD_EFFECT_PARAM_MISTY_TERRAIN: - effect = TryHandleSeed(gActiveBattler, STATUS_FIELD_MISTY_TERRAIN, STAT_SPDEF, item, FALSE); + effect = TryHandleSeed(battler, STATUS_FIELD_MISTY_TERRAIN, STAT_SPDEF, item, FALSE); break; case HOLD_EFFECT_PARAM_PSYCHIC_TERRAIN: - effect = TryHandleSeed(gActiveBattler, STATUS_FIELD_PSYCHIC_TERRAIN, STAT_SPDEF, item, FALSE); + effect = TryHandleSeed(battler, STATUS_FIELD_PSYCHIC_TERRAIN, STAT_SPDEF, item, FALSE); break; } @@ -10341,43 +9989,43 @@ static void Cmd_various(void) if (gBattleControllerExecFlags) break; - BtlController_EmitSpriteInvisibility(BUFFER_A, TRUE); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSpriteInvisibility(battler, BUFFER_A, TRUE); + MarkBattlerForControllerExec(battler); break; } case VARIOUS_EERIE_SPELL_PP_REDUCE: { VARIOUS_ARGS(const u8 *failInstr); - if (gLastMoves[gActiveBattler] != 0 && gLastMoves[gActiveBattler] != 0xFFFF) + if (gLastMoves[battler] != 0 && gLastMoves[battler] != 0xFFFF) { s32 i; for (i = 0; i < MAX_MON_MOVES; i++) { - if (gLastMoves[gActiveBattler] == gBattleMons[gActiveBattler].moves[i]) + if (gLastMoves[battler] == gBattleMons[battler].moves[i]) break; } - if (i != MAX_MON_MOVES && gBattleMons[gActiveBattler].pp[i] != 0) + if (i != MAX_MON_MOVES && gBattleMons[battler].pp[i] != 0) { s32 ppToDeduct = 3; - if (gBattleMons[gActiveBattler].pp[i] < ppToDeduct) - ppToDeduct = gBattleMons[gActiveBattler].pp[i]; + if (gBattleMons[battler].pp[i] < ppToDeduct) + ppToDeduct = gBattleMons[battler].pp[i]; - PREPARE_MOVE_BUFFER(gBattleTextBuff1, gLastMoves[gActiveBattler]) + PREPARE_MOVE_BUFFER(gBattleTextBuff1, gLastMoves[battler]) ConvertIntToDecimalStringN(gBattleTextBuff2, ppToDeduct, STR_CONV_MODE_LEFT_ALIGN, 1); PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff2, 1, ppToDeduct) - gBattleMons[gActiveBattler].pp[i] -= ppToDeduct; - if (!(gDisableStructs[gActiveBattler].mimickedMoves & gBitTable[i]) - && !(gBattleMons[gActiveBattler].status2 & STATUS2_TRANSFORMED)) + gBattleMons[battler].pp[i] -= ppToDeduct; + if (!(gDisableStructs[battler].mimickedMoves & gBitTable[i]) + && !(gBattleMons[battler].status2 & STATUS2_TRANSFORMED)) { - BtlController_EmitSetMonData(BUFFER_A, REQUEST_PPMOVE1_BATTLE + i, 0, sizeof(gBattleMons[gActiveBattler].pp[i]), &gBattleMons[gActiveBattler].pp[i]); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_PPMOVE1_BATTLE + i, 0, sizeof(gBattleMons[battler].pp[i]), &gBattleMons[battler].pp[i]); + MarkBattlerForControllerExec(battler); } - if (gBattleMons[gActiveBattler].pp[i] == 0 && gBattleStruct->skyDropTargets[gActiveBattler] == 0xFF) - CancelMultiTurnMoves(gActiveBattler); + if (gBattleMons[battler].pp[i] == 0 && gBattleStruct->skyDropTargets[battler] == 0xFF) + CancelMultiTurnMoves(battler); gBattlescriptCurrInstr = cmd->nextInstr; // continue } @@ -10395,10 +10043,10 @@ static void Cmd_various(void) case VARIOUS_JUMP_IF_TEAM_HEALTHY: { VARIOUS_ARGS(const u8 *jumpInstr); - if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && IsBattlerAlive(BATTLE_PARTNER(gActiveBattler))) + if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && IsBattlerAlive(BATTLE_PARTNER(battler))) { - u8 partner = BATTLE_PARTNER(gActiveBattler); - if ((gBattleMons[gActiveBattler].hp == gBattleMons[gActiveBattler].maxHP && !(gBattleMons[gActiveBattler].status1 & STATUS1_ANY)) + u8 partner = BATTLE_PARTNER(battler); + if ((gBattleMons[battler].hp == gBattleMons[battler].maxHP && !(gBattleMons[battler].status1 & STATUS1_ANY)) && (gBattleMons[partner].hp == gBattleMons[partner].maxHP && !(gBattleMons[partner].status1 & STATUS1_ANY))) gBattlescriptCurrInstr = cmd->jumpInstr; else @@ -10406,7 +10054,7 @@ static void Cmd_various(void) } else // single battle { - if (gBattleMons[gActiveBattler].hp == gBattleMons[gActiveBattler].maxHP && !(gBattleMons[gActiveBattler].status1 & STATUS1_ANY)) + if (gBattleMons[battler].hp == gBattleMons[battler].maxHP && !(gBattleMons[battler].status1 & STATUS1_ANY)) gBattlescriptCurrInstr = cmd->jumpInstr; else gBattlescriptCurrInstr = cmd->nextInstr; @@ -10416,12 +10064,12 @@ static void Cmd_various(void) case VARIOUS_TRY_HEAL_QUARTER_HP: { VARIOUS_ARGS(const u8 *failInstr); - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 4; + gBattleMoveDamage = gBattleMons[battler].maxHP / 4; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; gBattleMoveDamage *= -1; - if (gBattleMons[gActiveBattler].hp == gBattleMons[gActiveBattler].maxHP) + if (gBattleMons[battler].hp == gBattleMons[battler].maxHP) gBattlescriptCurrInstr = cmd->failInstr; // fail else gBattlescriptCurrInstr = cmd->nextInstr; // can heal @@ -10513,7 +10161,7 @@ static void Cmd_various(void) case VARIOUS_JUMP_IF_PRANKSTER_BLOCKED: { VARIOUS_ARGS(const u8 *jumpInstr); - if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gActiveBattler, TRUE)) + if (BlocksPrankster(gCurrentMove, gBattlerAttacker, battler, TRUE)) gBattlescriptCurrInstr = cmd->jumpInstr; else gBattlescriptCurrInstr = cmd->nextInstr; @@ -10535,19 +10183,19 @@ static void Cmd_various(void) if (gBattleWeather & B_WEATHER_SUN_PRIMAL && !shouldNotClear) { gBattleWeather &= ~B_WEATHER_SUN_PRIMAL; - PrepareStringBattle(STRINGID_EXTREMESUNLIGHTFADED, gActiveBattler); + PrepareStringBattle(STRINGID_EXTREMESUNLIGHTFADED, battler); gBattleCommunication[MSG_DISPLAY] = 1; } else if (gBattleWeather & B_WEATHER_RAIN_PRIMAL && !shouldNotClear) { gBattleWeather &= ~B_WEATHER_RAIN_PRIMAL; - PrepareStringBattle(STRINGID_HEAVYRAINLIFTED, gActiveBattler); + PrepareStringBattle(STRINGID_HEAVYRAINLIFTED, battler); gBattleCommunication[MSG_DISPLAY] = 1; } else if (gBattleWeather & B_WEATHER_STRONG_WINDS && !shouldNotClear) { gBattleWeather &= ~B_WEATHER_STRONG_WINDS; - PrepareStringBattle(STRINGID_STRONGWINDSDISSIPATED, gActiveBattler); + PrepareStringBattle(STRINGID_STRONGWINDSDISSIPATED, battler); gBattleCommunication[MSG_DISPLAY] = 1; } break; @@ -10555,9 +10203,9 @@ static void Cmd_various(void) case VARIOUS_TRY_END_NEUTRALIZING_GAS: { VARIOUS_ARGS(); - if (gSpecialStatuses[gActiveBattler].neutralizingGasRemoved) + if (gSpecialStatuses[battler].neutralizingGasRemoved) { - gSpecialStatuses[gActiveBattler].neutralizingGasRemoved = FALSE; + gSpecialStatuses[battler].neutralizingGasRemoved = FALSE; BattleScriptPush(cmd->nextInstr); gBattlescriptCurrInstr = BattleScript_NeutralizingGasExits; return; @@ -10590,9 +10238,9 @@ static void Cmd_various(void) case VARIOUS_JUMP_IF_NOT_ROTOTILLER_AFFECTED: { VARIOUS_ARGS(const u8 *jumpInstr); - if (gSpecialStatuses[gActiveBattler].rototillerAffected) + if (gSpecialStatuses[battler].rototillerAffected) { - gSpecialStatuses[gActiveBattler].rototillerAffected = FALSE; + gSpecialStatuses[battler].rototillerAffected = FALSE; gBattlescriptCurrInstr = cmd->nextInstr; } else @@ -10607,11 +10255,11 @@ static void Cmd_various(void) if (gBattleMons[gBattlerAttacker].species == SPECIES_GRENINJA_BATTLE_BOND && HasAttackerFaintedTarget() && CalculateBattlerPartyCount(gBattlerTarget) > 1 - && !(gBattleStruct->battleBondTransformed[GET_BATTLER_SIDE2(gBattlerAttacker)] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]])) + && !(gBattleStruct->battleBondTransformed[GetBattlerSide(gBattlerAttacker)] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]])) { - gBattleStruct->battleBondTransformed[GET_BATTLER_SIDE2(gBattlerAttacker)] |= gBitTable[gBattlerPartyIndexes[gBattlerAttacker]]; + gBattleStruct->battleBondTransformed[GetBattlerSide(gBattlerAttacker)] |= gBitTable[gBattlerPartyIndexes[gBattlerAttacker]]; PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerAttacker].species); - gBattleStruct->changedSpecies[GET_BATTLER_SIDE2(gBattlerAttacker)][gBattlerPartyIndexes[gBattlerAttacker]] = gBattleMons[gBattlerAttacker].species; + gBattleStruct->changedSpecies[GetBattlerSide(gBattlerAttacker)][gBattlerPartyIndexes[gBattlerAttacker]] = gBattleMons[gBattlerAttacker].species; gBattleMons[gBattlerAttacker].species = SPECIES_GRENINJA_ASH; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_BattleBondActivatesOnMoveEndAttacker; @@ -10629,10 +10277,10 @@ static void Cmd_various(void) } if (cmd->fromBattler) - gLastUsedItem = gBattleMons[gActiveBattler].item; + gLastUsedItem = gBattleMons[battler].item; - gBattleScripting.battler = gEffectBattler = gBattlerTarget = gActiveBattler; // Cover all berry effect battlerId cases. e.g. ChangeStatBuffs uses target ID - if (ItemBattleEffects(ITEMEFFECT_USE_LAST_ITEM, gActiveBattler, FALSE)) + gBattleScripting.battler = gEffectBattler = gBattlerTarget = battler; // Cover all berry effect battler cases. e.g. ChangeStatBuffs uses target ID + if (ItemBattleEffects(ITEMEFFECT_USE_LAST_ITEM, battler, FALSE)) return; gBattlescriptCurrInstr = cmd->nextInstr; return; @@ -10640,7 +10288,7 @@ static void Cmd_various(void) case VARIOUS_JUMP_IF_CANT_REVERT_TO_PRIMAL: { VARIOUS_ARGS(const u8 *jumpInstr); - if (GetBattleFormChangeTargetSpecies(gActiveBattler, FORM_CHANGE_BATTLE_PRIMAL_REVERSION) == SPECIES_NONE) + if (GetBattleFormChangeTargetSpecies(battler, FORM_CHANGE_BATTLE_PRIMAL_REVERSION) == SPECIES_NONE) gBattlescriptCurrInstr = cmd->jumpInstr; else gBattlescriptCurrInstr = cmd->nextInstr; @@ -10650,7 +10298,7 @@ static void Cmd_various(void) { VARIOUS_ARGS(u32 flags, const u8 *jumpInstr); u32 flags = cmd->flags; - if (IsBattlerWeatherAffected(gActiveBattler, flags)) + if (IsBattlerWeatherAffected(battler, flags)) gBattlescriptCurrInstr = cmd->jumpInstr; else gBattlescriptCurrInstr = cmd->nextInstr; @@ -10666,7 +10314,7 @@ static void Cmd_various(void) case VARIOUS_JUMP_IF_SPECIES: { VARIOUS_ARGS(u16 species, const u8 *jumpInstr); - if (gBattleMons[gActiveBattler].species == cmd->species) + if (gBattleMons[battler].species == cmd->species) gBattlescriptCurrInstr = cmd->jumpInstr; else gBattlescriptCurrInstr = cmd->nextInstr; @@ -10675,7 +10323,7 @@ static void Cmd_various(void) case VARIOUS_PHOTON_GEYSER_CHECK: { VARIOUS_ARGS(); - gBattleStruct->swapDamageCategory = (GetSplitBasedOnStats(gActiveBattler) == SPLIT_SPECIAL); + gBattleStruct->swapDamageCategory = (GetSplitBasedOnStats(battler) == SPLIT_SPECIAL); break; } case VARIOUS_SHELL_SIDE_ARM_CHECK: // 0% chance GameFreak actually checks this way according to DaWobblefet, but this is the only functional explanation at the moment @@ -10719,9 +10367,9 @@ static void Cmd_various(void) case VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED: { VARIOUS_ARGS(const u8 *jumpInstr); - if (IsLeafGuardProtected(gActiveBattler)) + if (IsLeafGuardProtected(battler)) { - gBattlerAbility = gActiveBattler; + gBattlerAbility = battler; gBattlescriptCurrInstr = cmd->jumpInstr; } else @@ -10737,8 +10385,8 @@ static void Cmd_various(void) // If Pokémon which set up Sticky Web is not on the field, no Pokémon have their Speed lowered." gBattlerAttacker = gBattlerTarget; // Initialize 'fail' condition SET_STATCHANGER(STAT_SPEED, 1, TRUE); - if (gSideTimers[GetBattlerSide(gActiveBattler)].stickyWebBattlerId != 0xFF) - gBattlerAttacker = gSideTimers[GetBattlerSide(gActiveBattler)].stickyWebBattlerId; + if (gSideTimers[GetBattlerSide(battler)].stickyWebBattlerId != 0xFF) + gBattlerAttacker = gSideTimers[GetBattlerSide(battler)].stickyWebBattlerId; break; } case VARIOUS_CUT_1_3_HP_RAISE_STATS: @@ -10770,15 +10418,15 @@ static void Cmd_various(void) case VARIOUS_SET_OCTOLOCK: { VARIOUS_ARGS(const u8 *failInstr); - if (gDisableStructs[gActiveBattler].octolock) + if (gDisableStructs[battler].octolock) { gBattlescriptCurrInstr = cmd->failInstr; } else { - gDisableStructs[gActiveBattler].octolock = TRUE; - gBattleMons[gActiveBattler].status2 |= STATUS2_ESCAPE_PREVENTION; - gDisableStructs[gActiveBattler].battlerPreventingEscape = gBattlerAttacker; + gDisableStructs[battler].octolock = TRUE; + gBattleMons[battler].status2 |= STATUS2_ESCAPE_PREVENTION; + gDisableStructs[battler].battlerPreventingEscape = gBattlerAttacker; gBattlescriptCurrInstr = cmd->nextInstr; } return; @@ -10786,16 +10434,16 @@ static void Cmd_various(void) case VARIOUS_CHECK_POLTERGEIST: { VARIOUS_ARGS(const u8 *failInstr); - if (gBattleMons[gActiveBattler].item == ITEM_NONE + if (gBattleMons[battler].item == ITEM_NONE || gFieldStatuses & STATUS_FIELD_MAGIC_ROOM - || GetBattlerAbility(gActiveBattler) == ABILITY_KLUTZ) + || GetBattlerAbility(battler) == ABILITY_KLUTZ) { gBattlescriptCurrInstr = cmd->failInstr; } else { - PREPARE_ITEM_BUFFER(gBattleTextBuff1, gBattleMons[gActiveBattler].item); - gLastUsedItem = gBattleMons[gActiveBattler].item; + PREPARE_ITEM_BUFFER(gBattleTextBuff1, gBattleMons[battler].item); + gLastUsedItem = gBattleMons[battler].item; gBattlescriptCurrInstr = cmd->nextInstr; } return; @@ -10803,14 +10451,14 @@ static void Cmd_various(void) case VARIOUS_TRY_NO_RETREAT: { VARIOUS_ARGS(const u8 *failInstr); - if (gDisableStructs[gActiveBattler].noRetreat) + if (gDisableStructs[battler].noRetreat) { gBattlescriptCurrInstr = cmd->failInstr; } else { - if (!(gBattleMons[gActiveBattler].status2 & STATUS2_ESCAPE_PREVENTION)) - gDisableStructs[gActiveBattler].noRetreat = TRUE; + if (!(gBattleMons[battler].status2 & STATUS2_ESCAPE_PREVENTION)) + gDisableStructs[battler].noRetreat = TRUE; gBattlescriptCurrInstr = cmd->nextInstr; } return; @@ -10818,13 +10466,13 @@ static void Cmd_various(void) case VARIOUS_TRY_TAR_SHOT: { VARIOUS_ARGS(const u8 *failInstr); - if (gDisableStructs[gActiveBattler].tarShot) + if (gDisableStructs[battler].tarShot) { gBattlescriptCurrInstr = cmd->failInstr; } else { - gDisableStructs[gActiveBattler].tarShot = TRUE; + gDisableStructs[battler].tarShot = TRUE; gBattlescriptCurrInstr = cmd->nextInstr; } return; @@ -10833,8 +10481,8 @@ static void Cmd_various(void) { VARIOUS_ARGS(const u8 *failInstr); // Tar Shot will fail if it's already been used on the target and its speed can't be lowered further - if (!gDisableStructs[gActiveBattler].tarShot - && CompareStat(gActiveBattler, STAT_SPEED, MAX_STAT_STAGE, CMP_LESS_THAN)) + if (!gDisableStructs[battler].tarShot + && CompareStat(battler, STAT_SPEED, MAX_STAT_STAGE, CMP_LESS_THAN)) gBattlescriptCurrInstr = cmd->nextInstr; else gBattlescriptCurrInstr = cmd->failInstr; @@ -10844,43 +10492,43 @@ static void Cmd_various(void) { VARIOUS_ARGS(); // Check infatuation - if (gBattleMons[gActiveBattler].status2 & STATUS2_INFATUATION) + if (gBattleMons[battler].status2 & STATUS2_INFATUATION) { - gBattleMons[gActiveBattler].status2 &= ~(STATUS2_INFATUATION); + gBattleMons[battler].status2 &= ~(STATUS2_INFATUATION); gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_INFATUATION; // STRINGID_TARGETGOTOVERINFATUATION StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn); } // Check taunt - if (gDisableStructs[gActiveBattler].tauntTimer != 0) + if (gDisableStructs[battler].tauntTimer != 0) { - gDisableStructs[gActiveBattler].tauntTimer = 0; + gDisableStructs[battler].tauntTimer = 0; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TAUNT; PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT); } // Check encore - if (gDisableStructs[gActiveBattler].encoreTimer != 0) + if (gDisableStructs[battler].encoreTimer != 0) { - gDisableStructs[gActiveBattler].encoredMove = 0; - gDisableStructs[gActiveBattler].encoreTimer = 0; + gDisableStructs[battler].encoredMove = 0; + gDisableStructs[battler].encoreTimer = 0; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_ENCORE; // STRINGID_PKMNENCOREENDED } // Check torment - if (gBattleMons[gActiveBattler].status2 & STATUS2_TORMENT) + if (gBattleMons[battler].status2 & STATUS2_TORMENT) { - gBattleMons[gActiveBattler].status2 &= ~(STATUS2_TORMENT); + gBattleMons[battler].status2 &= ~(STATUS2_TORMENT); gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TORMENT; } // Check heal block - if (gStatuses3[gActiveBattler] & STATUS3_HEAL_BLOCK) + if (gStatuses3[battler] & STATUS3_HEAL_BLOCK) { - gStatuses3[gActiveBattler] &= ~(STATUS3_HEAL_BLOCK); + gStatuses3[battler] &= ~(STATUS3_HEAL_BLOCK); gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_HEALBLOCK; } // Check disable - if (gDisableStructs[gActiveBattler].disableTimer != 0) + if (gDisableStructs[battler].disableTimer != 0) { - gDisableStructs[gActiveBattler].disableTimer = 0; - gDisableStructs[gActiveBattler].disabledMove = 0; + gDisableStructs[battler].disableTimer = 0; + gDisableStructs[battler].disabledMove = 0; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_DISABLE; } gBattlescriptCurrInstr = cmd->nextInstr; @@ -10889,10 +10537,10 @@ static void Cmd_various(void) case VARIOUS_TRY_RESET_NEGATIVE_STAT_STAGES: { VARIOUS_ARGS(); - gActiveBattler = gBattlerTarget; + battler = gBattlerTarget; for (i = 0; i < NUM_BATTLE_STATS; i++) - if (gBattleMons[gActiveBattler].statStages[i] < DEFAULT_STAT_STAGE) - gBattleMons[gActiveBattler].statStages[i] = DEFAULT_STAT_STAGE; + if (gBattleMons[battler].statStages[i] < DEFAULT_STAT_STAGE) + gBattleMons[battler].statStages[i] = DEFAULT_STAT_STAGE; gBattlescriptCurrInstr = cmd->nextInstr; return; } @@ -10917,25 +10565,25 @@ static void Cmd_various(void) case VARIOUS_SAVE_BATTLER_ITEM: { VARIOUS_ARGS(); - gBattleResources->battleHistory->heldItems[gActiveBattler] = gBattleMons[gActiveBattler].item; + gBattleResources->battleHistory->heldItems[battler] = gBattleMons[battler].item; break; } case VARIOUS_RESTORE_BATTLER_ITEM: { VARIOUS_ARGS(); - gBattleMons[gActiveBattler].item = gBattleResources->battleHistory->heldItems[gActiveBattler]; + gBattleMons[battler].item = gBattleResources->battleHistory->heldItems[battler]; break; } case VARIOUS_BATTLER_ITEM_TO_LAST_USED_ITEM: { VARIOUS_ARGS(); - gBattleMons[gActiveBattler].item = gLastUsedItem; + gBattleMons[battler].item = gLastUsedItem; break; } case VARIOUS_SET_BEAK_BLAST: { VARIOUS_ARGS(); - gProtectStructs[gActiveBattler].beakBlastCharge = TRUE; + gProtectStructs[battler].beakBlastCharge = TRUE; break; } case VARIOUS_SWAP_SIDE_STATUSES: @@ -10995,49 +10643,22 @@ static void Cmd_various(void) case VARIOUS_TEATIME_INVUL: { VARIOUS_ARGS(const u8 *jumpInstr); - if (ItemId_GetPocket(gBattleMons[gActiveBattler].item) == POCKET_BERRIES && !(gStatuses3[gBattlerTarget] & (STATUS3_SEMI_INVULNERABLE))) + if (ItemId_GetPocket(gBattleMons[battler].item) == POCKET_BERRIES && !(gStatuses3[gBattlerTarget] & (STATUS3_SEMI_INVULNERABLE))) gBattlescriptCurrInstr = cmd->nextInstr; else gBattlescriptCurrInstr = cmd->jumpInstr; return; } - case VARIOUS_JUMP_IF_ROD: - { - VARIOUS_ARGS(const u8 *jumpInstr); - if (IsAbilityRodAffected()) - gBattlescriptCurrInstr = cmd->jumpInstr; - else - gBattlescriptCurrInstr = cmd->nextInstr; - return; - } - case VARIOUS_JUMP_IF_MOTOR: - { - VARIOUS_ARGS(const u8 *jumpInstr); - if (IsAbilityMotorAffected()) - gBattlescriptCurrInstr = cmd->jumpInstr; - else - gBattlescriptCurrInstr = cmd->nextInstr; - return; - } - case VARIOUS_JUMP_IF_ABSORB: - { - VARIOUS_ARGS(const u8 *jumpInstr); - if (IsAbilityAbsorbAffected()) - gBattlescriptCurrInstr = cmd->jumpInstr; - else - gBattlescriptCurrInstr = cmd->nextInstr; - return; - } case VARIOUS_TRY_WIND_RIDER_POWER: { VARIOUS_ARGS(const u8 *failInstr); - u16 ability = GetBattlerAbility(gActiveBattler); - if (GetBattlerSide(gActiveBattler) == GetBattlerSide(gBattlerAttacker) + u16 ability = GetBattlerAbility(battler); + if (GetBattlerSide(battler) == GetBattlerSide(gBattlerAttacker) && (ability == ABILITY_WIND_RIDER || ability == ABILITY_WIND_POWER)) { gLastUsedAbility = ability; - RecordAbilityBattle(gActiveBattler, gLastUsedAbility); - gBattlerAbility = gBattleScripting.battler = gActiveBattler; + RecordAbilityBattle(battler, gLastUsedAbility); + gBattlerAbility = gBattleScripting.battler = battler; gBattlescriptCurrInstr = cmd->nextInstr; } else @@ -11050,32 +10671,23 @@ static void Cmd_various(void) { VARIOUS_ARGS(); gBattlescriptCurrInstr = cmd->nextInstr; - AbilityBattleEffects(ABILITYEFFECT_ON_WEATHER, gActiveBattler, 0, 0, 0); + AbilityBattleEffects(ABILITYEFFECT_ON_WEATHER, battler, 0, 0, 0); return; } case VARIOUS_ACTIVATE_TERRAIN_CHANGE_ABILITIES: { VARIOUS_ARGS(); gBattlescriptCurrInstr = cmd->nextInstr; - AbilityBattleEffects(ABILITYEFFECT_ON_TERRAIN, gActiveBattler, 0, 0, 0); - return; - } - case VARIOUS_JUMP_IF_EMERGENCY_EXITED: - { - VARIOUS_ARGS(const u8 *jumpInstr); - if (gSpecialStatuses[gActiveBattler].emergencyExited) - gBattlescriptCurrInstr = cmd->jumpInstr; - else - gBattlescriptCurrInstr = cmd->nextInstr; + AbilityBattleEffects(ABILITYEFFECT_ON_TERRAIN, battler, 0, 0, 0); return; } case VARIOUS_STORE_HEALING_WISH: { VARIOUS_ARGS(); if (gCurrentMove == MOVE_LUNAR_DANCE) - gBattleStruct->storedLunarDance |= gBitTable[gActiveBattler]; + gBattleStruct->storedLunarDance |= gBitTable[battler]; else - gBattleStruct->storedHealingWish |= gBitTable[gActiveBattler]; + gBattleStruct->storedHealingWish |= gBitTable[battler]; break; } case VARIOUS_HIT_SWITCH_TARGET_FAILED: @@ -11085,15 +10697,6 @@ static void Cmd_various(void) gBattlescriptCurrInstr = cmd->nextInstr; return; } - case VARIOUS_JUMP_IF_SHELL_TRAP: - { - VARIOUS_ARGS(const u8 *jumpInstr); - if (gProtectStructs[gActiveBattler].shellTrap) - gBattlescriptCurrInstr = cmd->jumpInstr; - else - gBattlescriptCurrInstr = cmd->nextInstr; - return; - } case VARIOUS_TRY_REVIVAL_BLESSING: { VARIOUS_ARGS(const u8 *failInstr); @@ -11113,7 +10716,7 @@ static void Cmd_various(void) struct Pokemon *party = GetSideParty(side); u16 hp = GetMonData(&party[gSelectedMonPartyId], MON_DATA_MAX_HP) / 2; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_HP_BATTLE, gBitTable[gSelectedMonPartyId], sizeof(hp), &hp); + BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_HP_BATTLE, gBitTable[gSelectedMonPartyId], sizeof(hp), &hp); MarkBattlerForControllerExec(gBattlerAttacker); PREPARE_SPECIES_BUFFER(gBattleTextBuff1, GetMonData(&party[gSelectedMonPartyId], MON_DATA_SPECIES)); @@ -11133,7 +10736,7 @@ static void Cmd_various(void) // Open party menu, wait to go to next instruction. else { - BtlController_EmitChoosePokemon(BUFFER_A, PARTY_ACTION_CHOOSE_FAINTED_MON, PARTY_SIZE, ABILITY_NONE, gBattleStruct->battlerPartyOrders[gBattlerAttacker]); + BtlController_EmitChoosePokemon(gBattlerAttacker, BUFFER_A, PARTY_ACTION_CHOOSE_FAINTED_MON, PARTY_SIZE, ABILITY_NONE, gBattleStruct->battlerPartyOrders[gBattlerAttacker]); MarkBattlerForControllerExec(gBattlerAttacker); } return; @@ -11141,9 +10744,9 @@ static void Cmd_various(void) case VARIOUS_TRY_TRAINER_SLIDE_MSG_Z_MOVE: { VARIOUS_ARGS(); - if ((i = ShouldDoTrainerSlide(gActiveBattler, TRAINER_SLIDE_Z_MOVE))) + if ((i = ShouldDoTrainerSlide(battler, TRAINER_SLIDE_Z_MOVE))) { - gBattleScripting.battler = gActiveBattler; + gBattleScripting.battler = battler; BattleScriptPush(cmd->nextInstr); gBattlescriptCurrInstr = (i == 1 ? BattleScript_TrainerASlideMsgRet : BattleScript_TrainerBSlideMsgRet); return; @@ -11153,9 +10756,9 @@ static void Cmd_various(void) case VARIOUS_TRY_TRAINER_SLIDE_MSG_MEGA_EVOLUTION: { VARIOUS_ARGS(); - if ((i = ShouldDoTrainerSlide(gActiveBattler, TRAINER_SLIDE_MEGA_EVOLUTION))) + if ((i = ShouldDoTrainerSlide(battler, TRAINER_SLIDE_MEGA_EVOLUTION))) { - gBattleScripting.battler = gActiveBattler; + gBattleScripting.battler = battler; BattleScriptPush(cmd->nextInstr); gBattlescriptCurrInstr = (i == 1 ? BattleScript_TrainerASlideMsgRet : BattleScript_TrainerBSlideMsgRet); return; @@ -11174,7 +10777,7 @@ static void Cmd_setprotectlike(void) bool32 fail = TRUE; bool32 notLastTurn = TRUE; - if (!(gBattleMoves[gLastResultingMoves[gBattlerAttacker]].flags & FLAG_PROTECTION_MOVE)) + if (!gBattleMoves[gLastResultingMoves[gBattlerAttacker]].protectionMove) gDisableStructs[gBattlerAttacker].protectUses = 0; if (gCurrentTurnActionNumber == (gBattlersCount - 1)) @@ -11283,10 +10886,9 @@ static void Cmd_tryexplosion(void) return; } - gActiveBattler = gBattlerAttacker; - gBattleMoveDamage = gBattleMons[gActiveBattler].hp; - BtlController_EmitHealthBarUpdate(BUFFER_A, INSTANT_HP_BAR_DROP); - MarkBattlerForControllerExec(gActiveBattler); + gBattleMoveDamage = gBattleMons[gBattlerAttacker].hp; + BtlController_EmitHealthBarUpdate(gBattlerAttacker, BUFFER_A, INSTANT_HP_BAR_DROP); + MarkBattlerForControllerExec(gBattlerAttacker); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -11297,10 +10899,9 @@ static void Cmd_setatkhptozero(void) if (gBattleControllerExecFlags) return; - gActiveBattler = gBattlerAttacker; - gBattleMons[gActiveBattler].hp = 0; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_HP_BATTLE, 0, sizeof(gBattleMons[gActiveBattler].hp), &gBattleMons[gActiveBattler].hp); - MarkBattlerForControllerExec(gActiveBattler); + gBattleMons[gBattlerAttacker].hp = 0; + BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_HP_BATTLE, 0, sizeof(gBattleMons[gBattlerAttacker].hp), &gBattleMons[gBattlerAttacker].hp); + MarkBattlerForControllerExec(gBattlerAttacker); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -11411,21 +11012,21 @@ static void Cmd_setreflect(void) { CMD_ARGS(); - if (gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] & SIDE_STATUS_REFLECT) + if (gSideStatuses[GetBattlerSide(gBattlerAttacker)] & SIDE_STATUS_REFLECT) { gMoveResultFlags |= MOVE_RESULT_MISSED; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SIDE_STATUS_FAILED; } else { - gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_REFLECT; + gSideStatuses[GetBattlerSide(gBattlerAttacker)] |= SIDE_STATUS_REFLECT; if (GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_LIGHT_CLAY) - gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].reflectTimer = 8; + gSideTimers[GetBattlerSide(gBattlerAttacker)].reflectTimer = 8; else - gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].reflectTimer = 5; - gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].reflectBattlerId = gBattlerAttacker; + gSideTimers[GetBattlerSide(gBattlerAttacker)].reflectTimer = 5; + gSideTimers[GetBattlerSide(gBattlerAttacker)].reflectBattlerId = gBattlerAttacker; - if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_ATK_SIDE) == 2) + if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_SIDE, gBattlerAttacker) == 2) gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_REFLECT_DOUBLE; else gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_REFLECT_SINGLE; @@ -11511,7 +11112,7 @@ static void Cmd_trysetrest(void) CMD_ARGS(const u8 *failInstr); const u8 *failInstr = cmd->failInstr; - gActiveBattler = gBattlerTarget = gBattlerAttacker; + gBattlerTarget = gBattlerAttacker; gBattleMoveDamage = gBattleMons[gBattlerTarget].maxHP * (-1); if (gBattleMons[gBattlerTarget].hp == gBattleMons[gBattlerTarget].maxHP) @@ -11534,8 +11135,8 @@ static void Cmd_trysetrest(void) gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_REST; gBattleMons[gBattlerTarget].status1 = STATUS1_SLEEP_TURN(3); - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gActiveBattler].status1), &gBattleMons[gActiveBattler].status1); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(gBattlerTarget, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].status1), &gBattleMons[gBattlerTarget].status1); + MarkBattlerForControllerExec(gBattlerTarget); gBattlescriptCurrInstr = cmd->nextInstr; } } @@ -11567,13 +11168,13 @@ static void Cmd_setmiracleeye(void) } } -bool8 UproarWakeUpCheck(u8 battlerId) +bool8 UproarWakeUpCheck(u8 battler) { s32 i; for (i = 0; i < gBattlersCount; i++) { - if (!(gBattleMons[i].status2 & STATUS2_UPROAR) || GetBattlerAbility(battlerId) == ABILITY_SOUNDPROOF) + if (!(gBattleMons[i].status2 & STATUS2_UPROAR) || GetBattlerAbility(battler) == ABILITY_SOUNDPROOF) continue; gBattleScripting.battler = i; @@ -11784,19 +11385,19 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr { bool32 certain = FALSE; bool32 notProtectAffected = FALSE; - u32 index; - u16 activeBattlerAbility; + u32 index, battler, battlerAbility, battlerHoldEffect; bool32 affectsUser = (flags & MOVE_EFFECT_AFFECTS_USER); bool32 mirrorArmored = (flags & STAT_CHANGE_MIRROR_ARMOR); if (affectsUser) - gActiveBattler = gBattlerAttacker; + battler = gBattlerAttacker; else - gActiveBattler = gBattlerTarget; + battler = gBattlerTarget; - activeBattlerAbility = GetBattlerAbility(gActiveBattler); + battlerAbility = GetBattlerAbility(battler); + battlerHoldEffect = GetBattlerHoldEffect(battler, TRUE); - gSpecialStatuses[gActiveBattler].changedStatsBattlerId = gBattlerAttacker; + gSpecialStatuses[battler].changedStatsBattlerId = gBattlerAttacker; flags &= ~(MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_MIRROR_ARMOR); @@ -11808,7 +11409,7 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr notProtectAffected++; flags &= ~STAT_CHANGE_NOT_PROTECT_AFFECTED; - if (activeBattlerAbility == ABILITY_CONTRARY) + if (battlerAbility == ABILITY_CONTRARY) { statValue ^= STAT_BUFF_NEGATIVE; gBattleScripting.statChanger ^= STAT_BUFF_NEGATIVE; @@ -11818,7 +11419,7 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr gBattleScripting.moveEffect = ReverseStatChangeMoveEffect(gBattleScripting.moveEffect); } } - else if (activeBattlerAbility == ABILITY_SIMPLE) + else if (battlerAbility == ABILITY_SIMPLE) { statValue = (SET_STAT_BUFF_VALUE(GET_STAT_BUFF_VALUE(statValue) * 2)) | ((statValue <= -1) ? STAT_BUFF_NEGATIVE : 0); } @@ -11827,22 +11428,22 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr if (statValue <= -1) // Stat decrease. { - if (gSideTimers[GET_BATTLER_SIDE(gActiveBattler)].mistTimer + if (gSideTimers[GetBattlerSide(battler)].mistTimer && !certain && gCurrentMove != MOVE_CURSE - && !(gActiveBattler == gBattlerTarget && GetBattlerAbility(gBattlerAttacker) == ABILITY_INFILTRATOR)) + && !(battler == gBattlerTarget && GetBattlerAbility(gBattlerAttacker) == ABILITY_INFILTRATOR)) { if (flags == STAT_CHANGE_ALLOW_PTR) { - if (gSpecialStatuses[gActiveBattler].statLowered) + if (gSpecialStatuses[battler].statLowered) { gBattlescriptCurrInstr = BS_ptr; } else { BattleScriptPush(BS_ptr); - gBattleScripting.battler = gActiveBattler; + gBattleScripting.battler = battler; gBattlescriptCurrInstr = BattleScript_MistProtected; - gSpecialStatuses[gActiveBattler].statLowered = TRUE; + gSpecialStatuses[battler].statLowered = TRUE; } } return STAT_CHANGE_DIDNT_WORK; @@ -11853,108 +11454,108 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr gBattlescriptCurrInstr = BattleScript_ButItFailed; return STAT_CHANGE_DIDNT_WORK; } - else if ((GetBattlerHoldEffect(gActiveBattler, TRUE) == HOLD_EFFECT_CLEAR_AMULET - || activeBattlerAbility == ABILITY_CLEAR_BODY - || activeBattlerAbility == ABILITY_FULL_METAL_BODY - || activeBattlerAbility == ABILITY_WHITE_SMOKE) + else if ((battlerHoldEffect == HOLD_EFFECT_CLEAR_AMULET + || battlerAbility == ABILITY_CLEAR_BODY + || battlerAbility == ABILITY_FULL_METAL_BODY + || battlerAbility == ABILITY_WHITE_SMOKE) && (!affectsUser || mirrorArmored) && !certain && gCurrentMove != MOVE_CURSE) { - if (GetBattlerHoldEffect(gActiveBattler, TRUE) == HOLD_EFFECT_CLEAR_AMULET) + if (battlerHoldEffect == HOLD_EFFECT_CLEAR_AMULET) { - RecordItemEffectBattle(gActiveBattler, HOLD_EFFECT_CLEAR_AMULET); + RecordItemEffectBattle(battler, HOLD_EFFECT_CLEAR_AMULET); } if (flags == STAT_CHANGE_ALLOW_PTR) { - if (gSpecialStatuses[gActiveBattler].statLowered) + if (gSpecialStatuses[battler].statLowered) { gBattlescriptCurrInstr = BS_ptr; } else { BattleScriptPush(BS_ptr); - gBattleScripting.battler = gActiveBattler; - if (GetBattlerHoldEffect(gActiveBattler, TRUE) == HOLD_EFFECT_CLEAR_AMULET) + gBattleScripting.battler = battler; + if (battlerHoldEffect == HOLD_EFFECT_CLEAR_AMULET) { gBattlescriptCurrInstr = BattleScript_ItemNoStatLoss; } else { - gBattlerAbility = gActiveBattler; + gBattlerAbility = battler; gBattlescriptCurrInstr = BattleScript_AbilityNoStatLoss; - gLastUsedAbility = activeBattlerAbility; - RecordAbilityBattle(gActiveBattler, gLastUsedAbility); + gLastUsedAbility = battlerAbility; + RecordAbilityBattle(battler, gLastUsedAbility); } - gSpecialStatuses[gActiveBattler].statLowered = TRUE; + gSpecialStatuses[battler].statLowered = TRUE; } } return STAT_CHANGE_DIDNT_WORK; } - else if ((index = IsFlowerVeilProtected(gActiveBattler)) && !certain) + else if ((index = IsFlowerVeilProtected(battler)) && !certain) { if (flags == STAT_CHANGE_ALLOW_PTR) { - if (gSpecialStatuses[gActiveBattler].statLowered) + if (gSpecialStatuses[battler].statLowered) { gBattlescriptCurrInstr = BS_ptr; } else { BattleScriptPush(BS_ptr); - gBattleScripting.battler = gActiveBattler; + gBattleScripting.battler = battler; gBattlerAbility = index - 1; gBattlescriptCurrInstr = BattleScript_FlowerVeilProtectsRet; gLastUsedAbility = ABILITY_FLOWER_VEIL; - gSpecialStatuses[gActiveBattler].statLowered = TRUE; + gSpecialStatuses[battler].statLowered = TRUE; } } return STAT_CHANGE_DIDNT_WORK; } else if (!certain - && ((activeBattlerAbility == ABILITY_KEEN_EYE && statId == STAT_ACC) - || (activeBattlerAbility == ABILITY_HYPER_CUTTER && statId == STAT_ATK) - || (activeBattlerAbility == ABILITY_BIG_PECKS && statId == STAT_DEF))) + && ((battlerAbility == ABILITY_KEEN_EYE && statId == STAT_ACC) + || (battlerAbility == ABILITY_HYPER_CUTTER && statId == STAT_ATK) + || (battlerAbility == ABILITY_BIG_PECKS && statId == STAT_DEF))) { if (flags == STAT_CHANGE_ALLOW_PTR) { BattleScriptPush(BS_ptr); - gBattleScripting.battler = gActiveBattler; - gBattlerAbility = gActiveBattler; + gBattleScripting.battler = battler; + gBattlerAbility = battler; gBattlescriptCurrInstr = BattleScript_AbilityNoSpecificStatLoss; - gLastUsedAbility = activeBattlerAbility; - RecordAbilityBattle(gActiveBattler, gLastUsedAbility); + gLastUsedAbility = battlerAbility; + RecordAbilityBattle(battler, gLastUsedAbility); } return STAT_CHANGE_DIDNT_WORK; } - else if (activeBattlerAbility == ABILITY_MIRROR_ARMOR && !affectsUser && !mirrorArmored && gBattlerAttacker != gBattlerTarget && gActiveBattler == gBattlerTarget) + else if (battlerAbility == ABILITY_MIRROR_ARMOR && !affectsUser && !mirrorArmored && gBattlerAttacker != gBattlerTarget && battler == gBattlerTarget) { if (flags == STAT_CHANGE_ALLOW_PTR) { SET_STATCHANGER(statId, GET_STAT_BUFF_VALUE(statValue) | STAT_BUFF_NEGATIVE, TRUE); BattleScriptPush(BS_ptr); - gBattleScripting.battler = gActiveBattler; - gBattlerAbility = gActiveBattler; + gBattleScripting.battler = battler; + gBattlerAbility = battler; gBattlescriptCurrInstr = BattleScript_MirrorArmorReflect; - RecordAbilityBattle(gActiveBattler, gBattleMons[gActiveBattler].ability); + RecordAbilityBattle(battler, gBattleMons[battler].ability); } return STAT_CHANGE_DIDNT_WORK; } - else if (activeBattlerAbility == ABILITY_SHIELD_DUST && flags == 0) + else if (battlerAbility == ABILITY_SHIELD_DUST && flags == 0) { - RecordAbilityBattle(gActiveBattler, ABILITY_SHIELD_DUST); + RecordAbilityBattle(battler, ABILITY_SHIELD_DUST); return STAT_CHANGE_DIDNT_WORK; } - else if (flags == 0 && GetBattlerHoldEffect(gActiveBattler, TRUE) == HOLD_EFFECT_COVERT_CLOAK) + else if (flags == 0 && battlerHoldEffect == HOLD_EFFECT_COVERT_CLOAK) { - RecordItemEffectBattle(gActiveBattler, HOLD_EFFECT_COVERT_CLOAK); + RecordItemEffectBattle(battler, HOLD_EFFECT_COVERT_CLOAK); return STAT_CHANGE_DIDNT_WORK; } else // try to decrease { statValue = -GET_STAT_BUFF_VALUE(statValue); - if (gBattleMons[gActiveBattler].statStages[statId] == 1) + if (gBattleMons[battler].statStages[statId] == 1) statValue = -1; - else if (gBattleMons[gActiveBattler].statStages[statId] == 2 && statValue < -2) + else if (gBattleMons[battler].statStages[statId] == 2 && statValue < -2) statValue = -2; gBattleTextBuff2[0] = B_BUFF_PLACEHOLDER_BEGIN; index = 1; @@ -11977,23 +11578,23 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr gBattleTextBuff2[index++] = STRINGID_STATFELL >> 8; gBattleTextBuff2[index] = B_BUFF_EOS; - if (gBattleMons[gActiveBattler].statStages[statId] == MIN_STAT_STAGE) + if (gBattleMons[battler].statStages[statId] == MIN_STAT_STAGE) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STAT_WONT_DECREASE; } else { - gProtectStructs[gActiveBattler].statFell = TRUE; // Eject pack, lash out - gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler); // B_MSG_ATTACKER_STAT_FELL or B_MSG_DEFENDER_STAT_FELL + gProtectStructs[battler].statFell = TRUE; // Eject pack, lash out + gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == battler); // B_MSG_ATTACKER_STAT_FELL or B_MSG_DEFENDER_STAT_FELL } } } else // stat increase { statValue = GET_STAT_BUFF_VALUE(statValue); - if (gBattleMons[gActiveBattler].statStages[statId] == 11) + if (gBattleMons[battler].statStages[statId] == 11) statValue = 1; - else if (gBattleMons[gActiveBattler].statStages[statId] == 10 && statValue > 2) + else if (gBattleMons[battler].statStages[statId] == 10 && statValue > 2) statValue = 2; gBattleTextBuff2[0] = B_BUFF_PLACEHOLDER_BEGIN; index = 1; @@ -12016,19 +11617,19 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr gBattleTextBuff2[index++] = STRINGID_STATROSE >> 8; gBattleTextBuff2[index] = B_BUFF_EOS; - if (gBattleMons[gActiveBattler].statStages[statId] == MAX_STAT_STAGE) + if (gBattleMons[battler].statStages[statId] == MAX_STAT_STAGE) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STAT_WONT_INCREASE; } else { - gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler); - gProtectStructs[gActiveBattler].statRaised = TRUE; + gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == battler); + gProtectStructs[battler].statRaised = TRUE; // check mirror herb for (index = 0; index < gBattlersCount; index++) { - if (GetBattlerSide(index) == GetBattlerSide(gActiveBattler)) + if (GetBattlerSide(index) == GetBattlerSide(battler)) continue; // Only triggers on opposing side if (GetBattlerHoldEffect(index, TRUE) == HOLD_EFFECT_MIRROR_HERB && gBattleMons[index].statStages[statId] < MAX_STAT_STAGE) @@ -12041,11 +11642,11 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr } } - gBattleMons[gActiveBattler].statStages[statId] += statValue; - if (gBattleMons[gActiveBattler].statStages[statId] < MIN_STAT_STAGE) - gBattleMons[gActiveBattler].statStages[statId] = MIN_STAT_STAGE; - if (gBattleMons[gActiveBattler].statStages[statId] > MAX_STAT_STAGE) - gBattleMons[gActiveBattler].statStages[statId] = MAX_STAT_STAGE; + gBattleMons[battler].statStages[statId] += statValue; + if (gBattleMons[battler].statStages[statId] < MIN_STAT_STAGE) + gBattleMons[battler].statStages[statId] = MIN_STAT_STAGE; + if (gBattleMons[battler].statStages[statId] > MAX_STAT_STAGE) + gBattleMons[battler].statStages[statId] = MAX_STAT_STAGE; if (gBattleCommunication[MULTISTRING_CHOOSER] == B_MSG_STAT_WONT_INCREASE && flags & STAT_CHANGE_ALLOW_PTR) gMoveResultFlags |= MOVE_RESULT_MISSED; @@ -12423,7 +12024,7 @@ static void Cmd_tryconversiontypechange(void) { do { - while ((moveChecked = Random() & (MAX_MON_MOVES - 1)) >= validMoves); + while ((moveChecked = MOD(Random(), MAX_MON_MOVES)) >= validMoves); moveType = gBattleMoves[gBattleMons[gBattlerAttacker].moves[moveChecked]].type; @@ -12469,21 +12070,21 @@ static void Cmd_setlightscreen(void) { CMD_ARGS(); - if (gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] & SIDE_STATUS_LIGHTSCREEN) + if (gSideStatuses[GetBattlerSide(gBattlerAttacker)] & SIDE_STATUS_LIGHTSCREEN) { gMoveResultFlags |= MOVE_RESULT_MISSED; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SIDE_STATUS_FAILED; } else { - gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_LIGHTSCREEN; + gSideStatuses[GetBattlerSide(gBattlerAttacker)] |= SIDE_STATUS_LIGHTSCREEN; if (GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_LIGHT_CLAY) - gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].lightscreenTimer = 8; + gSideTimers[GetBattlerSide(gBattlerAttacker)].lightscreenTimer = 8; else - gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].lightscreenTimer = 5; - gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].lightscreenBattlerId = gBattlerAttacker; + gSideTimers[GetBattlerSide(gBattlerAttacker)].lightscreenTimer = 5; + gSideTimers[GetBattlerSide(gBattlerAttacker)].lightscreenBattlerId = gBattlerAttacker; - if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_ATK_SIDE) == 2) + if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_SIDE, gBattlerAttacker) == 2) gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_LIGHTSCREEN_DOUBLE; else gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_LIGHTSCREEN_SINGLE; @@ -12706,32 +12307,33 @@ static void Cmd_tryinfatuating(void) static void Cmd_updatestatusicon(void) { CMD_ARGS(u8 battler); + u32 battler; if (gBattleControllerExecFlags) return; if (cmd->battler != BS_ATTACKER_WITH_PARTNER) { - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - BtlController_EmitStatusIconUpdate(BUFFER_A, gBattleMons[gActiveBattler].status1, gBattleMons[gActiveBattler].status2); - MarkBattlerForControllerExec(gActiveBattler); + battler = GetBattlerForBattleScript(cmd->battler); + BtlController_EmitStatusIconUpdate(battler, BUFFER_A, gBattleMons[battler].status1, gBattleMons[battler].status2); + MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; } else { - gActiveBattler = gBattlerAttacker; - if (!(gAbsentBattlerFlags & gBitTable[gActiveBattler])) + battler = gBattlerAttacker; + if (!(gAbsentBattlerFlags & gBitTable[battler])) { - BtlController_EmitStatusIconUpdate(BUFFER_A, gBattleMons[gActiveBattler].status1, gBattleMons[gActiveBattler].status2); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitStatusIconUpdate(battler, BUFFER_A, gBattleMons[battler].status1, gBattleMons[battler].status2); + MarkBattlerForControllerExec(battler); } if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) { - gActiveBattler = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker))); - if (!(gAbsentBattlerFlags & gBitTable[gActiveBattler])) + battler = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker))); + if (!(gAbsentBattlerFlags & gBitTable[battler])) { - BtlController_EmitStatusIconUpdate(BUFFER_A, gBattleMons[gActiveBattler].status1, gBattleMons[gActiveBattler].status2); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitStatusIconUpdate(battler, BUFFER_A, gBattleMons[battler].status1, gBattleMons[battler].status2); + MarkBattlerForControllerExec(battler); } } gBattlescriptCurrInstr = cmd->nextInstr; @@ -12742,16 +12344,16 @@ static void Cmd_setmist(void) { CMD_ARGS(); - if (gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].mistTimer) + if (gSideTimers[GetBattlerSide(gBattlerAttacker)].mistTimer) { gMoveResultFlags |= MOVE_RESULT_FAILED; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MIST_FAILED; } else { - gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].mistTimer = 5; - gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].mistBattlerId = gBattlerAttacker; - gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_MIST; + gSideTimers[GetBattlerSide(gBattlerAttacker)].mistTimer = 5; + gSideTimers[GetBattlerSide(gBattlerAttacker)].mistBattlerId = gBattlerAttacker; + gSideStatuses[GetBattlerSide(gBattlerAttacker)] |= SIDE_STATUS_MIST; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_MIST; } gBattlescriptCurrInstr = cmd->nextInstr; @@ -12817,9 +12419,12 @@ static void Cmd_transformdataexecution(void) gBattleMons[gBattlerAttacker].pp[i] = 5; } - gActiveBattler = gBattlerAttacker; - BtlController_EmitResetActionMoveSelection(BUFFER_A, RESET_MOVE_SELECTION); - MarkBattlerForControllerExec(gActiveBattler); + // update AI knowledge + RecordAllMoves(gBattlerAttacker); + RecordAbilityBattle(gBattlerAttacker, gBattleMons[gBattlerAttacker].ability); + + BtlController_EmitResetActionMoveSelection(gBattlerAttacker, BUFFER_A, RESET_MOVE_SELECTION); + MarkBattlerForControllerExec(gBattlerAttacker); gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_TRANSFORMED; } } @@ -12857,7 +12462,7 @@ static void Cmd_mimicattackcopy(void) { CMD_ARGS(const u8 *failInstr); - if ((sForbiddenMoves[gLastMoves[gBattlerTarget]] & FORBIDDEN_MIMIC) + if ((gBattleMoves[gLastMoves[gBattlerTarget]].mimicBanned) || (gBattleMons[gBattlerAttacker].status2 & STATUS2_TRANSFORMED) || gLastMoves[gBattlerTarget] == MOVE_UNAVAILABLE) { @@ -12897,7 +12502,7 @@ static void Cmd_mimicattackcopy(void) static bool32 InvalidMetronomeMove(u32 move) { return gBattleMoves[move].effect == EFFECT_PLACEHOLDER - || sForbiddenMoves[move] & FORBIDDEN_METRONOME; + || gBattleMoves[move].metronomeBanned; } static void Cmd_metronome(void) @@ -13196,7 +12801,6 @@ static void Cmd_copymovepermanently(void) gBattleMons[gBattlerAttacker].moves[gCurrMovePos] = gLastPrintedMoves[gBattlerTarget]; gBattleMons[gBattlerAttacker].pp[gCurrMovePos] = gBattleMoves[gLastPrintedMoves[gBattlerTarget]].pp; - gActiveBattler = gBattlerAttacker; for (i = 0; i < MAX_MON_MOVES; i++) { @@ -13205,8 +12809,8 @@ static void Cmd_copymovepermanently(void) } movePpData.ppBonuses = gBattleMons[gBattlerAttacker].ppBonuses; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_MOVES_PP_BATTLE, 0, sizeof(movePpData), &movePpData); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_MOVES_PP_BATTLE, 0, sizeof(movePpData), &movePpData); + MarkBattlerForControllerExec(gBattlerAttacker); PREPARE_MOVE_BUFFER(gBattleTextBuff1, gLastPrintedMoves[gBattlerTarget]) @@ -13226,18 +12830,19 @@ static bool8 IsTwoTurnsMove(u16 move) || gBattleMoves[move].effect == EFFECT_SOLAR_BEAM || gBattleMoves[move].effect == EFFECT_SEMI_INVULNERABLE || gBattleMoves[move].effect == EFFECT_BIDE - || gBattleMoves[move].effect == EFFECT_METEOR_BEAM) + || gBattleMoves[move].effect == EFFECT_METEOR_BEAM + || gBattleMoves[move].effect == EFFECT_GEOMANCY) return TRUE; else return FALSE; } // unused -static u8 AttacksThisTurn(u8 battlerId, u16 move) // Note: returns 1 if it's a charging turn, otherwise 2 +static u8 AttacksThisTurn(u8 battler, u16 move) // Note: returns 1 if it's a charging turn, otherwise 2 { // first argument is unused if (gBattleMoves[move].effect == EFFECT_SOLAR_BEAM - && IsBattlerWeatherAffected(battlerId, B_WEATHER_SUN)) + && IsBattlerWeatherAffected(battler, B_WEATHER_SUN)) return 2; if (gBattleMoves[move].effect == EFFECT_SKULL_BASH @@ -13260,7 +12865,7 @@ static void Cmd_trychoosesleeptalkmove(void) for (i = 0; i < MAX_MON_MOVES; i++) { - if ((sForbiddenMoves[gBattleMons[gBattlerAttacker].moves[i]] & FORBIDDEN_SLEEP_TALK) + if ((gBattleMoves[gBattleMons[gBattlerAttacker].moves[i]].sleepTalkBanned) || IsTwoTurnsMove(gBattleMons[gBattlerAttacker].moves[i])) { unusableMovesBits |= gBitTable[i]; @@ -13268,7 +12873,7 @@ static void Cmd_trychoosesleeptalkmove(void) } unusableMovesBits = CheckMoveLimitations(gBattlerAttacker, unusableMovesBits, ~MOVE_LIMITATION_PP); - if (unusableMovesBits == (1 << MAX_MON_MOVES) - 1) // all 4 moves cannot be chosen + if (unusableMovesBits == ALL_MOVES_MASK) // all 4 moves cannot be chosen { gBattlescriptCurrInstr = cmd->nextInstr; } @@ -13276,7 +12881,7 @@ static void Cmd_trychoosesleeptalkmove(void) { do { - movePosition = Random() & (MAX_MON_MOVES - 1); + movePosition = MOD(Random(), MAX_MON_MOVES); } while ((gBitTable[movePosition] & unusableMovesBits)); gCalledMove = gBattleMons[gBattlerAttacker].moves[movePosition]; @@ -13375,14 +12980,13 @@ static void Cmd_tryspiteppreduce(void) PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff2, 1, ppToDeduct) gBattleMons[gBattlerTarget].pp[i] -= ppToDeduct; - gActiveBattler = gBattlerTarget; - // if (MOVE_IS_PERMANENT(gActiveBattler, i)), but backwards - if (!(gDisableStructs[gActiveBattler].mimickedMoves & gBitTable[i]) - && !(gBattleMons[gActiveBattler].status2 & STATUS2_TRANSFORMED)) + // if (MOVE_IS_PERMANENT(gBattlerTarget, i)), but backwards + if (!(gDisableStructs[gBattlerTarget].mimickedMoves & gBitTable[i]) + && !(gBattleMons[gBattlerTarget].status2 & STATUS2_TRANSFORMED)) { - BtlController_EmitSetMonData(BUFFER_A, REQUEST_PPMOVE1_BATTLE + i, 0, sizeof(gBattleMons[gActiveBattler].pp[i]), &gBattleMons[gActiveBattler].pp[i]); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(gBattlerTarget, BUFFER_A, REQUEST_PPMOVE1_BATTLE + i, 0, sizeof(gBattleMons[gBattlerTarget].pp[i]), &gBattleMons[gBattlerTarget].pp[i]); + MarkBattlerForControllerExec(gBattlerTarget); } gBattlescriptCurrInstr = cmd->nextInstr; @@ -13407,6 +13011,7 @@ static void Cmd_healpartystatus(void) CMD_ARGS(); u32 zero = 0; + u32 battler; u8 toHeal = 0; if (gCurrentMove == MOVE_HEAL_BELL) @@ -13427,19 +13032,19 @@ static void Cmd_healpartystatus(void) gBattleCommunication[MULTISTRING_CHOOSER] |= B_MSG_BELL_SOUNDPROOF_ATTACKER; } - gActiveBattler = gBattleScripting.battler = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker))); + battler = gBattleScripting.battler = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker))); if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE - && !(gAbsentBattlerFlags & gBitTable[gActiveBattler])) + && !(gAbsentBattlerFlags & gBitTable[battler])) { - if (GetBattlerAbility(gActiveBattler) != ABILITY_SOUNDPROOF) + if (GetBattlerAbility(battler) != ABILITY_SOUNDPROOF) { - gBattleMons[gActiveBattler].status1 = 0; - gBattleMons[gActiveBattler].status2 &= ~STATUS2_NIGHTMARE; + gBattleMons[battler].status1 = 0; + gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE; } else { - RecordAbilityBattle(gActiveBattler, gBattleMons[gActiveBattler].ability); + RecordAbilityBattle(battler, gBattleMons[battler].ability); gBattleCommunication[MULTISTRING_CHOOSER] |= B_MSG_BELL_SOUNDPROOF_PARTNER; } } @@ -13458,9 +13063,9 @@ static void Cmd_healpartystatus(void) if (gBattlerPartyIndexes[gBattlerAttacker] == i) ability = GetBattlerAbility(gBattlerAttacker); else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE - && gBattlerPartyIndexes[gActiveBattler] == i - && !(gAbsentBattlerFlags & gBitTable[gActiveBattler])) - ability = GetBattlerAbility(gActiveBattler); + && gBattlerPartyIndexes[battler] == i + && !(gAbsentBattlerFlags & gBitTable[battler])) + ability = GetBattlerAbility(battler); else ability = GetAbilityBySpecies(species, abilityNum); @@ -13477,21 +13082,20 @@ static void Cmd_healpartystatus(void) gBattleMons[gBattlerAttacker].status1 = 0; gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_NIGHTMARE; - gActiveBattler = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker))); + battler = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker))); if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE - && !(gAbsentBattlerFlags & gBitTable[gActiveBattler])) + && !(gAbsentBattlerFlags & gBitTable[battler])) { - gBattleMons[gActiveBattler].status1 = 0; - gBattleMons[gActiveBattler].status2 &= ~STATUS2_NIGHTMARE; + gBattleMons[battler].status1 = 0; + gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE; } } if (toHeal) { - gActiveBattler = gBattlerAttacker; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, toHeal, sizeof(zero), &zero); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_STATUS_BATTLE, toHeal, sizeof(zero), &zero); + MarkBattlerForControllerExec(gBattlerAttacker); } gBattlescriptCurrInstr = cmd->nextInstr; @@ -13701,16 +13305,16 @@ static void Cmd_setsafeguard(void) { CMD_ARGS(); - if (gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] & SIDE_STATUS_SAFEGUARD) + if (gSideStatuses[GetBattlerSide(gBattlerAttacker)] & SIDE_STATUS_SAFEGUARD) { gMoveResultFlags |= MOVE_RESULT_MISSED; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SIDE_STATUS_FAILED; } else { - gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_SAFEGUARD; - gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].safeguardTimer = 5; - gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].safeguardBattlerId = gBattlerAttacker; + gSideStatuses[GetBattlerSide(gBattlerAttacker)] |= SIDE_STATUS_SAFEGUARD; + gSideTimers[GetBattlerSide(gBattlerAttacker)].safeguardTimer = 5; + gSideTimers[GetBattlerSide(gBattlerAttacker)].safeguardBattlerId = gBattlerAttacker; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_SAFEGUARD; } @@ -13796,7 +13400,7 @@ static void Cmd_jumpifnopursuitswitchdmg(void) && !(gBattleMons[gBattlerTarget].status1 & (STATUS1_SLEEP | STATUS1_FREEZE)) && gBattleMons[gBattlerAttacker].hp && !gDisableStructs[gBattlerTarget].truantCounter - && gChosenMoveByBattler[gBattlerTarget] == MOVE_PURSUIT) + && gBattleMoves[gChosenMoveByBattler[gBattlerTarget]].effect == EFFECT_PURSUIT) { s32 i; @@ -13806,7 +13410,7 @@ static void Cmd_jumpifnopursuitswitchdmg(void) gActionsByTurnOrder[i] = B_ACTION_TRY_FINISH; } - gCurrentMove = MOVE_PURSUIT; + gCurrentMove = gChosenMoveByBattler[gBattlerTarget]; gCurrMovePos = gChosenMovePos = *(gBattleStruct->chosenMovePositions + gBattlerTarget); gBattlescriptCurrInstr = cmd->nextInstr; gBattleScripting.animTurn = 1; @@ -14021,7 +13625,7 @@ static void Cmd_trysetfutureattack(void) } else { - gSideStatuses[GET_BATTLER_SIDE(gBattlerTarget)] |= SIDE_STATUS_FUTUREATTACK; + gSideStatuses[GetBattlerSide(gBattlerTarget)] |= SIDE_STATUS_FUTUREATTACK; gWishFutureKnock.futureSightMove[gBattlerTarget] = gCurrentMove; gWishFutureKnock.futureSightAttacker[gBattlerTarget] = gBattlerAttacker; gWishFutureKnock.futureSightCounter[gBattlerTarget] = 3; @@ -14167,10 +13771,9 @@ static void Cmd_trymemento(void) else { // Success, drop user's HP bar to 0 - gActiveBattler = gBattlerAttacker; - gBattleMoveDamage = gBattleMons[gActiveBattler].hp; - BtlController_EmitHealthBarUpdate(BUFFER_A, INSTANT_HP_BAR_DROP); - MarkBattlerForControllerExec(gActiveBattler); + gBattleMoveDamage = gBattleMons[gBattlerAttacker].hp; + BtlController_EmitHealthBarUpdate(gBattlerAttacker, BUFFER_A, INSTANT_HP_BAR_DROP); + MarkBattlerForControllerExec(gBattlerAttacker); gBattlescriptCurrInstr = cmd->nextInstr; } } @@ -14182,7 +13785,7 @@ static void Cmd_setforcedtarget(void) gSideTimers[GetBattlerSide(gBattlerTarget)].followmeTimer = 1; gSideTimers[GetBattlerSide(gBattlerTarget)].followmeTarget = gBattlerTarget; - gSideTimers[GetBattlerSide(gBattlerTarget)].followmePowder = TestMoveFlags(gCurrentMove, FLAG_POWDER); + gSideTimers[GetBattlerSide(gBattlerTarget)].followmePowder = gBattleMoves[gCurrentMove].powderMove; gBattlescriptCurrInstr = cmd->nextInstr; } @@ -14233,9 +13836,8 @@ static void Cmd_cureifburnedparalysedorpoisoned(void) { gBattleMons[gBattlerAttacker].status1 = 0; gBattlescriptCurrInstr = cmd->nextInstr; - gActiveBattler = gBattlerAttacker; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gActiveBattler].status1), &gBattleMons[gActiveBattler].status1); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gBattlerAttacker].status1), &gBattleMons[gBattlerAttacker].status1); + MarkBattlerForControllerExec(gBattlerAttacker); } else { @@ -14390,12 +13992,10 @@ static void Cmd_tryswapitems(void) RecordItemEffectBattle(gBattlerAttacker, 0); RecordItemEffectBattle(gBattlerTarget, ItemId_GetHoldEffect(oldItemAtk)); - gActiveBattler = gBattlerAttacker; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(*newItemAtk), newItemAtk); + BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(*newItemAtk), newItemAtk); MarkBattlerForControllerExec(gBattlerAttacker); - gActiveBattler = gBattlerTarget; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].item), &gBattleMons[gBattlerTarget].item); + BtlController_EmitSetMonData(gBattlerTarget, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].item), &gBattleMons[gBattlerTarget].item); MarkBattlerForControllerExec(gBattlerTarget); gBattleStruct->choicedMove[gBattlerTarget] = MOVE_NONE; @@ -14656,13 +14256,13 @@ static void Cmd_tryimprison(void) } else { - u8 battlerId, sideAttacker; + u8 battler, sideAttacker; sideAttacker = GetBattlerSide(gBattlerAttacker); PressurePPLoseOnUsingImprison(gBattlerAttacker); - for (battlerId = 0; battlerId < gBattlersCount; battlerId++) + for (battler = 0; battler < gBattlersCount; battler++) { - if (sideAttacker != GetBattlerSide(battlerId)) + if (sideAttacker != GetBattlerSide(battler)) { s32 attackerMoveId; for (attackerMoveId = 0; attackerMoveId < MAX_MON_MOVES; attackerMoveId++) @@ -14670,7 +14270,7 @@ static void Cmd_tryimprison(void) s32 i; for (i = 0; i < MAX_MON_MOVES; i++) { - if (gBattleMons[gBattlerAttacker].moves[attackerMoveId] == gBattleMons[battlerId].moves[i] + if (gBattleMons[gBattlerAttacker].moves[attackerMoveId] == gBattleMons[battler].moves[i] && gBattleMons[gBattlerAttacker].moves[attackerMoveId] != MOVE_NONE) break; } @@ -14685,7 +14285,7 @@ static void Cmd_tryimprison(void) } } } - if (battlerId == gBattlersCount) // In Generation 3 games, Imprison fails if the user doesn't share any moves with any of the foes. + if (battler == gBattlersCount) // In Generation 3 games, Imprison fails if the user doesn't share any moves with any of the foes. gBattlescriptCurrInstr = cmd->failInstr; } } @@ -14754,7 +14354,9 @@ static void Cmd_assistattackselect(void) { u16 move = GetMonData(&party[monId], MON_DATA_MOVE1 + moveId); - if (sForbiddenMoves[move] & FORBIDDEN_ASSIST) + if (gBattleMoves[move].copycatBanned + || gBattleMoves[move].effect == EFFECT_SEMI_INVULNERABLE + || gBattleMoves[move].effect == EFFECT_SKY_DROP) continue; validMoves[chooseableMovesNo++] = move; @@ -14819,35 +14421,35 @@ static void Cmd_switchoutabilities(void) { CMD_ARGS(u8 battler); - gActiveBattler = GetBattlerForBattleScript(cmd->battler); - if (gBattleMons[gActiveBattler].ability == ABILITY_NEUTRALIZING_GAS) + u32 battler = GetBattlerForBattleScript(cmd->battler); + if (gBattleMons[battler].ability == ABILITY_NEUTRALIZING_GAS) { - gBattleMons[gActiveBattler].ability = ABILITY_NONE; + gBattleMons[battler].ability = ABILITY_NONE; BattleScriptPush(gBattlescriptCurrInstr); gBattlescriptCurrInstr = BattleScript_NeutralizingGasExits; } else { - switch (GetBattlerAbility(gActiveBattler)) + switch (GetBattlerAbility(battler)) { case ABILITY_NATURAL_CURE: - gBattleMons[gActiveBattler].status1 = 0; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, - gBitTable[*(gBattleStruct->battlerPartyIndexes + gActiveBattler)], - sizeof(gBattleMons[gActiveBattler].status1), - &gBattleMons[gActiveBattler].status1); - MarkBattlerForControllerExec(gActiveBattler); + gBattleMons[battler].status1 = 0; + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, + gBitTable[*(gBattleStruct->battlerPartyIndexes + battler)], + sizeof(gBattleMons[battler].status1), + &gBattleMons[battler].status1); + MarkBattlerForControllerExec(battler); break; case ABILITY_REGENERATOR: - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 3; - gBattleMoveDamage += gBattleMons[gActiveBattler].hp; - if (gBattleMoveDamage > gBattleMons[gActiveBattler].maxHP) - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_HP_BATTLE, - gBitTable[*(gBattleStruct->battlerPartyIndexes + gActiveBattler)], + gBattleMoveDamage = gBattleMons[battler].maxHP / 3; + gBattleMoveDamage += gBattleMons[battler].hp; + if (gBattleMoveDamage > gBattleMons[battler].maxHP) + gBattleMoveDamage = gBattleMons[battler].maxHP; + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_HP_BATTLE, + gBitTable[*(gBattleStruct->battlerPartyIndexes + battler)], sizeof(gBattleMoveDamage), &gBattleMoveDamage); - MarkBattlerForControllerExec(gActiveBattler); + MarkBattlerForControllerExec(battler); break; } @@ -14859,9 +14461,9 @@ static void Cmd_jumpifhasnohp(void) { CMD_ARGS(u8 battler, const u8 *jumpInstr); - gActiveBattler = GetBattlerForBattleScript(cmd->battler); + u32 battler = GetBattlerForBattleScript(cmd->battler); - if (gBattleMons[gActiveBattler].hp == 0) + if (gBattleMons[battler].hp == 0) gBattlescriptCurrInstr = cmd->jumpInstr; else gBattlescriptCurrInstr = cmd->nextInstr; @@ -15048,26 +14650,12 @@ static void Cmd_pickup(void) gBattlescriptCurrInstr = cmd->nextInstr; } -static void Cmd_doweatherformchangeanimation(void) +static void Cmd_unused3(void) { - CMD_ARGS(); - - gActiveBattler = gBattleScripting.battler; - - if (gBattleMons[gActiveBattler].status2 & STATUS2_SUBSTITUTE) - *(&gBattleStruct->formToChangeInto) |= CASTFORM_SUBSTITUTE; - - BtlController_EmitBattleAnimation(BUFFER_A, B_ANIM_CASTFORM_CHANGE, gBattleStruct->formToChangeInto); - MarkBattlerForControllerExec(gActiveBattler); - - gBattlescriptCurrInstr = cmd->nextInstr; } -static void Cmd_tryweatherformdatachange(void) +static void Cmd_unused4(void) { - CMD_ARGS(); - - // removed in favor of new form system } // Water and Mud Sport @@ -15122,15 +14710,15 @@ static void Cmd_settypebasedhalvers(void) gBattlescriptCurrInstr = cmd->failInstr; } -bool32 DoesSubstituteBlockMove(u8 battlerAtk, u8 battlerDef, u32 move) +bool32 DoesSubstituteBlockMove(u32 battlerAtk, u32 battlerDef, u32 move) { if (!(gBattleMons[battlerDef].status2 & STATUS2_SUBSTITUTE)) return FALSE; #if B_SOUND_SUBSTITUTE >= GEN_6 - else if (gBattleMoves[move].flags & FLAG_SOUND) + else if (gBattleMoves[move].soundMove) return FALSE; #endif - else if (gBattleMoves[move].flags & FLAG_HIT_IN_SUBSTITUTE) + else if (gBattleMoves[move].ignoresSubstitute) return FALSE; else if (GetBattlerAbility(battlerAtk) == ABILITY_INFILTRATOR) return FALSE; @@ -15138,7 +14726,7 @@ bool32 DoesSubstituteBlockMove(u8 battlerAtk, u8 battlerDef, u32 move) return TRUE; } -bool32 DoesDisguiseBlockMove(u8 battlerAtk, u8 battlerDef, u32 move) +bool32 DoesDisguiseBlockMove(u32 battlerAtk, u32 battlerDef, u32 move) { if (gBattleMons[battlerDef].species != SPECIES_MIMIKYU || gBattleMons[battlerDef].status2 & STATUS2_TRANSFORMED @@ -15166,16 +14754,15 @@ static void Cmd_tryrecycleitem(void) u16 *usedHeldItem; - gActiveBattler = gBattlerAttacker; - usedHeldItem = &gBattleStruct->usedHeldItems[gBattlerPartyIndexes[gActiveBattler]][GetBattlerSide(gActiveBattler)]; - if (*usedHeldItem != ITEM_NONE && gBattleMons[gActiveBattler].item == ITEM_NONE) + usedHeldItem = &gBattleStruct->usedHeldItems[gBattlerPartyIndexes[gBattlerAttacker]][GetBattlerSide(gBattlerAttacker)]; + if (*usedHeldItem != ITEM_NONE && gBattleMons[gBattlerAttacker].item == ITEM_NONE) { gLastUsedItem = *usedHeldItem; *usedHeldItem = ITEM_NONE; - gBattleMons[gActiveBattler].item = gLastUsedItem; + gBattleMons[gBattlerAttacker].item = gLastUsedItem; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gActiveBattler].item), &gBattleMons[gActiveBattler].item); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gBattlerAttacker].item), &gBattleMons[gBattlerAttacker].item); + MarkBattlerForControllerExec(gBattlerAttacker); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -15185,9 +14772,9 @@ static void Cmd_tryrecycleitem(void) } } -bool32 CanCamouflage(u8 battlerId) +bool32 CanCamouflage(u8 battler) { - if (IS_BATTLER_OF_TYPE(battlerId, sTerrainToType[gBattleTerrain])) + if (IS_BATTLER_OF_TYPE(battler, sTerrainToType[gBattleTerrain])) return FALSE; return TRUE; } @@ -15234,19 +14821,19 @@ static void Cmd_pursuitdoubles(void) { CMD_ARGS(const u8 *failInstr); - gActiveBattler = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker))); + u32 battler = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker))); if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE - && !(gAbsentBattlerFlags & gBitTable[gActiveBattler]) - && gChosenActionByBattler[gActiveBattler] == B_ACTION_USE_MOVE - && gChosenMoveByBattler[gActiveBattler] == MOVE_PURSUIT) + && !(gAbsentBattlerFlags & gBitTable[battler]) + && gChosenActionByBattler[battler] == B_ACTION_USE_MOVE + && gBattleMoves[gChosenMoveByBattler[battler]].effect == EFFECT_PURSUIT) { - gActionsByTurnOrder[gActiveBattler] = B_ACTION_TRY_FINISH; - gCurrentMove = MOVE_PURSUIT; + gActionsByTurnOrder[battler] = B_ACTION_TRY_FINISH; + gCurrentMove = gChosenMoveByBattler[battler]; gBattlescriptCurrInstr = cmd->nextInstr; gBattleScripting.animTurn = 1; gBattleScripting.savedBattler = gBattlerAttacker; - gBattlerAttacker = gActiveBattler; + gBattlerAttacker = battler; } else { @@ -15331,19 +14918,18 @@ static void Cmd_handleballthrow(void) if (gBattleControllerExecFlags) return; - gActiveBattler = gBattlerAttacker; gBattlerTarget = GetCatchingBattler(); if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) { - BtlController_EmitBallThrowAnim(BUFFER_A, BALL_TRAINER_BLOCK); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitBallThrowAnim(gBattlerAttacker, BUFFER_A, BALL_TRAINER_BLOCK); + MarkBattlerForControllerExec(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_TrainerBallBlock; } else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL) { - BtlController_EmitBallThrowAnim(BUFFER_A, BALL_3_SHAKES_SUCCESS); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitBallThrowAnim(gBattlerAttacker, BUFFER_A, BALL_3_SHAKES_SUCCESS); + MarkBattlerForControllerExec(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_WallyBallThrow; } else @@ -15352,6 +14938,7 @@ static void Cmd_handleballthrow(void) u8 catchRate; gLastThrownBall = gLastUsedItem; + gBallToDisplay = gLastThrownBall; if (gBattleTypeFlags & BATTLE_TYPE_SAFARI) catchRate = gBattleStruct->safariCatchFactor * 1275 / 100; else @@ -15552,8 +15139,8 @@ static void Cmd_handleballthrow(void) if (odds > 254) // mon caught { - BtlController_EmitBallThrowAnim(BUFFER_A, BALL_3_SHAKES_SUCCESS); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitBallThrowAnim(gBattlerAttacker, BUFFER_A, BALL_3_SHAKES_SUCCESS); + MarkBattlerForControllerExec(gBattlerAttacker); TryBattleFormChange(gBattlerTarget, FORM_CHANGE_END_BATTLE); gBattlescriptCurrInstr = BattleScript_SuccessBallThrow; SetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerTarget]], MON_DATA_POKEBALL, &gLastUsedItem); @@ -15600,8 +15187,8 @@ static void Cmd_handleballthrow(void) for (shakes = 0; shakes < maxShakes && Random() < odds; shakes++); } - BtlController_EmitBallThrowAnim(BUFFER_A, shakes); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitBallThrowAnim(gBattlerAttacker, BUFFER_A, shakes); + MarkBattlerForControllerExec(gBattlerAttacker); if (shakes == maxShakes) // mon caught, copy of the code above { @@ -15923,9 +15510,9 @@ static void Cmd_trainerslideout(void) { CMD_ARGS(u8 position); - gActiveBattler = GetBattlerAtPosition(cmd->position); - BtlController_EmitTrainerSlideBack(BUFFER_A); - MarkBattlerForControllerExec(gActiveBattler); + u32 battler = GetBattlerAtPosition(cmd->position); + BtlController_EmitTrainerSlideBack(battler, BUFFER_A); + MarkBattlerForControllerExec(battler); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -16179,23 +15766,53 @@ static bool32 CriticalCapture(u32 odds) #endif } -bool8 IsMoveAffectedByParentalBond(u16 move, u8 battlerId) +static const u16 sParentalBondBannedEffects[] = +{ + EFFECT_BEAT_UP, + EFFECT_BIDE, // Note: Bide should work with Parental Bond. This will be addressed in future. + EFFECT_ENDEAVOR, + EFFECT_EXPLOSION, + EFFECT_FINAL_GAMBIT, + EFFECT_FLING, + EFFECT_GEOMANCY, + EFFECT_METEOR_BEAM, + EFFECT_MULTI_HIT, + EFFECT_OHKO, + EFFECT_ROLLOUT, + EFFECT_SEMI_INVULNERABLE, + EFFECT_SKULL_BASH, + EFFECT_SKY_DROP, + EFFECT_SOLAR_BEAM, + EFFECT_TRIPLE_KICK, + EFFECT_TWO_TURNS_ATTACK, + EFFECT_UPROAR, +}; + +bool32 IsMoveAffectedByParentalBond(u32 move, u32 battler) { - if (gBattleMoves[move].split != SPLIT_STATUS - && !(sForbiddenMoves[move] & FORBIDDEN_PARENTAL_BOND)) + if (move != MOVE_NONE && move != MOVE_STRUGGLE + && gBattleMoves[move].split != SPLIT_STATUS + && !gBattleMoves[move].strikeCount > 2) { + u32 i; + for (i = 0; i < ARRAY_COUNT(sParentalBondBannedEffects); i++) + { + if (gBattleMoves[move].effect == sParentalBondBannedEffects[i]) + return FALSE; + } + if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { - switch (GetBattlerMoveTargetType(battlerId, move)) + switch (GetBattlerMoveTargetType(battler, move)) { // Both foes are alive, spread move strikes once case MOVE_TARGET_BOTH: - if (CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) >= 2) + if (CountAliveMonsInBattle(BATTLE_ALIVE_SIDE, gBattlerTarget) >= 2) return FALSE; break; // Either both foes or one foe and its ally are alive; spread move strikes once case MOVE_TARGET_FOES_AND_ALLY: - if (CountAliveMonsInBattle(BATTLE_ALIVE_EXCEPT_ATTACKER) >= 2) + if (CountAliveMonsInBattle(BATTLE_ALIVE_EXCEPT_BATTLER, gBattlerAttacker) >= 2) return FALSE; break; default: @@ -16231,6 +15848,18 @@ void BS_CheckParentalBondCounter(void) gBattlescriptCurrInstr = cmd->nextInstr; } +void BS_JumpIfCantLoseItem(void) +{ + NATIVE_ARGS(u8 battler, const u8 *jumpInstr); + u8 battler = GetBattlerForBattleScript(cmd->battler); + u16 item = gBattleMons[battler].item; + + if (item == ITEM_NONE || !CanBattlerGetOrLoseItem(battler, item)) + gBattlescriptCurrInstr = cmd->jumpInstr; + else + gBattlescriptCurrInstr = cmd->nextInstr; +} + void BS_GetBattlerSide(void) { NATIVE_ARGS(u8 battler); @@ -16242,13 +15871,12 @@ void BS_TrySymbiosis(void) { NATIVE_ARGS(); //called by Bestow, Fling, and Bug Bite, which don't work with Cmd_removeitem. - gActiveBattler = gBattlerAttacker; - if (SYMBIOSIS_CHECK(gBattlerAttacker, BATTLE_PARTNER(gActiveBattler))) + u32 partner = BATTLE_PARTNER(gBattlerAttacker); + if (SYMBIOSIS_CHECK(gBattlerAttacker, partner)) { - BestowItem(BATTLE_PARTNER(gActiveBattler), gActiveBattler); - gLastUsedAbility = gBattleMons[BATTLE_PARTNER(gActiveBattler)].ability; - gBattleScripting.battler = gBattlerAbility = BATTLE_PARTNER(gActiveBattler); - gBattlerAttacker = gActiveBattler; + BestowItem(partner, gBattlerAttacker); + gLastUsedAbility = gBattleMons[partner].ability; + gBattleScripting.battler = gBattlerAbility = partner; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SymbiosisActivates; return; @@ -16309,19 +15937,19 @@ static void TryUpdateRoundTurnOrder(void) } } -u8 GetFirstFaintedPartyIndex(u8 battlerId) +u8 GetFirstFaintedPartyIndex(u8 battler) { u32 i; u32 start = 0; u32 end = PARTY_SIZE; - struct Pokemon *party = GetBattlerParty(battlerId); + struct Pokemon *party = GetBattlerParty(battler); // Check whether partner is separate trainer. - if ((GetBattlerSide(battlerId) == B_SIDE_PLAYER && gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) - || (GetBattlerSide(battlerId) == B_SIDE_OPPONENT && gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)) + if ((GetBattlerSide(battler) == B_SIDE_PLAYER && gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) + || (GetBattlerSide(battler) == B_SIDE_OPPONENT && gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)) { - if (GetBattlerPosition(battlerId) == B_POSITION_OPPONENT_LEFT - || GetBattlerPosition(battlerId) == B_POSITION_PLAYER_LEFT) + if (GetBattlerPosition(battler) == B_POSITION_OPPONENT_LEFT + || GetBattlerPosition(battler) == B_POSITION_PLAYER_LEFT) { end = PARTY_SIZE / 2; } @@ -16347,11 +15975,40 @@ u8 GetFirstFaintedPartyIndex(u8 battlerId) return PARTY_SIZE; } +void ApplyExperienceMultipliers(s32 *expAmount, u8 expGetterMonId, u8 faintedBattler) +{ + u32 holdEffect = GetMonHoldEffect(&gPlayerParty[expGetterMonId]); + + if (IsTradedMon(&gPlayerParty[expGetterMonId])) + *expAmount = (*expAmount * 150) / 100; + if (holdEffect == HOLD_EFFECT_LUCKY_EGG) + *expAmount = (*expAmount * 150) / 100; + if (B_UNEVOLVED_EXP_MULTIPLIER >= GEN_6 && IsMonPastEvolutionLevel(&gPlayerParty[expGetterMonId])) + *expAmount = (*expAmount * 4915) / 4096; + if (B_AFFECTION_MECHANICS == TRUE && GetBattlerFriendshipScore(expGetterMonId) >= FRIENDSHIP_50_TO_99) + *expAmount = (*expAmount * 4915) / 4096; + if (CheckBagHasItem(ITEM_EXP_CHARM, 1)) //is also for other exp boosting Powers if/when implemented + *expAmount = (*expAmount * 150) / 100; + + if (B_SCALED_EXP >= GEN_5 && B_SCALED_EXP != GEN_6) + { + // Note: There is an edge case where if a pokemon receives a large amount of exp, it wouldn't be properly calculated + // because of multiplying by scaling factor(the value would simply be larger than an u32 can hold). Hence u64 is needed. + u64 value = *expAmount; + u8 faintedLevel = gBattleMons[faintedBattler].level; + u8 expGetterLevel = GetMonData(&gPlayerParty[expGetterMonId], MON_DATA_LEVEL); + + value *= sExperienceScalingFactors[(faintedLevel * 2) + 10]; + value /= sExperienceScalingFactors[faintedLevel + expGetterLevel + 10]; + *expAmount = value + 1; + } +} + void BS_ItemRestoreHP(void) { NATIVE_ARGS(); u16 healAmount; - u32 battlerId = MAX_BATTLERS_COUNT; + u32 battler = MAX_BATTLERS_COUNT; u32 healParam = GetItemEffect(gLastUsedItem)[6]; u32 side = GetBattlerSide(gBattlerAttacker); struct Pokemon *party = GetSideParty(side); @@ -16365,10 +16022,10 @@ void BS_ItemRestoreHP(void) // Check if the recipient is an active battler. if (gBattleStruct->itemPartyIndex[gBattlerAttacker] == gBattlerPartyIndexes[gBattlerAttacker]) - battlerId = gBattlerAttacker; + battler = gBattlerAttacker; else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && gBattleStruct->itemPartyIndex[gBattlerAttacker] == gBattlerPartyIndexes[BATTLE_PARTNER(gBattlerAttacker)]) - battlerId = BATTLE_PARTNER(gBattlerAttacker); + battler = BATTLE_PARTNER(gBattlerAttacker); // Get amount to heal. switch (healParam) @@ -16390,7 +16047,7 @@ void BS_ItemRestoreHP(void) healAmount = maxHP - hp; // Heal is applied as move damage if battler is active. - if (battlerId != MAX_BATTLERS_COUNT && hp != 0) + if (battler != MAX_BATTLERS_COUNT && hp != 0) { gBattleMoveDamage = -healAmount; } @@ -16400,10 +16057,10 @@ void BS_ItemRestoreHP(void) SetMonData(&party[gBattleStruct->itemPartyIndex[gBattlerAttacker]], MON_DATA_HP, &hp); // Revived battlers on the field need to be brought back. - if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && battlerId != MAX_BATTLERS_COUNT) + if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && battler != MAX_BATTLERS_COUNT) { - gAbsentBattlerFlags &= ~gBitTable[battlerId]; - gBattleScripting.battler = battlerId; + gAbsentBattlerFlags &= ~gBitTable[battler]; + gBattleScripting.battler = battler; gBattleCommunication[MULTIUSE_STATE] = TRUE; } } @@ -16454,7 +16111,7 @@ void BS_ItemRestorePP(void) NATIVE_ARGS(); const u8 *effect = GetItemEffect(gLastUsedItem); u32 i, pp, maxPP, moveId, loopEnd; - u32 battlerId = MAX_BATTLERS_COUNT; + u32 battler = MAX_BATTLERS_COUNT; struct Pokemon *mon = (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER) ? &gPlayerParty[gBattleStruct->itemPartyIndex[gBattlerAttacker]] : &gEnemyParty[gBattleStruct->itemPartyIndex[gBattlerAttacker]]; // Check whether to apply to all moves. @@ -16471,10 +16128,10 @@ void BS_ItemRestorePP(void) // Check if the recipient is an active battler. if (gBattleStruct->itemPartyIndex[gBattlerAttacker] == gBattlerPartyIndexes[gBattlerAttacker]) - battlerId = gBattlerAttacker; + battler = gBattlerAttacker; else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && gBattleStruct->itemPartyIndex[gBattlerAttacker] == gBattlerPartyIndexes[BATTLE_PARTNER(gBattlerAttacker)]) - battlerId = BATTLE_PARTNER(gBattlerAttacker); + battler = BATTLE_PARTNER(gBattlerAttacker); // Heal PP! for (; i < loopEnd; i++) @@ -16490,11 +16147,11 @@ void BS_ItemRestorePP(void) SetMonData(mon, MON_DATA_PP1 + i, &pp); // Update battler PP if needed. - if (battlerId != MAX_BATTLERS_COUNT - && gBattleStruct->itemPartyIndex[gBattlerAttacker] == gBattlerPartyIndexes[battlerId] - && MOVE_IS_PERMANENT(battlerId, i)) + if (battler != MAX_BATTLERS_COUNT + && gBattleStruct->itemPartyIndex[gBattlerAttacker] == gBattlerPartyIndexes[battler] + && MOVE_IS_PERMANENT(battler, i)) { - gBattleMons[battlerId].pp[i] = pp; + gBattleMons[battler].pp[i] = pp; } } } @@ -16532,6 +16189,90 @@ void BS_SetSnow(void) gBattlescriptCurrInstr = cmd->nextInstr; } +void BS_HandleMegaEvolution(void) +{ + NATIVE_ARGS(u8 battler, u8 caseId); + + u8 battler = GetBattlerForBattleScript(cmd->battler); + HandleScriptMegaPrimalBurst(cmd->caseId, battler, HANDLE_TYPE_MEGA_EVOLUTION); + gBattlescriptCurrInstr = cmd->nextInstr; +} + +void BS_HandlePrimalReversion(void) +{ + NATIVE_ARGS(u8 battler, u8 caseId); + + u8 battler = GetBattlerForBattleScript(cmd->battler); + HandleScriptMegaPrimalBurst(cmd->caseId, battler, HANDLE_TYPE_PRIMAL_REVERSION); + gBattlescriptCurrInstr = cmd->nextInstr; +} + +void BS_HandleUltraBurst(void) +{ + NATIVE_ARGS(u8 battler, u8 caseId); + + u8 battler = GetBattlerForBattleScript(cmd->battler); + HandleScriptMegaPrimalBurst(cmd->caseId, battler, HANDLE_TYPE_ULTRA_BURST); + gBattlescriptCurrInstr = cmd->nextInstr; +} + +void BS_JumpIfShellTrap(void) +{ + NATIVE_ARGS(u8 battler, const u8 *jumpInstr); + + u8 battler = GetBattlerForBattleScript(cmd->battler); + if (gProtectStructs[battler].shellTrap) + gBattlescriptCurrInstr = cmd->jumpInstr; + else + gBattlescriptCurrInstr = cmd->nextInstr; +} + +void BS_JumpIfEmergencyExited(void) +{ + NATIVE_ARGS(u8 battler, const u8 *jumpInstr); + u8 battler = GetBattlerForBattleScript(cmd->battler); + if (gSpecialStatuses[battler].emergencyExited) + gBattlescriptCurrInstr = cmd->jumpInstr; + else + gBattlescriptCurrInstr = cmd->nextInstr; +} + +void BS_JumpIfRod(void) +{ + NATIVE_ARGS(const u8 *jumpInstr); + if (IsAbilityRodAffected()) + gBattlescriptCurrInstr = cmd->jumpInstr; + else + gBattlescriptCurrInstr = cmd->nextInstr; +} + +void BS_JumpIfAbsorb(void) +{ + NATIVE_ARGS(const u8 *jumpInstr); + if (IsAbilityAbsorbAffected()) + gBattlescriptCurrInstr = cmd->jumpInstr; + else + gBattlescriptCurrInstr = cmd->nextInstr; +} + +void BS_JumpIfMotor(void) +{ + NATIVE_ARGS(const u8 *jumpInstr); + if (IsAbilityMotorAffected()) + gBattlescriptCurrInstr = cmd->jumpInstr; + else + gBattlescriptCurrInstr = cmd->nextInstr; +} + +void BS_ApplySaltCure(void) +{ + NATIVE_ARGS(u8 battler); + + u8 battler = GetBattlerForBattleScript(cmd->battler); + gStatuses4[battler] |= STATUS4_SALT_CURE; + gBattlescriptCurrInstr = cmd->nextInstr; +} + void BS_JumpIfArgument(void) { NATIVE_ARGS(u8 argument, const u8 *jumpInstr); diff --git a/src/battle_setup.c b/src/battle_setup.c index 2b8e63e76683..1bc13d8d90cd 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -380,6 +380,41 @@ static void CreateBattleStartTask(u8 transition, u16 song) PlayMapChosenOrBattleBGM(song); } +static void Task_BattleStart_Debug(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + switch (tState) + { + case 0: + if (!FldEffPoison_IsActive()) // is poison not active? + { + BattleTransition_StartOnField(tTransition); + ClearMirageTowerPulseBlendEffect(); + tState++; // go to case 1. + } + break; + case 1: + if (IsBattleTransitionDone() == TRUE) + { + CleanupOverworldWindowsAndTilemaps(); + SetMainCallback2(CB2_InitBattle); + RestartWildEncounterImmunitySteps(); + ClearPoisonStepCounter(); + DestroyTask(taskId); + } + break; + } +} + +static void CreateBattleStartTask_Debug(u8 transition, u16 song) +{ + u8 taskId = CreateTask(Task_BattleStart_Debug, 1); + + gTasks[taskId].tTransition = transition; + PlayMapChosenOrBattleBGM(song); +} + #undef tState #undef tTransition @@ -422,6 +457,25 @@ static void DoStandardWildBattle(bool32 isDouble) TryUpdateGymLeaderRematchFromWild(); } +void DoStandardWildBattle_Debug(void) +{ + LockPlayerFieldControls(); + FreezeObjectEvents(); + StopPlayerAvatar(); + gMain.savedCallback = CB2_EndWildBattle; + gBattleTypeFlags = 0; + if (InBattlePyramid()) + { + VarSet(VAR_TEMP_PLAYING_PYRAMID_MUSIC, 0); + gBattleTypeFlags |= BATTLE_TYPE_PYRAMID; + } + CreateBattleStartTask_Debug(GetWildBattleTransition(), 0); + //IncrementGameStat(GAME_STAT_TOTAL_BATTLES); + //IncrementGameStat(GAME_STAT_WILD_BATTLES); + //IncrementDailyWildBattles(); + //TryUpdateGymLeaderRematchFromWild(); +} + void BattleSetup_StartRoamerBattle(void) { LockPlayerFieldControls(); @@ -758,55 +812,16 @@ static u8 GetSumOfEnemyPartyLevel(u16 opponentId, u8 numMons) u8 i; u8 sum; u32 count = numMons; + const struct TrainerMon *party; if (gTrainers[opponentId].partySize < count) count = gTrainers[opponentId].partySize; sum = 0; - switch (gTrainers[opponentId].partyFlags) - { - case 0: - { - const struct TrainerMonNoItemDefaultMoves *party; - party = gTrainers[opponentId].party.NoItemDefaultMoves; - for (i = 0; i < count; i++) - sum += party[i].lvl; - } - break; - case F_TRAINER_PARTY_CUSTOM_MOVESET: - { - const struct TrainerMonNoItemCustomMoves *party; - party = gTrainers[opponentId].party.NoItemCustomMoves; - for (i = 0; i < count; i++) - sum += party[i].lvl; - } - break; - case F_TRAINER_PARTY_HELD_ITEM: - { - const struct TrainerMonItemDefaultMoves *party; - party = gTrainers[opponentId].party.ItemDefaultMoves; - for (i = 0; i < count; i++) - sum += party[i].lvl; - } - break; - case F_TRAINER_PARTY_CUSTOM_MOVESET | F_TRAINER_PARTY_HELD_ITEM: - { - const struct TrainerMonItemCustomMoves *party; - party = gTrainers[opponentId].party.ItemCustomMoves; - for (i = 0; i < count; i++) - sum += party[i].lvl; - } - break; - case F_TRAINER_PARTY_EVERYTHING_CUSTOMIZED: - { - const struct TrainerMonCustomized *party; - party = gTrainers[opponentId].party.EverythingCustomized; - for (i = 0; i < count; i++) - sum += party[i].lvl; - } - break; - } + party = gTrainers[opponentId].party; + for (i = 0; i < count; i++) + sum += party[i].lvl; return sum; } @@ -1303,7 +1318,7 @@ void BattleSetup_StartTrainerBattle(void) if (InBattlePyramid()) { - VarSet(VAR_TEMP_E, 0); + VarSet(VAR_TEMP_PLAYING_PYRAMID_MUSIC, 0); gBattleTypeFlags |= BATTLE_TYPE_PYRAMID; if (gNoOfApproachingTrainers == 2) @@ -1349,6 +1364,19 @@ void BattleSetup_StartTrainerBattle(void) ScriptContext_Stop(); } +void BattleSetup_StartTrainerBattle_Debug(void) +{ + sNoOfPossibleTrainerRetScripts = gNoOfApproachingTrainers; + gNoOfApproachingTrainers = 0; + sShouldCheckTrainerBScript = FALSE; + gWhichTrainerToFaceAfterBattle = 0; + gMain.savedCallback = CB2_EndTrainerBattle; + + CreateBattleStartTask_Debug(GetWildBattleTransition(), 0); + + ScriptContext_Stop(); +} + static void CB2_EndTrainerBattle(void) { if (gTrainerBattleOpponent_A == TRAINER_SECRET_BASE) diff --git a/src/battle_tent.c b/src/battle_tent.c index e51ac38a5a2a..f0f7363f31af 100644 --- a/src/battle_tent.c +++ b/src/battle_tent.c @@ -140,7 +140,7 @@ static void BufferVerdanturfTentTrainerIntro(void) static void SaveVerdanturfTentChallenge(void) { gSaveBlock2Ptr->frontier.challengeStatus = gSpecialVar_0x8005; - VarSet(VAR_TEMP_0, 0); + VarSet(VAR_TEMP_CHALLENGE_STATUS, 0); gSaveBlock2Ptr->frontier.challengePaused = TRUE; SaveGameFrontier(); } @@ -190,7 +190,7 @@ static void SetFallarborTentPrize(void) static void SaveFallarborTentChallenge(void) { gSaveBlock2Ptr->frontier.challengeStatus = gSpecialVar_0x8005; - VarSet(VAR_TEMP_0, 0); + VarSet(VAR_TEMP_CHALLENGE_STATUS, 0); gSaveBlock2Ptr->frontier.challengePaused = TRUE; SaveGameFrontier(); } @@ -245,7 +245,7 @@ static void SetSlateportTentPrize(void) static void SaveSlateportTentChallenge(void) { gSaveBlock2Ptr->frontier.challengeStatus = gSpecialVar_0x8005; - VarSet(VAR_TEMP_0, 0); + VarSet(VAR_TEMP_CHALLENGE_STATUS, 0); gSaveBlock2Ptr->frontier.challengePaused = TRUE; SaveGameFrontier(); } diff --git a/src/battle_tower.c b/src/battle_tower.c index 51d7e16b333b..7615c796ee1f 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -2245,7 +2245,7 @@ static void SaveTowerChallenge(void) SaveBattleTowerRecord(); gSaveBlock2Ptr->frontier.challengeStatus = gSpecialVar_0x8005; - VarSet(VAR_TEMP_0, 0); + VarSet(VAR_TEMP_CHALLENGE_STATUS, 0); gSaveBlock2Ptr->frontier.challengePaused = TRUE; SaveGameFrontier(); } @@ -2491,7 +2491,7 @@ static void GetPotentialPartnerMoveAndSpecies(u16 trainerId, u16 monId) } StringCopy(gStringVar1, gMoveNames[move]); - StringCopy(gStringVar2, gSpeciesNames[species]); + StringCopy(gStringVar2, GetSpeciesName(species)); } // For multi battles in the Battle Tower, the player may choose a partner by talking to them @@ -3049,113 +3049,62 @@ static void FillPartnerParty(u16 trainerId) for (i = 0; i < 3 && i < gTrainers[trainerId - TRAINER_CUSTOM_PARTNER].partySize; i++) { + const struct TrainerMon *partyData = gTrainers[trainerId - TRAINER_CUSTOM_PARTNER].party; + u32 otIdType = OT_ID_RANDOM_NO_SHINY; do { j = Random32(); } while (IsShinyOtIdPersonality(otID, j)); - switch (gTrainers[trainerId - TRAINER_CUSTOM_PARTNER].partyFlags) + if (partyData[i].gender == TRAINER_MON_MALE) + j = (j & 0xFFFFFF00) | GeneratePersonalityForGender(MON_MALE, partyData[i].species); + else if (partyData[i].gender == TRAINER_MON_FEMALE) + j = (j & 0xFFFFFF00) | GeneratePersonalityForGender(MON_FEMALE, partyData[i].species); + if (partyData[i].nature != 0) + ModifyPersonalityForNature(&j, partyData[i].nature - 1); + if (partyData[i].isShiny) { - case 0: - { - const struct TrainerMonNoItemDefaultMoves *partyData = gTrainers[trainerId - TRAINER_CUSTOM_PARTNER].party.NoItemDefaultMoves; - - CreateMon(&gPlayerParty[i + 3], partyData[i].species, partyData[i].lvl, partyData[i].iv * 31 / 255, TRUE, j, TRUE, otID); - break; + otIdType = OT_ID_PRESET; + otID = HIHALF(j) ^ LOHALF(j); } - case F_TRAINER_PARTY_CUSTOM_MOVESET: - { - const struct TrainerMonNoItemCustomMoves *partyData = gTrainers[trainerId - TRAINER_CUSTOM_PARTNER].party.NoItemCustomMoves; - CreateMon(&gPlayerParty[i + 3], partyData[i].species, partyData[i].lvl, partyData[i].iv * 31 / 255, TRUE, j, TRUE, otID); + CreateMon(&gPlayerParty[i + 3], partyData[i].species, partyData[i].lvl, 0, TRUE, j, otIdType, otID); + SetMonData(&gPlayerParty[i + 3], MON_DATA_HELD_ITEM, &partyData[i].heldItem); + CustomTrainerPartyAssignMoves(&gPlayerParty[i+3], &partyData[i]); - for (j = 0; j < 4; j++) - { - SetMonData(&gPlayerParty[i + 3], MON_DATA_MOVE1 + j, &partyData[i].moves[j]); - SetMonData(&gPlayerParty[i + 3], MON_DATA_PP1 + j, &gBattleMoves[partyData[i].moves[j]].pp); - } - break; - } - case F_TRAINER_PARTY_HELD_ITEM: + SetMonData(&gPlayerParty[i+3], MON_DATA_IVS, &(partyData[i].iv)); + if (partyData[i].ev != NULL) { - const struct TrainerMonItemDefaultMoves *partyData = gTrainers[trainerId - TRAINER_CUSTOM_PARTNER].party.ItemDefaultMoves; - - CreateMon(&gPlayerParty[i + 3], partyData[i].species, partyData[i].lvl, partyData[i].iv * 31 / 255, TRUE, j, TRUE, otID); - - SetMonData(&gPlayerParty[i + 3], MON_DATA_HELD_ITEM, &partyData[i].heldItem); - break; + SetMonData(&gPlayerParty[i+3], MON_DATA_HP_EV, &(partyData[i].ev[0])); + SetMonData(&gPlayerParty[i+3], MON_DATA_ATK_EV, &(partyData[i].ev[1])); + SetMonData(&gPlayerParty[i+3], MON_DATA_DEF_EV, &(partyData[i].ev[2])); + SetMonData(&gPlayerParty[i+3], MON_DATA_SPATK_EV, &(partyData[i].ev[3])); + SetMonData(&gPlayerParty[i+3], MON_DATA_SPDEF_EV, &(partyData[i].ev[4])); + SetMonData(&gPlayerParty[i+3], MON_DATA_SPEED_EV, &(partyData[i].ev[5])); } - case F_TRAINER_PARTY_CUSTOM_MOVESET | F_TRAINER_PARTY_HELD_ITEM: + if (partyData[i].ability != ABILITY_NONE) { - const struct TrainerMonItemCustomMoves *partyData = gTrainers[trainerId - TRAINER_CUSTOM_PARTNER].party.ItemCustomMoves; - - CreateMon(&gPlayerParty[i + 3], partyData[i].species, partyData[i].lvl, partyData[i].iv * 31 / 255, TRUE, j, TRUE, otID); - - SetMonData(&gPlayerParty[i + 3], MON_DATA_HELD_ITEM, &partyData[i].heldItem); - - for (j = 0; j < 4; j++) + const struct SpeciesInfo *speciesInfo = &gSpeciesInfo[partyData[i].species]; + u32 maxAbilities = ARRAY_COUNT(speciesInfo->abilities); + for (j = 0; j < maxAbilities; ++j) { - SetMonData(&gPlayerParty[i + 3], MON_DATA_MOVE1 + j, &partyData[i].moves[j]); - SetMonData(&gPlayerParty[i + 3], MON_DATA_PP1 + j, &gBattleMoves[partyData[i].moves[j]].pp); + if (speciesInfo->abilities[j] == partyData[i].ability) + break; } - break; + if (j < maxAbilities) + SetMonData(&gPlayerParty[i+3], MON_DATA_ABILITY_NUM, &j); } - case F_TRAINER_PARTY_EVERYTHING_CUSTOMIZED: + SetMonData(&gPlayerParty[i+3], MON_DATA_FRIENDSHIP, &(partyData[i].friendship)); + if (partyData[i].ball != ITEM_NONE) { - const struct TrainerMonCustomized *partyData = gTrainers[trainerId - TRAINER_CUSTOM_PARTNER].party.EverythingCustomized; - u32 otIdType = OT_ID_RANDOM_NO_SHINY; - - if (partyData[i].gender == TRAINER_MON_MALE) - j = (j & 0xFFFFFF00) | GeneratePersonalityForGender(MON_MALE, partyData[i].species); - else if (partyData[i].gender == TRAINER_MON_FEMALE) - j = (j & 0xFFFFFF00) | GeneratePersonalityForGender(MON_FEMALE, partyData[i].species); - if (partyData[i].nature != 0) - ModifyPersonalityForNature(&j, partyData[i].nature - 1); - if (partyData[i].isShiny) - { - otIdType = OT_ID_PRESET; - otID = HIHALF(j) ^ LOHALF(j); - } - - CreateMon(&gPlayerParty[i + 3], partyData[i].species, partyData[i].lvl, 0, TRUE, j, otIdType, otID); - SetMonData(&gPlayerParty[i + 3], MON_DATA_HELD_ITEM, &partyData[i].heldItem); - CustomTrainerPartyAssignMoves(&gPlayerParty[i+3], &partyData[i]); - - SetMonData(&gPlayerParty[i+3], MON_DATA_IVS, &(partyData[i].iv)); - if (partyData[i].ev != NULL) - { - SetMonData(&gPlayerParty[i+3], MON_DATA_HP_EV, &(partyData[i].ev[0])); - SetMonData(&gPlayerParty[i+3], MON_DATA_ATK_EV, &(partyData[i].ev[1])); - SetMonData(&gPlayerParty[i+3], MON_DATA_DEF_EV, &(partyData[i].ev[2])); - SetMonData(&gPlayerParty[i+3], MON_DATA_SPATK_EV, &(partyData[i].ev[3])); - SetMonData(&gPlayerParty[i+3], MON_DATA_SPDEF_EV, &(partyData[i].ev[4])); - SetMonData(&gPlayerParty[i+3], MON_DATA_SPEED_EV, &(partyData[i].ev[5])); - } - if (partyData[i].ability != ABILITY_NONE) - { - const struct SpeciesInfo *speciesInfo = &gSpeciesInfo[partyData[i].species]; - u32 maxAbilities = ARRAY_COUNT(speciesInfo->abilities); - for (j = 0; j < maxAbilities; ++j) - { - if (speciesInfo->abilities[j] == partyData[i].ability) - break; - } - if (j < maxAbilities) - SetMonData(&gPlayerParty[i+3], MON_DATA_ABILITY_NUM, &j); - } - SetMonData(&gPlayerParty[i+3], MON_DATA_FRIENDSHIP, &(partyData[i].friendship)); - if (partyData[i].ball != ITEM_NONE) - { - ball = partyData[i].ball; - SetMonData(&gPlayerParty[i+3], MON_DATA_POKEBALL, &ball); - } - if (partyData[i].nickname != NULL) - { - SetMonData(&gPlayerParty[i+3], MON_DATA_NICKNAME, partyData[i].nickname); - } - CalculateMonStats(&gPlayerParty[i+3]); + ball = partyData[i].ball; + SetMonData(&gPlayerParty[i+3], MON_DATA_POKEBALL, &ball); } + if (partyData[i].nickname != NULL) + { + SetMonData(&gPlayerParty[i+3], MON_DATA_NICKNAME, partyData[i].nickname); } + CalculateMonStats(&gPlayerParty[i+3]); StringCopy(trainerName, gTrainers[trainerId - TRAINER_CUSTOM_PARTNER].trainerName); SetMonData(&gPlayerParty[i + 3], MON_DATA_OT_NAME, trainerName); @@ -3344,7 +3293,7 @@ void CalcApprenticeChecksum(struct Apprentice *apprentice) s32 i; apprentice->checksum = 0; - for (i = 0; i < (sizeof(struct Apprentice) - 4) / 4; i++) + for (i = 0; i < offsetof(struct Apprentice, checksum) / sizeof(u32); i++) apprentice->checksum += ((u32 *)apprentice)[i]; } @@ -3352,7 +3301,7 @@ static void ClearApprentice(struct Apprentice *apprentice) { s32 i; - for (i = 0; i < (sizeof(struct Apprentice)) / 4; i++) + for (i = 0; i < sizeof(struct Apprentice) / sizeof(u32); i++) ((u32 *)apprentice)[i] = 0; ResetApprenticeStruct(apprentice); } @@ -3365,7 +3314,7 @@ static void ValidateApprenticesChecksums(void) { u32 *data = (u32 *) &gSaveBlock2Ptr->apprentices[i]; u32 checksum = 0; - for (j = 0; j < (sizeof(struct Apprentice) - 4) / 4; j++) + for (j = 0; j < offsetof(struct Apprentice, checksum) / sizeof(u32); j++) checksum += data[j]; if (gSaveBlock2Ptr->apprentices[i].checksum != checksum) ClearApprentice(&gSaveBlock2Ptr->apprentices[i]); @@ -3675,7 +3624,7 @@ bool32 ValidateBattleTowerRecord(u8 recordId) // unused u32 *record = (u32 *)(&gSaveBlock2Ptr->frontier.towerRecords[recordId]); u32 checksum = 0; u32 hasData = 0; - for (i = 0; i < (sizeof(struct EmeraldBattleTowerRecord) - 4) / 4; i++) // - 4, because of the last fjeld bejng the checksum jtself. + for (i = 0; i < offsetof(struct EmeraldBattleTowerRecord, checksum) / sizeof(u32); i++) { checksum += record[i]; hasData |= record[i]; diff --git a/src/battle_tv.c b/src/battle_tv.c index 40f13f42e5fb..361b6fa2b9e3 100644 --- a/src/battle_tv.c +++ b/src/battle_tv.c @@ -182,7 +182,6 @@ static const u16 sPoints_MoveEffect[NUM_BATTLE_MOVE_EFFECTS] = [EFFECT_CONVERSION_2] = 4, [EFFECT_LOCK_ON] = 3, [EFFECT_SKETCH] = 3, -// [EFFECT_UNUSED_60] = 3, [EFFECT_SLEEP_TALK] = 3, [EFFECT_DESTINY_BOND] = 3, [EFFECT_FLAIL] = 2, @@ -196,7 +195,6 @@ static const u16 sPoints_MoveEffect[NUM_BATTLE_MOVE_EFFECTS] = [EFFECT_NIGHTMARE] = 3, [EFFECT_MINIMIZE] = 1, [EFFECT_CURSE] = 2, -// [EFFECT_UNUSED_6E] = 1, [EFFECT_PROTECT] = 5, [EFFECT_SPIKES] = 4, [EFFECT_FORESIGHT] = 3, @@ -217,7 +215,6 @@ static const u16 sPoints_MoveEffect[NUM_BATTLE_MOVE_EFFECTS] = [EFFECT_PURSUIT] = 2, [EFFECT_RAPID_SPIN] = 2, [EFFECT_SONICBOOM] = 1, -// [EFFECT_UNUSED_83] = 1, [EFFECT_MORNING_SUN] = 4, [EFFECT_SYNTHESIS] = 4, [EFFECT_MOONLIGHT] = 4, @@ -227,16 +224,15 @@ static const u16 sPoints_MoveEffect[NUM_BATTLE_MOVE_EFFECTS] = [EFFECT_DEFENSE_UP_HIT] = 1, [EFFECT_ATTACK_UP_HIT] = 1, [EFFECT_ALL_STATS_UP_HIT] = 1, -// [EFFECT_UNUSED_8D] = 1, [EFFECT_BELLY_DRUM] = 7, [EFFECT_PSYCH_UP] = 7, [EFFECT_MIRROR_COAT] = 6, [EFFECT_SKULL_BASH] = 3, - [EFFECT_TWISTER] = 1, +// [EFFECT_TWISTER] = 1, [EFFECT_EARTHQUAKE] = 1, [EFFECT_FUTURE_SIGHT] = 1, [EFFECT_GUST] = 1, - [EFFECT_FLINCH_MINIMIZE_HIT] = 1, +// [EFFECT_FLINCH_MINIMIZE_HIT] = 1, [EFFECT_SOLAR_BEAM] = 1, [EFFECT_THUNDER] = 1, [EFFECT_TELEPORT] = 1, @@ -249,7 +245,6 @@ static const u16 sPoints_MoveEffect[NUM_BATTLE_MOVE_EFFECTS] = [EFFECT_STOCKPILE] = 3, [EFFECT_SPIT_UP] = 3, [EFFECT_SWALLOW] = 3, -// [EFFECT_UNUSED_A3] = 1, [EFFECT_HAIL] = 4, [EFFECT_SNOWSCAPE] = 4, [EFFECT_TORMENT] = 7, diff --git a/src/battle_util.c b/src/battle_util.c index e7cc3be6c0e7..baeff398a9b7 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -57,14 +57,14 @@ match the ROM; this is also why sSoundMovesTable's declaration is in the middle functions instead of at the top of the file with the other declarations. */ -static bool32 TryRemoveScreens(u8 battler); -static bool32 IsUnnerveAbilityOnOpposingSide(u8 battlerId); -static u8 GetFlingPowerFromItemId(u16 itemId); +static bool32 TryRemoveScreens(u32 battler); +static bool32 IsUnnerveAbilityOnOpposingSide(u32 battler); +static u32 GetFlingPowerFromItemId(u32 itemId); static void SetRandomMultiHitCounter(); -static u32 GetBattlerItemHoldEffectParam(u8 battlerId, u16 item); -static u16 GetInverseTypeMultiplier(u16 multiplier); -static u16 GetSupremeOverlordModifier(u8 battlerId); -static bool8 CanBeInfinitelyConfused(u8 battlerId); +static u32 GetBattlerItemHoldEffectParam(u32 battler, u32 item); +static uq4_12_t GetInverseTypeMultiplier(uq4_12_t multiplier); +static uq4_12_t GetSupremeOverlordModifier(u32 battler); +static bool32 CanBeInfinitelyConfused(u32 battler); extern const u8 *const gBattleScriptsForMoveEffects[]; extern const u8 *const gBattlescriptsForRunningByItem[]; @@ -257,7 +257,7 @@ bool32 IsAffectedByFollowMe(u32 battlerAtk, u32 defSide, u32 move) // Functions void HandleAction_UseMove(void) { - u32 i, side, moveType, var = 4; + u32 battler, i, side, moveType, var = 4; u16 moveTarget; gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber]; @@ -352,18 +352,18 @@ void HandleAction_UseMove(void) || (GetBattlerAbility(*(gBattleStruct->moveTarget + gBattlerAttacker)) != ABILITY_STORM_DRAIN && moveType == TYPE_WATER))) { side = GetBattlerSide(gBattlerAttacker); - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) + for (battler = 0; battler < gBattlersCount; battler++) { - if (side != GetBattlerSide(gActiveBattler) - && *(gBattleStruct->moveTarget + gBattlerAttacker) != gActiveBattler - && ((GetBattlerAbility(gActiveBattler) == ABILITY_LIGHTNING_ROD && moveType == TYPE_ELECTRIC) - || (GetBattlerAbility(gActiveBattler) == ABILITY_STORM_DRAIN && moveType == TYPE_WATER)) - && GetBattlerTurnOrderNum(gActiveBattler) < var + if (side != GetBattlerSide(battler) + && *(gBattleStruct->moveTarget + gBattlerAttacker) != battler + && ((GetBattlerAbility(battler) == ABILITY_LIGHTNING_ROD && moveType == TYPE_ELECTRIC) + || (GetBattlerAbility(battler) == ABILITY_STORM_DRAIN && moveType == TYPE_WATER)) + && GetBattlerTurnOrderNum(battler) < var && gBattleMoves[gCurrentMove].effect != EFFECT_SNIPE_SHOT && (GetBattlerAbility(gBattlerAttacker) != ABILITY_PROPELLER_TAIL || GetBattlerAbility(gBattlerAttacker) != ABILITY_STALWART)) { - var = GetBattlerTurnOrderNum(gActiveBattler); + var = GetBattlerTurnOrderNum(battler); } } if (var == 4) @@ -417,15 +417,15 @@ void HandleAction_UseMove(void) else { u16 battlerAbility; - gActiveBattler = gBattlerByTurnOrder[var]; - battlerAbility = GetBattlerAbility(gActiveBattler); + battler = gBattlerByTurnOrder[var]; + battlerAbility = GetBattlerAbility(battler); - RecordAbilityBattle(gActiveBattler, gBattleMons[gActiveBattler].ability); + RecordAbilityBattle(battler, gBattleMons[battler].ability); if (battlerAbility == ABILITY_LIGHTNING_ROD && gCurrentMove != MOVE_TEATIME) - gSpecialStatuses[gActiveBattler].lightningRodRedirected = TRUE; + gSpecialStatuses[battler].lightningRodRedirected = TRUE; else if (battlerAbility == ABILITY_STORM_DRAIN) - gSpecialStatuses[gActiveBattler].stormDrainRedirected = TRUE; - gBattlerTarget = gActiveBattler; + gSpecialStatuses[battler].stormDrainRedirected = TRUE; + gBattlerTarget = battler; } } else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE @@ -547,7 +547,7 @@ void HandleAction_Switch(void) void HandleAction_UseItem(void) { - gActiveBattler = gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber]; + gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber]; gBattle_BG0_X = 0; gBattle_BG0_Y = 0; ClearFuryCutterDestinyBondGrudge(gBattlerAttacker); @@ -557,9 +557,9 @@ void HandleAction_UseItem(void) gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT; } -bool8 TryRunFromBattle(u8 battler) +bool32 TryRunFromBattle(u32 battler) { - bool8 effect = FALSE; + bool32 effect = FALSE; u8 holdEffect; u8 pyramidMultiplier; u8 speedVar; @@ -646,22 +646,23 @@ bool8 TryRunFromBattle(u8 battler) void HandleAction_Run(void) { - gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber]; + s32 i; + gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber]; if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) { gCurrentTurnActionNumber = gBattlersCount; - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) + for (i = 0; i < gBattlersCount; i++) { - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) + if (GetBattlerSide(i) == B_SIDE_PLAYER) { - if (gChosenActionByBattler[gActiveBattler] == B_ACTION_RUN) + if (gChosenActionByBattler[i] == B_ACTION_RUN) gBattleOutcome |= B_OUTCOME_LOST; } else { - if (gChosenActionByBattler[gActiveBattler] == B_ACTION_RUN) + if (gChosenActionByBattler[i] == B_ACTION_RUN) gBattleOutcome |= B_OUTCOME_WON; } } @@ -723,7 +724,7 @@ void HandleAction_ThrowBall(void) gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber]; gBattle_BG0_X = 0; gBattle_BG0_Y = 0; - gLastUsedItem = gLastThrownBall; + gLastUsedItem = gBallToDisplay; RemoveBagItem(gLastUsedItem, 1); gBattlescriptCurrInstr = BattleScript_BallThrow; gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT; @@ -849,7 +850,6 @@ void HandleAction_ActionFinished(void) gLastHitByType[gBattlerAttacker] = 0; gBattleStruct->dynamicMoveType = 0; gBattleScripting.moveendState = 0; - gBattleScripting.moveendState = 0; gBattleCommunication[3] = 0; gBattleCommunication[4] = 0; gBattleScripting.multihitMoveEffect = 0; @@ -864,8 +864,8 @@ void HandleAction_ActionFinished(void) { for (j = i + 1; j < gBattlersCount; j++) { - u8 battler1 = gBattlerByTurnOrder[i]; - u8 battler2 = gBattlerByTurnOrder[j]; + u32 battler1 = gBattlerByTurnOrder[i]; + u32 battler2 = gBattlerByTurnOrder[j]; if (gProtectStructs[battler1].quash || gProtectStructs[battler2].quash || gProtectStructs[battler1].shellTrap || gProtectStructs[battler2].shellTrap) @@ -875,12 +875,12 @@ void HandleAction_ActionFinished(void) // have been executed before. The only recalculation needed is for moves/switch. Mega evolution is handled in src/battle_main.c/TryChangeOrder if((gActionsByTurnOrder[i] == B_ACTION_USE_MOVE && gActionsByTurnOrder[j] == B_ACTION_USE_MOVE)) { - if (GetWhoStrikesFirst(battler1, battler2, FALSE)) + if (GetWhichBattlerFaster(battler1, battler2, FALSE)) SwapTurnOrder(i, j); } else if ((gActionsByTurnOrder[i] == B_ACTION_SWITCH && gActionsByTurnOrder[j] == B_ACTION_SWITCH)) { - if (GetWhoStrikesFirst(battler1, battler2, TRUE)) // If the actions chosen are switching, we recalc order but ignoring the moves + if (GetWhichBattlerFaster(battler1, battler2, TRUE)) // If the actions chosen are switching, we recalc order but ignoring the moves SwapTurnOrder(i, j); } } @@ -889,43 +889,6 @@ void HandleAction_ActionFinished(void) #endif } -static const u8 sMovesNotAffectedByStench[] = -{ - [MOVE_AIR_SLASH] = 1, - [MOVE_ASTONISH] = 1, - [MOVE_BITE] = 1, - [MOVE_BONE_CLUB] = 1, - [MOVE_DARK_PULSE] = 1, - [MOVE_DOUBLE_IRON_BASH] = 1, - [MOVE_DRAGON_RUSH] = 1, - [MOVE_EXTRASENSORY] = 1, - [MOVE_FAKE_OUT] = 1, - [MOVE_FIERY_WRATH] = 1, - [MOVE_FIRE_FANG] = 1, - [MOVE_FLING] = 1, - [MOVE_FLOATY_FALL] = 1, - [MOVE_HEADBUTT] = 1, - [MOVE_HEART_STAMP] = 1, - [MOVE_HYPER_FANG] = 1, - [MOVE_ICE_FANG] = 1, - [MOVE_ICICLE_CRASH] = 1, - [MOVE_IRON_HEAD] = 1, - [MOVE_NEEDLE_ARM] = 1, - [MOVE_NONE] = 1, - [MOVE_ROCK_SLIDE] = 1, - [MOVE_ROLLING_KICK] = 1, - [MOVE_SECRET_POWER] = 1, - [MOVE_SKY_ATTACK] = 1, - [MOVE_SNORE] = 1, - [MOVE_STEAMROLLER] = 1, - [MOVE_STOMP] = 1, - [MOVE_THUNDER_FANG] = 1, - [MOVE_TWISTER] = 1, - [MOVE_WATERFALL] = 1, - [MOVE_ZEN_HEADBUTT] = 1, - [MOVE_ZING_ZAP] = 1, -}; - static const u8 sAbilitiesAffectedByMoldBreaker[] = { [ABILITY_BATTLE_ARMOR] = 1, @@ -1054,7 +1017,7 @@ static const u8 sHoldEffectToType[][2] = }; // percent in UQ_4_12 format -static const u16 sPercentToModifier[] = +static const uq4_12_t sPercentToModifier[] = { UQ_4_12(0.00), // 0 UQ_4_12(0.01), // 1 @@ -1161,7 +1124,7 @@ static const u16 sPercentToModifier[] = #define X UQ_4_12 -static const u16 sTypeEffectivenessTable[NUMBER_OF_MON_TYPES][NUMBER_OF_MON_TYPES] = +static const uq4_12_t sTypeEffectivenessTable[NUMBER_OF_MON_TYPES][NUMBER_OF_MON_TYPES] = { // normal fight flying poison ground rock bug ghost steel mystery fire water grass electric psychic ice dragon dark fairy {X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(0.5), X(1.0), X(0.0), X(0.5), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0)}, // normal @@ -1269,9 +1232,8 @@ void PressurePPLose(u8 target, u8 attacker, u16 move) if (MOVE_IS_PERMANENT(attacker, moveIndex)) { - gActiveBattler = attacker; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_PPMOVE1_BATTLE + moveIndex, 0, 1, &gBattleMons[gActiveBattler].pp[moveIndex]); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(attacker, BUFFER_A, REQUEST_PPMOVE1_BATTLE + moveIndex, 0, 1, &gBattleMons[attacker].pp[moveIndex]); + MarkBattlerForControllerExec(attacker); } } @@ -1301,9 +1263,8 @@ void PressurePPLoseOnUsingImprison(u8 attacker) if (imprisonPos != MAX_MON_MOVES && MOVE_IS_PERMANENT(attacker, imprisonPos)) { - gActiveBattler = attacker; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_PPMOVE1_BATTLE + imprisonPos, 0, 1, &gBattleMons[gActiveBattler].pp[imprisonPos]); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(attacker, BUFFER_A, REQUEST_PPMOVE1_BATTLE + imprisonPos, 0, 1, &gBattleMons[attacker].pp[imprisonPos]); + MarkBattlerForControllerExec(attacker); } } @@ -1332,9 +1293,8 @@ void PressurePPLoseOnUsingPerishSong(u8 attacker) if (perishSongPos != MAX_MON_MOVES && MOVE_IS_PERMANENT(attacker, perishSongPos)) { - gActiveBattler = attacker; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_PPMOVE1_BATTLE + perishSongPos, 0, 1, &gBattleMons[gActiveBattler].pp[perishSongPos]); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(attacker, BUFFER_A, REQUEST_PPMOVE1_BATTLE + perishSongPos, 0, 1, &gBattleMons[attacker].pp[perishSongPos]); + MarkBattlerForControllerExec(attacker); } } @@ -1355,33 +1315,33 @@ static void MarkAllBattlersForControllerExec(void) } } -bool32 IsBattlerMarkedForControllerExec(u8 battlerId) +bool32 IsBattlerMarkedForControllerExec(u32 battler) { if (gBattleTypeFlags & BATTLE_TYPE_LINK) - return (gBattleControllerExecFlags & (gBitTable[battlerId] << 0x1C)) != 0; + return (gBattleControllerExecFlags & (gBitTable[battler] << 0x1C)) != 0; else - return (gBattleControllerExecFlags & (gBitTable[battlerId])) != 0; + return (gBattleControllerExecFlags & (gBitTable[battler])) != 0; } -void MarkBattlerForControllerExec(u8 battlerId) +void MarkBattlerForControllerExec(u32 battler) { if (gBattleTypeFlags & BATTLE_TYPE_LINK) - gBattleControllerExecFlags |= gBitTable[battlerId] << (32 - MAX_BATTLERS_COUNT); + gBattleControllerExecFlags |= gBitTable[battler] << (32 - MAX_BATTLERS_COUNT); else - gBattleControllerExecFlags |= gBitTable[battlerId]; + gBattleControllerExecFlags |= gBitTable[battler]; } -void MarkBattlerReceivedLinkData(u8 battlerId) +void MarkBattlerReceivedLinkData(u32 battler) { s32 i; for (i = 0; i < GetLinkPlayerCount(); i++) - gBattleControllerExecFlags |= gBitTable[battlerId] << (i << 2); + gBattleControllerExecFlags |= gBitTable[battler] << (i << 2); - gBattleControllerExecFlags &= ~((1 << 28) << battlerId); + gBattleControllerExecFlags &= ~((1 << 28) << battler); } -void CancelMultiTurnMoves(u8 battler) +void CancelMultiTurnMoves(u32 battler) { u8 i; gBattleMons[battler].status2 &= ~(STATUS2_MULTIPLETURNS); @@ -1462,7 +1422,7 @@ void CancelMultiTurnMoves(u8 battler) gDisableStructs[battler].furyCutterCounter = 0; } -bool8 WasUnableToUseMove(u8 battler) +bool32 WasUnableToUseMove(u32 battler) { if (gProtectStructs[battler].prlzImmobility || gProtectStructs[battler].usedImprisonedMove @@ -1481,7 +1441,7 @@ bool8 WasUnableToUseMove(u8 battler) return FALSE; } -void PrepareStringBattle(u16 stringId, u8 battler) +void PrepareStringBattle(u16 stringId, u32 battler) { u32 targetSide = GetBattlerSide(gBattlerTarget); u16 battlerAbility = GetBattlerAbility(battler); @@ -1533,9 +1493,8 @@ void PrepareStringBattle(u16 stringId, u8 battler) && gBattleStruct->trainerSlidePlayerMonUnaffectedMsgState != 2) gBattleStruct->trainerSlidePlayerMonUnaffectedMsgState = 1; - gActiveBattler = battler; - BtlController_EmitPrintString(BUFFER_A, stringId); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitPrintString(battler, BUFFER_A, stringId); + MarkBattlerForControllerExec(battler); } void ResetSentPokesToOpponentValue(void) @@ -1553,7 +1512,7 @@ void ResetSentPokesToOpponentValue(void) gSentPokesToOpponent[(i & BIT_FLANK) >> 1] = bits; } -void OpponentSwitchInResetSentPokesToOpponentValue(u8 battler) +void OpponentSwitchInResetSentPokesToOpponentValue(u32 battler) { s32 i = 0; u32 bits = 0; @@ -1572,7 +1531,7 @@ void OpponentSwitchInResetSentPokesToOpponentValue(u8 battler) } } -void UpdateSentPokesToOpponentValue(u8 battler) +void UpdateSentPokesToOpponentValue(u32 battler) { if (GetBattlerSide(battler) == B_SIDE_OPPONENT) { @@ -1607,22 +1566,7 @@ static bool32 IsGravityPreventingMove(u32 move) if (!(gFieldStatuses & STATUS_FIELD_GRAVITY)) return FALSE; - switch (move) - { - case MOVE_BOUNCE: - case MOVE_FLY: - case MOVE_FLYING_PRESS: - case MOVE_HIGH_JUMP_KICK: - case MOVE_JUMP_KICK: - case MOVE_MAGNET_RISE: - case MOVE_SKY_DROP: - case MOVE_SPLASH: - case MOVE_TELEKINESIS: - case MOVE_FLOATY_FALL: - return TRUE; - default: - return FALSE; - } + return gBattleMoves[move].gravityBanned; } bool32 IsHealBlockPreventingMove(u32 battler, u32 move) @@ -1661,86 +1605,86 @@ static bool32 IsBelchPreventingMove(u32 battler, u32 move) return !(gBattleStruct->ateBerry[battler & BIT_SIDE] & gBitTable[gBattlerPartyIndexes[battler]]); } -u8 TrySetCantSelectMoveBattleScript(void) +u32 TrySetCantSelectMoveBattleScript(u32 battler) { u32 limitations = 0; - u8 moveId = gBattleResources->bufferB[gActiveBattler][2] & ~RET_MEGA_EVOLUTION; - u32 move = gBattleMons[gActiveBattler].moves[moveId]; - u32 holdEffect = GetBattlerHoldEffect(gActiveBattler, TRUE); - u16 *choicedMove = &gBattleStruct->choicedMove[gActiveBattler]; + u8 moveId = gBattleResources->bufferB[battler][2] & ~(RET_MEGA_EVOLUTION | RET_ULTRA_BURST); + u32 move = gBattleMons[battler].moves[moveId]; + u32 holdEffect = GetBattlerHoldEffect(battler, TRUE); + u16 *choicedMove = &gBattleStruct->choicedMove[battler]; - if (gBattleStruct->zmove.toBeUsed[gBattlerAttacker] == MOVE_NONE && gDisableStructs[gActiveBattler].disabledMove == move && move != MOVE_NONE) + if (gBattleStruct->zmove.toBeUsed[gBattlerAttacker] == MOVE_NONE && gDisableStructs[battler].disabledMove == move && move != MOVE_NONE) { - gBattleScripting.battler = gActiveBattler; + gBattleScripting.battler = battler; gCurrentMove = move; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingDisabledMoveInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; + gPalaceSelectionBattleScripts[battler] = BattleScript_SelectingDisabledMoveInPalace; + gProtectStructs[battler].palaceUnableToUseMove = TRUE; } else { - gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingDisabledMove; + gSelectionBattleScripts[battler] = BattleScript_SelectingDisabledMove; limitations++; } } - if (gBattleStruct->zmove.toBeUsed[gBattlerAttacker] == MOVE_NONE && move == gLastMoves[gActiveBattler] && move != MOVE_STRUGGLE && (gBattleMons[gActiveBattler].status2 & STATUS2_TORMENT)) + if (gBattleStruct->zmove.toBeUsed[gBattlerAttacker] == MOVE_NONE && move == gLastMoves[battler] && move != MOVE_STRUGGLE && (gBattleMons[battler].status2 & STATUS2_TORMENT)) { - CancelMultiTurnMoves(gActiveBattler); + CancelMultiTurnMoves(battler); if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingTormentedMoveInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; + gPalaceSelectionBattleScripts[battler] = BattleScript_SelectingTormentedMoveInPalace; + gProtectStructs[battler].palaceUnableToUseMove = TRUE; } else { - gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingTormentedMove; + gSelectionBattleScripts[battler] = BattleScript_SelectingTormentedMove; limitations++; } } - if (gBattleStruct->zmove.toBeUsed[gBattlerAttacker] == MOVE_NONE && gDisableStructs[gActiveBattler].tauntTimer != 0 && IS_MOVE_STATUS(move)) + if (gBattleStruct->zmove.toBeUsed[gBattlerAttacker] == MOVE_NONE && gDisableStructs[battler].tauntTimer != 0 && IS_MOVE_STATUS(move)) { gCurrentMove = move; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveTauntInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; + gPalaceSelectionBattleScripts[battler] = BattleScript_SelectingNotAllowedMoveTauntInPalace; + gProtectStructs[battler].palaceUnableToUseMove = TRUE; } else { - gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveTaunt; + gSelectionBattleScripts[battler] = BattleScript_SelectingNotAllowedMoveTaunt; limitations++; } } - if (gBattleStruct->zmove.toBeUsed[gBattlerAttacker] == MOVE_NONE && gDisableStructs[gActiveBattler].throatChopTimer != 0 && gBattleMoves[move].flags & FLAG_SOUND) + if (gBattleStruct->zmove.toBeUsed[gBattlerAttacker] == MOVE_NONE && gDisableStructs[battler].throatChopTimer != 0 && gBattleMoves[move].soundMove) { gCurrentMove = move; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveThroatChopInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; + gPalaceSelectionBattleScripts[battler] = BattleScript_SelectingNotAllowedMoveThroatChopInPalace; + gProtectStructs[battler].palaceUnableToUseMove = TRUE; } else { - gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveThroatChop; + gSelectionBattleScripts[battler] = BattleScript_SelectingNotAllowedMoveThroatChop; limitations++; } } - if (gBattleStruct->zmove.toBeUsed[gBattlerAttacker] == MOVE_NONE && GetImprisonedMovesCount(gActiveBattler, move)) + if (gBattleStruct->zmove.toBeUsed[gBattlerAttacker] == MOVE_NONE && GetImprisonedMovesCount(battler, move)) { gCurrentMove = move; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingImprisonedMoveInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; + gPalaceSelectionBattleScripts[battler] = BattleScript_SelectingImprisonedMoveInPalace; + gProtectStructs[battler].palaceUnableToUseMove = TRUE; } else { - gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingImprisonedMove; + gSelectionBattleScripts[battler] = BattleScript_SelectingImprisonedMove; limitations++; } } @@ -1750,118 +1694,134 @@ u8 TrySetCantSelectMoveBattleScript(void) gCurrentMove = move; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveGravityInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; + gPalaceSelectionBattleScripts[battler] = BattleScript_SelectingNotAllowedMoveGravityInPalace; + gProtectStructs[battler].palaceUnableToUseMove = TRUE; } else { - gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveGravity; + gSelectionBattleScripts[battler] = BattleScript_SelectingNotAllowedMoveGravity; limitations++; } } - if (gBattleStruct->zmove.toBeUsed[gBattlerAttacker] == MOVE_NONE && IsHealBlockPreventingMove(gActiveBattler, move)) + if (gBattleStruct->zmove.toBeUsed[gBattlerAttacker] == MOVE_NONE && IsHealBlockPreventingMove(battler, move)) { gCurrentMove = move; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveHealBlockInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; + gPalaceSelectionBattleScripts[battler] = BattleScript_SelectingNotAllowedMoveHealBlockInPalace; + gProtectStructs[battler].palaceUnableToUseMove = TRUE; } else { - gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveHealBlock; + gSelectionBattleScripts[battler] = BattleScript_SelectingNotAllowedMoveHealBlock; limitations++; } } - if (gBattleStruct->zmove.toBeUsed[gBattlerAttacker] == MOVE_NONE && IsBelchPreventingMove(gActiveBattler, move)) + if (gBattleStruct->zmove.toBeUsed[gBattlerAttacker] == MOVE_NONE && IsBelchPreventingMove(battler, move)) { gCurrentMove = move; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedBelchInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; + gPalaceSelectionBattleScripts[battler] = BattleScript_SelectingNotAllowedBelchInPalace; + gProtectStructs[battler].palaceUnableToUseMove = TRUE; } else { - gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedBelch; + gSelectionBattleScripts[battler] = BattleScript_SelectingNotAllowedBelch; limitations++; } } - if (move == MOVE_STUFF_CHEEKS && ItemId_GetPocket(gBattleMons[gActiveBattler].item) != POCKET_BERRIES) + if (move == MOVE_STUFF_CHEEKS && ItemId_GetPocket(gBattleMons[battler].item) != POCKET_BERRIES) { gCurrentMove = move; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedStuffCheeksInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; + gPalaceSelectionBattleScripts[battler] = BattleScript_SelectingNotAllowedStuffCheeksInPalace; + gProtectStructs[battler].palaceUnableToUseMove = TRUE; } else { - gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedStuffCheeks; + gSelectionBattleScripts[battler] = BattleScript_SelectingNotAllowedStuffCheeks; limitations++; } } - gPotentialItemEffectBattler = gActiveBattler; + if (gBattleMoves[move].effect == EFFECT_GIGATON_HAMMER && move == gLastResultingMoves[battler]) + { + gCurrentMove = move; + PREPARE_MOVE_BUFFER(gBattleTextBuff1, gCurrentMove); + if (gBattleTypeFlags & BATTLE_TYPE_PALACE) + { + gPalaceSelectionBattleScripts[battler] = BattleScript_SelectingNotAllowedCurrentMoveInPalace; + gProtectStructs[battler].palaceUnableToUseMove = TRUE; + } + else + { + gSelectionBattleScripts[battler] = BattleScript_SelectingNotAllowedCurrentMove; + limitations++; + } + } + + gPotentialItemEffectBattler = battler; if (HOLD_EFFECT_CHOICE(holdEffect) && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != move) { gCurrentMove = *choicedMove; - gLastUsedItem = gBattleMons[gActiveBattler].item; + gLastUsedItem = gBattleMons[battler].item; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveChoiceItemInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; + gPalaceSelectionBattleScripts[battler] = BattleScript_SelectingNotAllowedMoveChoiceItemInPalace; + gProtectStructs[battler].palaceUnableToUseMove = TRUE; } else { - gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveChoiceItem; + gSelectionBattleScripts[battler] = BattleScript_SelectingNotAllowedMoveChoiceItem; limitations++; } } else if (holdEffect == HOLD_EFFECT_ASSAULT_VEST && IS_MOVE_STATUS(move) && move != MOVE_ME_FIRST) { gCurrentMove = move; - gLastUsedItem = gBattleMons[gActiveBattler].item; + gLastUsedItem = gBattleMons[battler].item; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveAssaultVestInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; + gPalaceSelectionBattleScripts[battler] = BattleScript_SelectingNotAllowedMoveAssaultVestInPalace; + gProtectStructs[battler].palaceUnableToUseMove = TRUE; } else { - gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveAssaultVest; + gSelectionBattleScripts[battler] = BattleScript_SelectingNotAllowedMoveAssaultVest; limitations++; } } - if ((GetBattlerAbility(gActiveBattler) == ABILITY_GORILLA_TACTICS) && *choicedMove != MOVE_NONE + if ((GetBattlerAbility(battler) == ABILITY_GORILLA_TACTICS) && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != move) { gCurrentMove = *choicedMove; - gLastUsedItem = gBattleMons[gActiveBattler].item; + gLastUsedItem = gBattleMons[battler].item; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveGorillaTacticsInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; + gPalaceSelectionBattleScripts[battler] = BattleScript_SelectingNotAllowedMoveGorillaTacticsInPalace; + gProtectStructs[battler].palaceUnableToUseMove = TRUE; } else { - gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveGorillaTactics; + gSelectionBattleScripts[battler] = BattleScript_SelectingNotAllowedMoveGorillaTactics; limitations++; } } - if (gBattleMons[gActiveBattler].pp[moveId] == 0) + if (gBattleMons[battler].pp[moveId] == 0) { if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; + gProtectStructs[battler].palaceUnableToUseMove = TRUE; } else { - gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingMoveWithNoPP; + gSelectionBattleScripts[battler] = BattleScript_SelectingMoveWithNoPP; limitations++; } } @@ -1870,12 +1830,12 @@ u8 TrySetCantSelectMoveBattleScript(void) { if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedPlaceholderInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; + gPalaceSelectionBattleScripts[battler] = BattleScript_SelectingNotAllowedPlaceholderInPalace; + gProtectStructs[battler].palaceUnableToUseMove = TRUE; } else { - gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedPlaceholder; + gSelectionBattleScripts[battler] = BattleScript_SelectingNotAllowedPlaceholder; limitations++; } } @@ -1883,92 +1843,93 @@ u8 TrySetCantSelectMoveBattleScript(void) return limitations; } -u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u16 check) +u8 CheckMoveLimitations(u32 battler, u8 unusableMoves, u16 check) { - u8 holdEffect = GetBattlerHoldEffect(battlerId, TRUE); - u16 *choicedMove = &gBattleStruct->choicedMove[battlerId]; + u8 holdEffect = GetBattlerHoldEffect(battler, TRUE); + u16 *choicedMove = &gBattleStruct->choicedMove[battler]; s32 i; - gPotentialItemEffectBattler = battlerId; + gPotentialItemEffectBattler = battler; for (i = 0; i < MAX_MON_MOVES; i++) { // No move - if (check & MOVE_LIMITATION_ZEROMOVE && gBattleMons[battlerId].moves[i] == MOVE_NONE) + if (check & MOVE_LIMITATION_ZEROMOVE && gBattleMons[battler].moves[i] == MOVE_NONE) unusableMoves |= gBitTable[i]; // No PP - else if (check & MOVE_LIMITATION_PP && gBattleMons[battlerId].pp[i] == 0) + else if (check & MOVE_LIMITATION_PP && gBattleMons[battler].pp[i] == 0) unusableMoves |= gBitTable[i]; // Placeholder - else if (check & MOVE_LIMITATION_PLACEHOLDER && gBattleMoves[gBattleMons[battlerId].moves[i]].effect == EFFECT_PLACEHOLDER) + else if (check & MOVE_LIMITATION_PLACEHOLDER && gBattleMoves[gBattleMons[battler].moves[i]].effect == EFFECT_PLACEHOLDER) unusableMoves |= gBitTable[i]; // Disable - else if (check & MOVE_LIMITATION_DISABLED && gBattleMons[battlerId].moves[i] == gDisableStructs[battlerId].disabledMove) + else if (check & MOVE_LIMITATION_DISABLED && gBattleMons[battler].moves[i] == gDisableStructs[battler].disabledMove) unusableMoves |= gBitTable[i]; // Torment - else if (check & MOVE_LIMITATION_TORMENTED && gBattleMons[battlerId].moves[i] == gLastMoves[battlerId] && gBattleMons[battlerId].status2 & STATUS2_TORMENT) + else if (check & MOVE_LIMITATION_TORMENTED && gBattleMons[battler].moves[i] == gLastMoves[battler] && gBattleMons[battler].status2 & STATUS2_TORMENT) unusableMoves |= gBitTable[i]; // Taunt - else if (check & MOVE_LIMITATION_TAUNT && gDisableStructs[battlerId].tauntTimer && IS_MOVE_STATUS(gBattleMons[battlerId].moves[i])) + else if (check & MOVE_LIMITATION_TAUNT && gDisableStructs[battler].tauntTimer && IS_MOVE_STATUS(gBattleMons[battler].moves[i])) unusableMoves |= gBitTable[i]; // Imprison - else if (check & MOVE_LIMITATION_IMPRISON && GetImprisonedMovesCount(battlerId, gBattleMons[battlerId].moves[i])) + else if (check & MOVE_LIMITATION_IMPRISON && GetImprisonedMovesCount(battler, gBattleMons[battler].moves[i])) unusableMoves |= gBitTable[i]; // Encore - else if (check & MOVE_LIMITATION_ENCORE && gDisableStructs[battlerId].encoreTimer && gDisableStructs[battlerId].encoredMove != gBattleMons[battlerId].moves[i]) + else if (check & MOVE_LIMITATION_ENCORE && gDisableStructs[battler].encoreTimer && gDisableStructs[battler].encoredMove != gBattleMons[battler].moves[i]) unusableMoves |= gBitTable[i]; // Choice Items - else if (check & MOVE_LIMITATION_CHOICE_ITEM && HOLD_EFFECT_CHOICE(holdEffect) && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != gBattleMons[battlerId].moves[i]) + else if (check & MOVE_LIMITATION_CHOICE_ITEM && HOLD_EFFECT_CHOICE(holdEffect) && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != gBattleMons[battler].moves[i]) unusableMoves |= gBitTable[i]; // Assault Vest - else if (check & MOVE_LIMITATION_ASSAULT_VEST && holdEffect == HOLD_EFFECT_ASSAULT_VEST && IS_MOVE_STATUS(gBattleMons[battlerId].moves[i]) && gBattleMons[battlerId].moves[i] != MOVE_ME_FIRST) + else if (check & MOVE_LIMITATION_ASSAULT_VEST && holdEffect == HOLD_EFFECT_ASSAULT_VEST && IS_MOVE_STATUS(gBattleMons[battler].moves[i]) && gBattleMons[battler].moves[i] != MOVE_ME_FIRST) unusableMoves |= gBitTable[i]; // Gravity - else if (check & MOVE_LIMITATION_GRAVITY && IsGravityPreventingMove(gBattleMons[battlerId].moves[i])) + else if (check & MOVE_LIMITATION_GRAVITY && IsGravityPreventingMove(gBattleMons[battler].moves[i])) unusableMoves |= gBitTable[i]; // Heal Block - else if (check & MOVE_LIMITATION_HEAL_BLOCK && IsHealBlockPreventingMove(battlerId, gBattleMons[battlerId].moves[i])) + else if (check & MOVE_LIMITATION_HEAL_BLOCK && IsHealBlockPreventingMove(battler, gBattleMons[battler].moves[i])) unusableMoves |= gBitTable[i]; // Belch - else if (check & MOVE_LIMITATION_BELCH && IsBelchPreventingMove(battlerId, gBattleMons[battlerId].moves[i])) + else if (check & MOVE_LIMITATION_BELCH && IsBelchPreventingMove(battler, gBattleMons[battler].moves[i])) unusableMoves |= gBitTable[i]; // Throat Chop - else if (check & MOVE_LIMITATION_THROAT_CHOP && gDisableStructs[battlerId].throatChopTimer && gBattleMoves[gBattleMons[battlerId].moves[i]].flags & FLAG_SOUND) + else if (check & MOVE_LIMITATION_THROAT_CHOP && gDisableStructs[battler].throatChopTimer && gBattleMoves[gBattleMons[battler].moves[i]].soundMove) unusableMoves |= gBitTable[i]; // Stuff Cheeks - else if (check & MOVE_LIMITATION_STUFF_CHEEKS && gBattleMons[battlerId].moves[i] == MOVE_STUFF_CHEEKS && ItemId_GetPocket(gBattleMons[gActiveBattler].item) != POCKET_BERRIES) + else if (check & MOVE_LIMITATION_STUFF_CHEEKS && gBattleMons[battler].moves[i] == MOVE_STUFF_CHEEKS && ItemId_GetPocket(gBattleMons[battler].item) != POCKET_BERRIES) unusableMoves |= gBitTable[i]; // Gorilla Tactics - else if (check & MOVE_LIMITATION_CHOICE_ITEM && GetBattlerAbility(battlerId) == ABILITY_GORILLA_TACTICS && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != gBattleMons[battlerId].moves[i]) + else if (check & MOVE_LIMITATION_CHOICE_ITEM && GetBattlerAbility(battler) == ABILITY_GORILLA_TACTICS && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != gBattleMons[battler].moves[i]) + unusableMoves |= gBitTable[i]; + else if (check & MOVE_LIMITATION_GIGATON_HAMMER && gBattleMoves[gBattleMons[battler].moves[i]].effect == EFFECT_GIGATON_HAMMER && gBattleMons[battler].moves[i] == gLastResultingMoves[battler]) unusableMoves |= gBitTable[i]; } return unusableMoves; } #define ALL_MOVES_MASK ((1 << MAX_MON_MOVES) - 1) -bool8 AreAllMovesUnusable(void) +bool32 AreAllMovesUnusable(u32 battler) { - u8 unusable = CheckMoveLimitations(gActiveBattler, 0, MOVE_LIMITATIONS_ALL); + u8 unusable = CheckMoveLimitations(battler, 0, MOVE_LIMITATIONS_ALL); if (unusable == ALL_MOVES_MASK) // All moves are unusable. { - gProtectStructs[gActiveBattler].noValidMoves = TRUE; - gSelectionBattleScripts[gActiveBattler] = BattleScript_NoMovesLeft; + gProtectStructs[battler].noValidMoves = TRUE; + gSelectionBattleScripts[battler] = BattleScript_NoMovesLeft; } else { - gProtectStructs[gActiveBattler].noValidMoves = FALSE; + gProtectStructs[battler].noValidMoves = FALSE; } return (unusable == ALL_MOVES_MASK); } -#undef ALL_MOVES_MASK -u8 GetImprisonedMovesCount(u8 battlerId, u16 move) +u8 GetImprisonedMovesCount(u32 battler, u16 move) { s32 i; u8 imprisonedMoves = 0; - u8 battlerSide = GetBattlerSide(battlerId); + u32 battlerSide = GetBattlerSide(battler); for (i = 0; i < gBattlersCount; i++) { @@ -1988,11 +1949,11 @@ u8 GetImprisonedMovesCount(u8 battlerId, u16 move) return imprisonedMoves; } -u32 GetBattlerFriendshipScore(u8 battlerId) +u32 GetBattlerFriendshipScore(u32 battler) { - u8 side = GetBattlerSide(battlerId); + u8 side = GetBattlerSide(battler); struct Pokemon *party = GetSideParty(side); - u16 species = GetMonData(&party[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); + u16 species = GetMonData(&party[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES); if (side != B_SIDE_PLAYER) return FRIENDSHIP_NONE; @@ -2004,7 +1965,7 @@ u32 GetBattlerFriendshipScore(u8 battlerId) | BATTLE_TYPE_SECRET_BASE))) return FRIENDSHIP_NONE; - return GetMonFriendshipScore(&party[gBattlerPartyIndexes[battlerId]]); + return GetMonFriendshipScore(&party[gBattlerPartyIndexes[battler]]); } static void TryToRevertMimicry(void) @@ -2100,7 +2061,7 @@ u8 DoFieldEndTurnEffects(void) { if (!gProtectStructs[i].quash && !gProtectStructs[j].quash - && GetWhoStrikesFirst(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], FALSE)) + && GetWhichBattlerFaster(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], FALSE)) SwapTurnOrder(i, j); } } @@ -2112,7 +2073,7 @@ u8 DoFieldEndTurnEffects(void) while (gBattleStruct->turnSideTracker < 2) { side = gBattleStruct->turnSideTracker; - gActiveBattler = gBattlerAttacker = gSideTimers[side].reflectBattlerId; + gBattlerAttacker = gSideTimers[side].reflectBattlerId; if (gSideStatuses[side] & SIDE_STATUS_REFLECT) { if (--gSideTimers[side].reflectTimer == 0) @@ -2137,7 +2098,7 @@ u8 DoFieldEndTurnEffects(void) while (gBattleStruct->turnSideTracker < 2) { side = gBattleStruct->turnSideTracker; - gActiveBattler = gBattlerAttacker = gSideTimers[side].lightscreenBattlerId; + gBattlerAttacker = gSideTimers[side].lightscreenBattlerId; if (gSideStatuses[side] & SIDE_STATUS_LIGHTSCREEN) { if (--gSideTimers[side].lightscreenTimer == 0) @@ -2163,7 +2124,7 @@ u8 DoFieldEndTurnEffects(void) while (gBattleStruct->turnSideTracker < 2) { side = gBattleStruct->turnSideTracker; - gActiveBattler = gBattlerAttacker = gSideTimers[side].auroraVeilBattlerId; + gBattlerAttacker = gSideTimers[side].auroraVeilBattlerId; if (gSideStatuses[side] & SIDE_STATUS_AURORA_VEIL) { if (--gSideTimers[side].auroraVeilTimer == 0) @@ -2189,7 +2150,7 @@ u8 DoFieldEndTurnEffects(void) while (gBattleStruct->turnSideTracker < 2) { side = gBattleStruct->turnSideTracker; - gActiveBattler = gBattlerAttacker = gSideTimers[side].mistBattlerId; + gBattlerAttacker = gSideTimers[side].mistBattlerId; if (gSideTimers[side].mistTimer != 0 && --gSideTimers[side].mistTimer == 0) { gSideStatuses[side] &= ~SIDE_STATUS_MIST; @@ -2212,7 +2173,7 @@ u8 DoFieldEndTurnEffects(void) while (gBattleStruct->turnSideTracker < 2) { side = gBattleStruct->turnSideTracker; - gActiveBattler = gBattlerAttacker = gSideTimers[side].safeguardBattlerId; + gBattlerAttacker = gSideTimers[side].safeguardBattlerId; if (gSideStatuses[side] & SIDE_STATUS_SAFEGUARD) { if (--gSideTimers[side].safeguardTimer == 0) @@ -2236,7 +2197,7 @@ u8 DoFieldEndTurnEffects(void) while (gBattleStruct->turnSideTracker < 2) { side = gBattleStruct->turnSideTracker; - gActiveBattler = gBattlerAttacker = gSideTimers[side].luckyChantBattlerId; + gBattlerAttacker = gSideTimers[side].luckyChantBattlerId; if (gSideStatuses[side] & SIDE_STATUS_LUCKY_CHANT) { if (--gSideTimers[side].luckyChantTimer == 0) @@ -2260,7 +2221,7 @@ u8 DoFieldEndTurnEffects(void) while (gBattleStruct->turnSideTracker < 2) { side = gBattleStruct->turnSideTracker; - gActiveBattler = gBattlerAttacker = gSideTimers[side].tailwindBattlerId; + gBattlerAttacker = gSideTimers[side].tailwindBattlerId; if (gSideStatuses[side] & SIDE_STATUS_TAILWIND) { if (--gSideTimers[side].tailwindTimer == 0) @@ -2283,12 +2244,12 @@ u8 DoFieldEndTurnEffects(void) case ENDTURN_WISH: while (gBattleStruct->turnSideTracker < gBattlersCount) { - gActiveBattler = gBattlerByTurnOrder[gBattleStruct->turnSideTracker]; - if (gWishFutureKnock.wishCounter[gActiveBattler] != 0 - && --gWishFutureKnock.wishCounter[gActiveBattler] == 0 - && gBattleMons[gActiveBattler].hp != 0) + u32 battler = gBattlerByTurnOrder[gBattleStruct->turnSideTracker]; + if (gWishFutureKnock.wishCounter[battler] != 0 + && --gWishFutureKnock.wishCounter[battler] == 0 + && gBattleMons[battler].hp != 0) { - gBattlerTarget = gActiveBattler; + gBattlerTarget = battler; BattleScriptExecute(BattleScript_WishComesTrue); effect++; } @@ -2580,6 +2541,7 @@ enum ENDTURN_SLOW_START, ENDTURN_PLASMA_FISTS, ENDTURN_CUD_CHEW, + ENDTURN_SALT_CURE, ENDTURN_BATTLER_COUNT }; @@ -2597,7 +2559,7 @@ s32 GetDrainedBigRootHp(u32 battler, s32 hp) #define MAGIC_GUARD_CHECK \ if (ability == ABILITY_MAGIC_GUARD) \ {\ - RecordAbilityBattle(gActiveBattler, ability);\ + RecordAbilityBattle(battler, ability);\ gBattleStruct->turnEffectsTracker++;\ break;\ } @@ -2605,74 +2567,74 @@ if (ability == ABILITY_MAGIC_GUARD) \ u8 DoBattlerEndTurnEffects(void) { - u32 ability, i, effect = 0; + u32 battler, ability, i, effect = 0; gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_SKIP_DMG_TRACK); while (gBattleStruct->turnEffectsBattlerId < gBattlersCount && gBattleStruct->turnEffectsTracker <= ENDTURN_BATTLER_COUNT) { - gActiveBattler = gBattlerAttacker = gBattlerByTurnOrder[gBattleStruct->turnEffectsBattlerId]; - if (gAbsentBattlerFlags & gBitTable[gActiveBattler]) + battler = gBattlerAttacker = gBattlerByTurnOrder[gBattleStruct->turnEffectsBattlerId]; + if (gAbsentBattlerFlags & gBitTable[battler]) { gBattleStruct->turnEffectsBattlerId++; continue; } - ability = GetBattlerAbility(gActiveBattler); + ability = GetBattlerAbility(battler); switch (gBattleStruct->turnEffectsTracker) { case ENDTURN_INGRAIN: // ingrain - if ((gStatuses3[gActiveBattler] & STATUS3_ROOTED) - && !BATTLER_MAX_HP(gActiveBattler) - && !(gStatuses3[gActiveBattler] & STATUS3_HEAL_BLOCK) - && gBattleMons[gActiveBattler].hp != 0) + if ((gStatuses3[battler] & STATUS3_ROOTED) + && !BATTLER_MAX_HP(battler) + && !(gStatuses3[battler] & STATUS3_HEAL_BLOCK) + && gBattleMons[battler].hp != 0) { - gBattleMoveDamage = GetDrainedBigRootHp(gActiveBattler, gBattleMons[gActiveBattler].maxHP / 16); + gBattleMoveDamage = GetDrainedBigRootHp(battler, gBattleMons[battler].maxHP / 16); BattleScriptExecute(BattleScript_IngrainTurnHeal); effect++; } gBattleStruct->turnEffectsTracker++; break; case ENDTURN_AQUA_RING: // aqua ring - if ((gStatuses3[gActiveBattler] & STATUS3_AQUA_RING) - && !BATTLER_MAX_HP(gActiveBattler) - && !(gStatuses3[gActiveBattler] & STATUS3_HEAL_BLOCK) - && gBattleMons[gActiveBattler].hp != 0) + if ((gStatuses3[battler] & STATUS3_AQUA_RING) + && !BATTLER_MAX_HP(battler) + && !(gStatuses3[battler] & STATUS3_HEAL_BLOCK) + && gBattleMons[battler].hp != 0) { - gBattleMoveDamage = GetDrainedBigRootHp(gActiveBattler, gBattleMons[gActiveBattler].maxHP / 16); + gBattleMoveDamage = GetDrainedBigRootHp(battler, gBattleMons[battler].maxHP / 16); BattleScriptExecute(BattleScript_AquaRingHeal); effect++; } gBattleStruct->turnEffectsTracker++; break; case ENDTURN_ABILITIES: // end turn abilities - if (AbilityBattleEffects(ABILITYEFFECT_ENDTURN, gActiveBattler, 0, 0, 0)) + if (AbilityBattleEffects(ABILITYEFFECT_ENDTURN, battler, 0, 0, 0)) effect++; gBattleStruct->turnEffectsTracker++; break; case ENDTURN_ITEMS1: // item effects - if (ItemBattleEffects(ITEMEFFECT_NORMAL, gActiveBattler, FALSE)) + if (ItemBattleEffects(ITEMEFFECT_NORMAL, battler, FALSE)) effect++; gBattleStruct->turnEffectsTracker++; break; case ENDTURN_ITEMS2: // item effects again - if (ItemBattleEffects(ITEMEFFECT_NORMAL, gActiveBattler, TRUE)) + if (ItemBattleEffects(ITEMEFFECT_NORMAL, battler, TRUE)) effect++; gBattleStruct->turnEffectsTracker++; break; case ENDTURN_ORBS: - if (IsBattlerAlive(gActiveBattler) && ItemBattleEffects(ITEMEFFECT_ORBS, gActiveBattler, FALSE)) + if (IsBattlerAlive(battler) && ItemBattleEffects(ITEMEFFECT_ORBS, battler, FALSE)) effect++; gBattleStruct->turnEffectsTracker++; break; case ENDTURN_LEECH_SEED: // leech seed - if ((gStatuses3[gActiveBattler] & STATUS3_LEECHSEED) - && gBattleMons[gStatuses3[gActiveBattler] & STATUS3_LEECHSEED_BATTLER].hp != 0 - && gBattleMons[gActiveBattler].hp != 0) + if ((gStatuses3[battler] & STATUS3_LEECHSEED) + && gBattleMons[gStatuses3[battler] & STATUS3_LEECHSEED_BATTLER].hp != 0 + && gBattleMons[battler].hp != 0) { MAGIC_GUARD_CHECK; - gBattlerTarget = gStatuses3[gActiveBattler] & STATUS3_LEECHSEED_BATTLER; // Notice gBattlerTarget is actually the HP receiver. - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8; + gBattlerTarget = gStatuses3[battler] & STATUS3_LEECHSEED_BATTLER; // Notice gBattlerTarget is actually the HP receiver. + gBattleMoveDamage = gBattleMons[battler].maxHP / 8; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; gBattleScripting.animArg1 = gBattlerTarget; @@ -2683,16 +2645,16 @@ u8 DoBattlerEndTurnEffects(void) gBattleStruct->turnEffectsTracker++; break; case ENDTURN_POISON: // poison - if ((gBattleMons[gActiveBattler].status1 & STATUS1_POISON) - && gBattleMons[gActiveBattler].hp != 0) + if ((gBattleMons[battler].status1 & STATUS1_POISON) + && gBattleMons[battler].hp != 0) { MAGIC_GUARD_CHECK; if (ability == ABILITY_POISON_HEAL) { - if (!BATTLER_MAX_HP(gActiveBattler) && !(gStatuses3[gActiveBattler] & STATUS3_HEAL_BLOCK)) + if (!BATTLER_MAX_HP(battler) && !(gStatuses3[battler] & STATUS3_HEAL_BLOCK)) { - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8; + gBattleMoveDamage = gBattleMons[battler].maxHP / 8; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; gBattleMoveDamage *= -1; @@ -2702,7 +2664,7 @@ u8 DoBattlerEndTurnEffects(void) } else { - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8; + gBattleMoveDamage = gBattleMons[battler].maxHP / 8; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; BattleScriptExecute(BattleScript_PoisonTurnDmg); @@ -2712,16 +2674,16 @@ u8 DoBattlerEndTurnEffects(void) gBattleStruct->turnEffectsTracker++; break; case ENDTURN_BAD_POISON: // toxic poison - if ((gBattleMons[gActiveBattler].status1 & STATUS1_TOXIC_POISON) - && gBattleMons[gActiveBattler].hp != 0) + if ((gBattleMons[battler].status1 & STATUS1_TOXIC_POISON) + && gBattleMons[battler].hp != 0) { MAGIC_GUARD_CHECK; if (ability == ABILITY_POISON_HEAL) { - if (!BATTLER_MAX_HP(gActiveBattler) && !(gStatuses3[gActiveBattler] & STATUS3_HEAL_BLOCK)) + if (!BATTLER_MAX_HP(battler) && !(gStatuses3[battler] & STATUS3_HEAL_BLOCK)) { - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8; + gBattleMoveDamage = gBattleMons[battler].maxHP / 8; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; gBattleMoveDamage *= -1; @@ -2731,12 +2693,12 @@ u8 DoBattlerEndTurnEffects(void) } else { - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 16; + gBattleMoveDamage = gBattleMons[battler].maxHP / 16; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; - if ((gBattleMons[gActiveBattler].status1 & STATUS1_TOXIC_COUNTER) != STATUS1_TOXIC_TURN(15)) // not 16 turns - gBattleMons[gActiveBattler].status1 += STATUS1_TOXIC_TURN(1); - gBattleMoveDamage *= (gBattleMons[gActiveBattler].status1 & STATUS1_TOXIC_COUNTER) >> 8; + if ((gBattleMons[battler].status1 & STATUS1_TOXIC_COUNTER) != STATUS1_TOXIC_TURN(15)) // not 16 turns + gBattleMons[battler].status1 += STATUS1_TOXIC_TURN(1); + gBattleMoveDamage *= (gBattleMons[battler].status1 & STATUS1_TOXIC_COUNTER) >> 8; BattleScriptExecute(BattleScript_PoisonTurnDmg); effect++; } @@ -2744,19 +2706,19 @@ u8 DoBattlerEndTurnEffects(void) gBattleStruct->turnEffectsTracker++; break; case ENDTURN_BURN: // burn - if ((gBattleMons[gActiveBattler].status1 & STATUS1_BURN) - && gBattleMons[gActiveBattler].hp != 0) + if ((gBattleMons[battler].status1 & STATUS1_BURN) + && gBattleMons[battler].hp != 0) { MAGIC_GUARD_CHECK; #if B_BURN_DAMAGE >= GEN_7 - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 16; + gBattleMoveDamage = gBattleMons[battler].maxHP / 16; #else - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8; + gBattleMoveDamage = gBattleMons[battler].maxHP / 8; #endif if (ability == ABILITY_HEATPROOF) { if (gBattleMoveDamage > (gBattleMoveDamage / 2) + 1) // Record ability if the burn takes less damage than it normally would. - RecordAbilityBattle(gActiveBattler, ABILITY_HEATPROOF); + RecordAbilityBattle(battler, ABILITY_HEATPROOF); gBattleMoveDamage /= 2; } if (gBattleMoveDamage == 0) @@ -2767,14 +2729,14 @@ u8 DoBattlerEndTurnEffects(void) gBattleStruct->turnEffectsTracker++; break; case ENDTURN_FROSTBITE: // burn - if ((gBattleMons[gActiveBattler].status1 & STATUS1_FROSTBITE) - && gBattleMons[gActiveBattler].hp != 0) + if ((gBattleMons[battler].status1 & STATUS1_FROSTBITE) + && gBattleMons[battler].hp != 0) { MAGIC_GUARD_CHECK; #if B_BURN_DAMAGE >= GEN_7 - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 16; + gBattleMoveDamage = gBattleMons[battler].maxHP / 16; #else - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8; + gBattleMoveDamage = gBattleMons[battler].maxHP / 8; #endif if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; @@ -2784,15 +2746,15 @@ u8 DoBattlerEndTurnEffects(void) gBattleStruct->turnEffectsTracker++; break; case ENDTURN_NIGHTMARES: // spooky nightmares - if ((gBattleMons[gActiveBattler].status2 & STATUS2_NIGHTMARE) - && gBattleMons[gActiveBattler].hp != 0) + if ((gBattleMons[battler].status2 & STATUS2_NIGHTMARE) + && gBattleMons[battler].hp != 0) { MAGIC_GUARD_CHECK; // R/S does not perform this sleep check, which causes the nightmare effect to // persist even after the affected Pokemon has been awakened by Shed Skin. - if (gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP) + if (gBattleMons[battler].status1 & STATUS1_SLEEP) { - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 4; + gBattleMoveDamage = gBattleMons[battler].maxHP / 4; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; BattleScriptExecute(BattleScript_NightmareTurnDmg); @@ -2800,17 +2762,17 @@ u8 DoBattlerEndTurnEffects(void) } else { - gBattleMons[gActiveBattler].status2 &= ~STATUS2_NIGHTMARE; + gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE; } } gBattleStruct->turnEffectsTracker++; break; case ENDTURN_CURSE: // curse - if ((gBattleMons[gActiveBattler].status2 & STATUS2_CURSED) - && gBattleMons[gActiveBattler].hp != 0) + if ((gBattleMons[battler].status2 & STATUS2_CURSED) + && gBattleMons[battler].hp != 0) { MAGIC_GUARD_CHECK; - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 4; + gBattleMoveDamage = gBattleMons[battler].maxHP / 4; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; BattleScriptExecute(BattleScript_CurseTurnDmg); @@ -2819,25 +2781,25 @@ u8 DoBattlerEndTurnEffects(void) gBattleStruct->turnEffectsTracker++; break; case ENDTURN_WRAP: // wrap - if ((gBattleMons[gActiveBattler].status2 & STATUS2_WRAPPED) && gBattleMons[gActiveBattler].hp != 0) + if ((gBattleMons[battler].status2 & STATUS2_WRAPPED) && gBattleMons[battler].hp != 0) { - if (--gDisableStructs[gActiveBattler].wrapTurns != 0) // damaged by wrap + if (--gDisableStructs[battler].wrapTurns != 0) // damaged by wrap { MAGIC_GUARD_CHECK; - gBattleScripting.animArg1 = gBattleStruct->wrappedMove[gActiveBattler]; - gBattleScripting.animArg2 = gBattleStruct->wrappedMove[gActiveBattler] >> 8; - PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleStruct->wrappedMove[gActiveBattler]); + gBattleScripting.animArg1 = gBattleStruct->wrappedMove[battler]; + gBattleScripting.animArg2 = gBattleStruct->wrappedMove[battler] >> 8; + PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleStruct->wrappedMove[battler]); gBattlescriptCurrInstr = BattleScript_WrapTurnDmg; - if (GetBattlerHoldEffect(gBattleStruct->wrappedBy[gActiveBattler], TRUE) == HOLD_EFFECT_BINDING_BAND) + if (GetBattlerHoldEffect(gBattleStruct->wrappedBy[battler], TRUE) == HOLD_EFFECT_BINDING_BAND) #if B_BINDING_DAMAGE >= GEN_6 - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 6; + gBattleMoveDamage = gBattleMons[battler].maxHP / 6; else - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8; + gBattleMoveDamage = gBattleMons[battler].maxHP / 8; #else - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8; + gBattleMoveDamage = gBattleMons[battler].maxHP / 8; else - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 16; + gBattleMoveDamage = gBattleMons[battler].maxHP / 16; #endif if (gBattleMoveDamage == 0) @@ -2845,8 +2807,8 @@ u8 DoBattlerEndTurnEffects(void) } else // broke free { - gBattleMons[gActiveBattler].status2 &= ~STATUS2_WRAPPED; - PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleStruct->wrappedMove[gActiveBattler]); + gBattleMons[battler].status2 &= ~STATUS2_WRAPPED; + PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleStruct->wrappedMove[battler]); gBattlescriptCurrInstr = BattleScript_WrapEnds; } BattleScriptExecute(gBattlescriptCurrInstr); @@ -2856,14 +2818,14 @@ u8 DoBattlerEndTurnEffects(void) break; case ENDTURN_OCTOLOCK: { - u16 battlerAbility = GetBattlerAbility(gActiveBattler); - if (gDisableStructs[gActiveBattler].octolock - && !(GetBattlerHoldEffect(gActiveBattler, TRUE) == HOLD_EFFECT_CLEAR_AMULET + u16 battlerAbility = GetBattlerAbility(battler); + if (gDisableStructs[battler].octolock + && !(GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_CLEAR_AMULET || battlerAbility == ABILITY_CLEAR_BODY || battlerAbility == ABILITY_FULL_METAL_BODY || battlerAbility == ABILITY_WHITE_SMOKE)) { - gBattlerTarget = gActiveBattler; + gBattlerTarget = battler; BattleScriptExecute(BattleScript_OctolockEndTurn); effect++; } @@ -2871,7 +2833,7 @@ u8 DoBattlerEndTurnEffects(void) } break; case ENDTURN_UPROAR: // uproar - if (gBattleMons[gActiveBattler].status2 & STATUS2_UPROAR) + if (gBattleMons[battler].status2 & STATUS2_UPROAR) { for (gBattlerAttacker = 0; gBattlerAttacker < gBattlersCount; gBattlerAttacker++) { @@ -2882,9 +2844,8 @@ u8 DoBattlerEndTurnEffects(void) gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_NIGHTMARE; gBattleCommunication[MULTISTRING_CHOOSER] = 1; BattleScriptExecute(BattleScript_MonWokeUpInUproar); - gActiveBattler = gBattlerAttacker; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gBattlerAttacker].status1); + MarkBattlerForControllerExec(gBattlerAttacker); break; } } @@ -2895,22 +2856,22 @@ u8 DoBattlerEndTurnEffects(void) } else { - gBattlerAttacker = gActiveBattler; - gBattleMons[gActiveBattler].status2 -= STATUS2_UPROAR_TURN(1); // uproar timer goes down - if (WasUnableToUseMove(gActiveBattler)) + gBattlerAttacker = battler; + gBattleMons[battler].status2 -= STATUS2_UPROAR_TURN(1); // uproar timer goes down + if (WasUnableToUseMove(battler)) { - CancelMultiTurnMoves(gActiveBattler); + CancelMultiTurnMoves(battler); gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_UPROAR_ENDS; } - else if (gBattleMons[gActiveBattler].status2 & STATUS2_UPROAR) + else if (gBattleMons[battler].status2 & STATUS2_UPROAR) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_UPROAR_CONTINUES; - gBattleMons[gActiveBattler].status2 |= STATUS2_MULTIPLETURNS; + gBattleMons[battler].status2 |= STATUS2_MULTIPLETURNS; } else { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_UPROAR_ENDS; - CancelMultiTurnMoves(gActiveBattler); + CancelMultiTurnMoves(battler); } BattleScriptExecute(BattleScript_PrintUproarOverTurns); effect = 1; @@ -2921,20 +2882,20 @@ u8 DoBattlerEndTurnEffects(void) break; case ENDTURN_THRASH: // thrash // Don't decrement STATUS2_LOCK_CONFUSE if the target is held by Sky Drop - if (gBattleMons[gActiveBattler].status2 & STATUS2_LOCK_CONFUSE && !(gStatuses3[gActiveBattler] & STATUS3_SKY_DROPPED)) + if (gBattleMons[battler].status2 & STATUS2_LOCK_CONFUSE && !(gStatuses3[battler] & STATUS3_SKY_DROPPED)) { - gBattleMons[gActiveBattler].status2 -= STATUS2_LOCK_CONFUSE_TURN(1); - if (WasUnableToUseMove(gActiveBattler)) - CancelMultiTurnMoves(gActiveBattler); - else if (!(gBattleMons[gActiveBattler].status2 & STATUS2_LOCK_CONFUSE) - && (gBattleMons[gActiveBattler].status2 & STATUS2_MULTIPLETURNS)) + gBattleMons[battler].status2 -= STATUS2_LOCK_CONFUSE_TURN(1); + if (WasUnableToUseMove(battler)) + CancelMultiTurnMoves(battler); + else if (!(gBattleMons[battler].status2 & STATUS2_LOCK_CONFUSE) + && (gBattleMons[battler].status2 & STATUS2_MULTIPLETURNS)) { - gBattleMons[gActiveBattler].status2 &= ~STATUS2_MULTIPLETURNS; - if (!(gBattleMons[gActiveBattler].status2 & STATUS2_CONFUSION)) + gBattleMons[battler].status2 &= ~STATUS2_MULTIPLETURNS; + if (!(gBattleMons[battler].status2 & STATUS2_CONFUSION)) { gBattleScripting.moveEffect = MOVE_EFFECT_CONFUSION | MOVE_EFFECT_AFFECTS_USER; SetMoveEffect(TRUE, 0); - if (gBattleMons[gActiveBattler].status2 & STATUS2_CONFUSION) + if (gBattleMons[battler].status2 & STATUS2_CONFUSION) BattleScriptExecute(BattleScript_ThrashConfuses); effect++; } @@ -2943,25 +2904,25 @@ u8 DoBattlerEndTurnEffects(void) gBattleStruct->turnEffectsTracker++; break; case ENDTURN_FLINCH: // reset flinch - gBattleMons[gActiveBattler].status2 &= ~STATUS2_FLINCHED; + gBattleMons[battler].status2 &= ~STATUS2_FLINCHED; gBattleStruct->turnEffectsTracker++; break; case ENDTURN_DISABLE: // disable - if (gDisableStructs[gActiveBattler].disableTimer != 0) + if (gDisableStructs[battler].disableTimer != 0) { for (i = 0; i < MAX_MON_MOVES; i++) { - if (gDisableStructs[gActiveBattler].disabledMove == gBattleMons[gActiveBattler].moves[i]) + if (gDisableStructs[battler].disabledMove == gBattleMons[battler].moves[i]) break; } if (i == MAX_MON_MOVES) // pokemon does not have the disabled move anymore { - gDisableStructs[gActiveBattler].disabledMove = 0; - gDisableStructs[gActiveBattler].disableTimer = 0; + gDisableStructs[battler].disabledMove = 0; + gDisableStructs[battler].disableTimer = 0; } - else if (--gDisableStructs[gActiveBattler].disableTimer == 0) // disable ends + else if (--gDisableStructs[battler].disableTimer == 0) // disable ends { - gDisableStructs[gActiveBattler].disabledMove = 0; + gDisableStructs[battler].disabledMove = 0; BattleScriptExecute(BattleScript_DisabledNoMore); effect++; } @@ -2969,18 +2930,18 @@ u8 DoBattlerEndTurnEffects(void) gBattleStruct->turnEffectsTracker++; break; case ENDTURN_ENCORE: // encore - if (gDisableStructs[gActiveBattler].encoreTimer != 0) + if (gDisableStructs[battler].encoreTimer != 0) { - if (gBattleMons[gActiveBattler].moves[gDisableStructs[gActiveBattler].encoredMovePos] != gDisableStructs[gActiveBattler].encoredMove) // pokemon does not have the encored move anymore + if (gBattleMons[battler].moves[gDisableStructs[battler].encoredMovePos] != gDisableStructs[battler].encoredMove) // pokemon does not have the encored move anymore { - gDisableStructs[gActiveBattler].encoredMove = 0; - gDisableStructs[gActiveBattler].encoreTimer = 0; + gDisableStructs[battler].encoredMove = 0; + gDisableStructs[battler].encoreTimer = 0; } - else if (--gDisableStructs[gActiveBattler].encoreTimer == 0 - || gBattleMons[gActiveBattler].pp[gDisableStructs[gActiveBattler].encoredMovePos] == 0) + else if (--gDisableStructs[battler].encoreTimer == 0 + || gBattleMons[battler].pp[gDisableStructs[battler].encoredMovePos] == 0) { - gDisableStructs[gActiveBattler].encoredMove = 0; - gDisableStructs[gActiveBattler].encoreTimer = 0; + gDisableStructs[battler].encoredMove = 0; + gDisableStructs[battler].encoreTimer = 0; BattleScriptExecute(BattleScript_EncoredNoMore); effect++; } @@ -2988,17 +2949,17 @@ u8 DoBattlerEndTurnEffects(void) gBattleStruct->turnEffectsTracker++; break; case ENDTURN_LOCK_ON: // lock-on decrement - if (gStatuses3[gActiveBattler] & STATUS3_ALWAYS_HITS) - gStatuses3[gActiveBattler] -= STATUS3_ALWAYS_HITS_TURN(1); + if (gStatuses3[battler] & STATUS3_ALWAYS_HITS) + gStatuses3[battler] -= STATUS3_ALWAYS_HITS_TURN(1); gBattleStruct->turnEffectsTracker++; break; case ENDTURN_CHARGE: // charge - if (gDisableStructs[gActiveBattler].chargeTimer && --gDisableStructs[gActiveBattler].chargeTimer == 0) - gStatuses3[gActiveBattler] &= ~STATUS3_CHARGED_UP; + if (gDisableStructs[battler].chargeTimer && --gDisableStructs[battler].chargeTimer == 0) + gStatuses3[battler] &= ~STATUS3_CHARGED_UP; gBattleStruct->turnEffectsTracker++; break; case ENDTURN_TAUNT: // taunt - if (gDisableStructs[gActiveBattler].tauntTimer && --gDisableStructs[gActiveBattler].tauntTimer == 0) + if (gDisableStructs[battler].tauntTimer && --gDisableStructs[battler].tauntTimer == 0) { BattleScriptExecute(BattleScript_BufferEndTurn); PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT); @@ -3007,23 +2968,23 @@ u8 DoBattlerEndTurnEffects(void) gBattleStruct->turnEffectsTracker++; break; case ENDTURN_YAWN: // yawn - if (gStatuses3[gActiveBattler] & STATUS3_YAWN) + if (gStatuses3[battler] & STATUS3_YAWN) { - u16 battlerAbility = GetBattlerAbility(gActiveBattler); - gStatuses3[gActiveBattler] -= STATUS3_YAWN_TURN(1); - if (!(gStatuses3[gActiveBattler] & STATUS3_YAWN) && !(gBattleMons[gActiveBattler].status1 & STATUS1_ANY) + u16 battlerAbility = GetBattlerAbility(battler); + gStatuses3[battler] -= STATUS3_YAWN_TURN(1); + if (!(gStatuses3[battler] & STATUS3_YAWN) && !(gBattleMons[battler].status1 & STATUS1_ANY) && battlerAbility != ABILITY_VITAL_SPIRIT - && battlerAbility != ABILITY_INSOMNIA && !UproarWakeUpCheck(gActiveBattler) - && !IsLeafGuardProtected(gActiveBattler)) + && battlerAbility != ABILITY_INSOMNIA && !UproarWakeUpCheck(battler) + && !IsLeafGuardProtected(battler)) { - CancelMultiTurnMoves(gActiveBattler); - gEffectBattler = gActiveBattler; - if (IsBattlerTerrainAffected(gActiveBattler, STATUS_FIELD_ELECTRIC_TERRAIN)) + CancelMultiTurnMoves(battler); + gEffectBattler = battler; + if (IsBattlerTerrainAffected(battler, STATUS_FIELD_ELECTRIC_TERRAIN)) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_TERRAINPREVENTS_ELECTRIC; BattleScriptExecute(BattleScript_TerrainPreventsEnd2); } - else if (IsBattlerTerrainAffected(gActiveBattler, STATUS_FIELD_MISTY_TERRAIN)) + else if (IsBattlerTerrainAffected(battler, STATUS_FIELD_MISTY_TERRAIN)) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_TERRAINPREVENTS_MISTY; BattleScriptExecute(BattleScript_TerrainPreventsEnd2); @@ -3031,12 +2992,12 @@ u8 DoBattlerEndTurnEffects(void) else { #if B_SLEEP_TURNS >= GEN_5 - gBattleMons[gActiveBattler].status1 |= ((Random() % 3) + 2); + gBattleMons[battler].status1 |= ((Random() % 3) + 2); #else - gBattleMons[gActiveBattler].status1 |= ((Random() % 4) + 3); + gBattleMons[battler].status1 |= ((Random() % 4) + 3); #endif - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); + MarkBattlerForControllerExec(battler); BattleScriptExecute(BattleScript_YawnMakesAsleep); } effect++; @@ -3045,19 +3006,19 @@ u8 DoBattlerEndTurnEffects(void) gBattleStruct->turnEffectsTracker++; break; case ENDTURN_LASER_FOCUS: - if (gStatuses3[gActiveBattler] & STATUS3_LASER_FOCUS) + if (gStatuses3[battler] & STATUS3_LASER_FOCUS) { - if (gDisableStructs[gActiveBattler].laserFocusTimer == 0 || --gDisableStructs[gActiveBattler].laserFocusTimer == 0) - gStatuses3[gActiveBattler] &= ~STATUS3_LASER_FOCUS; + if (gDisableStructs[battler].laserFocusTimer == 0 || --gDisableStructs[battler].laserFocusTimer == 0) + gStatuses3[battler] &= ~STATUS3_LASER_FOCUS; } gBattleStruct->turnEffectsTracker++; break; case ENDTURN_EMBARGO: - if (gStatuses3[gActiveBattler] & STATUS3_EMBARGO) + if (gStatuses3[battler] & STATUS3_EMBARGO) { - if (gDisableStructs[gActiveBattler].embargoTimer == 0 || --gDisableStructs[gActiveBattler].embargoTimer == 0) + if (gDisableStructs[battler].embargoTimer == 0 || --gDisableStructs[battler].embargoTimer == 0) { - gStatuses3[gActiveBattler] &= ~STATUS3_EMBARGO; + gStatuses3[battler] &= ~STATUS3_EMBARGO; BattleScriptExecute(BattleScript_EmbargoEndTurn); effect++; } @@ -3065,11 +3026,11 @@ u8 DoBattlerEndTurnEffects(void) gBattleStruct->turnEffectsTracker++; break; case ENDTURN_MAGNET_RISE: - if (gStatuses3[gActiveBattler] & STATUS3_MAGNET_RISE) + if (gStatuses3[battler] & STATUS3_MAGNET_RISE) { - if (gDisableStructs[gActiveBattler].magnetRiseTimer == 0 || --gDisableStructs[gActiveBattler].magnetRiseTimer == 0) + if (gDisableStructs[battler].magnetRiseTimer == 0 || --gDisableStructs[battler].magnetRiseTimer == 0) { - gStatuses3[gActiveBattler] &= ~STATUS3_MAGNET_RISE; + gStatuses3[battler] &= ~STATUS3_MAGNET_RISE; BattleScriptExecute(BattleScript_BufferEndTurn); PREPARE_STRING_BUFFER(gBattleTextBuff1, STRINGID_ELECTROMAGNETISM); effect++; @@ -3078,11 +3039,11 @@ u8 DoBattlerEndTurnEffects(void) gBattleStruct->turnEffectsTracker++; break; case ENDTURN_TELEKINESIS: - if (gStatuses3[gActiveBattler] & STATUS3_TELEKINESIS) + if (gStatuses3[battler] & STATUS3_TELEKINESIS) { - if (gDisableStructs[gActiveBattler].telekinesisTimer == 0 || --gDisableStructs[gActiveBattler].telekinesisTimer == 0) + if (gDisableStructs[battler].telekinesisTimer == 0 || --gDisableStructs[battler].telekinesisTimer == 0) { - gStatuses3[gActiveBattler] &= ~STATUS3_TELEKINESIS; + gStatuses3[battler] &= ~STATUS3_TELEKINESIS; BattleScriptExecute(BattleScript_TelekinesisEndTurn); effect++; } @@ -3090,11 +3051,11 @@ u8 DoBattlerEndTurnEffects(void) gBattleStruct->turnEffectsTracker++; break; case ENDTURN_HEALBLOCK: - if (gStatuses3[gActiveBattler] & STATUS3_HEAL_BLOCK) + if (gStatuses3[battler] & STATUS3_HEAL_BLOCK) { - if (gDisableStructs[gActiveBattler].healBlockTimer == 0 || --gDisableStructs[gActiveBattler].healBlockTimer == 0) + if (gDisableStructs[battler].healBlockTimer == 0 || --gDisableStructs[battler].healBlockTimer == 0) { - gStatuses3[gActiveBattler] &= ~STATUS3_HEAL_BLOCK; + gStatuses3[battler] &= ~STATUS3_HEAL_BLOCK; BattleScriptExecute(BattleScript_BufferEndTurn); PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_HEAL_BLOCK); effect++; @@ -3103,22 +3064,22 @@ u8 DoBattlerEndTurnEffects(void) gBattleStruct->turnEffectsTracker++; break; case ENDTURN_ROOST: // Return flying type. - if (gBattleResources->flags->flags[gActiveBattler] & RESOURCE_FLAG_ROOST) + if (gBattleResources->flags->flags[battler] & RESOURCE_FLAG_ROOST) { - gBattleResources->flags->flags[gActiveBattler] &= ~RESOURCE_FLAG_ROOST; - gBattleMons[gActiveBattler].type1 = gBattleStruct->roostTypes[gActiveBattler][0]; - gBattleMons[gActiveBattler].type2 = gBattleStruct->roostTypes[gActiveBattler][1]; + gBattleResources->flags->flags[battler] &= ~RESOURCE_FLAG_ROOST; + gBattleMons[battler].type1 = gBattleStruct->roostTypes[battler][0]; + gBattleMons[battler].type2 = gBattleStruct->roostTypes[battler][1]; } gBattleStruct->turnEffectsTracker++; break; case ENDTURN_ELECTRIFY: - gStatuses4[gActiveBattler] &= ~STATUS4_ELECTRIFIED; + gStatuses4[battler] &= ~STATUS4_ELECTRIFIED; gBattleStruct->turnEffectsTracker++; case ENDTURN_POWDER: - gBattleMons[gActiveBattler].status2 &= ~STATUS2_POWDER; + gBattleMons[battler].status2 &= ~STATUS2_POWDER; gBattleStruct->turnEffectsTracker++; case ENDTURN_THROAT_CHOP: - if (gDisableStructs[gActiveBattler].throatChopTimer && --gDisableStructs[gActiveBattler].throatChopTimer == 0) + if (gDisableStructs[battler].throatChopTimer && --gDisableStructs[battler].throatChopTimer == 0) { BattleScriptExecute(BattleScript_ThroatChopEndTurn); effect++; @@ -3126,8 +3087,8 @@ u8 DoBattlerEndTurnEffects(void) gBattleStruct->turnEffectsTracker++; break; case ENDTURN_SLOW_START: - if (gDisableStructs[gActiveBattler].slowStartTimer - && --gDisableStructs[gActiveBattler].slowStartTimer == 0 + if (gDisableStructs[battler].slowStartTimer + && --gDisableStructs[battler].slowStartTimer == 0 && ability == ABILITY_SLOW_START) { BattleScriptExecute(BattleScript_SlowStartEnds); @@ -3136,12 +3097,28 @@ u8 DoBattlerEndTurnEffects(void) gBattleStruct->turnEffectsTracker++; break; case ENDTURN_PLASMA_FISTS: - gStatuses4[gActiveBattler] &= ~STATUS4_PLASMA_FISTS; + gStatuses4[battler] &= ~STATUS4_PLASMA_FISTS; gBattleStruct->turnEffectsTracker++; break; case ENDTURN_CUD_CHEW: - if (GetBattlerAbility(gActiveBattler) == ABILITY_CUD_CHEW && !gDisableStructs[gActiveBattler].cudChew && ItemId_GetPocket(GetUsedHeldItem(gActiveBattler)) == POCKET_BERRIES) - gDisableStructs[gActiveBattler].cudChew = TRUE; + if (GetBattlerAbility(battler) == ABILITY_CUD_CHEW && !gDisableStructs[battler].cudChew && ItemId_GetPocket(GetUsedHeldItem(battler)) == POCKET_BERRIES) + gDisableStructs[battler].cudChew = TRUE; + gBattleStruct->turnEffectsTracker++; + break; + case ENDTURN_SALT_CURE: + if (gStatuses4[battler] & STATUS4_SALT_CURE && gBattleMons[battler].hp != 0) + { + gBattlerTarget = battler; + if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_STEEL) || IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_WATER)) + gBattleMoveDamage = gBattleMons[gBattlerTarget].maxHP / 4; + else + gBattleMoveDamage = gBattleMons[gBattlerTarget].maxHP / 8; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_SALT_CURE); + BattleScriptExecute(BattleScript_SaltCureExtraDamage); + effect++; + } gBattleStruct->turnEffectsTracker++; break; case ENDTURN_BATTLER_COUNT: // done @@ -3158,45 +3135,46 @@ u8 DoBattlerEndTurnEffects(void) return 0; } -bool8 HandleWishPerishSongOnTurnEnd(void) +bool32 HandleWishPerishSongOnTurnEnd(void) { - gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_SKIP_DMG_TRACK); + u32 battler; + gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_SKIP_DMG_TRACK); switch (gBattleStruct->wishPerishSongState) { case 0: while (gBattleStruct->wishPerishSongBattlerId < gBattlersCount) { - gActiveBattler = gBattleStruct->wishPerishSongBattlerId; - if (gAbsentBattlerFlags & gBitTable[gActiveBattler]) + battler = gBattleStruct->wishPerishSongBattlerId; + if (gAbsentBattlerFlags & gBitTable[battler]) { gBattleStruct->wishPerishSongBattlerId++; continue; } gBattleStruct->wishPerishSongBattlerId++; - if (gWishFutureKnock.futureSightCounter[gActiveBattler] != 0 - && --gWishFutureKnock.futureSightCounter[gActiveBattler] == 0 - && gBattleMons[gActiveBattler].hp != 0) + if (gWishFutureKnock.futureSightCounter[battler] != 0 + && --gWishFutureKnock.futureSightCounter[battler] == 0 + && gBattleMons[battler].hp != 0) { - if (gWishFutureKnock.futureSightMove[gActiveBattler] == MOVE_FUTURE_SIGHT) + if (gWishFutureKnock.futureSightMove[battler] == MOVE_FUTURE_SIGHT) gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_FUTURE_SIGHT; else gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DOOM_DESIRE; - PREPARE_MOVE_BUFFER(gBattleTextBuff1, gWishFutureKnock.futureSightMove[gActiveBattler]); + PREPARE_MOVE_BUFFER(gBattleTextBuff1, gWishFutureKnock.futureSightMove[battler]); - gBattlerTarget = gActiveBattler; - gBattlerAttacker = gWishFutureKnock.futureSightAttacker[gActiveBattler]; + gBattlerTarget = battler; + gBattlerAttacker = gWishFutureKnock.futureSightAttacker[battler]; gSpecialStatuses[gBattlerTarget].dmg = 0xFFFF; - gCurrentMove = gWishFutureKnock.futureSightMove[gActiveBattler]; - SetTypeBeforeUsingMove(gCurrentMove, gActiveBattler); + gCurrentMove = gWishFutureKnock.futureSightMove[battler]; + SetTypeBeforeUsingMove(gCurrentMove, battler); BattleScriptExecute(BattleScript_MonTookFutureAttack); - if (gWishFutureKnock.futureSightCounter[gActiveBattler] == 0 - && gWishFutureKnock.futureSightCounter[BATTLE_PARTNER(gActiveBattler)] == 0) + if (gWishFutureKnock.futureSightCounter[battler] == 0 + && gWishFutureKnock.futureSightCounter[BATTLE_PARTNER(battler)] == 0) { - gSideStatuses[GET_BATTLER_SIDE(gBattlerTarget)] &= ~SIDE_STATUS_FUTUREATTACK; + gSideStatuses[GetBattlerSide(gBattlerTarget)] &= ~SIDE_STATUS_FUTUREATTACK; } return TRUE; } @@ -3207,37 +3185,33 @@ bool8 HandleWishPerishSongOnTurnEnd(void) case 1: while (gBattleStruct->wishPerishSongBattlerId < gBattlersCount) { - gActiveBattler = gBattlerAttacker = gBattlerByTurnOrder[gBattleStruct->wishPerishSongBattlerId]; - if (gAbsentBattlerFlags & gBitTable[gActiveBattler]) + battler = gBattlerAttacker = gBattlerByTurnOrder[gBattleStruct->wishPerishSongBattlerId]; + if (gAbsentBattlerFlags & gBitTable[battler]) { gBattleStruct->wishPerishSongBattlerId++; continue; } gBattleStruct->wishPerishSongBattlerId++; - if (gStatuses3[gActiveBattler] & STATUS3_PERISH_SONG) + if (gStatuses3[battler] & STATUS3_PERISH_SONG) { - PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff1, 1, gDisableStructs[gActiveBattler].perishSongTimer); - if (gDisableStructs[gActiveBattler].perishSongTimer == 0) + PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff1, 1, gDisableStructs[battler].perishSongTimer); + if (gDisableStructs[battler].perishSongTimer == 0) { - gStatuses3[gActiveBattler] &= ~STATUS3_PERISH_SONG; - gBattleMoveDamage = gBattleMons[gActiveBattler].hp; + gStatuses3[battler] &= ~STATUS3_PERISH_SONG; + gBattleMoveDamage = gBattleMons[battler].hp; gBattlescriptCurrInstr = BattleScript_PerishSongTakesLife; } else { - gDisableStructs[gActiveBattler].perishSongTimer--; + gDisableStructs[battler].perishSongTimer--; gBattlescriptCurrInstr = BattleScript_PerishSongCountGoesDown; } BattleScriptExecute(gBattlescriptCurrInstr); return TRUE; } } - // Hm... - { - u8 *state = &gBattleStruct->wishPerishSongState; - *state = 2; - gBattleStruct->wishPerishSongBattlerId = 0; - } + gBattleStruct->wishPerishSongState = 2; + gBattleStruct->wishPerishSongBattlerId = 0; // fall through case 2: if ((gBattleTypeFlags & BATTLE_TYPE_ARENA) @@ -3264,7 +3238,7 @@ bool8 HandleWishPerishSongOnTurnEnd(void) #define FAINTED_ACTIONS_MAX_CASE 8 -bool8 HandleFaintedMonActions(void) +bool32 HandleFaintedMonActions(void) { if (gBattleTypeFlags & BATTLE_TYPE_SAFARI) return FALSE; @@ -3457,7 +3431,7 @@ u8 AtkCanceller_UnableToUseMove(u32 moveType) gBattleStruct->atkCancellerTracker++; break; case CANCELLER_FROZEN: // check being frozen - if (gBattleMons[gBattlerAttacker].status1 & STATUS1_FREEZE && !(gBattleMoves[gCurrentMove].flags & FLAG_THAW_USER)) + if (gBattleMons[gBattlerAttacker].status1 & STATUS1_FREEZE && !(gBattleMoves[gCurrentMove].thawsUser)) { if (!RandomPercentage(RNG_FROZEN, 20)) { @@ -3679,7 +3653,7 @@ u8 AtkCanceller_UnableToUseMove(u32 moveType) } effect = 2; } - if (gBattleMons[gBattlerAttacker].status1 & STATUS1_FROSTBITE && (gBattleMoves[gCurrentMove].flags & FLAG_THAW_USER)) + if (gBattleMons[gBattlerAttacker].status1 & STATUS1_FROSTBITE && gBattleMoves[gCurrentMove].thawsUser) { if (!(gBattleMoves[gCurrentMove].effect == EFFECT_BURN_UP && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_FIRE))) { @@ -3693,7 +3667,7 @@ u8 AtkCanceller_UnableToUseMove(u32 moveType) gBattleStruct->atkCancellerTracker++; break; case CANCELLER_POWDER_MOVE: - if ((gBattleMoves[gCurrentMove].flags & FLAG_POWDER) && (gBattlerAttacker != gBattlerTarget)) + if ((gBattleMoves[gCurrentMove].powderMove) && (gBattlerAttacker != gBattlerTarget)) { #if B_POWDER_GRASS >= GEN_6 if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_GRASS) || GetBattlerAbility(gBattlerTarget) == ABILITY_OVERCOAT) @@ -3733,7 +3707,7 @@ u8 AtkCanceller_UnableToUseMove(u32 moveType) gBattleStruct->atkCancellerTracker++; break; case CANCELLER_THROAT_CHOP: - if (gBattleStruct->zmove.toBeUsed[gBattlerAttacker] == MOVE_NONE && gDisableStructs[gBattlerAttacker].throatChopTimer && gBattleMoves[gCurrentMove].flags & FLAG_SOUND) + if (gBattleStruct->zmove.toBeUsed[gBattlerAttacker] == MOVE_NONE && gDisableStructs[gBattlerAttacker].throatChopTimer && gBattleMoves[gCurrentMove].soundMove) { gProtectStructs[gBattlerAttacker].usedThroatChopPreventedMove = TRUE; CancelMultiTurnMoves(gBattlerAttacker); @@ -3792,21 +3766,19 @@ u8 AtkCanceller_UnableToUseMove(u32 moveType) PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 1, 0) } - else if (gBattleMoves[gCurrentMove].flags & FLAG_TWO_STRIKES) + else if (gBattleMoves[gCurrentMove].strikeCount > 1) { - gMultiHitCounter = 2; - PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 1, 0) - if (gCurrentMove == MOVE_DRAGON_DARTS) + if (gBattleMoves[gCurrentMove].effect == EFFECT_POPULATION_BOMB && GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_LOADED_DICE) { - // TODO + gMultiHitCounter = RandomUniform(RNG_LOADED_DICE, 4, 10); + } + else + { + gMultiHitCounter = gBattleMoves[gCurrentMove].strikeCount; + PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 3, 0) } } - else if (gBattleMoves[gCurrentMove].effect == EFFECT_TRIPLE_KICK || gBattleMoves[gCurrentMove].flags & FLAG_THREE_STRIKES) - { - gMultiHitCounter = 3; - PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 1, 0) - } - #if B_BEAT_UP >= GEN_5 + #if B_BEAT_UP >= GEN_5 else if (gBattleMoves[gCurrentMove].effect == EFFECT_BEAT_UP) { struct Pokemon* party = GetBattlerParty(gBattlerAttacker); @@ -3824,7 +3796,7 @@ u8 AtkCanceller_UnableToUseMove(u32 moveType) gBattleStruct->beatUpSlot = 0; PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 1, 0) } - #endif + #endif gBattleStruct->atkCancellerTracker++; break; case CANCELLER_END: @@ -3835,9 +3807,8 @@ u8 AtkCanceller_UnableToUseMove(u32 moveType) if (effect == 2) { - gActiveBattler = gBattlerAttacker; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(gBattlerAttacker, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gBattlerAttacker].status1); + MarkBattlerForControllerExec(gBattlerAttacker); } return effect; } @@ -3875,7 +3846,7 @@ u8 AtkCanceller_UnableToUseMove2(void) return effect; } -bool8 HasNoMonsToSwitch(u8 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2) +bool32 HasNoMonsToSwitch(u32 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2) { u32 i, side, playerId, flankId; struct Pokemon *party; @@ -4030,7 +4001,7 @@ static const u16 sWeatherFlagsInfo[][3] = [ENUM_WEATHER_SNOW] = {B_WEATHER_SNOW_TEMPORARY, B_WEATHER_SNOW_PERMANENT, HOLD_EFFECT_ICY_ROCK}, }; -static void ShouldChangeFormInWeather(u8 battler) +static void ShouldChangeFormInWeather(u32 battler) { int i; int side = GetBattlerSide(battler); @@ -4045,7 +4016,7 @@ static void ShouldChangeFormInWeather(u8 battler) } } -bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility) +bool32 TryChangeBattleWeather(u32 battler, u32 weatherEnumId, bool32 viaAbility) { u16 battlerAbility = GetBattlerAbility(battler); if (gBattleWeather & B_WEATHER_PRIMAL_ANY @@ -4095,10 +4066,10 @@ static bool32 TryChangeBattleTerrain(u32 battler, u32 statusFlag, u8 *timer) return FALSE; } -static u8 ForewarnChooseMove(u32 battler) +static void ForewarnChooseMove(u32 battler) { struct Forewarn { - u8 battlerId; + u8 battler; u8 power; u16 moveId; }; @@ -4115,7 +4086,7 @@ static u8 ForewarnChooseMove(u32 battler) if (gBattleMons[i].moves[j] == MOVE_NONE) continue; data[count].moveId = gBattleMons[i].moves[j]; - data[count].battlerId = i; + data[count].battler = i; switch (gBattleMoves[data[count].moveId].effect) { case EFFECT_OHKO: @@ -4146,16 +4117,16 @@ static u8 ForewarnChooseMove(u32 battler) bestId = i; } - gBattlerTarget = data[bestId].battlerId; + gBattlerTarget = data[bestId].battler; PREPARE_MOVE_BUFFER(gBattleTextBuff1, data[bestId].moveId) RecordKnownMove(gBattlerTarget, data[bestId].moveId); Free(data); } -bool8 ChangeTypeBasedOnTerrain(u8 battlerId) +bool32 ChangeTypeBasedOnTerrain(u32 battler) { - u8 battlerType; + u32 battlerType; if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN) battlerType = TYPE_ELECTRIC; @@ -4168,19 +4139,19 @@ bool8 ChangeTypeBasedOnTerrain(u8 battlerId) else // failsafe return FALSE; - SET_BATTLER_TYPE(battlerId, battlerType); + SET_BATTLER_TYPE(battler, battlerType); PREPARE_TYPE_BUFFER(gBattleTextBuff1, battlerType); return TRUE; } // Supreme Overlord adds a damage boost for each fainted ally. // The first ally adds a x1.2 boost, and subsequent allies add an extra x0.1 boost each. -static u16 GetSupremeOverlordModifier(u8 battlerId) +static uq4_12_t GetSupremeOverlordModifier(u32 battler) { u32 i; - struct Pokemon *party = GetBattlerParty(battlerId); - u16 modifier = UQ_4_12(1.0); - bool8 appliedFirstBoost = FALSE; + struct Pokemon *party = GetBattlerParty(battler); + uq4_12_t modifier = UQ_4_12(1.0); + bool32 appliedFirstBoost = FALSE; for (i = 0; i < PARTY_SIZE; i++) { @@ -4194,9 +4165,9 @@ static u16 GetSupremeOverlordModifier(u8 battlerId) return modifier; } -u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 moveArg) +u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 moveArg) { - u8 effect = 0; + u32 effect = 0; u32 speciesAtk, speciesDef; u32 moveType, move; u32 i, j; @@ -4224,84 +4195,110 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move switch (caseID) { - case ABILITYEFFECT_ON_SWITCHIN: // 0 + case ABILITYEFFECT_SWITCH_IN_TERRAIN: gBattleScripting.battler = battler; - switch (gLastUsedAbility) + if (VarGet(VAR_TERRAIN) & STATUS_FIELD_TERRAIN_ANY) { - case ABILITYEFFECT_SWITCH_IN_TERRAIN: - if (VarGet(VAR_TERRAIN) & STATUS_FIELD_TERRAIN_ANY) - { - u16 terrainFlags = VarGet(VAR_TERRAIN) & STATUS_FIELD_TERRAIN_ANY; // only works for status flag (1 << 15) - gFieldStatuses = terrainFlags | STATUS_FIELD_TERRAIN_PERMANENT; // terrain is permanent - switch (VarGet(VAR_TERRAIN) & STATUS_FIELD_TERRAIN_ANY) - { - case STATUS_FIELD_ELECTRIC_TERRAIN: - gBattleCommunication[MULTISTRING_CHOOSER] = 2; - break; - case STATUS_FIELD_MISTY_TERRAIN: - gBattleCommunication[MULTISTRING_CHOOSER] = 0; - break; - case STATUS_FIELD_GRASSY_TERRAIN: - gBattleCommunication[MULTISTRING_CHOOSER] = 1; - break; - case STATUS_FIELD_PSYCHIC_TERRAIN: - gBattleCommunication[MULTISTRING_CHOOSER] = 3; - break; - } - - BattleScriptPushCursorAndCallback(BattleScript_OverworldTerrain); - effect++; - } - #if B_THUNDERSTORM_TERRAIN == TRUE - else if (GetCurrentWeather() == WEATHER_RAIN_THUNDERSTORM && !(gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN)) + u16 terrainFlags = VarGet(VAR_TERRAIN) & STATUS_FIELD_TERRAIN_ANY; // only works for status flag (1 << 15) + gFieldStatuses = terrainFlags | STATUS_FIELD_TERRAIN_PERMANENT; // terrain is permanent + switch (VarGet(VAR_TERRAIN) & STATUS_FIELD_TERRAIN_ANY) { - // overworld weather started rain, so just do electric terrain anim - gFieldStatuses = (STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_TERRAIN_PERMANENT); + case STATUS_FIELD_ELECTRIC_TERRAIN: gBattleCommunication[MULTISTRING_CHOOSER] = 2; - BattleScriptPushCursorAndCallback(BattleScript_OverworldTerrain); - effect++; + break; + case STATUS_FIELD_MISTY_TERRAIN: + gBattleCommunication[MULTISTRING_CHOOSER] = 0; + break; + case STATUS_FIELD_GRASSY_TERRAIN: + gBattleCommunication[MULTISTRING_CHOOSER] = 1; + break; + case STATUS_FIELD_PSYCHIC_TERRAIN: + gBattleCommunication[MULTISTRING_CHOOSER] = 3; + break; } - #endif - break; - case ABILITYEFFECT_SWITCH_IN_WEATHER: - if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) + + BattleScriptPushCursorAndCallback(BattleScript_OverworldTerrain); + effect++; + } + #if B_THUNDERSTORM_TERRAIN == TRUE + else if (GetCurrentWeather() == WEATHER_RAIN_THUNDERSTORM && !(gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN)) + { + // overworld weather started rain, so just do electric terrain anim + gFieldStatuses = (STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_TERRAIN_PERMANENT); + gBattleCommunication[MULTISTRING_CHOOSER] = 2; + BattleScriptPushCursorAndCallback(BattleScript_OverworldTerrain); + effect++; + } + #endif + #if B_FOG_TERRAIN == TRUE + else if ((GetCurrentWeather() == WEATHER_FOG_HORIZONTAL || GetCurrentWeather() == WEATHER_FOG_DIAGONAL) && !(gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN)) + { + gFieldStatuses = (STATUS_FIELD_MISTY_TERRAIN | STATUS_FIELD_TERRAIN_PERMANENT); + gBattleCommunication[MULTISTRING_CHOOSER] = 0; + BattleScriptPushCursorAndCallback(BattleScript_OverworldTerrain); + effect++; + } + #endif + break; + case ABILITYEFFECT_SWITCH_IN_WEATHER: + gBattleScripting.battler = battler; + if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) + { + switch (GetCurrentWeather()) { - switch (GetCurrentWeather()) + case WEATHER_RAIN: + case WEATHER_RAIN_THUNDERSTORM: + case WEATHER_DOWNPOUR: + if (!(gBattleWeather & B_WEATHER_RAIN)) { - case WEATHER_RAIN: - case WEATHER_RAIN_THUNDERSTORM: - case WEATHER_DOWNPOUR: - if (!(gBattleWeather & B_WEATHER_RAIN)) - { - gBattleWeather = (B_WEATHER_RAIN_TEMPORARY | B_WEATHER_RAIN_PERMANENT); - gBattleScripting.animArg1 = B_ANIM_RAIN_CONTINUES; - effect++; - } - break; - case WEATHER_SANDSTORM: - if (!(gBattleWeather & B_WEATHER_SANDSTORM)) - { - gBattleWeather = B_WEATHER_SANDSTORM; - gBattleScripting.animArg1 = B_ANIM_SANDSTORM_CONTINUES; + gBattleWeather = (B_WEATHER_RAIN_TEMPORARY | B_WEATHER_RAIN_PERMANENT); + gBattleScripting.animArg1 = B_ANIM_RAIN_CONTINUES; + effect++; + } + break; + case WEATHER_SANDSTORM: + if (!(gBattleWeather & B_WEATHER_SANDSTORM)) + { + gBattleWeather = B_WEATHER_SANDSTORM; + gBattleScripting.animArg1 = B_ANIM_SANDSTORM_CONTINUES; + effect++; + } + break; + case WEATHER_DROUGHT: + if (!(gBattleWeather & B_WEATHER_SUN)) + { + gBattleWeather = (B_WEATHER_SUN_PERMANENT | B_WEATHER_SUN_TEMPORARY); + gBattleScripting.animArg1 = B_ANIM_SUN_CONTINUES; + effect++; + } + break; + case WEATHER_SNOW: + if (!(gBattleWeather & (B_WEATHER_HAIL | B_WEATHER_SNOW))) + { + #if B_OVERWORLD_SNOW >= GEN_9 + gBattleWeather = B_WEATHER_SNOW; + gBattleScripting.animArg1 = B_ANIM_SNOW_CONTINUES; effect++; - } - break; - case WEATHER_DROUGHT: - if (!(gBattleWeather & B_WEATHER_SUN)) - { - gBattleWeather = (B_WEATHER_SUN_PERMANENT | B_WEATHER_SUN_TEMPORARY); - gBattleScripting.animArg1 = B_ANIM_SUN_CONTINUES; + #else + gBattleWeather = B_WEATHER_HAIL; + gBattleScripting.animArg1 = B_ANIM_HAIL_CONTINUES; effect++; - } - break; + #endif + } + break; } - if (effect != 0) - { - gBattleCommunication[MULTISTRING_CHOOSER] = GetCurrentWeather(); - BattleScriptPushCursorAndCallback(BattleScript_OverworldWeatherStarts); - } - break; + } + if (effect != 0) + { + gBattleCommunication[MULTISTRING_CHOOSER] = GetCurrentWeather(); + BattleScriptPushCursorAndCallback(BattleScript_OverworldWeatherStarts); + } + break; + case ABILITYEFFECT_ON_SWITCHIN: // 0 + gBattleScripting.battler = battler; + switch (gLastUsedAbility) + { case ABILITY_IMPOSTER: if (IsBattlerAlive(BATTLE_OPPOSITE(battler)) && !(gBattleMons[BATTLE_OPPOSITE(battler)].status2 & (STATUS2_TRANSFORMED | STATUS2_SUBSTITUTE)) @@ -4406,7 +4403,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move { move = gBattleMons[i].moves[j]; GET_MOVE_TYPE(move, moveType); - if (CalcTypeEffectivenessMultiplier(move, moveType, i, battler, FALSE) >= UQ_4_12(2.0)) + if (CalcTypeEffectivenessMultiplier(move, moveType, i, battler, ABILITY_ANTICIPATION, FALSE) >= UQ_4_12(2.0)) { effect++; break; @@ -4826,10 +4823,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move gBattleMons[battler].status1 = 0; gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE; - gBattleScripting.battler = gActiveBattler = battler; + gBattleScripting.battler = battler; BattleScriptPushCursorAndCallback(BattleScript_ShedSkinActivates); - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); + MarkBattlerForControllerExec(battler); effect++; } break; @@ -4932,7 +4929,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move && !gHasFetchedBall) { gBattleScripting.battler = battler; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, 2, &gLastUsedBall); + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, 2, &gLastUsedBall); MarkBattlerForControllerExec(battler); gHasFetchedBall = TRUE; gLastUsedItem = gLastUsedBall; @@ -4948,7 +4945,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } break; case ABILITY_CUD_CHEW: - if (ItemId_GetPocket(GetUsedHeldItem(battler)) == POCKET_BERRIES && gDisableStructs[gActiveBattler].cudChew == TRUE) + if (ItemId_GetPocket(GetUsedHeldItem(battler)) == POCKET_BERRIES && gDisableStructs[battler].cudChew == TRUE) { gLastUsedItem = gBattleStruct->usedHeldItems[battler][GetBattlerSide(battler)]; gBattleStruct->usedHeldItems[battler][GetBattlerSide(battler)] = ITEM_NONE; @@ -4965,8 +4962,8 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move u16 battlerAbility = GetBattlerAbility(battler); u16 targetAbility = GetBattlerAbility(gBattlerTarget); - if ((gLastUsedAbility == ABILITY_SOUNDPROOF && gBattleMoves[move].flags & FLAG_SOUND && !(moveTarget & MOVE_TARGET_USER)) - || (gLastUsedAbility == ABILITY_BULLETPROOF && gBattleMoves[move].flags & FLAG_BALLISTIC)) + if ((gLastUsedAbility == ABILITY_SOUNDPROOF && gBattleMoves[move].soundMove && !(moveTarget & MOVE_TARGET_USER)) + || (gLastUsedAbility == ABILITY_BULLETPROOF && gBattleMoves[move].ballisticMove)) { if (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS) gHitMarker |= HITMARKER_NO_PPDEDUCT; @@ -5078,7 +5075,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect = 2, statId = STAT_DEF, statAmount = 2; break; case ABILITY_WIND_RIDER: - if (gBattleMoves[gCurrentMove].flags & FLAG_WIND_MOVE && !(GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove) & MOVE_TARGET_USER)) + if (gBattleMoves[gCurrentMove].windMove && !(GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove) & MOVE_TARGET_USER)) effect = 2, statId = STAT_ATK; break; case ABILITY_EARTH_EATER: @@ -5306,7 +5303,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && IsBattlerAlive(gBattlerAttacker) && TARGET_TURN_DAMAGED - && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)) + && IsMoveMakingContact(move, gBattlerAttacker)) { switch (gBattleMons[gBattlerAttacker].ability) { @@ -5414,7 +5411,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move && IsBattlerAlive(gBattlerAttacker) && IsMoveMakingContact(move, gBattlerAttacker)) { - u8 battler; + u32 battler; if ((battler = IsAbilityOnField(ABILITY_DAMP))) { gBattleScripting.battler = battler - 1; @@ -5589,7 +5586,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } else if (TryChangeBattleWeather(battler, ENUM_WEATHER_SANDSTORM, TRUE)) { - gBattleScripting.battler = gActiveBattler = battler; + gBattleScripting.battler = battler; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SandSpitActivates; effect++; @@ -5691,7 +5688,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } break; case ABILITY_WIND_POWER: - if (!(gBattleMoves[gCurrentMove].flags & FLAG_WIND_MOVE)) + if (!(gBattleMoves[gCurrentMove].windMove)) break; // fall through case ABILITY_ELECTROMORPHOSIS: @@ -5710,8 +5707,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move && !gProtectStructs[gBattlerAttacker].confusionSelfDmg && IS_MOVE_PHYSICAL(gCurrentMove) && TARGET_TURN_DAMAGED - && (gSideTimers[gBattlerAttacker].toxicSpikesAmount != 2) - && IsBattlerAlive(gBattlerTarget)) + && (gSideTimers[gBattlerAttacker].toxicSpikesAmount != 2)) { SWAP(gBattlerAttacker, gBattlerTarget, i); BattleScriptPushCursor(); @@ -5747,7 +5743,9 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move && !gProtectStructs[gBattlerAttacker].confusionSelfDmg && RandomWeighted(RNG_STENCH, 9, 1) && !IS_MOVE_STATUS(move) - && !sMovesNotAffectedByStench[gCurrentMove]) + && !gBattleMoves[gCurrentMove].effect != EFFECT_FLINCH_HIT + && !gBattleMoves[gCurrentMove].effect != EFFECT_FLINCH_STATUS + && !gBattleMoves[gCurrentMove].effect != EFFECT_TRIPLE_ARROWS) { gBattleScripting.moveEffect = MOVE_EFFECT_FLINCH; BattleScriptPushCursor(); @@ -5772,7 +5770,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move { case ABILITY_DANCER: if (IsBattlerAlive(battler) - && (gBattleMoves[gCurrentMove].flags & FLAG_DANCE) + && (gBattleMoves[gCurrentMove].danceMove) && !gSpecialStatuses[battler].dancerUsedMove && gBattlerAttacker != battler) { @@ -5880,9 +5878,9 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move break; } - gBattleScripting.battler = gActiveBattler = gBattlerAbility = battler; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); - MarkBattlerForControllerExec(gActiveBattler); + gBattleScripting.battler = gBattlerAbility = battler; + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); + MarkBattlerForControllerExec(battler); return effect; } } @@ -5937,24 +5935,25 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move { if (gBattleMons[i].ability == ABILITY_TRACE && (gBattleResources->flags->flags[i] & RESOURCE_FLAG_TRACED)) { - u8 side = (BATTLE_OPPOSITE(GetBattlerPosition(i))) & BIT_SIDE; // side of the opposing pokemon - u8 target1 = GetBattlerAtPosition(side); - u8 target2 = GetBattlerAtPosition(side + BIT_FLANK); + u32 chosenTarget; + u32 side = (BATTLE_OPPOSITE(GetBattlerPosition(i))) & BIT_SIDE; // side of the opposing pokemon + u32 target1 = GetBattlerAtPosition(side); + u32 target2 = GetBattlerAtPosition(side + BIT_FLANK); if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { if (!sAbilitiesNotTraced[gBattleMons[target1].ability] && gBattleMons[target1].hp != 0 && !sAbilitiesNotTraced[gBattleMons[target2].ability] && gBattleMons[target2].hp != 0) - gActiveBattler = GetBattlerAtPosition(((Random() & 1) * 2) | side), effect++; + chosenTarget = GetBattlerAtPosition(((Random() & 1) * 2) | side), effect++; else if (!sAbilitiesNotTraced[gBattleMons[target1].ability] && gBattleMons[target1].hp != 0) - gActiveBattler = target1, effect++; + chosenTarget = target1, effect++; else if (!sAbilitiesNotTraced[gBattleMons[target2].ability] && gBattleMons[target2].hp != 0) - gActiveBattler = target2, effect++; + chosenTarget = target2, effect++; } else { if (!sAbilitiesNotTraced[gBattleMons[target1].ability] && gBattleMons[target1].hp != 0) - gActiveBattler = target1, effect++; + chosenTarget = target1, effect++; } if (effect != 0) @@ -5969,11 +5968,11 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move gBattlescriptCurrInstr = BattleScript_TraceActivates; } gBattleResources->flags->flags[i] &= ~RESOURCE_FLAG_TRACED; - gBattleStruct->tracedAbility[i] = gLastUsedAbility = gBattleMons[gActiveBattler].ability; - RecordAbilityBattle(gActiveBattler, gLastUsedAbility); // Record the opposing battler has this ability + gBattleStruct->tracedAbility[i] = gLastUsedAbility = gBattleMons[chosenTarget].ability; + RecordAbilityBattle(chosenTarget, gLastUsedAbility); // Record the opposing battler has this ability battler = gBattlerAbility = gBattleScripting.battler = i; - PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gActiveBattler, gBattlerPartyIndexes[gActiveBattler]) + PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, chosenTarget, gBattlerPartyIndexes[chosenTarget]) PREPARE_ABILITY_BUFFER(gBattleTextBuff2, gLastUsedAbility) break; } @@ -6101,12 +6100,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move return effect; } -bool32 TryPrimalReversion(u8 battlerId) +bool32 TryPrimalReversion(u32 battler) { - if (GetBattlerHoldEffect(battlerId, FALSE) == HOLD_EFFECT_PRIMAL_ORB - && GetBattleFormChangeTargetSpecies(battlerId, FORM_CHANGE_BATTLE_PRIMAL_REVERSION) != SPECIES_NONE) + if (GetBattlerHoldEffect(battler, FALSE) == HOLD_EFFECT_PRIMAL_ORB + && GetBattleFormChangeTargetSpecies(battler, FORM_CHANGE_BATTLE_PRIMAL_REVERSION) != SPECIES_NONE) { - if (gBattlerAttacker == battlerId) + if (gBattlerAttacker == battler) { BattleScriptExecute(BattleScript_PrimalReversion); } @@ -6114,7 +6113,7 @@ bool32 TryPrimalReversion(u8 battlerId) { // edge case for scenarios like a switch-in after activated eject button gBattleScripting.savedBattler = gBattlerAttacker; - gBattlerAttacker = battlerId; + gBattlerAttacker = battler; BattleScriptExecute(BattleScript_PrimalReversionRestoreAttacker); } return TRUE; @@ -6171,12 +6170,12 @@ bool32 IsMyceliumMightOnField(void) return FALSE; } -u32 GetBattlerAbility(u8 battlerId) +u32 GetBattlerAbility(u32 battler) { - if (gStatuses3[battlerId] & STATUS3_GASTRO_ACID) + if (gStatuses3[battler] & STATUS3_GASTRO_ACID) return ABILITY_NONE; - if (IsNeutralizingGasOnField() && !IsNeutralizingGasBannedAbility(gBattleMons[battlerId].ability)) + if (IsNeutralizingGasOnField() && !IsNeutralizingGasBannedAbility(gBattleMons[battler].ability)) return ABILITY_NONE; if (IsMyceliumMightOnField()) @@ -6186,29 +6185,29 @@ u32 GetBattlerAbility(u8 battlerId) || gBattleMons[gBattlerAttacker].ability == ABILITY_TERAVOLT || gBattleMons[gBattlerAttacker].ability == ABILITY_TURBOBLAZE) && !(gStatuses3[gBattlerAttacker] & STATUS3_GASTRO_ACID)) - || gBattleMoves[gCurrentMove].flags & FLAG_TARGET_ABILITY_IGNORED) - && sAbilitiesAffectedByMoldBreaker[gBattleMons[battlerId].ability] + || gBattleMoves[gCurrentMove].ignoresTargetAbility) + && sAbilitiesAffectedByMoldBreaker[gBattleMons[battler].ability] && gBattlerByTurnOrder[gCurrentTurnActionNumber] == gBattlerAttacker && gActionsByTurnOrder[gBattlerByTurnOrder[gBattlerAttacker]] == B_ACTION_USE_MOVE && gCurrentTurnActionNumber < gBattlersCount) return ABILITY_NONE; - return gBattleMons[battlerId].ability; + return gBattleMons[battler].ability; } -u32 IsAbilityOnSide(u32 battlerId, u32 ability) +u32 IsAbilityOnSide(u32 battler, u32 ability) { - if (IsBattlerAlive(battlerId) && GetBattlerAbility(battlerId) == ability) - return battlerId + 1; - else if (IsBattlerAlive(BATTLE_PARTNER(battlerId)) && GetBattlerAbility(BATTLE_PARTNER(battlerId)) == ability) - return BATTLE_PARTNER(battlerId) + 1; + if (IsBattlerAlive(battler) && GetBattlerAbility(battler) == ability) + return battler + 1; + else if (IsBattlerAlive(BATTLE_PARTNER(battler)) && GetBattlerAbility(BATTLE_PARTNER(battler)) == ability) + return BATTLE_PARTNER(battler) + 1; else return 0; } -u32 IsAbilityOnOpposingSide(u32 battlerId, u32 ability) +u32 IsAbilityOnOpposingSide(u32 battler, u32 ability) { - return IsAbilityOnSide(BATTLE_OPPOSITE(battlerId), ability); + return IsAbilityOnSide(BATTLE_OPPOSITE(battler), ability); } u32 IsAbilityOnField(u32 ability) @@ -6224,55 +6223,55 @@ u32 IsAbilityOnField(u32 ability) return 0; } -u32 IsAbilityOnFieldExcept(u32 battlerId, u32 ability) +u32 IsAbilityOnFieldExcept(u32 battler, u32 ability) { u32 i; for (i = 0; i < gBattlersCount; i++) { - if (i != battlerId && IsBattlerAlive(i) && GetBattlerAbility(i) == ability) + if (i != battler && IsBattlerAlive(i) && GetBattlerAbility(i) == ability) return i + 1; } return 0; } -u32 IsAbilityPreventingEscape(u32 battlerId) +u32 IsAbilityPreventingEscape(u32 battler) { u32 id; #if B_GHOSTS_ESCAPE >= GEN_6 - if (IS_BATTLER_OF_TYPE(battlerId, TYPE_GHOST)) + if (IS_BATTLER_OF_TYPE(battler, TYPE_GHOST)) return 0; #endif #if B_SHADOW_TAG_ESCAPE >= GEN_4 - if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG)) && GetBattlerAbility(battlerId) != ABILITY_SHADOW_TAG) + if ((id = IsAbilityOnOpposingSide(battler, ABILITY_SHADOW_TAG)) && GetBattlerAbility(battler) != ABILITY_SHADOW_TAG) #else - if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG))) + if ((id = IsAbilityOnOpposingSide(battler, ABILITY_SHADOW_TAG))) #endif return id; - if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_ARENA_TRAP)) && IsBattlerGrounded(battlerId)) + if ((id = IsAbilityOnOpposingSide(battler, ABILITY_ARENA_TRAP)) && IsBattlerGrounded(battler)) return id; - if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_MAGNET_PULL)) && IS_BATTLER_OF_TYPE(battlerId, TYPE_STEEL)) + if ((id = IsAbilityOnOpposingSide(battler, ABILITY_MAGNET_PULL)) && IS_BATTLER_OF_TYPE(battler, TYPE_STEEL)) return id; return 0; } -bool32 CanBattlerEscape(u32 battlerId) // no ability check +bool32 CanBattlerEscape(u32 battler) // no ability check { - if (GetBattlerHoldEffect(battlerId, TRUE) == HOLD_EFFECT_SHED_SHELL) + if (GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_SHED_SHELL) return TRUE; #if B_GHOSTS_ESCAPE >= GEN_6 - else if (IS_BATTLER_OF_TYPE(battlerId, TYPE_GHOST)) + else if (IS_BATTLER_OF_TYPE(battler, TYPE_GHOST)) return TRUE; #endif - else if (gBattleMons[battlerId].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED)) + else if (gBattleMons[battler].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED)) return FALSE; - else if (gStatuses3[battlerId] & STATUS3_ROOTED) + else if (gStatuses3[battler] & STATUS3_ROOTED) return FALSE; else if (gFieldStatuses & STATUS_FIELD_FAIRY_LOCK) return FALSE; - else if (gStatuses3[battlerId] & STATUS3_SKY_DROPPED) + else if (gStatuses3[battler] & STATUS3_SKY_DROPPED) return FALSE; else return TRUE; @@ -6304,32 +6303,32 @@ enum ITEM_STATS_CHANGE, }; -bool32 IsBattlerTerrainAffected(u8 battlerId, u32 terrainFlag) +bool32 IsBattlerTerrainAffected(u32 battler, u32 terrainFlag) { if (!(gFieldStatuses & terrainFlag)) return FALSE; - else if (gStatuses3[battlerId] & STATUS3_SEMI_INVULNERABLE) + else if (gStatuses3[battler] & STATUS3_SEMI_INVULNERABLE) return FALSE; - return IsBattlerGrounded(battlerId); + return IsBattlerGrounded(battler); } -bool32 CanSleep(u8 battlerId) +bool32 CanSleep(u32 battler) { - u16 ability = GetBattlerAbility(battlerId); + u16 ability = GetBattlerAbility(battler); if (ability == ABILITY_INSOMNIA || ability == ABILITY_VITAL_SPIRIT || ability == ABILITY_COMATOSE - || gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD - || gBattleMons[battlerId].status1 & STATUS1_ANY - || IsAbilityOnSide(battlerId, ABILITY_SWEET_VEIL) - || IsAbilityStatusProtected(battlerId) - || IsBattlerTerrainAffected(battlerId, STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_MISTY_TERRAIN)) + || gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_SAFEGUARD + || gBattleMons[battler].status1 & STATUS1_ANY + || IsAbilityOnSide(battler, ABILITY_SWEET_VEIL) + || IsAbilityStatusProtected(battler) + || IsBattlerTerrainAffected(battler, STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_MISTY_TERRAIN)) return FALSE; return TRUE; } -bool32 CanBePoisoned(u8 battlerAttacker, u8 battlerTarget) +bool32 CanBePoisoned(u32 battlerAttacker, u32 battlerTarget) { u16 ability = GetBattlerAbility(battlerTarget); @@ -6345,96 +6344,96 @@ bool32 CanBePoisoned(u8 battlerAttacker, u8 battlerTarget) return TRUE; } -bool32 CanBeBurned(u8 battlerId) +bool32 CanBeBurned(u32 battler) { - u16 ability = GetBattlerAbility(battlerId); - if (IS_BATTLER_OF_TYPE(battlerId, TYPE_FIRE) - || gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD - || gBattleMons[battlerId].status1 & STATUS1_ANY + u16 ability = GetBattlerAbility(battler); + if (IS_BATTLER_OF_TYPE(battler, TYPE_FIRE) + || gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_SAFEGUARD + || gBattleMons[battler].status1 & STATUS1_ANY || ability == ABILITY_WATER_VEIL || ability == ABILITY_WATER_BUBBLE || ability == ABILITY_COMATOSE || ability == ABILITY_THERMAL_EXCHANGE - || IsAbilityStatusProtected(battlerId) - || IsBattlerTerrainAffected(battlerId, STATUS_FIELD_MISTY_TERRAIN)) + || IsAbilityStatusProtected(battler) + || IsBattlerTerrainAffected(battler, STATUS_FIELD_MISTY_TERRAIN)) return FALSE; return TRUE; } -bool32 CanBeParalyzed(u8 battlerId) +bool32 CanBeParalyzed(u32 battler) { - u16 ability = GetBattlerAbility(battlerId); + u16 ability = GetBattlerAbility(battler); if ( #if B_PARALYZE_ELECTRIC >= GEN_6 - IS_BATTLER_OF_TYPE(battlerId, TYPE_ELECTRIC) || + IS_BATTLER_OF_TYPE(battler, TYPE_ELECTRIC) || #endif - gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD + gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_SAFEGUARD || ability == ABILITY_LIMBER || ability == ABILITY_COMATOSE - || gBattleMons[battlerId].status1 & STATUS1_ANY - || IsAbilityStatusProtected(battlerId) - || IsBattlerTerrainAffected(battlerId, STATUS_FIELD_MISTY_TERRAIN)) + || gBattleMons[battler].status1 & STATUS1_ANY + || IsAbilityStatusProtected(battler) + || IsBattlerTerrainAffected(battler, STATUS_FIELD_MISTY_TERRAIN)) return FALSE; return TRUE; } -bool32 CanBeFrozen(u8 battlerId) +bool32 CanBeFrozen(u32 battler) { - u16 ability = GetBattlerAbility(battlerId); - if (IS_BATTLER_OF_TYPE(battlerId, TYPE_ICE) - || IsBattlerWeatherAffected(battlerId, B_WEATHER_SUN) - || gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD + u16 ability = GetBattlerAbility(battler); + if (IS_BATTLER_OF_TYPE(battler, TYPE_ICE) + || IsBattlerWeatherAffected(battler, B_WEATHER_SUN) + || gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_SAFEGUARD || ability == ABILITY_MAGMA_ARMOR || ability == ABILITY_COMATOSE - || gBattleMons[battlerId].status1 & STATUS1_ANY - || IsAbilityStatusProtected(battlerId) - || IsBattlerTerrainAffected(battlerId, STATUS_FIELD_MISTY_TERRAIN)) + || gBattleMons[battler].status1 & STATUS1_ANY + || IsAbilityStatusProtected(battler) + || IsBattlerTerrainAffected(battler, STATUS_FIELD_MISTY_TERRAIN)) return FALSE; return TRUE; } -bool32 CanGetFrostbite(u8 battlerId) +bool32 CanGetFrostbite(u32 battler) { - u16 ability = GetBattlerAbility(battlerId); - if (IS_BATTLER_OF_TYPE(battlerId, TYPE_ICE) - || gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD + u16 ability = GetBattlerAbility(battler); + if (IS_BATTLER_OF_TYPE(battler, TYPE_ICE) + || gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_SAFEGUARD || ability == ABILITY_MAGMA_ARMOR || ability == ABILITY_COMATOSE - || gBattleMons[battlerId].status1 & STATUS1_ANY - || IsAbilityStatusProtected(battlerId) - || IsBattlerTerrainAffected(battlerId, STATUS_FIELD_MISTY_TERRAIN)) + || gBattleMons[battler].status1 & STATUS1_ANY + || IsAbilityStatusProtected(battler) + || IsBattlerTerrainAffected(battler, STATUS_FIELD_MISTY_TERRAIN)) return FALSE; return TRUE; } -bool32 CanBeConfused(u8 battlerId) +bool32 CanBeConfused(u32 battler) { - if (GetBattlerAbility(battlerId) == ABILITY_OWN_TEMPO - || gBattleMons[battlerId].status2 & STATUS2_CONFUSION - || IsBattlerTerrainAffected(battlerId, STATUS_FIELD_MISTY_TERRAIN)) + if (GetBattlerAbility(battler) == ABILITY_OWN_TEMPO + || gBattleMons[battler].status2 & STATUS2_CONFUSION + || IsBattlerTerrainAffected(battler, STATUS_FIELD_MISTY_TERRAIN)) return FALSE; return TRUE; } // second argument is 1/X of current hp compared to max hp -bool32 HasEnoughHpToEatBerry(u32 battlerId, u32 hpFraction, u32 itemId) +bool32 HasEnoughHpToEatBerry(u32 battler, u32 hpFraction, u32 itemId) { bool32 isBerry = (ItemId_GetPocket(itemId) == POCKET_BERRIES); - if (gBattleMons[battlerId].hp == 0) + if (gBattleMons[battler].hp == 0) return FALSE; if (gBattleScripting.overrideBerryRequirements) return TRUE; // Unnerve prevents consumption of opponents' berries. - if (isBerry && IsUnnerveAbilityOnOpposingSide(battlerId)) + if (isBerry && IsUnnerveAbilityOnOpposingSide(battler)) return FALSE; - if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / hpFraction) + if (gBattleMons[battler].hp <= gBattleMons[battler].maxHP / hpFraction) return TRUE; - if (hpFraction <= 4 && GetBattlerAbility(battlerId) == ABILITY_GLUTTONY && isBerry - && gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / 2) + if (hpFraction <= 4 && GetBattlerAbility(battler) == ABILITY_GLUTTONY && isBerry + && gBattleMons[battler].hp <= gBattleMons[battler].maxHP / 2) { - RecordAbilityBattle(battlerId, ABILITY_GLUTTONY); + RecordAbilityBattle(battler, ABILITY_GLUTTONY); return TRUE; } @@ -6447,30 +6446,30 @@ bool32 HasEnoughHpToEatBerry(u32 battlerId, u32 hpFraction, u32 itemId) #define CONFUSE_BERRY_HP_FRACTION 2 #endif -static u8 HealConfuseBerry(u32 battlerId, u32 itemId, u8 flavorId, bool32 end2) +static u8 HealConfuseBerry(u32 battler, u32 itemId, u32 flavorId, bool32 end2) { - if (HasEnoughHpToEatBerry(battlerId, CONFUSE_BERRY_HP_FRACTION, itemId) + if (HasEnoughHpToEatBerry(battler, CONFUSE_BERRY_HP_FRACTION, itemId) #if B_HEAL_BLOCKING >= GEN_5 - && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) + && !(gStatuses3[battler] & STATUS3_HEAL_BLOCK) #endif ) { PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, flavorId); - gBattleMoveDamage = gBattleMons[battlerId].maxHP / GetBattlerItemHoldEffectParam(battlerId, itemId); + gBattleMoveDamage = gBattleMons[battler].maxHP / GetBattlerItemHoldEffectParam(battler, itemId); if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; gBattleMoveDamage *= -1; - if (GetBattlerAbility(battlerId) == ABILITY_RIPEN) + if (GetBattlerAbility(battler) == ABILITY_RIPEN) { gBattleMoveDamage *= 2; - gBattlerAbility = battlerId; + gBattlerAbility = battler; } - gBattleScripting.battler = battlerId; + gBattleScripting.battler = battler; if (end2) { - if (GetFlavorRelationByPersonality(gBattleMons[battlerId].personality, flavorId) < 0) + if (GetFlavorRelationByPersonality(gBattleMons[battler].personality, flavorId) < 0) BattleScriptExecute(BattleScript_BerryConfuseHealEnd2); else BattleScriptExecute(BattleScript_ItemHealHP_RemoveItemEnd2); @@ -6478,7 +6477,7 @@ static u8 HealConfuseBerry(u32 battlerId, u32 itemId, u8 flavorId, bool32 end2) else { BattleScriptPushCursor(); - if (GetFlavorRelationByPersonality(gBattleMons[battlerId].personality, flavorId) < 0) + if (GetFlavorRelationByPersonality(gBattleMons[battler].personality, flavorId) < 0) gBattlescriptCurrInstr = BattleScript_BerryConfuseHealRet; else gBattlescriptCurrInstr = BattleScript_ItemHealHP_RemoveItemRet; @@ -6491,13 +6490,13 @@ static u8 HealConfuseBerry(u32 battlerId, u32 itemId, u8 flavorId, bool32 end2) #undef CONFUSE_BERRY_HP_FRACTION -static u8 StatRaiseBerry(u32 battlerId, u32 itemId, u32 statId, bool32 end2) +static u8 StatRaiseBerry(u32 battler, u32 itemId, u32 statId, bool32 end2) { - if (CompareStat(battlerId, statId, MAX_STAT_STAGE, CMP_LESS_THAN) && HasEnoughHpToEatBerry(battlerId, GetBattlerItemHoldEffectParam(battlerId, itemId), itemId)) + if (CompareStat(battler, statId, MAX_STAT_STAGE, CMP_LESS_THAN) && HasEnoughHpToEatBerry(battler, GetBattlerItemHoldEffectParam(battler, itemId), itemId)) { - BufferStatChange(battlerId, statId, STRINGID_STATROSE); - gEffectBattler = battlerId; - if (GetBattlerAbility(battlerId) == ABILITY_RIPEN) + BufferStatChange(battler, statId, STRINGID_STATROSE); + gEffectBattler = battler; + if (GetBattlerAbility(battler) == ABILITY_RIPEN) SET_STATCHANGER(statId, 2, FALSE); else SET_STATCHANGER(statId, 1, FALSE); @@ -6519,23 +6518,23 @@ static u8 StatRaiseBerry(u32 battlerId, u32 itemId, u32 statId, bool32 end2) return 0; } -static u8 RandomStatRaiseBerry(u32 battlerId, u32 itemId, bool32 end2) +static u8 RandomStatRaiseBerry(u32 battler, u32 itemId, bool32 end2) { s32 i; u16 stringId; for (i = 0; i < NUM_STATS - 1; i++) { - if (CompareStat(battlerId, STAT_ATK + i, MAX_STAT_STAGE, CMP_LESS_THAN)) + if (CompareStat(battler, STAT_ATK + i, MAX_STAT_STAGE, CMP_LESS_THAN)) break; } - if (i != NUM_STATS - 1 && HasEnoughHpToEatBerry(battlerId, GetBattlerItemHoldEffectParam(battlerId, itemId), itemId)) + if (i != NUM_STATS - 1 && HasEnoughHpToEatBerry(battler, GetBattlerItemHoldEffectParam(battler, itemId), itemId)) { - u16 battlerAbility = GetBattlerAbility(battlerId); + u16 battlerAbility = GetBattlerAbility(battler); do { i = Random() % (NUM_STATS - 1); - } while (!CompareStat(battlerId, STAT_ATK + i, MAX_STAT_STAGE, CMP_LESS_THAN)); + } while (!CompareStat(battler, STAT_ATK + i, MAX_STAT_STAGE, CMP_LESS_THAN)); PREPARE_STAT_BUFFER(gBattleTextBuff1, i + 1); stringId = (battlerAbility == ABILITY_CONTRARY) ? STRINGID_STATFELL : STRINGID_STATROSE; @@ -6547,7 +6546,7 @@ static u8 RandomStatRaiseBerry(u32 battlerId, u32 itemId, bool32 end2) gBattleTextBuff2[5] = stringId; gBattleTextBuff2[6] = stringId >> 8; gBattleTextBuff2[7] = EOS; - gEffectBattler = battlerId; + gEffectBattler = battler; if (battlerAbility == ABILITY_RIPEN) SET_STATCHANGER(i + 1, 4, FALSE); else @@ -6570,11 +6569,11 @@ static u8 RandomStatRaiseBerry(u32 battlerId, u32 itemId, bool32 end2) return 0; } -static u8 TrySetMicleBerry(u32 battlerId, u32 itemId, bool32 end2) +static u8 TrySetMicleBerry(u32 battler, u32 itemId, bool32 end2) { - if (HasEnoughHpToEatBerry(battlerId, 4, itemId)) + if (HasEnoughHpToEatBerry(battler, 4, itemId)) { - gProtectStructs[battlerId].usedMicleBerry = TRUE; // battler's next attack has increased accuracy + gProtectStructs[battler].usedMicleBerry = TRUE; // battler's next attack has increased accuracy if (end2) { @@ -6590,20 +6589,42 @@ static u8 TrySetMicleBerry(u32 battlerId, u32 itemId, bool32 end2) return 0; } -static u8 DamagedStatBoostBerryEffect(u8 battlerId, u8 statId, u8 split) +static u8 TrySetEnigmaBerry(u32 battler) +{ + if (IsBattlerAlive(battler) + && !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove) + && ((TARGET_TURN_DAMAGED && gMoveResultFlags & MOVE_RESULT_SUPER_EFFECTIVE) || gBattleScripting.overrideBerryRequirements) + && !(gBattleScripting.overrideBerryRequirements && gBattleMons[battler].hp == gBattleMons[battler].maxHP) +#if B_HEAL_BLOCKING >= GEN_5 + && !(gStatuses3[battler] & STATUS3_HEAL_BLOCK)) +#endif + { + gBattleScripting.battler = battler; + gBattleMoveDamage = (gBattleMons[battler].maxHP * 25 / 100) * -1; + if (GetBattlerAbility(battler) == ABILITY_RIPEN) + gBattleMoveDamage *= 2; + + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_ItemHealHP_RemoveItemRet; + return ITEM_HP_CHANGE; + } + return 0; +} + +static u8 DamagedStatBoostBerryEffect(u32 battler, u8 statId, u8 split) { - if (IsBattlerAlive(battlerId) - && CompareStat(battlerId, statId, MAX_STAT_STAGE, CMP_LESS_THAN) + if (IsBattlerAlive(battler) + && CompareStat(battler, statId, MAX_STAT_STAGE, CMP_LESS_THAN) && (gBattleScripting.overrideBerryRequirements - || (!DoesSubstituteBlockMove(gBattlerAttacker, battlerId, gCurrentMove) + || (!DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove) && GetBattleMoveSplit(gCurrentMove) == split && TARGET_TURN_DAMAGED)) ) { - BufferStatChange(battlerId, statId, STRINGID_STATROSE); + BufferStatChange(battler, statId, STRINGID_STATROSE); - gEffectBattler = battlerId; - if (GetBattlerAbility(battlerId) == ABILITY_RIPEN) + gEffectBattler = battler; + if (GetBattlerAbility(battler) == ABILITY_RIPEN) SET_STATCHANGER(statId, 2, FALSE); else SET_STATCHANGER(statId, 1, FALSE); @@ -6617,7 +6638,7 @@ static u8 DamagedStatBoostBerryEffect(u8 battlerId, u8 statId, u8 split) return 0; } -u8 TryHandleSeed(u8 battler, u32 terrainFlag, u8 statId, u16 itemId, bool32 execute) +u8 TryHandleSeed(u32 battler, u32 terrainFlag, u8 statId, u16 itemId, bool32 execute) { if (gFieldStatuses & terrainFlag && CompareStat(battler, statId, MAX_STAT_STAGE, CMP_LESS_THAN)) { @@ -6678,9 +6699,8 @@ static u32 ItemRestorePp(u32 battler, u32 itemId, bool32 execute) BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_BerryPPHealRet; } - gActiveBattler = battler; - BtlController_EmitSetMonData(BUFFER_A, i + REQUEST_PPMOVE1_BATTLE, 0, 1, &changedPP); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(battler, BUFFER_A, i + REQUEST_PPMOVE1_BATTLE, 0, 1, &changedPP); + MarkBattlerForControllerExec(battler); if (MOVE_IS_PERMANENT(battler, i)) gBattleMons[battler].pp[i] = changedPP; return ITEM_PP_CHANGE; @@ -6689,24 +6709,24 @@ static u32 ItemRestorePp(u32 battler, u32 itemId, bool32 execute) return 0; } -static u8 ItemHealHp(u32 battlerId, u32 itemId, bool32 end2, bool32 percentHeal) +static u8 ItemHealHp(u32 battler, u32 itemId, bool32 end2, bool32 percentHeal) { - if (!(gBattleScripting.overrideBerryRequirements && gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP) + if (!(gBattleScripting.overrideBerryRequirements && gBattleMons[battler].hp == gBattleMons[battler].maxHP) #if B_HEAL_BLOCKING >= GEN_5 - && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) + && !(gStatuses3[battler] & STATUS3_HEAL_BLOCK) #endif - && HasEnoughHpToEatBerry(battlerId, 2, itemId)) + && HasEnoughHpToEatBerry(battler, 2, itemId)) { if (percentHeal) - gBattleMoveDamage = (gBattleMons[battlerId].maxHP * GetBattlerItemHoldEffectParam(battlerId, itemId) / 100) * -1; + gBattleMoveDamage = (gBattleMons[battler].maxHP * GetBattlerItemHoldEffectParam(battler, itemId) / 100) * -1; else - gBattleMoveDamage = GetBattlerItemHoldEffectParam(battlerId, itemId) * -1; + gBattleMoveDamage = GetBattlerItemHoldEffectParam(battler, itemId) * -1; // check ripen - if (ItemId_GetPocket(itemId) == POCKET_BERRIES && GetBattlerAbility(battlerId) == ABILITY_RIPEN) + if (ItemId_GetPocket(itemId) == POCKET_BERRIES && GetBattlerAbility(battler) == ABILITY_RIPEN) gBattleMoveDamage *= 2; - gBattlerAbility = battlerId; // in SWSH, berry juice shows ability pop up but has no effect. This is mimicked here + gBattlerAbility = battler; // in SWSH, berry juice shows ability pop up but has no effect. This is mimicked here if (end2) { BattleScriptExecute(BattleScript_ItemHealHP_RemoveItemEnd2); @@ -6721,61 +6741,61 @@ static u8 ItemHealHp(u32 battlerId, u32 itemId, bool32 end2, bool32 percentHeal) return 0; } -static bool32 UnnerveOn(u32 battlerId, u32 itemId) +static bool32 UnnerveOn(u32 battler, u32 itemId) { - if (ItemId_GetPocket(itemId) == POCKET_BERRIES && IsUnnerveAbilityOnOpposingSide(battlerId)) + if (ItemId_GetPocket(itemId) == POCKET_BERRIES && IsUnnerveAbilityOnOpposingSide(battler)) return TRUE; return FALSE; } -static bool32 GetMentalHerbEffect(u8 battlerId) +static bool32 GetMentalHerbEffect(u32 battler) { bool32 ret = FALSE; // Check infatuation - if (gBattleMons[battlerId].status2 & STATUS2_INFATUATION) + if (gBattleMons[battler].status2 & STATUS2_INFATUATION) { - gBattleMons[battlerId].status2 &= ~STATUS2_INFATUATION; + gBattleMons[battler].status2 &= ~STATUS2_INFATUATION; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_INFATUATION; // STRINGID_TARGETGOTOVERINFATUATION StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn); ret = TRUE; } #if B_MENTAL_HERB >= GEN_5 // Check taunt - if (gDisableStructs[battlerId].tauntTimer != 0) + if (gDisableStructs[battler].tauntTimer != 0) { - gDisableStructs[battlerId].tauntTimer = 0; + gDisableStructs[battler].tauntTimer = 0; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TAUNT; PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT); ret = TRUE; } // Check encore - if (gDisableStructs[battlerId].encoreTimer != 0) + if (gDisableStructs[battler].encoreTimer != 0) { - gDisableStructs[battlerId].encoredMove = 0; - gDisableStructs[battlerId].encoreTimer = 0; + gDisableStructs[battler].encoredMove = 0; + gDisableStructs[battler].encoreTimer = 0; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_ENCORE; // STRINGID_PKMNENCOREENDED ret = TRUE; } // Check torment - if (gBattleMons[battlerId].status2 & STATUS2_TORMENT) + if (gBattleMons[battler].status2 & STATUS2_TORMENT) { - gBattleMons[battlerId].status2 &= ~STATUS2_TORMENT; + gBattleMons[battler].status2 &= ~STATUS2_TORMENT; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TORMENT; ret = TRUE; } // Check heal block - if (gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) + if (gStatuses3[battler] & STATUS3_HEAL_BLOCK) { - gStatuses3[battlerId] &= ~STATUS3_HEAL_BLOCK; + gStatuses3[battler] &= ~STATUS3_HEAL_BLOCK; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_HEALBLOCK; ret = TRUE; } // Check disable - if (gDisableStructs[battlerId].disableTimer != 0) + if (gDisableStructs[battler].disableTimer != 0) { - gDisableStructs[battlerId].disableTimer = 0; - gDisableStructs[battlerId].disabledMove = 0; + gDisableStructs[battler].disableTimer = 0; + gDisableStructs[battler].disabledMove = 0; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_DISABLE; ret = TRUE; } @@ -6783,15 +6803,15 @@ static bool32 GetMentalHerbEffect(u8 battlerId) return ret; } -static u8 TryConsumeMirrorHerb(u8 battlerId, bool32 execute) +static u8 TryConsumeMirrorHerb(u32 battler, bool32 execute) { u8 effect = 0; - if (gProtectStructs[battlerId].eatMirrorHerb) { - gLastUsedItem = gBattleMons[battlerId].item; + if (gProtectStructs[battler].eatMirrorHerb) { + gLastUsedItem = gBattleMons[battler].item; gBattleScripting.savedBattler = gBattlerAttacker; - gBattleScripting.battler = gBattlerAttacker = battlerId; - gProtectStructs[battlerId].eatMirrorHerb = 0; + gBattleScripting.battler = gBattlerAttacker = battler; + gProtectStructs[battler].eatMirrorHerb = 0; if (execute) { BattleScriptExecute(BattleScript_MirrorHerbCopyStatChangeEnd2); } else { @@ -6803,7 +6823,7 @@ static u8 TryConsumeMirrorHerb(u8 battlerId, bool32 execute) return effect; } -static u8 ItemEffectMoveEnd(u32 battlerId, u16 holdEffect) +static u8 ItemEffectMoveEnd(u32 battler, u16 holdEffect) { u8 effect = 0; u32 i; @@ -6812,157 +6832,160 @@ static u8 ItemEffectMoveEnd(u32 battlerId, u16 holdEffect) { #if B_HP_BERRIES >= GEN_4 case HOLD_EFFECT_MICLE_BERRY: - effect = TrySetMicleBerry(battlerId, gLastUsedItem, FALSE); + effect = TrySetMicleBerry(battler, gLastUsedItem, FALSE); break; case HOLD_EFFECT_RESTORE_HP: - effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, FALSE); + effect = ItemHealHp(battler, gLastUsedItem, FALSE, FALSE); break; #endif #if B_BERRIES_INSTANT >= GEN_4 case HOLD_EFFECT_RESTORE_PCT_HP: - effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, TRUE); + effect = ItemHealHp(battler, gLastUsedItem, FALSE, TRUE); break; case HOLD_EFFECT_RESTORE_PP: - effect = ItemRestorePp(battlerId, gLastUsedItem, FALSE); + effect = ItemRestorePp(battler, gLastUsedItem, FALSE); break; case HOLD_EFFECT_CONFUSE_SPICY: - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SPICY, FALSE); + effect = HealConfuseBerry(battler, gLastUsedItem, FLAVOR_SPICY, FALSE); break; case HOLD_EFFECT_CONFUSE_DRY: - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_DRY, FALSE); + effect = HealConfuseBerry(battler, gLastUsedItem, FLAVOR_DRY, FALSE); break; case HOLD_EFFECT_CONFUSE_SWEET: - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SWEET, FALSE); + effect = HealConfuseBerry(battler, gLastUsedItem, FLAVOR_SWEET, FALSE); break; case HOLD_EFFECT_CONFUSE_BITTER: - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_BITTER, FALSE); + effect = HealConfuseBerry(battler, gLastUsedItem, FLAVOR_BITTER, FALSE); break; case HOLD_EFFECT_CONFUSE_SOUR: - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SOUR, FALSE); + effect = HealConfuseBerry(battler, gLastUsedItem, FLAVOR_SOUR, FALSE); break; case HOLD_EFFECT_ATTACK_UP: - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_ATK, FALSE); + effect = StatRaiseBerry(battler, gLastUsedItem, STAT_ATK, FALSE); break; case HOLD_EFFECT_DEFENSE_UP: - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_DEF, FALSE); + effect = StatRaiseBerry(battler, gLastUsedItem, STAT_DEF, FALSE); break; case HOLD_EFFECT_SPEED_UP: - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPEED, FALSE); + effect = StatRaiseBerry(battler, gLastUsedItem, STAT_SPEED, FALSE); break; case HOLD_EFFECT_SP_ATTACK_UP: - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPATK, FALSE); + effect = StatRaiseBerry(battler, gLastUsedItem, STAT_SPATK, FALSE); break; case HOLD_EFFECT_SP_DEFENSE_UP: - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPDEF, FALSE); + effect = StatRaiseBerry(battler, gLastUsedItem, STAT_SPDEF, FALSE); + break; + case HOLD_EFFECT_ENIGMA_BERRY: // consume and heal if hit by super effective move + effect = TrySetEnigmaBerry(battler); break; case HOLD_EFFECT_KEE_BERRY: // consume and boost defense if used physical move - effect = DamagedStatBoostBerryEffect(battlerId, STAT_DEF, SPLIT_PHYSICAL); + effect = DamagedStatBoostBerryEffect(battler, STAT_DEF, SPLIT_PHYSICAL); break; case HOLD_EFFECT_MARANGA_BERRY: // consume and boost sp. defense if used special move - effect = DamagedStatBoostBerryEffect(battlerId, STAT_SPDEF, SPLIT_SPECIAL); + effect = DamagedStatBoostBerryEffect(battler, STAT_SPDEF, SPLIT_SPECIAL); break; case HOLD_EFFECT_RANDOM_STAT_UP: - effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, FALSE); + effect = RandomStatRaiseBerry(battler, gLastUsedItem, FALSE); break; #endif case HOLD_EFFECT_CURE_PAR: - if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battler].status1 & STATUS1_PARALYSIS && !UnnerveOn(battler, gLastUsedItem)) { - gBattleMons[battlerId].status1 &= ~STATUS1_PARALYSIS; + gBattleMons[battler].status1 &= ~STATUS1_PARALYSIS; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_BerryCureParRet; effect = ITEM_STATUS_CHANGE; } break; case HOLD_EFFECT_CURE_PSN: - if (gBattleMons[battlerId].status1 & STATUS1_PSN_ANY && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battler].status1 & STATUS1_PSN_ANY && !UnnerveOn(battler, gLastUsedItem)) { - gBattleMons[battlerId].status1 &= ~(STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER); + gBattleMons[battler].status1 &= ~(STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_BerryCurePsnRet; effect = ITEM_STATUS_CHANGE; } break; case HOLD_EFFECT_CURE_BRN: - if (gBattleMons[battlerId].status1 & STATUS1_BURN && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battler].status1 & STATUS1_BURN && !UnnerveOn(battler, gLastUsedItem)) { - gBattleMons[battlerId].status1 &= ~STATUS1_BURN; + gBattleMons[battler].status1 &= ~STATUS1_BURN; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_BerryCureBrnRet; effect = ITEM_STATUS_CHANGE; } break; case HOLD_EFFECT_CURE_FRZ: - if (gBattleMons[battlerId].status1 & STATUS1_FREEZE && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battler].status1 & STATUS1_FREEZE && !UnnerveOn(battler, gLastUsedItem)) { - gBattleMons[battlerId].status1 &= ~STATUS1_FREEZE; + gBattleMons[battler].status1 &= ~STATUS1_FREEZE; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_BerryCureFrzRet; effect = ITEM_STATUS_CHANGE; } - if (gBattleMons[battlerId].status1 & STATUS1_FROSTBITE && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battler].status1 & STATUS1_FROSTBITE && !UnnerveOn(battler, gLastUsedItem)) { - gBattleMons[battlerId].status1 &= ~STATUS1_FROSTBITE; + gBattleMons[battler].status1 &= ~STATUS1_FROSTBITE; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_BerryCureFsbRet; effect = ITEM_STATUS_CHANGE; } break; case HOLD_EFFECT_CURE_SLP: - if (gBattleMons[battlerId].status1 & STATUS1_SLEEP && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battler].status1 & STATUS1_SLEEP && !UnnerveOn(battler, gLastUsedItem)) { - gBattleMons[battlerId].status1 &= ~STATUS1_SLEEP; - gBattleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE; + gBattleMons[battler].status1 &= ~STATUS1_SLEEP; + gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_BerryCureSlpRet; effect = ITEM_STATUS_CHANGE; } break; case HOLD_EFFECT_CURE_CONFUSION: - if (gBattleMons[battlerId].status2 & STATUS2_CONFUSION && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battler].status2 & STATUS2_CONFUSION && !UnnerveOn(battler, gLastUsedItem)) { - RemoveConfusionStatus(battlerId); + RemoveConfusionStatus(battler); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_BerryCureConfusionRet; effect = ITEM_EFFECT_OTHER; } break; case HOLD_EFFECT_MENTAL_HERB: - if (GetMentalHerbEffect(battlerId)) + if (GetMentalHerbEffect(battler)) { gBattleScripting.savedBattler = gBattlerAttacker; - gBattlerAttacker = battlerId; + gBattlerAttacker = battler; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_MentalHerbCureRet; effect = ITEM_EFFECT_OTHER; } break; case HOLD_EFFECT_CURE_STATUS: - if ((gBattleMons[battlerId].status1 & STATUS1_ANY || gBattleMons[battlerId].status2 & STATUS2_CONFUSION) && !UnnerveOn(battlerId, gLastUsedItem)) + if ((gBattleMons[battler].status1 & STATUS1_ANY || gBattleMons[battler].status2 & STATUS2_CONFUSION) && !UnnerveOn(battler, gLastUsedItem)) { - if (gBattleMons[battlerId].status1 & STATUS1_PSN_ANY) + if (gBattleMons[battler].status1 & STATUS1_PSN_ANY) StringCopy(gBattleTextBuff1, gStatusConditionString_PoisonJpn); - if (gBattleMons[battlerId].status1 & STATUS1_SLEEP) + if (gBattleMons[battler].status1 & STATUS1_SLEEP) { - gBattleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE; + gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE; StringCopy(gBattleTextBuff1, gStatusConditionString_SleepJpn); } - if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS) + if (gBattleMons[battler].status1 & STATUS1_PARALYSIS) StringCopy(gBattleTextBuff1, gStatusConditionString_ParalysisJpn); - if (gBattleMons[battlerId].status1 & STATUS1_BURN) + if (gBattleMons[battler].status1 & STATUS1_BURN) StringCopy(gBattleTextBuff1, gStatusConditionString_BurnJpn); - if (gBattleMons[battlerId].status1 & STATUS1_FREEZE || gBattleMons[battlerId].status1 & STATUS1_FROSTBITE) + if (gBattleMons[battler].status1 & STATUS1_FREEZE || gBattleMons[battler].status1 & STATUS1_FROSTBITE) StringCopy(gBattleTextBuff1, gStatusConditionString_IceJpn); - if (gBattleMons[battlerId].status2 & STATUS2_CONFUSION) + if (gBattleMons[battler].status2 & STATUS2_CONFUSION) StringCopy(gBattleTextBuff1, gStatusConditionString_ConfusionJpn); - gBattleMons[battlerId].status1 = 0; - RemoveConfusionStatus(battlerId); + gBattleMons[battler].status1 = 0; + RemoveConfusionStatus(battler); BattleScriptPushCursor(); gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CURED_PROBLEM; gBattlescriptCurrInstr = BattleScript_BerryCureChosenStatusRet; @@ -6972,16 +6995,16 @@ static u8 ItemEffectMoveEnd(u32 battlerId, u16 holdEffect) case HOLD_EFFECT_RESTORE_STATS: for (i = 0; i < NUM_BATTLE_STATS; i++) { - if (gBattleMons[battlerId].statStages[i] < DEFAULT_STAT_STAGE) + if (gBattleMons[battler].statStages[i] < DEFAULT_STAT_STAGE) { - gBattleMons[battlerId].statStages[i] = DEFAULT_STAT_STAGE; + gBattleMons[battler].statStages[i] = DEFAULT_STAT_STAGE; effect = ITEM_STATS_CHANGE; } } if (effect != 0) { - gBattleScripting.battler = battlerId; - gPotentialItemEffectBattler = battlerId; + gBattleScripting.battler = battler; + gPotentialItemEffectBattler = battler; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_WhiteHerbRet; return effect; @@ -6989,20 +7012,20 @@ static u8 ItemEffectMoveEnd(u32 battlerId, u16 holdEffect) break; case HOLD_EFFECT_CRITICAL_UP: // lansat berry if (B_BERRIES_INSTANT >= GEN_4 - && !(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY) - && HasEnoughHpToEatBerry(battlerId, GetBattlerItemHoldEffectParam(battlerId, gLastUsedItem), gLastUsedItem)) + && !(gBattleMons[battler].status2 & STATUS2_FOCUS_ENERGY) + && HasEnoughHpToEatBerry(battler, GetBattlerItemHoldEffectParam(battler, gLastUsedItem), gLastUsedItem)) { - gBattleMons[battlerId].status2 |= STATUS2_FOCUS_ENERGY; - gBattleScripting.battler = battlerId; - gPotentialItemEffectBattler = battlerId; + gBattleMons[battler].status2 |= STATUS2_FOCUS_ENERGY; + gBattleScripting.battler = battler; + gPotentialItemEffectBattler = battler; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_BerryFocusEnergyRet; effect = ITEM_EFFECT_OTHER; } break; case HOLD_EFFECT_BERSERK_GENE: - BufferStatChange(battlerId, STAT_ATK, STRINGID_STATROSE); - gEffectBattler = battlerId; + BufferStatChange(battler, STAT_ATK, STRINGID_STATROSE); + gEffectBattler = battler; if (CanBeInfinitelyConfused(gEffectBattler)) { gStatuses4[gEffectBattler] |= STATUS4_INFINITE_CONFUSION; @@ -7016,25 +7039,25 @@ static u8 ItemEffectMoveEnd(u32 battlerId, u16 holdEffect) effect = ITEM_STATS_CHANGE; break; case HOLD_EFFECT_MIRROR_HERB: - effect = TryConsumeMirrorHerb(battlerId, FALSE); + effect = TryConsumeMirrorHerb(battler, FALSE); break; } return effect; } -u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) +u8 ItemBattleEffects(u8 caseID, u32 battler, bool32 moveTurn) { int i = 0, moveType; u8 effect = ITEM_NO_EFFECT; u8 changedPP = 0; - u8 battlerHoldEffect, atkHoldEffect; + u32 battlerHoldEffect, atkHoldEffect; u8 atkHoldEffectParam; u16 atkItem; if (caseID != ITEMEFFECT_USE_LAST_ITEM) { - gLastUsedItem = gBattleMons[battlerId].item; - battlerHoldEffect = GetBattlerHoldEffect(battlerId, TRUE); + gLastUsedItem = gBattleMons[battler].item; + battlerHoldEffect = GetBattlerHoldEffect(battler, TRUE); } atkItem = gBattleMons[gBattlerAttacker].item; @@ -7044,12 +7067,12 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) switch (caseID) { case ITEMEFFECT_ON_SWITCH_IN: - if (!gSpecialStatuses[battlerId].switchInItemDone) + if (!gSpecialStatuses[battler].switchInItemDone) { switch (battlerHoldEffect) { case HOLD_EFFECT_DOUBLE_PRIZE: - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER && !gBattleStruct->moneyMultiplierItem) + if (GetBattlerSide(battler) == B_SIDE_PLAYER && !gBattleStruct->moneyMultiplierItem) { gBattleStruct->moneyMultiplier *= 2; gBattleStruct->moneyMultiplierItem = 1; @@ -7058,141 +7081,141 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) case HOLD_EFFECT_RESTORE_STATS: for (i = 0; i < NUM_BATTLE_STATS; i++) { - if (gBattleMons[battlerId].statStages[i] < DEFAULT_STAT_STAGE) + if (gBattleMons[battler].statStages[i] < DEFAULT_STAT_STAGE) { - gBattleMons[battlerId].statStages[i] = DEFAULT_STAT_STAGE; + gBattleMons[battler].statStages[i] = DEFAULT_STAT_STAGE; effect = ITEM_STATS_CHANGE; } } if (effect != 0) { - gBattleScripting.battler = battlerId; - gPotentialItemEffectBattler = battlerId; - gActiveBattler = gBattlerAttacker = battlerId; + gBattleScripting.battler = battler; + gPotentialItemEffectBattler = battler; + gBattlerAttacker = battler; BattleScriptExecute(BattleScript_WhiteHerbEnd2); } break; #if B_BERRIES_INSTANT >= GEN_4 case HOLD_EFFECT_CONFUSE_SPICY: - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SPICY, TRUE); + effect = HealConfuseBerry(battler, gLastUsedItem, FLAVOR_SPICY, TRUE); break; case HOLD_EFFECT_CONFUSE_DRY: - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_DRY, TRUE); + effect = HealConfuseBerry(battler, gLastUsedItem, FLAVOR_DRY, TRUE); break; case HOLD_EFFECT_CONFUSE_SWEET: - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SWEET, TRUE); + effect = HealConfuseBerry(battler, gLastUsedItem, FLAVOR_SWEET, TRUE); break; case HOLD_EFFECT_CONFUSE_BITTER: - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_BITTER, TRUE); + effect = HealConfuseBerry(battler, gLastUsedItem, FLAVOR_BITTER, TRUE); break; case HOLD_EFFECT_CONFUSE_SOUR: - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SOUR, TRUE); + effect = HealConfuseBerry(battler, gLastUsedItem, FLAVOR_SOUR, TRUE); break; case HOLD_EFFECT_ATTACK_UP: - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_ATK, TRUE); + effect = StatRaiseBerry(battler, gLastUsedItem, STAT_ATK, TRUE); break; case HOLD_EFFECT_DEFENSE_UP: - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_DEF, TRUE); + effect = StatRaiseBerry(battler, gLastUsedItem, STAT_DEF, TRUE); break; case HOLD_EFFECT_SPEED_UP: - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPEED, TRUE); + effect = StatRaiseBerry(battler, gLastUsedItem, STAT_SPEED, TRUE); break; case HOLD_EFFECT_SP_ATTACK_UP: - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPATK, TRUE); + effect = StatRaiseBerry(battler, gLastUsedItem, STAT_SPATK, TRUE); break; case HOLD_EFFECT_SP_DEFENSE_UP: - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPDEF, TRUE); + effect = StatRaiseBerry(battler, gLastUsedItem, STAT_SPDEF, TRUE); break; case HOLD_EFFECT_CRITICAL_UP: - if (!(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY) && HasEnoughHpToEatBerry(battlerId, GetBattlerItemHoldEffectParam(battlerId, gLastUsedItem), gLastUsedItem)) + if (!(gBattleMons[battler].status2 & STATUS2_FOCUS_ENERGY) && HasEnoughHpToEatBerry(battler, GetBattlerItemHoldEffectParam(battler, gLastUsedItem), gLastUsedItem)) { - gBattleMons[battlerId].status2 |= STATUS2_FOCUS_ENERGY; - gBattleScripting.battler = battlerId; + gBattleMons[battler].status2 |= STATUS2_FOCUS_ENERGY; + gBattleScripting.battler = battler; BattleScriptExecute(BattleScript_BerryFocusEnergyEnd2); effect = ITEM_EFFECT_OTHER; } break; case HOLD_EFFECT_RANDOM_STAT_UP: - effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, TRUE); + effect = RandomStatRaiseBerry(battler, gLastUsedItem, TRUE); break; case HOLD_EFFECT_CURE_PAR: - if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battler].status1 & STATUS1_PARALYSIS && !UnnerveOn(battler, gLastUsedItem)) { - gBattleMons[battlerId].status1 &= ~STATUS1_PARALYSIS; + gBattleMons[battler].status1 &= ~STATUS1_PARALYSIS; BattleScriptExecute(BattleScript_BerryCurePrlzEnd2); effect = ITEM_STATUS_CHANGE; } break; case HOLD_EFFECT_CURE_PSN: - if (gBattleMons[battlerId].status1 & STATUS1_PSN_ANY && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battler].status1 & STATUS1_PSN_ANY && !UnnerveOn(battler, gLastUsedItem)) { - gBattleMons[battlerId].status1 &= ~(STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER); + gBattleMons[battler].status1 &= ~(STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER); BattleScriptExecute(BattleScript_BerryCurePsnEnd2); effect = ITEM_STATUS_CHANGE; } break; case HOLD_EFFECT_CURE_BRN: - if (gBattleMons[battlerId].status1 & STATUS1_BURN && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battler].status1 & STATUS1_BURN && !UnnerveOn(battler, gLastUsedItem)) { - gBattleMons[battlerId].status1 &= ~STATUS1_BURN; + gBattleMons[battler].status1 &= ~STATUS1_BURN; BattleScriptExecute(BattleScript_BerryCureBrnEnd2); effect = ITEM_STATUS_CHANGE; } break; case HOLD_EFFECT_CURE_FRZ: - if (gBattleMons[battlerId].status1 & STATUS1_FREEZE && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battler].status1 & STATUS1_FREEZE && !UnnerveOn(battler, gLastUsedItem)) { - gBattleMons[battlerId].status1 &= ~STATUS1_FREEZE; + gBattleMons[battler].status1 &= ~STATUS1_FREEZE; BattleScriptExecute(BattleScript_BerryCureFrzEnd2); effect = ITEM_STATUS_CHANGE; } - if (gBattleMons[battlerId].status1 & STATUS1_FROSTBITE && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battler].status1 & STATUS1_FROSTBITE && !UnnerveOn(battler, gLastUsedItem)) { - gBattleMons[battlerId].status1 &= ~STATUS1_FROSTBITE; + gBattleMons[battler].status1 &= ~STATUS1_FROSTBITE; BattleScriptExecute(BattleScript_BerryCureFsbEnd2); effect = ITEM_STATUS_CHANGE; } break; case HOLD_EFFECT_CURE_SLP: - if (gBattleMons[battlerId].status1 & STATUS1_SLEEP && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battler].status1 & STATUS1_SLEEP && !UnnerveOn(battler, gLastUsedItem)) { - gBattleMons[battlerId].status1 &= ~STATUS1_SLEEP; - gBattleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE; + gBattleMons[battler].status1 &= ~STATUS1_SLEEP; + gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE; BattleScriptExecute(BattleScript_BerryCureSlpEnd2); effect = ITEM_STATUS_CHANGE; } break; case HOLD_EFFECT_CURE_STATUS: - if ((gBattleMons[battlerId].status1 & STATUS1_ANY || gBattleMons[battlerId].status2 & STATUS2_CONFUSION) && !UnnerveOn(battlerId, gLastUsedItem)) + if ((gBattleMons[battler].status1 & STATUS1_ANY || gBattleMons[battler].status2 & STATUS2_CONFUSION) && !UnnerveOn(battler, gLastUsedItem)) { i = 0; - if (gBattleMons[battlerId].status1 & STATUS1_PSN_ANY) + if (gBattleMons[battler].status1 & STATUS1_PSN_ANY) { StringCopy(gBattleTextBuff1, gStatusConditionString_PoisonJpn); i++; } - if (gBattleMons[battlerId].status1 & STATUS1_SLEEP) + if (gBattleMons[battler].status1 & STATUS1_SLEEP) { - gBattleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE; + gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE; StringCopy(gBattleTextBuff1, gStatusConditionString_SleepJpn); i++; } - if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS) + if (gBattleMons[battler].status1 & STATUS1_PARALYSIS) { StringCopy(gBattleTextBuff1, gStatusConditionString_ParalysisJpn); i++; } - if (gBattleMons[battlerId].status1 & STATUS1_BURN) + if (gBattleMons[battler].status1 & STATUS1_BURN) { StringCopy(gBattleTextBuff1, gStatusConditionString_BurnJpn); i++; } - if (gBattleMons[battlerId].status1 & STATUS1_FREEZE || gBattleMons[battlerId].status1 & STATUS1_FROSTBITE) + if (gBattleMons[battler].status1 & STATUS1_FREEZE || gBattleMons[battler].status1 & STATUS1_FROSTBITE) { StringCopy(gBattleTextBuff1, gStatusConditionString_IceJpn); i++; } - if (gBattleMons[battlerId].status2 & STATUS2_CONFUSION) + if (gBattleMons[battler].status2 & STATUS2_CONFUSION) { StringCopy(gBattleTextBuff1, gStatusConditionString_ConfusionJpn); i++; @@ -7201,56 +7224,56 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CURED_PROBLEM; else gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_NORMALIZED_STATUS; - gBattleMons[battlerId].status1 = 0; - RemoveConfusionStatus(battlerId); + gBattleMons[battler].status1 = 0; + RemoveConfusionStatus(battler); BattleScriptExecute(BattleScript_BerryCureChosenStatusEnd2); effect = ITEM_STATUS_CHANGE; } break; case HOLD_EFFECT_RESTORE_HP: - effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, FALSE); + effect = ItemHealHp(battler, gLastUsedItem, TRUE, FALSE); break; case HOLD_EFFECT_RESTORE_PCT_HP: - effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, TRUE); + effect = ItemHealHp(battler, gLastUsedItem, TRUE, TRUE); break; #endif case HOLD_EFFECT_AIR_BALLOON: effect = ITEM_EFFECT_OTHER; - gBattleScripting.battler = battlerId; + gBattleScripting.battler = battler; BattleScriptPushCursorAndCallback(BattleScript_AirBaloonMsgIn); - RecordItemEffectBattle(battlerId, HOLD_EFFECT_AIR_BALLOON); + RecordItemEffectBattle(battler, HOLD_EFFECT_AIR_BALLOON); break; case HOLD_EFFECT_ROOM_SERVICE: - if (TryRoomService(battlerId)) + if (TryRoomService(battler)) { BattleScriptExecute(BattleScript_BerryStatRaiseEnd2); effect = ITEM_STATS_CHANGE; } break; case HOLD_EFFECT_SEEDS: - switch (GetBattlerHoldEffectParam(battlerId)) + switch (GetBattlerHoldEffectParam(battler)) { case HOLD_EFFECT_PARAM_ELECTRIC_TERRAIN: - effect = TryHandleSeed(battlerId, STATUS_FIELD_ELECTRIC_TERRAIN, STAT_DEF, gLastUsedItem, TRUE); + effect = TryHandleSeed(battler, STATUS_FIELD_ELECTRIC_TERRAIN, STAT_DEF, gLastUsedItem, TRUE); break; case HOLD_EFFECT_PARAM_GRASSY_TERRAIN: - effect = TryHandleSeed(battlerId, STATUS_FIELD_GRASSY_TERRAIN, STAT_DEF, gLastUsedItem, TRUE); + effect = TryHandleSeed(battler, STATUS_FIELD_GRASSY_TERRAIN, STAT_DEF, gLastUsedItem, TRUE); break; case HOLD_EFFECT_PARAM_MISTY_TERRAIN: - effect = TryHandleSeed(battlerId, STATUS_FIELD_MISTY_TERRAIN, STAT_SPDEF, gLastUsedItem, TRUE); + effect = TryHandleSeed(battler, STATUS_FIELD_MISTY_TERRAIN, STAT_SPDEF, gLastUsedItem, TRUE); break; case HOLD_EFFECT_PARAM_PSYCHIC_TERRAIN: - effect = TryHandleSeed(battlerId, STATUS_FIELD_PSYCHIC_TERRAIN, STAT_SPDEF, gLastUsedItem, TRUE); + effect = TryHandleSeed(battler, STATUS_FIELD_PSYCHIC_TERRAIN, STAT_SPDEF, gLastUsedItem, TRUE); break; } break; case HOLD_EFFECT_EJECT_PACK: - if (gProtectStructs[battlerId].statFell - && gProtectStructs[battlerId].disableEjectPack == 0 + if (gProtectStructs[battler].statFell + && gProtectStructs[battler].disableEjectPack == 0 && !(gCurrentMove == MOVE_PARTING_SHOT && CanBattlerSwitch(gBattlerAttacker))) // Does not activate if attacker used Parting Shot and can switch out { - gProtectStructs[battlerId].statFell = FALSE; - gActiveBattler = gBattleScripting.battler = battlerId; + gProtectStructs[battler].statFell = FALSE; + gBattleScripting.battler = battler; effect = ITEM_STATS_CHANGE; if (moveTurn) { @@ -7264,8 +7287,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_BERSERK_GENE: - BufferStatChange(battlerId, STAT_ATK, STRINGID_STATROSE); - gEffectBattler = battlerId; + BufferStatChange(battler, STAT_ATK, STRINGID_STATROSE); + gEffectBattler = battler; if (CanBeInfinitelyConfused(gEffectBattler)) { gStatuses4[gEffectBattler] |= STATUS4_INFINITE_CONFUSION; @@ -7281,225 +7304,225 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } if (effect != 0) { - gSpecialStatuses[battlerId].switchInItemDone = TRUE; - gActiveBattler = gBattlerAttacker = gPotentialItemEffectBattler = gBattleScripting.battler = battlerId; + gSpecialStatuses[battler].switchInItemDone = TRUE; + gBattlerAttacker = gPotentialItemEffectBattler = gBattleScripting.battler = battler; switch (effect) { case ITEM_STATUS_CHANGE: - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battlerId].status1); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); + MarkBattlerForControllerExec(battler); break; } } } break; case ITEMEFFECT_NORMAL: - if (gBattleMons[battlerId].hp) + if (gBattleMons[battler].hp) { switch (battlerHoldEffect) { case HOLD_EFFECT_RESTORE_HP: if (!moveTurn) - effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, FALSE); + effect = ItemHealHp(battler, gLastUsedItem, TRUE, FALSE); break; case HOLD_EFFECT_RESTORE_PCT_HP: if (!moveTurn) - effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, TRUE); + effect = ItemHealHp(battler, gLastUsedItem, TRUE, TRUE); break; case HOLD_EFFECT_RESTORE_PP: if (!moveTurn) - effect = ItemRestorePp(battlerId, gLastUsedItem, TRUE); + effect = ItemRestorePp(battler, gLastUsedItem, TRUE); break; case HOLD_EFFECT_RESTORE_STATS: for (i = 0; i < NUM_BATTLE_STATS; i++) { - if (gBattleMons[battlerId].statStages[i] < DEFAULT_STAT_STAGE) + if (gBattleMons[battler].statStages[i] < DEFAULT_STAT_STAGE) { - gBattleMons[battlerId].statStages[i] = DEFAULT_STAT_STAGE; + gBattleMons[battler].statStages[i] = DEFAULT_STAT_STAGE; effect = ITEM_STATS_CHANGE; } } if (effect != 0) { - gBattleScripting.battler = battlerId; - gPotentialItemEffectBattler = battlerId; - gActiveBattler = gBattlerAttacker = battlerId; + gBattleScripting.battler = battler; + gPotentialItemEffectBattler = battler; + gBattlerAttacker = battler; BattleScriptExecute(BattleScript_WhiteHerbEnd2); } break; case HOLD_EFFECT_BLACK_SLUDGE: - if (IS_BATTLER_OF_TYPE(battlerId, TYPE_POISON)) + if (IS_BATTLER_OF_TYPE(battler, TYPE_POISON)) { goto LEFTOVERS; } - else if (GetBattlerAbility(battlerId) != ABILITY_MAGIC_GUARD && !moveTurn) + else if (GetBattlerAbility(battler) != ABILITY_MAGIC_GUARD && !moveTurn) { - gBattleMoveDamage = gBattleMons[battlerId].maxHP / 8; + gBattleMoveDamage = gBattleMons[battler].maxHP / 8; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; BattleScriptExecute(BattleScript_ItemHurtEnd2); effect = ITEM_HP_CHANGE; - RecordItemEffectBattle(battlerId, battlerHoldEffect); + RecordItemEffectBattle(battler, battlerHoldEffect); PREPARE_ITEM_BUFFER(gBattleTextBuff1, gLastUsedItem); } break; case HOLD_EFFECT_LEFTOVERS: LEFTOVERS: #if B_HEAL_BLOCKING >= GEN_5 - if (gBattleMons[battlerId].hp < gBattleMons[battlerId].maxHP && !moveTurn && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)) + if (gBattleMons[battler].hp < gBattleMons[battler].maxHP && !moveTurn && !(gStatuses3[battler] & STATUS3_HEAL_BLOCK)) #else - if (gBattleMons[battlerId].hp < gBattleMons[battlerId].maxHP && !moveTurn) + if (gBattleMons[battler].hp < gBattleMons[battler].maxHP && !moveTurn) #endif { - gBattleMoveDamage = gBattleMons[battlerId].maxHP / 16; + gBattleMoveDamage = gBattleMons[battler].maxHP / 16; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; gBattleMoveDamage *= -1; BattleScriptExecute(BattleScript_ItemHealHP_End2); effect = ITEM_HP_CHANGE; - RecordItemEffectBattle(battlerId, battlerHoldEffect); + RecordItemEffectBattle(battler, battlerHoldEffect); } break; case HOLD_EFFECT_CONFUSE_SPICY: if (!moveTurn) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SPICY, TRUE); + effect = HealConfuseBerry(battler, gLastUsedItem, FLAVOR_SPICY, TRUE); break; case HOLD_EFFECT_CONFUSE_DRY: if (!moveTurn) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_DRY, TRUE); + effect = HealConfuseBerry(battler, gLastUsedItem, FLAVOR_DRY, TRUE); break; case HOLD_EFFECT_CONFUSE_SWEET: if (!moveTurn) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SWEET, TRUE); + effect = HealConfuseBerry(battler, gLastUsedItem, FLAVOR_SWEET, TRUE); break; case HOLD_EFFECT_CONFUSE_BITTER: if (!moveTurn) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_BITTER, TRUE); + effect = HealConfuseBerry(battler, gLastUsedItem, FLAVOR_BITTER, TRUE); break; case HOLD_EFFECT_CONFUSE_SOUR: if (!moveTurn) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SOUR, TRUE); + effect = HealConfuseBerry(battler, gLastUsedItem, FLAVOR_SOUR, TRUE); break; case HOLD_EFFECT_ATTACK_UP: if (!moveTurn) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_ATK, TRUE); + effect = StatRaiseBerry(battler, gLastUsedItem, STAT_ATK, TRUE); break; case HOLD_EFFECT_DEFENSE_UP: if (!moveTurn) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_DEF, TRUE); + effect = StatRaiseBerry(battler, gLastUsedItem, STAT_DEF, TRUE); break; case HOLD_EFFECT_SPEED_UP: if (!moveTurn) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPEED, TRUE); + effect = StatRaiseBerry(battler, gLastUsedItem, STAT_SPEED, TRUE); break; case HOLD_EFFECT_SP_ATTACK_UP: if (!moveTurn) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPATK, TRUE); + effect = StatRaiseBerry(battler, gLastUsedItem, STAT_SPATK, TRUE); break; case HOLD_EFFECT_SP_DEFENSE_UP: if (!moveTurn) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPDEF, TRUE); + effect = StatRaiseBerry(battler, gLastUsedItem, STAT_SPDEF, TRUE); break; case HOLD_EFFECT_CRITICAL_UP: - if (!moveTurn && !(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY) - && HasEnoughHpToEatBerry(battlerId, GetBattlerItemHoldEffectParam(battlerId, gLastUsedItem), gLastUsedItem)) + if (!moveTurn && !(gBattleMons[battler].status2 & STATUS2_FOCUS_ENERGY) + && HasEnoughHpToEatBerry(battler, GetBattlerItemHoldEffectParam(battler, gLastUsedItem), gLastUsedItem)) { - gBattleMons[battlerId].status2 |= STATUS2_FOCUS_ENERGY; - gBattleScripting.battler = battlerId; + gBattleMons[battler].status2 |= STATUS2_FOCUS_ENERGY; + gBattleScripting.battler = battler; BattleScriptExecute(BattleScript_BerryFocusEnergyEnd2); effect = ITEM_EFFECT_OTHER; } break; case HOLD_EFFECT_RANDOM_STAT_UP: if (!moveTurn) - effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, TRUE); + effect = RandomStatRaiseBerry(battler, gLastUsedItem, TRUE); break; case HOLD_EFFECT_CURE_PAR: - if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battler].status1 & STATUS1_PARALYSIS && !UnnerveOn(battler, gLastUsedItem)) { - gBattleMons[battlerId].status1 &= ~STATUS1_PARALYSIS; + gBattleMons[battler].status1 &= ~STATUS1_PARALYSIS; BattleScriptExecute(BattleScript_BerryCurePrlzEnd2); effect = ITEM_STATUS_CHANGE; } break; case HOLD_EFFECT_CURE_PSN: - if (gBattleMons[battlerId].status1 & STATUS1_PSN_ANY && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battler].status1 & STATUS1_PSN_ANY && !UnnerveOn(battler, gLastUsedItem)) { - gBattleMons[battlerId].status1 &= ~(STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER); + gBattleMons[battler].status1 &= ~(STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER); BattleScriptExecute(BattleScript_BerryCurePsnEnd2); effect = ITEM_STATUS_CHANGE; } break; case HOLD_EFFECT_CURE_BRN: - if (gBattleMons[battlerId].status1 & STATUS1_BURN && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battler].status1 & STATUS1_BURN && !UnnerveOn(battler, gLastUsedItem)) { - gBattleMons[battlerId].status1 &= ~STATUS1_BURN; + gBattleMons[battler].status1 &= ~STATUS1_BURN; BattleScriptExecute(BattleScript_BerryCureBrnEnd2); effect = ITEM_STATUS_CHANGE; } break; case HOLD_EFFECT_CURE_FRZ: - if (gBattleMons[battlerId].status1 & STATUS1_FREEZE && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battler].status1 & STATUS1_FREEZE && !UnnerveOn(battler, gLastUsedItem)) { - gBattleMons[battlerId].status1 &= ~STATUS1_FREEZE; + gBattleMons[battler].status1 &= ~STATUS1_FREEZE; BattleScriptExecute(BattleScript_BerryCureFrzEnd2); effect = ITEM_STATUS_CHANGE; } - if (gBattleMons[battlerId].status1 & STATUS1_FROSTBITE && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battler].status1 & STATUS1_FROSTBITE && !UnnerveOn(battler, gLastUsedItem)) { - gBattleMons[battlerId].status1 &= ~STATUS1_FROSTBITE; + gBattleMons[battler].status1 &= ~STATUS1_FROSTBITE; BattleScriptExecute(BattleScript_BerryCureFsbEnd2); effect = ITEM_STATUS_CHANGE; } break; case HOLD_EFFECT_CURE_SLP: - if (gBattleMons[battlerId].status1 & STATUS1_SLEEP && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battler].status1 & STATUS1_SLEEP && !UnnerveOn(battler, gLastUsedItem)) { - gBattleMons[battlerId].status1 &= ~STATUS1_SLEEP; - gBattleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE; + gBattleMons[battler].status1 &= ~STATUS1_SLEEP; + gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE; BattleScriptExecute(BattleScript_BerryCureSlpEnd2); effect = ITEM_STATUS_CHANGE; } break; case HOLD_EFFECT_CURE_CONFUSION: - if (gBattleMons[battlerId].status2 & STATUS2_CONFUSION && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battler].status2 & STATUS2_CONFUSION && !UnnerveOn(battler, gLastUsedItem)) { - RemoveConfusionStatus(battlerId); + RemoveConfusionStatus(battler); BattleScriptExecute(BattleScript_BerryCureConfusionEnd2); effect = ITEM_EFFECT_OTHER; } break; case HOLD_EFFECT_CURE_STATUS: - if ((gBattleMons[battlerId].status1 & STATUS1_ANY || gBattleMons[battlerId].status2 & STATUS2_CONFUSION) && !UnnerveOn(battlerId, gLastUsedItem)) + if ((gBattleMons[battler].status1 & STATUS1_ANY || gBattleMons[battler].status2 & STATUS2_CONFUSION) && !UnnerveOn(battler, gLastUsedItem)) { i = 0; - if (gBattleMons[battlerId].status1 & STATUS1_PSN_ANY) + if (gBattleMons[battler].status1 & STATUS1_PSN_ANY) { StringCopy(gBattleTextBuff1, gStatusConditionString_PoisonJpn); i++; } - if (gBattleMons[battlerId].status1 & STATUS1_SLEEP) + if (gBattleMons[battler].status1 & STATUS1_SLEEP) { - gBattleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE; + gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE; StringCopy(gBattleTextBuff1, gStatusConditionString_SleepJpn); i++; } - if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS) + if (gBattleMons[battler].status1 & STATUS1_PARALYSIS) { StringCopy(gBattleTextBuff1, gStatusConditionString_ParalysisJpn); i++; } - if (gBattleMons[battlerId].status1 & STATUS1_BURN) + if (gBattleMons[battler].status1 & STATUS1_BURN) { StringCopy(gBattleTextBuff1, gStatusConditionString_BurnJpn); i++; } - if (gBattleMons[battlerId].status1 & STATUS1_FREEZE || gBattleMons[battlerId].status1 & STATUS1_FROSTBITE) + if (gBattleMons[battler].status1 & STATUS1_FREEZE || gBattleMons[battler].status1 & STATUS1_FROSTBITE) { StringCopy(gBattleTextBuff1, gStatusConditionString_IceJpn); i++; } - if (gBattleMons[battlerId].status2 & STATUS2_CONFUSION) + if (gBattleMons[battler].status2 & STATUS2_CONFUSION) { StringCopy(gBattleTextBuff1, gStatusConditionString_ConfusionJpn); i++; @@ -7508,28 +7531,28 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CURED_PROBLEM; else gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_NORMALIZED_STATUS; - gBattleMons[battlerId].status1 = 0; - RemoveConfusionStatus(battlerId); + gBattleMons[battler].status1 = 0; + RemoveConfusionStatus(battler); BattleScriptExecute(BattleScript_BerryCureChosenStatusEnd2); effect = ITEM_STATUS_CHANGE; } break; case HOLD_EFFECT_MENTAL_HERB: - if (GetMentalHerbEffect(battlerId)) + if (GetMentalHerbEffect(battler)) { gBattleScripting.savedBattler = gBattlerAttacker; - gBattlerAttacker = battlerId; + gBattlerAttacker = battler; BattleScriptExecute(BattleScript_MentalHerbCureEnd2); effect = ITEM_EFFECT_OTHER; } break; case HOLD_EFFECT_MICLE_BERRY: if (!moveTurn) - effect = TrySetMicleBerry(battlerId, gLastUsedItem, TRUE); + effect = TrySetMicleBerry(battler, gLastUsedItem, TRUE); break; case HOLD_EFFECT_BERSERK_GENE: - BufferStatChange(battlerId, STAT_ATK, STRINGID_STATROSE); - gEffectBattler = battlerId; + BufferStatChange(battler, STAT_ATK, STRINGID_STATROSE); + gEffectBattler = battler; if (CanBeInfinitelyConfused(gEffectBattler)) { gStatuses4[gEffectBattler] |= STATUS4_INFINITE_CONFUSION; @@ -7543,49 +7566,49 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) effect = ITEM_STATS_CHANGE; break; case HOLD_EFFECT_MIRROR_HERB: - effect = TryConsumeMirrorHerb(battlerId, TRUE); + effect = TryConsumeMirrorHerb(battler, TRUE); break; } if (effect != 0) { - gActiveBattler = gBattlerAttacker = gPotentialItemEffectBattler = gBattleScripting.battler = battlerId; + gBattlerAttacker = gPotentialItemEffectBattler = gBattleScripting.battler = battler; switch (effect) { case ITEM_STATUS_CHANGE: - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battlerId].status1); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); + MarkBattlerForControllerExec(battler); break; } } } break; case ITEMEFFECT_USE_LAST_ITEM: - effect = ItemEffectMoveEnd(battlerId, ItemId_GetHoldEffect(gLastUsedItem)); + effect = ItemEffectMoveEnd(battler, ItemId_GetHoldEffect(gLastUsedItem)); gBattleScripting.overrideBerryRequirements = 2; // to exit VARIOUS_CONSUME_BERRIES if (effect) { - gActiveBattler = gPotentialItemEffectBattler = gBattleScripting.battler = battlerId; + gPotentialItemEffectBattler = gBattleScripting.battler = battler; if (effect == ITEM_STATUS_CHANGE) { - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); + MarkBattlerForControllerExec(battler); } break; } break; case ITEMEFFECT_MOVE_END: - for (battlerId = 0; battlerId < gBattlersCount; battlerId++) + for (battler = 0; battler < gBattlersCount; battler++) { - gLastUsedItem = gBattleMons[battlerId].item; - effect = ItemEffectMoveEnd(battlerId, GetBattlerHoldEffect(battlerId, TRUE)); + gLastUsedItem = gBattleMons[battler].item; + effect = ItemEffectMoveEnd(battler, GetBattlerHoldEffect(battler, TRUE)); if (effect) { - gActiveBattler = gPotentialItemEffectBattler = gBattleScripting.battler = battlerId; + gPotentialItemEffectBattler = gBattleScripting.battler = battler; if (effect == ITEM_STATUS_CHANGE) { - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); + MarkBattlerForControllerExec(battler); } break; } @@ -7596,21 +7619,25 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) switch (atkHoldEffect) { case HOLD_EFFECT_FLINCH: - #if B_SERENE_GRACE_BOOST >= GEN_5 - if (GetBattlerAbility(gBattlerAttacker) == ABILITY_SERENE_GRACE) - atkHoldEffectParam *= 2; - #endif - if (gBattleMoveDamage != 0 // Need to have done damage - && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) - && TARGET_TURN_DAMAGED - && RandomPercentage(RNG_HOLD_EFFECT_FLINCH, atkHoldEffectParam) - && gBattleMoves[gCurrentMove].flags & FLAG_KINGS_ROCK_AFFECTED - && gBattleMons[gBattlerTarget].hp) { - gBattleScripting.moveEffect = MOVE_EFFECT_FLINCH; - BattleScriptPushCursor(); - SetMoveEffect(FALSE, 0); - BattleScriptPop(); + u16 ability = GetBattlerAbility(gBattlerAttacker); + #if B_SERENE_GRACE_BOOST >= GEN_5 + if (ability == ABILITY_SERENE_GRACE) + atkHoldEffectParam *= 2; + #endif + if (gBattleMoveDamage != 0 // Need to have done damage + && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) + && TARGET_TURN_DAMAGED + && !gBattleMoves[gCurrentMove].ignoresKingsRock + && gBattleMons[gBattlerTarget].hp + && RandomPercentage(RNG_HOLD_EFFECT_FLINCH, atkHoldEffectParam) + && ability != ABILITY_STENCH) + { + gBattleScripting.moveEffect = MOVE_EFFECT_FLINCH; + BattleScriptPushCursor(); + SetMoveEffect(FALSE, 0); + BattleScriptPop(); + } } break; case HOLD_EFFECT_BLUNDER_POLICY: @@ -7637,7 +7664,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) && gBattlerAttacker != gBattlerTarget && gBattleMons[gBattlerAttacker].hp != gBattleMons[gBattlerAttacker].maxHP #if B_HEAL_BLOCKING >= GEN_5 - && gBattleMons[gBattlerAttacker].hp != 0 && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)) + && gBattleMons[gBattlerAttacker].hp != 0 && !(gStatuses3[battler] & STATUS3_HEAL_BLOCK)) #else && gBattleMons[gBattlerAttacker].hp != 0) #endif @@ -7672,7 +7699,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) case HOLD_EFFECT_THROAT_SPRAY: // Does NOT need to be a damaging move if (gProtectStructs[gBattlerAttacker].targetAffected && gBattleMons[gBattlerAttacker].hp != 0 - && gBattleMoves[gCurrentMove].flags & FLAG_SOUND + && gBattleMoves[gCurrentMove].soundMove && CompareStat(gBattlerAttacker, STAT_SPATK, MAX_STAT_STAGE, CMP_LESS_THAN) && !NoAliveMonsForEitherParty()) // Don't activate if battle will end { @@ -7713,11 +7740,11 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_RockyHelmetActivates; PREPARE_ITEM_BUFFER(gBattleTextBuff1, gLastUsedItem); - RecordItemEffectBattle(battlerId, HOLD_EFFECT_ROCKY_HELMET); + RecordItemEffectBattle(battler, HOLD_EFFECT_ROCKY_HELMET); } break; case HOLD_EFFECT_WEAKNESS_POLICY: - if (IsBattlerAlive(battlerId) + if (IsBattlerAlive(battler) && TARGET_TURN_DAMAGED && gMoveResultFlags & MOVE_RESULT_SUPER_EFFECTIVE) { @@ -7727,7 +7754,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_SNOWBALL: - if (IsBattlerAlive(battlerId) + if (IsBattlerAlive(battler) && TARGET_TURN_DAMAGED && moveType == TYPE_ICE) { @@ -7738,7 +7765,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_LUMINOUS_MOSS: - if (IsBattlerAlive(battlerId) + if (IsBattlerAlive(battler) && TARGET_TURN_DAMAGED && moveType == TYPE_WATER) { @@ -7749,7 +7776,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_CELL_BATTERY: - if (IsBattlerAlive(battlerId) + if (IsBattlerAlive(battler) && TARGET_TURN_DAMAGED && moveType == TYPE_ELECTRIC) { @@ -7760,7 +7787,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_ABSORB_BULB: - if (IsBattlerAlive(battlerId) + if (IsBattlerAlive(battler) && TARGET_TURN_DAMAGED && moveType == TYPE_WATER) { @@ -7770,63 +7797,66 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) gBattleScripting.statChanger = SET_STATCHANGER(STAT_SPATK, 1, FALSE); } break; + case HOLD_EFFECT_ENIGMA_BERRY: // consume and heal if hit by super effective move + effect = TrySetEnigmaBerry(battler); + break; case HOLD_EFFECT_JABOCA_BERRY: // consume and damage attacker if used physical move - if (IsBattlerAlive(battlerId) + if (IsBattlerAlive(battler) && TARGET_TURN_DAMAGED - && !DoesSubstituteBlockMove(gBattlerAttacker, battlerId, gCurrentMove) + && !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove) && IS_MOVE_PHYSICAL(gCurrentMove) && GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD) { gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 8; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; - if (GetBattlerAbility(battlerId) == ABILITY_RIPEN) + if (GetBattlerAbility(battler) == ABILITY_RIPEN) gBattleMoveDamage *= 2; effect = ITEM_HP_CHANGE; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_JabocaRowapBerryActivates; PREPARE_ITEM_BUFFER(gBattleTextBuff1, gLastUsedItem); - RecordItemEffectBattle(battlerId, HOLD_EFFECT_ROCKY_HELMET); + RecordItemEffectBattle(battler, HOLD_EFFECT_ROCKY_HELMET); } break; case HOLD_EFFECT_ROWAP_BERRY: // consume and damage attacker if used special move - if (IsBattlerAlive(battlerId) + if (IsBattlerAlive(battler) && TARGET_TURN_DAMAGED - && !DoesSubstituteBlockMove(gBattlerAttacker, battlerId, gCurrentMove) + && !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove) && IS_MOVE_SPECIAL(gCurrentMove) && GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD) { gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 8; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; - if (GetBattlerAbility(battlerId) == ABILITY_RIPEN) + if (GetBattlerAbility(battler) == ABILITY_RIPEN) gBattleMoveDamage *= 2; effect = ITEM_HP_CHANGE; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_JabocaRowapBerryActivates; PREPARE_ITEM_BUFFER(gBattleTextBuff1, gLastUsedItem); - RecordItemEffectBattle(battlerId, HOLD_EFFECT_ROCKY_HELMET); + RecordItemEffectBattle(battler, HOLD_EFFECT_ROCKY_HELMET); } break; case HOLD_EFFECT_KEE_BERRY: // consume and boost defense if used physical move - effect = DamagedStatBoostBerryEffect(battlerId, STAT_DEF, SPLIT_PHYSICAL); + effect = DamagedStatBoostBerryEffect(battler, STAT_DEF, SPLIT_PHYSICAL); break; case HOLD_EFFECT_MARANGA_BERRY: // consume and boost sp. defense if used special move - effect = DamagedStatBoostBerryEffect(battlerId, STAT_SPDEF, SPLIT_SPECIAL); + effect = DamagedStatBoostBerryEffect(battler, STAT_SPDEF, SPLIT_SPECIAL); break; case HOLD_EFFECT_STICKY_BARB: if (TARGET_TURN_DAMAGED && (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) && IsMoveMakingContact(gCurrentMove, gBattlerAttacker) - && !DoesSubstituteBlockMove(gBattlerAttacker, battlerId, gCurrentMove) + && !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove) && IsBattlerAlive(gBattlerAttacker) && CanStealItem(gBattlerAttacker, gBattlerTarget, gBattleMons[gBattlerTarget].item) && gBattleMons[gBattlerAttacker].item == ITEM_NONE) { // No sticky hold checks. - gEffectBattler = battlerId; // gEffectBattler = target + gEffectBattler = battler; // gEffectBattler = target StealTargetItem(gBattlerAttacker, gBattlerTarget); // Attacker takes target's barb BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_StickyBarbTransfer; @@ -7838,36 +7868,36 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) break; case ITEMEFFECT_ORBS: { - u16 battlerAbility = GetBattlerAbility(battlerId); + u16 battlerAbility = GetBattlerAbility(battler); switch (battlerHoldEffect) { case HOLD_EFFECT_TOXIC_ORB: - if (CanBePoisoned(battlerId, battlerId)) + if (CanBePoisoned(battler, battler)) { effect = ITEM_STATUS_CHANGE; - gBattleMons[battlerId].status1 = STATUS1_TOXIC_POISON; + gBattleMons[battler].status1 = STATUS1_TOXIC_POISON; BattleScriptExecute(BattleScript_ToxicOrb); - RecordItemEffectBattle(battlerId, battlerHoldEffect); + RecordItemEffectBattle(battler, battlerHoldEffect); } break; case HOLD_EFFECT_FLAME_ORB: - if (CanBeBurned(battlerId)) + if (CanBeBurned(battler)) { effect = ITEM_STATUS_CHANGE; - gBattleMons[battlerId].status1 = STATUS1_BURN; + gBattleMons[battler].status1 = STATUS1_BURN; BattleScriptExecute(BattleScript_FlameOrb); - RecordItemEffectBattle(battlerId, battlerHoldEffect); + RecordItemEffectBattle(battler, battlerHoldEffect); } break; case HOLD_EFFECT_STICKY_BARB: // Not an orb per se, but similar effect, and needs to NOT activate with pickpocket if (battlerAbility != ABILITY_MAGIC_GUARD) { - gBattleMoveDamage = gBattleMons[battlerId].maxHP / 8; + gBattleMoveDamage = gBattleMons[battler].maxHP / 8; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; BattleScriptExecute(BattleScript_ItemHurtEnd2); effect = ITEM_HP_CHANGE; - RecordItemEffectBattle(battlerId, battlerHoldEffect); + RecordItemEffectBattle(battler, battlerHoldEffect); PREPARE_ITEM_BUFFER(gBattleTextBuff1, gLastUsedItem); } break; @@ -7875,9 +7905,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) if (effect == ITEM_STATUS_CHANGE) { - gActiveBattler = battlerId; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battlerId].status1); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); + MarkBattlerForControllerExec(battler); } } break; @@ -7885,16 +7914,16 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) // Berry was successfully used on a Pokemon. if (effect && (gLastUsedItem >= FIRST_BERRY_INDEX && gLastUsedItem <= LAST_BERRY_INDEX)) - gBattleStruct->ateBerry[battlerId & BIT_SIDE] |= gBitTable[gBattlerPartyIndexes[battlerId]]; + gBattleStruct->ateBerry[battler & BIT_SIDE] |= gBitTable[gBattlerPartyIndexes[battler]]; return effect; } -void ClearFuryCutterDestinyBondGrudge(u8 battlerId) +void ClearFuryCutterDestinyBondGrudge(u32 battler) { - gDisableStructs[battlerId].furyCutterCounter = 0; - gBattleMons[battlerId].status2 &= ~STATUS2_DESTINY_BOND; - gStatuses3[battlerId] &= ~STATUS3_GRUDGE; + gDisableStructs[battler].furyCutterCounter = 0; + gBattleMons[battler].status2 &= ~STATUS2_DESTINY_BOND; + gStatuses3[battler] &= ~STATUS3_GRUDGE; } void HandleAction_RunBattleScript(void) // identical to RunBattleScriptCommands @@ -7903,7 +7932,7 @@ void HandleAction_RunBattleScript(void) // identical to RunBattleScriptCommands gBattleScriptingCommandsTable[*gBattlescriptCurrInstr](); } -u32 SetRandomTarget(u32 battlerId) +u32 SetRandomTarget(u32 battler) { u32 target; static const u8 targets[2][2] = @@ -7914,13 +7943,13 @@ u32 SetRandomTarget(u32 battlerId) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { - target = GetBattlerAtPosition(targets[GetBattlerSide(battlerId)][Random() % 2]); + target = GetBattlerAtPosition(targets[GetBattlerSide(battler)][Random() % 2]); if (!IsBattlerAlive(target)) target ^= BIT_FLANK; } else { - target = GetBattlerAtPosition(targets[GetBattlerSide(battlerId)][0]); + target = GetBattlerAtPosition(targets[GetBattlerSide(battler)][0]); } return target; @@ -7973,7 +8002,7 @@ u32 GetMoveTarget(u16 move, u8 setTarget) case MOVE_TARGET_BOTH: case MOVE_TARGET_FOES_AND_ALLY: case MOVE_TARGET_OPPONENTS_FIELD: - targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gBattlerAttacker))); + targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker))); if (!IsBattlerAlive(targetBattler)) targetBattler ^= BIT_FLANK; break; @@ -7984,7 +8013,7 @@ u32 GetMoveTarget(u16 move, u8 setTarget) else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && moveTarget & MOVE_TARGET_RANDOM) targetBattler = SetRandomTarget(gBattlerAttacker); else - targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gBattlerAttacker))); + targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker))); break; case MOVE_TARGET_USER_OR_SELECTED: case MOVE_TARGET_USER: @@ -8004,14 +8033,14 @@ u32 GetMoveTarget(u16 move, u8 setTarget) return targetBattler; } -static bool32 IsBattlerModernFatefulEncounter(u8 battlerId) +static bool32 IsBattlerModernFatefulEncounter(u32 battler) { - if (GetBattlerSide(battlerId) == B_SIDE_OPPONENT) + if (GetBattlerSide(battler) == B_SIDE_OPPONENT) return TRUE; - if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES, NULL) != SPECIES_DEOXYS - && GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES, NULL) != SPECIES_MEW) + if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES, NULL) != SPECIES_DEOXYS + && GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES, NULL) != SPECIES_MEW) return TRUE; - return GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_MODERN_FATEFUL_ENCOUNTER, NULL); + return GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_MODERN_FATEFUL_ENCOUNTER, NULL); } u8 IsMonDisobedient(void) @@ -8023,7 +8052,7 @@ u8 IsMonDisobedient(void) if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) return 0; - if (GetBattlerSide(gBattlerAttacker) == B_SIDE_OPPONENT) + if (BattlerHasAi(gBattlerAttacker)) return 0; if (IsBattlerModernFatefulEncounter(gBattlerAttacker)) // only false if illegal Mew or Deoxys @@ -8079,11 +8108,11 @@ u8 IsMonDisobedient(void) if (calc < obedienceLevel) { calc = CheckMoveLimitations(gBattlerAttacker, gBitTable[gCurrMovePos], MOVE_LIMITATIONS_ALL); - if (calc == 0xF) // all moves cannot be used + if (calc == ALL_MOVES_MASK) // all moves cannot be used { // Randomly select, then print a disobedient string // B_MSG_LOAFING, B_MSG_WONT_OBEY, B_MSG_TURNED_AWAY, or B_MSG_PRETEND_NOT_NOTICE - gBattleCommunication[MULTISTRING_CHOOSER] = Random() & (NUM_LOAF_STRINGS - 1); + gBattleCommunication[MULTISTRING_CHOOSER] = MOD(Random(), NUM_LOAF_STRINGS); gBattlescriptCurrInstr = BattleScript_MoveUsedLoafingAround; return 1; } @@ -8091,7 +8120,7 @@ u8 IsMonDisobedient(void) { do { - gCurrMovePos = gChosenMovePos = Random() & (MAX_MON_MOVES - 1); + gCurrMovePos = gChosenMovePos = MOD(Random(), MAX_MON_MOVES); } while (gBitTable[gCurrMovePos] & calc); gCalledMove = gBattleMons[gBattlerAttacker].moves[gCurrMovePos]; @@ -8134,66 +8163,61 @@ u8 IsMonDisobedient(void) { // Randomly select, then print a disobedient string // B_MSG_LOAFING, B_MSG_WONT_OBEY, B_MSG_TURNED_AWAY, or B_MSG_PRETEND_NOT_NOTICE - gBattleCommunication[MULTISTRING_CHOOSER] = Random() & (NUM_LOAF_STRINGS - 1); + gBattleCommunication[MULTISTRING_CHOOSER] = MOD(Random(), NUM_LOAF_STRINGS); gBattlescriptCurrInstr = BattleScript_MoveUsedLoafingAround; return 1; } } } -u32 GetBattlerHoldEffect(u8 battlerId, bool32 checkNegating) +u32 GetBattlerHoldEffect(u32 battler, bool32 checkNegating) { if (checkNegating) { - if (gStatuses3[battlerId] & STATUS3_EMBARGO) + if (gStatuses3[battler] & STATUS3_EMBARGO) return HOLD_EFFECT_NONE; if (gFieldStatuses & STATUS_FIELD_MAGIC_ROOM) return HOLD_EFFECT_NONE; - if (GetBattlerAbility(battlerId) == ABILITY_KLUTZ) + if (GetBattlerAbility(battler) == ABILITY_KLUTZ) return HOLD_EFFECT_NONE; } - gPotentialItemEffectBattler = battlerId; + gPotentialItemEffectBattler = battler; -#if DEBUG_BATTLE_MENU == TRUE - if (gBattleStruct->debugHoldEffects[battlerId] != 0 && gBattleMons[battlerId].item) - return gBattleStruct->debugHoldEffects[battlerId]; - else -#endif - if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY_E_READER) - return gEnigmaBerries[battlerId].holdEffect; + if (gBattleMons[battler].item == ITEM_ENIGMA_BERRY_E_READER) + return gEnigmaBerries[battler].holdEffect; else - return ItemId_GetHoldEffect(gBattleMons[battlerId].item); + return ItemId_GetHoldEffect(gBattleMons[battler].item); } -static u32 GetBattlerItemHoldEffectParam(u8 battlerId, u16 item) +static u32 GetBattlerItemHoldEffectParam(u32 battler, u32 item) { if (item == ITEM_ENIGMA_BERRY_E_READER) - return gEnigmaBerries[battlerId].holdEffectParam; + return gEnigmaBerries[battler].holdEffectParam; else return ItemId_GetHoldEffectParam(item); } -u32 GetBattlerHoldEffectParam(u8 battlerId) +u32 GetBattlerHoldEffectParam(u32 battler) { - if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY_E_READER) - return gEnigmaBerries[battlerId].holdEffectParam; + if (gBattleMons[battler].item == ITEM_ENIGMA_BERRY_E_READER) + return gEnigmaBerries[battler].holdEffectParam; else - return ItemId_GetHoldEffectParam(gBattleMons[battlerId].item); + return ItemId_GetHoldEffectParam(gBattleMons[battler].item); } -bool32 IsMoveMakingContact(u16 move, u8 battlerAtk) +bool32 IsMoveMakingContact(u32 move, u32 battlerAtk) { - u16 atkHoldEffect = GetBattlerHoldEffect(battlerAtk, TRUE); + u32 atkHoldEffect = GetBattlerHoldEffect(battlerAtk, TRUE); - if (!(gBattleMoves[move].flags & FLAG_MAKES_CONTACT)) + if (!gBattleMoves[move].makesContact) { if (gBattleMoves[move].effect == EFFECT_SHELL_SIDE_ARM && gBattleStruct->swapDamageCategory) return TRUE; else return FALSE; } - else if ((atkHoldEffect == HOLD_EFFECT_PUNCHING_GLOVE && (gBattleMoves[move].flags & FLAG_IRON_FIST_BOOST)) + else if ((atkHoldEffect == HOLD_EFFECT_PUNCHING_GLOVE && gBattleMoves[move].punchingMove) || atkHoldEffect == HOLD_EFFECT_PROTECTIVE_PADS || GetBattlerAbility(battlerAtk) == ABILITY_LONG_REACH) { @@ -8205,14 +8229,14 @@ bool32 IsMoveMakingContact(u16 move, u8 battlerAtk) } } -bool32 IsBattlerProtected(u8 battlerId, u16 move) +bool32 IsBattlerProtected(u32 battler, u32 move) { // Decorate bypasses protect and detect, but not crafty shield if (move == MOVE_DECORATE) { - if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_CRAFTY_SHIELD) + if (gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_CRAFTY_SHIELD) return TRUE; - else if (gProtectStructs[battlerId].protected) + else if (gProtectStructs[battler].protected) return FALSE; } @@ -8230,32 +8254,32 @@ bool32 IsBattlerProtected(u8 battlerId, u16 move) // Protective Pads doesn't stop Unseen Fist from bypassing Protect effects, so IsMoveMakingContact() isn't used here. // This means extra logic is needed to handle Shell Side Arm. if (GetBattlerAbility(gBattlerAttacker) == ABILITY_UNSEEN_FIST - && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT || (gBattleMoves[move].effect == EFFECT_SHELL_SIDE_ARM && gBattleStruct->swapDamageCategory))) + && (gBattleMoves[move].makesContact || (gBattleMoves[move].effect == EFFECT_SHELL_SIDE_ARM && gBattleStruct->swapDamageCategory))) return FALSE; - else if (!(gBattleMoves[move].flags & FLAG_PROTECT_AFFECTED)) + else if (gBattleMoves[move].ignoresProtect) return FALSE; - else if (gBattleMoves[move].effect == MOVE_EFFECT_FEINT) + else if (gBattleMoves[move].effect == EFFECT_FEINT) return FALSE; - else if (gProtectStructs[battlerId].protected) + else if (gProtectStructs[battler].protected) return TRUE; - else if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_WIDE_GUARD + else if (gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_WIDE_GUARD && GetBattlerMoveTargetType(gBattlerAttacker, move) & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY)) return TRUE; - else if (gProtectStructs[battlerId].banefulBunkered) + else if (gProtectStructs[battler].banefulBunkered) return TRUE; - else if ((gProtectStructs[battlerId].obstructed || gProtectStructs[battlerId].silkTrapped) && !IS_MOVE_STATUS(move)) + else if ((gProtectStructs[battler].obstructed || gProtectStructs[battler].silkTrapped) && !IS_MOVE_STATUS(move)) return TRUE; - else if (gProtectStructs[battlerId].spikyShielded) + else if (gProtectStructs[battler].spikyShielded) return TRUE; - else if (gProtectStructs[battlerId].kingsShielded && gBattleMoves[move].power != 0) + else if (gProtectStructs[battler].kingsShielded && gBattleMoves[move].power != 0) return TRUE; - else if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_QUICK_GUARD + else if (gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_QUICK_GUARD && GetChosenMovePriority(gBattlerAttacker) > 0) return TRUE; - else if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_CRAFTY_SHIELD + else if (gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_CRAFTY_SHIELD && IS_MOVE_STATUS(move)) return TRUE; - else if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_MAT_BLOCK + else if (gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_MAT_BLOCK && !IS_MOVE_STATUS(move)) return TRUE; else @@ -8263,66 +8287,68 @@ bool32 IsBattlerProtected(u8 battlerId, u16 move) } // Only called directly when calculating damage type effectiveness -static bool32 IsBattlerGrounded2(u8 battlerId, bool32 considerInverse) +static bool32 IsBattlerGrounded2(u32 battler, bool32 considerInverse) { - if (GetBattlerHoldEffect(battlerId, TRUE) == HOLD_EFFECT_IRON_BALL) + u32 holdEffect = GetBattlerHoldEffect(battler, TRUE); + + if (holdEffect == HOLD_EFFECT_IRON_BALL) return TRUE; if (gFieldStatuses & STATUS_FIELD_GRAVITY) return TRUE; #if B_ROOTED_GROUNDING >= GEN_4 - if (gStatuses3[battlerId] & STATUS3_ROOTED) + if (gStatuses3[battler] & STATUS3_ROOTED) return TRUE; #endif - if (gStatuses3[battlerId] & STATUS3_SMACKED_DOWN) + if (gStatuses3[battler] & STATUS3_SMACKED_DOWN) return TRUE; - if (gStatuses3[battlerId] & STATUS3_TELEKINESIS) + if (gStatuses3[battler] & STATUS3_TELEKINESIS) return FALSE; - if (gStatuses3[battlerId] & STATUS3_MAGNET_RISE) + if (gStatuses3[battler] & STATUS3_MAGNET_RISE) return FALSE; - if (GetBattlerHoldEffect(battlerId, TRUE) == HOLD_EFFECT_AIR_BALLOON) + if (holdEffect == HOLD_EFFECT_AIR_BALLOON) return FALSE; - if (GetBattlerAbility(battlerId) == ABILITY_LEVITATE) + if (GetBattlerAbility(battler) == ABILITY_LEVITATE) return FALSE; - if (IS_BATTLER_OF_TYPE(battlerId, TYPE_FLYING) && (!considerInverse || !FlagGet(B_FLAG_INVERSE_BATTLE))) + if (IS_BATTLER_OF_TYPE(battler, TYPE_FLYING) && (!considerInverse || !FlagGet(B_FLAG_INVERSE_BATTLE))) return FALSE; return TRUE; } -bool32 IsBattlerGrounded(u8 battlerId) +bool32 IsBattlerGrounded(u32 battler) { - IsBattlerGrounded2(battlerId, FALSE); + return IsBattlerGrounded2(battler, FALSE); } -bool32 IsBattlerAlive(u8 battlerId) +bool32 IsBattlerAlive(u32 battler) { - if (gBattleMons[battlerId].hp == 0) + if (gBattleMons[battler].hp == 0) return FALSE; - else if (battlerId >= gBattlersCount) + else if (battler >= gBattlersCount) return FALSE; - else if (gAbsentBattlerFlags & gBitTable[battlerId]) + else if (gAbsentBattlerFlags & gBitTable[battler]) return FALSE; else return TRUE; } -u8 GetBattleMonMoveSlot(struct BattlePokemon *battleMon, u16 move) +u32 GetMoveSlot(u16 *moves, u32 move) { - u8 i; + u32 i; for (i = 0; i < MAX_MON_MOVES; i++) { - if (battleMon->moves[i] == move) + if (moves[i] == move) break; } return i; } -u32 GetBattlerWeight(u8 battlerId) +u32 GetBattlerWeight(u32 battler) { u32 i; - u32 weight = GetPokedexHeightWeight(SpeciesToNationalPokedexNum(gBattleMons[battlerId].species), 1); - u32 ability = GetBattlerAbility(battlerId); - u32 holdEffect = GetBattlerHoldEffect(battlerId, TRUE); + u32 weight = GetPokedexHeightWeight(SpeciesToNationalPokedexNum(gBattleMons[battler].species), 1); + u32 ability = GetBattlerAbility(battler); + u32 holdEffect = GetBattlerHoldEffect(battler, TRUE); if (ability == ABILITY_HEAVY_METAL) weight *= 2; @@ -8332,7 +8358,7 @@ u32 GetBattlerWeight(u8 battlerId) if (holdEffect == HOLD_EFFECT_FLOAT_STONE) weight /= 2; - for (i = 0; i < gDisableStructs[battlerId].autotomizeCount; i++) + for (i = 0; i < gDisableStructs[battler].autotomizeCount; i++) { if (weight > 1000) { @@ -8351,7 +8377,7 @@ u32 GetBattlerWeight(u8 battlerId) return weight; } -u32 CountBattlerStatIncreases(u8 battlerId, bool32 countEvasionAcc) +u32 CountBattlerStatIncreases(u32 battler, bool32 countEvasionAcc) { u32 i; u32 count = 0; @@ -8360,14 +8386,14 @@ u32 CountBattlerStatIncreases(u8 battlerId, bool32 countEvasionAcc) { if ((i == STAT_ACC || i == STAT_EVASION) && !countEvasionAcc) continue; - if (gBattleMons[battlerId].statStages[i] > DEFAULT_STAT_STAGE) // Stat is increased. - count += gBattleMons[battlerId].statStages[i] - DEFAULT_STAT_STAGE; + if (gBattleMons[battler].statStages[i] > DEFAULT_STAT_STAGE) // Stat is increased. + count += gBattleMons[battler].statStages[i] - DEFAULT_STAT_STAGE; } return count; } -u32 GetMoveTargetCount(u16 move, u8 battlerAtk, u8 battlerDef) +u32 GetMoveTargetCount(u32 move, u32 battlerAtk, u32 battlerDef) { switch (GetBattlerMoveTargetType(gBattlerAttacker, move)) { @@ -8392,16 +8418,6 @@ u32 GetMoveTargetCount(u16 move, u8 battlerAtk, u8 battlerDef) } } -void MulModifier(u16 *modifier, u16 val) -{ - *modifier = UQ_4_12_TO_INT((*modifier * val) + UQ_4_12_ROUND); -} - -static u32 ApplyModifier(u16 modifier, u32 val) -{ - return UQ_4_12_TO_INT((modifier * val) + UQ_4_12_ROUND); -} - static const u8 sFlailHpScaleToPowerTable[] = { 1, 200, @@ -8516,10 +8532,10 @@ u32 CalcFuryCutterBasePower(u32 basePower, u32 furyCutterCounter) return basePower; } -static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) +static inline u32 CalcMoveBasePower(u32 move, u32 battlerAtk, u32 battlerDef, u32 abilityDef, u32 weather) { u32 i; - u16 basePower = gBattleMoves[move].power; + u32 basePower = gBattleMoves[move].power; u32 weight, hpFraction, speed; if (gBattleStruct->zmove.active) @@ -8580,7 +8596,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) basePower *= 2; break; case EFFECT_WEATHER_BALL: - if (gBattleWeather & B_WEATHER_ANY && WEATHER_HAS_EFFECT) + if (weather & B_WEATHER_ANY) basePower *= 2; break; case EFFECT_PURSUIT: @@ -8591,7 +8607,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) basePower = gNaturalGiftTable[ITEM_TO_BERRY(gBattleMons[battlerAtk].item)].power; break; case EFFECT_WAKE_UP_SLAP: - if (gBattleMons[battlerDef].status1 & STATUS1_SLEEP || GetBattlerAbility(battlerDef) == ABILITY_COMATOSE) + if (gBattleMons[battlerDef].status1 & STATUS1_SLEEP || abilityDef == ABILITY_COMATOSE) basePower *= 2; break; case EFFECT_SMELLINGSALT: @@ -8602,7 +8618,8 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) basePower = 120 * gBattleMons[battlerDef].hp / gBattleMons[battlerDef].maxHP; break; case EFFECT_HEX: - if (gBattleMons[battlerDef].status1 & STATUS1_ANY || GetBattlerAbility(battlerDef) == ABILITY_COMATOSE) + case EFFECT_INFERNAL_PARADE: + if (gBattleMons[battlerDef].status1 & STATUS1_ANY || abilityDef == ABILITY_COMATOSE) basePower *= 2; break; case EFFECT_ASSURANCE: @@ -8610,8 +8627,8 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) basePower *= 2; break; case EFFECT_TRUMP_CARD: - i = GetBattleMonMoveSlot(&gBattleMons[battlerAtk], move); - if (i != 4) + i = GetMoveSlot(gBattleMons[battlerAtk].moves, move); + if (i != MAX_MON_MOVES) { if (gBattleMons[battlerAtk].pp[i] >= ARRAY_COUNT(sTrumpCardPowerTable)) basePower = sTrumpCardPowerTable[ARRAY_COUNT(sTrumpCardPowerTable) - 1]; @@ -8705,7 +8722,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) break; case EFFECT_EXPLOSION: if (move == MOVE_MISTY_EXPLOSION && gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN && IsBattlerGrounded(battlerAtk)) - MulModifier(&basePower, UQ_4_12(1.5)); + basePower = uq4_12_multiply(basePower, UQ_4_12(1.5)); break; case EFFECT_DYNAMAX_DOUBLE_DMG: #ifdef B_DYNAMAX @@ -8731,7 +8748,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) } case EFFECT_GRAV_APPLE: if (gFieldStatuses & STATUS_FIELD_GRAVITY) - MulModifier(&basePower, UQ_4_12(1.5)); + basePower = uq4_12_multiply(basePower, UQ_4_12(1.5)); break; case EFFECT_TERRAIN_PULSE: if ((gFieldStatuses & STATUS_FIELD_TERRAIN_ANY) @@ -8740,7 +8757,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) break; case EFFECT_EXPANDING_FORCE: if (IsBattlerTerrainAffected(battlerAtk, STATUS_FIELD_PSYCHIC_TERRAIN)) - MulModifier(&basePower, UQ_4_12(1.5)); + basePower = uq4_12_multiply(basePower, UQ_4_12(1.5)); break; case EFFECT_RISING_VOLTAGE: if (IsBattlerTerrainAffected(battlerDef, STATUS_FIELD_ELECTRIC_TERRAIN)) @@ -8753,7 +8770,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) break; case EFFECT_PSYBLADE: if (IsBattlerTerrainAffected(battlerAtk, STATUS_FIELD_ELECTRIC_TERRAIN)) - MulModifier(&basePower, UQ_4_12(1.5)); + basePower = uq4_12_multiply(basePower, UQ_4_12(1.5)); break; } @@ -8771,129 +8788,206 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) return basePower; } -static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, bool32 updateFlags) +static inline u32 CalcMoveBasePowerAfterModifiers(u32 move, u32 battlerAtk, u32 battlerDef, u32 moveType, bool32 updateFlags, u32 atkAbility, u32 defAbility, u32 holdEffectAtk, u32 weather) { u32 i; - u32 holdEffectAtk, holdEffectParamAtk; - u16 basePower = CalcMoveBasePower(move, battlerAtk, battlerDef); - u16 holdEffectModifier; - u16 modifier = UQ_4_12(1.0); - u32 atkSide = GET_BATTLER_SIDE(battlerAtk); - u16 atkAbility = GetBattlerAbility(battlerAtk); - u16 defAbility = GetBattlerAbility(battlerDef); + u32 holdEffectParamAtk; + u32 basePower = CalcMoveBasePower(move, battlerAtk, battlerDef, defAbility, weather); + uq4_12_t holdEffectModifier; + uq4_12_t modifier = UQ_4_12(1.0); + u32 atkSide = GetBattlerSide(battlerAtk); - // attacker's abilities - switch (atkAbility) + // move effect + switch (gBattleMoves[move].effect) { - case ABILITY_TECHNICIAN: - if (basePower <= 60) - MulModifier(&modifier, UQ_4_12(1.5)); - break; - case ABILITY_FLARE_BOOST: - if (gBattleMons[battlerAtk].status1 & STATUS1_BURN && IS_MOVE_SPECIAL(move)) - MulModifier(&modifier, UQ_4_12(1.5)); + case EFFECT_FACADE: + if (gBattleMons[battlerAtk].status1 & (STATUS1_BURN | STATUS1_PSN_ANY | STATUS1_PARALYSIS | STATUS1_FROSTBITE)) + modifier = uq4_12_multiply(modifier, UQ_4_12(2.0)); break; - case ABILITY_TOXIC_BOOST: - if (gBattleMons[battlerAtk].status1 & STATUS1_PSN_ANY && IS_MOVE_PHYSICAL(move)) - MulModifier(&modifier, UQ_4_12(1.5)); + case EFFECT_BRINE: + if (gBattleMons[battlerDef].hp <= (gBattleMons[battlerDef].maxHP / 2)) + modifier = uq4_12_multiply(modifier, UQ_4_12(2.0)); break; - case ABILITY_RECKLESS: - if (gBattleMoves[move].flags & FLAG_RECKLESS_BOOST) - MulModifier(&modifier, UQ_4_12(1.2)); + case EFFECT_BARB_BARRAGE: + case EFFECT_VENOSHOCK: + if (gBattleMons[battlerDef].status1 & STATUS1_PSN_ANY) + modifier = uq4_12_multiply(modifier, UQ_4_12(2.0)); break; - case ABILITY_IRON_FIST: - if (gBattleMoves[move].flags & FLAG_IRON_FIST_BOOST) - MulModifier(&modifier, UQ_4_12(1.2)); + case EFFECT_RETALIATE: + if (gSideTimers[atkSide].retaliateTimer == 1) + modifier = uq4_12_multiply(modifier, UQ_4_12(2.0)); break; - case ABILITY_SHEER_FORCE: - if (gBattleMoves[move].flags & FLAG_SHEER_FORCE_BOOST) - MulModifier(&modifier, UQ_4_12(1.3)); + case EFFECT_SOLAR_BEAM: + if (IsBattlerWeatherAffected(battlerAtk, (B_WEATHER_HAIL | B_WEATHER_SANDSTORM | B_WEATHER_RAIN | B_WEATHER_SNOW))) + modifier = uq4_12_multiply(modifier, UQ_4_12(0.5)); break; - case ABILITY_SAND_FORCE: - if ((moveType == TYPE_STEEL || moveType == TYPE_ROCK || moveType == TYPE_GROUND) - && gBattleWeather & B_WEATHER_SANDSTORM && WEATHER_HAS_EFFECT) - MulModifier(&modifier, UQ_4_12(1.3)); + case EFFECT_STOMPING_TANTRUM: + if (gBattleStruct->lastMoveFailed & gBitTable[battlerAtk]) + modifier = uq4_12_multiply(modifier, UQ_4_12(2.0)); break; - case ABILITY_RIVALRY: - if (AreBattlersOfOppositeGender(battlerAtk, battlerDef)) - MulModifier(&modifier, UQ_4_12(1.25)); + case EFFECT_BULLDOZE: + case EFFECT_MAGNITUDE: + case EFFECT_EARTHQUAKE: + if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN && !(gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE)) + modifier = uq4_12_multiply(modifier, UQ_4_12(0.5)); + break; + case EFFECT_KNOCK_OFF: + #if B_KNOCK_OFF_DMG >= GEN_6 + if (gBattleMons[battlerDef].item != ITEM_NONE + && CanBattlerGetOrLoseItem(battlerDef, gBattleMons[battlerDef].item)) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); + #endif + break; + } + +#if B_TERRAIN_TYPE_BOOST >= GEN_8 + #define TERRAIN_TYPE_BOOST UQ_4_12(1.3) +#else + #define TERRAIN_TYPE_BOOST UQ_4_12(1.5) +#endif + + // various effects + if (gProtectStructs[battlerAtk].helpingHand) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); + if (gSpecialStatuses[battlerAtk].gemBoost) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.0) + sPercentToModifier[gSpecialStatuses[battlerAtk].gemParam]); + if (gStatuses3[battlerAtk] & STATUS3_CHARGED_UP && moveType == TYPE_ELECTRIC) + modifier = uq4_12_multiply(modifier, UQ_4_12(2.0)); + if (gStatuses3[battlerAtk] & STATUS3_ME_FIRST) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); + if (IsBattlerTerrainAffected(battlerAtk, STATUS_FIELD_GRASSY_TERRAIN) && moveType == TYPE_GRASS) + modifier = uq4_12_multiply(modifier, TERRAIN_TYPE_BOOST); + if (IsBattlerTerrainAffected(battlerDef, STATUS_FIELD_MISTY_TERRAIN) && moveType == TYPE_DRAGON) + modifier = uq4_12_multiply(modifier, UQ_4_12(0.5)); + if (IsBattlerTerrainAffected(battlerAtk, STATUS_FIELD_ELECTRIC_TERRAIN) && moveType == TYPE_ELECTRIC) + modifier = uq4_12_multiply(modifier, TERRAIN_TYPE_BOOST); + if (IsBattlerTerrainAffected(battlerAtk, STATUS_FIELD_PSYCHIC_TERRAIN) && moveType == TYPE_PSYCHIC) + modifier = uq4_12_multiply(modifier, TERRAIN_TYPE_BOOST); + #if B_SPORT_TURNS >= GEN_6 + if ((moveType == TYPE_ELECTRIC && gFieldStatuses & STATUS_FIELD_MUDSPORT) + || (moveType == TYPE_FIRE && gFieldStatuses & STATUS_FIELD_WATERSPORT)) + #else + if ((moveType == TYPE_ELECTRIC && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, ABILITYEFFECT_MUD_SPORT, 0)) + || (moveType == TYPE_FIRE && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, ABILITYEFFECT_WATER_SPORT, 0))) + #endif + #if B_SPORT_DMG_REDUCTION >= GEN_5 + modifier = uq4_12_multiply(modifier, UQ_4_12(0.23)); + #else + modifier = uq4_12_multiply(modifier, UQ_4_12(0.5)); + #endif + + // attacker's abilities + switch (atkAbility) + { + case ABILITY_TECHNICIAN: + if (basePower <= 60) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); + break; + case ABILITY_FLARE_BOOST: + if (gBattleMons[battlerAtk].status1 & STATUS1_BURN && IS_MOVE_SPECIAL(move)) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); + break; + case ABILITY_TOXIC_BOOST: + if (gBattleMons[battlerAtk].status1 & STATUS1_PSN_ANY && IS_MOVE_PHYSICAL(move)) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); + break; + case ABILITY_RECKLESS: + if (IS_MOVE_RECOIL(move)) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.2)); + break; + case ABILITY_IRON_FIST: + if (gBattleMoves[move].punchingMove) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.2)); + break; + case ABILITY_SHEER_FORCE: + if (gBattleMoves[move].sheerForceBoost) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.3)); + break; + case ABILITY_SAND_FORCE: + if ((moveType == TYPE_STEEL || moveType == TYPE_ROCK || moveType == TYPE_GROUND) + && weather & B_WEATHER_SANDSTORM) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.3)); + break; + case ABILITY_RIVALRY: + if (AreBattlersOfOppositeGender(battlerAtk, battlerDef)) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.25)); else - MulModifier(&modifier, UQ_4_12(0.75)); + modifier = uq4_12_multiply(modifier, UQ_4_12(0.75)); break; case ABILITY_ANALYTIC: if (GetBattlerTurnOrderNum(battlerAtk) == gBattlersCount - 1 && move != MOVE_FUTURE_SIGHT && move != MOVE_DOOM_DESIRE) - MulModifier(&modifier, UQ_4_12(1.3)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.3)); break; case ABILITY_TOUGH_CLAWS: if (IsMoveMakingContact(move, battlerAtk)) - MulModifier(&modifier, UQ_4_12(1.3)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.3)); break; case ABILITY_STRONG_JAW: - if (gBattleMoves[move].flags & FLAG_STRONG_JAW_BOOST) - MulModifier(&modifier, UQ_4_12(1.5)); + if (gBattleMoves[move].bitingMove) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); break; case ABILITY_MEGA_LAUNCHER: - if (gBattleMoves[move].flags & FLAG_MEGA_LAUNCHER_BOOST) - MulModifier(&modifier, UQ_4_12(1.5)); + if (gBattleMoves[move].pulseMove) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); break; case ABILITY_WATER_BUBBLE: if (moveType == TYPE_WATER) - MulModifier(&modifier, UQ_4_12(2.0)); + modifier = uq4_12_multiply(modifier, UQ_4_12(2.0)); break; case ABILITY_STEELWORKER: if (moveType == TYPE_STEEL) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); break; case ABILITY_PIXILATE: if (moveType == TYPE_FAIRY && gBattleStruct->ateBoost[battlerAtk]) - MulModifier(&modifier, UQ_4_12(1.2)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.2)); break; case ABILITY_GALVANIZE: if (moveType == TYPE_ELECTRIC && gBattleStruct->ateBoost[battlerAtk]) - MulModifier(&modifier, UQ_4_12(1.2)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.2)); break; case ABILITY_REFRIGERATE: if (moveType == TYPE_ICE && gBattleStruct->ateBoost[battlerAtk]) - MulModifier(&modifier, UQ_4_12(1.2)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.2)); break; case ABILITY_AERILATE: if (moveType == TYPE_FLYING && gBattleStruct->ateBoost[battlerAtk]) - MulModifier(&modifier, UQ_4_12(1.2)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.2)); break; case ABILITY_NORMALIZE: if (moveType == TYPE_NORMAL && gBattleStruct->ateBoost[battlerAtk]) - MulModifier(&modifier, UQ_4_12(1.2)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.2)); break; case ABILITY_PUNK_ROCK: - if (gBattleMoves[move].flags & FLAG_SOUND) - MulModifier(&modifier, UQ_4_12(1.3)); + if (gBattleMoves[move].soundMove) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.3)); break; case ABILITY_STEELY_SPIRIT: if (moveType == TYPE_STEEL) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); break; case ABILITY_TRANSISTOR: if (moveType == TYPE_ELECTRIC) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); break; case ABILITY_DRAGONS_MAW: if (moveType == TYPE_DRAGON) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); break; case ABILITY_GORILLA_TACTICS: if (IS_MOVE_PHYSICAL(move)) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); break; case ABILITY_ROCKY_PAYLOAD: if (moveType == TYPE_ROCK) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); break; case ABILITY_PROTOSYNTHESIS: { u8 atkHighestStat = GetHighestStatId(battlerAtk); - if (gBattleWeather & B_WEATHER_SUN && WEATHER_HAS_EFFECT + if (weather & B_WEATHER_SUN && ((IS_MOVE_PHYSICAL(move) && atkHighestStat == STAT_ATK) || (IS_MOVE_SPECIAL(move) && atkHighestStat == STAT_SPATK))) - MulModifier(&modifier, UQ_4_12(1.3)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.3)); } break; case ABILITY_QUARK_DRIVE: @@ -8901,23 +8995,23 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe u8 atkHighestStat = GetHighestStatId(battlerAtk); if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN && ((IS_MOVE_PHYSICAL(move) && atkHighestStat == STAT_ATK) || (IS_MOVE_SPECIAL(move) && atkHighestStat == STAT_SPATK))) - MulModifier(&modifier, UQ_4_12(1.3)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.3)); } break; case ABILITY_ORICHALCUM_PULSE: - if (gBattleWeather & B_WEATHER_SUN && WEATHER_HAS_EFFECT) - MulModifier(&modifier, UQ_4_12(1.3)); + if (weather & B_WEATHER_SUN) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.3)); break; case ABILITY_HADRON_ENGINE: if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN) - MulModifier(&modifier, UQ_4_12(1.3)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.3)); break; case ABILITY_SHARPNESS: - if (gBattleMoves[move].flags & FLAG_SLICING_MOVE) - MulModifier(&modifier, UQ_4_12(1.5)); + if (gBattleMoves[move].slicingMove) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); break; case ABILITY_SUPREME_OVERLORD: - MulModifier(&modifier, gBattleStruct->supremeOverlordModifier[battlerAtk]); + modifier = uq4_12_multiply(modifier, gBattleStruct->supremeOverlordModifier[battlerAtk]); break; } @@ -8926,22 +9020,22 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe || (IsAbilityOnField(ABILITY_FAIRY_AURA) && moveType == TYPE_FAIRY)) { if (IsAbilityOnField(ABILITY_AURA_BREAK)) - MulModifier(&modifier, UQ_4_12(0.75)); + modifier = uq4_12_multiply(modifier, UQ_4_12(0.75)); else - MulModifier(&modifier, UQ_4_12(1.33)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.33)); } if (IsAbilityOnField(ABILITY_VESSEL_OF_RUIN) && atkAbility != ABILITY_VESSEL_OF_RUIN && IS_MOVE_SPECIAL(gCurrentMove)) - MulModifier(&modifier, UQ_4_12(0.75)); + modifier = uq4_12_multiply(modifier, UQ_4_12(0.75)); if (IsAbilityOnField(ABILITY_SWORD_OF_RUIN) && defAbility != ABILITY_SWORD_OF_RUIN && IS_MOVE_PHYSICAL(gCurrentMove)) - MulModifier(&modifier, UQ_4_12(1.25)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.25)); if (IsAbilityOnField(ABILITY_TABLETS_OF_RUIN) && atkAbility != ABILITY_TABLETS_OF_RUIN && IS_MOVE_PHYSICAL(gCurrentMove)) - MulModifier(&modifier, UQ_4_12(0.75)); + modifier = uq4_12_multiply(modifier, UQ_4_12(0.75)); if (IsAbilityOnField(ABILITY_BEADS_OF_RUIN) && defAbility != ABILITY_BEADS_OF_RUIN && IS_MOVE_SPECIAL(gCurrentMove)) - MulModifier(&modifier, UQ_4_12(1.25)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.25)); // attacker partner's abilities if (IsBattlerAlive(BATTLE_PARTNER(battlerAtk))) @@ -8950,14 +9044,14 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe { case ABILITY_BATTERY: if (IS_MOVE_SPECIAL(move)) - MulModifier(&modifier, UQ_4_12(1.3)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.3)); break; case ABILITY_POWER_SPOT: - MulModifier(&modifier, UQ_4_12(1.3)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.3)); break; case ABILITY_STEELY_SPIRIT: if (moveType == TYPE_STEEL) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); break; } } @@ -8969,31 +9063,21 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe case ABILITY_WATER_BUBBLE: if (moveType == TYPE_FIRE) { - MulModifier(&modifier, UQ_4_12(0.5)); + modifier = uq4_12_multiply(modifier, UQ_4_12(0.5)); if (updateFlags) RecordAbilityBattle(battlerDef, defAbility); } break; case ABILITY_DRY_SKIN: if (moveType == TYPE_FIRE) - MulModifier(&modifier, UQ_4_12(1.25)); - break; - case ABILITY_FLUFFY: - if (IsMoveMakingContact(move, battlerAtk)) - { - MulModifier(&modifier, UQ_4_12(0.5)); - if (updateFlags) - RecordAbilityBattle(battlerDef, defAbility); - } - if (moveType == TYPE_FIRE) - MulModifier(&modifier, UQ_4_12(2.0)); + modifier = uq4_12_multiply(modifier, UQ_4_12(1.25)); break; case ABILITY_PROTOSYNTHESIS: { u8 defHighestStat = GetHighestStatId(battlerDef); - if (gBattleWeather & B_WEATHER_SUN && WEATHER_HAS_EFFECT + if (weather & B_WEATHER_SUN && ((IS_MOVE_PHYSICAL(move) && defHighestStat == STAT_DEF) || (IS_MOVE_SPECIAL(move) && defHighestStat == STAT_SPDEF))) - MulModifier(&modifier, UQ_4_12(0.7)); + modifier = uq4_12_multiply(modifier, UQ_4_12(0.7)); } break; case ABILITY_QUARK_DRIVE: @@ -9001,12 +9085,11 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe u8 defHighestStat = GetHighestStatId(battlerDef); if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN && ((IS_MOVE_PHYSICAL(move) && defHighestStat == STAT_DEF) || (IS_MOVE_SPECIAL(move) && defHighestStat == STAT_SPDEF))) - MulModifier(&modifier, UQ_4_12(0.7)); + modifier = uq4_12_multiply(modifier, UQ_4_12(0.7)); } break; } - holdEffectAtk = GetBattlerHoldEffect(battlerAtk, TRUE); holdEffectParamAtk = GetBattlerHoldEffectParam(battlerAtk); if (holdEffectParamAtk > 100) holdEffectParamAtk = 100; @@ -9018,23 +9101,23 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe { case HOLD_EFFECT_MUSCLE_BAND: if (IS_MOVE_PHYSICAL(move)) - MulModifier(&modifier, holdEffectModifier); + modifier = uq4_12_multiply(modifier, holdEffectModifier); break; case HOLD_EFFECT_WISE_GLASSES: if (IS_MOVE_SPECIAL(move)) - MulModifier(&modifier, holdEffectModifier); + modifier = uq4_12_multiply(modifier, holdEffectModifier); break; case HOLD_EFFECT_LUSTROUS_ORB: if (GET_BASE_SPECIES_ID(gBattleMons[battlerAtk].species) == SPECIES_PALKIA && (moveType == TYPE_WATER || moveType == TYPE_DRAGON)) - MulModifier(&modifier, holdEffectModifier); + modifier = uq4_12_multiply(modifier, holdEffectModifier); break; case HOLD_EFFECT_ADAMANT_ORB: if (GET_BASE_SPECIES_ID(gBattleMons[battlerAtk].species) == SPECIES_DIALGA && (moveType == TYPE_STEEL || moveType == TYPE_DRAGON)) - MulModifier(&modifier, holdEffectModifier); + modifier = uq4_12_multiply(modifier, holdEffectModifier); break; case HOLD_EFFECT_GRISEOUS_ORB: if (GET_BASE_SPECIES_ID(gBattleMons[battlerAtk].species) == SPECIES_GIRATINA && (moveType == TYPE_GHOST || moveType == TYPE_DRAGON)) - MulModifier(&modifier, holdEffectModifier); + modifier = uq4_12_multiply(modifier, holdEffectModifier); break; case HOLD_EFFECT_SOUL_DEW: #if B_SOUL_DEW_BOOST >= GEN_7 @@ -9042,7 +9125,7 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe #else if ((gBattleMons[battlerAtk].species == SPECIES_LATIAS || gBattleMons[battlerAtk].species == SPECIES_LATIOS) && !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER) && IS_MOVE_SPECIAL(move)) #endif - MulModifier(&modifier, holdEffectModifier); + modifier = uq4_12_multiply(modifier, holdEffectModifier); break; case HOLD_EFFECT_BUG_POWER: case HOLD_EFFECT_STEEL_POWER: @@ -9067,108 +9150,29 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe if (holdEffectAtk == sHoldEffectToType[i][0]) { if (moveType == sHoldEffectToType[i][1]) - MulModifier(&modifier, holdEffectModifier); + modifier = uq4_12_multiply(modifier, holdEffectModifier); break; } } break; case HOLD_EFFECT_PLATE: if (moveType == ItemId_GetSecondaryId(gBattleMons[battlerAtk].item)) - MulModifier(&modifier, holdEffectModifier); + modifier = uq4_12_multiply(modifier, holdEffectModifier); break; case HOLD_EFFECT_PUNCHING_GLOVE: - if (gBattleMoves[move].flags & FLAG_IRON_FIST_BOOST) - MulModifier(&modifier, UQ_4_12(1.1)); - break; - } - - // move effect - switch (gBattleMoves[move].effect) - { - case EFFECT_FACADE: - if (gBattleMons[battlerAtk].status1 & (STATUS1_BURN | STATUS1_PSN_ANY | STATUS1_PARALYSIS | STATUS1_FROSTBITE)) - MulModifier(&modifier, UQ_4_12(2.0)); - break; - case EFFECT_BRINE: - if (gBattleMons[battlerDef].hp <= (gBattleMons[battlerDef].maxHP / 2)) - MulModifier(&modifier, UQ_4_12(2.0)); - break; - case EFFECT_BARB_BARRAGE: - case EFFECT_VENOSHOCK: - if (gBattleMons[battlerDef].status1 & STATUS1_PSN_ANY) - MulModifier(&modifier, UQ_4_12(2.0)); - break; - case EFFECT_RETALIATE: - if (gSideTimers[atkSide].retaliateTimer == 1) - MulModifier(&modifier, UQ_4_12(2.0)); - break; - case EFFECT_SOLAR_BEAM: - if (IsBattlerWeatherAffected(battlerAtk, (B_WEATHER_HAIL | B_WEATHER_SANDSTORM | B_WEATHER_RAIN | B_WEATHER_SNOW))) - MulModifier(&modifier, UQ_4_12(0.5)); - break; - case EFFECT_STOMPING_TANTRUM: - if (gBattleStruct->lastMoveFailed & gBitTable[battlerAtk]) - MulModifier(&modifier, UQ_4_12(2.0)); - break; - case EFFECT_BULLDOZE: - case EFFECT_MAGNITUDE: - case EFFECT_EARTHQUAKE: - if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN && !(gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE)) - MulModifier(&modifier, UQ_4_12(0.5)); - break; - case EFFECT_KNOCK_OFF: - #if B_KNOCK_OFF_DMG >= GEN_6 - if (gBattleMons[battlerDef].item != ITEM_NONE - && CanBattlerGetOrLoseItem(battlerDef, gBattleMons[battlerDef].item)) - MulModifier(&modifier, UQ_4_12(1.5)); - #endif + if (gBattleMoves[move].punchingMove) + modifier = uq4_12_multiply(modifier, UQ_4_12(1.1)); break; } - -#if B_TERRAIN_TYPE_BOOST >= GEN_8 - #define TERRAIN_TYPE_BOOST UQ_4_12(1.3) -#else - #define TERRAIN_TYPE_BOOST UQ_4_12(1.5) -#endif - - // various effects - if (gProtectStructs[battlerAtk].helpingHand) - MulModifier(&modifier, UQ_4_12(1.5)); - if (gSpecialStatuses[battlerAtk].gemBoost) - MulModifier(&modifier, UQ_4_12(1.0) + sPercentToModifier[gSpecialStatuses[battlerAtk].gemParam]); - if (gStatuses3[battlerAtk] & STATUS3_CHARGED_UP && moveType == TYPE_ELECTRIC) - MulModifier(&modifier, UQ_4_12(2.0)); - if (gStatuses3[battlerAtk] & STATUS3_ME_FIRST) - MulModifier(&modifier, UQ_4_12(1.5)); - if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN && moveType == TYPE_GRASS && IsBattlerGrounded(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_SEMI_INVULNERABLE)) - MulModifier(&modifier, TERRAIN_TYPE_BOOST); - if (gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN && moveType == TYPE_DRAGON && IsBattlerGrounded(battlerDef) && !(gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE)) - MulModifier(&modifier, UQ_4_12(0.5)); - if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN && moveType == TYPE_ELECTRIC && IsBattlerGrounded(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_SEMI_INVULNERABLE)) - MulModifier(&modifier, TERRAIN_TYPE_BOOST); - if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN && moveType == TYPE_PSYCHIC && IsBattlerGrounded(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_SEMI_INVULNERABLE)) - MulModifier(&modifier, TERRAIN_TYPE_BOOST); - #if B_SPORT_TURNS >= GEN_6 - if ((moveType == TYPE_ELECTRIC && gFieldStatuses & STATUS_FIELD_MUDSPORT) - || (moveType == TYPE_FIRE && gFieldStatuses & STATUS_FIELD_WATERSPORT)) - #else - if ((moveType == TYPE_ELECTRIC && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, ABILITYEFFECT_MUD_SPORT, 0)) - || (moveType == TYPE_FIRE && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, ABILITYEFFECT_WATER_SPORT, 0))) - #endif - #if B_SPORT_DMG_REDUCTION >= GEN_5 - MulModifier(&modifier, UQ_4_12(0.23)); - #else - MulModifier(&modifier, UQ_4_12(0.5)); - #endif - return ApplyModifier(modifier, basePower); + return uq4_12_multiply_by_int_half_down(modifier, basePower); } #undef TERRAIN_TYPE_BOOST -static u32 CalcAttackStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, bool32 isCrit, bool32 updateFlags) +static inline u32 CalcAttackStat(u32 move, u32 battlerAtk, u32 battlerDef, u32 moveType, bool32 isCrit, bool32 updateFlags, u32 atkAbility, u32 defAbility, u32 holdEffectAtk) { u8 atkStage; u32 atkStat; - u16 modifier; + uq4_12_t modifier; u16 atkBaseSpeciesId; atkBaseSpeciesId = GET_BASE_SPECIES_ID(gBattleMons[battlerAtk].species); @@ -9209,7 +9213,7 @@ static u32 CalcAttackStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, b if (isCrit && atkStage < DEFAULT_STAT_STAGE) atkStage = DEFAULT_STAT_STAGE; // pokemon with unaware ignore attack stat changes while taking damage - if (GetBattlerAbility(battlerDef) == ABILITY_UNAWARE) + if (defAbility == ABILITY_UNAWARE) atkStage = DEFAULT_STAT_STAGE; atkStat *= gStatStageRatios[atkStage][0]; @@ -9219,44 +9223,44 @@ static u32 CalcAttackStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, b modifier = UQ_4_12(1.0); // attacker's abilities - switch (GetBattlerAbility(battlerAtk)) + switch (atkAbility) { case ABILITY_HUGE_POWER: case ABILITY_PURE_POWER: if (IS_MOVE_PHYSICAL(move)) - MulModifier(&modifier, UQ_4_12(2.0)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(2.0)); break; case ABILITY_SLOW_START: if (gDisableStructs[battlerAtk].slowStartTimer != 0) - MulModifier(&modifier, UQ_4_12(0.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(0.5)); break; case ABILITY_SOLAR_POWER: if (IS_MOVE_SPECIAL(move) && IsBattlerWeatherAffected(battlerAtk, B_WEATHER_SUN)) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); break; case ABILITY_DEFEATIST: if (gBattleMons[battlerAtk].hp <= (gBattleMons[battlerAtk].maxHP / 2)) - MulModifier(&modifier, UQ_4_12(0.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(0.5)); break; case ABILITY_FLASH_FIRE: if (moveType == TYPE_FIRE && gBattleResources->flags->flags[battlerAtk] & RESOURCE_FLAG_FLASH_FIRE) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); break; case ABILITY_SWARM: if (moveType == TYPE_BUG && gBattleMons[battlerAtk].hp <= (gBattleMons[battlerAtk].maxHP / 3)) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); break; case ABILITY_TORRENT: if (moveType == TYPE_WATER && gBattleMons[battlerAtk].hp <= (gBattleMons[battlerAtk].maxHP / 3)) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); break; case ABILITY_BLAZE: if (moveType == TYPE_FIRE && gBattleMons[battlerAtk].hp <= (gBattleMons[battlerAtk].maxHP / 3)) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); break; case ABILITY_OVERGROW: if (moveType == TYPE_GRASS && gBattleMons[battlerAtk].hp <= (gBattleMons[battlerAtk].maxHP / 3)) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); break; #if B_PLUS_MINUS_INTERACTION >= GEN_5 case ABILITY_PLUS: @@ -9265,52 +9269,48 @@ static u32 CalcAttackStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, b { u32 partnerAbility = GetBattlerAbility(BATTLE_PARTNER(battlerAtk)); if (partnerAbility == ABILITY_PLUS || partnerAbility == ABILITY_MINUS) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); } break; #else case ABILITY_PLUS: if (IS_MOVE_SPECIAL(move) && IsBattlerAlive(BATTLE_PARTNER(battlerAtk)) && GetBattlerAbility(BATTLE_PARTNER(battlerAtk)) == ABILITY_MINUS) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); break; case ABILITY_MINUS: if (IS_MOVE_SPECIAL(move) && IsBattlerAlive(BATTLE_PARTNER(battlerAtk)) && GetBattlerAbility(BATTLE_PARTNER(battlerAtk)) == ABILITY_PLUS) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); break; #endif case ABILITY_FLOWER_GIFT: if (gBattleMons[battlerAtk].species == SPECIES_CHERRIM_SUNSHINE && IsBattlerWeatherAffected(battlerAtk, B_WEATHER_SUN) && IS_MOVE_PHYSICAL(move)) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); break; case ABILITY_HUSTLE: if (IS_MOVE_PHYSICAL(move)) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); break; case ABILITY_STAKEOUT: if (gDisableStructs[battlerDef].isFirstTurn == 2) // just switched in - MulModifier(&modifier, UQ_4_12(2.0)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(2.0)); break; case ABILITY_GUTS: if (gBattleMons[battlerAtk].status1 & STATUS1_ANY && IS_MOVE_PHYSICAL(move)) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); break; } // target's abilities - switch (GetBattlerAbility(battlerDef)) + switch (defAbility) { case ABILITY_THICK_FAT: if (moveType == TYPE_FIRE || moveType == TYPE_ICE) { - MulModifier(&modifier, UQ_4_12(0.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(0.5)); if (updateFlags) RecordAbilityBattle(battlerDef, ABILITY_THICK_FAT); } break; - case ABILITY_ICE_SCALES: - if (IS_MOVE_SPECIAL(move)) - MulModifier(&modifier, UQ_4_12(0.5)); - break; } // ally's abilities @@ -9320,44 +9320,44 @@ static u32 CalcAttackStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, b { case ABILITY_FLOWER_GIFT: if (gBattleMons[BATTLE_PARTNER(battlerAtk)].species == SPECIES_CHERRIM_SUNSHINE && IsBattlerWeatherAffected(BATTLE_PARTNER(battlerAtk), B_WEATHER_SUN) && IS_MOVE_PHYSICAL(move)) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); break; } } // attacker's hold effect - switch (GetBattlerHoldEffect(battlerAtk, TRUE)) + switch (holdEffectAtk) { case HOLD_EFFECT_THICK_CLUB: if ((atkBaseSpeciesId == SPECIES_CUBONE || atkBaseSpeciesId == SPECIES_MAROWAK) && IS_MOVE_PHYSICAL(move)) - MulModifier(&modifier, UQ_4_12(2.0)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(2.0)); break; case HOLD_EFFECT_DEEP_SEA_TOOTH: if (gBattleMons[battlerAtk].species == SPECIES_CLAMPERL && IS_MOVE_SPECIAL(move)) - MulModifier(&modifier, UQ_4_12(2.0)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(2.0)); break; case HOLD_EFFECT_LIGHT_BALL: if (atkBaseSpeciesId == SPECIES_PIKACHU) - MulModifier(&modifier, UQ_4_12(2.0)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(2.0)); break; case HOLD_EFFECT_CHOICE_BAND: if (IS_MOVE_PHYSICAL(move)) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); break; case HOLD_EFFECT_CHOICE_SPECS: if (IS_MOVE_SPECIAL(move)) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); break; } // The offensive stats of a Player's Pokémon are boosted by x1.1 (+10%) if they have the 1st badge and 7th badges. // Having the 1st badge boosts physical attack while having the 7th badge boosts special attack. if (ShouldGetStatBadgeBoost(FLAG_BADGE01_GET, battlerAtk) && IS_MOVE_PHYSICAL(move)) - MulModifier(&modifier, UQ_4_12(1.1)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.1)); if (ShouldGetStatBadgeBoost(FLAG_BADGE07_GET, battlerAtk) && IS_MOVE_SPECIAL(move)) - MulModifier(&modifier, UQ_4_12(1.1)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.1)); - return ApplyModifier(modifier, atkStat); + return uq4_12_multiply_by_int_half_down(modifier, atkStat); } static bool32 CanEvolve(u32 species) @@ -9372,12 +9372,12 @@ static bool32 CanEvolve(u32 species) return FALSE; } -static u32 CalcDefenseStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, bool32 isCrit, bool32 updateFlags) +static inline u32 CalcDefenseStat(u32 move, u32 battlerAtk, u32 battlerDef, u32 moveType, bool32 isCrit, bool32 updateFlags, u32 atkAbility, u32 defAbility, u32 holdEffectDef, u32 weather) { bool32 usesDefStat; u8 defStage; u32 defStat, def, spDef; - u16 modifier; + uq4_12_t modifier; if (gFieldStatuses & STATUS_FIELD_WONDER_ROOM) // the defense stats are swapped { @@ -9413,10 +9413,10 @@ static u32 CalcDefenseStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, if (isCrit && defStage > DEFAULT_STAT_STAGE) defStage = DEFAULT_STAT_STAGE; // pokemon with unaware ignore defense stat changes while dealing damage - if (GetBattlerAbility(battlerAtk) == ABILITY_UNAWARE) + if (atkAbility == ABILITY_UNAWARE) defStage = DEFAULT_STAT_STAGE; // certain moves also ignore stat changes - if (gBattleMoves[move].flags & FLAG_STAT_STAGES_IGNORED) + if (gBattleMoves[move].ignoresTargetDefenseEvasionStages) defStage = DEFAULT_STAT_STAGE; defStat *= gStatStageRatios[defStage][0]; @@ -9426,12 +9426,12 @@ static u32 CalcDefenseStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, modifier = UQ_4_12(1.0); // target's abilities - switch (GetBattlerAbility(battlerDef)) + switch (defAbility) { case ABILITY_MARVEL_SCALE: if (gBattleMons[battlerDef].status1 & STATUS1_ANY && usesDefStat) { - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); if (updateFlags) RecordAbilityBattle(battlerDef, ABILITY_MARVEL_SCALE); } @@ -9439,7 +9439,7 @@ static u32 CalcDefenseStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, case ABILITY_FUR_COAT: if (usesDefStat) { - MulModifier(&modifier, UQ_4_12(2.0)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(2.0)); if (updateFlags) RecordAbilityBattle(battlerDef, ABILITY_FUR_COAT); } @@ -9447,22 +9447,18 @@ static u32 CalcDefenseStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, case ABILITY_GRASS_PELT: if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN && usesDefStat) { - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); if (updateFlags) RecordAbilityBattle(battlerDef, ABILITY_GRASS_PELT); } break; case ABILITY_FLOWER_GIFT: if (gBattleMons[battlerDef].species == SPECIES_CHERRIM_SUNSHINE && IsBattlerWeatherAffected(battlerDef, B_WEATHER_SUN) && !usesDefStat) - MulModifier(&modifier, UQ_4_12(1.5)); - break; - case ABILITY_PUNK_ROCK: - if (gBattleMoves[move].flags & FLAG_SOUND) - MulModifier(&modifier, UQ_4_12(2.0)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); break; case ABILITY_PURIFYING_SALT: if (gBattleMoves[move].type == TYPE_GHOST) - MulModifier(&modifier, UQ_4_12(2.0)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(2.0)); break; } @@ -9473,292 +9469,451 @@ static u32 CalcDefenseStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, { case ABILITY_FLOWER_GIFT: if (gBattleMons[BATTLE_PARTNER(battlerDef)].species == SPECIES_CHERRIM_SUNSHINE && IsBattlerWeatherAffected(BATTLE_PARTNER(battlerDef), B_WEATHER_SUN) && !usesDefStat) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); break; } } // target's hold effects - switch (GetBattlerHoldEffect(battlerDef, TRUE)) + switch (holdEffectDef) { case HOLD_EFFECT_DEEP_SEA_SCALE: if (gBattleMons[battlerDef].species == SPECIES_CLAMPERL && !usesDefStat) - MulModifier(&modifier, UQ_4_12(2.0)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(2.0)); break; case HOLD_EFFECT_METAL_POWDER: if (gBattleMons[battlerDef].species == SPECIES_DITTO && usesDefStat && !(gBattleMons[battlerDef].status2 & STATUS2_TRANSFORMED)) - MulModifier(&modifier, UQ_4_12(2.0)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(2.0)); break; case HOLD_EFFECT_EVIOLITE: if (CanEvolve(gBattleMons[battlerDef].species)) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); break; case HOLD_EFFECT_ASSAULT_VEST: if (!usesDefStat) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); break; #if B_SOUL_DEW_BOOST <= GEN_6 case HOLD_EFFECT_SOUL_DEW: if ((gBattleMons[battlerDef].species == SPECIES_LATIAS || gBattleMons[battlerDef].species == SPECIES_LATIOS) && !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER) && !usesDefStat) - MulModifier(&modifier, UQ_4_12(1.5)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); break; #endif } // sandstorm sp.def boost for rock types - if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_ROCK) && gBattleWeather & B_WEATHER_SANDSTORM && WEATHER_HAS_EFFECT && !usesDefStat) - MulModifier(&modifier, UQ_4_12(1.5)); + if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_ROCK) && weather & B_WEATHER_SANDSTORM && !usesDefStat) + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); // snow def boost for ice types - if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE) && gBattleWeather & B_WEATHER_SNOW && WEATHER_HAS_EFFECT && usesDefStat) - MulModifier(&modifier, UQ_4_12(1.5)); + if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE) && weather & B_WEATHER_SNOW && usesDefStat) + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5)); // The defensive stats of a Player's Pokémon are boosted by x1.1 (+10%) if they have the 5th badge and 7th badges. // Having the 5th badge boosts physical defense while having the 7th badge boosts special defense. if (ShouldGetStatBadgeBoost(FLAG_BADGE05_GET, battlerDef) && IS_MOVE_PHYSICAL(move)) - MulModifier(&modifier, UQ_4_12(1.1)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.1)); if (ShouldGetStatBadgeBoost(FLAG_BADGE07_GET, battlerDef) && IS_MOVE_SPECIAL(move)) - MulModifier(&modifier, UQ_4_12(1.1)); + modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.1)); - return ApplyModifier(modifier, defStat); + return uq4_12_multiply_by_int_half_down(modifier, defStat); } -static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, u16 typeEffectivenessModifier, bool32 isCrit, bool32 updateFlags) +// base damage formula before adding any modifiers +static inline s32 CalculateBaseDamage(u32 power, u32 userFinalAttack, u32 level, u32 targetFinalDefense) { - u32 percentBoost; - u32 abilityAtk = GetBattlerAbility(battlerAtk); - u32 abilityDef = GetBattlerAbility(battlerDef); - u32 defSide = GET_BATTLER_SIDE(battlerDef); - u16 finalModifier = UQ_4_12(1.0); - u16 itemDef = gBattleMons[battlerDef].item; - u16 holdEffectAtk = GetBattlerHoldEffect(battlerAtk, TRUE); - u16 holdEffectDef = GetBattlerHoldEffect(battlerDef, TRUE); - - // check multiple targets in double battle - if (GetMoveTargetCount(move, battlerAtk, battlerDef) >= 2) - #if B_MULTIPLE_TARGETS_DMG >= GEN_4 - MulModifier(&finalModifier, UQ_4_12(0.75)); - #else - MulModifier(&finalModifier, UQ_4_12(0.5)); - #endif + return power * userFinalAttack * (2 * level / 5 + 2) / targetFinalDefense / 50 + 2; +} - // take type effectiveness - MulModifier(&finalModifier, typeEffectivenessModifier); +#if B_MULTIPLE_TARGETS_DMG >= GEN_4 + #define V_MULTIPLE_TARGETS_DMG UQ_4_12(0.75) +#else + #define V_MULTIPLE_TARGETS_DMG UQ_4_12(0.5) +#endif - // check crit - if (isCrit) - #if B_CRIT_MULTIPLIER >= GEN_6 - dmg = ApplyModifier(UQ_4_12(1.5), dmg); - #else - dmg = ApplyModifier(UQ_4_12(2.0), dmg); - #endif +#if B_CRIT_MULTIPLIER >= GEN_6 + #define V_CRIT_MULTIPLIER UQ_4_12(1.5) +#else + #define V_CRIT_MULTIPLIER UQ_4_12(2.0) +#endif - // check burn - if (gBattleMons[battlerAtk].status1 & STATUS1_BURN && IS_MOVE_PHYSICAL(move) - #if B_BURN_FACADE_DMG >= GEN_6 - && gBattleMoves[move].effect != EFFECT_FACADE - #endif - && abilityAtk != ABILITY_GUTS) - dmg = ApplyModifier(UQ_4_12(0.5), dmg); +#if B_BURN_FACADE_DMG >= GEN_6 + #define FACADE_PREVENTS_BURN_MALUS(move) (gBattleMoves[move].effect == EFFECT_FACADE) +#else + #define FACADE_PREVENTS_BURN_MALUS(move) (FALSE) +#endif - // check frostbite - if (gBattleMons[battlerAtk].status1 & STATUS1_FROSTBITE && IS_MOVE_SPECIAL(move) - #if B_BURN_FACADE_DMG >= GEN_6 - && gBattleMoves[move].effect != EFFECT_FACADE - #endif - && abilityAtk != ABILITY_GUTS) - dmg = ApplyModifier(UQ_4_12(0.5), dmg); +#if B_PARENTAL_BOND_DMG < GEN_7 + #define V_PARENTAL_BOND_DMG UQ_4_12(0.5) +#else + #define V_PARENTAL_BOND_DMG UQ_4_12(0.25) +#endif - // check weather - dmg = ApplyWeatherDamageMultiplier(battlerAtk, move, moveType, dmg, holdEffectAtk, holdEffectDef); +static inline uq4_12_t GetTargetDamageModifier(u32 move, u32 battlerAtk, u32 battlerDef) +{ + if (GetMoveTargetCount(move, battlerAtk, battlerDef) >= 2) + return V_MULTIPLE_TARGETS_DMG; + return UQ_4_12(1.0); +} - // check stab - if (IS_BATTLER_OF_TYPE(battlerAtk, moveType) && move != MOVE_STRUGGLE && move != MOVE_NONE) - { - if (abilityAtk == ABILITY_ADAPTABILITY) - MulModifier(&finalModifier, UQ_4_12(2.0)); - else - MulModifier(&finalModifier, UQ_4_12(1.5)); - } +static inline uq4_12_t GetParentalBondModifier(u32 battlerAtk) +{ + if (gSpecialStatuses[battlerAtk].parentalBondState != PARENTAL_BOND_2ND_HIT) + return UQ_4_12(1.0); + return V_PARENTAL_BOND_DMG; +} + +static inline uq4_12_t GetSameTypeAttackBonusModifier(u32 battlerAtk, u32 moveType, u32 move, u32 abilityAtk) +{ + if (!IS_BATTLER_OF_TYPE(battlerAtk, moveType) || move == MOVE_STRUGGLE || move == MOVE_NONE) + return UQ_4_12(1.0); + return (abilityAtk == ABILITY_ADAPTABILITY) ? UQ_4_12(2.0) : UQ_4_12(1.5); +} + +// Utility Umbrella holders take normal damage from what would be rain- and sun-weakened attacks. +static uq4_12_t GetWeatherDamageModifier(u32 battlerAtk, u32 move, u32 moveType, u32 holdEffectAtk, u32 holdEffectDef, u32 weather) +{ + if (weather == B_WEATHER_NONE) + return UQ_4_12(1.0); + if (gBattleMoves[move].effect == EFFECT_HYDRO_STEAM && (weather & B_WEATHER_SUN) && holdEffectAtk != HOLD_EFFECT_UTILITY_UMBRELLA) + return UQ_4_12(1.5); + if (holdEffectDef == HOLD_EFFECT_UTILITY_UMBRELLA) + return UQ_4_12(1.0); - // reflect, light screen, aurora veil - if (((gSideStatuses[defSide] & SIDE_STATUS_REFLECT && IS_MOVE_PHYSICAL(move)) - || (gSideStatuses[defSide] & SIDE_STATUS_LIGHTSCREEN && IS_MOVE_SPECIAL(move)) - || (gSideStatuses[defSide] & SIDE_STATUS_AURORA_VEIL)) - && abilityAtk != ABILITY_INFILTRATOR - && !(isCrit) - && !gProtectStructs[battlerAtk].confusionSelfDmg) + if (weather & B_WEATHER_RAIN) { - if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) - MulModifier(&finalModifier, UQ_4_12(0.66)); - else - MulModifier(&finalModifier, UQ_4_12(0.5)); + if (moveType != TYPE_FIRE && moveType != TYPE_WATER) + return UQ_4_12(1.0); + return (moveType == TYPE_FIRE) ? UQ_4_12(0.5) : UQ_4_12(1.5); } - - // Parental Bond Second Strike - if (gSpecialStatuses[battlerAtk].parentalBondState == PARENTAL_BOND_2ND_HIT) + if (weather & B_WEATHER_SUN) { - if (B_PARENTAL_BOND_DMG < GEN_7) - MulModifier(&finalModifier, UQ_4_12(0.5)); - else - MulModifier(&finalModifier, UQ_4_12(0.25)); + if (moveType != TYPE_FIRE && moveType != TYPE_WATER) + return UQ_4_12(1.0); + return (moveType == TYPE_WATER) ? UQ_4_12(0.5) : UQ_4_12(1.5); } + return UQ_4_12(1.0); +} + +static inline uq4_12_t GetBurnOrFrostBiteModifier(u32 battlerAtk, u32 move, u32 abilityAtk) +{ + if (gBattleMons[battlerAtk].status1 & STATUS1_BURN + && IS_MOVE_PHYSICAL(move) + && !FACADE_PREVENTS_BURN_MALUS(move) + && abilityAtk != ABILITY_GUTS) + return UQ_4_12(0.5); + if (gBattleMons[battlerAtk].status1 & STATUS1_FROSTBITE + && IS_MOVE_SPECIAL(move) + && !FACADE_PREVENTS_BURN_MALUS(move) + && abilityAtk != ABILITY_GUTS) + return UQ_4_12(0.5); + return UQ_4_12(1.0); +} + +static inline uq4_12_t GetCriticalModifier(bool32 isCrit) +{ + return isCrit ? V_CRIT_MULTIPLIER : UQ_4_12(1.0); +} - // Z-Moves and Max Moves bypass Protect and do 25% of their original damage +static inline uq4_12_t GetZMoveAgainstProtectionModifier(u32 battlerDef) +{ if (gBattleStruct->zmove.active && IS_BATTLER_PROTECTED(battlerDef)) - { - MulModifier(&finalModifier, UQ_4_12(0.25)); - } + return UQ_4_12(0.25); + return UQ_4_12(1.0); +} - // attacker's abilities +static inline uq4_12_t GetMinimizeModifier(u32 move, u32 battlerDef) +{ + if (gBattleMoves[move].minimizeDoubleDamage && gStatuses3[battlerDef] & STATUS3_MINIMIZED) + return UQ_4_12(2.0); + return UQ_4_12(1.0); +} + +static inline uq4_12_t GetUndergroundModifier(u32 move, u32 battlerDef) +{ + if (gBattleMoves[move].damagesUnderground && gStatuses3[battlerDef] & STATUS3_UNDERGROUND) + return UQ_4_12(2.0); + return UQ_4_12(1.0); +} + +static inline uq4_12_t GetDiveModifier(u32 move, u32 battlerDef) +{ + if (gBattleMoves[move].damagesUnderwater && gStatuses3[battlerDef] & STATUS3_UNDERWATER) + return UQ_4_12(2.0); + return UQ_4_12(1.0); +} + +static inline uq4_12_t GetAirborneModifier(u32 move, u32 battlerDef) +{ + if (gBattleMoves[move].damagesAirborneDoubleDamage && gStatuses3[battlerDef] & STATUS3_ON_AIR) + return UQ_4_12(2.0); + return UQ_4_12(1.0); +} + +static inline uq4_12_t GetScreensModifier(u32 move, u32 battlerAtk, u32 battlerDef, bool32 isCrit, u32 abilityAtk) +{ + u32 sideStatus = gSideStatuses[GetBattlerSide(battlerDef)]; + bool32 lightScreen = (sideStatus & SIDE_STATUS_LIGHTSCREEN) && IS_MOVE_SPECIAL(move); + bool32 reflect = (sideStatus & SIDE_STATUS_REFLECT) && IS_MOVE_PHYSICAL(move); + bool32 auroraVeil = sideStatus & SIDE_STATUS_AURORA_VEIL; + + if (isCrit || abilityAtk == ABILITY_INFILTRATOR || gProtectStructs[battlerAtk].confusionSelfDmg) + return UQ_4_12(1.0); + if (reflect || lightScreen || auroraVeil) + return (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) ? UQ_4_12(0.667) : UQ_4_12(0.5); + return UQ_4_12(1.0); +} + +static inline uq4_12_t GetCollisionCourseElectroDriftModifier(u32 move, uq4_12_t typeEffectivenessModifier) +{ + if (gBattleMoves[move].effect == EFFECT_COLLISION_COURSE && typeEffectivenessModifier >= UQ_4_12(2.0)) + return UQ_4_12(1.3333); + return UQ_4_12(1.0); +} + +static inline uq4_12_t GetAttackerAbilitiesModifier(u32 battlerAtk, uq4_12_t typeEffectivenessModifier, bool32 isCrit, u32 abilityAtk) +{ switch (abilityAtk) { - case ABILITY_TINTED_LENS: - if (typeEffectivenessModifier <= UQ_4_12(0.5)) - MulModifier(&finalModifier, UQ_4_12(2.0)); + case ABILITY_NEUROFORCE: + if (typeEffectivenessModifier >= UQ_4_12(2.0)) + return UQ_4_12(1.25); break; case ABILITY_SNIPER: if (isCrit) - MulModifier(&finalModifier, UQ_4_12(1.5)); + return UQ_4_12(1.5); break; - case ABILITY_NEUROFORCE: - if (typeEffectivenessModifier >= UQ_4_12(2.0)) - MulModifier(&finalModifier, UQ_4_12(1.25)); + case ABILITY_TINTED_LENS: + if (typeEffectivenessModifier <= UQ_4_12(0.5)) + return UQ_4_12(2.0); break; } + return UQ_4_12(1.0); +} - // target's abilities +static inline uq4_12_t GetDefenderAbilitiesModifier(u32 move, u32 moveType, u32 battlerAtk, u32 battlerDef, uq4_12_t typeEffectivenessModifier, u32 abilityDef) +{ switch (abilityDef) { case ABILITY_MULTISCALE: case ABILITY_SHADOW_SHIELD: if (BATTLER_MAX_HP(battlerDef)) - MulModifier(&finalModifier, UQ_4_12(0.5)); + return UQ_4_12(0.5); break; case ABILITY_FILTER: case ABILITY_SOLID_ROCK: case ABILITY_PRISM_ARMOR: if (typeEffectivenessModifier >= UQ_4_12(2.0)) - MulModifier(&finalModifier, UQ_4_12(0.75)); + return UQ_4_12(0.75); + break; + case ABILITY_FLUFFY: + if (!IsMoveMakingContact(move, battlerAtk) && moveType == TYPE_FIRE) + return UQ_4_12(2.0); + if (IsMoveMakingContact(move, battlerAtk) && moveType != TYPE_FIRE) + return UQ_4_12(0.5); + break; + case ABILITY_PUNK_ROCK: + if (gBattleMoves[move].soundMove) + return UQ_4_12(0.5); + break; + case ABILITY_ICE_SCALES: + if (IS_MOVE_SPECIAL(move)) + return UQ_4_12(0.5); break; } + return UQ_4_12(1.0); +} - // target's ally's abilities - if (IsBattlerAlive(BATTLE_PARTNER(battlerDef))) +static inline uq4_12_t GetDefenderPartnerAbilitiesModifier(u32 battlerPartnerDef) +{ + if (!IsBattlerAlive(battlerPartnerDef)) + return UQ_4_12(1.0); + + switch (GetBattlerAbility(battlerPartnerDef)) { - switch (GetBattlerAbility(BATTLE_PARTNER(battlerDef))) - { - case ABILITY_FRIEND_GUARD: - MulModifier(&finalModifier, UQ_4_12(0.75)); - break; - } + case ABILITY_FRIEND_GUARD: + return UQ_4_12(0.75); + break; } + return UQ_4_12(1.0); +} - // attacker's hold effect +static inline uq4_12_t GetAttackerItemsModifier(u32 battlerAtk, uq4_12_t typeEffectivenessModifier, u32 holdEffectAtk) +{ + u32 percentBoost; switch (holdEffectAtk) { case HOLD_EFFECT_METRONOME: percentBoost = min((gBattleStruct->sameMoveTurns[battlerAtk] * GetBattlerHoldEffectParam(battlerAtk)), 100); - MulModifier(&finalModifier, UQ_4_12(1.0) + sPercentToModifier[percentBoost]); + return uq4_12_add(sPercentToModifier[percentBoost], UQ_4_12(1.0)); break; case HOLD_EFFECT_EXPERT_BELT: if (typeEffectivenessModifier >= UQ_4_12(2.0)) - MulModifier(&finalModifier, UQ_4_12(1.2)); + return UQ_4_12(1.2); break; case HOLD_EFFECT_LIFE_ORB: - MulModifier(&finalModifier, UQ_4_12(1.3)); + return UQ_4_12(1.3); break; } + return UQ_4_12(1.0); +} + +static inline uq4_12_t GetDefenderItemsModifier(u32 moveType, u32 battlerDef, uq4_12_t typeEffectivenessModifier, bool32 updateFlags, u32 abilityDef, u32 holdEffectDef) +{ + u32 holdEffectDefParam = GetBattlerHoldEffectParam(battlerDef); + u32 itemDef = gBattleMons[battlerDef].item; - // target's hold effect switch (holdEffectDef) { - // berries reducing dmg case HOLD_EFFECT_RESIST_BERRY: - if (moveType == GetBattlerHoldEffectParam(battlerDef) - && (moveType == TYPE_NORMAL || typeEffectivenessModifier >= UQ_4_12(2.0)) - && !UnnerveOn(battlerDef, itemDef)) + if (UnnerveOn(battlerDef, itemDef)) + return UQ_4_12(1.0); + if (moveType == holdEffectDefParam && (moveType == TYPE_NORMAL || typeEffectivenessModifier >= UQ_4_12(2.0))) { - if (abilityDef == ABILITY_RIPEN) - MulModifier(&finalModifier, UQ_4_12(0.25)); - else - MulModifier(&finalModifier, UQ_4_12(0.5)); if (updateFlags) gSpecialStatuses[battlerDef].berryReduced = TRUE; + return (abilityDef == ABILITY_RIPEN) ? UQ_4_12(0.25) : UQ_4_12(0.5); } break; } + return UQ_4_12(1.0); +} - if (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE && gStatuses3[battlerDef] & STATUS3_MINIMIZED) - MulModifier(&finalModifier, UQ_4_12(2.0)); - if (gBattleMoves[move].flags & FLAG_DMG_UNDERGROUND && gStatuses3[battlerDef] & STATUS3_UNDERGROUND) - MulModifier(&finalModifier, UQ_4_12(2.0)); - if (gBattleMoves[move].flags & FLAG_DMG_UNDERWATER && gStatuses3[battlerDef] & STATUS3_UNDERWATER) - MulModifier(&finalModifier, UQ_4_12(2.0)); - if (gBattleMoves[move].flags & FLAG_DMG_2X_IN_AIR && gStatuses3[battlerDef] & STATUS3_ON_AIR) - MulModifier(&finalModifier, UQ_4_12(2.0)); +#define DAMAGE_MULTIPLY_MODIFIER(modifier) do { \ + finalModifier = uq4_12_multiply_half_down(modifier, finalModifier); \ +} while (0) - dmg = ApplyModifier(finalModifier, dmg); - if (dmg == 0) - dmg = 1; +// Calculates the "other" modifier which accounts for held items, abilities, +// or very specific interactions of moves that are not handled in the basic +// damage calculation. It is implemented as described by bulbapedia: +// https://bulbapedia.bulbagarden.net/wiki/Damage#Generation_V_onward +// Please Note: Fixed Point Multiplication is not associative. +// The order of operations is relevant. +static inline uq4_12_t GetOtherModifiers(u32 move, u32 moveType, u32 battlerAtk, u32 battlerDef, bool32 isCrit, uq4_12_t typeEffectivenessModifier, bool32 updateFlags, + u32 abilityAtk, u32 abilityDef, u32 holdEffectAtk, u32 holdEffectDef) +{ + uq4_12_t finalModifier = UQ_4_12(1.0); + u32 battlerDefPartner = BATTLE_PARTNER(battlerDef); + u32 unmodifiedAttackerSpeed = gBattleMons[battlerAtk].speed; + u32 unmodifiedDefenderSpeed = gBattleMons[battlerDef].speed; + //TODO: Behemoth Blade, Behemoth Bash, Dynamax Cannon (Dynamax) + DAMAGE_MULTIPLY_MODIFIER(GetMinimizeModifier(move, battlerDef)); + DAMAGE_MULTIPLY_MODIFIER(GetUndergroundModifier(move, battlerDef)); + DAMAGE_MULTIPLY_MODIFIER(GetDiveModifier(move, battlerDef)); + DAMAGE_MULTIPLY_MODIFIER(GetAirborneModifier(move, battlerDef)); + DAMAGE_MULTIPLY_MODIFIER(GetScreensModifier(move, battlerAtk, battlerDef, isCrit, abilityAtk)); + DAMAGE_MULTIPLY_MODIFIER(GetCollisionCourseElectroDriftModifier(move, typeEffectivenessModifier)); - return dmg; + if (unmodifiedAttackerSpeed >= unmodifiedDefenderSpeed) + { + DAMAGE_MULTIPLY_MODIFIER(GetAttackerAbilitiesModifier(battlerAtk, typeEffectivenessModifier, isCrit, abilityAtk)); + DAMAGE_MULTIPLY_MODIFIER(GetDefenderAbilitiesModifier(move, moveType, battlerAtk, battlerDef, typeEffectivenessModifier, abilityDef)); + DAMAGE_MULTIPLY_MODIFIER(GetDefenderPartnerAbilitiesModifier(battlerDefPartner)); + DAMAGE_MULTIPLY_MODIFIER(GetAttackerItemsModifier(battlerAtk, typeEffectivenessModifier, holdEffectAtk)); + DAMAGE_MULTIPLY_MODIFIER(GetDefenderItemsModifier(moveType, battlerDef, typeEffectivenessModifier, updateFlags, abilityDef, holdEffectDef)); + } + else + { + DAMAGE_MULTIPLY_MODIFIER(GetDefenderAbilitiesModifier(move, moveType, battlerAtk, battlerDef, typeEffectivenessModifier, abilityDef)); + DAMAGE_MULTIPLY_MODIFIER(GetDefenderPartnerAbilitiesModifier(battlerDefPartner)); + DAMAGE_MULTIPLY_MODIFIER(GetAttackerAbilitiesModifier(battlerAtk, typeEffectivenessModifier, isCrit, abilityAtk)); + DAMAGE_MULTIPLY_MODIFIER(GetDefenderItemsModifier(moveType, battlerDef, typeEffectivenessModifier, updateFlags, abilityDef, holdEffectDef)); + DAMAGE_MULTIPLY_MODIFIER(GetAttackerItemsModifier(battlerAtk, typeEffectivenessModifier, holdEffectAtk)); + } + return finalModifier; } -static s32 DoMoveDamageCalc(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, s32 fixedBasePower, - bool32 isCrit, bool32 randomFactor, bool32 updateFlags, u16 typeEffectivenessModifier) +#undef DAMAGE_ACCUMULATE_MULTIPLIER + +#define DAMAGE_APPLY_MODIFIER(modifier) do { \ + dmg = uq4_12_multiply_by_int_half_down(modifier, dmg); \ +} while (0) + +static inline s32 DoMoveDamageCalcVars(u32 move, u32 battlerAtk, u32 battlerDef, u32 moveType, s32 fixedBasePower, + bool32 isCrit, bool32 randomFactor, bool32 updateFlags, uq4_12_t typeEffectivenessModifier, u32 weather, + u32 holdEffectAtk, u32 holdEffectDef, u32 abilityAtk, u32 abilityDef) { s32 dmg; - - // Don't calculate damage if the move has no effect on target. - if (typeEffectivenessModifier == UQ_4_12(0)) - return 0; + u32 userFinalAttack; + u32 targetFinalDefense; if (fixedBasePower) gBattleMovePower = fixedBasePower; else - gBattleMovePower = CalcMoveBasePowerAfterModifiers(move, battlerAtk, battlerDef, moveType, updateFlags); + gBattleMovePower = CalcMoveBasePowerAfterModifiers(move, battlerAtk, battlerDef, moveType, updateFlags, abilityAtk, abilityDef, holdEffectAtk, weather); - // long dmg basic formula - dmg = ((gBattleMons[battlerAtk].level * 2) / 5) + 2; - dmg *= gBattleMovePower; - dmg *= CalcAttackStat(move, battlerAtk, battlerDef, moveType, isCrit, updateFlags); - dmg /= CalcDefenseStat(move, battlerAtk, battlerDef, moveType, isCrit, updateFlags); - dmg = (dmg / 50) + 2; + userFinalAttack = CalcAttackStat(move, battlerAtk, battlerDef, moveType, isCrit, updateFlags, abilityAtk, abilityDef, holdEffectAtk); + targetFinalDefense = CalcDefenseStat(move, battlerAtk, battlerDef, moveType, isCrit, updateFlags, abilityAtk, abilityDef, holdEffectDef, weather); - // Calculate final modifiers. - dmg = CalcFinalDmg(dmg, move, battlerAtk, battlerDef, moveType, typeEffectivenessModifier, isCrit, updateFlags); - - // Add a random factor. + dmg = CalculateBaseDamage(gBattleMovePower, userFinalAttack, gBattleMons[battlerAtk].level, targetFinalDefense); + DAMAGE_APPLY_MODIFIER(GetTargetDamageModifier(move, battlerAtk, battlerDef)); + DAMAGE_APPLY_MODIFIER(GetParentalBondModifier(battlerAtk)); + DAMAGE_APPLY_MODIFIER(GetWeatherDamageModifier(battlerAtk, move, moveType, holdEffectAtk, holdEffectDef, weather)); + DAMAGE_APPLY_MODIFIER(GetCriticalModifier(isCrit)); + // TODO: Glaive Rush (Gen IX effect) if (randomFactor) { dmg *= 100 - RandomUniform(RNG_DAMAGE_MODIFIER, 0, 15); dmg /= 100; } + DAMAGE_APPLY_MODIFIER(GetSameTypeAttackBonusModifier(battlerAtk, moveType, move, abilityAtk)); + DAMAGE_APPLY_MODIFIER(typeEffectivenessModifier); + DAMAGE_APPLY_MODIFIER(GetBurnOrFrostBiteModifier(battlerAtk, move, abilityAtk)); + DAMAGE_APPLY_MODIFIER(GetZMoveAgainstProtectionModifier(battlerDef)); + DAMAGE_APPLY_MODIFIER(GetOtherModifiers(move, moveType, battlerAtk, battlerDef, isCrit, typeEffectivenessModifier, updateFlags, abilityAtk, abilityDef, holdEffectAtk, holdEffectDef)); + if (dmg == 0) dmg = 1; - return dmg; } -s32 CalculateMoveDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, s32 fixedBasePower, bool32 isCrit, bool32 randomFactor, bool32 updateFlags) +static inline s32 DoMoveDamageCalc(u32 move, u32 battlerAtk, u32 battlerDef, u32 moveType, s32 fixedBasePower, + bool32 isCrit, bool32 randomFactor, bool32 updateFlags, uq4_12_t typeEffectivenessModifier, u32 weather) +{ + u32 holdEffectAtk, holdEffectDef, abilityAtk, abilityDef; + + if (typeEffectivenessModifier == UQ_4_12(0.0)) + return 0; + + holdEffectAtk = GetBattlerHoldEffect(battlerAtk, TRUE); + holdEffectDef = GetBattlerHoldEffect(battlerDef, TRUE); + abilityAtk = GetBattlerAbility(battlerAtk); + abilityDef = GetBattlerAbility(battlerDef); + + return DoMoveDamageCalcVars(move, battlerAtk, battlerDef, moveType, fixedBasePower, isCrit, randomFactor, + updateFlags, typeEffectivenessModifier, weather, holdEffectAtk, holdEffectDef, abilityAtk, abilityDef); +} + +#undef DAMAGE_APPLY_MODIFIER + +static u32 GetWeather(void) +{ + if (gBattleWeather == B_WEATHER_NONE || !WEATHER_HAS_EFFECT) + return B_WEATHER_NONE; + else + return gBattleWeather; +} + +s32 CalculateMoveDamage(u32 move, u32 battlerAtk, u32 battlerDef, u32 moveType, s32 fixedBasePower, bool32 isCrit, bool32 randomFactor, bool32 updateFlags) { return DoMoveDamageCalc(move, battlerAtk, battlerDef, moveType, fixedBasePower, isCrit, randomFactor, - updateFlags, CalcTypeEffectivenessMultiplier(move, moveType, battlerAtk, battlerDef, updateFlags)); + updateFlags, CalcTypeEffectivenessMultiplier(move, moveType, battlerAtk, battlerDef, GetBattlerAbility(battlerDef), updateFlags), + GetWeather()); } -// for AI - get move damage and effectiveness with one function call -s32 CalculateMoveDamageAndEffectiveness(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, s32 fixedBasePower, u16 *typeEffectivenessModifier) +// for AI so that typeEffectivenessModifier, weather, abilities and holdEffects are calculated only once +s32 CalculateMoveDamageVars(u32 move, u32 battlerAtk, u32 battlerDef, u32 moveType, s32 fixedBasePower, uq4_12_t typeEffectivenessModifier, + u32 weather, bool32 isCrit, u32 holdEffectAtk, u32 holdEffectDef, u32 abilityAtk, u32 abilityDef) { - *typeEffectivenessModifier = CalcTypeEffectivenessMultiplier(move, moveType, battlerAtk, battlerDef, FALSE); - return DoMoveDamageCalc(move, battlerAtk, battlerDef, moveType, fixedBasePower, FALSE, FALSE, FALSE, *typeEffectivenessModifier); + return DoMoveDamageCalcVars(move, battlerAtk, battlerDef, moveType, fixedBasePower, isCrit, FALSE, FALSE, + typeEffectivenessModifier, weather, holdEffectAtk, holdEffectDef, abilityAtk, abilityDef); } -static void MulByTypeEffectiveness(u16 *modifier, u16 move, u8 moveType, u8 battlerDef, u8 defType, u8 battlerAtk, bool32 recordAbilities) +static inline void MulByTypeEffectiveness(uq4_12_t *modifier, u32 move, u32 moveType, u32 battlerDef, u32 defType, u32 battlerAtk, bool32 recordAbilities) { - u16 mod = GetTypeModifier(moveType, defType); + uq4_12_t mod = GetTypeModifier(moveType, defType); if (mod == UQ_4_12(0.0) && GetBattlerHoldEffect(battlerDef, TRUE) == HOLD_EFFECT_RING_TARGET) { @@ -9793,13 +9948,13 @@ static void MulByTypeEffectiveness(u16 *modifier, u16 move, u8 moveType, u8 batt mod = UQ_4_12(1.0); } - MulModifier(modifier, mod); + *modifier = uq4_12_multiply(*modifier, mod); } -static void TryNoticeIllusionInTypeEffectiveness(u32 move, u32 moveType, u32 battlerAtk, u32 battlerDef, u16 resultingModifier, u32 illusionSpecies) +static inline void TryNoticeIllusionInTypeEffectiveness(u32 move, u32 moveType, u32 battlerAtk, u32 battlerDef, uq4_12_t resultingModifier, u32 illusionSpecies) { // Check if the type effectiveness would've been different if the pokemon really had the types as the disguise. - u16 presumedModifier = UQ_4_12(1.0); + uq4_12_t presumedModifier = UQ_4_12(1.0); MulByTypeEffectiveness(&presumedModifier, move, moveType, battlerDef, gSpeciesInfo[illusionSpecies].types[0], battlerAtk, FALSE); if (gSpeciesInfo[illusionSpecies].types[1] != gSpeciesInfo[illusionSpecies].types[0]) MulByTypeEffectiveness(&presumedModifier, move, moveType, battlerDef, gSpeciesInfo[illusionSpecies].types[1], battlerAtk, FALSE); @@ -9808,7 +9963,7 @@ static void TryNoticeIllusionInTypeEffectiveness(u32 move, u32 moveType, u32 bat RecordAbilityBattle(battlerDef, ABILITY_ILLUSION); } -static void UpdateMoveResultFlags(u16 modifier) +static void UpdateMoveResultFlags(uq4_12_t modifier) { if (modifier == UQ_4_12(0.0)) { @@ -9831,10 +9986,9 @@ static void UpdateMoveResultFlags(u16 modifier) } } -static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 battlerAtk, u8 battlerDef, bool32 recordAbilities, u16 modifier) +static inline uq4_12_t CalcTypeEffectivenessMultiplierInternal(u32 move, u32 moveType, u32 battlerAtk, u32 battlerDef, bool32 recordAbilities, uq4_12_t modifier, u32 defAbility) { u32 illusionSpecies; - u16 defAbility = GetBattlerAbility(battlerDef); MulByTypeEffectiveness(&modifier, move, moveType, battlerDef, gBattleMons[battlerDef].type1, battlerAtk, recordAbilities); if (gBattleMons[battlerDef].type2 != gBattleMons[battlerDef].type1) @@ -9856,7 +10010,7 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat } #endif } - else if (moveType == TYPE_GROUND && !IsBattlerGrounded2(battlerDef, TRUE) && !(gBattleMoves[move].flags & FLAG_DMG_UNGROUNDED_IGNORE_TYPE_IF_FLYING)) + else if (moveType == TYPE_GROUND && !IsBattlerGrounded2(battlerDef, TRUE) && !(gBattleMoves[move].ignoreTypeIfFlyingAndUngrounded)) { modifier = UQ_4_12(0.0); if (recordAbilities && defAbility == ABILITY_LEVITATE) @@ -9876,7 +10030,7 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat #endif // Thousand Arrows ignores type modifiers for flying mons - if (!IsBattlerGrounded(battlerDef) && (gBattleMoves[move].flags & FLAG_DMG_UNGROUNDED_IGNORE_TYPE_IF_FLYING) + if (!IsBattlerGrounded(battlerDef) && (gBattleMoves[move].ignoreTypeIfFlyingAndUngrounded) && (gBattleMons[battlerDef].type1 == TYPE_FLYING || gBattleMons[battlerDef].type2 == TYPE_FLYING || gBattleMons[battlerDef].type3 == TYPE_FLYING)) { modifier = UQ_4_12(1.0); @@ -9904,15 +10058,15 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat return modifier; } -u16 CalcTypeEffectivenessMultiplier(u16 move, u8 moveType, u8 battlerAtk, u8 battlerDef, bool32 recordAbilities) +uq4_12_t CalcTypeEffectivenessMultiplier(u32 move, u32 moveType, u32 battlerAtk, u32 battlerDef, u32 defAbility, bool32 recordAbilities) { - u16 modifier = UQ_4_12(1.0); + uq4_12_t modifier = UQ_4_12(1.0); if (move != MOVE_STRUGGLE && moveType != TYPE_MYSTERY) { - modifier = CalcTypeEffectivenessMultiplierInternal(move, moveType, battlerAtk, battlerDef, recordAbilities, modifier); + modifier = CalcTypeEffectivenessMultiplierInternal(move, moveType, battlerAtk, battlerDef, recordAbilities, modifier, defAbility); if (gBattleMoves[move].effect == EFFECT_TWO_TYPED_MOVE) - modifier = CalcTypeEffectivenessMultiplierInternal(move, gBattleMoves[move].argument, battlerAtk, battlerDef, recordAbilities, modifier); + modifier = CalcTypeEffectivenessMultiplierInternal(move, gBattleMoves[move].argument, battlerAtk, battlerDef, recordAbilities, modifier, defAbility); } if (recordAbilities) @@ -9920,9 +10074,9 @@ u16 CalcTypeEffectivenessMultiplier(u16 move, u8 moveType, u8 battlerAtk, u8 bat return modifier; } -u16 CalcPartyMonTypeEffectivenessMultiplier(u16 move, u16 speciesDef, u16 abilityDef) +uq4_12_t CalcPartyMonTypeEffectivenessMultiplier(u16 move, u16 speciesDef, u16 abilityDef) { - u16 modifier = UQ_4_12(1.0); + uq4_12_t modifier = UQ_4_12(1.0); u8 moveType = gBattleMoves[move].type; if (move != MOVE_STRUGGLE && moveType != TYPE_MYSTERY) @@ -9941,7 +10095,7 @@ u16 CalcPartyMonTypeEffectivenessMultiplier(u16 move, u16 speciesDef, u16 abilit return modifier; } -static u16 GetInverseTypeMultiplier(u16 multiplier) +static uq4_12_t GetInverseTypeMultiplier(uq4_12_t multiplier) { switch (multiplier) { @@ -9956,7 +10110,7 @@ static u16 GetInverseTypeMultiplier(u16 multiplier) } } -u16 GetTypeModifier(u8 atkType, u8 defType) +uq4_12_t GetTypeModifier(u32 atkType, u32 defType) { #if B_FLAG_INVERSE_BATTLE != 0 if (FlagGet(B_FLAG_INVERSE_BATTLE)) @@ -9968,11 +10122,11 @@ u16 GetTypeModifier(u8 atkType, u8 defType) s32 GetStealthHazardDamageByTypesAndHP(u8 hazardType, u8 type1, u8 type2, u32 maxHp) { s32 dmg = 0; - u16 modifier = UQ_4_12(1.0); + uq4_12_t modifier = UQ_4_12(1.0); - MulModifier(&modifier, GetTypeModifier(hazardType, type1)); + modifier = uq4_12_multiply(modifier, GetTypeModifier(hazardType, type1)); if (type2 != type1) - MulModifier(&modifier, GetTypeModifier(hazardType, type2)); + modifier = uq4_12_multiply(modifier, GetTypeModifier(hazardType, type2)); switch (modifier) { @@ -10009,20 +10163,20 @@ s32 GetStealthHazardDamageByTypesAndHP(u8 hazardType, u8 type1, u8 type2, u32 ma return dmg; } -s32 GetStealthHazardDamage(u8 hazardType, u8 battlerId) +s32 GetStealthHazardDamage(u8 hazardType, u32 battler) { - u8 type1 = gBattleMons[battlerId].type1; - u8 type2 = gBattleMons[battlerId].type2; - u32 maxHp = gBattleMons[battlerId].maxHP; + u8 type1 = gBattleMons[battler].type1; + u8 type2 = gBattleMons[battler].type2; + u32 maxHp = gBattleMons[battler].maxHP; return GetStealthHazardDamageByTypesAndHP(hazardType, type1, type2, maxHp); } -bool32 IsPartnerMonFromSameTrainer(u8 battlerId) +bool32 IsPartnerMonFromSameTrainer(u32 battler) { - if (GetBattlerSide(battlerId) == B_SIDE_OPPONENT && gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) + if (GetBattlerSide(battler) == B_SIDE_OPPONENT && gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) return FALSE; - else if (GetBattlerSide(battlerId) == B_SIDE_PLAYER && gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) + else if (GetBattlerSide(battler) == B_SIDE_PLAYER && gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) return FALSE; else if (gBattleTypeFlags & BATTLE_TYPE_MULTI) return FALSE; @@ -10043,6 +10197,7 @@ bool32 DoesSpeciesUseHoldItemToChangeForm(u16 species, u16 heldItemId) { case FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM: case FORM_CHANGE_BATTLE_PRIMAL_REVERSION: + case FORM_CHANGE_BATTLE_ULTRA_BURST: case FORM_CHANGE_ITEM_HOLD: if (formChanges[i].param1 == heldItemId) return TRUE; @@ -10053,16 +10208,16 @@ bool32 DoesSpeciesUseHoldItemToChangeForm(u16 species, u16 heldItemId) return FALSE; } -bool32 CanMegaEvolve(u8 battlerId) +bool32 CanMegaEvolve(u32 battler) { u32 itemId, holdEffect, species; struct Pokemon *mon; - u8 battlerPosition = GetBattlerPosition(battlerId); - u8 partnerPosition = GetBattlerPosition(BATTLE_PARTNER(battlerId)); - struct MegaEvolutionData *mega = &(((struct ChooseMoveStruct *)(&gBattleResources->bufferA[gActiveBattler][4]))->mega); + u32 battlerPosition = GetBattlerPosition(battler); + u8 partnerPosition = GetBattlerPosition(BATTLE_PARTNER(battler)); + struct MegaEvolutionData *mega = &(((struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]))->mega); // Check if Player has a Mega Ring - if ((GetBattlerPosition(battlerId) == B_POSITION_PLAYER_LEFT || (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) && GetBattlerPosition(battlerId) == B_POSITION_PLAYER_RIGHT)) + if ((GetBattlerPosition(battler) == B_POSITION_PLAYER_LEFT || (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) && GetBattlerPosition(battler) == B_POSITION_PLAYER_RIGHT)) && !CheckBagHasItem(ITEM_MEGA_RING, 1)) return FALSE; @@ -10071,39 +10226,34 @@ bool32 CanMegaEvolve(u8 battlerId) return FALSE; // Cannot use z move and mega evolve on same turn - if (gBattleStruct->zmove.toBeUsed[battlerId]) + if (gBattleStruct->zmove.toBeUsed[battler]) return FALSE; if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE - && IsPartnerMonFromSameTrainer(battlerId) - && (mega->alreadyEvolved[partnerPosition] || (mega->toEvolve & gBitTable[BATTLE_PARTNER(battlerId)]))) + && IsPartnerMonFromSameTrainer(battler) + && (mega->alreadyEvolved[partnerPosition] || (mega->toEvolve & gBitTable[BATTLE_PARTNER(battler)]))) return FALSE; // Check if mon is currently held by Sky Drop - if (gStatuses3[battlerId] & STATUS3_SKY_DROPPED) + if (gStatuses3[battler] & STATUS3_SKY_DROPPED) return FALSE; // Gets mon data. - if (GetBattlerSide(battlerId) == B_SIDE_OPPONENT) - mon = &gEnemyParty[gBattlerPartyIndexes[battlerId]]; + if (GetBattlerSide(battler) == B_SIDE_OPPONENT) + mon = &gEnemyParty[gBattlerPartyIndexes[battler]]; else - mon = &gPlayerParty[gBattlerPartyIndexes[battlerId]]; + mon = &gPlayerParty[gBattlerPartyIndexes[battler]]; species = GetMonData(mon, MON_DATA_SPECIES); itemId = GetMonData(mon, MON_DATA_HELD_ITEM); -#if DEBUG_BATTLE_MENU == TRUE - if (gBattleStruct->debugHoldEffects[battlerId]) - holdEffect = gBattleStruct->debugHoldEffects[battlerId]; - else -#endif if (itemId == ITEM_ENIGMA_BERRY_E_READER) - holdEffect = gEnigmaBerries[battlerId].holdEffect; + holdEffect = gEnigmaBerries[battler].holdEffect; else holdEffect = ItemId_GetHoldEffect(itemId); // Check if there is an entry in the evolution table for regular Mega Evolution. - if (GetBattleFormChangeTargetSpecies(battlerId, FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM) != SPECIES_NONE) + if (GetBattleFormChangeTargetSpecies(battler, FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM) != SPECIES_NONE) { // Can Mega Evolve via Mega Stone. if (holdEffect == HOLD_EFFECT_MEGA_STONE) @@ -10111,7 +10261,7 @@ bool32 CanMegaEvolve(u8 battlerId) } // Check if there is an entry in the evolution table for Wish Mega Evolution. - if (GetBattleFormChangeTargetSpecies(battlerId, FORM_CHANGE_BATTLE_MEGA_EVOLUTION_MOVE) != SPECIES_NONE) + if (GetBattleFormChangeTargetSpecies(battler, FORM_CHANGE_BATTLE_MEGA_EVOLUTION_MOVE) != SPECIES_NONE) { // Can't Wish Mega Evolve if holding a Z Crystal. if (holdEffect != HOLD_EFFECT_Z_CRYSTAL) @@ -10122,36 +10272,99 @@ bool32 CanMegaEvolve(u8 battlerId) return FALSE; } -bool32 IsBattlerMegaEvolved(u8 battlerId) +bool32 CanUltraBurst(u32 battler) +{ + u32 itemId, holdEffect, species; + struct Pokemon *mon; + u32 battlerPosition = GetBattlerPosition(battler); + u8 partnerPosition = GetBattlerPosition(BATTLE_PARTNER(battler)); + + // Check if Player has a Z Ring + if ((GetBattlerPosition(battler) == B_POSITION_PLAYER_LEFT || (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) && GetBattlerPosition(battler) == B_POSITION_PLAYER_RIGHT)) + && !CheckBagHasItem(ITEM_Z_POWER_RING, 1)) + return FALSE; + + // Check if trainer already ultra bursted a pokemon. + if (gBattleStruct->burst.alreadyBursted[battlerPosition]) + return FALSE; + + // Cannot use z move and ultra burst on same turn + if (gBattleStruct->zmove.toBeUsed[battler]) + return FALSE; + + if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE + && IsPartnerMonFromSameTrainer(battler) + && (gBattleStruct->burst.alreadyBursted[partnerPosition] || (gBattleStruct->burst.toBurst & gBitTable[BATTLE_PARTNER(battler)]))) + return FALSE; + + // Check if mon is currently held by Sky Drop + if (gStatuses3[battler] & STATUS3_SKY_DROPPED) + return FALSE; + + // Gets mon data. + if (GetBattlerSide(battler) == B_SIDE_OPPONENT) + mon = &gEnemyParty[gBattlerPartyIndexes[battler]]; + else + mon = &gPlayerParty[gBattlerPartyIndexes[battler]]; + + species = GetMonData(mon, MON_DATA_SPECIES); + itemId = GetMonData(mon, MON_DATA_HELD_ITEM); + + // Check if there is an entry in the evolution table for Ultra Burst. + if (GetBattleFormChangeTargetSpecies(battler, FORM_CHANGE_BATTLE_ULTRA_BURST) != SPECIES_NONE) + { + if (itemId == ITEM_ENIGMA_BERRY_E_READER) + holdEffect = gEnigmaBerries[battler].holdEffect; + else + holdEffect = ItemId_GetHoldEffect(itemId); + + // Can Ultra Burst via Z Crystal. + if (holdEffect == HOLD_EFFECT_Z_CRYSTAL) + return TRUE; + } + + // No checks passed, the mon CAN'T ultra burst. + return FALSE; +} + +bool32 IsBattlerMegaEvolved(u32 battler) { // While Transform does copy stats and visuals, it shouldn't be counted as true Mega Evolution. - if (gBattleMons[battlerId].status2 & STATUS2_TRANSFORMED) + if (gBattleMons[battler].status2 & STATUS2_TRANSFORMED) return FALSE; - return (gSpeciesInfo[gBattleMons[battlerId].species].flags & SPECIES_FLAG_MEGA_EVOLUTION); + return (gSpeciesInfo[gBattleMons[battler].species].flags & SPECIES_FLAG_MEGA_EVOLUTION); } -bool32 IsBattlerPrimalReverted(u8 battlerId) +bool32 IsBattlerPrimalReverted(u32 battler) { // While Transform does copy stats and visuals, it shouldn't be counted as true Primal Revesion. - if (gBattleMons[battlerId].status2 & STATUS2_TRANSFORMED) + if (gBattleMons[battler].status2 & STATUS2_TRANSFORMED) + return FALSE; + return (gSpeciesInfo[gBattleMons[battler].species].flags & SPECIES_FLAG_PRIMAL_REVERSION); +} + +bool32 IsBattlerUltraBursted(u32 battler) +{ + // While Transform does copy stats and visuals, it shouldn't be counted as true Ultra Burst. + if (gBattleMons[battler].status2 & STATUS2_TRANSFORMED) return FALSE; - return (gSpeciesInfo[gBattleMons[battlerId].species].flags & SPECIES_FLAG_PRIMAL_REVERSION); + return (gSpeciesInfo[gBattleMons[battler].species].flags & SPECIES_FLAG_ULTRA_BURST); } // Returns SPECIES_NONE if no form change is possible -u16 GetBattleFormChangeTargetSpecies(u8 battlerId, u16 method) +u16 GetBattleFormChangeTargetSpecies(u32 battler, u16 method) { u32 i, j; u16 targetSpecies = SPECIES_NONE; - u16 species = gBattleMons[battlerId].species; + u16 species = gBattleMons[battler].species; const struct FormChange *formChanges = gFormChangeTablePointers[species]; u16 heldItem; u32 ability; if (formChanges != NULL) { - heldItem = gBattleMons[battlerId].item; - ability = GetBattlerAbility(battlerId); + heldItem = gBattleMons[battler].item; + ability = GetBattlerAbility(battler); for (i = 0; formChanges[i].method != FORM_CHANGE_TERMINATOR; i++) { @@ -10161,24 +10374,25 @@ u16 GetBattleFormChangeTargetSpecies(u8 battlerId, u16 method) { case FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM: case FORM_CHANGE_BATTLE_PRIMAL_REVERSION: + case FORM_CHANGE_BATTLE_ULTRA_BURST: if (heldItem == formChanges[i].param1) targetSpecies = formChanges[i].targetSpecies; break; case FORM_CHANGE_BATTLE_MEGA_EVOLUTION_MOVE: - if (gBattleMons[battlerId].moves[0] == formChanges[i].param1 - || gBattleMons[battlerId].moves[1] == formChanges[i].param1 - || gBattleMons[battlerId].moves[2] == formChanges[i].param1 - || gBattleMons[battlerId].moves[3] == formChanges[i].param1) + if (gBattleMons[battler].moves[0] == formChanges[i].param1 + || gBattleMons[battler].moves[1] == formChanges[i].param1 + || gBattleMons[battler].moves[2] == formChanges[i].param1 + || gBattleMons[battler].moves[3] == formChanges[i].param1) targetSpecies = formChanges[i].targetSpecies; break; case FORM_CHANGE_BATTLE_SWITCH: targetSpecies = formChanges[i].targetSpecies; break; case FORM_CHANGE_BATTLE_HP_PERCENT: - if (formChanges[i].param1 == GetBattlerAbility(battlerId)) + if (formChanges[i].param1 == GetBattlerAbility(battler)) { // We multiply by 100 to make sure that integer division doesn't mess with the health check. - u32 hpCheck = gBattleMons[battlerId].hp * 100 * 100 / gBattleMons[battlerId].maxHP; + u32 hpCheck = gBattleMons[battler].hp * 100 * 100 / gBattleMons[battler].maxHP; switch(formChanges[i].param2) { case HP_HIGHER_THAN: @@ -10196,7 +10410,7 @@ u16 GetBattleFormChangeTargetSpecies(u8 battlerId, u16 method) // Check if there is a required ability and if the battler's ability does not match it // or is suppressed. If so, revert to the no weather form. if (formChanges[i].param2 - && GetBattlerAbility(battlerId) != formChanges[i].param2 + && GetBattlerAbility(battler) != formChanges[i].param2 && formChanges[i].param1 == B_WEATHER_NONE) { targetSpecies = formChanges[i].targetSpecies; @@ -10214,7 +10428,7 @@ u16 GetBattleFormChangeTargetSpecies(u8 battlerId, u16 method) } break; case FORM_CHANGE_BATTLE_TURN_END: - if (formChanges[i].param1 == GetBattlerAbility(battlerId)) + if (formChanges[i].param1 == GetBattlerAbility(battler)) targetSpecies = formChanges[i].targetSpecies; break; } @@ -10225,55 +10439,55 @@ u16 GetBattleFormChangeTargetSpecies(u8 battlerId, u16 method) return targetSpecies; } -bool32 CanBattlerFormChange(u8 battlerId, u16 method) +bool32 CanBattlerFormChange(u32 battler, u16 method) { // Can't change form if transformed. - if (gBattleMons[battlerId].status2 & STATUS2_TRANSFORMED + if (gBattleMons[battler].status2 & STATUS2_TRANSFORMED && B_TRANSFORM_FORM_CHANGES >= GEN_5) return FALSE; - // Mega Evolved Pokémon should always revert to normal upon fainting or ending the battle. - if (IsBattlerMegaEvolved(battlerId) && (method == FORM_CHANGE_FAINT || method == FORM_CHANGE_END_BATTLE)) + // Mega Evolved and Ultra Bursted Pokémon should always revert to normal upon fainting or ending the battle. + if ((IsBattlerMegaEvolved(battler) || IsBattlerUltraBursted(battler)) && (method == FORM_CHANGE_FAINT || method == FORM_CHANGE_END_BATTLE)) return TRUE; - else if (IsBattlerPrimalReverted(battlerId) && (method == FORM_CHANGE_END_BATTLE)) + else if (IsBattlerPrimalReverted(battler) && (method == FORM_CHANGE_END_BATTLE)) return TRUE; - return DoesSpeciesHaveFormChangeMethod(gBattleMons[battlerId].species, method); + return DoesSpeciesHaveFormChangeMethod(gBattleMons[battler].species, method); } -bool32 TryBattleFormChange(u8 battlerId, u16 method) +bool32 TryBattleFormChange(u32 battler, u16 method) { - u8 monId = gBattlerPartyIndexes[battlerId]; - u8 side = GET_BATTLER_SIDE(battlerId); - struct Pokemon *party = GetBattlerParty(battlerId); + u8 monId = gBattlerPartyIndexes[battler]; + u8 side = GetBattlerSide(battler); + struct Pokemon *party = GetBattlerParty(battler); u16 targetSpecies; - if (!CanBattlerFormChange(battlerId, method)) + if (!CanBattlerFormChange(battler, method)) return FALSE; - targetSpecies = GetBattleFormChangeTargetSpecies(battlerId, method); + targetSpecies = GetBattleFormChangeTargetSpecies(battler, method); if (targetSpecies == SPECIES_NONE) targetSpecies = GetFormChangeTargetSpecies(&party[monId], method, 0); if (targetSpecies != SPECIES_NONE) { // Saves the original species on the first form change for the player. if (gBattleStruct->changedSpecies[side][monId] == SPECIES_NONE) - gBattleStruct->changedSpecies[side][monId] = gBattleMons[battlerId].species; + gBattleStruct->changedSpecies[side][monId] = gBattleMons[battler].species; TryToSetBattleFormChangeMoves(&party[monId], method); SetMonData(&party[monId], MON_DATA_SPECIES, &targetSpecies); - gBattleMons[battlerId].species = targetSpecies; - RecalcBattlerStats(battlerId, &party[monId]); + gBattleMons[battler].species = targetSpecies; + RecalcBattlerStats(battler, &party[monId]); return TRUE; } else if (gBattleStruct->changedSpecies[side][monId] != SPECIES_NONE) { - bool8 restoreSpecies = FALSE; + bool32 restoreSpecies = FALSE; - // Mega Evolved Pokémon should always revert to normal upon fainting or ending the battle, so no need to add it to the form change tables. - if (IsBattlerMegaEvolved(battlerId) && (method == FORM_CHANGE_FAINT || method == FORM_CHANGE_END_BATTLE)) + // Mega Evolved and Ultra Bursted Pokémon should always revert to normal upon fainting or ending the battle, so no need to add it to the form change tables. + if ((IsBattlerMegaEvolved(battler) || IsBattlerUltraBursted(battler)) && (method == FORM_CHANGE_FAINT || method == FORM_CHANGE_END_BATTLE)) restoreSpecies = TRUE; // Unlike Megas, Primal Reversion isn't canceled on fainting. - else if (IsBattlerPrimalReverted(battlerId) && (method == FORM_CHANGE_END_BATTLE)) + else if (IsBattlerPrimalReverted(battler) && (method == FORM_CHANGE_END_BATTLE)) restoreSpecies = TRUE; if (restoreSpecies) @@ -10281,7 +10495,7 @@ bool32 TryBattleFormChange(u8 battlerId, u16 method) // Reverts the original species TryToSetBattleFormChangeMoves(&party[monId], method); SetMonData(&party[monId], MON_DATA_SPECIES, &gBattleStruct->changedSpecies[side][monId]); - RecalcBattlerStats(battlerId, &party[monId]); + RecalcBattlerStats(battler, &party[monId]); return TRUE; } } @@ -10309,9 +10523,9 @@ bool32 DoBattlersShareType(u32 battler1, u32 battler2) return FALSE; } -bool32 CanBattlerGetOrLoseItem(u8 battlerId, u16 itemId) +bool32 CanBattlerGetOrLoseItem(u32 battler, u16 itemId) { - u16 species = gBattleMons[battlerId].species; + u16 species = gBattleMons[battler].species; u16 holdEffect = ItemId_GetHoldEffect(itemId); // Mail can be stolen now @@ -10325,56 +10539,56 @@ bool32 CanBattlerGetOrLoseItem(u8 battlerId, u16 itemId) return TRUE; } -struct Pokemon *GetIllusionMonPtr(u32 battlerId) +struct Pokemon *GetIllusionMonPtr(u32 battler) { - if (gBattleStruct->illusion[battlerId].broken) + if (gBattleStruct->illusion[battler].broken) return NULL; - if (!gBattleStruct->illusion[battlerId].set) + if (!gBattleStruct->illusion[battler].set) { - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) - SetIllusionMon(&gPlayerParty[gBattlerPartyIndexes[battlerId]], battlerId); + if (GetBattlerSide(battler) == B_SIDE_PLAYER) + SetIllusionMon(&gPlayerParty[gBattlerPartyIndexes[battler]], battler); else - SetIllusionMon(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId); + SetIllusionMon(&gEnemyParty[gBattlerPartyIndexes[battler]], battler); } - if (!gBattleStruct->illusion[battlerId].on) + if (!gBattleStruct->illusion[battler].on) return NULL; - return gBattleStruct->illusion[battlerId].mon; + return gBattleStruct->illusion[battler].mon; } -void ClearIllusionMon(u32 battlerId) +void ClearIllusionMon(u32 battler) { - memset(&gBattleStruct->illusion[battlerId], 0, sizeof(gBattleStruct->illusion[battlerId])); + memset(&gBattleStruct->illusion[battler], 0, sizeof(gBattleStruct->illusion[battler])); } -u32 GetIllusionMonSpecies(u32 battlerId) +u32 GetIllusionMonSpecies(u32 battler) { - struct Pokemon *illusionMon = GetIllusionMonPtr(battlerId); + struct Pokemon *illusionMon = GetIllusionMonPtr(battler); if (illusionMon != NULL) return GetMonData(illusionMon, MON_DATA_SPECIES); return SPECIES_NONE; } -bool32 SetIllusionMon(struct Pokemon *mon, u32 battlerId) +bool32 SetIllusionMon(struct Pokemon *mon, u32 battler) { struct Pokemon *party, *partnerMon; s32 i, id; u8 side, partyCount; - gBattleStruct->illusion[battlerId].set = 1; + gBattleStruct->illusion[battler].set = 1; if (GetMonAbility(mon) != ABILITY_ILLUSION) return FALSE; - party = GetBattlerParty(battlerId); - side = GetBattlerSide(battlerId); + party = GetBattlerParty(battler); + side = GetBattlerSide(battler); partyCount = side == B_SIDE_PLAYER ? gPlayerPartyCount : gEnemyPartyCount; // If this pokemon is last in the party, ignore Illusion. if (&party[partyCount - 1] == mon) return FALSE; - if (IsBattlerAlive(BATTLE_PARTNER(battlerId))) - partnerMon = &party[gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]]; + if (IsBattlerAlive(BATTLE_PARTNER(battler))) + partnerMon = &party[gBattlerPartyIndexes[BATTLE_PARTNER(battler)]]; else partnerMon = mon; @@ -10388,10 +10602,10 @@ bool32 SetIllusionMon(struct Pokemon *mon, u32 battlerId) && &party[id] != mon && &party[id] != partnerMon) { - gBattleStruct->illusion[battlerId].on = 1; - gBattleStruct->illusion[battlerId].broken = 0; - gBattleStruct->illusion[battlerId].partyId = id; - gBattleStruct->illusion[battlerId].mon = &party[id]; + gBattleStruct->illusion[battler].on = 1; + gBattleStruct->illusion[battler].broken = 0; + gBattleStruct->illusion[battler].partyId = id; + gBattleStruct->illusion[battler].mon = &party[id]; return TRUE; } } @@ -10399,12 +10613,12 @@ bool32 SetIllusionMon(struct Pokemon *mon, u32 battlerId) return FALSE; } -bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId) +bool32 ShouldGetStatBadgeBoost(u16 badgeFlag, u32 battler) { #if B_BADGE_BOOST == GEN_3 if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_FRONTIER)) return FALSE; - else if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) + else if (GetBattlerSide(battler) != B_SIDE_PLAYER) return FALSE; else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gTrainerBattleOpponent_A == TRAINER_SECRET_BASE) return FALSE; @@ -10433,10 +10647,10 @@ u8 GetBattleMoveSplit(u32 moveId) #endif } -static bool32 TryRemoveScreens(u8 battler) +static bool32 TryRemoveScreens(u32 battler) { bool32 removed = FALSE; - u8 battlerSide = GetBattlerSide(battler); + u32 battlerSide = GetBattlerSide(battler); u8 enemySide = GetBattlerSide(BATTLE_OPPOSITE(battler)); // try to remove from battler's side @@ -10462,26 +10676,26 @@ static bool32 TryRemoveScreens(u8 battler) return removed; } -static bool32 IsUnnerveAbilityOnOpposingSide(u8 battlerId) +static bool32 IsUnnerveAbilityOnOpposingSide(u32 battler) { - if (IsAbilityOnOpposingSide(battlerId, ABILITY_UNNERVE) - || IsAbilityOnOpposingSide(battlerId, ABILITY_AS_ONE_ICE_RIDER) - || IsAbilityOnOpposingSide(battlerId, ABILITY_AS_ONE_SHADOW_RIDER)) + if (IsAbilityOnOpposingSide(battler, ABILITY_UNNERVE) + || IsAbilityOnOpposingSide(battler, ABILITY_AS_ONE_ICE_RIDER) + || IsAbilityOnOpposingSide(battler, ABILITY_AS_ONE_SHADOW_RIDER)) return TRUE; return FALSE; } // Photon geyser & light that burns the sky -u8 GetSplitBasedOnStats(u8 battlerId) +u8 GetSplitBasedOnStats(u32 battler) { - u32 attack = gBattleMons[battlerId].attack; - u32 spAttack = gBattleMons[battlerId].spAttack; + u32 attack = gBattleMons[battler].attack; + u32 spAttack = gBattleMons[battler].spAttack; - attack = attack * gStatStageRatios[gBattleMons[battlerId].statStages[STAT_ATK]][0]; - attack = attack / gStatStageRatios[gBattleMons[battlerId].statStages[STAT_ATK]][1]; + attack = attack * gStatStageRatios[gBattleMons[battler].statStages[STAT_ATK]][0]; + attack = attack / gStatStageRatios[gBattleMons[battler].statStages[STAT_ATK]][1]; - spAttack = spAttack * gStatStageRatios[gBattleMons[battlerId].statStages[STAT_SPATK]][0]; - spAttack = spAttack / gStatStageRatios[gBattleMons[battlerId].statStages[STAT_SPATK]][1]; + spAttack = spAttack * gStatStageRatios[gBattleMons[battler].statStages[STAT_SPATK]][0]; + spAttack = spAttack / gStatStageRatios[gBattleMons[battler].statStages[STAT_SPATK]][1]; if (spAttack >= attack) return SPLIT_SPECIAL; @@ -10489,18 +10703,11 @@ u8 GetSplitBasedOnStats(u8 battlerId) return SPLIT_PHYSICAL; } -bool32 TestMoveFlags(u16 move, u32 flag) -{ - if (gBattleMoves[move].flags & flag) - return TRUE; - return FALSE; -} - -static u8 GetFlingPowerFromItemId(u16 itemId) +static u32 GetFlingPowerFromItemId(u32 itemId) { if (itemId >= ITEM_TM01 && itemId <= ITEM_HM08) { - u8 power = gBattleMoves[ItemIdToBattleMoveId(itemId)].power; + u32 power = gBattleMoves[ItemIdToBattleMoveId(itemId)].power; if (power > 1) return power; return 10; // Status moves and moves with variable power always return 10 power. @@ -10509,18 +10716,18 @@ static u8 GetFlingPowerFromItemId(u16 itemId) return ItemId_GetFlingPower(itemId); } -bool32 CanFling(u32 battlerId) +bool32 CanFling(u32 battler) { - u16 item = gBattleMons[battlerId].item; + u16 item = gBattleMons[battler].item; if (item == ITEM_NONE #if B_KLUTZ_FLING_INTERACTION >= GEN_5 - || GetBattlerAbility(battlerId) == ABILITY_KLUTZ + || GetBattlerAbility(battler) == ABILITY_KLUTZ #endif || gFieldStatuses & STATUS_FIELD_MAGIC_ROOM - || gDisableStructs[battlerId].embargoTimer != 0 + || gDisableStructs[battler].embargoTimer != 0 || GetFlingPowerFromItemId(item) == 0 - || !CanBattlerGetOrLoseItem(battlerId, item)) + || !CanBattlerGetOrLoseItem(battler, item)) return FALSE; return TRUE; @@ -10606,7 +10813,7 @@ bool32 IsEntrainmentTargetOrSimpleBeamBannedAbility(u16 ability) // Sort an array of battlers by speed // Useful for effects like pickpocket, eject button, red card, dancer -void SortBattlersBySpeed(u8 *battlers, bool8 slowToFast) +void SortBattlersBySpeed(u8 *battlers, bool32 slowToFast) { int i, j, currSpeed, currBattler; u16 speeds[MAX_BATTLERS_COUNT] = {0}; @@ -10662,7 +10869,7 @@ void TryRestoreHeldItems(void) } } -bool32 CanStealItem(u8 battlerStealing, u8 battlerItem, u16 item) +bool32 CanStealItem(u32 battlerStealing, u32 battlerItem, u16 item) { u8 stealerSide = GetBattlerSide(battlerStealing); @@ -10702,7 +10909,7 @@ bool32 CanStealItem(u8 battlerStealing, u8 battlerItem, u16 item) return TRUE; } -void TrySaveExchangedItem(u8 battlerId, u16 stolenItem) +void TrySaveExchangedItem(u32 battler, u16 stolenItem) { // Because BtlController_EmitSetMonData does SetMonData, we need to save the stolen item only if it matches the battler's original // So, if the player steals an item during battle and has it stolen from it, it will not end the battle with it (naturally) @@ -10710,46 +10917,46 @@ void TrySaveExchangedItem(u8 battlerId, u16 stolenItem) // If regular trainer battle and mon's original item matches what is being stolen, save it to be restored at end of battle if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER) - && GetBattlerSide(battlerId) == B_SIDE_PLAYER - && stolenItem == gBattleStruct->itemLost[gBattlerPartyIndexes[battlerId]].originalItem) - gBattleStruct->itemLost[gBattlerPartyIndexes[battlerId]].stolen = TRUE; + && GetBattlerSide(battler) == B_SIDE_PLAYER + && stolenItem == gBattleStruct->itemLost[gBattlerPartyIndexes[battler]].originalItem) + gBattleStruct->itemLost[gBattlerPartyIndexes[battler]].stolen = TRUE; #endif } -bool32 IsBattlerAffectedByHazards(u8 battlerId, bool32 toxicSpikes) +bool32 IsBattlerAffectedByHazards(u32 battler, bool32 toxicSpikes) { bool32 ret = TRUE; - u32 holdEffect = GetBattlerHoldEffect(gActiveBattler, TRUE); - if (toxicSpikes && holdEffect == HOLD_EFFECT_HEAVY_DUTY_BOOTS && !IS_BATTLER_OF_TYPE(battlerId, TYPE_POISON)) + u32 holdEffect = GetBattlerHoldEffect(battler, TRUE); + if (toxicSpikes && holdEffect == HOLD_EFFECT_HEAVY_DUTY_BOOTS && !IS_BATTLER_OF_TYPE(battler, TYPE_POISON)) { ret = FALSE; - RecordItemEffectBattle(battlerId, holdEffect); + RecordItemEffectBattle(battler, holdEffect); } else if (holdEffect == HOLD_EFFECT_HEAVY_DUTY_BOOTS) { ret = FALSE; - RecordItemEffectBattle(battlerId, holdEffect); + RecordItemEffectBattle(battler, holdEffect); } return ret; } -bool32 TestSheerForceFlag(u8 battler, u16 move) +bool32 TestSheerForceFlag(u32 battler, u16 move) { - if (GetBattlerAbility(battler) == ABILITY_SHEER_FORCE && gBattleMoves[move].flags & FLAG_SHEER_FORCE_BOOST) + if (GetBattlerAbility(battler) == ABILITY_SHEER_FORCE && gBattleMoves[move].sheerForceBoost) return TRUE; else return FALSE; } // This function is the body of "jumpifstat", but can be used dynamically in a function -bool32 CompareStat(u8 battlerId, u8 statId, u8 cmpTo, u8 cmpKind) +bool32 CompareStat(u32 battler, u8 statId, u8 cmpTo, u8 cmpKind) { - bool8 ret = FALSE; - u8 statValue = gBattleMons[battlerId].statStages[statId]; + bool32 ret = FALSE; + u8 statValue = gBattleMons[battler].statStages[statId]; // Because this command is used as a way of checking if a stat can be lowered/raised, // we need to do some modification at run-time. - if (GetBattlerAbility(battlerId) == ABILITY_CONTRARY) + if (GetBattlerAbility(battler) == ABILITY_CONTRARY) { if (cmpKind == CMP_GREATER_THAN) cmpKind = CMP_LESS_THAN; @@ -10793,9 +11000,9 @@ bool32 CompareStat(u8 battlerId, u8 statId, u8 cmpTo, u8 cmpKind) return ret; } -void BufferStatChange(u8 battlerId, u8 statId, u8 stringId) +void BufferStatChange(u32 battler, u8 statId, u8 stringId) { - bool8 hasContrary = (GetBattlerAbility(battlerId) == ABILITY_CONTRARY); + bool32 hasContrary = (GetBattlerAbility(battler) == ABILITY_CONTRARY); PREPARE_STAT_BUFFER(gBattleTextBuff1, statId); if (stringId == STRINGID_STATFELL) @@ -10818,16 +11025,16 @@ void BufferStatChange(u8 battlerId, u8 statId, u8 stringId) } } -bool32 TryRoomService(u8 battlerId) +bool32 TryRoomService(u32 battler) { - if (gFieldStatuses & STATUS_FIELD_TRICK_ROOM && CompareStat(battlerId, STAT_SPEED, MIN_STAT_STAGE, CMP_GREATER_THAN)) + if (gFieldStatuses & STATUS_FIELD_TRICK_ROOM && CompareStat(battler, STAT_SPEED, MIN_STAT_STAGE, CMP_GREATER_THAN)) { - BufferStatChange(battlerId, STAT_SPEED, STRINGID_STATFELL); - gEffectBattler = gBattleScripting.battler = battlerId; + BufferStatChange(battler, STAT_SPEED, STRINGID_STATFELL); + gEffectBattler = gBattleScripting.battler = battler; SET_STATCHANGER(STAT_SPEED, 1, TRUE); gBattleScripting.animArg1 = 14 + STAT_SPEED; gBattleScripting.animArg2 = 0; - gLastUsedItem = gBattleMons[battlerId].item; + gLastUsedItem = gBattleMons[battler].item; return TRUE; } else @@ -10836,7 +11043,7 @@ bool32 TryRoomService(u8 battlerId) } } -bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef, bool32 checkTarget) +bool32 BlocksPrankster(u16 move, u32 battlerPrankster, u32 battlerDef, bool32 checkTarget) { #if B_PRANKSTER_DARK_TYPES >= GEN_7 if (!gProtectStructs[battlerPrankster].pranksterElevated) @@ -10855,17 +11062,17 @@ bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef, bool32 chec return FALSE; } -u16 GetUsedHeldItem(u8 battler) +u16 GetUsedHeldItem(u32 battler) { return gBattleStruct->usedHeldItems[gBattlerPartyIndexes[battler]][GetBattlerSide(battler)]; } -bool32 IsBattlerWeatherAffected(u8 battlerId, u32 weatherFlags) +bool32 IsBattlerWeatherAffected(u32 battler, u32 weatherFlags) { if (gBattleWeather & weatherFlags && WEATHER_HAS_EFFECT) { // given weather is active -> check if its sun, rain against utility umbrella ( since only 1 weather can be active at once) - if (gBattleWeather & (B_WEATHER_SUN | B_WEATHER_RAIN) && GetBattlerHoldEffect(battlerId, TRUE) == HOLD_EFFECT_UTILITY_UMBRELLA) + if (gBattleWeather & (B_WEATHER_SUN | B_WEATHER_RAIN) && GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_UTILITY_UMBRELLA) return FALSE; // utility umbrella blocks sun, rain effects return TRUE; @@ -10873,48 +11080,20 @@ bool32 IsBattlerWeatherAffected(u8 battlerId, u32 weatherFlags) return FALSE; } -// Utility Umbrella holders take normal damage from what would be rain- and sun-weakened attacks. -u32 ApplyWeatherDamageMultiplier(u8 battlerAtk, u16 move, u8 moveType, u32 dmg, u16 holdEffectAtk, u16 holdEffectDef) -{ - if (WEATHER_HAS_EFFECT) - { - if (gBattleMoves[move].effect == EFFECT_HYDRO_STEAM && (gBattleWeather & B_WEATHER_SUN) && holdEffectAtk != HOLD_EFFECT_UTILITY_UMBRELLA) - dmg = ApplyModifier(UQ_4_12(1.5), dmg); - else if (holdEffectDef != HOLD_EFFECT_UTILITY_UMBRELLA) - { - if (gBattleWeather & B_WEATHER_RAIN) - { - if (moveType == TYPE_FIRE) - dmg = ApplyModifier(UQ_4_12(0.5), dmg); - else if (moveType == TYPE_WATER) - dmg = ApplyModifier(UQ_4_12(1.5), dmg); - } - else if (gBattleWeather & B_WEATHER_SUN) - { - if (moveType == TYPE_FIRE) - dmg = ApplyModifier(UQ_4_12(1.5), dmg); - else if (moveType == TYPE_WATER) - dmg = ApplyModifier(UQ_4_12(0.5), dmg); - } - } - } - return dmg; -} - // Gets move target before redirection effects etc. are applied // Possible return values are defined in battle.h following MOVE_TARGET_SELECTED -u32 GetBattlerMoveTargetType(u8 battlerId, u16 move) +u32 GetBattlerMoveTargetType(u32 battler, u32 move) { u32 target; if (gBattleMoves[move].effect == EFFECT_EXPANDING_FORCE - && IsBattlerTerrainAffected(battlerId, STATUS_FIELD_PSYCHIC_TERRAIN)) + && IsBattlerTerrainAffected(battler, STATUS_FIELD_PSYCHIC_TERRAIN)) return MOVE_TARGET_BOTH; else return gBattleMoves[move].target; } -bool32 CanTargetBattler(u8 battlerAtk, u8 battlerDef, u16 move) +bool32 CanTargetBattler(u32 battlerAtk, u32 battlerDef, u16 move) { if (gBattleMoves[move].effect == EFFECT_HIT_ENEMY_HEAL_ALLY && GetBattlerSide(battlerAtk) == GetBattlerSide(battlerDef) @@ -10968,33 +11147,55 @@ void RecalcBattlerStats(u32 battler, struct Pokemon *mon) CopyMonAbilityAndTypesToBattleMon(battler, mon); } -void RemoveConfusionStatus(u8 battlerId) +void RemoveConfusionStatus(u32 battler) { - gBattleMons[battlerId].status2 &= ~STATUS2_CONFUSION; - gStatuses4[battlerId] &= ~STATUS4_INFINITE_CONFUSION; + gBattleMons[battler].status2 &= ~STATUS2_CONFUSION; + gStatuses4[battler] &= ~STATUS4_INFINITE_CONFUSION; } -static bool8 CanBeInfinitelyConfused(u8 battlerId) +static bool32 CanBeInfinitelyConfused(u32 battler) { - if (gBattleMons[battlerId].ability == ABILITY_OWN_TEMPO - || IsBattlerTerrainAffected(battlerId, STATUS_FIELD_MISTY_TERRAIN) - || gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD) + if (gBattleMons[battler].ability == ABILITY_OWN_TEMPO + || IsBattlerTerrainAffected(battler, STATUS_FIELD_MISTY_TERRAIN) + || gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_SAFEGUARD) { return FALSE; } return TRUE; } -u8 GetBattlerGender(u8 battlerId) +u8 GetBattlerGender(u32 battler) { - return GetGenderFromSpeciesAndPersonality(gBattleMons[battlerId].species, - gBattleMons[battlerId].personality); + return GetGenderFromSpeciesAndPersonality(gBattleMons[battler].species, + gBattleMons[battler].personality); } -bool8 AreBattlersOfOppositeGender(u8 battler1, u8 battler2) +bool32 AreBattlersOfOppositeGender(u32 battler1, u32 battler2) { u8 gender1 = GetBattlerGender(battler1); u8 gender2 = GetBattlerGender(battler2); return (gender1 != MON_GENDERLESS && gender2 != MON_GENDERLESS && gender1 != gender2); } + +u32 CalcSecondaryEffectChance(u32 battler, u8 secondaryEffectChance) +{ + if (GetBattlerAbility(battler) == ABILITY_SERENE_GRACE) + secondaryEffectChance *= 2; + + return secondaryEffectChance; +} + +bool32 IsAlly(u32 battlerAtk, u32 battlerDef) +{ + return (GetBattlerSide(battlerAtk) == GetBattlerSide(battlerDef)); +} + +bool32 IsGen6ExpShareEnabled(void) +{ +#if I_EXP_SHARE_ITEM < GEN_6 + return FALSE; +#else + return FlagGet(I_EXP_SHARE_FLAG); +#endif +} diff --git a/src/battle_util2.c b/src/battle_util2.c index 0f04a6eb4eb1..8dda3004c057 100644 --- a/src/battle_util2.c +++ b/src/battle_util2.c @@ -72,7 +72,7 @@ void FreeBattleResources(void) } } -void AdjustFriendshipOnBattleFaint(u8 battlerId) +void AdjustFriendshipOnBattleFaint(u8 battler) { u8 opposingBattlerId; @@ -91,28 +91,28 @@ void AdjustFriendshipOnBattleFaint(u8 battlerId) opposingBattlerId = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); } - if (gBattleMons[opposingBattlerId].level > gBattleMons[battlerId].level) + if (gBattleMons[opposingBattlerId].level > gBattleMons[battler].level) { - if (gBattleMons[opposingBattlerId].level - gBattleMons[battlerId].level > 29) - AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battlerId]], FRIENDSHIP_EVENT_FAINT_LARGE); + if (gBattleMons[opposingBattlerId].level - gBattleMons[battler].level > 29) + AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battler]], FRIENDSHIP_EVENT_FAINT_LARGE); else - AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battlerId]], FRIENDSHIP_EVENT_FAINT_SMALL); + AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battler]], FRIENDSHIP_EVENT_FAINT_SMALL); } else { - AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battlerId]], FRIENDSHIP_EVENT_FAINT_SMALL); + AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battler]], FRIENDSHIP_EVENT_FAINT_SMALL); } } -void SwitchPartyOrderInGameMulti(u8 battlerId, u8 arg1) +void SwitchPartyOrderInGameMulti(u8 battler, u8 arg1) { - if (GetBattlerSide(battlerId) != B_SIDE_OPPONENT) + if (GetBattlerSide(battler) != B_SIDE_OPPONENT) { s32 i; for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++) gBattlePartyCurrentOrder[i] = *(0 * 3 + i + (u8 *)(gBattleStruct->battlerPartyOrders)); - SwitchPartyMonSlots(GetPartyIdFromBattlePartyId(gBattlerPartyIndexes[battlerId]), GetPartyIdFromBattlePartyId(arg1)); + SwitchPartyMonSlots(GetPartyIdFromBattlePartyId(gBattlerPartyIndexes[battler]), GetPartyIdFromBattlePartyId(arg1)); for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++) *(0 * 3 + i + (u8 *)(gBattleStruct->battlerPartyOrders)) = gBattlePartyCurrentOrder[i]; @@ -121,7 +121,7 @@ void SwitchPartyOrderInGameMulti(u8 battlerId, u8 arg1) // Called when a Pokémon is unable to attack during a Battle Palace battle. // Check if it was because they are frozen/asleep, and if so try to cure the status. -u32 BattlePalace_TryEscapeStatus(u8 battlerId) +u32 BattlePalace_TryEscapeStatus(u8 battler) { u32 effect = 0; @@ -130,13 +130,13 @@ u32 BattlePalace_TryEscapeStatus(u8 battlerId) switch (gBattleCommunication[MULTIUSE_STATE]) { case 0: - if (gBattleMons[battlerId].status1 & STATUS1_SLEEP) + if (gBattleMons[battler].status1 & STATUS1_SLEEP) { - if (UproarWakeUpCheck(battlerId)) + if (UproarWakeUpCheck(battler)) { // Wake up from Uproar - gBattleMons[battlerId].status1 &= ~(STATUS1_SLEEP); - gBattleMons[battlerId].status2 &= ~(STATUS2_NIGHTMARE); + gBattleMons[battler].status1 &= ~(STATUS1_SLEEP); + gBattleMons[battler].status2 &= ~(STATUS2_NIGHTMARE); BattleScriptPushCursor(); gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WOKE_UP_UPROAR; gBattlescriptCurrInstr = BattleScript_MoveUsedWokeUp; @@ -146,18 +146,18 @@ u32 BattlePalace_TryEscapeStatus(u8 battlerId) { u32 toSub; - if (GetBattlerAbility(battlerId) == ABILITY_EARLY_BIRD) + if (GetBattlerAbility(battler) == ABILITY_EARLY_BIRD) toSub = 2; else toSub = 1; // Reduce number of sleep turns - if ((gBattleMons[battlerId].status1 & STATUS1_SLEEP) < toSub) - gBattleMons[battlerId].status1 &= ~(STATUS1_SLEEP); + if ((gBattleMons[battler].status1 & STATUS1_SLEEP) < toSub) + gBattleMons[battler].status1 &= ~(STATUS1_SLEEP); else - gBattleMons[battlerId].status1 -= toSub; + gBattleMons[battler].status1 -= toSub; - if (gBattleMons[battlerId].status1 & STATUS1_SLEEP) + if (gBattleMons[battler].status1 & STATUS1_SLEEP) { // Still asleep gBattlescriptCurrInstr = BattleScript_MoveUsedIsAsleep; @@ -166,7 +166,7 @@ u32 BattlePalace_TryEscapeStatus(u8 battlerId) else { // Wake up - gBattleMons[battlerId].status2 &= ~(STATUS2_NIGHTMARE); + gBattleMons[battler].status2 &= ~(STATUS2_NIGHTMARE); BattleScriptPushCursor(); gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WOKE_UP; gBattlescriptCurrInstr = BattleScript_MoveUsedWokeUp; @@ -177,7 +177,7 @@ u32 BattlePalace_TryEscapeStatus(u8 battlerId) gBattleCommunication[MULTIUSE_STATE]++; break; case 1: - if (gBattleMons[battlerId].status1 & STATUS1_FREEZE) + if (gBattleMons[battler].status1 & STATUS1_FREEZE) { if (Random() % 5 != 0) { @@ -187,7 +187,7 @@ u32 BattlePalace_TryEscapeStatus(u8 battlerId) else { // Unfreeze - gBattleMons[battlerId].status1 &= ~(STATUS1_FREEZE); + gBattleMons[battler].status1 &= ~(STATUS1_FREEZE); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_MoveUsedUnfroze; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DEFROSTED; @@ -204,9 +204,8 @@ u32 BattlePalace_TryEscapeStatus(u8 battlerId) if (effect == 2) { - gActiveBattler = battlerId; - BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); - MarkBattlerForControllerExec(gActiveBattler); + BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); + MarkBattlerForControllerExec(battler); } return effect; diff --git a/src/battle_z_move.c b/src/battle_z_move.c index f17de921d3ac..d760148b51f8 100644 --- a/src/battle_z_move.c +++ b/src/battle_z_move.c @@ -48,12 +48,12 @@ static void SpriteCB_ZMoveTrigger(struct Sprite *sprite); static u16 GetSignatureZMove(u16 move, u16 species, u16 item); static u16 GetTypeBasedZMove(u16 move, u8 battler); -static void ZMoveSelectionDisplayPpNumber(void); +static void ZMoveSelectionDisplayPpNumber(u32 battler); static void ZMoveSelectionDisplayPower(u16 move, u16 zMove); static void ShowZMoveTriggerSprite(u8 battleId); -static bool32 AreStatsMaxed(u8 battlerId, u8 n); +static bool32 AreStatsMaxed(u8 battler, u8 n); static u8 GetZMoveScore(u8 battlerAtk, u8 battlerDef, u16 baseMove, u16 zMove); -static void ZMoveSelectionDisplayMoveType(u16 zMove); +static void ZMoveSelectionDisplayMoveType(u16 zMove, u32 battler); // Const Data static const struct SignatureZMove sSignatureZMoves[] = @@ -146,57 +146,52 @@ bool8 IsZMove(u16 move) return move >= FIRST_Z_MOVE && move <= LAST_Z_MOVE; } -void QueueZMove(u8 battlerId, u16 baseMove) +void QueueZMove(u8 battler, u16 baseMove) { - gBattleStruct->zmove.toBeUsed[battlerId] = gBattleStruct->zmove.chosenZMove; - gBattleStruct->zmove.baseMoves[battlerId] = baseMove; + gBattleStruct->zmove.toBeUsed[battler] = gBattleStruct->zmove.chosenZMove; + gBattleStruct->zmove.baseMoves[battler] = baseMove; if (gBattleStruct->zmove.chosenZMove == MOVE_LIGHT_THAT_BURNS_THE_SKY) - gBattleStruct->zmove.splits[battlerId] = GetSplitBasedOnStats(battlerId); + gBattleStruct->zmove.splits[battler] = GetSplitBasedOnStats(battler); else - gBattleStruct->zmove.splits[battlerId] = gBattleMoves[baseMove].split; + gBattleStruct->zmove.splits[battler] = gBattleMoves[baseMove].split; } -bool32 IsViableZMove(u8 battlerId, u16 move) +bool32 IsViableZMove(u8 battler, u16 move) { struct Pokemon *mon; - u8 battlerPosition = GetBattlerPosition(battlerId); - u8 partnerPosition = GetBattlerPosition(BATTLE_PARTNER(battlerId)); + u8 battlerPosition = GetBattlerPosition(battler); + u8 partnerPosition = GetBattlerPosition(BATTLE_PARTNER(battler)); u32 item; u16 holdEffect; u16 species; int moveSlotIndex; - species = gBattleMons[battlerId].species; - item = gBattleMons[battlerId].item; + species = gBattleMons[battler].species; + item = gBattleMons[battler].item; for (moveSlotIndex = 0; moveSlotIndex < MAX_MON_MOVES; moveSlotIndex++) { - if (gBattleMons[battlerId].moves[moveSlotIndex] == move && gBattleMons[battlerId].pp[moveSlotIndex] == 0) + if (gBattleMons[battler].moves[moveSlotIndex] == move && gBattleMons[battler].pp[moveSlotIndex] == 0) return FALSE; } - if (gBattleStruct->zmove.used[battlerId]) + if (gBattleStruct->zmove.used[battler]) return FALSE; if (gBattleTypeFlags & (BATTLE_TYPE_SAFARI | BATTLE_TYPE_WALLY_TUTORIAL | BATTLE_TYPE_FRONTIER)) return FALSE; - if ((GetBattlerPosition(battlerId) == B_POSITION_PLAYER_LEFT || (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) && GetBattlerPosition(battlerId) == B_POSITION_PLAYER_RIGHT)) && !CheckBagHasItem(ITEM_Z_POWER_RING, 1)) + if ((GetBattlerPosition(battler) == B_POSITION_PLAYER_LEFT || (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) && GetBattlerPosition(battler) == B_POSITION_PLAYER_RIGHT)) && !CheckBagHasItem(ITEM_Z_POWER_RING, 1)) return FALSE; -#if DEBUG_BATTLE_MENU == TRUE - if (gBattleStruct->debugHoldEffects[battlerId]) - holdEffect = gBattleStruct->debugHoldEffects[battlerId]; - else -#endif if (item == ITEM_ENIGMA_BERRY_E_READER) - return FALSE; // HoldEffect = gEnigmaBerries[battlerId].holdEffect; + return FALSE; // HoldEffect = gEnigmaBerries[battler].holdEffect; else holdEffect = ItemId_GetHoldEffect(item); if (holdEffect == HOLD_EFFECT_Z_CRYSTAL) { - u16 zMove = GetSignatureZMove(move, gBattleMons[battlerId].species, item); + u16 zMove = GetSignatureZMove(move, gBattleMons[battler].species, item); if (zMove != MOVE_NONE) { gBattleStruct->zmove.chosenZMove = zMove; // Signature z move exists @@ -205,7 +200,7 @@ bool32 IsViableZMove(u8 battlerId, u16 move) if (move != MOVE_NONE && zMove != MOVE_Z_STATUS && gBattleMoves[move].type == ItemId_GetSecondaryId(item)) { - gBattleStruct->zmove.chosenZMove = GetTypeBasedZMove(move, battlerId); + gBattleStruct->zmove.chosenZMove = GetTypeBasedZMove(move, battler); return TRUE; } } @@ -213,34 +208,34 @@ bool32 IsViableZMove(u8 battlerId, u16 move) return FALSE; } -void GetUsableZMoves(u8 battlerId, u16 *moves) +void GetUsableZMoves(u8 battler, u16 *moves) { u32 i; - gBattleStruct->zmove.possibleZMoves[battlerId] = 0; + gBattleStruct->zmove.possibleZMoves[battler] = 0; for (i = 0; i < MAX_MON_MOVES; i++) { - if (moves[i] != MOVE_NONE && IsViableZMove(battlerId, moves[i])) - gBattleStruct->zmove.possibleZMoves[battlerId] |= (1 << i); + if (moves[i] != MOVE_NONE && IsViableZMove(battler, moves[i])) + gBattleStruct->zmove.possibleZMoves[battler] |= (1 << i); } } -bool32 IsZMoveUsable(u8 battlerId, u16 moveIndex) +bool32 IsZMoveUsable(u8 battler, u16 moveIndex) { - if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && IsPartnerMonFromSameTrainer(battlerId) && gBattleStruct->zmove.toBeUsed[BATTLE_PARTNER(battlerId)] != MOVE_NONE) + if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && IsPartnerMonFromSameTrainer(battler) && gBattleStruct->zmove.toBeUsed[BATTLE_PARTNER(battler)] != MOVE_NONE) return FALSE; // Player's other mon has a z move queued up already - if (gBattleStruct->zmove.possibleZMoves[battlerId] & (1 << moveIndex)) + if (gBattleStruct->zmove.possibleZMoves[battler] & (1 << moveIndex)) return TRUE; return FALSE; } -bool32 TryChangeZIndicator(u8 battlerId, u8 moveIndex) +bool32 TryChangeZIndicator(u8 battler, u8 moveIndex) { - bool32 viableZMove = IsZMoveUsable(battlerId, moveIndex); + bool32 viableZMove = IsZMoveUsable(battler, moveIndex); if (gBattleStruct->zmove.viable && !viableZMove) HideZMoveTriggerSprite(); // Was a viable z move, now is not -> slide out else if (!gBattleStruct->zmove.viable && viableZMove) - ShowZMoveTriggerSprite(battlerId); // Was not a viable z move, now is -> slide back in + ShowZMoveTriggerSprite(battler); // Was not a viable z move, now is -> slide back in } #define SINGLES_Z_TRIGGER_POS_X_OPTIMAL (29) @@ -256,7 +251,7 @@ bool32 TryChangeZIndicator(u8 battlerId, u8 moveIndex) #define tBattler data[0] #define tHide data[1] -void CreateZMoveTriggerSprite(u8 battlerId, bool8 viable) +void CreateZMoveTriggerSprite(u8 battler, bool8 viable) { s16 x, y; @@ -266,19 +261,19 @@ void CreateZMoveTriggerSprite(u8 battlerId, bool8 viable) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { - x = gSprites[gHealthboxSpriteIds[battlerId]].x - DOUBLES_Z_TRIGGER_POS_X_SLIDE; - y = gSprites[gHealthboxSpriteIds[battlerId]].y - DOUBLES_Z_TRIGGER_POS_Y_DIFF; + x = gSprites[gHealthboxSpriteIds[battler]].x - DOUBLES_Z_TRIGGER_POS_X_SLIDE; + y = gSprites[gHealthboxSpriteIds[battler]].y - DOUBLES_Z_TRIGGER_POS_Y_DIFF; } else { - x = gSprites[gHealthboxSpriteIds[battlerId]].x - SINGLES_Z_TRIGGER_POS_X_SLIDE; - y = gSprites[gHealthboxSpriteIds[battlerId]].y - SINGLES_Z_TRIGGER_POS_Y_DIFF, 0; + x = gSprites[gHealthboxSpriteIds[battler]].x - SINGLES_Z_TRIGGER_POS_X_SLIDE; + y = gSprites[gHealthboxSpriteIds[battler]].y - SINGLES_Z_TRIGGER_POS_Y_DIFF, 0; } if (gBattleStruct->zmove.triggerSpriteId == 0xFF) gBattleStruct->zmove.triggerSpriteId = CreateSprite(&sSpriteTemplate_ZMoveTrigger, x, y, 0); - gSprites[gBattleStruct->zmove.triggerSpriteId].tBattler = battlerId; + gSprites[gBattleStruct->zmove.triggerSpriteId].tBattler = battler; gSprites[gBattleStruct->zmove.triggerSpriteId].tHide = (viable == TRUE) ? FALSE : TRUE; } @@ -353,11 +348,11 @@ void HideZMoveTriggerSprite(void) sprite->tHide = TRUE; } -static void ShowZMoveTriggerSprite(u8 battlerId) +static void ShowZMoveTriggerSprite(u8 battler) { struct Sprite *sprite = &gSprites[gBattleStruct->zmove.triggerSpriteId]; gBattleStruct->zmove.viable = TRUE; - CreateZMoveTriggerSprite(battlerId, TRUE); + CreateZMoveTriggerSprite(battler, TRUE); } void DestroyZMoveTriggerSprite(void) @@ -397,11 +392,11 @@ static u16 GetTypeBasedZMove(u16 move, u8 battler) return MOVE_BREAKNECK_BLITZ + (moveType - 1); } -bool32 MoveSelectionDisplayZMove(u16 zmove) +bool32 MoveSelectionDisplayZMove(u16 zmove, u32 battler) { u32 i; - struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[gActiveBattler][4]); - u16 move = moveInfo->moves[gMoveSelectionCursor[gActiveBattler]]; + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]); + u16 move = moveInfo->moves[gMoveSelectionCursor[battler]]; PlaySE(SE_SELECT); gBattleStruct->zmove.viewing = TRUE; @@ -512,8 +507,8 @@ bool32 MoveSelectionDisplayZMove(u16 zmove) } BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MOVE_NAME_1); - ZMoveSelectionDisplayPpNumber(); - ZMoveSelectionDisplayMoveType(zmove); + ZMoveSelectionDisplayPpNumber(battler); + ZMoveSelectionDisplayMoveType(zmove, battler); MoveSelectionCreateCursorAt(0, 0); return TRUE; } @@ -537,26 +532,26 @@ static void ZMoveSelectionDisplayPower(u16 move, u16 zMove) } } -static void ZMoveSelectionDisplayPpNumber(void) +static void ZMoveSelectionDisplayPpNumber(u32 battler) { u8 *txtPtr; struct ChooseMoveStruct *moveInfo; - if (gBattleResources->bufferA[gActiveBattler][2] == TRUE) // Check if we didn't want to display pp number + if (gBattleResources->bufferA[battler][2] == TRUE) // Check if we didn't want to display pp number return; - SetPpNumbersPaletteInMoveSelection(); - moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[gActiveBattler][4]); + SetPpNumbersPaletteInMoveSelection(battler); + moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]); txtPtr = ConvertIntToDecimalStringN(gDisplayedStringBattle, 1, STR_CONV_MODE_RIGHT_ALIGN, 2); *(txtPtr)++ = CHAR_SLASH; ConvertIntToDecimalStringN(txtPtr, 1, STR_CONV_MODE_RIGHT_ALIGN, 2); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_PP_REMAINING); } -static void ZMoveSelectionDisplayMoveType(u16 zMove) +static void ZMoveSelectionDisplayMoveType(u16 zMove, u32 battler) { u8 *txtPtr; - struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[gActiveBattler][4]); + struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]); u8 zMoveType; GET_MOVE_TYPE(zMove, zMoveType); @@ -688,12 +683,12 @@ void SetZEffect(void) gBattleStruct->zmove.zStatusActive = FALSE; } -static bool32 AreStatsMaxed(u8 battlerId, u8 n) +static bool32 AreStatsMaxed(u8 battler, u8 n) { u32 i; for (i = STAT_ATK; i <= n; i++) { - if (STAT_STAGE(battlerId, i) < MAX_STAT_STAGE) + if (STAT_STAGE(battler, i) < MAX_STAT_STAGE) return FALSE; } return TRUE; diff --git a/src/berry_blender.c b/src/berry_blender.c index 60c38370f796..0f22ad0167ac 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -3109,10 +3109,10 @@ static void DrawBlenderCenter(struct BgAffineSrcData *dest) { struct BgAffineSrcData affineSrc; - affineSrc.texX = 0x7800; - affineSrc.texY = 0x5000; - affineSrc.scrX = 0x78 - sBerryBlender->bg_X; - affineSrc.scrY = 0x50 - sBerryBlender->bg_Y; + affineSrc.texX = (DISPLAY_WIDTH / 2) << 8; + affineSrc.texY = (DISPLAY_HEIGHT / 2) << 8; + affineSrc.scrX = DISPLAY_WIDTH / 2 - sBerryBlender->bg_X; + affineSrc.scrY = DISPLAY_HEIGHT / 2 - sBerryBlender->bg_Y; affineSrc.sx = sBerryBlender->centerScale; affineSrc.sy = sBerryBlender->centerScale; affineSrc.alpha = sBerryBlender->arrowPos; diff --git a/src/berry_crush.c b/src/berry_crush.c index c0a72713a2de..bee0e9085ac6 100755 --- a/src/berry_crush.c +++ b/src/berry_crush.c @@ -2898,13 +2898,13 @@ static u32 Cmd_FinishGame(struct BerryCrushGame *game, u8 *args) case 0: game->gameState = STATE_FINISHED; PlaySE(SE_M_STRENGTH); - BlendPalettes(PALETTES_ALL, 8, RGB(31, 31, 0)); + BlendPalettes(PALETTES_ALL, 8, RGB_YELLOW); game->gfx.counter = 2; break; case 1: if (--game->gfx.counter != (u8)-1) return 0; - BlendPalettes(PALETTES_ALL, 0, RGB(31, 31, 0)); + BlendPalettes(PALETTES_ALL, 0, RGB_YELLOW); game->gfx.vibrationIdx = 4; game->gfx.counter = 0; game->gfx.numVibrations = sIntroOutroVibrationData[game->gfx.vibrationIdx][0]; @@ -2955,13 +2955,13 @@ static u32 Cmd_HandleTimeUp(struct BerryCrushGame *game, u8 *args) case 0: game->gameState = STATE_TIMES_UP; PlaySE(SE_FAILURE); - BlendPalettes(PALETTES_ALL, 8, RGB(31, 0, 0)); + BlendPalettes(PALETTES_ALL, 8, RGB_RED); game->gfx.counter = 4; break; case 1: if (--game->gfx.counter != (u8)-1) return 0; - BlendPalettes(PALETTES_ALL, 0, RGB(31, 0, 0)); + BlendPalettes(PALETTES_ALL, 0, RGB_RED); game->gfx.counter = 0; break; case 2: diff --git a/src/berry_fix_graphics.c b/src/berry_fix_graphics.c index b37645d4c29b..d766c3966253 100644 --- a/src/berry_fix_graphics.c +++ b/src/berry_fix_graphics.c @@ -8,9 +8,9 @@ static const struct { const u16 *pltt; } sBerryFixGraphics[] = { { - gBerryFixGameboy_Gfx, - gBerryFixGameboy_Tilemap, - gBerryFixGameboy_Pal + gBerryFixGbaConnect_Gfx, + gBerryFixGbaConnect_Tilemap, + gBerryFixGbaConnect_Pal }, { gBerryFixGameboyLogo_Gfx, gBerryFixGameboyLogo_Tilemap, @@ -43,7 +43,7 @@ static void LoadBerryFixGraphics(u32 idx) REG_BLDCNT = 0; LZ77UnCompVram(sBerryFixGraphics[idx].gfx, (void *)BG_CHAR_ADDR(0)); LZ77UnCompVram(sBerryFixGraphics[idx].tilemap, (void *)BG_SCREEN_ADDR(31)); - CpuCopy16(sBerryFixGraphics[idx].pltt, (void *)PLTT, 0x200); - REG_BG0CNT = 0x1f00; + CpuCopy16(sBerryFixGraphics[idx].pltt, (void *)BG_PLTT, BG_PLTT_SIZE); + REG_BG0CNT = BGCNT_SCREENBASE(31); REG_DISPCNT = DISPCNT_BG0_ON; } diff --git a/src/berry_fix_program.c b/src/berry_fix_program.c index 26af445a08c8..5900cb298abb 100644 --- a/src/berry_fix_program.c +++ b/src/berry_fix_program.c @@ -117,13 +117,7 @@ static const struct WindowTemplate sBerryFixWindowTemplates[] = { DUMMY_WIN_TEMPLATE }; -static const u16 ALIGNED(4) sBerryFixPalColors[] = { - RGB_WHITE, RGB_WHITE, RGB(12, 12, 12), RGB(26, 26, 25), - RGB(28, 1, 1), RGB(31, 23, 14), RGB(4, 19, 1), RGB(18, 30, 18), - RGB(6, 10, 25), RGB(20, 24, 30), RGB_WHITE, RGB(12, 12, 12), - RGB(26, 26, 25), RGB_BLACK, RGB_BLACK, RGB_BLACK -}; - +static const u16 ALIGNED(4) sText_Pal[] = INCBIN_U16("graphics/berry_fix/text.gbapal"); static const u8 sBerryProgramTextColors[] = {TEXT_DYNAMIC_COLOR_1, TEXT_DYNAMIC_COLOR_2, TEXT_DYNAMIC_COLOR_3}; static const u8 sGameTitleTextColors[] = { TEXT_COLOR_TRANSPARENT, TEXT_DYNAMIC_COLOR_1, TEXT_DYNAMIC_COLOR_4}; @@ -152,9 +146,9 @@ static const struct { const u16 *palette; } sBerryFixGraphics[] = { [SCENE_ENSURE_CONNECT] = { - gBerryFixGameboy_Gfx, - gBerryFixGameboy_Tilemap, - gBerryFixGameboy_Pal + gBerryFixGbaConnect_Gfx, + gBerryFixGbaConnect_Tilemap, + gBerryFixGbaConnect_Pal }, [SCENE_TURN_OFF_POWER] = { gBerryFixGameboyLogo_Gfx, @@ -304,7 +298,7 @@ static void BerryFix_GpuSet(void) InitWindows(sBerryFixWindowTemplates); DeactivateAllTextPrinters(); - DmaCopy32(3, sBerryFixPalColors, BG_PLTT + 0x1E0, sizeof(sBerryFixPalColors)); + DmaCopy32(3, sText_Pal, BG_PLTT + PLTT_OFFSET_4BPP(15), sizeof(sText_Pal)); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP); FillWindowPixelBuffer(WIN_GAME_NAMES, PIXEL_FILL(0)); FillWindowPixelBuffer(WIN_TURN_OFF_TITLE, PIXEL_FILL(0)); @@ -374,7 +368,9 @@ static void BerryFix_SetScene(int scene) CopyBgTilemapBufferToVram(0); LZ77UnCompVram(sBerryFixGraphics[scene].gfx, (void *)BG_CHAR_ADDR(1)); LZ77UnCompVram(sBerryFixGraphics[scene].tilemap, (void *)BG_SCREEN_ADDR(31)); - CpuCopy32(sBerryFixGraphics[scene].palette, (void *)BG_PLTT, 0x100); + // These palettes range in size from 32-48 colors, so the below is interpreting whatever + // follows the palette (by default, the corresponding tiles) as the remaining 80-96. + CpuCopy32(sBerryFixGraphics[scene].palette, (void *)BG_PLTT, PLTT_SIZEOF(128)); ShowBg(0); ShowBg(1); } diff --git a/src/berry_tag_screen.c b/src/berry_tag_screen.c index 216aff69674a..c6eb731845e2 100644 --- a/src/berry_tag_screen.c +++ b/src/berry_tag_screen.c @@ -310,6 +310,8 @@ static void HandleInitBackgrounds(void) ShowBg(3); } +#define BG_TILE 0x42 + static bool8 LoadBerryTagGfx(void) { u16 i; @@ -333,15 +335,16 @@ static bool8 LoadBerryTagGfx(void) sBerryTag->gfxState++; break; case 3: + // Palette of the bg tiles changes depending on the player's gender if (gSaveBlock2Ptr->playerGender == MALE) { for (i = 0; i < ARRAY_COUNT(sBerryTag->tilemapBuffers[1]); i++) - sBerryTag->tilemapBuffers[1][i] = 0x4042; + sBerryTag->tilemapBuffers[1][i] = (4 << 12) | BG_TILE; } else { for (i = 0; i < ARRAY_COUNT(sBerryTag->tilemapBuffers[1]); i++) - sBerryTag->tilemapBuffers[1][i] = 0x5042; + sBerryTag->tilemapBuffers[1][i] = (5 << 12) | BG_TILE; } sBerryTag->gfxState++; break; @@ -545,6 +548,9 @@ static void Task_HandleInput(u8 taskId) } } +#define tBerryY data[0] +#define tBgOp data[1] + static void TryChangeDisplayedBerry(u8 taskId, s8 toMove) { s16 *data = gTasks[taskId].data; @@ -553,11 +559,11 @@ static void TryChangeDisplayedBerry(u8 taskId, s8 toMove) if (newPocketPosition < ITEM_TO_BERRY(LAST_BERRY_INDEX) && BagGetItemIdByPocketPosition(POCKET_BERRIES, newPocketPosition) != ITEM_NONE) { if (toMove < 0) - data[1] = 2; + tBgOp = BG_COORD_SUB; else - data[1] = 1; + tBgOp = BG_COORD_ADD; - data[0] = 0; + tBerryY = 0; PlaySE(SE_SELECT); HandleBagCursorPositionChange(toMove); gTasks[taskId].func = Task_DisplayAnotherBerry; @@ -586,101 +592,103 @@ static void HandleBagCursorPositionChange(s8 toMove) sBerryTag->berryId = ItemIdToBerryType(BagGetItemIdByPocketPosition(POCKET_BERRIES, *scrollPos + *cursorPos)); } +#define DISPLAY_SPEED 16 + static void Task_DisplayAnotherBerry(u8 taskId) { u16 i; - s16 posY; + s16 y; s16 *data = gTasks[taskId].data; - data[0] += 0x10; - data[0] &= 0xFF; + tBerryY += DISPLAY_SPEED; + tBerryY &= 0xFF; - if (data[1] == 1) + if (tBgOp == BG_COORD_ADD) { - switch (data[0]) + switch (tBerryY) { - case 0x30: + case 3 * DISPLAY_SPEED: FillWindowPixelBuffer(WIN_BERRY_NAME, PIXEL_FILL(0)); break; - case 0x40: + case 4 * DISPLAY_SPEED: PrintBerryNumberAndName(); break; - case 0x50: + case 5 * DISPLAY_SPEED: DestroyBerrySprite(); CreateBerrySprite(); break; - case 0x60: + case 6 * DISPLAY_SPEED: FillWindowPixelBuffer(WIN_SIZE_FIRM, PIXEL_FILL(0)); break; - case 0x70: + case 7 * DISPLAY_SPEED: PrintBerrySize(); break; - case 0x80: + case 8 * DISPLAY_SPEED: PrintBerryFirmness(); break; - case 0x90: + case 9 * DISPLAY_SPEED: SetFlavorCirclesVisiblity(); break; - case 0xA0: + case 10 * DISPLAY_SPEED: FillWindowPixelBuffer(WIN_DESC, PIXEL_FILL(0)); break; - case 0xB0: + case 11 * DISPLAY_SPEED: PrintBerryDescription1(); break; - case 0xC0: + case 12 * DISPLAY_SPEED: PrintBerryDescription2(); break; } } - else + else // BG_COORD_SUB { - switch (data[0]) + switch (tBerryY) { - case 0x30: + case 3 * DISPLAY_SPEED: FillWindowPixelBuffer(WIN_DESC, PIXEL_FILL(0)); break; - case 0x40: + case 4 * DISPLAY_SPEED: PrintBerryDescription2(); break; - case 0x50: + case 5 * DISPLAY_SPEED: PrintBerryDescription1(); break; - case 0x60: + case 6 * DISPLAY_SPEED: SetFlavorCirclesVisiblity(); break; - case 0x70: + case 7 * DISPLAY_SPEED: FillWindowPixelBuffer(WIN_SIZE_FIRM, PIXEL_FILL(0)); break; - case 0x80: + case 8 * DISPLAY_SPEED: PrintBerryFirmness(); break; - case 0x90: + case 9 * DISPLAY_SPEED: PrintBerrySize(); break; - case 0xA0: + case 10 * DISPLAY_SPEED: DestroyBerrySprite(); CreateBerrySprite(); break; - case 0xB0: + case 11 * DISPLAY_SPEED: FillWindowPixelBuffer(WIN_BERRY_NAME, PIXEL_FILL(0)); break; - case 0xC0: + case 12 * DISPLAY_SPEED: PrintBerryNumberAndName(); break; } } - if (data[1] == 1) - posY = -data[0]; + if (tBgOp == BG_COORD_ADD) + y = -tBerryY; else - posY = data[0]; + y = tBerryY; - gSprites[sBerryTag->berrySpriteId].y2 = posY; + gSprites[sBerryTag->berrySpriteId].y2 = y; for (i = 0; i < FLAVOR_COUNT; i++) - gSprites[sBerryTag->flavorCircleIds[i]].y2 = posY; + gSprites[sBerryTag->flavorCircleIds[i]].y2 = y; - ChangeBgY(1, 0x1000, data[1]); - ChangeBgY(2, 0x1000, data[1]); + ChangeBgY(1, 0x1000, tBgOp); + ChangeBgY(2, 0x1000, tBgOp); - if (data[0] == 0) + if (tBerryY == 0) gTasks[taskId].func = Task_HandleInput; } diff --git a/src/braille_puzzles.c b/src/braille_puzzles.c index 348742849535..49f73dd6b733 100644 --- a/src/braille_puzzles.c +++ b/src/braille_puzzles.c @@ -278,6 +278,8 @@ bool8 FldEff_UsePuzzleEffect(void) return FALSE; } +// The puzzle to unlock Regice's cave requires the player to interact with the braille message on the back wall, +// step on every space on the perimeter of the cave (and only those spaces) then return to the back wall. bool8 ShouldDoBrailleRegicePuzzle(void) { u8 i; @@ -287,9 +289,11 @@ bool8 ShouldDoBrailleRegicePuzzle(void) { if (FlagGet(FLAG_SYS_BRAILLE_REGICE_COMPLETED)) return FALSE; - if (FlagGet(FLAG_TEMP_2) == FALSE) + // Set when the player interacts with the braille message + if (FlagGet(FLAG_TEMP_REGICE_PUZZLE_STARTED) == FALSE) return FALSE; - if (FlagGet(FLAG_TEMP_3) == TRUE) + // Cleared when the player interacts with the braille message + if (FlagGet(FLAG_TEMP_REGICE_PUZZLE_FAILED) == TRUE) return FALSE; for (i = 0; i < ARRAY_COUNT(sRegicePathCoords); i++) @@ -298,8 +302,7 @@ bool8 ShouldDoBrailleRegicePuzzle(void) u8 yPos = sRegicePathCoords[i][1]; if (gSaveBlock1Ptr->pos.x == xPos && gSaveBlock1Ptr->pos.y == yPos) { - u16 varValue; - + // Player is standing on a correct space, set the corresponding bit if (i < 16) { u16 val = VarGet(VAR_REGICE_STEPS_1); @@ -319,11 +322,11 @@ bool8 ShouldDoBrailleRegicePuzzle(void) VarSet(VAR_REGICE_STEPS_3, val); } - varValue = VarGet(VAR_REGICE_STEPS_1); - if (varValue != 0xFFFF || VarGet(VAR_REGICE_STEPS_2) != 0xFFFF || VarGet(VAR_REGICE_STEPS_3) != 0xF) + // Make sure a full lap has been completed. There are 36 steps in a lap, so 16+16+4 bits to check across the 3 vars. + if (VarGet(VAR_REGICE_STEPS_1) != 0xFFFF || VarGet(VAR_REGICE_STEPS_2) != 0xFFFF || VarGet(VAR_REGICE_STEPS_3) != 0xF) return FALSE; - // This final check is redundant. + // A lap has been completed, the puzzle is complete when the player returns to the braille message. if (gSaveBlock1Ptr->pos.x == 8 && gSaveBlock1Ptr->pos.y == 21) return TRUE; else @@ -331,8 +334,9 @@ bool8 ShouldDoBrailleRegicePuzzle(void) } } - FlagSet(FLAG_TEMP_3); - FlagClear(FLAG_TEMP_2); + // Player stepped on an incorrect space, puzzle failed. + FlagSet(FLAG_TEMP_REGICE_PUZZLE_FAILED); + FlagClear(FLAG_TEMP_REGICE_PUZZLE_STARTED); } return FALSE; diff --git a/src/cable_car.c b/src/cable_car.c index 7d18df7b7f36..8a666a536e46 100644 --- a/src/cable_car.c +++ b/src/cable_car.c @@ -237,7 +237,7 @@ void CableCar(void) { LockPlayerFieldControls(); CreateTask(Task_LoadCableCar, 1); - BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB(0, 0, 0)); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); } static void CB2_LoadCableCar(void) @@ -341,7 +341,7 @@ static void CB2_LoadCableCar(void) gMain.state++; break; case 8: - BeginNormalPaletteFade(PALETTES_ALL, 3, 16, 0, RGB(0, 0, 0)); + BeginNormalPaletteFade(PALETTES_ALL, 3, 16, 0, RGB_BLACK); FadeInNewBGM(MUS_CABLE_CAR, 1); SetBgRegs(TRUE); gMain.state++; @@ -459,7 +459,7 @@ static void Task_CableCar(u8 taskId) if (sCableCar->timer == 570) { sCableCar->state = 3; - BeginNormalPaletteFade(PALETTES_ALL, 3, 0, 16, RGB(0, 0, 0)); + BeginNormalPaletteFade(PALETTES_ALL, 3, 0, 16, RGB_BLACK); FadeOutBGM(4); } break; diff --git a/src/cable_club.c b/src/cable_club.c index 913a1b72872d..7668c2aa9956 100644 --- a/src/cable_club.c +++ b/src/cable_club.c @@ -446,13 +446,13 @@ bool32 AreBattleTowerLinkSpeciesSame(u16 *speciesList1, u16 *speciesList2) { if (numSameSpecies == 0) { - StringCopy(gStringVar1, gSpeciesNames[speciesList1[i]]); + StringCopy(gStringVar1, GetSpeciesName(speciesList1[i])); haveSameSpecies = TRUE; } if (numSameSpecies == 1) { - StringCopy(gStringVar2, gSpeciesNames[speciesList1[i]]); + StringCopy(gStringVar2, GetSpeciesName(speciesList1[i])); haveSameSpecies = TRUE; } @@ -725,7 +725,7 @@ void TryContestEModeLinkup(void) u8 CreateTask_ReestablishCableClubLink(void) { if (FuncIsActiveTask(Task_ReestablishLink) != FALSE) - return 0xFF; + return TASK_NONE; switch (gSpecialVar_0x8004) { diff --git a/src/contest.c b/src/contest.c index 91bca846dd3a..36e76718c7a3 100644 --- a/src/contest.c +++ b/src/contest.c @@ -1112,10 +1112,10 @@ static void InitContestResources(void) for (i = 0; i < CONTESTANT_COUNT; i++) { - eContestantStatus[i].nextTurnOrder = 0xFF; + eContestantStatus[i].nextTurnOrder = CONTESTANT_NONE; eContest.prevTurnOrder[i] = gContestantTurnOrder[i]; } - // Calling this here while all the nextTurnOrder values are 0xFF will actually + // Calling this here while all the nextTurnOrder values are CONTESTANT_NONE will actually // just reverse the turn order. ApplyNextTurnOrder(); memset(gContestResources->tv, 0, sizeof(*gContestResources->tv) * CONTESTANT_COUNT); @@ -1189,7 +1189,6 @@ void CB2_StartContest(void) FreeAllSpritePalettes(); gReservedSpritePaletteCount = 4; eContestDebugMode = CONTEST_DEBUG_MODE_OFF; - ClearBattleMonForms(); InitContestResources(); gMain.state++; break; @@ -1778,8 +1777,6 @@ static void Task_DoAppeals(u8 taskId) } return; case APPEALSTATE_SLIDE_MON_IN: - for (i = 0; i < CONTESTANT_COUNT; i++) - gBattleMonForms[i] = 0; memset(gContestResources->moveAnim, 0, sizeof(*gContestResources->moveAnim)); SetMoveAnimAttackerData(eContest.currentContestant); spriteId = CreateContestantSprite( @@ -2775,7 +2772,7 @@ static bool8 IsPlayerLinkLeader(void) void CreateContestMonFromParty(u8 partyIndex) { - u8 name[20]; + u8 name[max(PLAYER_NAME_LENGTH + 1, POKEMON_NAME_BUFFER_SIZE)]; u16 heldItem; s16 cool; s16 beauty; @@ -2785,10 +2782,8 @@ void CreateContestMonFromParty(u8 partyIndex) StringCopy(name, gSaveBlock2Ptr->playerName); if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK) - { StripPlayerNameForLinkContest(name); - } - memcpy(gContestMons[gContestPlayerMonIndex].trainerName, name, 8); + memcpy(gContestMons[gContestPlayerMonIndex].trainerName, name, PLAYER_NAME_LENGTH + 1); if (gSaveBlock2Ptr->playerGender == MALE) gContestMons[gContestPlayerMonIndex].trainerGfxId = OBJ_EVENT_GFX_LINK_BRENDAN; else @@ -2891,7 +2886,7 @@ void SetContestants(u8 contestType, u8 rank) opponents[opponentsCount++] = i; } } - opponents[opponentsCount] = 0xFF; + opponents[opponentsCount] = CONTESTANT_NONE; // Choose three random opponents from the list for (i = 0; i < CONTESTANT_COUNT - 1; i++) @@ -2900,7 +2895,7 @@ void SetContestants(u8 contestType, u8 rank) s32 j; gContestMons[i] = gContestOpponents[opponents[rnd]]; - for (j = rnd; opponents[j] != 0xFF; j++) + for (j = rnd; opponents[j] != CONTESTANT_NONE; j++) opponents[j] = opponents[j + 1]; opponentsCount--; } @@ -2940,7 +2935,7 @@ void SetLinkAIContestants(u8 contestType, u8 rank, bool32 isPostgame) || (contestType == CONTEST_CATEGORY_TOUGH && gContestOpponents[i].aiPool_Tough)) opponents[opponentsCount++] = i; } - opponents[opponentsCount] = 0xFF; + opponents[opponentsCount] = CONTESTANT_NONE; // Fill remaining contestant slots with random AI opponents from the list for (i = 0; i < CONTESTANT_COUNT - gNumLinkContestPlayers; i++) @@ -2950,7 +2945,7 @@ void SetLinkAIContestants(u8 contestType, u8 rank, bool32 isPostgame) gContestMons[gNumLinkContestPlayers + i] = gContestOpponents[opponents[rnd]]; StripPlayerNameForLinkContest(gContestMons[gNumLinkContestPlayers + i].trainerName); StripMonNameForLinkContest(gContestMons[gNumLinkContestPlayers + i].nickname, GAME_LANGUAGE); - for (j = rnd; opponents[j] != 0xFF; j++) + for (j = rnd; opponents[j] != CONTESTANT_NONE; j++) opponents[j] = opponents[j + 1]; opponentsCount--; } @@ -4367,7 +4362,7 @@ void SortContestants(bool8 useRanking) // Note that ranking is calculated so that shared places still take up a ranking // space. A ranking like [1, 2, 2, 3] is not possible; it would be [1, 2, 2, 4] // instead. - memset(scratch, 0xFF, sizeof(scratch)); + memset(scratch, CONTESTANT_NONE, sizeof(scratch)); for (i = 0; i < CONTESTANT_COUNT; i++) { u8 j = eContestantStatus[i].ranking; @@ -4375,7 +4370,7 @@ void SortContestants(bool8 useRanking) while (1) { u8 *ptr = &scratch[j]; - if (*ptr == 0xFF) + if (*ptr == CONTESTANT_NONE) { *ptr = i; gContestantTurnOrder[i] = j; @@ -4633,7 +4628,7 @@ static void ApplyNextTurnOrder(void) // First, look for the first unassigned contestant. for (j = 0; j < CONTESTANT_COUNT; j++) { - if (!isContestantOrdered[j] && eContestantStatus[j].nextTurnOrder == 0xFF) + if (!isContestantOrdered[j] && eContestantStatus[j].nextTurnOrder == CONTESTANT_NONE) { nextContestant = j; j++; @@ -4644,7 +4639,7 @@ static void ApplyNextTurnOrder(void) // Then, look for a better candidate, with a higher turn order. for (; j < CONTESTANT_COUNT; j++) { - if (!isContestantOrdered[j] && eContestantStatus[j].nextTurnOrder == 0xFF + if (!isContestantOrdered[j] && eContestantStatus[j].nextTurnOrder == CONTESTANT_NONE && gContestantTurnOrder[nextContestant] > gContestantTurnOrder[j]) nextContestant = j; } @@ -4658,7 +4653,7 @@ static void ApplyNextTurnOrder(void) for (i = 0; i < CONTESTANT_COUNT; i++) { eContestAppealResults.turnOrder[i] = newTurnOrder[i]; - eContestantStatus[i].nextTurnOrder = 0xFF; + eContestantStatus[i].nextTurnOrder = CONTESTANT_NONE; eContestantStatus[i].turnOrderMod = 0; gContestantTurnOrder[i] = newTurnOrder[i]; } @@ -5312,8 +5307,6 @@ static void SetMoveSpecificAnimData(u8 contestant) memset(&gContestResources->moveAnim->species, 0, 20); ClearBattleAnimationVars(); - for (i = 0; i < CONTESTANT_COUNT; i++) - gBattleMonForms[i] = 0; switch (move) { case MOVE_CURSE: @@ -6017,8 +6010,10 @@ static u8 GetMonNicknameLanguage(u8 *nickname) if (nickname[0] == EXT_CTRL_CODE_BEGIN && nickname[1] == EXT_CTRL_CODE_JPN) return GAME_LANGUAGE; - if (StringLength(nickname) < PLAYER_NAME_LENGTH - 1) + if (StringLength(nickname) <= 5) { + // Name is short enough that it might be Japanese. + // Make sure all the character values are valid latin name characters. while (*nickname != EOS) { if ((*nickname >= CHAR_A && *nickname <= CHAR_z) @@ -6036,12 +6031,18 @@ static u8 GetMonNicknameLanguage(u8 *nickname) || *nickname == CHAR_DBL_QUOTE_LEFT || *nickname == CHAR_DBL_QUOTE_RIGHT || *nickname == CHAR_SGL_QUOTE_LEFT - || *nickname == CHAR_DBL_QUOTE_LEFT) // Most likely a typo, CHAR_SGL_QUOTE_RIGHT should be here instead. +#ifdef BUGFIX + || *nickname == CHAR_SGL_QUOTE_RIGHT +#else + || *nickname == CHAR_DBL_QUOTE_LEFT // Most likely a typo, CHAR_SGL_QUOTE_RIGHT should be here instead. +#endif + ) { nickname++; } else { + // Invalid latin name character, assume the name was Japanese. ret = LANGUAGE_JAPANESE; break; } @@ -6098,7 +6099,7 @@ void StripPlayerAndMonNamesForLinkContest(struct ContestPokemon *mon, s32 langua name = mon->trainerName; if (language == LANGUAGE_JAPANESE) { - name[PLAYER_NAME_LENGTH] = EOS; + name[7] = EOS; name[6] = name[4]; name[5] = name[3]; name[4] = name[2]; diff --git a/src/contest_ai.c b/src/contest_ai.c index 7aeba828a62f..a4bb5b454904 100644 --- a/src/contest_ai.c +++ b/src/contest_ai.c @@ -6,6 +6,8 @@ #include "contest_effect.h" #include "constants/moves.h" +#define AI_ACTION_DONE (1 << 0) + extern const u8 *gAIScriptPtr; extern const u8 *gContestAI_ScriptsTable[]; @@ -324,7 +326,7 @@ u8 ContestAI_GetActionToUse(void) { // Randomly choose a move index. If it's the move // with the highest (or tied highest) score, return - u8 moveIdx = Random() & (MAX_MON_MOVES - 1); // % MAX_MON_MOVES doesn't match + u8 moveIdx = MOD(Random(), MAX_MON_MOVES); u8 score = eContestAI.moveScores[moveIdx]; int i; for (i = 0; i < MAX_MON_MOVES; i++) @@ -362,9 +364,9 @@ static void ContestAI_DoAIProcessing(void) else { eContestAI.moveScores[eContestAI.nextMoveIndex] = 0; // don't consider a move that doesn't exist. - eContestAI.aiAction |= 1; + eContestAI.aiAction |= AI_ACTION_DONE; } - if (eContestAI.aiAction & 1) + if (eContestAI.aiAction & AI_ACTION_DONE) { eContestAI.nextMoveIndex++; if (eContestAI.nextMoveIndex < MAX_MON_MOVES) @@ -372,7 +374,7 @@ static void ContestAI_DoAIProcessing(void) else // aiState = CONTESTAI_FINISHED eContestAI.aiState++; - eContestAI.aiAction &= 0xFE; // TODO: Define action flags + eContestAI.aiAction &= ~AI_ACTION_DONE; } break; } @@ -1667,7 +1669,7 @@ static void ContestAICmd_call(void) static void ContestAICmd_end(void) { if (!AIStackPop()) - eContestAI.aiAction |= 1; + eContestAI.aiAction |= AI_ACTION_DONE; } static void AIStackPushVar(const u8 *ptr) diff --git a/src/contest_effect.c b/src/contest_effect.c index 1d70b8d128bd..ae0e9d76c573 100644 --- a/src/contest_effect.c +++ b/src/contest_effect.c @@ -147,7 +147,7 @@ static void ContestEffect_StartleFrontMon(void) break; } eContestAppealResults.jamQueue[0] = i; - eContestAppealResults.jamQueue[1] = 0xFF; + eContestAppealResults.jamQueue[1] = CONTESTANT_NONE; idx = WasAtLeastOneOpponentJammed(); } if (idx == 0) @@ -171,7 +171,7 @@ static void ContestEffect_StartlePrevMons(void) eContestAppealResults.jamQueue[j++] = i; } - eContestAppealResults.jamQueue[j] = 0xFF; + eContestAppealResults.jamQueue[j] = CONTESTANT_NONE; idx = WasAtLeastOneOpponentJammed(); } if (idx == 0) @@ -214,7 +214,7 @@ static void ContestEffect_StartlePrevMons2(void) u8 rval, jam; eContestAppealResults.jamQueue[0] = i; - eContestAppealResults.jamQueue[1] = 0xFF; + eContestAppealResults.jamQueue[1] = CONTESTANT_NONE; rval = Random() % 10; if (rval == 0) @@ -291,7 +291,7 @@ static void ContestEffect_StartleMonWithJudgesAttention(void) else eContestAppealResults.jam = 10; eContestAppealResults.jamQueue[0] = i; - eContestAppealResults.jamQueue[1] = 0xFF; + eContestAppealResults.jamQueue[1] = CONTESTANT_NONE; if (WasAtLeastOneOpponentJammed()) numStartled++; } @@ -396,7 +396,7 @@ static void ContestEffect_MakeFollowingMonsNervous(void) s16 oddsMod[CONTESTANT_COUNT]; s16 odds[CONTESTANT_COUNT]; - memset(contestantIds, 0xFF, ARRAY_COUNT(contestantIds)); + memset(contestantIds, CONTESTANT_NONE, ARRAY_COUNT(contestantIds)); for (i = 0, numAfter = 0; i < CONTESTANT_COUNT; i++) { if (eContestAppealResults.turnOrder[eContestAppealResults.contestant] < eContestAppealResults.turnOrder[i] && @@ -434,7 +434,7 @@ static void ContestEffect_MakeFollowingMonsNervous(void) } if (odds[0] != 0) { - for (i = 0; contestantIds[i] != 0xFF; i++) + for (i = 0; contestantIds[i] != CONTESTANT_NONE; i++) { if (Random() % 100 < odds[i] + oddsMod[contestantIds[i]]) { @@ -507,7 +507,7 @@ static void ContestEffect_BadlyStartlesMonsInGoodCondition(void) else eContestAppealResults.jam = 10; eContestAppealResults.jamQueue[0] = i; - eContestAppealResults.jamQueue[1] = 0xFF; + eContestAppealResults.jamQueue[1] = CONTESTANT_NONE; if (WasAtLeastOneOpponentJammed()) numHit++; } @@ -758,7 +758,7 @@ static void ContestEffect_NextAppealEarlier(void) for (i = 0; i < CONTESTANT_COUNT; i++) turnOrder[i] = eContestantStatus[i].nextTurnOrder; - turnOrder[eContestAppealResults.contestant] = 0xFF; + turnOrder[eContestAppealResults.contestant] = CONTESTANT_NONE; for (i = 0; i < CONTESTANT_COUNT; i++) { @@ -800,7 +800,7 @@ static void ContestEffect_NextAppealLater(void) for (i = 0; i < CONTESTANT_COUNT; i++) turnOrder[i] = eContestantStatus[i].nextTurnOrder; - turnOrder[eContestAppealResults.contestant] = 0xFF; + turnOrder[eContestAppealResults.contestant] = CONTESTANT_NONE; for (i = CONTESTANT_COUNT - 1; i > -1; i--) { @@ -858,12 +858,12 @@ static void ContestEffect_ScrambleNextTurnOrder(void) for (j = 0; j < CONTESTANT_COUNT; j++) { - if (unselectedContestants[j] != 0xFF) + if (unselectedContestants[j] != CONTESTANT_NONE) { if (rval == 0) { turnOrder[j] = i; - unselectedContestants[j] = 0xFF; + unselectedContestants[j] = CONTESTANT_NONE; break; } else @@ -909,7 +909,7 @@ static void ContestEffect_BadlyStartleMonsWithGoodAppeals(void) else eContestAppealResults.jam = 10; eContestAppealResults.jamQueue[0] = i; - eContestAppealResults.jamQueue[1] = 0xFF; + eContestAppealResults.jamQueue[1] = CONTESTANT_NONE; if (WasAtLeastOneOpponentJammed()) numJammed++; } @@ -977,7 +977,7 @@ static void JamByMoveCategory(u8 category) else eContestAppealResults.jam = 10; eContestAppealResults.jamQueue[0] = i; - eContestAppealResults.jamQueue[1] = 0xFF; + eContestAppealResults.jamQueue[1] = CONTESTANT_NONE; if (WasAtLeastOneOpponentJammed()) numJammed++; } @@ -1016,7 +1016,7 @@ static bool8 WasAtLeastOneOpponentJammed(void) s16 jamBuffer[CONTESTANT_COUNT] = {0}; int i; - for (i = 0; eContestAppealResults.jamQueue[i] != 0xFF; i++) + for (i = 0; eContestAppealResults.jamQueue[i] != CONTESTANT_NONE; i++) { u8 contestant = eContestAppealResults.jamQueue[i]; if (CanUnnerveContestant(contestant)) diff --git a/src/contest_painting.c b/src/contest_painting.c index 40bad724e78c..00bacb5f484d 100644 --- a/src/contest_painting.c +++ b/src/contest_painting.c @@ -248,7 +248,7 @@ static void HoldContestPainting(void) if ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON))) { sHoldState++; - BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB(0, 0, 0)); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); } if (sVarsInitialized) diff --git a/src/contest_util.c b/src/contest_util.c index 5da02a285bdf..0786902b8ccb 100644 --- a/src/contest_util.c +++ b/src/contest_util.c @@ -1994,7 +1994,7 @@ void GiveMonContestRibbon(void) { case CONTEST_CATEGORY_COOL: ribbonData = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_COOL_RIBBON); - if (ribbonData <= gSpecialVar_ContestRank && ribbonData < 4) + if (ribbonData <= gSpecialVar_ContestRank && ribbonData <= CONTEST_RANK_MASTER) { ribbonData++; SetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_COOL_RIBBON, &ribbonData); @@ -2004,7 +2004,7 @@ void GiveMonContestRibbon(void) break; case CONTEST_CATEGORY_BEAUTY: ribbonData = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_BEAUTY_RIBBON); - if (ribbonData <= gSpecialVar_ContestRank && ribbonData < 4) + if (ribbonData <= gSpecialVar_ContestRank && ribbonData <= CONTEST_RANK_MASTER) { ribbonData++; SetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_BEAUTY_RIBBON, &ribbonData); @@ -2014,7 +2014,7 @@ void GiveMonContestRibbon(void) break; case CONTEST_CATEGORY_CUTE: ribbonData = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_CUTE_RIBBON); - if (ribbonData <= gSpecialVar_ContestRank && ribbonData < 4) + if (ribbonData <= gSpecialVar_ContestRank && ribbonData <= CONTEST_RANK_MASTER) { ribbonData++; SetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_CUTE_RIBBON, &ribbonData); @@ -2024,7 +2024,7 @@ void GiveMonContestRibbon(void) break; case CONTEST_CATEGORY_SMART: ribbonData = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_SMART_RIBBON); - if (ribbonData <= gSpecialVar_ContestRank && ribbonData < 4) + if (ribbonData <= gSpecialVar_ContestRank && ribbonData <= CONTEST_RANK_MASTER) { ribbonData++; SetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_SMART_RIBBON, &ribbonData); @@ -2034,7 +2034,7 @@ void GiveMonContestRibbon(void) break; case CONTEST_CATEGORY_TOUGH: ribbonData = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_TOUGH_RIBBON); - if (ribbonData <= gSpecialVar_ContestRank && ribbonData < 4) + if (ribbonData <= gSpecialVar_ContestRank && ribbonData <= CONTEST_RANK_MASTER) { ribbonData++; SetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_TOUGH_RIBBON, &ribbonData); diff --git a/src/credits.c b/src/credits.c index e88773c2e469..ecd6af6fca4b 100644 --- a/src/credits.c +++ b/src/credits.c @@ -1371,7 +1371,7 @@ static void SpriteCB_Player(struct Sprite *sprite) break; case 4: StartSpriteAnimIfDifferent(sprite, 0); - if (sprite->x > 120) + if (sprite->x > DISPLAY_WIDTH / 2) sprite->x--; break; case 5: diff --git a/src/data.c b/src/data.c index 1ced9ce81d18..859209a9342c 100644 --- a/src/data.c +++ b/src/data.c @@ -279,24 +279,10 @@ static const union AnimCmd sAnim_MonPic_1[] = ANIMCMD_END, }; -static const union AnimCmd sAnim_MonPic_2[] = -{ - ANIMCMD_FRAME(2, 0), - ANIMCMD_END, -}; - -static const union AnimCmd sAnim_MonPic_3[] = -{ - ANIMCMD_FRAME(3, 0), - ANIMCMD_END, -}; - const union AnimCmd *const gAnims_MonPic[MAX_MON_PIC_FRAMES] = { sAnim_MonPic_0, sAnim_MonPic_1, - sAnim_MonPic_2, - sAnim_MonPic_3, }; #define SPECIES_SPRITE(species, sprite) [SPECIES_##species] = {sprite, MON_PIC_SIZE, SPECIES_##species} diff --git a/src/data/battle_anim.h b/src/data/battle_anim.h index 46293e3a0a8d..885038725c8a 100644 --- a/src/data/battle_anim.h +++ b/src/data/battle_anim.h @@ -1156,11 +1156,7 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_Shock2, 0x0600, ANIM_TAG_SHOCK_2}, {gBattleAnimSpriteGfx_ClosingEye2, 0x0200, ANIM_TAG_CLOSING_EYE_2}, {gBattleAnimSpriteGfx_MetalBall, 0x0080, ANIM_TAG_METAL_BALL}, -#if NEW_SUBSTITUTE_PARTICLE - {gBattleAnimSpriteGfx_NewSubstituteFront, 0x0200, ANIM_TAG_MONSTER_DOLL}, -#else {gBattleAnimSpriteGfx_MonsterDoll, 0x0200, ANIM_TAG_MONSTER_DOLL}, -#endif {gBattleAnimSpriteGfx_Whirlwind, 0x0800, ANIM_TAG_WHIRLWIND}, {gBattleAnimSpriteGfx_Whirlwind2, 0x0080, ANIM_TAG_WHIRLWIND_2}, {gBattleAnimSpriteGfx_Explosion4, 0x0a00, ANIM_TAG_EXPLOSION_4}, @@ -1451,6 +1447,7 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_Orbs, 0x0180, ANIM_TAG_STEEL_BEAM}, {gBattleAnimSpriteGfx_AuraSphere, 0x200, ANIM_TAG_POLTERGEIST}, {gBattleAnimSpriteGfx_Teapot, 0x1800, ANIM_TAG_TEAPOT}, + {gBattleAnimSpriteGfx_WoodHammerHammer, 0x800, ANIM_TAG_WOOD_HAMMER_HAMMER}, }; const struct CompressedSpritePalette gBattleAnimPaletteTable[] = @@ -1606,11 +1603,7 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_Shock2, ANIM_TAG_SHOCK_2}, {gBattleAnimSpritePal_ClosingEye2, ANIM_TAG_CLOSING_EYE_2}, {gBattleAnimSpritePal_MetalBall, ANIM_TAG_METAL_BALL}, -#if NEW_SUBSTITUTE_PARTICLE - {gBattleAnimSpritePal_NewSubstituteFront, ANIM_TAG_MONSTER_DOLL}, -#else {gBattleAnimSpritePal_MonsterDoll, ANIM_TAG_MONSTER_DOLL}, -#endif {gBattleAnimSpritePal_Whirlwind, ANIM_TAG_WHIRLWIND}, {gBattleAnimSpritePal_Whirlwind, ANIM_TAG_WHIRLWIND_2}, {gBattleAnimSpritePal_Explosion4, ANIM_TAG_EXPLOSION_4}, @@ -1902,6 +1895,7 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_SteelBeam, ANIM_TAG_STEEL_BEAM}, {gBattleAnimSpritePal_Poltergeist, ANIM_TAG_POLTERGEIST}, {gBattleAnimSpritePal_Teapot, ANIM_TAG_TEAPOT}, + {gBattleAnimSpritePal_WoodHammerHammer, ANIM_TAG_WOOD_HAMMER_HAMMER}, }; const struct BattleAnimBackground gBattleAnimBackgroundTable[] = @@ -1987,4 +1981,5 @@ const struct BattleAnimBackground gBattleAnimBackgroundTable[] = [BG_AURA_SPHERE] = {gBattleAnimBgImage_FocusBlast, gBattleAnimBgPalette_AuraSphere, gBattleAnimBgTilemap_FocusBlast}, [BG_STEEL_BEAM_OPPONENT] = {gBattleAnimBgImage_Highspeed, gBattleAnimBgPalette_SteelBeam, gBattleAnimBgTilemap_HighspeedOpponent}, [BG_STEEL_BEAM_PLAYER] = {gBattleAnimBgImage_Highspeed, gBattleAnimBgPalette_SteelBeam, gBattleAnimBgTilemap_HighspeedPlayer}, + [BG_CHLOROBLAST] = {gBattleAnimBgImage_HydroCannon, gBattleAnimBgPalette_Chloroblast, gBattleAnimBgTilemap_HydroCannon}, }; diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 35490c8e48f7..80ac9f94585b 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -10,8 +10,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, + .mimicBanned = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_POUND] = @@ -24,9 +28,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .ignoresKingsRock = B_UPDATED_MOVE_FLAGS == GEN_4, }, [MOVE_KARATE_CHOP] = @@ -39,9 +44,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIGH_CRIT, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .highCritRatio = TRUE, }, [MOVE_DOUBLE_SLAP] = @@ -54,9 +60,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_COMET_PUNCH] = @@ -69,9 +75,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_IRON_FIST_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .punchingMove = TRUE, }, [MOVE_MEGA_PUNCH] = @@ -84,9 +91,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_IRON_FIST_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .punchingMove = TRUE, }, [MOVE_PAY_DAY] = @@ -99,7 +107,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -114,9 +121,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .punchingMove = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_ICE_PUNCH] = @@ -133,9 +142,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .punchingMove = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_THUNDER_PUNCH] = @@ -148,9 +159,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .punchingMove = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_SCRATCH] = @@ -163,9 +176,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_VISE_GRIP] = @@ -178,9 +191,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_GUILLOTINE] = @@ -193,18 +206,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_RAZOR_WIND] = { - #if B_UPDATED_MOVE_DATA >= GEN_4 - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIGH_CRIT, - #else - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, - #endif .effect = EFFECT_TWO_TURNS_ATTACK, .power = 80, .type = TYPE_NORMAL, @@ -215,6 +223,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .highCritRatio = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_SWORDS_DANCE] = @@ -231,9 +242,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED | FLAG_DANCE, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .danceMove = TRUE, + .snatchAffected = TRUE, }, [MOVE_CUT] = @@ -246,9 +258,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SLICING_MOVE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .slicingMove = TRUE, }, [MOVE_GUST] = @@ -261,9 +274,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_DMG_2X_IN_AIR | FLAG_WIND_MOVE, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .ignoresKingsRock = (B_UPDATED_MOVE_FLAGS == GEN_4) || (B_UPDATED_MOVE_FLAGS < GEN_3), + .damagesAirborneDoubleDamage = TRUE, + .windMove = TRUE, }, [MOVE_WING_ATTACK] = @@ -276,22 +291,17 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_WHIRLWIND] = { #if B_UPDATED_MOVE_DATA >= GEN_6 .accuracy = 0, - .flags = FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_WIND_MOVE, - #elif B_UPDATED_MOVE_DATA == GEN_5 - .accuracy = 100, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, #else .accuracy = 100, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, #endif .effect = EFFECT_ROAR, .power = 0, @@ -302,6 +312,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = -6, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_1, + .windMove = TRUE, + .ignoresProtect = B_UPDATED_MOVE_FLAGS >= GEN_6, + .magicCoatAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, + .copycatBanned = TRUE, }, [MOVE_FLY] = @@ -318,9 +332,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .gravityBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_BIND] = @@ -337,9 +354,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .ignoresKingsRock = B_UPDATED_MOVE_FLAGS < GEN_3, }, [MOVE_SLAM] = @@ -352,9 +370,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_VINE_WHIP] = @@ -362,7 +380,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = #if B_UPDATED_MOVE_DATA >= GEN_6 .power = 45, .pp = 25, - #elif B_UPDATED_MOVE_DATA == GEN_4 || B_UPDATED_MOVE_DATA == GEN_5 + #elif B_UPDATED_MOVE_DATA >= GEN_4 .power = 35, .pp = 15, #else @@ -375,9 +393,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_STOMP] = @@ -390,9 +408,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_DMG_MINIMIZE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, + .minimizeDoubleDamage = TRUE, }, [MOVE_DOUBLE_KICK] = @@ -405,9 +425,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .strikeCount = 2, }, [MOVE_MEGA_KICK] = @@ -420,9 +441,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_JUMP_KICK] = @@ -443,18 +464,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_RECKLESS_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .gravityBanned = TRUE, }, [MOVE_ROLLING_KICK] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, - #else - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, - #endif .effect = EFFECT_FLINCH_HIT, .power = 60, .type = TYPE_FIGHTING, @@ -465,6 +482,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .ignoresKingsRock = B_UPDATED_MOVE_FLAGS < GEN_3, + .sheerForceBoost = TRUE, }, [MOVE_SAND_ATTACK] = @@ -477,9 +497,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_EVSN_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_HEADBUTT] = @@ -492,9 +512,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_HORN_ATTACK] = @@ -507,9 +528,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_FURY_ATTACK] = @@ -522,9 +543,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_HORN_DRILL] = @@ -537,9 +558,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_TACKLE] = @@ -547,7 +568,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = #if B_UPDATED_MOVE_DATA >= GEN_7 .power = 40, .accuracy = 100, - #elif B_UPDATED_MOVE_DATA == GEN_5 || B_UPDATED_MOVE_DATA == GEN_6 + #elif B_UPDATED_MOVE_DATA >= GEN_5 .power = 50, .accuracy = 100, #else @@ -560,18 +581,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_BODY_SLAM] = { - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_DMG_MINIMIZE, - #else - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, - #endif .effect = EFFECT_PARALYZE_HIT, .power = 85, .type = TYPE_NORMAL, @@ -582,6 +598,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, + .minimizeDoubleDamage = B_UPDATED_MOVE_FLAGS >= GEN_6, }, [MOVE_WRAP] = @@ -598,9 +617,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_TAKE_DOWN] = @@ -613,9 +632,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_RECKLESS_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_THRASH] = @@ -633,9 +652,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_RANDOM, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_DOUBLE_EDGE] = @@ -648,9 +667,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_RECKLESS_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_TAIL_WHIP] = @@ -663,9 +682,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ATK_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_POISON_STING] = @@ -678,9 +697,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_TWINEEDLE] = @@ -693,9 +712,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .ignoresKingsRock = B_UPDATED_MOVE_FLAGS < GEN_5, // && B_UPDATED_MOVE_FLAGS > GEN_2 + .strikeCount = 2, }, [MOVE_PIN_MISSILE] = @@ -713,7 +734,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -728,9 +748,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ATK_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_BITE] = @@ -743,9 +763,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_STRONG_JAW_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, + .bitingMove = TRUE, }, [MOVE_GROWL] = @@ -758,22 +780,18 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SOUND, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .magicCoatAffected = TRUE, + .soundMove = TRUE, }, [MOVE_ROAR] = { #if B_UPDATED_MOVE_DATA >= GEN_6 .accuracy = 0, - .flags = FLAG_MIRROR_MOVE_AFFECTED | FLAG_SOUND | FLAG_MAGIC_COAT_AFFECTED, - #elif B_UPDATED_MOVE_DATA == GEN_5 - .accuracy = 100, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SOUND | FLAG_MAGIC_COAT_AFFECTED, #else .accuracy = 100, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SOUND, #endif .effect = EFFECT_ROAR, .power = 0, @@ -784,6 +802,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = -6, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .ignoresProtect = B_UPDATED_MOVE_FLAGS >= GEN_6, + .magicCoatAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, + .soundMove = TRUE, + .copycatBanned = TRUE, }, [MOVE_SING] = @@ -796,9 +818,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SOUND, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, + .magicCoatAffected = TRUE, + .soundMove = TRUE, }, [MOVE_SUPERSONIC] = @@ -811,9 +834,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SOUND, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, + .magicCoatAffected = TRUE, + .soundMove = TRUE, }, [MOVE_SONIC_BOOM] = @@ -826,7 +850,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -835,13 +858,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = { #if B_UPDATED_MOVE_DATA >= GEN_5 .accuracy = 100, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_MAGIC_COAT_AFFECTED, #elif B_UPDATED_MOVE_DATA == GEN_4 .accuracy = 80, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, #else .accuracy = 55, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, #endif .effect = EFFECT_DISABLE, .power = 0, @@ -852,6 +872,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .magicCoatAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_ACID] = @@ -868,9 +889,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_EMBER] = @@ -883,9 +904,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_FLAMETHROWER] = @@ -902,9 +923,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_MIST] = @@ -917,9 +938,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RECOVER_HP, + .snatchAffected = TRUE, }, [MOVE_WATER_GUN] = @@ -932,7 +953,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -951,7 +971,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -961,7 +980,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = #if B_UPDATED_MOVE_DATA >= GEN_6 .power = 90, .target = MOVE_TARGET_FOES_AND_ALLY, - #elif B_UPDATED_MOVE_DATA == GEN_4 || B_UPDATED_MOVE_DATA == GEN_5 + #elif B_UPDATED_MOVE_DATA >= GEN_4 .power = 95, .target = MOVE_TARGET_FOES_AND_ALLY, #else @@ -974,9 +993,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .pp = 15, .secondaryEffectChance = 0, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_DMG_UNDERWATER, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .damagesUnderwater = TRUE, }, [MOVE_ICE_BEAM] = @@ -999,9 +1018,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_BLIZZARD] = @@ -1022,9 +1041,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_WIND_MOVE, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .windMove = TRUE, }, [MOVE_PSYBEAM] = @@ -1037,9 +1057,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_BUBBLE_BEAM] = @@ -1052,9 +1072,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_AURORA_BEAM] = @@ -1067,9 +1087,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_HYPER_BEAM] = @@ -1082,9 +1102,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .ignoresKingsRock = B_UPDATED_MOVE_FLAGS < GEN_3, + .instructBanned = TRUE, }, [MOVE_PECK] = @@ -1097,9 +1118,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_DRILL_PECK] = @@ -1112,9 +1133,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_SUBMISSION] = @@ -1131,9 +1152,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_RECKLESS_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_LOW_KICK] = @@ -1146,20 +1167,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_COUNTER] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED, - #elif B_UPDATED_MOVE_DATA == GEN_4 - .flags = FLAG_MAKES_CONTACT, - #else - .flags = FLAG_MAKES_CONTACT | FLAG_MIRROR_MOVE_AFFECTED, - #endif .effect = EFFECT_COUNTER, .power = 1, .type = TYPE_FIGHTING, @@ -1170,6 +1184,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = -5, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .mirrorMoveBanned = B_UPDATED_MOVE_FLAGS >= GEN_4, + .ignoresKingsRock = B_UPDATED_MOVE_FLAGS < GEN_5, // && B_UPDATED_MOVE_FLAGS > GEN_2 + .meFirstBanned = TRUE, + .metronomeBanned = TRUE, // B_UPDATED_MOVE_FLAGS >= GEN_2 + .copycatBanned = TRUE, }, [MOVE_SEISMIC_TOSS] = @@ -1182,9 +1202,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_STRENGTH] = @@ -1197,9 +1217,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_ABSORB] = @@ -1216,9 +1236,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .ignoresKingsRock = B_UPDATED_MOVE_FLAGS < GEN_5, // && B_UPDATED_MOVE_FLAGS > GEN_2 }, [MOVE_MEGA_DRAIN] = @@ -1235,9 +1255,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .ignoresKingsRock = B_UPDATED_MOVE_FLAGS < GEN_5, // && B_UPDATED_MOVE_FLAGS > GEN_2 }, [MOVE_LEECH_SEED] = @@ -1250,9 +1270,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .magicCoatAffected = TRUE, }, [MOVE_GROWTH] = @@ -1273,9 +1293,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPATK_UP_1, + .snatchAffected = TRUE, }, [MOVE_RAZOR_LEAF] = @@ -1288,9 +1308,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIGH_CRIT | FLAG_SLICING_MOVE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .highCritRatio = TRUE, + .slicingMove = TRUE, }, [MOVE_SOLAR_BEAM] = @@ -1303,9 +1324,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_POISON_POWDER] = @@ -1318,9 +1340,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_POWDER, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .magicCoatAffected = TRUE, + .powderMove = TRUE, }, [MOVE_STUN_SPORE] = @@ -1333,9 +1356,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_POWDER, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_1, + .magicCoatAffected = TRUE, + .powderMove = TRUE, }, [MOVE_SLEEP_POWDER] = @@ -1348,9 +1372,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_POWDER, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, + .magicCoatAffected = TRUE, + .powderMove = TRUE, }, [MOVE_PETAL_DANCE] = @@ -1371,9 +1396,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_RANDOM, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_DANCE, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .danceMove = TRUE, }, [MOVE_STRING_SHOT] = @@ -1390,9 +1416,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_DRAGON_RAGE] = @@ -1405,9 +1431,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .ignoresKingsRock = (B_UPDATED_MOVE_FLAGS == GEN_4) || (B_UPDATED_MOVE_FLAGS < GEN_3), }, [MOVE_FIRE_SPIN] = @@ -1425,10 +1451,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, - + .ignoresKingsRock = B_UPDATED_MOVE_FLAGS < GEN_3, }, [MOVE_THUNDER_SHOCK] = @@ -1441,9 +1466,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_THUNDERBOLT] = @@ -1460,9 +1485,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_THUNDER_WAVE] = @@ -1479,9 +1504,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_THUNDER] = @@ -1498,9 +1523,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_DMG_IN_AIR, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .damagesAirborne = TRUE, }, [MOVE_ROCK_THROW] = @@ -1513,7 +1539,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -1528,9 +1553,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_DMG_UNDERGROUND, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .ignoresKingsRock = B_UPDATED_MOVE_FLAGS < GEN_3, + .damagesUnderground = TRUE, }, [MOVE_FISSURE] = @@ -1543,9 +1569,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_DMG_UNDERGROUND, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .damagesUnderground = TRUE, }, [MOVE_DIG] = @@ -1562,9 +1588,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_TOXIC] = @@ -1581,9 +1609,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_CONFUSION] = @@ -1596,9 +1624,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_PSYCHIC] = @@ -1611,9 +1639,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_HYPNOSIS] = @@ -1626,9 +1654,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_MEDITATE] = @@ -1641,9 +1669,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ATK_UP_1, + .snatchAffected = TRUE, }, [MOVE_AGILITY] = @@ -1656,9 +1684,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_QUICK_ATTACK] = @@ -1671,9 +1699,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 1, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_RAGE] = @@ -1686,9 +1714,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_TELEPORT] = @@ -1701,7 +1729,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = -6, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RECOVER_HP, }, @@ -1716,7 +1743,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -1731,9 +1757,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ACC_UP_1, + .mimicBanned = TRUE, + .metronomeBanned = TRUE, // B_UPDATED_MOVE_FLAGS >= GEN_2 + .copycatBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_SCREECH] = @@ -1746,9 +1776,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SOUND, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ATK_UP_1, + .magicCoatAffected = TRUE, + .soundMove = TRUE, }, [MOVE_DOUBLE_TEAM] = @@ -1761,9 +1792,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_RECOVER] = @@ -1782,9 +1813,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_HARDEN] = @@ -1797,9 +1828,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .snatchAffected = TRUE, }, [MOVE_MINIMIZE] = @@ -1816,9 +1847,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_SMOKESCREEN] = @@ -1831,9 +1862,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_EVSN_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_CONFUSE_RAY] = @@ -1846,9 +1877,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPATK_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_WITHDRAW] = @@ -1861,9 +1892,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .snatchAffected = TRUE, }, [MOVE_DEFENSE_CURL] = @@ -1876,9 +1907,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ACC_UP_1, + .snatchAffected = TRUE, }, [MOVE_BARRIER] = @@ -1895,9 +1926,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_LIGHT_SCREEN] = @@ -1910,9 +1941,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_1, + .snatchAffected = TRUE, }, [MOVE_HAZE] = @@ -1925,7 +1956,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RECOVER_HP, }, @@ -1940,9 +1970,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .snatchAffected = TRUE, }, [MOVE_FOCUS_ENERGY] = @@ -1955,9 +1985,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ACC_UP_1, + .snatchAffected = TRUE, + .sleepTalkBanned = TRUE, }, [MOVE_BIDE] = @@ -1975,9 +2006,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .pp = 10, .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_METRONOME] = @@ -1990,9 +2023,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_DEPENDS, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .sleepTalkBanned = B_UPDATED_MOVE_FLAGS >= GEN_3, + .instructBanned = TRUE, }, [MOVE_MIRROR_MOVE] = @@ -2005,9 +2041,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_DEPENDS, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ATK_UP_2, + .metronomeBanned = B_UPDATED_MOVE_FLAGS >= GEN_4, + .copycatBanned = TRUE, + .sleepTalkBanned = B_UPDATED_MOVE_FLAGS >= GEN_3, + .instructBanned = TRUE, }, [MOVE_SELF_DESTRUCT] = @@ -2020,7 +2059,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -2035,9 +2073,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_BALLISTIC, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .ballisticMove = TRUE, }, [MOVE_LICK] = @@ -2054,9 +2092,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_SMOG] = @@ -2073,9 +2112,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 40, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_SLUDGE] = @@ -2088,9 +2127,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_BONE_CLUB] = @@ -2103,9 +2142,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_FIRE_BLAST] = @@ -2122,22 +2161,17 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_WATERFALL] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .effect = EFFECT_FLINCH_HIT, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, - #elif B_UPDATED_MOVE_DATA == GEN_4 + #if B_UPDATED_MOVE_DATA >= GEN_4 .effect = EFFECT_FLINCH_HIT, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, #else .effect = EFFECT_HIT, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, #endif .power = 80, .type = TYPE_WATER, @@ -2148,6 +2182,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_CLAMP] = @@ -2165,9 +2201,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .ignoresKingsRock = B_UPDATED_MOVE_FLAGS < GEN_3, }, [MOVE_SWIFT] = @@ -2180,7 +2217,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -2200,9 +2236,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_SPIKE_CANNON] = @@ -2215,7 +2253,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -2230,9 +2267,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_AMNESIA] = @@ -2245,18 +2283,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_KINESIS] = { - #if B_UPDATED_MOVE_DATA >= GEN_4 - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_MAGIC_COAT_AFFECTED, - #else - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, - #endif .effect = EFFECT_ACCURACY_DOWN, .power = 0, .type = TYPE_PSYCHIC, @@ -2267,6 +2300,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_EVSN_UP_1, + .magicCoatAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_SOFT_BOILED] = @@ -2283,9 +2317,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_HIGH_JUMP_KICK] = @@ -2306,9 +2340,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_RECKLESS_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .gravityBanned = TRUE, }, [MOVE_GLARE] = @@ -2327,9 +2362,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_DREAM_EATER] = @@ -2342,7 +2377,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -2365,9 +2399,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .pp = 40, .secondaryEffectChance = 0, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_BARRAGE] = @@ -2380,9 +2414,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_BALLISTIC, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .ballisticMove = TRUE, }, [MOVE_LEECH_LIFE] = @@ -2400,9 +2434,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .ignoresKingsRock = B_UPDATED_MOVE_FLAGS < GEN_5, // && B_UPDATED_MOVE_FLAGS > GEN_2 }, [MOVE_LOVELY_KISS] = @@ -2415,18 +2450,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_SKY_ATTACK] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, - #else - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, - #endif .effect = EFFECT_TWO_TURNS_ATTACK, .power = 140, .type = TYPE_FLYING, @@ -2438,6 +2468,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .split = SPLIT_PHYSICAL, .argument = MOVE_EFFECT_FLINCH, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_TRANSFORM] = @@ -2450,9 +2483,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RECOVER_HP, + .ignoresProtect = TRUE, + .mimicBanned = TRUE, + .metronomeBanned = B_UPDATED_MOVE_FLAGS >= GEN_5, + .copycatBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_BUBBLE] = @@ -2469,9 +2506,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_DIZZY_PUNCH] = @@ -2484,9 +2521,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .punchingMove = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_SPORE] = @@ -2499,9 +2538,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_POWDER, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .magicCoatAffected = TRUE, + .powderMove = TRUE, }, [MOVE_FLASH] = @@ -2518,9 +2558,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_EVSN_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_PSYWAVE] = @@ -2537,7 +2577,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -2552,9 +2591,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ATK_UP_3, + .gravityBanned = TRUE, }, [MOVE_ACID_ARMOR] = @@ -2571,9 +2610,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_CRABHAMMER] = @@ -2594,9 +2633,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIGH_CRIT, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .highCritRatio = TRUE, }, [MOVE_EXPLOSION] = @@ -2609,7 +2649,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -2624,9 +2663,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_BONEMERANG] = @@ -2639,9 +2678,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .strikeCount = 2, }, [MOVE_REST] = @@ -2658,9 +2697,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_ROCK_SLIDE] = @@ -2673,9 +2712,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_HYPER_FANG] = @@ -2688,9 +2727,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_STRONG_JAW_BOOST | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, + .bitingMove = TRUE, }, [MOVE_SHARPEN] = @@ -2703,18 +2744,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ATK_UP_1, + .snatchAffected = TRUE, }, [MOVE_CONVERSION] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_SNATCH_AFFECTED, - #else - .flags = 0, - #endif .effect = EFFECT_CONVERSION, .power = 0, .type = TYPE_NORMAL, @@ -2725,6 +2761,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ALL_STATS_UP_1, + .snatchAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_TRI_ATTACK] = @@ -2737,9 +2774,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_SUPER_FANG] = @@ -2752,9 +2789,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .ignoresKingsRock = B_UPDATED_MOVE_FLAGS < GEN_5, // && B_UPDATED_MOVE_FLAGS > GEN_2 }, [MOVE_SLASH] = @@ -2767,9 +2805,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIGH_CRIT | FLAG_SLICING_MOVE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .highCritRatio = TRUE, + .slicingMove = TRUE, }, [MOVE_SUBSTITUTE] = @@ -2782,20 +2822,18 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_STRUGGLE] = { #if B_UPDATED_MOVE_DATA >= GEN_4 .accuracy = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .effect = EFFECT_RECOIL_HP_25, #else .accuracy = 100, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .effect = EFFECT_RECOIL_25, #endif .power = 50, @@ -2806,6 +2844,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .mirrorMoveBanned = B_UPDATED_MOVE_FLAGS >= GEN_4, + .meFirstBanned = TRUE, + .mimicBanned = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_SKETCH] = @@ -2818,9 +2863,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ALL_STATS_UP_1, + .ignoresProtect = TRUE, + .mimicBanned = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .sleepTalkBanned = B_UPDATED_MOVE_FLAGS >= GEN_5, + .instructBanned = TRUE, }, [MOVE_TRIPLE_KICK] = @@ -2833,9 +2883,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .strikeCount = 3, }, [MOVE_THIEF] = @@ -2853,18 +2904,17 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .ignoresKingsRock = B_UPDATED_MOVE_FLAGS < GEN_5, // && B_UPDATED_MOVE_FLAGS > GEN_2 + .meFirstBanned = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, }, [MOVE_SPIDER_WEB] = { - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flags = FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, - #else - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, - #endif .effect = EFFECT_MEAN_LOOK, .power = 0, .type = TYPE_BUG, @@ -2875,6 +2925,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .ignoresProtect = (B_UPDATED_MOVE_FLAGS >= GEN_6) || (B_UPDATED_MOVE_FLAGS <= GEN_3), + .magicCoatAffected = TRUE, }, [MOVE_MIND_READER] = @@ -2891,7 +2943,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPATK_UP_1, }, @@ -2910,9 +2961,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPATK_UP_1, + .ignoresProtect = B_UPDATED_MOVE_FLAGS <= GEN_3, }, [MOVE_FLAME_WHEEL] = @@ -2925,22 +2976,19 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_THAW_USER, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, + .thawsUser = TRUE, }, [MOVE_SNORE] = { #if B_UPDATED_MOVE_DATA >= GEN_6 .power = 50, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_SOUND, - #elif B_UPDATED_MOVE_DATA == GEN_5 - .power = 40, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_SOUND, #else .power = 40, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_SOUND, #endif .effect = EFFECT_SNORE, .type = TYPE_NORMAL, @@ -2951,6 +2999,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .soundMove = TRUE, + .metronomeBanned = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_CURSE] = @@ -2967,9 +3018,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_CURSE, + .ignoresProtect = TRUE, }, [MOVE_FLAIL] = @@ -2982,9 +3033,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_CONVERSION_2] = @@ -2997,9 +3048,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RECOVER_HP, + .ignoresProtect = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_AEROBLAST] = @@ -3012,9 +3063,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIGH_CRIT, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .highCritRatio = TRUE, }, [MOVE_COTTON_SPORE] = @@ -3035,9 +3086,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .pp = 40, .secondaryEffectChance = 0, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_POWDER, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .magicCoatAffected = TRUE, + .powderMove = TRUE, }, [MOVE_REVERSAL] = @@ -3050,18 +3102,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_SPITE] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_MAGIC_COAT_AFFECTED, - #else - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, - #endif .effect = EFFECT_SPITE, .power = 0, .type = TYPE_GHOST, @@ -3072,6 +3119,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RECOVER_HP, + .magicCoatAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_POWDER_SNOW] = @@ -3088,9 +3136,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_PROTECT] = @@ -3107,9 +3155,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .pp = 10, .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, - .flags = FLAG_PROTECTION_MOVE, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .protectionMove = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, }, [MOVE_MACH_PUNCH] = @@ -3122,9 +3172,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 1, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_IRON_FIST_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .punchingMove = TRUE, }, [MOVE_SCARY_FACE] = @@ -3141,17 +3192,15 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_FEINT_ATTACK] = { #if B_UPDATED_MOVE_DATA >= GEN_4 - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, - #else - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .makesContact = TRUE, #endif .effect = EFFECT_HIT, .power = 60, @@ -3179,9 +3228,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPATK_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_BELLY_DRUM] = @@ -3194,9 +3243,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RECOVER_HP, + .snatchAffected = TRUE, }, [MOVE_SLUDGE_BOMB] = @@ -3209,9 +3258,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_BALLISTIC, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .ballisticMove = TRUE, }, [MOVE_MUD_SLAP] = @@ -3224,9 +3274,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_OCTAZOOKA] = @@ -3239,18 +3289,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 50, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_BALLISTIC | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .ballisticMove = TRUE, }, [MOVE_SPIKES] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_MAGIC_COAT_AFFECTED, - #else - .flags = 0, - #endif .effect = EFFECT_SPIKES, .power = 0, .type = TYPE_GROUND, @@ -3261,6 +3307,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .magicCoatAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_ZAP_CANNON] = @@ -3277,22 +3324,18 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_BALLISTIC, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .ballisticMove = TRUE, }, [MOVE_FORESIGHT] = { #if B_UPDATED_MOVE_DATA >= GEN_5 .accuracy = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_MAGIC_COAT_AFFECTED, - #elif B_UPDATED_MOVE_DATA == GEN_4 - .accuracy = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, #else .accuracy = 100, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, #endif .effect = EFFECT_FORESIGHT, .power = 0, @@ -3303,6 +3346,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_BOOST_CRITS, + .magicCoatAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_DESTINY_BOND] = @@ -3315,9 +3359,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_FOLLOW_ME, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, }, [MOVE_PERISH_SONG] = @@ -3330,9 +3375,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, .priority = 0, - .flags = FLAG_SOUND, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .ignoresProtect = TRUE, + .soundMove = TRUE, }, [MOVE_ICY_WIND] = @@ -3345,9 +3391,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_WIND_MOVE, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .windMove = TRUE, }, [MOVE_DETECT] = @@ -3364,9 +3411,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .pp = 5, .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, - .flags = FLAG_PROTECTION_MOVE, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_EVSN_UP_1, + .protectionMove = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, }, [MOVE_BONE_RUSH] = @@ -3383,7 +3432,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -3402,7 +3450,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, }, @@ -3425,9 +3472,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_RANDOM, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .instructBanned = TRUE, }, [MOVE_SANDSTORM] = @@ -3440,9 +3488,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, .priority = 0, - .flags = FLAG_WIND_MOVE, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, + .windMove = TRUE, }, [MOVE_GIGA_DRAIN] = @@ -3463,9 +3511,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .ignoresKingsRock = B_UPDATED_MOVE_FLAGS < GEN_5, // && B_UPDATED_MOVE_FLAGS > GEN_2 }, [MOVE_ENDURE] = @@ -3482,9 +3530,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .pp = 10, .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, - .flags = FLAG_PROTECTION_MOVE, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .protectionMove = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, }, [MOVE_CHARM] = @@ -3501,9 +3551,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_ROLLOUT] = @@ -3516,9 +3566,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .instructBanned = TRUE, }, [MOVE_FALSE_SWIPE] = @@ -3531,9 +3582,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_SWAGGER] = @@ -3550,9 +3601,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .magicCoatAffected = TRUE, }, [MOVE_MILK_DRINK] = @@ -3569,9 +3620,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_SPARK] = @@ -3584,9 +3635,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_FURY_CUTTER] = @@ -3605,9 +3657,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SLICING_MOVE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .slicingMove = TRUE, }, [MOVE_STEEL_WING] = @@ -3620,18 +3673,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_MEAN_LOOK] = { - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flags = FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, - #else - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, - #endif .effect = EFFECT_MEAN_LOOK, .power = 0, .type = TYPE_NORMAL, @@ -3642,6 +3691,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_1, + .ignoresProtect = (B_UPDATED_MOVE_FLAGS >= GEN_6) || (B_UPDATED_MOVE_FLAGS <= GEN_3), + .magicCoatAffected = TRUE, }, [MOVE_ATTRACT] = @@ -3654,9 +3705,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .magicCoatAffected = TRUE, }, [MOVE_SLEEP_TALK] = @@ -3669,18 +3720,16 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_DEPENDS, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_BOOST_CRITS, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_HEAL_BELL] = { - #if B_UPDATED_MOVE_DATA != GEN_5 - .flags = FLAG_SNATCH_AFFECTED | FLAG_SOUND, - #else - .flags = FLAG_SNATCH_AFFECTED, - #endif .effect = EFFECT_HEAL_BELL, .power = 0, .type = TYPE_NORMAL, @@ -3691,6 +3740,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RECOVER_HP, + .snatchAffected = TRUE, + .soundMove = B_UPDATED_MOVE_FLAGS != GEN_5, }, [MOVE_RETURN] = @@ -3703,9 +3754,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_PRESENT] = @@ -3718,9 +3769,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .ignoresKingsRock = B_UPDATED_MOVE_FLAGS < GEN_5, // && B_UPDATED_MOVE_FLAGS > GEN_2 }, [MOVE_FRUSTRATION] = @@ -3733,9 +3784,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_SAFEGUARD] = @@ -3748,9 +3799,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, + .snatchAffected = TRUE, }, [MOVE_PAIN_SPLIT] = @@ -3763,7 +3814,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, }, @@ -3778,9 +3828,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 50, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_THAW_USER, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .thawsUser = TRUE, }, [MOVE_MAGNITUDE] = @@ -3793,9 +3844,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_DMG_UNDERGROUND, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .damagesUnderground = TRUE, }, [MOVE_DYNAMIC_PUNCH] = @@ -3808,9 +3859,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .punchingMove = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_MEGAHORN] = @@ -3823,9 +3876,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_DRAGON_BREATH] = @@ -3838,9 +3891,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .ignoresKingsRock = B_UPDATED_MOVE_FLAGS < GEN_3, }, [MOVE_BATON_PASS] = @@ -3853,18 +3907,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, }, [MOVE_ENCORE] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_MAGIC_COAT_AFFECTED, - #else - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, - #endif .effect = EFFECT_ENCORE, .power = 0, .type = TYPE_NORMAL, @@ -3875,6 +3923,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, + .magicCoatAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_PURSUIT] = @@ -3887,9 +3936,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .ignoresKingsRock = B_UPDATED_MOVE_FLAGS < GEN_5, // && B_UPDATED_MOVE_FLAGS > GEN_2 }, [MOVE_RAPID_SPIN] = @@ -3906,9 +3956,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_SWEET_SCENT] = @@ -3925,9 +3975,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ACC_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_IRON_TAIL] = @@ -3940,9 +3990,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_METAL_CLAW] = @@ -3955,9 +4006,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_VITAL_THROW] = @@ -3970,9 +4022,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = -1, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_MORNING_SUN] = @@ -3985,9 +4037,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_SYNTHESIS] = @@ -4000,9 +4052,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_MOONLIGHT] = @@ -4019,9 +4071,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_HIDDEN_POWER] = @@ -4038,7 +4090,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -4053,19 +4104,15 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIGH_CRIT, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .highCritRatio = TRUE, }, [MOVE_TWISTER] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_DMG_2X_IN_AIR | FLAG_WIND_MOVE, - #else - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_DMG_2X_IN_AIR, - #endif - .effect = EFFECT_TWISTER, + .effect = EFFECT_FLINCH_HIT, .power = 40, .type = TYPE_DRAGON, .accuracy = 100, @@ -4075,6 +4122,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .damagesAirborneDoubleDamage = TRUE, + .windMove = TRUE, }, [MOVE_RAIN_DANCE] = @@ -4087,7 +4137,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, }, @@ -4102,7 +4151,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, }, @@ -4121,20 +4169,15 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_STRONG_JAW_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, + .bitingMove = TRUE, }, [MOVE_MIRROR_COAT] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_PROTECT_AFFECTED, - #elif B_UPDATED_MOVE_DATA == GEN_4 - .flags = 0, - #else - .flags = FLAG_MIRROR_MOVE_AFFECTED, - #endif .effect = EFFECT_MIRROR_COAT, .power = 1, .type = TYPE_PSYCHIC, @@ -4145,15 +4188,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = -5, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .mirrorMoveBanned = B_UPDATED_MOVE_FLAGS >= GEN_4, + .meFirstBanned = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, }, [MOVE_PSYCH_UP] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = 0, - #else - .flags = FLAG_SNATCH_AFFECTED, - #endif .effect = EFFECT_PSYCH_UP, .power = 0, .type = TYPE_NORMAL, @@ -4164,6 +4206,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RECOVER_HP, + .ignoresProtect = TRUE, + .snatchAffected = B_UPDATED_MOVE_FLAGS < GEN_5, }, [MOVE_EXTREME_SPEED] = @@ -4180,17 +4224,15 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .pp = 5, .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_ANCIENT_POWER] = { - #if B_UPDATED_MOVE_DATA >= GEN_4 - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, - #else - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, + #if B_UPDATED_MOVE_DATA < GEN_4 + .makesContact = TRUE, #endif .effect = EFFECT_ALL_STATS_UP_HIT, .power = 60, @@ -4202,6 +4244,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_SHADOW_BALL] = @@ -4214,9 +4257,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_BALLISTIC, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .ballisticMove = TRUE, }, [MOVE_FUTURE_SIGHT] = @@ -4239,9 +4283,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .ignoresProtect = TRUE, + .mirrorMoveBanned = TRUE, }, [MOVE_ROCK_SMASH] = @@ -4258,9 +4303,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 50, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_WHIRLPOOL] = @@ -4278,9 +4324,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_DMG_UNDERWATER, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .damagesUnderwater = TRUE, }, [MOVE_BEAT_UP] = @@ -4297,7 +4343,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -4306,13 +4351,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = { #if B_UPDATED_MOVE_DATA >= GEN_5 .priority = 3, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, + .makesContact = TRUE, #elif B_UPDATED_MOVE_DATA == GEN_4 .priority = 1, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, + .makesContact = TRUE, #else .priority = 1, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, #endif .effect = EFFECT_FAKE_OUT, .power = 40, @@ -4323,6 +4367,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .target = MOVE_TARGET_SELECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_UPROAR] = @@ -4339,9 +4384,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_RANDOM, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SOUND, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .soundMove = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_STOCKPILE] = @@ -4358,9 +4405,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RECOVER_HP, + .snatchAffected = TRUE, }, [MOVE_SPIT_UP] = @@ -4377,9 +4424,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .mirrorMoveBanned = TRUE, }, [MOVE_SWALLOW] = @@ -4392,9 +4439,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_HEAT_WAVE] = @@ -4411,9 +4458,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_WIND_MOVE, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .windMove = TRUE, }, [MOVE_HAIL] = @@ -4426,18 +4474,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, }, [MOVE_TORMENT] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_MAGIC_COAT_AFFECTED, - #else - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, - #endif .effect = EFFECT_TORMENT, .power = 0, .type = TYPE_DARK, @@ -4448,6 +4490,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .magicCoatAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_FLATTER] = @@ -4460,9 +4503,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_WILL_O_WISP] = @@ -4479,9 +4522,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ATK_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_MEMENTO] = @@ -4494,7 +4537,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESTORE_REPLACEMENT_HP, }, @@ -4509,9 +4551,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_FOCUS_PUNCH] = @@ -4524,9 +4566,15 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = -3, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_IRON_FIST_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .mirrorMoveBanned = TRUE, + .punchingMove = TRUE, + .meFirstBanned = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_SMELLING_SALTS] = @@ -4543,10 +4591,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_PHYSICAL, .argument = STATUS1_PARALYSIS, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_FOLLOW_ME] = @@ -4563,9 +4611,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .pp = 20, .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, }, [MOVE_NATURE_POWER] = @@ -4578,9 +4627,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_DEPENDS, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = B_UPDATED_MOVE_FLAGS >= GEN_4, + .copycatBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_CHARGE] = @@ -4593,20 +4645,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_1, + .snatchAffected = TRUE, }, [MOVE_TAUNT] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, - #elif B_UPDATED_MOVE_DATA == GEN_4 - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, - #else - .flags = FLAG_PROTECT_AFFECTED, - #endif .effect = EFFECT_TAUNT, .power = 0, .type = TYPE_DARK, @@ -4617,6 +4662,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ATK_UP_1, + .magicCoatAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_HELPING_HAND] = @@ -4633,9 +4679,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .pp = 20, .secondaryEffectChance = 0, .priority = 5, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, }, [MOVE_TRICK] = @@ -4648,9 +4695,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_2, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, }, [MOVE_ROLE_PLAY] = @@ -4663,18 +4711,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, + .ignoresProtect = TRUE, }, [MOVE_WISH] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_SNATCH_AFFECTED, - #else - .flags = 0, - #endif .effect = EFFECT_WISH, .power = 0, .type = TYPE_NORMAL, @@ -4685,6 +4728,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_1, + .snatchAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_ASSIST] = @@ -4697,9 +4741,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_DEPENDS, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = B_UPDATED_MOVE_FLAGS >= GEN_4, + .copycatBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_INGRAIN] = @@ -4712,9 +4759,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_1, + .snatchAffected = TRUE, }, [MOVE_SUPERPOWER] = @@ -4727,9 +4774,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_MAGIC_COAT] = @@ -4742,18 +4789,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_DEPENDS, .priority = 4, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_2, }, [MOVE_RECYCLE] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_SNATCH_AFFECTED, - #else - .flags = 0, - #endif .effect = EFFECT_RECYCLE, .power = 0, .type = TYPE_NORMAL, @@ -4764,6 +4805,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_2, + .snatchAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_REVENGE] = @@ -4776,9 +4818,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = -4, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_BRICK_BREAK] = @@ -4791,9 +4833,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_YAWN] = @@ -4806,9 +4848,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_KNOCK_OFF] = @@ -4825,9 +4867,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_ENDEAVOR] = @@ -4840,9 +4882,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_ERUPTION] = @@ -4855,7 +4897,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -4870,18 +4911,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, }, [MOVE_IMPRISON] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_PROTECT_AFFECTED | FLAG_SNATCH_AFFECTED, - #else - .flags = FLAG_PROTECT_AFFECTED, - #endif .effect = EFFECT_IMPRISON, .power = 0, .type = TYPE_PSYCHIC, @@ -4892,6 +4927,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_2, + .snatchAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_REFRESH] = @@ -4904,9 +4940,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RECOVER_HP, + .snatchAffected = TRUE, }, [MOVE_GRUDGE] = @@ -4919,7 +4955,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_FOLLOW_ME, }, @@ -4934,9 +4969,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_DEPENDS, .priority = 4, - .flags = FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_2, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_SECRET_POWER] = @@ -4949,9 +4986,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_DIVE] = @@ -4968,9 +5005,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_ARM_THRUST] = @@ -4983,9 +5022,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_CAMOUFLAGE] = @@ -4998,9 +5037,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_EVSN_UP_1, + .snatchAffected = TRUE, }, [MOVE_TAIL_GLOW] = @@ -5017,9 +5056,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_LUSTER_PURGE] = @@ -5032,9 +5071,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 50, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_MIST_BALL] = @@ -5047,9 +5086,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 50, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_BALLISTIC | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .ballisticMove = TRUE, }, [MOVE_FEATHER_DANCE] = @@ -5062,18 +5102,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_DANCE, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .magicCoatAffected = TRUE, + .danceMove = TRUE, }, [MOVE_TEETER_DANCE] = { - #if B_UPDATED_MOVE_DATA >= GEN_4 - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_DANCE, - #else - .flags = FLAG_PROTECT_AFFECTED | FLAG_DANCE, - #endif .effect = EFFECT_TEETER_DANCE, .power = 0, .type = TYPE_NORMAL, @@ -5084,6 +5120,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPATK_UP_1, + .danceMove = TRUE, + .mirrorMoveBanned = B_UPDATED_MOVE_FLAGS < GEN_4, }, [MOVE_BLAZE_KICK] = @@ -5096,9 +5134,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_HIGH_CRIT | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .highCritRatio = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_MUD_SPORT] = @@ -5111,7 +5151,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_1, }, @@ -5126,18 +5165,15 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_BALLISTIC, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .ballisticMove = TRUE, + .instructBanned = TRUE, }, [MOVE_NEEDLE_ARM] = { - #if B_UPDATED_MOVE_DATA >= GEN_4 - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, - #else - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_DMG_MINIMIZE, - #endif .effect = EFFECT_FLINCH_HIT, .power = 60, .type = TYPE_GRASS, @@ -5148,6 +5184,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, + .minimizeDoubleDamage = B_UPDATED_MOVE_FLAGS < GEN_4, }, [MOVE_SLACK_OFF] = @@ -5164,9 +5203,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_HYPER_VOICE] = @@ -5179,9 +5218,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SOUND, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .soundMove = TRUE, }, [MOVE_POISON_FANG] = @@ -5198,9 +5237,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .pp = 15, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_STRONG_JAW_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, + .bitingMove = TRUE, }, [MOVE_CRUSH_CLAW] = @@ -5213,9 +5254,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 50, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_BLAST_BURN] = @@ -5228,9 +5270,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .instructBanned = TRUE, }, [MOVE_HYDRO_CANNON] = @@ -5243,9 +5285,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .instructBanned = TRUE, }, [MOVE_METEOR_MASH] = @@ -5263,18 +5305,15 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .punchingMove = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_ASTONISH] = { - #if B_UPDATED_MOVE_DATA >= GEN_4 - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, - #else - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_DMG_MINIMIZE, - #endif .effect = EFFECT_FLINCH_HIT, .power = 30, .type = TYPE_GHOST, @@ -5285,6 +5324,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, + .minimizeDoubleDamage = B_UPDATED_MOVE_FLAGS < GEN_4, }, [MOVE_WEATHER_BALL] = @@ -5297,9 +5339,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_BALLISTIC, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .ballisticMove = TRUE, }, [MOVE_AROMATHERAPY] = @@ -5312,9 +5354,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RECOVER_HP, + .snatchAffected = TRUE, }, [MOVE_FAKE_TEARS] = @@ -5327,9 +5369,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPATK_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_AIR_CUTTER] = @@ -5346,22 +5388,22 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIGH_CRIT | FLAG_SLICING_MOVE | FLAG_WIND_MOVE, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .highCritRatio = TRUE, + .windMove = TRUE, + .slicingMove = TRUE, }, [MOVE_OVERHEAT] = { #if B_UPDATED_MOVE_DATA >= GEN_6 .power = 130, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, - #elif B_UPDATED_MOVE_DATA == GEN_4 || B_UPDATED_MOVE_DATA == GEN_5 + #elif B_UPDATED_MOVE_DATA >= GEN_4 .power = 140, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, #else .power = 140, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .makesContact = TRUE, #endif .effect = EFFECT_OVERHEAT, .type = TYPE_FIRE, @@ -5376,15 +5418,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = [MOVE_ODOR_SLEUTH] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .accuracy = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_MAGIC_COAT_AFFECTED, - #elif B_UPDATED_MOVE_DATA == GEN_4 + #if B_UPDATED_MOVE_DATA >= GEN_4 .accuracy = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, #else .accuracy = 100, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, #endif .effect = EFFECT_FORESIGHT, .power = 0, @@ -5395,6 +5432,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ATK_UP_1, + .magicCoatAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_ROCK_TOMB] = @@ -5413,9 +5451,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_SILVER_WIND] = @@ -5428,9 +5466,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_METAL_SOUND] = @@ -5443,9 +5481,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SOUND, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPATK_UP_1, + .magicCoatAffected = TRUE, + .soundMove = TRUE, }, [MOVE_GRASS_WHISTLE] = @@ -5458,9 +5497,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SOUND, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, + .magicCoatAffected = TRUE, + .soundMove = TRUE, }, [MOVE_TICKLE] = @@ -5473,9 +5513,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_COSMIC_POWER] = @@ -5488,9 +5528,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_1, + .snatchAffected = TRUE, }, [MOVE_WATER_SPOUT] = @@ -5503,7 +5543,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -5518,9 +5557,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_SHADOW_PUNCH] = @@ -5533,22 +5572,18 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_IRON_FIST_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .punchingMove = TRUE, }, [MOVE_EXTRASENSORY] = { #if B_UPDATED_MOVE_DATA >= GEN_6 .pp = 20, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, - #elif B_UPDATED_MOVE_DATA == GEN_4 || B_UPDATED_MOVE_DATA == GEN_5 - .pp = 30, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, #else .pp = 30, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_DMG_MINIMIZE, #endif .effect = EFFECT_FLINCH_HIT, .power = 80, @@ -5559,6 +5594,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .minimizeDoubleDamage = B_UPDATED_MOVE_FLAGS < GEN_4, }, [MOVE_SKY_UPPERCUT] = @@ -5571,9 +5608,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_IRON_FIST_BOOST | FLAG_DMG_IN_AIR, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .punchingMove = TRUE, + .damagesAirborne = TRUE, }, [MOVE_SAND_TOMB] = @@ -5591,7 +5630,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -5606,7 +5644,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -5625,9 +5662,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_BULLET_SEED] = @@ -5644,9 +5681,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_BALLISTIC, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .ballisticMove = TRUE, }, [MOVE_AERIAL_ACE] = @@ -5659,9 +5696,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SLICING_MOVE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .slicingMove = TRUE, }, [MOVE_ICICLE_SPEAR] = @@ -5678,7 +5716,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -5693,18 +5730,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_BLOCK] = { - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flags = FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, - #else - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, - #endif .effect = EFFECT_MEAN_LOOK, .power = 0, .type = TYPE_NORMAL, @@ -5715,15 +5747,15 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .ignoresProtect = (B_UPDATED_MOVE_FLAGS >= GEN_6) || (B_UPDATED_MOVE_FLAGS <= GEN_3), + .magicCoatAffected = TRUE, }, [MOVE_HOWL] = { #if B_UPDATED_MOVE_DATA >= GEN_8 - .flags = FLAG_SNATCH_AFFECTED | FLAG_SOUND, .effect = EFFECT_ATTACK_UP_USER_ALLY, #else - .flags = FLAG_SNATCH_AFFECTED, .effect = EFFECT_ATTACK_UP, #endif .power = 0, @@ -5735,6 +5767,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ATK_UP_1, + .snatchAffected = TRUE, + .soundMove = B_UPDATED_MOVE_FLAGS >= GEN_8, }, [MOVE_DRAGON_CLAW] = @@ -5747,9 +5781,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_FRENZY_PLANT] = @@ -5762,7 +5796,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -5777,9 +5810,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ATK_UP_1, + .snatchAffected = TRUE, }, [MOVE_BOUNCE] = @@ -5792,10 +5825,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .argument = MOVE_EFFECT_PARALYSIS, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, + .gravityBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_MUD_SHOT] = @@ -5808,9 +5845,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_POISON_TAIL] = @@ -5823,9 +5860,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIGH_CRIT | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .highCritRatio = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_COVET] = @@ -5833,19 +5872,18 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = #if B_UPDATED_MOVE_DATA >= GEN_6 .power = 60, .pp = 25, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, + .makesContact = TRUE, #elif B_UPDATED_MOVE_DATA == GEN_5 .power = 60, .pp = 40, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, + .makesContact = TRUE, #elif B_UPDATED_MOVE_DATA == GEN_4 .power = 40, .pp = 40, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, + .makesContact = TRUE, #else .power = 40, .pp = 40, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, #endif .effect = EFFECT_THIEF, .type = TYPE_NORMAL, @@ -5855,6 +5893,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .meFirstBanned = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, }, [MOVE_VOLT_TACKLE] = @@ -5872,9 +5913,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_RECKLESS_BOOST | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_MAGICAL_LEAF] = @@ -5887,7 +5929,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -5902,7 +5943,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_1, }, @@ -5917,9 +5957,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_LEAF_BLADE] = @@ -5936,9 +5976,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIGH_CRIT | FLAG_SLICING_MOVE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .highCritRatio = TRUE, + .slicingMove = TRUE, }, [MOVE_DRAGON_DANCE] = @@ -5951,22 +5993,18 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED | FLAG_DANCE, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .danceMove = TRUE, + .snatchAffected = TRUE, }, [MOVE_ROCK_BLAST] = { - #if B_UPDATED_MOVE_DATA >= GEN_7 - .accuracy = 90, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_BALLISTIC, - #elif B_UPDATED_MOVE_DATA == GEN_5 || B_UPDATED_MOVE_DATA == GEN_6 + #if B_UPDATED_MOVE_DATA >= GEN_5 .accuracy = 90, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, #else .accuracy = 80, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, #endif .effect = EFFECT_MULTI_HIT, .power = 25, @@ -5977,6 +6015,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .ballisticMove = B_UPDATED_MOVE_FLAGS >= GEN_6, }, [MOVE_SHOCK_WAVE] = @@ -5989,7 +6028,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -6004,9 +6042,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_MEGA_LAUNCHER_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .pulseMove = TRUE, }, [MOVE_DOOM_DESIRE] = @@ -6024,9 +6063,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .ignoresProtect = TRUE, + .mirrorMoveBanned = TRUE, }, [MOVE_PSYCHO_BOOST] = @@ -6039,7 +6079,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -6058,9 +6097,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_GRAVITY] = @@ -6073,18 +6112,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPATK_UP_1, }, [MOVE_MIRACLE_EYE] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, - #else - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, - #endif .effect = EFFECT_MIRACLE_EYE, .power = 0, .type = TYPE_PSYCHIC, @@ -6095,6 +6128,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPATK_UP_1, + .magicCoatAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_WAKE_UP_SLAP] = @@ -6111,10 +6145,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .argument = STATUS1_SLEEP, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_HAMMER_ARM] = @@ -6127,9 +6161,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_IRON_FIST_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .punchingMove = TRUE, }, [MOVE_GYRO_BALL] = @@ -6142,18 +6177,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_BALLISTIC, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .ballisticMove = TRUE, }, [MOVE_HEALING_WISH] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_SNATCH_AFFECTED, - #else - .flags = 0, - #endif .effect = EFFECT_HEALING_WISH, .power = 0, .type = TYPE_PSYCHIC, @@ -6164,6 +6195,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, + .snatchAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_BRINE] = @@ -6176,7 +6208,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -6191,22 +6222,16 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, }, [MOVE_FEINT] = { - #if B_UPDATED_MOVE_DATA >= GEN_6 - .power = 30, - .flags = FLAG_MIRROR_MOVE_AFFECTED, - #elif B_UPDATED_MOVE_DATA >= GEN_5 + #if B_UPDATED_MOVE_DATA >= GEN_5 .power = 30, - .flags = 0, #else .power = 50, - .flags = 0, #endif .effect = EFFECT_FEINT, .type = TYPE_NORMAL, @@ -6217,6 +6242,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 2, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .ignoresProtect = TRUE, + .mirrorMoveBanned = B_UPDATED_MOVE_FLAGS < GEN_6, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, }, [MOVE_PLUCK] = @@ -6229,9 +6258,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_TAILWIND] = @@ -6248,18 +6277,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED | FLAG_WIND_MOVE, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_BOOST_CRITS, + .snatchAffected = TRUE, + .windMove = TRUE, }, [MOVE_ACUPRESSURE] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = 0, - #else - .flags = FLAG_SNATCH_AFFECTED, - #endif .effect = EFFECT_ACUPRESSURE, .power = 0, .type = TYPE_NORMAL, @@ -6270,15 +6295,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_BOOST_CRITS, + .ignoresProtect = TRUE, + .snatchAffected = B_UPDATED_MOVE_FLAGS < GEN_5, }, [MOVE_METAL_BURST] = { - #if B_UPDATED_MOVE_DATA >= GEN_4 - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, - #else - .flags = FLAG_MIRROR_MOVE_AFFECTED, - #endif .effect = EFFECT_METAL_BURST, .power = 0, .type = TYPE_STEEL, @@ -6289,6 +6311,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .meFirstBanned = TRUE, }, [MOVE_U_TURN] = @@ -6301,9 +6324,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_CLOSE_COMBAT] = @@ -6316,9 +6339,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_PAYBACK] = @@ -6331,9 +6354,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_ASSURANCE] = @@ -6350,18 +6373,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_EMBARGO] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, - #else - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, - #endif .effect = EFFECT_EMBARGO, .power = 0, .type = TYPE_DARK, @@ -6372,6 +6390,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPATK_UP_1, + .magicCoatAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_FLING] = @@ -6384,7 +6403,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -6403,7 +6421,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPATK_UP_2, }, @@ -6418,17 +6435,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, + .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_HEAL_BLOCK] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, - #else - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, - #endif .effect = EFFECT_HEAL_BLOCK, .power = 0, .type = TYPE_PSYCHIC, @@ -6439,6 +6452,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPATK_UP_2, + .magicCoatAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_WRING_OUT] = @@ -6451,17 +6465,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, + .makesContact = TRUE, }, [MOVE_POWER_TRICK] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_SNATCH_AFFECTED, - #else - .flags = 0, - #endif .effect = EFFECT_POWER_TRICK, .power = 0, .type = TYPE_PSYCHIC, @@ -6472,6 +6481,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ATK_UP_1, + .snatchAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_GASTRO_ACID] = @@ -6484,18 +6494,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_LUCKY_CHANT] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_SNATCH_AFFECTED, - #else - .flags = 0, - #endif .effect = EFFECT_LUCKY_CHANT, .power = 0, .type = TYPE_NORMAL, @@ -6506,6 +6511,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_EVSN_UP_1, + .snatchAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_ME_FIRST] = @@ -6518,9 +6524,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_2, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_COPYCAT] = @@ -6533,9 +6542,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_DEPENDS, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ACC_UP_1, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_POWER_SWAP] = @@ -6548,7 +6560,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, }, @@ -6563,7 +6574,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, }, @@ -6578,9 +6588,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_LAST_RESORT] = @@ -6597,9 +6607,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_WORRY_SEED] = @@ -6612,9 +6622,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_SUCKER_PUNCH] = @@ -6631,18 +6641,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 1, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_TOXIC_SPIKES] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_MAGIC_COAT_AFFECTED, - #else - .flags = 0, - #endif .effect = EFFECT_TOXIC_SPIKES, .power = 0, .type = TYPE_POISON, @@ -6653,6 +6658,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .magicCoatAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_HEART_SWAP] = @@ -6665,18 +6671,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_BOOST_CRITS, }, [MOVE_AQUA_RING] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_SNATCH_AFFECTED, - #else - .flags = 0, - #endif .effect = EFFECT_AQUA_RING, .power = 0, .type = TYPE_WATER, @@ -6687,15 +6687,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .snatchAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_MAGNET_RISE] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_SNATCH_AFFECTED, - #else - .flags = 0, - #endif .effect = EFFECT_MAGNET_RISE, .power = 0, .type = TYPE_ELECTRIC, @@ -6706,6 +6702,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_EVSN_UP_1, + .snatchAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, + .gravityBanned = TRUE, }, [MOVE_FLARE_BLITZ] = @@ -6718,10 +6716,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_RECKLESS_BOOST | FLAG_THAW_USER, .split = SPLIT_PHYSICAL, .argument = STATUS1_BURN, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, + .thawsUser = TRUE, }, [MOVE_FORCE_PALM] = @@ -6734,9 +6734,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_AURA_SPHERE] = @@ -6753,9 +6754,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_MEGA_LAUNCHER_BOOST | FLAG_BALLISTIC, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .pulseMove = TRUE, + .ballisticMove = TRUE, }, [MOVE_ROCK_POLISH] = @@ -6768,9 +6770,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_POISON_JAB] = @@ -6783,18 +6785,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_DARK_PULSE] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_MEGA_LAUNCHER_BOOST, - #else - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_MEGA_LAUNCHER_BOOST, - #endif .effect = EFFECT_FLINCH_HIT, .power = 80, .type = TYPE_DARK, @@ -6805,6 +6803,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .pulseMove = TRUE, }, [MOVE_NIGHT_SLASH] = @@ -6817,9 +6817,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIGH_CRIT | FLAG_SLICING_MOVE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .highCritRatio = TRUE, + .slicingMove = TRUE, }, [MOVE_AQUA_TAIL] = @@ -6832,9 +6834,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_SEED_BOMB] = @@ -6847,22 +6849,17 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_BALLISTIC, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .ballisticMove = TRUE, }, [MOVE_AIR_SLASH] = { #if B_UPDATED_MOVE_DATA >= GEN_6 .pp = 15, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_SLICING_MOVE, - #elif B_UPDATED_MOVE_DATA == GEN_5 - .pp = 20, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, #else .pp = 20, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, #endif .effect = EFFECT_FLINCH_HIT, .power = 75, @@ -6873,6 +6870,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .slicingMove = TRUE, }, [MOVE_X_SCISSOR] = @@ -6885,9 +6884,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SLICING_MOVE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .slicingMove = TRUE, }, [MOVE_BUG_BUZZ] = @@ -6900,9 +6900,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SOUND | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .soundMove = TRUE, }, [MOVE_DRAGON_PULSE] = @@ -6919,20 +6920,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_MEGA_LAUNCHER_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .pulseMove = TRUE, }, [MOVE_DRAGON_RUSH] = { - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_DMG_MINIMIZE, - #elif B_UPDATED_MOVE_DATA == GEN_5 - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, - #else - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, - #endif .effect = EFFECT_FLINCH_HIT, .power = 100, .type = TYPE_DRAGON, @@ -6943,6 +6937,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, + .minimizeDoubleDamage = B_UPDATED_MOVE_FLAGS >= GEN_6, }, [MOVE_POWER_GEM] = @@ -6959,7 +6956,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -6979,9 +6975,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_IRON_FIST_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .punchingMove = TRUE, }, [MOVE_VACUUM_WAVE] = @@ -6994,7 +6991,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 1, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -7009,9 +7005,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_BALLISTIC, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .ballisticMove = TRUE, }, [MOVE_ENERGY_BALL] = @@ -7028,9 +7025,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_BALLISTIC | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .ballisticMove = TRUE, }, [MOVE_BRAVE_BIRD] = @@ -7043,9 +7041,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_RECKLESS_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_EARTH_POWER] = @@ -7058,9 +7056,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_SWITCHEROO] = @@ -7073,9 +7071,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_2, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, }, [MOVE_GIGA_IMPACT] = @@ -7088,9 +7087,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .instructBanned = TRUE, }, [MOVE_NASTY_PLOT] = @@ -7103,9 +7103,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_BULLET_PUNCH] = @@ -7118,9 +7118,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 1, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_IRON_FIST_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .punchingMove = TRUE, }, [MOVE_AVALANCHE] = @@ -7133,9 +7134,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = -4, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_ICE_SHARD] = @@ -7148,7 +7149,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 1, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -7163,18 +7163,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIGH_CRIT, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .highCritRatio = TRUE, }, [MOVE_THUNDER_FANG] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_STRONG_JAW_BOOST, - #else - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_STRONG_JAW_BOOST, - #endif .effect = EFFECT_FLINCH_STATUS, .power = 65, .type = TYPE_ELECTRIC, @@ -7186,15 +7182,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .split = SPLIT_PHYSICAL, .argument = STATUS1_PARALYSIS, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, + .bitingMove = TRUE, }, [MOVE_ICE_FANG] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_STRONG_JAW_BOOST, - #else - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_STRONG_JAW_BOOST, - #endif #if B_USE_FROSTBITE == TRUE .argument = STATUS1_FROSTBITE, #else @@ -7210,15 +7204,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, + .bitingMove = TRUE, }, [MOVE_FIRE_FANG] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_STRONG_JAW_BOOST, - #else - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_STRONG_JAW_BOOST, - #endif .effect = EFFECT_FLINCH_STATUS, .power = 65, .type = TYPE_FIRE, @@ -7230,6 +7222,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .split = SPLIT_PHYSICAL, .argument = STATUS1_BURN, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, + .bitingMove = TRUE, }, [MOVE_SHADOW_SNEAK] = @@ -7242,9 +7237,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 1, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_MUD_BOMB] = @@ -7257,9 +7252,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_BALLISTIC, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .ballisticMove = TRUE, }, [MOVE_PSYCHO_CUT] = @@ -7272,9 +7268,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIGH_CRIT | FLAG_SLICING_MOVE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .highCritRatio = TRUE, + .slicingMove = TRUE, }, [MOVE_ZEN_HEADBUTT] = @@ -7287,9 +7284,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_MIRROR_SHOT] = @@ -7302,9 +7300,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_FLASH_CANNON] = @@ -7317,9 +7315,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_ROCK_CLIMB] = @@ -7332,18 +7330,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_DEFOG] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, - #else - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, - #endif .effect = EFFECT_DEFOG, .power = 0, .type = TYPE_FLYING, @@ -7354,6 +7348,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ACC_UP_1, + .magicCoatAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_TRICK_ROOM] = @@ -7366,7 +7361,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, .priority = -7, - .flags = FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ACC_UP_1, }, @@ -7385,7 +7379,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -7400,9 +7393,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_LAVA_PLUME] = @@ -7415,9 +7408,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_LEAF_STORM] = @@ -7434,7 +7427,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -7449,9 +7441,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_ROCK_WRECKER] = @@ -7464,9 +7456,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_BALLISTIC, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .ballisticMove = TRUE, + .instructBanned = TRUE, }, [MOVE_CROSS_POISON] = @@ -7479,9 +7472,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIGH_CRIT | FLAG_SHEER_FORCE_BOOST | FLAG_SLICING_MOVE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .highCritRatio = TRUE, + .sheerForceBoost = TRUE, + .slicingMove = TRUE, }, [MOVE_GUNK_SHOT] = @@ -7498,18 +7494,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_IRON_HEAD] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, - #else - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, - #endif .effect = EFFECT_FLINCH_HIT, .power = 80, .type = TYPE_STEEL, @@ -7520,6 +7511,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_MAGNET_BOMB] = @@ -7532,7 +7525,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_BALLISTIC, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -7547,9 +7539,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIGH_CRIT, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .highCritRatio = TRUE, }, [MOVE_CAPTIVATE] = @@ -7562,18 +7554,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_2, + .magicCoatAffected = TRUE, }, [MOVE_STEALTH_ROCK] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_MAGIC_COAT_AFFECTED, - #else - .flags = 0, - #endif .effect = EFFECT_STEALTH_ROCK, .power = 0, .type = TYPE_ROCK, @@ -7584,6 +7571,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .magicCoatAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, }, [MOVE_GRASS_KNOT] = @@ -7596,9 +7584,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_CHATTER] = @@ -7606,15 +7594,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = #if B_UPDATED_MOVE_DATA >= GEN_6 .power = 65, .secondaryEffectChance = 100, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SOUND | FLAG_SHEER_FORCE_BOOST, #elif B_UPDATED_MOVE_DATA == GEN_5 .power = 60, .secondaryEffectChance = 10, - .flags = FLAG_PROTECT_AFFECTED | FLAG_SOUND | FLAG_SHEER_FORCE_BOOST, #else .power = 60, .secondaryEffectChance = 31, - .flags = FLAG_PROTECT_AFFECTED | FLAG_SOUND | FLAG_SHEER_FORCE_BOOST, #endif .effect = EFFECT_CONFUSE_HIT, .type = TYPE_FLYING, @@ -7624,6 +7609,15 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .soundMove = TRUE, + .mirrorMoveBanned = B_UPDATED_MOVE_FLAGS < GEN_6, + .meFirstBanned = TRUE, + .mimicBanned = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_JUDGMENT] = @@ -7636,7 +7630,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .argument = HOLD_EFFECT_PLATE, .zMoveEffect = Z_EFFECT_NONE, @@ -7652,9 +7645,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_CHARGE_BEAM] = @@ -7667,9 +7660,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 70, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_WOOD_HAMMER] = @@ -7682,9 +7675,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_RECKLESS_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_AQUA_JET] = @@ -7697,9 +7690,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 1, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_ATTACK_ORDER] = @@ -7712,9 +7705,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIGH_CRIT, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .highCritRatio = TRUE, }, [MOVE_DEFEND_ORDER] = @@ -7727,9 +7720,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .snatchAffected = TRUE, }, [MOVE_HEAL_ORDER] = @@ -7742,9 +7735,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_HEAD_SMASH] = @@ -7757,9 +7750,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_RECKLESS_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_DOUBLE_HIT] = @@ -7772,9 +7765,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .strikeCount = 2, }, [MOVE_ROAR_OF_TIME] = @@ -7787,9 +7781,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .instructBanned = TRUE, }, [MOVE_SPACIAL_REND] = @@ -7802,18 +7796,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIGH_CRIT, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .highCritRatio = TRUE, }, [MOVE_LUNAR_DANCE] = { - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flags = FLAG_DANCE | FLAG_SNATCH_AFFECTED, - #else - .flags = FLAG_DANCE, - #endif .effect = EFFECT_HEALING_WISH, .power = 0, .type = TYPE_PSYCHIC, @@ -7824,6 +7813,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, + .snatchAffected = B_UPDATED_MOVE_FLAGS >= GEN_5, + .danceMove = TRUE, }, [MOVE_CRUSH_GRIP] = @@ -7836,9 +7827,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_MAGMA_STORM] = @@ -7859,7 +7850,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -7878,9 +7868,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .magicCoatAffected = TRUE, }, [MOVE_SEED_FLARE] = @@ -7893,9 +7883,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 40, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_OMINOUS_WIND] = @@ -7908,18 +7898,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_SHADOW_FORCE] = { - #if B_UPDATED_MOVE_DATA == GEN_6 - .flags = FLAG_MAKES_CONTACT | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_DMG_MINIMIZE, - #else - .flags = FLAG_MAKES_CONTACT | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, - #endif .effect = EFFECT_SEMI_INVULNERABLE, .power = 120, .type = TYPE_GHOST, @@ -7930,7 +7915,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, .argument = MOVE_EFFECT_FEINT, + .ignoresProtect = TRUE, + .minimizeDoubleDamage = B_UPDATED_MOVE_FLAGS == GEN_6, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_HONE_CLAWS] = @@ -7943,9 +7933,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ATK_UP_1, + .snatchAffected = TRUE, }, [MOVE_WIDE_GUARD] = @@ -7958,10 +7948,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 3, - .flags = FLAG_PROTECTION_MOVE | FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .argument = TRUE, // Protects the whole side. .zMoveEffect = Z_EFFECT_DEF_UP_1, + .snatchAffected = TRUE, + .protectionMove = TRUE, + .metronomeBanned = TRUE, }, [MOVE_GUARD_SPLIT] = @@ -7974,7 +7966,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, }, @@ -7989,7 +7980,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, }, @@ -8008,7 +7998,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .pp = 10, .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, - .flags = FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_1, }, @@ -8023,7 +8012,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -8038,7 +8026,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -8053,9 +8040,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_RAGE_POWDER] = @@ -8072,9 +8059,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .pp = 20, .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, - .flags = FLAG_POWDER, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .powderMove = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, }, [MOVE_TELEKINESIS] = @@ -8087,9 +8076,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPATK_UP_1, + .magicCoatAffected = TRUE, + .gravityBanned = TRUE, }, [MOVE_MAGIC_ROOM] = @@ -8106,7 +8096,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .pp = 10, .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, - .flags = FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_1, }, @@ -8121,9 +8110,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_DMG_IN_AIR, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .damagesAirborne = TRUE, }, [MOVE_STORM_THROW] = @@ -8140,9 +8129,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_FLAME_BURST] = @@ -8155,7 +8144,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -8170,9 +8158,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_QUIVER_DANCE] = @@ -8185,18 +8173,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED | FLAG_DANCE, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_HEAVY_SLAM] = { - #if B_UPDATED_MOVE_DATA >= GEN_7 - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_DMG_MINIMIZE, - #else - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, - #endif .effect = EFFECT_HEAT_CRASH, .power = 1, .type = TYPE_STEEL, @@ -8207,6 +8190,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .danceMove = TRUE, + .minimizeDoubleDamage = B_UPDATED_MOVE_FLAGS >= GEN_7, }, [MOVE_SYNCHRONOISE] = @@ -8224,7 +8210,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -8239,9 +8224,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_BALLISTIC, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .ballisticMove = TRUE, }, [MOVE_SOAK] = @@ -8254,9 +8239,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPATK_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_FLAME_CHARGE] = @@ -8269,9 +8254,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_COIL] = @@ -8284,9 +8270,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_LOW_SWEEP] = @@ -8303,9 +8289,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_ACID_SPRAY] = @@ -8318,9 +8305,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_BALLISTIC | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .ballisticMove = TRUE, }, [MOVE_FOUL_PLAY] = @@ -8333,9 +8321,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_SIMPLE_BEAM] = @@ -8348,9 +8336,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPATK_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_ENTRAINMENT] = @@ -8363,9 +8351,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_AFTER_YOU] = @@ -8378,9 +8366,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, + .metronomeBanned = TRUE, }, [MOVE_ROUND] = @@ -8393,9 +8381,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SOUND, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .soundMove = TRUE, }, [MOVE_ECHOED_VOICE] = @@ -8408,9 +8396,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SOUND, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .soundMove = TRUE, }, [MOVE_CHIP_AWAY] = @@ -8423,9 +8411,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_STAT_STAGES_IGNORED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .ignoresTargetDefenseEvasionStages = TRUE, }, [MOVE_CLEAR_SMOG] = @@ -8438,7 +8427,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -8453,7 +8441,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -8468,10 +8455,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 3, - .flags = FLAG_PROTECTION_MOVE | FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .argument = TRUE, // Protects the whole side. .zMoveEffect = Z_EFFECT_DEF_UP_1, + .snatchAffected = TRUE, + .protectionMove = TRUE, + .metronomeBanned = TRUE, }, [MOVE_ALLY_SWITCH] = @@ -8488,7 +8477,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .pp = 15, .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_2, }, @@ -8503,9 +8491,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_THAW_USER, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .thawsUser = TRUE, }, [MOVE_SHELL_SMASH] = @@ -8518,9 +8507,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_HEAL_PULSE] = @@ -8533,9 +8522,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MEGA_LAUNCHER_BOOST, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .magicCoatAffected = TRUE, + .pulseMove = TRUE, }, [MOVE_HEX] = @@ -8552,7 +8542,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -8567,9 +8556,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .gravityBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_SHIFT_GEAR] = @@ -8582,9 +8574,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_CIRCLE_THROW] = @@ -8597,9 +8589,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = -6, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .copycatBanned = TRUE, }, [MOVE_INCINERATE] = @@ -8616,7 +8609,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -8631,9 +8623,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, + .magicCoatAffected = TRUE, + .metronomeBanned = TRUE, }, [MOVE_ACROBATICS] = @@ -8646,9 +8639,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_REFLECT_TYPE] = @@ -8661,9 +8654,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPATK_UP_1, + .snatchAffected = TRUE, }, [MOVE_RETALIATE] = @@ -8676,9 +8669,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_FINAL_GAMBIT] = @@ -8691,18 +8684,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .mirrorMoveBanned = TRUE, }, [MOVE_BESTOW] = { - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flags = FLAG_MIRROR_MOVE_AFFECTED, - #else - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, - #endif .effect = EFFECT_BESTOW, .power = 0, .type = TYPE_NORMAL, @@ -8713,6 +8701,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_2, + .ignoresProtect = B_UPDATED_MOVE_FLAGS >= GEN_6, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, }, [MOVE_INFERNO] = @@ -8725,9 +8716,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_WATER_PLEDGE] = @@ -8744,7 +8735,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -8763,7 +8753,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -8782,7 +8771,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -8797,7 +8785,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -8816,9 +8803,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_BULLDOZE] = @@ -8831,9 +8818,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_FROST_BREATH] = @@ -8850,7 +8837,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -8865,9 +8851,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = -6, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .copycatBanned = TRUE, }, [MOVE_WORK_UP] = @@ -8880,9 +8867,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ATK_UP_1, + .snatchAffected = TRUE, }, [MOVE_ELECTROWEB] = @@ -8895,9 +8882,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_WILD_CHARGE] = @@ -8910,9 +8897,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_RECKLESS_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_DRILL_RUN] = @@ -8925,9 +8912,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIGH_CRIT, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .highCritRatio = TRUE, }, [MOVE_DUAL_CHOP] = @@ -8940,9 +8928,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .strikeCount = 2, }, [MOVE_HEART_STAMP] = @@ -8955,9 +8944,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_HORN_LEECH] = @@ -8970,9 +8960,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_SACRED_SWORD] = @@ -8989,9 +8979,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_STAT_STAGES_IGNORED | FLAG_SLICING_MOVE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .ignoresTargetDefenseEvasionStages = TRUE, + .slicingMove = TRUE, }, [MOVE_RAZOR_SHELL] = @@ -9004,18 +8996,15 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 50, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_SLICING_MOVE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, + .slicingMove = TRUE, }, [MOVE_HEAT_CRASH] = { - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_DMG_MINIMIZE, - #else - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, - #endif .effect = EFFECT_HEAT_CRASH, .power = 1, .type = TYPE_FIRE, @@ -9026,6 +9015,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .minimizeDoubleDamage = B_UPDATED_MOVE_FLAGS >= GEN_6, }, [MOVE_LEAF_TORNADO] = @@ -9038,9 +9029,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 50, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_STEAMROLLER] = @@ -9054,8 +9045,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .target = MOVE_TARGET_SELECTED, .priority = 0, .split = SPLIT_PHYSICAL, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_DMG_MINIMIZE, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, + .minimizeDoubleDamage = TRUE, }, [MOVE_COTTON_GUARD] = @@ -9068,9 +9061,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_NIGHT_DAZE] = @@ -9083,9 +9076,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 40, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_PSYSTRIKE] = @@ -9098,7 +9091,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -9113,9 +9105,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_HURRICANE] = @@ -9132,9 +9124,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_DMG_IN_AIR | FLAG_WIND_MOVE, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .windMove = TRUE, + .damagesAirborne = TRUE, }, [MOVE_HEAD_CHARGE] = @@ -9147,9 +9141,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_RECKLESS_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_GEAR_GRIND] = @@ -9162,9 +9156,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .strikeCount = 2, }, [MOVE_SEARING_SHOT] = @@ -9177,9 +9172,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_BALLISTIC | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .ballisticMove = TRUE, }, [MOVE_TECHNO_BLAST] = @@ -9196,10 +9192,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .argument = HOLD_EFFECT_DRIVE, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, }, [MOVE_RELIC_SONG] = @@ -9212,10 +9208,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SOUND | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, .argument = STATUS1_SLEEP, + .sheerForceBoost = TRUE, + .soundMove = TRUE, + .metronomeBanned = TRUE, }, [MOVE_SECRET_SWORD] = @@ -9228,9 +9226,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, }, [MOVE_GLACIATE] = @@ -9243,9 +9241,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_BOLT_STRIKE] = @@ -9258,9 +9256,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_BLUE_FLARE] = @@ -9273,9 +9272,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_FIERY_DANCE] = @@ -9288,9 +9287,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 50, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_DANCE | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .danceMove = TRUE, }, [MOVE_FREEZE_SHOCK] = @@ -9303,10 +9303,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .argument = MOVE_EFFECT_PARALYSIS, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .metronomeBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_ICE_BURN] = @@ -9319,10 +9322,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .argument = MOVE_EFFECT_BURN, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .metronomeBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_SNARL] = @@ -9335,9 +9341,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_SOUND, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .soundMove = TRUE, + .metronomeBanned = TRUE, }, [MOVE_ICICLE_CRASH] = @@ -9350,9 +9358,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_V_CREATE] = @@ -9365,9 +9373,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .metronomeBanned = TRUE, }, [MOVE_FUSION_FLARE] = @@ -9380,9 +9389,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_THAW_USER, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .thawsUser = TRUE, }, [MOVE_FUSION_BOLT] = @@ -9395,7 +9404,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -9414,10 +9422,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_DMG_MINIMIZE, .split = SPLIT_PHYSICAL, .argument = TYPE_FLYING, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .minimizeDoubleDamage = TRUE, + .gravityBanned = TRUE, }, [MOVE_MAT_BLOCK] = @@ -9430,10 +9440,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .argument = TRUE, // Protects the whole side. .zMoveEffect = Z_EFFECT_DEF_UP_1, + .snatchAffected = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, }, [MOVE_BELCH] = @@ -9446,9 +9458,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .mirrorMoveBanned = TRUE, + .meFirstBanned = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_ROTOTILLER] = @@ -9461,9 +9478,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ATK_UP_1, + .ignoresProtect = TRUE, }, [MOVE_STICKY_WEB] = @@ -9476,9 +9493,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_OPPONENTS_FIELD, .priority = 0, - .flags = FLAG_MAGIC_COAT_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_FELL_STINGER] = @@ -9495,18 +9512,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_PHANTOM_FORCE] = { - #if B_UPDATED_MOVE_DATA == GEN_6 - .flags = FLAG_MAKES_CONTACT | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_DMG_MINIMIZE, - #else - .flags = FLAG_MAKES_CONTACT | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, - #endif .effect = EFFECT_SEMI_INVULNERABLE, .power = 90, .type = TYPE_GHOST, @@ -9518,6 +9530,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .split = SPLIT_PHYSICAL, .argument = MOVE_EFFECT_FEINT, .zMoveEffect = Z_EFFECT_NONE, + .ignoresProtect = TRUE, + .makesContact = TRUE, + .minimizeDoubleDamage = B_UPDATED_MOVE_FLAGS == GEN_6, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_TRICK_OR_TREAT] = @@ -9530,7 +9547,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .argument = TYPE_GHOST, .zMoveEffect = Z_EFFECT_ALL_STATS_UP_1, @@ -9546,9 +9562,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SOUND, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .magicCoatAffected = TRUE, + .soundMove = TRUE, }, [MOVE_ION_DELUGE] = @@ -9561,7 +9578,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, .priority = 1, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPATK_UP_1, }, @@ -9580,7 +9596,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -9595,7 +9610,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .argument = TYPE_GRASS, .zMoveEffect = Z_EFFECT_ALL_STATS_UP_1, @@ -9611,9 +9625,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_WIND_MOVE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .windMove = TRUE, }, [MOVE_FREEZE_DRY] = @@ -9626,9 +9640,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_DISARMING_VOICE] = @@ -9641,9 +9655,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SOUND, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .soundMove = TRUE, }, [MOVE_PARTING_SHOT] = @@ -9656,9 +9670,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SOUND, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESTORE_REPLACEMENT_HP, + .magicCoatAffected = TRUE, + .soundMove = TRUE, }, [MOVE_TOPSY_TURVY] = @@ -9675,9 +9690,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ATK_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_DRAINING_KISS] = @@ -9690,11 +9705,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .argument = 75, // restores 75% HP instead of 50% HP .zMoveEffect = Z_EFFECT_NONE, - + .makesContact = TRUE, }, [MOVE_CRAFTY_SHIELD] = @@ -9707,10 +9721,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 3, - .flags = 0, .split = SPLIT_STATUS, .argument = TRUE, // Protects the whole side. .zMoveEffect = Z_EFFECT_SPDEF_UP_1, + .metronomeBanned = TRUE, }, [MOVE_FLOWER_SHIELD] = @@ -9723,9 +9737,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .ignoresProtect = TRUE, }, [MOVE_GRASSY_TERRAIN] = @@ -9738,7 +9752,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, }, @@ -9753,7 +9766,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_1, }, @@ -9768,7 +9780,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPATK_UP_1, }, @@ -9783,9 +9794,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_FAIRY_WIND] = @@ -9798,9 +9810,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_WIND_MOVE, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .windMove = TRUE, }, [MOVE_MOONBLAST] = @@ -9813,9 +9825,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_BOOMBURST] = @@ -9828,9 +9840,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SOUND, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .soundMove = TRUE, }, [MOVE_FAIRY_LOCK] = @@ -9843,7 +9855,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, .priority = 0, - .flags = FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, }, @@ -9858,9 +9869,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 4, - .flags = FLAG_PROTECTION_MOVE, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .protectionMove = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_PLAY_NICE] = @@ -9873,9 +9887,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .ignoresProtect = TRUE, + .magicCoatAffected = TRUE, }, [MOVE_CONFIDE] = @@ -9888,9 +9903,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SOUND, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_1, + .ignoresProtect = TRUE, + .magicCoatAffected = TRUE, + .soundMove = TRUE, }, [MOVE_DIAMOND_STORM] = @@ -9907,9 +9924,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 50, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .metronomeBanned = TRUE, }, [MOVE_STEAM_ERUPTION] = @@ -9922,9 +9940,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_THAW_USER, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .thawsUser = TRUE, + .metronomeBanned = TRUE, }, [MOVE_HYPERSPACE_HOLE] = @@ -9937,9 +9957,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .ignoresProtect = TRUE, + .metronomeBanned = TRUE, }, [MOVE_WATER_SHURIKEN] = @@ -9957,7 +9978,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 1, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .zMoveEffect = Z_EFFECT_NONE, }, @@ -9976,9 +9996,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_SPIKY_SHIELD] = @@ -9991,9 +10011,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 4, - .flags = FLAG_PROTECTION_MOVE, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .protectionMove = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, }, [MOVE_AROMATIC_MIST] = @@ -10006,9 +10028,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALLY, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_2, + .ignoresProtect = TRUE, }, [MOVE_EERIE_IMPULSE] = @@ -10021,9 +10043,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_VENOM_DRENCH] = @@ -10036,9 +10058,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_POWDER] = @@ -10051,9 +10073,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 1, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_POWDER, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_2, + .magicCoatAffected = TRUE, }, [MOVE_GEOMANCY] = @@ -10066,9 +10088,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ALL_STATS_UP_1, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_MAGNETIC_FLUX] = @@ -10081,9 +10104,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_1, + .snatchAffected = TRUE, }, [MOVE_HAPPY_HOUR] = @@ -10096,7 +10119,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ALL_STATS_UP_1, }, @@ -10111,7 +10133,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, }, @@ -10126,7 +10147,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -10141,9 +10161,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ALL_STATS_UP_1, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_HOLD_HANDS] = @@ -10156,9 +10179,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALLY, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ALL_STATS_UP_1, + .ignoresProtect = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_BABY_DOLL_EYES] = @@ -10171,9 +10198,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 1, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_NUZZLE] = @@ -10186,9 +10213,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_HOLD_BACK] = @@ -10201,9 +10229,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_INFESTATION] = @@ -10216,9 +10244,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_POWER_UP_PUNCH] = @@ -10231,9 +10259,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .punchingMove = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_OBLIVION_WING] = @@ -10246,7 +10276,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .argument = 75, // restores 75% HP instead of 50% HP .zMoveEffect = Z_EFFECT_NONE, @@ -10262,9 +10291,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_DMG_IN_AIR | FLAG_DMG_UNGROUNDED_IGNORE_TYPE_IF_FLYING, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .damagesAirborne = TRUE, + .ignoreTypeIfFlyingAndUngrounded = TRUE, + .metronomeBanned = TRUE, }, [MOVE_THOUSAND_WAVES] = @@ -10277,9 +10308,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, }, [MOVE_LANDS_WRATH] = @@ -10292,7 +10323,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -10307,9 +10337,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_RECKLESS_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, }, [MOVE_ORIGIN_PULSE] = @@ -10322,9 +10352,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_MEGA_LAUNCHER_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .pulseMove = TRUE, + .metronomeBanned = TRUE, }, [MOVE_PRECIPICE_BLADES] = @@ -10337,9 +10368,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, }, [MOVE_DRAGON_ASCENT] = @@ -10352,9 +10383,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .metronomeBanned = TRUE, }, [MOVE_HYPERSPACE_FURY] = @@ -10367,8 +10399,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIT_IN_SUBSTITUTE, .split = SPLIT_PHYSICAL, + .ignoresProtect = TRUE, + .ignoresSubstitute = TRUE, + .metronomeBanned = TRUE, }, [MOVE_SHORE_UP] = @@ -10385,9 +10419,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .snatchAffected = TRUE, }, [MOVE_FIRST_IMPRESSION] = @@ -10400,9 +10434,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 2, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_BANEFUL_BUNKER] = @@ -10415,9 +10449,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 4, - .flags = FLAG_PROTECTION_MOVE, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .protectionMove = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, }, [MOVE_SPIRIT_SHACKLE] = @@ -10430,9 +10466,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_DARKEST_LARIAT] = @@ -10445,9 +10481,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_STAT_STAGES_IGNORED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .ignoresTargetDefenseEvasionStages = TRUE, }, [MOVE_SPARKLING_ARIA] = @@ -10460,10 +10497,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SOUND | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .argument = STATUS1_BURN, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .soundMove = TRUE, }, [MOVE_ICE_HAMMER] = @@ -10476,9 +10514,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_IRON_FIST_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .punchingMove = TRUE, }, [MOVE_FLORAL_HEALING] = @@ -10491,9 +10530,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, + .magicCoatAffected = TRUE, }, [MOVE_HIGH_HORSEPOWER] = @@ -10506,9 +10545,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_STRENGTH_SAP] = @@ -10521,9 +10560,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_SOLAR_BLADE] = @@ -10536,9 +10575,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SLICING_MOVE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .slicingMove = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_LEAFAGE] = @@ -10551,7 +10593,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -10566,9 +10607,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 3, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPDEF_UP_1, + .magicCoatAffected = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, }, [MOVE_TOXIC_THREAD] = @@ -10581,9 +10624,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_LASER_FOCUS] = @@ -10596,9 +10639,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ATK_UP_1, + .snatchAffected = TRUE, }, [MOVE_GEAR_UP] = @@ -10611,9 +10654,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPATK_UP_1, + .snatchAffected = TRUE, }, [MOVE_THROAT_CHOP] = @@ -10626,9 +10669,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_POLLEN_PUFF] = @@ -10641,9 +10685,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_BALLISTIC, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .ballisticMove = TRUE, }, [MOVE_ANCHOR_SHOT] = @@ -10656,9 +10700,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_PSYCHIC_TERRAIN] = @@ -10671,7 +10716,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPATK_UP_1, }, @@ -10686,9 +10730,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_FIRE_LASH] = @@ -10701,9 +10746,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_POWER_TRIP] = @@ -10716,9 +10762,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_BURN_UP] = @@ -10731,9 +10777,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_THAW_USER, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .thawsUser = TRUE, }, [MOVE_SPEED_SWAP] = @@ -10746,7 +10792,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, }, @@ -10761,9 +10806,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_PURIFY] = @@ -10776,9 +10821,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_ALL_STATS_UP_1, + .magicCoatAffected = TRUE, }, [MOVE_REVELATION_DANCE] = @@ -10791,9 +10836,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_DANCE, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .danceMove = TRUE, }, [MOVE_CORE_ENFORCER] = @@ -10806,7 +10851,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -10821,9 +10865,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_INSTRUCT] = @@ -10836,9 +10881,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPATK_UP_1, + .metronomeBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_BEAK_BLAST] = @@ -10851,9 +10897,15 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = -3, - .flags = FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_BALLISTIC, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .mirrorMoveBanned = TRUE, + .ballisticMove = TRUE, + .meFirstBanned = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_CLANGING_SCALES] = @@ -10866,9 +10918,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SOUND, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .soundMove = TRUE, }, [MOVE_DRAGON_HAMMER] = @@ -10881,9 +10933,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_BRUTAL_SWING] = @@ -10896,9 +10948,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_AURORA_VEIL] = @@ -10911,9 +10963,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, + .snatchAffected = TRUE, }, [MOVE_SHELL_TRAP] = @@ -10926,9 +10978,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = -3, - .flags = FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .mirrorMoveBanned = TRUE, + .meFirstBanned = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_FLEUR_CANNON] = @@ -10941,9 +10998,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, }, [MOVE_PSYCHIC_FANGS] = @@ -10956,9 +11013,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_STRONG_JAW_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .bitingMove = TRUE, }, [MOVE_STOMPING_TANTRUM] = @@ -10971,9 +11029,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_SHADOW_BONE] = @@ -10986,9 +11044,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_ACCELEROCK] = @@ -11001,9 +11059,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 1, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_LIQUIDATION] = @@ -11016,9 +11074,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_PRISMATIC_LASER] = @@ -11031,9 +11090,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .instructBanned = TRUE, }, [MOVE_SPECTRAL_THIEF] = @@ -11046,9 +11105,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .metronomeBanned = TRUE, }, [MOVE_SUNSTEEL_STRIKE] = @@ -11061,9 +11121,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TARGET_ABILITY_IGNORED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .ignoresTargetAbility = TRUE, + .metronomeBanned = B_UPDATED_MOVE_FLAGS >= GEN_8, }, [MOVE_MOONGEIST_BEAM] = @@ -11076,9 +11138,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TARGET_ABILITY_IGNORED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .ignoresTargetAbility = TRUE, + .metronomeBanned = B_UPDATED_MOVE_FLAGS >= GEN_8, }, [MOVE_TEARFUL_LOOK] = @@ -11091,9 +11154,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_DEF_UP_1, + .ignoresProtect = TRUE, + .magicCoatAffected = TRUE, }, [MOVE_ZING_ZAP] = @@ -11106,9 +11170,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_NATURES_MADNESS] = @@ -11121,9 +11185,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .metronomeBanned = B_UPDATED_MOVE_FLAGS >= GEN_8, }, [MOVE_MULTI_ATTACK] = @@ -11140,10 +11205,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .argument = HOLD_EFFECT_MEMORY, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_MIND_BLOWN] = @@ -11156,9 +11221,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, }, [MOVE_PLASMA_FISTS] = @@ -11171,9 +11236,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_IRON_FIST_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .punchingMove = TRUE, + .metronomeBanned = TRUE, }, [MOVE_PHOTON_GEYSER] = @@ -11186,9 +11253,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TARGET_ABILITY_IGNORED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .ignoresTargetAbility = TRUE, + .metronomeBanned = TRUE, }, [MOVE_ZIPPY_ZAP] = @@ -11197,12 +11265,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .power = 80, .effect = EFFECT_EVASION_UP_HIT, .pp = 10, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, + .sheerForceBoost = TRUE, #else .effect = EFFECT_ALWAYS_CRIT, .power = 50, .pp = 15, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, #endif .type = TYPE_ELECTRIC, .accuracy = 100, @@ -11211,15 +11278,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 2, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .mirrorMoveBanned = B_UPDATED_MOVE_FLAGS < GEN_8, + .metronomeBanned = TRUE, }, [MOVE_SPLISHY_SPLASH] = { - #if B_UPDATED_MOVE_DATA >= GEN_8 - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, - #else - .flags = FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, - #endif .effect = EFFECT_PARALYZE_HIT, .power = 90, .type = TYPE_WATER, @@ -11230,15 +11295,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .mirrorMoveBanned = B_UPDATED_MOVE_FLAGS < GEN_8, + .metronomeBanned = TRUE, }, [MOVE_FLOATY_FALL] = { - #if B_UPDATED_MOVE_DATA >= GEN_8 - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, - #else - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_SHEER_FORCE_BOOST, - #endif .effect = EFFECT_FLINCH_HIT, .power = 90, .type = TYPE_FLYING, @@ -11249,15 +11312,15 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, + .mirrorMoveBanned = B_UPDATED_MOVE_FLAGS < GEN_8, + .gravityBanned = TRUE, + .metronomeBanned = TRUE, }, [MOVE_PIKA_PAPOW] = { - #if B_UPDATED_MOVE_DATA >= GEN_8 - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, - #else - .flags = FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, - #endif .effect = EFFECT_RETURN, .power = 1, .type = TYPE_ELECTRIC, @@ -11268,6 +11331,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .mirrorMoveBanned = B_UPDATED_MOVE_FLAGS < GEN_8, }, [MOVE_BOUNCY_BUBBLE] = @@ -11275,12 +11339,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = #if B_UPDATED_MOVE_DATA >= GEN_8 .power = 60, .pp = 20, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .argument = 100, // restores 100% HP instead of 50% HP #else .power = 90, .pp = 15, - .flags = FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, #endif .effect = EFFECT_ABSORB, .type = TYPE_WATER, @@ -11290,6 +11352,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .mirrorMoveBanned = B_UPDATED_MOVE_FLAGS < GEN_8, + .metronomeBanned = TRUE, }, [MOVE_BUZZY_BUZZ] = @@ -11297,11 +11361,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = #if B_UPDATED_MOVE_DATA >= GEN_8 .power = 60, .pp = 20, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, #else .power = 90, .pp = 15, - .flags = FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, #endif .effect = EFFECT_PARALYZE_HIT, .type = TYPE_ELECTRIC, @@ -11311,6 +11373,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .mirrorMoveBanned = B_UPDATED_MOVE_FLAGS < GEN_8, + .metronomeBanned = TRUE, }, [MOVE_SIZZLY_SLIDE] = @@ -11318,11 +11382,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = #if B_UPDATED_MOVE_DATA >= GEN_8 .power = 60, .pp = 20, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_THAW_USER, #else .power = 90, .pp = 15, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_THAW_USER, #endif .effect = EFFECT_BURN_HIT, .type = TYPE_FIRE, @@ -11332,6 +11394,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .mirrorMoveBanned = B_UPDATED_MOVE_FLAGS < GEN_8, + .thawsUser = TRUE, + .metronomeBanned = TRUE, }, [MOVE_GLITZY_GLOW] = @@ -11339,11 +11405,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = #if B_UPDATED_MOVE_DATA >= GEN_8 .power = 80, .accuracy = 95, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, #else .power = 90, .accuracy = 100, - .flags = FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, #endif .effect = EFFECT_GLITZY_GLOW, .type = TYPE_PSYCHIC, @@ -11353,6 +11417,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .mirrorMoveBanned = B_UPDATED_MOVE_FLAGS < GEN_8, + .metronomeBanned = TRUE, }, [MOVE_BADDY_BAD] = @@ -11360,11 +11426,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = #if B_UPDATED_MOVE_DATA >= GEN_8 .power = 80, .accuracy = 95, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, #else .power = 90, .accuracy = 100, - .flags = FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, #endif .effect = EFFECT_BADDY_BAD, .type = TYPE_DARK, @@ -11374,6 +11438,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .mirrorMoveBanned = B_UPDATED_MOVE_FLAGS < GEN_8, + .metronomeBanned = TRUE, }, [MOVE_SAPPY_SEED] = @@ -11382,12 +11448,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .power = 100, .accuracy = 90, .pp = 10, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, #else .power = 90, .accuracy = 100, .pp = 15, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, #endif .effect = EFFECT_SAPPY_SEED, .type = TYPE_GRASS, @@ -11396,6 +11460,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .mirrorMoveBanned = B_UPDATED_MOVE_FLAGS < GEN_8, + .magicCoatAffected = TRUE, + .metronomeBanned = TRUE, }, [MOVE_FREEZY_FROST] = @@ -11404,12 +11471,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .power = 100, .accuracy = 90, .pp = 10, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, #else .power = 90, .accuracy = 100, .pp = 15, - .flags = FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, #endif .effect = EFFECT_FREEZY_FROST, .type = TYPE_ICE, @@ -11418,6 +11483,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .mirrorMoveBanned = B_UPDATED_MOVE_FLAGS < GEN_8, + .metronomeBanned = TRUE, }, [MOVE_SPARKLY_SWIRL] = @@ -11426,12 +11493,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .power = 120, .accuracy = 85, .pp = 5, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, #else .power = 90, .accuracy = 100, .pp = 15, - .flags = FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, #endif .effect = EFFECT_SPARKLY_SWIRL, .type = TYPE_FAIRY, @@ -11440,15 +11505,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .mirrorMoveBanned = B_UPDATED_MOVE_FLAGS < GEN_8, + .metronomeBanned = TRUE, }, [MOVE_VEEVEE_VOLLEY] = { - #if B_UPDATED_MOVE_DATA >= GEN_8 - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, - #else - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, - #endif .effect = EFFECT_RETURN, .power = 1, .type = TYPE_NORMAL, @@ -11459,15 +11521,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .mirrorMoveBanned = B_UPDATED_MOVE_FLAGS < GEN_8, + .metronomeBanned = TRUE, }, [MOVE_DOUBLE_IRON_BASH] = { - #if B_UPDATED_MOVE_DATA >= GEN_8 - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST | FLAG_TWO_STRIKES, - #else - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_DMG_MINIMIZE | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST | FLAG_TWO_STRIKES, - #endif .effect = EFFECT_FLINCH_HIT, .power = 60, .type = TYPE_STEEL, @@ -11478,6 +11538,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .punchingMove = TRUE, + .sheerForceBoost = TRUE, + .strikeCount = 2, + .minimizeDoubleDamage = B_UPDATED_MOVE_FLAGS < GEN_8, + .metronomeBanned = TRUE, }, [MOVE_DYNAMAX_CANNON] = @@ -11490,9 +11556,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_SNIPE_SHOT] = @@ -11505,9 +11574,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIGH_CRIT, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .highCritRatio = TRUE, }, [MOVE_JAW_LOCK] = @@ -11520,9 +11589,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_STRONG_JAW_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .bitingMove = TRUE, }, [MOVE_STUFF_CHEEKS] = @@ -11535,9 +11605,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, + .snatchAffected = TRUE, }, [MOVE_NO_RETREAT] = @@ -11550,9 +11620,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, + .snatchAffected = TRUE, }, [MOVE_TAR_SHOT] = @@ -11565,9 +11635,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, + .magicCoatAffected = TRUE, }, [MOVE_MAGIC_POWDER] = @@ -11580,10 +11650,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_POWDER, .split = SPLIT_STATUS, .argument = TYPE_PSYCHIC, .zMoveEffect = Z_EFFECT_NONE, + .magicCoatAffected = TRUE, + .powderMove = TRUE, }, [MOVE_DRAGON_DARTS] = @@ -11596,9 +11667,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .strikeCount = 2, }, [MOVE_TEATIME] = @@ -11611,9 +11682,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, + .ignoresProtect = TRUE, }, [MOVE_OCTOLOCK] = @@ -11626,7 +11697,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, }, @@ -11641,9 +11711,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_FISHIOUS_REND] = @@ -11656,9 +11726,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_STRONG_JAW_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .bitingMove = TRUE, }, [MOVE_COURT_CHANGE] = @@ -11671,7 +11742,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, .priority = 0, - .flags = FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, }, @@ -11686,9 +11756,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED | FLAG_SOUND, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, + .snatchAffected = TRUE, + .soundMove = TRUE, + .metronomeBanned = TRUE, }, [MOVE_BODY_PRESS] = @@ -11701,13 +11773,15 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .metronomeBanned = TRUE, }, [MOVE_DECORATE] = { + .ignoresProtect = B_UPDATED_MOVE_FLAGS >= GEN_5, .effect = EFFECT_DECORATE, .power = 0, .type = TYPE_FAIRY, @@ -11716,9 +11790,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, }, [MOVE_DRUM_BEATING] = @@ -11731,9 +11805,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .metronomeBanned = TRUE, }, [MOVE_SNAP_TRAP] = @@ -11746,9 +11821,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .metronomeBanned = TRUE, }, [MOVE_PYRO_BALL] = @@ -11761,9 +11837,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_BALLISTIC | FLAG_SHEER_FORCE_BOOST | FLAG_THAW_USER, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .thawsUser = TRUE, + .ballisticMove = TRUE, + .metronomeBanned = TRUE, }, [MOVE_BEHEMOTH_BLADE] = @@ -11776,9 +11855,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SLICING_MOVE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .slicingMove = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, }, [MOVE_BEHEMOTH_BASH] = @@ -11791,9 +11873,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, }, [MOVE_AURA_WHEEL] = @@ -11806,9 +11890,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, }, [MOVE_BREAKING_SWIPE] = @@ -11821,9 +11905,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, + .metronomeBanned = TRUE, }, [MOVE_BRANCH_POKE] = @@ -11836,9 +11922,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .metronomeBanned = TRUE, }, [MOVE_OVERDRIVE] = @@ -11851,9 +11938,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SOUND, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .soundMove = TRUE, + .metronomeBanned = TRUE, }, [MOVE_APPLE_ACID] = @@ -11866,9 +11954,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .metronomeBanned = TRUE, }, [MOVE_GRAV_APPLE] = @@ -11881,9 +11970,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .metronomeBanned = TRUE, }, [MOVE_SPIRIT_BREAK] = @@ -11896,9 +11986,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, + .metronomeBanned = TRUE, }, [MOVE_STRANGE_STEAM] = @@ -11911,9 +12003,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .metronomeBanned = TRUE, }, [MOVE_LIFE_DEW] = @@ -11926,9 +12019,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, + .snatchAffected = TRUE, + .metronomeBanned = TRUE, }, [MOVE_OBSTRUCT] = @@ -11941,9 +12035,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 4, - .flags = FLAG_PROTECTION_MOVE, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, + .protectionMove = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_FALSE_SURRENDER] = @@ -11956,9 +12053,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .metronomeBanned = TRUE, }, [MOVE_METEOR_ASSAULT] = @@ -11971,9 +12069,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_ETERNABEAM] = @@ -11986,9 +12085,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_STEEL_BEAM] = @@ -12001,9 +12101,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, }, [MOVE_EXPANDING_FORCE] = @@ -12016,7 +12116,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -12031,9 +12130,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, .argument = ARG_TRY_REMOVE_TERRAIN_FAIL, // Remove a field terrain if there is one and hit, otherwise fail. }, @@ -12047,7 +12146,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, .argument = MOVE_EFFECT_SCALE_SHOT, @@ -12063,9 +12161,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .instructBanned = TRUE, }, [MOVE_SHELL_SIDE_ARM] = @@ -12078,9 +12176,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_MISTY_EXPLOSION] = @@ -12093,7 +12191,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -12112,9 +12209,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_RISING_VOLTAGE] = @@ -12127,7 +12224,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -12142,9 +12238,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_MEGA_LAUNCHER_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .pulseMove = TRUE, }, [MOVE_SKITTER_SMACK] = @@ -12157,9 +12253,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_BURNING_JEALOUSY] = @@ -12172,9 +12269,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_LASH_OUT] = @@ -12187,9 +12284,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_POLTERGEIST] = @@ -12202,14 +12299,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, }, [MOVE_CORROSIVE_GAS] = { - .effect = EFFECT_PLACEHOLDER, // EFFECT_CORROSIVE_GAS, TODO + .effect = EFFECT_CORROSIVE_GAS, .power = 0, .type = TYPE_POISON, .accuracy = 100, @@ -12217,9 +12313,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, + .magicCoatAffected = TRUE, }, [MOVE_COACHING] = @@ -12232,7 +12328,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALLY, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, }, @@ -12247,9 +12342,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_TRIPLE_AXEL] = @@ -12262,9 +12357,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .strikeCount = 3, }, [MOVE_DUAL_WINGBEAT] = @@ -12277,9 +12373,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .strikeCount = 2, }, [MOVE_SCORCHING_SANDS] = @@ -12292,9 +12389,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_THAW_USER, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .thawsUser = TRUE, }, [MOVE_JUNGLE_HEALING] = @@ -12309,6 +12407,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .priority = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, }, [MOVE_WICKED_BLOW] = @@ -12325,9 +12424,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_IRON_FIST_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .punchingMove = TRUE, + .metronomeBanned = TRUE, }, [MOVE_SURGING_STRIKES] = @@ -12340,9 +12441,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_IRON_FIST_BOOST | FLAG_THREE_STRIKES, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .punchingMove = TRUE, + .strikeCount = 3, + .metronomeBanned = TRUE, }, [MOVE_THUNDER_CAGE] = @@ -12355,9 +12459,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, }, [MOVE_DRAGON_ENERGY] = @@ -12370,9 +12474,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, }, [MOVE_FREEZING_GLARE] = @@ -12389,9 +12493,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .metronomeBanned = TRUE, }, [MOVE_FIERY_WRATH] = @@ -12404,9 +12509,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 20, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, }, [MOVE_THUNDEROUS_KICK] = @@ -12419,9 +12524,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, + .metronomeBanned = TRUE, }, [MOVE_GLACIAL_LANCE] = @@ -12438,9 +12545,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, }, [MOVE_ASTRAL_BARRAGE] = @@ -12453,9 +12560,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, }, [MOVE_EERIE_SPELL] = @@ -12468,9 +12575,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_SOUND, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .soundMove = TRUE, }, [MOVE_DIRE_CLAW] = @@ -12487,9 +12595,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 50, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_PSYSHIELD_BASH] = @@ -12502,9 +12611,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_POWER_SHIFT] = @@ -12517,9 +12627,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, }, [MOVE_STONE_AXE] = @@ -12532,10 +12642,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_SLICING_MOVE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, .argument = MOVE_EFFECT_STEALTH_ROCK, + .sheerForceBoost = TRUE, + .slicingMove = TRUE, }, [MOVE_SPRINGTIDE_STORM] = @@ -12552,9 +12664,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_WIND_MOVE, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .windMove = TRUE, }, [MOVE_MYSTICAL_POWER] = @@ -12567,9 +12680,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_RAGING_FURY] = @@ -12586,9 +12699,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_RANDOM, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .metronomeBanned = TRUE, }, [MOVE_WAVE_CRASH] = @@ -12605,9 +12719,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_CHLOROBLAST] = @@ -12624,7 +12738,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -12639,9 +12752,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_VICTORY_DANCE] = @@ -12654,9 +12767,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED | FLAG_DANCE, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, + .danceMove = TRUE, + .snatchAffected = TRUE, }, [MOVE_HEADLONG_RUSH] = @@ -12673,9 +12787,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_IRON_FIST_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .punchingMove = TRUE, }, [MOVE_BARB_BARRAGE] = @@ -12692,9 +12807,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 50, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_ESPER_WING] = @@ -12712,9 +12827,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIGH_CRIT | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .highCritRatio = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_BITTER_MALICE] = @@ -12731,9 +12847,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_SHELTER] = @@ -12746,43 +12862,45 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, + .snatchAffected = TRUE, }, [MOVE_TRIPLE_ARROWS] = { #if B_UPDATED_MOVE_DATA >= GEN_9 .power = 90, + .pp = 10, #else .power = 50, + .pp = 15, #endif - .effect = EFFECT_PLACEHOLDER, // EFFECT_TRIPLE_ARROWS, + .effect = EFFECT_TRIPLE_ARROWS, .type = TYPE_FIGHTING, .accuracy = 100, - .pp = 15, - .secondaryEffectChance = 100, + .secondaryEffectChance = 100, // 50% Defense down, 30% Flinch. Can be modified in 'SetMoveEffect' .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .highCritRatio = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_INFERNAL_PARADE] = { - .effect = EFFECT_PLACEHOLDER, // EFFECT_INFERNAL_PARADE, + .effect = EFFECT_INFERNAL_PARADE, .power = 60, .type = TYPE_GHOST, .accuracy = 100, .pp = 15, - .secondaryEffectChance = 0, + .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_CEASELESS_EDGE] = @@ -12795,10 +12913,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_SLICING_MOVE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, .argument = MOVE_EFFECT_SPIKES, + .sheerForceBoost = TRUE, + .slicingMove = TRUE, }, [MOVE_BLEAKWIND_STORM] = @@ -12816,9 +12936,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_WIND_MOVE, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .windMove = TRUE, }, [MOVE_WILDBOLT_STORM] = @@ -12836,9 +12957,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_WIND_MOVE, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .windMove = TRUE, }, [MOVE_SANDSEAR_STORM] = @@ -12856,14 +12978,15 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_WIND_MOVE, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .windMove = TRUE, }, [MOVE_LUNAR_BLESSING] = { - .effect = EFFECT_PLACEHOLDER, // EFFECT_LUNAR_BLESSING, + .effect = EFFECT_JUNGLE_HEALING, .power = 0, .type = TYPE_PSYCHIC, .accuracy = 0, @@ -12871,14 +12994,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, + .snatchAffected = TRUE, }, [MOVE_TAKE_HEART] = { - .effect = EFFECT_PLACEHOLDER, // EFFECT_TAKE_HEART, + .effect = EFFECT_TAKE_HEART, .power = 0, .type = TYPE_PSYCHIC, .accuracy = 0, @@ -12886,9 +13009,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, + .snatchAffected = TRUE, }, [MOVE_TERA_BLAST] = @@ -12901,7 +13024,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -12916,24 +13038,26 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 4, - .flags = FLAG_PROTECTION_MOVE, .split = SPLIT_STATUS, - .zMoveEffect = Z_EFFECT_NONE + .zMoveEffect = Z_EFFECT_NONE, + .protectionMove = TRUE, + .metronomeBanned = TRUE, }, [MOVE_AXE_KICK] = { - .effect = EFFECT_PLACEHOLDER, // EFFECT_RECOIL_IF_MISS + 30% chance to confuse + .effect = EFFECT_AXE_KICK, .power = 120, .type = TYPE_FIGHTING, .accuracy = 90, .pp = 10, - .secondaryEffectChance = 0, + .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, - .zMoveEffect = Z_EFFECT_NONE + .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, }, [MOVE_LAST_RESPECTS] = @@ -12946,9 +13070,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, - .zMoveEffect = Z_EFFECT_NONE + .zMoveEffect = Z_EFFECT_NONE, }, [MOVE_LUMINA_CRASH] = @@ -12961,9 +13084,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, - .zMoveEffect = Z_EFFECT_NONE + .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_ORDER_UP] = @@ -12976,9 +13099,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, - .zMoveEffect = Z_EFFECT_NONE + .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .metronomeBanned = TRUE, }, [MOVE_JET_PUNCH] = @@ -12991,10 +13115,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 1, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, - // The datamine master sheet mentions uncopiable by Metronome but that sounds odd? not yet implemented + .makesContact = TRUE, + .punchingMove = TRUE, + .sheerForceBoost = TRUE, + .metronomeBanned = TRUE, }, [MOVE_SPICY_EXTRACT] = @@ -13007,15 +13133,15 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MAGIC_COAT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, - // The datamine master sheet mentions uncopiable by Metronome but that sounds odd? not yet implemented + .magicCoatAffected = TRUE, + .metronomeBanned = TRUE, }, [MOVE_SPIN_OUT] = { - .effect = EFFECT_PLACEHOLDER, // EFFECT_SPIN_OUT + .effect = EFFECT_SPIN_OUT, .power = 100, .type = TYPE_STEEL, .accuracy = 100, @@ -13023,14 +13149,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, - .zMoveEffect = Z_EFFECT_NONE + .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, }, [MOVE_POPULATION_BOMB] = { - .effect = EFFECT_PLACEHOLDER, // EFFECT_MULTI_HIT maybe? + .effect = EFFECT_POPULATION_BOMB, .power = 20, .type = TYPE_NORMAL, .accuracy = 90, @@ -13038,10 +13164,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, // | FLAG_SLICING_MOVE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, - //Supposedly uncallable by Metronome? (if so, needs implementation) + .makesContact = TRUE, + .slicingMove = TRUE, + .metronomeBanned = TRUE, + .strikeCount = 10, }, [MOVE_ICE_SPINNER] = @@ -13054,9 +13182,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, .argument = ARG_TRY_REMOVE_TERRAIN_HIT, // Remove the active field terrain if there is one. }, @@ -13070,9 +13198,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, - .zMoveEffect = Z_EFFECT_NONE + .zMoveEffect = Z_EFFECT_NONE, }, [MOVE_REVIVAL_BLESSING] = @@ -13085,15 +13212,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, - // Uncallable by Metronome (to be implemented) + .metronomeBanned = TRUE, }, [MOVE_SALT_CURE] = { - .effect = EFFECT_PLACEHOLDER, // EFFECT_SALT_CURE + .effect = EFFECT_SALT_CURE, .power = 40, .type = TYPE_ROCK, .accuracy = 100, @@ -13101,10 +13227,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, - // Supposedly uncallable by Metronome, but dubious + .sheerForceBoost = TRUE, + .metronomeBanned = TRUE, }, [MOVE_TRIPLE_DIVE] = @@ -13117,24 +13243,25 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_THREE_STRIKES, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .strikeCount = 3, }, [MOVE_MORTAL_SPIN] = { - .effect = EFFECT_PLACEHOLDER, // EFFECT_MORTAL_SPIN + .effect = EFFECT_MORTAL_SPIN, .power = 30, .type = TYPE_POISON, .accuracy = 100, .pp = 15, - .secondaryEffectChance = 0, + .secondaryEffectChance = 100, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, - .zMoveEffect = Z_EFFECT_NONE + .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, }, [MOVE_DOODLE] = @@ -13146,11 +13273,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .pp = 10, .secondaryEffectChance = 0, .target = MOVE_TARGET_FOES_AND_ALLY, // Supposedly unconfirmed? - .priority = 0, - .flags = 0, // TO VERIFY + .priority = 0, // TO VERIFY .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, - // Supposedly uncallable by Metronome (unimplemented) + .metronomeBanned = TRUE, }, [MOVE_FILLET_AWAY] = @@ -13163,10 +13289,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RECOVER_HP, - // Supposedly uncallable by Metronome (unimplemented) + .snatchAffected = TRUE, + .metronomeBanned = TRUE, }, [MOVE_KOWTOW_CLEAVE] = @@ -13179,9 +13305,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, // | FLAG_SLICING_MOVE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .slicingMove = TRUE, }, [MOVE_FLOWER_TRICK] = @@ -13194,7 +13321,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -13209,9 +13335,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SOUND | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .soundMove = TRUE, }, [MOVE_AQUA_STEP] = @@ -13224,9 +13351,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_DANCE | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .sheerForceBoost = TRUE, + .danceMove = TRUE, }, [MOVE_RAGING_BULL] = @@ -13238,27 +13367,26 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .pp = 10, .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, - .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, // TO VERIFY + .priority = 0, // TO VERIFY .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, - // Uncallable by Metronome (to be implemented) + .makesContact = TRUE, + .metronomeBanned = TRUE, }, [MOVE_MAKE_IT_RAIN] = { - .effect = EFFECT_PLACEHOLDER, // EFFECT_MAKE_IT_RAIN + .effect = EFFECT_MAKE_IT_RAIN, .power = 120, .type = TYPE_STEEL, .accuracy = 100, .pp = 5, - .secondaryEffectChance = 0, + .secondaryEffectChance = 100, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, - // Uncallable by Metronome (to be implemented) + .metronomeBanned = TRUE, }, [MOVE_RUINATION] = @@ -13271,15 +13399,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, - // Uncallable by Metronome (to be implemented) + .metronomeBanned = TRUE, }, [MOVE_COLLISION_COURSE] = { - .effect = EFFECT_PLACEHOLDER, // EFFECT_COLLISION_COURSE + .effect = EFFECT_COLLISION_COURSE, .power = 100, .type = TYPE_FIGHTING, .accuracy = 100, @@ -13287,15 +13414,15 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, - // Uncallable by Metronome (to be implemented) + .makesContact = TRUE, + .metronomeBanned = TRUE, }, [MOVE_ELECTRO_DRIFT] = { - .effect = EFFECT_PLACEHOLDER, // EFFECT_COLLISION_COURSE + .effect = EFFECT_COLLISION_COURSE, .power = 100, .type = TYPE_ELECTRIC, .accuracy = 100, @@ -13303,10 +13430,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, - // Uncallable by Metronome (to be implemented) + .makesContact = TRUE, + .metronomeBanned = TRUE, }, [MOVE_SHED_TAIL] = @@ -13319,10 +13446,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_RESET_STATS, - // Uncallable by Metronome (to be implemented) + .metronomeBanned = TRUE, }, [MOVE_CHILLY_RECEPTION] = @@ -13335,10 +13461,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, - // Supposedly uncallable by Metronome? (to be implemented) + .metronomeBanned = TRUE, }, [MOVE_TIDY_UP] = @@ -13351,10 +13476,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_NONE, - // Supposedly uncallable by Metronome? (to be implemented) + .metronomeBanned = TRUE, }, [MOVE_SNOWSCAPE] = @@ -13367,10 +13491,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_ALL_BATTLERS, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED, .split = SPLIT_STATUS, .zMoveEffect = Z_EFFECT_SPD_UP_1, - // Currently an exact copy of Hail until we figure out what to do with it + .metronomeBanned = TRUE, }, [MOVE_POUNCE] = @@ -13383,9 +13506,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .metronomeBanned = TRUE, }, [MOVE_TRAILBLAZE] = @@ -13398,9 +13522,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .metronomeBanned = TRUE, }, [MOVE_CHILLING_WATER] = @@ -13413,9 +13538,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, }, [MOVE_HYPER_DRILL] = @@ -13428,9 +13553,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .metronomeBanned = TRUE, }, [MOVE_TWIN_BEAM] = @@ -13443,9 +13569,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_TWO_STRIKES, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .strikeCount = 2, + .metronomeBanned = TRUE, }, [MOVE_RAGE_FIST] = @@ -13458,9 +13585,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_IRON_FIST_BOOST | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .punchingMove = TRUE, + .metronomeBanned = TRUE, }, [MOVE_ARMOR_CANNON] = @@ -13473,9 +13602,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, }, [MOVE_BITTER_BLADE] = @@ -13488,9 +13617,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, // | FLAG_SLICING_MOVE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .slicingMove = TRUE, }, [MOVE_DOUBLE_SHOCK] = @@ -13503,14 +13633,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, - .zMoveEffect = Z_EFFECT_NONE + .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, }, [MOVE_GIGATON_HAMMER] = { - .effect = EFFECT_PLACEHOLDER, // EFFECT_GIGATON_HAMMER + .effect = EFFECT_GIGATON_HAMMER, .power = 160, .type = TYPE_STEEL, .accuracy = 100, @@ -13518,7 +13648,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -13533,9 +13662,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_DEPENDS, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .metronomeBanned = TRUE, }, [MOVE_AQUA_CUTTER] = @@ -13548,9 +13677,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIGH_CRIT, // | FLAG_SLICING_MOVE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .slicingMove = TRUE, + .highCritRatio = TRUE, }, [MOVE_BLAZING_TORQUE] = @@ -13563,9 +13693,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, - .zMoveEffect = Z_EFFECT_NONE + .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .mimicBanned = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_WICKED_TORQUE] = @@ -13578,9 +13713,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 10, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, - .zMoveEffect = Z_EFFECT_NONE + .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .mimicBanned = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_NOXIOUS_TORQUE] = @@ -13593,9 +13733,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, - .zMoveEffect = Z_EFFECT_NONE + .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .mimicBanned = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_COMBAT_TORQUE] = @@ -13608,9 +13753,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, - .zMoveEffect = Z_EFFECT_NONE + .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .mimicBanned = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_MAGICAL_TORQUE] = @@ -13623,9 +13773,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_PHYSICAL, - .zMoveEffect = Z_EFFECT_NONE + .zMoveEffect = Z_EFFECT_NONE, + .sheerForceBoost = TRUE, + .mimicBanned = TRUE, + .metronomeBanned = TRUE, + .copycatBanned = TRUE, + .sleepTalkBanned = TRUE, + .instructBanned = TRUE, }, [MOVE_PSYBLADE] = @@ -13638,9 +13793,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SLICING_MOVE, .split = SPLIT_PHYSICAL, .zMoveEffect = Z_EFFECT_NONE, + .makesContact = TRUE, + .slicingMove = TRUE, }, [MOVE_HYDRO_STEAM] = @@ -13653,7 +13809,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL, .zMoveEffect = Z_EFFECT_NONE, }, @@ -13669,9 +13824,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, //determined from move type - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_ALL_OUT_PUMMELING] = { @@ -13683,9 +13837,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_SUPERSONIC_SKYSTRIKE] = { @@ -13697,9 +13850,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_ACID_DOWNPOUR] = { @@ -13711,9 +13863,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_TECTONIC_RAGE] = { @@ -13725,9 +13876,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_CONTINENTAL_CRUSH] = { @@ -13739,9 +13889,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_SAVAGE_SPIN_OUT] = { @@ -13753,9 +13902,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_NEVER_ENDING_NIGHTMARE] = { @@ -13767,9 +13915,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_CORKSCREW_CRASH] = { @@ -13781,9 +13928,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_INFERNO_OVERDRIVE] = { @@ -13795,9 +13941,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_HYDRO_VORTEX] = { @@ -13809,9 +13954,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_BLOOM_DOOM] = { @@ -13823,9 +13967,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_GIGAVOLT_HAVOC] = { @@ -13837,9 +13980,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_SHATTERED_PSYCHE] = { @@ -13851,9 +13993,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_SUBZERO_SLAMMER] = { @@ -13865,9 +14006,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_DEVASTATING_DRAKE] = { @@ -13879,9 +14019,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_BLACK_HOLE_ECLIPSE] = { @@ -13893,9 +14032,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_TWINKLE_TACKLE] = { @@ -13907,9 +14045,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_CATASTROPIKA] = { @@ -13921,9 +14058,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_10000000_VOLT_THUNDERBOLT] = { @@ -13935,9 +14071,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_HIGH_CRIT, .split = SPLIT_SPECIAL, - .zMoveEffect = 0 + .zMoveEffect = 0, + .highCritRatio = TRUE, }, [MOVE_STOKED_SPARKSURFER] = { @@ -13949,9 +14085,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_SPECIAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_EXTREME_EVOBOOST] = { @@ -13963,9 +14098,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = 0, .split = SPLIT_STATUS, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_PULVERIZING_PANCAKE] = { @@ -13977,9 +14111,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_GENESIS_SUPERNOVA] = { @@ -13991,10 +14124,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_SPECIAL, .argument = ARG_SET_PSYCHIC_TERRAIN, // Set Psychic Terrain. If there's a different field terrain active, overwrite it. - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_SINISTER_ARROW_RAID] = { @@ -14006,9 +14138,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_MALICIOUS_MOONSAULT] = { @@ -14020,9 +14151,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_OCEANIC_OPERETTA] = { @@ -14034,9 +14164,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_SPECIAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_SPLINTERED_STORMSHARDS] = { @@ -14048,10 +14177,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, .argument = ARG_TRY_REMOVE_TERRAIN_HIT, // Remove the active field terrain if there is one. - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_LETS_SNUGGLE_FOREVER] = { @@ -14063,9 +14191,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_CLANGOROUS_SOULBLAZE] = { @@ -14077,9 +14204,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 100, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_SOUND, .split = SPLIT_SPECIAL, - .zMoveEffect = 0 + .zMoveEffect = 0, + .soundMove = TRUE, }, [MOVE_GUARDIAN_OF_ALOLA] = { @@ -14091,9 +14218,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_SPECIAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_SEARING_SUNRAZE_SMASH] = { @@ -14105,9 +14231,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_MENACING_MOONRAZE_MAELSTROM] = { @@ -14119,9 +14244,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_SPECIAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_LIGHT_THAT_BURNS_THE_SKY] = { @@ -14133,9 +14257,8 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_SPECIAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, [MOVE_SOUL_STEALING_7_STAR_STRIKE] = { @@ -14147,8 +14270,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = 0, .split = SPLIT_PHYSICAL, - .zMoveEffect = 0 + .zMoveEffect = 0, }, }; diff --git a/src/data/contest_opponents.h b/src/data/contest_opponents.h index 10fff6134988..feeb29524f1a 100644 --- a/src/data/contest_opponents.h +++ b/src/data/contest_opponents.h @@ -138,11 +138,14 @@ enum { #define CONTEST_AI_SET_20 (CONTEST_AI_COMMON | CONTEST_AI_DUMMY_12 | CONTEST_AI_DUMMY_25) #define CONTEST_AI_SET_21 (CONTEST_AI_COMMON | CONTEST_AI_DUMMY_7 | CONTEST_AI_DUMMY_25) +// All AI contestants have the same trainer ID +#define CONTEST_AI_TRAINER_ID 0xFFFF + const struct ContestWinner gDefaultContestWinners[] = { [CONTEST_WINNER_HALL_1 - 1] = { .personality = 0, - .trainerId = 0xFFFF, + .trainerId = CONTEST_AI_TRAINER_ID, .species = SPECIES_ELECTRIKE, .contestCategory = CONTEST_CATEGORY_CUTE, .monName = _("ELECTER"), @@ -151,7 +154,7 @@ const struct ContestWinner gDefaultContestWinners[] = }, [CONTEST_WINNER_HALL_2 - 1] = { .personality = 0, - .trainerId = 0xFFFF, + .trainerId = CONTEST_AI_TRAINER_ID, .species = SPECIES_TROPIUS, .contestCategory = CONTEST_CATEGORY_COOL, .monName = _("TROPO"), @@ -160,7 +163,7 @@ const struct ContestWinner gDefaultContestWinners[] = }, [CONTEST_WINNER_HALL_3 - 1] = { .personality = 0, - .trainerId = 0xFFFF, + .trainerId = CONTEST_AI_TRAINER_ID, .species = SPECIES_XATU, .contestCategory = CONTEST_CATEGORY_BEAUTY, .monName = _("TUXA"), @@ -169,7 +172,7 @@ const struct ContestWinner gDefaultContestWinners[] = }, [CONTEST_WINNER_HALL_4 - 1] = { .personality = 0, - .trainerId = 0xFFFF, + .trainerId = CONTEST_AI_TRAINER_ID, .species = SPECIES_PLUSLE, .contestCategory = CONTEST_CATEGORY_TOUGH, .monName = _("PULSE"), @@ -178,7 +181,7 @@ const struct ContestWinner gDefaultContestWinners[] = }, [CONTEST_WINNER_HALL_5 - 1] = { .personality = 0, - .trainerId = 0xFFFF, + .trainerId = CONTEST_AI_TRAINER_ID, .species = SPECIES_SHUPPET, .contestCategory = CONTEST_CATEGORY_SMART, .monName = _("SHUPUP"), @@ -187,7 +190,7 @@ const struct ContestWinner gDefaultContestWinners[] = }, [CONTEST_WINNER_HALL_6 - 1] = { .personality = 0, - .trainerId = 0xFFFF, + .trainerId = CONTEST_AI_TRAINER_ID, .species = SPECIES_ZANGOOSE, .contestCategory = CONTEST_CATEGORY_COOL, .monName = _("GOOZAN"), @@ -196,7 +199,7 @@ const struct ContestWinner gDefaultContestWinners[] = }, [CONTEST_WINNER_HALL_UNUSED_1 - 1] = { .personality = 0, - .trainerId = 0xFFFF, + .trainerId = CONTEST_AI_TRAINER_ID, .species = SPECIES_LOUDRED, .contestCategory = CONTEST_CATEGORY_BEAUTY, .monName = _("LOUDED"), @@ -205,7 +208,7 @@ const struct ContestWinner gDefaultContestWinners[] = }, [CONTEST_WINNER_HALL_UNUSED_2 - 1] = { .personality = 0, - .trainerId = 0xFFFF, + .trainerId = CONTEST_AI_TRAINER_ID, .species = SPECIES_DELCATTY, .contestCategory = CONTEST_CATEGORY_CUTE, .monName = _("KITSY"), @@ -242,7 +245,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 4, .sheen = 50, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_EDITH] = { .species = SPECIES_ILLUMISE, @@ -270,7 +273,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 2, .sheen = 60, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_EVAN] = { .species = SPECIES_DUSTOX, @@ -298,7 +301,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 4, .sheen = 70, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_KELSEY] = { .species = SPECIES_SEEDOT, @@ -326,7 +329,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 7, .sheen = 80, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_MADISON] = { .species = SPECIES_TAILLOW, @@ -354,7 +357,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 4, .sheen = 90, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_RAYMOND] = { .species = SPECIES_NINCADA, @@ -382,7 +385,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 8, .sheen = 100, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_GRANT] = { .species = SPECIES_SHROOMISH, @@ -410,7 +413,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 2, .sheen = 50, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_PAIGE] = { .species = SPECIES_SPHEAL, @@ -438,7 +441,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 10, .sheen = 60, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_ALEC] = { .species = SPECIES_SLAKOTH, @@ -466,7 +469,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 18, .sheen = 70, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_SYDNEY] = { .species = SPECIES_WHISMUR, @@ -494,7 +497,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 7, .sheen = 80, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_MORRIS] = { .species = SPECIES_MAKUHITA, @@ -522,7 +525,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 1, .sheen = 90, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_MARIAH] = { .species = SPECIES_ARON, @@ -550,7 +553,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 2, .sheen = 100, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_RUSSELL] = { .species = SPECIES_CROBAT, @@ -578,7 +581,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 10, .sheen = 50, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_MELANIE] = { .species = SPECIES_GULPIN, @@ -606,7 +609,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 5, .sheen = 60, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_CHANCE] = { .species = SPECIES_MANECTRIC, @@ -634,7 +637,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 1, .sheen = 70, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_AGATHA] = { .species = SPECIES_BULBASAUR, @@ -662,7 +665,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 4, .sheen = 50, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_BEAU] = { .species = SPECIES_BUTTERFREE, @@ -690,7 +693,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 4, .sheen = 60, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_KAY] = { .species = SPECIES_PIDGEOTTO, @@ -718,7 +721,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 3, .sheen = 70, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_CALE] = { .species = SPECIES_DIGLETT, @@ -746,7 +749,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 10, .sheen = 80, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_CAITLIN] = { .species = SPECIES_POLIWAG, @@ -774,7 +777,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 10, .sheen = 90, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_COLBY] = { .species = SPECIES_TOTODILE, @@ -802,7 +805,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 5, .sheen = 100, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_KYLIE] = { .species = SPECIES_LEDYBA, @@ -830,7 +833,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 2, .sheen = 90, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_LIAM] = { .species = SPECIES_DELIBIRD, @@ -858,7 +861,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 3, .sheen = 80, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_MILO] = { .species = SPECIES_LARVITAR, @@ -886,7 +889,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 10, .sheen = 70, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_KARINA] = { .species = SPECIES_ROSELIA, @@ -914,7 +917,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 20, .sheen = 100, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_BOBBY] = { .species = SPECIES_DODRIO, @@ -942,7 +945,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 35, .sheen = 110, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_CLAIRE] = { .species = SPECIES_TRAPINCH, @@ -970,7 +973,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 25, .sheen = 120, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_WILLIE] = { .species = SPECIES_CACNEA, @@ -998,7 +1001,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 25, .sheen = 130, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_CASSIDY] = { .species = SPECIES_SANDSLASH, @@ -1026,7 +1029,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 100, .sheen = 140, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_MORGAN] = { .species = SPECIES_BALTOY, @@ -1054,7 +1057,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 35, .sheen = 150, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_SUMMER] = { .species = SPECIES_MEDICHAM, @@ -1082,7 +1085,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 40, .sheen = 100, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_MILES] = { .species = SPECIES_SPINDA, @@ -1110,7 +1113,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 25, .sheen = 110, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_AUDREY] = { .species = SPECIES_SWABLU, @@ -1138,7 +1141,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 25, .sheen = 120, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_AVERY] = { .species = SPECIES_SPOINK, @@ -1166,7 +1169,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 30, .sheen = 130, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_ARIANA] = { .species = SPECIES_KECLEON, @@ -1194,7 +1197,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 35, .sheen = 140, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_ASHTON] = { .species = SPECIES_GOLDEEN, @@ -1222,7 +1225,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 25, .sheen = 150, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_SANDRA] = { .species = SPECIES_BARBOACH, @@ -1250,7 +1253,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 15, .sheen = 100, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_CARSON] = { .species = SPECIES_SKARMORY, @@ -1278,7 +1281,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 20, .sheen = 110, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_KATRINA] = { .species = SPECIES_LOTAD, @@ -1306,7 +1309,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 75, .sheen = 120, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_LUKE] = { .species = SPECIES_SLOWBRO, @@ -1334,7 +1337,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 20, .sheen = 100, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_RAUL] = { .species = SPECIES_FARFETCHD, @@ -1362,7 +1365,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 20, .sheen = 110, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_JADA] = { .species = SPECIES_SEEL, @@ -1390,7 +1393,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 20, .sheen = 120, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_ZEEK] = { .species = SPECIES_DROWZEE, @@ -1418,7 +1421,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 45, .sheen = 130, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_DIEGO] = { .species = SPECIES_HITMONCHAN, @@ -1446,7 +1449,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 45, .sheen = 140, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_ALIYAH] = { .species = SPECIES_BLISSEY, @@ -1474,7 +1477,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 20, .sheen = 150, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_NATALIA] = { .species = SPECIES_ELEKID, @@ -1502,7 +1505,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 25, .sheen = 140, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_DEVIN] = { .species = SPECIES_SNUBBULL, @@ -1530,7 +1533,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 20, .sheen = 130, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_TYLOR] = { .species = SPECIES_MISDREAVUS, @@ -1558,7 +1561,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 20, .sheen = 120, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_RONNIE] = { .species = SPECIES_LAIRON, @@ -1586,7 +1589,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 90, .sheen = 200, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_CLAUDIA] = { .species = SPECIES_SHIFTRY, @@ -1614,7 +1617,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 70, .sheen = 210, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_ELIAS] = { .species = SPECIES_NINJASK, @@ -1642,7 +1645,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 70, .sheen = 220, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_JADE] = { .species = SPECIES_SWELLOW, @@ -1670,7 +1673,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 40, .sheen = 230, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_FRANCIS] = { .species = SPECIES_MIGHTYENA, @@ -1698,7 +1701,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 70, .sheen = 240, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_ALISHA] = { .species = SPECIES_BEAUTIFLY, @@ -1726,7 +1729,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 100, .sheen = 250, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_SAUL] = { .species = SPECIES_SEAKING, @@ -1754,7 +1757,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 90, .sheen = 200, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_FELICIA] = { .species = SPECIES_CASTFORM, @@ -1782,7 +1785,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 65, .sheen = 210, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_EMILIO] = { .species = SPECIES_MACHOKE, @@ -1810,7 +1813,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 50, .sheen = 220, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_KARLA] = { .species = SPECIES_LOMBRE, @@ -1838,7 +1841,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 70, .sheen = 230, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_DARRYL] = { .species = SPECIES_SEVIPER, @@ -1866,7 +1869,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 100, .sheen = 240, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_SELENA] = { .species = SPECIES_WAILMER, @@ -1894,7 +1897,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 30, .sheen = 250, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_NOEL] = { .species = SPECIES_MAGIKARP, @@ -1922,7 +1925,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 160, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_LACEY] = { .species = SPECIES_LUNATONE, @@ -1950,7 +1953,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 50, .sheen = 210, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_CORBIN] = { .species = SPECIES_ABSOL, @@ -1978,7 +1981,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 35, .sheen = 220, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_GRACIE] = { .species = SPECIES_EXEGGUTOR, @@ -2006,7 +2009,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 80, .sheen = 200, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_COLTIN] = { .species = SPECIES_CUBONE, @@ -2034,7 +2037,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 100, .sheen = 210, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_ELLIE] = { .species = SPECIES_HITMONLEE, @@ -2062,7 +2065,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 100, .sheen = 220, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_MARCUS] = { .species = SPECIES_SQUIRTLE, @@ -2090,7 +2093,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 95, .sheen = 230, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_KIARA] = { .species = SPECIES_KANGASKHAN, @@ -2118,7 +2121,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 100, .sheen = 240, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_BRYCE] = { .species = SPECIES_PINECO, @@ -2146,7 +2149,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 80, .sheen = 250, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_JAMIE] = { .species = SPECIES_DUNSPARCE, @@ -2174,7 +2177,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 110, .sheen = 240, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_JORGE] = { .species = SPECIES_HOUNDOOM, @@ -2202,7 +2205,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 80, .sheen = 230, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_DEVON] = { .species = SPECIES_MILTANK, @@ -2230,7 +2233,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 40, .sheen = 220, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_JUSTINA] = { .species = SPECIES_GYARADOS, @@ -2258,7 +2261,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 160, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_RALPH] = { .species = SPECIES_LOUDRED, @@ -2286,7 +2289,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 160, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_ROSA] = { .species = SPECIES_SKITTY, @@ -2314,7 +2317,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 60, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_KEATON] = { .species = SPECIES_SLAKING, @@ -2342,7 +2345,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 150, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_MAYRA] = { .species = SPECIES_ALTARIA, @@ -2370,7 +2373,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 90, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_LAMAR] = { .species = SPECIES_KIRLIA, @@ -2398,7 +2401,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 80, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_AUBREY] = { .species = SPECIES_BELLOSSOM, @@ -2426,7 +2429,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 40, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_NIGEL] = { .species = SPECIES_SABLEYE, @@ -2454,7 +2457,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 160, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_CAMILLE] = { .species = SPECIES_NATU, @@ -2482,7 +2485,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 170, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_DEON] = { .species = SPECIES_SHARPEDO, @@ -2510,7 +2513,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 100, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_JANELLE] = { .species = SPECIES_LUVDISC, @@ -2538,7 +2541,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 190, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_HEATH] = { .species = SPECIES_HERACROSS, @@ -2566,7 +2569,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 140, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_SASHA] = { .species = SPECIES_ELECTRODE, @@ -2594,7 +2597,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 50, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_FRANKIE] = { .species = SPECIES_PICHU, @@ -2622,7 +2625,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 120, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_HELEN] = { .species = SPECIES_WOBBUFFET, @@ -2650,7 +2653,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 210, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_CAMILE] = { .species = SPECIES_GENGAR, @@ -2678,7 +2681,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 180, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_MARTIN] = { .species = SPECIES_PORYGON, @@ -2706,7 +2709,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 130, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_SERGIO] = { .species = SPECIES_DRAGONITE, @@ -2734,7 +2737,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 150, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_KAILEY] = { .species = SPECIES_MEOWTH, @@ -2762,7 +2765,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 80, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_PERLA] = { .species = SPECIES_JYNX, @@ -2790,7 +2793,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 120, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_CLARA] = { .species = SPECIES_TOGEPI, @@ -2818,7 +2821,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 80, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_JAKOB] = { .species = SPECIES_ESPEON, @@ -2846,7 +2849,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 150, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_TREY] = { .species = SPECIES_SLOWKING, @@ -2874,7 +2877,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 170, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_LANE] = { .species = SPECIES_URSARING, @@ -2902,7 +2905,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 190, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, } }; diff --git a/src/data/graphics/berry_fix.h b/src/data/graphics/berry_fix.h index 07e2cbf51c06..0c26f7e92be4 100644 --- a/src/data/graphics/berry_fix.h +++ b/src/data/graphics/berry_fix.h @@ -1,6 +1,6 @@ -const u16 gBerryFixGameboy_Pal[] = INCBIN_U16("graphics/berry_fix/gba_small.gbapal"); -const u32 gBerryFixGameboy_Gfx[] = INCBIN_U32("graphics/berry_fix/gba_small.4bpp.lz"); -const u32 gBerryFixGameboy_Tilemap[] = INCBIN_U32("graphics/berry_fix/gba_small.bin.lz"); +const u16 gBerryFixGbaConnect_Pal[] = INCBIN_U16("graphics/berry_fix/gba_connect.gbapal"); +const u32 gBerryFixGbaConnect_Gfx[] = INCBIN_U32("graphics/berry_fix/gba_connect.4bpp.lz"); +const u32 gBerryFixGbaConnect_Tilemap[] = INCBIN_U32("graphics/berry_fix/gba_connect.bin.lz"); const u16 gBerryFixGameboyLogo_Pal[] = INCBIN_U16("graphics/berry_fix/logo.gbapal"); const u32 gBerryFixGameboyLogo_Gfx[] = INCBIN_U32("graphics/berry_fix/logo.4bpp.lz"); diff --git a/src/data/graphics/items.h b/src/data/graphics/items.h index 9ef79b2c9256..60cd7d51875c 100644 --- a/src/data/graphics/items.h +++ b/src/data/graphics/items.h @@ -1943,8 +1943,8 @@ const u32 gItemIconPalette_Sapphire[] = INCBIN_U32("graphics/items/icon_palettes const u32 gItemIcon_AbilityShield[] = INCBIN_U32("graphics/items/icons/ability_shield.4bpp.lz"); const u32 gItemIconPalette_AbilityShield[] = INCBIN_U32("graphics/items/icon_palettes/ability_shield.gbapal.lz"); -//const u32 gItemIcon_ClearAmulet[] = INCBIN_U32("graphics/items/icons/clear_amulet.4bpp.lz"); -//const u32 gItemIconPalette_ClearAmulet[] = INCBIN_U32("graphics/items/icon_palettes/clear_amulet.gbapal.lz"); +const u32 gItemIcon_ClearAmulet[] = INCBIN_U32("graphics/items/icons/clear_amulet.4bpp.lz"); +const u32 gItemIconPalette_ClearAmulet[] = INCBIN_U32("graphics/items/icon_palettes/clear_amulet.gbapal.lz"); const u32 gItemIcon_PunchingGlove[] = INCBIN_U32("graphics/items/icons/punching_glove.4bpp.lz"); const u32 gItemIconPalette_PunchingGlove[] = INCBIN_U32("graphics/items/icon_palettes/punching_glove.gbapal.lz"); @@ -1988,7 +1988,29 @@ const u32 gItemIconPalette_TeraOrb[] = INCBIN_U32("graphics/items/icon_palettes/ const u32 gItemIcon_TinyBambooShoot[] = INCBIN_U32("graphics/items/icons/tiny_bamboo_shoot.4bpp.lz"); const u32 gItemIconPalette_TinyBambooShoot[] = INCBIN_U32("graphics/items/icon_palettes/tiny_bamboo_shoot.gbapal.lz"); -// Tera Shards here +// Tera Shards + +const u32 gItemIcon_TeraShard[] = INCBIN_U32("graphics/items/icons/tera_shard.4bpp.lz"); +const u32 gItemIconPalette_NormalTeraShard[] = INCBIN_U32("graphics/items/icon_palettes/normal_tera_shard.gbapal.lz"); +const u32 gItemIconPalette_FireTeraShard[] = INCBIN_U32("graphics/items/icon_palettes/fire_tera_shard.gbapal.lz"); +const u32 gItemIconPalette_WaterTeraShard[] = INCBIN_U32("graphics/items/icon_palettes/water_tera_shard.gbapal.lz"); +const u32 gItemIconPalette_GrassTeraShard[] = INCBIN_U32("graphics/items/icon_palettes/grass_tera_shard.gbapal.lz"); +const u32 gItemIconPalette_ElectricTeraShard[] = INCBIN_U32("graphics/items/icon_palettes/electric_tera_shard.gbapal.lz"); +const u32 gItemIconPalette_IceTeraShard[] = INCBIN_U32("graphics/items/icon_palettes/ice_tera_shard.gbapal.lz"); +const u32 gItemIconPalette_FightingTeraShard[] = INCBIN_U32("graphics/items/icon_palettes/fighting_tera_shard.gbapal.lz"); +const u32 gItemIconPalette_PoisonTeraShard[] = INCBIN_U32("graphics/items/icon_palettes/poison_tera_shard.gbapal.lz"); +const u32 gItemIconPalette_GroundTeraShard[] = INCBIN_U32("graphics/items/icon_palettes/ground_tera_shard.gbapal.lz"); +const u32 gItemIconPalette_FlyingTeraShard[] = INCBIN_U32("graphics/items/icon_palettes/flying_tera_shard.gbapal.lz"); +const u32 gItemIconPalette_PsychicTeraShard[] = INCBIN_U32("graphics/items/icon_palettes/psychic_tera_shard.gbapal.lz"); +const u32 gItemIconPalette_BugTeraShard[] = INCBIN_U32("graphics/items/icon_palettes/bug_tera_shard.gbapal.lz"); +const u32 gItemIconPalette_RockTeraShard[] = INCBIN_U32("graphics/items/icon_palettes/rock_tera_shard.gbapal.lz"); +const u32 gItemIconPalette_GhostTeraShard[] = INCBIN_U32("graphics/items/icon_palettes/ghost_tera_shard.gbapal.lz"); +const u32 gItemIconPalette_DarkTeraShard[] = INCBIN_U32("graphics/items/icon_palettes/dark_tera_shard.gbapal.lz"); +const u32 gItemIconPalette_DragonTeraShard[] = INCBIN_U32("graphics/items/icon_palettes/dragon_tera_shard.gbapal.lz"); +const u32 gItemIconPalette_SteelTeraShard[] = INCBIN_U32("graphics/items/icon_palettes/steel_tera_shard.gbapal.lz"); +const u32 gItemIconPalette_FairyTeraShard[] = INCBIN_U32("graphics/items/icon_palettes/fairy_tera_shard.gbapal.lz"); + +// Misc. Items const u32 gItemIcon_AdamantCrystal[] = INCBIN_U32("graphics/items/icons/adamant_crystal.4bpp.lz"); const u32 gItemIconPalette_AdamantCrystal[] = INCBIN_U32("graphics/items/icon_palettes/adamant_crystal.gbapal.lz"); diff --git a/src/data/graphics/pokemon.h b/src/data/graphics/pokemon.h index 56e45283afca..7c8afc0066b5 100644 --- a/src/data/graphics/pokemon.h +++ b/src/data/graphics/pokemon.h @@ -3,6 +3,7 @@ const u32 gMonFrontPic_DoubleQuestionMark[] = INCBIN_U32("graphics/pokemon/quest const u32 gMonFrontPic_Bulbasaur[] = INCBIN_U32("graphics/pokemon/bulbasaur/anim_front.4bpp.lz"); const u32 gMonFrontPic_Ivysaur[] = INCBIN_U32("graphics/pokemon/ivysaur/anim_front.4bpp.lz"); const u32 gMonFrontPic_Venusaur[] = INCBIN_U32("graphics/pokemon/venusaur/anim_front.4bpp.lz"); +const u32 gMonFrontPic_VenusaurF[] = INCBIN_U32("graphics/pokemon/venusaur/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Charmander[] = INCBIN_U32("graphics/pokemon/charmander/anim_front.4bpp.lz"); const u32 gMonFrontPic_Charmeleon[] = INCBIN_U32("graphics/pokemon/charmeleon/anim_front.4bpp.lz"); const u32 gMonFrontPic_Charizard[] = INCBIN_U32("graphics/pokemon/charizard/anim_front.4bpp.lz"); @@ -12,6 +13,7 @@ const u32 gMonFrontPic_Blastoise[] = INCBIN_U32("graphics/pokemon/blastoise/anim const u32 gMonFrontPic_Caterpie[] = INCBIN_U32("graphics/pokemon/caterpie/anim_front.4bpp.lz"); const u32 gMonFrontPic_Metapod[] = INCBIN_U32("graphics/pokemon/metapod/anim_front.4bpp.lz"); const u32 gMonFrontPic_Butterfree[] = INCBIN_U32("graphics/pokemon/butterfree/anim_front.4bpp.lz"); +const u32 gMonFrontPic_ButterfreeF[] = INCBIN_U32("graphics/pokemon/butterfree/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Weedle[] = INCBIN_U32("graphics/pokemon/weedle/anim_front.4bpp.lz"); const u32 gMonFrontPic_Kakuna[] = INCBIN_U32("graphics/pokemon/kakuna/anim_front.4bpp.lz"); const u32 gMonFrontPic_Beedrill[] = INCBIN_U32("graphics/pokemon/beedrill/anim_front.4bpp.lz"); @@ -19,13 +21,17 @@ const u32 gMonFrontPic_Pidgey[] = INCBIN_U32("graphics/pokemon/pidgey/anim_front const u32 gMonFrontPic_Pidgeotto[] = INCBIN_U32("graphics/pokemon/pidgeotto/anim_front.4bpp.lz"); const u32 gMonFrontPic_Pidgeot[] = INCBIN_U32("graphics/pokemon/pidgeot/anim_front.4bpp.lz"); const u32 gMonFrontPic_Rattata[] = INCBIN_U32("graphics/pokemon/rattata/anim_front.4bpp.lz"); +const u32 gMonFrontPic_RattataF[] = INCBIN_U32("graphics/pokemon/rattata/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Raticate[] = INCBIN_U32("graphics/pokemon/raticate/anim_front.4bpp.lz"); +const u32 gMonFrontPic_RaticateF[] = INCBIN_U32("graphics/pokemon/raticate/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Spearow[] = INCBIN_U32("graphics/pokemon/spearow/anim_front.4bpp.lz"); const u32 gMonFrontPic_Fearow[] = INCBIN_U32("graphics/pokemon/fearow/anim_front.4bpp.lz"); const u32 gMonFrontPic_Ekans[] = INCBIN_U32("graphics/pokemon/ekans/anim_front.4bpp.lz"); const u32 gMonFrontPic_Arbok[] = INCBIN_U32("graphics/pokemon/arbok/anim_front.4bpp.lz"); const u32 gMonFrontPic_Pikachu[] = INCBIN_U32("graphics/pokemon/pikachu/anim_front.4bpp.lz"); +const u32 gMonFrontPic_PikachuF[] = INCBIN_U32("graphics/pokemon/pikachu/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Raichu[] = INCBIN_U32("graphics/pokemon/raichu/anim_front.4bpp.lz"); +const u32 gMonFrontPic_RaichuF[] = INCBIN_U32("graphics/pokemon/raichu/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Sandshrew[] = INCBIN_U32("graphics/pokemon/sandshrew/anim_front.4bpp.lz"); const u32 gMonFrontPic_Sandslash[] = INCBIN_U32("graphics/pokemon/sandslash/anim_front.4bpp.lz"); const u32 gMonFrontPic_NidoranF[] = INCBIN_U32("graphics/pokemon/nidoran_f/anim_front.4bpp.lz"); @@ -41,10 +47,14 @@ const u32 gMonFrontPic_Ninetales[] = INCBIN_U32("graphics/pokemon/ninetales/anim const u32 gMonFrontPic_Jigglypuff[] = INCBIN_U32("graphics/pokemon/jigglypuff/anim_front.4bpp.lz"); const u32 gMonFrontPic_Wigglytuff[] = INCBIN_U32("graphics/pokemon/wigglytuff/anim_front.4bpp.lz"); const u32 gMonFrontPic_Zubat[] = INCBIN_U32("graphics/pokemon/zubat/anim_front.4bpp.lz"); +const u32 gMonFrontPic_ZubatF[] = INCBIN_U32("graphics/pokemon/zubat/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Golbat[] = INCBIN_U32("graphics/pokemon/golbat/anim_front.4bpp.lz"); +const u32 gMonFrontPic_GolbatF[] = INCBIN_U32("graphics/pokemon/golbat/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Oddish[] = INCBIN_U32("graphics/pokemon/oddish/anim_front.4bpp.lz"); const u32 gMonFrontPic_Gloom[] = INCBIN_U32("graphics/pokemon/gloom/anim_front.4bpp.lz"); +const u32 gMonFrontPic_GloomF[] = INCBIN_U32("graphics/pokemon/gloom/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Vileplume[] = INCBIN_U32("graphics/pokemon/vileplume/anim_front.4bpp.lz"); +const u32 gMonFrontPic_VileplumeF[] = INCBIN_U32("graphics/pokemon/vileplume/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Paras[] = INCBIN_U32("graphics/pokemon/paras/anim_front.4bpp.lz"); const u32 gMonFrontPic_Parasect[] = INCBIN_U32("graphics/pokemon/parasect/anim_front.4bpp.lz"); const u32 gMonFrontPic_Venonat[] = INCBIN_U32("graphics/pokemon/venonat/anim_front.4bpp.lz"); @@ -64,7 +74,9 @@ const u32 gMonFrontPic_Poliwhirl[] = INCBIN_U32("graphics/pokemon/poliwhirl/anim const u32 gMonFrontPic_Poliwrath[] = INCBIN_U32("graphics/pokemon/poliwrath/anim_front.4bpp.lz"); const u32 gMonFrontPic_Abra[] = INCBIN_U32("graphics/pokemon/abra/anim_front.4bpp.lz"); const u32 gMonFrontPic_Kadabra[] = INCBIN_U32("graphics/pokemon/kadabra/anim_front.4bpp.lz"); +const u32 gMonFrontPic_KadabraF[] = INCBIN_U32("graphics/pokemon/kadabra/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Alakazam[] = INCBIN_U32("graphics/pokemon/alakazam/anim_front.4bpp.lz"); +const u32 gMonFrontPic_AlakazamF[] = INCBIN_U32("graphics/pokemon/alakazam/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Machop[] = INCBIN_U32("graphics/pokemon/machop/anim_front.4bpp.lz"); const u32 gMonFrontPic_Machoke[] = INCBIN_U32("graphics/pokemon/machoke/anim_front.4bpp.lz"); const u32 gMonFrontPic_Machamp[] = INCBIN_U32("graphics/pokemon/machamp/anim_front.4bpp.lz"); @@ -84,7 +96,9 @@ const u32 gMonFrontPic_Magnemite[] = INCBIN_U32("graphics/pokemon/magnemite/anim const u32 gMonFrontPic_Magneton[] = INCBIN_U32("graphics/pokemon/magneton/anim_front.4bpp.lz"); const u32 gMonFrontPic_Farfetchd[] = INCBIN_U32("graphics/pokemon/farfetchd/anim_front.4bpp.lz"); const u32 gMonFrontPic_Doduo[] = INCBIN_U32("graphics/pokemon/doduo/anim_front.4bpp.lz"); +const u32 gMonFrontPic_DoduoF[] = INCBIN_U32("graphics/pokemon/doduo/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Dodrio[] = INCBIN_U32("graphics/pokemon/dodrio/anim_front.4bpp.lz"); +const u32 gMonFrontPic_DodrioF[] = INCBIN_U32("graphics/pokemon/dodrio/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Seel[] = INCBIN_U32("graphics/pokemon/seel/anim_front.4bpp.lz"); const u32 gMonFrontPic_Dewgong[] = INCBIN_U32("graphics/pokemon/dewgong/anim_front.4bpp.lz"); const u32 gMonFrontPic_Grimer[] = INCBIN_U32("graphics/pokemon/grimer/anim_front.4bpp.lz"); @@ -97,6 +111,7 @@ const u32 gMonFrontPic_Gengar[] = INCBIN_U32("graphics/pokemon/gengar/anim_front const u32 gMonFrontPic_Onix[] = INCBIN_U32("graphics/pokemon/onix/anim_front.4bpp.lz"); const u32 gMonFrontPic_Drowzee[] = INCBIN_U32("graphics/pokemon/drowzee/anim_front.4bpp.lz"); const u32 gMonFrontPic_Hypno[] = INCBIN_U32("graphics/pokemon/hypno/anim_front.4bpp.lz"); +const u32 gMonFrontPic_HypnoF[] = INCBIN_U32("graphics/pokemon/hypno/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Krabby[] = INCBIN_U32("graphics/pokemon/krabby/anim_front.4bpp.lz"); const u32 gMonFrontPic_Kingler[] = INCBIN_U32("graphics/pokemon/kingler/anim_front.4bpp.lz"); const u32 gMonFrontPic_Voltorb[] = INCBIN_U32("graphics/pokemon/voltorb/anim_front.4bpp.lz"); @@ -111,25 +126,32 @@ const u32 gMonFrontPic_Lickitung[] = INCBIN_U32("graphics/pokemon/lickitung/anim const u32 gMonFrontPic_Koffing[] = INCBIN_U32("graphics/pokemon/koffing/anim_front.4bpp.lz"); const u32 gMonFrontPic_Weezing[] = INCBIN_U32("graphics/pokemon/weezing/anim_front.4bpp.lz"); const u32 gMonFrontPic_Rhyhorn[] = INCBIN_U32("graphics/pokemon/rhyhorn/anim_front.4bpp.lz"); +const u32 gMonFrontPic_RhyhornF[] = INCBIN_U32("graphics/pokemon/rhyhorn/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Rhydon[] = INCBIN_U32("graphics/pokemon/rhydon/anim_front.4bpp.lz"); +const u32 gMonFrontPic_RhydonF[] = INCBIN_U32("graphics/pokemon/rhydon/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Chansey[] = INCBIN_U32("graphics/pokemon/chansey/anim_front.4bpp.lz"); const u32 gMonFrontPic_Tangela[] = INCBIN_U32("graphics/pokemon/tangela/anim_front.4bpp.lz"); const u32 gMonFrontPic_Kangaskhan[] = INCBIN_U32("graphics/pokemon/kangaskhan/anim_front.4bpp.lz"); const u32 gMonFrontPic_Horsea[] = INCBIN_U32("graphics/pokemon/horsea/anim_front.4bpp.lz"); const u32 gMonFrontPic_Seadra[] = INCBIN_U32("graphics/pokemon/seadra/anim_front.4bpp.lz"); const u32 gMonFrontPic_Goldeen[] = INCBIN_U32("graphics/pokemon/goldeen/anim_front.4bpp.lz"); +const u32 gMonFrontPic_GoldeenF[] = INCBIN_U32("graphics/pokemon/goldeen/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Seaking[] = INCBIN_U32("graphics/pokemon/seaking/anim_front.4bpp.lz"); +const u32 gMonFrontPic_SeakingF[] = INCBIN_U32("graphics/pokemon/seaking/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Staryu[] = INCBIN_U32("graphics/pokemon/staryu/anim_front.4bpp.lz"); const u32 gMonFrontPic_Starmie[] = INCBIN_U32("graphics/pokemon/starmie/anim_front.4bpp.lz"); const u32 gMonFrontPic_MrMime[] = INCBIN_U32("graphics/pokemon/mr_mime/anim_front.4bpp.lz"); const u32 gMonFrontPic_Scyther[] = INCBIN_U32("graphics/pokemon/scyther/anim_front.4bpp.lz"); +const u32 gMonFrontPic_ScytherF[] = INCBIN_U32("graphics/pokemon/scyther/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Jynx[] = INCBIN_U32("graphics/pokemon/jynx/anim_front.4bpp.lz"); const u32 gMonFrontPic_Electabuzz[] = INCBIN_U32("graphics/pokemon/electabuzz/anim_front.4bpp.lz"); const u32 gMonFrontPic_Magmar[] = INCBIN_U32("graphics/pokemon/magmar/anim_front.4bpp.lz"); const u32 gMonFrontPic_Pinsir[] = INCBIN_U32("graphics/pokemon/pinsir/anim_front.4bpp.lz"); const u32 gMonFrontPic_Tauros[] = INCBIN_U32("graphics/pokemon/tauros/anim_front.4bpp.lz"); const u32 gMonFrontPic_Magikarp[] = INCBIN_U32("graphics/pokemon/magikarp/anim_front.4bpp.lz"); +const u32 gMonFrontPic_MagikarpF[] = INCBIN_U32("graphics/pokemon/magikarp/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Gyarados[] = INCBIN_U32("graphics/pokemon/gyarados/anim_front.4bpp.lz"); +const u32 gMonFrontPic_GyaradosF[] = INCBIN_U32("graphics/pokemon/gyarados/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Lapras[] = INCBIN_U32("graphics/pokemon/lapras/anim_front.4bpp.lz"); const u32 gMonFrontPic_Ditto[] = INCBIN_U32("graphics/pokemon/ditto/anim_front.4bpp.lz"); const u32 gMonFrontPic_Eevee[] = INCBIN_U32("graphics/pokemon/eevee/anim_front.4bpp.lz"); @@ -155,6 +177,7 @@ const u32 gMonFrontPic_Mew[] = INCBIN_U32("graphics/pokemon/mew/anim_front.4bpp. const u32 gMonFrontPic_Chikorita[] = INCBIN_U32("graphics/pokemon/chikorita/anim_front.4bpp.lz"); const u32 gMonFrontPic_Bayleef[] = INCBIN_U32("graphics/pokemon/bayleef/anim_front.4bpp.lz"); const u32 gMonFrontPic_Meganium[] = INCBIN_U32("graphics/pokemon/meganium/anim_front.4bpp.lz"); +const u32 gMonFrontPic_MeganiumF[] = INCBIN_U32("graphics/pokemon/meganium/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Cyndaquil[] = INCBIN_U32("graphics/pokemon/cyndaquil/anim_front.4bpp.lz"); const u32 gMonFrontPic_Quilava[] = INCBIN_U32("graphics/pokemon/quilava/anim_front.4bpp.lz"); const u32 gMonFrontPic_Typhlosion[] = INCBIN_U32("graphics/pokemon/typhlosion/anim_front.4bpp.lz"); @@ -166,7 +189,9 @@ const u32 gMonFrontPic_Furret[] = INCBIN_U32("graphics/pokemon/furret/anim_front const u32 gMonFrontPic_Hoothoot[] = INCBIN_U32("graphics/pokemon/hoothoot/anim_front.4bpp.lz"); const u32 gMonFrontPic_Noctowl[] = INCBIN_U32("graphics/pokemon/noctowl/anim_front.4bpp.lz"); const u32 gMonFrontPic_Ledyba[] = INCBIN_U32("graphics/pokemon/ledyba/anim_front.4bpp.lz"); +const u32 gMonFrontPic_LedybaF[] = INCBIN_U32("graphics/pokemon/ledyba/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Ledian[] = INCBIN_U32("graphics/pokemon/ledian/anim_front.4bpp.lz"); +const u32 gMonFrontPic_LedianF[] = INCBIN_U32("graphics/pokemon/ledian/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Spinarak[] = INCBIN_U32("graphics/pokemon/spinarak/anim_front.4bpp.lz"); const u32 gMonFrontPic_Ariados[] = INCBIN_U32("graphics/pokemon/ariados/anim_front.4bpp.lz"); const u32 gMonFrontPic_Crobat[] = INCBIN_U32("graphics/pokemon/crobat/anim_front.4bpp.lz"); @@ -179,6 +204,7 @@ const u32 gMonFrontPic_Togepi[] = INCBIN_U32("graphics/pokemon/togepi/anim_front const u32 gMonFrontPic_Togetic[] = INCBIN_U32("graphics/pokemon/togetic/anim_front.4bpp.lz"); const u32 gMonFrontPic_Natu[] = INCBIN_U32("graphics/pokemon/natu/anim_front.4bpp.lz"); const u32 gMonFrontPic_Xatu[] = INCBIN_U32("graphics/pokemon/xatu/anim_front.4bpp.lz"); +const u32 gMonFrontPic_XatuF[] = INCBIN_U32("graphics/pokemon/xatu/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Mareep[] = INCBIN_U32("graphics/pokemon/mareep/anim_front.4bpp.lz"); const u32 gMonFrontPic_Flaaffy[] = INCBIN_U32("graphics/pokemon/flaaffy/anim_front.4bpp.lz"); const u32 gMonFrontPic_Ampharos[] = INCBIN_U32("graphics/pokemon/ampharos/anim_front.4bpp.lz"); @@ -186,53 +212,71 @@ const u32 gMonFrontPic_Bellossom[] = INCBIN_U32("graphics/pokemon/bellossom/anim const u32 gMonFrontPic_Marill[] = INCBIN_U32("graphics/pokemon/marill/anim_front.4bpp.lz"); const u32 gMonFrontPic_Azumarill[] = INCBIN_U32("graphics/pokemon/azumarill/anim_front.4bpp.lz"); const u32 gMonFrontPic_Sudowoodo[] = INCBIN_U32("graphics/pokemon/sudowoodo/anim_front.4bpp.lz"); +const u32 gMonFrontPic_SudowoodoF[] = INCBIN_U32("graphics/pokemon/sudowoodo/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Politoed[] = INCBIN_U32("graphics/pokemon/politoed/anim_front.4bpp.lz"); +const u32 gMonFrontPic_PolitoedF[] = INCBIN_U32("graphics/pokemon/politoed/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Hoppip[] = INCBIN_U32("graphics/pokemon/hoppip/anim_front.4bpp.lz"); const u32 gMonFrontPic_Skiploom[] = INCBIN_U32("graphics/pokemon/skiploom/anim_front.4bpp.lz"); const u32 gMonFrontPic_Jumpluff[] = INCBIN_U32("graphics/pokemon/jumpluff/anim_front.4bpp.lz"); const u32 gMonFrontPic_Aipom[] = INCBIN_U32("graphics/pokemon/aipom/anim_front.4bpp.lz"); +const u32 gMonFrontPic_AipomF[] = INCBIN_U32("graphics/pokemon/aipom/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Sunkern[] = INCBIN_U32("graphics/pokemon/sunkern/anim_front.4bpp.lz"); const u32 gMonFrontPic_Sunflora[] = INCBIN_U32("graphics/pokemon/sunflora/anim_front.4bpp.lz"); const u32 gMonFrontPic_Yanma[] = INCBIN_U32("graphics/pokemon/yanma/anim_front.4bpp.lz"); const u32 gMonFrontPic_Wooper[] = INCBIN_U32("graphics/pokemon/wooper/anim_front.4bpp.lz"); +const u32 gMonFrontPic_WooperF[] = INCBIN_U32("graphics/pokemon/wooper/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Quagsire[] = INCBIN_U32("graphics/pokemon/quagsire/anim_front.4bpp.lz"); +const u32 gMonFrontPic_QuagsireF[] = INCBIN_U32("graphics/pokemon/quagsire/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Espeon[] = INCBIN_U32("graphics/pokemon/espeon/anim_front.4bpp.lz"); const u32 gMonFrontPic_Umbreon[] = INCBIN_U32("graphics/pokemon/umbreon/anim_front.4bpp.lz"); const u32 gMonFrontPic_Murkrow[] = INCBIN_U32("graphics/pokemon/murkrow/anim_front.4bpp.lz"); +const u32 gMonFrontPic_MurkrowF[] = INCBIN_U32("graphics/pokemon/murkrow/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Slowking[] = INCBIN_U32("graphics/pokemon/slowking/anim_front.4bpp.lz"); const u32 gMonFrontPic_Misdreavus[] = INCBIN_U32("graphics/pokemon/misdreavus/anim_front.4bpp.lz"); const u32 gMonFrontPic_Unown[] = INCBIN_U32("graphics/pokemon/unown/anim_front.4bpp.lz"); const u32 gMonFrontPic_Wobbuffet[] = INCBIN_U32("graphics/pokemon/wobbuffet/anim_front.4bpp.lz"); +const u32 gMonFrontPic_WobbuffetF[] = INCBIN_U32("graphics/pokemon/wobbuffet/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Girafarig[] = INCBIN_U32("graphics/pokemon/girafarig/anim_front.4bpp.lz"); +const u32 gMonFrontPic_GirafarigF[] = INCBIN_U32("graphics/pokemon/girafarig/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Pineco[] = INCBIN_U32("graphics/pokemon/pineco/anim_front.4bpp.lz"); const u32 gMonFrontPic_Forretress[] = INCBIN_U32("graphics/pokemon/forretress/anim_front.4bpp.lz"); const u32 gMonFrontPic_Dunsparce[] = INCBIN_U32("graphics/pokemon/dunsparce/anim_front.4bpp.lz"); const u32 gMonFrontPic_Gligar[] = INCBIN_U32("graphics/pokemon/gligar/anim_front.4bpp.lz"); +const u32 gMonFrontPic_GligarF[] = INCBIN_U32("graphics/pokemon/gligar/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Steelix[] = INCBIN_U32("graphics/pokemon/steelix/anim_front.4bpp.lz"); +const u32 gMonFrontPic_SteelixF[] = INCBIN_U32("graphics/pokemon/steelix/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Snubbull[] = INCBIN_U32("graphics/pokemon/snubbull/anim_front.4bpp.lz"); const u32 gMonFrontPic_Granbull[] = INCBIN_U32("graphics/pokemon/granbull/anim_front.4bpp.lz"); const u32 gMonFrontPic_Qwilfish[] = INCBIN_U32("graphics/pokemon/qwilfish/anim_front.4bpp.lz"); const u32 gMonFrontPic_Scizor[] = INCBIN_U32("graphics/pokemon/scizor/anim_front.4bpp.lz"); +const u32 gMonFrontPic_ScizorF[] = INCBIN_U32("graphics/pokemon/scizor/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Shuckle[] = INCBIN_U32("graphics/pokemon/shuckle/anim_front.4bpp.lz"); const u32 gMonFrontPic_Heracross[] = INCBIN_U32("graphics/pokemon/heracross/anim_front.4bpp.lz"); +const u32 gMonFrontPic_HeracrossF[] = INCBIN_U32("graphics/pokemon/heracross/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Sneasel[] = INCBIN_U32("graphics/pokemon/sneasel/anim_front.4bpp.lz"); +const u32 gMonFrontPic_SneaselF[] = INCBIN_U32("graphics/pokemon/sneasel/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Teddiursa[] = INCBIN_U32("graphics/pokemon/teddiursa/anim_front.4bpp.lz"); const u32 gMonFrontPic_Ursaring[] = INCBIN_U32("graphics/pokemon/ursaring/anim_front.4bpp.lz"); +const u32 gMonFrontPic_UrsaringF[] = INCBIN_U32("graphics/pokemon/ursaring/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Slugma[] = INCBIN_U32("graphics/pokemon/slugma/anim_front.4bpp.lz"); const u32 gMonFrontPic_Magcargo[] = INCBIN_U32("graphics/pokemon/magcargo/anim_front.4bpp.lz"); const u32 gMonFrontPic_Swinub[] = INCBIN_U32("graphics/pokemon/swinub/anim_front.4bpp.lz"); const u32 gMonFrontPic_Piloswine[] = INCBIN_U32("graphics/pokemon/piloswine/anim_front.4bpp.lz"); +const u32 gMonFrontPic_PiloswineF[] = INCBIN_U32("graphics/pokemon/piloswine/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Corsola[] = INCBIN_U32("graphics/pokemon/corsola/anim_front.4bpp.lz"); const u32 gMonFrontPic_Remoraid[] = INCBIN_U32("graphics/pokemon/remoraid/anim_front.4bpp.lz"); const u32 gMonFrontPic_Octillery[] = INCBIN_U32("graphics/pokemon/octillery/anim_front.4bpp.lz"); +const u32 gMonFrontPic_OctilleryF[] = INCBIN_U32("graphics/pokemon/octillery/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Delibird[] = INCBIN_U32("graphics/pokemon/delibird/anim_front.4bpp.lz"); const u32 gMonFrontPic_Mantine[] = INCBIN_U32("graphics/pokemon/mantine/anim_front.4bpp.lz"); const u32 gMonFrontPic_Skarmory[] = INCBIN_U32("graphics/pokemon/skarmory/anim_front.4bpp.lz"); const u32 gMonFrontPic_Houndour[] = INCBIN_U32("graphics/pokemon/houndour/anim_front.4bpp.lz"); const u32 gMonFrontPic_Houndoom[] = INCBIN_U32("graphics/pokemon/houndoom/anim_front.4bpp.lz"); +const u32 gMonFrontPic_HoundoomF[] = INCBIN_U32("graphics/pokemon/houndoom/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Kingdra[] = INCBIN_U32("graphics/pokemon/kingdra/anim_front.4bpp.lz"); const u32 gMonFrontPic_Phanpy[] = INCBIN_U32("graphics/pokemon/phanpy/anim_front.4bpp.lz"); const u32 gMonFrontPic_Donphan[] = INCBIN_U32("graphics/pokemon/donphan/anim_front.4bpp.lz"); +const u32 gMonFrontPic_DonphanF[] = INCBIN_U32("graphics/pokemon/donphan/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Porygon2[] = INCBIN_U32("graphics/pokemon/porygon2/anim_front.4bpp.lz"); const u32 gMonFrontPic_Stantler[] = INCBIN_U32("graphics/pokemon/stantler/anim_front.4bpp.lz"); const u32 gMonFrontPic_Smeargle[] = INCBIN_U32("graphics/pokemon/smeargle/anim_front.4bpp.lz"); @@ -257,7 +301,9 @@ const u32 gMonFrontPic_Grovyle[] = INCBIN_U32("graphics/pokemon/grovyle/anim_fro const u32 gMonFrontPic_Sceptile[] = INCBIN_U32("graphics/pokemon/sceptile/anim_front.4bpp.lz"); const u32 gMonFrontPic_Torchic[] = INCBIN_U32("graphics/pokemon/torchic/anim_front.4bpp.lz"); const u32 gMonFrontPic_Combusken[] = INCBIN_U32("graphics/pokemon/combusken/anim_front.4bpp.lz"); +const u32 gMonFrontPic_CombuskenF[] = INCBIN_U32("graphics/pokemon/combusken/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Blaziken[] = INCBIN_U32("graphics/pokemon/blaziken/anim_front.4bpp.lz"); +const u32 gMonFrontPic_BlazikenF[] = INCBIN_U32("graphics/pokemon/blaziken/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Mudkip[] = INCBIN_U32("graphics/pokemon/mudkip/anim_front.4bpp.lz"); const u32 gMonFrontPic_Marshtomp[] = INCBIN_U32("graphics/pokemon/marshtomp/anim_front.4bpp.lz"); const u32 gMonFrontPic_Swampert[] = INCBIN_U32("graphics/pokemon/swampert/anim_front.4bpp.lz"); @@ -268,14 +314,19 @@ const u32 gMonFrontPic_Linoone[] = INCBIN_U32("graphics/pokemon/linoone/anim_fro const u32 gMonFrontPic_Wurmple[] = INCBIN_U32("graphics/pokemon/wurmple/anim_front.4bpp.lz"); const u32 gMonFrontPic_Silcoon[] = INCBIN_U32("graphics/pokemon/silcoon/anim_front.4bpp.lz"); const u32 gMonFrontPic_Beautifly[] = INCBIN_U32("graphics/pokemon/beautifly/anim_front.4bpp.lz"); +const u32 gMonFrontPic_BeautiflyF[] = INCBIN_U32("graphics/pokemon/beautifly/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Cascoon[] = INCBIN_U32("graphics/pokemon/cascoon/anim_front.4bpp.lz"); const u32 gMonFrontPic_Dustox[] = INCBIN_U32("graphics/pokemon/dustox/anim_front.4bpp.lz"); +const u32 gMonFrontPic_DustoxF[] = INCBIN_U32("graphics/pokemon/dustox/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Lotad[] = INCBIN_U32("graphics/pokemon/lotad/anim_front.4bpp.lz"); const u32 gMonFrontPic_Lombre[] = INCBIN_U32("graphics/pokemon/lombre/anim_front.4bpp.lz"); const u32 gMonFrontPic_Ludicolo[] = INCBIN_U32("graphics/pokemon/ludicolo/anim_front.4bpp.lz"); +const u32 gMonFrontPic_LudicoloF[] = INCBIN_U32("graphics/pokemon/ludicolo/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Seedot[] = INCBIN_U32("graphics/pokemon/seedot/anim_front.4bpp.lz"); const u32 gMonFrontPic_Nuzleaf[] = INCBIN_U32("graphics/pokemon/nuzleaf/anim_front.4bpp.lz"); +const u32 gMonFrontPic_NuzleafF[] = INCBIN_U32("graphics/pokemon/nuzleaf/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Shiftry[] = INCBIN_U32("graphics/pokemon/shiftry/anim_front.4bpp.lz"); +const u32 gMonFrontPic_ShiftryF[] = INCBIN_U32("graphics/pokemon/shiftry/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Taillow[] = INCBIN_U32("graphics/pokemon/taillow/anim_front.4bpp.lz"); const u32 gMonFrontPic_Swellow[] = INCBIN_U32("graphics/pokemon/swellow/anim_front.4bpp.lz"); const u32 gMonFrontPic_Wingull[] = INCBIN_U32("graphics/pokemon/wingull/anim_front.4bpp.lz"); @@ -308,7 +359,9 @@ const u32 gMonFrontPic_Aron[] = INCBIN_U32("graphics/pokemon/aron/anim_front.4bp const u32 gMonFrontPic_Lairon[] = INCBIN_U32("graphics/pokemon/lairon/anim_front.4bpp.lz"); const u32 gMonFrontPic_Aggron[] = INCBIN_U32("graphics/pokemon/aggron/anim_front.4bpp.lz"); const u32 gMonFrontPic_Meditite[] = INCBIN_U32("graphics/pokemon/meditite/anim_front.4bpp.lz"); +const u32 gMonFrontPic_MedititeF[] = INCBIN_U32("graphics/pokemon/meditite/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Medicham[] = INCBIN_U32("graphics/pokemon/medicham/anim_front.4bpp.lz"); +const u32 gMonFrontPic_MedichamF[] = INCBIN_U32("graphics/pokemon/medicham/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Electrike[] = INCBIN_U32("graphics/pokemon/electrike/anim_front.4bpp.lz"); const u32 gMonFrontPic_Manectric[] = INCBIN_U32("graphics/pokemon/manectric/anim_front.4bpp.lz"); const u32 gMonFrontPic_Plusle[] = INCBIN_U32("graphics/pokemon/plusle/anim_front.4bpp.lz"); @@ -316,14 +369,19 @@ const u32 gMonFrontPic_Minun[] = INCBIN_U32("graphics/pokemon/minun/anim_front.4 const u32 gMonFrontPic_Volbeat[] = INCBIN_U32("graphics/pokemon/volbeat/anim_front.4bpp.lz"); const u32 gMonFrontPic_Illumise[] = INCBIN_U32("graphics/pokemon/illumise/anim_front.4bpp.lz"); const u32 gMonFrontPic_Roselia[] = INCBIN_U32("graphics/pokemon/roselia/anim_front.4bpp.lz"); +const u32 gMonFrontPic_RoseliaF[] = INCBIN_U32("graphics/pokemon/roselia/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Gulpin[] = INCBIN_U32("graphics/pokemon/gulpin/anim_front.4bpp.lz"); +const u32 gMonFrontPic_GulpinF[] = INCBIN_U32("graphics/pokemon/gulpin/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Swalot[] = INCBIN_U32("graphics/pokemon/swalot/anim_front.4bpp.lz"); +const u32 gMonFrontPic_SwalotF[] = INCBIN_U32("graphics/pokemon/swalot/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Carvanha[] = INCBIN_U32("graphics/pokemon/carvanha/anim_front.4bpp.lz"); const u32 gMonFrontPic_Sharpedo[] = INCBIN_U32("graphics/pokemon/sharpedo/anim_front.4bpp.lz"); const u32 gMonFrontPic_Wailmer[] = INCBIN_U32("graphics/pokemon/wailmer/anim_front.4bpp.lz"); const u32 gMonFrontPic_Wailord[] = INCBIN_U32("graphics/pokemon/wailord/anim_front.4bpp.lz"); const u32 gMonFrontPic_Numel[] = INCBIN_U32("graphics/pokemon/numel/anim_front.4bpp.lz"); +const u32 gMonFrontPic_NumelF[] = INCBIN_U32("graphics/pokemon/numel/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Camerupt[] = INCBIN_U32("graphics/pokemon/camerupt/anim_front.4bpp.lz"); +const u32 gMonFrontPic_CameruptF[] = INCBIN_U32("graphics/pokemon/camerupt/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Torkoal[] = INCBIN_U32("graphics/pokemon/torkoal/anim_front.4bpp.lz"); const u32 gMonFrontPic_Spoink[] = INCBIN_U32("graphics/pokemon/spoink/anim_front.4bpp.lz"); const u32 gMonFrontPic_Grumpig[] = INCBIN_U32("graphics/pokemon/grumpig/anim_front.4bpp.lz"); @@ -333,6 +391,7 @@ const u32 gMonFrontPic_Vibrava[] = INCBIN_U32("graphics/pokemon/vibrava/anim_fro const u32 gMonFrontPic_Flygon[] = INCBIN_U32("graphics/pokemon/flygon/anim_front.4bpp.lz"); const u32 gMonFrontPic_Cacnea[] = INCBIN_U32("graphics/pokemon/cacnea/anim_front.4bpp.lz"); const u32 gMonFrontPic_Cacturne[] = INCBIN_U32("graphics/pokemon/cacturne/anim_front.4bpp.lz"); +const u32 gMonFrontPic_CacturneF[] = INCBIN_U32("graphics/pokemon/cacturne/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Swablu[] = INCBIN_U32("graphics/pokemon/swablu/anim_front.4bpp.lz"); const u32 gMonFrontPic_Altaria[] = INCBIN_U32("graphics/pokemon/altaria/anim_front.4bpp.lz"); const u32 gMonFrontPic_Zangoose[] = INCBIN_U32("graphics/pokemon/zangoose/anim_front.4bpp.lz"); @@ -351,6 +410,7 @@ const u32 gMonFrontPic_Anorith[] = INCBIN_U32("graphics/pokemon/anorith/anim_fro const u32 gMonFrontPic_Armaldo[] = INCBIN_U32("graphics/pokemon/armaldo/anim_front.4bpp.lz"); const u32 gMonFrontPic_Feebas[] = INCBIN_U32("graphics/pokemon/feebas/anim_front.4bpp.lz"); const u32 gMonFrontPic_Milotic[] = INCBIN_U32("graphics/pokemon/milotic/anim_front.4bpp.lz"); +const u32 gMonFrontPic_MiloticF[] = INCBIN_U32("graphics/pokemon/milotic/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Castform[] = INCBIN_U32("graphics/pokemon/castform/anim_front.4bpp.lz"); const u32 gMonFrontPic_Kecleon[] = INCBIN_U32("graphics/pokemon/kecleon/anim_front.4bpp.lz"); const u32 gMonFrontPic_Shuppet[] = INCBIN_U32("graphics/pokemon/shuppet/anim_front.4bpp.lz"); @@ -370,6 +430,7 @@ const u32 gMonFrontPic_Clamperl[] = INCBIN_U32("graphics/pokemon/clamperl/anim_f const u32 gMonFrontPic_Huntail[] = INCBIN_U32("graphics/pokemon/huntail/anim_front.4bpp.lz"); const u32 gMonFrontPic_Gorebyss[] = INCBIN_U32("graphics/pokemon/gorebyss/anim_front.4bpp.lz"); const u32 gMonFrontPic_Relicanth[] = INCBIN_U32("graphics/pokemon/relicanth/anim_front.4bpp.lz"); +const u32 gMonFrontPic_RelicanthF[] = INCBIN_U32("graphics/pokemon/relicanth/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Luvdisc[] = INCBIN_U32("graphics/pokemon/luvdisc/anim_front.4bpp.lz"); const u32 gMonFrontPic_Bagon[] = INCBIN_U32("graphics/pokemon/bagon/anim_front.4bpp.lz"); const u32 gMonFrontPic_Shelgon[] = INCBIN_U32("graphics/pokemon/shelgon/anim_front.4bpp.lz"); @@ -406,6 +467,7 @@ const u32 gMonFrontPic_StaraptorF[] = INCBIN_U32("graphics/pokemon/staraptor/ani const u32 gMonFrontPic_Bidoof[] = INCBIN_U32("graphics/pokemon/bidoof/anim_front.4bpp.lz"); const u32 gMonFrontPic_BidoofF[] = INCBIN_U32("graphics/pokemon/bidoof/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Bibarel[] = INCBIN_U32("graphics/pokemon/bibarel/anim_front.4bpp.lz"); +const u32 gMonFrontPic_BibarelF[] = INCBIN_U32("graphics/pokemon/bibarel/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Kricketot[] = INCBIN_U32("graphics/pokemon/kricketot/anim_front.4bpp.lz"); const u32 gMonFrontPic_KricketotF[] = INCBIN_U32("graphics/pokemon/kricketot/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Kricketune[] = INCBIN_U32("graphics/pokemon/kricketune/anim_front.4bpp.lz"); @@ -413,9 +475,12 @@ const u32 gMonFrontPic_KricketuneF[] = INCBIN_U32("graphics/pokemon/kricketune/a const u32 gMonFrontPic_Shinx[] = INCBIN_U32("graphics/pokemon/shinx/anim_front.4bpp.lz"); const u32 gMonFrontPic_ShinxF[] = INCBIN_U32("graphics/pokemon/shinx/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Luxio[] = INCBIN_U32("graphics/pokemon/luxio/anim_front.4bpp.lz"); +const u32 gMonFrontPic_LuxioF[] = INCBIN_U32("graphics/pokemon/luxio/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Luxray[] = INCBIN_U32("graphics/pokemon/luxray/anim_front.4bpp.lz"); +const u32 gMonFrontPic_LuxrayF[] = INCBIN_U32("graphics/pokemon/luxray/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Budew[] = INCBIN_U32("graphics/pokemon/budew/anim_front.4bpp.lz"); const u32 gMonFrontPic_Roserade[] = INCBIN_U32("graphics/pokemon/roserade/anim_front.4bpp.lz"); +const u32 gMonFrontPic_RoseradeF[] = INCBIN_U32("graphics/pokemon/roserade/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Cranidos[] = INCBIN_U32("graphics/pokemon/cranidos/anim_front.4bpp.lz"); const u32 gMonFrontPic_Rampardos[] = INCBIN_U32("graphics/pokemon/rampardos/anim_front.4bpp.lz"); const u32 gMonFrontPic_Shieldon[] = INCBIN_U32("graphics/pokemon/shieldon/anim_front.4bpp.lz"); @@ -426,13 +491,15 @@ const u32 gMonFrontPic_Mothim[] = INCBIN_U32("graphics/pokemon/mothim/anim_front const u32 gMonFrontPic_Combee[] = INCBIN_U32("graphics/pokemon/combee/anim_front.4bpp.lz"); const u32 gMonFrontPic_Vespiquen[] = INCBIN_U32("graphics/pokemon/vespiquen/anim_front.4bpp.lz"); const u32 gMonFrontPic_Pachirisu[] = INCBIN_U32("graphics/pokemon/pachirisu/anim_front.4bpp.lz"); +const u32 gMonFrontPic_PachirisuF[] = INCBIN_U32("graphics/pokemon/pachirisu/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Buizel[] = INCBIN_U32("graphics/pokemon/buizel/anim_front.4bpp.lz"); const u32 gMonFrontPic_Floatzel[] = INCBIN_U32("graphics/pokemon/floatzel/anim_front.4bpp.lz"); const u32 gMonFrontPic_Cherubi[] = INCBIN_U32("graphics/pokemon/cherubi/anim_front.4bpp.lz"); -const u32 gMonFrontPic_Cherrim[] = INCBIN_U32("graphics/pokemon/cherrim/anim_front.4bpp.lz"); +const u32 gMonFrontPic_Cherrim[] = INCBIN_U32("graphics/pokemon/cherrim/normal/anim_front.4bpp.lz"); const u32 gMonFrontPic_Shellos[] = INCBIN_U32("graphics/pokemon/shellos/anim_front.4bpp.lz"); const u32 gMonFrontPic_Gastrodon[] = INCBIN_U32("graphics/pokemon/gastrodon/anim_front.4bpp.lz"); const u32 gMonFrontPic_Ambipom[] = INCBIN_U32("graphics/pokemon/ambipom/anim_front.4bpp.lz"); +const u32 gMonFrontPic_AmbipomF[] = INCBIN_U32("graphics/pokemon/ambipom/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Drifloon[] = INCBIN_U32("graphics/pokemon/drifloon/anim_front.4bpp.lz"); const u32 gMonFrontPic_Drifblim[] = INCBIN_U32("graphics/pokemon/drifblim/anim_front.4bpp.lz"); const u32 gMonFrontPic_Buneary[] = INCBIN_U32("graphics/pokemon/buneary/anim_front.4bpp.lz"); @@ -452,8 +519,11 @@ const u32 gMonFrontPic_Happiny[] = INCBIN_U32("graphics/pokemon/happiny/anim_fro const u32 gMonFrontPic_Chatot[] = INCBIN_U32("graphics/pokemon/chatot/anim_front.4bpp.lz"); const u32 gMonFrontPic_Spiritomb[] = INCBIN_U32("graphics/pokemon/spiritomb/anim_front.4bpp.lz"); const u32 gMonFrontPic_Gible[] = INCBIN_U32("graphics/pokemon/gible/anim_front.4bpp.lz"); +const u32 gMonFrontPic_GibleF[] = INCBIN_U32("graphics/pokemon/gible/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Gabite[] = INCBIN_U32("graphics/pokemon/gabite/anim_front.4bpp.lz"); +const u32 gMonFrontPic_GabiteF[] = INCBIN_U32("graphics/pokemon/gabite/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Garchomp[] = INCBIN_U32("graphics/pokemon/garchomp/anim_front.4bpp.lz"); +const u32 gMonFrontPic_GarchompF[] = INCBIN_U32("graphics/pokemon/garchomp/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Munchlax[] = INCBIN_U32("graphics/pokemon/munchlax/anim_front.4bpp.lz"); const u32 gMonFrontPic_Riolu[] = INCBIN_U32("graphics/pokemon/riolu/anim_front.4bpp.lz"); const u32 gMonFrontPic_Lucario[] = INCBIN_U32("graphics/pokemon/lucario/anim_front.4bpp.lz"); @@ -462,18 +532,27 @@ const u32 gMonFrontPic_Hippowdon[] = INCBIN_U32("graphics/pokemon/hippowdon/anim const u32 gMonFrontPic_Skorupi[] = INCBIN_U32("graphics/pokemon/skorupi/anim_front.4bpp.lz"); const u32 gMonFrontPic_Drapion[] = INCBIN_U32("graphics/pokemon/drapion/anim_front.4bpp.lz"); const u32 gMonFrontPic_Croagunk[] = INCBIN_U32("graphics/pokemon/croagunk/anim_front.4bpp.lz"); +const u32 gMonFrontPic_CroagunkF[] = INCBIN_U32("graphics/pokemon/croagunk/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Toxicroak[] = INCBIN_U32("graphics/pokemon/toxicroak/anim_front.4bpp.lz"); +const u32 gMonFrontPic_ToxicroakF[] = INCBIN_U32("graphics/pokemon/toxicroak/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Carnivine[] = INCBIN_U32("graphics/pokemon/carnivine/anim_front.4bpp.lz"); const u32 gMonFrontPic_Finneon[] = INCBIN_U32("graphics/pokemon/finneon/anim_front.4bpp.lz"); +const u32 gMonFrontPic_FinneonF[] = INCBIN_U32("graphics/pokemon/finneon/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Lumineon[] = INCBIN_U32("graphics/pokemon/lumineon/anim_front.4bpp.lz"); +const u32 gMonFrontPic_LumineonF[] = INCBIN_U32("graphics/pokemon/lumineon/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Mantyke[] = INCBIN_U32("graphics/pokemon/mantyke/anim_front.4bpp.lz"); const u32 gMonFrontPic_Snover[] = INCBIN_U32("graphics/pokemon/snover/anim_front.4bpp.lz"); +const u32 gMonFrontPic_SnoverF[] = INCBIN_U32("graphics/pokemon/snover/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Abomasnow[] = INCBIN_U32("graphics/pokemon/abomasnow/anim_front.4bpp.lz"); +const u32 gMonFrontPic_AbomasnowF[] = INCBIN_U32("graphics/pokemon/abomasnow/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Weavile[] = INCBIN_U32("graphics/pokemon/weavile/anim_front.4bpp.lz"); +const u32 gMonFrontPic_WeavileF[] = INCBIN_U32("graphics/pokemon/weavile/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Magnezone[] = INCBIN_U32("graphics/pokemon/magnezone/anim_front.4bpp.lz"); const u32 gMonFrontPic_Lickilicky[] = INCBIN_U32("graphics/pokemon/lickilicky/anim_front.4bpp.lz"); const u32 gMonFrontPic_Rhyperior[] = INCBIN_U32("graphics/pokemon/rhyperior/anim_front.4bpp.lz"); +const u32 gMonFrontPic_RhyperiorF[] = INCBIN_U32("graphics/pokemon/rhyperior/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Tangrowth[] = INCBIN_U32("graphics/pokemon/tangrowth/anim_front.4bpp.lz"); +const u32 gMonFrontPic_TangrowthF[] = INCBIN_U32("graphics/pokemon/tangrowth/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_Electivire[] = INCBIN_U32("graphics/pokemon/electivire/anim_front.4bpp.lz"); const u32 gMonFrontPic_Magmortar[] = INCBIN_U32("graphics/pokemon/magmortar/anim_front.4bpp.lz"); const u32 gMonFrontPic_Togekiss[] = INCBIN_U32("graphics/pokemon/togekiss/anim_front.4bpp.lz"); @@ -482,6 +561,7 @@ const u32 gMonFrontPic_Leafeon[] = INCBIN_U32("graphics/pokemon/leafeon/anim_fro const u32 gMonFrontPic_Glaceon[] = INCBIN_U32("graphics/pokemon/glaceon/anim_front.4bpp.lz"); const u32 gMonFrontPic_Gliscor[] = INCBIN_U32("graphics/pokemon/gliscor/anim_front.4bpp.lz"); const u32 gMonFrontPic_Mamoswine[] = INCBIN_U32("graphics/pokemon/mamoswine/anim_front.4bpp.lz"); +const u32 gMonFrontPic_MamoswineF[] = INCBIN_U32("graphics/pokemon/mamoswine/anim_frontf.4bpp.lz"); const u32 gMonFrontPic_PorygonZ[] = INCBIN_U32("graphics/pokemon/porygon_z/anim_front.4bpp.lz"); const u32 gMonFrontPic_Gallade[] = INCBIN_U32("graphics/pokemon/gallade/anim_front.4bpp.lz"); const u32 gMonFrontPic_Probopass[] = INCBIN_U32("graphics/pokemon/probopass/anim_front.4bpp.lz"); @@ -754,9 +834,9 @@ const u32 gMonFrontPic_Trumbeak[] = INCBIN_U32("graphics/pokemon/trumbeak/front. const u32 gMonFrontPic_Toucannon[] = INCBIN_U32("graphics/pokemon/toucannon/front.4bpp.lz"); const u32 gMonFrontPic_Yungoos[] = INCBIN_U32("graphics/pokemon/yungoos/front.4bpp.lz"); const u32 gMonFrontPic_Gumshoos[] = INCBIN_U32("graphics/pokemon/gumshoos/front.4bpp.lz"); -const u32 gMonFrontPic_Grubbin[] = INCBIN_U32("graphics/pokemon/grubbin/front.4bpp.lz"); -const u32 gMonFrontPic_Charjabug[] = INCBIN_U32("graphics/pokemon/charjabug/front.4bpp.lz"); -const u32 gMonFrontPic_Vikavolt[] = INCBIN_U32("graphics/pokemon/vikavolt/front.4bpp.lz"); +const u32 gMonFrontPic_Grubbin[] = INCBIN_U32("graphics/pokemon/grubbin/anim_front.4bpp.lz"); +const u32 gMonFrontPic_Charjabug[] = INCBIN_U32("graphics/pokemon/charjabug/anim_front.4bpp.lz"); +const u32 gMonFrontPic_Vikavolt[] = INCBIN_U32("graphics/pokemon/vikavolt/anim_front.4bpp.lz"); const u32 gMonFrontPic_Crabrawler[] = INCBIN_U32("graphics/pokemon/crabrawler/front.4bpp.lz"); const u32 gMonFrontPic_Crabominable[] = INCBIN_U32("graphics/pokemon/crabominable/front.4bpp.lz"); const u32 gMonFrontPic_Oricorio[] = INCBIN_U32("graphics/pokemon/oricorio/front.4bpp.lz"); @@ -769,40 +849,40 @@ const u32 gMonFrontPic_Mareanie[] = INCBIN_U32("graphics/pokemon/mareanie/front. const u32 gMonFrontPic_Toxapex[] = INCBIN_U32("graphics/pokemon/toxapex/front.4bpp.lz"); const u32 gMonFrontPic_Mudbray[] = INCBIN_U32("graphics/pokemon/mudbray/front.4bpp.lz"); const u32 gMonFrontPic_Mudsdale[] = INCBIN_U32("graphics/pokemon/mudsdale/front.4bpp.lz"); -const u32 gMonFrontPic_Dewpider[] = INCBIN_U32("graphics/pokemon/dewpider/front.4bpp.lz"); -const u32 gMonFrontPic_Araquanid[] = INCBIN_U32("graphics/pokemon/araquanid/front.4bpp.lz"); +const u32 gMonFrontPic_Dewpider[] = INCBIN_U32("graphics/pokemon/dewpider/anim_front.4bpp.lz"); +const u32 gMonFrontPic_Araquanid[] = INCBIN_U32("graphics/pokemon/araquanid/anim_front.4bpp.lz"); const u32 gMonFrontPic_Fomantis[] = INCBIN_U32("graphics/pokemon/fomantis/front.4bpp.lz"); const u32 gMonFrontPic_Lurantis[] = INCBIN_U32("graphics/pokemon/lurantis/front.4bpp.lz"); const u32 gMonFrontPic_Morelull[] = INCBIN_U32("graphics/pokemon/morelull/front.4bpp.lz"); const u32 gMonFrontPic_Shiinotic[] = INCBIN_U32("graphics/pokemon/shiinotic/front.4bpp.lz"); -const u32 gMonFrontPic_Salandit[] = INCBIN_U32("graphics/pokemon/salandit/front.4bpp.lz"); -const u32 gMonFrontPic_Salazzle[] = INCBIN_U32("graphics/pokemon/salazzle/front.4bpp.lz"); -const u32 gMonFrontPic_Stufful[] = INCBIN_U32("graphics/pokemon/stufful/front.4bpp.lz"); -const u32 gMonFrontPic_Bewear[] = INCBIN_U32("graphics/pokemon/bewear/front.4bpp.lz"); +const u32 gMonFrontPic_Salandit[] = INCBIN_U32("graphics/pokemon/salandit/anim_front.4bpp.lz"); +const u32 gMonFrontPic_Salazzle[] = INCBIN_U32("graphics/pokemon/salazzle/anim_front.4bpp.lz"); +const u32 gMonFrontPic_Stufful[] = INCBIN_U32("graphics/pokemon/stufful/anim_front.4bpp.lz"); +const u32 gMonFrontPic_Bewear[] = INCBIN_U32("graphics/pokemon/bewear/anim_front.4bpp.lz"); const u32 gMonFrontPic_Bounsweet[] = INCBIN_U32("graphics/pokemon/bounsweet/front.4bpp.lz"); const u32 gMonFrontPic_Steenee[] = INCBIN_U32("graphics/pokemon/steenee/front.4bpp.lz"); const u32 gMonFrontPic_Tsareena[] = INCBIN_U32("graphics/pokemon/tsareena/front.4bpp.lz"); const u32 gMonFrontPic_Comfey[] = INCBIN_U32("graphics/pokemon/comfey/front.4bpp.lz"); const u32 gMonFrontPic_Oranguru[] = INCBIN_U32("graphics/pokemon/oranguru/front.4bpp.lz"); const u32 gMonFrontPic_Passimian[] = INCBIN_U32("graphics/pokemon/passimian/front.4bpp.lz"); -const u32 gMonFrontPic_Wimpod[] = INCBIN_U32("graphics/pokemon/wimpod/front.4bpp.lz"); -const u32 gMonFrontPic_Golisopod[] = INCBIN_U32("graphics/pokemon/golisopod/front.4bpp.lz"); +const u32 gMonFrontPic_Wimpod[] = INCBIN_U32("graphics/pokemon/wimpod/anim_front.4bpp.lz"); +const u32 gMonFrontPic_Golisopod[] = INCBIN_U32("graphics/pokemon/golisopod/anim_front.4bpp.lz"); const u32 gMonFrontPic_Sandygast[] = INCBIN_U32("graphics/pokemon/sandygast/front.4bpp.lz"); const u32 gMonFrontPic_Palossand[] = INCBIN_U32("graphics/pokemon/palossand/front.4bpp.lz"); -const u32 gMonFrontPic_Pyukumuku[] = INCBIN_U32("graphics/pokemon/pyukumuku/front.4bpp.lz"); +const u32 gMonFrontPic_Pyukumuku[] = INCBIN_U32("graphics/pokemon/pyukumuku/anim_front.4bpp.lz"); const u32 gMonFrontPic_TypeNull[] = INCBIN_U32("graphics/pokemon/type_null/front.4bpp.lz"); const u32 gMonFrontPic_Silvally[] = INCBIN_U32("graphics/pokemon/silvally/front.4bpp.lz"); const u32 gMonFrontPic_Minior[] = INCBIN_U32("graphics/pokemon/minior/front.4bpp.lz"); const u32 gMonFrontPic_Komala[] = INCBIN_U32("graphics/pokemon/komala/front.4bpp.lz"); -const u32 gMonFrontPic_Turtonator[] = INCBIN_U32("graphics/pokemon/turtonator/front.4bpp.lz"); +const u32 gMonFrontPic_Turtonator[] = INCBIN_U32("graphics/pokemon/turtonator/anim_front.4bpp.lz"); const u32 gMonFrontPic_Togedemaru[] = INCBIN_U32("graphics/pokemon/togedemaru/front.4bpp.lz"); const u32 gMonFrontPic_Mimikyu[] = INCBIN_U32("graphics/pokemon/mimikyu/front.4bpp.lz"); const u32 gMonFrontPic_Bruxish[] = INCBIN_U32("graphics/pokemon/bruxish/front.4bpp.lz"); const u32 gMonFrontPic_Drampa[] = INCBIN_U32("graphics/pokemon/drampa/front.4bpp.lz"); const u32 gMonFrontPic_Dhelmise[] = INCBIN_U32("graphics/pokemon/dhelmise/front.4bpp.lz"); -const u32 gMonFrontPic_JangmoO[] = INCBIN_U32("graphics/pokemon/jangmo_o/front.4bpp.lz"); -const u32 gMonFrontPic_HakamoO[] = INCBIN_U32("graphics/pokemon/hakamo_o/front.4bpp.lz"); -const u32 gMonFrontPic_KommoO[] = INCBIN_U32("graphics/pokemon/kommo_o/front.4bpp.lz"); +const u32 gMonFrontPic_JangmoO[] = INCBIN_U32("graphics/pokemon/jangmo_o/anim_front.4bpp.lz"); +const u32 gMonFrontPic_HakamoO[] = INCBIN_U32("graphics/pokemon/hakamo_o/anim_front.4bpp.lz"); +const u32 gMonFrontPic_KommoO[] = INCBIN_U32("graphics/pokemon/kommo_o/anim_front.4bpp.lz"); const u32 gMonFrontPic_TapuKoko[] = INCBIN_U32("graphics/pokemon/tapu_koko/anim_front.4bpp.lz"); const u32 gMonFrontPic_TapuLele[] = INCBIN_U32("graphics/pokemon/tapu_lele/anim_front.4bpp.lz"); const u32 gMonFrontPic_TapuBulu[] = INCBIN_U32("graphics/pokemon/tapu_bulu/anim_front.4bpp.lz"); @@ -841,9 +921,9 @@ const u32 gMonFrontPic_Drizzile[] = INCBIN_U32("graphics/pokemon/drizzile/front. const u32 gMonFrontPic_Inteleon[] = INCBIN_U32("graphics/pokemon/inteleon/front.4bpp.lz"); const u32 gMonFrontPic_Skwovet[] = INCBIN_U32("graphics/pokemon/skwovet/front.4bpp.lz"); const u32 gMonFrontPic_Greedent[] = INCBIN_U32("graphics/pokemon/greedent/front.4bpp.lz"); -const u32 gMonFrontPic_Rookidee[] = INCBIN_U32("graphics/pokemon/rookidee/front.4bpp.lz"); -const u32 gMonFrontPic_Corvisquire[] = INCBIN_U32("graphics/pokemon/corvisquire/front.4bpp.lz"); -const u32 gMonFrontPic_Corviknight[] = INCBIN_U32("graphics/pokemon/corviknight/front.4bpp.lz"); +const u32 gMonFrontPic_Rookidee[] = INCBIN_U32("graphics/pokemon/rookidee/anim_front.4bpp.lz"); +const u32 gMonFrontPic_Corvisquire[] = INCBIN_U32("graphics/pokemon/corvisquire/anim_front.4bpp.lz"); +const u32 gMonFrontPic_Corviknight[] = INCBIN_U32("graphics/pokemon/corviknight/anim_front.4bpp.lz"); const u32 gMonFrontPic_Blipbug[] = INCBIN_U32("graphics/pokemon/blipbug/front.4bpp.lz"); const u32 gMonFrontPic_Dottler[] = INCBIN_U32("graphics/pokemon/dottler/front.4bpp.lz"); const u32 gMonFrontPic_Orbeetle[] = INCBIN_U32("graphics/pokemon/orbeetle/front.4bpp.lz"); @@ -853,16 +933,16 @@ const u32 gMonFrontPic_Gossifleur[] = INCBIN_U32("graphics/pokemon/gossifleur/fr const u32 gMonFrontPic_Eldegoss[] = INCBIN_U32("graphics/pokemon/eldegoss/front.4bpp.lz"); const u32 gMonFrontPic_Wooloo[] = INCBIN_U32("graphics/pokemon/wooloo/front.4bpp.lz"); const u32 gMonFrontPic_Dubwool[] = INCBIN_U32("graphics/pokemon/dubwool/front.4bpp.lz"); -const u32 gMonFrontPic_Chewtle[] = INCBIN_U32("graphics/pokemon/chewtle/front.4bpp.lz"); -const u32 gMonFrontPic_Drednaw[] = INCBIN_U32("graphics/pokemon/drednaw/front.4bpp.lz"); +const u32 gMonFrontPic_Chewtle[] = INCBIN_U32("graphics/pokemon/chewtle/anim_front.4bpp.lz"); +const u32 gMonFrontPic_Drednaw[] = INCBIN_U32("graphics/pokemon/drednaw/anim_front.4bpp.lz"); const u32 gMonFrontPic_Yamper[] = INCBIN_U32("graphics/pokemon/yamper/front.4bpp.lz"); const u32 gMonFrontPic_Boltund[] = INCBIN_U32("graphics/pokemon/boltund/front.4bpp.lz"); -const u32 gMonFrontPic_Rolycoly[] = INCBIN_U32("graphics/pokemon/rolycoly/front.4bpp.lz"); -const u32 gMonFrontPic_Carkol[] = INCBIN_U32("graphics/pokemon/carkol/front.4bpp.lz"); -const u32 gMonFrontPic_Coalossal[] = INCBIN_U32("graphics/pokemon/coalossal/front.4bpp.lz"); -const u32 gMonFrontPic_Applin[] = INCBIN_U32("graphics/pokemon/applin/front.4bpp.lz"); -const u32 gMonFrontPic_Flapple[] = INCBIN_U32("graphics/pokemon/flapple/front.4bpp.lz"); -const u32 gMonFrontPic_Appletun[] = INCBIN_U32("graphics/pokemon/appletun/front.4bpp.lz"); +const u32 gMonFrontPic_Rolycoly[] = INCBIN_U32("graphics/pokemon/rolycoly/anim_front.4bpp.lz"); +const u32 gMonFrontPic_Carkol[] = INCBIN_U32("graphics/pokemon/carkol/anim_front.4bpp.lz"); +const u32 gMonFrontPic_Coalossal[] = INCBIN_U32("graphics/pokemon/coalossal/anim_front.4bpp.lz"); +const u32 gMonFrontPic_Applin[] = INCBIN_U32("graphics/pokemon/applin/anim_front.4bpp.lz"); +const u32 gMonFrontPic_Flapple[] = INCBIN_U32("graphics/pokemon/flapple/anim_front.4bpp.lz"); +const u32 gMonFrontPic_Appletun[] = INCBIN_U32("graphics/pokemon/appletun/anim_front.4bpp.lz"); const u32 gMonFrontPic_Silicobra[] = INCBIN_U32("graphics/pokemon/silicobra/front.4bpp.lz"); const u32 gMonFrontPic_Sandaconda[] = INCBIN_U32("graphics/pokemon/sandaconda/front.4bpp.lz"); const u32 gMonFrontPic_Cramorant[] = INCBIN_U32("graphics/pokemon/cramorant/front.4bpp.lz"); @@ -870,8 +950,8 @@ const u32 gMonFrontPic_Arrokuda[] = INCBIN_U32("graphics/pokemon/arrokuda/front. const u32 gMonFrontPic_Barraskewda[] = INCBIN_U32("graphics/pokemon/barraskewda/front.4bpp.lz"); const u32 gMonFrontPic_Toxel[] = INCBIN_U32("graphics/pokemon/toxel/front.4bpp.lz"); const u32 gMonFrontPic_Toxtricity[] = INCBIN_U32("graphics/pokemon/toxtricity/front.4bpp.lz"); -const u32 gMonFrontPic_Sizzlipede[] = INCBIN_U32("graphics/pokemon/sizzlipede/front.4bpp.lz"); -const u32 gMonFrontPic_Centiskorch[] = INCBIN_U32("graphics/pokemon/centiskorch/front.4bpp.lz"); +const u32 gMonFrontPic_Sizzlipede[] = INCBIN_U32("graphics/pokemon/sizzlipede/anim_front.4bpp.lz"); +const u32 gMonFrontPic_Centiskorch[] = INCBIN_U32("graphics/pokemon/centiskorch/anim_front.4bpp.lz"); const u32 gMonFrontPic_Clobbopus[] = INCBIN_U32("graphics/pokemon/clobbopus/front.4bpp.lz"); const u32 gMonFrontPic_Grapploct[] = INCBIN_U32("graphics/pokemon/grapploct/front.4bpp.lz"); const u32 gMonFrontPic_Sinistea[] = INCBIN_U32("graphics/pokemon/sinistea/front.4bpp.lz"); @@ -891,7 +971,7 @@ const u32 gMonFrontPic_Runerigus[] = INCBIN_U32("graphics/pokemon/runerigus/fron const u32 gMonFrontPic_Milcery[] = INCBIN_U32("graphics/pokemon/milcery/front.4bpp.lz"); const u32 gMonFrontPic_Alcremie[] = INCBIN_U32("graphics/pokemon/alcremie/front.4bpp.lz"); const u32 gMonFrontPic_Falinks[] = INCBIN_U32("graphics/pokemon/falinks/front.4bpp.lz"); -const u32 gMonFrontPic_Pincurchin[] = INCBIN_U32("graphics/pokemon/pincurchin/front.4bpp.lz"); +const u32 gMonFrontPic_Pincurchin[] = INCBIN_U32("graphics/pokemon/pincurchin/anim_front.4bpp.lz"); const u32 gMonFrontPic_Snom[] = INCBIN_U32("graphics/pokemon/snom/front.4bpp.lz"); const u32 gMonFrontPic_Frosmoth[] = INCBIN_U32("graphics/pokemon/frosmoth/front.4bpp.lz"); const u32 gMonFrontPic_Stonjourner[] = INCBIN_U32("graphics/pokemon/stonjourner/front.4bpp.lz"); @@ -999,7 +1079,7 @@ const u32 gMonFrontPic_GravelerAlolan[] = INCBIN_U32("graphics/pokemon/graveler/ const u32 gMonFrontPic_GolemAlolan[] = INCBIN_U32("graphics/pokemon/golem/alolan/front.4bpp.lz"); const u32 gMonFrontPic_GrimerAlolan[] = INCBIN_U32("graphics/pokemon/grimer/alolan/front.4bpp.lz"); const u32 gMonFrontPic_MukAlolan[] = INCBIN_U32("graphics/pokemon/muk/alolan/front.4bpp.lz"); -const u32 gMonFrontPic_ExeggutorAlolan[] = INCBIN_U32("graphics/pokemon/exeggutor/alolan/front.4bpp.lz"); +const u32 gMonFrontPic_ExeggutorAlolan[] = INCBIN_U32("graphics/pokemon/exeggutor/alolan/anim_front.4bpp.lz"); const u32 gMonFrontPic_MarowakAlolan[] = INCBIN_U32("graphics/pokemon/marowak/alolan/front.4bpp.lz"); const u32 gMonFrontPic_MeowthGalarian[] = INCBIN_U32("graphics/pokemon/meowth/galarian/front.4bpp.lz"); const u32 gMonFrontPic_PonytaGalarian[] = INCBIN_U32("graphics/pokemon/ponyta/galarian/front.4bpp.lz"); @@ -1029,6 +1109,7 @@ const u32 gMonFrontPic_ElectrodeHisuian[] = INCBIN_U32("graphics/pokemon/electro const u32 gMonFrontPic_TyphlosionHisuian[] = INCBIN_U32("graphics/pokemon/typhlosion/hisuian/front.4bpp.lz"); const u32 gMonFrontPic_QwilfishHisuian[] = INCBIN_U32("graphics/pokemon/qwilfish/hisuian/front.4bpp.lz"); const u32 gMonFrontPic_SneaselHisuian[] = INCBIN_U32("graphics/pokemon/sneasel/hisuian/front.4bpp.lz"); +const u32 gMonFrontPic_SneaselHisuianF[] = INCBIN_U32("graphics/pokemon/sneasel/hisuian/frontf.4bpp.lz"); #if P_GEN_5_POKEMON == TRUE const u32 gMonFrontPic_SamurottHisuian[] = INCBIN_U32("graphics/pokemon/samurott/hisuian/front.4bpp.lz"); const u32 gMonFrontPic_LilligantHisuian[] = INCBIN_U32("graphics/pokemon/lilligant/hisuian/front.4bpp.lz"); @@ -1097,7 +1178,7 @@ const u32 gMonFrontPic_BurmySandyCloak[] = INCBIN_U32("graphics/pokemon/burmy/sa const u32 gMonFrontPic_BurmyTrashCloak[] = INCBIN_U32("graphics/pokemon/burmy/trash_cloak/anim_front.4bpp.lz"); const u32 gMonFrontPic_WormadamSandyCloak[] = INCBIN_U32("graphics/pokemon/wormadam/sandy_cloak/anim_front.4bpp.lz"); const u32 gMonFrontPic_WormadamTrashCloak[] = INCBIN_U32("graphics/pokemon/wormadam/trash_cloak/anim_front.4bpp.lz"); -const u32 gMonFrontPic_CherrimSunshine[] = INCBIN_U32("graphics/pokemon/cherrim/sunshine/front.4bpp.lz"); +const u32 gMonFrontPic_CherrimSunshine[] = INCBIN_U32("graphics/pokemon/cherrim/sunshine/anim_front.4bpp.lz"); const u32 gMonFrontPic_ShellosEastSea[] = INCBIN_U32("graphics/pokemon/shellos/east_sea/anim_front.4bpp.lz"); const u32 gMonFrontPic_GastrodonEastSea[] = INCBIN_U32("graphics/pokemon/gastrodon/east_sea/anim_front.4bpp.lz"); const u32 gMonFrontPic_RotomHeat[] = INCBIN_U32("graphics/pokemon/rotom/heat/anim_front.4bpp.lz"); @@ -1216,6 +1297,7 @@ const u32 gMonBackPic_DoubleQuestionMark[] = INCBIN_U32("graphics/pokemon/questi const u32 gMonBackPic_Bulbasaur[] = INCBIN_U32("graphics/pokemon/bulbasaur/back.4bpp.lz"); const u32 gMonBackPic_Ivysaur[] = INCBIN_U32("graphics/pokemon/ivysaur/back.4bpp.lz"); const u32 gMonBackPic_Venusaur[] = INCBIN_U32("graphics/pokemon/venusaur/back.4bpp.lz"); +const u32 gMonBackPic_VenusaurF[] = INCBIN_U32("graphics/pokemon/venusaur/backf.4bpp.lz"); const u32 gMonBackPic_Charmander[] = INCBIN_U32("graphics/pokemon/charmander/back.4bpp.lz"); const u32 gMonBackPic_Charmeleon[] = INCBIN_U32("graphics/pokemon/charmeleon/back.4bpp.lz"); const u32 gMonBackPic_Charizard[] = INCBIN_U32("graphics/pokemon/charizard/back.4bpp.lz"); @@ -1225,6 +1307,7 @@ const u32 gMonBackPic_Blastoise[] = INCBIN_U32("graphics/pokemon/blastoise/back. const u32 gMonBackPic_Caterpie[] = INCBIN_U32("graphics/pokemon/caterpie/back.4bpp.lz"); const u32 gMonBackPic_Metapod[] = INCBIN_U32("graphics/pokemon/metapod/back.4bpp.lz"); const u32 gMonBackPic_Butterfree[] = INCBIN_U32("graphics/pokemon/butterfree/back.4bpp.lz"); +const u32 gMonBackPic_ButterfreeF[] = INCBIN_U32("graphics/pokemon/butterfree/backf.4bpp.lz"); const u32 gMonBackPic_Weedle[] = INCBIN_U32("graphics/pokemon/weedle/back.4bpp.lz"); const u32 gMonBackPic_Kakuna[] = INCBIN_U32("graphics/pokemon/kakuna/back.4bpp.lz"); const u32 gMonBackPic_Beedrill[] = INCBIN_U32("graphics/pokemon/beedrill/back.4bpp.lz"); @@ -1232,12 +1315,15 @@ const u32 gMonBackPic_Pidgey[] = INCBIN_U32("graphics/pokemon/pidgey/back.4bpp.l const u32 gMonBackPic_Pidgeotto[] = INCBIN_U32("graphics/pokemon/pidgeotto/back.4bpp.lz"); const u32 gMonBackPic_Pidgeot[] = INCBIN_U32("graphics/pokemon/pidgeot/back.4bpp.lz"); const u32 gMonBackPic_Rattata[] = INCBIN_U32("graphics/pokemon/rattata/back.4bpp.lz"); +const u32 gMonBackPic_RattataF[] = INCBIN_U32("graphics/pokemon/rattata/backf.4bpp.lz"); const u32 gMonBackPic_Raticate[] = INCBIN_U32("graphics/pokemon/raticate/back.4bpp.lz"); +const u32 gMonBackPic_RaticateF[] = INCBIN_U32("graphics/pokemon/raticate/backf.4bpp.lz"); const u32 gMonBackPic_Spearow[] = INCBIN_U32("graphics/pokemon/spearow/back.4bpp.lz"); const u32 gMonBackPic_Fearow[] = INCBIN_U32("graphics/pokemon/fearow/back.4bpp.lz"); const u32 gMonBackPic_Ekans[] = INCBIN_U32("graphics/pokemon/ekans/back.4bpp.lz"); const u32 gMonBackPic_Arbok[] = INCBIN_U32("graphics/pokemon/arbok/back.4bpp.lz"); const u32 gMonBackPic_Pikachu[] = INCBIN_U32("graphics/pokemon/pikachu/back.4bpp.lz"); +const u32 gMonBackPic_PikachuF[] = INCBIN_U32("graphics/pokemon/pikachu/backf.4bpp.lz"); const u32 gMonBackPic_Raichu[] = INCBIN_U32("graphics/pokemon/raichu/back.4bpp.lz"); const u32 gMonBackPic_Sandshrew[] = INCBIN_U32("graphics/pokemon/sandshrew/back.4bpp.lz"); const u32 gMonBackPic_Sandslash[] = INCBIN_U32("graphics/pokemon/sandslash/back.4bpp.lz"); @@ -1254,10 +1340,14 @@ const u32 gMonBackPic_Ninetales[] = INCBIN_U32("graphics/pokemon/ninetales/back. const u32 gMonBackPic_Jigglypuff[] = INCBIN_U32("graphics/pokemon/jigglypuff/back.4bpp.lz"); const u32 gMonBackPic_Wigglytuff[] = INCBIN_U32("graphics/pokemon/wigglytuff/back.4bpp.lz"); const u32 gMonBackPic_Zubat[] = INCBIN_U32("graphics/pokemon/zubat/back.4bpp.lz"); +const u32 gMonBackPic_ZubatF[] = INCBIN_U32("graphics/pokemon/zubat/backf.4bpp.lz"); const u32 gMonBackPic_Golbat[] = INCBIN_U32("graphics/pokemon/golbat/back.4bpp.lz"); +const u32 gMonBackPic_GolbatF[] = INCBIN_U32("graphics/pokemon/golbat/backf.4bpp.lz"); const u32 gMonBackPic_Oddish[] = INCBIN_U32("graphics/pokemon/oddish/back.4bpp.lz"); const u32 gMonBackPic_Gloom[] = INCBIN_U32("graphics/pokemon/gloom/back.4bpp.lz"); +const u32 gMonBackPic_GloomF[] = INCBIN_U32("graphics/pokemon/gloom/backf.4bpp.lz"); const u32 gMonBackPic_Vileplume[] = INCBIN_U32("graphics/pokemon/vileplume/back.4bpp.lz"); +const u32 gMonBackPic_VileplumeF[] = INCBIN_U32("graphics/pokemon/vileplume/backf.4bpp.lz"); const u32 gMonBackPic_Paras[] = INCBIN_U32("graphics/pokemon/paras/back.4bpp.lz"); const u32 gMonBackPic_Parasect[] = INCBIN_U32("graphics/pokemon/parasect/back.4bpp.lz"); const u32 gMonBackPic_Venonat[] = INCBIN_U32("graphics/pokemon/venonat/back.4bpp.lz"); @@ -1277,7 +1367,9 @@ const u32 gMonBackPic_Poliwhirl[] = INCBIN_U32("graphics/pokemon/poliwhirl/back. const u32 gMonBackPic_Poliwrath[] = INCBIN_U32("graphics/pokemon/poliwrath/back.4bpp.lz"); const u32 gMonBackPic_Abra[] = INCBIN_U32("graphics/pokemon/abra/back.4bpp.lz"); const u32 gMonBackPic_Kadabra[] = INCBIN_U32("graphics/pokemon/kadabra/back.4bpp.lz"); +const u32 gMonBackPic_KadabraF[] = INCBIN_U32("graphics/pokemon/kadabra/backf.4bpp.lz"); const u32 gMonBackPic_Alakazam[] = INCBIN_U32("graphics/pokemon/alakazam/back.4bpp.lz"); +const u32 gMonBackPic_AlakazamF[] = INCBIN_U32("graphics/pokemon/alakazam/backf.4bpp.lz"); const u32 gMonBackPic_Machop[] = INCBIN_U32("graphics/pokemon/machop/back.4bpp.lz"); const u32 gMonBackPic_Machoke[] = INCBIN_U32("graphics/pokemon/machoke/back.4bpp.lz"); const u32 gMonBackPic_Machamp[] = INCBIN_U32("graphics/pokemon/machamp/back.4bpp.lz"); @@ -1297,7 +1389,9 @@ const u32 gMonBackPic_Magnemite[] = INCBIN_U32("graphics/pokemon/magnemite/back. const u32 gMonBackPic_Magneton[] = INCBIN_U32("graphics/pokemon/magneton/back.4bpp.lz"); const u32 gMonBackPic_Farfetchd[] = INCBIN_U32("graphics/pokemon/farfetchd/back.4bpp.lz"); const u32 gMonBackPic_Doduo[] = INCBIN_U32("graphics/pokemon/doduo/back.4bpp.lz"); +const u32 gMonBackPic_DoduoF[] = INCBIN_U32("graphics/pokemon/doduo/backf.4bpp.lz"); const u32 gMonBackPic_Dodrio[] = INCBIN_U32("graphics/pokemon/dodrio/back.4bpp.lz"); +const u32 gMonBackPic_DodrioF[] = INCBIN_U32("graphics/pokemon/dodrio/backf.4bpp.lz"); const u32 gMonBackPic_Seel[] = INCBIN_U32("graphics/pokemon/seel/back.4bpp.lz"); const u32 gMonBackPic_Dewgong[] = INCBIN_U32("graphics/pokemon/dewgong/back.4bpp.lz"); const u32 gMonBackPic_Grimer[] = INCBIN_U32("graphics/pokemon/grimer/back.4bpp.lz"); @@ -1310,6 +1404,7 @@ const u32 gMonBackPic_Gengar[] = INCBIN_U32("graphics/pokemon/gengar/back.4bpp.l const u32 gMonBackPic_Onix[] = INCBIN_U32("graphics/pokemon/onix/back.4bpp.lz"); const u32 gMonBackPic_Drowzee[] = INCBIN_U32("graphics/pokemon/drowzee/back.4bpp.lz"); const u32 gMonBackPic_Hypno[] = INCBIN_U32("graphics/pokemon/hypno/back.4bpp.lz"); +const u32 gMonBackPic_HypnoF[] = INCBIN_U32("graphics/pokemon/hypno/backf.4bpp.lz"); const u32 gMonBackPic_Krabby[] = INCBIN_U32("graphics/pokemon/krabby/back.4bpp.lz"); const u32 gMonBackPic_Kingler[] = INCBIN_U32("graphics/pokemon/kingler/back.4bpp.lz"); const u32 gMonBackPic_Voltorb[] = INCBIN_U32("graphics/pokemon/voltorb/back.4bpp.lz"); @@ -1324,14 +1419,18 @@ const u32 gMonBackPic_Lickitung[] = INCBIN_U32("graphics/pokemon/lickitung/back. const u32 gMonBackPic_Koffing[] = INCBIN_U32("graphics/pokemon/koffing/back.4bpp.lz"); const u32 gMonBackPic_Weezing[] = INCBIN_U32("graphics/pokemon/weezing/back.4bpp.lz"); const u32 gMonBackPic_Rhyhorn[] = INCBIN_U32("graphics/pokemon/rhyhorn/back.4bpp.lz"); +const u32 gMonBackPic_RhyhornF[] = INCBIN_U32("graphics/pokemon/rhyhorn/backf.4bpp.lz"); const u32 gMonBackPic_Rhydon[] = INCBIN_U32("graphics/pokemon/rhydon/back.4bpp.lz"); +const u32 gMonBackPic_RhydonF[] = INCBIN_U32("graphics/pokemon/rhydon/backf.4bpp.lz"); const u32 gMonBackPic_Chansey[] = INCBIN_U32("graphics/pokemon/chansey/back.4bpp.lz"); const u32 gMonBackPic_Tangela[] = INCBIN_U32("graphics/pokemon/tangela/back.4bpp.lz"); const u32 gMonBackPic_Kangaskhan[] = INCBIN_U32("graphics/pokemon/kangaskhan/back.4bpp.lz"); const u32 gMonBackPic_Horsea[] = INCBIN_U32("graphics/pokemon/horsea/back.4bpp.lz"); const u32 gMonBackPic_Seadra[] = INCBIN_U32("graphics/pokemon/seadra/back.4bpp.lz"); const u32 gMonBackPic_Goldeen[] = INCBIN_U32("graphics/pokemon/goldeen/back.4bpp.lz"); +const u32 gMonBackPic_GoldeenF[] = INCBIN_U32("graphics/pokemon/goldeen/backf.4bpp.lz"); const u32 gMonBackPic_Seaking[] = INCBIN_U32("graphics/pokemon/seaking/back.4bpp.lz"); +const u32 gMonBackPic_SeakingF[] = INCBIN_U32("graphics/pokemon/seaking/backf.4bpp.lz"); const u32 gMonBackPic_Staryu[] = INCBIN_U32("graphics/pokemon/staryu/back.4bpp.lz"); const u32 gMonBackPic_Starmie[] = INCBIN_U32("graphics/pokemon/starmie/back.4bpp.lz"); const u32 gMonBackPic_MrMime[] = INCBIN_U32("graphics/pokemon/mr_mime/back.4bpp.lz"); @@ -1342,7 +1441,9 @@ const u32 gMonBackPic_Magmar[] = INCBIN_U32("graphics/pokemon/magmar/back.4bpp.l const u32 gMonBackPic_Pinsir[] = INCBIN_U32("graphics/pokemon/pinsir/back.4bpp.lz"); const u32 gMonBackPic_Tauros[] = INCBIN_U32("graphics/pokemon/tauros/back.4bpp.lz"); const u32 gMonBackPic_Magikarp[] = INCBIN_U32("graphics/pokemon/magikarp/back.4bpp.lz"); +const u32 gMonBackPic_MagikarpF[] = INCBIN_U32("graphics/pokemon/magikarp/backf.4bpp.lz"); const u32 gMonBackPic_Gyarados[] = INCBIN_U32("graphics/pokemon/gyarados/back.4bpp.lz"); +const u32 gMonBackPic_GyaradosF[] = INCBIN_U32("graphics/pokemon/gyarados/backf.4bpp.lz"); const u32 gMonBackPic_Lapras[] = INCBIN_U32("graphics/pokemon/lapras/back.4bpp.lz"); const u32 gMonBackPic_Ditto[] = INCBIN_U32("graphics/pokemon/ditto/back.4bpp.lz"); const u32 gMonBackPic_Eevee[] = INCBIN_U32("graphics/pokemon/eevee/back.4bpp.lz"); @@ -1368,6 +1469,7 @@ const u32 gMonBackPic_Mew[] = INCBIN_U32("graphics/pokemon/mew/back.4bpp.lz"); const u32 gMonBackPic_Chikorita[] = INCBIN_U32("graphics/pokemon/chikorita/back.4bpp.lz"); const u32 gMonBackPic_Bayleef[] = INCBIN_U32("graphics/pokemon/bayleef/back.4bpp.lz"); const u32 gMonBackPic_Meganium[] = INCBIN_U32("graphics/pokemon/meganium/back.4bpp.lz"); +const u32 gMonBackPic_MeganiumF[] = INCBIN_U32("graphics/pokemon/meganium/backf.4bpp.lz"); const u32 gMonBackPic_Cyndaquil[] = INCBIN_U32("graphics/pokemon/cyndaquil/back.4bpp.lz"); const u32 gMonBackPic_Quilava[] = INCBIN_U32("graphics/pokemon/quilava/back.4bpp.lz"); const u32 gMonBackPic_Typhlosion[] = INCBIN_U32("graphics/pokemon/typhlosion/back.4bpp.lz"); @@ -1379,7 +1481,9 @@ const u32 gMonBackPic_Furret[] = INCBIN_U32("graphics/pokemon/furret/back.4bpp.l const u32 gMonBackPic_Hoothoot[] = INCBIN_U32("graphics/pokemon/hoothoot/back.4bpp.lz"); const u32 gMonBackPic_Noctowl[] = INCBIN_U32("graphics/pokemon/noctowl/back.4bpp.lz"); const u32 gMonBackPic_Ledyba[] = INCBIN_U32("graphics/pokemon/ledyba/back.4bpp.lz"); +const u32 gMonBackPic_LedybaF[] = INCBIN_U32("graphics/pokemon/ledyba/backf.4bpp.lz"); const u32 gMonBackPic_Ledian[] = INCBIN_U32("graphics/pokemon/ledian/back.4bpp.lz"); +const u32 gMonBackPic_LedianF[] = INCBIN_U32("graphics/pokemon/ledian/backf.4bpp.lz"); const u32 gMonBackPic_Spinarak[] = INCBIN_U32("graphics/pokemon/spinarak/back.4bpp.lz"); const u32 gMonBackPic_Ariados[] = INCBIN_U32("graphics/pokemon/ariados/back.4bpp.lz"); const u32 gMonBackPic_Crobat[] = INCBIN_U32("graphics/pokemon/crobat/back.4bpp.lz"); @@ -1399,53 +1503,70 @@ const u32 gMonBackPic_Bellossom[] = INCBIN_U32("graphics/pokemon/bellossom/back. const u32 gMonBackPic_Marill[] = INCBIN_U32("graphics/pokemon/marill/back.4bpp.lz"); const u32 gMonBackPic_Azumarill[] = INCBIN_U32("graphics/pokemon/azumarill/back.4bpp.lz"); const u32 gMonBackPic_Sudowoodo[] = INCBIN_U32("graphics/pokemon/sudowoodo/back.4bpp.lz"); +const u32 gMonBackPic_SudowoodoF[] = INCBIN_U32("graphics/pokemon/sudowoodo/backf.4bpp.lz"); const u32 gMonBackPic_Politoed[] = INCBIN_U32("graphics/pokemon/politoed/back.4bpp.lz"); +const u32 gMonBackPic_PolitoedF[] = INCBIN_U32("graphics/pokemon/politoed/backf.4bpp.lz"); const u32 gMonBackPic_Hoppip[] = INCBIN_U32("graphics/pokemon/hoppip/back.4bpp.lz"); const u32 gMonBackPic_Skiploom[] = INCBIN_U32("graphics/pokemon/skiploom/back.4bpp.lz"); const u32 gMonBackPic_Jumpluff[] = INCBIN_U32("graphics/pokemon/jumpluff/back.4bpp.lz"); const u32 gMonBackPic_Aipom[] = INCBIN_U32("graphics/pokemon/aipom/back.4bpp.lz"); +const u32 gMonBackPic_AipomF[] = INCBIN_U32("graphics/pokemon/aipom/backf.4bpp.lz"); const u32 gMonBackPic_Sunkern[] = INCBIN_U32("graphics/pokemon/sunkern/back.4bpp.lz"); const u32 gMonBackPic_Sunflora[] = INCBIN_U32("graphics/pokemon/sunflora/back.4bpp.lz"); const u32 gMonBackPic_Yanma[] = INCBIN_U32("graphics/pokemon/yanma/back.4bpp.lz"); const u32 gMonBackPic_Wooper[] = INCBIN_U32("graphics/pokemon/wooper/back.4bpp.lz"); +const u32 gMonBackPic_WooperF[] = INCBIN_U32("graphics/pokemon/wooper/backf.4bpp.lz"); const u32 gMonBackPic_Quagsire[] = INCBIN_U32("graphics/pokemon/quagsire/back.4bpp.lz"); +const u32 gMonBackPic_QuagsireF[] = INCBIN_U32("graphics/pokemon/quagsire/backf.4bpp.lz"); const u32 gMonBackPic_Espeon[] = INCBIN_U32("graphics/pokemon/espeon/back.4bpp.lz"); const u32 gMonBackPic_Umbreon[] = INCBIN_U32("graphics/pokemon/umbreon/back.4bpp.lz"); const u32 gMonBackPic_Murkrow[] = INCBIN_U32("graphics/pokemon/murkrow/back.4bpp.lz"); +const u32 gMonBackPic_MurkrowF[] = INCBIN_U32("graphics/pokemon/murkrow/backf.4bpp.lz"); const u32 gMonBackPic_Slowking[] = INCBIN_U32("graphics/pokemon/slowking/back.4bpp.lz"); const u32 gMonBackPic_Misdreavus[] = INCBIN_U32("graphics/pokemon/misdreavus/back.4bpp.lz"); const u32 gMonBackPic_Unown[] = INCBIN_U32("graphics/pokemon/unown/back.4bpp.lz"); const u32 gMonBackPic_Wobbuffet[] = INCBIN_U32("graphics/pokemon/wobbuffet/back.4bpp.lz"); +const u32 gMonBackPic_WobbuffetF[] = INCBIN_U32("graphics/pokemon/wobbuffet/backf.4bpp.lz"); const u32 gMonBackPic_Girafarig[] = INCBIN_U32("graphics/pokemon/girafarig/back.4bpp.lz"); +const u32 gMonBackPic_GirafarigF[] = INCBIN_U32("graphics/pokemon/girafarig/backf.4bpp.lz"); const u32 gMonBackPic_Pineco[] = INCBIN_U32("graphics/pokemon/pineco/back.4bpp.lz"); const u32 gMonBackPic_Forretress[] = INCBIN_U32("graphics/pokemon/forretress/back.4bpp.lz"); const u32 gMonBackPic_Dunsparce[] = INCBIN_U32("graphics/pokemon/dunsparce/back.4bpp.lz"); const u32 gMonBackPic_Gligar[] = INCBIN_U32("graphics/pokemon/gligar/back.4bpp.lz"); +const u32 gMonBackPic_GligarF[] = INCBIN_U32("graphics/pokemon/gligar/backf.4bpp.lz"); const u32 gMonBackPic_Steelix[] = INCBIN_U32("graphics/pokemon/steelix/back.4bpp.lz"); +const u32 gMonBackPic_SteelixF[] = INCBIN_U32("graphics/pokemon/steelix/backf.4bpp.lz"); const u32 gMonBackPic_Snubbull[] = INCBIN_U32("graphics/pokemon/snubbull/back.4bpp.lz"); const u32 gMonBackPic_Granbull[] = INCBIN_U32("graphics/pokemon/granbull/back.4bpp.lz"); const u32 gMonBackPic_Qwilfish[] = INCBIN_U32("graphics/pokemon/qwilfish/back.4bpp.lz"); const u32 gMonBackPic_Scizor[] = INCBIN_U32("graphics/pokemon/scizor/back.4bpp.lz"); const u32 gMonBackPic_Shuckle[] = INCBIN_U32("graphics/pokemon/shuckle/back.4bpp.lz"); const u32 gMonBackPic_Heracross[] = INCBIN_U32("graphics/pokemon/heracross/back.4bpp.lz"); +const u32 gMonBackPic_HeracrossF[] = INCBIN_U32("graphics/pokemon/heracross/backf.4bpp.lz"); const u32 gMonBackPic_Sneasel[] = INCBIN_U32("graphics/pokemon/sneasel/back.4bpp.lz"); +const u32 gMonBackPic_SneaselF[] = INCBIN_U32("graphics/pokemon/sneasel/backf.4bpp.lz"); const u32 gMonBackPic_Teddiursa[] = INCBIN_U32("graphics/pokemon/teddiursa/back.4bpp.lz"); const u32 gMonBackPic_Ursaring[] = INCBIN_U32("graphics/pokemon/ursaring/back.4bpp.lz"); +const u32 gMonBackPic_UrsaringF[] = INCBIN_U32("graphics/pokemon/ursaring/backf.4bpp.lz"); const u32 gMonBackPic_Slugma[] = INCBIN_U32("graphics/pokemon/slugma/back.4bpp.lz"); const u32 gMonBackPic_Magcargo[] = INCBIN_U32("graphics/pokemon/magcargo/back.4bpp.lz"); const u32 gMonBackPic_Swinub[] = INCBIN_U32("graphics/pokemon/swinub/back.4bpp.lz"); const u32 gMonBackPic_Piloswine[] = INCBIN_U32("graphics/pokemon/piloswine/back.4bpp.lz"); +const u32 gMonBackPic_PiloswineF[] = INCBIN_U32("graphics/pokemon/piloswine/backf.4bpp.lz"); const u32 gMonBackPic_Corsola[] = INCBIN_U32("graphics/pokemon/corsola/back.4bpp.lz"); const u32 gMonBackPic_Remoraid[] = INCBIN_U32("graphics/pokemon/remoraid/back.4bpp.lz"); const u32 gMonBackPic_Octillery[] = INCBIN_U32("graphics/pokemon/octillery/back.4bpp.lz"); +const u32 gMonBackPic_OctilleryF[] = INCBIN_U32("graphics/pokemon/octillery/backf.4bpp.lz"); const u32 gMonBackPic_Delibird[] = INCBIN_U32("graphics/pokemon/delibird/back.4bpp.lz"); const u32 gMonBackPic_Mantine[] = INCBIN_U32("graphics/pokemon/mantine/back.4bpp.lz"); const u32 gMonBackPic_Skarmory[] = INCBIN_U32("graphics/pokemon/skarmory/back.4bpp.lz"); const u32 gMonBackPic_Houndour[] = INCBIN_U32("graphics/pokemon/houndour/back.4bpp.lz"); const u32 gMonBackPic_Houndoom[] = INCBIN_U32("graphics/pokemon/houndoom/back.4bpp.lz"); +const u32 gMonBackPic_HoundoomF[] = INCBIN_U32("graphics/pokemon/houndoom/backf.4bpp.lz"); const u32 gMonBackPic_Kingdra[] = INCBIN_U32("graphics/pokemon/kingdra/back.4bpp.lz"); const u32 gMonBackPic_Phanpy[] = INCBIN_U32("graphics/pokemon/phanpy/back.4bpp.lz"); const u32 gMonBackPic_Donphan[] = INCBIN_U32("graphics/pokemon/donphan/back.4bpp.lz"); +const u32 gMonBackPic_DonphanF[] = INCBIN_U32("graphics/pokemon/donphan/backf.4bpp.lz"); const u32 gMonBackPic_Porygon2[] = INCBIN_U32("graphics/pokemon/porygon2/back.4bpp.lz"); const u32 gMonBackPic_Stantler[] = INCBIN_U32("graphics/pokemon/stantler/back.4bpp.lz"); const u32 gMonBackPic_Smeargle[] = INCBIN_U32("graphics/pokemon/smeargle/back.4bpp.lz"); @@ -1469,8 +1590,11 @@ const u32 gMonBackPic_Treecko[] = INCBIN_U32("graphics/pokemon/treecko/back.4bpp const u32 gMonBackPic_Grovyle[] = INCBIN_U32("graphics/pokemon/grovyle/back.4bpp.lz"); const u32 gMonBackPic_Sceptile[] = INCBIN_U32("graphics/pokemon/sceptile/back.4bpp.lz"); const u32 gMonBackPic_Torchic[] = INCBIN_U32("graphics/pokemon/torchic/back.4bpp.lz"); +const u32 gMonBackPic_TorchicF[] = INCBIN_U32("graphics/pokemon/torchic/backf.4bpp.lz"); const u32 gMonBackPic_Combusken[] = INCBIN_U32("graphics/pokemon/combusken/back.4bpp.lz"); +const u32 gMonBackPic_CombuskenF[] = INCBIN_U32("graphics/pokemon/combusken/backf.4bpp.lz"); const u32 gMonBackPic_Blaziken[] = INCBIN_U32("graphics/pokemon/blaziken/back.4bpp.lz"); +const u32 gMonBackPic_BlazikenF[] = INCBIN_U32("graphics/pokemon/blaziken/backf.4bpp.lz"); const u32 gMonBackPic_Mudkip[] = INCBIN_U32("graphics/pokemon/mudkip/back.4bpp.lz"); const u32 gMonBackPic_Marshtomp[] = INCBIN_U32("graphics/pokemon/marshtomp/back.4bpp.lz"); const u32 gMonBackPic_Swampert[] = INCBIN_U32("graphics/pokemon/swampert/back.4bpp.lz"); @@ -1481,14 +1605,19 @@ const u32 gMonBackPic_Linoone[] = INCBIN_U32("graphics/pokemon/linoone/back.4bpp const u32 gMonBackPic_Wurmple[] = INCBIN_U32("graphics/pokemon/wurmple/back.4bpp.lz"); const u32 gMonBackPic_Silcoon[] = INCBIN_U32("graphics/pokemon/silcoon/back.4bpp.lz"); const u32 gMonBackPic_Beautifly[] = INCBIN_U32("graphics/pokemon/beautifly/back.4bpp.lz"); +const u32 gMonBackPic_BeautiflyF[] = INCBIN_U32("graphics/pokemon/beautifly/backf.4bpp.lz"); const u32 gMonBackPic_Cascoon[] = INCBIN_U32("graphics/pokemon/cascoon/back.4bpp.lz"); const u32 gMonBackPic_Dustox[] = INCBIN_U32("graphics/pokemon/dustox/back.4bpp.lz"); +const u32 gMonBackPic_DustoxF[] = INCBIN_U32("graphics/pokemon/dustox/backf.4bpp.lz"); const u32 gMonBackPic_Lotad[] = INCBIN_U32("graphics/pokemon/lotad/back.4bpp.lz"); const u32 gMonBackPic_Lombre[] = INCBIN_U32("graphics/pokemon/lombre/back.4bpp.lz"); const u32 gMonBackPic_Ludicolo[] = INCBIN_U32("graphics/pokemon/ludicolo/back.4bpp.lz"); +const u32 gMonBackPic_LudicoloF[] = INCBIN_U32("graphics/pokemon/ludicolo/backf.4bpp.lz"); const u32 gMonBackPic_Seedot[] = INCBIN_U32("graphics/pokemon/seedot/back.4bpp.lz"); const u32 gMonBackPic_Nuzleaf[] = INCBIN_U32("graphics/pokemon/nuzleaf/back.4bpp.lz"); +const u32 gMonBackPic_NuzleafF[] = INCBIN_U32("graphics/pokemon/nuzleaf/backf.4bpp.lz"); const u32 gMonBackPic_Shiftry[] = INCBIN_U32("graphics/pokemon/shiftry/back.4bpp.lz"); +const u32 gMonBackPic_ShiftryF[] = INCBIN_U32("graphics/pokemon/shiftry/backf.4bpp.lz"); const u32 gMonBackPic_Taillow[] = INCBIN_U32("graphics/pokemon/taillow/back.4bpp.lz"); const u32 gMonBackPic_Swellow[] = INCBIN_U32("graphics/pokemon/swellow/back.4bpp.lz"); const u32 gMonBackPic_Wingull[] = INCBIN_U32("graphics/pokemon/wingull/back.4bpp.lz"); @@ -1521,7 +1650,9 @@ const u32 gMonBackPic_Aron[] = INCBIN_U32("graphics/pokemon/aron/back.4bpp.lz"); const u32 gMonBackPic_Lairon[] = INCBIN_U32("graphics/pokemon/lairon/back.4bpp.lz"); const u32 gMonBackPic_Aggron[] = INCBIN_U32("graphics/pokemon/aggron/back.4bpp.lz"); const u32 gMonBackPic_Meditite[] = INCBIN_U32("graphics/pokemon/meditite/back.4bpp.lz"); +const u32 gMonBackPic_MedititeF[] = INCBIN_U32("graphics/pokemon/meditite/backf.4bpp.lz"); const u32 gMonBackPic_Medicham[] = INCBIN_U32("graphics/pokemon/medicham/back.4bpp.lz"); +const u32 gMonBackPic_MedichamF[] = INCBIN_U32("graphics/pokemon/medicham/backf.4bpp.lz"); const u32 gMonBackPic_Electrike[] = INCBIN_U32("graphics/pokemon/electrike/back.4bpp.lz"); const u32 gMonBackPic_Manectric[] = INCBIN_U32("graphics/pokemon/manectric/back.4bpp.lz"); const u32 gMonBackPic_Plusle[] = INCBIN_U32("graphics/pokemon/plusle/back.4bpp.lz"); @@ -1529,14 +1660,19 @@ const u32 gMonBackPic_Minun[] = INCBIN_U32("graphics/pokemon/minun/back.4bpp.lz" const u32 gMonBackPic_Volbeat[] = INCBIN_U32("graphics/pokemon/volbeat/back.4bpp.lz"); const u32 gMonBackPic_Illumise[] = INCBIN_U32("graphics/pokemon/illumise/back.4bpp.lz"); const u32 gMonBackPic_Roselia[] = INCBIN_U32("graphics/pokemon/roselia/back.4bpp.lz"); +const u32 gMonBackPic_RoseliaF[] = INCBIN_U32("graphics/pokemon/roselia/backf.4bpp.lz"); const u32 gMonBackPic_Gulpin[] = INCBIN_U32("graphics/pokemon/gulpin/back.4bpp.lz"); +const u32 gMonBackPic_GulpinF[] = INCBIN_U32("graphics/pokemon/gulpin/backf.4bpp.lz"); const u32 gMonBackPic_Swalot[] = INCBIN_U32("graphics/pokemon/swalot/back.4bpp.lz"); +const u32 gMonBackPic_SwalotF[] = INCBIN_U32("graphics/pokemon/swalot/backf.4bpp.lz"); const u32 gMonBackPic_Carvanha[] = INCBIN_U32("graphics/pokemon/carvanha/back.4bpp.lz"); const u32 gMonBackPic_Sharpedo[] = INCBIN_U32("graphics/pokemon/sharpedo/back.4bpp.lz"); const u32 gMonBackPic_Wailmer[] = INCBIN_U32("graphics/pokemon/wailmer/back.4bpp.lz"); const u32 gMonBackPic_Wailord[] = INCBIN_U32("graphics/pokemon/wailord/back.4bpp.lz"); const u32 gMonBackPic_Numel[] = INCBIN_U32("graphics/pokemon/numel/back.4bpp.lz"); +const u32 gMonBackPic_NumelF[] = INCBIN_U32("graphics/pokemon/numel/backf.4bpp.lz"); const u32 gMonBackPic_Camerupt[] = INCBIN_U32("graphics/pokemon/camerupt/back.4bpp.lz"); +const u32 gMonBackPic_CameruptF[] = INCBIN_U32("graphics/pokemon/camerupt/backf.4bpp.lz"); const u32 gMonBackPic_Torkoal[] = INCBIN_U32("graphics/pokemon/torkoal/back.4bpp.lz"); const u32 gMonBackPic_Spoink[] = INCBIN_U32("graphics/pokemon/spoink/back.4bpp.lz"); const u32 gMonBackPic_Grumpig[] = INCBIN_U32("graphics/pokemon/grumpig/back.4bpp.lz"); @@ -1564,6 +1700,7 @@ const u32 gMonBackPic_Anorith[] = INCBIN_U32("graphics/pokemon/anorith/back.4bpp const u32 gMonBackPic_Armaldo[] = INCBIN_U32("graphics/pokemon/armaldo/back.4bpp.lz"); const u32 gMonBackPic_Feebas[] = INCBIN_U32("graphics/pokemon/feebas/back.4bpp.lz"); const u32 gMonBackPic_Milotic[] = INCBIN_U32("graphics/pokemon/milotic/back.4bpp.lz"); +const u32 gMonBackPic_MiloticF[] = INCBIN_U32("graphics/pokemon/milotic/backf.4bpp.lz"); const u32 gMonBackPic_Castform[] = INCBIN_U32("graphics/pokemon/castform/back.4bpp.lz"); const u32 gMonBackPic_Kecleon[] = INCBIN_U32("graphics/pokemon/kecleon/back.4bpp.lz"); const u32 gMonBackPic_Shuppet[] = INCBIN_U32("graphics/pokemon/shuppet/back.4bpp.lz"); @@ -1583,6 +1720,7 @@ const u32 gMonBackPic_Clamperl[] = INCBIN_U32("graphics/pokemon/clamperl/back.4b const u32 gMonBackPic_Huntail[] = INCBIN_U32("graphics/pokemon/huntail/back.4bpp.lz"); const u32 gMonBackPic_Gorebyss[] = INCBIN_U32("graphics/pokemon/gorebyss/back.4bpp.lz"); const u32 gMonBackPic_Relicanth[] = INCBIN_U32("graphics/pokemon/relicanth/back.4bpp.lz"); +const u32 gMonBackPic_RelicanthF[] = INCBIN_U32("graphics/pokemon/relicanth/backf.4bpp.lz"); const u32 gMonBackPic_Luvdisc[] = INCBIN_U32("graphics/pokemon/luvdisc/back.4bpp.lz"); const u32 gMonBackPic_Bagon[] = INCBIN_U32("graphics/pokemon/bagon/back.4bpp.lz"); const u32 gMonBackPic_Shelgon[] = INCBIN_U32("graphics/pokemon/shelgon/back.4bpp.lz"); @@ -1625,9 +1763,12 @@ const u32 gMonBackPic_KricketuneF[] = INCBIN_U32("graphics/pokemon/kricketune/ba const u32 gMonBackPic_Shinx[] = INCBIN_U32("graphics/pokemon/shinx/back.4bpp.lz"); const u32 gMonBackPic_ShinxF[] = INCBIN_U32("graphics/pokemon/shinx/backf.4bpp.lz"); const u32 gMonBackPic_Luxio[] = INCBIN_U32("graphics/pokemon/luxio/back.4bpp.lz"); +const u32 gMonBackPic_LuxioF[] = INCBIN_U32("graphics/pokemon/luxio/backf.4bpp.lz"); const u32 gMonBackPic_Luxray[] = INCBIN_U32("graphics/pokemon/luxray/back.4bpp.lz"); +const u32 gMonBackPic_LuxrayF[] = INCBIN_U32("graphics/pokemon/luxray/backf.4bpp.lz"); const u32 gMonBackPic_Budew[] = INCBIN_U32("graphics/pokemon/budew/back.4bpp.lz"); const u32 gMonBackPic_Roserade[] = INCBIN_U32("graphics/pokemon/roserade/back.4bpp.lz"); +const u32 gMonBackPic_RoseradeF[] = INCBIN_U32("graphics/pokemon/roserade/backf.4bpp.lz"); const u32 gMonBackPic_Cranidos[] = INCBIN_U32("graphics/pokemon/cranidos/back.4bpp.lz"); const u32 gMonBackPic_Rampardos[] = INCBIN_U32("graphics/pokemon/rampardos/back.4bpp.lz"); const u32 gMonBackPic_Shieldon[] = INCBIN_U32("graphics/pokemon/shieldon/back.4bpp.lz"); @@ -1639,12 +1780,15 @@ const u32 gMonBackPic_Combee[] = INCBIN_U32("graphics/pokemon/combee/back.4bpp.l const u32 gMonBackPic_Vespiquen[] = INCBIN_U32("graphics/pokemon/vespiquen/back.4bpp.lz"); const u32 gMonBackPic_Pachirisu[] = INCBIN_U32("graphics/pokemon/pachirisu/back.4bpp.lz"); const u32 gMonBackPic_Buizel[] = INCBIN_U32("graphics/pokemon/buizel/back.4bpp.lz"); +const u32 gMonBackPic_BuizelF[] = INCBIN_U32("graphics/pokemon/buizel/backf.4bpp.lz"); const u32 gMonBackPic_Floatzel[] = INCBIN_U32("graphics/pokemon/floatzel/back.4bpp.lz"); +const u32 gMonBackPic_FloatzelF[] = INCBIN_U32("graphics/pokemon/floatzel/backf.4bpp.lz"); const u32 gMonBackPic_Cherubi[] = INCBIN_U32("graphics/pokemon/cherubi/back.4bpp.lz"); -const u32 gMonBackPic_Cherrim[] = INCBIN_U32("graphics/pokemon/cherrim/back.4bpp.lz"); +const u32 gMonBackPic_Cherrim[] = INCBIN_U32("graphics/pokemon/cherrim/normal/back.4bpp.lz"); const u32 gMonBackPic_Shellos[] = INCBIN_U32("graphics/pokemon/shellos/back.4bpp.lz"); const u32 gMonBackPic_Gastrodon[] = INCBIN_U32("graphics/pokemon/gastrodon/back.4bpp.lz"); const u32 gMonBackPic_Ambipom[] = INCBIN_U32("graphics/pokemon/ambipom/back.4bpp.lz"); +const u32 gMonBackPic_AmbipomF[] = INCBIN_U32("graphics/pokemon/ambipom/backf.4bpp.lz"); const u32 gMonBackPic_Drifloon[] = INCBIN_U32("graphics/pokemon/drifloon/back.4bpp.lz"); const u32 gMonBackPic_Drifblim[] = INCBIN_U32("graphics/pokemon/drifblim/back.4bpp.lz"); const u32 gMonBackPic_Buneary[] = INCBIN_U32("graphics/pokemon/buneary/back.4bpp.lz"); @@ -1664,7 +1808,9 @@ const u32 gMonBackPic_Happiny[] = INCBIN_U32("graphics/pokemon/happiny/back.4bpp const u32 gMonBackPic_Chatot[] = INCBIN_U32("graphics/pokemon/chatot/back.4bpp.lz"); const u32 gMonBackPic_Spiritomb[] = INCBIN_U32("graphics/pokemon/spiritomb/back.4bpp.lz"); const u32 gMonBackPic_Gible[] = INCBIN_U32("graphics/pokemon/gible/back.4bpp.lz"); +const u32 gMonBackPic_GibleF[] = INCBIN_U32("graphics/pokemon/gible/backf.4bpp.lz"); const u32 gMonBackPic_Gabite[] = INCBIN_U32("graphics/pokemon/gabite/back.4bpp.lz"); +const u32 gMonBackPic_GabiteF[] = INCBIN_U32("graphics/pokemon/gabite/backf.4bpp.lz"); const u32 gMonBackPic_Garchomp[] = INCBIN_U32("graphics/pokemon/garchomp/back.4bpp.lz"); const u32 gMonBackPic_Munchlax[] = INCBIN_U32("graphics/pokemon/munchlax/back.4bpp.lz"); const u32 gMonBackPic_Riolu[] = INCBIN_U32("graphics/pokemon/riolu/back.4bpp.lz"); @@ -1674,17 +1820,24 @@ const u32 gMonBackPic_Hippowdon[] = INCBIN_U32("graphics/pokemon/hippowdon/back. const u32 gMonBackPic_Skorupi[] = INCBIN_U32("graphics/pokemon/skorupi/back.4bpp.lz"); const u32 gMonBackPic_Drapion[] = INCBIN_U32("graphics/pokemon/drapion/back.4bpp.lz"); const u32 gMonBackPic_Croagunk[] = INCBIN_U32("graphics/pokemon/croagunk/back.4bpp.lz"); +const u32 gMonBackPic_CroagunkF[] = INCBIN_U32("graphics/pokemon/croagunk/backf.4bpp.lz"); const u32 gMonBackPic_Toxicroak[] = INCBIN_U32("graphics/pokemon/toxicroak/back.4bpp.lz"); +const u32 gMonBackPic_ToxicroakF[] = INCBIN_U32("graphics/pokemon/toxicroak/backf.4bpp.lz"); const u32 gMonBackPic_Carnivine[] = INCBIN_U32("graphics/pokemon/carnivine/back.4bpp.lz"); const u32 gMonBackPic_Finneon[] = INCBIN_U32("graphics/pokemon/finneon/back.4bpp.lz"); +const u32 gMonBackPic_FinneonF[] = INCBIN_U32("graphics/pokemon/finneon/backf.4bpp.lz"); const u32 gMonBackPic_Lumineon[] = INCBIN_U32("graphics/pokemon/lumineon/back.4bpp.lz"); +const u32 gMonBackPic_LumineonF[] = INCBIN_U32("graphics/pokemon/lumineon/backf.4bpp.lz"); const u32 gMonBackPic_Mantyke[] = INCBIN_U32("graphics/pokemon/mantyke/back.4bpp.lz"); const u32 gMonBackPic_Snover[] = INCBIN_U32("graphics/pokemon/snover/back.4bpp.lz"); +const u32 gMonBackPic_SnoverF[] = INCBIN_U32("graphics/pokemon/snover/backf.4bpp.lz"); const u32 gMonBackPic_Abomasnow[] = INCBIN_U32("graphics/pokemon/abomasnow/back.4bpp.lz"); const u32 gMonBackPic_Weavile[] = INCBIN_U32("graphics/pokemon/weavile/back.4bpp.lz"); +const u32 gMonBackPic_WeavileF[] = INCBIN_U32("graphics/pokemon/weavile/backf.4bpp.lz"); const u32 gMonBackPic_Magnezone[] = INCBIN_U32("graphics/pokemon/magnezone/back.4bpp.lz"); const u32 gMonBackPic_Lickilicky[] = INCBIN_U32("graphics/pokemon/lickilicky/back.4bpp.lz"); const u32 gMonBackPic_Rhyperior[] = INCBIN_U32("graphics/pokemon/rhyperior/back.4bpp.lz"); +const u32 gMonBackPic_RhyperiorF[] = INCBIN_U32("graphics/pokemon/rhyperior/backf.4bpp.lz"); const u32 gMonBackPic_Tangrowth[] = INCBIN_U32("graphics/pokemon/tangrowth/back.4bpp.lz"); const u32 gMonBackPic_Electivire[] = INCBIN_U32("graphics/pokemon/electivire/back.4bpp.lz"); const u32 gMonBackPic_Magmortar[] = INCBIN_U32("graphics/pokemon/magmortar/back.4bpp.lz"); @@ -2241,6 +2394,7 @@ const u32 gMonBackPic_ElectrodeHisuian[] = INCBIN_U32("graphics/pokemon/electrod const u32 gMonBackPic_TyphlosionHisuian[] = INCBIN_U32("graphics/pokemon/typhlosion/hisuian/back.4bpp.lz"); const u32 gMonBackPic_QwilfishHisuian[] = INCBIN_U32("graphics/pokemon/qwilfish/hisuian/back.4bpp.lz"); const u32 gMonBackPic_SneaselHisuian[] = INCBIN_U32("graphics/pokemon/sneasel/hisuian/back.4bpp.lz"); +const u32 gMonBackPic_SneaselHisuianF[] = INCBIN_U32("graphics/pokemon/sneasel/hisuian/backf.4bpp.lz"); #if P_GEN_5_POKEMON == TRUE const u32 gMonBackPic_SamurottHisuian[] = INCBIN_U32("graphics/pokemon/samurott/hisuian/back.4bpp.lz"); const u32 gMonBackPic_LilligantHisuian[] = INCBIN_U32("graphics/pokemon/lilligant/hisuian/back.4bpp.lz"); @@ -2846,7 +3000,7 @@ const u32 gMonPalette_Pachirisu[] = INCBIN_U32("graphics/pokemon/pachirisu/norma const u32 gMonPalette_Buizel[] = INCBIN_U32("graphics/pokemon/buizel/normal.gbapal.lz"); const u32 gMonPalette_Floatzel[] = INCBIN_U32("graphics/pokemon/floatzel/normal.gbapal.lz"); const u32 gMonPalette_Cherubi[] = INCBIN_U32("graphics/pokemon/cherubi/normal.gbapal.lz"); -const u32 gMonPalette_Cherrim[] = INCBIN_U32("graphics/pokemon/cherrim/normal.gbapal.lz"); +const u32 gMonPalette_Cherrim[] = INCBIN_U32("graphics/pokemon/cherrim/normal/normal.gbapal.lz"); const u32 gMonPalette_Shellos[] = INCBIN_U32("graphics/pokemon/shellos/normal.gbapal.lz"); const u32 gMonPalette_Gastrodon[] = INCBIN_U32("graphics/pokemon/gastrodon/normal.gbapal.lz"); const u32 gMonPalette_Ambipom[] = INCBIN_U32("graphics/pokemon/ambipom/normal.gbapal.lz"); @@ -4079,7 +4233,7 @@ const u32 gMonShinyPalette_Pachirisu[] = INCBIN_U32("graphics/pokemon/pachirisu/ const u32 gMonShinyPalette_Buizel[] = INCBIN_U32("graphics/pokemon/buizel/shiny.gbapal.lz"); const u32 gMonShinyPalette_Floatzel[] = INCBIN_U32("graphics/pokemon/floatzel/shiny.gbapal.lz"); const u32 gMonShinyPalette_Cherubi[] = INCBIN_U32("graphics/pokemon/cherubi/shiny.gbapal.lz"); -const u32 gMonShinyPalette_Cherrim[] = INCBIN_U32("graphics/pokemon/cherrim/shiny.gbapal.lz"); +const u32 gMonShinyPalette_Cherrim[] = INCBIN_U32("graphics/pokemon/cherrim/normal/shiny.gbapal.lz"); const u32 gMonShinyPalette_Shellos[] = INCBIN_U32("graphics/pokemon/shellos/shiny.gbapal.lz"); const u32 gMonShinyPalette_Gastrodon[] = INCBIN_U32("graphics/pokemon/gastrodon/shiny.gbapal.lz"); const u32 gMonShinyPalette_Ambipom[] = INCBIN_U32("graphics/pokemon/ambipom/shiny.gbapal.lz"); diff --git a/src/data/item_icon_table.h b/src/data/item_icon_table.h index 05a87828120d..a0a207be2d76 100644 --- a/src/data/item_icon_table.h +++ b/src/data/item_icon_table.h @@ -804,7 +804,7 @@ const u32 *const gItemIconTable[ITEMS_COUNT + 1][2] = [ITEM_RUBY] = {gItemIcon_Gem, gItemIconPalette_Ruby}, [ITEM_SAPPHIRE] = {gItemIcon_Gem, gItemIconPalette_Sapphire}, [ITEM_ABILITY_SHIELD] = {gItemIcon_AbilityShield, gItemIconPalette_AbilityShield}, - [ITEM_CLEAR_AMULET] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_ClearAmulet, gItemIconPalette_ClearAmulet}, + [ITEM_CLEAR_AMULET] = {gItemIcon_ClearAmulet, gItemIconPalette_ClearAmulet}, [ITEM_PUNCHING_GLOVE] = {gItemIcon_PunchingGlove, gItemIconPalette_PunchingGlove}, [ITEM_COVERT_CLOAK] = {gItemIcon_CovertCloak, gItemIconPalette_CovertCloak}, [ITEM_LOADED_DICE] = {gItemIcon_LoadedDice, gItemIconPalette_LoadedDice}, @@ -819,24 +819,24 @@ const u32 *const gItemIconTable[ITEMS_COUNT + 1][2] = [ITEM_SCROLL_OF_WATERS] = {gItemIcon_ScrollOfWaters, gItemIconPalette_ScrollOfWaters}, [ITEM_TERA_ORB] = {gItemIcon_TeraOrb, gItemIconPalette_TeraOrb}, [ITEM_TINY_BAMBOO_SHOOT] = {gItemIcon_TinyBambooShoot, gItemIconPalette_TinyBambooShoot}, - [ITEM_BUG_TERA_SHARD] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_BugTeraShard, gItemIconPalette_BugTeraShard}, - [ITEM_DARK_TERA_SHARD] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_DarkTeraShard, gItemIconPalette_DarkTeraShard}, - [ITEM_DRAGON_TERA_SHARD] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_DragonTeraShard, gItemIconPalette_DragonTeraShard}, - [ITEM_ELECTRIC_TERA_SHARD] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_ElectricTeraShard, gItemIconPalette_ElectricTeraShard}, - [ITEM_FAIRY_TERA_SHARD] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_FairyTeraShard, gItemIconPalette_FairyTeraShard}, - [ITEM_FIGHTING_TERA_SHARD] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_FightingTeraShard, gItemIconPalette_FightingTeraShard}, - [ITEM_FIRE_TERA_SHARD] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_FireTeraShard, gItemIconPalette_FireTeraShard}, - [ITEM_FLYING_TERA_SHARD] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_FlyingTeraShard, gItemIconPalette_FlyingTeraShard}, - [ITEM_GHOST_TERA_SHARD] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_GhostTeraShard, gItemIconPalette_GhostTeraShard}, - [ITEM_GRASS_TERA_SHARD] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_GrassTeraShard, gItemIconPalette_GrassTeraShard}, - [ITEM_GROUND_TERA_SHARD] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_GroundTeraShard, gItemIconPalette_GroundTeraShard}, - [ITEM_ICE_TERA_SHARD] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_IceTeraShard, gItemIconPalette_IceTeraShard}, - [ITEM_NORMAL_TERA_SHARD] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_NormalTeraShard, gItemIconPalette_NormalTeraShard}, - [ITEM_POISON_TERA_SHARD] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_PoisonTeraShard, gItemIconPalette_PoisonTeraShard}, - [ITEM_PSYCHIC_TERA_SHARD] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_PsychicTeraShard, gItemIconPalette_PsychicTeraShard}, - [ITEM_ROCK_TERA_SHARD] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_RockTeraShard, gItemIconPalette_RockTeraShard}, - [ITEM_STEEL_TERA_SHARD] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_SteelTeraShard, gItemIconPalette_SteelTeraShard}, - [ITEM_WATER_TERA_SHARD] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark}, // {gItemIcon_WaterTeraShard, gItemIconPalette_WaterTeraShard}, + [ITEM_BUG_TERA_SHARD] = {gItemIcon_TeraShard, gItemIconPalette_BugTeraShard}, + [ITEM_DARK_TERA_SHARD] = {gItemIcon_TeraShard, gItemIconPalette_DarkTeraShard}, + [ITEM_DRAGON_TERA_SHARD] = {gItemIcon_TeraShard, gItemIconPalette_DragonTeraShard}, + [ITEM_ELECTRIC_TERA_SHARD] = {gItemIcon_TeraShard, gItemIconPalette_ElectricTeraShard}, + [ITEM_FAIRY_TERA_SHARD] = {gItemIcon_TeraShard, gItemIconPalette_FairyTeraShard}, + [ITEM_FIGHTING_TERA_SHARD] = {gItemIcon_TeraShard, gItemIconPalette_FightingTeraShard}, + [ITEM_FIRE_TERA_SHARD] = {gItemIcon_TeraShard, gItemIconPalette_FireTeraShard}, + [ITEM_FLYING_TERA_SHARD] = {gItemIcon_TeraShard, gItemIconPalette_FlyingTeraShard}, + [ITEM_GHOST_TERA_SHARD] = {gItemIcon_TeraShard, gItemIconPalette_GhostTeraShard}, + [ITEM_GRASS_TERA_SHARD] = {gItemIcon_TeraShard, gItemIconPalette_GrassTeraShard}, + [ITEM_GROUND_TERA_SHARD] = {gItemIcon_TeraShard, gItemIconPalette_GroundTeraShard}, + [ITEM_ICE_TERA_SHARD] = {gItemIcon_TeraShard, gItemIconPalette_IceTeraShard}, + [ITEM_NORMAL_TERA_SHARD] = {gItemIcon_TeraShard, gItemIconPalette_NormalTeraShard}, + [ITEM_POISON_TERA_SHARD] = {gItemIcon_TeraShard, gItemIconPalette_PoisonTeraShard}, + [ITEM_PSYCHIC_TERA_SHARD] = {gItemIcon_TeraShard, gItemIconPalette_PsychicTeraShard}, + [ITEM_ROCK_TERA_SHARD] = {gItemIcon_TeraShard, gItemIconPalette_RockTeraShard}, + [ITEM_STEEL_TERA_SHARD] = {gItemIcon_TeraShard, gItemIconPalette_SteelTeraShard}, + [ITEM_WATER_TERA_SHARD] = {gItemIcon_TeraShard, gItemIconPalette_WaterTeraShard}, [ITEM_ADAMANT_CRYSTAL] = {gItemIcon_AdamantCrystal, gItemIconPalette_AdamantCrystal}, [ITEM_GRISEOUS_CORE] = {gItemIcon_GriseousCore, gItemIconPalette_GriseousCore}, [ITEM_LUSTROUS_GLOBE] = {gItemIcon_LustrousGlobe, gItemIconPalette_LustrousGlobe}, diff --git a/src/data/items.h b/src/data/items.h index 5e15b27344d4..6990e7cdedc0 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -1,3 +1,5 @@ +#include "constants/moves.h" + #if I_USE_EVO_HELD_ITEMS_FROM_BAG == TRUE #define EVO_HELD_ITEM_TYPE ITEM_USE_PARTY_MENU #define EVO_HELD_ITEM_FIELD_FUNC ItemUseOutOfBattle_EvolutionStone @@ -12,12 +14,17 @@ #define GEM_BOOST_PARAM 50 #endif +#if I_TYPE_BOOST_POWER >= GEN_4 // For non Pokémon-specific type-boosting held items. + #define TYPE_BOOST_PARAM 20 +#else + #define TYPE_BOOST_PARAM 10 +#endif + const struct Item gItems[] = { [ITEM_NONE] = { .name = _("????????"), - .itemId = ITEM_NONE, .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, @@ -30,7 +37,6 @@ const struct Item gItems[] = [ITEM_POKE_BALL] = { .name = _("Poké Ball"), - .itemId = ITEM_POKE_BALL, .price = 200, .description = sPokeBallDesc, .pocket = POCKET_POKE_BALLS, @@ -42,7 +48,6 @@ const struct Item gItems[] = [ITEM_GREAT_BALL] = { .name = _("Great Ball"), - .itemId = ITEM_GREAT_BALL, .price = 600, .description = sGreatBallDesc, .pocket = POCKET_POKE_BALLS, @@ -54,7 +59,6 @@ const struct Item gItems[] = [ITEM_ULTRA_BALL] = { .name = _("Ultra Ball"), - .itemId = ITEM_ULTRA_BALL, .price = 800, .description = sUltraBallDesc, .pocket = POCKET_POKE_BALLS, @@ -66,7 +70,6 @@ const struct Item gItems[] = [ITEM_MASTER_BALL] = { .name = _("Master Ball"), - .itemId = ITEM_MASTER_BALL, .price = 0, .description = sMasterBallDesc, .pocket = POCKET_POKE_BALLS, @@ -78,7 +81,6 @@ const struct Item gItems[] = [ITEM_PREMIER_BALL] = { .name = _("Premier Ball"), - .itemId = ITEM_PREMIER_BALL, .price = 20, .description = sPremierBallDesc, .pocket = POCKET_POKE_BALLS, @@ -90,7 +92,6 @@ const struct Item gItems[] = [ITEM_HEAL_BALL] = { .name = _("Heal Ball"), - .itemId = ITEM_HEAL_BALL, .price = 300, .description = sHealBallDesc, .pocket = POCKET_POKE_BALLS, @@ -102,7 +103,6 @@ const struct Item gItems[] = [ITEM_NET_BALL] = { .name = _("Net Ball"), - .itemId = ITEM_NET_BALL, .price = 1000, .description = sNetBallDesc, .pocket = POCKET_POKE_BALLS, @@ -114,7 +114,6 @@ const struct Item gItems[] = [ITEM_NEST_BALL] = { .name = _("Nest Ball"), - .itemId = ITEM_NEST_BALL, .price = 1000, .description = sNestBallDesc, .pocket = POCKET_POKE_BALLS, @@ -126,7 +125,6 @@ const struct Item gItems[] = [ITEM_DIVE_BALL] = { .name = _("Dive Ball"), - .itemId = ITEM_DIVE_BALL, .price = 1000, .description = sDiveBallDesc, .pocket = POCKET_POKE_BALLS, @@ -138,7 +136,6 @@ const struct Item gItems[] = [ITEM_DUSK_BALL] = { .name = _("Dusk Ball"), - .itemId = ITEM_DUSK_BALL, .price = 1000, .description = sDuskBallDesc, .pocket = POCKET_POKE_BALLS, @@ -150,7 +147,6 @@ const struct Item gItems[] = [ITEM_TIMER_BALL] = { .name = _("Timer Ball"), - .itemId = ITEM_TIMER_BALL, .price = 1000, .description = sTimerBallDesc, .pocket = POCKET_POKE_BALLS, @@ -162,7 +158,6 @@ const struct Item gItems[] = [ITEM_QUICK_BALL] = { .name = _("Quick Ball"), - .itemId = ITEM_QUICK_BALL, .price = 1000, .description = sQuickBallDesc, .pocket = POCKET_POKE_BALLS, @@ -174,7 +169,6 @@ const struct Item gItems[] = [ITEM_REPEAT_BALL] = { .name = _("Repeat Ball"), - .itemId = ITEM_REPEAT_BALL, .price = 1000, .description = sRepeatBallDesc, .pocket = POCKET_POKE_BALLS, @@ -186,7 +180,6 @@ const struct Item gItems[] = [ITEM_LUXURY_BALL] = { .name = _("Luxury Ball"), - .itemId = ITEM_LUXURY_BALL, .price = 1000, .description = sLuxuryBallDesc, .pocket = POCKET_POKE_BALLS, @@ -198,7 +191,6 @@ const struct Item gItems[] = [ITEM_LEVEL_BALL] = { .name = _("Level Ball"), - .itemId = ITEM_LEVEL_BALL, .price = 0, .description = sLevelBallDesc, .pocket = POCKET_POKE_BALLS, @@ -210,7 +202,6 @@ const struct Item gItems[] = [ITEM_LURE_BALL] = { .name = _("Lure Ball"), - .itemId = ITEM_LURE_BALL, .price = 0, .description = sLureBallDesc, .pocket = POCKET_POKE_BALLS, @@ -222,7 +213,6 @@ const struct Item gItems[] = [ITEM_MOON_BALL] = { .name = _("Moon Ball"), - .itemId = ITEM_MOON_BALL, .price = 0, .description = sMoonBallDesc, .pocket = POCKET_POKE_BALLS, @@ -234,7 +224,6 @@ const struct Item gItems[] = [ITEM_FRIEND_BALL] = { .name = _("Friend Ball"), - .itemId = ITEM_FRIEND_BALL, .price = 0, .description = sFriendBallDesc, .pocket = POCKET_POKE_BALLS, @@ -246,7 +235,6 @@ const struct Item gItems[] = [ITEM_LOVE_BALL] = { .name = _("Love Ball"), - .itemId = ITEM_LOVE_BALL, .price = 0, .description = sLoveBallDesc, .pocket = POCKET_POKE_BALLS, @@ -258,7 +246,6 @@ const struct Item gItems[] = [ITEM_FAST_BALL] = { .name = _("Fast Ball"), - .itemId = ITEM_FAST_BALL, .price = 0, .description = sFastBallDesc, .pocket = POCKET_POKE_BALLS, @@ -270,7 +257,6 @@ const struct Item gItems[] = [ITEM_HEAVY_BALL] = { .name = _("Heavy Ball"), - .itemId = ITEM_HEAVY_BALL, .price = 0, .description = sHeavyBallDesc, .pocket = POCKET_POKE_BALLS, @@ -282,7 +268,6 @@ const struct Item gItems[] = [ITEM_DREAM_BALL] = { .name = _("Dream Ball"), - .itemId = ITEM_DREAM_BALL, .price = 0, .description = sDreamBallDesc, .pocket = POCKET_POKE_BALLS, @@ -294,7 +279,6 @@ const struct Item gItems[] = [ITEM_SAFARI_BALL] = { .name = _("Safari Ball"), - .itemId = ITEM_SAFARI_BALL, .price = 0, .description = sSafariBallDesc, .pocket = POCKET_POKE_BALLS, @@ -306,7 +290,6 @@ const struct Item gItems[] = [ITEM_SPORT_BALL] = { .name = _("Sport Ball"), - .itemId = ITEM_SPORT_BALL, .price = 0, .description = sSportBallDesc, .pocket = POCKET_POKE_BALLS, @@ -318,7 +301,6 @@ const struct Item gItems[] = [ITEM_PARK_BALL] = { .name = _("Park Ball"), - .itemId = ITEM_PARK_BALL, .price = 0, .description = sParkBallDesc, .pocket = POCKET_POKE_BALLS, @@ -330,7 +312,6 @@ const struct Item gItems[] = [ITEM_BEAST_BALL] = { .name = _("Beast Ball"), - .itemId = ITEM_BEAST_BALL, .price = 0, .description = sBeastBallDesc, .pocket = POCKET_POKE_BALLS, @@ -342,7 +323,6 @@ const struct Item gItems[] = [ITEM_CHERISH_BALL] = { .name = _("Cherish Ball"), - .itemId = ITEM_CHERISH_BALL, .price = 0, .description = sCherishBallDesc, .pocket = POCKET_POKE_BALLS, @@ -356,7 +336,6 @@ const struct Item gItems[] = [ITEM_POTION] = { .name = _("Potion"), - .itemId = ITEM_POTION, .price = 200, .holdEffectParam = 20, .description = sPotionDesc, @@ -370,7 +349,6 @@ const struct Item gItems[] = [ITEM_SUPER_POTION] = { .name = _("Super Potion"), - .itemId = ITEM_SUPER_POTION, .price = 700, .holdEffectParam = 60, .description = sSuperPotionDesc, @@ -384,7 +362,6 @@ const struct Item gItems[] = [ITEM_HYPER_POTION] = { .name = _("Hyper Potion"), - .itemId = ITEM_HYPER_POTION, .price = 1500, .holdEffectParam = 120, .description = sHyperPotionDesc, @@ -398,7 +375,6 @@ const struct Item gItems[] = [ITEM_MAX_POTION] = { .name = _("Max Potion"), - .itemId = ITEM_MAX_POTION, .price = 2500, .holdEffectParam = 255, .description = sMaxPotionDesc, @@ -412,7 +388,6 @@ const struct Item gItems[] = [ITEM_FULL_RESTORE] = { .name = _("Full Restore"), - .itemId = ITEM_FULL_RESTORE, .price = 3000, .holdEffectParam = 255, .description = sFullRestoreDesc, @@ -426,7 +401,6 @@ const struct Item gItems[] = [ITEM_REVIVE] = { .name = _("Revive"), - .itemId = ITEM_REVIVE, .price = 2000, .description = sReviveDesc, .pocket = POCKET_ITEMS, @@ -439,7 +413,6 @@ const struct Item gItems[] = [ITEM_MAX_REVIVE] = { .name = _("Max Revive"), - .itemId = ITEM_MAX_REVIVE, .price = 4000, .description = sMaxReviveDesc, .pocket = POCKET_ITEMS, @@ -452,7 +425,6 @@ const struct Item gItems[] = [ITEM_FRESH_WATER] = { .name = _("Fresh Water"), - .itemId = ITEM_FRESH_WATER, .price = 200, .holdEffectParam = 30, .description = sFreshWaterDesc, @@ -466,7 +438,6 @@ const struct Item gItems[] = [ITEM_SODA_POP] = { .name = _("Soda Pop"), - .itemId = ITEM_SODA_POP, .price = 300, .holdEffectParam = 50, .description = sSodaPopDesc, @@ -480,7 +451,6 @@ const struct Item gItems[] = [ITEM_LEMONADE] = { .name = _("Lemonade"), - .itemId = ITEM_LEMONADE, .price = 400, .holdEffectParam = 70, .description = sLemonadeDesc, @@ -494,7 +464,6 @@ const struct Item gItems[] = [ITEM_MOOMOO_MILK] = { .name = _("Moomoo Milk"), - .itemId = ITEM_MOOMOO_MILK, .price = 600, .holdEffectParam = 100, .description = sMoomooMilkDesc, @@ -508,7 +477,6 @@ const struct Item gItems[] = [ITEM_ENERGY_POWDER] = { .name = _("Energy Powder"), - .itemId = ITEM_ENERGY_POWDER, .price = 500, .description = sEnergyPowderDesc, .pocket = POCKET_ITEMS, @@ -521,7 +489,6 @@ const struct Item gItems[] = [ITEM_ENERGY_ROOT] = { .name = _("Energy Root"), - .itemId = ITEM_ENERGY_ROOT, .price = 1200, .description = sEnergyRootDesc, .pocket = POCKET_ITEMS, @@ -534,7 +501,6 @@ const struct Item gItems[] = [ITEM_HEAL_POWDER] = { .name = _("Heal Powder"), - .itemId = ITEM_HEAL_POWDER, .price = 300, .description = sHealPowderDesc, .pocket = POCKET_ITEMS, @@ -547,7 +513,6 @@ const struct Item gItems[] = [ITEM_REVIVAL_HERB] = { .name = _("Revival Herb"), - .itemId = ITEM_REVIVAL_HERB, .price = 2800, .description = sRevivalHerbDesc, .pocket = POCKET_ITEMS, @@ -560,7 +525,6 @@ const struct Item gItems[] = [ITEM_ANTIDOTE] = { .name = _("Antidote"), - .itemId = ITEM_ANTIDOTE, .price = 200, .description = sAntidoteDesc, .pocket = POCKET_ITEMS, @@ -573,7 +537,6 @@ const struct Item gItems[] = [ITEM_PARALYZE_HEAL] = { .name = _("Paralyze Heal"), - .itemId = ITEM_PARALYZE_HEAL, .price = 300, .description = sParalyzeHealDesc, .pocket = POCKET_ITEMS, @@ -586,7 +549,6 @@ const struct Item gItems[] = [ITEM_BURN_HEAL] = { .name = _("Burn Heal"), - .itemId = ITEM_BURN_HEAL, .price = 300, .description = sBurnHealDesc, .pocket = POCKET_ITEMS, @@ -599,7 +561,6 @@ const struct Item gItems[] = [ITEM_ICE_HEAL] = { .name = _("Ice Heal"), - .itemId = ITEM_ICE_HEAL, .price = 100, .description = sIceHealDesc, .pocket = POCKET_ITEMS, @@ -612,7 +573,6 @@ const struct Item gItems[] = [ITEM_AWAKENING] = { .name = _("Awakening"), - .itemId = ITEM_AWAKENING, .price = 100, .description = sAwakeningDesc, .pocket = POCKET_ITEMS, @@ -625,7 +585,6 @@ const struct Item gItems[] = [ITEM_FULL_HEAL] = { .name = _("Full Heal"), - .itemId = ITEM_FULL_HEAL, .price = 400, .description = sFullHealDesc, .pocket = POCKET_ITEMS, @@ -638,7 +597,6 @@ const struct Item gItems[] = [ITEM_ETHER] = { .name = _("Ether"), - .itemId = ITEM_ETHER, .price = 1200, .holdEffectParam = 10, .description = sEtherDesc, @@ -652,7 +610,6 @@ const struct Item gItems[] = [ITEM_MAX_ETHER] = { .name = _("Max Ether"), - .itemId = ITEM_MAX_ETHER, .price = 2000, .holdEffectParam = 255, .description = sMaxEtherDesc, @@ -666,7 +623,6 @@ const struct Item gItems[] = [ITEM_ELIXIR] = { .name = _("Elixir"), - .itemId = ITEM_ELIXIR, .price = 3000, .holdEffectParam = 10, .description = sElixirDesc, @@ -680,7 +636,6 @@ const struct Item gItems[] = [ITEM_MAX_ELIXIR] = { .name = _("Max Elixir"), - .itemId = ITEM_MAX_ELIXIR, .price = 4500, .holdEffectParam = 255, .description = sMaxElixirDesc, @@ -694,7 +649,6 @@ const struct Item gItems[] = [ITEM_BERRY_JUICE] = { .name = _("Berry Juice"), - .itemId = ITEM_BERRY_JUICE, .price = 200, .holdEffect = HOLD_EFFECT_RESTORE_HP, .holdEffectParam = 20, @@ -709,7 +663,6 @@ const struct Item gItems[] = [ITEM_SACRED_ASH] = { .name = _("Sacred Ash"), - .itemId = ITEM_SACRED_ASH, .price = 50000, .description = sSacredAshDesc, .pocket = POCKET_ITEMS, @@ -721,7 +674,6 @@ const struct Item gItems[] = [ITEM_SWEET_HEART] = { .name = _("Sweet Heart"), - .itemId = ITEM_SWEET_HEART, .price = 3000, .holdEffectParam = 20, .description = sSweetHeartDesc, @@ -735,7 +687,6 @@ const struct Item gItems[] = [ITEM_MAX_HONEY] = { .name = _("Max Honey"), - .itemId = ITEM_MAX_HONEY, .price = 8000, .description = sMaxHoneyDesc, .pocket = POCKET_ITEMS, @@ -750,7 +701,6 @@ const struct Item gItems[] = [ITEM_PEWTER_CRUNCHIES] = { .name = _("PewtrCrnches"), - .itemId = ITEM_PEWTER_CRUNCHIES, .price = 250, .description = sPewterCrunchiesDesc, .pocket = POCKET_ITEMS, @@ -763,7 +713,6 @@ const struct Item gItems[] = [ITEM_RAGE_CANDY_BAR] = { .name = _("RageCandyBar"), - .itemId = ITEM_RAGE_CANDY_BAR, .price = 350, .description = sRageCandyBarDesc, .pocket = POCKET_ITEMS, @@ -776,7 +725,6 @@ const struct Item gItems[] = [ITEM_LAVA_COOKIE] = { .name = _("Lava Cookie"), - .itemId = ITEM_LAVA_COOKIE, .price = 350, .description = sLavaCookieDesc, .pocket = POCKET_ITEMS, @@ -789,7 +737,6 @@ const struct Item gItems[] = [ITEM_OLD_GATEAU] = { .name = _("Old Gateau"), - .itemId = ITEM_OLD_GATEAU, .price = 350, .description = sOldGateauDesc, .pocket = POCKET_ITEMS, @@ -802,7 +749,6 @@ const struct Item gItems[] = [ITEM_CASTELIACONE] = { .name = _("Casteliacone"), - .itemId = ITEM_CASTELIACONE, .price = 350, .description = sCasteliaconeDesc, .pocket = POCKET_ITEMS, @@ -815,7 +761,6 @@ const struct Item gItems[] = [ITEM_LUMIOSE_GALETTE] = { .name = _("LumioseGlete"), - .itemId = ITEM_LUMIOSE_GALETTE, .price = 350, .description = sLumioseGaletteDesc, .pocket = POCKET_ITEMS, @@ -828,7 +773,6 @@ const struct Item gItems[] = [ITEM_SHALOUR_SABLE] = { .name = _("ShalourSable"), - .itemId = ITEM_SHALOUR_SABLE, .price = 350, .description = sShalourSableDesc, .pocket = POCKET_ITEMS, @@ -841,7 +785,6 @@ const struct Item gItems[] = [ITEM_BIG_MALASADA] = { .name = _("Big Malasada"), - .itemId = ITEM_BIG_MALASADA, .price = 350, .description = sBigMalasadaDesc, .pocket = POCKET_ITEMS, @@ -856,7 +799,6 @@ const struct Item gItems[] = [ITEM_HP_UP] = { .name = _("HP Up"), - .itemId = ITEM_HP_UP, .price = 10000, .description = sHPUpDesc, .pocket = POCKET_ITEMS, @@ -868,7 +810,6 @@ const struct Item gItems[] = [ITEM_PROTEIN] = { .name = _("Protein"), - .itemId = ITEM_PROTEIN, .price = 10000, .description = sProteinDesc, .pocket = POCKET_ITEMS, @@ -880,7 +821,6 @@ const struct Item gItems[] = [ITEM_IRON] = { .name = _("Iron"), - .itemId = ITEM_IRON, .price = 10000, .description = sIronDesc, .pocket = POCKET_ITEMS, @@ -892,7 +832,6 @@ const struct Item gItems[] = [ITEM_CALCIUM] = { .name = _("Calcium"), - .itemId = ITEM_CALCIUM, .price = 10000, .description = sCalciumDesc, .pocket = POCKET_ITEMS, @@ -904,7 +843,6 @@ const struct Item gItems[] = [ITEM_ZINC] = { .name = _("Zinc"), - .itemId = ITEM_ZINC, .price = 10000, .description = sZincDesc, .pocket = POCKET_ITEMS, @@ -916,7 +854,6 @@ const struct Item gItems[] = [ITEM_CARBOS] = { .name = _("Carbos"), - .itemId = ITEM_CARBOS, .price = 10000, .description = sCarbosDesc, .pocket = POCKET_ITEMS, @@ -928,7 +865,6 @@ const struct Item gItems[] = [ITEM_PP_UP] = { .name = _("PP Up"), - .itemId = ITEM_PP_UP, .price = 10000, .description = sPPUpDesc, .pocket = POCKET_ITEMS, @@ -940,7 +876,6 @@ const struct Item gItems[] = [ITEM_PP_MAX] = { .name = _("PP Max"), - .itemId = ITEM_PP_MAX, .price = 10000, .description = sPPMaxDesc, .pocket = POCKET_ITEMS, @@ -954,7 +889,6 @@ const struct Item gItems[] = [ITEM_HEALTH_FEATHER] = { .name = _("HealthFeather"), - .itemId = ITEM_HEALTH_FEATHER, .price = 300, .description = sHealthFeatherDesc, .pocket = POCKET_ITEMS, @@ -966,7 +900,6 @@ const struct Item gItems[] = [ITEM_MUSCLE_FEATHER] = { .name = _("MuscleFeather"), - .itemId = ITEM_MUSCLE_FEATHER, .price = 300, .description = sMuscleFeatherDesc, .pocket = POCKET_ITEMS, @@ -978,7 +911,6 @@ const struct Item gItems[] = [ITEM_RESIST_FEATHER] = { .name = _("ResistFeather"), - .itemId = ITEM_RESIST_FEATHER, .price = 300, .description = sResistFeatherDesc, .pocket = POCKET_ITEMS, @@ -990,7 +922,6 @@ const struct Item gItems[] = [ITEM_GENIUS_FEATHER] = { .name = _("GeniusFeather"), - .itemId = ITEM_GENIUS_FEATHER, .price = 300, .description = sGeniusFeatherDesc, .pocket = POCKET_ITEMS, @@ -1002,7 +933,6 @@ const struct Item gItems[] = [ITEM_CLEVER_FEATHER] = { .name = _("CleverFeather"), - .itemId = ITEM_CLEVER_FEATHER, .price = 300, .description = sCleverFeatherDesc, .pocket = POCKET_ITEMS, @@ -1014,7 +944,6 @@ const struct Item gItems[] = [ITEM_SWIFT_FEATHER] = { .name = _("SwiftFeather"), - .itemId = ITEM_SWIFT_FEATHER, .price = 300, .description = sSwiftFeatherDesc, .pocket = POCKET_ITEMS, @@ -1028,7 +957,6 @@ const struct Item gItems[] = [ITEM_ABILITY_CAPSULE] = { .name = _("AbilityCapsle"), - .itemId = ITEM_ABILITY_CAPSULE, .price = 10000, .holdEffectParam = 0, .description = sAbilityCapsuleDesc, @@ -1040,7 +968,6 @@ const struct Item gItems[] = [ITEM_ABILITY_PATCH] = { .name = _("AbilityPatch"), - .itemId = ITEM_ABILITY_PATCH, .price = 0, .holdEffectParam = 0, .description = sAbilityPatchDesc, @@ -1054,7 +981,6 @@ const struct Item gItems[] = [ITEM_LONELY_MINT] = { .name = _("Lonely Mint"), - .itemId = ITEM_LONELY_MINT, .price = 20, .description = sLonelyMintDesc, .pocket = POCKET_ITEMS, @@ -1066,7 +992,6 @@ const struct Item gItems[] = [ITEM_ADAMANT_MINT] = { .name = _("Adamant Mint"), - .itemId = ITEM_ADAMANT_MINT, .price = 20, .description = sAdamantMintDesc, .pocket = POCKET_ITEMS, @@ -1078,7 +1003,6 @@ const struct Item gItems[] = [ITEM_NAUGHTY_MINT] = { .name = _("Naughty Mint"), - .itemId = ITEM_NAUGHTY_MINT, .price = 20, .description = sNaughtyMintDesc, .pocket = POCKET_ITEMS, @@ -1090,7 +1014,6 @@ const struct Item gItems[] = [ITEM_BRAVE_MINT] = { .name = _("Brave Mint"), - .itemId = ITEM_BRAVE_MINT, .price = 20, .description = sBraveMintDesc, .pocket = POCKET_ITEMS, @@ -1102,7 +1025,6 @@ const struct Item gItems[] = [ITEM_BOLD_MINT] = { .name = _("Bold Mint"), - .itemId = ITEM_BOLD_MINT, .price = 20, .description = sBoldMintDesc, .pocket = POCKET_ITEMS, @@ -1114,7 +1036,6 @@ const struct Item gItems[] = [ITEM_IMPISH_MINT] = { .name = _("Impish Mint"), - .itemId = ITEM_IMPISH_MINT, .price = 20, .description = sImpishMintDesc, .pocket = POCKET_ITEMS, @@ -1126,7 +1047,6 @@ const struct Item gItems[] = [ITEM_LAX_MINT] = { .name = _("Lax Mint"), - .itemId = ITEM_LAX_MINT, .price = 20, .description = sLaxMintDesc, .pocket = POCKET_ITEMS, @@ -1138,7 +1058,6 @@ const struct Item gItems[] = [ITEM_RELAXED_MINT] = { .name = _("Relaxed Mint"), - .itemId = ITEM_RELAXED_MINT, .price = 20, .description = sRelaxedMintDesc, .pocket = POCKET_ITEMS, @@ -1150,7 +1069,6 @@ const struct Item gItems[] = [ITEM_MODEST_MINT] = { .name = _("Modest Mint"), - .itemId = ITEM_MODEST_MINT, .price = 20, .description = sModestMintDesc, .pocket = POCKET_ITEMS, @@ -1162,7 +1080,6 @@ const struct Item gItems[] = [ITEM_MILD_MINT] = { .name = _("Mild Mint"), - .itemId = ITEM_MILD_MINT, .price = 20, .description = sMildMintDesc, .pocket = POCKET_ITEMS, @@ -1174,7 +1091,6 @@ const struct Item gItems[] = [ITEM_RASH_MINT] = { .name = _("Rash Mint"), - .itemId = ITEM_RASH_MINT, .price = 20, .description = sRashMintDesc, .pocket = POCKET_ITEMS, @@ -1186,7 +1102,6 @@ const struct Item gItems[] = [ITEM_QUIET_MINT] = { .name = _("Quiet Mint"), - .itemId = ITEM_QUIET_MINT, .price = 20, .description = sQuietMintDesc, .pocket = POCKET_ITEMS, @@ -1198,7 +1113,6 @@ const struct Item gItems[] = [ITEM_CALM_MINT] = { .name = _("Calm Mint"), - .itemId = ITEM_CALM_MINT, .price = 20, .description = sCalmMintDesc, .pocket = POCKET_ITEMS, @@ -1210,7 +1124,6 @@ const struct Item gItems[] = [ITEM_GENTLE_MINT] = { .name = _("Gentle Mint"), - .itemId = ITEM_GENTLE_MINT, .price = 20, .description = sGentleMintDesc, .pocket = POCKET_ITEMS, @@ -1222,7 +1135,6 @@ const struct Item gItems[] = [ITEM_CAREFUL_MINT] = { .name = _("Careful Mint"), - .itemId = ITEM_CAREFUL_MINT, .price = 20, .description = sCarefulMintDesc, .pocket = POCKET_ITEMS, @@ -1234,7 +1146,6 @@ const struct Item gItems[] = [ITEM_SASSY_MINT] = { .name = _("Sassy Mint"), - .itemId = ITEM_SASSY_MINT, .price = 20, .description = sSassyMintDesc, .pocket = POCKET_ITEMS, @@ -1246,7 +1157,6 @@ const struct Item gItems[] = [ITEM_TIMID_MINT] = { .name = _("Timid Mint"), - .itemId = ITEM_TIMID_MINT, .price = 20, .description = sTimidMintDesc, .pocket = POCKET_ITEMS, @@ -1258,7 +1168,6 @@ const struct Item gItems[] = [ITEM_HASTY_MINT] = { .name = _("Hasty Mint"), - .itemId = ITEM_HASTY_MINT, .price = 20, .description = sHastyMintDesc, .pocket = POCKET_ITEMS, @@ -1270,7 +1179,6 @@ const struct Item gItems[] = [ITEM_JOLLY_MINT] = { .name = _("Jolly Mint"), - .itemId = ITEM_JOLLY_MINT, .price = 20, .description = sJollyMintDesc, .pocket = POCKET_ITEMS, @@ -1282,7 +1190,6 @@ const struct Item gItems[] = [ITEM_NAIVE_MINT] = { .name = _("Naive Mint"), - .itemId = ITEM_NAIVE_MINT, .price = 20, .description = sNaiveMintDesc, .pocket = POCKET_ITEMS, @@ -1294,7 +1201,6 @@ const struct Item gItems[] = [ITEM_SERIOUS_MINT] = { .name = _("Serious Mint"), - .itemId = ITEM_SERIOUS_MINT, .price = 20, .description = sSeriousMintDesc, .pocket = POCKET_ITEMS, @@ -1308,7 +1214,6 @@ const struct Item gItems[] = [ITEM_RARE_CANDY] = { .name = _("Rare Candy"), - .itemId = ITEM_RARE_CANDY, .price = 10000, .description = sRareCandyDesc, .pocket = POCKET_ITEMS, @@ -1320,7 +1225,6 @@ const struct Item gItems[] = [ITEM_EXP_CANDY_XS] = { .name = _("Exp.Candy XS"), - .itemId = ITEM_EXP_CANDY_XS, .price = 20, .holdEffectParam = EXP_100, .description = sExpCandyXSDesc, @@ -1333,7 +1237,6 @@ const struct Item gItems[] = [ITEM_EXP_CANDY_S] = { .name = _("Exp.Candy S"), - .itemId = ITEM_EXP_CANDY_S, .price = 240, .holdEffectParam = EXP_800, .description = sExpCandySDesc, @@ -1346,7 +1249,6 @@ const struct Item gItems[] = [ITEM_EXP_CANDY_M] = { .name = _("Exp.Candy M"), - .itemId = ITEM_EXP_CANDY_M, .price = 1000, .holdEffectParam = EXP_3000, .description = sExpCandyMDesc, @@ -1359,7 +1261,6 @@ const struct Item gItems[] = [ITEM_EXP_CANDY_L] = { .name = _("Exp.Candy L"), - .itemId = ITEM_EXP_CANDY_L, .price = 3000, .holdEffectParam = EXP_10000, .description = sExpCandyLDesc, @@ -1372,7 +1273,6 @@ const struct Item gItems[] = [ITEM_EXP_CANDY_XL] = { .name = _("Exp.Candy XL"), - .itemId = ITEM_EXP_CANDY_XL, .price = 10000, .holdEffectParam = EXP_30000, .description = sExpCandyXLDesc, @@ -1385,7 +1285,6 @@ const struct Item gItems[] = [ITEM_DYNAMAX_CANDY] = { .name = _("DynamaxCandy"), - .itemId = ITEM_DYNAMAX_CANDY, .price = 0, .description = sDynamaxCandyDesc, .pocket = POCKET_ITEMS, @@ -1399,7 +1298,6 @@ const struct Item gItems[] = [ITEM_BLUE_FLUTE] = { .name = _("Blue Flute"), - .itemId = ITEM_BLUE_FLUTE, .price = 20, .description = sBlueFluteDesc, .pocket = POCKET_ITEMS, @@ -1412,7 +1310,6 @@ const struct Item gItems[] = [ITEM_YELLOW_FLUTE] = { .name = _("Yellow Flute"), - .itemId = ITEM_YELLOW_FLUTE, .price = 20, .description = sYellowFluteDesc, .pocket = POCKET_ITEMS, @@ -1425,7 +1322,6 @@ const struct Item gItems[] = [ITEM_RED_FLUTE] = { .name = _("Red Flute"), - .itemId = ITEM_RED_FLUTE, .price = 20, .description = sRedFluteDesc, .pocket = POCKET_ITEMS, @@ -1440,7 +1336,6 @@ const struct Item gItems[] = [ITEM_BLACK_FLUTE] = { .name = _("Black Flute"), - .itemId = ITEM_BLACK_FLUTE, .price = 20, .holdEffectParam = 50, .description = sBlackFluteDesc, @@ -1453,7 +1348,6 @@ const struct Item gItems[] = [ITEM_WHITE_FLUTE] = { .name = _("White Flute"), - .itemId = ITEM_WHITE_FLUTE, .price = 20, .holdEffectParam = 150, .description = sWhiteFluteDesc, @@ -1468,7 +1362,6 @@ const struct Item gItems[] = [ITEM_REPEL] = { .name = _("Repel"), - .itemId = ITEM_REPEL, .price = 400, .holdEffectParam = 100, .description = sRepelDesc, @@ -1481,7 +1374,6 @@ const struct Item gItems[] = [ITEM_SUPER_REPEL] = { .name = _("Super Repel"), - .itemId = ITEM_SUPER_REPEL, .price = 700, .holdEffectParam = 200, .description = sSuperRepelDesc, @@ -1494,7 +1386,6 @@ const struct Item gItems[] = [ITEM_MAX_REPEL] = { .name = _("Max Repel"), - .itemId = ITEM_MAX_REPEL, .price = 900, .holdEffectParam = 250, .description = sMaxRepelDesc, @@ -1507,7 +1398,6 @@ const struct Item gItems[] = [ITEM_LURE] = { .name = _("Lure"), - .itemId = ITEM_LURE, .price = 400, .holdEffectParam = 100, .description = sLureDesc, @@ -1521,7 +1411,6 @@ const struct Item gItems[] = [ITEM_SUPER_LURE] = { .name = _("Super Lure"), - .itemId = ITEM_SUPER_LURE, .price = 700, .holdEffectParam = 200, .description = sSuperLureDesc, @@ -1535,7 +1424,6 @@ const struct Item gItems[] = [ITEM_MAX_LURE] = { .name = _("Max Lure"), - .itemId = ITEM_MAX_LURE, .price = 900, .holdEffectParam = 250, .description = sMaxLureDesc, @@ -1549,7 +1437,6 @@ const struct Item gItems[] = [ITEM_ESCAPE_ROPE] = { .name = _("Escape Rope"), - .itemId = ITEM_ESCAPE_ROPE, .description = sEscapeRopeDesc, #if I_KEY_ESCAPE_ROPE >= GEN_8 .price = 0, @@ -1571,7 +1458,6 @@ const struct Item gItems[] = [ITEM_X_ATTACK] = { .name = _("X Attack"), - .itemId = ITEM_X_ATTACK, .price = 1000, .holdEffectParam = X_ITEM_STAGES, .description = sXAttackDesc, @@ -1585,7 +1471,6 @@ const struct Item gItems[] = [ITEM_X_DEFENSE] = { .name = _("X Defense"), - .itemId = ITEM_X_DEFENSE, .price = 2000, .holdEffectParam = X_ITEM_STAGES, .description = sXDefenseDesc, @@ -1599,7 +1484,6 @@ const struct Item gItems[] = [ITEM_X_SP_ATK] = { .name = _("X Sp. Atk"), - .itemId = ITEM_X_SP_ATK, .price = 1000, .holdEffectParam = X_ITEM_STAGES, .description = sXSpAtkDesc, @@ -1613,7 +1497,6 @@ const struct Item gItems[] = [ITEM_X_SP_DEF] = { .name = _("X Sp. Def"), - .itemId = ITEM_X_SP_DEF, .price = 2000, .holdEffectParam = X_ITEM_STAGES, .description = sXSpDefDesc, @@ -1627,7 +1510,6 @@ const struct Item gItems[] = [ITEM_X_SPEED] = { .name = _("X Speed"), - .itemId = ITEM_X_SPEED, .price = 1000, .holdEffectParam = X_ITEM_STAGES, .description = sXSpeedDesc, @@ -1641,7 +1523,6 @@ const struct Item gItems[] = [ITEM_X_ACCURACY] = { .name = _("X Accuracy"), - .itemId = ITEM_X_ACCURACY, .price = 1000, .holdEffectParam = X_ITEM_STAGES, .description = sXAccuracyDesc, @@ -1655,7 +1536,6 @@ const struct Item gItems[] = [ITEM_DIRE_HIT] = { .name = _("Dire Hit"), - .itemId = ITEM_DIRE_HIT, .price = 1000, .description = sDireHitDesc, .pocket = POCKET_ITEMS, @@ -1668,7 +1548,6 @@ const struct Item gItems[] = [ITEM_GUARD_SPEC] = { .name = _("Guard Spec."), - .itemId = ITEM_GUARD_SPEC, .price = 1500, .description = sGuardSpecDesc, .pocket = POCKET_ITEMS, @@ -1681,7 +1560,6 @@ const struct Item gItems[] = [ITEM_POKE_DOLL] = { .name = _("Poké Doll"), - .itemId = ITEM_POKE_DOLL, .price = 100, .description = sPokeDollDesc, .pocket = POCKET_ITEMS, @@ -1694,7 +1572,6 @@ const struct Item gItems[] = [ITEM_FLUFFY_TAIL] = { .name = _("Fluffy Tail"), - .itemId = ITEM_FLUFFY_TAIL, .price = 100, .description = sFluffyTailDesc, .pocket = POCKET_ITEMS, @@ -1707,7 +1584,6 @@ const struct Item gItems[] = [ITEM_POKE_TOY] = { .name = _("Poké Toy"), - .itemId = ITEM_POKE_TOY, .price = 100, .description = sPokeToyDesc, .pocket = POCKET_ITEMS, @@ -1720,7 +1596,6 @@ const struct Item gItems[] = [ITEM_MAX_MUSHROOMS] = { .name = _("MaxMushrooms"), - .itemId = ITEM_MAX_MUSHROOMS, .price = 8000, .description = sMaxMushroomsDesc, .pocket = POCKET_ITEMS, @@ -1737,7 +1612,6 @@ const struct Item gItems[] = [ITEM_BOTTLE_CAP] = { .name = _("Bottle Cap"), - .itemId = ITEM_BOTTLE_CAP, .price = 5000, .description = sBottleCapDesc, .pocket = POCKET_ITEMS, @@ -1749,7 +1623,6 @@ const struct Item gItems[] = [ITEM_GOLD_BOTTLE_CAP] = { .name = _("GoldBottlCap"), - .itemId = ITEM_GOLD_BOTTLE_CAP, .price = 10000, .description = sGoldBottleCapDesc, .pocket = POCKET_ITEMS, @@ -1761,7 +1634,6 @@ const struct Item gItems[] = [ITEM_NUGGET] = { .name = _("Nugget"), - .itemId = ITEM_NUGGET, .price = 10000, .description = sNuggetDesc, .pocket = POCKET_ITEMS, @@ -1773,19 +1645,17 @@ const struct Item gItems[] = [ITEM_BIG_NUGGET] = { .name = _("Big Nugget"), - .itemId = ITEM_BIG_NUGGET, .price = 40000, .description = sBigNuggetDesc, .pocket = POCKET_ITEMS, .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .flingPower = 30, + .flingPower = 130, }, [ITEM_TINY_MUSHROOM] = { .name = _("Tiny Mushroom"), - .itemId = ITEM_TINY_MUSHROOM, .price = 500, .description = sTinyMushroomDesc, .pocket = POCKET_ITEMS, @@ -1797,7 +1667,6 @@ const struct Item gItems[] = [ITEM_BIG_MUSHROOM] = { .name = _("Big Mushroom"), - .itemId = ITEM_BIG_MUSHROOM, .price = 5000, .description = sBigMushroomDesc, .pocket = POCKET_ITEMS, @@ -1809,7 +1678,6 @@ const struct Item gItems[] = [ITEM_BALM_MUSHROOM] = { .name = _("Balm Mushroom"), - .itemId = ITEM_BALM_MUSHROOM, .price = 15000, .description = sBalmMushroomDesc, .pocket = POCKET_ITEMS, @@ -1821,7 +1689,6 @@ const struct Item gItems[] = [ITEM_PEARL] = { .name = _("Pearl"), - .itemId = ITEM_PEARL, .price = 2000, .description = sPearlDesc, .pocket = POCKET_ITEMS, @@ -1833,7 +1700,6 @@ const struct Item gItems[] = [ITEM_BIG_PEARL] = { .name = _("Big Pearl"), - .itemId = ITEM_BIG_PEARL, .price = 8000, .description = sBigPearlDesc, .pocket = POCKET_ITEMS, @@ -1845,7 +1711,6 @@ const struct Item gItems[] = [ITEM_PEARL_STRING] = { .name = _("Pearl String"), - .itemId = ITEM_PEARL_STRING, .price = 20000, .description = sPearlStringDesc, .pocket = POCKET_ITEMS, @@ -1857,7 +1722,6 @@ const struct Item gItems[] = [ITEM_STARDUST] = { .name = _("Stardust"), - .itemId = ITEM_STARDUST, .price = 3000, .description = sStardustDesc, .pocket = POCKET_ITEMS, @@ -1869,7 +1733,6 @@ const struct Item gItems[] = [ITEM_STAR_PIECE] = { .name = _("Star Piece"), - .itemId = ITEM_STAR_PIECE, .price = 12000, .description = sStarPieceDesc, .pocket = POCKET_ITEMS, @@ -1881,7 +1744,6 @@ const struct Item gItems[] = [ITEM_COMET_SHARD] = { .name = _("Comet Shard"), - .itemId = ITEM_COMET_SHARD, .price = 25000, .description = sCometShardDesc, .pocket = POCKET_ITEMS, @@ -1893,7 +1755,6 @@ const struct Item gItems[] = [ITEM_SHOAL_SALT] = { .name = _("Shoal Salt"), - .itemId = ITEM_SHOAL_SALT, .price = 20, .description = sShoalSaltDesc, .pocket = POCKET_ITEMS, @@ -1905,7 +1766,6 @@ const struct Item gItems[] = [ITEM_SHOAL_SHELL] = { .name = _("Shoal Shell"), - .itemId = ITEM_SHOAL_SHELL, .price = 20, .description = sShoalShellDesc, .pocket = POCKET_ITEMS, @@ -1917,7 +1777,6 @@ const struct Item gItems[] = [ITEM_RED_SHARD] = { .name = _("Red Shard"), - .itemId = ITEM_RED_SHARD, .price = 1000, .description = sRedShardDesc, .pocket = POCKET_ITEMS, @@ -1929,7 +1788,6 @@ const struct Item gItems[] = [ITEM_BLUE_SHARD] = { .name = _("Blue Shard"), - .itemId = ITEM_BLUE_SHARD, .price = 1000, .description = sBlueShardDesc, .pocket = POCKET_ITEMS, @@ -1941,7 +1799,6 @@ const struct Item gItems[] = [ITEM_YELLOW_SHARD] = { .name = _("Yellow Shard"), - .itemId = ITEM_YELLOW_SHARD, .price = 1000, .description = sYellowShardDesc, .pocket = POCKET_ITEMS, @@ -1953,7 +1810,6 @@ const struct Item gItems[] = [ITEM_GREEN_SHARD] = { .name = _("Green Shard"), - .itemId = ITEM_GREEN_SHARD, .price = 1000, .description = sGreenShardDesc, .pocket = POCKET_ITEMS, @@ -1965,7 +1821,6 @@ const struct Item gItems[] = [ITEM_HEART_SCALE] = { .name = _("Heart Scale"), - .itemId = ITEM_HEART_SCALE, .price = 100, .description = sHeartScaleDesc, .pocket = POCKET_ITEMS, @@ -1977,7 +1832,6 @@ const struct Item gItems[] = [ITEM_HONEY] = { .name = _("Honey"), - .itemId = ITEM_HONEY, .price = 300, .description = sHoneyDesc, .pocket = POCKET_ITEMS, @@ -1989,7 +1843,6 @@ const struct Item gItems[] = [ITEM_RARE_BONE] = { .name = _("Rare Bone"), - .itemId = ITEM_RARE_BONE, .price = 5000, .description = sRareBoneDesc, .pocket = POCKET_ITEMS, @@ -2001,7 +1854,6 @@ const struct Item gItems[] = [ITEM_ODD_KEYSTONE] = { .name = _("Odd Keystone"), - .itemId = ITEM_ODD_KEYSTONE, .price = 2100, .description = sOddKeystoneDesc, .pocket = POCKET_ITEMS, @@ -2013,7 +1865,6 @@ const struct Item gItems[] = [ITEM_PRETTY_FEATHER] = { .name = _("PrettyFeather"), - .itemId = ITEM_PRETTY_FEATHER, .price = 1000, .description = sPrettyFeatherDesc, .pocket = POCKET_ITEMS, @@ -2025,7 +1876,6 @@ const struct Item gItems[] = [ITEM_RELIC_COPPER] = { .name = _("Relic Copper"), - .itemId = ITEM_RELIC_COPPER, .price = 0, .description = sRelicCopperDesc, .pocket = POCKET_ITEMS, @@ -2037,7 +1887,6 @@ const struct Item gItems[] = [ITEM_RELIC_SILVER] = { .name = _("Relic Silver"), - .itemId = ITEM_RELIC_SILVER, .price = 0, .description = sRelicSilverDesc, .pocket = POCKET_ITEMS, @@ -2049,7 +1898,6 @@ const struct Item gItems[] = [ITEM_RELIC_GOLD] = { .name = _("Relic Gold"), - .itemId = ITEM_RELIC_GOLD, .price = 0, .description = sRelicGoldDesc, .pocket = POCKET_ITEMS, @@ -2061,7 +1909,6 @@ const struct Item gItems[] = [ITEM_RELIC_VASE] = { .name = _("Relic Vase"), - .itemId = ITEM_RELIC_VASE, .price = 0, .description = sRelicVaseDesc, .pocket = POCKET_ITEMS, @@ -2073,7 +1920,6 @@ const struct Item gItems[] = [ITEM_RELIC_BAND] = { .name = _("Relic Band"), - .itemId = ITEM_RELIC_BAND, .price = 0, .description = sRelicBandDesc, .pocket = POCKET_ITEMS, @@ -2085,7 +1931,6 @@ const struct Item gItems[] = [ITEM_RELIC_STATUE] = { .name = _("Relic Statue"), - .itemId = ITEM_RELIC_STATUE, .price = 0, .description = sRelicStatueDesc, .pocket = POCKET_ITEMS, @@ -2097,7 +1942,6 @@ const struct Item gItems[] = [ITEM_RELIC_CROWN] = { .name = _("Relic Crown"), - .itemId = ITEM_RELIC_CROWN, .price = 0, .description = sRelicCrownDesc, .pocket = POCKET_ITEMS, @@ -2109,7 +1953,6 @@ const struct Item gItems[] = [ITEM_STRANGE_SOUVENIR] = { .name = _("StrngeSouvnr"), - .itemId = ITEM_STRANGE_SOUVENIR, .price = 3000, .description = sStrangeSouvenirDesc, .pocket = POCKET_ITEMS, @@ -2123,7 +1966,6 @@ const struct Item gItems[] = [ITEM_HELIX_FOSSIL] = { .name = _("Helix Fossil"), - .itemId = ITEM_HELIX_FOSSIL, .description = sHelixFossilDesc, #if I_KEY_FOSSILS >= GEN_4 .price = 7000, @@ -2141,7 +1983,6 @@ const struct Item gItems[] = [ITEM_DOME_FOSSIL] = { .name = _("Dome Fossil"), - .itemId = ITEM_DOME_FOSSIL, .description = sDomeFossilDesc, #if I_KEY_FOSSILS >= GEN_4 .price = 7000, @@ -2159,7 +2000,6 @@ const struct Item gItems[] = [ITEM_OLD_AMBER] = { .name = _("Old Amber"), - .itemId = ITEM_OLD_AMBER, .description = sOldAmberDesc, #if I_KEY_FOSSILS >= GEN_4 .price = 10000, @@ -2177,7 +2017,6 @@ const struct Item gItems[] = [ITEM_ROOT_FOSSIL] = { .name = _("Root Fossil"), - .itemId = ITEM_ROOT_FOSSIL, .description = sRootFossilDesc, #if I_KEY_FOSSILS >= GEN_4 .price = 7000, @@ -2195,7 +2034,6 @@ const struct Item gItems[] = [ITEM_CLAW_FOSSIL] = { .name = _("Claw Fossil"), - .itemId = ITEM_CLAW_FOSSIL, .description = sClawFossilDesc, #if I_KEY_FOSSILS >= GEN_4 .price = 7000, @@ -2213,7 +2051,6 @@ const struct Item gItems[] = [ITEM_ARMOR_FOSSIL] = { .name = _("Armor Fossil"), - .itemId = ITEM_ARMOR_FOSSIL, .price = 7000, .description = sArmorFossilDesc, .pocket = POCKET_ITEMS, @@ -2225,7 +2062,6 @@ const struct Item gItems[] = [ITEM_SKULL_FOSSIL] = { .name = _("Skull Fossil"), - .itemId = ITEM_SKULL_FOSSIL, .price = 7000, .description = sSkullFossilDesc, .pocket = POCKET_ITEMS, @@ -2237,7 +2073,6 @@ const struct Item gItems[] = [ITEM_COVER_FOSSIL] = { .name = _("Cover Fossil"), - .itemId = ITEM_COVER_FOSSIL, .price = 7000, .description = sCoverFossilDesc, .pocket = POCKET_ITEMS, @@ -2249,7 +2084,6 @@ const struct Item gItems[] = [ITEM_PLUME_FOSSIL] = { .name = _("Plume Fossil"), - .itemId = ITEM_PLUME_FOSSIL, .price = 7000, .description = sPlumeFossilDesc, .pocket = POCKET_ITEMS, @@ -2261,7 +2095,6 @@ const struct Item gItems[] = [ITEM_JAW_FOSSIL] = { .name = _("Jaw Fossil"), - .itemId = ITEM_JAW_FOSSIL, .price = 7000, .description = sJawFossilDesc, .pocket = POCKET_ITEMS, @@ -2273,7 +2106,6 @@ const struct Item gItems[] = [ITEM_SAIL_FOSSIL] = { .name = _("Sail Fossil"), - .itemId = ITEM_SAIL_FOSSIL, .price = 7000, .description = sSailFossilDesc, .pocket = POCKET_ITEMS, @@ -2285,7 +2117,6 @@ const struct Item gItems[] = [ITEM_FOSSILIZED_BIRD] = { .name = _("FosslzedBird"), - .itemId = ITEM_FOSSILIZED_BIRD, .price = 5000, .description = sFossilizedBirdDesc, .pocket = POCKET_ITEMS, @@ -2297,7 +2128,6 @@ const struct Item gItems[] = [ITEM_FOSSILIZED_FISH] = { .name = _("FosslzedFish"), - .itemId = ITEM_FOSSILIZED_FISH, .price = 5000, .description = sFossilizedFishDesc, .pocket = POCKET_ITEMS, @@ -2309,7 +2139,6 @@ const struct Item gItems[] = [ITEM_FOSSILIZED_DRAKE] = { .name = _("FosslzedDrke"), - .itemId = ITEM_FOSSILIZED_DRAKE, .price = 5000, .description = sFossilizedDrakeDesc, .pocket = POCKET_ITEMS, @@ -2321,7 +2150,6 @@ const struct Item gItems[] = [ITEM_FOSSILIZED_DINO] = { .name = _("FosslzedDino"), - .itemId = ITEM_FOSSILIZED_DINO, .price = 5000, .description = sFossilizedDinoDesc, .pocket = POCKET_ITEMS, @@ -2335,7 +2163,6 @@ const struct Item gItems[] = [ITEM_GROWTH_MULCH] = { .name = _("Growth Mulch"), - .itemId = ITEM_GROWTH_MULCH, .price = 200, .description = sGrowthMulchDesc, .pocket = POCKET_ITEMS, @@ -2347,7 +2174,6 @@ const struct Item gItems[] = [ITEM_DAMP_MULCH] = { .name = _("Damp Mulch"), - .itemId = ITEM_DAMP_MULCH, .price = 200, .description = sDampMulchDesc, .pocket = POCKET_ITEMS, @@ -2359,7 +2185,6 @@ const struct Item gItems[] = [ITEM_STABLE_MULCH] = { .name = _("Stable Mulch"), - .itemId = ITEM_STABLE_MULCH, .price = 200, .description = sStableMulchDesc, .pocket = POCKET_ITEMS, @@ -2371,7 +2196,6 @@ const struct Item gItems[] = [ITEM_GOOEY_MULCH] = { .name = _("Gooey Mulch"), - .itemId = ITEM_GOOEY_MULCH, .price = 200, .description = sGooeyMulchDesc, .pocket = POCKET_ITEMS, @@ -2383,7 +2207,6 @@ const struct Item gItems[] = [ITEM_RICH_MULCH] = { .name = _("Rich Mulch"), - .itemId = ITEM_RICH_MULCH, .price = 200, .description = sRichMulchDesc, .pocket = POCKET_ITEMS, @@ -2395,7 +2218,6 @@ const struct Item gItems[] = [ITEM_SURPRISE_MULCH] = { .name = _("SurprseMulch"), - .itemId = ITEM_SURPRISE_MULCH, .price = 200, .description = sSurpriseMulchDesc, .pocket = POCKET_ITEMS, @@ -2407,7 +2229,6 @@ const struct Item gItems[] = [ITEM_BOOST_MULCH] = { .name = _("Boost Mulch"), - .itemId = ITEM_BOOST_MULCH, .price = 200, .description = sBoostMulchDesc, .pocket = POCKET_ITEMS, @@ -2419,7 +2240,6 @@ const struct Item gItems[] = [ITEM_AMAZE_MULCH] = { .name = _("Amaze Mulch"), - .itemId = ITEM_AMAZE_MULCH, .price = 200, .description = sAmazeMulchDesc, .pocket = POCKET_ITEMS, @@ -2433,7 +2253,6 @@ const struct Item gItems[] = [ITEM_RED_APRICORN] = { .name = _("Red Apricorn"), - .itemId = ITEM_RED_APRICORN, .price = 200, .description = sRedApricornDesc, .pocket = POCKET_ITEMS, @@ -2444,7 +2263,6 @@ const struct Item gItems[] = [ITEM_BLUE_APRICORN] = { .name = _("Blue Apricorn"), - .itemId = ITEM_BLUE_APRICORN, .price = 200, .description = sBlueApricornDesc, .pocket = POCKET_ITEMS, @@ -2455,7 +2273,6 @@ const struct Item gItems[] = [ITEM_YELLOW_APRICORN] = { .name = _("YellwApricorn"), - .itemId = ITEM_YELLOW_APRICORN, .price = 200, .description = sYellowApricornDesc, .pocket = POCKET_ITEMS, @@ -2466,7 +2283,6 @@ const struct Item gItems[] = [ITEM_GREEN_APRICORN] = { .name = _("GreenApricorn"), - .itemId = ITEM_GREEN_APRICORN, .price = 200, .description = sGreenApricornDesc, .pocket = POCKET_ITEMS, @@ -2477,7 +2293,6 @@ const struct Item gItems[] = [ITEM_PINK_APRICORN] = { .name = _("Pink Apricorn"), - .itemId = ITEM_PINK_APRICORN, .price = 200, .description = sPinkApricornDesc, .pocket = POCKET_ITEMS, @@ -2488,7 +2303,6 @@ const struct Item gItems[] = [ITEM_WHITE_APRICORN] = { .name = _("WhiteApricorn"), - .itemId = ITEM_WHITE_APRICORN, .price = 200, .description = sWhiteApricornDesc, .pocket = POCKET_ITEMS, @@ -2499,7 +2313,6 @@ const struct Item gItems[] = [ITEM_BLACK_APRICORN] = { .name = _("BlackApricorn"), - .itemId = ITEM_BLACK_APRICORN, .price = 200, .description = sBlackApricornDesc, .pocket = POCKET_ITEMS, @@ -2510,7 +2323,6 @@ const struct Item gItems[] = [ITEM_WISHING_PIECE] = { .name = _("WishingPiece"), - .itemId = ITEM_WISHING_PIECE, .price = 20, .description = sWishingPieceDesc, .pocket = POCKET_ITEMS, @@ -2522,7 +2334,6 @@ const struct Item gItems[] = [ITEM_GALARICA_TWIG] = { .name = _("GalaricaTwig"), - .itemId = ITEM_GALARICA_TWIG, .price = 40, .description = sGalaricaTwigDesc, .pocket = POCKET_ITEMS, @@ -2534,7 +2345,6 @@ const struct Item gItems[] = [ITEM_ARMORITE_ORE] = { .name = _("Armorite Ore"), - .itemId = ITEM_ARMORITE_ORE, .price = 40, .description = sArmoriteOreDesc, .pocket = POCKET_ITEMS, @@ -2546,7 +2356,6 @@ const struct Item gItems[] = [ITEM_DYNITE_ORE] = { .name = _("Dynite Ore"), - .itemId = ITEM_DYNITE_ORE, .price = 20, .description = sDyniteOreDesc, .pocket = POCKET_ITEMS, @@ -2560,7 +2369,6 @@ const struct Item gItems[] = [ITEM_ORANGE_MAIL] = { .name = _("Orange Mail"), - .itemId = ITEM_ORANGE_MAIL, .price = 50, .description = sOrangeMailDesc, .pocket = POCKET_ITEMS, @@ -2572,7 +2380,6 @@ const struct Item gItems[] = [ITEM_HARBOR_MAIL] = { .name = _("Harbor Mail"), - .itemId = ITEM_HARBOR_MAIL, .price = 50, .description = sHarborMailDesc, .pocket = POCKET_ITEMS, @@ -2584,7 +2391,6 @@ const struct Item gItems[] = [ITEM_GLITTER_MAIL] = { .name = _("Glitter Mail"), - .itemId = ITEM_GLITTER_MAIL, .price = 50, .description = sGlitterMailDesc, .pocket = POCKET_ITEMS, @@ -2596,7 +2402,6 @@ const struct Item gItems[] = [ITEM_MECH_MAIL] = { .name = _("Mech Mail"), - .itemId = ITEM_MECH_MAIL, .price = 50, .description = sMechMailDesc, .pocket = POCKET_ITEMS, @@ -2608,7 +2413,6 @@ const struct Item gItems[] = [ITEM_WOOD_MAIL] = { .name = _("Wood Mail"), - .itemId = ITEM_WOOD_MAIL, .price = 50, .description = sWoodMailDesc, .pocket = POCKET_ITEMS, @@ -2620,7 +2424,6 @@ const struct Item gItems[] = [ITEM_WAVE_MAIL] = { .name = _("Wave Mail"), - .itemId = ITEM_WAVE_MAIL, .price = 50, .description = sWaveMailDesc, .pocket = POCKET_ITEMS, @@ -2632,7 +2435,6 @@ const struct Item gItems[] = [ITEM_BEAD_MAIL] = { .name = _("Bead Mail"), - .itemId = ITEM_BEAD_MAIL, .price = 50, .description = sBeadMailDesc, .pocket = POCKET_ITEMS, @@ -2644,7 +2446,6 @@ const struct Item gItems[] = [ITEM_SHADOW_MAIL] = { .name = _("Shadow Mail"), - .itemId = ITEM_SHADOW_MAIL, .price = 50, .description = sShadowMailDesc, .pocket = POCKET_ITEMS, @@ -2656,7 +2457,6 @@ const struct Item gItems[] = [ITEM_TROPIC_MAIL] = { .name = _("Tropic Mail"), - .itemId = ITEM_TROPIC_MAIL, .price = 50, .description = sTropicMailDesc, .pocket = POCKET_ITEMS, @@ -2668,7 +2468,6 @@ const struct Item gItems[] = [ITEM_DREAM_MAIL] = { .name = _("Dream Mail"), - .itemId = ITEM_DREAM_MAIL, .price = 50, .description = sDreamMailDesc, .pocket = POCKET_ITEMS, @@ -2680,7 +2479,6 @@ const struct Item gItems[] = [ITEM_FAB_MAIL] = { .name = _("Fab Mail"), - .itemId = ITEM_FAB_MAIL, .price = 50, .description = sFabMailDesc, .pocket = POCKET_ITEMS, @@ -2692,7 +2490,6 @@ const struct Item gItems[] = [ITEM_RETRO_MAIL] = { .name = _("Retro Mail"), - .itemId = ITEM_RETRO_MAIL, .price = 50, .description = sRetroMailDesc, .pocket = POCKET_ITEMS, @@ -2706,7 +2503,6 @@ const struct Item gItems[] = [ITEM_FIRE_STONE] = { .name = _("Fire Stone"), - .itemId = ITEM_FIRE_STONE, .price = 3000, .description = sFireStoneDesc, .pocket = POCKET_ITEMS, @@ -2718,7 +2514,6 @@ const struct Item gItems[] = [ITEM_WATER_STONE] = { .name = _("Water Stone"), - .itemId = ITEM_WATER_STONE, .price = 3000, .description = sWaterStoneDesc, .pocket = POCKET_ITEMS, @@ -2730,7 +2525,6 @@ const struct Item gItems[] = [ITEM_THUNDER_STONE] = { .name = _("Thunder Stone"), - .itemId = ITEM_THUNDER_STONE, .price = 3000, .description = sThunderStoneDesc, .pocket = POCKET_ITEMS, @@ -2742,7 +2536,6 @@ const struct Item gItems[] = [ITEM_LEAF_STONE] = { .name = _("Leaf Stone"), - .itemId = ITEM_LEAF_STONE, .price = 3000, .description = sLeafStoneDesc, .pocket = POCKET_ITEMS, @@ -2754,7 +2547,6 @@ const struct Item gItems[] = [ITEM_ICE_STONE] = { .name = _("Ice Stone"), - .itemId = ITEM_ICE_STONE, .price = 3000, .description = sIceStoneDesc, .pocket = POCKET_ITEMS, @@ -2766,7 +2558,6 @@ const struct Item gItems[] = [ITEM_SUN_STONE] = { .name = _("Sun Stone"), - .itemId = ITEM_SUN_STONE, .price = 3000, .description = sSunStoneDesc, .pocket = POCKET_ITEMS, @@ -2778,7 +2569,6 @@ const struct Item gItems[] = [ITEM_MOON_STONE] = { .name = _("Moon Stone"), - .itemId = ITEM_MOON_STONE, .price = 3000, .description = sMoonStoneDesc, .pocket = POCKET_ITEMS, @@ -2790,7 +2580,6 @@ const struct Item gItems[] = [ITEM_SHINY_STONE] = { .name = _("Shiny Stone"), - .itemId = ITEM_SHINY_STONE, .price = 3000, .description = sShinyStoneDesc, .pocket = POCKET_ITEMS, @@ -2802,7 +2591,6 @@ const struct Item gItems[] = [ITEM_DUSK_STONE] = { .name = _("Dusk Stone"), - .itemId = ITEM_DUSK_STONE, .price = 3000, .description = sDuskStoneDesc, .pocket = POCKET_ITEMS, @@ -2814,7 +2602,6 @@ const struct Item gItems[] = [ITEM_DAWN_STONE] = { .name = _("Dawn Stone"), - .itemId = ITEM_DAWN_STONE, .price = 3000, .description = sDawnStoneDesc, .pocket = POCKET_ITEMS, @@ -2826,7 +2613,6 @@ const struct Item gItems[] = [ITEM_SWEET_APPLE] = { .name = _("Sweet Apple"), - .itemId = ITEM_SWEET_APPLE, .price = 2200, .description = sSweetAppleDesc, .pocket = POCKET_ITEMS, @@ -2838,7 +2624,6 @@ const struct Item gItems[] = [ITEM_TART_APPLE] = { .name = _("Tart Apple"), - .itemId = ITEM_TART_APPLE, .price = 2200, .description = sTartAppleDesc, .pocket = POCKET_ITEMS, @@ -2850,7 +2635,6 @@ const struct Item gItems[] = [ITEM_CRACKED_POT] = { .name = _("Cracked Pot"), - .itemId = ITEM_CRACKED_POT, .price = 1600, .description = sCrackedPotDesc, .pocket = POCKET_ITEMS, @@ -2862,7 +2646,6 @@ const struct Item gItems[] = [ITEM_CHIPPED_POT] = { .name = _("Chipped Pot"), - .itemId = ITEM_CHIPPED_POT, .price = 38000, .description = sChippedPotDesc, .pocket = POCKET_ITEMS, @@ -2874,7 +2657,6 @@ const struct Item gItems[] = [ITEM_GALARICA_CUFF] = { .name = _("GalaricaCuff"), - .itemId = ITEM_GALARICA_CUFF, .price = 6000, .description = sGalaricaCuffDesc, .pocket = POCKET_ITEMS, @@ -2886,7 +2668,6 @@ const struct Item gItems[] = [ITEM_GALARICA_WREATH] = { .name = _("GalrcaWreath"), - .itemId = ITEM_GALARICA_WREATH, .price = 6000, .description = sGalaricaWreathDesc, .pocket = POCKET_ITEMS, @@ -2898,7 +2679,6 @@ const struct Item gItems[] = [ITEM_DRAGON_SCALE] = { .name = _("Dragon Scale"), - .itemId = ITEM_DRAGON_SCALE, .price = 2000, .holdEffect = HOLD_EFFECT_DRAGON_SCALE, .holdEffectParam = 10, @@ -2912,7 +2692,6 @@ const struct Item gItems[] = [ITEM_UPGRADE] = { .name = _("Upgrade"), - .itemId = ITEM_UPGRADE, .price = 2000, .holdEffect = HOLD_EFFECT_UPGRADE, .description = sUpgradeDesc, @@ -2925,7 +2704,6 @@ const struct Item gItems[] = [ITEM_PROTECTOR] = { .name = _("Protector"), - .itemId = ITEM_PROTECTOR, .price = 2000, .description = sProtectorDesc, .pocket = POCKET_ITEMS, @@ -2937,7 +2715,6 @@ const struct Item gItems[] = [ITEM_ELECTIRIZER] = { .name = _("Electirizer"), - .itemId = ITEM_ELECTIRIZER, .price = 2000, .description = sElectirizerDesc, .pocket = POCKET_ITEMS, @@ -2949,7 +2726,6 @@ const struct Item gItems[] = [ITEM_MAGMARIZER] = { .name = _("Magmarizer"), - .itemId = ITEM_MAGMARIZER, .price = 2000, .description = sMagmarizerDesc, .pocket = POCKET_ITEMS, @@ -2961,7 +2737,6 @@ const struct Item gItems[] = [ITEM_DUBIOUS_DISC] = { .name = _("Dubious Disc"), - .itemId = ITEM_DUBIOUS_DISC, .price = 2000, .description = sDubiousDiscDesc, .pocket = POCKET_ITEMS, @@ -2973,7 +2748,6 @@ const struct Item gItems[] = [ITEM_REAPER_CLOTH] = { .name = _("Reaper Cloth"), - .itemId = ITEM_REAPER_CLOTH, .price = 2000, .description = sReaperClothDesc, .pocket = POCKET_ITEMS, @@ -2985,7 +2759,6 @@ const struct Item gItems[] = [ITEM_PRISM_SCALE] = { .name = _("Prism Scale"), - .itemId = ITEM_PRISM_SCALE, .price = 2000, .description = sPrismScaleDesc, .pocket = POCKET_ITEMS, @@ -2997,7 +2770,6 @@ const struct Item gItems[] = [ITEM_WHIPPED_DREAM] = { .name = _("Whipped Dream"), - .itemId = ITEM_WHIPPED_DREAM, .price = 2000, .description = sWhippedDreamDesc, .pocket = POCKET_ITEMS, @@ -3009,7 +2781,6 @@ const struct Item gItems[] = [ITEM_SACHET] = { .name = _("Sachet"), - .itemId = ITEM_SACHET, .price = 2000, .description = sSachetDesc, .pocket = POCKET_ITEMS, @@ -3021,7 +2792,6 @@ const struct Item gItems[] = [ITEM_OVAL_STONE] = { .name = _("Oval Stone"), - .itemId = ITEM_OVAL_STONE, .price = 2000, .description = sOvalStoneDesc, .pocket = POCKET_ITEMS, @@ -3033,7 +2803,6 @@ const struct Item gItems[] = [ITEM_STRAWBERRY_SWEET] = { .name = _("StrwbrySweet"), - .itemId = ITEM_STRAWBERRY_SWEET, .price = 500, .description = sStrawberrySweetDesc, .pocket = POCKET_ITEMS, @@ -3045,7 +2814,6 @@ const struct Item gItems[] = [ITEM_LOVE_SWEET] = { .name = _("Love Sweet"), - .itemId = ITEM_LOVE_SWEET, .price = 500, .description = sLoveSweetDesc, .pocket = POCKET_ITEMS, @@ -3057,7 +2825,6 @@ const struct Item gItems[] = [ITEM_BERRY_SWEET] = { .name = _("Berry Sweet"), - .itemId = ITEM_BERRY_SWEET, .price = 500, .description = sBerrySweetDesc, .pocket = POCKET_ITEMS, @@ -3069,7 +2836,6 @@ const struct Item gItems[] = [ITEM_CLOVER_SWEET] = { .name = _("Clover Sweet"), - .itemId = ITEM_CLOVER_SWEET, .price = 500, .description = sCloverSweetDesc, .pocket = POCKET_ITEMS, @@ -3081,7 +2847,6 @@ const struct Item gItems[] = [ITEM_FLOWER_SWEET] = { .name = _("Flower Sweet"), - .itemId = ITEM_FLOWER_SWEET, .price = 500, .description = sFlowerSweetDesc, .pocket = POCKET_ITEMS, @@ -3093,7 +2858,6 @@ const struct Item gItems[] = [ITEM_STAR_SWEET] = { .name = _("Star Sweet"), - .itemId = ITEM_STAR_SWEET, .price = 500, .description = sStarSweetDesc, .pocket = POCKET_ITEMS, @@ -3105,7 +2869,6 @@ const struct Item gItems[] = [ITEM_RIBBON_SWEET] = { .name = _("Ribbon Sweet"), - .itemId = ITEM_RIBBON_SWEET, .price = 500, .description = sRibbonSweetDesc, .pocket = POCKET_ITEMS, @@ -3117,7 +2880,6 @@ const struct Item gItems[] = [ITEM_EVERSTONE] = { .name = _("Everstone"), - .itemId = ITEM_EVERSTONE, .price = 3000, .holdEffect = HOLD_EFFECT_PREVENT_EVOLVE, .description = sEverstoneDesc, @@ -3132,7 +2894,6 @@ const struct Item gItems[] = [ITEM_RED_NECTAR] = { .name = _("Red Nectar"), - .itemId = ITEM_RED_NECTAR, .price = 300, .holdEffectParam = 0, .description = sRedNectarDesc, @@ -3145,7 +2906,6 @@ const struct Item gItems[] = [ITEM_YELLOW_NECTAR] = { .name = _("Yellow Nectar"), - .itemId = ITEM_YELLOW_NECTAR, .price = 300, .holdEffectParam = 0, .description = sYellowNectarDesc, @@ -3158,7 +2918,6 @@ const struct Item gItems[] = [ITEM_PINK_NECTAR] = { .name = _("Pink Nectar"), - .itemId = ITEM_PINK_NECTAR, .price = 300, .holdEffectParam = 0, .description = sPinkNectarDesc, @@ -3171,7 +2930,6 @@ const struct Item gItems[] = [ITEM_PURPLE_NECTAR] = { .name = _("Purple Nectar"), - .itemId = ITEM_PURPLE_NECTAR, .price = 300, .holdEffectParam = 0, .description = sPurpleNectarDesc, @@ -3186,7 +2944,6 @@ const struct Item gItems[] = [ITEM_FLAME_PLATE] = { .name = _("Flame Plate"), - .itemId = ITEM_FLAME_PLATE, .price = 1000, .holdEffect = HOLD_EFFECT_PLATE, .holdEffectParam = 20, @@ -3201,7 +2958,6 @@ const struct Item gItems[] = [ITEM_SPLASH_PLATE] = { .name = _("Splash Plate"), - .itemId = ITEM_SPLASH_PLATE, .price = 1000, .holdEffect = HOLD_EFFECT_PLATE, .holdEffectParam = 20, @@ -3216,7 +2972,6 @@ const struct Item gItems[] = [ITEM_ZAP_PLATE] = { .name = _("Zap Plate"), - .itemId = ITEM_ZAP_PLATE, .price = 1000, .holdEffect = HOLD_EFFECT_PLATE, .holdEffectParam = 20, @@ -3231,7 +2986,6 @@ const struct Item gItems[] = [ITEM_MEADOW_PLATE] = { .name = _("Meadow Plate"), - .itemId = ITEM_MEADOW_PLATE, .price = 1000, .holdEffect = HOLD_EFFECT_PLATE, .holdEffectParam = 20, @@ -3246,7 +3000,6 @@ const struct Item gItems[] = [ITEM_ICICLE_PLATE] = { .name = _("Icicle Plate"), - .itemId = ITEM_ICICLE_PLATE, .price = 1000, .holdEffect = HOLD_EFFECT_PLATE, .holdEffectParam = 20, @@ -3261,7 +3014,6 @@ const struct Item gItems[] = [ITEM_FIST_PLATE] = { .name = _("Fist Plate"), - .itemId = ITEM_FIST_PLATE, .price = 1000, .holdEffect = HOLD_EFFECT_PLATE, .holdEffectParam = 20, @@ -3276,7 +3028,6 @@ const struct Item gItems[] = [ITEM_TOXIC_PLATE] = { .name = _("Toxic Plate"), - .itemId = ITEM_TOXIC_PLATE, .price = 1000, .holdEffect = HOLD_EFFECT_PLATE, .holdEffectParam = 20, @@ -3291,7 +3042,6 @@ const struct Item gItems[] = [ITEM_EARTH_PLATE] = { .name = _("Earth Plate"), - .itemId = ITEM_EARTH_PLATE, .price = 1000, .holdEffect = HOLD_EFFECT_PLATE, .holdEffectParam = 20, @@ -3306,7 +3056,6 @@ const struct Item gItems[] = [ITEM_SKY_PLATE] = { .name = _("Sky Plate"), - .itemId = ITEM_SKY_PLATE, .price = 1000, .holdEffect = HOLD_EFFECT_PLATE, .holdEffectParam = 20, @@ -3321,7 +3070,6 @@ const struct Item gItems[] = [ITEM_MIND_PLATE] = { .name = _("Mind Plate"), - .itemId = ITEM_MIND_PLATE, .price = 1000, .holdEffect = HOLD_EFFECT_PLATE, .holdEffectParam = 20, @@ -3336,7 +3084,6 @@ const struct Item gItems[] = [ITEM_INSECT_PLATE] = { .name = _("Insect Plate"), - .itemId = ITEM_INSECT_PLATE, .price = 1000, .holdEffect = HOLD_EFFECT_PLATE, .holdEffectParam = 20, @@ -3351,7 +3098,6 @@ const struct Item gItems[] = [ITEM_STONE_PLATE] = { .name = _("Stone Plate"), - .itemId = ITEM_STONE_PLATE, .price = 1000, .holdEffect = HOLD_EFFECT_PLATE, .holdEffectParam = 20, @@ -3366,7 +3112,6 @@ const struct Item gItems[] = [ITEM_SPOOKY_PLATE] = { .name = _("Spooky Plate"), - .itemId = ITEM_SPOOKY_PLATE, .price = 1000, .holdEffect = HOLD_EFFECT_PLATE, .holdEffectParam = 20, @@ -3381,7 +3126,6 @@ const struct Item gItems[] = [ITEM_DRACO_PLATE] = { .name = _("Draco Plate"), - .itemId = ITEM_DRACO_PLATE, .price = 1000, .holdEffect = HOLD_EFFECT_PLATE, .holdEffectParam = 20, @@ -3396,7 +3140,6 @@ const struct Item gItems[] = [ITEM_DREAD_PLATE] = { .name = _("Dread Plate"), - .itemId = ITEM_DREAD_PLATE, .price = 1000, .holdEffect = HOLD_EFFECT_PLATE, .holdEffectParam = 20, @@ -3411,7 +3154,6 @@ const struct Item gItems[] = [ITEM_IRON_PLATE] = { .name = _("Iron Plate"), - .itemId = ITEM_IRON_PLATE, .price = 1000, .holdEffect = HOLD_EFFECT_PLATE, .holdEffectParam = 20, @@ -3426,7 +3168,6 @@ const struct Item gItems[] = [ITEM_PIXIE_PLATE] = { .name = _("Pixie Plate"), - .itemId = ITEM_PIXIE_PLATE, .price = 1000, .holdEffect = HOLD_EFFECT_PLATE, .holdEffectParam = 20, @@ -3443,7 +3184,6 @@ const struct Item gItems[] = [ITEM_DOUSE_DRIVE] = { .name = _("Douse Drive"), - .itemId = ITEM_DOUSE_DRIVE, .price = 0, .holdEffect = HOLD_EFFECT_DRIVE, .description = sDouseDriveDesc, @@ -3457,7 +3197,6 @@ const struct Item gItems[] = [ITEM_SHOCK_DRIVE] = { .name = _("Shock Drive"), - .itemId = ITEM_SHOCK_DRIVE, .price = 0, .holdEffect = HOLD_EFFECT_DRIVE, .description = sShockDriveDesc, @@ -3471,7 +3210,6 @@ const struct Item gItems[] = [ITEM_BURN_DRIVE] = { .name = _("Burn Drive"), - .itemId = ITEM_BURN_DRIVE, .price = 0, .holdEffect = HOLD_EFFECT_DRIVE, .description = sBurnDriveDesc, @@ -3485,7 +3223,6 @@ const struct Item gItems[] = [ITEM_CHILL_DRIVE] = { .name = _("Chill Drive"), - .itemId = ITEM_CHILL_DRIVE, .price = 0, .holdEffect = HOLD_EFFECT_DRIVE, .description = sChillDriveDesc, @@ -3501,7 +3238,6 @@ const struct Item gItems[] = [ITEM_FIRE_MEMORY] = { .name = _("Fire Memory"), - .itemId = ITEM_FIRE_MEMORY, .price = 1000, .holdEffect = HOLD_EFFECT_MEMORY, .holdEffectParam = 0, @@ -3516,7 +3252,6 @@ const struct Item gItems[] = [ITEM_WATER_MEMORY] = { .name = _("Water Memory"), - .itemId = ITEM_WATER_MEMORY, .price = 1000, .holdEffect = HOLD_EFFECT_MEMORY, .holdEffectParam = 0, @@ -3531,7 +3266,6 @@ const struct Item gItems[] = [ITEM_ELECTRIC_MEMORY] = { .name = _("ElectrcMemory"), - .itemId = ITEM_ELECTRIC_MEMORY, .price = 1000, .holdEffect = HOLD_EFFECT_MEMORY, .holdEffectParam = 0, @@ -3546,7 +3280,6 @@ const struct Item gItems[] = [ITEM_GRASS_MEMORY] = { .name = _("Grass Memory"), - .itemId = ITEM_GRASS_MEMORY, .price = 1000, .holdEffect = HOLD_EFFECT_MEMORY, .holdEffectParam = 0, @@ -3561,7 +3294,6 @@ const struct Item gItems[] = [ITEM_ICE_MEMORY] = { .name = _("Ice Memory"), - .itemId = ITEM_ICE_MEMORY, .price = 1000, .holdEffect = HOLD_EFFECT_MEMORY, .holdEffectParam = 0, @@ -3576,7 +3308,6 @@ const struct Item gItems[] = [ITEM_FIGHTING_MEMORY] = { .name = _("FightngMemory"), - .itemId = ITEM_FIGHTING_MEMORY, .price = 1000, .holdEffect = HOLD_EFFECT_MEMORY, .holdEffectParam = 0, @@ -3591,7 +3322,6 @@ const struct Item gItems[] = [ITEM_POISON_MEMORY] = { .name = _("Poison Memory"), - .itemId = ITEM_POISON_MEMORY, .price = 1000, .holdEffect = HOLD_EFFECT_MEMORY, .holdEffectParam = 0, @@ -3606,7 +3336,6 @@ const struct Item gItems[] = [ITEM_GROUND_MEMORY] = { .name = _("Ground Memory"), - .itemId = ITEM_GROUND_MEMORY, .price = 1000, .holdEffect = HOLD_EFFECT_MEMORY, .holdEffectParam = 0, @@ -3621,7 +3350,6 @@ const struct Item gItems[] = [ITEM_FLYING_MEMORY] = { .name = _("Flying Memory"), - .itemId = ITEM_FLYING_MEMORY, .price = 1000, .holdEffect = HOLD_EFFECT_MEMORY, .holdEffectParam = 0, @@ -3636,7 +3364,6 @@ const struct Item gItems[] = [ITEM_PSYCHIC_MEMORY] = { .name = _("PsychicMemory"), - .itemId = ITEM_PSYCHIC_MEMORY, .price = 1000, .holdEffect = HOLD_EFFECT_MEMORY, .holdEffectParam = 0, @@ -3651,7 +3378,6 @@ const struct Item gItems[] = [ITEM_BUG_MEMORY] = { .name = _("Bug Memory"), - .itemId = ITEM_BUG_MEMORY, .price = 1000, .holdEffect = HOLD_EFFECT_MEMORY, .holdEffectParam = 0, @@ -3666,7 +3392,6 @@ const struct Item gItems[] = [ITEM_ROCK_MEMORY] = { .name = _("Rock Memory"), - .itemId = ITEM_ROCK_MEMORY, .price = 1000, .holdEffect = HOLD_EFFECT_MEMORY, .holdEffectParam = 0, @@ -3681,7 +3406,6 @@ const struct Item gItems[] = [ITEM_GHOST_MEMORY] = { .name = _("Ghost Memory"), - .itemId = ITEM_GHOST_MEMORY, .price = 1000, .holdEffect = HOLD_EFFECT_MEMORY, .holdEffectParam = 0, @@ -3696,7 +3420,6 @@ const struct Item gItems[] = [ITEM_DRAGON_MEMORY] = { .name = _("Dragon Memory"), - .itemId = ITEM_DRAGON_MEMORY, .price = 1000, .holdEffect = HOLD_EFFECT_MEMORY, .holdEffectParam = 0, @@ -3711,7 +3434,6 @@ const struct Item gItems[] = [ITEM_DARK_MEMORY] = { .name = _("Dark Memory"), - .itemId = ITEM_DARK_MEMORY, .price = 1000, .holdEffect = HOLD_EFFECT_MEMORY, .holdEffectParam = 0, @@ -3726,7 +3448,6 @@ const struct Item gItems[] = [ITEM_STEEL_MEMORY] = { .name = _("Steel Memory"), - .itemId = ITEM_STEEL_MEMORY, .price = 1000, .holdEffect = HOLD_EFFECT_MEMORY, .holdEffectParam = 0, @@ -3741,7 +3462,6 @@ const struct Item gItems[] = [ITEM_FAIRY_MEMORY] = { .name = _("Fairy Memory"), - .itemId = ITEM_FAIRY_MEMORY, .price = 1000, .holdEffect = HOLD_EFFECT_MEMORY, .holdEffectParam = 0, @@ -3756,7 +3476,6 @@ const struct Item gItems[] = [ITEM_RUSTED_SWORD] = { .name = _("RustedSword"), - .itemId = ITEM_RUSTED_SWORD, .price = 0, .description = sRustedSwordDesc, .pocket = POCKET_ITEMS, @@ -3767,7 +3486,6 @@ const struct Item gItems[] = [ITEM_RUSTED_SHIELD] = { .name = _("RustedShield"), - .itemId = ITEM_RUSTED_SHIELD, .price = 0, .description = sRustedShieldDesc, .pocket = POCKET_ITEMS, @@ -3780,7 +3498,6 @@ const struct Item gItems[] = [ITEM_RED_ORB] = { .name = _("Red Orb"), - .itemId = ITEM_RED_ORB, .price = 0, .holdEffect = HOLD_EFFECT_PRIMAL_ORB, .description = sRedOrbDesc, @@ -3792,7 +3509,6 @@ const struct Item gItems[] = [ITEM_BLUE_ORB] = { .name = _("Blue Orb"), - .itemId = ITEM_BLUE_ORB, .price = 0, .holdEffect = HOLD_EFFECT_PRIMAL_ORB, .description = sBlueOrbDesc, @@ -3806,7 +3522,6 @@ const struct Item gItems[] = [ITEM_VENUSAURITE] = { .name = _("Venusaurite"), - .itemId = ITEM_VENUSAURITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sVenusauriteDesc, @@ -3819,7 +3534,6 @@ const struct Item gItems[] = [ITEM_CHARIZARDITE_X] = { .name = _("CharizarditeX"), - .itemId = ITEM_CHARIZARDITE_X, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sCharizarditeDesc, @@ -3832,7 +3546,6 @@ const struct Item gItems[] = [ITEM_CHARIZARDITE_Y] = { .name = _("CharizarditeY"), - .itemId = ITEM_CHARIZARDITE_Y, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sCharizarditeDesc, @@ -3845,7 +3558,6 @@ const struct Item gItems[] = [ITEM_BLASTOISINITE] = { .name = _("Blastoisinite"), - .itemId = ITEM_BLASTOISINITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sBlastoisiniteDesc, @@ -3858,7 +3570,6 @@ const struct Item gItems[] = [ITEM_BEEDRILLITE] = { .name = _("Beedrillite"), - .itemId = ITEM_BEEDRILLITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sBeedrilliteDesc, @@ -3871,7 +3582,6 @@ const struct Item gItems[] = [ITEM_PIDGEOTITE] = { .name = _("Pidgeotite"), - .itemId = ITEM_PIDGEOTITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sPidgeotiteDesc, @@ -3884,7 +3594,6 @@ const struct Item gItems[] = [ITEM_ALAKAZITE] = { .name = _("Alakazite"), - .itemId = ITEM_ALAKAZITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sAlakaziteDesc, @@ -3897,7 +3606,6 @@ const struct Item gItems[] = [ITEM_SLOWBRONITE] = { .name = _("Slowbronite"), - .itemId = ITEM_SLOWBRONITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sSlowbroniteDesc, @@ -3910,7 +3618,6 @@ const struct Item gItems[] = [ITEM_GENGARITE] = { .name = _("Gengarite"), - .itemId = ITEM_GENGARITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sGengariteDesc, @@ -3923,7 +3630,6 @@ const struct Item gItems[] = [ITEM_KANGASKHANITE] = { .name = _("Kangaskhanite"), - .itemId = ITEM_KANGASKHANITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sKangaskhaniteDesc, @@ -3936,7 +3642,6 @@ const struct Item gItems[] = [ITEM_PINSIRITE] = { .name = _("Pinsirite"), - .itemId = ITEM_PINSIRITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sPinsiriteDesc, @@ -3949,7 +3654,6 @@ const struct Item gItems[] = [ITEM_GYARADOSITE] = { .name = _("Gyaradosite"), - .itemId = ITEM_GYARADOSITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sGyaradositeDesc, @@ -3962,7 +3666,6 @@ const struct Item gItems[] = [ITEM_AERODACTYLITE] = { .name = _("Aerodactylite"), - .itemId = ITEM_AERODACTYLITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sAerodactyliteDesc, @@ -3975,7 +3678,6 @@ const struct Item gItems[] = [ITEM_MEWTWONITE_X] = { .name = _("Mewtwonite X"), - .itemId = ITEM_MEWTWONITE_X, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sMewtwoniteDesc, @@ -3988,7 +3690,6 @@ const struct Item gItems[] = [ITEM_MEWTWONITE_Y] = { .name = _("Mewtwonite Y"), - .itemId = ITEM_MEWTWONITE_Y, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sMewtwoniteDesc, @@ -4001,7 +3702,6 @@ const struct Item gItems[] = [ITEM_AMPHAROSITE] = { .name = _("Ampharosite"), - .itemId = ITEM_AMPHAROSITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sAmpharositeDesc, @@ -4014,7 +3714,6 @@ const struct Item gItems[] = [ITEM_STEELIXITE] = { .name = _("Steelixite"), - .itemId = ITEM_STEELIXITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sSteelixiteDesc, @@ -4027,7 +3726,6 @@ const struct Item gItems[] = [ITEM_SCIZORITE] = { .name = _("Scizorite"), - .itemId = ITEM_SCIZORITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sScizoriteDesc, @@ -4040,7 +3738,6 @@ const struct Item gItems[] = [ITEM_HERACRONITE] = { .name = _("Heracronite"), - .itemId = ITEM_HERACRONITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sHeracroniteDesc, @@ -4053,7 +3750,6 @@ const struct Item gItems[] = [ITEM_HOUNDOOMINITE] = { .name = _("Houndoominite"), - .itemId = ITEM_HOUNDOOMINITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sHoundoominiteDesc, @@ -4066,7 +3762,6 @@ const struct Item gItems[] = [ITEM_TYRANITARITE] = { .name = _("Tyranitarite"), - .itemId = ITEM_TYRANITARITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sTyranitariteDesc, @@ -4079,7 +3774,6 @@ const struct Item gItems[] = [ITEM_SCEPTILITE] = { .name = _("Sceptilite"), - .itemId = ITEM_SCEPTILITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sSceptiliteDesc, @@ -4092,7 +3786,6 @@ const struct Item gItems[] = [ITEM_BLAZIKENITE] = { .name = _("Blazikenite"), - .itemId = ITEM_BLAZIKENITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sBlazikeniteDesc, @@ -4105,7 +3798,6 @@ const struct Item gItems[] = [ITEM_SWAMPERTITE] = { .name = _("Swampertite"), - .itemId = ITEM_SWAMPERTITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sSwampertiteDesc, @@ -4118,7 +3810,6 @@ const struct Item gItems[] = [ITEM_GARDEVOIRITE] = { .name = _("Gardevoirite"), - .itemId = ITEM_GARDEVOIRITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sGardevoiriteDesc, @@ -4131,7 +3822,6 @@ const struct Item gItems[] = [ITEM_SABLENITE] = { .name = _("Sablenite"), - .itemId = ITEM_SABLENITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sSableniteDesc, @@ -4144,7 +3834,6 @@ const struct Item gItems[] = [ITEM_MAWILITE] = { .name = _("Mawilite"), - .itemId = ITEM_MAWILITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sMawiliteDesc, @@ -4157,7 +3846,6 @@ const struct Item gItems[] = [ITEM_AGGRONITE] = { .name = _("Aggronite"), - .itemId = ITEM_AGGRONITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sAggroniteDesc, @@ -4170,7 +3858,6 @@ const struct Item gItems[] = [ITEM_MEDICHAMITE] = { .name = _("Medichamite"), - .itemId = ITEM_MEDICHAMITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sMedichamiteDesc, @@ -4183,7 +3870,6 @@ const struct Item gItems[] = [ITEM_MANECTITE] = { .name = _("Manectite"), - .itemId = ITEM_MANECTITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sManectiteDesc, @@ -4196,7 +3882,6 @@ const struct Item gItems[] = [ITEM_SHARPEDONITE] = { .name = _("Sharpedonite"), - .itemId = ITEM_SHARPEDONITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sSharpedoniteDesc, @@ -4209,7 +3894,6 @@ const struct Item gItems[] = [ITEM_CAMERUPTITE] = { .name = _("Cameruptite"), - .itemId = ITEM_CAMERUPTITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sCameruptiteDesc, @@ -4222,7 +3906,6 @@ const struct Item gItems[] = [ITEM_ALTARIANITE] = { .name = _("Altarianite"), - .itemId = ITEM_ALTARIANITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sAltarianiteDesc, @@ -4235,7 +3918,6 @@ const struct Item gItems[] = [ITEM_BANETTITE] = { .name = _("Banettite"), - .itemId = ITEM_BANETTITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sBanettiteDesc, @@ -4248,7 +3930,6 @@ const struct Item gItems[] = [ITEM_ABSOLITE] = { .name = _("Absolite"), - .itemId = ITEM_ABSOLITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sAbsoliteDesc, @@ -4261,7 +3942,6 @@ const struct Item gItems[] = [ITEM_GLALITITE] = { .name = _("Glalitite"), - .itemId = ITEM_GLALITITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sGlalititeDesc, @@ -4274,7 +3954,6 @@ const struct Item gItems[] = [ITEM_SALAMENCITE] = { .name = _("Salamencite"), - .itemId = ITEM_SALAMENCITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sSalamenciteDesc, @@ -4287,7 +3966,6 @@ const struct Item gItems[] = [ITEM_METAGROSSITE] = { .name = _("Metagrossite"), - .itemId = ITEM_METAGROSSITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sMetagrossiteDesc, @@ -4300,7 +3978,6 @@ const struct Item gItems[] = [ITEM_LATIASITE] = { .name = _("Latiasite"), - .itemId = ITEM_LATIASITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sLatiasiteDesc, @@ -4313,7 +3990,6 @@ const struct Item gItems[] = [ITEM_LATIOSITE] = { .name = _("Latiosite"), - .itemId = ITEM_LATIOSITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sLatiositeDesc, @@ -4326,7 +4002,6 @@ const struct Item gItems[] = [ITEM_LOPUNNITE] = { .name = _("Lopunnite"), - .itemId = ITEM_LOPUNNITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sLopunniteDesc, @@ -4339,7 +4014,6 @@ const struct Item gItems[] = [ITEM_GARCHOMPITE] = { .name = _("Garchompite"), - .itemId = ITEM_GARCHOMPITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sGarchompiteDesc, @@ -4352,7 +4026,6 @@ const struct Item gItems[] = [ITEM_LUCARIONITE] = { .name = _("Lucarionite"), - .itemId = ITEM_LUCARIONITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sLucarioniteDesc, @@ -4365,7 +4038,6 @@ const struct Item gItems[] = [ITEM_ABOMASITE] = { .name = _("Abomasite"), - .itemId = ITEM_ABOMASITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sAbomasiteDesc, @@ -4378,7 +4050,6 @@ const struct Item gItems[] = [ITEM_GALLADITE] = { .name = _("Galladite"), - .itemId = ITEM_GALLADITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sGalladiteDesc, @@ -4391,7 +4062,6 @@ const struct Item gItems[] = [ITEM_AUDINITE] = { .name = _("Audinite"), - .itemId = ITEM_AUDINITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sAudiniteDesc, @@ -4404,7 +4074,6 @@ const struct Item gItems[] = [ITEM_DIANCITE] = { .name = _("Diancite"), - .itemId = ITEM_DIANCITE, .price = 0, .holdEffect = HOLD_EFFECT_MEGA_STONE, .description = sDianciteDesc, @@ -4419,7 +4088,6 @@ const struct Item gItems[] = [ITEM_NORMAL_GEM] = { .name = _("Normal Gem"), - .itemId = ITEM_NORMAL_GEM, .price = 4000, .holdEffect = HOLD_EFFECT_GEMS, .holdEffectParam = GEM_BOOST_PARAM, @@ -4433,7 +4101,6 @@ const struct Item gItems[] = [ITEM_FIRE_GEM] = { .name = _("Fire Gem"), - .itemId = ITEM_FIRE_GEM, .price = 4000, .holdEffect = HOLD_EFFECT_GEMS, .holdEffectParam = GEM_BOOST_PARAM, @@ -4447,7 +4114,6 @@ const struct Item gItems[] = [ITEM_WATER_GEM] = { .name = _("Water Gem"), - .itemId = ITEM_WATER_GEM, .price = 4000, .holdEffect = HOLD_EFFECT_GEMS, .holdEffectParam = GEM_BOOST_PARAM, @@ -4461,7 +4127,6 @@ const struct Item gItems[] = [ITEM_ELECTRIC_GEM] = { .name = _("Electric Gem"), - .itemId = ITEM_ELECTRIC_GEM, .price = 4000, .holdEffect = HOLD_EFFECT_GEMS, .holdEffectParam = GEM_BOOST_PARAM, @@ -4475,7 +4140,6 @@ const struct Item gItems[] = [ITEM_GRASS_GEM] = { .name = _("Grass Gem"), - .itemId = ITEM_GRASS_GEM, .price = 4000, .holdEffect = HOLD_EFFECT_GEMS, .holdEffectParam = GEM_BOOST_PARAM, @@ -4489,7 +4153,6 @@ const struct Item gItems[] = [ITEM_ICE_GEM] = { .name = _("Ice Gem"), - .itemId = ITEM_ICE_GEM, .price = 4000, .holdEffect = HOLD_EFFECT_GEMS, .holdEffectParam = GEM_BOOST_PARAM, @@ -4503,7 +4166,6 @@ const struct Item gItems[] = [ITEM_FIGHTING_GEM] = { .name = _("Fighting Gem"), - .itemId = ITEM_FIGHTING_GEM, .price = 4000, .holdEffect = HOLD_EFFECT_GEMS, .holdEffectParam = GEM_BOOST_PARAM, @@ -4517,7 +4179,6 @@ const struct Item gItems[] = [ITEM_POISON_GEM] = { .name = _("Poison Gem"), - .itemId = ITEM_POISON_GEM, .price = 4000, .holdEffect = HOLD_EFFECT_GEMS, .holdEffectParam = GEM_BOOST_PARAM, @@ -4531,7 +4192,6 @@ const struct Item gItems[] = [ITEM_GROUND_GEM] = { .name = _("Ground Gem"), - .itemId = ITEM_GROUND_GEM, .price = 4000, .holdEffect = HOLD_EFFECT_GEMS, .holdEffectParam = GEM_BOOST_PARAM, @@ -4545,7 +4205,6 @@ const struct Item gItems[] = [ITEM_FLYING_GEM] = { .name = _("Flying Gem"), - .itemId = ITEM_FLYING_GEM, .price = 4000, .holdEffect = HOLD_EFFECT_GEMS, .holdEffectParam = GEM_BOOST_PARAM, @@ -4559,7 +4218,6 @@ const struct Item gItems[] = [ITEM_PSYCHIC_GEM] = { .name = _("Psychic Gem"), - .itemId = ITEM_PSYCHIC_GEM, .price = 4000, .holdEffect = HOLD_EFFECT_GEMS, .holdEffectParam = GEM_BOOST_PARAM, @@ -4573,7 +4231,6 @@ const struct Item gItems[] = [ITEM_BUG_GEM] = { .name = _("Bug Gem"), - .itemId = ITEM_BUG_GEM, .price = 4000, .holdEffect = HOLD_EFFECT_GEMS, .holdEffectParam = GEM_BOOST_PARAM, @@ -4587,7 +4244,6 @@ const struct Item gItems[] = [ITEM_ROCK_GEM] = { .name = _("Rock Gem"), - .itemId = ITEM_ROCK_GEM, .price = 4000, .holdEffect = HOLD_EFFECT_GEMS, .holdEffectParam = GEM_BOOST_PARAM, @@ -4601,7 +4257,6 @@ const struct Item gItems[] = [ITEM_GHOST_GEM] = { .name = _("Ghost Gem"), - .itemId = ITEM_GHOST_GEM, .price = 4000, .holdEffect = HOLD_EFFECT_GEMS, .holdEffectParam = GEM_BOOST_PARAM, @@ -4615,7 +4270,6 @@ const struct Item gItems[] = [ITEM_DRAGON_GEM] = { .name = _("Dragon Gem"), - .itemId = ITEM_DRAGON_GEM, .price = 4000, .holdEffect = HOLD_EFFECT_GEMS, .holdEffectParam = GEM_BOOST_PARAM, @@ -4629,7 +4283,6 @@ const struct Item gItems[] = [ITEM_DARK_GEM] = { .name = _("Dark Gem"), - .itemId = ITEM_DARK_GEM, .price = 4000, .holdEffect = HOLD_EFFECT_GEMS, .holdEffectParam = GEM_BOOST_PARAM, @@ -4643,7 +4296,6 @@ const struct Item gItems[] = [ITEM_STEEL_GEM] = { .name = _("Steel Gem"), - .itemId = ITEM_STEEL_GEM, .price = 4000, .holdEffect = HOLD_EFFECT_GEMS, .holdEffectParam = GEM_BOOST_PARAM, @@ -4657,7 +4309,6 @@ const struct Item gItems[] = [ITEM_FAIRY_GEM] = { .name = _("Fairy Gem"), - .itemId = ITEM_FAIRY_GEM, .price = 4000, .holdEffect = HOLD_EFFECT_GEMS, .holdEffectParam = GEM_BOOST_PARAM, @@ -4673,7 +4324,6 @@ const struct Item gItems[] = [ITEM_NORMALIUM_Z] = { .name = _("Normalium Z"), - .itemId = ITEM_NORMALIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sNormaliumZDesc, @@ -4686,7 +4336,6 @@ const struct Item gItems[] = [ITEM_FIRIUM_Z] = { .name = _("Firium Z"), - .itemId = ITEM_FIRIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sFiriumZDesc, @@ -4699,7 +4348,6 @@ const struct Item gItems[] = [ITEM_WATERIUM_Z] = { .name = _("Waterium Z"), - .itemId = ITEM_WATERIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sWateriumZDesc, @@ -4712,7 +4360,6 @@ const struct Item gItems[] = [ITEM_ELECTRIUM_Z] = { .name = _("Electrium Z"), - .itemId = ITEM_ELECTRIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sElectriumZDesc, @@ -4725,7 +4372,6 @@ const struct Item gItems[] = [ITEM_GRASSIUM_Z] = { .name = _("Grassium Z"), - .itemId = ITEM_GRASSIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sGrassiumZDesc, @@ -4738,7 +4384,6 @@ const struct Item gItems[] = [ITEM_ICIUM_Z] = { .name = _("Icium Z"), - .itemId = ITEM_ICIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sIciumZDesc, @@ -4751,7 +4396,6 @@ const struct Item gItems[] = [ITEM_FIGHTINIUM_Z] = { .name = _("Fightinium Z"), - .itemId = ITEM_FIGHTINIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sFightiniumZDesc, @@ -4764,7 +4408,6 @@ const struct Item gItems[] = [ITEM_POISONIUM_Z] = { .name = _("Poisonium Z"), - .itemId = ITEM_POISONIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sPoisoniumZDesc, @@ -4777,7 +4420,6 @@ const struct Item gItems[] = [ITEM_GROUNDIUM_Z] = { .name = _("Groundium Z"), - .itemId = ITEM_GROUNDIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sGroundiumZDesc, @@ -4790,7 +4432,6 @@ const struct Item gItems[] = [ITEM_FLYINIUM_Z] = { .name = _("Flyinium Z"), - .itemId = ITEM_FLYINIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sFlyiniumZDesc, @@ -4803,7 +4444,6 @@ const struct Item gItems[] = [ITEM_PSYCHIUM_Z] = { .name = _("Psychium Z"), - .itemId = ITEM_PSYCHIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sPsychiumZDesc, @@ -4816,7 +4456,6 @@ const struct Item gItems[] = [ITEM_BUGINIUM_Z] = { .name = _("Buginium Z"), - .itemId = ITEM_BUGINIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sBuginiumZDesc, @@ -4829,7 +4468,6 @@ const struct Item gItems[] = [ITEM_ROCKIUM_Z] = { .name = _("Rockium Z"), - .itemId = ITEM_ROCKIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sRockiumZDesc, @@ -4842,7 +4480,6 @@ const struct Item gItems[] = [ITEM_GHOSTIUM_Z] = { .name = _("Ghostium Z"), - .itemId = ITEM_GHOSTIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sGhostiumZDesc, @@ -4855,7 +4492,6 @@ const struct Item gItems[] = [ITEM_DRAGONIUM_Z] = { .name = _("Dragonium Z"), - .itemId = ITEM_DRAGONIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sDragoniumZDesc, @@ -4868,7 +4504,6 @@ const struct Item gItems[] = [ITEM_DARKINIUM_Z] = { .name = _("Darkinium Z"), - .itemId = ITEM_DARKINIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sDarkiniumZDesc, @@ -4881,7 +4516,6 @@ const struct Item gItems[] = [ITEM_STEELIUM_Z] = { .name = _("Steelium Z"), - .itemId = ITEM_STEELIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sSteeliumZDesc, @@ -4894,7 +4528,6 @@ const struct Item gItems[] = [ITEM_FAIRIUM_Z] = { .name = _("Fairium Z"), - .itemId = ITEM_FAIRIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sFairiumZDesc, @@ -4907,7 +4540,6 @@ const struct Item gItems[] = [ITEM_PIKANIUM_Z] = { .name = _("Pikanium Z"), - .itemId = ITEM_PIKANIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sPikaniumZDesc, @@ -4920,7 +4552,6 @@ const struct Item gItems[] = [ITEM_EEVIUM_Z] = { .name = _("Eevium Z"), - .itemId = ITEM_EEVIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sEeviumZDesc, @@ -4933,7 +4564,6 @@ const struct Item gItems[] = [ITEM_SNORLIUM_Z] = { .name = _("Snorlium Z"), - .itemId = ITEM_SNORLIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sSnorliumZDesc, @@ -4946,7 +4576,6 @@ const struct Item gItems[] = [ITEM_MEWNIUM_Z] = { .name = _("Mewnium Z"), - .itemId = ITEM_MEWNIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sMewniumZDesc, @@ -4959,7 +4588,6 @@ const struct Item gItems[] = [ITEM_DECIDIUM_Z] = { .name = _("Decidium Z"), - .itemId = ITEM_DECIDIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sDecidiumZDesc, @@ -4972,7 +4600,6 @@ const struct Item gItems[] = [ITEM_INCINIUM_Z] = { .name = _("Incinium Z"), - .itemId = ITEM_INCINIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sInciniumZDesc, @@ -4985,7 +4612,6 @@ const struct Item gItems[] = [ITEM_PRIMARIUM_Z] = { .name = _("Primarium Z"), - .itemId = ITEM_PRIMARIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sPrimariumZDesc, @@ -4998,7 +4624,6 @@ const struct Item gItems[] = [ITEM_LYCANIUM_Z] = { .name = _("Lycanium Z"), - .itemId = ITEM_LYCANIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sLycaniumZDesc, @@ -5011,7 +4636,6 @@ const struct Item gItems[] = [ITEM_MIMIKIUM_Z] = { .name = _("Mimikium Z"), - .itemId = ITEM_MIMIKIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sMimikiumZDesc, @@ -5024,7 +4648,6 @@ const struct Item gItems[] = [ITEM_KOMMONIUM_Z] = { .name = _("Kommonium Z"), - .itemId = ITEM_KOMMONIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sKommoniumZDesc, @@ -5037,7 +4660,6 @@ const struct Item gItems[] = [ITEM_TAPUNIUM_Z] = { .name = _("Tapunium Z"), - .itemId = ITEM_TAPUNIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sTapuniumZDesc, @@ -5050,7 +4672,6 @@ const struct Item gItems[] = [ITEM_SOLGANIUM_Z] = { .name = _("Solganium Z"), - .itemId = ITEM_SOLGANIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sSolganiumZDesc, @@ -5063,7 +4684,6 @@ const struct Item gItems[] = [ITEM_LUNALIUM_Z] = { .name = _("Lunalium Z"), - .itemId = ITEM_LUNALIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sLunaliumZDesc, @@ -5076,7 +4696,6 @@ const struct Item gItems[] = [ITEM_MARSHADIUM_Z] = { .name = _("Marshadium Z"), - .itemId = ITEM_MARSHADIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sMarshadiumZDesc, @@ -5089,7 +4708,6 @@ const struct Item gItems[] = [ITEM_ALORAICHIUM_Z] = { .name = _("Aloraichium Z"), - .itemId = ITEM_ALORAICHIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sAloraichiumZDesc, @@ -5102,7 +4720,6 @@ const struct Item gItems[] = [ITEM_PIKASHUNIUM_Z] = { .name = _("Pikashunium Z"), - .itemId = ITEM_PIKASHUNIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sPikashuniumZDesc, @@ -5115,7 +4732,6 @@ const struct Item gItems[] = [ITEM_ULTRANECROZIUM_Z] = { .name = _("U-Necrozium Z"), - .itemId = ITEM_ULTRANECROZIUM_Z, .price = 0, .holdEffect = HOLD_EFFECT_Z_CRYSTAL, .description = sUltranecroziumZDesc, @@ -5130,7 +4746,6 @@ const struct Item gItems[] = [ITEM_LIGHT_BALL] = { .name = _("Light Ball"), - .itemId = ITEM_LIGHT_BALL, .price = 1000, .holdEffect = HOLD_EFFECT_LIGHT_BALL, .description = sLightBallDesc, @@ -5143,7 +4758,6 @@ const struct Item gItems[] = [ITEM_LEEK] = { .name = _("Leek"), - .itemId = ITEM_LEEK, .price = 1000, .holdEffect = HOLD_EFFECT_LEEK, .description = sLeekDesc, @@ -5156,7 +4770,6 @@ const struct Item gItems[] = [ITEM_THICK_CLUB] = { .name = _("Thick Club"), - .itemId = ITEM_THICK_CLUB, .price = 1000, .holdEffect = HOLD_EFFECT_THICK_CLUB, .description = sThickClubDesc, @@ -5169,7 +4782,6 @@ const struct Item gItems[] = [ITEM_LUCKY_PUNCH] = { .name = _("Lucky Punch"), - .itemId = ITEM_LUCKY_PUNCH, .price = 1000, .holdEffect = HOLD_EFFECT_LUCKY_PUNCH, .description = sLuckyPunchDesc, @@ -5182,7 +4794,6 @@ const struct Item gItems[] = [ITEM_METAL_POWDER] = { .name = _("Metal Powder"), - .itemId = ITEM_METAL_POWDER, .price = 1000, .holdEffect = HOLD_EFFECT_METAL_POWDER, .description = sMetalPowderDesc, @@ -5195,7 +4806,6 @@ const struct Item gItems[] = [ITEM_QUICK_POWDER] = { .name = _("Quick Powder"), - .itemId = ITEM_QUICK_POWDER, .price = 1000, .holdEffect = HOLD_EFFECT_QUICK_POWDER, .description = sQuickPowderDesc, @@ -5208,7 +4818,6 @@ const struct Item gItems[] = [ITEM_DEEP_SEA_SCALE] = { .name = _("DeepSeaScale"), - .itemId = ITEM_DEEP_SEA_SCALE, .price = 2000, .holdEffect = HOLD_EFFECT_DEEP_SEA_SCALE, .description = sDeepSeaScaleDesc, @@ -5221,7 +4830,6 @@ const struct Item gItems[] = [ITEM_DEEP_SEA_TOOTH] = { .name = _("DeepSeaTooth"), - .itemId = ITEM_DEEP_SEA_TOOTH, .price = 2000, .holdEffect = HOLD_EFFECT_DEEP_SEA_TOOTH, .description = sDeepSeaToothDesc, @@ -5234,7 +4842,6 @@ const struct Item gItems[] = [ITEM_SOUL_DEW] = { .name = _("Soul Dew"), - .itemId = ITEM_SOUL_DEW, .price = 0, .holdEffect = HOLD_EFFECT_SOUL_DEW, #if B_SOUL_DEW_BOOST >= GEN_7 @@ -5252,7 +4859,6 @@ const struct Item gItems[] = [ITEM_ADAMANT_ORB] = { .name = _("Adamant Orb"), - .itemId = ITEM_ADAMANT_ORB, .price = 0, .holdEffect = HOLD_EFFECT_ADAMANT_ORB, .holdEffectParam = 20, @@ -5266,7 +4872,6 @@ const struct Item gItems[] = [ITEM_LUSTROUS_ORB] = { .name = _("Lustrous Orb"), - .itemId = ITEM_LUSTROUS_ORB, .price = 0, .holdEffect = HOLD_EFFECT_LUSTROUS_ORB, .holdEffectParam = 20, @@ -5280,7 +4885,6 @@ const struct Item gItems[] = [ITEM_GRISEOUS_ORB] = { .name = _("Griseous Orb"), - .itemId = ITEM_GRISEOUS_ORB, .price = 0, .holdEffect = HOLD_EFFECT_GRISEOUS_ORB, .holdEffectParam = 20, @@ -5296,7 +4900,6 @@ const struct Item gItems[] = [ITEM_SEA_INCENSE] = { .name = _("Sea Incense"), - .itemId = ITEM_SEA_INCENSE, .price = 2000, .holdEffect = HOLD_EFFECT_WATER_POWER, .holdEffectParam = 20, @@ -5310,7 +4913,6 @@ const struct Item gItems[] = [ITEM_LAX_INCENSE] = { .name = _("Lax Incense"), - .itemId = ITEM_LAX_INCENSE, .price = 5000, .holdEffect = HOLD_EFFECT_EVASION_UP, .holdEffectParam = 10, @@ -5324,7 +4926,6 @@ const struct Item gItems[] = [ITEM_ODD_INCENSE] = { .name = _("Odd Incense"), - .itemId = ITEM_ODD_INCENSE, .price = 2000, .holdEffect = HOLD_EFFECT_PSYCHIC_POWER, .holdEffectParam = 20, @@ -5338,7 +4939,6 @@ const struct Item gItems[] = [ITEM_ROCK_INCENSE] = { .name = _("Rock Incense"), - .itemId = ITEM_ROCK_INCENSE, .price = 2000, .holdEffect = HOLD_EFFECT_ROCK_POWER, .holdEffectParam = 20, @@ -5352,7 +4952,6 @@ const struct Item gItems[] = [ITEM_FULL_INCENSE] = { .name = _("Full Incense"), - .itemId = ITEM_FULL_INCENSE, .price = 5000, .holdEffect = HOLD_EFFECT_LAGGING_TAIL, .holdEffectParam = 5, @@ -5366,7 +4965,6 @@ const struct Item gItems[] = [ITEM_WAVE_INCENSE] = { .name = _("Wave Incense"), - .itemId = ITEM_WAVE_INCENSE, .price = 2000, .holdEffect = HOLD_EFFECT_WATER_POWER, .holdEffectParam = 20, @@ -5380,7 +4978,6 @@ const struct Item gItems[] = [ITEM_ROSE_INCENSE] = { .name = _("Rose Incense"), - .itemId = ITEM_ROSE_INCENSE, .price = 2000, .holdEffect = HOLD_EFFECT_GRASS_POWER, .holdEffectParam = 20, @@ -5394,7 +4991,6 @@ const struct Item gItems[] = [ITEM_LUCK_INCENSE] = { .name = _("Luck Incense"), - .itemId = ITEM_LUCK_INCENSE, .price = 11000, .holdEffect = HOLD_EFFECT_DOUBLE_PRIZE, .holdEffectParam = 10, @@ -5408,7 +5004,6 @@ const struct Item gItems[] = [ITEM_PURE_INCENSE] = { .name = _("Pure Incense"), - .itemId = ITEM_PURE_INCENSE, .price = 6000, .holdEffect = HOLD_EFFECT_REPEL, .description = sPureIncenseDesc, @@ -5423,7 +5018,6 @@ const struct Item gItems[] = [ITEM_RED_SCARF] = { .name = _("Red Scarf"), - .itemId = ITEM_RED_SCARF, .price = 100, .description = sRedScarfDesc, .pocket = POCKET_ITEMS, @@ -5435,7 +5029,6 @@ const struct Item gItems[] = [ITEM_BLUE_SCARF] = { .name = _("Blue Scarf"), - .itemId = ITEM_BLUE_SCARF, .price = 100, .description = sBlueScarfDesc, .pocket = POCKET_ITEMS, @@ -5447,7 +5040,6 @@ const struct Item gItems[] = [ITEM_PINK_SCARF] = { .name = _("Pink Scarf"), - .itemId = ITEM_PINK_SCARF, .price = 100, .description = sPinkScarfDesc, .pocket = POCKET_ITEMS, @@ -5459,7 +5051,6 @@ const struct Item gItems[] = [ITEM_GREEN_SCARF] = { .name = _("Green Scarf"), - .itemId = ITEM_GREEN_SCARF, .price = 100, .description = sGreenScarfDesc, .pocket = POCKET_ITEMS, @@ -5471,7 +5062,6 @@ const struct Item gItems[] = [ITEM_YELLOW_SCARF] = { .name = _("Yellow Scarf"), - .itemId = ITEM_YELLOW_SCARF, .price = 100, .description = sYellowScarfDesc, .pocket = POCKET_ITEMS, @@ -5485,7 +5075,6 @@ const struct Item gItems[] = [ITEM_MACHO_BRACE] = { .name = _("Macho Brace"), - .itemId = ITEM_MACHO_BRACE, .price = 3000, .holdEffect = HOLD_EFFECT_MACHO_BRACE, .description = sMachoBraceDesc, @@ -5498,7 +5087,6 @@ const struct Item gItems[] = [ITEM_POWER_WEIGHT] = { .name = _("Power Weight"), - .itemId = ITEM_POWER_WEIGHT, .price = 3000, .holdEffect = HOLD_EFFECT_POWER_ITEM, .holdEffectParam = 8, @@ -5513,7 +5101,6 @@ const struct Item gItems[] = [ITEM_POWER_BRACER] = { .name = _("Power Bracer"), - .itemId = ITEM_POWER_BRACER, .price = 3000, .holdEffect = HOLD_EFFECT_POWER_ITEM, .holdEffectParam = 8, @@ -5528,7 +5115,6 @@ const struct Item gItems[] = [ITEM_POWER_BELT] = { .name = _("Power Belt"), - .itemId = ITEM_POWER_BELT, .price = 3000, .holdEffect = HOLD_EFFECT_POWER_ITEM, .holdEffectParam = 8, @@ -5543,7 +5129,6 @@ const struct Item gItems[] = [ITEM_POWER_LENS] = { .name = _("Power Lens"), - .itemId = ITEM_POWER_LENS, .price = 3000, .holdEffect = HOLD_EFFECT_POWER_ITEM, .holdEffectParam = 8, @@ -5558,7 +5143,6 @@ const struct Item gItems[] = [ITEM_POWER_BAND] = { .name = _("Power Band"), - .itemId = ITEM_POWER_BAND, .price = 3000, .holdEffect = HOLD_EFFECT_POWER_ITEM, .holdEffectParam = 8, @@ -5573,7 +5157,6 @@ const struct Item gItems[] = [ITEM_POWER_ANKLET] = { .name = _("Power Anklet"), - .itemId = ITEM_POWER_ANKLET, .price = 3000, .holdEffect = HOLD_EFFECT_POWER_ITEM, .holdEffectParam = 8, @@ -5590,10 +5173,9 @@ const struct Item gItems[] = [ITEM_SILK_SCARF] = { .name = _("Silk Scarf"), - .itemId = ITEM_SILK_SCARF, .price = 1000, .holdEffect = HOLD_EFFECT_NORMAL_POWER, - .holdEffectParam = 20, + .holdEffectParam = TYPE_BOOST_PARAM, .description = sSilkScarfDesc, .pocket = POCKET_ITEMS, .type = ITEM_USE_BAG_MENU, @@ -5604,10 +5186,9 @@ const struct Item gItems[] = [ITEM_CHARCOAL] = { .name = _("Charcoal"), - .itemId = ITEM_CHARCOAL, .price = 1000, .holdEffect = HOLD_EFFECT_FIRE_POWER, - .holdEffectParam = 20, + .holdEffectParam = TYPE_BOOST_PARAM, .description = sCharcoalDesc, .pocket = POCKET_ITEMS, .type = ITEM_USE_BAG_MENU, @@ -5618,10 +5199,9 @@ const struct Item gItems[] = [ITEM_MYSTIC_WATER] = { .name = _("Mystic Water"), - .itemId = ITEM_MYSTIC_WATER, .price = 1000, .holdEffect = HOLD_EFFECT_WATER_POWER, - .holdEffectParam = 20, + .holdEffectParam = TYPE_BOOST_PARAM, .description = sMysticWaterDesc, .pocket = POCKET_ITEMS, .type = ITEM_USE_BAG_MENU, @@ -5632,10 +5212,9 @@ const struct Item gItems[] = [ITEM_MAGNET] = { .name = _("Magnet"), - .itemId = ITEM_MAGNET, .price = 1000, .holdEffect = HOLD_EFFECT_ELECTRIC_POWER, - .holdEffectParam = 20, + .holdEffectParam = TYPE_BOOST_PARAM, .description = sMagnetDesc, .pocket = POCKET_ITEMS, .type = ITEM_USE_BAG_MENU, @@ -5646,10 +5225,9 @@ const struct Item gItems[] = [ITEM_MIRACLE_SEED] = { .name = _("Miracle Seed"), - .itemId = ITEM_MIRACLE_SEED, .price = 1000, .holdEffect = HOLD_EFFECT_GRASS_POWER, - .holdEffectParam = 20, + .holdEffectParam = TYPE_BOOST_PARAM, .description = sMiracleSeedDesc, .pocket = POCKET_ITEMS, .type = ITEM_USE_BAG_MENU, @@ -5660,10 +5238,9 @@ const struct Item gItems[] = [ITEM_NEVER_MELT_ICE] = { .name = _("Never-MeltIce"), - .itemId = ITEM_NEVER_MELT_ICE, .price = 1000, .holdEffect = HOLD_EFFECT_ICE_POWER, - .holdEffectParam = 20, + .holdEffectParam = TYPE_BOOST_PARAM, .description = sNeverMeltIceDesc, .pocket = POCKET_ITEMS, .type = ITEM_USE_BAG_MENU, @@ -5674,10 +5251,9 @@ const struct Item gItems[] = [ITEM_BLACK_BELT] = { .name = _("Black Belt"), - .itemId = ITEM_BLACK_BELT, .price = 1000, .holdEffect = HOLD_EFFECT_FIGHTING_POWER, - .holdEffectParam = 20, + .holdEffectParam = TYPE_BOOST_PARAM, .description = sBlackBeltDesc, .pocket = POCKET_ITEMS, .type = ITEM_USE_BAG_MENU, @@ -5688,10 +5264,9 @@ const struct Item gItems[] = [ITEM_POISON_BARB] = { .name = _("Poison Barb"), - .itemId = ITEM_POISON_BARB, .price = 1000, .holdEffect = HOLD_EFFECT_POISON_POWER, - .holdEffectParam = 20, + .holdEffectParam = TYPE_BOOST_PARAM, .description = sPoisonBarbDesc, .pocket = POCKET_ITEMS, .type = ITEM_USE_BAG_MENU, @@ -5702,10 +5277,9 @@ const struct Item gItems[] = [ITEM_SOFT_SAND] = { .name = _("Soft Sand"), - .itemId = ITEM_SOFT_SAND, .price = 1000, .holdEffect = HOLD_EFFECT_GROUND_POWER, - .holdEffectParam = 20, + .holdEffectParam = TYPE_BOOST_PARAM, .description = sSoftSandDesc, .pocket = POCKET_ITEMS, .type = ITEM_USE_BAG_MENU, @@ -5716,10 +5290,9 @@ const struct Item gItems[] = [ITEM_SHARP_BEAK] = { .name = _("Sharp Beak"), - .itemId = ITEM_SHARP_BEAK, .price = 1000, .holdEffect = HOLD_EFFECT_FLYING_POWER, - .holdEffectParam = 20, + .holdEffectParam = TYPE_BOOST_PARAM, .description = sSharpBeakDesc, .pocket = POCKET_ITEMS, .type = ITEM_USE_BAG_MENU, @@ -5730,10 +5303,9 @@ const struct Item gItems[] = [ITEM_TWISTED_SPOON] = { .name = _("Twisted Spoon"), - .itemId = ITEM_TWISTED_SPOON, .price = 1000, .holdEffect = HOLD_EFFECT_PSYCHIC_POWER, - .holdEffectParam = 20, + .holdEffectParam = TYPE_BOOST_PARAM, .description = sTwistedSpoonDesc, .pocket = POCKET_ITEMS, .type = ITEM_USE_BAG_MENU, @@ -5744,10 +5316,9 @@ const struct Item gItems[] = [ITEM_SILVER_POWDER] = { .name = _("Silver Powder"), - .itemId = ITEM_SILVER_POWDER, .price = 1000, .holdEffect = HOLD_EFFECT_BUG_POWER, - .holdEffectParam = 20, + .holdEffectParam = TYPE_BOOST_PARAM, .description = sSilverPowderDesc, .pocket = POCKET_ITEMS, .type = ITEM_USE_BAG_MENU, @@ -5758,10 +5329,9 @@ const struct Item gItems[] = [ITEM_HARD_STONE] = { .name = _("Hard Stone"), - .itemId = ITEM_HARD_STONE, .price = 1000, .holdEffect = HOLD_EFFECT_ROCK_POWER, - .holdEffectParam = 20, + .holdEffectParam = TYPE_BOOST_PARAM, .description = sHardStoneDesc, .pocket = POCKET_ITEMS, .type = ITEM_USE_BAG_MENU, @@ -5772,10 +5342,9 @@ const struct Item gItems[] = [ITEM_SPELL_TAG] = { .name = _("Spell Tag"), - .itemId = ITEM_SPELL_TAG, .price = 1000, .holdEffect = HOLD_EFFECT_GHOST_POWER, - .holdEffectParam = 20, + .holdEffectParam = TYPE_BOOST_PARAM, .description = sSpellTagDesc, .pocket = POCKET_ITEMS, .type = ITEM_USE_BAG_MENU, @@ -5786,10 +5355,9 @@ const struct Item gItems[] = [ITEM_DRAGON_FANG] = { .name = _("Dragon Fang"), - .itemId = ITEM_DRAGON_FANG, .price = 1000, .holdEffect = HOLD_EFFECT_DRAGON_POWER, - .holdEffectParam = 20, + .holdEffectParam = TYPE_BOOST_PARAM, .description = sDragonFangDesc, .pocket = POCKET_ITEMS, .type = ITEM_USE_BAG_MENU, @@ -5800,10 +5368,9 @@ const struct Item gItems[] = [ITEM_BLACK_GLASSES] = { .name = _("Black Glasses"), - .itemId = ITEM_BLACK_GLASSES, .price = 1000, .holdEffect = HOLD_EFFECT_DARK_POWER, - .holdEffectParam = 20, + .holdEffectParam = TYPE_BOOST_PARAM, .description = sBlackGlassesDesc, .pocket = POCKET_ITEMS, .type = ITEM_USE_BAG_MENU, @@ -5814,10 +5381,9 @@ const struct Item gItems[] = [ITEM_METAL_COAT] = { .name = _("Metal Coat"), - .itemId = ITEM_METAL_COAT, .price = 2000, .holdEffect = HOLD_EFFECT_STEEL_POWER, - .holdEffectParam = 20, + .holdEffectParam = TYPE_BOOST_PARAM, .description = sMetalCoatDesc, .pocket = POCKET_ITEMS, .type = EVO_HELD_ITEM_TYPE, @@ -5830,7 +5396,6 @@ const struct Item gItems[] = [ITEM_CHOICE_BAND] = { .name = _("Choice Band"), - .itemId = ITEM_CHOICE_BAND, .price = 4000, .holdEffect = HOLD_EFFECT_CHOICE_BAND, .description = sChoiceBandDesc, @@ -5843,7 +5408,6 @@ const struct Item gItems[] = [ITEM_CHOICE_SPECS] = { .name = _("Choice Specs"), - .itemId = ITEM_CHOICE_SPECS, .price = 4000, .holdEffect = HOLD_EFFECT_CHOICE_SPECS, .description = sChoiceSpecsDesc, @@ -5856,7 +5420,6 @@ const struct Item gItems[] = [ITEM_CHOICE_SCARF] = { .name = _("Choice Scarf"), - .itemId = ITEM_CHOICE_SCARF, .price = 4000, .holdEffect = HOLD_EFFECT_CHOICE_SCARF, .description = sChoiceScarfDesc, @@ -5871,7 +5434,6 @@ const struct Item gItems[] = [ITEM_FLAME_ORB] = { .name = _("Flame Orb"), - .itemId = ITEM_FLAME_ORB, .price = 4000, .holdEffect = HOLD_EFFECT_FLAME_ORB, .description = sFlameOrbDesc, @@ -5884,7 +5446,6 @@ const struct Item gItems[] = [ITEM_TOXIC_ORB] = { .name = _("Toxic Orb"), - .itemId = ITEM_TOXIC_ORB, .price = 4000, .holdEffect = HOLD_EFFECT_TOXIC_ORB, .description = sToxicOrbDesc, @@ -5899,7 +5460,6 @@ const struct Item gItems[] = [ITEM_DAMP_ROCK] = { .name = _("Damp Rock"), - .itemId = ITEM_DAMP_ROCK, .price = 4000, .holdEffect = HOLD_EFFECT_DAMP_ROCK, .description = sDampRockDesc, @@ -5912,7 +5472,6 @@ const struct Item gItems[] = [ITEM_HEAT_ROCK] = { .name = _("Heat Rock"), - .itemId = ITEM_HEAT_ROCK, .price = 4000, .holdEffect = HOLD_EFFECT_HEAT_ROCK, .description = sHeatRockDesc, @@ -5925,7 +5484,6 @@ const struct Item gItems[] = [ITEM_SMOOTH_ROCK] = { .name = _("Smooth Rock"), - .itemId = ITEM_SMOOTH_ROCK, .price = 4000, .holdEffect = HOLD_EFFECT_SMOOTH_ROCK, .description = sSmoothRockDesc, @@ -5938,7 +5496,6 @@ const struct Item gItems[] = [ITEM_ICY_ROCK] = { .name = _("Icy Rock"), - .itemId = ITEM_ICY_ROCK, .price = 4000, .holdEffect = HOLD_EFFECT_ICY_ROCK, .description = sIcyRockDesc, @@ -5953,7 +5510,6 @@ const struct Item gItems[] = [ITEM_ELECTRIC_SEED] = { .name = _("Electric Seed"), - .itemId = ITEM_ELECTRIC_SEED, .price = 4000, .holdEffect = HOLD_EFFECT_SEEDS, .holdEffectParam = HOLD_EFFECT_PARAM_ELECTRIC_TERRAIN, @@ -5967,7 +5523,6 @@ const struct Item gItems[] = [ITEM_PSYCHIC_SEED] = { .name = _("Psychic Seed"), - .itemId = ITEM_PSYCHIC_SEED, .price = 4000, .holdEffect = HOLD_EFFECT_SEEDS, .holdEffectParam = HOLD_EFFECT_PARAM_PSYCHIC_TERRAIN, @@ -5981,7 +5536,6 @@ const struct Item gItems[] = [ITEM_MISTY_SEED] = { .name = _("Misty Seed"), - .itemId = ITEM_MISTY_SEED, .price = 4000, .holdEffect = HOLD_EFFECT_SEEDS, .holdEffectParam = HOLD_EFFECT_PARAM_MISTY_TERRAIN, @@ -5995,7 +5549,6 @@ const struct Item gItems[] = [ITEM_GRASSY_SEED] = { .name = _("Grassy Seed"), - .itemId = ITEM_GRASSY_SEED, .price = 4000, .holdEffect = HOLD_EFFECT_SEEDS, .holdEffectParam = HOLD_EFFECT_PARAM_GRASSY_TERRAIN, @@ -6011,7 +5564,6 @@ const struct Item gItems[] = [ITEM_ABSORB_BULB] = { .name = _("Absorb Bulb"), - .itemId = ITEM_ABSORB_BULB, .price = 4000, .holdEffect = HOLD_EFFECT_ABSORB_BULB, .holdEffectParam = 0, @@ -6025,7 +5577,6 @@ const struct Item gItems[] = [ITEM_CELL_BATTERY] = { .name = _("Cell Battery"), - .itemId = ITEM_CELL_BATTERY, .price = 4000, .holdEffect = HOLD_EFFECT_CELL_BATTERY, .holdEffectParam = 0, @@ -6039,7 +5590,6 @@ const struct Item gItems[] = [ITEM_LUMINOUS_MOSS] = { .name = _("Luminous Moss"), - .itemId = ITEM_LUMINOUS_MOSS, .price = 4000, .holdEffect = HOLD_EFFECT_LUMINOUS_MOSS, .holdEffectParam = 0, @@ -6053,7 +5603,6 @@ const struct Item gItems[] = [ITEM_SNOWBALL] = { .name = _("Snowball"), - .itemId = ITEM_SNOWBALL, .price = 4000, .holdEffect = HOLD_EFFECT_SNOWBALL, .holdEffectParam = 0, @@ -6069,7 +5618,6 @@ const struct Item gItems[] = [ITEM_BRIGHT_POWDER] = { .name = _("Bright Powder"), - .itemId = ITEM_BRIGHT_POWDER, .price = 4000, .holdEffect = HOLD_EFFECT_EVASION_UP, .holdEffectParam = 10, @@ -6083,7 +5631,6 @@ const struct Item gItems[] = [ITEM_WHITE_HERB] = { .name = _("White Herb"), - .itemId = ITEM_WHITE_HERB, .price = 4000, .holdEffect = HOLD_EFFECT_RESTORE_STATS, .description = sWhiteHerbDesc, @@ -6096,20 +5643,18 @@ const struct Item gItems[] = [ITEM_EXP_SHARE] = { .name = _("Exp. Share"), - .itemId = ITEM_EXP_SHARE, .price = 3000, .holdEffect = HOLD_EFFECT_EXP_SHARE, .description = sExpShareDesc, - .pocket = POCKET_ITEMS, - .type = ITEM_USE_BAG_MENU, - .fieldUseFunc = ItemUseOutOfBattle_CannotUse, + .pocket = I_EXP_SHARE_ITEM >= GEN_6 ? POCKET_KEY_ITEMS : POCKET_ITEMS, + .type = ITEM_USE_FIELD, + .fieldUseFunc = ItemUseOutOfBattle_ExpShare, .flingPower = 30, }, [ITEM_QUICK_CLAW] = { .name = _("Quick Claw"), - .itemId = ITEM_QUICK_CLAW, .price = 4000, .holdEffect = HOLD_EFFECT_QUICK_CLAW, .holdEffectParam = 20, @@ -6123,7 +5668,6 @@ const struct Item gItems[] = [ITEM_SOOTHE_BELL] = { .name = _("Soothe Bell"), - .itemId = ITEM_SOOTHE_BELL, .price = 4000, .holdEffect = HOLD_EFFECT_FRIENDSHIP_UP, .description = sSootheBellDesc, @@ -6136,7 +5680,6 @@ const struct Item gItems[] = [ITEM_MENTAL_HERB] = { .name = _("Mental Herb"), - .itemId = ITEM_MENTAL_HERB, .price = 4000, .holdEffect = HOLD_EFFECT_MENTAL_HERB, .description = sMentalHerbDesc, @@ -6149,7 +5692,6 @@ const struct Item gItems[] = [ITEM_KINGS_ROCK] = { .name = _("King's Rock"), - .itemId = ITEM_KINGS_ROCK, .price = 5000, .holdEffect = HOLD_EFFECT_FLINCH, .holdEffectParam = 10, @@ -6163,7 +5705,6 @@ const struct Item gItems[] = [ITEM_AMULET_COIN] = { .name = _("Amulet Coin"), - .itemId = ITEM_AMULET_COIN, .price = 10000, .holdEffect = HOLD_EFFECT_DOUBLE_PRIZE, .holdEffectParam = 10, @@ -6177,7 +5718,6 @@ const struct Item gItems[] = [ITEM_CLEANSE_TAG] = { .name = _("Cleanse Tag"), - .itemId = ITEM_CLEANSE_TAG, .price = 5000, .holdEffect = HOLD_EFFECT_REPEL, .description = sCleanseTagDesc, @@ -6190,7 +5730,6 @@ const struct Item gItems[] = [ITEM_SMOKE_BALL] = { .name = _("Smoke Ball"), - .itemId = ITEM_SMOKE_BALL, .price = 4000, .holdEffect = HOLD_EFFECT_CAN_ALWAYS_RUN, .description = sSmokeBallDesc, @@ -6203,7 +5742,6 @@ const struct Item gItems[] = [ITEM_FOCUS_BAND] = { .name = _("Focus Band"), - .itemId = ITEM_FOCUS_BAND, .price = 4000, .holdEffect = HOLD_EFFECT_FOCUS_BAND, .holdEffectParam = 10, @@ -6217,7 +5755,6 @@ const struct Item gItems[] = [ITEM_LUCKY_EGG] = { .name = _("Lucky Egg"), - .itemId = ITEM_LUCKY_EGG, .price = 10000, .holdEffect = HOLD_EFFECT_LUCKY_EGG, .description = sLuckyEggDesc, @@ -6230,7 +5767,6 @@ const struct Item gItems[] = [ITEM_SCOPE_LENS] = { .name = _("Scope Lens"), - .itemId = ITEM_SCOPE_LENS, .price = 4000, .holdEffect = HOLD_EFFECT_SCOPE_LENS, .description = sScopeLensDesc, @@ -6243,7 +5779,6 @@ const struct Item gItems[] = [ITEM_LEFTOVERS] = { .name = _("Leftovers"), - .itemId = ITEM_LEFTOVERS, .price = 4000, .holdEffect = HOLD_EFFECT_LEFTOVERS, .holdEffectParam = 10, @@ -6257,7 +5792,6 @@ const struct Item gItems[] = [ITEM_SHELL_BELL] = { .name = _("Shell Bell"), - .itemId = ITEM_SHELL_BELL, .price = 4000, .holdEffect = HOLD_EFFECT_SHELL_BELL, .holdEffectParam = 8, @@ -6271,7 +5805,6 @@ const struct Item gItems[] = [ITEM_WIDE_LENS] = { .name = _("Wide Lens"), - .itemId = ITEM_WIDE_LENS, .price = 4000, .holdEffect = HOLD_EFFECT_WIDE_LENS, .holdEffectParam = 10, @@ -6285,7 +5818,6 @@ const struct Item gItems[] = [ITEM_MUSCLE_BAND] = { .name = _("Muscle Band"), - .itemId = ITEM_MUSCLE_BAND, .price = 4000, .holdEffect = HOLD_EFFECT_MUSCLE_BAND, .holdEffectParam = 10, @@ -6299,7 +5831,6 @@ const struct Item gItems[] = [ITEM_WISE_GLASSES] = { .name = _("Wise Glasses"), - .itemId = ITEM_WISE_GLASSES, .price = 4000, .holdEffect = HOLD_EFFECT_WISE_GLASSES, .holdEffectParam = 10, @@ -6313,7 +5844,6 @@ const struct Item gItems[] = [ITEM_EXPERT_BELT] = { .name = _("Expert Belt"), - .itemId = ITEM_EXPERT_BELT, .price = 4000, .holdEffect = HOLD_EFFECT_EXPERT_BELT, .holdEffectParam = 20, @@ -6327,7 +5857,6 @@ const struct Item gItems[] = [ITEM_LIGHT_CLAY] = { .name = _("Light Clay"), - .itemId = ITEM_LIGHT_CLAY, .price = 4000, .holdEffect = HOLD_EFFECT_LIGHT_CLAY, .description = sLightClayDesc, @@ -6340,7 +5869,6 @@ const struct Item gItems[] = [ITEM_LIFE_ORB] = { .name = _("Life Orb"), - .itemId = ITEM_LIFE_ORB, .price = 4000, .holdEffect = HOLD_EFFECT_LIFE_ORB, .description = sLifeOrbDesc, @@ -6353,7 +5881,6 @@ const struct Item gItems[] = [ITEM_POWER_HERB] = { .name = _("Power Herb"), - .itemId = ITEM_POWER_HERB, .price = 4000, .holdEffect = HOLD_EFFECT_POWER_HERB, .description = sPowerHerbDesc, @@ -6366,7 +5893,6 @@ const struct Item gItems[] = [ITEM_FOCUS_SASH] = { .name = _("Focus Sash"), - .itemId = ITEM_FOCUS_SASH, .price = 4000, .holdEffect = HOLD_EFFECT_FOCUS_SASH, .description = sFocusSashDesc, @@ -6379,7 +5905,6 @@ const struct Item gItems[] = [ITEM_ZOOM_LENS] = { .name = _("Zoom Lens"), - .itemId = ITEM_ZOOM_LENS, .price = 4000, .holdEffect = HOLD_EFFECT_ZOOM_LENS, .holdEffectParam = 20, @@ -6393,7 +5918,6 @@ const struct Item gItems[] = [ITEM_METRONOME] = { .name = _("Metronome"), - .itemId = ITEM_METRONOME, .price = 4000, .holdEffect = HOLD_EFFECT_METRONOME, .holdEffectParam = 20, @@ -6407,7 +5931,6 @@ const struct Item gItems[] = [ITEM_IRON_BALL] = { .name = _("Iron Ball"), - .itemId = ITEM_IRON_BALL, .price = 4000, .holdEffect = HOLD_EFFECT_IRON_BALL, .description = sIronBallDesc, @@ -6420,7 +5943,6 @@ const struct Item gItems[] = [ITEM_LAGGING_TAIL] = { .name = _("Lagging Tail"), - .itemId = ITEM_LAGGING_TAIL, .price = 4000, .holdEffect = HOLD_EFFECT_LAGGING_TAIL, .description = sLaggingTailDesc, @@ -6433,7 +5955,6 @@ const struct Item gItems[] = [ITEM_DESTINY_KNOT] = { .name = _("Destiny Knot"), - .itemId = ITEM_DESTINY_KNOT, .price = 4000, .holdEffect = HOLD_EFFECT_DESTINY_KNOT, .description = sDestinyKnotDesc, @@ -6446,7 +5967,6 @@ const struct Item gItems[] = [ITEM_BLACK_SLUDGE] = { .name = _("Black Sludge"), - .itemId = ITEM_BLACK_SLUDGE, .price = 4000, .holdEffect = HOLD_EFFECT_BLACK_SLUDGE, .description = sBlackSludgeDesc, @@ -6459,7 +5979,6 @@ const struct Item gItems[] = [ITEM_GRIP_CLAW] = { .name = _("Grip Claw"), - .itemId = ITEM_GRIP_CLAW, .price = 4000, .holdEffect = HOLD_EFFECT_GRIP_CLAW, .description = sGripClawDesc, @@ -6472,7 +5991,6 @@ const struct Item gItems[] = [ITEM_STICKY_BARB] = { .name = _("Sticky Barb"), - .itemId = ITEM_STICKY_BARB, .price = 4000, .holdEffect = HOLD_EFFECT_STICKY_BARB, .description = sStickyBarbDesc, @@ -6485,7 +6003,6 @@ const struct Item gItems[] = [ITEM_SHED_SHELL] = { .name = _("Shed Shell"), - .itemId = ITEM_SHED_SHELL, .price = 4000, .holdEffect = HOLD_EFFECT_SHED_SHELL, .description = sShedShellDesc, @@ -6498,7 +6015,6 @@ const struct Item gItems[] = [ITEM_BIG_ROOT] = { .name = _("Big Root"), - .itemId = ITEM_BIG_ROOT, .price = 4000, .holdEffect = HOLD_EFFECT_BIG_ROOT, .holdEffectParam = 30, @@ -6512,7 +6028,6 @@ const struct Item gItems[] = [ITEM_RAZOR_CLAW] = { .name = _("Razor Claw"), - .itemId = ITEM_RAZOR_CLAW, .price = 5000, .holdEffect = HOLD_EFFECT_SCOPE_LENS, .description = sRazorClawDesc, @@ -6525,7 +6040,6 @@ const struct Item gItems[] = [ITEM_RAZOR_FANG] = { .name = _("Razor Fang"), - .itemId = ITEM_RAZOR_FANG, .price = 5000, .holdEffect = HOLD_EFFECT_FLINCH, .holdEffectParam = 10, @@ -6539,7 +6053,6 @@ const struct Item gItems[] = [ITEM_EVIOLITE] = { .name = _("Eviolite"), - .itemId = ITEM_EVIOLITE, .price = 4000, .holdEffect = HOLD_EFFECT_EVIOLITE, .holdEffectParam = 50, @@ -6553,7 +6066,6 @@ const struct Item gItems[] = [ITEM_FLOAT_STONE] = { .name = _("Float Stone"), - .itemId = ITEM_FLOAT_STONE, .price = 4000, .holdEffect = HOLD_EFFECT_FLOAT_STONE, .description = sFloatStoneDesc, @@ -6566,7 +6078,6 @@ const struct Item gItems[] = [ITEM_ROCKY_HELMET] = { .name = _("Rocky Helmet"), - .itemId = ITEM_ROCKY_HELMET, .price = 4000, .holdEffect = HOLD_EFFECT_ROCKY_HELMET, .holdEffectParam = 0, @@ -6580,7 +6091,6 @@ const struct Item gItems[] = [ITEM_AIR_BALLOON] = { .name = _("Air Balloon"), - .itemId = ITEM_AIR_BALLOON, .price = 4000, .holdEffect = HOLD_EFFECT_AIR_BALLOON, .holdEffectParam = 0, @@ -6594,7 +6104,6 @@ const struct Item gItems[] = [ITEM_RED_CARD] = { .name = _("Red Card"), - .itemId = ITEM_RED_CARD, .price = 4000, .holdEffect = HOLD_EFFECT_RED_CARD, .holdEffectParam = 0, @@ -6608,7 +6117,6 @@ const struct Item gItems[] = [ITEM_RING_TARGET] = { .name = _("Ring Target"), - .itemId = ITEM_RING_TARGET, .price = 4000, .holdEffect = HOLD_EFFECT_RING_TARGET, .holdEffectParam = 0, @@ -6622,7 +6130,6 @@ const struct Item gItems[] = [ITEM_BINDING_BAND] = { .name = _("Binding Band"), - .itemId = ITEM_BINDING_BAND, .price = 4000, .holdEffect = HOLD_EFFECT_BINDING_BAND, .description = sBindingBandDesc, @@ -6635,7 +6142,6 @@ const struct Item gItems[] = [ITEM_EJECT_BUTTON] = { .name = _("Eject Button"), - .itemId = ITEM_EJECT_BUTTON, .price = 4000, .holdEffect = HOLD_EFFECT_EJECT_BUTTON, .holdEffectParam = 0, @@ -6649,7 +6155,6 @@ const struct Item gItems[] = [ITEM_WEAKNESS_POLICY] = { .name = _("WeaknssPolicy"), - .itemId = ITEM_WEAKNESS_POLICY, .price = 1000, .holdEffect = HOLD_EFFECT_WEAKNESS_POLICY, .holdEffectParam = 0, @@ -6663,7 +6168,6 @@ const struct Item gItems[] = [ITEM_ASSAULT_VEST] = { .name = _("Assault Vest"), - .itemId = ITEM_ASSAULT_VEST, .price = 1000, .holdEffect = HOLD_EFFECT_ASSAULT_VEST, .holdEffectParam = 50, @@ -6677,7 +6181,6 @@ const struct Item gItems[] = [ITEM_SAFETY_GOGGLES] = { .name = _("SafetyGoggles"), - .itemId = ITEM_SAFETY_GOGGLES, .price = 4000, .holdEffect = HOLD_EFFECT_SAFETY_GOGGLES, .description = sSafetyGogglesDesc, @@ -6690,7 +6193,6 @@ const struct Item gItems[] = [ITEM_ADRENALINE_ORB] = { .name = _("AdrenalineOrb"), - .itemId = ITEM_ADRENALINE_ORB, .price = 300, .holdEffect = HOLD_EFFECT_ADRENALINE_ORB, .description = sAdrenalineOrbDesc, @@ -6703,7 +6205,6 @@ const struct Item gItems[] = [ITEM_TERRAIN_EXTENDER] = { .name = _("TerainExtendr"), - .itemId = ITEM_TERRAIN_EXTENDER, .price = 4000, .holdEffect = HOLD_EFFECT_TERRAIN_EXTENDER, .description = sTerrainExtenderDesc, @@ -6716,7 +6217,6 @@ const struct Item gItems[] = [ITEM_PROTECTIVE_PADS] = { .name = _("ProtectvePads"), - .itemId = ITEM_PROTECTIVE_PADS, .price = 4000, .holdEffect = HOLD_EFFECT_PROTECTIVE_PADS, .description = sProtectivePadsDesc, @@ -6729,7 +6229,6 @@ const struct Item gItems[] = [ITEM_THROAT_SPRAY] = { .name = _("Throat Spray"), - .itemId = ITEM_THROAT_SPRAY, .price = 4000, .holdEffect = HOLD_EFFECT_THROAT_SPRAY, .description = sThroatSprayDesc, @@ -6742,7 +6241,6 @@ const struct Item gItems[] = [ITEM_EJECT_PACK] = { .name = _("Eject Pack"), - .itemId = ITEM_EJECT_PACK, .price = 4000, .holdEffect = HOLD_EFFECT_EJECT_PACK, .description = sEjectPackDesc, @@ -6755,7 +6253,6 @@ const struct Item gItems[] = [ITEM_HEAVY_DUTY_BOOTS] = { .name = _("Heavy-DtyBts"), - .itemId = ITEM_HEAVY_DUTY_BOOTS, .price = 4000, .holdEffect = HOLD_EFFECT_HEAVY_DUTY_BOOTS, .description = sHeavyDutyBootsDesc, @@ -6768,7 +6265,6 @@ const struct Item gItems[] = [ITEM_BLUNDER_POLICY] = { .name = _("BlundrPolicy"), - .itemId = ITEM_BLUNDER_POLICY, .price = 4000, .holdEffect = HOLD_EFFECT_BLUNDER_POLICY, .description = sBlunderPolicyDesc, @@ -6781,7 +6277,6 @@ const struct Item gItems[] = [ITEM_ROOM_SERVICE] = { .name = _("Room Service"), - .itemId = ITEM_ROOM_SERVICE, .price = 4000, .holdEffect = HOLD_EFFECT_ROOM_SERVICE, .description = sRoomServiceDesc, @@ -6794,7 +6289,6 @@ const struct Item gItems[] = [ITEM_UTILITY_UMBRELLA] = { .name = _("UtltyUmbrlla"), - .itemId = ITEM_UTILITY_UMBRELLA, .price = 4000, .holdEffect = HOLD_EFFECT_UTILITY_UMBRELLA, .description = sUtilityUmbrellaDesc, @@ -6809,7 +6303,6 @@ const struct Item gItems[] = [ITEM_CHERI_BERRY] = { .name = _("Cheri Berry"), - .itemId = ITEM_CHERI_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_CURE_PAR, .description = sCheriBerryDesc, @@ -6823,7 +6316,6 @@ const struct Item gItems[] = [ITEM_CHESTO_BERRY] = { .name = _("Chesto Berry"), - .itemId = ITEM_CHESTO_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_CURE_SLP, .description = sChestoBerryDesc, @@ -6837,7 +6329,6 @@ const struct Item gItems[] = [ITEM_PECHA_BERRY] = { .name = _("Pecha Berry"), - .itemId = ITEM_PECHA_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_CURE_PSN, .description = sPechaBerryDesc, @@ -6851,7 +6342,6 @@ const struct Item gItems[] = [ITEM_RAWST_BERRY] = { .name = _("Rawst Berry"), - .itemId = ITEM_RAWST_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_CURE_BRN, .description = sRawstBerryDesc, @@ -6865,7 +6355,6 @@ const struct Item gItems[] = [ITEM_ASPEAR_BERRY] = { .name = _("Aspear Berry"), - .itemId = ITEM_ASPEAR_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_CURE_FRZ, .description = sAspearBerryDesc, @@ -6879,7 +6368,6 @@ const struct Item gItems[] = [ITEM_LEPPA_BERRY] = { .name = _("Leppa Berry"), - .itemId = ITEM_LEPPA_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_RESTORE_PP, .holdEffectParam = 10, @@ -6894,7 +6382,6 @@ const struct Item gItems[] = [ITEM_ORAN_BERRY] = { .name = _("Oran Berry"), - .itemId = ITEM_ORAN_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_RESTORE_HP, .holdEffectParam = 10, @@ -6909,7 +6396,6 @@ const struct Item gItems[] = [ITEM_PERSIM_BERRY] = { .name = _("Persim Berry"), - .itemId = ITEM_PERSIM_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_CURE_CONFUSION, .description = sPersimBerryDesc, @@ -6923,7 +6409,6 @@ const struct Item gItems[] = [ITEM_LUM_BERRY] = { .name = _("Lum Berry"), - .itemId = ITEM_LUM_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_CURE_STATUS, .description = sLumBerryDesc, @@ -6937,7 +6422,6 @@ const struct Item gItems[] = [ITEM_SITRUS_BERRY] = { .name = _("Sitrus Berry"), - .itemId = ITEM_SITRUS_BERRY, .price = 20, #if I_SITRUS_BERRY_HEAL >= GEN_4 .holdEffect = HOLD_EFFECT_RESTORE_PCT_HP, @@ -6965,7 +6449,6 @@ const struct Item gItems[] = [ITEM_FIGY_BERRY] = { .name = _("Figy Berry"), - .itemId = ITEM_FIGY_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_CONFUSE_SPICY, .holdEffectParam = CONFUSE_BERRY_HEAL_FRACTION, @@ -6979,7 +6462,6 @@ const struct Item gItems[] = [ITEM_WIKI_BERRY] = { .name = _("Wiki Berry"), - .itemId = ITEM_WIKI_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_CONFUSE_DRY, .holdEffectParam = CONFUSE_BERRY_HEAL_FRACTION, @@ -6993,7 +6475,6 @@ const struct Item gItems[] = [ITEM_MAGO_BERRY] = { .name = _("Mago Berry"), - .itemId = ITEM_MAGO_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_CONFUSE_SWEET, .holdEffectParam = CONFUSE_BERRY_HEAL_FRACTION, @@ -7007,7 +6488,6 @@ const struct Item gItems[] = [ITEM_AGUAV_BERRY] = { .name = _("Aguav Berry"), - .itemId = ITEM_AGUAV_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_CONFUSE_BITTER, .holdEffectParam = CONFUSE_BERRY_HEAL_FRACTION, @@ -7021,7 +6501,6 @@ const struct Item gItems[] = [ITEM_IAPAPA_BERRY] = { .name = _("Iapapa Berry"), - .itemId = ITEM_IAPAPA_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_CONFUSE_SOUR, .holdEffectParam = CONFUSE_BERRY_HEAL_FRACTION, @@ -7037,7 +6516,6 @@ const struct Item gItems[] = [ITEM_RAZZ_BERRY] = { .name = _("Razz Berry"), - .itemId = ITEM_RAZZ_BERRY, .price = 20, .description = sRazzBerryDesc, .pocket = POCKET_BERRIES, @@ -7049,7 +6527,6 @@ const struct Item gItems[] = [ITEM_BLUK_BERRY] = { .name = _("Bluk Berry"), - .itemId = ITEM_BLUK_BERRY, .price = 20, .description = sBlukBerryDesc, .pocket = POCKET_BERRIES, @@ -7061,7 +6538,6 @@ const struct Item gItems[] = [ITEM_NANAB_BERRY] = { .name = _("Nanab Berry"), - .itemId = ITEM_NANAB_BERRY, .price = 20, .description = sNanabBerryDesc, .pocket = POCKET_BERRIES, @@ -7073,7 +6549,6 @@ const struct Item gItems[] = [ITEM_WEPEAR_BERRY] = { .name = _("Wepear Berry"), - .itemId = ITEM_WEPEAR_BERRY, .price = 20, .description = sWepearBerryDesc, .pocket = POCKET_BERRIES, @@ -7085,7 +6560,6 @@ const struct Item gItems[] = [ITEM_PINAP_BERRY] = { .name = _("Pinap Berry"), - .itemId = ITEM_PINAP_BERRY, .price = 20, .description = sPinapBerryDesc, .pocket = POCKET_BERRIES, @@ -7097,7 +6571,6 @@ const struct Item gItems[] = [ITEM_POMEG_BERRY] = { .name = _("Pomeg Berry"), - .itemId = ITEM_POMEG_BERRY, .price = 20, .description = sPomegBerryDesc, .pocket = POCKET_BERRIES, @@ -7109,7 +6582,6 @@ const struct Item gItems[] = [ITEM_KELPSY_BERRY] = { .name = _("Kelpsy Berry"), - .itemId = ITEM_KELPSY_BERRY, .price = 20, .description = sKelpsyBerryDesc, .pocket = POCKET_BERRIES, @@ -7121,7 +6593,6 @@ const struct Item gItems[] = [ITEM_QUALOT_BERRY] = { .name = _("Qualot Berry"), - .itemId = ITEM_QUALOT_BERRY, .price = 20, .description = sQualotBerryDesc, .pocket = POCKET_BERRIES, @@ -7133,7 +6604,6 @@ const struct Item gItems[] = [ITEM_HONDEW_BERRY] = { .name = _("Hondew Berry"), - .itemId = ITEM_HONDEW_BERRY, .price = 20, .description = sHondewBerryDesc, .pocket = POCKET_BERRIES, @@ -7145,7 +6615,6 @@ const struct Item gItems[] = [ITEM_GREPA_BERRY] = { .name = _("Grepa Berry"), - .itemId = ITEM_GREPA_BERRY, .price = 20, .description = sGrepaBerryDesc, .pocket = POCKET_BERRIES, @@ -7157,7 +6626,6 @@ const struct Item gItems[] = [ITEM_TAMATO_BERRY] = { .name = _("Tamato Berry"), - .itemId = ITEM_TAMATO_BERRY, .price = 20, .description = sTamatoBerryDesc, .pocket = POCKET_BERRIES, @@ -7169,7 +6637,6 @@ const struct Item gItems[] = [ITEM_CORNN_BERRY] = { .name = _("Cornn Berry"), - .itemId = ITEM_CORNN_BERRY, .price = 20, .description = sCornnBerryDesc, .pocket = POCKET_BERRIES, @@ -7181,7 +6648,6 @@ const struct Item gItems[] = [ITEM_MAGOST_BERRY] = { .name = _("Magost Berry"), - .itemId = ITEM_MAGOST_BERRY, .price = 20, .description = sMagostBerryDesc, .pocket = POCKET_BERRIES, @@ -7193,7 +6659,6 @@ const struct Item gItems[] = [ITEM_RABUTA_BERRY] = { .name = _("Rabuta Berry"), - .itemId = ITEM_RABUTA_BERRY, .price = 20, .description = sRabutaBerryDesc, .pocket = POCKET_BERRIES, @@ -7205,7 +6670,6 @@ const struct Item gItems[] = [ITEM_NOMEL_BERRY] = { .name = _("Nomel Berry"), - .itemId = ITEM_NOMEL_BERRY, .price = 20, .description = sNomelBerryDesc, .pocket = POCKET_BERRIES, @@ -7217,7 +6681,6 @@ const struct Item gItems[] = [ITEM_SPELON_BERRY] = { .name = _("Spelon Berry"), - .itemId = ITEM_SPELON_BERRY, .price = 20, .description = sSpelonBerryDesc, .pocket = POCKET_BERRIES, @@ -7229,7 +6692,6 @@ const struct Item gItems[] = [ITEM_PAMTRE_BERRY] = { .name = _("Pamtre Berry"), - .itemId = ITEM_PAMTRE_BERRY, .price = 20, .description = sPamtreBerryDesc, .pocket = POCKET_BERRIES, @@ -7241,7 +6703,6 @@ const struct Item gItems[] = [ITEM_WATMEL_BERRY] = { .name = _("Watmel Berry"), - .itemId = ITEM_WATMEL_BERRY, .price = 20, .description = sWatmelBerryDesc, .pocket = POCKET_BERRIES, @@ -7253,7 +6714,6 @@ const struct Item gItems[] = [ITEM_DURIN_BERRY] = { .name = _("Durin Berry"), - .itemId = ITEM_DURIN_BERRY, .price = 20, .description = sDurinBerryDesc, .pocket = POCKET_BERRIES, @@ -7265,7 +6725,6 @@ const struct Item gItems[] = [ITEM_BELUE_BERRY] = { .name = _("Belue Berry"), - .itemId = ITEM_BELUE_BERRY, .price = 20, .description = sBelueBerryDesc, .pocket = POCKET_BERRIES, @@ -7277,7 +6736,6 @@ const struct Item gItems[] = [ITEM_CHILAN_BERRY] = { .name = _("Chilan Berry"), - .itemId = ITEM_CHILAN_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_RESIST_BERRY, .holdEffectParam = TYPE_NORMAL, @@ -7291,7 +6749,6 @@ const struct Item gItems[] = [ITEM_OCCA_BERRY] = { .name = _("Occa Berry"), - .itemId = ITEM_OCCA_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_RESIST_BERRY, .holdEffectParam = TYPE_FIRE, @@ -7305,7 +6762,6 @@ const struct Item gItems[] = [ITEM_PASSHO_BERRY] = { .name = _("Passho Berry"), - .itemId = ITEM_PASSHO_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_RESIST_BERRY, .holdEffectParam = TYPE_WATER, @@ -7319,7 +6775,6 @@ const struct Item gItems[] = [ITEM_WACAN_BERRY] = { .name = _("Wacan Berry"), - .itemId = ITEM_WACAN_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_RESIST_BERRY, .holdEffectParam = TYPE_ELECTRIC, @@ -7333,7 +6788,6 @@ const struct Item gItems[] = [ITEM_RINDO_BERRY] = { .name = _("Rindo Berry"), - .itemId = ITEM_RINDO_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_RESIST_BERRY, .holdEffectParam = TYPE_GRASS, @@ -7347,7 +6801,6 @@ const struct Item gItems[] = [ITEM_YACHE_BERRY] = { .name = _("Yache Berry"), - .itemId = ITEM_YACHE_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_RESIST_BERRY, .holdEffectParam = TYPE_ICE, @@ -7361,7 +6814,6 @@ const struct Item gItems[] = [ITEM_CHOPLE_BERRY] = { .name = _("Chople Berry"), - .itemId = ITEM_CHOPLE_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_RESIST_BERRY, .holdEffectParam = TYPE_FIGHTING, @@ -7375,7 +6827,6 @@ const struct Item gItems[] = [ITEM_KEBIA_BERRY] = { .name = _("Kebia Berry"), - .itemId = ITEM_KEBIA_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_RESIST_BERRY, .holdEffectParam = TYPE_POISON, @@ -7389,7 +6840,6 @@ const struct Item gItems[] = [ITEM_SHUCA_BERRY] = { .name = _("Shuca Berry"), - .itemId = ITEM_SHUCA_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_RESIST_BERRY, .holdEffectParam = TYPE_GROUND, @@ -7403,7 +6853,6 @@ const struct Item gItems[] = [ITEM_COBA_BERRY] = { .name = _("Coba Berry"), - .itemId = ITEM_COBA_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_RESIST_BERRY, .holdEffectParam = TYPE_FLYING, @@ -7417,7 +6866,6 @@ const struct Item gItems[] = [ITEM_PAYAPA_BERRY] = { .name = _("Payapa Berry"), - .itemId = ITEM_PAYAPA_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_RESIST_BERRY, .holdEffectParam = TYPE_PSYCHIC, @@ -7431,7 +6879,6 @@ const struct Item gItems[] = [ITEM_TANGA_BERRY] = { .name = _("Tanga Berry"), - .itemId = ITEM_TANGA_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_RESIST_BERRY, .holdEffectParam = TYPE_BUG, @@ -7445,7 +6892,6 @@ const struct Item gItems[] = [ITEM_CHARTI_BERRY] = { .name = _("Charti Berry"), - .itemId = ITEM_CHARTI_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_RESIST_BERRY, .holdEffectParam = TYPE_ROCK, @@ -7459,7 +6905,6 @@ const struct Item gItems[] = [ITEM_KASIB_BERRY] = { .name = _("Kasib Berry"), - .itemId = ITEM_KASIB_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_RESIST_BERRY, .holdEffectParam = TYPE_GHOST, @@ -7473,7 +6918,6 @@ const struct Item gItems[] = [ITEM_HABAN_BERRY] = { .name = _("Haban Berry"), - .itemId = ITEM_HABAN_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_RESIST_BERRY, .holdEffectParam = TYPE_DRAGON, @@ -7487,7 +6931,6 @@ const struct Item gItems[] = [ITEM_COLBUR_BERRY] = { .name = _("Colbur Berry"), - .itemId = ITEM_COLBUR_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_RESIST_BERRY, .holdEffectParam = TYPE_DARK, @@ -7501,7 +6944,6 @@ const struct Item gItems[] = [ITEM_BABIRI_BERRY] = { .name = _("Babiri Berry"), - .itemId = ITEM_BABIRI_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_RESIST_BERRY, .holdEffectParam = TYPE_STEEL, @@ -7515,7 +6957,6 @@ const struct Item gItems[] = [ITEM_ROSELI_BERRY] = { .name = _("Roseli Berry"), - .itemId = ITEM_ROSELI_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_RESIST_BERRY, .holdEffectParam = TYPE_FAIRY, @@ -7529,7 +6970,6 @@ const struct Item gItems[] = [ITEM_LIECHI_BERRY] = { .name = _("Liechi Berry"), - .itemId = ITEM_LIECHI_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_ATTACK_UP, .holdEffectParam = 4, @@ -7543,7 +6983,6 @@ const struct Item gItems[] = [ITEM_GANLON_BERRY] = { .name = _("Ganlon Berry"), - .itemId = ITEM_GANLON_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_DEFENSE_UP, .holdEffectParam = 4, @@ -7557,7 +6996,6 @@ const struct Item gItems[] = [ITEM_SALAC_BERRY] = { .name = _("Salac Berry"), - .itemId = ITEM_SALAC_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_SPEED_UP, .holdEffectParam = 4, @@ -7571,7 +7009,6 @@ const struct Item gItems[] = [ITEM_PETAYA_BERRY] = { .name = _("Petaya Berry"), - .itemId = ITEM_PETAYA_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_SP_ATTACK_UP, .holdEffectParam = 4, @@ -7585,7 +7022,6 @@ const struct Item gItems[] = [ITEM_APICOT_BERRY] = { .name = _("Apicot Berry"), - .itemId = ITEM_APICOT_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_SP_DEFENSE_UP, .holdEffectParam = 4, @@ -7599,7 +7035,6 @@ const struct Item gItems[] = [ITEM_LANSAT_BERRY] = { .name = _("Lansat Berry"), - .itemId = ITEM_LANSAT_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_CRITICAL_UP, .holdEffectParam = 4, @@ -7613,7 +7048,6 @@ const struct Item gItems[] = [ITEM_STARF_BERRY] = { .name = _("Starf Berry"), - .itemId = ITEM_STARF_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_RANDOM_STAT_UP, .holdEffectParam = 4, @@ -7627,7 +7061,6 @@ const struct Item gItems[] = [ITEM_ENIGMA_BERRY] = { .name = _("Enigma Berry"), - .itemId = ITEM_ENIGMA_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_ENIGMA_BERRY, .description = sEnigmaBerryDesc, @@ -7640,7 +7073,6 @@ const struct Item gItems[] = [ITEM_MICLE_BERRY] = { .name = _("Micle Berry"), - .itemId = ITEM_MICLE_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_MICLE_BERRY, .holdEffectParam = 4, @@ -7654,7 +7086,6 @@ const struct Item gItems[] = [ITEM_CUSTAP_BERRY] = { .name = _("Custap Berry"), - .itemId = ITEM_CUSTAP_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_CUSTAP_BERRY, .holdEffectParam = 4, @@ -7668,7 +7099,6 @@ const struct Item gItems[] = [ITEM_JABOCA_BERRY] = { .name = _("Jaboca Berry"), - .itemId = ITEM_JABOCA_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_JABOCA_BERRY, .description = sJabocaBerryDesc, @@ -7681,7 +7111,6 @@ const struct Item gItems[] = [ITEM_ROWAP_BERRY] = { .name = _("Rowap Berry"), - .itemId = ITEM_ROWAP_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_ROWAP_BERRY, .description = sRowapBerryDesc, @@ -7694,7 +7123,6 @@ const struct Item gItems[] = [ITEM_KEE_BERRY] = { .name = _("Kee Berry"), - .itemId = ITEM_KEE_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_KEE_BERRY, .description = sKeeBerryDesc, @@ -7707,7 +7135,6 @@ const struct Item gItems[] = [ITEM_MARANGA_BERRY] = { .name = _("Maranga Berry"), - .itemId = ITEM_MARANGA_BERRY, .price = 20, .holdEffect = HOLD_EFFECT_MARANGA_BERRY, .description = sMarangaBerryDesc, @@ -7720,7 +7147,6 @@ const struct Item gItems[] = [ITEM_ENIGMA_BERRY_E_READER] = { .name = _("Enigma Berry"), - .itemId = ITEM_ENIGMA_BERRY, .price = 20, .description = sEnigmaBerryEReaderDesc, .pocket = POCKET_BERRIES, @@ -7732,1300 +7158,1300 @@ const struct Item gItems[] = // TMs/HMs. They don't have a set flingPower, as that's handled by GetFlingPowerFromItemId. - [ITEM_TM01_FOCUS_PUNCH] = + [ITEM_TM_FOCUS_PUNCH] = { .name = _("TM01"), - .itemId = ITEM_TM01_FOCUS_PUNCH, .price = 3000, .description = sTM01Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_FOCUS_PUNCH, }, - [ITEM_TM02_DRAGON_CLAW] = + [ITEM_TM_DRAGON_CLAW] = { .name = _("TM02"), - .itemId = ITEM_TM02_DRAGON_CLAW, .price = 3000, .description = sTM02Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_DRAGON_CLAW, }, - [ITEM_TM03_WATER_PULSE] = + [ITEM_TM_WATER_PULSE] = { .name = _("TM03"), - .itemId = ITEM_TM03_WATER_PULSE, .price = 3000, .description = sTM03Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_WATER_PULSE, }, - [ITEM_TM04_CALM_MIND] = + [ITEM_TM_CALM_MIND] = { .name = _("TM04"), - .itemId = ITEM_TM04_CALM_MIND, .price = 3000, .description = sTM04Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_CALM_MIND, }, - [ITEM_TM05_ROAR] = + [ITEM_TM_ROAR] = { .name = _("TM05"), - .itemId = ITEM_TM05_ROAR, .price = 1000, .description = sTM05Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_ROAR, }, - [ITEM_TM06_TOXIC] = + [ITEM_TM_TOXIC] = { .name = _("TM06"), - .itemId = ITEM_TM06_TOXIC, .price = 3000, .description = sTM06Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_TOXIC, }, - [ITEM_TM07_HAIL] = + [ITEM_TM_HAIL] = { .name = _("TM07"), - .itemId = ITEM_TM07_HAIL, .price = 3000, .description = sTM07Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_HAIL, }, - [ITEM_TM08_BULK_UP] = + [ITEM_TM_BULK_UP] = { .name = _("TM08"), - .itemId = ITEM_TM08_BULK_UP, .price = 3000, .description = sTM08Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_BULK_UP, }, - [ITEM_TM09_BULLET_SEED] = + [ITEM_TM_BULLET_SEED] = { .name = _("TM09"), - .itemId = ITEM_TM09_BULLET_SEED, .price = 3000, .description = sTM09Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_BULLET_SEED, }, - [ITEM_TM10_HIDDEN_POWER] = + [ITEM_TM_HIDDEN_POWER] = { .name = _("TM10"), - .itemId = ITEM_TM10_HIDDEN_POWER, .price = 3000, .description = sTM10Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_HIDDEN_POWER, }, - [ITEM_TM11_SUNNY_DAY] = + [ITEM_TM_SUNNY_DAY] = { .name = _("TM11"), - .itemId = ITEM_TM11_SUNNY_DAY, .price = 2000, .description = sTM11Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_SUNNY_DAY, }, - [ITEM_TM12_TAUNT] = + [ITEM_TM_TAUNT] = { .name = _("TM12"), - .itemId = ITEM_TM12_TAUNT, .price = 3000, .description = sTM12Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_TAUNT, }, - [ITEM_TM13_ICE_BEAM] = + [ITEM_TM_ICE_BEAM] = { .name = _("TM13"), - .itemId = ITEM_TM13_ICE_BEAM, .price = 3000, .description = sTM13Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_ICE_BEAM, }, - [ITEM_TM14_BLIZZARD] = + [ITEM_TM_BLIZZARD] = { .name = _("TM14"), - .itemId = ITEM_TM14_BLIZZARD, .price = 5500, .description = sTM14Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_BLIZZARD, }, - [ITEM_TM15_HYPER_BEAM] = + [ITEM_TM_HYPER_BEAM] = { .name = _("TM15"), - .itemId = ITEM_TM15_HYPER_BEAM, .price = 7500, .description = sTM15Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_HYPER_BEAM, }, - [ITEM_TM16_LIGHT_SCREEN] = + [ITEM_TM_LIGHT_SCREEN] = { .name = _("TM16"), - .itemId = ITEM_TM16_LIGHT_SCREEN, .price = 3000, .description = sTM16Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_LIGHT_SCREEN, }, - [ITEM_TM17_PROTECT] = + [ITEM_TM_PROTECT] = { .name = _("TM17"), - .itemId = ITEM_TM17_PROTECT, .price = 3000, .description = sTM17Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_PROTECT, }, - [ITEM_TM18_RAIN_DANCE] = + [ITEM_TM_RAIN_DANCE] = { .name = _("TM18"), - .itemId = ITEM_TM18_RAIN_DANCE, .price = 2000, .description = sTM18Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_RAIN_DANCE, }, - [ITEM_TM19_GIGA_DRAIN] = + [ITEM_TM_GIGA_DRAIN] = { .name = _("TM19"), - .itemId = ITEM_TM19_GIGA_DRAIN, .price = 3000, .description = sTM19Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_GIGA_DRAIN, }, - [ITEM_TM20_SAFEGUARD] = + [ITEM_TM_SAFEGUARD] = { .name = _("TM20"), - .itemId = ITEM_TM20_SAFEGUARD, .price = 3000, .description = sTM20Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_SAFEGUARD, }, - [ITEM_TM21_FRUSTRATION] = + [ITEM_TM_FRUSTRATION] = { .name = _("TM21"), - .itemId = ITEM_TM21_FRUSTRATION, .price = 1000, .description = sTM21Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_FRUSTRATION, }, - [ITEM_TM22_SOLAR_BEAM] = + [ITEM_TM_SOLAR_BEAM] = { .name = _("TM22"), - .itemId = ITEM_TM22_SOLAR_BEAM, .price = 3000, .description = sTM22Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_SOLAR_BEAM, }, - [ITEM_TM23_IRON_TAIL] = + [ITEM_TM_IRON_TAIL] = { .name = _("TM23"), - .itemId = ITEM_TM23_IRON_TAIL, .price = 3000, .description = sTM23Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_IRON_TAIL, }, - [ITEM_TM24_THUNDERBOLT] = + [ITEM_TM_THUNDERBOLT] = { .name = _("TM24"), - .itemId = ITEM_TM24_THUNDERBOLT, .price = 3000, .description = sTM24Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_THUNDERBOLT, }, - [ITEM_TM25_THUNDER] = + [ITEM_TM_THUNDER] = { .name = _("TM25"), - .itemId = ITEM_TM25_THUNDER, .price = 5500, .description = sTM25Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_THUNDER, }, - [ITEM_TM26_EARTHQUAKE] = + [ITEM_TM_EARTHQUAKE] = { .name = _("TM26"), - .itemId = ITEM_TM26_EARTHQUAKE, .price = 3000, .description = sTM26Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_EARTHQUAKE, }, - [ITEM_TM27_RETURN] = + [ITEM_TM_RETURN] = { .name = _("TM27"), - .itemId = ITEM_TM27_RETURN, .price = 1000, .description = sTM27Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_RETURN, }, - [ITEM_TM28_DIG] = + [ITEM_TM_DIG] = { .name = _("TM28"), - .itemId = ITEM_TM28_DIG, .price = 2000, .description = sTM28Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_DIG, }, - [ITEM_TM29_PSYCHIC] = + [ITEM_TM_PSYCHIC] = { .name = _("TM29"), - .itemId = ITEM_TM29_PSYCHIC, .price = 2000, .description = sTM29Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_PSYCHIC, }, - [ITEM_TM30_SHADOW_BALL] = + [ITEM_TM_SHADOW_BALL] = { .name = _("TM30"), - .itemId = ITEM_TM30_SHADOW_BALL, .price = 3000, .description = sTM30Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_SHADOW_BALL, }, - [ITEM_TM31_BRICK_BREAK] = + [ITEM_TM_BRICK_BREAK] = { .name = _("TM31"), - .itemId = ITEM_TM31_BRICK_BREAK, .price = 3000, .description = sTM31Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_BRICK_BREAK, }, - [ITEM_TM32_DOUBLE_TEAM] = + [ITEM_TM_DOUBLE_TEAM] = { .name = _("TM32"), - .itemId = ITEM_TM32_DOUBLE_TEAM, .price = 2000, .description = sTM32Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_DOUBLE_TEAM, }, - [ITEM_TM33_REFLECT] = + [ITEM_TM_REFLECT] = { .name = _("TM33"), - .itemId = ITEM_TM33_REFLECT, .price = 3000, .description = sTM33Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_REFLECT, }, - [ITEM_TM34_SHOCK_WAVE] = + [ITEM_TM_SHOCK_WAVE] = { .name = _("TM34"), - .itemId = ITEM_TM34_SHOCK_WAVE, .price = 3000, .description = sTM34Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_SHOCK_WAVE, }, - [ITEM_TM35_FLAMETHROWER] = + [ITEM_TM_FLAMETHROWER] = { .name = _("TM35"), - .itemId = ITEM_TM35_FLAMETHROWER, .price = 3000, .description = sTM35Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_FLAMETHROWER, }, - [ITEM_TM36_SLUDGE_BOMB] = + [ITEM_TM_SLUDGE_BOMB] = { .name = _("TM36"), - .itemId = ITEM_TM36_SLUDGE_BOMB, .price = 1000, .description = sTM36Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_SLUDGE_BOMB, }, - [ITEM_TM37_SANDSTORM] = + [ITEM_TM_SANDSTORM] = { .name = _("TM37"), - .itemId = ITEM_TM37_SANDSTORM, .price = 2000, .description = sTM37Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_SANDSTORM, }, - [ITEM_TM38_FIRE_BLAST] = + [ITEM_TM_FIRE_BLAST] = { .name = _("TM38"), - .itemId = ITEM_TM38_FIRE_BLAST, .price = 5500, .description = sTM38Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_FIRE_BLAST, }, - [ITEM_TM39_ROCK_TOMB] = + [ITEM_TM_ROCK_TOMB] = { .name = _("TM39"), - .itemId = ITEM_TM39_ROCK_TOMB, .price = 3000, .description = sTM39Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_ROCK_TOMB, }, - [ITEM_TM40_AERIAL_ACE] = + [ITEM_TM_AERIAL_ACE] = { .name = _("TM40"), - .itemId = ITEM_TM40_AERIAL_ACE, .price = 3000, .description = sTM40Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_AERIAL_ACE, }, - [ITEM_TM41_TORMENT] = + [ITEM_TM_TORMENT] = { .name = _("TM41"), - .itemId = ITEM_TM41_TORMENT, .price = 3000, .description = sTM41Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_TORMENT, }, - [ITEM_TM42_FACADE] = + [ITEM_TM_FACADE] = { .name = _("TM42"), - .itemId = ITEM_TM42_FACADE, .price = 3000, .description = sTM42Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_FACADE, }, - [ITEM_TM43_SECRET_POWER] = + [ITEM_TM_SECRET_POWER] = { .name = _("TM43"), - .itemId = ITEM_TM43_SECRET_POWER, .price = 3000, .description = sTM43Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_SECRET_POWER, }, - [ITEM_TM44_REST] = + [ITEM_TM_REST] = { .name = _("TM44"), - .itemId = ITEM_TM44_REST, .price = 3000, .description = sTM44Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_REST, }, - [ITEM_TM45_ATTRACT] = + [ITEM_TM_ATTRACT] = { .name = _("TM45"), - .itemId = ITEM_TM45_ATTRACT, .price = 3000, .description = sTM45Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_ATTRACT, }, - [ITEM_TM46_THIEF] = + [ITEM_TM_THIEF] = { .name = _("TM46"), - .itemId = ITEM_TM46_THIEF, .price = 3000, .description = sTM46Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_THIEF, }, - [ITEM_TM47_STEEL_WING] = + [ITEM_TM_STEEL_WING] = { .name = _("TM47"), - .itemId = ITEM_TM47_STEEL_WING, .price = 3000, .description = sTM47Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_STEEL_WING, }, - [ITEM_TM48_SKILL_SWAP] = + [ITEM_TM_SKILL_SWAP] = { .name = _("TM48"), - .itemId = ITEM_TM48_SKILL_SWAP, .price = 3000, .description = sTM48Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_SKILL_SWAP, }, - [ITEM_TM49_SNATCH] = + [ITEM_TM_SNATCH] = { .name = _("TM49"), - .itemId = ITEM_TM49_SNATCH, .price = 3000, .description = sTM49Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_SNATCH, }, - [ITEM_TM50_OVERHEAT] = + [ITEM_TM_OVERHEAT] = { .name = _("TM50"), - .itemId = ITEM_TM50_OVERHEAT, .price = 3000, .description = sTM50Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_OVERHEAT, }, [ITEM_TM51] = { .name = _("TM51"), - .itemId = ITEM_TM51, .price = 3000, .description = sTM51Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM52] = { .name = _("TM52"), - .itemId = ITEM_TM52, .price = 3000, .description = sTM52Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM53] = { .name = _("TM53"), - .itemId = ITEM_TM53, .price = 3000, .description = sTM53Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM54] = { .name = _("TM54"), - .itemId = ITEM_TM54, .price = 3000, .description = sTM54Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM55] = { .name = _("TM55"), - .itemId = ITEM_TM55, .price = 3000, .description = sTM55Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM56] = { .name = _("TM56"), - .itemId = ITEM_TM56, .price = 3000, .description = sTM56Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM57] = { .name = _("TM57"), - .itemId = ITEM_TM57, .price = 3000, .description = sTM57Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM58] = { .name = _("TM58"), - .itemId = ITEM_TM58, .price = 3000, .description = sTM58Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM59] = { .name = _("TM59"), - .itemId = ITEM_TM59, .price = 3000, .description = sTM59Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM60] = { .name = _("TM60"), - .itemId = ITEM_TM60, .price = 3000, .description = sTM60Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM61] = { .name = _("TM61"), - .itemId = ITEM_TM61, .price = 3000, .description = sTM61Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM62] = { .name = _("TM62"), - .itemId = ITEM_TM62, .price = 3000, .description = sTM62Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM63] = { .name = _("TM63"), - .itemId = ITEM_TM63, .price = 3000, .description = sTM63Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM64] = { .name = _("TM64"), - .itemId = ITEM_TM64, .price = 3000, .description = sTM64Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM65] = { .name = _("TM65"), - .itemId = ITEM_TM65, .price = 3000, .description = sTM65Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM66] = { .name = _("TM66"), - .itemId = ITEM_TM66, .price = 3000, .description = sTM66Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM67] = { .name = _("TM67"), - .itemId = ITEM_TM67, .price = 3000, .description = sTM67Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM68] = { .name = _("TM68"), - .itemId = ITEM_TM68, .price = 3000, .description = sTM68Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM69] = { .name = _("TM69"), - .itemId = ITEM_TM69, .price = 3000, .description = sTM69Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM70] = { .name = _("TM70"), - .itemId = ITEM_TM70, .price = 3000, .description = sTM70Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM71] = { .name = _("TM71"), - .itemId = ITEM_TM71, .price = 3000, .description = sTM71Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM72] = { .name = _("TM72"), - .itemId = ITEM_TM72, .price = 3000, .description = sTM72Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM73] = { .name = _("TM73"), - .itemId = ITEM_TM73, .price = 3000, .description = sTM73Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM74] = { .name = _("TM74"), - .itemId = ITEM_TM74, .price = 3000, .description = sTM74Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM75] = { .name = _("TM75"), - .itemId = ITEM_TM75, .price = 3000, .description = sTM75Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM76] = { .name = _("TM76"), - .itemId = ITEM_TM76, .price = 3000, .description = sTM76Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM77] = { .name = _("TM77"), - .itemId = ITEM_TM77, .price = 3000, .description = sTM77Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM78] = { .name = _("TM78"), - .itemId = ITEM_TM78, .price = 3000, .description = sTM78Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM79] = { .name = _("TM79"), - .itemId = ITEM_TM79, .price = 3000, .description = sTM79Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM80] = { .name = _("TM80"), - .itemId = ITEM_TM80, .price = 3000, .description = sTM80Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM81] = { .name = _("TM81"), - .itemId = ITEM_TM81, .price = 3000, .description = sTM81Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM82] = { .name = _("TM82"), - .itemId = ITEM_TM82, .price = 3000, .description = sTM82Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM83] = { .name = _("TM83"), - .itemId = ITEM_TM83, .price = 3000, .description = sTM83Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM84] = { .name = _("TM84"), - .itemId = ITEM_TM84, .price = 3000, .description = sTM84Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM85] = { .name = _("TM85"), - .itemId = ITEM_TM85, .price = 3000, .description = sTM85Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM86] = { .name = _("TM86"), - .itemId = ITEM_TM86, .price = 3000, .description = sTM86Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM87] = { .name = _("TM87"), - .itemId = ITEM_TM87, .price = 3000, .description = sTM87Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM88] = { .name = _("TM88"), - .itemId = ITEM_TM88, .price = 3000, .description = sTM88Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM89] = { .name = _("TM89"), - .itemId = ITEM_TM89, .price = 3000, .description = sTM89Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM90] = { .name = _("TM90"), - .itemId = ITEM_TM90, .price = 3000, .description = sTM90Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM91] = { .name = _("TM91"), - .itemId = ITEM_TM91, .price = 3000, .description = sTM91Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM92] = { .name = _("TM92"), - .itemId = ITEM_TM92, .price = 3000, .description = sTM92Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM93] = { .name = _("TM93"), - .itemId = ITEM_TM93, .price = 3000, .description = sTM93Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM94] = { .name = _("TM94"), - .itemId = ITEM_TM94, .price = 3000, .description = sTM94Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM95] = { .name = _("TM95"), - .itemId = ITEM_TM95, .price = 3000, .description = sTM95Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM96] = { .name = _("TM96"), - .itemId = ITEM_TM96, .price = 3000, .description = sTM96Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM97] = { .name = _("TM97"), - .itemId = ITEM_TM97, .price = 3000, .description = sTM97Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM98] = { .name = _("TM98"), - .itemId = ITEM_TM98, .price = 3000, .description = sTM98Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM99] = { .name = _("TM99"), - .itemId = ITEM_TM99, .price = 3000, .description = sTM99Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, [ITEM_TM100] = { .name = _("TM100"), - .itemId = ITEM_TM100, .price = 3000, .description = sTM100Desc, .importance = I_REUSABLE_TMS, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_NONE, // Todo }, - [ITEM_HM01_CUT] = + [ITEM_HM_CUT] = { .name = _("HM01"), - .itemId = ITEM_HM01_CUT, .price = 0, .description = sHM01Desc, .importance = 1, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_CUT, }, - [ITEM_HM02_FLY] = + [ITEM_HM_FLY] = { .name = _("HM02"), - .itemId = ITEM_HM02_FLY, .price = 0, .description = sHM02Desc, .importance = 1, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_FLY, }, - [ITEM_HM03_SURF] = + [ITEM_HM_SURF] = { .name = _("HM03"), - .itemId = ITEM_HM03_SURF, .price = 0, .description = sHM03Desc, .importance = 1, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_SURF, }, - [ITEM_HM04_STRENGTH] = + [ITEM_HM_STRENGTH] = { .name = _("HM04"), - .itemId = ITEM_HM04_STRENGTH, .price = 0, .description = sHM04Desc, .importance = 1, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_STRENGTH, }, - [ITEM_HM05_FLASH] = + [ITEM_HM_FLASH] = { .name = _("HM05"), - .itemId = ITEM_HM05_FLASH, .price = 0, .description = sHM05Desc, .importance = 1, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_FLASH, }, - [ITEM_HM06_ROCK_SMASH] = + [ITEM_HM_ROCK_SMASH] = { .name = _("HM06"), - .itemId = ITEM_HM06_ROCK_SMASH, .price = 0, .description = sHM06Desc, .importance = 1, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_ROCK_SMASH, }, - [ITEM_HM07_WATERFALL] = + [ITEM_HM_WATERFALL] = { .name = _("HM07"), - .itemId = ITEM_HM07_WATERFALL, .price = 0, .description = sHM07Desc, .importance = 1, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_WATERFALL, }, - [ITEM_HM08_DIVE] = + [ITEM_HM_DIVE] = { .name = _("HM08"), - .itemId = ITEM_HM08_DIVE, .price = 0, .description = sHM08Desc, .importance = 1, .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, + .secondaryId = MOVE_DIVE, }, @@ -9034,7 +8460,6 @@ const struct Item gItems[] = [ITEM_OVAL_CHARM] = { .name = _("Oval Charm"), - .itemId = ITEM_OVAL_CHARM, .price = 0, .importance = 1, .description = sOvalCharmDesc, @@ -9046,7 +8471,6 @@ const struct Item gItems[] = [ITEM_SHINY_CHARM] = { .name = _("Shiny Charm"), - .itemId = ITEM_SHINY_CHARM, .price = 0, .importance = 1, .description = sShinyCharmDesc, @@ -9058,7 +8482,6 @@ const struct Item gItems[] = [ITEM_CATCHING_CHARM] = { .name = _("CatchngCharm"), - .itemId = ITEM_CATCHING_CHARM, .price = 0, .importance = 1, .description = sCatchingCharmDesc, @@ -9070,7 +8493,6 @@ const struct Item gItems[] = [ITEM_EXP_CHARM] = { .name = _("Exp. Charm"), - .itemId = ITEM_EXP_CHARM, .price = 0, .importance = 1, .description = sExpCharmDesc, @@ -9084,7 +8506,6 @@ const struct Item gItems[] = [ITEM_ROTOM_CATALOG] = { .name = _("RotomCatalog"), - .itemId = ITEM_ROTOM_CATALOG, .price = 0, .importance = 1, .description = sRotomCatalogDesc, @@ -9096,7 +8517,6 @@ const struct Item gItems[] = [ITEM_GRACIDEA] = { .name = _("Gracidea"), - .itemId = ITEM_GRACIDEA, .price = 0, .description = sGracideaDesc, .pocket = POCKET_KEY_ITEMS, @@ -9107,7 +8527,6 @@ const struct Item gItems[] = [ITEM_REVEAL_GLASS] = { .name = _("Reveal Glass"), - .itemId = ITEM_REVEAL_GLASS, .price = 0, .description = sRevealGlassDesc, .pocket = POCKET_KEY_ITEMS, @@ -9118,7 +8537,6 @@ const struct Item gItems[] = [ITEM_DNA_SPLICERS] = { .name = _("DNA Splicers"), - .itemId = ITEM_DNA_SPLICERS, .price = 0, .description = sDNASplicersDesc, .pocket = POCKET_KEY_ITEMS, @@ -9129,7 +8547,6 @@ const struct Item gItems[] = [ITEM_ZYGARDE_CUBE] = { .name = _("Zygarde Cube"), - .itemId = ITEM_ZYGARDE_CUBE, .price = 0, .importance = 1, .description = sZygardeCubeDesc, @@ -9141,7 +8558,6 @@ const struct Item gItems[] = [ITEM_PRISON_BOTTLE] = { .name = _("Prison Bottle"), - .itemId = ITEM_PRISON_BOTTLE, .price = 0, .description = sPrisonBottleDesc, .pocket = POCKET_KEY_ITEMS, @@ -9152,7 +8568,6 @@ const struct Item gItems[] = [ITEM_N_SOLARIZER] = { .name = _("N-Solarizer"), - .itemId = ITEM_N_SOLARIZER, .price = 0, .description = sNSolarizerDesc, .pocket = POCKET_KEY_ITEMS, @@ -9163,7 +8578,6 @@ const struct Item gItems[] = [ITEM_N_LUNARIZER] = { .name = _("N-Lunarizer"), - .itemId = ITEM_N_LUNARIZER, .price = 0, .description = sNLunarizerDesc, .pocket = POCKET_KEY_ITEMS, @@ -9174,7 +8588,6 @@ const struct Item gItems[] = [ITEM_REINS_OF_UNITY] = { .name = _("ReinsOfUnity"), - .itemId = ITEM_REINS_OF_UNITY, .price = 0, .description = sReinsOfUnityDesc, .pocket = POCKET_KEY_ITEMS, @@ -9187,7 +8600,6 @@ const struct Item gItems[] = [ITEM_MEGA_RING] = { .name = _("Mega Ring"), - .itemId = ITEM_MEGA_RING, .price = 0, .importance = 1, .description = sMegaRingDesc, @@ -9199,7 +8611,6 @@ const struct Item gItems[] = [ITEM_Z_POWER_RING] = { .name = _("Z-Power Ring"), - .itemId = ITEM_Z_POWER_RING, .price = 0, .importance = 1, .description = sZPowerRingDesc, @@ -9211,7 +8622,6 @@ const struct Item gItems[] = [ITEM_DYNAMAX_BAND] = { .name = _("Dynamax Band"), - .itemId = ITEM_DYNAMAX_BAND, .price = 0, .description = sDynamaxBandDesc, .pocket = POCKET_KEY_ITEMS, @@ -9224,11 +8634,9 @@ const struct Item gItems[] = [ITEM_BICYCLE] = { .name = _("Bicycle"), - .itemId = ITEM_BICYCLE, .price = 0, .description = sBicycleDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_FIELD, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, @@ -9237,11 +8645,9 @@ const struct Item gItems[] = [ITEM_MACH_BIKE] = { .name = _("Mach Bike"), - .itemId = ITEM_MACH_BIKE, .price = 0, .description = sMachBikeDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_FIELD, .fieldUseFunc = ItemUseOutOfBattle_Bike, @@ -9251,11 +8657,9 @@ const struct Item gItems[] = [ITEM_ACRO_BIKE] = { .name = _("Acro Bike"), - .itemId = ITEM_ACRO_BIKE, .price = 0, .description = sAcroBikeDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_FIELD, .fieldUseFunc = ItemUseOutOfBattle_Bike, @@ -9265,11 +8669,9 @@ const struct Item gItems[] = [ITEM_OLD_ROD] = { .name = _("Old Rod"), - .itemId = ITEM_OLD_ROD, .price = 0, .description = sOldRodDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_FIELD, .fieldUseFunc = ItemUseOutOfBattle_Rod, @@ -9279,11 +8681,9 @@ const struct Item gItems[] = [ITEM_GOOD_ROD] = { .name = _("Good Rod"), - .itemId = ITEM_GOOD_ROD, .price = 0, .description = sGoodRodDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_FIELD, .fieldUseFunc = ItemUseOutOfBattle_Rod, @@ -9293,11 +8693,9 @@ const struct Item gItems[] = [ITEM_SUPER_ROD] = { .name = _("Super Rod"), - .itemId = ITEM_SUPER_ROD, .price = 0, .description = sSuperRodDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_FIELD, .fieldUseFunc = ItemUseOutOfBattle_Rod, @@ -9307,11 +8705,9 @@ const struct Item gItems[] = [ITEM_DOWSING_MACHINE] = { .name = _("Dowsing MCHN"), - .itemId = ITEM_DOWSING_MACHINE, .price = 0, .description = sDowsingMachineDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_FIELD, .fieldUseFunc = ItemUseOutOfBattle_Itemfinder, @@ -9320,11 +8716,9 @@ const struct Item gItems[] = [ITEM_TOWN_MAP] = { .name = _("Town Map"), - .itemId = ITEM_TOWN_MAP, .price = 0, .description = sTownMapDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, @@ -9333,11 +8727,9 @@ const struct Item gItems[] = [ITEM_VS_SEEKER] = { .name = _("Vs. Seeker"), - .itemId = ITEM_VS_SEEKER, .price = 0, .description = sVsSeekerDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_FIELD, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, @@ -9346,11 +8738,9 @@ const struct Item gItems[] = [ITEM_TM_CASE] = { .name = _("TM Case"), - .itemId = ITEM_TM_CASE, .price = 0, .description = sTMCaseDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, @@ -9359,11 +8749,9 @@ const struct Item gItems[] = [ITEM_BERRY_POUCH] = { .name = _("Berry Pouch"), - .itemId = ITEM_BERRY_POUCH, .price = 0, .description = sBerryPouchDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, @@ -9372,7 +8760,6 @@ const struct Item gItems[] = [ITEM_POKEMON_BOX_LINK] = { .name = _("{PKMN} Box Link"), - .itemId = ITEM_POKEMON_BOX_LINK, .price = 0, .description = sPokemonBoxLinkDesc, .importance = 1, @@ -9384,7 +8771,6 @@ const struct Item gItems[] = [ITEM_COIN_CASE] = { .name = _("Coin Case"), - .itemId = ITEM_COIN_CASE, .price = 0, .description = sCoinCaseDesc, .importance = 1, @@ -9396,11 +8782,9 @@ const struct Item gItems[] = [ITEM_POWDER_JAR] = { .name = _("Powder Jar"), - .itemId = ITEM_POWDER_JAR, .price = 0, .description = sPowderJarDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_PowderJar, @@ -9409,7 +8793,6 @@ const struct Item gItems[] = [ITEM_WAILMER_PAIL] = { .name = _("Wailmer Pail"), - .itemId = ITEM_WAILMER_PAIL, .price = 0, .description = sWailmerPailDesc, .importance = 1, @@ -9421,7 +8804,6 @@ const struct Item gItems[] = [ITEM_POKE_RADAR] = { .name = _("Poké Radar"), - .itemId = ITEM_POKE_RADAR, .price = 0, .description = sPokeRadarDesc, .importance = 1, @@ -9433,11 +8815,9 @@ const struct Item gItems[] = [ITEM_POKEBLOCK_CASE] = { .name = _("{POKEBLOCK} Case"), - .itemId = ITEM_POKEBLOCK_CASE, .price = 0, .description = sPokeblockCaseDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_PBLOCK_CASE, .fieldUseFunc = ItemUseOutOfBattle_PokeblockCase, @@ -9446,7 +8826,6 @@ const struct Item gItems[] = [ITEM_SOOT_SACK] = { .name = _("Soot Sack"), - .itemId = ITEM_SOOT_SACK, .price = 0, .description = sSootSackDesc, .importance = 1, @@ -9458,7 +8837,6 @@ const struct Item gItems[] = [ITEM_POKE_FLUTE] = { .name = _("Poké Flute"), - .itemId = ITEM_POKE_FLUTE, .price = 0, .description = sPokeFluteDesc, .importance = 1, @@ -9470,11 +8848,9 @@ const struct Item gItems[] = [ITEM_FAME_CHECKER] = { .name = _("Fame Checker"), - .itemId = ITEM_FAME_CHECKER, .price = 0, .description = sFameCheckerDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, @@ -9483,11 +8859,9 @@ const struct Item gItems[] = [ITEM_TEACHY_TV] = { .name = _("Teachy TV"), - .itemId = ITEM_TEACHY_TV, .price = 0, .description = sTeachyTVDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_FIELD, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, @@ -9498,7 +8872,6 @@ const struct Item gItems[] = [ITEM_SS_TICKET] = { .name = _("S.S. Ticket"), - .itemId = ITEM_SS_TICKET, .price = 0, .description = sSSTicketDesc, .importance = 1, @@ -9510,7 +8883,6 @@ const struct Item gItems[] = [ITEM_EON_TICKET] = { .name = _("Eon Ticket"), - .itemId = ITEM_EON_TICKET, .price = 0, .description = sEonTicketDesc, .importance = 1, @@ -9523,11 +8895,9 @@ const struct Item gItems[] = [ITEM_MYSTIC_TICKET] = { .name = _("Mystic Ticket"), - .itemId = ITEM_MYSTIC_TICKET, .price = 0, .description = sMysticTicketDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, @@ -9536,11 +8906,9 @@ const struct Item gItems[] = [ITEM_AURORA_TICKET] = { .name = _("Aurora Ticket"), - .itemId = ITEM_AURORA_TICKET, .price = 0, .description = sAuroraTicketDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, @@ -9549,11 +8917,9 @@ const struct Item gItems[] = [ITEM_OLD_SEA_MAP] = { .name = _("Old Sea Map"), - .itemId = ITEM_OLD_SEA_MAP, .price = 0, .description = sOldSeaMapDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, @@ -9562,7 +8928,6 @@ const struct Item gItems[] = [ITEM_LETTER] = { .name = _("Letter"), - .itemId = ITEM_LETTER, .price = 0, .description = sLetterDesc, .importance = 2, @@ -9574,7 +8939,6 @@ const struct Item gItems[] = [ITEM_DEVON_PARTS] = { .name = _("Devon Parts"), - .itemId = ITEM_DEVON_PARTS, .price = 0, .description = sDevonPartsDesc, .importance = 2, @@ -9586,7 +8950,6 @@ const struct Item gItems[] = [ITEM_GO_GOGGLES] = { .name = _("Go-Goggles"), - .itemId = ITEM_GO_GOGGLES, .price = 0, .description = sGoGogglesDesc, .importance = 1, @@ -9598,7 +8961,6 @@ const struct Item gItems[] = [ITEM_DEVON_SCOPE] = { .name = _("Devon Scope"), - .itemId = ITEM_DEVON_SCOPE, .price = 0, .description = sDevonScopeDesc, .importance = 1, @@ -9610,7 +8972,6 @@ const struct Item gItems[] = [ITEM_BASEMENT_KEY] = { .name = _("Basement Key"), - .itemId = ITEM_BASEMENT_KEY, .price = 0, .description = sBasementKeyDesc, .importance = 1, @@ -9622,7 +8983,6 @@ const struct Item gItems[] = [ITEM_SCANNER] = { .name = _("Scanner"), - .itemId = ITEM_SCANNER, .price = 0, .description = sScannerDesc, .importance = 1, @@ -9634,7 +8994,6 @@ const struct Item gItems[] = [ITEM_STORAGE_KEY] = { .name = _("Storage Key"), - .itemId = ITEM_STORAGE_KEY, .price = 0, .description = sStorageKeyDesc, .importance = 1, @@ -9646,7 +9005,6 @@ const struct Item gItems[] = [ITEM_KEY_TO_ROOM_1] = { .name = _("Key to Room 1"), - .itemId = ITEM_KEY_TO_ROOM_1, .price = 0, .description = sKeyToRoom1Desc, .importance = 1, @@ -9658,7 +9016,6 @@ const struct Item gItems[] = [ITEM_KEY_TO_ROOM_2] = { .name = _("Key to Room 2"), - .itemId = ITEM_KEY_TO_ROOM_2, .price = 0, .description = sKeyToRoom2Desc, .importance = 1, @@ -9670,7 +9027,6 @@ const struct Item gItems[] = [ITEM_KEY_TO_ROOM_4] = { .name = _("Key to Room 4"), - .itemId = ITEM_KEY_TO_ROOM_4, .price = 0, .description = sKeyToRoom4Desc, .importance = 1, @@ -9682,7 +9038,6 @@ const struct Item gItems[] = [ITEM_KEY_TO_ROOM_6] = { .name = _("Key to Room 6"), - .itemId = ITEM_KEY_TO_ROOM_6, .price = 0, .description = sKeyToRoom6Desc, .importance = 1, @@ -9694,7 +9049,6 @@ const struct Item gItems[] = [ITEM_METEORITE] = { .name = _("Meteorite"), - .itemId = ITEM_METEORITE, .price = 0, .description = sMeteoriteDesc, .importance = 1, @@ -9706,11 +9060,9 @@ const struct Item gItems[] = [ITEM_MAGMA_EMBLEM] = { .name = _("Magma Emblem"), - .itemId = ITEM_MAGMA_EMBLEM, .price = 0, .description = sMagmaEmblemDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, @@ -9719,7 +9071,6 @@ const struct Item gItems[] = [ITEM_CONTEST_PASS] = { .name = _("Contest Pass"), - .itemId = ITEM_CONTEST_PASS, .price = 0, .description = sContestPassDesc, .importance = 1, @@ -9731,7 +9082,6 @@ const struct Item gItems[] = [ITEM_OAKS_PARCEL] = { .name = _("Oak's Parcel"), - .itemId = ITEM_OAKS_PARCEL, .price = 0, .description = sOaksParcelDesc, .importance = 2, @@ -9743,7 +9093,6 @@ const struct Item gItems[] = [ITEM_SECRET_KEY] = { .name = _("Secret Key"), - .itemId = ITEM_SECRET_KEY, .price = 0, .description = sSecretKeyDesc, .importance = 1, @@ -9755,7 +9104,6 @@ const struct Item gItems[] = [ITEM_BIKE_VOUCHER] = { .name = _("Bike Voucher"), - .itemId = ITEM_BIKE_VOUCHER, .price = 0, .description = sBikeVoucherDesc, .importance = 1, @@ -9767,7 +9115,6 @@ const struct Item gItems[] = [ITEM_GOLD_TEETH] = { .name = _("Gold Teeth"), - .itemId = ITEM_GOLD_TEETH, .price = 0, .description = sGoldTeethDesc, .importance = 1, @@ -9779,7 +9126,6 @@ const struct Item gItems[] = [ITEM_CARD_KEY] = { .name = _("Card Key"), - .itemId = ITEM_CARD_KEY, .price = 0, .description = sCardKeyDesc, .importance = 1, @@ -9791,7 +9137,6 @@ const struct Item gItems[] = [ITEM_LIFT_KEY] = { .name = _("Lift Key"), - .itemId = ITEM_LIFT_KEY, .price = 0, .description = sLiftKeyDesc, .importance = 1, @@ -9803,7 +9148,6 @@ const struct Item gItems[] = [ITEM_SILPH_SCOPE] = { .name = _("Silph Scope"), - .itemId = ITEM_SILPH_SCOPE, .price = 0, .description = sSilphScopeDesc, .importance = 1, @@ -9815,11 +9159,9 @@ const struct Item gItems[] = [ITEM_TRI_PASS] = { .name = _("Tri-Pass"), - .itemId = ITEM_TRI_PASS, .price = 0, .description = sTriPassDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, @@ -9828,11 +9170,9 @@ const struct Item gItems[] = [ITEM_RAINBOW_PASS] = { .name = _("Rainbow Pass"), - .itemId = ITEM_RAINBOW_PASS, .price = 0, .description = sRainbowPassDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, @@ -9841,11 +9181,9 @@ const struct Item gItems[] = [ITEM_TEA] = { .name = _("Tea"), - .itemId = ITEM_TEA, .price = 0, .description = sTeaDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, @@ -9854,11 +9192,9 @@ const struct Item gItems[] = [ITEM_RUBY] = { .name = _("Ruby"), - .itemId = ITEM_RUBY, .price = 0, .description = sRubyDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, @@ -9867,11 +9203,9 @@ const struct Item gItems[] = [ITEM_SAPPHIRE] = { .name = _("Sapphire"), - .itemId = ITEM_SAPPHIRE, .price = 0, .description = sSapphireDesc, .importance = 1, - .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, @@ -9880,7 +9214,6 @@ const struct Item gItems[] = [ITEM_ABILITY_SHIELD] = { .name = _("AbilityShield"), - .itemId = ITEM_ABILITY_SHIELD, .price = 20000, .holdEffect = HOLD_EFFECT_ABILITY_SHIELD, .description = sAbilityShieldDesc, @@ -9893,7 +9226,6 @@ const struct Item gItems[] = [ITEM_CLEAR_AMULET] = { .name = _("Clear Amulet"), - .itemId = ITEM_CLEAR_AMULET, .price = 30000, .holdEffect = HOLD_EFFECT_CLEAR_AMULET, .description = sClearAmuletDesc, @@ -9906,7 +9238,6 @@ const struct Item gItems[] = [ITEM_PUNCHING_GLOVE] = { .name = _("PunchingGlove"), - .itemId = ITEM_PUNCHING_GLOVE, .price = 15000, .holdEffect = HOLD_EFFECT_PUNCHING_GLOVE, .description = sPunchingGloveDesc, @@ -9919,7 +9250,6 @@ const struct Item gItems[] = [ITEM_COVERT_CLOAK] = { .name = _("Covert Cloak"), - .itemId = ITEM_COVERT_CLOAK, .price = 20000, .holdEffect = HOLD_EFFECT_COVERT_CLOAK, .description = sCovertCloakDesc, @@ -9932,7 +9262,6 @@ const struct Item gItems[] = [ITEM_LOADED_DICE] = { .name = _("Loaded Dice"), - .itemId = ITEM_LOADED_DICE, .price = 20000, .holdEffect = HOLD_EFFECT_LOADED_DICE, .description = sLoadedDiceDesc, @@ -9945,7 +9274,6 @@ const struct Item gItems[] = [ITEM_AUSPICIOUS_ARMOR] = { .name = _("AuspciousArmr"), - .itemId = ITEM_AUSPICIOUS_ARMOR, .price = 3000, .description = sAuspiciousArmorDesc, .pocket = POCKET_ITEMS, @@ -9957,7 +9285,6 @@ const struct Item gItems[] = [ITEM_BOOSTER_ENERGY] = { .name = _("BoosterEnergy"), - .itemId = ITEM_BOOSTER_ENERGY, .price = 0, .holdEffect = HOLD_EFFECT_BOOSTER_ENERGY, .description = sBoosterEnergyDesc, @@ -9970,7 +9297,6 @@ const struct Item gItems[] = [ITEM_BIG_BAMBOO_SHOOT] = { .name = _("BigBmbooShoot"), - .itemId = ITEM_BIG_BAMBOO_SHOOT, .price = 3000, .description = sBigBambooShootDesc, .pocket = POCKET_ITEMS, @@ -9982,7 +9308,6 @@ const struct Item gItems[] = [ITEM_GIMMIGHOUL_COIN] = { .name = _("GimighoulCoin"), - .itemId = ITEM_GIMMIGHOUL_COIN, .price = 400, .description = sGimmighoulCoinDesc, .pocket = POCKET_ITEMS, @@ -9993,7 +9318,6 @@ const struct Item gItems[] = [ITEM_LEADERS_CREST] = { .name = _("Leader'sCrest"), - .itemId = ITEM_LEADERS_CREST, .price = 3000, .description = sLeadersCrestDesc, .pocket = POCKET_ITEMS, @@ -10004,7 +9328,6 @@ const struct Item gItems[] = [ITEM_MALICIOUS_ARMOR] = { .name = _("MaliciousArmr"), - .itemId = ITEM_MALICIOUS_ARMOR, .price = 3000, .description = sMaliciousArmorDesc, .pocket = POCKET_ITEMS, @@ -10016,7 +9339,6 @@ const struct Item gItems[] = [ITEM_MIRROR_HERB] = { .name = _("Mirror Herb"), - .itemId = ITEM_MIRROR_HERB, .price = 30000, .holdEffect = HOLD_EFFECT_MIRROR_HERB, .description = sMirrorHerbDesc, @@ -10029,7 +9351,6 @@ const struct Item gItems[] = [ITEM_SCROLL_OF_DARKNESS] = { .name = _("ScrllOfDrknss"), - .itemId = ITEM_SCROLL_OF_DARKNESS, .price = 0, .description = sScrollOfDarknessDesc, .importance = 1, @@ -10041,7 +9362,6 @@ const struct Item gItems[] = [ITEM_SCROLL_OF_WATERS] = { .name = _("ScrollOfWatrs"), - .itemId = ITEM_SCROLL_OF_WATERS, .price = 0, .description = sScrollOfWatersDesc, .importance = 1, @@ -10053,7 +9373,6 @@ const struct Item gItems[] = [ITEM_TERA_ORB] = { .name = _("Tera Orb"), - .itemId = ITEM_TERA_ORB, .price = 0, .description = sTeraOrbDesc, .importance = 1, @@ -10065,7 +9384,6 @@ const struct Item gItems[] = [ITEM_TINY_BAMBOO_SHOOT] = { .name = _("TinyBmbooShot"), - .itemId = ITEM_TINY_BAMBOO_SHOOT, .price = 750, .description = sTinyBambooShootDesc, .pocket = POCKET_ITEMS, @@ -10077,7 +9395,6 @@ const struct Item gItems[] = [ITEM_BUG_TERA_SHARD] = { .name = _("Bug TeraShard"), - .itemId = ITEM_BUG_TERA_SHARD, .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -10088,7 +9405,6 @@ const struct Item gItems[] = [ITEM_DARK_TERA_SHARD] = { .name = _("DarkTeraShard"), - .itemId = ITEM_DARK_TERA_SHARD, .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -10099,7 +9415,6 @@ const struct Item gItems[] = [ITEM_DRAGON_TERA_SHARD] = { .name = _("DragnTeraShrd"), - .itemId = ITEM_DRAGON_TERA_SHARD, .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -10110,7 +9425,6 @@ const struct Item gItems[] = [ITEM_ELECTRIC_TERA_SHARD] = { .name = _("EltrcTeraShrd"), - .itemId = ITEM_ELECTRIC_TERA_SHARD, .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -10121,7 +9435,6 @@ const struct Item gItems[] = [ITEM_FAIRY_TERA_SHARD] = { .name = _("FairyTeraShrd"), - .itemId = ITEM_FAIRY_TERA_SHARD, .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -10132,7 +9445,6 @@ const struct Item gItems[] = [ITEM_FIGHTING_TERA_SHARD] = { .name = _("FghtngTerShrd"), - .itemId = ITEM_FIGHTING_TERA_SHARD, .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -10143,7 +9455,6 @@ const struct Item gItems[] = [ITEM_FIRE_TERA_SHARD] = { .name = _("FireTeraShard"), - .itemId = ITEM_FIRE_TERA_SHARD, .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -10154,7 +9465,6 @@ const struct Item gItems[] = [ITEM_FLYING_TERA_SHARD] = { .name = _("FlyngTeraShrd"), - .itemId = ITEM_FLYING_TERA_SHARD, .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -10165,7 +9475,6 @@ const struct Item gItems[] = [ITEM_GHOST_TERA_SHARD] = { .name = _("GhostTeraShrd"), - .itemId = ITEM_GHOST_TERA_SHARD, .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -10176,7 +9485,6 @@ const struct Item gItems[] = [ITEM_GRASS_TERA_SHARD] = { .name = _("GrassTeraShrd"), - .itemId = ITEM_GRASS_TERA_SHARD, .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -10187,7 +9495,6 @@ const struct Item gItems[] = [ITEM_GROUND_TERA_SHARD] = { .name = _("GrondTeraShrd"), - .itemId = ITEM_GROUND_TERA_SHARD, .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -10198,7 +9505,6 @@ const struct Item gItems[] = [ITEM_ICE_TERA_SHARD] = { .name = _("Ice TeraShard"), - .itemId = ITEM_ICE_TERA_SHARD, .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -10209,7 +9515,6 @@ const struct Item gItems[] = [ITEM_NORMAL_TERA_SHARD] = { .name = _("NormlTeraShrd"), - .itemId = ITEM_NORMAL_TERA_SHARD, .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -10220,7 +9525,6 @@ const struct Item gItems[] = [ITEM_POISON_TERA_SHARD] = { .name = _("PoisnTeraShrd"), - .itemId = ITEM_POISON_TERA_SHARD, .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -10231,7 +9535,6 @@ const struct Item gItems[] = [ITEM_PSYCHIC_TERA_SHARD] = { .name = _("PschcTeraShrd"), - .itemId = ITEM_PSYCHIC_TERA_SHARD, .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -10242,7 +9545,6 @@ const struct Item gItems[] = [ITEM_ROCK_TERA_SHARD] = { .name = _("RockTeraShard"), - .itemId = ITEM_ROCK_TERA_SHARD, .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -10253,7 +9555,6 @@ const struct Item gItems[] = [ITEM_STEEL_TERA_SHARD] = { .name = _("SteelTeraShrd"), - .itemId = ITEM_STEEL_TERA_SHARD, .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -10264,7 +9565,6 @@ const struct Item gItems[] = [ITEM_WATER_TERA_SHARD] = { .name = _("WaterTeraShrd"), - .itemId = ITEM_WATER_TERA_SHARD, .price = 0, .description = sTeraShardDesc, .pocket = POCKET_ITEMS, @@ -10275,7 +9575,6 @@ const struct Item gItems[] = [ITEM_ADAMANT_CRYSTAL] = { .name = _("AdamantCrystl"), - .itemId = ITEM_ADAMANT_CRYSTAL, .price = 0, .description = sAdamantCrystalDesc, .pocket = POCKET_ITEMS, @@ -10287,7 +9586,6 @@ const struct Item gItems[] = [ITEM_GRISEOUS_CORE] = { .name = _("Griseous Core"), - .itemId = ITEM_GRISEOUS_CORE, .price = 0, .description = sGriseousCoreDesc, .pocket = POCKET_ITEMS, @@ -10299,7 +9597,6 @@ const struct Item gItems[] = [ITEM_LUSTROUS_GLOBE] = { .name = _("LustrousGlobe"), - .itemId = ITEM_LUSTROUS_GLOBE, .price = 0, .description = sLustrousGlobeDesc, .pocket = POCKET_ITEMS, @@ -10311,7 +9608,6 @@ const struct Item gItems[] = [ITEM_BLACK_AUGURITE] = { .name = _("BlackAugurite"), - .itemId = ITEM_BLACK_AUGURITE, .price = 8000, .description = sBlackAuguriteDesc, .pocket = POCKET_ITEMS, @@ -10323,7 +9619,6 @@ const struct Item gItems[] = [ITEM_LINKING_CORD] = { .name = _("Linking Cord"), - .itemId = ITEM_LINKING_CORD, .price = 8000, .description = sLinkingCordDesc, .pocket = POCKET_ITEMS, @@ -10335,7 +9630,6 @@ const struct Item gItems[] = [ITEM_PEAT_BLOCK] = { .name = _("Peat Block"), - .itemId = ITEM_PEAT_BLOCK, .price = 10000, .description = sPeatBlockDesc, .pocket = POCKET_ITEMS, @@ -10347,7 +9641,6 @@ const struct Item gItems[] = [ITEM_BERSERK_GENE] = { .name = _("Berserk Gene"), - .itemId = ITEM_BERSERK_GENE, .price = 20, .holdEffect = HOLD_EFFECT_BERSERK_GENE, .description = sBerserkGene, diff --git a/src/data/lilycove_lady.h b/src/data/lilycove_lady.h index bff13c504dcd..09586ccd6b03 100644 --- a/src/data/lilycove_lady.h +++ b/src/data/lilycove_lady.h @@ -279,7 +279,7 @@ static const u16 sQuizLadyPrizes[] = ITEM_BELUE_BERRY, ITEM_DURIN_BERRY, ITEM_LUXURY_BALL, - ITEM_TM15_HYPER_BEAM, + ITEM_TM_HYPER_BEAM, ITEM_BIG_PEARL, ITEM_STAR_PIECE, ITEM_RARE_CANDY, diff --git a/src/data/party_menu.h b/src/data/party_menu.h index e7ebf98939ca..4a1c5344c69d 100644 --- a/src/data/party_menu.h +++ b/src/data/party_menu.h @@ -1102,115 +1102,3 @@ static const u8 *const sUnused_StatStrings[] = gText_SpDef4, gText_Speed2 }; - -static const u16 sTMHMMoves[] = -{ - [ITEM_TM01 - ITEM_TM01] = MOVE_FOCUS_PUNCH, - [ITEM_TM02 - ITEM_TM01] = MOVE_DRAGON_CLAW, - [ITEM_TM03 - ITEM_TM01] = MOVE_WATER_PULSE, - [ITEM_TM04 - ITEM_TM01] = MOVE_CALM_MIND, - [ITEM_TM05 - ITEM_TM01] = MOVE_ROAR, - [ITEM_TM06 - ITEM_TM01] = MOVE_TOXIC, - [ITEM_TM07 - ITEM_TM01] = MOVE_HAIL, - [ITEM_TM08 - ITEM_TM01] = MOVE_BULK_UP, - [ITEM_TM09 - ITEM_TM01] = MOVE_BULLET_SEED, - [ITEM_TM10 - ITEM_TM01] = MOVE_HIDDEN_POWER, - [ITEM_TM11 - ITEM_TM01] = MOVE_SUNNY_DAY, - [ITEM_TM12 - ITEM_TM01] = MOVE_TAUNT, - [ITEM_TM13 - ITEM_TM01] = MOVE_ICE_BEAM, - [ITEM_TM14 - ITEM_TM01] = MOVE_BLIZZARD, - [ITEM_TM15 - ITEM_TM01] = MOVE_HYPER_BEAM, - [ITEM_TM16 - ITEM_TM01] = MOVE_LIGHT_SCREEN, - [ITEM_TM17 - ITEM_TM01] = MOVE_PROTECT, - [ITEM_TM18 - ITEM_TM01] = MOVE_RAIN_DANCE, - [ITEM_TM19 - ITEM_TM01] = MOVE_GIGA_DRAIN, - [ITEM_TM20 - ITEM_TM01] = MOVE_SAFEGUARD, - [ITEM_TM21 - ITEM_TM01] = MOVE_FRUSTRATION, - [ITEM_TM22 - ITEM_TM01] = MOVE_SOLAR_BEAM, - [ITEM_TM23 - ITEM_TM01] = MOVE_IRON_TAIL, - [ITEM_TM24 - ITEM_TM01] = MOVE_THUNDERBOLT, - [ITEM_TM25 - ITEM_TM01] = MOVE_THUNDER, - [ITEM_TM26 - ITEM_TM01] = MOVE_EARTHQUAKE, - [ITEM_TM27 - ITEM_TM01] = MOVE_RETURN, - [ITEM_TM28 - ITEM_TM01] = MOVE_DIG, - [ITEM_TM29 - ITEM_TM01] = MOVE_PSYCHIC, - [ITEM_TM30 - ITEM_TM01] = MOVE_SHADOW_BALL, - [ITEM_TM31 - ITEM_TM01] = MOVE_BRICK_BREAK, - [ITEM_TM32 - ITEM_TM01] = MOVE_DOUBLE_TEAM, - [ITEM_TM33 - ITEM_TM01] = MOVE_REFLECT, - [ITEM_TM34 - ITEM_TM01] = MOVE_SHOCK_WAVE, - [ITEM_TM35 - ITEM_TM01] = MOVE_FLAMETHROWER, - [ITEM_TM36 - ITEM_TM01] = MOVE_SLUDGE_BOMB, - [ITEM_TM37 - ITEM_TM01] = MOVE_SANDSTORM, - [ITEM_TM38 - ITEM_TM01] = MOVE_FIRE_BLAST, - [ITEM_TM39 - ITEM_TM01] = MOVE_ROCK_TOMB, - [ITEM_TM40 - ITEM_TM01] = MOVE_AERIAL_ACE, - [ITEM_TM41 - ITEM_TM01] = MOVE_TORMENT, - [ITEM_TM42 - ITEM_TM01] = MOVE_FACADE, - [ITEM_TM43 - ITEM_TM01] = MOVE_SECRET_POWER, - [ITEM_TM44 - ITEM_TM01] = MOVE_REST, - [ITEM_TM45 - ITEM_TM01] = MOVE_ATTRACT, - [ITEM_TM46 - ITEM_TM01] = MOVE_THIEF, - [ITEM_TM47 - ITEM_TM01] = MOVE_STEEL_WING, - [ITEM_TM48 - ITEM_TM01] = MOVE_SKILL_SWAP, - [ITEM_TM49 - ITEM_TM01] = MOVE_SNATCH, - [ITEM_TM50 - ITEM_TM01] = MOVE_OVERHEAT, - [ITEM_TM51 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM52 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM53 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM54 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM55 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM56 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM57 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM58 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM59 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM60 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM61 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM62 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM63 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM64 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM65 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM66 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM67 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM68 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM69 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM70 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM71 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM72 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM73 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM74 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM75 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM76 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM77 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM78 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM79 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM80 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM81 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM82 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM83 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM84 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM85 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM86 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM87 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM88 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM89 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM90 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM91 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM92 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM93 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM94 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM95 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM96 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM97 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM98 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM99 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_TM100 - ITEM_TM01] = MOVE_NONE, // Todo - [ITEM_HM01 - ITEM_TM01] = MOVE_CUT, - [ITEM_HM02 - ITEM_TM01] = MOVE_FLY, - [ITEM_HM03 - ITEM_TM01] = MOVE_SURF, - [ITEM_HM04 - ITEM_TM01] = MOVE_STRENGTH, - [ITEM_HM05 - ITEM_TM01] = MOVE_FLASH, - [ITEM_HM06 - ITEM_TM01] = MOVE_ROCK_SMASH, - [ITEM_HM07 - ITEM_TM01] = MOVE_WATERFALL, - [ITEM_HM08 - ITEM_TM01] = MOVE_DIVE, -}; diff --git a/src/data/pokemon/evolution.h b/src/data/pokemon/evolution.h index 53745eea5b65..b26f5772576d 100644 --- a/src/data/pokemon/evolution.h +++ b/src/data/pokemon/evolution.h @@ -222,7 +222,8 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] = [SPECIES_SKITTY] = {{EVO_ITEM, ITEM_MOON_STONE, SPECIES_DELCATTY}}, [SPECIES_BALTOY] = {{EVO_LEVEL, 36, SPECIES_CLAYDOL}}, #if P_GEN_4_POKEMON == TRUE - [SPECIES_NOSEPASS] = {{EVO_MAPSEC, MAPSEC_NEW_MAUVILLE, SPECIES_PROBOPASS}}, + [SPECIES_NOSEPASS] = {{EVO_MAPSEC, MAPSEC_NEW_MAUVILLE, SPECIES_PROBOPASS}, + {EVO_ITEM, ITEM_THUNDER_STONE, SPECIES_PROBOPASS}}, #endif [SPECIES_BARBOACH] = {{EVO_LEVEL, 30, SPECIES_WHISCASH}}, [SPECIES_CORPHISH] = {{EVO_LEVEL, 30, SPECIES_CRAWDAUNT}}, @@ -439,8 +440,10 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] = [SPECIES_AMAURA] = {{EVO_LEVEL_NIGHT, 39, SPECIES_AURORUS}}, [SPECIES_GOOMY] = {{EVO_LEVEL, 40, SPECIES_SLIGGOO}, {EVO_NONE, 0, SPECIES_SLIGGOO_HISUIAN}}, - [SPECIES_SLIGGOO] = {{EVO_LEVEL_RAIN, 50, SPECIES_GOODRA}}, - [SPECIES_SLIGGOO_HISUIAN] = {{EVO_LEVEL_RAIN, 40, SPECIES_GOODRA_HISUIAN}}, + [SPECIES_SLIGGOO] = {{EVO_LEVEL_RAIN, 50, SPECIES_GOODRA}, + {EVO_LEVEL_FOG, 50, SPECIES_GOODRA}}, + [SPECIES_SLIGGOO_HISUIAN] = {{EVO_LEVEL_RAIN, 50, SPECIES_GOODRA_HISUIAN}, + {EVO_LEVEL_FOG, 50, SPECIES_GOODRA_HISUIAN}}, [SPECIES_PHANTUMP] = {{EVO_TRADE, 0, SPECIES_TREVENANT}, {EVO_ITEM, ITEM_LINKING_CORD, SPECIES_TREVENANT}}, [SPECIES_PUMPKABOO] = {{EVO_TRADE, 0, SPECIES_GOURGEIST}, @@ -463,7 +466,8 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] = [SPECIES_GRUBBIN] = {{EVO_LEVEL, 20, SPECIES_CHARJABUG}}, [SPECIES_CHARJABUG] = {{EVO_MAPSEC, MAPSEC_NEW_MAUVILLE, SPECIES_VIKAVOLT}, {EVO_ITEM, ITEM_THUNDER_STONE, SPECIES_VIKAVOLT}}, - [SPECIES_CRABRAWLER] = {{EVO_SPECIFIC_MAP, MAP_SHOAL_CAVE_LOW_TIDE_ICE_ROOM, SPECIES_CRABOMINABLE}}, + [SPECIES_CRABRAWLER] = {{EVO_SPECIFIC_MAP, MAP_SHOAL_CAVE_LOW_TIDE_ICE_ROOM, SPECIES_CRABOMINABLE}, + {EVO_ITEM, ITEM_ICE_STONE, SPECIES_CRABOMINABLE}}, [SPECIES_CUTIEFLY] = {{EVO_LEVEL, 25, SPECIES_RIBOMBEE}}, [SPECIES_ROCKRUFF] = {{EVO_LEVEL_DAY, 25, SPECIES_LYCANROC}, {EVO_LEVEL_NIGHT, 25, SPECIES_LYCANROC_MIDNIGHT}}, diff --git a/src/data/pokemon/form_change_table_pointers.h b/src/data/pokemon/form_change_table_pointers.h index 8453ed480efb..9f75ee3e2714 100644 --- a/src/data/pokemon/form_change_table_pointers.h +++ b/src/data/pokemon/form_change_table_pointers.h @@ -210,6 +210,8 @@ const struct FormChange *const gFormChangeTablePointers[NUM_SPECIES] = [SPECIES_MINIOR_CORE_VIOLET] = sMiniorVioletFormChangeTable, [SPECIES_MINIOR_METEOR_YELLOW] = sMiniorYellowFormChangeTable, [SPECIES_MINIOR_CORE_YELLOW] = sMiniorYellowFormChangeTable, + [SPECIES_NECROZMA_DUSK_MANE] = sNecrozmaDuskManeFormChangeTable, + [SPECIES_NECROZMA_DAWN_WINGS] = sNecrozmaDawnWingsFormChangeTable, #endif #if P_GEN_8_POKEMON == TRUE [SPECIES_CRAMORANT] = sCramorantFormChangeTable, diff --git a/src/data/pokemon/form_change_tables.h b/src/data/pokemon/form_change_tables.h index 1d9b0e8dc9c8..2db4d8a1d3b1 100644 --- a/src/data/pokemon/form_change_tables.h +++ b/src/data/pokemon/form_change_tables.h @@ -548,6 +548,14 @@ static const struct FormChange sMiniorYellowFormChangeTable[] = { {FORM_CHANGE_END_BATTLE, SPECIES_MINIOR_CORE_YELLOW}, {FORM_CHANGE_TERMINATOR}, }; +static const struct FormChange sNecrozmaDuskManeFormChangeTable[] = { + {FORM_CHANGE_BATTLE_ULTRA_BURST, SPECIES_NECROZMA_ULTRA, ITEM_ULTRANECROZIUM_Z}, + {FORM_CHANGE_TERMINATOR}, +}; +static const struct FormChange sNecrozmaDawnWingsFormChangeTable[] = { + {FORM_CHANGE_BATTLE_ULTRA_BURST, SPECIES_NECROZMA_ULTRA, ITEM_ULTRANECROZIUM_Z}, + {FORM_CHANGE_TERMINATOR}, +}; #endif #if P_GEN_8_POKEMON == TRUE diff --git a/src/data/pokemon/species_info.h b/src/data/pokemon/species_info.h index b83f2da9a7f5..668c1dede900 100644 --- a/src/data/pokemon/species_info.h +++ b/src/data/pokemon/species_info.h @@ -3928,7 +3928,6 @@ const struct SpeciesInfo gSpeciesInfo[] = .abilities = {ABILITY_RUN_AWAY, ABILITY_ADAPTABILITY, ABILITY_ANTICIPATION}, .bodyColor = BODY_COLOR_BROWN, .noFlip = FALSE, - .flags = SPECIES_FLAG_GENDER_DIFFERENCE, }, [SPECIES_VAPOREON] = @@ -10007,7 +10006,6 @@ const struct SpeciesInfo gSpeciesInfo[] = .abilities = {ABILITY_KEEN_EYE, ABILITY_NONE, ABILITY_RECKLESS}, .bodyColor = BODY_COLOR_BROWN, .noFlip = FALSE, - .flags = SPECIES_FLAG_GENDER_DIFFERENCE, }, [SPECIES_STARAVIA] = @@ -10030,7 +10028,6 @@ const struct SpeciesInfo gSpeciesInfo[] = .abilities = {ABILITY_INTIMIDATE, ABILITY_NONE, ABILITY_RECKLESS}, .bodyColor = BODY_COLOR_BROWN, .noFlip = FALSE, - .flags = SPECIES_FLAG_GENDER_DIFFERENCE, }, [SPECIES_STARAPTOR] = @@ -10079,7 +10076,6 @@ const struct SpeciesInfo gSpeciesInfo[] = .abilities = {ABILITY_SIMPLE, ABILITY_UNAWARE, ABILITY_MOODY}, .bodyColor = BODY_COLOR_BROWN, .noFlip = FALSE, - .flags = SPECIES_FLAG_GENDER_DIFFERENCE, }, [SPECIES_BIBAREL] = @@ -10125,7 +10121,6 @@ const struct SpeciesInfo gSpeciesInfo[] = .abilities = {ABILITY_SHED_SKIN, ABILITY_NONE, ABILITY_RUN_AWAY}, .bodyColor = BODY_COLOR_RED, .noFlip = FALSE, - .flags = SPECIES_FLAG_GENDER_DIFFERENCE, }, [SPECIES_KRICKETUNE] = @@ -10149,7 +10144,6 @@ const struct SpeciesInfo gSpeciesInfo[] = .abilities = {ABILITY_SWARM, ABILITY_NONE, ABILITY_TECHNICIAN}, .bodyColor = BODY_COLOR_RED, .noFlip = FALSE, - .flags = SPECIES_FLAG_GENDER_DIFFERENCE, }, [SPECIES_SHINX] = @@ -10172,7 +10166,6 @@ const struct SpeciesInfo gSpeciesInfo[] = .abilities = {ABILITY_RIVALRY, ABILITY_INTIMIDATE, ABILITY_GUTS}, .bodyColor = BODY_COLOR_BLUE, .noFlip = FALSE, - .flags = SPECIES_FLAG_GENDER_DIFFERENCE, }, [SPECIES_LUXIO] = @@ -10427,7 +10420,6 @@ const struct SpeciesInfo gSpeciesInfo[] = .abilities = {ABILITY_HONEY_GATHER, ABILITY_NONE, ABILITY_HUSTLE}, .bodyColor = BODY_COLOR_YELLOW, .noFlip = FALSE, - .flags = SPECIES_FLAG_GENDER_DIFFERENCE, }, [SPECIES_VESPIQUEN] = @@ -11134,7 +11126,6 @@ const struct SpeciesInfo gSpeciesInfo[] = .abilities = {ABILITY_SAND_STREAM, ABILITY_NONE, ABILITY_SAND_FORCE}, .bodyColor = BODY_COLOR_BROWN, .noFlip = FALSE, - .flags = SPECIES_FLAG_GENDER_DIFFERENCE, }, [SPECIES_HIPPOWDON] = @@ -11157,7 +11148,6 @@ const struct SpeciesInfo gSpeciesInfo[] = .abilities = {ABILITY_SAND_STREAM, ABILITY_NONE, ABILITY_SAND_FORCE}, .bodyColor = BODY_COLOR_BROWN, .noFlip = FALSE, - .flags = SPECIES_FLAG_GENDER_DIFFERENCE, }, [SPECIES_SKORUPI] = @@ -12780,7 +12770,6 @@ const struct SpeciesInfo gSpeciesInfo[] = .abilities = {ABILITY_BIG_PECKS, ABILITY_SUPER_LUCK, ABILITY_RIVALRY}, .bodyColor = BODY_COLOR_GRAY, .noFlip = FALSE, - .flags = SPECIES_FLAG_GENDER_DIFFERENCE, }, [SPECIES_BLITZLE] = @@ -14394,7 +14383,6 @@ const struct SpeciesInfo gSpeciesInfo[] = .abilities = {ABILITY_WATER_ABSORB, ABILITY_CURSED_BODY, ABILITY_DAMP}, .bodyColor = BODY_COLOR_WHITE, .noFlip = FALSE, - .flags = SPECIES_FLAG_GENDER_DIFFERENCE, }, [SPECIES_JELLICENT] = @@ -14417,7 +14405,6 @@ const struct SpeciesInfo gSpeciesInfo[] = .abilities = {ABILITY_WATER_ABSORB, ABILITY_CURSED_BODY, ABILITY_DAMP}, .bodyColor = BODY_COLOR_WHITE, .noFlip = FALSE, - .flags = SPECIES_FLAG_GENDER_DIFFERENCE, }, [SPECIES_ALOMOMOLA] = @@ -16077,7 +16064,6 @@ const struct SpeciesInfo gSpeciesInfo[] = .abilities = {ABILITY_RIVALRY, ABILITY_UNNERVE, ABILITY_MOXIE}, .bodyColor = BODY_COLOR_BROWN, .noFlip = FALSE, - .flags = SPECIES_FLAG_GENDER_DIFFERENCE, }, [SPECIES_FLABEBE] = FLABEBE_SPECIES_INFO, @@ -24498,7 +24484,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .abilities = {ABILITY_NEUROFORCE, ABILITY_NONE}, .bodyColor = BODY_COLOR_YELLOW, .noFlip = TRUE, - .flags = SPECIES_FLAG_LEGENDARY, + .flags = SPECIES_FLAG_LEGENDARY | SPECIES_FLAG_ULTRA_BURST, }, [SPECIES_MAGEARNA_ORIGINAL_COLOR] = MAGEARNA_SPECIES_INFO(BODY_COLOR_RED), diff --git a/src/data/pokemon_graphics/back_pic_coordinates.h b/src/data/pokemon_graphics/back_pic_coordinates.h index 06bf461c9a4d..d967a50fcabb 100644 --- a/src/data/pokemon_graphics/back_pic_coordinates.h +++ b/src/data/pokemon_graphics/back_pic_coordinates.h @@ -21,7 +21,7 @@ // the sprite's non-transparent pixels actually are. // .size is the dimensions of this drawn pixel area. // .y_offset is the number of pixels between the drawn pixel area and the bottom edge. -const struct MonCoords gMonBackPicCoords[] = +const struct MonCoords gMonBackPicCoords[NUM_SPECIES + 1] = { [SPECIES_NONE] = { .size = MON_COORDS_SIZE(40, 40), .y_offset = 12 }, [SPECIES_BULBASAUR] = { .size = MON_COORDS_SIZE(56, 40), .y_offset = 13 }, @@ -480,7 +480,7 @@ const struct MonCoords gMonBackPicCoords[] = [SPECIES_CROAGUNK] = { .size = MON_COORDS_SIZE(56, 56), .y_offset = 6 }, [SPECIES_TOXICROAK] = { .size = MON_COORDS_SIZE(56, 56), .y_offset = 6 }, [SPECIES_CARNIVINE] = { .size = MON_COORDS_SIZE(64, 56), .y_offset = 6 }, - [SPECIES_FINNEON] = { .size = MON_COORDS_SIZE(56, 40), .y_offset = 13 }, + [SPECIES_FINNEON] = { .size = MON_COORDS_SIZE(56, 40), .y_offset = 12 }, [SPECIES_LUMINEON] = { .size = MON_COORDS_SIZE(56, 64), .y_offset = 0 }, [SPECIES_MANTYKE] = { .size = MON_COORDS_SIZE(64, 56), .y_offset = 6 }, [SPECIES_SNOVER] = { .size = MON_COORDS_SIZE(64, 56), .y_offset = 6 }, @@ -1013,7 +1013,7 @@ const struct MonCoords gMonBackPicCoords[] = [SPECIES_GOLEM_ALOLAN] = { .size = MON_COORDS_SIZE(64, 48), .y_offset = 13 }, [SPECIES_GRIMER_ALOLAN] = { .size = MON_COORDS_SIZE(64, 40), .y_offset = 14 }, [SPECIES_MUK_ALOLAN] = { .size = MON_COORDS_SIZE(64, 56), .y_offset = 6 }, - [SPECIES_EXEGGUTOR_ALOLAN] = { .size = MON_COORDS_SIZE(64, 56), .y_offset = 4 }, + [SPECIES_EXEGGUTOR_ALOLAN] = { .size = MON_COORDS_SIZE(64, 56), .y_offset = 0 }, [SPECIES_MAROWAK_ALOLAN] = { .size = MON_COORDS_SIZE(56, 56), .y_offset = 6 }, // Galarian Forms [SPECIES_MEOWTH_GALARIAN] = { .size = MON_COORDS_SIZE(64, 56), .y_offset = 8 }, diff --git a/src/data/pokemon_graphics/back_pic_table.h b/src/data/pokemon_graphics/back_pic_table.h index 32864907bbe5..a232abb567ea 100644 --- a/src/data/pokemon_graphics/back_pic_table.h +++ b/src/data/pokemon_graphics/back_pic_table.h @@ -1,4 +1,4 @@ -const struct CompressedSpriteSheet gMonBackPicTable[] = +const struct CompressedSpriteSheet gMonBackPicTable[NUM_SPECIES + 1] = { SPECIES_SPRITE(NONE, gMonBackPic_CircledQuestionMark), SPECIES_SPRITE(BULBASAUR, gMonBackPic_Bulbasaur), @@ -1338,9 +1338,67 @@ const struct CompressedSpriteSheet gMonBackPicTable[] = SPECIES_SPRITE(EGG, gMonFrontPic_Egg), }; -const struct CompressedSpriteSheet gMonBackPicTableFemale[] = +const struct CompressedSpriteSheet gMonBackPicTableFemale[NUM_SPECIES + 1] = { + SPECIES_SPRITE(VENUSAUR, gMonBackPic_VenusaurF), + SPECIES_SPRITE(BUTTERFREE, gMonBackPic_ButterfreeF), + SPECIES_SPRITE(RATTATA, gMonBackPic_RattataF), + SPECIES_SPRITE(RATICATE, gMonBackPic_RaticateF), + SPECIES_SPRITE(PIKACHU, gMonBackPic_PikachuF), + SPECIES_SPRITE(ZUBAT, gMonBackPic_ZubatF), + SPECIES_SPRITE(GOLBAT, gMonBackPic_GolbatF), + SPECIES_SPRITE(GLOOM, gMonBackPic_GloomF), + SPECIES_SPRITE(VILEPLUME, gMonBackPic_VileplumeF), + SPECIES_SPRITE(KADABRA, gMonBackPic_KadabraF), + SPECIES_SPRITE(ALAKAZAM, gMonBackPic_AlakazamF), + SPECIES_SPRITE(DODUO, gMonBackPic_DoduoF), + SPECIES_SPRITE(DODRIO, gMonBackPic_DodrioF), + SPECIES_SPRITE(HYPNO, gMonBackPic_HypnoF), + SPECIES_SPRITE(RHYHORN, gMonBackPic_RhyhornF), + SPECIES_SPRITE(RHYDON, gMonBackPic_RhydonF), + SPECIES_SPRITE(GOLDEEN, gMonBackPic_GoldeenF), + SPECIES_SPRITE(SEAKING, gMonBackPic_SeakingF), + SPECIES_SPRITE(MAGIKARP, gMonBackPic_MagikarpF), + SPECIES_SPRITE(GYARADOS, gMonBackPic_GyaradosF), SPECIES_SPRITE(EEVEE, gMonBackPic_EeveeF), + SPECIES_SPRITE(MEGANIUM, gMonBackPic_MeganiumF), + SPECIES_SPRITE(LEDYBA, gMonBackPic_LedybaF), + SPECIES_SPRITE(LEDIAN, gMonBackPic_LedianF), + SPECIES_SPRITE(SUDOWOODO, gMonBackPic_SudowoodoF), + SPECIES_SPRITE(POLITOED, gMonBackPic_PolitoedF), + SPECIES_SPRITE(AIPOM, gMonBackPic_AipomF), + SPECIES_SPRITE(WOOPER, gMonBackPic_WooperF), + SPECIES_SPRITE(QUAGSIRE, gMonBackPic_QuagsireF), + SPECIES_SPRITE(MURKROW, gMonBackPic_MurkrowF), + SPECIES_SPRITE(WOBBUFFET, gMonBackPic_WobbuffetF), + SPECIES_SPRITE(GIRAFARIG, gMonBackPic_GirafarigF), + SPECIES_SPRITE(GLIGAR, gMonBackPic_GligarF), + SPECIES_SPRITE(STEELIX, gMonBackPic_SteelixF), + SPECIES_SPRITE(HERACROSS, gMonBackPic_HeracrossF), + SPECIES_SPRITE(SNEASEL, gMonBackPic_SneaselF), + SPECIES_SPRITE(URSARING, gMonBackPic_UrsaringF), + SPECIES_SPRITE(PILOSWINE, gMonBackPic_PiloswineF), + SPECIES_SPRITE(OCTILLERY, gMonBackPic_OctilleryF), + SPECIES_SPRITE(HOUNDOOM, gMonBackPic_HoundoomF), + SPECIES_SPRITE(DONPHAN, gMonBackPic_DonphanF), + SPECIES_SPRITE(TORCHIC, gMonBackPic_TorchicF), + SPECIES_SPRITE(COMBUSKEN, gMonBackPic_CombuskenF), + SPECIES_SPRITE(BLAZIKEN, gMonBackPic_BlazikenF), + SPECIES_SPRITE(BEAUTIFLY, gMonBackPic_BeautiflyF), + SPECIES_SPRITE(DUSTOX, gMonBackPic_DustoxF), + SPECIES_SPRITE(LUDICOLO, gMonBackPic_LudicoloF), + SPECIES_SPRITE(NUZLEAF, gMonBackPic_NuzleafF), + SPECIES_SPRITE(SHIFTRY, gMonBackPic_ShiftryF), + SPECIES_SPRITE(MEDITITE, gMonBackPic_MedititeF), + SPECIES_SPRITE(MEDICHAM, gMonBackPic_MedichamF), + SPECIES_SPRITE(ROSELIA, gMonBackPic_RoseliaF), + SPECIES_SPRITE(GULPIN, gMonBackPic_GulpinF), + SPECIES_SPRITE(SWALOT, gMonBackPic_SwalotF), + SPECIES_SPRITE(NUMEL, gMonBackPic_NumelF), + SPECIES_SPRITE(CAMERUPT, gMonBackPic_CameruptF), + SPECIES_SPRITE(MILOTIC, gMonBackPic_MiloticF), + SPECIES_SPRITE(RELICANTH, gMonBackPic_RelicanthF), + #if P_GEN_4_POKEMON == TRUE SPECIES_SPRITE(STARLY, gMonBackPic_StarlyF), SPECIES_SPRITE(STARAVIA, gMonBackPic_StaraviaF), @@ -1349,9 +1407,21 @@ const struct CompressedSpriteSheet gMonBackPicTableFemale[] = SPECIES_SPRITE(KRICKETOT, gMonBackPic_KricketotF), SPECIES_SPRITE(KRICKETUNE, gMonBackPic_KricketuneF), SPECIES_SPRITE(SHINX, gMonBackPic_ShinxF), - SPECIES_SPRITE(COMBEE, gMonBackPic_Combee), - SPECIES_SPRITE(HIPPOPOTAS, gMonBackPic_Hippopotas), - SPECIES_SPRITE(HIPPOWDON, gMonBackPic_Hippowdon), + SPECIES_SPRITE(LUXIO, gMonBackPic_LuxioF), + SPECIES_SPRITE(LUXRAY, gMonBackPic_LuxrayF), + SPECIES_SPRITE(ROSERADE, gMonBackPic_RoseradeF), + SPECIES_SPRITE(BUIZEL, gMonBackPic_BuizelF), + SPECIES_SPRITE(FLOATZEL, gMonBackPic_FloatzelF), + SPECIES_SPRITE(AMBIPOM, gMonBackPic_AmbipomF), + SPECIES_SPRITE(GIBLE, gMonBackPic_GibleF), + SPECIES_SPRITE(GABITE, gMonBackPic_GabiteF), + SPECIES_SPRITE(CROAGUNK, gMonBackPic_CroagunkF), + SPECIES_SPRITE(TOXICROAK, gMonBackPic_ToxicroakF), + SPECIES_SPRITE(FINNEON, gMonBackPic_FinneonF), + SPECIES_SPRITE(LUMINEON, gMonBackPic_LumineonF), + SPECIES_SPRITE(SNOVER, gMonBackPic_SnoverF), + SPECIES_SPRITE(WEAVILE, gMonBackPic_WeavileF), + SPECIES_SPRITE(RHYPERIOR, gMonBackPic_RhyperiorF), #endif #if P_GEN_5_POKEMON == TRUE SPECIES_SPRITE(UNFEZANT, gMonBackPic_UnfezantF), @@ -1361,4 +1431,6 @@ const struct CompressedSpriteSheet gMonBackPicTableFemale[] = #if P_GEN_6_POKEMON == TRUE SPECIES_SPRITE(PYROAR, gMonBackPic_PyroarF), #endif + + SPECIES_SPRITE(SNEASEL_HISUIAN, gMonBackPic_SneaselHisuianF), }; diff --git a/src/data/pokemon_graphics/enemy_mon_elevation.h b/src/data/pokemon_graphics/enemy_mon_elevation.h index 64bd433fa4bb..007c6a90a77c 100644 --- a/src/data/pokemon_graphics/enemy_mon_elevation.h +++ b/src/data/pokemon_graphics/enemy_mon_elevation.h @@ -1,6 +1,6 @@ // This determines how much higher above the usual position the enemy Pokémon // is during battle. Species that float or fly have nonzero values. -const u8 gEnemyMonElevation[NUM_SPECIES] = +const u8 gEnemyMonElevation[NUM_SPECIES + 1] = { [SPECIES_BUTTERFREE] = 10, [SPECIES_BEEDRILL] = 9, @@ -9,7 +9,7 @@ const u8 gEnemyMonElevation[NUM_SPECIES] = [SPECIES_ZUBAT] = 16, [SPECIES_GOLBAT] = 10, [SPECIES_VENOMOTH] = 16, - [SPECIES_GEODUDE] = 16, + [SPECIES_GEODUDE] = 10, [SPECIES_MAGNEMITE] = 17, [SPECIES_MAGNETON] = 9, [SPECIES_GASTLY] = 10, diff --git a/src/data/pokemon_graphics/footprint_table.h b/src/data/pokemon_graphics/footprint_table.h index 8e21b0604eaf..38737ac43914 100644 --- a/src/data/pokemon_graphics/footprint_table.h +++ b/src/data/pokemon_graphics/footprint_table.h @@ -1,4 +1,4 @@ -const u8 *const gMonFootprintTable[] = +const u8 *const gMonFootprintTable[NUM_SPECIES + 1] = { [SPECIES_NONE] = gMonFootprint_Bulbasaur, [SPECIES_BULBASAUR] = gMonFootprint_Bulbasaur, diff --git a/src/data/pokemon_graphics/front_pic_anims.h b/src/data/pokemon_graphics/front_pic_anims.h index 326af6d1ee56..95ea6f943729 100644 --- a/src/data/pokemon_graphics/front_pic_anims.h +++ b/src/data/pokemon_graphics/front_pic_anims.h @@ -1,4 +1,13 @@ -static const union AnimCmd sAnim_None_1[] = +#define PLACEHOLDER_TWO_FRAME_ANIMATION(name) \ +static const union AnimCmd sAnim_##name##_1[] = \ +{ \ + ANIMCMD_FRAME(0, 30), \ + ANIMCMD_FRAME(1, 30), \ + ANIMCMD_FRAME(0, 1), \ + ANIMCMD_END, \ +} + +static const union AnimCmd sAnim_None_1[] = { ANIMCMD_FRAME(0, 30), ANIMCMD_FRAME(1, 30), @@ -55,9 +64,10 @@ static const union AnimCmd sAnim_Charizard_1[] = static const union AnimCmd sAnim_Squirtle_1[] = { - ANIMCMD_FRAME(1, 50), - ANIMCMD_FRAME(1, 50), - ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(1, 11), + ANIMCMD_FRAME(0, 11), + ANIMCMD_FRAME(1, 11), + ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; @@ -71,11 +81,10 @@ static const union AnimCmd sAnim_Wartortle_1[] = static const union AnimCmd sAnim_Blastoise_1[] = { - ANIMCMD_FRAME(0, 50), - ANIMCMD_FRAME(1, 25), + ANIMCMD_FRAME(1, 20), ANIMCMD_FRAME(0, 20), ANIMCMD_FRAME(1, 25), - ANIMCMD_FRAME(0, 1), + ANIMCMD_FRAME(0, 20), ANIMCMD_END, }; @@ -149,26 +158,19 @@ static const union AnimCmd sAnim_Beedrill_1[] = { ANIMCMD_FRAME(0, 5), ANIMCMD_FRAME(1, 35), - ANIMCMD_FRAME(0, 28), + ANIMCMD_FRAME(0, 15), ANIMCMD_FRAME(1, 10), ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(1, 20), + ANIMCMD_FRAME(0, 10), ANIMCMD_END, }; static const union AnimCmd sAnim_Pidgey_1[] = { - ANIMCMD_FRAME(1, 5), ANIMCMD_FRAME(0, 5), - ANIMCMD_FRAME(1, 5), - ANIMCMD_FRAME(0, 10), - ANIMCMD_FRAME(1, 5), - ANIMCMD_FRAME(0, 5), - ANIMCMD_FRAME(1, 5), - ANIMCMD_FRAME(0, 10), - ANIMCMD_FRAME(1, 5), + ANIMCMD_FRAME(1, 25), ANIMCMD_FRAME(0, 5), - ANIMCMD_FRAME(1, 5), - ANIMCMD_FRAME(0, 10), ANIMCMD_END, }; @@ -193,10 +195,10 @@ static const union AnimCmd sAnim_Pidgeot_1[] = static const union AnimCmd sAnim_Rattata_1[] = { - ANIMCMD_FRAME(0, 3), - ANIMCMD_FRAME(1, 50), - ANIMCMD_FRAME(1, 28), - ANIMCMD_FRAME(0, 5), + ANIMCMD_FRAME(1, 11), + ANIMCMD_FRAME(0, 11), + ANIMCMD_FRAME(1, 11), + ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; @@ -219,22 +221,10 @@ static const union AnimCmd sAnim_Raticate_1[] = static const union AnimCmd sAnim_Spearow_1[] = { - ANIMCMD_FRAME(0, 5), - ANIMCMD_FRAME(1, 5), - ANIMCMD_FRAME(0, 5), - ANIMCMD_FRAME(1, 5), - ANIMCMD_FRAME(0, 5), - ANIMCMD_FRAME(1, 5), - ANIMCMD_FRAME(0, 5), - ANIMCMD_FRAME(1, 5), - ANIMCMD_FRAME(0, 5), - ANIMCMD_FRAME(1, 5), - ANIMCMD_FRAME(0, 20), - ANIMCMD_FRAME(0, 5), - ANIMCMD_FRAME(1, 5), - ANIMCMD_FRAME(0, 5), - ANIMCMD_FRAME(1, 5), - ANIMCMD_FRAME(0, 5), + ANIMCMD_FRAME(1, 11), + ANIMCMD_FRAME(0, 11), + ANIMCMD_FRAME(1, 11), + ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; @@ -273,10 +263,9 @@ static const union AnimCmd sAnim_Arbok_1[] = static const union AnimCmd sAnim_Pikachu_1[] = { ANIMCMD_FRAME(0, 15), + ANIMCMD_FRAME(1, 60), ANIMCMD_FRAME(1, 20), - ANIMCMD_FRAME(0, 15), - ANIMCMD_FRAME(1, 20), - ANIMCMD_FRAME(0, 15), + ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; @@ -384,8 +373,8 @@ static const union AnimCmd sAnim_NidoranM_1[] = static const union AnimCmd sAnim_Nidorino_1[] = { - ANIMCMD_FRAME(0, 15), - ANIMCMD_FRAME(1, 15), + ANIMCMD_FRAME(0, 7), + ANIMCMD_FRAME(1, 23), ANIMCMD_FRAME(0, 5), ANIMCMD_END, }; @@ -409,11 +398,8 @@ static const union AnimCmd sAnim_Clefairy_1[] = static const union AnimCmd sAnim_Clefable_1[] = { - ANIMCMD_FRAME(1, 27), - ANIMCMD_FRAME(0, 27), - ANIMCMD_FRAME(1, 24), - ANIMCMD_FRAME(0, 25), - ANIMCMD_FRAME(1, 27), + ANIMCMD_FRAME(0, 16), + ANIMCMD_FRAME(1, 48), ANIMCMD_FRAME(0, 5), ANIMCMD_END, }; @@ -559,10 +545,7 @@ static const union AnimCmd sAnim_Gloom_1[] = static const union AnimCmd sAnim_Vileplume_1[] = { - ANIMCMD_FRAME(0, 50), - ANIMCMD_FRAME(1, 25), - ANIMCMD_FRAME(0, 20), - ANIMCMD_FRAME(1, 25), + ANIMCMD_FRAME(1, 38), ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; @@ -729,12 +712,13 @@ static const union AnimCmd sAnim_Mankey_1[] = static const union AnimCmd sAnim_Primeape_1[] = { - ANIMCMD_FRAME(1, 15), - ANIMCMD_FRAME(0, 15), - ANIMCMD_FRAME(1, 15), - ANIMCMD_FRAME(0, 15), - ANIMCMD_FRAME(1, 15), - ANIMCMD_FRAME(0, 15), + ANIMCMD_FRAME(0, 14), + ANIMCMD_FRAME(1, 14), + ANIMCMD_FRAME(0, 14), + ANIMCMD_FRAME(1, 14), + ANIMCMD_FRAME(0, 14), + ANIMCMD_FRAME(1, 10), + ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; @@ -751,12 +735,8 @@ static const union AnimCmd sAnim_Growlithe_1[] = static const union AnimCmd sAnim_Arcanine_1[] = { - ANIMCMD_FRAME(1, 8), - ANIMCMD_FRAME(0, 8), - ANIMCMD_FRAME(1, 8), - ANIMCMD_FRAME(0, 15), - ANIMCMD_FRAME(1, 40), - ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(1, 38), + ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; @@ -813,9 +793,7 @@ static const union AnimCmd sAnim_Alakazam_1[] = static const union AnimCmd sAnim_Machop_1[] = { - ANIMCMD_FRAME(0, 15), - ANIMCMD_FRAME(1, 15), - ANIMCMD_FRAME(0, 15), + ANIMCMD_FRAME(0, 6), ANIMCMD_FRAME(1, 15), ANIMCMD_FRAME(0, 15), ANIMCMD_FRAME(1, 15), @@ -925,7 +903,7 @@ static const union AnimCmd sAnim_Golem_1[] = static const union AnimCmd sAnim_Ponyta_1[] = { - ANIMCMD_FRAME(1, 45), + ANIMCMD_FRAME(1, 30), ANIMCMD_FRAME(0, 5), ANIMCMD_END, }; @@ -948,7 +926,6 @@ static const union AnimCmd sAnim_Slowpoke_1[] = static const union AnimCmd sAnim_Slowbro_1[] = { - ANIMCMD_FRAME(1, 50), ANIMCMD_FRAME(1, 45), ANIMCMD_FRAME(0, 10), ANIMCMD_END, @@ -3255,6 +3232,16 @@ static const union AnimCmd sAnim_Breloom_1[] = ANIMCMD_END, }; +static const union AnimCmd sAnim_Spinda_1[] = +{ + ANIMCMD_FRAME(0, 17), + ANIMCMD_FRAME(1, 23), + ANIMCMD_FRAME(0, 17), + ANIMCMD_FRAME(1, 23), + ANIMCMD_FRAME(0, 13), + ANIMCMD_END, +}; + static const union AnimCmd sAnim_Wingull_1[] = { ANIMCMD_FRAME(0, 17), @@ -4144,27 +4131,45 @@ static const union AnimCmd sAnim_Aggron_1[] = ANIMCMD_END, }; -static const union AnimCmd sAnim_Castform_0[] = +static const union AnimCmd sAnim_Castform_1[] = { - ANIMCMD_FRAME(0, 1), + ANIMCMD_FRAME(0, 12), + ANIMCMD_FRAME(1, 24), + ANIMCMD_FRAME(0, 24), + ANIMCMD_FRAME(1, 24), + ANIMCMD_FRAME(0, 24), ANIMCMD_END, }; -static const union AnimCmd sAnim_Castform_1[] = +static const union AnimCmd sAnim_CastformSunny_1[] = { - ANIMCMD_FRAME(1, 1), + ANIMCMD_FRAME(0, 12), + ANIMCMD_FRAME(1, 12), + ANIMCMD_FRAME(0, 12), + ANIMCMD_FRAME(1, 12), + ANIMCMD_FRAME(0, 12), + ANIMCMD_FRAME(1, 12), + ANIMCMD_FRAME(0, 12), ANIMCMD_END, }; -static const union AnimCmd sAnim_Castform_2[] = +static const union AnimCmd sAnim_CastformRainy_1[] = { - ANIMCMD_FRAME(2, 1), + ANIMCMD_FRAME(0, 22), + ANIMCMD_FRAME(1, 22), + ANIMCMD_FRAME(0, 22), + ANIMCMD_FRAME(1, 22), + ANIMCMD_FRAME(0, 11), ANIMCMD_END, }; -static const union AnimCmd sAnim_Castform_3[] = +static const union AnimCmd sAnim_CastformSnowy_1[] = { - ANIMCMD_FRAME(3, 1), + ANIMCMD_FRAME(0, 5), + ANIMCMD_FRAME(1, 12), + ANIMCMD_FRAME(0, 12), + ANIMCMD_FRAME(1, 29), + ANIMCMD_FRAME(0, 12), ANIMCMD_END, }; @@ -4818,7 +4823,6 @@ static const union AnimCmd sAnim_Prinplup_1[] = ANIMCMD_END, }; - static const union AnimCmd sAnim_Empoleon_1[] = { ANIMCMD_FRAME(0, 1), @@ -4923,7 +4927,6 @@ static const union AnimCmd sAnim_Shinx_1[] = ANIMCMD_END, }; - static const union AnimCmd sAnim_Luxio_1[] = { ANIMCMD_FRAME(1, 40), @@ -4990,7 +4993,6 @@ static const union AnimCmd sAnim_Shieldon_1[] = ANIMCMD_END, }; - static const union AnimCmd sAnim_Bastiodon_1[] = { ANIMCMD_FRAME(0, 10), @@ -5060,7 +5062,6 @@ static const union AnimCmd sAnim_Vespiquen_1[] = ANIMCMD_END, }; - static const union AnimCmd sAnim_Pachirisu_1[] = { ANIMCMD_FRAME(0, 5), @@ -5108,7 +5109,6 @@ static const union AnimCmd sAnim_Cherubi_1[] = ANIMCMD_END, }; - static const union AnimCmd sAnim_CherrimOvercast_1[] = { ANIMCMD_FRAME(0, 15), @@ -5130,15 +5130,12 @@ static const union AnimCmd sAnim_CherrimOvercast_2[] = static const union AnimCmd sAnim_CherrimSunshine_1[] = { - ANIMCMD_FRAME(0, 10), - ANIMCMD_FRAME(1, 10), - ANIMCMD_FRAME(0, 10), - ANIMCMD_FRAME(1, 10), - ANIMCMD_FRAME(0, 10), - ANIMCMD_FRAME(1, 10), - ANIMCMD_FRAME(0, 10), - ANIMCMD_FRAME(1, 10), - ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(1, 6), + ANIMCMD_FRAME(0, 28), + ANIMCMD_FRAME(1, 12), + ANIMCMD_FRAME(0, 28), + ANIMCMD_FRAME(1, 7), + ANIMCMD_FRAME(0, 8), ANIMCMD_END, }; @@ -5196,7 +5193,6 @@ static const union AnimCmd sAnim_Buneary_1[] = ANIMCMD_END, }; - static const union AnimCmd sAnim_Lopunny_1[] = { ANIMCMD_FRAME(0, 15), @@ -5784,7 +5780,6 @@ static const union AnimCmd sAnim_RotomHeat_1[] = ANIMCMD_END, }; - static const union AnimCmd sAnim_RotomWash_1[] = { ANIMCMD_FRAME(0, 30), @@ -8477,18 +8472,28 @@ static const union AnimCmd sAnim_Gumshoos_1[] = static const union AnimCmd sAnim_Grubbin_1[] = { + ANIMCMD_FRAME(0, 1), + ANIMCMD_FRAME(1, 15), ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; static const union AnimCmd sAnim_Charjabug_1[] = { + ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(1, 15), ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; static const union AnimCmd sAnim_Vikavolt_1[] = { + ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(1, 10), + ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(1, 10), + ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(1, 10), ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; @@ -8567,12 +8572,19 @@ static const union AnimCmd sAnim_Mudsdale_1[] = static const union AnimCmd sAnim_Dewpider_1[] = { + ANIMCMD_FRAME(0, 1), + ANIMCMD_FRAME(1, 9), + ANIMCMD_FRAME(0, 9), + ANIMCMD_FRAME(0, 1), + ANIMCMD_FRAME(1, 9), ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; static const union AnimCmd sAnim_Araquanid_1[] = { + ANIMCMD_FRAME(0, 1), + ANIMCMD_FRAME(1, 45), ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; @@ -8603,25 +8615,33 @@ static const union AnimCmd sAnim_Shiinotic_1[] = static const union AnimCmd sAnim_Salandit_1[] = { - ANIMCMD_FRAME(0, 1), + ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(1, 50), + ANIMCMD_FRAME(0, 10), ANIMCMD_END, }; static const union AnimCmd sAnim_Salazzle_1[] = { + ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(1, 30), ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; static const union AnimCmd sAnim_Stufful_1[] = { - ANIMCMD_FRAME(0, 1), + ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(1, 44), + ANIMCMD_FRAME(0, 10), ANIMCMD_END, }; static const union AnimCmd sAnim_Bewear_1[] = { - ANIMCMD_FRAME(0, 1), + ANIMCMD_FRAME(0, 20), + ANIMCMD_FRAME(1, 60), + ANIMCMD_FRAME(0, 10), ANIMCMD_END, }; @@ -8663,12 +8683,16 @@ static const union AnimCmd sAnim_Passimian_1[] = static const union AnimCmd sAnim_Wimpod_1[] = { + ANIMCMD_FRAME(0, 1), + ANIMCMD_FRAME(1, 25), ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; static const union AnimCmd sAnim_Golisopod_1[] = { + ANIMCMD_FRAME(0, 25), + ANIMCMD_FRAME(1, 15), ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; @@ -8687,6 +8711,8 @@ static const union AnimCmd sAnim_Palossand_1[] = static const union AnimCmd sAnim_Pyukumuku_1[] = { + ANIMCMD_FRAME(0, 1), + ANIMCMD_FRAME(1, 25), ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; @@ -8717,7 +8743,9 @@ static const union AnimCmd sAnim_Komala_1[] = static const union AnimCmd sAnim_Turtonator_1[] = { - ANIMCMD_FRAME(0, 1), + ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(1, 44), + ANIMCMD_FRAME(0, 10), ANIMCMD_END, }; @@ -8753,18 +8781,26 @@ static const union AnimCmd sAnim_Dhelmise_1[] = static const union AnimCmd sAnim_JANGMO_O_1[] = { + ANIMCMD_FRAME(0, 1), + ANIMCMD_FRAME(1, 25), ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; static const union AnimCmd sAnim_HAKAMO_O_1[] = { - ANIMCMD_FRAME(0, 1), + ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(1, 30), + ANIMCMD_FRAME(0, 10), ANIMCMD_END, }; static const union AnimCmd sAnim_KOMMO_O_1[] = { + ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(1, 20), + ANIMCMD_FRAME(0, 20), + ANIMCMD_FRAME(1, 20), ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; @@ -9004,18 +9040,32 @@ static const union AnimCmd sAnim_Greedent_1[] = static const union AnimCmd sAnim_Rookidee_1[] = { + ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(1, 15), + ANIMCMD_FRAME(0, 15), + ANIMCMD_FRAME(1, 25), + ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(1, 10), ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; static const union AnimCmd sAnim_Corvisquire_1[] = { + ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(1, 10), + ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(1, 10), + ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(1, 10), ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; static const union AnimCmd sAnim_Corviknight_1[] = { + ANIMCMD_FRAME(0, 1), + ANIMCMD_FRAME(1, 50), ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; @@ -9076,12 +9126,16 @@ static const union AnimCmd sAnim_Dubwool_1[] = static const union AnimCmd sAnim_Chewtle_1[] = { + ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(1, 20), ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; static const union AnimCmd sAnim_Drednaw_1[] = { + ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(1, 30), ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; @@ -9098,41 +9152,12 @@ static const union AnimCmd sAnim_Boltund_1[] = ANIMCMD_END, }; -static const union AnimCmd sAnim_Rolycoly_1[] = -{ - ANIMCMD_FRAME(0, 1), - ANIMCMD_END, -}; - -static const union AnimCmd sAnim_Carkol_1[] = -{ - ANIMCMD_FRAME(0, 1), - ANIMCMD_END, -}; - -static const union AnimCmd sAnim_Coalossal_1[] = -{ - ANIMCMD_FRAME(0, 1), - ANIMCMD_END, -}; - -static const union AnimCmd sAnim_Applin_1[] = -{ - ANIMCMD_FRAME(0, 1), - ANIMCMD_END, -}; - -static const union AnimCmd sAnim_Flapple_1[] = -{ - ANIMCMD_FRAME(0, 1), - ANIMCMD_END, -}; - -static const union AnimCmd sAnim_Appletun_1[] = -{ - ANIMCMD_FRAME(0, 1), - ANIMCMD_END, -}; +PLACEHOLDER_TWO_FRAME_ANIMATION(Rolycoly); +PLACEHOLDER_TWO_FRAME_ANIMATION(Carkol); +PLACEHOLDER_TWO_FRAME_ANIMATION(Coalossal); +PLACEHOLDER_TWO_FRAME_ANIMATION(Applin); +PLACEHOLDER_TWO_FRAME_ANIMATION(Flapple); +PLACEHOLDER_TWO_FRAME_ANIMATION(Appletun); static const union AnimCmd sAnim_Silicobra_1[] = { @@ -9178,12 +9203,16 @@ static const union AnimCmd sAnim_Toxtricity_1[] = static const union AnimCmd sAnim_Sizzlipede_1[] = { + ANIMCMD_FRAME(0, 1), + ANIMCMD_FRAME(1, 25), ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; static const union AnimCmd sAnim_Centiskorch_1[] = { + ANIMCMD_FRAME(0, 1), + ANIMCMD_FRAME(1, 35), ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; @@ -9302,11 +9331,7 @@ static const union AnimCmd sAnim_Falinks_1[] = ANIMCMD_END, }; -static const union AnimCmd sAnim_Pincurchin_1[] = -{ - ANIMCMD_FRAME(0, 1), - ANIMCMD_END, -}; +PLACEHOLDER_TWO_FRAME_ANIMATION(Pincurchin); static const union AnimCmd sAnim_Snom_1[] = { @@ -9913,11 +9938,7 @@ static const union AnimCmd sAnim_MukAlolan_1[] = ANIMCMD_END, }; -static const union AnimCmd sAnim_ExeggutorAlolan_1[] = -{ - ANIMCMD_FRAME(0, 1), - ANIMCMD_END, -}; +PLACEHOLDER_TWO_FRAME_ANIMATION(ExeggutorAlolan); static const union AnimCmd sAnim_MarowakAlolan_1[] = { @@ -10793,9 +10814,7 @@ SINGLE_ANIMATION(Taillow); SINGLE_ANIMATION(Swellow); SINGLE_ANIMATION(Shroomish); SINGLE_ANIMATION(Breloom); -static const union AnimCmd *const sAnims_Spinda[] ={ - sAnim_GeneralFrame0, -}; +SINGLE_ANIMATION(Spinda); SINGLE_ANIMATION(Wingull); SINGLE_ANIMATION(Pelipper); DOUBLE_ANIMATION(Surskit); @@ -10872,12 +10891,10 @@ SINGLE_ANIMATION(Relicanth); SINGLE_ANIMATION(Aron); SINGLE_ANIMATION(Lairon); SINGLE_ANIMATION(Aggron); -static const union AnimCmd *const sAnims_Castform[] ={ - sAnim_Castform_0, - sAnim_Castform_1, - sAnim_Castform_2, - sAnim_Castform_3, -}; +SINGLE_ANIMATION(Castform); +SINGLE_ANIMATION(CastformSunny); +SINGLE_ANIMATION(CastformRainy); +SINGLE_ANIMATION(CastformSnowy); SINGLE_ANIMATION(Volbeat); SINGLE_ANIMATION(Illumise); SINGLE_ANIMATION(Lileep); @@ -11637,7 +11654,7 @@ SINGLE_ANIMATION(LycanrocDusk); SINGLE_ANIMATION(EnamorusTherian); #endif -const union AnimCmd *const *const gMonFrontAnimsPtrTable[] = +const union AnimCmd *const *const gMonFrontAnimsPtrTable[NUM_SPECIES + 1] = { [SPECIES_NONE] = sAnims_None, [SPECIES_BULBASAUR] = sAnims_Bulbasaur, @@ -12714,9 +12731,9 @@ const union AnimCmd *const *const gMonFrontAnimsPtrTable[] = [SPECIES_UNOWN_Z] = sAnims_UnownZ, [SPECIES_UNOWN_EMARK] = sAnims_UnownEMark, [SPECIES_UNOWN_QMARK] = sAnims_UnownQMark, - [SPECIES_CASTFORM_SUNNY] = sAnims_Castform, - [SPECIES_CASTFORM_RAINY] = sAnims_Castform, - [SPECIES_CASTFORM_SNOWY] = sAnims_Castform, + [SPECIES_CASTFORM_SUNNY] = sAnims_CastformSunny, + [SPECIES_CASTFORM_RAINY] = sAnims_CastformRainy, + [SPECIES_CASTFORM_SNOWY] = sAnims_CastformSnowy, [SPECIES_DEOXYS_ATTACK] = sAnims_DeoxysAttack, [SPECIES_DEOXYS_DEFENSE] = sAnims_DeoxysDefense, [SPECIES_DEOXYS_SPEED] = sAnims_DeoxysSpeed, diff --git a/src/data/pokemon_graphics/front_pic_coordinates.h b/src/data/pokemon_graphics/front_pic_coordinates.h index ea158229c5f6..897ce63308dc 100644 --- a/src/data/pokemon_graphics/front_pic_coordinates.h +++ b/src/data/pokemon_graphics/front_pic_coordinates.h @@ -2,18 +2,18 @@ // the sprite's non-transparent pixels actually are. // .size is the dimensions of this drawn pixel area. // .y_offset is the number of pixels between the drawn pixel area and the bottom edge. -const struct MonCoords gMonFrontPicCoords[] = +const struct MonCoords gMonFrontPicCoords[NUM_SPECIES + 1] = { [SPECIES_NONE] = { .size = MON_COORDS_SIZE(40, 40), .y_offset = 12 }, [SPECIES_BULBASAUR] = { .size = MON_COORDS_SIZE(40, 40), .y_offset = 13 }, [SPECIES_IVYSAUR] = { .size = MON_COORDS_SIZE(56, 48), .y_offset = 9 }, [SPECIES_VENUSAUR] = { .size = MON_COORDS_SIZE(64, 64), .y_offset = 3 }, [SPECIES_CHARMANDER] = { .size = MON_COORDS_SIZE(48, 48), .y_offset = 10 }, - [SPECIES_CHARMELEON] = { .size = MON_COORDS_SIZE(56, 56), .y_offset = 7 }, + [SPECIES_CHARMELEON] = { .size = MON_COORDS_SIZE(56, 56), .y_offset = 8 }, [SPECIES_CHARIZARD] = { .size = MON_COORDS_SIZE(64, 64), .y_offset = 0 }, [SPECIES_SQUIRTLE] = { .size = MON_COORDS_SIZE(40, 48), .y_offset = 11 }, [SPECIES_WARTORTLE] = { .size = MON_COORDS_SIZE(56, 56), .y_offset = 7 }, - [SPECIES_BLASTOISE] = { .size = MON_COORDS_SIZE(64, 64), .y_offset = 3 }, + [SPECIES_BLASTOISE] = { .size = MON_COORDS_SIZE(64, 64), .y_offset = 4 }, [SPECIES_CATERPIE] = { .size = MON_COORDS_SIZE(40, 40), .y_offset = 12 }, [SPECIES_METAPOD] = { .size = MON_COORDS_SIZE(40, 40), .y_offset = 14 }, [SPECIES_BUTTERFREE] = { .size = MON_COORDS_SIZE(64, 56), .y_offset = 10 }, @@ -47,10 +47,10 @@ const struct MonCoords gMonFrontPicCoords[] = [SPECIES_WIGGLYTUFF] = { .size = MON_COORDS_SIZE(48, 64), .y_offset = 4 }, [SPECIES_ZUBAT] = { .size = MON_COORDS_SIZE(56, 48), .y_offset = 16 }, [SPECIES_GOLBAT] = { .size = MON_COORDS_SIZE(64, 56), .y_offset = 7 }, - [SPECIES_ODDISH] = { .size = MON_COORDS_SIZE(40, 40), .y_offset = 14 }, + [SPECIES_ODDISH] = { .size = MON_COORDS_SIZE(40, 40), .y_offset = 15 }, [SPECIES_GLOOM] = { .size = MON_COORDS_SIZE(56, 48), .y_offset = 11 }, [SPECIES_VILEPLUME] = { .size = MON_COORDS_SIZE(56, 56), .y_offset = 7 }, - [SPECIES_PARAS] = { .size = MON_COORDS_SIZE(48, 40), .y_offset = 14 }, + [SPECIES_PARAS] = { .size = MON_COORDS_SIZE(48, 40), .y_offset = 15 }, [SPECIES_PARASECT] = { .size = MON_COORDS_SIZE(56, 56), .y_offset = 7 }, [SPECIES_VENONAT] = { .size = MON_COORDS_SIZE(40, 56), .y_offset = 8 }, [SPECIES_VENOMOTH] = { .size = MON_COORDS_SIZE(64, 48), .y_offset = 9 }, @@ -59,10 +59,10 @@ const struct MonCoords gMonFrontPicCoords[] = [SPECIES_MEOWTH] = { .size = MON_COORDS_SIZE(48, 48), .y_offset = 10 }, [SPECIES_PERSIAN] = { .size = MON_COORDS_SIZE(64, 56), .y_offset = 4 }, [SPECIES_PSYDUCK] = { .size = MON_COORDS_SIZE(40, 48), .y_offset = 11 }, - [SPECIES_GOLDUCK] = { .size = MON_COORDS_SIZE(64, 64), .y_offset = 2 }, + [SPECIES_GOLDUCK] = { .size = MON_COORDS_SIZE(64, 64), .y_offset = 4 }, [SPECIES_MANKEY] = { .size = MON_COORDS_SIZE(56, 48), .y_offset = 11 }, [SPECIES_PRIMEAPE] = { .size = MON_COORDS_SIZE(64, 56), .y_offset = 6 }, - [SPECIES_GROWLITHE] = { .size = MON_COORDS_SIZE(48, 48), .y_offset = 11 }, + [SPECIES_GROWLITHE] = { .size = MON_COORDS_SIZE(48, 48), .y_offset = 9 }, [SPECIES_ARCANINE] = { .size = MON_COORDS_SIZE(64, 64), .y_offset = 2 }, [SPECIES_POLIWAG] = { .size = MON_COORDS_SIZE(64, 40), .y_offset = 13 }, [SPECIES_POLIWHIRL] = { .size = MON_COORDS_SIZE(64, 48), .y_offset = 9 }, @@ -70,7 +70,7 @@ const struct MonCoords gMonFrontPicCoords[] = [SPECIES_ABRA] = { .size = MON_COORDS_SIZE(56, 48), .y_offset = 10 }, [SPECIES_KADABRA] = { .size = MON_COORDS_SIZE(64, 56), .y_offset = 5 }, [SPECIES_ALAKAZAM] = { .size = MON_COORDS_SIZE(64, 64), .y_offset = 2 }, - [SPECIES_MACHOP] = { .size = MON_COORDS_SIZE(48, 48), .y_offset = 10 }, + [SPECIES_MACHOP] = { .size = MON_COORDS_SIZE(48, 48), .y_offset = 8 }, [SPECIES_MACHOKE] = { .size = MON_COORDS_SIZE(56, 56), .y_offset = 4 }, [SPECIES_MACHAMP] = { .size = MON_COORDS_SIZE(64, 64), .y_offset = 0 }, [SPECIES_BELLSPROUT] = { .size = MON_COORDS_SIZE(40, 40), .y_offset = 12 }, diff --git a/src/data/pokemon_graphics/front_pic_table.h b/src/data/pokemon_graphics/front_pic_table.h index fa56b8492eca..27fefa95075e 100644 --- a/src/data/pokemon_graphics/front_pic_table.h +++ b/src/data/pokemon_graphics/front_pic_table.h @@ -1,4 +1,4 @@ -const struct CompressedSpriteSheet gMonFrontPicTable[] = +const struct CompressedSpriteSheet gMonFrontPicTable[NUM_SPECIES + 1] = { SPECIES_SPRITE(NONE, gMonFrontPic_CircledQuestionMark), SPECIES_SPRITE(BULBASAUR, gMonFrontPic_Bulbasaur), @@ -1337,20 +1337,97 @@ const struct CompressedSpriteSheet gMonFrontPicTable[] = SPECIES_SPRITE(EGG, gMonFrontPic_Egg), }; -const struct CompressedSpriteSheet gMonFrontPicTableFemale[] = +const struct CompressedSpriteSheet gMonFrontPicTableFemale[NUM_SPECIES + 1] = { + SPECIES_SPRITE(VENUSAUR, gMonFrontPic_VenusaurF), + SPECIES_SPRITE(BUTTERFREE, gMonFrontPic_ButterfreeF), + SPECIES_SPRITE(RATTATA, gMonFrontPic_RattataF), + SPECIES_SPRITE(RATICATE, gMonFrontPic_RaticateF), + SPECIES_SPRITE(PIKACHU, gMonFrontPic_PikachuF), + SPECIES_SPRITE(RAICHU, gMonFrontPic_RaichuF), + SPECIES_SPRITE(ZUBAT, gMonFrontPic_ZubatF), + SPECIES_SPRITE(GOLBAT, gMonFrontPic_GolbatF), + SPECIES_SPRITE(GLOOM, gMonFrontPic_GloomF), + SPECIES_SPRITE(VILEPLUME, gMonFrontPic_VileplumeF), + SPECIES_SPRITE(KADABRA, gMonFrontPic_KadabraF), + SPECIES_SPRITE(ALAKAZAM, gMonFrontPic_AlakazamF), + SPECIES_SPRITE(DODUO, gMonFrontPic_DoduoF), + SPECIES_SPRITE(DODRIO, gMonFrontPic_DodrioF), + SPECIES_SPRITE(HYPNO, gMonFrontPic_HypnoF), + SPECIES_SPRITE(RHYHORN, gMonFrontPic_RhyhornF), + SPECIES_SPRITE(RHYDON, gMonFrontPic_RhydonF), + SPECIES_SPRITE(GOLDEEN, gMonFrontPic_GoldeenF), + SPECIES_SPRITE(SEAKING, gMonFrontPic_SeakingF), + SPECIES_SPRITE(SCYTHER, gMonFrontPic_ScytherF), + SPECIES_SPRITE(MAGIKARP, gMonFrontPic_MagikarpF), + SPECIES_SPRITE(GYARADOS, gMonFrontPic_GyaradosF), SPECIES_SPRITE(EEVEE, gMonFrontPic_EeveeF), + SPECIES_SPRITE(MEGANIUM, gMonFrontPic_MeganiumF), + SPECIES_SPRITE(LEDYBA, gMonFrontPic_LedybaF), + SPECIES_SPRITE(LEDIAN, gMonFrontPic_LedianF), + SPECIES_SPRITE(XATU, gMonFrontPic_XatuF), + SPECIES_SPRITE(SUDOWOODO, gMonFrontPic_SudowoodoF), + SPECIES_SPRITE(POLITOED, gMonFrontPic_PolitoedF), + SPECIES_SPRITE(AIPOM, gMonFrontPic_AipomF), + SPECIES_SPRITE(WOOPER, gMonFrontPic_WooperF), + SPECIES_SPRITE(QUAGSIRE, gMonFrontPic_QuagsireF), + SPECIES_SPRITE(MURKROW, gMonFrontPic_MurkrowF), + SPECIES_SPRITE(WOBBUFFET, gMonFrontPic_WobbuffetF), + SPECIES_SPRITE(GIRAFARIG, gMonFrontPic_GirafarigF), + SPECIES_SPRITE(GLIGAR, gMonFrontPic_GligarF), + SPECIES_SPRITE(STEELIX, gMonFrontPic_SteelixF), + SPECIES_SPRITE(SCIZOR, gMonFrontPic_ScizorF), + SPECIES_SPRITE(HERACROSS, gMonFrontPic_HeracrossF), + SPECIES_SPRITE(SNEASEL, gMonFrontPic_SneaselF), + SPECIES_SPRITE(URSARING, gMonFrontPic_UrsaringF), + SPECIES_SPRITE(PILOSWINE, gMonFrontPic_PiloswineF), + SPECIES_SPRITE(OCTILLERY, gMonFrontPic_OctilleryF), + SPECIES_SPRITE(HOUNDOOM, gMonFrontPic_HoundoomF), + SPECIES_SPRITE(DONPHAN, gMonFrontPic_DonphanF), + SPECIES_SPRITE(COMBUSKEN, gMonFrontPic_CombuskenF), + SPECIES_SPRITE(BLAZIKEN, gMonFrontPic_BlazikenF), + SPECIES_SPRITE(BEAUTIFLY, gMonFrontPic_BeautiflyF), + SPECIES_SPRITE(DUSTOX, gMonFrontPic_DustoxF), + SPECIES_SPRITE(LUDICOLO, gMonFrontPic_LudicoloF), + SPECIES_SPRITE(NUZLEAF, gMonFrontPic_NuzleafF), + SPECIES_SPRITE(SHIFTRY, gMonFrontPic_ShiftryF), + SPECIES_SPRITE(MEDITITE, gMonFrontPic_MedititeF), + SPECIES_SPRITE(MEDICHAM, gMonFrontPic_MedichamF), + SPECIES_SPRITE(ROSELIA, gMonFrontPic_RoseliaF), + SPECIES_SPRITE(GULPIN, gMonFrontPic_GulpinF), + SPECIES_SPRITE(SWALOT, gMonFrontPic_SwalotF), + SPECIES_SPRITE(NUMEL, gMonFrontPic_NumelF), + SPECIES_SPRITE(CAMERUPT, gMonFrontPic_CameruptF), + SPECIES_SPRITE(CACTURNE, gMonFrontPic_CacturneF), + SPECIES_SPRITE(MILOTIC, gMonFrontPic_MiloticF), + SPECIES_SPRITE(RELICANTH, gMonFrontPic_RelicanthF), #if P_GEN_4_POKEMON == TRUE SPECIES_SPRITE(STARLY, gMonFrontPic_StarlyF), SPECIES_SPRITE(STARAVIA, gMonFrontPic_StaraviaF), SPECIES_SPRITE(STARAPTOR, gMonFrontPic_StaraptorF), SPECIES_SPRITE(BIDOOF, gMonFrontPic_BidoofF), + SPECIES_SPRITE(BIBAREL, gMonFrontPic_BibarelF), SPECIES_SPRITE(KRICKETOT, gMonFrontPic_KricketotF), SPECIES_SPRITE(KRICKETUNE, gMonFrontPic_KricketuneF), SPECIES_SPRITE(SHINX, gMonFrontPic_ShinxF), - SPECIES_SPRITE(COMBEE, gMonFrontPic_Combee), - SPECIES_SPRITE(HIPPOPOTAS, gMonFrontPic_Hippopotas), - SPECIES_SPRITE(HIPPOWDON, gMonFrontPic_Hippowdon), + SPECIES_SPRITE(LUXIO, gMonFrontPic_LuxioF), + SPECIES_SPRITE(LUXRAY, gMonFrontPic_LuxrayF), + SPECIES_SPRITE(ROSERADE, gMonFrontPic_RoseradeF), + SPECIES_SPRITE(AMBIPOM, gMonFrontPic_AmbipomF), + SPECIES_SPRITE(PACHIRISU, gMonFrontPic_PachirisuF), + SPECIES_SPRITE(GIBLE, gMonFrontPic_GibleF), + SPECIES_SPRITE(GABITE, gMonFrontPic_GabiteF), + SPECIES_SPRITE(GARCHOMP, gMonFrontPic_GarchompF), + SPECIES_SPRITE(CROAGUNK, gMonFrontPic_CroagunkF), + SPECIES_SPRITE(TOXICROAK, gMonFrontPic_ToxicroakF), + SPECIES_SPRITE(FINNEON, gMonFrontPic_FinneonF), + SPECIES_SPRITE(LUMINEON, gMonFrontPic_LumineonF), + SPECIES_SPRITE(SNOVER, gMonFrontPic_SnoverF), + SPECIES_SPRITE(ABOMASNOW, gMonFrontPic_AbomasnowF), + SPECIES_SPRITE(WEAVILE, gMonFrontPic_WeavileF), + SPECIES_SPRITE(RHYPERIOR, gMonFrontPic_RhyperiorF), + SPECIES_SPRITE(TANGROWTH, gMonFrontPic_TangrowthF), + SPECIES_SPRITE(MAMOSWINE, gMonFrontPic_MamoswineF), #endif #if P_GEN_5_POKEMON == TRUE SPECIES_SPRITE(UNFEZANT, gMonFrontPic_UnfezantF), @@ -1360,4 +1437,5 @@ const struct CompressedSpriteSheet gMonFrontPicTableFemale[] = #if P_GEN_6_POKEMON == TRUE SPECIES_SPRITE(PYROAR, gMonFrontPic_PyroarF), #endif + SPECIES_SPRITE(SNEASEL_HISUIAN, gMonFrontPic_SneaselHisuianF), }; diff --git a/src/data/pokemon_graphics/palette_table.h b/src/data/pokemon_graphics/palette_table.h index 0e6c9964225e..1fa65f3b3352 100644 --- a/src/data/pokemon_graphics/palette_table.h +++ b/src/data/pokemon_graphics/palette_table.h @@ -1,4 +1,4 @@ -const struct CompressedSpritePalette gMonPaletteTable[] = +const struct CompressedSpritePalette gMonPaletteTable[NUM_SPECIES + 1] = { SPECIES_PAL(NONE, gMonPalette_CircledQuestionMark), SPECIES_PAL(BULBASAUR, gMonPalette_Bulbasaur), @@ -1021,8 +1021,8 @@ const struct CompressedSpritePalette gMonPaletteTable[] = SPECIES_PAL(ELECTRODE_HISUIAN, gMonPalette_ElectrodeHisuian), SPECIES_PAL(TYPHLOSION_HISUIAN, gMonPalette_TyphlosionHisuian), SPECIES_PAL(QWILFISH_HISUIAN, gMonPalette_QwilfishHisuian), -#if P_GEN_5_POKEMON == TRUE SPECIES_PAL(SNEASEL_HISUIAN, gMonPalette_SneaselHisuian), +#if P_GEN_5_POKEMON == TRUE SPECIES_PAL(SAMUROTT_HISUIAN, gMonPalette_SamurottHisuian), SPECIES_PAL(LILLIGANT_HISUIAN, gMonPalette_LilligantHisuian), SPECIES_PAL(ZORUA_HISUIAN, gMonPalette_ZoruaHisuian), @@ -1336,18 +1336,10 @@ const struct CompressedSpritePalette gMonPaletteTable[] = SPECIES_PAL(EGG, gMonPalette_Egg), }; -const struct CompressedSpritePalette gMonPaletteTableFemale[] = +const struct CompressedSpritePalette gMonPaletteTableFemale[NUM_SPECIES + 1] = { - SPECIES_PAL(EEVEE, gMonPalette_Eevee), #if P_GEN_4_POKEMON == TRUE SPECIES_PAL(COMBEE, gMonPalette_CombeeF), - SPECIES_PAL(STARLY, gMonPalette_Starly), - SPECIES_PAL(STARAVIA, gMonPalette_Staravia), - SPECIES_PAL(STARAPTOR, gMonPalette_Staraptor), - SPECIES_PAL(BIDOOF, gMonPalette_Bidoof), - SPECIES_PAL(KRICKETOT, gMonPalette_Kricketot), - SPECIES_PAL(KRICKETUNE, gMonPalette_Kricketune), - SPECIES_PAL(SHINX, gMonPalette_Shinx), SPECIES_PAL(HIPPOPOTAS, gMonPalette_HippopotasF), SPECIES_PAL(HIPPOWDON, gMonPalette_HippowdonF), #endif @@ -1356,7 +1348,4 @@ const struct CompressedSpritePalette gMonPaletteTableFemale[] = SPECIES_PAL(FRILLISH, gMonPalette_FrillishF), SPECIES_PAL(JELLICENT, gMonPalette_JellicentF), #endif -#if P_GEN_6_POKEMON == TRUE - SPECIES_PAL(PYROAR, gMonPalette_Pyroar), -#endif }; diff --git a/src/data/pokemon_graphics/shiny_palette_table.h b/src/data/pokemon_graphics/shiny_palette_table.h index 0123b0e1fceb..b674617b67e2 100644 --- a/src/data/pokemon_graphics/shiny_palette_table.h +++ b/src/data/pokemon_graphics/shiny_palette_table.h @@ -1,4 +1,4 @@ -const struct CompressedSpritePalette gMonShinyPaletteTable[] = +const struct CompressedSpritePalette gMonShinyPaletteTable[NUM_SPECIES + 1] = { SPECIES_SHINY_PAL(NONE, gMonShinyPalette_CircledQuestionMark), SPECIES_SHINY_PAL(BULBASAUR, gMonShinyPalette_Bulbasaur), @@ -1335,17 +1335,9 @@ const struct CompressedSpritePalette gMonShinyPaletteTable[] = SPECIES_SHINY_PAL(EGG, gMonPalette_Egg), }; -const struct CompressedSpritePalette gMonShinyPaletteTableFemale[] = +const struct CompressedSpritePalette gMonShinyPaletteTableFemale[NUM_SPECIES + 1] = { - SPECIES_SHINY_PAL(EEVEE, gMonShinyPalette_Eevee), #if P_GEN_4_POKEMON == TRUE - SPECIES_SHINY_PAL(STARLY, gMonShinyPalette_Starly), - SPECIES_SHINY_PAL(STARAVIA, gMonShinyPalette_Staravia), - SPECIES_SHINY_PAL(STARAPTOR, gMonShinyPalette_Staraptor), - SPECIES_SHINY_PAL(BIDOOF, gMonShinyPalette_Bidoof), - SPECIES_SHINY_PAL(KRICKETOT, gMonShinyPalette_Kricketot), - SPECIES_SHINY_PAL(KRICKETUNE, gMonShinyPalette_Kricketune), - SPECIES_SHINY_PAL(SHINX, gMonShinyPalette_Shinx), SPECIES_SHINY_PAL(COMBEE, gMonShinyPalette_CombeeF), SPECIES_SHINY_PAL(HIPPOPOTAS, gMonShinyPalette_HippopotasF), SPECIES_SHINY_PAL(HIPPOWDON, gMonShinyPalette_HippowdonF), @@ -1355,7 +1347,4 @@ const struct CompressedSpritePalette gMonShinyPaletteTableFemale[] = SPECIES_SHINY_PAL(FRILLISH, gMonShinyPalette_FrillishF), SPECIES_SHINY_PAL(JELLICENT, gMonShinyPalette_JellicentF), #endif -#if P_GEN_6_POKEMON == TRUE - SPECIES_SHINY_PAL(PYROAR, gMonShinyPalette_Pyroar), -#endif }; diff --git a/src/data/text/item_descriptions.h b/src/data/text/item_descriptions.h index ecca3ef301fa..0948fbe187d2 100644 --- a/src/data/text/item_descriptions.h +++ b/src/data/text/item_descriptions.h @@ -2406,9 +2406,15 @@ static const u8 sWhiteHerbDesc[] = _( "lowered stat."); static const u8 sExpShareDesc[] = _( +#if I_EXP_SHARE_ITEM >= GEN_6 + "This device gives\n" + "exp. to other\n" + "party members."); +#else "A hold item that\n" "gets Exp. points\n" "from battles."); +#endif static const u8 sQuickClawDesc[] = _( "A hold item that\n" diff --git a/src/data/text/species_names.h b/src/data/text/species_names.h index 9e60b94cf5b7..e9aee3a06ce2 100644 --- a/src/data/text/species_names.h +++ b/src/data/text/species_names.h @@ -1,4 +1,4 @@ -const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1] = { +const u8 gSpeciesNames[NUM_SPECIES][POKEMON_NAME_LENGTH + 1] = { [SPECIES_NONE] = _("??????????"), [SPECIES_BULBASAUR] = _("Bulbasaur"), [SPECIES_IVYSAUR] = _("Ivysaur"), diff --git a/src/data/trainer_parties.h b/src/data/trainer_parties.h index 1759120b7f3c..ed53a181dddb 100644 --- a/src/data/trainer_parties.h +++ b/src/data/trainer_parties.h @@ -1,825 +1,768 @@ -static const struct TrainerMonNoItemDefaultMoves sParty_Sawyer1[] = { +static const struct TrainerMon sParty_Sawyer1[] = { { - .iv = 0, .lvl = 21, .species = SPECIES_GEODUDE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntAquaHideout1[] = { +static const struct TrainerMon sParty_GruntAquaHideout1[] = { { - .iv = 0, .lvl = 32, .species = SPECIES_POOCHYENA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntAquaHideout2[] = { +static const struct TrainerMon sParty_GruntAquaHideout2[] = { { - .iv = 0, .lvl = 31, .species = SPECIES_ZUBAT, }, { - .iv = 0, .lvl = 31, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntAquaHideout3[] = { +static const struct TrainerMon sParty_GruntAquaHideout3[] = { { - .iv = 0, .lvl = 32, .species = SPECIES_ZUBAT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntAquaHideout4[] = { +static const struct TrainerMon sParty_GruntAquaHideout4[] = { { - .iv = 0, .lvl = 32, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntSeafloorCavern1[] = { +static const struct TrainerMon sParty_GruntSeafloorCavern1[] = { { - .iv = 0, .lvl = 36, .species = SPECIES_POOCHYENA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntSeafloorCavern2[] = { +static const struct TrainerMon sParty_GruntSeafloorCavern2[] = { { - .iv = 0, .lvl = 36, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntSeafloorCavern3[] = { +static const struct TrainerMon sParty_GruntSeafloorCavern3[] = { { - .iv = 0, .lvl = 36, .species = SPECIES_ZUBAT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Gabrielle1[] = { +static const struct TrainerMon sParty_Gabrielle1[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_SKITTY, }, { - .iv = 0, .lvl = 26, .species = SPECIES_POOCHYENA, }, { - .iv = 0, .lvl = 26, .species = SPECIES_ZIGZAGOON, }, { - .iv = 0, .lvl = 26, .species = SPECIES_LOTAD, }, { - .iv = 0, .lvl = 26, .species = SPECIES_SEEDOT, }, { - .iv = 0, .lvl = 26, .species = SPECIES_TAILLOW, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntPetalburgWoods[] = { +static const struct TrainerMon sParty_GruntPetalburgWoods[] = { { - .iv = 0, .lvl = 9, .species = SPECIES_POOCHYENA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Marcel[] = { +static const struct TrainerMon sParty_Marcel[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 29, .species = SPECIES_MANECTRIC, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 29, .species = SPECIES_SHIFTRY, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Alberto[] = { +static const struct TrainerMon sParty_Alberto[] = { { - .iv = 0, .lvl = 30, .species = SPECIES_PELIPPER, }, { - .iv = 0, .lvl = 30, .species = SPECIES_XATU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Ed[] = { +static const struct TrainerMon sParty_Ed[] = { { - .iv = 0, .lvl = 30, .species = SPECIES_ZANGOOSE, }, { - .iv = 0, .lvl = 30, .species = SPECIES_SEVIPER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntSeafloorCavern4[] = { +static const struct TrainerMon sParty_GruntSeafloorCavern4[] = { { - .iv = 0, .lvl = 36, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Declan[] = { +static const struct TrainerMon sParty_Declan[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_GYARADOS, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntRusturfTunnel[] = { +static const struct TrainerMon sParty_GruntRusturfTunnel[] = { { - .iv = 0, .lvl = 11, .species = SPECIES_POOCHYENA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntWeatherInst1[] = { +static const struct TrainerMon sParty_GruntWeatherInst1[] = { { - .iv = 0, .lvl = 27, .species = SPECIES_ZUBAT, }, { - .iv = 0, .lvl = 27, .species = SPECIES_POOCHYENA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntWeatherInst2[] = { +static const struct TrainerMon sParty_GruntWeatherInst2[] = { { - .iv = 0, .lvl = 27, .species = SPECIES_POOCHYENA, }, { - .iv = 0, .lvl = 27, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntWeatherInst3[] = { +static const struct TrainerMon sParty_GruntWeatherInst3[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_POOCHYENA, }, { - .iv = 0, .lvl = 26, .species = SPECIES_ZUBAT, }, { - .iv = 0, .lvl = 26, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMuseum1[] = { +static const struct TrainerMon sParty_GruntMuseum1[] = { { - .iv = 0, .lvl = 15, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMuseum2[] = { +static const struct TrainerMon sParty_GruntMuseum2[] = { { - .iv = 0, .lvl = 14, .species = SPECIES_ZUBAT, }, { - .iv = 0, .lvl = 14, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntSpaceCenter1[] = { +static const struct TrainerMon sParty_GruntSpaceCenter1[] = { { - .iv = 0, .lvl = 32, .species = SPECIES_NUMEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMtPyre1[] = { +static const struct TrainerMon sParty_GruntMtPyre1[] = { { - .iv = 0, .lvl = 32, .species = SPECIES_ZUBAT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMtPyre2[] = { +static const struct TrainerMon sParty_GruntMtPyre2[] = { { - .iv = 0, .lvl = 32, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMtPyre3[] = { +static const struct TrainerMon sParty_GruntMtPyre3[] = { { - .iv = 0, .lvl = 30, .species = SPECIES_POOCHYENA, }, { - .iv = 0, .lvl = 30, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntWeatherInst4[] = { +static const struct TrainerMon sParty_GruntWeatherInst4[] = { { - .iv = 0, .lvl = 28, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntAquaHideout5[] = { +static const struct TrainerMon sParty_GruntAquaHideout5[] = { { - .iv = 0, .lvl = 32, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntAquaHideout6[] = { +static const struct TrainerMon sParty_GruntAquaHideout6[] = { { - .iv = 0, .lvl = 32, .species = SPECIES_ZUBAT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Fredrick[] = { +static const struct TrainerMon sParty_Fredrick[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 30, .species = SPECIES_MAKUHITA, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 30, .species = SPECIES_MACHOKE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Matt[] = { +static const struct TrainerMon sParty_Matt[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 34, .species = SPECIES_MIGHTYENA, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 34, .species = SPECIES_GOLBAT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Zander[] = { +static const struct TrainerMon sParty_Zander[] = { { - .iv = 0, .lvl = 31, .species = SPECIES_HARIYAMA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_ShellyWeatherInstitute[] = { +static const struct TrainerMon sParty_ShellyWeatherInstitute[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 28, .species = SPECIES_CARVANHA, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 28, .species = SPECIES_MIGHTYENA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_ShellySeafloorCavern[] = { +static const struct TrainerMon sParty_ShellySeafloorCavern[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 37, .species = SPECIES_SHARPEDO, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 37, .species = SPECIES_MIGHTYENA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Archie[] = { +static const struct TrainerMon sParty_Archie[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 41, .species = SPECIES_MIGHTYENA, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 41, .species = SPECIES_CROBAT, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 43, .species = SPECIES_SHARPEDO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Leah[] = { +static const struct TrainerMon sParty_Leah[] = { { - .iv = 0, .lvl = 31, .species = SPECIES_SPOINK, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Daisy[] = { +static const struct TrainerMon sParty_Daisy[] = { { - .iv = 0, .lvl = 14, .species = SPECIES_SHROOMISH, }, { - .iv = 0, .lvl = 14, .species = SPECIES_ROSELIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Rose1[] = { +static const struct TrainerMon sParty_Rose1[] = { { - .iv = 0, .lvl = 14, .species = SPECIES_ROSELIA, }, { - .iv = 0, .lvl = 14, .species = SPECIES_SHROOMISH, }, { - .iv = 0, .lvl = 14, .species = SPECIES_ROSELIA, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Felix[] = { +static const struct TrainerMon sParty_Felix[] = { { - .iv = 0, .lvl = 43, .species = SPECIES_MEDICHAM, .moves = {MOVE_PSYCHIC, MOVE_NONE, MOVE_NONE, MOVE_NONE} }, { - .iv = 0, .lvl = 43, .species = SPECIES_CLAYDOL, .moves = {MOVE_SKILL_SWAP, MOVE_EARTHQUAKE, MOVE_NONE, MOVE_NONE} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Violet[] = { +static const struct TrainerMon sParty_Violet[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_ROSELIA, }, { - .iv = 0, .lvl = 26, .species = SPECIES_GLOOM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Rose2[] = { +static const struct TrainerMon sParty_Rose2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 26, .species = SPECIES_SHROOMISH, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 26, .species = SPECIES_ROSELIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Rose3[] = { +static const struct TrainerMon sParty_Rose3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 28, .species = SPECIES_SHROOMISH, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 28, .species = SPECIES_GLOOM, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 28, .species = SPECIES_ROSELIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Rose4[] = { +static const struct TrainerMon sParty_Rose4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 31, .species = SPECIES_SHROOMISH, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 31, .species = SPECIES_GLOOM, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 31, .species = SPECIES_ROSELIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Rose5[] = { +static const struct TrainerMon sParty_Rose5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 34, .species = SPECIES_BRELOOM, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 34, .species = SPECIES_GLOOM, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 34, .species = SPECIES_ROSELIA, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Dusty1[] = { +static const struct TrainerMon sParty_Dusty1[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 23, .species = SPECIES_SANDSLASH, .moves = {MOVE_DIG, MOVE_SLASH, MOVE_SAND_ATTACK, MOVE_POISON_STING} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Chip[] = { +static const struct TrainerMon sParty_Chip[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 27, .species = SPECIES_BALTOY, .moves = {MOVE_PSYBEAM, MOVE_SELF_DESTRUCT, MOVE_SANDSTORM, MOVE_ANCIENT_POWER} }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 27, .species = SPECIES_SANDSHREW, .moves = {MOVE_DIG, MOVE_SLASH, MOVE_SAND_ATTACK, MOVE_POISON_STING} }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 27, .species = SPECIES_SANDSLASH, .moves = {MOVE_DIG, MOVE_SLASH, MOVE_SAND_ATTACK, MOVE_POISON_STING} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Foster[] = { +static const struct TrainerMon sParty_Foster[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 25, .species = SPECIES_SANDSHREW, .moves = {MOVE_DIG, MOVE_SLASH, MOVE_SAND_ATTACK, MOVE_POISON_STING} }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 25, .species = SPECIES_SANDSLASH, .moves = {MOVE_DIG, MOVE_SLASH, MOVE_SAND_ATTACK, MOVE_POISON_STING} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Dusty2[] = { +static const struct TrainerMon sParty_Dusty2[] = { { - .iv = 60, + .iv = TRAINER_PARTY_IVS(7, 7, 7, 7, 7, 7), .lvl = 27, .species = SPECIES_SANDSLASH, .moves = {MOVE_DIG, MOVE_SLASH, MOVE_SAND_ATTACK, MOVE_POISON_STING} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Dusty3[] = { +static const struct TrainerMon sParty_Dusty3[] = { { - .iv = 70, + .iv = TRAINER_PARTY_IVS(8, 8, 8, 8, 8, 8), .lvl = 30, .species = SPECIES_SANDSLASH, .moves = {MOVE_DIG, MOVE_SLASH, MOVE_SAND_ATTACK, MOVE_POISON_STING} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Dusty4[] = { +static const struct TrainerMon sParty_Dusty4[] = { { - .iv = 80, + .iv = TRAINER_PARTY_IVS(9, 9, 9, 9, 9, 9), .lvl = 33, .species = SPECIES_SANDSLASH, .moves = {MOVE_DIG, MOVE_SLASH, MOVE_SAND_ATTACK, MOVE_POISON_STING} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Dusty5[] = { +static const struct TrainerMon sParty_Dusty5[] = { { - .iv = 90, + .iv = TRAINER_PARTY_IVS(10, 10, 10, 10, 10, 10), .lvl = 36, .species = SPECIES_SANDSLASH, .moves = {MOVE_DIG, MOVE_SLASH, MOVE_SAND_ATTACK, MOVE_POISON_STING} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GabbyAndTy1[] = { +static const struct TrainerMon sParty_GabbyAndTy1[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 17, .species = SPECIES_MAGNEMITE, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 17, .species = SPECIES_WHISMUR, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GabbyAndTy2[] = { +static const struct TrainerMon sParty_GabbyAndTy2[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 27, .species = SPECIES_MAGNEMITE, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 27, .species = SPECIES_LOUDRED, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GabbyAndTy3[] = { +static const struct TrainerMon sParty_GabbyAndTy3[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 30, .species = SPECIES_MAGNETON, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 30, .species = SPECIES_LOUDRED, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GabbyAndTy4[] = { +static const struct TrainerMon sParty_GabbyAndTy4[] = { { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 33, .species = SPECIES_MAGNETON, }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 33, .species = SPECIES_LOUDRED, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GabbyAndTy5[] = { +static const struct TrainerMon sParty_GabbyAndTy5[] = { { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 36, .species = SPECIES_MAGNETON, }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 36, .species = SPECIES_LOUDRED, } }; -static const struct TrainerMonNoItemCustomMoves sParty_GabbyAndTy6[] = { +static const struct TrainerMon sParty_GabbyAndTy6[] = { { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 39, .species = SPECIES_MAGNETON, .moves = {MOVE_SONIC_BOOM, MOVE_THUNDER_WAVE, MOVE_METAL_SOUND, MOVE_THUNDERBOLT} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 39, .species = SPECIES_EXPLOUD, .moves = {MOVE_ASTONISH, MOVE_STOMP, MOVE_SUPERSONIC, MOVE_HYPER_VOICE} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Lola1[] = { +static const struct TrainerMon sParty_Lola1[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 12, .species = SPECIES_AZURILL, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 12, .species = SPECIES_AZURILL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Austina[] = { +static const struct TrainerMon sParty_Austina[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_MARILL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Gwen[] = { +static const struct TrainerMon sParty_Gwen[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_MARILL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Lola2[] = { +static const struct TrainerMon sParty_Lola2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 26, .species = SPECIES_MARILL, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 26, .species = SPECIES_MARILL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Lola3[] = { +static const struct TrainerMon sParty_Lola3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 29, .species = SPECIES_MARILL, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 29, .species = SPECIES_MARILL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Lola4[] = { +static const struct TrainerMon sParty_Lola4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 32, .species = SPECIES_MARILL, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 32, .species = SPECIES_MARILL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Lola5[] = { +static const struct TrainerMon sParty_Lola5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 35, .species = SPECIES_AZUMARILL, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 35, .species = SPECIES_AZUMARILL, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Ricky1[] = { +static const struct TrainerMon sParty_Ricky1[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 13, .species = SPECIES_ZIGZAGOON, .moves = {MOVE_SAND_ATTACK, MOVE_HEADBUTT, MOVE_TAIL_WHIP, MOVE_SURF} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Simon[] = { +static const struct TrainerMon sParty_Simon[] = { { - .iv = 0, .lvl = 12, .species = SPECIES_AZURILL, }, { - .iv = 0, .lvl = 12, .species = SPECIES_MARILL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Charlie[] = { +static const struct TrainerMon sParty_Charlie[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_MARILL, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Ricky2[] = { +static const struct TrainerMon sParty_Ricky2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 27, .species = SPECIES_LINOONE, .moves = {MOVE_SAND_ATTACK, MOVE_PIN_MISSILE, MOVE_TAIL_WHIP, MOVE_SURF} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Ricky3[] = { +static const struct TrainerMon sParty_Ricky3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 30, .species = SPECIES_LINOONE, .moves = {MOVE_SAND_ATTACK, MOVE_PIN_MISSILE, MOVE_TAIL_WHIP, MOVE_SURF} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Ricky4[] = { +static const struct TrainerMon sParty_Ricky4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 33, .species = SPECIES_LINOONE, .moves = {MOVE_SAND_ATTACK, MOVE_PIN_MISSILE, MOVE_TAIL_WHIP, MOVE_SURF} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Ricky5[] = { +static const struct TrainerMon sParty_Ricky5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 36, .species = SPECIES_LINOONE, .moves = {MOVE_SAND_ATTACK, MOVE_PIN_MISSILE, MOVE_TAIL_WHIP, MOVE_SURF} } }; -static const struct TrainerMonItemCustomMoves sParty_Randall[] = { +static const struct TrainerMon sParty_Randall[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 26, .species = SPECIES_SWELLOW, .heldItem = ITEM_NONE, @@ -827,9 +770,9 @@ static const struct TrainerMonItemCustomMoves sParty_Randall[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Parker[] = { +static const struct TrainerMon sParty_Parker[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 26, .species = SPECIES_SPINDA, .heldItem = ITEM_NONE, @@ -837,9 +780,9 @@ static const struct TrainerMonItemCustomMoves sParty_Parker[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_George[] = { +static const struct TrainerMon sParty_George[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 26, .species = SPECIES_SLAKOTH, .heldItem = ITEM_SITRUS_BERRY, @@ -847,9 +790,9 @@ static const struct TrainerMonItemCustomMoves sParty_George[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Berke[] = { +static const struct TrainerMon sParty_Berke[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 26, .species = SPECIES_VIGOROTH, .heldItem = ITEM_NONE, @@ -857,261 +800,261 @@ static const struct TrainerMonItemCustomMoves sParty_Berke[] = { } }; -static const struct TrainerMonNoItemCustomMoves sParty_Braxton[] = { +static const struct TrainerMon sParty_Braxton[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 28, .species = SPECIES_SWELLOW, .moves = {MOVE_FOCUS_ENERGY, MOVE_QUICK_ATTACK, MOVE_WING_ATTACK, MOVE_ENDEAVOR} }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 28, .species = SPECIES_TRAPINCH, .moves = {MOVE_BITE, MOVE_DIG, MOVE_FEINT_ATTACK, MOVE_SAND_TOMB} }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 28, .species = SPECIES_WAILMER, .moves = {MOVE_ROLLOUT, MOVE_WHIRLPOOL, MOVE_ASTONISH, MOVE_WATER_PULSE} }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 28, .species = SPECIES_MAGNETON, .moves = {MOVE_THUNDERBOLT, MOVE_SUPERSONIC, MOVE_THUNDER_WAVE, MOVE_SONIC_BOOM} }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 28, .species = SPECIES_SHIFTRY, .moves = {MOVE_GIGA_DRAIN, MOVE_FEINT_ATTACK, MOVE_DOUBLE_TEAM, MOVE_SWAGGER} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Vincent[] = { +static const struct TrainerMon sParty_Vincent[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 44, .species = SPECIES_SABLEYE, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 44, .species = SPECIES_MEDICHAM, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 44, .species = SPECIES_SHARPEDO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Leroy[] = { +static const struct TrainerMon sParty_Leroy[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 46, .species = SPECIES_MAWILE, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 46, .species = SPECIES_STARMIE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Wilton1[] = { +static const struct TrainerMon sParty_Wilton1[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 17, .species = SPECIES_ELECTRIKE, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 17, .species = SPECIES_WAILMER, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 17, .species = SPECIES_MAKUHITA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Edgar[] = { +static const struct TrainerMon sParty_Edgar[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 43, .species = SPECIES_CACTURNE, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 43, .species = SPECIES_PELIPPER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Albert[] = { +static const struct TrainerMon sParty_Albert[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 43, .species = SPECIES_MAGNETON, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 43, .species = SPECIES_MUK, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Samuel[] = { +static const struct TrainerMon sParty_Samuel[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 42, .species = SPECIES_SWELLOW, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 42, .species = SPECIES_MAWILE, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 42, .species = SPECIES_KADABRA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Vito[] = { +static const struct TrainerMon sParty_Vito[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 42, .species = SPECIES_DODRIO, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 42, .species = SPECIES_KADABRA, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 42, .species = SPECIES_ELECTRODE, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 42, .species = SPECIES_SHIFTRY, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Owen[] = { +static const struct TrainerMon sParty_Owen[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 42, .species = SPECIES_KECLEON, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 42, .species = SPECIES_GRAVELER, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 42, .species = SPECIES_WAILORD, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Wilton2[] = { +static const struct TrainerMon sParty_Wilton2[] = { { - .iv = 110, + .iv = TRAINER_PARTY_IVS(13, 13, 13, 13, 13, 13), .lvl = 26, .species = SPECIES_ELECTRIKE, }, { - .iv = 110, + .iv = TRAINER_PARTY_IVS(13, 13, 13, 13, 13, 13), .lvl = 26, .species = SPECIES_WAILMER, }, { - .iv = 110, + .iv = TRAINER_PARTY_IVS(13, 13, 13, 13, 13, 13), .lvl = 26, .species = SPECIES_MAKUHITA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Wilton3[] = { +static const struct TrainerMon sParty_Wilton3[] = { { - .iv = 120, + .iv = TRAINER_PARTY_IVS(14, 14, 14, 14, 14, 14), .lvl = 29, .species = SPECIES_MANECTRIC, }, { - .iv = 120, + .iv = TRAINER_PARTY_IVS(14, 14, 14, 14, 14, 14), .lvl = 29, .species = SPECIES_WAILMER, }, { - .iv = 120, + .iv = TRAINER_PARTY_IVS(14, 14, 14, 14, 14, 14), .lvl = 29, .species = SPECIES_MAKUHITA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Wilton4[] = { +static const struct TrainerMon sParty_Wilton4[] = { { - .iv = 130, + .iv = TRAINER_PARTY_IVS(15, 15, 15, 15, 15, 15), .lvl = 32, .species = SPECIES_MANECTRIC, }, { - .iv = 130, + .iv = TRAINER_PARTY_IVS(15, 15, 15, 15, 15, 15), .lvl = 32, .species = SPECIES_WAILMER, }, { - .iv = 130, + .iv = TRAINER_PARTY_IVS(15, 15, 15, 15, 15, 15), .lvl = 32, .species = SPECIES_MAKUHITA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Wilton5[] = { +static const struct TrainerMon sParty_Wilton5[] = { { - .iv = 140, + .iv = TRAINER_PARTY_IVS(17, 17, 17, 17, 17, 17), .lvl = 35, .species = SPECIES_MANECTRIC, }, { - .iv = 140, + .iv = TRAINER_PARTY_IVS(17, 17, 17, 17, 17, 17), .lvl = 35, .species = SPECIES_WAILMER, }, { - .iv = 140, + .iv = TRAINER_PARTY_IVS(17, 17, 17, 17, 17, 17), .lvl = 35, .species = SPECIES_HARIYAMA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Warren[] = { +static const struct TrainerMon sParty_Warren[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 33, .species = SPECIES_GRAVELER, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 33, .species = SPECIES_LUDICOLO, } }; -static const struct TrainerMonItemCustomMoves sParty_Mary[] = { +static const struct TrainerMon sParty_Mary[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 26, .species = SPECIES_DELCATTY, .heldItem = ITEM_NONE, @@ -1119,9 +1062,9 @@ static const struct TrainerMonItemCustomMoves sParty_Mary[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Alexia[] = { +static const struct TrainerMon sParty_Alexia[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 26, .species = SPECIES_WIGGLYTUFF, .heldItem = ITEM_NONE, @@ -1129,9 +1072,9 @@ static const struct TrainerMonItemCustomMoves sParty_Alexia[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Jody[] = { +static const struct TrainerMon sParty_Jody[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 26, .species = SPECIES_ZANGOOSE, .heldItem = ITEM_NONE, @@ -1139,334 +1082,326 @@ static const struct TrainerMonItemCustomMoves sParty_Jody[] = { } }; -static const struct TrainerMonNoItemCustomMoves sParty_Wendy[] = { +static const struct TrainerMon sParty_Wendy[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 29, .species = SPECIES_MAWILE, .moves = {MOVE_BATON_PASS, MOVE_FEINT_ATTACK, MOVE_FAKE_TEARS, MOVE_BITE} }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 29, .species = SPECIES_ROSELIA, .moves = {MOVE_MEGA_DRAIN, MOVE_MAGICAL_LEAF, MOVE_GRASS_WHISTLE, MOVE_LEECH_SEED} }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 29, .species = SPECIES_PELIPPER, .moves = {MOVE_FLY, MOVE_WATER_GUN, MOVE_MIST, MOVE_PROTECT} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Keira[] = { +static const struct TrainerMon sParty_Keira[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 45, .species = SPECIES_LAIRON, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 45, .species = SPECIES_MANECTRIC, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Brooke1[] = { +static const struct TrainerMon sParty_Brooke1[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 17, .species = SPECIES_WINGULL, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 17, .species = SPECIES_NUMEL, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 17, .species = SPECIES_ROSELIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jennifer[] = { +static const struct TrainerMon sParty_Jennifer[] = { { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 30, .species = SPECIES_SABLEYE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Hope[] = { +static const struct TrainerMon sParty_Hope[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 45, .species = SPECIES_ROSELIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Shannon[] = { +static const struct TrainerMon sParty_Shannon[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 45, .species = SPECIES_CLAYDOL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Michelle[] = { +static const struct TrainerMon sParty_Michelle[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 42, .species = SPECIES_TORKOAL, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 42, .species = SPECIES_MEDICHAM, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 42, .species = SPECIES_LUDICOLO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Caroline[] = { +static const struct TrainerMon sParty_Caroline[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 43, .species = SPECIES_SKARMORY, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 43, .species = SPECIES_SABLEYE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Julie[] = { +static const struct TrainerMon sParty_Julie[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 42, .species = SPECIES_SANDSLASH, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 42, .species = SPECIES_NINETALES, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 42, .species = SPECIES_TROPIUS, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Brooke2[] = { +static const struct TrainerMon sParty_Brooke2[] = { { - .iv = 110, + .iv = TRAINER_PARTY_IVS(13, 13, 13, 13, 13, 13), .lvl = 26, .species = SPECIES_WINGULL, }, { - .iv = 110, + .iv = TRAINER_PARTY_IVS(13, 13, 13, 13, 13, 13), .lvl = 26, .species = SPECIES_NUMEL, }, { - .iv = 110, + .iv = TRAINER_PARTY_IVS(13, 13, 13, 13, 13, 13), .lvl = 26, .species = SPECIES_ROSELIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Brooke3[] = { +static const struct TrainerMon sParty_Brooke3[] = { { - .iv = 120, + .iv = TRAINER_PARTY_IVS(14, 14, 14, 14, 14, 14), .lvl = 29, .species = SPECIES_PELIPPER, }, { - .iv = 120, + .iv = TRAINER_PARTY_IVS(14, 14, 14, 14, 14, 14), .lvl = 29, .species = SPECIES_NUMEL, }, { - .iv = 120, + .iv = TRAINER_PARTY_IVS(14, 14, 14, 14, 14, 14), .lvl = 29, .species = SPECIES_ROSELIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Brooke4[] = { +static const struct TrainerMon sParty_Brooke4[] = { { - .iv = 130, + .iv = TRAINER_PARTY_IVS(15, 15, 15, 15, 15, 15), .lvl = 32, .species = SPECIES_PELIPPER, }, { - .iv = 130, + .iv = TRAINER_PARTY_IVS(15, 15, 15, 15, 15, 15), .lvl = 32, .species = SPECIES_NUMEL, }, { - .iv = 130, + .iv = TRAINER_PARTY_IVS(15, 15, 15, 15, 15, 15), .lvl = 32, .species = SPECIES_ROSELIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Brooke5[] = { +static const struct TrainerMon sParty_Brooke5[] = { { - .iv = 140, + .iv = TRAINER_PARTY_IVS(17, 17, 17, 17, 17, 17), .lvl = 34, .species = SPECIES_PELIPPER, }, { - .iv = 140, + .iv = TRAINER_PARTY_IVS(17, 17, 17, 17, 17, 17), .lvl = 34, .species = SPECIES_CAMERUPT, }, { - .iv = 140, + .iv = TRAINER_PARTY_IVS(17, 17, 17, 17, 17, 17), .lvl = 34, .species = SPECIES_ROSELIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Patricia[] = { +static const struct TrainerMon sParty_Patricia[] = { { - .iv = 0, .lvl = 41, .species = SPECIES_BANETTE, }, { - .iv = 0, .lvl = 41, .species = SPECIES_LUNATONE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Kindra[] = { +static const struct TrainerMon sParty_Kindra[] = { { - .iv = 0, .lvl = 30, .species = SPECIES_DUSKULL, }, { - .iv = 0, .lvl = 30, .species = SPECIES_SHUPPET, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Tammy[] = { +static const struct TrainerMon sParty_Tammy[] = { { - .iv = 0, .lvl = 29, .species = SPECIES_DUSKULL, }, { - .iv = 0, .lvl = 29, .species = SPECIES_SHUPPET, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Valerie1[] = { +static const struct TrainerMon sParty_Valerie1[] = { { - .iv = 0, .lvl = 32, .species = SPECIES_SABLEYE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Tasha[] = { +static const struct TrainerMon sParty_Tasha[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 32, .species = SPECIES_SHUPPET, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Valerie2[] = { +static const struct TrainerMon sParty_Valerie2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 31, .species = SPECIES_SABLEYE, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 31, .species = SPECIES_SPOINK, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Valerie3[] = { +static const struct TrainerMon sParty_Valerie3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 35, .species = SPECIES_SPOINK, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 35, .species = SPECIES_SABLEYE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Valerie4[] = { +static const struct TrainerMon sParty_Valerie4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 40, .species = SPECIES_SPOINK, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 40, .species = SPECIES_SABLEYE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Valerie5[] = { +static const struct TrainerMon sParty_Valerie5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 42, .species = SPECIES_DUSKULL, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 42, .species = SPECIES_SABLEYE, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 42, .species = SPECIES_GRUMPIG, } }; -static const struct TrainerMonItemDefaultMoves sParty_Cindy1[] = { +static const struct TrainerMon sParty_Cindy1[] = { { - .iv = 0, .lvl = 7, .species = SPECIES_ZIGZAGOON, .heldItem = ITEM_NUGGET } }; -static const struct TrainerMonItemCustomMoves sParty_Daphne[] = { +static const struct TrainerMon sParty_Daphne[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 39, .species = SPECIES_LUVDISC, .heldItem = ITEM_NUGGET, .moves = {MOVE_ATTRACT, MOVE_SWEET_KISS, MOVE_FLAIL, MOVE_WATER_PULSE} }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 39, .species = SPECIES_LUVDISC, .heldItem = ITEM_NUGGET, @@ -1474,27 +1409,23 @@ static const struct TrainerMonItemCustomMoves sParty_Daphne[] = { } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntSpaceCenter2[] = { +static const struct TrainerMon sParty_GruntSpaceCenter2[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_MIGHTYENA, }, { - .iv = 0, .lvl = 28, .species = SPECIES_MIGHTYENA, }, { - .iv = 0, .lvl = 30, .species = SPECIES_NUMEL, } }; -static const struct TrainerMonItemCustomMoves sParty_Cindy2[] = { +static const struct TrainerMon sParty_Cindy2[] = { { - .iv = 0, .lvl = 11, .species = SPECIES_ZIGZAGOON, .heldItem = ITEM_NUGGET, @@ -1502,54 +1433,54 @@ static const struct TrainerMonItemCustomMoves sParty_Cindy2[] = { } }; -static const struct TrainerMonItemDefaultMoves sParty_Brianna[] = { +static const struct TrainerMon sParty_Brianna[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 40, .species = SPECIES_SEAKING, .heldItem = ITEM_NUGGET } }; -static const struct TrainerMonItemDefaultMoves sParty_Naomi[] = { +static const struct TrainerMon sParty_Naomi[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 45, .species = SPECIES_ROSELIA, .heldItem = ITEM_NUGGET } }; -static const struct TrainerMonItemDefaultMoves sParty_Cindy3[] = { +static const struct TrainerMon sParty_Cindy3[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 27, .species = SPECIES_LINOONE, .heldItem = ITEM_NUGGET } }; -static const struct TrainerMonItemDefaultMoves sParty_Cindy4[] = { +static const struct TrainerMon sParty_Cindy4[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 30, .species = SPECIES_LINOONE, .heldItem = ITEM_NUGGET } }; -static const struct TrainerMonItemDefaultMoves sParty_Cindy5[] = { +static const struct TrainerMon sParty_Cindy5[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 33, .species = SPECIES_LINOONE, .heldItem = ITEM_NUGGET } }; -static const struct TrainerMonItemCustomMoves sParty_Cindy6[] = { +static const struct TrainerMon sParty_Cindy6[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 36, .species = SPECIES_LINOONE, .heldItem = ITEM_NUGGET, @@ -1557,216 +1488,204 @@ static const struct TrainerMonItemCustomMoves sParty_Cindy6[] = { } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Melissa[] = { +static const struct TrainerMon sParty_Melissa[] = { { - .iv = 0, .lvl = 21, .species = SPECIES_MARILL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Sheila[] = { +static const struct TrainerMon sParty_Sheila[] = { { - .iv = 0, .lvl = 21, .species = SPECIES_SHROOMISH, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Shirley[] = { +static const struct TrainerMon sParty_Shirley[] = { { - .iv = 0, .lvl = 21, .species = SPECIES_NUMEL, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Jessica1[] = { +static const struct TrainerMon sParty_Jessica1[] = { { - .iv = 0, .lvl = 29, .species = SPECIES_KECLEON, .moves = {MOVE_BIND, MOVE_LICK, MOVE_FURY_SWIPES, MOVE_FEINT_ATTACK} }, { - .iv = 0, .lvl = 29, .species = SPECIES_SEVIPER, .moves = {MOVE_POISON_TAIL, MOVE_SCREECH, MOVE_GLARE, MOVE_CRUNCH} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Connie[] = { +static const struct TrainerMon sParty_Connie[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 40, .species = SPECIES_GOLDEEN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Bridget[] = { +static const struct TrainerMon sParty_Bridget[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 40, .species = SPECIES_AZUMARILL, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Olivia[] = { +static const struct TrainerMon sParty_Olivia[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 35, .species = SPECIES_CLAMPERL, .moves = {MOVE_IRON_DEFENSE, MOVE_WHIRLPOOL, MOVE_RAIN_DANCE, MOVE_WATER_PULSE} }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 37, .species = SPECIES_CORPHISH, .moves = {MOVE_TAUNT, MOVE_CRABHAMMER, MOVE_WATER_PULSE, MOVE_NONE} }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 39, .species = SPECIES_LOMBRE, .moves = {MOVE_UPROAR, MOVE_FURY_SWIPES, MOVE_FAKE_OUT, MOVE_WATER_PULSE} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Tiffany[] = { +static const struct TrainerMon sParty_Tiffany[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 39, .species = SPECIES_CARVANHA, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 39, .species = SPECIES_SHARPEDO, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Jessica2[] = { +static const struct TrainerMon sParty_Jessica2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 35, .species = SPECIES_KECLEON, .moves = {MOVE_BIND, MOVE_LICK, MOVE_FURY_SWIPES, MOVE_FEINT_ATTACK} }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 35, .species = SPECIES_SEVIPER, .moves = {MOVE_POISON_TAIL, MOVE_SCREECH, MOVE_GLARE, MOVE_CRUNCH} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Jessica3[] = { +static const struct TrainerMon sParty_Jessica3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 38, .species = SPECIES_KECLEON, .moves = {MOVE_BIND, MOVE_LICK, MOVE_FURY_SWIPES, MOVE_FEINT_ATTACK} }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 38, .species = SPECIES_SEVIPER, .moves = {MOVE_POISON_TAIL, MOVE_SCREECH, MOVE_GLARE, MOVE_CRUNCH} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Jessica4[] = { +static const struct TrainerMon sParty_Jessica4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 41, .species = SPECIES_KECLEON, .moves = {MOVE_BIND, MOVE_LICK, MOVE_FURY_SWIPES, MOVE_FEINT_ATTACK} }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 41, .species = SPECIES_SEVIPER, .moves = {MOVE_POISON_TAIL, MOVE_SCREECH, MOVE_GLARE, MOVE_CRUNCH} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Jessica5[] = { +static const struct TrainerMon sParty_Jessica5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 44, .species = SPECIES_KECLEON, .moves = {MOVE_BIND, MOVE_LICK, MOVE_FURY_SWIPES, MOVE_FEINT_ATTACK} }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 44, .species = SPECIES_SEVIPER, .moves = {MOVE_POISON_TAIL, MOVE_SCREECH, MOVE_GLARE, MOVE_CRUNCH} } }; -static const struct TrainerMonItemDefaultMoves sParty_Winston1[] = { +static const struct TrainerMon sParty_Winston1[] = { { - .iv = 0, .lvl = 7, .species = SPECIES_ZIGZAGOON, .heldItem = ITEM_NUGGET } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Mollie[] = { +static const struct TrainerMon sParty_Mollie[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_WHISCASH, }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 33, .species = SPECIES_MEDITITE, } }; -static const struct TrainerMonItemDefaultMoves sParty_Garret[] = { +static const struct TrainerMon sParty_Garret[] = { { - .iv = 0, .lvl = 45, .species = SPECIES_AZUMARILL, .heldItem = ITEM_NUGGET } }; -static const struct TrainerMonItemDefaultMoves sParty_Winston2[] = { +static const struct TrainerMon sParty_Winston2[] = { { - .iv = 0, .lvl = 27, .species = SPECIES_LINOONE, .heldItem = ITEM_NUGGET } }; -static const struct TrainerMonItemDefaultMoves sParty_Winston3[] = { +static const struct TrainerMon sParty_Winston3[] = { { - .iv = 0, .lvl = 30, .species = SPECIES_LINOONE, .heldItem = ITEM_NUGGET } }; -static const struct TrainerMonItemDefaultMoves sParty_Winston4[] = { +static const struct TrainerMon sParty_Winston4[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_LINOONE, .heldItem = ITEM_NUGGET } }; -static const struct TrainerMonItemCustomMoves sParty_Winston5[] = { +static const struct TrainerMon sParty_Winston5[] = { { - .iv = 0, .lvl = 36, .species = SPECIES_LINOONE, .heldItem = ITEM_NUGGET, @@ -1774,1475 +1693,1396 @@ static const struct TrainerMonItemCustomMoves sParty_Winston5[] = { } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Steve1[] = { +static const struct TrainerMon sParty_Steve1[] = { { - .iv = 0, .lvl = 19, .species = SPECIES_ARON, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Thalia1[] = { +static const struct TrainerMon sParty_Thalia1[] = { { - .iv = 0, .lvl = 25, .species = SPECIES_WAILMER, }, { - .iv = 0, .lvl = 25, .species = SPECIES_HORSEA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Mark[] = { +static const struct TrainerMon sParty_Mark[] = { { - .iv = 0, .lvl = 31, .species = SPECIES_RHYHORN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMtChimney1[] = { +static const struct TrainerMon sParty_GruntMtChimney1[] = { { - .iv = 0, .lvl = 20, .species = SPECIES_NUMEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Steve2[] = { +static const struct TrainerMon sParty_Steve2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 27, .species = SPECIES_LAIRON, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Steve3[] = { +static const struct TrainerMon sParty_Steve3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 29, .species = SPECIES_LAIRON, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 29, .species = SPECIES_RHYHORN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Steve4[] = { +static const struct TrainerMon sParty_Steve4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 32, .species = SPECIES_LAIRON, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 32, .species = SPECIES_RHYHORN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Steve5[] = { +static const struct TrainerMon sParty_Steve5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 35, .species = SPECIES_AGGRON, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 35, .species = SPECIES_RHYDON, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Luis[] = { +static const struct TrainerMon sParty_Luis[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Dominik[] = { +static const struct TrainerMon sParty_Dominik[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_TENTACOOL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Douglas[] = { +static const struct TrainerMon sParty_Douglas[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 24, .species = SPECIES_TENTACOOL, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 24, .species = SPECIES_TENTACOOL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Darrin[] = { +static const struct TrainerMon sParty_Darrin[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 24, .species = SPECIES_TENTACOOL, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 24, .species = SPECIES_WINGULL, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 24, .species = SPECIES_TENTACOOL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Tony1[] = { +static const struct TrainerMon sParty_Tony1[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jerome[] = { +static const struct TrainerMon sParty_Jerome[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_TENTACRUEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Matthew[] = { +static const struct TrainerMon sParty_Matthew[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_David[] = { +static const struct TrainerMon sParty_David[] = { { - .iv = 0, .lvl = 25, .species = SPECIES_TENTACOOL, }, { - .iv = 0, .lvl = 25, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Spencer[] = { +static const struct TrainerMon sParty_Spencer[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_TENTACOOL, }, { - .iv = 0, .lvl = 33, .species = SPECIES_WINGULL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Roland[] = { +static const struct TrainerMon sParty_Roland[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Nolen[] = { +static const struct TrainerMon sParty_Nolen[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_TENTACRUEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Stan[] = { +static const struct TrainerMon sParty_Stan[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_HORSEA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Barry[] = { +static const struct TrainerMon sParty_Barry[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_GYARADOS, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Dean[] = { +static const struct TrainerMon sParty_Dean[] = { { - .iv = 0, .lvl = 31, .species = SPECIES_CARVANHA, }, { - .iv = 0, .lvl = 31, .species = SPECIES_WINGULL, }, { - .iv = 0, .lvl = 31, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Rodney[] = { +static const struct TrainerMon sParty_Rodney[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_GYARADOS, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Richard[] = { +static const struct TrainerMon sParty_Richard[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_PELIPPER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Herman[] = { +static const struct TrainerMon sParty_Herman[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_WINGULL, }, { - .iv = 0, .lvl = 33, .species = SPECIES_TENTACRUEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Santiago[] = { +static const struct TrainerMon sParty_Santiago[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_TENTACRUEL, }, { - .iv = 0, .lvl = 33, .species = SPECIES_WAILMER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Gilbert[] = { +static const struct TrainerMon sParty_Gilbert[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_SHARPEDO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Franklin[] = { +static const struct TrainerMon sParty_Franklin[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_SEALEO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Kevin[] = { +static const struct TrainerMon sParty_Kevin[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_SPHEAL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jack[] = { +static const struct TrainerMon sParty_Jack[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_GYARADOS, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Dudley[] = { +static const struct TrainerMon sParty_Dudley[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_TENTACOOL, }, { - .iv = 0, .lvl = 33, .species = SPECIES_WINGULL, }, { - .iv = 0, .lvl = 33, .species = SPECIES_TENTACRUEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Chad[] = { +static const struct TrainerMon sParty_Chad[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_TENTACOOL, }, { - .iv = 0, .lvl = 33, .species = SPECIES_WAILMER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Tony2[] = { +static const struct TrainerMon sParty_Tony2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 30, .species = SPECIES_SHARPEDO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Tony3[] = { +static const struct TrainerMon sParty_Tony3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 33, .species = SPECIES_SHARPEDO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Tony4[] = { +static const struct TrainerMon sParty_Tony4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 34, .species = SPECIES_STARYU, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 36, .species = SPECIES_SHARPEDO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Tony5[] = { +static const struct TrainerMon sParty_Tony5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 37, .species = SPECIES_STARMIE, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 39, .species = SPECIES_SHARPEDO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Takao[] = { +static const struct TrainerMon sParty_Takao[] = { { - .iv = 127, + .iv = TRAINER_PARTY_IVS(15, 15, 15, 15, 15, 15), .lvl = 13, .species = SPECIES_MACHOP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Hitoshi[] = { +static const struct TrainerMon sParty_Hitoshi[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 32, .species = SPECIES_MACHOP, }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 32, .species = SPECIES_MACHOKE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Kiyo[] = { +static const struct TrainerMon sParty_Kiyo[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 34, .species = SPECIES_HARIYAMA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Koichi[] = { +static const struct TrainerMon sParty_Koichi[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 24, .species = SPECIES_MACHOP, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 28, .species = SPECIES_MACHOKE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Nob1[] = { +static const struct TrainerMon sParty_Nob1[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 19, .species = SPECIES_MACHOP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Nob2[] = { +static const struct TrainerMon sParty_Nob2[] = { { - .iv = 110, + .iv = TRAINER_PARTY_IVS(13, 13, 13, 13, 13, 13), .lvl = 27, .species = SPECIES_MACHOKE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Nob3[] = { +static const struct TrainerMon sParty_Nob3[] = { { - .iv = 120, + .iv = TRAINER_PARTY_IVS(14, 14, 14, 14, 14, 14), .lvl = 29, .species = SPECIES_MACHOP, }, { - .iv = 120, + .iv = TRAINER_PARTY_IVS(14, 14, 14, 14, 14, 14), .lvl = 29, .species = SPECIES_MACHOKE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Nob4[] = { +static const struct TrainerMon sParty_Nob4[] = { { - .iv = 130, + .iv = TRAINER_PARTY_IVS(15, 15, 15, 15, 15, 15), .lvl = 31, .species = SPECIES_MACHOP, }, { - .iv = 130, + .iv = TRAINER_PARTY_IVS(15, 15, 15, 15, 15, 15), .lvl = 31, .species = SPECIES_MACHOKE, }, { - .iv = 130, + .iv = TRAINER_PARTY_IVS(15, 15, 15, 15, 15, 15), .lvl = 31, .species = SPECIES_MACHOKE, } }; -static const struct TrainerMonItemDefaultMoves sParty_Nob5[] = { +static const struct TrainerMon sParty_Nob5[] = { { - .iv = 140, + .iv = TRAINER_PARTY_IVS(17, 17, 17, 17, 17, 17), .lvl = 33, .species = SPECIES_MACHOP, .heldItem = ITEM_NONE }, { - .iv = 140, + .iv = TRAINER_PARTY_IVS(17, 17, 17, 17, 17, 17), .lvl = 33, .species = SPECIES_MACHOKE, .heldItem = ITEM_NONE }, { - .iv = 140, + .iv = TRAINER_PARTY_IVS(17, 17, 17, 17, 17, 17), .lvl = 33, .species = SPECIES_MACHOKE, .heldItem = ITEM_NONE }, { - .iv = 140, + .iv = TRAINER_PARTY_IVS(17, 17, 17, 17, 17, 17), .lvl = 33, .species = SPECIES_MACHAMP, .heldItem = ITEM_BLACK_BELT } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Yuji[] = { +static const struct TrainerMon sParty_Yuji[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 26, .species = SPECIES_MAKUHITA, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 26, .species = SPECIES_MACHOKE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Daisuke[] = { +static const struct TrainerMon sParty_Daisuke[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 19, .species = SPECIES_MACHOP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Atsushi[] = { +static const struct TrainerMon sParty_Atsushi[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 32, .species = SPECIES_HARIYAMA, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Kirk[] = { +static const struct TrainerMon sParty_Kirk[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 17, .species = SPECIES_ELECTRIKE, .moves = {MOVE_QUICK_ATTACK, MOVE_THUNDER_WAVE, MOVE_SPARK, MOVE_LEER} }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 17, .species = SPECIES_VOLTORB, .moves = {MOVE_CHARGE, MOVE_SHOCK_WAVE, MOVE_SCREECH, MOVE_NONE} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntAquaHideout7[] = { +static const struct TrainerMon sParty_GruntAquaHideout7[] = { { - .iv = 0, .lvl = 31, .species = SPECIES_POOCHYENA, }, { - .iv = 0, .lvl = 31, .species = SPECIES_ZUBAT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntAquaHideout8[] = { +static const struct TrainerMon sParty_GruntAquaHideout8[] = { { - .iv = 0, .lvl = 32, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Shawn[] = { +static const struct TrainerMon sParty_Shawn[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 17, .species = SPECIES_VOLTORB, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 17, .species = SPECIES_MAGNEMITE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Fernando1[] = { +static const struct TrainerMon sParty_Fernando1[] = { { - .iv = 0, .lvl = 30, .species = SPECIES_ELECTRIKE, }, { - .iv = 0, .lvl = 30, .species = SPECIES_LOUDRED, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Dalton1[] = { +static const struct TrainerMon sParty_Dalton1[] = { { - .iv = 0, .lvl = 15, .species = SPECIES_MAGNEMITE, }, { - .iv = 0, .lvl = 15, .species = SPECIES_WHISMUR, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Dalton2[] = { +static const struct TrainerMon sParty_Dalton2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 25, .species = SPECIES_MAGNEMITE, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 25, .species = SPECIES_WHISMUR, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 25, .species = SPECIES_MAGNEMITE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Dalton3[] = { +static const struct TrainerMon sParty_Dalton3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 28, .species = SPECIES_MAGNEMITE, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 28, .species = SPECIES_LOUDRED, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 28, .species = SPECIES_MAGNEMITE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Dalton4[] = { +static const struct TrainerMon sParty_Dalton4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 31, .species = SPECIES_MAGNETON, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 31, .species = SPECIES_LOUDRED, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 31, .species = SPECIES_MAGNETON, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Dalton5[] = { +static const struct TrainerMon sParty_Dalton5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 34, .species = SPECIES_MAGNETON, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 34, .species = SPECIES_EXPLOUD, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 34, .species = SPECIES_MAGNETON, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cole[] = { +static const struct TrainerMon sParty_Cole[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 23, .species = SPECIES_NUMEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jeff[] = { +static const struct TrainerMon sParty_Jeff[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 22, .species = SPECIES_SLUGMA, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 22, .species = SPECIES_SLUGMA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Axle[] = { +static const struct TrainerMon sParty_Axle[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 23, .species = SPECIES_NUMEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jace[] = { +static const struct TrainerMon sParty_Jace[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 23, .species = SPECIES_SLUGMA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Keegan[] = { +static const struct TrainerMon sParty_Keegan[] = { { - .iv = 120, + .iv = TRAINER_PARTY_IVS(14, 14, 14, 14, 14, 14), .lvl = 23, .species = SPECIES_SLUGMA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Bernie1[] = { +static const struct TrainerMon sParty_Bernie1[] = { { - .iv = 0, .lvl = 18, .species = SPECIES_SLUGMA, }, { - .iv = 0, .lvl = 18, .species = SPECIES_WINGULL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Bernie2[] = { +static const struct TrainerMon sParty_Bernie2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 26, .species = SPECIES_SLUGMA, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 26, .species = SPECIES_WINGULL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Bernie3[] = { +static const struct TrainerMon sParty_Bernie3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 29, .species = SPECIES_SLUGMA, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 29, .species = SPECIES_PELIPPER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Bernie4[] = { +static const struct TrainerMon sParty_Bernie4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 32, .species = SPECIES_SLUGMA, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 32, .species = SPECIES_PELIPPER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Bernie5[] = { +static const struct TrainerMon sParty_Bernie5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 35, .species = SPECIES_MAGCARGO, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 35, .species = SPECIES_PELIPPER, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Drew[] = { +static const struct TrainerMon sParty_Drew[] = { { - .iv = 0, .lvl = 23, .species = SPECIES_SANDSHREW, .moves = {MOVE_DIG, MOVE_SAND_ATTACK, MOVE_POISON_STING, MOVE_SLASH} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Beau[] = { +static const struct TrainerMon sParty_Beau[] = { { - .iv = 0, .lvl = 21, .species = SPECIES_BALTOY, .moves = {MOVE_RAPID_SPIN, MOVE_MUD_SLAP, MOVE_PSYBEAM, MOVE_ROCK_TOMB} }, { - .iv = 0, .lvl = 21, .species = SPECIES_SANDSHREW, .moves = {MOVE_POISON_STING, MOVE_SAND_ATTACK, MOVE_SCRATCH, MOVE_DIG} }, { - .iv = 0, .lvl = 21, .species = SPECIES_BALTOY, .moves = {MOVE_RAPID_SPIN, MOVE_MUD_SLAP, MOVE_PSYBEAM, MOVE_ROCK_TOMB} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Larry[] = { +static const struct TrainerMon sParty_Larry[] = { { - .iv = 0, .lvl = 18, .species = SPECIES_NUZLEAF, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Shane[] = { +static const struct TrainerMon sParty_Shane[] = { { - .iv = 0, .lvl = 18, .species = SPECIES_SANDSHREW, }, { - .iv = 0, .lvl = 18, .species = SPECIES_NUZLEAF, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Justin[] = { +static const struct TrainerMon sParty_Justin[] = { { - .iv = 0, .lvl = 24, .species = SPECIES_KECLEON, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Ethan1[] = { +static const struct TrainerMon sParty_Ethan1[] = { { - .iv = 0, .lvl = 20, .species = SPECIES_ZIGZAGOON, }, { - .iv = 0, .lvl = 20, .species = SPECIES_TAILLOW, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Autumn[] = { +static const struct TrainerMon sParty_Autumn[] = { { - .iv = 0, .lvl = 21, .species = SPECIES_SHROOMISH, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Travis[] = { +static const struct TrainerMon sParty_Travis[] = { { - .iv = 0, .lvl = 18, .species = SPECIES_SANDSHREW, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Ethan2[] = { +static const struct TrainerMon sParty_Ethan2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 26, .species = SPECIES_ZIGZAGOON, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 26, .species = SPECIES_TAILLOW, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Ethan3[] = { +static const struct TrainerMon sParty_Ethan3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 29, .species = SPECIES_LINOONE, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 29, .species = SPECIES_SWELLOW, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Ethan4[] = { +static const struct TrainerMon sParty_Ethan4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 31, .species = SPECIES_SANDSHREW, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 31, .species = SPECIES_SWELLOW, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 31, .species = SPECIES_LINOONE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Ethan5[] = { +static const struct TrainerMon sParty_Ethan5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 34, .species = SPECIES_SWELLOW, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 34, .species = SPECIES_SANDSLASH, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 34, .species = SPECIES_LINOONE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Brent[] = { +static const struct TrainerMon sParty_Brent[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 26, .species = SPECIES_SURSKIT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Donald[] = { +static const struct TrainerMon sParty_Donald[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 24, .species = SPECIES_WURMPLE, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 24, .species = SPECIES_SILCOON, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 24, .species = SPECIES_BEAUTIFLY, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Taylor[] = { +static const struct TrainerMon sParty_Taylor[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 27, .species = SPECIES_WURMPLE, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 27, .species = SPECIES_CASCOON, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 27, .species = SPECIES_DUSTOX, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jeffrey1[] = { +static const struct TrainerMon sParty_Jeffrey1[] = { { - .iv = 0, .lvl = 27, .species = SPECIES_SURSKIT, }, { - .iv = 0, .lvl = 27, .species = SPECIES_SURSKIT, }, { - .iv = 0, .lvl = 27, .species = SPECIES_SURSKIT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Derek[] = { +static const struct TrainerMon sParty_Derek[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 16, .species = SPECIES_DUSTOX, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 16, .species = SPECIES_BEAUTIFLY, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jeffrey2[] = { +static const struct TrainerMon sParty_Jeffrey2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 31, .species = SPECIES_SURSKIT, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 31, .species = SPECIES_SURSKIT, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 31, .species = SPECIES_SURSKIT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jeffrey3[] = { +static const struct TrainerMon sParty_Jeffrey3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 34, .species = SPECIES_SURSKIT, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 34, .species = SPECIES_SURSKIT, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 34, .species = SPECIES_MASQUERAIN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jeffrey4[] = { +static const struct TrainerMon sParty_Jeffrey4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 36, .species = SPECIES_SURSKIT, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 36, .species = SPECIES_WURMPLE, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 36, .species = SPECIES_SURSKIT, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 36, .species = SPECIES_MASQUERAIN, } }; -static const struct TrainerMonItemDefaultMoves sParty_Jeffrey5[] = { +static const struct TrainerMon sParty_Jeffrey5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 38, .species = SPECIES_SURSKIT, .heldItem = ITEM_NONE }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 38, .species = SPECIES_DUSTOX, .heldItem = ITEM_NONE }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 38, .species = SPECIES_SURSKIT, .heldItem = ITEM_NONE }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 38, .species = SPECIES_MASQUERAIN, .heldItem = ITEM_SILVER_POWDER }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 38, .species = SPECIES_BEAUTIFLY, .heldItem = ITEM_NONE } }; -static const struct TrainerMonNoItemCustomMoves sParty_Edward[] = { +static const struct TrainerMon sParty_Edward[] = { { - .iv = 0, .lvl = 15, .species = SPECIES_ABRA, .moves = {MOVE_HIDDEN_POWER, MOVE_NONE, MOVE_NONE, MOVE_NONE} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Preston[] = { +static const struct TrainerMon sParty_Preston[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 36, .species = SPECIES_KIRLIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Virgil[] = { +static const struct TrainerMon sParty_Virgil[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 36, .species = SPECIES_RALTS, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Blake[] = { +static const struct TrainerMon sParty_Blake[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 36, .species = SPECIES_GIRAFARIG, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_William[] = { +static const struct TrainerMon sParty_William[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_RALTS, }, { - .iv = 0, .lvl = 26, .species = SPECIES_RALTS, }, { - .iv = 0, .lvl = 26, .species = SPECIES_KIRLIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Joshua[] = { +static const struct TrainerMon sParty_Joshua[] = { { - .iv = 0, .lvl = 41, .species = SPECIES_KADABRA, }, { - .iv = 0, .lvl = 41, .species = SPECIES_SOLROCK, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cameron1[] = { +static const struct TrainerMon sParty_Cameron1[] = { { - .iv = 0, .lvl = 31, .species = SPECIES_SOLROCK, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cameron2[] = { +static const struct TrainerMon sParty_Cameron2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 33, .species = SPECIES_KADABRA, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 33, .species = SPECIES_SOLROCK, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cameron3[] = { +static const struct TrainerMon sParty_Cameron3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 38, .species = SPECIES_KADABRA, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 38, .species = SPECIES_SOLROCK, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cameron4[] = { +static const struct TrainerMon sParty_Cameron4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 41, .species = SPECIES_KADABRA, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 41, .species = SPECIES_SOLROCK, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cameron5[] = { +static const struct TrainerMon sParty_Cameron5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 45, .species = SPECIES_SOLROCK, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 45, .species = SPECIES_ALAKAZAM, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Jaclyn[] = { +static const struct TrainerMon sParty_Jaclyn[] = { { - .iv = 0, .lvl = 16, .species = SPECIES_ABRA, .moves = {MOVE_HIDDEN_POWER, MOVE_NONE, MOVE_NONE, MOVE_NONE} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Hannah[] = { +static const struct TrainerMon sParty_Hannah[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 36, .species = SPECIES_KIRLIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Samantha[] = { +static const struct TrainerMon sParty_Samantha[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 36, .species = SPECIES_XATU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Maura[] = { +static const struct TrainerMon sParty_Maura[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 36, .species = SPECIES_KADABRA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Kayla[] = { +static const struct TrainerMon sParty_Kayla[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_WOBBUFFET, }, { - .iv = 0, .lvl = 26, .species = SPECIES_NATU, }, { - .iv = 0, .lvl = 26, .species = SPECIES_KADABRA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Alexis[] = { +static const struct TrainerMon sParty_Alexis[] = { { - .iv = 0, .lvl = 41, .species = SPECIES_KIRLIA, }, { - .iv = 0, .lvl = 41, .species = SPECIES_XATU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jacki1[] = { +static const struct TrainerMon sParty_Jacki1[] = { { - .iv = 0, .lvl = 30, .species = SPECIES_KADABRA, }, { - .iv = 0, .lvl = 30, .species = SPECIES_LUNATONE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jacki2[] = { +static const struct TrainerMon sParty_Jacki2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 34, .species = SPECIES_KADABRA, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 34, .species = SPECIES_LUNATONE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jacki3[] = { +static const struct TrainerMon sParty_Jacki3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 37, .species = SPECIES_KADABRA, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 37, .species = SPECIES_LUNATONE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jacki4[] = { +static const struct TrainerMon sParty_Jacki4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 40, .species = SPECIES_KADABRA, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 40, .species = SPECIES_LUNATONE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jacki5[] = { +static const struct TrainerMon sParty_Jacki5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 43, .species = SPECIES_LUNATONE, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 43, .species = SPECIES_ALAKAZAM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Walter1[] = { +static const struct TrainerMon sParty_Walter1[] = { { - .iv = 0, .lvl = 29, .species = SPECIES_MANECTRIC, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Micah[] = { +static const struct TrainerMon sParty_Micah[] = { { - .iv = 0, .lvl = 44, .species = SPECIES_MANECTRIC, }, { - .iv = 0, .lvl = 44, .species = SPECIES_MANECTRIC, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Thomas[] = { +static const struct TrainerMon sParty_Thomas[] = { { - .iv = 0, .lvl = 45, .species = SPECIES_ZANGOOSE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Walter2[] = { +static const struct TrainerMon sParty_Walter2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 34, .species = SPECIES_MANECTRIC, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Walter3[] = { +static const struct TrainerMon sParty_Walter3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 36, .species = SPECIES_LINOONE, .moves = {MOVE_HEADBUTT, MOVE_SAND_ATTACK, MOVE_ODOR_SLEUTH, MOVE_FURY_SWIPES} }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 36, .species = SPECIES_MANECTRIC, .moves = {MOVE_QUICK_ATTACK, MOVE_SPARK, MOVE_ODOR_SLEUTH, MOVE_ROAR} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Walter4[] = { +static const struct TrainerMon sParty_Walter4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 39, .species = SPECIES_LINOONE, .moves = {MOVE_HEADBUTT, MOVE_SAND_ATTACK, MOVE_ODOR_SLEUTH, MOVE_FURY_SWIPES} }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 39, .species = SPECIES_MANECTRIC, .moves = {MOVE_QUICK_ATTACK, MOVE_SPARK, MOVE_ODOR_SLEUTH, MOVE_NONE} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Walter5[] = { +static const struct TrainerMon sParty_Walter5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 41, .species = SPECIES_LINOONE, .moves = {MOVE_HEADBUTT, MOVE_SAND_ATTACK, MOVE_ODOR_SLEUTH, MOVE_FURY_SWIPES} }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 41, .species = SPECIES_GOLDUCK, .moves = {MOVE_FURY_SWIPES, MOVE_DISABLE, MOVE_CONFUSION, MOVE_PSYCH_UP} }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 41, .species = SPECIES_MANECTRIC, .moves = {MOVE_QUICK_ATTACK, MOVE_SPARK, MOVE_ODOR_SLEUTH, MOVE_ROAR} } }; -static const struct TrainerMonItemCustomMoves sParty_Sidney[] = { +static const struct TrainerMon sParty_Sidney[] = { { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 46, .species = SPECIES_MIGHTYENA, .heldItem = ITEM_NONE, .moves = {MOVE_ROAR, MOVE_DOUBLE_EDGE, MOVE_SAND_ATTACK, MOVE_CRUNCH} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 48, .species = SPECIES_SHIFTRY, .heldItem = ITEM_NONE, .moves = {MOVE_TORMENT, MOVE_DOUBLE_TEAM, MOVE_SWAGGER, MOVE_EXTRASENSORY} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 46, .species = SPECIES_CACTURNE, .heldItem = ITEM_NONE, .moves = {MOVE_LEECH_SEED, MOVE_FEINT_ATTACK, MOVE_NEEDLE_ARM, MOVE_COTTON_SPORE} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 48, .species = SPECIES_CRAWDAUNT, .heldItem = ITEM_NONE, .moves = {MOVE_SURF, MOVE_SWORDS_DANCE, MOVE_STRENGTH, MOVE_FACADE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 49, .species = SPECIES_ABSOL, .heldItem = ITEM_SITRUS_BERRY, @@ -3250,37 +3090,37 @@ static const struct TrainerMonItemCustomMoves sParty_Sidney[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Phoebe[] = { +static const struct TrainerMon sParty_Phoebe[] = { { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 48, .species = SPECIES_DUSCLOPS, .heldItem = ITEM_NONE, .moves = {MOVE_SHADOW_PUNCH, MOVE_CONFUSE_RAY, MOVE_CURSE, MOVE_PROTECT} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 49, .species = SPECIES_BANETTE, .heldItem = ITEM_NONE, .moves = {MOVE_SHADOW_BALL, MOVE_GRUDGE, MOVE_WILL_O_WISP, MOVE_FEINT_ATTACK} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 50, .species = SPECIES_SABLEYE, .heldItem = ITEM_NONE, .moves = {MOVE_SHADOW_BALL, MOVE_DOUBLE_TEAM, MOVE_NIGHT_SHADE, MOVE_FEINT_ATTACK} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 49, .species = SPECIES_BANETTE, .heldItem = ITEM_NONE, .moves = {MOVE_SHADOW_BALL, MOVE_PSYCHIC, MOVE_THUNDERBOLT, MOVE_FACADE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 51, .species = SPECIES_DUSCLOPS, .heldItem = ITEM_SITRUS_BERRY, @@ -3288,37 +3128,37 @@ static const struct TrainerMonItemCustomMoves sParty_Phoebe[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Glacia[] = { +static const struct TrainerMon sParty_Glacia[] = { { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 50, .species = SPECIES_SEALEO, .heldItem = ITEM_NONE, .moves = {MOVE_ENCORE, MOVE_BODY_SLAM, MOVE_HAIL, MOVE_ICE_BALL} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 50, .species = SPECIES_GLALIE, .heldItem = ITEM_NONE, .moves = {MOVE_LIGHT_SCREEN, MOVE_CRUNCH, MOVE_ICY_WIND, MOVE_ICE_BEAM} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 52, .species = SPECIES_SEALEO, .heldItem = ITEM_NONE, .moves = {MOVE_ATTRACT, MOVE_DOUBLE_EDGE, MOVE_HAIL, MOVE_BLIZZARD} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 52, .species = SPECIES_GLALIE, .heldItem = ITEM_NONE, .moves = {MOVE_SHADOW_BALL, MOVE_EXPLOSION, MOVE_HAIL, MOVE_ICE_BEAM} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 53, .species = SPECIES_WALREIN, .heldItem = ITEM_SITRUS_BERRY, @@ -3326,37 +3166,37 @@ static const struct TrainerMonItemCustomMoves sParty_Glacia[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Drake[] = { +static const struct TrainerMon sParty_Drake[] = { { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 52, .species = SPECIES_SHELGON, .heldItem = ITEM_NONE, .moves = {MOVE_ROCK_TOMB, MOVE_DRAGON_CLAW, MOVE_PROTECT, MOVE_DOUBLE_EDGE} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 54, .species = SPECIES_ALTARIA, .heldItem = ITEM_NONE, .moves = {MOVE_DOUBLE_EDGE, MOVE_DRAGON_BREATH, MOVE_DRAGON_DANCE, MOVE_AERIAL_ACE} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 53, .species = SPECIES_KINGDRA, .heldItem = ITEM_NONE, .moves = {MOVE_SMOKESCREEN, MOVE_DRAGON_DANCE, MOVE_SURF, MOVE_BODY_SLAM} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 53, .species = SPECIES_FLYGON, .heldItem = ITEM_NONE, .moves = {MOVE_FLAMETHROWER, MOVE_CRUNCH, MOVE_DRAGON_BREATH, MOVE_EARTHQUAKE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 55, .species = SPECIES_SALAMENCE, .heldItem = ITEM_SITRUS_BERRY, @@ -3364,23 +3204,23 @@ static const struct TrainerMonItemCustomMoves sParty_Drake[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Roxanne1[] = { +static const struct TrainerMon sParty_Roxanne1[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 12, .species = SPECIES_GEODUDE, .heldItem = ITEM_NONE, .moves = {MOVE_TACKLE, MOVE_DEFENSE_CURL, MOVE_ROCK_THROW, MOVE_ROCK_TOMB} }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 12, .species = SPECIES_GEODUDE, .heldItem = ITEM_NONE, .moves = {MOVE_TACKLE, MOVE_DEFENSE_CURL, MOVE_ROCK_THROW, MOVE_ROCK_TOMB} }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 15, .species = SPECIES_NOSEPASS, .heldItem = ITEM_ORAN_BERRY, @@ -3388,23 +3228,23 @@ static const struct TrainerMonItemCustomMoves sParty_Roxanne1[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Brawly1[] = { +static const struct TrainerMon sParty_Brawly1[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 16, .species = SPECIES_MACHOP, .heldItem = ITEM_NONE, .moves = {MOVE_KARATE_CHOP, MOVE_LOW_KICK, MOVE_SEISMIC_TOSS, MOVE_BULK_UP} }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 16, .species = SPECIES_MEDITITE, .heldItem = ITEM_NONE, .moves = {MOVE_FOCUS_PUNCH, MOVE_LIGHT_SCREEN, MOVE_REFLECT, MOVE_BULK_UP} }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 19, .species = SPECIES_MAKUHITA, .heldItem = ITEM_SITRUS_BERRY, @@ -3412,30 +3252,30 @@ static const struct TrainerMonItemCustomMoves sParty_Brawly1[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Wattson1[] = { +static const struct TrainerMon sParty_Wattson1[] = { { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 20, .species = SPECIES_VOLTORB, .heldItem = ITEM_NONE, .moves = {MOVE_ROLLOUT, MOVE_SPARK, MOVE_SELF_DESTRUCT, MOVE_SHOCK_WAVE} }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 20, .species = SPECIES_ELECTRIKE, .heldItem = ITEM_NONE, .moves = {MOVE_SHOCK_WAVE, MOVE_LEER, MOVE_QUICK_ATTACK, MOVE_HOWL} }, { - .iv = 220, + .iv = TRAINER_PARTY_IVS(26, 26, 26, 26, 26, 26), .lvl = 22, .species = SPECIES_MAGNETON, .heldItem = ITEM_NONE, .moves = {MOVE_SUPERSONIC, MOVE_SHOCK_WAVE, MOVE_THUNDER_WAVE, MOVE_SONIC_BOOM} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 24, .species = SPECIES_MANECTRIC, .heldItem = ITEM_SITRUS_BERRY, @@ -3443,30 +3283,30 @@ static const struct TrainerMonItemCustomMoves sParty_Wattson1[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Flannery1[] = { +static const struct TrainerMon sParty_Flannery1[] = { { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 24, .species = SPECIES_NUMEL, .heldItem = ITEM_NONE, .moves = {MOVE_OVERHEAT, MOVE_TAKE_DOWN, MOVE_MAGNITUDE, MOVE_SUNNY_DAY} }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 24, .species = SPECIES_SLUGMA, .heldItem = ITEM_NONE, .moves = {MOVE_OVERHEAT, MOVE_SMOG, MOVE_LIGHT_SCREEN, MOVE_SUNNY_DAY} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 26, .species = SPECIES_CAMERUPT, .heldItem = ITEM_NONE, .moves = {MOVE_OVERHEAT, MOVE_TACKLE, MOVE_SUNNY_DAY, MOVE_ATTRACT} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 29, .species = SPECIES_TORKOAL, .heldItem = ITEM_WHITE_HERB, @@ -3474,30 +3314,30 @@ static const struct TrainerMonItemCustomMoves sParty_Flannery1[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Norman1[] = { +static const struct TrainerMon sParty_Norman1[] = { { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 27, .species = SPECIES_SPINDA, .heldItem = ITEM_NONE, .moves = {MOVE_TEETER_DANCE, MOVE_PSYBEAM, MOVE_FACADE, MOVE_ENCORE} }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 27, .species = SPECIES_VIGOROTH, .heldItem = ITEM_NONE, .moves = {MOVE_SLASH, MOVE_FACADE, MOVE_ENCORE, MOVE_FEINT_ATTACK} }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 29, .species = SPECIES_LINOONE, .heldItem = ITEM_NONE, .moves = {MOVE_SLASH, MOVE_BELLY_DRUM, MOVE_FACADE, MOVE_HEADBUTT} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 31, .species = SPECIES_SLAKING, .heldItem = ITEM_SITRUS_BERRY, @@ -3505,37 +3345,37 @@ static const struct TrainerMonItemCustomMoves sParty_Norman1[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Winona1[] = { +static const struct TrainerMon sParty_Winona1[] = { { - .iv = 210, + .iv = TRAINER_PARTY_IVS(25, 25, 25, 25, 25, 25), .lvl = 29, .species = SPECIES_SWABLU, .heldItem = ITEM_NONE, .moves = {MOVE_PERISH_SONG, MOVE_MIRROR_MOVE, MOVE_SAFEGUARD, MOVE_AERIAL_ACE} }, { - .iv = 210, + .iv = TRAINER_PARTY_IVS(25, 25, 25, 25, 25, 25), .lvl = 29, .species = SPECIES_TROPIUS, .heldItem = ITEM_NONE, .moves = {MOVE_SUNNY_DAY, MOVE_AERIAL_ACE, MOVE_SOLAR_BEAM, MOVE_SYNTHESIS} }, { - .iv = 210, + .iv = TRAINER_PARTY_IVS(25, 25, 25, 25, 25, 25), .lvl = 30, .species = SPECIES_PELIPPER, .heldItem = ITEM_NONE, .moves = {MOVE_WATER_GUN, MOVE_SUPERSONIC, MOVE_PROTECT, MOVE_AERIAL_ACE} }, { - .iv = 220, + .iv = TRAINER_PARTY_IVS(26, 26, 26, 26, 26, 26), .lvl = 31, .species = SPECIES_SKARMORY, .heldItem = ITEM_NONE, .moves = {MOVE_SAND_ATTACK, MOVE_FURY_ATTACK, MOVE_STEEL_WING, MOVE_AERIAL_ACE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 33, .species = SPECIES_ALTARIA, .heldItem = ITEM_ORAN_BERRY, @@ -3543,30 +3383,30 @@ static const struct TrainerMonItemCustomMoves sParty_Winona1[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_TateAndLiza1[] = { +static const struct TrainerMon sParty_TateAndLiza1[] = { { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 41, .species = SPECIES_CLAYDOL, .heldItem = ITEM_NONE, .moves = {MOVE_EARTHQUAKE, MOVE_ANCIENT_POWER, MOVE_PSYCHIC, MOVE_LIGHT_SCREEN} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 41, .species = SPECIES_XATU, .heldItem = ITEM_NONE, .moves = {MOVE_PSYCHIC, MOVE_SUNNY_DAY, MOVE_CONFUSE_RAY, MOVE_CALM_MIND} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 42, .species = SPECIES_LUNATONE, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_LIGHT_SCREEN, MOVE_PSYCHIC, MOVE_HYPNOSIS, MOVE_CALM_MIND} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 42, .species = SPECIES_SOLROCK, .heldItem = ITEM_SITRUS_BERRY, @@ -3574,37 +3414,37 @@ static const struct TrainerMonItemCustomMoves sParty_TateAndLiza1[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Juan1[] = { +static const struct TrainerMon sParty_Juan1[] = { { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 41, .species = SPECIES_LUVDISC, .heldItem = ITEM_NONE, .moves = {MOVE_WATER_PULSE, MOVE_ATTRACT, MOVE_SWEET_KISS, MOVE_FLAIL} }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 41, .species = SPECIES_WHISCASH, .heldItem = ITEM_NONE, .moves = {MOVE_RAIN_DANCE, MOVE_WATER_PULSE, MOVE_AMNESIA, MOVE_EARTHQUAKE} }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 43, .species = SPECIES_SEALEO, .heldItem = ITEM_NONE, .moves = {MOVE_ENCORE, MOVE_BODY_SLAM, MOVE_AURORA_BEAM, MOVE_WATER_PULSE} }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 43, .species = SPECIES_CRAWDAUNT, .heldItem = ITEM_NONE, .moves = {MOVE_WATER_PULSE, MOVE_CRABHAMMER, MOVE_TAUNT, MOVE_LEER} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 46, .species = SPECIES_KINGDRA, .heldItem = ITEM_CHESTO_BERRY, @@ -3612,322 +3452,311 @@ static const struct TrainerMonItemCustomMoves sParty_Juan1[] = { } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jerry1[] = { +static const struct TrainerMon sParty_Jerry1[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 9, .species = SPECIES_RALTS, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Ted[] = { +static const struct TrainerMon sParty_Ted[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 17, .species = SPECIES_RALTS, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Paul[] = { +static const struct TrainerMon sParty_Paul[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 15, .species = SPECIES_NUMEL, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 15, .species = SPECIES_ODDISH, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 15, .species = SPECIES_WINGULL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jerry2[] = { +static const struct TrainerMon sParty_Jerry2[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 26, .species = SPECIES_RALTS, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 26, .species = SPECIES_MEDITITE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jerry3[] = { +static const struct TrainerMon sParty_Jerry3[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 29, .species = SPECIES_KIRLIA, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 29, .species = SPECIES_MEDITITE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jerry4[] = { +static const struct TrainerMon sParty_Jerry4[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 32, .species = SPECIES_KIRLIA, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 32, .species = SPECIES_MEDICHAM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jerry5[] = { +static const struct TrainerMon sParty_Jerry5[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 34, .species = SPECIES_KIRLIA, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 34, .species = SPECIES_BANETTE, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 34, .species = SPECIES_MEDICHAM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Karen1[] = { +static const struct TrainerMon sParty_Karen1[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 9, .species = SPECIES_SHROOMISH, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Georgia[] = { +static const struct TrainerMon sParty_Georgia[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 16, .species = SPECIES_SHROOMISH, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 16, .species = SPECIES_BEAUTIFLY, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Karen2[] = { +static const struct TrainerMon sParty_Karen2[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 26, .species = SPECIES_SHROOMISH, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 26, .species = SPECIES_WHISMUR, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Karen3[] = { +static const struct TrainerMon sParty_Karen3[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 29, .species = SPECIES_SHROOMISH, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 29, .species = SPECIES_LOUDRED, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Karen4[] = { +static const struct TrainerMon sParty_Karen4[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 32, .species = SPECIES_BRELOOM, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 32, .species = SPECIES_LOUDRED, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Karen5[] = { +static const struct TrainerMon sParty_Karen5[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 35, .species = SPECIES_BRELOOM, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 35, .species = SPECIES_EXPLOUD, } }; -static const struct TrainerMonNoItemCustomMoves sParty_KateAndJoy[] = { +static const struct TrainerMon sParty_KateAndJoy[] = { { - .iv = 0, .lvl = 30, .species = SPECIES_SPINDA, .moves = {MOVE_HYPNOSIS, MOVE_PSYBEAM, MOVE_DIZZY_PUNCH, MOVE_TEETER_DANCE} }, { - .iv = 0, .lvl = 32, .species = SPECIES_SLAKING, .moves = {MOVE_FOCUS_PUNCH, MOVE_YAWN, MOVE_SLACK_OFF, MOVE_FEINT_ATTACK} } }; -static const struct TrainerMonNoItemCustomMoves sParty_AnnaAndMeg1[] = { +static const struct TrainerMon sParty_AnnaAndMeg1[] = { { - .iv = 0, .lvl = 15, .species = SPECIES_ZIGZAGOON, .moves = {MOVE_GROWL, MOVE_TAIL_WHIP, MOVE_HEADBUTT, MOVE_ODOR_SLEUTH} }, { - .iv = 0, .lvl = 17, .species = SPECIES_MAKUHITA, .moves = {MOVE_TACKLE, MOVE_FOCUS_ENERGY, MOVE_ARM_THRUST, MOVE_NONE} } }; -static const struct TrainerMonNoItemCustomMoves sParty_AnnaAndMeg2[] = { +static const struct TrainerMon sParty_AnnaAndMeg2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 28, .species = SPECIES_ZIGZAGOON, .moves = {MOVE_GROWL, MOVE_TAIL_WHIP, MOVE_HEADBUTT, MOVE_ODOR_SLEUTH} }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 30, .species = SPECIES_MAKUHITA, .moves = {MOVE_TACKLE, MOVE_FOCUS_ENERGY, MOVE_ARM_THRUST, MOVE_NONE} } }; -static const struct TrainerMonNoItemCustomMoves sParty_AnnaAndMeg3[] = { +static const struct TrainerMon sParty_AnnaAndMeg3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 31, .species = SPECIES_ZIGZAGOON, .moves = {MOVE_GROWL, MOVE_TAIL_WHIP, MOVE_HEADBUTT, MOVE_ODOR_SLEUTH} }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 33, .species = SPECIES_MAKUHITA, .moves = {MOVE_TACKLE, MOVE_FOCUS_ENERGY, MOVE_ARM_THRUST, MOVE_NONE} } }; -static const struct TrainerMonNoItemCustomMoves sParty_AnnaAndMeg4[] = { +static const struct TrainerMon sParty_AnnaAndMeg4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 34, .species = SPECIES_LINOONE, .moves = {MOVE_GROWL, MOVE_TAIL_WHIP, MOVE_HEADBUTT, MOVE_ODOR_SLEUTH} }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 36, .species = SPECIES_MAKUHITA, .moves = {MOVE_TACKLE, MOVE_FOCUS_ENERGY, MOVE_ARM_THRUST, MOVE_NONE} } }; -static const struct TrainerMonNoItemCustomMoves sParty_AnnaAndMeg5[] = { +static const struct TrainerMon sParty_AnnaAndMeg5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 36, .species = SPECIES_LINOONE, .moves = {MOVE_GROWL, MOVE_TAIL_WHIP, MOVE_HEADBUTT, MOVE_ODOR_SLEUTH} }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 38, .species = SPECIES_HARIYAMA, .moves = {MOVE_TACKLE, MOVE_FOCUS_ENERGY, MOVE_ARM_THRUST, MOVE_NONE} } }; -static const struct TrainerMonItemDefaultMoves sParty_Victor[] = { +static const struct TrainerMon sParty_Victor[] = { { - .iv = 25, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 16, .species = SPECIES_TAILLOW, .heldItem = ITEM_ORAN_BERRY }, { - .iv = 25, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 16, .species = SPECIES_ZIGZAGOON, .heldItem = ITEM_ORAN_BERRY } }; -static const struct TrainerMonItemDefaultMoves sParty_Miguel1[] = { +static const struct TrainerMon sParty_Miguel1[] = { { - .iv = 0, .lvl = 15, .species = SPECIES_SKITTY, .heldItem = ITEM_ORAN_BERRY } }; -static const struct TrainerMonItemCustomMoves sParty_Colton[] = { +static const struct TrainerMon sParty_Colton[] = { { - .iv = 0, .lvl = 22, .species = SPECIES_SKITTY, .heldItem = ITEM_ORAN_BERRY, .moves = {MOVE_ASSIST, MOVE_CHARM, MOVE_FEINT_ATTACK, MOVE_HEAL_BELL} }, { - .iv = 0, .lvl = 36, .species = SPECIES_SKITTY, .heldItem = ITEM_ORAN_BERRY, .moves = {MOVE_ASSIST, MOVE_CHARM, MOVE_FEINT_ATTACK, MOVE_HEAL_BELL} }, { - .iv = 0, .lvl = 40, .species = SPECIES_SKITTY, .heldItem = ITEM_ORAN_BERRY, .moves = {MOVE_ASSIST, MOVE_CHARM, MOVE_FEINT_ATTACK, MOVE_HEAL_BELL} }, { - .iv = 0, .lvl = 12, .species = SPECIES_SKITTY, .heldItem = ITEM_ORAN_BERRY, .moves = {MOVE_ASSIST, MOVE_CHARM, MOVE_FEINT_ATTACK, MOVE_HEAL_BELL} }, { - .iv = 0, .lvl = 30, .species = SPECIES_SKITTY, .heldItem = ITEM_ORAN_BERRY, .moves = {MOVE_ASSIST, MOVE_CHARM, MOVE_FEINT_ATTACK, MOVE_HEAL_BELL} }, { - .iv = 0, .lvl = 42, .species = SPECIES_DELCATTY, .heldItem = ITEM_ORAN_BERRY, @@ -3935,520 +3764,501 @@ static const struct TrainerMonItemCustomMoves sParty_Colton[] = { } }; -static const struct TrainerMonItemDefaultMoves sParty_Miguel2[] = { +static const struct TrainerMon sParty_Miguel2[] = { { - .iv = 0, .lvl = 29, .species = SPECIES_SKITTY, .heldItem = ITEM_ORAN_BERRY } }; -static const struct TrainerMonItemDefaultMoves sParty_Miguel3[] = { +static const struct TrainerMon sParty_Miguel3[] = { { - .iv = 0, .lvl = 32, .species = SPECIES_SKITTY, .heldItem = ITEM_ORAN_BERRY } }; -static const struct TrainerMonItemDefaultMoves sParty_Miguel4[] = { +static const struct TrainerMon sParty_Miguel4[] = { { - .iv = 0, .lvl = 35, .species = SPECIES_DELCATTY, .heldItem = ITEM_ORAN_BERRY } }; -static const struct TrainerMonItemDefaultMoves sParty_Miguel5[] = { +static const struct TrainerMon sParty_Miguel5[] = { { - .iv = 0, .lvl = 38, .species = SPECIES_DELCATTY, .heldItem = ITEM_SITRUS_BERRY } }; -static const struct TrainerMonItemDefaultMoves sParty_Victoria[] = { +static const struct TrainerMon sParty_Victoria[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 17, .species = SPECIES_ROSELIA, .heldItem = ITEM_ORAN_BERRY } }; -static const struct TrainerMonItemDefaultMoves sParty_Vanessa[] = { +static const struct TrainerMon sParty_Vanessa[] = { { - .iv = 0, .lvl = 30, .species = SPECIES_PIKACHU, .heldItem = ITEM_ORAN_BERRY } }; -static const struct TrainerMonItemDefaultMoves sParty_Bethany[] = { +static const struct TrainerMon sParty_Bethany[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 35, .species = SPECIES_AZURILL, .heldItem = ITEM_ORAN_BERRY }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 37, .species = SPECIES_MARILL, .heldItem = ITEM_ORAN_BERRY }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 39, .species = SPECIES_AZUMARILL, .heldItem = ITEM_ORAN_BERRY } }; -static const struct TrainerMonItemDefaultMoves sParty_Isabel1[] = { +static const struct TrainerMon sParty_Isabel1[] = { { - .iv = 0, .lvl = 14, .species = SPECIES_PLUSLE, .heldItem = ITEM_ORAN_BERRY }, { - .iv = 0, .lvl = 14, .species = SPECIES_MINUN, .heldItem = ITEM_ORAN_BERRY } }; -static const struct TrainerMonItemDefaultMoves sParty_Isabel2[] = { +static const struct TrainerMon sParty_Isabel2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 26, .species = SPECIES_PLUSLE, .heldItem = ITEM_ORAN_BERRY }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 26, .species = SPECIES_MINUN, .heldItem = ITEM_ORAN_BERRY } }; -static const struct TrainerMonItemDefaultMoves sParty_Isabel3[] = { +static const struct TrainerMon sParty_Isabel3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 29, .species = SPECIES_PLUSLE, .heldItem = ITEM_ORAN_BERRY }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 29, .species = SPECIES_MINUN, .heldItem = ITEM_ORAN_BERRY } }; -static const struct TrainerMonItemDefaultMoves sParty_Isabel4[] = { +static const struct TrainerMon sParty_Isabel4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 32, .species = SPECIES_PLUSLE, .heldItem = ITEM_ORAN_BERRY }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 32, .species = SPECIES_MINUN, .heldItem = ITEM_ORAN_BERRY } }; -static const struct TrainerMonItemDefaultMoves sParty_Isabel5[] = { +static const struct TrainerMon sParty_Isabel5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 35, .species = SPECIES_PLUSLE, .heldItem = ITEM_SITRUS_BERRY }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 35, .species = SPECIES_MINUN, .heldItem = ITEM_SITRUS_BERRY } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Timothy1[] = { +static const struct TrainerMon sParty_Timothy1[] = { { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 27, .species = SPECIES_HARIYAMA, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Timothy2[] = { +static const struct TrainerMon sParty_Timothy2[] = { { - .iv = 210, + .iv = TRAINER_PARTY_IVS(25, 25, 25, 25, 25, 25), .lvl = 33, .species = SPECIES_HARIYAMA, .moves = {MOVE_ARM_THRUST, MOVE_KNOCK_OFF, MOVE_SAND_ATTACK, MOVE_DIG} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Timothy3[] = { +static const struct TrainerMon sParty_Timothy3[] = { { - .iv = 220, + .iv = TRAINER_PARTY_IVS(26, 26, 26, 26, 26, 26), .lvl = 36, .species = SPECIES_HARIYAMA, .moves = {MOVE_ARM_THRUST, MOVE_KNOCK_OFF, MOVE_SAND_ATTACK, MOVE_DIG} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Timothy4[] = { +static const struct TrainerMon sParty_Timothy4[] = { { - .iv = 230, + .iv = TRAINER_PARTY_IVS(27, 27, 27, 27, 27, 27), .lvl = 39, .species = SPECIES_HARIYAMA, .moves = {MOVE_ARM_THRUST, MOVE_BELLY_DRUM, MOVE_SAND_ATTACK, MOVE_DIG} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Timothy5[] = { +static const struct TrainerMon sParty_Timothy5[] = { { - .iv = 240, + .iv = TRAINER_PARTY_IVS(29, 29, 29, 29, 29, 29), .lvl = 42, .species = SPECIES_HARIYAMA, .moves = {MOVE_ARM_THRUST, MOVE_BELLY_DRUM, MOVE_SAND_ATTACK, MOVE_DIG} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Vicky[] = { +static const struct TrainerMon sParty_Vicky[] = { { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 18, .species = SPECIES_MEDITITE, .moves = {MOVE_HIGH_JUMP_KICK, MOVE_MEDITATE, MOVE_CONFUSION, MOVE_DETECT} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Shelby1[] = { +static const struct TrainerMon sParty_Shelby1[] = { { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 21, .species = SPECIES_MEDITITE, }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 21, .species = SPECIES_MAKUHITA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Shelby2[] = { +static const struct TrainerMon sParty_Shelby2[] = { { - .iv = 210, + .iv = TRAINER_PARTY_IVS(25, 25, 25, 25, 25, 25), .lvl = 30, .species = SPECIES_MEDITITE, }, { - .iv = 210, + .iv = TRAINER_PARTY_IVS(25, 25, 25, 25, 25, 25), .lvl = 30, .species = SPECIES_MAKUHITA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Shelby3[] = { +static const struct TrainerMon sParty_Shelby3[] = { { - .iv = 220, + .iv = TRAINER_PARTY_IVS(26, 26, 26, 26, 26, 26), .lvl = 33, .species = SPECIES_MEDICHAM, }, { - .iv = 220, + .iv = TRAINER_PARTY_IVS(26, 26, 26, 26, 26, 26), .lvl = 33, .species = SPECIES_HARIYAMA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Shelby4[] = { +static const struct TrainerMon sParty_Shelby4[] = { { - .iv = 230, + .iv = TRAINER_PARTY_IVS(27, 27, 27, 27, 27, 27), .lvl = 36, .species = SPECIES_MEDICHAM, }, { - .iv = 230, + .iv = TRAINER_PARTY_IVS(27, 27, 27, 27, 27, 27), .lvl = 36, .species = SPECIES_HARIYAMA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Shelby5[] = { +static const struct TrainerMon sParty_Shelby5[] = { { - .iv = 240, + .iv = TRAINER_PARTY_IVS(29, 29, 29, 29, 29, 29), .lvl = 39, .species = SPECIES_MEDICHAM, }, { - .iv = 240, + .iv = TRAINER_PARTY_IVS(29, 29, 29, 29, 29, 29), .lvl = 39, .species = SPECIES_HARIYAMA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Calvin1[] = { +static const struct TrainerMon sParty_Calvin1[] = { { - .iv = 0, .lvl = 5, .species = SPECIES_POOCHYENA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Billy[] = { +static const struct TrainerMon sParty_Billy[] = { { - .iv = 0, .lvl = 5, .species = SPECIES_ZIGZAGOON, }, { - .iv = 0, .lvl = 7, .species = SPECIES_SEEDOT, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Josh[] = { +static const struct TrainerMon sParty_Josh[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 10, .species = SPECIES_GEODUDE, .moves = {MOVE_TACKLE, MOVE_NONE, MOVE_NONE, MOVE_NONE} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Tommy[] = { +static const struct TrainerMon sParty_Tommy[] = { { - .iv = 110, + .iv = TRAINER_PARTY_IVS(13, 13, 13, 13, 13, 13), .lvl = 8, .species = SPECIES_GEODUDE, }, { - .iv = 120, + .iv = TRAINER_PARTY_IVS(14, 14, 14, 14, 14, 14), .lvl = 8, .species = SPECIES_GEODUDE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Joey[] = { +static const struct TrainerMon sParty_Joey[] = { { - .iv = 0, .lvl = 9, .species = SPECIES_MACHOP, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Ben[] = { +static const struct TrainerMon sParty_Ben[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 17, .species = SPECIES_ZIGZAGOON, .moves = {MOVE_HEADBUTT, MOVE_SAND_ATTACK, MOVE_GROWL, MOVE_THUNDERBOLT} }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 17, .species = SPECIES_GULPIN, .moves = {MOVE_AMNESIA, MOVE_SLUDGE, MOVE_YAWN, MOVE_POUND} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Quincy[] = { +static const struct TrainerMon sParty_Quincy[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 43, .species = SPECIES_SLAKING, .moves = {MOVE_ATTRACT, MOVE_ICE_BEAM, MOVE_THUNDERBOLT, MOVE_FLAMETHROWER} }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 43, .species = SPECIES_DUSCLOPS, .moves = {MOVE_SKILL_SWAP, MOVE_PROTECT, MOVE_WILL_O_WISP, MOVE_TOXIC} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Katelynn[] = { +static const struct TrainerMon sParty_Katelynn[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 43, .species = SPECIES_GARDEVOIR, .moves = {MOVE_SKILL_SWAP, MOVE_PSYCHIC, MOVE_THUNDERBOLT, MOVE_CALM_MIND} }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 43, .species = SPECIES_SLAKING, .moves = {MOVE_EARTHQUAKE, MOVE_SHADOW_BALL, MOVE_AERIAL_ACE, MOVE_BRICK_BREAK} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jaylen[] = { +static const struct TrainerMon sParty_Jaylen[] = { { - .iv = 0, .lvl = 19, .species = SPECIES_TRAPINCH, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Dillon[] = { +static const struct TrainerMon sParty_Dillon[] = { { - .iv = 0, .lvl = 19, .species = SPECIES_ARON, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Calvin2[] = { +static const struct TrainerMon sParty_Calvin2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 27, .species = SPECIES_MIGHTYENA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Calvin3[] = { +static const struct TrainerMon sParty_Calvin3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 28, .species = SPECIES_SWELLOW, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 30, .species = SPECIES_MIGHTYENA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Calvin4[] = { +static const struct TrainerMon sParty_Calvin4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 31, .species = SPECIES_SWELLOW, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 29, .species = SPECIES_LINOONE, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 33, .species = SPECIES_MIGHTYENA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Calvin5[] = { +static const struct TrainerMon sParty_Calvin5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 34, .species = SPECIES_SWELLOW, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 32, .species = SPECIES_LINOONE, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 36, .species = SPECIES_MIGHTYENA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Eddie[] = { +static const struct TrainerMon sParty_Eddie[] = { { - .iv = 0, .lvl = 14, .species = SPECIES_ZIGZAGOON, }, { - .iv = 0, .lvl = 16, .species = SPECIES_ZIGZAGOON, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Allen[] = { +static const struct TrainerMon sParty_Allen[] = { { - .iv = 0, .lvl = 4, .species = SPECIES_ZIGZAGOON, }, { - .iv = 0, .lvl = 3, .species = SPECIES_TAILLOW, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Timmy[] = { +static const struct TrainerMon sParty_Timmy[] = { { - .iv = 0, .lvl = 15, .species = SPECIES_ARON, }, { - .iv = 0, .lvl = 13, .species = SPECIES_ELECTRIKE, } }; -static const struct TrainerMonItemCustomMoves sParty_Wallace[] = { +static const struct TrainerMon sParty_Wallace[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 57, .species = SPECIES_WAILORD, .heldItem = ITEM_NONE, .moves = {MOVE_RAIN_DANCE, MOVE_WATER_SPOUT, MOVE_DOUBLE_EDGE, MOVE_BLIZZARD} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 55, .species = SPECIES_TENTACRUEL, .heldItem = ITEM_NONE, .moves = {MOVE_TOXIC, MOVE_HYDRO_PUMP, MOVE_SLUDGE_BOMB, MOVE_ICE_BEAM} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 56, .species = SPECIES_LUDICOLO, .heldItem = ITEM_NONE, .moves = {MOVE_GIGA_DRAIN, MOVE_SURF, MOVE_LEECH_SEED, MOVE_DOUBLE_TEAM} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 56, .species = SPECIES_WHISCASH, .heldItem = ITEM_NONE, .moves = {MOVE_EARTHQUAKE, MOVE_SURF, MOVE_AMNESIA, MOVE_HYPER_BEAM} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 56, .species = SPECIES_GYARADOS, .heldItem = ITEM_NONE, .moves = {MOVE_DRAGON_DANCE, MOVE_EARTHQUAKE, MOVE_HYPER_BEAM, MOVE_SURF} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 58, .species = SPECIES_MILOTIC, .heldItem = ITEM_SITRUS_BERRY, @@ -4456,978 +4266,912 @@ static const struct TrainerMonItemCustomMoves sParty_Wallace[] = { } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Andrew[] = { +static const struct TrainerMon sParty_Andrew[] = { { - .iv = 0, .lvl = 5, .species = SPECIES_MAGIKARP, }, { - .iv = 0, .lvl = 10, .species = SPECIES_TENTACOOL, }, { - .iv = 0, .lvl = 15, .species = SPECIES_MAGIKARP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Ivan[] = { +static const struct TrainerMon sParty_Ivan[] = { { - .iv = 0, .lvl = 5, .species = SPECIES_MAGIKARP, }, { - .iv = 0, .lvl = 6, .species = SPECIES_MAGIKARP, }, { - .iv = 0, .lvl = 7, .species = SPECIES_MAGIKARP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Claude[] = { +static const struct TrainerMon sParty_Claude[] = { { - .iv = 0, .lvl = 16, .species = SPECIES_MAGIKARP, }, { - .iv = 0, .lvl = 17, .species = SPECIES_GOLDEEN, }, { - .iv = 0, .lvl = 18, .species = SPECIES_BARBOACH, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Elliot1[] = { +static const struct TrainerMon sParty_Elliot1[] = { { - .iv = 0, .lvl = 10, .species = SPECIES_MAGIKARP, }, { - .iv = 0, .lvl = 7, .species = SPECIES_TENTACOOL, }, { - .iv = 0, .lvl = 10, .species = SPECIES_MAGIKARP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Ned[] = { +static const struct TrainerMon sParty_Ned[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 11, .species = SPECIES_TENTACOOL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Dale[] = { +static const struct TrainerMon sParty_Dale[] = { { - .iv = 0, .lvl = 11, .species = SPECIES_TENTACOOL, }, { - .iv = 0, .lvl = 14, .species = SPECIES_WAILMER, }, { - .iv = 0, .lvl = 11, .species = SPECIES_TENTACOOL, }, { - .iv = 0, .lvl = 14, .species = SPECIES_WAILMER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Nolan[] = { +static const struct TrainerMon sParty_Nolan[] = { { - .iv = 0, .lvl = 19, .species = SPECIES_BARBOACH, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Barny[] = { +static const struct TrainerMon sParty_Barny[] = { { - .iv = 0, .lvl = 25, .species = SPECIES_TENTACOOL, }, { - .iv = 0, .lvl = 25, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Wade[] = { +static const struct TrainerMon sParty_Wade[] = { { - .iv = 0, .lvl = 16, .species = SPECIES_TENTACOOL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Carter[] = { +static const struct TrainerMon sParty_Carter[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 25, .species = SPECIES_WAILMER, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 25, .species = SPECIES_TENTACRUEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Elliot2[] = { +static const struct TrainerMon sParty_Elliot2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 24, .species = SPECIES_TENTACOOL, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 27, .species = SPECIES_GYARADOS, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 27, .species = SPECIES_GYARADOS, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Elliot3[] = { +static const struct TrainerMon sParty_Elliot3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 29, .species = SPECIES_GYARADOS, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 26, .species = SPECIES_CARVANHA, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 26, .species = SPECIES_TENTACOOL, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 29, .species = SPECIES_GYARADOS, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Elliot4[] = { +static const struct TrainerMon sParty_Elliot4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 31, .species = SPECIES_GYARADOS, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 30, .species = SPECIES_CARVANHA, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 30, .species = SPECIES_TENTACRUEL, }, { - .iv = 31, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 31, .species = SPECIES_GYARADOS, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Elliot5[] = { +static const struct TrainerMon sParty_Elliot5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 33, .species = SPECIES_GYARADOS, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 33, .species = SPECIES_SHARPEDO, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 33, .species = SPECIES_GYARADOS, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 35, .species = SPECIES_TENTACRUEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Ronald[] = { +static const struct TrainerMon sParty_Ronald[] = { { - .iv = 0, .lvl = 19, .species = SPECIES_MAGIKARP, }, { - .iv = 0, .lvl = 21, .species = SPECIES_GYARADOS, }, { - .iv = 0, .lvl = 23, .species = SPECIES_GYARADOS, }, { - .iv = 0, .lvl = 26, .species = SPECIES_GYARADOS, }, { - .iv = 0, .lvl = 30, .species = SPECIES_GYARADOS, }, { - .iv = 0, .lvl = 35, .species = SPECIES_GYARADOS, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jacob[] = { +static const struct TrainerMon sParty_Jacob[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 6, .species = SPECIES_VOLTORB, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 6, .species = SPECIES_VOLTORB, }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 14, .species = SPECIES_MAGNEMITE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Anthony[] = { +static const struct TrainerMon sParty_Anthony[] = { { - .iv = 0, .lvl = 14, .species = SPECIES_MAGNEMITE, }, { - .iv = 0, .lvl = 14, .species = SPECIES_MAGNEMITE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Benjamin1[] = { +static const struct TrainerMon sParty_Benjamin1[] = { { - .iv = 0, .lvl = 16, .species = SPECIES_MAGNEMITE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Benjamin2[] = { +static const struct TrainerMon sParty_Benjamin2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 30, .species = SPECIES_MAGNEMITE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Benjamin3[] = { +static const struct TrainerMon sParty_Benjamin3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 33, .species = SPECIES_MAGNEMITE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Benjamin4[] = { +static const struct TrainerMon sParty_Benjamin4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 36, .species = SPECIES_MAGNETON, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Benjamin5[] = { +static const struct TrainerMon sParty_Benjamin5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 39, .species = SPECIES_MAGNETON, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Abigail1[] = { +static const struct TrainerMon sParty_Abigail1[] = { { - .iv = 0, .lvl = 16, .species = SPECIES_MAGNEMITE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jasmine[] = { +static const struct TrainerMon sParty_Jasmine[] = { { - .iv = 80, + .iv = TRAINER_PARTY_IVS(9, 9, 9, 9, 9, 9), .lvl = 14, .species = SPECIES_MAGNEMITE, }, { - .iv = 80, + .iv = TRAINER_PARTY_IVS(9, 9, 9, 9, 9, 9), .lvl = 14, .species = SPECIES_MAGNEMITE, }, { - .iv = 0, .lvl = 6, .species = SPECIES_VOLTORB, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Abigail2[] = { +static const struct TrainerMon sParty_Abigail2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 28, .species = SPECIES_MAGNEMITE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Abigail3[] = { +static const struct TrainerMon sParty_Abigail3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 31, .species = SPECIES_MAGNEMITE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Abigail4[] = { +static const struct TrainerMon sParty_Abigail4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 34, .species = SPECIES_MAGNETON, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Abigail5[] = { +static const struct TrainerMon sParty_Abigail5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 37, .species = SPECIES_MAGNETON, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Dylan1[] = { +static const struct TrainerMon sParty_Dylan1[] = { { - .iv = 0, .lvl = 17, .species = SPECIES_DODUO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Dylan2[] = { +static const struct TrainerMon sParty_Dylan2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 28, .species = SPECIES_DODUO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Dylan3[] = { +static const struct TrainerMon sParty_Dylan3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 31, .species = SPECIES_DODUO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Dylan4[] = { +static const struct TrainerMon sParty_Dylan4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 34, .species = SPECIES_DODRIO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Dylan5[] = { +static const struct TrainerMon sParty_Dylan5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 37, .species = SPECIES_DODRIO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Maria1[] = { +static const struct TrainerMon sParty_Maria1[] = { { - .iv = 0, .lvl = 17, .species = SPECIES_DODUO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Maria2[] = { +static const struct TrainerMon sParty_Maria2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 28, .species = SPECIES_DODUO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Maria3[] = { +static const struct TrainerMon sParty_Maria3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 31, .species = SPECIES_DODUO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Maria4[] = { +static const struct TrainerMon sParty_Maria4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 34, .species = SPECIES_DODRIO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Maria5[] = { +static const struct TrainerMon sParty_Maria5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 37, .species = SPECIES_DODRIO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Camden[] = { +static const struct TrainerMon sParty_Camden[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_STARYU, }, { - .iv = 0, .lvl = 33, .species = SPECIES_STARYU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Demetrius[] = { +static const struct TrainerMon sParty_Demetrius[] = { { - .iv = 0, .lvl = 25, .species = SPECIES_ZIGZAGOON, }, { - .iv = 0, .lvl = 25, .species = SPECIES_ELECTRIKE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Isaiah1[] = { +static const struct TrainerMon sParty_Isaiah1[] = { { - .iv = 0, .lvl = 35, .species = SPECIES_STARYU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Pablo1[] = { +static const struct TrainerMon sParty_Pablo1[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_STARYU, }, { - .iv = 0, .lvl = 33, .species = SPECIES_STARYU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Chase[] = { +static const struct TrainerMon sParty_Chase[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_WINGULL, }, { - .iv = 80, + .iv = TRAINER_PARTY_IVS(9, 9, 9, 9, 9, 9), .lvl = 34, .species = SPECIES_STARYU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Isaiah2[] = { +static const struct TrainerMon sParty_Isaiah2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 39, .species = SPECIES_STARYU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Isaiah3[] = { +static const struct TrainerMon sParty_Isaiah3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 42, .species = SPECIES_STARYU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Isaiah4[] = { +static const struct TrainerMon sParty_Isaiah4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 45, .species = SPECIES_STARMIE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Isaiah5[] = { +static const struct TrainerMon sParty_Isaiah5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 48, .species = SPECIES_STARMIE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Isobel[] = { +static const struct TrainerMon sParty_Isobel[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_STARYU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Donny[] = { +static const struct TrainerMon sParty_Donny[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_WINGULL, }, { - .iv = 160, + .iv = TRAINER_PARTY_IVS(19, 19, 19, 19, 19, 19), .lvl = 34, .species = SPECIES_STARYU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Talia[] = { +static const struct TrainerMon sParty_Talia[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_STARYU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Katelyn1[] = { +static const struct TrainerMon sParty_Katelyn1[] = { { - .iv = 0, .lvl = 35, .species = SPECIES_STARYU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Allison[] = { +static const struct TrainerMon sParty_Allison[] = { { - .iv = 0, .lvl = 27, .species = SPECIES_WINGULL, }, { - .iv = 240, + .iv = TRAINER_PARTY_IVS(29, 29, 29, 29, 29, 29), .lvl = 33, .species = SPECIES_STARYU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Katelyn2[] = { +static const struct TrainerMon sParty_Katelyn2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 39, .species = SPECIES_STARYU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Katelyn3[] = { +static const struct TrainerMon sParty_Katelyn3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 42, .species = SPECIES_STARYU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Katelyn4[] = { +static const struct TrainerMon sParty_Katelyn4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 45, .species = SPECIES_STARMIE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Katelyn5[] = { +static const struct TrainerMon sParty_Katelyn5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 48, .species = SPECIES_STARMIE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Nicolas1[] = { +static const struct TrainerMon sParty_Nicolas1[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 37, .species = SPECIES_ALTARIA, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 37, .species = SPECIES_ALTARIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Nicolas2[] = { +static const struct TrainerMon sParty_Nicolas2[] = { { - .iv = 110, + .iv = TRAINER_PARTY_IVS(13, 13, 13, 13, 13, 13), .lvl = 41, .species = SPECIES_ALTARIA, }, { - .iv = 110, + .iv = TRAINER_PARTY_IVS(13, 13, 13, 13, 13, 13), .lvl = 41, .species = SPECIES_ALTARIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Nicolas3[] = { +static const struct TrainerMon sParty_Nicolas3[] = { { - .iv = 120, + .iv = TRAINER_PARTY_IVS(14, 14, 14, 14, 14, 14), .lvl = 44, .species = SPECIES_ALTARIA, }, { - .iv = 120, + .iv = TRAINER_PARTY_IVS(14, 14, 14, 14, 14, 14), .lvl = 44, .species = SPECIES_ALTARIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Nicolas4[] = { +static const struct TrainerMon sParty_Nicolas4[] = { { - .iv = 130, + .iv = TRAINER_PARTY_IVS(15, 15, 15, 15, 15, 15), .lvl = 46, .species = SPECIES_BAGON, }, { - .iv = 130, + .iv = TRAINER_PARTY_IVS(15, 15, 15, 15, 15, 15), .lvl = 46, .species = SPECIES_ALTARIA, }, { - .iv = 130, + .iv = TRAINER_PARTY_IVS(15, 15, 15, 15, 15, 15), .lvl = 46, .species = SPECIES_ALTARIA, } }; -static const struct TrainerMonItemDefaultMoves sParty_Nicolas5[] = { +static const struct TrainerMon sParty_Nicolas5[] = { { - .iv = 140, + .iv = TRAINER_PARTY_IVS(17, 17, 17, 17, 17, 17), .lvl = 49, .species = SPECIES_ALTARIA, .heldItem = ITEM_NONE }, { - .iv = 140, + .iv = TRAINER_PARTY_IVS(17, 17, 17, 17, 17, 17), .lvl = 49, .species = SPECIES_ALTARIA, .heldItem = ITEM_NONE }, { - .iv = 140, + .iv = TRAINER_PARTY_IVS(17, 17, 17, 17, 17, 17), .lvl = 49, .species = SPECIES_SHELGON, .heldItem = ITEM_DRAGON_FANG } }; -static const struct TrainerMonNoItemCustomMoves sParty_Aaron[] = { +static const struct TrainerMon sParty_Aaron[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 34, .species = SPECIES_BAGON, .moves = {MOVE_DRAGON_BREATH, MOVE_HEADBUTT, MOVE_FOCUS_ENERGY, MOVE_EMBER} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Perry[] = { +static const struct TrainerMon sParty_Perry[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_WINGULL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Hugh[] = { +static const struct TrainerMon sParty_Hugh[] = { { - .iv = 0, .lvl = 25, .species = SPECIES_WINGULL, }, { - .iv = 0, .lvl = 25, .species = SPECIES_TROPIUS, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Phil[] = { +static const struct TrainerMon sParty_Phil[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_SWELLOW, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jared[] = { +static const struct TrainerMon sParty_Jared[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 27, .species = SPECIES_DODUO, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 27, .species = SPECIES_SKARMORY, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 27, .species = SPECIES_TROPIUS, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Humberto[] = { +static const struct TrainerMon sParty_Humberto[] = { { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 30, .species = SPECIES_SKARMORY, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Presley[] = { +static const struct TrainerMon sParty_Presley[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_TROPIUS, }, { - .iv = 0, .lvl = 33, .species = SPECIES_XATU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Edwardo[] = { +static const struct TrainerMon sParty_Edwardo[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 29, .species = SPECIES_DODUO, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 29, .species = SPECIES_PELIPPER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Colin[] = { +static const struct TrainerMon sParty_Colin[] = { { - .iv = 0, .lvl = 28, .species = SPECIES_WINGULL, }, { - .iv = 0, .lvl = 28, .species = SPECIES_NATU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Robert1[] = { +static const struct TrainerMon sParty_Robert1[] = { { - .iv = 0, .lvl = 29, .species = SPECIES_SWABLU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Benny[] = { +static const struct TrainerMon sParty_Benny[] = { { - .iv = 0, .lvl = 36, .species = SPECIES_SWELLOW, }, { - .iv = 0, .lvl = 36, .species = SPECIES_PELIPPER, }, { - .iv = 0, .lvl = 36, .species = SPECIES_XATU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Chester[] = { +static const struct TrainerMon sParty_Chester[] = { { - .iv = 0, .lvl = 25, .species = SPECIES_TAILLOW, }, { - .iv = 0, .lvl = 25, .species = SPECIES_SWELLOW, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Robert2[] = { +static const struct TrainerMon sParty_Robert2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 32, .species = SPECIES_NATU, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 32, .species = SPECIES_SWABLU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Robert3[] = { +static const struct TrainerMon sParty_Robert3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 35, .species = SPECIES_NATU, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 35, .species = SPECIES_ALTARIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Robert4[] = { +static const struct TrainerMon sParty_Robert4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 38, .species = SPECIES_NATU, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 38, .species = SPECIES_ALTARIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Robert5[] = { +static const struct TrainerMon sParty_Robert5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 41, .species = SPECIES_ALTARIA, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 41, .species = SPECIES_XATU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Alex[] = { +static const struct TrainerMon sParty_Alex[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 33, .species = SPECIES_NATU, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 33, .species = SPECIES_SWELLOW, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Beck[] = { +static const struct TrainerMon sParty_Beck[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_TROPIUS, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Yasu[] = { +static const struct TrainerMon sParty_Yasu[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_NINJASK, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Takashi[] = { +static const struct TrainerMon sParty_Takashi[] = { { - .iv = 0, .lvl = 25, .species = SPECIES_NINJASK, }, { - .iv = 0, .lvl = 25, .species = SPECIES_KOFFING, } }; -static const struct TrainerMonItemCustomMoves sParty_Dianne[] = { +static const struct TrainerMon sParty_Dianne[] = { { - .iv = 0, .lvl = 43, .species = SPECIES_CLAYDOL, .heldItem = ITEM_NONE, .moves = {MOVE_SKILL_SWAP, MOVE_EARTHQUAKE, MOVE_NONE, MOVE_NONE} }, { - .iv = 0, .lvl = 43, .species = SPECIES_LANTURN, .heldItem = ITEM_NONE, @@ -5435,153 +5179,143 @@ static const struct TrainerMonItemCustomMoves sParty_Dianne[] = { } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jani[] = { +static const struct TrainerMon sParty_Jani[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_MARILL, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Lao1[] = { +static const struct TrainerMon sParty_Lao1[] = { { - .iv = 0, .lvl = 17, .species = SPECIES_KOFFING, .moves = {MOVE_POISON_GAS, MOVE_TACKLE, MOVE_SMOG, MOVE_SELF_DESTRUCT} }, { - .iv = 0, .lvl = 17, .species = SPECIES_KOFFING, .moves = {MOVE_POISON_GAS, MOVE_TACKLE, MOVE_SMOG, MOVE_SELF_DESTRUCT} }, { - .iv = 0, .lvl = 17, .species = SPECIES_KOFFING, .moves = {MOVE_POISON_GAS, MOVE_TACKLE, MOVE_SLUDGE, MOVE_SELF_DESTRUCT} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Lung[] = { +static const struct TrainerMon sParty_Lung[] = { { - .iv = 0, .lvl = 18, .species = SPECIES_KOFFING, }, { - .iv = 0, .lvl = 18, .species = SPECIES_NINJASK, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Lao2[] = { +static const struct TrainerMon sParty_Lao2[] = { { - .iv = 0, .lvl = 24, .species = SPECIES_KOFFING, .moves = {MOVE_POISON_GAS, MOVE_TACKLE, MOVE_SLUDGE, MOVE_SELF_DESTRUCT} }, { - .iv = 0, .lvl = 24, .species = SPECIES_KOFFING, .moves = {MOVE_POISON_GAS, MOVE_TACKLE, MOVE_SLUDGE, MOVE_NONE} }, { - .iv = 0, .lvl = 24, .species = SPECIES_KOFFING, .moves = {MOVE_POISON_GAS, MOVE_TACKLE, MOVE_SLUDGE, MOVE_SELF_DESTRUCT} }, { - .iv = 0, .lvl = 26, .species = SPECIES_KOFFING, .moves = {MOVE_TACKLE, MOVE_SLUDGE, MOVE_NONE, MOVE_NONE} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Lao3[] = { +static const struct TrainerMon sParty_Lao3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 27, .species = SPECIES_KOFFING, .moves = {MOVE_POISON_GAS, MOVE_TACKLE, MOVE_SLUDGE, MOVE_SELF_DESTRUCT} }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 27, .species = SPECIES_KOFFING, .moves = {MOVE_POISON_GAS, MOVE_TACKLE, MOVE_SLUDGE, MOVE_SELF_DESTRUCT} }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 27, .species = SPECIES_KOFFING, .moves = {MOVE_POISON_GAS, MOVE_TACKLE, MOVE_SLUDGE, MOVE_NONE} }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 29, .species = SPECIES_KOFFING, .moves = {MOVE_TACKLE, MOVE_SLUDGE, MOVE_NONE, MOVE_NONE} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Lao4[] = { +static const struct TrainerMon sParty_Lao4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 30, .species = SPECIES_KOFFING, .moves = {MOVE_POISON_GAS, MOVE_TACKLE, MOVE_SLUDGE, MOVE_NONE} }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 30, .species = SPECIES_KOFFING, .moves = {MOVE_POISON_GAS, MOVE_TACKLE, MOVE_SLUDGE, MOVE_NONE} }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 30, .species = SPECIES_KOFFING, .moves = {MOVE_POISON_GAS, MOVE_TACKLE, MOVE_SLUDGE, MOVE_NONE} }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 32, .species = SPECIES_KOFFING, .moves = {MOVE_TACKLE, MOVE_SLUDGE, MOVE_NONE, MOVE_NONE} } }; -static const struct TrainerMonItemCustomMoves sParty_Lao5[] = { +static const struct TrainerMon sParty_Lao5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 33, .species = SPECIES_KOFFING, .heldItem = ITEM_NONE, .moves = {MOVE_POISON_GAS, MOVE_TACKLE, MOVE_SLUDGE, MOVE_NONE} }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 33, .species = SPECIES_KOFFING, .heldItem = ITEM_NONE, .moves = {MOVE_POISON_GAS, MOVE_TACKLE, MOVE_SLUDGE, MOVE_SELF_DESTRUCT} }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 33, .species = SPECIES_KOFFING, .heldItem = ITEM_NONE, .moves = {MOVE_POISON_GAS, MOVE_TACKLE, MOVE_SLUDGE, MOVE_SELF_DESTRUCT} }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 35, .species = SPECIES_WEEZING, .heldItem = ITEM_SMOKE_BALL, @@ -5589,966 +5323,882 @@ static const struct TrainerMonItemCustomMoves sParty_Lao5[] = { } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jocelyn[] = { +static const struct TrainerMon sParty_Jocelyn[] = { { - .iv = 127, + .iv = TRAINER_PARTY_IVS(15, 15, 15, 15, 15, 15), .lvl = 13, .species = SPECIES_MEDITITE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Laura[] = { +static const struct TrainerMon sParty_Laura[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 13, .species = SPECIES_MEDITITE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cyndy1[] = { +static const struct TrainerMon sParty_Cyndy1[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 18, .species = SPECIES_MEDITITE, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 18, .species = SPECIES_MAKUHITA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cora[] = { +static const struct TrainerMon sParty_Cora[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 27, .species = SPECIES_MEDITITE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Paula[] = { +static const struct TrainerMon sParty_Paula[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 27, .species = SPECIES_BRELOOM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cyndy2[] = { +static const struct TrainerMon sParty_Cyndy2[] = { { - .iv = 110, + .iv = TRAINER_PARTY_IVS(13, 13, 13, 13, 13, 13), .lvl = 26, .species = SPECIES_MEDITITE, }, { - .iv = 110, + .iv = TRAINER_PARTY_IVS(13, 13, 13, 13, 13, 13), .lvl = 26, .species = SPECIES_MAKUHITA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cyndy3[] = { +static const struct TrainerMon sParty_Cyndy3[] = { { - .iv = 120, + .iv = TRAINER_PARTY_IVS(14, 14, 14, 14, 14, 14), .lvl = 29, .species = SPECIES_MEDITITE, }, { - .iv = 120, + .iv = TRAINER_PARTY_IVS(14, 14, 14, 14, 14, 14), .lvl = 29, .species = SPECIES_MAKUHITA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cyndy4[] = { +static const struct TrainerMon sParty_Cyndy4[] = { { - .iv = 130, + .iv = TRAINER_PARTY_IVS(15, 15, 15, 15, 15, 15), .lvl = 32, .species = SPECIES_MEDICHAM, }, { - .iv = 130, + .iv = TRAINER_PARTY_IVS(15, 15, 15, 15, 15, 15), .lvl = 32, .species = SPECIES_HARIYAMA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cyndy5[] = { +static const struct TrainerMon sParty_Cyndy5[] = { { - .iv = 140, + .iv = TRAINER_PARTY_IVS(17, 17, 17, 17, 17, 17), .lvl = 35, .species = SPECIES_MEDICHAM, }, { - .iv = 140, + .iv = TRAINER_PARTY_IVS(17, 17, 17, 17, 17, 17), .lvl = 35, .species = SPECIES_HARIYAMA, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Madeline1[] = { +static const struct TrainerMon sParty_Madeline1[] = { { - .iv = 0, .lvl = 19, .species = SPECIES_NUMEL, .moves = {MOVE_EMBER, MOVE_TACKLE, MOVE_MAGNITUDE, MOVE_SUNNY_DAY} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Clarissa[] = { +static const struct TrainerMon sParty_Clarissa[] = { { - .iv = 0, .lvl = 28, .species = SPECIES_ROSELIA, }, { - .iv = 0, .lvl = 28, .species = SPECIES_WAILMER, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Angelica[] = { +static const struct TrainerMon sParty_Angelica[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 30, .species = SPECIES_CASTFORM, .moves = {MOVE_RAIN_DANCE, MOVE_WEATHER_BALL, MOVE_THUNDER, MOVE_WATER_PULSE} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Madeline2[] = { +static const struct TrainerMon sParty_Madeline2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 29, .species = SPECIES_NUMEL, .moves = {MOVE_EMBER, MOVE_TACKLE, MOVE_MAGNITUDE, MOVE_SUNNY_DAY} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Madeline3[] = { +static const struct TrainerMon sParty_Madeline3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 32, .species = SPECIES_NUMEL, .moves = {MOVE_EMBER, MOVE_TAKE_DOWN, MOVE_MAGNITUDE, MOVE_SUNNY_DAY} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Madeline4[] = { +static const struct TrainerMon sParty_Madeline4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 34, .species = SPECIES_ROSELIA, .moves = {MOVE_LEECH_SEED, MOVE_MEGA_DRAIN, MOVE_GRASS_WHISTLE, MOVE_SUNNY_DAY} }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 34, .species = SPECIES_NUMEL, .moves = {MOVE_FLAMETHROWER, MOVE_TAKE_DOWN, MOVE_MAGNITUDE, MOVE_SUNNY_DAY} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Madeline5[] = { +static const struct TrainerMon sParty_Madeline5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 37, .species = SPECIES_ROSELIA, .moves = {MOVE_LEECH_SEED, MOVE_GIGA_DRAIN, MOVE_SOLAR_BEAM, MOVE_SUNNY_DAY} }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 37, .species = SPECIES_CAMERUPT, .moves = {MOVE_FLAMETHROWER, MOVE_TAKE_DOWN, MOVE_EARTHQUAKE, MOVE_SUNNY_DAY} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Beverly[] = { +static const struct TrainerMon sParty_Beverly[] = { { - .iv = 0, .lvl = 25, .species = SPECIES_WINGULL, }, { - .iv = 0, .lvl = 25, .species = SPECIES_WAILMER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Imani[] = { +static const struct TrainerMon sParty_Imani[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_MARILL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Kyla[] = { +static const struct TrainerMon sParty_Kyla[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_WAILMER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Denise[] = { +static const struct TrainerMon sParty_Denise[] = { { - .iv = 0, .lvl = 25, .species = SPECIES_WINGULL, }, { - .iv = 0, .lvl = 25, .species = SPECIES_GOLDEEN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Beth[] = { +static const struct TrainerMon sParty_Beth[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_GOLDEEN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Tara[] = { +static const struct TrainerMon sParty_Tara[] = { { - .iv = 0, .lvl = 25, .species = SPECIES_HORSEA, }, { - .iv = 0, .lvl = 25, .species = SPECIES_MARILL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Missy[] = { +static const struct TrainerMon sParty_Missy[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_GOLDEEN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Alice[] = { +static const struct TrainerMon sParty_Alice[] = { { - .iv = 0, .lvl = 24, .species = SPECIES_GOLDEEN, }, { - .iv = 0, .lvl = 24, .species = SPECIES_WINGULL, }, { - .iv = 0, .lvl = 24, .species = SPECIES_GOLDEEN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jenny1[] = { +static const struct TrainerMon sParty_Jenny1[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_WAILMER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Grace[] = { +static const struct TrainerMon sParty_Grace[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_MARILL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Tanya[] = { +static const struct TrainerMon sParty_Tanya[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_LUVDISC, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Sharon[] = { +static const struct TrainerMon sParty_Sharon[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_SEAKING, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Nikki[] = { +static const struct TrainerMon sParty_Nikki[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_MARILL, }, { - .iv = 0, .lvl = 33, .species = SPECIES_SPHEAL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Brenda[] = { +static const struct TrainerMon sParty_Brenda[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_GOLDEEN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Katie[] = { +static const struct TrainerMon sParty_Katie[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_GOLDEEN, }, { - .iv = 0, .lvl = 33, .species = SPECIES_SPHEAL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Susie[] = { +static const struct TrainerMon sParty_Susie[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_LUVDISC, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Kara[] = { +static const struct TrainerMon sParty_Kara[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_SEAKING, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Dana[] = { +static const struct TrainerMon sParty_Dana[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_AZUMARILL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Sienna[] = { +static const struct TrainerMon sParty_Sienna[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_LUVDISC, }, { - .iv = 0, .lvl = 33, .species = SPECIES_LUVDISC, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Debra[] = { +static const struct TrainerMon sParty_Debra[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_SEAKING, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Linda[] = { +static const struct TrainerMon sParty_Linda[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_HORSEA, }, { - .iv = 0, .lvl = 33, .species = SPECIES_SEADRA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Kaylee[] = { +static const struct TrainerMon sParty_Kaylee[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_LANTURN, }, { - .iv = 0, .lvl = 34, .species = SPECIES_PELIPPER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Laurel[] = { +static const struct TrainerMon sParty_Laurel[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_LUVDISC, }, { - .iv = 0, .lvl = 33, .species = SPECIES_LUVDISC, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Carlee[] = { +static const struct TrainerMon sParty_Carlee[] = { { - .iv = 0, .lvl = 35, .species = SPECIES_SEAKING, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jenny2[] = { +static const struct TrainerMon sParty_Jenny2[] = { { - .iv = 0, .lvl = 38, .species = SPECIES_WAILMER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jenny3[] = { +static const struct TrainerMon sParty_Jenny3[] = { { - .iv = 0, .lvl = 41, .species = SPECIES_WAILMER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jenny4[] = { +static const struct TrainerMon sParty_Jenny4[] = { { - .iv = 0, .lvl = 43, .species = SPECIES_STARYU, }, { - .iv = 0, .lvl = 43, .species = SPECIES_WAILMER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jenny5[] = { +static const struct TrainerMon sParty_Jenny5[] = { { - .iv = 0, .lvl = 45, .species = SPECIES_LUVDISC, }, { - .iv = 0, .lvl = 45, .species = SPECIES_WAILMER, }, { - .iv = 0, .lvl = 45, .species = SPECIES_STARMIE, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Heidi[] = { +static const struct TrainerMon sParty_Heidi[] = { { - .iv = 0, .lvl = 22, .species = SPECIES_SANDSHREW, .moves = {MOVE_DIG, MOVE_SAND_ATTACK, MOVE_POISON_STING, MOVE_SLASH} }, { - .iv = 0, .lvl = 22, .species = SPECIES_BALTOY, .moves = {MOVE_RAPID_SPIN, MOVE_MUD_SLAP, MOVE_PSYBEAM, MOVE_ROCK_TOMB} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Becky[] = { +static const struct TrainerMon sParty_Becky[] = { { - .iv = 0, .lvl = 22, .species = SPECIES_SANDSHREW, .moves = {MOVE_SAND_ATTACK, MOVE_POISON_STING, MOVE_SLASH, MOVE_DIG} }, { - .iv = 0, .lvl = 22, .species = SPECIES_MARILL, .moves = {MOVE_ROLLOUT, MOVE_BUBBLE_BEAM, MOVE_TAIL_WHIP, MOVE_DEFENSE_CURL} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Carol[] = { +static const struct TrainerMon sParty_Carol[] = { { - .iv = 0, .lvl = 17, .species = SPECIES_TAILLOW, }, { - .iv = 0, .lvl = 17, .species = SPECIES_LOMBRE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Nancy[] = { +static const struct TrainerMon sParty_Nancy[] = { { - .iv = 0, .lvl = 18, .species = SPECIES_MARILL, }, { - .iv = 0, .lvl = 18, .species = SPECIES_LOMBRE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Martha[] = { +static const struct TrainerMon sParty_Martha[] = { { - .iv = 0, .lvl = 23, .species = SPECIES_SKITTY, }, { - .iv = 0, .lvl = 23, .species = SPECIES_SWABLU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Diana1[] = { +static const struct TrainerMon sParty_Diana1[] = { { - .iv = 0, .lvl = 19, .species = SPECIES_SHROOMISH, }, { - .iv = 0, .lvl = 19, .species = SPECIES_ODDISH, }, { - .iv = 0, .lvl = 19, .species = SPECIES_SWABLU, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Cedric[] = { +static const struct TrainerMon sParty_Cedric[] = { { - .iv = 0, .lvl = 32, .species = SPECIES_WOBBUFFET, .moves = {MOVE_DESTINY_BOND, MOVE_SAFEGUARD, MOVE_COUNTER, MOVE_MIRROR_COAT} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Irene[] = { +static const struct TrainerMon sParty_Irene[] = { { - .iv = 0, .lvl = 17, .species = SPECIES_SHROOMISH, }, { - .iv = 0, .lvl = 17, .species = SPECIES_MARILL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Diana2[] = { +static const struct TrainerMon sParty_Diana2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 25, .species = SPECIES_SHROOMISH, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 25, .species = SPECIES_GLOOM, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 25, .species = SPECIES_SWABLU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Diana3[] = { +static const struct TrainerMon sParty_Diana3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 28, .species = SPECIES_BRELOOM, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 28, .species = SPECIES_GLOOM, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 28, .species = SPECIES_SWABLU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Diana4[] = { +static const struct TrainerMon sParty_Diana4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 31, .species = SPECIES_BRELOOM, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 31, .species = SPECIES_GLOOM, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 31, .species = SPECIES_SWABLU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Diana5[] = { +static const struct TrainerMon sParty_Diana5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 40, .species = SPECIES_BRELOOM, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 40, .species = SPECIES_VILEPLUME, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 40, .species = SPECIES_ALTARIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_AmyAndLiv1[] = { +static const struct TrainerMon sParty_AmyAndLiv1[] = { { - .iv = 0, .lvl = 15, .species = SPECIES_PLUSLE, }, { - .iv = 0, .lvl = 15, .species = SPECIES_MINUN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_AmyAndLiv2[] = { +static const struct TrainerMon sParty_AmyAndLiv2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 27, .species = SPECIES_PLUSLE, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 27, .species = SPECIES_MINUN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GinaAndMia1[] = { +static const struct TrainerMon sParty_GinaAndMia1[] = { { - .iv = 0, .lvl = 6, .species = SPECIES_SEEDOT, }, { - .iv = 0, .lvl = 6, .species = SPECIES_LOTAD, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_MiuAndYuki[] = { +static const struct TrainerMon sParty_MiuAndYuki[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_BEAUTIFLY, }, { - .iv = 0, .lvl = 26, .species = SPECIES_DUSTOX, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_AmyAndLiv3[] = { +static const struct TrainerMon sParty_AmyAndLiv3[] = { { - .iv = 0, .lvl = 9, .species = SPECIES_PLUSLE, }, { - .iv = 0, .lvl = 9, .species = SPECIES_MINUN, } }; -static const struct TrainerMonNoItemCustomMoves sParty_GinaAndMia2[] = { +static const struct TrainerMon sParty_GinaAndMia2[] = { { - .iv = 0, .lvl = 10, .species = SPECIES_DUSKULL, .moves = {MOVE_NIGHT_SHADE, MOVE_DISABLE, MOVE_NONE, MOVE_NONE} }, { - .iv = 0, .lvl = 10, .species = SPECIES_SHROOMISH, .moves = {MOVE_ABSORB, MOVE_LEECH_SEED, MOVE_NONE, MOVE_NONE} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_AmyAndLiv4[] = { +static const struct TrainerMon sParty_AmyAndLiv4[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 30, .species = SPECIES_PLUSLE, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 30, .species = SPECIES_MINUN, } }; -static const struct TrainerMonNoItemCustomMoves sParty_AmyAndLiv5[] = { +static const struct TrainerMon sParty_AmyAndLiv5[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 33, .species = SPECIES_PLUSLE, .moves = {MOVE_SPARK, MOVE_CHARGE, MOVE_FAKE_TEARS, MOVE_HELPING_HAND} }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 33, .species = SPECIES_MINUN, .moves = {MOVE_SPARK, MOVE_CHARGE, MOVE_CHARM, MOVE_HELPING_HAND} } }; -static const struct TrainerMonNoItemCustomMoves sParty_AmyAndLiv6[] = { +static const struct TrainerMon sParty_AmyAndLiv6[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 36, .species = SPECIES_PLUSLE, .moves = {MOVE_THUNDER, MOVE_CHARGE, MOVE_FAKE_TEARS, MOVE_HELPING_HAND} }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 36, .species = SPECIES_MINUN, .moves = {MOVE_THUNDER, MOVE_CHARGE, MOVE_CHARM, MOVE_HELPING_HAND} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Huey[] = { +static const struct TrainerMon sParty_Huey[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 12, .species = SPECIES_WINGULL, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 12, .species = SPECIES_MACHOP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Edmond[] = { +static const struct TrainerMon sParty_Edmond[] = { { - .iv = 0, .lvl = 13, .species = SPECIES_WINGULL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Ernest1[] = { +static const struct TrainerMon sParty_Ernest1[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_WINGULL, }, { - .iv = 0, .lvl = 33, .species = SPECIES_MACHOKE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Dwayne[] = { +static const struct TrainerMon sParty_Dwayne[] = { { - .iv = 0, .lvl = 11, .species = SPECIES_WINGULL, }, { - .iv = 0, .lvl = 11, .species = SPECIES_MACHOP, }, { - .iv = 0, .lvl = 11, .species = SPECIES_TENTACOOL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Phillip[] = { +static const struct TrainerMon sParty_Phillip[] = { { - .iv = 0, .lvl = 44, .species = SPECIES_TENTACRUEL, }, { - .iv = 0, .lvl = 44, .species = SPECIES_MACHOKE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Leonard[] = { +static const struct TrainerMon sParty_Leonard[] = { { - .iv = 0, .lvl = 43, .species = SPECIES_MACHOP, }, { - .iv = 0, .lvl = 43, .species = SPECIES_PELIPPER, }, { - .iv = 0, .lvl = 43, .species = SPECIES_MACHOKE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Duncan[] = { +static const struct TrainerMon sParty_Duncan[] = { { - .iv = 0, .lvl = 25, .species = SPECIES_SPHEAL, }, { - .iv = 0, .lvl = 25, .species = SPECIES_MACHOKE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Ernest2[] = { +static const struct TrainerMon sParty_Ernest2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 36, .species = SPECIES_WINGULL, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 36, .species = SPECIES_TENTACOOL, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 36, .species = SPECIES_MACHOKE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Ernest3[] = { +static const struct TrainerMon sParty_Ernest3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 39, .species = SPECIES_PELIPPER, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 39, .species = SPECIES_TENTACOOL, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 39, .species = SPECIES_MACHOKE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Ernest4[] = { +static const struct TrainerMon sParty_Ernest4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 42, .species = SPECIES_PELIPPER, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 42, .species = SPECIES_TENTACOOL, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 42, .species = SPECIES_MACHOKE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Ernest5[] = { +static const struct TrainerMon sParty_Ernest5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 45, .species = SPECIES_PELIPPER, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 45, .species = SPECIES_MACHOKE, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 45, .species = SPECIES_TENTACRUEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Eli[] = { +static const struct TrainerMon sParty_Eli[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 23, .species = SPECIES_NUMEL, } }; -static const struct TrainerMonItemCustomMoves sParty_Annika[] = { +static const struct TrainerMon sParty_Annika[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 39, .species = SPECIES_FEEBAS, .heldItem = ITEM_ORAN_BERRY, .moves = {MOVE_FLAIL, MOVE_WATER_PULSE, MOVE_RETURN, MOVE_ATTRACT} }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 39, .species = SPECIES_FEEBAS, .heldItem = ITEM_ORAN_BERRY, @@ -6556,61 +6206,56 @@ static const struct TrainerMonItemCustomMoves sParty_Annika[] = { } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jazmyn[] = { +static const struct TrainerMon sParty_Jazmyn[] = { { - .iv = 0, .lvl = 27, .species = SPECIES_ABSOL, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Jonas[] = { +static const struct TrainerMon sParty_Jonas[] = { { - .iv = 0, .lvl = 31, .species = SPECIES_KOFFING, .moves = {MOVE_TOXIC, MOVE_THUNDER, MOVE_SELF_DESTRUCT, MOVE_SLUDGE_BOMB} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Kayley[] = { +static const struct TrainerMon sParty_Kayley[] = { { - .iv = 0, .lvl = 31, .species = SPECIES_CASTFORM, .moves = {MOVE_SUNNY_DAY, MOVE_WEATHER_BALL, MOVE_FLAMETHROWER, MOVE_SOLAR_BEAM} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Auron[] = { +static const struct TrainerMon sParty_Auron[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_MANECTRIC, }, { - .iv = 0, .lvl = 33, .species = SPECIES_MACHAMP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Kelvin[] = { +static const struct TrainerMon sParty_Kelvin[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 33, .species = SPECIES_MACHOKE, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 33, .species = SPECIES_SPHEAL, } }; -static const struct TrainerMonItemCustomMoves sParty_Marley[] = { +static const struct TrainerMon sParty_Marley[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 34, .species = SPECIES_MANECTRIC, .heldItem = ITEM_NONE, @@ -6618,1097 +6263,1053 @@ static const struct TrainerMonItemCustomMoves sParty_Marley[] = { } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Reyna[] = { +static const struct TrainerMon sParty_Reyna[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 33, .species = SPECIES_MEDITITE, }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 33, .species = SPECIES_HARIYAMA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Hudson[] = { +static const struct TrainerMon sParty_Hudson[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_WAILMER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Conor[] = { +static const struct TrainerMon sParty_Conor[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_CHINCHOU, }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 33, .species = SPECIES_HARIYAMA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Edwin1[] = { +static const struct TrainerMon sParty_Edwin1[] = { { - .iv = 0, .lvl = 14, .species = SPECIES_LOMBRE, }, { - .iv = 0, .lvl = 14, .species = SPECIES_NUZLEAF, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Hector[] = { +static const struct TrainerMon sParty_Hector[] = { { - .iv = 0, .lvl = 18, .species = SPECIES_ZANGOOSE, }, { - .iv = 0, .lvl = 18, .species = SPECIES_SEVIPER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_TabithaMossdeep[] = { +static const struct TrainerMon sParty_TabithaMossdeep[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 36, .species = SPECIES_CAMERUPT, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 38, .species = SPECIES_MIGHTYENA, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 40, .species = SPECIES_GOLBAT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Edwin2[] = { +static const struct TrainerMon sParty_Edwin2[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_LOMBRE, }, { - .iv = 0, .lvl = 26, .species = SPECIES_NUZLEAF, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Edwin3[] = { +static const struct TrainerMon sParty_Edwin3[] = { { - .iv = 0, .lvl = 29, .species = SPECIES_LOMBRE, }, { - .iv = 0, .lvl = 29, .species = SPECIES_NUZLEAF, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Edwin4[] = { +static const struct TrainerMon sParty_Edwin4[] = { { - .iv = 0, .lvl = 32, .species = SPECIES_LOMBRE, }, { - .iv = 0, .lvl = 32, .species = SPECIES_NUZLEAF, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Edwin5[] = { +static const struct TrainerMon sParty_Edwin5[] = { { - .iv = 0, .lvl = 35, .species = SPECIES_LUDICOLO, }, { - .iv = 0, .lvl = 35, .species = SPECIES_SHIFTRY, } }; -static const struct TrainerMonNoItemCustomMoves sParty_WallyVR1[] = { +static const struct TrainerMon sParty_WallyVR1[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 44, .species = SPECIES_ALTARIA, .moves = {MOVE_AERIAL_ACE, MOVE_SAFEGUARD, MOVE_DRAGON_BREATH, MOVE_DRAGON_DANCE} }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 43, .species = SPECIES_DELCATTY, .moves = {MOVE_SING, MOVE_ASSIST, MOVE_CHARM, MOVE_FEINT_ATTACK} }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 44, .species = SPECIES_ROSELIA, .moves = {MOVE_MAGICAL_LEAF, MOVE_LEECH_SEED, MOVE_GIGA_DRAIN, MOVE_TOXIC} }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 41, .species = SPECIES_MAGNETON, .moves = {MOVE_SUPERSONIC, MOVE_THUNDERBOLT, MOVE_TRI_ATTACK, MOVE_SCREECH} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 45, .species = SPECIES_GARDEVOIR, .moves = {MOVE_DOUBLE_TEAM, MOVE_CALM_MIND, MOVE_PSYCHIC, MOVE_FUTURE_SIGHT} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_BrendanRoute103Mudkip[] = { +static const struct TrainerMon sParty_BrendanRoute103Mudkip[] = { { - .iv = 0, .lvl = 5, .species = SPECIES_TREECKO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_BrendanRoute110Mudkip[] = { +static const struct TrainerMon sParty_BrendanRoute110Mudkip[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 18, .species = SPECIES_SLUGMA, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 18, .species = SPECIES_WINGULL, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 20, .species = SPECIES_GROVYLE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_BrendanRoute119Mudkip[] = { +static const struct TrainerMon sParty_BrendanRoute119Mudkip[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 29, .species = SPECIES_SLUGMA, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 29, .species = SPECIES_PELIPPER, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 31, .species = SPECIES_GROVYLE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_BrendanRoute103Treecko[] = { +static const struct TrainerMon sParty_BrendanRoute103Treecko[] = { { - .iv = 0, .lvl = 5, .species = SPECIES_TORCHIC, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_BrendanRoute110Treecko[] = { +static const struct TrainerMon sParty_BrendanRoute110Treecko[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 18, .species = SPECIES_WINGULL, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 18, .species = SPECIES_LOMBRE, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 20, .species = SPECIES_COMBUSKEN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_BrendanRoute119Treecko[] = { +static const struct TrainerMon sParty_BrendanRoute119Treecko[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 29, .species = SPECIES_PELIPPER, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 29, .species = SPECIES_LOMBRE, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 31, .species = SPECIES_COMBUSKEN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_BrendanRoute103Torchic[] = { +static const struct TrainerMon sParty_BrendanRoute103Torchic[] = { { - .iv = 0, .lvl = 5, .species = SPECIES_MUDKIP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_BrendanRoute110Torchic[] = { +static const struct TrainerMon sParty_BrendanRoute110Torchic[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 18, .species = SPECIES_LOMBRE, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 18, .species = SPECIES_SLUGMA, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 20, .species = SPECIES_MARSHTOMP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_BrendanRoute119Torchic[] = { +static const struct TrainerMon sParty_BrendanRoute119Torchic[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 29, .species = SPECIES_LOMBRE, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 29, .species = SPECIES_SLUGMA, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 31, .species = SPECIES_MARSHTOMP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_MayRoute103Mudkip[] = { +static const struct TrainerMon sParty_MayRoute103Mudkip[] = { { - .iv = 0, .lvl = 5, .species = SPECIES_TREECKO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_MayRoute110Mudkip[] = { +static const struct TrainerMon sParty_MayRoute110Mudkip[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 18, .species = SPECIES_WINGULL, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 18, .species = SPECIES_SLUGMA, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 20, .species = SPECIES_GROVYLE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_MayRoute119Mudkip[] = { +static const struct TrainerMon sParty_MayRoute119Mudkip[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 29, .species = SPECIES_SLUGMA, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 29, .species = SPECIES_LOMBRE, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 31, .species = SPECIES_GROVYLE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_MayRoute103Treecko[] = { +static const struct TrainerMon sParty_MayRoute103Treecko[] = { { - .iv = 0, .lvl = 5, .species = SPECIES_TORCHIC, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_MayRoute110Treecko[] = { +static const struct TrainerMon sParty_MayRoute110Treecko[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 18, .species = SPECIES_WINGULL, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 18, .species = SPECIES_LOMBRE, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 20, .species = SPECIES_COMBUSKEN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_MayRoute119Treecko[] = { +static const struct TrainerMon sParty_MayRoute119Treecko[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 29, .species = SPECIES_PELIPPER, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 29, .species = SPECIES_LOMBRE, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 31, .species = SPECIES_COMBUSKEN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_MayRoute103Torchic[] = { +static const struct TrainerMon sParty_MayRoute103Torchic[] = { { - .iv = 0, .lvl = 5, .species = SPECIES_MUDKIP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_MayRoute110Torchic[] = { +static const struct TrainerMon sParty_MayRoute110Torchic[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 18, .species = SPECIES_LOMBRE, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 18, .species = SPECIES_SLUGMA, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 20, .species = SPECIES_MARSHTOMP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_MayRoute119Torchic[] = { +static const struct TrainerMon sParty_MayRoute119Torchic[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 29, .species = SPECIES_LOMBRE, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 29, .species = SPECIES_SLUGMA, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 31, .species = SPECIES_MARSHTOMP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Isaac1[] = { +static const struct TrainerMon sParty_Isaac1[] = { { - .iv = 0, .lvl = 11, .species = SPECIES_WHISMUR, }, { - .iv = 0, .lvl = 11, .species = SPECIES_ZIGZAGOON, }, { - .iv = 0, .lvl = 11, .species = SPECIES_ARON, }, { - .iv = 0, .lvl = 11, .species = SPECIES_POOCHYENA, }, { - .iv = 0, .lvl = 11, .species = SPECIES_TAILLOW, }, { - .iv = 0, .lvl = 11, .species = SPECIES_MAKUHITA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Davis[] = { +static const struct TrainerMon sParty_Davis[] = { { - .iv = 0, .lvl = 27, .species = SPECIES_PINSIR, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Mitchell[] = { +static const struct TrainerMon sParty_Mitchell[] = { { - .iv = 0, .lvl = 43, .species = SPECIES_LUNATONE, .moves = {MOVE_EXPLOSION, MOVE_REFLECT, MOVE_LIGHT_SCREEN, MOVE_PSYCHIC} }, { - .iv = 0, .lvl = 43, .species = SPECIES_SOLROCK, .moves = {MOVE_EXPLOSION, MOVE_REFLECT, MOVE_LIGHT_SCREEN, MOVE_SHADOW_BALL} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Isaac2[] = { +static const struct TrainerMon sParty_Isaac2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 22, .species = SPECIES_LOUDRED, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 22, .species = SPECIES_LINOONE, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 22, .species = SPECIES_ARON, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 22, .species = SPECIES_MIGHTYENA, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 22, .species = SPECIES_SWELLOW, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 22, .species = SPECIES_MAKUHITA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Isaac3[] = { +static const struct TrainerMon sParty_Isaac3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 25, .species = SPECIES_LOUDRED, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 25, .species = SPECIES_LINOONE, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 25, .species = SPECIES_ARON, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 25, .species = SPECIES_MIGHTYENA, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 25, .species = SPECIES_SWELLOW, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 25, .species = SPECIES_HARIYAMA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Isaac4[] = { +static const struct TrainerMon sParty_Isaac4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 28, .species = SPECIES_LOUDRED, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 28, .species = SPECIES_LINOONE, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 28, .species = SPECIES_ARON, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 28, .species = SPECIES_MIGHTYENA, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 28, .species = SPECIES_SWELLOW, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 28, .species = SPECIES_HARIYAMA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Isaac5[] = { +static const struct TrainerMon sParty_Isaac5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 31, .species = SPECIES_LOUDRED, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 31, .species = SPECIES_LINOONE, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 31, .species = SPECIES_LAIRON, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 31, .species = SPECIES_MIGHTYENA, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 31, .species = SPECIES_SWELLOW, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 31, .species = SPECIES_HARIYAMA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Lydia1[] = { +static const struct TrainerMon sParty_Lydia1[] = { { - .iv = 0, .lvl = 11, .species = SPECIES_WINGULL, }, { - .iv = 0, .lvl = 11, .species = SPECIES_SHROOMISH, }, { - .iv = 0, .lvl = 11, .species = SPECIES_MARILL, }, { - .iv = 0, .lvl = 11, .species = SPECIES_ROSELIA, }, { - .iv = 0, .lvl = 11, .species = SPECIES_SKITTY, }, { - .iv = 0, .lvl = 11, .species = SPECIES_GOLDEEN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Halle[] = { +static const struct TrainerMon sParty_Halle[] = { { - .iv = 0, .lvl = 43, .species = SPECIES_SABLEYE, }, { - .iv = 0, .lvl = 43, .species = SPECIES_ABSOL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Garrison[] = { +static const struct TrainerMon sParty_Garrison[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_SANDSLASH, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Lydia2[] = { +static const struct TrainerMon sParty_Lydia2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 22, .species = SPECIES_WINGULL, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 22, .species = SPECIES_SHROOMISH, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 22, .species = SPECIES_MARILL, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 22, .species = SPECIES_ROSELIA, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 22, .species = SPECIES_SKITTY, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 22, .species = SPECIES_GOLDEEN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Lydia3[] = { +static const struct TrainerMon sParty_Lydia3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 25, .species = SPECIES_PELIPPER, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 25, .species = SPECIES_BRELOOM, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 25, .species = SPECIES_MARILL, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 25, .species = SPECIES_ROSELIA, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 25, .species = SPECIES_DELCATTY, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 25, .species = SPECIES_GOLDEEN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Lydia4[] = { +static const struct TrainerMon sParty_Lydia4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 28, .species = SPECIES_PELIPPER, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 28, .species = SPECIES_BRELOOM, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 28, .species = SPECIES_MARILL, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 28, .species = SPECIES_ROSELIA, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 28, .species = SPECIES_DELCATTY, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 28, .species = SPECIES_GOLDEEN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Lydia5[] = { +static const struct TrainerMon sParty_Lydia5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 31, .species = SPECIES_PELIPPER, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 31, .species = SPECIES_BRELOOM, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 31, .species = SPECIES_AZUMARILL, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 31, .species = SPECIES_ROSELIA, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 31, .species = SPECIES_DELCATTY, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 31, .species = SPECIES_SEAKING, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jackson1[] = { +static const struct TrainerMon sParty_Jackson1[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 27, .species = SPECIES_BRELOOM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Lorenzo[] = { +static const struct TrainerMon sParty_Lorenzo[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 28, .species = SPECIES_SEEDOT, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 28, .species = SPECIES_NUZLEAF, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 28, .species = SPECIES_LOMBRE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Sebastian[] = { +static const struct TrainerMon sParty_Sebastian[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 39, .species = SPECIES_CACTURNE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jackson2[] = { +static const struct TrainerMon sParty_Jackson2[] = { { - .iv = 60, + .iv = TRAINER_PARTY_IVS(7, 7, 7, 7, 7, 7), .lvl = 31, .species = SPECIES_BRELOOM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jackson3[] = { +static const struct TrainerMon sParty_Jackson3[] = { { - .iv = 70, + .iv = TRAINER_PARTY_IVS(8, 8, 8, 8, 8, 8), .lvl = 34, .species = SPECIES_BRELOOM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jackson4[] = { +static const struct TrainerMon sParty_Jackson4[] = { { - .iv = 80, + .iv = TRAINER_PARTY_IVS(9, 9, 9, 9, 9, 9), .lvl = 37, .species = SPECIES_BRELOOM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jackson5[] = { +static const struct TrainerMon sParty_Jackson5[] = { { - .iv = 90, + .iv = TRAINER_PARTY_IVS(10, 10, 10, 10, 10, 10), .lvl = 39, .species = SPECIES_KECLEON, }, { - .iv = 90, + .iv = TRAINER_PARTY_IVS(10, 10, 10, 10, 10, 10), .lvl = 39, .species = SPECIES_BRELOOM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Catherine1[] = { +static const struct TrainerMon sParty_Catherine1[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 26, .species = SPECIES_GLOOM, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 26, .species = SPECIES_ROSELIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jenna[] = { +static const struct TrainerMon sParty_Jenna[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 28, .species = SPECIES_LOTAD, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 28, .species = SPECIES_LOMBRE, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 28, .species = SPECIES_NUZLEAF, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Sophia[] = { +static const struct TrainerMon sParty_Sophia[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 38, .species = SPECIES_SWABLU, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 38, .species = SPECIES_ROSELIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Catherine2[] = { +static const struct TrainerMon sParty_Catherine2[] = { { - .iv = 60, + .iv = TRAINER_PARTY_IVS(7, 7, 7, 7, 7, 7), .lvl = 30, .species = SPECIES_GLOOM, }, { - .iv = 60, + .iv = TRAINER_PARTY_IVS(7, 7, 7, 7, 7, 7), .lvl = 30, .species = SPECIES_ROSELIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Catherine3[] = { +static const struct TrainerMon sParty_Catherine3[] = { { - .iv = 70, + .iv = TRAINER_PARTY_IVS(8, 8, 8, 8, 8, 8), .lvl = 33, .species = SPECIES_GLOOM, }, { - .iv = 70, + .iv = TRAINER_PARTY_IVS(8, 8, 8, 8, 8, 8), .lvl = 33, .species = SPECIES_ROSELIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Catherine4[] = { +static const struct TrainerMon sParty_Catherine4[] = { { - .iv = 80, + .iv = TRAINER_PARTY_IVS(9, 9, 9, 9, 9, 9), .lvl = 36, .species = SPECIES_GLOOM, }, { - .iv = 80, + .iv = TRAINER_PARTY_IVS(9, 9, 9, 9, 9, 9), .lvl = 36, .species = SPECIES_ROSELIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Catherine5[] = { +static const struct TrainerMon sParty_Catherine5[] = { { - .iv = 90, + .iv = TRAINER_PARTY_IVS(10, 10, 10, 10, 10, 10), .lvl = 39, .species = SPECIES_BELLOSSOM, }, { - .iv = 90, + .iv = TRAINER_PARTY_IVS(10, 10, 10, 10, 10, 10), .lvl = 39, .species = SPECIES_ROSELIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Julio[] = { +static const struct TrainerMon sParty_Julio[] = { { - .iv = 0, .lvl = 21, .species = SPECIES_MAGNEMITE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntSeafloorCavern5[] = { +static const struct TrainerMon sParty_GruntSeafloorCavern5[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 35, .species = SPECIES_MIGHTYENA, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 35, .species = SPECIES_GOLBAT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntUnused[] = { +static const struct TrainerMon sParty_GruntUnused[] = { { - .iv = 0, .lvl = 31, .species = SPECIES_WAILMER, }, { - .iv = 0, .lvl = 31, .species = SPECIES_ZUBAT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMtPyre4[] = { +static const struct TrainerMon sParty_GruntMtPyre4[] = { { - .iv = 0, .lvl = 30, .species = SPECIES_WAILMER, }, { - .iv = 0, .lvl = 30, .species = SPECIES_ZUBAT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntJaggedPass[] = { +static const struct TrainerMon sParty_GruntJaggedPass[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 22, .species = SPECIES_POOCHYENA, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 22, .species = SPECIES_NUMEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Marc[] = { +static const struct TrainerMon sParty_Marc[] = { { - .iv = 120, + .iv = TRAINER_PARTY_IVS(14, 14, 14, 14, 14, 14), .lvl = 8, .species = SPECIES_GEODUDE, }, { - .iv = 130, + .iv = TRAINER_PARTY_IVS(15, 15, 15, 15, 15, 15), .lvl = 8, .species = SPECIES_GEODUDE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Brenden[] = { +static const struct TrainerMon sParty_Brenden[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 13, .species = SPECIES_MACHOP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Lilith[] = { +static const struct TrainerMon sParty_Lilith[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 13, .species = SPECIES_MEDITITE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cristian[] = { +static const struct TrainerMon sParty_Cristian[] = { { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 13, .species = SPECIES_MAKUHITA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Sylvia[] = { +static const struct TrainerMon sParty_Sylvia[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 36, .species = SPECIES_MEDITITE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Leonardo[] = { +static const struct TrainerMon sParty_Leonardo[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonItemCustomMoves sParty_Athena[] = { +static const struct TrainerMon sParty_Athena[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 32, .species = SPECIES_MANECTRIC, .heldItem = ITEM_NONE, .moves = {MOVE_THUNDER, MOVE_THUNDER_WAVE, MOVE_QUICK_ATTACK, MOVE_NONE} }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 32, .species = SPECIES_LINOONE, .heldItem = ITEM_NONE, @@ -7716,2612 +7317,2396 @@ static const struct TrainerMonItemCustomMoves sParty_Athena[] = { } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Harrison[] = { +static const struct TrainerMon sParty_Harrison[] = { { - .iv = 0, .lvl = 35, .species = SPECIES_TENTACRUEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMtChimney2[] = { +static const struct TrainerMon sParty_GruntMtChimney2[] = { { - .iv = 0, .lvl = 20, .species = SPECIES_ZUBAT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Clarence[] = { +static const struct TrainerMon sParty_Clarence[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_SHARPEDO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Terry[] = { +static const struct TrainerMon sParty_Terry[] = { { - .iv = 0, .lvl = 37, .species = SPECIES_GIRAFARIG, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Nate[] = { +static const struct TrainerMon sParty_Nate[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 36, .species = SPECIES_SPOINK, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Kathleen[] = { +static const struct TrainerMon sParty_Kathleen[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 36, .species = SPECIES_KADABRA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Clifford[] = { +static const struct TrainerMon sParty_Clifford[] = { { - .iv = 0, .lvl = 36, .species = SPECIES_GIRAFARIG, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Nicholas[] = { +static const struct TrainerMon sParty_Nicholas[] = { { - .iv = 0, .lvl = 36, .species = SPECIES_WOBBUFFET, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntSpaceCenter3[] = { +static const struct TrainerMon sParty_GruntSpaceCenter3[] = { { - .iv = 0, .lvl = 31, .species = SPECIES_ZUBAT, }, { - .iv = 0, .lvl = 31, .species = SPECIES_POOCHYENA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntSpaceCenter4[] = { +static const struct TrainerMon sParty_GruntSpaceCenter4[] = { { - .iv = 0, .lvl = 32, .species = SPECIES_BALTOY, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntSpaceCenter5[] = { +static const struct TrainerMon sParty_GruntSpaceCenter5[] = { { - .iv = 0, .lvl = 32, .species = SPECIES_ZUBAT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntSpaceCenter6[] = { +static const struct TrainerMon sParty_GruntSpaceCenter6[] = { { - .iv = 0, .lvl = 32, .species = SPECIES_MIGHTYENA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntSpaceCenter7[] = { +static const struct TrainerMon sParty_GruntSpaceCenter7[] = { { - .iv = 0, .lvl = 32, .species = SPECIES_BALTOY, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Macey[] = { +static const struct TrainerMon sParty_Macey[] = { { - .iv = 0, .lvl = 36, .species = SPECIES_NATU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_BrendanRustboroTreecko[] = { +static const struct TrainerMon sParty_BrendanRustboroTreecko[] = { { - .iv = 25, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 13, .species = SPECIES_LOTAD, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 15, .species = SPECIES_TORCHIC, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_BrendanRustboroMudkip[] = { +static const struct TrainerMon sParty_BrendanRustboroMudkip[] = { { - .iv = 25, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 13, .species = SPECIES_WINGULL, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 15, .species = SPECIES_TREECKO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Paxton[] = { +static const struct TrainerMon sParty_Paxton[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_SWELLOW, }, { - .iv = 0, .lvl = 33, .species = SPECIES_BRELOOM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Isabella[] = { +static const struct TrainerMon sParty_Isabella[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_STARYU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntWeatherInst5[] = { +static const struct TrainerMon sParty_GruntWeatherInst5[] = { { - .iv = 0, .lvl = 27, .species = SPECIES_ZUBAT, }, { - .iv = 0, .lvl = 27, .species = SPECIES_POOCHYENA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_TabithaMtChimney[] = { +static const struct TrainerMon sParty_TabithaMtChimney[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 18, .species = SPECIES_NUMEL, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 20, .species = SPECIES_POOCHYENA, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 22, .species = SPECIES_NUMEL, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 22, .species = SPECIES_ZUBAT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jonathan[] = { +static const struct TrainerMon sParty_Jonathan[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_KECLEON, }, { - .iv = 0, .lvl = 33, .species = SPECIES_LOUDRED, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_BrendanRustboroTorchic[] = { +static const struct TrainerMon sParty_BrendanRustboroTorchic[] = { { - .iv = 25, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 13, .species = SPECIES_SLUGMA, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 15, .species = SPECIES_MUDKIP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_MayRustboroMudkip[] = { +static const struct TrainerMon sParty_MayRustboroMudkip[] = { { - .iv = 25, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 13, .species = SPECIES_WINGULL, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 15, .species = SPECIES_TREECKO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_MaxieMagmaHideout[] = { +static const struct TrainerMon sParty_MaxieMagmaHideout[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 37, .species = SPECIES_MIGHTYENA, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 38, .species = SPECIES_CROBAT, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 39, .species = SPECIES_CAMERUPT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_MaxieMtChimney[] = { +static const struct TrainerMon sParty_MaxieMtChimney[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 24, .species = SPECIES_MIGHTYENA, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 24, .species = SPECIES_ZUBAT, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 25, .species = SPECIES_CAMERUPT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Tiana[] = { +static const struct TrainerMon sParty_Tiana[] = { { - .iv = 0, .lvl = 4, .species = SPECIES_ZIGZAGOON, }, { - .iv = 0, .lvl = 4, .species = SPECIES_SHROOMISH, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Haley1[] = { +static const struct TrainerMon sParty_Haley1[] = { { - .iv = 0, .lvl = 6, .species = SPECIES_LOTAD, }, { - .iv = 0, .lvl = 6, .species = SPECIES_SHROOMISH, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Janice[] = { +static const struct TrainerMon sParty_Janice[] = { { - .iv = 0, .lvl = 9, .species = SPECIES_MARILL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Vivi[] = { +static const struct TrainerMon sParty_Vivi[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 15, .species = SPECIES_MARILL, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 15, .species = SPECIES_SHROOMISH, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 15, .species = SPECIES_NUMEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Haley2[] = { +static const struct TrainerMon sParty_Haley2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 26, .species = SPECIES_LOMBRE, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 26, .species = SPECIES_SHROOMISH, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Haley3[] = { +static const struct TrainerMon sParty_Haley3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 29, .species = SPECIES_LOMBRE, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 29, .species = SPECIES_BRELOOM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Haley4[] = { +static const struct TrainerMon sParty_Haley4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 32, .species = SPECIES_LOMBRE, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 32, .species = SPECIES_BRELOOM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Haley5[] = { +static const struct TrainerMon sParty_Haley5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 34, .species = SPECIES_SWELLOW, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 34, .species = SPECIES_LOMBRE, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 34, .species = SPECIES_BRELOOM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Sally[] = { +static const struct TrainerMon sParty_Sally[] = { { - .iv = 0, .lvl = 16, .species = SPECIES_ODDISH, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Robin[] = { +static const struct TrainerMon sParty_Robin[] = { { - .iv = 0, .lvl = 14, .species = SPECIES_SKITTY, }, { - .iv = 0, .lvl = 14, .species = SPECIES_SHROOMISH, }, { - .iv = 0, .lvl = 14, .species = SPECIES_MARILL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Andrea[] = { +static const struct TrainerMon sParty_Andrea[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 40, .species = SPECIES_LUVDISC, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Crissy[] = { +static const struct TrainerMon sParty_Crissy[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 39, .species = SPECIES_GOLDEEN, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 39, .species = SPECIES_WAILMER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Rick[] = { +static const struct TrainerMon sParty_Rick[] = { { - .iv = 0, .lvl = 4, .species = SPECIES_WURMPLE, }, { - .iv = 0, .lvl = 4, .species = SPECIES_WURMPLE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Lyle[] = { +static const struct TrainerMon sParty_Lyle[] = { { - .iv = 0, .lvl = 3, .species = SPECIES_WURMPLE, }, { - .iv = 0, .lvl = 3, .species = SPECIES_WURMPLE, }, { - .iv = 0, .lvl = 3, .species = SPECIES_WURMPLE, }, { - .iv = 0, .lvl = 3, .species = SPECIES_WURMPLE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jose[] = { +static const struct TrainerMon sParty_Jose[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 8, .species = SPECIES_WURMPLE, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 8, .species = SPECIES_NINCADA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Doug[] = { +static const struct TrainerMon sParty_Doug[] = { { - .iv = 0, .lvl = 28, .species = SPECIES_NINCADA, }, { - .iv = 0, .lvl = 28, .species = SPECIES_NINJASK, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Greg[] = { +static const struct TrainerMon sParty_Greg[] = { { - .iv = 0, .lvl = 25, .species = SPECIES_VOLBEAT, }, { - .iv = 0, .lvl = 25, .species = SPECIES_ILLUMISE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Kent[] = { +static const struct TrainerMon sParty_Kent[] = { { - .iv = 0, .lvl = 25, .species = SPECIES_NINJASK, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_James1[] = { +static const struct TrainerMon sParty_James1[] = { { - .iv = 0, .lvl = 6, .species = SPECIES_NINCADA, }, { - .iv = 0, .lvl = 6, .species = SPECIES_NINCADA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_James2[] = { +static const struct TrainerMon sParty_James2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 27, .species = SPECIES_NINJASK, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_James3[] = { +static const struct TrainerMon sParty_James3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 29, .species = SPECIES_DUSTOX, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 29, .species = SPECIES_NINJASK, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_James4[] = { +static const struct TrainerMon sParty_James4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 31, .species = SPECIES_SURSKIT, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 31, .species = SPECIES_DUSTOX, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 31, .species = SPECIES_NINJASK, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_James5[] = { +static const struct TrainerMon sParty_James5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 33, .species = SPECIES_SURSKIT, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 33, .species = SPECIES_NINJASK, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 33, .species = SPECIES_DUSTOX, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 33, .species = SPECIES_NINJASK, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Brice[] = { +static const struct TrainerMon sParty_Brice[] = { { - .iv = 0, .lvl = 17, .species = SPECIES_NUMEL, }, { - .iv = 0, .lvl = 17, .species = SPECIES_MACHOP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Trent1[] = { +static const struct TrainerMon sParty_Trent1[] = { { - .iv = 0, .lvl = 16, .species = SPECIES_GEODUDE, }, { - .iv = 0, .lvl = 17, .species = SPECIES_GEODUDE, }, { - .iv = 0, .lvl = 16, .species = SPECIES_GEODUDE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Lenny[] = { +static const struct TrainerMon sParty_Lenny[] = { { - .iv = 0, .lvl = 18, .species = SPECIES_GEODUDE, }, { - .iv = 0, .lvl = 18, .species = SPECIES_MACHOP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Lucas1[] = { +static const struct TrainerMon sParty_Lucas1[] = { { - .iv = 0, .lvl = 18, .species = SPECIES_GEODUDE, }, { - .iv = 0, .lvl = 18, .species = SPECIES_NUMEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Alan[] = { +static const struct TrainerMon sParty_Alan[] = { { - .iv = 0, .lvl = 22, .species = SPECIES_GEODUDE, }, { - .iv = 0, .lvl = 22, .species = SPECIES_NOSEPASS, }, { - .iv = 0, .lvl = 22, .species = SPECIES_GRAVELER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Clark[] = { +static const struct TrainerMon sParty_Clark[] = { { - .iv = 0, .lvl = 8, .species = SPECIES_GEODUDE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Eric[] = { +static const struct TrainerMon sParty_Eric[] = { { - .iv = 0, .lvl = 20, .species = SPECIES_GEODUDE, }, { - .iv = 0, .lvl = 20, .species = SPECIES_BALTOY, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Lucas2[] = { +static const struct TrainerMon sParty_Lucas2[] = { { - .iv = 0, .lvl = 9, .species = SPECIES_WAILMER, .moves = {MOVE_SPLASH, MOVE_WATER_GUN, MOVE_NONE, MOVE_NONE} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Mike1[] = { +static const struct TrainerMon sParty_Mike1[] = { { - .iv = 0, .lvl = 10, .species = SPECIES_PELIPPER, .moves = {MOVE_GUST, MOVE_GROWL, MOVE_NONE, MOVE_NONE} }, { - .iv = 0, .lvl = 10, .species = SPECIES_POOCHYENA, .moves = {MOVE_BITE, MOVE_SCARY_FACE, MOVE_NONE, MOVE_NONE} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Mike2[] = { +static const struct TrainerMon sParty_Mike2[] = { { - .iv = 0, .lvl = 16, .species = SPECIES_GEODUDE, }, { - .iv = 0, .lvl = 16, .species = SPECIES_GEODUDE, }, { - .iv = 0, .lvl = 16, .species = SPECIES_MACHOP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Trent2[] = { +static const struct TrainerMon sParty_Trent2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 24, .species = SPECIES_GEODUDE, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 24, .species = SPECIES_GEODUDE, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 24, .species = SPECIES_GEODUDE, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 24, .species = SPECIES_GRAVELER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Trent3[] = { +static const struct TrainerMon sParty_Trent3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 27, .species = SPECIES_GEODUDE, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 27, .species = SPECIES_GEODUDE, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 27, .species = SPECIES_GRAVELER, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 27, .species = SPECIES_GRAVELER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Trent4[] = { +static const struct TrainerMon sParty_Trent4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 30, .species = SPECIES_GEODUDE, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 30, .species = SPECIES_GRAVELER, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 30, .species = SPECIES_GRAVELER, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 30, .species = SPECIES_GRAVELER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Trent5[] = { +static const struct TrainerMon sParty_Trent5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 33, .species = SPECIES_GRAVELER, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 33, .species = SPECIES_GRAVELER, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 33, .species = SPECIES_GRAVELER, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 33, .species = SPECIES_GOLEM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_DezAndLuke[] = { +static const struct TrainerMon sParty_DezAndLuke[] = { { - .iv = 0, .lvl = 31, .species = SPECIES_DELCATTY, }, { - .iv = 0, .lvl = 31, .species = SPECIES_MANECTRIC, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_LeaAndJed[] = { +static const struct TrainerMon sParty_LeaAndJed[] = { { - .iv = 0, .lvl = 45, .species = SPECIES_LUVDISC, }, { - .iv = 0, .lvl = 45, .species = SPECIES_LUVDISC, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_KiraAndDan1[] = { +static const struct TrainerMon sParty_KiraAndDan1[] = { { - .iv = 0, .lvl = 25, .species = SPECIES_VOLBEAT, }, { - .iv = 0, .lvl = 25, .species = SPECIES_ILLUMISE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_KiraAndDan2[] = { +static const struct TrainerMon sParty_KiraAndDan2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 30, .species = SPECIES_VOLBEAT, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 30, .species = SPECIES_ILLUMISE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_KiraAndDan3[] = { +static const struct TrainerMon sParty_KiraAndDan3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 33, .species = SPECIES_VOLBEAT, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 33, .species = SPECIES_ILLUMISE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_KiraAndDan4[] = { +static const struct TrainerMon sParty_KiraAndDan4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 36, .species = SPECIES_VOLBEAT, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 36, .species = SPECIES_ILLUMISE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_KiraAndDan5[] = { +static const struct TrainerMon sParty_KiraAndDan5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 39, .species = SPECIES_VOLBEAT, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 39, .species = SPECIES_ILLUMISE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Johanna[] = { +static const struct TrainerMon sParty_Johanna[] = { { - .iv = 0, .lvl = 13, .species = SPECIES_GOLDEEN, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Gerald[] = { +static const struct TrainerMon sParty_Gerald[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 23, .species = SPECIES_KECLEON, .moves = {MOVE_FLAMETHROWER, MOVE_FURY_SWIPES, MOVE_FEINT_ATTACK, MOVE_BIND} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Vivian[] = { +static const struct TrainerMon sParty_Vivian[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 17, .species = SPECIES_MEDITITE, .moves = {MOVE_BIDE, MOVE_DETECT, MOVE_CONFUSION, MOVE_THUNDER_PUNCH} }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 17, .species = SPECIES_MEDITITE, .moves = {MOVE_THUNDER_PUNCH, MOVE_DETECT, MOVE_CONFUSION, MOVE_MEDITATE} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Danielle[] = { +static const struct TrainerMon sParty_Danielle[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 23, .species = SPECIES_MEDITITE, .moves = {MOVE_BIDE, MOVE_DETECT, MOVE_CONFUSION, MOVE_FIRE_PUNCH} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Hideo[] = { +static const struct TrainerMon sParty_Hideo[] = { { - .iv = 0, .lvl = 25, .species = SPECIES_KOFFING, .moves = {MOVE_TACKLE, MOVE_SELF_DESTRUCT, MOVE_SLUDGE, MOVE_SMOKESCREEN} }, { - .iv = 0, .lvl = 25, .species = SPECIES_KOFFING, .moves = {MOVE_TACKLE, MOVE_POISON_GAS, MOVE_SLUDGE, MOVE_SMOKESCREEN} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Keigo[] = { +static const struct TrainerMon sParty_Keigo[] = { { - .iv = 0, .lvl = 28, .species = SPECIES_KOFFING, .moves = {MOVE_POISON_GAS, MOVE_SELF_DESTRUCT, MOVE_SLUDGE, MOVE_SMOKESCREEN} }, { - .iv = 0, .lvl = 28, .species = SPECIES_NINJASK, .moves = {MOVE_SAND_ATTACK, MOVE_DOUBLE_TEAM, MOVE_FURY_CUTTER, MOVE_SWORDS_DANCE} } }; -static const struct TrainerMonNoItemCustomMoves sParty_Riley[] = { +static const struct TrainerMon sParty_Riley[] = { { - .iv = 0, .lvl = 28, .species = SPECIES_NINCADA, .moves = {MOVE_LEECH_LIFE, MOVE_FURY_SWIPES, MOVE_MIND_READER, MOVE_DIG} }, { - .iv = 0, .lvl = 28, .species = SPECIES_KOFFING, .moves = {MOVE_TACKLE, MOVE_SELF_DESTRUCT, MOVE_SLUDGE, MOVE_SMOKESCREEN} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Flint[] = { +static const struct TrainerMon sParty_Flint[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 29, .species = SPECIES_SWELLOW, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 29, .species = SPECIES_XATU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Ashley[] = { +static const struct TrainerMon sParty_Ashley[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 27, .species = SPECIES_SWABLU, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 27, .species = SPECIES_SWABLU, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 27, .species = SPECIES_SWABLU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_WallyMauville[] = { +static const struct TrainerMon sParty_WallyMauville[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 16, .species = SPECIES_RALTS, } }; -static const struct TrainerMonNoItemCustomMoves sParty_WallyVR2[] = { +static const struct TrainerMon sParty_WallyVR2[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 47, .species = SPECIES_ALTARIA, .moves = {MOVE_AERIAL_ACE, MOVE_SAFEGUARD, MOVE_DRAGON_BREATH, MOVE_DRAGON_DANCE} }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 46, .species = SPECIES_DELCATTY, .moves = {MOVE_SING, MOVE_ASSIST, MOVE_CHARM, MOVE_FEINT_ATTACK} }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 47, .species = SPECIES_ROSELIA, .moves = {MOVE_MAGICAL_LEAF, MOVE_LEECH_SEED, MOVE_GIGA_DRAIN, MOVE_TOXIC} }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 44, .species = SPECIES_MAGNETON, .moves = {MOVE_SUPERSONIC, MOVE_THUNDERBOLT, MOVE_TRI_ATTACK, MOVE_SCREECH} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 48, .species = SPECIES_GARDEVOIR, .moves = {MOVE_DOUBLE_TEAM, MOVE_CALM_MIND, MOVE_PSYCHIC, MOVE_FUTURE_SIGHT} } }; -static const struct TrainerMonNoItemCustomMoves sParty_WallyVR3[] = { +static const struct TrainerMon sParty_WallyVR3[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 50, .species = SPECIES_ALTARIA, .moves = {MOVE_AERIAL_ACE, MOVE_SAFEGUARD, MOVE_DRAGON_BREATH, MOVE_DRAGON_DANCE} }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 49, .species = SPECIES_DELCATTY, .moves = {MOVE_SING, MOVE_ASSIST, MOVE_CHARM, MOVE_FEINT_ATTACK} }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 50, .species = SPECIES_ROSELIA, .moves = {MOVE_MAGICAL_LEAF, MOVE_LEECH_SEED, MOVE_GIGA_DRAIN, MOVE_TOXIC} }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 47, .species = SPECIES_MAGNETON, .moves = {MOVE_SUPERSONIC, MOVE_THUNDERBOLT, MOVE_TRI_ATTACK, MOVE_SCREECH} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 51, .species = SPECIES_GARDEVOIR, .moves = {MOVE_DOUBLE_TEAM, MOVE_CALM_MIND, MOVE_PSYCHIC, MOVE_FUTURE_SIGHT} } }; -static const struct TrainerMonNoItemCustomMoves sParty_WallyVR4[] = { +static const struct TrainerMon sParty_WallyVR4[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 53, .species = SPECIES_ALTARIA, .moves = {MOVE_AERIAL_ACE, MOVE_SAFEGUARD, MOVE_DRAGON_BREATH, MOVE_DRAGON_DANCE} }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 52, .species = SPECIES_DELCATTY, .moves = {MOVE_SING, MOVE_ASSIST, MOVE_CHARM, MOVE_FEINT_ATTACK} }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 53, .species = SPECIES_ROSELIA, .moves = {MOVE_MAGICAL_LEAF, MOVE_LEECH_SEED, MOVE_GIGA_DRAIN, MOVE_TOXIC} }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 50, .species = SPECIES_MAGNETON, .moves = {MOVE_SUPERSONIC, MOVE_THUNDERBOLT, MOVE_TRI_ATTACK, MOVE_SCREECH} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 54, .species = SPECIES_GARDEVOIR, .moves = {MOVE_DOUBLE_TEAM, MOVE_CALM_MIND, MOVE_PSYCHIC, MOVE_FUTURE_SIGHT} } }; -static const struct TrainerMonNoItemCustomMoves sParty_WallyVR5[] = { +static const struct TrainerMon sParty_WallyVR5[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 56, .species = SPECIES_ALTARIA, .moves = {MOVE_AERIAL_ACE, MOVE_SAFEGUARD, MOVE_DRAGON_BREATH, MOVE_DRAGON_DANCE} }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 55, .species = SPECIES_DELCATTY, .moves = {MOVE_SING, MOVE_ASSIST, MOVE_CHARM, MOVE_FEINT_ATTACK} }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 56, .species = SPECIES_ROSELIA, .moves = {MOVE_MAGICAL_LEAF, MOVE_LEECH_SEED, MOVE_GIGA_DRAIN, MOVE_TOXIC} }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 53, .species = SPECIES_MAGNETON, .moves = {MOVE_SUPERSONIC, MOVE_THUNDERBOLT, MOVE_TRI_ATTACK, MOVE_SCREECH} }, { - .iv = 250, + .iv = TRAINER_PARTY_IVS(30, 30, 30, 30, 30, 30), .lvl = 57, .species = SPECIES_GARDEVOIR, .moves = {MOVE_DOUBLE_TEAM, MOVE_CALM_MIND, MOVE_PSYCHIC, MOVE_FUTURE_SIGHT} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_BrendanLilycoveMudkip[] = { +static const struct TrainerMon sParty_BrendanLilycoveMudkip[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 31, .species = SPECIES_TROPIUS, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 32, .species = SPECIES_SLUGMA, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 32, .species = SPECIES_PELIPPER, }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 34, .species = SPECIES_GROVYLE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_BrendanLilycoveTreecko[] = { +static const struct TrainerMon sParty_BrendanLilycoveTreecko[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 31, .species = SPECIES_TROPIUS, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 32, .species = SPECIES_PELIPPER, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 32, .species = SPECIES_LUDICOLO, }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 34, .species = SPECIES_COMBUSKEN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_BrendanLilycoveTorchic[] = { +static const struct TrainerMon sParty_BrendanLilycoveTorchic[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 31, .species = SPECIES_TROPIUS, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 32, .species = SPECIES_LUDICOLO, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 32, .species = SPECIES_SLUGMA, }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 34, .species = SPECIES_MARSHTOMP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_MayLilycoveMudkip[] = { +static const struct TrainerMon sParty_MayLilycoveMudkip[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 31, .species = SPECIES_TROPIUS, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 32, .species = SPECIES_SLUGMA, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 32, .species = SPECIES_PELIPPER, }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 34, .species = SPECIES_GROVYLE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_MayLilycoveTreecko[] = { +static const struct TrainerMon sParty_MayLilycoveTreecko[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 31, .species = SPECIES_TROPIUS, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 32, .species = SPECIES_PELIPPER, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 32, .species = SPECIES_LUDICOLO, }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 34, .species = SPECIES_COMBUSKEN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_MayLilycoveTorchic[] = { +static const struct TrainerMon sParty_MayLilycoveTorchic[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 31, .species = SPECIES_TROPIUS, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 32, .species = SPECIES_LUDICOLO, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 32, .species = SPECIES_SLUGMA, }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 34, .species = SPECIES_MARSHTOMP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jonah[] = { +static const struct TrainerMon sParty_Jonah[] = { { - .iv = 0, .lvl = 30, .species = SPECIES_WAILMER, }, { - .iv = 0, .lvl = 31, .species = SPECIES_TENTACOOL, }, { - .iv = 0, .lvl = 32, .species = SPECIES_SHARPEDO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Henry[] = { +static const struct TrainerMon sParty_Henry[] = { { - .iv = 0, .lvl = 31, .species = SPECIES_CARVANHA, }, { - .iv = 0, .lvl = 34, .species = SPECIES_TENTACRUEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Roger[] = { +static const struct TrainerMon sParty_Roger[] = { { - .iv = 0, .lvl = 15, .species = SPECIES_MAGIKARP, }, { - .iv = 0, .lvl = 25, .species = SPECIES_MAGIKARP, }, { - .iv = 0, .lvl = 35, .species = SPECIES_GYARADOS, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Alexa[] = { +static const struct TrainerMon sParty_Alexa[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 34, .species = SPECIES_GLOOM, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 34, .species = SPECIES_AZUMARILL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Ruben[] = { +static const struct TrainerMon sParty_Ruben[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 34, .species = SPECIES_SHIFTRY, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 34, .species = SPECIES_NOSEPASS, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Koji1[] = { +static const struct TrainerMon sParty_Koji1[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_MACHOKE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Wayne[] = { +static const struct TrainerMon sParty_Wayne[] = { { - .iv = 0, .lvl = 31, .species = SPECIES_TENTACOOL, }, { - .iv = 0, .lvl = 31, .species = SPECIES_TENTACOOL, }, { - .iv = 0, .lvl = 36, .species = SPECIES_WAILMER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Aidan[] = { +static const struct TrainerMon sParty_Aidan[] = { { - .iv = 0, .lvl = 32, .species = SPECIES_SWELLOW, }, { - .iv = 0, .lvl = 32, .species = SPECIES_SKARMORY, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Reed[] = { +static const struct TrainerMon sParty_Reed[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_SPHEAL, }, { - .iv = 0, .lvl = 33, .species = SPECIES_SHARPEDO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Tisha[] = { +static const struct TrainerMon sParty_Tisha[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_CHINCHOU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_ToriAndTia[] = { +static const struct TrainerMon sParty_ToriAndTia[] = { { - .iv = 0, .lvl = 19, .species = SPECIES_SPINDA, }, { - .iv = 0, .lvl = 19, .species = SPECIES_SPINDA, } }; -static const struct TrainerMonNoItemCustomMoves sParty_KimAndIris[] = { +static const struct TrainerMon sParty_KimAndIris[] = { { - .iv = 0, .lvl = 32, .species = SPECIES_SWABLU, .moves = {MOVE_SING, MOVE_FURY_ATTACK, MOVE_SAFEGUARD, MOVE_AERIAL_ACE} }, { - .iv = 0, .lvl = 35, .species = SPECIES_NUMEL, .moves = {MOVE_FLAMETHROWER, MOVE_TAKE_DOWN, MOVE_REST, MOVE_EARTHQUAKE} } }; -static const struct TrainerMonNoItemCustomMoves sParty_TyraAndIvy[] = { +static const struct TrainerMon sParty_TyraAndIvy[] = { { - .iv = 0, .lvl = 18, .species = SPECIES_ROSELIA, .moves = {MOVE_GROWTH, MOVE_STUN_SPORE, MOVE_MEGA_DRAIN, MOVE_LEECH_SEED} }, { - .iv = 0, .lvl = 20, .species = SPECIES_GRAVELER, .moves = {MOVE_DEFENSE_CURL, MOVE_ROLLOUT, MOVE_MUD_SPORT, MOVE_ROCK_THROW} } }; -static const struct TrainerMonNoItemCustomMoves sParty_MelAndPaul[] = { +static const struct TrainerMon sParty_MelAndPaul[] = { { - .iv = 0, .lvl = 27, .species = SPECIES_DUSTOX, .moves = {MOVE_GUST, MOVE_PSYBEAM, MOVE_TOXIC, MOVE_PROTECT} }, { - .iv = 0, .lvl = 27, .species = SPECIES_BEAUTIFLY, .moves = {MOVE_GUST, MOVE_MEGA_DRAIN, MOVE_ATTRACT, MOVE_STUN_SPORE} } }; -static const struct TrainerMonNoItemCustomMoves sParty_JohnAndJay1[] = { +static const struct TrainerMon sParty_JohnAndJay1[] = { { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 39, .species = SPECIES_MEDICHAM, .moves = {MOVE_PSYCHIC, MOVE_FIRE_PUNCH, MOVE_PSYCH_UP, MOVE_PROTECT} }, { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 39, .species = SPECIES_HARIYAMA, .moves = {MOVE_FOCUS_PUNCH, MOVE_ROCK_TOMB, MOVE_REST, MOVE_BELLY_DRUM} } }; -static const struct TrainerMonNoItemCustomMoves sParty_JohnAndJay2[] = { +static const struct TrainerMon sParty_JohnAndJay2[] = { { - .iv = 210, + .iv = TRAINER_PARTY_IVS(25, 25, 25, 25, 25, 25), .lvl = 43, .species = SPECIES_MEDICHAM, .moves = {MOVE_PSYCHIC, MOVE_FIRE_PUNCH, MOVE_PSYCH_UP, MOVE_PROTECT} }, { - .iv = 210, + .iv = TRAINER_PARTY_IVS(25, 25, 25, 25, 25, 25), .lvl = 43, .species = SPECIES_HARIYAMA, .moves = {MOVE_FOCUS_PUNCH, MOVE_ROCK_TOMB, MOVE_REST, MOVE_BELLY_DRUM} } }; -static const struct TrainerMonNoItemCustomMoves sParty_JohnAndJay3[] = { +static const struct TrainerMon sParty_JohnAndJay3[] = { { - .iv = 220, + .iv = TRAINER_PARTY_IVS(26, 26, 26, 26, 26, 26), .lvl = 46, .species = SPECIES_MEDICHAM, .moves = {MOVE_PSYCHIC, MOVE_FIRE_PUNCH, MOVE_PSYCH_UP, MOVE_PROTECT} }, { - .iv = 220, + .iv = TRAINER_PARTY_IVS(26, 26, 26, 26, 26, 26), .lvl = 46, .species = SPECIES_HARIYAMA, .moves = {MOVE_FOCUS_PUNCH, MOVE_ROCK_TOMB, MOVE_REST, MOVE_BELLY_DRUM} } }; -static const struct TrainerMonNoItemCustomMoves sParty_JohnAndJay4[] = { +static const struct TrainerMon sParty_JohnAndJay4[] = { { - .iv = 230, + .iv = TRAINER_PARTY_IVS(27, 27, 27, 27, 27, 27), .lvl = 49, .species = SPECIES_MEDICHAM, .moves = {MOVE_PSYCHIC, MOVE_FIRE_PUNCH, MOVE_PSYCH_UP, MOVE_PROTECT} }, { - .iv = 230, + .iv = TRAINER_PARTY_IVS(27, 27, 27, 27, 27, 27), .lvl = 49, .species = SPECIES_HARIYAMA, .moves = {MOVE_FOCUS_PUNCH, MOVE_ROCK_TOMB, MOVE_REST, MOVE_BELLY_DRUM} } }; -static const struct TrainerMonNoItemCustomMoves sParty_JohnAndJay5[] = { +static const struct TrainerMon sParty_JohnAndJay5[] = { { - .iv = 240, + .iv = TRAINER_PARTY_IVS(29, 29, 29, 29, 29, 29), .lvl = 52, .species = SPECIES_MEDICHAM, .moves = {MOVE_PSYCHIC, MOVE_FIRE_PUNCH, MOVE_PSYCH_UP, MOVE_PROTECT} }, { - .iv = 240, + .iv = TRAINER_PARTY_IVS(29, 29, 29, 29, 29, 29), .lvl = 52, .species = SPECIES_HARIYAMA, .moves = {MOVE_FOCUS_PUNCH, MOVE_ROCK_TOMB, MOVE_REST, MOVE_BELLY_DRUM} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_ReliAndIan[] = { +static const struct TrainerMon sParty_ReliAndIan[] = { { - .iv = 0, .lvl = 35, .species = SPECIES_AZUMARILL, }, { - .iv = 0, .lvl = 33, .species = SPECIES_WINGULL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_LilaAndRoy1[] = { +static const struct TrainerMon sParty_LilaAndRoy1[] = { { - .iv = 0, .lvl = 34, .species = SPECIES_CHINCHOU, }, { - .iv = 0, .lvl = 33, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_LilaAndRoy2[] = { +static const struct TrainerMon sParty_LilaAndRoy2[] = { { - .iv = 0, .lvl = 42, .species = SPECIES_CHINCHOU, }, { - .iv = 0, .lvl = 40, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_LilaAndRoy3[] = { +static const struct TrainerMon sParty_LilaAndRoy3[] = { { - .iv = 0, .lvl = 45, .species = SPECIES_LANTURN, }, { - .iv = 0, .lvl = 43, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_LilaAndRoy4[] = { +static const struct TrainerMon sParty_LilaAndRoy4[] = { { - .iv = 0, .lvl = 48, .species = SPECIES_LANTURN, }, { - .iv = 0, .lvl = 46, .species = SPECIES_SHARPEDO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_LilaAndRoy5[] = { +static const struct TrainerMon sParty_LilaAndRoy5[] = { { - .iv = 0, .lvl = 51, .species = SPECIES_LANTURN, }, { - .iv = 0, .lvl = 49, .species = SPECIES_SHARPEDO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_LisaAndRay[] = { +static const struct TrainerMon sParty_LisaAndRay[] = { { - .iv = 0, .lvl = 27, .species = SPECIES_GOLDEEN, }, { - .iv = 0, .lvl = 25, .species = SPECIES_TENTACOOL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Chris[] = { +static const struct TrainerMon sParty_Chris[] = { { - .iv = 0, .lvl = 29, .species = SPECIES_MAGIKARP, }, { - .iv = 0, .lvl = 20, .species = SPECIES_TENTACOOL, }, { - .iv = 0, .lvl = 26, .species = SPECIES_FEEBAS, }, { - .iv = 0, .lvl = 23, .species = SPECIES_CARVANHA, } }; -static const struct TrainerMonItemDefaultMoves sParty_Dawson[] = { +static const struct TrainerMon sParty_Dawson[] = { { - .iv = 0, .lvl = 8, .species = SPECIES_ZIGZAGOON, .heldItem = ITEM_NUGGET }, { - .iv = 0, .lvl = 8, .species = SPECIES_POOCHYENA, .heldItem = ITEM_NONE } }; -static const struct TrainerMonItemDefaultMoves sParty_Sarah[] = { +static const struct TrainerMon sParty_Sarah[] = { { - .iv = 0, .lvl = 8, .species = SPECIES_LOTAD, .heldItem = ITEM_NONE }, { - .iv = 0, .lvl = 8, .species = SPECIES_ZIGZAGOON, .heldItem = ITEM_NUGGET } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Darian[] = { +static const struct TrainerMon sParty_Darian[] = { { - .iv = 0, .lvl = 9, .species = SPECIES_MAGIKARP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Hailey[] = { +static const struct TrainerMon sParty_Hailey[] = { { - .iv = 0, .lvl = 13, .species = SPECIES_MARILL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Chandler[] = { +static const struct TrainerMon sParty_Chandler[] = { { - .iv = 0, .lvl = 12, .species = SPECIES_TENTACOOL, }, { - .iv = 0, .lvl = 12, .species = SPECIES_TENTACOOL, } }; -static const struct TrainerMonItemDefaultMoves sParty_Kaleb[] = { +static const struct TrainerMon sParty_Kaleb[] = { { - .iv = 0, .lvl = 14, .species = SPECIES_MINUN, .heldItem = ITEM_ORAN_BERRY }, { - .iv = 0, .lvl = 14, .species = SPECIES_PLUSLE, .heldItem = ITEM_ORAN_BERRY } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Joseph[] = { +static const struct TrainerMon sParty_Joseph[] = { { - .iv = 0, .lvl = 14, .species = SPECIES_ELECTRIKE, }, { - .iv = 0, .lvl = 14, .species = SPECIES_VOLTORB, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Alyssa[] = { +static const struct TrainerMon sParty_Alyssa[] = { { - .iv = 0, .lvl = 15, .species = SPECIES_MAGNEMITE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Marcos[] = { +static const struct TrainerMon sParty_Marcos[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 15, .species = SPECIES_VOLTORB, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Rhett[] = { +static const struct TrainerMon sParty_Rhett[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 15, .species = SPECIES_MAKUHITA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Tyron[] = { +static const struct TrainerMon sParty_Tyron[] = { { - .iv = 0, .lvl = 19, .species = SPECIES_SANDSHREW, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Celina[] = { +static const struct TrainerMon sParty_Celina[] = { { - .iv = 0, .lvl = 18, .species = SPECIES_ROSELIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Bianca[] = { +static const struct TrainerMon sParty_Bianca[] = { { - .iv = 0, .lvl = 18, .species = SPECIES_SHROOMISH, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Hayden[] = { +static const struct TrainerMon sParty_Hayden[] = { { - .iv = 0, .lvl = 18, .species = SPECIES_NUMEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Sophie[] = { +static const struct TrainerMon sParty_Sophie[] = { { - .iv = 0, .lvl = 17, .species = SPECIES_MARILL, }, { - .iv = 0, .lvl = 19, .species = SPECIES_LOMBRE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Coby[] = { +static const struct TrainerMon sParty_Coby[] = { { - .iv = 0, .lvl = 17, .species = SPECIES_SKARMORY, }, { - .iv = 0, .lvl = 19, .species = SPECIES_SWELLOW, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Lawrence[] = { +static const struct TrainerMon sParty_Lawrence[] = { { - .iv = 0, .lvl = 18, .species = SPECIES_BALTOY, }, { - .iv = 0, .lvl = 18, .species = SPECIES_SANDSHREW, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Wyatt[] = { +static const struct TrainerMon sParty_Wyatt[] = { { - .iv = 0, .lvl = 18, .species = SPECIES_ARON, }, { - .iv = 0, .lvl = 18, .species = SPECIES_ARON, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Angelina[] = { +static const struct TrainerMon sParty_Angelina[] = { { - .iv = 0, .lvl = 18, .species = SPECIES_LOMBRE, }, { - .iv = 0, .lvl = 18, .species = SPECIES_MARILL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Kai[] = { +static const struct TrainerMon sParty_Kai[] = { { - .iv = 0, .lvl = 19, .species = SPECIES_BARBOACH, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Charlotte[] = { +static const struct TrainerMon sParty_Charlotte[] = { { - .iv = 0, .lvl = 19, .species = SPECIES_NUZLEAF, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Deandre[] = { +static const struct TrainerMon sParty_Deandre[] = { { - .iv = 0, .lvl = 14, .species = SPECIES_ZIGZAGOON, }, { - .iv = 0, .lvl = 14, .species = SPECIES_ARON, }, { - .iv = 0, .lvl = 14, .species = SPECIES_ELECTRIKE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMagmaHideout1[] = { +static const struct TrainerMon sParty_GruntMagmaHideout1[] = { { - .iv = 0, .lvl = 29, .species = SPECIES_ZUBAT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMagmaHideout2[] = { +static const struct TrainerMon sParty_GruntMagmaHideout2[] = { { - .iv = 0, .lvl = 29, .species = SPECIES_POOCHYENA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMagmaHideout3[] = { +static const struct TrainerMon sParty_GruntMagmaHideout3[] = { { - .iv = 0, .lvl = 29, .species = SPECIES_NUMEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMagmaHideout4[] = { +static const struct TrainerMon sParty_GruntMagmaHideout4[] = { { - .iv = 0, .lvl = 28, .species = SPECIES_BALTOY, }, { - .iv = 0, .lvl = 28, .species = SPECIES_ZUBAT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMagmaHideout5[] = { +static const struct TrainerMon sParty_GruntMagmaHideout5[] = { { - .iv = 0, .lvl = 28, .species = SPECIES_BALTOY, }, { - .iv = 0, .lvl = 28, .species = SPECIES_NUMEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMagmaHideout6[] = { +static const struct TrainerMon sParty_GruntMagmaHideout6[] = { { - .iv = 0, .lvl = 29, .species = SPECIES_MIGHTYENA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMagmaHideout7[] = { +static const struct TrainerMon sParty_GruntMagmaHideout7[] = { { - .iv = 0, .lvl = 29, .species = SPECIES_ZUBAT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMagmaHideout8[] = { +static const struct TrainerMon sParty_GruntMagmaHideout8[] = { { - .iv = 0, .lvl = 29, .species = SPECIES_POOCHYENA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMagmaHideout9[] = { +static const struct TrainerMon sParty_GruntMagmaHideout9[] = { { - .iv = 0, .lvl = 29, .species = SPECIES_ZUBAT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMagmaHideout10[] = { +static const struct TrainerMon sParty_GruntMagmaHideout10[] = { { - .iv = 0, .lvl = 29, .species = SPECIES_MIGHTYENA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMagmaHideout11[] = { +static const struct TrainerMon sParty_GruntMagmaHideout11[] = { { - .iv = 0, .lvl = 29, .species = SPECIES_BALTOY, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMagmaHideout12[] = { +static const struct TrainerMon sParty_GruntMagmaHideout12[] = { { - .iv = 0, .lvl = 29, .species = SPECIES_NUMEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMagmaHideout13[] = { +static const struct TrainerMon sParty_GruntMagmaHideout13[] = { { - .iv = 0, .lvl = 29, .species = SPECIES_ZUBAT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMagmaHideout14[] = { +static const struct TrainerMon sParty_GruntMagmaHideout14[] = { { - .iv = 0, .lvl = 29, .species = SPECIES_MIGHTYENA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMagmaHideout15[] = { +static const struct TrainerMon sParty_GruntMagmaHideout15[] = { { - .iv = 0, .lvl = 29, .species = SPECIES_NUMEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_GruntMagmaHideout16[] = { +static const struct TrainerMon sParty_GruntMagmaHideout16[] = { { - .iv = 0, .lvl = 29, .species = SPECIES_BALTOY, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_TabithaMagmaHideout[] = { +static const struct TrainerMon sParty_TabithaMagmaHideout[] = { { - .iv = 75, + .iv = TRAINER_PARTY_IVS(9, 9, 9, 9, 9, 9), .lvl = 26, .species = SPECIES_NUMEL, }, { - .iv = 75, + .iv = TRAINER_PARTY_IVS(9, 9, 9, 9, 9, 9), .lvl = 28, .species = SPECIES_MIGHTYENA, }, { - .iv = 75, + .iv = TRAINER_PARTY_IVS(9, 9, 9, 9, 9, 9), .lvl = 30, .species = SPECIES_ZUBAT, }, { - .iv = 75, + .iv = TRAINER_PARTY_IVS(9, 9, 9, 9, 9, 9), .lvl = 33, .species = SPECIES_CAMERUPT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Darcy[] = { +static const struct TrainerMon sParty_Darcy[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_PELIPPER, }, { - .iv = 0, .lvl = 33, .species = SPECIES_CAMERUPT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_MaxieMossdeep[] = { +static const struct TrainerMon sParty_MaxieMossdeep[] = { { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 42, .species = SPECIES_MIGHTYENA, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 43, .species = SPECIES_CROBAT, }, { - .iv = 150, + .iv = TRAINER_PARTY_IVS(18, 18, 18, 18, 18, 18), .lvl = 44, .species = SPECIES_CAMERUPT, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Pete[] = { +static const struct TrainerMon sParty_Pete[] = { { - .iv = 0, .lvl = 15, .species = SPECIES_TENTACOOL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Isabelle[] = { +static const struct TrainerMon sParty_Isabelle[] = { { - .iv = 0, .lvl = 15, .species = SPECIES_MARILL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Andres1[] = { +static const struct TrainerMon sParty_Andres1[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 25, .species = SPECIES_SANDSHREW, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 25, .species = SPECIES_SANDSHREW, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Josue[] = { +static const struct TrainerMon sParty_Josue[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 25, .species = SPECIES_TAILLOW, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 25, .species = SPECIES_WINGULL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Camron[] = { +static const struct TrainerMon sParty_Camron[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_STARYU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cory1[] = { +static const struct TrainerMon sParty_Cory1[] = { { - .iv = 0, .lvl = 24, .species = SPECIES_WINGULL, }, { - .iv = 0, .lvl = 24, .species = SPECIES_MACHOP, }, { - .iv = 0, .lvl = 24, .species = SPECIES_TENTACOOL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Carolina[] = { +static const struct TrainerMon sParty_Carolina[] = { { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 24, .species = SPECIES_MANECTRIC, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 24, .species = SPECIES_SWELLOW, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 24, .species = SPECIES_MANECTRIC, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Elijah[] = { +static const struct TrainerMon sParty_Elijah[] = { { - .iv = 0, .lvl = 25, .species = SPECIES_SKARMORY, }, { - .iv = 0, .lvl = 25, .species = SPECIES_SKARMORY, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Celia[] = { +static const struct TrainerMon sParty_Celia[] = { { - .iv = 0, .lvl = 22, .species = SPECIES_MARILL, }, { - .iv = 0, .lvl = 22, .species = SPECIES_LOMBRE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Bryan[] = { +static const struct TrainerMon sParty_Bryan[] = { { - .iv = 0, .lvl = 22, .species = SPECIES_SANDSHREW, }, { - .iv = 0, .lvl = 22, .species = SPECIES_SANDSLASH, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Branden[] = { +static const struct TrainerMon sParty_Branden[] = { { - .iv = 0, .lvl = 22, .species = SPECIES_TAILLOW, }, { - .iv = 0, .lvl = 22, .species = SPECIES_NUZLEAF, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Bryant[] = { +static const struct TrainerMon sParty_Bryant[] = { { - .iv = 0, .lvl = 18, .species = SPECIES_NUMEL, }, { - .iv = 0, .lvl = 18, .species = SPECIES_SLUGMA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Shayla[] = { +static const struct TrainerMon sParty_Shayla[] = { { - .iv = 0, .lvl = 18, .species = SPECIES_SHROOMISH, }, { - .iv = 0, .lvl = 18, .species = SPECIES_ROSELIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Kyra[] = { +static const struct TrainerMon sParty_Kyra[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_DODUO, }, { - .iv = 0, .lvl = 26, .species = SPECIES_DODRIO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Jaiden[] = { +static const struct TrainerMon sParty_Jaiden[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_NINJASK, }, { - .iv = 0, .lvl = 26, .species = SPECIES_GULPIN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Alix[] = { +static const struct TrainerMon sParty_Alix[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_KADABRA, }, { - .iv = 0, .lvl = 26, .species = SPECIES_KIRLIA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Helene[] = { +static const struct TrainerMon sParty_Helene[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_MEDITITE, }, { - .iv = 0, .lvl = 26, .species = SPECIES_MAKUHITA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Marlene[] = { +static const struct TrainerMon sParty_Marlene[] = { { - .iv = 0, .lvl = 18, .species = SPECIES_MEDITITE, }, { - .iv = 0, .lvl = 18, .species = SPECIES_SPOINK, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Devan[] = { +static const struct TrainerMon sParty_Devan[] = { { - .iv = 0, .lvl = 8, .species = SPECIES_GEODUDE, }, { - .iv = 0, .lvl = 8, .species = SPECIES_GEODUDE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Johnson[] = { +static const struct TrainerMon sParty_Johnson[] = { { - .iv = 0, .lvl = 8, .species = SPECIES_SHROOMISH, }, { - .iv = 0, .lvl = 8, .species = SPECIES_LOTAD, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Melina[] = { +static const struct TrainerMon sParty_Melina[] = { { - .iv = 0, .lvl = 17, .species = SPECIES_DODUO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Brandi[] = { +static const struct TrainerMon sParty_Brandi[] = { { - .iv = 0, .lvl = 17, .species = SPECIES_RALTS, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Aisha[] = { +static const struct TrainerMon sParty_Aisha[] = { { - .iv = 0, .lvl = 17, .species = SPECIES_MEDITITE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Makayla[] = { +static const struct TrainerMon sParty_Makayla[] = { { - .iv = 0, .lvl = 33, .species = SPECIES_ROSELIA, }, { - .iv = 0, .lvl = 33, .species = SPECIES_MEDICHAM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Fabian[] = { +static const struct TrainerMon sParty_Fabian[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_MANECTRIC, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Dayton[] = { +static const struct TrainerMon sParty_Dayton[] = { { - .iv = 0, .lvl = 25, .species = SPECIES_SLUGMA, }, { - .iv = 0, .lvl = 25, .species = SPECIES_NUMEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Rachel[] = { +static const struct TrainerMon sParty_Rachel[] = { { - .iv = 0, .lvl = 26, .species = SPECIES_GOLDEEN, } }; -static const struct TrainerMonNoItemCustomMoves sParty_Leonel[] = { +static const struct TrainerMon sParty_Leonel[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 30, .species = SPECIES_MANECTRIC, .moves = {MOVE_THUNDER, MOVE_QUICK_ATTACK, MOVE_THUNDER_WAVE, MOVE_NONE} } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Callie[] = { +static const struct TrainerMon sParty_Callie[] = { { - .iv = 0, .lvl = 28, .species = SPECIES_MEDITITE, }, { - .iv = 0, .lvl = 28, .species = SPECIES_MAKUHITA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cale[] = { +static const struct TrainerMon sParty_Cale[] = { { - .iv = 0, .lvl = 29, .species = SPECIES_DUSTOX, }, { - .iv = 0, .lvl = 29, .species = SPECIES_BEAUTIFLY, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Myles[] = { +static const struct TrainerMon sParty_Myles[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 25, .species = SPECIES_MAKUHITA, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 25, .species = SPECIES_WINGULL, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 25, .species = SPECIES_TROPIUS, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 25, .species = SPECIES_ZIGZAGOON, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 25, .species = SPECIES_ELECTRIKE, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 25, .species = SPECIES_NUMEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Pat[] = { +static const struct TrainerMon sParty_Pat[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 25, .species = SPECIES_POOCHYENA, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 25, .species = SPECIES_SHROOMISH, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 25, .species = SPECIES_ELECTRIKE, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 25, .species = SPECIES_MARILL, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 25, .species = SPECIES_SANDSHREW, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 25, .species = SPECIES_GULPIN, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cristin1[] = { +static const struct TrainerMon sParty_Cristin1[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 29, .species = SPECIES_LOUDRED, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 29, .species = SPECIES_VIGOROTH, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_MayRustboroTreecko[] = { +static const struct TrainerMon sParty_MayRustboroTreecko[] = { { - .iv = 25, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 13, .species = SPECIES_LOTAD, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 15, .species = SPECIES_TORCHIC, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_MayRustboroTorchic[] = { +static const struct TrainerMon sParty_MayRustboroTorchic[] = { { - .iv = 25, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 13, .species = SPECIES_TORKOAL, }, { - .iv = 50, + .iv = TRAINER_PARTY_IVS(6, 6, 6, 6, 6, 6), .lvl = 15, .species = SPECIES_MUDKIP, } }; -static const struct TrainerMonItemCustomMoves sParty_Roxanne2[] = { +static const struct TrainerMon sParty_Roxanne2[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 32, .species = SPECIES_GOLEM, .heldItem = ITEM_NONE, .moves = {MOVE_PROTECT, MOVE_ROLLOUT, MOVE_MAGNITUDE, MOVE_EXPLOSION} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 35, .species = SPECIES_KABUTO, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_SWORDS_DANCE, MOVE_ICE_BEAM, MOVE_SURF, MOVE_ROCK_SLIDE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 35, .species = SPECIES_ONIX, .heldItem = ITEM_NONE, .moves = {MOVE_IRON_TAIL, MOVE_EXPLOSION, MOVE_ROAR, MOVE_ROCK_SLIDE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 37, .species = SPECIES_NOSEPASS, .heldItem = ITEM_SITRUS_BERRY, @@ -10329,37 +9714,37 @@ static const struct TrainerMonItemCustomMoves sParty_Roxanne2[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Roxanne3[] = { +static const struct TrainerMon sParty_Roxanne3[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 37, .species = SPECIES_OMANYTE, .heldItem = ITEM_NONE, .moves = {MOVE_PROTECT, MOVE_ICE_BEAM, MOVE_ROCK_SLIDE, MOVE_SURF} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 37, .species = SPECIES_GOLEM, .heldItem = ITEM_NONE, .moves = {MOVE_PROTECT, MOVE_ROLLOUT, MOVE_MAGNITUDE, MOVE_EXPLOSION} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 40, .species = SPECIES_KABUTOPS, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_SWORDS_DANCE, MOVE_ICE_BEAM, MOVE_SURF, MOVE_ROCK_SLIDE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 40, .species = SPECIES_ONIX, .heldItem = ITEM_NONE, .moves = {MOVE_IRON_TAIL, MOVE_EXPLOSION, MOVE_ROAR, MOVE_ROCK_SLIDE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 42, .species = SPECIES_NOSEPASS, .heldItem = ITEM_SITRUS_BERRY, @@ -10367,37 +9752,37 @@ static const struct TrainerMonItemCustomMoves sParty_Roxanne3[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Roxanne4[] = { +static const struct TrainerMon sParty_Roxanne4[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 42, .species = SPECIES_OMASTAR, .heldItem = ITEM_NONE, .moves = {MOVE_PROTECT, MOVE_ICE_BEAM, MOVE_ROCK_SLIDE, MOVE_SURF} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 42, .species = SPECIES_GOLEM, .heldItem = ITEM_NONE, .moves = {MOVE_PROTECT, MOVE_ROLLOUT, MOVE_EARTHQUAKE, MOVE_EXPLOSION} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 45, .species = SPECIES_KABUTOPS, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_SWORDS_DANCE, MOVE_ICE_BEAM, MOVE_SURF, MOVE_ROCK_SLIDE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 45, .species = SPECIES_ONIX, .heldItem = ITEM_NONE, .moves = {MOVE_IRON_TAIL, MOVE_EXPLOSION, MOVE_ROAR, MOVE_ROCK_SLIDE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 47, .species = SPECIES_NOSEPASS, .heldItem = ITEM_SITRUS_BERRY, @@ -10405,44 +9790,44 @@ static const struct TrainerMonItemCustomMoves sParty_Roxanne4[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Roxanne5[] = { +static const struct TrainerMon sParty_Roxanne5[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 47, .species = SPECIES_AERODACTYL, .heldItem = ITEM_NONE, .moves = {MOVE_ROCK_SLIDE, MOVE_HYPER_BEAM, MOVE_SUPERSONIC, MOVE_PROTECT} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 47, .species = SPECIES_GOLEM, .heldItem = ITEM_NONE, .moves = {MOVE_FOCUS_PUNCH, MOVE_ROLLOUT, MOVE_EARTHQUAKE, MOVE_EXPLOSION} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 47, .species = SPECIES_OMASTAR, .heldItem = ITEM_NONE, .moves = {MOVE_PROTECT, MOVE_ICE_BEAM, MOVE_ROCK_SLIDE, MOVE_SURF} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 50, .species = SPECIES_KABUTOPS, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_SWORDS_DANCE, MOVE_ICE_BEAM, MOVE_SURF, MOVE_ROCK_SLIDE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 50, .species = SPECIES_STEELIX, .heldItem = ITEM_NONE, .moves = {MOVE_IRON_TAIL, MOVE_EXPLOSION, MOVE_ROAR, MOVE_ROCK_SLIDE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 52, .species = SPECIES_NOSEPASS, .heldItem = ITEM_SITRUS_BERRY, @@ -10450,30 +9835,30 @@ static const struct TrainerMonItemCustomMoves sParty_Roxanne5[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Brawly2[] = { +static const struct TrainerMon sParty_Brawly2[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 33, .species = SPECIES_MACHAMP, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_KARATE_CHOP, MOVE_ROCK_SLIDE, MOVE_FOCUS_PUNCH, MOVE_BULK_UP} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 33, .species = SPECIES_MEDITITE, .heldItem = ITEM_NONE, .moves = {MOVE_PSYCHIC, MOVE_LIGHT_SCREEN, MOVE_REFLECT, MOVE_FOCUS_PUNCH} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 35, .species = SPECIES_HITMONTOP, .heldItem = ITEM_NONE, .moves = {MOVE_PURSUIT, MOVE_COUNTER, MOVE_PROTECT, MOVE_TRIPLE_KICK} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 37, .species = SPECIES_HARIYAMA, .heldItem = ITEM_SITRUS_BERRY, @@ -10481,30 +9866,30 @@ static const struct TrainerMonItemCustomMoves sParty_Brawly2[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Brawly3[] = { +static const struct TrainerMon sParty_Brawly3[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 38, .species = SPECIES_MACHAMP, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_KARATE_CHOP, MOVE_ROCK_SLIDE, MOVE_FOCUS_PUNCH, MOVE_BULK_UP} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 38, .species = SPECIES_MEDICHAM, .heldItem = ITEM_NONE, .moves = {MOVE_PSYCHIC, MOVE_LIGHT_SCREEN, MOVE_REFLECT, MOVE_FOCUS_PUNCH} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 40, .species = SPECIES_HITMONTOP, .heldItem = ITEM_NONE, .moves = {MOVE_PURSUIT, MOVE_COUNTER, MOVE_PROTECT, MOVE_TRIPLE_KICK} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 42, .species = SPECIES_HARIYAMA, .heldItem = ITEM_SITRUS_BERRY, @@ -10512,37 +9897,37 @@ static const struct TrainerMonItemCustomMoves sParty_Brawly3[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Brawly4[] = { +static const struct TrainerMon sParty_Brawly4[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 40, .species = SPECIES_HITMONCHAN, .heldItem = ITEM_NONE, .moves = {MOVE_SKY_UPPERCUT, MOVE_PROTECT, MOVE_FIRE_PUNCH, MOVE_ICE_PUNCH} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 43, .species = SPECIES_MACHAMP, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_KARATE_CHOP, MOVE_ROCK_SLIDE, MOVE_FOCUS_PUNCH, MOVE_BULK_UP} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 43, .species = SPECIES_MEDICHAM, .heldItem = ITEM_NONE, .moves = {MOVE_FOCUS_PUNCH, MOVE_LIGHT_SCREEN, MOVE_REFLECT, MOVE_PSYCHIC} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 45, .species = SPECIES_HITMONTOP, .heldItem = ITEM_NONE, .moves = {MOVE_PURSUIT, MOVE_COUNTER, MOVE_PROTECT, MOVE_TRIPLE_KICK} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 47, .species = SPECIES_HARIYAMA, .heldItem = ITEM_SITRUS_BERRY, @@ -10550,44 +9935,44 @@ static const struct TrainerMonItemCustomMoves sParty_Brawly4[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Brawly5[] = { +static const struct TrainerMon sParty_Brawly5[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 46, .species = SPECIES_HITMONLEE, .heldItem = ITEM_NONE, .moves = {MOVE_MEGA_KICK, MOVE_FOCUS_PUNCH, MOVE_EARTHQUAKE, MOVE_BULK_UP} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 46, .species = SPECIES_HITMONCHAN, .heldItem = ITEM_NONE, .moves = {MOVE_SKY_UPPERCUT, MOVE_PROTECT, MOVE_FIRE_PUNCH, MOVE_ICE_PUNCH} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 48, .species = SPECIES_MACHAMP, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_CROSS_CHOP, MOVE_ROCK_SLIDE, MOVE_FOCUS_PUNCH, MOVE_BULK_UP} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 48, .species = SPECIES_MEDICHAM, .heldItem = ITEM_NONE, .moves = {MOVE_FOCUS_PUNCH, MOVE_LIGHT_SCREEN, MOVE_REFLECT, MOVE_PSYCHIC} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 50, .species = SPECIES_HITMONTOP, .heldItem = ITEM_NONE, .moves = {MOVE_PURSUIT, MOVE_COUNTER, MOVE_PROTECT, MOVE_TRIPLE_KICK} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 52, .species = SPECIES_HARIYAMA, .heldItem = ITEM_SITRUS_BERRY, @@ -10595,30 +9980,30 @@ static const struct TrainerMonItemCustomMoves sParty_Brawly5[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Wattson2[] = { +static const struct TrainerMon sParty_Wattson2[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 36, .species = SPECIES_MAREEP, .heldItem = ITEM_NONE, .moves = {MOVE_THUNDER, MOVE_PROTECT, MOVE_THUNDER_WAVE, MOVE_LIGHT_SCREEN} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 36, .species = SPECIES_ELECTRODE, .heldItem = ITEM_NONE, .moves = {MOVE_ROLLOUT, MOVE_THUNDER, MOVE_EXPLOSION, MOVE_RAIN_DANCE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 38, .species = SPECIES_MAGNETON, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_SUPERSONIC, MOVE_PROTECT, MOVE_THUNDER, MOVE_RAIN_DANCE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 40, .species = SPECIES_MANECTRIC, .heldItem = ITEM_SITRUS_BERRY, @@ -10626,37 +10011,37 @@ static const struct TrainerMonItemCustomMoves sParty_Wattson2[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Wattson3[] = { +static const struct TrainerMon sParty_Wattson3[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 39, .species = SPECIES_PIKACHU, .heldItem = ITEM_NONE, .moves = {MOVE_THUNDER, MOVE_SLAM, MOVE_RAIN_DANCE, MOVE_SHOCK_WAVE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 41, .species = SPECIES_FLAAFFY, .heldItem = ITEM_NONE, .moves = {MOVE_THUNDER, MOVE_PROTECT, MOVE_THUNDER_WAVE, MOVE_LIGHT_SCREEN} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 41, .species = SPECIES_ELECTRODE, .heldItem = ITEM_NONE, .moves = {MOVE_ROLLOUT, MOVE_THUNDER, MOVE_EXPLOSION, MOVE_RAIN_DANCE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 43, .species = SPECIES_MAGNETON, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_SUPERSONIC, MOVE_PROTECT, MOVE_THUNDER, MOVE_RAIN_DANCE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 45, .species = SPECIES_MANECTRIC, .heldItem = ITEM_SITRUS_BERRY, @@ -10664,37 +10049,37 @@ static const struct TrainerMonItemCustomMoves sParty_Wattson3[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Wattson4[] = { +static const struct TrainerMon sParty_Wattson4[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 44, .species = SPECIES_RAICHU, .heldItem = ITEM_NONE, .moves = {MOVE_THUNDER, MOVE_SLAM, MOVE_RAIN_DANCE, MOVE_PROTECT} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 46, .species = SPECIES_AMPHAROS, .heldItem = ITEM_NONE, .moves = {MOVE_THUNDER, MOVE_PROTECT, MOVE_THUNDER_WAVE, MOVE_LIGHT_SCREEN} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 46, .species = SPECIES_ELECTRODE, .heldItem = ITEM_NONE, .moves = {MOVE_ROLLOUT, MOVE_THUNDER, MOVE_EXPLOSION, MOVE_RAIN_DANCE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 48, .species = SPECIES_MAGNETON, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_SUPERSONIC, MOVE_PROTECT, MOVE_THUNDER, MOVE_RAIN_DANCE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 50, .species = SPECIES_MANECTRIC, .heldItem = ITEM_SITRUS_BERRY, @@ -10702,44 +10087,44 @@ static const struct TrainerMonItemCustomMoves sParty_Wattson4[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Wattson5[] = { +static const struct TrainerMon sParty_Wattson5[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 50, .species = SPECIES_ELECTABUZZ, .heldItem = ITEM_NONE, .moves = {MOVE_SWIFT, MOVE_FOCUS_PUNCH, MOVE_THUNDER_PUNCH, MOVE_LIGHT_SCREEN} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 51, .species = SPECIES_RAICHU, .heldItem = ITEM_NONE, .moves = {MOVE_THUNDER, MOVE_SLAM, MOVE_RAIN_DANCE, MOVE_PROTECT} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 51, .species = SPECIES_AMPHAROS, .heldItem = ITEM_NONE, .moves = {MOVE_THUNDER, MOVE_PROTECT, MOVE_THUNDER_WAVE, MOVE_LIGHT_SCREEN} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 53, .species = SPECIES_ELECTRODE, .heldItem = ITEM_NONE, .moves = {MOVE_ROLLOUT, MOVE_THUNDER, MOVE_EXPLOSION, MOVE_RAIN_DANCE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 53, .species = SPECIES_MAGNETON, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_SUPERSONIC, MOVE_PROTECT, MOVE_THUNDER, MOVE_RAIN_DANCE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 55, .species = SPECIES_MANECTRIC, .heldItem = ITEM_SITRUS_BERRY, @@ -10747,30 +10132,30 @@ static const struct TrainerMonItemCustomMoves sParty_Wattson5[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Flannery2[] = { +static const struct TrainerMon sParty_Flannery2[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 38, .species = SPECIES_MAGCARGO, .heldItem = ITEM_WHITE_HERB, .moves = {MOVE_OVERHEAT, MOVE_ATTRACT, MOVE_LIGHT_SCREEN, MOVE_ROCK_SLIDE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 36, .species = SPECIES_PONYTA, .heldItem = ITEM_NONE, .moves = {MOVE_FLAMETHROWER, MOVE_ATTRACT, MOVE_SOLAR_BEAM, MOVE_BOUNCE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 38, .species = SPECIES_CAMERUPT, .heldItem = ITEM_WHITE_HERB, .moves = {MOVE_OVERHEAT, MOVE_SUNNY_DAY, MOVE_EARTHQUAKE, MOVE_ATTRACT} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 40, .species = SPECIES_TORKOAL, .heldItem = ITEM_WHITE_HERB, @@ -10778,37 +10163,37 @@ static const struct TrainerMonItemCustomMoves sParty_Flannery2[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Flannery3[] = { +static const struct TrainerMon sParty_Flannery3[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 41, .species = SPECIES_GROWLITHE, .heldItem = ITEM_NONE, .moves = {MOVE_HELPING_HAND, MOVE_FLAMETHROWER, MOVE_ROAR, MOVE_SUNNY_DAY} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 43, .species = SPECIES_MAGCARGO, .heldItem = ITEM_WHITE_HERB, .moves = {MOVE_OVERHEAT, MOVE_ATTRACT, MOVE_LIGHT_SCREEN, MOVE_ROCK_SLIDE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 41, .species = SPECIES_PONYTA, .heldItem = ITEM_NONE, .moves = {MOVE_FLAMETHROWER, MOVE_ATTRACT, MOVE_SOLAR_BEAM, MOVE_BOUNCE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 43, .species = SPECIES_CAMERUPT, .heldItem = ITEM_WHITE_HERB, .moves = {MOVE_OVERHEAT, MOVE_SUNNY_DAY, MOVE_EARTHQUAKE, MOVE_ATTRACT} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 45, .species = SPECIES_TORKOAL, .heldItem = ITEM_WHITE_HERB, @@ -10816,44 +10201,44 @@ static const struct TrainerMonItemCustomMoves sParty_Flannery3[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Flannery4[] = { +static const struct TrainerMon sParty_Flannery4[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 46, .species = SPECIES_HOUNDOUR, .heldItem = ITEM_NONE, .moves = {MOVE_ROAR, MOVE_SOLAR_BEAM, MOVE_TAUNT, MOVE_SUNNY_DAY} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 46, .species = SPECIES_GROWLITHE, .heldItem = ITEM_NONE, .moves = {MOVE_HELPING_HAND, MOVE_FLAMETHROWER, MOVE_SUNNY_DAY, MOVE_ROAR} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 48, .species = SPECIES_MAGCARGO, .heldItem = ITEM_WHITE_HERB, .moves = {MOVE_OVERHEAT, MOVE_ATTRACT, MOVE_LIGHT_SCREEN, MOVE_ROCK_SLIDE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 46, .species = SPECIES_RAPIDASH, .heldItem = ITEM_NONE, .moves = {MOVE_FLAMETHROWER, MOVE_ATTRACT, MOVE_SOLAR_BEAM, MOVE_BOUNCE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 48, .species = SPECIES_CAMERUPT, .heldItem = ITEM_WHITE_HERB, .moves = {MOVE_OVERHEAT, MOVE_SUNNY_DAY, MOVE_EARTHQUAKE, MOVE_ATTRACT} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 50, .species = SPECIES_TORKOAL, .heldItem = ITEM_WHITE_HERB, @@ -10861,44 +10246,44 @@ static const struct TrainerMonItemCustomMoves sParty_Flannery4[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Flannery5[] = { +static const struct TrainerMon sParty_Flannery5[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 51, .species = SPECIES_ARCANINE, .heldItem = ITEM_NONE, .moves = {MOVE_HELPING_HAND, MOVE_FLAMETHROWER, MOVE_SUNNY_DAY, MOVE_ROAR} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 53, .species = SPECIES_MAGCARGO, .heldItem = ITEM_WHITE_HERB, .moves = {MOVE_OVERHEAT, MOVE_ATTRACT, MOVE_LIGHT_SCREEN, MOVE_ROCK_SLIDE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 51, .species = SPECIES_HOUNDOOM, .heldItem = ITEM_NONE, .moves = {MOVE_ROAR, MOVE_SOLAR_BEAM, MOVE_TAUNT, MOVE_SUNNY_DAY} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 51, .species = SPECIES_RAPIDASH, .heldItem = ITEM_NONE, .moves = {MOVE_FLAMETHROWER, MOVE_ATTRACT, MOVE_SOLAR_BEAM, MOVE_BOUNCE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 53, .species = SPECIES_CAMERUPT, .heldItem = ITEM_WHITE_HERB, .moves = {MOVE_OVERHEAT, MOVE_SUNNY_DAY, MOVE_EARTHQUAKE, MOVE_ATTRACT} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 55, .species = SPECIES_TORKOAL, .heldItem = ITEM_WHITE_HERB, @@ -10906,30 +10291,30 @@ static const struct TrainerMonItemCustomMoves sParty_Flannery5[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Norman2[] = { +static const struct TrainerMon sParty_Norman2[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 42, .species = SPECIES_CHANSEY, .heldItem = ITEM_NONE, .moves = {MOVE_LIGHT_SCREEN, MOVE_SING, MOVE_SKILL_SWAP, MOVE_FOCUS_PUNCH} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 42, .species = SPECIES_SLAKING, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_BLIZZARD, MOVE_SHADOW_BALL, MOVE_DOUBLE_EDGE, MOVE_FIRE_BLAST} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 43, .species = SPECIES_SPINDA, .heldItem = ITEM_NONE, .moves = {MOVE_TEETER_DANCE, MOVE_SKILL_SWAP, MOVE_FACADE, MOVE_HYPNOSIS} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 45, .species = SPECIES_SLAKING, .heldItem = ITEM_SITRUS_BERRY, @@ -10937,37 +10322,37 @@ static const struct TrainerMonItemCustomMoves sParty_Norman2[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Norman3[] = { +static const struct TrainerMon sParty_Norman3[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 47, .species = SPECIES_SLAKING, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_BLIZZARD, MOVE_SHADOW_BALL, MOVE_DOUBLE_EDGE, MOVE_FIRE_BLAST} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 47, .species = SPECIES_CHANSEY, .heldItem = ITEM_NONE, .moves = {MOVE_LIGHT_SCREEN, MOVE_SING, MOVE_SKILL_SWAP, MOVE_FOCUS_PUNCH} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 45, .species = SPECIES_KANGASKHAN, .heldItem = ITEM_NONE, .moves = {MOVE_FAKE_OUT, MOVE_DIZZY_PUNCH, MOVE_ENDURE, MOVE_REVERSAL} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 48, .species = SPECIES_SPINDA, .heldItem = ITEM_NONE, .moves = {MOVE_TEETER_DANCE, MOVE_SKILL_SWAP, MOVE_FACADE, MOVE_HYPNOSIS} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 50, .species = SPECIES_SLAKING, .heldItem = ITEM_SITRUS_BERRY, @@ -10975,37 +10360,37 @@ static const struct TrainerMonItemCustomMoves sParty_Norman3[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Norman4[] = { +static const struct TrainerMon sParty_Norman4[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 52, .species = SPECIES_SLAKING, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_BLIZZARD, MOVE_SHADOW_BALL, MOVE_DOUBLE_EDGE, MOVE_FIRE_BLAST} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 52, .species = SPECIES_BLISSEY, .heldItem = ITEM_NONE, .moves = {MOVE_LIGHT_SCREEN, MOVE_SING, MOVE_SKILL_SWAP, MOVE_FOCUS_PUNCH} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 50, .species = SPECIES_KANGASKHAN, .heldItem = ITEM_NONE, .moves = {MOVE_FAKE_OUT, MOVE_DIZZY_PUNCH, MOVE_ENDURE, MOVE_REVERSAL} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 53, .species = SPECIES_SPINDA, .heldItem = ITEM_NONE, .moves = {MOVE_TEETER_DANCE, MOVE_SKILL_SWAP, MOVE_FACADE, MOVE_HYPNOSIS} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 55, .species = SPECIES_SLAKING, .heldItem = ITEM_SITRUS_BERRY, @@ -11013,44 +10398,44 @@ static const struct TrainerMonItemCustomMoves sParty_Norman4[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Norman5[] = { +static const struct TrainerMon sParty_Norman5[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 57, .species = SPECIES_SLAKING, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_BLIZZARD, MOVE_SHADOW_BALL, MOVE_DOUBLE_EDGE, MOVE_FIRE_BLAST} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 57, .species = SPECIES_BLISSEY, .heldItem = ITEM_NONE, .moves = {MOVE_PROTECT, MOVE_SING, MOVE_SKILL_SWAP, MOVE_FOCUS_PUNCH} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 55, .species = SPECIES_KANGASKHAN, .heldItem = ITEM_NONE, .moves = {MOVE_FAKE_OUT, MOVE_DIZZY_PUNCH, MOVE_ENDURE, MOVE_REVERSAL} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 57, .species = SPECIES_TAUROS, .heldItem = ITEM_NONE, .moves = {MOVE_TAKE_DOWN, MOVE_PROTECT, MOVE_FIRE_BLAST, MOVE_EARTHQUAKE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 58, .species = SPECIES_SPINDA, .heldItem = ITEM_NONE, .moves = {MOVE_TEETER_DANCE, MOVE_SKILL_SWAP, MOVE_FACADE, MOVE_HYPNOSIS} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 60, .species = SPECIES_SLAKING, .heldItem = ITEM_SITRUS_BERRY, @@ -11058,37 +10443,37 @@ static const struct TrainerMonItemCustomMoves sParty_Norman5[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Winona2[] = { +static const struct TrainerMon sParty_Winona2[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 40, .species = SPECIES_DRATINI, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_THUNDER_WAVE, MOVE_THUNDERBOLT, MOVE_PROTECT, MOVE_ICE_BEAM} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 38, .species = SPECIES_TROPIUS, .heldItem = ITEM_NONE, .moves = {MOVE_SUNNY_DAY, MOVE_AERIAL_ACE, MOVE_SOLAR_BEAM, MOVE_EARTHQUAKE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 41, .species = SPECIES_PELIPPER, .heldItem = ITEM_NONE, .moves = {MOVE_SURF, MOVE_SUPERSONIC, MOVE_PROTECT, MOVE_AERIAL_ACE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 43, .species = SPECIES_SKARMORY, .heldItem = ITEM_NONE, .moves = {MOVE_WHIRLWIND, MOVE_SPIKES, MOVE_STEEL_WING, MOVE_AERIAL_ACE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 45, .species = SPECIES_ALTARIA, .heldItem = ITEM_CHESTO_BERRY, @@ -11096,44 +10481,44 @@ static const struct TrainerMonItemCustomMoves sParty_Winona2[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Winona3[] = { +static const struct TrainerMon sParty_Winona3[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 43, .species = SPECIES_HOOTHOOT, .heldItem = ITEM_NONE, .moves = {MOVE_HYPNOSIS, MOVE_PSYCHIC, MOVE_REFLECT, MOVE_DREAM_EATER} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 43, .species = SPECIES_TROPIUS, .heldItem = ITEM_NONE, .moves = {MOVE_SUNNY_DAY, MOVE_AERIAL_ACE, MOVE_SOLAR_BEAM, MOVE_EARTHQUAKE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 45, .species = SPECIES_DRAGONAIR, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_THUNDER_WAVE, MOVE_THUNDERBOLT, MOVE_PROTECT, MOVE_ICE_BEAM} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 46, .species = SPECIES_PELIPPER, .heldItem = ITEM_NONE, .moves = {MOVE_SURF, MOVE_SUPERSONIC, MOVE_PROTECT, MOVE_AERIAL_ACE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 48, .species = SPECIES_SKARMORY, .heldItem = ITEM_NONE, .moves = {MOVE_WHIRLWIND, MOVE_SPIKES, MOVE_STEEL_WING, MOVE_AERIAL_ACE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 50, .species = SPECIES_ALTARIA, .heldItem = ITEM_CHESTO_BERRY, @@ -11141,44 +10526,44 @@ static const struct TrainerMonItemCustomMoves sParty_Winona3[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Winona4[] = { +static const struct TrainerMon sParty_Winona4[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 48, .species = SPECIES_NOCTOWL, .heldItem = ITEM_NONE, .moves = {MOVE_HYPNOSIS, MOVE_PSYCHIC, MOVE_REFLECT, MOVE_DREAM_EATER} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 49, .species = SPECIES_TROPIUS, .heldItem = ITEM_NONE, .moves = {MOVE_SUNNY_DAY, MOVE_AERIAL_ACE, MOVE_SOLAR_BEAM, MOVE_EARTHQUAKE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 50, .species = SPECIES_DRAGONAIR, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_THUNDER_WAVE, MOVE_THUNDERBOLT, MOVE_PROTECT, MOVE_ICE_BEAM} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 51, .species = SPECIES_PELIPPER, .heldItem = ITEM_NONE, .moves = {MOVE_SURF, MOVE_SUPERSONIC, MOVE_PROTECT, MOVE_AERIAL_ACE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 53, .species = SPECIES_SKARMORY, .heldItem = ITEM_NONE, .moves = {MOVE_WHIRLWIND, MOVE_SPIKES, MOVE_STEEL_WING, MOVE_AERIAL_ACE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 55, .species = SPECIES_ALTARIA, .heldItem = ITEM_CHESTO_BERRY, @@ -11186,44 +10571,44 @@ static const struct TrainerMonItemCustomMoves sParty_Winona4[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Winona5[] = { +static const struct TrainerMon sParty_Winona5[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 53, .species = SPECIES_NOCTOWL, .heldItem = ITEM_NONE, .moves = {MOVE_HYPNOSIS, MOVE_PSYCHIC, MOVE_REFLECT, MOVE_DREAM_EATER} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 54, .species = SPECIES_TROPIUS, .heldItem = ITEM_NONE, .moves = {MOVE_SUNNY_DAY, MOVE_AERIAL_ACE, MOVE_SOLAR_BEAM, MOVE_EARTHQUAKE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 55, .species = SPECIES_PELIPPER, .heldItem = ITEM_NONE, .moves = {MOVE_SURF, MOVE_SUPERSONIC, MOVE_PROTECT, MOVE_AERIAL_ACE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 55, .species = SPECIES_DRAGONITE, .heldItem = ITEM_SITRUS_BERRY, .moves = {MOVE_HYPER_BEAM, MOVE_THUNDERBOLT, MOVE_EARTHQUAKE, MOVE_ICE_BEAM} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 58, .species = SPECIES_SKARMORY, .heldItem = ITEM_NONE, .moves = {MOVE_WHIRLWIND, MOVE_SPIKES, MOVE_STEEL_WING, MOVE_AERIAL_ACE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 60, .species = SPECIES_ALTARIA, .heldItem = ITEM_CHESTO_BERRY, @@ -11231,37 +10616,37 @@ static const struct TrainerMonItemCustomMoves sParty_Winona5[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_TateAndLiza2[] = { +static const struct TrainerMon sParty_TateAndLiza2[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 48, .species = SPECIES_SLOWPOKE, .heldItem = ITEM_NONE, .moves = {MOVE_YAWN, MOVE_PSYCHIC, MOVE_CALM_MIND, MOVE_PROTECT} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 49, .species = SPECIES_CLAYDOL, .heldItem = ITEM_NONE, .moves = {MOVE_EARTHQUAKE, MOVE_ANCIENT_POWER, MOVE_PSYCHIC, MOVE_LIGHT_SCREEN} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 49, .species = SPECIES_XATU, .heldItem = ITEM_CHESTO_BERRY, .moves = {MOVE_PSYCHIC, MOVE_REST, MOVE_CONFUSE_RAY, MOVE_CALM_MIND} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 50, .species = SPECIES_LUNATONE, .heldItem = ITEM_CHESTO_BERRY, .moves = {MOVE_EARTHQUAKE, MOVE_PSYCHIC, MOVE_REST, MOVE_CALM_MIND} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 50, .species = SPECIES_SOLROCK, .heldItem = ITEM_SITRUS_BERRY, @@ -11269,44 +10654,44 @@ static const struct TrainerMonItemCustomMoves sParty_TateAndLiza2[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_TateAndLiza3[] = { +static const struct TrainerMon sParty_TateAndLiza3[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 53, .species = SPECIES_DROWZEE, .heldItem = ITEM_NONE, .moves = {MOVE_HYPNOSIS, MOVE_DREAM_EATER, MOVE_HEADBUTT, MOVE_PROTECT} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 53, .species = SPECIES_SLOWPOKE, .heldItem = ITEM_NONE, .moves = {MOVE_YAWN, MOVE_PSYCHIC, MOVE_CALM_MIND, MOVE_PROTECT} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 54, .species = SPECIES_CLAYDOL, .heldItem = ITEM_NONE, .moves = {MOVE_EARTHQUAKE, MOVE_EXPLOSION, MOVE_PSYCHIC, MOVE_LIGHT_SCREEN} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 54, .species = SPECIES_XATU, .heldItem = ITEM_CHESTO_BERRY, .moves = {MOVE_PSYCHIC, MOVE_REST, MOVE_CONFUSE_RAY, MOVE_CALM_MIND} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 55, .species = SPECIES_LUNATONE, .heldItem = ITEM_CHESTO_BERRY, .moves = {MOVE_EARTHQUAKE, MOVE_PSYCHIC, MOVE_REST, MOVE_CALM_MIND} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 55, .species = SPECIES_SOLROCK, .heldItem = ITEM_SITRUS_BERRY, @@ -11314,44 +10699,44 @@ static const struct TrainerMonItemCustomMoves sParty_TateAndLiza3[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_TateAndLiza4[] = { +static const struct TrainerMon sParty_TateAndLiza4[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 58, .species = SPECIES_HYPNO, .heldItem = ITEM_NONE, .moves = {MOVE_HYPNOSIS, MOVE_DREAM_EATER, MOVE_HEADBUTT, MOVE_PROTECT} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 59, .species = SPECIES_CLAYDOL, .heldItem = ITEM_NONE, .moves = {MOVE_EARTHQUAKE, MOVE_EXPLOSION, MOVE_PSYCHIC, MOVE_LIGHT_SCREEN} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 58, .species = SPECIES_SLOWPOKE, .heldItem = ITEM_NONE, .moves = {MOVE_YAWN, MOVE_PSYCHIC, MOVE_CALM_MIND, MOVE_PROTECT} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 59, .species = SPECIES_XATU, .heldItem = ITEM_CHESTO_BERRY, .moves = {MOVE_PSYCHIC, MOVE_REST, MOVE_CONFUSE_RAY, MOVE_CALM_MIND} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 60, .species = SPECIES_LUNATONE, .heldItem = ITEM_CHESTO_BERRY, .moves = {MOVE_EARTHQUAKE, MOVE_PSYCHIC, MOVE_REST, MOVE_CALM_MIND} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 60, .species = SPECIES_SOLROCK, .heldItem = ITEM_SITRUS_BERRY, @@ -11359,44 +10744,44 @@ static const struct TrainerMonItemCustomMoves sParty_TateAndLiza4[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_TateAndLiza5[] = { +static const struct TrainerMon sParty_TateAndLiza5[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 63, .species = SPECIES_HYPNO, .heldItem = ITEM_NONE, .moves = {MOVE_HYPNOSIS, MOVE_DREAM_EATER, MOVE_HEADBUTT, MOVE_PROTECT} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 64, .species = SPECIES_CLAYDOL, .heldItem = ITEM_NONE, .moves = {MOVE_EARTHQUAKE, MOVE_EXPLOSION, MOVE_PSYCHIC, MOVE_LIGHT_SCREEN} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 63, .species = SPECIES_SLOWKING, .heldItem = ITEM_NONE, .moves = {MOVE_YAWN, MOVE_PSYCHIC, MOVE_CALM_MIND, MOVE_PROTECT} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 64, .species = SPECIES_XATU, .heldItem = ITEM_CHESTO_BERRY, .moves = {MOVE_PSYCHIC, MOVE_REST, MOVE_CONFUSE_RAY, MOVE_CALM_MIND} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 65, .species = SPECIES_LUNATONE, .heldItem = ITEM_CHESTO_BERRY, .moves = {MOVE_EARTHQUAKE, MOVE_PSYCHIC, MOVE_REST, MOVE_CALM_MIND} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 65, .species = SPECIES_SOLROCK, .heldItem = ITEM_SITRUS_BERRY, @@ -11404,37 +10789,37 @@ static const struct TrainerMonItemCustomMoves sParty_TateAndLiza5[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Juan2[] = { +static const struct TrainerMon sParty_Juan2[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 46, .species = SPECIES_POLIWAG, .heldItem = ITEM_NONE, .moves = {MOVE_HYPNOSIS, MOVE_RAIN_DANCE, MOVE_PROTECT, MOVE_HYDRO_PUMP} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 46, .species = SPECIES_WHISCASH, .heldItem = ITEM_NONE, .moves = {MOVE_RAIN_DANCE, MOVE_WATER_PULSE, MOVE_DOUBLE_TEAM, MOVE_FISSURE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 48, .species = SPECIES_WALREIN, .heldItem = ITEM_NONE, .moves = {MOVE_WATER_PULSE, MOVE_BODY_SLAM, MOVE_PROTECT, MOVE_ICE_BEAM} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 48, .species = SPECIES_CRAWDAUNT, .heldItem = ITEM_CHESTO_BERRY, .moves = {MOVE_REST, MOVE_CRABHAMMER, MOVE_TAUNT, MOVE_DOUBLE_TEAM} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 51, .species = SPECIES_KINGDRA, .heldItem = ITEM_CHESTO_BERRY, @@ -11442,37 +10827,37 @@ static const struct TrainerMonItemCustomMoves sParty_Juan2[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Juan3[] = { +static const struct TrainerMon sParty_Juan3[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 50, .species = SPECIES_POLIWHIRL, .heldItem = ITEM_NONE, .moves = {MOVE_HYPNOSIS, MOVE_RAIN_DANCE, MOVE_PROTECT, MOVE_HYDRO_PUMP} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 51, .species = SPECIES_WHISCASH, .heldItem = ITEM_NONE, .moves = {MOVE_RAIN_DANCE, MOVE_WATER_PULSE, MOVE_DOUBLE_TEAM, MOVE_FISSURE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 53, .species = SPECIES_WALREIN, .heldItem = ITEM_NONE, .moves = {MOVE_WATER_PULSE, MOVE_BODY_SLAM, MOVE_PROTECT, MOVE_ICE_BEAM} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 53, .species = SPECIES_CRAWDAUNT, .heldItem = ITEM_CHESTO_BERRY, .moves = {MOVE_REST, MOVE_GUILLOTINE, MOVE_TAUNT, MOVE_DOUBLE_TEAM} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 56, .species = SPECIES_KINGDRA, .heldItem = ITEM_CHESTO_BERRY, @@ -11480,44 +10865,44 @@ static const struct TrainerMonItemCustomMoves sParty_Juan3[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Juan4[] = { +static const struct TrainerMon sParty_Juan4[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 56, .species = SPECIES_LAPRAS, .heldItem = ITEM_NONE, .moves = {MOVE_HYDRO_PUMP, MOVE_PERISH_SONG, MOVE_ICE_BEAM, MOVE_CONFUSE_RAY} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 58, .species = SPECIES_WHISCASH, .heldItem = ITEM_NONE, .moves = {MOVE_RAIN_DANCE, MOVE_WATER_PULSE, MOVE_DOUBLE_TEAM, MOVE_FISSURE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 56, .species = SPECIES_POLIWHIRL, .heldItem = ITEM_NONE, .moves = {MOVE_HYPNOSIS, MOVE_RAIN_DANCE, MOVE_PROTECT, MOVE_HYDRO_PUMP} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 58, .species = SPECIES_WALREIN, .heldItem = ITEM_NONE, .moves = {MOVE_WATER_PULSE, MOVE_BODY_SLAM, MOVE_PROTECT, MOVE_ICE_BEAM} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 58, .species = SPECIES_CRAWDAUNT, .heldItem = ITEM_CHESTO_BERRY, .moves = {MOVE_REST, MOVE_GUILLOTINE, MOVE_TAUNT, MOVE_DOUBLE_TEAM} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 61, .species = SPECIES_KINGDRA, .heldItem = ITEM_CHESTO_BERRY, @@ -11525,44 +10910,44 @@ static const struct TrainerMonItemCustomMoves sParty_Juan4[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Juan5[] = { +static const struct TrainerMon sParty_Juan5[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 61, .species = SPECIES_LAPRAS, .heldItem = ITEM_NONE, .moves = {MOVE_HYDRO_PUMP, MOVE_PERISH_SONG, MOVE_ICE_BEAM, MOVE_CONFUSE_RAY} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 63, .species = SPECIES_WHISCASH, .heldItem = ITEM_NONE, .moves = {MOVE_RAIN_DANCE, MOVE_WATER_PULSE, MOVE_DOUBLE_TEAM, MOVE_FISSURE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 61, .species = SPECIES_POLITOED, .heldItem = ITEM_NONE, .moves = {MOVE_HYPNOSIS, MOVE_RAIN_DANCE, MOVE_HYDRO_PUMP, MOVE_PERISH_SONG} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 63, .species = SPECIES_WALREIN, .heldItem = ITEM_NONE, .moves = {MOVE_WATER_PULSE, MOVE_BODY_SLAM, MOVE_PROTECT, MOVE_SHEER_COLD} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 63, .species = SPECIES_CRAWDAUNT, .heldItem = ITEM_CHESTO_BERRY, .moves = {MOVE_REST, MOVE_GUILLOTINE, MOVE_TAUNT, MOVE_DOUBLE_TEAM} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 66, .species = SPECIES_KINGDRA, .heldItem = ITEM_CHESTO_BERRY, @@ -11570,16 +10955,16 @@ static const struct TrainerMonItemCustomMoves sParty_Juan5[] = { } }; -static const struct TrainerMonItemCustomMoves sParty_Angelo[] = { +static const struct TrainerMon sParty_Angelo[] = { { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 17, .species = SPECIES_ILLUMISE, .heldItem = ITEM_NONE, .moves = {MOVE_SHOCK_WAVE, MOVE_QUICK_ATTACK, MOVE_CHARM, MOVE_NONE} }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 17, .species = SPECIES_VOLBEAT, .heldItem = ITEM_NONE, @@ -11587,52 +10972,52 @@ static const struct TrainerMonItemCustomMoves sParty_Angelo[] = { } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Darius[] = { +static const struct TrainerMon sParty_Darius[] = { { - .iv = 200, + .iv = TRAINER_PARTY_IVS(24, 24, 24, 24, 24, 24), .lvl = 30, .species = SPECIES_TROPIUS, } }; -static const struct TrainerMonItemCustomMoves sParty_Steven[] = { +static const struct TrainerMon sParty_Steven[] = { { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 77, .species = SPECIES_SKARMORY, .heldItem = ITEM_NONE, .moves = {MOVE_TOXIC, MOVE_AERIAL_ACE, MOVE_SPIKES, MOVE_STEEL_WING} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 75, .species = SPECIES_CLAYDOL, .heldItem = ITEM_NONE, .moves = {MOVE_REFLECT, MOVE_LIGHT_SCREEN, MOVE_ANCIENT_POWER, MOVE_EARTHQUAKE} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 76, .species = SPECIES_AGGRON, .heldItem = ITEM_NONE, .moves = {MOVE_THUNDER, MOVE_EARTHQUAKE, MOVE_SOLAR_BEAM, MOVE_DRAGON_CLAW} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 76, .species = SPECIES_CRADILY, .heldItem = ITEM_NONE, .moves = {MOVE_GIGA_DRAIN, MOVE_ANCIENT_POWER, MOVE_INGRAIN, MOVE_CONFUSE_RAY} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 76, .species = SPECIES_ARMALDO, .heldItem = ITEM_NONE, .moves = {MOVE_WATER_PULSE, MOVE_ANCIENT_POWER, MOVE_AERIAL_ACE, MOVE_SLASH} }, { - .iv = 255, + .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31), .lvl = 78, .species = SPECIES_METAGROSS, .heldItem = ITEM_SITRUS_BERRY, @@ -11640,796 +11025,781 @@ static const struct TrainerMonItemCustomMoves sParty_Steven[] = { } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Anabel[] = { +static const struct TrainerMon sParty_Anabel[] = { { - .iv = 0, .lvl = 5, .species = SPECIES_BELDUM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Tucker[] = { +static const struct TrainerMon sParty_Tucker[] = { { - .iv = 0, .lvl = 5, .species = SPECIES_BELDUM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Spenser[] = { +static const struct TrainerMon sParty_Spenser[] = { { - .iv = 0, .lvl = 5, .species = SPECIES_BELDUM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Greta[] = { +static const struct TrainerMon sParty_Greta[] = { { - .iv = 0, .lvl = 5, .species = SPECIES_BELDUM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Noland[] = { +static const struct TrainerMon sParty_Noland[] = { { - .iv = 0, .lvl = 5, .species = SPECIES_BELDUM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Lucy[] = { +static const struct TrainerMon sParty_Lucy[] = { { - .iv = 0, .lvl = 5, .species = SPECIES_BELDUM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Brandon[] = { +static const struct TrainerMon sParty_Brandon[] = { { - .iv = 0, .lvl = 5, .species = SPECIES_BELDUM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Andres2[] = { +static const struct TrainerMon sParty_Andres2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 31, .species = SPECIES_SANDSHREW, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 31, .species = SPECIES_SANDSHREW, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Andres3[] = { +static const struct TrainerMon sParty_Andres3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 33, .species = SPECIES_NOSEPASS, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 33, .species = SPECIES_SANDSHREW, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 33, .species = SPECIES_SANDSHREW, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Andres4[] = { +static const struct TrainerMon sParty_Andres4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 35, .species = SPECIES_NOSEPASS, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 35, .species = SPECIES_SANDSHREW, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 35, .species = SPECIES_SANDSHREW, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Andres5[] = { +static const struct TrainerMon sParty_Andres5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 37, .species = SPECIES_NOSEPASS, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 37, .species = SPECIES_SANDSLASH, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 37, .species = SPECIES_SANDSLASH, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cory2[] = { +static const struct TrainerMon sParty_Cory2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 30, .species = SPECIES_WINGULL, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 30, .species = SPECIES_MACHOP, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 30, .species = SPECIES_TENTACOOL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cory3[] = { +static const struct TrainerMon sParty_Cory3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 32, .species = SPECIES_PELIPPER, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 32, .species = SPECIES_MACHOP, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 32, .species = SPECIES_TENTACOOL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cory4[] = { +static const struct TrainerMon sParty_Cory4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 34, .species = SPECIES_PELIPPER, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 34, .species = SPECIES_MACHOP, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 34, .species = SPECIES_TENTACRUEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cory5[] = { +static const struct TrainerMon sParty_Cory5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 36, .species = SPECIES_PELIPPER, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 36, .species = SPECIES_MACHOKE, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 36, .species = SPECIES_TENTACRUEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Pablo2[] = { +static const struct TrainerMon sParty_Pablo2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 37, .species = SPECIES_STARYU, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 37, .species = SPECIES_STARYU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Pablo3[] = { +static const struct TrainerMon sParty_Pablo3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 39, .species = SPECIES_WINGULL, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 39, .species = SPECIES_STARYU, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 39, .species = SPECIES_STARYU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Pablo4[] = { +static const struct TrainerMon sParty_Pablo4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 41, .species = SPECIES_PELIPPER, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 41, .species = SPECIES_STARYU, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 41, .species = SPECIES_STARYU, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Pablo5[] = { +static const struct TrainerMon sParty_Pablo5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 43, .species = SPECIES_PELIPPER, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 43, .species = SPECIES_STARMIE, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 43, .species = SPECIES_STARMIE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Koji2[] = { +static const struct TrainerMon sParty_Koji2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 37, .species = SPECIES_MACHOKE, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 37, .species = SPECIES_MACHOKE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Koji3[] = { +static const struct TrainerMon sParty_Koji3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 39, .species = SPECIES_MAKUHITA, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 39, .species = SPECIES_MACHOKE, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 39, .species = SPECIES_MACHOKE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Koji4[] = { +static const struct TrainerMon sParty_Koji4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 41, .species = SPECIES_HARIYAMA, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 41, .species = SPECIES_MACHOKE, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 41, .species = SPECIES_MACHOKE, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Koji5[] = { +static const struct TrainerMon sParty_Koji5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 43, .species = SPECIES_HARIYAMA, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 43, .species = SPECIES_MACHAMP, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 43, .species = SPECIES_MACHAMP, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cristin2[] = { +static const struct TrainerMon sParty_Cristin2[] = { { - .iv = 110, + .iv = TRAINER_PARTY_IVS(13, 13, 13, 13, 13, 13), .lvl = 35, .species = SPECIES_LOUDRED, }, { - .iv = 110, + .iv = TRAINER_PARTY_IVS(13, 13, 13, 13, 13, 13), .lvl = 35, .species = SPECIES_VIGOROTH, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cristin3[] = { +static const struct TrainerMon sParty_Cristin3[] = { { - .iv = 120, + .iv = TRAINER_PARTY_IVS(14, 14, 14, 14, 14, 14), .lvl = 37, .species = SPECIES_SPINDA, }, { - .iv = 120, + .iv = TRAINER_PARTY_IVS(14, 14, 14, 14, 14, 14), .lvl = 37, .species = SPECIES_LOUDRED, }, { - .iv = 120, + .iv = TRAINER_PARTY_IVS(14, 14, 14, 14, 14, 14), .lvl = 37, .species = SPECIES_VIGOROTH, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cristin4[] = { +static const struct TrainerMon sParty_Cristin4[] = { { - .iv = 130, + .iv = TRAINER_PARTY_IVS(15, 15, 15, 15, 15, 15), .lvl = 39, .species = SPECIES_SPINDA, }, { - .iv = 130, + .iv = TRAINER_PARTY_IVS(15, 15, 15, 15, 15, 15), .lvl = 39, .species = SPECIES_LOUDRED, }, { - .iv = 100, + .iv = TRAINER_PARTY_IVS(12, 12, 12, 12, 12, 12), .lvl = 39, .species = SPECIES_VIGOROTH, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Cristin5[] = { +static const struct TrainerMon sParty_Cristin5[] = { { - .iv = 140, + .iv = TRAINER_PARTY_IVS(17, 17, 17, 17, 17, 17), .lvl = 41, .species = SPECIES_SPINDA, }, { - .iv = 140, + .iv = TRAINER_PARTY_IVS(17, 17, 17, 17, 17, 17), .lvl = 41, .species = SPECIES_EXPLOUD, }, { - .iv = 140, + .iv = TRAINER_PARTY_IVS(17, 17, 17, 17, 17, 17), .lvl = 41, .species = SPECIES_SLAKING, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Fernando2[] = { +static const struct TrainerMon sParty_Fernando2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 35, .species = SPECIES_ELECTRIKE, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 35, .species = SPECIES_ELECTRIKE, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 35, .species = SPECIES_LOUDRED, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Fernando3[] = { +static const struct TrainerMon sParty_Fernando3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 37, .species = SPECIES_ELECTRIKE, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 37, .species = SPECIES_MANECTRIC, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 37, .species = SPECIES_LOUDRED, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Fernando4[] = { +static const struct TrainerMon sParty_Fernando4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 39, .species = SPECIES_MANECTRIC, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 39, .species = SPECIES_MANECTRIC, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 39, .species = SPECIES_LOUDRED, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Fernando5[] = { +static const struct TrainerMon sParty_Fernando5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 41, .species = SPECIES_MANECTRIC, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 41, .species = SPECIES_MANECTRIC, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 41, .species = SPECIES_EXPLOUD, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Sawyer2[] = { +static const struct TrainerMon sParty_Sawyer2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 26, .species = SPECIES_GEODUDE, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 26, .species = SPECIES_NUMEL, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Sawyer3[] = { +static const struct TrainerMon sParty_Sawyer3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 28, .species = SPECIES_MACHOP, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 28, .species = SPECIES_NUMEL, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 28, .species = SPECIES_GRAVELER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Sawyer4[] = { +static const struct TrainerMon sParty_Sawyer4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 30, .species = SPECIES_MACHOP, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 30, .species = SPECIES_NUMEL, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 30, .species = SPECIES_GRAVELER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Sawyer5[] = { +static const struct TrainerMon sParty_Sawyer5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 33, .species = SPECIES_MACHOKE, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 33, .species = SPECIES_CAMERUPT, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 33, .species = SPECIES_GOLEM, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Gabrielle2[] = { +static const struct TrainerMon sParty_Gabrielle2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 31, .species = SPECIES_SKITTY, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 31, .species = SPECIES_MIGHTYENA, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 31, .species = SPECIES_ZIGZAGOON, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 31, .species = SPECIES_LOTAD, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 31, .species = SPECIES_SEEDOT, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 31, .species = SPECIES_TAILLOW, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Gabrielle3[] = { +static const struct TrainerMon sParty_Gabrielle3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 33, .species = SPECIES_SKITTY, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 33, .species = SPECIES_MIGHTYENA, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 33, .species = SPECIES_LINOONE, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 33, .species = SPECIES_LOMBRE, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 33, .species = SPECIES_NUZLEAF, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 33, .species = SPECIES_TAILLOW, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Gabrielle4[] = { +static const struct TrainerMon sParty_Gabrielle4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 35, .species = SPECIES_DELCATTY, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 35, .species = SPECIES_MIGHTYENA, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 35, .species = SPECIES_LINOONE, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 35, .species = SPECIES_LOMBRE, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 35, .species = SPECIES_NUZLEAF, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 35, .species = SPECIES_SWELLOW, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Gabrielle5[] = { +static const struct TrainerMon sParty_Gabrielle5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 37, .species = SPECIES_DELCATTY, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 37, .species = SPECIES_MIGHTYENA, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 37, .species = SPECIES_LINOONE, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 37, .species = SPECIES_LUDICOLO, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 37, .species = SPECIES_SHIFTRY, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 37, .species = SPECIES_SWELLOW, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Thalia2[] = { +static const struct TrainerMon sParty_Thalia2[] = { { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 34, .species = SPECIES_WAILMER, }, { - .iv = 10, + .iv = TRAINER_PARTY_IVS(1, 1, 1, 1, 1, 1), .lvl = 34, .species = SPECIES_HORSEA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Thalia3[] = { +static const struct TrainerMon sParty_Thalia3[] = { { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 36, .species = SPECIES_LUVDISC, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 36, .species = SPECIES_WAILMER, }, { - .iv = 20, + .iv = TRAINER_PARTY_IVS(2, 2, 2, 2, 2, 2), .lvl = 36, .species = SPECIES_SEADRA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Thalia4[] = { +static const struct TrainerMon sParty_Thalia4[] = { { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 38, .species = SPECIES_LUVDISC, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 38, .species = SPECIES_WAILMER, }, { - .iv = 30, + .iv = TRAINER_PARTY_IVS(3, 3, 3, 3, 3, 3), .lvl = 38, .species = SPECIES_SEADRA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Thalia5[] = { +static const struct TrainerMon sParty_Thalia5[] = { { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 40, .species = SPECIES_LUVDISC, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 40, .species = SPECIES_WAILORD, }, { - .iv = 40, + .iv = TRAINER_PARTY_IVS(4, 4, 4, 4, 4, 4), .lvl = 40, .species = SPECIES_KINGDRA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Mariela[] = { +static const struct TrainerMon sParty_Mariela[] = { { - .iv = 0, .lvl = 41, .species = SPECIES_CHIMECHO, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Alvaro[] = { +static const struct TrainerMon sParty_Alvaro[] = { { - .iv = 0, .lvl = 41, .species = SPECIES_BANETTE, }, { - .iv = 0, .lvl = 41, .species = SPECIES_KADABRA, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Everett[] = { +static const struct TrainerMon sParty_Everett[] = { { - .iv = 0, .lvl = 41, .species = SPECIES_WOBBUFFET, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Red[] = { +static const struct TrainerMon sParty_Red[] = { { - .iv = 0, .lvl = 5, .species = SPECIES_CHARMANDER, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_Leaf[] = { +static const struct TrainerMon sParty_Leaf[] = { { - .iv = 0, .lvl = 5, .species = SPECIES_BULBASAUR, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_BrendanLinkPlaceholder[] = { +static const struct TrainerMon sParty_BrendanLinkPlaceholder[] = { { - .iv = 0, .lvl = 5, .species = SPECIES_GROUDON, } }; -static const struct TrainerMonNoItemDefaultMoves sParty_MayLinkPlaceholder[] = { +static const struct TrainerMon sParty_MayLinkPlaceholder[] = { { - .iv = 0, .lvl = 5, .species = SPECIES_KYOGRE, } diff --git a/src/data/trainers.h b/src/data/trainers.h index 75f7edc8b787..7a34223b8562 100644 --- a/src/data/trainers.h +++ b/src/data/trainers.h @@ -1,7 +1,6 @@ const struct Trainer gTrainers[] = { [TRAINER_NONE] = { - .partyFlags = 0, .trainerClass = TRAINER_CLASS_PKMN_TRAINER_1, .encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE, .trainerPic = TRAINER_PIC_HIKER, @@ -10,7 +9,7 @@ const struct Trainer gTrainers[] = { .doubleBattle = FALSE, .aiFlags = 0, .partySize = 0, - .party = {.NoItemDefaultMoves = NULL}, + .party = NULL, }, [TRAINER_SAWYER_1] = @@ -22,7 +21,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Sawyer1), + .party = TRAINER_PARTY(sParty_Sawyer1), }, [TRAINER_GRUNT_AQUA_HIDEOUT_1] = @@ -34,7 +33,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntAquaHideout1), + .party = TRAINER_PARTY(sParty_GruntAquaHideout1), }, [TRAINER_GRUNT_AQUA_HIDEOUT_2] = @@ -46,7 +45,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntAquaHideout2), + .party = TRAINER_PARTY(sParty_GruntAquaHideout2), }, [TRAINER_GRUNT_AQUA_HIDEOUT_3] = @@ -58,7 +57,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntAquaHideout3), + .party = TRAINER_PARTY(sParty_GruntAquaHideout3), }, [TRAINER_GRUNT_AQUA_HIDEOUT_4] = @@ -70,7 +69,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntAquaHideout4), + .party = TRAINER_PARTY(sParty_GruntAquaHideout4), }, [TRAINER_GRUNT_SEAFLOOR_CAVERN_1] = @@ -82,7 +81,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntSeafloorCavern1), + .party = TRAINER_PARTY(sParty_GruntSeafloorCavern1), }, [TRAINER_GRUNT_SEAFLOOR_CAVERN_2] = @@ -94,7 +93,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntSeafloorCavern2), + .party = TRAINER_PARTY(sParty_GruntSeafloorCavern2), }, [TRAINER_GRUNT_SEAFLOOR_CAVERN_3] = @@ -106,7 +105,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntSeafloorCavern3), + .party = TRAINER_PARTY(sParty_GruntSeafloorCavern3), }, [TRAINER_GABRIELLE_1] = @@ -118,7 +117,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Gabrielle1), + .party = TRAINER_PARTY(sParty_Gabrielle1), }, [TRAINER_GRUNT_PETALBURG_WOODS] = @@ -130,7 +129,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntPetalburgWoods), + .party = TRAINER_PARTY(sParty_GruntPetalburgWoods), }, [TRAINER_MARCEL] = @@ -142,7 +141,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Marcel), + .party = TRAINER_PARTY(sParty_Marcel), }, [TRAINER_ALBERTO] = @@ -154,7 +153,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Alberto), + .party = TRAINER_PARTY(sParty_Alberto), }, [TRAINER_ED] = @@ -166,7 +165,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Ed), + .party = TRAINER_PARTY(sParty_Ed), }, [TRAINER_GRUNT_SEAFLOOR_CAVERN_4] = @@ -178,7 +177,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntSeafloorCavern4), + .party = TRAINER_PARTY(sParty_GruntSeafloorCavern4), }, [TRAINER_DECLAN] = @@ -190,7 +189,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Declan), + .party = TRAINER_PARTY(sParty_Declan), }, [TRAINER_GRUNT_RUSTURF_TUNNEL] = @@ -202,7 +201,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntRusturfTunnel), + .party = TRAINER_PARTY(sParty_GruntRusturfTunnel), }, [TRAINER_GRUNT_WEATHER_INST_1] = @@ -214,7 +213,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntWeatherInst1), + .party = TRAINER_PARTY(sParty_GruntWeatherInst1), }, [TRAINER_GRUNT_WEATHER_INST_2] = @@ -226,7 +225,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntWeatherInst2), + .party = TRAINER_PARTY(sParty_GruntWeatherInst2), }, [TRAINER_GRUNT_WEATHER_INST_3] = @@ -238,7 +237,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntWeatherInst3), + .party = TRAINER_PARTY(sParty_GruntWeatherInst3), }, [TRAINER_GRUNT_MUSEUM_1] = @@ -250,7 +249,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMuseum1), + .party = TRAINER_PARTY(sParty_GruntMuseum1), }, [TRAINER_GRUNT_MUSEUM_2] = @@ -262,7 +261,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMuseum2), + .party = TRAINER_PARTY(sParty_GruntMuseum2), }, [TRAINER_GRUNT_SPACE_CENTER_1] = @@ -274,7 +273,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntSpaceCenter1), + .party = TRAINER_PARTY(sParty_GruntSpaceCenter1), }, [TRAINER_GRUNT_MT_PYRE_1] = @@ -286,7 +285,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMtPyre1), + .party = TRAINER_PARTY(sParty_GruntMtPyre1), }, [TRAINER_GRUNT_MT_PYRE_2] = @@ -298,7 +297,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMtPyre2), + .party = TRAINER_PARTY(sParty_GruntMtPyre2), }, [TRAINER_GRUNT_MT_PYRE_3] = @@ -310,7 +309,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMtPyre3), + .party = TRAINER_PARTY(sParty_GruntMtPyre3), }, [TRAINER_GRUNT_WEATHER_INST_4] = @@ -322,7 +321,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntWeatherInst4), + .party = TRAINER_PARTY(sParty_GruntWeatherInst4), }, [TRAINER_GRUNT_AQUA_HIDEOUT_5] = @@ -334,7 +333,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntAquaHideout5), + .party = TRAINER_PARTY(sParty_GruntAquaHideout5), }, [TRAINER_GRUNT_AQUA_HIDEOUT_6] = @@ -346,7 +345,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntAquaHideout6), + .party = TRAINER_PARTY(sParty_GruntAquaHideout6), }, [TRAINER_FREDRICK] = @@ -358,7 +357,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Fredrick), + .party = TRAINER_PARTY(sParty_Fredrick), }, [TRAINER_MATT] = @@ -370,7 +369,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_SUPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Matt), + .party = TRAINER_PARTY(sParty_Matt), }, [TRAINER_ZANDER] = @@ -382,7 +381,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Zander), + .party = TRAINER_PARTY(sParty_Zander), }, [TRAINER_SHELLY_WEATHER_INSTITUTE] = @@ -394,7 +393,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_ShellyWeatherInstitute), + .party = TRAINER_PARTY(sParty_ShellyWeatherInstitute), }, [TRAINER_SHELLY_SEAFLOOR_CAVERN] = @@ -406,7 +405,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_ShellySeafloorCavern), + .party = TRAINER_PARTY(sParty_ShellySeafloorCavern), }, [TRAINER_ARCHIE] = @@ -418,7 +417,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_SUPER_POTION, ITEM_SUPER_POTION, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Archie), + .party = TRAINER_PARTY(sParty_Archie), }, [TRAINER_LEAH] = @@ -430,7 +429,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Leah), + .party = TRAINER_PARTY(sParty_Leah), }, [TRAINER_DAISY] = @@ -442,7 +441,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Daisy), + .party = TRAINER_PARTY(sParty_Daisy), }, [TRAINER_ROSE_1] = @@ -454,7 +453,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Rose1), + .party = TRAINER_PARTY(sParty_Rose1), }, [TRAINER_FELIX] = @@ -466,7 +465,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Felix), + .party = TRAINER_PARTY(sParty_Felix), }, [TRAINER_VIOLET] = @@ -478,7 +477,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Violet), + .party = TRAINER_PARTY(sParty_Violet), }, [TRAINER_ROSE_2] = @@ -490,7 +489,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Rose2), + .party = TRAINER_PARTY(sParty_Rose2), }, [TRAINER_ROSE_3] = @@ -502,7 +501,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Rose3), + .party = TRAINER_PARTY(sParty_Rose3), }, [TRAINER_ROSE_4] = @@ -514,7 +513,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Rose4), + .party = TRAINER_PARTY(sParty_Rose4), }, [TRAINER_ROSE_5] = @@ -526,7 +525,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Rose5), + .party = TRAINER_PARTY(sParty_Rose5), }, [TRAINER_DUSTY_1] = @@ -538,7 +537,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Dusty1), + .party = TRAINER_PARTY(sParty_Dusty1), }, [TRAINER_CHIP] = @@ -550,7 +549,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Chip), + .party = TRAINER_PARTY(sParty_Chip), }, [TRAINER_FOSTER] = @@ -562,7 +561,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Foster), + .party = TRAINER_PARTY(sParty_Foster), }, [TRAINER_DUSTY_2] = @@ -574,7 +573,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Dusty2), + .party = TRAINER_PARTY(sParty_Dusty2), }, [TRAINER_DUSTY_3] = @@ -586,7 +585,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Dusty3), + .party = TRAINER_PARTY(sParty_Dusty3), }, [TRAINER_DUSTY_4] = @@ -598,7 +597,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Dusty4), + .party = TRAINER_PARTY(sParty_Dusty4), }, [TRAINER_DUSTY_5] = @@ -610,7 +609,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Dusty5), + .party = TRAINER_PARTY(sParty_Dusty5), }, [TRAINER_GABBY_AND_TY_1] = @@ -622,7 +621,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GabbyAndTy1), + .party = TRAINER_PARTY(sParty_GabbyAndTy1), }, [TRAINER_GABBY_AND_TY_2] = @@ -634,7 +633,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GabbyAndTy2), + .party = TRAINER_PARTY(sParty_GabbyAndTy2), }, [TRAINER_GABBY_AND_TY_3] = @@ -646,7 +645,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GabbyAndTy3), + .party = TRAINER_PARTY(sParty_GabbyAndTy3), }, [TRAINER_GABBY_AND_TY_4] = @@ -658,7 +657,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GabbyAndTy4), + .party = TRAINER_PARTY(sParty_GabbyAndTy4), }, [TRAINER_GABBY_AND_TY_5] = @@ -670,7 +669,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GabbyAndTy5), + .party = TRAINER_PARTY(sParty_GabbyAndTy5), }, [TRAINER_GABBY_AND_TY_6] = @@ -682,7 +681,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_GabbyAndTy6), + .party = TRAINER_PARTY(sParty_GabbyAndTy6), }, [TRAINER_LOLA_1] = @@ -694,7 +693,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Lola1), + .party = TRAINER_PARTY(sParty_Lola1), }, [TRAINER_AUSTINA] = @@ -706,7 +705,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Austina), + .party = TRAINER_PARTY(sParty_Austina), }, [TRAINER_GWEN] = @@ -718,7 +717,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Gwen), + .party = TRAINER_PARTY(sParty_Gwen), }, [TRAINER_LOLA_2] = @@ -730,7 +729,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Lola2), + .party = TRAINER_PARTY(sParty_Lola2), }, [TRAINER_LOLA_3] = @@ -742,7 +741,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Lola3), + .party = TRAINER_PARTY(sParty_Lola3), }, [TRAINER_LOLA_4] = @@ -754,7 +753,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Lola4), + .party = TRAINER_PARTY(sParty_Lola4), }, [TRAINER_LOLA_5] = @@ -766,7 +765,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Lola5), + .party = TRAINER_PARTY(sParty_Lola5), }, [TRAINER_RICKY_1] = @@ -778,7 +777,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Ricky1), + .party = TRAINER_PARTY(sParty_Ricky1), }, [TRAINER_SIMON] = @@ -790,7 +789,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Simon), + .party = TRAINER_PARTY(sParty_Simon), }, [TRAINER_CHARLIE] = @@ -802,7 +801,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Charlie), + .party = TRAINER_PARTY(sParty_Charlie), }, [TRAINER_RICKY_2] = @@ -814,7 +813,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Ricky2), + .party = TRAINER_PARTY(sParty_Ricky2), }, [TRAINER_RICKY_3] = @@ -826,7 +825,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Ricky3), + .party = TRAINER_PARTY(sParty_Ricky3), }, [TRAINER_RICKY_4] = @@ -838,7 +837,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Ricky4), + .party = TRAINER_PARTY(sParty_Ricky4), }, [TRAINER_RICKY_5] = @@ -850,7 +849,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Ricky5), + .party = TRAINER_PARTY(sParty_Ricky5), }, [TRAINER_RANDALL] = @@ -862,7 +861,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Randall), + .party = TRAINER_PARTY(sParty_Randall), }, [TRAINER_PARKER] = @@ -874,7 +873,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Parker), + .party = TRAINER_PARTY(sParty_Parker), }, [TRAINER_GEORGE] = @@ -886,7 +885,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_George), + .party = TRAINER_PARTY(sParty_George), }, [TRAINER_BERKE] = @@ -898,7 +897,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Berke), + .party = TRAINER_PARTY(sParty_Berke), }, [TRAINER_BRAXTON] = @@ -910,7 +909,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Braxton), + .party = TRAINER_PARTY(sParty_Braxton), }, [TRAINER_VINCENT] = @@ -922,7 +921,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Vincent), + .party = TRAINER_PARTY(sParty_Vincent), }, [TRAINER_LEROY] = @@ -934,7 +933,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Leroy), + .party = TRAINER_PARTY(sParty_Leroy), }, [TRAINER_WILTON_1] = @@ -946,7 +945,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_SUPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Wilton1), + .party = TRAINER_PARTY(sParty_Wilton1), }, [TRAINER_EDGAR] = @@ -958,7 +957,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Edgar), + .party = TRAINER_PARTY(sParty_Edgar), }, [TRAINER_ALBERT] = @@ -970,7 +969,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Albert), + .party = TRAINER_PARTY(sParty_Albert), }, [TRAINER_SAMUEL] = @@ -982,7 +981,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Samuel), + .party = TRAINER_PARTY(sParty_Samuel), }, [TRAINER_VITO] = @@ -994,7 +993,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Vito), + .party = TRAINER_PARTY(sParty_Vito), }, [TRAINER_OWEN] = @@ -1006,7 +1005,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Owen), + .party = TRAINER_PARTY(sParty_Owen), }, [TRAINER_WILTON_2] = @@ -1018,7 +1017,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Wilton2), + .party = TRAINER_PARTY(sParty_Wilton2), }, [TRAINER_WILTON_3] = @@ -1030,7 +1029,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Wilton3), + .party = TRAINER_PARTY(sParty_Wilton3), }, [TRAINER_WILTON_4] = @@ -1042,7 +1041,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Wilton4), + .party = TRAINER_PARTY(sParty_Wilton4), }, [TRAINER_WILTON_5] = @@ -1054,7 +1053,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Wilton5), + .party = TRAINER_PARTY(sParty_Wilton5), }, [TRAINER_WARREN] = @@ -1066,7 +1065,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Warren), + .party = TRAINER_PARTY(sParty_Warren), }, [TRAINER_MARY] = @@ -1078,7 +1077,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Mary), + .party = TRAINER_PARTY(sParty_Mary), }, [TRAINER_ALEXIA] = @@ -1090,7 +1089,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Alexia), + .party = TRAINER_PARTY(sParty_Alexia), }, [TRAINER_JODY] = @@ -1102,7 +1101,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_SETUP_FIRST_TURN, - .party = ITEM_CUSTOM_MOVES(sParty_Jody), + .party = TRAINER_PARTY(sParty_Jody), }, [TRAINER_WENDY] = @@ -1114,7 +1113,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_SETUP_FIRST_TURN, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Wendy), + .party = TRAINER_PARTY(sParty_Wendy), }, [TRAINER_KEIRA] = @@ -1126,7 +1125,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_SETUP_FIRST_TURN, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Keira), + .party = TRAINER_PARTY(sParty_Keira), }, [TRAINER_BROOKE_1] = @@ -1138,7 +1137,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_SUPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Brooke1), + .party = TRAINER_PARTY(sParty_Brooke1), }, [TRAINER_JENNIFER] = @@ -1150,7 +1149,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jennifer), + .party = TRAINER_PARTY(sParty_Jennifer), }, [TRAINER_HOPE] = @@ -1162,7 +1161,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Hope), + .party = TRAINER_PARTY(sParty_Hope), }, [TRAINER_SHANNON] = @@ -1174,7 +1173,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Shannon), + .party = TRAINER_PARTY(sParty_Shannon), }, [TRAINER_MICHELLE] = @@ -1186,7 +1185,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Michelle), + .party = TRAINER_PARTY(sParty_Michelle), }, [TRAINER_CAROLINE] = @@ -1198,7 +1197,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Caroline), + .party = TRAINER_PARTY(sParty_Caroline), }, [TRAINER_JULIE] = @@ -1210,7 +1209,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Julie), + .party = TRAINER_PARTY(sParty_Julie), }, [TRAINER_BROOKE_2] = @@ -1222,7 +1221,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Brooke2), + .party = TRAINER_PARTY(sParty_Brooke2), }, [TRAINER_BROOKE_3] = @@ -1234,7 +1233,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Brooke3), + .party = TRAINER_PARTY(sParty_Brooke3), }, [TRAINER_BROOKE_4] = @@ -1246,7 +1245,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Brooke4), + .party = TRAINER_PARTY(sParty_Brooke4), }, [TRAINER_BROOKE_5] = @@ -1258,7 +1257,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Brooke5), + .party = TRAINER_PARTY(sParty_Brooke5), }, [TRAINER_PATRICIA] = @@ -1270,7 +1269,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Patricia), + .party = TRAINER_PARTY(sParty_Patricia), }, [TRAINER_KINDRA] = @@ -1282,7 +1281,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Kindra), + .party = TRAINER_PARTY(sParty_Kindra), }, [TRAINER_TAMMY] = @@ -1294,7 +1293,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Tammy), + .party = TRAINER_PARTY(sParty_Tammy), }, [TRAINER_VALERIE_1] = @@ -1306,7 +1305,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Valerie1), + .party = TRAINER_PARTY(sParty_Valerie1), }, [TRAINER_TASHA] = @@ -1318,7 +1317,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Tasha), + .party = TRAINER_PARTY(sParty_Tasha), }, [TRAINER_VALERIE_2] = @@ -1330,7 +1329,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Valerie2), + .party = TRAINER_PARTY(sParty_Valerie2), }, [TRAINER_VALERIE_3] = @@ -1342,7 +1341,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Valerie3), + .party = TRAINER_PARTY(sParty_Valerie3), }, [TRAINER_VALERIE_4] = @@ -1354,7 +1353,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Valerie4), + .party = TRAINER_PARTY(sParty_Valerie4), }, [TRAINER_VALERIE_5] = @@ -1366,7 +1365,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Valerie5), + .party = TRAINER_PARTY(sParty_Valerie5), }, [TRAINER_CINDY_1] = @@ -1378,7 +1377,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Cindy1), + .party = TRAINER_PARTY(sParty_Cindy1), }, [TRAINER_DAPHNE] = @@ -1390,7 +1389,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_CUSTOM_MOVES(sParty_Daphne), + .party = TRAINER_PARTY(sParty_Daphne), }, [TRAINER_GRUNT_SPACE_CENTER_2] = @@ -1402,7 +1401,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntSpaceCenter2), + .party = TRAINER_PARTY(sParty_GruntSpaceCenter2), }, [TRAINER_CINDY_2] = @@ -1414,7 +1413,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_CUSTOM_MOVES(sParty_Cindy2), + .party = TRAINER_PARTY(sParty_Cindy2), }, [TRAINER_BRIANNA] = @@ -1426,7 +1425,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Brianna), + .party = TRAINER_PARTY(sParty_Brianna), }, [TRAINER_NAOMI] = @@ -1438,7 +1437,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Naomi), + .party = TRAINER_PARTY(sParty_Naomi), }, [TRAINER_CINDY_3] = @@ -1450,7 +1449,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Cindy3), + .party = TRAINER_PARTY(sParty_Cindy3), }, [TRAINER_CINDY_4] = @@ -1462,7 +1461,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Cindy4), + .party = TRAINER_PARTY(sParty_Cindy4), }, [TRAINER_CINDY_5] = @@ -1474,7 +1473,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Cindy5), + .party = TRAINER_PARTY(sParty_Cindy5), }, [TRAINER_CINDY_6] = @@ -1486,7 +1485,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_CUSTOM_MOVES(sParty_Cindy6), + .party = TRAINER_PARTY(sParty_Cindy6), }, [TRAINER_MELISSA] = @@ -1498,7 +1497,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Melissa), + .party = TRAINER_PARTY(sParty_Melissa), }, [TRAINER_SHEILA] = @@ -1510,7 +1509,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Sheila), + .party = TRAINER_PARTY(sParty_Sheila), }, [TRAINER_SHIRLEY] = @@ -1522,7 +1521,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Shirley), + .party = TRAINER_PARTY(sParty_Shirley), }, [TRAINER_JESSICA_1] = @@ -1534,7 +1533,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Jessica1), + .party = TRAINER_PARTY(sParty_Jessica1), }, [TRAINER_CONNIE] = @@ -1546,7 +1545,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Connie), + .party = TRAINER_PARTY(sParty_Connie), }, [TRAINER_BRIDGET] = @@ -1558,7 +1557,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Bridget), + .party = TRAINER_PARTY(sParty_Bridget), }, [TRAINER_OLIVIA] = @@ -1570,7 +1569,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Olivia), + .party = TRAINER_PARTY(sParty_Olivia), }, [TRAINER_TIFFANY] = @@ -1582,7 +1581,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Tiffany), + .party = TRAINER_PARTY(sParty_Tiffany), }, [TRAINER_JESSICA_2] = @@ -1594,7 +1593,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Jessica2), + .party = TRAINER_PARTY(sParty_Jessica2), }, [TRAINER_JESSICA_3] = @@ -1606,7 +1605,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Jessica3), + .party = TRAINER_PARTY(sParty_Jessica3), }, [TRAINER_JESSICA_4] = @@ -1618,7 +1617,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Jessica4), + .party = TRAINER_PARTY(sParty_Jessica4), }, [TRAINER_JESSICA_5] = @@ -1630,7 +1629,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Jessica5), + .party = TRAINER_PARTY(sParty_Jessica5), }, [TRAINER_WINSTON_1] = @@ -1642,7 +1641,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Winston1), + .party = TRAINER_PARTY(sParty_Winston1), }, [TRAINER_MOLLIE] = @@ -1654,7 +1653,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Mollie), + .party = TRAINER_PARTY(sParty_Mollie), }, [TRAINER_GARRET] = @@ -1666,7 +1665,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Garret), + .party = TRAINER_PARTY(sParty_Garret), }, [TRAINER_WINSTON_2] = @@ -1678,7 +1677,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Winston2), + .party = TRAINER_PARTY(sParty_Winston2), }, [TRAINER_WINSTON_3] = @@ -1690,7 +1689,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Winston3), + .party = TRAINER_PARTY(sParty_Winston3), }, [TRAINER_WINSTON_4] = @@ -1702,7 +1701,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Winston4), + .party = TRAINER_PARTY(sParty_Winston4), }, [TRAINER_WINSTON_5] = @@ -1714,7 +1713,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_CUSTOM_MOVES(sParty_Winston5), + .party = TRAINER_PARTY(sParty_Winston5), }, [TRAINER_STEVE_1] = @@ -1726,7 +1725,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Steve1), + .party = TRAINER_PARTY(sParty_Steve1), }, [TRAINER_THALIA_1] = @@ -1738,7 +1737,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Thalia1), + .party = TRAINER_PARTY(sParty_Thalia1), }, [TRAINER_MARK] = @@ -1750,7 +1749,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Mark), + .party = TRAINER_PARTY(sParty_Mark), }, [TRAINER_GRUNT_MT_CHIMNEY_1] = @@ -1762,7 +1761,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMtChimney1), + .party = TRAINER_PARTY(sParty_GruntMtChimney1), }, [TRAINER_STEVE_2] = @@ -1774,7 +1773,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Steve2), + .party = TRAINER_PARTY(sParty_Steve2), }, [TRAINER_STEVE_3] = @@ -1786,7 +1785,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Steve3), + .party = TRAINER_PARTY(sParty_Steve3), }, [TRAINER_STEVE_4] = @@ -1798,7 +1797,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Steve4), + .party = TRAINER_PARTY(sParty_Steve4), }, [TRAINER_STEVE_5] = @@ -1810,7 +1809,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Steve5), + .party = TRAINER_PARTY(sParty_Steve5), }, [TRAINER_LUIS] = @@ -1822,7 +1821,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Luis), + .party = TRAINER_PARTY(sParty_Luis), }, [TRAINER_DOMINIK] = @@ -1834,7 +1833,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Dominik), + .party = TRAINER_PARTY(sParty_Dominik), }, [TRAINER_DOUGLAS] = @@ -1846,7 +1845,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Douglas), + .party = TRAINER_PARTY(sParty_Douglas), }, [TRAINER_DARRIN] = @@ -1858,7 +1857,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Darrin), + .party = TRAINER_PARTY(sParty_Darrin), }, [TRAINER_TONY_1] = @@ -1870,7 +1869,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Tony1), + .party = TRAINER_PARTY(sParty_Tony1), }, [TRAINER_JEROME] = @@ -1882,7 +1881,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jerome), + .party = TRAINER_PARTY(sParty_Jerome), }, [TRAINER_MATTHEW] = @@ -1894,7 +1893,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Matthew), + .party = TRAINER_PARTY(sParty_Matthew), }, [TRAINER_DAVID] = @@ -1906,7 +1905,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_David), + .party = TRAINER_PARTY(sParty_David), }, [TRAINER_SPENCER] = @@ -1918,7 +1917,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Spencer), + .party = TRAINER_PARTY(sParty_Spencer), }, [TRAINER_ROLAND] = @@ -1930,7 +1929,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Roland), + .party = TRAINER_PARTY(sParty_Roland), }, [TRAINER_NOLEN] = @@ -1942,7 +1941,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Nolen), + .party = TRAINER_PARTY(sParty_Nolen), }, [TRAINER_STAN] = @@ -1954,7 +1953,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Stan), + .party = TRAINER_PARTY(sParty_Stan), }, [TRAINER_BARRY] = @@ -1966,7 +1965,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Barry), + .party = TRAINER_PARTY(sParty_Barry), }, [TRAINER_DEAN] = @@ -1978,7 +1977,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Dean), + .party = TRAINER_PARTY(sParty_Dean), }, [TRAINER_RODNEY] = @@ -1990,7 +1989,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Rodney), + .party = TRAINER_PARTY(sParty_Rodney), }, [TRAINER_RICHARD] = @@ -2002,7 +2001,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Richard), + .party = TRAINER_PARTY(sParty_Richard), }, [TRAINER_HERMAN] = @@ -2014,7 +2013,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Herman), + .party = TRAINER_PARTY(sParty_Herman), }, [TRAINER_SANTIAGO] = @@ -2026,7 +2025,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Santiago), + .party = TRAINER_PARTY(sParty_Santiago), }, [TRAINER_GILBERT] = @@ -2038,7 +2037,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Gilbert), + .party = TRAINER_PARTY(sParty_Gilbert), }, [TRAINER_FRANKLIN] = @@ -2050,7 +2049,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Franklin), + .party = TRAINER_PARTY(sParty_Franklin), }, [TRAINER_KEVIN] = @@ -2062,7 +2061,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Kevin), + .party = TRAINER_PARTY(sParty_Kevin), }, [TRAINER_JACK] = @@ -2074,7 +2073,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jack), + .party = TRAINER_PARTY(sParty_Jack), }, [TRAINER_DUDLEY] = @@ -2086,7 +2085,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Dudley), + .party = TRAINER_PARTY(sParty_Dudley), }, [TRAINER_CHAD] = @@ -2098,7 +2097,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Chad), + .party = TRAINER_PARTY(sParty_Chad), }, [TRAINER_TONY_2] = @@ -2110,7 +2109,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Tony2), + .party = TRAINER_PARTY(sParty_Tony2), }, [TRAINER_TONY_3] = @@ -2122,7 +2121,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Tony3), + .party = TRAINER_PARTY(sParty_Tony3), }, [TRAINER_TONY_4] = @@ -2134,7 +2133,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Tony4), + .party = TRAINER_PARTY(sParty_Tony4), }, [TRAINER_TONY_5] = @@ -2146,7 +2145,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Tony5), + .party = TRAINER_PARTY(sParty_Tony5), }, [TRAINER_TAKAO] = @@ -2158,7 +2157,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Takao), + .party = TRAINER_PARTY(sParty_Takao), }, [TRAINER_HITOSHI] = @@ -2170,7 +2169,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Hitoshi), + .party = TRAINER_PARTY(sParty_Hitoshi), }, [TRAINER_KIYO] = @@ -2182,7 +2181,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Kiyo), + .party = TRAINER_PARTY(sParty_Kiyo), }, [TRAINER_KOICHI] = @@ -2194,7 +2193,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Koichi), + .party = TRAINER_PARTY(sParty_Koichi), }, [TRAINER_NOB_1] = @@ -2206,7 +2205,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Nob1), + .party = TRAINER_PARTY(sParty_Nob1), }, [TRAINER_NOB_2] = @@ -2218,7 +2217,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Nob2), + .party = TRAINER_PARTY(sParty_Nob2), }, [TRAINER_NOB_3] = @@ -2230,7 +2229,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Nob3), + .party = TRAINER_PARTY(sParty_Nob3), }, [TRAINER_NOB_4] = @@ -2242,7 +2241,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Nob4), + .party = TRAINER_PARTY(sParty_Nob4), }, [TRAINER_NOB_5] = @@ -2254,7 +2253,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Nob5), + .party = TRAINER_PARTY(sParty_Nob5), }, [TRAINER_YUJI] = @@ -2266,7 +2265,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Yuji), + .party = TRAINER_PARTY(sParty_Yuji), }, [TRAINER_DAISUKE] = @@ -2278,7 +2277,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Daisuke), + .party = TRAINER_PARTY(sParty_Daisuke), }, [TRAINER_ATSUSHI] = @@ -2290,7 +2289,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Atsushi), + .party = TRAINER_PARTY(sParty_Atsushi), }, [TRAINER_KIRK] = @@ -2302,7 +2301,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Kirk), + .party = TRAINER_PARTY(sParty_Kirk), }, [TRAINER_GRUNT_AQUA_HIDEOUT_7] = @@ -2314,7 +2313,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntAquaHideout7), + .party = TRAINER_PARTY(sParty_GruntAquaHideout7), }, [TRAINER_GRUNT_AQUA_HIDEOUT_8] = @@ -2326,7 +2325,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntAquaHideout8), + .party = TRAINER_PARTY(sParty_GruntAquaHideout8), }, [TRAINER_SHAWN] = @@ -2338,7 +2337,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Shawn), + .party = TRAINER_PARTY(sParty_Shawn), }, [TRAINER_FERNANDO_1] = @@ -2350,7 +2349,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Fernando1), + .party = TRAINER_PARTY(sParty_Fernando1), }, [TRAINER_DALTON_1] = @@ -2362,7 +2361,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Dalton1), + .party = TRAINER_PARTY(sParty_Dalton1), }, [TRAINER_DALTON_2] = @@ -2374,7 +2373,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Dalton2), + .party = TRAINER_PARTY(sParty_Dalton2), }, [TRAINER_DALTON_3] = @@ -2386,7 +2385,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Dalton3), + .party = TRAINER_PARTY(sParty_Dalton3), }, [TRAINER_DALTON_4] = @@ -2398,7 +2397,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Dalton4), + .party = TRAINER_PARTY(sParty_Dalton4), }, [TRAINER_DALTON_5] = @@ -2410,7 +2409,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Dalton5), + .party = TRAINER_PARTY(sParty_Dalton5), }, [TRAINER_COLE] = @@ -2422,7 +2421,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cole), + .party = TRAINER_PARTY(sParty_Cole), }, [TRAINER_JEFF] = @@ -2434,7 +2433,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jeff), + .party = TRAINER_PARTY(sParty_Jeff), }, [TRAINER_AXLE] = @@ -2446,7 +2445,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Axle), + .party = TRAINER_PARTY(sParty_Axle), }, [TRAINER_JACE] = @@ -2458,7 +2457,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jace), + .party = TRAINER_PARTY(sParty_Jace), }, [TRAINER_KEEGAN] = @@ -2470,7 +2469,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Keegan), + .party = TRAINER_PARTY(sParty_Keegan), }, [TRAINER_BERNIE_1] = @@ -2482,7 +2481,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Bernie1), + .party = TRAINER_PARTY(sParty_Bernie1), }, [TRAINER_BERNIE_2] = @@ -2494,7 +2493,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Bernie2), + .party = TRAINER_PARTY(sParty_Bernie2), }, [TRAINER_BERNIE_3] = @@ -2506,7 +2505,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Bernie3), + .party = TRAINER_PARTY(sParty_Bernie3), }, [TRAINER_BERNIE_4] = @@ -2518,7 +2517,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Bernie4), + .party = TRAINER_PARTY(sParty_Bernie4), }, [TRAINER_BERNIE_5] = @@ -2530,7 +2529,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Bernie5), + .party = TRAINER_PARTY(sParty_Bernie5), }, [TRAINER_DREW] = @@ -2542,7 +2541,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Drew), + .party = TRAINER_PARTY(sParty_Drew), }, [TRAINER_BEAU] = @@ -2554,7 +2553,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Beau), + .party = TRAINER_PARTY(sParty_Beau), }, [TRAINER_LARRY] = @@ -2566,7 +2565,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Larry), + .party = TRAINER_PARTY(sParty_Larry), }, [TRAINER_SHANE] = @@ -2578,7 +2577,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Shane), + .party = TRAINER_PARTY(sParty_Shane), }, [TRAINER_JUSTIN] = @@ -2590,7 +2589,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Justin), + .party = TRAINER_PARTY(sParty_Justin), }, [TRAINER_ETHAN_1] = @@ -2602,7 +2601,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Ethan1), + .party = TRAINER_PARTY(sParty_Ethan1), }, [TRAINER_AUTUMN] = @@ -2614,7 +2613,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Autumn), + .party = TRAINER_PARTY(sParty_Autumn), }, [TRAINER_TRAVIS] = @@ -2626,7 +2625,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Travis), + .party = TRAINER_PARTY(sParty_Travis), }, [TRAINER_ETHAN_2] = @@ -2638,7 +2637,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Ethan2), + .party = TRAINER_PARTY(sParty_Ethan2), }, [TRAINER_ETHAN_3] = @@ -2650,7 +2649,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Ethan3), + .party = TRAINER_PARTY(sParty_Ethan3), }, [TRAINER_ETHAN_4] = @@ -2662,7 +2661,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Ethan4), + .party = TRAINER_PARTY(sParty_Ethan4), }, [TRAINER_ETHAN_5] = @@ -2674,7 +2673,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Ethan5), + .party = TRAINER_PARTY(sParty_Ethan5), }, [TRAINER_BRENT] = @@ -2686,7 +2685,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Brent), + .party = TRAINER_PARTY(sParty_Brent), }, [TRAINER_DONALD] = @@ -2698,7 +2697,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Donald), + .party = TRAINER_PARTY(sParty_Donald), }, [TRAINER_TAYLOR] = @@ -2710,7 +2709,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Taylor), + .party = TRAINER_PARTY(sParty_Taylor), }, [TRAINER_JEFFREY_1] = @@ -2722,7 +2721,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jeffrey1), + .party = TRAINER_PARTY(sParty_Jeffrey1), }, [TRAINER_DEREK] = @@ -2734,7 +2733,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Derek), + .party = TRAINER_PARTY(sParty_Derek), }, [TRAINER_JEFFREY_2] = @@ -2746,7 +2745,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jeffrey2), + .party = TRAINER_PARTY(sParty_Jeffrey2), }, [TRAINER_JEFFREY_3] = @@ -2758,7 +2757,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jeffrey3), + .party = TRAINER_PARTY(sParty_Jeffrey3), }, [TRAINER_JEFFREY_4] = @@ -2770,7 +2769,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jeffrey4), + .party = TRAINER_PARTY(sParty_Jeffrey4), }, [TRAINER_JEFFREY_5] = @@ -2782,7 +2781,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Jeffrey5), + .party = TRAINER_PARTY(sParty_Jeffrey5), }, [TRAINER_EDWARD] = @@ -2794,7 +2793,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Edward), + .party = TRAINER_PARTY(sParty_Edward), }, [TRAINER_PRESTON] = @@ -2806,7 +2805,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Preston), + .party = TRAINER_PARTY(sParty_Preston), }, [TRAINER_VIRGIL] = @@ -2818,7 +2817,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Virgil), + .party = TRAINER_PARTY(sParty_Virgil), }, [TRAINER_BLAKE] = @@ -2830,7 +2829,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Blake), + .party = TRAINER_PARTY(sParty_Blake), }, [TRAINER_WILLIAM] = @@ -2842,7 +2841,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_William), + .party = TRAINER_PARTY(sParty_William), }, [TRAINER_JOSHUA] = @@ -2854,7 +2853,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Joshua), + .party = TRAINER_PARTY(sParty_Joshua), }, [TRAINER_CAMERON_1] = @@ -2866,7 +2865,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cameron1), + .party = TRAINER_PARTY(sParty_Cameron1), }, [TRAINER_CAMERON_2] = @@ -2878,7 +2877,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cameron2), + .party = TRAINER_PARTY(sParty_Cameron2), }, [TRAINER_CAMERON_3] = @@ -2890,7 +2889,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cameron3), + .party = TRAINER_PARTY(sParty_Cameron3), }, [TRAINER_CAMERON_4] = @@ -2902,7 +2901,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cameron4), + .party = TRAINER_PARTY(sParty_Cameron4), }, [TRAINER_CAMERON_5] = @@ -2914,7 +2913,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cameron5), + .party = TRAINER_PARTY(sParty_Cameron5), }, [TRAINER_JACLYN] = @@ -2926,7 +2925,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Jaclyn), + .party = TRAINER_PARTY(sParty_Jaclyn), }, [TRAINER_HANNAH] = @@ -2938,7 +2937,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Hannah), + .party = TRAINER_PARTY(sParty_Hannah), }, [TRAINER_SAMANTHA] = @@ -2950,7 +2949,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Samantha), + .party = TRAINER_PARTY(sParty_Samantha), }, [TRAINER_MAURA] = @@ -2962,7 +2961,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Maura), + .party = TRAINER_PARTY(sParty_Maura), }, [TRAINER_KAYLA] = @@ -2974,7 +2973,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Kayla), + .party = TRAINER_PARTY(sParty_Kayla), }, [TRAINER_ALEXIS] = @@ -2986,7 +2985,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Alexis), + .party = TRAINER_PARTY(sParty_Alexis), }, [TRAINER_JACKI_1] = @@ -2998,7 +2997,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jacki1), + .party = TRAINER_PARTY(sParty_Jacki1), }, [TRAINER_JACKI_2] = @@ -3010,7 +3009,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jacki2), + .party = TRAINER_PARTY(sParty_Jacki2), }, [TRAINER_JACKI_3] = @@ -3022,7 +3021,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jacki3), + .party = TRAINER_PARTY(sParty_Jacki3), }, [TRAINER_JACKI_4] = @@ -3034,7 +3033,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jacki4), + .party = TRAINER_PARTY(sParty_Jacki4), }, [TRAINER_JACKI_5] = @@ -3046,7 +3045,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jacki5), + .party = TRAINER_PARTY(sParty_Jacki5), }, [TRAINER_WALTER_1] = @@ -3058,7 +3057,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Walter1), + .party = TRAINER_PARTY(sParty_Walter1), }, [TRAINER_MICAH] = @@ -3070,7 +3069,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Micah), + .party = TRAINER_PARTY(sParty_Micah), }, [TRAINER_THOMAS] = @@ -3082,7 +3081,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Thomas), + .party = TRAINER_PARTY(sParty_Thomas), }, [TRAINER_WALTER_2] = @@ -3094,7 +3093,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Walter2), + .party = TRAINER_PARTY(sParty_Walter2), }, [TRAINER_WALTER_3] = @@ -3106,7 +3105,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Walter3), + .party = TRAINER_PARTY(sParty_Walter3), }, [TRAINER_WALTER_4] = @@ -3118,7 +3117,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Walter4), + .party = TRAINER_PARTY(sParty_Walter4), }, [TRAINER_WALTER_5] = @@ -3130,7 +3129,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Walter5), + .party = TRAINER_PARTY(sParty_Walter5), }, [TRAINER_SIDNEY] = @@ -3142,7 +3141,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY | AI_FLAG_SETUP_FIRST_TURN, - .party = ITEM_CUSTOM_MOVES(sParty_Sidney), + .party = TRAINER_PARTY(sParty_Sidney), }, [TRAINER_PHOEBE] = @@ -3154,7 +3153,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Phoebe), + .party = TRAINER_PARTY(sParty_Phoebe), }, [TRAINER_GLACIA] = @@ -3166,7 +3165,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Glacia), + .party = TRAINER_PARTY(sParty_Glacia), }, [TRAINER_DRAKE] = @@ -3178,7 +3177,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Drake), + .party = TRAINER_PARTY(sParty_Drake), }, [TRAINER_ROXANNE_1] = @@ -3190,7 +3189,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_POTION, ITEM_POTION, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Roxanne1), + .party = TRAINER_PARTY(sParty_Roxanne1), }, [TRAINER_BRAWLY_1] = @@ -3202,7 +3201,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_SUPER_POTION, ITEM_SUPER_POTION, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Brawly1), + .party = TRAINER_PARTY(sParty_Brawly1), }, [TRAINER_WATTSON_1] = @@ -3214,7 +3213,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_SUPER_POTION, ITEM_SUPER_POTION, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Wattson1), + .party = TRAINER_PARTY(sParty_Wattson1), }, [TRAINER_FLANNERY_1] = @@ -3226,7 +3225,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Flannery1), + .party = TRAINER_PARTY(sParty_Flannery1), }, [TRAINER_NORMAN_1] = @@ -3238,7 +3237,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Norman1), + .party = TRAINER_PARTY(sParty_Norman1), }, [TRAINER_WINONA_1] = @@ -3250,7 +3249,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY | AI_FLAG_RISKY, - .party = ITEM_CUSTOM_MOVES(sParty_Winona1), + .party = TRAINER_PARTY(sParty_Winona1), }, [TRAINER_TATE_AND_LIZA_1] = @@ -3262,7 +3261,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_HYPER_POTION, ITEM_HYPER_POTION, ITEM_HYPER_POTION}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_TateAndLiza1), + .party = TRAINER_PARTY(sParty_TateAndLiza1), }, [TRAINER_JUAN_1] = @@ -3274,7 +3273,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Juan1), + .party = TRAINER_PARTY(sParty_Juan1), }, [TRAINER_JERRY_1] = @@ -3286,7 +3285,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jerry1), + .party = TRAINER_PARTY(sParty_Jerry1), }, [TRAINER_TED] = @@ -3298,7 +3297,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Ted), + .party = TRAINER_PARTY(sParty_Ted), }, [TRAINER_PAUL] = @@ -3310,7 +3309,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Paul), + .party = TRAINER_PARTY(sParty_Paul), }, [TRAINER_JERRY_2] = @@ -3322,7 +3321,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jerry2), + .party = TRAINER_PARTY(sParty_Jerry2), }, [TRAINER_JERRY_3] = @@ -3334,7 +3333,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jerry3), + .party = TRAINER_PARTY(sParty_Jerry3), }, [TRAINER_JERRY_4] = @@ -3346,7 +3345,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jerry4), + .party = TRAINER_PARTY(sParty_Jerry4), }, [TRAINER_JERRY_5] = @@ -3358,7 +3357,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jerry5), + .party = TRAINER_PARTY(sParty_Jerry5), }, [TRAINER_KAREN_1] = @@ -3370,7 +3369,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Karen1), + .party = TRAINER_PARTY(sParty_Karen1), }, [TRAINER_GEORGIA] = @@ -3382,7 +3381,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Georgia), + .party = TRAINER_PARTY(sParty_Georgia), }, [TRAINER_KAREN_2] = @@ -3394,7 +3393,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Karen2), + .party = TRAINER_PARTY(sParty_Karen2), }, [TRAINER_KAREN_3] = @@ -3406,7 +3405,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Karen3), + .party = TRAINER_PARTY(sParty_Karen3), }, [TRAINER_KAREN_4] = @@ -3418,7 +3417,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Karen4), + .party = TRAINER_PARTY(sParty_Karen4), }, [TRAINER_KAREN_5] = @@ -3430,7 +3429,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Karen5), + .party = TRAINER_PARTY(sParty_Karen5), }, [TRAINER_KATE_AND_JOY] = @@ -3442,7 +3441,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_KateAndJoy), + .party = TRAINER_PARTY(sParty_KateAndJoy), }, [TRAINER_ANNA_AND_MEG_1] = @@ -3454,7 +3453,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_AnnaAndMeg1), + .party = TRAINER_PARTY(sParty_AnnaAndMeg1), }, [TRAINER_ANNA_AND_MEG_2] = @@ -3466,7 +3465,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_AnnaAndMeg2), + .party = TRAINER_PARTY(sParty_AnnaAndMeg2), }, [TRAINER_ANNA_AND_MEG_3] = @@ -3478,7 +3477,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_AnnaAndMeg3), + .party = TRAINER_PARTY(sParty_AnnaAndMeg3), }, [TRAINER_ANNA_AND_MEG_4] = @@ -3490,7 +3489,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_AnnaAndMeg4), + .party = TRAINER_PARTY(sParty_AnnaAndMeg4), }, [TRAINER_ANNA_AND_MEG_5] = @@ -3502,7 +3501,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_AnnaAndMeg5), + .party = TRAINER_PARTY(sParty_AnnaAndMeg5), }, [TRAINER_VICTOR] = @@ -3514,7 +3513,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Victor), + .party = TRAINER_PARTY(sParty_Victor), }, [TRAINER_MIGUEL_1] = @@ -3526,7 +3525,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Miguel1), + .party = TRAINER_PARTY(sParty_Miguel1), }, [TRAINER_COLTON] = @@ -3538,7 +3537,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_CUSTOM_MOVES(sParty_Colton), + .party = TRAINER_PARTY(sParty_Colton), }, [TRAINER_MIGUEL_2] = @@ -3550,7 +3549,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Miguel2), + .party = TRAINER_PARTY(sParty_Miguel2), }, [TRAINER_MIGUEL_3] = @@ -3562,7 +3561,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Miguel3), + .party = TRAINER_PARTY(sParty_Miguel3), }, [TRAINER_MIGUEL_4] = @@ -3574,7 +3573,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Miguel4), + .party = TRAINER_PARTY(sParty_Miguel4), }, [TRAINER_MIGUEL_5] = @@ -3586,7 +3585,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Miguel5), + .party = TRAINER_PARTY(sParty_Miguel5), }, [TRAINER_VICTORIA] = @@ -3598,7 +3597,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT, - .party = ITEM_DEFAULT_MOVES(sParty_Victoria), + .party = TRAINER_PARTY(sParty_Victoria), }, [TRAINER_VANESSA] = @@ -3610,7 +3609,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Vanessa), + .party = TRAINER_PARTY(sParty_Vanessa), }, [TRAINER_BETHANY] = @@ -3622,7 +3621,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Bethany), + .party = TRAINER_PARTY(sParty_Bethany), }, [TRAINER_ISABEL_1] = @@ -3634,7 +3633,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Isabel1), + .party = TRAINER_PARTY(sParty_Isabel1), }, [TRAINER_ISABEL_2] = @@ -3646,7 +3645,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Isabel2), + .party = TRAINER_PARTY(sParty_Isabel2), }, [TRAINER_ISABEL_3] = @@ -3658,7 +3657,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Isabel3), + .party = TRAINER_PARTY(sParty_Isabel3), }, [TRAINER_ISABEL_4] = @@ -3670,7 +3669,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Isabel4), + .party = TRAINER_PARTY(sParty_Isabel4), }, [TRAINER_ISABEL_5] = @@ -3682,7 +3681,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Isabel5), + .party = TRAINER_PARTY(sParty_Isabel5), }, [TRAINER_TIMOTHY_1] = @@ -3694,7 +3693,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Timothy1), + .party = TRAINER_PARTY(sParty_Timothy1), }, [TRAINER_TIMOTHY_2] = @@ -3706,7 +3705,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Timothy2), + .party = TRAINER_PARTY(sParty_Timothy2), }, [TRAINER_TIMOTHY_3] = @@ -3718,7 +3717,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Timothy3), + .party = TRAINER_PARTY(sParty_Timothy3), }, [TRAINER_TIMOTHY_4] = @@ -3730,7 +3729,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Timothy4), + .party = TRAINER_PARTY(sParty_Timothy4), }, [TRAINER_TIMOTHY_5] = @@ -3742,7 +3741,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Timothy5), + .party = TRAINER_PARTY(sParty_Timothy5), }, [TRAINER_VICKY] = @@ -3754,7 +3753,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Vicky), + .party = TRAINER_PARTY(sParty_Vicky), }, [TRAINER_SHELBY_1] = @@ -3766,7 +3765,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Shelby1), + .party = TRAINER_PARTY(sParty_Shelby1), }, [TRAINER_SHELBY_2] = @@ -3778,7 +3777,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Shelby2), + .party = TRAINER_PARTY(sParty_Shelby2), }, [TRAINER_SHELBY_3] = @@ -3790,7 +3789,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Shelby3), + .party = TRAINER_PARTY(sParty_Shelby3), }, [TRAINER_SHELBY_4] = @@ -3802,7 +3801,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Shelby4), + .party = TRAINER_PARTY(sParty_Shelby4), }, [TRAINER_SHELBY_5] = @@ -3814,7 +3813,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Shelby5), + .party = TRAINER_PARTY(sParty_Shelby5), }, [TRAINER_CALVIN_1] = @@ -3826,7 +3825,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Calvin1), + .party = TRAINER_PARTY(sParty_Calvin1), }, [TRAINER_BILLY] = @@ -3838,7 +3837,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Billy), + .party = TRAINER_PARTY(sParty_Billy), }, [TRAINER_JOSH] = @@ -3850,7 +3849,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Josh), + .party = TRAINER_PARTY(sParty_Josh), }, [TRAINER_TOMMY] = @@ -3862,7 +3861,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Tommy), + .party = TRAINER_PARTY(sParty_Tommy), }, [TRAINER_JOEY] = @@ -3874,7 +3873,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Joey), + .party = TRAINER_PARTY(sParty_Joey), }, [TRAINER_BEN] = @@ -3886,7 +3885,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Ben), + .party = TRAINER_PARTY(sParty_Ben), }, [TRAINER_QUINCY] = @@ -3898,7 +3897,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Quincy), + .party = TRAINER_PARTY(sParty_Quincy), }, [TRAINER_KATELYNN] = @@ -3910,7 +3909,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Katelynn), + .party = TRAINER_PARTY(sParty_Katelynn), }, [TRAINER_JAYLEN] = @@ -3922,7 +3921,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jaylen), + .party = TRAINER_PARTY(sParty_Jaylen), }, [TRAINER_DILLON] = @@ -3934,7 +3933,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Dillon), + .party = TRAINER_PARTY(sParty_Dillon), }, [TRAINER_CALVIN_2] = @@ -3946,7 +3945,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Calvin2), + .party = TRAINER_PARTY(sParty_Calvin2), }, [TRAINER_CALVIN_3] = @@ -3958,7 +3957,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Calvin3), + .party = TRAINER_PARTY(sParty_Calvin3), }, [TRAINER_CALVIN_4] = @@ -3970,7 +3969,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Calvin4), + .party = TRAINER_PARTY(sParty_Calvin4), }, [TRAINER_CALVIN_5] = @@ -3982,7 +3981,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Calvin5), + .party = TRAINER_PARTY(sParty_Calvin5), }, [TRAINER_EDDIE] = @@ -3994,7 +3993,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Eddie), + .party = TRAINER_PARTY(sParty_Eddie), }, [TRAINER_ALLEN] = @@ -4006,7 +4005,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Allen), + .party = TRAINER_PARTY(sParty_Allen), }, [TRAINER_TIMMY] = @@ -4018,7 +4017,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Timmy), + .party = TRAINER_PARTY(sParty_Timmy), }, [TRAINER_WALLACE] = @@ -4030,7 +4029,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Wallace), + .party = TRAINER_PARTY(sParty_Wallace), }, [TRAINER_ANDREW] = @@ -4042,7 +4041,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Andrew), + .party = TRAINER_PARTY(sParty_Andrew), }, [TRAINER_IVAN] = @@ -4054,7 +4053,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Ivan), + .party = TRAINER_PARTY(sParty_Ivan), }, [TRAINER_CLAUDE] = @@ -4066,7 +4065,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Claude), + .party = TRAINER_PARTY(sParty_Claude), }, [TRAINER_ELLIOT_1] = @@ -4078,7 +4077,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Elliot1), + .party = TRAINER_PARTY(sParty_Elliot1), }, [TRAINER_NED] = @@ -4090,7 +4089,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Ned), + .party = TRAINER_PARTY(sParty_Ned), }, [TRAINER_DALE] = @@ -4102,7 +4101,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Dale), + .party = TRAINER_PARTY(sParty_Dale), }, [TRAINER_NOLAN] = @@ -4114,7 +4113,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Nolan), + .party = TRAINER_PARTY(sParty_Nolan), }, [TRAINER_BARNY] = @@ -4126,7 +4125,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Barny), + .party = TRAINER_PARTY(sParty_Barny), }, [TRAINER_WADE] = @@ -4138,7 +4137,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Wade), + .party = TRAINER_PARTY(sParty_Wade), }, [TRAINER_CARTER] = @@ -4150,7 +4149,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Carter), + .party = TRAINER_PARTY(sParty_Carter), }, [TRAINER_ELLIOT_2] = @@ -4162,7 +4161,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Elliot2), + .party = TRAINER_PARTY(sParty_Elliot2), }, [TRAINER_ELLIOT_3] = @@ -4174,7 +4173,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Elliot3), + .party = TRAINER_PARTY(sParty_Elliot3), }, [TRAINER_ELLIOT_4] = @@ -4186,7 +4185,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Elliot4), + .party = TRAINER_PARTY(sParty_Elliot4), }, [TRAINER_ELLIOT_5] = @@ -4198,7 +4197,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Elliot5), + .party = TRAINER_PARTY(sParty_Elliot5), }, [TRAINER_RONALD] = @@ -4210,7 +4209,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Ronald), + .party = TRAINER_PARTY(sParty_Ronald), }, [TRAINER_JACOB] = @@ -4222,7 +4221,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jacob), + .party = TRAINER_PARTY(sParty_Jacob), }, [TRAINER_ANTHONY] = @@ -4234,7 +4233,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Anthony), + .party = TRAINER_PARTY(sParty_Anthony), }, [TRAINER_BENJAMIN_1] = @@ -4246,7 +4245,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Benjamin1), + .party = TRAINER_PARTY(sParty_Benjamin1), }, [TRAINER_BENJAMIN_2] = @@ -4258,7 +4257,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Benjamin2), + .party = TRAINER_PARTY(sParty_Benjamin2), }, [TRAINER_BENJAMIN_3] = @@ -4270,7 +4269,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Benjamin3), + .party = TRAINER_PARTY(sParty_Benjamin3), }, [TRAINER_BENJAMIN_4] = @@ -4282,7 +4281,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Benjamin4), + .party = TRAINER_PARTY(sParty_Benjamin4), }, [TRAINER_BENJAMIN_5] = @@ -4294,7 +4293,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Benjamin5), + .party = TRAINER_PARTY(sParty_Benjamin5), }, [TRAINER_ABIGAIL_1] = @@ -4306,7 +4305,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Abigail1), + .party = TRAINER_PARTY(sParty_Abigail1), }, [TRAINER_JASMINE] = @@ -4318,7 +4317,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jasmine), + .party = TRAINER_PARTY(sParty_Jasmine), }, [TRAINER_ABIGAIL_2] = @@ -4330,7 +4329,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Abigail2), + .party = TRAINER_PARTY(sParty_Abigail2), }, [TRAINER_ABIGAIL_3] = @@ -4342,7 +4341,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Abigail3), + .party = TRAINER_PARTY(sParty_Abigail3), }, [TRAINER_ABIGAIL_4] = @@ -4354,7 +4353,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Abigail4), + .party = TRAINER_PARTY(sParty_Abigail4), }, [TRAINER_ABIGAIL_5] = @@ -4366,7 +4365,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Abigail5), + .party = TRAINER_PARTY(sParty_Abigail5), }, [TRAINER_DYLAN_1] = @@ -4378,7 +4377,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Dylan1), + .party = TRAINER_PARTY(sParty_Dylan1), }, [TRAINER_DYLAN_2] = @@ -4390,7 +4389,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Dylan2), + .party = TRAINER_PARTY(sParty_Dylan2), }, [TRAINER_DYLAN_3] = @@ -4402,7 +4401,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Dylan3), + .party = TRAINER_PARTY(sParty_Dylan3), }, [TRAINER_DYLAN_4] = @@ -4414,7 +4413,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Dylan4), + .party = TRAINER_PARTY(sParty_Dylan4), }, [TRAINER_DYLAN_5] = @@ -4426,7 +4425,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Dylan5), + .party = TRAINER_PARTY(sParty_Dylan5), }, [TRAINER_MARIA_1] = @@ -4438,7 +4437,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Maria1), + .party = TRAINER_PARTY(sParty_Maria1), }, [TRAINER_MARIA_2] = @@ -4450,7 +4449,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Maria2), + .party = TRAINER_PARTY(sParty_Maria2), }, [TRAINER_MARIA_3] = @@ -4462,7 +4461,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Maria3), + .party = TRAINER_PARTY(sParty_Maria3), }, [TRAINER_MARIA_4] = @@ -4474,7 +4473,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Maria4), + .party = TRAINER_PARTY(sParty_Maria4), }, [TRAINER_MARIA_5] = @@ -4486,7 +4485,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Maria5), + .party = TRAINER_PARTY(sParty_Maria5), }, [TRAINER_CAMDEN] = @@ -4498,7 +4497,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Camden), + .party = TRAINER_PARTY(sParty_Camden), }, [TRAINER_DEMETRIUS] = @@ -4510,7 +4509,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Demetrius), + .party = TRAINER_PARTY(sParty_Demetrius), }, [TRAINER_ISAIAH_1] = @@ -4522,7 +4521,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Isaiah1), + .party = TRAINER_PARTY(sParty_Isaiah1), }, [TRAINER_PABLO_1] = @@ -4534,7 +4533,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Pablo1), + .party = TRAINER_PARTY(sParty_Pablo1), }, [TRAINER_CHASE] = @@ -4546,7 +4545,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Chase), + .party = TRAINER_PARTY(sParty_Chase), }, [TRAINER_ISAIAH_2] = @@ -4558,7 +4557,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Isaiah2), + .party = TRAINER_PARTY(sParty_Isaiah2), }, [TRAINER_ISAIAH_3] = @@ -4570,7 +4569,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Isaiah3), + .party = TRAINER_PARTY(sParty_Isaiah3), }, [TRAINER_ISAIAH_4] = @@ -4582,7 +4581,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Isaiah4), + .party = TRAINER_PARTY(sParty_Isaiah4), }, [TRAINER_ISAIAH_5] = @@ -4594,7 +4593,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Isaiah5), + .party = TRAINER_PARTY(sParty_Isaiah5), }, [TRAINER_ISOBEL] = @@ -4606,7 +4605,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Isobel), + .party = TRAINER_PARTY(sParty_Isobel), }, [TRAINER_DONNY] = @@ -4618,7 +4617,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Donny), + .party = TRAINER_PARTY(sParty_Donny), }, [TRAINER_TALIA] = @@ -4630,7 +4629,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Talia), + .party = TRAINER_PARTY(sParty_Talia), }, [TRAINER_KATELYN_1] = @@ -4642,7 +4641,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Katelyn1), + .party = TRAINER_PARTY(sParty_Katelyn1), }, [TRAINER_ALLISON] = @@ -4654,7 +4653,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Allison), + .party = TRAINER_PARTY(sParty_Allison), }, [TRAINER_KATELYN_2] = @@ -4666,7 +4665,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Katelyn2), + .party = TRAINER_PARTY(sParty_Katelyn2), }, [TRAINER_KATELYN_3] = @@ -4678,7 +4677,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Katelyn3), + .party = TRAINER_PARTY(sParty_Katelyn3), }, [TRAINER_KATELYN_4] = @@ -4690,7 +4689,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Katelyn4), + .party = TRAINER_PARTY(sParty_Katelyn4), }, [TRAINER_KATELYN_5] = @@ -4702,7 +4701,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Katelyn5), + .party = TRAINER_PARTY(sParty_Katelyn5), }, [TRAINER_NICOLAS_1] = @@ -4714,7 +4713,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Nicolas1), + .party = TRAINER_PARTY(sParty_Nicolas1), }, [TRAINER_NICOLAS_2] = @@ -4726,7 +4725,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Nicolas2), + .party = TRAINER_PARTY(sParty_Nicolas2), }, [TRAINER_NICOLAS_3] = @@ -4738,7 +4737,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Nicolas3), + .party = TRAINER_PARTY(sParty_Nicolas3), }, [TRAINER_NICOLAS_4] = @@ -4750,7 +4749,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Nicolas4), + .party = TRAINER_PARTY(sParty_Nicolas4), }, [TRAINER_NICOLAS_5] = @@ -4762,7 +4761,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Nicolas5), + .party = TRAINER_PARTY(sParty_Nicolas5), }, [TRAINER_AARON] = @@ -4774,7 +4773,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Aaron), + .party = TRAINER_PARTY(sParty_Aaron), }, [TRAINER_PERRY] = @@ -4786,7 +4785,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Perry), + .party = TRAINER_PARTY(sParty_Perry), }, [TRAINER_HUGH] = @@ -4798,7 +4797,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Hugh), + .party = TRAINER_PARTY(sParty_Hugh), }, [TRAINER_PHIL] = @@ -4810,7 +4809,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Phil), + .party = TRAINER_PARTY(sParty_Phil), }, [TRAINER_JARED] = @@ -4822,7 +4821,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jared), + .party = TRAINER_PARTY(sParty_Jared), }, [TRAINER_HUMBERTO] = @@ -4834,7 +4833,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Humberto), + .party = TRAINER_PARTY(sParty_Humberto), }, [TRAINER_PRESLEY] = @@ -4846,7 +4845,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Presley), + .party = TRAINER_PARTY(sParty_Presley), }, [TRAINER_EDWARDO] = @@ -4858,7 +4857,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Edwardo), + .party = TRAINER_PARTY(sParty_Edwardo), }, [TRAINER_COLIN] = @@ -4870,7 +4869,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Colin), + .party = TRAINER_PARTY(sParty_Colin), }, [TRAINER_ROBERT_1] = @@ -4882,7 +4881,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Robert1), + .party = TRAINER_PARTY(sParty_Robert1), }, [TRAINER_BENNY] = @@ -4894,7 +4893,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Benny), + .party = TRAINER_PARTY(sParty_Benny), }, [TRAINER_CHESTER] = @@ -4906,7 +4905,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Chester), + .party = TRAINER_PARTY(sParty_Chester), }, [TRAINER_ROBERT_2] = @@ -4918,7 +4917,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Robert2), + .party = TRAINER_PARTY(sParty_Robert2), }, [TRAINER_ROBERT_3] = @@ -4930,7 +4929,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Robert3), + .party = TRAINER_PARTY(sParty_Robert3), }, [TRAINER_ROBERT_4] = @@ -4942,7 +4941,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Robert4), + .party = TRAINER_PARTY(sParty_Robert4), }, [TRAINER_ROBERT_5] = @@ -4954,7 +4953,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Robert5), + .party = TRAINER_PARTY(sParty_Robert5), }, [TRAINER_ALEX] = @@ -4966,7 +4965,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Alex), + .party = TRAINER_PARTY(sParty_Alex), }, [TRAINER_BECK] = @@ -4978,7 +4977,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Beck), + .party = TRAINER_PARTY(sParty_Beck), }, [TRAINER_YASU] = @@ -4990,7 +4989,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Yasu), + .party = TRAINER_PARTY(sParty_Yasu), }, [TRAINER_TAKASHI] = @@ -5002,7 +5001,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Takashi), + .party = TRAINER_PARTY(sParty_Takashi), }, [TRAINER_DIANNE] = @@ -5014,7 +5013,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = 0, - .party = ITEM_CUSTOM_MOVES(sParty_Dianne), + .party = TRAINER_PARTY(sParty_Dianne), }, [TRAINER_JANI] = @@ -5026,7 +5025,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = 0, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jani), + .party = TRAINER_PARTY(sParty_Jani), }, [TRAINER_LAO_1] = @@ -5038,7 +5037,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = 0, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Lao1), + .party = TRAINER_PARTY(sParty_Lao1), }, [TRAINER_LUNG] = @@ -5050,7 +5049,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = 0, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Lung), + .party = TRAINER_PARTY(sParty_Lung), }, [TRAINER_LAO_2] = @@ -5062,7 +5061,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = 0, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Lao2), + .party = TRAINER_PARTY(sParty_Lao2), }, [TRAINER_LAO_3] = @@ -5074,7 +5073,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = 0, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Lao3), + .party = TRAINER_PARTY(sParty_Lao3), }, [TRAINER_LAO_4] = @@ -5086,7 +5085,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = 0, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Lao4), + .party = TRAINER_PARTY(sParty_Lao4), }, [TRAINER_LAO_5] = @@ -5098,7 +5097,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = 0, - .party = ITEM_CUSTOM_MOVES(sParty_Lao5), + .party = TRAINER_PARTY(sParty_Lao5), }, [TRAINER_JOCELYN] = @@ -5110,7 +5109,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jocelyn), + .party = TRAINER_PARTY(sParty_Jocelyn), }, [TRAINER_LAURA] = @@ -5122,7 +5121,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Laura), + .party = TRAINER_PARTY(sParty_Laura), }, [TRAINER_CYNDY_1] = @@ -5134,7 +5133,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cyndy1), + .party = TRAINER_PARTY(sParty_Cyndy1), }, [TRAINER_CORA] = @@ -5146,7 +5145,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cora), + .party = TRAINER_PARTY(sParty_Cora), }, [TRAINER_PAULA] = @@ -5158,7 +5157,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Paula), + .party = TRAINER_PARTY(sParty_Paula), }, [TRAINER_CYNDY_2] = @@ -5170,7 +5169,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cyndy2), + .party = TRAINER_PARTY(sParty_Cyndy2), }, [TRAINER_CYNDY_3] = @@ -5182,7 +5181,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cyndy3), + .party = TRAINER_PARTY(sParty_Cyndy3), }, [TRAINER_CYNDY_4] = @@ -5194,7 +5193,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cyndy4), + .party = TRAINER_PARTY(sParty_Cyndy4), }, [TRAINER_CYNDY_5] = @@ -5206,7 +5205,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cyndy5), + .party = TRAINER_PARTY(sParty_Cyndy5), }, [TRAINER_MADELINE_1] = @@ -5218,7 +5217,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Madeline1), + .party = TRAINER_PARTY(sParty_Madeline1), }, [TRAINER_CLARISSA] = @@ -5230,7 +5229,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Clarissa), + .party = TRAINER_PARTY(sParty_Clarissa), }, [TRAINER_ANGELICA] = @@ -5242,7 +5241,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Angelica), + .party = TRAINER_PARTY(sParty_Angelica), }, [TRAINER_MADELINE_2] = @@ -5254,7 +5253,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Madeline2), + .party = TRAINER_PARTY(sParty_Madeline2), }, [TRAINER_MADELINE_3] = @@ -5266,7 +5265,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Madeline3), + .party = TRAINER_PARTY(sParty_Madeline3), }, [TRAINER_MADELINE_4] = @@ -5278,7 +5277,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Madeline4), + .party = TRAINER_PARTY(sParty_Madeline4), }, [TRAINER_MADELINE_5] = @@ -5290,7 +5289,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Madeline5), + .party = TRAINER_PARTY(sParty_Madeline5), }, [TRAINER_BEVERLY] = @@ -5302,7 +5301,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Beverly), + .party = TRAINER_PARTY(sParty_Beverly), }, [TRAINER_IMANI] = @@ -5314,7 +5313,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Imani), + .party = TRAINER_PARTY(sParty_Imani), }, [TRAINER_KYLA] = @@ -5326,7 +5325,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Kyla), + .party = TRAINER_PARTY(sParty_Kyla), }, [TRAINER_DENISE] = @@ -5338,7 +5337,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Denise), + .party = TRAINER_PARTY(sParty_Denise), }, [TRAINER_BETH] = @@ -5350,7 +5349,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Beth), + .party = TRAINER_PARTY(sParty_Beth), }, [TRAINER_TARA] = @@ -5362,7 +5361,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Tara), + .party = TRAINER_PARTY(sParty_Tara), }, [TRAINER_MISSY] = @@ -5374,7 +5373,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Missy), + .party = TRAINER_PARTY(sParty_Missy), }, [TRAINER_ALICE] = @@ -5386,7 +5385,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Alice), + .party = TRAINER_PARTY(sParty_Alice), }, [TRAINER_JENNY_1] = @@ -5398,7 +5397,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jenny1), + .party = TRAINER_PARTY(sParty_Jenny1), }, [TRAINER_GRACE] = @@ -5410,7 +5409,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Grace), + .party = TRAINER_PARTY(sParty_Grace), }, [TRAINER_TANYA] = @@ -5422,7 +5421,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Tanya), + .party = TRAINER_PARTY(sParty_Tanya), }, [TRAINER_SHARON] = @@ -5434,7 +5433,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Sharon), + .party = TRAINER_PARTY(sParty_Sharon), }, [TRAINER_NIKKI] = @@ -5446,7 +5445,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Nikki), + .party = TRAINER_PARTY(sParty_Nikki), }, [TRAINER_BRENDA] = @@ -5458,7 +5457,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Brenda), + .party = TRAINER_PARTY(sParty_Brenda), }, [TRAINER_KATIE] = @@ -5470,7 +5469,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Katie), + .party = TRAINER_PARTY(sParty_Katie), }, [TRAINER_SUSIE] = @@ -5482,7 +5481,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Susie), + .party = TRAINER_PARTY(sParty_Susie), }, [TRAINER_KARA] = @@ -5494,7 +5493,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Kara), + .party = TRAINER_PARTY(sParty_Kara), }, [TRAINER_DANA] = @@ -5506,7 +5505,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Dana), + .party = TRAINER_PARTY(sParty_Dana), }, [TRAINER_SIENNA] = @@ -5518,7 +5517,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Sienna), + .party = TRAINER_PARTY(sParty_Sienna), }, [TRAINER_DEBRA] = @@ -5530,7 +5529,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Debra), + .party = TRAINER_PARTY(sParty_Debra), }, [TRAINER_LINDA] = @@ -5542,7 +5541,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Linda), + .party = TRAINER_PARTY(sParty_Linda), }, [TRAINER_KAYLEE] = @@ -5554,7 +5553,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Kaylee), + .party = TRAINER_PARTY(sParty_Kaylee), }, [TRAINER_LAUREL] = @@ -5566,7 +5565,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Laurel), + .party = TRAINER_PARTY(sParty_Laurel), }, [TRAINER_CARLEE] = @@ -5578,7 +5577,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Carlee), + .party = TRAINER_PARTY(sParty_Carlee), }, [TRAINER_JENNY_2] = @@ -5590,7 +5589,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jenny2), + .party = TRAINER_PARTY(sParty_Jenny2), }, [TRAINER_JENNY_3] = @@ -5602,7 +5601,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jenny3), + .party = TRAINER_PARTY(sParty_Jenny3), }, [TRAINER_JENNY_4] = @@ -5614,7 +5613,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jenny4), + .party = TRAINER_PARTY(sParty_Jenny4), }, [TRAINER_JENNY_5] = @@ -5626,7 +5625,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jenny5), + .party = TRAINER_PARTY(sParty_Jenny5), }, [TRAINER_HEIDI] = @@ -5638,7 +5637,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Heidi), + .party = TRAINER_PARTY(sParty_Heidi), }, [TRAINER_BECKY] = @@ -5650,7 +5649,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Becky), + .party = TRAINER_PARTY(sParty_Becky), }, [TRAINER_CAROL] = @@ -5662,7 +5661,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Carol), + .party = TRAINER_PARTY(sParty_Carol), }, [TRAINER_NANCY] = @@ -5674,7 +5673,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Nancy), + .party = TRAINER_PARTY(sParty_Nancy), }, [TRAINER_MARTHA] = @@ -5686,7 +5685,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Martha), + .party = TRAINER_PARTY(sParty_Martha), }, [TRAINER_DIANA_1] = @@ -5698,7 +5697,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Diana1), + .party = TRAINER_PARTY(sParty_Diana1), }, [TRAINER_CEDRIC] = @@ -5710,7 +5709,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Cedric), + .party = TRAINER_PARTY(sParty_Cedric), }, [TRAINER_IRENE] = @@ -5722,7 +5721,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Irene), + .party = TRAINER_PARTY(sParty_Irene), }, [TRAINER_DIANA_2] = @@ -5734,7 +5733,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Diana2), + .party = TRAINER_PARTY(sParty_Diana2), }, [TRAINER_DIANA_3] = @@ -5746,7 +5745,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Diana3), + .party = TRAINER_PARTY(sParty_Diana3), }, [TRAINER_DIANA_4] = @@ -5758,7 +5757,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Diana4), + .party = TRAINER_PARTY(sParty_Diana4), }, [TRAINER_DIANA_5] = @@ -5770,7 +5769,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Diana5), + .party = TRAINER_PARTY(sParty_Diana5), }, [TRAINER_AMY_AND_LIV_1] = @@ -5782,7 +5781,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_AmyAndLiv1), + .party = TRAINER_PARTY(sParty_AmyAndLiv1), }, [TRAINER_AMY_AND_LIV_2] = @@ -5794,7 +5793,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_AmyAndLiv2), + .party = TRAINER_PARTY(sParty_AmyAndLiv2), }, [TRAINER_GINA_AND_MIA_1] = @@ -5806,7 +5805,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GinaAndMia1), + .party = TRAINER_PARTY(sParty_GinaAndMia1), }, [TRAINER_MIU_AND_YUKI] = @@ -5818,7 +5817,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_MiuAndYuki), + .party = TRAINER_PARTY(sParty_MiuAndYuki), }, [TRAINER_AMY_AND_LIV_3] = @@ -5830,7 +5829,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_AmyAndLiv3), + .party = TRAINER_PARTY(sParty_AmyAndLiv3), }, [TRAINER_GINA_AND_MIA_2] = @@ -5842,7 +5841,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_GinaAndMia2), + .party = TRAINER_PARTY(sParty_GinaAndMia2), }, [TRAINER_AMY_AND_LIV_4] = @@ -5854,7 +5853,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_AmyAndLiv4), + .party = TRAINER_PARTY(sParty_AmyAndLiv4), }, [TRAINER_AMY_AND_LIV_5] = @@ -5866,7 +5865,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_AmyAndLiv5), + .party = TRAINER_PARTY(sParty_AmyAndLiv5), }, [TRAINER_AMY_AND_LIV_6] = @@ -5878,7 +5877,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_AmyAndLiv6), + .party = TRAINER_PARTY(sParty_AmyAndLiv6), }, [TRAINER_HUEY] = @@ -5890,7 +5889,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Huey), + .party = TRAINER_PARTY(sParty_Huey), }, [TRAINER_EDMOND] = @@ -5902,7 +5901,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Edmond), + .party = TRAINER_PARTY(sParty_Edmond), }, [TRAINER_ERNEST_1] = @@ -5914,7 +5913,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Ernest1), + .party = TRAINER_PARTY(sParty_Ernest1), }, [TRAINER_DWAYNE] = @@ -5926,7 +5925,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Dwayne), + .party = TRAINER_PARTY(sParty_Dwayne), }, [TRAINER_PHILLIP] = @@ -5938,7 +5937,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Phillip), + .party = TRAINER_PARTY(sParty_Phillip), }, [TRAINER_LEONARD] = @@ -5950,7 +5949,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Leonard), + .party = TRAINER_PARTY(sParty_Leonard), }, [TRAINER_DUNCAN] = @@ -5962,7 +5961,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Duncan), + .party = TRAINER_PARTY(sParty_Duncan), }, [TRAINER_ERNEST_2] = @@ -5974,7 +5973,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Ernest2), + .party = TRAINER_PARTY(sParty_Ernest2), }, [TRAINER_ERNEST_3] = @@ -5986,7 +5985,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Ernest3), + .party = TRAINER_PARTY(sParty_Ernest3), }, [TRAINER_ERNEST_4] = @@ -5998,7 +5997,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Ernest4), + .party = TRAINER_PARTY(sParty_Ernest4), }, [TRAINER_ERNEST_5] = @@ -6010,7 +6009,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Ernest5), + .party = TRAINER_PARTY(sParty_Ernest5), }, [TRAINER_ELI] = @@ -6022,7 +6021,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Eli), + .party = TRAINER_PARTY(sParty_Eli), }, [TRAINER_ANNIKA] = @@ -6034,7 +6033,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_CUSTOM_MOVES(sParty_Annika), + .party = TRAINER_PARTY(sParty_Annika), }, [TRAINER_JAZMYN] = @@ -6046,7 +6045,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jazmyn), + .party = TRAINER_PARTY(sParty_Jazmyn), }, [TRAINER_JONAS] = @@ -6058,7 +6057,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Jonas), + .party = TRAINER_PARTY(sParty_Jonas), }, [TRAINER_KAYLEY] = @@ -6070,7 +6069,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Kayley), + .party = TRAINER_PARTY(sParty_Kayley), }, [TRAINER_AURON] = @@ -6082,7 +6081,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Auron), + .party = TRAINER_PARTY(sParty_Auron), }, [TRAINER_KELVIN] = @@ -6094,7 +6093,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Kelvin), + .party = TRAINER_PARTY(sParty_Kelvin), }, [TRAINER_MARLEY] = @@ -6106,7 +6105,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Marley), + .party = TRAINER_PARTY(sParty_Marley), }, [TRAINER_REYNA] = @@ -6118,7 +6117,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Reyna), + .party = TRAINER_PARTY(sParty_Reyna), }, [TRAINER_HUDSON] = @@ -6130,7 +6129,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Hudson), + .party = TRAINER_PARTY(sParty_Hudson), }, [TRAINER_CONOR] = @@ -6142,7 +6141,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Conor), + .party = TRAINER_PARTY(sParty_Conor), }, [TRAINER_EDWIN_1] = @@ -6154,7 +6153,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Edwin1), + .party = TRAINER_PARTY(sParty_Edwin1), }, [TRAINER_HECTOR] = @@ -6166,7 +6165,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Hector), + .party = TRAINER_PARTY(sParty_Hector), }, [TRAINER_TABITHA_MOSSDEEP] = @@ -6178,7 +6177,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_TabithaMossdeep), + .party = TRAINER_PARTY(sParty_TabithaMossdeep), }, [TRAINER_EDWIN_2] = @@ -6190,7 +6189,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Edwin2), + .party = TRAINER_PARTY(sParty_Edwin2), }, [TRAINER_EDWIN_3] = @@ -6202,7 +6201,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Edwin3), + .party = TRAINER_PARTY(sParty_Edwin3), }, [TRAINER_EDWIN_4] = @@ -6214,7 +6213,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Edwin4), + .party = TRAINER_PARTY(sParty_Edwin4), }, [TRAINER_EDWIN_5] = @@ -6226,7 +6225,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Edwin5), + .party = TRAINER_PARTY(sParty_Edwin5), }, [TRAINER_WALLY_VR_1] = @@ -6238,7 +6237,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_CUSTOM_MOVES(sParty_WallyVR1), + .party = TRAINER_PARTY(sParty_WallyVR1), }, [TRAINER_BRENDAN_ROUTE_103_MUDKIP] = @@ -6250,7 +6249,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_BrendanRoute103Mudkip), + .party = TRAINER_PARTY(sParty_BrendanRoute103Mudkip), }, [TRAINER_BRENDAN_ROUTE_110_MUDKIP] = @@ -6262,7 +6261,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_BrendanRoute110Mudkip), + .party = TRAINER_PARTY(sParty_BrendanRoute110Mudkip), }, [TRAINER_BRENDAN_ROUTE_119_MUDKIP] = @@ -6274,7 +6273,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_BrendanRoute119Mudkip), + .party = TRAINER_PARTY(sParty_BrendanRoute119Mudkip), }, [TRAINER_BRENDAN_ROUTE_103_TREECKO] = @@ -6286,7 +6285,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_SETUP_FIRST_TURN, - .party = NO_ITEM_DEFAULT_MOVES(sParty_BrendanRoute103Treecko), + .party = TRAINER_PARTY(sParty_BrendanRoute103Treecko), }, [TRAINER_BRENDAN_ROUTE_110_TREECKO] = @@ -6298,7 +6297,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_BrendanRoute110Treecko), + .party = TRAINER_PARTY(sParty_BrendanRoute110Treecko), }, [TRAINER_BRENDAN_ROUTE_119_TREECKO] = @@ -6310,7 +6309,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_BrendanRoute119Treecko), + .party = TRAINER_PARTY(sParty_BrendanRoute119Treecko), }, [TRAINER_BRENDAN_ROUTE_103_TORCHIC] = @@ -6322,7 +6321,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_BrendanRoute103Torchic), + .party = TRAINER_PARTY(sParty_BrendanRoute103Torchic), }, [TRAINER_BRENDAN_ROUTE_110_TORCHIC] = @@ -6334,7 +6333,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_BrendanRoute110Torchic), + .party = TRAINER_PARTY(sParty_BrendanRoute110Torchic), }, [TRAINER_BRENDAN_ROUTE_119_TORCHIC] = @@ -6346,7 +6345,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_BrendanRoute119Torchic), + .party = TRAINER_PARTY(sParty_BrendanRoute119Torchic), }, [TRAINER_MAY_ROUTE_103_MUDKIP] = @@ -6358,7 +6357,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_MayRoute103Mudkip), + .party = TRAINER_PARTY(sParty_MayRoute103Mudkip), }, [TRAINER_MAY_ROUTE_110_MUDKIP] = @@ -6370,7 +6369,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_MayRoute110Mudkip), + .party = TRAINER_PARTY(sParty_MayRoute110Mudkip), }, [TRAINER_MAY_ROUTE_119_MUDKIP] = @@ -6382,7 +6381,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_MayRoute119Mudkip), + .party = TRAINER_PARTY(sParty_MayRoute119Mudkip), }, [TRAINER_MAY_ROUTE_103_TREECKO] = @@ -6394,7 +6393,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_MayRoute103Treecko), + .party = TRAINER_PARTY(sParty_MayRoute103Treecko), }, [TRAINER_MAY_ROUTE_110_TREECKO] = @@ -6406,7 +6405,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_MayRoute110Treecko), + .party = TRAINER_PARTY(sParty_MayRoute110Treecko), }, [TRAINER_MAY_ROUTE_119_TREECKO] = @@ -6418,7 +6417,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_MayRoute119Treecko), + .party = TRAINER_PARTY(sParty_MayRoute119Treecko), }, [TRAINER_MAY_ROUTE_103_TORCHIC] = @@ -6430,7 +6429,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_MayRoute103Torchic), + .party = TRAINER_PARTY(sParty_MayRoute103Torchic), }, [TRAINER_MAY_ROUTE_110_TORCHIC] = @@ -6442,7 +6441,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_MayRoute110Torchic), + .party = TRAINER_PARTY(sParty_MayRoute110Torchic), }, [TRAINER_MAY_ROUTE_119_TORCHIC] = @@ -6454,7 +6453,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_MayRoute119Torchic), + .party = TRAINER_PARTY(sParty_MayRoute119Torchic), }, [TRAINER_ISAAC_1] = @@ -6466,7 +6465,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Isaac1), + .party = TRAINER_PARTY(sParty_Isaac1), }, [TRAINER_DAVIS] = @@ -6478,7 +6477,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Davis), + .party = TRAINER_PARTY(sParty_Davis), }, [TRAINER_MITCHELL] = @@ -6490,7 +6489,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Mitchell), + .party = TRAINER_PARTY(sParty_Mitchell), }, [TRAINER_ISAAC_2] = @@ -6502,7 +6501,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Isaac2), + .party = TRAINER_PARTY(sParty_Isaac2), }, [TRAINER_ISAAC_3] = @@ -6514,7 +6513,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Isaac3), + .party = TRAINER_PARTY(sParty_Isaac3), }, [TRAINER_ISAAC_4] = @@ -6526,7 +6525,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Isaac4), + .party = TRAINER_PARTY(sParty_Isaac4), }, [TRAINER_ISAAC_5] = @@ -6538,7 +6537,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Isaac5), + .party = TRAINER_PARTY(sParty_Isaac5), }, [TRAINER_LYDIA_1] = @@ -6550,7 +6549,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Lydia1), + .party = TRAINER_PARTY(sParty_Lydia1), }, [TRAINER_HALLE] = @@ -6562,7 +6561,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Halle), + .party = TRAINER_PARTY(sParty_Halle), }, [TRAINER_GARRISON] = @@ -6574,7 +6573,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Garrison), + .party = TRAINER_PARTY(sParty_Garrison), }, [TRAINER_LYDIA_2] = @@ -6586,7 +6585,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Lydia2), + .party = TRAINER_PARTY(sParty_Lydia2), }, [TRAINER_LYDIA_3] = @@ -6598,7 +6597,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Lydia3), + .party = TRAINER_PARTY(sParty_Lydia3), }, [TRAINER_LYDIA_4] = @@ -6610,7 +6609,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Lydia4), + .party = TRAINER_PARTY(sParty_Lydia4), }, [TRAINER_LYDIA_5] = @@ -6622,7 +6621,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Lydia5), + .party = TRAINER_PARTY(sParty_Lydia5), }, [TRAINER_JACKSON_1] = @@ -6634,7 +6633,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jackson1), + .party = TRAINER_PARTY(sParty_Jackson1), }, [TRAINER_LORENZO] = @@ -6646,7 +6645,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Lorenzo), + .party = TRAINER_PARTY(sParty_Lorenzo), }, [TRAINER_SEBASTIAN] = @@ -6658,7 +6657,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Sebastian), + .party = TRAINER_PARTY(sParty_Sebastian), }, [TRAINER_JACKSON_2] = @@ -6670,7 +6669,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_SETUP_FIRST_TURN, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jackson2), + .party = TRAINER_PARTY(sParty_Jackson2), }, [TRAINER_JACKSON_3] = @@ -6682,7 +6681,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jackson3), + .party = TRAINER_PARTY(sParty_Jackson3), }, [TRAINER_JACKSON_4] = @@ -6694,7 +6693,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_SETUP_FIRST_TURN, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jackson4), + .party = TRAINER_PARTY(sParty_Jackson4), }, [TRAINER_JACKSON_5] = @@ -6706,7 +6705,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jackson5), + .party = TRAINER_PARTY(sParty_Jackson5), }, [TRAINER_CATHERINE_1] = @@ -6718,7 +6717,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_SETUP_FIRST_TURN, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Catherine1), + .party = TRAINER_PARTY(sParty_Catherine1), }, [TRAINER_JENNA] = @@ -6730,7 +6729,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_SETUP_FIRST_TURN, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jenna), + .party = TRAINER_PARTY(sParty_Jenna), }, [TRAINER_SOPHIA] = @@ -6742,7 +6741,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Sophia), + .party = TRAINER_PARTY(sParty_Sophia), }, [TRAINER_CATHERINE_2] = @@ -6754,7 +6753,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_SETUP_FIRST_TURN, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Catherine2), + .party = TRAINER_PARTY(sParty_Catherine2), }, [TRAINER_CATHERINE_3] = @@ -6766,7 +6765,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Catherine3), + .party = TRAINER_PARTY(sParty_Catherine3), }, [TRAINER_CATHERINE_4] = @@ -6778,7 +6777,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_SETUP_FIRST_TURN, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Catherine4), + .party = TRAINER_PARTY(sParty_Catherine4), }, [TRAINER_CATHERINE_5] = @@ -6790,7 +6789,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Catherine5), + .party = TRAINER_PARTY(sParty_Catherine5), }, [TRAINER_JULIO] = @@ -6802,7 +6801,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Julio), + .party = TRAINER_PARTY(sParty_Julio), }, [TRAINER_GRUNT_SEAFLOOR_CAVERN_5] = @@ -6814,7 +6813,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntSeafloorCavern5), + .party = TRAINER_PARTY(sParty_GruntSeafloorCavern5), }, [TRAINER_GRUNT_UNUSED] = @@ -6826,7 +6825,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntUnused), + .party = TRAINER_PARTY(sParty_GruntUnused), }, [TRAINER_GRUNT_MT_PYRE_4] = @@ -6838,7 +6837,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMtPyre4), + .party = TRAINER_PARTY(sParty_GruntMtPyre4), }, [TRAINER_GRUNT_JAGGED_PASS] = @@ -6850,7 +6849,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntJaggedPass), + .party = TRAINER_PARTY(sParty_GruntJaggedPass), }, [TRAINER_MARC] = @@ -6862,7 +6861,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Marc), + .party = TRAINER_PARTY(sParty_Marc), }, [TRAINER_BRENDEN] = @@ -6874,7 +6873,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Brenden), + .party = TRAINER_PARTY(sParty_Brenden), }, [TRAINER_LILITH] = @@ -6886,7 +6885,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Lilith), + .party = TRAINER_PARTY(sParty_Lilith), }, [TRAINER_CRISTIAN] = @@ -6898,7 +6897,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cristian), + .party = TRAINER_PARTY(sParty_Cristian), }, [TRAINER_SYLVIA] = @@ -6910,7 +6909,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Sylvia), + .party = TRAINER_PARTY(sParty_Sylvia), }, [TRAINER_LEONARDO] = @@ -6922,7 +6921,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Leonardo), + .party = TRAINER_PARTY(sParty_Leonardo), }, [TRAINER_ATHENA] = @@ -6934,7 +6933,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Athena), + .party = TRAINER_PARTY(sParty_Athena), }, [TRAINER_HARRISON] = @@ -6946,7 +6945,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Harrison), + .party = TRAINER_PARTY(sParty_Harrison), }, [TRAINER_GRUNT_MT_CHIMNEY_2] = @@ -6958,7 +6957,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMtChimney2), + .party = TRAINER_PARTY(sParty_GruntMtChimney2), }, [TRAINER_CLARENCE] = @@ -6970,7 +6969,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Clarence), + .party = TRAINER_PARTY(sParty_Clarence), }, [TRAINER_TERRY] = @@ -6982,7 +6981,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Terry), + .party = TRAINER_PARTY(sParty_Terry), }, [TRAINER_NATE] = @@ -6994,7 +6993,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Nate), + .party = TRAINER_PARTY(sParty_Nate), }, [TRAINER_KATHLEEN] = @@ -7006,7 +7005,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Kathleen), + .party = TRAINER_PARTY(sParty_Kathleen), }, [TRAINER_CLIFFORD] = @@ -7018,7 +7017,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Clifford), + .party = TRAINER_PARTY(sParty_Clifford), }, [TRAINER_NICHOLAS] = @@ -7030,7 +7029,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Nicholas), + .party = TRAINER_PARTY(sParty_Nicholas), }, [TRAINER_GRUNT_SPACE_CENTER_3] = @@ -7042,7 +7041,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntSpaceCenter3), + .party = TRAINER_PARTY(sParty_GruntSpaceCenter3), }, [TRAINER_GRUNT_SPACE_CENTER_4] = @@ -7054,7 +7053,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntSpaceCenter4), + .party = TRAINER_PARTY(sParty_GruntSpaceCenter4), }, [TRAINER_GRUNT_SPACE_CENTER_5] = @@ -7066,7 +7065,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntSpaceCenter5), + .party = TRAINER_PARTY(sParty_GruntSpaceCenter5), }, [TRAINER_GRUNT_SPACE_CENTER_6] = @@ -7078,7 +7077,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntSpaceCenter6), + .party = TRAINER_PARTY(sParty_GruntSpaceCenter6), }, [TRAINER_GRUNT_SPACE_CENTER_7] = @@ -7090,7 +7089,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntSpaceCenter7), + .party = TRAINER_PARTY(sParty_GruntSpaceCenter7), }, [TRAINER_MACEY] = @@ -7102,7 +7101,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Macey), + .party = TRAINER_PARTY(sParty_Macey), }, [TRAINER_BRENDAN_RUSTBORO_TREECKO] = @@ -7114,7 +7113,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_BrendanRustboroTreecko), + .party = TRAINER_PARTY(sParty_BrendanRustboroTreecko), }, [TRAINER_BRENDAN_RUSTBORO_MUDKIP] = @@ -7126,7 +7125,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_BrendanRustboroMudkip), + .party = TRAINER_PARTY(sParty_BrendanRustboroMudkip), }, [TRAINER_PAXTON] = @@ -7138,7 +7137,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Paxton), + .party = TRAINER_PARTY(sParty_Paxton), }, [TRAINER_ISABELLA] = @@ -7150,7 +7149,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Isabella), + .party = TRAINER_PARTY(sParty_Isabella), }, [TRAINER_GRUNT_WEATHER_INST_5] = @@ -7162,7 +7161,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntWeatherInst5), + .party = TRAINER_PARTY(sParty_GruntWeatherInst5), }, [TRAINER_TABITHA_MT_CHIMNEY] = @@ -7174,7 +7173,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_TabithaMtChimney), + .party = TRAINER_PARTY(sParty_TabithaMtChimney), }, [TRAINER_JONATHAN] = @@ -7186,7 +7185,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_SETUP_FIRST_TURN, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jonathan), + .party = TRAINER_PARTY(sParty_Jonathan), }, [TRAINER_BRENDAN_RUSTBORO_TORCHIC] = @@ -7198,7 +7197,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_BrendanRustboroTorchic), + .party = TRAINER_PARTY(sParty_BrendanRustboroTorchic), }, [TRAINER_MAY_RUSTBORO_MUDKIP] = @@ -7210,7 +7209,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_SETUP_FIRST_TURN, - .party = NO_ITEM_DEFAULT_MOVES(sParty_MayRustboroMudkip), + .party = TRAINER_PARTY(sParty_MayRustboroMudkip), }, [TRAINER_MAXIE_MAGMA_HIDEOUT] = @@ -7222,7 +7221,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_SUPER_POTION, ITEM_SUPER_POTION, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_MaxieMagmaHideout), + .party = TRAINER_PARTY(sParty_MaxieMagmaHideout), }, [TRAINER_MAXIE_MT_CHIMNEY] = @@ -7234,7 +7233,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_SUPER_POTION, ITEM_SUPER_POTION, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_MaxieMtChimney), + .party = TRAINER_PARTY(sParty_MaxieMtChimney), }, [TRAINER_TIANA] = @@ -7246,7 +7245,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Tiana), + .party = TRAINER_PARTY(sParty_Tiana), }, [TRAINER_HALEY_1] = @@ -7258,7 +7257,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Haley1), + .party = TRAINER_PARTY(sParty_Haley1), }, [TRAINER_JANICE] = @@ -7270,7 +7269,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Janice), + .party = TRAINER_PARTY(sParty_Janice), }, [TRAINER_VIVI] = @@ -7282,7 +7281,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Vivi), + .party = TRAINER_PARTY(sParty_Vivi), }, [TRAINER_HALEY_2] = @@ -7294,7 +7293,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Haley2), + .party = TRAINER_PARTY(sParty_Haley2), }, [TRAINER_HALEY_3] = @@ -7306,7 +7305,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Haley3), + .party = TRAINER_PARTY(sParty_Haley3), }, [TRAINER_HALEY_4] = @@ -7318,7 +7317,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Haley4), + .party = TRAINER_PARTY(sParty_Haley4), }, [TRAINER_HALEY_5] = @@ -7330,7 +7329,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Haley5), + .party = TRAINER_PARTY(sParty_Haley5), }, [TRAINER_SALLY] = @@ -7342,7 +7341,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Sally), + .party = TRAINER_PARTY(sParty_Sally), }, [TRAINER_ROBIN] = @@ -7354,7 +7353,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Robin), + .party = TRAINER_PARTY(sParty_Robin), }, [TRAINER_ANDREA] = @@ -7366,7 +7365,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Andrea), + .party = TRAINER_PARTY(sParty_Andrea), }, [TRAINER_CRISSY] = @@ -7378,7 +7377,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Crissy), + .party = TRAINER_PARTY(sParty_Crissy), }, [TRAINER_RICK] = @@ -7390,7 +7389,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Rick), + .party = TRAINER_PARTY(sParty_Rick), }, [TRAINER_LYLE] = @@ -7402,7 +7401,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Lyle), + .party = TRAINER_PARTY(sParty_Lyle), }, [TRAINER_JOSE] = @@ -7414,7 +7413,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jose), + .party = TRAINER_PARTY(sParty_Jose), }, [TRAINER_DOUG] = @@ -7426,7 +7425,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Doug), + .party = TRAINER_PARTY(sParty_Doug), }, [TRAINER_GREG] = @@ -7438,7 +7437,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Greg), + .party = TRAINER_PARTY(sParty_Greg), }, [TRAINER_KENT] = @@ -7450,7 +7449,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Kent), + .party = TRAINER_PARTY(sParty_Kent), }, [TRAINER_JAMES_1] = @@ -7462,7 +7461,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_James1), + .party = TRAINER_PARTY(sParty_James1), }, [TRAINER_JAMES_2] = @@ -7474,7 +7473,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_James2), + .party = TRAINER_PARTY(sParty_James2), }, [TRAINER_JAMES_3] = @@ -7486,7 +7485,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_James3), + .party = TRAINER_PARTY(sParty_James3), }, [TRAINER_JAMES_4] = @@ -7498,7 +7497,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_James4), + .party = TRAINER_PARTY(sParty_James4), }, [TRAINER_JAMES_5] = @@ -7510,7 +7509,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_James5), + .party = TRAINER_PARTY(sParty_James5), }, [TRAINER_BRICE] = @@ -7522,7 +7521,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Brice), + .party = TRAINER_PARTY(sParty_Brice), }, [TRAINER_TRENT_1] = @@ -7534,7 +7533,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Trent1), + .party = TRAINER_PARTY(sParty_Trent1), }, [TRAINER_LENNY] = @@ -7546,7 +7545,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Lenny), + .party = TRAINER_PARTY(sParty_Lenny), }, [TRAINER_LUCAS_1] = @@ -7558,7 +7557,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Lucas1), + .party = TRAINER_PARTY(sParty_Lucas1), }, [TRAINER_ALAN] = @@ -7570,7 +7569,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Alan), + .party = TRAINER_PARTY(sParty_Alan), }, [TRAINER_CLARK] = @@ -7582,7 +7581,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Clark), + .party = TRAINER_PARTY(sParty_Clark), }, [TRAINER_ERIC] = @@ -7594,7 +7593,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Eric), + .party = TRAINER_PARTY(sParty_Eric), }, [TRAINER_LUCAS_2] = @@ -7606,7 +7605,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Lucas2), + .party = TRAINER_PARTY(sParty_Lucas2), }, [TRAINER_MIKE_1] = @@ -7618,7 +7617,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Mike1), + .party = TRAINER_PARTY(sParty_Mike1), }, [TRAINER_MIKE_2] = @@ -7630,7 +7629,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Mike2), + .party = TRAINER_PARTY(sParty_Mike2), }, [TRAINER_TRENT_2] = @@ -7642,7 +7641,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Trent2), + .party = TRAINER_PARTY(sParty_Trent2), }, [TRAINER_TRENT_3] = @@ -7654,7 +7653,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Trent3), + .party = TRAINER_PARTY(sParty_Trent3), }, [TRAINER_TRENT_4] = @@ -7666,7 +7665,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Trent4), + .party = TRAINER_PARTY(sParty_Trent4), }, [TRAINER_TRENT_5] = @@ -7678,7 +7677,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Trent5), + .party = TRAINER_PARTY(sParty_Trent5), }, [TRAINER_DEZ_AND_LUKE] = @@ -7690,7 +7689,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_DezAndLuke), + .party = TRAINER_PARTY(sParty_DezAndLuke), }, [TRAINER_LEA_AND_JED] = @@ -7702,7 +7701,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_LeaAndJed), + .party = TRAINER_PARTY(sParty_LeaAndJed), }, [TRAINER_KIRA_AND_DAN_1] = @@ -7714,7 +7713,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_KiraAndDan1), + .party = TRAINER_PARTY(sParty_KiraAndDan1), }, [TRAINER_KIRA_AND_DAN_2] = @@ -7726,7 +7725,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_KiraAndDan2), + .party = TRAINER_PARTY(sParty_KiraAndDan2), }, [TRAINER_KIRA_AND_DAN_3] = @@ -7738,7 +7737,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_KiraAndDan3), + .party = TRAINER_PARTY(sParty_KiraAndDan3), }, [TRAINER_KIRA_AND_DAN_4] = @@ -7750,7 +7749,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_KiraAndDan4), + .party = TRAINER_PARTY(sParty_KiraAndDan4), }, [TRAINER_KIRA_AND_DAN_5] = @@ -7762,7 +7761,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_KiraAndDan5), + .party = TRAINER_PARTY(sParty_KiraAndDan5), }, [TRAINER_JOHANNA] = @@ -7774,7 +7773,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Johanna), + .party = TRAINER_PARTY(sParty_Johanna), }, [TRAINER_GERALD] = @@ -7786,7 +7785,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Gerald), + .party = TRAINER_PARTY(sParty_Gerald), }, [TRAINER_VIVIAN] = @@ -7798,7 +7797,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Vivian), + .party = TRAINER_PARTY(sParty_Vivian), }, [TRAINER_DANIELLE] = @@ -7810,7 +7809,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Danielle), + .party = TRAINER_PARTY(sParty_Danielle), }, [TRAINER_HIDEO] = @@ -7822,7 +7821,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Hideo), + .party = TRAINER_PARTY(sParty_Hideo), }, [TRAINER_KEIGO] = @@ -7834,7 +7833,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Keigo), + .party = TRAINER_PARTY(sParty_Keigo), }, [TRAINER_RILEY] = @@ -7846,7 +7845,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Riley), + .party = TRAINER_PARTY(sParty_Riley), }, [TRAINER_FLINT] = @@ -7858,7 +7857,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Flint), + .party = TRAINER_PARTY(sParty_Flint), }, [TRAINER_ASHLEY] = @@ -7870,7 +7869,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Ashley), + .party = TRAINER_PARTY(sParty_Ashley), }, [TRAINER_WALLY_MAUVILLE] = @@ -7882,7 +7881,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_WallyMauville), + .party = TRAINER_PARTY(sParty_WallyMauville), }, [TRAINER_WALLY_VR_2] = @@ -7894,7 +7893,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_CUSTOM_MOVES(sParty_WallyVR2), + .party = TRAINER_PARTY(sParty_WallyVR2), }, [TRAINER_WALLY_VR_3] = @@ -7906,7 +7905,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_CUSTOM_MOVES(sParty_WallyVR3), + .party = TRAINER_PARTY(sParty_WallyVR3), }, [TRAINER_WALLY_VR_4] = @@ -7918,7 +7917,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_CUSTOM_MOVES(sParty_WallyVR4), + .party = TRAINER_PARTY(sParty_WallyVR4), }, [TRAINER_WALLY_VR_5] = @@ -7930,7 +7929,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_CUSTOM_MOVES(sParty_WallyVR5), + .party = TRAINER_PARTY(sParty_WallyVR5), }, [TRAINER_BRENDAN_LILYCOVE_MUDKIP] = @@ -7942,7 +7941,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_BrendanLilycoveMudkip), + .party = TRAINER_PARTY(sParty_BrendanLilycoveMudkip), }, [TRAINER_BRENDAN_LILYCOVE_TREECKO] = @@ -7954,7 +7953,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_BrendanLilycoveTreecko), + .party = TRAINER_PARTY(sParty_BrendanLilycoveTreecko), }, [TRAINER_BRENDAN_LILYCOVE_TORCHIC] = @@ -7966,7 +7965,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_BrendanLilycoveTorchic), + .party = TRAINER_PARTY(sParty_BrendanLilycoveTorchic), }, [TRAINER_MAY_LILYCOVE_MUDKIP] = @@ -7978,7 +7977,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_MayLilycoveMudkip), + .party = TRAINER_PARTY(sParty_MayLilycoveMudkip), }, [TRAINER_MAY_LILYCOVE_TREECKO] = @@ -7990,7 +7989,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_MayLilycoveTreecko), + .party = TRAINER_PARTY(sParty_MayLilycoveTreecko), }, [TRAINER_MAY_LILYCOVE_TORCHIC] = @@ -8002,7 +8001,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_MayLilycoveTorchic), + .party = TRAINER_PARTY(sParty_MayLilycoveTorchic), }, [TRAINER_JONAH] = @@ -8014,7 +8013,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jonah), + .party = TRAINER_PARTY(sParty_Jonah), }, [TRAINER_HENRY] = @@ -8026,7 +8025,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Henry), + .party = TRAINER_PARTY(sParty_Henry), }, [TRAINER_ROGER] = @@ -8038,7 +8037,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Roger), + .party = TRAINER_PARTY(sParty_Roger), }, [TRAINER_ALEXA] = @@ -8050,7 +8049,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Alexa), + .party = TRAINER_PARTY(sParty_Alexa), }, [TRAINER_RUBEN] = @@ -8062,7 +8061,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Ruben), + .party = TRAINER_PARTY(sParty_Ruben), }, [TRAINER_KOJI_1] = @@ -8074,7 +8073,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Koji1), + .party = TRAINER_PARTY(sParty_Koji1), }, [TRAINER_WAYNE] = @@ -8086,7 +8085,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Wayne), + .party = TRAINER_PARTY(sParty_Wayne), }, [TRAINER_AIDAN] = @@ -8098,7 +8097,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Aidan), + .party = TRAINER_PARTY(sParty_Aidan), }, [TRAINER_REED] = @@ -8110,7 +8109,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Reed), + .party = TRAINER_PARTY(sParty_Reed), }, [TRAINER_TISHA] = @@ -8122,7 +8121,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Tisha), + .party = TRAINER_PARTY(sParty_Tisha), }, [TRAINER_TORI_AND_TIA] = @@ -8134,7 +8133,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_ToriAndTia), + .party = TRAINER_PARTY(sParty_ToriAndTia), }, [TRAINER_KIM_AND_IRIS] = @@ -8146,7 +8145,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_KimAndIris), + .party = TRAINER_PARTY(sParty_KimAndIris), }, [TRAINER_TYRA_AND_IVY] = @@ -8158,7 +8157,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_TyraAndIvy), + .party = TRAINER_PARTY(sParty_TyraAndIvy), }, [TRAINER_MEL_AND_PAUL] = @@ -8170,7 +8169,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_CUSTOM_MOVES(sParty_MelAndPaul), + .party = TRAINER_PARTY(sParty_MelAndPaul), }, [TRAINER_JOHN_AND_JAY_1] = @@ -8182,7 +8181,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_CUSTOM_MOVES(sParty_JohnAndJay1), + .party = TRAINER_PARTY(sParty_JohnAndJay1), }, [TRAINER_JOHN_AND_JAY_2] = @@ -8194,7 +8193,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_CUSTOM_MOVES(sParty_JohnAndJay2), + .party = TRAINER_PARTY(sParty_JohnAndJay2), }, [TRAINER_JOHN_AND_JAY_3] = @@ -8206,7 +8205,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_CUSTOM_MOVES(sParty_JohnAndJay3), + .party = TRAINER_PARTY(sParty_JohnAndJay3), }, [TRAINER_JOHN_AND_JAY_4] = @@ -8218,7 +8217,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_SETUP_FIRST_TURN, - .party = NO_ITEM_CUSTOM_MOVES(sParty_JohnAndJay4), + .party = TRAINER_PARTY(sParty_JohnAndJay4), }, [TRAINER_JOHN_AND_JAY_5] = @@ -8230,7 +8229,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_CUSTOM_MOVES(sParty_JohnAndJay5), + .party = TRAINER_PARTY(sParty_JohnAndJay5), }, [TRAINER_RELI_AND_IAN] = @@ -8242,7 +8241,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_ReliAndIan), + .party = TRAINER_PARTY(sParty_ReliAndIan), }, [TRAINER_LILA_AND_ROY_1] = @@ -8254,7 +8253,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_LilaAndRoy1), + .party = TRAINER_PARTY(sParty_LilaAndRoy1), }, [TRAINER_LILA_AND_ROY_2] = @@ -8266,7 +8265,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_LilaAndRoy2), + .party = TRAINER_PARTY(sParty_LilaAndRoy2), }, [TRAINER_LILA_AND_ROY_3] = @@ -8278,7 +8277,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_LilaAndRoy3), + .party = TRAINER_PARTY(sParty_LilaAndRoy3), }, [TRAINER_LILA_AND_ROY_4] = @@ -8290,7 +8289,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_LilaAndRoy4), + .party = TRAINER_PARTY(sParty_LilaAndRoy4), }, [TRAINER_LILA_AND_ROY_5] = @@ -8302,7 +8301,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_LilaAndRoy5), + .party = TRAINER_PARTY(sParty_LilaAndRoy5), }, [TRAINER_LISA_AND_RAY] = @@ -8314,7 +8313,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_LisaAndRay), + .party = TRAINER_PARTY(sParty_LisaAndRay), }, [TRAINER_CHRIS] = @@ -8326,7 +8325,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Chris), + .party = TRAINER_PARTY(sParty_Chris), }, [TRAINER_DAWSON] = @@ -8338,7 +8337,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Dawson), + .party = TRAINER_PARTY(sParty_Dawson), }, [TRAINER_SARAH] = @@ -8350,7 +8349,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Sarah), + .party = TRAINER_PARTY(sParty_Sarah), }, [TRAINER_DARIAN] = @@ -8362,7 +8361,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Darian), + .party = TRAINER_PARTY(sParty_Darian), }, [TRAINER_HAILEY] = @@ -8374,7 +8373,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Hailey), + .party = TRAINER_PARTY(sParty_Hailey), }, [TRAINER_CHANDLER] = @@ -8386,7 +8385,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Chandler), + .party = TRAINER_PARTY(sParty_Chandler), }, [TRAINER_KALEB] = @@ -8398,7 +8397,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = ITEM_DEFAULT_MOVES(sParty_Kaleb), + .party = TRAINER_PARTY(sParty_Kaleb), }, [TRAINER_JOSEPH] = @@ -8410,7 +8409,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Joseph), + .party = TRAINER_PARTY(sParty_Joseph), }, [TRAINER_ALYSSA] = @@ -8422,7 +8421,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Alyssa), + .party = TRAINER_PARTY(sParty_Alyssa), }, [TRAINER_MARCOS] = @@ -8434,7 +8433,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Marcos), + .party = TRAINER_PARTY(sParty_Marcos), }, [TRAINER_RHETT] = @@ -8446,7 +8445,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Rhett), + .party = TRAINER_PARTY(sParty_Rhett), }, [TRAINER_TYRON] = @@ -8458,7 +8457,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Tyron), + .party = TRAINER_PARTY(sParty_Tyron), }, [TRAINER_CELINA] = @@ -8470,7 +8469,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Celina), + .party = TRAINER_PARTY(sParty_Celina), }, [TRAINER_BIANCA] = @@ -8482,7 +8481,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Bianca), + .party = TRAINER_PARTY(sParty_Bianca), }, [TRAINER_HAYDEN] = @@ -8494,7 +8493,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Hayden), + .party = TRAINER_PARTY(sParty_Hayden), }, [TRAINER_SOPHIE] = @@ -8506,7 +8505,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Sophie), + .party = TRAINER_PARTY(sParty_Sophie), }, [TRAINER_COBY] = @@ -8518,7 +8517,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Coby), + .party = TRAINER_PARTY(sParty_Coby), }, [TRAINER_LAWRENCE] = @@ -8530,7 +8529,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Lawrence), + .party = TRAINER_PARTY(sParty_Lawrence), }, [TRAINER_WYATT] = @@ -8542,7 +8541,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Wyatt), + .party = TRAINER_PARTY(sParty_Wyatt), }, [TRAINER_ANGELINA] = @@ -8554,7 +8553,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Angelina), + .party = TRAINER_PARTY(sParty_Angelina), }, [TRAINER_KAI] = @@ -8566,7 +8565,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Kai), + .party = TRAINER_PARTY(sParty_Kai), }, [TRAINER_CHARLOTTE] = @@ -8578,7 +8577,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Charlotte), + .party = TRAINER_PARTY(sParty_Charlotte), }, [TRAINER_DEANDRE] = @@ -8590,7 +8589,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Deandre), + .party = TRAINER_PARTY(sParty_Deandre), }, [TRAINER_GRUNT_MAGMA_HIDEOUT_1] = @@ -8602,7 +8601,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMagmaHideout1), + .party = TRAINER_PARTY(sParty_GruntMagmaHideout1), }, [TRAINER_GRUNT_MAGMA_HIDEOUT_2] = @@ -8614,7 +8613,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMagmaHideout2), + .party = TRAINER_PARTY(sParty_GruntMagmaHideout2), }, [TRAINER_GRUNT_MAGMA_HIDEOUT_3] = @@ -8626,7 +8625,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMagmaHideout3), + .party = TRAINER_PARTY(sParty_GruntMagmaHideout3), }, [TRAINER_GRUNT_MAGMA_HIDEOUT_4] = @@ -8638,7 +8637,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMagmaHideout4), + .party = TRAINER_PARTY(sParty_GruntMagmaHideout4), }, [TRAINER_GRUNT_MAGMA_HIDEOUT_5] = @@ -8650,7 +8649,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMagmaHideout5), + .party = TRAINER_PARTY(sParty_GruntMagmaHideout5), }, [TRAINER_GRUNT_MAGMA_HIDEOUT_6] = @@ -8662,7 +8661,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMagmaHideout6), + .party = TRAINER_PARTY(sParty_GruntMagmaHideout6), }, [TRAINER_GRUNT_MAGMA_HIDEOUT_7] = @@ -8674,7 +8673,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMagmaHideout7), + .party = TRAINER_PARTY(sParty_GruntMagmaHideout7), }, [TRAINER_GRUNT_MAGMA_HIDEOUT_8] = @@ -8686,7 +8685,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMagmaHideout8), + .party = TRAINER_PARTY(sParty_GruntMagmaHideout8), }, [TRAINER_GRUNT_MAGMA_HIDEOUT_9] = @@ -8698,7 +8697,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMagmaHideout9), + .party = TRAINER_PARTY(sParty_GruntMagmaHideout9), }, [TRAINER_GRUNT_MAGMA_HIDEOUT_10] = @@ -8710,7 +8709,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMagmaHideout10), + .party = TRAINER_PARTY(sParty_GruntMagmaHideout10), }, [TRAINER_GRUNT_MAGMA_HIDEOUT_11] = @@ -8722,7 +8721,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMagmaHideout11), + .party = TRAINER_PARTY(sParty_GruntMagmaHideout11), }, [TRAINER_GRUNT_MAGMA_HIDEOUT_12] = @@ -8734,7 +8733,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMagmaHideout12), + .party = TRAINER_PARTY(sParty_GruntMagmaHideout12), }, [TRAINER_GRUNT_MAGMA_HIDEOUT_13] = @@ -8746,7 +8745,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMagmaHideout13), + .party = TRAINER_PARTY(sParty_GruntMagmaHideout13), }, [TRAINER_GRUNT_MAGMA_HIDEOUT_14] = @@ -8758,7 +8757,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMagmaHideout14), + .party = TRAINER_PARTY(sParty_GruntMagmaHideout14), }, [TRAINER_GRUNT_MAGMA_HIDEOUT_15] = @@ -8770,7 +8769,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMagmaHideout15), + .party = TRAINER_PARTY(sParty_GruntMagmaHideout15), }, [TRAINER_GRUNT_MAGMA_HIDEOUT_16] = @@ -8782,7 +8781,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_GruntMagmaHideout16), + .party = TRAINER_PARTY(sParty_GruntMagmaHideout16), }, [TRAINER_TABITHA_MAGMA_HIDEOUT] = @@ -8794,7 +8793,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_TabithaMagmaHideout), + .party = TRAINER_PARTY(sParty_TabithaMagmaHideout), }, [TRAINER_DARCY] = @@ -8806,7 +8805,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Darcy), + .party = TRAINER_PARTY(sParty_Darcy), }, [TRAINER_MAXIE_MOSSDEEP] = @@ -8818,7 +8817,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_MaxieMossdeep), + .party = TRAINER_PARTY(sParty_MaxieMossdeep), }, [TRAINER_PETE] = @@ -8830,7 +8829,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Pete), + .party = TRAINER_PARTY(sParty_Pete), }, [TRAINER_ISABELLE] = @@ -8842,7 +8841,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Isabelle), + .party = TRAINER_PARTY(sParty_Isabelle), }, [TRAINER_ANDRES_1] = @@ -8854,7 +8853,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Andres1), + .party = TRAINER_PARTY(sParty_Andres1), }, [TRAINER_JOSUE] = @@ -8866,7 +8865,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Josue), + .party = TRAINER_PARTY(sParty_Josue), }, [TRAINER_CAMRON] = @@ -8878,7 +8877,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Camron), + .party = TRAINER_PARTY(sParty_Camron), }, [TRAINER_CORY_1] = @@ -8890,7 +8889,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cory1), + .party = TRAINER_PARTY(sParty_Cory1), }, [TRAINER_CAROLINA] = @@ -8902,7 +8901,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Carolina), + .party = TRAINER_PARTY(sParty_Carolina), }, [TRAINER_ELIJAH] = @@ -8914,7 +8913,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Elijah), + .party = TRAINER_PARTY(sParty_Elijah), }, [TRAINER_CELIA] = @@ -8926,7 +8925,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Celia), + .party = TRAINER_PARTY(sParty_Celia), }, [TRAINER_BRYAN] = @@ -8938,7 +8937,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Bryan), + .party = TRAINER_PARTY(sParty_Bryan), }, [TRAINER_BRANDEN] = @@ -8950,7 +8949,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Branden), + .party = TRAINER_PARTY(sParty_Branden), }, [TRAINER_BRYANT] = @@ -8962,7 +8961,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Bryant), + .party = TRAINER_PARTY(sParty_Bryant), }, [TRAINER_SHAYLA] = @@ -8974,7 +8973,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Shayla), + .party = TRAINER_PARTY(sParty_Shayla), }, [TRAINER_KYRA] = @@ -8986,7 +8985,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Kyra), + .party = TRAINER_PARTY(sParty_Kyra), }, [TRAINER_JAIDEN] = @@ -8998,7 +8997,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Jaiden), + .party = TRAINER_PARTY(sParty_Jaiden), }, [TRAINER_ALIX] = @@ -9010,7 +9009,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Alix), + .party = TRAINER_PARTY(sParty_Alix), }, [TRAINER_HELENE] = @@ -9022,7 +9021,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Helene), + .party = TRAINER_PARTY(sParty_Helene), }, [TRAINER_MARLENE] = @@ -9034,7 +9033,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Marlene), + .party = TRAINER_PARTY(sParty_Marlene), }, [TRAINER_DEVAN] = @@ -9046,7 +9045,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Devan), + .party = TRAINER_PARTY(sParty_Devan), }, [TRAINER_JOHNSON] = @@ -9058,7 +9057,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Johnson), + .party = TRAINER_PARTY(sParty_Johnson), }, [TRAINER_MELINA] = @@ -9070,7 +9069,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Melina), + .party = TRAINER_PARTY(sParty_Melina), }, [TRAINER_BRANDI] = @@ -9082,7 +9081,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Brandi), + .party = TRAINER_PARTY(sParty_Brandi), }, [TRAINER_AISHA] = @@ -9094,7 +9093,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Aisha), + .party = TRAINER_PARTY(sParty_Aisha), }, [TRAINER_MAKAYLA] = @@ -9106,7 +9105,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Makayla), + .party = TRAINER_PARTY(sParty_Makayla), }, [TRAINER_FABIAN] = @@ -9118,7 +9117,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Fabian), + .party = TRAINER_PARTY(sParty_Fabian), }, [TRAINER_DAYTON] = @@ -9130,7 +9129,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Dayton), + .party = TRAINER_PARTY(sParty_Dayton), }, [TRAINER_RACHEL] = @@ -9142,7 +9141,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Rachel), + .party = TRAINER_PARTY(sParty_Rachel), }, [TRAINER_LEONEL] = @@ -9154,7 +9153,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_CUSTOM_MOVES(sParty_Leonel), + .party = TRAINER_PARTY(sParty_Leonel), }, [TRAINER_CALLIE] = @@ -9166,7 +9165,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Callie), + .party = TRAINER_PARTY(sParty_Callie), }, [TRAINER_CALE] = @@ -9178,7 +9177,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cale), + .party = TRAINER_PARTY(sParty_Cale), }, [TRAINER_MYLES] = @@ -9190,7 +9189,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Myles), + .party = TRAINER_PARTY(sParty_Myles), }, [TRAINER_PAT] = @@ -9202,7 +9201,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Pat), + .party = TRAINER_PARTY(sParty_Pat), }, [TRAINER_CRISTIN_1] = @@ -9214,7 +9213,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cristin1), + .party = TRAINER_PARTY(sParty_Cristin1), }, [TRAINER_MAY_RUSTBORO_TREECKO] = @@ -9226,7 +9225,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_MayRustboroTreecko), + .party = TRAINER_PARTY(sParty_MayRustboroTreecko), }, [TRAINER_MAY_RUSTBORO_TORCHIC] = @@ -9238,7 +9237,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_MayRustboroTorchic), + .party = TRAINER_PARTY(sParty_MayRustboroTorchic), }, [TRAINER_ROXANNE_2] = @@ -9250,7 +9249,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Roxanne2), + .party = TRAINER_PARTY(sParty_Roxanne2), }, [TRAINER_ROXANNE_3] = @@ -9262,7 +9261,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Roxanne3), + .party = TRAINER_PARTY(sParty_Roxanne3), }, [TRAINER_ROXANNE_4] = @@ -9274,7 +9273,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Roxanne4), + .party = TRAINER_PARTY(sParty_Roxanne4), }, [TRAINER_ROXANNE_5] = @@ -9286,7 +9285,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Roxanne5), + .party = TRAINER_PARTY(sParty_Roxanne5), }, [TRAINER_BRAWLY_2] = @@ -9298,7 +9297,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Brawly2), + .party = TRAINER_PARTY(sParty_Brawly2), }, [TRAINER_BRAWLY_3] = @@ -9310,7 +9309,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Brawly3), + .party = TRAINER_PARTY(sParty_Brawly3), }, [TRAINER_BRAWLY_4] = @@ -9322,7 +9321,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Brawly4), + .party = TRAINER_PARTY(sParty_Brawly4), }, [TRAINER_BRAWLY_5] = @@ -9334,7 +9333,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Brawly5), + .party = TRAINER_PARTY(sParty_Brawly5), }, [TRAINER_WATTSON_2] = @@ -9346,7 +9345,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Wattson2), + .party = TRAINER_PARTY(sParty_Wattson2), }, [TRAINER_WATTSON_3] = @@ -9358,7 +9357,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Wattson3), + .party = TRAINER_PARTY(sParty_Wattson3), }, [TRAINER_WATTSON_4] = @@ -9370,7 +9369,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Wattson4), + .party = TRAINER_PARTY(sParty_Wattson4), }, [TRAINER_WATTSON_5] = @@ -9382,7 +9381,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Wattson5), + .party = TRAINER_PARTY(sParty_Wattson5), }, [TRAINER_FLANNERY_2] = @@ -9394,7 +9393,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Flannery2), + .party = TRAINER_PARTY(sParty_Flannery2), }, [TRAINER_FLANNERY_3] = @@ -9406,7 +9405,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Flannery3), + .party = TRAINER_PARTY(sParty_Flannery3), }, [TRAINER_FLANNERY_4] = @@ -9418,7 +9417,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Flannery4), + .party = TRAINER_PARTY(sParty_Flannery4), }, [TRAINER_FLANNERY_5] = @@ -9430,7 +9429,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Flannery5), + .party = TRAINER_PARTY(sParty_Flannery5), }, [TRAINER_NORMAN_2] = @@ -9442,7 +9441,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Norman2), + .party = TRAINER_PARTY(sParty_Norman2), }, [TRAINER_NORMAN_3] = @@ -9454,7 +9453,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Norman3), + .party = TRAINER_PARTY(sParty_Norman3), }, [TRAINER_NORMAN_4] = @@ -9466,7 +9465,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Norman4), + .party = TRAINER_PARTY(sParty_Norman4), }, [TRAINER_NORMAN_5] = @@ -9478,7 +9477,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Norman5), + .party = TRAINER_PARTY(sParty_Norman5), }, [TRAINER_WINONA_2] = @@ -9490,7 +9489,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY | AI_FLAG_RISKY, - .party = ITEM_CUSTOM_MOVES(sParty_Winona2), + .party = TRAINER_PARTY(sParty_Winona2), }, [TRAINER_WINONA_3] = @@ -9502,7 +9501,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY | AI_FLAG_RISKY, - .party = ITEM_CUSTOM_MOVES(sParty_Winona3), + .party = TRAINER_PARTY(sParty_Winona3), }, [TRAINER_WINONA_4] = @@ -9514,7 +9513,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY | AI_FLAG_RISKY, - .party = ITEM_CUSTOM_MOVES(sParty_Winona4), + .party = TRAINER_PARTY(sParty_Winona4), }, [TRAINER_WINONA_5] = @@ -9526,7 +9525,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY | AI_FLAG_RISKY, - .party = ITEM_CUSTOM_MOVES(sParty_Winona5), + .party = TRAINER_PARTY(sParty_Winona5), }, [TRAINER_TATE_AND_LIZA_2] = @@ -9538,7 +9537,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_TateAndLiza2), + .party = TRAINER_PARTY(sParty_TateAndLiza2), }, [TRAINER_TATE_AND_LIZA_3] = @@ -9550,7 +9549,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_TateAndLiza3), + .party = TRAINER_PARTY(sParty_TateAndLiza3), }, [TRAINER_TATE_AND_LIZA_4] = @@ -9562,7 +9561,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_TateAndLiza4), + .party = TRAINER_PARTY(sParty_TateAndLiza4), }, [TRAINER_TATE_AND_LIZA_5] = @@ -9574,7 +9573,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_TateAndLiza5), + .party = TRAINER_PARTY(sParty_TateAndLiza5), }, [TRAINER_JUAN_2] = @@ -9586,7 +9585,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Juan2), + .party = TRAINER_PARTY(sParty_Juan2), }, [TRAINER_JUAN_3] = @@ -9598,7 +9597,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Juan3), + .party = TRAINER_PARTY(sParty_Juan3), }, [TRAINER_JUAN_4] = @@ -9610,7 +9609,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Juan4), + .party = TRAINER_PARTY(sParty_Juan4), }, [TRAINER_JUAN_5] = @@ -9622,7 +9621,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_NONE}, .doubleBattle = TRUE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Juan5), + .party = TRAINER_PARTY(sParty_Juan5), }, [TRAINER_ANGELO] = @@ -9634,7 +9633,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Angelo), + .party = TRAINER_PARTY(sParty_Angelo), }, [TRAINER_DARIUS] = @@ -9646,7 +9645,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Darius), + .party = TRAINER_PARTY(sParty_Darius), }, [TRAINER_STEVEN] = @@ -9658,7 +9657,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE, ITEM_FULL_RESTORE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = ITEM_CUSTOM_MOVES(sParty_Steven), + .party = TRAINER_PARTY(sParty_Steven), }, [TRAINER_ANABEL] = @@ -9670,7 +9669,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Anabel), + .party = TRAINER_PARTY(sParty_Anabel), }, [TRAINER_TUCKER] = @@ -9682,7 +9681,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Tucker), + .party = TRAINER_PARTY(sParty_Tucker), }, [TRAINER_SPENSER] = @@ -9694,7 +9693,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Spenser), + .party = TRAINER_PARTY(sParty_Spenser), }, [TRAINER_GRETA] = @@ -9706,7 +9705,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Greta), + .party = TRAINER_PARTY(sParty_Greta), }, [TRAINER_NOLAND] = @@ -9718,7 +9717,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Noland), + .party = TRAINER_PARTY(sParty_Noland), }, [TRAINER_LUCY] = @@ -9730,7 +9729,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Lucy), + .party = TRAINER_PARTY(sParty_Lucy), }, [TRAINER_BRANDON] = @@ -9742,7 +9741,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Brandon), + .party = TRAINER_PARTY(sParty_Brandon), }, [TRAINER_ANDRES_2] = @@ -9754,7 +9753,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Andres2), + .party = TRAINER_PARTY(sParty_Andres2), }, [TRAINER_ANDRES_3] = @@ -9766,7 +9765,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Andres3), + .party = TRAINER_PARTY(sParty_Andres3), }, [TRAINER_ANDRES_4] = @@ -9778,7 +9777,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Andres4), + .party = TRAINER_PARTY(sParty_Andres4), }, [TRAINER_ANDRES_5] = @@ -9790,7 +9789,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Andres5), + .party = TRAINER_PARTY(sParty_Andres5), }, [TRAINER_CORY_2] = @@ -9802,7 +9801,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cory2), + .party = TRAINER_PARTY(sParty_Cory2), }, [TRAINER_CORY_3] = @@ -9814,7 +9813,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cory3), + .party = TRAINER_PARTY(sParty_Cory3), }, [TRAINER_CORY_4] = @@ -9826,7 +9825,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cory4), + .party = TRAINER_PARTY(sParty_Cory4), }, [TRAINER_CORY_5] = @@ -9838,7 +9837,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cory5), + .party = TRAINER_PARTY(sParty_Cory5), }, [TRAINER_PABLO_2] = @@ -9850,7 +9849,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Pablo2), + .party = TRAINER_PARTY(sParty_Pablo2), }, [TRAINER_PABLO_3] = @@ -9862,7 +9861,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Pablo3), + .party = TRAINER_PARTY(sParty_Pablo3), }, [TRAINER_PABLO_4] = @@ -9874,7 +9873,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Pablo4), + .party = TRAINER_PARTY(sParty_Pablo4), }, [TRAINER_PABLO_5] = @@ -9886,7 +9885,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Pablo5), + .party = TRAINER_PARTY(sParty_Pablo5), }, [TRAINER_KOJI_2] = @@ -9898,7 +9897,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Koji2), + .party = TRAINER_PARTY(sParty_Koji2), }, [TRAINER_KOJI_3] = @@ -9910,7 +9909,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Koji3), + .party = TRAINER_PARTY(sParty_Koji3), }, [TRAINER_KOJI_4] = @@ -9922,7 +9921,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Koji4), + .party = TRAINER_PARTY(sParty_Koji4), }, [TRAINER_KOJI_5] = @@ -9934,7 +9933,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Koji5), + .party = TRAINER_PARTY(sParty_Koji5), }, [TRAINER_CRISTIN_2] = @@ -9946,7 +9945,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cristin2), + .party = TRAINER_PARTY(sParty_Cristin2), }, [TRAINER_CRISTIN_3] = @@ -9958,7 +9957,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cristin3), + .party = TRAINER_PARTY(sParty_Cristin3), }, [TRAINER_CRISTIN_4] = @@ -9970,7 +9969,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cristin4), + .party = TRAINER_PARTY(sParty_Cristin4), }, [TRAINER_CRISTIN_5] = @@ -9982,7 +9981,7 @@ const struct Trainer gTrainers[] = { .items = {ITEM_HYPER_POTION, ITEM_NONE, ITEM_NONE, ITEM_NONE}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Cristin5), + .party = TRAINER_PARTY(sParty_Cristin5), }, [TRAINER_FERNANDO_2] = @@ -9994,7 +9993,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Fernando2), + .party = TRAINER_PARTY(sParty_Fernando2), }, [TRAINER_FERNANDO_3] = @@ -10006,7 +10005,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Fernando3), + .party = TRAINER_PARTY(sParty_Fernando3), }, [TRAINER_FERNANDO_4] = @@ -10018,7 +10017,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Fernando4), + .party = TRAINER_PARTY(sParty_Fernando4), }, [TRAINER_FERNANDO_5] = @@ -10030,7 +10029,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Fernando5), + .party = TRAINER_PARTY(sParty_Fernando5), }, [TRAINER_SAWYER_2] = @@ -10042,7 +10041,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Sawyer2), + .party = TRAINER_PARTY(sParty_Sawyer2), }, [TRAINER_SAWYER_3] = @@ -10054,7 +10053,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Sawyer3), + .party = TRAINER_PARTY(sParty_Sawyer3), }, [TRAINER_SAWYER_4] = @@ -10066,7 +10065,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Sawyer4), + .party = TRAINER_PARTY(sParty_Sawyer4), }, [TRAINER_SAWYER_5] = @@ -10078,7 +10077,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Sawyer5), + .party = TRAINER_PARTY(sParty_Sawyer5), }, [TRAINER_GABRIELLE_2] = @@ -10090,7 +10089,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Gabrielle2), + .party = TRAINER_PARTY(sParty_Gabrielle2), }, [TRAINER_GABRIELLE_3] = @@ -10102,7 +10101,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Gabrielle3), + .party = TRAINER_PARTY(sParty_Gabrielle3), }, [TRAINER_GABRIELLE_4] = @@ -10114,7 +10113,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Gabrielle4), + .party = TRAINER_PARTY(sParty_Gabrielle4), }, [TRAINER_GABRIELLE_5] = @@ -10126,7 +10125,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Gabrielle5), + .party = TRAINER_PARTY(sParty_Gabrielle5), }, [TRAINER_THALIA_2] = @@ -10138,7 +10137,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Thalia2), + .party = TRAINER_PARTY(sParty_Thalia2), }, [TRAINER_THALIA_3] = @@ -10150,7 +10149,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Thalia3), + .party = TRAINER_PARTY(sParty_Thalia3), }, [TRAINER_THALIA_4] = @@ -10162,7 +10161,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Thalia4), + .party = TRAINER_PARTY(sParty_Thalia4), }, [TRAINER_THALIA_5] = @@ -10174,7 +10173,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = AI_FLAG_CHECK_BAD_MOVE, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Thalia5), + .party = TRAINER_PARTY(sParty_Thalia5), }, [TRAINER_MARIELA] = @@ -10186,7 +10185,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = 0, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Mariela), + .party = TRAINER_PARTY(sParty_Mariela), }, [TRAINER_ALVARO] = @@ -10198,7 +10197,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = 0, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Alvaro), + .party = TRAINER_PARTY(sParty_Alvaro), }, [TRAINER_EVERETT] = @@ -10210,7 +10209,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = 0, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Everett), + .party = TRAINER_PARTY(sParty_Everett), }, [TRAINER_RED] = @@ -10222,7 +10221,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = 0, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Red), + .party = TRAINER_PARTY(sParty_Red), }, [TRAINER_LEAF] = @@ -10234,7 +10233,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = 0, - .party = NO_ITEM_DEFAULT_MOVES(sParty_Leaf), + .party = TRAINER_PARTY(sParty_Leaf), }, [TRAINER_BRENDAN_PLACEHOLDER] = @@ -10246,7 +10245,7 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = 0, - .party = NO_ITEM_DEFAULT_MOVES(sParty_BrendanLinkPlaceholder), + .party = TRAINER_PARTY(sParty_BrendanLinkPlaceholder), }, [TRAINER_MAY_PLACEHOLDER] = @@ -10258,6 +10257,6 @@ const struct Trainer gTrainers[] = { .items = {}, .doubleBattle = FALSE, .aiFlags = 0, - .party = NO_ITEM_DEFAULT_MOVES(sParty_MayLinkPlaceholder), + .party = TRAINER_PARTY(sParty_MayLinkPlaceholder), }, }; diff --git a/src/daycare.c b/src/daycare.c index 2b4311734737..6078135fd73a 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -32,7 +32,6 @@ extern const struct Evolution gEvolutionTable[][EVOS_PER_MON]; static void ClearDaycareMonMail(struct DaycareMail *mail); static void SetInitialEggData(struct Pokemon *mon, u16 species, struct DayCare *daycare); -static u8 GetDaycareCompatibilityScore(struct DayCare *daycare); static void DaycarePrintMonInfo(u8 windowId, u32 daycareSlotId, u8 y); static u8 ModifyBreedingScoreForOvalCharm(u8 score); static u8 GetEggMoves(struct Pokemon *pokemon, u16 *eggMoves); @@ -100,16 +99,14 @@ static const u8 sJapaneseEggNickname[] = _("タマゴ"); // "tamago" ("egg" in J u8 *GetMonNickname2(struct Pokemon *mon, u8 *dest) { - u8 nickname[POKEMON_NAME_LENGTH * 2]; - + u8 nickname[POKEMON_NAME_BUFFER_SIZE]; GetMonData(mon, MON_DATA_NICKNAME, nickname); return StringCopy_Nickname(dest, nickname); } u8 *GetBoxMonNickname(struct BoxPokemon *mon, u8 *dest) { - u8 nickname[POKEMON_NAME_LENGTH * 2]; - + u8 nickname[POKEMON_NAME_BUFFER_SIZE]; GetBoxMonData(mon, MON_DATA_NICKNAME, nickname); return StringCopy_Nickname(dest, nickname); } @@ -153,7 +150,7 @@ void InitDaycareMailRecordMixing(struct DayCare *daycare, struct RecordMixingDay mixMail->numDaycareMons = numDaycareMons; } -static s8 Daycare_FindEmptySpot(struct DayCare *daycare) +s8 Daycare_FindEmptySpot(struct DayCare *daycare) { u8 i; @@ -195,7 +192,7 @@ static void TransferEggMoves(void) { if (k == i || !GetBoxMonData(&gSaveBlock1Ptr->daycare.mons[k].mon, MON_DATA_SANITY_HAS_SPECIES)) continue; - + // Check if you can inherit from them if (GetBoxMonData(&gSaveBlock1Ptr->daycare.mons[k].mon, MON_DATA_SPECIES) != GetBoxMonData(&gSaveBlock1Ptr->daycare.mons[i].mon, MON_DATA_SPECIES) #if P_EGG_MOVE_TRANSFER >= GEN_9 @@ -495,7 +492,7 @@ static s32 GetParentToInheritNature(struct DayCare *daycare) if (ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[i].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE #if P_NATURE_INHERITANCE == GEN_3 && (GetBoxMonGender(&daycare->mons[i].mon) == MON_FEMALE || IS_DITTO(GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SPECIES))) - #endif + #endif ) { slot = i; numWithEverstone++; @@ -605,7 +602,7 @@ static void InheritIVs(struct Pokemon *egg, struct DayCare *daycare) } start = 0; - if (ItemId_GetHoldEffect(motherItem) == HOLD_EFFECT_POWER_ITEM && + if (ItemId_GetHoldEffect(motherItem) == HOLD_EFFECT_POWER_ITEM && ItemId_GetHoldEffect(fatherItem) == HOLD_EFFECT_POWER_ITEM) { whichParents[0] = Random() % DAYCARE_MON_COUNT; @@ -614,14 +611,14 @@ static void InheritIVs(struct Pokemon *egg, struct DayCare *daycare) RemoveIVIndexFromList(availableIVs, selectedIvs[0]); start++; } - else if (ItemId_GetHoldEffect(motherItem) == HOLD_EFFECT_POWER_ITEM) + else if (ItemId_GetHoldEffect(motherItem) == HOLD_EFFECT_POWER_ITEM) { whichParents[0] = 0; selectedIvs[0] = ItemId_GetSecondaryId(motherItem); RemoveIVIndexFromList(availableIVs, selectedIvs[0]); start++; } - else if (ItemId_GetHoldEffect(fatherItem) == HOLD_EFFECT_POWER_ITEM) + else if (ItemId_GetHoldEffect(fatherItem) == HOLD_EFFECT_POWER_ITEM) { whichParents[0] = 1; selectedIvs[0] = ItemId_GetSecondaryId(fatherItem); @@ -1163,12 +1160,12 @@ static bool8 IsEggPending(struct DayCare *daycare) // gStringVar3 = first mon trainer's name static void _GetDaycareMonNicknames(struct DayCare *daycare) { - u8 text[12]; + u8 otName[max(12, PLAYER_NAME_LENGTH + 1)]; if (GetBoxMonData(&daycare->mons[0].mon, MON_DATA_SPECIES) != 0) { GetBoxMonNickname(&daycare->mons[0].mon, gStringVar1); - GetBoxMonData(&daycare->mons[0].mon, MON_DATA_OT_NAME, text); - StringCopy(gStringVar3, text); + GetBoxMonData(&daycare->mons[0].mon, MON_DATA_OT_NAME, otName); + StringCopy(gStringVar3, otName); } if (GetBoxMonData(&daycare->mons[1].mon, MON_DATA_SPECIES) != 0) @@ -1232,7 +1229,7 @@ static bool8 EggGroupsOverlap(u16 *eggGroups1, u16 *eggGroups2) return FALSE; } -static u8 GetDaycareCompatibilityScore(struct DayCare *daycare) +u8 GetDaycareCompatibilityScore(struct DayCare *daycare) { u32 i; u16 eggGroups[DAYCARE_MON_COUNT][EGG_GROUPS_PER_MON]; @@ -1363,7 +1360,7 @@ static u8 *AppendMonGenderSymbol(u8 *name, struct BoxPokemon *boxMon) static void GetDaycareLevelMenuText(struct DayCare *daycare, u8 *dest) { - u8 monNames[DAYCARE_MON_COUNT][20]; + u8 monNames[DAYCARE_MON_COUNT][POKEMON_NAME_BUFFER_SIZE]; u8 i; *dest = EOS; @@ -1421,8 +1418,7 @@ static void DaycareAddTextPrinter(u8 windowId, const u8 *text, u32 x, u32 y) static void DaycarePrintMonNickname(struct DayCare *daycare, u8 windowId, u32 daycareSlotId, u32 y) { - u8 nickname[POKEMON_NAME_LENGTH * 2]; - + u8 nickname[POKEMON_NAME_BUFFER_SIZE]; GetBoxMonNickname(&daycare->mons[daycareSlotId].mon, nickname); AppendMonGenderSymbol(nickname, &daycare->mons[daycareSlotId].mon); DaycareAddTextPrinter(windowId, nickname, 8, y); diff --git a/src/debug.c b/src/debug.c index 43ebb01a8264..f915235d8b64 100644 --- a/src/debug.c +++ b/src/debug.c @@ -8,6 +8,7 @@ //Jaizu: https://jaizu.moe/ #include "global.h" #include "battle.h" +#include "battle_setup.h" #include "coins.h" #include "credits.h" #include "data.h" @@ -48,7 +49,9 @@ #include "string_util.h" #include "task.h" #include "pokemon_summary_screen.h" +#include "wild_encounter.h" #include "constants/abilities.h" +#include "constants/battle_ai.h" #include "constants/battle_frontier.h" #include "constants/flags.h" #include "constants/items.h" @@ -65,9 +68,10 @@ enum { // Main DEBUG_MENU_ITEM_UTILITIES, DEBUG_MENU_ITEM_SCRIPTS, - DEBUG_MENU_ITEM_FLAGS, - DEBUG_MENU_ITEM_VARS, + DEBUG_MENU_ITEM_FLAGVAR, + //DEBUG_MENU_ITEM_BATTLE, DEBUG_MENU_ITEM_GIVE, + DEBUG_MENU_ITEM_FILL, DEBUG_MENU_ITEM_SOUND, DEBUG_MENU_ITEM_ACCESS_PC, DEBUG_MENU_ITEM_CANCEL @@ -76,7 +80,6 @@ enum { // Util DEBUG_UTIL_MENU_ITEM_HEAL_PARTY, DEBUG_UTIL_MENU_ITEM_FLY, DEBUG_UTIL_MENU_ITEM_WARP, - DEBUG_UTIL_MENU_ITEM_RUNNING_SHOES, DEBUG_UTIL_MENU_ITEM_POISON_MONS, DEBUG_UTIL_MENU_ITEM_SAVEBLOCK, DEBUG_UTIL_MENU_ITEM_WEATHER, @@ -87,6 +90,8 @@ enum { // Util DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER, DEBUG_UTIL_MENU_ITEM_TRAINER_ID, DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES, + DEBUG_UTIL_MENU_ITEM_CHEAT, + DEBUG_UTIL_MENU_ITEM_HATCH_AN_EGG, }; enum { // Scripts DEBUG_UTIL_MENU_ITEM_SCRIPT_1, @@ -98,23 +103,63 @@ enum { // Scripts DEBUG_UTIL_MENU_ITEM_SCRIPT_7, DEBUG_UTIL_MENU_ITEM_SCRIPT_8, }; -enum { // Flags - DEBUG_FLAG_MENU_ITEM_FLAGS, - DEBUG_FLAG_MENU_ITEM_POKEDEXFLAGS, - DEBUG_FLAG_MENU_ITEM_POKEDEXONOFF, - DEBUG_FLAG_MENU_ITEM_NATDEXONOFF, - DEBUG_FLAG_MENU_ITEM_POKENAVONOFF, - DEBUG_FLAG_MENU_ITEM_FLYANYWHERE, - DEBUG_FLAG_MENU_ITEM_GETALLBADGES, - DEBUG_FLAG_MENU_ITEM_FRONTIER_PASS, - DEBUG_FLAG_MENU_ITEM_COLISSION_ONOFF, - DEBUG_FLAG_MENU_ITEM_ENCOUNTER_ONOFF, - DEBUG_FLAG_MENU_ITEM_TRAINER_SEE_ONOFF, - DEBUG_FLAG_MENU_ITEM_BAG_USE_ONOFF, - DEBUG_FLAG_MENU_ITEM_CATCHING_ONOFF, +enum { // Flags and Vars + DEBUG_FLAGVAR_MENU_ITEM_FLAGS, + DEBUG_FLAGVAR_MENU_ITEM_VARS, + DEBUG_FLAGVAR_MENU_ITEM_DEXFLAGS_ALL, + DEBUG_FLAGVAR_MENU_ITEM_DEXFLAGS_RESET, + DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_POKEDEX, + DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_NATDEX, + DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_POKENAV, + DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_RUN_SHOES, + DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_LOCATIONS, + DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BADGES_ALL, + DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_FRONTIER_PASS, + DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_COLISSION, + DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_ENCOUNTER, + DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_TRAINER_SEE, + DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BAG_USE, + DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_CATCHING, }; -enum { // Vars - DEBUG_VARS_MENU_ITEM_VARS, +enum { // Battle 0 Type + DEBUG_BATTLE_0_MENU_ITEM_WILD, + DEBUG_BATTLE_0_MENU_ITEM_WILD_DOUBLE, + DEBUG_BATTLE_0_MENU_ITEM_SINGLE, + DEBUG_BATTLE_0_MENU_ITEM_DOUBLE, + DEBUG_BATTLE_0_MENU_ITEM_MULTI, +}; +enum { // Battle 1 AI FLags + DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_00, + DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_01, + DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_02, + DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_03, + DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_04, + DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_05, + DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_06, + DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_07, + DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_08, + DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_09, + DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_10, + DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_11, + DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_12, + DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_13, + DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_14, + DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_15, + DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_16, + DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_17, + DEBUG_BATTLE_1_MENU_ITEM_CONTINUE, +}; +enum { // Battle 2 Terrain + DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_0, + DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_1, + DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_2, + DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_3, + DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_4, + DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_5, + DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_6, + DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_7, + DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_8, + DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_9, }; enum { // Give DEBUG_GIVE_MENU_ITEM_ITEM_X, @@ -125,8 +170,16 @@ enum { // Give DEBUG_GIVE_MENU_ITEM_MAX_COINS, DEBUG_GIVE_MENU_ITEM_MAX_BATTLE_POINTS, DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG, - DEBUG_GIVE_MENU_ITEM_FILL_PC, - DEBUG_GIVE_MENU_ITEM_CHEAT, +}; +enum { // Give Fill + DEBUG_FILL_MENU_ITEM_PC_BOXES_FAST, + DEBUG_FILL_MENU_ITEM_PC_BOXES_SLOW, + DEBUG_FILL_MENU_ITEM_PC_ITEMS, + DEBUG_FILL_MENU_ITEM_POCKET_ITEMS, + DEBUG_FILL_MENU_ITEM_POCKET_BALLS, + DEBUG_FILL_MENU_ITEM_POCKET_TMHM, + DEBUG_FILL_MENU_ITEM_POCKET_BERRIES, + DEBUG_FILL_MENU_ITEM_POCKET_KEY_ITEMS, }; enum { //Sound DEBUG_SOUND_MENU_ITEM_SE, @@ -135,15 +188,20 @@ enum { //Sound // ******************************* // Constants -#define DEBUG_MAIN_MENU_WIDTH 15 -#define DEBUG_MAIN_MENU_HEIGHT 8 +#define DEBUG_MENU_WIDTH_MAIN 16 +#define DEBUG_MENU_HEIGHT_MAIN 9 + +#define DEBUG_MENU_WIDTH_EXTRA 10 +#define DEBUG_MENU_HEIGHT_EXTRA 4 -#define DEBUG_NUMBER_DISPLAY_WIDTH 10 -#define DEBUG_NUMBER_DISPLAY_HEIGHT 4 -#define DEBUG_NUMBER_DISPLAY_MEDIUM_WIDTH 15 -#define DEBUG_NUMBER_DISPLAY_MEDIUM_HEIGHT 3 -#define DEBUG_NUMBER_DISPLAY_SOUND_WIDTH 20 -#define DEBUG_NUMBER_DISPLAY_SOUND_HEIGHT 6 +#define DEBUG_MENU_WIDTH_WEATHER 15 +#define DEBUG_MENU_HEIGHT_WEATHER 3 + +#define DEBUG_MENU_WIDTH_SOUND 20 +#define DEBUG_MENU_HEIGHT_SOUND 6 + +#define DEBUG_MENU_WIDTH_FLAGVAR 4 +#define DEBUG_MENU_HEIGHT_FLAGVAR 2 #define DEBUG_NUMBER_DIGITS_FLAGS 4 #define DEBUG_NUMBER_DIGITS_VARIABLES 5 @@ -154,8 +212,7 @@ enum { //Sound #define DEBUG_NUMBER_ICON_X 210 #define DEBUG_NUMBER_ICON_Y 50 -// EWRAM -static EWRAM_DATA struct DebugMonData *sDebugMonData = NULL; +#define DEBUG_MAX_MENU_ITEMS 50 // ******************************* struct DebugMonData @@ -177,14 +234,41 @@ struct DebugMonData u16 mon_move_3; }; +struct DebugMenuListData +{ + struct ListMenuItem listItems[20 + 1]; + u8 itemNames[DEBUG_MAX_MENU_ITEMS + 1][26]; + u8 listId; +}; + +struct DebugBattleData +{ + u8 submenu; + u8 battleType; + u8 battleTerrain; + bool8 aiFlags[AI_FLAG_COUNT]; +}; + +// EWRAM +static EWRAM_DATA struct DebugMonData *sDebugMonData = NULL; +static EWRAM_DATA struct DebugMenuListData *sDebugMenuListData = NULL; +static EWRAM_DATA struct DebugBattleData *sDebugBattleData = NULL; +EWRAM_DATA bool8 gIsDebugBattle = FALSE; +EWRAM_DATA u32 gDebugAIFlags = 0; + // ******************************* // Define functions +static void Debug_ReShowMainMenu(void); static void Debug_ShowMenu(void (*HandleInput)(u8), struct ListMenuTemplate LMtemplate); -void Debug_ShowMainMenu(void); +static void Debug_ShowMenuDynamic(u8 taskId); static void Debug_DestroyMenu(u8 taskId); static void Debug_DestroyMenu_Full(u8 taskId); static void DebugAction_Cancel(u8 taskId); static void DebugAction_DestroyExtraWindow(u8 taskId); +static void DebugTask_HandleMenuInput(u8 taskId, void (*HandleInput)(u8)); +static void Debug_InitDebugBattleData(void); +static void Debug_RefreshListMenu(u8 taskId); +static void Debug_RedrawListMenu(u8 taskId); static void DebugAction_Util_Script_1(u8 taskId); static void DebugAction_Util_Script_2(u8 taskId); @@ -197,16 +281,19 @@ static void DebugAction_Util_Script_8(u8 taskId); static void DebugAction_OpenUtilitiesMenu(u8 taskId); static void DebugAction_OpenScriptsMenu(u8 taskId); -static void DebugAction_OpenFlagsMenu(u8 taskId); -static void DebugAction_OpenVariablesMenu(u8 taskId); +static void DebugAction_OpenFlagsVarsMenu(u8 taskId); +static void DebugAction_OpenBattleMenu(u8 taskId); static void DebugAction_OpenGiveMenu(u8 taskId); +static void DebugAction_OpenFillMenu(u8 taskId); static void DebugAction_OpenSoundMenu(u8 taskId); +static void DebugAction_AccessPC(u8 taskId); static void DebugTask_HandleMenuInput_Main(u8 taskId); static void DebugTask_HandleMenuInput_Utilities(u8 taskId); static void DebugTask_HandleMenuInput_Scripts(u8 taskId); -static void DebugTask_HandleMenuInput_Flags(u8 taskId); -static void DebugTask_HandleMenuInput_Vars(u8 taskId); +static void DebugTask_HandleMenuInput_FlagsVars(u8 taskId); +static void DebugTask_HandleMenuInput_Battle(u8 taskId); static void DebugTask_HandleMenuInput_Give(u8 taskId); +static void DebugTask_HandleMenuInput_Fill(u8 taskId); static void DebugTask_HandleMenuInput_Sound(u8 taskId); static void DebugAction_Util_HealParty(u8 taskId); @@ -215,7 +302,7 @@ static void DebugAction_Util_Warp_Warp(u8 taskId); static void DebugAction_Util_Warp_SelectMapGroup(u8 taskId); static void DebugAction_Util_Warp_SelectMap(u8 taskId); static void DebugAction_Util_Warp_SelectWarp(u8 taskId); -static void DebugAction_Util_RunningShoes(u8 taskId); +static void DebugAction_FlagsVars_RunningShoes(u8 taskId); static void DebugAction_Util_PoisonMons(u8 taskId); static void DebugAction_Util_CheckSaveBlock(u8 taskId); static void DebugAction_Util_Weather(u8 taskId); @@ -227,26 +314,29 @@ static void DebugAction_Util_Trainer_Name(u8 taskId); static void DebugAction_Util_Trainer_Gender(u8 taskId); static void DebugAction_Util_Trainer_Id(u8 taskId); static void DebugAction_Util_Clear_Boxes(u8 taskId); - -static void DebugAction_Flags_Flags(u8 taskId); -static void DebugAction_Flags_FlagsSelect(u8 taskId); - -static void DebugAction_Flags_SetPokedexFlags(u8 taskId); -static void DebugAction_Flags_SwitchDex(u8 taskId); -static void DebugAction_Flags_SwitchNatDex(u8 taskId); -static void DebugAction_Flags_SwitchPokeNav(u8 taskId); -static void DebugAction_Flags_ToggleFlyFlags(u8 taskId); -static void DebugAction_Flags_ToggleBadgeFlags(u8 taskId); -static void DebugAction_Flags_ToggleFrontierPass(u8 taskId); -static void DebugAction_Flags_CollisionOnOff(u8 taskId); -static void DebugAction_Flags_EncounterOnOff(u8 taskId); -static void DebugAction_Flags_TrainerSeeOnOff(u8 taskId); -static void DebugAction_Flags_BagUseOnOff(u8 taskId); -static void DebugAction_Flags_CatchingOnOff(u8 taskId); - -static void DebugAction_Vars_Vars(u8 taskId); -static void DebugAction_Vars_Select(u8 taskId); -static void DebugAction_Vars_SetValue(u8 taskId); +static void DebugAction_Util_CheatStart(u8 taskId); +static void DebugAction_Util_HatchAnEgg(u8 taskId); + +static void DebugAction_FlagsVars_Flags(u8 taskId); +static void DebugAction_FlagsVars_FlagsSelect(u8 taskId); +static void DebugAction_FlagsVars_Vars(u8 taskId); +static void DebugAction_FlagsVars_Select(u8 taskId); +static void DebugAction_FlagsVars_SetValue(u8 taskId); +static void DebugAction_FlagsVars_PokedexFlags_All(u8 taskId); +static void DebugAction_FlagsVars_PokedexFlags_Reset(u8 taskId); +static void DebugAction_FlagsVars_SwitchDex(u8 taskId); +static void DebugAction_FlagsVars_SwitchNatDex(u8 taskId); +static void DebugAction_FlagsVars_SwitchPokeNav(u8 taskId); +static void DebugAction_FlagsVars_ToggleFlyFlags(u8 taskId); +static void DebugAction_FlagsVars_ToggleBadgeFlags(u8 taskId); +static void DebugAction_FlagsVars_ToggleFrontierPass(u8 taskId); +static void DebugAction_FlagsVars_CollisionOnOff(u8 taskId); +static void DebugAction_FlagsVars_EncounterOnOff(u8 taskId); +static void DebugAction_FlagsVars_TrainerSeeOnOff(u8 taskId); +static void DebugAction_FlagsVars_BagUseOnOff(u8 taskId); +static void DebugAction_FlagsVars_CatchingOnOff(u8 taskId); + +static void Debug_InitializeBattle(u8 taskId); static void DebugAction_Give_Item(u8 taskId); static void DebugAction_Give_Item_SelectId(u8 taskId); @@ -266,134 +356,192 @@ static void DebugAction_Give_MaxMoney(u8 taskId); static void DebugAction_Give_MaxCoins(u8 taskId); static void DebugAction_Give_MaxBattlePoints(u8 taskId); static void DebugAction_Give_DayCareEgg(u8 taskId); -static void DebugAction_Give_FillPC(u8 taskId); -static void DebugAction_Give_CHEAT(u8 taskId); -static void DebugAction_AccessPC(u8 taskId); + +static void DebugAction_Fill_PCBoxes_Fast(u8 taskId); +static void DebugAction_Fill_PCBoxes_Slow(u8 taskId); +static void DebugAction_Fill_PCItemStorage(u8 taskId); +static void DebugAction_Fill_PocketItems(u8 taskId); +static void DebugAction_Fill_PocketPokeBalls(u8 taskId); +static void DebugAction_Fill_PocketTMHM(u8 taskId); +static void DebugAction_Fill_PocketBerries(u8 taskId); +static void DebugAction_Fill_PocketKeyItems(u8 taskId); static void DebugAction_Sound_SE(u8 taskId); static void DebugAction_Sound_SE_SelectId(u8 taskId); static void DebugAction_Sound_MUS(u8 taskId); static void DebugAction_Sound_MUS_SelectId(u8 taskId); -static void DebugTask_HandleMenuInput(u8 taskId, void (*HandleInput)(u8)); -static void DebugAction_OpenSubMenu(u8 taskId, struct ListMenuTemplate LMtemplate); - -extern u8 Debug_FlagsNotSetOverworldConfigMessage[]; -extern u8 Debug_FlagsNotSetBattleConfigMessage[]; -extern u8 Debug_Script_1[]; -extern u8 Debug_Script_2[]; -extern u8 Debug_Script_3[]; -extern u8 Debug_Script_4[]; -extern u8 Debug_Script_5[]; -extern u8 Debug_Script_6[]; -extern u8 Debug_Script_7[]; -extern u8 Debug_Script_8[]; - -extern u8 Debug_ShowFieldMessageStringVar4[]; -extern u8 Debug_CheatStart[]; -extern u8 PlayersHouse_2F_EventScript_SetWallClock[]; -extern u8 PlayersHouse_2F_EventScript_CheckWallClock[]; -extern u8 Debug_CheckSaveBlock[]; + +extern const u8 Debug_FlagsNotSetOverworldConfigMessage[]; +extern const u8 Debug_FlagsNotSetBattleConfigMessage[]; +extern const u8 Debug_Script_1[]; +extern const u8 Debug_Script_2[]; +extern const u8 Debug_Script_3[]; +extern const u8 Debug_Script_4[]; +extern const u8 Debug_Script_5[]; +extern const u8 Debug_Script_6[]; +extern const u8 Debug_Script_7[]; +extern const u8 Debug_Script_8[]; +extern const u8 DebugScript_DaycareMonsNotCompatible[]; +extern const u8 DebugScript_OneDaycareMons[]; +extern const u8 DebugScript_ZeroDaycareMons[]; + +extern const u8 Debug_ShowFieldMessageStringVar4[]; +extern const u8 Debug_CheatStart[]; +extern const u8 Debug_HatchAnEgg[]; +extern const u8 PlayersHouse_2F_EventScript_SetWallClock[]; +extern const u8 PlayersHouse_2F_EventScript_CheckWallClock[]; +extern const u8 Debug_CheckSaveBlock[]; +extern const u8 Debug_BoxFilledMessage[]; #include "data/map_group_count.h" // Text +// General +static const u8 sDebugText_True[] = _("TRUE"); +static const u8 sDebugText_False[] = _("FALSE"); +static const u8 sDebugText_Colored_True[] = _("{COLOR GREEN}TRUE"); +static const u8 sDebugText_Colored_False[] = _("{COLOR RED}FALSE"); +static const u8 sDebugText_Dashes[] = _("---"); +static const u8 sDebugText_Empty[] = _(""); +static const u8 sDebugText_Continue[] = _("Continue…{CLEAR_TO 110}{RIGHT_ARROW}"); // Main Menu -static const u8 sDebugText_Utilities[] = _("Utilities"); -static const u8 sDebugText_Scripts[] = _("Scripts"); -static const u8 sDebugText_Flags[] = _("Flags"); -static const u8 sDebugText_Vars[] = _("Variables"); -static const u8 sDebugText_Give[] = _("Give X"); -static const u8 sDebugText_Sound[] = _("Sound"); -static const u8 sDebugText_Cancel[] = _("Cancel"); +static const u8 sDebugText_Utilities[] = _("Utilities…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Scripts[] = _("Scripts…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_FlagsVars[] = _("Flags & Vars…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Battle[] = _("Battle Test{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Give[] = _("Give X…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Fill[] = _("Fill PC/Pockets…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Sound[] = _("Sound…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_AccessPC[] = _("Access PC…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Cancel[] = _("Cancel"); // Script menu -static const u8 sDebugText_Util_Script_1[] = _("Script 1"); -static const u8 sDebugText_Util_Script_2[] = _("Script 2"); -static const u8 sDebugText_Util_Script_3[] = _("Script 3"); -static const u8 sDebugText_Util_Script_4[] = _("Script 4"); -static const u8 sDebugText_Util_Script_5[] = _("Script 5"); -static const u8 sDebugText_Util_Script_6[] = _("Script 6"); -static const u8 sDebugText_Util_Script_7[] = _("Script 7"); -static const u8 sDebugText_Util_Script_8[] = _("Script 8"); +static const u8 sDebugText_Util_Script_1[] = _("Script 1"); +static const u8 sDebugText_Util_Script_2[] = _("Script 2"); +static const u8 sDebugText_Util_Script_3[] = _("Script 3"); +static const u8 sDebugText_Util_Script_4[] = _("Script 4"); +static const u8 sDebugText_Util_Script_5[] = _("Script 5"); +static const u8 sDebugText_Util_Script_6[] = _("Script 6"); +static const u8 sDebugText_Util_Script_7[] = _("Script 7"); +static const u8 sDebugText_Util_Script_8[] = _("Script 8"); // Util Menu -static const u8 sDebugText_Util_HealParty[] = _("Heal Party"); -static const u8 sDebugText_Util_Fly[] = _("Fly to map"); -static const u8 sDebugText_Util_WarpToMap[] = _("Warp to map warp"); -static const u8 sDebugText_Util_WarpToMap_SelectMapGroup[] = _("Group: {STR_VAR_1} \n \n\n{STR_VAR_3} "); -static const u8 sDebugText_Util_WarpToMap_SelectMap[] = _("Map: {STR_VAR_1} \nMapSec: \n{STR_VAR_2} \n{STR_VAR_3} "); -static const u8 sDebugText_Util_WarpToMap_SelectWarp[] = _("Warp: \n{STR_VAR_1} \n \n{STR_VAR_3} "); -static const u8 sDebugText_Util_WarpToMap_SelMax[] = _("{STR_VAR_1} / {STR_VAR_2}"); -static const u8 sDebugText_Util_RunningShoes[] = _("Toggle Running Shoes"); -static const u8 sDebugText_Util_PoisonMons[] = _("Poison all mons"); -static const u8 sDebugText_Util_SaveBlockSpace[] = _("SaveBlock Space"); -static const u8 sDebugText_Util_Weather[] = _("Set weather"); -static const u8 sDebugText_Util_Weather_ID[] = _("Weather Id: {STR_VAR_3}\n{STR_VAR_1}\n{STR_VAR_2}"); -static const u8 sDebugText_Util_CheckWallClock[] = _("Check Wall Clock"); -static const u8 sDebugText_Util_SetWallClock[] = _("Set Wall Clock"); -static const u8 sDebugText_Util_WatchCredits[] = _("Watch Credits"); -static const u8 sDebugText_Util_Trainer_Name[] = _("Trainer name"); -static const u8 sDebugText_Util_Trainer_Gender[] = _("Toggle T. Gender"); -static const u8 sDebugText_Util_Trainer_Id[] = _("New Trainer Id"); -static const u8 sDebugText_Util_Clear_Boxes[] = _("Clear Storage Boxes"); -// Flags Menu -static const u8 sDebugText_Flags_Flags[] = _("Set Flag XXXX"); -static const u8 sDebugText_Flags_SetPokedexFlags[] = _("All Pokédex Flags"); -static const u8 sDebugText_Flags_SwitchDex[] = _("Pokédex ON/OFF"); -static const u8 sDebugText_Flags_SwitchNationalDex[] = _("NatDex ON/OFF"); -static const u8 sDebugText_Flags_SwitchPokeNav[] = _("PokéNav ON/OFF"); -static const u8 sDebugText_Flags_ToggleFlyFlags[] = _("Fly Flags ON/OFF"); -static const u8 sDebugText_Flags_ToggleAllBadges[] = _("All badges ON/OFF"); -static const u8 sDebugText_Flags_ToggleFrontierPass[] = _("Frontier Pass ON/OFF"); -static const u8 sDebugText_Flags_SwitchCollision[] = _("Collision ON/OFF"); -static const u8 sDebugText_Flags_SwitchEncounter[] = _("Encounter ON/OFF"); -static const u8 sDebugText_Flags_SwitchTrainerSee[] = _("TrainerSee ON/OFF"); -static const u8 sDebugText_Flags_SwitchBagUse[] = _("BagUse ON/OFF"); -static const u8 sDebugText_Flags_SwitchCatching[] = _("Catching ON/OFF"); -static const u8 sDebugText_Flags_Flag[] = _("Flag: {STR_VAR_1} \n{STR_VAR_2} \n{STR_VAR_3}"); -static const u8 sDebugText_Flags_FlagHex[] = _("{STR_VAR_1} \n0x{STR_VAR_2} "); -static const u8 sDebugText_Flags_FlagSet[] = _("TRUE"); -static const u8 sDebugText_Flags_FlagUnset[] = _("FALSE"); -// Variables Menu -static const u8 sDebugText_Vars_Vars[] = _("Set Vars XXXX"); -static const u8 sDebugText_Vars_VariableHex[] = _("{STR_VAR_1} \n0x{STR_VAR_2} "); -static const u8 sDebugText_Vars_Variable[] = _("Var: {STR_VAR_1} \nVal: {STR_VAR_3} \n{STR_VAR_2}"); -static const u8 sDebugText_Vars_VariableValueSet[] = _("Var: {STR_VAR_1} \nVal: {STR_VAR_3} \n{STR_VAR_2}"); +static const u8 sDebugText_Util_HealParty[] = _("Heal Party"); +static const u8 sDebugText_Util_Fly[] = _("Fly to map…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Util_WarpToMap[] = _("Warp to map warp…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Util_WarpToMap_SelectMapGroup[] =_("Group: {STR_VAR_1}{CLEAR_TO 90}\n{CLEAR_TO 90}\n\n{STR_VAR_3}{CLEAR_TO 90}"); +static const u8 sDebugText_Util_WarpToMap_SelectMap[] = _("Map: {STR_VAR_1}{CLEAR_TO 90}\nMapSec:{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}\n{STR_VAR_3}{CLEAR_TO 90}"); +static const u8 sDebugText_Util_WarpToMap_SelectWarp[] = _("Warp:{CLEAR_TO 90}\n{STR_VAR_1}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_3}{CLEAR_TO 90}"); +static const u8 sDebugText_Util_WarpToMap_SelMax[] = _("{STR_VAR_1} / {STR_VAR_2}"); +static const u8 sDebugText_Util_PoisonMons[] = _("Poison all mons"); +static const u8 sDebugText_Util_SaveBlockSpace[] = _("SaveBlock Space…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Util_Weather[] = _("Set weather…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Util_Weather_ID[] = _("Weather Id: {STR_VAR_3}\n{STR_VAR_1}\n{STR_VAR_2}"); +static const u8 sDebugText_Util_CheckWallClock[] = _("Check Wall Clock…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Util_SetWallClock[] = _("Set Wall Clock…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Util_WatchCredits[] = _("Watch Credits…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Util_Trainer_Name[] = _("Trainer name"); +static const u8 sDebugText_Util_Trainer_Gender[] = _("Toggle T. Gender"); +static const u8 sDebugText_Util_Trainer_Id[] = _("New Trainer Id"); +static const u8 sDebugText_Util_Clear_Boxes[] = _("Clear Storage Boxes"); +static const u8 sDebugText_Util_CheatStart[] = _("CHEAT Start"); +static const u8 sDebugText_Util_HatchAnEgg[] = _("Hatch an Egg"); +// Flags/Vars Menu +static const u8 sDebugText_FlagsVars_Flags[] = _("Set Flag XYZ…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_FlagsVars_Flag[] = _("Flag: {STR_VAR_1}{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}\n{STR_VAR_3}"); +static const u8 sDebugText_FlagsVars_FlagHex[] = _("{STR_VAR_1}{CLEAR_TO 90}\n0x{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_FlagsVars_Vars[] = _("Set Var XYZ…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_FlagsVars_VariableHex[] = _("{STR_VAR_1}{CLEAR_TO 90}\n0x{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_FlagsVars_Variable[] = _("Var: {STR_VAR_1}{CLEAR_TO 90}\nVal: {STR_VAR_3}{CLEAR_TO 90}\n{STR_VAR_2}"); +static const u8 sDebugText_FlagsVars_VariableValueSet[] = _("Var: {STR_VAR_1}{CLEAR_TO 90}\nVal: {STR_VAR_3}{CLEAR_TO 90}\n{STR_VAR_2}"); +static const u8 sDebugText_FlagsVars_PokedexFlags_All[] = _("Pokédex Flags All"); +static const u8 sDebugText_FlagsVars_PokedexFlags_Reset[] = _("Pokédex Flags Reset"); +static const u8 sDebugText_FlagsVars_SwitchDex[] = _("Toggle {STR_VAR_1}Pokédex"); +static const u8 sDebugText_FlagsVars_SwitchNationalDex[] = _("Toggle {STR_VAR_1}NatDex"); +static const u8 sDebugText_FlagsVars_SwitchPokeNav[] = _("Toggle {STR_VAR_1}PokéNav"); +static const u8 sDebugText_FlagsVars_RunningShoes[] = _("Toggle {STR_VAR_1}Running Shoes"); +static const u8 sDebugText_FlagsVars_ToggleFlyFlags[] = _("Toggle {STR_VAR_1}Fly Flags"); +static const u8 sDebugText_FlagsVars_ToggleAllBadges[] = _("Toggle {STR_VAR_1}All badges"); +static const u8 sDebugText_FlagsVars_ToggleFrontierPass[] = _("Toggle {STR_VAR_1}Frontier Pass"); +static const u8 sDebugText_FlagsVars_SwitchCollision[] = _("Toggle {STR_VAR_1}Collision OFF"); +static const u8 sDebugText_FlagsVars_SwitchEncounter[] = _("Toggle {STR_VAR_1}Encounter OFF"); +static const u8 sDebugText_FlagsVars_SwitchTrainerSee[] = _("Toggle {STR_VAR_1}TrainerSee OFF"); +static const u8 sDebugText_FlagsVars_SwitchBagUse[] = _("Toggle {STR_VAR_1}BagUse OFF"); +static const u8 sDebugText_FlagsVars_SwitchCatching[] = _("Toggle {STR_VAR_1}Catching OFF"); +// Battle +static const u8 sDebugText_Battle_0_Wild[] = _("Wild…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Battle_0_WildDouble[] = _("Wild Double…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Battle_0_Single[] = _("Single…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Battle_0_Double[] = _("Double…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Battle_0_Mulit[] = _("Multi…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Battle_1_AIFlag_00[] = _("{STR_VAR_1}Check bad move"); +static const u8 sDebugText_Battle_1_AIFlag_01[] = _("{STR_VAR_1}Try to faint"); +static const u8 sDebugText_Battle_1_AIFlag_02[] = _("{STR_VAR_1}Check viability"); +static const u8 sDebugText_Battle_1_AIFlag_03[] = _("{STR_VAR_1}Setup first turn"); +static const u8 sDebugText_Battle_1_AIFlag_04[] = _("{STR_VAR_1}Risky"); +static const u8 sDebugText_Battle_1_AIFlag_05[] = _("{STR_VAR_1}Prefer strongest move"); +static const u8 sDebugText_Battle_1_AIFlag_06[] = _("{STR_VAR_1}Prefer baton pass"); +static const u8 sDebugText_Battle_1_AIFlag_07[] = _("{STR_VAR_1}Double battle"); +static const u8 sDebugText_Battle_1_AIFlag_08[] = _("{STR_VAR_1}Hp aware"); +static const u8 sDebugText_Battle_1_AIFlag_09[] = _("{STR_VAR_1}Negate unaware"); +static const u8 sDebugText_Battle_1_AIFlag_10[] = _("{STR_VAR_1}Will suicide"); +static const u8 sDebugText_Battle_1_AIFlag_11[] = _("{STR_VAR_1}Help partner"); +static const u8 sDebugText_Battle_1_AIFlag_12[] = _("{STR_VAR_1}Prefer status moves"); +static const u8 sDebugText_Battle_1_AIFlag_13[] = _("{STR_VAR_1}Stall"); +static const u8 sDebugText_Battle_1_AIFlag_14[] = _("{STR_VAR_1}Screener"); +static const u8 sDebugText_Battle_1_AIFlag_15[] = _("{STR_VAR_1}Smart switching"); +static const u8 sDebugText_Battle_1_AIFlag_16[] = _("{STR_VAR_1}Ace pokemon"); +static const u8 sDebugText_Battle_1_AIFlag_17[] = _("{STR_VAR_1}Omniscient"); +static const u8 sDebugText_Battle_2_Terrain_0[] = _("Grass…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Battle_2_Terrain_1[] = _("Long grass…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Battle_2_Terrain_2[] = _("Sand…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Battle_2_Terrain_3[] = _("Underwater…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Battle_2_Terrain_4[] = _("Water…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Battle_2_Terrain_5[] = _("Pond…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Battle_2_Terrain_6[] = _("Mountain…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Battle_2_Terrain_7[] = _("Cave…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Battle_2_Terrain_8[] = _("Building…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Battle_2_Terrain_9[] = _("Plain…{CLEAR_TO 110}{RIGHT_ARROW}"); // Give Menu -static const u8 sDebugText_Give_GiveItem[] = _("Give item XXXX"); -static const u8 sDebugText_ItemQuantity[] = _("Quantity: \n{STR_VAR_1} \n\n{STR_VAR_2}"); -static const u8 sDebugText_ItemID[] = _("Item Id: {STR_VAR_3}\n{STR_VAR_1} \n\n{STR_VAR_2}"); -static const u8 sDebugText_Give_AllTMs[] = _("Give all TMs"); -static const u8 sDebugText_Give_GivePokemonSimple[] = _("Pkm(lvl)"); -static const u8 sDebugText_Give_GivePokemonComplex[] = _("Pkm(l,s,n,a,IV,mov)"); -static const u8 sDebugText_PokemonID[] = _("Species: {STR_VAR_3}\n{STR_VAR_1} \n\n{STR_VAR_2}"); -static const u8 sDebugText_PokemonLevel[] = _("Level: \n{STR_VAR_1} \n \n{STR_VAR_2}"); -static const u8 sDebugText_PokemonShiny[] = _("Shiny: \n {STR_VAR_2} \n \n "); -static const u8 sDebugText_PokemonNature[] = _("NatureId: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); -static const u8 sDebugText_PokemonAbility[] = _("AbilityNum: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); -static const u8 sDebugText_PokemonIVs[] = _("All IVs: \n {STR_VAR_3} \n \n{STR_VAR_2} "); -static const u8 sDebugText_PokemonIV_0[] = _("IV HP: \n {STR_VAR_3} \n \n{STR_VAR_2} "); -static const u8 sDebugText_PokemonIV_1[] = _("IV Attack: \n {STR_VAR_3} \n \n{STR_VAR_2} "); -static const u8 sDebugText_PokemonIV_2[] = _("IV Defense: \n {STR_VAR_3} \n \n{STR_VAR_2} "); -static const u8 sDebugText_PokemonIV_3[] = _("IV Speed: \n {STR_VAR_3} \n \n{STR_VAR_2} "); -static const u8 sDebugText_PokemonIV_4[] = _("IV Sp. Attack: \n {STR_VAR_3} \n \n{STR_VAR_2} "); -static const u8 sDebugText_PokemonIV_5[] = _("IV Sp. Defense: \n {STR_VAR_3} \n \n{STR_VAR_2} "); -static const u8 sDebugText_PokemonMove_0[] = _("Move 0: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); -static const u8 sDebugText_PokemonMove_1[] = _("Move 1: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); -static const u8 sDebugText_PokemonMove_2[] = _("Move 2: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); -static const u8 sDebugText_PokemonMove_3[] = _("Move 3: {STR_VAR_3} \n{STR_VAR_1} \n \n{STR_VAR_2}"); -static const u8 sDebugText_Give_MaxMoney[] = _("Max Money"); -static const u8 sDebugText_Give_MaxCoins[] = _("Max Coins"); -static const u8 sDebugText_Give_BattlePoints[] = _("Max Battle Points"); -static const u8 sDebugText_Give_DaycareEgg[] = _("Daycare Egg"); -static const u8 sDebugText_Give_FillPc[] = _("Fill Pc"); -static const u8 sDebugText_Give_GiveCHEAT[] = _("CHEAT Start"); -static const u8 sDebugText_AccessPC[] = _("Access PC"); +static const u8 sDebugText_Give_GiveItem[] = _("Give item XYZ…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_ItemQuantity[] = _("Quantity:{CLEAR_TO 90}\n{STR_VAR_1}{CLEAR_TO 90}\n\n{STR_VAR_2}"); +static const u8 sDebugText_ItemID[] = _("Item Id: {STR_VAR_3}\n{STR_VAR_1}{CLEAR_TO 90}\n\n{STR_VAR_2}"); +static const u8 sDebugText_Give_AllTMs[] = _("Give all TMs"); +static const u8 sDebugText_Give_GivePokemonSimple[] = _("Pkm (lvl)…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Give_GivePokemonComplex[] = _("Pkm (l,s,n,a,IV,mov)…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_PokemonID[] = _("Species: {STR_VAR_3}\n{STR_VAR_1}{CLEAR_TO 90}\n\n{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_PokemonLevel[] = _("Level:{CLEAR_TO 90}\n{STR_VAR_1}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_PokemonShiny[] = _("Shiny:{CLEAR_TO 90}\n {STR_VAR_2}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{CLEAR_TO 90}"); +static const u8 sDebugText_PokemonNature[] = _("NatureId: {STR_VAR_3}{CLEAR_TO 90}\n{STR_VAR_1}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_PokemonAbility[] = _("AbilityNum: {STR_VAR_3}{CLEAR_TO 90}\n{STR_VAR_1}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_PokemonIVs[] = _("All IVs:{CLEAR_TO 90}\n {STR_VAR_3}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_PokemonIV_0[] = _("IV HP:{CLEAR_TO 90}\n {STR_VAR_3}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_PokemonIV_1[] = _("IV Attack:{CLEAR_TO 90}\n {STR_VAR_3}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_PokemonIV_2[] = _("IV Defense:{CLEAR_TO 90}\n {STR_VAR_3}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_PokemonIV_3[] = _("IV Speed:{CLEAR_TO 90}\n {STR_VAR_3}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_PokemonIV_4[] = _("IV Sp. Attack:{CLEAR_TO 90}\n {STR_VAR_3}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_PokemonIV_5[] = _("IV Sp. Defense:{CLEAR_TO 90}\n {STR_VAR_3}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_PokemonMove_0[] = _("Move 0: {STR_VAR_3}{CLEAR_TO 90}\n{STR_VAR_1}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_PokemonMove_1[] = _("Move 1: {STR_VAR_3}{CLEAR_TO 90}\n{STR_VAR_1}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_PokemonMove_2[] = _("Move 2: {STR_VAR_3}{CLEAR_TO 90}\n{STR_VAR_1}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_PokemonMove_3[] = _("Move 3: {STR_VAR_3}{CLEAR_TO 90}\n{STR_VAR_1}{CLEAR_TO 90}\n{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}"); +static const u8 sDebugText_Give_MaxMoney[] = _("Max Money"); +static const u8 sDebugText_Give_MaxCoins[] = _("Max Coins"); +static const u8 sDebugText_Give_BattlePoints[] = _("Max Battle Points"); +static const u8 sDebugText_Give_DaycareEgg[] = _("Daycare Egg"); +// Fill Menu +static const u8 sDebugText_Fill_Pc_Fast[] = _("Fill PCBoxes Fast"); +static const u8 sDebugText_Fill_Pc_Slow[] = _("Fill PCBoxes Slow (LAG!)"); +static const u8 sDebugText_Fill_Pc_Items[] = _("Fill PCItems"); +static const u8 sDebugText_Fill_PocketItems[] = _("Fill Pocket Items"); +static const u8 sDebugText_Fill_PocketPokeBalls[] =_("Fill Pocket PokeBalls"); +static const u8 sDebugText_Fill_PocketTMHM[] = _("Fill Pocket TMHM"); +static const u8 sDebugText_Fill_PocketBerries[] = _("Fill Pocket Berries"); +static const u8 sDebugText_Fill_PocketKeyItems[] = _("Fill Pocket KeyItems"); // Sound Mneu -static const u8 sDebugText_Sound_SE[] = _("Effects"); -static const u8 sDebugText_Sound_SE_ID[] = _("Sound Id: {STR_VAR_3}\n{STR_VAR_1} \n{STR_VAR_2}"); -static const u8 sDebugText_Sound_MUS[] = _("Music"); -static const u8 sDebugText_Sound_MUS_ID[] = _("Music Id: {STR_VAR_3}\n{STR_VAR_1} \n{STR_VAR_2}"); -static const u8 sDebugText_Sound_Empty[] = _(""); +static const u8 sDebugText_Sound_SE[] = _("Effects…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Sound_SE_ID[] = _("Sound Id: {STR_VAR_3}\n{STR_VAR_1} \n{STR_VAR_2}"); +static const u8 sDebugText_Sound_MUS[] = _("Music…{CLEAR_TO 110}{RIGHT_ARROW}"); +static const u8 sDebugText_Sound_MUS_ID[] = _("Music Id: {STR_VAR_3}\n{STR_VAR_1} \n{STR_VAR_2}"); static const u8 digitInidicator_1[] = _("{LEFT_ARROW}+1{RIGHT_ARROW} "); static const u8 digitInidicator_10[] = _("{LEFT_ARROW}+10{RIGHT_ARROW} "); @@ -432,62 +580,106 @@ static const s32 sPowersOfTen[] = // List Menu Items static const struct ListMenuItem sDebugMenu_Items_Main[] = { - [DEBUG_MENU_ITEM_UTILITIES] = {sDebugText_Utilities, DEBUG_MENU_ITEM_UTILITIES}, - [DEBUG_MENU_ITEM_SCRIPTS] = {sDebugText_Scripts, DEBUG_MENU_ITEM_SCRIPTS}, - [DEBUG_MENU_ITEM_FLAGS] = {sDebugText_Flags, DEBUG_MENU_ITEM_FLAGS}, - [DEBUG_MENU_ITEM_VARS] = {sDebugText_Vars, DEBUG_MENU_ITEM_VARS}, - [DEBUG_MENU_ITEM_GIVE] = {sDebugText_Give, DEBUG_MENU_ITEM_GIVE}, - [DEBUG_MENU_ITEM_SOUND] = {sDebugText_Sound, DEBUG_MENU_ITEM_SOUND}, - [DEBUG_MENU_ITEM_ACCESS_PC] = {sDebugText_AccessPC, DEBUG_MENU_ITEM_ACCESS_PC}, - [DEBUG_MENU_ITEM_CANCEL] = {sDebugText_Cancel, DEBUG_MENU_ITEM_CANCEL} + [DEBUG_MENU_ITEM_UTILITIES] = {sDebugText_Utilities, DEBUG_MENU_ITEM_UTILITIES}, + [DEBUG_MENU_ITEM_SCRIPTS] = {sDebugText_Scripts, DEBUG_MENU_ITEM_SCRIPTS}, + [DEBUG_MENU_ITEM_FLAGVAR] = {sDebugText_FlagsVars, DEBUG_MENU_ITEM_FLAGVAR}, + //[DEBUG_MENU_ITEM_BATTLE] = {sDebugText_Battle, DEBUG_MENU_ITEM_BATTLE}, + [DEBUG_MENU_ITEM_GIVE] = {sDebugText_Give, DEBUG_MENU_ITEM_GIVE}, + [DEBUG_MENU_ITEM_FILL] = {sDebugText_Fill, DEBUG_MENU_ITEM_FILL}, + [DEBUG_MENU_ITEM_SOUND] = {sDebugText_Sound, DEBUG_MENU_ITEM_SOUND}, + [DEBUG_MENU_ITEM_ACCESS_PC] = {sDebugText_AccessPC, DEBUG_MENU_ITEM_ACCESS_PC}, + [DEBUG_MENU_ITEM_CANCEL] = {sDebugText_Cancel, DEBUG_MENU_ITEM_CANCEL} }; static const struct ListMenuItem sDebugMenu_Items_Utilities[] = { - [DEBUG_UTIL_MENU_ITEM_HEAL_PARTY] = {sDebugText_Util_HealParty, DEBUG_UTIL_MENU_ITEM_HEAL_PARTY}, - [DEBUG_UTIL_MENU_ITEM_FLY] = {sDebugText_Util_Fly, DEBUG_UTIL_MENU_ITEM_FLY}, - [DEBUG_UTIL_MENU_ITEM_WARP] = {sDebugText_Util_WarpToMap, DEBUG_UTIL_MENU_ITEM_WARP}, - [DEBUG_UTIL_MENU_ITEM_RUNNING_SHOES] = {sDebugText_Util_RunningShoes, DEBUG_UTIL_MENU_ITEM_RUNNING_SHOES}, - [DEBUG_UTIL_MENU_ITEM_POISON_MONS] = {sDebugText_Util_PoisonMons, DEBUG_UTIL_MENU_ITEM_POISON_MONS}, - [DEBUG_UTIL_MENU_ITEM_SAVEBLOCK] = {sDebugText_Util_SaveBlockSpace, DEBUG_UTIL_MENU_ITEM_SAVEBLOCK}, - [DEBUG_UTIL_MENU_ITEM_WEATHER] = {sDebugText_Util_Weather, DEBUG_UTIL_MENU_ITEM_WEATHER}, - [DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK] = {sDebugText_Util_CheckWallClock, DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK}, - [DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK] = {sDebugText_Util_SetWallClock, DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK}, - [DEBUG_UTIL_MENU_ITEM_WATCHCREDITS] = {sDebugText_Util_WatchCredits, DEBUG_UTIL_MENU_ITEM_WATCHCREDITS}, - [DEBUG_UTIL_MENU_ITEM_TRAINER_NAME] = {sDebugText_Util_Trainer_Name, DEBUG_UTIL_MENU_ITEM_TRAINER_NAME}, - [DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER] = {sDebugText_Util_Trainer_Gender, DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER}, - [DEBUG_UTIL_MENU_ITEM_TRAINER_ID] = {sDebugText_Util_Trainer_Id, DEBUG_UTIL_MENU_ITEM_TRAINER_ID}, - [DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES] = {sDebugText_Util_Clear_Boxes, DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES}, + [DEBUG_UTIL_MENU_ITEM_HEAL_PARTY] = {sDebugText_Util_HealParty, DEBUG_UTIL_MENU_ITEM_HEAL_PARTY}, + [DEBUG_UTIL_MENU_ITEM_FLY] = {sDebugText_Util_Fly, DEBUG_UTIL_MENU_ITEM_FLY}, + [DEBUG_UTIL_MENU_ITEM_WARP] = {sDebugText_Util_WarpToMap, DEBUG_UTIL_MENU_ITEM_WARP}, + [DEBUG_UTIL_MENU_ITEM_POISON_MONS] = {sDebugText_Util_PoisonMons, DEBUG_UTIL_MENU_ITEM_POISON_MONS}, + [DEBUG_UTIL_MENU_ITEM_SAVEBLOCK] = {sDebugText_Util_SaveBlockSpace, DEBUG_UTIL_MENU_ITEM_SAVEBLOCK}, + [DEBUG_UTIL_MENU_ITEM_WEATHER] = {sDebugText_Util_Weather, DEBUG_UTIL_MENU_ITEM_WEATHER}, + [DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK] = {sDebugText_Util_CheckWallClock, DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK}, + [DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK] = {sDebugText_Util_SetWallClock, DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK}, + [DEBUG_UTIL_MENU_ITEM_WATCHCREDITS] = {sDebugText_Util_WatchCredits, DEBUG_UTIL_MENU_ITEM_WATCHCREDITS}, + [DEBUG_UTIL_MENU_ITEM_TRAINER_NAME] = {sDebugText_Util_Trainer_Name, DEBUG_UTIL_MENU_ITEM_TRAINER_NAME}, + [DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER] = {sDebugText_Util_Trainer_Gender, DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER}, + [DEBUG_UTIL_MENU_ITEM_TRAINER_ID] = {sDebugText_Util_Trainer_Id, DEBUG_UTIL_MENU_ITEM_TRAINER_ID}, + [DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES] = {sDebugText_Util_Clear_Boxes, DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES}, + [DEBUG_UTIL_MENU_ITEM_CHEAT] = {sDebugText_Util_CheatStart, DEBUG_UTIL_MENU_ITEM_CHEAT}, + [DEBUG_UTIL_MENU_ITEM_HATCH_AN_EGG] = {sDebugText_Util_HatchAnEgg, DEBUG_UTIL_MENU_ITEM_HATCH_AN_EGG}, }; static const struct ListMenuItem sDebugMenu_Items_Scripts[] = { - [DEBUG_UTIL_MENU_ITEM_SCRIPT_1] = {sDebugText_Util_Script_1, DEBUG_UTIL_MENU_ITEM_SCRIPT_1}, - [DEBUG_UTIL_MENU_ITEM_SCRIPT_2] = {sDebugText_Util_Script_2, DEBUG_UTIL_MENU_ITEM_SCRIPT_2}, - [DEBUG_UTIL_MENU_ITEM_SCRIPT_3] = {sDebugText_Util_Script_3, DEBUG_UTIL_MENU_ITEM_SCRIPT_3}, - [DEBUG_UTIL_MENU_ITEM_SCRIPT_4] = {sDebugText_Util_Script_4, DEBUG_UTIL_MENU_ITEM_SCRIPT_4}, - [DEBUG_UTIL_MENU_ITEM_SCRIPT_5] = {sDebugText_Util_Script_5, DEBUG_UTIL_MENU_ITEM_SCRIPT_5}, - [DEBUG_UTIL_MENU_ITEM_SCRIPT_6] = {sDebugText_Util_Script_6, DEBUG_UTIL_MENU_ITEM_SCRIPT_6}, - [DEBUG_UTIL_MENU_ITEM_SCRIPT_7] = {sDebugText_Util_Script_7, DEBUG_UTIL_MENU_ITEM_SCRIPT_7}, - [DEBUG_UTIL_MENU_ITEM_SCRIPT_8] = {sDebugText_Util_Script_8, DEBUG_UTIL_MENU_ITEM_SCRIPT_8}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_1] = {sDebugText_Util_Script_1, DEBUG_UTIL_MENU_ITEM_SCRIPT_1}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_2] = {sDebugText_Util_Script_2, DEBUG_UTIL_MENU_ITEM_SCRIPT_2}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_3] = {sDebugText_Util_Script_3, DEBUG_UTIL_MENU_ITEM_SCRIPT_3}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_4] = {sDebugText_Util_Script_4, DEBUG_UTIL_MENU_ITEM_SCRIPT_4}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_5] = {sDebugText_Util_Script_5, DEBUG_UTIL_MENU_ITEM_SCRIPT_5}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_6] = {sDebugText_Util_Script_6, DEBUG_UTIL_MENU_ITEM_SCRIPT_6}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_7] = {sDebugText_Util_Script_7, DEBUG_UTIL_MENU_ITEM_SCRIPT_7}, + [DEBUG_UTIL_MENU_ITEM_SCRIPT_8] = {sDebugText_Util_Script_8, DEBUG_UTIL_MENU_ITEM_SCRIPT_8}, }; -static const struct ListMenuItem sDebugMenu_Items_Flags[] = -{ - [DEBUG_FLAG_MENU_ITEM_FLAGS] = {sDebugText_Flags_Flags, DEBUG_FLAG_MENU_ITEM_FLAGS}, - [DEBUG_FLAG_MENU_ITEM_POKEDEXFLAGS] = {sDebugText_Flags_SetPokedexFlags, DEBUG_FLAG_MENU_ITEM_POKEDEXFLAGS}, - [DEBUG_FLAG_MENU_ITEM_POKEDEXONOFF] = {sDebugText_Flags_SwitchDex, DEBUG_FLAG_MENU_ITEM_POKEDEXONOFF}, - [DEBUG_FLAG_MENU_ITEM_NATDEXONOFF] = {sDebugText_Flags_SwitchNationalDex, DEBUG_FLAG_MENU_ITEM_NATDEXONOFF}, - [DEBUG_FLAG_MENU_ITEM_POKENAVONOFF] = {sDebugText_Flags_SwitchPokeNav, DEBUG_FLAG_MENU_ITEM_POKENAVONOFF}, - [DEBUG_FLAG_MENU_ITEM_FLYANYWHERE] = {sDebugText_Flags_ToggleFlyFlags, DEBUG_FLAG_MENU_ITEM_FLYANYWHERE}, - [DEBUG_FLAG_MENU_ITEM_GETALLBADGES] = {sDebugText_Flags_ToggleAllBadges, DEBUG_FLAG_MENU_ITEM_GETALLBADGES}, - [DEBUG_FLAG_MENU_ITEM_FRONTIER_PASS] = {sDebugText_Flags_ToggleFrontierPass, DEBUG_FLAG_MENU_ITEM_FRONTIER_PASS}, - [DEBUG_FLAG_MENU_ITEM_COLISSION_ONOFF] = {sDebugText_Flags_SwitchCollision, DEBUG_FLAG_MENU_ITEM_COLISSION_ONOFF}, - [DEBUG_FLAG_MENU_ITEM_ENCOUNTER_ONOFF] = {sDebugText_Flags_SwitchEncounter, DEBUG_FLAG_MENU_ITEM_ENCOUNTER_ONOFF}, - [DEBUG_FLAG_MENU_ITEM_TRAINER_SEE_ONOFF] = {sDebugText_Flags_SwitchTrainerSee, DEBUG_FLAG_MENU_ITEM_TRAINER_SEE_ONOFF}, - [DEBUG_FLAG_MENU_ITEM_BAG_USE_ONOFF] = {sDebugText_Flags_SwitchBagUse, DEBUG_FLAG_MENU_ITEM_BAG_USE_ONOFF}, - [DEBUG_FLAG_MENU_ITEM_CATCHING_ONOFF] = {sDebugText_Flags_SwitchCatching, DEBUG_FLAG_MENU_ITEM_CATCHING_ONOFF}, +static const struct ListMenuItem sDebugMenu_Items_FlagsVars[] = +{ + [DEBUG_FLAGVAR_MENU_ITEM_FLAGS] = {sDebugText_FlagsVars_Flags, DEBUG_FLAGVAR_MENU_ITEM_FLAGS}, + [DEBUG_FLAGVAR_MENU_ITEM_VARS] = {sDebugText_FlagsVars_Vars, DEBUG_FLAGVAR_MENU_ITEM_VARS}, + [DEBUG_FLAGVAR_MENU_ITEM_DEXFLAGS_ALL] = {sDebugText_FlagsVars_PokedexFlags_All, DEBUG_FLAGVAR_MENU_ITEM_DEXFLAGS_ALL}, + [DEBUG_FLAGVAR_MENU_ITEM_DEXFLAGS_RESET] = {sDebugText_FlagsVars_PokedexFlags_Reset, DEBUG_FLAGVAR_MENU_ITEM_DEXFLAGS_RESET}, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_POKEDEX] = {sDebugText_FlagsVars_SwitchDex, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_POKEDEX}, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_NATDEX] = {sDebugText_FlagsVars_SwitchNationalDex, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_NATDEX}, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_POKENAV] = {sDebugText_FlagsVars_SwitchPokeNav, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_POKENAV}, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_RUN_SHOES] = {sDebugText_FlagsVars_RunningShoes, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_RUN_SHOES}, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_LOCATIONS] = {sDebugText_FlagsVars_ToggleFlyFlags, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_LOCATIONS}, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BADGES_ALL] = {sDebugText_FlagsVars_ToggleAllBadges, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BADGES_ALL}, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_FRONTIER_PASS] = {sDebugText_FlagsVars_ToggleFrontierPass, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_FRONTIER_PASS}, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_COLISSION] = {sDebugText_FlagsVars_SwitchCollision, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_COLISSION}, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_ENCOUNTER] = {sDebugText_FlagsVars_SwitchEncounter, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_ENCOUNTER}, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_TRAINER_SEE] = {sDebugText_FlagsVars_SwitchTrainerSee, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_TRAINER_SEE}, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BAG_USE] = {sDebugText_FlagsVars_SwitchBagUse, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BAG_USE}, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_CATCHING] = {sDebugText_FlagsVars_SwitchCatching, DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_CATCHING}, }; -static const struct ListMenuItem sDebugMenu_Items_Vars[] = +static const struct ListMenuItem sDebugMenu_Items_Battle_0[] = { - [DEBUG_VARS_MENU_ITEM_VARS] = {sDebugText_Vars_Vars, DEBUG_FLAG_MENU_ITEM_FLAGS}, + [DEBUG_BATTLE_0_MENU_ITEM_WILD] = {sDebugText_Battle_0_Wild, DEBUG_BATTLE_0_MENU_ITEM_WILD}, + [DEBUG_BATTLE_0_MENU_ITEM_WILD_DOUBLE] = {sDebugText_Battle_0_WildDouble, DEBUG_BATTLE_0_MENU_ITEM_WILD_DOUBLE}, + [DEBUG_BATTLE_0_MENU_ITEM_SINGLE] = {sDebugText_Battle_0_Single, DEBUG_BATTLE_0_MENU_ITEM_SINGLE}, + [DEBUG_BATTLE_0_MENU_ITEM_DOUBLE] = {sDebugText_Battle_0_Double, DEBUG_BATTLE_0_MENU_ITEM_DOUBLE}, + [DEBUG_BATTLE_0_MENU_ITEM_MULTI] = {sDebugText_Battle_0_Mulit, DEBUG_BATTLE_0_MENU_ITEM_MULTI}, +}; +static const struct ListMenuItem sDebugMenu_Items_Battle_1[] = +{ + [DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_00] = {sDebugText_Battle_1_AIFlag_00, DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_00}, + [DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_01] = {sDebugText_Battle_1_AIFlag_01, DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_01}, + [DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_02] = {sDebugText_Battle_1_AIFlag_02, DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_02}, + [DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_03] = {sDebugText_Battle_1_AIFlag_03, DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_03}, + [DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_04] = {sDebugText_Battle_1_AIFlag_04, DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_04}, + [DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_05] = {sDebugText_Battle_1_AIFlag_05, DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_05}, + [DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_06] = {sDebugText_Battle_1_AIFlag_06, DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_06}, + [DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_07] = {sDebugText_Battle_1_AIFlag_07, DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_07}, + [DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_08] = {sDebugText_Battle_1_AIFlag_08, DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_08}, + [DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_09] = {sDebugText_Battle_1_AIFlag_09, DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_09}, + [DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_10] = {sDebugText_Battle_1_AIFlag_10, DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_10}, + [DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_11] = {sDebugText_Battle_1_AIFlag_11, DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_11}, + [DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_12] = {sDebugText_Battle_1_AIFlag_12, DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_12}, + [DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_13] = {sDebugText_Battle_1_AIFlag_13, DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_13}, + [DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_14] = {sDebugText_Battle_1_AIFlag_14, DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_14}, + [DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_15] = {sDebugText_Battle_1_AIFlag_15, DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_15}, + [DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_16] = {sDebugText_Battle_1_AIFlag_16, DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_16}, + [DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_17] = {sDebugText_Battle_1_AIFlag_17, DEBUG_BATTLE_1_MENU_ITEM_AI_FLAG_17}, + [DEBUG_BATTLE_1_MENU_ITEM_CONTINUE] = {sDebugText_Continue, DEBUG_BATTLE_1_MENU_ITEM_CONTINUE}, +}; +static const struct ListMenuItem sDebugMenu_Items_Battle_2[] = +{ + [DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_0] = {sDebugText_Battle_2_Terrain_0, DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_0}, + [DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_1] = {sDebugText_Battle_2_Terrain_1, DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_1}, + [DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_2] = {sDebugText_Battle_2_Terrain_2, DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_2}, + [DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_3] = {sDebugText_Battle_2_Terrain_3, DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_3}, + [DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_4] = {sDebugText_Battle_2_Terrain_4, DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_4}, + [DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_5] = {sDebugText_Battle_2_Terrain_5, DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_5}, + [DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_6] = {sDebugText_Battle_2_Terrain_6, DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_6}, + [DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_7] = {sDebugText_Battle_2_Terrain_7, DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_7}, + [DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_8] = {sDebugText_Battle_2_Terrain_8, DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_8}, + [DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_9] = {sDebugText_Battle_2_Terrain_9, DEBUG_BATTLE_2_MENU_ITEM_TERRAIN_9}, }; static const struct ListMenuItem sDebugMenu_Items_Give[] = { @@ -499,44 +691,55 @@ static const struct ListMenuItem sDebugMenu_Items_Give[] = [DEBUG_GIVE_MENU_ITEM_MAX_COINS] = {sDebugText_Give_MaxCoins, DEBUG_GIVE_MENU_ITEM_MAX_COINS}, [DEBUG_GIVE_MENU_ITEM_MAX_BATTLE_POINTS] = {sDebugText_Give_BattlePoints, DEBUG_GIVE_MENU_ITEM_MAX_BATTLE_POINTS}, [DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG] = {sDebugText_Give_DaycareEgg, DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG}, - [DEBUG_GIVE_MENU_ITEM_FILL_PC] = {sDebugText_Give_FillPc, DEBUG_GIVE_MENU_ITEM_FILL_PC}, - [DEBUG_GIVE_MENU_ITEM_CHEAT] = {sDebugText_Give_GiveCHEAT, DEBUG_GIVE_MENU_ITEM_CHEAT}, +}; +static const struct ListMenuItem sDebugMenu_Items_Fill[] = +{ + [DEBUG_FILL_MENU_ITEM_PC_BOXES_FAST] = {sDebugText_Fill_Pc_Fast, DEBUG_FILL_MENU_ITEM_PC_BOXES_FAST}, + [DEBUG_FILL_MENU_ITEM_PC_BOXES_SLOW] = {sDebugText_Fill_Pc_Slow, DEBUG_FILL_MENU_ITEM_PC_BOXES_SLOW}, + [DEBUG_FILL_MENU_ITEM_PC_ITEMS] = {sDebugText_Fill_Pc_Items , DEBUG_FILL_MENU_ITEM_PC_ITEMS}, + [DEBUG_FILL_MENU_ITEM_POCKET_ITEMS] = {sDebugText_Fill_PocketItems, DEBUG_FILL_MENU_ITEM_POCKET_ITEMS}, + [DEBUG_FILL_MENU_ITEM_POCKET_BALLS] = {sDebugText_Fill_PocketPokeBalls, DEBUG_FILL_MENU_ITEM_POCKET_BALLS}, + [DEBUG_FILL_MENU_ITEM_POCKET_TMHM] = {sDebugText_Fill_PocketTMHM, DEBUG_FILL_MENU_ITEM_POCKET_TMHM}, + [DEBUG_FILL_MENU_ITEM_POCKET_BERRIES] = {sDebugText_Fill_PocketBerries, DEBUG_FILL_MENU_ITEM_POCKET_BERRIES}, + [DEBUG_FILL_MENU_ITEM_POCKET_KEY_ITEMS] = {sDebugText_Fill_PocketKeyItems, DEBUG_FILL_MENU_ITEM_POCKET_KEY_ITEMS}, }; static const struct ListMenuItem sDebugMenu_Items_Sound[] = { - [DEBUG_SOUND_MENU_ITEM_SE] = {sDebugText_Sound_SE, DEBUG_SOUND_MENU_ITEM_SE}, - [DEBUG_SOUND_MENU_ITEM_MUS] = {sDebugText_Sound_MUS, DEBUG_SOUND_MENU_ITEM_MUS}, + [DEBUG_SOUND_MENU_ITEM_SE] = {sDebugText_Sound_SE, DEBUG_SOUND_MENU_ITEM_SE}, + [DEBUG_SOUND_MENU_ITEM_MUS] = {sDebugText_Sound_MUS, DEBUG_SOUND_MENU_ITEM_MUS}, }; // ******************************* // Menu Actions static void (*const sDebugMenu_Actions_Main[])(u8) = { - [DEBUG_MENU_ITEM_UTILITIES] = DebugAction_OpenUtilitiesMenu, - [DEBUG_MENU_ITEM_SCRIPTS] = DebugAction_OpenScriptsMenu, - [DEBUG_MENU_ITEM_FLAGS] = DebugAction_OpenFlagsMenu, - [DEBUG_MENU_ITEM_VARS] = DebugAction_OpenVariablesMenu, - [DEBUG_MENU_ITEM_GIVE] = DebugAction_OpenGiveMenu, - [DEBUG_MENU_ITEM_SOUND] = DebugAction_OpenSoundMenu, - [DEBUG_MENU_ITEM_ACCESS_PC] = DebugAction_AccessPC, - [DEBUG_MENU_ITEM_CANCEL] = DebugAction_Cancel + [DEBUG_MENU_ITEM_UTILITIES] = DebugAction_OpenUtilitiesMenu, + [DEBUG_MENU_ITEM_SCRIPTS] = DebugAction_OpenScriptsMenu, + [DEBUG_MENU_ITEM_FLAGVAR] = DebugAction_OpenFlagsVarsMenu, + //[DEBUG_MENU_ITEM_BATTLE] = DebugAction_OpenBattleMenu, + [DEBUG_MENU_ITEM_GIVE] = DebugAction_OpenGiveMenu, + [DEBUG_MENU_ITEM_FILL] = DebugAction_OpenFillMenu, + [DEBUG_MENU_ITEM_SOUND] = DebugAction_OpenSoundMenu, + [DEBUG_MENU_ITEM_ACCESS_PC] = DebugAction_AccessPC, + [DEBUG_MENU_ITEM_CANCEL] = DebugAction_Cancel }; static void (*const sDebugMenu_Actions_Utilities[])(u8) = { - [DEBUG_UTIL_MENU_ITEM_HEAL_PARTY] = DebugAction_Util_HealParty, - [DEBUG_UTIL_MENU_ITEM_FLY] = DebugAction_Util_Fly, - [DEBUG_UTIL_MENU_ITEM_WARP] = DebugAction_Util_Warp_Warp, - [DEBUG_UTIL_MENU_ITEM_RUNNING_SHOES] = DebugAction_Util_RunningShoes, - [DEBUG_UTIL_MENU_ITEM_POISON_MONS] = DebugAction_Util_PoisonMons, - [DEBUG_UTIL_MENU_ITEM_SAVEBLOCK] = DebugAction_Util_CheckSaveBlock, - [DEBUG_UTIL_MENU_ITEM_WEATHER] = DebugAction_Util_Weather, - [DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK] = DebugAction_Util_CheckWallClock, - [DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK] = DebugAction_Util_SetWallClock, - [DEBUG_UTIL_MENU_ITEM_WATCHCREDITS] = DebugAction_Util_WatchCredits, - [DEBUG_UTIL_MENU_ITEM_TRAINER_NAME] = DebugAction_Util_Trainer_Name, - [DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER] = DebugAction_Util_Trainer_Gender, - [DEBUG_UTIL_MENU_ITEM_TRAINER_ID] = DebugAction_Util_Trainer_Id, - [DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES] = DebugAction_Util_Clear_Boxes, + [DEBUG_UTIL_MENU_ITEM_HEAL_PARTY] = DebugAction_Util_HealParty, + [DEBUG_UTIL_MENU_ITEM_FLY] = DebugAction_Util_Fly, + [DEBUG_UTIL_MENU_ITEM_WARP] = DebugAction_Util_Warp_Warp, + [DEBUG_UTIL_MENU_ITEM_POISON_MONS] = DebugAction_Util_PoisonMons, + [DEBUG_UTIL_MENU_ITEM_SAVEBLOCK] = DebugAction_Util_CheckSaveBlock, + [DEBUG_UTIL_MENU_ITEM_WEATHER] = DebugAction_Util_Weather, + [DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK] = DebugAction_Util_CheckWallClock, + [DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK] = DebugAction_Util_SetWallClock, + [DEBUG_UTIL_MENU_ITEM_WATCHCREDITS] = DebugAction_Util_WatchCredits, + [DEBUG_UTIL_MENU_ITEM_TRAINER_NAME] = DebugAction_Util_Trainer_Name, + [DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER] = DebugAction_Util_Trainer_Gender, + [DEBUG_UTIL_MENU_ITEM_TRAINER_ID] = DebugAction_Util_Trainer_Id, + [DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES] = DebugAction_Util_Clear_Boxes, + [DEBUG_UTIL_MENU_ITEM_CHEAT] = DebugAction_Util_CheatStart, + [DEBUG_UTIL_MENU_ITEM_HATCH_AN_EGG] = DebugAction_Util_HatchAnEgg, }; static void (*const sDebugMenu_Actions_Scripts[])(u8) = { @@ -551,23 +754,22 @@ static void (*const sDebugMenu_Actions_Scripts[])(u8) = }; static void (*const sDebugMenu_Actions_Flags[])(u8) = { - [DEBUG_FLAG_MENU_ITEM_FLAGS] = DebugAction_Flags_Flags, - [DEBUG_FLAG_MENU_ITEM_POKEDEXFLAGS] = DebugAction_Flags_SetPokedexFlags, - [DEBUG_FLAG_MENU_ITEM_POKEDEXONOFF] = DebugAction_Flags_SwitchDex, - [DEBUG_FLAG_MENU_ITEM_NATDEXONOFF] = DebugAction_Flags_SwitchNatDex, - [DEBUG_FLAG_MENU_ITEM_POKENAVONOFF] = DebugAction_Flags_SwitchPokeNav, - [DEBUG_FLAG_MENU_ITEM_FLYANYWHERE] = DebugAction_Flags_ToggleFlyFlags, - [DEBUG_FLAG_MENU_ITEM_GETALLBADGES] = DebugAction_Flags_ToggleBadgeFlags, - [DEBUG_FLAG_MENU_ITEM_FRONTIER_PASS] = DebugAction_Flags_ToggleFrontierPass, - [DEBUG_FLAG_MENU_ITEM_COLISSION_ONOFF] = DebugAction_Flags_CollisionOnOff, - [DEBUG_FLAG_MENU_ITEM_ENCOUNTER_ONOFF] = DebugAction_Flags_EncounterOnOff, - [DEBUG_FLAG_MENU_ITEM_TRAINER_SEE_ONOFF] = DebugAction_Flags_TrainerSeeOnOff, - [DEBUG_FLAG_MENU_ITEM_BAG_USE_ONOFF] = DebugAction_Flags_BagUseOnOff, - [DEBUG_FLAG_MENU_ITEM_CATCHING_ONOFF] = DebugAction_Flags_CatchingOnOff, -}; -static void (*const sDebugMenu_Actions_Vars[])(u8) = -{ - [DEBUG_VARS_MENU_ITEM_VARS] = DebugAction_Vars_Vars, + [DEBUG_FLAGVAR_MENU_ITEM_FLAGS] = DebugAction_FlagsVars_Flags, + [DEBUG_FLAGVAR_MENU_ITEM_VARS] = DebugAction_FlagsVars_Vars, + [DEBUG_FLAGVAR_MENU_ITEM_DEXFLAGS_ALL] = DebugAction_FlagsVars_PokedexFlags_All, + [DEBUG_FLAGVAR_MENU_ITEM_DEXFLAGS_RESET] = DebugAction_FlagsVars_PokedexFlags_Reset, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_POKEDEX] = DebugAction_FlagsVars_SwitchDex, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_NATDEX] = DebugAction_FlagsVars_SwitchNatDex, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_POKENAV] = DebugAction_FlagsVars_SwitchPokeNav, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_RUN_SHOES] = DebugAction_FlagsVars_RunningShoes, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_LOCATIONS] = DebugAction_FlagsVars_ToggleFlyFlags, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BADGES_ALL] = DebugAction_FlagsVars_ToggleBadgeFlags, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_FRONTIER_PASS] = DebugAction_FlagsVars_ToggleFrontierPass, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_COLISSION] = DebugAction_FlagsVars_CollisionOnOff, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_ENCOUNTER] = DebugAction_FlagsVars_EncounterOnOff, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_TRAINER_SEE] = DebugAction_FlagsVars_TrainerSeeOnOff, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BAG_USE] = DebugAction_FlagsVars_BagUseOnOff, + [DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_CATCHING] = DebugAction_FlagsVars_CatchingOnOff, }; static void (*const sDebugMenu_Actions_Give[])(u8) = { @@ -579,9 +781,19 @@ static void (*const sDebugMenu_Actions_Give[])(u8) = [DEBUG_GIVE_MENU_ITEM_MAX_COINS] = DebugAction_Give_MaxCoins, [DEBUG_GIVE_MENU_ITEM_MAX_BATTLE_POINTS] = DebugAction_Give_MaxBattlePoints, [DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG] = DebugAction_Give_DayCareEgg, - [DEBUG_GIVE_MENU_ITEM_FILL_PC] = DebugAction_Give_FillPC, - [DEBUG_GIVE_MENU_ITEM_CHEAT] = DebugAction_Give_CHEAT, }; +static void (*const sDebugMenu_Actions_Fill[])(u8) = +{ + [DEBUG_FILL_MENU_ITEM_PC_BOXES_FAST] = DebugAction_Fill_PCBoxes_Fast, + [DEBUG_FILL_MENU_ITEM_PC_BOXES_SLOW] = DebugAction_Fill_PCBoxes_Slow, + [DEBUG_FILL_MENU_ITEM_PC_ITEMS] = DebugAction_Fill_PCItemStorage, + [DEBUG_FILL_MENU_ITEM_POCKET_ITEMS] = DebugAction_Fill_PocketItems, + [DEBUG_FILL_MENU_ITEM_POCKET_BALLS] = DebugAction_Fill_PocketPokeBalls, + [DEBUG_FILL_MENU_ITEM_POCKET_TMHM] = DebugAction_Fill_PocketTMHM, + [DEBUG_FILL_MENU_ITEM_POCKET_BERRIES] = DebugAction_Fill_PocketBerries, + [DEBUG_FILL_MENU_ITEM_POCKET_KEY_ITEMS] = DebugAction_Fill_PocketKeyItems, +}; + static void (*const sDebugMenu_Actions_Sound[])(u8) = { [DEBUG_SOUND_MENU_ITEM_SE] = DebugAction_Sound_SE, @@ -591,46 +803,56 @@ static void (*const sDebugMenu_Actions_Sound[])(u8) = // ******************************* // Windows -static const struct WindowTemplate sDebugMenuWindowTemplate = +static const struct WindowTemplate sDebugMenuWindowTemplateMain = { .bg = 0, .tilemapLeft = 1, .tilemapTop = 1, - .width = DEBUG_MAIN_MENU_WIDTH, - .height = 2 * DEBUG_MAIN_MENU_HEIGHT, + .width = DEBUG_MENU_WIDTH_MAIN, + .height = 2 * DEBUG_MENU_HEIGHT_MAIN, .paletteNum = 15, .baseBlock = 1, }; -static const struct WindowTemplate sDebugNumberDisplayWindowTemplate = +static const struct WindowTemplate sDebugMenuWindowTemplateExtra = { .bg = 0, - .tilemapLeft = 4 + DEBUG_MAIN_MENU_WIDTH, + .tilemapLeft = 30 - DEBUG_MENU_WIDTH_EXTRA - 1, .tilemapTop = 1, - .width = DEBUG_NUMBER_DISPLAY_WIDTH, - .height = 2 * DEBUG_NUMBER_DISPLAY_HEIGHT, + .width = DEBUG_MENU_WIDTH_EXTRA, + .height = 2 * DEBUG_MENU_HEIGHT_EXTRA, .paletteNum = 15, .baseBlock = 1, }; -static const struct WindowTemplate sDebugNumberDisplayMediumWindowTemplate = +static const struct WindowTemplate sDebugMenuWindowTemplateWeather = { .bg = 0, - .tilemapLeft = 30 - DEBUG_NUMBER_DISPLAY_MEDIUM_WIDTH - 1, + .tilemapLeft = 30 - DEBUG_MENU_WIDTH_WEATHER - 1, .tilemapTop = 1, - .width = DEBUG_NUMBER_DISPLAY_MEDIUM_WIDTH, - .height = 2 * DEBUG_NUMBER_DISPLAY_MEDIUM_HEIGHT, + .width = DEBUG_MENU_WIDTH_WEATHER, + .height = 2 * DEBUG_MENU_HEIGHT_WEATHER, .paletteNum = 15, .baseBlock = 1, }; -static const struct WindowTemplate sDebugNumberDisplayLargeWindowTemplate = +static const struct WindowTemplate sDebugMenuWindowTemplateSound = { .bg = 0, - .tilemapLeft = 30 - DEBUG_NUMBER_DISPLAY_SOUND_WIDTH -1, + .tilemapLeft = 30 - DEBUG_MENU_WIDTH_SOUND - 1, .tilemapTop = 1, - .width = DEBUG_NUMBER_DISPLAY_SOUND_WIDTH, - .height = DEBUG_NUMBER_DISPLAY_SOUND_HEIGHT, + .width = DEBUG_MENU_WIDTH_SOUND, + .height = DEBUG_MENU_HEIGHT_SOUND, .paletteNum = 15, .baseBlock = 1, }; +static const struct WindowTemplate sDebugMenuWindowTemplateFlagsVars = +{ + .bg = 0, + .tilemapLeft = 30 - DEBUG_MENU_WIDTH_FLAGVAR - 1, + .tilemapTop = 1, + .width = DEBUG_MENU_WIDTH_FLAGVAR, + .height = DEBUG_MENU_HEIGHT_FLAGVAR, + .paletteNum = 15, + .baseBlock = 1 + DEBUG_MENU_WIDTH_MAIN * DEBUG_MENU_HEIGHT_MAIN * 2, +}; // ******************************* // List Menu Templates @@ -652,17 +874,29 @@ static const struct ListMenuTemplate sDebugMenu_ListTemplate_Scripts = .moveCursorFunc = ListMenuDefaultCursorMoveFunc, .totalItems = ARRAY_COUNT(sDebugMenu_Items_Scripts), }; -static const struct ListMenuTemplate sDebugMenu_ListTemplate_Flags = +static const struct ListMenuTemplate sDebugMenu_ListTemplate_FlagsVars = { - .items = sDebugMenu_Items_Flags, + .items = sDebugMenu_Items_FlagsVars, .moveCursorFunc = ListMenuDefaultCursorMoveFunc, - .totalItems = ARRAY_COUNT(sDebugMenu_Items_Flags), + .totalItems = ARRAY_COUNT(sDebugMenu_Items_FlagsVars), }; -static const struct ListMenuTemplate sDebugMenu_ListTemplate_Vars = +static const struct ListMenuTemplate sDebugMenu_ListTemplate_Battle_0 = { - .items = sDebugMenu_Items_Vars, + .items = sDebugMenu_Items_Battle_0, .moveCursorFunc = ListMenuDefaultCursorMoveFunc, - .totalItems = ARRAY_COUNT(sDebugMenu_Items_Vars), + .totalItems = ARRAY_COUNT(sDebugMenu_Items_Battle_0), +}; +static const struct ListMenuTemplate sDebugMenu_ListTemplate_Battle_1 = +{ + .items = sDebugMenu_Items_Battle_1, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .totalItems = ARRAY_COUNT(sDebugMenu_Items_Battle_1), +}; +static const struct ListMenuTemplate sDebugMenu_ListTemplate_Battle_2 = +{ + .items = sDebugMenu_Items_Battle_2, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .totalItems = ARRAY_COUNT(sDebugMenu_Items_Battle_2), }; static const struct ListMenuTemplate sDebugMenu_ListTemplate_Give = { @@ -670,6 +904,12 @@ static const struct ListMenuTemplate sDebugMenu_ListTemplate_Give = .moveCursorFunc = ListMenuDefaultCursorMoveFunc, .totalItems = ARRAY_COUNT(sDebugMenu_Items_Give), }; +static const struct ListMenuTemplate sDebugMenu_ListTemplate_Fill = +{ + .items = sDebugMenu_Items_Fill, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .totalItems = ARRAY_COUNT(sDebugMenu_Items_Fill), +}; static const struct ListMenuTemplate sDebugMenu_ListTemplate_Sound = { .items = sDebugMenu_Items_Sound, @@ -681,6 +921,14 @@ static const struct ListMenuTemplate sDebugMenu_ListTemplate_Sound = // ******************************* // Functions universal void Debug_ShowMainMenu(void) +{ + sDebugBattleData = AllocZeroed(sizeof(*sDebugBattleData)); + sDebugMenuListData = AllocZeroed(sizeof(*sDebugMenuListData)); + Debug_InitDebugBattleData(); + + Debug_ShowMenu(DebugTask_HandleMenuInput_Main, sDebugMenu_ListTemplate_Main); +} +static void Debug_ReShowMainMenu(void) { Debug_ShowMenu(DebugTask_HandleMenuInput_Main, sDebugMenu_ListTemplate_Main); } @@ -694,12 +942,12 @@ static void Debug_ShowMenu(void (*HandleInput)(u8), struct ListMenuTemplate LMte // create window HideMapNamePopUpWindow(); LoadMessageBoxAndBorderGfx(); - windowId = AddWindow(&sDebugMenuWindowTemplate); + windowId = AddWindow(&sDebugMenuWindowTemplateMain); DrawStdWindowFrame(windowId, FALSE); // create list menu menuTemplate = LMtemplate; - menuTemplate.maxShowed = DEBUG_MAIN_MENU_HEIGHT; + menuTemplate.maxShowed = DEBUG_MENU_HEIGHT_MAIN; menuTemplate.windowId = windowId; menuTemplate.header_X = 0; menuTemplate.item_X = 8; @@ -715,13 +963,17 @@ static void Debug_ShowMenu(void (*HandleInput)(u8), struct ListMenuTemplate LMte menuTemplate.cursorKind = 0; menuTaskId = ListMenuInit(&menuTemplate, 0, 0); - // draw everything - CopyWindowToVram(windowId, 3); - // create input handler task inputTaskId = CreateTask(HandleInput, 3); gTasks[inputTaskId].data[0] = menuTaskId; gTasks[inputTaskId].data[1] = windowId; + gTasks[inputTaskId].data[2] = 0; + + Debug_RefreshListMenu(inputTaskId); + //Debug_ShowMenuDynamic(inputTaskId); + + // draw everything + CopyWindowToVram(windowId, 3); } static void Debug_DestroyMenu(u8 taskId) { @@ -731,11 +983,25 @@ static void Debug_DestroyMenu(u8 taskId) } static void Debug_DestroyMenu_Full(u8 taskId) { + if (gTasks[taskId].data[2] != 0) + { + ClearStdWindowAndFrame(gTasks[taskId].data[2], FALSE); + DebugAction_DestroyExtraWindow(taskId); + } DestroyListMenuTask(gTasks[taskId].data[0], NULL, NULL); ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE); RemoveWindow(gTasks[taskId].data[1]); DestroyTask(taskId); UnfreezeObjectEvents(); + Free(sDebugMenuListData); + Free(sDebugBattleData); +} +static void Debug_DestroyMenu_Full_Script(u8 taskId, const u8 *script) +{ + Debug_DestroyMenu_Full(taskId); + LockPlayerFieldControls(); + FreezeObjectEvents(); + ScriptContext_SetupScript(script); } static void DebugAction_Cancel(u8 taskId) { @@ -756,6 +1022,218 @@ static void DebugAction_DestroyExtraWindow(u8 taskId) UnfreezeObjectEvents(); } +static u8 Debug_CheckToggleFlags(u8 id) +{ + u8 result = FALSE; + + switch (id) + { + case DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_POKEDEX: + result = FlagGet(FLAG_SYS_POKEDEX_GET); + break; + case DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_NATDEX: + result = IsNationalPokedexEnabled(); + break; + case DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_POKENAV: + result = FlagGet(FLAG_SYS_POKENAV_GET); + break; + case DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_RUN_SHOES: + result = FlagGet(FLAG_SYS_B_DASH); + break; + case DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_LOCATIONS: + result = FlagGet(FLAG_VISITED_LITTLEROOT_TOWN) && + FlagGet(FLAG_VISITED_OLDALE_TOWN) && + FlagGet(FLAG_VISITED_DEWFORD_TOWN) && + FlagGet(FLAG_VISITED_LAVARIDGE_TOWN) && + FlagGet(FLAG_VISITED_FALLARBOR_TOWN) && + FlagGet(FLAG_VISITED_VERDANTURF_TOWN) && + FlagGet(FLAG_VISITED_PACIFIDLOG_TOWN) && + FlagGet(FLAG_VISITED_PETALBURG_CITY) && + FlagGet(FLAG_VISITED_SLATEPORT_CITY) && + FlagGet(FLAG_VISITED_MAUVILLE_CITY) && + FlagGet(FLAG_VISITED_RUSTBORO_CITY) && + FlagGet(FLAG_VISITED_FORTREE_CITY) && + FlagGet(FLAG_VISITED_LILYCOVE_CITY) && + FlagGet(FLAG_VISITED_MOSSDEEP_CITY) && + FlagGet(FLAG_VISITED_SOOTOPOLIS_CITY) && + FlagGet(FLAG_VISITED_EVER_GRANDE_CITY) && + FlagGet(FLAG_LANDMARK_POKEMON_LEAGUE) && + FlagGet(FLAG_LANDMARK_BATTLE_FRONTIER); + break; + case DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BADGES_ALL: + result = FlagGet(FLAG_BADGE01_GET) && + FlagGet(FLAG_BADGE02_GET) && + FlagGet(FLAG_BADGE03_GET) && + FlagGet(FLAG_BADGE04_GET) && + FlagGet(FLAG_BADGE05_GET) && + FlagGet(FLAG_BADGE06_GET) && + FlagGet(FLAG_BADGE07_GET) && + FlagGet(FLAG_BADGE08_GET); + break; + case DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_FRONTIER_PASS: + result = FlagGet(FLAG_SYS_FRONTIER_PASS); + break; + #if OW_FLAG_NO_COLLISION != 0 + case DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_COLISSION: + result = FlagGet(OW_FLAG_NO_COLLISION); + break; + #endif + #if OW_FLAG_NO_ENCOUNTER != 0 + case DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_ENCOUNTER: + result = FlagGet(OW_FLAG_NO_ENCOUNTER); + break; + #endif + #if OW_FLAG_NO_TRAINER_SEE != 0 + case DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_TRAINER_SEE: + result = FlagGet(OW_FLAG_NO_TRAINER_SEE); + break; + #endif + #if B_FLAG_NO_BAG_USE != 0 + case DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_BAG_USE: + result = FlagGet(B_FLAG_NO_BAG_USE); + break; + #endif + #if B_FLAG_NO_CATCHING != 0 + case DEBUG_FLAGVAR_MENU_ITEM_TOGGLE_CATCHING: + result = FlagGet(B_FLAG_NO_CATCHING); + break; + #endif + default: + result = 0xFF; + break; + } + + return result; +} + +static void Debug_InitDebugBattleData(void) +{ + u32 i; + sDebugBattleData->submenu = 0; + sDebugBattleData->battleType = 0xFF; + sDebugBattleData->battleTerrain = 0xFF; + + for (i = 0; i < AI_FLAG_COUNT; i++) + sDebugBattleData->aiFlags[i] = FALSE; +} + +static void Debug_RefreshListMenu(u8 taskId) +{ + u16 i; + const u8 sColor_Red[] = _("{COLOR RED}"); + const u8 sColor_Green[] = _("{COLOR GREEN}"); + u8 listTaskId = gTasks[taskId].data[0]; + struct ListMenu *list = (void*) gTasks[listTaskId].data; + u8 totalItems, flagResult; + u8 const * name; + + if (sDebugMenuListData->listId == 0) + { + gMultiuseListMenuTemplate = sDebugMenu_ListTemplate_FlagsVars; + totalItems = gMultiuseListMenuTemplate.totalItems; + } + else if (sDebugMenuListData->listId == 1 && sDebugBattleData->submenu <= 1) + { + gMultiuseListMenuTemplate = sDebugMenu_ListTemplate_Battle_1; + totalItems = gMultiuseListMenuTemplate.totalItems; + } + else if (sDebugMenuListData->listId == 1 && sDebugBattleData->submenu > 1) + { + gMultiuseListMenuTemplate = sDebugMenu_ListTemplate_Battle_2; + totalItems = 7; + } + + // Failsafe to prevent memory corruption + totalItems = min(totalItems, DEBUG_MAX_MENU_ITEMS); + // Copy item names for all entries but the last (which is Cancel) + for(i = 0; i < totalItems; i++) + { + + if (sDebugMenuListData->listId == 1 && sDebugBattleData->submenu > 1) + { + u16 species; + if (i == 6) + { + name = sDebugText_Continue; + StringCopy(&sDebugMenuListData->itemNames[i][0], name); + } + else if (GetMonData(&gEnemyParty[i], MON_DATA_SANITY_HAS_SPECIES)) + { + species = GetMonData(&gEnemyParty[i], MON_DATA_SPECIES); + StringCopy(gStringVar1, GetSpeciesName(species)); + StringCopy(&sDebugMenuListData->itemNames[i][0], gStringVar1); + } + else + { + StringCopy(&sDebugMenuListData->itemNames[i][0], sDebugText_Dashes); + } + } + else + { + if (sDebugMenuListData->listId == 0) + { + flagResult = Debug_CheckToggleFlags(i); + name = sDebugMenu_Items_FlagsVars[i].name; + } + else if (sDebugMenuListData->listId == 1) + { + flagResult = sDebugBattleData->aiFlags[i]; + if (i == totalItems - 1) + flagResult == 0xFF; + name = sDebugMenu_Items_Battle_1[i].name; + } + + if (flagResult == 0xFF) + { + StringCopy(&sDebugMenuListData->itemNames[i][0], name); + } + else if (flagResult) + { + StringCopy(gStringVar1, sColor_Green); + StringExpandPlaceholders(gStringVar4, name); + StringCopy(&sDebugMenuListData->itemNames[i][0], gStringVar4); + } + else + { + StringCopy(gStringVar1, sColor_Red); + StringExpandPlaceholders(gStringVar4, name); + StringCopy(&sDebugMenuListData->itemNames[i][0], gStringVar4); + } + } + + sDebugMenuListData->listItems[i].name = &sDebugMenuListData->itemNames[i][0]; + sDebugMenuListData->listItems[i].id = i; + } + + // Set list menu data + gMultiuseListMenuTemplate.items = sDebugMenuListData->listItems; + gMultiuseListMenuTemplate.totalItems = totalItems; + gMultiuseListMenuTemplate.maxShowed = DEBUG_MENU_HEIGHT_MAIN; + gMultiuseListMenuTemplate.windowId = gTasks[taskId].data[1]; + gMultiuseListMenuTemplate.header_X = 0; + gMultiuseListMenuTemplate.item_X = 8; + gMultiuseListMenuTemplate.cursor_X = 0; + gMultiuseListMenuTemplate.upText_Y = 1; + gMultiuseListMenuTemplate.cursorPal = 2; + gMultiuseListMenuTemplate.fillValue = 1; + gMultiuseListMenuTemplate.cursorShadowPal = 3; + gMultiuseListMenuTemplate.lettersSpacing = 1; + gMultiuseListMenuTemplate.itemVerticalPadding = 0; + gMultiuseListMenuTemplate.scrollMultiple = LIST_NO_MULTIPLE_SCROLL; + gMultiuseListMenuTemplate.fontId = 1; + gMultiuseListMenuTemplate.cursorKind = 0; +} +static void Debug_RedrawListMenu(u8 taskId) +{ + u8 listTaskId = gTasks[taskId].data[0]; + u16 scrollOffset, selectedRow; + ListMenuGetScrollAndRow(listTaskId, &scrollOffset, &selectedRow); + + DestroyListMenuTask(gTasks[taskId].data[0], &scrollOffset, &selectedRow); + Debug_RefreshListMenu(taskId); + gTasks[taskId].data[0] = ListMenuInit(&gMultiuseListMenuTemplate, scrollOffset, selectedRow); +} + // ******************************* // Handle Inputs @@ -792,7 +1270,7 @@ static void DebugTask_HandleMenuInput_Utilities(u8 taskId) { PlaySE(SE_SELECT); Debug_DestroyMenu(taskId); - Debug_ShowMainMenu(); + Debug_ReShowMainMenu(); } } static void DebugTask_HandleMenuInput_Scripts(u8 taskId) @@ -810,10 +1288,10 @@ static void DebugTask_HandleMenuInput_Scripts(u8 taskId) { PlaySE(SE_SELECT); Debug_DestroyMenu(taskId); - Debug_ShowMainMenu(); + Debug_ReShowMainMenu(); } } -static void DebugTask_HandleMenuInput_Flags(u8 taskId) +static void DebugTask_HandleMenuInput_FlagsVars(u8 taskId) { void (*func)(u8); u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); @@ -822,16 +1300,182 @@ static void DebugTask_HandleMenuInput_Flags(u8 taskId) { PlaySE(SE_SELECT); if ((func = sDebugMenu_Actions_Flags[input]) != NULL) + { func(taskId); + + // Remove TRUE/FALSE window for functions that haven't been assigned flags + if (gTasks[taskId].data[3] == 0xFF) + { + ClearStdWindowAndFrame(gTasks[taskId].data[2], TRUE); + RemoveWindow(gTasks[taskId].data[2]); + Free(sDebugMenuListData); + } + else + Debug_RedrawListMenu(taskId); + } } else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); Debug_DestroyMenu(taskId); - Debug_ShowMainMenu(); + Debug_ReShowMainMenu(); } } -static void DebugTask_HandleMenuInput_Vars(u8 taskId) + +static void DebugTask_HandleBattleMenuReDraw(u8 taskId) +{ + Debug_RefreshListMenu(taskId); + switch (sDebugBattleData->submenu) + { + case 0: + Debug_DestroyMenu(taskId); + Debug_ShowMenu(DebugTask_HandleMenuInput_Battle, sDebugMenu_ListTemplate_Battle_0); + break; + case 1: + Debug_DestroyMenu(taskId); + Debug_ShowMenu(DebugTask_HandleMenuInput_Battle, gMultiuseListMenuTemplate); + break; + case 2: + Debug_DestroyMenu(taskId); + Debug_ShowMenu(DebugTask_HandleMenuInput_Battle, sDebugMenu_ListTemplate_Battle_2); + break; + case 3: + Debug_DestroyMenu(taskId); + Debug_ShowMenu(DebugTask_HandleMenuInput_Battle, gMultiuseListMenuTemplate); + break; + } +} +static void DebugTask_HandleMenuInput_Battle(u8 taskId) +{ + void (*func)(u8); + u8 listTaskId = gTasks[taskId].data[0]; + u32 input = ListMenu_ProcessInput(listTaskId); + u16 idx; + + ListMenuGetCurrentItemArrayId(listTaskId, &idx); + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + + switch (sDebugBattleData->submenu) + { + case 0: // Battle type + sDebugBattleData->battleType = idx; + sDebugBattleData->submenu++; + Debug_DestroyMenu(taskId); + + if (sDebugBattleData->battleType == DEBUG_BATTLE_0_MENU_ITEM_WILD // Skip AI Flag selection if wild battle + || sDebugBattleData->battleType == DEBUG_BATTLE_0_MENU_ITEM_WILD_DOUBLE) + { + sDebugBattleData->submenu++; + Debug_ShowMenu(DebugTask_HandleMenuInput_Battle, sDebugMenu_ListTemplate_Battle_2); + } + else + { + Debug_ShowMenu(DebugTask_HandleMenuInput_Battle, gMultiuseListMenuTemplate); + } + break; + case 1: // AI Flags + if (idx == sDebugMenu_ListTemplate_Battle_1.totalItems - 1) + { + sDebugBattleData->submenu++; + Debug_DestroyMenu(taskId); + Debug_ShowMenu(DebugTask_HandleMenuInput_Battle, sDebugMenu_ListTemplate_Battle_2); + } + else + { + sDebugBattleData->aiFlags[idx] = !sDebugBattleData->aiFlags[idx]; + Debug_RedrawListMenu(taskId); + } + + break; + case 2: // Terrain + sDebugBattleData->submenu++; + sDebugBattleData->battleTerrain = idx; + Debug_DestroyMenu(taskId); + Debug_ShowMenu(DebugTask_HandleMenuInput_Battle, gMultiuseListMenuTemplate); + break; + case 3: // Enemy pokemon + if (idx == 6) + Debug_InitializeBattle(taskId); + break; + } + } + else if (gMain.newKeys & B_BUTTON) + { + switch (sDebugBattleData->submenu) + { + case 0: // Return to Main menu + PlaySE(SE_SELECT); + Debug_DestroyMenu(taskId); + Debug_ReShowMainMenu(); + break; + case 2: // Skip AI Flag selection if wild battle + if (sDebugBattleData->battleType == DEBUG_BATTLE_0_MENU_ITEM_WILD + || sDebugBattleData->battleType == DEBUG_BATTLE_0_MENU_ITEM_WILD_DOUBLE) + { + sDebugBattleData->submenu = 0; + } + else + sDebugBattleData->submenu--; + DebugTask_HandleBattleMenuReDraw(taskId); + break; + default: + sDebugBattleData->submenu--; + DebugTask_HandleBattleMenuReDraw(taskId); + break; + } + } +} + +static void Debug_InitializeBattle(u8 taskId) +{ + u32 i; + gBattleTypeFlags = 0; + + // Set main battle flags + switch (sDebugBattleData->battleType) + { + case DEBUG_BATTLE_0_MENU_ITEM_WILD: + break; + case DEBUG_BATTLE_0_MENU_ITEM_SINGLE: + gBattleTypeFlags = (BATTLE_TYPE_TRAINER); + break; + case DEBUG_BATTLE_0_MENU_ITEM_DOUBLE: + gBattleTypeFlags = (BATTLE_TYPE_DOUBLE | BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_TRAINER); + break; + case DEBUG_BATTLE_0_MENU_ITEM_MULTI: + gBattleTypeFlags = (BATTLE_TYPE_DOUBLE | BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_TRAINER | BATTLE_TYPE_INGAME_PARTNER); + break; + } + + // Set terrain + gBattleTerrain = sDebugBattleData->battleTerrain; + + // Populate enemy party + for (i = 0; i < PARTY_SIZE; i++) + { + ZeroMonData(&gEnemyParty[i]); + if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_HAS_SPECIES)) + gEnemyParty[i] = gPlayerParty[i]; + } + + // Set AI flags + for (i = 0; i < ARRAY_COUNT(sDebugBattleData->aiFlags); i++) + { + if (sDebugBattleData->aiFlags[i]) + gDebugAIFlags |= (1 << i); + } + + gIsDebugBattle = TRUE; + BattleSetup_StartTrainerBattle_Debug(); + + + Debug_DestroyMenu_Full(taskId); +} + +static void DebugTask_HandleMenuInput_Give(u8 taskId) { void (*func)(u8); u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); @@ -839,32 +1483,32 @@ static void DebugTask_HandleMenuInput_Vars(u8 taskId) if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); - if ((func = sDebugMenu_Actions_Vars[input]) != NULL) + if ((func = sDebugMenu_Actions_Give[input]) != NULL) func(taskId); } else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); Debug_DestroyMenu(taskId); - Debug_ShowMainMenu(); + Debug_ReShowMainMenu(); } } -static void DebugTask_HandleMenuInput_Give(u8 taskId) +static void DebugTask_HandleMenuInput_Fill(u8 taskId) { void (*func)(u8); u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]); - if (JOY_NEW(A_BUTTON)) + if (gMain.newKeys & A_BUTTON) { PlaySE(SE_SELECT); - if ((func = sDebugMenu_Actions_Give[input]) != NULL) + if ((func = sDebugMenu_Actions_Fill[input]) != NULL) func(taskId); } - else if (JOY_NEW(B_BUTTON)) + else if (gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); Debug_DestroyMenu(taskId); - Debug_ShowMainMenu(); + Debug_ReShowMainMenu(); } } static void DebugTask_HandleMenuInput_Sound(u8 taskId) @@ -882,7 +1526,7 @@ static void DebugTask_HandleMenuInput_Sound(u8 taskId) { PlaySE(SE_SELECT); Debug_DestroyMenu(taskId); - Debug_ShowMainMenu(); + Debug_ReShowMainMenu(); } } @@ -898,28 +1542,36 @@ static void DebugAction_OpenScriptsMenu(u8 taskId) Debug_DestroyMenu(taskId); Debug_ShowMenu(DebugTask_HandleMenuInput_Scripts, sDebugMenu_ListTemplate_Scripts); } -static void DebugAction_OpenFlagsMenu(u8 taskId) +static void DebugAction_OpenFlagsVarsMenu(u8 taskId) { Debug_DestroyMenu(taskId); - Debug_ShowMenu(DebugTask_HandleMenuInput_Flags, sDebugMenu_ListTemplate_Flags); + sDebugMenuListData->listId = 0; + Debug_ShowMenu(DebugTask_HandleMenuInput_FlagsVars, gMultiuseListMenuTemplate); } -static void DebugAction_OpenVariablesMenu(u8 taskId) + +static void DebugAction_OpenBattleMenu(u8 taskId) { Debug_DestroyMenu(taskId); - Debug_ShowMenu(DebugTask_HandleMenuInput_Vars, sDebugMenu_ListTemplate_Vars); + sDebugMenuListData->listId = 1; + Debug_ShowMenu(DebugTask_HandleMenuInput_Battle, sDebugMenu_ListTemplate_Battle_0); } + static void DebugAction_OpenGiveMenu(u8 taskId) { Debug_DestroyMenu(taskId); Debug_ShowMenu(DebugTask_HandleMenuInput_Give, sDebugMenu_ListTemplate_Give); } +static void DebugAction_OpenFillMenu(u8 taskId) +{ + Debug_DestroyMenu(taskId); + Debug_ShowMenu(DebugTask_HandleMenuInput_Fill, sDebugMenu_ListTemplate_Fill); +} static void DebugAction_OpenSoundMenu(u8 taskId) { Debug_DestroyMenu(taskId); Debug_ShowMenu(DebugTask_HandleMenuInput_Sound, sDebugMenu_ListTemplate_Sound); } - // ******************************* // Actions Utilities static void DebugAction_Util_HealParty(u8 taskId) @@ -962,7 +1614,7 @@ static void DebugAction_Util_Warp_Warp(u8 taskId) HideMapNamePopUpWindow(); LoadMessageBoxAndBorderGfx(); - windowId = AddWindow(&sDebugNumberDisplayWindowTemplate); + windowId = AddWindow(&sDebugMenuWindowTemplateExtra); DrawStdWindowFrame(windowId, FALSE); CopyWindowToVram(windowId, 3); @@ -1138,20 +1790,6 @@ static void DebugAction_Util_Warp_SelectWarp(u8 taskId) } } -static void DebugAction_Util_RunningShoes(u8 taskId) -{ - if (FlagGet(FLAG_SYS_B_DASH)) - { - FlagClear(FLAG_SYS_B_DASH); - PlaySE(SE_PC_OFF); - } - else - { - FlagSet(FLAG_SYS_B_DASH); - PlaySE(SE_PC_LOGIN); - } -} - static void DebugAction_Util_PoisonMons(u8 taskId) { int i; @@ -1168,7 +1806,7 @@ static void DebugAction_Util_PoisonMons(u8 taskId) PlaySE(SE_FIELD_POISON); } -void CheckSaveBlock1Size(void) +void CheckSaveBlock1Size(struct ScriptContext *ctx) { u32 currSb1Size = sizeof(struct SaveBlock1); u32 maxSb1Size = SECTOR_DATA_SIZE * (SECTOR_ID_SAVEBLOCK1_END - SECTOR_ID_SAVEBLOCK1_START + 1); @@ -1176,7 +1814,7 @@ void CheckSaveBlock1Size(void) ConvertIntToDecimalStringN(gStringVar2, maxSb1Size, STR_CONV_MODE_LEFT_ALIGN, 6); } -void CheckSaveBlock2Size(void) +void CheckSaveBlock2Size(struct ScriptContext *ctx) { u32 currSb2Size = (sizeof(struct SaveBlock2)); u32 maxSb2Size = SECTOR_DATA_SIZE; @@ -1184,7 +1822,7 @@ void CheckSaveBlock2Size(void) ConvertIntToDecimalStringN(gStringVar2, maxSb2Size, STR_CONV_MODE_LEFT_ALIGN, 6); } -void CheckPokemonStorageSize(void) +void CheckPokemonStorageSize(struct ScriptContext *ctx) { u32 currPkmnStorageSize = sizeof(struct PokemonStorage); u32 maxPkmnStorageSize = SECTOR_DATA_SIZE * (SECTOR_ID_PKMN_STORAGE_END - SECTOR_ID_PKMN_STORAGE_START + 1); @@ -1229,7 +1867,7 @@ static void DebugAction_Util_Weather(u8 taskId) HideMapNamePopUpWindow(); LoadMessageBoxAndBorderGfx(); - windowId = AddWindow(&sDebugNumberDisplayMediumWindowTemplate); + windowId = AddWindow(&sDebugMenuWindowTemplateWeather); DrawStdWindowFrame(windowId, FALSE); CopyWindowToVram(windowId, 3); @@ -1304,15 +1942,11 @@ static void DebugAction_Util_Weather_SelectId(u8 taskId) static void DebugAction_Util_CheckWallClock(u8 taskId) { - Debug_DestroyMenu_Full(taskId); - LockPlayerFieldControls(); - ScriptContext_SetupScript(PlayersHouse_2F_EventScript_CheckWallClock); + Debug_DestroyMenu_Full_Script(taskId, PlayersHouse_2F_EventScript_CheckWallClock); } static void DebugAction_Util_SetWallClock(u8 taskId) { - Debug_DestroyMenu_Full(taskId); - LockPlayerFieldControls(); - ScriptContext_SetupScript(PlayersHouse_2F_EventScript_SetWallClock); + Debug_DestroyMenu_Full_Script(taskId, PlayersHouse_2F_EventScript_SetWallClock); } static void DebugAction_Util_WatchCredits(u8 taskId) { @@ -1347,61 +1981,53 @@ static void DebugAction_Util_Clear_Boxes(u8 taskId) Debug_DestroyMenu_Full(taskId); ScriptContext_Enable(); } +static void DebugAction_Util_CheatStart(u8 taskId) +{ + Debug_DestroyMenu_Full_Script(taskId, Debug_CheatStart); +} +static void DebugAction_Util_HatchAnEgg(u8 taskId) +{ + Debug_DestroyMenu_Full_Script(taskId, Debug_HatchAnEgg); +} // ******************************* // Actions Scripts static void DebugAction_Util_Script_1(u8 taskId) { - Debug_DestroyMenu_Full(taskId); - LockPlayerFieldControls(); - ScriptContext_SetupScript(Debug_Script_1); + Debug_DestroyMenu_Full_Script(taskId, Debug_Script_1); } static void DebugAction_Util_Script_2(u8 taskId) { - Debug_DestroyMenu_Full(taskId); - LockPlayerFieldControls(); - ScriptContext_SetupScript(Debug_Script_2); + Debug_DestroyMenu_Full_Script(taskId, Debug_Script_2); } static void DebugAction_Util_Script_3(u8 taskId) { - Debug_DestroyMenu_Full(taskId); - LockPlayerFieldControls(); - ScriptContext_SetupScript(Debug_Script_3); + Debug_DestroyMenu_Full_Script(taskId, Debug_Script_3); } static void DebugAction_Util_Script_4(u8 taskId) { - Debug_DestroyMenu_Full(taskId); - LockPlayerFieldControls(); - ScriptContext_SetupScript(Debug_Script_4); + Debug_DestroyMenu_Full_Script(taskId, Debug_Script_4); } static void DebugAction_Util_Script_5(u8 taskId) { - Debug_DestroyMenu_Full(taskId); - LockPlayerFieldControls(); - ScriptContext_SetupScript(Debug_Script_5); + Debug_DestroyMenu_Full_Script(taskId, Debug_Script_5); } static void DebugAction_Util_Script_6(u8 taskId) { - Debug_DestroyMenu_Full(taskId); - LockPlayerFieldControls(); - ScriptContext_SetupScript(Debug_Script_6); + Debug_DestroyMenu_Full_Script(taskId, Debug_Script_6); } static void DebugAction_Util_Script_7(u8 taskId) { - Debug_DestroyMenu_Full(taskId); - LockPlayerFieldControls(); - ScriptContext_SetupScript(Debug_Script_7); + Debug_DestroyMenu_Full_Script(taskId, Debug_Script_7); } static void DebugAction_Util_Script_8(u8 taskId) { - Debug_DestroyMenu_Full(taskId); - LockPlayerFieldControls(); - ScriptContext_SetupScript(Debug_Script_8); + Debug_DestroyMenu_Full_Script(taskId, Debug_Script_8); } // ******************************* -// Actions Flags -static void DebugAction_Flags_Flags(u8 taskId) +// Actions Flags and Vars +static void DebugAction_FlagsVars_Flags(u8 taskId) { u8 windowId; @@ -1410,7 +2036,7 @@ static void DebugAction_Flags_Flags(u8 taskId) HideMapNamePopUpWindow(); LoadMessageBoxAndBorderGfx(); - windowId = AddWindow(&sDebugNumberDisplayWindowTemplate); + windowId = AddWindow(&sDebugMenuWindowTemplateExtra); DrawStdWindowFrame(windowId, FALSE); CopyWindowToVram(windowId, 3); @@ -1418,248 +2044,82 @@ static void DebugAction_Flags_Flags(u8 taskId) //Display initial Flag ConvertIntToDecimalStringN(gStringVar1, 1, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_FLAGS); ConvertIntToHexStringN(gStringVar2, 1, STR_CONV_MODE_LEFT_ALIGN, 3); - StringExpandPlaceholders(gStringVar1, sDebugText_Flags_FlagHex); - if (FlagGet(FLAG_TEMP_1) == TRUE) - StringCopyPadded(gStringVar2, sDebugText_Flags_FlagSet, CHAR_SPACE, 15); + StringExpandPlaceholders(gStringVar1, sDebugText_FlagsVars_FlagHex); + if (FlagGet(FLAG_TEMP_1)) + StringCopyPadded(gStringVar2, sDebugText_True, CHAR_SPACE, 15); else - StringCopyPadded(gStringVar2, sDebugText_Flags_FlagUnset, CHAR_SPACE, 15); + StringCopyPadded(gStringVar2, sDebugText_False, CHAR_SPACE, 15); StringCopy(gStringVar3, gText_DigitIndicator[0]); - StringExpandPlaceholders(gStringVar4, sDebugText_Flags_Flag); + StringExpandPlaceholders(gStringVar4, sDebugText_FlagsVars_Flag); AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); - gTasks[taskId].func = DebugAction_Flags_FlagsSelect; + gTasks[taskId].func = DebugAction_FlagsVars_FlagsSelect; gTasks[taskId].data[2] = windowId; gTasks[taskId].data[3] = FLAG_TEMP_1; //Current Flag gTasks[taskId].data[4] = 0; //Digit Selected } -static void DebugAction_Flags_FlagsSelect(u8 taskId) -{ - if (JOY_NEW(A_BUTTON)) - FlagToggle(gTasks[taskId].data[3]); - else if (JOY_NEW(B_BUTTON)) - { - PlaySE(SE_SELECT); - DebugAction_DestroyExtraWindow(taskId); - return; - } - - if (JOY_NEW(DPAD_UP)) - { - PlaySE(SE_SELECT); - gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] >= FLAGS_COUNT){ - gTasks[taskId].data[3] = FLAGS_COUNT - 1; - } - } - if (JOY_NEW(DPAD_DOWN)) - { - PlaySE(SE_SELECT); - gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] < 1){ - gTasks[taskId].data[3] = 1; - } - } - if (JOY_NEW(DPAD_LEFT)) - { - PlaySE(SE_SELECT); - gTasks[taskId].data[4] -= 1; - if (gTasks[taskId].data[4] < 0) - { - gTasks[taskId].data[4] = 0; - } - } - if (JOY_NEW(DPAD_RIGHT)) - { - PlaySE(SE_SELECT); - gTasks[taskId].data[4] += 1; - if (gTasks[taskId].data[4] > DEBUG_NUMBER_DIGITS_FLAGS - 1) - { - gTasks[taskId].data[4] = DEBUG_NUMBER_DIGITS_FLAGS - 1; - } - } - - if (JOY_NEW(DPAD_ANY) || JOY_NEW(A_BUTTON)) - { - ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_FLAGS); - ConvertIntToHexStringN(gStringVar2, gTasks[taskId].data[3], STR_CONV_MODE_LEFT_ALIGN, 3); - StringExpandPlaceholders(gStringVar1, sDebugText_Flags_FlagHex); - if (FlagGet(gTasks[taskId].data[3]) == TRUE) - StringCopyPadded(gStringVar2, sDebugText_Flags_FlagSet, CHAR_SPACE, 15); - else - StringCopyPadded(gStringVar2, sDebugText_Flags_FlagUnset, CHAR_SPACE, 15); - StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); - StringExpandPlaceholders(gStringVar4, sDebugText_Flags_Flag); - AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); - } -} - -static void DebugAction_Flags_SetPokedexFlags(u8 taskId) -{ - u16 i; - for (i = 0; i < NATIONAL_DEX_COUNT; i++) - { - GetSetPokedexFlag(i + 1, FLAG_SET_CAUGHT); - GetSetPokedexFlag(i + 1, FLAG_SET_SEEN); - } - Debug_DestroyMenu_Full(taskId); - ScriptContext_Enable(); -} -static void DebugAction_Flags_SwitchDex(u8 taskId) -{ - if (FlagGet(FLAG_SYS_POKEDEX_GET)) - PlaySE(SE_PC_OFF); - else - PlaySE(SE_PC_LOGIN); - FlagToggle(FLAG_SYS_POKEDEX_GET); -} -static void DebugAction_Flags_SwitchNatDex(u8 taskId) -{ - if (IsNationalPokedexEnabled()) - { - DisableNationalPokedex(); - PlaySE(SE_PC_OFF); - } - else - { - EnableNationalPokedex(); - PlaySE(SE_PC_LOGIN); - } -} -static void DebugAction_Flags_SwitchPokeNav(u8 taskId) -{ - if (FlagGet(FLAG_SYS_POKENAV_GET)) - PlaySE(SE_PC_OFF); - else - PlaySE(SE_PC_LOGIN); - FlagToggle(FLAG_SYS_POKENAV_GET); -} -static void DebugAction_Flags_ToggleFlyFlags(u8 taskId) -{ - // Sound effect - if (FlagGet(FLAG_LANDMARK_BATTLE_FRONTIER)) - PlaySE(SE_PC_OFF); - else - PlaySE(SE_PC_LOGIN); - - FlagToggle(FLAG_VISITED_LITTLEROOT_TOWN); - FlagToggle(FLAG_VISITED_OLDALE_TOWN); - FlagToggle(FLAG_VISITED_DEWFORD_TOWN); - FlagToggle(FLAG_VISITED_LAVARIDGE_TOWN); - FlagToggle(FLAG_VISITED_FALLARBOR_TOWN); - FlagToggle(FLAG_VISITED_VERDANTURF_TOWN); - FlagToggle(FLAG_VISITED_PACIFIDLOG_TOWN); - FlagToggle(FLAG_VISITED_PETALBURG_CITY); - FlagToggle(FLAG_VISITED_SLATEPORT_CITY); - FlagToggle(FLAG_VISITED_MAUVILLE_CITY); - FlagToggle(FLAG_VISITED_RUSTBORO_CITY); - FlagToggle(FLAG_VISITED_FORTREE_CITY); - FlagToggle(FLAG_VISITED_LILYCOVE_CITY); - FlagToggle(FLAG_VISITED_MOSSDEEP_CITY); - FlagToggle(FLAG_VISITED_SOOTOPOLIS_CITY); - FlagToggle(FLAG_VISITED_EVER_GRANDE_CITY); - FlagToggle(FLAG_LANDMARK_POKEMON_LEAGUE); - FlagToggle(FLAG_LANDMARK_BATTLE_FRONTIER); -} -static void DebugAction_Flags_ToggleBadgeFlags(u8 taskId) -{ - // Sound effect - if (FlagGet(FLAG_BADGE08_GET)) - PlaySE(SE_PC_OFF); - else - PlaySE(SE_PC_LOGIN); - - FlagToggle(FLAG_BADGE01_GET); - FlagToggle(FLAG_BADGE02_GET); - FlagToggle(FLAG_BADGE03_GET); - FlagToggle(FLAG_BADGE04_GET); - FlagToggle(FLAG_BADGE05_GET); - FlagToggle(FLAG_BADGE06_GET); - FlagToggle(FLAG_BADGE07_GET); - FlagToggle(FLAG_BADGE08_GET); -} -static void DebugAction_Flags_ToggleFrontierPass(u8 taskId) -{ - // Sound effect - if (FlagGet(FLAG_SYS_FRONTIER_PASS)) - PlaySE(SE_PC_OFF); - else - PlaySE(SE_PC_LOGIN); - FlagToggle(FLAG_SYS_FRONTIER_PASS); -} -static void DebugAction_Flags_CollisionOnOff(u8 taskId) -{ -#if OW_FLAG_NO_COLLISION == 0 - Debug_DestroyMenu_Full(taskId); - LockPlayerFieldControls(); - ScriptContext_SetupScript(Debug_FlagsNotSetOverworldConfigMessage); -#else - if (FlagGet(OW_FLAG_NO_COLLISION)) - PlaySE(SE_PC_OFF); - else - PlaySE(SE_PC_LOGIN); - FlagToggle(OW_FLAG_NO_COLLISION); -#endif -} -static void DebugAction_Flags_EncounterOnOff(u8 taskId) -{ -#if OW_FLAG_NO_ENCOUNTER == 0 - Debug_DestroyMenu_Full(taskId); - LockPlayerFieldControls(); - ScriptContext_SetupScript(Debug_FlagsNotSetOverworldConfigMessage); -#else - if (FlagGet(OW_FLAG_NO_ENCOUNTER)) - PlaySE(SE_PC_OFF); - else - PlaySE(SE_PC_LOGIN); - FlagToggle(OW_FLAG_NO_ENCOUNTER); -#endif -} -static void DebugAction_Flags_TrainerSeeOnOff(u8 taskId) -{ -#if OW_FLAG_NO_TRAINER_SEE == 0 - Debug_DestroyMenu_Full(taskId); - LockPlayerFieldControls(); - ScriptContext_SetupScript(Debug_FlagsNotSetOverworldConfigMessage); -#else - if (FlagGet(OW_FLAG_NO_TRAINER_SEE)) - PlaySE(SE_PC_OFF); - else - PlaySE(SE_PC_LOGIN); - FlagToggle(OW_FLAG_NO_TRAINER_SEE); -#endif -} -static void DebugAction_Flags_BagUseOnOff(u8 taskId) -{ -#if B_FLAG_NO_BAG_USE == 0 - Debug_DestroyMenu_Full(taskId); - LockPlayerFieldControls(); - ScriptContext_SetupScript(Debug_FlagsNotSetBattleConfigMessage); -#else - if (FlagGet(B_FLAG_NO_BAG_USE)) - PlaySE(SE_PC_OFF); - else - PlaySE(SE_PC_LOGIN); - FlagToggle(B_FLAG_NO_BAG_USE); -#endif -} -static void DebugAction_Flags_CatchingOnOff(u8 taskId) -{ -#if B_FLAG_NO_CATCHING == 0 - Debug_DestroyMenu_Full(taskId); - LockPlayerFieldControls(); - ScriptContext_SetupScript(Debug_FlagsNotSetBattleConfigMessage); -#else - if (FlagGet(B_FLAG_NO_CATCHING)) - PlaySE(SE_PC_OFF); - else - PlaySE(SE_PC_LOGIN); - FlagToggle(B_FLAG_NO_CATCHING); -#endif -} +static void DebugAction_FlagsVars_FlagsSelect(u8 taskId) +{ + if (JOY_NEW(A_BUTTON)) + FlagToggle(gTasks[taskId].data[3]); + else if (JOY_NEW(B_BUTTON)) + { + PlaySE(SE_SELECT); + DebugAction_DestroyExtraWindow(taskId); + return; + } -// ******************************* -// Actions Variables -static void DebugAction_Vars_Vars(u8 taskId) + if (JOY_NEW(DPAD_UP)) + { + PlaySE(SE_SELECT); + gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] >= FLAGS_COUNT){ + gTasks[taskId].data[3] = FLAGS_COUNT - 1; + } + } + if (JOY_NEW(DPAD_DOWN)) + { + PlaySE(SE_SELECT); + gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]]; + if (gTasks[taskId].data[3] < 1){ + gTasks[taskId].data[3] = 1; + } + } + if (JOY_NEW(DPAD_LEFT)) + { + PlaySE(SE_SELECT); + gTasks[taskId].data[4] -= 1; + if (gTasks[taskId].data[4] < 0) + { + gTasks[taskId].data[4] = 0; + } + } + if (JOY_NEW(DPAD_RIGHT)) + { + PlaySE(SE_SELECT); + gTasks[taskId].data[4] += 1; + if (gTasks[taskId].data[4] > DEBUG_NUMBER_DIGITS_FLAGS - 1) + { + gTasks[taskId].data[4] = DEBUG_NUMBER_DIGITS_FLAGS - 1; + } + } + + if (JOY_NEW(DPAD_ANY) || JOY_NEW(A_BUTTON)) + { + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_FLAGS); + ConvertIntToHexStringN(gStringVar2, gTasks[taskId].data[3], STR_CONV_MODE_LEFT_ALIGN, 3); + StringExpandPlaceholders(gStringVar1, sDebugText_FlagsVars_FlagHex); + if (FlagGet(gTasks[taskId].data[3]) == TRUE) + StringCopyPadded(gStringVar2, sDebugText_True, CHAR_SPACE, 15); + else + StringCopyPadded(gStringVar2, sDebugText_False, CHAR_SPACE, 15); + StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); + StringExpandPlaceholders(gStringVar4, sDebugText_FlagsVars_Flag); + AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); + } +} + +static void DebugAction_FlagsVars_Vars(u8 taskId) { u8 windowId; @@ -1668,7 +2128,7 @@ static void DebugAction_Vars_Vars(u8 taskId) HideMapNamePopUpWindow(); LoadMessageBoxAndBorderGfx(); - windowId = AddWindow(&sDebugNumberDisplayWindowTemplate); + windowId = AddWindow(&sDebugMenuWindowTemplateExtra); DrawStdWindowFrame(windowId, FALSE); CopyWindowToVram(windowId, 3); @@ -1676,21 +2136,21 @@ static void DebugAction_Vars_Vars(u8 taskId) //Display initial Variable ConvertIntToDecimalStringN(gStringVar1, VARS_START, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); ConvertIntToHexStringN(gStringVar2, VARS_START, STR_CONV_MODE_LEFT_ALIGN, 4); - StringExpandPlaceholders(gStringVar1, sDebugText_Vars_VariableHex); + StringExpandPlaceholders(gStringVar1, sDebugText_FlagsVars_VariableHex); ConvertIntToDecimalStringN(gStringVar3, 0, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); StringCopy(gStringVar2, gText_DigitIndicator[0]); - StringExpandPlaceholders(gStringVar4, sDebugText_Vars_Variable); + StringExpandPlaceholders(gStringVar4, sDebugText_FlagsVars_Variable); AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); - gTasks[taskId].func = DebugAction_Vars_Select; + gTasks[taskId].func = DebugAction_FlagsVars_Select; gTasks[taskId].data[2] = windowId; gTasks[taskId].data[3] = VARS_START; //Current Variable gTasks[taskId].data[4] = 0; //Digit Selected gTasks[taskId].data[5] = 0; //Current Variable VALUE } -static void DebugAction_Vars_Select(u8 taskId) +static void DebugAction_FlagsVars_Select(u8 taskId) { if (JOY_NEW(DPAD_UP)) { @@ -1723,7 +2183,7 @@ static void DebugAction_Vars_Select(u8 taskId) ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); ConvertIntToHexStringN(gStringVar2, gTasks[taskId].data[3], STR_CONV_MODE_LEFT_ALIGN, 4); - StringExpandPlaceholders(gStringVar1, sDebugText_Vars_VariableHex); + StringExpandPlaceholders(gStringVar1, sDebugText_FlagsVars_VariableHex); if (VarGetIfExist(gTasks[taskId].data[3]) == 65535) //Current value, if 65535 the value hasnt been set gTasks[taskId].data[5] = 0; else @@ -1732,7 +2192,7 @@ static void DebugAction_Vars_Select(u8 taskId) StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); //Current digit //Combine str's to full window string - StringExpandPlaceholders(gStringVar4, sDebugText_Vars_Variable); + StringExpandPlaceholders(gStringVar4, sDebugText_FlagsVars_Variable); AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); } @@ -1744,7 +2204,7 @@ static void DebugAction_Vars_Select(u8 taskId) ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); ConvertIntToHexStringN(gStringVar2, gTasks[taskId].data[3], STR_CONV_MODE_LEFT_ALIGN, 4); - StringExpandPlaceholders(gStringVar1, sDebugText_Vars_VariableHex); + StringExpandPlaceholders(gStringVar1, sDebugText_FlagsVars_VariableHex); if (VarGetIfExist(gTasks[taskId].data[3]) == 65535) //Current value if 65535 the value hasnt been set gTasks[taskId].data[5] = 0; else @@ -1752,11 +2212,11 @@ static void DebugAction_Vars_Select(u8 taskId) ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[5], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); //Current digit - StringExpandPlaceholders(gStringVar4, sDebugText_Vars_VariableValueSet); + StringExpandPlaceholders(gStringVar4, sDebugText_FlagsVars_VariableValueSet); AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); gTasks[taskId].data[6] = gTasks[taskId].data[5]; //New value selector - gTasks[taskId].func = DebugAction_Vars_SetValue; + gTasks[taskId].func = DebugAction_FlagsVars_SetValue; } else if (JOY_NEW(B_BUTTON)) { @@ -1765,7 +2225,7 @@ static void DebugAction_Vars_Select(u8 taskId) return; } } -static void DebugAction_Vars_SetValue(u8 taskId) +static void DebugAction_FlagsVars_SetValue(u8 taskId) { if (JOY_NEW(DPAD_UP)) { @@ -1819,16 +2279,233 @@ static void DebugAction_Vars_SetValue(u8 taskId) ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); ConvertIntToHexStringN(gStringVar2, gTasks[taskId].data[3], STR_CONV_MODE_LEFT_ALIGN, 4); - StringExpandPlaceholders(gStringVar1, sDebugText_Vars_VariableHex); + StringExpandPlaceholders(gStringVar1, sDebugText_FlagsVars_VariableHex); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[6], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); //Current digit - StringExpandPlaceholders(gStringVar4, sDebugText_Vars_VariableValueSet); + StringExpandPlaceholders(gStringVar4, sDebugText_FlagsVars_VariableValueSet); AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); } } +static void DebugAction_FlagsVars_PokedexFlags_All(u8 taskId) +{ + u16 i; + for (i = 0; i < NATIONAL_DEX_COUNT; i++) + { + GetSetPokedexFlag(i + 1, FLAG_SET_CAUGHT); + GetSetPokedexFlag(i + 1, FLAG_SET_SEEN); + } + Debug_DestroyMenu_Full(taskId); + ScriptContext_Enable(); +} +static void DebugAction_FlagsVars_PokedexFlags_Reset(u8 taskId) +{ + int boxId, boxPosition, partyId; + u16 species; + + // Reset Pokedex to emtpy + memset(&gSaveBlock1Ptr->dexCaught, 0, sizeof(gSaveBlock1Ptr->dexCaught)); + memset(&gSaveBlock1Ptr->dexSeen, 0, sizeof(gSaveBlock1Ptr->dexSeen)); + + // Add party Pokemon to Pokedex + for (partyId = 0; partyId < PARTY_SIZE; partyId++) + { + if (GetMonData(&gPlayerParty[partyId], MON_DATA_SANITY_HAS_SPECIES)) + { + species = GetMonData(&gPlayerParty[partyId], MON_DATA_SPECIES); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_SET_CAUGHT); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_SET_SEEN); + } + } + + // Add box Pokemon to Pokedex + for (boxId = 0; boxId < TOTAL_BOXES_COUNT; boxId++) + { + for (boxPosition = 0; boxPosition < IN_BOX_COUNT; boxPosition++) + { + if (GetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], MON_DATA_SANITY_HAS_SPECIES)) + { + species = GetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], MON_DATA_SPECIES); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_SET_CAUGHT); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_SET_SEEN); + } + } + } + Debug_DestroyMenu_Full(taskId); + ScriptContext_Enable(); +} +static void DebugAction_FlagsVars_SwitchDex(u8 taskId) +{ + if (FlagGet(FLAG_SYS_POKEDEX_GET)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + FlagToggle(FLAG_SYS_POKEDEX_GET); +} +static void DebugAction_FlagsVars_SwitchNatDex(u8 taskId) +{ + if (IsNationalPokedexEnabled()) + { + DisableNationalPokedex(); + PlaySE(SE_PC_OFF); + }else{ + EnableNationalPokedex(); + PlaySE(SE_PC_LOGIN); + } +} +static void DebugAction_FlagsVars_SwitchPokeNav(u8 taskId) +{ + if (FlagGet(FLAG_SYS_POKENAV_GET)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + FlagToggle(FLAG_SYS_POKENAV_GET); +} +static void DebugAction_FlagsVars_RunningShoes(u8 taskId) +{ + if (FlagGet(FLAG_SYS_B_DASH)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + FlagToggle(FLAG_SYS_B_DASH); +} +static void DebugAction_FlagsVars_ToggleFlyFlags(u8 taskId) +{ + // Sound effect + if (FlagGet(FLAG_LANDMARK_BATTLE_FRONTIER)) + { + PlaySE(SE_PC_OFF); + + FlagClear(FLAG_VISITED_LITTLEROOT_TOWN); + FlagClear(FLAG_VISITED_OLDALE_TOWN); + FlagClear(FLAG_VISITED_DEWFORD_TOWN); + FlagClear(FLAG_VISITED_LAVARIDGE_TOWN); + FlagClear(FLAG_VISITED_FALLARBOR_TOWN); + FlagClear(FLAG_VISITED_VERDANTURF_TOWN); + FlagClear(FLAG_VISITED_PACIFIDLOG_TOWN); + FlagClear(FLAG_VISITED_PETALBURG_CITY); + FlagClear(FLAG_VISITED_SLATEPORT_CITY); + FlagClear(FLAG_VISITED_MAUVILLE_CITY); + FlagClear(FLAG_VISITED_RUSTBORO_CITY); + FlagClear(FLAG_VISITED_FORTREE_CITY); + FlagClear(FLAG_VISITED_LILYCOVE_CITY); + FlagClear(FLAG_VISITED_MOSSDEEP_CITY); + FlagClear(FLAG_VISITED_SOOTOPOLIS_CITY); + FlagClear(FLAG_VISITED_EVER_GRANDE_CITY); + FlagClear(FLAG_LANDMARK_POKEMON_LEAGUE); + FlagClear(FLAG_LANDMARK_BATTLE_FRONTIER); + } + else + { + PlaySE(SE_PC_LOGIN); + + FlagSet(FLAG_VISITED_LITTLEROOT_TOWN); + FlagSet(FLAG_VISITED_OLDALE_TOWN); + FlagSet(FLAG_VISITED_DEWFORD_TOWN); + FlagSet(FLAG_VISITED_LAVARIDGE_TOWN); + FlagSet(FLAG_VISITED_FALLARBOR_TOWN); + FlagSet(FLAG_VISITED_VERDANTURF_TOWN); + FlagSet(FLAG_VISITED_PACIFIDLOG_TOWN); + FlagSet(FLAG_VISITED_PETALBURG_CITY); + FlagSet(FLAG_VISITED_SLATEPORT_CITY); + FlagSet(FLAG_VISITED_MAUVILLE_CITY); + FlagSet(FLAG_VISITED_RUSTBORO_CITY); + FlagSet(FLAG_VISITED_FORTREE_CITY); + FlagSet(FLAG_VISITED_LILYCOVE_CITY); + FlagSet(FLAG_VISITED_MOSSDEEP_CITY); + FlagSet(FLAG_VISITED_SOOTOPOLIS_CITY); + FlagSet(FLAG_VISITED_EVER_GRANDE_CITY); + FlagSet(FLAG_LANDMARK_POKEMON_LEAGUE); + FlagSet(FLAG_LANDMARK_BATTLE_FRONTIER); + } +} +static void DebugAction_FlagsVars_ToggleBadgeFlags(u8 taskId) +{ + // Sound effect + if (FlagGet(FLAG_BADGE08_GET)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + FlagToggle(FLAG_BADGE01_GET); + FlagToggle(FLAG_BADGE02_GET); + FlagToggle(FLAG_BADGE03_GET); + FlagToggle(FLAG_BADGE04_GET); + FlagToggle(FLAG_BADGE05_GET); + FlagToggle(FLAG_BADGE06_GET); + FlagToggle(FLAG_BADGE07_GET); + FlagToggle(FLAG_BADGE08_GET); +} +static void DebugAction_FlagsVars_ToggleFrontierPass(u8 taskId) +{ + // Sound effect + if (FlagGet(FLAG_SYS_FRONTIER_PASS)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + FlagToggle(FLAG_SYS_FRONTIER_PASS); +} +static void DebugAction_FlagsVars_CollisionOnOff(u8 taskId) +{ +#if OW_FLAG_NO_COLLISION == 0 + Debug_DestroyMenu_Full_Script(taskId, Debug_FlagsNotSetOverworldConfigMessage); +#else + if (FlagGet(OW_FLAG_NO_COLLISION)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + FlagToggle(OW_FLAG_NO_COLLISION); +#endif +} +static void DebugAction_FlagsVars_EncounterOnOff(u8 taskId) +{ +#if OW_FLAG_NO_ENCOUNTER == 0 + Debug_DestroyMenu_Full_Script(taskId, Debug_FlagsNotSetOverworldConfigMessage); +#else + if (FlagGet(OW_FLAG_NO_ENCOUNTER)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + FlagToggle(OW_FLAG_NO_ENCOUNTER); +#endif +} +static void DebugAction_FlagsVars_TrainerSeeOnOff(u8 taskId) +{ +#if OW_FLAG_NO_TRAINER_SEE == 0 + Debug_DestroyMenu_Full_Script(taskId, Debug_FlagsNotSetOverworldConfigMessage); +#else + if (FlagGet(OW_FLAG_NO_TRAINER_SEE)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + FlagToggle(OW_FLAG_NO_TRAINER_SEE); +#endif +} +static void DebugAction_FlagsVars_BagUseOnOff(u8 taskId) +{ +#if B_FLAG_NO_BAG_USE == 0 + Debug_DestroyMenu_Full_Script(taskId, Debug_FlagsNotSetBattleConfigMessage); +#else + if (FlagGet(B_FLAG_NO_BAG_USE)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + FlagToggle(B_FLAG_NO_BAG_USE); +#endif +} +static void DebugAction_FlagsVars_CatchingOnOff(u8 taskId) +{ +#if B_FLAG_NO_CATCHING == 0 + Debug_DestroyMenu_Full_Script(taskId, Debug_FlagsNotSetBattleConfigMessage); +#else + if (FlagGet(B_FLAG_NO_CATCHING)) + PlaySE(SE_PC_OFF); + else + PlaySE(SE_PC_LOGIN); + FlagToggle(B_FLAG_NO_CATCHING); +#endif +} // ******************************* // Actions Give @@ -1842,7 +2519,7 @@ static void DebugAction_Give_Item(u8 taskId) HideMapNamePopUpWindow(); LoadMessageBoxAndBorderGfx(); - windowId = AddWindow(&sDebugNumberDisplayWindowTemplate); + windowId = AddWindow(&sDebugMenuWindowTemplateExtra); DrawStdWindowFrame(windowId, FALSE); CopyWindowToVram(windowId, 3); @@ -2040,7 +2717,7 @@ static void DebugAction_Give_PokemonSimple(u8 taskId) HideMapNamePopUpWindow(); LoadMessageBoxAndBorderGfx(); - windowId = AddWindow(&sDebugNumberDisplayWindowTemplate); + windowId = AddWindow(&sDebugMenuWindowTemplateExtra); DrawStdWindowFrame(windowId, FALSE); CopyWindowToVram(windowId, 3); @@ -2048,7 +2725,7 @@ static void DebugAction_Give_PokemonSimple(u8 taskId) //Display initial ID StringCopy(gStringVar2, gText_DigitIndicator[0]); ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, 3); - StringCopy(gStringVar1, gSpeciesNames[1]); + StringCopy(gStringVar1, GetSpeciesName(1)); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); StringExpandPlaceholders(gStringVar4, sDebugText_PokemonID); AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); @@ -2078,7 +2755,7 @@ static void DebugAction_Give_PokemonComplex(u8 taskId) HideMapNamePopUpWindow(); LoadMessageBoxAndBorderGfx(); - windowId = AddWindow(&sDebugNumberDisplayWindowTemplate); + windowId = AddWindow(&sDebugMenuWindowTemplateExtra); DrawStdWindowFrame(windowId, FALSE); CopyWindowToVram(windowId, 3); @@ -2086,7 +2763,7 @@ static void DebugAction_Give_PokemonComplex(u8 taskId) //Display initial ID StringCopy(gStringVar2, gText_DigitIndicator[0]); ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, 4); - StringCopy(gStringVar1, gSpeciesNames[1]); + StringCopy(gStringVar1, GetSpeciesName(1)); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); StringExpandPlaceholders(gStringVar4, sDebugText_PokemonID); AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL); @@ -2133,7 +2810,7 @@ static void DebugAction_Give_Pokemon_SelectId(u8 taskId) } StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); - StringCopy(gStringVar1, gSpeciesNames[gTasks[taskId].data[3]]); //CopyItemName(gTasks[taskId].data[3], gStringVar1); + StringCopy(gStringVar1, GetSpeciesName(gTasks[taskId].data[3])); //CopyItemName(gTasks[taskId].data[3], gStringVar1); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 4); StringExpandPlaceholders(gStringVar4, sDebugText_PokemonID); @@ -2226,7 +2903,7 @@ static void DebugAction_Give_Pokemon_SelectLevel(u8 taskId) ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 0); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); - StringCopyPadded(gStringVar2, sDebugText_Flags_FlagUnset, CHAR_SPACE, 15); + StringCopyPadded(gStringVar2, sDebugText_False, CHAR_SPACE, 15); StringExpandPlaceholders(gStringVar4, sDebugText_PokemonShiny); AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL); @@ -2263,9 +2940,9 @@ static void DebugAction_Give_Pokemon_SelectShiny(u8 taskId) } if (gTasks[taskId].data[3] == 1) - StringCopyPadded(gStringVar2, sDebugText_Flags_FlagSet, CHAR_SPACE, 15); + StringCopyPadded(gStringVar2, sDebugText_True, CHAR_SPACE, 15); else - StringCopyPadded(gStringVar2, sDebugText_Flags_FlagUnset, CHAR_SPACE, 15); + StringCopyPadded(gStringVar2, sDebugText_False, CHAR_SPACE, 15); ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 0); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); StringExpandPlaceholders(gStringVar4, sDebugText_PokemonShiny); @@ -2793,26 +3470,58 @@ static void DebugAction_Give_MaxBattlePoints(u8 taskId) static void DebugAction_Give_DayCareEgg(u8 taskId) { - TriggerPendingDaycareEgg(); + s32 emptySlot = Daycare_FindEmptySpot(&gSaveBlock1Ptr->daycare); + if (emptySlot == 0) // no daycare mons + Debug_DestroyMenu_Full_Script(taskId, DebugScript_ZeroDaycareMons); + else if (emptySlot == 1) // 1 daycare mon + Debug_DestroyMenu_Full_Script(taskId, DebugScript_OneDaycareMons); + else if (GetDaycareCompatibilityScore(&gSaveBlock1Ptr->daycare) == PARENTS_INCOMPATIBLE) // not compatible parents + Debug_DestroyMenu_Full_Script(taskId, DebugScript_DaycareMonsNotCompatible); + else // 2 pokemon which can have a pokemon baby together + TriggerPendingDaycareEgg(); } -static void DebugAction_Give_FillPC(u8 taskId) //Credit: Sierraffinity +// ******************************* +// Actions Fill +static void DebugAction_Fill_PCBoxes_Fast(u8 taskId) //Credit: Sierraffinity { int boxId, boxPosition; u32 personality; struct BoxPokemon boxMon; u16 species = SPECIES_BULBASAUR; + u8 speciesName[POKEMON_NAME_LENGTH + 1]; personality = Random32(); - CreateBoxMon(&boxMon, - species, - 100, - 32, - personality, - 0, - OT_ID_PLAYER_ID, - 0); + CreateBoxMon(&boxMon, species, 100, USE_RANDOM_IVS, FALSE, personality, OT_ID_PLAYER_ID, 0); + + for (boxId = 0; boxId < TOTAL_BOXES_COUNT; boxId++) + { + for (boxPosition = 0; boxPosition < IN_BOX_COUNT; boxPosition++, species++) + { + if (!GetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], MON_DATA_SANITY_HAS_SPECIES)) + { + StringCopy(speciesName, GetSpeciesName(species)); + SetBoxMonData(&boxMon, MON_DATA_NICKNAME, &speciesName); + SetBoxMonData(&boxMon, MON_DATA_SPECIES, &species); + GiveBoxMonInitialMoveset_Fast(&boxMon); + gPokemonStoragePtr->boxes[boxId][boxPosition] = boxMon; + } + } + } + + // Set flag for user convenience + FlagSet(FLAG_SYS_POKEMON_GET); + Debug_DestroyMenu_Full(taskId); + ScriptContext_Enable(); +} +static void DebugAction_Fill_PCBoxes_Slow(u8 taskId) +{ + int boxId, boxPosition; + u32 personality; + struct BoxPokemon boxMon; + u32 species = SPECIES_BULBASAUR; + bool8 spaceAvailable = FALSE; for (boxId = 0; boxId < TOTAL_BOXES_COUNT; boxId++) { @@ -2820,36 +3529,86 @@ static void DebugAction_Give_FillPC(u8 taskId) //Credit: Sierraffinity { if (!GetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], MON_DATA_SANITY_HAS_SPECIES)) { + if (!spaceAvailable) + PlayBGM(MUS_RG_MYSTERY_GIFT); + CreateBoxMon(&boxMon, species, 100, USE_RANDOM_IVS, FALSE, 0, OT_ID_PLAYER_ID, 0); gPokemonStoragePtr->boxes[boxId][boxPosition] = boxMon; - SetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], MON_DATA_SPECIES, &species); - GetSetPokedexFlag(species, FLAG_SET_SEEN); - GetSetPokedexFlag(species, FLAG_SET_CAUGHT); - species++; + species = (species < NUM_SPECIES - 1) ? species + 1 : 1; + spaceAvailable = TRUE; } } } // Set flag for user convenience FlagSet(FLAG_SYS_POKEMON_GET); + if (spaceAvailable) + PlayBGM(GetCurrentMapMusic()); + + Debug_DestroyMenu_Full_Script(taskId, Debug_BoxFilledMessage); +} +static void DebugAction_Fill_PCItemStorage(u8 taskId) +{ + u16 itemId; + + for (itemId = 1; itemId < ITEMS_COUNT; itemId++) + { + if (!CheckPCHasItem(itemId, MAX_PC_ITEM_CAPACITY)) + AddPCItem(itemId, MAX_PC_ITEM_CAPACITY); + } } +static void DebugAction_Fill_PocketItems(u8 taskId) +{ + u16 itemId; -static void DebugAction_Give_CHEAT(u8 taskId) + for (itemId = 1; itemId < ITEMS_COUNT; itemId++) + { + if (ItemId_GetPocket(itemId) == POCKET_ITEMS && CheckBagHasSpace(itemId, MAX_BAG_ITEM_CAPACITY)) + AddBagItem(itemId, MAX_BAG_ITEM_CAPACITY); + } +} +static void DebugAction_Fill_PocketPokeBalls(u8 taskId) { - Debug_DestroyMenu_Full(taskId); - LockPlayerFieldControls(); - ScriptContext_SetupScript(Debug_CheatStart); + u16 itemId; + + for (itemId = FIRST_BALL; itemId < LAST_BALL; itemId++) + { + if (CheckBagHasSpace(itemId, MAX_BAG_ITEM_CAPACITY)) + AddBagItem(itemId, MAX_BAG_ITEM_CAPACITY); + } } +static void DebugAction_Fill_PocketTMHM(u8 taskId) +{ + u16 itemId; -static void DebugAction_AccessPC(u8 taskId) + for (itemId = ITEM_TM01; itemId <= ITEM_HM08; itemId++) + { + if (CheckBagHasSpace(itemId, 1) && ItemIdToBattleMoveId(itemId) != MOVE_NONE) + AddBagItem(itemId, 1); + } +} +static void DebugAction_Fill_PocketBerries(u8 taskId) { - Debug_DestroyMenu_Full(taskId); - LockPlayerFieldControls(); - ScriptContext_SetupScript(EventScript_PC); + u16 itemId; + + for (itemId = FIRST_BERRY_INDEX; itemId < LAST_BERRY_INDEX; itemId++) + { + if (CheckBagHasSpace(itemId, MAX_BERRY_CAPACITY)) + AddBagItem(itemId, MAX_BERRY_CAPACITY); + } } +static void DebugAction_Fill_PocketKeyItems(u8 taskId) +{ + u16 itemId; + for (itemId = 1; itemId < ITEMS_COUNT; itemId++) + { + if (ItemId_GetPocket(itemId) == POCKET_KEY_ITEMS && CheckBagHasSpace(itemId, 1)) + AddBagItem(itemId, 1); + } +} // ******************************* -// Sound Scripts +// Actions Sound static const u8 *const sBGMNames[]; static const u8 *const sSENames[]; static void DebugAction_Sound_SE(u8 taskId) @@ -2861,7 +3620,7 @@ static void DebugAction_Sound_SE(u8 taskId) HideMapNamePopUpWindow(); LoadMessageBoxAndBorderGfx(); - windowId = AddWindow(&sDebugNumberDisplayLargeWindowTemplate); + windowId = AddWindow(&sDebugMenuWindowTemplateSound); DrawStdWindowFrame(windowId, FALSE); CopyWindowToVram(windowId, 3); @@ -2938,7 +3697,7 @@ static void DebugAction_Sound_MUS(u8 taskId) HideMapNamePopUpWindow(); LoadMessageBoxAndBorderGfx(); - windowId = AddWindow(&sDebugNumberDisplayLargeWindowTemplate); + windowId = AddWindow(&sDebugMenuWindowTemplateSound); DrawStdWindowFrame(windowId, FALSE); CopyWindowToVram(windowId, 3); @@ -3563,4 +4322,12 @@ SOUND_LIST_SE }; #undef X +// ******************************* +// Actions Other + +static void DebugAction_AccessPC(u8 taskId) +{ + Debug_DestroyMenu_Full_Script(taskId, EventScript_PC); +} + #endif //DEBUG_OVERWORLD_MENU == TRUE diff --git a/src/decompress.c b/src/decompress.c index f5d4ff233d87..b4de99efc34e 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -63,17 +63,19 @@ void LoadCompressedSpritePaletteOverrideBuffer(const struct CompressedSpritePale void DecompressPicFromTable(const struct CompressedSpriteSheet *src, void *buffer, s32 species) { if (species > NUM_SPECIES) - LZ77UnCompWram(gMonFrontPicTable[0].data, buffer); + LZ77UnCompWram(gMonFrontPicTable[SPECIES_NONE].data, buffer); else LZ77UnCompWram(src->data, buffer); } void DecompressPicFromTableGender(void* buffer, s32 species, u32 personality) { - if (ShouldShowFemaleDifferences(species, personality)) - DecompressPicFromTable(&gMonFrontPicTableFemale[species], buffer, species); + if (gMonFrontPicTableFemale[species].data != NULL && IsPersonalityFemale(species, personality)) + LZ77UnCompWram(gMonFrontPicTableFemale[species].data, buffer); + else if (gMonFrontPicTable[species].data != NULL) + LZ77UnCompWram(gMonFrontPicTable[species].data, buffer); else - DecompressPicFromTable(&gMonFrontPicTable[species], buffer, species); + LZ77UnCompWram(gMonFrontPicTable[SPECIES_NONE].data, buffer); } void HandleLoadSpecialPokePic(bool32 isFrontPic, void *dest, s32 species, u32 personality) @@ -83,38 +85,35 @@ void HandleLoadSpecialPokePic(bool32 isFrontPic, void *dest, s32 species, u32 pe void LoadSpecialPokePic(void *dest, s32 species, u32 personality, bool8 isFrontPic) { - if (species == SPECIES_UNOWN) - { - u32 id = GetUnownSpeciesId(personality); + if (species > NUM_SPECIES) + species = SPECIES_NONE; + else if (species == SPECIES_UNOWN) + species = GetUnownSpeciesId(personality); - if (!isFrontPic) - LZ77UnCompWram(gMonBackPicTable[id].data, dest); - else - LZ77UnCompWram(gMonFrontPicTable[id].data, dest); - } - else if (species > NUM_SPECIES) // is species unknown? draw the ? icon + if (isFrontPic) { - if (isFrontPic) - LZ77UnCompWram(gMonFrontPicTable[0].data, dest); - else - LZ77UnCompWram(gMonBackPicTable[0].data, dest); - } - else if (ShouldShowFemaleDifferences(species, personality)) - { - if (isFrontPic) + if (gMonFrontPicTableFemale[species].data != NULL && IsPersonalityFemale(species, personality)) LZ77UnCompWram(gMonFrontPicTableFemale[species].data, dest); + else if (gMonFrontPicTable[species].data != NULL) + LZ77UnCompWram(gMonFrontPicTable[species].data, dest); else - LZ77UnCompWram(gMonBackPicTableFemale[species].data, dest); + LZ77UnCompWram(gMonFrontPicTable[SPECIES_NONE].data, dest); } else { - if (isFrontPic) - LZ77UnCompWram(gMonFrontPicTable[species].data, dest); - else + if (gMonBackPicTableFemale[species].data != NULL && IsPersonalityFemale(species, personality)) + LZ77UnCompWram(gMonBackPicTableFemale[species].data, dest); + else if (gMonBackPicTable[species].data != NULL) LZ77UnCompWram(gMonBackPicTable[species].data, dest); + else + LZ77UnCompWram(gMonBackPicTable[SPECIES_NONE].data, dest); } - DrawSpindaSpots(species, personality, dest, isFrontPic); + if (species == SPECIES_SPINDA && isFrontPic) + { + DrawSpindaSpots(personality, dest, FALSE); + DrawSpindaSpots(personality, dest, TRUE); + } } void Unused_LZDecompressWramIndirect(const void **src, void *dest) diff --git a/src/decoration.c b/src/decoration.c index b33580d2d3f0..688018b2db17 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -422,7 +422,16 @@ static const u8 sDecorationSlideElevation[] = }; static const u16 sDecorShapeSizes[] = { - 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x10, 0x20, 0x40, 0x20 + [DECORSHAPE_1x1] = 4, + [DECORSHAPE_2x1] = 8, + [DECORSHAPE_3x1] = 16, + [DECORSHAPE_4x2] = 32, + [DECORSHAPE_2x2] = 16, + [DECORSHAPE_1x2] = 8, + [DECORSHAPE_1x3] = 16, + [DECORSHAPE_2x4] = 32, + [DECORSHAPE_3x3] = 64, + [DECORSHAPE_3x2] = 32, }; static const u16 sBrendanPalette[] = INCBIN_U16("graphics/decorations/brendan.gbapal"); diff --git a/src/dewford_trend.c b/src/dewford_trend.c index 08dd9afe0ba0..45c18f6013db 100644 --- a/src/dewford_trend.c +++ b/src/dewford_trend.c @@ -224,7 +224,7 @@ static void SortTrends(struct DewfordTrend *trends, u16 numTrends, u8 mode) } #define SAVED_TRENDS_SIZE (sizeof(struct DewfordTrend) * SAVED_TRENDS_COUNT) -#define BUFFER_SIZE (SAVED_TRENDS_SIZE * MAX_LINK_PLAYERS > 0x100 ? SAVED_TRENDS_SIZE * MAX_LINK_PLAYERS : 0x100) // More space was allocated than needed +#define BUFFER_SIZE max(SAVED_TRENDS_SIZE * MAX_LINK_PLAYERS, 0x100) // More space was allocated than needed void ReceiveDewfordTrendData(struct DewfordTrend *linkedTrends, size_t size, u8 unused) { diff --git a/src/easy_chat.c b/src/easy_chat.c index 476702c209f3..5ba83f72572d 100644 --- a/src/easy_chat.c +++ b/src/easy_chat.c @@ -5204,7 +5204,7 @@ static const u8 *GetEasyChatWord(u8 groupId, u16 index) { case EC_GROUP_POKEMON: case EC_GROUP_POKEMON_NATIONAL: - return gSpeciesNames[index]; + return GetSpeciesName(index); case EC_GROUP_MOVE_1: case EC_GROUP_MOVE_2: return gMoveNames[index]; diff --git a/src/egg_hatch.c b/src/egg_hatch.c index fe50c80f41bb..7ceaa161ed71 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -369,7 +369,7 @@ static void AddHatchedMonToParty(u8 id) SetMonData(mon, MON_DATA_IS_EGG, &isEgg); species = GetMonData(mon, MON_DATA_SPECIES); - GetSpeciesName(name, species); + StringCopy(name, GetSpeciesName(species)); SetMonData(mon, MON_DATA_NICKNAME, name); species = SpeciesToNationalPokedexNum(species); @@ -396,7 +396,7 @@ void ScriptHatchMon(void) static bool8 _CheckDaycareMonReceivedMail(struct DayCare *daycare, u8 daycareId) { - u8 nickname[32]; + u8 nickname[max(32, POKEMON_NAME_BUFFER_SIZE)]; struct DaycareMon *daycareMon = &daycare->mons[daycareId]; GetBoxMonNickname(&daycareMon->mon, nickname); diff --git a/src/ereader_helpers.c b/src/ereader_helpers.c index aaaaf00eebad..2dafb3b2459d 100755 --- a/src/ereader_helpers.c +++ b/src/ereader_helpers.c @@ -753,11 +753,11 @@ void EReaderHelper_SerialCallback(void) switch (sSendRecvMgr.state) { case EREADER_XFR_STATE_HANDSHAKE: - REG_SIOMLT_SEND = 0xCCD0; // Handshake id + REG_SIOMLT_SEND = EREADER_HANDSHAKE; *(u64 *)recv = REG_SIOMLT_RECV; for (i = 0, cnt1 = 0, cnt2 = 0; i < 4; i++) { - if (recv[i] == 0xCCD0) + if (recv[i] == EREADER_HANDSHAKE) cnt1++; else if (recv[i] != 0xFFFF) cnt2++; diff --git a/src/event_data.c b/src/event_data.c index 50f6f68da430..5fbe1bd3aa57 100644 --- a/src/event_data.c +++ b/src/event_data.c @@ -2,11 +2,6 @@ #include "event_data.h" #include "pokedex.h" -#define NUM_SPECIAL_FLAGS (SPECIAL_FLAGS_END - SPECIAL_FLAGS_START + 1) -#define NUM_TEMP_FLAGS (TEMP_FLAGS_END - TEMP_FLAGS_START + 1) -#define NUM_DAILY_FLAGS (DAILY_FLAGS_END - DAILY_FLAGS_START + 1) -#define NUM_TEMP_VARS (TEMP_VARS_END - TEMP_VARS_START + 1) - #define SPECIAL_FLAGS_SIZE (NUM_SPECIAL_FLAGS / 8) // 8 flags per byte #define TEMP_FLAGS_SIZE (NUM_TEMP_FLAGS / 8) #define DAILY_FLAGS_SIZE (NUM_DAILY_FLAGS / 8) @@ -43,8 +38,8 @@ void InitEventData(void) void ClearTempFieldEventData(void) { - memset(gSaveBlock1Ptr->flags + (TEMP_FLAGS_START / 8), 0, TEMP_FLAGS_SIZE); - memset(gSaveBlock1Ptr->vars + ((TEMP_VARS_START - VARS_START) * 2), 0, TEMP_VARS_SIZE); + memset(&gSaveBlock1Ptr->flags[TEMP_FLAGS_START / 8], 0, TEMP_FLAGS_SIZE); + memset(&gSaveBlock1Ptr->vars[TEMP_VARS_START - VARS_START], 0, TEMP_VARS_SIZE); FlagClear(FLAG_SYS_ENC_UP_ITEM); FlagClear(FLAG_SYS_ENC_DOWN_ITEM); FlagClear(FLAG_SYS_USE_STRENGTH); @@ -54,7 +49,7 @@ void ClearTempFieldEventData(void) void ClearDailyFlags(void) { - memset(gSaveBlock1Ptr->flags + (DAILY_FLAGS_START / 8), 0, DAILY_FLAGS_SIZE); + memset(&gSaveBlock1Ptr->flags[DAILY_FLAGS_START / 8], 0, DAILY_FLAGS_SIZE); } void DisableNationalPokedex(void) diff --git a/src/evolution_scene.c b/src/evolution_scene.c index ec331bf014d9..4d33983a9e16 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -209,7 +209,7 @@ void BeginEvolutionScene(struct Pokemon *mon, u16 postEvoSpecies, bool8 canStopE void EvolutionScene(struct Pokemon *mon, u16 postEvoSpecies, bool8 canStopEvo, u8 partyId) { - u8 name[20]; + u8 name[POKEMON_NAME_BUFFER_SIZE]; u16 currSpecies; u32 trainerId, personality; const struct CompressedSpritePalette* pokePal; @@ -254,7 +254,7 @@ void EvolutionScene(struct Pokemon *mon, u16 postEvoSpecies, bool8 canStopEvo, u GetMonData(mon, MON_DATA_NICKNAME, name); StringCopy_Nickname(gStringVar1, name); - StringCopy(gStringVar2, gSpeciesNames[postEvoSpecies]); + StringCopy(gStringVar2, GetSpeciesName(postEvoSpecies)); // preEvo sprite currSpecies = GetMonData(mon, MON_DATA_SPECIES); @@ -468,7 +468,7 @@ static void CB2_TradeEvolutionSceneLoadGraphics(void) void TradeEvolutionScene(struct Pokemon *mon, u16 postEvoSpecies, u8 preEvoSpriteId, u8 partyId) { - u8 name[20]; + u8 name[POKEMON_NAME_BUFFER_SIZE]; u16 currSpecies; u32 trainerId, personality; const struct CompressedSpritePalette* pokePal; @@ -476,7 +476,7 @@ void TradeEvolutionScene(struct Pokemon *mon, u16 postEvoSpecies, u8 preEvoSprit GetMonData(mon, MON_DATA_NICKNAME, name); StringCopy_Nickname(gStringVar1, name); - StringCopy(gStringVar2, gSpeciesNames[postEvoSpecies]); + StringCopy(gStringVar2, GetSpeciesName(postEvoSpecies)); gAffineAnimsDisabled = TRUE; @@ -561,7 +561,7 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon *mon) CopyMon(&gPlayerParty[gPlayerPartyCount], mon, sizeof(struct Pokemon)); SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_SPECIES, &gEvolutionTable[preEvoSpecies][1].targetSpecies); - SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_NICKNAME, gSpeciesNames[gEvolutionTable[preEvoSpecies][1].targetSpecies]); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_NICKNAME, GetSpeciesName(gEvolutionTable[preEvoSpecies][1].targetSpecies)); SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_HELD_ITEM, &data); SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_MARKINGS, &data); SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_ENCRYPT_SEPARATOR, &data); @@ -786,8 +786,7 @@ static void Task_EvolutionScene(u8 taskId) var = MonTryLearningNewMoveEvolution(mon, gTasks[taskId].tLearnsFirstMove); if (var != MOVE_NONE && !gTasks[taskId].tEvoWasStopped) { - u8 text[20]; - + u8 nickname[POKEMON_NAME_BUFFER_SIZE]; if (!(gTasks[taskId].tBits & TASK_BIT_LEARN_MOVE)) { StopMapMusic(); @@ -797,8 +796,8 @@ static void Task_EvolutionScene(u8 taskId) gTasks[taskId].tBits |= TASK_BIT_LEARN_MOVE; gTasks[taskId].tLearnsFirstMove = FALSE; gTasks[taskId].tLearnMoveState = MVSTATE_INTRO_MSG_1; - GetMonData(mon, MON_DATA_NICKNAME, text); - StringCopy_Nickname(gBattleTextBuff1, text); + GetMonData(mon, MON_DATA_NICKNAME, nickname); + StringCopy_Nickname(gBattleTextBuff1, nickname); if (var == MON_HAS_MAX_MOVES) gTasks[taskId].tState = EVOSTATE_REPLACE_MOVE; @@ -986,7 +985,7 @@ static void Task_EvolutionScene(u8 taskId) { // Selected move to forget u16 move = GetMonData(mon, var + MON_DATA_MOVE1); - if (IsHMMove2(move)) + if (IsMoveHM(move)) { // Can't forget HMs BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_HMMOVESCANTBEFORGOTTEN - BATTLESTRINGS_TABLE_START]); @@ -1206,13 +1205,12 @@ static void Task_TradeEvolutionScene(u8 taskId) var = MonTryLearningNewMoveEvolution(mon, gTasks[taskId].tLearnsFirstMove); if (var != MOVE_NONE && !gTasks[taskId].tEvoWasStopped) { - u8 text[20]; - + u8 nickname[POKEMON_NAME_BUFFER_SIZE]; gTasks[taskId].tBits |= TASK_BIT_LEARN_MOVE; gTasks[taskId].tLearnsFirstMove = FALSE; gTasks[taskId].tLearnMoveState = 0; - GetMonData(mon, MON_DATA_NICKNAME, text); - StringCopy_Nickname(gBattleTextBuff1, text); + GetMonData(mon, MON_DATA_NICKNAME, nickname); + StringCopy_Nickname(gBattleTextBuff1, nickname); if (var == MON_HAS_MAX_MOVES) gTasks[taskId].tState = T_EVOSTATE_REPLACE_MOVE; @@ -1369,7 +1367,7 @@ static void Task_TradeEvolutionScene(u8 taskId) { // Selected move to forget u16 move = GetMonData(mon, var + MON_DATA_MOVE1); - if (IsHMMove2(move)) + if (IsMoveHM(move)) { // Can't forget HMs BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_HMMOVESCANTBEFORGOTTEN - BATTLESTRINGS_TABLE_START]); diff --git a/src/field_effect.c b/src/field_effect.c index b8e3cecc6672..5b00f5340cd6 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -236,7 +236,7 @@ static void Task_MoveDeoxysRock(u8 taskId); static u8 sActiveList[32]; // External declarations -extern struct CompressedSpritePalette gMonPaletteTable[]; // GF made a mistake and did not extern it as const. +extern const struct CompressedSpritePalette gMonPaletteTable[]; extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; extern const struct CompressedSpriteSheet gTrainerFrontPicTable[]; extern u8 *gFieldEffectScriptPointers[]; @@ -2416,7 +2416,7 @@ static void TeleportWarpOutFieldEffect_SpinExit(struct Task *task) { sprite->subspriteMode = SUBSPRITES_IGNORE_PRIORITY; } - if (task->data[4] >= 0xa8) + if (task->data[4] >= DISPLAY_HEIGHT + 8) { task->tState++; TryFadeOutOldMapMusic(); diff --git a/src/field_specials.c b/src/field_specials.c index 6fdec2a5f09d..c91f458ed1e1 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -57,7 +57,6 @@ #include "constants/heal_locations.h" #include "constants/map_types.h" #include "constants/mystery_gift.h" -#include "constants/script_menu.h" #include "constants/slot_machine.h" #include "constants/songs.h" #include "constants/moves.h" @@ -3197,6 +3196,7 @@ void ScrollableMultichoice_ClosePersistentMenu(void) #undef tTaskId #define DEOXYS_ROCK_LEVELS 11 +#define ROCK_PAL_ID 10 void DoDeoxysRockInteraction(void) { @@ -3276,7 +3276,7 @@ static void Task_DeoxysRockInteraction(u8 taskId) static void ChangeDeoxysRockLevel(u8 rockLevel) { u8 objectEventId; - LoadPalette(&sDeoxysRockPalettes[rockLevel], OBJ_PLTT_ID(10), PLTT_SIZEOF(4)); + LoadPalette(&sDeoxysRockPalettes[rockLevel], OBJ_PLTT_ID(ROCK_PAL_ID), PLTT_SIZEOF(4)); TryGetObjectEventIdByLocalIdAndMap(LOCALID_BIRTH_ISLAND_EXTERIOR_ROCK, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objectEventId); if (rockLevel == 0) @@ -3313,21 +3313,20 @@ static void WaitForDeoxysRockMovement(u8 taskId) void IncrementBirthIslandRockStepCount(void) { - u16 var = VarGet(VAR_DEOXYS_ROCK_STEP_COUNT); + u16 stepCount = VarGet(VAR_DEOXYS_ROCK_STEP_COUNT); if (gSaveBlock1Ptr->location.mapNum == MAP_NUM(BIRTH_ISLAND_EXTERIOR) && gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(BIRTH_ISLAND_EXTERIOR)) { - var++; - if (var > 99) + if (++stepCount > 99) VarSet(VAR_DEOXYS_ROCK_STEP_COUNT, 0); else - VarSet(VAR_DEOXYS_ROCK_STEP_COUNT, var); + VarSet(VAR_DEOXYS_ROCK_STEP_COUNT, stepCount); } } void SetDeoxysRockPalette(void) { - LoadPalette(&sDeoxysRockPalettes[(u8)VarGet(VAR_DEOXYS_ROCK_LEVEL)], OBJ_PLTT_ID(10), PLTT_SIZEOF(4)); - BlendPalettes(0x04000000, 16, 0); + LoadPalette(&sDeoxysRockPalettes[(u8)VarGet(VAR_DEOXYS_ROCK_LEVEL)], OBJ_PLTT_ID(ROCK_PAL_ID), PLTT_SIZEOF(4)); + BlendPalettes(1 << (ROCK_PAL_ID + 16), 16, 0); } void SetPCBoxToSendMon(u8 boxId) @@ -3894,16 +3893,15 @@ bool8 InPokemonCenter(void) #define FANCLUB_BITFIELD (gSaveBlock1Ptr->vars[VAR_FANCLUB_FAN_COUNTER - VARS_START]) #define FANCLUB_COUNTER 0x007F -#define FANCLUB_FAN_FLAGS 0xFF80 #define GET_TRAINER_FAN_CLUB_FLAG(flag) (FANCLUB_BITFIELD >> (flag) & 1) #define SET_TRAINER_FAN_CLUB_FLAG(flag) (FANCLUB_BITFIELD |= 1 << (flag)) #define FLIP_TRAINER_FAN_CLUB_FLAG(flag)(FANCLUB_BITFIELD ^= 1 << (flag)) #define GET_TRAINER_FAN_CLUB_COUNTER (FANCLUB_BITFIELD & FANCLUB_COUNTER) -#define SET_TRAINER_FAN_CLUB_COUNTER(count) (FANCLUB_BITFIELD = (FANCLUB_BITFIELD & FANCLUB_FAN_FLAGS) | (count)) +#define SET_TRAINER_FAN_CLUB_COUNTER(count) (FANCLUB_BITFIELD = (FANCLUB_BITFIELD & ~FANCLUB_COUNTER) | (count)) #define INCR_TRAINER_FAN_CLUB_COUNTER(count)(FANCLUB_BITFIELD += (count)) -#define CLEAR_TRAINER_FAN_CLUB_COUNTER (FANCLUB_BITFIELD &= ~(FANCLUB_COUNTER)) +#define CLEAR_TRAINER_FAN_CLUB_COUNTER (FANCLUB_BITFIELD &= ~FANCLUB_COUNTER) void ResetFanClub(void) { diff --git a/src/field_tasks.c b/src/field_tasks.c index dec5cba8002b..8683301f2651 100644 --- a/src/field_tasks.c +++ b/src/field_tasks.c @@ -100,6 +100,9 @@ static const struct PacifidlogMetatileOffsets sFloatingBridgeMetatileOffsets[] = }; // Each element corresponds to a y coordinate row in the sootopolis gym 1F map. +// The rows with ice each have a temp var used to track the ice steps. Each bit in the var +// represents whether ice at that x coordinate (starting from the left edge) has been visited. +// This method of tracking steps will break if the ice puzzle is more than 16 map spaces wide. static const u16 sSootopolisGymIceRowVars[] = { 0, diff --git a/src/field_weather.c b/src/field_weather.c index bcc6a1c44004..045c234acde4 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -16,6 +16,7 @@ #include "task.h" #include "trig.h" #include "gpu_regs.h" +#include "field_camera.h" #define DROUGHT_COLOR_INDEX(color) ((((color) >> 1) & 0xF) | (((color) >> 2) & 0xF0) | (((color) >> 3) & 0xF00)) @@ -219,6 +220,7 @@ static void Task_WeatherInit(u8 taskId) // When the screen fades in, this is set to TRUE. if (gWeatherPtr->readyForInit) { + UpdateCameraPanning(); sWeatherFuncs[gWeatherPtr->currWeather].initAll(); gTasks[taskId].func = Task_WeatherMain; } @@ -380,7 +382,6 @@ static void FadeInScreenWithWeather(void) case WEATHER_RAIN: case WEATHER_RAIN_THUNDERSTORM: case WEATHER_DOWNPOUR: - case WEATHER_SNOW: case WEATHER_SHADE: if (FadeInScreen_RainShowShade() == FALSE) { @@ -402,6 +403,7 @@ static void FadeInScreenWithWeather(void) gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_IDLE; } break; + case WEATHER_SNOW: case WEATHER_VOLCANIC_ASH: case WEATHER_SANDSTORM: case WEATHER_FOG_DIAGONAL: @@ -772,7 +774,6 @@ void FadeScreen(u8 mode, s8 delay) case WEATHER_RAIN: case WEATHER_RAIN_THUNDERSTORM: case WEATHER_DOWNPOUR: - case WEATHER_SNOW: case WEATHER_FOG_HORIZONTAL: case WEATHER_SHADE: case WEATHER_DROUGHT: diff --git a/src/field_weather_effect.c b/src/field_weather_effect.c index 05eae421e0e0..3340334039c8 100644 --- a/src/field_weather_effect.c +++ b/src/field_weather_effect.c @@ -768,7 +768,7 @@ void Snow_InitVars(void) { gWeatherPtr->initStep = 0; gWeatherPtr->weatherGfxLoaded = FALSE; - gWeatherPtr->targetColorMapIndex = 3; + gWeatherPtr->targetColorMapIndex = 0; gWeatherPtr->colorMapStepDelay = 20; gWeatherPtr->targetSnowflakeSpriteCount = 16; gWeatherPtr->snowflakeVisibleCounter = 0; @@ -940,8 +940,7 @@ static void InitSnowflakeSpriteMovement(struct Sprite *sprite) static void WaitSnowflakeSprite(struct Sprite *sprite) { - // Timer is never incremented - if (gWeatherPtr->snowflakeTimer > 18) + if (++gWeatherPtr->snowflakeTimer > 18) { sprite->invisible = FALSE; sprite->callback = UpdateSnowflakeSprite; @@ -970,32 +969,6 @@ static void UpdateSnowflakeSprite(struct Sprite *sprite) sprite->x = 242 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX); else if (x > 242) sprite->x = -3 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX); - - y = (sprite->y + sprite->centerToCornerVecY + gSpriteCoordOffsetY) & 0xFF; - if (y > 163 && y < 171) - { - sprite->y = 250 - (gSpriteCoordOffsetY + sprite->centerToCornerVecY); - sprite->tPosY = sprite->y * 128; - sprite->tFallCounter = 0; - sprite->tFallDuration = 220; - } - else if (y > 242 && y < 250) - { - sprite->y = 163; - sprite->tPosY = sprite->y * 128; - sprite->tFallCounter = 0; - sprite->tFallDuration = 220; - sprite->invisible = TRUE; - sprite->callback = WaitSnowflakeSprite; - } - - if (++sprite->tFallCounter == sprite->tFallDuration) - { - InitSnowflakeSpriteMovement(sprite); - sprite->y = 250; - sprite->invisible = TRUE; - sprite->callback = WaitSnowflakeSprite; - } } #undef tPosY diff --git a/src/fieldmap.c b/src/fieldmap.c index 9534255c7879..0ece73c5c3f5 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -621,8 +621,8 @@ bool32 CanCameraMoveInDirection(int direction) static void SetPositionFromConnection(const struct MapConnection *connection, int direction, int x, int y) { - struct MapHeader const *mapHeader; - mapHeader = GetMapHeaderFromConnection(connection); + struct MapHeader const *mapHeader = GetMapHeaderFromConnection(connection); + switch (direction) { case CONNECTION_EAST: @@ -641,6 +641,9 @@ static void SetPositionFromConnection(const struct MapConnection *connection, in gSaveBlock1Ptr->pos.x -= connection->offset; gSaveBlock1Ptr->pos.y = mapHeader->mapLayout->height; break; + default: + DebugPrintfLevel(MGBA_LOG_WARN, "SetPositionFromConnection was passed an invalid direction (%d)!", direction); + break; } } @@ -663,14 +666,22 @@ bool8 CameraMove(int x, int y) old_x = gSaveBlock1Ptr->pos.x; old_y = gSaveBlock1Ptr->pos.y; connection = GetIncomingConnection(direction, gSaveBlock1Ptr->pos.x, gSaveBlock1Ptr->pos.y); - SetPositionFromConnection(connection, direction, x, y); - LoadMapFromCameraTransition(connection->mapGroup, connection->mapNum); - gCamera.active = TRUE; - gCamera.x = old_x - gSaveBlock1Ptr->pos.x; - gCamera.y = old_y - gSaveBlock1Ptr->pos.y; - gSaveBlock1Ptr->pos.x += x; - gSaveBlock1Ptr->pos.y += y; - MoveMapViewToBackup(direction); + if (connection) + { + SetPositionFromConnection(connection, direction, x, y); + LoadMapFromCameraTransition(connection->mapGroup, connection->mapNum); + gCamera.active = TRUE; + gCamera.x = old_x - gSaveBlock1Ptr->pos.x; + gCamera.y = old_y - gSaveBlock1Ptr->pos.y; + gSaveBlock1Ptr->pos.x += x; + gSaveBlock1Ptr->pos.y += y; + MoveMapViewToBackup(direction); + } + else + { + DebugPrintfLevel(MGBA_LOG_WARN, "GetIncomingConnection returned an invalid connection inside CameraMove!"); + } + } return gCamera.active; } diff --git a/src/frontier_util.c b/src/frontier_util.c index 85e016a26b30..d138daba4c80 100644 --- a/src/frontier_util.c +++ b/src/frontier_util.c @@ -644,8 +644,8 @@ static const u8 *const sRecordsWindowChallengeTexts[][2] = static const u8 *const sLevelModeText[] = { - gText_RecordsLv50, - gText_RecordsOpenLevel, + [FRONTIER_LVL_50] = gText_RecordsLv50, + [FRONTIER_LVL_OPEN] = gText_RecordsOpenLevel, }; static const u8 *const sHallFacilityToRecordsText[] = @@ -735,28 +735,28 @@ void CallFrontierUtilFunc(void) sFrontierUtilFuncs[gSpecialVar_0x8004](); } -// Buffers into VAR_TEMP_0 specifically because this is used to react to the status in OnFrame map scripts +// VAR_TEMP_CHALLENGE_STATUS is used to react to the status in OnFrame map scripts static void GetChallengeStatus(void) { - VarSet(VAR_TEMP_0, 0xFF); + VarSet(VAR_TEMP_CHALLENGE_STATUS, 0xFF); switch (gSaveBlock2Ptr->frontier.challengeStatus) { case 0: break; case CHALLENGE_STATUS_SAVING: FrontierGamblerSetWonOrLost(FALSE); - VarSet(VAR_TEMP_0, gSaveBlock2Ptr->frontier.challengeStatus); + VarSet(VAR_TEMP_CHALLENGE_STATUS, gSaveBlock2Ptr->frontier.challengeStatus); break; case CHALLENGE_STATUS_LOST: FrontierGamblerSetWonOrLost(FALSE); - VarSet(VAR_TEMP_0, gSaveBlock2Ptr->frontier.challengeStatus); + VarSet(VAR_TEMP_CHALLENGE_STATUS, gSaveBlock2Ptr->frontier.challengeStatus); break; case CHALLENGE_STATUS_WON: FrontierGamblerSetWonOrLost(TRUE); - VarSet(VAR_TEMP_0, gSaveBlock2Ptr->frontier.challengeStatus); + VarSet(VAR_TEMP_CHALLENGE_STATUS, gSaveBlock2Ptr->frontier.challengeStatus); break; case CHALLENGE_STATUS_PAUSED: - VarSet(VAR_TEMP_0, gSaveBlock2Ptr->frontier.challengeStatus); + VarSet(VAR_TEMP_CHALLENGE_STATUS, gSaveBlock2Ptr->frontier.challengeStatus); break; } } @@ -1911,7 +1911,7 @@ static u8 AppendCaughtBannedMonSpeciesName(u16 species, u8 count, s32 numBannedM StringAppend(gStringVar1, gText_LineBreak); break; } - StringAppend(gStringVar1, gSpeciesNames[species]); + StringAppend(gStringVar1, GetSpeciesName(species)); } return count; diff --git a/src/graphics.c b/src/graphics.c index d122b15a7552..40c5d131b4d8 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -265,10 +265,6 @@ const u32 gBattleAnimSpritePal_SteelBeam[] = INCBIN_U32("graphics/battle_anims/s const u32 gBattleAnimSpriteGfx_StraightBeam[] = INCBIN_U32("graphics/battle_anims/sprites/straight_beam.4bpp.lz"); const u32 gBattleAnimSpritePal_StraightBeam[] = INCBIN_U32("graphics/battle_anims/sprites/straight_beam.gbapal.lz"); -const u32 gBattleAnimSpriteGfx_SubstituteBack[] = INCBIN_U32("graphics/battle_anims/sprites/substitute_back_new.4bpp.lz"); -const u32 gBattleAnimSpriteGfx_NewSubstituteFront[] = INCBIN_U32("graphics/battle_anims/sprites/substitute_new.4bpp.lz"); -const u32 gBattleAnimSpritePal_NewSubstituteFront[] = INCBIN_U32("graphics/battle_anims/sprites/substitute_new.gbapal.lz"); - const u32 gBattleAnimSpritePal_NewSurf[] = INCBIN_U32("graphics/battle_anims/sprites/surf_new.gbapal.lz"); const u32 gBattleAnimSpriteGfx_NewSword[] = INCBIN_U32("graphics/battle_anims/sprites/sword_new.4bpp.lz"); @@ -449,6 +445,9 @@ const u32 gBattleAnimSpriteGfx_SpinningBall[] = INCBIN_U32("graphics/battle_anim const u32 gBattleAnimSpritePal_SpinningBall[] = INCBIN_U32("graphics/battle_anims/unused/spinning_ball.gbapal.lz"); const u32 gBattleAnimSpritePal_SpinningBall2[] = INCBIN_U32("graphics/battle_anims/unused/spinning_ball_2.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_WoodHammerHammer[] = INCBIN_U32("graphics/battle_anims/sprites/wood_hammer_hammer.4bpp.lz"); +const u32 gBattleAnimSpritePal_WoodHammerHammer[] = INCBIN_U32("graphics/battle_anims/sprites/wood_hammer_hammer.gbapal.lz"); + // old battle interface data, unused const u32 gOldBattleInterfaceGfx[] = INCBIN_U32("graphics/unused/obi1.4bpp.lz"); @@ -1171,9 +1170,9 @@ const u32 gBattleAnimSpritePal_HandsAndFeet[] = INCBIN_U32("graphics/battle_anim const u32 gBattleAnimSpriteGfx_Confetti[] = INCBIN_U32("graphics/battle_anims/sprites/confetti.4bpp.lz"); const u32 gBattleAnimSpritePal_Confetti[] = INCBIN_U32("graphics/battle_anims/sprites/confetti.gbapal.lz"); -const u32 gSubstituteDollPal[] = INCBIN_U32("graphics/battle_anims/sprites/substitute.gbapal.lz"); -const u32 gSubstituteDollFrontGfx[] = INCBIN_U32("graphics/battle_anims/sprites/substitute.4bpp.lz"); -const u32 gSubstituteDollBackGfx[] = INCBIN_U32("graphics/battle_anims/sprites/substitute_back.4bpp.lz"); +const u32 gBattleAnimSpriteGfx_Substitute[] = INCBIN_U32("graphics/battle_anims/sprites/substitute.4bpp.lz"); +const u32 gBattleAnimSpriteGfx_SubstituteBack[] = INCBIN_U32("graphics/battle_anims/sprites/substitute_back.4bpp.lz"); +const u32 gBattleAnimSpritePal_Substitute[] = INCBIN_U32("graphics/battle_anims/sprites/substitute.gbapal.lz"); const u32 gBattleAnimSpriteGfx_GreenStar[] = INCBIN_U32("graphics/battle_anims/sprites/green_star.4bpp.lz"); const u32 gBattleAnimSpritePal_GreenStar[] = INCBIN_U32("graphics/battle_anims/sprites/green_star.gbapal.lz"); @@ -1187,18 +1186,17 @@ const u32 gBattleAnimSpritePal_PinkCloud[] = INCBIN_U32("graphics/battle_anims/s const u32 gBattleAnimSpriteGfx_SweatDrop[] = INCBIN_U32("graphics/battle_anims/sprites/sweat_drop.4bpp.lz"); const u32 gBattleAnimSpritePal_SweatDrop[] = INCBIN_U32("graphics/battle_anims/sprites/sweat_drop.gbapal.lz"); -const u32 gBattleStatMask_Gfx[] = INCBIN_U32("graphics/battle_anims/masks/stat.4bpp.lz"); -const u32 gBattleStatMask1_Tilemap[] = INCBIN_U32("graphics/battle_anims/masks/stat_tilemap_1.bin.lz"); -const u32 gBattleStatMask2_Tilemap[] = INCBIN_U32("graphics/battle_anims/masks/stat_tilemap_2.bin.lz"); - -const u32 gBattleStatMask1_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat1.gbapal.lz"); -const u32 gBattleStatMask2_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat2.gbapal.lz"); -const u32 gBattleStatMask3_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat3.gbapal.lz"); -const u32 gBattleStatMask4_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat4.gbapal.lz"); -const u32 gBattleStatMask5_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat5.gbapal.lz"); -const u32 gBattleStatMask6_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat6.gbapal.lz"); -const u32 gBattleStatMask7_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat7.gbapal.lz"); -const u32 gBattleStatMask8_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat8.gbapal.lz"); +const u32 gStatAnim_Gfx[] = INCBIN_U32("graphics/battle_anims/stat_change/tiles.4bpp.lz"); +const u32 gStatAnim_Increase_Tilemap[] = INCBIN_U32("graphics/battle_anims/stat_change/increase.bin.lz"); +const u32 gStatAnim_Decrease_Tilemap[] = INCBIN_U32("graphics/battle_anims/stat_change/decrease.bin.lz"); +const u32 gStatAnim_Defense_Pal[] = INCBIN_U32("graphics/battle_anims/stat_change/defense.gbapal.lz"); +const u32 gStatAnim_Attack_Pal[] = INCBIN_U32("graphics/battle_anims/stat_change/attack.gbapal.lz"); +const u32 gStatAnim_Accuracy_Pal[] = INCBIN_U32("graphics/battle_anims/stat_change/accuracy.gbapal.lz"); +const u32 gStatAnim_Speed_Pal[] = INCBIN_U32("graphics/battle_anims/stat_change/speed.gbapal.lz"); +const u32 gStatAnim_Multiple_Pal[] = INCBIN_U32("graphics/battle_anims/stat_change/multiple.gbapal.lz"); +const u32 gStatAnim_Evasion_Pal[] = INCBIN_U32("graphics/battle_anims/stat_change/evasion.gbapal.lz"); +const u32 gStatAnim_SpAttack_Pal[] = INCBIN_U32("graphics/battle_anims/stat_change/sp_attack.gbapal.lz"); +const u32 gStatAnim_SpDefense_Pal[] = INCBIN_U32("graphics/battle_anims/stat_change/sp_defense.gbapal.lz"); const u32 gCureBubblesGfx[] = INCBIN_U32("graphics/battle_anims/masks/cure_bubbles.4bpp.lz"); const u32 gCureBubblesPal[] = INCBIN_U32("graphics/battle_anims/masks/cure_bubbles.gbapal.lz"); @@ -1274,7 +1272,7 @@ const u32 gDomeTourneyInfoCard_Gfx[] = INCBIN_U32("graphics/battle_frontier/tour const u32 gDomeTourneyInfoCard_Tilemap[] = INCBIN_U32("graphics/battle_frontier/tourney_info_card_tilemap.bin.lz"); const u32 gDomeTourneyInfoCardBg_Tilemap[] = INCBIN_U32("graphics/battle_frontier/tourney_info_card_bg.bin.lz"); const u32 gDomeTourneyTreeButtons_Gfx[] = INCBIN_U32("graphics/battle_frontier/tourney_buttons.4bpp.lz"); // exit/cancel and pokeball buttons -const u32 gDomeTourneyTree_Pal[] = INCBIN_U32("graphics/battle_frontier/tourney.gbapal.lz"); +const u32 gDomeTourneyTree_Pal[] = INCBIN_U32("graphics/battle_frontier/tourney_tree.gbapal.lz"); const u32 gDomeTourneyTreeButtons_Pal[] = INCBIN_U32("graphics/battle_frontier/tourney_buttons.gbapal.lz"); const u32 gDomeTourneyMatchCardBg_Pal[] = INCBIN_U32("graphics/battle_frontier/tourney_match_card_bg.gbapal.lz"); @@ -1438,6 +1436,7 @@ const u32 gBattleAnimBgPalette_GunkShot[] = INCBIN_U32("graphics/battle_anims/ba const u32 gBattleAnimBgImage_HydroCannon[] = INCBIN_U32("graphics/battle_anims/backgrounds/hydro_cannon.4bpp.lz"); const u32 gBattleAnimBgPalette_HydroCannon[] = INCBIN_U32("graphics/battle_anims/backgrounds/hydro_cannon.gbapal.lz"); const u32 gBattleAnimBgTilemap_HydroCannon[] = INCBIN_U32("graphics/battle_anims/backgrounds/hydro_cannon.bin.lz"); +const u32 gBattleAnimBgPalette_Chloroblast[] = INCBIN_U32("graphics/battle_anims/backgrounds/chloroblast.gbapal.lz"); const u32 gBattleAnimBgImage_HydroPump[] = INCBIN_U32("graphics/battle_anims/backgrounds/hydro_pump.4bpp.lz"); const u32 gBattleAnimBgPalette_HydroPump[] = INCBIN_U32("graphics/battle_anims/backgrounds/hydro_pump.gbapal.lz"); @@ -1706,13 +1705,9 @@ const u32 gRouletteMultiplier_Gfx[] = INCBIN_U32("graphics/roulette/multiplier.4 #include "data/graphics/mail.h" -const u16 gFrontierFactorySelectMenu_Pal[] = INCBIN_U16("graphics/battle_frontier/factory_menu1.gbapal"); -const u16 gFrontierFactorySelectMenu_Pal2[] = INCBIN_U16("graphics/battle_frontier/factory_menu2.gbapal"); - -const u16 gFrontierFactorySelectMenu_Gfx[] = INCBIN_U16("graphics/battle_frontier/factory_menu1.4bpp"); -const u16 gFrontierFactorySelectMenu_Gfx2[] = INCBIN_U16("graphics/battle_frontier/factory_menu2.4bpp"); - -const u16 gFrontierFactorySelectMenu_Tilemap[] = INCBIN_U16("graphics/battle_frontier/factory_menu.bin"); +const u16 gFrontierFactoryMenu_Pal[] = INCBIN_U16("graphics/battle_frontier/factory_screen/menu.gbapal"); +const u16 gFrontierFactoryMenu_Gfx[] = INCBIN_U16("graphics/battle_frontier/factory_screen/menu.4bpp"); +const u16 gFrontierFactoryMenu_Tilemap[] = INCBIN_U16("graphics/battle_frontier/factory_screen/menu.bin"); const u32 gFrontierPassMedals_Gfx[] = INCBIN_U32("graphics/frontier_pass/medals.4bpp.lz"); diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 18b4c3e4bf7a..bfb4e4c9d8ad 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -44,7 +44,7 @@ struct HallofFameMon u32 personality; u16 species; u8 lvl; - u8 nick[POKEMON_NAME_LENGTH]; + u8 nickname[POKEMON_NAME_LENGTH]; }; struct HallofFameTeam @@ -338,7 +338,7 @@ static const struct HallofFameMon sDummyFameMon = .personality = 0, .species = SPECIES_NONE, .lvl = 0, - .nick = {0} + .nickname = {0} }; // Unused, order of party slots on Hall of Fame screen @@ -442,18 +442,16 @@ static void Task_Hof_InitMonData(u8 taskId) for (i = 0; i < PARTY_SIZE; i++) { - u8 nick[POKEMON_NAME_LENGTH + 2]; + u8 nickname[POKEMON_NAME_LENGTH + 1]; if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES)) { sHofMonPtr->mon[i].species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES_OR_EGG); sHofMonPtr->mon[i].tid = GetMonData(&gPlayerParty[i], MON_DATA_OT_ID); sHofMonPtr->mon[i].personality = GetMonData(&gPlayerParty[i], MON_DATA_PERSONALITY); sHofMonPtr->mon[i].lvl = GetMonData(&gPlayerParty[i], MON_DATA_LEVEL); - GetMonData(&gPlayerParty[i], MON_DATA_NICKNAME, nick); + GetMonData(&gPlayerParty[i], MON_DATA_NICKNAME, nickname); for (j = 0; j < POKEMON_NAME_LENGTH; j++) - { - sHofMonPtr->mon[i].nick[j] = nick[j]; - } + sHofMonPtr->mon[i].nickname[j] = nickname[j]; gTasks[taskId].tMonNumber++; } else @@ -462,7 +460,7 @@ static void Task_Hof_InitMonData(u8 taskId) sHofMonPtr->mon[i].tid = 0; sHofMonPtr->mon[i].personality = 0; sHofMonPtr->mon[i].lvl = 0; - sHofMonPtr->mon[i].nick[0] = EOS; + sHofMonPtr->mon[i].nickname[0] = EOS; } } @@ -1115,7 +1113,7 @@ static void HallOfFame_PrintWelcomeText(u8 unusedPossiblyWindowId, u8 unused2) static void HallOfFame_PrintMonInfo(struct HallofFameMon* currMon, u8 unused1, u8 unused2) { - u8 text[30]; + u8 text[max(32, POKEMON_NAME_LENGTH + 1)]; u8 *stringPtr; s32 dexNumber; s32 width; @@ -1148,8 +1146,8 @@ static void HallOfFame_PrintMonInfo(struct HallofFameMon* currMon, u8 unused1, u AddTextPrinterParameterized3(0, FONT_NORMAL, 0x10, 1, sMonInfoTextColors, TEXT_SKIP_DRAW, text); } - // nick, species names, gender and level - memcpy(text, currMon->nick, POKEMON_NAME_LENGTH); + // nickname, species names, gender and level + memcpy(text, currMon->nickname, POKEMON_NAME_LENGTH); text[POKEMON_NAME_LENGTH] = EOS; if (currMon->species == SPECIES_EGG) { @@ -1163,7 +1161,7 @@ static void HallOfFame_PrintMonInfo(struct HallofFameMon* currMon, u8 unused1, u AddTextPrinterParameterized3(0, FONT_NORMAL, width, 1, sMonInfoTextColors, TEXT_SKIP_DRAW, text); text[0] = CHAR_SLASH; - stringPtr = StringCopy(text + 1, gSpeciesNames[currMon->species]); + stringPtr = StringCopy(text + 1, GetSpeciesName(currMon->species)); if (currMon->species != SPECIES_NIDORAN_M && currMon->species != SPECIES_NIDORAN_F) { diff --git a/src/intro.c b/src/intro.c index 28b4120b1185..8b5ca5bd4262 100644 --- a/src/intro.c +++ b/src/intro.c @@ -1172,7 +1172,7 @@ void CB2_InitCopyrightScreenAfterTitleScreen(void) void Task_Scene1_Load(u8 taskId) { SetVBlankCallback(NULL); - sIntroCharacterGender = Random() & 1; + sIntroCharacterGender = MOD(Random(), GENDER_COUNT); IntroResetGpuRegs(); SetGpuReg(REG_OFFSET_BG3VOFS, 0); SetGpuReg(REG_OFFSET_BG2VOFS, 80); @@ -1204,7 +1204,7 @@ void Task_Scene1_Load(u8 taskId) CpuCopy16(&gPlttBufferUnfaded[OBJ_PLTT_ID(0)], &gPlttBufferUnfaded[OBJ_PLTT_ID(11) + 4], PLTT_SIZEOF(16 - 4)); CpuCopy16(&gPlttBufferUnfaded[OBJ_PLTT_ID(0)], &gPlttBufferUnfaded[OBJ_PLTT_ID(10) + 5], PLTT_SIZEOF(16 - 5)); CpuCopy16(&gPlttBufferUnfaded[OBJ_PLTT_ID(0)], &gPlttBufferUnfaded[OBJ_PLTT_ID( 9) + 6], PLTT_SIZEOF(16 - 6)); - CreateGameFreakLogoSprites(120, 80, 0); + CreateGameFreakLogoSprites(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, 0); gTasks[taskId].sBigDropSpriteId = CreateWaterDrop(236, -14, 0x200, 1, 0x78, FALSE); gTasks[taskId].func = Task_Scene1_FadeIn; } @@ -1731,7 +1731,7 @@ static void Task_Scene3_Load(u8 taskId) gTasks[taskId].tZoomDiv = 0; gTasks[taskId].tZoomDivSpeed = 0; gTasks[taskId].data[3] = 0; - PanFadeAndZoomScreen(0x78, 0x50, 0, 0); + PanFadeAndZoomScreen(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, 0, 0); ResetSpriteData(); FreeAllSpritePalettes(); BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_WHITEALPHA); @@ -1755,7 +1755,7 @@ static void Task_Scene3_SpinPokeball(u8 taskId) gTasks[taskId].func = Task_Scene3_WaitGroudon; } - PanFadeAndZoomScreen(0x78, 0x50, SAFE_DIV(0x10000, gTasks[taskId].tZoomDiv), gTasks[taskId].tAlpha); + PanFadeAndZoomScreen(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, SAFE_DIV(0x10000, gTasks[taskId].tZoomDiv), gTasks[taskId].tAlpha); if (gIntroFrameCounter == TIMER_POKEBALL_FADE) BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_WHITEALPHA); @@ -1857,7 +1857,7 @@ static void Task_Scene3_StartGroudon(u8 taskId) { gTasks[taskId].tState = 0; gTasks[taskId].func = Task_Scene3_Groudon; - ScanlineEffect_InitWave(0, 160, 4, 4, 1, SCANLINE_EFFECT_REG_BG1HOFS, FALSE); + ScanlineEffect_InitWave(0, DISPLAY_HEIGHT, 4, 4, 1, SCANLINE_EFFECT_REG_BG1HOFS, FALSE); } #define tScreenX data[1] @@ -2067,7 +2067,7 @@ static void Task_Scene3_LoadKyogre(u8 taskId) gTasks[taskId].tDelay = 16; gTasks[taskId].tZoom = 256; PanFadeAndZoomScreen(gTasks[taskId].tScreenX, gTasks[taskId].tScreenY, gTasks[taskId].tZoom, 0); - ScanlineEffect_InitWave(0, 0xA0, 4, 4, 1, SCANLINE_EFFECT_REG_BG1VOFS, FALSE); + ScanlineEffect_InitWave(0, DISPLAY_HEIGHT, 4, 4, 1, SCANLINE_EFFECT_REG_BG1VOFS, FALSE); } static void Task_Scene3_Kyogre(u8 taskId) diff --git a/src/item.c b/src/item.c index 2c6937244605..7c19b316d661 100644 --- a/src/item.c +++ b/src/item.c @@ -884,12 +884,12 @@ u16 ItemId_GetPrice(u16 itemId) return gItems[SanitizeItemId(itemId)].price; } -u8 ItemId_GetHoldEffect(u16 itemId) +u32 ItemId_GetHoldEffect(u32 itemId) { return gItems[SanitizeItemId(itemId)].holdEffect; } -u8 ItemId_GetHoldEffectParam(u16 itemId) +u32 ItemId_GetHoldEffectParam(u32 itemId) { return gItems[SanitizeItemId(itemId)].holdEffectParam; } @@ -904,12 +904,6 @@ u8 ItemId_GetImportance(u16 itemId) return gItems[SanitizeItemId(itemId)].importance; } -// Unused -u8 ItemId_GetRegistrability(u16 itemId) -{ - return gItems[SanitizeItemId(itemId)].registrability; -} - u8 ItemId_GetPocket(u16 itemId) { return gItems[SanitizeItemId(itemId)].pocket; @@ -962,7 +956,7 @@ u8 ItemId_GetSecondaryId(u16 itemId) return gItems[SanitizeItemId(itemId)].secondaryId; } -u8 ItemId_GetFlingPower(u16 itemId) +u32 ItemId_GetFlingPower(u32 itemId) { return gItems[SanitizeItemId(itemId)].flingPower; } diff --git a/src/item_use.c b/src/item_use.c index 2f703a3a9a5b..b3b5c066a499 100644 --- a/src/item_use.c +++ b/src/item_use.c @@ -200,6 +200,33 @@ void ItemUseOutOfBattle_Mail(u8 taskId) Task_FadeAndCloseBagMenu(taskId); } +STATIC_ASSERT(I_EXP_SHARE_ITEM < GEN_6 || I_EXP_SHARE_FLAG > TEMP_FLAGS_END, YouNeedToSetAFlagToUseGen6ExpShare); + +void ItemUseOutOfBattle_ExpShare(u8 taskId) +{ +#if I_EXP_SHARE_ITEM >= GEN_6 + if (IsGen6ExpShareEnabled()) + { + PlaySE(SE_PC_OFF); + if (!gTasks[taskId].data[2]) // to account for pressing select in the overworld + DisplayItemMessageOnField(taskId, gText_ExpShareOff, Task_CloseCantUseKeyItemMessage); + else + DisplayItemMessage(taskId, FONT_NORMAL, gText_ExpShareOff, CloseItemMessage); + } + else + { + PlaySE(SE_EXP_MAX); + if (!gTasks[taskId].data[2]) // to account for pressing select in the overworld + DisplayItemMessageOnField(taskId, gText_ExpShareOn, Task_CloseCantUseKeyItemMessage); + else + DisplayItemMessage(taskId, FONT_NORMAL, gText_ExpShareOn, CloseItemMessage); + } + FlagToggle(I_EXP_SHARE_FLAG); +#else + DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].tUsingRegisteredKeyItem); +#endif +} + void ItemUseOutOfBattle_Bike(u8 taskId) { s16 *data = gTasks[taskId].data; @@ -800,7 +827,7 @@ void ItemUseOutOfBattle_RareCandy(u8 taskId) void ItemUseOutOfBattle_TMHM(u8 taskId) { - if (gSpecialVar_ItemId >= ITEM_HM01_CUT) + if (gSpecialVar_ItemId >= ITEM_HM01) DisplayItemMessage(taskId, FONT_NORMAL, gText_BootedUpHM, BootUpSoundTMHM); // HM else DisplayItemMessage(taskId, FONT_NORMAL, gText_BootedUpTM, BootUpSoundTMHM); // TM @@ -887,7 +914,7 @@ static void Task_UseRepel(u8 taskId) DisplayItemMessageInBattlePyramid(taskId, gStringVar4, Task_CloseBattlePyramidBagMessage); } } -void HandleUseExpiredRepel(void) +void HandleUseExpiredRepel(struct ScriptContext *ctx) { #if VAR_LAST_REPEL_LURE_USED != 0 VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(VarGet(VAR_LAST_REPEL_LURE_USED))); @@ -932,7 +959,7 @@ static void Task_UseLure(u8 taskId) } } -void HandleUseExpiredLure(void) +void HandleUseExpiredLure(struct ScriptContext *ctx) { #if VAR_LAST_REPEL_LURE_USED != 0 VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(VarGet(VAR_LAST_REPEL_LURE_USED)) | REPEL_LURE_MASK); diff --git a/src/librfu_rfu.c b/src/librfu_rfu.c index 319743d0d2f4..da37b8fc112d 100644 --- a/src/librfu_rfu.c +++ b/src/librfu_rfu.c @@ -139,7 +139,7 @@ u16 rfu_initializeAPI(u32 *APIBuffer, u16 buffByteSize, IntrFunc *sioIntrTable_p u16 buffByteSizeMax; // is in EWRAM? - if (((uintptr_t)APIBuffer & 0xF000000) == 0x2000000 && copyInterruptToRam) + if (((uintptr_t)APIBuffer & 0xF000000) == EWRAM_START && copyInterruptToRam) return ERR_RFU_API_BUFF_ADR; // is not 4-byte aligned? if ((u32)APIBuffer & 3) @@ -338,7 +338,7 @@ u16 rfu_getRFUStatus(u8 *rfuState) u16 rfu_MBOOT_CHILD_inheritanceLinkStatus(void) { const char *s1 = str_checkMbootLL; - char *s2 = (char *)0x30000F0; + char *s2 = (char *)(IWRAM_START + 0xF0); u16 checksum; u16 *mb_buff_iwram_p; u8 i; @@ -347,15 +347,15 @@ u16 rfu_MBOOT_CHILD_inheritanceLinkStatus(void) while (*s1 != '\0') if (*s1++ != *s2++) return 1; - mb_buff_iwram_p = (u16 *)0x3000000; + mb_buff_iwram_p = (u16 *)IWRAM_START; // The size of struct RfuLinkStatus is 180 checksum = 0; for (i = 0; i < 180/2; ++i) checksum += *mb_buff_iwram_p++; - if (checksum != *(u16 *)0x30000FA) + if (checksum != *(u16 *)(IWRAM_START + 0xFA)) return 1; - CpuCopy16((u16 *)0x3000000, gRfuLinkStatus, sizeof(struct RfuLinkStatus)); + CpuCopy16((u16 *)IWRAM_START, gRfuLinkStatus, sizeof(struct RfuLinkStatus)); gRfuStatic->flags |= 0x80; // mboot return 0; } diff --git a/src/link_rfu_2.c b/src/link_rfu_2.c index 9d66a1837858..6c84ffefe008 100644 --- a/src/link_rfu_2.c +++ b/src/link_rfu_2.c @@ -1918,7 +1918,8 @@ static void Task_PlayerExchangeUpdate(u8 taskId) for (i = 0; i < RFU_CHILD_MAX; i++) sio->linkPlayerIdx[i] = gRfu.linkPlayerIdx[i]; memcpy(sio->linkPlayers, gLinkPlayers, sizeof(gLinkPlayers)); - if (SendBlock(0, gBlockSendBuffer, 0xa0)) + // Send SioInfo but exclude the 92 unused bytes at the end + if (SendBlock(0, gBlockSendBuffer, offsetof(struct SioInfo, filler))) gTasks[taskId].tState++; break; case 5: diff --git a/src/m4a_1.s b/src/m4a_1.s index 3f15788061d0..20f9197a8dd3 100644 --- a/src/m4a_1.s +++ b/src/m4a_1.s @@ -1395,7 +1395,7 @@ _081DD9F6: cmp r6, 0 beq _081DDA14 ldrb r0, [r4, o_CgbChannel_modify] - movs r1, 0x1 + movs r1, CGB_CHANNEL_MO_VOL orrs r0, r1 strb r0, [r4, o_CgbChannel_modify] _081DDA14: diff --git a/src/main_menu.c b/src/main_menu.c index ce366faef937..a5571e014a09 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -4,6 +4,7 @@ #include "constants/rgb.h" #include "constants/songs.h" #include "constants/trainers.h" +#include "data.h" #include "decompress.h" #include "event_data.h" #include "field_effect.h" @@ -1900,7 +1901,7 @@ static void AddBirchSpeechObjects(u8 taskId) gSprites[brendanSpriteId].invisible = TRUE; gSprites[brendanSpriteId].oam.priority = 0; gTasks[taskId].tBrendanSpriteId = brendanSpriteId; - maySpriteId = CreateTrainerSprite(FacilityClassToPicIndex(FACILITY_CLASS_MAY), 120, 60, 0, &gDecompressionBuffer[0x800]); + maySpriteId = CreateTrainerSprite(FacilityClassToPicIndex(FACILITY_CLASS_MAY), 120, 60, 0, &gDecompressionBuffer[TRAINER_PIC_SIZE]); gSprites[maySpriteId].callback = SpriteCB_Null; gSprites[maySpriteId].invisible = TRUE; gSprites[maySpriteId].oam.priority = 0; diff --git a/src/match_call.c b/src/match_call.c index c3378040e3e2..4d45b9b436d3 100644 --- a/src/match_call.c +++ b/src/match_call.c @@ -1777,7 +1777,7 @@ static void PopulateSpeciesFromTrainerLocation(int matchCallId, u8 *destStr) if (numSpecies) { - StringCopy(destStr, gSpeciesNames[species[Random() % numSpecies]]); + StringCopy(destStr, GetSpeciesName(species[Random() % numSpecies])); return; } } @@ -1789,33 +1789,14 @@ static void PopulateSpeciesFromTrainerLocation(int matchCallId, u8 *destStr) static void PopulateSpeciesFromTrainerParty(int matchCallId, u8 *destStr) { u16 trainerId; - union TrainerMonPtr party; + const struct TrainerMon *party; u8 monId; const u8 *speciesName; trainerId = GetLastBeatenRematchTrainerId(sMatchCallTrainers[matchCallId].trainerId); party = gTrainers[trainerId].party; monId = Random() % gTrainers[trainerId].partySize; - - switch (gTrainers[trainerId].partyFlags) - { - case 0: - default: - speciesName = gSpeciesNames[party.NoItemDefaultMoves[monId].species]; - break; - case F_TRAINER_PARTY_CUSTOM_MOVESET: - speciesName = gSpeciesNames[party.NoItemCustomMoves[monId].species]; - break; - case F_TRAINER_PARTY_HELD_ITEM: - speciesName = gSpeciesNames[party.ItemDefaultMoves[monId].species]; - break; - case F_TRAINER_PARTY_CUSTOM_MOVESET | F_TRAINER_PARTY_HELD_ITEM: - speciesName = gSpeciesNames[party.ItemCustomMoves[monId].species]; - break; - case F_TRAINER_PARTY_EVERYTHING_CUSTOMIZED: - speciesName = gSpeciesNames[party.EverythingCustomized[monId].species]; - break; - } + speciesName = GetSpeciesName(party[monId].species); StringCopy(destStr, speciesName); } diff --git a/src/menu_specialized.c b/src/menu_specialized.c index 802d1aec3243..01fc4eddb924 100644 --- a/src/menu_specialized.c +++ b/src/menu_specialized.c @@ -923,7 +923,7 @@ static u8 *GetConditionMenuMonString(u8 *dst, u16 boxId, u16 monId) *(dst++) = TEXT_COLOR_TRANSPARENT; *(dst++) = TEXT_COLOR_LIGHT_BLUE; if (GetBoxOrPartyMonData(box, mon, MON_DATA_IS_EGG, NULL)) - return StringCopyPadded(dst, gText_EggNickname, 0, 12); + return StringCopyPadded(dst, gText_EggNickname, 0, POKEMON_NAME_LENGTH + 2); GetBoxOrPartyMonData(box, mon, MON_DATA_NICKNAME, dst); StringGet_Nickname(dst); species = GetBoxOrPartyMonData(box, mon, MON_DATA_SPECIES, NULL); @@ -939,7 +939,7 @@ static u8 *GetConditionMenuMonString(u8 *dst, u16 boxId, u16 monId) level = GetLevelFromBoxMonExp(boxMon); } - if ((species == SPECIES_NIDORAN_F || species == SPECIES_NIDORAN_M) && !StringCompare(dst, gSpeciesNames[species])) + if ((species == SPECIES_NIDORAN_F || species == SPECIES_NIDORAN_M) && !StringCompare(dst, GetSpeciesName(species))) gender = MON_GENDERLESS; for (str = dst; *str != EOS; str++) @@ -1025,7 +1025,7 @@ void GetConditionMenuMonNameAndLocString(u8 *locationDst, u8 *nameDst, u16 boxId locationDst[3] = TEXT_COLOR_TRANSPARENT; locationDst[4] = TEXT_COLOR_LIGHT_BLUE; if (box == TOTAL_BOXES_COUNT) // Party mon. - BufferConditionMenuSpacedStringN(&locationDst[5], gText_InParty, 8); + BufferConditionMenuSpacedStringN(&locationDst[5], gText_InParty, BOX_NAME_LENGTH); else BufferConditionMenuSpacedStringN(&locationDst[5], GetBoxNamePtr(box), BOX_NAME_LENGTH); } @@ -1034,7 +1034,7 @@ void GetConditionMenuMonNameAndLocString(u8 *locationDst, u8 *nameDst, u16 boxId for (i = 0; i < POKEMON_NAME_LENGTH + 2; i++) nameDst[i] = CHAR_SPACE; nameDst[i] = EOS; - for (i = 0; i < 8; i++) + for (i = 0; i < BOX_NAME_LENGTH; i++) locationDst[i] = CHAR_SPACE; locationDst[i] = EOS; } diff --git a/src/naming_screen.c b/src/naming_screen.c index 3962f141ab22..28bb24637519 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -1067,7 +1067,7 @@ static void SpriteCB_InputArrow(struct Sprite *sprite) if (sprite->sDelay == 0 || --sprite->sDelay == 0) { sprite->sDelay = 8; - sprite->sXPosId = (sprite->sXPosId + 1) & (ARRAY_COUNT(x) - 1); + sprite->sXPosId = MOD(sprite->sXPosId + 1, ARRAY_COUNT(x)); } sprite->x2 = x[sprite->sXPosId]; } @@ -1097,7 +1097,7 @@ static void SpriteCB_Underscore(struct Sprite *sprite) sprite->sDelay++; if (sprite->sDelay > 8) { - sprite->sYPosId = (sprite->sYPosId + 1) & (ARRAY_COUNT(y) - 1); + sprite->sYPosId = MOD(sprite->sYPosId + 1, ARRAY_COUNT(y)); sprite->sDelay = 0; } } @@ -1712,7 +1712,7 @@ static void DrawMonTextEntryBox(void) { u8 buffer[32]; - StringCopy(buffer, gSpeciesNames[sNamingScreen->monSpecies]); + StringCopy(buffer, GetSpeciesName(sNamingScreen->monSpecies)); StringAppendN(buffer, sNamingScreen->template->title, 15); FillWindowPixelBuffer(sNamingScreen->windows[WIN_TEXT_ENTRY_BOX], PIXEL_FILL(1)); AddTextPrinterParameterized(sNamingScreen->windows[WIN_TEXT_ENTRY_BOX], FONT_NORMAL, buffer, 8, 1, 0, 0); diff --git a/src/overworld.c b/src/overworld.c index bb1b98611b9b..0152a4857971 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -556,12 +556,9 @@ static void InitMapView(void) InitTilesetAnimations(); } -const struct MapLayout *GetMapLayout(void) +const struct MapLayout *GetMapLayout(u16 mapLayoutId) { - u16 mapLayoutId = gSaveBlock1Ptr->mapLayoutId; - if (mapLayoutId) - return gMapLayouts[mapLayoutId - 1]; - return NULL; + return gMapLayouts[mapLayoutId - 1]; } void ApplyCurrentWarp(void) @@ -618,13 +615,13 @@ static void LoadCurrentMapData(void) sLastMapSectionId = gMapHeader.regionMapSectionId; gMapHeader = *Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum); gSaveBlock1Ptr->mapLayoutId = gMapHeader.mapLayoutId; - gMapHeader.mapLayout = GetMapLayout(); + gMapHeader.mapLayout = GetMapLayout(gMapHeader.mapLayoutId); } static void LoadSaveblockMapHeader(void) { gMapHeader = *Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum); - gMapHeader.mapLayout = GetMapLayout(); + gMapHeader.mapLayout = GetMapLayout(gMapHeader.mapLayoutId); } static void SetPlayerCoordsFromWarp(void) @@ -1020,7 +1017,7 @@ u8 GetFlashLevel(void) void SetCurrentMapLayout(u16 mapLayoutId) { gSaveBlock1Ptr->mapLayoutId = mapLayoutId; - gMapHeader.mapLayout = GetMapLayout(); + gMapHeader.mapLayout = GetMapLayout(mapLayoutId); } void SetObjectEventLoadFlag(u8 flag) diff --git a/src/palette.c b/src/palette.c index 43a4c213c71a..e3606646274b 100644 --- a/src/palette.c +++ b/src/palette.c @@ -440,7 +440,7 @@ static u8 UpdateNormalPaletteFade(void) else { selectedPalettes = gPaletteFade_selectedPalettes >> 16; - paletteOffset = 256; + paletteOffset = OBJ_PLTT_OFFSET; } while (selectedPalettes) diff --git a/src/party_menu.c b/src/party_menu.c index 68d7b058e283..2b7256628201 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -2333,7 +2333,7 @@ static void DisplayPartyPokemonGender(u8 gender, u16 species, u8 *nickname, stru if (species == SPECIES_NONE) return; - if ((species == SPECIES_NIDORAN_M || species == SPECIES_NIDORAN_F) && StringCompare(nickname, gSpeciesNames[species]) == 0) + if ((species == SPECIES_NIDORAN_M || species == SPECIES_NIDORAN_F) && StringCompare(nickname, GetSpeciesName(species)) == 0) return; switch (gender) { @@ -4993,20 +4993,7 @@ void ItemUseCB_PPUp(u8 taskId, TaskFunc task) u16 ItemIdToBattleMoveId(u16 item) { - u16 tmNumber = item - ITEM_TM01; - return sTMHMMoves[tmNumber]; -} - -bool8 IsMoveHm(u16 move) -{ - u8 i; - - for (i = 0; i < NUM_HIDDEN_MACHINES; i++) - { - if (sTMHMMoves[i + NUM_TECHNICAL_MACHINES] == move) - return TRUE; - } - return FALSE; + return (ItemId_GetPocket(item) == POCKET_TM_HM) ? gItems[item].secondaryId : MOVE_NONE; } bool8 MonKnowsMove(struct Pokemon *mon, u16 move) diff --git a/src/pokeball.c b/src/pokeball.c index 2e556ec22523..891b8fe4a5b3 100644 --- a/src/pokeball.c +++ b/src/pokeball.c @@ -527,17 +527,17 @@ const struct SpriteTemplate gBallSpriteTemplates[POKEBALL_COUNT] = #define tBattler data[3] #define tOpponentBattler data[4] -u8 DoPokeballSendOutAnimation(s16 pan, u8 kindOfThrow) +u8 DoPokeballSendOutAnimation(u32 battler, s16 pan, u8 kindOfThrow) { u8 taskId; gDoingBattleAnim = TRUE; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive = TRUE; + gBattleSpritesDataPtr->healthBoxesData[battler].ballAnimActive = TRUE; taskId = CreateTask(Task_DoPokeballSendOutAnim, 5); gTasks[taskId].tPan = pan; gTasks[taskId].tThrowId = kindOfThrow; - gTasks[taskId].tBattler = gActiveBattler; + gTasks[taskId].tBattler = battler; return 0; } diff --git a/src/pokedex.c b/src/pokedex.c index a0cb85b753c3..6494c58f5270 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -2447,7 +2447,7 @@ static u8 CreateMonName(u16 num, u8 left, u8 top) num = NationalPokedexNumToSpecies(num); if (num) - str = gSpeciesNames[num]; + str = GetSpeciesName(num); else str = sText_TenDashes; PrintMonDexNumAndName(0, FONT_NARROW, str, left, top); @@ -3755,7 +3755,7 @@ static void Task_LoadSizeScreen(u8 taskId) StringCopy(string, gText_SizeComparedTo); StringAppend(string, gSaveBlock2Ptr->playerName); - PrintInfoScreenText(string, GetStringCenterAlignXOffset(FONT_NORMAL, string, 0xF0), 0x79); + PrintInfoScreenText(string, GetStringCenterAlignXOffset(FONT_NORMAL, string, DISPLAY_WIDTH), 121); gMain.state++; } break; @@ -4072,14 +4072,14 @@ static void Task_ExitCaughtMonPage(u8 taskId) static void SpriteCB_SlideCaughtMonToCenter(struct Sprite *sprite) { - if (sprite->x < 0x78) + if (sprite->x < DISPLAY_WIDTH / 2) sprite->x += 2; - if (sprite->x > 0x78) + if (sprite->x > DISPLAY_WIDTH / 2) sprite->x -= 2; - if (sprite->y < 0x50) + if (sprite->y < DISPLAY_HEIGHT / 2) sprite->y += 1; - if (sprite->y > 0x50) + if (sprite->y > DISPLAY_HEIGHT / 2) sprite->y -= 1; } @@ -4103,7 +4103,7 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry) const u8 *description; if (newEntry) - PrintInfoScreenText(gText_PokedexRegistration, GetStringCenterAlignXOffset(FONT_NORMAL, gText_PokedexRegistration, 0xF0), 0); + PrintInfoScreenText(gText_PokedexRegistration, GetStringCenterAlignXOffset(FONT_NORMAL, gText_PokedexRegistration, DISPLAY_WIDTH), 0); if (value == 0) value = NationalToHoennOrder(num); else @@ -4112,7 +4112,7 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry) PrintInfoScreenText(str, 0x60, 0x19); natNum = NationalPokedexNumToSpecies(num); if (natNum) - name = gSpeciesNames[natNum]; + name = GetSpeciesName(natNum); else name = sText_TenDashes2; PrintInfoScreenText(name, 0x84, 0x19); @@ -4142,7 +4142,7 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry) description = gPokedexEntries[num].description; else description = sExpandedPlaceholder_PokedexDescription; - PrintInfoScreenText(description, GetStringCenterAlignXOffset(FONT_NORMAL, description, 0xF0), 0x5F); + PrintInfoScreenText(description, GetStringCenterAlignXOffset(FONT_NORMAL, description, DISPLAY_WIDTH), 95); } static void PrintMonHeight(u16 height, u8 left, u8 top) @@ -4459,8 +4459,8 @@ static u8 PrintCryScreenSpeciesName(u8 windowId, u16 num, u8 left, u8 top) switch (num) { default: - for (i = 0; gSpeciesNames[num][i] != EOS && i < POKEMON_NAME_LENGTH; i++) - str[i] = gSpeciesNames[num][i]; + for (i = 0; GetSpeciesName(num)[i] != EOS && i < POKEMON_NAME_LENGTH; i++) + str[i] = GetSpeciesName(num)[i]; break; case 0: for (i = 0; i < 5; i++) @@ -4661,7 +4661,7 @@ static int DoPokedexSearch(u8 dexMode, u8 order, u8 abcGroup, u8 bodyColor, u8 t u8 firstLetter; species = NationalPokedexNumToSpecies(sPokedexView->pokedexList[i].dexNum); - firstLetter = gSpeciesNames[species][0]; + firstLetter = GetSpeciesName(species)[0]; if (LETTER_IN_RANGE_UPPER(firstLetter, abcGroup) || LETTER_IN_RANGE_LOWER(firstLetter, abcGroup)) { sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i]; diff --git a/src/pokemon.c b/src/pokemon.c index fb3898465a94..1320774f1e11 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1969,7 +1969,7 @@ const u8 sMonFrontAnimIdsTable[NUM_SPECIES - 1] = [SPECIES_CHARMANDER - 1] = ANIM_V_JUMPS_SMALL, [SPECIES_CHARMELEON - 1] = ANIM_BACK_AND_LUNGE, [SPECIES_CHARIZARD - 1] = ANIM_V_SHAKE, - [SPECIES_SQUIRTLE - 1] = ANIM_V_JUMPS_SMALL, + [SPECIES_SQUIRTLE - 1] = ANIM_V_JUMPS_BIG, [SPECIES_WARTORTLE - 1] = ANIM_SHRINK_GROW, [SPECIES_BLASTOISE - 1] = ANIM_V_SHAKE_TWICE, [SPECIES_CATERPIE - 1] = ANIM_SWING_CONCAVE, @@ -1977,13 +1977,13 @@ const u8 sMonFrontAnimIdsTable[NUM_SPECIES - 1] = [SPECIES_BUTTERFREE - 1] = ANIM_H_SLIDE_WOBBLE, [SPECIES_WEEDLE - 1] = ANIM_H_SLIDE_SLOW, [SPECIES_KAKUNA - 1] = ANIM_GLOW_ORANGE, - [SPECIES_BEEDRILL - 1] = ANIM_H_VIBRATE, + [SPECIES_BEEDRILL - 1] = ANIM_ZIGZAG_SLOW, [SPECIES_PIDGEY - 1] = ANIM_V_STRETCH, [SPECIES_PIDGEOTTO - 1] = ANIM_V_STRETCH, [SPECIES_PIDGEOT - 1] = ANIM_FRONT_FLIP, - [SPECIES_RATTATA - 1] = ANIM_RAPID_H_HOPS, - [SPECIES_RATICATE - 1] = ANIM_FIGURE_8, - [SPECIES_SPEAROW - 1] = ANIM_H_JUMPS, + [SPECIES_RATTATA - 1] = ANIM_H_JUMPS, + [SPECIES_RATICATE - 1] = ANIM_BOUNCE_ROTATE_TO_SIDES_SMALL, + [SPECIES_SPEAROW - 1] = ANIM_V_JUMPS_SMALL, [SPECIES_FEAROW - 1] = ANIM_FIGURE_8, [SPECIES_EKANS - 1] = ANIM_V_STRETCH, [SPECIES_ARBOK - 1] = ANIM_V_STRETCH, @@ -1998,16 +1998,16 @@ const u8 sMonFrontAnimIdsTable[NUM_SPECIES - 1] = [SPECIES_NIDORINO - 1] = ANIM_V_STRETCH, [SPECIES_NIDOKING - 1] = ANIM_H_SHAKE, [SPECIES_CLEFAIRY - 1] = ANIM_V_SQUISH_AND_BOUNCE, - [SPECIES_CLEFABLE - 1] = ANIM_V_STRETCH, + [SPECIES_CLEFABLE - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_VULPIX - 1] = ANIM_V_STRETCH, [SPECIES_NINETALES - 1] = ANIM_GROW_VIBRATE, [SPECIES_JIGGLYPUFF - 1] = ANIM_BOUNCE_ROTATE_TO_SIDES_SMALL, [SPECIES_WIGGLYTUFF - 1] = ANIM_H_JUMPS, [SPECIES_ZUBAT - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_GOLBAT - 1] = ANIM_H_SLIDE_WOBBLE, - [SPECIES_ODDISH - 1] = ANIM_V_SQUISH_AND_BOUNCE, + [SPECIES_ODDISH - 1] = ANIM_V_JUMPS_H_JUMPS, [SPECIES_GLOOM - 1] = ANIM_V_SQUISH_AND_BOUNCE_SLOW, - [SPECIES_VILEPLUME - 1] = ANIM_V_SHAKE_TWICE, + [SPECIES_VILEPLUME - 1] = ANIM_V_SQUISH_AND_BOUNCE_SLOW, [SPECIES_PARAS - 1] = ANIM_H_SLIDE_SLOW, [SPECIES_PARASECT - 1] = ANIM_H_SHAKE, [SPECIES_VENONAT - 1] = ANIM_V_JUMPS_H_JUMPS, @@ -2019,16 +2019,16 @@ const u8 sMonFrontAnimIdsTable[NUM_SPECIES - 1] = [SPECIES_PSYDUCK - 1] = ANIM_V_JUMPS_H_JUMPS, [SPECIES_GOLDUCK - 1] = ANIM_H_SHAKE_SLOW, [SPECIES_MANKEY - 1] = ANIM_H_JUMPS_V_STRETCH, - [SPECIES_PRIMEAPE - 1] = ANIM_BOUNCE_ROTATE_TO_SIDES_SMALL, - [SPECIES_GROWLITHE - 1] = ANIM_BACK_AND_LUNGE, - [SPECIES_ARCANINE - 1] = ANIM_H_SHAKE, + [SPECIES_PRIMEAPE - 1] = ANIM_BOUNCE_ROTATE_TO_SIDES, + [SPECIES_GROWLITHE - 1] = ANIM_V_STRETCH, + [SPECIES_ARCANINE - 1] = ANIM_V_SHAKE, [SPECIES_POLIWAG - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_POLIWHIRL - 1] = ANIM_H_JUMPS_V_STRETCH, [SPECIES_POLIWRATH - 1] = ANIM_V_SHAKE_TWICE, - [SPECIES_ABRA - 1] = ANIM_H_JUMPS, + [SPECIES_ABRA - 1] = ANIM_H_VIBRATE, [SPECIES_KADABRA - 1] = ANIM_GROW_VIBRATE, [SPECIES_ALAKAZAM - 1] = ANIM_GROW_VIBRATE, - [SPECIES_MACHOP - 1] = ANIM_V_SQUISH_AND_BOUNCE, + [SPECIES_MACHOP - 1] = ANIM_V_STRETCH, [SPECIES_MACHOKE - 1] = ANIM_V_SHAKE, [SPECIES_MACHAMP - 1] = ANIM_H_JUMPS, [SPECIES_BELLSPROUT - 1] = ANIM_H_JUMPS, @@ -2037,12 +2037,12 @@ const u8 sMonFrontAnimIdsTable[NUM_SPECIES - 1] = [SPECIES_TENTACOOL - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_TENTACRUEL - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_GEODUDE - 1] = ANIM_BOUNCE_ROTATE_TO_SIDES_SMALL, - [SPECIES_GRAVELER - 1] = ANIM_BOUNCE_ROTATE_TO_SIDES_SMALL, + [SPECIES_GRAVELER - 1] = ANIM_V_SHAKE, [SPECIES_GOLEM - 1] = ANIM_ROTATE_UP_SLAM_DOWN, - [SPECIES_PONYTA - 1] = ANIM_GLOW_ORANGE, + [SPECIES_PONYTA - 1] = ANIM_V_SHAKE, [SPECIES_RAPIDASH - 1] = ANIM_H_SHAKE, [SPECIES_SLOWPOKE - 1] = ANIM_V_SQUISH_AND_BOUNCE_SLOW, - [SPECIES_SLOWBRO - 1] = ANIM_GROW_VIBRATE, + [SPECIES_SLOWBRO - 1] = ANIM_H_STRETCH, [SPECIES_MAGNEMITE - 1] = ANIM_TUMBLING_FRONT_FLIP_TWICE, [SPECIES_MAGNETON - 1] = ANIM_FLASH_YELLOW, [SPECIES_FARFETCHD - 1] = ANIM_BOUNCE_ROTATE_TO_SIDES_SMALL, @@ -2289,7 +2289,7 @@ const u8 sMonFrontAnimIdsTable[NUM_SPECIES - 1] = [SPECIES_TORKOAL - 1] = ANIM_V_STRETCH, [SPECIES_SPOINK - 1] = ANIM_H_JUMPS_V_STRETCH_TWICE, [SPECIES_GRUMPIG - 1] = ANIM_H_JUMPS_V_STRETCH, - [SPECIES_SPINDA - 1] = ANIM_H_JUMPS, + [SPECIES_SPINDA - 1] = ANIM_CIRCLE_INTO_BG, [SPECIES_TRAPINCH - 1] = ANIM_V_SHAKE, [SPECIES_VIBRAVA - 1] = ANIM_H_SHAKE, [SPECIES_FLYGON - 1] = ANIM_ZIGZAG_SLOW, @@ -2325,7 +2325,7 @@ const u8 sMonFrontAnimIdsTable[NUM_SPECIES - 1] = [SPECIES_WYNAUT - 1] = ANIM_H_JUMPS_V_STRETCH, [SPECIES_SNORUNT - 1] = ANIM_V_SQUISH_AND_BOUNCE_SLOW, [SPECIES_GLALIE - 1] = ANIM_ZIGZAG_FAST, - [SPECIES_SPHEAL - 1] = ANIM_V_STRETCH, + [SPECIES_SPHEAL - 1] = ANIM_SPIN_LONG, [SPECIES_SEALEO - 1] = ANIM_V_STRETCH, [SPECIES_WALREIN - 1] = ANIM_H_SHAKE, [SPECIES_CLAMPERL - 1] = ANIM_TWIST, @@ -2707,7 +2707,7 @@ const u8 sMonFrontAnimIdsTable[NUM_SPECIES - 1] = [SPECIES_GUMSHOOS - 1] = ANIM_H_SHAKE, [SPECIES_GRUBBIN - 1] = ANIM_H_SLIDE, [SPECIES_CHARJABUG - 1] = ANIM_SHAKE_FLASH_YELLOW_SLOW, - [SPECIES_VIKAVOLT - 1] = ANIM_H_VIBRATE, + [SPECIES_VIKAVOLT - 1] = ANIM_BOUNCE_ROTATE_TO_SIDES, [SPECIES_CRABRAWLER - 1] = ANIM_V_SHAKE, [SPECIES_CRABOMINABLE - 1] = ANIM_SHRINK_GROW_VIBRATE_FAST, [SPECIES_ORICORIO - 1] = ANIM_CONCAVE_ARC_SMALL, @@ -2726,9 +2726,9 @@ const u8 sMonFrontAnimIdsTable[NUM_SPECIES - 1] = [SPECIES_LURANTIS - 1] = ANIM_GROW_VIBRATE, [SPECIES_MORELULL - 1] = ANIM_SHAKE_FLASH_YELLOW, [SPECIES_SHIINOTIC - 1] = ANIM_SHAKE_GLOW_WHITE_SLOW, - [SPECIES_SALANDIT - 1] = ANIM_SHAKE_GLOW_RED_SLOW, + [SPECIES_SALANDIT - 1] = ANIM_GLOW_RED, [SPECIES_SALAZZLE - 1] = ANIM_GROW_VIBRATE, - [SPECIES_STUFFUL - 1] = ANIM_H_STRETCH, + [SPECIES_STUFFUL - 1] = ANIM_V_SHAKE, [SPECIES_BEWEAR - 1] = ANIM_H_STRETCH, [SPECIES_BOUNSWEET - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_STEENEE - 1] = ANIM_V_SQUISH_AND_BOUNCE, @@ -2753,7 +2753,7 @@ const u8 sMonFrontAnimIdsTable[NUM_SPECIES - 1] = [SPECIES_DHELMISE - 1] = ANIM_SWING_CONVEX, [SPECIES_JANGMO_O - 1] = ANIM_H_STRETCH, [SPECIES_HAKAMO_O - 1] = ANIM_H_STRETCH, - [SPECIES_KOMMO_O - 1] = ANIM_V_SHAKE_TWICE, + [SPECIES_KOMMO_O - 1] = ANIM_GROW_STUTTER_TWICE, [SPECIES_TAPU_KOKO - 1] = ANIM_TRIANGLE_DOWN_TWICE, [SPECIES_TAPU_LELE - 1] = ANIM_V_SLIDE_WOBBLE_SMALL, [SPECIES_TAPU_BULU - 1] = ANIM_V_SHAKE_TWICE, @@ -2792,9 +2792,9 @@ const u8 sMonFrontAnimIdsTable[NUM_SPECIES - 1] = [SPECIES_INTELEON - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_SKWOVET - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_GREEDENT - 1] = ANIM_V_SQUISH_AND_BOUNCE, - [SPECIES_ROOKIDEE - 1] = ANIM_V_SQUISH_AND_BOUNCE, - [SPECIES_CORVISQUIRE - 1] = ANIM_V_SQUISH_AND_BOUNCE, - [SPECIES_CORVIKNIGHT - 1] = ANIM_V_SQUISH_AND_BOUNCE, + [SPECIES_ROOKIDEE - 1] = ANIM_H_VIBRATE, + [SPECIES_CORVISQUIRE - 1] = ANIM_CIRCLE_INTO_BG, + [SPECIES_CORVIKNIGHT - 1] = ANIM_H_VIBRATE, [SPECIES_BLIPBUG - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_DOTTLER - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_ORBEETLE - 1] = ANIM_V_SQUISH_AND_BOUNCE, @@ -2805,12 +2805,12 @@ const u8 sMonFrontAnimIdsTable[NUM_SPECIES - 1] = [SPECIES_WOOLOO - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_DUBWOOL - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_CHEWTLE - 1] = ANIM_V_SQUISH_AND_BOUNCE, - [SPECIES_DREDNAW - 1] = ANIM_V_SQUISH_AND_BOUNCE, + [SPECIES_DREDNAW - 1] = ANIM_GROW_VIBRATE, [SPECIES_YAMPER - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_BOLTUND - 1] = ANIM_V_SQUISH_AND_BOUNCE, - [SPECIES_ROLYCOLY - 1] = ANIM_V_SQUISH_AND_BOUNCE, + [SPECIES_ROLYCOLY - 1] = ANIM_H_SLIDE_SLOW, [SPECIES_CARKOL - 1] = ANIM_V_SQUISH_AND_BOUNCE, - [SPECIES_COALOSSAL - 1] = ANIM_V_SQUISH_AND_BOUNCE, + [SPECIES_COALOSSAL - 1] = ANIM_GLOW_RED, [SPECIES_APPLIN - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_FLAPPLE - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_APPLETUN - 1] = ANIM_V_SQUISH_AND_BOUNCE, @@ -2821,7 +2821,7 @@ const u8 sMonFrontAnimIdsTable[NUM_SPECIES - 1] = [SPECIES_BARRASKEWDA - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_TOXEL - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_TOXTRICITY - 1] = ANIM_V_SQUISH_AND_BOUNCE, - [SPECIES_SIZZLIPEDE - 1] = ANIM_V_SQUISH_AND_BOUNCE, + [SPECIES_SIZZLIPEDE - 1] = ANIM_H_VIBRATE, [SPECIES_CENTISKORCH - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_CLOBBOPUS - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_GRAPPLOCT - 1] = ANIM_V_SQUISH_AND_BOUNCE, @@ -2842,7 +2842,7 @@ const u8 sMonFrontAnimIdsTable[NUM_SPECIES - 1] = [SPECIES_MILCERY - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_ALCREMIE - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_FALINKS - 1] = ANIM_V_SQUISH_AND_BOUNCE, - [SPECIES_PINCURCHIN - 1] = ANIM_V_SQUISH_AND_BOUNCE, + [SPECIES_PINCURCHIN - 1] = ANIM_SHRINK_GROW_VIBRATE, [SPECIES_SNOM - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_FROSMOTH - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_STONJOURNER - 1] = ANIM_V_SQUISH_AND_BOUNCE, @@ -2877,16 +2877,20 @@ const u8 sMonFrontAnimIdsTable[NUM_SPECIES - 1] = [SPECIES_SNEASLER - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_OVERQWIL - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_ENAMORUS - 1] = ANIM_V_SQUISH_AND_BOUNCE, - [SPECIES_DEOXYS_ATTACK - 1] = ANIM_GROW_VIBRATE, - [SPECIES_DEOXYS_DEFENSE - 1] = ANIM_GROW_VIBRATE, - [SPECIES_DEOXYS_SPEED - 1] = ANIM_GROW_VIBRATE, + //Gen 3 Forms + [SPECIES_CASTFORM_SUNNY - 1] = ANIM_GROW_VIBRATE, + [SPECIES_CASTFORM_RAINY - 1] = ANIM_SWING_CONVEX_FAST, + [SPECIES_CASTFORM_SNOWY - 1] = ANIM_V_STRETCH, + [SPECIES_DEOXYS_ATTACK - 1] = ANIM_GROW_VIBRATE, + [SPECIES_DEOXYS_DEFENSE - 1] = ANIM_GROW_VIBRATE, + [SPECIES_DEOXYS_SPEED - 1] = ANIM_GROW_VIBRATE, //Gen 4 Forms [SPECIES_BURMY_SANDY_CLOAK - 1] = ANIM_V_STRETCH, [SPECIES_BURMY_TRASH_CLOAK - 1] = ANIM_V_STRETCH, [SPECIES_WORMADAM_SANDY_CLOAK - 1] = ANIM_SWING_CONVEX_FAST_SHORT, [SPECIES_WORMADAM_TRASH_CLOAK - 1] = ANIM_SWING_CONVEX_FAST_SHORT, - [SPECIES_CHERRIM_SUNSHINE - 1] = ANIM_RAPID_H_HOPS, + [SPECIES_CHERRIM_SUNSHINE - 1] = ANIM_H_JUMPS_V_STRETCH, [SPECIES_SHELLOS_EAST_SEA - 1] = ANIM_V_STRETCH, [SPECIES_GASTRODON_EAST_SEA - 1] = ANIM_CIRCULAR_STRETCH_TWICE, [SPECIES_ROTOM_HEAT - 1] = ANIM_V_SQUISH_AND_BOUNCE, @@ -3037,13 +3041,13 @@ const u8 sMonFrontAnimIdsTable[NUM_SPECIES - 1] = static const u8 sMonAnimationDelayTable[NUM_SPECIES - 1] = { - [SPECIES_BLASTOISE - 1] = 50, + [SPECIES_BLASTOISE - 1] = 20, [SPECIES_WEEDLE - 1] = 10, [SPECIES_KAKUNA - 1] = 20, - [SPECIES_BEEDRILL - 1] = 35, [SPECIES_PIDGEOTTO - 1] = 25, [SPECIES_FEAROW - 1] = 2, [SPECIES_EKANS - 1] = 30, + [SPECIES_PIKACHU - 1] = 25, [SPECIES_NIDORAN_F - 1] = 28, [SPECIES_NIDOKING - 1] = 25, [SPECIES_PARAS - 1] = 10, @@ -3055,9 +3059,10 @@ static const u8 sMonAnimationDelayTable[NUM_SPECIES - 1] = [SPECIES_PERSIAN - 1] = 20, [SPECIES_MANKEY - 1] = 20, [SPECIES_GROWLITHE - 1] = 30, - [SPECIES_ARCANINE - 1] = 40, + [SPECIES_ARCANINE - 1] = 8, [SPECIES_POLIWHIRL - 1] = 5, [SPECIES_WEEPINBELL - 1] = 3, + [SPECIES_PONYTA - 1] = 10, [SPECIES_MUK - 1] = 45, [SPECIES_SHELLDER - 1] = 20, [SPECIES_HAUNTER - 1] = 23, @@ -3501,7 +3506,7 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV, checksum = CalculateBoxMonChecksum(boxMon); SetBoxMonData(boxMon, MON_DATA_CHECKSUM, &checksum); EncryptBoxMon(boxMon); - GetSpeciesName(speciesName, species); + StringCopy(speciesName, GetSpeciesName(species)); SetBoxMonData(boxMon, MON_DATA_NICKNAME, speciesName); SetBoxMonData(boxMon, MON_DATA_LANGUAGE, &gGameLanguage); SetBoxMonData(boxMon, MON_DATA_OT_NAME, gSaveBlock2Ptr->playerName); @@ -3722,7 +3727,7 @@ void CreateMonWithEVSpread(struct Pokemon *mon, u16 species, u8 level, u8 fixedI void CreateBattleTowerMon(struct Pokemon *mon, struct BattleTowerPokemon *src) { s32 i; - u8 nickname[30]; + u8 nickname[max(32, POKEMON_NAME_BUFFER_SIZE)]; u8 language; u8 value; @@ -3776,7 +3781,7 @@ void CreateBattleTowerMon(struct Pokemon *mon, struct BattleTowerPokemon *src) void CreateBattleTowerMon_HandleLevel(struct Pokemon *mon, struct BattleTowerPokemon *src, bool8 lvl50) { s32 i; - u8 nickname[30]; + u8 nickname[max(32, POKEMON_NAME_BUFFER_SIZE)]; u8 level; u8 language; u8 value; @@ -4074,12 +4079,19 @@ static u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon) return checksum; } +#if B_FRIENDSHIP_BOOST == TRUE +#define CALC_FRIENDSHIP_BOOST() n = n + ((n * 10 * friendship) / (MAX_FRIENDSHIP * 100)); +#else +#define CALC_FRIENDSHIP_BOOST() +#endif + #define CALC_STAT(base, iv, ev, statIndex, field) \ { \ u8 baseStat = gSpeciesInfo[species].base; \ s32 n = (((2 * baseStat + iv + ev / 4) * level) / 100) + 5; \ u8 nature = GetNature(mon); \ n = ModifyStatByNature(nature, n, statIndex); \ + CALC_FRIENDSHIP_BOOST() \ SetMonData(mon, field, &n); \ } @@ -4100,6 +4112,7 @@ void CalculateMonStats(struct Pokemon *mon) s32 spDefenseIV = GetMonData(mon, MON_DATA_SPDEF_IV, NULL); s32 spDefenseEV = GetMonData(mon, MON_DATA_SPDEF_EV, NULL); u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL); + u8 friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL); s32 level = GetLevelFromMonExp(mon); s32 newMaxHP; @@ -4275,6 +4288,40 @@ void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon) } } +void GiveMonInitialMoveset_Fast(struct Pokemon *mon) +{ + GiveBoxMonInitialMoveset_Fast(&mon->box); +} + +void GiveBoxMonInitialMoveset_Fast(struct BoxPokemon *boxMon) //Credit: AsparagusEduardo +{ + u16 species = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); + s32 level = GetLevelFromBoxMonExp(boxMon); + s32 i, j; + u16 levelMoveCount = 0; + u16 moves[MAX_MON_MOVES] = {0}; + u8 addedMoves = 0; + + for (i = 0; gLevelUpLearnsets[species][i].move != LEVEL_UP_END; i++) + levelMoveCount++; + + for (i = levelMoveCount; (i >= 0 && addedMoves < MAX_MON_MOVES); i--) + { + if (gLevelUpLearnsets[species][i].level > level) + continue; + if (gLevelUpLearnsets[species][i].level == 0) + continue; + + if (moves[addedMoves] != gLevelUpLearnsets[species][i].move) + moves[addedMoves++] = gLevelUpLearnsets[species][i].move; + } + for (i = MAX_MON_MOVES - 1; i >= 0; i--) + { + SetBoxMonData(boxMon, MON_DATA_MOVE1 + i, &moves[i]); + SetBoxMonData(boxMon, MON_DATA_PP1 + i, &gBattleMoves[moves[i]].pp); + } +} + u16 MonTryLearningNewMove(struct Pokemon *mon, bool8 firstMove) { u32 retVal = MOVE_NONE; @@ -4361,38 +4408,24 @@ void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move) SetBoxMonData(boxMon, MON_DATA_PP_BONUSES, &ppBonuses); } -u8 CountAliveMonsInBattle(u8 caseId) +u8 CountAliveMonsInBattle(u8 caseId, u32 battler) { s32 i; u8 retVal = 0; switch (caseId) { - case BATTLE_ALIVE_EXCEPT_ACTIVE: + case BATTLE_ALIVE_EXCEPT_BATTLER: for (i = 0; i < MAX_BATTLERS_COUNT; i++) { - if (i != gActiveBattler && !(gAbsentBattlerFlags & gBitTable[i])) + if (i != battler && !(gAbsentBattlerFlags & gBitTable[i])) retVal++; } break; - case BATTLE_ALIVE_ATK_SIDE: + case BATTLE_ALIVE_SIDE: for (i = 0; i < MAX_BATTLERS_COUNT; i++) { - if (GetBattlerSide(i) == GetBattlerSide(gBattlerAttacker) && !(gAbsentBattlerFlags & gBitTable[i])) - retVal++; - } - break; - case BATTLE_ALIVE_DEF_SIDE: - for (i = 0; i < MAX_BATTLERS_COUNT; i++) - { - if (GetBattlerSide(i) == GetBattlerSide(gBattlerTarget) && !(gAbsentBattlerFlags & gBitTable[i])) - retVal++; - } - break; - case BATTLE_ALIVE_EXCEPT_ATTACKER: - for (i = 0; i < MAX_BATTLERS_COUNT; i++) - { - if (i != gBattlerAttacker && !(gAbsentBattlerFlags & gBitTable[i])) + if (GetBattlerSide(i) == GetBattlerSide(battler) && !(gAbsentBattlerFlags & gBitTable[i])) retVal++; } break; @@ -4403,11 +4436,11 @@ u8 CountAliveMonsInBattle(u8 caseId) u8 GetDefaultMoveTarget(u8 battlerId) { - u8 opposing = BATTLE_OPPOSITE(GET_BATTLER_SIDE(battlerId)); + u8 opposing = BATTLE_OPPOSITE(GetBattlerSide(battlerId)); if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) return GetBattlerAtPosition(opposing); - if (CountAliveMonsInBattle(BATTLE_ALIVE_EXCEPT_ACTIVE) > 1) + if (CountAliveMonsInBattle(BATTLE_ALIVE_EXCEPT_BATTLER, battlerId) > 1) { u8 position; @@ -4467,6 +4500,11 @@ u8 GetGenderFromSpeciesAndPersonality(u16 species, u32 personality) return MON_MALE; } +bool32 IsPersonalityFemale(u16 species, u32 personality) +{ + return GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE; +} + u32 GetUnownSpeciesId(u32 personality) { u16 unownLetter = GetUnownLetterByPersonality(personality); @@ -4491,9 +4529,19 @@ void SetMultiuseSpriteTemplateToPokemon(u16 speciesTag, u8 battlerPosition) if (battlerPosition == B_POSITION_PLAYER_LEFT || battlerPosition == B_POSITION_PLAYER_RIGHT) gMultiuseSpriteTemplate.anims = gAnims_MonPic; else if (speciesTag > SPECIES_SHINY_TAG) - gMultiuseSpriteTemplate.anims = gMonFrontAnimsPtrTable[speciesTag - SPECIES_SHINY_TAG]; + { + if (gMonFrontAnimsPtrTable[speciesTag - SPECIES_SHINY_TAG] != NULL) + gMultiuseSpriteTemplate.anims = gMonFrontAnimsPtrTable[speciesTag - SPECIES_SHINY_TAG]; + else + gMultiuseSpriteTemplate.anims = gMonFrontAnimsPtrTable[SPECIES_NONE]; + } else - gMultiuseSpriteTemplate.anims = gMonFrontAnimsPtrTable[speciesTag]; + { + if (gMonFrontAnimsPtrTable[speciesTag] != NULL) + gMultiuseSpriteTemplate.anims = gMonFrontAnimsPtrTable[speciesTag]; + else + gMultiuseSpriteTemplate.anims = gMonFrontAnimsPtrTable[SPECIES_NONE]; + } } void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerPicId, u8 battlerPosition) @@ -4720,329 +4768,337 @@ u32 GetBoxMonData3(struct BoxPokemon *boxMon, s32 field, u8 *data) boxMon->isEgg = TRUE; substruct3->isEgg = TRUE; } - } - switch (field) - { - case MON_DATA_PERSONALITY: - retVal = boxMon->personality; - break; - case MON_DATA_OT_ID: - retVal = boxMon->otId; - break; - case MON_DATA_NICKNAME: - { - if (boxMon->isBadEgg) + switch (field) { - for (retVal = 0; - retVal < POKEMON_NAME_LENGTH && gText_BadEgg[retVal] != EOS; - data[retVal] = gText_BadEgg[retVal], retVal++) {} + case MON_DATA_SPECIES: + retVal = boxMon->isBadEgg ? SPECIES_EGG : substruct0->species; + break; + case MON_DATA_HELD_ITEM: + retVal = substruct0->heldItem; + break; + case MON_DATA_EXP: + retVal = substruct0->experience; + break; + case MON_DATA_PP_BONUSES: + retVal = substruct0->ppBonuses; + break; + case MON_DATA_FRIENDSHIP: + retVal = substruct0->friendship; + break; + case MON_DATA_MOVE1: + case MON_DATA_MOVE2: + case MON_DATA_MOVE3: + case MON_DATA_MOVE4: + retVal = substruct1->moves[field - MON_DATA_MOVE1]; + break; + case MON_DATA_PP1: + case MON_DATA_PP2: + case MON_DATA_PP3: + case MON_DATA_PP4: + retVal = substruct1->pp[field - MON_DATA_PP1]; + break; + case MON_DATA_HP_EV: + retVal = substruct2->hpEV; + break; + case MON_DATA_ATK_EV: + retVal = substruct2->attackEV; + break; + case MON_DATA_DEF_EV: + retVal = substruct2->defenseEV; + break; + case MON_DATA_SPEED_EV: + retVal = substruct2->speedEV; + break; + case MON_DATA_SPATK_EV: + retVal = substruct2->spAttackEV; + break; + case MON_DATA_SPDEF_EV: + retVal = substruct2->spDefenseEV; + break; + case MON_DATA_COOL: + retVal = substruct2->cool; + break; + case MON_DATA_BEAUTY: + retVal = substruct2->beauty; + break; + case MON_DATA_CUTE: + retVal = substruct2->cute; + break; + case MON_DATA_SMART: + retVal = substruct2->smart; + break; + case MON_DATA_TOUGH: + retVal = substruct2->tough; + break; + case MON_DATA_SHEEN: + retVal = substruct2->sheen; + break; + case MON_DATA_POKERUS: + retVal = substruct3->pokerus; + break; + case MON_DATA_MET_LOCATION: + retVal = substruct3->metLocation; + break; + case MON_DATA_MET_LEVEL: + retVal = substruct3->metLevel; + break; + case MON_DATA_MET_GAME: + retVal = substruct3->metGame; + break; + case MON_DATA_POKEBALL: + retVal = substruct0->pokeball; + break; + case MON_DATA_OT_GENDER: + retVal = substruct3->otGender; + break; + case MON_DATA_HP_IV: + retVal = substruct3->hpIV; + break; + case MON_DATA_ATK_IV: + retVal = substruct3->attackIV; + break; + case MON_DATA_DEF_IV: + retVal = substruct3->defenseIV; + break; + case MON_DATA_SPEED_IV: + retVal = substruct3->speedIV; + break; + case MON_DATA_SPATK_IV: + retVal = substruct3->spAttackIV; + break; + case MON_DATA_SPDEF_IV: + retVal = substruct3->spDefenseIV; + break; + case MON_DATA_IS_EGG: + retVal = substruct3->isEgg; + break; + case MON_DATA_ABILITY_NUM: + retVal = substruct3->abilityNum; + break; + case MON_DATA_COOL_RIBBON: + retVal = substruct3->coolRibbon; + break; + case MON_DATA_BEAUTY_RIBBON: + retVal = substruct3->beautyRibbon; + break; + case MON_DATA_CUTE_RIBBON: + retVal = substruct3->cuteRibbon; + break; + case MON_DATA_SMART_RIBBON: + retVal = substruct3->smartRibbon; + break; + case MON_DATA_TOUGH_RIBBON: + retVal = substruct3->toughRibbon; + break; + case MON_DATA_CHAMPION_RIBBON: + retVal = substruct3->championRibbon; + break; + case MON_DATA_WINNING_RIBBON: + retVal = substruct3->winningRibbon; + break; + case MON_DATA_VICTORY_RIBBON: + retVal = substruct3->victoryRibbon; + break; + case MON_DATA_ARTIST_RIBBON: + retVal = substruct3->artistRibbon; + break; + case MON_DATA_EFFORT_RIBBON: + retVal = substruct3->effortRibbon; + break; + case MON_DATA_MARINE_RIBBON: + retVal = substruct3->marineRibbon; + break; + case MON_DATA_LAND_RIBBON: + retVal = substruct3->landRibbon; + break; + case MON_DATA_SKY_RIBBON: + retVal = substruct3->skyRibbon; + break; + case MON_DATA_COUNTRY_RIBBON: + retVal = substruct3->countryRibbon; + break; + case MON_DATA_NATIONAL_RIBBON: + retVal = substruct3->nationalRibbon; + break; + case MON_DATA_EARTH_RIBBON: + retVal = substruct3->earthRibbon; + break; + case MON_DATA_WORLD_RIBBON: + retVal = substruct3->worldRibbon; + break; + case MON_DATA_UNUSED_RIBBONS: + retVal = substruct3->unusedRibbons; + break; + case MON_DATA_MODERN_FATEFUL_ENCOUNTER: + retVal = substruct3->modernFatefulEncounter; + break; + case MON_DATA_SPECIES_OR_EGG: + retVal = substruct0->species; + if (substruct0->species && (substruct3->isEgg || boxMon->isBadEgg)) + retVal = SPECIES_EGG; + break; + case MON_DATA_IVS: + retVal = substruct3->hpIV + | (substruct3->attackIV << 5) + | (substruct3->defenseIV << 10) + | (substruct3->speedIV << 15) + | (substruct3->spAttackIV << 20) + | (substruct3->spDefenseIV << 25); + break; + case MON_DATA_KNOWN_MOVES: + if (substruct0->species && !substruct3->isEgg) + { + u16 *moves = (u16 *)data; + s32 i = 0; - data[retVal] = EOS; + while (moves[i] != MOVES_COUNT) + { + u16 move = moves[i]; + if (substruct1->moves[0] == move + || substruct1->moves[1] == move + || substruct1->moves[2] == move + || substruct1->moves[3] == move) + retVal |= gBitTable[i]; + i++; + } + } + break; + case MON_DATA_RIBBON_COUNT: + retVal = 0; + if (substruct0->species && !substruct3->isEgg) + { + retVal += substruct3->coolRibbon; + retVal += substruct3->beautyRibbon; + retVal += substruct3->cuteRibbon; + retVal += substruct3->smartRibbon; + retVal += substruct3->toughRibbon; + retVal += substruct3->championRibbon; + retVal += substruct3->winningRibbon; + retVal += substruct3->victoryRibbon; + retVal += substruct3->artistRibbon; + retVal += substruct3->effortRibbon; + retVal += substruct3->marineRibbon; + retVal += substruct3->landRibbon; + retVal += substruct3->skyRibbon; + retVal += substruct3->countryRibbon; + retVal += substruct3->nationalRibbon; + retVal += substruct3->earthRibbon; + retVal += substruct3->worldRibbon; + } + break; + case MON_DATA_RIBBONS: + retVal = 0; + if (substruct0->species && !substruct3->isEgg) + { + retVal = substruct3->championRibbon + | (substruct3->coolRibbon << 1) + | (substruct3->beautyRibbon << 4) + | (substruct3->cuteRibbon << 7) + | (substruct3->smartRibbon << 10) + | (substruct3->toughRibbon << 13) + | (substruct3->winningRibbon << 16) + | (substruct3->victoryRibbon << 17) + | (substruct3->artistRibbon << 18) + | (substruct3->effortRibbon << 19) + | (substruct3->marineRibbon << 20) + | (substruct3->landRibbon << 21) + | (substruct3->skyRibbon << 22) + | (substruct3->countryRibbon << 23) + | (substruct3->nationalRibbon << 24) + | (substruct3->earthRibbon << 25) + | (substruct3->worldRibbon << 26); + } + break; + default: + break; } - else if (boxMon->isEgg) + } + else + { + switch (field) { - StringCopy(data, gText_EggNickname); - retVal = StringLength(data); - } - else if (boxMon->language == LANGUAGE_JAPANESE) + case MON_DATA_PERSONALITY: + retVal = boxMon->personality; + break; + case MON_DATA_OT_ID: + retVal = boxMon->otId; + break; + case MON_DATA_NICKNAME: { - data[0] = EXT_CTRL_CODE_BEGIN; - data[1] = EXT_CTRL_CODE_JPN; + if (boxMon->isBadEgg) + { + for (retVal = 0; + retVal < POKEMON_NAME_LENGTH && gText_BadEgg[retVal] != EOS; + data[retVal] = gText_BadEgg[retVal], retVal++) {} - for (retVal = 2, i = 0; - i < 5 && boxMon->nickname[i] != EOS; - data[retVal] = boxMon->nickname[i], retVal++, i++) {} + data[retVal] = EOS; + } + else if (boxMon->isEgg) + { + StringCopy(data, gText_EggNickname); + retVal = StringLength(data); + } + else if (boxMon->language == LANGUAGE_JAPANESE) + { + data[0] = EXT_CTRL_CODE_BEGIN; + data[1] = EXT_CTRL_CODE_JPN; - data[retVal++] = EXT_CTRL_CODE_BEGIN; - data[retVal++] = EXT_CTRL_CODE_ENG; - data[retVal] = EOS; - } - else - { - for (retVal = 0; - retVal < POKEMON_NAME_LENGTH; - data[retVal] = boxMon->nickname[retVal], retVal++){} + for (retVal = 2, i = 0; + i < 5 && boxMon->nickname[i] != EOS; + data[retVal] = boxMon->nickname[i], retVal++, i++) {} - data[retVal] = EOS; - } - break; - } - case MON_DATA_LANGUAGE: - retVal = boxMon->language; - break; - case MON_DATA_SANITY_IS_BAD_EGG: - retVal = boxMon->isBadEgg; - break; - case MON_DATA_SANITY_HAS_SPECIES: - retVal = boxMon->hasSpecies; - break; - case MON_DATA_SANITY_IS_EGG: - retVal = boxMon->isEgg; - break; - case MON_DATA_OT_NAME: - { - retVal = 0; + data[retVal++] = EXT_CTRL_CODE_BEGIN; + data[retVal++] = EXT_CTRL_CODE_ENG; + data[retVal] = EOS; + } + else + { + for (retVal = 0; + retVal < POKEMON_NAME_LENGTH; + data[retVal] = boxMon->nickname[retVal], retVal++){} - while (retVal < PLAYER_NAME_LENGTH) - { - data[retVal] = boxMon->otName[retVal]; - retVal++; + data[retVal] = EOS; + } + break; } - - data[retVal] = EOS; - break; - } - case MON_DATA_MARKINGS: - retVal = boxMon->markings; - break; - case MON_DATA_CHECKSUM: - retVal = boxMon->checksum; - break; - case MON_DATA_ENCRYPT_SEPARATOR: - retVal = boxMon->unknown; - break; - case MON_DATA_SPECIES: - retVal = boxMon->isBadEgg ? SPECIES_EGG : substruct0->species; - break; - case MON_DATA_HELD_ITEM: - retVal = substruct0->heldItem; - break; - case MON_DATA_EXP: - retVal = substruct0->experience; - break; - case MON_DATA_PP_BONUSES: - retVal = substruct0->ppBonuses; - break; - case MON_DATA_FRIENDSHIP: - retVal = substruct0->friendship; - break; - case MON_DATA_MOVE1: - case MON_DATA_MOVE2: - case MON_DATA_MOVE3: - case MON_DATA_MOVE4: - retVal = substruct1->moves[field - MON_DATA_MOVE1]; - break; - case MON_DATA_PP1: - case MON_DATA_PP2: - case MON_DATA_PP3: - case MON_DATA_PP4: - retVal = substruct1->pp[field - MON_DATA_PP1]; - break; - case MON_DATA_HP_EV: - retVal = substruct2->hpEV; - break; - case MON_DATA_ATK_EV: - retVal = substruct2->attackEV; - break; - case MON_DATA_DEF_EV: - retVal = substruct2->defenseEV; - break; - case MON_DATA_SPEED_EV: - retVal = substruct2->speedEV; - break; - case MON_DATA_SPATK_EV: - retVal = substruct2->spAttackEV; - break; - case MON_DATA_SPDEF_EV: - retVal = substruct2->spDefenseEV; - break; - case MON_DATA_COOL: - retVal = substruct2->cool; - break; - case MON_DATA_BEAUTY: - retVal = substruct2->beauty; - break; - case MON_DATA_CUTE: - retVal = substruct2->cute; - break; - case MON_DATA_SMART: - retVal = substruct2->smart; - break; - case MON_DATA_TOUGH: - retVal = substruct2->tough; - break; - case MON_DATA_SHEEN: - retVal = substruct2->sheen; - break; - case MON_DATA_POKERUS: - retVal = substruct3->pokerus; - break; - case MON_DATA_MET_LOCATION: - retVal = substruct3->metLocation; - break; - case MON_DATA_MET_LEVEL: - retVal = substruct3->metLevel; - break; - case MON_DATA_MET_GAME: - retVal = substruct3->metGame; - break; - case MON_DATA_POKEBALL: - retVal = substruct0->pokeball; - break; - case MON_DATA_OT_GENDER: - retVal = substruct3->otGender; - break; - case MON_DATA_HP_IV: - retVal = substruct3->hpIV; - break; - case MON_DATA_ATK_IV: - retVal = substruct3->attackIV; - break; - case MON_DATA_DEF_IV: - retVal = substruct3->defenseIV; - break; - case MON_DATA_SPEED_IV: - retVal = substruct3->speedIV; - break; - case MON_DATA_SPATK_IV: - retVal = substruct3->spAttackIV; - break; - case MON_DATA_SPDEF_IV: - retVal = substruct3->spDefenseIV; - break; - case MON_DATA_IS_EGG: - retVal = substruct3->isEgg; - break; - case MON_DATA_ABILITY_NUM: - retVal = substruct3->abilityNum; - break; - case MON_DATA_COOL_RIBBON: - retVal = substruct3->coolRibbon; - break; - case MON_DATA_BEAUTY_RIBBON: - retVal = substruct3->beautyRibbon; - break; - case MON_DATA_CUTE_RIBBON: - retVal = substruct3->cuteRibbon; - break; - case MON_DATA_SMART_RIBBON: - retVal = substruct3->smartRibbon; - break; - case MON_DATA_TOUGH_RIBBON: - retVal = substruct3->toughRibbon; - break; - case MON_DATA_CHAMPION_RIBBON: - retVal = substruct3->championRibbon; - break; - case MON_DATA_WINNING_RIBBON: - retVal = substruct3->winningRibbon; - break; - case MON_DATA_VICTORY_RIBBON: - retVal = substruct3->victoryRibbon; - break; - case MON_DATA_ARTIST_RIBBON: - retVal = substruct3->artistRibbon; - break; - case MON_DATA_EFFORT_RIBBON: - retVal = substruct3->effortRibbon; - break; - case MON_DATA_MARINE_RIBBON: - retVal = substruct3->marineRibbon; - break; - case MON_DATA_LAND_RIBBON: - retVal = substruct3->landRibbon; - break; - case MON_DATA_SKY_RIBBON: - retVal = substruct3->skyRibbon; - break; - case MON_DATA_COUNTRY_RIBBON: - retVal = substruct3->countryRibbon; - break; - case MON_DATA_NATIONAL_RIBBON: - retVal = substruct3->nationalRibbon; - break; - case MON_DATA_EARTH_RIBBON: - retVal = substruct3->earthRibbon; - break; - case MON_DATA_WORLD_RIBBON: - retVal = substruct3->worldRibbon; - break; - case MON_DATA_UNUSED_RIBBONS: - retVal = substruct3->unusedRibbons; - break; - case MON_DATA_MODERN_FATEFUL_ENCOUNTER: - retVal = substruct3->modernFatefulEncounter; - break; - case MON_DATA_SPECIES_OR_EGG: - retVal = substruct0->species; - if (substruct0->species && (substruct3->isEgg || boxMon->isBadEgg)) - retVal = SPECIES_EGG; - break; - case MON_DATA_IVS: - retVal = substruct3->hpIV - | (substruct3->attackIV << 5) - | (substruct3->defenseIV << 10) - | (substruct3->speedIV << 15) - | (substruct3->spAttackIV << 20) - | (substruct3->spDefenseIV << 25); - break; - case MON_DATA_KNOWN_MOVES: - if (substruct0->species && !substruct3->isEgg) + case MON_DATA_LANGUAGE: + retVal = boxMon->language; + break; + case MON_DATA_SANITY_IS_BAD_EGG: + retVal = boxMon->isBadEgg; + break; + case MON_DATA_SANITY_HAS_SPECIES: + retVal = boxMon->hasSpecies; + break; + case MON_DATA_SANITY_IS_EGG: + retVal = boxMon->isEgg; + break; + case MON_DATA_OT_NAME: { - u16 *moves = (u16 *)data; - s32 i = 0; + retVal = 0; - while (moves[i] != MOVES_COUNT) + while (retVal < PLAYER_NAME_LENGTH) { - u16 move = moves[i]; - if (substruct1->moves[0] == move - || substruct1->moves[1] == move - || substruct1->moves[2] == move - || substruct1->moves[3] == move) - retVal |= gBitTable[i]; - i++; + data[retVal] = boxMon->otName[retVal]; + retVal++; } + + data[retVal] = EOS; + break; } - break; - case MON_DATA_RIBBON_COUNT: - retVal = 0; - if (substruct0->species && !substruct3->isEgg) - { - retVal += substruct3->coolRibbon; - retVal += substruct3->beautyRibbon; - retVal += substruct3->cuteRibbon; - retVal += substruct3->smartRibbon; - retVal += substruct3->toughRibbon; - retVal += substruct3->championRibbon; - retVal += substruct3->winningRibbon; - retVal += substruct3->victoryRibbon; - retVal += substruct3->artistRibbon; - retVal += substruct3->effortRibbon; - retVal += substruct3->marineRibbon; - retVal += substruct3->landRibbon; - retVal += substruct3->skyRibbon; - retVal += substruct3->countryRibbon; - retVal += substruct3->nationalRibbon; - retVal += substruct3->earthRibbon; - retVal += substruct3->worldRibbon; - } - break; - case MON_DATA_RIBBONS: - retVal = 0; - if (substruct0->species && !substruct3->isEgg) - { - retVal = substruct3->championRibbon - | (substruct3->coolRibbon << 1) - | (substruct3->beautyRibbon << 4) - | (substruct3->cuteRibbon << 7) - | (substruct3->smartRibbon << 10) - | (substruct3->toughRibbon << 13) - | (substruct3->winningRibbon << 16) - | (substruct3->victoryRibbon << 17) - | (substruct3->artistRibbon << 18) - | (substruct3->effortRibbon << 19) - | (substruct3->marineRibbon << 20) - | (substruct3->landRibbon << 21) - | (substruct3->skyRibbon << 22) - | (substruct3->countryRibbon << 23) - | (substruct3->nationalRibbon << 24) - | (substruct3->earthRibbon << 25) - | (substruct3->worldRibbon << 26); + case MON_DATA_MARKINGS: + retVal = boxMon->markings; + break; + case MON_DATA_CHECKSUM: + retVal = boxMon->checksum; + break; + case MON_DATA_ENCRYPT_SEPARATOR: + retVal = boxMon->unknown; + break; + default: + break; } - break; - default: - break; } if (field > MON_DATA_ENCRYPT_SEPARATOR) @@ -5127,242 +5183,248 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg) EncryptBoxMon(boxMon); return; } - } - switch (field) - { - case MON_DATA_PERSONALITY: - SET32(boxMon->personality); - break; - case MON_DATA_OT_ID: - SET32(boxMon->otId); - break; - case MON_DATA_NICKNAME: - { - s32 i; - for (i = 0; i < POKEMON_NAME_LENGTH; i++) - boxMon->nickname[i] = data[i]; - break; - } - case MON_DATA_LANGUAGE: - SET8(boxMon->language); - break; - case MON_DATA_SANITY_IS_BAD_EGG: - SET8(boxMon->isBadEgg); - break; - case MON_DATA_SANITY_HAS_SPECIES: - SET8(boxMon->hasSpecies); - break; - case MON_DATA_SANITY_IS_EGG: - SET8(boxMon->isEgg); - break; - case MON_DATA_OT_NAME: - { - s32 i; - for (i = 0; i < PLAYER_NAME_LENGTH; i++) - boxMon->otName[i] = data[i]; - break; - } - case MON_DATA_MARKINGS: - SET8(boxMon->markings); - break; - case MON_DATA_CHECKSUM: - SET16(boxMon->checksum); - break; - case MON_DATA_ENCRYPT_SEPARATOR: - SET16(boxMon->unknown); - break; - case MON_DATA_SPECIES: - { - SET16(substruct0->species); - if (substruct0->species) - boxMon->hasSpecies = TRUE; - else - boxMon->hasSpecies = FALSE; - break; - } - case MON_DATA_HELD_ITEM: - SET16(substruct0->heldItem); - break; - case MON_DATA_EXP: - SET32(substruct0->experience); - break; - case MON_DATA_PP_BONUSES: - SET8(substruct0->ppBonuses); - break; - case MON_DATA_FRIENDSHIP: - SET8(substruct0->friendship); - break; - case MON_DATA_MOVE1: - case MON_DATA_MOVE2: - case MON_DATA_MOVE3: - case MON_DATA_MOVE4: - SET16(substruct1->moves[field - MON_DATA_MOVE1]); - break; - case MON_DATA_PP1: - case MON_DATA_PP2: - case MON_DATA_PP3: - case MON_DATA_PP4: - SET8(substruct1->pp[field - MON_DATA_PP1]); - break; - case MON_DATA_HP_EV: - SET8(substruct2->hpEV); - break; - case MON_DATA_ATK_EV: - SET8(substruct2->attackEV); - break; - case MON_DATA_DEF_EV: - SET8(substruct2->defenseEV); - break; - case MON_DATA_SPEED_EV: - SET8(substruct2->speedEV); - break; - case MON_DATA_SPATK_EV: - SET8(substruct2->spAttackEV); - break; - case MON_DATA_SPDEF_EV: - SET8(substruct2->spDefenseEV); - break; - case MON_DATA_COOL: - SET8(substruct2->cool); - break; - case MON_DATA_BEAUTY: - SET8(substruct2->beauty); - break; - case MON_DATA_CUTE: - SET8(substruct2->cute); - break; - case MON_DATA_SMART: - SET8(substruct2->smart); - break; - case MON_DATA_TOUGH: - SET8(substruct2->tough); - break; - case MON_DATA_SHEEN: - SET8(substruct2->sheen); - break; - case MON_DATA_POKERUS: - SET8(substruct3->pokerus); - break; - case MON_DATA_MET_LOCATION: - SET8(substruct3->metLocation); - break; - case MON_DATA_MET_LEVEL: - { - u8 metLevel = *data; - substruct3->metLevel = metLevel; - break; + switch (field) + { + case MON_DATA_SPECIES: + { + SET16(substruct0->species); + if (substruct0->species) + boxMon->hasSpecies = TRUE; + else + boxMon->hasSpecies = FALSE; + break; + } + case MON_DATA_HELD_ITEM: + SET16(substruct0->heldItem); + break; + case MON_DATA_EXP: + SET32(substruct0->experience); + break; + case MON_DATA_PP_BONUSES: + SET8(substruct0->ppBonuses); + break; + case MON_DATA_FRIENDSHIP: + SET8(substruct0->friendship); + break; + case MON_DATA_MOVE1: + case MON_DATA_MOVE2: + case MON_DATA_MOVE3: + case MON_DATA_MOVE4: + SET16(substruct1->moves[field - MON_DATA_MOVE1]); + break; + case MON_DATA_PP1: + case MON_DATA_PP2: + case MON_DATA_PP3: + case MON_DATA_PP4: + SET8(substruct1->pp[field - MON_DATA_PP1]); + break; + case MON_DATA_HP_EV: + SET8(substruct2->hpEV); + break; + case MON_DATA_ATK_EV: + SET8(substruct2->attackEV); + break; + case MON_DATA_DEF_EV: + SET8(substruct2->defenseEV); + break; + case MON_DATA_SPEED_EV: + SET8(substruct2->speedEV); + break; + case MON_DATA_SPATK_EV: + SET8(substruct2->spAttackEV); + break; + case MON_DATA_SPDEF_EV: + SET8(substruct2->spDefenseEV); + break; + case MON_DATA_COOL: + SET8(substruct2->cool); + break; + case MON_DATA_BEAUTY: + SET8(substruct2->beauty); + break; + case MON_DATA_CUTE: + SET8(substruct2->cute); + break; + case MON_DATA_SMART: + SET8(substruct2->smart); + break; + case MON_DATA_TOUGH: + SET8(substruct2->tough); + break; + case MON_DATA_SHEEN: + SET8(substruct2->sheen); + break; + case MON_DATA_POKERUS: + SET8(substruct3->pokerus); + break; + case MON_DATA_MET_LOCATION: + SET8(substruct3->metLocation); + break; + case MON_DATA_MET_LEVEL: + { + u8 metLevel = *data; + substruct3->metLevel = metLevel; + break; + } + case MON_DATA_MET_GAME: + SET8(substruct3->metGame); + break; + case MON_DATA_POKEBALL: + { + u8 pokeball = *data; + substruct0->pokeball = pokeball; + break; + } + case MON_DATA_OT_GENDER: + SET8(substruct3->otGender); + break; + case MON_DATA_HP_IV: + SET8(substruct3->hpIV); + break; + case MON_DATA_ATK_IV: + SET8(substruct3->attackIV); + break; + case MON_DATA_DEF_IV: + SET8(substruct3->defenseIV); + break; + case MON_DATA_SPEED_IV: + SET8(substruct3->speedIV); + break; + case MON_DATA_SPATK_IV: + SET8(substruct3->spAttackIV); + break; + case MON_DATA_SPDEF_IV: + SET8(substruct3->spDefenseIV); + break; + case MON_DATA_IS_EGG: + SET8(substruct3->isEgg); + if (substruct3->isEgg) + boxMon->isEgg = TRUE; + else + boxMon->isEgg = FALSE; + break; + case MON_DATA_ABILITY_NUM: + SET8(substruct3->abilityNum); + break; + case MON_DATA_COOL_RIBBON: + SET8(substruct3->coolRibbon); + break; + case MON_DATA_BEAUTY_RIBBON: + SET8(substruct3->beautyRibbon); + break; + case MON_DATA_CUTE_RIBBON: + SET8(substruct3->cuteRibbon); + break; + case MON_DATA_SMART_RIBBON: + SET8(substruct3->smartRibbon); + break; + case MON_DATA_TOUGH_RIBBON: + SET8(substruct3->toughRibbon); + break; + case MON_DATA_CHAMPION_RIBBON: + SET8(substruct3->championRibbon); + break; + case MON_DATA_WINNING_RIBBON: + SET8(substruct3->winningRibbon); + break; + case MON_DATA_VICTORY_RIBBON: + SET8(substruct3->victoryRibbon); + break; + case MON_DATA_ARTIST_RIBBON: + SET8(substruct3->artistRibbon); + break; + case MON_DATA_EFFORT_RIBBON: + SET8(substruct3->effortRibbon); + break; + case MON_DATA_MARINE_RIBBON: + SET8(substruct3->marineRibbon); + break; + case MON_DATA_LAND_RIBBON: + SET8(substruct3->landRibbon); + break; + case MON_DATA_SKY_RIBBON: + SET8(substruct3->skyRibbon); + break; + case MON_DATA_COUNTRY_RIBBON: + SET8(substruct3->countryRibbon); + break; + case MON_DATA_NATIONAL_RIBBON: + SET8(substruct3->nationalRibbon); + break; + case MON_DATA_EARTH_RIBBON: + SET8(substruct3->earthRibbon); + break; + case MON_DATA_WORLD_RIBBON: + SET8(substruct3->worldRibbon); + break; + case MON_DATA_UNUSED_RIBBONS: + SET8(substruct3->unusedRibbons); + break; + case MON_DATA_MODERN_FATEFUL_ENCOUNTER: + SET8(substruct3->modernFatefulEncounter); + break; + case MON_DATA_IVS: + { + u32 ivs = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); + substruct3->hpIV = ivs & MAX_IV_MASK; + substruct3->attackIV = (ivs >> 5) & MAX_IV_MASK; + substruct3->defenseIV = (ivs >> 10) & MAX_IV_MASK; + substruct3->speedIV = (ivs >> 15) & MAX_IV_MASK; + substruct3->spAttackIV = (ivs >> 20) & MAX_IV_MASK; + substruct3->spDefenseIV = (ivs >> 25) & MAX_IV_MASK; + break; + } + default: + break; + } } - case MON_DATA_MET_GAME: - SET8(substruct3->metGame); - break; - case MON_DATA_POKEBALL: + else { - u8 pokeball = *data; - substruct0->pokeball = pokeball; - break; - } - case MON_DATA_OT_GENDER: - SET8(substruct3->otGender); - break; - case MON_DATA_HP_IV: - SET8(substruct3->hpIV); - break; - case MON_DATA_ATK_IV: - SET8(substruct3->attackIV); - break; - case MON_DATA_DEF_IV: - SET8(substruct3->defenseIV); - break; - case MON_DATA_SPEED_IV: - SET8(substruct3->speedIV); - break; - case MON_DATA_SPATK_IV: - SET8(substruct3->spAttackIV); - break; - case MON_DATA_SPDEF_IV: - SET8(substruct3->spDefenseIV); - break; - case MON_DATA_IS_EGG: - SET8(substruct3->isEgg); - if (substruct3->isEgg) - boxMon->isEgg = TRUE; - else - boxMon->isEgg = FALSE; - break; - case MON_DATA_ABILITY_NUM: - SET8(substruct3->abilityNum); - break; - case MON_DATA_COOL_RIBBON: - SET8(substruct3->coolRibbon); - break; - case MON_DATA_BEAUTY_RIBBON: - SET8(substruct3->beautyRibbon); - break; - case MON_DATA_CUTE_RIBBON: - SET8(substruct3->cuteRibbon); - break; - case MON_DATA_SMART_RIBBON: - SET8(substruct3->smartRibbon); - break; - case MON_DATA_TOUGH_RIBBON: - SET8(substruct3->toughRibbon); - break; - case MON_DATA_CHAMPION_RIBBON: - SET8(substruct3->championRibbon); - break; - case MON_DATA_WINNING_RIBBON: - SET8(substruct3->winningRibbon); - break; - case MON_DATA_VICTORY_RIBBON: - SET8(substruct3->victoryRibbon); - break; - case MON_DATA_ARTIST_RIBBON: - SET8(substruct3->artistRibbon); - break; - case MON_DATA_EFFORT_RIBBON: - SET8(substruct3->effortRibbon); - break; - case MON_DATA_MARINE_RIBBON: - SET8(substruct3->marineRibbon); - break; - case MON_DATA_LAND_RIBBON: - SET8(substruct3->landRibbon); - break; - case MON_DATA_SKY_RIBBON: - SET8(substruct3->skyRibbon); - break; - case MON_DATA_COUNTRY_RIBBON: - SET8(substruct3->countryRibbon); - break; - case MON_DATA_NATIONAL_RIBBON: - SET8(substruct3->nationalRibbon); - break; - case MON_DATA_EARTH_RIBBON: - SET8(substruct3->earthRibbon); - break; - case MON_DATA_WORLD_RIBBON: - SET8(substruct3->worldRibbon); - break; - case MON_DATA_UNUSED_RIBBONS: - SET8(substruct3->unusedRibbons); - break; - case MON_DATA_MODERN_FATEFUL_ENCOUNTER: - SET8(substruct3->modernFatefulEncounter); - break; - case MON_DATA_IVS: - { - u32 ivs = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); - substruct3->hpIV = ivs & MAX_IV_MASK; - substruct3->attackIV = (ivs >> 5) & MAX_IV_MASK; - substruct3->defenseIV = (ivs >> 10) & MAX_IV_MASK; - substruct3->speedIV = (ivs >> 15) & MAX_IV_MASK; - substruct3->spAttackIV = (ivs >> 20) & MAX_IV_MASK; - substruct3->spDefenseIV = (ivs >> 25) & MAX_IV_MASK; - break; - } - default: - break; + switch (field) + { + case MON_DATA_PERSONALITY: + SET32(boxMon->personality); + break; + case MON_DATA_OT_ID: + SET32(boxMon->otId); + break; + case MON_DATA_NICKNAME: + { + s32 i; + for (i = 0; i < POKEMON_NAME_LENGTH; i++) + boxMon->nickname[i] = data[i]; + break; + } + case MON_DATA_LANGUAGE: + SET8(boxMon->language); + break; + case MON_DATA_SANITY_IS_BAD_EGG: + SET8(boxMon->isBadEgg); + break; + case MON_DATA_SANITY_HAS_SPECIES: + SET8(boxMon->hasSpecies); + break; + case MON_DATA_SANITY_IS_EGG: + SET8(boxMon->isEgg); + break; + case MON_DATA_OT_NAME: + { + s32 i; + for (i = 0; i < PLAYER_NAME_LENGTH; i++) + boxMon->otName[i] = data[i]; + break; + } + case MON_DATA_MARKINGS: + SET8(boxMon->markings); + break; + case MON_DATA_CHECKSUM: + SET16(boxMon->checksum); + break; + case MON_DATA_ENCRYPT_SEPARATOR: + SET16(boxMon->unknown); + break; + } } if (field > MON_DATA_ENCRYPT_SEPARATOR) @@ -5433,29 +5495,28 @@ u8 SendMonToPC(struct Pokemon* mon) return MON_CANT_GIVE; } -u8 CalculatePlayerPartyCount(void) +u8 CalculatePartyCount(struct Pokemon *party) { - gPlayerPartyCount = 0; + u32 partyCount = 0; - while (gPlayerPartyCount < PARTY_SIZE - && GetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_SPECIES, NULL) != SPECIES_NONE) + while (partyCount < PARTY_SIZE + && GetMonData(&party[partyCount], MON_DATA_SPECIES, NULL) != SPECIES_NONE) { - gPlayerPartyCount++; + partyCount++; } + return partyCount; +} + +u8 CalculatePlayerPartyCount(void) +{ + gPlayerPartyCount = CalculatePartyCount(gPlayerParty); return gPlayerPartyCount; } u8 CalculateEnemyPartyCount(void) { - gEnemyPartyCount = 0; - - while (gEnemyPartyCount < PARTY_SIZE - && GetMonData(&gEnemyParty[gEnemyPartyCount], MON_DATA_SPECIES, NULL) != SPECIES_NONE) - { - gEnemyPartyCount++; - } - + gEnemyPartyCount = CalculatePartyCount(gEnemyParty); return gEnemyPartyCount; } @@ -5599,22 +5660,9 @@ bool8 IsPokemonStorageFull(void) return TRUE; } -void GetSpeciesName(u8 *name, u16 species) +const u8 *GetSpeciesName(u16 species) { - s32 i; - - for (i = 0; i <= POKEMON_NAME_LENGTH; i++) - { - if (species > NUM_SPECIES) - name[i] = gSpeciesNames[SPECIES_NONE][i]; - else - name[i] = gSpeciesNames[species][i]; - - if (name[i] == EOS) - break; - } - - name[i] = EOS; + return gSpeciesNames[SanitizeSpeciesId(species)]; } u8 CalculatePPWithBonus(u16 move, u8 ppBonuses, u8 moveIndex) @@ -5638,7 +5686,7 @@ void RemoveBattleMonPPBonus(struct BattlePokemon *mon, u8 moveIndex) void PokemonToBattleMon(struct Pokemon *src, struct BattlePokemon *dst) { s32 i; - u8 nickname[POKEMON_NAME_LENGTH * 2]; + u8 nickname[POKEMON_NAME_BUFFER_SIZE]; for (i = 0; i < MAX_MON_MOVES; i++) { @@ -6168,7 +6216,7 @@ bool8 HealStatusConditions(struct Pokemon *mon, u32 battlePartyId, u32 healMask, } } -u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit) +u8 GetItemEffectParamOffset(u32 battler, u16 itemId, u8 effectByte, u8 effectBit) { const u8 *temp; const u8 *itemEffect; @@ -6186,7 +6234,7 @@ u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit) if (itemId == ITEM_ENIGMA_BERRY_E_READER) { - temp = gEnigmaBerries[gActiveBattler].itemEffect; + temp = gEnigmaBerries[battler].itemEffect; } itemEffect = temp; @@ -6557,6 +6605,12 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 mode, u16 evolutionItem, s && (j == WEATHER_RAIN || j == WEATHER_RAIN_THUNDERSTORM || j == WEATHER_DOWNPOUR)) targetSpecies = gEvolutionTable[species][i].targetSpecies; break; + case EVO_LEVEL_FOG: + j = GetCurrentWeather(); + if (gEvolutionTable[species][i].param <= level + && (j == WEATHER_FOG_HORIZONTAL || j == WEATHER_FOG_DIAGONAL)) + targetSpecies = gEvolutionTable[species][i].targetSpecies; + break; case EVO_MAPSEC: if (gMapHeader.regionMapSectionId == gEvolutionTable[species][i].param) targetSpecies = gEvolutionTable[species][i].targetSpecies; @@ -6722,6 +6776,26 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 mode, u16 evolutionItem, s return targetSpecies; } +bool8 IsMonPastEvolutionLevel(struct Pokemon *mon) +{ + int i; + u16 species = GetMonData(mon, MON_DATA_SPECIES, 0); + u8 level = GetMonData(mon, MON_DATA_LEVEL, 0); + + for (i = 0; i < EVOS_PER_MON; i++) + { + switch (gEvolutionTable[species][i].method) + { + case EVO_LEVEL: + if (gEvolutionTable[species][i].param <= level) + return TRUE; + break; + } + } + + return FALSE; +} + u16 HoennPokedexNumToSpecies(u16 hoennNum) { u16 species; @@ -6807,7 +6881,7 @@ u16 HoennToNationalOrder(u16 hoennNum) // To draw a spot pixel, add 4 to the color index #define SPOT_COLOR_ADJUSTMENT 4 /* - The macro below handles drawing the randomly-placed spots on Spinda's front sprite. + The function below handles drawing the randomly-placed spots on Spinda's front sprite. Spinda has 4 spots, each with an entry in gSpindaSpotGraphics. Each entry contains a base x and y coordinate for the spot and a 16x16 binary image. Each bit in the image determines whether that pixel should be considered part of the spot. @@ -6819,85 +6893,80 @@ u16 HoennToNationalOrder(u16 hoennNum) coordinate is calculated as (baseCoord + (given 4 bits of personality) - 8). In effect this means each spot can start at any position -8 to +7 off of its base coordinates (256 possibilities). - The macro then loops over the 16x16 spot image. For each bit in the spot's binary image, if + The function then loops over the 16x16 spot image. For each bit in the spot's binary image, if the bit is set then it's part of the spot; try to draw it. A pixel is drawn on Spinda if the pixel on Spinda satisfies the following formula: ((u8)(colorIndex - 1) <= 2). The -1 excludes transparent pixels, as these are index 0. Therefore only colors 1, 2, or 3 on Spinda will allow a spot to be drawn. These color indexes are Spinda's light brown body colors. To create the spot it adds 4 to the color index, so Spinda's spots will be colors 5, 6, and 7. - The above is done two different ways in the macro: one with << 4, and one without. This + The above is done two different ways in the function: one with << 4, and one without. This is because Spinda's sprite is a 4 bits per pixel image, but the pointer to Spinda's pixels (destPixels) is an 8 bit pointer, so it addresses two pixels. Shifting by 4 accesses the 2nd of these pixels, so this is done every other time. */ -#define DRAW_SPINDA_SPOTS(personality, dest) \ -{ \ - s32 i; \ - for (i = 0; i < (s32)ARRAY_COUNT(gSpindaSpotGraphics); i++) \ - { \ - s32 row; \ - u8 x = gSpindaSpotGraphics[i].x + ((personality & 0x0F) - 8); \ - u8 y = gSpindaSpotGraphics[i].y + (((personality & 0xF0) >> 4) - 8); \ - \ - for (row = 0; row < SPINDA_SPOT_HEIGHT; row++) \ - { \ - s32 column; \ - s32 spotPixelRow = gSpindaSpotGraphics[i].image[row]; \ - \ - for (column = x; column < x + SPINDA_SPOT_WIDTH; column++) \ - { \ - /* Get target pixels on Spinda's sprite */ \ - u8 *destPixels = dest + ((column / 8) * TILE_SIZE_4BPP) + \ - ((column % 8) / 2) + \ - ((y / 8) * TILE_SIZE_4BPP * 8) + \ - ((y % 8) * 4); \ - \ - /* Is this pixel in the 16x16 spot image part of the spot? */ \ - if (spotPixelRow & 1) \ - { \ - /* destPixels addressess two pixels, alternate which */ \ - /* of the two pixels is being considered for drawing */ \ - if (column & 1) \ - { \ - /* Draw spot pixel if this is Spinda's body color */ \ - if ((u8)((*destPixels & 0xF0) - (FIRST_SPOT_COLOR << 4))\ - <= ((LAST_SPOT_COLOR - FIRST_SPOT_COLOR) << 4))\ - *destPixels += (SPOT_COLOR_ADJUSTMENT << 4); \ - } \ - else \ - { \ - /* Draw spot pixel if this is Spinda's body color */ \ - if ((u8)((*destPixels & 0xF) - FIRST_SPOT_COLOR) \ - <= (LAST_SPOT_COLOR - FIRST_SPOT_COLOR)) \ - *destPixels += SPOT_COLOR_ADJUSTMENT; \ - } \ - } \ - \ - spotPixelRow >>= 1; \ - } \ - \ - y++; \ - } \ - \ - personality >>= 8; \ - } \ -} - -// Same as DrawSpindaSpots but attempts to discern for itself whether or -// not it's the front pic. -static void DrawSpindaSpotsUnused(u16 species, u32 personality, u8 *dest) -{ - if (species == SPECIES_SPINDA - && dest != gMonSpritesGfxPtr->sprites.ptr[B_POSITION_PLAYER_LEFT] - && dest != gMonSpritesGfxPtr->sprites.ptr[B_POSITION_PLAYER_RIGHT]) - DRAW_SPINDA_SPOTS(personality, dest); -} - -void DrawSpindaSpots(u16 species, u32 personality, u8 *dest, bool8 isFrontPic) -{ - if (species == SPECIES_SPINDA && isFrontPic) - DRAW_SPINDA_SPOTS(personality, dest); +void DrawSpindaSpots(u32 personality, u8 *dest, bool32 isSecondFrame) +{ + s32 i; + for (i = 0; i < (s32)ARRAY_COUNT(gSpindaSpotGraphics); i++) + { + s32 row; + u8 x = gSpindaSpotGraphics[i].x + (personality & 0x0F); + u8 y = gSpindaSpotGraphics[i].y + ((personality & 0xF0) >> 4); + + if (isSecondFrame) + { + x -= 12; + y += 56; + } + else + { + x -= 8; + y -= 8; + } + + for (row = 0; row < SPINDA_SPOT_HEIGHT; row++) + { + s32 column; + s32 spotPixelRow = gSpindaSpotGraphics[i].image[row]; + + for (column = x; column < x + SPINDA_SPOT_WIDTH; column++) + { + /* Get target pixels on Spinda's sprite */ + u8 *destPixels = dest + ((column / 8) * TILE_SIZE_4BPP) + + ((column % 8) / 2) + + ((y / 8) * TILE_SIZE_4BPP * 8) + + ((y % 8) * 4); + + /* Is this pixel in the 16x16 spot image part of the spot? */ + if (spotPixelRow & 1) + { + /* destPixels addressess two pixels, alternate which */ + /* of the two pixels is being considered for drawing */ + if (column & 1) + { + /* Draw spot pixel if this is Spinda's body color */ + if ((u8)((*destPixels & 0xF0) - (FIRST_SPOT_COLOR << 4)) + <= ((LAST_SPOT_COLOR - FIRST_SPOT_COLOR) << 4)) + *destPixels += (SPOT_COLOR_ADJUSTMENT << 4); + } + else + { + /* Draw spot pixel if this is Spinda's body color */ + if ((u8)((*destPixels & 0xF) - FIRST_SPOT_COLOR) + <= (LAST_SPOT_COLOR - FIRST_SPOT_COLOR)) + *destPixels += SPOT_COLOR_ADJUSTMENT; + } + } + + spotPixelRow >>= 1; + } + + y++; + } + + personality >>= 8; + } } void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies) @@ -6905,8 +6974,8 @@ void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies) u8 language; GetMonData(mon, MON_DATA_NICKNAME, gStringVar1); language = GetMonData(mon, MON_DATA_LANGUAGE, &language); - if (language == GAME_LANGUAGE && !StringCompare(gSpeciesNames[oldSpecies], gStringVar1)) - SetMonData(mon, MON_DATA_NICKNAME, gSpeciesNames[newSpecies]); + if (language == GAME_LANGUAGE && !StringCompare(GetSpeciesName(oldSpecies), gStringVar1)) + SetMonData(mon, MON_DATA_NICKNAME, GetSpeciesName(newSpecies)); } // The below two functions determine which side of a multi battle the trainer battles on @@ -7512,13 +7581,6 @@ bool32 IsSpeciesInHoennDex(u16 species) return TRUE; } -void ClearBattleMonForms(void) -{ - int i; - for (i = 0; i < MAX_BATTLERS_COUNT; i++) - gBattleMonForms[i] = 0; -} - u16 GetBattleBGM(void) { if (gBattleTypeFlags & BATTLE_TYPE_KYOGRE_GROUDON) @@ -7636,17 +7698,21 @@ const u32 *GetMonSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32 p shinyValue = GET_SHINY_VALUE(otId, personality); if (shinyValue < SHINY_ODDS) { - if (ShouldShowFemaleDifferences(species, personality)) + if (gMonShinyPaletteTableFemale[species].data != NULL && IsPersonalityFemale(species, personality)) return gMonShinyPaletteTableFemale[species].data; - else + else if (gMonShinyPaletteTable[species].data != NULL) return gMonShinyPaletteTable[species].data; + else + return gMonShinyPaletteTable[SPECIES_NONE].data; } else { - if (ShouldShowFemaleDifferences(species, personality)) + if (gMonPaletteTableFemale[species].data != NULL && IsPersonalityFemale(species, personality)) return gMonPaletteTableFemale[species].data; - else + else if (gMonPaletteTable[species].data != NULL) return gMonPaletteTable[species].data; + else + return gMonPaletteTable[SPECIES_NONE].data; } } @@ -7665,21 +7731,25 @@ const struct CompressedSpritePalette *GetMonSpritePalStructFromOtIdPersonality(u shinyValue = GET_SHINY_VALUE(otId, personality); if (shinyValue < SHINY_ODDS) { - if (ShouldShowFemaleDifferences(species, personality)) + if (gMonShinyPaletteTableFemale[species].data != NULL && IsPersonalityFemale(species, personality)) return &gMonShinyPaletteTableFemale[species]; - else + else if (gMonShinyPaletteTable[species].data != NULL) return &gMonShinyPaletteTable[species]; + else + return &gMonShinyPaletteTable[SPECIES_NONE]; } else { - if (ShouldShowFemaleDifferences(species, personality)) + if (gMonPaletteTableFemale[species].data != NULL && IsPersonalityFemale(species, personality)) return &gMonPaletteTableFemale[species]; - else + else if (gMonPaletteTable[species].data != NULL) return &gMonPaletteTable[species]; + else + return &gMonPaletteTable[SPECIES_NONE]; } } -bool32 IsHMMove2(u16 move) +bool8 IsMoveHM(u16 move) { int i = 0; while (sHMMoves[i] != HM_MOVES_END) @@ -8108,13 +8178,7 @@ const u8 *GetTrainerNameFromId(u16 trainerId) bool8 HasTwoFramesAnimation(u16 species) { - return (species != SPECIES_CASTFORM - && species != SPECIES_SPINDA - && species != SPECIES_UNOWN - && species != SPECIES_CHERRIM - && species != SPECIES_CASTFORM_SUNNY - && species != SPECIES_CASTFORM_RAINY - && species != SPECIES_CASTFORM_SNOWY); + return species != SPECIES_UNOWN; } static bool8 ShouldSkipFriendshipChange(void) @@ -8500,11 +8564,16 @@ void TrySpecialOverworldEvo(void) SetMainCallback2(CB2_ReturnToField); } -bool32 ShouldShowFemaleDifferences(u16 species, u32 personality) +bool32 SpeciesHasGenderDifferences(u16 species) { - if (species >= NUM_SPECIES) - return FALSE; - return (gSpeciesInfo[species].flags & SPECIES_FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE; + if (gMonFrontPicTableFemale[species].data != NULL + || gMonPaletteTableFemale[species].data != NULL + || gMonBackPicTableFemale[species].data != NULL + || gMonShinyPaletteTableFemale[species].data != NULL + || gMonIconTableFemale[species] != NULL) + return TRUE; + + return FALSE; } bool32 TryFormChange(u32 monId, u32 side, u16 method) @@ -8532,6 +8601,19 @@ bool32 TryFormChange(u32 monId, u32 side, u16 method) return FALSE; } +u16 SanitizeSpeciesId(u16 species) +{ + if (species > NUM_SPECIES || !IsSpeciesEnabled(species)) + return SPECIES_NONE; + else + return species; +} + +bool32 IsSpeciesEnabled(u16 species) +{ + return gSpeciesInfo[species].baseHP > 0; +} + void TryToSetBattleFormChangeMoves(struct Pokemon *mon, u16 method) { int i, j; diff --git a/src/pokemon_animation.c b/src/pokemon_animation.c index e0847233e518..57b3d5b303df 100644 --- a/src/pokemon_animation.c +++ b/src/pokemon_animation.c @@ -575,6 +575,9 @@ static const u8 sSpeciesToBackAnimSet[NUM_SPECIES] = [SPECIES_LAIRON] = BACK_ANIM_V_SHAKE, [SPECIES_AGGRON] = BACK_ANIM_V_SHAKE_LOW, [SPECIES_CASTFORM] = BACK_ANIM_CONVEX_DOUBLE_ARC, + [SPECIES_CASTFORM_SUNNY] = BACK_ANIM_SHAKE_GLOW_RED, + [SPECIES_CASTFORM_RAINY] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_CASTFORM_SNOWY] = BACK_ANIM_TRIANGLE_DOWN, [SPECIES_VOLBEAT] = BACK_ANIM_CONVEX_DOUBLE_ARC, [SPECIES_ILLUMISE] = BACK_ANIM_CONVEX_DOUBLE_ARC, [SPECIES_LILEEP] = BACK_ANIM_H_STRETCH, @@ -719,7 +722,7 @@ static const u8 sSpeciesToBackAnimSet[NUM_SPECIES] = [SPECIES_BURMY_TRASH_CLOAK] = BACK_ANIM_H_SHAKE, [SPECIES_WORMADAM_SANDY_CLOAK] = BACK_ANIM_V_SHAKE, [SPECIES_WORMADAM_TRASH_CLOAK] = BACK_ANIM_V_SHAKE, - [SPECIES_CHERRIM_SUNSHINE] = BACK_ANIM_CONCAVE_ARC_SMALL, + [SPECIES_CHERRIM_SUNSHINE] = BACK_ANIM_CONCAVE_ARC_SMALL, [SPECIES_SHELLOS_EAST_SEA] = BACK_ANIM_H_SPRING, [SPECIES_GASTRODON_EAST_SEA] = BACK_ANIM_SHRINK_GROW_VIBRATE, [SPECIES_ROTOM_HEAT] = BACK_ANIM_SHAKE_GLOW_RED, diff --git a/src/pokemon_debug.c b/src/pokemon_debug.c index d3277caa981f..3c9a562776bf 100644 --- a/src/pokemon_debug.c +++ b/src/pokemon_debug.c @@ -45,8 +45,6 @@ extern const struct CompressedSpriteSheet gSpriteSheet_EnemyShadow; extern const struct SpriteTemplate gSpriteTemplate_EnemyShadow; extern const struct SpritePalette sSpritePalettes_HealthBoxHealthBar[2]; extern const struct UCoords8 sBattlerCoords[][MAX_BATTLERS_COUNT] ; -extern const struct MonCoords gCastformFrontSpriteCoords[NUM_CASTFORM_FORMS]; -extern const u8 sCastformElevations[NUM_CASTFORM_FORMS]; extern const u8 sMonFrontAnimIdsTable[NUM_SPECIES - 1]; static const u16 sBgColor[] = {RGB_WHITE}; @@ -417,21 +415,21 @@ static void PrintInstructionsOnWindow(struct PokemonDebugMenu *data) FillWindowPixelBuffer(WIN_INSTRUCTIONS, 0x11); if (data->currentSubmenu == 0) { - if (gSpeciesInfo[species].flags & SPECIES_FLAG_GENDER_DIFFERENCE) + if (SpeciesHasGenderDifferences(species)) AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructionsGender, x, 0, 0, NULL); else AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructions, x, 0, 0, NULL); } else if (data->currentSubmenu == 1) { - if (gSpeciesInfo[species].flags & SPECIES_FLAG_GENDER_DIFFERENCE) + if (SpeciesHasGenderDifferences(species)) AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructionsSubmenuOneGender, x, 0, 0, NULL); else AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructionsSubmenuOne, x, 0, 0, NULL); } else if (data->currentSubmenu == 2) { - if (gSpeciesInfo[species].flags & SPECIES_FLAG_GENDER_DIFFERENCE) + if (SpeciesHasGenderDifferences(species)) AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructionsSubmenuTwoGender, x, 0, 0, NULL); else AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructionsSubmenuTwo, x, 0, 0, NULL); @@ -485,7 +483,7 @@ static void PrintDigitChars(struct PokemonDebugMenu *data) text[i++] = CHAR_SPACE; text[i++] = CHAR_HYPHEN; - if (gSpeciesInfo[species].flags & SPECIES_FLAG_GENDER_DIFFERENCE) + if (SpeciesHasGenderDifferences(species)) { if (data->isFemale) text[i++] = CHAR_FEMALE; @@ -495,7 +493,7 @@ static void PrintDigitChars(struct PokemonDebugMenu *data) } text[i++] = CHAR_SPACE; - StringCopy(&text[i], gSpeciesNames[species]); + StringCopy(&text[i], GetSpeciesName(species)); FillWindowPixelBuffer(WIN_NAME_NUMBERS, 0x11); AddTextPrinterParameterized(WIN_NAME_NUMBERS, 1, text, 6, 0, 0, NULL); @@ -688,17 +686,21 @@ static const struct CompressedSpritePalette *GetMonSpritePalStructCustom(u16 spe { if (isShiny) { - if ((gSpeciesInfo[species].flags & SPECIES_FLAG_GENDER_DIFFERENCE) && isFemale) + if (gMonShinyPaletteTableFemale[species].data != NULL && isFemale) return &gMonShinyPaletteTableFemale[species]; - else + else if (gMonShinyPaletteTable[species].data != NULL) return &gMonShinyPaletteTable[species]; + else + return &gMonShinyPaletteTable[SPECIES_NONE]; } else { - if ((gSpeciesInfo[species].flags & SPECIES_FLAG_GENDER_DIFFERENCE) && isFemale) + if (gMonPaletteTableFemale[species].data != NULL && isFemale) return &gMonPaletteTableFemale[species]; - else + else if (gMonPaletteTable[species].data != NULL) return &gMonPaletteTable[species]; + else + return &gMonPaletteTable[SPECIES_NONE]; } } @@ -714,17 +716,21 @@ static void BattleLoadOpponentMonSpriteGfxCustom(u16 species, bool8 isFemale, bo if (isShiny) { - if ((gSpeciesInfo[species].flags & SPECIES_FLAG_GENDER_DIFFERENCE) && isFemale) + if (gMonShinyPaletteTableFemale[species].data != NULL && isFemale) lzPaletteData = gMonShinyPaletteTableFemale[species].data; - else + else if (gMonShinyPaletteTable[species].data != NULL) lzPaletteData = gMonShinyPaletteTable[species].data; + else + lzPaletteData = gMonShinyPaletteTable[SPECIES_NONE].data; } else { - if ((gSpeciesInfo[species].flags & SPECIES_FLAG_GENDER_DIFFERENCE) && isFemale) + if (gMonPaletteTableFemale[species].data != NULL && isFemale) lzPaletteData = gMonPaletteTableFemale[species].data; - else + else if (gMonPaletteTable[species].data != NULL) lzPaletteData = gMonPaletteTable[species].data; + else + lzPaletteData = gMonPaletteTable[SPECIES_NONE].data; } LZDecompressWram(lzPaletteData, gDecompressionBuffer); @@ -732,53 +738,11 @@ static void BattleLoadOpponentMonSpriteGfxCustom(u16 species, bool8 isFemale, bo LoadPalette(gDecompressionBuffer, 0x80 + battlerId * 16, 0x20); } -static bool8 IsCastformForm(species) -{ - if (species == SPECIES_CASTFORM_SUNNY || species == SPECIES_CASTFORM_RAINY || species == SPECIES_CASTFORM_SNOWY) - return TRUE; - - return FALSE; -} - -static u8 GetCastformYCustom(species) -{ - u8 ret; - switch (species) - { - case SPECIES_CASTFORM: - ret = gCastformFrontSpriteCoords[CASTFORM_NORMAL].y_offset; - break; - case SPECIES_CASTFORM_SUNNY: - ret = gCastformFrontSpriteCoords[CASTFORM_FIRE].y_offset; - break; - case SPECIES_CASTFORM_RAINY: - ret = gCastformFrontSpriteCoords[CASTFORM_WATER].y_offset; - break; - case SPECIES_CASTFORM_SNOWY: - ret = gCastformFrontSpriteCoords[CASTFORM_ICE].y_offset; - break; - } - return ret; -} - -static u8 GetElevationValue(u16 species) -{ - u8 val; - if (species == SPECIES_CASTFORM) - val = sCastformElevations[0]; - else if (IsCastformForm(species)) - val = sCastformElevations[species - SPECIES_CASTFORM_SUNNY + 1]; - else - val = gEnemyMonElevation[species]; - - return val; -} - static void SetConstSpriteValues(struct PokemonDebugMenu *data) { u16 species = data->currentmonId; data->constSpriteValues.frontPicCoords = gMonFrontPicCoords[species].y_offset; - data->constSpriteValues.frontElevation = GetElevationValue(species); + data->constSpriteValues.frontElevation = gEnemyMonElevation[species]; data->constSpriteValues.backPicCoords = gMonBackPicCoords[species].y_offset; } @@ -798,7 +762,7 @@ static u8 GetBattlerSpriteFinal_YCustom(u16 species, s8 offset_picCoords, s8 off offset = gMonFrontPicCoords[species].y_offset + offset_picCoords; //Elevation - offset -= GetElevationValue(species) + offset_elevation; + offset -= gEnemyMonElevation[species] + offset_elevation; //Main position y = offset + sBattlerCoords[0][1].y; @@ -830,7 +794,7 @@ static void LoadAndCreateEnemyShadowSpriteCustom(struct PokemonDebugMenu *data, { u8 x, y; bool8 invisible = FALSE; - if (gEnemyMonElevation[species] == 0 && !IsCastformForm(species)) + if (gEnemyMonElevation[species] == 0) invisible = TRUE; LoadCompressedSpriteSheet(&gSpriteSheet_EnemyShadow); LoadSpritePalette(&sSpritePalettes_HealthBoxHealthBar[0]); @@ -1494,7 +1458,7 @@ static void Handle_Input_Debug_Pokemon(u8 taskId) ReloadPokemonSprites(data); ApplyOffsetSpriteValues(data); } - if (JOY_NEW(SELECT_BUTTON) && (gSpeciesInfo[data->currentmonId].flags & SPECIES_FLAG_GENDER_DIFFERENCE)) + if (JOY_NEW(SELECT_BUTTON) && SpeciesHasGenderDifferences(data->currentmonId)) { data->isFemale = !data->isFemale; PrintDigitChars(data); diff --git a/src/pokemon_icon.c b/src/pokemon_icon.c index 9255e1c03b9f..28a96262451b 100644 --- a/src/pokemon_icon.c +++ b/src/pokemon_icon.c @@ -24,9 +24,9 @@ struct MonIconSpriteTemplate static u8 CreateMonIconSprite(struct MonIconSpriteTemplate *, s16, s16, u8); static void FreeAndDestroyMonIconSprite_(struct Sprite *sprite); -const u8 *const gMonIconTable[] = +const u8 *const gMonIconTable[NUM_SPECIES + 1] = { - [SPECIES_NONE] = gMonIcon_Bulbasaur, + [SPECIES_NONE] = gMonIcon_QuestionMark, [SPECIES_BULBASAUR] = gMonIcon_Bulbasaur, [SPECIES_IVYSAUR] = gMonIcon_Ivysaur, [SPECIES_VENUSAUR] = gMonIcon_Venusaur, @@ -1298,25 +1298,12 @@ const u8 *const gMonIconTable[] = [SPECIES_EGG] = gMonIcon_Egg, }; -const u8 *const gMonIconTableFemale[] = +// Female icon palette indexes still need to be defined in gMonIconPaletteIndicesFemale, even if they are the same as males. +const u8 *const gMonIconTableFemale[NUM_SPECIES + 1] = { - [SPECIES_EEVEE] = gMonIcon_Eevee, -#if P_GEN_4_POKEMON == TRUE - [SPECIES_STARLY] = gMonIcon_Starly, - [SPECIES_STARAVIA] = gMonIcon_Staravia, - [SPECIES_STARAPTOR] = gMonIcon_Staraptor, - [SPECIES_BIDOOF] = gMonIcon_Bidoof, - [SPECIES_KRICKETOT] = gMonIcon_Kricketot, - [SPECIES_KRICKETUNE] = gMonIcon_Kricketune, - [SPECIES_SHINX] = gMonIcon_Shinx, - [SPECIES_COMBEE] = gMonIcon_Combee, -#if P_HIPPO_GENDER_DIFF_ICONS == TRUE +#if P_GEN_4_POKEMON == TRUE && P_HIPPO_GENDER_DIFF_ICONS == TRUE [SPECIES_HIPPOPOTAS] = gMonIcon_HippopotasF, [SPECIES_HIPPOWDON] = gMonIcon_HippowdonF, -#else - [SPECIES_HIPPOPOTAS] = gMonIcon_Hippopotas, - [SPECIES_HIPPOWDON] = gMonIcon_Hippowdon, -#endif #endif #if P_GEN_5_POKEMON == TRUE [SPECIES_UNFEZANT] = gMonIcon_UnfezantF, @@ -2235,7 +2222,7 @@ const u8 gMonIconPaletteIndices[] = [SPECIES_SNEASLER] = 2, [SPECIES_OVERQWIL] = 2, [SPECIES_ENAMORUS] = 1, - [SPECIES_VENUSAUR_MEGA] = 1, + [SPECIES_VENUSAUR_MEGA] = 4, [SPECIES_CHARIZARD_MEGA_X] = 0, [SPECIES_CHARIZARD_MEGA_Y] = 0, [SPECIES_BLASTOISE_MEGA] = 2, @@ -2547,15 +2534,7 @@ const u8 gMonIconPaletteIndices[] = const u8 gMonIconPaletteIndicesFemale[] = { - [SPECIES_EEVEE] = 2, #if P_GEN_4_POKEMON == TRUE - [SPECIES_STARLY] = 0, - [SPECIES_STARAVIA] = 0, - [SPECIES_BIDOOF] = 2, - [SPECIES_KRICKETOT] = 2, - [SPECIES_KRICKETUNE] = 2, - [SPECIES_SHINX] = 0, - [SPECIES_COMBEE] = 0, [SPECIES_HIPPOPOTAS] = 1, [SPECIES_HIPPOWDON] = 1, #endif @@ -2567,9 +2546,6 @@ const u8 gMonIconPaletteIndicesFemale[] = #if P_GEN_6_POKEMON == TRUE [SPECIES_PYROAR] = 2, #endif -#if P_GEN_8_POKEMON == TRUE - [SPECIES_BASCULEGION] = 0, -#endif }; const struct SpritePalette gMonIconPaletteTable[] = @@ -2700,7 +2676,7 @@ u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u if (species > NUM_SPECIES) iconTemplate.paletteTag = POKE_ICON_BASE_PAL_TAG; - else if (ShouldShowFemaleDifferences(species, personality)) + else if (gMonIconTableFemale[species] && IsPersonalityFemale(species, personality)) iconTemplate.paletteTag = POKE_ICON_BASE_PAL_TAG + gMonIconPaletteIndicesFemale[species]; spriteId = CreateMonIconSprite(&iconTemplate, x, y, subpriority); @@ -2815,7 +2791,7 @@ void LoadMonIconPalette(u16 species) void LoadMonIconPalettePersonality(u16 species, u32 personality) { u8 palIndex; - if (ShouldShowFemaleDifferences(species, personality)) + if (gMonIconTableFemale[species] != NULL && IsPersonalityFemale(species, personality)) palIndex = gMonIconPaletteIndicesFemale[species]; else palIndex = gMonIconPaletteIndices[species]; @@ -2856,10 +2832,15 @@ const u8 *GetMonIconTiles(u16 species, u32 personality) { const u8 *iconSprite; - if (ShouldShowFemaleDifferences(species, personality)) + if (species > NUM_SPECIES) + species = SPECIES_NONE; + + if (gMonIconTableFemale[species] != NULL && IsPersonalityFemale(species, personality)) iconSprite = gMonIconTableFemale[species]; - else + else if (gMonIconTable[species] != NULL) iconSprite = gMonIconTable[species]; + else + iconSprite = gMonIconTable[SPECIES_NONE]; return iconSprite; } diff --git a/src/pokemon_size_record.c b/src/pokemon_size_record.c index 7c88e5bf1043..bc2ffe1aea68 100644 --- a/src/pokemon_size_record.c +++ b/src/pokemon_size_record.c @@ -148,7 +148,7 @@ static void GetMonSizeRecordInfo(u16 species, u16 *sizeRecord) u32 size = GetMonSize(species, *sizeRecord); FormatMonSizeRecord(gStringVar3, size); - StringCopy(gStringVar1, gSpeciesNames[species]); + StringCopy(gStringVar1, GetSpeciesName(species)); if (*sizeRecord == DEFAULT_MAX_SIZE) StringCopy(gStringVar2, gText_Marco); else diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 6faa4aeb96ca..849c523b8e19 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -3685,9 +3685,14 @@ static void Task_OnBPressed(u8 taskId) case 0: if (IsMonBeingMoved()) { + #if OW_PC_PRESS_B < GEN_4 PlaySE(SE_FAILURE); PrintMessage(MSG_HOLDING_POKE); sStorage->state = 1; + #else + PlaySE(SE_SELECT); + SetPokeStorageTask(Task_PlaceMon); + #endif } else if (IsMovingItem()) { @@ -5110,7 +5115,7 @@ static u16 TryLoadMonIconTiles(u16 species, u32 personality) u16 i, offset; // Treat female mons as a seperate species as they may have a different icon than males - if (ShouldShowFemaleDifferences(species, personality)) + if (gMonIconTableFemale[species] != NULL && IsPersonalityFemale(species, personality)) species |= 0x8000; // 1 << 15 // Search icon list for this species @@ -5177,7 +5182,7 @@ static struct Sprite *CreateMonIconSprite(u16 species, u32 personality, s16 x, s struct SpriteTemplate template = sSpriteTemplate_MonIcon; species = GetIconSpecies(species, personality); - if (ShouldShowFemaleDifferences(species, personality)) + if (gMonIconTableFemale[species] != NULL && IsPersonalityFemale(species, personality)) { template.paletteTag = PALTAG_MON_ICON_0 + gMonIconPaletteIndicesFemale[species]; } @@ -6993,7 +6998,7 @@ static void SetDisplayMonData(void *pokemon, u8 mode) txtPtr = sStorage->displayMonSpeciesName; *(txtPtr)++ = CHAR_SLASH; - StringCopyPadded(txtPtr, gSpeciesNames[sStorage->displayMonSpecies], CHAR_SPACE, 5); + StringCopyPadded(txtPtr, GetSpeciesName(sStorage->displayMonSpecies), CHAR_SPACE, 5); txtPtr = sStorage->displayMonGenderLvlText; *(txtPtr)++ = EXT_CTRL_CODE_BEGIN; diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index f7106b8752ac..79ade7cdd81d 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -2331,7 +2331,7 @@ static bool8 CanReplaceMove(void) { if (sMonSummaryScreen->firstMoveIndex == MAX_MON_MOVES || sMonSummaryScreen->newMove == MOVE_NONE - || IsMoveHm(sMonSummaryScreen->summary.moves[sMonSummaryScreen->firstMoveIndex]) != TRUE) + || IsMoveHM(sMonSummaryScreen->summary.moves[sMonSummaryScreen->firstMoveIndex]) != TRUE) return TRUE; else return FALSE; @@ -2863,7 +2863,7 @@ static void PrintNotEggInfo(void) GetMonNickname(mon, gStringVar1); PrintTextOnWindow(PSS_LABEL_WINDOW_PORTRAIT_NICKNAME, gStringVar1, 0, 1, 0, 1); strArray[0] = CHAR_SLASH; - StringCopy(&strArray[1], &gSpeciesNames[summary->species2][0]); + StringCopy(&strArray[1], &GetSpeciesName(summary->species2)[0]); PrintTextOnWindow(PSS_LABEL_WINDOW_PORTRAIT_SPECIES, strArray, 0, 1, 0, 1); PrintGenderSymbol(mon, summary->species2); PutWindowTilemap(PSS_LABEL_WINDOW_PORTRAIT_NICKNAME); diff --git a/src/pokenav_conditions.c b/src/pokenav_conditions.c index 3c06f6c6492c..3f662e6f3e7d 100644 --- a/src/pokenav_conditions.c +++ b/src/pokenav_conditions.c @@ -348,7 +348,7 @@ static u8 *CopyConditionMonNameGender(u8 *str, u16 listId, bool8 skipPadding) *(str++) = TEXT_COLOR_LIGHT_BLUE; if (GetBoxOrPartyMonData(boxId, monId, MON_DATA_IS_EGG, NULL)) - return StringCopyPadded(str, gText_EggNickname, CHAR_SPACE, 12); + return StringCopyPadded(str, gText_EggNickname, CHAR_SPACE, POKEMON_NAME_LENGTH + 2); GetBoxOrPartyMonData(boxId, monId, MON_DATA_NICKNAME, str); StringGet_Nickname(str); @@ -365,7 +365,7 @@ static u8 *CopyConditionMonNameGender(u8 *str, u16 listId, bool8 skipPadding) level = GetLevelFromBoxMonExp(boxMon); } - if ((species == SPECIES_NIDORAN_F || species == SPECIES_NIDORAN_M) && !StringCompare(str, gSpeciesNames[species])) + if ((species == SPECIES_NIDORAN_F || species == SPECIES_NIDORAN_M) && !StringCompare(str, GetSpeciesName(species))) gender = MON_GENDERLESS; str_ = str; // For some reason, a variable is needed to match. @@ -445,7 +445,7 @@ static void CopyMonNameGenderLocation(s16 listId, u8 loadId) } else { - for (i = 0; i < 12; i++) + for (i = 0; i < POKEMON_NAME_LENGTH + 2; i++) menu->nameText[loadId][i] = CHAR_SPACE; menu->nameText[loadId][i] = EOS; diff --git a/src/pokenav_match_call_data.c b/src/pokenav_match_call_data.c index 2e8cc40b5cb8..f6d71009bbe7 100644 --- a/src/pokenav_match_call_data.c +++ b/src/pokenav_match_call_data.c @@ -164,7 +164,7 @@ static const match_call_text_data_t sMrStoneTextScripts[] = { { MatchCall_Text_MrStone2, FLAG_ENABLE_MR_STONE_POKENAV, 0xFFFF }, { MatchCall_Text_MrStone3, FLAG_DELIVERED_STEVEN_LETTER, 0xFFFF }, { MatchCall_Text_MrStone4, FLAG_RECEIVED_EXP_SHARE, 0xFFFF }, - { MatchCall_Text_MrStone5, FLAG_RECEIVED_HM04, 0xFFFF }, + { MatchCall_Text_MrStone5, FLAG_RECEIVED_HM_STRENGTH, 0xFFFF }, { MatchCall_Text_MrStone6, FLAG_DEFEATED_PETALBURG_GYM, 0xFFFF }, { MatchCall_Text_MrStone7, FLAG_RECEIVED_CASTFORM, 0xFFFF }, { MatchCall_Text_MrStone8, FLAG_GROUDON_AWAKENED_MAGMA_HIDEOUT, 0xFFFF }, @@ -260,7 +260,7 @@ static const match_call_text_data_t sMayTextScripts[] = { { MatchCall_Text_May2, FLAG_DEFEATED_DEWFORD_GYM, 0xFFFF }, { MatchCall_Text_May3, FLAG_DELIVERED_DEVON_GOODS, 0xFFFF }, { MatchCall_Text_May4, FLAG_HIDE_MAUVILLE_CITY_WALLY, 0xFFFF }, - { MatchCall_Text_May5, FLAG_RECEIVED_HM04, 0xFFFF }, + { MatchCall_Text_May5, FLAG_RECEIVED_HM_STRENGTH, 0xFFFF }, { MatchCall_Text_May6, FLAG_DEFEATED_LAVARIDGE_GYM, 0xFFFF }, { MatchCall_Text_May7, FLAG_DEFEATED_PETALBURG_GYM, 0xFFFF }, { MatchCall_Text_May8, FLAG_RECEIVED_CASTFORM, 0xFFFF }, @@ -289,7 +289,7 @@ static const match_call_text_data_t sBrendanTextScripts[] = { { MatchCall_Text_Brendan2, FLAG_DEFEATED_DEWFORD_GYM, 0xFFFF }, { MatchCall_Text_Brendan3, FLAG_DELIVERED_DEVON_GOODS, 0xFFFF }, { MatchCall_Text_Brendan4, FLAG_HIDE_MAUVILLE_CITY_WALLY, 0xFFFF }, - { MatchCall_Text_Brendan5, FLAG_RECEIVED_HM04, 0xFFFF }, + { MatchCall_Text_Brendan5, FLAG_RECEIVED_HM_STRENGTH, 0xFFFF }, { MatchCall_Text_Brendan6, FLAG_DEFEATED_LAVARIDGE_GYM, 0xFFFF }, { MatchCall_Text_Brendan7, FLAG_DEFEATED_PETALBURG_GYM, 0xFFFF }, { MatchCall_Text_Brendan8, FLAG_RECEIVED_CASTFORM, 0xFFFF }, diff --git a/src/random.c b/src/random.c index 0c2509bd94a1..6a462004b4c3 100644 --- a/src/random.c +++ b/src/random.c @@ -1,5 +1,8 @@ #include "global.h" #include "random.h" +#if MODERN +#include +#endif EWRAM_DATA static u8 sUnknown = 0; EWRAM_DATA static u32 sRandCount = 0; @@ -32,6 +35,48 @@ u16 Random2(void) return gRng2Value >> 16; } +#define SHUFFLE_IMPL \ + u32 tmp; \ + --n; \ + while (n > 1) \ + { \ + int j = (Random() * (n+1)) >> 16; \ + SWAP(data[n], data[j], tmp); \ + --n; \ + } + +void Shuffle8(void *data_, size_t n) +{ + u8 *data = data_; + SHUFFLE_IMPL; +} + +void Shuffle16(void *data_, size_t n) +{ + u16 *data = data_; + SHUFFLE_IMPL; +} + +void Shuffle32(void *data_, size_t n) +{ + u32 *data = data_; + SHUFFLE_IMPL; +} + +void ShuffleN(void *data, size_t n, size_t size) +{ + void *tmp = alloca(size); + --n; + while (n > 1) + { + int j = (Random() * (n+1)) >> 16; + memcpy(tmp, (u8 *)data + n*size, size); // tmp = data[n]; + memcpy((u8 *)data + n*size, (u8 *)data + j*size, size); // data[n] = data[j]; + memcpy((u8 *)data + j*size, tmp, size); // data[j] = tmp; + --n; + } +} + __attribute__((weak, alias("RandomUniformDefault"))) u32 RandomUniform(enum RandomTag tag, u32 lo, u32 hi); diff --git a/src/record_mixing.c b/src/record_mixing.c index d6edd078b700..c5d915a9dbcc 100644 --- a/src/record_mixing.c +++ b/src/record_mixing.c @@ -318,7 +318,7 @@ static void Task_RecordMixing_Main(u8 taskId) sSentRecord = Alloc(sizeof(*sSentRecord)); sReceivedRecords = Alloc(sizeof(*sReceivedRecords) * MAX_LINK_PLAYERS); SetLocalLinkPlayerId(gSpecialVar_0x8005); - VarSet(VAR_TEMP_0, 1); + VarSet(VAR_TEMP_MIXED_RECORDS, 1); sReadyToReceive = FALSE; PrepareExchangePacket(); CreateRecordMixingLights(); @@ -972,14 +972,14 @@ static void ReceiveGiftItem(u16 *item, u8 multiplayerId) { if (!CheckBagHasItem(*item, 1) && !CheckPCHasItem(*item, 1) && AddBagItem(*item, 1)) { - VarSet(VAR_TEMP_1, *item); + VarSet(VAR_TEMP_RECORD_MIX_GIFT_ITEM, *item); StringCopy(gStringVar1, gLinkPlayers[0].name); if (*item == ITEM_EON_TICKET) FlagSet(FLAG_ENABLE_SHIP_SOUTHERN_ISLAND); } else { - VarSet(VAR_TEMP_1, ITEM_NONE); + VarSet(VAR_TEMP_RECORD_MIX_GIFT_ITEM, ITEM_NONE); } } } diff --git a/src/recorded_battle.c b/src/recorded_battle.c index e4b1a55440bb..17f12ce93c05 100644 --- a/src/recorded_battle.c +++ b/src/recorded_battle.c @@ -616,13 +616,13 @@ static void RecordedBattle_RestoreSavedParties(void) } } -u8 GetActiveBattlerLinkPlayerGender(void) +u8 GetBattlerLinkPlayerGender(u32 battler) { s32 i; for (i = 0; i < MAX_LINK_PLAYERS; i++) { - if (gLinkPlayers[i].id == gActiveBattler) + if (gLinkPlayers[i].id == battler) break; } @@ -658,11 +658,11 @@ u8 GetTextSpeedInRecordedBattle(void) return sTextSpeed; } -void RecordedBattle_CopyBattlerMoves(void) +void RecordedBattle_CopyBattlerMoves(u32 battler) { s32 i; - if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT) + if (GetBattlerSide(battler) == B_SIDE_OPPONENT) return; if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) return; @@ -670,7 +670,7 @@ void RecordedBattle_CopyBattlerMoves(void) return; for (i = 0; i < MAX_MON_MOVES; i++) - sPlayerMonMoves[gActiveBattler / 2][i] = gBattleMons[gActiveBattler].moves[i]; + sPlayerMonMoves[battler / 2][i] = gBattleMons[battler].moves[i]; } // This is a special battle action only used by this function diff --git a/src/region_map.c b/src/region_map.c index f6123359be8b..7d5fe93654f6 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -1419,7 +1419,7 @@ void CreateRegionMapCursor(u16 tileTag, u16 paletteTag) sRegionMap->cursorSprite->y = 8 * sRegionMap->cursorPosY + 4; } sRegionMap->cursorSprite->data[1] = 2; - sRegionMap->cursorSprite->data[2] = (IndexOfSpritePaletteTag(paletteTag) << 4) + 0x101; + sRegionMap->cursorSprite->data[2] = OBJ_PLTT_ID(IndexOfSpritePaletteTag(paletteTag)) + 1; sRegionMap->cursorSprite->data[3] = TRUE; } } diff --git a/src/reshow_battle_screen.c b/src/reshow_battle_screen.c index e9b817ff20ef..38999e1c79cd 100644 --- a/src/reshow_battle_screen.c +++ b/src/reshow_battle_screen.c @@ -187,7 +187,7 @@ static bool8 LoadBattlerSpriteGfx(u8 battler) if (GetBattlerSide(battler) != B_SIDE_PLAYER) { if (!gBattleSpritesDataPtr->battlerData[battler].behindSubstitute) - BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battler]], battler); + BattleLoadMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battler]], battler); else BattleLoadSubstituteOrMonSpriteGfx(battler, FALSE); } @@ -196,7 +196,7 @@ static bool8 LoadBattlerSpriteGfx(u8 battler) else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL && battler == B_POSITION_PLAYER_LEFT) // Should be checking position, not battler. DecompressTrainerBackPic(TRAINER_BACK_PIC_WALLY, battler); else if (!gBattleSpritesDataPtr->battlerData[battler].behindSubstitute) - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battler]], battler); + BattleLoadMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battler]], battler); else BattleLoadSubstituteOrMonSpriteGfx(battler, FALSE); @@ -230,9 +230,7 @@ static void CreateBattlerSprite(u8 battler) gSprites[gBattlerSpriteIds[battler]].data[0] = battler; gSprites[gBattlerSpriteIds[battler]].data[2] = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES); - StartSpriteAnim(&gSprites[gBattlerSpriteIds[battler]], gBattleMonForms[battler]); - if (gBattleSpritesDataPtr->battlerData[battler].transformSpecies == SPECIES_CASTFORM) - gSprites[gBattlerSpriteIds[battler]].anims = gMonFrontAnimsPtrTable[SPECIES_CASTFORM]; + StartSpriteAnim(&gSprites[gBattlerSpriteIds[battler]], 0); } else if (gBattleTypeFlags & BATTLE_TYPE_SAFARI && battler == B_POSITION_PLAYER_LEFT) { @@ -266,9 +264,7 @@ static void CreateBattlerSprite(u8 battler) gSprites[gBattlerSpriteIds[battler]].data[0] = battler; gSprites[gBattlerSpriteIds[battler]].data[2] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES); - StartSpriteAnim(&gSprites[gBattlerSpriteIds[battler]], gBattleMonForms[battler]); - if (gBattleSpritesDataPtr->battlerData[battler].transformSpecies == SPECIES_CASTFORM) - gSprites[gBattlerSpriteIds[battler]].anims = gMonFrontAnimsPtrTable[SPECIES_CASTFORM]; + StartSpriteAnim(&gSprites[gBattlerSpriteIds[battler]], 0); } gSprites[gBattlerSpriteIds[battler]].invisible = gBattleSpritesDataPtr->battlerData[battler].invisible; diff --git a/src/rotating_gate.c b/src/rotating_gate.c index f9e732eb7410..0b0c68a836d4 100644 --- a/src/rotating_gate.c +++ b/src/rotating_gate.c @@ -17,12 +17,10 @@ #define GATE_ROT_ACW(arm, longArm) GATE_ROT(ROTATE_ANTICLOCKWISE, arm, longArm) #define GATE_ROT_NONE 255 -// static functions static void SpriteCallback_RotatingGate(struct Sprite *sprite); static u8 RotatingGate_CreateGate(u8 gateId, s16 deltaX, s16 deltaY); static void RotatingGate_HideGatesOutsideViewport(struct Sprite *sprite); -// enums enum { /* @@ -180,7 +178,6 @@ enum PUZZLE_ROUTE110_TRICK_HOUSE_PUZZLE6, }; -// structure struct RotatingGatePuzzle { s16 x; @@ -189,7 +186,6 @@ struct RotatingGatePuzzle u8 orientation; }; -// .rodata // Fortree static const struct RotatingGatePuzzle sRotatingGate_FortreePuzzleConfig[] = { @@ -219,6 +215,15 @@ static const struct RotatingGatePuzzle sRotatingGate_TrickHousePuzzleConfig[] = {10, 19, GATE_SHAPE_L3, GATE_ORIENTATION_180}, }; +#define MAX_GATES max(ARRAY_COUNT(sRotatingGate_FortreePuzzleConfig), \ + ARRAY_COUNT(sRotatingGate_TrickHousePuzzleConfig)) + +// Rotating gate puzzles use the temp vars as a byte array to track the orientation of each gate. +// The assert below makes sure the existing puzzles don't have too many gates, and aren't quietly +// using vars outside the temp vars. Aside from potentially reading/writing vars being used for +// something else, using vars that persist when exiting the map could softlock the puzzle. +STATIC_ASSERT(MAX_GATES <= (2 * NUM_TEMP_VARS), TooManyRotatingGates) + static const u8 sRotatingGateTiles_1[] = INCBIN_U8("graphics/rotating_gates/l1.4bpp"); static const u8 sRotatingGateTiles_2[] = INCBIN_U8("graphics/rotating_gates/l2.4bpp"); static const u8 sRotatingGateTiles_3[] = INCBIN_U8("graphics/rotating_gates/l3.4bpp"); @@ -639,9 +644,7 @@ static void RotatingGate_ResetAllGateOrientations(void) u8 *ptr = (u8 *)GetVarPointer(VAR_TEMP_0); for (i = 0; i < sRotatingGate_PuzzleCount; i++) - { ptr[i] = sRotatingGate_PuzzleConfig[i].orientation; - } } static s32 RotatingGate_GetGateOrientation(u8 gateId) diff --git a/src/scrcmd.c b/src/scrcmd.c index 98c20ef4e3be..51db8ebc6aab 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -51,7 +51,7 @@ #include "constants/event_objects.h" typedef u16 (*SpecialFunc)(void); -typedef void (*NativeFunc)(void); +typedef void (*NativeFunc)(struct ScriptContext *ctx); EWRAM_DATA const u8 *gRamScriptRetAddr = NULL; static EWRAM_DATA u32 sAddressOffset = 0; // For relative addressing in vgoto etc., used by saved scripts (e.g. Mystery Event) @@ -136,7 +136,7 @@ bool8 ScrCmd_callnative(struct ScriptContext *ctx) { NativeFunc func = (NativeFunc)ScriptReadWord(ctx); - func(); + func(ctx); return FALSE; } @@ -1552,7 +1552,7 @@ bool8 ScrCmd_bufferspeciesname(struct ScriptContext *ctx) u8 stringVarIndex = ScriptReadByte(ctx); u16 species = VarGet(ScriptReadHalfword(ctx)); - StringCopy(sScriptStringVars[stringVarIndex], gSpeciesNames[species]); + StringCopy(sScriptStringVars[stringVarIndex], GetSpeciesName(species)); return FALSE; } @@ -1563,7 +1563,7 @@ bool8 ScrCmd_bufferleadmonspeciesname(struct ScriptContext *ctx) u8 *dest = sScriptStringVars[stringVarIndex]; u8 partyIndex = GetLeadMonIndex(); u32 species = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPECIES, NULL); - StringCopy(dest, gSpeciesNames[species]); + StringCopy(dest, GetSpeciesName(species)); return FALSE; } diff --git a/src/script_menu.c b/src/script_menu.c index df7a12f6d863..842a1db797e2 100644 --- a/src/script_menu.c +++ b/src/script_menu.c @@ -118,7 +118,7 @@ static void DrawMultichoiceMenu(u8 left, u8 top, u8 multichoiceId, bool8 ignoreB } #if I_REPEL_LURE_MENU == TRUE -void TryDrawRepelMenu(void) +void TryDrawRepelMenu(struct ScriptContext *ctx) { static const u16 repelItems[] = {ITEM_REPEL, ITEM_SUPER_REPEL, ITEM_MAX_REPEL}; struct MenuAction menuItems[ARRAY_COUNT(repelItems) + 1] = {NULL}; @@ -144,7 +144,7 @@ void TryDrawRepelMenu(void) gSpecialVar_Result = (count > 1); } -void HandleRepelMenuChoice(void) +void HandleRepelMenuChoice(struct ScriptContext *ctx) { gSpecialVar_0x8004 = VarGet(VAR_0x8004 + gSpecialVar_Result); // Get item Id; VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(gSpecialVar_0x8004)); @@ -153,7 +153,7 @@ void HandleRepelMenuChoice(void) #endif } -void TryDrawLureMenu(void) +void TryDrawLureMenu(struct ScriptContext *ctx) { static const u16 lureItems[] = {ITEM_LURE, ITEM_SUPER_LURE, ITEM_MAX_LURE}; struct MenuAction menuItems[ARRAY_COUNT(lureItems) + 1] = {NULL}; @@ -180,7 +180,7 @@ void TryDrawLureMenu(void) gSpecialVar_Result = (count > 1); } -void HandleLureMenuChoice(void) +void HandleLureMenuChoice(struct ScriptContext *ctx) { gSpecialVar_0x8004 = VarGet(VAR_0x8004 + gSpecialVar_Result); // Get item Id; VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(gSpecialVar_0x8004) | REPEL_LURE_MASK); diff --git a/src/secret_base.c b/src/secret_base.c index 1a4a0ac9cdc6..9509cd0fc5c2 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -47,6 +47,8 @@ #include "constants/songs.h" #include "constants/trainers.h" +#define TAG_SCROLL_ARROW 5112 + // Values for registryStatus enum { UNREGISTERED, @@ -985,7 +987,7 @@ static void FinalizeRegistryMenu(u8 taskId) static void AddRegistryMenuScrollArrows(u8 taskId) { s16 *data = gTasks[taskId].data; - tArrowTaskId = AddScrollIndicatorArrowPairParameterized(SCROLL_ARROW_UP, 188, 12, 148, tNumBases - tMaxShownItems, 0x13f8, 0x13f8, &tScrollOffset); + tArrowTaskId = AddScrollIndicatorArrowPairParameterized(SCROLL_ARROW_UP, 188, 12, 148, tNumBases - tMaxShownItems, TAG_SCROLL_ARROW, TAG_SCROLL_ARROW, &tScrollOffset); } static void HandleRegistryMenuInput(u8 taskId) diff --git a/src/slot_machine.c b/src/slot_machine.c index 581e5c78e00c..20386a2528b5 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -1285,7 +1285,7 @@ static void Task_SlotMachine(u8 taskId) // SLOTTASK_UNFADE static bool8 SlotTask_UnfadeScreen(struct Task *task) { - BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB(0, 0, 0)); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); LoadPikaPowerMeter(sSlotMachine->pikaPowerBolts); sSlotMachine->state++; // SLOTTASK_WAIT_FADE return FALSE; @@ -1731,7 +1731,7 @@ static bool8 SlotTask_EndGame(struct Task *task) { SetCoins(sSlotMachine->coins); TryPutFindThatGamerOnAir(GetCoins()); - BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB(0, 0, 0)); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); sSlotMachine->state++; // SLOTTASK_FREE return FALSE; } @@ -3904,7 +3904,7 @@ static void Task_InfoBox(u8 taskId) static void InfoBox_FadeIn(struct Task *task) { - BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB(0, 0, 0)); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); task->tState++; } @@ -3928,7 +3928,7 @@ static void InfoBox_AddText(struct Task *task) { AddTextPrinterParameterized3(1, FONT_NORMAL, 2, 5, sColors_ReeltimeHelp, 0, gText_ReelTimeHelp); CopyWindowToVram(1, COPYWIN_FULL); - BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB(0, 0, 0)); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); task->tState++; } @@ -3940,7 +3940,7 @@ static void InfoBox_WaitInput(struct Task *task) ClearWindowTilemap(1); CopyWindowToVram(1, COPYWIN_MAP); RemoveWindow(1); - BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB(0, 0, 0)); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); task->tState++; } } @@ -3961,7 +3961,7 @@ static void InfoBox_CreateDigitalDisplay(struct Task *task) static void InfoBox_LoadPikaPowerMeter(struct Task *task) { LoadPikaPowerMeter(sSlotMachine->pikaPowerBolts); - BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB(0, 0, 0)); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); task->tState++; } @@ -4672,9 +4672,9 @@ static void SpriteCB_DigitalDisplay_Reel(struct Sprite *sprite) { case 0: sprite->x += 4; - if (sprite->x >= 0xd0) + if (sprite->x >= DISPLAY_WIDTH - 32) { - sprite->x = 0xd0; + sprite->x = DISPLAY_WIDTH - 32; sprite->sState++; } break; @@ -4684,7 +4684,7 @@ static void SpriteCB_DigitalDisplay_Reel(struct Sprite *sprite) break; case 2: sprite->x += 4; - if (sprite->x >= 0x110) + if (sprite->x >= DISPLAY_WIDTH + 32) sprite->sState++; break; case 3: @@ -4700,9 +4700,9 @@ static void SpriteCB_DigitalDisplay_Time(struct Sprite *sprite) { case 0: sprite->x -= 4; - if (sprite->x <= 0xd0) + if (sprite->x <= DISPLAY_WIDTH - 32) { - sprite->x = 0xd0; + sprite->x = DISPLAY_WIDTH - 32; sprite->sState++; } break; @@ -4712,7 +4712,7 @@ static void SpriteCB_DigitalDisplay_Time(struct Sprite *sprite) break; case 2: sprite->x -= 4; - if (sprite->x <= 0x90) + if (sprite->x <= 144) sprite->sState++; break; case 3: @@ -4738,9 +4738,9 @@ static void SpriteCB_DigitalDisplay_ReelTimeNumber(struct Sprite *sprite) break; case 2: sprite->x += 4; - if (sprite->x >= 0xd0) + if (sprite->x >= DISPLAY_WIDTH - 32) { - sprite->x = 0xd0; + sprite->x = DISPLAY_WIDTH - 32; sprite->sState++; } break; @@ -4750,7 +4750,7 @@ static void SpriteCB_DigitalDisplay_ReelTimeNumber(struct Sprite *sprite) break; case 4: sprite->x += 4; - if (sprite->x >= 0xf8) + if (sprite->x >= DISPLAY_WIDTH + 8) sprite->sState++; break; case 5: @@ -7853,7 +7853,7 @@ static const u16 sUnusedColors[] = RGB(27, 27, 27), RGB(8, 11, 26), RGB(11, 21, 13), - RGB(31, 31, 31), + RGB_WHITE, RGB(16, 26, 21), RGB(0, 22, 31), RGB(26, 21, 0), diff --git a/src/start_menu.c b/src/start_menu.c index ea8123ef9a2e..0fbbfe0417a6 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -140,7 +140,15 @@ static void Task_SaveAfterLinkBattle(u8 taskId); static void Task_WaitForBattleTowerLinkSave(u8 taskId); static bool8 FieldCB_ReturnToFieldStartMenu(void); -static const struct WindowTemplate sSafariBallsWindowTemplate = {0, 1, 1, 9, 4, 0xF, 8}; +static const struct WindowTemplate sWindowTemplate_SafariBalls = { + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 1, + .width = 9, + .height = 4, + .paletteNum = 15, + .baseBlock = 0x8 +}; static const u8 *const sPyramidFloorNames[FRONTIER_STAGES_PER_CHALLENGE + 1] = { @@ -154,8 +162,25 @@ static const u8 *const sPyramidFloorNames[FRONTIER_STAGES_PER_CHALLENGE + 1] = gText_Peak }; -static const struct WindowTemplate sPyramidFloorWindowTemplate_2 = {0, 1, 1, 0xA, 4, 0xF, 8}; -static const struct WindowTemplate sPyramidFloorWindowTemplate_1 = {0, 1, 1, 0xC, 4, 0xF, 8}; +static const struct WindowTemplate sWindowTemplate_PyramidFloor = { + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 1, + .width = 10, + .height = 4, + .paletteNum = 15, + .baseBlock = 0x8 +}; + +static const struct WindowTemplate sWindowTemplate_PyramidPeak = { + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 1, + .width = 12, + .height = 4, + .paletteNum = 15, + .baseBlock = 0x8 +}; static const u8 gText_MenuDebug[] = _("DEBUG"); @@ -409,7 +434,7 @@ static void BuildMultiPartnerRoomStartMenu(void) static void ShowSafariBallsWindow(void) { - sSafariBallsWindowId = AddWindow(&sSafariBallsWindowTemplate); + sSafariBallsWindowId = AddWindow(&sWindowTemplate_SafariBalls); PutWindowTilemap(sSafariBallsWindowId); DrawStdWindowFrame(sSafariBallsWindowId, FALSE); ConvertIntToDecimalStringN(gStringVar1, gNumSafariBalls, STR_CONV_MODE_RIGHT_ALIGN, 2); @@ -421,9 +446,9 @@ static void ShowSafariBallsWindow(void) static void ShowPyramidFloorWindow(void) { if (gSaveBlock2Ptr->frontier.curChallengeBattleNum == FRONTIER_STAGES_PER_CHALLENGE) - sBattlePyramidFloorWindowId = AddWindow(&sPyramidFloorWindowTemplate_1); + sBattlePyramidFloorWindowId = AddWindow(&sWindowTemplate_PyramidPeak); else - sBattlePyramidFloorWindowId = AddWindow(&sPyramidFloorWindowTemplate_2); + sBattlePyramidFloorWindowId = AddWindow(&sWindowTemplate_PyramidFloor); PutWindowTilemap(sBattlePyramidFloorWindowId); DrawStdWindowFrame(sBattlePyramidFloorWindowId, FALSE); diff --git a/src/starter_choose.c b/src/starter_choose.c index 3d5291e88775..39de696e97ba 100644 --- a/src/starter_choose.c +++ b/src/starter_choose.c @@ -577,7 +577,7 @@ static void CreateStarterPokemonLabel(u8 selection) u16 species = GetStarterPokemon(selection); CopyMonCategoryText(SpeciesToNationalPokedexNum(species), categoryText); - speciesName = gSpeciesNames[species]; + speciesName = GetSpeciesName(species); winTemplate = sWindowTemplate_StarterLabel; winTemplate.tilemapLeft = sStarterLabelCoords[selection][0]; diff --git a/src/strings.c b/src/strings.c index eb7bb8ba1f92..f9137c4f151d 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1831,3 +1831,5 @@ const u8 gText_Answer[] = _("ANSWER"); const u8 gText_PokeBalls[] = _("POKé BALLS"); const u8 gText_Berry[] = _("BERRY"); const u8 gText_Berries[] = _("BERRIES"); +const u8 gText_ExpShareOn[] = _("The Exp. Share has been turned on.{PAUSE_UNTIL_PRESS}"); +const u8 gText_ExpShareOff[] = _("The Exp. Share has been turned off.{PAUSE_UNTIL_PRESS}"); diff --git a/src/title_screen.c b/src/title_screen.c index bb73df5bc5b7..87bf0d970ea5 100644 --- a/src/title_screen.c +++ b/src/title_screen.c @@ -584,7 +584,7 @@ void CB2_InitTitleScreen(void) gMain.state = 4; break; case 4: - PanFadeAndZoomScreen(0x78, 0x50, 0x100, 0); + PanFadeAndZoomScreen(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, 0x100, 0); SetGpuReg(REG_OFFSET_BG2X_L, -29 * 256); SetGpuReg(REG_OFFSET_BG2X_H, -1); SetGpuReg(REG_OFFSET_BG2Y_L, -32 * 256); diff --git a/src/trade.c b/src/trade.c index b09cc5af734f..4b98a1a07660 100644 --- a/src/trade.c +++ b/src/trade.c @@ -1165,7 +1165,7 @@ static bool8 BufferTradeParties(void) GetMonData(mon, MON_DATA_NICKNAME, name); if (!StringCompareWithoutExtCtrlCodes(name, sText_ShedinjaJP)) - SetMonData(mon, MON_DATA_NICKNAME, gSpeciesNames[SPECIES_SHEDINJA]); + SetMonData(mon, MON_DATA_NICKNAME, GetSpeciesName(SPECIES_SHEDINJA)); } } } @@ -1864,7 +1864,7 @@ static void SetSelectedMon(u8 cursorPosition) static void DrawSelectedMonScreen(u8 whichParty) { s8 nameStringWidth; - u8 nickname[20]; + u8 nickname[POKEMON_NAME_BUFFER_SIZE]; u8 movesString[56]; u8 i; u8 partyIdx; @@ -1950,7 +1950,7 @@ static void DrawSelectedMonScreen(u8 whichParty) static u8 GetMonNicknameWidth(u8 *str, u8 whichParty, u8 partyIdx) { - u8 nickname[POKEMON_NAME_LENGTH]; + u8 nickname[POKEMON_NAME_LENGTH + 1]; if (whichParty == TRADE_PLAYER) GetMonData(&gPlayerParty[partyIdx], MON_DATA_NICKNAME, nickname); @@ -2006,8 +2006,8 @@ static void PrintPartyMonNickname(u8 whichParty, u8 windowId, u8 *nickname) static void PrintPartyNicknames(u8 whichParty) { u8 i; - u8 nickname[20]; - u8 str[32]; + u8 nickname[POKEMON_NAME_BUFFER_SIZE]; + u8 str[max(32, POKEMON_NAME_BUFFER_SIZE)]; struct Pokemon *party = (whichParty == TRADE_PLAYER) ? gPlayerParty : gEnemyParty; for (i = 0; i < sTradeMenu->partyCounts[whichParty]; i++) @@ -2023,7 +2023,7 @@ static void PrintLevelAndGender(u8 whichParty, u8 monIdx, u8 x, u8 y, u8 width, u8 level; u32 symbolTile; u8 gender; - u8 nickname[POKEMON_NAME_LENGTH]; + u8 nickname[POKEMON_NAME_LENGTH + 1]; CopyToBgTilemapBufferRect_ChangePalette(1, gTradeMenuMonBox_Tilemap, width, height, 6, 3, 0); CopyBgTilemapBufferToVram(1); @@ -3339,7 +3339,7 @@ static void LoadTradeSequenceSpriteSheetsAndPalettes(void) static void BufferTradeSceneStrings(void) { u8 mpId; - u8 name[20]; + u8 name[POKEMON_NAME_BUFFER_SIZE]; const struct InGameTrade *ingameTrade; if (sTradeAnim->isLinkTrade) @@ -4541,18 +4541,18 @@ static void SpriteCB_BouncingPokeballArrive(struct Sprite *sprite) u16 GetInGameTradeSpeciesInfo(void) { const struct InGameTrade *inGameTrade = &sIngameTrades[gSpecialVar_0x8004]; - StringCopy(gStringVar1, gSpeciesNames[inGameTrade->requestedSpecies]); - StringCopy(gStringVar2, gSpeciesNames[inGameTrade->species]); + StringCopy(gStringVar1, GetSpeciesName(inGameTrade->requestedSpecies)); + StringCopy(gStringVar2, GetSpeciesName(inGameTrade->species)); return inGameTrade->requestedSpecies; } static void BufferInGameTradeMonName(void) { - u8 nickname[32]; + u8 nickname[max(32, POKEMON_NAME_BUFFER_SIZE)]; const struct InGameTrade *inGameTrade = &sIngameTrades[gSpecialVar_0x8004]; GetMonData(&gPlayerParty[gSpecialVar_0x8005], MON_DATA_NICKNAME, nickname); StringCopy_Nickname(gStringVar1, nickname); - StringCopy(gStringVar2, gSpeciesNames[inGameTrade->species]); + StringCopy(gStringVar2, GetSpeciesName(inGameTrade->species)); } static void CreateInGameTradePokemonInternal(u8 whichPlayerMon, u8 whichInGameTrade) diff --git a/src/trainer_hill.c b/src/trainer_hill.c index 2995a2cb29c4..419133e28e61 100644 --- a/src/trainer_hill.c +++ b/src/trainer_hill.c @@ -146,22 +146,22 @@ static const u16 sPrizeListLuxuryBall1[] = {ITEM_LUXURY_BALL, ITEM_ETHER, I static const u16 sPrizeListMaxRevive1[] = {ITEM_MAX_REVIVE, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; static const u16 sPrizeListMaxEther1[] = {ITEM_MAX_ETHER, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; static const u16 sPrizeListElixir1[] = {ITEM_ELIXIR, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 sPrizeListRoar[] = {ITEM_TM05_ROAR, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 sPrizeListSludgeBomb[] = {ITEM_TM36_SLUDGE_BOMB, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 sPrizeListToxic[] = {ITEM_TM06_TOXIC, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 sPrizeListSunnyDay[] = {ITEM_TM11_SUNNY_DAY, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 sPrizeListEarthQuake[] = {ITEM_TM26_EARTHQUAKE, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListRoar[] = {ITEM_TM_ROAR, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListSludgeBomb[] = {ITEM_TM_SLUDGE_BOMB, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListToxic[] = {ITEM_TM_TOXIC, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListSunnyDay[] = {ITEM_TM_SUNNY_DAY, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListEarthQuake[] = {ITEM_TM_EARTHQUAKE, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; static const u16 sPrizeListRareCandy2[] = {ITEM_RARE_CANDY, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; static const u16 sPrizeListLuxuryBall2[] = {ITEM_LUXURY_BALL, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; static const u16 sPrizeListMaxRevive2[] = {ITEM_MAX_REVIVE, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; static const u16 sPrizeListMaxEther2[] = {ITEM_MAX_ETHER, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; static const u16 sPrizeListElixir2[] = {ITEM_ELIXIR, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 sPrizeListBrickBreak[] = {ITEM_TM31_BRICK_BREAK, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 sPrizeListTorment[] = {ITEM_TM41_TORMENT, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 sPrizeListSkillSwap[] = {ITEM_TM48_SKILL_SWAP, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 sPrizeListGigaDrain[] = {ITEM_TM19_GIGA_DRAIN, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 sPrizeListAttract[] = {ITEM_TM45_ATTRACT, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListBrickBreak[] = {ITEM_TM_BRICK_BREAK, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListTorment[] = {ITEM_TM_TORMENT, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListSkillSwap[] = {ITEM_TM_SKILL_SWAP, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListGigaDrain[] = {ITEM_TM_GIGA_DRAIN, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListAttract[] = {ITEM_TM_ATTRACT, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; static const u16 *const sPrizeLists1[NUM_TRAINER_HILL_PRIZE_LISTS] = { @@ -1066,10 +1066,10 @@ static u16 GetPrizeItemId(void) // Which prize is given from the list depends on the time scored. // The prize for any time after 12 minutes is the same in every list. // The prizes for a time under 12 minutes are: - // - ITEM_TM11_SUNNY_DAY (Normal) + // - ITEM_TM_SUNNY_DAY (Normal) // - ITEM_ELIXIR (Variety) - // - ITEM_TM19_GIGA_DRAIN (Unique) - // - ITEM_TM31_BRICK_BREAK (Expert) + // - ITEM_TM_GIGA_DRAIN (Unique) + // - ITEM_TM_BRICK_BREAK (Expert) // As an additional note, if players were allowed to enter a Trainer Hill challenge before // entering the Hall of Fame, there would be 1 additional prize possibility (ITEM_MAX_ETHER) // as Normal / Unique modes would use sPrizeListSets[0][3] / sPrizeListSets[1][3] respectively. diff --git a/src/trainer_see.c b/src/trainer_see.c index 8d3450628848..6e1d41055ce0 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -131,11 +131,11 @@ static const struct SpriteFrameImage sSpriteImageTable_ExclamationQuestionMark[] { { .data = sEmotion_ExclamationMarkGfx, - .size = 0x80 + .size = sizeof(sEmotion_ExclamationMarkGfx) }, { .data = sEmotion_QuestionMarkGfx, - .size = 0x80 + .size = sizeof(sEmotion_QuestionMarkGfx) } }; @@ -143,7 +143,7 @@ static const struct SpriteFrameImage sSpriteImageTable_HeartIcon[] = { { .data = sEmotion_HeartGfx, - .size = 0x80 + .size = sizeof(sEmotion_HeartGfx) } }; diff --git a/src/tv.c b/src/tv.c index 4400a56c292c..c96703848be8 100644 --- a/src/tv.c +++ b/src/tv.c @@ -45,7 +45,6 @@ #include "constants/metatile_labels.h" #include "constants/moves.h" #include "constants/region_map_sections.h" -#include "constants/script_menu.h" #define LAST_TVSHOW_IDX (TV_SHOWS_COUNT - 1) @@ -941,9 +940,8 @@ void GabbyAndTyBeforeInterview(void) gSaveBlock1Ptr->gabbyAndTyData.mon2 = gBattleResults.playerMon2Species; gSaveBlock1Ptr->gabbyAndTyData.lastMove = gBattleResults.lastUsedMovePlayer; if (gSaveBlock1Ptr->gabbyAndTyData.battleNum != 0xFF) - { gSaveBlock1Ptr->gabbyAndTyData.battleNum++; - } + gSaveBlock1Ptr->gabbyAndTyData.battleTookMoreThanOneTurn = gBattleResults.playerMonWasDamaged; if (gBattleResults.playerFaintCounter != 0) @@ -967,9 +965,7 @@ void GabbyAndTyBeforeInterview(void) TakeGabbyAndTyOffTheAir(); if (gSaveBlock1Ptr->gabbyAndTyData.lastMove == MOVE_NONE) - { - FlagSet(FLAG_TEMP_1); - } + FlagSet(FLAG_TEMP_SKIP_GABBY_INTERVIEW); } void GabbyAndTyAfterInterview(void) @@ -1116,7 +1112,7 @@ void TryPutPokemonTodayOnAir(void) else { InitWorldOfMastersShowAttempt(); - if (!rbernoulli(1, 1) && StringCompare(gSpeciesNames[gBattleResults.caughtMonSpecies], gBattleResults.caughtMonNick)) + if (!rbernoulli(1, 1) && StringCompare(GetSpeciesName(gBattleResults.caughtMonSpecies), gBattleResults.caughtMonNick)) { sCurTVShowSlot = FindFirstEmptyRecordMixTVShowSlot(gSaveBlock1Ptr->tvShows); if (sCurTVShowSlot != -1 && IsRecordMixShowAlreadySpawned(TVSHOW_POKEMON_TODAY_CAUGHT, FALSE) != TRUE) @@ -1467,8 +1463,8 @@ static void InterviewAfter_BravoTrainerBattleTowerProfile(void) TVShow *show = &gSaveBlock1Ptr->tvShows[sCurTVShowSlot]; show->bravoTrainerTower.kind = TVSHOW_BRAVO_TRAINER_BATTLE_TOWER_PROFILE; show->bravoTrainerTower.active = TRUE; - StringCopy(show->bravoTrainerTower.trainerName, gSaveBlock2Ptr->playerName); - StringCopy(show->bravoTrainerTower.pokemonName, gSaveBlock2Ptr->frontier.towerInterview.opponentName); + StringCopy(show->bravoTrainerTower.playerName, gSaveBlock2Ptr->playerName); + StringCopy(show->bravoTrainerTower.opponentName, gSaveBlock2Ptr->frontier.towerInterview.opponentName); show->bravoTrainerTower.species = gSaveBlock2Ptr->frontier.towerInterview.playerSpecies; show->bravoTrainerTower.defeatedSpecies = gSaveBlock2Ptr->frontier.towerInterview.opponentSpecies; show->bravoTrainerTower.numFights = GetCurrentBattleTowerWinStreak(gSaveBlock2Ptr->frontier.towerLvlMode, 0); @@ -1479,11 +1475,11 @@ static void InterviewAfter_BravoTrainerBattleTowerProfile(void) show->bravoTrainerTower.btLevel = FRONTIER_MAX_LEVEL_OPEN; show->bravoTrainerTower.interviewResponse = gSpecialVar_0x8004; StorePlayerIdInNormalShow(show); - show->bravoTrainerTower.language = gGameLanguage; - if (show->bravoTrainerTower.language == LANGUAGE_JAPANESE || gSaveBlock2Ptr->frontier.towerInterview.opponentLanguage == LANGUAGE_JAPANESE) - show->bravoTrainerTower.pokemonNameLanguage = LANGUAGE_JAPANESE; + show->bravoTrainerTower.playerLanguage = gGameLanguage; + if (show->bravoTrainerTower.playerLanguage == LANGUAGE_JAPANESE || gSaveBlock2Ptr->frontier.towerInterview.opponentLanguage == LANGUAGE_JAPANESE) + show->bravoTrainerTower.opponentLanguage = LANGUAGE_JAPANESE; else - show->bravoTrainerTower.pokemonNameLanguage = gSaveBlock2Ptr->frontier.towerInterview.opponentLanguage; + show->bravoTrainerTower.opponentLanguage = gSaveBlock2Ptr->frontier.towerInterview.opponentLanguage; } void TryPutSmartShopperOnAir(void) @@ -2914,7 +2910,7 @@ static void InterviewBefore_FanClubLetter(void) TryReplaceOldTVShowOfKind(TVSHOW_FAN_CLUB_LETTER); if (!gSpecialVar_Result) { - StringCopy(gStringVar1, gSpeciesNames[GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_SPECIES, NULL)]); + StringCopy(gStringVar1, GetSpeciesName(GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_SPECIES, NULL))); InitializeEasyChatWordArray(gSaveBlock1Ptr->tvShows[sCurTVShowSlot].fanclubLetter.words, ARRAY_COUNT(gSaveBlock1Ptr->tvShows[sCurTVShowSlot].fanclubLetter.words)); } @@ -2935,7 +2931,7 @@ static void InterviewBefore_PkmnFanClubOpinions(void) TryReplaceOldTVShowOfKind(TVSHOW_PKMN_FAN_CLUB_OPINIONS); if (!gSpecialVar_Result) { - StringCopy(gStringVar1, gSpeciesNames[GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_SPECIES, NULL)]); + StringCopy(gStringVar1, GetSpeciesName(GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_SPECIES, NULL))); GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_NICKNAME, gStringVar2); StringGet_Nickname(gStringVar2); InitializeEasyChatWordArray(gSaveBlock1Ptr->tvShows[sCurTVShowSlot].fanclubOpinions.words, @@ -2995,7 +2991,7 @@ static bool8 IsPartyMonNicknamedOrNotEnglish(u8 monIdx) pokemon = &gPlayerParty[monIdx]; GetMonData(pokemon, MON_DATA_NICKNAME, gStringVar1); language = GetMonData(pokemon, MON_DATA_LANGUAGE, &language); - if (language == GAME_LANGUAGE && !StringCompare(gSpeciesNames[GetMonData(pokemon, MON_DATA_SPECIES, NULL)], gStringVar1)) + if (language == GAME_LANGUAGE && !StringCompare(GetSpeciesName(GetMonData(pokemon, MON_DATA_SPECIES, NULL)), gStringVar1)) return FALSE; return TRUE; @@ -3059,7 +3055,7 @@ static void CompactTVShowArray(TVShow *shows) static u16 GetRandomDifferentSpeciesAndNameSeenByPlayer(u8 varIdx, u16 excludedSpecies) { u16 species = GetRandomDifferentSpeciesSeenByPlayer(excludedSpecies); - StringCopy(gTVStringVarPtrs[varIdx], gSpeciesNames[species]); + StringCopy(gTVStringVarPtrs[varIdx], GetSpeciesName(species)); return species; } @@ -3221,24 +3217,24 @@ static void GetNicknameSubstring(u8 varIdx, u8 whichPosition, u8 charParam, u16 } else { - strlen = StringLength(gSpeciesNames[species]); + strlen = StringLength(GetSpeciesName(species)); if (charParam == 0) { - buff[0] = gSpeciesNames[species][whichPosition]; + buff[0] = GetSpeciesName(species)[whichPosition]; } else if (charParam == 1) { - buff[0] = gSpeciesNames[species][strlen - whichPosition]; + buff[0] = GetSpeciesName(species)[strlen - whichPosition]; } else if (charParam == 2) { - buff[0] = gSpeciesNames[species][whichPosition]; - buff[1] = gSpeciesNames[species][whichPosition + 1]; + buff[0] = GetSpeciesName(species)[whichPosition]; + buff[1] = GetSpeciesName(species)[whichPosition + 1]; } else { - buff[0] = gSpeciesNames[species][strlen - (whichPosition + 2)]; - buff[1] = gSpeciesNames[species][strlen - (whichPosition + 1)]; + buff[0] = GetSpeciesName(species)[strlen - (whichPosition + 2)]; + buff[1] = GetSpeciesName(species)[strlen - (whichPosition + 1)]; } } StringCopy(gTVStringVarPtrs[varIdx], buff); @@ -3365,6 +3361,7 @@ u8 CheckForPlayersHouseNews(void) void GetMomOrDadStringForTVMessage(void) { + // If the player is checking the TV in their house it will only refer to their Mom. if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(LITTLEROOT_TOWN_BRENDANS_HOUSE_1F)) { if (gSaveBlock2Ptr->playerGender == MALE) @@ -3394,6 +3391,7 @@ void GetMomOrDadStringForTVMessage(void) } else if (VarGet(VAR_TEMP_3) > 2) { + // Should only happen if VAR_TEMP_3 is already in use by something else. if (VarGet(VAR_TEMP_3) % 2 == 0) StringCopy(gStringVar1, gText_Mom); else @@ -3401,6 +3399,9 @@ void GetMomOrDadStringForTVMessage(void) } else { + // Randomly choose whether to refer to Mom or Dad. + // NOTE: Because of this, any map that has a TV in it shouldn't rely on VAR_TEMP_3. + // If its value is 0, checking the TV will set it to 1 or 2. if (Random() % 2 != 0) { StringCopy(gStringVar1, gText_Mom); @@ -3970,8 +3971,8 @@ static void TranslateShowNames(TVShow *show, u32 language) break; case TVSHOW_BRAVO_TRAINER_BATTLE_TOWER_PROFILE: shows[5] = &show[i]; - SetStrLanguage(shows[5]->bravoTrainerTower.trainerName, shows[5]->bravoTrainerTower.language, language); - SetStrLanguage(shows[5]->bravoTrainerTower.pokemonName, shows[5]->bravoTrainerTower.pokemonNameLanguage, language); + SetStrLanguage(shows[5]->bravoTrainerTower.playerName, shows[5]->bravoTrainerTower.playerLanguage, language); + SetStrLanguage(shows[5]->bravoTrainerTower.opponentName, shows[5]->bravoTrainerTower.opponentLanguage, language); break; case TVSHOW_BRAVO_TRAINER_POKEMON_PROFILE: shows[4] = &show[i]; @@ -4013,8 +4014,8 @@ void SanitizeTVShowsForRuby(TVShow *shows) { if (curShow->bravoTrainerTower.kind == TVSHOW_BRAVO_TRAINER_BATTLE_TOWER_PROFILE) { - if ((curShow->bravoTrainerTower.language == LANGUAGE_JAPANESE && curShow->bravoTrainerTower.pokemonNameLanguage != LANGUAGE_JAPANESE) - || (curShow->bravoTrainerTower.language != LANGUAGE_JAPANESE && curShow->bravoTrainerTower.pokemonNameLanguage == LANGUAGE_JAPANESE)) + if ((curShow->bravoTrainerTower.playerLanguage == LANGUAGE_JAPANESE && curShow->bravoTrainerTower.opponentLanguage != LANGUAGE_JAPANESE) + || (curShow->bravoTrainerTower.playerLanguage != LANGUAGE_JAPANESE && curShow->bravoTrainerTower.opponentLanguage == LANGUAGE_JAPANESE)) memset(curShow, 0, sizeof(TVShow)); } } @@ -4028,10 +4029,10 @@ static void TranslateRubyShows(TVShow *shows) { if (curShow->bravoTrainerTower.kind == TVSHOW_BRAVO_TRAINER_BATTLE_TOWER_PROFILE) { - if (IsStringJapanese(curShow->bravoTrainerTower.pokemonName)) - curShow->bravoTrainerTower.pokemonNameLanguage = LANGUAGE_JAPANESE; + if (IsStringJapanese(curShow->bravoTrainerTower.opponentName)) + curShow->bravoTrainerTower.opponentLanguage = LANGUAGE_JAPANESE; else - curShow->bravoTrainerTower.pokemonNameLanguage = GAME_LANGUAGE; + curShow->bravoTrainerTower.opponentLanguage = GAME_LANGUAGE; } } } @@ -4071,8 +4072,8 @@ static void TranslateJapaneseEmeraldShows(TVShow *shows) curShow->bravoTrainer.pokemonNameLanguage = GetStringLanguage(curShow->bravoTrainer.pokemonNickname); break; case TVSHOW_BRAVO_TRAINER_BATTLE_TOWER_PROFILE: - curShow->bravoTrainerTower.language = GetStringLanguage(curShow->bravoTrainerTower.trainerName); - curShow->bravoTrainerTower.pokemonNameLanguage = GetStringLanguage(curShow->bravoTrainerTower.pokemonName); + curShow->bravoTrainerTower.playerLanguage = GetStringLanguage(curShow->bravoTrainerTower.playerName); + curShow->bravoTrainerTower.opponentLanguage = GetStringLanguage(curShow->bravoTrainerTower.opponentName); break; case TVSHOW_CONTEST_LIVE_UPDATES: curShow->contestLiveUpdates.winningTrainerLanguage = GetStringLanguage(curShow->contestLiveUpdates.winningTrainerName); @@ -4291,13 +4292,13 @@ static void DoTVShowBravoTrainerPokemonProfile(void) TVShowConvertInternationalString(gStringVar1, show->bravoTrainer.playerName, show->bravoTrainer.language); CopyContestCategoryToStringVar(1, show->bravoTrainer.contestCategory); CopyContestRankToStringVar(2, show->bravoTrainer.contestRank); - if (!StringCompare(gSpeciesNames[show->bravoTrainer.species], show->bravoTrainer.pokemonNickname)) + if (!StringCompare(GetSpeciesName(show->bravoTrainer.species), show->bravoTrainer.pokemonNickname)) sTVShowState = 8; else sTVShowState = 1; break; case 1: - StringCopy(gStringVar1, gSpeciesNames[show->bravoTrainer.species]); + StringCopy(gStringVar1, GetSpeciesName(show->bravoTrainer.species)); TVShowConvertInternationalString(gStringVar2, show->bravoTrainer.pokemonNickname, show->bravoTrainer.pokemonNameLanguage); CopyContestCategoryToStringVar(2, show->bravoTrainer.contestCategory); sTVShowState = 2; @@ -4331,18 +4332,18 @@ static void DoTVShowBravoTrainerPokemonProfile(void) sTVShowState = 7; break; case 6: - StringCopy(gStringVar1, gSpeciesNames[show->bravoTrainer.species]); + StringCopy(gStringVar1, GetSpeciesName(show->bravoTrainer.species)); StringCopy(gStringVar2, gMoveNames[show->bravoTrainer.move]); CopyEasyChatWord(gStringVar3, show->bravoTrainer.words[1]); sTVShowState = 7; break; case 7: TVShowConvertInternationalString(gStringVar1, show->bravoTrainer.playerName, show->bravoTrainer.language); - StringCopy(gStringVar2, gSpeciesNames[show->bravoTrainer.species]); + StringCopy(gStringVar2, GetSpeciesName(show->bravoTrainer.species)); TVShowDone(); break; case 8: - StringCopy(gStringVar1, gSpeciesNames[show->bravoTrainer.species]); + StringCopy(gStringVar1, GetSpeciesName(show->bravoTrainer.species)); sTVShowState = 2; break; } @@ -4363,8 +4364,8 @@ static void DoTVShowBravoTrainerBattleTower(void) switch(state) { case BRAVOTOWER_STATE_INTRO: - TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.trainerName, show->bravoTrainerTower.language); - StringCopy(gStringVar2, gSpeciesNames[show->bravoTrainerTower.species]); + TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.playerName, show->bravoTrainerTower.playerLanguage); + StringCopy(gStringVar2, GetSpeciesName(show->bravoTrainerTower.species)); if (show->bravoTrainerTower.numFights >= FRONTIER_STAGES_PER_CHALLENGE) sTVShowState = BRAVOTOWER_STATE_NEW_RECORD; else @@ -4384,7 +4385,7 @@ static void DoTVShowBravoTrainerBattleTower(void) sTVShowState = BRAVOTOWER_STATE_LOST_FINAL; break; case BRAVOTOWER_STATE_LOST: - TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.pokemonName, show->bravoTrainerTower.pokemonNameLanguage); + TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.opponentName, show->bravoTrainerTower.opponentLanguage); ConvertIntToDecimalString(1, show->bravoTrainerTower.numFights + 1); if (show->bravoTrainerTower.interviewResponse == 0) sTVShowState = BRAVOTOWER_STATE_SATISFIED; @@ -4392,27 +4393,27 @@ static void DoTVShowBravoTrainerBattleTower(void) sTVShowState = BRAVOTOWER_STATE_UNSATISFIED; break; case BRAVOTOWER_STATE_WON: - TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.pokemonName, show->bravoTrainerTower.pokemonNameLanguage); - StringCopy(gStringVar2, gSpeciesNames[show->bravoTrainerTower.defeatedSpecies]); + TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.opponentName, show->bravoTrainerTower.opponentLanguage); + StringCopy(gStringVar2, GetSpeciesName(show->bravoTrainerTower.defeatedSpecies)); if (show->bravoTrainerTower.interviewResponse == 0) sTVShowState = BRAVOTOWER_STATE_SATISFIED; else sTVShowState = BRAVOTOWER_STATE_UNSATISFIED; break; case BRAVOTOWER_STATE_LOST_FINAL: - TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.pokemonName, show->bravoTrainerTower.pokemonNameLanguage); - StringCopy(gStringVar2, gSpeciesNames[show->bravoTrainerTower.defeatedSpecies]); + TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.opponentName, show->bravoTrainerTower.opponentLanguage); + StringCopy(gStringVar2, GetSpeciesName(show->bravoTrainerTower.defeatedSpecies)); if (show->bravoTrainerTower.interviewResponse == 0) sTVShowState = BRAVOTOWER_STATE_SATISFIED; else sTVShowState = BRAVOTOWER_STATE_UNSATISFIED; break; case BRAVOTOWER_STATE_SATISFIED: - TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.pokemonName, show->bravoTrainerTower.pokemonNameLanguage); + TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.opponentName, show->bravoTrainerTower.opponentLanguage); sTVShowState = BRAVOTOWER_STATE_RESPONSE; break; case BRAVOTOWER_STATE_UNSATISFIED: - TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.pokemonName, show->bravoTrainerTower.pokemonNameLanguage); + TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.opponentName, show->bravoTrainerTower.opponentLanguage); sTVShowState = BRAVOTOWER_STATE_RESPONSE; break; case BRAVOTOWER_STATE_UNUSED_1: @@ -4421,7 +4422,7 @@ static void DoTVShowBravoTrainerBattleTower(void) case BRAVOTOWER_STATE_UNUSED_2: case BRAVOTOWER_STATE_UNUSED_3: case BRAVOTOWER_STATE_UNUSED_4: - TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.trainerName, show->bravoTrainerTower.language); + TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.playerName, show->bravoTrainerTower.playerLanguage); sTVShowState = BRAVOTOWER_STATE_RESPONSE; break; case BRAVOTOWER_STATE_RESPONSE: @@ -4434,13 +4435,13 @@ static void DoTVShowBravoTrainerBattleTower(void) case BRAVOTOWER_STATE_RESPONSE_SATISFIED: case BRAVOTOWER_STATE_RESPONSE_UNSATISFIED: CopyEasyChatWord(gStringVar1, show->bravoTrainerTower.words[0]); - TVShowConvertInternationalString(gStringVar2, show->bravoTrainerTower.trainerName, show->bravoTrainerTower.language); - TVShowConvertInternationalString(gStringVar3, show->bravoTrainerTower.pokemonName, show->bravoTrainerTower.pokemonNameLanguage); + TVShowConvertInternationalString(gStringVar2, show->bravoTrainerTower.playerName, show->bravoTrainerTower.playerLanguage); + TVShowConvertInternationalString(gStringVar3, show->bravoTrainerTower.opponentName, show->bravoTrainerTower.opponentLanguage); sTVShowState = BRAVOTOWER_STATE_OUTRO; break; case BRAVOTOWER_STATE_OUTRO: - TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.trainerName, show->bravoTrainerTower.language); - StringCopy(gStringVar2, gSpeciesNames[show->bravoTrainerTower.species]); + TVShowConvertInternationalString(gStringVar1, show->bravoTrainerTower.playerName, show->bravoTrainerTower.playerLanguage); + StringCopy(gStringVar2, GetSpeciesName(show->bravoTrainerTower.species)); TVShowDone(); break; } @@ -4555,7 +4556,7 @@ static void DoTVShowTheNameRaterShow(void) { case 0: TVShowConvertInternationalString(gStringVar1, show->nameRaterShow.trainerName, show->nameRaterShow.language); - StringCopy(gStringVar2, gSpeciesNames[show->nameRaterShow.species]); + StringCopy(gStringVar2, GetSpeciesName(show->nameRaterShow.species)); TVShowConvertInternationalString(gStringVar3, show->nameRaterShow.pokemonName, show->nameRaterShow.pokemonNameLanguage); sTVShowState = GetRandomNameRaterStateFromName(show) + 1; break; @@ -4603,7 +4604,7 @@ static void DoTVShowTheNameRaterShow(void) break; case 15: GetNicknameSubstring(0, 0, 2, 1, 0, show); - StringCopy(gStringVar2, gSpeciesNames[show->nameRaterShow.species]); + StringCopy(gStringVar2, GetSpeciesName(show->nameRaterShow.species)); GetNicknameSubstring(2, 0, 3, 2, show->nameRaterShow.species, show); sTVShowState = 16; break; @@ -4614,7 +4615,7 @@ static void DoTVShowTheNameRaterShow(void) break; case 17: GetNicknameSubstring(0, 0, 2, 1, 0, show); - StringCopy(gStringVar2, gSpeciesNames[show->nameRaterShow.randomSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->nameRaterShow.randomSpecies)); GetNicknameSubstring(2, 0, 3, 2, show->nameRaterShow.randomSpecies, show); sTVShowState = 18; break; @@ -4641,7 +4642,7 @@ static void DoTVShowPokemonTodaySuccessfulCapture(void) { case 0: TVShowConvertInternationalString(gStringVar1, show->pokemonToday.playerName, show->pokemonToday.language); - StringCopy(gStringVar2, gSpeciesNames[show->pokemonToday.species]); + StringCopy(gStringVar2, GetSpeciesName(show->pokemonToday.species)); TVShowConvertInternationalString(gStringVar3, show->pokemonToday.nickname, show->pokemonToday.language2); if (show->pokemonToday.ball == ITEM_MASTER_BALL) sTVShowState = 5; @@ -4661,7 +4662,7 @@ static void DoTVShowPokemonTodaySuccessfulCapture(void) break; case 3: TVShowConvertInternationalString(gStringVar1, show->pokemonToday.playerName, show->pokemonToday.language); - StringCopy(gStringVar2, gSpeciesNames[show->pokemonToday.species]); + StringCopy(gStringVar2, GetSpeciesName(show->pokemonToday.species)); TVShowConvertInternationalString(gStringVar3, show->pokemonToday.nickname, show->pokemonToday.language2); sTVShowState = 6; break; @@ -4670,25 +4671,25 @@ static void DoTVShowPokemonTodaySuccessfulCapture(void) break; case 5: TVShowConvertInternationalString(gStringVar1, show->pokemonToday.playerName, show->pokemonToday.language); - StringCopy(gStringVar2, gSpeciesNames[show->pokemonToday.species]); + StringCopy(gStringVar2, GetSpeciesName(show->pokemonToday.species)); sTVShowState = 6; break; case 6: TVShowConvertInternationalString(gStringVar1, show->pokemonToday.playerName, show->pokemonToday.language); - StringCopy(gStringVar2, gSpeciesNames[show->pokemonToday.species]); + StringCopy(gStringVar2, GetSpeciesName(show->pokemonToday.species)); TVShowConvertInternationalString(gStringVar3, show->pokemonToday.nickname, show->pokemonToday.language2); sTVShowState += 1 + (Random() % 4); break; case 7: case 8: - StringCopy(gStringVar1, gSpeciesNames[show->pokemonToday.species]); + StringCopy(gStringVar1, GetSpeciesName(show->pokemonToday.species)); TVShowConvertInternationalString(gStringVar2, show->pokemonToday.nickname, show->pokemonToday.language2); GetRandomDifferentSpeciesAndNameSeenByPlayer(2, show->pokemonToday.species); sTVShowState = 11; break; case 9: case 10: - StringCopy(gStringVar1, gSpeciesNames[show->pokemonToday.species]); + StringCopy(gStringVar1, GetSpeciesName(show->pokemonToday.species)); TVShowConvertInternationalString(gStringVar2, show->pokemonToday.nickname, show->pokemonToday.language2); sTVShowState = 11; break; @@ -4711,13 +4712,13 @@ static void DoTVShowPokemonTodayFailedCapture(void) { case 0: TVShowConvertInternationalString(gStringVar1, show->pokemonTodayFailed.playerName, show->pokemonTodayFailed.language); - StringCopy(gStringVar2, gSpeciesNames[show->pokemonTodayFailed.species]); + StringCopy(gStringVar2, GetSpeciesName(show->pokemonTodayFailed.species)); sTVShowState = 1; break; case 1: TVShowConvertInternationalString(gStringVar1, show->pokemonTodayFailed.playerName, show->pokemonTodayFailed.language); GetMapName(gStringVar2, show->pokemonTodayFailed.location, 0); - StringCopy(gStringVar3, gSpeciesNames[show->pokemonTodayFailed.species2]); + StringCopy(gStringVar3, GetSpeciesName(show->pokemonTodayFailed.species2)); if (show->pokemonTodayFailed.outcome == 1) sTVShowState = 3; else @@ -4757,7 +4758,7 @@ static void DoTVShowPokemonFanClubLetter(void) { case 0: TVShowConvertInternationalString(gStringVar1, show->fanclubLetter.playerName, show->fanclubLetter.language); - StringCopy(gStringVar2, gSpeciesNames[show->fanclubLetter.species]); + StringCopy(gStringVar2, GetSpeciesName(show->fanclubLetter.species)); sTVShowState = 50; break; case 1: @@ -4845,7 +4846,7 @@ static void DoTVShowPokemonFanClubOpinions(void) { case 0: TVShowConvertInternationalString(gStringVar1, show->fanclubOpinions.playerName, show->fanclubOpinions.language); - StringCopy(gStringVar2, gSpeciesNames[show->fanclubOpinions.species]); + StringCopy(gStringVar2, GetSpeciesName(show->fanclubOpinions.species)); TVShowConvertInternationalString(gStringVar3, show->fanclubOpinions.nickname, show->fanclubOpinions.pokemonNameLanguage); sTVShowState = show->fanclubOpinions.questionAsked + 1; break; @@ -4853,7 +4854,7 @@ static void DoTVShowPokemonFanClubOpinions(void) case 2: case 3: TVShowConvertInternationalString(gStringVar1, show->fanclubOpinions.playerName, show->fanclubOpinions.language); - StringCopy(gStringVar2, gSpeciesNames[show->fanclubOpinions.species]); + StringCopy(gStringVar2, GetSpeciesName(show->fanclubOpinions.species)); CopyEasyChatWord(gStringVar3, show->fanclubOpinions.words[0]); sTVShowState = 4; break; @@ -4877,7 +4878,7 @@ static void DoTVShowPokemonNewsMassOutbreak(void) show = &gSaveBlock1Ptr->tvShows[gSpecialVar_0x8004]; GetMapName(gStringVar1, show->massOutbreak.locationMapNum, 0); - StringCopy(gStringVar2, gSpeciesNames[show->massOutbreak.species]); + StringCopy(gStringVar2, GetSpeciesName(show->massOutbreak.species)); TVShowDone(); StartMassOutbreak(); ShowFieldMessage(sTVMassOutbreakTextGroup[sTVShowState]); @@ -4901,7 +4902,7 @@ static void DoTVShowPokemonContestLiveUpdates(void) { case CONTESTLIVE_STATE_INTRO: BufferContestName(gStringVar1, show->contestLiveUpdates.category); - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); TVShowConvertInternationalString(gStringVar3, show->contestLiveUpdates.winningTrainerName, show->contestLiveUpdates.winningTrainerLanguage); if (show->contestLiveUpdates.round1Placing == show->contestLiveUpdates.round2Placing) { @@ -4920,7 +4921,7 @@ static void DoTVShowPokemonContestLiveUpdates(void) } break; case CONTESTLIVE_STATE_WON_BOTH_ROUNDS: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); switch (show->contestLiveUpdates.winnerAppealFlag) { case CONTESTLIVE_FLAG_EXCITING_APPEAL: @@ -4950,7 +4951,7 @@ static void DoTVShowPokemonContestLiveUpdates(void) } break; case CONTESTLIVE_STATE_BETTER_ROUND2: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); switch (show->contestLiveUpdates.winnerAppealFlag) { case CONTESTLIVE_FLAG_EXCITING_APPEAL: @@ -4980,7 +4981,7 @@ static void DoTVShowPokemonContestLiveUpdates(void) } break; case CONTESTLIVE_STATE_EQUAL_ROUNDS: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); TVShowConvertInternationalString(gStringVar3, show->contestLiveUpdates.winningTrainerName, show->contestLiveUpdates.winningTrainerLanguage); switch (show->contestLiveUpdates.winnerAppealFlag) { @@ -5029,7 +5030,7 @@ static void DoTVShowPokemonContestLiveUpdates(void) StringCopy(gStringVar1, gText_Tough); break; } - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); switch (show->contestLiveUpdates.winnerAppealFlag) { case CONTESTLIVE_FLAG_EXCITING_APPEAL: @@ -5059,19 +5060,19 @@ static void DoTVShowPokemonContestLiveUpdates(void) } break; case CONTESTLIVE_STATE_GOT_NERVOUS: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; break; case CONTESTLIVE_STATE_STARTLED_OTHER: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; break; case CONTESTLIVE_STATE_USED_COMBO: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; break; case CONTESTLIVE_STATE_EXCITING_APPEAL: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); switch (show->contestLiveUpdates.category) { case CONTEST_CATEGORY_COOL: @@ -5092,27 +5093,27 @@ static void DoTVShowPokemonContestLiveUpdates(void) } break; case CONTESTLIVE_STATE_COOL: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; break; case CONTESTLIVE_STATE_BEAUTIFUL: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; break; case CONTESTLIVE_STATE_CUTE: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; break; case CONTESTLIVE_STATE_SMART: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; break; case CONTESTLIVE_STATE_TOUGH: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; break; case CONTESTLIVE_STATE_VERY_EXCITING_APPEAL: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); switch (show->contestLiveUpdates.category) { case CONTEST_CATEGORY_COOL: @@ -5133,42 +5134,42 @@ static void DoTVShowPokemonContestLiveUpdates(void) } break; case CONTESTLIVE_STATE_VERY_COOL: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; break; case CONTESTLIVE_STATE_VERY_BEAUTIFUL: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; break; case CONTESTLIVE_STATE_VERY_CUTE: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; break; case CONTESTLIVE_STATE_VERY_SMART: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; break; case CONTESTLIVE_STATE_VERY_TOUGH: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; break; case CONTESTLIVE_STATE_TOOK_BREAK: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; break; case CONTESTLIVE_STATE_GOT_STARTLED: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; break; case CONTESTLIVE_STATE_USED_MOVE: - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); StringCopy(gStringVar3, gMoveNames[show->contestLiveUpdates.move]); sTVShowState = CONTESTLIVE_STATE_TALK_ABOUT_LOSER; break; case CONTESTLIVE_STATE_TALK_ABOUT_LOSER: - StringCopy(gStringVar1, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar1, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); TVShowConvertInternationalString(gStringVar2, show->contestLiveUpdates.losingTrainerName, show->contestLiveUpdates.losingTrainerLanguage); - StringCopy(gStringVar3, gSpeciesNames[show->contestLiveUpdates.losingSpecies]); + StringCopy(gStringVar3, GetSpeciesName(show->contestLiveUpdates.losingSpecies)); switch (show->contestLiveUpdates.loserAppealFlag) { case CONTESTLIVE_FLAG_LOST: @@ -5198,12 +5199,12 @@ static void DoTVShowPokemonContestLiveUpdates(void) } break; case CONTESTLIVE_STATE_NO_APPEALS: - StringCopy(gStringVar1, gSpeciesNames[show->contestLiveUpdates.losingSpecies]); + StringCopy(gStringVar1, GetSpeciesName(show->contestLiveUpdates.losingSpecies)); sTVShowState = CONTESTLIVE_STATE_OUTRO; break; case CONTESTLIVE_STATE_LAST_BOTH: TVShowConvertInternationalString(gStringVar1, show->contestLiveUpdates.losingTrainerName, show->contestLiveUpdates.losingTrainerLanguage); - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.losingSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.losingSpecies)); sTVShowState = CONTESTLIVE_STATE_OUTRO; break; case CONTESTLIVE_STATE_NO_EXCITING_APPEALS: @@ -5211,7 +5212,7 @@ static void DoTVShowPokemonContestLiveUpdates(void) break; case CONTESTLIVE_STATE_LOST_SMALL_MARGIN: TVShowConvertInternationalString(gStringVar1, show->contestLiveUpdates.winningTrainerName, show->contestLiveUpdates.winningTrainerLanguage); - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); TVShowConvertInternationalString(gStringVar3, show->contestLiveUpdates.losingTrainerName, show->contestLiveUpdates.losingTrainerLanguage); sTVShowState = CONTESTLIVE_STATE_OUTRO; break; @@ -5224,7 +5225,7 @@ static void DoTVShowPokemonContestLiveUpdates(void) break; case CONTESTLIVE_STATE_OUTRO: TVShowConvertInternationalString(gStringVar1, show->contestLiveUpdates.winningTrainerName, show->contestLiveUpdates.winningTrainerLanguage); - StringCopy(gStringVar2, gSpeciesNames[show->contestLiveUpdates.winningSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->contestLiveUpdates.winningSpecies)); TVShowDone(); break; } @@ -5268,13 +5269,13 @@ static void DoTVShowPokemonBattleUpdate(void) break; case 2: TVShowConvertInternationalString(gStringVar1, show->battleUpdate.playerName, show->battleUpdate.language); - StringCopy(gStringVar2, gSpeciesNames[show->battleUpdate.speciesPlayer]); + StringCopy(gStringVar2, GetSpeciesName(show->battleUpdate.speciesPlayer)); StringCopy(gStringVar3, gMoveNames[show->battleUpdate.move]); sTVShowState = 3; break; case 3: TVShowConvertInternationalString(gStringVar1, show->battleUpdate.linkOpponentName, show->battleUpdate.linkOpponentLanguage); - StringCopy(gStringVar2, gSpeciesNames[show->battleUpdate.speciesOpponent]); + StringCopy(gStringVar2, GetSpeciesName(show->battleUpdate.speciesOpponent)); sTVShowState = 4; break; case 4: @@ -5289,14 +5290,14 @@ static void DoTVShowPokemonBattleUpdate(void) break; case 6: TVShowConvertInternationalString(gStringVar1, show->battleUpdate.playerName, show->battleUpdate.language); - StringCopy(gStringVar2, gSpeciesNames[show->battleUpdate.speciesPlayer]); + StringCopy(gStringVar2, GetSpeciesName(show->battleUpdate.speciesPlayer)); StringCopy(gStringVar3, gMoveNames[show->battleUpdate.move]); sTVShowState = 7; break; case 7: TVShowConvertInternationalString(gStringVar1, show->battleUpdate.playerName, show->battleUpdate.language); TVShowConvertInternationalString(gStringVar2, show->battleUpdate.linkOpponentName, show->battleUpdate.linkOpponentLanguage); - StringCopy(gStringVar3, gSpeciesNames[show->battleUpdate.speciesOpponent]); + StringCopy(gStringVar3, GetSpeciesName(show->battleUpdate.speciesOpponent)); TVShowDone(); break; } @@ -5430,9 +5431,9 @@ void DoTVShowInSearchOfTrainers(void) sTVShowState = 3; break; case 3: - StringCopy(gStringVar1, gSpeciesNames[gSaveBlock1Ptr->gabbyAndTyData.mon1]); + StringCopy(gStringVar1, GetSpeciesName(gSaveBlock1Ptr->gabbyAndTyData.mon1)); StringCopy(gStringVar2, gMoveNames[gSaveBlock1Ptr->gabbyAndTyData.lastMove]); - StringCopy(gStringVar3, gSpeciesNames[gSaveBlock1Ptr->gabbyAndTyData.mon2]); + StringCopy(gStringVar3, GetSpeciesName(gSaveBlock1Ptr->gabbyAndTyData.mon2)); sTVShowState = 8; break; case 4: @@ -5443,8 +5444,8 @@ void DoTVShowInSearchOfTrainers(void) break; case 8: CopyEasyChatWord(gStringVar1, gSaveBlock1Ptr->gabbyAndTyData.quote[0]); - StringCopy(gStringVar2, gSpeciesNames[gSaveBlock1Ptr->gabbyAndTyData.mon1]); - StringCopy(gStringVar3, gSpeciesNames[gSaveBlock1Ptr->gabbyAndTyData.mon2]); + StringCopy(gStringVar2, GetSpeciesName(gSaveBlock1Ptr->gabbyAndTyData.mon1)); + StringCopy(gStringVar3, GetSpeciesName(gSaveBlock1Ptr->gabbyAndTyData.mon2)); gSpecialVar_Result = TRUE; sTVShowState = 0; TakeGabbyAndTyOffTheAir(); @@ -5469,13 +5470,13 @@ static void DoTVShowPokemonAngler(void) { case 0: TVShowConvertInternationalString(gStringVar1, show->pokemonAngler.playerName, show->pokemonAngler.language); - StringCopy(gStringVar2, gSpeciesNames[show->pokemonAngler.species]); + StringCopy(gStringVar2, GetSpeciesName(show->pokemonAngler.species)); ConvertIntToDecimalString(2, show->pokemonAngler.nFails); TVShowDone(); break; case 1: TVShowConvertInternationalString(gStringVar1, show->pokemonAngler.playerName, show->pokemonAngler.language); - StringCopy(gStringVar2, gSpeciesNames[show->pokemonAngler.species]); + StringCopy(gStringVar2, GetSpeciesName(show->pokemonAngler.species)); ConvertIntToDecimalString(2, show->pokemonAngler.nBites); TVShowDone(); break; @@ -5500,13 +5501,13 @@ static void DoTVShowTheWorldOfMasters(void) sTVShowState = 1; break; case 1: - StringCopy(gStringVar1, gSpeciesNames[show->worldOfMasters.species]); + StringCopy(gStringVar1, GetSpeciesName(show->worldOfMasters.species)); sTVShowState = 2; break; case 2: TVShowConvertInternationalString(gStringVar1, show->worldOfMasters.playerName, show->worldOfMasters.language); GetMapName(gStringVar2, show->worldOfMasters.location, 0); - StringCopy(gStringVar3, gSpeciesNames[show->worldOfMasters.caughtPoke]); + StringCopy(gStringVar3, GetSpeciesName(show->worldOfMasters.caughtPoke)); TVShowDone(); break; } @@ -5814,14 +5815,14 @@ static void DoTVShowBreakingNewsTV(void) break; case 1: TVShowConvertInternationalString(gStringVar1, show->breakingNews.playerName, show->breakingNews.language); - StringCopy(gStringVar2, gSpeciesNames[show->breakingNews.lastOpponentSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->breakingNews.lastOpponentSpecies)); GetMapName(gStringVar3, show->breakingNews.location, 0); sTVShowState = 2; break; case 2: TVShowConvertInternationalString(gStringVar1, show->breakingNews.playerName, show->breakingNews.language); - StringCopy(gStringVar2, gSpeciesNames[show->breakingNews.lastOpponentSpecies]); - StringCopy(gStringVar3, gSpeciesNames[show->breakingNews.poke1Species]); + StringCopy(gStringVar2, GetSpeciesName(show->breakingNews.lastOpponentSpecies)); + StringCopy(gStringVar3, GetSpeciesName(show->breakingNews.poke1Species)); sTVShowState = 3; break; case 3: @@ -5836,14 +5837,14 @@ static void DoTVShowBreakingNewsTV(void) break; case 5: TVShowConvertInternationalString(gStringVar1, show->breakingNews.playerName, show->breakingNews.language); - StringCopy(gStringVar2, gSpeciesNames[show->breakingNews.lastOpponentSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->breakingNews.lastOpponentSpecies)); GetMapName(gStringVar3, show->breakingNews.location, 0); sTVShowState = 6; break; case 6: TVShowConvertInternationalString(gStringVar1, show->breakingNews.playerName, show->breakingNews.language); - StringCopy(gStringVar2, gSpeciesNames[show->breakingNews.lastOpponentSpecies]); - StringCopy(gStringVar3, gSpeciesNames[show->breakingNews.poke1Species]); + StringCopy(gStringVar2, GetSpeciesName(show->breakingNews.lastOpponentSpecies)); + StringCopy(gStringVar3, GetSpeciesName(show->breakingNews.poke1Species)); switch (show->breakingNews.outcome) { case 1: @@ -5862,13 +5863,13 @@ static void DoTVShowBreakingNewsTV(void) break; case 7: StringCopy(gStringVar1, gMoveNames[show->breakingNews.lastUsedMove]); - StringCopy(gStringVar2, gSpeciesNames[show->breakingNews.poke1Species]); + StringCopy(gStringVar2, GetSpeciesName(show->breakingNews.poke1Species)); sTVShowState = 8; break; case 12: TVShowConvertInternationalString(gStringVar1, show->breakingNews.playerName, show->breakingNews.language); - StringCopy(gStringVar2, gSpeciesNames[show->breakingNews.lastOpponentSpecies]); - StringCopy(gStringVar3, gSpeciesNames[show->breakingNews.poke1Species]); + StringCopy(gStringVar2, GetSpeciesName(show->breakingNews.lastOpponentSpecies)); + StringCopy(gStringVar3, GetSpeciesName(show->breakingNews.poke1Species)); sTVShowState = 8; break; case 8: @@ -5879,7 +5880,7 @@ static void DoTVShowBreakingNewsTV(void) case 9: case 10: TVShowConvertInternationalString(gStringVar1, show->breakingNews.playerName, show->breakingNews.language); - StringCopy(gStringVar2, gSpeciesNames[show->breakingNews.lastOpponentSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->breakingNews.lastOpponentSpecies)); GetMapName(gStringVar3, show->breakingNews.location, 0); sTVShowState = 11; break; @@ -5960,7 +5961,7 @@ static void DoTVShowSecretBaseVisit(void) case 11: case 12: TVShowConvertInternationalString(gStringVar1, show->secretBaseVisit.playerName, show->secretBaseVisit.language); - StringCopy(gStringVar2, gSpeciesNames[show->secretBaseVisit.species]); + StringCopy(gStringVar2, GetSpeciesName(show->secretBaseVisit.species)); StringCopy(gStringVar3, gMoveNames[show->secretBaseVisit.move]); sTVShowState = 13; break; @@ -6005,18 +6006,18 @@ static void DoTVShowThePokemonBattleSeminar(void) { case 0: TVShowConvertInternationalString(gStringVar1, show->battleSeminar.playerName, show->battleSeminar.language); - StringCopy(gStringVar2, gSpeciesNames[show->battleSeminar.species]); - StringCopy(gStringVar3, gSpeciesNames[show->battleSeminar.foeSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->battleSeminar.species)); + StringCopy(gStringVar3, GetSpeciesName(show->battleSeminar.foeSpecies)); sTVShowState = 1; break; case 1: TVShowConvertInternationalString(gStringVar1, show->battleSeminar.playerName, show->battleSeminar.language); - StringCopy(gStringVar2, gSpeciesNames[show->battleSeminar.foeSpecies]); + StringCopy(gStringVar2, GetSpeciesName(show->battleSeminar.foeSpecies)); StringCopy(gStringVar3, gMoveNames[show->battleSeminar.move]); sTVShowState = 2; break; case 2: - StringCopy(gStringVar1, gSpeciesNames[show->battleSeminar.species]); + StringCopy(gStringVar1, GetSpeciesName(show->battleSeminar.species)); switch (show->battleSeminar.nOtherMoves) { case 1: @@ -6428,24 +6429,24 @@ static void DoTVShowPokemonNewsBattleFrontier(void) sTVShowState = 14; break; case 14: - StringCopy(gStringVar1, gSpeciesNames[show->frontier.species1]); - StringCopy(gStringVar2, gSpeciesNames[show->frontier.species2]); - StringCopy(gStringVar3, gSpeciesNames[show->frontier.species3]); + StringCopy(gStringVar1, GetSpeciesName(show->frontier.species1)); + StringCopy(gStringVar2, GetSpeciesName(show->frontier.species2)); + StringCopy(gStringVar3, GetSpeciesName(show->frontier.species3)); sTVShowState = 18; break; case 15: - StringCopy(gStringVar1, gSpeciesNames[show->frontier.species1]); - StringCopy(gStringVar2, gSpeciesNames[show->frontier.species2]); + StringCopy(gStringVar1, GetSpeciesName(show->frontier.species1)); + StringCopy(gStringVar2, GetSpeciesName(show->frontier.species2)); sTVShowState = 18; break; case 16: - StringCopy(gStringVar1, gSpeciesNames[show->frontier.species1]); - StringCopy(gStringVar2, gSpeciesNames[show->frontier.species2]); - StringCopy(gStringVar3, gSpeciesNames[show->frontier.species3]); + StringCopy(gStringVar1, GetSpeciesName(show->frontier.species1)); + StringCopy(gStringVar2, GetSpeciesName(show->frontier.species2)); + StringCopy(gStringVar3, GetSpeciesName(show->frontier.species3)); sTVShowState = 17; break; case 17: - StringCopy(gStringVar1, gSpeciesNames[show->frontier.species4]); + StringCopy(gStringVar1, GetSpeciesName(show->frontier.species4)); sTVShowState = 18; break; case 18: diff --git a/src/union_room.c b/src/union_room.c index 38f2b22fa8c0..0d33a352127d 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -3050,7 +3050,7 @@ static void Task_RunUnionRoom(u8 taskId) } else { - StringCopy(gStringVar1, gSpeciesNames[GetHostRfuGameData()->tradeSpecies]); + StringCopy(gStringVar1, GetSpeciesName(GetHostRfuGameData()->tradeSpecies)); ConvertIntToDecimalStringN(gStringVar2, GetHostRfuGameData()->tradeLevel, STR_CONV_MODE_LEFT_ALIGN, 3); StringExpandPlaceholders(gStringVar4, sText_CancelRegistrationOfMon); } @@ -4109,7 +4109,7 @@ static void TradeBoardPrintItemInfo(u8 windowId, u8 y, struct RfuGameData * data else { BlitMenuInfoIcon(windowId, type + 1, 68, y); - PrintUnionRoomText(windowId, FONT_NORMAL, gSpeciesNames[species], 118, y, colorIdx); + PrintUnionRoomText(windowId, FONT_NORMAL, GetSpeciesName(species), 118, y, colorIdx); ConvertIntToDecimalStringN(levelStr, level, STR_CONV_MODE_RIGHT_ALIGN, 3); PrintUnionRoomText(windowId, FONT_NORMAL, levelStr, 198, y, colorIdx); } @@ -4250,13 +4250,13 @@ static s32 GetChatLeaderActionRequestMessage(u8 *dst, u32 gender, u16 *activityD break; case ACTIVITY_TRADE | IN_UNION_ROOM: ConvertIntToDecimalStringN(uroom->activityRequestStrbufs[0], sUnionRoomTrade.playerLevel, STR_CONV_MODE_LEFT_ALIGN, 3); - StringCopy(uroom->activityRequestStrbufs[1], gSpeciesNames[sUnionRoomTrade.playerSpecies]); + StringCopy(uroom->activityRequestStrbufs[1], GetSpeciesName(sUnionRoomTrade.playerSpecies)); for (i = 0; i < RFU_CHILD_MAX; i++) { if (gRfuLinkStatus->partner[i].serialNo == RFU_SERIAL_GAME) { ConvertIntToDecimalStringN(uroom->activityRequestStrbufs[2], activityData[2], STR_CONV_MODE_LEFT_ALIGN, 3); - StringCopy(uroom->activityRequestStrbufs[3], gSpeciesNames[activityData[1]]); + StringCopy(uroom->activityRequestStrbufs[3], GetSpeciesName(activityData[1])); species = activityData[1]; break; } diff --git a/src/util.c b/src/util.c index ab5603b867a4..09381fcaf317 100644 --- a/src/util.c +++ b/src/util.c @@ -118,7 +118,7 @@ const u8 gMiscBlank_Gfx[] = INCBIN_U8("graphics/interface/blank.4bpp"); u8 CreateInvisibleSpriteWithCallback(void (*callback)(struct Sprite *)) { - u8 sprite = CreateSprite(&sInvisibleSpriteTemplate, 248, 168, 14); + u8 sprite = CreateSprite(&sInvisibleSpriteTemplate, DISPLAY_WIDTH + 8, DISPLAY_HEIGHT + 8, 14); gSprites[sprite].invisible = TRUE; gSprites[sprite].callback = callback; return sprite; diff --git a/src/wild_encounter.c b/src/wild_encounter.c index b01b5bd5dc38..6016e08e69a8 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -56,7 +56,11 @@ static bool8 IsWildLevelAllowedByRepel(u8 level); static void ApplyFluteEncounterRateMod(u32 *encRate); static void ApplyCleanseTagEncounterRateMod(u32 *encRate); static u8 GetMaxLevelOfSpeciesInWildTable(const struct WildPokemon *wildMon, u16 species, u8 area); +#ifdef BUGFIX +static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildMon, u8 type, u16 ability, u8 *monIndex, u32 size); +#else static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildMon, u8 type, u16 ability, u8 *monIndex); +#endif static bool8 IsAbilityAllowingEncounter(u8 level); EWRAM_DATA static u8 sWildEncountersDisabled = 0; @@ -463,6 +467,11 @@ static void CreateWildMon(u16 species, u8 level) CreateMonWithNature(&gEnemyParty[0], species, level, USE_RANDOM_IVS, PickWildMonNature()); } +#ifdef BUGFIX +#define TRY_GET_ABILITY_INFLUENCED_WILD_MON_INDEX(wildPokemon, type, ability, ptr, count) TryGetAbilityInfluencedWildMonIndex(wildPokemon, type, ability, ptr, count) +#else +#define TRY_GET_ABILITY_INFLUENCED_WILD_MON_INDEX(wildPokemon, type, ability, ptr, count) TryGetAbilityInfluencedWildMonIndex(wildPokemon, type, ability, ptr) +#endif static bool8 TryGenerateWildMon(const struct WildPokemonInfo *wildMonInfo, u8 area, u8 flags) { @@ -472,33 +481,33 @@ static bool8 TryGenerateWildMon(const struct WildPokemonInfo *wildMonInfo, u8 ar switch (area) { case WILD_AREA_LAND: - if (TryGetAbilityInfluencedWildMonIndex(wildMonInfo->wildPokemon, TYPE_STEEL, ABILITY_MAGNET_PULL, &wildMonIndex)) + if (TRY_GET_ABILITY_INFLUENCED_WILD_MON_INDEX(wildMonInfo->wildPokemon, TYPE_STEEL, ABILITY_MAGNET_PULL, &wildMonIndex, LAND_WILD_COUNT)) break; - if (TryGetAbilityInfluencedWildMonIndex(wildMonInfo->wildPokemon, TYPE_ELECTRIC, ABILITY_STATIC, &wildMonIndex)) + if (TRY_GET_ABILITY_INFLUENCED_WILD_MON_INDEX(wildMonInfo->wildPokemon, TYPE_ELECTRIC, ABILITY_STATIC, &wildMonIndex, LAND_WILD_COUNT)) break; - if (TryGetAbilityInfluencedWildMonIndex(wildMonInfo->wildPokemon, TYPE_ELECTRIC, ABILITY_LIGHTNING_ROD, &wildMonIndex)) + if (TRY_GET_ABILITY_INFLUENCED_WILD_MON_INDEX(wildMonInfo->wildPokemon, TYPE_ELECTRIC, ABILITY_LIGHTNING_ROD, &wildMonIndex, LAND_WILD_COUNT)) break; - if (TryGetAbilityInfluencedWildMonIndex(wildMonInfo->wildPokemon, TYPE_FIRE, ABILITY_FLASH_FIRE, &wildMonIndex)) + if (TRY_GET_ABILITY_INFLUENCED_WILD_MON_INDEX(wildMonInfo->wildPokemon, TYPE_FIRE, ABILITY_FLASH_FIRE, &wildMonIndex, LAND_WILD_COUNT)) break; - if (TryGetAbilityInfluencedWildMonIndex(wildMonInfo->wildPokemon, TYPE_GRASS, ABILITY_HARVEST, &wildMonIndex)) + if (TRY_GET_ABILITY_INFLUENCED_WILD_MON_INDEX(wildMonInfo->wildPokemon, TYPE_GRASS, ABILITY_HARVEST, &wildMonIndex, LAND_WILD_COUNT)) break; - if (TryGetAbilityInfluencedWildMonIndex(wildMonInfo->wildPokemon, TYPE_WATER, ABILITY_STORM_DRAIN, &wildMonIndex)) + if (TRY_GET_ABILITY_INFLUENCED_WILD_MON_INDEX(wildMonInfo->wildPokemon, TYPE_WATER, ABILITY_STORM_DRAIN, &wildMonIndex, LAND_WILD_COUNT)) break; wildMonIndex = ChooseWildMonIndex_Land(); break; case WILD_AREA_WATER: - if (TryGetAbilityInfluencedWildMonIndex(wildMonInfo->wildPokemon, TYPE_STEEL, ABILITY_MAGNET_PULL, &wildMonIndex)) + if (TRY_GET_ABILITY_INFLUENCED_WILD_MON_INDEX(wildMonInfo->wildPokemon, TYPE_STEEL, ABILITY_MAGNET_PULL, &wildMonIndex, WATER_WILD_COUNT)) break; - if (TryGetAbilityInfluencedWildMonIndex(wildMonInfo->wildPokemon, TYPE_ELECTRIC, ABILITY_STATIC, &wildMonIndex)) + if (TRY_GET_ABILITY_INFLUENCED_WILD_MON_INDEX(wildMonInfo->wildPokemon, TYPE_ELECTRIC, ABILITY_STATIC, &wildMonIndex, WATER_WILD_COUNT)) break; - if (TryGetAbilityInfluencedWildMonIndex(wildMonInfo->wildPokemon, TYPE_ELECTRIC, ABILITY_LIGHTNING_ROD, &wildMonIndex)) + if (TRY_GET_ABILITY_INFLUENCED_WILD_MON_INDEX(wildMonInfo->wildPokemon, TYPE_ELECTRIC, ABILITY_LIGHTNING_ROD, &wildMonIndex, WATER_WILD_COUNT)) break; - if (TryGetAbilityInfluencedWildMonIndex(wildMonInfo->wildPokemon, TYPE_FIRE, ABILITY_FLASH_FIRE, &wildMonIndex)) + if (TRY_GET_ABILITY_INFLUENCED_WILD_MON_INDEX(wildMonInfo->wildPokemon, TYPE_FIRE, ABILITY_FLASH_FIRE, &wildMonIndex, WATER_WILD_COUNT)) break; - if (TryGetAbilityInfluencedWildMonIndex(wildMonInfo->wildPokemon, TYPE_GRASS, ABILITY_HARVEST, &wildMonIndex)) + if (TRY_GET_ABILITY_INFLUENCED_WILD_MON_INDEX(wildMonInfo->wildPokemon, TYPE_GRASS, ABILITY_HARVEST, &wildMonIndex, WATER_WILD_COUNT)) break; - if (TryGetAbilityInfluencedWildMonIndex(wildMonInfo->wildPokemon, TYPE_WATER, ABILITY_STORM_DRAIN, &wildMonIndex)) + if (TRY_GET_ABILITY_INFLUENCED_WILD_MON_INDEX(wildMonInfo->wildPokemon, TYPE_WATER, ABILITY_STORM_DRAIN, &wildMonIndex, WATER_WILD_COUNT)) break; wildMonIndex = ChooseWildMonIndex_WaterRock(); @@ -1069,7 +1078,11 @@ static u8 GetMaxLevelOfSpeciesInWildTable(const struct WildPokemon *wildMon, u16 return maxLevel; } +#ifdef BUGFIX +static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildMon, u8 type, u16 ability, u8 *monIndex, u32 size) +#else static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildMon, u8 type, u16 ability, u8 *monIndex) +#endif { if (GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG)) return FALSE; @@ -1078,7 +1091,11 @@ static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildM else if (Random() % 2 != 0) return FALSE; +#ifdef BUGFIX + return TryGetRandomWildMonIndexByType(wildMon, type, size, monIndex); +#else return TryGetRandomWildMonIndexByType(wildMon, type, LAND_WILD_COUNT, monIndex); +#endif } static void ApplyFluteEncounterRateMod(u32 *encRate) @@ -1113,3 +1130,13 @@ bool8 TryDoDoubleWildBattle(void) #endif return FALSE; } + +bool8 StandardWildEncounter_Debug(void) +{ + u16 headerId = GetCurrentMapWildMonHeaderId(); + if (TryGenerateWildMon(gWildMonHeaders[headerId].landMonsInfo, WILD_AREA_LAND, 0) != TRUE) + return FALSE; + + DoStandardWildBattle_Debug(); + return TRUE; +} diff --git a/sym_common.txt b/sym_common.txt index 7eebcac74e62..170aee2f42a4 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -37,6 +37,7 @@ gReservedSpritePaletteCount: .include "link_rfu_2.o" .include "rtc.o" .include "battle_main.o" + .include "battle_controllers.o" .include "random.o" .include "load_save.o" .include "berry_blender.o" diff --git a/sym_ewram.txt b/sym_ewram.txt index 914501a088e9..2d7a6e26edd1 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -149,3 +149,4 @@ .include "src/trainer_hill.o" .include "src/rayquaza_scene.o" .include "src/debug.o" + .include "src/battle_controller_player.o" diff --git a/test/battle/ability/contrary.c b/test/battle/ability/contrary.c index de40937161a2..4e4417e19bd8 100644 --- a/test/battle/ability/contrary.c +++ b/test/battle/ability/contrary.c @@ -26,7 +26,7 @@ SINGLE_BATTLE_TEST("Contrary raises Attack when Intimidated", s16 damage) HP_BAR(player, captureDamage: &results[i].damage); } FINALLY { - EXPECT_MUL_EQ(results[1].damage, Q_4_12(2.125), results[0].damage); + EXPECT_MUL_EQ(results[1].damage, Q_4_12(2.25), results[0].damage); } } diff --git a/test/battle/ability/cute_charm.c b/test/battle/ability/cute_charm.c index 1a55fc3595ba..9bef66b19ab1 100644 --- a/test/battle/ability/cute_charm.c +++ b/test/battle/ability/cute_charm.c @@ -7,15 +7,15 @@ SINGLE_BATTLE_TEST("Cute Charm inflicts infatuation on contact") PARAMETRIZE { move = MOVE_TACKLE; } PARAMETRIZE { move = MOVE_SWIFT; } GIVEN { - ASSUME(gBattleMoves[MOVE_TACKLE].flags & FLAG_MAKES_CONTACT); - ASSUME(!(gBattleMoves[MOVE_SWIFT].flags & FLAG_MAKES_CONTACT)); + ASSUME(gBattleMoves[MOVE_TACKLE].makesContact); + ASSUME(!gBattleMoves[MOVE_SWIFT].makesContact); PLAYER(SPECIES_WOBBUFFET) { Gender(MON_MALE); } OPPONENT(SPECIES_CLEFAIRY) { Gender(MON_FEMALE); Ability(ABILITY_CUTE_CHARM); } } WHEN { TURN { MOVE(player, move); } TURN { MOVE(player, move); } } SCENE { - if (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) { + if (gBattleMoves[move].makesContact) { ABILITY_POPUP(opponent, ABILITY_CUTE_CHARM); ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_INFATUATION, player); MESSAGE("Foe Clefairy's Cute Charm infatuated Wobbuffet!"); diff --git a/test/battle/ability/damp.c b/test/battle/ability/damp.c index ce53db112cf2..46e378c5fd40 100644 --- a/test/battle/ability/damp.c +++ b/test/battle/ability/damp.c @@ -60,7 +60,7 @@ SINGLE_BATTLE_TEST("Damp prevents explosion-like moves from self") SINGLE_BATTLE_TEST("Damp prevents damage from aftermath") { GIVEN { - ASSUME(gBattleMoves[MOVE_TACKLE].flags & FLAG_MAKES_CONTACT); + ASSUME(gBattleMoves[MOVE_TACKLE].makesContact); PLAYER(SPECIES_PARAS) { Ability(ABILITY_DAMP); } OPPONENT(SPECIES_VOLTORB) { Ability(ABILITY_AFTERMATH); HP(1); } OPPONENT(SPECIES_WOBBUFFET); diff --git a/test/battle/ability/dry_skin.c b/test/battle/ability/dry_skin.c index 832b7baafe3c..db0b61f2d3b2 100644 --- a/test/battle/ability/dry_skin.c +++ b/test/battle/ability/dry_skin.c @@ -36,15 +36,24 @@ SINGLE_BATTLE_TEST("Dry Skin increases damage taken from Fire-type moves by 25%" PARAMETRIZE { ability = ABILITY_DRY_SKIN; } GIVEN { ASSUME(gBattleMoves[MOVE_EMBER].type == TYPE_FIRE); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_PARASECT) { Ability(ability); } + ASSUME(gBattleMoves[MOVE_EMBER].power == 40); + ASSUME(gSpeciesInfo[SPECIES_PARASECT].types[0] == TYPE_BUG); + ASSUME(gSpeciesInfo[SPECIES_PARASECT].types[1] == TYPE_GRASS); + ASSUME(gSpeciesInfo[SPECIES_WOBBUFFET].types[0] == TYPE_PSYCHIC); + ASSUME(gSpeciesInfo[SPECIES_WOBBUFFET].types[1] == TYPE_PSYCHIC); + PLAYER(SPECIES_WOBBUFFET) { SpAttack(71); } + OPPONENT(SPECIES_PARASECT) { Ability(ability); SpDefense(165); } } WHEN { TURN { MOVE(player, MOVE_EMBER); } } SCENE { MESSAGE("Wobbuffet used Ember!"); HP_BAR(opponent, captureDamage: &results[i].damage); } FINALLY { - EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.25), results[1].damage); + // Due to numerics related to rounding on each applied multiplier, + // the ability effect doesn't manifest as a 25% damage increase, but as a ~31% damage increase in this case. + // Values obtained from https://calc.pokemonshowdown.com (Neutral nature and 0 IVs on both sides) + EXPECT_EQ(results[0].damage, 52); + EXPECT_EQ(results[1].damage, 68); } } diff --git a/test/battle/ability/flame_body.c b/test/battle/ability/flame_body.c index ae9138e125ad..959b583f80a2 100644 --- a/test/battle/ability/flame_body.c +++ b/test/battle/ability/flame_body.c @@ -7,14 +7,14 @@ SINGLE_BATTLE_TEST("Flame Body inflicts burn on contact") PARAMETRIZE { move = MOVE_TACKLE; } PARAMETRIZE { move = MOVE_SWIFT; } GIVEN { - ASSUME(gBattleMoves[MOVE_TACKLE].flags & FLAG_MAKES_CONTACT); - ASSUME(!(gBattleMoves[MOVE_SWIFT].flags & FLAG_MAKES_CONTACT)); + ASSUME(gBattleMoves[MOVE_TACKLE].makesContact); + ASSUME(!gBattleMoves[MOVE_SWIFT].makesContact); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_MAGMAR) { Ability(ABILITY_FLAME_BODY); } } WHEN { TURN { MOVE(player, move); } } SCENE { - if (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) { + if (gBattleMoves[move].makesContact) { ABILITY_POPUP(opponent, ABILITY_FLAME_BODY); ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_BRN, player); MESSAGE("Foe Magmar's Flame Body burned Wobbuffet!"); diff --git a/test/battle/ability/flower_gift.c b/test/battle/ability/flower_gift.c index fdd191f55f52..e02f90dc6c24 100644 --- a/test/battle/ability/flower_gift.c +++ b/test/battle/ability/flower_gift.c @@ -12,6 +12,8 @@ SINGLE_BATTLE_TEST("Flower Gift transforms Cherrim in harsh sunlight") ABILITY_POPUP(player, ABILITY_FLOWER_GIFT); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player); MESSAGE("Cherrim transformed!"); + } THEN { + EXPECT_EQ(player->species, SPECIES_CHERRIM_SUNSHINE); } } @@ -32,6 +34,8 @@ SINGLE_BATTLE_TEST("Flower Gift transforms Cherrim back to normal when weather c ABILITY_POPUP(player, ABILITY_FLOWER_GIFT); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player); MESSAGE("Cherrim transformed!"); + } THEN { + EXPECT_EQ(player->species, SPECIES_CHERRIM); } } @@ -52,6 +56,8 @@ SINGLE_BATTLE_TEST("Flower Gift transforms Cherrim back to normal when its abili // back to normal ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player); MESSAGE("Cherrim transformed!"); + } THEN { + EXPECT_EQ(player->species, SPECIES_CHERRIM); } } diff --git a/test/battle/ability/fluffy.c b/test/battle/ability/fluffy.c new file mode 100644 index 000000000000..6c76aeed5586 --- /dev/null +++ b/test/battle/ability/fluffy.c @@ -0,0 +1,66 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_TACKLE].makesContact); + ASSUME(gBattleMoves[MOVE_EMBER].type == TYPE_FIRE); + ASSUME(gBattleMoves[MOVE_TACKLE].makesContact); + ASSUME(gBattleMoves[MOVE_FIRE_PUNCH].makesContact); + ASSUME(gBattleMoves[MOVE_FIRE_PUNCH].type == TYPE_FIRE); + ASSUME(P_GEN_7_POKEMON == TRUE); +} + +SINGLE_BATTLE_TEST("Fluffy halves damage taken from moves that make direct contact", s16 damage) +{ + u32 ability; + PARAMETRIZE { ability = ABILITY_KLUTZ; } + PARAMETRIZE { ability = ABILITY_FLUFFY; } + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_STUFFUL) { Ability(ability); } + } WHEN { + TURN { MOVE(player, MOVE_TACKLE); } + } SCENE { + MESSAGE("Wobbuffet used Tackle!"); + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, UQ_4_12(0.5), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("Fluffy doubles damage taken from fire type moves", s16 damage) +{ + u32 ability; + PARAMETRIZE { ability = ABILITY_KLUTZ; } + PARAMETRIZE { ability = ABILITY_FLUFFY; } + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_STUFFUL) { Ability(ability); } + } WHEN { + TURN { MOVE(player, MOVE_EMBER); } + } SCENE { + MESSAGE("Wobbuffet used Ember!"); + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, UQ_4_12(2.0), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("Fluffy does not alter damage of fire-type moves that make direct contact", s16 damage) +{ + u32 ability; + PARAMETRIZE { ability = ABILITY_KLUTZ; } + PARAMETRIZE { ability = ABILITY_FLUFFY; } + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_STUFFUL) { Ability(ability); } + } WHEN { + TURN { MOVE(player, MOVE_FIRE_PUNCH); } + } SCENE { + MESSAGE("Wobbuffet used Fire Punch!"); + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_EQ(results[0].damage, results[1].damage); + } +} diff --git a/test/battle/ability/forecast.c b/test/battle/ability/forecast.c index 26ad789da94e..66793ebfb2cc 100644 --- a/test/battle/ability/forecast.c +++ b/test/battle/ability/forecast.c @@ -17,6 +17,20 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform in weather from an opponent's m ABILITY_POPUP(player, ABILITY_FORECAST); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player); MESSAGE("Castform transformed!"); + } THEN { + switch (move) + { + case MOVE_SUNNY_DAY: + EXPECT_EQ(player->species, SPECIES_CASTFORM_SUNNY); + break; + case MOVE_RAIN_DANCE: + EXPECT_EQ(player->species, SPECIES_CASTFORM_RAINY); + break; + case MOVE_HAIL: + case MOVE_SNOWSCAPE: + EXPECT_EQ(player->species, SPECIES_CASTFORM_SNOWY); + break; + } } } @@ -36,6 +50,20 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform in weather from its own move") ABILITY_POPUP(player, ABILITY_FORECAST); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player); MESSAGE("Castform transformed!"); + } THEN { + switch (move) + { + case MOVE_SUNNY_DAY: + EXPECT_EQ(player->species, SPECIES_CASTFORM_SUNNY); + break; + case MOVE_RAIN_DANCE: + EXPECT_EQ(player->species, SPECIES_CASTFORM_RAINY); + break; + case MOVE_HAIL: + case MOVE_SNOWSCAPE: + EXPECT_EQ(player->species, SPECIES_CASTFORM_SNOWY); + break; + } } } @@ -57,6 +85,20 @@ DOUBLE_BATTLE_TEST("Forecast transforms Castform in weather from a partner's mov ABILITY_POPUP(playerLeft, ABILITY_FORECAST); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, playerLeft); MESSAGE("Castform transformed!"); + } THEN { + switch (move) + { + case MOVE_SUNNY_DAY: + EXPECT_EQ(playerLeft->species, SPECIES_CASTFORM_SUNNY); + break; + case MOVE_RAIN_DANCE: + EXPECT_EQ(playerLeft->species, SPECIES_CASTFORM_RAINY); + break; + case MOVE_HAIL: + case MOVE_SNOWSCAPE: + EXPECT_EQ(playerLeft->species, SPECIES_CASTFORM_SNOWY); + break; + } } } @@ -87,6 +129,29 @@ DOUBLE_BATTLE_TEST("Forecast transforms all Castforms present in weather") ABILITY_POPUP(opponentRight, ABILITY_FORECAST); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, opponentRight); MESSAGE("Foe Castform transformed!"); + } THEN { + switch (move) + { + case MOVE_SUNNY_DAY: + EXPECT_EQ(playerLeft->species, SPECIES_CASTFORM_SUNNY); + EXPECT_EQ(playerRight->species, SPECIES_CASTFORM_SUNNY); + EXPECT_EQ(opponentLeft->species, SPECIES_CASTFORM_SUNNY); + EXPECT_EQ(opponentRight->species, SPECIES_CASTFORM_SUNNY); + break; + case MOVE_RAIN_DANCE: + EXPECT_EQ(playerLeft->species, SPECIES_CASTFORM_RAINY); + EXPECT_EQ(playerRight->species, SPECIES_CASTFORM_RAINY); + EXPECT_EQ(opponentLeft->species, SPECIES_CASTFORM_RAINY); + EXPECT_EQ(opponentRight->species, SPECIES_CASTFORM_RAINY); + break; + case MOVE_HAIL: + case MOVE_SNOWSCAPE: + EXPECT_EQ(playerLeft->species, SPECIES_CASTFORM_SNOWY); + EXPECT_EQ(playerRight->species, SPECIES_CASTFORM_SNOWY); + EXPECT_EQ(opponentLeft->species, SPECIES_CASTFORM_SNOWY); + EXPECT_EQ(opponentRight->species, SPECIES_CASTFORM_SNOWY); + break; + } } } @@ -106,6 +171,19 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform in weather from an ability") ABILITY_POPUP(player, ABILITY_FORECAST); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player); MESSAGE("Castform transformed!"); + } THEN { + switch (ability) + { + case ABILITY_DROUGHT: + EXPECT_EQ(player->species, SPECIES_CASTFORM_SUNNY); + break; + case ABILITY_DRIZZLE: + EXPECT_EQ(player->species, SPECIES_CASTFORM_RAINY); + break; + case ABILITY_SNOW_WARNING: + EXPECT_EQ(player->species, SPECIES_CASTFORM_SNOWY); + break; + } } } @@ -125,6 +203,16 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform in primal weather") ABILITY_POPUP(player, ABILITY_FORECAST); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player); MESSAGE("Castform transformed!"); + } THEN { + switch (ability) + { + case ABILITY_DESOLATE_LAND: + EXPECT_EQ(player->species, SPECIES_CASTFORM_SUNNY); + break; + case ABILITY_PRIMORDIAL_SEA: + EXPECT_EQ(player->species, SPECIES_CASTFORM_RAINY); + break; + } } } @@ -149,6 +237,8 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform back to normal when weather exp ABILITY_POPUP(player, ABILITY_FORECAST); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player); MESSAGE("Castform transformed!"); + } THEN { + EXPECT_EQ(player->species, SPECIES_CASTFORM); } } @@ -169,11 +259,14 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform back to normal when Sandstorm i ABILITY_POPUP(player, ABILITY_FORECAST); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player); MESSAGE("Castform transformed!"); + } THEN { + EXPECT_EQ(player->species, SPECIES_CASTFORM); } } SINGLE_BATTLE_TEST("Forecast transforms Castform back to normal under Air Lock") { + KNOWN_FAILING; GIVEN { PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); } OPPONENT(SPECIES_WOBBUFFET); @@ -181,7 +274,6 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform back to normal under Air Lock") } WHEN { TURN { MOVE(player, MOVE_RAIN_DANCE); } TURN { SWITCH(opponent, 1); } - TURN { MOVE(opponent, MOVE_CELEBRATE, megaEvolve: TRUE); } } SCENE { // transforms ABILITY_POPUP(player, ABILITY_FORECAST); @@ -192,6 +284,8 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform back to normal under Air Lock") ABILITY_POPUP(player, ABILITY_FORECAST); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player); MESSAGE("Castform transformed!"); + } THEN { + EXPECT_EQ(player->species, SPECIES_CASTFORM); } } @@ -211,6 +305,8 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform on switch-in") ABILITY_POPUP(player, ABILITY_FORECAST); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player); MESSAGE("Castform transformed!"); + } THEN { + EXPECT_EQ(player->species, SPECIES_CASTFORM_RAINY); } } @@ -231,6 +327,8 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform when weather changes") ABILITY_POPUP(player, ABILITY_FORECAST); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player); MESSAGE("Castform transformed!"); + } THEN { + EXPECT_EQ(player->species, SPECIES_CASTFORM_SUNNY); } } @@ -251,5 +349,7 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform back to normal when its ability // back to normal ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player); MESSAGE("Castform transformed!"); + } THEN { + EXPECT_EQ(player->species, SPECIES_CASTFORM); } } diff --git a/test/battle/ability/magic_bounce.c b/test/battle/ability/magic_bounce.c index 348b80f0a040..80ff40f2e168 100644 --- a/test/battle/ability/magic_bounce.c +++ b/test/battle/ability/magic_bounce.c @@ -22,7 +22,7 @@ SINGLE_BATTLE_TEST("Magic Bounce bounces back status moves") SINGLE_BATTLE_TEST("Magic Bounce bounces back powder moves") { GIVEN { - ASSUME(gBattleMoves[MOVE_STUN_SPORE].flags & FLAG_POWDER); + ASSUME(gBattleMoves[MOVE_STUN_SPORE].powderMove); ASSUME(gBattleMoves[MOVE_STUN_SPORE].effect == EFFECT_PARALYZE); PLAYER(SPECIES_WYNAUT); OPPONENT(SPECIES_ESPEON) { Ability(ABILITY_MAGIC_BOUNCE); } @@ -40,7 +40,7 @@ SINGLE_BATTLE_TEST("Magic Bounce bounces back powder moves") SINGLE_BATTLE_TEST("Magic Bounce cannot bounce back powder moves against Grass Types") { GIVEN { - ASSUME(gBattleMoves[MOVE_STUN_SPORE].flags & FLAG_POWDER); + ASSUME(gBattleMoves[MOVE_STUN_SPORE].powderMove); ASSUME(gSpeciesInfo[SPECIES_ODDISH].types[0] == TYPE_GRASS); PLAYER(SPECIES_ODDISH); OPPONENT(SPECIES_ESPEON) { Ability(ABILITY_MAGIC_BOUNCE); } diff --git a/test/battle/ability/overcoat.c b/test/battle/ability/overcoat.c index 5f2405167207..6673c0ceebfb 100644 --- a/test/battle/ability/overcoat.c +++ b/test/battle/ability/overcoat.c @@ -4,7 +4,7 @@ SINGLE_BATTLE_TEST("Overcoat blocks powder and spore moves") { GIVEN { - ASSUME(gBattleMoves[MOVE_STUN_SPORE].flags & FLAG_POWDER); + ASSUME(gBattleMoves[MOVE_STUN_SPORE].powderMove); PLAYER(SPECIES_WYNAUT); OPPONENT(SPECIES_PINECO) { Ability(ABILITY_OVERCOAT); } } WHEN { diff --git a/test/battle/ability/poison_point.c b/test/battle/ability/poison_point.c index 63690d84daad..7d2fcd518bf2 100644 --- a/test/battle/ability/poison_point.c +++ b/test/battle/ability/poison_point.c @@ -7,15 +7,15 @@ SINGLE_BATTLE_TEST("Poison Point inflicts poison on contact") PARAMETRIZE { move = MOVE_TACKLE; } PARAMETRIZE { move = MOVE_SWIFT; } GIVEN { - ASSUME(gBattleMoves[MOVE_TACKLE].flags & FLAG_MAKES_CONTACT); - ASSUME(!(gBattleMoves[MOVE_SWIFT].flags & FLAG_MAKES_CONTACT)); + ASSUME(gBattleMoves[MOVE_TACKLE].makesContact); + ASSUME(!gBattleMoves[MOVE_SWIFT].makesContact); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_NIDORAN_M) { Ability(ABILITY_POISON_POINT); } } WHEN { TURN { MOVE(player, move); } TURN {} } SCENE { - if (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) { + if (gBattleMoves[move].makesContact) { ABILITY_POPUP(opponent, ABILITY_POISON_POINT); ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, player); MESSAGE("Wobbuffet was poisoned by Foe Nidoran♂'s Poison Point!"); diff --git a/test/battle/ability/static.c b/test/battle/ability/static.c index eb52a838b744..e0d91aa0d52b 100644 --- a/test/battle/ability/static.c +++ b/test/battle/ability/static.c @@ -7,14 +7,14 @@ SINGLE_BATTLE_TEST("Static inflicts paralysis on contact") PARAMETRIZE { move = MOVE_TACKLE; } PARAMETRIZE { move = MOVE_SWIFT; } GIVEN { - ASSUME(gBattleMoves[MOVE_TACKLE].flags & FLAG_MAKES_CONTACT); - ASSUME(!(gBattleMoves[MOVE_SWIFT].flags & FLAG_MAKES_CONTACT)); + ASSUME(gBattleMoves[MOVE_TACKLE].makesContact); + ASSUME(!gBattleMoves[MOVE_SWIFT].makesContact); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_PIKACHU) { Ability(ABILITY_STATIC); } } WHEN { TURN { MOVE(player, move); } } SCENE { - if (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) { + if (gBattleMoves[move].makesContact) { ABILITY_POPUP(opponent, ABILITY_STATIC); ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PRZ, player); MESSAGE("Foe Pikachu's Static paralyzed Wobbuffet! It may be unable to move!"); diff --git a/test/battle/ability/stench.c b/test/battle/ability/stench.c index a91c861fc5fd..4153e6b15503 100644 --- a/test/battle/ability/stench.c +++ b/test/battle/ability/stench.c @@ -17,7 +17,6 @@ SINGLE_BATTLE_TEST("Stench has a 10% chance to flinch") SINGLE_BATTLE_TEST("Stench does not stack with King's Rock") { - KNOWN_FAILING; PASSES_RANDOMLY(1, 10, RNG_STENCH); GIVEN { ASSUME(gItems[ITEM_KINGS_ROCK].holdEffect == HOLD_EFFECT_FLINCH); diff --git a/test/battle/ability/swarm.c b/test/battle/ability/swarm.c index c6479412ad15..b49bd225f812 100644 --- a/test/battle/ability/swarm.c +++ b/test/battle/ability/swarm.c @@ -8,13 +8,21 @@ SINGLE_BATTLE_TEST("Swarm boosts Bug-type moves in a pinch", s16 damage) PARAMETRIZE { hp = 33; } GIVEN { ASSUME(gBattleMoves[MOVE_BUG_BITE].type == TYPE_BUG); - PLAYER(SPECIES_LEDYBA) { Ability(ABILITY_SWARM); MaxHP(99); HP(hp); } - OPPONENT(SPECIES_WOBBUFFET); + ASSUME(gBattleMoves[MOVE_BUG_BITE].power == 60); + ASSUME(gSpeciesInfo[SPECIES_LEDYBA].types[0] == TYPE_BUG); + ASSUME(gSpeciesInfo[SPECIES_WOBBUFFET].types[0] == TYPE_PSYCHIC); + ASSUME(gSpeciesInfo[SPECIES_WOBBUFFET].types[1] == TYPE_PSYCHIC); + PLAYER(SPECIES_LEDYBA) { Ability(ABILITY_SWARM); MaxHP(99); HP(hp); Attack(45); } + OPPONENT(SPECIES_WOBBUFFET) { Defense(121); } } WHEN { TURN { MOVE(player, MOVE_BUG_BITE); } } SCENE { HP_BAR(opponent, captureDamage: &results[i].damage); } FINALLY { - EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage); + // Due to numerics related to rounding on each applied multiplier, + // the 50% move power increase doesn't manifest as a 50% damage increase, but as a 44% damage increase in this case. + // Values obtained from https://calc.pokemonshowdown.com (Neutral nature and 0 IVs on both sides) + EXPECT_EQ(results[0].damage, 50); + EXPECT_EQ(results[1].damage, 72); } } diff --git a/test/battle/ability/toxic_debris.c b/test/battle/ability/toxic_debris.c index 95749358a4d9..f3e23e5abbf3 100644 --- a/test/battle/ability/toxic_debris.c +++ b/test/battle/ability/toxic_debris.c @@ -80,6 +80,21 @@ SINGLE_BATTLE_TEST("Each hit of a Multi Hit move activates Toxic Debris") } } +SINGLE_BATTLE_TEST("Toxic Debris activates if user faints after physical hit") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { HP(1); Ability(ABILITY_TOXIC_DEBRIS); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_TACKLE); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent); + MESSAGE("Wobbuffet fainted!"); + ABILITY_POPUP(player, ABILITY_TOXIC_DEBRIS); + MESSAGE("Poison Spikes were scattered all around the opposing team's feet!"); + } +} + SINGLE_BATTLE_TEST("Air Balloon is popped after Toxic Debris activates") { GIVEN { diff --git a/test/battle/ability/wind_power.c b/test/battle/ability/wind_power.c index 99691064085c..4616a69fb7fd 100644 --- a/test/battle/ability/wind_power.c +++ b/test/battle/ability/wind_power.c @@ -8,11 +8,11 @@ ASSUMPTIONS ASSUME(gBattleMoves[MOVE_TACKLE].power != 0); ASSUME(gBattleMoves[MOVE_AIR_CUTTER].power != 0); ASSUME(gBattleMoves[MOVE_AIR_CUTTER].target == MOVE_TARGET_BOTH); - ASSUME(gBattleMoves[MOVE_AIR_CUTTER].flags & FLAG_WIND_MOVE); + ASSUME(gBattleMoves[MOVE_AIR_CUTTER].windMove == TRUE); ASSUME(gBattleMoves[MOVE_PETAL_BLIZZARD].power != 0); ASSUME(gBattleMoves[MOVE_PETAL_BLIZZARD].target == MOVE_TARGET_FOES_AND_ALLY); - ASSUME(gBattleMoves[MOVE_PETAL_BLIZZARD].flags & FLAG_WIND_MOVE); - ASSUME(!(gBattleMoves[MOVE_TACKLE].flags & FLAG_WIND_MOVE)); + ASSUME(gBattleMoves[MOVE_PETAL_BLIZZARD].windMove == TRUE); + ASSUME(gBattleMoves[MOVE_TACKLE].windMove == FALSE); } SINGLE_BATTLE_TEST("Wind Power sets up Charge for player when hit by a wind move") diff --git a/test/battle/damage_formula.c b/test/battle/damage_formula.c new file mode 100644 index 000000000000..98aa197ca1de --- /dev/null +++ b/test/battle/damage_formula.c @@ -0,0 +1,78 @@ +#include "global.h" +#include "test/battle.h" + +// From https://bulbapedia.bulbagarden.net/wiki/Damage#Example + +SINGLE_BATTLE_TEST("Damage calculation matches Gen5+") +{ + s16 dmg; + s16 expectedDamage; + PARAMETRIZE { expectedDamage = 196; } + PARAMETRIZE { expectedDamage = 192; } + PARAMETRIZE { expectedDamage = 192; } + PARAMETRIZE { expectedDamage = 192; } + PARAMETRIZE { expectedDamage = 184; } + PARAMETRIZE { expectedDamage = 184; } + PARAMETRIZE { expectedDamage = 184; } + PARAMETRIZE { expectedDamage = 180; } + PARAMETRIZE { expectedDamage = 180; } + PARAMETRIZE { expectedDamage = 180; } + PARAMETRIZE { expectedDamage = 172; } + PARAMETRIZE { expectedDamage = 172; } + PARAMETRIZE { expectedDamage = 172; } + PARAMETRIZE { expectedDamage = 168; } + PARAMETRIZE { expectedDamage = 168; } + PARAMETRIZE { expectedDamage = 168; } + GIVEN { + PLAYER(SPECIES_GLACEON) { Level(75); Attack(123); } + OPPONENT(SPECIES_GARCHOMP) { Defense(163); } + } WHEN { + TURN { + MOVE(player, MOVE_ICE_FANG, WITH_RNG(RNG_DAMAGE_MODIFIER, i)); + } + } + SCENE{ + MESSAGE("Glaceon used Ice Fang!"); + HP_BAR(opponent, captureDamage: &dmg); + } + THEN{ + EXPECT_EQ(expectedDamage, dmg); + } +} + +SINGLE_BATTLE_TEST("Damage calculation matches Gen5+ (Muscle Band, crit)") +{ + s16 dmg; + s16 expectedDamage; + PARAMETRIZE { expectedDamage = 324; } + PARAMETRIZE { expectedDamage = 316; } + PARAMETRIZE { expectedDamage = 312; } + PARAMETRIZE { expectedDamage = 312; } + PARAMETRIZE { expectedDamage = 304; } + PARAMETRIZE { expectedDamage = 304; } + PARAMETRIZE { expectedDamage = 300; } + PARAMETRIZE { expectedDamage = 300; } + PARAMETRIZE { expectedDamage = 292; } + PARAMETRIZE { expectedDamage = 292; } + PARAMETRIZE { expectedDamage = 288; } + PARAMETRIZE { expectedDamage = 288; } + PARAMETRIZE { expectedDamage = 280; } + PARAMETRIZE { expectedDamage = 276; } + PARAMETRIZE { expectedDamage = 276; } + PARAMETRIZE { expectedDamage = 268; } + GIVEN { + PLAYER(SPECIES_GLACEON) { Level(75); Attack(123); Item(ITEM_MUSCLE_BAND); } + OPPONENT(SPECIES_GARCHOMP) { Defense(163); } + } WHEN { + TURN { + MOVE(player, MOVE_ICE_FANG, WITH_RNG(RNG_DAMAGE_MODIFIER, i), criticalHit: TRUE); + } + } + SCENE{ + MESSAGE("Glaceon used Ice Fang!"); + HP_BAR(opponent, captureDamage: &dmg); + } + THEN{ + EXPECT_EQ(expectedDamage, dmg); + } +} diff --git a/test/battle/form_change/ultra_burst.c b/test/battle/form_change/ultra_burst.c new file mode 100644 index 000000000000..e58d42c3daa5 --- /dev/null +++ b/test/battle/form_change/ultra_burst.c @@ -0,0 +1,127 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Dusk Mane Necrozma can Ultra Burst holding Ultranecrozium Z") +{ + GIVEN { + ASSUME(P_GEN_7_POKEMON == TRUE); + PLAYER(SPECIES_NECROZMA_DUSK_MANE) { Item(ITEM_ULTRANECROZIUM_Z); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_CELEBRATE, ultraBurst: TRUE); } + } SCENE { + MESSAGE("Bright light is about to burst out of Necrozma!"); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_ULTRA_BURST, player); + MESSAGE("Necrozma regained its true power through Ultra Burst!"); + } THEN { + EXPECT_EQ(player->species, SPECIES_NECROZMA_ULTRA); + } +} + +DOUBLE_BATTLE_TEST("Ultra Burst's order is determined by Speed - opponent faster") +{ + GIVEN { + ASSUME(P_GEN_7_POKEMON == TRUE); + PLAYER(SPECIES_NECROZMA_DUSK_MANE) { Item(ITEM_ULTRANECROZIUM_Z); Speed(1); } + PLAYER(SPECIES_WOBBUFFET) { Speed(3); } + OPPONENT(SPECIES_NECROZMA_DAWN_WINGS) { Item(ITEM_ULTRANECROZIUM_Z); Speed(3); } + OPPONENT(SPECIES_WOBBUFFET) { Speed(4); } + } WHEN { + TURN { MOVE(opponentLeft, MOVE_CELEBRATE, ultraBurst: TRUE); MOVE(playerLeft, MOVE_CELEBRATE, ultraBurst: TRUE); } + } SCENE { + MESSAGE("Bright light is about to burst out of Foe Necrozma!"); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_ULTRA_BURST, opponentLeft); + MESSAGE("Foe Necrozma regained its true power through Ultra Burst!"); + MESSAGE("Bright light is about to burst out of Necrozma!"); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_ULTRA_BURST, playerLeft); + MESSAGE("Necrozma regained its true power through Ultra Burst!"); + } +} + +DOUBLE_BATTLE_TEST("Ultra Burst's order is determined by Speed - player faster") +{ + GIVEN { + ASSUME(P_GEN_7_POKEMON == TRUE); + PLAYER(SPECIES_NECROZMA_DUSK_MANE) { Item(ITEM_ULTRANECROZIUM_Z); Speed(5); } + PLAYER(SPECIES_WOBBUFFET) { Speed(3); } + OPPONENT(SPECIES_NECROZMA_DAWN_WINGS) { Item(ITEM_ULTRANECROZIUM_Z); Speed(2); } + OPPONENT(SPECIES_WOBBUFFET) { Speed(4); } + } WHEN { + TURN { MOVE(opponentLeft, MOVE_CELEBRATE, ultraBurst: TRUE); MOVE(playerLeft, MOVE_CELEBRATE, ultraBurst: TRUE); } + } SCENE { + MESSAGE("Bright light is about to burst out of Necrozma!"); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_ULTRA_BURST, playerLeft); + MESSAGE("Necrozma regained its true power through Ultra Burst!"); + MESSAGE("Bright light is about to burst out of Foe Necrozma!"); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_ULTRA_BURST, opponentLeft); + MESSAGE("Foe Necrozma regained its true power through Ultra Burst!"); + } +} + +SINGLE_BATTLE_TEST("Ultra Burst affects turn order") +{ + GIVEN { + ASSUME(P_GEN_7_POKEMON == TRUE); + ASSUME(B_MEGA_EVO_TURN_ORDER); + PLAYER(SPECIES_NECROZMA_DUSK_MANE) { Item(ITEM_ULTRANECROZIUM_Z); Speed(105); } + OPPONENT(SPECIES_WOBBUFFET) { Speed(106); } + } WHEN { + TURN { MOVE(player, MOVE_CELEBRATE, ultraBurst: TRUE); } + } SCENE { + MESSAGE("Necrozma used Celebrate!"); + MESSAGE("Foe Wobbuffet used Celebrate!"); + } THEN { + ASSUME(player->speed == 263); + } +} + +DOUBLE_BATTLE_TEST("Ultra Burst happens after switching, but before Focus Punch-like Moves") +{ + GIVEN { + ASSUME(P_GEN_7_POKEMON == TRUE); + ASSUME(gBattleMoves[MOVE_FOCUS_PUNCH].effect == EFFECT_FOCUS_PUNCH); + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_NECROZMA_DUSK_MANE) { Item(ITEM_ULTRANECROZIUM_Z); } + OPPONENT(SPECIES_WYNAUT); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { SWITCH(opponentRight, 2); MOVE(playerRight, MOVE_FOCUS_PUNCH, ultraBurst: TRUE, target: opponentLeft); MOVE(playerLeft, MOVE_FOCUS_PUNCH, target: opponentLeft); } + TURN {} + } SCENE { + MESSAGE("2 withdrew Wobbuffet!"); + MESSAGE("2 sent out Wobbuffet!"); + + MESSAGE("Bright light is about to burst out of Necrozma!"); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_ULTRA_BURST, playerRight); + MESSAGE("Necrozma regained its true power through Ultra Burst!"); + + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FOCUS_PUNCH_SETUP, playerRight); + MESSAGE("Necrozma is tightening its focus!"); + + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FOCUS_PUNCH_SETUP, playerLeft); + MESSAGE("Wobbuffet is tightening its focus!"); + } +} + +SINGLE_BATTLE_TEST("Ultra Burst and Mega Evolution can happen on the same turn") +{ + GIVEN { + ASSUME(P_GEN_7_POKEMON == TRUE); + PLAYER(SPECIES_NECROZMA_DUSK_MANE) { Item(ITEM_ULTRANECROZIUM_Z); Speed(3); } + OPPONENT(SPECIES_GARDEVOIR) { Item(ITEM_GARDEVOIRITE); Speed(2); } + } WHEN { + TURN { MOVE(player, MOVE_CELEBRATE, ultraBurst: TRUE); MOVE(opponent, MOVE_CELEBRATE, megaEvolve: TRUE); } + } SCENE { + MESSAGE("Bright light is about to burst out of Necrozma!"); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_ULTRA_BURST, player); + MESSAGE("Necrozma regained its true power through Ultra Burst!"); + + MESSAGE("Foe Gardevoir's Gardevoirite is reacting to 2's Mega Ring!"); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_MEGA_EVOLUTION, opponent); + MESSAGE("Foe Gardevoir has Mega Evolved into Mega Gardevoir!"); + } THEN { + EXPECT_EQ(player->species, SPECIES_NECROZMA_ULTRA); + EXPECT_EQ(opponent->species, SPECIES_GARDEVOIR_MEGA); + } +} diff --git a/test/battle/hold_effect/enigma_berry.c b/test/battle/hold_effect/enigma_berry.c new file mode 100644 index 000000000000..6758ac402628 --- /dev/null +++ b/test/battle/hold_effect/enigma_berry.c @@ -0,0 +1,60 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + gItems[ITEM_ENIGMA_BERRY].holdEffect == HOLD_EFFECT_ENIGMA_BERRY; +} + +SINGLE_BATTLE_TEST("Enigma Berry recovers 25% of HP if hit by super effective move") +{ + GIVEN { + PLAYER(SPECIES_WYNAUT) { MaxHP(100); HP(2); Item(ITEM_ENIGMA_BERRY); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_ENDURE); MOVE(opponent, MOVE_BITE); } + } SCENE { + s32 maxHP = GetMonData(&PLAYER_PARTY[0], MON_DATA_MAX_HP); + ANIMATION(ANIM_TYPE_MOVE, MOVE_ENDURE, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BITE, opponent); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player); + MESSAGE("Wynaut's Enigma Berry restored health!"); + HP_BAR(player, damage: -maxHP / 4); + } +} + +SINGLE_BATTLE_TEST("Enigma Berry does nothing if not hit by super effective move") +{ + GIVEN { + PLAYER(SPECIES_MIGHTYENA) { MaxHP(100); HP(2); Item(ITEM_ENIGMA_BERRY); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_ENDURE); MOVE(opponent, MOVE_BITE); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_ENDURE, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BITE, opponent); + NONE_OF { + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player); + MESSAGE("Mightyena's Enigma Berry restored health!"); + } + } +} + +SINGLE_BATTLE_TEST("Enigma Berry does nothing if Heal Block applies") +{ + GIVEN { + PLAYER(SPECIES_WYNAUT) { MaxHP(100); HP(2); Item(ITEM_ENIGMA_BERRY); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_HEAL_BLOCK); } + TURN { MOVE(player, MOVE_ENDURE); MOVE(opponent, MOVE_BITE); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_HEAL_BLOCK, opponent); + ANIMATION(ANIM_TYPE_MOVE, MOVE_ENDURE, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BITE, opponent); + NONE_OF { + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player); + MESSAGE("Wynaut's Enigma Berry restored health!"); + } + } +} diff --git a/test/battle/hold_effect/metronome.c b/test/battle/hold_effect/metronome.c new file mode 100644 index 000000000000..76cd27c6f1b7 --- /dev/null +++ b/test/battle/hold_effect/metronome.c @@ -0,0 +1,156 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + gItems[ITEM_METRONOME].holdEffect == HOLD_EFFECT_METRONOME; +} + +const uq4_12_t MetronomeMultipliers[] = { + UQ_4_12(1.0), + UQ_4_12(1.2), + UQ_4_12(1.4), + UQ_4_12(1.6), + UQ_4_12(1.8), + UQ_4_12(2.0), + UQ_4_12(2.0) +}; + +#define METRONOME_TURNS (ARRAY_COUNT(MetronomeMultipliers)) + +SINGLE_BATTLE_TEST("Metronome Item gradually boosts power of consecutively used moves by 20%, up to 100%") +{ + s16 damage[METRONOME_TURNS]; + u32 j; + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_METRONOME); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + for (j = 0; j < METRONOME_TURNS; ++j) { + TURN { MOVE(player, MOVE_TACKLE); } + } + } SCENE { + for (j = 0; j < METRONOME_TURNS; ++j) { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, player); + HP_BAR(opponent, captureDamage: &damage[j]); + } + } THEN { + for (j = 0; j < METRONOME_TURNS; ++j) { + EXPECT_MUL_EQ(damage[0], MetronomeMultipliers[j], damage[j]); + } + } +} + +SINGLE_BATTLE_TEST("Metronome Item's boost is reset if the attacker uses a different move") +{ + s16 damage[2]; + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_METRONOME); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_TACKLE); } + TURN { MOVE(player, MOVE_QUICK_ATTACK); } + TURN { MOVE(player, MOVE_TACKLE); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, player); + HP_BAR(opponent, captureDamage: &damage[0]); + + ANIMATION(ANIM_TYPE_MOVE, MOVE_QUICK_ATTACK, player); + + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, player); + HP_BAR(opponent, captureDamage: &damage[1]); + } THEN { + EXPECT_EQ(damage[0], damage[1]); + } +} + +SINGLE_BATTLE_TEST("Metronome Item's boost is reset if the move fails") +{ + s16 damage[2]; + KNOWN_FAILING; //https://github.com/rh-hideout/pokeemerald-expansion/issues/3251 + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_METRONOME); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_TACKLE); } + TURN { MOVE(opponent, MOVE_PROTECT); MOVE(player, MOVE_TACKLE); } + TURN { MOVE(player, MOVE_TACKLE); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, player); + HP_BAR(opponent, captureDamage: &damage[0]); + + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, player); + HP_BAR(opponent, captureDamage: &damage[1]); + } THEN { + EXPECT_EQ(damage[0], damage[1]); + } +} + +SINGLE_BATTLE_TEST("Metronome Item counts called moves instead of the calling move") +{ + s16 damage[2]; + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_METRONOME); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_METRONOME, WITH_RNG(RNG_METRONOME, MOVE_TACKLE)); } + TURN { MOVE(player, MOVE_METRONOME, WITH_RNG(RNG_METRONOME, MOVE_TACKLE)); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, player); + HP_BAR(opponent, captureDamage: &damage[0]); + + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, player); + HP_BAR(opponent, captureDamage: &damage[1]); + } THEN { + EXPECT_MUL_EQ(damage[0], UQ_4_12(1.2), damage[1]); + } +} + +SINGLE_BATTLE_TEST("Metronome Item counts charging turn of moves for its attacking turn", s16 damage) +{ + u32 item; + + KNOWN_FAILING; // https://github.com/rh-hideout/pokeemerald-expansion/issues/3250 + PARAMETRIZE {item = ITEM_NONE; } + PARAMETRIZE {item = ITEM_METRONOME; } + GIVEN { + ASSUME(gBattleMoves[MOVE_SOLAR_BEAM].effect == EFFECT_SOLAR_BEAM); + PLAYER(SPECIES_WOBBUFFET) { Item(item); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_SOLAR_BEAM); } + TURN { SKIP_TURN(player); } + } SCENE { + MESSAGE("Wobbuffet used Solar Beam!"); + MESSAGE("Wobbuffet took in sunlight!"); + MESSAGE("Foe Wobbuffet used Celebrate!"); + MESSAGE("Congratulations, 1!"); + MESSAGE("Wobbuffet used Solar Beam!"); + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, UQ_4_12(1.2), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("Metronome Item doesn't increase damage per hit of multi-hit moves") +{ + s16 damage[3]; + GIVEN { + ASSUME(gBattleMoves[MOVE_FURY_ATTACK].effect == EFFECT_MULTI_HIT); + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_METRONOME); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_FURY_ATTACK); } + TURN { MOVE(player, MOVE_FURY_ATTACK); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_FURY_ATTACK, player); + HP_BAR(opponent, captureDamage: &damage[0]); + HP_BAR(opponent, captureDamage: &damage[1]); + MESSAGE("Hit 5 time(s)!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_FURY_ATTACK, player); + HP_BAR(opponent, captureDamage: &damage[2]); + } THEN { + EXPECT_MUL_EQ(damage[0], UQ_4_12(1.2), damage[2]); // Got bonus once for the second turn + EXPECT_EQ(damage[0], damage[1]); // Do not get the bonus while still inside the first turn + } +} diff --git a/test/battle/hold_effect/safety_goggles.c b/test/battle/hold_effect/safety_goggles.c index bec703443e2b..3deeeb810fe7 100644 --- a/test/battle/hold_effect/safety_goggles.c +++ b/test/battle/hold_effect/safety_goggles.c @@ -9,7 +9,7 @@ ASSUMPTIONS SINGLE_BATTLE_TEST("Safety Goggles block powder and spore moves") { GIVEN { - ASSUME(gBattleMoves[MOVE_STUN_SPORE].flags & FLAG_POWDER); + ASSUME(gBattleMoves[MOVE_STUN_SPORE].powderMove); ASSUME(gItems[ITEM_SAFETY_GOGGLES].holdEffect == HOLD_EFFECT_SAFETY_GOGGLES); PLAYER(SPECIES_WYNAUT); OPPONENT(SPECIES_ABRA) { Item(ITEM_SAFETY_GOGGLES); } diff --git a/test/battle/move.c b/test/battle/move.c index e89c2ad35fcf..03ed84f53c90 100644 --- a/test/battle/move.c +++ b/test/battle/move.c @@ -99,7 +99,7 @@ SINGLE_BATTLE_TEST("Critical hits occur at a 1/24 rate") SINGLE_BATTLE_TEST("Slash's critical hits occur at a 1/8 rate") { ASSUME(B_CRIT_CHANCE >= GEN_7); - ASSUME(gBattleMoves[MOVE_SLASH].flags & FLAG_HIGH_CRIT); + ASSUME(gBattleMoves[MOVE_SLASH].highCritRatio); PASSES_RANDOMLY(1, 8, RNG_CRITICAL_HIT); GIVEN { PLAYER(SPECIES_WOBBUFFET); diff --git a/test/battle/move_effect/axe_kick.c b/test/battle/move_effect/axe_kick.c new file mode 100644 index 000000000000..e8674579f463 --- /dev/null +++ b/test/battle/move_effect/axe_kick.c @@ -0,0 +1,54 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_AXE_KICK].effect == EFFECT_AXE_KICK); +} + +SINGLE_BATTLE_TEST("Axe Kick confuses the target") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_AXE_KICK); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_AXE_KICK, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_CONFUSION, opponent); + MESSAGE("Foe Wobbuffet became confused!"); + } +} + +SINGLE_BATTLE_TEST("Axe Kick deals damage half the hp to user if def battler protected") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_PROTECT); MOVE(player, MOVE_AXE_KICK); } + } SCENE { + s32 maxHP = GetMonData(&PLAYER_PARTY[0], MON_DATA_MAX_HP); + ANIMATION(ANIM_TYPE_MOVE, MOVE_PROTECT, opponent); + MESSAGE("Foe Wobbuffet protected itself!"); + MESSAGE("Foe Wobbuffet protected itself!"); + MESSAGE("Wobbuffet kept going and crashed!"); + HP_BAR(player, hp: maxHP / 2); + } +} + +SINGLE_BATTLE_TEST("Axe Kick deals damage half the hp to user if it fails") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_AXE_KICK, hit: FALSE); } + } SCENE { + s32 maxHP = GetMonData(&PLAYER_PARTY[0], MON_DATA_MAX_HP); + MESSAGE("Wobbuffet used Axe Kick!"); + MESSAGE("Wobbuffet's attack missed!"); + MESSAGE("Wobbuffet kept going and crashed!"); + HP_BAR(player, hp: maxHP / 2); + } +} diff --git a/test/battle/move_effect/beak_blast.c b/test/battle/move_effect/beak_blast.c index 50bff2411c71..8ecf1961189d 100644 --- a/test/battle/move_effect/beak_blast.c +++ b/test/battle/move_effect/beak_blast.c @@ -37,7 +37,7 @@ DOUBLE_BATTLE_TEST("Beak Blast burns all who make contact with the pokemon") { GIVEN { ASSUME(gBattleMoves[MOVE_BEAK_BLAST].priority < 0); - ASSUME(gBattleMoves[MOVE_TACKLE].flags & FLAG_MAKES_CONTACT); + ASSUME(gBattleMoves[MOVE_TACKLE].makesContact); PLAYER(SPECIES_WYNAUT) { Speed(10); } PLAYER(SPECIES_WOBBUFFET) { Speed(5); } OPPONENT(SPECIES_WOBBUFFET) { Speed(3); } @@ -80,9 +80,9 @@ SINGLE_BATTLE_TEST("Beak Blast burns only when contact moves are used") PARAMETRIZE { move = MOVE_LEER; burn = FALSE; } GIVEN { - ASSUME(gBattleMoves[MOVE_TACKLE].flags & FLAG_MAKES_CONTACT); - ASSUME(!(gBattleMoves[MOVE_WATER_GUN].flags & FLAG_MAKES_CONTACT)); - ASSUME(!(gBattleMoves[MOVE_LEER].flags & FLAG_MAKES_CONTACT)); + ASSUME(gBattleMoves[MOVE_TACKLE].makesContact); + ASSUME(!gBattleMoves[MOVE_WATER_GUN].makesContact); + ASSUME(!gBattleMoves[MOVE_LEER].makesContact); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET); } WHEN { diff --git a/test/battle/move_effect/bug_bite.c b/test/battle/move_effect/bug_bite.c index 315d52109c5a..385b8a400ff3 100644 --- a/test/battle/move_effect/bug_bite.c +++ b/test/battle/move_effect/bug_bite.c @@ -10,13 +10,13 @@ ASSUMPTIONS // Pretty much copy/paste of the Berry Fling Test. SINGLE_BATTLE_TEST("Bug Bite eats the target's berry and immediately gains its effect") { - u16 item; - u32 status1 = STATUS1_NONE, effect, statId; + u16 item = ITEM_NONE; + u32 status1 = STATUS1_NONE, effect = HOLD_EFFECT_NONE, statId = 0; PARAMETRIZE { item = ITEM_NONE; } PARAMETRIZE { item = ITEM_ORAN_BERRY; effect = HOLD_EFFECT_RESTORE_HP; } PARAMETRIZE { item = ITEM_SITRUS_BERRY; effect = HOLD_EFFECT_RESTORE_HP; } - // PARAMETRIZE { item = ITEM_ENIGMA_BERRY; effect = HOLD_EFFECT_RESTORE_HP; } To do once Enigma Berry's effect is done + PARAMETRIZE { item = ITEM_ENIGMA_BERRY; effect = HOLD_EFFECT_ENIGMA_BERRY; } PARAMETRIZE { item = ITEM_LEPPA_BERRY; effect = HOLD_EFFECT_RESTORE_PP; } PARAMETRIZE { item = ITEM_CHESTO_BERRY; effect = HOLD_EFFECT_CURE_SLP; status1 = STATUS1_SLEEP; } PARAMETRIZE { item = ITEM_CHERI_BERRY; effect = HOLD_EFFECT_CURE_PAR; status1 = STATUS1_PARALYSIS; } @@ -50,13 +50,13 @@ SINGLE_BATTLE_TEST("Bug Bite eats the target's berry and immediately gains its e MESSAGE("Wobbuffet used Bug Bite!"); ANIMATION(ANIM_TYPE_MOVE, MOVE_BUG_BITE, player); HP_BAR(opponent); - if (effect == HOLD_EFFECT_RESTORE_HP) { + if (effect == HOLD_EFFECT_RESTORE_HP || effect == HOLD_EFFECT_ENIGMA_BERRY) { if (item == ITEM_ORAN_BERRY) { MESSAGE("Wobbuffet's Oran Berry restored health!"); } else if (item == ITEM_SITRUS_BERRY) { MESSAGE("Wobbuffet's Sitrus Berry restored health!"); } else { - // MESSAGE("Wobbuffet's Enigma Berry restored health!"); + MESSAGE("Wobbuffet's Enigma Berry restored health!"); } HP_BAR(player); } diff --git a/test/battle/move_effect/collision_course.c b/test/battle/move_effect/collision_course.c new file mode 100644 index 000000000000..734095038b6a --- /dev/null +++ b/test/battle/move_effect/collision_course.c @@ -0,0 +1,47 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_COLLISION_COURSE].effect == EFFECT_COLLISION_COURSE); +} + +SINGLE_BATTLE_TEST("Collision Course damage is increased by 33 Percent if super effective", s16 damage) +{ + u32 move; + + PARAMETRIZE { move = MOVE_HAMMER_ARM; } + PARAMETRIZE { move = MOVE_COLLISION_COURSE; } + + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_KANGASKHAN); + } WHEN { + TURN { MOVE(player, move); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, move, player); + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.3333), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("Collision Course does normal damage if not super effective", s16 damage) +{ + u32 move; + + PARAMETRIZE { move = MOVE_HAMMER_ARM; } + PARAMETRIZE { move = MOVE_COLLISION_COURSE; } + + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, move); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, move, player); + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_EQ(results[0].damage, results[1].damage); + } +} diff --git a/test/battle/move_effect/corrosive_gas.c b/test/battle/move_effect/corrosive_gas.c new file mode 100644 index 000000000000..e4b6a958e7ea --- /dev/null +++ b/test/battle/move_effect/corrosive_gas.c @@ -0,0 +1,119 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_CORROSIVE_GAS].effect == EFFECT_CORROSIVE_GAS); +} + +SINGLE_BATTLE_TEST("Corrosive Gas destroys the target's item or fails if the target has no item") +{ + u16 item; + + PARAMETRIZE {item = ITEM_NONE; } + PARAMETRIZE {item = ITEM_POTION; } + + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) {Item(item); } + } WHEN { + TURN { MOVE(player, MOVE_CORROSIVE_GAS); } + } SCENE { + MESSAGE("Wobbuffet used CorrosiveGas!"); + if (item == ITEM_POTION) { + ANIMATION(ANIM_TYPE_MOVE, MOVE_CORROSIVE_GAS, player); + MESSAGE("Wobbuffet corroded Foe Wobbuffet's Potion!"); + } + else { + MESSAGE("It had no effect on Foe Wobbuffet!"); + } + } THEN { + EXPECT_EQ(opponent->item, ITEM_NONE); + } +} + +SINGLE_BATTLE_TEST("Corrosive Gas doesn't destroy the item of a Pokemon with the Sticky Hold ability") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_MUK) {Item(ITEM_POISON_BARB); Ability(ABILITY_STICKY_HOLD); } + } WHEN { + TURN { MOVE(player, MOVE_CORROSIVE_GAS); } + } SCENE { + MESSAGE("Wobbuffet used CorrosiveGas!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_CORROSIVE_GAS, player); + NOT MESSAGE("Wobbuffet corroded Foe Wobbuffet's Potion!"); + ABILITY_POPUP(opponent, ABILITY_STICKY_HOLD); + MESSAGE("Foe Muk's Sticky Hold made CorrosiveGas ineffective!"); + } THEN { + EXPECT_EQ(opponent->item, ITEM_POISON_BARB); + } +} + +SINGLE_BATTLE_TEST("Items lost to Corrosive Gas cannot be restored by Recycle") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_RECYCLE].effect == EFFECT_RECYCLE); + PLAYER(SPECIES_WOBBUFFET) {Speed(15); } + OPPONENT(SPECIES_WOBBUFFET) {Item(ITEM_ORAN_BERRY); Speed(10); } + } WHEN { + TURN { MOVE(player, MOVE_CORROSIVE_GAS); MOVE(opponent, MOVE_RECYCLE); } + } SCENE { + MESSAGE("Wobbuffet used CorrosiveGas!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_CORROSIVE_GAS, player); + MESSAGE("Wobbuffet corroded Foe Wobbuffet's Oran Berry!"); + MESSAGE("Foe Wobbuffet used Recycle!"); + MESSAGE("But it failed!"); + } THEN { + EXPECT_EQ(opponent->item, ITEM_NONE); + } +} + +DOUBLE_BATTLE_TEST("Corrosive Gas destroys foes and ally's items if they have one") +{ + // Check it affects all targets in all possible configurations. + u32 j, k, l; + u16 itemOpponentLeft, itemOpponentRight, itemPlayerLeft; + + for (j = 0; j < 2; j++) { + for (k = 0; k < 2; k++) { + for (l = 0; l < 2; l++) { + PARAMETRIZE {itemOpponentLeft = (j & 1) ? ITEM_ORAN_BERRY : ITEM_NONE; + itemOpponentRight = (k & 1) ? ITEM_CHESTO_BERRY : ITEM_NONE; + itemPlayerLeft = (l & 1) ? ITEM_CHERI_BERRY : ITEM_NONE; } + } + } + } + + GIVEN { + PLAYER(SPECIES_WOBBUFFET) {Item(itemPlayerLeft);} + PLAYER(SPECIES_WYNAUT) {Item(ITEM_SITRUS_BERRY);} + OPPONENT(SPECIES_ABRA) {Item(itemOpponentLeft);} + OPPONENT(SPECIES_KADABRA) {Item(itemOpponentRight);} + } WHEN { + TURN { MOVE(playerRight, MOVE_CORROSIVE_GAS); } + } SCENE { + MESSAGE("Wynaut used CorrosiveGas!"); + if (itemPlayerLeft == ITEM_CHERI_BERRY) { + MESSAGE("Wynaut corroded Wobbuffet's Cheri Berry!"); + } else { + MESSAGE("It had no effect on Wobbuffet!"); + } + if (itemOpponentLeft == ITEM_ORAN_BERRY) { + MESSAGE("Wynaut corroded Foe Abra's Oran Berry!"); + } else { + MESSAGE("It had no effect on Foe Abra!"); + } + if (itemOpponentRight == ITEM_CHESTO_BERRY) { + MESSAGE("Wynaut corroded Foe Kadabra's Chesto Berry!"); + } else { + MESSAGE("It had no effect on Foe Kadabra!"); + } + + } THEN { + EXPECT_EQ(playerRight->item, ITEM_SITRUS_BERRY); // Attacker doesn't lose its item. + EXPECT_EQ(playerLeft->item, ITEM_NONE); + EXPECT_EQ(opponentLeft->item, ITEM_NONE); + EXPECT_EQ(opponentRight->item, ITEM_NONE); + } +} diff --git a/test/battle/move_effect/fling.c b/test/battle/move_effect/fling.c index 5abb883e1ef3..8d44d9b9f1b2 100644 --- a/test/battle/move_effect/fling.c +++ b/test/battle/move_effect/fling.c @@ -255,6 +255,7 @@ SINGLE_BATTLE_TEST("Fling - thrown berry's effect activates for the target even PARAMETRIZE { item = ITEM_ORAN_BERRY; effect = HOLD_EFFECT_RESTORE_HP; } PARAMETRIZE { item = ITEM_SITRUS_BERRY; effect = HOLD_EFFECT_RESTORE_HP; } + PARAMETRIZE { item = ITEM_ENIGMA_BERRY; effect = HOLD_EFFECT_ENIGMA_BERRY; } PARAMETRIZE { item = ITEM_LEPPA_BERRY; effect = HOLD_EFFECT_RESTORE_PP; } PARAMETRIZE { item = ITEM_CHESTO_BERRY; effect = HOLD_EFFECT_CURE_SLP; status1 = STATUS1_SLEEP; } PARAMETRIZE { item = ITEM_CHERI_BERRY; effect = HOLD_EFFECT_CURE_PAR; status1 = STATUS1_PARALYSIS; } @@ -262,6 +263,7 @@ SINGLE_BATTLE_TEST("Fling - thrown berry's effect activates for the target even PARAMETRIZE { item = ITEM_PECHA_BERRY; effect = HOLD_EFFECT_CURE_PSN; status1 = STATUS1_TOXIC_POISON; } PARAMETRIZE { item = ITEM_RAWST_BERRY; effect = HOLD_EFFECT_CURE_BRN; status1 = STATUS1_BURN; } PARAMETRIZE { item = ITEM_ASPEAR_BERRY; effect = HOLD_EFFECT_CURE_FRZ; status1 = STATUS1_FREEZE; } + PARAMETRIZE { item = ITEM_ASPEAR_BERRY; effect = HOLD_EFFECT_CURE_FRZ; status1 = STATUS1_FROSTBITE; } PARAMETRIZE { item = ITEM_APICOT_BERRY; effect = HOLD_EFFECT_SP_DEFENSE_UP; statId = STAT_SPDEF; } PARAMETRIZE { item = ITEM_MARANGA_BERRY; effect = HOLD_EFFECT_MARANGA_BERRY; statId = STAT_SPDEF; } PARAMETRIZE { item = ITEM_GANLON_BERRY; effect = HOLD_EFFECT_DEFENSE_UP; statId = STAT_DEF; } @@ -282,8 +284,10 @@ SINGLE_BATTLE_TEST("Fling - thrown berry's effect activates for the target even if (effect == HOLD_EFFECT_RESTORE_HP) { if (item == ITEM_ORAN_BERRY) { MESSAGE("Foe Wobbuffet's Oran Berry restored health!"); - } else { + } else if (item == ITEM_SITRUS_BERRY) { MESSAGE("Foe Wobbuffet's Sitrus Berry restored health!"); + } else { + MESSAGE("Wobbuffet's Enigma Berry restored health!"); } HP_BAR(opponent); } @@ -297,6 +301,8 @@ SINGLE_BATTLE_TEST("Fling - thrown berry's effect activates for the target even MESSAGE("Foe Wobbuffet's Chesto Berry woke it from its sleep!"); } else if (status1 == STATUS1_FREEZE) { MESSAGE("Foe Wobbuffet's Aspear Berry defrosted it!"); + } else if (status1 == STATUS1_FROSTBITE) { + MESSAGE("Foe Wobbuffet's Aspear Berry healed its frostbite!"); } else if (status1 == STATUS1_PARALYSIS) { MESSAGE("Foe Wobbuffet's Cheri Berry cured paralysis!"); } else if (status1 == STATUS1_TOXIC_POISON || status1 == STATUS1_POISON) { diff --git a/test/battle/move_effect/gigaton_hammer.c b/test/battle/move_effect/gigaton_hammer.c new file mode 100644 index 000000000000..aaff50f75211 --- /dev/null +++ b/test/battle/move_effect/gigaton_hammer.c @@ -0,0 +1,63 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_GIGATON_HAMMER].effect == EFFECT_GIGATON_HAMMER); +} + +SINGLE_BATTLE_TEST("Struggle will be used if slow Encore is used on Gigaton Hammer") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_ENCORE].effect == EFFECT_ENCORE); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_GIGATON_HAMMER); MOVE(opponent, MOVE_ENCORE); } + TURN { FORCED_MOVE(player); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_GIGATON_HAMMER, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_ENCORE, opponent); + ANIMATION(ANIM_TYPE_MOVE, MOVE_STRUGGLE, player); + } +} + +SINGLE_BATTLE_TEST("Gigaton Hammer strikes again if fast encore is used") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_ENCORE].effect == EFFECT_ENCORE); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_GIGATON_HAMMER); } + TURN { MOVE(opponent, MOVE_ENCORE); FORCED_MOVE(player); } + TURN { FORCED_MOVE(player); } + TURN { FORCED_MOVE(player); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponent); + ANIMATION(ANIM_TYPE_MOVE, MOVE_GIGATON_HAMMER, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_ENCORE, opponent); + ANIMATION(ANIM_TYPE_MOVE, MOVE_GIGATON_HAMMER, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_STRUGGLE, player); + } +} + +SINGLE_BATTLE_TEST("Gigaton Hammer alternates with Struggle if it is the only usable move left") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Moves(MOVE_GIGATON_HAMMER, MOVE_NONE, MOVE_NONE, MOVE_NONE); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_GIGATON_HAMMER); } + TURN { FORCED_MOVE(player); } + TURN { MOVE(player, MOVE_GIGATON_HAMMER); } + TURN { FORCED_MOVE(player); } + TURN { MOVE(player, MOVE_GIGATON_HAMMER); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_GIGATON_HAMMER, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_STRUGGLE, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_GIGATON_HAMMER, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_STRUGGLE, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_GIGATON_HAMMER, player); + } +} diff --git a/test/battle/move_effect/hit_set_remove_terrain.c b/test/battle/move_effect/hit_set_remove_terrain.c index 140a112f7fc7..5c21d0853805 100644 --- a/test/battle/move_effect/hit_set_remove_terrain.c +++ b/test/battle/move_effect/hit_set_remove_terrain.c @@ -3,7 +3,7 @@ ASSUMPTIONS { - ASSUME(gBattleMoves[MOVE_ELECTRIC_TERRAIN].effect == MOVE_ELECTRIC_TERRAIN); + ASSUME(gBattleMoves[MOVE_ELECTRIC_TERRAIN].effect == EFFECT_ELECTRIC_TERRAIN); ASSUME(gBattleMoves[MOVE_PSYCHIC_TERRAIN].effect == EFFECT_PSYCHIC_TERRAIN); ASSUME(gBattleMoves[MOVE_GRASSY_TERRAIN].effect == EFFECT_GRASSY_TERRAIN); ASSUME(gBattleMoves[MOVE_MISTY_TERRAIN].effect == EFFECT_MISTY_TERRAIN); diff --git a/test/battle/move_effect/infernal_parade.c b/test/battle/move_effect/infernal_parade.c new file mode 100644 index 000000000000..38cfc9733a74 --- /dev/null +++ b/test/battle/move_effect/infernal_parade.c @@ -0,0 +1,48 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_INFERNAL_PARADE].effect == EFFECT_INFERNAL_PARADE); +} + +SINGLE_BATTLE_TEST("Infernal Parade inflicts poison") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_INFERNAL_PARADE); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_INFERNAL_PARADE, player); + HP_BAR(opponent); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_BRN, opponent); + STATUS_ICON(opponent, burn: TRUE); + } +} + +SINGLE_BATTLE_TEST("Infernal Parade's power doubles if the target has a status condition", s16 damage) +{ + u32 status1; + PARAMETRIZE { status1 = STATUS1_NONE; } + PARAMETRIZE { status1 = STATUS1_SLEEP; } + PARAMETRIZE { status1 = STATUS1_POISON; } + PARAMETRIZE { status1 = STATUS1_BURN; } + PARAMETRIZE { status1 = STATUS1_FREEZE; } + PARAMETRIZE { status1 = STATUS1_PARALYSIS; } + PARAMETRIZE { status1 = STATUS1_TOXIC_POISON; } + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) { Status1(status1); }; + } WHEN { + TURN { MOVE(player, MOVE_INFERNAL_PARADE); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_INFERNAL_PARADE, player); + HP_BAR(opponent, captureDamage: &results[i].damage); + } THEN { + if (i > 0) + EXPECT_MUL_EQ(results[0].damage, Q_4_12(2.0), results[i].damage); + if (i > 1) + EXPECT_EQ(results[i-1].damage, results[i].damage); + } +} diff --git a/test/battle/move_effect/make_it_rain.c b/test/battle/move_effect/make_it_rain.c new file mode 100644 index 000000000000..42046c1457d8 --- /dev/null +++ b/test/battle/move_effect/make_it_rain.c @@ -0,0 +1,34 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_MAKE_IT_RAIN].effect == EFFECT_MAKE_IT_RAIN); +} + +SINGLE_BATTLE_TEST("Make It Rain lowers special attack by one stage") +{ + s16 damage[2]; + + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_MAKE_IT_RAIN); } + TURN { MOVE(player, MOVE_MAKE_IT_RAIN); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_MAKE_IT_RAIN, player); + HP_BAR(opponent, captureDamage: &damage[0]); + MESSAGE("Coins scattered everywhere!"); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); + MESSAGE("Wobbuffet's Sp. Atk fell!"); + + ANIMATION(ANIM_TYPE_MOVE, MOVE_MAKE_IT_RAIN, player); + HP_BAR(opponent, captureDamage: &damage[1]); + MESSAGE("Coins scattered everywhere!"); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); + MESSAGE("Wobbuffet's Sp. Atk fell!"); + } THEN { + EXPECT_MUL_EQ(damage[0], Q_4_12(0.66), damage[1]); + } +} diff --git a/test/battle/move_effect/metronome.c b/test/battle/move_effect/metronome.c index c6611ffa520b..390c834be257 100644 --- a/test/battle/move_effect/metronome.c +++ b/test/battle/move_effect/metronome.c @@ -25,7 +25,7 @@ SINGLE_BATTLE_TEST("Metronome picks a random move") SINGLE_BATTLE_TEST("Metronome's called powder move fails against Grass Types") { GIVEN { - ASSUME(gBattleMoves[MOVE_POISON_POWDER].flags & FLAG_POWDER); + ASSUME(gBattleMoves[MOVE_POISON_POWDER].powderMove); ASSUME(gSpeciesInfo[SPECIES_TANGELA].types[0] == TYPE_GRASS); ASSUME(gBattleMoves[MOVE_POISON_POWDER].effect == EFFECT_POISON); PLAYER(SPECIES_WOBBUFFET); diff --git a/test/battle/move_effect/mirror_move.c b/test/battle/move_effect/mirror_move.c index b709ffce7eac..96d5280c530e 100644 --- a/test/battle/move_effect/mirror_move.c +++ b/test/battle/move_effect/mirror_move.c @@ -41,7 +41,7 @@ SINGLE_BATTLE_TEST("Mirror Move fails if no move was used before") SINGLE_BATTLE_TEST("Mirror Move's called powder move fails against Grass Types") { GIVEN { - ASSUME(gBattleMoves[MOVE_STUN_SPORE].flags & FLAG_POWDER); + ASSUME(gBattleMoves[MOVE_STUN_SPORE].powderMove); ASSUME(gSpeciesInfo[SPECIES_ODDISH].types[0] == TYPE_GRASS); ASSUME(gBattleMoves[MOVE_STUN_SPORE].effect == EFFECT_PARALYZE); PLAYER(SPECIES_ODDISH); diff --git a/test/battle/move_effect/mortal_spin.c b/test/battle/move_effect/mortal_spin.c new file mode 100644 index 000000000000..0ac8403e2857 --- /dev/null +++ b/test/battle/move_effect/mortal_spin.c @@ -0,0 +1,24 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_MORTAL_SPIN].effect == EFFECT_MORTAL_SPIN); +} + +SINGLE_BATTLE_TEST("Mortal Spin blows away hazards and poisons foe") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_STEALTH_ROCK); MOVE(player, MOVE_MORTAL_SPIN); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_STEALTH_ROCK, opponent); + ANIMATION(ANIM_TYPE_MOVE, MOVE_MORTAL_SPIN, player); + MESSAGE("Wobbuffet blew away Stealth Rock!"); + MESSAGE("Foe Wobbuffet was poisoned!"); + STATUS_ICON(opponent, poison: TRUE); + } +} + diff --git a/test/battle/move_effect/population_bomb.c b/test/battle/move_effect/population_bomb.c new file mode 100644 index 000000000000..e4fad6976ce0 --- /dev/null +++ b/test/battle/move_effect/population_bomb.c @@ -0,0 +1,29 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Population Bomb can hit ten times") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_POPULATION_BOMB].strikeCount == 10); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_POPULATION_BOMB); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_POPULATION_BOMB, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_POPULATION_BOMB, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_POPULATION_BOMB, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_POPULATION_BOMB, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_POPULATION_BOMB, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_POPULATION_BOMB, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_POPULATION_BOMB, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_POPULATION_BOMB, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_POPULATION_BOMB, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_POPULATION_BOMB, player); + MESSAGE("Hit 10 time(s)!"); + } +} + +TO_DO_BATTLE_TEST("Accuracy for Population Bomb is checked independently for each hit") +TO_DO_BATTLE_TEST("Accuracy for Population Bomb is only checked for the first hit with Skill Link") +TO_DO_BATTLE_TEST("Accuracy for Population Bomb is only checked for the first hit with Loaded Dice") diff --git a/test/battle/move_effect/protect.c b/test/battle/move_effect/protect.c index bd7a7329294f..39bd0eb8ae85 100644 --- a/test/battle/move_effect/protect.c +++ b/test/battle/move_effect/protect.c @@ -13,10 +13,10 @@ ASSUMPTIONS ASSUME(gBattleMoves[MOVE_CRAFTY_SHIELD].effect == EFFECT_PROTECT); ASSUME(gBattleMoves[MOVE_BANEFUL_BUNKER].effect == EFFECT_PROTECT); ASSUME(gBattleMoves[MOVE_TACKLE].split == SPLIT_PHYSICAL); - ASSUME(gBattleMoves[MOVE_TACKLE].flags & FLAG_MAKES_CONTACT); + ASSUME(gBattleMoves[MOVE_TACKLE].makesContact); ASSUME(gBattleMoves[MOVE_LEER].split == SPLIT_STATUS); ASSUME(gBattleMoves[MOVE_WATER_GUN].split == SPLIT_SPECIAL); - ASSUME(!(gBattleMoves[MOVE_WATER_GUN].flags & FLAG_MAKES_CONTACT)); + ASSUME(!(gBattleMoves[MOVE_WATER_GUN].makesContact)); } SINGLE_BATTLE_TEST("Protect, Detect, Spiky Shield and Baneful Bunker protect from all moves") diff --git a/test/battle/move_effect/recoil_if_miss.c b/test/battle/move_effect/recoil_if_miss.c index c72fd26489c8..f7d5cf24231c 100644 --- a/test/battle/move_effect/recoil_if_miss.c +++ b/test/battle/move_effect/recoil_if_miss.c @@ -25,7 +25,7 @@ SINGLE_BATTLE_TEST("Jump Kick has 50% recoil on miss") SINGLE_BATTLE_TEST("Jump Kick has 50% recoil on protect") { GIVEN { - ASSUME(gBattleMoves[MOVE_JUMP_KICK].flags & FLAG_PROTECT_AFFECTED); + ASSUME(!gBattleMoves[MOVE_JUMP_KICK].ignoresProtect); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET); } WHEN { diff --git a/test/battle/move_effect/salt_cure.c b/test/battle/move_effect/salt_cure.c new file mode 100644 index 000000000000..fcf240631a04 --- /dev/null +++ b/test/battle/move_effect/salt_cure.c @@ -0,0 +1,72 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_SALT_CURE].effect == EFFECT_SALT_CURE); +} + +SINGLE_BATTLE_TEST("Salt Cure inflicts 1/8 of the target's maximum HP as damage per turn") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_SALT_CURE); } + for (i = 0; i < 3; i++) + TURN {} + } SCENE { + s32 maxHP = GetMonData(&OPPONENT_PARTY[0], MON_DATA_MAX_HP); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SALT_CURE, player); + MESSAGE("Foe Wobbuffet is being salt cured!"); + for (i = 0; i < 4; i++) { + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_SALT_CURE_DAMAGE, opponent); + HP_BAR(opponent, damage: maxHP / 8); + MESSAGE("Foe Wobbuffet is hurt by Salt Cure!"); + } + } +} + +SINGLE_BATTLE_TEST("Salt Cure inflicts 1/4 to Water/Steel types of their maximum HP as damage per turn") +{ + u32 species; + + PARAMETRIZE { species = SPECIES_LAPRAS; }; + PARAMETRIZE { species = SPECIES_JIRACHI; }; + + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(species); + } WHEN { + TURN { MOVE(player, MOVE_SALT_CURE); } + TURN {} + } SCENE { + s32 maxHP = GetMonData(&OPPONENT_PARTY[0], MON_DATA_MAX_HP); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SALT_CURE, player); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_SALT_CURE_DAMAGE, opponent); + HP_BAR(opponent, damage: maxHP / 4); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_SALT_CURE_DAMAGE, opponent); + HP_BAR(opponent, damage: maxHP / 4); + } +} + +SINGLE_BATTLE_TEST("Salt Cure is removed when the afflicted Pokémon is switched out") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WYNAUT); + } WHEN { + TURN { MOVE(player, MOVE_SALT_CURE); } + TURN { SWITCH(opponent, 1); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SALT_CURE, player); + MESSAGE("Foe Wobbuffet is being salt cured!"); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_SALT_CURE_DAMAGE, opponent); + MESSAGE("Foe Wobbuffet is hurt by Salt Cure!"); + NONE_OF { + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_SALT_CURE_DAMAGE, opponent); + MESSAGE("Foe Wobbuffet is hurt by Salt Cure!"); + } + } +} diff --git a/test/battle/move_effect/spin_out.c b/test/battle/move_effect/spin_out.c new file mode 100644 index 000000000000..7966882c6a5e --- /dev/null +++ b/test/battle/move_effect/spin_out.c @@ -0,0 +1,21 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_SPIN_OUT].effect == EFFECT_SPIN_OUT); +} + +SINGLE_BATTLE_TEST("Spin Out lowers speed by 2 stages") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_SPIN_OUT); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPIN_OUT, player); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); + MESSAGE("Wobbuffet's Speed harshly fell!"); + } +} diff --git a/test/battle/move_effect/stockpile.c b/test/battle/move_effect/stockpile.c index 0e540bb5d391..e5f108a16d23 100644 --- a/test/battle/move_effect/stockpile.c +++ b/test/battle/move_effect/stockpile.c @@ -250,4 +250,3 @@ DOUBLE_BATTLE_TEST("Stockpile's Def and Sp. Def boost is lost after using Spit U EXPECT_MUL_EQ(results[2].dmgSpecialBefore, UQ_4_12(1.0), results[2].dmgSpecialAfter); } } - diff --git a/test/battle/move_effect/take_heart.c b/test/battle/move_effect/take_heart.c new file mode 100644 index 000000000000..c2dfc90a8bf4 --- /dev/null +++ b/test/battle/move_effect/take_heart.c @@ -0,0 +1,47 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_TAKE_HEART].effect == EFFECT_TAKE_HEART); +} + +SINGLE_BATTLE_TEST("Take Heart increases Sp. Atk and Sp. Def by one stage") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_TAKE_HEART); } + } SCENE { + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); + } +} + +SINGLE_BATTLE_TEST("Take Heart cures the user of all status conditions") +{ + u32 status1; + PARAMETRIZE { status1 = STATUS1_SLEEP; } + PARAMETRIZE { status1 = STATUS1_POISON; } + PARAMETRIZE { status1 = STATUS1_FREEZE; } + PARAMETRIZE { status1 = STATUS1_BURN; } + PARAMETRIZE { status1 = STATUS1_PARALYSIS; } + PARAMETRIZE { status1 = STATUS1_TOXIC_POISON; } + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Status1(status1); }; + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_TAKE_HEART); } + } SCENE { + if (status1 == STATUS1_SLEEP) { + MESSAGE("Wobbuffet is fast asleep."); + } else if (status1 == STATUS1_FREEZE) { + PASSES_RANDOMLY(20, 100, RNG_FROZEN); + STATUS_ICON(player, none: TRUE); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); + } else { + MESSAGE("Wobbuffet's status returned to normal!"); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); + } + } +} diff --git a/test/battle/move_effect/teatime.c b/test/battle/move_effect/teatime.c new file mode 100644 index 000000000000..7995937fa5f3 --- /dev/null +++ b/test/battle/move_effect/teatime.c @@ -0,0 +1,270 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_TEATIME].effect == EFFECT_TEATIME); + ASSUME(gItems[ITEM_LIECHI_BERRY].holdEffect == HOLD_EFFECT_ATTACK_UP); +} + +SINGLE_BATTLE_TEST("Teatime causes the user to consume its Berry, ignoring HP requirements") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_LIECHI_BERRY); } + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_NONE); } + } WHEN { + TURN { MOVE(player, MOVE_TEATIME); } + } SCENE { + MESSAGE("Wobbuffet used Teatime!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_TEATIME, player); + MESSAGE("Using Liechi Berry, the Attack of Wobbuffet rose!"); + } +} + +SINGLE_BATTLE_TEST("Teatime causes the user to consume its Berry, even in the pressence of Unnerve") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_LIECHI_BERRY); } + OPPONENT(SPECIES_EKANS) { Ability(ABILITY_UNNERVE); } + } WHEN { + TURN { MOVE(player, MOVE_TEATIME); } + } SCENE { + MESSAGE("Wobbuffet used Teatime!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_TEATIME, player); + MESSAGE("Using Liechi Berry, the Attack of Wobbuffet rose!"); + } +} + +SINGLE_BATTLE_TEST("Teatime causes the user to consume its Berry, even under the effects of Wonder Room") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_LIECHI_BERRY); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { + MOVE(opponent, MOVE_WONDER_ROOM); + MOVE(player, MOVE_TEATIME); + } + } SCENE { + MESSAGE("Wobbuffet used Teatime!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_TEATIME, player); + MESSAGE("Using Liechi Berry, the Attack of Wobbuffet rose!"); + } +} + +SINGLE_BATTLE_TEST("Teatime causes the user to consume its Berry, ignoring HP requirements, when not used by the Player") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_NONE); } + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_LIECHI_BERRY); } + } WHEN { + TURN { MOVE(opponent, MOVE_TEATIME); } + } SCENE { + MESSAGE("Foe Wobbuffet used Teatime!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_TEATIME, opponent); + MESSAGE("Using Liechi Berry, the Attack of Foe Wobbuffet rose!"); + } +} + +SINGLE_BATTLE_TEST("Teatime causes other Pokemon to consume their Berry even if the user doesn't have a Berry as its held item") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_NONE); } + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_LIECHI_BERRY); } + } WHEN { + TURN { MOVE(player, MOVE_TEATIME); } + } SCENE { + MESSAGE("Wobbuffet used Teatime!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_TEATIME, player); + MESSAGE("Using Liechi Berry, the Attack of Foe Wobbuffet rose!"); + } +} + +SINGLE_BATTLE_TEST("Teatime causes other Pokemon to consume their Berry even if the user doesn't have a Berry as its held item, when not used by the Player") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_LIECHI_BERRY); } + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_NONE); } + } WHEN { + TURN { MOVE(opponent, MOVE_TEATIME); } + } SCENE { + MESSAGE("Foe Wobbuffet used Teatime!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_TEATIME, opponent); + MESSAGE("Using Liechi Berry, the Attack of Wobbuffet rose!"); + } +} + +DOUBLE_BATTLE_TEST("Teatime causes all Pokémon to consume their berry") +{ + struct BattlePokemon *user; + PARAMETRIZE { user = playerLeft; } + PARAMETRIZE { user = playerRight; } + PARAMETRIZE { user = opponentLeft; } + PARAMETRIZE { user = opponentRight; } + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_LIECHI_BERRY); } + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_LIECHI_BERRY); } + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_LIECHI_BERRY); } + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_LIECHI_BERRY); } + } WHEN { + TURN { MOVE(user, MOVE_TEATIME); } + } SCENE { + if (user == playerLeft || user == playerRight) + { + MESSAGE("Wobbuffet used Teatime!"); + } else { + MESSAGE("Foe Wobbuffet used Teatime!"); + } + ANIMATION(ANIM_TYPE_MOVE, MOVE_TEATIME, user); + MESSAGE("Using Liechi Berry, the Attack of Wobbuffet rose!"); + MESSAGE("Using Liechi Berry, the Attack of Foe Wobbuffet rose!"); + MESSAGE("Using Liechi Berry, the Attack of Wobbuffet rose!"); + MESSAGE("Using Liechi Berry, the Attack of Foe Wobbuffet rose!"); + } +} + +SINGLE_BATTLE_TEST("Teatime fails if no Pokémon is holding a Berry") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_NONE); } + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_NONE); } + } WHEN { + TURN { MOVE(player, MOVE_TEATIME); } + } SCENE { + MESSAGE("Wobbuffet used Teatime!"); + NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_TEATIME, player); + MESSAGE("But it failed!"); + } +} + +SINGLE_BATTLE_TEST("Teatime does not affect Pokémon in the semi-invulnerable turn of a move") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_NONE); } + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_LIECHI_BERRY); } + } WHEN { + TURN { + MOVE(opponent, MOVE_FLY); + MOVE(player, MOVE_TEATIME); + } + } SCENE { + MESSAGE("Wobbuffet used Teatime!"); + NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_TEATIME, player); + NOT MESSAGE("Using Liechi Berry, the Attack of Foe Wobbuffet rose!"); + } +} + +SINGLE_BATTLE_TEST("Teatime triggers Volt Absorb if it has been affected by Electrify or Plasma Fists, even when not holding a Berry") +{ + u32 move; + u32 item = ITEM_LIECHI_BERRY; + bool8 shouldTriggerAbility = TRUE; + + PARAMETRIZE { move = MOVE_CELEBRATE; shouldTriggerAbility = FALSE; } + PARAMETRIZE { move = MOVE_ELECTRIFY; } + PARAMETRIZE { move = MOVE_PLASMA_FISTS; } + PARAMETRIZE { move = MOVE_ELECTRIFY; item = ITEM_NONE; } + PARAMETRIZE { move = MOVE_PLASMA_FISTS; item = ITEM_NONE; } + + GIVEN { + PLAYER(SPECIES_JOLTEON) { Ability(ABILITY_VOLT_ABSORB); Item(item); HP(55); MaxHP(100); } + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_LIECHI_BERRY); } + } WHEN { + TURN { + MOVE(player, move); + MOVE(opponent, MOVE_TEATIME); + } + } SCENE { + MESSAGE("Foe Wobbuffet used Teatime!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_TEATIME, opponent); + if (shouldTriggerAbility) + { + ABILITY_POPUP(player, ABILITY_VOLT_ABSORB); + HP_BAR(player, damage: -25); + NOT MESSAGE("Using Liechi Berry, the Attack of Jolteon rose!"); + } else { + NOT ABILITY_POPUP(player, ABILITY_VOLT_ABSORB); + MESSAGE("Using Liechi Berry, the Attack of Jolteon rose!"); + } + MESSAGE("Using Liechi Berry, the Attack of Foe Wobbuffet rose!"); + } +} + +SINGLE_BATTLE_TEST("Teatime triggers Lightning Rod if it has been affected by Electrify or Plasma Fists, even when not holding a Berry") +{ + u32 move; + u32 item = ITEM_LIECHI_BERRY; + bool8 shouldTriggerAbility = TRUE; + + PARAMETRIZE { move = MOVE_CELEBRATE; shouldTriggerAbility = FALSE; } + PARAMETRIZE { move = MOVE_ELECTRIFY; } + PARAMETRIZE { move = MOVE_PLASMA_FISTS; } + PARAMETRIZE { move = MOVE_ELECTRIFY; item = ITEM_NONE; } + PARAMETRIZE { move = MOVE_PLASMA_FISTS; item = ITEM_NONE; } + + GIVEN { + PLAYER(SPECIES_PIKACHU) { Ability(ABILITY_LIGHTNING_ROD); Item(item); } + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_LIECHI_BERRY); } + } WHEN { + TURN { + MOVE(player, move); + MOVE(opponent, MOVE_TEATIME); + } + } SCENE { + MESSAGE("Foe Wobbuffet used Teatime!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_TEATIME, opponent); + if (shouldTriggerAbility) + { + ABILITY_POPUP(player, ABILITY_LIGHTNING_ROD); + MESSAGE("Pikachu's Sp. Atk rose!"); + NOT MESSAGE("Using Liechi Berry, the Attack of Pikachu rose!"); + } else { + NONE_OF { + ABILITY_POPUP(player, ABILITY_LIGHTNING_ROD); + MESSAGE("Pikachu's Sp. Atk rose!"); + } + MESSAGE("Using Liechi Berry, the Attack of Pikachu rose!"); + } + MESSAGE("Using Liechi Berry, the Attack of Foe Wobbuffet rose!"); + } +} + +SINGLE_BATTLE_TEST("Teatime triggers Motor Drive if it has been affected by Electrify or Plasma Fists, even when not holding a Berry") +{ + u32 move; + u32 item= ITEM_LIECHI_BERRY; + bool8 shouldTriggerAbility = TRUE; + + PARAMETRIZE { move = MOVE_CELEBRATE; shouldTriggerAbility = FALSE; } + PARAMETRIZE { move = MOVE_ELECTRIFY; } + PARAMETRIZE { move = MOVE_PLASMA_FISTS; } + PARAMETRIZE { move = MOVE_ELECTRIFY; item = ITEM_NONE; } + PARAMETRIZE { move = MOVE_PLASMA_FISTS; item = ITEM_NONE; } + + GIVEN { + ASSUME(P_GEN_4_POKEMON == TRUE); + PLAYER(SPECIES_ELECTIVIRE) { Ability(ABILITY_MOTOR_DRIVE); Item(item); } + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_LIECHI_BERRY); } + } WHEN { + TURN { + MOVE(player, move); + MOVE(opponent, MOVE_TEATIME); + } + } SCENE { + MESSAGE("Foe Wobbuffet used Teatime!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_TEATIME, opponent); + if (shouldTriggerAbility) + { + ABILITY_POPUP(player, ABILITY_MOTOR_DRIVE); + MESSAGE("Electivire's Speed rose!"); + NOT MESSAGE("Using Liechi Berry, the Attack of Electivire rose!"); + } else { + NONE_OF { + ABILITY_POPUP(player, ABILITY_MOTOR_DRIVE); + MESSAGE("Electivire's Speed rose!"); + } + MESSAGE("Using Liechi Berry, the Attack of Electivire rose!"); + } + MESSAGE("Using Liechi Berry, the Attack of Foe Wobbuffet rose!"); + } +} diff --git a/test/battle/move_effect/triple_arrows.c b/test/battle/move_effect/triple_arrows.c new file mode 100644 index 000000000000..eb8e1c666f4c --- /dev/null +++ b/test/battle/move_effect/triple_arrows.c @@ -0,0 +1,91 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_TRIPLE_ARROWS].effect == EFFECT_TRIPLE_ARROWS); +} + +SINGLE_BATTLE_TEST("Triple Arrows may lower Defense by one stage") +{ + u32 ability; + u32 chance; + PARAMETRIZE { ability = ABILITY_HUSTLE; chance = 50; } + PARAMETRIZE { ability = ABILITY_SERENE_GRACE; chance = 100; } + PASSES_RANDOMLY(chance, 100, RNG_TRIPLE_ARROWS_DEFENSE_DOWN); + GIVEN { + PLAYER(SPECIES_TOGEPI) { Ability(ability); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_TRIPLE_ARROWS); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TRIPLE_ARROWS, player); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent); + MESSAGE("Foe Wobbuffet's Defense fell!"); + } +} + +SINGLE_BATTLE_TEST("Triple Arrows makes the foe flinch 30% of the time") +{ + u32 ability; + u32 chance; + PARAMETRIZE { ability = ABILITY_HUSTLE; chance = 30; } + PARAMETRIZE { ability = ABILITY_SERENE_GRACE; chance = 60; } + PASSES_RANDOMLY(chance, 100, RNG_TRIPLE_ARROWS_FLINCH); + GIVEN { + PLAYER(SPECIES_TOGEPI) { Ability(ability); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_TRIPLE_ARROWS); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TRIPLE_ARROWS, player); + MESSAGE("Foe Wobbuffet flinched!"); + } +} + +SINGLE_BATTLE_TEST("Triple Arrows lands a critical hit") +{ + ASSUME(B_CRIT_CHANCE >= GEN_7); + ASSUME(gBattleMoves[MOVE_TRIPLE_ARROWS].highCritRatio == TRUE); + PASSES_RANDOMLY(1, 8, RNG_CRITICAL_HIT); + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_TRIPLE_ARROWS); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TRIPLE_ARROWS, player); + MESSAGE("A critical hit!"); + } +} + +SINGLE_BATTLE_TEST("Triple Arrows can lower Defense and cause flinch at the time") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_TRIPLE_ARROWS); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TRIPLE_ARROWS, player); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent); + MESSAGE("Foe Wobbuffet's Defense fell!"); + MESSAGE("Foe Wobbuffet flinched!"); + } +} + +SINGLE_BATTLE_TEST("Triple Arrows's flinching is prevented by Inner Focus") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_RIOLU) { Ability(ABILITY_INNER_FOCUS); } + } WHEN { + TURN { MOVE(player, MOVE_TRIPLE_ARROWS); + MOVE(opponent, MOVE_TACKLE); + } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TRIPLE_ARROWS, player); + NONE_OF { MESSAGE("Foe Wobbuffet flinched!"); } + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent); + } +} diff --git a/test/battle/move_effect/triple_kick.c b/test/battle/move_effect/triple_kick.c index 5ff47c840faf..fef571cb4cef 100644 --- a/test/battle/move_effect/triple_kick.c +++ b/test/battle/move_effect/triple_kick.c @@ -3,7 +3,7 @@ ASSUMPTIONS { - ASSUME(gBattleMoves[MOVE_TRIPLE_KICK].effect & EFFECT_TRIPLE_KICK); + ASSUME(gBattleMoves[MOVE_TRIPLE_KICK].effect == EFFECT_TRIPLE_KICK); } SINGLE_BATTLE_TEST("Triple Kick damage is increased by its base damage for each hit") @@ -29,3 +29,7 @@ SINGLE_BATTLE_TEST("Triple Kick damage is increased by its base damage for each EXPECT_MUL_EQ(firstHit, Q_4_12(3.0), thirdHit); } } + +TO_DO_BATTLE_TEST("Accuracy for Triple Kick is checked independently for each hit") +TO_DO_BATTLE_TEST("Accuracy for Triple Kick is only checked for the first hit with Skill Link") +TO_DO_BATTLE_TEST("Accuracy for Triple Kick is only checked for the first hit with Loaded Dice") diff --git a/test/battle/move_flags/damages_airborne_double_damage.c b/test/battle/move_flags/damages_airborne_double_damage.c new file mode 100644 index 000000000000..5906e3b6b4e3 --- /dev/null +++ b/test/battle/move_flags/damages_airborne_double_damage.c @@ -0,0 +1,23 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Being airborne causes the target to take double damage from certain moves", s16 damage) +{ + bool32 useDive; + PARAMETRIZE { useDive = FALSE; } + PARAMETRIZE { useDive = TRUE; } + GIVEN { + ASSUME(gBattleMoves[MOVE_TWISTER].damagesAirborneDoubleDamage); + PLAYER(SPECIES_WOBBUFFET) { Speed(1); } + OPPONENT(SPECIES_WOBBUFFET) { Speed(2); } + } WHEN { + if (useDive) + TURN { MOVE(opponent, MOVE_FLY); MOVE(player, MOVE_TWISTER); } + else + TURN { MOVE(player, MOVE_TWISTER); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, UQ_4_12(2.0), results[1].damage); + } +} diff --git a/test/battle/move_flags/damages_underground.c b/test/battle/move_flags/damages_underground.c new file mode 100644 index 000000000000..54af8b8298f2 --- /dev/null +++ b/test/battle/move_flags/damages_underground.c @@ -0,0 +1,23 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Being underground causes the target to take double damage from certain moves", s16 damage) +{ + bool32 useDig; + PARAMETRIZE { useDig = FALSE; } + PARAMETRIZE { useDig = TRUE; } + GIVEN { + ASSUME(gBattleMoves[MOVE_EARTHQUAKE].damagesUnderground); + PLAYER(SPECIES_WOBBUFFET) { Speed(1); } + OPPONENT(SPECIES_WOBBUFFET) { Speed(2); } + } WHEN { + if (useDig) + TURN { MOVE(opponent, MOVE_DIG); MOVE(player, MOVE_EARTHQUAKE); } + else + TURN { MOVE(player, MOVE_EARTHQUAKE); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, UQ_4_12(2.0), results[1].damage); + } +} diff --git a/test/battle/move_flags/damages_underwater.c b/test/battle/move_flags/damages_underwater.c new file mode 100644 index 000000000000..e8f45e8deee9 --- /dev/null +++ b/test/battle/move_flags/damages_underwater.c @@ -0,0 +1,23 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Being underwater causes the target to take double damage from certain moves", s16 damage) +{ + bool32 useDive; + PARAMETRIZE { useDive = FALSE; } + PARAMETRIZE { useDive = TRUE; } + GIVEN { + ASSUME(gBattleMoves[MOVE_SURF].damagesUnderwater); + PLAYER(SPECIES_WOBBUFFET) { Speed(1); } + OPPONENT(SPECIES_WOBBUFFET) { Speed(2); } + } WHEN { + if (useDive) + TURN { MOVE(opponent, MOVE_DIVE); MOVE(player, MOVE_SURF); } + else + TURN { MOVE(player, MOVE_SURF); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, UQ_4_12(2.0), results[1].damage); + } +} diff --git a/test/battle/move_flags/minimize_double_damage.c b/test/battle/move_flags/minimize_double_damage.c new file mode 100644 index 000000000000..6b631c9a36ae --- /dev/null +++ b/test/battle/move_flags/minimize_double_damage.c @@ -0,0 +1,27 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("MinimizeDoubleDamage flag makes moves cause double damage to Minimized targets", s16 damage) +{ + bool32 useMinimize; + PARAMETRIZE { useMinimize = FALSE; } + PARAMETRIZE { useMinimize = TRUE; } + GIVEN { + ASSUME(gBattleMoves[MOVE_MINIMIZE].effect == EFFECT_MINIMIZE); + ASSUME(gBattleMoves[MOVE_STEAMROLLER].minimizeDoubleDamage); + PLAYER(SPECIES_WOBBUFFET) { Speed(1); } + OPPONENT(SPECIES_WOBBUFFET) { Speed(2); } + } WHEN { + if (useMinimize) + TURN { MOVE(opponent, MOVE_MINIMIZE); MOVE(player, MOVE_STEAMROLLER); } + else + TURN { MOVE(player, MOVE_STEAMROLLER); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, UQ_4_12(2.0), results[1].damage); + } +} + +// Remember to add ASSUME(B_MINIMIZE_DMG_ACC >= GEN_6) +TO_DO_BATTLE_TEST("MinimizeDoubleDamage flag allows moves to skip accuracy checks towards Minimized targets") diff --git a/test/battle/move_flags/three_strikes.c b/test/battle/move_flags/strike_count.c similarity index 71% rename from test/battle/move_flags/three_strikes.c rename to test/battle/move_flags/strike_count.c index 794df10d30be..d134e58c8075 100644 --- a/test/battle/move_flags/three_strikes.c +++ b/test/battle/move_flags/strike_count.c @@ -1,14 +1,29 @@ #include "global.h" #include "test/battle.h" -SINGLE_BATTLE_TEST("Three-strike flag turns a move into a 3-hit move") +SINGLE_BATTLE_TEST("Two strike count turns a move into a 2-hit move") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_DOUBLE_KICK].strikeCount == 2); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_DOUBLE_KICK); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_DOUBLE_KICK, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_DOUBLE_KICK, player); + MESSAGE("Hit 2 time(s)!"); + } +} + +SINGLE_BATTLE_TEST("Three strike count turns a move into a 3-hit move") { s16 firstHit; s16 secondHit; s16 thirdHit; GIVEN { - ASSUME(gBattleMoves[MOVE_TRIPLE_DIVE].flags & FLAG_THREE_STRIKES); + ASSUME(gBattleMoves[MOVE_TRIPLE_DIVE].strikeCount == 3); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET); } WHEN { @@ -34,7 +49,7 @@ SINGLE_BATTLE_TEST("Surging Strikes hits 3 times with each hit being a critical s16 thirdHit; GIVEN { - ASSUME(gBattleMoves[MOVE_SURGING_STRIKES].flags & FLAG_THREE_STRIKES); + ASSUME(gBattleMoves[MOVE_SURGING_STRIKES].strikeCount == 3); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET); } WHEN { diff --git a/test/battle/status1/freeze.c b/test/battle/status1/freeze.c index e3c53f790a88..28a31efef617 100644 --- a/test/battle/status1/freeze.c +++ b/test/battle/status1/freeze.c @@ -32,7 +32,7 @@ SINGLE_BATTLE_TEST("Freeze is thawed by opponent's Fire-type attacks") SINGLE_BATTLE_TEST("Freeze is thawed by user's Flame Wheel") { GIVEN { - ASSUME(gBattleMoves[MOVE_FLAME_WHEEL].flags & FLAG_THAW_USER); + ASSUME(gBattleMoves[MOVE_FLAME_WHEEL].thawsUser); PLAYER(SPECIES_WOBBUFFET) { Status1(STATUS1_FREEZE); } OPPONENT(SPECIES_WOBBUFFET); } WHEN { diff --git a/test/battle/trainer_control.c b/test/battle/trainer_control.c index f5ca68e364a4..cdb06adc2531 100644 --- a/test/battle/trainer_control.c +++ b/test/battle/trainer_control.c @@ -11,7 +11,7 @@ #include "constants/battle.h" -static const struct TrainerMonCustomized sTestParty1[] = +static const struct TrainerMon sTestParty1[] = { { .species = SPECIES_WOBBUFFET, @@ -35,28 +35,10 @@ static const struct TrainerMonCustomized sTestParty1[] = }, }; -static const struct TrainerMonNoItemDefaultMoves sTestParty2[] = -{ - { - .species = SPECIES_WOBBUFFET, - .lvl = 5, - }, - { - .species = SPECIES_WOBBUFFET, - .lvl = 6, - } -}; - static const struct Trainer sTestTrainer1 = { .trainerName = _("Test1"), - .party = EVERYTHING_CUSTOMIZED(sTestParty1), -}; - -static const struct Trainer sTestTrainer2 = -{ - .trainerName = _("Test2"), - .party = NO_ITEM_DEFAULT_MOVES(sTestParty2), + .party = TRAINER_PARTY(sTestParty1), }; TEST("CreateNPCTrainerPartyForTrainer generates customized Pokémon") @@ -134,7 +116,7 @@ TEST("CreateNPCTrainerPartyForTrainer generates customized Pokémon") TEST("CreateNPCTrainerPartyForTrainer generates different personalities for different mons") { struct Pokemon *testParty = Alloc(6 * sizeof(struct Pokemon)); - CreateNPCTrainerPartyFromTrainer(testParty, &sTestTrainer2, TRUE, BATTLE_TYPE_TRAINER); + CreateNPCTrainerPartyFromTrainer(testParty, &sTestTrainer1, TRUE, BATTLE_TYPE_TRAINER); EXPECT(testParty[0].box.personality != testParty[1].box.personality); Free(testParty); } diff --git a/test/battle/type/grass.c b/test/battle/type/grass.c index b36813ac7415..6bb016c58086 100644 --- a/test/battle/type/grass.c +++ b/test/battle/type/grass.c @@ -4,7 +4,7 @@ SINGLE_BATTLE_TEST("Grass-type Pokémon block powder and spore moves") { GIVEN { - ASSUME(gBattleMoves[MOVE_STUN_SPORE].flags & FLAG_POWDER); + ASSUME(gBattleMoves[MOVE_STUN_SPORE].powderMove); ASSUME(gSpeciesInfo[SPECIES_ODDISH].types[0] == TYPE_GRASS); PLAYER(SPECIES_WYNAUT); OPPONENT(SPECIES_ODDISH); diff --git a/test/battle/weather/snow.c b/test/battle/weather/snow.c index 1e8cb62cb37e..21b7a5565e5c 100644 --- a/test/battle/weather/snow.c +++ b/test/battle/weather/snow.c @@ -81,7 +81,6 @@ SINGLE_BATTLE_TEST("Snow halves the power of Solar Beam", s16 damage) SINGLE_BATTLE_TEST("Snow halves the power of Solar Blade", s16 damage) { u16 move; - KNOWN_FAILING; // fails bc the bp of solar blade gets rounded up which leads to slightly incorrect calcs down the line PARAMETRIZE{ move = MOVE_CELEBRATE; } PARAMETRIZE{ move = MOVE_SNOWSCAPE; } GIVEN { diff --git a/test/fpmath.c b/test/fpmath.c new file mode 100644 index 000000000000..063d938e09ee --- /dev/null +++ b/test/fpmath.c @@ -0,0 +1,18 @@ +#include "global.h" +#include "test/test.h" + +TEST("uq4_12_add adds 4.12 numbers") { + EXPECT_EQ(uq4_12_add(UQ_4_12(3.5), UQ_4_12(2.5)), UQ_4_12(6.0)); +} + +TEST("uq4_12_subtract subtracts 4.12 numbers") { + EXPECT_EQ(uq4_12_subtract(UQ_4_12(3.5), UQ_4_12(2.0)), UQ_4_12(1.5)); +} + +TEST("uq4_12_multiply multiplies 4.12 numbers") { + EXPECT_EQ(uq4_12_multiply(UQ_4_12(3.5), UQ_4_12(2.0)), UQ_4_12(7.0)); +} + +TEST("uq4_12_divide divides 4.12 numbers") { + EXPECT_EQ(uq4_12_divide(UQ_4_12(5.0), UQ_4_12(2.0)), UQ_4_12(2.5)); +} diff --git a/test/random.c b/test/random.c index 202933beb6ba..5ca4b814df80 100644 --- a/test/random.c +++ b/test/random.c @@ -2,6 +2,47 @@ #include "test/test.h" #include "random.h" +// We expect each element to have an indexSum of 3.5 * 1024. +// Therefore the maximum error is 8*3584, or 28672. +#define SHUFFLE_TEST_IMPL \ + u32 i, j, error; \ + u16 indexSum[7]; \ + memset(indexSum, 0, sizeof(indexSum)); \ + for (i = 0; i < 1024; i++) \ + { \ + Shuffle(array, ARRAY_COUNT(array), sizeof(array[0])); \ + for (j = 0; j < ARRAY_COUNT(array); j++) \ + indexSum[array[j]] += j; \ + } \ + error = 0; \ + for (i = 0; i < ARRAY_COUNT(indexSum); i++) \ + error += abs(3584 - indexSum[i]); \ + EXPECT_LT(error, (int)(28672 * 0.025)); + +TEST("Shuffle randomizes the array [Shuffle8]") +{ + u8 array[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; + SHUFFLE_TEST_IMPL; +} + +TEST("Shuffle randomizes the array [Shuffle16]") +{ + u16 array[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; + SHUFFLE_TEST_IMPL; +} + +TEST("Shuffle randomizes the array [Shuffle32]") +{ + u32 array[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; + SHUFFLE_TEST_IMPL; +} + +TEST("Shuffle randomizes the array [Shuffle64]") +{ + u64 array[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; + SHUFFLE_TEST_IMPL; +} + TEST("RandomUniform generates lo..hi") { u32 lo, hi, i; @@ -152,3 +193,60 @@ TEST("RandomElement generates a uniform distribution") EXPECT_LT(error, UQ_4_12(0.025)); } + +TEST("RandomUniform mul-based faster than mod-based (compile-time)") +{ + u32 i; + struct Benchmark mulBenchmark, modBenchmark; + u32 mulSum = 0, modSum = 0; + + BENCHMARK(&mulBenchmark) + { + mulSum += RandomUniformDefault(RNG_NONE, 0, 1); + mulSum += RandomUniformDefault(RNG_NONE, 0, 2); + mulSum += RandomUniformDefault(RNG_NONE, 0, 3); + mulSum += RandomUniformDefault(RNG_NONE, 0, 4); + } + + BENCHMARK(&modBenchmark) + { + modSum += Random() % 2; + modSum += Random() % 3; + modSum += Random() % 4; + modSum += Random() % 5; + } + + EXPECT_FASTER(mulBenchmark, modBenchmark); + + // Reference mulSum/modSum to prevent optimization. + // These numbers are different because multiplication and modulus + // have subtly different biases (so subtle that it's irrelevant for + // our purposes). + EXPECT_EQ(mulSum, 3); + EXPECT_EQ(modSum, 4); +} + +TEST("RandomUniform mul-based faster than mod-based (run-time)") +{ + u32 i; + struct Benchmark mulBenchmark, modBenchmark; + u32 mulSum = 0, modSum = 0; + + BENCHMARK(&mulBenchmark) + { + for (i = 0; i < 32; i++) + mulSum += RandomUniformDefault(RNG_NONE, 0, i); + } + + BENCHMARK(&modBenchmark) + { + for (i = 0; i < 32; i++) + modSum += Random() % (i + 1); + } + + EXPECT_FASTER(mulBenchmark, modBenchmark); + + // Reference mulSum/modSum to prevent optimization. + EXPECT_EQ(mulSum, 232); + EXPECT_EQ(modSum, 249); +} diff --git a/test/sprite.c b/test/sprite.c new file mode 100644 index 000000000000..51d4873beffc --- /dev/null +++ b/test/sprite.c @@ -0,0 +1,303 @@ +#include "global.h" +#include "main.h" +#include "malloc.h" +#include "random.h" +#include "sprite.h" +#include "test/test.h" + +#define OAM_MATRIX_COUNT 32 + +EWRAM_DATA static u16 sSpritePriorities[MAX_SPRITES] = {0}; +EWRAM_DATA static u8 sSpriteOrder[MAX_SPRITES] = {0}; + +static void Old_BuildOamBuffer(void); + +static void ExpectEqOamBuffers(const struct OamData *oldOamBuffer, const struct OamData *newOamBuffer) +{ + u32 i; + u32 matrices = 0; + + // Compare the non-matrix data. + for (i = 0; i < gOamLimit; i++) + { + EXPECT(memcmp(&oldOamBuffer[i], &newOamBuffer[i], 6) == 0); + if (newOamBuffer[i].affineMode & ST_OAM_AFFINE_ON_MASK) + matrices |= 1 << newOamBuffer[i].matrixNum; + } + + // Compare the matrix data. + for (i = 0; i < OAM_MATRIX_COUNT; i++) + { + if (matrices & (1 << i)) + { + u32 base = 4 * i; + EXPECT_EQ(oldOamBuffer[base + 0].affineParam, newOamBuffer[base + 0].affineParam); + EXPECT_EQ(oldOamBuffer[base + 1].affineParam, newOamBuffer[base + 1].affineParam); + EXPECT_EQ(oldOamBuffer[base + 2].affineParam, newOamBuffer[base + 2].affineParam); + EXPECT_EQ(oldOamBuffer[base + 3].affineParam, newOamBuffer[base + 3].affineParam); + } + } +} + +static void ResetSpriteData_(void) +{ + u32 i; + ResetSpriteData(); + for (i = 0; i < MAX_SPRITES; i++) + sSpriteOrder[i] = i; +} + +static void BenchmarkBuildOamBuffer(bool32 preSort) +{ + struct Benchmark oldBuildOamBuffer, newBuildOamBuffer; + struct OamData *oldOamBuffer = Alloc(sizeof(gMain.oamBuffer)); + + if (preSort) + Old_BuildOamBuffer(); + BENCHMARK(&oldBuildOamBuffer) + { + Old_BuildOamBuffer(); + } + memcpy(oldOamBuffer, gMain.oamBuffer, sizeof(gMain.oamBuffer)); + + if (preSort) + BuildOamBuffer(); + BENCHMARK(&newBuildOamBuffer) + { + BuildOamBuffer(); + } + + ExpectEqOamBuffers(oldOamBuffer, gMain.oamBuffer); + EXPECT_FASTER(newBuildOamBuffer, oldBuildOamBuffer); + Free(oldOamBuffer); +} + +TEST("BuildOamBuffer faster with no sprites") +{ + ResetSpriteData_(); + BenchmarkBuildOamBuffer(FALSE); +} + +TEST("BuildOamBuffer faster with max sprites (equal y/subpriority)") +{ + u32 i; + + ResetSpriteData_(); + for (i = 0; i < MAX_SPRITES; i++) + CreateSprite(&gDummySpriteTemplate, 0, 0, 0); + BenchmarkBuildOamBuffer(FALSE); +} + +TEST("BuildOamBuffer faster with max sprites (random y/subpriority)") +{ + u32 i; + ResetSpriteData_(); + SeedRng(0); + for (i = 0; i < MAX_SPRITES; i++) + CreateSprite(&gDummySpriteTemplate, 0, Random() % 256, Random() % 256); + BenchmarkBuildOamBuffer(FALSE); +} + +TEST("BuildOamBuffer faster on already-sorted max sprites") +{ + u32 i; + ResetSpriteData_(); + SeedRng(0); + for (i = 0; i < MAX_SPRITES; i++) + CreateSprite(&gDummySpriteTemplate, 0, Random() % 256, Random() % 256); + BenchmarkBuildOamBuffer(TRUE); +} + +TEST("BuildOamBuffer faster with mix of sprites") +{ + u32 i; + ResetSpriteData_(); + SeedRng(0); + for (i = 0; i < MAX_SPRITES / 2; i++) + { + u32 spriteId = CreateSprite(&gDummySpriteTemplate, 0, Random() % 256, Random() % 256); + gSprites[spriteId].invisible = Random() % 4 == 0; + } + BenchmarkBuildOamBuffer(FALSE); +} + +// Old implementation. + +#define UBFIX + +static void UpdateOamCoords(void) +{ + u8 i; + for (i = 0; i < MAX_SPRITES; i++) + { + struct Sprite *sprite = &gSprites[i]; + if (sprite->inUse && !sprite->invisible) + { + if (sprite->coordOffsetEnabled) + { + sprite->oam.x = sprite->x + sprite->x2 + sprite->centerToCornerVecX + gSpriteCoordOffsetX; + sprite->oam.y = sprite->y + sprite->y2 + sprite->centerToCornerVecY + gSpriteCoordOffsetY; + } + else + { + sprite->oam.x = sprite->x + sprite->x2 + sprite->centerToCornerVecX; + sprite->oam.y = sprite->y + sprite->y2 + sprite->centerToCornerVecY; + } + } + } +} + +static void BuildSpritePriorities(void) +{ + u16 i; + for (i = 0; i < MAX_SPRITES; i++) + { + struct Sprite *sprite = &gSprites[i]; + u16 priority = sprite->subpriority | (sprite->oam.priority << 8); + sSpritePriorities[i] = priority; + } +} + +static void SortSprites(void) +{ + u8 i; + for (i = 1; i < MAX_SPRITES; i++) + { + u8 j = i; + struct Sprite *sprite1 = &gSprites[sSpriteOrder[i - 1]]; + struct Sprite *sprite2 = &gSprites[sSpriteOrder[i]]; + u16 sprite1Priority = sSpritePriorities[sSpriteOrder[i - 1]]; + u16 sprite2Priority = sSpritePriorities[sSpriteOrder[i]]; + s16 sprite1Y = sprite1->oam.y; + s16 sprite2Y = sprite2->oam.y; + + if (sprite1Y >= DISPLAY_HEIGHT) + sprite1Y = sprite1Y - 256; + + if (sprite2Y >= DISPLAY_HEIGHT) + sprite2Y = sprite2Y - 256; + + if (sprite1->oam.affineMode == ST_OAM_AFFINE_DOUBLE + && sprite1->oam.size == ST_OAM_SIZE_3) + { + u32 shape = sprite1->oam.shape; + if (shape == ST_OAM_SQUARE || shape == ST_OAM_V_RECTANGLE) + { + if (sprite1Y > 128) + sprite1Y = sprite1Y - 256; + } + } + + if (sprite2->oam.affineMode == ST_OAM_AFFINE_DOUBLE + && sprite2->oam.size == ST_OAM_SIZE_3) + { + u32 shape = sprite2->oam.shape; + if (shape == ST_OAM_SQUARE || shape == ST_OAM_V_RECTANGLE) + { + if (sprite2Y > 128) + sprite2Y = sprite2Y - 256; + } + } + + while (j > 0 + && ((sprite1Priority > sprite2Priority) + || (sprite1Priority == sprite2Priority && sprite1Y < sprite2Y))) + { + u8 temp = sSpriteOrder[j]; + sSpriteOrder[j] = sSpriteOrder[j - 1]; + sSpriteOrder[j - 1] = temp; + + // UB: If j equals 1, then j-- makes j equal 0. + // Then, sSpriteOrder[-1] gets accessed below. + // Although this doesn't result in a bug in the ROM, + // the behavior is undefined. + j--; +#ifdef UBFIX + if (j == 0) + break; +#endif + + sprite1 = &gSprites[sSpriteOrder[j - 1]]; + sprite2 = &gSprites[sSpriteOrder[j]]; + sprite1Priority = sSpritePriorities[sSpriteOrder[j - 1]]; + sprite2Priority = sSpritePriorities[sSpriteOrder[j]]; + sprite1Y = sprite1->oam.y; + sprite2Y = sprite2->oam.y; + + if (sprite1Y >= DISPLAY_HEIGHT) + sprite1Y = sprite1Y - 256; + + if (sprite2Y >= DISPLAY_HEIGHT) + sprite2Y = sprite2Y - 256; + + if (sprite1->oam.affineMode == ST_OAM_AFFINE_DOUBLE + && sprite1->oam.size == ST_OAM_SIZE_3) + { + u32 shape = sprite1->oam.shape; + if (shape == ST_OAM_SQUARE || shape == ST_OAM_V_RECTANGLE) + { + if (sprite1Y > 128) + sprite1Y = sprite1Y - 256; + } + } + + if (sprite2->oam.affineMode == ST_OAM_AFFINE_DOUBLE + && sprite2->oam.size == ST_OAM_SIZE_3) + { + u32 shape = sprite2->oam.shape; + if (shape == ST_OAM_SQUARE || shape == ST_OAM_V_RECTANGLE) + { + if (sprite2Y > 128) + sprite2Y = sprite2Y - 256; + } + } + } + } +} + +static void CopyMatricesToOamBuffer(void) +{ + u8 i; + for (i = 0; i < OAM_MATRIX_COUNT; i++) + { + u32 base = 4 * i; + gMain.oamBuffer[base + 0].affineParam = gOamMatrices[i].a; + gMain.oamBuffer[base + 1].affineParam = gOamMatrices[i].b; + gMain.oamBuffer[base + 2].affineParam = gOamMatrices[i].c; + gMain.oamBuffer[base + 3].affineParam = gOamMatrices[i].d; + } +} + +static void AddSpritesToOamBuffer(void) +{ + u8 i = 0; + u8 oamIndex = 0; + + while (i < MAX_SPRITES) + { + struct Sprite *sprite = &gSprites[sSpriteOrder[i]]; + if (sprite->inUse && !sprite->invisible && AddSpriteToOamBuffer(sprite, &oamIndex)) + return; + i++; + } + + while (oamIndex < gOamLimit) + { + gMain.oamBuffer[oamIndex] = gDummyOamData; + oamIndex++; + } +} + +static void Old_BuildOamBuffer(void) +{ + u8 temp; + UpdateOamCoords(); + BuildSpritePriorities(); + SortSprites(); + temp = gMain.oamLoadDisabled; + gMain.oamLoadDisabled = TRUE; + AddSpritesToOamBuffer(); + CopyMatricesToOamBuffer(); + gMain.oamLoadDisabled = temp; + //sShouldProcessSpriteCopyRequests = TRUE; +} diff --git a/test/test_runner_battle.c b/test/test_runner_battle.c index 80d1f5594143..a0a8033e154c 100644 --- a/test/test_runner_battle.c +++ b/test/test_runner_battle.c @@ -1488,6 +1488,9 @@ void Move(u32 sourceLine, struct BattlePokemon *battler, struct MoveContext ctx) if (ctx.explicitMegaEvolve && ctx.megaEvolve) moveSlot |= RET_MEGA_EVOLUTION; + if (ctx.explicitUltraBurst && ctx.ultraBurst) + moveSlot |= RET_ULTRA_BURST; + if (ctx.explicitTarget) { target = ctx.target - gBattleMons; diff --git a/tools/gbagfx/Makefile b/tools/gbagfx/Makefile index 8728fa8d094c..8a52d52d3742 100644 --- a/tools/gbagfx/Makefile +++ b/tools/gbagfx/Makefile @@ -1,4 +1,4 @@ -CC = gcc +CC ?= gcc CFLAGS = -Wall -Wextra -Werror -Wno-sign-compare -std=c11 -O2 -DPNG_SKIP_SETJMP_CHECK CFLAGS += $(shell pkg-config --cflags libpng)