Fix some bugs and add seen Pokemon to starter screen

pull/16/head
Flashfyre 2024-02-18 22:21:57 -05:00
parent 22054dddd5
commit 2f8df43db8
10 changed files with 80 additions and 38 deletions

View File

@ -3191,7 +3191,11 @@ export class PokemonHealPhase extends CommonAnimPhase {
this.scene.applyModifiers(HealingBoosterModifier, this.player, hpRestoreMultiplier); this.scene.applyModifiers(HealingBoosterModifier, this.player, hpRestoreMultiplier);
const healAmount = new Utils.NumberHolder(this.hpHealed * hpRestoreMultiplier.value); const healAmount = new Utils.NumberHolder(this.hpHealed * hpRestoreMultiplier.value);
healAmount.value = pokemon.heal(healAmount.value); healAmount.value = pokemon.heal(healAmount.value);
if (pokemon.isPlayer()) {
this.scene.validateAchvs(HealAchv, healAmount); this.scene.validateAchvs(HealAchv, healAmount);
if (healAmount.value > this.scene.gameData.gameStats.highestHeal)
this.scene.gameData.gameStats.highestHeal = healAmount.value;
}
pokemon.updateInfo().then(() => super.end()); pokemon.updateInfo().then(() => super.end());
} else if (this.showFullHpMessage) } else if (this.showFullHpMessage)
this.message = getPokemonMessage(pokemon, `'s\nHP is full!`); this.message = getPokemonMessage(pokemon, `'s\nHP is full!`);

View File

