From 8f99ef16be87c0bf34ef118bb5a71f471597efd4 Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Tue, 16 Jan 2024 22:52:56 +0100 Subject: [PATCH] Adds Move Psychic Noise (#4005) * Adds Move Psychic Noise * changes psychic noise from effect to move_effect * remove leftover --------- Co-authored-by: Bassoonian --- data/battle_scripts_1.s | 5 +++ include/battle_scripts.h | 2 + include/constants/battle.h | 3 +- src/battle_script_commands.c | 15 +++++++ src/data/battle_moves.h | 6 ++- test/battle/move_effect/psychic_noise.c | 56 +++++++++++++++++++++++++ 6 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 test/battle/move_effect/psychic_noise.c diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 18e7f6f612..a07c3cc56d 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -371,6 +371,11 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectHit @ EFFECT_BLIZZARD .4byte BattleScript_EffectHit @ EFFECT_RAIN_ALWAYS_HIT +BattleScript_EffectPsychicNoise:: + printstring STRINGID_PKMNPREVENTEDFROMHEALING + waitmessage B_WAIT_TIME_LONG + return + BattleScript_EffectFilletAway: attackcanceler attackstring diff --git a/include/battle_scripts.h b/include/battle_scripts.h index c1da89443b..0582558b88 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -490,6 +490,8 @@ extern const u8 BattleScript_TheRainbowDisappeared[]; extern const u8 BattleScript_HurtByTheSeaOfFire[]; extern const u8 BattleScript_TheSeaOfFireDisappeared[]; extern const u8 BattleScript_TheSwampDisappeared[]; +extern const u8 BattleScript_EffectPsychicNoise[]; +extern const u8 BattleScript_AromaVeilProtectsRet[]; // zmoves extern const u8 BattleScript_ZMoveActivateDamaging[]; diff --git a/include/constants/battle.h b/include/constants/battle.h index 5c999f7eab..ddaa79cbc9 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -396,8 +396,9 @@ #define MOVE_EFFECT_SYRUP_BOMB 76 #define MOVE_EFFECT_FLORAL_HEALING 77 #define MOVE_EFFECT_SECRET_POWER 78 +#define MOVE_EFFECT_PSYCHIC_NOISE 79 -#define NUM_MOVE_EFFECTS 79 +#define NUM_MOVE_EFFECTS 80 #define MOVE_EFFECT_AFFECTS_USER 0x2000 #define MOVE_EFFECT_CERTAIN 0x4000 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index ec6464eb30..c12ccab908 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3793,6 +3793,21 @@ void SetMoveEffect(bool32 primary, bool32 certain) } SetMoveEffect(primary, certain); break; + case MOVE_EFFECT_PSYCHIC_NOISE: + if (GetBattlerAbility(gEffectBattler) == ABILITY_AROMA_VEIL || GetBattlerAbility(BATTLE_PARTNER(gEffectBattler)) == ABILITY_AROMA_VEIL) + { + gBattlerAbility = gEffectBattler; + BattleScriptPush(gBattlescriptCurrInstr + 1); + gBattlescriptCurrInstr = BattleScript_AromaVeilProtectsRet; + } + else if (!(gStatuses3[gEffectBattler] & STATUS3_HEAL_BLOCK)) + { + gStatuses3[gEffectBattler] |= STATUS3_HEAL_BLOCK; + gDisableStructs[gEffectBattler].healBlockTimer = 2; + BattleScriptPush(gBattlescriptCurrInstr + 1); + gBattlescriptCurrInstr = BattleScript_EffectPsychicNoise; + } + break; } } } diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 3098d0c5b0..d5a7d01c10 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -13556,7 +13556,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_DYNAMAX] = [MOVE_PSYCHIC_NOISE] = { - .effect = EFFECT_PLACEHOLDER, //EFFECT_PSYCHIC_NOISE + .effect = EFFECT_HIT, .power = 75, .type = TYPE_PSYCHIC, .accuracy = 100, @@ -13566,6 +13566,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_DYNAMAX] = .category = BATTLE_CATEGORY_SPECIAL, .soundMove = TRUE, .ignoresSubstitute = TRUE, + .additionalEffects = ADDITIONAL_EFFECTS({ + .moveEffect = MOVE_EFFECT_PSYCHIC_NOISE, + .chance = 100, + }), }, [MOVE_UPPER_HAND] = diff --git a/test/battle/move_effect/psychic_noise.c b/test/battle/move_effect/psychic_noise.c new file mode 100644 index 0000000000..25d7f60795 --- /dev/null +++ b/test/battle/move_effect/psychic_noise.c @@ -0,0 +1,56 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(MoveHasMoveEffect(MOVE_PSYCHIC_NOISE, MOVE_EFFECT_PSYCHIC_NOISE)); + ASSUME(gBattleMoves[MOVE_RECOVER].effect == EFFECT_RESTORE_HP); +} + +SINGLE_BATTLE_TEST("Psychic Noise blocks healing moves for 2 turns") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_PSYCHIC_NOISE); MOVE(opponent, MOVE_RECOVER); } + TURN { MOVE(opponent, MOVE_RECOVER, allowed: FALSE); } + TURN { MOVE(opponent, MOVE_RECOVER); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_PSYCHIC_NOISE, player); + MESSAGE("Foe Wobbuffet was prevented from healing!"); + MESSAGE("Foe Wobbuffet was prevented from healing!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_STRUGGLE, opponent); + MESSAGE("Foe Wobbuffet's Heal Block wore off!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_RECOVER, opponent); + } +} + +SINGLE_BATTLE_TEST("Psychic Noise is blocked by Soundproof") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_VOLTORB) { HP(1); Ability(ABILITY_SOUNDPROOF); } + } WHEN { + TURN { MOVE(player, MOVE_PSYCHIC_NOISE); MOVE(opponent, MOVE_RECOVER); } + } SCENE { + ABILITY_POPUP(opponent, ABILITY_SOUNDPROOF); + MESSAGE("Foe Voltorb's Soundproof blocks PsychicNoise!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_RECOVER, opponent); + } +} + +SINGLE_BATTLE_TEST("Psychic Noise heal block effect is blocked by Aroma Veil") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_MILCERY) { Ability(ABILITY_AROMA_VEIL); } + } WHEN { + TURN { MOVE(player, MOVE_PSYCHIC_NOISE); MOVE(opponent, MOVE_RECOVER); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_PSYCHIC_NOISE, player); + ABILITY_POPUP(opponent, ABILITY_AROMA_VEIL); + MESSAGE("Foe Milcery is protected by an aromatic veil!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_RECOVER, opponent); + } +}