Port/decompile field_control_avatar
This commit is contained in:
+6
-6
@@ -3251,7 +3251,7 @@ u8 GetLevelFromMonExp(struct Pokemon *mon)
|
||||
u32 exp = GetMonData(mon, MON_DATA_EXP, NULL);
|
||||
s32 level = 1;
|
||||
|
||||
while (level <= MAX_MON_LEVEL && gExperienceTables[gBaseStats[species].growthRate][level] <= exp)
|
||||
while (level <= MAX_LEVEL && gExperienceTables[gBaseStats[species].growthRate][level] <= exp)
|
||||
level++;
|
||||
|
||||
return level - 1;
|
||||
@@ -3263,7 +3263,7 @@ u8 GetLevelFromBoxMonExp(struct BoxPokemon *boxMon)
|
||||
u32 exp = GetBoxMonData(boxMon, MON_DATA_EXP, NULL);
|
||||
s32 level = 1;
|
||||
|
||||
while (level <= MAX_MON_LEVEL && gExperienceTables[gBaseStats[species].growthRate][level] <= exp)
|
||||
while (level <= MAX_LEVEL && gExperienceTables[gBaseStats[species].growthRate][level] <= exp)
|
||||
level++;
|
||||
|
||||
return level - 1;
|
||||
@@ -5145,7 +5145,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
retVal = FALSE;
|
||||
}
|
||||
if ((itemEffect[cmdIndex] & 0x40) // raise level
|
||||
&& GetMonData(mon, MON_DATA_LEVEL, NULL) != MAX_MON_LEVEL)
|
||||
&& GetMonData(mon, MON_DATA_LEVEL, NULL) != MAX_LEVEL)
|
||||
{
|
||||
dataUnsigned = gExperienceTables[gBaseStats[GetMonData(mon, MON_DATA_SPECIES, NULL)].growthRate][GetMonData(mon, MON_DATA_LEVEL, NULL) + 1];
|
||||
SetMonData(mon, MON_DATA_EXP, &dataUnsigned);
|
||||
@@ -6430,12 +6430,12 @@ bool8 TryIncrementMonLevel(struct Pokemon *mon)
|
||||
u16 species = GetMonData(mon, MON_DATA_SPECIES, 0);
|
||||
u8 nextLevel = GetMonData(mon, MON_DATA_LEVEL, 0) + 1;
|
||||
u32 expPoints = GetMonData(mon, MON_DATA_EXP, 0);
|
||||
if (expPoints > gExperienceTables[gBaseStats[species].growthRate][MAX_MON_LEVEL])
|
||||
if (expPoints > gExperienceTables[gBaseStats[species].growthRate][MAX_LEVEL])
|
||||
{
|
||||
expPoints = gExperienceTables[gBaseStats[species].growthRate][MAX_MON_LEVEL];
|
||||
expPoints = gExperienceTables[gBaseStats[species].growthRate][MAX_LEVEL];
|
||||
SetMonData(mon, MON_DATA_EXP, &expPoints);
|
||||
}
|
||||
if (nextLevel > MAX_MON_LEVEL || expPoints < gExperienceTables[gBaseStats[species].growthRate][nextLevel])
|
||||
if (nextLevel > MAX_LEVEL || expPoints < gExperienceTables[gBaseStats[species].growthRate][nextLevel])
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user