Rename faintifabilitynotdamp and jumpifattackandspecialattackcannotfall

This commit is contained in:
GriffinR 2022-07-06 14:38:27 -04:00
parent 06c9e0eb99
commit e6a374f2b6
3 changed files with 24 additions and 16 deletions

View File

@ -668,7 +668,7 @@
.byte 0x77 .byte 0x77
.endm .endm
.macro faintifabilitynotdamp .macro tryexplosion
.byte 0x78 .byte 0x78
.endm .endm
@ -1031,7 +1031,7 @@
.byte 0xc8 .byte 0xc8
.endm .endm
.macro jumpifattackandspecialattackcannotfall ptr:req .macro trymemento ptr:req
.byte 0xc9 .byte 0xc9
.4byte \ptr .4byte \ptr
.endm .endm

View File

@ -374,7 +374,8 @@ BattleScript_EffectExplosion::
attackcanceler attackcanceler
attackstring attackstring
ppreduce ppreduce
faintifabilitynotdamp @ Below jumps to BattleScript_DampStopsExplosion if it fails (only way it can)
tryexplosion
setatkhptozero setatkhptozero
waitstate waitstate
jumpifbyte CMP_NO_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_MISSED, BattleScript_ExplosionDoAnimStartLoop jumpifbyte CMP_NO_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_MISSED, BattleScript_ExplosionDoAnimStartLoop
@ -2201,10 +2202,10 @@ BattleScript_AlreadyBurned::
BattleScript_EffectMemento:: BattleScript_EffectMemento::
attackcanceler attackcanceler
jumpifbyte CMP_EQUAL, cMISS_TYPE, B_MSG_PROTECTED, BattleScript_MementoFailProtect jumpifbyte CMP_EQUAL, cMISS_TYPE, B_MSG_PROTECTED, BattleScript_MementoTargetProtect
attackstring attackstring
ppreduce ppreduce
jumpifattackandspecialattackcannotfall BattleScript_ButItFailed trymemento BattleScript_ButItFailed
setatkhptozero setatkhptozero
attackanimation attackanimation
waitanimation waitanimation
@ -2214,7 +2215,7 @@ BattleScript_EffectMemento::
playstatchangeanimation BS_TARGET, BIT_ATK, STAT_CHANGE_NEGATIVE | STAT_CHANGE_BY_TWO playstatchangeanimation BS_TARGET, BIT_ATK, STAT_CHANGE_NEGATIVE | STAT_CHANGE_BY_TWO
setstatchanger STAT_ATK, 2, TRUE setstatchanger STAT_ATK, 2, TRUE
statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_EffectMementoTrySpAtk statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_EffectMementoTrySpAtk
@ Greater than STAT_FELL is checking if the stat cannot decrease @ Greater than B_MSG_DEFENDER_STAT_FELL is checking if the stat cannot decrease
jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, B_MSG_DEFENDER_STAT_FELL, BattleScript_EffectMementoTrySpAtk jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, B_MSG_DEFENDER_STAT_FELL, BattleScript_EffectMementoTrySpAtk
printfromtable gStatDownStringIds printfromtable gStatDownStringIds
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
@ -2222,7 +2223,7 @@ BattleScript_EffectMementoTrySpAtk:
playstatchangeanimation BS_TARGET, BIT_SPATK, STAT_CHANGE_NEGATIVE | STAT_CHANGE_BY_TWO playstatchangeanimation BS_TARGET, BIT_SPATK, STAT_CHANGE_NEGATIVE | STAT_CHANGE_BY_TWO
setstatchanger STAT_SPATK, 2, TRUE setstatchanger STAT_SPATK, 2, TRUE
statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_EffectMementoTryFaint statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_EffectMementoTryFaint
@ Greater than STAT_FELL is checking if the stat cannot decrease @ Greater than B_MSG_DEFENDER_STAT_FELL is checking if the stat cannot decrease
jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, B_MSG_DEFENDER_STAT_FELL, BattleScript_EffectMementoTryFaint jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, B_MSG_DEFENDER_STAT_FELL, BattleScript_EffectMementoTryFaint
printfromtable gStatDownStringIds printfromtable gStatDownStringIds
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
@ -2233,11 +2234,12 @@ BattleScript_EffectMementoPrintNoEffect:
printstring STRINGID_BUTNOEFFECT printstring STRINGID_BUTNOEFFECT
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
goto BattleScript_EffectMementoTryFaint goto BattleScript_EffectMementoTryFaint
BattleScript_MementoFailProtect: @ If the target is protected there's no need to check the target's stats or animate, the user will just faint
BattleScript_MementoTargetProtect:
attackstring attackstring
ppreduce ppreduce
jumpifattackandspecialattackcannotfall BattleScript_MementoFailEnd trymemento BattleScript_MementoTargetProtectEnd
BattleScript_MementoFailEnd: BattleScript_MementoTargetProtectEnd:
setatkhptozero setatkhptozero
pause B_WAIT_TIME_LONG pause B_WAIT_TIME_LONG
effectivenesssound effectivenesssound

