Anticipation clean-up

This commit is contained in:
DizzyEggg 2020-04-11 12:34:53 +02:00
parent 6078cd3e15
commit d28992d2ed
3 changed files with 26 additions and 39 deletions

View File

@ -587,7 +587,7 @@ static const u8 sText_SlowStartEnters[] = _("{B_ATK_NAME_WITH_PREFIX} can't get
static const u8 sText_SlowStartEnd[] = _("{B_ATK_NAME_WITH_PREFIX} finally got its act together!"); static const u8 sText_SlowStartEnd[] = _("{B_ATK_NAME_WITH_PREFIX} finally got its act together!");
static const u8 sText_SolarPowerHpDrop[] = _("The {B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY}\ntakes its toll!"); static const u8 sText_SolarPowerHpDrop[] = _("The {B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY}\ntakes its toll!");
static const u8 sText_AftermathDmg[] = _("{B_ATK_NAME_WITH_PREFIX} is hurt!"); static const u8 sText_AftermathDmg[] = _("{B_ATK_NAME_WITH_PREFIX} is hurt!");
static const u8 sText_AnticipationActivates[] = _("The {B_ATK_NAME_WITH_PREFIX} shuddered\nin anticipation!"); static const u8 sText_AnticipationActivates[] = _("{B_ATK_NAME_WITH_PREFIX} shuddered\nin anticipation!");
static const u8 sText_ForewarnActivates[] = _("{B_ATK_ABILITY} alerted the {B_ATK_NAME_WITH_PREFIX} to the\n{B_DEF_NAME_WITH_PREFIX}'s {B_BUFF1}!"); static const u8 sText_ForewarnActivates[] = _("{B_ATK_ABILITY} alerted the {B_ATK_NAME_WITH_PREFIX} to the\n{B_DEF_NAME_WITH_PREFIX}'s {B_BUFF1}!");
static const u8 sText_IceBodyHpGain[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY}\nhealed it a little bit!"); static const u8 sText_IceBodyHpGain[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY}\nhealed it a little bit!");
static const u8 sText_SnowWarningHail[] = _("It started to hail!"); static const u8 sText_SnowWarningHail[] = _("It started to hail!");

View File

@ -2734,7 +2734,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
u32 speciesAtk, speciesDef; u32 speciesAtk, speciesDef;
u32 pidAtk, pidDef; u32 pidAtk, pidDef;
u32 moveType, move; u32 moveType, move;
u32 i; u32 i, j;
if (gBattleTypeFlags & BATTLE_TYPE_SAFARI) if (gBattleTypeFlags & BATTLE_TYPE_SAFARI)
return 0; return 0;
@ -2864,45 +2864,32 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
} }
break; break;
case ABILITY_ANTICIPATION: case ABILITY_ANTICIPATION:
if (!gSpecialStatuses[battler].switchInAbilityDone)
{ {
bool16 shudders = FALSE; u32 side = GetBattlerSide(battler);
u8 side = (GetBattlerPosition(battler) ^ BIT_SIDE) & BIT_SIDE; // side of the opposing pokemon
u8 target1 = GetBattlerAtPosition(side);
u8 target2 = GetBattlerAtPosition(side + BIT_FLANK);
if (IsBattlerAlive(target1)) for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{ {
for(i = 0; i < MAX_MON_MOVES; i++) if (IsBattlerAlive(i) && side != GetBattlerSide(i))
{ {
move = gBattleMons[target1].moves[i]; for (j = 0; j < MAX_MON_MOVES; j++)
{
move = gBattleMons[i].moves[j];
GET_MOVE_TYPE(move, moveType); GET_MOVE_TYPE(move, moveType);
if(CalcTypeEffectivenessMultiplier(move, moveType, target1, battler, FALSE) >= UQ_4_12(2.0)) if (CalcTypeEffectivenessMultiplier(move, moveType, i, battler, FALSE) >= UQ_4_12(2.0))
{ {
shudders = TRUE; effect++;
break; break;
} }
} }
} }
}
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsBattlerAlive(target2)) if (effect)
{
for(i = 0; i < MAX_MON_MOVES; i++)
{
move = gBattleMons[target2].moves[i];
GET_MOVE_TYPE(move, moveType);
if(CalcTypeEffectivenessMultiplier(move, moveType, target2, battler, FALSE) >= UQ_4_12(2.0))
{
shudders = TRUE;
break;
}
}
}
if (!gSpecialStatuses[battler].switchInAbilityDone && shudders)
{ {
gBattleCommunication[MULTISTRING_CHOOSER] = 5; gBattleCommunication[MULTISTRING_CHOOSER] = 5;
gSpecialStatuses[battler].switchInAbilityDone = 1; gSpecialStatuses[battler].switchInAbilityDone = 1;
BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg);
effect++;
} }
} }
break; break;