Skip to content

Commit

Permalink
Fixes Stalwart/Propeller Tail, Life Orb on confusion, Remove Status w…
Browse files Browse the repository at this point in the history
…rong battlescripts (#5061)

* Fix swapped BattleScripts in MoveEffectRemoveStatus for Freeze/Frostbite

* Fix Life Orb damaging the user if they hit themselves in confusion

* Fix Stalwart/Propeller Tail not ignoring redirection from Storm Drain/Lightning Rod

* Parametrize Species
  • Loading branch information
PhallenTree authored Jul 30, 2024
1 parent 7422051 commit ab9f8e6
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -5741,10 +5741,10 @@ static void Cmd_moveend(void)
gBattlescriptCurrInstr = BattleScript_TargetBurnHeal;
break;
case STATUS1_FREEZE:
gBattlescriptCurrInstr = BattleScript_FrostbiteHealedViaFireMove;
gBattlescriptCurrInstr = BattleScript_DefrostedViaFireMove;
break;
case STATUS1_FROSTBITE:
gBattlescriptCurrInstr = BattleScript_DefrostedViaFireMove;
gBattlescriptCurrInstr = BattleScript_FrostbiteHealedViaFireMove;
break;
case STATUS1_POISON:
case STATUS1_TOXIC_POISON:
Expand Down
5 changes: 3 additions & 2 deletions src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ void HandleAction_UseMove(void)
&& GetBattlerTurnOrderNum(battler) < var
&& gMovesInfo[gCurrentMove].effect != EFFECT_SNIPE_SHOT
&& gMovesInfo[gCurrentMove].effect != EFFECT_PLEDGE
&& (GetBattlerAbility(gBattlerAttacker) != ABILITY_PROPELLER_TAIL
|| GetBattlerAbility(gBattlerAttacker) != ABILITY_STALWART))
&& GetBattlerAbility(gBattlerAttacker) != ABILITY_PROPELLER_TAIL
&& GetBattlerAbility(gBattlerAttacker) != ABILITY_STALWART)
{
var = GetBattlerTurnOrderNum(battler);
}
Expand Down Expand Up @@ -7791,6 +7791,7 @@ u8 ItemBattleEffects(u8 caseID, u32 battler, bool32 moveTurn)
if (IsBattlerAlive(gBattlerAttacker)
&& !(TestIfSheerForceAffected(gBattlerAttacker, gCurrentMove))
&& GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
&& !gSpecialStatuses[gBattlerAttacker].preventLifeOrbDamage
&& gSpecialStatuses[gBattlerAttacker].damagedMons)
{
Expand Down
55 changes: 55 additions & 0 deletions test/battle/ability/stalwart.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#include "global.h"
#include "test/battle.h"

DOUBLE_BATTLE_TEST("Stalwart ignores redirection from Follow-Me")
{
GIVEN {
PLAYER(SPECIES_ARCHALUDON) { Ability(ABILITY_STALWART); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponentLeft, MOVE_FOLLOW_ME); MOVE(playerLeft, MOVE_DRACO_METEOR, target: opponentRight); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_FOLLOW_ME, opponentLeft);
ANIMATION(ANIM_TYPE_MOVE, MOVE_DRACO_METEOR, playerLeft);
HP_BAR(opponentRight);
NOT HP_BAR(opponentLeft);
}
}

DOUBLE_BATTLE_TEST("Stalwart stops Lightning Rod and Storm Drain from redirecting moves")
{
u32 ability, species;
PARAMETRIZE { ability = ABILITY_STORM_DRAIN; species = SPECIES_LUMINEON; }
PARAMETRIZE { ability = ABILITY_LIGHTNING_ROD; species = SPECIES_RAICHU; }
GIVEN {
ASSUME(gMovesInfo[MOVE_SPARK].type == TYPE_ELECTRIC);
ASSUME(gMovesInfo[MOVE_WATER_GUN].type == TYPE_WATER);
PLAYER(SPECIES_WOBBUFFET) { Ability(ABILITY_STALWART); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(species) { Ability(ability); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN {
if (ability == ABILITY_LIGHTNING_ROD)
MOVE(playerLeft, MOVE_SPARK, target: opponentRight);
else
MOVE(playerLeft, MOVE_WATER_GUN, target: opponentRight);
}
} SCENE {
if (B_REDIRECT_ABILITY_IMMUNITY >= GEN_5) {
HP_BAR(opponentRight);
NONE_OF {
ABILITY_POPUP(opponentLeft, ability);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentLeft);
MESSAGE("Foe Raichu's Sp. Atk rose!");
}
} else {
HP_BAR(opponentRight);
NONE_OF {
HP_BAR(opponentLeft);
}
}
}
}

0 comments on commit ab9f8e6

Please sign in to comment.