Fixes Life Orb + Eject Pack / Red Card interaction (#4038)
* Fixes Life Orb + Eject Pack / Red Card interaction * fix test
This commit is contained in:
parent
f3342de00b
commit
d125da7797
5 changed files with 49 additions and 4 deletions
|
@ -208,7 +208,7 @@ struct SpecialStatus
|
|||
// End of byte
|
||||
u8 emergencyExited:1;
|
||||
u8 afterYou:1;
|
||||
u8 magicianStolen:1; // So that Life Orb doesn't activate after Magician steals it.
|
||||
u8 preventLifeOrbDamage:1; // So that Life Orb doesn't activate various effects.
|
||||
};
|
||||
|
||||
struct SideTimer
|
||||
|
|
|
@ -5711,7 +5711,7 @@ static void Cmd_moveend(void)
|
|||
gEffectBattler = gBattlerTarget;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_MagicianActivates;
|
||||
gSpecialStatuses[gBattlerAttacker].magicianStolen = TRUE;
|
||||
gSpecialStatuses[gBattlerAttacker].preventLifeOrbDamage = TRUE;
|
||||
effect = TRUE;
|
||||
}
|
||||
gBattleScripting.moveendState++;
|
||||
|
@ -5898,6 +5898,7 @@ static void Cmd_moveend(void)
|
|||
gBattlescriptCurrInstr = BattleScript_MoveEnd; // Prevent user switch-in selection
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_RedCardActivates;
|
||||
gSpecialStatuses[gBattlerAttacker].preventLifeOrbDamage = TRUE;
|
||||
effect = TRUE;
|
||||
break; // Only fastest red card activates
|
||||
}
|
||||
|
@ -5924,6 +5925,7 @@ static void Cmd_moveend(void)
|
|||
gLastUsedItem = gBattleMons[battler].item;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_EjectPackActivates;
|
||||
gSpecialStatuses[gBattlerAttacker].preventLifeOrbDamage = TRUE;
|
||||
effect = TRUE;
|
||||
break; // Only fastest eject pack activates
|
||||
}
|
||||
|
@ -6076,7 +6078,7 @@ static void Cmd_moveend(void)
|
|||
gStatuses3[gBattlerAttacker] &= ~STATUS3_ME_FIRST;
|
||||
gSpecialStatuses[gBattlerAttacker].gemBoost = FALSE;
|
||||
gSpecialStatuses[gBattlerAttacker].damagedMons = 0;
|
||||
gSpecialStatuses[gBattlerAttacker].magicianStolen = 0;
|
||||
gSpecialStatuses[gBattlerAttacker].preventLifeOrbDamage = 0;
|
||||
gSpecialStatuses[gBattlerTarget].berryReduced = FALSE;
|
||||
gBattleScripting.moveEffect = 0;
|
||||
// clear attacker z move data
|
||||
|
|
|
@ -7775,7 +7775,7 @@ u8 ItemBattleEffects(u8 caseID, u32 battler, bool32 moveTurn)
|
|||
if (IsBattlerAlive(gBattlerAttacker)
|
||||
&& !(TestSheerForceFlag(gBattlerAttacker, gCurrentMove))
|
||||
&& GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD
|
||||
&& !gSpecialStatuses[gBattlerAttacker].magicianStolen
|
||||
&& !gSpecialStatuses[gBattlerAttacker].preventLifeOrbDamage
|
||||
&& gSpecialStatuses[gBattlerAttacker].damagedMons)
|
||||
{
|
||||
gBattleMoveDamage = GetNonDynamaxMaxHP(gBattlerAttacker) / 10;
|
||||
|
|
26
test/battle/hold_effect/eject_pack.c
Normal file
26
test/battle/hold_effect/eject_pack.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include "global.h"
|
||||
#include "test/battle.h"
|
||||
|
||||
ASSUMPTIONS
|
||||
{
|
||||
ASSUME(gItems[ITEM_EJECT_PACK].holdEffect == HOLD_EFFECT_EJECT_PACK);
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Eject Pack does not cause the new pokemon to lose hp due to it's held Life Orb")
|
||||
{
|
||||
GIVEN {
|
||||
ASSUME(gItems[ITEM_LIFE_ORB].holdEffect == HOLD_EFFECT_LIFE_ORB);
|
||||
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_EJECT_PACK); }
|
||||
PLAYER(SPECIES_WYNAUT) { Item(ITEM_LIFE_ORB); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_OVERHEAT); SEND_OUT(player, 1); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_OVERHEAT, player);
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player);
|
||||
MESSAGE("Wobbuffet is switched out with the Eject Pack!");
|
||||
MESSAGE("Go! Wynaut!");
|
||||
NOT MESSAGE("Wynaut was hurt by its Life Orb!");
|
||||
}
|
||||
}
|
|
@ -430,4 +430,21 @@ SINGLE_BATTLE_TEST("Red Card is consumed after dragged out replacement has its S
|
|||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Red Card does not cause the dragged out mon to lose hp due to it's held Life Orb")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
PLAYER(SPECIES_WYNAUT) { Item(ITEM_LIFE_ORB); }
|
||||
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_RED_CARD); }
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_TACKLE); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, player);
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
|
||||
MESSAGE("Foe Wobbuffet held up its Red Card against Wobbuffet!");
|
||||
MESSAGE("Wynaut was dragged out!");
|
||||
NOT MESSAGE("Wynaut was hurt by its Life Orb!");
|
||||
}
|
||||
}
|
||||
|
||||
// SINGLE_BATTLE_TEST("Red Card activates but fails if the attacker has Dynamaxed")
|
||||
|
|
Loading…
Reference in a new issue