View File

@ -196,7 +196,7 @@ static void Cmd_hpthresholds2(void);
static void Cmd_useitemonopponent(void); static void Cmd_useitemonopponent(void);
static void Cmd_various(void); static void Cmd_various(void);
static void Cmd_setprotectlike(void); static void Cmd_setprotectlike(void);
static void Cmd_faintifabilitynotdamp(void); static void Cmd_tryexplosion(void);
static void Cmd_setatkhptozero(void); static void Cmd_setatkhptozero(void);
static void Cmd_jumpifnexttargetvalid(void); static void Cmd_jumpifnexttargetvalid(void);
static void Cmd_tryhealhalfhealth(void); static void Cmd_tryhealhalfhealth(void);
@ -277,7 +277,7 @@ static void Cmd_setsemiinvulnerablebit(void);
static void Cmd_clearsemiinvulnerablebit(void); static void Cmd_clearsemiinvulnerablebit(void);
static void Cmd_setminimize(void); static void Cmd_setminimize(void);
static void Cmd_sethail(void); static void Cmd_sethail(void);
static void Cmd_jumpifattackandspecialattackcannotfall(void); static void Cmd_trymemento(void);
static void Cmd_setforcedtarget(void); static void Cmd_setforcedtarget(void);
static void Cmd_setcharge(void); static void Cmd_setcharge(void);
static void Cmd_callterrainattack(void); static void Cmd_callterrainattack(void);
@ -448,7 +448,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
Cmd_useitemonopponent, //0x75 Cmd_useitemonopponent, //0x75
Cmd_various, //0x76 Cmd_various, //0x76
Cmd_setprotectlike, //0x77 Cmd_setprotectlike, //0x77
Cmd_faintifabilitynotdamp, //0x78 Cmd_tryexplosion, //0x78
Cmd_setatkhptozero, //0x79 Cmd_setatkhptozero, //0x79
Cmd_jumpifnexttargetvalid, //0x7A Cmd_jumpifnexttargetvalid, //0x7A
Cmd_tryhealhalfhealth, //0x7B Cmd_tryhealhalfhealth, //0x7B
@ -529,7 +529,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
Cmd_clearsemiinvulnerablebit, //0xC6 Cmd_clearsemiinvulnerablebit, //0xC6
Cmd_setminimize, //0xC7 Cmd_setminimize, //0xC7
Cmd_sethail, //0xC8 Cmd_sethail, //0xC8
Cmd_jumpifattackandspecialattackcannotfall, //0xC9 Cmd_trymemento, //0xC9
Cmd_setforcedtarget, //0xCA Cmd_setforcedtarget, //0xCA
Cmd_setcharge, //0xCB Cmd_setcharge, //0xCB
Cmd_callterrainattack, //0xCC Cmd_callterrainattack, //0xCC
@ -6489,11 +6489,12 @@ static void Cmd_setprotectlike(void) // protect and endure
gBattlescriptCurrInstr++; gBattlescriptCurrInstr++;
} }
static void Cmd_faintifabilitynotdamp(void) static void Cmd_tryexplosion(void)
{ {
if (gBattleControllerExecFlags) if (gBattleControllerExecFlags)
return; return;
// Explosion can only fail if any battler has Damp
for (gBattlerTarget = 0; gBattlerTarget < gBattlersCount; gBattlerTarget++) for (gBattlerTarget = 0; gBattlerTarget < gBattlersCount; gBattlerTarget++)
{ {
if (gBattleMons[gBattlerTarget].ability == ABILITY_DAMP) if (gBattleMons[gBattlerTarget].ability == ABILITY_DAMP)
@ -6502,12 +6503,14 @@ static void Cmd_faintifabilitynotdamp(void)
if (gBattlerTarget == gBattlersCount) if (gBattlerTarget == gBattlersCount)
{ {
// Success, no battlers with Damp. Drop user's HP bar to 0
gActiveBattler = gBattlerAttacker; gActiveBattler = gBattlerAttacker;
gBattleMoveDamage = gBattleMons[gActiveBattler].hp; gBattleMoveDamage = gBattleMons[gActiveBattler].hp;
BtlController_EmitHealthBarUpdate(BUFFER_A, INSTANT_HP_BAR_DROP); BtlController_EmitHealthBarUpdate(BUFFER_A, INSTANT_HP_BAR_DROP);
MarkBattlerForControllerExec(gActiveBattler); MarkBattlerForControllerExec(gActiveBattler);
gBattlescriptCurrInstr++; gBattlescriptCurrInstr++;
// Mark Explosion user as absent
for (gBattlerTarget = 0; gBattlerTarget < gBattlersCount; gBattlerTarget++) for (gBattlerTarget = 0; gBattlerTarget < gBattlersCount; gBattlerTarget++)
{ {
if (gBattlerTarget == gBattlerAttacker) if (gBattlerTarget == gBattlerAttacker)
@ -6518,6 +6521,7 @@ static void Cmd_faintifabilitynotdamp(void)
} }
else else
{ {
// Failed, a battler has Damp
gLastUsedAbility = ABILITY_DAMP; gLastUsedAbility = ABILITY_DAMP;
RecordAbilityBattle(gBattlerTarget, gBattleMons[gBattlerTarget].ability); RecordAbilityBattle(gBattlerTarget, gBattleMons[gBattlerTarget].ability);
gBattlescriptCurrInstr = BattleScript_DampStopsExplosion; gBattlescriptCurrInstr = BattleScript_DampStopsExplosion;
@ -8950,16 +8954,18 @@ static void Cmd_sethail(void)
gBattlescriptCurrInstr++; gBattlescriptCurrInstr++;
} }
static void Cmd_jumpifattackandspecialattackcannotfall(void) // memento static void Cmd_trymemento(void)
{ {
if (gBattleMons[gBattlerTarget].statStages[STAT_ATK] == MIN_STAT_STAGE if (gBattleMons[gBattlerTarget].statStages[STAT_ATK] == MIN_STAT_STAGE
&& gBattleMons[gBattlerTarget].statStages[STAT_SPATK] == MIN_STAT_STAGE && gBattleMons[gBattlerTarget].statStages[STAT_SPATK] == MIN_STAT_STAGE
&& gBattleCommunication[MISS_TYPE] != B_MSG_PROTECTED) && gBattleCommunication[MISS_TYPE] != B_MSG_PROTECTED)
{ {
// Failed, unprotected target already has minimum Attack and Special Attack.
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
} }
else else
{ {
// Success, drop user's HP bar to 0
gActiveBattler = gBattlerAttacker; gActiveBattler = gBattlerAttacker;
gBattleMoveDamage = gBattleMons[gActiveBattler].hp; gBattleMoveDamage = gBattleMons[gActiveBattler].hp;
BtlController_EmitHealthBarUpdate(BUFFER_A, INSTANT_HP_BAR_DROP); BtlController_EmitHealthBarUpdate(BUFFER_A, INSTANT_HP_BAR_DROP);