fix type, add bugfix

This commit is contained in:
Kurausukun 2022-06-17 21:58:56 -04:00
parent 23e9455e0a
commit d3c8346a67

View File

@ -628,7 +628,11 @@ static void ModulateByTypeEffectiveness(u8 atkType, u8 defType1, u8 defType2, u8
u8 GetMostSuitableMonToSwitchInto(void)
{
u8 opposingBattler;
#ifdef BUGFIX
s32 bestDmg;
#else
u8 bestDmg; // Note: should be changed to s32 since it is also used for the actual damage done later
#endif
u8 bestMonId;
u8 battlerIn1, battlerIn2;
s32 firstId;
@ -684,8 +688,8 @@ u8 GetMostSuitableMonToSwitchInto(void)
while (invalidMons != 0x3F) // All mons are invalid.
{
bestDmg = ;
bestMonId = 6;
bestDmg = TYPE_MUL_NO_EFFECT;
bestMonId = PARTY_SIZE;
// Find the mon whose type is the most suitable offensively.
for (i = firstId; i < lastId; i++)
{
@ -706,7 +710,7 @@ u8 GetMostSuitableMonToSwitchInto(void)
/* Possible bug: this comparison gives the type that takes the most damage, when
a "good" AI would want to select the type that takes the least damage. Unknown if this
is a legitimate mistake or if it's an intentional, if weird, design choice*/
is a legitimate mistake or if it's an intentional, if weird, design choice */
if (bestDmg < typeDmg)
{
bestDmg = typeDmg;