Document item use functions in pokemon.c

This commit is contained in:
PikalaxALT
2021-03-16 21:16:31 -04:00
parent c4b61cc0ed
commit 4d86834d12
10 changed files with 223 additions and 216 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ bool8 WasUnableToUseMove(u8 battler);
void PrepareStringBattle(u16 stringId, u8 battler);
void ResetSentPokesToOpponentValue(void);
void sub_8017434(u8 battler);
void sub_80174B8(u8 battler);
void UpdateSentPokesToOpponentValue(u8 battler);
void BattleScriptPush(const u8 *bsPtr);
void BattleScriptPushCursor(void);
void BattleScriptPop(void);
+5
View File
@@ -213,4 +213,9 @@
#define UNOWN_FORM_COUNT 28
#define BOX_NAME_LENGTH 8
#define EVOTRIGGER_LEVEL_UP 0
#define EVOTRIGGER_TRADE 1
#define EVOTRIGGER_STONE 2
#define EVOTRIGGER_STONE_2 3
#endif // GUARD_CONSTANTS_POKEMON_H
+1 -1
View File
@@ -342,7 +342,7 @@ void CreateMaleMon(struct Pokemon *mon, u16 species, u8 level);
void CreateMonWithIVsPersonality(struct Pokemon *mon, u16 species, u8 level, u32 ivs, u32 personality);
void CreateMonWithEVSpread(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 evSpread);
void CreateBattleTowerMon(struct Pokemon *mon, struct BattleTowerPokemon *src);
void sub_803E23C(struct Pokemon *mon, struct BattleTowerPokemon *dest);
void ConvertPokemonToBattleTowerPokemon(struct Pokemon *mon, struct BattleTowerPokemon *dest);
void CalculateMonStats(struct Pokemon *mon);
void BoxMonToMon(struct BoxPokemon *src, struct Pokemon *dest);
u8 GetLevelFromBoxMonExp(struct BoxPokemon *boxMon);
+1 -1
View File
@@ -3791,7 +3791,7 @@ static void TryEvolvePokemon(void)
levelUpBits &= ~(gBitTable[i]);
gLeveledUpInBattle = levelUpBits;
species = GetEvolutionTargetSpecies(&gPlayerParty[i], 0, levelUpBits);
species = GetEvolutionTargetSpecies(&gPlayerParty[i], EVOTRIGGER_LEVEL_UP, levelUpBits);
if (species != SPECIES_NONE)
{
gBattleMainFunc = WaitForEvoSceneToFinish;
+1 -1
View File
@@ -4823,7 +4823,7 @@ static void atk52_switchineffects(void)
s32 i;
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
sub_80174B8(gActiveBattler);
UpdateSentPokesToOpponentValue(gActiveBattler);
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
gSpecialStatuses[gActiveBattler].flag40 = 0;
if (!(gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_SPIKES_DAMAGED)
+3 -2
View File
@@ -1124,7 +1124,8 @@ static void SetPlayerBattleTowerRecord(void)
playerRecord->greeting[i] = gSaveBlock1Ptr->easyChatBattleStart[i];
for (i = 0; i < 3; i++)
sub_803E23C(&gPlayerParty[gSaveBlock2Ptr->battleTower.selectedPartyMons[i] - 1], &playerRecord->party[i]);
ConvertPokemonToBattleTowerPokemon(&gPlayerParty[gSaveBlock2Ptr->battleTower.selectedPartyMons[i] - 1],
&playerRecord->party[i]);
SetBattleTowerRecordChecksum(&gSaveBlock2Ptr->battleTower.playerRecord);
SaveCurrentWinStreak();
@@ -1320,7 +1321,7 @@ static void Debug_FillEReaderTrainerWithPlayerData(void)
}
for (i = 0; i < 3; i++)
sub_803E23C(&gPlayerParty[i], &ereaderTrainer->party[i]);
ConvertPokemonToBattleTowerPokemon(&gPlayerParty[i], &ereaderTrainer->party[i]);
SetEReaderTrainerChecksum(ereaderTrainer);
}
+1 -1
View File
@@ -247,7 +247,7 @@ void sub_8017434(u8 battler)
}
}
void sub_80174B8(u8 battler)
void UpdateSentPokesToOpponentValue(u8 battler)
{
if (GetBattlerSide(battler) == B_SIDE_OPPONENT)
{
+3 -3
View File
@@ -855,7 +855,7 @@ static bool8 DisplayPartyPokemonDataForMoveTutorOrEvolutionItem(u8 slot)
DisplayPartyPokemonDataToTeachMove(slot, item, 0);
break;
case 2: // Evolution stone
if (!GetMonData(currentPokemon, MON_DATA_IS_EGG) && GetEvolutionTargetSpecies(currentPokemon, 3, item) != SPECIES_NONE)
if (!GetMonData(currentPokemon, MON_DATA_IS_EGG) && GetEvolutionTargetSpecies(currentPokemon, EVOTRIGGER_STONE_2, item) != SPECIES_NONE)
return FALSE;
DisplayPartyPokemonDescriptionData(slot, PARTYBOX_DESC_NO_USE);
break;
@@ -5197,7 +5197,7 @@ static void Task_TryLearningNextMove(u8 taskId)
static void PartyMenuTryEvolution(u8 taskId)
{
struct Pokemon *mon = &gPlayerParty[gPartyMenu.slotId];
u16 targetSpecies = GetEvolutionTargetSpecies(mon, 0, 0);
u16 targetSpecies = GetEvolutionTargetSpecies(mon, EVOTRIGGER_LEVEL_UP, 0);
if (targetSpecies != SPECIES_NONE)
{
@@ -5353,7 +5353,7 @@ static void sub_8126BD4(void)
static bool8 MonCanEvolve(void)
{
if (!IsNationalPokedexEnabled()
&& GetEvolutionTargetSpecies(&gPlayerParty[gPartyMenu.slotId], 2, gSpecialVar_ItemId) > KANTO_DEX_COUNT)
&& GetEvolutionTargetSpecies(&gPlayerParty[gPartyMenu.slotId], EVOTRIGGER_STONE, gSpecialVar_ItemId) > KANTO_DEX_COUNT)
return FALSE;
else
return TRUE;
+204 -203
View File
@@ -30,6 +30,7 @@
#include "constants/abilities.h"
#include "constants/moves.h"
#include "constants/songs.h"
#include "constants/item_effects.h"
#include "constants/trainer_classes.h"
#include "constants/facility_trainer_classes.h"
#include "constants/hold_effects.h"
@@ -72,7 +73,7 @@ static u16 GetDeoxysStat(struct Pokemon *mon, s32 statId);
static bool8 IsShinyOtIdPersonality(u32 otId, u32 personality);
static u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex);
static u8 GetNatureFromPersonality(u32 personality);
static bool8 sub_8042BE8(struct Pokemon *mon, u32 unused, u32 healMask, u8 battleId);
static bool8 PartyMonHasStatus(struct Pokemon *mon, u32 unused, u32 healMask, u8 battleId);
static bool8 HealStatusConditions(struct Pokemon *mon, u32 unused, u32 healMask, u8 battleId);
static bool8 IsPokemonStorageFull(void);
static u8 SendMonToPC(struct Pokemon* mon);
@@ -1986,7 +1987,7 @@ static void CreateEventLegalMon(struct Pokemon *mon, u16 species, u8 level, u8 f
SetMonData(mon, MON_DATA_EVENT_LEGAL, &isEventLegal);
}
void sub_803E23C(struct Pokemon *mon, struct BattleTowerPokemon *dest)
void ConvertPokemonToBattleTowerPokemon(struct Pokemon *mon, struct BattleTowerPokemon *dest)
{
s32 i;
u16 heldItem;
@@ -3895,7 +3896,7 @@ static void CopyPlayerPartyMonToBattleData(u8 battlerId, u8 partyIndex)
gBattleMons[battlerId].statStages[i] = 6;
gBattleMons[battlerId].status2 = 0;
sub_80174B8(battlerId);
UpdateSentPokesToOpponentValue(battlerId);
ClearTemporarySpeciesSpriteData(battlerId, FALSE);
}
@@ -3911,14 +3912,14 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
s32 cmdIndex;
bool8 retVal = TRUE;
const u8 *itemEffect;
u8 sp24 = 6;
u32 sp28;
s8 sp2C = 0;
u8 idx = 6;
u32 i;
s8 friendshipDelta = 0;
u8 holdEffect;
u8 sp34 = 4;
u8 battleMonId = 4;
u16 heldItem;
u8 r10;
u32 r4;
u8 val;
u32 evDelta;
heldItem = GetMonData(mon, MON_DATA_HELD_ITEM, NULL);
if (heldItem == ITEM_ENIGMA_BERRY)
@@ -3942,7 +3943,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
{
if (gBattlerPartyIndexes[cmdIndex] == partyIndex)
{
sp34 = cmdIndex;
battleMonId = cmdIndex;
break;
}
cmdIndex += 2;
@@ -3951,12 +3952,12 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
else
{
gActiveBattler = 0;
sp34 = 4;
battleMonId = 4;
}
if (!IS_POKEMON_ITEM(item))
return TRUE;
if (gItemEffectTable[item - 13] == NULL && item != ITEM_ENIGMA_BERRY)
if (gItemEffectTable[item - ITEM_POTION] == NULL && item != ITEM_ENIGMA_BERRY)
return TRUE;
if (item == ITEM_ENIGMA_BERRY)
@@ -3968,7 +3969,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
}
else
{
itemEffect = gItemEffectTable[item - 13];
itemEffect = gItemEffectTable[item - ITEM_POTION];
}
for (cmdIndex = 0; cmdIndex < 6; cmdIndex++)
@@ -3977,22 +3978,22 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
{
// status healing effects
case 0:
if ((itemEffect[cmdIndex] & 0x80)
&& gMain.inBattle && sp34 != 4 && (gBattleMons[sp34].status2 & STATUS2_INFATUATION))
if ((itemEffect[cmdIndex] & ITEM0_INFATUATION)
&& gMain.inBattle && battleMonId != 4 && (gBattleMons[battleMonId].status2 & STATUS2_INFATUATION))
{
gBattleMons[sp34].status2 &= ~STATUS2_INFATUATION;
gBattleMons[battleMonId].status2 &= ~STATUS2_INFATUATION;
retVal = FALSE;
}
if ((itemEffect[cmdIndex] & 0x30)
if ((itemEffect[cmdIndex] & ITEM0_HIGH_CRIT)
&& !(gBattleMons[gActiveBattler].status2 & STATUS2_FOCUS_ENERGY))
{
gBattleMons[gActiveBattler].status2 |= STATUS2_FOCUS_ENERGY;
retVal = FALSE;
}
if ((itemEffect[cmdIndex] & 0xF)
if ((itemEffect[cmdIndex] & ITEM0_X_ATTACK)
&& gBattleMons[gActiveBattler].statStages[STAT_ATK] < 12)
{
gBattleMons[gActiveBattler].statStages[STAT_ATK] += itemEffect[cmdIndex] & 0xF;
gBattleMons[gActiveBattler].statStages[STAT_ATK] += itemEffect[cmdIndex] & ITEM0_X_ATTACK;
if (gBattleMons[gActiveBattler].statStages[STAT_ATK] > 12)
gBattleMons[gActiveBattler].statStages[STAT_ATK] = 12;
retVal = FALSE;
@@ -4000,18 +4001,18 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
break;
// in-battle stat boosting effects?
case 1:
if ((itemEffect[cmdIndex] & 0xF0)
if ((itemEffect[cmdIndex] & ITEM1_X_DEFEND)
&& gBattleMons[gActiveBattler].statStages[STAT_DEF] < 12)
{
gBattleMons[gActiveBattler].statStages[STAT_DEF] += (itemEffect[cmdIndex] & 0xF0) >> 4;
gBattleMons[gActiveBattler].statStages[STAT_DEF] += (itemEffect[cmdIndex] & ITEM1_X_DEFEND) >> 4;
if (gBattleMons[gActiveBattler].statStages[STAT_DEF] > 12)
gBattleMons[gActiveBattler].statStages[STAT_DEF] = 12;
retVal = FALSE;
}
if ((itemEffect[cmdIndex] & 0xF)
if ((itemEffect[cmdIndex] & ITEM1_X_SPEED)
&& gBattleMons[gActiveBattler].statStages[STAT_SPEED] < 12)
{
gBattleMons[gActiveBattler].statStages[STAT_SPEED] += itemEffect[cmdIndex] & 0xF;
gBattleMons[gActiveBattler].statStages[STAT_SPEED] += itemEffect[cmdIndex] & ITEM1_X_SPEED;
if (gBattleMons[gActiveBattler].statStages[STAT_SPEED] > 12)
gBattleMons[gActiveBattler].statStages[STAT_SPEED] = 12;
retVal = FALSE;
@@ -4019,31 +4020,31 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
break;
// more stat boosting effects?
case 2:
if ((itemEffect[cmdIndex] & 0xF0)
if ((itemEffect[cmdIndex] & ITEM2_X_ACCURACY)
&& gBattleMons[gActiveBattler].statStages[STAT_ACC] < 12)
{
gBattleMons[gActiveBattler].statStages[STAT_ACC] += (itemEffect[cmdIndex] & 0xF0) >> 4;
gBattleMons[gActiveBattler].statStages[STAT_ACC] += (itemEffect[cmdIndex] & ITEM2_X_ACCURACY) >> 4;
if (gBattleMons[gActiveBattler].statStages[STAT_ACC] > 12)
gBattleMons[gActiveBattler].statStages[STAT_ACC] = 12;
retVal = FALSE;
}
if ((itemEffect[cmdIndex] & 0xF)
if ((itemEffect[cmdIndex] & ITEM2_X_SPATK)
&& gBattleMons[gActiveBattler].statStages[STAT_SPATK] < 12)
{
gBattleMons[gActiveBattler].statStages[STAT_SPATK] += itemEffect[cmdIndex] & 0xF;
gBattleMons[gActiveBattler].statStages[STAT_SPATK] += itemEffect[cmdIndex] & ITEM2_X_SPATK;
if (gBattleMons[gActiveBattler].statStages[STAT_SPATK] > 12)
gBattleMons[gActiveBattler].statStages[STAT_SPATK] = 12;
retVal = FALSE;
}
break;
case 3:
if ((itemEffect[cmdIndex] & 0x80)
if ((itemEffect[cmdIndex] & ITEM3_MIST)
&& gSideTimers[GetBattlerSide(gActiveBattler)].mistTimer == 0)
{
gSideTimers[GetBattlerSide(gActiveBattler)].mistTimer = 5;
retVal = FALSE;
}
if ((itemEffect[cmdIndex] & 0x40) // raise level
if ((itemEffect[cmdIndex] & ITEM3_LEVEL_UP) // raise level
&& GetMonData(mon, MON_DATA_LEVEL, NULL) != 100)
{
data = gExperienceTables[gBaseStats[GetMonData(mon, MON_DATA_SPECIES, NULL)].growthRate][GetMonData(mon, MON_DATA_LEVEL, NULL) + 1];
@@ -4051,93 +4052,93 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
CalculateMonStats(mon);
retVal = FALSE;
}
if ((itemEffect[cmdIndex] & 0x20)
&& HealStatusConditions(mon, partyIndex, 7, sp34) == 0)
if ((itemEffect[cmdIndex] & ITEM3_SLEEP)
&& HealStatusConditions(mon, partyIndex, STATUS1_SLEEP, battleMonId) == 0)
{
if (sp34 != 4)
gBattleMons[sp34].status2 &= ~STATUS2_NIGHTMARE;
if (battleMonId != 4)
gBattleMons[battleMonId].status2 &= ~STATUS2_NIGHTMARE;
retVal = FALSE;
}
if ((itemEffect[cmdIndex] & 0x10) && HealStatusConditions(mon, partyIndex, 0xF88, sp34) == 0)
if ((itemEffect[cmdIndex] & ITEM3_POISON) && HealStatusConditions(mon, partyIndex, STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER, battleMonId) == 0)
retVal = FALSE;
if ((itemEffect[cmdIndex] & 8) && HealStatusConditions(mon, partyIndex, 16, sp34) == 0)
if ((itemEffect[cmdIndex] & ITEM3_BURN) && HealStatusConditions(mon, partyIndex, STATUS1_BURN, battleMonId) == 0)
retVal = FALSE;
if ((itemEffect[cmdIndex] & 4) && HealStatusConditions(mon, partyIndex, 32, sp34) == 0)
if ((itemEffect[cmdIndex] & ITEM3_FREEZE) && HealStatusConditions(mon, partyIndex, STATUS1_FREEZE, battleMonId) == 0)
retVal = FALSE;
if ((itemEffect[cmdIndex] & 2) && HealStatusConditions(mon, partyIndex, 64, sp34) == 0)
if ((itemEffect[cmdIndex] & ITEM3_PARALYSIS) && HealStatusConditions(mon, partyIndex, STATUS1_PARALYSIS, battleMonId) == 0)
retVal = FALSE;
if ((itemEffect[cmdIndex] & 1) // heal confusion
&& gMain.inBattle && sp34 != 4 && (gBattleMons[sp34].status2 & STATUS2_CONFUSION))
if ((itemEffect[cmdIndex] & ITEM3_CONFUSION) // heal confusion
&& gMain.inBattle && battleMonId != 4 && (gBattleMons[battleMonId].status2 & STATUS2_CONFUSION))
{
gBattleMons[sp34].status2 &= ~STATUS2_CONFUSION;
gBattleMons[battleMonId].status2 &= ~STATUS2_CONFUSION;
retVal = FALSE;
}
break;
// EV, HP, and PP raising effects
case 4:
r10 = itemEffect[cmdIndex];
if (r10 & 0x20)
val = itemEffect[cmdIndex];
if (val & ITEM4_PP_UP)
{
r10 &= ~0x20;
val &= ~ITEM4_PP_UP;
data = (GetMonData(mon, MON_DATA_PP_BONUSES, NULL) & gPPUpGetMask[moveIndex]) >> (moveIndex * 2);
sp28 = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex);
if (data < 3 && sp28 > 4)
i = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex);
if (data < 3 && i > 4)
{
data = GetMonData(mon, MON_DATA_PP_BONUSES, NULL) + gPPUpAddMask[moveIndex];
SetMonData(mon, MON_DATA_PP_BONUSES, &data);
data = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), data, moveIndex) - sp28;
data = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), data, moveIndex) - i;
data = GetMonData(mon, MON_DATA_PP1 + moveIndex, NULL) + data;
SetMonData(mon, MON_DATA_PP1 + moveIndex, &data);
retVal = FALSE;
}
}
sp28 = 0;
while (r10 != 0)
i = 0;
while (val != 0)
{
if (r10 & 1)
if (val & 1)
{
u16 evCount;
s32 r5;
switch (sp28)
switch (i)
{
case 0:
case 1:
case 0: // EV_HP
case 1: // EV_ATK
evCount = GetMonEVCount(mon);
if (evCount >= 510)
return TRUE;
data = GetMonData(mon, sGetMonDataEVConstants[sp28], NULL);
data = GetMonData(mon, sGetMonDataEVConstants[i], NULL);
if (data < 100)
{
if (data + itemEffect[sp24] > 100)
r4 = 100 - (data + itemEffect[sp24]) + itemEffect[sp24];
if (data + itemEffect[idx] > 100)
evDelta = 100 - (data + itemEffect[idx]) + itemEffect[idx];
else
r4 = itemEffect[sp24];
if (evCount + r4 > 510)
r4 += 510 - (evCount + r4);
data += r4;
SetMonData(mon, sGetMonDataEVConstants[sp28], &data);
evDelta = itemEffect[idx];
if (evCount + evDelta > 510)
evDelta += 510 - (evCount + evDelta);
data += evDelta;
SetMonData(mon, sGetMonDataEVConstants[i], &data);
CalculateMonStats(mon);
sp24++;
idx++;
retVal = FALSE;
}
break;
case 2:
case 2: // HEAL_HP
// revive?
if (r10 & 0x10)
if (val & (ITEM4_REVIVE >> 2))
{
if (GetMonData(mon, MON_DATA_HP, NULL) != 0)
{
sp24++;
idx++;
break;
}
if (gMain.inBattle)
{
if (sp34 != 4)
if (battleMonId != 4)
{
gAbsentBattlerFlags &= ~gBitTable[sp34];
CopyPlayerPartyMonToBattleData(sp34, GetPartyIdFromBattlePartyId(gBattlerPartyIndexes[sp34]));
gAbsentBattlerFlags &= ~gBitTable[battleMonId];
CopyPlayerPartyMonToBattleData(battleMonId, GetPartyIdFromBattlePartyId(gBattlerPartyIndexes[battleMonId]));
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER && gBattleResults.numRevivesUsed < 255)
gBattleResults.numRevivesUsed++;
}
@@ -4153,11 +4154,11 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
{
if (GetMonData(mon, MON_DATA_HP, NULL) == 0)
{
sp24++;
idx++;
break;
}
}
data = itemEffect[sp24++];
data = itemEffect[idx++];
switch (data)
{
case 0xFF:
@@ -4180,16 +4181,16 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if (data > GetMonData(mon, MON_DATA_MAX_HP, NULL))
data = GetMonData(mon, MON_DATA_MAX_HP, NULL);
SetMonData(mon, MON_DATA_HP, &data);
if (gMain.inBattle && sp34 != 4)
if (gMain.inBattle && battleMonId != 4)
{
gBattleMons[sp34].hp = data;
if (!(r10 & 0x10) && GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
gBattleMons[battleMonId].hp = data;
if (!(val & (ITEM4_REVIVE >> 2)) && GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
{
if (gBattleResults.numHealingItemsUsed < 255)
gBattleResults.numHealingItemsUsed++;
// I have to re-use this variable to match.
r5 = gActiveBattler;
gActiveBattler = sp34;
gActiveBattler = battleMonId;
BtlController_EmitGetMonData(0, 0, 0);
MarkBattlerForControllerExec(gActiveBattler);
gActiveBattler = r5;
@@ -4202,63 +4203,63 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
}
retVal = FALSE;
}
r10 &= 0xEF;
val &= ~(ITEM4_REVIVE >> 2);
break;
case 3:
if (!(r10 & 2))
case 3: // HEAL_PP_ALL
if (!(val & (ITEM4_HEAL_PP_ONE >> 3)))
{
for (r5 = 0; r5 < 4; r5++)
{
u16 r4;
u16 move_id;
data = GetMonData(mon, MON_DATA_PP1 + r5, NULL);
r4 = GetMonData(mon, MON_DATA_MOVE1 + r5, NULL);
if (data != CalculatePPWithBonus(r4, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), r5))
move_id = GetMonData(mon, MON_DATA_MOVE1 + r5, NULL);
if (data != CalculatePPWithBonus(move_id, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), r5))
{
data += itemEffect[sp24];
r4 = GetMonData(mon, MON_DATA_MOVE1 + r5, NULL);
if (data > CalculatePPWithBonus(r4, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), r5))
data += itemEffect[idx];
move_id = GetMonData(mon, MON_DATA_MOVE1 + r5, NULL);
if (data > CalculatePPWithBonus(move_id, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), r5))
{
r4 = GetMonData(mon, MON_DATA_MOVE1 + r5, NULL);
data = CalculatePPWithBonus(r4, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), r5);
move_id = GetMonData(mon, MON_DATA_MOVE1 + r5, NULL);
data = CalculatePPWithBonus(move_id, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), r5);
}
SetMonData(mon, MON_DATA_PP1 + r5, &data);
if (gMain.inBattle
&& sp34 != 4 && !(gBattleMons[sp34].status2 & 0x200000)
&& !(gDisableStructs[sp34].mimickedMoves & gBitTable[r5]))
gBattleMons[sp34].pp[r5] = data;
&& battleMonId != 4 && !(gBattleMons[battleMonId].status2 & STATUS2_TRANSFORMED)
&& !(gDisableStructs[battleMonId].mimickedMoves & gBitTable[r5]))
gBattleMons[battleMonId].pp[r5] = data;
retVal = FALSE;
}
}
sp24++;
idx++;
}
else
{
u16 r4;
u16 move_id;
data = GetMonData(mon, MON_DATA_PP1 + moveIndex, NULL);
r4 = GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL);
if (data != CalculatePPWithBonus(r4, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex))
move_id = GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL);
if (data != CalculatePPWithBonus(move_id, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex))
{
data += itemEffect[sp24++];
r4 = GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL);
if (data > CalculatePPWithBonus(r4, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex))
data += itemEffect[idx++];
move_id = GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL);
if (data > CalculatePPWithBonus(move_id, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex))
{
r4 = GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL);
data = CalculatePPWithBonus(r4, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex);
move_id = GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL);
data = CalculatePPWithBonus(move_id, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex);
}
SetMonData(mon, MON_DATA_PP1 + moveIndex, &data);
if (gMain.inBattle
&& sp34 != 4 && !(gBattleMons[sp34].status2 & 0x200000)
&& !(gDisableStructs[sp34].mimickedMoves & gBitTable[moveIndex]))
gBattleMons[sp34].pp[moveIndex] = data;
&& battleMonId != 4 && !(gBattleMons[battleMonId].status2 & STATUS2_TRANSFORMED)
&& !(gDisableStructs[battleMonId].mimickedMoves & gBitTable[moveIndex]))
gBattleMons[battleMonId].pp[moveIndex] = data;
retVal = FALSE;
}
}
break;
case 7:
case 7: // EVO_STONE
{
u16 targetSpecies = GetEvolutionTargetSpecies(mon, 2, item);
u16 targetSpecies = GetEvolutionTargetSpecies(mon, EVOTRIGGER_STONE, item);
if (targetSpecies != SPECIES_NONE)
{
@@ -4269,70 +4270,70 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
break;
}
}
sp28++;
r10 >>= 1;
i++;
val >>= 1;
}
break;
case 5:
r10 = itemEffect[cmdIndex];
sp28 = 0;
while (r10 != 0)
val = itemEffect[cmdIndex];
i = 0;
while (val != 0)
{
if (r10 & 1)
if (val & 1)
{
u16 evCount;
switch (sp28)
switch (i)
{
case 0:
case 1:
case 2:
case 3:
case 0: // EV_DEF
case 1: // EV_SPEED
case 2: // EV_SPDEF
case 3: // EV_SPATK
evCount = GetMonEVCount(mon);
if (evCount >= 510)
return TRUE;
data = GetMonData(mon, sGetMonDataEVConstants[sp28 + 2], NULL);
data = GetMonData(mon, sGetMonDataEVConstants[i + 2], NULL);
if (data < 100)
{
if (data + itemEffect[sp24] > 100)
r4 = 100 - (data + itemEffect[sp24]) + itemEffect[sp24];
if (data + itemEffect[idx] > 100)
evDelta = 100 - (data + itemEffect[idx]) + itemEffect[idx];
else
r4 = itemEffect[sp24];
if (evCount + r4 > 510)
r4 += 510 - (evCount + r4);
data += r4;
SetMonData(mon, sGetMonDataEVConstants[sp28 + 2], &data);
evDelta = itemEffect[idx];
if (evCount + evDelta > 510)
evDelta += 510 - (evCount + evDelta);
data += evDelta;
SetMonData(mon, sGetMonDataEVConstants[i + 2], &data);
CalculateMonStats(mon);
retVal = FALSE;
sp24++;
idx++;
}
break;
case 4:
case 4: // PP_MAX
data = (GetMonData(mon, MON_DATA_PP_BONUSES, NULL) & gPPUpGetMask[moveIndex]) >> (moveIndex * 2);
if (data < 3)
{
r4 = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex);
evDelta = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex);
data = GetMonData(mon, MON_DATA_PP_BONUSES, NULL);
data &= gPPUpSetMask[moveIndex];
data += gPPUpAddMask[moveIndex] * 3;
SetMonData(mon, MON_DATA_PP_BONUSES, &data);
data = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), data, moveIndex) - r4;
data = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), data, moveIndex) - evDelta;
data = GetMonData(mon, MON_DATA_PP1 + moveIndex, NULL) + data;
SetMonData(mon, MON_DATA_PP1 + moveIndex, &data);
retVal = FALSE;
}
break;
case 5:
if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) < 100 && retVal == 0 && sp2C == 0)
case 5: // FRIENDSHIP_LOW
if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) < 100 && retVal == 0 && friendshipDelta == 0)
{
sp2C = itemEffect[sp24];
friendshipDelta = itemEffect[idx];
friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL);
if (sp2C > 0 && holdEffect == HOLD_EFFECT_HAPPINESS_UP)
friendship += 150 * sp2C / 100;
if (friendshipDelta > 0 && holdEffect == HOLD_EFFECT_HAPPINESS_UP)
friendship += 150 * friendshipDelta / 100;
else
friendship += sp2C;
if (sp2C > 0)
friendship += friendshipDelta;
if (friendshipDelta > 0)
{
if (GetMonData(mon, MON_DATA_POKEBALL, NULL) == 11)
friendship++;
@@ -4345,19 +4346,19 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
friendship = 255;
SetMonData(mon, MON_DATA_FRIENDSHIP, &friendship);
}
sp24++;
idx++;
break;
case 6:
case 6: // FRIENDSHIP_MID
if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) >= 100 && GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) < 200
&& retVal == 0 && sp2C == 0)
&& retVal == 0 && friendshipDelta == 0)
{
sp2C = itemEffect[sp24];
friendshipDelta = itemEffect[idx];
friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL);
if (sp2C > 0 && holdEffect == HOLD_EFFECT_HAPPINESS_UP)
friendship += 150 * sp2C / 100;
if (friendshipDelta > 0 && holdEffect == HOLD_EFFECT_HAPPINESS_UP)
friendship += 150 * friendshipDelta / 100;
else
friendship += sp2C;
if (sp2C > 0)
friendship += friendshipDelta;
if (friendshipDelta > 0)
{
if (GetMonData(mon, MON_DATA_POKEBALL, NULL) == 11)
friendship++;
@@ -4370,18 +4371,18 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
friendship = 255;
SetMonData(mon, MON_DATA_FRIENDSHIP, &friendship);
}
sp24++;
idx++;
break;
case 7:
if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) >= 200 && retVal == 0 && sp2C == 0)
case 7: // FRIENDSHIP_HIGH
if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) >= 200 && retVal == 0 && friendshipDelta == 0)
{
sp2C = itemEffect[sp24];
friendshipDelta = itemEffect[idx];
friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL);
if (sp2C > 0 && holdEffect == HOLD_EFFECT_HAPPINESS_UP)
friendship += 150 * sp2C / 100;
if (friendshipDelta > 0 && holdEffect == HOLD_EFFECT_HAPPINESS_UP)
friendship += 150 * friendshipDelta / 100;
else
friendship += sp2C;
if (sp2C > 0)
friendship += friendshipDelta;
if (friendshipDelta > 0)
{
if (GetMonData(mon, MON_DATA_POKEBALL, NULL) == 11)
friendship++;
@@ -4394,12 +4395,12 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
friendship = 255;
SetMonData(mon, MON_DATA_FRIENDSHIP, &friendship);
}
sp24++;
idx++;
break;
}
}
sp28++;
r10 >>= 1;
i++;
val >>= 1;
}
break;
}
@@ -4432,7 +4433,7 @@ bool8 PokemonItemUseNoEffect(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mo
s32 cmdIndex;
bool8 retVal = TRUE;
const u8 *itemEffect;
u8 r10 = 6;
u8 idx = 6;
u32 i;
s32 sp18 = 0;
u8 holdEffect;
@@ -4476,7 +4477,7 @@ bool8 PokemonItemUseNoEffect(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mo
}
if (!IS_POKEMON_ITEM(item))
return TRUE;
if (gItemEffectTable[item - 13] == NULL && item != ITEM_ENIGMA_BERRY)
if (gItemEffectTable[item - ITEM_POTION] == NULL && item != ITEM_ENIGMA_BERRY)
return TRUE;
if (item == ITEM_ENIGMA_BERRY)
{
@@ -4495,64 +4496,64 @@ bool8 PokemonItemUseNoEffect(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mo
{
// status healing effects
case 0:
if (itemEffect[cmdIndex] & 0x80
if (itemEffect[cmdIndex] & ITEM0_INFATUATION
&& gMain.inBattle
&& battlerId != 4
&& gBattleMons[battlerId].status2 & STATUS2_INFATUATION)
retVal = FALSE;
if (itemEffect[cmdIndex] & 0x30
if (itemEffect[cmdIndex] & ITEM0_HIGH_CRIT
&& !(gBattleMons[gActiveBattler].status2 & STATUS2_FOCUS_ENERGY))
retVal = FALSE;
if ((itemEffect[cmdIndex] & 0xF)
if ((itemEffect[cmdIndex] & ITEM0_X_ATTACK)
&& gBattleMons[gActiveBattler].statStages[STAT_ATK] < 12)
retVal = FALSE;
break;
// in-battle stat boosting effects?
case 1:
if ((itemEffect[cmdIndex] & 0xF0)
if ((itemEffect[cmdIndex] & ITEM1_X_DEFEND)
&& gBattleMons[gActiveBattler].statStages[STAT_DEF] < 12)
retVal = FALSE;
if ((itemEffect[cmdIndex] & 0xF)
if ((itemEffect[cmdIndex] & ITEM1_X_SPEED)
&& gBattleMons[gActiveBattler].statStages[STAT_SPEED] < 12)
retVal = FALSE;
break;
// more stat boosting effects?
case 2:
if ((itemEffect[cmdIndex] & 0xF0)
if ((itemEffect[cmdIndex] & ITEM2_X_ACCURACY)
&& gBattleMons[gActiveBattler].statStages[STAT_ACC] < 12)
retVal = FALSE;
if ((itemEffect[cmdIndex] & 0xF)
if ((itemEffect[cmdIndex] & ITEM2_X_SPATK)
&& gBattleMons[gActiveBattler].statStages[STAT_SPATK] < 12)
retVal = FALSE;
break;
case 3:
if ((itemEffect[cmdIndex] & 0x80)
if ((itemEffect[cmdIndex] & ITEM3_MIST)
&& gSideTimers[GetBattlerSide(gActiveBattler)].mistTimer == 0)
retVal = FALSE;
if ((itemEffect[cmdIndex] & 0x40) // raise level
if ((itemEffect[cmdIndex] & ITEM3_LEVEL_UP) // raise level
&& GetMonData(mon, MON_DATA_LEVEL, NULL) != 100)
retVal = FALSE;
if ((itemEffect[cmdIndex] & 0x20)
&& sub_8042BE8(mon, partyIndex, 7, battlerId))
if ((itemEffect[cmdIndex] & ITEM3_SLEEP)
&& PartyMonHasStatus(mon, partyIndex, STATUS1_SLEEP, battlerId))
retVal = FALSE;
if ((itemEffect[cmdIndex] & 0x10) && sub_8042BE8(mon, partyIndex, 0xF88, battlerId))
if ((itemEffect[cmdIndex] & ITEM3_POISON) && PartyMonHasStatus(mon, partyIndex, STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER, battlerId))
retVal = FALSE;
if ((itemEffect[cmdIndex] & 8) && sub_8042BE8(mon, partyIndex, 16, battlerId))
if ((itemEffect[cmdIndex] & ITEM3_BURN) && PartyMonHasStatus(mon, partyIndex, STATUS1_BURN, battlerId))
retVal = FALSE;
if ((itemEffect[cmdIndex] & 4) && sub_8042BE8(mon, partyIndex, 32, battlerId))
if ((itemEffect[cmdIndex] & ITEM3_FREEZE) && PartyMonHasStatus(mon, partyIndex, STATUS1_FREEZE, battlerId))
retVal = FALSE;
if ((itemEffect[cmdIndex] & 2) && sub_8042BE8(mon, partyIndex, 64, battlerId))
if ((itemEffect[cmdIndex] & ITEM3_PARALYSIS) && PartyMonHasStatus(mon, partyIndex, STATUS1_PARALYSIS, battlerId))
retVal = FALSE;
if (itemEffect[cmdIndex] & 1 // heal confusion
if (itemEffect[cmdIndex] & ITEM3_CONFUSION // heal confusion
&& gMain.inBattle && battlerId != 4 && (gBattleMons[battlerId].status2 & STATUS2_CONFUSION))
retVal = FALSE;
break;
// EV, HP, and PP raising effects
case 4:
curEffect = itemEffect[cmdIndex];
if (curEffect & 0x20)
if (curEffect & ITEM4_PP_UP)
{
curEffect &= ~0x20;
curEffect &= ~ITEM4_PP_UP;
data = (GetMonData(mon, MON_DATA_PP_BONUSES, NULL) & gPPUpGetMask[moveIndex]) >> (moveIndex * 2);
i = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex);
if (data < 3 && i > 4)
@@ -4565,24 +4566,24 @@ bool8 PokemonItemUseNoEffect(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mo
{
switch (i)
{
case 0:
case 1:
case 0: // EV_HP
case 1: // EV_ATK
if (GetMonEVCount(mon) >= 510)
return TRUE;
data = GetMonData(mon, sGetMonDataEVConstants[i], NULL);
if (data < 100)
{
r10++;
idx++;
retVal = FALSE;
}
break;
case 2:
case 2: // HEAL_HP
// revive?
if (curEffect & 0x10)
if (curEffect & (ITEM4_REVIVE >> 2))
{
if (GetMonData(mon, MON_DATA_HP, NULL) != 0)
{
r10++;
idx++;
break;
}
}
@@ -4590,17 +4591,17 @@ bool8 PokemonItemUseNoEffect(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mo
{
if (GetMonData(mon, MON_DATA_HP, NULL) == 0)
{
r10++;
idx++;
break;
}
}
if (GetMonData(mon, MON_DATA_MAX_HP, NULL) != GetMonData(mon, MON_DATA_HP, NULL))
retVal = FALSE;
r10++;
curEffect &= 0xEF;
idx;
curEffect &= ~(ITEM4_REVIVE >> 2);
break;
case 3:
if (!(curEffect & 2))
if (!(curEffect & (ITEM4_HEAL_PP_ONE >> 3)))
{
for (tmp = 0; tmp < MAX_MON_MOVES; tmp++)
{
@@ -4608,7 +4609,7 @@ bool8 PokemonItemUseNoEffect(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mo
if (data != CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + tmp, NULL), GetMonData(mon, MON_DATA_PP_BONUSES, NULL), tmp))
retVal = FALSE;
}
r10++;
idx++;
}
else // _080429FA
{
@@ -4616,13 +4617,13 @@ bool8 PokemonItemUseNoEffect(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mo
curMoveId = GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL);
if (data != CalculatePPWithBonus(curMoveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex))
{
r10++;
idx++;
retVal = FALSE;
}
}
break;
case 7:
if (GetEvolutionTargetSpecies(mon, 2, item) != SPECIES_NONE)
if (GetEvolutionTargetSpecies(mon, EVOTRIGGER_STONE, item) != SPECIES_NONE)
return FALSE;
break;
}
@@ -4640,46 +4641,46 @@ bool8 PokemonItemUseNoEffect(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mo
{
switch (i)
{
case 0:
case 1:
case 2:
case 3:
case 0: // EV_DEF
case 1: // EV_SPEED
case 2: // EV_SPDEF
case 3: // EV_SPATK
if (GetMonEVCount(mon) >= 510)
return TRUE;
data = GetMonData(mon, sGetMonDataEVConstants[i + 2], NULL);
if (data < 100)
{
retVal = FALSE;
r10++;
idx++;
}
break;
case 4:
case 4: // PP_MAX
data = (GetMonData(mon, MON_DATA_PP_BONUSES, NULL) & gPPUpGetMask[moveIndex]) >> (moveIndex * 2);
tmp = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex);
if (data < 3 && tmp > 4)
retVal = FALSE;
break;
case 5:
case 5: // FRIENDSHIP_LOW
if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) < 100
&& retVal == FALSE
&& sp18 == 0)
sp18 = itemEffect[r10];
r10++;
sp18 = itemEffect[idx];
idx++;
break;
case 6:
case 6: // FRIENDSHIP_MID
if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) >= 100
&& GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) < 200
&& retVal == FALSE
&& sp18 == 0)
sp18 = itemEffect[r10];
r10++;
sp18 = itemEffect[idx];
idx++;
break;
case 7:
case 7: // FRIENDSHIP_HIGH
if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) >= 200
&& retVal == FALSE
&& sp18 == 0)
sp18 = itemEffect[r10];
r10++;
sp18 = itemEffect[idx];
idx++;
break;
}
}
@@ -4692,7 +4693,7 @@ bool8 PokemonItemUseNoEffect(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mo
return retVal;
}
static bool8 sub_8042BE8(struct Pokemon *mon, u32 unused, u32 healMask, u8 battleId)
static bool8 PartyMonHasStatus(struct Pokemon *mon, u32 unused, u32 healMask, u8 battleId)
{
if ((GetMonData(mon, MON_DATA_STATUS, NULL) & healMask) != 0)
return TRUE;
@@ -4904,7 +4905,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
switch (type)
{
case 0:
case EVOTRIGGER_LEVEL_UP:
level = GetMonData(mon, MON_DATA_LEVEL, 0);
friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, 0);
@@ -4969,7 +4970,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
}
}
break;
case 1:
case EVOTRIGGER_TRADE:
for (i = 0; i < 5; i++)
{
switch (gEvolutionTable[species][i].method)
@@ -4992,8 +4993,8 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
}
}
break;
case 2:
case 3:
case EVOTRIGGER_STONE:
case EVOTRIGGER_STONE_2:
for (i = 0; i < 5; i++)
{
if (gEvolutionTable[species][i].method == EVO_ITEM
+3 -3
View File
@@ -1725,7 +1725,7 @@ static bool8 DoTradeAnim_Cable(void)
case 72: // Only if in-game trade
TradeMons(gSpecialVar_0x8005, 0);
gCB2_AfterEvolution = CB2_RunTradeAnim_InGameTrade;
evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[0]], TRUE, ITEM_NONE);
evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[0]], EVOTRIGGER_TRADE, ITEM_NONE);
if (evoTarget != SPECIES_NONE)
{
TradeEvolutionScene(&gPlayerParty[gSelectedTradeMonPositions[0]], evoTarget, sTradeData->pokePicSpriteIdxs[1], gSelectedTradeMonPositions[0]);
@@ -2246,7 +2246,7 @@ static bool8 DoTradeAnim_Wireless(void)
case 72: // Only if in-game trade
TradeMons(gSpecialVar_0x8005, 0);
gCB2_AfterEvolution = CB2_RunTradeAnim_InGameTrade;
evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[0]], TRUE, ITEM_NONE);
evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[0]], EVOTRIGGER_TRADE, ITEM_NONE);
if (evoTarget != SPECIES_NONE)
{
TradeEvolutionScene(&gPlayerParty[gSelectedTradeMonPositions[0]], evoTarget, sTradeData->pokePicSpriteIdxs[1], gSelectedTradeMonPositions[0]);
@@ -2290,7 +2290,7 @@ static void sub_8053788(void)
break;
case 4:
gCB2_AfterEvolution = sub_8053E8C;
evoSpecies = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[0]], 1, 0);
evoSpecies = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[0]], EVOTRIGGER_TRADE, 0);
if (evoSpecies != SPECIES_NONE)
TradeEvolutionScene(&gPlayerParty[gSelectedTradeMonPositions[0]], evoSpecies, sTradeData->pokePicSpriteIdxs[1], gSelectedTradeMonPositions[0]);
else