mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-10-28 06:56:00 +01:00
* Rename `Abilities` to `AbilityId` * Rename `abilities.ts` to `ability-id.ts` * Rename `Moves` to `MoveId` * Rename `moves.ts` to `move-id.ts` * Rename `Species` to `SpeciesId` * Rename `species.ts` to `species-id.ts` * Rename `Biome` to `BiomeId` * Rename `biome.ts` to `biome-id.ts` * Replace `Abilities` with `AbilityId` in comments * Replace `Biome` with `BiomeId` in comments * Replace `Moves` with `MoveId` in comments * Replace `Species` with `SpeciesId` in comments
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import { Arena } from "../field/arena";
|
|
import type { ArenaTag } from "../data/arena-tag";
|
|
import { loadArenaTag } from "../data/arena-tag";
|
|
import type { BiomeId } from "#enums/biome-id";
|
|
import { Weather } from "../data/weather";
|
|
import { Terrain } from "#app/data/terrain";
|
|
|
|
export default class ArenaData {
|
|
public biome: BiomeId;
|
|
public weather: Weather | null;
|
|
public terrain: Terrain | null;
|
|
public tags: ArenaTag[];
|
|
public playerTerasUsed: number;
|
|
|
|
constructor(source: Arena | any) {
|
|
const sourceArena = source instanceof Arena ? (source as Arena) : null;
|
|
this.biome = sourceArena ? sourceArena.biomeType : source.biome;
|
|
this.weather = sourceArena
|
|
? sourceArena.weather
|
|
: source.weather
|
|
? new Weather(source.weather.weatherType, source.weather.turnsLeft)
|
|
: null;
|
|
this.terrain = sourceArena
|
|
? sourceArena.terrain
|
|
: source.terrain
|
|
? new Terrain(source.terrain.terrainType, source.terrain.turnsLeft)
|
|
: null;
|
|
this.playerTerasUsed = (sourceArena ? sourceArena.playerTerasUsed : source.playerTerasUsed) ?? 0;
|
|
this.tags = [];
|
|
|
|
if (source.tags) {
|
|
this.tags = source.tags.map(t => loadArenaTag(t));
|
|
}
|
|
}
|
|
}
|