Optimizations

This commit is contained in:
LOuroboros 2021-10-28 13:59:59 -03:00
parent 28522f3ffb
commit 82101d3581
6 changed files with 22 additions and 92 deletions

View File

@ -1864,11 +1864,6 @@
.4byte \ptr
.endm
.macro jumpifprotected battler:req, ptr:req
various \battler, VARIOUS_JUMP_IF_PROTECTED
.4byte \ptr
.endm
@ helpful macros
.macro setstatchanger stat:req, stages:req, down:req
setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7

View File

@ -394,86 +394,31 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectHyperspaceFury @ EFFECT_HYPERSPACE_FURY
BattleScript_EffectHyperspaceFury:
jumpifspecies BS_ATTACKER, SPECIES_HOOPA_UNBOUND, BattleScript_EffectHyperspaceFuryUnbound
jumpifspecies BS_ATTACKER, SPECIES_HOOPA, BattleScript_ButHoopaCantUseIt
jumpifspecies BS_ATTACKER, SPECIES_TREECKO, BattleScript_EffectHyperspaceFuryUnbound
jumpifspecies BS_ATTACKER, SPECIES_MUDKIP, BattleScript_ButHoopaCantUseIt
printstring STRINGID_BUTPOKEMONCANTUSETHEMOVE
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd
BattleScript_EffectHyperspaceFuryUnbound::
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
pause B_WAIT_TIME_LONG
ppreduce
setmoveeffect MOVE_EFFECT_FEINT
seteffectwithchance
setmoveeffect MOVE_EFFECT_DEF_MINUS_1 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
goto BattleScript_HitFromCritCalc
BattleScript_ButHoopaCantUseIt:
printstring STRINGID_BUTHOOPACANTUSEIT
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd
BattleScript_EffectHyperspaceFuryUnbound:
attackcanceler
jumpifprotected BS_TARGET, BattleScript_HyperspaceFuryBrokeThroughProtection
argumenttomoveeffect
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
critcalc
damagecalc
adjustdamage
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
seteffectwithchance
tryfaintmon BS_TARGET, FALSE, NULL
swapattackerwithtarget @ to make gStatDownStringIds down below print the right battler
setstatchanger STAT_DEF, 1, TRUE
statbuffchange STAT_BUFF_NOT_PROTECT_AFFECTED, BattleScript_HyperspaceFuryTargetDefenseCantGoLower
setgraphicalstatchangevalues
playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
printfromtable gStatDownStringIds
waitmessage B_WAIT_TIME_LONG
swapattackerwithtarget @ restore the battlers, just in case
goto BattleScript_MoveEnd
BattleScript_HyperspaceFuryBrokeThroughProtection::
argumenttomoveeffect
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
pause B_WAIT_TIME_LONG
BattleScript_HyperspaceFuryRemoveProtect::
printstring STRINGID_BROKETHROUGHPROTECTION
waitmessage B_WAIT_TIME_LONG
critcalc
damagecalc
adjustdamage
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
seteffectwithchance
tryfaintmon BS_TARGET, FALSE, NULL
swapattackerwithtarget @ to make gStatDownStringIds down below print the right battler
setstatchanger STAT_DEF, 1, TRUE
statbuffchange STAT_BUFF_NOT_PROTECT_AFFECTED, BattleScript_HyperspaceFuryTargetDefenseCantGoLower
setgraphicalstatchangevalues
playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
printfromtable gStatDownStringIds
waitmessage B_WAIT_TIME_LONG
swapattackerwithtarget @ restore the battlers, just in case
goto BattleScript_MoveEnd
return
BattleScript_HyperspaceFuryTargetDefenseCantGoLower:
printstring STRINGID_STATSWONTDECREASE
waitmessage B_WAIT_TIME_LONG
return
BattleScript_EffectPlasmaFists:

View File

@ -401,5 +401,6 @@ extern const u8 BattleScript_AttackWeakenedByStrongWinds[];
extern const u8 BattleScript_BlockedByPrimalWeatherEnd3[];
extern const u8 BattleScript_BlockedByPrimalWeatherRet[];
extern const u8 BattleScript_PrimalReversion[];
extern const u8 BattleScript_HyperspaceFuryRemoveProtect[];
#endif // GUARD_BATTLE_SCRIPTS_H

View File

@ -194,7 +194,6 @@
#define VARIOUS_HANDLE_PRIMAL_REVERSION 121
#define VARIOUS_APPLY_PLASMA_FISTS 122
#define VARIOUS_JUMP_IF_SPECIES 123
#define VARIOUS_JUMP_IF_PROTECTED 124
// Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0

View File

@ -3278,15 +3278,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
}
break;
case MOVE_EFFECT_FEINT:
if (gProtectStructs[gBattlerTarget].protected
|| gSideStatuses[GetBattlerSide(gBattlerTarget)] & SIDE_STATUS_WIDE_GUARD
|| gSideStatuses[GetBattlerSide(gBattlerTarget)] & SIDE_STATUS_QUICK_GUARD
|| gSideStatuses[GetBattlerSide(gBattlerTarget)] & SIDE_STATUS_CRAFTY_SHIELD
|| gSideStatuses[GetBattlerSide(gBattlerTarget)] & SIDE_STATUS_MAT_BLOCK
|| gProtectStructs[gBattlerTarget].spikyShielded
|| gProtectStructs[gBattlerTarget].kingsShielded
|| gProtectStructs[gBattlerTarget].banefulBunkered
|| gProtectStructs[gBattlerTarget].obstructed)
if (IS_BATTLER_PROTECTED(gBattlerTarget))
{
gProtectStructs[gBattlerTarget].protected = 0;
gSideStatuses[GetBattlerSide(gBattlerTarget)] &= ~(SIDE_STATUS_WIDE_GUARD);
@ -3302,6 +3294,11 @@ void SetMoveEffect(bool32 primary, u32 certain)
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_MoveEffectFeint;
}
else if (gCurrentMove == MOVE_HYPERSPACE_FURY)
{
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_HyperspaceFuryRemoveProtect;
}
}
break;
case MOVE_EFFECT_SPECTRAL_THIEF:
@ -8983,12 +8980,6 @@ static void Cmd_various(void)
else
gBattlescriptCurrInstr += 9;
return;
case VARIOUS_JUMP_IF_PROTECTED:
if (IS_BATTLER_PROTECTED(gActiveBattler))
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
else
gBattlescriptCurrInstr += 7;
return;
}
gBattlescriptCurrInstr += 3;

View File

@ -9701,7 +9701,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.priority = 0,
.flags = FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIT_IN_SUBSTITUTE,
.split = SPLIT_PHYSICAL,
.argument = MOVE_EFFECT_FEINT,
},
[MOVE_SHORE_UP] =