More review changes and added lackings

-Removed unnecessary special handling of terrain-inducing overworld weather states from ChangeTypeBasedOnTerrain.
-Mimicry now activates normally for terrain-inducing overworld weather states.
-Weather abilities now activate normally when switchineffects is called, and at the beginning of a battle.
-Terrain abilities now activate normally at the beginning of a battle.
This commit is contained in:
LOuroboros 2023-01-09 07:53:59 -03:00
parent c32f584940
commit 91b2e1bb50
4 changed files with 6 additions and 4 deletions

View File

@ -8629,6 +8629,7 @@ BattleScript_TerrainSeedLoop_NextBattler:
addbyte gBattlerTarget, 0x1 addbyte gBattlerTarget, 0x1
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_TerrainSeedLoopIter jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_TerrainSeedLoopIter
restoretarget restoretarget
call BattleScript_ActivateSwitchInAbilities
return return
BattleScript_ActivateSwitchInAbilities: BattleScript_ActivateSwitchInAbilities:

View File

@ -3720,6 +3720,10 @@ static void TryDoEventsBeforeFirstTurn(void)
gBattlerAttacker = gBattlerByTurnOrder[gBattleStruct->switchInAbilitiesCounter++]; gBattlerAttacker = gBattlerByTurnOrder[gBattleStruct->switchInAbilitiesCounter++];
if (AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, gBattlerAttacker, 0, 0, 0) != 0) if (AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, gBattlerAttacker, 0, 0, 0) != 0)
return; 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) if (AbilityBattleEffects(ABILITYEFFECT_TRACE1, 0, 0, 0, 0) != 0)
return; return;

View File

@ -6785,6 +6785,7 @@ static void Cmd_switchineffects(void)
gDisableStructs[gActiveBattler].truantSwitchInHack = 0; gDisableStructs[gActiveBattler].truantSwitchInHack = 0;
if (AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, gActiveBattler, 0, 0, 0) if (AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, gActiveBattler, 0, 0, 0)
|| (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)) || (gFieldStatuses & STATUS_FIELD_TERRAIN_ANY && AbilityBattleEffects(ABILITYEFFECT_ON_TERRAIN, gActiveBattler, 0, 0, 0))
|| ItemBattleEffects(ITEMEFFECT_ON_SWITCH_IN, gActiveBattler, FALSE) || ItemBattleEffects(ITEMEFFECT_ON_SWITCH_IN, gActiveBattler, FALSE)
|| AbilityBattleEffects(ABILITYEFFECT_TRACE2, 0, 0, 0, 0) || AbilityBattleEffects(ABILITYEFFECT_TRACE2, 0, 0, 0, 0)

View File

@ -4298,10 +4298,6 @@ static u8 ForewarnChooseMove(u32 battler)
bool8 ChangeTypeBasedOnTerrain(u8 battlerId) bool8 ChangeTypeBasedOnTerrain(u8 battlerId)
{ {
u8 battlerType; u8 battlerType;
u16 terrainFlags = VarGet(VAR_TERRAIN) & STATUS_FIELD_TERRAIN_ANY;
if (terrainFlags && gFieldStatuses & STATUS_FIELD_TERRAIN_ANY)
gFieldStatuses = terrainFlags | STATUS_FIELD_TERRAIN_PERMANENT; // terrain is permanent
if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN) if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN)
battlerType = TYPE_ELECTRIC; battlerType = TYPE_ELECTRIC;