Hyun/weather_override (#4)

* weather_override

* move weather override
This commit is contained in:
Hyun Ahn 2023-11-25 12:25:09 +09:00 committed by GitHub
parent 1a9c492a79
commit 62a070239b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 1 deletions

View File

@ -12,6 +12,8 @@ import { ArenaTag, ArenaTagType, getArenaTag } from "./data/arena-tag";
import { GameMode } from "./game-mode";
import { TrainerType } from "./data/trainer-type";
const WEATHER_OVERRIDE = WeatherType.RAIN
export class Arena {
public scene: BattleScene;
public biomeType: Biome;
@ -183,13 +185,26 @@ export class Arena {
}
}
trySetWeatherOverride(weather: WeatherType): boolean {
this.weather = new Weather(weather, 0);
this.scene.unshiftPhase(new CommonAnimPhase(this.scene, undefined, undefined, CommonAnim.SUNNY + (weather - 1)));
this.scene.queueMessage(getWeatherStartMessage(weather));
return true
}
trySetWeather(weather: WeatherType, viaMove: boolean): boolean {
// override hook for debugging
if (WEATHER_OVERRIDE) {
return this.trySetWeatherOverride(WEATHER_OVERRIDE);
}
if (this.weather?.weatherType === (weather || undefined))
return false;
const oldWeatherType = this.weather?.weatherType || WeatherType.NONE;
this.weather = weather ? new Weather(weather, viaMove ? 5 : 0) : null;
this.weather = weather ? new Weather(weather, viaMove ? 5 : 0) : null;
if (this.weather) {
this.scene.unshiftPhase(new CommonAnimPhase(this.scene, undefined, undefined, CommonAnim.SUNNY + (weather - 1)));
this.scene.queueMessage(getWeatherStartMessage(weather));