Add growth rate to starter select screen

pull/2/head
Flashfyre 2023-10-24 23:04:23 -04:00
parent a53dc0f025
commit 8ae78fcd05
2 changed files with 37 additions and 2 deletions

View File

@ -51,8 +51,25 @@ export function getLevelTotalExp(level: integer, growthRate: GrowthRate): intege
return Math.floor(ret * 0.325 + getLevelTotalExp(level, GrowthRate.MEDIUM_FAST) * 0.675); return Math.floor(ret * 0.325 + getLevelTotalExp(level, GrowthRate.MEDIUM_FAST) * 0.675);
return Math.floor(ret); return Math.floor(ret);
}; }
export function getLevelRelExp(level: integer, growthRate: GrowthRate): number { export function getLevelRelExp(level: integer, growthRate: GrowthRate): number {
return getLevelTotalExp(level, growthRate) - getLevelTotalExp(level - 1, growthRate); return getLevelTotalExp(level, growthRate) - getLevelTotalExp(level - 1, growthRate);
}; }
export function getGrowthRateColor(growthRate: GrowthRate, shadow?: boolean) {
switch (growthRate) {
case GrowthRate.ERRATIC:
return !shadow ? '#f85888' : '#906060';
case GrowthRate.FAST:
return !shadow ? '#f8d030' : '#b8a038';
case GrowthRate.MEDIUM_FAST:
return !shadow ? '#78c850' : '#588040';
case GrowthRate.MEDIUM_SLOW:
return !shadow ? '#6890f0' : '#807870';
case GrowthRate.SLOW:
return !shadow ? '#f08030' : '#c03028';
case GrowthRate.FLUCTUATING:
return !shadow ? '#a040a0' : '#483850';
}
}

View File

@ -11,6 +11,7 @@ import { pokemonPrevolutions } from "../data/pokemon-evolutions";
import { abilities } from "../data/ability"; import { abilities } from "../data/ability";
import { GameMode } from "../game-mode"; import { GameMode } from "../game-mode";
import { Unlockables } from "../system/unlockables"; import { Unlockables } from "../system/unlockables";
import { GrowthRate, getGrowthRateColor } from "../data/exp";
export type StarterSelectCallback = (starters: Starter[]) => void; export type StarterSelectCallback = (starters: Starter[]) => void;
@ -28,6 +29,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
private pokemonNumberText: Phaser.GameObjects.Text; private pokemonNumberText: Phaser.GameObjects.Text;
private pokemonSprite: Phaser.GameObjects.Sprite; private pokemonSprite: Phaser.GameObjects.Sprite;
private pokemonNameText: Phaser.GameObjects.Text; private pokemonNameText: Phaser.GameObjects.Text;
private pokemonGrowthRateLabelText: Phaser.GameObjects.Text;
private pokemonGrowthRateText: Phaser.GameObjects.Text;
private pokemonGenderText: Phaser.GameObjects.Text; private pokemonGenderText: Phaser.GameObjects.Text;
private pokemonAbilityLabelText: Phaser.GameObjects.Text; private pokemonAbilityLabelText: Phaser.GameObjects.Text;
private pokemonAbilityText: Phaser.GameObjects.Text; private pokemonAbilityText: Phaser.GameObjects.Text;
@ -90,6 +93,15 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.pokemonNameText.setOrigin(0, 0); this.pokemonNameText.setOrigin(0, 0);
this.starterSelectContainer.add(this.pokemonNameText); this.starterSelectContainer.add(this.pokemonNameText);
this.pokemonGrowthRateLabelText = addTextObject(this.scene, 8, 103, 'Growth Rate:', TextStyle.SUMMARY, { fontSize: '48px' });
this.pokemonGrowthRateLabelText.setOrigin(0, 0);
this.pokemonGrowthRateLabelText.setVisible(false);
this.starterSelectContainer.add(this.pokemonGrowthRateLabelText);
this.pokemonGrowthRateText = addTextObject(this.scene, 44, 103, '', TextStyle.SUMMARY_RED, { fontSize: '48px' });
this.pokemonGrowthRateText.setOrigin(0, 0);
this.starterSelectContainer.add(this.pokemonGrowthRateText);
this.pokemonGenderText = addTextObject(this.scene, 96, 112, '', TextStyle.SUMMARY); this.pokemonGenderText = addTextObject(this.scene, 96, 112, '', TextStyle.SUMMARY);
this.pokemonGenderText.setOrigin(0, 0); this.pokemonGenderText.setOrigin(0, 0);
this.starterSelectContainer.add(this.pokemonGenderText); this.starterSelectContainer.add(this.pokemonGenderText);
@ -468,12 +480,18 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
if (species && this.speciesStarterDexEntry) { if (species && this.speciesStarterDexEntry) {
this.pokemonNumberText.setText(Utils.padInt(species.speciesId, 3)); this.pokemonNumberText.setText(Utils.padInt(species.speciesId, 3));
this.pokemonNameText.setText(species.name); this.pokemonNameText.setText(species.name);
this.pokemonGrowthRateText.setText(Utils.toReadableString(GrowthRate[species.growthRate]));
this.pokemonGrowthRateText.setColor(getGrowthRateColor(species.growthRate));
this.pokemonGrowthRateText.setShadowColor(getGrowthRateColor(species.growthRate, true));
this.pokemonGrowthRateLabelText.setVisible(true);
this.pokemonAbilityLabelText.setVisible(true); this.pokemonAbilityLabelText.setVisible(true);
this.setSpeciesDetails(species, !!this.speciesStarterDexEntry?.shiny, this.speciesStarterDexEntry?.formIndex, !!this.speciesStarterDexEntry?.female, this.speciesStarterDexEntry?.abilityIndex); this.setSpeciesDetails(species, !!this.speciesStarterDexEntry?.shiny, this.speciesStarterDexEntry?.formIndex, !!this.speciesStarterDexEntry?.female, this.speciesStarterDexEntry?.abilityIndex);
} else { } else {
this.pokemonNumberText.setText(Utils.padInt(0, 3)); this.pokemonNumberText.setText(Utils.padInt(0, 3));
this.pokemonNameText.setText(species ? '???' : ''); this.pokemonNameText.setText(species ? '???' : '');
this.pokemonGrowthRateText.setText('');
this.pokemonGrowthRateLabelText.setVisible(false);
this.pokemonAbilityLabelText.setVisible(false); this.pokemonAbilityLabelText.setVisible(false);
this.setSpeciesDetails(species, false, 0, false, 0); this.setSpeciesDetails(species, false, 0, false, 0);