Helpful macros for atk49

This commit is contained in:
DizzyEggg 2019-03-30 12:37:18 +01:00 committed by huderlem
parent 8184688330
commit 35cffea987
4 changed files with 79 additions and 72 deletions

View File

@ -404,6 +404,38 @@
.byte \param1 .byte \param1
.endm .endm
@ Help macros for 5 uses of moveend command
@ All cases
.macro moveendall
setbyte sMOVEEND_STATE, 0
moveend 0, 0
.endm
@ Chosen case
.macro moveendcase case:req
setbyte sMOVEEND_STATE, \case
moveend 1, 0
.endm
@ All cases from (inclusive)
.macro moveendfrom from:req
setbyte sMOVEEND_STATE, \from
moveend 0, 0
.endm
@ All cases from 0 to (not inclusive)
.macro moveendto to:req
setbyte sMOVEEND_STATE, 0
moveend 2, \to
.endm
@ Cases from (inclusive) to (not inclusive)
.macro moveendfromto from:req, to:req
setbyte sMOVEEND_STATE, \from
moveend 2, \to
.endm
.macro typecalc2 .macro typecalc2
.byte 0x4a .byte 0x4a
.endm .endm

View File

@ -284,8 +284,7 @@ BattleScript_HitFromAtkAnimation::
seteffectwithchance seteffectwithchance
tryfaintmon BS_TARGET, FALSE, NULL tryfaintmon BS_TARGET, FALSE, NULL
BattleScript_MoveEnd:: BattleScript_MoveEnd::
setbyte sMOVEEND_STATE, 0x0 moveendall
moveend 0x0, 0x0
end end
BattleScript_MakeMoveMissed:: BattleScript_MakeMoveMissed::
@ -423,8 +422,7 @@ BattleScript_ExplosionLoop:
resultmessage resultmessage
waitmessage 0x40 waitmessage 0x40
tryfaintmon BS_TARGET, FALSE, NULL tryfaintmon BS_TARGET, FALSE, NULL
setbyte sMOVEEND_STATE, 0x0 moveendto ATK49_NEXT_TARGET
moveend 0x2, 0x10
jumpifnexttargetvalid BattleScript_ExplosionLoop jumpifnexttargetvalid BattleScript_ExplosionLoop
tryfaintmon BS_ATTACKER, FALSE, NULL tryfaintmon BS_ATTACKER, FALSE, NULL
end end
@ -432,8 +430,7 @@ BattleScript_ExplosionMissed:
effectivenesssound effectivenesssound
resultmessage resultmessage
waitmessage 0x40 waitmessage 0x40
setbyte sMOVEEND_STATE, 0x0 moveendto ATK49_NEXT_TARGET
moveend 0x2, 0x10
jumpifnexttargetvalid BattleScript_ExplosionLoop jumpifnexttargetvalid BattleScript_ExplosionLoop
tryfaintmon BS_ATTACKER, FALSE, NULL tryfaintmon BS_ATTACKER, FALSE, NULL
end end
@ -657,8 +654,7 @@ BattleScript_DoMultiHit::
printstring STRINGID_EMPTYSTRING3 printstring STRINGID_EMPTYSTRING3
waitmessage 0x1 waitmessage 0x1
addbyte sMULTIHIT_STRING + 4, 0x1 addbyte sMULTIHIT_STRING + 4, 0x1
setbyte sMOVEEND_STATE, 0x0 moveendto ATK49_NEXT_TARGET
moveend 0x2, 0x10
jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_FOE_ENDURED, BattleScript_MultiHitPrintStrings jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_FOE_ENDURED, BattleScript_MultiHitPrintStrings
decrementmultihit BattleScript_MultiHitLoop decrementmultihit BattleScript_MultiHitLoop
goto BattleScript_MultiHitPrintStrings goto BattleScript_MultiHitPrintStrings
@ -674,10 +670,8 @@ BattleScript_MultiHitPrintStrings::
BattleScript_MultiHitEnd:: BattleScript_MultiHitEnd::
seteffectwithchance seteffectwithchance
tryfaintmon BS_TARGET, FALSE, NULL tryfaintmon BS_TARGET, FALSE, NULL
setbyte sMOVEEND_STATE, 0x2 moveendcase ATK49_SYNCHRONIZE_TARGET
moveend 0x1, 0x0 moveendfrom ATK49_STATUS_IMMUNITY_ABILITIES
setbyte sMOVEEND_STATE, 0x4
moveend 0x0, 0x0
end end
BattleScript_EffectConversion:: BattleScript_EffectConversion::
@ -1441,8 +1435,7 @@ BattleScript_DoTripleKickAttack::
waitmessage 0x40 waitmessage 0x40
printstring STRINGID_EMPTYSTRING3 printstring STRINGID_EMPTYSTRING3
waitmessage 0x1 waitmessage 0x1
setbyte sMOVEEND_STATE, 0x0 moveendto ATK49_NEXT_TARGET
moveend 0x2, 0x10
jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_FOE_ENDURED, BattleScript_TripleKickPrintStrings jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_FOE_ENDURED, BattleScript_TripleKickPrintStrings
decrementmultihit BattleScript_TripleKickLoop decrementmultihit BattleScript_TripleKickLoop
goto BattleScript_TripleKickPrintStrings goto BattleScript_TripleKickPrintStrings
@ -1461,8 +1454,7 @@ BattleScript_TripleKickPrintStrings::
BattleScript_TripleKickEnd:: BattleScript_TripleKickEnd::
seteffectwithchance seteffectwithchance
tryfaintmon BS_TARGET, FALSE, NULL tryfaintmon BS_TARGET, FALSE, NULL
setbyte sMOVEEND_STATE, 0xE moveendfrom ATK49_UPDATE_LAST_MOVES
moveend 0x0, 0x0
end end
BattleScript_EffectThief:: BattleScript_EffectThief::
@ -1893,8 +1885,7 @@ BattleScript_DoHitAllWithUndergroundBonus::
printstring STRINGID_EMPTYSTRING3 printstring STRINGID_EMPTYSTRING3
waitmessage 0x1 waitmessage 0x1
tryfaintmon BS_TARGET, FALSE, NULL tryfaintmon BS_TARGET, FALSE, NULL
setbyte sMOVEEND_STATE, 0x0 moveendto ATK49_NEXT_TARGET
moveend 0x2, 0x10
jumpifnexttargetvalid BattleScript_HitsAllWithUndergroundBonusLoop jumpifnexttargetvalid BattleScript_HitsAllWithUndergroundBonusLoop
end end
BattleScript_HitAllWithUndergroundBonusMissed:: BattleScript_HitAllWithUndergroundBonusMissed::
@ -1903,8 +1894,7 @@ BattleScript_HitAllWithUndergroundBonusMissed::
effectivenesssound effectivenesssound
resultmessage resultmessage
waitmessage 0x40 waitmessage 0x40
setbyte sMOVEEND_STATE, 0x0 moveendto ATK49_NEXT_TARGET
moveend 0x2, 0x10
jumpifnexttargetvalid BattleScript_HitsAllWithUndergroundBonusLoop jumpifnexttargetvalid BattleScript_HitsAllWithUndergroundBonusLoop
end end
@ -1995,8 +1985,7 @@ BattleScript_BeatUpAttack::
resultmessage resultmessage
waitmessage 0x40 waitmessage 0x40
tryfaintmon BS_TARGET, FALSE, NULL tryfaintmon BS_TARGET, FALSE, NULL
setbyte sMOVEEND_STATE, 0x0 moveendto ATK49_NEXT_TARGET
moveend 0x2, 0x10
goto BattleScript_BeatUpLoop goto BattleScript_BeatUpLoop
BattleScript_BeatUpEnd:: BattleScript_BeatUpEnd::
end end
@ -2617,8 +2606,7 @@ BattleScript_TeeterDanceLoop::
resultmessage resultmessage
waitmessage 0x40 waitmessage 0x40
BattleScript_TeeterDanceDoMoveEndIncrement:: BattleScript_TeeterDanceDoMoveEndIncrement::
setbyte sMOVEEND_STATE, 0x0 moveendto ATK49_NEXT_TARGET
moveend 0x2, 0x10
BattleScript_TeeterDanceLoopIncrement:: BattleScript_TeeterDanceLoopIncrement::
addbyte gBattlerTarget, 0x1 addbyte gBattlerTarget, 0x1
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_TeeterDanceLoop jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_TeeterDanceLoop
@ -3140,10 +3128,8 @@ BattleScript_DoSwitchOut::
switchinanim BS_ATTACKER, FALSE switchinanim BS_ATTACKER, FALSE
waitstate waitstate
switchineffects BS_ATTACKER switchineffects BS_ATTACKER
setbyte sMOVEEND_STATE, 0x4 moveendcase ATK49_STATUS_IMMUNITY_ABILITIES
moveend 0x1, 0x0 moveendcase ATK49_MIRROR_MOVE
setbyte sMOVEEND_STATE, 0xF
moveend 0x1, 0x0
end2 end2
BattleScript_PursuitDmgOnSwitchOut:: BattleScript_PursuitDmgOnSwitchOut::
@ -3166,8 +3152,7 @@ BattleScript_PursuitDmgOnSwitchOut::
resultmessage resultmessage
waitmessage 0x40 waitmessage 0x40
tryfaintmon BS_TARGET, FALSE, NULL tryfaintmon BS_TARGET, FALSE, NULL
setbyte sMOVEEND_STATE, 0x3 moveendfromto ATK49_MOVE_END_ABILITIES, ATK49_CHOICE_MOVE
moveend 0x2, 0x6
various4 BS_TARGET various4 BS_TARGET
jumpifbyte CMP_EQUAL, gBattleCommunication, 0x0, BattleScript_PursuitDmgOnSwitchOutRet jumpifbyte CMP_EQUAL, gBattleCommunication, 0x0, BattleScript_PursuitDmgOnSwitchOutRet
setbyte sGIVEEXP_STATE, 0x0 setbyte sGIVEEXP_STATE, 0x0
@ -3395,8 +3380,7 @@ BattleScript_DisabledNoMore::
BattleScript_SelectingDisabledMoveInPalace:: BattleScript_SelectingDisabledMoveInPalace::
printstring STRINGID_PKMNMOVEISDISABLED printstring STRINGID_PKMNMOVEISDISABLED
BattleScript_SelectingUnusableMoveInPalace:: BattleScript_SelectingUnusableMoveInPalace::
setbyte sMOVEEND_STATE, 0x0 moveendto ATK49_NEXT_TARGET
moveend 0x2, 0x10
end end
BattleScript_EncoredNoMore:: BattleScript_EncoredNoMore::
@ -3425,8 +3409,7 @@ BattleScript_SpikesOnAttacker::
BattleScript_SpikesOnAttackerFainted:: BattleScript_SpikesOnAttackerFainted::
setbyte sGIVEEXP_STATE, 0x0 setbyte sGIVEEXP_STATE, 0x0
getexp BS_ATTACKER getexp BS_ATTACKER
setbyte sMOVEEND_STATE, 0x0 moveendall
moveend 0x0, 0x0
goto BattleScript_HandleFaintedMon goto BattleScript_HandleFaintedMon
BattleScript_SpikesOnTarget:: BattleScript_SpikesOnTarget::
@ -3441,8 +3424,7 @@ BattleScript_SpikesOnTarget::
BattleScript_SpikesOnTargetFainted:: BattleScript_SpikesOnTargetFainted::
setbyte sGIVEEXP_STATE, 0x0 setbyte sGIVEEXP_STATE, 0x0
getexp BS_TARGET getexp BS_TARGET
setbyte sMOVEEND_STATE, 0x0 moveendall
moveend 0x0, 0x0
goto BattleScript_HandleFaintedMon goto BattleScript_HandleFaintedMon
BattleScript_SpikesOnFaintedBattler:: BattleScript_SpikesOnFaintedBattler::
@ -3457,8 +3439,7 @@ BattleScript_SpikesOnFaintedBattler::
BattleScript_SpikesOnFaintedBattlerFainted:: BattleScript_SpikesOnFaintedBattlerFainted::
setbyte sGIVEEXP_STATE, 0x0 setbyte sGIVEEXP_STATE, 0x0
getexp BS_FAINTED getexp BS_FAINTED
setbyte sMOVEEND_STATE, 0x0 moveendall
moveend 0x0, 0x0
goto BattleScript_HandleFaintedMon goto BattleScript_HandleFaintedMon
BattleScript_PrintHurtBySpikes:: BattleScript_PrintHurtBySpikes::
@ -3562,10 +3543,8 @@ BattleScript_DoFutureAttackHit::
tryfaintmon BS_TARGET, FALSE, NULL tryfaintmon BS_TARGET, FALSE, NULL
atk24 BattleScript_FutureAttackEnd atk24 BattleScript_FutureAttackEnd
BattleScript_FutureAttackEnd:: BattleScript_FutureAttackEnd::
setbyte sMOVEEND_STATE, 0x0 moveendcase ATK49_RAGE
moveend 0x1, 0x0 moveendfromto ATK49_ITEM_EFFECTS_ALL, ATK49_UPDATE_LAST_MOVES
setbyte sMOVEEND_STATE, 0xB
moveend 0x2, 0xE
setbyte gMoveResultFlags, 0 setbyte gMoveResultFlags, 0
end2 end2
@ -4254,8 +4233,7 @@ BattleScript_AbilityCuredStatus::
BattleScript_IgnoresWhileAsleep:: BattleScript_IgnoresWhileAsleep::
printstring STRINGID_PKMNIGNORESASLEEP printstring STRINGID_PKMNIGNORESASLEEP
waitmessage 0x40 waitmessage 0x40
setbyte sMOVEEND_STATE, 0x0 moveendto ATK49_NEXT_TARGET
moveend 0x2, 0x10
end end
BattleScript_IgnoresAndUsesRandomMove:: BattleScript_IgnoresAndUsesRandomMove::
@ -4271,8 +4249,7 @@ BattleScript_MoveUsedLoafingAround::
BattleScript_82DB6C7:: BattleScript_82DB6C7::
printfromtable gInobedientStringIds printfromtable gInobedientStringIds
waitmessage 0x40 waitmessage 0x40
setbyte sMOVEEND_STATE, 0x0 moveendto ATK49_NEXT_TARGET
moveend 0x2, 0x10
end end
BattleScript_IgnoresAndFallsAsleep:: BattleScript_IgnoresAndFallsAsleep::
@ -4280,8 +4257,7 @@ BattleScript_IgnoresAndFallsAsleep::
waitmessage 0x40 waitmessage 0x40
setmoveeffect MOVE_EFFECT_SLEEP | MOVE_EFFECT_AFFECTS_USER setmoveeffect MOVE_EFFECT_SLEEP | MOVE_EFFECT_AFFECTS_USER
seteffectprimary seteffectprimary
setbyte sMOVEEND_STATE, 0x0 moveendto ATK49_NEXT_TARGET
moveend 0x2, 0x10
end end
BattleScript_IgnoresAndHitsItself:: BattleScript_IgnoresAndHitsItself::

