Fixes Scale Shot not activating + Known Failing Round test (#5292)

* Fixes Scale Shot not activating + Known Failing Round test

* Update test/battle/move_effect/multi_hit.c
This commit is contained in:
Alex 2024-08-31 01:36:14 +02:00 committed by GitHub
parent 8053f4ab1e
commit addaf40971
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 53 additions and 5 deletions

View file

@ -6016,15 +6016,18 @@ static void Cmd_moveend(void)
&& gMultiHitCounter
&& !(gMovesInfo[gCurrentMove].effect == EFFECT_PRESENT && gBattleStruct->presentBasePower == 0)) // Silly edge case
{
gMultiHitCounter--;
if (!IsBattlerAlive(gBattlerTarget) && gMovesInfo[gCurrentMove].effect != EFFECT_DRAGON_DARTS)
gMultiHitCounter = 0;
gBattleScripting.multihitString[4]++;
if (--gMultiHitCounter == 0)
if (gMultiHitCounter == 0)
{
if (gMovesInfo[gCurrentMove].argument == MOVE_EFFECT_SCALE_SHOT && !NoAliveMonsForEitherParty())
{
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_DefDownSpeedUp;
}
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_MultiHitPrintStrings;
effect = TRUE;
@ -16124,7 +16127,6 @@ static void TryUpdateRoundTurnOrder(void)
for (i = 0; roundUsers[i] != 0xFF && i < 3; i++)
{
gBattlerByTurnOrder[currRounder] = roundUsers[i];
gActionsByTurnOrder[currRounder] = gActionsByTurnOrder[roundUsers[i]];
gProtectStructs[roundUsers[i]].quash = TRUE; // Make it so their turn order can't be changed again
currRounder++;
}
@ -16133,7 +16135,6 @@ static void TryUpdateRoundTurnOrder(void)
for (i = 0; nonRoundUsers[i] != 0xFF && i < 3; i++)
{
gBattlerByTurnOrder[currRounder] = nonRoundUsers[i];
gActionsByTurnOrder[currRounder] = gActionsByTurnOrder[nonRoundUsers[i]];
currRounder++;
}
}

View file

@ -183,3 +183,51 @@ SINGLE_BATTLE_TEST("Endure does not prevent multiple hits and stat changes occur
MESSAGE("Wobbuffet's Speed rose!");
}
}
SINGLE_BATTLE_TEST("Scale Shot decreases defense and increases speed after the 4th hit of Loaded Dice")
{
PASSES_RANDOMLY(50, 100, RNG_LOADED_DICE);
GIVEN {
ASSUME(gMovesInfo[MOVE_SCALE_SHOT].effect == EFFECT_MULTI_HIT);
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_LOADED_DICE); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_SCALE_SHOT); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_SCALE_SHOT, player);
ANIMATION(ANIM_TYPE_MOVE, MOVE_SCALE_SHOT, player);
ANIMATION(ANIM_TYPE_MOVE, MOVE_SCALE_SHOT, player);
ANIMATION(ANIM_TYPE_MOVE, MOVE_SCALE_SHOT, player);
MESSAGE("Hit 4 time(s)!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Wobbuffet's Defense fell!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Wobbuffet's Speed rose!");
}
}
SINGLE_BATTLE_TEST("Scale Shot decreases defense and increases speed after killing opposing with less then 4 hits")
{
u32 item;
PARAMETRIZE { item = ITEM_NONE; }
PARAMETRIZE { item = ITEM_LOADED_DICE; }
GIVEN {
ASSUME(gMovesInfo[MOVE_SCALE_SHOT].effect == EFFECT_MULTI_HIT);
PLAYER(SPECIES_BAGON) { Item(item); }
OPPONENT(SPECIES_SLUGMA) { Ability(ABILITY_WEAK_ARMOR); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_SCALE_SHOT); SEND_OUT(opponent, 1); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_SCALE_SHOT, player);
ANIMATION(ANIM_TYPE_MOVE, MOVE_SCALE_SHOT, player);
ANIMATION(ANIM_TYPE_MOVE, MOVE_SCALE_SHOT, player);
MESSAGE("Foe Slugma fainted!");
MESSAGE("Hit 3 time(s)!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Bagon's Defense fell!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Bagon's Speed rose!");
}
}

View file

@ -74,7 +74,6 @@ DOUBLE_BATTLE_TEST("Round still preserves the turn order outside of the other Ro
}
DOUBLE_BATTLE_TEST("Round still preserves the turn order outside of the other Round users moving immediately with switch")
{
KNOWN_FAILING; // #5148
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_WYNAUT);