Rename atk## constants and states

This commit is contained in:
GriffinR 2019-08-23 08:46:21 -04:00 committed by GitHub
parent 2cb174b4ea
commit 869d0eebc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 157 additions and 157 deletions

View File

@ -366,7 +366,7 @@ BattleScript_EffectAbsorb::
setbyte cMULTISTRING_CHOOSER, 0x0
goto BattleScript_AbsorbUpdateHp
BattleScript_AbsorbLiquidOoze::
manipulatedamage ATK80_DMG_CHANGE_SIGN
manipulatedamage DMG_CHANGE_SIGN
setbyte cMULTISTRING_CHOOSER, 0x1
BattleScript_AbsorbUpdateHp::
healthbarupdate BS_ATTACKER
@ -422,7 +422,7 @@ BattleScript_ExplosionLoop:
resultmessage
waitmessage 0x40
tryfaintmon BS_TARGET, FALSE, NULL
moveendto ATK49_NEXT_TARGET
moveendto MOVEEND_NEXT_TARGET
jumpifnexttargetvalid BattleScript_ExplosionLoop
tryfaintmon BS_ATTACKER, FALSE, NULL
end
@ -430,7 +430,7 @@ BattleScript_ExplosionMissed:
effectivenesssound
resultmessage
waitmessage 0x40
moveendto ATK49_NEXT_TARGET
moveendto MOVEEND_NEXT_TARGET
jumpifnexttargetvalid BattleScript_ExplosionLoop
tryfaintmon BS_ATTACKER, FALSE, NULL
end
@ -654,7 +654,7 @@ BattleScript_DoMultiHit::
printstring STRINGID_EMPTYSTRING3
waitmessage 0x1
addbyte sMULTIHIT_STRING + 4, 0x1
moveendto ATK49_NEXT_TARGET
moveendto MOVEEND_NEXT_TARGET
jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_FOE_ENDURED, BattleScript_MultiHitPrintStrings
decrementmultihit BattleScript_MultiHitLoop
goto BattleScript_MultiHitPrintStrings
@ -670,8 +670,8 @@ BattleScript_MultiHitPrintStrings::
BattleScript_MultiHitEnd::
seteffectwithchance
tryfaintmon BS_TARGET, FALSE, NULL
moveendcase ATK49_SYNCHRONIZE_TARGET
moveendfrom ATK49_STATUS_IMMUNITY_ABILITIES
moveendcase MOVEEND_SYNCHRONIZE_TARGET
moveendfrom MOVEEND_STATUS_IMMUNITY_ABILITIES
end
BattleScript_EffectConversion::
@ -882,7 +882,7 @@ BattleScript_MoveMissedDoDamage::
damagecalc
typecalc
adjustnormaldamage
manipulatedamage ATK80_DMG_HALF_BY_TWO_NOT_MORE_THAN_HALF_MAX_HP
manipulatedamage DMG_HALF_BY_TWO_NOT_MORE_THAN_HALF_MAX_HP
bicbyte gMoveResultFlags, MOVE_RESULT_MISSED
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE
healthbarupdate BS_ATTACKER
@ -1435,7 +1435,7 @@ BattleScript_DoTripleKickAttack::
waitmessage 0x40
printstring STRINGID_EMPTYSTRING3
waitmessage 0x1
moveendto ATK49_NEXT_TARGET
moveendto MOVEEND_NEXT_TARGET
jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_FOE_ENDURED, BattleScript_TripleKickPrintStrings
decrementmultihit BattleScript_TripleKickLoop
goto BattleScript_TripleKickPrintStrings
@ -1454,7 +1454,7 @@ BattleScript_TripleKickPrintStrings::
BattleScript_TripleKickEnd::
seteffectwithchance
tryfaintmon BS_TARGET, FALSE, NULL
moveendfrom ATK49_UPDATE_LAST_MOVES
moveendfrom MOVEEND_UPDATE_LAST_MOVES
end
BattleScript_EffectThief::
@ -1716,7 +1716,7 @@ BattleScript_EffectBatonPass::
attackstring
ppreduce
jumpifbattletype BATTLE_TYPE_ARENA, BattleScript_ButItFailed
jumpifcantswitch ATK4F_DONT_CHECK_STATUSES | BS_ATTACKER, BattleScript_ButItFailed
jumpifcantswitch DONT_CHECK_STATUSES | BS_ATTACKER, BattleScript_ButItFailed
attackanimation
waitanimation
openpartyscreen 0x1, BattleScript_ButItFailed
@ -1885,7 +1885,7 @@ BattleScript_DoHitAllWithUndergroundBonus::
printstring STRINGID_EMPTYSTRING3
waitmessage 0x1
tryfaintmon BS_TARGET, FALSE, NULL
moveendto ATK49_NEXT_TARGET
moveendto MOVEEND_NEXT_TARGET
jumpifnexttargetvalid BattleScript_HitsAllWithUndergroundBonusLoop
end
BattleScript_HitAllWithUndergroundBonusMissed::
@ -1894,7 +1894,7 @@ BattleScript_HitAllWithUndergroundBonusMissed::
effectivenesssound
resultmessage
waitmessage 0x40
moveendto ATK49_NEXT_TARGET
moveendto MOVEEND_NEXT_TARGET
jumpifnexttargetvalid BattleScript_HitsAllWithUndergroundBonusLoop
end
@ -1970,7 +1970,7 @@ BattleScript_BeatUpLoop::
printstring STRINGID_PKMNATTACK
critcalc
jumpifbyte CMP_NOT_EQUAL, gCritMultiplier, 0x2, BattleScript_BeatUpAttack
manipulatedamage ATK80_DMG_DOUBLED
manipulatedamage DMG_DOUBLED
BattleScript_BeatUpAttack::
adjustnormaldamage
attackanimation
@ -1985,7 +1985,7 @@ BattleScript_BeatUpAttack::
resultmessage
waitmessage 0x40
tryfaintmon BS_TARGET, FALSE, NULL
moveendto ATK49_NEXT_TARGET
moveendto MOVEEND_NEXT_TARGET
goto BattleScript_BeatUpLoop
BattleScript_BeatUpEnd::
end
@ -2232,15 +2232,15 @@ BattleScript_EffectMemento::
waitanimation
jumpifstatus2 BS_TARGET, STATUS2_SUBSTITUTE, BattleScript_EffectMementoPrintNoEffect
setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_TARGET, BIT_ATK | BIT_SPATK, ATK48_STAT_NEGATIVE | ATK48_STAT_BY_TWO | ATK48_ONLY_MULTIPLE
playstatchangeanimation BS_TARGET, BIT_ATK, ATK48_STAT_NEGATIVE | ATK48_STAT_BY_TWO
playstatchangeanimation BS_TARGET, BIT_ATK | BIT_SPATK, STAT_CHANGE_NEGATIVE | STAT_CHANGE_BY_TWO | STAT_CHANGE_ONLY_MULTIPLE
playstatchangeanimation BS_TARGET, BIT_ATK, STAT_CHANGE_NEGATIVE | STAT_CHANGE_BY_TWO
setstatchanger STAT_ATK, 2, TRUE
statbuffchange STAT_CHANGE_BS_PTR, BattleScript_EffectMementoTrySpAtk
jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, 0x1, BattleScript_EffectMementoTrySpAtk
printfromtable gStatDownStringIds
waitmessage 0x40
BattleScript_EffectMementoTrySpAtk:
playstatchangeanimation BS_TARGET, BIT_SPATK, ATK48_STAT_NEGATIVE | ATK48_STAT_BY_TWO
playstatchangeanimation BS_TARGET, BIT_SPATK, STAT_CHANGE_NEGATIVE | STAT_CHANGE_BY_TWO
setstatchanger STAT_SPATK, 2, TRUE
statbuffchange STAT_CHANGE_BS_PTR, BattleScript_EffectMementoTryFaint
jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, 0x1, BattleScript_EffectMementoTryFaint
@ -2606,7 +2606,7 @@ BattleScript_TeeterDanceLoop::
resultmessage
waitmessage 0x40
BattleScript_TeeterDanceDoMoveEndIncrement::
moveendto ATK49_NEXT_TARGET
moveendto MOVEEND_NEXT_TARGET
BattleScript_TeeterDanceLoopIncrement::
addbyte gBattlerTarget, 0x1
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_TeeterDanceLoop
@ -2677,15 +2677,15 @@ BattleScript_TickleDoMoveAnim::
attackanimation
waitanimation
setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_TARGET, BIT_ATK | BIT_DEF, ATK48_STAT_NEGATIVE | ATK48_ONLY_MULTIPLE
playstatchangeanimation BS_TARGET, BIT_ATK, ATK48_STAT_NEGATIVE
playstatchangeanimation BS_TARGET, BIT_ATK | BIT_DEF, STAT_CHANGE_NEGATIVE | STAT_CHANGE_ONLY_MULTIPLE
playstatchangeanimation BS_TARGET, BIT_ATK, STAT_CHANGE_NEGATIVE
setstatchanger STAT_ATK, 1, TRUE
statbuffchange STAT_CHANGE_BS_PTR, BattleScript_TickleTryLowerDef
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_TickleTryLowerDef
printfromtable gStatDownStringIds
waitmessage 0x40
BattleScript_TickleTryLowerDef::
playstatchangeanimation BS_TARGET, BIT_DEF, ATK48_STAT_NEGATIVE
playstatchangeanimation BS_TARGET, BIT_DEF, STAT_CHANGE_NEGATIVE
setstatchanger STAT_DEF, 1, TRUE
statbuffchange STAT_CHANGE_BS_PTR, BattleScript_TickleEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_TickleEnd
@ -3128,8 +3128,8 @@ BattleScript_DoSwitchOut::
switchinanim BS_ATTACKER, FALSE
waitstate
switchineffects BS_ATTACKER
moveendcase ATK49_STATUS_IMMUNITY_ABILITIES
moveendcase ATK49_MIRROR_MOVE
moveendcase MOVEEND_STATUS_IMMUNITY_ABILITIES
moveendcase MOVEEND_MIRROR_MOVE
end2
BattleScript_PursuitDmgOnSwitchOut::
@ -3152,7 +3152,7 @@ BattleScript_PursuitDmgOnSwitchOut::
resultmessage
waitmessage 0x40
tryfaintmon BS_TARGET, FALSE, NULL
moveendfromto ATK49_MOVE_END_ABILITIES, ATK49_CHOICE_MOVE
moveendfromto MOVEEND_MOVE_END_ABILITIES, MOVEEND_CHOICE_MOVE
various4 BS_TARGET
jumpifbyte CMP_EQUAL, gBattleCommunication, 0x0, BattleScript_PursuitDmgOnSwitchOutRet
setbyte sGIVEEXP_STATE, 0x0
@ -3281,7 +3281,7 @@ BattleScript_LeechSeedTurnDrain::
datahpupdate BS_ATTACKER
copyword gBattleMoveDamage, gHpDealt
jumpifability BS_ATTACKER, ABILITY_LIQUID_OOZE, BattleScript_LeechSeedTurnPrintLiquidOoze
manipulatedamage ATK80_DMG_CHANGE_SIGN
manipulatedamage DMG_CHANGE_SIGN
setbyte cMULTISTRING_CHOOSER, 0x3
goto BattleScript_LeechSeedTurnPrintAndUpdateHp
BattleScript_LeechSeedTurnPrintLiquidOoze::
@ -3380,7 +3380,7 @@ BattleScript_DisabledNoMore::
BattleScript_SelectingDisabledMoveInPalace::
printstring STRINGID_PKMNMOVEISDISABLED
BattleScript_SelectingUnusableMoveInPalace::
moveendto ATK49_NEXT_TARGET
moveendto MOVEEND_NEXT_TARGET
end
BattleScript_EncoredNoMore::
@ -3543,8 +3543,8 @@ BattleScript_DoFutureAttackHit::
tryfaintmon BS_TARGET, FALSE, NULL
atk24 BattleScript_FutureAttackEnd
BattleScript_FutureAttackEnd::
moveendcase ATK49_RAGE
moveendfromto ATK49_ITEM_EFFECTS_ALL, ATK49_UPDATE_LAST_MOVES
moveendcase MOVEEND_RAGE
moveendfromto MOVEEND_ITEM_EFFECTS_ALL, MOVEEND_UPDATE_LAST_MOVES
setbyte gMoveResultFlags, 0
end2
@ -3635,15 +3635,15 @@ BattleScript_PrintMonIsRooted::
BattleScript_AtkDefDown::
setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_ATK, ATK48_DONT_CHECK_LOWER | ATK48_STAT_NEGATIVE | ATK48_ONLY_MULTIPLE
playstatchangeanimation BS_ATTACKER, BIT_ATK, ATK48_DONT_CHECK_LOWER | ATK48_STAT_NEGATIVE
playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_ATK, STAT_CHANGE_DONT_CHECK_LOWER | STAT_CHANGE_NEGATIVE | STAT_CHANGE_ONLY_MULTIPLE
playstatchangeanimation BS_ATTACKER, BIT_ATK, STAT_CHANGE_DONT_CHECK_LOWER | STAT_CHANGE_NEGATIVE
setstatchanger STAT_ATK, 1, TRUE
statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_CHANGE_BS_PTR, BattleScript_82DB144
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_82DB144
printfromtable gStatDownStringIds
waitmessage 0x40
BattleScript_82DB144::
playstatchangeanimation BS_ATTACKER, BIT_DEF, ATK48_DONT_CHECK_LOWER | ATK48_STAT_NEGATIVE
playstatchangeanimation BS_ATTACKER, BIT_DEF, STAT_CHANGE_DONT_CHECK_LOWER | STAT_CHANGE_NEGATIVE
setstatchanger STAT_DEF, 1, TRUE
statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_CHANGE_BS_PTR, BattleScript_82DB167
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_82DB167
@ -3709,7 +3709,7 @@ BattleScript_OneHitKOMsg::
BattleScript_SAtkDown2::
setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_SPATK, ATK48_DONT_CHECK_LOWER | ATK48_STAT_NEGATIVE | ATK48_STAT_BY_TWO
playstatchangeanimation BS_ATTACKER, BIT_SPATK, STAT_CHANGE_DONT_CHECK_LOWER | STAT_CHANGE_NEGATIVE | STAT_CHANGE_BY_TWO
setstatchanger STAT_SPATK, 2, TRUE
statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_CHANGE_BS_PTR, BattleScript_SAtkDown2End
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_SAtkDown2End
@ -4233,7 +4233,7 @@ BattleScript_AbilityCuredStatus::
BattleScript_IgnoresWhileAsleep::
printstring STRINGID_PKMNIGNORESASLEEP
waitmessage 0x40
moveendto ATK49_NEXT_TARGET
moveendto MOVEEND_NEXT_TARGET
end
BattleScript_IgnoresAndUsesRandomMove::
@ -4249,7 +4249,7 @@ BattleScript_MoveUsedLoafingAround::
BattleScript_82DB6C7::
printfromtable gInobedientStringIds
waitmessage 0x40
moveendto ATK49_NEXT_TARGET
moveendto MOVEEND_NEXT_TARGET
end
BattleScript_IgnoresAndFallsAsleep::
@ -4257,7 +4257,7 @@ BattleScript_IgnoresAndFallsAsleep::
waitmessage 0x40
setmoveeffect MOVE_EFFECT_SLEEP | MOVE_EFFECT_AFFECTS_USER
seteffectprimary
moveendto ATK49_NEXT_TARGET
moveendto MOVEEND_NEXT_TARGET
end
BattleScript_IgnoresAndHitsItself::