@ -1058,7 +1058,7 @@ export default class BattleScene extends Phaser.Scene {
addPokemonSprite(pokemon: Pokemon, x: number, y: number, texture: string | Phaser.Textures.Texture, frame?: string | number, hasShadow: boolean = false, ignoreOverride: boolean = false): Phaser.GameObjects.Sprite { addPokemonSprite(pokemon: Pokemon, x: number, y: number, texture: string | Phaser.Textures.Texture, frame?: string | number, hasShadow: boolean = false, ignoreOverride: boolean = false): Phaser.GameObjects.Sprite {
const ret = this.addFieldSprite(x, y, texture, frame); const ret = this.addFieldSprite(x, y, texture, frame);
this.initPokemonSprite(ret, pokemon); this.initPokemonSprite(ret, pokemon, hasShadow, ignoreOverride);
return ret; return ret;
} }

View File

@ -68,10 +68,10 @@ export function getTypeDamageMultiplier(attackType: integer, defType: integer):
case Type.ELECTRIC: case Type.ELECTRIC:
case Type.ICE: case Type.ICE:
case Type.DRAGON: case Type.DRAGON:
case Type.DARK:
return 1; return 1;
case Type.ROCK: case Type.ROCK:
case Type.BUG: case Type.BUG:
case Type.DARK:
return 0.5; return 0.5;
default: default:
return 0; return 0;

View File

@ -116,11 +116,13 @@ export class FormChangePhase extends EvolutionPhase {
this.scene.time.delayedCall(250, () => { this.scene.time.delayedCall(250, () => {
this.pokemon.cry(); this.pokemon.cry();
this.scene.time.delayedCall(1250, () => { this.scene.time.delayedCall(1250, () => {
const isMega = this.formChange.formKey.indexOf(SpeciesFormKey.MEGA) > -1;
let playEvolutionFanfare = false; let playEvolutionFanfare = false;
if (isMega) { if (this.formChange.formKey.indexOf(SpeciesFormKey.MEGA) > -1) {
this.scene.validateAchv(achvs.MEGA_EVOLVE); this.scene.validateAchv(achvs.MEGA_EVOLVE);
playEvolutionFanfare = true; playEvolutionFanfare = true;
} else if (this.formChange.formKey.indexOf(SpeciesFormKey.GIGANTAMAX) > -1 || this.formChange.formKey.indexOf(SpeciesFormKey.ETERNAMAX) > -1) {
this.scene.validateAchv(achvs.GIGANTAMAX);
playEvolutionFanfare = true;
} }
const delay = playEvolutionFanfare ? 4000 : 1750; const delay = playEvolutionFanfare ? 4000 : 1750;

View File

@ -14,7 +14,7 @@ import * as Utils from "../utils";
import { TempBattleStat } from '../data/temp-battle-stat'; import { TempBattleStat } from '../data/temp-battle-stat';
import { BerryType, getBerryEffectFunc, getBerryPredicate } from '../data/berry'; import { BerryType, getBerryEffectFunc, getBerryPredicate } from '../data/berry';
import { StatusEffect, getStatusEffectDescriptor } from '../data/status-effect'; import { StatusEffect, getStatusEffectDescriptor } from '../data/status-effect';
import { MoneyAchv } from '../system/achv'; import { MoneyAchv, achvs } from '../system/achv';
import { VoucherType } from '../system/voucher'; import { VoucherType } from '../system/voucher';
import { PreventBerryUseAbAttr, applyAbAttrs } from '../data/ability'; import { PreventBerryUseAbAttr, applyAbAttrs } from '../data/ability';
import { FormChangeItem, SpeciesFormChangeItemTrigger } from '../data/pokemon-forms'; import { FormChangeItem, SpeciesFormChangeItemTrigger } from '../data/pokemon-forms';
@ -564,6 +564,9 @@ export class TerastallizeModifier extends LapsingPokemonHeldItemModifier {
apply(args: any[]): boolean { apply(args: any[]): boolean {
const pokemon = args[0] as Pokemon; const pokemon = args[0] as Pokemon;
pokemon.scene.validateAchv(achvs.TERASTALLIZE);
if (this.teraType === Type.STELLAR)
pokemon.scene.validateAchv(achvs.STELLAR_TERASTALLIZE);
pokemon.updateSpritePipelineData(); pokemon.updateSpritePipelineData();
return true; return true;
} }

View File

@ -860,7 +860,7 @@ export class GameData {
} while (pokemonPrevolutions.hasOwnProperty(speciesId) && (speciesId = pokemonPrevolutions[speciesId])); } while (pokemonPrevolutions.hasOwnProperty(speciesId) && (speciesId = pokemonPrevolutions[speciesId]));
} }
getSpeciesDefaultDexAttr(species: PokemonSpecies): bigint { getSpeciesDefaultDexAttr(species: PokemonSpecies, forSeen: boolean = false): bigint {
let ret = 0n; let ret = 0n;
const dexEntry = this.dexData[species.speciesId]; const dexEntry = this.dexData[species.speciesId];
const attr = dexEntry.caughtAttr; const attr = dexEntry.caughtAttr;

View File

@ -10,6 +10,8 @@ export class GameStats {
public highestEndlessWave: integer; public highestEndlessWave: integer;
public highestLevel: integer; public highestLevel: integer;
public highestMoney: integer; public highestMoney: integer;
public highestDamage: integer;
public highestHeal: integer;
public pokemonSeen: integer; public pokemonSeen: integer;
public pokemonDefeated: integer; public pokemonDefeated: integer;
public pokemonCaught: integer; public pokemonCaught: integer;
@ -40,6 +42,8 @@ export class GameStats {
this.highestEndlessWave = source?.highestEndlessWave || 0; this.highestEndlessWave = source?.highestEndlessWave || 0;
this.highestLevel = source?.highestLevel || 0; this.highestLevel = source?.highestLevel || 0;
this.highestMoney = source?.highestMoney || 0; this.highestMoney = source?.highestMoney || 0;
this.highestDamage = source?.highestDamage || 0;
this.highestHeal = source?.highestHeal || 0;
this.pokemonSeen = source?.pokemonSeen || 0; this.pokemonSeen = source?.pokemonSeen || 0;
this.pokemonDefeated = source?.pokemonDefeated || 0; this.pokemonDefeated = source?.pokemonDefeated || 0;
this.pokemonCaught = source?.pokemonCaught || 0; this.pokemonCaught = source?.pokemonCaught || 0;

View File

@ -75,6 +75,8 @@ const displayStats: DisplayStats = {
endlessSessionsPlayed: 'Runs (Endless)?', endlessSessionsPlayed: 'Runs (Endless)?',
highestEndlessWave: 'Highest Wave (Endless)?', highestEndlessWave: 'Highest Wave (Endless)?',
highestMoney: 'Highest Money', highestMoney: 'Highest Money',
highestDamage: 'Highest Damage',
highestHeal: 'Highest HP Healed',
pokemonSeen: 'Pokémon Encountered', pokemonSeen: 'Pokémon Encountered',
pokemonDefeated: 'Pokémon Defeated', pokemonDefeated: 'Pokémon Defeated',
pokemonCaught: 'Pokémon Caught', pokemonCaught: 'Pokémon Caught',

View File

@ -18,7 +18,6 @@ import { Nature, getNatureName } from "../data/nature";
import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext";
import { pokemonFormChanges } from "../data/pokemon-forms"; import { pokemonFormChanges } from "../data/pokemon-forms";
import { Tutorial, handleTutorial } from "../tutorial"; import { Tutorial, handleTutorial } from "../tutorial";
import PokemonSpriteSparkleHandler from "../sprite/pokemon-sprite-sparkle-handler";
export type StarterSelectCallback = (starters: Starter[]) => void; export type StarterSelectCallback = (starters: Starter[]) => void;
@ -40,6 +39,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
private pokemonGrowthRateLabelText: Phaser.GameObjects.Text; private pokemonGrowthRateLabelText: Phaser.GameObjects.Text;
private pokemonGrowthRateText: Phaser.GameObjects.Text; private pokemonGrowthRateText: Phaser.GameObjects.Text;
private pokemonGenderText: Phaser.GameObjects.Text; private pokemonGenderText: Phaser.GameObjects.Text;
private pokemonUncaughtText: Phaser.GameObjects.Text;
private pokemonAbilityLabelText: Phaser.GameObjects.Text; private pokemonAbilityLabelText: Phaser.GameObjects.Text;
private pokemonAbilityText: Phaser.GameObjects.Text; private pokemonAbilityText: Phaser.GameObjects.Text;
private pokemonNatureLabelText: Phaser.GameObjects.Text; private pokemonNatureLabelText: Phaser.GameObjects.Text;
@ -140,6 +140,10 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.pokemonGenderText.setOrigin(0, 0); this.pokemonGenderText.setOrigin(0, 0);
this.starterSelectContainer.add(this.pokemonGenderText); this.starterSelectContainer.add(this.pokemonGenderText);
this.pokemonUncaughtText = addTextObject(this.scene, 6, 126, 'Uncaught', TextStyle.SUMMARY, { fontSize: '56px' });
this.pokemonUncaughtText.setOrigin(0, 0);
this.starterSelectContainer.add(this.pokemonUncaughtText);
this.pokemonAbilityLabelText = addTextObject(this.scene, 6, 126, 'Ability:', TextStyle.SUMMARY, { fontSize: '56px' }); this.pokemonAbilityLabelText = addTextObject(this.scene, 6, 126, 'Ability:', TextStyle.SUMMARY, { fontSize: '56px' });
this.pokemonAbilityLabelText.setOrigin(0, 0); this.pokemonAbilityLabelText.setOrigin(0, 0);
this.pokemonAbilityLabelText.setVisible(false); this.pokemonAbilityLabelText.setVisible(false);
@ -244,7 +248,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
icon.setScale(0.5); icon.setScale(0.5);
icon.setOrigin(0, 0); icon.setOrigin(0, 0);
icon.setFrame(species.getIconId(defaultProps.female, defaultProps.formIndex, defaultProps.shiny)); icon.setFrame(species.getIconId(defaultProps.female, defaultProps.formIndex, defaultProps.shiny));
icon.setTintFill(0); icon.setTint(0);
this.starterSelectGenIconContainers[g].add(icon); this.starterSelectGenIconContainers[g].add(icon);
this.iconAnimHandler.addOrUpdate(icon, PokemonIconAnimMode.NONE); this.iconAnimHandler.addOrUpdate(icon, PokemonIconAnimMode.NONE);
s++; s++;
@ -356,6 +360,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
const icon = this.starterSelectGenIconContainers[g].getAt(s) as Phaser.GameObjects.Sprite; const icon = this.starterSelectGenIconContainers[g].getAt(s) as Phaser.GameObjects.Sprite;
if (dexEntry.caughtAttr) if (dexEntry.caughtAttr)
icon.clearTint(); icon.clearTint();
else if (dexEntry.seenAttr)
icon.setTint(0x808080);
}); });
} }
@ -762,13 +768,16 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.lastSpecies = species; this.lastSpecies = species;
if (species && this.speciesStarterDexEntry?.caughtAttr) { if (species && (this.speciesStarterDexEntry?.seenAttr || this.speciesStarterDexEntry?.caughtAttr)) {
this.pokemonNumberText.setText(Utils.padInt(species.speciesId, 4)); this.pokemonNumberText.setText(Utils.padInt(species.speciesId, 4));
this.pokemonNameText.setText(species.name); this.pokemonNameText.setText(species.name);
if (this.speciesStarterDexEntry?.caughtAttr) {
this.pokemonGrowthRateText.setText(Utils.toReadableString(GrowthRate[species.growthRate])); this.pokemonGrowthRateText.setText(Utils.toReadableString(GrowthRate[species.growthRate]));
this.pokemonGrowthRateText.setColor(getGrowthRateColor(species.growthRate)); this.pokemonGrowthRateText.setColor(getGrowthRateColor(species.growthRate));
this.pokemonGrowthRateText.setShadowColor(getGrowthRateColor(species.growthRate, true)); this.pokemonGrowthRateText.setShadowColor(getGrowthRateColor(species.growthRate, true));
this.pokemonGrowthRateLabelText.setVisible(true); this.pokemonGrowthRateLabelText.setVisible(true);
this.pokemonUncaughtText.setVisible(false);
this.pokemonAbilityLabelText.setVisible(true); this.pokemonAbilityLabelText.setVisible(true);
this.pokemonNatureLabelText.setVisible(true); this.pokemonNatureLabelText.setVisible(true);
this.pokemonCaughtCountLabelText.setVisible(true); this.pokemonCaughtCountLabelText.setVisible(true);
@ -797,21 +806,40 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.setSpeciesDetails(species, props.shiny, props.formIndex, props.female, props.abilityIndex, defaultNature); this.setSpeciesDetails(species, props.shiny, props.formIndex, props.female, props.abilityIndex, defaultNature);
} }
this.pokemonSprite.clearTint();
} else {
this.pokemonGrowthRateText.setText('');
this.pokemonGrowthRateLabelText.setVisible(false);
this.pokemonUncaughtText.setVisible(true);
this.pokemonAbilityLabelText.setVisible(false);
this.pokemonNatureLabelText.setVisible(false);
this.pokemonCaughtCountLabelText.setVisible(false);
this.pokemonCaughtCountText.setVisible(false);
const defaultDexAttr = this.scene.gameData.getSpeciesDefaultDexAttr(species, true);
const defaultNature = this.scene.gameData.getSpeciesDefaultNature(species);
const props = this.scene.gameData.getSpeciesDexAttrProps(species, defaultDexAttr);
this.setSpeciesDetails(species, props.shiny, props.formIndex, props.female, props.abilityIndex, defaultNature, true);
this.pokemonSprite.setTint(0x808080);
}
} else { } else {
this.pokemonNumberText.setText(Utils.padInt(0, 4)); this.pokemonNumberText.setText(Utils.padInt(0, 4));
this.pokemonNameText.setText(species ? '???' : ''); this.pokemonNameText.setText(species ? '???' : '');
this.pokemonGrowthRateText.setText(''); this.pokemonGrowthRateText.setText('');
this.pokemonGrowthRateLabelText.setVisible(false); this.pokemonGrowthRateLabelText.setVisible(false);
this.pokemonUncaughtText.setVisible(!!species);
this.pokemonAbilityLabelText.setVisible(false); this.pokemonAbilityLabelText.setVisible(false);
this.pokemonNatureLabelText.setVisible(false); this.pokemonNatureLabelText.setVisible(false);
this.pokemonCaughtCountLabelText.setVisible(false); this.pokemonCaughtCountLabelText.setVisible(false);
this.pokemonCaughtCountText.setVisible(false); this.pokemonCaughtCountText.setVisible(false);
this.setSpeciesDetails(species, false, 0, false, 0, 0); this.setSpeciesDetails(species, false, 0, false, 0, 0);
this.pokemonSprite.clearTint();
} }
} }
setSpeciesDetails(species: PokemonSpecies, shiny: boolean, formIndex: integer, female: boolean, abilityIndex: integer, natureIndex: integer): void { setSpeciesDetails(species: PokemonSpecies, shiny: boolean, formIndex: integer, female: boolean, abilityIndex: integer, natureIndex: integer, forSeen: boolean = false): void {
const oldProps = species ? this.scene.gameData.getSpeciesDexAttrProps(species, this.dexAttrCursor) : null; const oldProps = species ? this.scene.gameData.getSpeciesDexAttrProps(species, this.dexAttrCursor) : null;
this.dexAttrCursor = 0n; this.dexAttrCursor = 0n;
@ -836,7 +864,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
if (species) { if (species) {
const dexEntry = this.scene.gameData.dexData[species.speciesId]; const dexEntry = this.scene.gameData.dexData[species.speciesId];
if (!dexEntry.caughtAttr) { if (!dexEntry.caughtAttr) {
const props = this.scene.gameData.getSpeciesDexAttrProps(species, this.scene.gameData.getSpeciesDefaultDexAttr(species)); const props = this.scene.gameData.getSpeciesDexAttrProps(species, this.scene.gameData.getSpeciesDefaultDexAttr(species, forSeen));
const defaultNature = this.scene.gameData.getSpeciesDefaultNature(species); const defaultNature = this.scene.gameData.getSpeciesDefaultNature(species);
if (shiny === undefined || shiny !== props.shiny) if (shiny === undefined || shiny !== props.shiny)
shiny = props.shiny; shiny = props.shiny;
@ -850,7 +878,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
natureIndex = defaultNature; natureIndex = defaultNature;
} }
if (this.speciesStarterDexEntry?.caughtAttr) { if (forSeen ? this.speciesStarterDexEntry?.seenAttr : this.speciesStarterDexEntry?.caughtAttr) {
let starterIndex = -1; let starterIndex = -1;
this.starterGens.every((g, i) => { this.starterGens.every((g, i) => {

View File

@ -2,7 +2,6 @@ import BBCodeText from "phaser3-rex-plugins/plugins/gameobjects/tagtext/bbcodete
import BattleScene from "../battle-scene"; import BattleScene from "../battle-scene";
import { Stat, getStatName } from "../data/pokemon-stat"; import { Stat, getStatName } from "../data/pokemon-stat";
import { TextStyle, addBBCodeTextObject, addTextObject, getTextColor } from "./text"; import { TextStyle, addBBCodeTextObject, addTextObject, getTextColor } from "./text";
import { Gender, getGenderColor } from "../data/gender";
const ivChartSize = 24; const ivChartSize = 24;
const ivChartStatCoordMultipliers = [ [ 0, 1 ], [ 0.825, 0.5 ], [ 0.825, -0.5 ], [ 0, -1 ], [ -0.825, -0.5 ], [ -0.825, 0.5 ] ]; const ivChartStatCoordMultipliers = [ [ 0, 1 ], [ 0.825, 0.5 ], [ 0.825, -0.5 ], [ 0, -1 ], [ -0.825, -0.5 ], [ -0.825, 0.5 ] ];