Review
This commit is contained in:
parent
ca590818b8
commit
3bd248f7ae
2 changed files with 14 additions and 18 deletions
|
@ -1410,6 +1410,14 @@ void Task_PlayerController_RestoreBgmAfterCry(u8 taskId)
|
|||
#define tExpTask_gainedExp_2 data[4] // Stored as two half-words containing a word.
|
||||
#define tExpTask_frames data[10]
|
||||
|
||||
static void DynamaxModifyHPLevelUp(struct Pokemon *mon, u32 battler, u32 oldMaxHP)
|
||||
{
|
||||
ApplyDynamaxHPMultiplier(mon);
|
||||
gBattleScripting.levelUpHP = GetMonData(mon, MON_DATA_MAX_HP) - oldMaxHP; // overwrite levelUpHP since it overflows
|
||||
gBattleMons[battler].hp += gBattleScripting.levelUpHP;
|
||||
SetMonData(mon, MON_DATA_HP, &gBattleMons[battler].hp);
|
||||
}
|
||||
|
||||
static s32 GetTaskExpValue(u8 taskId)
|
||||
{
|
||||
return (u16)(gTasks[taskId].tExpTask_gainedExp_1) | (gTasks[taskId].tExpTask_gainedExp_2 << 16);
|
||||
|
@ -1437,13 +1445,7 @@ static void Task_GiveExpToMon(u8 taskId)
|
|||
|
||||
// Reapply Dynamax HP multiplier after stats are recalculated.
|
||||
if (GetActiveGimmick(battler) == GIMMICK_DYNAMAX && monId == gBattlerPartyIndexes[battler])
|
||||
{
|
||||
ApplyDynamaxHPMultiplier(mon);
|
||||
// overwrite levelUpHP since it overflows
|
||||
gBattleScripting.levelUpHP = GetMonData(mon, MON_DATA_MAX_HP) - oldMaxHP;
|
||||
gBattleMons[battler].hp += gBattleScripting.levelUpHP;
|
||||
SetMonData(mon, MON_DATA_HP, &gBattleMons[battler].hp);
|
||||
}
|
||||
DynamaxModifyHPLevelUp(mon, battler, oldMaxHP);
|
||||
|
||||
gainedExp -= nextLvlExp - currExp;
|
||||
BtlController_EmitTwoReturnValues(battler, BUFFER_B, RET_VALUE_LEVELED_UP, gainedExp);
|
||||
|
@ -1524,13 +1526,7 @@ static void Task_GiveExpWithExpBar(u8 taskId)
|
|||
|
||||
// Reapply Dynamax HP multiplier after stats are recalculated.
|
||||
if (GetActiveGimmick(battler) == GIMMICK_DYNAMAX && monId == gBattlerPartyIndexes[battler])
|
||||
{
|
||||
ApplyDynamaxHPMultiplier(mon);
|
||||
// overwrite levelUpHP since it overflows
|
||||
gBattleScripting.levelUpHP = GetMonData(mon, MON_DATA_MAX_HP) - oldMaxHP;
|
||||
gBattleMons[battler].hp += gBattleScripting.levelUpHP;
|
||||
SetMonData(mon, MON_DATA_HP, &gBattleMons[battler].hp);
|
||||
}
|
||||
DynamaxModifyHPLevelUp(mon, battler, oldMaxHP);
|
||||
|
||||
gainedExp -= expOnNextLvl - currExp;
|
||||
BtlController_EmitTwoReturnValues(battler, BUFFER_B, RET_VALUE_LEVELED_UP, gainedExp);
|
||||
|
|
|
@ -123,7 +123,7 @@ bool32 CanDynamax(u32 battler)
|
|||
// Returns whether a battler is transformed into a Gigantamax form.
|
||||
bool32 IsGigantamaxed(u32 battler)
|
||||
{
|
||||
struct Pokemon *mon = &GetSideParty(GetBattlerSide(battler))[gBattlerPartyIndexes[battler]];
|
||||
struct Pokemon *mon = GetPartyBattlerData(battler);
|
||||
if ((gSpeciesInfo[gBattleMons[battler].species].isGigantamax) && GetMonData(mon, MON_DATA_GIGANTAMAX_FACTOR))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
|
@ -151,7 +151,7 @@ u16 GetNonDynamaxHP(u32 battler)
|
|||
return gBattleMons[battler].hp;
|
||||
else
|
||||
{
|
||||
struct Pokemon *mon = &GetSideParty(GetBattlerSide(battler))[gBattlerPartyIndexes[battler]];
|
||||
struct Pokemon *mon = GetPartyBattlerData(battler);
|
||||
uq4_12_t mult = GetDynamaxLevelHPMultiplier(GetMonData(mon, MON_DATA_DYNAMAX_LEVEL), TRUE);
|
||||
u32 hp = UQ_4_12_TO_INT((gBattleMons[battler].hp * mult) + UQ_4_12_ROUND);
|
||||
return hp;
|
||||
|
@ -165,7 +165,7 @@ u16 GetNonDynamaxMaxHP(u32 battler)
|
|||
return gBattleMons[battler].maxHP;
|
||||
else
|
||||
{
|
||||
struct Pokemon *mon = &GetSideParty(GetBattlerSide(battler))[gBattlerPartyIndexes[battler]];
|
||||
struct Pokemon *mon = GetPartyBattlerData(battler);
|
||||
uq4_12_t mult = GetDynamaxLevelHPMultiplier(GetMonData(mon, MON_DATA_DYNAMAX_LEVEL), TRUE);
|
||||
u32 maxHP = UQ_4_12_TO_INT((gBattleMons[battler].maxHP * mult) + UQ_4_12_ROUND);
|
||||
return maxHP;
|
||||
|
@ -510,7 +510,7 @@ void BS_UpdateDynamax(void)
|
|||
{
|
||||
NATIVE_ARGS();
|
||||
u32 battler = gBattleScripting.battler;
|
||||
struct Pokemon *mon = &GetSideParty(GetBattlerSide(battler))[gBattlerPartyIndexes[battler]];
|
||||
struct Pokemon *mon = GetPartyBattlerData(battler);
|
||||
|
||||
if (!IsGigantamaxed(battler)) // RecalcBattlerStats will get called on form change.
|
||||
RecalcBattlerStats(battler, mon, GetActiveGimmick(battler) == GIMMICK_DYNAMAX);
|
||||
|
|
Loading…
Reference in a new issue