mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Fixed entry hazards switch in issue (#3316)
* fix entry hazards switch in issue * accidental known failing fix
This commit is contained in:
parent
093c653801
commit
10adba3af4
@ -99,6 +99,10 @@ struct DisableStruct
|
||||
u8 tarShot:1;
|
||||
u8 octolock:1;
|
||||
u8 cudChew:1;
|
||||
u8 spikesDone:1;
|
||||
u8 toxicSpikesDone:1;
|
||||
u8 stickyWebDone:1;
|
||||
u8 stealthRockDone:1;
|
||||
};
|
||||
|
||||
struct ProtectStruct
|
||||
|
@ -224,15 +224,13 @@
|
||||
#define SIDE_STATUS_SAFEGUARD (1 << 5)
|
||||
#define SIDE_STATUS_FUTUREATTACK (1 << 6)
|
||||
#define SIDE_STATUS_MIST (1 << 8)
|
||||
#define SIDE_STATUS_SPIKES_DAMAGED (1 << 9)
|
||||
// (1 << 9) previously was SIDE_STATUS_SPIKES_DAMAGED
|
||||
#define SIDE_STATUS_TAILWIND (1 << 10)
|
||||
#define SIDE_STATUS_AURORA_VEIL (1 << 11)
|
||||
#define SIDE_STATUS_LUCKY_CHANT (1 << 12)
|
||||
#define SIDE_STATUS_TOXIC_SPIKES (1 << 13)
|
||||
#define SIDE_STATUS_STEALTH_ROCK (1 << 14)
|
||||
#define SIDE_STATUS_STEALTH_ROCK_DAMAGED (1 << 15)
|
||||
#define SIDE_STATUS_TOXIC_SPIKES_DAMAGED (1 << 16)
|
||||
#define SIDE_STATUS_STICKY_WEB_DAMAGED (1 << 17)
|
||||
// Missing flags previously were SIDE_STATUS_TOXIC_SPIKES_DAMAGED, SIDE_STATUS_STEALTH_ROCK_DAMAGED, SIDE_STATUS_STICKY_WEB_DAMAGED
|
||||
#define SIDE_STATUS_QUICK_GUARD (1 << 18)
|
||||
#define SIDE_STATUS_WIDE_GUARD (1 << 19)
|
||||
#define SIDE_STATUS_CRAFTY_SHIELD (1 << 20)
|
||||
|
@ -553,7 +553,7 @@ static const u8 sText_ShieldedFromCriticalHits[] = _("The {B_CURRENT_MOVE} shiel
|
||||
static const u8 sText_SwitchedAtkAndSpAtk[] = _("{B_ATK_NAME_WITH_PREFIX} switched all its\nchanges to its Attack and\pSp. Atk with the target!");
|
||||
static const u8 sText_SwitchedDefAndSpDef[] = _("{B_ATK_NAME_WITH_PREFIX} switched all its\nchanges to its Defense and\pSp. Def with the target!");
|
||||
static const u8 sText_PkmnAcquiredAbility[] = _("{B_DEF_NAME_WITH_PREFIX} acquired\n{B_DEF_ABILITY}!");
|
||||
static const u8 sText_PoisonSpikesScattered[] = _("Poison Spikes were scattered all\naround the opposing team's feet!");
|
||||
static const u8 sText_PoisonSpikesScattered[] = _("Poison Spikes were scattered all\naround {B_DEF_TEAM2} team's feet!");
|
||||
static const u8 sText_PkmnSwitchedStatChanges[] = _("{B_ATK_NAME_WITH_PREFIX} switched stat changes\nwith the target!");
|
||||
static const u8 sText_PkmnSurroundedWithVeilOfWater[] = _("{B_ATK_NAME_WITH_PREFIX} surrounded itself\nwith a veil of water!");
|
||||
static const u8 sText_PkmnLevitatedOnElectromagnetism[] = _("{B_ATK_NAME_WITH_PREFIX} levitated on\nelectromagnetism!");
|
||||
@ -627,7 +627,7 @@ static const u8 sText_MagicBounceActivates[] = _("The {B_DEF_NAME_WITH_PREFIX} b
|
||||
static const u8 sText_ProteanTypeChange[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY} transformed\nit into the {B_BUFF1} type!");
|
||||
static const u8 sText_SymbiosisItemPass[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} passed its {B_LAST_ITEM}\nto {B_ATK_NAME_WITH_PREFIX} through {B_LAST_ABILITY}!");
|
||||
static const u8 sText_StealthRockDmg[] = _("Pointed stones dug into\n{B_SCR_ACTIVE_NAME_WITH_PREFIX}!");
|
||||
static const u8 sText_ToxicSpikesAbsorbed[] = _("The poison spikes disappeared\nfrom around the opposing team's feet!");
|
||||
static const u8 sText_ToxicSpikesAbsorbed[] = _("The poison spikes disappeared\nfrom around {B_DEF_TEAM2} team's feet!");
|
||||
static const u8 sText_ToxicSpikesPoisoned[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} was poisoned!");
|
||||
static const u8 sText_StickyWebSwitchIn[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} was\ncaught in a Sticky Web!");
|
||||
static const u8 sText_HealingWishCameTrue[] = _("The healing wish came true\nfor {B_ATK_NAME_WITH_PREFIX}!");
|
||||
|
@ -3773,7 +3773,6 @@ static void Cmd_tryfaintmon(void)
|
||||
{
|
||||
BattleScriptPop();
|
||||
gBattlescriptCurrInstr = cmd->instr;
|
||||
gSideStatuses[GetBattlerSide(battler)] &= ~(SIDE_STATUS_SPIKES_DAMAGED | SIDE_STATUS_TOXIC_SPIKES_DAMAGED | SIDE_STATUS_STEALTH_ROCK_DAMAGED | SIDE_STATUS_STICKY_WEB_DAMAGED);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -6880,7 +6879,7 @@ static void Cmd_switchineffects(void)
|
||||
gBattleStruct->storedLunarDance &= ~(gBitTable[battler]);
|
||||
}
|
||||
}
|
||||
else if (!(gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_SPIKES_DAMAGED)
|
||||
else if (!(gDisableStructs[battler].spikesDone)
|
||||
&& (gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_SPIKES)
|
||||
&& GetBattlerAbility(battler) != ABILITY_MAGIC_GUARD
|
||||
&& IsBattlerAffectedByHazards(battler, FALSE)
|
||||
@ -6891,25 +6890,25 @@ static void Cmd_switchineffects(void)
|
||||
if (gBattleMoveDamage == 0)
|
||||
gBattleMoveDamage = 1;
|
||||
|
||||
gSideStatuses[GetBattlerSide(battler)] |= SIDE_STATUS_SPIKES_DAMAGED;
|
||||
gDisableStructs[battler].spikesDone = TRUE;
|
||||
SetDmgHazardsBattlescript(battler, B_MSG_PKMNHURTBYSPIKES);
|
||||
}
|
||||
else if (!(gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_STEALTH_ROCK_DAMAGED)
|
||||
else if (!(gDisableStructs[battler].stealthRockDone)
|
||||
&& (gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_STEALTH_ROCK)
|
||||
&& IsBattlerAffectedByHazards(battler, FALSE)
|
||||
&& GetBattlerAbility(battler) != ABILITY_MAGIC_GUARD)
|
||||
{
|
||||
gSideStatuses[GetBattlerSide(battler)] |= SIDE_STATUS_STEALTH_ROCK_DAMAGED;
|
||||
gDisableStructs[battler].stealthRockDone = TRUE;
|
||||
gBattleMoveDamage = GetStealthHazardDamage(gBattleMoves[MOVE_STEALTH_ROCK].type, battler);
|
||||
|
||||
if (gBattleMoveDamage != 0)
|
||||
SetDmgHazardsBattlescript(battler, B_MSG_STEALTHROCKDMG);
|
||||
}
|
||||
else if (!(gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_TOXIC_SPIKES_DAMAGED)
|
||||
else if (!(gDisableStructs[battler].toxicSpikesDone)
|
||||
&& (gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_TOXIC_SPIKES)
|
||||
&& IsBattlerGrounded(battler))
|
||||
{
|
||||
gSideStatuses[GetBattlerSide(battler)] |= SIDE_STATUS_TOXIC_SPIKES_DAMAGED;
|
||||
gDisableStructs[battler].toxicSpikesDone = TRUE;
|
||||
if (IS_BATTLER_OF_TYPE(battler, TYPE_POISON)) // Absorb the toxic spikes.
|
||||
{
|
||||
gSideStatuses[GetBattlerSide(battler)] &= ~SIDE_STATUS_TOXIC_SPIKES;
|
||||
@ -6940,12 +6939,12 @@ static void Cmd_switchineffects(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!(gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_STICKY_WEB_DAMAGED)
|
||||
else if (!(gDisableStructs[battler].stickyWebDone)
|
||||
&& (gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_STICKY_WEB)
|
||||
&& IsBattlerAffectedByHazards(battler, FALSE)
|
||||
&& IsBattlerGrounded(battler))
|
||||
{
|
||||
gSideStatuses[GetBattlerSide(battler)] |= SIDE_STATUS_STICKY_WEB_DAMAGED;
|
||||
gDisableStructs[battler].stickyWebDone = TRUE;
|
||||
gBattleScripting.battler = battler;
|
||||
SET_STATCHANGER(STAT_SPEED, 1, TRUE);
|
||||
BattleScriptPushCursor();
|
||||
@ -6984,7 +6983,10 @@ static void Cmd_switchineffects(void)
|
||||
return;
|
||||
}
|
||||
|
||||
gSideStatuses[GetBattlerSide(battler)] &= ~(SIDE_STATUS_SPIKES_DAMAGED | SIDE_STATUS_TOXIC_SPIKES_DAMAGED | SIDE_STATUS_STEALTH_ROCK_DAMAGED | SIDE_STATUS_STICKY_WEB_DAMAGED);
|
||||
gDisableStructs[battler].stickyWebDone = FALSE;
|
||||
gDisableStructs[battler].spikesDone = FALSE;
|
||||
gDisableStructs[battler].toxicSpikesDone = FALSE;
|
||||
gDisableStructs[battler].stealthRockDone = FALSE;
|
||||
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
|
@ -186,16 +186,16 @@ SINGLE_BATTLE_TEST("Berry hold effect cures status if a pokemon enters a battle"
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Pokemon can be further poisoned with Toxic spikes after a status healing hold effect was previously used")
|
||||
SINGLE_BATTLE_TEST("Opponent Pokemon can be further poisoned with Toxic spikes after a status healing hold effect was previously used")
|
||||
{
|
||||
u16 item;
|
||||
|
||||
PARAMETRIZE { item = ITEM_PECHA_BERRY; }
|
||||
PARAMETRIZE { item = ITEM_LUM_BERRY; }
|
||||
|
||||
KNOWN_FAILING;
|
||||
GIVEN {
|
||||
ASSUME(gItems[ITEM_PECHA_BERRY].holdEffect == HOLD_EFFECT_CURE_PSN);
|
||||
ASSUME(gItems[ITEM_LUM_BERRY].holdEffect == HOLD_EFFECT_CURE_STATUS);
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_WYNAUT) { Item(item); }
|
||||
@ -204,12 +204,64 @@ SINGLE_BATTLE_TEST("Pokemon can be further poisoned with Toxic spikes after a st
|
||||
TURN { SWITCH(opponent, 1); }
|
||||
TURN { SWITCH(opponent, 0); }
|
||||
} SCENE {
|
||||
MESSAGE("Wobbuffet used Toxic Spikes!");
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_TOXIC_SPIKES, player);
|
||||
MESSAGE("Poison Spikes were scattered all around the opposing team's feet!");
|
||||
// 1st switch-in
|
||||
MESSAGE("2 sent out Wynaut!");
|
||||
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent);
|
||||
STATUS_ICON(opponent, poison: TRUE);
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
|
||||
if (item == ITEM_PECHA_BERRY) {
|
||||
MESSAGE("Foe Wynaut's Pecha Berry cured poison!");
|
||||
} else {
|
||||
MESSAGE("Foe Wynaut's Lum Berry cured its poison problem!");
|
||||
}
|
||||
STATUS_ICON(opponent, poison: FALSE);
|
||||
// 2nd switch-in
|
||||
MESSAGE("2 sent out Wobbuffet!");
|
||||
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent);
|
||||
STATUS_ICON(opponent, poison: TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
// Basically same as above, but with the sides reversed.
|
||||
SINGLE_BATTLE_TEST("Player Pokemon can be further poisoned with Toxic spikes after a status healing hold effect was previously used")
|
||||
{
|
||||
u16 item;
|
||||
|
||||
PARAMETRIZE { item = ITEM_PECHA_BERRY; }
|
||||
PARAMETRIZE { item = ITEM_LUM_BERRY; }
|
||||
|
||||
GIVEN {
|
||||
ASSUME(gItems[ITEM_PECHA_BERRY].holdEffect == HOLD_EFFECT_CURE_PSN);
|
||||
ASSUME(gItems[ITEM_LUM_BERRY].holdEffect == HOLD_EFFECT_CURE_STATUS);
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
PLAYER(SPECIES_WOBBUFFET) {Item(item); }
|
||||
PLAYER(SPECIES_WYNAUT);
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(opponent, MOVE_TOXIC_SPIKES); }
|
||||
TURN { SWITCH(player, 1); }
|
||||
TURN { SWITCH(player, 2); }
|
||||
} SCENE {
|
||||
MESSAGE("Foe Wobbuffet used Toxic Spikes!");
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_TOXIC_SPIKES, opponent);
|
||||
MESSAGE("Poison Spikes were scattered all around your team's feet!");
|
||||
// 1st switch-in
|
||||
MESSAGE("Go! Wobbuffet!");
|
||||
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, player);
|
||||
STATUS_ICON(player, poison: TRUE);
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player);
|
||||
if (item == ITEM_PECHA_BERRY) {
|
||||
MESSAGE("Wobbuffet's Pecha Berry cured poison!");
|
||||
} else {
|
||||
MESSAGE("Wobbuffet's Lum Berry cured its poison problem!");
|
||||
}
|
||||
STATUS_ICON(player, poison: FALSE);
|
||||
// 2nd switch-in
|
||||
MESSAGE("Go! Wynaut!");
|
||||
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, player);
|
||||
STATUS_ICON(player, poison: TRUE);
|
||||
}
|
||||
}
|
||||
|
@ -208,3 +208,35 @@ SINGLE_BATTLE_TEST("Toxic Spikes are removed by Poison-types affected by Magnet
|
||||
NOT STATUS_ICON(opponent, poison: TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Toxic Spikes inflicts poison on switch in after Primal Reversed mon fainted") // Oddly specific, but encountered during testing
|
||||
{
|
||||
GIVEN {
|
||||
ASSUME(gBattleMoves[MOVE_MEMENTO].effect == EFFECT_MEMENTO); // Faints the user.
|
||||
PLAYER(SPECIES_WOBBUFFET) {Speed(5); }
|
||||
PLAYER(SPECIES_GROUDON) { Item(ITEM_RED_ORB); Speed(1); }
|
||||
PLAYER(SPECIES_WYNAUT) {Speed(5); }
|
||||
OPPONENT(SPECIES_WOBBUFFET) {Speed(15); }
|
||||
} WHEN {
|
||||
TURN { MOVE(opponent, MOVE_TOXIC_SPIKES); }
|
||||
TURN { SWITCH(player, 1); }
|
||||
TURN { MOVE(player, MOVE_MEMENTO); SEND_OUT(player, 2); }
|
||||
} SCENE {
|
||||
MESSAGE("Foe Wobbuffet used Toxic Spikes!");
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_TOXIC_SPIKES, opponent);
|
||||
MESSAGE("Poison Spikes were scattered all around your team's feet!");
|
||||
// Switch in
|
||||
MESSAGE("Go! Groudon!");
|
||||
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, player);
|
||||
STATUS_ICON(player, poison: TRUE);
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_PRIMAL_REVERSION, player);
|
||||
MESSAGE("Groudon's Primal Reversion! It reverted to its primal form!");
|
||||
// Memento
|
||||
MESSAGE("Groudon used Memento!");
|
||||
MESSAGE("Groudon fainted!");
|
||||
// 2nd switch-in
|
||||
MESSAGE("Go! Wynaut!");
|
||||
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, player);
|
||||
STATUS_ICON(player, poison: TRUE);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user