View File

@ -479,7 +479,7 @@ struct BattleScripting
u8 animArg1;
u8 animArg2;
u16 tripleKickPower;
u8 atk49_state;
u8 moveendState;
u8 battlerWithAbility;
u8 multihitMoveEffect;
u8 battler;
@ -487,9 +487,9 @@ struct BattleScripting
u8 animTargetsHit;
u8 statChanger;
bool8 statAnimPlayed;
u8 atk23_state;
u8 getexpState;
u8 battleStyle;
u8 atk6C_state;
u8 drawlvlupboxState;
u8 learnMoveState;
u8 field_20;
u8 reshowMainState;

View File

@ -84,43 +84,43 @@
#define VARIOUS_SET_TELEPORT_OUTCOME 25
#define VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC 26
// atk80, dmg manipulation
#define ATK80_DMG_CHANGE_SIGN 0
#define ATK80_DMG_HALF_BY_TWO_NOT_MORE_THAN_HALF_MAX_HP 1
#define ATK80_DMG_DOUBLED 2
// manipulatedmg
#define DMG_CHANGE_SIGN 0
#define DMG_HALF_BY_TWO_NOT_MORE_THAN_HALF_MAX_HP 1
#define DMG_DOUBLED 2
// atk4F, a flag used for the jumpifcantswitch command
#define ATK4F_DONT_CHECK_STATUSES 0x80
// flag used for the jumpifcantswitch command
#define DONT_CHECK_STATUSES 0x80
// statchange defines
#define STAT_CHANGE_BS_PTR 0x1
#define STAT_CHANGE_NOT_PROTECT_AFFECTED 0x20
// atk48
#define ATK48_STAT_NEGATIVE 0x1
#define ATK48_STAT_BY_TWO 0x2
#define ATK48_ONLY_MULTIPLE 0x4
#define ATK48_DONT_CHECK_LOWER 0x8
// playstatchangeanimation
#define STAT_CHANGE_NEGATIVE 0x1
#define STAT_CHANGE_BY_TWO 0x2
#define STAT_CHANGE_ONLY_MULTIPLE 0x4
#define STAT_CHANGE_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
// moveend cases
#define MOVEEND_RAGE 0
#define MOVEEND_DEFROST 1
#define MOVEEND_SYNCHRONIZE_TARGET 2
#define MOVEEND_MOVE_END_ABILITIES 3
#define MOVEEND_STATUS_IMMUNITY_ABILITIES 4
#define MOVEEND_SYNCHRONIZE_ATTACKER 5
#define MOVEEND_CHOICE_MOVE 6
#define MOVEEND_CHANGED_ITEMS 7
#define MOVEEND_ATTACKER_INVISIBLE 8
#define MOVEEND_ATTACKER_VISIBLE 9
#define MOVEEND_TARGET_VISIBLE 10
#define MOVEEND_ITEM_EFFECTS_ALL 11
#define MOVEEND_KINGSROCK_SHELLBELL 12
#define MOVEEND_SUBSTITUTE 13
#define MOVEEND_UPDATE_LAST_MOVES 14
#define MOVEEND_MIRROR_MOVE 15
#define MOVEEND_NEXT_TARGET 16
#define MOVEEND_COUNT 17
#define BIT_HP 0x1
#define BIT_ATK 0x2

