mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-03-30 01:09:34 +01:00
Restore ModifyStatByNature bug notes
This commit is contained in:
parent
f9f91be60a
commit
7f49f26331
@ -5775,27 +5775,36 @@ u8 GetTrainerEncounterMusicId(u16 trainerOpponentId)
|
|||||||
return TRAINER_ENCOUNTER_MUSIC(trainerOpponentId);
|
return TRAINER_ENCOUNTER_MUSIC(trainerOpponentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex)
|
u16 ModifyStatByNature(u8 nature, u16 stat, u8 statIndex)
|
||||||
{
|
{
|
||||||
|
// Because this is a u16 it will be unable to store the
|
||||||
|
// result of the multiplication for any stat > 595 for a
|
||||||
|
// positive nature and > 728 for a negative nature.
|
||||||
|
// Neither occur in the base game, but this can happen if
|
||||||
|
// any Nature-affected base stat is increased to a value
|
||||||
|
// above 248. The closest by default is Shuckle at 230.
|
||||||
|
#ifdef BUGFIX
|
||||||
|
u32 retVal;
|
||||||
|
#else
|
||||||
u16 retVal;
|
u16 retVal;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Don't modify HP, Accuracy, or Evasion by nature
|
// Don't modify HP, Accuracy, or Evasion by nature
|
||||||
if (statIndex <= STAT_HP || statIndex > NUM_NATURE_STATS)
|
if (statIndex <= STAT_HP || statIndex > NUM_NATURE_STATS)
|
||||||
{
|
return stat;
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (gNatureStatTable[nature][statIndex - 1])
|
switch (gNatureStatTable[nature][statIndex - 1])
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
retVal = n * 110;
|
retVal = stat * 110;
|
||||||
retVal /= 100;
|
retVal /= 100;
|
||||||
break;
|
break;
|
||||||
case -1:
|
case -1:
|
||||||
retVal = n * 90;
|
retVal = stat * 90;
|
||||||
retVal /= 100;
|
retVal /= 100;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
retVal = n;
|
retVal = stat;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user