level reappears in healthbox and form reversion occurs correctly when Dynamax ends
This commit is contained in:
parent
40102fe418
commit
6dc3c7a143
3 changed files with 4 additions and 3 deletions
|
@ -498,4 +498,4 @@ extern const u8 BattleScript_DynamaxBegins[];
|
|||
extern const u8 BattleScript_DynamaxEnds[];
|
||||
extern const u8 BattleScript_MoveBlockedByDynamax[];
|
||||
|
||||
#endif // GUARD_BATTLE_SCRIPTS_H
|
||||
#endif // GUARD_BATTLE_SCRIPTS_H
|
||||
|
|
|
@ -193,13 +193,14 @@ void PrepareBattlerForDynamax(u16 battlerId)
|
|||
void UndoDynamax(u16 battlerId)
|
||||
{
|
||||
u8 side = GetBattlerSide(battlerId);
|
||||
// Revert HP if battler is Dynamaxed.
|
||||
// Revert HP and try form reversion if battler is Dynamaxed.
|
||||
if (IsDynamaxed(battlerId))
|
||||
{
|
||||
struct Pokemon *party = (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
|
||||
u16 mult = UQ_4_12(1.0/1.5); // placeholder
|
||||
u16 hp = UQ_4_12_TO_INT((gBattleMons[battlerId].hp * mult + 1) + UQ_4_12_ROUND); // round up
|
||||
SetMonData(&party[gBattlerPartyIndexes[battlerId]], MON_DATA_HP, &hp);
|
||||
TryBattleFormChange(battlerId, FORM_CHANGE_BATTLE_SWITCH);
|
||||
}
|
||||
// Makes sure there are no Dynamax flags set, including on switch / faint.
|
||||
gBattleStruct->dynamax.dynamaxed[battlerId] = FALSE;
|
||||
|
|
|
@ -11337,7 +11337,7 @@ static void Cmd_various(void)
|
|||
else
|
||||
mon = &gEnemyParty[gBattlerPartyIndexes[battler]];
|
||||
RecalcBattlerStats(battler, mon);
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], mon, HP_BOTH);
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[battler], mon, HEALTHBOX_ALL);
|
||||
break;
|
||||
}
|
||||
case VARIOUS_JUMP_IF_TARGET_DYNAMAXED:
|
||||
|
|
Loading…
Reference in a new issue