Merge pull request #1719 from AsparagusEduardo/pret_cleanBattleScriptCommands

Further cleaning after comparing with pokefirered
This commit is contained in:
GriffinR 2022-07-30 09:09:23 -04:00 committed by GitHub
commit 5101811407
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
149 changed files with 1372 additions and 1362 deletions

View File

@ -490,7 +490,7 @@ BattleScript_EffectStatUp::
BattleScript_EffectStatUpAfterAtkCanceler::
attackstring
ppreduce
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_StatUpEnd
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_StatUpEnd
jumpifbyte CMP_NOT_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_StatUpAttackAnim
pause B_WAIT_TIME_SHORT
goto BattleScript_StatUpPrintString
@ -536,7 +536,7 @@ BattleScript_EffectStatDown::
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_StatDownEnd
statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_StatDownEnd
jumpifbyte CMP_LESS_THAN, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_DECREASE, BattleScript_StatDownDoAnim
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_FELL_EMPTY, BattleScript_StatDownEnd
pause B_WAIT_TIME_SHORT
@ -1492,17 +1492,17 @@ BattleScript_CurseTrySpeed::
attackanimation
waitanimation
setstatchanger STAT_SPEED, 1, TRUE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_CurseTryAttack
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_CurseTryAttack
printfromtable gStatDownStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_CurseTryAttack::
setstatchanger STAT_ATK, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_CurseTryDefense
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_CurseTryDefense
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_CurseTryDefense::
setstatchanger STAT_DEF, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_CurseEnd
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_CurseEnd
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_CurseEnd::
@ -1614,7 +1614,7 @@ BattleScript_EffectSwagger::
attackanimation
waitanimation
setstatchanger STAT_ATK, 2, FALSE
statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_SwaggerTryConfuse
statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_SwaggerTryConfuse
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_SwaggerTryConfuse
setgraphicalstatchangevalues
playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
@ -1813,7 +1813,7 @@ BattleScript_EffectSkullBash::
setbyte sTWOTURN_STRINGID, B_MSG_TURN1_SKULL_BASH
call BattleScriptFirstChargingTurn
setstatchanger STAT_DEF, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_SkullBashEnd
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_SkullBashEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_SkullBashEnd
setgraphicalstatchangevalues
playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
@ -2016,7 +2016,7 @@ BattleScript_EffectDefenseCurl::
ppreduce
setdefensecurlbit
setstatchanger STAT_DEF, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_DefenseCurlDoStatUpAnim
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_DefenseCurlDoStatUpAnim
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_StatUpPrintString
attackanimation
waitanimation
@ -2157,7 +2157,7 @@ BattleScript_EffectFlatter::
attackanimation
waitanimation
setstatchanger STAT_SPATK, 1, FALSE
statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_FlatterTryConfuse
statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_FlatterTryConfuse
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_FlatterTryConfuse
setgraphicalstatchangevalues
playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
@ -2214,7 +2214,7 @@ BattleScript_EffectMemento::
playstatchangeanimation BS_TARGET, BIT_ATK | BIT_SPATK, STAT_CHANGE_NEGATIVE | STAT_CHANGE_BY_TWO | STAT_CHANGE_MULTIPLE_STATS
playstatchangeanimation BS_TARGET, BIT_ATK, STAT_CHANGE_NEGATIVE | STAT_CHANGE_BY_TWO
setstatchanger STAT_ATK, 2, TRUE
statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_EffectMementoTrySpAtk
statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_EffectMementoTrySpAtk
@ 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
printfromtable gStatDownStringIds
@ -2222,7 +2222,7 @@ BattleScript_EffectMemento::
BattleScript_EffectMementoTrySpAtk:
playstatchangeanimation BS_TARGET, BIT_SPATK, STAT_CHANGE_NEGATIVE | STAT_CHANGE_BY_TWO
setstatchanger STAT_SPATK, 2, TRUE
statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_EffectMementoTryFaint
statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_EffectMementoTryFaint
@ 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
printfromtable gStatDownStringIds
@ -2662,14 +2662,14 @@ BattleScript_TickleDoMoveAnim::
playstatchangeanimation BS_TARGET, BIT_ATK | BIT_DEF, STAT_CHANGE_NEGATIVE | STAT_CHANGE_MULTIPLE_STATS
playstatchangeanimation BS_TARGET, BIT_ATK, STAT_CHANGE_NEGATIVE
setstatchanger STAT_ATK, 1, TRUE
statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_TickleTryLowerDef
statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_TickleTryLowerDef
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_DECREASE, BattleScript_TickleTryLowerDef
printfromtable gStatDownStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_TickleTryLowerDef::
playstatchangeanimation BS_TARGET, BIT_DEF, STAT_CHANGE_NEGATIVE
setstatchanger STAT_DEF, 1, TRUE
statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_TickleEnd
statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_TickleEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_DECREASE, BattleScript_TickleEnd
printfromtable gStatDownStringIds
waitmessage B_WAIT_TIME_LONG
@ -2695,13 +2695,13 @@ BattleScript_CosmicPowerDoMoveAnim::
setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_SPDEF, 0
setstatchanger STAT_DEF, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_CosmicPowerTrySpDef
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_CosmicPowerTrySpDef
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_CosmicPowerTrySpDef
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_CosmicPowerTrySpDef::
setstatchanger STAT_SPDEF, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_CosmicPowerEnd
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_CosmicPowerEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_CosmicPowerEnd
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
@ -2724,13 +2724,13 @@ BattleScript_BulkUpDoMoveAnim::
setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_DEF, 0
setstatchanger STAT_ATK, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_BulkUpTryDef
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_BulkUpTryDef
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_BulkUpTryDef
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_BulkUpTryDef::
setstatchanger STAT_DEF, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_BulkUpEnd
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_BulkUpEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_BulkUpEnd
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
@ -2749,13 +2749,13 @@ BattleScript_CalmMindDoMoveAnim::
setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_SPATK | BIT_SPDEF, 0
setstatchanger STAT_SPATK, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_CalmMindTrySpDef
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_CalmMindTrySpDef
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_CalmMindTrySpDef
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_CalmMindTrySpDef::
setstatchanger STAT_SPDEF, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_CalmMindEnd
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_CalmMindEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_CalmMindEnd
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
@ -2781,13 +2781,13 @@ BattleScript_DragonDanceDoMoveAnim::
setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_SPEED, 0
setstatchanger STAT_ATK, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_DragonDanceTrySpeed
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_DragonDanceTrySpeed
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_DragonDanceTrySpeed
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_DragonDanceTrySpeed::
setstatchanger STAT_SPEED, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_DragonDanceEnd
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_DragonDanceEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_DragonDanceEnd
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
@ -3458,27 +3458,27 @@ BattleScript_AllStatsUpAtk::
setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_DEF | BIT_SPEED | BIT_SPATK | BIT_SPDEF, 0
setstatchanger STAT_ATK, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_AllStatsUpDef
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_AllStatsUpDef
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_AllStatsUpDef::
setstatchanger STAT_DEF, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_AllStatsUpSpeed
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_AllStatsUpSpeed
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_AllStatsUpSpeed::
setstatchanger STAT_SPEED, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_AllStatsUpSpAtk
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_AllStatsUpSpAtk
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_AllStatsUpSpAtk::
setstatchanger STAT_SPATK, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_AllStatsUpSpDef
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_AllStatsUpSpDef
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_AllStatsUpSpDef::
setstatchanger STAT_SPDEF, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_AllStatsUpRet
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_AllStatsUpRet
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_AllStatsUpRet::
@ -3625,14 +3625,14 @@ BattleScript_AtkDefDown::
playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_ATK, STAT_CHANGE_CANT_PREVENT | STAT_CHANGE_NEGATIVE | STAT_CHANGE_MULTIPLE_STATS
playstatchangeanimation BS_ATTACKER, BIT_ATK, STAT_CHANGE_CANT_PREVENT | STAT_CHANGE_NEGATIVE
setstatchanger STAT_ATK, 1, TRUE
statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_BUFF_ALLOW_PTR, BattleScript_AtkDefDown_TryDef
statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_CHANGE_ALLOW_PTR, BattleScript_AtkDefDown_TryDef
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_DECREASE, BattleScript_AtkDefDown_TryDef
printfromtable gStatDownStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_AtkDefDown_TryDef::
playstatchangeanimation BS_ATTACKER, BIT_DEF, STAT_CHANGE_CANT_PREVENT | STAT_CHANGE_NEGATIVE
setstatchanger STAT_DEF, 1, TRUE
statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_BUFF_ALLOW_PTR, BattleScript_AtkDefDown_End
statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_CHANGE_ALLOW_PTR, BattleScript_AtkDefDown_End
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_DECREASE, BattleScript_AtkDefDown_End
printfromtable gStatDownStringIds
waitmessage B_WAIT_TIME_LONG
@ -3698,7 +3698,7 @@ BattleScript_SAtkDown2::
setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_SPATK, STAT_CHANGE_CANT_PREVENT | STAT_CHANGE_NEGATIVE | STAT_CHANGE_BY_TWO
setstatchanger STAT_SPATK, 2, TRUE
statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_BUFF_ALLOW_PTR, BattleScript_SAtkDown2End
statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_CHANGE_ALLOW_PTR, BattleScript_SAtkDown2End
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_DECREASE, BattleScript_SAtkDown2End
printfromtable gStatDownStringIds
waitmessage B_WAIT_TIME_LONG
@ -4029,7 +4029,7 @@ BattleScript_IntimidateActivatesLoop:
jumpifability BS_TARGET, ABILITY_CLEAR_BODY, BattleScript_IntimidatePrevented
jumpifability BS_TARGET, ABILITY_HYPER_CUTTER, BattleScript_IntimidatePrevented
jumpifability BS_TARGET, ABILITY_WHITE_SMOKE, BattleScript_IntimidatePrevented
statbuffchange STAT_BUFF_NOT_PROTECT_AFFECTED | STAT_BUFF_ALLOW_PTR, BattleScript_IntimidateActivatesLoopIncrement
statbuffchange STAT_CHANGE_NOT_PROTECT_AFFECTED | STAT_CHANGE_ALLOW_PTR, BattleScript_IntimidateActivatesLoopIncrement
jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, 1, BattleScript_IntimidateActivatesLoopIncrement
setgraphicalstatchangevalues
playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
@ -4408,7 +4408,7 @@ BattleScript_BerryConfuseHealEnd2::
BattleScript_BerryStatRaiseEnd2::
playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_BerryStatRaiseDoStatUp
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_BerryStatRaiseDoStatUp
BattleScript_BerryStatRaiseDoStatUp::
setbyte cMULTISTRING_CHOOSER, B_MSG_STAT_ROSE_ITEM
call BattleScript_StatUp

View File

@ -92,7 +92,7 @@ enum {
LINK_STANDBY_MSG_ONLY,
};
#define INSTANT_HP_BAR_DROP 32767
#define INSTANT_HP_BAR_DROP 0x7FFF
#define PARTY_SUMM_SKIP_DRAW_DELAY (1 << 7)

View File

@ -53,17 +53,17 @@
#define BATTLE_TYPE_MULTI (1 << 6)
#define BATTLE_TYPE_SAFARI (1 << 7)
#define BATTLE_TYPE_BATTLE_TOWER (1 << 8)
#define BATTLE_TYPE_WALLY_TUTORIAL (1 << 9)
#define BATTLE_TYPE_WALLY_TUTORIAL (1 << 9) // Used in pokefirered as BATTLE_TYPE_OLD_MAN_TUTORIAL.
#define BATTLE_TYPE_ROAMER (1 << 10)
#define BATTLE_TYPE_EREADER_TRAINER (1 << 11)
#define BATTLE_TYPE_KYOGRE_GROUDON (1 << 12)
#define BATTLE_TYPE_LEGENDARY (1 << 13)
#define BATTLE_TYPE_REGI (1 << 14)
#define BATTLE_TYPE_TWO_OPPONENTS (1 << 15)
#define BATTLE_TYPE_DOME (1 << 16)
#define BATTLE_TYPE_PALACE (1 << 17)
#define BATTLE_TYPE_ARENA (1 << 18)
#define BATTLE_TYPE_FACTORY (1 << 19)
#define BATTLE_TYPE_TWO_OPPONENTS (1 << 15) // Used in pokefirered as BATTLE_TYPE_GHOST.
#define BATTLE_TYPE_DOME (1 << 16) // Used in pokefirered as BATTLE_TYPE_POKEDUDE.
#define BATTLE_TYPE_PALACE (1 << 17) // Used in pokefirered as BATTLE_TYPE_WILD_SCRIPTED.
#define BATTLE_TYPE_ARENA (1 << 18) // Used in pokefirered as BATTLE_TYPE_LEGENDARY_FRLG.
#define BATTLE_TYPE_FACTORY (1 << 19) // Used in pokefirered as BATTLE_TYPE_TRAINER_TOWER.
#define BATTLE_TYPE_PIKE (1 << 20)
#define BATTLE_TYPE_PYRAMID (1 << 21)
#define BATTLE_TYPE_INGAME_PARTNER (1 << 22)

View File

@ -53,15 +53,15 @@
#define BS_EFFECT_BATTLER 2
#define BS_FAINTED 3
#define BS_ATTACKER_WITH_PARTNER 4 // for Cmd_updatestatusicon
#define BS_FAINTED_LINK_MULTIPLE_1 5
#define BS_FAINTED_LINK_MULTIPLE_2 6
#define BS_FAINTED_LINK_MULTIPLE_1 5 // for openpartyscreen
#define BS_FAINTED_LINK_MULTIPLE_2 6 // for openpartyscreen
#define BS_BATTLER_0 7
#define BS_ATTACKER_SIDE 8 // for Cmd_jumpifability
#define BS_NOT_ATTACKER_SIDE 9 // for Cmd_jumpifability
#define BS_SCRIPTING 10
#define BS_PLAYER1 11
#define BS_OPPONENT1 12
#define BS_PLAYER2 13
#define BS_PLAYER2 13 // for Cmd_updatestatusicon
#define BS_OPPONENT2 14
// Cmd_accuracycheck
@ -115,8 +115,8 @@
#define SWITCH_IGNORE_ESCAPE_PREVENTION (1 << 7)
// Cmd_statbuffchange
#define STAT_BUFF_ALLOW_PTR (1 << 0) // If set, allow use of jumpptr. Set in every use of statbuffchange
#define STAT_BUFF_NOT_PROTECT_AFFECTED (1 << 5)
#define STAT_CHANGE_ALLOW_PTR (1 << 0) // If set, allow use of jumpptr. Set in every use of statbuffchange
#define STAT_CHANGE_NOT_PROTECT_AFFECTED (1 << 5)
// stat change flags for Cmd_playstatchangeanimation
#define STAT_CHANGE_NEGATIVE (1 << 0)

