Fix stat access for stats other than Attack in BS_GetStatValue (#8684)
This commit is contained in:
parent
22fb105f70
commit
0a1d8bf754
@ -16609,7 +16609,27 @@ void BS_GetStatValue(void)
|
||||
{
|
||||
NATIVE_ARGS(u8 stat);
|
||||
u32 stat = cmd->stat;
|
||||
gBattleStruct->passiveHpUpdate[gBattlerAttacker] = *(u16 *)(&gBattleMons[gBattlerTarget].attack) + (stat - 1);
|
||||
switch (stat)
|
||||
{
|
||||
case STAT_ATK:
|
||||
gBattleStruct->passiveHpUpdate[gBattlerAttacker] = gBattleMons[gBattlerTarget].attack;
|
||||
break;
|
||||
case STAT_DEF:
|
||||
gBattleStruct->passiveHpUpdate[gBattlerAttacker] = gBattleMons[gBattlerTarget].defense;
|
||||
break;
|
||||
case STAT_SPATK:
|
||||
gBattleStruct->passiveHpUpdate[gBattlerAttacker] = gBattleMons[gBattlerTarget].spAttack;
|
||||
break;
|
||||
case STAT_SPDEF:
|
||||
gBattleStruct->passiveHpUpdate[gBattlerAttacker] = gBattleMons[gBattlerTarget].spDefense;
|
||||
break;
|
||||
case STAT_SPEED:
|
||||
gBattleStruct->passiveHpUpdate[gBattlerAttacker] = gBattleMons[gBattlerTarget].speed;
|
||||
break;
|
||||
default:
|
||||
// Add errorf here on upcoming
|
||||
return;
|
||||
}
|
||||
gBattleStruct->passiveHpUpdate[gBattlerAttacker] *= gStatStageRatios[gBattleMons[gBattlerTarget].statStages[stat]][0];
|
||||
gBattleStruct->passiveHpUpdate[gBattlerAttacker] /= gStatStageRatios[gBattleMons[gBattlerTarget].statStages[stat]][1];
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user