From 6dc868272f6099c9ccfcb99fc63c557282a95819 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Fri, 5 Jan 2024 11:29:34 -0500 Subject: [PATCH] Add summary memo text --- package-lock.json | 52 ++++++++++++++--------------- src/data/biome.ts | 4 ++- src/pokemon.ts | 12 ++++--- src/system/pokemon-data.ts | 5 +++ src/ui/form-modal-ui-handler.ts | 4 +-- src/ui/starter-select-ui-handler.ts | 6 ++-- src/ui/stats-container.ts | 2 +- src/ui/summary-ui-handler.ts | 11 ++++-- src/ui/text.ts | 8 +++++ 9 files changed, 65 insertions(+), 39 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0c24c0973..c849f347b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,9 +35,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.23.6", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.6.tgz", - "integrity": "sha512-zHd0eUrf5GZoOWVCXp6koAKQTfZV07eit6bGPmJgnZdnSAvvZee6zniW2XMF7Cmc4ISOOnPy3QaSiIJGJkVEDQ==", + "version": "7.23.7", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.7.tgz", + "integrity": "sha512-w06OXVOFso7LcbzMiDGt+3X7Rh7Ho8MmgPoWU3rarH+8upf+wSU/grlGbWzQyr3DkdN6ZeuMFjpdwW0Q+HxobA==", "dependencies": { "regenerator-runtime": "^0.14.0" }, @@ -546,9 +546,9 @@ } }, "node_modules/acorn": { - "version": "8.11.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", - "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -618,12 +618,12 @@ "dev": true }, "node_modules/axios": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.3.tgz", - "integrity": "sha512-fWyNdeawGam70jXSVlKl+SUNVcL6j6W79CuSIPfi6HnDUmSCH6gyUys/HrqHeA/wU0Az41rRgean494d0Jb+ww==", + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.4.tgz", + "integrity": "sha512-heJnIs6N4aa1eSthhN9M5ioILu8Wi8vmQW9iHQ9NUvfkJb0lEEDUiIdQNAuBtfUt3FxReaKdpQA5DbmMOqzF/A==", "dev": true, "dependencies": { - "follow-redirects": "^1.15.0", + "follow-redirects": "^1.15.4", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } @@ -810,9 +810,9 @@ } }, "node_modules/cookies": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/cookies/-/cookies-0.8.0.tgz", - "integrity": "sha512-8aPsApQfebXnuI+537McwYsDtjVxGm8gTIzQI3FDW6t5t/DAhERxtnbEPN/8RX+uZthoz4eCOgloXaE5cYyNow==", + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/cookies/-/cookies-0.9.1.tgz", + "integrity": "sha512-TG2hpqe4ELx54QER/S3HQ9SRVnQnGBtKUz5bLQWtYAQ+o6GpgMs6sYUvaiJjVxb+UXwhRhAEP3m7LbsIZ77Hmw==", "dev": true, "dependencies": { "depd": "~2.0.0", @@ -1242,9 +1242,9 @@ "dev": true }, "node_modules/follow-redirects": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", + "version": "1.15.4", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", + "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==", "dev": true, "funding": [ { @@ -1738,16 +1738,16 @@ } }, "node_modules/koa": { - "version": "2.14.2", - "resolved": "https://registry.npmjs.org/koa/-/koa-2.14.2.tgz", - "integrity": "sha512-VFI2bpJaodz6P7x2uyLiX6RLYpZmOJqNmoCst/Yyd7hQlszyPwG/I9CQJ63nOtKSxpt5M7NH67V6nJL2BwCl7g==", + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/koa/-/koa-2.15.0.tgz", + "integrity": "sha512-KEL/vU1knsoUvfP4MC4/GthpQrY/p6dzwaaGI6Rt4NQuFqkw3qrvsdYF5pz3wOfi7IGTvMPHC9aZIcUKYFNxsw==", "dev": true, "dependencies": { "accepts": "^1.3.5", "cache-content-type": "^1.0.0", "content-disposition": "~0.5.2", "content-type": "^1.0.4", - "cookies": "~0.8.0", + "cookies": "~0.9.0", "debug": "^4.3.2", "delegates": "^1.0.0", "depd": "^2.0.0", @@ -2143,9 +2143,9 @@ } }, "node_modules/phaser3-rex-plugins": { - "version": "1.60.8", - "resolved": "https://registry.npmjs.org/phaser3-rex-plugins/-/phaser3-rex-plugins-1.60.8.tgz", - "integrity": "sha512-akmRnNpPMP239aN91zxIEsqLIWwoFJe6BBdJEw5pgMMi/bnMY/3NpyoDfJT1thFC7Yf8rwLCBGtPF/nWXx6jAw==", + "version": "1.60.9", + "resolved": "https://registry.npmjs.org/phaser3-rex-plugins/-/phaser3-rex-plugins-1.60.9.tgz", + "integrity": "sha512-3tH98Fo3boDIFwwehlGhFdpaHAK0/gLugTyaXipfVS4dyWbT7BO5LOLhcgSuGoCTgooWN020x5juMMOtttxbSw==", "dependencies": { "eventemitter3": "^3.1.2", "i18next": "^22.5.1", @@ -2184,9 +2184,9 @@ } }, "node_modules/postcss": { - "version": "8.4.32", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.32.tgz", - "integrity": "sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw==", + "version": "8.4.33", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.33.tgz", + "integrity": "sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg==", "dev": true, "funding": [ { diff --git a/src/data/biome.ts b/src/data/biome.ts index de9706478..7164a38cb 100644 --- a/src/data/biome.ts +++ b/src/data/biome.ts @@ -45,7 +45,9 @@ export enum Biome { END = 50 }; -export function getBiomeName(biome: Biome) { +export function getBiomeName(biome: Biome | -1) { + if (biome === -1) + return 'Somewhere you can\'t remember'; switch (biome) { case Biome.GRASS: return 'Grassy Field'; diff --git a/src/pokemon.ts b/src/pokemon.ts index 554f4d37d..4397e54ab 100644 --- a/src/pokemon.ts +++ b/src/pokemon.ts @@ -65,6 +65,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { public moveset: PokemonMove[]; public status: Status; public friendship: integer; + public metLevel: integer; + public metBiome: Biome | -1; public pauseEvolutions: boolean; public pokerus: boolean; @@ -124,6 +126,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { this.moveset = dataSource.moveset; this.status = dataSource.status; this.friendship = dataSource.friendship !== undefined ? dataSource.friendship : this.species.baseFriendship; + this.metLevel = dataSource.metLevel || 5; + this.metBiome = dataSource.metBiome; this.pauseEvolutions = dataSource.pauseEvolutions; this.pokerus = !!dataSource.pokerus; this.fusionSpecies = dataSource.fusionSpecies instanceof PokemonSpecies ? dataSource.fusionSpecies : getPokemonSpecies(dataSource.fusionSpecies); @@ -161,6 +165,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { this.trySetShiny(); this.friendship = species.baseFriendship; + this.metLevel = level; + this.metBiome = scene.currentBattle ? scene.arena.biomeType : -1; this.pokerus = false; if (scene.gameMode === GameMode.SPLICED_ENDLESS) { @@ -1717,15 +1723,11 @@ export default interface Pokemon { } export class PlayerPokemon extends Pokemon { - public metBiome: Biome; - public metLevel: integer; public compatibleTms: Moves[]; constructor(scene: BattleScene, species: PokemonSpecies, level: integer, abilityIndex: integer, formIndex: integer, gender?: Gender, shiny?: boolean, ivs?: integer[], dataSource?: Pokemon | PokemonData) { super(scene, 106, 148, species, level, abilityIndex, formIndex, gender, shiny, ivs, dataSource); - this.metBiome = scene.arena?.biomeType || Biome.TOWN; - this.metLevel = level; this.generateCompatibleTms(); } @@ -2092,6 +2094,8 @@ export class EnemyPokemon extends Pokemon { if (party.length < 6) { this.pokeball = pokeballType; + this.metLevel = this.level; + this.metBiome = this.scene.arena.biomeType; const newPokemon = new PlayerPokemon(this.scene, this.species, this.level, this.abilityIndex, this.formIndex, this.gender, this.shiny, null, this); party.push(newPokemon); ret = newPokemon; diff --git a/src/system/pokemon-data.ts b/src/system/pokemon-data.ts index bae40e8cf..9e8ca0db3 100644 --- a/src/system/pokemon-data.ts +++ b/src/system/pokemon-data.ts @@ -1,5 +1,6 @@ import { BattleType } from "../battle"; import BattleScene from "../battle-scene"; +import { Biome } from "../data/biome"; import { Gender } from "../data/gender"; import { PokeballType } from "../data/pokeball"; import { getPokemonSpecies } from "../data/pokemon-species"; @@ -25,6 +26,8 @@ export default class PokemonData { public moveset: PokemonMove[]; public status: Status; public friendship: integer; + public metLevel: integer; + public metBiome: Biome | -1; public pauseEvolutions: boolean; public pokerus: boolean; @@ -53,6 +56,8 @@ export default class PokemonData { this.stats = source.stats; this.ivs = source.ivs; this.friendship = source.friendship !== undefined ? source.friendship : getPokemonSpecies(this.species).baseFriendship; + this.metLevel = source.metLevel || 5; + this.metBiome = source.metBiome !== undefined ? source.metBiome : -1; this.pauseEvolutions = !!source.pauseEvolutions; this.pokerus = !!source.pokerus; diff --git a/src/ui/form-modal-ui-handler.ts b/src/ui/form-modal-ui-handler.ts index d912c1e20..cd22a2326 100644 --- a/src/ui/form-modal-ui-handler.ts +++ b/src/ui/form-modal-ui-handler.ts @@ -65,8 +65,8 @@ export abstract class FormModalUiHandler extends ModalUiHandler { }); this.errorMessage = addTextObject(this.scene, 10, (hasTitle ? 31 : 5) + 20 * (fields.length - 1) + 16, '', TextStyle.TOOLTIP_CONTENT); - this.errorMessage.setColor(getTextColor(TextStyle.SUMMARY_RED)); - this.errorMessage.setShadowColor(getTextColor(TextStyle.SUMMARY_RED, true)); + this.errorMessage.setColor(getTextColor(TextStyle.SUMMARY_PINK)); + this.errorMessage.setShadowColor(getTextColor(TextStyle.SUMMARY_PINK, true)); this.errorMessage.setVisible(false); this.modalContainer.add(this.errorMessage); } diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 4cc2ba526..934e3cebf 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -118,7 +118,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.pokemonGrowthRateLabelText.setVisible(false); this.starterSelectContainer.add(this.pokemonGrowthRateLabelText); - this.pokemonGrowthRateText = addTextObject(this.scene, 44, 103, '', TextStyle.SUMMARY_RED, { fontSize: '48px' }); + this.pokemonGrowthRateText = addTextObject(this.scene, 44, 103, '', TextStyle.SUMMARY_PINK, { fontSize: '48px' }); this.pokemonGrowthRateText.setOrigin(0, 0); this.starterSelectContainer.add(this.pokemonGrowthRateText); @@ -796,8 +796,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler { const newValue = value + (add || 0); const overLimit = newValue > 10; this.valueLimitLabel.setText(`${newValue}/10`); - this.valueLimitLabel.setColor(getTextColor(!overLimit ? TextStyle.TOOLTIP_CONTENT : TextStyle.SUMMARY_RED)); - this.valueLimitLabel.setShadowColor(getTextColor(!overLimit ? TextStyle.TOOLTIP_CONTENT : TextStyle.SUMMARY_RED, true)); + this.valueLimitLabel.setColor(getTextColor(!overLimit ? TextStyle.TOOLTIP_CONTENT : TextStyle.SUMMARY_PINK)); + this.valueLimitLabel.setShadowColor(getTextColor(!overLimit ? TextStyle.TOOLTIP_CONTENT : TextStyle.SUMMARY_PINK, true)); if (overLimit) { this.scene.time.delayedCall(Utils.fixedInt(500), () => this.tryUpdateValue()); return false; diff --git a/src/ui/stats-container.ts b/src/ui/stats-container.ts index e53840d20..1e496b9d7 100644 --- a/src/ui/stats-container.ts +++ b/src/ui/stats-container.ts @@ -71,7 +71,7 @@ export class StatsContainer extends Phaser.GameObjects.Container { let label = ivs[i].toString(); if (this.showDiff && originalIvs) { if (originalIvs[i] < ivs[i]) - label += ` ([color=${getGenderColor(Gender.MALE)}]+${ivs[i] - originalIvs[i]}[/color])`; + label += ` ([color=${getGenderColor(Gender.MALE)}][shadow=${getGenderColor(Gender.MALE, true)}]+${ivs[i] - originalIvs[i]}[/shadow][/color])`; else label += ' (-)'; } diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index 6bfb81986..8a24a340b 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -4,7 +4,7 @@ import UiHandler from "./ui-handler"; import * as Utils from "../utils"; import { PlayerPokemon } from "../pokemon"; import { Type } from "../data/type"; -import { TextStyle, addTextObject, getTextColor } from "./text"; +import { TextStyle, addBBCodeTextObject, addTextObject, getBBCodeFrag, getTextColor } from "./text"; import Move, { MoveCategory } from "../data/move"; import { getPokeballAtlasKey } from "../data/pokeball"; import { getGenderColor, getGenderSymbol } from "../data/gender"; @@ -12,6 +12,7 @@ import { getLevelTotalExp } from "../data/exp"; import { Stat, getStatName } from "../data/pokemon-stat"; import { PokemonHeldItemModifier } from "../modifier/modifier"; import { StatusEffect } from "../data/status-effect"; +import { getBiomeName } from "../data/biome"; enum Page { PROFILE, @@ -529,6 +530,12 @@ export default class SummaryUiHandler extends UiHandler { y: `-=${14.83 * (abilityDescriptionLineCount - 2)}` }); } + + let memoString = `${getBBCodeFrag(`${this.pokemon.metBiome === -1 ? 'apparently ' : ''}met at Lv`, TextStyle.WINDOW)}${getBBCodeFrag(this.pokemon.metLevel.toString(), TextStyle.SUMMARY_RED)}${getBBCodeFrag(',', TextStyle.WINDOW)}\n${getBBCodeFrag(getBiomeName(this.pokemon.metBiome), TextStyle.SUMMARY_RED)}${getBBCodeFrag('.', TextStyle.WINDOW)}`; + + const memoText = addBBCodeTextObject(this.scene, 7, 113, memoString, TextStyle.WINDOW); + memoText.setOrigin(0, 0); + profileContainer.add(memoText); break; case Page.STATS: const statsContainer = this.scene.add.container(0, -pageBg.height); @@ -619,7 +626,7 @@ export default class SummaryUiHandler extends UiHandler { this.extraMoveRowContainer.add(extraRowOverlay); const extraRowText = addTextObject(this.scene, 35, 0, this.summaryUiMode === SummaryUiMode.LEARN_MOVE ? this.newMove.name : 'Cancel', - this.summaryUiMode === SummaryUiMode.LEARN_MOVE ? TextStyle.SUMMARY_RED : TextStyle.SUMMARY); + this.summaryUiMode === SummaryUiMode.LEARN_MOVE ? TextStyle.SUMMARY_PINK : TextStyle.SUMMARY); extraRowText.setOrigin(0, 1); this.extraMoveRowContainer.add(extraRowText); diff --git a/src/ui/text.ts b/src/ui/text.ts index 927fe9389..b844d3dda 100644 --- a/src/ui/text.ts +++ b/src/ui/text.ts @@ -9,6 +9,7 @@ export enum TextStyle { PARTY_RED, SUMMARY, SUMMARY_RED, + SUMMARY_PINK, SUMMARY_GOLD, MONEY, SETTINGS_LABEL, @@ -68,6 +69,7 @@ function getTextStyleOptions(style: TextStyle, extraStyleOptions?: Phaser.Types. switch (style) { case TextStyle.SUMMARY: case TextStyle.SUMMARY_RED: + case TextStyle.SUMMARY_PINK: case TextStyle.SUMMARY_GOLD: case TextStyle.WINDOW: case TextStyle.MESSAGE: @@ -105,6 +107,10 @@ function getTextStyleOptions(style: TextStyle, extraStyleOptions?: Phaser.Types. return [ styleOptions, shadowColor, shadowSize ]; } +export function getBBCodeFrag(content: string, textStyle: TextStyle): string { + return `[color=${getTextColor(textStyle)}][shadow=${getTextColor(textStyle, true)}]${content}[/shadow][/color]`; +} + export function getTextColor(textStyle: TextStyle, shadow?: boolean): string { switch (textStyle) { case TextStyle.MESSAGE: @@ -122,6 +128,8 @@ export function getTextColor(textStyle: TextStyle, shadow?: boolean): string { return !shadow ? '#ffffff' : '#636363'; case TextStyle.SUMMARY_RED: case TextStyle.TOOLTIP_TITLE: + return !shadow ? '#e70808' : '#ffbd73'; + case TextStyle.SUMMARY_PINK: return !shadow ? '#f89890' : '#984038'; case TextStyle.SUMMARY_GOLD: case TextStyle.MONEY: