From c683f72aad3bf5b39216e93690772ab7e8f13ebc Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Sun, 3 Mar 2024 21:30:11 -0500 Subject: [PATCH] Replace type gacha with rare egg move gacha --- .../egg/{gacha_type.png => gacha_move.png} | Bin ...lay_type.json => gacha_underlay_move.json} | 2 +- ...erlay_type.png => gacha_underlay_move.png} | Bin src/data/egg.ts | 18 +++-------------- src/egg-hatch-phase.ts | 19 ++++-------------- src/ui/egg-gacha-ui-handler.ts | 18 +++++------------ 6 files changed, 13 insertions(+), 44 deletions(-) rename public/images/egg/{gacha_type.png => gacha_move.png} (100%) rename public/images/egg/{gacha_underlay_type.json => gacha_underlay_move.json} (96%) rename public/images/egg/{gacha_underlay_type.png => gacha_underlay_move.png} (100%) diff --git a/public/images/egg/gacha_type.png b/public/images/egg/gacha_move.png similarity index 100% rename from public/images/egg/gacha_type.png rename to public/images/egg/gacha_move.png diff --git a/public/images/egg/gacha_underlay_type.json b/public/images/egg/gacha_underlay_move.json similarity index 96% rename from public/images/egg/gacha_underlay_type.json rename to public/images/egg/gacha_underlay_move.json index e4b0b3a25..49dcfd542 100644 --- a/public/images/egg/gacha_underlay_type.json +++ b/public/images/egg/gacha_underlay_move.json @@ -1,7 +1,7 @@ { "textures": [ { - "image": "gacha_underlay_type.png", + "image": "gacha_underlay_move.png", "format": "RGBA8888", "size": { "w": 25, diff --git a/public/images/egg/gacha_underlay_type.png b/public/images/egg/gacha_underlay_move.png similarity index 100% rename from public/images/egg/gacha_underlay_type.png rename to public/images/egg/gacha_underlay_move.png diff --git a/src/data/egg.ts b/src/data/egg.ts index 28626ef2a..08982cd4a 100644 --- a/src/data/egg.ts +++ b/src/data/egg.ts @@ -8,7 +8,7 @@ import { EggTier } from "./enums/egg-type"; export const EGG_SEED = 1073741824; export enum GachaType { - TYPE, + MOVE, LEGENDARY, SHINY } @@ -82,8 +82,8 @@ export function getEggGachaTypeDescriptor(scene: BattleScene, egg: Egg): string switch (egg.gachaType) { case GachaType.LEGENDARY: return `Legendary Rate Up (${getPokemonSpecies(getLegendaryGachaSpeciesForTimestamp(scene, egg.timestamp)).getName()})`; - case GachaType.TYPE: - return `Type Rate Up (${Utils.toReadableString(Type[getTypeGachaTypeForTimestamp(scene, egg.timestamp)])})`; + case GachaType.MOVE: + return 'Rare Egg Move Rate Up'; case GachaType.SHINY: return 'Shiny Rate Up'; } @@ -101,17 +101,5 @@ export function getLegendaryGachaSpeciesForTimestamp(scene: BattleScene, timesta ret = Utils.randSeedItem(legendarySpecies); }, Utils.getSunday(new Date(timestamp)).getTime(), EGG_SEED.toString()); - return ret; -} - -export function getTypeGachaTypeForTimestamp(scene: BattleScene, timestamp: integer): Type { - const allTypes = Utils.getEnumValues(Type); - const types = allTypes.slice(1, allTypes.length - 1); - let ret: Type; - - scene.executeWithSeedOffset(() => { - ret = Utils.randSeedItem(types); - }, Utils.getSunday(new Date(timestamp)).getTime(), EGG_SEED.toString()); - return ret; } \ No newline at end of file diff --git a/src/egg-hatch-phase.ts b/src/egg-hatch-phase.ts index 0d8d158ad..03c5d0ccb 100644 --- a/src/egg-hatch-phase.ts +++ b/src/egg-hatch-phase.ts @@ -3,7 +3,7 @@ import { Phase } from "./phase"; import BattleScene, { AnySound } from "./battle-scene"; import * as Utils from "./utils"; import { Mode } from "./ui/ui"; -import { EGG_SEED, Egg, GachaType, getLegendaryGachaSpeciesForTimestamp, getTypeGachaTypeForTimestamp } from "./data/egg"; +import { EGG_SEED, Egg, GachaType, getLegendaryGachaSpeciesForTimestamp } from "./data/egg"; import EggHatchSceneHandler from "./ui/egg-hatch-scene-handler"; import { Species } from "./data/enums/species"; import { PlayerPokemon } from "./field/pokemon"; @@ -414,18 +414,6 @@ export class EggHatchPhase extends Phase { .map(s => parseInt(s) as Species) .filter(s => !pokemonPrevolutions.hasOwnProperty(s) && getPokemonSpecies(s).isObtainable() && ignoredSpecies.indexOf(s) === -1); - if (this.egg.gachaType === GachaType.TYPE) { - let tryOverrideType = !Utils.randSeedInt(2); - - if (tryOverrideType) { - const type = getTypeGachaTypeForTimestamp(this.scene, this.egg.timestamp); - const typeFilteredSpeciesPool = speciesPool - .filter(s => getPokemonSpecies(s).isOfType(type)); - if (typeFilteredSpeciesPool.length) - speciesPool = typeFilteredSpeciesPool; - } - } - let totalWeight = 0; const speciesWeights = []; for (let speciesId of speciesPool) { @@ -467,10 +455,11 @@ export class EggHatchPhase extends Phase { for (let s = 0; s < ret.ivs.length; s++) ret.ivs[s] = Math.max(ret.ivs[s], secondaryIvs[s]); - this.eggMoveIndex = Utils.randSeedInt(6 * Math.pow(2, 3 - this.egg.tier)) + const baseChance = this.egg.gachaType === GachaType.MOVE ? 3 : 6; + this.eggMoveIndex = Utils.randSeedInt(baseChance * Math.pow(2, 3 - this.egg.tier)) ? Utils.randSeedInt(3) : 3; - + }, this.egg.id, EGG_SEED.toString()); return ret; diff --git a/src/ui/egg-gacha-ui-handler.ts b/src/ui/egg-gacha-ui-handler.ts index 4f771fa19..57672143f 100644 --- a/src/ui/egg-gacha-ui-handler.ts +++ b/src/ui/egg-gacha-ui-handler.ts @@ -3,7 +3,7 @@ import { Mode } from "./ui"; import { TextStyle, addTextObject, getEggTierTextTint } from "./text"; import MessageUiHandler from "./message-ui-handler"; import * as Utils from "../utils"; -import { EGG_SEED, Egg, GachaType, getEggTierDefaultHatchWaves, getEggDescriptor, getLegendaryGachaSpeciesForTimestamp, getTypeGachaTypeForTimestamp } from "../data/egg"; +import { EGG_SEED, Egg, GachaType, getEggTierDefaultHatchWaves, getEggDescriptor, getLegendaryGachaSpeciesForTimestamp } from "../data/egg"; import { VoucherType, getVoucherTypeIcon } from "../system/voucher"; import { getPokemonSpecies } from "../data/pokemon-species"; import { Type } from "../data/type"; @@ -101,14 +101,10 @@ export default class EggGachaUiHandler extends MessageUiHandler { gachaInfoContainer.add(pokemonIcon); break; - case GachaType.TYPE: - const typeIcon = this.scene.add.sprite(-22, 7, 'types', 'unknown'); - typeIcon.setScale(0.75); - typeIcon.setOrigin(0, 0.5); - - gachaUpLabel.x += 4; - - gachaInfoContainer.add(typeIcon); + case GachaType.MOVE: + gachaUpLabel.setText('Move UP!'); + gachaUpLabel.setX(0); + gachaUpLabel.setOrigin(0.5, 0); break; case GachaType.SHINY: gachaUpLabel.setText('Shiny UP!'); @@ -462,10 +458,6 @@ export default class EggGachaUiHandler extends MessageUiHandler { const pokemonIcon = infoContainer.getAt(1) as Phaser.GameObjects.Sprite; pokemonIcon.setTexture(species.getIconAtlasKey(), species.getIconId(false)); break; - case GachaType.TYPE: - const typeIcon = infoContainer.getAt(1) as Phaser.GameObjects.Sprite; - typeIcon.setFrame(Type[getTypeGachaTypeForTimestamp(this.scene, new Date().getTime())].toLowerCase()); - break; } }