pull/280/merge
grant 2024-05-13 10:09:18 -04:00 committed by GitHub
commit 9e13b2c72d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 55 additions and 0 deletions

View File

@ -1517,6 +1517,14 @@ export class PostSummonWeatherChangeAbAttr extends PostSummonAbAttr {
if (!pokemon.scene.arena.weather?.isImmutable()) if (!pokemon.scene.arena.weather?.isImmutable())
return pokemon.scene.arena.trySetWeather(this.weatherType, true); return pokemon.scene.arena.trySetWeather(this.weatherType, true);
if (pokemon.scene.arena.weather?.isImmutable())
switch (this.weatherType) {
case WeatherType.HEAVY_RAIN:
case WeatherType.HARSH_SUN:
case WeatherType.STRONG_WINDS:
return pokemon.scene.arena.trySetWeather(this.weatherType, true);
}
return false; return false;
} }
} }
@ -1648,6 +1656,16 @@ export class PreSwitchOutHealAbAttr extends PreSwitchOutAbAttr {
} }
} }
export class PreSwitchOutWeatherChangeAbAttr extends PreSwitchOutAbAttr {
applyPreSwitchOut(pokemon: Pokemon, passive: boolean, args: any[]): boolean | Promise<boolean> {
if (pokemon.scene.arena.weather?.isImmutable()) {
return pokemon.scene.arena.weather?.isAbilityOnField(pokemon.scene) ? false : pokemon.scene.arena.trySetWeather(WeatherType.NONE, true);
}
return false;
}
}
export class PreStatChangeAbAttr extends AbAttr { export class PreStatChangeAbAttr extends AbAttr {
applyPreStatChange(pokemon: Pokemon, passive: boolean, stat: BattleStat, cancelled: Utils.BooleanHolder, args: any[]): boolean | Promise<boolean> { applyPreStatChange(pokemon: Pokemon, passive: boolean, stat: BattleStat, cancelled: Utils.BooleanHolder, args: any[]): boolean | Promise<boolean> {
return false; return false;
@ -3348,12 +3366,15 @@ export function initAbilities() {
.unimplemented(), .unimplemented(),
new Ability(Abilities.PRIMORDIAL_SEA, 6) new Ability(Abilities.PRIMORDIAL_SEA, 6)
.attr(PostSummonWeatherChangeAbAttr, WeatherType.HEAVY_RAIN) .attr(PostSummonWeatherChangeAbAttr, WeatherType.HEAVY_RAIN)
.attr(PreSwitchOutWeatherChangeAbAttr)
.attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.HEAVY_RAIN), .attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.HEAVY_RAIN),
new Ability(Abilities.DESOLATE_LAND, 6) new Ability(Abilities.DESOLATE_LAND, 6)
.attr(PostSummonWeatherChangeAbAttr, WeatherType.HARSH_SUN) .attr(PostSummonWeatherChangeAbAttr, WeatherType.HARSH_SUN)
.attr(PreSwitchOutWeatherChangeAbAttr)
.attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.HARSH_SUN), .attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.HARSH_SUN),
new Ability(Abilities.DELTA_STREAM, 6) new Ability(Abilities.DELTA_STREAM, 6)
.attr(PostSummonWeatherChangeAbAttr, WeatherType.STRONG_WINDS) .attr(PostSummonWeatherChangeAbAttr, WeatherType.STRONG_WINDS)
.attr(PreSwitchOutWeatherChangeAbAttr)
.attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.STRONG_WINDS), .attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.STRONG_WINDS),
new Ability(Abilities.STAMINA, 7) new Ability(Abilities.STAMINA, 7)
.attr(PostDefendStatChangeAbAttr, (target, user, move) => move.category !== MoveCategory.STATUS, BattleStat.DEF, 1), .attr(PostDefendStatChangeAbAttr, (target, user, move) => move.category !== MoveCategory.STATUS, BattleStat.DEF, 1),

View File

@ -7,6 +7,7 @@ import * as Utils from "../utils";
import BattleScene from "../battle-scene"; import BattleScene from "../battle-scene";
import { SuppressWeatherEffectAbAttr } from "./ability"; import { SuppressWeatherEffectAbAttr } from "./ability";
import { TerrainType } from "./terrain"; import { TerrainType } from "./terrain";
import { Abilities } from "./enums/abilities";
export enum WeatherType { export enum WeatherType {
NONE, NONE,
@ -116,6 +117,39 @@ export class Weather {
return false; return false;
} }
isAbilityOnField(scene: BattleScene): boolean {
const field = scene.getField(true);
let abilitiesOnField = 0;
for (let pokemon of field) {
let ability = pokemon.getAbility();
switch (this.weatherType) {
case WeatherType.HARSH_SUN:
if (ability.id === Abilities.DESOLATE_LAND)
abilitiesOnField++
if (pokemon.hasPassive() && pokemon.getPassiveAbility().id === Abilities.DESOLATE_LAND)
abilitiesOnField++
break;
case WeatherType.HEAVY_RAIN:
if (ability.id === Abilities.PRIMORDIAL_SEA)
abilitiesOnField++
if (pokemon.hasPassive() && pokemon.getPassiveAbility().id === Abilities.PRIMORDIAL_SEA)
abilitiesOnField++
break;
case WeatherType.STRONG_WINDS:
if (ability.id === Abilities.DELTA_STREAM)
abilitiesOnField++
if (pokemon.hasPassive() && pokemon.getPassiveAbility().id === Abilities.DELTA_STREAM)
abilitiesOnField++
break;
default:
break;
}
}
return abilitiesOnField > 1;
}
} }
export function getWeatherStartMessage(weatherType: WeatherType): string { export function getWeatherStartMessage(weatherType: WeatherType): string {