diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 111e5439b12..d25616724cc 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -48,7 +48,7 @@ import { Nature } from './data/nature'; import { SpeciesFormChangeTimeOfDayTrigger, SpeciesFormChangeTrigger, pokemonFormChanges } from './data/pokemon-forms'; import { FormChangePhase, QuietFormChangePhase } from './form-change-phase'; import { BattleSpec } from './enums/battle-spec'; -import { getTypeRgb } from './data/type'; +import { getTypeRgb, getTypeHex } from './data/type'; import PokemonSpriteSparkleHandler from './field/pokemon-sprite-sparkle-handler'; import CharSprite from './ui/char-sprite'; import DamageNumberHandler from './field/damage-number-handler'; @@ -62,6 +62,7 @@ import { Localizable } from './plugins/i18n'; import * as Overrides from './overrides'; import {InputsController} from "./inputs-controller"; import {UiInputs} from "./ui-inputs"; +import { Type } from 'pokenode-ts'; export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1"; @@ -158,6 +159,7 @@ export default class BattleScene extends SceneBase { private party: PlayerPokemon[]; private waveCountText: Phaser.GameObjects.Text; private moneyText: Phaser.GameObjects.Text; + private biomeText: Phaser.GameObjects.Text; private scoreText: Phaser.GameObjects.Text; private luckLabelText: Phaser.GameObjects.Text; private luckText: Phaser.GameObjects.Text; @@ -356,6 +358,10 @@ export default class BattleScene extends SceneBase { this.moneyText.setOrigin(1, 0); this.fieldUI.add(this.moneyText); + this.biomeText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, '', TextStyle.BATTLE_INFO); + this.biomeText.setOrigin(1, 0); + this.fieldUI.add(this.biomeText); + this.scoreText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, '', TextStyle.PARTY, { fontSize: '54px' }); this.scoreText.setOrigin(1, 0); this.fieldUI.add(this.scoreText); @@ -469,6 +475,7 @@ export default class BattleScene extends SceneBase { this.updateWaveCountText(); this.updateMoneyText(); + this.updateBiomeText(); this.updateScoreText(); } @@ -764,6 +771,9 @@ export default class BattleScene extends SceneBase { this.updateMoneyText(); this.moneyText.setVisible(false); + this.updateBiomeText(); + this.biomeText.setVisible(false); + this.updateScoreText(); this.scoreText.setVisible(false); @@ -950,6 +960,8 @@ export default class BattleScene extends SceneBase { this.arenaBg.pipelineData = { terrainColorRatio: this.arena.getBgTerrainColorRatioForBiome() }; + this.updateBiomeText(); + return this.arena; } @@ -1196,6 +1208,26 @@ export default class BattleScene extends SceneBase { this.moneyText.setVisible(true); } + updateBiomeText(): void { + try { + const biomeString: string = getBiomeName(this.arena.biomeType) + this.biomeText.setText(biomeString); + /* + * + * Set text colour based on biomeType + * Looks gross + * + * const biomeValue: Biome = Biome[biomeString.toUpperCase() as keyof typeof Biome]; + * const biomeType = this.arena.getTypeForBiome(biomeValue); + * this.biomeText.setColor(getTypeHex(biomeType)); + * + */ + } catch { + this.biomeText.setText(''); + } + this.biomeText.setVisible(true); + } + updateScoreText(): void { this.scoreText.setText(`Score: ${this.score.toString()}`); this.scoreText.setVisible(this.gameMode.isDaily); @@ -1237,8 +1269,9 @@ export default class BattleScene extends SceneBase { const enemyModifierCount = this.enemyModifiers.filter(m => m.isIconVisible(this)).length; this.waveCountText.setY(-(this.game.canvas.height / 6) + (enemyModifierCount ? enemyModifierCount <= 12 ? 15 : 24 : 0)); this.moneyText.setY(this.waveCountText.y + 10); - this.scoreText.setY(this.moneyText.y + 10); - [ this.luckLabelText, this.luckText ].map(l => l.setY((this.scoreText.visible ? this.scoreText : this.moneyText).y + 10)); + this.biomeText.setY(this.moneyText.y + 10); + this.scoreText.setY(this.biomeText.y + 10); + [ this.luckLabelText, this.luckText ].map(l => l.setY((this.scoreText.visible ? this.scoreText : this.biomeText).y + 10)); const offsetY = (this.scoreText.visible ? this.scoreText : this.moneyText).y + 15; this.partyExpBar.setY(offsetY); this.candyBar.setY(offsetY + 15); diff --git a/src/data/type.ts b/src/data/type.ts index 35c56aecd32..734f0af93c7 100644 --- a/src/data/type.ts +++ b/src/data/type.ts @@ -544,3 +544,48 @@ export function getTypeRgb(type: Type): [ integer, integer, integer ] { return [ 0, 0, 0 ]; } } + +export function getTypeHex(type: Type): string{ + switch (type) { + case Type.NORMAL: + return "#A8A878"; // [ 168, 168, 120 ] + case Type.FIGHTING: + return "#C03028"; // [ 192, 48, 40 ] + case Type.FLYING: + return "#A890F0"; // [ 168, 144, 240 ] + case Type.POISON: + return "#A040A0"; // [ 160, 64, 160 ] + case Type.GROUND: + return "#E0C868"; // [ 224, 192, 104 ] + case Type.ROCK: + return "#B8A038"; // [ 184, 160, 56 ] + case Type.BUG: + return "#A8B820"; // [ 168, 184, 32 ] + case Type.GHOST: + return "#705898"; // [ 112, 88, 152 ] + case Type.STEEL: + return "#B8B8D0"; // [ 184, 184, 208 ] + case Type.FIRE: + return "#F08030"; // [ 240, 128, 48 ] + case Type.WATER: + return "#6890F0"; // [ 104, 144, 240 ] + case Type.GRASS: + return "#78C850"; // [ 120, 200, 80 ] + case Type.ELECTRIC: + return "#F8D030"; // [ 248, 208, 48 ] + case Type.PSYCHIC: + return "#F85888"; // [ 248, 88, 136 ] + case Type.ICE: + return "#98D8D8"; // [ 152, 216, 216 ] + case Type.DRAGON: + return "#7038F8"; // [ 112, 56, 248 ] + case Type.DARK: + return "#705848"; // [ 112, 88, 72 ] + case Type.FAIRY: + return "#E89AC8"; // [ 232, 136, 200 ] + case Type.STELLAR: + return "#FFFFFF"; // [ 255, 255, 255 ] + default: + return "#000000"; // [ 0, 0, 0 ] + } +} \ No newline at end of file diff --git a/src/field/arena.ts b/src/field/arena.ts index a2bde94229d..6ccb5292258 100644 --- a/src/field/arena.ts +++ b/src/field/arena.ts @@ -196,8 +196,9 @@ export class Arena { return 0; } - getTypeForBiome() { - switch (this.biomeType) { + getTypeForBiome(biomeObject?: Biome) { + const biome = biomeObject || this.biomeType; + switch (biome) { case Biome.TOWN: case Biome.PLAINS: case Biome.METROPOLIS: