From 5738760917716abd545c918a511ed5169ee900e5 Mon Sep 17 00:00:00 2001 From: sneed Date: Thu, 6 Jun 2024 16:32:45 +0300 Subject: [PATCH 1/4] FIx mummy ability ..and lingering aroma. Adds tests for both. --- src/battle_util.c | 6 +++--- test/battle/ability/lingering_aroma.c | 27 +++++++++++++++++++++++++++ test/battle/ability/mummy.c | 27 +++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 test/battle/ability/lingering_aroma.c create mode 100644 test/battle/ability/mummy.c diff --git a/src/battle_util.c b/src/battle_util.c index 77b02637d414..68cf7a1cef5b 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5315,9 +5315,9 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 && GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_PROTECTIVE_PADS && IsMoveMakingContact(move, gBattlerAttacker) && gBattleStruct->overwrittenAbilities[gBattlerAttacker] != GetBattlerAbility(gBattlerTarget) - && gBattleMons[gBattlerTarget].ability != ABILITY_MUMMY - && gBattleMons[gBattlerTarget].ability != ABILITY_LINGERING_AROMA - && !gAbilitiesInfo[gBattleMons[gBattlerTarget].ability].cantBeSuppressed) + && gBattleMons[gBattlerAttacker].ability != ABILITY_MUMMY + && gBattleMons[gBattlerAttacker].ability != ABILITY_LINGERING_AROMA + && !gAbilitiesInfo[gBattleMons[gBattlerAttacker].ability].cantBeSuppressed) { if (GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_ABILITY_SHIELD) { diff --git a/test/battle/ability/lingering_aroma.c b/test/battle/ability/lingering_aroma.c new file mode 100644 index 000000000000..f85b5ce870bd --- /dev/null +++ b/test/battle/ability/lingering_aroma.c @@ -0,0 +1,27 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Lingering aroma replaces the attacker's ability on contact") +{ + u32 move; + PARAMETRIZE { move = MOVE_TACKLE; } + PARAMETRIZE { move = MOVE_WATER_GUN; } + GIVEN { + ASSUME(gMovesInfo[MOVE_TACKLE].makesContact); + ASSUME(!gMovesInfo[MOVE_WATER_GUN].makesContact); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_OINKOLOGNE) { Ability(ABILITY_LINGERING_AROMA); } + } WHEN { + TURN { MOVE(player, move); } + } SCENE { + if (gMovesInfo[move].makesContact) { + ABILITY_POPUP(opponent, ABILITY_LINGERING_AROMA); + MESSAGE("Wobbuffet acquired Lingering Aroma!"); + } else { + NONE_OF { + ABILITY_POPUP(opponent, ABILITY_LINGERING_AROMA); + MESSAGE("Wobbuffet acquired Lingering Aroma!"); + } + } + } +} diff --git a/test/battle/ability/mummy.c b/test/battle/ability/mummy.c new file mode 100644 index 000000000000..d53641328a98 --- /dev/null +++ b/test/battle/ability/mummy.c @@ -0,0 +1,27 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Mummy replaces the attacker's ability on contact") +{ + u32 move; + PARAMETRIZE { move = MOVE_AQUA_JET; } + PARAMETRIZE { move = MOVE_WATER_GUN; } + GIVEN { + ASSUME(gMovesInfo[MOVE_AQUA_JET].makesContact); + ASSUME(!gMovesInfo[MOVE_WATER_GUN].makesContact); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_YAMASK) { Ability(ABILITY_MUMMY); } + } WHEN { + TURN { MOVE(player, move); } + } SCENE { + if (gMovesInfo[move].makesContact) { + ABILITY_POPUP(opponent, ABILITY_MUMMY); + MESSAGE("Wobbuffet acquired Mummy!"); + } else { + NONE_OF { + ABILITY_POPUP(opponent, ABILITY_MUMMY); + MESSAGE("Wobbuffet acquired Mummy!"); + } + } + } +} From 50b00cb45a90a03921fcdacdc70d58e9c0b63b8f Mon Sep 17 00:00:00 2001 From: sneed Date: Thu, 6 Jun 2024 16:53:16 +0300 Subject: [PATCH 2/4] merge the tests --- test/battle/ability/lingering_aroma.c | 25 +------------------------ test/battle/ability/mummy.c | 27 ++++++++++++++++++--------- 2 files changed, 19 insertions(+), 33 deletions(-) diff --git a/test/battle/ability/lingering_aroma.c b/test/battle/ability/lingering_aroma.c index f85b5ce870bd..a98850022981 100644 --- a/test/battle/ability/lingering_aroma.c +++ b/test/battle/ability/lingering_aroma.c @@ -1,27 +1,4 @@ #include "global.h" #include "test/battle.h" -SINGLE_BATTLE_TEST("Lingering aroma replaces the attacker's ability on contact") -{ - u32 move; - PARAMETRIZE { move = MOVE_TACKLE; } - PARAMETRIZE { move = MOVE_WATER_GUN; } - GIVEN { - ASSUME(gMovesInfo[MOVE_TACKLE].makesContact); - ASSUME(!gMovesInfo[MOVE_WATER_GUN].makesContact); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_OINKOLOGNE) { Ability(ABILITY_LINGERING_AROMA); } - } WHEN { - TURN { MOVE(player, move); } - } SCENE { - if (gMovesInfo[move].makesContact) { - ABILITY_POPUP(opponent, ABILITY_LINGERING_AROMA); - MESSAGE("Wobbuffet acquired Lingering Aroma!"); - } else { - NONE_OF { - ABILITY_POPUP(opponent, ABILITY_LINGERING_AROMA); - MESSAGE("Wobbuffet acquired Lingering Aroma!"); - } - } - } -} +// Tests for Lingering Aroma are handled in test/battle/ability/mummy.c \ No newline at end of file diff --git a/test/battle/ability/mummy.c b/test/battle/ability/mummy.c index d53641328a98..2254f5f9089a 100644 --- a/test/battle/ability/mummy.c +++ b/test/battle/ability/mummy.c @@ -1,26 +1,35 @@ #include "global.h" #include "test/battle.h" -SINGLE_BATTLE_TEST("Mummy replaces the attacker's ability on contact") +SINGLE_BATTLE_TEST("Mummy/Lingering Aroma replace the attacker's ability on contact") { - u32 move; - PARAMETRIZE { move = MOVE_AQUA_JET; } - PARAMETRIZE { move = MOVE_WATER_GUN; } + u32 move, ability, species; + + PARAMETRIZE { move = MOVE_AQUA_JET; ability = ABILITY_MUMMY; species = SPECIES_YAMASK; } + PARAMETRIZE { move = MOVE_WATER_GUN; ability = ABILITY_MUMMY; species = SPECIES_YAMASK;} + PARAMETRIZE { move = MOVE_AQUA_JET; ability = ABILITY_LINGERING_AROMA; species = SPECIES_OINKOLOGNE; } + PARAMETRIZE { move = MOVE_WATER_GUN; ability = ABILITY_LINGERING_AROMA; species = SPECIES_OINKOLOGNE; } GIVEN { ASSUME(gMovesInfo[MOVE_AQUA_JET].makesContact); ASSUME(!gMovesInfo[MOVE_WATER_GUN].makesContact); PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_YAMASK) { Ability(ABILITY_MUMMY); } + OPPONENT(species) { Ability(ability); } } WHEN { TURN { MOVE(player, move); } } SCENE { if (gMovesInfo[move].makesContact) { - ABILITY_POPUP(opponent, ABILITY_MUMMY); - MESSAGE("Wobbuffet acquired Mummy!"); + ABILITY_POPUP(opponent, ability); + if (ability == ABILITY_MUMMY) + MESSAGE("Wobbuffet acquired Mummy!"); + else + MESSAGE("Wobbuffet acquired Lingering Aroma!"); } else { NONE_OF { - ABILITY_POPUP(opponent, ABILITY_MUMMY); - MESSAGE("Wobbuffet acquired Mummy!"); + ABILITY_POPUP(opponent, ability); + if (ability == ABILITY_MUMMY) + MESSAGE("Wobbuffet acquired Mummy!"); + else + MESSAGE("Wobbuffet acquired Lingering Aroma!"); } } } From 838c81221f3ce5ca1350dffb4ce6a7ba20c42efa Mon Sep 17 00:00:00 2001 From: sneed Date: Thu, 6 Jun 2024 17:01:00 +0300 Subject: [PATCH 3/4] new line --- test/battle/ability/lingering_aroma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/battle/ability/lingering_aroma.c b/test/battle/ability/lingering_aroma.c index a98850022981..a4ef5fc48fa2 100644 --- a/test/battle/ability/lingering_aroma.c +++ b/test/battle/ability/lingering_aroma.c @@ -1,4 +1,4 @@ #include "global.h" #include "test/battle.h" -// Tests for Lingering Aroma are handled in test/battle/ability/mummy.c \ No newline at end of file +// Tests for Lingering Aroma are handled in test/battle/ability/mummy.c From 4a6a0a897f484a69a8b8fd94a05c9be885912452 Mon Sep 17 00:00:00 2001 From: sneed Date: Thu, 6 Jun 2024 17:19:40 +0300 Subject: [PATCH 4/4] add 2 more tests Mummy and Lingering Aroma don't replace each other Mummy doesn't replace abilities that can't be suppressed --- test/battle/ability/mummy.c | 62 +++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/test/battle/ability/mummy.c b/test/battle/ability/mummy.c index 2254f5f9089a..ed80a178e6f4 100644 --- a/test/battle/ability/mummy.c +++ b/test/battle/ability/mummy.c @@ -34,3 +34,65 @@ SINGLE_BATTLE_TEST("Mummy/Lingering Aroma replace the attacker's ability on cont } } } + +SINGLE_BATTLE_TEST("Mummy and Lingering Aroma don't replace each other") +{ + u32 ability1, species1, ability2, species2; + + PARAMETRIZE { ability1 = ability2 = ABILITY_MUMMY; species1 = species2 = SPECIES_YAMASK; } + PARAMETRIZE { ability1 = ABILITY_MUMMY; species1 = SPECIES_YAMASK; ability2 = ABILITY_LINGERING_AROMA; species2 = SPECIES_OINKOLOGNE; } + PARAMETRIZE { ability1 = ability2 = ABILITY_LINGERING_AROMA; species1 = species2 = SPECIES_OINKOLOGNE; } + GIVEN { + ASSUME(gMovesInfo[MOVE_AQUA_JET].makesContact); + PLAYER(species1) { Ability(ability1); Speed(2); } + OPPONENT(species2) { Ability(ability2); Speed(1); } + } WHEN { + TURN { MOVE(player, MOVE_AQUA_JET); MOVE(opponent, MOVE_AQUA_JET); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_AQUA_JET, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_AQUA_JET, opponent); + NONE_OF { + ABILITY_POPUP(player, ability1); + ABILITY_POPUP(player, ability2); + ABILITY_POPUP(opponent, ability1); + ABILITY_POPUP(opponent, ability2); + MESSAGE("Yamask acquired Mummy!"); + MESSAGE("Yamask acquired Lingering Aroma!"); + MESSAGE("Oinkologne acquired Mummy!"); + MESSAGE("Oinkologne acquired Lingering Aroma!"); + } + } +} + +SINGLE_BATTLE_TEST("Mummy doesn't replace abilities that can't be suppressed") +{ + u32 species, ability; + + PARAMETRIZE { species = SPECIES_ARCEUS; ability = ABILITY_MULTITYPE; } + PARAMETRIZE { species = SPECIES_AEGISLASH; ability = ABILITY_STANCE_CHANGE; } + PARAMETRIZE { species = SPECIES_WISHIWASHI; ability = ABILITY_SCHOOLING; } + PARAMETRIZE { species = SPECIES_KOMALA; ability = ABILITY_COMATOSE; } + PARAMETRIZE { species = SPECIES_MINIOR; ability = ABILITY_SHIELDS_DOWN; } + PARAMETRIZE { species = SPECIES_MIMIKYU; ability = ABILITY_DISGUISE; } + PARAMETRIZE { species = SPECIES_SILVALLY; ability = ABILITY_RKS_SYSTEM; } + PARAMETRIZE { species = SPECIES_GRENINJA_BATTLE_BOND; ability = ABILITY_BATTLE_BOND; } + PARAMETRIZE { species = SPECIES_ZYGARDE; ability = ABILITY_POWER_CONSTRUCT; } + PARAMETRIZE { species = SPECIES_EISCUE; ability = ABILITY_ICE_FACE; } + PARAMETRIZE { species = SPECIES_CRAMORANT; ability = ABILITY_GULP_MISSILE; } + PARAMETRIZE { species = SPECIES_PALAFIN_ZERO; ability = ABILITY_ZERO_TO_HERO; } + PARAMETRIZE { species = SPECIES_TATSUGIRI; ability = ABILITY_COMMANDER; } + PARAMETRIZE { species = SPECIES_CALYREX_SHADOW_RIDER; ability = ABILITY_AS_ONE_SHADOW_RIDER; } + PARAMETRIZE { species = SPECIES_CALYREX_ICE_RIDER; ability = ABILITY_AS_ONE_ICE_RIDER; } + + GIVEN { + PLAYER(SPECIES_YAMASK); + OPPONENT(species) { Ability(ability); } + } WHEN { + TURN { MOVE(opponent, MOVE_AQUA_JET); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_AQUA_JET, opponent); + NONE_OF { + ABILITY_POPUP(opponent, ABILITY_MUMMY); + } + } +}