Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Move Psychic Noise #4005

Merged
merged 4 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,11 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectHit @ EFFECT_BLIZZARD
.4byte BattleScript_EffectHit @ EFFECT_RAIN_ALWAYS_HIT

BattleScript_EffectPsychicNoise::
AlexOn1ine marked this conversation as resolved.
Show resolved Hide resolved
printstring STRINGID_PKMNPREVENTEDFROMHEALING
waitmessage B_WAIT_TIME_LONG
return

BattleScript_EffectFilletAway:
attackcanceler
attackstring
Expand Down
2 changes: 2 additions & 0 deletions include/battle_scripts.h
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down
3 changes: 2 additions & 1 deletion include/constants/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link

@Skeli789 Skeli789 Jan 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few things:

  1. The "proper" way to do this is to use AbilityBattleEffects(ABILITYEFFECT_CHECK_BANK_SIDE.... That way you don't run the risk of checking the partner's data in a single battle.
  2. You should check ingame if there should be an Ability pop-up here. Usually when a secondary effect is blocked by an Ability (eg. Water Veil blocking burn) no Ability pop-up is shown -- the effect just doesn't happen.
  3. If there is supposed to be an Ability pop-up, it'll say the wrong Pokemon's Ability in the case where it's the partner's Ability that blocks it (you're setting gBattlerAbility to gEffectBattler regardless of the Ability holder)/.

Copy link
Collaborator Author

@AlexOn1ine AlexOn1ine Jan 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. There is the function IsAbilityOnSide that is used for ABILITY_AROMA_VEIL. Would that suffice?
  2. On showdown the ability pop up does show up.
  3. Correct. Should have been obvious 🫣

}
else if (!(gStatuses3[gEffectBattler] & STATUS3_HEAL_BLOCK))
{
gStatuses3[gEffectBattler] |= STATUS3_HEAL_BLOCK;
gDisableStructs[gEffectBattler].healBlockTimer = 2;
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_EffectPsychicNoise;
}
break;
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/data/battle_moves.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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] =
Expand Down
56 changes: 56 additions & 0 deletions test/battle/move_effect/psychic_noise.c
Original file line number Diff line number Diff line change
@@ -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);
}
}
Loading