mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 11:44:17 +01:00
Extra review changes
-Foolproofed the ability checks in ABILITYEFFECT_ON_WEATHER and ABILITYEFFECT_ON_TERRAIN -Made BattleScript_OverworldWeatherStarts and BattleScript_OverworldTerrain call the battle scripts that handle weather form changes, weather abilities, terrain seeds and terrain abilities. -Consequentially, I removed the activation for weather and terrain abilities that I added to TryDoEventsBeforeFirstTurn, and the activation of Protosynthesis in ABILITYEFFECT_ON_SWITCHIN. -Added a weatherAbilityDone to prevent abilities that lack self-checks like Protosynthesis from getting stuck in a loop. -Removed now pointless ABILITYEFFECT_WEATHER_FORM. I think Duke/Sneed69 added it to fix Castform's form change, but it no longer serves a purpose.
This commit is contained in:
parent
91b2e1bb50
commit
620a6a5e90
@ -6708,12 +6708,14 @@ BattleScript_OverworldWeatherStarts::
|
||||
printfromtable gWeatherStartsStringIds
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
playanimation_var BS_ATTACKER, sB_ANIM_ARG1
|
||||
call BattleScript_WeatherFormChanges
|
||||
end3
|
||||
|
||||
BattleScript_OverworldTerrain::
|
||||
printfromtable gTerrainStringIds
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG
|
||||
call BattleScript_TerrainSeedLoop
|
||||
end3
|
||||
|
||||
BattleScript_SideStatusWoreOff::
|
||||
|
@ -192,6 +192,7 @@ struct SpecialStatus
|
||||
u8 dancerUsedMove:1;
|
||||
u8 dancerOriginalTarget:3;
|
||||
// End of byte
|
||||
u8 weatherAbilityDone:1;
|
||||
u8 terrainAbilityDone:1;
|
||||
};
|
||||
|
||||
|
@ -26,16 +26,15 @@
|
||||
#define ABILITYEFFECT_MOVE_END_ATTACKER 4
|
||||
#define ABILITYEFFECT_MOVE_END 5
|
||||
#define ABILITYEFFECT_IMMUNITY 6
|
||||
#define ABILITYEFFECT_WEATHER_FORM 7
|
||||
#define ABILITYEFFECT_SYNCHRONIZE 8
|
||||
#define ABILITYEFFECT_ATK_SYNCHRONIZE 9
|
||||
#define ABILITYEFFECT_TRACE1 10
|
||||
#define ABILITYEFFECT_TRACE2 11
|
||||
#define ABILITYEFFECT_MOVE_END_OTHER 12
|
||||
#define ABILITYEFFECT_NEUTRALIZINGGAS 13
|
||||
#define ABILITYEFFECT_FIELD_SPORT 14 // Only used if B_SPORT_TURNS < GEN_6
|
||||
#define ABILITYEFFECT_ON_WEATHER 15
|
||||
#define ABILITYEFFECT_ON_TERRAIN 16
|
||||
#define ABILITYEFFECT_SYNCHRONIZE 7
|
||||
#define ABILITYEFFECT_ATK_SYNCHRONIZE 8
|
||||
#define ABILITYEFFECT_TRACE1 9
|
||||
#define ABILITYEFFECT_TRACE2 10
|
||||
#define ABILITYEFFECT_MOVE_END_OTHER 11
|
||||
#define ABILITYEFFECT_NEUTRALIZINGGAS 12
|
||||
#define ABILITYEFFECT_FIELD_SPORT 13 // Only used if B_SPORT_TURNS < GEN_6
|
||||
#define ABILITYEFFECT_ON_WEATHER 14
|
||||
#define ABILITYEFFECT_ON_TERRAIN 15
|
||||
// Special cases
|
||||
#define ABILITYEFFECT_MUD_SPORT 252 // Only used if B_SPORT_TURNS < GEN_6
|
||||
#define ABILITYEFFECT_WATER_SPORT 253 // Only used if B_SPORT_TURNS < GEN_6
|
||||
|
@ -3720,10 +3720,6 @@ static void TryDoEventsBeforeFirstTurn(void)
|
||||
gBattlerAttacker = gBattlerByTurnOrder[gBattleStruct->switchInAbilitiesCounter++];
|
||||
if (AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, gBattlerAttacker, 0, 0, 0) != 0)
|
||||
return;
|
||||
if (gBattleWeather & B_WEATHER_ANY && WEATHER_HAS_EFFECT && AbilityBattleEffects(ABILITYEFFECT_ON_WEATHER, gActiveBattler, 0, 0, 0) != 0)
|
||||
return;
|
||||
if (gFieldStatuses & STATUS_FIELD_TERRAIN_ANY && AbilityBattleEffects(ABILITYEFFECT_ON_TERRAIN, gActiveBattler, 0, 0, 0) != 0)
|
||||
return;
|
||||
}
|
||||
if (AbilityBattleEffects(ABILITYEFFECT_TRACE1, 0, 0, 0, 0) != 0)
|
||||
return;
|
||||
|
@ -6788,8 +6788,7 @@ static void Cmd_switchineffects(void)
|
||||
|| (gBattleWeather & B_WEATHER_ANY && WEATHER_HAS_EFFECT && AbilityBattleEffects(ABILITYEFFECT_ON_WEATHER, gActiveBattler, 0, 0, 0))
|
||||
|| (gFieldStatuses & STATUS_FIELD_TERRAIN_ANY && AbilityBattleEffects(ABILITYEFFECT_ON_TERRAIN, gActiveBattler, 0, 0, 0))
|
||||
|| ItemBattleEffects(ITEMEFFECT_ON_SWITCH_IN, gActiveBattler, FALSE)
|
||||
|| AbilityBattleEffects(ABILITYEFFECT_TRACE2, 0, 0, 0, 0)
|
||||
|| AbilityBattleEffects(ABILITYEFFECT_WEATHER_FORM, 0, 0, 0, 0))
|
||||
|| AbilityBattleEffects(ABILITYEFFECT_TRACE2, 0, 0, 0, 0))
|
||||
return;
|
||||
|
||||
gSideStatuses[GetBattlerSide(gActiveBattler)] &= ~(SIDE_STATUS_SPIKES_DAMAGED | SIDE_STATUS_TOXIC_SPIKES_DAMAGED | SIDE_STATUS_STEALTH_ROCK_DAMAGED | SIDE_STATUS_STICKY_WEB_DAMAGED);
|
||||
|
@ -2556,7 +2556,7 @@ u8 DoFieldEndTurnEffects(void)
|
||||
gBattleStruct->turnCountersTracker++;
|
||||
break;
|
||||
case ENDTURN_WEATHER_FORM:
|
||||
AbilityBattleEffects(ABILITYEFFECT_WEATHER_FORM, 0, 0, 0, 0);
|
||||
AbilityBattleEffects(ABILITYEFFECT_ON_WEATHER, 0, 0, 0, 0);
|
||||
gBattleStruct->turnCountersTracker++;
|
||||
break;
|
||||
case ENDTURN_STATUS_HEAL:
|
||||
@ -4815,15 +4815,6 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
effect++;
|
||||
}
|
||||
break;
|
||||
case ABILITY_PROTOSYNTHESIS:
|
||||
if (!gSpecialStatuses[battler].switchInAbilityDone && gBattleWeather & B_WEATHER_SUN)
|
||||
{
|
||||
gSpecialStatuses[battler].switchInAbilityDone = TRUE;
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, GetHighestStatId(battler));
|
||||
BattleScriptPushCursorAndCallback(BattleScript_ProtosynthesisActivates);
|
||||
effect++;
|
||||
}
|
||||
break;
|
||||
case ABILITY_VESSEL_OF_RUIN:
|
||||
if (!gSpecialStatuses[battler].switchInAbilityDone)
|
||||
{
|
||||
@ -6008,31 +5999,6 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ABILITYEFFECT_WEATHER_FORM: // 6
|
||||
for (battler = 0; battler < gBattlersCount; battler++)
|
||||
{
|
||||
switch (gBattleMons[battler].species)
|
||||
{
|
||||
case SPECIES_CASTFORM:
|
||||
case SPECIES_CHERRIM:
|
||||
#ifdef POKEMON_EXPANSION
|
||||
case SPECIES_CASTFORM_RAINY:
|
||||
case SPECIES_CASTFORM_SNOWY:
|
||||
case SPECIES_CASTFORM_SUNNY:
|
||||
case SPECIES_CHERRIM_SUNSHINE:
|
||||
#endif
|
||||
effect = TryWeatherFormChange(battler);
|
||||
if (effect != 0)
|
||||
{
|
||||
BattleScriptPushCursorAndCallback(BattleScript_WeatherFormChange);
|
||||
gBattleScripting.battler = battler;
|
||||
gBattleStruct->formToChangeInto = effect - 1;
|
||||
return effect;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ABILITYEFFECT_SYNCHRONIZE:
|
||||
if (gLastUsedAbility == ABILITY_SYNCHRONIZE && (gHitMarker & HITMARKER_SYNCHRONISE_EFFECT))
|
||||
{
|
||||
@ -6174,7 +6140,8 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
break;
|
||||
case ABILITYEFFECT_ON_WEATHER: // For ability effects that activate when the battle weather changes.
|
||||
battler = gBattlerAbility = gBattleScripting.battler;
|
||||
switch (GetBattlerAbility(battler))
|
||||
gLastUsedAbility = GetBattlerAbility(battler);
|
||||
switch (gLastUsedAbility)
|
||||
{
|
||||
case ABILITY_FORECAST:
|
||||
#if B_WEATHER_FORMS >= GEN_5
|
||||
@ -6190,8 +6157,9 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
}
|
||||
break;
|
||||
case ABILITY_PROTOSYNTHESIS:
|
||||
if (IsBattlerWeatherAffected(battler, B_WEATHER_SUN))
|
||||
if (!gSpecialStatuses[battler].terrainAbilityDone && IsBattlerWeatherAffected(battler, B_WEATHER_SUN))
|
||||
{
|
||||
gSpecialStatuses[battler].terrainAbilityDone = TRUE;
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, GetHighestStatId(battler));
|
||||
BattleScriptPushCursorAndCallback(BattleScript_ProtosynthesisActivates);
|
||||
effect++;
|
||||
@ -6201,7 +6169,8 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
break;
|
||||
case ABILITYEFFECT_ON_TERRAIN: // For ability effects that activate when the field terrain changes.
|
||||
battler = gBattlerAbility = gBattleScripting.battler;
|
||||
switch (GetBattlerAbility(battler))
|
||||
gLastUsedAbility = GetBattlerAbility(battler);
|
||||
switch (gLastUsedAbility)
|
||||
{
|
||||
case ABILITY_MIMICRY:
|
||||
if (!gSpecialStatuses[battler].terrainAbilityDone && ChangeTypeBasedOnTerrain(battler))
|
||||
|
Loading…
Reference in New Issue
Block a user