Fix Download raising the wrong stat

This commit is contained in:
DizzyEggg 2019-02-09 13:30:45 +01:00
parent 691544fa0b
commit 872389b15c

View File

@ -2714,16 +2714,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
case ABILITY_DOWNLOAD: case ABILITY_DOWNLOAD:
if (!gSpecialStatuses[battler].switchInAbilityDone) if (!gSpecialStatuses[battler].switchInAbilityDone)
{ {
u8 statId; u32 statId, opposingBattler;
u32 opposingBattler = BATTLE_OPPOSITE(battler); u32 opposingDef = 0, opposingSpDef = 0;
u32 opposingDef = gBattleMons[opposingBattler].defense
* gStatStageRatios[gBattleMons[opposingBattler].statStages[STAT_DEF]][0]
/ gStatStageRatios[gBattleMons[opposingBattler].statStages[STAT_DEF]][1];
u32 opposingSpDef = gBattleMons[opposingBattler].spDefense
* gStatStageRatios[gBattleMons[opposingBattler].statStages[STAT_SPDEF]][0]
/ gStatStageRatios[gBattleMons[opposingBattler].statStages[STAT_SPDEF]][1];
opposingBattler = BATTLE_PARTNER(opposingBattler); opposingBattler = BATTLE_OPPOSITE(battler);
for (i = 0; i < 2; opposingBattler ^= BIT_SIDE, i++)
{
if (IsBattlerAlive(opposingBattler)) if (IsBattlerAlive(opposingBattler))
{ {
opposingDef += gBattleMons[opposingBattler].defense opposingDef += gBattleMons[opposingBattler].defense
@ -2733,11 +2729,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
* gStatStageRatios[gBattleMons[opposingBattler].statStages[STAT_SPDEF]][0] * gStatStageRatios[gBattleMons[opposingBattler].statStages[STAT_SPDEF]][0]
/ gStatStageRatios[gBattleMons[opposingBattler].statStages[STAT_SPDEF]][1]; / gStatStageRatios[gBattleMons[opposingBattler].statStages[STAT_SPDEF]][1];
} }
}
if (opposingSpDef > opposingDef) if (opposingDef < opposingSpDef)
statId = STAT_SPATK;
else
statId = STAT_ATK; statId = STAT_ATK;
else
statId = STAT_SPATK;
gSpecialStatuses[battler].switchInAbilityDone = 1; gSpecialStatuses[battler].switchInAbilityDone = 1;