mirror of
https://github.com/rh-hideout/pokeemerald-expansion.git
synced 2026-03-21 18:04:50 -05:00
Fixes present master merge regression (#9301)
Co-authored-by: PhallenTree <168426989+PhallenTree@users.noreply.github.com>
This commit is contained in:
parent
81a5622b51
commit
7ba87890b5
|
|
@ -1230,6 +1230,19 @@ static enum CancelerResult CancelerMoveFailure(struct BattleContext *ctx)
|
|||
|| gBattleMons[ctx->battlerAtk].volatiles.embargo)
|
||||
battleScript = BattleScript_ButItFailed;
|
||||
break;
|
||||
case EFFECT_PRESENT:
|
||||
{
|
||||
u32 rand = RandomUniform(RNG_PRESENT, 0, 0xFF);
|
||||
if (rand < 102)
|
||||
gBattleStruct->presentBasePower = 40;
|
||||
else if (rand < 178)
|
||||
gBattleStruct->presentBasePower = 80;
|
||||
else if (rand < 204)
|
||||
gBattleStruct->presentBasePower = 120;
|
||||
else
|
||||
gBattleStruct->presentBasePower = 0; // Healing
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -1844,6 +1857,7 @@ static bool32 IsMoveParentalBondAffected(struct BattleContext *ctx)
|
|||
|| GetMoveEffect(ctx->move) == EFFECT_SEMI_INVULNERABLE
|
||||
|| GetMoveEffect(ctx->move) == EFFECT_TWO_TURNS_ATTACK
|
||||
|| GetActiveGimmick(ctx->battlerAtk) == GIMMICK_Z_MOVE
|
||||
|| (GetMoveEffect(ctx->move) == EFFECT_PRESENT && gBattleStruct->presentBasePower == 0)
|
||||
|| ctx->move == MOVE_STRUGGLE)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
|
|
|
|||
|
|
@ -9191,46 +9191,10 @@ static void Cmd_presentdamagecalculation(void)
|
|||
{
|
||||
CMD_ARGS();
|
||||
|
||||
u32 rand = RandomUniform(RNG_PRESENT, 0, 0xFF);
|
||||
|
||||
/* Don't reroll present effect/power for the second hit of Parental Bond.
|
||||
* Not sure if this is the correct behaviour, but bulbapedia states
|
||||
* that if present heals the foe, it doesn't strike twice, and if it deals
|
||||
* damage, the second strike will always deal damage too. This is a simple way
|
||||
* to replicate that effect.
|
||||
*/
|
||||
if (gSpecialStatuses[gBattlerAttacker].parentalBondState != PARENTAL_BOND_2ND_HIT)
|
||||
{
|
||||
if (rand < 102)
|
||||
{
|
||||
gBattleStruct->presentBasePower = 40;
|
||||
}
|
||||
else if (rand < 178)
|
||||
{
|
||||
gBattleStruct->presentBasePower = 80;
|
||||
}
|
||||
else if (rand < 204)
|
||||
{
|
||||
gBattleStruct->presentBasePower = 120;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSpecialStatuses[gBattlerAttacker].parentalBondState = PARENTAL_BOND_OFF;
|
||||
gSpecialStatuses[gBattlerAttacker].multiHitOn = 0;
|
||||
gMultiHitCounter = 0;
|
||||
SetHealAmount(gBattlerTarget, GetNonDynamaxMaxHP(gBattlerTarget) / 4);
|
||||
gBattleStruct->presentBasePower = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (gBattleStruct->presentBasePower)
|
||||
{
|
||||
gBattlescriptCurrInstr = BattleScript_HitFromDamageCalc;
|
||||
}
|
||||
else if (gBattlerTarget == BATTLE_PARTNER(gBattlerAttacker) && GetBattlerAbility(gBattlerTarget) == ABILITY_TELEPATHY)
|
||||
{
|
||||
gBattlescriptCurrInstr = BattleScript_MoveMissedPause;
|
||||
}
|
||||
else if (gBattleMons[gBattlerTarget].maxHP == gBattleMons[gBattlerTarget].hp)
|
||||
{
|
||||
gBattlescriptCurrInstr = BattleScript_AlreadyAtFullHp;
|
||||
|
|
@ -9238,6 +9202,7 @@ static void Cmd_presentdamagecalculation(void)
|
|||
else
|
||||
{
|
||||
gBattleStruct->moveResultFlags[gBattlerTarget] &= ~(MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE);
|
||||
SetHealAmount(gBattlerTarget, GetNonDynamaxMaxHP(gBattlerTarget) / 4);
|
||||
gBattlescriptCurrInstr = BattleScript_PresentHealTarget;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8277,7 +8277,9 @@ static inline uq4_12_t CalcTypeEffectivenessMultiplierInternal(struct BattleCont
|
|||
if (ctx->updateFlags && (illusionSpecies = GetIllusionMonSpecies(ctx->battlerDef)))
|
||||
TryNoticeIllusionInTypeEffectiveness(ctx->move, ctx->moveType, ctx->battlerAtk, ctx->battlerDef, modifier, illusionSpecies);
|
||||
|
||||
if (GetMoveCategory(ctx->move) == DAMAGE_CATEGORY_STATUS && ctx->move != MOVE_THUNDER_WAVE)
|
||||
bool32 isPresentHealing = GetMoveEffect(ctx->move) == EFFECT_PRESENT && gBattleStruct->presentBasePower == 0;
|
||||
bool32 ignoreTypeCalc = isPresentHealing || GetMoveCategory(ctx->move) == DAMAGE_CATEGORY_STATUS;
|
||||
if (ignoreTypeCalc && ctx->move != MOVE_THUNDER_WAVE)
|
||||
{
|
||||
modifier = UQ_4_12(1.0);
|
||||
if (B_GLARE_GHOST < GEN_4 && ctx->move == MOVE_GLARE && IS_BATTLER_OF_TYPE(ctx->battlerDef, TYPE_GHOST))
|
||||
|
|
@ -8322,7 +8324,7 @@ static inline uq4_12_t CalcTypeEffectivenessMultiplierInternal(struct BattleCont
|
|||
modifier = UQ_4_12(1.0);
|
||||
}
|
||||
|
||||
if (((ctx->abilityDef == ABILITY_WONDER_GUARD && modifier <= UQ_4_12(1.0))
|
||||
if (((ctx->abilityDef == ABILITY_WONDER_GUARD && modifier <= UQ_4_12(1.0) && !isPresentHealing)
|
||||
|| (ctx->abilityDef == ABILITY_TELEPATHY && ctx->battlerDef == BATTLE_PARTNER(ctx->battlerAtk)))
|
||||
&& GetMovePower(ctx->move) != 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ ASSUMPTIONS
|
|||
|
||||
SINGLE_BATTLE_TEST("Present healing through Wonder Guard is still considered to have affected the target")
|
||||
{
|
||||
KNOWN_FAILING;
|
||||
GIVEN {
|
||||
ASSUME(GetMoveEffect(MOVE_MIRROR_MOVE) == EFFECT_MIRROR_MOVE);
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user