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

Fixes Tar Shot on Tera mons #5302

Merged
merged 2 commits into from
Aug 31, 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: 5 additions & 5 deletions asm/macros/battle_script.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1674,6 +1674,11 @@
callnative BS_FickleBeamDamageCalculation
.endm

.macro trytarshot failInstr:req
callnative BS_TryTarShot
.4byte \failInstr
.endm

@ various command changed to more readable macros
.macro cancelmultiturnmoves battler:req
various \battler, VARIOUS_CANCEL_MULTI_TURN_MOVES
Expand Down Expand Up @@ -2210,11 +2215,6 @@
.4byte \failInstr
.endm

.macro trytarshot battler:req, failInstr:req
various \battler, VARIOUS_TRY_TAR_SHOT
.4byte \failInstr
.endm

.macro cantarshotwork battler:req, failInstr:req
various \battler, VARIOUS_CAN_TAR_SHOT_WORK
.4byte \failInstr
Expand Down
2 changes: 1 addition & 1 deletion data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ BattleScript_EffectTarShot::
printfromtable gStatDownStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_TryTarShot:
trytarshot BS_TARGET, BattleScript_MoveEnd
trytarshot BattleScript_MoveEnd
printstring STRINGID_PKMNBECAMEWEAKERTOFIRE
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd
Expand Down
28 changes: 14 additions & 14 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -10715,20 +10715,6 @@ static void Cmd_various(void)
}
return;
}
case VARIOUS_TRY_TAR_SHOT:
{
VARIOUS_ARGS(const u8 *failInstr);
if (gDisableStructs[battler].tarShot)
{
gBattlescriptCurrInstr = cmd->failInstr;
}
else
{
gDisableStructs[battler].tarShot = TRUE;
gBattlescriptCurrInstr = cmd->nextInstr;
}
return;
}
case VARIOUS_CAN_TAR_SHOT_WORK:
{
VARIOUS_ARGS(const u8 *failInstr);
Expand Down Expand Up @@ -17209,3 +17195,17 @@ void BS_FickleBeamDamageCalculation(void)
gBattlescriptCurrInstr = cmd->nextInstr;
}
}

void BS_TryTarShot(void)
{
NATIVE_ARGS(const u8 *failInstr);
if (gDisableStructs[gBattlerTarget].tarShot || GetActiveGimmick(gBattlerTarget) == GIMMICK_TERA)
{
gBattlescriptCurrInstr = cmd->failInstr;
}
else
{
gDisableStructs[gBattlerTarget].tarShot = TRUE;
gBattlescriptCurrInstr = cmd->nextInstr;
}
}
43 changes: 43 additions & 0 deletions test/battle/move_effect/tar_shot.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,46 @@ SINGLE_BATTLE_TEST("Tar Shot doubles the effectiveness of Fire-type moves used o
}
}

SINGLE_BATTLE_TEST("Tar Shot does not affect Pokemon that are Terastallized")
{
s16 damage[2];
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { TeraType(TYPE_NORMAL); }
OPPONENT(SPECIES_WOBBUFFET) ;
} WHEN {
TURN { MOVE(player, MOVE_CELEBRATE, gimmick: GIMMICK_TERA); MOVE(opponent, MOVE_EMBER); }
TURN { MOVE(opponent, MOVE_TAR_SHOT); }
TURN { MOVE(opponent, MOVE_EMBER); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_EMBER, opponent);
HP_BAR(player, captureDamage: &damage[0]);
ANIMATION(ANIM_TYPE_MOVE, MOVE_TAR_SHOT, opponent);
ANIMATION(ANIM_TYPE_MOVE, MOVE_EMBER, opponent);
HP_BAR(player, captureDamage: &damage[1]);
NOT MESSAGE("It's super effective!");
} THEN {
EXPECT_EQ(damage[0], damage[1]);
}
}

SINGLE_BATTLE_TEST("Tar Shot does affect Pokemon that Terastallized after Tar Shot status was applied")
{
s16 damage[2];
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { TeraType(TYPE_NORMAL); }
OPPONENT(SPECIES_WOBBUFFET) ;
} WHEN {
TURN { MOVE(opponent, MOVE_EMBER); }
TURN { MOVE(opponent, MOVE_TAR_SHOT); }
TURN { MOVE(player, MOVE_CELEBRATE, gimmick: GIMMICK_TERA); MOVE(opponent, MOVE_EMBER); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_EMBER, opponent);
HP_BAR(player, captureDamage: &damage[0]);
ANIMATION(ANIM_TYPE_MOVE, MOVE_TAR_SHOT, opponent);
ANIMATION(ANIM_TYPE_MOVE, MOVE_EMBER, opponent);
HP_BAR(player, captureDamage: &damage[1]);
MESSAGE("It's super effective!");
} THEN {
EXPECT_MUL_EQ(damage[0], Q_4_12(2.0), damage[1]);
}
}
Loading