Fix order of messages in gen6 exp share (#3339)

Co-authored-by: Eduardo Quezada D'Ottone <eduardo602002@gmail.com>
This commit is contained in:
DizzyEggg 2023-09-24 22:07:56 +02:00 committed by GitHub
parent b77dec1234
commit 996bc6ba24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 129 additions and 106 deletions

View File

@ -536,7 +536,15 @@ struct BattleStruct
u8 turnCountersTracker;
u16 wrappedMove[MAX_BATTLERS_COUNT];
u16 moveTarget[MAX_BATTLERS_COUNT];
u32 expShareExpValue;
u32 expValue;
u8 expGettersOrder[PARTY_SIZE]; // First battlers which were sent out, then via exp-share
u8 expGetterMonId;
u8 expOrderId:3;
u8 expGetterBattlerId:2;
u8 teamGotExpMsgPrinted:1; // The 'Rest of your team got msg' has been printed.
u8 givenExpMons; // Bits for enemy party's pokemon that gave exp to player's party.
u8 expSentInMons; // As bits for player party mons - not including exp share mons.
u8 wildVictorySong;
u8 dynamicMoveType;
u8 wrappedBy[MAX_BATTLERS_COUNT];
@ -549,9 +557,7 @@ struct BattleStruct
u8 switchInAbilitiesCounter;
u8 faintedActionsState;
u8 faintedActionsBattlerId;
u32 expValue;
u8 scriptPartyIdx; // for printing the nickname
u8 sentInPokes;
bool8 selectionScriptFinished[MAX_BATTLERS_COUNT];
u8 battlerPartyIndexes[MAX_BATTLERS_COUNT];
u8 monToSwitchIntoId[MAX_BATTLERS_COUNT];
@ -569,7 +575,6 @@ struct BattleStruct
u8 stateIdAfterSelScript[MAX_BATTLERS_COUNT];
u8 prevSelectedPartySlot;
u8 stringMoveType;
u8 expGetterBattlerId;
u8 absentBattlerFlags;
u8 palaceFlags; // First 4 bits are "is <= 50% HP and not asleep" for each battler, last 4 bits are selected moves to pass to AI
u8 field_93; // related to choosing pokemon?
@ -592,7 +597,6 @@ struct BattleStruct
u8 switchInItemsCounter;
u8 arenaTurnCounter;
u8 turnSideTracker;
u8 givenExpMons; // Bits for enemy party's pokemon that gave exp to player's party.
u16 lastTakenMoveFrom[MAX_BATTLERS_COUNT][MAX_BATTLERS_COUNT]; // a 2-D array [target][attacker]
union {
struct LinkBattlerHeader linkBattlerHeader;
@ -975,7 +979,6 @@ extern u16 gBattleWeather;
extern struct WishFutureKnock gWishFutureKnock;
extern u16 gIntroSlideFlags;
extern u8 gSentPokesToOpponent[2];
extern u16 gExpShareExp;
extern struct BattleEnigmaBerry gEnigmaBerries[MAX_BATTLERS_COUNT];
extern struct BattleScripting gBattleScripting;
extern struct BattleStruct *gBattleStruct;

View File

@ -212,7 +212,6 @@ EWRAM_DATA u16 gBattleWeather = 0;
EWRAM_DATA struct WishFutureKnock gWishFutureKnock = {0};
EWRAM_DATA u16 gIntroSlideFlags = 0;
EWRAM_DATA u8 gSentPokesToOpponent[2] = {0};
EWRAM_DATA u16 gExpShareExp = 0;
EWRAM_DATA struct BattleEnigmaBerry gEnigmaBerries[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA struct BattleScripting gBattleScripting = {0};
EWRAM_DATA struct BattleStruct *gBattleStruct = NULL;

View File

@ -4023,19 +4023,28 @@ static void Cmd_jumpbasedontype(void)
FEATURE_FLAG_ASSERT(I_EXP_SHARE_FLAG, YouNeedToSetTheExpShareFlagToAnUnusedFlag);
static u32 GetMonHoldEffect(struct Pokemon *mon)
{
u32 holdEffect;
u32 item = GetMonData(mon, MON_DATA_HELD_ITEM);
if (item == ITEM_ENIGMA_BERRY_E_READER)
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
else
holdEffect = ItemId_GetHoldEffect(item);
return holdEffect;
}
static void Cmd_getexp(void)
{
CMD_ARGS(u8 battler);
u16 item;
u32 holdEffect;
s32 i; // also used as stringId
u8 holdEffect;
s32 sentIn;
s32 viaExpShare = 0;
u32 *exp = &gBattleStruct->expValue;
u8 *expMonId = &gBattleStruct->expGetterMonId;
gBattlerFainted = GetBattlerForBattleScript(cmd->battler);
sentIn = gSentPokesToOpponent[(gBattlerFainted & 2) >> 1];
switch (gBattleScripting.getexpState)
{
@ -4061,26 +4070,42 @@ static void Cmd_getexp(void)
break;
case 1: // calculate experience points to redistribute
{
u32 calculatedExp;
s32 viaSentIn;
u32 orderId = 0;
u32 calculatedExp = 0;
u32 *exp = &gBattleStruct->expValue;
u32 sentInBits = gSentPokesToOpponent[(gBattlerFainted & 2) >> 1];
u32 expShareBits = 0;
s32 viaSentIn = 0;
s32 viaExpShare = 0;
for (viaSentIn = 0, i = 0; i < PARTY_SIZE; i++)
for (i = 0; i < PARTY_SIZE; i++)
{
if (!IsValidForBattle(&gPlayerParty[i]))
continue;
if (gBitTable[i] & sentIn)
if (gBitTable[i] & sentInBits)
viaSentIn++;
item = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM);
if (item == ITEM_ENIGMA_BERRY_E_READER)
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
else
holdEffect = ItemId_GetHoldEffect(item);
holdEffect = GetMonHoldEffect(&gPlayerParty[i]);
if (holdEffect == HOLD_EFFECT_EXP_SHARE || IsGen6ExpShareEnabled())
{
expShareBits |= gBitTable[i];
viaExpShare++;
}
}
// Get order of mons getting exp: 1. all mons via sent in, 2. all mons via exp share
for (i = 0; i < PARTY_SIZE; i++)
{
if (gBitTable[i] & sentInBits)
gBattleStruct->expGettersOrder[orderId++] = i;
}
for (i = 0; i < PARTY_SIZE; i++)
{
if (!(gBitTable[i] & sentInBits) && gBitTable[i] & expShareBits)
gBattleStruct->expGettersOrder[orderId++] = i;
}
if (orderId < PARTY_SIZE)
gBattleStruct->expGettersOrder[orderId] = PARTY_SIZE;
#if (B_SCALED_EXP >= GEN_5) && (B_SCALED_EXP != GEN_6)
calculatedExp = gSpeciesInfo[gBattleMons[gBattlerFainted].species].expYield * gBattleMons[gBattlerFainted].level / 5;
#else
@ -4097,54 +4122,49 @@ static void Cmd_getexp(void)
if (*exp == 0)
*exp = 1;
gExpShareExp = calculatedExp / 2 / viaExpShare;
if (gExpShareExp == 0)
gExpShareExp = 1;
gBattleStruct->expShareExpValue = calculatedExp / 2 / viaExpShare;
if (gBattleStruct->expShareExpValue == 0)
gBattleStruct->expShareExpValue = 1;
}
else
{
*exp = SAFE_DIV(calculatedExp, viaSentIn);
if (*exp == 0)
*exp = 1;
gExpShareExp = 0;
gBattleStruct->expShareExpValue = 0;
}
#else
*exp = calculatedExp;
gExpShareExp = calculatedExp / 2;
if (gExpShareExp == 0)
gExpShareExp = 1;
gBattleStruct->expShareExpValue = calculatedExp / 2;
if (gBattleStruct->expShareExpValue == 0)
gBattleStruct->expShareExpValue = 1;
#endif
gBattleScripting.getexpState++;
gBattleStruct->expGetterMonId = 0;
gBattleStruct->sentInPokes = sentIn;
gBattleStruct->expOrderId = 0;
*expMonId = gBattleStruct->expGettersOrder[0];
gBattleStruct->expSentInMons = sentInBits;
}
// fall through
case 2: // set exp value to the poke in expgetter_id and print message
if (gBattleControllerExecFlags == 0)
{
item = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HELD_ITEM);
bool32 wasSentOut = ((gBattleStruct->expSentInMons & gBitTable[*expMonId]) != 0);
holdEffect = GetMonHoldEffect(&gPlayerParty[*expMonId]);
if (item == ITEM_ENIGMA_BERRY_E_READER)
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
else
holdEffect = ItemId_GetHoldEffect(item);
if ((holdEffect != HOLD_EFFECT_EXP_SHARE && !(gBattleStruct->sentInPokes & 1) && !IsGen6ExpShareEnabled())
|| GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPECIES_OR_EGG) == SPECIES_EGG)
if ((holdEffect != HOLD_EFFECT_EXP_SHARE && !wasSentOut && !IsGen6ExpShareEnabled())
|| GetMonData(&gPlayerParty[*expMonId], MON_DATA_SPECIES_OR_EGG) == SPECIES_EGG)
{
*(&gBattleStruct->sentInPokes) >>= 1;
gBattleScripting.getexpState = 5;
gBattleMoveDamage = 0; // used for exp
}
else if ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gBattleStruct->expGetterMonId >= 3)
|| GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL) == MAX_LEVEL)
else if ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && *expMonId >= 3)
|| GetMonData(&gPlayerParty[*expMonId], MON_DATA_LEVEL) == MAX_LEVEL)
{
*(&gBattleStruct->sentInPokes) >>= 1;
gBattleScripting.getexpState = 5;
gBattleMoveDamage = 0; // used for exp
#if B_MAX_LEVEL_EV_GAINS >= GEN_5
MonGainEVs(&gPlayerParty[gBattleStruct->expGetterMonId], gBattleMons[gBattlerFainted].species);
MonGainEVs(&gPlayerParty[*expMonId], gBattleMons[gBattlerFainted].species);
#endif
}
else
@ -4161,10 +4181,10 @@ static void Cmd_getexp(void)
gBattleStruct->wildVictorySong++;
}
if (IsValidForBattle(&gPlayerParty[gBattleStruct->expGetterMonId]))
if (IsValidForBattle(&gPlayerParty[*expMonId]))
{
if (gBattleStruct->sentInPokes & 1)
gBattleMoveDamage = *exp;
if (wasSentOut)
gBattleMoveDamage = gBattleStruct->expValue;
else
gBattleMoveDamage = 0;
@ -4174,14 +4194,16 @@ static void Cmd_getexp(void)
&& gBattleMoveDamage == 0
#endif
)
gBattleMoveDamage += gExpShareExp;
{
gBattleMoveDamage += gBattleStruct->expShareExpValue;
}
ApplyExperienceMultipliers(&gBattleMoveDamage, gBattleStruct->expGetterMonId, gBattlerFainted);
ApplyExperienceMultipliers(&gBattleMoveDamage, *expMonId, gBattlerFainted);
if (IsTradedMon(&gPlayerParty[gBattleStruct->expGetterMonId]))
if (IsTradedMon(&gPlayerParty[*expMonId]))
{
// check if the pokemon doesn't belong to the player
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gBattleStruct->expGetterMonId >= 3)
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && *expMonId >= 3)
i = STRINGID_EMPTYSTRING4;
else
i = STRINGID_ABOOSTED;
@ -4194,7 +4216,7 @@ static void Cmd_getexp(void)
// get exp getter battler
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
if (gBattlerPartyIndexes[2] == gBattleStruct->expGetterMonId && !(gAbsentBattlerFlags & gBitTable[2]))
if (gBattlerPartyIndexes[2] == *expMonId && !(gAbsentBattlerFlags & gBitTable[2]))
gBattleStruct->expGetterBattlerId = 2;
else
{
@ -4209,24 +4231,24 @@ static void Cmd_getexp(void)
gBattleStruct->expGetterBattlerId = 0;
}
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattleStruct->expGetterBattlerId, gBattleStruct->expGetterMonId);
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattleStruct->expGetterBattlerId, *expMonId);
// buffer 'gained' or 'gained a boosted'
PREPARE_STRING_BUFFER(gBattleTextBuff2, i);
PREPARE_WORD_NUMBER_BUFFER(gBattleTextBuff3, 6, gBattleMoveDamage);
if (gBattleStruct->sentInPokes & 1)
if (wasSentOut || holdEffect == HOLD_EFFECT_EXP_SHARE)
{
PrepareStringBattle(STRINGID_PKMNGAINEDEXP, gBattleStruct->expGetterBattlerId);
}
else if (!IsValidForBattle(&gPlayerParty[gBattleStruct->expGetterMonId+1]))
else if (IsGen6ExpShareEnabled() && !gBattleStruct->teamGotExpMsgPrinted) // Print 'the rest of your team got exp' message once, when all of the sent-in mons were given experience
{
gLastUsedItem = ITEM_EXP_SHARE;
PrepareStringBattle(STRINGID_TEAMGAINEDEXP, 0);
PrepareStringBattle(STRINGID_TEAMGAINEDEXP, gBattleStruct->expGetterBattlerId);
gBattleStruct->teamGotExpMsgPrinted = TRUE;
}
MonGainEVs(&gPlayerParty[gBattleStruct->expGetterMonId], gBattleMons[gBattlerFainted].species);
MonGainEVs(&gPlayerParty[*expMonId], gBattleMons[gBattlerFainted].species);
}
gBattleStruct->sentInPokes >>= 1;
gBattleScripting.getexpState++;
}
}
@ -4235,16 +4257,16 @@ static void Cmd_getexp(void)
if (gBattleControllerExecFlags == 0)
{
gBattleResources->bufferB[gBattleStruct->expGetterBattlerId][0] = 0;
if (GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HP) && GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL) != MAX_LEVEL)
if (GetMonData(&gPlayerParty[*expMonId], MON_DATA_HP) && GetMonData(&gPlayerParty[*expMonId], MON_DATA_LEVEL) != MAX_LEVEL)
{
gBattleResources->beforeLvlUp->stats[STAT_HP] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_MAX_HP);
gBattleResources->beforeLvlUp->stats[STAT_ATK] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_ATK);
gBattleResources->beforeLvlUp->stats[STAT_DEF] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_DEF);
gBattleResources->beforeLvlUp->stats[STAT_SPEED] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPEED);
gBattleResources->beforeLvlUp->stats[STAT_SPATK] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPATK);
gBattleResources->beforeLvlUp->stats[STAT_SPDEF] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPDEF);
gBattleResources->beforeLvlUp->stats[STAT_HP] = GetMonData(&gPlayerParty[*expMonId], MON_DATA_MAX_HP);
gBattleResources->beforeLvlUp->stats[STAT_ATK] = GetMonData(&gPlayerParty[*expMonId], MON_DATA_ATK);
gBattleResources->beforeLvlUp->stats[STAT_DEF] = GetMonData(&gPlayerParty[*expMonId], MON_DATA_DEF);
gBattleResources->beforeLvlUp->stats[STAT_SPEED] = GetMonData(&gPlayerParty[*expMonId], MON_DATA_SPEED);
gBattleResources->beforeLvlUp->stats[STAT_SPATK] = GetMonData(&gPlayerParty[*expMonId], MON_DATA_SPATK);
gBattleResources->beforeLvlUp->stats[STAT_SPDEF] = GetMonData(&gPlayerParty[*expMonId], MON_DATA_SPDEF);
BtlController_EmitExpUpdate(gBattleStruct->expGetterBattlerId, BUFFER_A, gBattleStruct->expGetterMonId, gBattleMoveDamage);
BtlController_EmitExpUpdate(gBattleStruct->expGetterBattlerId, BUFFER_A, *expMonId, gBattleMoveDamage);
MarkBattlerForControllerExec(gBattleStruct->expGetterBattlerId);
}
gBattleScripting.getexpState++;
@ -4257,27 +4279,27 @@ static void Cmd_getexp(void)
if (gBattleResources->bufferB[expBattler][0] == CONTROLLER_TWORETURNVALUES && gBattleResources->bufferB[expBattler][1] == RET_VALUE_LEVELED_UP)
{
u16 temp, battler = 0xFF;
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gBattlerPartyIndexes[expBattler] == gBattleStruct->expGetterMonId)
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gBattlerPartyIndexes[expBattler] == *expMonId)
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[expBattler]], expBattler);
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, expBattler, gBattleStruct->expGetterMonId);
PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff2, 3, GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL));
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, expBattler, *expMonId);
PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff2, 3, GetMonData(&gPlayerParty[*expMonId], MON_DATA_LEVEL));
BattleScriptPushCursor();
gLeveledUpInBattle |= gBitTable[gBattleStruct->expGetterMonId];
gLeveledUpInBattle |= gBitTable[*expMonId];
gBattlescriptCurrInstr = BattleScript_LevelUp;
gBattleMoveDamage = T1_READ_32(&gBattleResources->bufferB[expBattler][2]);
AdjustFriendship(&gPlayerParty[gBattleStruct->expGetterMonId], FRIENDSHIP_EVENT_GROW_LEVEL);
AdjustFriendship(&gPlayerParty[*expMonId], FRIENDSHIP_EVENT_GROW_LEVEL);
// update battle mon structure after level up
if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterMonId && gBattleMons[0].hp)
if (gBattlerPartyIndexes[0] == *expMonId && gBattleMons[0].hp)
battler = 0;
else if (gBattlerPartyIndexes[2] == gBattleStruct->expGetterMonId && gBattleMons[2].hp && (gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
else if (gBattlerPartyIndexes[2] == *expMonId && gBattleMons[2].hp && (gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
battler = 2;
if (battler != 0xFF)
{
CopyMonLevelAndBaseStatsToBattleMon(battler, &gPlayerParty[gBattleStruct->expGetterMonId]);
CopyMonLevelAndBaseStatsToBattleMon(battler, &gPlayerParty[*expMonId]);
if (gStatuses3[battler] & STATUS3_POWER_TRICK)
SWAP(gBattleMons[battler].attack, gBattleMons[battler].defense, temp);
}
@ -4298,10 +4320,15 @@ static void Cmd_getexp(void)
}
else
{
gBattleStruct->expGetterMonId++;
if (gBattleStruct->expGetterMonId < PARTY_SIZE)
if ((++gBattleStruct->expOrderId) < PARTY_SIZE)
{
*expMonId = gBattleStruct->expGettersOrder[gBattleStruct->expOrderId];
if (*expMonId < PARTY_SIZE)
{
gBattleScripting.getexpState = 2; // loop again
else
break;
}
}
gBattleScripting.getexpState = 6; // we're done
}
break;
@ -4309,6 +4336,8 @@ static void Cmd_getexp(void)
if (gBattleControllerExecFlags == 0)
{
// not sure why gf clears the item and ability here
gBattleStruct->expOrderId = 0;
gBattleStruct->teamGotExpMsgPrinted = FALSE;
gBattleMons[gBattlerFainted].item = ITEM_NONE;
gBattleMons[gBattlerFainted].ability = ABILITY_NONE;
gBattlescriptCurrInstr = cmd->nextInstr;
@ -7044,9 +7073,10 @@ static void Cmd_handlelearnnewmove(void)
{
CMD_ARGS(const u8 *learnedMovePtr, const u8 *nothingToLearnPtr, bool8 isFirstMove);
u16 learnMove = MonTryLearningNewMove(&gPlayerParty[gBattleStruct->expGetterMonId], cmd->isFirstMove);
u32 monId = gBattleStruct->expGetterMonId;
u16 learnMove = MonTryLearningNewMove(&gPlayerParty[monId], cmd->isFirstMove);
while (learnMove == MON_ALREADY_KNOWS_MOVE)
learnMove = MonTryLearningNewMove(&gPlayerParty[gBattleStruct->expGetterMonId], FALSE);
learnMove = MonTryLearningNewMove(&gPlayerParty[monId], FALSE);
if (learnMove == MOVE_NONE)
{
@ -7060,7 +7090,7 @@ static void Cmd_handlelearnnewmove(void)
{
u32 battler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
if (gBattlerPartyIndexes[battler] == gBattleStruct->expGetterMonId
if (gBattlerPartyIndexes[battler] == monId
&& !(gBattleMons[battler].status2 & STATUS2_TRANSFORMED))
{
GiveMoveToBattleMon(&gBattleMons[battler], learnMove);
@ -7068,7 +7098,7 @@ static void Cmd_handlelearnnewmove(void)
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
battler = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
if (gBattlerPartyIndexes[battler] == gBattleStruct->expGetterMonId
if (gBattlerPartyIndexes[battler] == monId
&& !(gBattleMons[battler].status2 & STATUS2_TRANSFORMED))
{
GiveMoveToBattleMon(&gBattleMons[battler], learnMove);
@ -7834,15 +7864,14 @@ static bool8 SlideInLevelUpBanner(void)
static void DrawLevelUpBannerText(void)
{
u16 monLevel;
u8 monGender;
struct TextPrinterTemplate printerTemplate;
u8 *txtPtr;
u32 var;
monLevel = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL);
monGender = GetMonGender(&gPlayerParty[gBattleStruct->expGetterMonId]);
GetMonNickname(&gPlayerParty[gBattleStruct->expGetterMonId], gStringVar4);
struct Pokemon *mon = &gPlayerParty[gBattleStruct->expGetterMonId];
u32 monLevel = GetMonData(mon, MON_DATA_LEVEL);
u8 monGender = GetMonGender(mon);
GetMonNickname(mon, gStringVar4);
printerTemplate.currentChar = gStringVar4;
printerTemplate.windowId = B_WIN_LEVEL_UP_BANNER;
@ -7912,20 +7941,18 @@ static bool8 SlideOutLevelUpBanner(void)
static void PutMonIconOnLvlUpBanner(void)
{
u8 spriteId;
const u16 *iconPal;
struct SpriteSheet iconSheet;
struct SpritePalette iconPalSheet;
u16 species = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPECIES);
u32 personality = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_PERSONALITY);
struct Pokemon *mon = &gPlayerParty[gBattleStruct->expGetterMonId];
u32 species = GetMonData(mon, MON_DATA_SPECIES);
u32 personality = GetMonData(mon, MON_DATA_PERSONALITY);
const u8 *iconPtr = GetMonIconPtr(species, personality);
iconSheet.data = iconPtr;
iconSheet.data = GetMonIconPtr(species, personality);
iconSheet.size = 0x200;
iconSheet.tag = TAG_LVLUP_BANNER_MON_ICON;
iconPal = GetValidMonIconPalettePtr(species);
iconPalSheet.data = iconPal;
iconPalSheet.data = GetValidMonIconPalettePtr(species);
iconPalSheet.tag = TAG_LVLUP_BANNER_MON_ICON;
LoadSpriteSheet(&iconSheet);
@ -16023,13 +16050,7 @@ u8 GetFirstFaintedPartyIndex(u8 battler)
void ApplyExperienceMultipliers(s32 *expAmount, u8 expGetterMonId, u8 faintedBattler)
{
u16 item = GetMonData(&gPlayerParty[expGetterMonId], MON_DATA_HELD_ITEM);
u8 holdEffect;
if (item == ITEM_ENIGMA_BERRY_E_READER)
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
else
holdEffect = ItemId_GetHoldEffect(item);
u32 holdEffect = GetMonHoldEffect(&gPlayerParty[expGetterMonId]);
if (IsTradedMon(&gPlayerParty[expGetterMonId]))
*expAmount = (*expAmount * 150) / 100;