Revert Dynamax HP on fainting (#4681)
* Revert Dynamax HP on fainting Calls UndoDynamax whenever a mon faints to ensure that its HP is reverted and the relevant data is cleared. Updates UndoDynamax to CalculateMonStats after applying the HP reversion to prevent fainted mons from retaining their boosted Max HP until the end of the battle. * Update src/battle_main.c --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>
This commit is contained in:
parent
13d4d29e1e
commit
0ed8d09d47
2 changed files with 4 additions and 0 deletions
|
@ -207,6 +207,7 @@ void UndoDynamax(u16 battlerId)
|
|||
u16 mult = UQ_4_12(1.0/1.5); // placeholder
|
||||
gBattleMons[battlerId].hp = UQ_4_12_TO_INT((GetMonData(mon, MON_DATA_HP) * mult + 1) + UQ_4_12_ROUND); // round up
|
||||
SetMonData(mon, MON_DATA_HP, &gBattleMons[battlerId].hp);
|
||||
CalculateMonStats(mon);
|
||||
}
|
||||
|
||||
// Makes sure there are no Dynamax flags set, including on switch / faint.
|
||||
|
|
|
@ -3677,6 +3677,9 @@ const u8* FaintClearSetData(u32 battler)
|
|||
gBattleStruct->zmove.active = FALSE;
|
||||
gBattleStruct->zmove.toBeUsed[battler] = MOVE_NONE;
|
||||
gBattleStruct->zmove.effect = EFFECT_HIT;
|
||||
// Clear Dynamax data
|
||||
UndoDynamax(battler);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue