Label miss string indexes

This commit is contained in:
GriffinR 2021-04-02 02:12:46 -04:00
parent 8be2c5d60b
commit c9d3b26ff7
5 changed files with 33 additions and 23 deletions

View File

@ -2113,7 +2113,7 @@ BattleScript_EffectStockpile::
BattleScript_EffectSpitUp:: BattleScript_EffectSpitUp::
attackcanceler attackcanceler
jumpifbyte CMP_EQUAL, gBattleCommunication + 6, 0x1, BattleScript_82D9FA2 jumpifbyte CMP_EQUAL, cMISS_TYPE, B_MSG_PROTECTED, BattleScript_SpitUpFailProtect
attackstring attackstring
ppreduce ppreduce
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
@ -2127,7 +2127,7 @@ BattleScript_SpitUpFail::
waitmessage 0x40 waitmessage 0x40
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_82D9FA2:: BattleScript_SpitUpFailProtect::
attackstring attackstring
ppreduce ppreduce
pause 0x40 pause 0x40
@ -2223,7 +2223,7 @@ BattleScript_AlreadyBurned::
BattleScript_EffectMemento:: BattleScript_EffectMemento::
attackcanceler attackcanceler
jumpifbyte CMP_EQUAL, gBattleCommunication + 6, 0x1, BattleScript_82DA153 jumpifbyte CMP_EQUAL, cMISS_TYPE, B_MSG_PROTECTED, BattleScript_MementoFailProtect
attackstring attackstring
ppreduce ppreduce
jumpifattackandspecialattackcannotfall BattleScript_ButItFailed jumpifattackandspecialattackcannotfall BattleScript_ButItFailed
@ -2253,11 +2253,11 @@ BattleScript_EffectMementoPrintNoEffect:
printstring STRINGID_BUTNOEFFECT printstring STRINGID_BUTNOEFFECT
waitmessage 0x40 waitmessage 0x40
goto BattleScript_EffectMementoTryFaint goto BattleScript_EffectMementoTryFaint
BattleScript_82DA153: BattleScript_MementoFailProtect:
attackstring attackstring
ppreduce ppreduce
jumpifattackandspecialattackcannotfall BattleScript_82DA15A jumpifattackandspecialattackcannotfall BattleScript_MementoFailEnd
BattleScript_82DA15A: BattleScript_MementoFailEnd:
setatkhptozero setatkhptozero
pause 0x40 pause 0x40
effectivenesssound effectivenesssound

View File

@ -32,6 +32,7 @@
#define cEFFECT_CHOOSER gBattleCommunication + 3 #define cEFFECT_CHOOSER gBattleCommunication + 3
#define cMULTISTRING_CHOOSER gBattleCommunication + 5 #define cMULTISTRING_CHOOSER gBattleCommunication + 5
#define cMISS_TYPE gBattleCommunication + 6
// Battle Script defines for getting the wanted battler // Battle Script defines for getting the wanted battler
#define BS_TARGET 0 #define BS_TARGET 0

View File

@ -383,4 +383,11 @@
#define STRINGID_TRAINER1WINTEXT 379 #define STRINGID_TRAINER1WINTEXT 379
#define STRINGID_TRAINER2WINTEXT 380 #define STRINGID_TRAINER2WINTEXT 380
// Indexes into gMissStringIds
#define B_MSG_MISSED 0
#define B_MSG_PROTECTED 1
#define B_MSG_AVOIDED_ATK 2
#define B_MSG_AVOIDED_DMG 3
#define B_MSG_GROUND_MISS 4
#endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H #endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H

View File

@ -893,9 +893,11 @@ const u8 * const gBattleStringsTable[BATTLESTRINGS_COUNT] =
const u16 gMissStringIds[] = const u16 gMissStringIds[] =
{ {
STRINGID_ATTACKMISSED, STRINGID_PKMNPROTECTEDITSELF, [B_MSG_MISSED] = STRINGID_ATTACKMISSED,
STRINGID_PKMNAVOIDEDATTACK, STRINGID_AVOIDEDDAMAGE, [B_MSG_PROTECTED] = STRINGID_PKMNPROTECTEDITSELF,
STRINGID_PKMNMAKESGROUNDMISS [B_MSG_AVOIDED_ATK] = STRINGID_PKMNAVOIDEDATTACK,
[B_MSG_AVOIDED_DMG] = STRINGID_AVOIDEDDAMAGE,
[B_MSG_GROUND_MISS] = STRINGID_PKMNMAKESGROUNDMISS
}; };
const u16 gNoEscapeStringIds[] = const u16 gNoEscapeStringIds[] =

