mirror of
https://github.com/pret/pokeemerald.git
synced 2026-05-05 21:07:17 -05:00
Fixes Explosion behavior when 3 mons can endure hit (#7594)
This commit is contained in:
parent
9b5b69ae49
commit
53e7699649
|
|
@ -2181,7 +2181,7 @@ static void Cmd_adjustdamage(void)
|
|||
u32 moveTarget = GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove);
|
||||
enum BattleMoveEffects moveEffect = GetMoveEffect(gCurrentMove);
|
||||
bool32 calcSpreadMoveDamage = IsSpreadMove(moveTarget) && !IsBattleMoveStatus(gCurrentMove);
|
||||
bool32 enduredHit = FALSE;
|
||||
u32 enduredHit = 0;
|
||||
|
||||
for (battlerDef = 0; battlerDef < gBattlersCount; battlerDef++)
|
||||
{
|
||||
|
|
@ -2227,30 +2227,30 @@ static void Cmd_adjustdamage(void)
|
|||
|
||||
if (moveEffect == EFFECT_FALSE_SWIPE)
|
||||
{
|
||||
enduredHit = TRUE;
|
||||
enduredHit |= 1u << battlerDef;
|
||||
}
|
||||
else if (gProtectStructs[battlerDef].endured)
|
||||
{
|
||||
enduredHit = TRUE;
|
||||
enduredHit |= 1u << battlerDef;
|
||||
gBattleStruct->moveResultFlags[battlerDef] |= MOVE_RESULT_FOE_ENDURED;
|
||||
}
|
||||
else if (holdEffect == HOLD_EFFECT_FOCUS_BAND && rand < param)
|
||||
{
|
||||
enduredHit = TRUE;
|
||||
enduredHit |= 1u << battlerDef;
|
||||
RecordItemEffectBattle(battlerDef, holdEffect);
|
||||
gLastUsedItem = gBattleMons[battlerDef].item;
|
||||
gBattleStruct->moveResultFlags[battlerDef] |= MOVE_RESULT_FOE_HUNG_ON;
|
||||
}
|
||||
else if (B_STURDY >= GEN_5 && GetBattlerAbility(battlerDef) == ABILITY_STURDY && IsBattlerAtMaxHp(battlerDef))
|
||||
{
|
||||
enduredHit = TRUE;
|
||||
enduredHit |= 1u << battlerDef;
|
||||
RecordAbilityBattle(battlerDef, ABILITY_STURDY);
|
||||
gLastUsedAbility = ABILITY_STURDY;
|
||||
gBattleStruct->moveResultFlags[battlerDef] |= MOVE_RESULT_STURDIED;
|
||||
}
|
||||
else if (holdEffect == HOLD_EFFECT_FOCUS_SASH && IsBattlerAtMaxHp(battlerDef))
|
||||
{
|
||||
enduredHit = TRUE;
|
||||
enduredHit |= 1u << battlerDef;
|
||||
RecordItemEffectBattle(battlerDef, holdEffect);
|
||||
gLastUsedItem = gBattleMons[battlerDef].item;
|
||||
gBattleStruct->moveResultFlags[battlerDef] |= MOVE_RESULT_FOE_HUNG_ON;
|
||||
|
|
@ -2261,20 +2261,18 @@ static void Cmd_adjustdamage(void)
|
|||
|| (affectionScore == AFFECTION_FOUR_HEARTS && rand < 15)
|
||||
|| (affectionScore == AFFECTION_THREE_HEARTS && rand < 10))
|
||||
{
|
||||
enduredHit = TRUE;
|
||||
enduredHit |= 1u << battlerDef;
|
||||
gBattleStruct->moveResultFlags[battlerDef] |= MOVE_RESULT_FOE_ENDURED_AFFECTION;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle reducing the dmg to 1 hp.
|
||||
if (enduredHit)
|
||||
if (enduredHit & 1u << battlerDef)
|
||||
{
|
||||
gBattleStruct->moveDamage[battlerDef] = gBattleMons[battlerDef].hp - 1;
|
||||
gSpecialStatuses[battlerDef].enduredDamage = TRUE;
|
||||
}
|
||||
|
||||
if (gSpecialStatuses[battlerDef].enduredDamage)
|
||||
gProtectStructs[battlerDef].assuranceDoubled = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (calcSpreadMoveDamage)
|
||||
|
|
|
|||
|
|
@ -433,3 +433,23 @@ DOUBLE_BATTLE_TEST("Spread Moves: Unless move hits every target user will not in
|
|||
MESSAGE("It's super effective on the opposing Torkoal and Torkoal!");
|
||||
}
|
||||
}
|
||||
|
||||
DOUBLE_BATTLE_TEST("Spread Moves: Focus Sash activates correctly")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
PLAYER(SPECIES_WYNAUT) { HP(2); MaxHP(2); Item(ITEM_FOCUS_SASH); }
|
||||
OPPONENT(SPECIES_WOBBUFFET) { HP(2); MaxHP(2); Item(ITEM_FOCUS_SASH); }
|
||||
OPPONENT(SPECIES_WYNAUT) { HP(2); MaxHP(2); Item(ITEM_FOCUS_SASH); }
|
||||
} WHEN {
|
||||
TURN { MOVE(playerRight, MOVE_HYPER_VOICE); MOVE(playerLeft, MOVE_EXPLOSION); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_HYPER_VOICE, playerRight);
|
||||
MESSAGE("The opposing Wynaut hung on using its Focus Sash!");
|
||||
MESSAGE("The opposing Wobbuffet hung on using its Focus Sash!");
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_EXPLOSION, playerLeft);
|
||||
MESSAGE("The opposing Wobbuffet fainted!");
|
||||
MESSAGE("Wynaut hung on using its Focus Sash!");
|
||||
MESSAGE("The opposing Wynaut fainted!");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user