From b77dc8ba1124b80c8c2a7be8280b2ab585a040d9 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 20 Apr 2024 20:13:34 +0200 Subject: [PATCH 1/4] Adds Ability Poison Puppeteer --- include/battle.h | 1 + src/battle_script_commands.c | 5 +- src/battle_util.c | 12 +++++ test/battle/ability/poison_puppeteer.c | 65 ++++++++++++++++++++++++++ 4 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 test/battle/ability/poison_puppeteer.c diff --git a/include/battle.h b/include/battle.h index 1274ffcbfc4d..2032c5a3d40d 100644 --- a/include/battle.h +++ b/include/battle.h @@ -787,6 +787,7 @@ struct BattleStruct u8 trainerSlideDynamaxMsgDone:1; u8 pledgeMove:1; u8 isSkyBattle:1; + u8 poisonPuppeteerConfusion:1; u32 aiDelayTimer; // Counts number of frames AI takes to choose an action. u32 aiDelayFrames; // Number of frames it took to choose an action. u8 timesGotHit[NUM_BATTLE_SIDES][PARTY_SIZE]; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index e3f6615832a3..ea23244eabcf 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3085,7 +3085,6 @@ void SetMoveEffect(bool32 primary, bool32 certain) } // for synchronize - if (gBattleScripting.moveEffect == MOVE_EFFECT_POISON || gBattleScripting.moveEffect == MOVE_EFFECT_TOXIC || gBattleScripting.moveEffect == MOVE_EFFECT_PARALYSIS @@ -3094,6 +3093,10 @@ void SetMoveEffect(bool32 primary, bool32 certain) gBattleStruct->synchronizeMoveEffect = gBattleScripting.moveEffect; gHitMarker |= HITMARKER_SYNCHRONISE_EFFECT; } + + if (gBattleScripting.moveEffect == MOVE_EFFECT_POISON || gBattleScripting.moveEffect == MOVE_EFFECT_TOXIC) + gBattleStruct->poisonPuppeteerConfusion = TRUE; + return; } else if (statusChanged == FALSE) diff --git a/src/battle_util.c b/src/battle_util.c index 55df4761ded7..0fd4bc37aadd 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5762,6 +5762,18 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 effect++; } break; + case ABILITY_POISON_PUPPETEER: + if (gBattleMons[gBattlerAttacker].species == SPECIES_PECHARUNT + && gBattleStruct->poisonPuppeteerConfusion == TRUE + && CanBeConfused(gBattlerTarget)) + { + gBattleStruct->poisonPuppeteerConfusion = FALSE; + gBattleScripting.moveEffect = MOVE_EFFECT_CONFUSION; + PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gLastUsedAbility); + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_AbilityStatusEffect; + effect++; + } } break; case ABILITYEFFECT_MOVE_END_OTHER: // Abilities that activate on *another* battler's moveend: Dancer, Soul-Heart, Receiver, Symbiosis diff --git a/test/battle/ability/poison_puppeteer.c b/test/battle/ability/poison_puppeteer.c new file mode 100644 index 000000000000..6a1440b0f740 --- /dev/null +++ b/test/battle/ability/poison_puppeteer.c @@ -0,0 +1,65 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ +} + +SINGLE_BATTLE_TEST("Poison Puppeteer confuses target if it was poisoned by a damaging move") +{ + GIVEN { + ASSUME(MoveHasAdditionalEffect(MOVE_POISON_STING, MOVE_EFFECT_POISON) == TRUE); + PLAYER(SPECIES_PECHARUNT) { Ability(ABILITY_POISON_PUPPETEER); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_POISON_STING); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_POISON_STING, player); + HP_BAR(opponent); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); + STATUS_ICON(opponent, poison: TRUE); + ABILITY_POPUP(player, ABILITY_POISON_PUPPETEER); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_CONFUSION, opponent); + MESSAGE("Foe Wobbuffet became confused!"); + } +} + +SINGLE_BATTLE_TEST("Poison Puppeteer confuses target if it was poisoned by a status move") +{ + GIVEN { + ASSUME(MoveHasAdditionalEffect(MOVE_POISON_STING, MOVE_EFFECT_POISON) == TRUE); + PLAYER(SPECIES_PECHARUNT) { Ability(ABILITY_POISON_PUPPETEER); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_POISON_POWDER); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_POISON_POWDER, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); + STATUS_ICON(opponent, poison: TRUE); + ABILITY_POPUP(player, ABILITY_POISON_PUPPETEER); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_CONFUSION, opponent); + MESSAGE("Foe Wobbuffet became confused!"); + } +} + +SINGLE_BATTLE_TEST("Poison Puppeteer does not trigger if poison is Toxic Spikes induced") +{ + GIVEN { + ASSUME(gMovesInfo[MOVE_TOXIC_SPIKES].effect == MOVE_TOXIC_SPIKES) + PLAYER(SPECIES_PECHARUNT) { Ability(ABILITY_POISON_PUPPETEER); } + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_TOXIC_SPIKES);} + TURN { SWITCH(opponent, 1); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TOXIC_SPIKES, player); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); + STATUS_ICON(opponent, poison: TRUE); + NONE_OF { + ABILITY_POPUP(player, ABILITY_POISON_PUPPETEER); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_CONFUSION, opponent); + MESSAGE("Foe Wobbuffet became confused!"); + } + } +} From dffa8a48226e4ed899168c09f0cf1758f09fb910 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 20 Apr 2024 20:56:52 +0200 Subject: [PATCH 2/4] nothing happened --- test/battle/ability/poison_puppeteer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/battle/ability/poison_puppeteer.c b/test/battle/ability/poison_puppeteer.c index 6a1440b0f740..3c66d5ca5814 100644 --- a/test/battle/ability/poison_puppeteer.c +++ b/test/battle/ability/poison_puppeteer.c @@ -45,7 +45,7 @@ SINGLE_BATTLE_TEST("Poison Puppeteer confuses target if it was poisoned by a sta SINGLE_BATTLE_TEST("Poison Puppeteer does not trigger if poison is Toxic Spikes induced") { GIVEN { - ASSUME(gMovesInfo[MOVE_TOXIC_SPIKES].effect == MOVE_TOXIC_SPIKES) + ASSUME(gMovesInfo[MOVE_TOXIC_SPIKES].effect == EFFECT_TOXIC_SPIKES); PLAYER(SPECIES_PECHARUNT) { Ability(ABILITY_POISON_PUPPETEER); } OPPONENT(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET); From 342a2b7fc7de54277cedfa68c3d8b9a9472c12cb Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 20 Apr 2024 22:01:26 +0200 Subject: [PATCH 3/4] parametrize poison powder and toxic --- src/battle_script_commands.c | 1 + test/battle/ability/poison_puppeteer.c | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index ea23244eabcf..feb0149c685f 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6306,6 +6306,7 @@ static void Cmd_moveend(void) gBattleStruct->swapDamageCategory = FALSE; gBattleStruct->enduredDamage = 0; gBattleStruct->additionalEffectsCounter = 0; + gBattleStruct->poisonPuppeteerConfusion = FALSE; gBattleScripting.moveendState++; break; case MOVEEND_COUNT: diff --git a/test/battle/ability/poison_puppeteer.c b/test/battle/ability/poison_puppeteer.c index 3c66d5ca5814..b33a49e57e2a 100644 --- a/test/battle/ability/poison_puppeteer.c +++ b/test/battle/ability/poison_puppeteer.c @@ -17,25 +17,35 @@ SINGLE_BATTLE_TEST("Poison Puppeteer confuses target if it was poisoned by a dam ANIMATION(ANIM_TYPE_MOVE, MOVE_POISON_STING, player); HP_BAR(opponent); ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); + STATUS_ICON(opponent, poison: TRUE); + ABILITY_POPUP(player, ABILITY_POISON_PUPPETEER); ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_CONFUSION, opponent); MESSAGE("Foe Wobbuffet became confused!"); } } -SINGLE_BATTLE_TEST("Poison Puppeteer confuses target if it was poisoned by a status move") +SINGLE_BATTLE_TEST("Poison Puppeteer confuses target if it was (badly) poisoned by a status move") { + u32 move; + + PARAMETRIZE { move = MOVE_POISON_POWDER; } + PARAMETRIZE { move = MOVE_TOXIC; } + GIVEN { ASSUME(MoveHasAdditionalEffect(MOVE_POISON_STING, MOVE_EFFECT_POISON) == TRUE); PLAYER(SPECIES_PECHARUNT) { Ability(ABILITY_POISON_PUPPETEER); } OPPONENT(SPECIES_WOBBUFFET); } WHEN { - TURN { MOVE(player, MOVE_POISON_POWDER); } + TURN { MOVE(player, move); } } SCENE { - ANIMATION(ANIM_TYPE_MOVE, MOVE_POISON_POWDER, player); + ANIMATION(ANIM_TYPE_MOVE, move, player); ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); - STATUS_ICON(opponent, poison: TRUE); + if (move == MOVE_POISON_POWDER) + STATUS_ICON(opponent, poison: TRUE); + else + STATUS_ICON(opponent, badPoison: TRUE); ABILITY_POPUP(player, ABILITY_POISON_PUPPETEER); ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_CONFUSION, opponent); MESSAGE("Foe Wobbuffet became confused!"); From bd37ac77456bbd57b26d1404c75cf717c8074b80 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 20 Apr 2024 22:04:22 +0200 Subject: [PATCH 4/4] leftover --- test/battle/ability/poison_puppeteer.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/battle/ability/poison_puppeteer.c b/test/battle/ability/poison_puppeteer.c index b33a49e57e2a..af5d5389fa65 100644 --- a/test/battle/ability/poison_puppeteer.c +++ b/test/battle/ability/poison_puppeteer.c @@ -17,9 +17,7 @@ SINGLE_BATTLE_TEST("Poison Puppeteer confuses target if it was poisoned by a dam ANIMATION(ANIM_TYPE_MOVE, MOVE_POISON_STING, player); HP_BAR(opponent); ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); - STATUS_ICON(opponent, poison: TRUE); - ABILITY_POPUP(player, ABILITY_POISON_PUPPETEER); ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_CONFUSION, opponent); MESSAGE("Foe Wobbuffet became confused!");