fix eject pack weak armor special case

This commit is contained in:
ghoulslash 2021-09-22 21:51:37 -04:00
parent 9bf2ffe459
commit 936f2c7bcb
3 changed files with 4 additions and 3 deletions

View file

@ -3094,6 +3094,7 @@ void FaintClearSetData(void)
gProtectStructs[gActiveBattler].usedGravityPreventedMove = 0; gProtectStructs[gActiveBattler].usedGravityPreventedMove = 0;
gProtectStructs[gActiveBattler].usedThroatChopPreventedMove = 0; gProtectStructs[gActiveBattler].usedThroatChopPreventedMove = 0;
gProtectStructs[gActiveBattler].statRaised = 0; gProtectStructs[gActiveBattler].statRaised = 0;
gProtectStructs[gActiveBattler].statFell = 0;
gDisableStructs[gActiveBattler].isFirstTurn = 2; gDisableStructs[gActiveBattler].isFirstTurn = 2;

View file

@ -5165,6 +5165,7 @@ static void Cmd_moveend(void)
u8 battler = battlers[i]; u8 battler = battlers[i];
if (IsBattlerAlive(battler) if (IsBattlerAlive(battler)
&& gProtectStructs[battler].statFell && gProtectStructs[battler].statFell
&& gProtectStructs[battler].disableEjectPack == 0
&& GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_EJECT_PACK && GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_EJECT_PACK
&& !(gCurrentMove == MOVE_PARTING_SHOT && CanBattlerSwitch(gBattlerAttacker)) // Does not activate if attacker used Parting Shot and can switch out && !(gCurrentMove == MOVE_PARTING_SHOT && CanBattlerSwitch(gBattlerAttacker)) // Does not activate if attacker used Parting Shot and can switch out
&& CountUsablePartyMons(battler) > 0) // Has mon to switch into && CountUsablePartyMons(battler) > 0) // Has mon to switch into
@ -9407,9 +9408,7 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr
} }
else else
{ {
// Check eject pack. disableEjectPack set for edge cases (e.g. attacking weak armor'd eject pack holder with u-turn) gProtectStructs[gActiveBattler].statFell = 1; // Eject pack, lash out
if (gProtectStructs[gActiveBattler].disableEjectPack == 0)
gProtectStructs[gActiveBattler].statFell = 1;
gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler); // B_MSG_ATTACKER_STAT_FELL or B_MSG_DEFENDER_STAT_FELL gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler); // B_MSG_ATTACKER_STAT_FELL or B_MSG_DEFENDER_STAT_FELL
} }
} }

View file

@ -5997,6 +5997,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
break; break;
case HOLD_EFFECT_EJECT_PACK: case HOLD_EFFECT_EJECT_PACK:
if (gProtectStructs[battlerId].statFell if (gProtectStructs[battlerId].statFell
&& gProtectStructs[battlerId].disableEjectPack == 0
&& !(gCurrentMove == MOVE_PARTING_SHOT && CanBattlerSwitch(gBattlerAttacker))) // Does not activate if attacker used Parting Shot and can switch out && !(gCurrentMove == MOVE_PARTING_SHOT && CanBattlerSwitch(gBattlerAttacker))) // Does not activate if attacker used Parting Shot and can switch out
{ {
gProtectStructs[battlerId].statFell = FALSE; gProtectStructs[battlerId].statFell = FALSE;