Add Surge Abilities

This commit is contained in:
DizzyEggg 2019-02-09 14:30:16 +01:00
parent 872389b15c
commit 3d616dfffe
7 changed files with 139 additions and 34 deletions

View file

@ -678,6 +678,10 @@ gBattleAnims_General::
.4byte General_IngrainHeal
.4byte General_WishHeal
.4byte General_MegaEvolution
.4byte General_TerrainMisty
.4byte General_TerrainGrassy
.4byte General_TerrainElectric
.4byte General_TerrainPsychic
.align 2
gBattleAnims_Special::
@ -12790,6 +12794,18 @@ General_MegaEvolution:
blendoff
clearmonbg ANIM_ATTACKER
end
General_TerrainMisty:
end
General_TerrainGrassy:
end
General_TerrainElectric:
end
General_TerrainPsychic:
end
AnimScript_82D85A3:
createvisualtask sub_8172E9C, 2

View file

@ -1602,7 +1602,7 @@ BattleScript_EffectHitEscape:
setbyte sMOVEEND_STATE, 0x0
moveend 0x0, 0x0
jumpifbattleend BattleScript_HitEscapeEnd
jumpifbyte CMP_NOT_EQUAL gBattleOutcome 0 BattleScript_HitEscapeEnd
jumpifbyte CMP_NOT_EQUAL gBattleOutcome 0, BattleScript_HitEscapeEnd
jumpifcantswitch ATK4F_DONT_CHECK_STATUSES | BS_ATTACKER, BattleScript_HitEscapeEnd
openpartyscreen 0x1, BattleScript_HitEscapeEnd
switchoutabilities BS_ATTACKER
@ -5880,6 +5880,38 @@ BattleScript_SnowWarningActivates::
call BattleScript_WeatherFormChanges
end3
BattleScript_ElectricSurgeActivates::
pause 0x20
call BattleScript_AbilityPopUp
printstring STRINGID_TERRAINBECOMESELECTRIC
waitstate
playanimation BS_SCRIPTING, B_ANIM_TERRAIN_ELECTRIC, NULL
end3
BattleScript_MistySurgeActivates::
pause 0x20
call BattleScript_AbilityPopUp
printstring STRINGID_TERRAINBECOMESMISTY
waitstate
playanimation BS_SCRIPTING, B_ANIM_TERRAIN_MISTY, NULL
end3
BattleScript_GrassySurgeActivates::
pause 0x20
call BattleScript_AbilityPopUp
printstring STRINGID_TERRAINBECOMESGRASSY
waitstate
playanimation BS_SCRIPTING, B_ANIM_TERRAIN_GRASSY, NULL
end3
BattleScript_PsychicSurgeActivates::
pause 0x20
call BattleScript_AbilityPopUp
printstring STRINGID_TERRAINBECOMESPSYCHIC
waitstate
playanimation BS_SCRIPTING, B_ANIM_TERRAIN_PSYCHIC, NULL
end3
BattleScript_BadDreamsActivates::
setbyte gBattlerTarget, 0
call BattleScript_AbilityPopUp

View file

@ -289,5 +289,9 @@ extern const u8 BattleScript_MoveUsedPsychicTerrainPrevents[];
extern const u8 BattleScript_MoveUsedPowder[];
extern const u8 BattleScript_SelectingNotAllowedBelch[];
extern const u8 BattleScript_SelectingNotAllowedBelchInPalace[];
extern const u8 BattleScript_PsychicSurgeActivates[];
extern const u8 BattleScript_GrassySurgeActivates[];
extern const u8 BattleScript_MistySurgeActivates[];
extern const u8 BattleScript_ElectricSurgeActivates[];
#endif // GUARD_BATTLE_SCRIPTS_H

View file

