From 58055c6f9044c8cc1c6e9f168a4dcf935ea4774d Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 29 Oct 2023 23:50:13 +0100 Subject: [PATCH] Glaive Rush no affect --- data/battle_scripts_1.s | 10 ++++-- src/battle_script_commands.c | 1 + test/battle/move_effect/glaive_rush.c | 48 +++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 3 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 5cca7a20587d..208e417a7054 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -443,10 +443,14 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectGlaiveRush @ EFFECT_GLAIVE_RUSH BattleScript_EffectGlaiveRush:: - attackcanceler - accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE + call BattleScript_EffectHit_Ret + jumpifhalfword CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_GlaiveRushNoEffect setglaiverush - goto BattleScript_HitFromAtkString +BattleScript_GlaiveRushNoEffect: + waitmessage B_WAIT_TIME_LONG + seteffectwithchance + tryfaintmon BS_TARGET + goto BattleScript_MoveEnd BattleScript_EffectSyrupBomb:: setmoveeffect MOVE_EFFECT_SYRUP_BOMB diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 8a487df4997b..468cbf2025b5 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -16282,5 +16282,6 @@ void BS_SetGlaiveRush(void) NATIVE_ARGS(); gStatuses4[gBattlerAttacker] |= STATUS4_GLAIVE_RUSH; + gBattlescriptCurrInstr = cmd->nextInstr; } diff --git a/test/battle/move_effect/glaive_rush.c b/test/battle/move_effect/glaive_rush.c index 7d812d4304ec..6cbc92fa9546 100644 --- a/test/battle/move_effect/glaive_rush.c +++ b/test/battle/move_effect/glaive_rush.c @@ -68,6 +68,54 @@ SINGLE_BATTLE_TEST("If Glaive Rush is successful, moves targeted at the user dea } } +SINGLE_BATTLE_TEST("If Glaive Rush isn't successful moves targeted at the user don't deal double damage", s16 damage) +{ + bool32 missesGlaiveRush; + + PARAMETRIZE { missesGlaiveRush = FALSE; } + PARAMETRIZE { missesGlaiveRush = TRUE; } + + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_BRIGHT_POWDER); } + } WHEN { + TURN { MOVE(player, MOVE_GLAIVE_RUSH, hit: missesGlaiveRush); MOVE(opponent, MOVE_TACKLE); } + } SCENE { + if (!missesGlaiveRush) + NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_GLAIVE_RUSH, player); + else + ANIMATION(ANIM_TYPE_MOVE, MOVE_GLAIVE_RUSH, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent); + HP_BAR(player, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(2.0), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("Glaive Rush doesn't affect the user if the effect is blocked", s16 damage) +{ + u32 species; + + PARAMETRIZE { species = SPECIES_CLEFAIRY; } + PARAMETRIZE { species = SPECIES_WOBBUFFET; } + + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(species) { Attack(50); } + } WHEN { + TURN { MOVE(player, MOVE_GLAIVE_RUSH); MOVE(opponent, MOVE_TACKLE); } + } SCENE { + if (species == SPECIES_CLEFAIRY) + NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_GLAIVE_RUSH, player); + else + ANIMATION(ANIM_TYPE_MOVE, MOVE_GLAIVE_RUSH, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent); + HP_BAR(player, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(2.0), results[1].damage); + } +} + SINGLE_BATTLE_TEST("Glaive Rush status last until the the user's next turn") { s16 normalDmgFristHit;