View File

@ -991,7 +991,7 @@ static void Cmd_attackcanceler(void)
gMoveResultFlags |= MOVE_RESULT_MISSED; gMoveResultFlags |= MOVE_RESULT_MISSED;
gLastLandedMoves[gBattlerTarget] = 0; gLastLandedMoves[gBattlerTarget] = 0;
gLastHitByType[gBattlerTarget] = 0; gLastHitByType[gBattlerTarget] = 0;
gBattleCommunication[6] = 1; gBattleCommunication[6] = B_MSG_PROTECTED;
gBattlescriptCurrInstr++; gBattlescriptCurrInstr++;
} }
else else
@ -1024,7 +1024,7 @@ static void Cmd_jumpifaffectedbyprotect(void)
{ {
gMoveResultFlags |= MOVE_RESULT_MISSED; gMoveResultFlags |= MOVE_RESULT_MISSED;
JumpIfMoveFailed(5, 0); JumpIfMoveFailed(5, 0);
gBattleCommunication[6] = 1; gBattleCommunication[6] = B_MSG_PROTECTED;
} }
else else
{ {
@ -1039,7 +1039,7 @@ bool8 JumpIfMoveAffectedByProtect(u16 move)
{ {
gMoveResultFlags |= MOVE_RESULT_MISSED; gMoveResultFlags |= MOVE_RESULT_MISSED;
JumpIfMoveFailed(7, move); JumpIfMoveFailed(7, move);
gBattleCommunication[6] = 1; gBattleCommunication[6] = B_MSG_PROTECTED;
affected = TRUE; affected = TRUE;
} }
return affected; return affected;
@ -1172,9 +1172,9 @@ static void Cmd_accuracycheck(void)
gMoveResultFlags |= MOVE_RESULT_MISSED; gMoveResultFlags |= MOVE_RESULT_MISSED;
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE &&
(gBattleMoves[move].target == MOVE_TARGET_BOTH || gBattleMoves[move].target == MOVE_TARGET_FOES_AND_ALLY)) (gBattleMoves[move].target == MOVE_TARGET_BOTH || gBattleMoves[move].target == MOVE_TARGET_FOES_AND_ALLY))
gBattleCommunication[6] = 2; gBattleCommunication[6] = B_MSG_AVOIDED_ATK;
else else
gBattleCommunication[6] = 0; gBattleCommunication[6] = B_MSG_MISSED;
CheckWonderGuardAndLevitate(); CheckWonderGuardAndLevitate();
} }
@ -1370,7 +1370,7 @@ static void Cmd_typecalc(void)
gMoveResultFlags |= (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE); gMoveResultFlags |= (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE);
gLastLandedMoves[gBattlerTarget] = 0; gLastLandedMoves[gBattlerTarget] = 0;
gLastHitByType[gBattlerTarget] = 0; gLastHitByType[gBattlerTarget] = 0;
gBattleCommunication[6] = moveType; gBattleCommunication[6] = B_MSG_GROUND_MISS;
RecordAbilityBattle(gBattlerTarget, gLastUsedAbility); RecordAbilityBattle(gBattlerTarget, gLastUsedAbility);
} }
else else
@ -1406,7 +1406,7 @@ static void Cmd_typecalc(void)
gMoveResultFlags |= MOVE_RESULT_MISSED; gMoveResultFlags |= MOVE_RESULT_MISSED;
gLastLandedMoves[gBattlerTarget] = 0; gLastLandedMoves[gBattlerTarget] = 0;
gLastHitByType[gBattlerTarget] = 0; gLastHitByType[gBattlerTarget] = 0;
gBattleCommunication[6] = 3; gBattleCommunication[6] = B_MSG_AVOIDED_DMG;
RecordAbilityBattle(gBattlerTarget, gLastUsedAbility); RecordAbilityBattle(gBattlerTarget, gLastUsedAbility);
} }
if (gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE) if (gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE)
@ -1429,7 +1429,7 @@ static void CheckWonderGuardAndLevitate(void)
if (gBattleMons[gBattlerTarget].ability == ABILITY_LEVITATE && moveType == TYPE_GROUND) if (gBattleMons[gBattlerTarget].ability == ABILITY_LEVITATE && moveType == TYPE_GROUND)
{ {
gLastUsedAbility = ABILITY_LEVITATE; gLastUsedAbility = ABILITY_LEVITATE;
gBattleCommunication[6] = moveType; gBattleCommunication[6] = B_MSG_GROUND_MISS;
RecordAbilityBattle(gBattlerTarget, ABILITY_LEVITATE); RecordAbilityBattle(gBattlerTarget, ABILITY_LEVITATE);
return; return;
} }
@ -1484,7 +1484,7 @@ static void CheckWonderGuardAndLevitate(void)
if (((flags & 2) || !(flags & 1)) && gBattleMoves[gCurrentMove].power) if (((flags & 2) || !(flags & 1)) && gBattleMoves[gCurrentMove].power)
{ {
gLastUsedAbility = ABILITY_WONDER_GUARD; gLastUsedAbility = ABILITY_WONDER_GUARD;
gBattleCommunication[6] = 3; gBattleCommunication[6] = B_MSG_AVOIDED_DMG;
RecordAbilityBattle(gBattlerTarget, ABILITY_WONDER_GUARD); RecordAbilityBattle(gBattlerTarget, ABILITY_WONDER_GUARD);
} }
} }
@ -2019,7 +2019,7 @@ static void Cmd_resultmessage(void)
if (gBattleControllerExecFlags) if (gBattleControllerExecFlags)
return; return;
if (gMoveResultFlags & MOVE_RESULT_MISSED && (!(gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE) || gBattleCommunication[6] > 2)) if (gMoveResultFlags & MOVE_RESULT_MISSED && (!(gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE) || gBattleCommunication[6] > B_MSG_AVOIDED_ATK))
{ {
stringId = gMissStringIds[gBattleCommunication[6]]; stringId = gMissStringIds[gBattleCommunication[6]];
gBattleCommunication[MSG_DISPLAY] = 1; gBattleCommunication[MSG_DISPLAY] = 1;
@ -4459,7 +4459,7 @@ static void Cmd_typecalc2(void)
gLastUsedAbility = gBattleMons[gBattlerTarget].ability; gLastUsedAbility = gBattleMons[gBattlerTarget].ability;
gMoveResultFlags |= (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE); gMoveResultFlags |= (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE);
gLastLandedMoves[gBattlerTarget] = 0; gLastLandedMoves[gBattlerTarget] = 0;
gBattleCommunication[6] = moveType; gBattleCommunication[6] = B_MSG_GROUND_MISS;
RecordAbilityBattle(gBattlerTarget, gLastUsedAbility); RecordAbilityBattle(gBattlerTarget, gLastUsedAbility);
} }
else else
@ -4534,7 +4534,7 @@ static void Cmd_typecalc2(void)
gLastUsedAbility = ABILITY_WONDER_GUARD; gLastUsedAbility = ABILITY_WONDER_GUARD;
gMoveResultFlags |= MOVE_RESULT_MISSED; gMoveResultFlags |= MOVE_RESULT_MISSED;
gLastLandedMoves[gBattlerTarget] = 0; gLastLandedMoves[gBattlerTarget] = 0;
gBattleCommunication[6] = 3; gBattleCommunication[6] = B_MSG_AVOIDED_DMG;
RecordAbilityBattle(gBattlerTarget, gLastUsedAbility); RecordAbilityBattle(gBattlerTarget, gLastUsedAbility);
} }
if (gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE) if (gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE)
@ -6802,7 +6802,7 @@ static void Cmd_stockpiletobasedamage(void)
} }
else else
{ {
if (gBattleCommunication[6] != 1) if (gBattleCommunication[6] != B_MSG_PROTECTED)
{ {
gBattleMoveDamage = CalculateBaseDamage(&gBattleMons[gBattlerAttacker], &gBattleMons[gBattlerTarget], gCurrentMove, gBattleMoveDamage = CalculateBaseDamage(&gBattleMons[gBattlerAttacker], &gBattleMons[gBattlerTarget], gCurrentMove,
gSideStatuses[GET_BATTLER_SIDE(gBattlerTarget)], 0, gSideStatuses[GET_BATTLER_SIDE(gBattlerTarget)], 0,
@ -8928,7 +8928,7 @@ static void Cmd_jumpifattackandspecialattackcannotfall(void) // memento
{ {
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[6] != 1) && gBattleCommunication[6] != B_MSG_PROTECTED)
{ {
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
} }