View File

@ -12,7 +12,6 @@ void StopMapMusic(void);
void FadeOutMapMusic(u8 speed);
void FadeOutAndPlayNewMapMusic(u16 songNum, u8 speed);
void FadeOutAndFadeInNewMapMusic(u16 songNum, u8 fadeOutSpeed, u8 fadeInSpeed);
void FadeInNewMapMusic(u16 songNum, u8 speed);
bool8 IsNotWaitingForBGMStop(void);
void PlayFanfareByFanfareNum(u8 fanfareNum);
bool8 WaitFanfare(bool8 stop);

View File

@ -17,7 +17,7 @@ int GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData player, struct Rf
int CanSpinTradeMon(struct Pokemon *, u16);
void InitTradeSequenceBgGpuRegs(void);
void LinkTradeDrawWindow(void);
void InitTradeBg(void);
void LoadTradeAnimGfx(void);
void DrawTextOnTradeWindow(u8, const u8 *, u8);
#endif //GUARD_TRADE_H

View File

@ -719,7 +719,7 @@ void BattleArena_AddSkillPoints(u8 battler)
}
else if (gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
{
if (!(gMoveResultFlags & MOVE_RESULT_MISSED) || gBattleCommunication[6] != 1)
if (!(gMoveResultFlags & MOVE_RESULT_MISSED) || gBattleCommunication[MISS_TYPE] != B_MSG_PROTECTED)
skillPoints[battler] -= 2;
}
else if ((gMoveResultFlags & MOVE_RESULT_SUPER_EFFECTIVE) && (gMoveResultFlags & MOVE_RESULT_NOT_VERY_EFFECTIVE))

View File

@ -3275,25 +3275,25 @@ void FaintClearSetData(void)
for (i = 0; i < sizeof(struct DisableStruct); i++)
ptr[i] = 0;
gProtectStructs[gActiveBattler].protected = 0;
gProtectStructs[gActiveBattler].endured = 0;
gProtectStructs[gActiveBattler].noValidMoves = 0;
gProtectStructs[gActiveBattler].helpingHand = 0;
gProtectStructs[gActiveBattler].bounceMove = 0;
gProtectStructs[gActiveBattler].stealMove = 0;
gProtectStructs[gActiveBattler].flag0Unknown = 0;
gProtectStructs[gActiveBattler].prlzImmobility = 0;
gProtectStructs[gActiveBattler].confusionSelfDmg = 0;
gProtectStructs[gActiveBattler].targetNotAffected = 0;
gProtectStructs[gActiveBattler].chargingTurn = 0;
gProtectStructs[gActiveBattler].protected = FALSE;
gProtectStructs[gActiveBattler].endured = FALSE;
gProtectStructs[gActiveBattler].noValidMoves = FALSE;
gProtectStructs[gActiveBattler].helpingHand = FALSE;
gProtectStructs[gActiveBattler].bounceMove = FALSE;
gProtectStructs[gActiveBattler].stealMove = FALSE;
gProtectStructs[gActiveBattler].flag0Unknown = FALSE;
gProtectStructs[gActiveBattler].prlzImmobility = FALSE;
gProtectStructs[gActiveBattler].confusionSelfDmg = FALSE;
gProtectStructs[gActiveBattler].targetNotAffected = FALSE;
gProtectStructs[gActiveBattler].chargingTurn = FALSE;
gProtectStructs[gActiveBattler].fleeType = 0;
gProtectStructs[gActiveBattler].usedImprisonedMove = 0;
gProtectStructs[gActiveBattler].loveImmobility = 0;
gProtectStructs[gActiveBattler].usedDisabledMove = 0;
gProtectStructs[gActiveBattler].usedTauntedMove = 0;
gProtectStructs[gActiveBattler].flag2Unknown = 0;
gProtectStructs[gActiveBattler].flinchImmobility = 0;
gProtectStructs[gActiveBattler].notFirstStrike = 0;
gProtectStructs[gActiveBattler].usedImprisonedMove = FALSE;
gProtectStructs[gActiveBattler].loveImmobility = FALSE;
gProtectStructs[gActiveBattler].usedDisabledMove = FALSE;
gProtectStructs[gActiveBattler].usedTauntedMove = FALSE;
gProtectStructs[gActiveBattler].flag2Unknown = FALSE;
gProtectStructs[gActiveBattler].flinchImmobility = FALSE;
gProtectStructs[gActiveBattler].notFirstStrike = FALSE;
gDisableStructs[gActiveBattler].isFirstTurn = 2;

View File

@ -667,7 +667,8 @@ static const u8* const sMoveEffectBS_Ptrs[] =
[MOVE_EFFECT_RECOIL_33] = BattleScript_MoveEffectRecoil,
};
static const struct WindowTemplate sUnusedWinTemplate = {
static const struct WindowTemplate sUnusedWinTemplate =
{
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 3,
@ -961,7 +962,7 @@ static void Cmd_attackcanceler(void)
if (gProtectStructs[gBattlerTarget].bounceMove && gBattleMoves[gCurrentMove].flags & FLAG_MAGIC_COAT_AFFECTED)
{
PressurePPLose(gBattlerAttacker, gBattlerTarget, MOVE_MAGIC_COAT);
gProtectStructs[gBattlerTarget].bounceMove = 0;
gProtectStructs[gBattlerTarget].bounceMove = FALSE;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_MagicCoatBounce;
return;
@ -972,7 +973,7 @@ static void Cmd_attackcanceler(void)
if ((gProtectStructs[gBattlerByTurnOrder[i]].stealMove) && gBattleMoves[gCurrentMove].flags & FLAG_SNATCH_AFFECTED)
{
PressurePPLose(gBattlerAttacker, gBattlerByTurnOrder[i], MOVE_SNATCH);
gProtectStructs[gBattlerByTurnOrder[i]].stealMove = 0;
gProtectStructs[gBattlerByTurnOrder[i]].stealMove = FALSE;
gBattleScripting.battler = gBattlerByTurnOrder[i];
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_SnatchedMove;
@ -982,7 +983,7 @@ static void Cmd_attackcanceler(void)
if (gSpecialStatuses[gBattlerTarget].lightningRodRedirected)
{
gSpecialStatuses[gBattlerTarget].lightningRodRedirected = 0;
gSpecialStatuses[gBattlerTarget].lightningRodRedirected = FALSE;
gLastUsedAbility = ABILITY_LIGHTNING_ROD;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_TookAttack;
@ -1175,8 +1176,8 @@ static void Cmd_accuracycheck(void)
if ((Random() % 100 + 1) > calc)
{
gMoveResultFlags |= MOVE_RESULT_MISSED;
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE &&
(gBattleMoves[move].target == MOVE_TARGET_BOTH || gBattleMoves[move].target == MOVE_TARGET_FOES_AND_ALLY))
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE
&& (gBattleMoves[move].target == MOVE_TARGET_BOTH || gBattleMoves[move].target == MOVE_TARGET_FOES_AND_ALLY))
gBattleCommunication[MISS_TYPE] = B_MSG_AVOIDED_ATK;
else
gBattleCommunication[MISS_TYPE] = B_MSG_MISSED;
@ -1191,6 +1192,7 @@ static void Cmd_attackstring(void)
{
if (gBattleControllerExecFlags)
return;
if (!(gHitMarker & (HITMARKER_NO_ATTACKSTRING | HITMARKER_ATTACKSTRING_PRINTED)))
{
PrepareStringBattle(STRINGID_USEDMOVE, gBattlerAttacker);
@ -1496,7 +1498,8 @@ static void CheckWonderGuardAndLevitate(void)
}
}
static void ModulateDmgByType2(u8 multiplier, u16 move, u8* flags) // same as ModulateDmgByType except different arguments
// Same as ModulateDmgByType except different arguments
static void ModulateDmgByType2(u8 multiplier, u16 move, u8 *flags)
{
gBattleMoveDamage = gBattleMoveDamage * multiplier / 10;
if (gBattleMoveDamage == 0 && multiplier != 0)
@ -1694,7 +1697,8 @@ static void Cmd_adjustnormaldamage(void)
gBattlescriptCurrInstr++;
}
static void Cmd_adjustnormaldamage2(void) // The same as adjustnormaldamage except it doesn't check for false swipe move effect.
// The same as adjustnormaldamage except it doesn't check for false swipe move effect.
static void Cmd_adjustnormaldamage2(void)
{
u8 holdEffect, param;
@ -1777,8 +1781,8 @@ static void Cmd_attackanimation(void)
multihit = gMultiHitCounter;
BtlController_EmitMoveAnimation(BUFFER_A, gCurrentMove, gBattleScripting.animTurn, gBattleMovePower, gBattleMoveDamage, gBattleMons[gBattlerAttacker].friendship, &gDisableStructs[gBattlerAttacker], multihit);
gBattleScripting.animTurn += 1;
gBattleScripting.animTargetsHit += 1;
gBattleScripting.animTurn++;
gBattleScripting.animTargetsHit++;
MarkBattlerForControllerExec(gBattlerAttacker);
gBattlescriptCurrInstr++;
}
@ -2537,7 +2541,6 @@ void SetMoveEffect(bool8 primary, u8 certain)
case MOVE_EFFECT_UPROAR:
if (!(gBattleMons[gEffectBattler].status2 & STATUS2_UPROAR))
{
gBattleMons[gEffectBattler].status2 |= STATUS2_MULTIPLETURNS;
gLockedMoves[gEffectBattler] = gCurrentMove;
gBattleMons[gEffectBattler].status2 |= STATUS2_UPROAR_TURN((Random() & 3) + 2); // 2-5 turns
@ -2754,7 +2757,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
{
u16 *changedItem = &gBattleStruct->changedItems[gBattlerAttacker];
gLastUsedItem = *changedItem = gBattleMons[gBattlerTarget].item;
gBattleMons[gBattlerTarget].item = 0;
gBattleMons[gBattlerTarget].item = ITEM_NONE;
gActiveBattler = gBattlerAttacker;
BtlController_EmitSetMonData(BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gLastUsedItem), &gLastUsedItem);
@ -2770,7 +2773,6 @@ void SetMoveEffect(bool8 primary, u8 certain)
*(u8 *)((u8 *)(&gBattleStruct->choicedMove[gBattlerTarget]) + 0) = 0;
*(u8 *)((u8 *)(&gBattleStruct->choicedMove[gBattlerTarget]) + 1) = 0;
}
}
break;
case MOVE_EFFECT_PREVENT_ESCAPE:
@ -2834,7 +2836,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
case MOVE_EFFECT_KNOCK_OFF:
if (gBattleMons[gEffectBattler].ability == ABILITY_STICKY_HOLD)
{
if (gBattleMons[gEffectBattler].item == 0)
if (gBattleMons[gEffectBattler].item == ITEM_NONE)
{
gBattlescriptCurrInstr++;
}
@ -2851,7 +2853,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
side = GetBattlerSide(gEffectBattler);
gLastUsedItem = gBattleMons[gEffectBattler].item;
gBattleMons[gEffectBattler].item = 0;
gBattleMons[gEffectBattler].item = ITEM_NONE;
gWishFutureKnock.knockedOffMons[side] |= gBitTable[gBattlerPartyIndexes[gEffectBattler]];
BattleScriptPush(gBattlescriptCurrInstr + 1);
@ -3055,7 +3057,7 @@ static void Cmd_jumpifstatus(void)
u32 flags = T2_READ_32(gBattlescriptCurrInstr + 2);
const u8 *jumpPtr = T2_READ_PTR(gBattlescriptCurrInstr + 6);
if (gBattleMons[battlerId].status1 & flags && gBattleMons[battlerId].hp)
if (gBattleMons[battlerId].status1 & flags && gBattleMons[battlerId].hp != 0)
gBattlescriptCurrInstr = jumpPtr;
else
gBattlescriptCurrInstr += 10;
@ -3067,7 +3069,7 @@ static void Cmd_jumpifstatus2(void)
u32 flags = T2_READ_32(gBattlescriptCurrInstr + 2);
const u8 *jumpPtr = T2_READ_PTR(gBattlescriptCurrInstr + 6);
if (gBattleMons[battlerId].status2 & flags && gBattleMons[battlerId].hp)
if (gBattleMons[battlerId].status2 & flags && gBattleMons[battlerId].hp != 0)
gBattlescriptCurrInstr = jumpPtr;
else
gBattlescriptCurrInstr += 10;
@ -3322,7 +3324,7 @@ static void Cmd_getexp(void)
else
{
// music change in wild battle after fainting a poke
if (!(gBattleTypeFlags & BATTLE_TYPE_TRAINER) && gBattleMons[0].hp && !gBattleStruct->wildVictorySong)
if (!(gBattleTypeFlags & BATTLE_TYPE_TRAINER) && gBattleMons[0].hp != 0 && !gBattleStruct->wildVictorySong)
{
BattleStopLowHpSound();
PlayBGM(MUS_VICTORY_WILD);
@ -3488,8 +3490,8 @@ static void Cmd_getexp(void)
if (gBattleControllerExecFlags == 0)
{
// not sure why gf clears the item and ability here
gBattleMons[gBattlerFainted].item = 0;
gBattleMons[gBattlerFainted].ability = 0;
gBattleMons[gBattlerFainted].item = ITEM_NONE;
gBattleMons[gBattlerFainted].ability = ABILITY_NONE;
gBattlescriptCurrInstr += 2;
}
break;
@ -3931,7 +3933,8 @@ static void Cmd_end2(void)
gCurrentActionFuncId = B_ACTION_TRY_FINISH;
}
static void Cmd_end3(void) // pops the main function stack
// Pops the main function stack
static void Cmd_end3(void)
{
BattleScriptPop();
if (gBattleResources->battleCallbackStack->size != 0)
@ -4244,7 +4247,7 @@ static void Cmd_moveend(void)
effect = TRUE;
gBattleScripting.moveendState++;
break;
case MOVEEND_ON_DAMAGE_ABILITIES: // Contact abilities and Color Change
case MOVEEND_ON_DAMAGE_ABILITIES: // Such as abilities activating on contact (Effect Spore, Rough Skin, etc.).
if (AbilityBattleEffects(ABILITYEFFECT_ON_DAMAGE, gBattlerTarget, 0, 0, 0))
effect = TRUE;
gBattleScripting.moveendState++;
@ -4268,19 +4271,19 @@ static void Cmd_moveend(void)
{
if (gChosenMove == MOVE_BATON_PASS && !(gMoveResultFlags & MOVE_RESULT_FAILED))
{
++gBattleScripting.moveendState;
gBattleScripting.moveendState++;
break;
}
*choicedMoveAtk = gChosenMove;
}
for (i = 0; i < MAX_MON_MOVES; ++i)
for (i = 0; i < MAX_MON_MOVES; i++)
{
if (gBattleMons[gBattlerAttacker].moves[i] == *choicedMoveAtk)
break;
}
if (i == MAX_MON_MOVES)
*choicedMoveAtk = MOVE_NONE;
++gBattleScripting.moveendState;
gBattleScripting.moveendState++;
break;
case MOVEEND_CHANGED_ITEMS: // changed held items
for (i = 0; i < gBattlersCount; i++)
@ -4609,7 +4612,7 @@ static void Cmd_switchindataupdate(void)
i = GetBattlerSide(gActiveBattler);
if (gWishFutureKnock.knockedOffMons[i] & gBitTable[gBattlerPartyIndexes[gActiveBattler]])
{
gBattleMons[gActiveBattler].item = 0;
gBattleMons[gActiveBattler].item = ITEM_NONE;
}
if (gBattleMoves[gCurrentMove].effect == EFFECT_BATON_PASS)
@ -5251,7 +5254,7 @@ static void Cmd_switchineffects(void)
u32 hitmarkerFaintBits = gHitMarker >> 28;
gBattlerFainted++;
while (1)
while (TRUE)
{
if (hitmarkerFaintBits & gBitTable[gBattlerFainted] && !(gAbsentBattlerFlags & gBitTable[gBattlerFainted]))
break;
@ -5824,7 +5827,8 @@ static void Cmd_cancelallactions(void)
gBattlescriptCurrInstr++;
}
static void Cmd_adjustsetdamage(void) // The same as adjustnormaldamage, except there's no random damage multiplier.
// The same as adjustnormaldamage, except there's no random damage multiplier.
static void Cmd_adjustsetdamage(void)
{
u8 holdEffect, param;
@ -5872,7 +5876,7 @@ static void Cmd_removeitem(void)
usedHeldItem = &gBattleStruct->usedHeldItems[gActiveBattler];
*usedHeldItem = gBattleMons[gActiveBattler].item;
gBattleMons[gActiveBattler].item = 0;
gBattleMons[gActiveBattler].item = ITEM_NONE;
BtlController_EmitSetMonData(BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gActiveBattler].item), &gBattleMons[gActiveBattler].item);
MarkBattlerForControllerExec(gActiveBattler);
@ -6223,19 +6227,19 @@ static void Cmd_jumpifplayerran(void)
static void Cmd_hpthresholds(void)
{
u8 opposingBank;
u8 opposingBattler;
s32 result;
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
{
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
opposingBank = gActiveBattler ^ BIT_SIDE;
opposingBattler = gActiveBattler ^ BIT_SIDE;
result = gBattleMons[opposingBank].hp * 100 / gBattleMons[opposingBank].maxHP;
result = gBattleMons[opposingBattler].hp * 100 / gBattleMons[opposingBattler].maxHP;
if (result == 0)
result = 1;
if (result > 69 || !gBattleMons[opposingBank].hp)
if (result > 69 || gBattleMons[opposingBattler].hp == 0)
gBattleStruct->hpScale = 0;
else if (result > 39)
gBattleStruct->hpScale = 1;
@ -6250,18 +6254,18 @@ static void Cmd_hpthresholds(void)
static void Cmd_hpthresholds2(void)
{
u8 opposingBank;
u8 opposingBattler;
s32 result;
u8 hpSwitchout;
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
{
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
opposingBank = gActiveBattler ^ BIT_SIDE;
hpSwitchout = *(gBattleStruct->hpOnSwitchout + GetBattlerSide(opposingBank));
result = (hpSwitchout - gBattleMons[opposingBank].hp) * 100 / hpSwitchout;
opposingBattler = gActiveBattler ^ BIT_SIDE;
hpSwitchout = *(gBattleStruct->hpOnSwitchout + GetBattlerSide(opposingBattler));
result = (hpSwitchout - gBattleMons[opposingBattler].hp) * 100 / hpSwitchout;
if (gBattleMons[opposingBank].hp >= hpSwitchout)
if (gBattleMons[opposingBattler].hp >= hpSwitchout)
gBattleStruct->hpScale = 0;
else if (result <= 29)
gBattleStruct->hpScale = 1;
@ -6278,7 +6282,7 @@ static void Cmd_useitemonopponent(void)
{
gBattlerInMenuId = gBattlerAttacker;
PokemonUseItemEffects(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker]], gLastUsedItem, gBattlerPartyIndexes[gBattlerAttacker], 0, TRUE);
gBattlescriptCurrInstr += 1;
gBattlescriptCurrInstr++;
}
static void Cmd_various(void)
@ -6335,7 +6339,7 @@ static void Cmd_various(void)
break;
}
if (i == MAX_MON_MOVES)
*choicedMove = 0;
*choicedMove = MOVE_NONE;
}
break;
case VARIOUS_RESET_PLAYER_FAINTED:
@ -6462,7 +6466,8 @@ static void Cmd_various(void)
gBattlescriptCurrInstr += 3;
}
static void Cmd_setprotectlike(void) // protect and endure
// Protect and Endure
static void Cmd_setprotectlike(void)
{
bool8 notLastTurn = TRUE;
u16 lastMove = gLastResultingMoves[gBattlerAttacker];
@ -6606,8 +6611,7 @@ static void Cmd_trymirrormove(void)
{
if (i != gBattlerAttacker)
{
move = *(i * 2 + gBattlerAttacker * 8 + (u8*)(gBattleStruct->lastTakenMoveFrom) + 0)
| (*(i * 2 + gBattlerAttacker * 8 + (u8*)(gBattleStruct->lastTakenMoveFrom) + 1) << 8);
move = T1_READ_16(i * 2 + gBattlerAttacker * 8 + gBattleStruct->lastTakenMoveFrom);
if (move != MOVE_NONE && move != MOVE_UNAVAILABLE)
{
@ -6617,8 +6621,7 @@ static void Cmd_trymirrormove(void)
}
}
move = *(gBattleStruct->lastTakenMove + gBattlerAttacker * 2 + 0)
| (*(gBattleStruct->lastTakenMove + gBattlerAttacker * 2 + 1) << 8);
move = T1_READ_16(gBattleStruct->lastTakenMove + gBattlerAttacker * 2);
if (move != MOVE_NONE && move != MOVE_UNAVAILABLE)
{
@ -6895,8 +6898,8 @@ static void Cmd_negativedamage(void)
gBattlescriptCurrInstr++;
}
#define STAT_BUFF_WORKED 0
#define STAT_BUFF_DIDNT_WORK 1
#define STAT_CHANGE_WORKED 0
#define STAT_CHANGE_DIDNT_WORK 1
static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
{
@ -6915,9 +6918,9 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
certain++;
flags &= ~MOVE_EFFECT_CERTAIN;
if (flags & STAT_BUFF_NOT_PROTECT_AFFECTED)
if (flags & STAT_CHANGE_NOT_PROTECT_AFFECTED)
notProtectAffected++;
flags &= ~STAT_BUFF_NOT_PROTECT_AFFECTED;
flags &= ~STAT_CHANGE_NOT_PROTECT_AFFECTED;
PREPARE_STAT_BUFFER(gBattleTextBuff1, statId)
@ -6926,7 +6929,7 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
if (gSideTimers[GET_BATTLER_SIDE(gActiveBattler)].mistTimer
&& !certain && gCurrentMove != MOVE_CURSE)
{
if (flags == STAT_BUFF_ALLOW_PTR)
if (flags == STAT_CHANGE_ALLOW_PTR)
{
if (gSpecialStatuses[gActiveBattler].statLowered)
{
@ -6940,19 +6943,19 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
gSpecialStatuses[gActiveBattler].statLowered = 1;
}
}
return STAT_BUFF_DIDNT_WORK;
return STAT_CHANGE_DIDNT_WORK;
}
else if (gCurrentMove != MOVE_CURSE
&& notProtectAffected != TRUE && JumpIfMoveAffectedByProtect(0))
{
gBattlescriptCurrInstr = BattleScript_ButItFailed;
return STAT_BUFF_DIDNT_WORK;
return STAT_CHANGE_DIDNT_WORK;
}
else if ((gBattleMons[gActiveBattler].ability == ABILITY_CLEAR_BODY
|| gBattleMons[gActiveBattler].ability == ABILITY_WHITE_SMOKE)
&& !certain && gCurrentMove != MOVE_CURSE)
{
if (flags == STAT_BUFF_ALLOW_PTR)
if (flags == STAT_CHANGE_ALLOW_PTR)
{
if (gSpecialStatuses[gActiveBattler].statLowered)
{
@ -6968,12 +6971,12 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
gSpecialStatuses[gActiveBattler].statLowered = 1;
}
}
return STAT_BUFF_DIDNT_WORK;
return STAT_CHANGE_DIDNT_WORK;
}
else if (gBattleMons[gActiveBattler].ability == ABILITY_KEEN_EYE
&& !certain && statId == STAT_ACC)
{
if (flags == STAT_BUFF_ALLOW_PTR)
if (flags == STAT_CHANGE_ALLOW_PTR)
{
BattleScriptPush(BS_ptr);
gBattleScripting.battler = gActiveBattler;
@ -6981,12 +6984,12 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
gLastUsedAbility = gBattleMons[gActiveBattler].ability;
RecordAbilityBattle(gActiveBattler, gLastUsedAbility);
}
return STAT_BUFF_DIDNT_WORK;
return STAT_CHANGE_DIDNT_WORK;
}
else if (gBattleMons[gActiveBattler].ability == ABILITY_HYPER_CUTTER
&& !certain && statId == STAT_ATK)
{
if (flags == STAT_BUFF_ALLOW_PTR)
if (flags == STAT_CHANGE_ALLOW_PTR)
{
BattleScriptPush(BS_ptr);
gBattleScripting.battler = gActiveBattler;
@ -6994,11 +6997,11 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
gLastUsedAbility = gBattleMons[gActiveBattler].ability;
RecordAbilityBattle(gActiveBattler, gLastUsedAbility);
}
return STAT_BUFF_DIDNT_WORK;
return STAT_CHANGE_DIDNT_WORK;
}
else if (gBattleMons[gActiveBattler].ability == ABILITY_SHIELD_DUST && flags == 0)
{
return STAT_BUFF_DIDNT_WORK;
return STAT_CHANGE_DIDNT_WORK;
}
else // try to decrease
{
@ -7012,19 +7015,15 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
gBattleTextBuff2[3] = STRINGID_STATHARSHLY >> 8;
index = 4;
}
gBattleTextBuff2[index] = B_BUFF_STRING;
index++;
gBattleTextBuff2[index] = STRINGID_STATFELL;
index++;
gBattleTextBuff2[index] = STRINGID_STATFELL >> 8;
index++;
gBattleTextBuff2[index++] = B_BUFF_STRING;
gBattleTextBuff2[index++] = STRINGID_STATFELL;
gBattleTextBuff2[index++] = STRINGID_STATFELL >> 8;
gBattleTextBuff2[index] = B_BUFF_EOS;
if (gBattleMons[gActiveBattler].statStages[statId] == MIN_STAT_STAGE)
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STAT_WONT_DECREASE;
else
gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler); // B_MSG_ATTACKER_STAT_FELL or B_MSG_DEFENDER_STAT_FELL
}
}
else // stat increase
@ -7039,12 +7038,9 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
gBattleTextBuff2[3] = STRINGID_STATSHARPLY >> 8;
index = 4;
}
gBattleTextBuff2[index] = B_BUFF_STRING;
index++;
gBattleTextBuff2[index] = STRINGID_STATROSE;
index++;
gBattleTextBuff2[index] = STRINGID_STATROSE >> 8;
index++;
gBattleTextBuff2[index++] = B_BUFF_STRING;
gBattleTextBuff2[index++] = STRINGID_STATROSE;
gBattleTextBuff2[index++] = STRINGID_STATROSE >> 8;
gBattleTextBuff2[index] = B_BUFF_EOS;
if (gBattleMons[gActiveBattler].statStages[statId] == MAX_STAT_STAGE)
@ -7059,23 +7055,24 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
if (gBattleMons[gActiveBattler].statStages[statId] > MAX_STAT_STAGE)
gBattleMons[gActiveBattler].statStages[statId] = MAX_STAT_STAGE;
if (gBattleCommunication[MULTISTRING_CHOOSER] == B_MSG_STAT_WONT_INCREASE && flags & STAT_BUFF_ALLOW_PTR)
if (gBattleCommunication[MULTISTRING_CHOOSER] == B_MSG_STAT_WONT_INCREASE && flags & STAT_CHANGE_ALLOW_PTR)
gMoveResultFlags |= MOVE_RESULT_MISSED;
if (gBattleCommunication[MULTISTRING_CHOOSER] == B_MSG_STAT_WONT_INCREASE && !(flags & STAT_BUFF_ALLOW_PTR))
return STAT_BUFF_DIDNT_WORK;
if (gBattleCommunication[MULTISTRING_CHOOSER] == B_MSG_STAT_WONT_INCREASE && !(flags & STAT_CHANGE_ALLOW_PTR))
return STAT_CHANGE_DIDNT_WORK;
return STAT_BUFF_WORKED;
return STAT_CHANGE_WORKED;
}
static void Cmd_statbuffchange(void)
{
const u8 *jumpPtr = T1_READ_PTR(gBattlescriptCurrInstr + 2);
if (ChangeStatBuffs(gBattleScripting.statChanger & 0xF0, GET_STAT_BUFF_ID(gBattleScripting.statChanger), gBattlescriptCurrInstr[1], jumpPtr) == STAT_BUFF_WORKED)
if (ChangeStatBuffs(gBattleScripting.statChanger & 0xF0, GET_STAT_BUFF_ID(gBattleScripting.statChanger), gBattlescriptCurrInstr[1], jumpPtr) == STAT_CHANGE_WORKED)
gBattlescriptCurrInstr += 6;
}
static void Cmd_normalisebuffs(void) // haze
// Haze
static void Cmd_normalisebuffs(void)
{
s32 i, j;
@ -7178,15 +7175,15 @@ static void Cmd_forcerandomswitch(void)
{
if ((gBattlerTarget & BIT_FLANK) != B_FLANK_LEFT)
{
firstMonId = 3;
lastMonId = 6;
firstMonId = PARTY_SIZE / 2;
lastMonId = PARTY_SIZE;
}
else
{
firstMonId = 0;
lastMonId = 3;
lastMonId = PARTY_SIZE / 2;
}
monsCount = 3;
monsCount = PARTY_SIZE / 2;
minNeeded = 1;
battler2PartyId = gBattlerPartyIndexes[gBattlerTarget];
battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK];
@ -7196,15 +7193,15 @@ static void Cmd_forcerandomswitch(void)
{
if (GetLinkTrainerFlankId(GetBattlerMultiplayerId(gBattlerTarget)) == B_FLANK_RIGHT)
{
firstMonId = 3;
lastMonId = 6;
firstMonId = PARTY_SIZE / 2;
lastMonId = PARTY_SIZE;
}
else
{
firstMonId = 0;
lastMonId = 3;
lastMonId = PARTY_SIZE / 2;
}
monsCount = 3;
monsCount = PARTY_SIZE / 2;
minNeeded = 1;
battler2PartyId = gBattlerPartyIndexes[gBattlerTarget];
battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK];
@ -7214,23 +7211,23 @@ static void Cmd_forcerandomswitch(void)
if (GetBattlerSide(gBattlerTarget) == B_SIDE_PLAYER)
{
firstMonId = 0;
lastMonId = 6;
monsCount = 6;
lastMonId = PARTY_SIZE;
monsCount = PARTY_SIZE;
minNeeded = 2; // since there are two opponents, it has to be a double battle
}
else
{
if ((gBattlerTarget & BIT_FLANK) != B_FLANK_LEFT)
{
firstMonId = 3;
lastMonId = 6;
firstMonId = PARTY_SIZE / 2;
lastMonId = PARTY_SIZE;
}
else
{
firstMonId = 0;
lastMonId = 3;
lastMonId = PARTY_SIZE / 2;
}
monsCount = 3;
monsCount = PARTY_SIZE / 2;
minNeeded = 1;
}
battler2PartyId = gBattlerPartyIndexes[gBattlerTarget];
@ -7239,8 +7236,8 @@ static void Cmd_forcerandomswitch(void)
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
firstMonId = 0;
lastMonId = 6;
monsCount = 6;
lastMonId = PARTY_SIZE;
monsCount = PARTY_SIZE;
minNeeded = 2;
battler2PartyId = gBattlerPartyIndexes[gBattlerTarget];
battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK];
@ -7248,8 +7245,8 @@ static void Cmd_forcerandomswitch(void)
else
{
firstMonId = 0;
lastMonId = 6;
monsCount = 6;
lastMonId = PARTY_SIZE;
monsCount = PARTY_SIZE;
minNeeded = 1;
battler2PartyId = gBattlerPartyIndexes[gBattlerTarget]; // there is only one pokemon out in single battles
battler1PartyId = gBattlerPartyIndexes[gBattlerTarget];
@ -7309,7 +7306,8 @@ static void Cmd_forcerandomswitch(void)
}
}
static void Cmd_tryconversiontypechange(void) // randomly changes user's type to one of its moves' type
// Randomly changes user's type to one of its moves' type
static void Cmd_tryconversiontypechange(void)
{
u8 validMoves = 0;
u8 moveChecked;
@ -7349,7 +7347,6 @@ static void Cmd_tryconversiontypechange(void) // randomly changes user's type to
{
do
{
while ((moveChecked = Random() & (MAX_MON_MOVES - 1)) >= validMoves);
moveType = gBattleMoves[gBattleMons[gBattlerAttacker].moves[moveChecked]].type;
@ -7497,7 +7494,8 @@ static void Cmd_tryKO(void)
}
}
static void Cmd_damagetohalftargethp(void) // super fang
// Super Fang
static void Cmd_damagetohalftargethp(void)
{
gBattleMoveDamage = gBattleMons[gBattlerTarget].hp / 2;
if (gBattleMoveDamage == 0)
@ -7793,7 +7791,6 @@ static void Cmd_mimicattackcopy(void)
else
gBattleMons[gBattlerAttacker].pp[gCurrMovePos] = 5;
PREPARE_MOVE_BUFFER(gBattleTextBuff1, gLastMoves[gBattlerTarget])
gDisableStructs[gBattlerAttacker].mimickedMoves |= gBitTable[gCurrMovePos];
@ -7808,7 +7805,7 @@ static void Cmd_mimicattackcopy(void)
static void Cmd_metronome(void)
{
while (1)
while (TRUE)
{
s32 i;
@ -7819,7 +7816,7 @@ static void Cmd_metronome(void)
for (i = 0; i < MAX_MON_MOVES; i++); // ?
i = -1;
while (1)
while (TRUE)
{
i++;
if (sMovesForbiddenToCopy[i] == gCurrentMove)
@ -7880,7 +7877,8 @@ static void Cmd_counterdamagecalculator(void)
}
}
static void Cmd_mirrorcoatdamagecalculator(void) // a copy of Cmd with the physical -> special field changes
// A copy of Cmd with the physical -> special field changes
static void Cmd_mirrorcoatdamagecalculator(void)
{
u8 sideAttacker = GetBattlerSide(gBattlerAttacker);
u8 sideTarget = GetBattlerSide(gProtectStructs[gBattlerAttacker].specialBattlerId);
@ -7984,7 +7982,8 @@ static void Cmd_painsplitdmgcalc(void)
}
}
static void Cmd_settypetorandomresistance(void) // conversion 2
// Conversion 2
static void Cmd_settypetorandomresistance(void)
{
if (gLastLandedMoves[gBattlerAttacker] == MOVE_NONE
|| gLastLandedMoves[gBattlerAttacker] == MOVE_UNAVAILABLE)
@ -8052,7 +8051,8 @@ static void Cmd_setalwayshitflag(void)
gBattlescriptCurrInstr++;
}
static void Cmd_copymovepermanently(void) // sketch
// Sketch
static void Cmd_copymovepermanently(void)
{
gChosenMove = MOVE_UNAVAILABLE;
@ -8164,7 +8164,6 @@ static void Cmd_trychoosesleeptalkmove(void)
{
unusableMovesBits |= gBitTable[i];
}
}
unusableMovesBits = CheckMoveLimitations(gBattlerAttacker, unusableMovesBits, ~MOVE_LIMITATION_PP);
@ -8609,7 +8608,6 @@ static void Cmd_magnitudedamagecalculation(void)
magnitude = 10;
}
PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff1, 2, magnitude)
for (gBattlerTarget = 0; gBattlerTarget < gBattlersCount; gBattlerTarget++)
@ -8684,7 +8682,8 @@ static void Cmd_setsunny(void)
gBattlescriptCurrInstr++;
}
static void Cmd_maxattackhalvehp(void) // belly drum
// Belly Drum
static void Cmd_maxattackhalvehp(void)
{
u32 halfHp = gBattleMons[gBattlerAttacker].maxHP / 2;
@ -8707,7 +8706,8 @@ static void Cmd_maxattackhalvehp(void) // belly drum
}
}
static void Cmd_copyfoestats(void) // psych up
// Psych Up
static void Cmd_copyfoestats(void)
{
s32 i;
@ -8985,7 +8985,8 @@ static void Cmd_trymemento(void)
}
}
static void Cmd_setforcedtarget(void) // follow me
// Follow Me
static void Cmd_setforcedtarget(void)
{
gSideTimers[GetBattlerSide(gBattlerAttacker)].followmeTimer = 1;
gSideTimers[GetBattlerSide(gBattlerAttacker)].followmeTarget = gBattlerAttacker;
@ -9000,7 +9001,8 @@ static void Cmd_setcharge(void)
gBattlescriptCurrInstr++;
}
static void Cmd_callterrainattack(void) // nature power
// Nature Power
static void Cmd_callterrainattack(void)
{
gHitMarker &= ~HITMARKER_ATTACKSTRING_PRINTED;
gCurrentMove = sNaturePowerMoves[gBattleTerrain];
@ -9009,7 +9011,8 @@ static void Cmd_callterrainattack(void) // nature power
gBattlescriptCurrInstr++;
}
static void Cmd_cureifburnedparalysedorpoisoned(void) // refresh
// Refresh
static void Cmd_cureifburnedparalysedorpoisoned(void)
{
if (gBattleMons[gBattlerAttacker].status1 & (STATUS1_POISON | STATUS1_BURN | STATUS1_PARALYSIS | STATUS1_TOXIC_POISON))
{
@ -9078,7 +9081,8 @@ static void Cmd_trysethelpinghand(void)
}
}
static void Cmd_tryswapitems(void) // trick
// Trick
static void Cmd_tryswapitems(void)
{
// opponent can't swap items with player in regular battles
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL
@ -9165,7 +9169,8 @@ static void Cmd_tryswapitems(void) // trick
}
}
static void Cmd_trycopyability(void) // role play
// Role Play
static void Cmd_trycopyability(void)
{
if (gBattleMons[gBattlerTarget].ability != ABILITY_NONE
&& gBattleMons[gBattlerTarget].ability != ABILITY_WONDER_GUARD)
@ -9213,7 +9218,8 @@ static void Cmd_trywish(void)
}
}
static void Cmd_trysetroots(void) // ingrain
// Ingrain
static void Cmd_trysetroots(void)
{
if (gStatuses3[gBattlerAttacker] & STATUS3_ROOTED)
{
@ -9228,9 +9234,9 @@ static void Cmd_trysetroots(void) // ingrain
static void Cmd_doubledamagedealtifdamaged(void)
{
if ((gProtectStructs[gBattlerAttacker].physicalDmg
if ((gProtectStructs[gBattlerAttacker].physicalDmg != 0
&& gProtectStructs[gBattlerAttacker].physicalBattlerId == gBattlerTarget)
|| (gProtectStructs[gBattlerAttacker].specialDmg
|| (gProtectStructs[gBattlerAttacker].specialDmg != 0
&& gProtectStructs[gBattlerAttacker].specialBattlerId == gBattlerTarget))
{
gBattleScripting.dmgMultiplier = 2;
@ -9278,7 +9284,8 @@ static void Cmd_scaledamagebyhealthratio(void)
gBattlescriptCurrInstr++;
}
static void Cmd_tryswapabilities(void) // skill swap
// Skill Swap
static void Cmd_tryswapabilities(void)
{
if ((gBattleMons[gBattlerAttacker].ability == ABILITY_NONE
&& gBattleMons[gBattlerTarget].ability == ABILITY_NONE)
@ -9433,12 +9440,13 @@ static void Cmd_trysetmagiccoat(void)
}
else
{
gProtectStructs[gBattlerAttacker].bounceMove = 1;
gProtectStructs[gBattlerAttacker].bounceMove = TRUE;
gBattlescriptCurrInstr += 5;
}
}
static void Cmd_trysetsnatch(void) // snatch
// Snatch
static void Cmd_trysetsnatch(void)
{
gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = 1;
if (gCurrentTurnActionNumber == gBattlersCount - 1) // moves last turn
@ -9642,7 +9650,8 @@ static void Cmd_trycastformdatachange(void)
}
}
static void Cmd_settypebasedhalvers(void) // water and mud sport
// Water and Mud Sport
static void Cmd_settypebasedhalvers(void)
{
bool8 worked = FALSE;
@ -9655,7 +9664,7 @@ static void Cmd_settypebasedhalvers(void) // water and mud sport
worked = TRUE;
}
}
else // water sport
else // Water Sport
{
if (!(gStatuses3[gBattlerAttacker] & STATUS3_WATERSPORT))
{
@ -9766,7 +9775,8 @@ static void Cmd_snatchsetbattlers(void)
gBattlescriptCurrInstr++;
}
static void Cmd_removelightscreenreflect(void) // brick break
// Brick Break
static void Cmd_removelightscreenreflect(void)
{
u8 opposingSide = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;

View File

@ -93,7 +93,7 @@ void HandleAction_UseMove(void)
gBattleStruct->atkCancellerTracker = 0;
gMoveResultFlags = 0;
gMultiHitCounter = 0;
gBattleCommunication[6] = 0;
gBattleCommunication[MISS_TYPE] = 0;
gCurrMovePos = gChosenMovePos = *(gBattleStruct->chosenMovePositions + gBattlerAttacker);
// choose move

View File

@ -410,7 +410,7 @@ static void CB2_TradeEvolutionSceneLoadGraphics(void)
gMain.state++;
break;
case 2:
InitTradeBg();
LoadTradeAnimGfx();
gMain.state++;
break;
case 3:

View File

@ -156,7 +156,8 @@ void FadeOutAndFadeInNewMapMusic(u16 songNum, u8 fadeOutSpeed, u8 fadeInSpeed)
sMapMusicFadeInSpeed = fadeInSpeed;
}
void FadeInNewMapMusic(u16 songNum, u8 speed)
// Unused
static void FadeInNewMapMusic(u16 songNum, u8 speed)
{
FadeInNewBGM(songNum, speed);
sCurrentMapMusic = songNum;

View File

@ -4821,7 +4821,7 @@ static void CheckPartnersMonForRibbons(void)
FlagSet(FLAG_SYS_RIBBON_GET);
}
void InitTradeBg(void)
void LoadTradeAnimGfx(void)
{
InitTradeBgInternal();
}