Add support for time of day specific Pokemon pools

pull/14/head
Flashfyre 2023-12-30 00:00:27 -05:00
parent 4e841db730
commit 2ed01f9b63
3 changed files with 1526 additions and 917 deletions

View File

@ -1,5 +1,5 @@
import BattleScene from "./battle-scene"; import BattleScene from "./battle-scene";
import { Biome, BiomePoolTier, BiomeTierPokemonPools, BiomeTierTrainerPools, biomePokemonPools, biomeTrainerPools } from "./data/biome"; import { Biome, BiomePoolTier, BiomeTierPokemonPools, PokemonPools, BiomeTierTrainerPools, biomePokemonPools, biomeTrainerPools } from "./data/biome";
import * as Utils from "./utils"; import * as Utils from "./utils";
import PokemonSpecies, { getPokemonSpecies } from "./data/pokemon-species"; import PokemonSpecies, { getPokemonSpecies } from "./data/pokemon-species";
import { Species } from "./data/species"; import { Species } from "./data/species";
@ -16,6 +16,7 @@ import { BattlerIndex } from "./battle";
const WEATHER_OVERRIDE = WeatherType.NONE; const WEATHER_OVERRIDE = WeatherType.NONE;
export enum TimeOfDay { export enum TimeOfDay {
ALL = -1,
DAWN, DAWN,
DAY, DAY,
DUSK, DUSK,
@ -29,7 +30,9 @@ export class Arena {
public tags: ArenaTag[]; public tags: ArenaTag[];
public bgm: string; public bgm: string;
private pokemonPool: BiomeTierPokemonPools; private lastTimeOfDay: TimeOfDay;
private pokemonPool: PokemonPools;
private trainerPool: BiomeTierTrainerPools; private trainerPool: BiomeTierTrainerPools;
constructor(scene: BattleScene, biome: Biome, bgm: string) { constructor(scene: BattleScene, biome: Biome, bgm: string) {
@ -37,8 +40,18 @@ export class Arena {
this.biomeType = biome; this.biomeType = biome;
this.tags = []; this.tags = [];
this.bgm = bgm; this.bgm = bgm;
this.pokemonPool = biomePokemonPools[biome];
this.trainerPool = biomeTrainerPools[biome]; this.trainerPool = biomeTrainerPools[biome];
this.updatePoolsForTimeOfDay();
}
updatePoolsForTimeOfDay(): void {
const timeOfDay = this.getTimeOfDay();
if (timeOfDay !== this.lastTimeOfDay) {
this.pokemonPool = {};
for (let tier of Object.keys(biomePokemonPools[this.biomeType]))
this.pokemonPool[tier] = Object.assign([], biomePokemonPools[this.biomeType][tier][TimeOfDay.ALL]).concat(biomePokemonPools[this.biomeType][tier][timeOfDay]);
this.lastTimeOfDay = timeOfDay;
}
} }
randomSpecies(waveIndex: integer, level: integer, attempt?: integer): PokemonSpecies { randomSpecies(waveIndex: integer, level: integer, attempt?: integer): PokemonSpecies {
@ -317,12 +330,12 @@ export class Arena {
return TimeOfDay.DAY; return TimeOfDay.DAY;
if (waveCycle < 20) if (waveCycle < 20)
return TimeOfDay.DAWN; return TimeOfDay.DUSK;
if (waveCycle < 35) if (waveCycle < 35)
return TimeOfDay.NIGHT; return TimeOfDay.NIGHT;
return TimeOfDay.DUSK; return TimeOfDay.DAWN;
} }
isOutside(): boolean { isOutside(): boolean {

View File

@ -746,6 +746,8 @@ export default class BattleScene extends Phaser.Scene {
const resetArenaState = isNewBiome || this.currentBattle.battleType === BattleType.TRAINER; const resetArenaState = isNewBiome || this.currentBattle.battleType === BattleType.TRAINER;
this.getEnemyParty().forEach(enemyPokemon => enemyPokemon.destroy()); this.getEnemyParty().forEach(enemyPokemon => enemyPokemon.destroy());
this.trySpreadPokerus(); this.trySpreadPokerus();
if (!isNewBiome && (newWaveIndex % 10) == 5)
this.arena.updatePoolsForTimeOfDay();
if (resetArenaState) { if (resetArenaState) {
this.arena.removeAllTags(); this.arena.removeAllTags();
playerField.forEach((_, p) => this.unshiftPhase(new ReturnPhase(this, p))); playerField.forEach((_, p) => this.unshiftPhase(new ReturnPhase(this, p)));

File diff suppressed because it is too large Load Diff