move weather override

This commit is contained in:
Hyun Ahn 2023-11-24 18:30:56 +09:00
parent 04db56e86b
commit cfdab43292
2 changed files with 17 additions and 8 deletions

View File

@ -12,6 +12,8 @@ import { ArenaTag, ArenaTagType, getArenaTag } from "./data/arena-tag";
import { GameMode } from "./game-mode"; import { GameMode } from "./game-mode";
import { TrainerType } from "./data/trainer-type"; import { TrainerType } from "./data/trainer-type";
const WEATHER_OVERRIDE = WeatherType.RAIN
export class Arena { export class Arena {
public scene: BattleScene; public scene: BattleScene;
public biomeType: Biome; public biomeType: Biome;
@ -183,11 +185,24 @@ 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 { trySetWeather(weather: WeatherType, viaMove: boolean): boolean {
// override hook for debugging
if (WEATHER_OVERRIDE) {
return this.trySetWeatherOverride(WEATHER_OVERRIDE);
}
if (this.weather?.weatherType === (weather || undefined)) if (this.weather?.weatherType === (weather || undefined))
return false; return false;
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, viaMove ? 5 : 0) : null;
if (this.weather) { if (this.weather) {

View File

@ -35,8 +35,6 @@ import { HealAchv, LevelAchv, MoneyAchv, achvs } from "./system/achv";
import { DexEntry } from "./system/game-data"; import { DexEntry } from "./system/game-data";
import { pokemonPrevolutions } from "./data/pokemon-evolutions"; import { pokemonPrevolutions } from "./data/pokemon-evolutions";
const WEATHER_OVERRIDE = WeatherType.NONE
export class CheckLoadPhase extends BattlePhase { export class CheckLoadPhase extends BattlePhase {
private loaded: boolean; private loaded: boolean;
@ -320,11 +318,7 @@ export class EncounterPhase extends BattlePhase {
this.scene.updateModifiers(true); this.scene.updateModifiers(true);
} }
if(WEATHER_OVERRIDE){
this.scene.arena.trySetWeather(WEATHER_OVERRIDE, false);
} else {
this.scene.arena.trySetWeather(getRandomWeatherType(this.scene.arena.biomeType), false); this.scene.arena.trySetWeather(getRandomWeatherType(this.scene.arena.biomeType), false);
}
const enemyField = this.scene.getEnemyField(); const enemyField = this.scene.getEnemyField();
this.scene.tweens.add({ this.scene.tweens.add({