Anticipation ability (#282)

This commit is contained in:
Eduardo Alvaro Quezada D'Ottone 2020-04-11 06:24:25 -04:00 committed by GitHub
parent bfd1874945
commit 6078cd3e15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 54 additions and 2 deletions

View file

@ -5880,6 +5880,13 @@ BattleScript_IllusionOff::
waitmessage 0x40
return
BattleScript_AnticipationActivates::
pause 0x5
call BattleScript_AbilityPopUp
printstring STRINGID_ANTICIPATIONACTIVATES
waitmessage 0x40
return
BattleScript_AftermathDmg::
pause 0x20
call BattleScript_AbilityPopUp

View file

@ -330,5 +330,6 @@ extern const u8 BattleScript_DancerActivates[];
extern const u8 BattleScript_AftermathDmg[];
extern const u8 BattleScript_StanceChangeActivates[];
extern const u8 BattleScript_DisguiseBustedActivates[];
extern const u8 BattleScript_AnticipationActivates[];
#endif // GUARD_BATTLE_SCRIPTS_H

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_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_AnticipationActivates[] = _("The {B_ATK_NAME_WITH_PREFIX} shuddered in {B_ATK_ABILITY}!");
static const u8 sText_AnticipationActivates[] = _("The {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_IceBodyHpGain[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY}\nhealed it a little bit!");
static const u8 sText_SnowWarningHail[] = _("It started to hail!");
@ -1220,7 +1220,8 @@ const u16 gDmgHazardsStringIds[] =
const u16 gSwitchInAbilityStringIds[] =
{
STRINGID_MOLDBREAKERENTERS, STRINGID_TERAVOLTENTERS, STRINGID_TURBOBLAZEENTERS, STRINGID_SLOWSTARTENTERS, STRINGID_UNNERVEENTERS
STRINGID_MOLDBREAKERENTERS, STRINGID_TERAVOLTENTERS, STRINGID_TURBOBLAZEENTERS,
STRINGID_SLOWSTARTENTERS, STRINGID_UNNERVEENTERS, STRINGID_ANTICIPATIONACTIVATES
};
const u16 gMissStringIds[] =

View file

@ -2863,6 +2863,49 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
effect++;
}
break;
case ABILITY_ANTICIPATION:
{
bool16 shudders = FALSE;
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_MON_MOVES; i++)
{
move = gBattleMons[target1].moves[i];
GET_MOVE_TYPE(move, moveType);
if(CalcTypeEffectivenessMultiplier(move, moveType, target1, battler, FALSE) >= UQ_4_12(2.0))
{
shudders = TRUE;
break;
}
}
}
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsBattlerAlive(target2))
{
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;
gSpecialStatuses[battler].switchInAbilityDone = 1;
BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg);
effect++;
}
}
break;
case ABILITY_DOWNLOAD:
if (!gSpecialStatuses[battler].switchInAbilityDone)
{