View File

@ -3953,7 +3953,7 @@ static void TryDoEventsBeforeFirstTurn(void)
*(&gBattleStruct->turnEffectsBattlerId) = 0;
*(&gBattleStruct->wishPerishSongState) = 0;
*(&gBattleStruct->wishPerishSongBattlerId) = 0;
gBattleScripting.atk49_state = 0;
gBattleScripting.moveendState = 0;
gBattleStruct->faintedActionsState = 0;
gBattleStruct->turnCountersTracker = 0;
gMoveResultFlags = 0;
@ -4016,7 +4016,7 @@ void BattleTurnPassed(void)
gHitMarker &= ~(HITMARKER_x100000);
gBattleScripting.animTurn = 0;
gBattleScripting.animTargetsHit = 0;
gBattleScripting.atk49_state = 0;
gBattleScripting.moveendState = 0;
gBattleMoveDamage = 0;
gMoveResultFlags = 0;
@ -5884,7 +5884,7 @@ static void HandleAction_ActionFinished(void)
gLastHitByType[gBattlerAttacker] = 0;
gBattleStruct->dynamicMoveType = 0;
gDynamicBasePower = 0;
gBattleScripting.atk49_state = 0;
gBattleScripting.moveendState = 0;
gBattleCommunication[3] = 0;
gBattleCommunication[4] = 0;
gBattleScripting.multihitMoveEffect = 0;

