Merge pull request #1397 from GriffinRichards/doc-moremisc
Clean up battle scripts
This commit is contained in:
@@ -876,34 +876,33 @@ const ALIGNED(4) u8 gBattlePalaceNatureToMoveGroupLikelihood[NUM_NATURES][4] =
|
||||
[NATURE_QUIRKY] = PALACE_STYLE(56, 22, 56, 22) // 22%, 22%
|
||||
};
|
||||
|
||||
// Indices into gBattlePalaceFlavorTextTable
|
||||
static const u8 sBattlePalaceNatureToFlavorTextId[NUM_NATURES] =
|
||||
{
|
||||
[NATURE_HARDY] = 3,
|
||||
[NATURE_LONELY] = 0,
|
||||
[NATURE_BRAVE] = 1,
|
||||
[NATURE_ADAMANT] = 0,
|
||||
[NATURE_NAUGHTY] = 0,
|
||||
[NATURE_BOLD] = 1,
|
||||
[NATURE_DOCILE] = 3,
|
||||
[NATURE_RELAXED] = 0,
|
||||
[NATURE_IMPISH] = 1,
|
||||
[NATURE_LAX] = 2,
|
||||
[NATURE_TIMID] = 2,
|
||||
[NATURE_HASTY] = 0,
|
||||
[NATURE_SERIOUS] = 3,
|
||||
[NATURE_JOLLY] = 1,
|
||||
[NATURE_NAIVE] = 3,
|
||||
[NATURE_MODEST] = 1,
|
||||
[NATURE_MILD] = 2,
|
||||
[NATURE_QUIET] = 3,
|
||||
[NATURE_BASHFUL] = 3,
|
||||
[NATURE_RASH] = 2,
|
||||
[NATURE_CALM] = 1,
|
||||
[NATURE_GENTLE] = 0,
|
||||
[NATURE_SASSY] = 2,
|
||||
[NATURE_CAREFUL] = 2,
|
||||
[NATURE_QUIRKY] = 3,
|
||||
[NATURE_HARDY] = B_MSG_EAGER_FOR_MORE,
|
||||
[NATURE_LONELY] = B_MSG_GLINT_IN_EYE,
|
||||
[NATURE_BRAVE] = B_MSG_GETTING_IN_POS,
|
||||
[NATURE_ADAMANT] = B_MSG_GLINT_IN_EYE,
|
||||
[NATURE_NAUGHTY] = B_MSG_GLINT_IN_EYE,
|
||||
[NATURE_BOLD] = B_MSG_GETTING_IN_POS,
|
||||
[NATURE_DOCILE] = B_MSG_EAGER_FOR_MORE,
|
||||
[NATURE_RELAXED] = B_MSG_GLINT_IN_EYE,
|
||||
[NATURE_IMPISH] = B_MSG_GETTING_IN_POS,
|
||||
[NATURE_LAX] = B_MSG_GROWL_DEEPLY,
|
||||
[NATURE_TIMID] = B_MSG_GROWL_DEEPLY,
|
||||
[NATURE_HASTY] = B_MSG_GLINT_IN_EYE,
|
||||
[NATURE_SERIOUS] = B_MSG_EAGER_FOR_MORE,
|
||||
[NATURE_JOLLY] = B_MSG_GETTING_IN_POS,
|
||||
[NATURE_NAIVE] = B_MSG_EAGER_FOR_MORE,
|
||||
[NATURE_MODEST] = B_MSG_GETTING_IN_POS,
|
||||
[NATURE_MILD] = B_MSG_GROWL_DEEPLY,
|
||||
[NATURE_QUIET] = B_MSG_EAGER_FOR_MORE,
|
||||
[NATURE_BASHFUL] = B_MSG_EAGER_FOR_MORE,
|
||||
[NATURE_RASH] = B_MSG_GROWL_DEEPLY,
|
||||
[NATURE_CALM] = B_MSG_GETTING_IN_POS,
|
||||
[NATURE_GENTLE] = B_MSG_GLINT_IN_EYE,
|
||||
[NATURE_SASSY] = B_MSG_GROWL_DEEPLY,
|
||||
[NATURE_CAREFUL] = B_MSG_GROWL_DEEPLY,
|
||||
[NATURE_QUIRKY] = B_MSG_EAGER_FOR_MORE,
|
||||
};
|
||||
|
||||
static void Cmd_attackcanceler(void)
|
||||
@@ -991,7 +990,7 @@ static void Cmd_attackcanceler(void)
|
||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||
gLastLandedMoves[gBattlerTarget] = 0;
|
||||
gLastHitByType[gBattlerTarget] = 0;
|
||||
gBattleCommunication[6] = 1;
|
||||
gBattleCommunication[MISS_TYPE] = B_MSG_PROTECTED;
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
else
|
||||
@@ -1024,7 +1023,7 @@ static void Cmd_jumpifaffectedbyprotect(void)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||
JumpIfMoveFailed(5, 0);
|
||||
gBattleCommunication[6] = 1;
|
||||
gBattleCommunication[MISS_TYPE] = B_MSG_PROTECTED;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1039,7 +1038,7 @@ bool8 JumpIfMoveAffectedByProtect(u16 move)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||
JumpIfMoveFailed(7, move);
|
||||
gBattleCommunication[6] = 1;
|
||||
gBattleCommunication[MISS_TYPE] = B_MSG_PROTECTED;
|
||||
affected = TRUE;
|
||||
}
|
||||
return affected;
|
||||
@@ -1172,9 +1171,9 @@ static void Cmd_accuracycheck(void)
|
||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE &&
|
||||
(gBattleMoves[move].target == MOVE_TARGET_BOTH || gBattleMoves[move].target == MOVE_TARGET_FOES_AND_ALLY))
|
||||
gBattleCommunication[6] = 2;
|
||||
gBattleCommunication[MISS_TYPE] = B_MSG_AVOIDED_ATK;
|
||||
else
|
||||
gBattleCommunication[6] = 0;
|
||||
gBattleCommunication[MISS_TYPE] = B_MSG_MISSED;
|
||||
|
||||
CheckWonderGuardAndLevitate();
|
||||
}
|
||||
@@ -1370,7 +1369,7 @@ static void Cmd_typecalc(void)
|
||||
gMoveResultFlags |= (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE);
|
||||
gLastLandedMoves[gBattlerTarget] = 0;
|
||||
gLastHitByType[gBattlerTarget] = 0;
|
||||
gBattleCommunication[6] = moveType;
|
||||
gBattleCommunication[MISS_TYPE] = B_MSG_GROUND_MISS;
|
||||
RecordAbilityBattle(gBattlerTarget, gLastUsedAbility);
|
||||
}
|
||||
else
|
||||
@@ -1406,7 +1405,7 @@ static void Cmd_typecalc(void)
|
||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||
gLastLandedMoves[gBattlerTarget] = 0;
|
||||
gLastHitByType[gBattlerTarget] = 0;
|
||||
gBattleCommunication[6] = 3;
|
||||
gBattleCommunication[MISS_TYPE] = B_MSG_AVOIDED_DMG;
|
||||
RecordAbilityBattle(gBattlerTarget, gLastUsedAbility);
|
||||
}
|
||||
if (gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE)
|
||||
@@ -1429,7 +1428,7 @@ static void CheckWonderGuardAndLevitate(void)
|
||||
if (gBattleMons[gBattlerTarget].ability == ABILITY_LEVITATE && moveType == TYPE_GROUND)
|
||||
{
|
||||
gLastUsedAbility = ABILITY_LEVITATE;
|
||||
gBattleCommunication[6] = moveType;
|
||||
gBattleCommunication[MISS_TYPE] = B_MSG_GROUND_MISS;
|
||||
RecordAbilityBattle(gBattlerTarget, ABILITY_LEVITATE);
|
||||
return;
|
||||
}
|
||||
@@ -1484,7 +1483,7 @@ static void CheckWonderGuardAndLevitate(void)
|
||||
if (((flags & 2) || !(flags & 1)) && gBattleMoves[gCurrentMove].power)
|
||||
{
|
||||
gLastUsedAbility = ABILITY_WONDER_GUARD;
|
||||
gBattleCommunication[6] = 3;
|
||||
gBattleCommunication[MISS_TYPE] = B_MSG_AVOIDED_DMG;
|
||||
RecordAbilityBattle(gBattlerTarget, ABILITY_WONDER_GUARD);
|
||||
}
|
||||
}
|
||||
@@ -2019,9 +2018,9 @@ static void Cmd_resultmessage(void)
|
||||
if (gBattleControllerExecFlags)
|
||||
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[MISS_TYPE] > B_MSG_AVOIDED_ATK))
|
||||
{
|
||||
stringId = gMissStringIds[gBattleCommunication[6]];
|
||||
stringId = gMissStringIds[gBattleCommunication[MISS_TYPE]];
|
||||
gBattleCommunication[MSG_DISPLAY] = 1;
|
||||
}
|
||||
else
|
||||
@@ -2273,12 +2272,12 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
|
||||
if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
|
||||
{
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS;
|
||||
gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD);
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_MOVE_STATUS;
|
||||
}
|
||||
RESET_RETURN
|
||||
}
|
||||
@@ -2289,7 +2288,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = BattleScript_PSNPrevention;
|
||||
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STATUS_HAD_NO_EFFECT;
|
||||
RESET_RETURN
|
||||
}
|
||||
if (IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_POISON))
|
||||
@@ -2314,12 +2313,12 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
gBattlescriptCurrInstr = BattleScript_BRNPrevention;
|
||||
if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
|
||||
{
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS;
|
||||
gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD);
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_MOVE_STATUS;
|
||||
}
|
||||
RESET_RETURN
|
||||
}
|
||||
@@ -2330,7 +2329,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = BattleScript_BRNPrevention;
|
||||
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STATUS_HAD_NO_EFFECT;
|
||||
RESET_RETURN
|
||||
}
|
||||
if (IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_FIRE))
|
||||
@@ -2370,12 +2369,12 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
|
||||
if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
|
||||
{
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS;
|
||||
gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD);
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_MOVE_STATUS;
|
||||
}
|
||||
RESET_RETURN
|
||||
}
|
||||
@@ -2398,12 +2397,12 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
|
||||
if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
|
||||
{
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS;
|
||||
gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD);
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_MOVE_STATUS;
|
||||
}
|
||||
RESET_RETURN
|
||||
}
|
||||
@@ -2414,7 +2413,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = BattleScript_PSNPrevention;
|
||||
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STATUS_HAD_NO_EFFECT;
|
||||
RESET_RETURN
|
||||
}
|
||||
if (gBattleMons[gEffectBattler].status1)
|
||||
@@ -2453,12 +2452,12 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
|
||||
if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
|
||||
{
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STATUSED_BY_ABILITY;
|
||||
gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD);
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STATUSED;
|
||||
}
|
||||
|
||||
// for synchronize
|
||||
@@ -3579,7 +3578,7 @@ static void MoveValuesCleanUp(void)
|
||||
gBattleScripting.dmgMultiplier = 1;
|
||||
gCritMultiplier = 1;
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = 0;
|
||||
gBattleCommunication[6] = 0;
|
||||
gBattleCommunication[MISS_TYPE] = 0;
|
||||
gHitMarker &= ~(HITMARKER_DESTINYBOND);
|
||||
gHitMarker &= ~(HITMARKER_SYNCHRONISE_EFFECT);
|
||||
}
|
||||
@@ -4459,7 +4458,7 @@ static void Cmd_typecalc2(void)
|
||||
gLastUsedAbility = gBattleMons[gBattlerTarget].ability;
|
||||
gMoveResultFlags |= (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE);
|
||||
gLastLandedMoves[gBattlerTarget] = 0;
|
||||
gBattleCommunication[6] = moveType;
|
||||
gBattleCommunication[MISS_TYPE] = B_MSG_GROUND_MISS;
|
||||
RecordAbilityBattle(gBattlerTarget, gLastUsedAbility);
|
||||
}
|
||||
else
|
||||
@@ -4534,7 +4533,7 @@ static void Cmd_typecalc2(void)
|
||||
gLastUsedAbility = ABILITY_WONDER_GUARD;
|
||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||
gLastLandedMoves[gBattlerTarget] = 0;
|
||||
gBattleCommunication[6] = 3;
|
||||
gBattleCommunication[MISS_TYPE] = B_MSG_AVOIDED_DMG;
|
||||
RecordAbilityBattle(gBattlerTarget, gLastUsedAbility);
|
||||
}
|
||||
if (gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE)
|
||||
@@ -4802,7 +4801,9 @@ static void Cmd_jumpifcantswitch(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_804CF10(u8 slotId)
|
||||
// Opens the party screen to choose a new Pokémon to send out
|
||||
// slotId is the Pokémon to replace
|
||||
static void ChooseMonToSendOut(u8 slotId)
|
||||
{
|
||||
*(gBattleStruct->field_58 + gActiveBattler) = gBattlerPartyIndexes[gActiveBattler];
|
||||
*(gBattleStruct->monToSwitchIntoId + gActiveBattler) = PARTY_SIZE;
|
||||
@@ -4823,7 +4824,7 @@ static void Cmd_openpartyscreen(void)
|
||||
flags = 0;
|
||||
jumpPtr = T1_READ_PTR(gBattlescriptCurrInstr + 2);
|
||||
|
||||
if (gBattlescriptCurrInstr[1] == 5)
|
||||
if (gBattlescriptCurrInstr[1] == BS_UNK_5)
|
||||
{
|
||||
if ((gBattleTypeFlags & (BATTLE_TYPE_DOUBLE | BATTLE_TYPE_MULTI)) != BATTLE_TYPE_DOUBLE)
|
||||
{
|
||||
@@ -4831,7 +4832,7 @@ static void Cmd_openpartyscreen(void)
|
||||
{
|
||||
if (gHitMarker & HITMARKER_FAINTED(gActiveBattler))
|
||||
{
|
||||
if (HasNoMonsToSwitch(gActiveBattler, 6, 6))
|
||||
if (HasNoMonsToSwitch(gActiveBattler, PARTY_SIZE, PARTY_SIZE))
|
||||
{
|
||||
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
|
||||
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
|
||||
@@ -4840,7 +4841,7 @@ static void Cmd_openpartyscreen(void)
|
||||
}
|
||||
else if (!gSpecialStatuses[gActiveBattler].flag40)
|
||||
{
|
||||
sub_804CF10(PARTY_SIZE);
|
||||
ChooseMonToSendOut(PARTY_SIZE);
|
||||
gSpecialStatuses[gActiveBattler].flag40 = 1;
|
||||
}
|
||||
}
|
||||
@@ -4860,16 +4861,16 @@ static void Cmd_openpartyscreen(void)
|
||||
if (gBitTable[0] & hitmarkerFaintBits)
|
||||
{
|
||||
gActiveBattler = 0;
|
||||
if (HasNoMonsToSwitch(0, 6, 6))
|
||||
if (HasNoMonsToSwitch(0, PARTY_SIZE, PARTY_SIZE))
|
||||
{
|
||||
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
|
||||
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
|
||||
BtlController_EmitCmd42(0);
|
||||
BtlController_EmitCantSwitch(0);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
else if (!gSpecialStatuses[gActiveBattler].flag40)
|
||||
{
|
||||
sub_804CF10(gBattleStruct->monToSwitchIntoId[2]);
|
||||
ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[2]);
|
||||
gSpecialStatuses[gActiveBattler].flag40 = 1;
|
||||
}
|
||||
else
|
||||
@@ -4882,16 +4883,16 @@ static void Cmd_openpartyscreen(void)
|
||||
if (gBitTable[2] & hitmarkerFaintBits && !(gBitTable[0] & hitmarkerFaintBits))
|
||||
{
|
||||
gActiveBattler = 2;
|
||||
if (HasNoMonsToSwitch(2, 6, 6))
|
||||
if (HasNoMonsToSwitch(2, PARTY_SIZE, PARTY_SIZE))
|
||||
{
|
||||
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
|
||||
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
|
||||
BtlController_EmitCmd42(0);
|
||||
BtlController_EmitCantSwitch(0);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
else if (!gSpecialStatuses[gActiveBattler].flag40)
|
||||
{
|
||||
sub_804CF10(gBattleStruct->monToSwitchIntoId[0]);
|
||||
ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[0]);
|
||||
gSpecialStatuses[gActiveBattler].flag40 = 1;
|
||||
}
|
||||
else if (!(flags & 1))
|
||||
@@ -4903,16 +4904,16 @@ static void Cmd_openpartyscreen(void)
|
||||
if (gBitTable[1] & hitmarkerFaintBits)
|
||||
{
|
||||
gActiveBattler = 1;
|
||||
if (HasNoMonsToSwitch(1, 6, 6))
|
||||
if (HasNoMonsToSwitch(1, PARTY_SIZE, PARTY_SIZE))
|
||||
{
|
||||
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
|
||||
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
|
||||
BtlController_EmitCmd42(0);
|
||||
BtlController_EmitCantSwitch(0);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
else if (!gSpecialStatuses[gActiveBattler].flag40)
|
||||
{
|
||||
sub_804CF10(gBattleStruct->monToSwitchIntoId[3]);
|
||||
ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[3]);
|
||||
gSpecialStatuses[gActiveBattler].flag40 = 1;
|
||||
}
|
||||
else
|
||||
@@ -4925,16 +4926,16 @@ static void Cmd_openpartyscreen(void)
|
||||
if (gBitTable[3] & hitmarkerFaintBits && !(gBitTable[1] & hitmarkerFaintBits))
|
||||
{
|
||||
gActiveBattler = 3;
|
||||
if (HasNoMonsToSwitch(3, 6, 6))
|
||||
if (HasNoMonsToSwitch(3, PARTY_SIZE, PARTY_SIZE))
|
||||
{
|
||||
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
|
||||
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
|
||||
BtlController_EmitCmd42(0);
|
||||
BtlController_EmitCantSwitch(0);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
else if (!gSpecialStatuses[gActiveBattler].flag40)
|
||||
{
|
||||
sub_804CF10(gBattleStruct->monToSwitchIntoId[1]);
|
||||
ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[1]);
|
||||
gSpecialStatuses[gActiveBattler].flag40 = 1;
|
||||
}
|
||||
else if (!(flags & 2))
|
||||
@@ -4978,7 +4979,7 @@ static void Cmd_openpartyscreen(void)
|
||||
}
|
||||
gBattlescriptCurrInstr += 6;
|
||||
}
|
||||
else if (gBattlescriptCurrInstr[1] == 6)
|
||||
else if (gBattlescriptCurrInstr[1] == BS_UNK_6)
|
||||
{
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI))
|
||||
{
|
||||
@@ -4988,32 +4989,32 @@ static void Cmd_openpartyscreen(void)
|
||||
if (gBitTable[2] & hitmarkerFaintBits && gBitTable[0] & hitmarkerFaintBits)
|
||||
{
|
||||
gActiveBattler = 2;
|
||||
if (HasNoMonsToSwitch(2, gBattleBufferB[0][1], 6))
|
||||
if (HasNoMonsToSwitch(2, gBattleBufferB[0][1], PARTY_SIZE))
|
||||
{
|
||||
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
|
||||
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
|
||||
BtlController_EmitCmd42(0);
|
||||
BtlController_EmitCantSwitch(0);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
else if (!gSpecialStatuses[gActiveBattler].flag40)
|
||||
{
|
||||
sub_804CF10(gBattleStruct->monToSwitchIntoId[0]);
|
||||
ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[0]);
|
||||
gSpecialStatuses[gActiveBattler].flag40 = 1;
|
||||
}
|
||||
}
|
||||
if (gBitTable[3] & hitmarkerFaintBits && hitmarkerFaintBits & gBitTable[1])
|
||||
{
|
||||
gActiveBattler = 3;
|
||||
if (HasNoMonsToSwitch(3, gBattleBufferB[1][1], 6))
|
||||
if (HasNoMonsToSwitch(3, gBattleBufferB[1][1], PARTY_SIZE))
|
||||
{
|
||||
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
|
||||
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
|
||||
BtlController_EmitCmd42(0);
|
||||
BtlController_EmitCantSwitch(0);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
else if (!gSpecialStatuses[gActiveBattler].flag40)
|
||||
{
|
||||
sub_804CF10(gBattleStruct->monToSwitchIntoId[1]);
|
||||
ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[1]);
|
||||
gSpecialStatuses[gActiveBattler].flag40 = 1;
|
||||
}
|
||||
}
|
||||
@@ -5041,17 +5042,17 @@ static void Cmd_openpartyscreen(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gBattlescriptCurrInstr[1] & 0x80)
|
||||
if (gBattlescriptCurrInstr[1] & PARTY_SCREEN_OPTIONAL)
|
||||
hitmarkerFaintBits = PARTY_ACTION_CHOOSE_MON; // Used here as the caseId for the EmitChoose function.
|
||||
else
|
||||
hitmarkerFaintBits = PARTY_ACTION_SEND_OUT;
|
||||
|
||||
battlerId = GetBattlerForBattleScript(gBattlescriptCurrInstr[1] & ~(0x80));
|
||||
battlerId = GetBattlerForBattleScript(gBattlescriptCurrInstr[1] & ~(PARTY_SCREEN_OPTIONAL));
|
||||
if (gSpecialStatuses[battlerId].flag40)
|
||||
{
|
||||
gBattlescriptCurrInstr += 6;
|
||||
}
|
||||
else if (HasNoMonsToSwitch(battlerId, 6, 6))
|
||||
else if (HasNoMonsToSwitch(battlerId, PARTY_SIZE, PARTY_SIZE))
|
||||
{
|
||||
gActiveBattler = battlerId;
|
||||
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
|
||||
@@ -6373,10 +6374,10 @@ static void Cmd_various(void)
|
||||
break;
|
||||
case VARIOUS_ARENA_JUDGMENT_STRING:
|
||||
BattleStringExpandPlaceholdersToDisplayedString(gRefereeStringsTable[gBattlescriptCurrInstr[1]]);
|
||||
BattlePutTextOnWindow(gDisplayedStringBattle, 0x16);
|
||||
BattlePutTextOnWindow(gDisplayedStringBattle, 22);
|
||||
break;
|
||||
case VARIOUS_ARENA_WAIT_STRING:
|
||||
if (IsTextPrinterActive(0x16))
|
||||
if (IsTextPrinterActive(22))
|
||||
return;
|
||||
break;
|
||||
case VARIOUS_WAIT_CRY:
|
||||
@@ -6446,19 +6447,19 @@ static void Cmd_setprotectlike(void) // protect and endure
|
||||
if (gBattleMoves[gCurrentMove].effect == EFFECT_PROTECT)
|
||||
{
|
||||
gProtectStructs[gBattlerAttacker].protected = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_PROTECTED_ITSELF;
|
||||
}
|
||||
if (gBattleMoves[gCurrentMove].effect == EFFECT_ENDURE)
|
||||
{
|
||||
gProtectStructs[gBattlerAttacker].endured = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_BRACED_ITSELF;
|
||||
}
|
||||
gDisableStructs[gBattlerAttacker].protectUses++;
|
||||
}
|
||||
else
|
||||
{
|
||||
gDisableStructs[gBattlerAttacker].protectUses = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_PROTECT_FAILED;
|
||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||
}
|
||||
|
||||
@@ -6611,12 +6612,12 @@ static void Cmd_setrain(void)
|
||||
if (gBattleWeather & WEATHER_RAIN_ANY)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_FAILED;
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleWeather = WEATHER_RAIN_TEMPORARY;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STARTED_RAIN;
|
||||
gWishFutureKnock.weatherDuration = 5;
|
||||
}
|
||||
gBattlescriptCurrInstr++;
|
||||
@@ -6627,7 +6628,7 @@ static void Cmd_setreflect(void)
|
||||
if (gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] & SIDE_STATUS_REFLECT)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SIDE_STATUS_FAILED;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -6636,9 +6637,9 @@ static void Cmd_setreflect(void)
|
||||
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].reflectBattlerId = gBattlerAttacker;
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_ATK_SIDE) == 2)
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_REFLECT_DOUBLE;
|
||||
else
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_REFLECT_SINGLE;
|
||||
}
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
@@ -6648,18 +6649,18 @@ static void Cmd_setseeded(void)
|
||||
if (gMoveResultFlags & MOVE_RESULT_NO_EFFECT || gStatuses3[gBattlerTarget] & STATUS3_LEECHSEED)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_LEECH_SEED_MISS;
|
||||
}
|
||||
else if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_GRASS))
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_LEECH_SEED_FAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
gStatuses3[gBattlerTarget] |= gBattlerAttacker;
|
||||
gStatuses3[gBattlerTarget] |= STATUS3_LEECHSEED;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_LEECH_SEED_SET;
|
||||
}
|
||||
|
||||
gBattlescriptCurrInstr++;
|
||||
@@ -6700,11 +6701,11 @@ static void Cmd_trysetrest(void)
|
||||
else
|
||||
{
|
||||
if (gBattleMons[gBattlerTarget].status1 & ((u8)(~STATUS1_SLEEP)))
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_REST_STATUSED;
|
||||
else
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_REST;
|
||||
|
||||
gBattleMons[gBattlerTarget].status1 = 3;
|
||||
gBattleMons[gBattlerTarget].status1 = STATUS1_SLEEP_TURN(3);
|
||||
BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
gBattlescriptCurrInstr += 5;
|
||||
@@ -6740,9 +6741,9 @@ bool8 UproarWakeUpCheck(u8 battlerId)
|
||||
if (gBattlerTarget == 0xFF)
|
||||
gBattlerTarget = i;
|
||||
else if (gBattlerTarget == i)
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CANT_SLEEP_UPROAR;
|
||||
else
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_UPROAR_KEPT_AWAKE;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -6765,7 +6766,7 @@ static void Cmd_jumpifcantmakeasleep(void)
|
||||
|| gBattleMons[gBattlerTarget].ability == ABILITY_VITAL_SPIRIT)
|
||||
{
|
||||
gLastUsedAbility = gBattleMons[gBattlerTarget].ability;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STAYED_AWAKE_USING;
|
||||
gBattlescriptCurrInstr = jumpPtr;
|
||||
RecordAbilityBattle(gBattlerTarget, gLastUsedAbility);
|
||||
}
|
||||
@@ -6780,7 +6781,7 @@ static void Cmd_stockpile(void)
|
||||
if (gDisableStructs[gBattlerAttacker].stockpileCounter == 3)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CANT_STOCKPILE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -6788,7 +6789,7 @@ static void Cmd_stockpile(void)
|
||||
|
||||
PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff1, 1, gDisableStructs[gBattlerAttacker].stockpileCounter)
|
||||
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STOCKPILED;
|
||||
}
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
@@ -6802,7 +6803,7 @@ static void Cmd_stockpiletobasedamage(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gBattleCommunication[6] != 1)
|
||||
if (gBattleCommunication[MISS_TYPE] != B_MSG_PROTECTED)
|
||||
{
|
||||
gBattleMoveDamage = CalculateBaseDamage(&gBattleMons[gBattlerAttacker], &gBattleMons[gBattlerTarget], gCurrentMove,
|
||||
gSideStatuses[GET_BATTLER_SIDE(gBattlerTarget)], 0,
|
||||
@@ -6826,14 +6827,14 @@ static void Cmd_stockpiletohpheal(void)
|
||||
if (gDisableStructs[gBattlerAttacker].stockpileCounter == 0)
|
||||
{
|
||||
gBattlescriptCurrInstr = jumpPtr;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWALLOW_FAILED;
|
||||
}
|
||||
else if (gBattleMons[gBattlerAttacker].maxHP == gBattleMons[gBattlerAttacker].hp)
|
||||
{
|
||||
gDisableStructs[gBattlerAttacker].stockpileCounter = 0;
|
||||
gBattlescriptCurrInstr = jumpPtr;
|
||||
gBattlerTarget = gBattlerAttacker;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWALLOW_FULL_HP;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -6985,9 +6986,9 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
|
||||
gBattleTextBuff2[index] = B_BUFF_EOS;
|
||||
|
||||
if (gBattleMons[gActiveBattler].statStages[statId] == MIN_STAT_STAGE)
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STAT_WONT_DECREASE;
|
||||
else
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler);
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler); // B_MSG_ATTACKER_STAT_FELL or B_MSG_DEFENDER_STAT_FELL
|
||||
|
||||
}
|
||||
}
|
||||
@@ -7012,9 +7013,9 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
|
||||
gBattleTextBuff2[index] = B_BUFF_EOS;
|
||||
|
||||
if (gBattleMons[gActiveBattler].statStages[statId] == MAX_STAT_STAGE)
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STAT_WONT_INCREASE;
|
||||
else
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler);
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler); // B_MSG_ATTACKER_STAT_ROSE or B_MSG_DEFENDER_STAT_ROSE
|
||||
}
|
||||
|
||||
gBattleMons[gActiveBattler].statStages[statId] += statValue;
|
||||
@@ -7023,10 +7024,10 @@ 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] == 2 && flags & STAT_BUFF_ALLOW_PTR)
|
||||
if (gBattleCommunication[MULTISTRING_CHOOSER] == B_MSG_STAT_WONT_INCREASE && flags & STAT_BUFF_ALLOW_PTR)
|
||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||
|
||||
if (gBattleCommunication[MULTISTRING_CHOOSER] == 2 && !(flags & STAT_BUFF_ALLOW_PTR))
|
||||
if (gBattleCommunication[MULTISTRING_CHOOSER] == B_MSG_STAT_WONT_INCREASE && !(flags & STAT_BUFF_ALLOW_PTR))
|
||||
return STAT_BUFF_DIDNT_WORK;
|
||||
|
||||
return STAT_BUFF_WORKED;
|
||||
@@ -7314,7 +7315,7 @@ static void Cmd_tryconversiontypechange(void) // randomly changes user's type to
|
||||
do
|
||||
{
|
||||
|
||||
while ((moveChecked = Random() & 3) >= validMoves);
|
||||
while ((moveChecked = Random() & (MAX_MON_MOVES - 1)) >= validMoves);
|
||||
|
||||
moveType = gBattleMoves[gBattleMons[gBattlerAttacker].moves[moveChecked]].type;
|
||||
|
||||
@@ -7358,7 +7359,7 @@ static void Cmd_setlightscreen(void)
|
||||
if (gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] & SIDE_STATUS_LIGHTSCREEN)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SIDE_STATUS_FAILED;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -7367,9 +7368,9 @@ static void Cmd_setlightscreen(void)
|
||||
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].lightscreenBattlerId = gBattlerAttacker;
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_ATK_SIDE) == 2)
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 4;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_LIGHTSCREEN_DOUBLE;
|
||||
else
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 3;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_LIGHTSCREEN_SINGLE;
|
||||
}
|
||||
|
||||
gBattlescriptCurrInstr++;
|
||||
@@ -7453,9 +7454,9 @@ static void Cmd_tryKO(void)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||
if (gBattleMons[gBattlerAttacker].level >= gBattleMons[gBattlerTarget].level)
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_KO_MISS;
|
||||
else
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_KO_UNAFFECTED;
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||
}
|
||||
}
|
||||
@@ -7475,12 +7476,12 @@ static void Cmd_setsandstorm(void)
|
||||
if (gBattleWeather & WEATHER_SANDSTORM_ANY)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_FAILED;
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleWeather = WEATHER_SANDSTORM_TEMPORARY;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 3;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STARTED_SANDSTORM;
|
||||
gWishFutureKnock.weatherDuration = 5;
|
||||
}
|
||||
gBattlescriptCurrInstr++;
|
||||
@@ -7621,14 +7622,14 @@ static void Cmd_setmist(void)
|
||||
if (gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].mistTimer)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_FAILED;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MIST_FAILED;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].mistTimer = 5;
|
||||
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].mistBattlerId = gBattlerAttacker;
|
||||
gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_MIST;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_MIST;
|
||||
}
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
@@ -7638,12 +7639,12 @@ static void Cmd_setfocusenergy(void)
|
||||
if (gBattleMons[gBattlerAttacker].status2 & STATUS2_FOCUS_ENERGY)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_FAILED;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_FOCUS_ENERGY_FAILED;
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleMons[gBattlerAttacker].status2 |= STATUS2_FOCUS_ENERGY;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_GETTING_PUMPED;
|
||||
}
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
@@ -7656,7 +7657,7 @@ static void Cmd_transformdataexecution(void)
|
||||
|| gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_FAILED;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_TRANSFORM_FAILED;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -7688,7 +7689,7 @@ static void Cmd_transformdataexecution(void)
|
||||
gActiveBattler = gBattlerAttacker;
|
||||
BtlController_EmitResetActionMoveSelection(0, RESET_MOVE_SELECTION);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_TRANSFORMED;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7701,7 +7702,7 @@ static void Cmd_setsubstitute(void)
|
||||
if (gBattleMons[gBattlerAttacker].hp <= hp)
|
||||
{
|
||||
gBattleMoveDamage = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SUBSTITUTE_FAILED;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -7712,7 +7713,7 @@ static void Cmd_setsubstitute(void)
|
||||
gBattleMons[gBattlerAttacker].status2 |= STATUS2_SUBSTITUTE;
|
||||
gBattleMons[gBattlerAttacker].status2 &= ~(STATUS2_WRAPPED);
|
||||
gDisableStructs[gBattlerAttacker].substituteHP = gBattleMoveDamage;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_SUBSTITUTE;
|
||||
gHitMarker |= HITMARKER_IGNORE_SUBSTITUTE;
|
||||
}
|
||||
|
||||
@@ -8139,7 +8140,7 @@ static void Cmd_trychoosesleeptalkmove(void)
|
||||
|
||||
do
|
||||
{
|
||||
movePosition = Random() & 3;
|
||||
movePosition = Random() & (MAX_MON_MOVES - 1);
|
||||
} while ((gBitTable[movePosition] & unusableMovesBits));
|
||||
|
||||
gCalledMove = gBattleMons[gBattlerAttacker].moves[movePosition];
|
||||
@@ -8250,7 +8251,7 @@ static void Cmd_healpartystatus(void)
|
||||
struct Pokemon *party;
|
||||
s32 i;
|
||||
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_BELL;
|
||||
|
||||
if (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER)
|
||||
party = gPlayerParty;
|
||||
@@ -8265,7 +8266,7 @@ static void Cmd_healpartystatus(void)
|
||||
else
|
||||
{
|
||||
RecordAbilityBattle(gBattlerAttacker, gBattleMons[gBattlerAttacker].ability);
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] |= 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] |= B_MSG_BELL_SOUNDPROOF_ATTACKER;
|
||||
}
|
||||
|
||||
gActiveBattler = gBattleScripting.battler = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_FLANK);
|
||||
@@ -8281,10 +8282,12 @@ static void Cmd_healpartystatus(void)
|
||||
else
|
||||
{
|
||||
RecordAbilityBattle(gActiveBattler, gBattleMons[gActiveBattler].ability);
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] |= 2;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] |= B_MSG_BELL_SOUNDPROOF_PARTNER;
|
||||
}
|
||||
}
|
||||
|
||||
// Because the above MULTISTRING_CHOOSER are ORd, if both are set then it will be B_MSG_BELL_BOTH_SOUNDPROOF
|
||||
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
u16 species = GetMonData(&party[i], MON_DATA_SPECIES2);
|
||||
@@ -8310,7 +8313,7 @@ static void Cmd_healpartystatus(void)
|
||||
}
|
||||
else // Aromatherapy
|
||||
{
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 4;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SOOTHING_AROMA;
|
||||
toHeal = 0x3F;
|
||||
|
||||
gBattleMons[gBattlerAttacker].status1 = 0;
|
||||
@@ -8514,14 +8517,14 @@ static void Cmd_setsafeguard(void)
|
||||
if (gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] & SIDE_STATUS_SAFEGUARD)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SIDE_STATUS_FAILED;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_SAFEGUARD;
|
||||
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].safeguardTimer = 5;
|
||||
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].safeguardBattlerId = gBattlerAttacker;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 5;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_SAFEGUARD;
|
||||
}
|
||||
|
||||
gBattlescriptCurrInstr++;
|
||||
@@ -8630,12 +8633,12 @@ static void Cmd_setsunny(void)
|
||||
if (gBattleWeather & WEATHER_SUN_ANY)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_FAILED;
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleWeather = WEATHER_SUN_TEMPORARY;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 4;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STARTED_SUNLIGHT;
|
||||
gWishFutureKnock.weatherDuration = 5;
|
||||
}
|
||||
|
||||
@@ -8806,9 +8809,9 @@ static void Cmd_trysetfutureattack(void)
|
||||
gWishFutureKnock.futureSightDmg[gBattlerTarget] = gWishFutureKnock.futureSightDmg[gBattlerTarget] * 15 / 10;
|
||||
|
||||
if (gCurrentMove == MOVE_DOOM_DESIRE)
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DOOM_DESIRE;
|
||||
else
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_FUTURE_SIGHT;
|
||||
|
||||
gBattlescriptCurrInstr += 5;
|
||||
}
|
||||
@@ -8912,12 +8915,12 @@ static void Cmd_sethail(void)
|
||||
if (gBattleWeather & WEATHER_HAIL_ANY)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_FAILED;
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleWeather = WEATHER_HAIL;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 5;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STARTED_HAIL;
|
||||
gWishFutureKnock.weatherDuration = 5;
|
||||
}
|
||||
|
||||
@@ -8928,7 +8931,7 @@ static void Cmd_jumpifattackandspecialattackcannotfall(void) // memento
|
||||
{
|
||||
if (gBattleMons[gBattlerTarget].statStages[STAT_ATK] == MIN_STAT_STAGE
|
||||
&& gBattleMons[gBattlerTarget].statStages[STAT_SPATK] == MIN_STAT_STAGE
|
||||
&& gBattleCommunication[6] != 1)
|
||||
&& gBattleCommunication[MISS_TYPE] != B_MSG_PROTECTED)
|
||||
{
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||
}
|
||||
@@ -9113,11 +9116,11 @@ static void Cmd_tryswapitems(void) // trick
|
||||
PREPARE_ITEM_BUFFER(gBattleTextBuff2, oldItemAtk)
|
||||
|
||||
if (oldItemAtk != 0 && *newItemAtk != 0)
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 2; // attacker's item -> <- target's item
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ITEM_SWAP_BOTH; // attacker's item -> <- target's item
|
||||
else if (oldItemAtk == 0 && *newItemAtk != 0)
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0; // nothing -> <- target's item
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ITEM_SWAP_TAKEN; // nothing -> <- target's item
|
||||
else
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1; // attacker's item -> <- nothing
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ITEM_SWAP_GIVEN; // attacker's item -> <- nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9605,7 +9608,7 @@ static void Cmd_settypebasedhalvers(void) // water and mud sport
|
||||
if (!(gStatuses3[gBattlerAttacker] & STATUS3_MUDSPORT))
|
||||
{
|
||||
gStatuses3[gBattlerAttacker] |= STATUS3_MUDSPORT;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEAKEN_ELECTRIC;
|
||||
worked = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -9614,7 +9617,7 @@ static void Cmd_settypebasedhalvers(void) // water and mud sport
|
||||
if (!(gStatuses3[gBattlerAttacker] & STATUS3_WATERSPORT))
|
||||
{
|
||||
gStatuses3[gBattlerAttacker] |= STATUS3_WATERSPORT;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEAKEN_FIRE;
|
||||
worked = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -9883,7 +9886,6 @@ static void Cmd_handleballthrow(void)
|
||||
else // not caught
|
||||
{
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = shakes;
|
||||
// Maybe inject SpriteCB_TestBallThrow here
|
||||
gBattlescriptCurrInstr = BattleScript_ShakeBallThrow;
|
||||
}
|
||||
}
|
||||
@@ -9896,7 +9898,7 @@ static void Cmd_givecaughtmon(void)
|
||||
{
|
||||
if (!ShouldShowBoxWasFullMessage())
|
||||
{
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SENT_SOMEONES_PC;
|
||||
StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_PC_BOX_TO_SEND_MON)));
|
||||
GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gStringVar2);
|
||||
}
|
||||
@@ -9905,9 +9907,10 @@ static void Cmd_givecaughtmon(void)
|
||||
StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_PC_BOX_TO_SEND_MON))); // box the mon was sent to
|
||||
GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gStringVar2);
|
||||
StringCopy(gStringVar3, GetBoxNamePtr(GetPCBoxToSendMon())); //box the mon was going to be sent to
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SOMEONES_BOX_FULL;
|
||||
}
|
||||
|
||||
// Change to B_MSG_SENT_LANETTES_PC or B_MSG_LANETTES_BOX_FULL
|
||||
if (FlagGet(FLAG_SYS_PC_LANETTE))
|
||||
gBattleCommunication[MULTISTRING_CHOOSER]++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user