Fixed corruption of the next turn used move caused by Scale Shot (#5397)

This commit is contained in:
Alex 2024-09-18 16:58:49 +02:00 committed by GitHub
parent 27db57f854
commit 6ef36837e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 48 additions and 43 deletions

View file

@ -3279,51 +3279,17 @@ BattleScript_RoarBlockedByDynamax:
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_MultiHitLoop::
jumpifhasnohp BS_ATTACKER, BattleScript_MultiHitEnd
jumpifhasnohp BS_TARGET, BattleScript_MultiHitPrintStrings
jumpifhalfword CMP_EQUAL, gChosenMove, MOVE_SLEEP_TALK, BattleScript_DoMultiHit
jumpifstatus BS_ATTACKER, STATUS1_SLEEP, BattleScript_MultiHitPrintStrings
BattleScript_DoMultiHit::
movevaluescleanup
copyhword sMOVE_EFFECT, sMULTIHIT_EFFECT
critcalc
damagecalc
jumpifmovehadnoeffect BattleScript_MultiHitNoMoreHits
adjustdamage
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
multihitresultmessage
flushtextbox
addbyte sMULTIHIT_STRING + 4, 1
moveendto MOVEEND_NEXT_TARGET
jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_FOE_ENDURED, BattleScript_MultiHitPrintStrings
decrementmultihit BattleScript_MultiHitLoop
goto BattleScript_MultiHitPrintStrings
BattleScript_MultiHitNoMoreHits::
pause B_WAIT_TIME_SHORT
BattleScript_MultiHitPrintStrings:: BattleScript_MultiHitPrintStrings::
resultmessage resultmessage
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
jumpifmovehadnoeffect BattleScript_MultiHitEnd
copyarray gBattleTextBuff1, sMULTIHIT_STRING, 6 copyarray gBattleTextBuff1, sMULTIHIT_STRING, 6
printstring STRINGID_HITXTIMES printstring STRINGID_HITXTIMES
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
return return
BattleScript_MultiHitEnd:: BattleScript_ScaleShot::
setadditionaleffects call BattleScript_MultiHitPrintStrings
tryfaintmon BS_TARGET goto BattleScript_DefDownSpeedUp
moveendcase MOVEEND_SYNCHRONIZE_TARGET
moveendfrom MOVEEND_STATUS_IMMUNITY_ABILITIES
end
BattleScript_EffectConversion:: BattleScript_EffectConversion::
attackcanceler attackcanceler

View file

@ -460,6 +460,7 @@ extern const u8 BattleScript_DefDownSpeedUp[];
extern const u8 BattleScript_AffectionBasedStatusHeal[]; extern const u8 BattleScript_AffectionBasedStatusHeal[];
extern const u8 BattleScript_AffectionBasedEndurance[]; extern const u8 BattleScript_AffectionBasedEndurance[];
extern const u8 BattleScript_SymbiosisActivates[]; extern const u8 BattleScript_SymbiosisActivates[];
extern const u8 BattleScript_ScaleShot[];
extern const u8 BattleScript_MultiHitPrintStrings[]; extern const u8 BattleScript_MultiHitPrintStrings[];
extern const u8 BattleScript_RemoveFireType[]; extern const u8 BattleScript_RemoveFireType[];
extern const u8 BattleScript_TargetAbilityStatRaiseRet[]; extern const u8 BattleScript_TargetAbilityStatRaiseRet[];

View file

@ -6030,13 +6030,11 @@ static void Cmd_moveend(void)
gBattleScripting.multihitString[4]++; 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(); BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_MultiHitPrintStrings; if (gMovesInfo[gCurrentMove].argument == MOVE_EFFECT_SCALE_SHOT && !NoAliveMonsForEitherParty())
gBattlescriptCurrInstr = BattleScript_ScaleShot;
else
gBattlescriptCurrInstr = BattleScript_MultiHitPrintStrings;
effect = TRUE; effect = TRUE;
} }
else else

View file

@ -160,6 +160,46 @@ SINGLE_BATTLE_TEST("Scale Shot decreases defense and increases speed after final
} }
} }
SINGLE_BATTLE_TEST("Scale Shot is immune to Fairy types and will end the move correctly")
{
GIVEN {
ASSUME(gMovesInfo[MOVE_SCALE_SHOT].effect == EFFECT_MULTI_HIT);
ASSUME(gMovesInfo[MOVE_SCALE_SHOT].type == TYPE_DRAGON);
ASSUME(gSpeciesInfo[SPECIES_CLEFAIRY].types[0] == TYPE_FAIRY || gSpeciesInfo[SPECIES_CLEFAIRY].types[1] == TYPE_FAIRY);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_CLEFAIRY) { HP(1); }
} WHEN {
TURN { MOVE(player, MOVE_SCALE_SHOT); }
} SCENE {
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_SCALE_SHOT, player);
MESSAGE("It doesn't affect Foe Clefairy…");
}
}
DOUBLE_BATTLE_TEST("Scale Shot does not corrupt the next turn move used")
{
GIVEN {
ASSUME(gMovesInfo[MOVE_SCALE_SHOT].effect == EFFECT_MULTI_HIT);
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { HP(1); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(playerRight, MOVE_SCALE_SHOT, target: opponentRight); SWITCH(playerLeft, 2); SEND_OUT(opponentRight, 2); }
TURN { MOVE(playerRight, MOVE_BULLDOZE); MOVE(playerLeft, MOVE_CELEBRATE); MOVE(opponentRight, MOVE_CELEBRATE); MOVE(opponentLeft, MOVE_CELEBRATE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_SCALE_SHOT, playerRight);
HP_BAR(opponentRight);
MESSAGE("Hit 1 time(s)!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_BULLDOZE, playerRight);
HP_BAR(playerLeft);
HP_BAR(opponentLeft);
HP_BAR(opponentRight);
}
}
SINGLE_BATTLE_TEST("Endure does not prevent multiple hits and stat changes occur at the end of the turn") SINGLE_BATTLE_TEST("Endure does not prevent multiple hits and stat changes occur at the end of the turn")
{ {
GIVEN { GIVEN {