Fix abilities causing permanent weather and terrains
parent
efa8d4f3fc
commit
a22d50caa7
|
@ -372,7 +372,7 @@ export class PostDefendTerrainChangeAbAttr extends PostDefendAbAttr {
|
||||||
|
|
||||||
applyPostDefend(pokemon: Pokemon, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean {
|
applyPostDefend(pokemon: Pokemon, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean {
|
||||||
if (hitResult < HitResult.NO_EFFECT)
|
if (hitResult < HitResult.NO_EFFECT)
|
||||||
return pokemon.scene.arena.trySetTerrain(this.terrainType, false);
|
return pokemon.scene.arena.trySetTerrain(this.terrainType, true);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -716,7 +716,7 @@ export class PostSummonWeatherChangeAbAttr extends PostSummonAbAttr {
|
||||||
|
|
||||||
applyPostSummon(pokemon: Pokemon, args: any[]): boolean {
|
applyPostSummon(pokemon: Pokemon, args: any[]): boolean {
|
||||||
if (!pokemon.scene.arena.weather?.isImmutable())
|
if (!pokemon.scene.arena.weather?.isImmutable())
|
||||||
return pokemon.scene.arena.trySetWeather(this.weatherType, false);
|
return pokemon.scene.arena.trySetWeather(this.weatherType, true);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -732,7 +732,7 @@ export class PostSummonTerrainChangeAbAttr extends PostSummonAbAttr {
|
||||||
}
|
}
|
||||||
|
|
||||||
applyPostSummon(pokemon: Pokemon, args: any[]): boolean {
|
applyPostSummon(pokemon: Pokemon, args: any[]): boolean {
|
||||||
return pokemon.scene.arena.trySetTerrain(this.terrainType, false);
|
return pokemon.scene.arena.trySetTerrain(this.terrainType, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -255,7 +255,7 @@ export class Arena {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
trySetWeather(weather: WeatherType, viaMove: boolean): boolean {
|
trySetWeather(weather: WeatherType, hasPokemonSource: boolean): boolean {
|
||||||
// override hook for debugging
|
// override hook for debugging
|
||||||
if (WEATHER_OVERRIDE) {
|
if (WEATHER_OVERRIDE) {
|
||||||
return this.trySetWeatherOverride(WEATHER_OVERRIDE);
|
return this.trySetWeatherOverride(WEATHER_OVERRIDE);
|
||||||
|
@ -266,7 +266,7 @@ export class Arena {
|
||||||
|
|
||||||
const oldWeatherType = this.weather?.weatherType || WeatherType.NONE;
|
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) {
|
if (this.weather) {
|
||||||
this.scene.tryReplacePhase(phase => phase instanceof WeatherEffectPhase && phase.weather.weatherType === oldWeatherType, new WeatherEffectPhase(this.scene, 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;
|
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))
|
if (this.terrain?.terrainType === (terrain || undefined))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const oldTerrainType = this.terrain?.terrainType || TerrainType.NONE;
|
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 (this.terrain) {
|
||||||
if (!ignoreAnim)
|
if (!ignoreAnim)
|
||||||
|
|
Loading…
Reference in New Issue