diff --git a/src/battle_util.c b/src/battle_util.c index 7c8690ff01..7b1cde1474 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -6185,7 +6185,14 @@ u32 GetBattlerAbility(u32 battler) bool32 noAbilityShield = GetBattlerHoldEffectIgnoreAbility(battler, TRUE) != HOLD_EFFECT_ABILITY_SHIELD; 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; + } if (gStatuses3[battler] & STATUS3_GASTRO_ACID) return ABILITY_NONE; diff --git a/test/battle/ability/comatose.c b/test/battle/ability/comatose.c new file mode 100644 index 0000000000..bd991c258e --- /dev/null +++ b/test/battle/ability/comatose.c @@ -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); } + } +}