Merge pull request #1295 from ghoulslash/terrain
Various Terrain Effects and Fixes
This commit is contained in:
commit
255a635237
14 changed files with 109 additions and 62 deletions
|
@ -817,10 +817,6 @@ gBattleAnims_General::
|
|||
.4byte General_IngrainHeal @ B_ANIM_INGRAIN_HEAL
|
||||
.4byte General_WishHeal @ B_ANIM_WISH_HEAL
|
||||
.4byte General_MegaEvolution @ B_ANIM_MEGA_EVOLUTION
|
||||
.4byte General_TerrainMisty @ B_ANIM_TERRAIN_MISTY
|
||||
.4byte General_TerrainGrassy @ B_ANIM_TERRAIN_GRASSY
|
||||
.4byte General_TerrainElectric @ B_ANIM_TERRAIN_ELECTRIC
|
||||
.4byte General_TerrainPsychic @ B_ANIM_TERRAIN_PSYCHIC
|
||||
.4byte General_IllusionOff @ B_ANIM_ILLUSION_OFF
|
||||
.4byte General_FormChange @ B_ANIM_FORM_CHANGE
|
||||
.4byte General_SlideOffScreen @ B_ANIM_SLIDE_OFFSCREEN
|
||||
|
@ -8478,8 +8474,6 @@ Move_GRASSY_TERRAIN::
|
|||
delay 4
|
||||
createvisualtask AnimTask_BlendBattleAnimPal, 10, ANIM_PAL_BG, 3, 4, 0, RGB(31, 24, 31)
|
||||
waitforvisualfinish
|
||||
restorebg
|
||||
waitbgfadein
|
||||
end
|
||||
|
||||
Move_MISTY_TERRAIN::
|
||||
|
@ -8518,8 +8512,6 @@ Move_MISTY_TERRAIN::
|
|||
delay 4
|
||||
createvisualtask AnimTask_BlendBattleAnimPal, 10, ANIM_PAL_BG, 3, 7, 0, RGB(31, 24, 31)
|
||||
waitforvisualfinish
|
||||
restorebg
|
||||
waitbgfadein
|
||||
end
|
||||
|
||||
Move_ELECTRIFY::
|
||||
|
@ -9403,8 +9395,6 @@ Move_ELECTRIC_TERRAIN::
|
|||
delay 2
|
||||
createvisualtask AnimTask_BlendBattleAnimPal, 10, ANIM_PAL_BG, 3, 4, 0, RGB(28, 28, 0)
|
||||
waitforvisualfinish
|
||||
restorebg
|
||||
waitbgfadein
|
||||
end
|
||||
|
||||
Move_DAZZLING_GLEAM::
|
||||
|
@ -11060,8 +11050,6 @@ Move_PSYCHIC_TERRAIN::
|
|||
delay 4
|
||||
createvisualtask AnimTask_BlendBattleAnimPal, 10, ANIM_PAL_BG, 3, 4, 0, RGB(27, 0, 13)
|
||||
waitforvisualfinish
|
||||
restorebg
|
||||
waitbgfadein
|
||||
end
|
||||
|
||||
Move_LUNGE::
|
||||
|
@ -24384,18 +24372,6 @@ MegaEvolutionParticles:
|
|||
delay 3
|
||||
return
|
||||
|
||||
General_TerrainMisty:
|
||||
end
|
||||
|
||||
General_TerrainGrassy:
|
||||
end
|
||||
|
||||
General_TerrainElectric:
|
||||
end
|
||||
|
||||
General_TerrainPsychic:
|
||||
end
|
||||
|
||||
General_RestoreBg:
|
||||
restorebg
|
||||
waitbgfadein
|
||||
|
|
|
@ -1520,6 +1520,7 @@ BattleScript_EffectPsychicTerrain:
|
|||
waitanimation
|
||||
printfromtable gTerrainStringIds
|
||||
waitmessage 0x40
|
||||
playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG, NULL
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectTopsyTurvy:
|
||||
|
@ -5403,6 +5404,12 @@ BattleScript_OverworldWeatherStarts::
|
|||
playanimation2 BS_ATTACKER, sB_ANIM_ARG1, NULL
|
||||
end3
|
||||
|
||||
BattleScript_OverworldTerrain::
|
||||
printfromtable gTerrainStringIds
|
||||
waitmessage 0x40
|
||||
playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG, NULL
|
||||
end3
|
||||
|
||||
BattleScript_SideStatusWoreOff::
|
||||
printstring STRINGID_PKMNSXWOREOFF
|
||||
waitmessage 0x40
|
||||
|
@ -6887,32 +6894,32 @@ BattleScript_ElectricSurgeActivates::
|
|||
pause 0x20
|
||||
call BattleScript_AbilityPopUp
|
||||
printstring STRINGID_TERRAINBECOMESELECTRIC
|
||||
waitstate
|
||||
playanimation BS_SCRIPTING, B_ANIM_TERRAIN_ELECTRIC, NULL
|
||||
waitmessage 0x40
|
||||
playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG, NULL
|
||||
end3
|
||||
|
||||
BattleScript_MistySurgeActivates::
|
||||
pause 0x20
|
||||
call BattleScript_AbilityPopUp
|
||||
printstring STRINGID_TERRAINBECOMESMISTY
|
||||
waitstate
|
||||
playanimation BS_SCRIPTING, B_ANIM_TERRAIN_MISTY, NULL
|
||||
waitmessage 0x40
|
||||
playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG, NULL
|
||||
end3
|
||||
|
||||
BattleScript_GrassySurgeActivates::
|
||||
pause 0x20
|
||||
call BattleScript_AbilityPopUp
|
||||
printstring STRINGID_TERRAINBECOMESGRASSY
|
||||
waitstate
|
||||
playanimation BS_SCRIPTING, B_ANIM_TERRAIN_GRASSY, NULL
|
||||
waitmessage 0x40
|
||||
playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG, NULL
|
||||
end3
|
||||
|
||||
BattleScript_PsychicSurgeActivates::
|
||||
pause 0x20
|
||||
call BattleScript_AbilityPopUp
|
||||
printstring STRINGID_TERRAINBECOMESPSYCHIC
|
||||
waitstate
|
||||
playanimation BS_SCRIPTING, B_ANIM_TERRAIN_PSYCHIC, NULL
|
||||
waitmessage 0x40
|
||||
playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG, NULL
|
||||
end3
|
||||
|
||||
BattleScript_BadDreamsActivates::
|
||||
|
@ -7100,7 +7107,9 @@ BattleScript_GrassyTerrainLoopIncrement::
|
|||
jumpifbytenotequal gBattleCommunication, gBattlersCount, BattleScript_GrassyTerrainLoop
|
||||
BattleScript_GrassyTerrainLoopEnd::
|
||||
bicword gHitMarker, HITMARKER_x20 | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000
|
||||
jumpifword CMP_COMMON_BITS, gFieldStatuses, STATUS_FIELD_TERRAIN_PERMANENT, BattleScript_GrassyTerrainHealEnd
|
||||
jumpifbyte CMP_EQUAL, gFieldTimers + 5, 0x0, BattleScript_GrassyTerrainEnds
|
||||
BattleScript_GrassyTerrainHealEnd:
|
||||
end2
|
||||
|
||||
BattleScript_AbilityNoSpecificStatLoss::
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "constants/apprentice.h"
|
||||
#include "constants/battle.h"
|
||||
#include "constants/battle_arena.h"
|
||||
#include "constants/battle_config.h"
|
||||
#include "constants/battle_dome.h"
|
||||
#include "constants/battle_factory.h"
|
||||
#include "constants/battle_frontier.h"
|
||||
|
|
|
@ -503,6 +503,7 @@ struct BattleStruct
|
|||
u8 wishPerishSongState;
|
||||
u8 wishPerishSongBattlerId;
|
||||
bool8 overworldWeatherDone;
|
||||
bool8 terrainDone;
|
||||
u8 atkCancellerTracker;
|
||||
struct BattleTvMovePoints tvMovePoints;
|
||||
struct BattleTv tv;
|
||||
|
|
|
@ -48,6 +48,7 @@ extern const u8 BattleScript_SandStormHailEnds[];
|
|||
extern const u8 BattleScript_SunlightContinues[];
|
||||
extern const u8 BattleScript_SunlightFaded[];
|
||||
extern const u8 BattleScript_OverworldWeatherStarts[];
|
||||
extern const u8 BattleScript_OverworldTerrain[];
|
||||
extern const u8 BattleScript_SideStatusWoreOff[];
|
||||
extern const u8 BattleScript_SafeguardProtected[];
|
||||
extern const u8 BattleScript_SafeguardEnds[];
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#define ABILITYEFFECT_TRACE1 0xC
|
||||
#define ABILITYEFFECT_TRACE2 0xD
|
||||
#define ABILITYEFFECT_MOVE_END_OTHER 0xE
|
||||
#define ABILITYEFFECT_SWITCH_IN_TERRAIN 0xFE
|
||||
#define ABILITYEFFECT_SWITCH_IN_WEATHER 0xFF
|
||||
|
||||
#define ITEMEFFECT_ON_SWITCH_IN 0x0
|
||||
|
|
|
@ -221,18 +221,19 @@
|
|||
#define SIDE_STATUS_MAT_BLOCK (1 << 21)
|
||||
|
||||
// Field affecting statuses.
|
||||
#define STATUS_FIELD_MAGIC_ROOM 0x1
|
||||
#define STATUS_FIELD_TRICK_ROOM 0x2
|
||||
#define STATUS_FIELD_WONDER_ROOM 0x4
|
||||
#define STATUS_FIELD_MUDSPORT 0x8
|
||||
#define STATUS_FIELD_WATERSPORT 0x10
|
||||
#define STATUS_FIELD_GRAVITY 0x20
|
||||
#define STATUS_FIELD_GRASSY_TERRAIN 0x40
|
||||
#define STATUS_FIELD_MISTY_TERRAIN 0x80
|
||||
#define STATUS_FIELD_ELECTRIC_TERRAIN 0x100
|
||||
#define STATUS_FIELD_PSYCHIC_TERRAIN 0x200
|
||||
#define STATUS_FIELD_ION_DELUGE 0x400
|
||||
#define STATUS_FIELD_FAIRY_LOCK 0x800
|
||||
#define STATUS_FIELD_MAGIC_ROOM (1 << 0)
|
||||
#define STATUS_FIELD_TRICK_ROOM (1 << 1)
|
||||
#define STATUS_FIELD_WONDER_ROOM (1 << 2)
|
||||
#define STATUS_FIELD_MUDSPORT (1 << 3)
|
||||
#define STATUS_FIELD_WATERSPORT (1 << 4)
|
||||
#define STATUS_FIELD_GRAVITY (1 << 5)
|
||||
#define STATUS_FIELD_GRASSY_TERRAIN (1 << 6)
|
||||
#define STATUS_FIELD_MISTY_TERRAIN (1 << 7)
|
||||
#define STATUS_FIELD_ELECTRIC_TERRAIN (1 << 8)
|
||||
#define STATUS_FIELD_PSYCHIC_TERRAIN (1 << 9)
|
||||
#define STATUS_FIELD_ION_DELUGE (1 << 10)
|
||||
#define STATUS_FIELD_FAIRY_LOCK (1 << 11)
|
||||
#define STATUS_FIELD_TERRAIN_PERMANENT (1 << 12) // Overworld thunderstorm generates electric terrain
|
||||
|
||||
#define STATUS_TERRAIN_ANY (STATUS_FIELD_GRASSY_TERRAIN | STATUS_FIELD_MISTY_TERRAIN | STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_PSYCHIC_TERRAIN)
|
||||
|
||||
|
|
|
@ -518,15 +518,11 @@
|
|||
#define B_ANIM_INGRAIN_HEAL 21
|
||||
#define B_ANIM_WISH_HEAL 22
|
||||
#define B_ANIM_MEGA_EVOLUTION 23
|
||||
#define B_ANIM_TERRAIN_MISTY 24
|
||||
#define B_ANIM_TERRAIN_GRASSY 25
|
||||
#define B_ANIM_TERRAIN_ELECTRIC 26
|
||||
#define B_ANIM_TERRAIN_PSYCHIC 27
|
||||
#define B_ANIM_ILLUSION_OFF 28
|
||||
#define B_ANIM_FORM_CHANGE 29
|
||||
#define B_ANIM_SLIDE_OFFSCREEN 30 // for Emergency Exit
|
||||
#define B_ANIM_RESTORE_BG 31 // for Terrain Endings
|
||||
#define B_ANIM_TOTEM_FLARE 32 // Totem boosts aura flare
|
||||
#define B_ANIM_ILLUSION_OFF 24
|
||||
#define B_ANIM_FORM_CHANGE 25
|
||||
#define B_ANIM_SLIDE_OFFSCREEN 26 // for Emergency Exit
|
||||
#define B_ANIM_RESTORE_BG 27 // for Terrain Endings
|
||||
#define B_ANIM_TOTEM_FLARE 28 // Totem boosts aura flare
|
||||
|
||||
// special animations table (gBattleAnims_Special)
|
||||
#define B_ANIM_LVL_UP 0
|
||||
|
|
|
@ -135,6 +135,11 @@
|
|||
#define B_FLAG_INVERSE_BATTLE 0 // If this flag is set, the battle's type effectiveness are inversed. For example, fire is super effective against water.
|
||||
#define B_FLAG_FORCE_DOUBLE_WILD 0 // If this flag is set, all land and surfing wild battles will be double battles.
|
||||
|
||||
// Var Settings
|
||||
// To use the following features in scripting, replace the 0s with the var ID you're assigning it to.
|
||||
// Eg: Replace with VAR_UNUSED_0x40F7 so you can use VAR_TERRAIN for that feature.
|
||||
#define VAR_TERRAIN 0 // If this var has a value, assigning a STATUS_FIELD_xx_TERRAIN to it before battle causes the battle to start with that terrain active
|
||||
|
||||
// Interface settings
|
||||
#define B_ABILITY_POP_UP TRUE // In Gen5+, the Pokémon abilities are displayed in a pop-up, when they activate in battle.
|
||||
#define B_FAST_INTRO TRUE // If set to TRUE, battle intro texts print at the same time as animation of a Pokémon, as opposing to waiting for the animation to end.
|
||||
|
@ -151,6 +156,7 @@
|
|||
#define B_PARALYZE_ELECTRIC GEN_6 // In Gen6+, Electric-type Pokémon can't be paralyzed.
|
||||
#define B_POWDER_GRASS GEN_6 // In Gen6+, Grass-type Pokémon are immune to powder and spore moves.
|
||||
#define B_STEEL_RESISTANCES GEN_6 // In Gen6+, Steel-type Pokémon are no longer resistant to Dark and Ghost moves.
|
||||
#define B_THUNDERSTORM_TERRAIN TRUE // If TRUE, overworld Thunderstorm generates Rain and Electric Terrain as in Gen 8.
|
||||
|
||||
// Animation Settings
|
||||
#define B_NEW_SWORD_PARTICLE FALSE // If set to TRUE, it updates Swords Dance's particle.
|
||||
|
|
|
@ -965,10 +965,7 @@ static void TryToggleHealboxVisibility(u8 priority, u8 healthboxLeftSpriteId, u8
|
|||
case B_ANIM_WISH_HEAL:
|
||||
//new
|
||||
case B_ANIM_MEGA_EVOLUTION:
|
||||
case B_ANIM_TERRAIN_MISTY:
|
||||
case B_ANIM_TERRAIN_GRASSY:
|
||||
case B_ANIM_TERRAIN_ELECTRIC:
|
||||
case B_ANIM_TERRAIN_PSYCHIC:
|
||||
case B_ANIM_RESTORE_BG:
|
||||
break;
|
||||
}
|
||||
return; //all other special anims dont hide
|
||||
|
|
|
@ -3490,6 +3490,12 @@ static void TryDoEventsBeforeFirstTurn(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!gBattleStruct->terrainDone && AbilityBattleEffects(0, 0, 0, ABILITYEFFECT_SWITCH_IN_TERRAIN, 0) != 0)
|
||||
{
|
||||
gBattleStruct->terrainDone = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
// Totem boosts
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
|
|
|
@ -4403,6 +4403,15 @@ static void Cmd_playanimation(void)
|
|||
|
||||
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
|
||||
argumentPtr = T2_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
|
||||
#if B_TERRAIN_BG_CHANGE == FALSE
|
||||
if (gBattlescriptCurrInstr[2] == B_ANIM_RESTORE_BG)
|
||||
{
|
||||
// workaround for .if not working
|
||||
gBattlescriptCurrInstr += 7;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gBattlescriptCurrInstr[2] == B_ANIM_STATS_CHANGE
|
||||
|| gBattlescriptCurrInstr[2] == B_ANIM_SNATCH_MOVE
|
||||
|
|
|
@ -2000,16 +2000,18 @@ u8 DoFieldEndTurnEffects(void)
|
|||
gBattleStruct->turnCountersTracker++;
|
||||
break;
|
||||
case ENDTURN_ELECTRIC_TERRAIN:
|
||||
if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN && --gFieldTimers.electricTerrainTimer == 0)
|
||||
if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN
|
||||
&& ((!gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.electricTerrainTimer == 0))
|
||||
{
|
||||
gFieldStatuses &= ~(STATUS_FIELD_ELECTRIC_TERRAIN);
|
||||
gFieldStatuses &= ~(STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_TERRAIN_PERMANENT);
|
||||
BattleScriptExecute(BattleScript_ElectricTerrainEnds);
|
||||
effect++;
|
||||
}
|
||||
gBattleStruct->turnCountersTracker++;
|
||||
break;
|
||||
case ENDTURN_MISTY_TERRAIN:
|
||||
if (gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN && --gFieldTimers.mistyTerrainTimer == 0)
|
||||
if (gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN
|
||||
&& ((!gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.mistyTerrainTimer == 0))
|
||||
{
|
||||
gFieldStatuses &= ~(STATUS_FIELD_MISTY_TERRAIN);
|
||||
BattleScriptExecute(BattleScript_MistyTerrainEnds);
|
||||
|
@ -2020,15 +2022,18 @@ u8 DoFieldEndTurnEffects(void)
|
|||
case ENDTURN_GRASSY_TERRAIN:
|
||||
if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN)
|
||||
{
|
||||
if (gFieldTimers.grassyTerrainTimer == 0 || --gFieldTimers.grassyTerrainTimer == 0)
|
||||
if (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT)
|
||||
&& (gFieldTimers.grassyTerrainTimer == 0 || --gFieldTimers.grassyTerrainTimer == 0))
|
||||
gFieldStatuses &= ~(STATUS_FIELD_GRASSY_TERRAIN);
|
||||
|
||||
BattleScriptExecute(BattleScript_GrassyTerrainHeals);
|
||||
effect++;
|
||||
}
|
||||
gBattleStruct->turnCountersTracker++;
|
||||
break;
|
||||
case ENDTURN_PSYCHIC_TERRAIN:
|
||||
if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN && --gFieldTimers.psychicTerrainTimer == 0)
|
||||
if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN
|
||||
&& ((!gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.psychicTerrainTimer == 0))
|
||||
{
|
||||
gFieldStatuses &= ~(STATUS_FIELD_PSYCHIC_TERRAIN);
|
||||
BattleScriptExecute(BattleScript_PsychicTerrainEnds);
|
||||
|
@ -3636,6 +3641,41 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
|||
gBattleScripting.battler = battler;
|
||||
switch (gLastUsedAbility)
|
||||
{
|
||||
case ABILITYEFFECT_SWITCH_IN_TERRAIN:
|
||||
if (VarGet(VAR_TERRAIN) & STATUS_TERRAIN_ANY)
|
||||
{
|
||||
u16 terrainFlags = VarGet(VAR_TERRAIN) & STATUS_TERRAIN_ANY; // only works for status flag (1 << 15)
|
||||
gFieldStatuses = terrainFlags | STATUS_FIELD_TERRAIN_PERMANENT; // terrain is permanent
|
||||
switch (VarGet(VAR_TERRAIN) & STATUS_TERRAIN_ANY)
|
||||
{
|
||||
case STATUS_FIELD_ELECTRIC_TERRAIN:
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
|
||||
break;
|
||||
case STATUS_FIELD_MISTY_TERRAIN:
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
break;
|
||||
case STATUS_FIELD_GRASSY_TERRAIN:
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
break;
|
||||
case STATUS_FIELD_PSYCHIC_TERRAIN:
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
BattleScriptPushCursorAndCallback(BattleScript_OverworldTerrain);
|
||||
effect++;
|
||||
}
|
||||
#if B_THUNDERSTORM_TERRAIN == TRUE
|
||||
else if (GetCurrentWeather() == WEATHER_RAIN_THUNDERSTORM && !(gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN))
|
||||
{
|
||||
// overworld weather started rain, so just do electric terrain anim
|
||||
gFieldStatuses = (STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_TERRAIN_PERMANENT);
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
|
||||
BattleScriptPushCursorAndCallback(BattleScript_OverworldTerrain);
|
||||
effect++;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case ABILITYEFFECT_SWITCH_IN_WEATHER:
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED))
|
||||
{
|
||||
|
|
|
@ -402,6 +402,9 @@ static void Overworld_ResetStateAfterWhiteOut(void)
|
|||
FlagClear(FLAG_SYS_SAFARI_MODE);
|
||||
FlagClear(FLAG_SYS_USE_STRENGTH);
|
||||
FlagClear(FLAG_SYS_USE_FLASH);
|
||||
#if VAR_TERRAIN != 0
|
||||
VarSet(VAR_TERRAIN, 0);
|
||||
#endif
|
||||
// If you were defeated by Kyogre/Groudon and the step counter has
|
||||
// maxed out, end the abnormal weather.
|
||||
if (VarGet(VAR_SHOULD_END_ABNORMAL_WEATHER) == 1)
|
||||
|
|
Loading…
Reference in a new issue