more battle labels
This commit is contained in:
@@ -100,7 +100,7 @@ _0806BDBC:
|
|||||||
lsrs r0, 24
|
lsrs r0, 24
|
||||||
_0806BDC4:
|
_0806BDC4:
|
||||||
str r0, [sp, 0x34]
|
str r0, [sp, 0x34]
|
||||||
ldr r1, =gStringBattler
|
ldr r1, =gPotentialItemEffectBattler
|
||||||
ldr r0, =gBattlerInMenuId
|
ldr r0, =gBattlerInMenuId
|
||||||
ldrb r2, [r0]
|
ldrb r2, [r0]
|
||||||
strb r2, [r1]
|
strb r2, [r1]
|
||||||
|
|||||||
+1
-1
@@ -673,7 +673,7 @@ extern u8 gBattlerAttacker;
|
|||||||
extern u8 gBattlerTarget;
|
extern u8 gBattlerTarget;
|
||||||
extern u8 gBattlerFainted;
|
extern u8 gBattlerFainted;
|
||||||
extern u8 gEffectBattler;
|
extern u8 gEffectBattler;
|
||||||
extern u8 gStringBattler;
|
extern u8 gPotentialItemEffectBattler;
|
||||||
extern u8 gAbsentBattlerFlags;
|
extern u8 gAbsentBattlerFlags;
|
||||||
extern u8 gCritMultiplier;
|
extern u8 gCritMultiplier;
|
||||||
extern u8 gMultiHitCounter;
|
extern u8 gMultiHitCounter;
|
||||||
|
|||||||
@@ -1102,7 +1102,7 @@ void BtlController_EmitPrintString(u8 bufferId, u16 stringID)
|
|||||||
stringInfo->scrActive = gBattleScripting.battler;
|
stringInfo->scrActive = gBattleScripting.battler;
|
||||||
stringInfo->unk1605E = gBattleStruct->field_52;
|
stringInfo->unk1605E = gBattleStruct->field_52;
|
||||||
stringInfo->hpScale = gBattleStruct->hpScale;
|
stringInfo->hpScale = gBattleStruct->hpScale;
|
||||||
stringInfo->StringBank = gStringBattler;
|
stringInfo->StringBank = gPotentialItemEffectBattler;
|
||||||
stringInfo->moveType = gBattleMoves[gCurrentMove].type;
|
stringInfo->moveType = gBattleMoves[gCurrentMove].type;
|
||||||
|
|
||||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||||
|
|||||||
+122
-121
@@ -22,6 +22,7 @@
|
|||||||
#include "blend_palette.h"
|
#include "blend_palette.h"
|
||||||
#include "contest.h"
|
#include "contest.h"
|
||||||
#include "constants/songs.h"
|
#include "constants/songs.h"
|
||||||
|
#include "constants/rgb.h"
|
||||||
|
|
||||||
extern struct MusicPlayerInfo gMPlayInfo_SE1;
|
extern struct MusicPlayerInfo gMPlayInfo_SE1;
|
||||||
extern struct MusicPlayerInfo gMPlayInfo_SE2;
|
extern struct MusicPlayerInfo gMPlayInfo_SE2;
|
||||||
@@ -57,7 +58,7 @@ extern const u8 gBlankGfxCompressed[];
|
|||||||
extern const u16 gBattleInterface_BallStatusBarPal[];
|
extern const u16 gBattleInterface_BallStatusBarPal[];
|
||||||
extern const u16 gBattleInterface_BallDisplayPal[];
|
extern const u16 gBattleInterface_BallDisplayPal[];
|
||||||
|
|
||||||
extern u8 sub_80688F8(u8, u8 bank);
|
extern u8 sub_80688F8(u8, u8 battlerId);
|
||||||
extern u8 pokemon_order_func(u8); // party menu
|
extern u8 pokemon_order_func(u8); // party menu
|
||||||
extern void sub_81B8C68(void);
|
extern void sub_81B8C68(void);
|
||||||
|
|
||||||
@@ -410,7 +411,7 @@ void InitAndLaunchChosenStatusAnimation(bool8 isStatus2, u32 status)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define tBank data[0]
|
#define tBattlerId data[0]
|
||||||
|
|
||||||
bool8 TryHandleLaunchBattleTableAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tableId, u16 argument)
|
bool8 TryHandleLaunchBattleTableAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tableId, u16 argument)
|
||||||
{
|
{
|
||||||
@@ -440,8 +441,8 @@ bool8 TryHandleLaunchBattleTableAnimation(u8 activeBank, u8 atkBank, u8 defBank,
|
|||||||
gBattleSpritesDataPtr->animationData->animArg = argument;
|
gBattleSpritesDataPtr->animationData->animArg = argument;
|
||||||
LaunchBattleAnimation(gBattleAnims_VariousTable, tableId, FALSE);
|
LaunchBattleAnimation(gBattleAnims_VariousTable, tableId, FALSE);
|
||||||
taskId = CreateTask(Task_ClearBitWhenBattleTableAnimDone, 10);
|
taskId = CreateTask(Task_ClearBitWhenBattleTableAnimDone, 10);
|
||||||
gTasks[taskId].tBank = activeBank;
|
gTasks[taskId].tBattlerId = activeBank;
|
||||||
gBattleSpritesDataPtr->healthBoxesData[gTasks[taskId].tBank].animFromTableActive = 1;
|
gBattleSpritesDataPtr->healthBoxesData[gTasks[taskId].tBattlerId].animFromTableActive = 1;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -451,12 +452,12 @@ static void Task_ClearBitWhenBattleTableAnimDone(u8 taskId)
|
|||||||
gAnimScriptCallback();
|
gAnimScriptCallback();
|
||||||
if (!gAnimScriptActive)
|
if (!gAnimScriptActive)
|
||||||
{
|
{
|
||||||
gBattleSpritesDataPtr->healthBoxesData[gTasks[taskId].tBank].animFromTableActive = 0;
|
gBattleSpritesDataPtr->healthBoxesData[gTasks[taskId].tBattlerId].animFromTableActive = 0;
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef tBank
|
#undef tBattlerId
|
||||||
|
|
||||||
static bool8 ShouldAnimBeDoneRegardlessOfSubsitute(u8 animId)
|
static bool8 ShouldAnimBeDoneRegardlessOfSubsitute(u8 animId)
|
||||||
{
|
{
|
||||||
@@ -474,7 +475,7 @@ static bool8 ShouldAnimBeDoneRegardlessOfSubsitute(u8 animId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define tBank data[0]
|
#define tBattlerId data[0]
|
||||||
|
|
||||||
void InitAndLaunchSpecialAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tableId)
|
void InitAndLaunchSpecialAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tableId)
|
||||||
{
|
{
|
||||||
@@ -484,8 +485,8 @@ void InitAndLaunchSpecialAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tab
|
|||||||
gBattleAnimTarget = defBank;
|
gBattleAnimTarget = defBank;
|
||||||
LaunchBattleAnimation(gBattleAnims_Special, tableId, FALSE);
|
LaunchBattleAnimation(gBattleAnims_Special, tableId, FALSE);
|
||||||
taskId = CreateTask(Task_ClearBitWhenSpecialAnimDone, 10);
|
taskId = CreateTask(Task_ClearBitWhenSpecialAnimDone, 10);
|
||||||
gTasks[taskId].tBank = activeBank;
|
gTasks[taskId].tBattlerId = activeBank;
|
||||||
gBattleSpritesDataPtr->healthBoxesData[gTasks[taskId].tBank].specialAnimActive = 1;
|
gBattleSpritesDataPtr->healthBoxesData[gTasks[taskId].tBattlerId].specialAnimActive = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Task_ClearBitWhenSpecialAnimDone(u8 taskId)
|
static void Task_ClearBitWhenSpecialAnimDone(u8 taskId)
|
||||||
@@ -493,12 +494,12 @@ static void Task_ClearBitWhenSpecialAnimDone(u8 taskId)
|
|||||||
gAnimScriptCallback();
|
gAnimScriptCallback();
|
||||||
if (!gAnimScriptActive)
|
if (!gAnimScriptActive)
|
||||||
{
|
{
|
||||||
gBattleSpritesDataPtr->healthBoxesData[gTasks[taskId].tBank].specialAnimActive = 0;
|
gBattleSpritesDataPtr->healthBoxesData[gTasks[taskId].tBattlerId].specialAnimActive = 0;
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef tBank
|
#undef tBattlerId
|
||||||
|
|
||||||
// great function to include newly added moves that don't have animation yet
|
// great function to include newly added moves that don't have animation yet
|
||||||
bool8 IsMoveWithoutAnimation(u16 moveId, u8 animationTurn)
|
bool8 IsMoveWithoutAnimation(u16 moveId, u8 animationTurn)
|
||||||
@@ -506,13 +507,13 @@ bool8 IsMoveWithoutAnimation(u16 moveId, u8 animationTurn)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 mplay_80342A4(u8 bank)
|
bool8 mplay_80342A4(u8 battlerId)
|
||||||
{
|
{
|
||||||
u8 zero = 0;
|
u8 zero = 0;
|
||||||
|
|
||||||
if (IsSEPlaying())
|
if (IsSEPlaying())
|
||||||
{
|
{
|
||||||
gBattleSpritesDataPtr->healthBoxesData[bank].field_8++;
|
gBattleSpritesDataPtr->healthBoxesData[battlerId].field_8++;
|
||||||
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_8 < 30)
|
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_8 < 30)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
@@ -521,14 +522,14 @@ bool8 mplay_80342A4(u8 bank)
|
|||||||
}
|
}
|
||||||
if (zero == 0)
|
if (zero == 0)
|
||||||
{
|
{
|
||||||
gBattleSpritesDataPtr->healthBoxesData[bank].field_8 = 0;
|
gBattleSpritesDataPtr->healthBoxesData[battlerId].field_8 = 0;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 bank)
|
void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 battlerId)
|
||||||
{
|
{
|
||||||
u32 monsPersonality, currentPersonality, otId;
|
u32 monsPersonality, currentPersonality, otId;
|
||||||
u16 species;
|
u16 species;
|
||||||
@@ -538,50 +539,50 @@ void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 bank)
|
|||||||
|
|
||||||
monsPersonality = GetMonData(mon, MON_DATA_PERSONALITY);
|
monsPersonality = GetMonData(mon, MON_DATA_PERSONALITY);
|
||||||
|
|
||||||
if (gBattleSpritesDataPtr->battlerData[bank].transformSpecies == SPECIES_NONE)
|
if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies == SPECIES_NONE)
|
||||||
{
|
{
|
||||||
species = GetMonData(mon, MON_DATA_SPECIES);
|
species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
currentPersonality = monsPersonality;
|
currentPersonality = monsPersonality;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
species = gBattleSpritesDataPtr->battlerData[bank].transformSpecies;
|
species = gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies;
|
||||||
currentPersonality = gTransformedPersonalities[bank];
|
currentPersonality = gTransformedPersonalities[battlerId];
|
||||||
}
|
}
|
||||||
|
|
||||||
otId = GetMonData(mon, MON_DATA_OT_ID);
|
otId = GetMonData(mon, MON_DATA_OT_ID);
|
||||||
position = GetBattlerPosition(bank);
|
position = GetBattlerPosition(battlerId);
|
||||||
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[species],
|
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[species],
|
||||||
gMonSpritesGfxPtr->sprites[position],
|
gMonSpritesGfxPtr->sprites[position],
|
||||||
species, currentPersonality);
|
species, currentPersonality);
|
||||||
|
|
||||||
paletteOffset = 0x100 + bank * 16;
|
paletteOffset = 0x100 + battlerId * 16;
|
||||||
|
|
||||||
if (gBattleSpritesDataPtr->battlerData[bank].transformSpecies == SPECIES_NONE)
|
if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies == SPECIES_NONE)
|
||||||
lzPaletteData = GetMonFrontSpritePal(mon);
|
lzPaletteData = GetMonFrontSpritePal(mon);
|
||||||
else
|
else
|
||||||
lzPaletteData = GetFrontSpritePalFromSpeciesAndPersonality(species, otId, monsPersonality);
|
lzPaletteData = GetFrontSpritePalFromSpeciesAndPersonality(species, otId, monsPersonality);
|
||||||
|
|
||||||
LZDecompressWram(lzPaletteData, gDecompressionBuffer);
|
LZDecompressWram(lzPaletteData, gDecompressionBuffer);
|
||||||
LoadPalette(gDecompressionBuffer, paletteOffset, 0x20);
|
LoadPalette(gDecompressionBuffer, paletteOffset, 0x20);
|
||||||
LoadPalette(gDecompressionBuffer, 0x80 + bank * 16, 0x20);
|
LoadPalette(gDecompressionBuffer, 0x80 + battlerId * 16, 0x20);
|
||||||
|
|
||||||
if (species == SPECIES_CASTFORM)
|
if (species == SPECIES_CASTFORM)
|
||||||
{
|
{
|
||||||
paletteOffset = 0x100 + bank * 16;
|
paletteOffset = 0x100 + battlerId * 16;
|
||||||
LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette[0]);
|
LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette[0]);
|
||||||
LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[bank]], paletteOffset, 0x20);
|
LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerId]], paletteOffset, 0x20);
|
||||||
}
|
}
|
||||||
|
|
||||||
// transform's pink color
|
// transform's pink color
|
||||||
if (gBattleSpritesDataPtr->battlerData[bank].transformSpecies != SPECIES_NONE)
|
if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != SPECIES_NONE)
|
||||||
{
|
{
|
||||||
BlendPalette(paletteOffset, 16, 6, 0x7FFF);
|
BlendPalette(paletteOffset, 16, 6, RGB_WHITE);
|
||||||
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, 32);
|
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, 32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 bank)
|
void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 battlerId)
|
||||||
{
|
{
|
||||||
u32 monsPersonality, currentPersonality, otId;
|
u32 monsPersonality, currentPersonality, otId;
|
||||||
u16 species;
|
u16 species;
|
||||||
@@ -591,21 +592,21 @@ void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 bank)
|
|||||||
|
|
||||||
monsPersonality = GetMonData(mon, MON_DATA_PERSONALITY);
|
monsPersonality = GetMonData(mon, MON_DATA_PERSONALITY);
|
||||||
|
|
||||||
if (gBattleSpritesDataPtr->battlerData[bank].transformSpecies == SPECIES_NONE)
|
if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies == SPECIES_NONE)
|
||||||
{
|
{
|
||||||
species = GetMonData(mon, MON_DATA_SPECIES);
|
species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
currentPersonality = monsPersonality;
|
currentPersonality = monsPersonality;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
species = gBattleSpritesDataPtr->battlerData[bank].transformSpecies;
|
species = gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies;
|
||||||
currentPersonality = gTransformedPersonalities[bank];
|
currentPersonality = gTransformedPersonalities[battlerId];
|
||||||
}
|
}
|
||||||
|
|
||||||
otId = GetMonData(mon, MON_DATA_OT_ID);
|
otId = GetMonData(mon, MON_DATA_OT_ID);
|
||||||
position = GetBattlerPosition(bank);
|
position = GetBattlerPosition(battlerId);
|
||||||
|
|
||||||
if (sub_80688F8(1, bank) == 1 || gBattleSpritesDataPtr->battlerData[bank].transformSpecies != SPECIES_NONE)
|
if (sub_80688F8(1, battlerId) == 1 || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != SPECIES_NONE)
|
||||||
{
|
{
|
||||||
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[species],
|
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[species],
|
||||||
gMonSpritesGfxPtr->sprites[position],
|
gMonSpritesGfxPtr->sprites[position],
|
||||||
@@ -618,28 +619,28 @@ void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 bank)
|
|||||||
species, currentPersonality);
|
species, currentPersonality);
|
||||||
}
|
}
|
||||||
|
|
||||||
paletteOffset = 0x100 + bank * 16;
|
paletteOffset = 0x100 + battlerId * 16;
|
||||||
|
|
||||||
if (gBattleSpritesDataPtr->battlerData[bank].transformSpecies == SPECIES_NONE)
|
if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies == SPECIES_NONE)
|
||||||
lzPaletteData = GetMonFrontSpritePal(mon);
|
lzPaletteData = GetMonFrontSpritePal(mon);
|
||||||
else
|
else
|
||||||
lzPaletteData = GetFrontSpritePalFromSpeciesAndPersonality(species, otId, monsPersonality);
|
lzPaletteData = GetFrontSpritePalFromSpeciesAndPersonality(species, otId, monsPersonality);
|
||||||
|
|
||||||
LZDecompressWram(lzPaletteData, gDecompressionBuffer);
|
LZDecompressWram(lzPaletteData, gDecompressionBuffer);
|
||||||
LoadPalette(gDecompressionBuffer, paletteOffset, 0x20);
|
LoadPalette(gDecompressionBuffer, paletteOffset, 0x20);
|
||||||
LoadPalette(gDecompressionBuffer, 0x80 + bank * 16, 0x20);
|
LoadPalette(gDecompressionBuffer, 0x80 + battlerId * 16, 0x20);
|
||||||
|
|
||||||
if (species == SPECIES_CASTFORM)
|
if (species == SPECIES_CASTFORM)
|
||||||
{
|
{
|
||||||
paletteOffset = 0x100 + bank * 16;
|
paletteOffset = 0x100 + battlerId * 16;
|
||||||
LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette[0]);
|
LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette[0]);
|
||||||
LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[bank]], paletteOffset, 0x20);
|
LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerId]], paletteOffset, 0x20);
|
||||||
}
|
}
|
||||||
|
|
||||||
// transform's pink color
|
// transform's pink color
|
||||||
if (gBattleSpritesDataPtr->battlerData[bank].transformSpecies != SPECIES_NONE)
|
if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != SPECIES_NONE)
|
||||||
{
|
{
|
||||||
BlendPalette(paletteOffset, 16, 6, 0x7FFF);
|
BlendPalette(paletteOffset, 16, 6, RGB_WHITE);
|
||||||
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, 32);
|
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, 32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -652,23 +653,23 @@ void nullsub_24(u16 species)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecompressTrainerFrontPic(u16 frontPicId, u8 bank)
|
void DecompressTrainerFrontPic(u16 frontPicId, u8 battlerId)
|
||||||
{
|
{
|
||||||
u8 position = GetBattlerPosition(bank);
|
u8 position = GetBattlerPosition(battlerId);
|
||||||
DecompressPicFromTable_2(&gTrainerFrontPicTable[frontPicId],
|
DecompressPicFromTable_2(&gTrainerFrontPicTable[frontPicId],
|
||||||
gMonSpritesGfxPtr->sprites[position],
|
gMonSpritesGfxPtr->sprites[position],
|
||||||
SPECIES_NONE);
|
SPECIES_NONE);
|
||||||
LoadCompressedObjectPalette(&gTrainerFrontPicPaletteTable[frontPicId]);
|
LoadCompressedObjectPalette(&gTrainerFrontPicPaletteTable[frontPicId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecompressTrainerBackPic(u16 backPicId, u8 bank)
|
void DecompressTrainerBackPic(u16 backPicId, u8 battlerId)
|
||||||
{
|
{
|
||||||
u8 position = GetBattlerPosition(bank);
|
u8 position = GetBattlerPosition(battlerId);
|
||||||
DecompressPicFromTable_2(&gTrainerBackPicTable[backPicId],
|
DecompressPicFromTable_2(&gTrainerBackPicTable[backPicId],
|
||||||
gMonSpritesGfxPtr->sprites[position],
|
gMonSpritesGfxPtr->sprites[position],
|
||||||
SPECIES_NONE);
|
SPECIES_NONE);
|
||||||
LoadCompressedPalette(gTrainerBackPicPaletteTable[backPicId].data,
|
LoadCompressedPalette(gTrainerBackPicPaletteTable[backPicId].data,
|
||||||
0x100 + 16 * bank, 0x20);
|
0x100 + 16 * battlerId, 0x20);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nullsub_25(u8 arg0)
|
void nullsub_25(u8 arg0)
|
||||||
@@ -765,7 +766,7 @@ void LoadBattleBarGfx(u8 arg0)
|
|||||||
LZDecompressWram(gUnknown_08C093F0, gMonSpritesGfxPtr->barFontGfx);
|
LZDecompressWram(gUnknown_08C093F0, gMonSpritesGfxPtr->barFontGfx);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 BattleInitAllSprites(u8 *state1, u8 *bank)
|
bool8 BattleInitAllSprites(u8 *state1, u8 *battlerId)
|
||||||
{
|
{
|
||||||
bool8 retVal = FALSE;
|
bool8 retVal = FALSE;
|
||||||
|
|
||||||
@@ -776,13 +777,13 @@ bool8 BattleInitAllSprites(u8 *state1, u8 *bank)
|
|||||||
(*state1)++;
|
(*state1)++;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (!BattleLoadAllHealthBoxesGfx(*bank))
|
if (!BattleLoadAllHealthBoxesGfx(*battlerId))
|
||||||
{
|
{
|
||||||
(*bank)++;
|
(*battlerId)++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*bank = 0;
|
*battlerId = 0;
|
||||||
(*state1)++;
|
(*state1)++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -790,47 +791,47 @@ bool8 BattleInitAllSprites(u8 *state1, u8 *bank)
|
|||||||
(*state1)++;
|
(*state1)++;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if ((gBattleTypeFlags & BATTLE_TYPE_SAFARI) && *bank == 0)
|
if ((gBattleTypeFlags & BATTLE_TYPE_SAFARI) && *battlerId == 0)
|
||||||
gHealthboxSpriteIds[*bank] = CreateSafariPlayerHealthboxSprites();
|
gHealthboxSpriteIds[*battlerId] = CreateSafariPlayerHealthboxSprites();
|
||||||
else
|
else
|
||||||
gHealthboxSpriteIds[*bank] = CreateBattlerHealthboxSprites(*bank);
|
gHealthboxSpriteIds[*battlerId] = CreateBattlerHealthboxSprites(*battlerId);
|
||||||
|
|
||||||
(*bank)++;
|
(*battlerId)++;
|
||||||
if (*bank == gBattlersCount)
|
if (*battlerId == gBattlersCount)
|
||||||
{
|
{
|
||||||
*bank = 0;
|
*battlerId = 0;
|
||||||
(*state1)++;
|
(*state1)++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
InitBattlerHealthboxCoords(*bank);
|
InitBattlerHealthboxCoords(*battlerId);
|
||||||
if (gBattlerPositions[*bank] <= 1)
|
if (gBattlerPositions[*battlerId] <= 1)
|
||||||
DummyBattleInterfaceFunc(gHealthboxSpriteIds[*bank], FALSE);
|
DummyBattleInterfaceFunc(gHealthboxSpriteIds[*battlerId], FALSE);
|
||||||
else
|
else
|
||||||
DummyBattleInterfaceFunc(gHealthboxSpriteIds[*bank], TRUE);
|
DummyBattleInterfaceFunc(gHealthboxSpriteIds[*battlerId], TRUE);
|
||||||
|
|
||||||
(*bank)++;
|
(*battlerId)++;
|
||||||
if (*bank == gBattlersCount)
|
if (*battlerId == gBattlersCount)
|
||||||
{
|
{
|
||||||
*bank = 0;
|
*battlerId = 0;
|
||||||
(*state1)++;
|
(*state1)++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
if (GetBattlerSide(*bank) == B_SIDE_PLAYER)
|
if (GetBattlerSide(*battlerId) == B_SIDE_PLAYER)
|
||||||
{
|
{
|
||||||
if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI))
|
if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI))
|
||||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[*bank], &gPlayerParty[gBattlerPartyIndexes[*bank]], HEALTHBOX_ALL);
|
UpdateHealthboxAttribute(gHealthboxSpriteIds[*battlerId], &gPlayerParty[gBattlerPartyIndexes[*battlerId]], HEALTHBOX_ALL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[*bank], &gEnemyParty[gBattlerPartyIndexes[*bank]], HEALTHBOX_ALL);
|
UpdateHealthboxAttribute(gHealthboxSpriteIds[*battlerId], &gEnemyParty[gBattlerPartyIndexes[*battlerId]], HEALTHBOX_ALL);
|
||||||
}
|
}
|
||||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[*bank]);
|
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[*battlerId]);
|
||||||
(*bank)++;
|
(*battlerId)++;
|
||||||
if (*bank == gBattlersCount)
|
if (*battlerId == gBattlersCount)
|
||||||
{
|
{
|
||||||
*bank = 0;
|
*battlerId = 0;
|
||||||
(*state1)++;
|
(*state1)++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -864,9 +865,9 @@ void CopyAllBattleSpritesInvisibilities(void)
|
|||||||
gBattleSpritesDataPtr->battlerData[i].invisible = gSprites[gBattlerSpriteIds[i]].invisible;
|
gBattleSpritesDataPtr->battlerData[i].invisible = gSprites[gBattlerSpriteIds[i]].invisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CopyBattleSpriteInvisibility(u8 bank)
|
void CopyBattleSpriteInvisibility(u8 battlerId)
|
||||||
{
|
{
|
||||||
gBattleSpritesDataPtr->battlerData[bank].invisible = gSprites[gBattlerSpriteIds[bank]].invisible;
|
gBattleSpritesDataPtr->battlerData[battlerId].invisible = gSprites[gBattlerSpriteIds[battlerId]].invisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform)
|
void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform)
|
||||||
@@ -885,7 +886,7 @@ void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform)
|
|||||||
gBattleMonForms[bankAtk] = gBattleSpritesDataPtr->animationData->animArg;
|
gBattleMonForms[bankAtk] = gBattleSpritesDataPtr->animationData->animArg;
|
||||||
if (gBattleSpritesDataPtr->battlerData[bankAtk].transformSpecies != SPECIES_NONE)
|
if (gBattleSpritesDataPtr->battlerData[bankAtk].transformSpecies != SPECIES_NONE)
|
||||||
{
|
{
|
||||||
BlendPalette(paletteOffset, 16, 6, 0x7FFF);
|
BlendPalette(paletteOffset, 16, 6, RGB_WHITE);
|
||||||
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, 32);
|
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, 32);
|
||||||
}
|
}
|
||||||
gSprites[gBattlerSpriteIds[bankAtk]].pos1.y = GetBattlerSpriteDefault_Y(bankAtk);
|
gSprites[gBattlerSpriteIds[bankAtk]].pos1.y = GetBattlerSpriteDefault_Y(bankAtk);
|
||||||
@@ -954,7 +955,7 @@ void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform)
|
|||||||
LoadPalette(gBattleStruct->castformPalette[0] + gBattleMonForms[bankDef] * 16, paletteOffset, 32);
|
LoadPalette(gBattleStruct->castformPalette[0] + gBattleMonForms[bankDef] * 16, paletteOffset, 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
BlendPalette(paletteOffset, 16, 6, 0x7FFF);
|
BlendPalette(paletteOffset, 16, 6, RGB_WHITE);
|
||||||
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, 32);
|
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, 32);
|
||||||
|
|
||||||
if (!IsContest())
|
if (!IsContest())
|
||||||
@@ -968,7 +969,7 @@ void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleLoadSubstituteOrMonSpriteGfx(u8 bank, bool8 loadMonSprite)
|
void BattleLoadSubstituteOrMonSpriteGfx(u8 battlerId, bool8 loadMonSprite)
|
||||||
{
|
{
|
||||||
u8 position;
|
u8 position;
|
||||||
s32 i;
|
s32 i;
|
||||||
@@ -980,17 +981,17 @@ void BattleLoadSubstituteOrMonSpriteGfx(u8 bank, bool8 loadMonSprite)
|
|||||||
if (IsContest())
|
if (IsContest())
|
||||||
position = 0;
|
position = 0;
|
||||||
else
|
else
|
||||||
position = GetBattlerPosition(bank);
|
position = GetBattlerPosition(battlerId);
|
||||||
|
|
||||||
if (IsContest())
|
if (IsContest())
|
||||||
LZDecompressVram(gSubstituteDollTilemap, gMonSpritesGfxPtr->sprites[position]);
|
LZDecompressVram(gSubstituteDollTilemap, gMonSpritesGfxPtr->sprites[position]);
|
||||||
else if (GetBattlerSide(bank) != B_SIDE_PLAYER)
|
else if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
|
||||||
LZDecompressVram(gSubstituteDollGfx, gMonSpritesGfxPtr->sprites[position]);
|
LZDecompressVram(gSubstituteDollGfx, gMonSpritesGfxPtr->sprites[position]);
|
||||||
else
|
else
|
||||||
LZDecompressVram(gSubstituteDollTilemap, gMonSpritesGfxPtr->sprites[position]);
|
LZDecompressVram(gSubstituteDollTilemap, gMonSpritesGfxPtr->sprites[position]);
|
||||||
|
|
||||||
i = 1;
|
i = 1;
|
||||||
var = bank * 16;
|
var = battlerId * 16;
|
||||||
substitutePal = gSubstituteDollPal;
|
substitutePal = gSubstituteDollPal;
|
||||||
for (; i < 4; i++)
|
for (; i < 4; i++)
|
||||||
{
|
{
|
||||||
@@ -1007,59 +1008,59 @@ void BattleLoadSubstituteOrMonSpriteGfx(u8 bank, bool8 loadMonSprite)
|
|||||||
{
|
{
|
||||||
if (!IsContest())
|
if (!IsContest())
|
||||||
{
|
{
|
||||||
if (GetBattlerSide(bank) != B_SIDE_PLAYER)
|
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
|
||||||
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[bank]], bank);
|
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||||
else
|
else
|
||||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[bank]], bank);
|
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadBattleMonGfxAndAnimate(u8 bank, bool8 loadMonSprite, u8 spriteId)
|
void LoadBattleMonGfxAndAnimate(u8 battlerId, bool8 loadMonSprite, u8 spriteId)
|
||||||
{
|
{
|
||||||
BattleLoadSubstituteOrMonSpriteGfx(bank, loadMonSprite);
|
BattleLoadSubstituteOrMonSpriteGfx(battlerId, loadMonSprite);
|
||||||
StartSpriteAnim(&gSprites[spriteId], gBattleMonForms[bank]);
|
StartSpriteAnim(&gSprites[spriteId], gBattleMonForms[battlerId]);
|
||||||
|
|
||||||
if (!loadMonSprite)
|
if (!loadMonSprite)
|
||||||
gSprites[spriteId].pos1.y = GetSubstituteSpriteDefault_Y(bank);
|
gSprites[spriteId].pos1.y = GetSubstituteSpriteDefault_Y(battlerId);
|
||||||
else
|
else
|
||||||
gSprites[spriteId].pos1.y = GetBattlerSpriteDefault_Y(bank);
|
gSprites[spriteId].pos1.y = GetBattlerSpriteDefault_Y(battlerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrySetBehindSubstituteSpriteBit(u8 bank, u16 move)
|
void TrySetBehindSubstituteSpriteBit(u8 battlerId, u16 move)
|
||||||
{
|
{
|
||||||
if (move == MOVE_SUBSTITUTE)
|
if (move == MOVE_SUBSTITUTE)
|
||||||
gBattleSpritesDataPtr->battlerData[bank].behindSubstitute = 1;
|
gBattleSpritesDataPtr->battlerData[battlerId].behindSubstitute = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearBehindSubstituteBit(u8 bank)
|
void ClearBehindSubstituteBit(u8 battlerId)
|
||||||
{
|
{
|
||||||
gBattleSpritesDataPtr->battlerData[bank].behindSubstitute = 0;
|
gBattleSpritesDataPtr->battlerData[battlerId].behindSubstitute = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleLowHpMusicChange(struct Pokemon *mon, u8 bank)
|
void HandleLowHpMusicChange(struct Pokemon *mon, u8 battlerId)
|
||||||
{
|
{
|
||||||
u16 hp = GetMonData(mon, MON_DATA_HP);
|
u16 hp = GetMonData(mon, MON_DATA_HP);
|
||||||
u16 maxHP = GetMonData(mon, MON_DATA_MAX_HP);
|
u16 maxHP = GetMonData(mon, MON_DATA_MAX_HP);
|
||||||
|
|
||||||
if (GetHPBarLevel(hp, maxHP) == HP_BAR_RED)
|
if (GetHPBarLevel(hp, maxHP) == HP_BAR_RED)
|
||||||
{
|
{
|
||||||
if (!gBattleSpritesDataPtr->battlerData[bank].lowHpSong)
|
if (!gBattleSpritesDataPtr->battlerData[battlerId].lowHpSong)
|
||||||
{
|
{
|
||||||
if (!gBattleSpritesDataPtr->battlerData[bank ^ BIT_FLANK].lowHpSong)
|
if (!gBattleSpritesDataPtr->battlerData[battlerId ^ BIT_FLANK].lowHpSong)
|
||||||
PlaySE(SE_HINSI);
|
PlaySE(SE_HINSI);
|
||||||
gBattleSpritesDataPtr->battlerData[bank].lowHpSong = 1;
|
gBattleSpritesDataPtr->battlerData[battlerId].lowHpSong = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gBattleSpritesDataPtr->battlerData[bank].lowHpSong = 0;
|
gBattleSpritesDataPtr->battlerData[battlerId].lowHpSong = 0;
|
||||||
if (!IsDoubleBattle())
|
if (!IsDoubleBattle())
|
||||||
{
|
{
|
||||||
m4aSongNumStop(SE_HINSI);
|
m4aSongNumStop(SE_HINSI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (IsDoubleBattle() && !gBattleSpritesDataPtr->battlerData[bank ^ BIT_FLANK].lowHpSong)
|
if (IsDoubleBattle() && !gBattleSpritesDataPtr->battlerData[battlerId ^ BIT_FLANK].lowHpSong)
|
||||||
{
|
{
|
||||||
m4aSongNumStop(SE_HINSI);
|
m4aSongNumStop(SE_HINSI);
|
||||||
return;
|
return;
|
||||||
@@ -1124,44 +1125,44 @@ void sub_805EB9C(u8 affineMode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define tBank data[0]
|
#define tBattlerId data[0]
|
||||||
|
|
||||||
void LoadAndCreateEnemyShadowSprites(void)
|
void LoadAndCreateEnemyShadowSprites(void)
|
||||||
{
|
{
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
|
|
||||||
LoadCompressedObjectPic(&gSpriteSheet_EnemyShadow);
|
LoadCompressedObjectPic(&gSpriteSheet_EnemyShadow);
|
||||||
|
|
||||||
bank = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
|
battlerId = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
|
||||||
gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, GetBattlerSpriteCoord(bank, 0), GetBattlerSpriteCoord(bank, 1) + 29, 0xC8);
|
gBattleSpritesDataPtr->healthBoxesData[battlerId].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, GetBattlerSpriteCoord(battlerId, 0), GetBattlerSpriteCoord(battlerId, 1) + 29, 0xC8);
|
||||||
gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].data[0] = bank;
|
gSprites[gBattleSpritesDataPtr->healthBoxesData[battlerId].shadowSpriteId].data[0] = battlerId;
|
||||||
|
|
||||||
if (IsDoubleBattle())
|
if (IsDoubleBattle())
|
||||||
{
|
{
|
||||||
bank = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
|
battlerId = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
|
||||||
gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, GetBattlerSpriteCoord(bank, 0), GetBattlerSpriteCoord(bank, 1) + 29, 0xC8);
|
gBattleSpritesDataPtr->healthBoxesData[battlerId].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, GetBattlerSpriteCoord(battlerId, 0), GetBattlerSpriteCoord(battlerId, 1) + 29, 0xC8);
|
||||||
gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].data[0] = bank;
|
gSprites[gBattleSpritesDataPtr->healthBoxesData[battlerId].shadowSpriteId].data[0] = battlerId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteCB_EnemyShadow(struct Sprite *shadowSprite)
|
void SpriteCB_EnemyShadow(struct Sprite *shadowSprite)
|
||||||
{
|
{
|
||||||
bool8 invisible = FALSE;
|
bool8 invisible = FALSE;
|
||||||
u8 bank = shadowSprite->tBank;
|
u8 battlerId = shadowSprite->tBattlerId;
|
||||||
struct Sprite *bankSprite = &gSprites[gBattlerSpriteIds[bank]];
|
struct Sprite *bankSprite = &gSprites[gBattlerSpriteIds[battlerId]];
|
||||||
|
|
||||||
if (!bankSprite->inUse || !IsBattlerSpritePresent(bank))
|
if (!bankSprite->inUse || !IsBattlerSpritePresent(battlerId))
|
||||||
{
|
{
|
||||||
shadowSprite->callback = SpriteCB_SetInvisible;
|
shadowSprite->callback = SpriteCB_SetInvisible;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (gAnimScriptActive || bankSprite->invisible)
|
if (gAnimScriptActive || bankSprite->invisible)
|
||||||
invisible = TRUE;
|
invisible = TRUE;
|
||||||
else if (gBattleSpritesDataPtr->battlerData[bank].transformSpecies != SPECIES_NONE
|
else if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != SPECIES_NONE
|
||||||
&& gEnemyMonElevation[gBattleSpritesDataPtr->battlerData[bank].transformSpecies] == 0)
|
&& gEnemyMonElevation[gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies] == 0)
|
||||||
invisible = TRUE;
|
invisible = TRUE;
|
||||||
|
|
||||||
if (gBattleSpritesDataPtr->battlerData[bank].behindSubstitute)
|
if (gBattleSpritesDataPtr->battlerData[battlerId].behindSubstitute)
|
||||||
invisible = TRUE;
|
invisible = TRUE;
|
||||||
|
|
||||||
shadowSprite->pos1.x = bankSprite->pos1.x;
|
shadowSprite->pos1.x = bankSprite->pos1.x;
|
||||||
@@ -1169,31 +1170,31 @@ void SpriteCB_EnemyShadow(struct Sprite *shadowSprite)
|
|||||||
shadowSprite->invisible = invisible;
|
shadowSprite->invisible = invisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef tBank
|
#undef tBattlerId
|
||||||
|
|
||||||
void SpriteCB_SetInvisible(struct Sprite *sprite)
|
void SpriteCB_SetInvisible(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
sprite->invisible = 1;
|
sprite->invisible = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetBattlerShadowSpriteCallback(u8 bank, u16 species)
|
void SetBattlerShadowSpriteCallback(u8 battlerId, u16 species)
|
||||||
{
|
{
|
||||||
// The player's shadow is never seen
|
// The player's shadow is never seen
|
||||||
if (GetBattlerSide(bank) == B_SIDE_PLAYER)
|
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gBattleSpritesDataPtr->battlerData[bank].transformSpecies != SPECIES_NONE)
|
if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != SPECIES_NONE)
|
||||||
species = gBattleSpritesDataPtr->battlerData[bank].transformSpecies;
|
species = gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies;
|
||||||
|
|
||||||
if (gEnemyMonElevation[species] != 0)
|
if (gEnemyMonElevation[species] != 0)
|
||||||
gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].callback = SpriteCB_EnemyShadow;
|
gSprites[gBattleSpritesDataPtr->healthBoxesData[battlerId].shadowSpriteId].callback = SpriteCB_EnemyShadow;
|
||||||
else
|
else
|
||||||
gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].callback = SpriteCB_SetInvisible;
|
gSprites[gBattleSpritesDataPtr->healthBoxesData[battlerId].shadowSpriteId].callback = SpriteCB_SetInvisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HideBattlerShadowSprite(u8 bank)
|
void HideBattlerShadowSprite(u8 battlerId)
|
||||||
{
|
{
|
||||||
gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].callback = SpriteCB_SetInvisible;
|
gSprites[gBattleSpritesDataPtr->healthBoxesData[battlerId].shadowSpriteId].callback = SpriteCB_SetInvisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_805EF14(void)
|
void sub_805EF14(void)
|
||||||
@@ -1219,12 +1220,12 @@ void sub_805EF14(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearTemporarySpeciesSpriteData(u8 bank, bool8 dontClearSubstitute)
|
void ClearTemporarySpeciesSpriteData(u8 battlerId, bool8 dontClearSubstitute)
|
||||||
{
|
{
|
||||||
gBattleSpritesDataPtr->battlerData[bank].transformSpecies = SPECIES_NONE;
|
gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies = SPECIES_NONE;
|
||||||
gBattleMonForms[bank] = 0;
|
gBattleMonForms[battlerId] = 0;
|
||||||
if (!dontClearSubstitute)
|
if (!dontClearSubstitute)
|
||||||
ClearBehindSubstituteBit(bank);
|
ClearBehindSubstituteBit(battlerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AllocateMonSpritesGfx(void)
|
void AllocateMonSpritesGfx(void)
|
||||||
|
|||||||
+7
-7
@@ -232,7 +232,7 @@ EWRAM_DATA u8 gBattlerAttacker = 0;
|
|||||||
EWRAM_DATA u8 gBattlerTarget = 0;
|
EWRAM_DATA u8 gBattlerTarget = 0;
|
||||||
EWRAM_DATA u8 gBattlerFainted = 0;
|
EWRAM_DATA u8 gBattlerFainted = 0;
|
||||||
EWRAM_DATA u8 gEffectBattler = 0;
|
EWRAM_DATA u8 gEffectBattler = 0;
|
||||||
EWRAM_DATA u8 gStringBattler = 0;
|
EWRAM_DATA u8 gPotentialItemEffectBattler = 0;
|
||||||
EWRAM_DATA u8 gAbsentBattlerFlags = 0;
|
EWRAM_DATA u8 gAbsentBattlerFlags = 0;
|
||||||
EWRAM_DATA u8 gCritMultiplier = 0;
|
EWRAM_DATA u8 gCritMultiplier = 0;
|
||||||
EWRAM_DATA u8 gMultiHitCounter = 0;
|
EWRAM_DATA u8 gMultiHitCounter = 0;
|
||||||
@@ -3815,7 +3815,7 @@ u8 IsRunningFromBattleImpossible(void)
|
|||||||
else
|
else
|
||||||
holdEffect = ItemId_GetHoldEffect(gBattleMons[gActiveBattler].item);
|
holdEffect = ItemId_GetHoldEffect(gBattleMons[gActiveBattler].item);
|
||||||
|
|
||||||
gStringBattler = gActiveBattler;
|
gPotentialItemEffectBattler = gActiveBattler;
|
||||||
|
|
||||||
if (holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN)
|
if (holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -4417,8 +4417,8 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves)
|
|||||||
}
|
}
|
||||||
|
|
||||||
speedBattler1 = (gBattleMons[battler1].speed * speedMultiplierBattler1)
|
speedBattler1 = (gBattleMons[battler1].speed * speedMultiplierBattler1)
|
||||||
* (gStatStageRatios[gBattleMons[battler1].statStages[STAT_STAGE_SPEED]][0])
|
* (gStatStageRatios[gBattleMons[battler1].statStages[STAT_SPEED]][0])
|
||||||
/ (gStatStageRatios[gBattleMons[battler1].statStages[STAT_STAGE_SPEED]][1]);
|
/ (gStatStageRatios[gBattleMons[battler1].statStages[STAT_SPEED]][1]);
|
||||||
|
|
||||||
if (gBattleMons[battler1].item == ITEM_ENIGMA_BERRY)
|
if (gBattleMons[battler1].item == ITEM_ENIGMA_BERRY)
|
||||||
{
|
{
|
||||||
@@ -4451,8 +4451,8 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves)
|
|||||||
// check second battlerId's speed
|
// check second battlerId's speed
|
||||||
|
|
||||||
speedBattler2 = (gBattleMons[battler2].speed * speedMultiplierBattler2)
|
speedBattler2 = (gBattleMons[battler2].speed * speedMultiplierBattler2)
|
||||||
* (gStatStageRatios[gBattleMons[battler2].statStages[STAT_STAGE_SPEED]][0])
|
* (gStatStageRatios[gBattleMons[battler2].statStages[STAT_SPEED]][0])
|
||||||
/ (gStatStageRatios[gBattleMons[battler2].statStages[STAT_STAGE_SPEED]][1]);
|
/ (gStatStageRatios[gBattleMons[battler2].statStages[STAT_SPEED]][1]);
|
||||||
|
|
||||||
if (gBattleMons[battler2].item == ITEM_ENIGMA_BERRY)
|
if (gBattleMons[battler2].item == ITEM_ENIGMA_BERRY)
|
||||||
{
|
{
|
||||||
@@ -5380,7 +5380,7 @@ bool8 TryRunFromBattle(u8 battler)
|
|||||||
else
|
else
|
||||||
holdEffect = ItemId_GetHoldEffect(gBattleMons[battler].item);
|
holdEffect = ItemId_GetHoldEffect(gBattleMons[battler].item);
|
||||||
|
|
||||||
gStringBattler = battler;
|
gPotentialItemEffectBattler = battler;
|
||||||
|
|
||||||
if (holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN)
|
if (holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1421,7 +1421,7 @@ void BufferStringBattle(u16 stringID)
|
|||||||
gBattleScripting.battler = gStringInfo->scrActive;
|
gBattleScripting.battler = gStringInfo->scrActive;
|
||||||
*(&gBattleStruct->field_52) = gStringInfo->unk1605E;
|
*(&gBattleStruct->field_52) = gStringInfo->unk1605E;
|
||||||
*(&gBattleStruct->hpScale) = gStringInfo->hpScale;
|
*(&gBattleStruct->hpScale) = gStringInfo->hpScale;
|
||||||
gStringBattler = gStringInfo->StringBank;
|
gPotentialItemEffectBattler = gStringInfo->StringBank;
|
||||||
*(&gBattleStruct->stringMoveType) = gStringInfo->moveType;
|
*(&gBattleStruct->stringMoveType) = gStringInfo->moveType;
|
||||||
|
|
||||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||||
@@ -1915,10 +1915,10 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst)
|
|||||||
{
|
{
|
||||||
if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI))
|
if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI))
|
||||||
{
|
{
|
||||||
if ((gBattleScripting.multiplayerId != 0 && (gStringBattler & BIT_SIDE))
|
if ((gBattleScripting.multiplayerId != 0 && (gPotentialItemEffectBattler & BIT_SIDE))
|
||||||
|| (gBattleScripting.multiplayerId == 0 && !(gStringBattler & BIT_SIDE)))
|
|| (gBattleScripting.multiplayerId == 0 && !(gPotentialItemEffectBattler & BIT_SIDE)))
|
||||||
{
|
{
|
||||||
StringCopy(text, gEnigmaBerries[gStringBattler].name);
|
StringCopy(text, gEnigmaBerries[gPotentialItemEffectBattler].name);
|
||||||
StringAppend(text, gText_BerrySuffix);
|
StringAppend(text, gText_BerrySuffix);
|
||||||
toCpy = text;
|
toCpy = text;
|
||||||
}
|
}
|
||||||
@@ -1929,9 +1929,9 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gLinkPlayers[gBattleScripting.multiplayerId].lp_field_18 == gStringBattler)
|
if (gLinkPlayers[gBattleScripting.multiplayerId].lp_field_18 == gPotentialItemEffectBattler)
|
||||||
{
|
{
|
||||||
StringCopy(text, gEnigmaBerries[gStringBattler].name);
|
StringCopy(text, gEnigmaBerries[gPotentialItemEffectBattler].name);
|
||||||
StringAppend(text, gText_BerrySuffix);
|
StringAppend(text, gText_BerrySuffix);
|
||||||
toCpy = text;
|
toCpy = text;
|
||||||
}
|
}
|
||||||
@@ -2298,9 +2298,9 @@ static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst)
|
|||||||
{
|
{
|
||||||
if (hword == ITEM_ENIGMA_BERRY)
|
if (hword == ITEM_ENIGMA_BERRY)
|
||||||
{
|
{
|
||||||
if (gLinkPlayers[gBattleScripting.multiplayerId].lp_field_18 == gStringBattler)
|
if (gLinkPlayers[gBattleScripting.multiplayerId].lp_field_18 == gPotentialItemEffectBattler)
|
||||||
{
|
{
|
||||||
StringCopy(dst, gEnigmaBerries[gStringBattler].name);
|
StringCopy(dst, gEnigmaBerries[gPotentialItemEffectBattler].name);
|
||||||
StringAppend(dst, gText_BerrySuffix);
|
StringAppend(dst, gText_BerrySuffix);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ extern const struct TrainerMoney gTrainerMoneyTable[];
|
|||||||
extern const u8* const gBattleScriptsForMoveEffects[];
|
extern const u8* const gBattleScriptsForMoveEffects[];
|
||||||
|
|
||||||
// functions
|
// functions
|
||||||
extern void sub_81A5718(u8 bank); // battle frontier 2
|
extern void sub_81A5718(u8 battlerId); // battle frontier 2
|
||||||
extern void sub_81A56B4(void); // battle frontier 2
|
extern void sub_81A56B4(void); // battle frontier 2
|
||||||
extern void sub_81BFA38(struct Pokemon* party, u8 monPartyId, u8 monCount, void (*callback)(void), u16 move); // pokemon summary screen
|
extern void sub_81BFA38(struct Pokemon* party, u8 monPartyId, u8 monCount, void (*callback)(void), u16 move); // pokemon summary screen
|
||||||
extern u8 sub_81C1B94(void); // pokemon summary screen
|
extern u8 sub_81C1B94(void); // pokemon summary screen
|
||||||
@@ -73,7 +73,7 @@ extern u8* GetMonNickname(struct Pokemon* mon, u8* dst); // party_menu
|
|||||||
extern u8 sub_81A5258(u8* arg0); // battle frontier 2
|
extern u8 sub_81A5258(u8* arg0); // battle frontier 2
|
||||||
extern void sub_81A5BF8(void); // battle frontier 2
|
extern void sub_81A5BF8(void); // battle frontier 2
|
||||||
extern void sub_81A5D44(void); // battle frontier 2
|
extern void sub_81A5D44(void); // battle frontier 2
|
||||||
extern void sub_81B8E80(u8 bank, u8, u8); // party menu
|
extern void sub_81B8E80(u8 battlerId, u8, u8); // party menu
|
||||||
extern bool8 sub_81B1250(void); // ?
|
extern bool8 sub_81B1250(void); // ?
|
||||||
extern bool8 InBattlePike(void);
|
extern bool8 InBattlePike(void);
|
||||||
extern bool8 InBattlePyramid(void);
|
extern bool8 InBattlePyramid(void);
|
||||||
@@ -104,7 +104,7 @@ extern const u8 gText_BattleYesNoChoice[];
|
|||||||
// this file's functions
|
// this file's functions
|
||||||
static bool8 IsTwoTurnsMove(u16 move);
|
static bool8 IsTwoTurnsMove(u16 move);
|
||||||
static void TrySetDestinyBondToHappen(void);
|
static void TrySetDestinyBondToHappen(void);
|
||||||
static u8 AttacksThisTurn(u8 bank, u16 move); // Note: returns 1 if it's a charging turn, otherwise 2.
|
static u8 AttacksThisTurn(u8 battlerId, u16 move); // Note: returns 1 if it's a charging turn, otherwise 2.
|
||||||
static void CheckWonderGuardAndLevitate(void);
|
static void CheckWonderGuardAndLevitate(void);
|
||||||
static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8, const u8* BS_ptr);
|
static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8, const u8* BS_ptr);
|
||||||
static bool32 IsMonGettingExpSentOut(void);
|
static bool32 IsMonGettingExpSentOut(void);
|
||||||
@@ -1174,13 +1174,13 @@ static void atk01_accuracycheck(void)
|
|||||||
|
|
||||||
if (gBattleMons[gBattlerTarget].status2 & STATUS2_FORESIGHT)
|
if (gBattleMons[gBattlerTarget].status2 & STATUS2_FORESIGHT)
|
||||||
{
|
{
|
||||||
u8 acc = gBattleMons[gBattlerAttacker].statStages[STAT_STAGE_ACC];
|
u8 acc = gBattleMons[gBattlerAttacker].statStages[STAT_ACC];
|
||||||
buff = acc;
|
buff = acc;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
u8 acc = gBattleMons[gBattlerAttacker].statStages[STAT_STAGE_ACC];
|
u8 acc = gBattleMons[gBattlerAttacker].statStages[STAT_ACC];
|
||||||
buff = acc + 6 - gBattleMons[gBattlerTarget].statStages[STAT_STAGE_EVASION];
|
buff = acc + 6 - gBattleMons[gBattlerTarget].statStages[STAT_EVASION];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buff < 0)
|
if (buff < 0)
|
||||||
@@ -1214,7 +1214,7 @@ static void atk01_accuracycheck(void)
|
|||||||
param = ItemId_GetHoldEffectParam(gBattleMons[gBattlerTarget].item);
|
param = ItemId_GetHoldEffectParam(gBattleMons[gBattlerTarget].item);
|
||||||
}
|
}
|
||||||
|
|
||||||
gStringBattler = gBattlerTarget;
|
gPotentialItemEffectBattler = gBattlerTarget;
|
||||||
|
|
||||||
if (holdEffect == HOLD_EFFECT_EVASION_UP)
|
if (holdEffect == HOLD_EFFECT_EVASION_UP)
|
||||||
calc = (calc * (100 - param)) / 100;
|
calc = (calc * (100 - param)) / 100;
|
||||||
@@ -1307,7 +1307,7 @@ static void atk04_critcalc(void)
|
|||||||
else
|
else
|
||||||
holdEffect = ItemId_GetHoldEffect(item);
|
holdEffect = ItemId_GetHoldEffect(item);
|
||||||
|
|
||||||
gStringBattler = gBattlerAttacker;
|
gPotentialItemEffectBattler = gBattlerAttacker;
|
||||||
|
|
||||||
critChance = 2 * ((gBattleMons[gBattlerAttacker].status2 & STATUS2_FOCUS_ENERGY) != 0)
|
critChance = 2 * ((gBattleMons[gBattlerAttacker].status2 & STATUS2_FOCUS_ENERGY) != 0)
|
||||||
+ (gBattleMoves[gCurrentMove].effect == EFFECT_HIGH_CRITICAL)
|
+ (gBattleMoves[gCurrentMove].effect == EFFECT_HIGH_CRITICAL)
|
||||||
@@ -1716,7 +1716,7 @@ static void atk07_adjustnormaldamage(void)
|
|||||||
param = ItemId_GetHoldEffectParam(gBattleMons[gBattlerTarget].item);
|
param = ItemId_GetHoldEffectParam(gBattleMons[gBattlerTarget].item);
|
||||||
}
|
}
|
||||||
|
|
||||||
gStringBattler = gBattlerTarget;
|
gPotentialItemEffectBattler = gBattlerTarget;
|
||||||
|
|
||||||
if (holdEffect == HOLD_EFFECT_FOCUS_BAND && (Random() % 100) < param)
|
if (holdEffect == HOLD_EFFECT_FOCUS_BAND && (Random() % 100) < param)
|
||||||
{
|
{
|
||||||
@@ -1765,7 +1765,7 @@ static void atk08_adjustnormaldamage2(void) // The same as 0x7 except it doesn't
|
|||||||
param = ItemId_GetHoldEffectParam(gBattleMons[gBattlerTarget].item);
|
param = ItemId_GetHoldEffectParam(gBattleMons[gBattlerTarget].item);
|
||||||
}
|
}
|
||||||
|
|
||||||
gStringBattler = gBattlerTarget;
|
gPotentialItemEffectBattler = gBattlerTarget;
|
||||||
|
|
||||||
if (holdEffect == HOLD_EFFECT_FOCUS_BAND && (Random() % 100) < param)
|
if (holdEffect == HOLD_EFFECT_FOCUS_BAND && (Random() % 100) < param)
|
||||||
{
|
{
|
||||||
@@ -1972,7 +1972,7 @@ static void atk0C_datahpupdate(void)
|
|||||||
if (!gSpecialStatuses[gActiveBattler].dmg && !(gHitMarker & HITMARKER_x100000))
|
if (!gSpecialStatuses[gActiveBattler].dmg && !(gHitMarker & HITMARKER_x100000))
|
||||||
gSpecialStatuses[gActiveBattler].dmg = gHpDealt;
|
gSpecialStatuses[gActiveBattler].dmg = gHpDealt;
|
||||||
|
|
||||||
if (moveType <= 8 && !(gHitMarker & HITMARKER_x100000) && gCurrentMove != MOVE_PAIN_SPLIT)
|
if (IS_MOVE_PHYSICAL(moveType) && !(gHitMarker & HITMARKER_x100000) && gCurrentMove != MOVE_PAIN_SPLIT)
|
||||||
{
|
{
|
||||||
gProtectStructs[gActiveBattler].physicalDmg = gHpDealt;
|
gProtectStructs[gActiveBattler].physicalDmg = gHpDealt;
|
||||||
gSpecialStatuses[gActiveBattler].physicalDmg = gHpDealt;
|
gSpecialStatuses[gActiveBattler].physicalDmg = gHpDealt;
|
||||||
@@ -1987,7 +1987,7 @@ static void atk0C_datahpupdate(void)
|
|||||||
gSpecialStatuses[gActiveBattler].physicalBattlerId = gBattlerTarget;
|
gSpecialStatuses[gActiveBattler].physicalBattlerId = gBattlerTarget;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (moveType > 8 && !(gHitMarker & HITMARKER_x100000))
|
else if (!IS_MOVE_PHYSICAL(moveType) && !(gHitMarker & HITMARKER_x100000))
|
||||||
{
|
{
|
||||||
gProtectStructs[gActiveBattler].specialDmg = gHpDealt;
|
gProtectStructs[gActiveBattler].specialDmg = gHpDealt;
|
||||||
gSpecialStatuses[gActiveBattler].specialDmg = gHpDealt;
|
gSpecialStatuses[gActiveBattler].specialDmg = gHpDealt;
|
||||||
@@ -2114,7 +2114,7 @@ static void atk0F_resultmessage(void)
|
|||||||
break;
|
break;
|
||||||
case MOVE_RESULT_FOE_HUNG_ON:
|
case MOVE_RESULT_FOE_HUNG_ON:
|
||||||
gLastUsedItem = gBattleMons[gBattlerTarget].item;
|
gLastUsedItem = gBattleMons[gBattlerTarget].item;
|
||||||
gStringBattler = gBattlerTarget;
|
gPotentialItemEffectBattler = gBattlerTarget;
|
||||||
gMoveResultFlags &= ~(MOVE_RESULT_FOE_ENDURED | MOVE_RESULT_FOE_HUNG_ON);
|
gMoveResultFlags &= ~(MOVE_RESULT_FOE_ENDURED | MOVE_RESULT_FOE_HUNG_ON);
|
||||||
BattleScriptPushCursor();
|
BattleScriptPushCursor();
|
||||||
gBattlescriptCurrInstr = BattleScript_HangedOnMsg;
|
gBattlescriptCurrInstr = BattleScript_HangedOnMsg;
|
||||||
@@ -2143,7 +2143,7 @@ static void atk0F_resultmessage(void)
|
|||||||
else if (gMoveResultFlags & MOVE_RESULT_FOE_HUNG_ON)
|
else if (gMoveResultFlags & MOVE_RESULT_FOE_HUNG_ON)
|
||||||
{
|
{
|
||||||
gLastUsedItem = gBattleMons[gBattlerTarget].item;
|
gLastUsedItem = gBattleMons[gBattlerTarget].item;
|
||||||
gStringBattler = gBattlerTarget;
|
gPotentialItemEffectBattler = gBattlerTarget;
|
||||||
gMoveResultFlags &= ~(MOVE_RESULT_FOE_ENDURED | MOVE_RESULT_FOE_HUNG_ON);
|
gMoveResultFlags &= ~(MOVE_RESULT_FOE_ENDURED | MOVE_RESULT_FOE_HUNG_ON);
|
||||||
BattleScriptPushCursor();
|
BattleScriptPushCursor();
|
||||||
gBattlescriptCurrInstr = BattleScript_HangedOnMsg;
|
gBattlescriptCurrInstr = BattleScript_HangedOnMsg;
|
||||||
@@ -2239,12 +2239,12 @@ static void atk14_printselectionstringfromtable(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 GetBattlerTurnOrderNum(u8 bank)
|
u8 GetBattlerTurnOrderNum(u8 battlerId)
|
||||||
{
|
{
|
||||||
s32 i;
|
s32 i;
|
||||||
for (i = 0; i < gBattlersCount; i++)
|
for (i = 0; i < gBattlersCount; i++)
|
||||||
{
|
{
|
||||||
if (gBattleTurnOrder[i] == bank)
|
if (gBattleTurnOrder[i] == battlerId)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
@@ -2271,7 +2271,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
|||||||
|
|
||||||
if (gBattleCommunication[MOVE_EFFECT_BYTE] & MOVE_EFFECT_AFFECTS_USER)
|
if (gBattleCommunication[MOVE_EFFECT_BYTE] & MOVE_EFFECT_AFFECTS_USER)
|
||||||
{
|
{
|
||||||
gEffectBattler = gBattlerAttacker; // bank that effects get applied on
|
gEffectBattler = gBattlerAttacker; // battlerId that effects get applied on
|
||||||
gBattleCommunication[MOVE_EFFECT_BYTE] &= ~(MOVE_EFFECT_AFFECTS_USER);
|
gBattleCommunication[MOVE_EFFECT_BYTE] &= ~(MOVE_EFFECT_AFFECTS_USER);
|
||||||
affectsUser = MOVE_EFFECT_AFFECTS_USER;
|
affectsUser = MOVE_EFFECT_AFFECTS_USER;
|
||||||
gBattleScripting.battler = gBattlerTarget; // theoretically the attacker
|
gBattleScripting.battler = gBattlerTarget; // theoretically the attacker
|
||||||
@@ -3028,18 +3028,18 @@ static void atk19_tryfaintmon(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
|
|
||||||
if (gBattlescriptCurrInstr[1] == BS_ATTACKER)
|
if (gBattlescriptCurrInstr[1] == BS_ATTACKER)
|
||||||
{
|
{
|
||||||
gActiveBattler = gBattlerAttacker;
|
gActiveBattler = gBattlerAttacker;
|
||||||
bank = gBattlerTarget;
|
battlerId = gBattlerTarget;
|
||||||
BS_ptr = BattleScript_FaintAttacker;
|
BS_ptr = BattleScript_FaintAttacker;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gActiveBattler = gBattlerTarget;
|
gActiveBattler = gBattlerTarget;
|
||||||
bank = gBattlerAttacker;
|
battlerId = gBattlerAttacker;
|
||||||
BS_ptr = BattleScript_FaintTarget;
|
BS_ptr = BattleScript_FaintTarget;
|
||||||
}
|
}
|
||||||
if (!(gAbsentBattlerFlags & gBitTable[gActiveBattler])
|
if (!(gAbsentBattlerFlags & gBitTable[gActiveBattler])
|
||||||
@@ -3065,7 +3065,7 @@ static void atk19_tryfaintmon(void)
|
|||||||
{
|
{
|
||||||
gHitMarker &= ~(HITMARKER_DESTINYBOND);
|
gHitMarker &= ~(HITMARKER_DESTINYBOND);
|
||||||
BattleScriptPush(gBattlescriptCurrInstr);
|
BattleScriptPush(gBattlescriptCurrInstr);
|
||||||
gBattleMoveDamage = gBattleMons[bank].hp;
|
gBattleMoveDamage = gBattleMons[battlerId].hp;
|
||||||
gBattlescriptCurrInstr = BattleScript_DestinyBondTakesLife;
|
gBattlescriptCurrInstr = BattleScript_DestinyBondTakesLife;
|
||||||
}
|
}
|
||||||
if ((gStatuses3[gBattlerTarget] & STATUS3_GRUDGE)
|
if ((gStatuses3[gBattlerTarget] & STATUS3_GRUDGE)
|
||||||
@@ -3124,11 +3124,11 @@ static void atk1B_cleareffectsonfaint(void)
|
|||||||
|
|
||||||
static void atk1C_jumpifstatus(void)
|
static void atk1C_jumpifstatus(void)
|
||||||
{
|
{
|
||||||
u8 bank = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
|
u8 battlerId = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
|
||||||
u32 flags = BS2ScriptRead32(gBattlescriptCurrInstr + 2);
|
u32 flags = BS2ScriptRead32(gBattlescriptCurrInstr + 2);
|
||||||
const u8* jumpPtr = BS2ScriptReadPtr(gBattlescriptCurrInstr + 6);
|
const u8* jumpPtr = BS2ScriptReadPtr(gBattlescriptCurrInstr + 6);
|
||||||
|
|
||||||
if (gBattleMons[bank].status1 & flags && gBattleMons[bank].hp)
|
if (gBattleMons[battlerId].status1 & flags && gBattleMons[battlerId].hp)
|
||||||
gBattlescriptCurrInstr = jumpPtr;
|
gBattlescriptCurrInstr = jumpPtr;
|
||||||
else
|
else
|
||||||
gBattlescriptCurrInstr += 10;
|
gBattlescriptCurrInstr += 10;
|
||||||
@@ -3136,11 +3136,11 @@ static void atk1C_jumpifstatus(void)
|
|||||||
|
|
||||||
static void atk1D_jumpifstatus2(void)
|
static void atk1D_jumpifstatus2(void)
|
||||||
{
|
{
|
||||||
u8 bank = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
|
u8 battlerId = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
|
||||||
u32 flags = BS2ScriptRead32(gBattlescriptCurrInstr + 2);
|
u32 flags = BS2ScriptRead32(gBattlescriptCurrInstr + 2);
|
||||||
const u8* jumpPtr = BS2ScriptReadPtr(gBattlescriptCurrInstr + 6);
|
const u8* jumpPtr = BS2ScriptReadPtr(gBattlescriptCurrInstr + 6);
|
||||||
|
|
||||||
if (gBattleMons[bank].status2 & flags && gBattleMons[bank].hp)
|
if (gBattleMons[battlerId].status2 & flags && gBattleMons[battlerId].hp)
|
||||||
gBattlescriptCurrInstr = jumpPtr;
|
gBattlescriptCurrInstr = jumpPtr;
|
||||||
else
|
else
|
||||||
gBattlescriptCurrInstr += 10;
|
gBattlescriptCurrInstr += 10;
|
||||||
@@ -3148,45 +3148,45 @@ static void atk1D_jumpifstatus2(void)
|
|||||||
|
|
||||||
static void atk1E_jumpifability(void)
|
static void atk1E_jumpifability(void)
|
||||||
{
|
{
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
u8 ability = gBattlescriptCurrInstr[2];
|
u8 ability = gBattlescriptCurrInstr[2];
|
||||||
const u8* jumpPtr = BS2ScriptReadPtr(gBattlescriptCurrInstr + 3);
|
const u8* jumpPtr = BS2ScriptReadPtr(gBattlescriptCurrInstr + 3);
|
||||||
|
|
||||||
if (gBattlescriptCurrInstr[1] == BS_ATTACKER_SIDE)
|
if (gBattlescriptCurrInstr[1] == BS_ATTACKER_SIDE)
|
||||||
{
|
{
|
||||||
bank = AbilityBattleEffects(ABILITYEFFECT_CHECK_BANK_SIDE, gBattlerAttacker, ability, 0, 0);
|
battlerId = AbilityBattleEffects(ABILITYEFFECT_CHECK_BANK_SIDE, gBattlerAttacker, ability, 0, 0);
|
||||||
if (bank)
|
if (battlerId)
|
||||||
{
|
{
|
||||||
gLastUsedAbility = ability;
|
gLastUsedAbility = ability;
|
||||||
gBattlescriptCurrInstr = jumpPtr;
|
gBattlescriptCurrInstr = jumpPtr;
|
||||||
RecordAbilityBattle(bank - 1, gLastUsedAbility);
|
RecordAbilityBattle(battlerId - 1, gLastUsedAbility);
|
||||||
gBattleScripting.battlerWithAbility = bank - 1;
|
gBattleScripting.battlerWithAbility = battlerId - 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gBattlescriptCurrInstr += 7;
|
gBattlescriptCurrInstr += 7;
|
||||||
}
|
}
|
||||||
else if (gBattlescriptCurrInstr[1] == BS_NOT_ATTACKER_SIDE)
|
else if (gBattlescriptCurrInstr[1] == BS_NOT_ATTACKER_SIDE)
|
||||||
{
|
{
|
||||||
bank = AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, gBattlerAttacker, ability, 0, 0);
|
battlerId = AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, gBattlerAttacker, ability, 0, 0);
|
||||||
if (bank)
|
if (battlerId)
|
||||||
{
|
{
|
||||||
gLastUsedAbility = ability;
|
gLastUsedAbility = ability;
|
||||||
gBattlescriptCurrInstr = jumpPtr;
|
gBattlescriptCurrInstr = jumpPtr;
|
||||||
RecordAbilityBattle(bank - 1, gLastUsedAbility);
|
RecordAbilityBattle(battlerId - 1, gLastUsedAbility);
|
||||||
gBattleScripting.battlerWithAbility = bank - 1;
|
gBattleScripting.battlerWithAbility = battlerId - 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gBattlescriptCurrInstr += 7;
|
gBattlescriptCurrInstr += 7;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bank = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
|
battlerId = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
|
||||||
if (gBattleMons[bank].ability == ability)
|
if (gBattleMons[battlerId].ability == ability)
|
||||||
{
|
{
|
||||||
gLastUsedAbility = ability;
|
gLastUsedAbility = ability;
|
||||||
gBattlescriptCurrInstr = jumpPtr;
|
gBattlescriptCurrInstr = jumpPtr;
|
||||||
RecordAbilityBattle(bank, gLastUsedAbility);
|
RecordAbilityBattle(battlerId, gLastUsedAbility);
|
||||||
gBattleScripting.battlerWithAbility = bank;
|
gBattleScripting.battlerWithAbility = battlerId;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gBattlescriptCurrInstr += 7;
|
gBattlescriptCurrInstr += 7;
|
||||||
@@ -3216,8 +3216,8 @@ static void atk1F_jumpifsideaffecting(void)
|
|||||||
static void atk20_jumpifstat(void)
|
static void atk20_jumpifstat(void)
|
||||||
{
|
{
|
||||||
u8 ret = 0;
|
u8 ret = 0;
|
||||||
u8 bank = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
|
u8 battlerId = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
|
||||||
u8 value = gBattleMons[bank].statStages[gBattlescriptCurrInstr[3]];
|
u8 value = gBattleMons[battlerId].statStages[gBattlescriptCurrInstr[3]];
|
||||||
|
|
||||||
switch (gBattlescriptCurrInstr[2])
|
switch (gBattlescriptCurrInstr[2])
|
||||||
{
|
{
|
||||||
@@ -3280,11 +3280,11 @@ static void atk21_jumpifstatus3condition(void)
|
|||||||
|
|
||||||
static void atk22_jumpiftype(void)
|
static void atk22_jumpiftype(void)
|
||||||
{
|
{
|
||||||
u8 bank = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
|
u8 battlerId = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
|
||||||
u8 type = gBattlescriptCurrInstr[2];
|
u8 type = gBattlescriptCurrInstr[2];
|
||||||
const u8* jumpPtr = BS2ScriptReadPtr(gBattlescriptCurrInstr + 3);
|
const u8* jumpPtr = BS2ScriptReadPtr(gBattlescriptCurrInstr + 3);
|
||||||
|
|
||||||
if (gBattleMons[bank].type1 == type || gBattleMons[bank].type2 == type)
|
if (gBattleMons[battlerId].type1 == type || gBattleMons[battlerId].type2 == type)
|
||||||
gBattlescriptCurrInstr = jumpPtr;
|
gBattlescriptCurrInstr = jumpPtr;
|
||||||
else
|
else
|
||||||
gBattlescriptCurrInstr += 7;
|
gBattlescriptCurrInstr += 7;
|
||||||
@@ -3435,7 +3435,7 @@ static void atk23_getexp(void)
|
|||||||
i = 0x149;
|
i = 0x149;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get exp getter bank
|
// get exp getter battlerId
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||||
{
|
{
|
||||||
if (!(gBattlerPartyIndexes[2] != gBattleStruct->expGetterMonId) && !(gAbsentBattlerFlags & gBitTable[2]))
|
if (!(gBattlerPartyIndexes[2] != gBattleStruct->expGetterMonId) && !(gAbsentBattlerFlags & gBitTable[2]))
|
||||||
@@ -4312,9 +4312,9 @@ static void atk41_call(void)
|
|||||||
|
|
||||||
static void atk42_jumpiftype2(void)
|
static void atk42_jumpiftype2(void)
|
||||||
{
|
{
|
||||||
u8 bank = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
|
u8 battlerId = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
|
||||||
|
|
||||||
if (gBattlescriptCurrInstr[2] == gBattleMons[bank].type1 || gBattlescriptCurrInstr[2] == gBattleMons[bank].type2)
|
if (gBattlescriptCurrInstr[2] == gBattleMons[battlerId].type1 || gBattlescriptCurrInstr[2] == gBattleMons[battlerId].type2)
|
||||||
gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 3);
|
gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 3);
|
||||||
else
|
else
|
||||||
gBattlescriptCurrInstr += 7;
|
gBattlescriptCurrInstr += 7;
|
||||||
@@ -4469,8 +4469,8 @@ static void atk48_playstatchangeanimation(void)
|
|||||||
else if (!gSideTimers[GET_BATTLER_SIDE(gActiveBattler)].mistTimer
|
else if (!gSideTimers[GET_BATTLER_SIDE(gActiveBattler)].mistTimer
|
||||||
&& gBattleMons[gActiveBattler].ability != ABILITY_CLEAR_BODY
|
&& gBattleMons[gActiveBattler].ability != ABILITY_CLEAR_BODY
|
||||||
&& gBattleMons[gActiveBattler].ability != ABILITY_WHITE_SMOKE
|
&& gBattleMons[gActiveBattler].ability != ABILITY_WHITE_SMOKE
|
||||||
&& !(gBattleMons[gActiveBattler].ability == ABILITY_KEEN_EYE && currStat == STAT_STAGE_ACC)
|
&& !(gBattleMons[gActiveBattler].ability == ABILITY_KEEN_EYE && currStat == STAT_ACC)
|
||||||
&& !(gBattleMons[gActiveBattler].ability == ABILITY_HYPER_CUTTER && currStat == STAT_STAGE_ATK))
|
&& !(gBattleMons[gActiveBattler].ability == ABILITY_HYPER_CUTTER && currStat == STAT_ATK))
|
||||||
{
|
{
|
||||||
if (gBattleMons[gActiveBattler].statStages[currStat] > 0)
|
if (gBattleMons[gActiveBattler].statStages[currStat] > 0)
|
||||||
{
|
{
|
||||||
@@ -4824,9 +4824,9 @@ static void atk49_moveend(void)
|
|||||||
&& gBattleMons[gBattlerTarget].hp != 0 && gBattlerAttacker != gBattlerTarget
|
&& gBattleMons[gBattlerTarget].hp != 0 && gBattlerAttacker != gBattlerTarget
|
||||||
&& GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget)
|
&& GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget)
|
||||||
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && TARGET_TURN_DAMAGED
|
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && TARGET_TURN_DAMAGED
|
||||||
&& gBattleMoves[gCurrentMove].power && gBattleMons[gBattlerTarget].statStages[STAT_STAGE_ATK] <= 0xB)
|
&& gBattleMoves[gCurrentMove].power && gBattleMons[gBattlerTarget].statStages[STAT_ATK] <= 0xB)
|
||||||
{
|
{
|
||||||
gBattleMons[gBattlerTarget].statStages[STAT_STAGE_ATK]++;
|
gBattleMons[gBattlerTarget].statStages[STAT_ATK]++;
|
||||||
BattleScriptPushCursor();
|
BattleScriptPushCursor();
|
||||||
gBattlescriptCurrInstr = BattleScript_RageIsBuilding;
|
gBattlescriptCurrInstr = BattleScript_RageIsBuilding;
|
||||||
effect = TRUE;
|
effect = TRUE;
|
||||||
@@ -4861,7 +4861,7 @@ static void atk49_moveend(void)
|
|||||||
break;
|
break;
|
||||||
case 4: // status immunities
|
case 4: // status immunities
|
||||||
if (AbilityBattleEffects(ABILITYEFFECT_IMMUNITY, 0, 0, 0, 0))
|
if (AbilityBattleEffects(ABILITYEFFECT_IMMUNITY, 0, 0, 0, 0))
|
||||||
effect = TRUE; // it loops through all banks, so we increment after its done with all banks
|
effect = TRUE; // it loops through all battlers, so we increment after its done with all battlers
|
||||||
else
|
else
|
||||||
gBattleScripting.atk49_state++;
|
gBattleScripting.atk49_state++;
|
||||||
break;
|
break;
|
||||||
@@ -4905,7 +4905,7 @@ static void atk49_moveend(void)
|
|||||||
}
|
}
|
||||||
gBattleScripting.atk49_state++;
|
gBattleScripting.atk49_state++;
|
||||||
break;
|
break;
|
||||||
case 11: // item effects for all banks
|
case 11: // item effects for all battlers
|
||||||
if (ItemBattleEffects(3, 0, FALSE))
|
if (ItemBattleEffects(3, 0, FALSE))
|
||||||
effect = TRUE;
|
effect = TRUE;
|
||||||
else
|
else
|
||||||
@@ -5039,10 +5039,10 @@ static void atk49_moveend(void)
|
|||||||
&& !gProtectStructs[gBattlerAttacker].chargingTurn && gBattleMoves[gCurrentMove].target == MOVE_TARGET_BOTH
|
&& !gProtectStructs[gBattlerAttacker].chargingTurn && gBattleMoves[gCurrentMove].target == MOVE_TARGET_BOTH
|
||||||
&& !(gHitMarker & HITMARKER_NO_ATTACKSTRING))
|
&& !(gHitMarker & HITMARKER_NO_ATTACKSTRING))
|
||||||
{
|
{
|
||||||
u8 bank = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerTarget)));
|
u8 battlerId = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerTarget)));
|
||||||
if (gBattleMons[bank].hp != 0)
|
if (gBattleMons[battlerId].hp != 0)
|
||||||
{
|
{
|
||||||
gBattlerTarget = bank;
|
gBattlerTarget = battlerId;
|
||||||
gHitMarker |= HITMARKER_NO_ATTACKSTRING;
|
gHitMarker |= HITMARKER_NO_ATTACKSTRING;
|
||||||
gBattleScripting.atk49_state = 0;
|
gBattleScripting.atk49_state = 0;
|
||||||
MoveValuesCleanUp();
|
MoveValuesCleanUp();
|
||||||
@@ -5440,10 +5440,10 @@ static void atk50_openpartyscreen(void)
|
|||||||
{
|
{
|
||||||
u32 flags;
|
u32 flags;
|
||||||
u8 hitmarkerFaintBits;
|
u8 hitmarkerFaintBits;
|
||||||
u8 bank;
|
u8 battlerId;
|
||||||
const u8 *jumpPtr;
|
const u8 *jumpPtr;
|
||||||
|
|
||||||
bank = 0;
|
battlerId = 0;
|
||||||
flags = 0;
|
flags = 0;
|
||||||
jumpPtr = BSScriptReadPtr(gBattlescriptCurrInstr + 2);
|
jumpPtr = BSScriptReadPtr(gBattlescriptCurrInstr + 2);
|
||||||
|
|
||||||
@@ -5675,21 +5675,21 @@ static void atk50_openpartyscreen(void)
|
|||||||
else
|
else
|
||||||
hitmarkerFaintBits = 1;
|
hitmarkerFaintBits = 1;
|
||||||
|
|
||||||
bank = GetBattlerForBattleScript(gBattlescriptCurrInstr[1] & ~(0x80));
|
battlerId = GetBattlerForBattleScript(gBattlescriptCurrInstr[1] & ~(0x80));
|
||||||
if (gSpecialStatuses[bank].flag40)
|
if (gSpecialStatuses[battlerId].flag40)
|
||||||
{
|
{
|
||||||
gBattlescriptCurrInstr += 6;
|
gBattlescriptCurrInstr += 6;
|
||||||
}
|
}
|
||||||
else if (sub_80423F4(bank, 6, 6))
|
else if (sub_80423F4(battlerId, 6, 6))
|
||||||
{
|
{
|
||||||
gActiveBattler = bank;
|
gActiveBattler = battlerId;
|
||||||
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
|
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
|
||||||
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
|
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
|
||||||
gBattlescriptCurrInstr = jumpPtr;
|
gBattlescriptCurrInstr = jumpPtr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gActiveBattler = bank;
|
gActiveBattler = battlerId;
|
||||||
*(gBattleStruct->field_58 + gActiveBattler) = gBattlerPartyIndexes[gActiveBattler];
|
*(gBattleStruct->field_58 + gActiveBattler) = gBattlerPartyIndexes[gActiveBattler];
|
||||||
*(gBattleStruct->monToSwitchIntoId + gActiveBattler) = 6;
|
*(gBattleStruct->monToSwitchIntoId + gActiveBattler) = 6;
|
||||||
gBattleStruct->field_93 &= ~(gBitTable[gActiveBattler]);
|
gBattleStruct->field_93 &= ~(gBitTable[gActiveBattler]);
|
||||||
@@ -5706,7 +5706,7 @@ static void atk50_openpartyscreen(void)
|
|||||||
{
|
{
|
||||||
for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++)
|
for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++)
|
||||||
{
|
{
|
||||||
if (gActiveBattler != bank)
|
if (gActiveBattler != battlerId)
|
||||||
{
|
{
|
||||||
BtlController_EmitLinkStandbyMsg(0, 2, 0);
|
BtlController_EmitLinkStandbyMsg(0, 2, 0);
|
||||||
MarkBattlerForControllerExec(gActiveBattler);
|
MarkBattlerForControllerExec(gActiveBattler);
|
||||||
@@ -5715,7 +5715,7 @@ static void atk50_openpartyscreen(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gActiveBattler = GetBattlerAtPosition(GetBattlerPosition(bank) ^ BIT_SIDE);
|
gActiveBattler = GetBattlerAtPosition(GetBattlerPosition(battlerId) ^ BIT_SIDE);
|
||||||
if (gAbsentBattlerFlags & gBitTable[gActiveBattler])
|
if (gAbsentBattlerFlags & gBitTable[gActiveBattler])
|
||||||
gActiveBattler ^= BIT_FLANK;
|
gActiveBattler ^= BIT_FLANK;
|
||||||
|
|
||||||
@@ -6451,7 +6451,7 @@ static void atk69_adjustsetdamage(void) // The same as 0x7, except there's no ra
|
|||||||
param = ItemId_GetHoldEffectParam(gBattleMons[gBattlerTarget].item);
|
param = ItemId_GetHoldEffectParam(gBattleMons[gBattlerTarget].item);
|
||||||
}
|
}
|
||||||
|
|
||||||
gStringBattler = gBattlerTarget;
|
gPotentialItemEffectBattler = gBattlerTarget;
|
||||||
|
|
||||||
if (holdEffect == HOLD_EFFECT_FOCUS_BAND && (Random() % 100) < param)
|
if (holdEffect == HOLD_EFFECT_FOCUS_BAND && (Random() % 100) < param)
|
||||||
{
|
{
|
||||||
@@ -6805,7 +6805,7 @@ static void atk70_recordlastability(void)
|
|||||||
{
|
{
|
||||||
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
|
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
|
||||||
RecordAbilityBattle(gActiveBattler, gLastUsedAbility);
|
RecordAbilityBattle(gActiveBattler, gLastUsedAbility);
|
||||||
gBattlescriptCurrInstr += 1; // UB: Should be + 2, one byte for command and one byte for bank argument.
|
gBattlescriptCurrInstr += 1; // UB: Should be + 2, one byte for command and one byte for battlerId argument.
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferMoveToLearnIntoBattleTextBuff2(void)
|
void BufferMoveToLearnIntoBattleTextBuff2(void)
|
||||||
@@ -7363,13 +7363,13 @@ static void atk83_nop(void)
|
|||||||
gBattlescriptCurrInstr++;
|
gBattlescriptCurrInstr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 UproarWakeUpCheck(u8 bank)
|
bool8 UproarWakeUpCheck(u8 battlerId)
|
||||||
{
|
{
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (i = 0; i < gBattlersCount; i++)
|
for (i = 0; i < gBattlersCount; i++)
|
||||||
{
|
{
|
||||||
if (!(gBattleMons[i].status2 & STATUS2_UPROAR) || gBattleMons[bank].ability == ABILITY_SOUNDPROOF)
|
if (!(gBattleMons[i].status2 & STATUS2_UPROAR) || gBattleMons[battlerId].ability == ABILITY_SOUNDPROOF)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
gBattleScripting.battler = i;
|
gBattleScripting.battler = i;
|
||||||
@@ -7569,7 +7569,7 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
|
|||||||
return STAT_CHANGE_DIDNT_WORK;
|
return STAT_CHANGE_DIDNT_WORK;
|
||||||
}
|
}
|
||||||
else if (gBattleMons[gActiveBattler].ability == ABILITY_KEEN_EYE
|
else if (gBattleMons[gActiveBattler].ability == ABILITY_KEEN_EYE
|
||||||
&& !certain && statId == STAT_STAGE_ACC)
|
&& !certain && statId == STAT_ACC)
|
||||||
{
|
{
|
||||||
if (flags == STAT_CHANGE_BS_PTR)
|
if (flags == STAT_CHANGE_BS_PTR)
|
||||||
{
|
{
|
||||||
@@ -7582,7 +7582,7 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
|
|||||||
return STAT_CHANGE_DIDNT_WORK;
|
return STAT_CHANGE_DIDNT_WORK;
|
||||||
}
|
}
|
||||||
else if (gBattleMons[gActiveBattler].ability == ABILITY_HYPER_CUTTER
|
else if (gBattleMons[gActiveBattler].ability == ABILITY_HYPER_CUTTER
|
||||||
&& !certain && statId == STAT_STAGE_ATK)
|
&& !certain && statId == STAT_ATK)
|
||||||
{
|
{
|
||||||
if (flags == STAT_CHANGE_BS_PTR)
|
if (flags == STAT_CHANGE_BS_PTR)
|
||||||
{
|
{
|
||||||
@@ -7753,8 +7753,8 @@ static bool8 TryDoForceSwitchOut(void)
|
|||||||
static void atk8F_forcerandomswitch(void)
|
static void atk8F_forcerandomswitch(void)
|
||||||
{
|
{
|
||||||
s32 i;
|
s32 i;
|
||||||
s32 bank1PartyId = 0;
|
s32 battler1PartyId = 0;
|
||||||
s32 bank2PartyId = 0;
|
s32 battler2PartyId = 0;
|
||||||
|
|
||||||
#ifdef NONMATCHING
|
#ifdef NONMATCHING
|
||||||
s32 lastMonId = 0; // + 1
|
s32 lastMonId = 0; // + 1
|
||||||
@@ -7791,8 +7791,8 @@ static void atk8F_forcerandomswitch(void)
|
|||||||
}
|
}
|
||||||
monsCount = 3;
|
monsCount = 3;
|
||||||
minNeeded = 1;
|
minNeeded = 1;
|
||||||
bank2PartyId = gBattlerPartyIndexes[gBattlerTarget];
|
battler2PartyId = gBattlerPartyIndexes[gBattlerTarget];
|
||||||
bank1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK];
|
battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK];
|
||||||
}
|
}
|
||||||
else if ((gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK)
|
else if ((gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK)
|
||||||
|| (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_x2000000))
|
|| (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_x2000000))
|
||||||
@@ -7809,8 +7809,8 @@ static void atk8F_forcerandomswitch(void)
|
|||||||
}
|
}
|
||||||
monsCount = 3;
|
monsCount = 3;
|
||||||
minNeeded = 1;
|
minNeeded = 1;
|
||||||
bank2PartyId = gBattlerPartyIndexes[gBattlerTarget];
|
battler2PartyId = gBattlerPartyIndexes[gBattlerTarget];
|
||||||
bank1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK];
|
battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK];
|
||||||
}
|
}
|
||||||
else if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)
|
else if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)
|
||||||
{
|
{
|
||||||
@@ -7836,8 +7836,8 @@ static void atk8F_forcerandomswitch(void)
|
|||||||
monsCount = 3;
|
monsCount = 3;
|
||||||
minNeeded = 1;
|
minNeeded = 1;
|
||||||
}
|
}
|
||||||
bank2PartyId = gBattlerPartyIndexes[gBattlerTarget];
|
battler2PartyId = gBattlerPartyIndexes[gBattlerTarget];
|
||||||
bank1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK];
|
battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK];
|
||||||
}
|
}
|
||||||
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||||
{
|
{
|
||||||
@@ -7845,8 +7845,8 @@ static void atk8F_forcerandomswitch(void)
|
|||||||
lastMonId = 6;
|
lastMonId = 6;
|
||||||
monsCount = 6;
|
monsCount = 6;
|
||||||
minNeeded = 2;
|
minNeeded = 2;
|
||||||
bank2PartyId = gBattlerPartyIndexes[gBattlerTarget];
|
battler2PartyId = gBattlerPartyIndexes[gBattlerTarget];
|
||||||
bank1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK];
|
battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -7854,8 +7854,8 @@ static void atk8F_forcerandomswitch(void)
|
|||||||
lastMonId = 6;
|
lastMonId = 6;
|
||||||
monsCount = 6;
|
monsCount = 6;
|
||||||
minNeeded = 1;
|
minNeeded = 1;
|
||||||
bank2PartyId = gBattlerPartyIndexes[gBattlerTarget]; // there is only one pokemon out in single battles
|
battler2PartyId = gBattlerPartyIndexes[gBattlerTarget]; // there is only one pokemon out in single battles
|
||||||
bank1PartyId = gBattlerPartyIndexes[gBattlerTarget];
|
battler1PartyId = gBattlerPartyIndexes[gBattlerTarget];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = firstMonId; i < lastMonId; i++)
|
for (i = firstMonId; i < lastMonId; i++)
|
||||||
@@ -7881,8 +7881,8 @@ static void atk8F_forcerandomswitch(void)
|
|||||||
i = Random() % monsCount;
|
i = Random() % monsCount;
|
||||||
i += firstMonId;
|
i += firstMonId;
|
||||||
}
|
}
|
||||||
while (i == bank2PartyId
|
while (i == battler2PartyId
|
||||||
|| i == bank1PartyId
|
|| i == battler1PartyId
|
||||||
|| GetMonData(&party[i], MON_DATA_SPECIES) == SPECIES_NONE
|
|| GetMonData(&party[i], MON_DATA_SPECIES) == SPECIES_NONE
|
||||||
|| GetMonData(&party[i], MON_DATA_IS_EGG) == TRUE
|
|| GetMonData(&party[i], MON_DATA_IS_EGG) == TRUE
|
||||||
|| GetMonData(&party[i], MON_DATA_HP) == 0);
|
|| GetMonData(&party[i], MON_DATA_HP) == 0);
|
||||||
@@ -8030,7 +8030,7 @@ static void atk93_tryKO(void)
|
|||||||
param = ItemId_GetHoldEffectParam(gBattleMons[gBattlerTarget].item);
|
param = ItemId_GetHoldEffectParam(gBattleMons[gBattlerTarget].item);
|
||||||
}
|
}
|
||||||
|
|
||||||
gStringBattler = gBattlerTarget;
|
gPotentialItemEffectBattler = gBattlerTarget;
|
||||||
|
|
||||||
if (holdEffect == HOLD_EFFECT_FOCUS_BAND && (Random() % 100) < param)
|
if (holdEffect == HOLD_EFFECT_FOCUS_BAND && (Random() % 100) < param)
|
||||||
{
|
{
|
||||||
@@ -8738,7 +8738,7 @@ static bool8 IsInvalidForSleepTalkOrAssist(u16 move)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 AttacksThisTurn(u8 bank, u16 move) // Note: returns 1 if it's a charging turn, otherwise 2
|
static u8 AttacksThisTurn(u8 battlerId, u16 move) // Note: returns 1 if it's a charging turn, otherwise 2
|
||||||
{
|
{
|
||||||
// first argument is unused
|
// first argument is unused
|
||||||
if (gBattleMoves[move].effect == EFFECT_SOLARBEAM
|
if (gBattleMoves[move].effect == EFFECT_SOLARBEAM
|
||||||
@@ -9296,10 +9296,10 @@ static void atkBC_maxattackhalvehp(void) // belly drum
|
|||||||
if (!(gBattleMons[gBattlerAttacker].maxHP / 2))
|
if (!(gBattleMons[gBattlerAttacker].maxHP / 2))
|
||||||
halfHp = 1;
|
halfHp = 1;
|
||||||
|
|
||||||
if (gBattleMons[gBattlerAttacker].statStages[STAT_STAGE_ATK] < 12
|
if (gBattleMons[gBattlerAttacker].statStages[STAT_ATK] < 12
|
||||||
&& gBattleMons[gBattlerAttacker].hp > halfHp)
|
&& gBattleMons[gBattlerAttacker].hp > halfHp)
|
||||||
{
|
{
|
||||||
gBattleMons[gBattlerAttacker].statStages[STAT_STAGE_ATK] = 12;
|
gBattleMons[gBattlerAttacker].statStages[STAT_ATK] = 12;
|
||||||
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2;
|
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2;
|
||||||
if (gBattleMoveDamage == 0)
|
if (gBattleMoveDamage == 0)
|
||||||
gBattleMoveDamage = 1;
|
gBattleMoveDamage = 1;
|
||||||
@@ -9719,8 +9719,8 @@ static void atkC8_sethail(void)
|
|||||||
|
|
||||||
static void atkC9_jumpifattackandspecialattackcannotfall(void) // memento
|
static void atkC9_jumpifattackandspecialattackcannotfall(void) // memento
|
||||||
{
|
{
|
||||||
if (gBattleMons[gBattlerTarget].statStages[STAT_STAGE_ATK] == 0
|
if (gBattleMons[gBattlerTarget].statStages[STAT_ATK] == 0
|
||||||
&& gBattleMons[gBattlerTarget].statStages[STAT_STAGE_SPATK] == 0
|
&& gBattleMons[gBattlerTarget].statStages[STAT_SPATK] == 0
|
||||||
&& gBattleCommunication[6] != 1)
|
&& gBattleCommunication[6] != 1)
|
||||||
{
|
{
|
||||||
gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1);
|
gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1);
|
||||||
@@ -10056,13 +10056,13 @@ static void atkDB_tryimprision(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
u8 bank, sideAttacker;
|
u8 battlerId, sideAttacker;
|
||||||
|
|
||||||
sideAttacker = GetBattlerSide(gBattlerAttacker);
|
sideAttacker = GetBattlerSide(gBattlerAttacker);
|
||||||
PressurePPLoseOnUsingImprision(gBattlerAttacker);
|
PressurePPLoseOnUsingImprision(gBattlerAttacker);
|
||||||
for (bank = 0; bank < gBattlersCount; bank++)
|
for (battlerId = 0; battlerId < gBattlersCount; battlerId++)
|
||||||
{
|
{
|
||||||
if (sideAttacker != GetBattlerSide(bank))
|
if (sideAttacker != GetBattlerSide(battlerId))
|
||||||
{
|
{
|
||||||
s32 attackerMoveId;
|
s32 attackerMoveId;
|
||||||
for (attackerMoveId = 0; attackerMoveId < 4; attackerMoveId++)
|
for (attackerMoveId = 0; attackerMoveId < 4; attackerMoveId++)
|
||||||
@@ -10070,7 +10070,7 @@ static void atkDB_tryimprision(void)
|
|||||||
s32 i;
|
s32 i;
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
if (gBattleMons[gBattlerAttacker].moves[attackerMoveId] == gBattleMons[bank].moves[i]
|
if (gBattleMons[gBattlerAttacker].moves[attackerMoveId] == gBattleMons[battlerId].moves[i]
|
||||||
&& gBattleMons[gBattlerAttacker].moves[attackerMoveId] != MOVE_NONE)
|
&& gBattleMons[gBattlerAttacker].moves[attackerMoveId] != MOVE_NONE)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -10085,7 +10085,7 @@ static void atkDB_tryimprision(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bank == gBattlersCount) // In Generation 3 games, Imprison fails if the user doesn't share any moves with any of the foes
|
if (battlerId == gBattlersCount) // In Generation 3 games, Imprison fails if the user doesn't share any moves with any of the foes
|
||||||
gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1);
|
gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+32
-32
@@ -383,7 +383,7 @@ u8 TrySetCantSelectMoveBattleScript(void)
|
|||||||
else
|
else
|
||||||
holdEffect = ItemId_GetHoldEffect(gBattleMons[gActiveBattler].item);
|
holdEffect = ItemId_GetHoldEffect(gBattleMons[gActiveBattler].item);
|
||||||
|
|
||||||
gStringBattler = gActiveBattler;
|
gPotentialItemEffectBattler = gActiveBattler;
|
||||||
|
|
||||||
if (holdEffect == HOLD_EFFECT_CHOICE_BAND && *choicedMove != 0 && *choicedMove != 0xFFFF && *choicedMove != move)
|
if (holdEffect == HOLD_EFFECT_CHOICE_BAND && *choicedMove != 0 && *choicedMove != 0xFFFF && *choicedMove != move)
|
||||||
{
|
{
|
||||||
@@ -427,7 +427,7 @@ u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check)
|
|||||||
else
|
else
|
||||||
holdEffect = ItemId_GetHoldEffect(gBattleMons[battlerId].item);
|
holdEffect = ItemId_GetHoldEffect(gBattleMons[battlerId].item);
|
||||||
|
|
||||||
gStringBattler = battlerId;
|
gPotentialItemEffectBattler = battlerId;
|
||||||
|
|
||||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||||
{
|
{
|
||||||
@@ -1912,9 +1912,9 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ABILITY_SPEED_BOOST:
|
case ABILITY_SPEED_BOOST:
|
||||||
if (gBattleMons[battler].statStages[STAT_STAGE_SPEED] < 0xC && gDisableStructs[battler].isFirstTurn != 2)
|
if (gBattleMons[battler].statStages[STAT_SPEED] < 0xC && gDisableStructs[battler].isFirstTurn != 2)
|
||||||
{
|
{
|
||||||
gBattleMons[battler].statStages[STAT_STAGE_SPEED]++;
|
gBattleMons[battler].statStages[STAT_SPEED]++;
|
||||||
gBattleScripting.animArg1 = 0x11;
|
gBattleScripting.animArg1 = 0x11;
|
||||||
gBattleScripting.animArg2 = 0;
|
gBattleScripting.animArg2 = 0;
|
||||||
BattleScriptPushCursorAndCallback(BattleScript_SpeedBoostActivates);
|
BattleScriptPushCursorAndCallback(BattleScript_SpeedBoostActivates);
|
||||||
@@ -2564,7 +2564,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
|||||||
if (effect)
|
if (effect)
|
||||||
{
|
{
|
||||||
gBattleScripting.battler = battlerId;
|
gBattleScripting.battler = battlerId;
|
||||||
gStringBattler = battlerId;
|
gPotentialItemEffectBattler = battlerId;
|
||||||
gActiveBattler = gBattlerAttacker = battlerId;
|
gActiveBattler = gBattlerAttacker = battlerId;
|
||||||
BattleScriptExecute(BattleScript_WhiteHerbEnd2);
|
BattleScriptExecute(BattleScript_WhiteHerbEnd2);
|
||||||
}
|
}
|
||||||
@@ -2635,7 +2635,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
|||||||
if (effect)
|
if (effect)
|
||||||
{
|
{
|
||||||
gBattleScripting.battler = battlerId;
|
gBattleScripting.battler = battlerId;
|
||||||
gStringBattler = battlerId;
|
gPotentialItemEffectBattler = battlerId;
|
||||||
gActiveBattler = gBattlerAttacker = battlerId;
|
gActiveBattler = gBattlerAttacker = battlerId;
|
||||||
BattleScriptExecute(BattleScript_WhiteHerbEnd2);
|
BattleScriptExecute(BattleScript_WhiteHerbEnd2);
|
||||||
}
|
}
|
||||||
@@ -2747,66 +2747,66 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
|||||||
break;
|
break;
|
||||||
// copy/paste again, smh
|
// copy/paste again, smh
|
||||||
case HOLD_EFFECT_ATTACK_UP:
|
case HOLD_EFFECT_ATTACK_UP:
|
||||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_STAGE_ATK] < 0xC)
|
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_ATK] < 0xC)
|
||||||
{
|
{
|
||||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_STAGE_ATK);
|
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_ATK);
|
||||||
PREPARE_STRING_BUFFER(gBattleTextBuff2, STRINGID_STATROSE);
|
PREPARE_STRING_BUFFER(gBattleTextBuff2, STRINGID_STATROSE);
|
||||||
|
|
||||||
gEffectBattler = battlerId;
|
gEffectBattler = battlerId;
|
||||||
SET_STATCHANGER(STAT_STAGE_ATK, 1, FALSE);
|
SET_STATCHANGER(STAT_ATK, 1, FALSE);
|
||||||
gBattleScripting.animArg1 = 0xE + STAT_STAGE_ATK;
|
gBattleScripting.animArg1 = 0xE + STAT_ATK;
|
||||||
gBattleScripting.animArg2 = 0;
|
gBattleScripting.animArg2 = 0;
|
||||||
BattleScriptExecute(BattleScript_BerryStatRaiseEnd2);
|
BattleScriptExecute(BattleScript_BerryStatRaiseEnd2);
|
||||||
effect = ITEM_STATS_CHANGE;
|
effect = ITEM_STATS_CHANGE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HOLD_EFFECT_DEFENSE_UP:
|
case HOLD_EFFECT_DEFENSE_UP:
|
||||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_STAGE_DEF] < 0xC)
|
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_DEF] < 0xC)
|
||||||
{
|
{
|
||||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_STAGE_DEF);
|
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_DEF);
|
||||||
|
|
||||||
gEffectBattler = battlerId;
|
gEffectBattler = battlerId;
|
||||||
SET_STATCHANGER(STAT_STAGE_DEF, 1, FALSE);
|
SET_STATCHANGER(STAT_DEF, 1, FALSE);
|
||||||
gBattleScripting.animArg1 = 0xE + STAT_STAGE_DEF;
|
gBattleScripting.animArg1 = 0xE + STAT_DEF;
|
||||||
gBattleScripting.animArg2 = 0;
|
gBattleScripting.animArg2 = 0;
|
||||||
BattleScriptExecute(BattleScript_BerryStatRaiseEnd2);
|
BattleScriptExecute(BattleScript_BerryStatRaiseEnd2);
|
||||||
effect = ITEM_STATS_CHANGE;
|
effect = ITEM_STATS_CHANGE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HOLD_EFFECT_SPEED_UP:
|
case HOLD_EFFECT_SPEED_UP:
|
||||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_STAGE_SPEED] < 0xC)
|
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPEED] < 0xC)
|
||||||
{
|
{
|
||||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_STAGE_SPEED);
|
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPEED);
|
||||||
|
|
||||||
gEffectBattler = battlerId;
|
gEffectBattler = battlerId;
|
||||||
SET_STATCHANGER(STAT_STAGE_SPEED, 1, FALSE);
|
SET_STATCHANGER(STAT_SPEED, 1, FALSE);
|
||||||
gBattleScripting.animArg1 = 0xE + STAT_STAGE_SPEED;
|
gBattleScripting.animArg1 = 0xE + STAT_SPEED;
|
||||||
gBattleScripting.animArg2 = 0;
|
gBattleScripting.animArg2 = 0;
|
||||||
BattleScriptExecute(BattleScript_BerryStatRaiseEnd2);
|
BattleScriptExecute(BattleScript_BerryStatRaiseEnd2);
|
||||||
effect = ITEM_STATS_CHANGE;
|
effect = ITEM_STATS_CHANGE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HOLD_EFFECT_SP_ATTACK_UP:
|
case HOLD_EFFECT_SP_ATTACK_UP:
|
||||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_STAGE_SPATK] < 0xC)
|
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPATK] < 0xC)
|
||||||
{
|
{
|
||||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_STAGE_SPATK);
|
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPATK);
|
||||||
|
|
||||||
gEffectBattler = battlerId;
|
gEffectBattler = battlerId;
|
||||||
SET_STATCHANGER(STAT_STAGE_SPATK, 1, FALSE);
|
SET_STATCHANGER(STAT_SPATK, 1, FALSE);
|
||||||
gBattleScripting.animArg1 = 0xE + STAT_STAGE_SPATK;
|
gBattleScripting.animArg1 = 0xE + STAT_SPATK;
|
||||||
gBattleScripting.animArg2 = 0;
|
gBattleScripting.animArg2 = 0;
|
||||||
BattleScriptExecute(BattleScript_BerryStatRaiseEnd2);
|
BattleScriptExecute(BattleScript_BerryStatRaiseEnd2);
|
||||||
effect = ITEM_STATS_CHANGE;
|
effect = ITEM_STATS_CHANGE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HOLD_EFFECT_SP_DEFENSE_UP:
|
case HOLD_EFFECT_SP_DEFENSE_UP:
|
||||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_STAGE_SPDEF] < 0xC)
|
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPDEF] < 0xC)
|
||||||
{
|
{
|
||||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_STAGE_SPDEF);
|
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPDEF);
|
||||||
|
|
||||||
gEffectBattler = battlerId;
|
gEffectBattler = battlerId;
|
||||||
SET_STATCHANGER(STAT_STAGE_SPDEF, 1, FALSE);
|
SET_STATCHANGER(STAT_SPDEF, 1, FALSE);
|
||||||
gBattleScripting.animArg1 = 0xE + STAT_STAGE_SPDEF;
|
gBattleScripting.animArg1 = 0xE + STAT_SPDEF;
|
||||||
gBattleScripting.animArg2 = 0;
|
gBattleScripting.animArg2 = 0;
|
||||||
BattleScriptExecute(BattleScript_BerryStatRaiseEnd2);
|
BattleScriptExecute(BattleScript_BerryStatRaiseEnd2);
|
||||||
effect = ITEM_STATS_CHANGE;
|
effect = ITEM_STATS_CHANGE;
|
||||||
@@ -2825,7 +2825,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
|||||||
{
|
{
|
||||||
for (i = 0; i < 5; i++)
|
for (i = 0; i < 5; i++)
|
||||||
{
|
{
|
||||||
if (gBattleMons[battlerId].statStages[STAT_STAGE_ATK + i] < 0xC)
|
if (gBattleMons[battlerId].statStages[STAT_ATK + i] < 0xC)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i != 5)
|
if (i != 5)
|
||||||
@@ -2833,7 +2833,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
i = Random() % 5;
|
i = Random() % 5;
|
||||||
} while (gBattleMons[battlerId].statStages[STAT_STAGE_ATK + i] == 0xC);
|
} while (gBattleMons[battlerId].statStages[STAT_ATK + i] == 0xC);
|
||||||
|
|
||||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, i + 1);
|
PREPARE_STAT_BUFFER(gBattleTextBuff1, i + 1);
|
||||||
|
|
||||||
@@ -2963,7 +2963,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
|||||||
if (effect)
|
if (effect)
|
||||||
{
|
{
|
||||||
gBattleScripting.battler = battlerId;
|
gBattleScripting.battler = battlerId;
|
||||||
gStringBattler = battlerId;
|
gPotentialItemEffectBattler = battlerId;
|
||||||
gActiveBattler = gBattlerAttacker = battlerId;
|
gActiveBattler = gBattlerAttacker = battlerId;
|
||||||
switch (effect)
|
switch (effect)
|
||||||
{
|
{
|
||||||
@@ -3111,7 +3111,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
|||||||
if (effect)
|
if (effect)
|
||||||
{
|
{
|
||||||
gBattleScripting.battler = battlerId;
|
gBattleScripting.battler = battlerId;
|
||||||
gStringBattler = battlerId;
|
gPotentialItemEffectBattler = battlerId;
|
||||||
BattleScriptPushCursor();
|
BattleScriptPushCursor();
|
||||||
gBattlescriptCurrInstr = BattleScript_WhiteHerbRet;
|
gBattlescriptCurrInstr = BattleScript_WhiteHerbRet;
|
||||||
return effect; // unnecessary return
|
return effect; // unnecessary return
|
||||||
@@ -3121,7 +3121,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
|||||||
if (effect)
|
if (effect)
|
||||||
{
|
{
|
||||||
gBattleScripting.battler = battlerId;
|
gBattleScripting.battler = battlerId;
|
||||||
gStringBattler = battlerId;
|
gPotentialItemEffectBattler = battlerId;
|
||||||
gActiveBattler = battlerId;
|
gActiveBattler = battlerId;
|
||||||
BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
|
BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
|
||||||
MarkBattlerForControllerExec(gActiveBattler);
|
MarkBattlerForControllerExec(gActiveBattler);
|
||||||
@@ -3156,7 +3156,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
|||||||
&& gBattleMons[gBattlerAttacker].hp != 0)
|
&& gBattleMons[gBattlerAttacker].hp != 0)
|
||||||
{
|
{
|
||||||
gLastUsedItem = atkItem;
|
gLastUsedItem = atkItem;
|
||||||
gStringBattler = gBattlerAttacker;
|
gPotentialItemEffectBattler = gBattlerAttacker;
|
||||||
gBattleScripting.battler = gBattlerAttacker;
|
gBattleScripting.battler = gBattlerAttacker;
|
||||||
gBattleMoveDamage = (gSpecialStatuses[gBattlerTarget].dmg / atkQuality) * -1;
|
gBattleMoveDamage = (gSpecialStatuses[gBattlerTarget].dmg / atkQuality) * -1;
|
||||||
if (gBattleMoveDamage == 0)
|
if (gBattleMoveDamage == 0)
|
||||||
|
|||||||
+2
-2
@@ -29,7 +29,7 @@ extern u8 gActiveBattler;
|
|||||||
extern u8 gBattlerInMenuId;
|
extern u8 gBattlerInMenuId;
|
||||||
extern u8 gBattlerTarget;
|
extern u8 gBattlerTarget;
|
||||||
extern u8 gBattlerAttacker;
|
extern u8 gBattlerAttacker;
|
||||||
extern u8 gStringBattler;
|
extern u8 gPotentialItemEffectBattler;
|
||||||
extern u16 gTrainerBattleOpponent_A;
|
extern u16 gTrainerBattleOpponent_A;
|
||||||
extern u32 gBattleTypeFlags;
|
extern u32 gBattleTypeFlags;
|
||||||
extern u8 gBattleMonForms[4];
|
extern u8 gBattleMonForms[4];
|
||||||
@@ -233,7 +233,7 @@ u8 *sub_806CF78(u16 itemId)
|
|||||||
itemEffect = gItemEffectTable[itemId - 13];
|
itemEffect = gItemEffectTable[itemId - 13];
|
||||||
}
|
}
|
||||||
|
|
||||||
gStringBattler = gBattlerInMenuId;
|
gPotentialItemEffectBattler = gBattlerInMenuId;
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user