Skip to content

Commit

Permalink
Glaive Rush no affect
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexOn1ine committed Oct 29, 2023
1 parent f8b3fdf commit 58055c6
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 3 deletions.
10 changes: 7 additions & 3 deletions data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -16282,5 +16282,6 @@ void BS_SetGlaiveRush(void)
NATIVE_ARGS();

gStatuses4[gBattlerAttacker] |= STATUS4_GLAIVE_RUSH;

gBattlescriptCurrInstr = cmd->nextInstr;
}
48 changes: 48 additions & 0 deletions test/battle/move_effect/glaive_rush.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 58055c6

Please sign in to comment.