Skip to content

Commit

Permalink
Fixes Mind Blown / Magic Guard interaction and renames Steel Beam eff…
Browse files Browse the repository at this point in the history
…ect (rh-hideout#4043)

* Fixes Mind Blown / Magic Guard interaction and renames Steel Beam effect

* review fixes

---------

Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
  • Loading branch information
AlexOn1ine and Bassoonian authored Jan 21, 2024
1 parent a01d442 commit 0ec777d
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 7 deletions.
5 changes: 3 additions & 2 deletions data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectHit @ EFFECT_RISING_VOLTAGE
.4byte BattleScript_EffectHit @ EFFECT_BEAK_BLAST
.4byte BattleScript_EffectCourtChange @ EFFECT_COURT_CHANGE
.4byte BattleScript_EffectSteelBeam @ EFFECT_STEEL_BEAM
.4byte BattleScript_EffectMaxHp50Recoil @ EFFECT_MAX_HP_50_RECOIL
.4byte BattleScript_EffectExtremeEvoboost @ EFFECT_EXTREME_EVOBOOST
.4byte BattleScript_EffectHitSetRemoveTerrain @ EFFECT_HIT_SET_REMOVE_TERRAIN
.4byte BattleScript_EffectDarkVoid @ EFFECT_DARK_VOID
Expand Down Expand Up @@ -927,7 +927,7 @@ BattleScript_EffectShellTrap::
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd

BattleScript_EffectSteelBeam::
BattleScript_EffectMaxHp50Recoil::
attackcanceler
attackstring
ppreduce
Expand Down Expand Up @@ -3592,6 +3592,7 @@ BattleScript_MindBlownDamp:
goto BattleScript_DampStopsExplosion
BattleScript_EffectMindBlown_HpDown:
setbyte sMULTIHIT_EFFECT, 1 @ Note to not faint the attacker
jumpifability BS_ATTACKER, ABILITY_MAGIC_GUARD, BattleScript_EffectMindBlown_AnimDmgNoFaint
dmg_1_2_attackerhp
healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER
Expand Down
2 changes: 1 addition & 1 deletion include/constants/battle_move_effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@
#define EFFECT_RISING_VOLTAGE 377
#define EFFECT_BEAK_BLAST 378
#define EFFECT_COURT_CHANGE 379
#define EFFECT_STEEL_BEAM 380
#define EFFECT_MAX_HP_50_RECOIL 380
#define EFFECT_EXTREME_EVOBOOST 381
#define EFFECT_HIT_SET_REMOVE_TERRAIN 382 // genesis supernova
#define EFFECT_DARK_VOID 383
Expand Down
2 changes: 1 addition & 1 deletion src/battle_ai_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ static bool32 AI_IsMoveEffectInMinus(u32 battlerAtk, u32 battlerDef, u32 move, s
case EFFECT_OVERHEAT:
case EFFECT_MAKE_IT_RAIN:
case EFFECT_MIND_BLOWN:
case EFFECT_STEEL_BEAM:
case EFFECT_MAX_HP_50_RECOIL:
return TRUE;
case EFFECT_RECOIL_25:
case EFFECT_RECOIL_IF_MISS:
Expand Down
2 changes: 1 addition & 1 deletion src/battle_tv.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ static const u16 sPoints_MoveEffect[NUM_BATTLE_MOVE_EFFECTS] =
[EFFECT_RISING_VOLTAGE] = 0, // TODO: Assign points
[EFFECT_BEAK_BLAST] = 0, // TODO: Assign points
[EFFECT_COURT_CHANGE] = 0, // TODO: Assign points
[EFFECT_STEEL_BEAM] = 0, // TODO: Assign points
[EFFECT_MAX_HP_50_RECOIL] = 0, // TODO: Assign points
[EFFECT_EXTREME_EVOBOOST] = 0, // TODO: Assign points
[EFFECT_HIT_SET_REMOVE_TERRAIN] = 0, // TODO: Assign points
[EFFECT_DARK_VOID] = 0, // TODO: Assign points
Expand Down
4 changes: 2 additions & 2 deletions src/data/battle_moves.h
Original file line number Diff line number Diff line change
Expand Up @@ -12606,7 +12606,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_DYNAMAX] =

[MOVE_STEEL_BEAM] =
{
.effect = EFFECT_STEEL_BEAM,
.effect = EFFECT_MAX_HP_50_RECOIL,
.power = 140,
.type = TYPE_STEEL,
.accuracy = 95,
Expand Down Expand Up @@ -13259,7 +13259,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_DYNAMAX] =
#else
.power = 120,
#endif
.effect = EFFECT_STEEL_BEAM,
.effect = EFFECT_MAX_HP_50_RECOIL,
.type = TYPE_GRASS,
.accuracy = 95,
.pp = 5,
Expand Down
39 changes: 39 additions & 0 deletions test/battle/move_effect/max_hp_50_recoil.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include "global.h"
#include "test/battle.h"

ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_STEEL_BEAM].effect == EFFECT_MAX_HP_50_RECOIL);
}

SINGLE_BATTLE_TEST("Steel Beam causes the user to take damage equal to half of its maximum HP")
{
s16 recoilDamage;

GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_STEEL_BEAM); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_STEEL_BEAM, player);
HP_BAR(opponent);
HP_BAR(player, captureDamage: &recoilDamage);
} THEN {
EXPECT_EQ(player->maxHP / 2, recoilDamage);
}
}

SINGLE_BATTLE_TEST("Steel Beam hp loss is prevented by Magic Guard")
{
GIVEN {
PLAYER(SPECIES_CLEFAIRY) { Ability(ABILITY_MAGIC_GUARD); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_STEEL_BEAM); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_STEEL_BEAM, player);
HP_BAR(opponent);
NOT HP_BAR(player);
}
}
13 changes: 13 additions & 0 deletions test/battle/move_effect/mind_blown.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,16 @@ DOUBLE_BATTLE_TEST("Mind Blown causes everyone to faint in a double battle")
MESSAGE("Wobbuffet fainted!");
}
}

SINGLE_BATTLE_TEST("Mind Blown hp loss is prevented by Magic Guard")
{
GIVEN {
PLAYER(SPECIES_CLEFAIRY) { Ability(ABILITY_MAGIC_GUARD); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_MIND_BLOWN); }
} SCENE {
NOT HP_BAR(player);
ANIMATION(ANIM_TYPE_MOVE, MOVE_MIND_BLOWN, player);
}
}

0 comments on commit 0ec777d

Please sign in to comment.