summaryrefslogtreecommitdiff
path: root/src/pokemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pokemon.c')
-rw-r--r--src/pokemon.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/pokemon.c b/src/pokemon.c
index 2485caa50..cb7be1715 100644
--- a/src/pokemon.c
+++ b/src/pokemon.c
@@ -2649,25 +2649,20 @@ bool8 sub_80688F8(u8 caseId, u8 battlerId)
return TRUE;
}
-static s32 GetDeoxysStat(struct Pokemon *mon, s32 statId)
+static u16 GetDeoxysStat(struct Pokemon *mon, s32 statId)
{
s32 ivVal, evVal;
- s32 statValue;
- u8 nature, statId_;
+ u16 statValue = 0;
+ u8 nature;
- if (gBattleTypeFlags & BATTLE_TYPE_20)
- return 0;
- if (GetMonData(mon, MON_DATA_SPECIES, NULL) != SPECIES_DEOXYS)
+ if (gBattleTypeFlags & BATTLE_TYPE_20 || GetMonData(mon, MON_DATA_SPECIES, NULL) != SPECIES_DEOXYS)
return 0;
ivVal = GetMonData(mon, MON_DATA_HP_IV + statId, NULL);
evVal = GetMonData(mon, MON_DATA_HP_EV + statId, NULL);
- statValue = (u16)(((sDeoxysBaseStats[statId] * 2 + ivVal + evVal / 4) * mon->level) / 100 + 5);
-
+ statValue = ((sDeoxysBaseStats[statId] * 2 + ivVal + evVal / 4) * mon->level) / 100 + 5;
nature = GetNature(mon);
- statId_ = statId; // needed to match
- statValue = ModifyStatByNature(nature, statValue, statId_);
-
+ statValue = ModifyStatByNature(nature, statValue, (u8)statId);
return statValue;
}
@@ -3584,27 +3579,27 @@ u32 GetMonData(struct Pokemon *mon, s32 field, u8* data)
ret = mon->maxHP;
break;
case MON_DATA_ATK:
- ret = (u16)GetDeoxysStat(mon, STAT_ATK);
+ ret = GetDeoxysStat(mon, STAT_ATK);
if (!ret)
ret = mon->attack;
break;
case MON_DATA_DEF:
- ret = (u16)GetDeoxysStat(mon, STAT_DEF);
+ ret = GetDeoxysStat(mon, STAT_DEF);
if (!ret)
ret = mon->defense;
break;
case MON_DATA_SPEED:
- ret = (u16)GetDeoxysStat(mon, STAT_SPEED);
+ ret = GetDeoxysStat(mon, STAT_SPEED);
if (!ret)
ret = mon->speed;
break;
case MON_DATA_SPATK:
- ret = (u16)GetDeoxysStat(mon, STAT_SPATK);
+ ret = GetDeoxysStat(mon, STAT_SPATK);
if (!ret)
ret = mon->spAttack;
break;
case MON_DATA_SPDEF:
- ret = (u16)GetDeoxysStat(mon, STAT_SPDEF);
+ ret = GetDeoxysStat(mon, STAT_SPDEF);
if (!ret)
ret = mon->spDefense;
break;