mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-27 20:24:18 +01:00
fix eject pack
This commit is contained in:
parent
55c3e152cf
commit
c4ce4c150d
@ -145,6 +145,7 @@ struct ProtectStruct
|
||||
u32 micle:1;
|
||||
u32 custap:1; // also quick claw
|
||||
u32 touchedProtectLike:1;
|
||||
u32 disableEjectPack:1;
|
||||
u32 physicalDmg;
|
||||
u32 specialDmg;
|
||||
u8 physicalBattlerId;
|
||||
|
@ -5171,6 +5171,7 @@ static void Cmd_moveend(void)
|
||||
if (IsBattlerAlive(battler)
|
||||
&& gSpecialStatuses[battler].statFell
|
||||
&& 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
|
||||
&& CountUsablePartyMons(battler) > 0) // Has mon to switch into
|
||||
{
|
||||
gSpecialStatuses[battler].statFell = FALSE;
|
||||
@ -9288,7 +9289,9 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr
|
||||
}
|
||||
else
|
||||
{
|
||||
gSpecialStatuses[gActiveBattler].statFell = TRUE; // For eject pack
|
||||
// Check eject pack. disableEjectPack set for edge cases (e.g. attacking weak armor'd eject pack holder with u-turn)
|
||||
if (gProtectStructs[gActiveBattler].disableEjectPack == 0)
|
||||
gSpecialStatuses[gActiveBattler].statFell = TRUE;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler); // B_MSG_ATTACKER_STAT_FELL or B_MSG_DEFENDER_STAT_FELL
|
||||
}
|
||||
}
|
||||
|
@ -557,7 +557,6 @@ void HandleAction_UseItem(void)
|
||||
}
|
||||
break;
|
||||
case AI_ITEM_X_STAT:
|
||||
// TODO Contrary check
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STAT_ROSE_ITEM;
|
||||
if (*(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1)) & (1 << AI_DIRE_HIT))
|
||||
{
|
||||
@ -4645,6 +4644,9 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
&& (CompareStat(battler, STAT_SPEED, MAX_STAT_STAGE, CMP_LESS_THAN) // Don't activate if speed cannot be raised
|
||||
|| CompareStat(battler, STAT_DEF, MIN_STAT_STAGE, CMP_GREATER_THAN))) // Don't activate if defense cannot be lowered
|
||||
{
|
||||
if (gBattleMoves[gCurrentMove].effect == EFFECT_HIT_ESCAPE && CanBattlerSwitch(gBattlerAttacker))
|
||||
gProtectStructs[battler].disableEjectPack = 1; // Set flag for target
|
||||
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_WeakArmorActivates;
|
||||
effect++;
|
||||
@ -5851,7 +5853,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_EJECT_PACK:
|
||||
if (gSpecialStatuses[battlerId].statFell)
|
||||
if (gSpecialStatuses[battlerId].statFell
|
||||
&& !(gCurrentMove == MOVE_PARTING_SHOT && CanBattlerSwitch(gBattlerAttacker))) // Does not activate if attacker used Parting Shot and can switch out
|
||||
{
|
||||
gSpecialStatuses[battlerId].statFell = FALSE;
|
||||
gActiveBattler = gBattleScripting.battler = battlerId;
|
||||
|
Loading…
Reference in New Issue
Block a user