Fixed AI_FLAG_CHECK_VIABILITY changing the toxic counter in some cases (#6402)

Co-authored-by: Hedara <hedara90@gmail.com>
This commit is contained in:
hedara90 2025-03-11 13:58:49 +01:00 committed by GitHub
parent 40dd3a7688
commit a26a47cab8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2634,12 +2634,13 @@ static u32 GetPoisonDamage(u32 battlerId)
}
else if (gBattleMons[battlerId].status1 & STATUS1_TOXIC_POISON)
{
u32 status1Temp = gBattleMons[battlerId].status1;
damage = gBattleMons[battlerId].maxHP / 16;
if (damage == 0)
damage = 1;
if ((gBattleMons[battlerId].status1 & STATUS1_TOXIC_COUNTER) != STATUS1_TOXIC_TURN(15)) // not 16 turns
gBattleMons[battlerId].status1 += STATUS1_TOXIC_TURN(1);
damage *= (gBattleMons[battlerId].status1 & STATUS1_TOXIC_COUNTER) >> 8;
if ((status1Temp & STATUS1_TOXIC_COUNTER) != STATUS1_TOXIC_TURN(15)) // not 16 turns
status1Temp += STATUS1_TOXIC_TURN(1);
damage *= (status1Temp & STATUS1_TOXIC_COUNTER) >> 8;
}
return damage;
}