Fix Tar Shot

If Tar Shot can't do anything to the target it should fail. Checking this is clunky, but it works.
This commit is contained in:
BuffelSaft 2021-11-04 20:47:45 +13:00
parent fb62479d85
commit cecd341011
4 changed files with 19 additions and 3 deletions

View File

@ -1888,6 +1888,11 @@
.4byte \ptr
.endm
.macro cantarshotwork battler:req, ptr:req
various \battler, VARIOUS_CAN_TAR_SHOT_WORK
.4byte \ptr
.endm
.macro checkpoltergeist battler:req, ptr:req
various \battler, VARIOUS_CHECK_POLTERGEIST
.4byte \ptr

View File

@ -461,6 +461,7 @@ BattleScript_EffectTarShot:
attackcanceler
jumpifsubstituteblocks BattleScript_ButItFailedAtkStringPpReduce
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
cantarshotwork BS_TARGET, BattleScript_ButItFailedAtkStringPpReduce
attackstring
ppreduce
setstatchanger STAT_SPEED, 1, TRUE

View File

@ -200,9 +200,10 @@
#define VARIOUS_SET_ATTACKER_STICKY_WEB_USER 127
#define VARIOUS_TRY_NO_RETREAT 128
#define VARIOUS_TRY_TAR_SHOT 129
#define VARIOUS_CHECK_POLTERGEIST 130
#define VARIOUS_SET_OCTOLOCK 131
#define VARIOUS_CUT_1_3_HP_RAISE_STATS 132
#define VARIOUS_CAN_TAR_SHOT_WORK 130
#define VARIOUS_CHECK_POLTERGEIST 131
#define VARIOUS_SET_OCTOLOCK 132
#define VARIOUS_CUT_1_3_HP_RAISE_STATS 133
// Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0

View File

@ -9107,6 +9107,15 @@ static void Cmd_various(void)
gBattlescriptCurrInstr += 7;
}
return;
case VARIOUS_CAN_TAR_SHOT_WORK:
// Tar Shot will fail if it's already been used on the target and its speed can't be lowered further
if (gDisableStructs[gActiveBattler].tarShot
&& (gBattleMons[gActiveBattler].statStages[STAT_SPEED] == MIN_STAT_STAGE
|| (gBattleMons[gActiveBattler].statStages[STAT_SPEED] == MAX_STAT_STAGE && GetBattlerAbility(gActiveBattler) == ABILITY_CONTRARY)))
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
else
gBattlescriptCurrInstr += 7;
return;
}
gBattlescriptCurrInstr += 3;