Replace type gacha with rare egg move gacha

pull/16/head
Flashfyre 2024-03-03 21:30:11 -05:00
parent 6dc5e7b1fd
commit c683f72aad
6 changed files with 13 additions and 44 deletions

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -1,7 +1,7 @@
{ {
"textures": [ "textures": [
{ {
"image": "gacha_underlay_type.png", "image": "gacha_underlay_move.png",
"format": "RGBA8888", "format": "RGBA8888",
"size": { "size": {
"w": 25, "w": 25,

View File

Before

Width:  |  Height:  |  Size: 421 B

After

Width:  |  Height:  |  Size: 421 B

View File

@ -8,7 +8,7 @@ import { EggTier } from "./enums/egg-type";
export const EGG_SEED = 1073741824; export const EGG_SEED = 1073741824;
export enum GachaType { export enum GachaType {
TYPE, MOVE,
LEGENDARY, LEGENDARY,
SHINY SHINY
} }
@ -82,8 +82,8 @@ export function getEggGachaTypeDescriptor(scene: BattleScene, egg: Egg): string
switch (egg.gachaType) { switch (egg.gachaType) {
case GachaType.LEGENDARY: case GachaType.LEGENDARY:
return `Legendary Rate Up (${getPokemonSpecies(getLegendaryGachaSpeciesForTimestamp(scene, egg.timestamp)).getName()})`; return `Legendary Rate Up (${getPokemonSpecies(getLegendaryGachaSpeciesForTimestamp(scene, egg.timestamp)).getName()})`;
case GachaType.TYPE: case GachaType.MOVE:
return `Type Rate Up (${Utils.toReadableString(Type[getTypeGachaTypeForTimestamp(scene, egg.timestamp)])})`; return 'Rare Egg Move Rate Up';
case GachaType.SHINY: case GachaType.SHINY:
return 'Shiny Rate Up'; return 'Shiny Rate Up';
} }
@ -101,17 +101,5 @@ export function getLegendaryGachaSpeciesForTimestamp(scene: BattleScene, timesta
ret = Utils.randSeedItem(legendarySpecies); ret = Utils.randSeedItem(legendarySpecies);
}, Utils.getSunday(new Date(timestamp)).getTime(), EGG_SEED.toString()); }, 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; return ret;
} }

View File

@ -3,7 +3,7 @@ import { Phase } from "./phase";
import BattleScene, { AnySound } from "./battle-scene"; import BattleScene, { AnySound } from "./battle-scene";
import * as Utils from "./utils"; import * as Utils from "./utils";
import { Mode } from "./ui/ui"; 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 EggHatchSceneHandler from "./ui/egg-hatch-scene-handler";
import { Species } from "./data/enums/species"; import { Species } from "./data/enums/species";
import { PlayerPokemon } from "./field/pokemon"; import { PlayerPokemon } from "./field/pokemon";
@ -414,18 +414,6 @@ export class EggHatchPhase extends Phase {
.map(s => parseInt(s) as Species) .map(s => parseInt(s) as Species)
.filter(s => !pokemonPrevolutions.hasOwnProperty(s) && getPokemonSpecies(s).isObtainable() && ignoredSpecies.indexOf(s) === -1); .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; let totalWeight = 0;
const speciesWeights = []; const speciesWeights = [];
for (let speciesId of speciesPool) { for (let speciesId of speciesPool) {
@ -467,10 +455,11 @@ export class EggHatchPhase extends Phase {
for (let s = 0; s < ret.ivs.length; s++) for (let s = 0; s < ret.ivs.length; s++)
ret.ivs[s] = Math.max(ret.ivs[s], secondaryIvs[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) ? Utils.randSeedInt(3)
: 3; : 3;
}, this.egg.id, EGG_SEED.toString()); }, this.egg.id, EGG_SEED.toString());
return ret; return ret;

View File

@ -3,7 +3,7 @@ import { Mode } from "./ui";
import { TextStyle, addTextObject, getEggTierTextTint } from "./text"; import { TextStyle, addTextObject, getEggTierTextTint } from "./text";
import MessageUiHandler from "./message-ui-handler"; import MessageUiHandler from "./message-ui-handler";
import * as Utils from "../utils"; 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 { VoucherType, getVoucherTypeIcon } from "../system/voucher";
import { getPokemonSpecies } from "../data/pokemon-species"; import { getPokemonSpecies } from "../data/pokemon-species";
import { Type } from "../data/type"; import { Type } from "../data/type";
@ -101,14 +101,10 @@ export default class EggGachaUiHandler extends MessageUiHandler {
gachaInfoContainer.add(pokemonIcon); gachaInfoContainer.add(pokemonIcon);
break; break;
case GachaType.TYPE: case GachaType.MOVE:
const typeIcon = this.scene.add.sprite(-22, 7, 'types', 'unknown'); gachaUpLabel.setText('Move UP!');
typeIcon.setScale(0.75); gachaUpLabel.setX(0);
typeIcon.setOrigin(0, 0.5); gachaUpLabel.setOrigin(0.5, 0);
gachaUpLabel.x += 4;
gachaInfoContainer.add(typeIcon);
break; break;
case GachaType.SHINY: case GachaType.SHINY:
gachaUpLabel.setText('Shiny UP!'); gachaUpLabel.setText('Shiny UP!');
@ -462,10 +458,6 @@ export default class EggGachaUiHandler extends MessageUiHandler {
const pokemonIcon = infoContainer.getAt(1) as Phaser.GameObjects.Sprite; const pokemonIcon = infoContainer.getAt(1) as Phaser.GameObjects.Sprite;
pokemonIcon.setTexture(species.getIconAtlasKey(), species.getIconId(false)); pokemonIcon.setTexture(species.getIconAtlasKey(), species.getIconId(false));
break; break;
case GachaType.TYPE:
const typeIcon = infoContainer.getAt(1) as Phaser.GameObjects.Sprite;
typeIcon.setFrame(Type[getTypeGachaTypeForTimestamp(this.scene, new Date().getTime())].toLowerCase());
break;
} }
} }