View File

@ -95,8 +95,6 @@
// statchange defines // statchange defines
#define STAT_CHANGE_BS_PTR 0x1 #define STAT_CHANGE_BS_PTR 0x1
#define STAT_CHANGE_NOT_PROTECT_AFFECTED 0x20 #define STAT_CHANGE_NOT_PROTECT_AFFECTED 0x20
#define STAT_CHANGE_WORKED 0
#define STAT_CHANGE_DIDNT_WORK 1
// atk48 // atk48
#define ATK48_STAT_NEGATIVE 0x1 #define ATK48_STAT_NEGATIVE 0x1
@ -104,6 +102,26 @@
#define ATK48_ONLY_MULTIPLE 0x4 #define ATK48_ONLY_MULTIPLE 0x4
#define ATK48_DONT_CHECK_LOWER 0x8 #define ATK48_DONT_CHECK_LOWER 0x8
// atk49, moveend cases
#define ATK49_RAGE 0
#define ATK49_DEFROST 1
#define ATK49_SYNCHRONIZE_TARGET 2
#define ATK49_MOVE_END_ABILITIES 3
#define ATK49_STATUS_IMMUNITY_ABILITIES 4
#define ATK49_SYNCHRONIZE_ATTACKER 5
#define ATK49_CHOICE_MOVE 6
#define ATK49_CHANGED_ITEMS 7
#define ATK49_ATTACKER_INVISIBLE 8
#define ATK49_ATTACKER_VISIBLE 9
#define ATK49_TARGET_VISIBLE 10
#define ATK49_ITEM_EFFECTS_ALL 11
#define ATK49_KINGSROCK_SHELLBELL 12
#define ATK49_SUBSTITUTE 13
#define ATK49_UPDATE_LAST_MOVES 14
#define ATK49_MIRROR_MOVE 15
#define ATK49_NEXT_TARGET 16
#define ATK49_COUNT 17
#define BIT_HP 0x1 #define BIT_HP 0x1
#define BIT_ATK 0x2 #define BIT_ATK 0x2
#define BIT_DEF 0x4 #define BIT_DEF 0x4

