Fix abilities causing permanent weather and terrains

pull/16/head
Flashfyre 2024-03-25 10:22:16 -04:00
parent efa8d4f3fc
commit a22d50caa7
2 changed files with 7 additions and 7 deletions

View File

@ -372,7 +372,7 @@ export class PostDefendTerrainChangeAbAttr extends PostDefendAbAttr {
applyPostDefend(pokemon: Pokemon, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean {
if (hitResult < HitResult.NO_EFFECT)
return pokemon.scene.arena.trySetTerrain(this.terrainType, false);
return pokemon.scene.arena.trySetTerrain(this.terrainType, true);
return false;
}
@ -716,7 +716,7 @@ export class PostSummonWeatherChangeAbAttr extends PostSummonAbAttr {
applyPostSummon(pokemon: Pokemon, args: any[]): boolean {
if (!pokemon.scene.arena.weather?.isImmutable())
return pokemon.scene.arena.trySetWeather(this.weatherType, false);
return pokemon.scene.arena.trySetWeather(this.weatherType, true);
return false;
}
@ -732,7 +732,7 @@ export class PostSummonTerrainChangeAbAttr extends PostSummonAbAttr {
}
applyPostSummon(pokemon: Pokemon, args: any[]): boolean {
return pokemon.scene.arena.trySetTerrain(this.terrainType, false);
return pokemon.scene.arena.trySetTerrain(this.terrainType, true);
}
}

View File

@ -255,7 +255,7 @@ export class Arena {
return true
}
trySetWeather(weather: WeatherType, viaMove: boolean): boolean {
trySetWeather(weather: WeatherType, hasPokemonSource: boolean): boolean {
// override hook for debugging
if (WEATHER_OVERRIDE) {
return this.trySetWeatherOverride(WEATHER_OVERRIDE);
@ -266,7 +266,7 @@ export class Arena {
const oldWeatherType = this.weather?.weatherType || WeatherType.NONE;
this.weather = weather ? new Weather(weather, viaMove ? 5 : 0) : null;
this.weather = weather ? new Weather(weather, hasPokemonSource ? 5 : 0) : null;
if (this.weather) {
this.scene.tryReplacePhase(phase => phase instanceof WeatherEffectPhase && phase.weather.weatherType === oldWeatherType, new WeatherEffectPhase(this.scene, this.weather));
@ -285,13 +285,13 @@ export class Arena {
return true;
}
trySetTerrain(terrain: TerrainType, viaMove: boolean, ignoreAnim: boolean = false): boolean {
trySetTerrain(terrain: TerrainType, hasPokemonSource: boolean, ignoreAnim: boolean = false): boolean {
if (this.terrain?.terrainType === (terrain || undefined))
return false;
const oldTerrainType = this.terrain?.terrainType || TerrainType.NONE;
this.terrain = terrain ? new Terrain(terrain, viaMove ? 5 : 0) : null;
this.terrain = terrain ? new Terrain(terrain, hasPokemonSource ? 5 : 0) : null;
if (this.terrain) {
if (!ignoreAnim)