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": [
{
"image": "gacha_underlay_type.png",
"image": "gacha_underlay_move.png",
"format": "RGBA8888",
"size": {
"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 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';
}
@ -103,15 +103,3 @@ export function getLegendaryGachaSpeciesForTimestamp(scene: BattleScene, timesta
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;
}

View File

@ -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,7 +455,8 @@ 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;

View File

@ -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;
}
}