View File

@ -4480,28 +4480,6 @@ static void atk48_playstatchangeanimation(void)
} }
} }
enum
{
ATK49_RAGE,
ATK49_DEFROST,
ATK49_SYNCHRONIZE_TARGET,
ATK49_MOVE_END_ABILITIES,
ATK49_STATUS_IMMUNITY_ABILITIES,
ATK49_SYNCHRONIZE_ATTACKER,
ATK49_CHOICE_MOVE,
ATK49_CHANGED_ITEMS,
ATK49_ATTACKER_INVISIBLE,
ATK49_ATTACKER_VISIBLE,
ATK49_TARGET_VISIBLE,
ATK49_ITEM_EFFECTS_ALL,
ATK49_KINGSROCK_SHELLBELL,
ATK49_SUBSTITUTE,
ATK49_UPDATE_LAST_MOVES,
ATK49_MIRROR_MOVE,
ATK49_NEXT_TARGET,
ATK49_COUNT,
};
static void atk49_moveend(void) static void atk49_moveend(void)
{ {
s32 i; s32 i;
@ -7210,6 +7188,9 @@ static void atk88_negativedamage(void)
gBattlescriptCurrInstr++; gBattlescriptCurrInstr++;
} }
#define STAT_CHANGE_WORKED 0
#define STAT_CHANGE_DIDNT_WORK 1
static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr) static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
{ {
bool8 certain = FALSE; bool8 certain = FALSE;