mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 19:54:21 +01:00
move battle vars to c file
This commit is contained in:
parent
802b505d7b
commit
5ac6cc4860
@ -16302,7 +16302,7 @@ _081B8BA8:
|
|||||||
movs r0, 0x1
|
movs r0, 0x1
|
||||||
strb r0, [r1]
|
strb r0, [r1]
|
||||||
ldr r1, =gBattlerPartyIndexes
|
ldr r1, =gBattlerPartyIndexes
|
||||||
ldr r0, =gBankInMenu
|
ldr r0, =gBattlerInMenuId
|
||||||
ldrb r0, [r0]
|
ldrb r0, [r0]
|
||||||
lsls r0, 1
|
lsls r0, 1
|
||||||
adds r0, r1
|
adds r0, r1
|
||||||
@ -16334,7 +16334,7 @@ _081B8BFC:
|
|||||||
b _081B8C42
|
b _081B8C42
|
||||||
.pool
|
.pool
|
||||||
_081B8C20:
|
_081B8C20:
|
||||||
ldr r0, =gBankInMenu
|
ldr r0, =gBattlerInMenuId
|
||||||
ldrb r0, [r0]
|
ldrb r0, [r0]
|
||||||
ldr r1, =gBattlerPartyIndexes
|
ldr r1, =gBattlerPartyIndexes
|
||||||
lsls r0, 1
|
lsls r0, 1
|
||||||
|
@ -77,7 +77,7 @@ ExecuteTableBasedItemEffect: @ 806BD28
|
|||||||
cmp r0, 0
|
cmp r0, 0
|
||||||
beq _0806BDA8
|
beq _0806BDA8
|
||||||
ldr r2, =gEnigmaBerries
|
ldr r2, =gEnigmaBerries
|
||||||
ldr r0, =gBankInMenu
|
ldr r0, =gBattlerInMenuId
|
||||||
ldrb r1, [r0]
|
ldrb r1, [r0]
|
||||||
lsls r0, r1, 3
|
lsls r0, r1, 3
|
||||||
subs r0, r1
|
subs r0, r1
|
||||||
@ -101,7 +101,7 @@ _0806BDBC:
|
|||||||
_0806BDC4:
|
_0806BDC4:
|
||||||
str r0, [sp, 0x34]
|
str r0, [sp, 0x34]
|
||||||
ldr r1, =gStringBattler
|
ldr r1, =gStringBattler
|
||||||
ldr r0, =gBankInMenu
|
ldr r0, =gBattlerInMenuId
|
||||||
ldrb r2, [r0]
|
ldrb r2, [r0]
|
||||||
strb r2, [r1]
|
strb r2, [r1]
|
||||||
ldr r0, =gMain
|
ldr r0, =gMain
|
||||||
|
@ -476,8 +476,8 @@ struct ProtectStruct
|
|||||||
|
|
||||||
/* field_4 */ u32 physicalDmg;
|
/* field_4 */ u32 physicalDmg;
|
||||||
/* field_8 */ u32 specialDmg;
|
/* field_8 */ u32 specialDmg;
|
||||||
/* field_C */ u8 physicalBank;
|
/* field_C */ u8 physicalBattlerId;
|
||||||
/* field_D */ u8 specialBank;
|
/* field_D */ u8 specialBattlerId;
|
||||||
/* field_E */ u16 fieldE;
|
/* field_E */ u16 fieldE;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -494,11 +494,11 @@ struct SpecialStatus
|
|||||||
u8 flag40 : 1;
|
u8 flag40 : 1;
|
||||||
u8 focusBanded : 1;
|
u8 focusBanded : 1;
|
||||||
u8 field1[3];
|
u8 field1[3];
|
||||||
s32 moveturnLostHP;
|
s32 dmg;
|
||||||
s32 moveturnLostHP_physical;
|
s32 physicalDmg;
|
||||||
s32 moveturnLostHP_special;
|
s32 specialDmg;
|
||||||
u8 moveturnPhysicalBank;
|
u8 physicalBattlerId;
|
||||||
u8 moveturnSpecialBank;
|
u8 specialBattlerId;
|
||||||
u8 field12;
|
u8 field12;
|
||||||
u8 field13;
|
u8 field13;
|
||||||
};
|
};
|
||||||
@ -508,13 +508,13 @@ extern struct SpecialStatus gSpecialStatuses[MAX_BATTLERS_COUNT];
|
|||||||
struct SideTimer
|
struct SideTimer
|
||||||
{
|
{
|
||||||
/*0x00*/ u8 reflectTimer;
|
/*0x00*/ u8 reflectTimer;
|
||||||
/*0x01*/ u8 reflectBank;
|
/*0x01*/ u8 reflectBattlerId;
|
||||||
/*0x02*/ u8 lightscreenTimer;
|
/*0x02*/ u8 lightscreenTimer;
|
||||||
/*0x03*/ u8 lightscreenBank;
|
/*0x03*/ u8 lightscreenBattlerId;
|
||||||
/*0x04*/ u8 mistTimer;
|
/*0x04*/ u8 mistTimer;
|
||||||
/*0x05*/ u8 mistBank;
|
/*0x05*/ u8 mistBattlerId;
|
||||||
/*0x06*/ u8 safeguardTimer;
|
/*0x06*/ u8 safeguardTimer;
|
||||||
/*0x07*/ u8 safeguardBank;
|
/*0x07*/ u8 safeguardBattlerId;
|
||||||
/*0x08*/ u8 followmeTimer;
|
/*0x08*/ u8 followmeTimer;
|
||||||
/*0x09*/ u8 followmeTarget;
|
/*0x09*/ u8 followmeTarget;
|
||||||
/*0x0A*/ u8 spikesAmount;
|
/*0x0A*/ u8 spikesAmount;
|
||||||
@ -530,7 +530,7 @@ struct WishFutureKnock
|
|||||||
s32 futureSightDmg[MAX_BATTLERS_COUNT];
|
s32 futureSightDmg[MAX_BATTLERS_COUNT];
|
||||||
u16 futureSightMove[MAX_BATTLERS_COUNT];
|
u16 futureSightMove[MAX_BATTLERS_COUNT];
|
||||||
u8 wishCounter[MAX_BATTLERS_COUNT];
|
u8 wishCounter[MAX_BATTLERS_COUNT];
|
||||||
u8 wishUserID[MAX_BATTLERS_COUNT];
|
u8 wishMonId[MAX_BATTLERS_COUNT];
|
||||||
u8 weatherDuration;
|
u8 weatherDuration;
|
||||||
u8 knockedOffPokes[2];
|
u8 knockedOffPokes[2];
|
||||||
};
|
};
|
||||||
@ -625,7 +625,7 @@ struct BattleResults
|
|||||||
u16 playerMon2Species; // 0x26
|
u16 playerMon2Species; // 0x26
|
||||||
u16 caughtMonSpecies; // 0x28
|
u16 caughtMonSpecies; // 0x28
|
||||||
u8 caughtMonNick[10]; // 0x2A
|
u8 caughtMonNick[10]; // 0x2A
|
||||||
u8 filler34[2];
|
u8 filler34[2]; // 0x34
|
||||||
u8 catchAttempts[11]; // 0x36
|
u8 catchAttempts[11]; // 0x36
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -634,12 +634,12 @@ extern struct BattleResults gBattleResults;
|
|||||||
struct BattleStruct
|
struct BattleStruct
|
||||||
{
|
{
|
||||||
u8 turnEffectsTracker;
|
u8 turnEffectsTracker;
|
||||||
u8 turnEffectsBank;
|
u8 turnEffectsBattlerId;
|
||||||
u8 filler2;
|
u8 filler2;
|
||||||
u8 turncountersTracker;
|
u8 turnCountersTracker;
|
||||||
u8 wrappedMove[8]; // ask gamefreak why they declared it that way
|
u8 wrappedMove[8]; // ask gamefreak why they declared it that way
|
||||||
u8 moveTarget[4];
|
u8 moveTarget[4];
|
||||||
u8 expGetterId;
|
u8 expGetterMonId;
|
||||||
u8 field_11;
|
u8 field_11;
|
||||||
u8 wildVictorySong;
|
u8 wildVictorySong;
|
||||||
u8 dynamicMoveType;
|
u8 dynamicMoveType;
|
||||||
@ -653,13 +653,13 @@ struct BattleStruct
|
|||||||
u8 field_45;
|
u8 field_45;
|
||||||
u8 field_46;
|
u8 field_46;
|
||||||
u8 field_47;
|
u8 field_47;
|
||||||
u8 focusPunchBank;
|
u8 focusPunchBattlerId;
|
||||||
u8 field_49;
|
u8 field_49;
|
||||||
u8 moneyMultiplier;
|
u8 moneyMultiplier;
|
||||||
u8 savedTurnActionNumber;
|
u8 savedTurnActionNumber;
|
||||||
u8 switchInAbilitiesCounter;
|
u8 switchInAbilitiesCounter;
|
||||||
u8 faintedActionsState;
|
u8 faintedActionsState;
|
||||||
u8 faintedActionsBank;
|
u8 faintedActionsBattlerId;
|
||||||
u8 field_4F;
|
u8 field_4F;
|
||||||
u16 expValue;
|
u16 expValue;
|
||||||
u8 field_52;
|
u8 field_52;
|
||||||
@ -687,7 +687,7 @@ struct BattleStruct
|
|||||||
u8 field_8C;
|
u8 field_8C;
|
||||||
u8 field_8D;
|
u8 field_8D;
|
||||||
u8 stringMoveType;
|
u8 stringMoveType;
|
||||||
u8 expGetterBank;
|
u8 expGetterBattlerId;
|
||||||
u8 field_90;
|
u8 field_90;
|
||||||
u8 field_91;
|
u8 field_91;
|
||||||
u8 field_92;
|
u8 field_92;
|
||||||
@ -732,7 +732,7 @@ struct BattleStruct
|
|||||||
u8 field_183;
|
u8 field_183;
|
||||||
struct BattleEnigmaBerry battleEnigmaBerry;
|
struct BattleEnigmaBerry battleEnigmaBerry;
|
||||||
u8 wishPerishSongState;
|
u8 wishPerishSongState;
|
||||||
u8 wishPerishSongBank;
|
u8 wishPerishSongBattlerId;
|
||||||
bool8 overworldWeatherDone;
|
bool8 overworldWeatherDone;
|
||||||
u8 atkCancellerTracker;
|
u8 atkCancellerTracker;
|
||||||
u8 field_1A4[96];
|
u8 field_1A4[96];
|
||||||
|
@ -56,8 +56,8 @@ void LaunchBattleAnimation(const u8 *const animsTable[], u16 tableId, bool8 isMo
|
|||||||
void DestroyAnimSprite(struct Sprite *sprite);
|
void DestroyAnimSprite(struct Sprite *sprite);
|
||||||
void DestroyAnimVisualTask(u8 taskId);
|
void DestroyAnimVisualTask(u8 taskId);
|
||||||
void DestroyAnimSoundTask(u8 taskId);
|
void DestroyAnimSoundTask(u8 taskId);
|
||||||
bool8 IsBattlerSpriteVisible(u8 bank);
|
bool8 IsBattlerSpriteVisible(u8 battlerId);
|
||||||
void sub_80A438C(u8 bank, bool8 toBG_2, bool8 setSpriteInvisible);
|
void sub_80A438C(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible);
|
||||||
bool8 IsContest(void);
|
bool8 IsContest(void);
|
||||||
s8 BattleAnimAdjustPanning(s8 pan);
|
s8 BattleAnimAdjustPanning(s8 pan);
|
||||||
s8 BattleAnimAdjustPanning2(s8 pan);
|
s8 BattleAnimAdjustPanning2(s8 pan);
|
||||||
@ -76,7 +76,7 @@ void sub_80A6F3C(struct Sprite *sprite);
|
|||||||
void sub_80A8278(void);
|
void sub_80A8278(void);
|
||||||
void sub_80A6B30(struct UnknownAnimStruct2*);
|
void sub_80A6B30(struct UnknownAnimStruct2*);
|
||||||
void sub_80A6B90(struct UnknownAnimStruct2*, u32 arg1);
|
void sub_80A6B90(struct UnknownAnimStruct2*, u32 arg1);
|
||||||
u8 sub_80A82E4(u8 bank);
|
u8 sub_80A82E4(u8 battlerId);
|
||||||
bool8 AnimateBallThrow(struct Sprite *sprite);
|
bool8 AnimateBallThrow(struct Sprite *sprite);
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@ -85,26 +85,26 @@ enum
|
|||||||
BANK_Y_POS,
|
BANK_Y_POS,
|
||||||
};
|
};
|
||||||
|
|
||||||
u8 GetBattlerSpriteCoord(u8 bank, u8 attributeId);
|
u8 GetBattlerSpriteCoord(u8 battlerId, u8 attributeId);
|
||||||
|
|
||||||
bool8 IsBattlerSpritePresent(u8 bank);
|
bool8 IsBattlerSpritePresent(u8 battlerId);
|
||||||
void sub_80A6C68(u8 arg0);
|
void sub_80A6C68(u8 arg0);
|
||||||
u8 GetAnimBattlerSpriteId(u8 wantedBank);
|
u8 GetAnimBattlerSpriteId(u8 wantedBattler);
|
||||||
bool8 IsDoubleBattle(void);
|
bool8 IsDoubleBattle(void);
|
||||||
u8 sub_80A6D94(void);
|
u8 sub_80A6D94(void);
|
||||||
u8 sub_80A8364(u8);
|
u8 sub_80A8364(u8);
|
||||||
void StoreSpriteCallbackInData6(struct Sprite *sprite, void (*spriteCallback)(struct Sprite*));
|
void StoreSpriteCallbackInData6(struct Sprite *sprite, void (*spriteCallback)(struct Sprite*));
|
||||||
void oamt_add_pos2_onto_pos1(struct Sprite *sprite);
|
void oamt_add_pos2_onto_pos1(struct Sprite *sprite);
|
||||||
u8 GetBattlerSpriteDefault_Y(u8 bank);
|
u8 GetBattlerSpriteDefault_Y(u8 battlerId);
|
||||||
u8 sub_80A82E4(u8 bank);
|
u8 sub_80A82E4(u8 battlerId);
|
||||||
u8 GetSubstituteSpriteDefault_Y(u8 bank);
|
u8 GetSubstituteSpriteDefault_Y(u8 battlerId);
|
||||||
|
|
||||||
// battle_anim_80A9C70.s
|
// battle_anim_80A9C70.s
|
||||||
void LaunchStatusAnimation(u8 bank, u8 statusAnimId);
|
void LaunchStatusAnimation(u8 battlerId, u8 statusAnimId);
|
||||||
|
|
||||||
// battle_anim_8170478.s
|
// battle_anim_8170478.s
|
||||||
u8 ItemIdToBallId(u16 itemId);
|
u8 ItemIdToBallId(u16 itemId);
|
||||||
u8 LaunchBallStarsTask(u8 x, u8 y, u8 kindOfStars, u8 arg3, u8 ballId);
|
u8 LaunchBallStarsTask(u8 x, u8 y, u8 kindOfStars, u8 arg3, u8 ballId);
|
||||||
u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 bank, u32 arg2, u8 ballId);
|
u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 battlerId, u32 arg2, u8 ballId);
|
||||||
|
|
||||||
#endif // GUARD_BATTLE_ANIM_H
|
#endif // GUARD_BATTLE_ANIM_H
|
||||||
|
@ -8,41 +8,41 @@ void sub_805D714(struct Sprite *sprite);
|
|||||||
void sub_805D770(struct Sprite *sprite, bool8 arg1);
|
void sub_805D770(struct Sprite *sprite, bool8 arg1);
|
||||||
void sub_805D7AC(struct Sprite *sprite);
|
void sub_805D7AC(struct Sprite *sprite);
|
||||||
void InitAndLaunchChosenStatusAnimation(bool8 isStatus2, u32 status);
|
void InitAndLaunchChosenStatusAnimation(bool8 isStatus2, u32 status);
|
||||||
bool8 TryHandleLaunchBattleTableAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tableId, u16 argument);
|
bool8 TryHandleLaunchBattleTableAnimation(u8 activeBattlerId, u8 attacker, u8 target, u8 tableId, u16 argument);
|
||||||
void InitAndLaunchSpecialAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tableId);
|
void InitAndLaunchSpecialAnimation(u8 activeBattlerId, u8 attacker, u8 target, u8 tableId);
|
||||||
bool8 IsMoveWithoutAnimation(u16 moveId, u8 animationTurn);
|
bool8 IsMoveWithoutAnimation(u16 moveId, u8 animationTurn);
|
||||||
bool8 mplay_80342A4(u8 bank);
|
bool8 mplay_80342A4(u8 battlerId);
|
||||||
void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 bank);
|
void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 battlerId);
|
||||||
void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 bank);
|
void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 battlerId);
|
||||||
void nullsub_23(void);
|
void nullsub_23(void);
|
||||||
void nullsub_24(u16 species);
|
void nullsub_24(u16 species);
|
||||||
void DecompressTrainerFrontPic(u16 frontPicId, u8 bank);
|
void DecompressTrainerFrontPic(u16 frontPicId, u8 battlerId);
|
||||||
void DecompressTrainerBackPic(u16 backPicId, u8 bank);
|
void DecompressTrainerBackPic(u16 backPicId, u8 battlerId);
|
||||||
void nullsub_25(u8 arg0);
|
void nullsub_25(u8 arg0);
|
||||||
void FreeTrainerFrontPicPalette(u16 frontPicId);
|
void FreeTrainerFrontPicPalette(u16 frontPicId);
|
||||||
void sub_805DFFC(void);
|
void sub_805DFFC(void);
|
||||||
bool8 BattleLoadAllHealthBoxesGfx(u8 state);
|
bool8 BattleLoadAllHealthBoxesGfx(u8 state);
|
||||||
void LoadBattleBarGfx(u8 arg0);
|
void LoadBattleBarGfx(u8 arg0);
|
||||||
bool8 BattleInitAllSprites(u8 *state1, u8 *bank);
|
bool8 BattleInitAllSprites(u8 *state1, u8 *battlerId);
|
||||||
void ClearSpritesHealthboxAnimData(void);
|
void ClearSpritesHealthboxAnimData(void);
|
||||||
void CopyAllBattleSpritesInvisibilities(void);
|
void CopyAllBattleSpritesInvisibilities(void);
|
||||||
void CopyBattleSpriteInvisibility(u8 bank);
|
void CopyBattleSpriteInvisibility(u8 battlerId);
|
||||||
void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform);
|
void HandleSpeciesGfxDataChange(u8 attacker, u8 target, bool8 notTransform);
|
||||||
void BattleLoadSubstituteOrMonSpriteGfx(u8 bank, bool8 loadMonSprite);
|
void BattleLoadSubstituteOrMonSpriteGfx(u8 battlerId, bool8 loadMonSprite);
|
||||||
void LoadBattleMonGfxAndAnimate(u8 bank, bool8 loadMonSprite, u8 spriteId);
|
void LoadBattleMonGfxAndAnimate(u8 battlerId, bool8 loadMonSprite, u8 spriteId);
|
||||||
void TrySetBehindSubstituteSpriteBit(u8 bank, u16 move);
|
void TrySetBehindSubstituteSpriteBit(u8 battlerId, u16 move);
|
||||||
void ClearBehindSubstituteBit(u8 bank);
|
void ClearBehindSubstituteBit(u8 battlerId);
|
||||||
void HandleLowHpMusicChange(struct Pokemon *mon, u8 bank);
|
void HandleLowHpMusicChange(struct Pokemon *mon, u8 battlerId);
|
||||||
void BattleStopLowHpSound(void);
|
void BattleStopLowHpSound(void);
|
||||||
u8 GetMonHPBarLevel(struct Pokemon *mon);
|
u8 GetMonHPBarLevel(struct Pokemon *mon);
|
||||||
void sub_805EAE8(void);
|
void sub_805EAE8(void);
|
||||||
void sub_805EB9C(u8 affineMode);
|
void sub_805EB9C(u8 affineMode);
|
||||||
void LoadAndCreateEnemyShadowSprites(void);
|
void LoadAndCreateEnemyShadowSprites(void);
|
||||||
void SpriteCB_SetInvisible(struct Sprite *sprite);
|
void SpriteCB_SetInvisible(struct Sprite *sprite);
|
||||||
void SetBattlerShadowSpriteCallback(u8 bank, u16 species);
|
void SetBattlerShadowSpriteCallback(u8 battlerId, u16 species);
|
||||||
void HideBattlerShadowSprite(u8 bank);
|
void HideBattlerShadowSprite(u8 battlerId);
|
||||||
void sub_805EF14(void);
|
void sub_805EF14(void);
|
||||||
void ClearTemporarySpeciesSpriteData(u8 bank, bool8 dontClearSubstitute);
|
void ClearTemporarySpeciesSpriteData(u8 battlerId, bool8 dontClearSubstitute);
|
||||||
void AllocateMonSpritesGfx(void);
|
void AllocateMonSpritesGfx(void);
|
||||||
void FreeMonSpritesGfx(void);
|
void FreeMonSpritesGfx(void);
|
||||||
bool32 ShouldPlayNormalPokeCry(struct Pokemon *mon);
|
bool32 ShouldPlayNormalPokeCry(struct Pokemon *mon);
|
||||||
|
@ -21,8 +21,8 @@ void sub_8039B58(struct Sprite *sprite);
|
|||||||
void sub_8039BB4(struct Sprite *sprite);
|
void sub_8039BB4(struct Sprite *sprite);
|
||||||
void sub_80105DC(struct Sprite *sprite);
|
void sub_80105DC(struct Sprite *sprite);
|
||||||
void sub_8039C00(struct Sprite *sprite);
|
void sub_8039C00(struct Sprite *sprite);
|
||||||
void dp11b_obj_instanciate(u8 bank, u8 b, s8 c, s8 d);
|
void dp11b_obj_instanciate(u8 battlerId, u8 b, s8 c, s8 d);
|
||||||
void dp11b_obj_free(u8 bank, bool8 b);
|
void dp11b_obj_free(u8 battlerId, bool8 b);
|
||||||
void sub_8039E44(struct Sprite *sprite);
|
void sub_8039E44(struct Sprite *sprite);
|
||||||
void sub_8039E60(struct Sprite *sprite);
|
void sub_8039E60(struct Sprite *sprite);
|
||||||
void sub_8039E84(struct Sprite *sprite);
|
void sub_8039E84(struct Sprite *sprite);
|
||||||
@ -35,12 +35,12 @@ void sub_803B3AC(void); // unused
|
|||||||
void sub_803B598(void); // unused
|
void sub_803B598(void); // unused
|
||||||
void BattleTurnPassed(void);
|
void BattleTurnPassed(void);
|
||||||
u8 IsRunningFromBattleImpossible(void);
|
u8 IsRunningFromBattleImpossible(void);
|
||||||
void sub_803BDA0(u8 bank);
|
void sub_803BDA0(u8 battlerId);
|
||||||
void SwapTurnOrder(u8 id1, u8 id2);
|
void SwapTurnOrder(u8 id1, u8 id2);
|
||||||
u8 GetWhoStrikesFirst(u8 bank1, u8 bank2, bool8 ignoreChosenMoves);
|
u8 GetWhoStrikesFirst(u8 battlerId1, u8 battlerId2, bool8 ignoreChosenMoves);
|
||||||
void RunBattleScriptCommands_PopCallbacksStack(void);
|
void RunBattleScriptCommands_PopCallbacksStack(void);
|
||||||
void RunBattleScriptCommands(void);
|
void RunBattleScriptCommands(void);
|
||||||
bool8 TryRunFromBattle(u8 bank);
|
bool8 TryRunFromBattle(u8 battlerId);
|
||||||
|
|
||||||
extern const u8 gStatusConditionString_PoisonJpn[8];
|
extern const u8 gStatusConditionString_PoisonJpn[8];
|
||||||
extern const u8 gStatusConditionString_SleepJpn[8];
|
extern const u8 gStatusConditionString_SleepJpn[8];
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef GUARD_BATTLE_AI_H
|
#ifndef GUARD_BATTLE_AI_H
|
||||||
#define GUARD_BATTLE_AI_H
|
#define GUARD_BATTLE_AI_H
|
||||||
|
|
||||||
// banks enum
|
// battlers
|
||||||
#define AI_TARGET 0
|
#define AI_TARGET 0
|
||||||
#define AI_USER 1
|
#define AI_USER 1
|
||||||
#define AI_TARGET_PARTNER 2
|
#define AI_TARGET_PARTNER 2
|
||||||
@ -22,7 +22,7 @@
|
|||||||
#define AI_EFFECTIVENESS_x0_25 10
|
#define AI_EFFECTIVENESS_x0_25 10
|
||||||
#define AI_EFFECTIVENESS_x0 0
|
#define AI_EFFECTIVENESS_x0 0
|
||||||
|
|
||||||
// ai weather enum
|
// ai weather
|
||||||
#define AI_WEATHER_SUN 0
|
#define AI_WEATHER_SUN 0
|
||||||
#define AI_WEATHER_RAIN 1
|
#define AI_WEATHER_RAIN 1
|
||||||
#define AI_WEATHER_SANDSTORM 2
|
#define AI_WEATHER_SANDSTORM 2
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef GUARD_CONSTANTS_BATTLE_ANIM_H
|
#ifndef GUARD_CONSTANTS_BATTLE_ANIM_H
|
||||||
#define GUARD_CONSTANTS_BATTLE_ANIM_H
|
#define GUARD_CONSTANTS_BATTLE_ANIM_H
|
||||||
|
|
||||||
// banks enum used in scripts
|
// battlers
|
||||||
#define ANIM_ATTACKER 0
|
#define ANIM_ATTACKER 0
|
||||||
#define ANIM_TARGET 1
|
#define ANIM_TARGET 1
|
||||||
#define ANIM_ATK_PARTNER 2
|
#define ANIM_ATK_PARTNER 2
|
||||||
|
@ -58,7 +58,7 @@ extern u8 gNumberOfMovesToChoose;
|
|||||||
extern u16 gBattle_BG0_X;
|
extern u16 gBattle_BG0_X;
|
||||||
extern u16 gBattle_BG0_Y;
|
extern u16 gBattle_BG0_Y;
|
||||||
extern s32 gUnknown_0203CD70;
|
extern s32 gUnknown_0203CD70;
|
||||||
extern u8 gBankInMenu;
|
extern u8 gBattlerInMenuId;
|
||||||
extern u32 gBattlePalaceMoveSelectionRngValue;
|
extern u32 gBattlePalaceMoveSelectionRngValue;
|
||||||
extern u32 gTransformedPersonalities[MAX_BATTLERS_COUNT];
|
extern u32 gTransformedPersonalities[MAX_BATTLERS_COUNT];
|
||||||
extern u8 gUnknown_020244B4[];
|
extern u8 gUnknown_020244B4[];
|
||||||
@ -2677,7 +2677,7 @@ static void PlayerHandleChooseItem(void)
|
|||||||
|
|
||||||
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
|
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
|
||||||
gBattlerControllerFuncs[gActiveBattler] = OpenBagAndChooseItem;
|
gBattlerControllerFuncs[gActiveBattler] = OpenBagAndChooseItem;
|
||||||
gBankInMenu = gActiveBattler;
|
gBattlerInMenuId = gActiveBattler;
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
gUnknown_0203CF00[i] = gBattleBufferA[gActiveBattler][1 + i];
|
gUnknown_0203CF00[i] = gBattleBufferA[gActiveBattler][1 + i];
|
||||||
@ -2704,7 +2704,7 @@ static void PlayerHandleChoosePokemon(void)
|
|||||||
*(&gBattleStruct->field_B0) = gBattleBufferA[gActiveBattler][3];
|
*(&gBattleStruct->field_B0) = gBattleBufferA[gActiveBattler][3];
|
||||||
BeginNormalPaletteFade(-1, 0, 0, 16, 0);
|
BeginNormalPaletteFade(-1, 0, 0, 16, 0);
|
||||||
gBattlerControllerFuncs[gActiveBattler] = sub_80597CC;
|
gBattlerControllerFuncs[gActiveBattler] = sub_80597CC;
|
||||||
gBankInMenu = gActiveBattler;
|
gBattlerInMenuId = gActiveBattler;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT];
|
|||||||
extern u8 gBattleOutcome;
|
extern u8 gBattleOutcome;
|
||||||
extern u16 gBattle_BG0_X;
|
extern u16 gBattle_BG0_X;
|
||||||
extern u16 gBattle_BG0_Y;
|
extern u16 gBattle_BG0_Y;
|
||||||
extern u8 gBankInMenu;
|
extern u8 gBattlerInMenuId;
|
||||||
extern u16 gUnknown_020243FC;
|
extern u16 gUnknown_020243FC;
|
||||||
extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT];
|
extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT];
|
||||||
extern u8 gBattleMonForms[MAX_BATTLERS_COUNT];
|
extern u8 gBattleMonForms[MAX_BATTLERS_COUNT];
|
||||||
|
@ -42,7 +42,7 @@ extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT];
|
|||||||
extern u8 gBattleOutcome;
|
extern u8 gBattleOutcome;
|
||||||
extern u16 gBattle_BG0_X;
|
extern u16 gBattle_BG0_X;
|
||||||
extern u16 gBattle_BG0_Y;
|
extern u16 gBattle_BG0_Y;
|
||||||
extern u8 gBankInMenu;
|
extern u8 gBattlerInMenuId;
|
||||||
extern u16 gUnknown_020243FC;
|
extern u16 gUnknown_020243FC;
|
||||||
extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT];
|
extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT];
|
||||||
extern u8 gBattleMonForms[MAX_BATTLERS_COUNT];
|
extern u8 gBattleMonForms[MAX_BATTLERS_COUNT];
|
||||||
|
@ -40,7 +40,7 @@ extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT];
|
|||||||
extern u8 gBattleOutcome;
|
extern u8 gBattleOutcome;
|
||||||
extern u16 gBattle_BG0_X;
|
extern u16 gBattle_BG0_X;
|
||||||
extern u16 gBattle_BG0_Y;
|
extern u16 gBattle_BG0_Y;
|
||||||
extern u8 gBankInMenu;
|
extern u8 gBattlerInMenuId;
|
||||||
extern u16 gUnknown_020243FC;
|
extern u16 gUnknown_020243FC;
|
||||||
|
|
||||||
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
|
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
|
||||||
@ -500,7 +500,7 @@ static void SafariHandleChooseItem(void)
|
|||||||
|
|
||||||
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
|
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
|
||||||
gBattlerControllerFuncs[gActiveBattler] = SafariOpenPokeblockCase;
|
gBattlerControllerFuncs[gActiveBattler] = SafariOpenPokeblockCase;
|
||||||
gBankInMenu = gActiveBattler;
|
gBattlerInMenuId = gActiveBattler;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SafariHandleChoosePokemon(void)
|
static void SafariHandleChoosePokemon(void)
|
||||||
|
@ -54,7 +54,7 @@ extern u8 gNumberOfMovesToChoose;
|
|||||||
extern u16 gBattle_BG0_X;
|
extern u16 gBattle_BG0_X;
|
||||||
extern u16 gBattle_BG0_Y;
|
extern u16 gBattle_BG0_Y;
|
||||||
extern s32 gUnknown_0203CD70;
|
extern s32 gUnknown_0203CD70;
|
||||||
extern u8 gBankInMenu;
|
extern u8 gBattlerInMenuId;
|
||||||
extern u32 gBattlePalaceMoveSelectionRngValue;
|
extern u32 gBattlePalaceMoveSelectionRngValue;
|
||||||
extern u32 gTransformedPersonalities[MAX_BATTLERS_COUNT];
|
extern u32 gTransformedPersonalities[MAX_BATTLERS_COUNT];
|
||||||
extern u8 gUnknown_020244B4[];
|
extern u8 gUnknown_020244B4[];
|
||||||
@ -1282,7 +1282,7 @@ static void WallyHandleChooseItem(void)
|
|||||||
{
|
{
|
||||||
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
|
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
|
||||||
gBattlerControllerFuncs[gActiveBattler] = OpenBagAfterPaletteFade;
|
gBattlerControllerFuncs[gActiveBattler] = OpenBagAfterPaletteFade;
|
||||||
gBankInMenu = gActiveBattler;
|
gBattlerInMenuId = gActiveBattler;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WallyHandleChoosePokemon(void)
|
static void WallyHandleChoosePokemon(void)
|
||||||
|
@ -81,8 +81,6 @@ extern struct BattleEnigmaBerry gEnigmaBerries[MAX_BATTLERS_COUNT];
|
|||||||
extern void (*gPreBattleCallback1)(void);
|
extern void (*gPreBattleCallback1)(void);
|
||||||
extern void (*gBattleMainFunc)(void);
|
extern void (*gBattleMainFunc)(void);
|
||||||
extern void (*gCB2_AfterEvolution)(void);
|
extern void (*gCB2_AfterEvolution)(void);
|
||||||
extern struct UnknownPokemonStruct2 gUnknown_02022FF8[3]; // what is it used for?
|
|
||||||
extern struct UnknownPokemonStruct2* gUnknown_02023058; // what is it used for?
|
|
||||||
extern struct MusicPlayerInfo gMPlayInfo_SE1;
|
extern struct MusicPlayerInfo gMPlayInfo_SE1;
|
||||||
extern struct MusicPlayerInfo gMPlayInfo_SE2;
|
extern struct MusicPlayerInfo gMPlayInfo_SE2;
|
||||||
extern u8 gDecompressionBuffer[];
|
extern u8 gDecompressionBuffer[];
|
||||||
@ -92,7 +90,6 @@ extern void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(void);
|
|||||||
extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200];
|
extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200];
|
||||||
extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200];
|
extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200];
|
||||||
extern u8 gStringBattler;
|
extern u8 gStringBattler;
|
||||||
extern u32 gUnknown_02022F88;
|
|
||||||
extern u32 gHitMarker;
|
extern u32 gHitMarker;
|
||||||
extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT];
|
extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT];
|
||||||
extern u8 gBattleMonForms[MAX_BATTLERS_COUNT];
|
extern u8 gBattleMonForms[MAX_BATTLERS_COUNT];
|
||||||
@ -261,6 +258,102 @@ static void HandleAction_Action11(void);
|
|||||||
static void HandleAction_NothingIsFainted(void);
|
static void HandleAction_NothingIsFainted(void);
|
||||||
static void HandleAction_ActionFinished(void);
|
static void HandleAction_ActionFinished(void);
|
||||||
|
|
||||||
|
// EWRAM vars
|
||||||
|
EWRAM_DATA u32 gUnknown_02022F88[25] = {0};
|
||||||
|
EWRAM_DATA u32 gBattleTypeFlags = 0;
|
||||||
|
EWRAM_DATA u8 gBattleTerrain = 0;
|
||||||
|
EWRAM_DATA u32 gUnknown_02022FF4 = 0;
|
||||||
|
EWRAM_DATA struct UnknownPokemonStruct2 gUnknown_02022FF8[3] = {0}; // what is it used for?
|
||||||
|
EWRAM_DATA struct UnknownPokemonStruct2* gUnknown_02023058 = NULL; // what is it used for?
|
||||||
|
EWRAM_DATA u8 *gUnknown_0202305C = NULL;
|
||||||
|
EWRAM_DATA u8 *gUnknown_02023060 = NULL;
|
||||||
|
EWRAM_DATA u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200] = {0};
|
||||||
|
EWRAM_DATA u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200] = {0};
|
||||||
|
EWRAM_DATA u8 gActiveBattler = 0;
|
||||||
|
EWRAM_DATA u32 gBattleControllerExecFlags = 0;
|
||||||
|
EWRAM_DATA u8 gBattlersCount = 0;
|
||||||
|
EWRAM_DATA u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u8 gBattlerPositions[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u8 gActionsByTurnOrder[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u8 gBattleTurnOrder[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u8 gCurrentTurnActionNumber = 0;
|
||||||
|
EWRAM_DATA u8 gCurrentActionFuncId = 0;
|
||||||
|
EWRAM_DATA struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u8 gBattlerSpriteIds[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u8 gCurrMovePos = 0;
|
||||||
|
EWRAM_DATA u8 gUnknown_020241E9 = 0;
|
||||||
|
EWRAM_DATA u16 gCurrentMove = 0;
|
||||||
|
EWRAM_DATA u16 gChosenMove = 0;
|
||||||
|
EWRAM_DATA u16 gRandomMove = 0;
|
||||||
|
EWRAM_DATA s32 gBattleMoveDamage = 0;
|
||||||
|
EWRAM_DATA s32 gHpDealt = 0;
|
||||||
|
EWRAM_DATA s32 gTakenDmg[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u16 gLastUsedItem = 0;
|
||||||
|
EWRAM_DATA u8 gLastUsedAbility = 0;
|
||||||
|
EWRAM_DATA u8 gBattlerAttacker = 0;
|
||||||
|
EWRAM_DATA u8 gBattlerTarget = 0;
|
||||||
|
EWRAM_DATA u8 gBank1 = 0;
|
||||||
|
EWRAM_DATA u8 gEffectBank = 0;
|
||||||
|
EWRAM_DATA u8 gStringBattler = 0;
|
||||||
|
EWRAM_DATA u8 gAbsentBattlerFlags = 0;
|
||||||
|
EWRAM_DATA u8 gCritMultiplier = 0;
|
||||||
|
EWRAM_DATA u8 gMultiHitCounter = 0;
|
||||||
|
EWRAM_DATA const u8 *gBattlescriptCurrInstr = NULL;
|
||||||
|
EWRAM_DATA u32 gUnusedBattleMainVar = 0;
|
||||||
|
EWRAM_DATA u8 gChosenActionByBattler[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA const u8 *gSelectionBattleScripts[MAX_BATTLERS_COUNT] = {NULL};
|
||||||
|
EWRAM_DATA const u8 *gPalaceSelectionBattleScripts[MAX_BATTLERS_COUNT] = {NULL};
|
||||||
|
EWRAM_DATA u16 gLastPrintedMoves[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u16 gLastMoves[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u16 gLastLandedMoves[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u16 gLastHitByType[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u16 gLastResultingMoves[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u16 gLockedMoves[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u8 gLastHitBy[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u16 gChosenMoveByBattler[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u8 gMoveResultFlags = 0;
|
||||||
|
EWRAM_DATA u32 gHitMarker = 0;
|
||||||
|
EWRAM_DATA u8 gUnknown_02024284[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u8 gUnknown_0202428C = 0;
|
||||||
|
EWRAM_DATA u16 gSideStatuses[2] = {0};
|
||||||
|
EWRAM_DATA struct SideTimer gSideTimers[2] = {0};
|
||||||
|
EWRAM_DATA u32 gStatuses3[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA struct DisableStruct gDisableStructs[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u16 gPauseCounterBattle = 0;
|
||||||
|
EWRAM_DATA u16 gPaydayMoney = 0;
|
||||||
|
EWRAM_DATA u16 gRandomTurnNumber = 0;
|
||||||
|
EWRAM_DATA u8 gBattleCommunication[BATTLE_COMMUNICATION_ENTRIES_COUNT] = {0};
|
||||||
|
EWRAM_DATA u8 gBattleOutcome = 0;
|
||||||
|
EWRAM_DATA struct ProtectStruct gProtectStructs[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA struct SpecialStatus gSpecialStatuses[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u16 gBattleWeather = 0;
|
||||||
|
EWRAM_DATA struct WishFutureKnock gWishFutureKnock = {0};
|
||||||
|
EWRAM_DATA u16 gUnknown_020243FC = 0;
|
||||||
|
EWRAM_DATA u8 gSentPokesToOpponent[2] = {0};
|
||||||
|
EWRAM_DATA u16 gDynamicBasePower = 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;
|
||||||
|
EWRAM_DATA u8 *gLinkBattleSendBuffer = NULL;
|
||||||
|
EWRAM_DATA u8 *gLinkBattleRecvBuffer = NULL;
|
||||||
|
EWRAM_DATA struct BattleResources *gBattleResources = NULL;
|
||||||
|
EWRAM_DATA u8 gActionSelectionCursor[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u8 gMoveSelectionCursor[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u8 gUnknown_020244B4[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u8 gBattlerInMenuId = 0;
|
||||||
|
EWRAM_DATA bool8 gDoingBattleAnim = FALSE;
|
||||||
|
EWRAM_DATA u32 gTransformedPersonalities[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u8 gPlayerDpadHoldFrames = 0;
|
||||||
|
EWRAM_DATA struct BattleSpriteData *gBattleSpritesDataPtr = NULL;
|
||||||
|
EWRAM_DATA struct MonSpritesGfx *gMonSpritesGfxPtr = NULL;
|
||||||
|
EWRAM_DATA u8 *gUnknown_020244D8 = NULL;
|
||||||
|
EWRAM_DATA u8 *gUnknown_020244DC = NULL;
|
||||||
|
EWRAM_DATA u16 gBattleMovePower = 0;
|
||||||
|
EWRAM_DATA u16 gMoveToLearn = 0;
|
||||||
|
EWRAM_DATA u8 gBattleMonForms[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
|
||||||
// rom const data
|
// rom const data
|
||||||
static void (* const sTurnActionsFuncsTable[])(void) =
|
static void (* const sTurnActionsFuncsTable[])(void) =
|
||||||
{
|
{
|
||||||
@ -2437,7 +2530,7 @@ static void sub_80398D0(struct Sprite *sprite)
|
|||||||
{
|
{
|
||||||
sprite->invisible = FALSE;
|
sprite->invisible = FALSE;
|
||||||
sprite->callback = SpriteCallbackDummy_2;
|
sprite->callback = SpriteCallbackDummy_2;
|
||||||
gUnknown_02022F88 = 0;
|
gUnknown_02022F88[0] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3656,12 +3749,12 @@ static void TryDoEventsBeforeFirstTurn(void)
|
|||||||
gBattleMons[i].status2 &= ~(STATUS2_FLINCHED);
|
gBattleMons[i].status2 &= ~(STATUS2_FLINCHED);
|
||||||
|
|
||||||
*(&gBattleStruct->turnEffectsTracker) = 0;
|
*(&gBattleStruct->turnEffectsTracker) = 0;
|
||||||
*(&gBattleStruct->turnEffectsBank) = 0;
|
*(&gBattleStruct->turnEffectsBattlerId) = 0;
|
||||||
*(&gBattleStruct->wishPerishSongState) = 0;
|
*(&gBattleStruct->wishPerishSongState) = 0;
|
||||||
*(&gBattleStruct->wishPerishSongBank) = 0;
|
*(&gBattleStruct->wishPerishSongBattlerId) = 0;
|
||||||
gBattleScripting.atk49_state = 0;
|
gBattleScripting.atk49_state = 0;
|
||||||
gBattleStruct->faintedActionsState = 0;
|
gBattleStruct->faintedActionsState = 0;
|
||||||
gBattleStruct->turncountersTracker = 0;
|
gBattleStruct->turnCountersTracker = 0;
|
||||||
gMoveResultFlags = 0;
|
gMoveResultFlags = 0;
|
||||||
|
|
||||||
gRandomTurnNumber = Random();
|
gRandomTurnNumber = Random();
|
||||||
@ -3689,10 +3782,10 @@ static void HandleEndTurn_ContinueBattle(void)
|
|||||||
CancelMultiTurnMoves(i);
|
CancelMultiTurnMoves(i);
|
||||||
}
|
}
|
||||||
gBattleStruct->turnEffectsTracker = 0;
|
gBattleStruct->turnEffectsTracker = 0;
|
||||||
gBattleStruct->turnEffectsBank = 0;
|
gBattleStruct->turnEffectsBattlerId = 0;
|
||||||
gBattleStruct->wishPerishSongState = 0;
|
gBattleStruct->wishPerishSongState = 0;
|
||||||
gBattleStruct->wishPerishSongBank = 0;
|
gBattleStruct->wishPerishSongBattlerId = 0;
|
||||||
gBattleStruct->turncountersTracker = 0;
|
gBattleStruct->turnCountersTracker = 0;
|
||||||
gMoveResultFlags = 0;
|
gMoveResultFlags = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4556,7 +4649,7 @@ static void SetActionsAndBanksTurnOrder(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
gBattleMainFunc = CheckFocusPunch_ClearVarsBeforeTurnStarts;
|
gBattleMainFunc = CheckFocusPunch_ClearVarsBeforeTurnStarts;
|
||||||
gBattleStruct->focusPunchBank = 0;
|
gBattleStruct->focusPunchBattlerId = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -4598,7 +4691,7 @@ static void SetActionsAndBanksTurnOrder(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
gBattleMainFunc = CheckFocusPunch_ClearVarsBeforeTurnStarts;
|
gBattleMainFunc = CheckFocusPunch_ClearVarsBeforeTurnStarts;
|
||||||
gBattleStruct->focusPunchBank = 0;
|
gBattleStruct->focusPunchBattlerId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TurnValuesCleanUp(bool8 var0)
|
static void TurnValuesCleanUp(bool8 var0)
|
||||||
@ -4654,10 +4747,10 @@ static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void)
|
|||||||
{
|
{
|
||||||
if (!(gHitMarker & HITMARKER_RUN))
|
if (!(gHitMarker & HITMARKER_RUN))
|
||||||
{
|
{
|
||||||
while (gBattleStruct->focusPunchBank < gBattlersCount)
|
while (gBattleStruct->focusPunchBattlerId < gBattlersCount)
|
||||||
{
|
{
|
||||||
gActiveBattler = gBattlerAttacker = gBattleStruct->focusPunchBank;
|
gActiveBattler = gBattlerAttacker = gBattleStruct->focusPunchBattlerId;
|
||||||
gBattleStruct->focusPunchBank++;
|
gBattleStruct->focusPunchBattlerId++;
|
||||||
if (gChosenMoveByBattler[gActiveBattler] == MOVE_FOCUS_PUNCH
|
if (gChosenMoveByBattler[gActiveBattler] == MOVE_FOCUS_PUNCH
|
||||||
&& !(gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP)
|
&& !(gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP)
|
||||||
&& !(gDisableStructs[gBattlerAttacker].truantCounter)
|
&& !(gDisableStructs[gBattlerAttacker].truantCounter)
|
||||||
|
@ -79,7 +79,7 @@ extern u16 gLastUsedItem;
|
|||||||
extern u16 gBattleMovePower;
|
extern u16 gBattleMovePower;
|
||||||
extern s32 gHpDealt;
|
extern s32 gHpDealt;
|
||||||
extern s32 gTakenDmg[MAX_BATTLERS_COUNT];
|
extern s32 gTakenDmg[MAX_BATTLERS_COUNT];
|
||||||
extern u8 gTakenDmgBanks[MAX_BATTLERS_COUNT];
|
extern u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT];
|
||||||
extern u8 gSentPokesToOpponent[2];
|
extern u8 gSentPokesToOpponent[2];
|
||||||
extern u8 gBank1;
|
extern u8 gBank1;
|
||||||
extern u16 gExpShareExp;
|
extern u16 gExpShareExp;
|
||||||
@ -88,7 +88,7 @@ extern void (*gBattleMainFunc)(void);
|
|||||||
extern u8 gPlayerPartyCount;
|
extern u8 gPlayerPartyCount;
|
||||||
extern u16 gMoveToLearn;
|
extern u16 gMoveToLearn;
|
||||||
extern u16 gRandomMove;
|
extern u16 gRandomMove;
|
||||||
extern u8 gBankInMenu;
|
extern u8 gBattlerInMenuId;
|
||||||
extern u8 gChosenActionByBattler[MAX_BATTLERS_COUNT];
|
extern u8 gChosenActionByBattler[MAX_BATTLERS_COUNT];
|
||||||
extern u8 gCurrentTurnActionNumber;
|
extern u8 gCurrentTurnActionNumber;
|
||||||
extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200];
|
extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200];
|
||||||
@ -157,8 +157,8 @@ extern const u8 gText_BattleYesNoChoice[];
|
|||||||
|
|
||||||
#define DEFENDER_IS_PROTECTED ((gProtectStructs[gBattlerTarget].protected) && (gBattleMoves[gCurrentMove].flags & FLAG_PROTECT_AFFECTED))
|
#define DEFENDER_IS_PROTECTED ((gProtectStructs[gBattlerTarget].protected) && (gBattleMoves[gCurrentMove].flags & FLAG_PROTECT_AFFECTED))
|
||||||
|
|
||||||
#define TARGET_TURN_DAMAGED (gSpecialStatuses[gBattlerTarget].moveturnLostHP_physical != 0 \
|
#define TARGET_TURN_DAMAGED (gSpecialStatuses[gBattlerTarget].physicalDmg != 0 \
|
||||||
|| gSpecialStatuses[gBattlerTarget].moveturnLostHP_special != 0)
|
|| gSpecialStatuses[gBattlerTarget].specialDmg != 0)
|
||||||
|
|
||||||
// this file's functions
|
// this file's functions
|
||||||
static bool8 IsTwoTurnsMove(u16 move);
|
static bool8 IsTwoTurnsMove(u16 move);
|
||||||
@ -1969,15 +1969,15 @@ static void atk0C_datahpupdate(void)
|
|||||||
{
|
{
|
||||||
if (gDisableStructs[gActiveBattler].substituteHP >= gBattleMoveDamage)
|
if (gDisableStructs[gActiveBattler].substituteHP >= gBattleMoveDamage)
|
||||||
{
|
{
|
||||||
if (gSpecialStatuses[gActiveBattler].moveturnLostHP == 0)
|
if (gSpecialStatuses[gActiveBattler].dmg == 0)
|
||||||
gSpecialStatuses[gActiveBattler].moveturnLostHP = gBattleMoveDamage;
|
gSpecialStatuses[gActiveBattler].dmg = gBattleMoveDamage;
|
||||||
gDisableStructs[gActiveBattler].substituteHP -= gBattleMoveDamage;
|
gDisableStructs[gActiveBattler].substituteHP -= gBattleMoveDamage;
|
||||||
gHpDealt = gBattleMoveDamage;
|
gHpDealt = gBattleMoveDamage;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gSpecialStatuses[gActiveBattler].moveturnLostHP == 0)
|
if (gSpecialStatuses[gActiveBattler].dmg == 0)
|
||||||
gSpecialStatuses[gActiveBattler].moveturnLostHP = gDisableStructs[gActiveBattler].substituteHP;
|
gSpecialStatuses[gActiveBattler].dmg = gDisableStructs[gActiveBattler].substituteHP;
|
||||||
gHpDealt = gDisableStructs[gActiveBattler].substituteHP;
|
gHpDealt = gDisableStructs[gActiveBattler].substituteHP;
|
||||||
gDisableStructs[gActiveBattler].substituteHP = 0;
|
gDisableStructs[gActiveBattler].substituteHP = 0;
|
||||||
}
|
}
|
||||||
@ -2010,9 +2010,9 @@ static void atk0C_datahpupdate(void)
|
|||||||
{
|
{
|
||||||
gTakenDmg[gActiveBattler] += gBattleMoveDamage;
|
gTakenDmg[gActiveBattler] += gBattleMoveDamage;
|
||||||
if (gBattlescriptCurrInstr[1] == BS_GET_TARGET)
|
if (gBattlescriptCurrInstr[1] == BS_GET_TARGET)
|
||||||
gTakenDmgBanks[gActiveBattler] = gBattlerAttacker;
|
gTakenDmgByBattler[gActiveBattler] = gBattlerAttacker;
|
||||||
else
|
else
|
||||||
gTakenDmgBanks[gActiveBattler] = gBattlerTarget;
|
gTakenDmgByBattler[gActiveBattler] = gBattlerTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gBattleMons[gActiveBattler].hp > gBattleMoveDamage)
|
if (gBattleMons[gActiveBattler].hp > gBattleMoveDamage)
|
||||||
@ -2026,37 +2026,37 @@ static void atk0C_datahpupdate(void)
|
|||||||
gBattleMons[gActiveBattler].hp = 0;
|
gBattleMons[gActiveBattler].hp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gSpecialStatuses[gActiveBattler].moveturnLostHP && !(gHitMarker & HITMARKER_x100000))
|
if (!gSpecialStatuses[gActiveBattler].dmg && !(gHitMarker & HITMARKER_x100000))
|
||||||
gSpecialStatuses[gActiveBattler].moveturnLostHP = gHpDealt;
|
gSpecialStatuses[gActiveBattler].dmg = gHpDealt;
|
||||||
|
|
||||||
if (moveType <= 8 && !(gHitMarker & HITMARKER_x100000) && gCurrentMove != MOVE_PAIN_SPLIT)
|
if (moveType <= 8 && !(gHitMarker & HITMARKER_x100000) && gCurrentMove != MOVE_PAIN_SPLIT)
|
||||||
{
|
{
|
||||||
gProtectStructs[gActiveBattler].physicalDmg = gHpDealt;
|
gProtectStructs[gActiveBattler].physicalDmg = gHpDealt;
|
||||||
gSpecialStatuses[gActiveBattler].moveturnLostHP_physical = gHpDealt;
|
gSpecialStatuses[gActiveBattler].physicalDmg = gHpDealt;
|
||||||
if (gBattlescriptCurrInstr[1] == BS_GET_TARGET)
|
if (gBattlescriptCurrInstr[1] == BS_GET_TARGET)
|
||||||
{
|
{
|
||||||
gProtectStructs[gActiveBattler].physicalBank = gBattlerAttacker;
|
gProtectStructs[gActiveBattler].physicalBattlerId = gBattlerAttacker;
|
||||||
gSpecialStatuses[gActiveBattler].moveturnPhysicalBank = gBattlerAttacker;
|
gSpecialStatuses[gActiveBattler].physicalBattlerId = gBattlerAttacker;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gProtectStructs[gActiveBattler].physicalBank = gBattlerTarget;
|
gProtectStructs[gActiveBattler].physicalBattlerId = gBattlerTarget;
|
||||||
gSpecialStatuses[gActiveBattler].moveturnPhysicalBank = gBattlerTarget;
|
gSpecialStatuses[gActiveBattler].physicalBattlerId = gBattlerTarget;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (moveType > 8 && !(gHitMarker & HITMARKER_x100000))
|
else if (moveType > 8 && !(gHitMarker & HITMARKER_x100000))
|
||||||
{
|
{
|
||||||
gProtectStructs[gActiveBattler].specialDmg = gHpDealt;
|
gProtectStructs[gActiveBattler].specialDmg = gHpDealt;
|
||||||
gSpecialStatuses[gActiveBattler].moveturnLostHP_special = gHpDealt;
|
gSpecialStatuses[gActiveBattler].specialDmg = gHpDealt;
|
||||||
if (gBattlescriptCurrInstr[1] == BS_GET_TARGET)
|
if (gBattlescriptCurrInstr[1] == BS_GET_TARGET)
|
||||||
{
|
{
|
||||||
gProtectStructs[gActiveBattler].specialBank = gBattlerAttacker;
|
gProtectStructs[gActiveBattler].specialBattlerId = gBattlerAttacker;
|
||||||
gSpecialStatuses[gActiveBattler].moveturnSpecialBank = gBattlerAttacker;
|
gSpecialStatuses[gActiveBattler].specialBattlerId = gBattlerAttacker;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gProtectStructs[gActiveBattler].specialBank = gBattlerTarget;
|
gProtectStructs[gActiveBattler].specialBattlerId = gBattlerTarget;
|
||||||
gSpecialStatuses[gActiveBattler].moveturnSpecialBank = gBattlerTarget;
|
gSpecialStatuses[gActiveBattler].specialBattlerId = gBattlerTarget;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2068,8 +2068,8 @@ static void atk0C_datahpupdate(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
gActiveBattler = GetBattleBank(gBattlescriptCurrInstr[1]);
|
gActiveBattler = GetBattleBank(gBattlescriptCurrInstr[1]);
|
||||||
if (gSpecialStatuses[gActiveBattler].moveturnLostHP == 0)
|
if (gSpecialStatuses[gActiveBattler].dmg == 0)
|
||||||
gSpecialStatuses[gActiveBattler].moveturnLostHP = 0xFFFF;
|
gSpecialStatuses[gActiveBattler].dmg = 0xFFFF;
|
||||||
}
|
}
|
||||||
gBattlescriptCurrInstr += 2;
|
gBattlescriptCurrInstr += 2;
|
||||||
}
|
}
|
||||||
@ -3424,14 +3424,14 @@ static void atk23_getexp(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gBattleScripting.atk23_state++;
|
gBattleScripting.atk23_state++;
|
||||||
gBattleStruct->expGetterId = 0;
|
gBattleStruct->expGetterMonId = 0;
|
||||||
gBattleStruct->sentInPokes = sentIn;
|
gBattleStruct->sentInPokes = sentIn;
|
||||||
}
|
}
|
||||||
// fall through
|
// fall through
|
||||||
case 2: // set exp value to the poke in expgetter_id and print message
|
case 2: // set exp value to the poke in expgetter_id and print message
|
||||||
if (gBattleControllerExecFlags == 0)
|
if (gBattleControllerExecFlags == 0)
|
||||||
{
|
{
|
||||||
item = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_HELD_ITEM);
|
item = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HELD_ITEM);
|
||||||
|
|
||||||
if (item == ITEM_ENIGMA_BERRY)
|
if (item == ITEM_ENIGMA_BERRY)
|
||||||
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
|
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
|
||||||
@ -3444,7 +3444,7 @@ static void atk23_getexp(void)
|
|||||||
gBattleScripting.atk23_state = 5;
|
gBattleScripting.atk23_state = 5;
|
||||||
gBattleMoveDamage = 0; // used for exp
|
gBattleMoveDamage = 0; // used for exp
|
||||||
}
|
}
|
||||||
else if (GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_LEVEL) == MAX_MON_LEVEL)
|
else if (GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL) == MAX_MON_LEVEL)
|
||||||
{
|
{
|
||||||
*(&gBattleStruct->sentInPokes) >>= 1;
|
*(&gBattleStruct->sentInPokes) >>= 1;
|
||||||
gBattleScripting.atk23_state = 5;
|
gBattleScripting.atk23_state = 5;
|
||||||
@ -3460,7 +3460,7 @@ static void atk23_getexp(void)
|
|||||||
gBattleStruct->wildVictorySong++;
|
gBattleStruct->wildVictorySong++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_HP))
|
if (GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HP))
|
||||||
{
|
{
|
||||||
if (gBattleStruct->sentInPokes & 1)
|
if (gBattleStruct->sentInPokes & 1)
|
||||||
gBattleMoveDamage = *exp;
|
gBattleMoveDamage = *exp;
|
||||||
@ -3474,10 +3474,10 @@ static void atk23_getexp(void)
|
|||||||
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
|
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
|
||||||
gBattleMoveDamage = (gBattleMoveDamage * 150) / 100;
|
gBattleMoveDamage = (gBattleMoveDamage * 150) / 100;
|
||||||
|
|
||||||
if (IsTradedMon(&gPlayerParty[gBattleStruct->expGetterId]))
|
if (IsTradedMon(&gPlayerParty[gBattleStruct->expGetterMonId]))
|
||||||
{
|
{
|
||||||
// check if the pokemon doesn't belong to the player
|
// check if the pokemon doesn't belong to the player
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gBattleStruct->expGetterId >= 3)
|
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gBattleStruct->expGetterMonId >= 3)
|
||||||
{
|
{
|
||||||
i = 0x149;
|
i = 0x149;
|
||||||
}
|
}
|
||||||
@ -3495,28 +3495,28 @@ static void atk23_getexp(void)
|
|||||||
// get exp getter bank
|
// get exp getter bank
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||||
{
|
{
|
||||||
if (!(gBattlerPartyIndexes[2] != gBattleStruct->expGetterId) && !(gAbsentBattlerFlags & gBitTable[2]))
|
if (!(gBattlerPartyIndexes[2] != gBattleStruct->expGetterMonId) && !(gAbsentBattlerFlags & gBitTable[2]))
|
||||||
gBattleStruct->expGetterBank = 2;
|
gBattleStruct->expGetterBattlerId = 2;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!(gAbsentBattlerFlags & gBitTable[0]))
|
if (!(gAbsentBattlerFlags & gBitTable[0]))
|
||||||
gBattleStruct->expGetterBank = 0;
|
gBattleStruct->expGetterBattlerId = 0;
|
||||||
else
|
else
|
||||||
gBattleStruct->expGetterBank = 2;
|
gBattleStruct->expGetterBattlerId = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gBattleStruct->expGetterBank = 0;
|
gBattleStruct->expGetterBattlerId = 0;
|
||||||
|
|
||||||
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattleStruct->expGetterBank, gBattleStruct->expGetterId)
|
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattleStruct->expGetterBattlerId, gBattleStruct->expGetterMonId)
|
||||||
|
|
||||||
// buffer 'gained' or 'gained a boosted'
|
// buffer 'gained' or 'gained a boosted'
|
||||||
PREPARE_STRING_BUFFER(gBattleTextBuff2, i)
|
PREPARE_STRING_BUFFER(gBattleTextBuff2, i)
|
||||||
|
|
||||||
PREPARE_WORD_NUMBER_BUFFER(gBattleTextBuff3, 5, gBattleMoveDamage)
|
PREPARE_WORD_NUMBER_BUFFER(gBattleTextBuff3, 5, gBattleMoveDamage)
|
||||||
|
|
||||||
PrepareStringBattle(STRINGID_PKMNGAINEDEXP, gBattleStruct->expGetterBank);
|
PrepareStringBattle(STRINGID_PKMNGAINEDEXP, gBattleStruct->expGetterBattlerId);
|
||||||
MonGainEVs(&gPlayerParty[gBattleStruct->expGetterId], gBattleMons[gBank1].species);
|
MonGainEVs(&gPlayerParty[gBattleStruct->expGetterMonId], gBattleMons[gBank1].species);
|
||||||
}
|
}
|
||||||
gBattleStruct->sentInPokes >>= 1;
|
gBattleStruct->sentInPokes >>= 1;
|
||||||
gBattleScripting.atk23_state++;
|
gBattleScripting.atk23_state++;
|
||||||
@ -3526,18 +3526,18 @@ static void atk23_getexp(void)
|
|||||||
case 3: // Set stats and give exp
|
case 3: // Set stats and give exp
|
||||||
if (gBattleControllerExecFlags == 0)
|
if (gBattleControllerExecFlags == 0)
|
||||||
{
|
{
|
||||||
gBattleBufferB[gBattleStruct->expGetterBank][0] = 0;
|
gBattleBufferB[gBattleStruct->expGetterBattlerId][0] = 0;
|
||||||
if (GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_HP) && GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_LEVEL) != MAX_MON_LEVEL)
|
if (GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HP) && GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL) != MAX_MON_LEVEL)
|
||||||
{
|
{
|
||||||
gBattleResources->statsBeforeLvlUp->hp = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_MAX_HP);
|
gBattleResources->statsBeforeLvlUp->hp = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_MAX_HP);
|
||||||
gBattleResources->statsBeforeLvlUp->atk = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_ATK);
|
gBattleResources->statsBeforeLvlUp->atk = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_ATK);
|
||||||
gBattleResources->statsBeforeLvlUp->def = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_DEF);
|
gBattleResources->statsBeforeLvlUp->def = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_DEF);
|
||||||
gBattleResources->statsBeforeLvlUp->spd = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPEED);
|
gBattleResources->statsBeforeLvlUp->spd = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPEED);
|
||||||
gBattleResources->statsBeforeLvlUp->spAtk = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPATK);
|
gBattleResources->statsBeforeLvlUp->spAtk = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPATK);
|
||||||
gBattleResources->statsBeforeLvlUp->spDef = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPDEF);
|
gBattleResources->statsBeforeLvlUp->spDef = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPDEF);
|
||||||
|
|
||||||
gActiveBattler = gBattleStruct->expGetterBank;
|
gActiveBattler = gBattleStruct->expGetterBattlerId;
|
||||||
BtlController_EmitExpUpdate(0, gBattleStruct->expGetterId, gBattleMoveDamage);
|
BtlController_EmitExpUpdate(0, gBattleStruct->expGetterMonId, gBattleMoveDamage);
|
||||||
MarkBattlerForControllerExec(gActiveBattler);
|
MarkBattlerForControllerExec(gActiveBattler);
|
||||||
}
|
}
|
||||||
gBattleScripting.atk23_state++;
|
gBattleScripting.atk23_state++;
|
||||||
@ -3546,50 +3546,50 @@ static void atk23_getexp(void)
|
|||||||
case 4: // lvl up if necessary
|
case 4: // lvl up if necessary
|
||||||
if (gBattleControllerExecFlags == 0)
|
if (gBattleControllerExecFlags == 0)
|
||||||
{
|
{
|
||||||
gActiveBattler = gBattleStruct->expGetterBank;
|
gActiveBattler = gBattleStruct->expGetterBattlerId;
|
||||||
if (gBattleBufferB[gActiveBattler][0] == CONTROLLER_TWORETURNVALUES && gBattleBufferB[gActiveBattler][1] == RET_VALUE_LEVELLED_UP)
|
if (gBattleBufferB[gActiveBattler][0] == CONTROLLER_TWORETURNVALUES && gBattleBufferB[gActiveBattler][1] == RET_VALUE_LEVELLED_UP)
|
||||||
{
|
{
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterId)
|
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterMonId)
|
||||||
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||||
|
|
||||||
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gActiveBattler, gBattleStruct->expGetterId)
|
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gActiveBattler, gBattleStruct->expGetterMonId)
|
||||||
|
|
||||||
PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff2, 3, GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_LEVEL))
|
PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff2, 3, GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL))
|
||||||
|
|
||||||
BattleScriptPushCursor();
|
BattleScriptPushCursor();
|
||||||
gLeveledUpInBattle |= gBitTable[gBattleStruct->expGetterId];
|
gLeveledUpInBattle |= gBitTable[gBattleStruct->expGetterMonId];
|
||||||
gBattlescriptCurrInstr = BattleScript_LevelUp;
|
gBattlescriptCurrInstr = BattleScript_LevelUp;
|
||||||
gBattleMoveDamage = (gBattleBufferB[gActiveBattler][2] | (gBattleBufferB[gActiveBattler][3] << 8));
|
gBattleMoveDamage = (gBattleBufferB[gActiveBattler][2] | (gBattleBufferB[gActiveBattler][3] << 8));
|
||||||
AdjustFriendship(&gPlayerParty[gBattleStruct->expGetterId], 0);
|
AdjustFriendship(&gPlayerParty[gBattleStruct->expGetterMonId], 0);
|
||||||
|
|
||||||
// update battle mon structure after level up
|
// update battle mon structure after level up
|
||||||
if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterId && gBattleMons[0].hp)
|
if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterMonId && gBattleMons[0].hp)
|
||||||
{
|
{
|
||||||
gBattleMons[0].level = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_LEVEL);
|
gBattleMons[0].level = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL);
|
||||||
gBattleMons[0].hp = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_HP);
|
gBattleMons[0].hp = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HP);
|
||||||
gBattleMons[0].maxHP = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_MAX_HP);
|
gBattleMons[0].maxHP = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_MAX_HP);
|
||||||
gBattleMons[0].attack = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_ATK);
|
gBattleMons[0].attack = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_ATK);
|
||||||
gBattleMons[0].defense = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_DEF);
|
gBattleMons[0].defense = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_DEF);
|
||||||
// Why is this duplicated?
|
// Why is this duplicated?
|
||||||
gBattleMons[0].speed = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPEED);
|
gBattleMons[0].speed = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPEED);
|
||||||
gBattleMons[0].speed = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPEED);
|
gBattleMons[0].speed = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPEED);
|
||||||
|
|
||||||
gBattleMons[0].spAttack = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPATK);
|
gBattleMons[0].spAttack = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPATK);
|
||||||
gBattleMons[0].spDefense = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPDEF);
|
gBattleMons[0].spDefense = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPDEF);
|
||||||
}
|
}
|
||||||
// What is else if?
|
// What is else if?
|
||||||
if (gBattlerPartyIndexes[2] == gBattleStruct->expGetterId && gBattleMons[2].hp && (gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
|
if (gBattlerPartyIndexes[2] == gBattleStruct->expGetterMonId && gBattleMons[2].hp && (gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
|
||||||
{
|
{
|
||||||
gBattleMons[2].level = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_LEVEL);
|
gBattleMons[2].level = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL);
|
||||||
gBattleMons[2].hp = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_HP);
|
gBattleMons[2].hp = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HP);
|
||||||
gBattleMons[2].maxHP = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_MAX_HP);
|
gBattleMons[2].maxHP = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_MAX_HP);
|
||||||
gBattleMons[2].attack = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_ATK);
|
gBattleMons[2].attack = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_ATK);
|
||||||
gBattleMons[2].defense = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_DEF);
|
gBattleMons[2].defense = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_DEF);
|
||||||
// Duplicated again, but this time there's no Sp Defense
|
// Duplicated again, but this time there's no Sp Defense
|
||||||
gBattleMons[2].speed = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPEED);
|
gBattleMons[2].speed = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPEED);
|
||||||
gBattleMons[2].speed = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPEED);
|
gBattleMons[2].speed = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPEED);
|
||||||
|
|
||||||
gBattleMons[2].spAttack = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPATK);
|
gBattleMons[2].spAttack = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPATK);
|
||||||
}
|
}
|
||||||
gBattleScripting.atk23_state = 5;
|
gBattleScripting.atk23_state = 5;
|
||||||
}
|
}
|
||||||
@ -3605,8 +3605,8 @@ static void atk23_getexp(void)
|
|||||||
gBattleScripting.atk23_state = 3;
|
gBattleScripting.atk23_state = 3;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gBattleStruct->expGetterId++;
|
gBattleStruct->expGetterMonId++;
|
||||||
if (gBattleStruct->expGetterId <= 5)
|
if (gBattleStruct->expGetterMonId <= 5)
|
||||||
gBattleScripting.atk23_state = 2; // loop again
|
gBattleScripting.atk23_state = 2; // loop again
|
||||||
else
|
else
|
||||||
gBattleScripting.atk23_state = 6; // we're done
|
gBattleScripting.atk23_state = 6; // we're done
|
||||||
@ -4894,7 +4894,7 @@ static void atk49_moveend(void)
|
|||||||
case 1: // defrosting check
|
case 1: // defrosting check
|
||||||
if (gBattleMons[gBattlerTarget].status1 & STATUS1_FREEZE
|
if (gBattleMons[gBattlerTarget].status1 & STATUS1_FREEZE
|
||||||
&& gBattleMons[gBattlerTarget].hp != 0 && gBattlerAttacker != gBattlerTarget
|
&& gBattleMons[gBattlerTarget].hp != 0 && gBattlerAttacker != gBattlerTarget
|
||||||
&& gSpecialStatuses[gBattlerTarget].moveturnLostHP_special
|
&& gSpecialStatuses[gBattlerTarget].specialDmg
|
||||||
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && moveType == TYPE_FIRE)
|
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && moveType == TYPE_FIRE)
|
||||||
{
|
{
|
||||||
gBattleMons[gBattlerTarget].status1 &= ~(STATUS1_FREEZE);
|
gBattleMons[gBattlerTarget].status1 &= ~(STATUS1_FREEZE);
|
||||||
@ -5991,9 +5991,9 @@ static void atk59_handlelearnnewmove(void)
|
|||||||
const u8 *jumpPtr1 = BSScriptReadPtr(gBattlescriptCurrInstr + 1);
|
const u8 *jumpPtr1 = BSScriptReadPtr(gBattlescriptCurrInstr + 1);
|
||||||
const u8 *jumpPtr2 = BSScriptReadPtr(gBattlescriptCurrInstr + 5);
|
const u8 *jumpPtr2 = BSScriptReadPtr(gBattlescriptCurrInstr + 5);
|
||||||
|
|
||||||
u16 ret = MonTryLearningNewMove(&gPlayerParty[gBattleStruct->expGetterId], gBattlescriptCurrInstr[9]);
|
u16 ret = MonTryLearningNewMove(&gPlayerParty[gBattleStruct->expGetterMonId], gBattlescriptCurrInstr[9]);
|
||||||
while (ret == 0xFFFE)
|
while (ret == 0xFFFE)
|
||||||
ret = MonTryLearningNewMove(&gPlayerParty[gBattleStruct->expGetterId], 0);
|
ret = MonTryLearningNewMove(&gPlayerParty[gBattleStruct->expGetterMonId], 0);
|
||||||
|
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
{
|
{
|
||||||
@ -6007,7 +6007,7 @@ static void atk59_handlelearnnewmove(void)
|
|||||||
{
|
{
|
||||||
gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
|
gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
|
||||||
|
|
||||||
if (gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterId
|
if (gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterMonId
|
||||||
&& !(gBattleMons[gActiveBattler].status2 & STATUS2_TRANSFORMED))
|
&& !(gBattleMons[gActiveBattler].status2 & STATUS2_TRANSFORMED))
|
||||||
{
|
{
|
||||||
GiveMoveToBattleMon(&gBattleMons[gActiveBattler], ret);
|
GiveMoveToBattleMon(&gBattleMons[gActiveBattler], ret);
|
||||||
@ -6015,7 +6015,7 @@ static void atk59_handlelearnnewmove(void)
|
|||||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||||
{
|
{
|
||||||
gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
|
gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
|
||||||
if (gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterId
|
if (gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterMonId
|
||||||
&& !(gBattleMons[gActiveBattler].status2 & STATUS2_TRANSFORMED))
|
&& !(gBattleMons[gActiveBattler].status2 & STATUS2_TRANSFORMED))
|
||||||
{
|
{
|
||||||
GiveMoveToBattleMon(&gBattleMons[gActiveBattler], ret);
|
GiveMoveToBattleMon(&gBattleMons[gActiveBattler], ret);
|
||||||
@ -6078,7 +6078,7 @@ static void atk5A_yesnoboxlearnmove(void)
|
|||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
{
|
||||||
FreeAllWindowBuffers();
|
FreeAllWindowBuffers();
|
||||||
sub_81BFA38(gPlayerParty, gBattleStruct->expGetterId, gPlayerPartyCount - 1, ReshowBattleScreenAfterMenu, gMoveToLearn);
|
sub_81BFA38(gPlayerParty, gBattleStruct->expGetterMonId, gPlayerPartyCount - 1, ReshowBattleScreenAfterMenu, gMoveToLearn);
|
||||||
gBattleScripting.learnMoveState++;
|
gBattleScripting.learnMoveState++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -6098,7 +6098,7 @@ static void atk5A_yesnoboxlearnmove(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
u16 moveId = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_MOVE1 + movePosition);
|
u16 moveId = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_MOVE1 + movePosition);
|
||||||
if (IsHMMove2(moveId))
|
if (IsHMMove2(moveId))
|
||||||
{
|
{
|
||||||
PrepareStringBattle(STRINGID_HMMOVESCANTBEFORGOTTEN, gActiveBattler);
|
PrepareStringBattle(STRINGID_HMMOVESCANTBEFORGOTTEN, gActiveBattler);
|
||||||
@ -6110,10 +6110,10 @@ static void atk5A_yesnoboxlearnmove(void)
|
|||||||
|
|
||||||
PREPARE_MOVE_BUFFER(gBattleTextBuff2, moveId)
|
PREPARE_MOVE_BUFFER(gBattleTextBuff2, moveId)
|
||||||
|
|
||||||
RemoveMonPPBonus(&gPlayerParty[gBattleStruct->expGetterId], movePosition);
|
RemoveMonPPBonus(&gPlayerParty[gBattleStruct->expGetterMonId], movePosition);
|
||||||
SetMonMoveSlot(&gPlayerParty[gBattleStruct->expGetterId], gMoveToLearn, movePosition);
|
SetMonMoveSlot(&gPlayerParty[gBattleStruct->expGetterMonId], gMoveToLearn, movePosition);
|
||||||
|
|
||||||
if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterId
|
if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterMonId
|
||||||
&& !(gBattleMons[0].status2 & STATUS2_TRANSFORMED)
|
&& !(gBattleMons[0].status2 & STATUS2_TRANSFORMED)
|
||||||
&& !(gDisableStructs[0].unk18_b & gBitTable[movePosition]))
|
&& !(gDisableStructs[0].unk18_b & gBitTable[movePosition]))
|
||||||
{
|
{
|
||||||
@ -6121,7 +6121,7 @@ static void atk5A_yesnoboxlearnmove(void)
|
|||||||
SetBattleMonMoveSlot(&gBattleMons[0], gMoveToLearn, movePosition);
|
SetBattleMonMoveSlot(&gBattleMons[0], gMoveToLearn, movePosition);
|
||||||
}
|
}
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE
|
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE
|
||||||
&& gBattlerPartyIndexes[2] == gBattleStruct->expGetterId
|
&& gBattlerPartyIndexes[2] == gBattleStruct->expGetterMonId
|
||||||
&& !(gBattleMons[2].status2 & STATUS2_TRANSFORMED)
|
&& !(gBattleMons[2].status2 & STATUS2_TRANSFORMED)
|
||||||
&& !(gDisableStructs[2].unk18_b & gBitTable[movePosition]))
|
&& !(gDisableStructs[2].unk18_b & gBitTable[movePosition]))
|
||||||
{
|
{
|
||||||
@ -6659,7 +6659,7 @@ static void sub_804F100(void)
|
|||||||
{
|
{
|
||||||
struct StatsArray currentStats;
|
struct StatsArray currentStats;
|
||||||
|
|
||||||
sub_81D388C(&gPlayerParty[gBattleStruct->expGetterId], ¤tStats);
|
sub_81D388C(&gPlayerParty[gBattleStruct->expGetterMonId], ¤tStats);
|
||||||
sub_81D3640(0xD, gBattleResources->statsBeforeLvlUp, ¤tStats, 0xE, 0xD, 0xF);
|
sub_81D3640(0xD, gBattleResources->statsBeforeLvlUp, ¤tStats, 0xE, 0xD, 0xF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6667,7 +6667,7 @@ static void sub_804F144(void)
|
|||||||
{
|
{
|
||||||
struct StatsArray currentStats;
|
struct StatsArray currentStats;
|
||||||
|
|
||||||
sub_81D388C(&gPlayerParty[gBattleStruct->expGetterId], ¤tStats);
|
sub_81D388C(&gPlayerParty[gBattleStruct->expGetterMonId], ¤tStats);
|
||||||
sub_81D3784(0xD, ¤tStats, 0xE, 0xD, 0xF);
|
sub_81D3784(0xD, ¤tStats, 0xE, 0xD, 0xF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6710,9 +6710,9 @@ static void PutLevelAndGenderOnLvlUpBox(void)
|
|||||||
u8 *txtPtr;
|
u8 *txtPtr;
|
||||||
u32 var;
|
u32 var;
|
||||||
|
|
||||||
monLevel = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_LEVEL);
|
monLevel = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL);
|
||||||
monGender = GetMonGender(&gPlayerParty[gBattleStruct->expGetterId]);
|
monGender = GetMonGender(&gPlayerParty[gBattleStruct->expGetterMonId]);
|
||||||
GetMonNickname(&gPlayerParty[gBattleStruct->expGetterId], gStringVar4);
|
GetMonNickname(&gPlayerParty[gBattleStruct->expGetterMonId], gStringVar4);
|
||||||
|
|
||||||
subPrinter.current_text_offset = gStringVar4;
|
subPrinter.current_text_offset = gStringVar4;
|
||||||
subPrinter.windowId = 14;
|
subPrinter.windowId = 14;
|
||||||
@ -6788,8 +6788,8 @@ static void PutMonIconOnLvlUpBox(void)
|
|||||||
struct SpriteSheet iconSheet;
|
struct SpriteSheet iconSheet;
|
||||||
struct SpritePalette iconPalSheet;
|
struct SpritePalette iconPalSheet;
|
||||||
|
|
||||||
u16 species = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPECIES);
|
u16 species = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPECIES);
|
||||||
u32 personality = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_PERSONALITY);
|
u32 personality = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_PERSONALITY);
|
||||||
|
|
||||||
const u8* iconPtr = GetMonIconPtr(species, personality, 1);
|
const u8* iconPtr = GetMonIconPtr(species, personality, 1);
|
||||||
iconSheet.data = iconPtr;
|
iconSheet.data = iconPtr;
|
||||||
@ -6829,9 +6829,9 @@ static void SpriteCB_MonIconOnLvlUpBox(struct Sprite* sprite)
|
|||||||
|
|
||||||
static bool32 IsMonGettingExpSentOut(void)
|
static bool32 IsMonGettingExpSentOut(void)
|
||||||
{
|
{
|
||||||
if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterId)
|
if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterMonId)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && gBattlerPartyIndexes[2] == gBattleStruct->expGetterId)
|
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && gBattlerPartyIndexes[2] == gBattleStruct->expGetterMonId)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -6939,7 +6939,7 @@ static void atk74_hpthresholds2(void)
|
|||||||
|
|
||||||
static void atk75_useitemonopponent(void)
|
static void atk75_useitemonopponent(void)
|
||||||
{
|
{
|
||||||
gBankInMenu = gBattlerAttacker;
|
gBattlerInMenuId = gBattlerAttacker;
|
||||||
ExecuteTableBasedItemEffect(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker]], gLastUsedItem, gBattlerPartyIndexes[gBattlerAttacker], 0, 1);
|
ExecuteTableBasedItemEffect(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker]], gLastUsedItem, gBattlerPartyIndexes[gBattlerAttacker], 0, 1);
|
||||||
|
|
||||||
gBattlescriptCurrInstr += 1;
|
gBattlescriptCurrInstr += 1;
|
||||||
@ -6982,11 +6982,11 @@ static void atk76_various(void)
|
|||||||
gSpecialStatuses[gActiveBattler].traced = 0;
|
gSpecialStatuses[gActiveBattler].traced = 0;
|
||||||
break;
|
break;
|
||||||
case VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP:
|
case VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP:
|
||||||
if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterId || gBattlerPartyIndexes[2] == gBattleStruct->expGetterId)
|
if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterMonId || gBattlerPartyIndexes[2] == gBattleStruct->expGetterMonId)
|
||||||
{
|
{
|
||||||
u16 *choicedMove;
|
u16 *choicedMove;
|
||||||
|
|
||||||
if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterId)
|
if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterMonId)
|
||||||
gActiveBattler = 0;
|
gActiveBattler = 0;
|
||||||
else
|
else
|
||||||
gActiveBattler = 2;
|
gActiveBattler = 2;
|
||||||
@ -7327,7 +7327,7 @@ static void atk7E_setreflect(void)
|
|||||||
{
|
{
|
||||||
gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_REFLECT;
|
gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_REFLECT;
|
||||||
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].reflectTimer = 5;
|
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].reflectTimer = 5;
|
||||||
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].reflectBank = gBattlerAttacker;
|
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].reflectBattlerId = gBattlerAttacker;
|
||||||
|
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_ATK_SIDE) == 2)
|
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_ATK_SIDE) == 2)
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
|
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
|
||||||
@ -8061,7 +8061,7 @@ static void atk92_setlightscreen(void)
|
|||||||
{
|
{
|
||||||
gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_LIGHTSCREEN;
|
gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_LIGHTSCREEN;
|
||||||
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].lightscreenTimer = 5;
|
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].lightscreenTimer = 5;
|
||||||
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].lightscreenBank = gBattlerAttacker;
|
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].lightscreenBattlerId = gBattlerAttacker;
|
||||||
|
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_ATK_SIDE) == 2)
|
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_ATK_SIDE) == 2)
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 4;
|
gBattleCommunication[MULTISTRING_CHOOSER] = 4;
|
||||||
@ -8324,7 +8324,7 @@ static void atk99_setmist(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].mistTimer = 5;
|
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].mistTimer = 5;
|
||||||
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].mistBank = gBattlerAttacker;
|
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].mistBattlerId = gBattlerAttacker;
|
||||||
gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_MIST;
|
gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_MIST;
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||||
}
|
}
|
||||||
@ -8520,18 +8520,18 @@ static void atkA0_psywavedamageeffect(void)
|
|||||||
static void atkA1_counterdamagecalculator(void)
|
static void atkA1_counterdamagecalculator(void)
|
||||||
{
|
{
|
||||||
u8 sideAttacker = GetBattlerSide(gBattlerAttacker);
|
u8 sideAttacker = GetBattlerSide(gBattlerAttacker);
|
||||||
u8 sideTarget = GetBattlerSide(gProtectStructs[gBattlerAttacker].physicalBank);
|
u8 sideTarget = GetBattlerSide(gProtectStructs[gBattlerAttacker].physicalBattlerId);
|
||||||
|
|
||||||
if (gProtectStructs[gBattlerAttacker].physicalDmg
|
if (gProtectStructs[gBattlerAttacker].physicalDmg
|
||||||
&& sideAttacker != sideTarget
|
&& sideAttacker != sideTarget
|
||||||
&& gBattleMons[gProtectStructs[gBattlerAttacker].physicalBank].hp)
|
&& gBattleMons[gProtectStructs[gBattlerAttacker].physicalBattlerId].hp)
|
||||||
{
|
{
|
||||||
gBattleMoveDamage = gProtectStructs[gBattlerAttacker].physicalDmg * 2;
|
gBattleMoveDamage = gProtectStructs[gBattlerAttacker].physicalDmg * 2;
|
||||||
|
|
||||||
if (gSideTimers[sideTarget].followmeTimer && gBattleMons[gSideTimers[sideTarget].followmeTarget].hp)
|
if (gSideTimers[sideTarget].followmeTimer && gBattleMons[gSideTimers[sideTarget].followmeTarget].hp)
|
||||||
gBattlerTarget = gSideTimers[sideTarget].followmeTarget;
|
gBattlerTarget = gSideTimers[sideTarget].followmeTarget;
|
||||||
else
|
else
|
||||||
gBattlerTarget = gProtectStructs[gBattlerAttacker].physicalBank;
|
gBattlerTarget = gProtectStructs[gBattlerAttacker].physicalBattlerId;
|
||||||
|
|
||||||
gBattlescriptCurrInstr += 5;
|
gBattlescriptCurrInstr += 5;
|
||||||
}
|
}
|
||||||
@ -8545,16 +8545,16 @@ static void atkA1_counterdamagecalculator(void)
|
|||||||
static void atkA2_mirrorcoatdamagecalculator(void) // a copy of atkA1 with the physical -> special field changes
|
static void atkA2_mirrorcoatdamagecalculator(void) // a copy of atkA1 with the physical -> special field changes
|
||||||
{
|
{
|
||||||
u8 sideAttacker = GetBattlerSide(gBattlerAttacker);
|
u8 sideAttacker = GetBattlerSide(gBattlerAttacker);
|
||||||
u8 sideTarget = GetBattlerSide(gProtectStructs[gBattlerAttacker].specialBank);
|
u8 sideTarget = GetBattlerSide(gProtectStructs[gBattlerAttacker].specialBattlerId);
|
||||||
|
|
||||||
if (gProtectStructs[gBattlerAttacker].specialDmg && sideAttacker != sideTarget && gBattleMons[gProtectStructs[gBattlerAttacker].specialBank].hp)
|
if (gProtectStructs[gBattlerAttacker].specialDmg && sideAttacker != sideTarget && gBattleMons[gProtectStructs[gBattlerAttacker].specialBattlerId].hp)
|
||||||
{
|
{
|
||||||
gBattleMoveDamage = gProtectStructs[gBattlerAttacker].specialDmg * 2;
|
gBattleMoveDamage = gProtectStructs[gBattlerAttacker].specialDmg * 2;
|
||||||
|
|
||||||
if (gSideTimers[sideTarget].followmeTimer && gBattleMons[gSideTimers[sideTarget].followmeTarget].hp)
|
if (gSideTimers[sideTarget].followmeTimer && gBattleMons[gSideTimers[sideTarget].followmeTarget].hp)
|
||||||
gBattlerTarget = gSideTimers[sideTarget].followmeTarget;
|
gBattlerTarget = gSideTimers[sideTarget].followmeTarget;
|
||||||
else
|
else
|
||||||
gBattlerTarget = gProtectStructs[gBattlerAttacker].specialBank;
|
gBattlerTarget = gProtectStructs[gBattlerAttacker].specialBattlerId;
|
||||||
|
|
||||||
gBattlescriptCurrInstr += 5;
|
gBattlescriptCurrInstr += 5;
|
||||||
}
|
}
|
||||||
@ -8636,7 +8636,7 @@ static void atkA5_painsplitdmgcalc(void)
|
|||||||
storeLoc[3] = (painSplitHp & 0xFF000000) >> 24;
|
storeLoc[3] = (painSplitHp & 0xFF000000) >> 24;
|
||||||
|
|
||||||
gBattleMoveDamage = gBattleMons[gBattlerAttacker].hp - hpDiff;
|
gBattleMoveDamage = gBattleMons[gBattlerAttacker].hp - hpDiff;
|
||||||
gSpecialStatuses[gBattlerTarget].moveturnLostHP = 0xFFFF;
|
gSpecialStatuses[gBattlerTarget].dmg = 0xFFFF;
|
||||||
|
|
||||||
gBattlescriptCurrInstr += 5;
|
gBattlescriptCurrInstr += 5;
|
||||||
}
|
}
|
||||||
@ -9224,7 +9224,7 @@ static void atkB8_setsafeguard(void)
|
|||||||
{
|
{
|
||||||
gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_SAFEGUARD;
|
gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_SAFEGUARD;
|
||||||
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].safeguardTimer = 5;
|
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].safeguardTimer = 5;
|
||||||
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].safeguardBank = gBattlerAttacker;
|
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].safeguardBattlerId = gBattlerAttacker;
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 5;
|
gBattleCommunication[MULTISTRING_CHOOSER] = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9995,7 +9995,7 @@ static void atkD4_trywish(void)
|
|||||||
if (gWishFutureKnock.wishCounter[gBattlerAttacker] == 0)
|
if (gWishFutureKnock.wishCounter[gBattlerAttacker] == 0)
|
||||||
{
|
{
|
||||||
gWishFutureKnock.wishCounter[gBattlerAttacker] = 2;
|
gWishFutureKnock.wishCounter[gBattlerAttacker] = 2;
|
||||||
gWishFutureKnock.wishUserID[gBattlerAttacker] = gBattlerPartyIndexes[gBattlerAttacker];
|
gWishFutureKnock.wishMonId[gBattlerAttacker] = gBattlerPartyIndexes[gBattlerAttacker];
|
||||||
gBattlescriptCurrInstr += 6;
|
gBattlescriptCurrInstr += 6;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -10004,7 +10004,7 @@ static void atkD4_trywish(void)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1: // heal effect
|
case 1: // heal effect
|
||||||
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattlerTarget, gWishFutureKnock.wishUserID[gBattlerTarget])
|
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattlerTarget, gWishFutureKnock.wishMonId[gBattlerTarget])
|
||||||
|
|
||||||
gBattleMoveDamage = gBattleMons[gBattlerTarget].maxHP / 2;
|
gBattleMoveDamage = gBattleMons[gBattlerTarget].maxHP / 2;
|
||||||
if (gBattleMoveDamage == 0)
|
if (gBattleMoveDamage == 0)
|
||||||
@ -10036,9 +10036,9 @@ static void atkD5_trysetroots(void) // ingrain
|
|||||||
static void atkD6_doubledamagedealtifdamaged(void)
|
static void atkD6_doubledamagedealtifdamaged(void)
|
||||||
{
|
{
|
||||||
if ((gProtectStructs[gBattlerAttacker].physicalDmg
|
if ((gProtectStructs[gBattlerAttacker].physicalDmg
|
||||||
&& gProtectStructs[gBattlerAttacker].physicalBank == gBattlerTarget)
|
&& gProtectStructs[gBattlerAttacker].physicalBattlerId == gBattlerTarget)
|
||||||
|| (gProtectStructs[gBattlerAttacker].specialDmg
|
|| (gProtectStructs[gBattlerAttacker].specialDmg
|
||||||
&& gProtectStructs[gBattlerAttacker].specialBank == gBattlerTarget))
|
&& gProtectStructs[gBattlerAttacker].specialBattlerId == gBattlerTarget))
|
||||||
{
|
{
|
||||||
gBattleScripting.dmgMultiplier = 2;
|
gBattleScripting.dmgMultiplier = 2;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ extern u8 gBank1;
|
|||||||
extern u16 gChosenMoveByBattler[MAX_BATTLERS_COUNT];
|
extern u16 gChosenMoveByBattler[MAX_BATTLERS_COUNT];
|
||||||
extern u8 gMoveResultFlags;
|
extern u8 gMoveResultFlags;
|
||||||
extern s32 gTakenDmg[MAX_BATTLERS_COUNT];
|
extern s32 gTakenDmg[MAX_BATTLERS_COUNT];
|
||||||
extern u8 gTakenDmgBanks[MAX_BATTLERS_COUNT];
|
extern u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT];
|
||||||
extern u8 gLastUsedAbility;
|
extern u8 gLastUsedAbility;
|
||||||
extern u8 gCurrentActionFuncId;
|
extern u8 gCurrentActionFuncId;
|
||||||
extern u32 gBattleControllerExecFlags;
|
extern u32 gBattleControllerExecFlags;
|
||||||
@ -547,7 +547,7 @@ u8 UpdateTurnCounters(void)
|
|||||||
{
|
{
|
||||||
u8 sideBank;
|
u8 sideBank;
|
||||||
|
|
||||||
switch (gBattleStruct->turncountersTracker)
|
switch (gBattleStruct->turnCountersTracker)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
for (i = 0; i < gBattlersCount; i++)
|
for (i = 0; i < gBattlersCount; i++)
|
||||||
@ -566,7 +566,7 @@ u8 UpdateTurnCounters(void)
|
|||||||
|
|
||||||
// It's stupid, but won't match without it
|
// It's stupid, but won't match without it
|
||||||
{
|
{
|
||||||
u8* var = &gBattleStruct->turncountersTracker;
|
u8* var = &gBattleStruct->turnCountersTracker;
|
||||||
(*var)++;
|
(*var)++;
|
||||||
gBattleStruct->turnSideTracker = 0;
|
gBattleStruct->turnSideTracker = 0;
|
||||||
}
|
}
|
||||||
@ -575,7 +575,7 @@ u8 UpdateTurnCounters(void)
|
|||||||
while (gBattleStruct->turnSideTracker < 2)
|
while (gBattleStruct->turnSideTracker < 2)
|
||||||
{
|
{
|
||||||
sideBank = gBattleStruct->turnSideTracker;
|
sideBank = gBattleStruct->turnSideTracker;
|
||||||
gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].reflectBank;
|
gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].reflectBattlerId;
|
||||||
if (gSideStatuses[sideBank] & SIDE_STATUS_REFLECT)
|
if (gSideStatuses[sideBank] & SIDE_STATUS_REFLECT)
|
||||||
{
|
{
|
||||||
if (--gSideTimers[sideBank].reflectTimer == 0)
|
if (--gSideTimers[sideBank].reflectTimer == 0)
|
||||||
@ -592,7 +592,7 @@ u8 UpdateTurnCounters(void)
|
|||||||
}
|
}
|
||||||
if (!effect)
|
if (!effect)
|
||||||
{
|
{
|
||||||
gBattleStruct->turncountersTracker++;
|
gBattleStruct->turnCountersTracker++;
|
||||||
gBattleStruct->turnSideTracker = 0;
|
gBattleStruct->turnSideTracker = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -600,7 +600,7 @@ u8 UpdateTurnCounters(void)
|
|||||||
while (gBattleStruct->turnSideTracker < 2)
|
while (gBattleStruct->turnSideTracker < 2)
|
||||||
{
|
{
|
||||||
sideBank = gBattleStruct->turnSideTracker;
|
sideBank = gBattleStruct->turnSideTracker;
|
||||||
gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].lightscreenBank;
|
gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].lightscreenBattlerId;
|
||||||
if (gSideStatuses[sideBank] & SIDE_STATUS_LIGHTSCREEN)
|
if (gSideStatuses[sideBank] & SIDE_STATUS_LIGHTSCREEN)
|
||||||
{
|
{
|
||||||
if (--gSideTimers[sideBank].lightscreenTimer == 0)
|
if (--gSideTimers[sideBank].lightscreenTimer == 0)
|
||||||
@ -618,7 +618,7 @@ u8 UpdateTurnCounters(void)
|
|||||||
}
|
}
|
||||||
if (!effect)
|
if (!effect)
|
||||||
{
|
{
|
||||||
gBattleStruct->turncountersTracker++;
|
gBattleStruct->turnCountersTracker++;
|
||||||
gBattleStruct->turnSideTracker = 0;
|
gBattleStruct->turnSideTracker = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -626,7 +626,7 @@ u8 UpdateTurnCounters(void)
|
|||||||
while (gBattleStruct->turnSideTracker < 2)
|
while (gBattleStruct->turnSideTracker < 2)
|
||||||
{
|
{
|
||||||
sideBank = gBattleStruct->turnSideTracker;
|
sideBank = gBattleStruct->turnSideTracker;
|
||||||
gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].mistBank;
|
gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].mistBattlerId;
|
||||||
if (gSideTimers[sideBank].mistTimer != 0
|
if (gSideTimers[sideBank].mistTimer != 0
|
||||||
&& --gSideTimers[sideBank].mistTimer == 0)
|
&& --gSideTimers[sideBank].mistTimer == 0)
|
||||||
{
|
{
|
||||||
@ -642,7 +642,7 @@ u8 UpdateTurnCounters(void)
|
|||||||
}
|
}
|
||||||
if (!effect)
|
if (!effect)
|
||||||
{
|
{
|
||||||
gBattleStruct->turncountersTracker++;
|
gBattleStruct->turnCountersTracker++;
|
||||||
gBattleStruct->turnSideTracker = 0;
|
gBattleStruct->turnSideTracker = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -650,7 +650,7 @@ u8 UpdateTurnCounters(void)
|
|||||||
while (gBattleStruct->turnSideTracker < 2)
|
while (gBattleStruct->turnSideTracker < 2)
|
||||||
{
|
{
|
||||||
sideBank = gBattleStruct->turnSideTracker;
|
sideBank = gBattleStruct->turnSideTracker;
|
||||||
gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].safeguardBank;
|
gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].safeguardBattlerId;
|
||||||
if (gSideStatuses[sideBank] & SIDE_STATUS_SAFEGUARD)
|
if (gSideStatuses[sideBank] & SIDE_STATUS_SAFEGUARD)
|
||||||
{
|
{
|
||||||
if (--gSideTimers[sideBank].safeguardTimer == 0)
|
if (--gSideTimers[sideBank].safeguardTimer == 0)
|
||||||
@ -666,7 +666,7 @@ u8 UpdateTurnCounters(void)
|
|||||||
}
|
}
|
||||||
if (!effect)
|
if (!effect)
|
||||||
{
|
{
|
||||||
gBattleStruct->turncountersTracker++;
|
gBattleStruct->turnCountersTracker++;
|
||||||
gBattleStruct->turnSideTracker = 0;
|
gBattleStruct->turnSideTracker = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -688,7 +688,7 @@ u8 UpdateTurnCounters(void)
|
|||||||
}
|
}
|
||||||
if (!effect)
|
if (!effect)
|
||||||
{
|
{
|
||||||
gBattleStruct->turncountersTracker++;
|
gBattleStruct->turnCountersTracker++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
@ -719,7 +719,7 @@ u8 UpdateTurnCounters(void)
|
|||||||
BattleScriptExecute(BattleScript_RainContinuesOrEnds);
|
BattleScriptExecute(BattleScript_RainContinuesOrEnds);
|
||||||
effect++;
|
effect++;
|
||||||
}
|
}
|
||||||
gBattleStruct->turncountersTracker++;
|
gBattleStruct->turnCountersTracker++;
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
if (gBattleWeather & WEATHER_SANDSTORM_ANY)
|
if (gBattleWeather & WEATHER_SANDSTORM_ANY)
|
||||||
@ -739,7 +739,7 @@ u8 UpdateTurnCounters(void)
|
|||||||
BattleScriptExecute(gBattlescriptCurrInstr);
|
BattleScriptExecute(gBattlescriptCurrInstr);
|
||||||
effect++;
|
effect++;
|
||||||
}
|
}
|
||||||
gBattleStruct->turncountersTracker++;
|
gBattleStruct->turnCountersTracker++;
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
if (gBattleWeather & WEATHER_SUN_ANY)
|
if (gBattleWeather & WEATHER_SUN_ANY)
|
||||||
@ -757,7 +757,7 @@ u8 UpdateTurnCounters(void)
|
|||||||
BattleScriptExecute(gBattlescriptCurrInstr);
|
BattleScriptExecute(gBattlescriptCurrInstr);
|
||||||
effect++;
|
effect++;
|
||||||
}
|
}
|
||||||
gBattleStruct->turncountersTracker++;
|
gBattleStruct->turnCountersTracker++;
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
if (gBattleWeather & WEATHER_HAIL)
|
if (gBattleWeather & WEATHER_HAIL)
|
||||||
@ -777,7 +777,7 @@ u8 UpdateTurnCounters(void)
|
|||||||
BattleScriptExecute(gBattlescriptCurrInstr);
|
BattleScriptExecute(gBattlescriptCurrInstr);
|
||||||
effect++;
|
effect++;
|
||||||
}
|
}
|
||||||
gBattleStruct->turncountersTracker++;
|
gBattleStruct->turnCountersTracker++;
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
effect++;
|
effect++;
|
||||||
@ -794,12 +794,12 @@ u8 TurnBasedEffects(void)
|
|||||||
u8 effect = 0;
|
u8 effect = 0;
|
||||||
|
|
||||||
gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_x20);
|
gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_x20);
|
||||||
while (gBattleStruct->turnEffectsBank < gBattlersCount && gBattleStruct->turnEffectsTracker <= TURNBASED_MAX_CASE)
|
while (gBattleStruct->turnEffectsBattlerId < gBattlersCount && gBattleStruct->turnEffectsTracker <= TURNBASED_MAX_CASE)
|
||||||
{
|
{
|
||||||
gActiveBattler = gBattlerAttacker = gBattleTurnOrder[gBattleStruct->turnEffectsBank];
|
gActiveBattler = gBattlerAttacker = gBattleTurnOrder[gBattleStruct->turnEffectsBattlerId];
|
||||||
if (gAbsentBattlerFlags & gBitTable[gActiveBattler])
|
if (gAbsentBattlerFlags & gBitTable[gActiveBattler])
|
||||||
{
|
{
|
||||||
gBattleStruct->turnEffectsBank++;
|
gBattleStruct->turnEffectsBattlerId++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1099,7 +1099,7 @@ u8 TurnBasedEffects(void)
|
|||||||
break;
|
break;
|
||||||
case 19: // done
|
case 19: // done
|
||||||
gBattleStruct->turnEffectsTracker = 0;
|
gBattleStruct->turnEffectsTracker = 0;
|
||||||
gBattleStruct->turnEffectsBank++;
|
gBattleStruct->turnEffectsBattlerId++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (effect != 0)
|
if (effect != 0)
|
||||||
@ -1117,16 +1117,16 @@ bool8 HandleWishPerishSongOnTurnEnd(void)
|
|||||||
switch (gBattleStruct->wishPerishSongState)
|
switch (gBattleStruct->wishPerishSongState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
while (gBattleStruct->wishPerishSongBank < gBattlersCount)
|
while (gBattleStruct->wishPerishSongBattlerId < gBattlersCount)
|
||||||
{
|
{
|
||||||
gActiveBattler = gBattleStruct->wishPerishSongBank;
|
gActiveBattler = gBattleStruct->wishPerishSongBattlerId;
|
||||||
if (gAbsentBattlerFlags & gBitTable[gActiveBattler])
|
if (gAbsentBattlerFlags & gBitTable[gActiveBattler])
|
||||||
{
|
{
|
||||||
gBattleStruct->wishPerishSongBank++;
|
gBattleStruct->wishPerishSongBattlerId++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
gBattleStruct->wishPerishSongBank++;
|
gBattleStruct->wishPerishSongBattlerId++;
|
||||||
if (gWishFutureKnock.futureSightCounter[gActiveBattler] != 0
|
if (gWishFutureKnock.futureSightCounter[gActiveBattler] != 0
|
||||||
&& --gWishFutureKnock.futureSightCounter[gActiveBattler] == 0
|
&& --gWishFutureKnock.futureSightCounter[gActiveBattler] == 0
|
||||||
&& gBattleMons[gActiveBattler].hp != 0)
|
&& gBattleMons[gActiveBattler].hp != 0)
|
||||||
@ -1141,7 +1141,7 @@ bool8 HandleWishPerishSongOnTurnEnd(void)
|
|||||||
gBattlerTarget = gActiveBattler;
|
gBattlerTarget = gActiveBattler;
|
||||||
gBattlerAttacker = gWishFutureKnock.futureSightAttacker[gActiveBattler];
|
gBattlerAttacker = gWishFutureKnock.futureSightAttacker[gActiveBattler];
|
||||||
gBattleMoveDamage = gWishFutureKnock.futureSightDmg[gActiveBattler];
|
gBattleMoveDamage = gWishFutureKnock.futureSightDmg[gActiveBattler];
|
||||||
gSpecialStatuses[gBattlerTarget].moveturnLostHP = 0xFFFF;
|
gSpecialStatuses[gBattlerTarget].dmg = 0xFFFF;
|
||||||
BattleScriptExecute(BattleScript_MonTookFutureAttack);
|
BattleScriptExecute(BattleScript_MonTookFutureAttack);
|
||||||
|
|
||||||
if (gWishFutureKnock.futureSightCounter[gActiveBattler] == 0
|
if (gWishFutureKnock.futureSightCounter[gActiveBattler] == 0
|
||||||
@ -1156,19 +1156,19 @@ bool8 HandleWishPerishSongOnTurnEnd(void)
|
|||||||
{
|
{
|
||||||
u8 *state = &gBattleStruct->wishPerishSongState;
|
u8 *state = &gBattleStruct->wishPerishSongState;
|
||||||
*state = 1;
|
*state = 1;
|
||||||
gBattleStruct->wishPerishSongBank = 0;
|
gBattleStruct->wishPerishSongBattlerId = 0;
|
||||||
}
|
}
|
||||||
// fall through
|
// fall through
|
||||||
case 1:
|
case 1:
|
||||||
while (gBattleStruct->wishPerishSongBank < gBattlersCount)
|
while (gBattleStruct->wishPerishSongBattlerId < gBattlersCount)
|
||||||
{
|
{
|
||||||
gActiveBattler = gBattlerAttacker = gBattleTurnOrder[gBattleStruct->wishPerishSongBank];
|
gActiveBattler = gBattlerAttacker = gBattleTurnOrder[gBattleStruct->wishPerishSongBattlerId];
|
||||||
if (gAbsentBattlerFlags & gBitTable[gActiveBattler])
|
if (gAbsentBattlerFlags & gBitTable[gActiveBattler])
|
||||||
{
|
{
|
||||||
gBattleStruct->wishPerishSongBank++;
|
gBattleStruct->wishPerishSongBattlerId++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
gBattleStruct->wishPerishSongBank++;
|
gBattleStruct->wishPerishSongBattlerId++;
|
||||||
if (gStatuses3[gActiveBattler] & STATUS3_PERISH_SONG)
|
if (gStatuses3[gActiveBattler] & STATUS3_PERISH_SONG)
|
||||||
{
|
{
|
||||||
PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff1, 1, gDisableStructs[gActiveBattler].perishSongTimer1);
|
PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff1, 1, gDisableStructs[gActiveBattler].perishSongTimer1);
|
||||||
@ -1191,7 +1191,7 @@ bool8 HandleWishPerishSongOnTurnEnd(void)
|
|||||||
{
|
{
|
||||||
u8 *state = &gBattleStruct->wishPerishSongState;
|
u8 *state = &gBattleStruct->wishPerishSongState;
|
||||||
*state = 2;
|
*state = 2;
|
||||||
gBattleStruct->wishPerishSongBank = 0;
|
gBattleStruct->wishPerishSongBattlerId = 0;
|
||||||
}
|
}
|
||||||
// fall through
|
// fall through
|
||||||
case 2:
|
case 2:
|
||||||
@ -1229,7 +1229,7 @@ bool8 HandleFaintedMonActions(void)
|
|||||||
switch (gBattleStruct->faintedActionsState)
|
switch (gBattleStruct->faintedActionsState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
gBattleStruct->faintedActionsBank = 0;
|
gBattleStruct->faintedActionsBattlerId = 0;
|
||||||
gBattleStruct->faintedActionsState++;
|
gBattleStruct->faintedActionsState++;
|
||||||
for (i = 0; i < gBattlersCount; i++)
|
for (i = 0; i < gBattlersCount; i++)
|
||||||
{
|
{
|
||||||
@ -1240,45 +1240,45 @@ bool8 HandleFaintedMonActions(void)
|
|||||||
case 1:
|
case 1:
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
gBank1 = gBattlerTarget = gBattleStruct->faintedActionsBank;
|
gBank1 = gBattlerTarget = gBattleStruct->faintedActionsBattlerId;
|
||||||
if (gBattleMons[gBattleStruct->faintedActionsBank].hp == 0
|
if (gBattleMons[gBattleStruct->faintedActionsBattlerId].hp == 0
|
||||||
&& !(gBattleStruct->field_DF & gBitTable[gBattlerPartyIndexes[gBattleStruct->faintedActionsBank]])
|
&& !(gBattleStruct->field_DF & gBitTable[gBattlerPartyIndexes[gBattleStruct->faintedActionsBattlerId]])
|
||||||
&& !(gAbsentBattlerFlags & gBitTable[gBattleStruct->faintedActionsBank]))
|
&& !(gAbsentBattlerFlags & gBitTable[gBattleStruct->faintedActionsBattlerId]))
|
||||||
{
|
{
|
||||||
BattleScriptExecute(BattleScript_GiveExp);
|
BattleScriptExecute(BattleScript_GiveExp);
|
||||||
gBattleStruct->faintedActionsState = 2;
|
gBattleStruct->faintedActionsState = 2;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
} while (++gBattleStruct->faintedActionsBank != gBattlersCount);
|
} while (++gBattleStruct->faintedActionsBattlerId != gBattlersCount);
|
||||||
gBattleStruct->faintedActionsState = 3;
|
gBattleStruct->faintedActionsState = 3;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
sub_803F9EC(gBank1);
|
sub_803F9EC(gBank1);
|
||||||
if (++gBattleStruct->faintedActionsBank == gBattlersCount)
|
if (++gBattleStruct->faintedActionsBattlerId == gBattlersCount)
|
||||||
gBattleStruct->faintedActionsState = 3;
|
gBattleStruct->faintedActionsState = 3;
|
||||||
else
|
else
|
||||||
gBattleStruct->faintedActionsState = 1;
|
gBattleStruct->faintedActionsState = 1;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
gBattleStruct->faintedActionsBank = 0;
|
gBattleStruct->faintedActionsBattlerId = 0;
|
||||||
gBattleStruct->faintedActionsState++;
|
gBattleStruct->faintedActionsState++;
|
||||||
// fall through
|
// fall through
|
||||||
case 4:
|
case 4:
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
gBank1 = gBattlerTarget = gBattleStruct->faintedActionsBank;
|
gBank1 = gBattlerTarget = gBattleStruct->faintedActionsBattlerId;
|
||||||
if (gBattleMons[gBattleStruct->faintedActionsBank].hp == 0
|
if (gBattleMons[gBattleStruct->faintedActionsBattlerId].hp == 0
|
||||||
&& !(gAbsentBattlerFlags & gBitTable[gBattleStruct->faintedActionsBank]))
|
&& !(gAbsentBattlerFlags & gBitTable[gBattleStruct->faintedActionsBattlerId]))
|
||||||
{
|
{
|
||||||
BattleScriptExecute(BattleScript_HandleFaintedMon);
|
BattleScriptExecute(BattleScript_HandleFaintedMon);
|
||||||
gBattleStruct->faintedActionsState = 5;
|
gBattleStruct->faintedActionsState = 5;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
} while (++gBattleStruct->faintedActionsBank != gBattlersCount);
|
} while (++gBattleStruct->faintedActionsBattlerId != gBattlersCount);
|
||||||
gBattleStruct->faintedActionsState = 6;
|
gBattleStruct->faintedActionsState = 6;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
if (++gBattleStruct->faintedActionsBank == gBattlersCount)
|
if (++gBattleStruct->faintedActionsBattlerId == gBattlersCount)
|
||||||
gBattleStruct->faintedActionsState = 6;
|
gBattleStruct->faintedActionsState = 6;
|
||||||
else
|
else
|
||||||
gBattleStruct->faintedActionsState = 4;
|
gBattleStruct->faintedActionsState = 4;
|
||||||
@ -1535,7 +1535,7 @@ u8 AtkCanceller_UnableToUseMove(void)
|
|||||||
{
|
{
|
||||||
gCurrentMove = MOVE_BIDE;
|
gCurrentMove = MOVE_BIDE;
|
||||||
*bideDmg = gTakenDmg[gBattlerAttacker] * 2;
|
*bideDmg = gTakenDmg[gBattlerAttacker] * 2;
|
||||||
gBattlerTarget = gTakenDmgBanks[gBattlerAttacker];
|
gBattlerTarget = gTakenDmgByBattler[gBattlerAttacker];
|
||||||
if (gAbsentBattlerFlags & gBitTable[gBattlerTarget])
|
if (gAbsentBattlerFlags & gBitTable[gBattlerTarget])
|
||||||
gBattlerTarget = GetMoveTarget(MOVE_BIDE, 1);
|
gBattlerTarget = GetMoveTarget(MOVE_BIDE, 1);
|
||||||
gBattlescriptCurrInstr = BattleScript_BideAttack;
|
gBattlescriptCurrInstr = BattleScript_BideAttack;
|
||||||
@ -2063,7 +2063,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
|||||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||||
&& move != MOVE_STRUGGLE
|
&& move != MOVE_STRUGGLE
|
||||||
&& gBattleMoves[move].power != 0
|
&& gBattleMoves[move].power != 0
|
||||||
&& (gSpecialStatuses[gBattlerTarget].moveturnLostHP_physical || gSpecialStatuses[gBattlerTarget].moveturnLostHP_special)
|
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||||
&& gBattleMons[battler].type1 != moveType
|
&& gBattleMons[battler].type1 != moveType
|
||||||
&& gBattleMons[battler].type2 != moveType
|
&& gBattleMons[battler].type2 != moveType
|
||||||
&& gBattleMons[battler].hp != 0)
|
&& gBattleMons[battler].hp != 0)
|
||||||
@ -2080,7 +2080,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
|||||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||||
&& (gSpecialStatuses[gBattlerTarget].moveturnLostHP_physical || gSpecialStatuses[gBattlerTarget].moveturnLostHP_special)
|
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT))
|
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT))
|
||||||
{
|
{
|
||||||
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 16;
|
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 16;
|
||||||
@ -2095,7 +2095,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
|||||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||||
&& (gSpecialStatuses[gBattlerTarget].moveturnLostHP_physical || gSpecialStatuses[gBattlerTarget].moveturnLostHP_special)
|
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
||||||
&& (Random() % 10) == 0)
|
&& (Random() % 10) == 0)
|
||||||
{
|
{
|
||||||
@ -2118,7 +2118,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
|||||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||||
&& (gSpecialStatuses[gBattlerTarget].moveturnLostHP_physical || gSpecialStatuses[gBattlerTarget].moveturnLostHP_special)
|
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
||||||
&& (Random() % 3) == 0)
|
&& (Random() % 3) == 0)
|
||||||
{
|
{
|
||||||
@ -2133,7 +2133,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
|||||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||||
&& (gSpecialStatuses[gBattlerTarget].moveturnLostHP_physical || gSpecialStatuses[gBattlerTarget].moveturnLostHP_special)
|
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
||||||
&& (Random() % 3) == 0)
|
&& (Random() % 3) == 0)
|
||||||
{
|
{
|
||||||
@ -2149,7 +2149,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
|||||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
||||||
&& (gSpecialStatuses[gBattlerTarget].moveturnLostHP_physical || gSpecialStatuses[gBattlerTarget].moveturnLostHP_special)
|
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||||
&& (Random() % 3) == 0)
|
&& (Random() % 3) == 0)
|
||||||
{
|
{
|
||||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_BURN;
|
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_BURN;
|
||||||
@ -2164,7 +2164,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
|||||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
||||||
&& (gSpecialStatuses[gBattlerTarget].moveturnLostHP_physical || gSpecialStatuses[gBattlerTarget].moveturnLostHP_special)
|
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||||
&& gBattleMons[gBattlerTarget].hp != 0
|
&& gBattleMons[gBattlerTarget].hp != 0
|
||||||
&& (Random() % 3) == 0
|
&& (Random() % 3) == 0
|
||||||
&& gBattleMons[gBattlerAttacker].ability != ABILITY_OBLIVIOUS
|
&& gBattleMons[gBattlerAttacker].ability != ABILITY_OBLIVIOUS
|
||||||
@ -3174,7 +3174,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
|
|||||||
{
|
{
|
||||||
case HOLD_EFFECT_FLINCH:
|
case HOLD_EFFECT_FLINCH:
|
||||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||||
&& (gSpecialStatuses[gBattlerTarget].moveturnLostHP_physical || gSpecialStatuses[gBattlerTarget].moveturnLostHP_special)
|
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||||
&& (Random() % 100) < atkQuality
|
&& (Random() % 100) < atkQuality
|
||||||
&& gBattleMoves[gCurrentMove].flags & FLAG_KINGSROCK_AFFECTED
|
&& gBattleMoves[gCurrentMove].flags & FLAG_KINGSROCK_AFFECTED
|
||||||
&& gBattleMons[gBattlerTarget].hp)
|
&& gBattleMons[gBattlerTarget].hp)
|
||||||
@ -3187,8 +3187,8 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
|
|||||||
break;
|
break;
|
||||||
case HOLD_EFFECT_SHELL_BELL:
|
case HOLD_EFFECT_SHELL_BELL:
|
||||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||||
&& gSpecialStatuses[gBattlerTarget].moveturnLostHP != 0
|
&& gSpecialStatuses[gBattlerTarget].dmg != 0
|
||||||
&& gSpecialStatuses[gBattlerTarget].moveturnLostHP != 0xFFFF
|
&& gSpecialStatuses[gBattlerTarget].dmg != 0xFFFF
|
||||||
&& gBattlerAttacker != gBattlerTarget
|
&& gBattlerAttacker != gBattlerTarget
|
||||||
&& gBattleMons[gBattlerAttacker].hp != gBattleMons[gBattlerAttacker].maxHP
|
&& gBattleMons[gBattlerAttacker].hp != gBattleMons[gBattlerAttacker].maxHP
|
||||||
&& gBattleMons[gBattlerAttacker].hp != 0)
|
&& gBattleMons[gBattlerAttacker].hp != 0)
|
||||||
@ -3196,10 +3196,10 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
|
|||||||
gLastUsedItem = atkItem;
|
gLastUsedItem = atkItem;
|
||||||
gStringBattler = gBattlerAttacker;
|
gStringBattler = gBattlerAttacker;
|
||||||
gBattleScripting.battler = gBattlerAttacker;
|
gBattleScripting.battler = gBattlerAttacker;
|
||||||
gBattleMoveDamage = (gSpecialStatuses[gBattlerTarget].moveturnLostHP / atkQuality) * -1;
|
gBattleMoveDamage = (gSpecialStatuses[gBattlerTarget].dmg / atkQuality) * -1;
|
||||||
if (gBattleMoveDamage == 0)
|
if (gBattleMoveDamage == 0)
|
||||||
gBattleMoveDamage = -1;
|
gBattleMoveDamage = -1;
|
||||||
gSpecialStatuses[gBattlerTarget].moveturnLostHP = 0;
|
gSpecialStatuses[gBattlerTarget].dmg = 0;
|
||||||
BattleScriptPushCursor();
|
BattleScriptPushCursor();
|
||||||
gBattlescriptCurrInstr = BattleScript_ItemHealHP_Ret;
|
gBattlescriptCurrInstr = BattleScript_ItemHealHP_Ret;
|
||||||
effect++;
|
effect++;
|
||||||
|
@ -88,7 +88,7 @@ extern void sub_80B7CC8(void);
|
|||||||
extern void flagmods_08054D70(void);
|
extern void flagmods_08054D70(void);
|
||||||
extern u8* sub_806CF78(u16);
|
extern u8* sub_806CF78(u16);
|
||||||
extern bool8 ExecuteTableBasedItemEffect_(struct Pokemon*, u16, u8, u8);
|
extern bool8 ExecuteTableBasedItemEffect_(struct Pokemon*, u16, u8, u8);
|
||||||
extern u8 gBankInMenu;
|
extern u8 gBattlerInMenuId;
|
||||||
extern u16 gBattlerPartyIndexes[];
|
extern u16 gBattlerPartyIndexes[];
|
||||||
extern void sub_81B89F0(void);
|
extern void sub_81B89F0(void);
|
||||||
extern u8 GetItemEffectType(u16);
|
extern u8 GetItemEffectType(u16);
|
||||||
@ -984,7 +984,7 @@ void sub_80FE440(u8 taskId)
|
|||||||
|
|
||||||
void ItemUseInBattle_StatIncrease(u8 taskId)
|
void ItemUseInBattle_StatIncrease(u8 taskId)
|
||||||
{
|
{
|
||||||
u16 partyId = gBattlerPartyIndexes[gBankInMenu];
|
u16 partyId = gBattlerPartyIndexes[gBattlerInMenuId];
|
||||||
|
|
||||||
if (ExecuteTableBasedItemEffect_(&gPlayerParty[partyId], gSpecialVar_ItemId, partyId, 0) != FALSE)
|
if (ExecuteTableBasedItemEffect_(&gPlayerParty[partyId], gSpecialVar_ItemId, partyId, 0) != FALSE)
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
extern struct BattlePokemon gBattleMons[4];
|
extern struct BattlePokemon gBattleMons[4];
|
||||||
extern struct BattleEnigmaBerry gEnigmaBerries[4];
|
extern struct BattleEnigmaBerry gEnigmaBerries[4];
|
||||||
extern u8 gActiveBattler;
|
extern u8 gActiveBattler;
|
||||||
extern u8 gBankInMenu;
|
extern u8 gBattlerInMenuId;
|
||||||
extern u8 gBattlerTarget;
|
extern u8 gBattlerTarget;
|
||||||
extern u8 gBattlerAttacker;
|
extern u8 gBattlerAttacker;
|
||||||
extern u8 gStringBattler;
|
extern u8 gStringBattler;
|
||||||
@ -210,7 +210,7 @@ u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit)
|
|||||||
|
|
||||||
void sub_806CF24(s32 stat)
|
void sub_806CF24(s32 stat)
|
||||||
{
|
{
|
||||||
gBattlerTarget = gBankInMenu;
|
gBattlerTarget = gBattlerInMenuId;
|
||||||
StringCopy(gBattleTextBuff1, gStatNamesTable[gUnknown_08329EC8[stat]]);
|
StringCopy(gBattleTextBuff1, gStatNamesTable[gUnknown_08329EC8[stat]]);
|
||||||
StringCopy(gBattleTextBuff2, gText_StatRose);
|
StringCopy(gBattleTextBuff2, gText_StatRose);
|
||||||
BattleStringExpandPlaceholdersToDisplayedString(gText_PkmnsStatChanged2);
|
BattleStringExpandPlaceholdersToDisplayedString(gText_PkmnsStatChanged2);
|
||||||
@ -224,7 +224,7 @@ u8 *sub_806CF78(u16 itemId)
|
|||||||
if (itemId == ITEM_ENIGMA_BERRY)
|
if (itemId == ITEM_ENIGMA_BERRY)
|
||||||
{
|
{
|
||||||
if (gMain.inBattle)
|
if (gMain.inBattle)
|
||||||
itemEffect = gEnigmaBerries[gBankInMenu].itemEffect;
|
itemEffect = gEnigmaBerries[gBattlerInMenuId].itemEffect;
|
||||||
else
|
else
|
||||||
itemEffect = gSaveBlock1Ptr->enigmaBerry.itemEffect;
|
itemEffect = gSaveBlock1Ptr->enigmaBerry.itemEffect;
|
||||||
}
|
}
|
||||||
@ -233,7 +233,7 @@ u8 *sub_806CF78(u16 itemId)
|
|||||||
itemEffect = gItemEffectTable[itemId - 13];
|
itemEffect = gItemEffectTable[itemId - 13];
|
||||||
}
|
}
|
||||||
|
|
||||||
gStringBattler = gBankInMenu;
|
gStringBattler = gBattlerInMenuId;
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
@ -247,7 +247,7 @@ u8 *sub_806CF78(u16 itemId)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gBattlerAttacker = gBankInMenu;
|
gBattlerAttacker = gBattlerInMenuId;
|
||||||
BattleStringExpandPlaceholdersToDisplayedString(gText_PkmnGettingPumped);
|
BattleStringExpandPlaceholdersToDisplayedString(gText_PkmnGettingPumped);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -255,7 +255,7 @@ u8 *sub_806CF78(u16 itemId)
|
|||||||
|
|
||||||
if (itemEffect[3] & 0x80)
|
if (itemEffect[3] & 0x80)
|
||||||
{
|
{
|
||||||
gBattlerAttacker = gBankInMenu;
|
gBattlerAttacker = gBattlerInMenuId;
|
||||||
BattleStringExpandPlaceholdersToDisplayedString(gText_PkmnShroudedInMist);
|
BattleStringExpandPlaceholdersToDisplayedString(gText_PkmnShroudedInMist);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1371,7 +1371,7 @@ void sub_806E994(void)
|
|||||||
else
|
else
|
||||||
gBattleTextBuff1[3] = gBattlerPartyIndexes[gBattleStruct->field_49];
|
gBattleTextBuff1[3] = gBattlerPartyIndexes[gBattleStruct->field_49];
|
||||||
|
|
||||||
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff2, gBankInMenu, pokemon_order_func(gBattlerPartyIndexes[gBankInMenu]))
|
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff2, gBattlerInMenuId, pokemon_order_func(gBattlerPartyIndexes[gBattlerInMenuId]))
|
||||||
|
|
||||||
BattleStringExpandPlaceholders(gText_PkmnsXPreventsSwitching, gStringVar4);
|
BattleStringExpandPlaceholders(gText_PkmnsXPreventsSwitching, gStringVar4);
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ extern u16 gBattle_BG3_X;
|
|||||||
extern u16 gBattle_BG3_Y;
|
extern u16 gBattle_BG3_Y;
|
||||||
extern u8 gReservedSpritePaletteCount;
|
extern u8 gReservedSpritePaletteCount;
|
||||||
extern u8 gActionSelectionCursor[MAX_BATTLERS_COUNT];
|
extern u8 gActionSelectionCursor[MAX_BATTLERS_COUNT];
|
||||||
extern u8 gBankInMenu;
|
extern u8 gBattlerInMenuId;
|
||||||
extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT];
|
extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT];
|
||||||
extern u8 gBattlersCount;
|
extern u8 gBattlersCount;
|
||||||
extern u32 gBattleTypeFlags;
|
extern u32 gBattleTypeFlags;
|
||||||
@ -175,7 +175,7 @@ static void CB2_ReshowBattleScreenAfterMenu(void)
|
|||||||
SetBattlerShadowSpriteCallback(opponentBank, species);
|
SetBattlerShadowSpriteCallback(opponentBank, species);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionSelectionCreateCursorAt(gActionSelectionCursor[gBankInMenu], 0);
|
ActionSelectionCreateCursorAt(gActionSelectionCursor[gBattlerInMenuId], 0);
|
||||||
|
|
||||||
if (gLinkVSyncDisabled != 0 && gReceivedRemoteLinkPlayers != 0)
|
if (gLinkVSyncDisabled != 0 && gReceivedRemoteLinkPlayers != 0)
|
||||||
{
|
{
|
||||||
|
283
sym_ewram.txt
283
sym_ewram.txt
@ -239,288 +239,7 @@ gBattle_WIN1V: @ 2022E2A
|
|||||||
.space 0x2
|
.space 0x2
|
||||||
|
|
||||||
.include "src/battle_message.o"
|
.include "src/battle_message.o"
|
||||||
|
.include "src/battle_main.o"
|
||||||
gUnknown_02022F88: @ 2022F88
|
|
||||||
.space 0x64
|
|
||||||
|
|
||||||
gBattleTypeFlags: @ 2022FEC
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gBattleTerrain: @ 2022FF0
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gUnknown_02022FF4: @ 2022FF4
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gUnknown_02022FF8: @ 2022FF8
|
|
||||||
.space 0x60
|
|
||||||
|
|
||||||
gUnknown_02023058: @ 2023058
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gUnknown_0202305C: @ 202305C
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gUnknown_02023060: @ 2023060
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gBattleBufferA: @ 2023064
|
|
||||||
.space 0x800
|
|
||||||
|
|
||||||
gBattleBufferB: @ 2023864
|
|
||||||
.space 0x800
|
|
||||||
|
|
||||||
gActiveBattler: @ 2024064
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gBattleControllerExecFlags: @ 2024068
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gBattlersCount: @ 202406C
|
|
||||||
.space 0x2
|
|
||||||
|
|
||||||
gBattlerPartyIndexes: @ 202406E
|
|
||||||
.space 0x8
|
|
||||||
|
|
||||||
gBattlerPositions: @ 2024076
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gActionsByTurnOrder: @ 202407A
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gBattleTurnOrder: @ 202407E
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gCurrentTurnActionNumber: @ 2024082
|
|
||||||
.space 0x1
|
|
||||||
|
|
||||||
gCurrentActionFuncId: @ 2024083
|
|
||||||
.space 0x1
|
|
||||||
|
|
||||||
gBattleMons: @ 2024084
|
|
||||||
.space 0x160
|
|
||||||
|
|
||||||
gBattlerSpriteIds: @ 20241E4
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gCurrMovePos: @ 20241E8
|
|
||||||
.space 0x1
|
|
||||||
|
|
||||||
gUnknown_020241E9: @ 20241E9
|
|
||||||
.space 0x1
|
|
||||||
|
|
||||||
gCurrentMove: @ 20241EA
|
|
||||||
.space 0x2
|
|
||||||
|
|
||||||
gChosenMove: @ 20241EC
|
|
||||||
.space 0x2
|
|
||||||
|
|
||||||
gRandomMove: @ 20241EE
|
|
||||||
.space 0x2
|
|
||||||
|
|
||||||
gBattleMoveDamage: @ 20241F0
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gHpDealt: @ 20241F4
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gTakenDmg: @ 20241F8
|
|
||||||
.space 0x10
|
|
||||||
|
|
||||||
gLastUsedItem: @ 2024208
|
|
||||||
.space 0x2
|
|
||||||
|
|
||||||
gLastUsedAbility: @ 202420A
|
|
||||||
.space 0x1
|
|
||||||
|
|
||||||
gBattlerAttacker: @ 202420B
|
|
||||||
.space 0x1
|
|
||||||
|
|
||||||
gBattlerTarget: @ 202420C
|
|
||||||
.space 0x1
|
|
||||||
|
|
||||||
gBank1: @ 202420D
|
|
||||||
.space 0x1
|
|
||||||
|
|
||||||
gEffectBank: @ 202420E
|
|
||||||
.space 0x1
|
|
||||||
|
|
||||||
gStringBattler: @ 202420F
|
|
||||||
.space 0x1
|
|
||||||
|
|
||||||
gAbsentBattlerFlags: @ 2024210
|
|
||||||
.space 0x1
|
|
||||||
|
|
||||||
gCritMultiplier: @ 2024211
|
|
||||||
.space 0x1
|
|
||||||
|
|
||||||
gMultiHitCounter: @ 2024212
|
|
||||||
.space 0x2
|
|
||||||
|
|
||||||
gBattlescriptCurrInstr: @ 2024214
|
|
||||||
.space 0x8
|
|
||||||
|
|
||||||
gChosenActionByBattler: @ 202421C
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gSelectionBattleScripts: @ 2024220
|
|
||||||
.space 0x10
|
|
||||||
|
|
||||||
gPalaceSelectionBattleScripts: @ 2024230
|
|
||||||
.space 0x10
|
|
||||||
|
|
||||||
gLastPrintedMoves: @ 2024240
|
|
||||||
.space 0x8
|
|
||||||
|
|
||||||
gLastMoves: @ 2024248
|
|
||||||
.space 0x8
|
|
||||||
|
|
||||||
gLastLandedMoves: @ 2024250
|
|
||||||
.space 0x8
|
|
||||||
|
|
||||||
gLastHitByType: @ 2024258
|
|
||||||
.space 0x8
|
|
||||||
|
|
||||||
gLastResultingMoves: @ 2024260
|
|
||||||
.space 0x8
|
|
||||||
|
|
||||||
gLockedMoves: @ 2024268
|
|
||||||
.space 0x8
|
|
||||||
|
|
||||||
gLastHitBy: @ 2024270
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gChosenMoveByBattler: @ 2024274
|
|
||||||
.space 0x8
|
|
||||||
|
|
||||||
gMoveResultFlags: @ 202427C
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gHitMarker: @ 2024280
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gUnknown_02024284: @ 2024284
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gTakenDmgBanks: @ 2024288
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gUnknown_0202428C: @ 202428C
|
|
||||||
.space 0x2
|
|
||||||
|
|
||||||
gSideStatuses: @ 202428E
|
|
||||||
.space 0x6
|
|
||||||
|
|
||||||
gSideTimers: @ 2024294
|
|
||||||
.space 0x18
|
|
||||||
|
|
||||||
gStatuses3: @ 20242AC
|
|
||||||
.space 0x10
|
|
||||||
|
|
||||||
gDisableStructs: @ 20242BC
|
|
||||||
.space 0x70
|
|
||||||
|
|
||||||
gPauseCounterBattle: @ 202432C
|
|
||||||
.space 0x2
|
|
||||||
|
|
||||||
gPaydayMoney: @ 202432E
|
|
||||||
.space 0x2
|
|
||||||
|
|
||||||
gRandomTurnNumber: @ 2024330
|
|
||||||
.space 0x2
|
|
||||||
|
|
||||||
gBattleCommunication: @ 2024332
|
|
||||||
.space 0x1
|
|
||||||
|
|
||||||
gUnknown_02024333: @ 2024333
|
|
||||||
.space 0x7
|
|
||||||
|
|
||||||
gBattleOutcome: @ 202433A
|
|
||||||
.space 0x2
|
|
||||||
|
|
||||||
gProtectStructs: @ 202433C
|
|
||||||
.space 0x40
|
|
||||||
|
|
||||||
gSpecialStatuses: @ 202437C
|
|
||||||
.space 0x50
|
|
||||||
|
|
||||||
gBattleWeather: @ 20243CC
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gWishFutureKnock: @ 20243D0
|
|
||||||
.space 0x2C
|
|
||||||
|
|
||||||
gUnknown_020243FC: @ 20243FC
|
|
||||||
.space 0x2
|
|
||||||
|
|
||||||
gSentPokesToOpponent: @ 20243FE
|
|
||||||
.space 0x2
|
|
||||||
|
|
||||||
gDynamicBasePower: @ 2024400
|
|
||||||
.space 0x2
|
|
||||||
|
|
||||||
gExpShareExp: @ 2024402
|
|
||||||
.space 0x2
|
|
||||||
|
|
||||||
gEnigmaBerries: @ 2024404
|
|
||||||
.space 0x70
|
|
||||||
|
|
||||||
gBattleScripting: @ 2024474
|
|
||||||
.space 0x28
|
|
||||||
|
|
||||||
gBattleStruct: @ 202449C
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gLinkBattleSendBuffer: @ 20244A0
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gLinkBattleRecvBuffer: @ 20244A4
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gBattleResources: @ 20244A8
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gActionSelectionCursor: @ 20244AC
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gMoveSelectionCursor: @ 20244B0
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gUnknown_020244B4: @ 20244B4
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gBankInMenu: @ 20244B8
|
|
||||||
.space 0x1
|
|
||||||
|
|
||||||
gDoingBattleAnim: @ 20244B9
|
|
||||||
.space 0x3
|
|
||||||
|
|
||||||
gTransformedPersonalities: @ 20244BC
|
|
||||||
.space 0x10
|
|
||||||
|
|
||||||
gPlayerDpadHoldFrames: @ 20244CC
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gBattleSpritesDataPtr: @ 20244D0
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gMonSpritesGfxPtr: @ 20244D4
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gUnknown_020244D8: @ 20244D8
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gUnknown_020244DC: @ 20244DC
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
gBattleMovePower: @ 20244E0
|
|
||||||
.space 0x2
|
|
||||||
|
|
||||||
gMoveToLearn: @ 20244E2
|
|
||||||
.space 0x2
|
|
||||||
|
|
||||||
gBattleMonForms: @ 20244E4
|
|
||||||
.space 0x4
|
|
||||||
|
|
||||||
sLearningMoveTableID: @ 20244E8
|
sLearningMoveTableID: @ 20244E8
|
||||||
.space 0x1
|
.space 0x1
|
||||||
|
Loading…
Reference in New Issue
Block a user