@ -316,7 +316,7 @@
// . .
// . .
// 127
//
//
#define SOUND_PAN_ATTACKER -64
#define SOUND_PAN_TARGET 63
@ -374,6 +374,10 @@
#define B_ANIM_INGRAIN_HEAL 0x15
#define B_ANIM_WISH_HEAL 0x16
#define B_ANIM_MEGA_EVOLUTION 0x17
#define B_ANIM_TERRAIN_MISTY 0x18
#define B_ANIM_TERRAIN_GRASSY 0x19
#define B_ANIM_TERRAIN_ELECTRIC 0x1A
#define B_ANIM_TERRAIN_PSYCHIC 0x1B
// special animations table
#define B_ANIM_LVL_UP 0x0
@ -415,32 +419,32 @@
#define ANIM_WEATHER_HAIL 4
// Battle mon back animations.
#define BACK_ANIM_NONE 0x00
#define BACK_ANIM_H_SLIDE_QUICK 0x01
#define BACK_ANIM_H_SLIDE 0x02
#define BACK_ANIM_H_SLIDE_WITH_V_COMPRESS_1 0x03
#define BACK_ANIM_H_SLIDE_WITH_V_COMPRESS_2 0x04
#define BACK_ANIM_SHRINK_GROW_1 0x05
#define BACK_ANIM_GROW_1 0x06
#define BACK_ANIM_CIRCLE_MOVE_COUNTERCLOCKWISE 0x07
#define BACK_ANIM_HORIZONTAL_SHAKE 0x08
#define BACK_ANIM_VERTICAL_SHAKE 0x09
#define BACK_ANIM_V_SHAKE_WITH_H_SLIDE 0x0a
#define BACK_ANIM_VERTICAL_STRETCH 0x0b
#define BACK_ANIM_HORIZONTAL_STRETCH 0x0c
#define BACK_ANIM_GROW_2 0x0d
#define BACK_ANIM_V_SHAKE_WITH_PAUSE 0x0e
#define BACK_ANIM_CIRCLE_MOVE_CLOCKWISE 0x0f
#define BACK_ANIM_CONCAVE_DOWN_ARC_SWAY_SMALL 0x10
#define BACK_ANIM_CONCAVE_DOWN_ARC_SWAY_LARGE 0x11
#define BACK_ANIM_CONCAVE_UP_ARC_SWAY_LARGE 0x12
#define BACK_ANIM_DIP_RIGHT_SIDE 0x13
#define BACK_ANIM_SHRINK_GROW_2 0x14
#define BACK_ANIM_JOLT_RIGHT 0x15
#define BACK_ANIM_FLASH_YELLOW_WITH_SHAKE 0x16
#define BACK_ANIM_FADE_RED_WITH_SHAKE 0x17
#define BACK_ANIM_FADE_GREEN_WITH_SHAKE 0x18
#define BACK_ANIM_FADE_BLUE_WITH_SHAKE 0x19
#define BACK_ANIM_NONE 0x00
#define BACK_ANIM_H_SLIDE_QUICK 0x01
#define BACK_ANIM_H_SLIDE 0x02
#define BACK_ANIM_H_SLIDE_WITH_V_COMPRESS_1 0x03
#define BACK_ANIM_H_SLIDE_WITH_V_COMPRESS_2 0x04
#define BACK_ANIM_SHRINK_GROW_1 0x05
#define BACK_ANIM_GROW_1 0x06
#define BACK_ANIM_CIRCLE_MOVE_COUNTERCLOCKWISE 0x07
#define BACK_ANIM_HORIZONTAL_SHAKE 0x08
#define BACK_ANIM_VERTICAL_SHAKE 0x09
#define BACK_ANIM_V_SHAKE_WITH_H_SLIDE 0x0a
#define BACK_ANIM_VERTICAL_STRETCH 0x0b
#define BACK_ANIM_HORIZONTAL_STRETCH 0x0c
#define BACK_ANIM_GROW_2 0x0d
#define BACK_ANIM_V_SHAKE_WITH_PAUSE 0x0e
#define BACK_ANIM_CIRCLE_MOVE_CLOCKWISE 0x0f
#define BACK_ANIM_CONCAVE_DOWN_ARC_SWAY_SMALL 0x10
#define BACK_ANIM_CONCAVE_DOWN_ARC_SWAY_LARGE 0x11
#define BACK_ANIM_CONCAVE_UP_ARC_SWAY_LARGE 0x12
#define BACK_ANIM_DIP_RIGHT_SIDE 0x13
#define BACK_ANIM_SHRINK_GROW_2 0x14
#define BACK_ANIM_JOLT_RIGHT 0x15
#define BACK_ANIM_FLASH_YELLOW_WITH_SHAKE 0x16
#define BACK_ANIM_FADE_RED_WITH_SHAKE 0x17
#define BACK_ANIM_FADE_GREEN_WITH_SHAKE 0x18
#define BACK_ANIM_FADE_BLUE_WITH_SHAKE 0x19
#endif // GUARD_CONSTANTS_BATTLE_ANIM_H

