Fix comatose transform gastro acid interaction (#4852)

This commit is contained in:
DizzyEggg 2024-06-21 12:19:43 +02:00 committed by GitHub
parent d0bb03e5a9
commit 438f478146
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 61 additions and 0 deletions

View file

@ -6185,7 +6185,14 @@ u32 GetBattlerAbility(u32 battler)
bool32 noAbilityShield = GetBattlerHoldEffectIgnoreAbility(battler, TRUE) != HOLD_EFFECT_ABILITY_SHIELD; bool32 noAbilityShield = GetBattlerHoldEffectIgnoreAbility(battler, TRUE) != HOLD_EFFECT_ABILITY_SHIELD;
if (gAbilitiesInfo[gBattleMons[battler].ability].cantBeSuppressed) if (gAbilitiesInfo[gBattleMons[battler].ability].cantBeSuppressed)
{
// Edge case: pokemon under the effect of gastro acid transforms into a pokemon with Comatose (Todo: verify how other unsuppressable abilities behave)
if (gBattleMons[battler].status2 & STATUS2_TRANSFORMED
&& gStatuses3[battler] & STATUS3_GASTRO_ACID
&& gBattleMons[battler].ability == ABILITY_COMATOSE)
return ABILITY_NONE;
return gBattleMons[battler].ability; return gBattleMons[battler].ability;
}
if (gStatuses3[battler] & STATUS3_GASTRO_ACID) if (gStatuses3[battler] & STATUS3_GASTRO_ACID)
return ABILITY_NONE; return ABILITY_NONE;

View file

@ -0,0 +1,54 @@
#include "global.h"
#include "test/battle.h"
SINGLE_BATTLE_TEST("Comatose prevents status-inducing moves")
{
u32 move;
PARAMETRIZE { move = MOVE_TOXIC; }
PARAMETRIZE { move = MOVE_POISONPOWDER; }
PARAMETRIZE { move = MOVE_SLEEP_POWDER; }
PARAMETRIZE { move = MOVE_THUNDER_WAVE; }
GIVEN {
PLAYER(SPECIES_KOMALA) { Ability(ABILITY_COMATOSE); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, move); }
} SCENE {
MESSAGE("Komala is drowsing!");
NOT ANIMATION(ANIM_TYPE_MOVE, move, opponent);
ABILITY_POPUP(player, ABILITY_COMATOSE);
MESSAGE("It doesn't affect Komala…");
}
}
SINGLE_BATTLE_TEST("Comatose may be suppressed if pokemon transformed into a pokemon with Comatose ability and was under the effects of Gastro Acid")
{
u32 move;
PARAMETRIZE { move = MOVE_TOXIC; }
PARAMETRIZE { move = MOVE_POISONPOWDER; }
PARAMETRIZE { move = MOVE_SLEEP_POWDER; }
PARAMETRIZE { move = MOVE_THUNDER_WAVE; }
GIVEN {
PLAYER(SPECIES_KOMALA) { Ability(ABILITY_COMATOSE); Speed(30); }
OPPONENT(SPECIES_DITTO) { Speed(20); }
} WHEN {
TURN { MOVE(player, MOVE_GASTRO_ACID); MOVE(opponent, MOVE_TRANSFORM); }
TURN { MOVE(player, move); }
} SCENE {
MESSAGE("Komala is drowsing!");
MESSAGE("Komala used Gastro Acid!");
MESSAGE("Foe Ditto used Transform!");
MESSAGE("Foe Ditto transformed into Komala!");
ANIMATION(ANIM_TYPE_MOVE, move, player);
if (move == MOVE_POISONPOWDER) { STATUS_ICON(opponent, poison: TRUE); }
else if (move == MOVE_TOXIC) { STATUS_ICON(opponent, badPoison: TRUE); }
else if (move == MOVE_THUNDER_WAVE) { STATUS_ICON(opponent, paralysis: TRUE); }
else if (move == MOVE_SLEEP_POWDER) { STATUS_ICON(opponent, sleep: TRUE); }
}
}