View File

@ -1706,7 +1706,7 @@ static void Cmd_adjustnormaldamage(void)
gBattlescriptCurrInstr++;
}
static void Cmd_adjustnormaldamage2(void) // The same as 0x7 except it doesn't check for false swipe move effect.
static void Cmd_adjustnormaldamage2(void) // The same as adjustnormaldamage except it doesn't check for false swipe move effect.
{
u8 holdEffect, param;
@ -3246,7 +3246,7 @@ static void Cmd_getexp(void)
gBattlerFainted = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
sentIn = gSentPokesToOpponent[(gBattlerFainted & 2) >> 1];
switch (gBattleScripting.atk23_state)
switch (gBattleScripting.getexpState)
{
case 0: // check if should receive exp at all
if (GetBattlerSide(gBattlerFainted) != B_SIDE_OPPONENT || (gBattleTypeFlags &
@ -3258,11 +3258,11 @@ static void Cmd_getexp(void)
| BATTLE_TYPE_BATTLE_TOWER
| BATTLE_TYPE_EREADER_TRAINER)))
{
gBattleScripting.atk23_state = 6; // goto last case
gBattleScripting.getexpState = 6; // goto last case
}
else
{
gBattleScripting.atk23_state++;
gBattleScripting.getexpState++;
gBattleStruct->givenExpMons |= gBitTable[gBattlerPartyIndexes[gBattlerFainted]];
}
break;
@ -3309,7 +3309,7 @@ static void Cmd_getexp(void)
gExpShareExp = 0;
}
gBattleScripting.atk23_state++;
gBattleScripting.getexpState++;
gBattleStruct->expGetterMonId = 0;
gBattleStruct->sentInPokes = sentIn;
}
@ -3327,13 +3327,13 @@ static void Cmd_getexp(void)
if (holdEffect != HOLD_EFFECT_EXP_SHARE && !(gBattleStruct->sentInPokes & 1))
{
*(&gBattleStruct->sentInPokes) >>= 1;
gBattleScripting.atk23_state = 5;
gBattleScripting.getexpState = 5;
gBattleMoveDamage = 0; // used for exp
}
else if (GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL) == MAX_LEVEL)
{
*(&gBattleStruct->sentInPokes) >>= 1;
gBattleScripting.atk23_state = 5;
gBattleScripting.getexpState = 5;
gBattleMoveDamage = 0; // used for exp
}
else
@ -3405,7 +3405,7 @@ static void Cmd_getexp(void)
MonGainEVs(&gPlayerParty[gBattleStruct->expGetterMonId], gBattleMons[gBattlerFainted].species);
}
gBattleStruct->sentInPokes >>= 1;
gBattleScripting.atk23_state++;
gBattleScripting.getexpState++;
}
}
break;
@ -3426,7 +3426,7 @@ static void Cmd_getexp(void)
BtlController_EmitExpUpdate(0, gBattleStruct->expGetterMonId, gBattleMoveDamage);
MarkBattlerForControllerExec(gActiveBattler);
}
gBattleScripting.atk23_state++;
gBattleScripting.getexpState++;
}
break;
case 4: // lvl up if necessary
@ -3476,27 +3476,27 @@ static void Cmd_getexp(void)
gBattleMons[2].spAttack = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPATK);
}
gBattleScripting.atk23_state = 5;
gBattleScripting.getexpState = 5;
}
else
{
gBattleMoveDamage = 0;
gBattleScripting.atk23_state = 5;
gBattleScripting.getexpState = 5;
}
}
break;
case 5: // looper increment
if (gBattleMoveDamage) // there is exp to give, goto case 3 that gives exp
{
gBattleScripting.atk23_state = 3;
gBattleScripting.getexpState = 3;
}
else
{
gBattleStruct->expGetterMonId++;
if (gBattleStruct->expGetterMonId <= 5)
gBattleScripting.atk23_state = 2; // loop again
gBattleScripting.getexpState = 2; // loop again
else
gBattleScripting.atk23_state = 6; // we're done
gBattleScripting.getexpState = 6; // we're done
}
break;
case 6: // increment instruction
@ -4393,10 +4393,10 @@ static void Cmd_playstatchangeanimation(void)
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
statsToCheck = gBattlescriptCurrInstr[2];
if (gBattlescriptCurrInstr[3] & ATK48_STAT_NEGATIVE) // goes down
if (gBattlescriptCurrInstr[3] & STAT_CHANGE_NEGATIVE) // goes down
{
s16 startingStatAnimId;
if (gBattlescriptCurrInstr[3] & ATK48_STAT_BY_TWO)
if (gBattlescriptCurrInstr[3] & STAT_CHANGE_BY_TWO)
startingStatAnimId = STAT_ANIM_MINUS2 - 1;
else
startingStatAnimId = STAT_ANIM_MINUS1 - 1;
@ -4405,7 +4405,7 @@ static void Cmd_playstatchangeanimation(void)
{
if (statsToCheck & 1)
{
if (gBattlescriptCurrInstr[3] & ATK48_DONT_CHECK_LOWER)
if (gBattlescriptCurrInstr[3] & STAT_CHANGE_DONT_CHECK_LOWER)
{
if (gBattleMons[gActiveBattler].statStages[currStat] > 0)
{
@ -4431,7 +4431,7 @@ static void Cmd_playstatchangeanimation(void)
if (changeableStatsCount > 1) // more than one stat, so the color is gray
{
if (gBattlescriptCurrInstr[3] & ATK48_STAT_BY_TWO)
if (gBattlescriptCurrInstr[3] & STAT_CHANGE_BY_TWO)
statAnimId = STAT_ANIM_MULTIPLE_MINUS2;
else
statAnimId = STAT_ANIM_MULTIPLE_MINUS1;
@ -4440,7 +4440,7 @@ static void Cmd_playstatchangeanimation(void)
else // goes up
{
s16 startingStatAnimId;
if (gBattlescriptCurrInstr[3] & ATK48_STAT_BY_TWO)
if (gBattlescriptCurrInstr[3] & STAT_CHANGE_BY_TWO)
startingStatAnimId = STAT_ANIM_PLUS2 - 1;
else
startingStatAnimId = STAT_ANIM_PLUS1 - 1;
@ -4457,14 +4457,14 @@ static void Cmd_playstatchangeanimation(void)
if (changeableStatsCount > 1) // more than one stat, so the color is gray
{
if (gBattlescriptCurrInstr[3] & ATK48_STAT_BY_TWO)
if (gBattlescriptCurrInstr[3] & STAT_CHANGE_BY_TWO)
statAnimId = STAT_ANIM_MULTIPLE_PLUS2;
else
statAnimId = STAT_ANIM_MULTIPLE_PLUS1;
}
}
if (gBattlescriptCurrInstr[3] & ATK48_ONLY_MULTIPLE && changeableStatsCount < 2)
if (gBattlescriptCurrInstr[3] & STAT_CHANGE_ONLY_MULTIPLE && changeableStatsCount < 2)
{
gBattlescriptCurrInstr += 4;
}
@ -4472,7 +4472,7 @@ static void Cmd_playstatchangeanimation(void)
{
BtlController_EmitBattleAnimation(0, B_ANIM_STATS_CHANGE, statAnimId);
MarkBattlerForControllerExec(gActiveBattler);
if (gBattlescriptCurrInstr[3] & ATK48_ONLY_MULTIPLE && changeableStatsCount > 1)
if (gBattlescriptCurrInstr[3] & STAT_CHANGE_ONLY_MULTIPLE && changeableStatsCount > 1)
gBattleScripting.statAnimPlayed = TRUE;
gBattlescriptCurrInstr += 4;
}
@ -4510,9 +4510,9 @@ static void Cmd_moveend(void)
do
{
switch (gBattleScripting.atk49_state)
switch (gBattleScripting.moveendState)
{
case ATK49_RAGE: // rage check
case MOVEEND_RAGE: // rage check
if (gBattleMons[gBattlerTarget].status2 & STATUS2_RAGE
&& gBattleMons[gBattlerTarget].hp != 0 && gBattlerAttacker != gBattlerTarget
&& GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget)
@ -4524,9 +4524,9 @@ static void Cmd_moveend(void)
gBattlescriptCurrInstr = BattleScript_RageIsBuilding;
effect = TRUE;
}
gBattleScripting.atk49_state++;
gBattleScripting.moveendState++;
break;
case ATK49_DEFROST: // defrosting check
case MOVEEND_DEFROST: // defrosting check
if (gBattleMons[gBattlerTarget].status1 & STATUS1_FREEZE
&& gBattleMons[gBattlerTarget].hp != 0 && gBattlerAttacker != gBattlerTarget
&& gSpecialStatuses[gBattlerTarget].specialDmg
@ -4540,36 +4540,36 @@ static void Cmd_moveend(void)
gBattlescriptCurrInstr = BattleScript_DefrostedViaFireMove;
effect = TRUE;
}
gBattleScripting.atk49_state++;
gBattleScripting.moveendState++;
break;
case ATK49_SYNCHRONIZE_TARGET: // target synchronize
case MOVEEND_SYNCHRONIZE_TARGET: // target synchronize
if (AbilityBattleEffects(ABILITYEFFECT_SYNCHRONIZE, gBattlerTarget, 0, 0, 0))
effect = TRUE;
gBattleScripting.atk49_state++;
gBattleScripting.moveendState++;
break;
case ATK49_MOVE_END_ABILITIES: // Such as abilities activating on contact(Poison Spore, Rough Skin, etc.).
case MOVEEND_MOVE_END_ABILITIES: // Such as abilities activating on contact(Poison Spore, Rough Skin, etc.).
if (AbilityBattleEffects(ABILITYEFFECT_MOVE_END, gBattlerTarget, 0, 0, 0))
effect = TRUE;
gBattleScripting.atk49_state++;
gBattleScripting.moveendState++;
break;
case ATK49_STATUS_IMMUNITY_ABILITIES: // status immunities
case MOVEEND_STATUS_IMMUNITY_ABILITIES: // status immunities
if (AbilityBattleEffects(ABILITYEFFECT_IMMUNITY, 0, 0, 0, 0))
effect = TRUE; // it loops through all battlers, so we increment after its done with all battlers
else
gBattleScripting.atk49_state++;
gBattleScripting.moveendState++;
break;
case ATK49_SYNCHRONIZE_ATTACKER: // attacker synchronize
case MOVEEND_SYNCHRONIZE_ATTACKER: // attacker synchronize
if (AbilityBattleEffects(ABILITYEFFECT_ATK_SYNCHRONIZE, gBattlerAttacker, 0, 0, 0))
effect = TRUE;
gBattleScripting.atk49_state++;
gBattleScripting.moveendState++;
break;
case ATK49_CHOICE_MOVE: // update choice band move
case MOVEEND_CHOICE_MOVE: // update choice band move
if (!(gHitMarker & HITMARKER_OBEYS) || holdEffectAtk != HOLD_EFFECT_CHOICE_BAND
|| gChosenMove == MOVE_STRUGGLE || (*choicedMoveAtk != 0 && *choicedMoveAtk != 0xFFFF))
goto LOOP;
if (gChosenMove == MOVE_BATON_PASS && !(gMoveResultFlags & MOVE_RESULT_FAILED))
{
gBattleScripting.atk49_state++;
gBattleScripting.moveendState++;
break;
}
*choicedMoveAtk = gChosenMove;
@ -4583,10 +4583,10 @@ static void Cmd_moveend(void)
if (i == MAX_MON_MOVES)
*choicedMoveAtk = 0;
gBattleScripting.atk49_state++;
gBattleScripting.moveendState++;
}
break;
case ATK49_CHANGED_ITEMS: // changed held items
case MOVEEND_CHANGED_ITEMS: // changed held items
for (i = 0; i < gBattlersCount; i++)
{
u16* changedItem = &gBattleStruct->changedItems[i];
@ -4596,32 +4596,32 @@ static void Cmd_moveend(void)
*changedItem = 0;
}
}
gBattleScripting.atk49_state++;
gBattleScripting.moveendState++;
break;
case ATK49_ITEM_EFFECTS_ALL: // item effects for all battlers
case MOVEEND_ITEM_EFFECTS_ALL: // item effects for all battlers
if (ItemBattleEffects(ITEMEFFECT_MOVE_END, 0, FALSE))
effect = TRUE;
else
gBattleScripting.atk49_state++;
gBattleScripting.moveendState++;
break;
case ATK49_KINGSROCK_SHELLBELL: // king's rock and shell bell
case MOVEEND_KINGSROCK_SHELLBELL: // king's rock and shell bell
if (ItemBattleEffects(ITEMEFFECT_KINGSROCK_SHELLBELL, 0, FALSE))
effect = TRUE;
gBattleScripting.atk49_state++;
gBattleScripting.moveendState++;
break;
case ATK49_ATTACKER_INVISIBLE: // make attacker sprite invisible
case MOVEEND_ATTACKER_INVISIBLE: // make attacker sprite invisible
if (gStatuses3[gBattlerAttacker] & (STATUS3_SEMI_INVULNERABLE)
&& gHitMarker & HITMARKER_NO_ANIMATIONS)
{
gActiveBattler = gBattlerAttacker;
BtlController_EmitSpriteInvisibility(0, TRUE);
MarkBattlerForControllerExec(gActiveBattler);
gBattleScripting.atk49_state++;
gBattleScripting.moveendState++;
return;
}
gBattleScripting.atk49_state++;
gBattleScripting.moveendState++;
break;
case ATK49_ATTACKER_VISIBLE: // make attacker sprite visible
case MOVEEND_ATTACKER_VISIBLE: // make attacker sprite visible
if (gMoveResultFlags & MOVE_RESULT_NO_EFFECT
|| !(gStatuses3[gBattlerAttacker] & (STATUS3_SEMI_INVULNERABLE))
|| WasUnableToUseMove(gBattlerAttacker))
@ -4631,12 +4631,12 @@ static void Cmd_moveend(void)
MarkBattlerForControllerExec(gActiveBattler);
gStatuses3[gBattlerAttacker] &= ~(STATUS3_SEMI_INVULNERABLE);
gSpecialStatuses[gBattlerAttacker].restoredBattlerSprite = 1;
gBattleScripting.atk49_state++;
gBattleScripting.moveendState++;
return;
}
gBattleScripting.atk49_state++;
gBattleScripting.moveendState++;
break;
case ATK49_TARGET_VISIBLE: // make target sprite visible
case MOVEEND_TARGET_VISIBLE: // make target sprite visible
if (!gSpecialStatuses[gBattlerTarget].restoredBattlerSprite && gBattlerTarget < gBattlersCount
&& !(gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE))
{
@ -4644,20 +4644,20 @@ static void Cmd_moveend(void)
BtlController_EmitSpriteInvisibility(0, FALSE);
MarkBattlerForControllerExec(gActiveBattler);
gStatuses3[gBattlerTarget] &= ~(STATUS3_SEMI_INVULNERABLE);
gBattleScripting.atk49_state++;
gBattleScripting.moveendState++;
return;
}
gBattleScripting.atk49_state++;
gBattleScripting.moveendState++;
break;
case ATK49_SUBSTITUTE: // update substitute
case MOVEEND_SUBSTITUTE: // update substitute
for (i = 0; i < gBattlersCount; i++)
{
if (gDisableStructs[i].substituteHP == 0)
gBattleMons[i].status2 &= ~(STATUS2_SUBSTITUTE);
}
gBattleScripting.atk49_state++;
gBattleScripting.moveendState++;
break;
case ATK49_UPDATE_LAST_MOVES:
case MOVEEND_UPDATE_LAST_MOVES:
if (gHitMarker & HITMARKER_SWAP_ATTACKER_TARGET)
{
gActiveBattler = gBattlerAttacker;
@ -4704,9 +4704,9 @@ static void Cmd_moveend(void)
gLastLandedMoves[gBattlerTarget] = 0xFFFF;
}
}
gBattleScripting.atk49_state++;
gBattleScripting.moveendState++;
break;
case ATK49_MIRROR_MOVE: // mirror move
case MOVEEND_MIRROR_MOVE: // mirror move
if (!(gAbsentBattlerFlags & gBitTable[gBattlerAttacker]) && !(gBattleStruct->field_91 & gBitTable[gBattlerAttacker])
&& gBattleMoves[originallyUsedMove].flags & FLAG_MIRROR_MOVE_AFFECTED && gHitMarker & HITMARKER_OBEYS
&& gBattlerAttacker != gBattlerTarget && !(gHitMarker & HITMARKER_FAINTED(gBattlerTarget))
@ -4725,9 +4725,9 @@ static void Cmd_moveend(void)
attacker = gBattlerAttacker;
*(attacker * 2 + target * 8 + (u8*)(gBattleStruct->lastTakenMoveFrom) + 1) = gChosenMove >> 8;
}
gBattleScripting.atk49_state++;
gBattleScripting.moveendState++;
break;
case ATK49_NEXT_TARGET: // For moves hitting two opposing Pokemon.
case MOVEEND_NEXT_TARGET: // For moves hitting two opposing Pokemon.
if (!(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE) && gBattleTypeFlags & BATTLE_TYPE_DOUBLE
&& !gProtectStructs[gBattlerAttacker].chargingTurn && gBattleMoves[gCurrentMove].target == MOVE_TARGET_BOTH
&& !(gHitMarker & HITMARKER_NO_ATTACKSTRING))
@ -4737,7 +4737,7 @@ static void Cmd_moveend(void)
{
gBattlerTarget = battlerId;
gHitMarker |= HITMARKER_NO_ATTACKSTRING;
gBattleScripting.atk49_state = 0;
gBattleScripting.moveendState = 0;
MoveValuesCleanUp();
BattleScriptPush(gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect]);
gBattlescriptCurrInstr = BattleScript_FlushMessageBox;
@ -4748,20 +4748,20 @@ static void Cmd_moveend(void)
gHitMarker |= HITMARKER_NO_ATTACKSTRING;
}
}
gBattleScripting.atk49_state++;
gBattleScripting.moveendState++;
break;
case ATK49_COUNT:
case MOVEEND_COUNT:
break;
}
if (arg1 == 1 && effect == FALSE)
gBattleScripting.atk49_state = ATK49_COUNT;
if (arg1 == 2 && arg2 == gBattleScripting.atk49_state)
gBattleScripting.atk49_state = ATK49_COUNT;
gBattleScripting.moveendState = MOVEEND_COUNT;
if (arg1 == 2 && arg2 == gBattleScripting.moveendState)
gBattleScripting.moveendState = MOVEEND_COUNT;
} while (gBattleScripting.atk49_state != ATK49_COUNT && effect == FALSE);
} while (gBattleScripting.moveendState != MOVEEND_COUNT && effect == FALSE);
if (gBattleScripting.atk49_state == ATK49_COUNT && effect == FALSE)
if (gBattleScripting.moveendState == MOVEEND_COUNT && effect == FALSE)
gBattlescriptCurrInstr += 3;
}
@ -4971,9 +4971,9 @@ static void Cmd_jumpifcantswitch(void)
s32 lastMonId;
struct Pokemon *party;
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1] & ~(ATK4F_DONT_CHECK_STATUSES));
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1] & ~(DONT_CHECK_STATUSES));
if (!(gBattlescriptCurrInstr[1] & ATK4F_DONT_CHECK_STATUSES)
if (!(gBattlescriptCurrInstr[1] & DONT_CHECK_STATUSES)
&& ((gBattleMons[gActiveBattler].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION))
|| (gStatuses3[gActiveBattler] & STATUS3_ROOTED)))
{
@ -6130,7 +6130,7 @@ static void Cmd_cancelallactions(void)
gBattlescriptCurrInstr++;
}
static void Cmd_adjustsetdamage(void) // The same as 0x7, except there's no random damage multiplier.
static void Cmd_adjustsetdamage(void) // The same as adjustnormaldamage, except there's no random damage multiplier.
{
u8 holdEffect, param;
@ -6202,26 +6202,26 @@ static void Cmd_atknameinbuff1(void)
static void Cmd_drawlvlupbox(void)
{
if (gBattleScripting.atk6C_state == 0)
if (gBattleScripting.drawlvlupboxState == 0)
{
if (IsMonGettingExpSentOut())
gBattleScripting.atk6C_state = 3;
gBattleScripting.drawlvlupboxState = 3;
else
gBattleScripting.atk6C_state = 1;
gBattleScripting.drawlvlupboxState = 1;
}
switch (gBattleScripting.atk6C_state)
switch (gBattleScripting.drawlvlupboxState)
{
case 1:
gBattle_BG2_Y = 0x60;
SetBgAttribute(2, BG_ATTR_PRIORITY, 0);
ShowBg(2);
sub_804F17C();
gBattleScripting.atk6C_state = 2;
gBattleScripting.drawlvlupboxState = 2;
break;
case 2:
if (!sub_804F1CC())
gBattleScripting.atk6C_state = 3;
gBattleScripting.drawlvlupboxState = 3;
break;
case 3:
gBattle_BG1_X = 0;
@ -6231,20 +6231,20 @@ static void Cmd_drawlvlupbox(void)
ShowBg(0);
ShowBg(1);
HandleBattleWindow(0x12, 7, 0x1D, 0x13, WINDOW_x80);
gBattleScripting.atk6C_state = 4;
gBattleScripting.drawlvlupboxState = 4;
break;
case 4:
DrawLevelUpWindow1();
PutWindowTilemap(13);
CopyWindowToVram(13, 3);
gBattleScripting.atk6C_state++;
gBattleScripting.drawlvlupboxState++;
break;
case 5:
case 7:
if (!IsDma3ManagerBusyWithBgCopy())
{
gBattle_BG1_Y = 0;
gBattleScripting.atk6C_state++;
gBattleScripting.drawlvlupboxState++;
}
break;
case 6:
@ -6253,7 +6253,7 @@ static void Cmd_drawlvlupbox(void)
PlaySE(SE_SELECT);
DrawLevelUpWindow2();
CopyWindowToVram(13, 2);
gBattleScripting.atk6C_state++;
gBattleScripting.drawlvlupboxState++;
}
break;
case 8:
@ -6261,7 +6261,7 @@ static void Cmd_drawlvlupbox(void)
{
PlaySE(SE_SELECT);
HandleBattleWindow(0x12, 7, 0x1D, 0x13, WINDOW_x80 | WINDOW_CLEAR);
gBattleScripting.atk6C_state++;
gBattleScripting.drawlvlupboxState++;
}
break;
case 9:
@ -6276,7 +6276,7 @@ static void Cmd_drawlvlupbox(void)
SetBgAttribute(2, BG_ATTR_PRIORITY, 2);
ShowBg(2);
gBattleScripting.atk6C_state = 10;
gBattleScripting.drawlvlupboxState = 10;
}
break;
case 10:
@ -6999,17 +6999,17 @@ static void Cmd_manipulatedamage(void)
{
switch (gBattlescriptCurrInstr[1])
{
case ATK80_DMG_CHANGE_SIGN:
case DMG_CHANGE_SIGN:
gBattleMoveDamage *= -1;
break;
case ATK80_DMG_HALF_BY_TWO_NOT_MORE_THAN_HALF_MAX_HP:
case DMG_HALF_BY_TWO_NOT_MORE_THAN_HALF_MAX_HP:
gBattleMoveDamage /= 2;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
if ((gBattleMons[gBattlerTarget].maxHP / 2) < gBattleMoveDamage)
gBattleMoveDamage = gBattleMons[gBattlerTarget].maxHP / 2;
break;
case ATK80_DMG_DOUBLED:
case DMG_DOUBLED:
gBattleMoveDamage *= 2;
break;
}