View file

@ -113,7 +113,8 @@
#define HOLD_EFFECT_MEGA_STONE 130
// Gen7 hold effects
#define HOLD_EFFECT_PROTECTIVE_PADS 149
#define HOLD_EFFECT_PROTECTIVE_PADS 149
#define HOLD_EFFECT_TERRAIN_EXTENDER 150
#define HOLD_EFFECT_CHOICE(holdEffect)((holdEffect == HOLD_EFFECT_CHOICE_BAND || holdEffect == HOLD_EFFECT_CHOICE_SCARF || holdEffect == HOLD_EFFECT_CHOICE_SPECS))

View file

@ -6245,9 +6245,12 @@ static void HandleTerrainMove(u32 moveEffect)
}
else
{
gFieldStatuses &= ~(STATUS_FIELD_MISTY_TERRAIN | STATUS_FIELD_GRASSY_TERRAIN | EFFECT_ELECTRIC_TERRAIN | EFFECT_PSYCHIC_TERRAIN);
gFieldStatuses &= ~(STATUS_FIELD_MISTY_TERRAIN | STATUS_FIELD_GRASSY_TERRAIN | STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_PSYCHIC_TERRAIN);
gFieldStatuses |= statusFlag;
*timer = 5;
if (GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_TERRAIN_EXTENDER)
*timer = 8;
else
*timer = 5;
gBattlescriptCurrInstr += 7;
}
}

View file

@ -2568,10 +2568,27 @@ bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility)
return TRUE;
}
else
return FALSE;
}
static bool32 TryChangeBattleTerrain(u32 battler, u32 statusFlag, u8 *timer)
{
if (!(gFieldStatuses & statusFlag))
{
return FALSE;
gFieldStatuses &= ~(STATUS_FIELD_MISTY_TERRAIN | STATUS_FIELD_GRASSY_TERRAIN | EFFECT_ELECTRIC_TERRAIN | EFFECT_PSYCHIC_TERRAIN);
gFieldStatuses |= statusFlag;
if (GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_TERRAIN_EXTENDER)
*timer = 8;
else
*timer = 5;
gBattlerAttacker = gBattleScripting.battler = battler;
return TRUE;
}
return FALSE;
}
u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveArg)
@ -2780,6 +2797,34 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
effect++;
}
break;
case ABILITY_ELECTRIC_SURGE:
if (TryChangeBattleTerrain(battler, STATUS_FIELD_ELECTRIC_TERRAIN, &gFieldTimers.electricTerrainTimer))
{
BattleScriptPushCursorAndCallback(BattleScript_ElectricSurgeActivates);
effect++;
}
break;
case ABILITY_GRASSY_SURGE:
if (TryChangeBattleTerrain(battler, STATUS_FIELD_GRASSY_TERRAIN, &gFieldTimers.grassyTerrainTimer))
{
BattleScriptPushCursorAndCallback(BattleScript_GrassySurgeActivates);
effect++;
}
break;
case ABILITY_MISTY_SURGE:
if (TryChangeBattleTerrain(battler, STATUS_FIELD_MISTY_TERRAIN, &gFieldTimers.mistyTerrainTimer))
{
BattleScriptPushCursorAndCallback(BattleScript_MistySurgeActivates);
effect++;
}
break;
case ABILITY_PSYCHIC_SURGE:
if (TryChangeBattleTerrain(battler, STATUS_FIELD_PSYCHIC_TERRAIN, &gFieldTimers.psychicTerrainTimer))
{
BattleScriptPushCursorAndCallback(BattleScript_PsychicSurgeActivates);
effect++;
}
break;
case ABILITY_INTIMIDATE:
if (!(gSpecialStatuses[battler].intimidatedMon))
{
@ -3454,7 +3499,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
{
BattleScriptPushCursorAndCallback(BattleScript_TraceActivates);
gStatuses3[i] &= ~(STATUS3_TRACE);
gBattleScripting.battler = i;
gBattlerAbility = gBattleScripting.battler = i;
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gActiveBattler, gBattlerPartyIndexes[gActiveBattler])
PREPARE_ABILITY_BUFFER(gBattleTextBuff2, gLastUsedAbility)