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

Fixing bugs with Moxie clones+Dynamax, Fling Flinch infinite loop and Focus Sash+foreseen moves #4625

Merged
merged 16 commits into from
May 26, 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
10 changes: 9 additions & 1 deletion src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -2096,6 +2096,9 @@ static void Cmd_adjustdamage(void)
{
gMoveResultFlags |= MOVE_RESULT_FOE_HUNG_ON;
gLastUsedItem = gBattleMons[gBattlerTarget].item;
gSpecialStatuses[gBattlerTarget].focusBanded = FALSE;
gSpecialStatuses[gBattlerTarget].focusSashed = FALSE;

}
else if (gSpecialStatuses[gBattlerTarget].sturdied)
{
Expand Down Expand Up @@ -3212,6 +3215,10 @@ void SetMoveEffect(bool32 primary, bool32 certain)
{
gBattleMons[gEffectBattler].status2 |= sStatusFlagsForMoveEffects[gBattleScripting.moveEffect];
gBattlescriptCurrInstr++;
}
else
{
gBattlescriptCurrInstr++;
}
break;
case MOVE_EFFECT_UPROAR:
Expand Down Expand Up @@ -8406,7 +8413,7 @@ static bool32 HasAttackerFaintedTarget(void)
&& gBattleStruct->moveTarget[gBattlerAttacker] == gBattlerTarget
&& gBattlerTarget != gBattlerAttacker
&& gCurrentTurnActionNumber == GetBattlerTurnOrderNum(gBattlerAttacker)
&& (gChosenMove == gChosenMoveByBattler[gBattlerAttacker] || gChosenMove == gBattleMons[gBattlerAttacker].moves[gChosenMovePos]))
&& (gChosenMove == gChosenMoveByBattler[gBattlerAttacker] || gChosenMove == gBattleMons[gBattlerAttacker].moves[gChosenMovePos] || gChosenMove == GetMaxMove(gBattlerAttacker, gChosenMoveByBattler[gBattlerAttacker])))
return TRUE;
else
return FALSE;
Expand Down Expand Up @@ -9486,6 +9493,7 @@ static void Cmd_various(void)
case VARIOUS_TRY_ACTIVATE_BEAST_BOOST:
{
VARIOUS_ARGS();

i = GetHighestStatId(battler);
if (GetBattlerAbility(battler) == ABILITY_BEAST_BOOST
&& HasAttackerFaintedTarget()
Expand Down
21 changes: 21 additions & 0 deletions test/battle/move_effect/future_sight.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ ASSUMPTIONS
{
ASSUME(gMovesInfo[MOVE_SEED_FLARE].power == gMovesInfo[MOVE_FUTURE_SIGHT].power);
ASSUME(gMovesInfo[MOVE_SEED_FLARE].category == gMovesInfo[MOVE_FUTURE_SIGHT].category);
ASSUME(gMovesInfo[MOVE_FUTURE_SIGHT].effect == EFFECT_FUTURE_SIGHT);
ASSUME(gMovesInfo[MOVE_FUTURE_SIGHT].power > 0);
}

SINGLE_BATTLE_TEST("Future Sight uses Sp. Atk stat of the original user without modifiers")
Expand Down Expand Up @@ -153,3 +155,22 @@ SINGLE_BATTLE_TEST("Future Sight will miss timing if target faints by residual d
NOT MESSAGE("Foe Wynaut took the Future Sight attack!");
}
}

SINGLE_BATTLE_TEST("Future Sight breaks Focus Sash and doesn't make the holder endure another move")
{
ASSUME(gMovesInfo[MOVE_PSYCHIC].power > 0);
ASSUME(gItemsInfo[ITEM_FOCUS_SASH].holdEffect == HOLD_EFFECT_FOCUS_SASH);
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_PIDGEY) { Level(1); Item(ITEM_FOCUS_SASH); }
} WHEN {
TURN { MOVE(player, MOVE_FUTURE_SIGHT); }
TURN { }
TURN { }
TURN { MOVE(player, MOVE_PSYCHIC); }
} SCENE {
MESSAGE("Foe Pidgey hung on using its Focus Sash!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_PSYCHIC, player);
MESSAGE("Foe Pidgey fainted!");
}
}
16 changes: 16 additions & 0 deletions test/dynamax.c
Original file line number Diff line number Diff line change
Expand Up @@ -1470,3 +1470,19 @@ SINGLE_BATTLE_TEST("(DYNAMAX) Max Moves don't execute effects on fainted battler
NOT MESSAGE("Foe Wobbuffet's Speed fell!");
}
}

SINGLE_BATTLE_TEST("(DYNAMAX) Moxie clones can be triggered by Max Moves fainting opponents")
{
ASSUME(gMovesInfo[MOVE_WATERFALL].power > 0);
GIVEN {
PLAYER(SPECIES_GYARADOS) { Ability(ABILITY_MOXIE); }
OPPONENT(SPECIES_WOBBUFFET) { HP(1); }
OPPONENT(SPECIES_WYNAUT);
} WHEN {
TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_WATERFALL, dynamax: TRUE); SEND_OUT(opponent, 1); }
} SCENE {
MESSAGE("Foe Wobbuffet fainted!");
ABILITY_POPUP(player, ABILITY_MOXIE);
MESSAGE("Gyarados's Moxie raised its Attack!");
}
}
Loading