updated egg hatch bg, added candy tracker, icon anims for new shiny or new form unlock

This commit is contained in:
James Diefenbach 2024-08-24 21:31:07 +10:00
parent 92a3ad1105
commit 3172c51266
7 changed files with 42 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

View File

@ -29,6 +29,7 @@ export class EggSummaryPhase extends Phase {
});
} else {
this.eggHatchData[i].setDex();
this.eggHatchData[i].updatePokemon().then(() => {
console.log("updating next pokemon");
if (i < this.eggHatchData.length) {

View File

@ -10,6 +10,7 @@ import { EggTier } from "#app/enums/egg-type.js";
import PokemonHatchInfoContainer from "./pokemon-hatch-info-container";
import { EggHatchData } from "#app/phases/egg-hatch-phase.js";
import { EggSummaryPhase } from "#app/phases/egg-summary-phase.js";
import { DexAttr } from "#app/system/game-data.js";
export default class EggSummaryUiHandler extends MessageUiHandler {
private pokemonListContainer: Phaser.GameObjects.Container;
@ -51,6 +52,7 @@ export default class EggSummaryUiHandler extends MessageUiHandler {
this.eggHatchContainer = this.scene.add.container(0, -this.scene.game.canvas.height / 6);
this.eggHatchContainer.setVisible(false);
ui.add(this.eggHatchContainer);
// this.scene.fieldUI.add(this.eggHatchContainer);
// const bgColor = this.scene.add.rectangle(0, 0, this.scene.game.canvas.width / 6, this.scene.game.canvas.height / 6, 0x006860);
@ -62,6 +64,8 @@ export default class EggSummaryUiHandler extends MessageUiHandler {
this.eggHatchBg = this.scene.add.image(0, 0, "egg_summary_bg");
this.eggHatchBg.setOrigin(0, 0);
this.eggHatchContainer.add(this.eggHatchBg);
// this.eggHatchContainer.add(addWindow(this.scene, 107, 1, 212, 178));
this.pokemonIconsContainer = this.scene.add.container(115, 9);
this.pokemonIconSpritesContainer = this.scene.add.container(115, 9);
@ -159,7 +163,7 @@ export default class EggSummaryUiHandler extends MessageUiHandler {
// set tint for passive bg
switch (getEggTierForSpecies(displayPokemon.species)) {
case EggTier.COMMON:
bg.setTint(0xabddab);
bg.setVisible(false);
break;
case EggTier.GREAT:
bg.setTint(0xabafff);
@ -181,8 +185,7 @@ export default class EggSummaryUiHandler extends MessageUiHandler {
this.pokemonIconSpritesContainer.add(icon);
this.iconAnimHandler.addOrUpdate(icon, PokemonIconAnimMode.NONE);
// add shiny
const shiny = this.scene.add.image(x + 12, y + 2, "shiny_star_small");
const shiny = this.scene.add.image(x + 12, y + 4, "shiny_star_small");
shiny.setScale(0.5);
shiny.setVisible(displayPokemon.shiny);
shiny.setTint(getVariantTint(displayPokemon.variant));
@ -196,10 +199,17 @@ export default class EggSummaryUiHandler extends MessageUiHandler {
const pb = this.scene.add.image(x + 12, y + 14, "icon_owned");
pb.setOrigin(0, 0);
pb.setScale(0.5);
// add animation for new unlocks (new catch or new shiny or new form)
const dexEntry = value.prevDexEntry;
const caughtAttr = dexEntry.caughtAttr;
pb.setVisible(!caughtAttr);
if (!caughtAttr) {
const newShiny = BigInt(1 << (displayPokemon.shiny ? 1 : 0));
const newVariant = BigInt(1 << (displayPokemon.variant + 4));
const newShinyOrVariant = ((newShiny & caughtAttr) === BigInt(0)) || ((newVariant & caughtAttr) === BigInt(0));
const newForm = (BigInt(1 << displayPokemon.formIndex) * DexAttr.DEFAULT_FORM & caughtAttr) === BigInt(0);
pb.setVisible(!caughtAttr || newForm);
if (!caughtAttr || newShinyOrVariant || newForm) {
this.iconAnimHandler.addOrUpdate(icon, PokemonIconAnimMode.PASSIVE);
}
this.pokemonIconsContainer.add(pb);

View File

@ -11,6 +11,8 @@ import { allMoves } from "#app/data/move.js";
import { Species } from "#app/enums/species.js";
import { getEggTierForSpecies } from "#app/data/egg.js";
import { EggHatchData } from "#app/phases/egg-hatch-phase.js";
import { starterColors } from "../battle-scene";
import { argbFromRgba } from "@material/material-color-utilities";
export default class PokemonHatchInfoContainer extends PokemonInfoContainer {
private currentPokemonSprite: Phaser.GameObjects.Sprite;
@ -22,6 +24,9 @@ export default class PokemonHatchInfoContainer extends PokemonInfoContainer {
private pokemonEggMoveLabels: Phaser.GameObjects.Text[];
private pokemonHatchedIcon : Phaser.GameObjects.Sprite;
private pokemonListContainer: Phaser.GameObjects.Container;
private pokemonCandyIcon: Phaser.GameObjects.Sprite;
private pokemonCandyOverlayIcon: Phaser.GameObjects.Sprite;
private pokemonCandyCountText: Phaser.GameObjects.Text;
constructor(scene: BattleScene, listContainer : Phaser.GameObjects.Container, x: number = 115, y: number = 9,) {
super(scene, x, y);
@ -50,6 +55,20 @@ export default class PokemonHatchInfoContainer extends PokemonInfoContainer {
this.pokemonHatchedIcon.setScale(0.8);
this.pokemonListContainer.add(this.pokemonHatchedIcon);
this.pokemonCandyIcon = this.scene.add.sprite(4.5, 40, "candy");
this.pokemonCandyIcon.setScale(0.5);
this.pokemonCandyIcon.setOrigin(0, 0);
this.pokemonListContainer.add(this.pokemonCandyIcon);
this.pokemonCandyOverlayIcon = this.scene.add.sprite(4.5, 40, "candy_overlay");
this.pokemonCandyOverlayIcon.setScale(0.5);
this.pokemonCandyOverlayIcon.setOrigin(0, 0);
this.pokemonListContainer.add(this.pokemonCandyOverlayIcon);
this.pokemonCandyCountText = addTextObject(this.scene, 14, 40, "x0", TextStyle.WINDOW_ALT, { fontSize: "56px" });
this.pokemonCandyCountText.setOrigin(0, 0);
this.pokemonListContainer.add(this.pokemonCandyCountText);
this.pokemonEggMoveContainers = [];
this.pokemonEggMoveBgs = [];
this.pokemonEggMoveLabels = [];
@ -99,7 +118,14 @@ export default class PokemonHatchInfoContainer extends PokemonInfoContainer {
const shiny = displayPokemon.shiny;
const variant = displayPokemon.variant;
super.show(displayPokemon, false, 1, hatchInfo.getDex(), hatchInfo.prevStarterEntry, true);
const colorScheme = starterColors[species.speciesId];
this.pokemonCandyIcon.setTint(argbFromRgba(Utils.rgbHexToRgba(colorScheme[0])));
this.pokemonCandyIcon.setVisible(true);
this.pokemonCandyOverlayIcon.setTint(argbFromRgba(Utils.rgbHexToRgba(colorScheme[1])));
this.pokemonCandyOverlayIcon.setVisible(true);
this.pokemonCandyCountText.setText(`x${this.scene.gameData.starterData[species.speciesId].candyCount}`);
this.pokemonCandyCountText.setVisible(true);
species.loadAssets(this.scene, female, formIndex, shiny, variant, true).then(() => {
// if (assetLoadCancelled.value) {
// return;