Rebalance item weights and add Rogue tier

This commit is contained in:
Flashfyre 2024-02-28 23:13:05 -05:00
parent ce64eb6c70
commit ffd785d534
22 changed files with 1518 additions and 1360 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

BIN
public/images/items/rb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

View File

@ -4,8 +4,8 @@
"image": "pb.png",
"format": "RGBA8888",
"size": {
"w": 14,
"h": 245
"w": 12,
"h": 246
},
"scale": 1,
"frames": [
@ -24,8 +24,8 @@
"h": 16
},
"frame": {
"x": 1,
"y": 1,
"x": 0,
"y": 0,
"w": 12,
"h": 16
}
@ -45,8 +45,8 @@
"h": 16
},
"frame": {
"x": 1,
"y": 19,
"x": 0,
"y": 16,
"w": 12,
"h": 16
}
@ -66,8 +66,8 @@
"h": 16
},
"frame": {
"x": 1,
"y": 37,
"x": 0,
"y": 32,
"w": 12,
"h": 16
}
@ -87,8 +87,29 @@
"h": 16
},
"frame": {
"x": 1,
"y": 55,
"x": 0,
"y": 48,
"w": 12,
"h": 16
}
},
{
"filename": "rb_open",
"rotated": false,
"trimmed": false,
"sourceSize": {
"w": 12,
"h": 16
},
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 12,
"h": 16
},
"frame": {
"x": 0,
"y": 64,
"w": 12,
"h": 16
}
@ -108,8 +129,8 @@
"h": 16
},
"frame": {
"x": 1,
"y": 73,
"x": 0,
"y": 80,
"w": 12,
"h": 16
}
@ -124,15 +145,15 @@
},
"spriteSourceSize": {
"x": 0,
"y": 2,
"y": 3,
"w": 12,
"h": 14
"h": 13
},
"frame": {
"x": 1,
"y": 91,
"x": 0,
"y": 96,
"w": 12,
"h": 14
"h": 13
}
},
{
@ -145,15 +166,15 @@
},
"spriteSourceSize": {
"x": 0,
"y": 2,
"y": 3,
"w": 12,
"h": 14
"h": 13
},
"frame": {
"x": 1,
"y": 107,
"x": 0,
"y": 109,
"w": 12,
"h": 14
"h": 13
}
},
{
@ -166,15 +187,15 @@
},
"spriteSourceSize": {
"x": 0,
"y": 2,
"y": 3,
"w": 12,
"h": 14
"h": 13
},
"frame": {
"x": 1,
"y": 123,
"x": 0,
"y": 122,
"w": 12,
"h": 14
"h": 13
}
},
{
@ -187,15 +208,36 @@
},
"spriteSourceSize": {
"x": 0,
"y": 2,
"y": 3,
"w": 12,
"h": 14
"h": 13
},
"frame": {
"x": 1,
"y": 139,
"x": 0,
"y": 135,
"w": 12,
"h": 14
"h": 13
}
},
{
"filename": "rb_opening",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 12,
"h": 16
},
"spriteSourceSize": {
"x": 0,
"y": 3,
"w": 12,
"h": 13
},
"frame": {
"x": 0,
"y": 148,
"w": 12,
"h": 13
}
},
{
@ -208,15 +250,15 @@
},
"spriteSourceSize": {
"x": 0,
"y": 2,
"y": 3,
"w": 12,
"h": 14
"h": 13
},
"frame": {
"x": 1,
"y": 155,
"x": 0,
"y": 161,
"w": 12,
"h": 14
"h": 13
}
},
{
@ -229,15 +271,15 @@
},
"spriteSourceSize": {
"x": 0,
"y": 3,
"y": 4,
"w": 12,
"h": 13
"h": 12
},
"frame": {
"x": 1,
"y": 171,
"x": 0,
"y": 174,
"w": 12,
"h": 13
"h": 12
}
},
{
@ -250,15 +292,15 @@
},
"spriteSourceSize": {
"x": 0,
"y": 3,
"y": 4,
"w": 12,
"h": 13
"h": 12
},
"frame": {
"x": 1,
"x": 0,
"y": 186,
"w": 12,
"h": 13
"h": 12
}
},
{
@ -271,15 +313,15 @@
},
"spriteSourceSize": {
"x": 0,
"y": 3,
"y": 4,
"w": 12,
"h": 13
"h": 12
},
"frame": {
"x": 1,
"y": 201,
"x": 0,
"y": 198,
"w": 12,
"h": 13
"h": 12
}
},
{
@ -292,15 +334,36 @@
},
"spriteSourceSize": {
"x": 0,
"y": 3,
"y": 4,
"w": 12,
"h": 13
"h": 12
},
"frame": {
"x": 1,
"y": 216,
"x": 0,
"y": 210,
"w": 12,
"h": 13
"h": 12
}
},
{
"filename": "rb",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 12,
"h": 16
},
"spriteSourceSize": {
"x": 0,
"y": 4,
"w": 12,
"h": 12
},
"frame": {
"x": 0,
"y": 222,
"w": 12,
"h": 12
}
},
{
@ -313,15 +376,15 @@
},
"spriteSourceSize": {
"x": 0,
"y": 3,
"y": 4,
"w": 12,
"h": 13
"h": 12
},
"frame": {
"x": 1,
"y": 231,
"x": 0,
"y": 234,
"w": 12,
"h": 13
"h": 12
}
}
]
@ -330,6 +393,6 @@
"meta": {
"app": "https://www.codeandweb.com/texturepacker",
"version": "3.0",
"smartupdate": "$TexturePacker:SmartUpdate:c08fee07b4a02d4a278d0b9e81cafea9:8bb540e5126337d0b85e58b6cfcef619:8bcd206ed4f9371dcc2f2cbe354ed6ed$"
"smartupdate": "$TexturePacker:SmartUpdate:d0201027b060060859e6dd538ff09720:06e35198d6d176c5d754233d7a871f7c:8bcd206ed4f9371dcc2f2cbe354ed6ed$"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 946 B

After

Width:  |  Height:  |  Size: 995 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

View File

@ -11,6 +11,7 @@ export function addPokeballOpenParticles(scene: BattleScene, x: number, y: numbe
doDefaultPbOpenParticles(scene, x, y, 96);
break;
case PokeballType.ULTRA_BALL:
case PokeballType.ROGUE_BALL:
doUbOpenParticles(scene, x, y);
break;
case PokeballType.MASTER_BALL:

View File

@ -1171,7 +1171,7 @@ export default class BattleScene extends Phaser.Scene {
else if (this.isButtonPressed(Button.CANCEL)) {
inputSuccess = this.ui.processInput(Button.CANCEL);
} else if (this.isButtonPressed(Button.MENU)) {
switch (this.ui.getMode()) {
switch (this.ui?.getMode()) {
case Mode.MESSAGE:
if (!(this.ui.getHandler() as MessageUiHandler).pendingPrompt)
return;
@ -1213,13 +1213,13 @@ export default class BattleScene extends Phaser.Scene {
} else if (this.isButtonPressed(Button.SPEED_UP)) {
if (this.gameSpeed < 5) {
this.gameData.saveSetting(Setting.Game_Speed, settingOptions[Setting.Game_Speed].indexOf(`${this.gameSpeed}x`) + 1);
if (this.ui.getMode() === Mode.SETTINGS)
if (this.ui?.getMode() === Mode.SETTINGS)
(this.ui.getHandler() as SettingsUiHandler).show([]);
}
} else if (this.isButtonPressed(Button.SLOW_DOWN)) {
if (this.gameSpeed > 1) {
this.gameData.saveSetting(Setting.Game_Speed, Math.max(settingOptions[Setting.Game_Speed].indexOf(`${this.gameSpeed}x`) - 1, 0));
if (this.ui.getMode() === Mode.SETTINGS)
if (this.ui?.getMode() === Mode.SETTINGS)
(this.ui.getHandler() as SettingsUiHandler).show([]);
}
} else

View File

@ -1,9 +1,9 @@
import { ModifierTier } from "../modifier/modifier-tier";
import { Type } from "./type";
import * as Utils from "../utils";
import BattleScene from "../battle-scene";
import { Species } from "./enums/species";
import { getPokemonSpecies, speciesStarters } from "./pokemon-species";
import { EggTier } from "./enums/egg-type";
export const EGG_SEED = 1073741824;
@ -15,7 +15,7 @@ export enum GachaType {
export class Egg {
public id: integer;
public tier: ModifierTier;
public tier: EggTier;
public gachaType: GachaType;
public hatchWaves: integer;
public timestamp: integer;
@ -29,7 +29,7 @@ export class Egg {
}
isManaphyEgg(): boolean {
return this.tier === ModifierTier.COMMON && !(this.id % 255);
return this.tier === EggTier.COMMON && !(this.id % 255);
}
getKey(): string {
@ -39,13 +39,13 @@ export class Egg {
}
}
export function getEggTierDefaultHatchWaves(tier: ModifierTier): integer {
export function getEggTierDefaultHatchWaves(tier: EggTier): integer {
switch (tier) {
case ModifierTier.COMMON:
case EggTier.COMMON:
return 10;
case ModifierTier.GREAT:
case EggTier.GREAT:
return 25;
case ModifierTier.ULTRA:
case EggTier.ULTRA:
return 50;
}
return 100;
@ -55,11 +55,11 @@ export function getEggDescriptor(egg: Egg): string {
if (egg.isManaphyEgg())
return 'Manaphy';
switch (egg.tier) {
case ModifierTier.GREAT:
case EggTier.GREAT:
return 'Rare';
case ModifierTier.ULTRA:
case EggTier.ULTRA:
return 'Epic';
case ModifierTier.MASTER:
case EggTier.MASTER:
return 'Legendary';
default:
return 'Common';

View File

@ -0,0 +1,6 @@
export enum EggTier {
COMMON,
GREAT,
ULTRA,
MASTER
}

View File

@ -4,6 +4,7 @@ export enum PokeballType {
POKEBALL,
GREAT_BALL,
ULTRA_BALL,
ROGUE_BALL,
MASTER_BALL,
LUXURY_BALL
};
@ -16,6 +17,8 @@ export function getPokeballAtlasKey(type: PokeballType): string {
return 'gb';
case PokeballType.ULTRA_BALL:
return 'ub';
case PokeballType.ROGUE_BALL:
return 'rb';
case PokeballType.MASTER_BALL:
return 'mb';
case PokeballType.LUXURY_BALL:
@ -35,6 +38,9 @@ export function getPokeballName(type: PokeballType): string {
case PokeballType.ULTRA_BALL:
ret = 'Ultra Ball';
break;
case PokeballType.ROGUE_BALL:
ret = 'Rogue Ball';
break;
case PokeballType.MASTER_BALL:
ret = 'Master Ball';
break;
@ -53,6 +59,8 @@ export function getPokeballCatchMultiplier(type: PokeballType): number {
return 1.5;
case PokeballType.ULTRA_BALL:
return 2;
case PokeballType.ROGUE_BALL:
return 3;
case PokeballType.MASTER_BALL:
return -1;
case PokeballType.LUXURY_BALL:
@ -68,6 +76,8 @@ export function getPokeballTintColor(type: PokeballType): number {
return 0x94b4de;
case PokeballType.ULTRA_BALL:
return 0xe6cd31;
case PokeballType.ROGUE_BALL:
return 0xd52929;
case PokeballType.MASTER_BALL:
return 0xa441bd;
case PokeballType.LUXURY_BALL:

View File

@ -5,7 +5,6 @@ import * as Utils from "./utils";
import { Mode } from "./ui/ui";
import { EGG_SEED, Egg, GachaType, getLegendaryGachaSpeciesForTimestamp, getTypeGachaTypeForTimestamp } from "./data/egg";
import EggHatchSceneHandler from "./ui/egg-hatch-scene-handler";
import { ModifierTier } from "./modifier/modifier-tier";
import { Species } from "./data/enums/species";
import { PlayerPokemon } from "./pokemon";
import { getPokemonSpecies, speciesStarters } from "./data/pokemon-species";
@ -16,6 +15,7 @@ import { achvs } from "./system/achv";
import { addWindow } from "./ui/window";
import { getNatureName } from "./data/nature";
import { pokemonPrevolutions } from "./data/pokemon-evolutions";
import { EggTier } from "./data/enums/egg-type";
export class EggHatchPhase extends Phase {
private egg: Egg;
@ -375,7 +375,7 @@ export class EggHatchPhase extends Phase {
speciesOverride = rand ? Species.PHIONE : Species.MANAPHY;
}, this.egg.id, EGG_SEED.toString());
} else if (this.egg.tier === ModifierTier.MASTER
} else if (this.egg.tier === EggTier.MASTER
&& this.egg.gachaType === GachaType.LEGENDARY) {
this.scene.executeWithSeedOffset(() => {
if (!Utils.randSeedInt(2))
@ -393,15 +393,15 @@ export class EggHatchPhase extends Phase {
let maxStarterValue: integer;
switch (this.egg.tier) {
case ModifierTier.GREAT:
case EggTier.GREAT:
minStarterValue = 4;
maxStarterValue = 5;
break;
case ModifierTier.ULTRA:
case EggTier.ULTRA:
minStarterValue = 6;
maxStarterValue = 7;
break;
case ModifierTier.MASTER:
case EggTier.MASTER:
minStarterValue = 8;
maxStarterValue = 9;
break;

View File

@ -2,6 +2,7 @@ export enum ModifierTier {
COMMON,
GREAT,
ULTRA,
ROGUE,
MASTER,
LUXURY
}

View File

@ -20,6 +20,9 @@ import { VoucherType, getVoucherTypeIcon, getVoucherTypeName } from '../system/v
import { FormChangeItem, SpeciesFormChangeItemTrigger, pokemonFormChanges } from '../data/pokemon-forms';
import { ModifierTier } from './modifier-tier';
const outputModifierData = false;
const useMaxWeightForOutput = false;
type Modifier = Modifiers.Modifier;
export enum ModifierPoolType {
@ -678,11 +681,13 @@ type WeightedModifierTypeWeightFunc = (party: Pokemon[]) => integer;
class WeightedModifierType {
public modifierType: ModifierType;
public weight: integer | WeightedModifierTypeWeightFunc;
public maxWeight: integer;
constructor(modifierTypeFunc: ModifierTypeFunc, weight: integer | WeightedModifierTypeWeightFunc) {
constructor(modifierTypeFunc: ModifierTypeFunc, weight: integer | WeightedModifierTypeWeightFunc, maxWeight?: integer) {
this.modifierType = modifierTypeFunc();
this.modifierType.id = Object.keys(modifierTypes).find(k => modifierTypes[k] === modifierTypeFunc);
this.weight = weight;
this.maxWeight = maxWeight || (!(weight instanceof Function) ? weight : 0);
}
setTier(tier: ModifierTier) {
@ -694,6 +699,7 @@ export const modifierTypes = {
POKEBALL: () => new AddPokeballModifierType(PokeballType.POKEBALL, 5, 'pb'),
GREAT_BALL: () => new AddPokeballModifierType(PokeballType.GREAT_BALL, 5, 'gb'),
ULTRA_BALL: () => new AddPokeballModifierType(PokeballType.ULTRA_BALL, 5, 'ub'),
ROGUE_BALL: () => new AddPokeballModifierType(PokeballType.ROGUE_BALL, 5, 'rb'),
MASTER_BALL: () => new AddPokeballModifierType(PokeballType.MASTER_BALL, 1, 'mb'),
RARE_CANDY: () => new PokemonLevelIncrementModifierType('Rare Candy'),
@ -878,19 +884,19 @@ const modifierPool = {
new WeightedModifierType(modifierTypes.POTION, (party: Pokemon[]) => {
const thresholdPartyMemberCount = Math.min(party.filter(p => p.getInverseHp() >= 10 || p.getHpRatio() <= 0.875).length, 3);
return thresholdPartyMemberCount * 3;
}),
}, 9),
new WeightedModifierType(modifierTypes.SUPER_POTION, (party: Pokemon[]) => {
const thresholdPartyMemberCount = Math.min(party.filter(p => p.getInverseHp() >= 25 || p.getHpRatio() <= 0.75).length, 3);
return thresholdPartyMemberCount;
}),
}, 3),
new WeightedModifierType(modifierTypes.ETHER, (party: Pokemon[]) => {
const thresholdPartyMemberCount = Math.min(party.filter(p => p.hp && p.getMoveset().filter(m => (m.getMove().pp - m.ppUsed) <= 5).length).length, 3);
return thresholdPartyMemberCount * 3;
}),
}, 9),
new WeightedModifierType(modifierTypes.MAX_ETHER, (party: Pokemon[]) => {
const thresholdPartyMemberCount = Math.min(party.filter(p => p.hp && p.getMoveset().filter(m => (m.getMove().pp - m.ppUsed) <= 5).length).length, 3);
return thresholdPartyMemberCount;
}),
}, 3),
new WeightedModifierType(modifierTypes.LURE, 2),
new WeightedModifierType(modifierTypes.TEMP_STAT_BOOSTER, 4),
new WeightedModifierType(modifierTypes.BERRY, 2),
@ -898,110 +904,110 @@ const modifierPool = {
].map(m => { m.setTier(ModifierTier.COMMON); return m; }),
[ModifierTier.GREAT]: [
new WeightedModifierType(modifierTypes.GREAT_BALL, 6),
new WeightedModifierType(modifierTypes.EVOLUTION_ITEM, 2),
new WeightedModifierType(modifierTypes.FULL_HEAL, (party: Pokemon[]) => {
const statusEffectPartyMemberCount = Math.min(party.filter(p => p.hp && !!p.status).length, 3);
return statusEffectPartyMemberCount * 6;
}),
}, 18),
new WeightedModifierType(modifierTypes.REVIVE, (party: Pokemon[]) => {
const faintedPartyMemberCount = Math.min(party.filter(p => p.isFainted()).length, 3);
return faintedPartyMemberCount * 9;
}),
}, 3),
new WeightedModifierType(modifierTypes.MAX_REVIVE, (party: Pokemon[]) => {
const faintedPartyMemberCount = Math.min(party.filter(p => p.isFainted()).length, 3);
return faintedPartyMemberCount * 3;
}),
}, 9),
new WeightedModifierType(modifierTypes.SACRED_ASH, (party: Pokemon[]) => {
return party.filter(p => p.isFainted()).length >= Math.ceil(party.length / 2) ? 1 : 0;
}),
}, 1),
new WeightedModifierType(modifierTypes.HYPER_POTION, (party: Pokemon[]) => {
const thresholdPartyMemberCount = Math.min(party.filter(p => p.getInverseHp() >= 100 || p.getHpRatio() <= 0.625).length, 3);
return thresholdPartyMemberCount * 3;
}),
}, 9),
new WeightedModifierType(modifierTypes.MAX_POTION, (party: Pokemon[]) => {
const thresholdPartyMemberCount = Math.min(party.filter(p => p.getInverseHp() >= 150 || p.getHpRatio() <= 0.5).length, 3);
return thresholdPartyMemberCount;
}),
}, 3),
new WeightedModifierType(modifierTypes.FULL_RESTORE, (party: Pokemon[]) => {
const statusEffectPartyMemberCount = Math.min(party.filter(p => p.hp && !!p.status).length, 3);
const thresholdPartyMemberCount = Math.floor((Math.min(party.filter(p => p.getInverseHp() >= 150 || p.getHpRatio() <= 0.5).length, 3) + statusEffectPartyMemberCount) / 2);
return thresholdPartyMemberCount;
}),
}, 3),
new WeightedModifierType(modifierTypes.ELIXIR, (party: Pokemon[]) => {
const thresholdPartyMemberCount = Math.min(party.filter(p => p.hp && p.getMoveset().filter(m => (m.getMove().pp - m.ppUsed) <= 5).length).length, 3);
return thresholdPartyMemberCount * 3;
}),
}, 9),
new WeightedModifierType(modifierTypes.MAX_ELIXIR, (party: Pokemon[]) => {
const thresholdPartyMemberCount = Math.min(party.filter(p => p.hp && p.getMoveset().filter(m => (m.getMove().pp - m.ppUsed) <= 5).length).length, 3);
return thresholdPartyMemberCount;
}),
}, 3),
new WeightedModifierType(modifierTypes.SUPER_LURE, 4),
new WeightedModifierType(modifierTypes.NUGGET, 5),
new WeightedModifierType(modifierTypes.BIG_NUGGET, 1),
new WeightedModifierType(modifierTypes.MAP, (party: Pokemon[]) => party[0].scene.gameMode === GameMode.CLASSIC ? 1 : 0),
new WeightedModifierType(modifierTypes.MAP, (party: Pokemon[]) => party[0].scene.gameMode === GameMode.CLASSIC ? 1 : 0, 1),
new WeightedModifierType(modifierTypes.TM_GREAT, 2),
new WeightedModifierType(modifierTypes.EXP_SHARE, 1),
new WeightedModifierType(modifierTypes.AMULET_COIN, 1),
new WeightedModifierType(modifierTypes.EXP_CHARM, 2),
new WeightedModifierType(modifierTypes.MEMORY_MUSHROOM, (party: Pokemon[]) => {
if (!party.find(p => p.getLearnableLevelMoves().length))
return 0;
const highestPartyLevel = party.map(p => p.level).reduce((highestLevel: integer, level: integer) => Math.max(highestLevel, level), 1);
return Math.min(Math.ceil(highestPartyLevel / 20), 4);
}),
}, 4),
new WeightedModifierType(modifierTypes.BASE_STAT_BOOSTER, 3),
new WeightedModifierType(modifierTypes.TERA_SHARD, 1),
new WeightedModifierType(modifierTypes.DNA_SPLICERS, (party: Pokemon[]) => party[0].scene.gameMode === GameMode.SPLICED_ENDLESS && party.filter(p => !p.fusionSpecies).length > 1 ? 4 : 0),
new WeightedModifierType(modifierTypes.REVERSE_DNA_SPLICERS, (party: Pokemon[]) => party[0].scene.gameMode === GameMode.SPLICED_ENDLESS && party.filter(p => p.fusionSpecies).length ? 6 : 0),
].map(m => { m.setTier(ModifierTier.GREAT); return m; }),
[ModifierTier.ULTRA]: [
new WeightedModifierType(modifierTypes.ULTRA_BALL, 8),
new WeightedModifierType(modifierTypes.ULTRA_BALL, 24),
new WeightedModifierType(modifierTypes.MAX_LURE, 4),
new WeightedModifierType(modifierTypes.RELIC_GOLD, 3),
new WeightedModifierType(modifierTypes.PP_UP, 6),
new WeightedModifierType(modifierTypes.PP_MAX, 2),
new WeightedModifierType(modifierTypes.ATTACK_TYPE_BOOSTER, 4),
new WeightedModifierType(modifierTypes.TM_ULTRA, 5),
new WeightedModifierType(modifierTypes.REVIVER_SEED, 3),
new WeightedModifierType(modifierTypes.CANDY_JAR, 3),
new WeightedModifierType(modifierTypes.RARER_CANDY, 3),
new WeightedModifierType(modifierTypes.BIG_NUGGET, 12),
new WeightedModifierType(modifierTypes.PP_UP, 9),
new WeightedModifierType(modifierTypes.PP_MAX, 3),
new WeightedModifierType(modifierTypes.EVOLUTION_ITEM, 16),
new WeightedModifierType(modifierTypes.AMULET_COIN, 3),
new WeightedModifierType(modifierTypes.REVIVER_SEED, 4),
new WeightedModifierType(modifierTypes.CANDY_JAR, 5),
new WeightedModifierType(modifierTypes.ATTACK_TYPE_BOOSTER, 10),
new WeightedModifierType(modifierTypes.TM_ULTRA, 8),
new WeightedModifierType(modifierTypes.RARER_CANDY, 4),
new WeightedModifierType(modifierTypes.SOOTHE_BELL, (party: Pokemon[]) => {
const friendshipBenefitPartyMemberCount = Math.min(party.filter(p => (pokemonEvolutions.hasOwnProperty(p.species.speciesId) && pokemonEvolutions[p.species.speciesId].find(e => e.condition && e.condition instanceof SpeciesFriendshipEvolutionCondition)) || p.moveset.find(m => m.moveId === Moves.RETURN)).length, 3);
return friendshipBenefitPartyMemberCount * 3;
}),
new WeightedModifierType(modifierTypes.SOUL_DEW, 3),
}, 9),
new WeightedModifierType(modifierTypes.SOUL_DEW, 2),
new WeightedModifierType(modifierTypes.GOLDEN_PUNCH, 2),
new WeightedModifierType(modifierTypes.GRIP_CLAW, 2),
new WeightedModifierType(modifierTypes.BATON, 1),
new WeightedModifierType(modifierTypes.FOCUS_BAND, 3),
new WeightedModifierType(modifierTypes.KINGS_ROCK, 2),
new WeightedModifierType(modifierTypes.LEFTOVERS, 2),
new WeightedModifierType(modifierTypes.SHELL_BELL, 2),
new WeightedModifierType(modifierTypes.BERRY_POUCH, 3),
new WeightedModifierType(modifierTypes.SUPER_EXP_CHARM, 3),
new WeightedModifierType(modifierTypes.OVAL_CHARM, 2),
new WeightedModifierType(modifierTypes.ABILITY_CHARM, 2),
new WeightedModifierType(modifierTypes.IV_SCANNER, 2),
new WeightedModifierType(modifierTypes.TERA_ORB, (party: Pokemon[]) => Math.max(Math.floor(party[0].scene.currentBattle.waveIndex / 50) * 2, 1)),
new WeightedModifierType(modifierTypes.EXP_CHARM, 8),
new WeightedModifierType(modifierTypes.EXP_SHARE, 12),
new WeightedModifierType(modifierTypes.EXP_BALANCE, 1),
new WeightedModifierType(modifierTypes.FORM_CHANGE_ITEM, 1),
new WeightedModifierType(modifierTypes.REVERSE_DNA_SPLICERS, (party: Pokemon[]) => party[0].scene.gameMode !== GameMode.SPLICED_ENDLESS && party.filter(p => p.fusionSpecies).length ? 3 : 0),
new WeightedModifierType(modifierTypes.TERA_ORB, (party: Pokemon[]) => Math.min(Math.max(Math.floor(party[0].scene.currentBattle.waveIndex / 50) * 2, 1), 4), 4),
new WeightedModifierType(modifierTypes.REVERSE_DNA_SPLICERS, (party: Pokemon[]) => party[0].scene.gameMode !== GameMode.SPLICED_ENDLESS && party.filter(p => p.fusionSpecies).length ? 3 : 0, 3),
new WeightedModifierType(modifierTypes.VOUCHER, 3),
].map(m => { m.setTier(ModifierTier.ULTRA); return m; }),
[ModifierTier.ROGUE]: [
new WeightedModifierType(modifierTypes.ROGUE_BALL, 12),
new WeightedModifierType(modifierTypes.RELIC_GOLD, 3),
new WeightedModifierType(modifierTypes.LEFTOVERS, 1),
new WeightedModifierType(modifierTypes.SHELL_BELL, 1),
new WeightedModifierType(modifierTypes.BERRY_POUCH, 2),
new WeightedModifierType(modifierTypes.GRIP_CLAW, 2),
new WeightedModifierType(modifierTypes.BATON, 1),
//new WeightedModifierType(modifierTypes.OVAL_CHARM, 2),
new WeightedModifierType(modifierTypes.ABILITY_CHARM, 2),
new WeightedModifierType(modifierTypes.FOCUS_BAND, 3),
new WeightedModifierType(modifierTypes.KINGS_ROCK, 2),
new WeightedModifierType(modifierTypes.SUPER_EXP_CHARM, 5),
new WeightedModifierType(modifierTypes.FORM_CHANGE_ITEM, 9),
new WeightedModifierType(modifierTypes.MEGA_BRACELET, (party: Pokemon[]) => Math.min(Math.ceil(party[0].scene.currentBattle.waveIndex / 50), 4) * 4, 16),
new WeightedModifierType(modifierTypes.DYNAMAX_BAND, (party: Pokemon[]) => Math.min(Math.ceil(party[0].scene.currentBattle.waveIndex / 50), 4) * 4, 16),
].map(m => { m.setTier(ModifierTier.ROGUE); return m; }),
[ModifierTier.MASTER]: [
new WeightedModifierType(modifierTypes.MASTER_BALL, 32),
new WeightedModifierType(modifierTypes.SHINY_CHARM, 18),
new WeightedModifierType(modifierTypes.HEALING_CHARM, 18),
new WeightedModifierType(modifierTypes.VOUCHER_PLUS, 6),
new WeightedModifierType(modifierTypes.MEGA_BRACELET, (party: Pokemon[]) => Math.min(Math.ceil(party[0].scene.currentBattle.waveIndex / 50), 4) * 8),
new WeightedModifierType(modifierTypes.DYNAMAX_BAND, (party: Pokemon[]) => Math.min(Math.ceil(party[0].scene.currentBattle.waveIndex / 50), 4) * 8),
new WeightedModifierType(modifierTypes.DNA_SPLICERS, (party: Pokemon[]) => party[0].scene.gameMode !== GameMode.SPLICED_ENDLESS && party.filter(p => !p.fusionSpecies).length > 1 ? 12 : 0),
new WeightedModifierType(modifierTypes.MINI_BLACK_HOLE, (party: Pokemon[]) => party[0].scene.gameData.unlocks[Unlockables.MINI_BLACK_HOLE] ? 2 : 0),
new WeightedModifierType(modifierTypes.VOUCHER_PLUS, 8),
new WeightedModifierType(modifierTypes.DNA_SPLICERS, (party: Pokemon[]) => party[0].scene.gameMode !== GameMode.SPLICED_ENDLESS && party.filter(p => !p.fusionSpecies).length > 1 ? 24 : 0, 24),
new WeightedModifierType(modifierTypes.MINI_BLACK_HOLE, (party: Pokemon[]) => party[0].scene.gameData.unlocks[Unlockables.MINI_BLACK_HOLE] ? 1 : 0, 1),
].map(m => { m.setTier(ModifierTier.MASTER); return m; }),
[ModifierTier.LUXURY]: [
new WeightedModifierType(modifierTypes.GOLDEN_EXP_CHARM, 1),
new WeightedModifierType(modifierTypes.GOLDEN_POKEBALL, 1),
new WeightedModifierType(modifierTypes.RARER_CANDY, 1),
].map(m => { m.setTier(ModifierTier.LUXURY); return m; }),
};
@ -1028,19 +1034,20 @@ const trainerModifierPool = {
].map(m => { m.setTier(ModifierTier.COMMON); return m; }),
[ModifierTier.GREAT]: [
new WeightedModifierType(modifierTypes.BASE_STAT_BOOSTER, 3),
new WeightedModifierType(modifierTypes.ATTACK_TYPE_BOOSTER, 1),
].map(m => { m.setTier(ModifierTier.GREAT); return m; }),
[ModifierTier.ULTRA]: [
new WeightedModifierType(modifierTypes.ATTACK_TYPE_BOOSTER, 1),
].map(m => { m.setTier(ModifierTier.ULTRA); return m; }),
[ModifierTier.ROGUE]: [
new WeightedModifierType(modifierTypes.REVIVER_SEED, 2),
new WeightedModifierType(modifierTypes.FOCUS_BAND, 2),
new WeightedModifierType(modifierTypes.LUCKY_EGG, 4),
new WeightedModifierType(modifierTypes.GRIP_CLAW, 1),
].map(m => { m.setTier(ModifierTier.ROGUE); return m; }),
[ModifierTier.MASTER]: [
new WeightedModifierType(modifierTypes.KINGS_ROCK, 1),
new WeightedModifierType(modifierTypes.LEFTOVERS, 1),
new WeightedModifierType(modifierTypes.SHELL_BELL, 1),
].map(m => { m.setTier(ModifierTier.ULTRA); return m; }),
[ModifierTier.MASTER]: [
new WeightedModifierType(modifierTypes.GOLDEN_EGG, 1),
].map(m => { m.setTier(ModifierTier.MASTER); return m; })
};
@ -1074,6 +1081,7 @@ const enemyBuffModifierPool = {
new WeightedModifierType(modifierTypes.ENEMY_INSTANT_REVIVE_CHANCE, 5),
new WeightedModifierType(modifierTypes.ENEMY_INSTANT_MAX_REVIVE_CHANCE, 3)
].map(m => { m.setTier(ModifierTier.ULTRA); return m; }),
[ModifierTier.ROGUE]: [ ].map(m => { m.setTier(ModifierTier.ROGUE); return m; }),
[ModifierTier.MASTER]: [ ].map(m => { m.setTier(ModifierTier.MASTER); return m; })
};
@ -1093,13 +1101,18 @@ let enemyIgnoredPoolIndexes = {};
let enemyBuffModifierPoolThresholds = {};
let enemyBuffIgnoredPoolIndexes = {};
const tierWeights = [ 769 / 1024, 192 / 1024, 48 / 1024, 12 / 1024, 1 / 1024 ];
export function regenerateModifierPoolThresholds(party: Pokemon[], poolType: ModifierPoolType) {
const player = !poolType;
const pool = player ? modifierPool : poolType === ModifierPoolType.WILD ? wildModifierPool : poolType === ModifierPoolType.TRAINER ? trainerModifierPool : enemyBuffModifierPool;
const ignoredIndexes = {};
const thresholds = Object.fromEntries(new Map(Object.keys(pool).map(t => {
const modifierTableData = {};
const thresholds = Object.fromEntries(new Map(Object.keys(pool).slice(0, -1).map(t => {
ignoredIndexes[t] = [];
const thresholds = new Map();
const tierModifierIds: string[] = [];
let tierMaxWeight = 0;
let i = 0;
pool[t].reduce((total: integer, modifierType: WeightedModifierType) => {
const weightedModifierType = modifierType as WeightedModifierType;
@ -1115,6 +1128,13 @@ export function regenerateModifierPoolThresholds(party: Pokemon[], poolType: Mod
? (weightedModifierType.weight as Function)(party)
: weightedModifierType.weight as integer
: 0;
if (weightedModifierType.maxWeight) {
const modifierId = weightedModifierType.modifierType.generatorId || weightedModifierType.modifierType.id;
tierModifierIds.push(modifierId);
const outputWeight = useMaxWeightForOutput ? weightedModifierType.maxWeight : weight;
modifierTableData[modifierId] = { weight: outputWeight, tier: parseInt(t), tierPercent: 0, totalPercent: 0 };
tierMaxWeight += outputWeight;
}
if (weight)
total += weight;
else {
@ -1124,8 +1144,16 @@ export function regenerateModifierPoolThresholds(party: Pokemon[], poolType: Mod
thresholds.set(total, i++);
return total;
}, 0);
return [ t, Object.fromEntries(thresholds) ]
for (let id of tierModifierIds)
modifierTableData[id].tierPercent = Math.floor((modifierTableData[id].weight / tierMaxWeight) * 10000) / 100;
return [ t, Object.fromEntries(thresholds) ];
})));
for (let id of Object.keys(modifierTableData)) {
modifierTableData[id].totalPercent = Math.floor(modifierTableData[id].tierPercent * tierWeights[modifierTableData[id].tier] * 100) / 100;
modifierTableData[id].tier = ModifierTier[modifierTableData[id].tier];
}
if (outputModifierData)
console.table(modifierTableData);
if (player) {
modifierPoolThresholds = thresholds;
ignoredPoolIndexes = ignoredIndexes;
@ -1144,14 +1172,14 @@ export function getModifierTypeFuncById(id: string): ModifierTypeFunc {
export function getPlayerModifierTypeOptionsForWave(waveIndex: integer, count: integer, party: PlayerPokemon[]): ModifierTypeOption[] {
if (waveIndex % 10 === 0)
return modifierPool[ModifierTier.LUXURY].filter(m => !(m.weight instanceof Function) || m.weight(party)).map(m => new ModifierTypeOption(m.modifierType, false));
return modifierPool[ModifierTier.LUXURY].filter(m => !(m.weight instanceof Function) || m.weight(party)).map(m => new ModifierTypeOption(m.modifierType, 0));
const options: ModifierTypeOption[] = [];
const retryCount = Math.min(count * 5, 50);
new Array(count).fill(0).map(() => {
let candidate = getNewModifierTypeOption(party, ModifierPoolType.PLAYER);
let r = 0;
while (options.length && ++r < retryCount && options.filter(o => o.type.name === candidate.type.name || o.type.group === candidate.type.group).length)
candidate = getNewModifierTypeOption(party, ModifierPoolType.PLAYER, candidate.type.tier, candidate.upgraded);
candidate = getNewModifierTypeOption(party, ModifierPoolType.PLAYER, candidate.type.tier, candidate.upgradeCount);
options.push(candidate);
});
return options;
@ -1163,31 +1191,31 @@ export function getPlayerShopModifierTypeOptionsForWave(waveIndex: integer, base
const options = [
[
new ModifierTypeOption(modifierTypes.POTION(), false, baseCost * 0.2),
new ModifierTypeOption(modifierTypes.ETHER(), false, baseCost * 0.4),
new ModifierTypeOption(modifierTypes.REVIVE(), false, baseCost * 2)
new ModifierTypeOption(modifierTypes.POTION(), 0, baseCost * 0.2),
new ModifierTypeOption(modifierTypes.ETHER(), 0, baseCost * 0.4),
new ModifierTypeOption(modifierTypes.REVIVE(), 0, baseCost * 2)
],
[
new ModifierTypeOption(modifierTypes.SUPER_POTION(), false, baseCost * 0.45),
new ModifierTypeOption(modifierTypes.ELIXIR(), false, baseCost)
new ModifierTypeOption(modifierTypes.SUPER_POTION(), 0, baseCost * 0.45),
new ModifierTypeOption(modifierTypes.ELIXIR(), 0, baseCost)
],
[
new ModifierTypeOption(modifierTypes.FULL_HEAL(), false, baseCost),
new ModifierTypeOption(modifierTypes.MAX_ETHER(), false, baseCost)
new ModifierTypeOption(modifierTypes.FULL_HEAL(), 0, baseCost),
new ModifierTypeOption(modifierTypes.MAX_ETHER(), 0, baseCost)
],
[
new ModifierTypeOption(modifierTypes.HYPER_POTION(), false, baseCost * 0.8),
new ModifierTypeOption(modifierTypes.MAX_REVIVE(), false, baseCost * 2.75)
new ModifierTypeOption(modifierTypes.HYPER_POTION(), 0, baseCost * 0.8),
new ModifierTypeOption(modifierTypes.MAX_REVIVE(), 0, baseCost * 2.75)
],
[
new ModifierTypeOption(modifierTypes.MAX_POTION(), false, baseCost * 1.5),
new ModifierTypeOption(modifierTypes.MAX_ELIXIR(), false, baseCost * 2.5)
new ModifierTypeOption(modifierTypes.MAX_POTION(), 0, baseCost * 1.5),
new ModifierTypeOption(modifierTypes.MAX_ELIXIR(), 0, baseCost * 2.5)
],
[
new ModifierTypeOption(modifierTypes.FULL_RESTORE(), false, baseCost * 2.25)
new ModifierTypeOption(modifierTypes.FULL_RESTORE(), 0, baseCost * 2.25)
],
[
new ModifierTypeOption(modifierTypes.SACRED_ASH(), false, baseCost * 12)
new ModifierTypeOption(modifierTypes.SACRED_ASH(), 0, baseCost * 12)
]
];
return options.slice(0, Math.ceil(Math.max(waveIndex + 10, 0) / 30)).flat();
@ -1215,20 +1243,30 @@ export function getEnemyModifierTypesForWave(waveIndex: integer, count: integer,
return ret;
}
function getNewModifierTypeOption(party: Pokemon[], poolType: ModifierPoolType, tier?: ModifierTier, upgrade?: boolean): ModifierTypeOption {
function getNewModifierTypeOption(party: Pokemon[], poolType: ModifierPoolType, tier?: ModifierTier, upgradeCount?: integer): ModifierTypeOption {
const player = !poolType;
const pool = player ? modifierPool : poolType === ModifierPoolType.WILD ? wildModifierPool : poolType === ModifierPoolType.TRAINER ? trainerModifierPool : enemyBuffModifierPool;
if (tier === undefined) {
const tierValue = Utils.randSeedInt(256);
const tierValue = Utils.randSeedInt(1024);
upgradeCount = 0;
if (player && tierValue) {
const partyShinyCount = party.filter(p => p.isShiny() && !p.isFainted()).length;
const upgradeOdds = Math.floor(32 / Math.max((partyShinyCount * 2), 1));
upgrade = !Utils.randSeedInt(upgradeOdds);
} else
upgrade = false;
tier = (tierValue >= 52 ? ModifierTier.COMMON : tierValue >= 8 ? ModifierTier.GREAT : tierValue >= 1 ? ModifierTier.ULTRA : ModifierTier.MASTER) + (upgrade ? 1 : 0);
while (tier && !modifierPool[tier].length)
const upgradeOdds = Math.floor(32 / ((partyShinyCount + 2) / 2));
let upgraded = false;
do {
upgraded = !Utils.randSeedInt(upgradeOdds);
if (upgraded)
upgradeCount++;
} while (upgraded);
}
tier = tierValue > 255 ? ModifierTier.COMMON : tierValue > 60 ? ModifierTier.GREAT : tierValue > 12 ? ModifierTier.ULTRA : tierValue ? ModifierTier.ROGUE : ModifierTier.MASTER;
upgradeCount = Math.min(upgradeCount, ModifierTier.MASTER - tier);
tier += upgradeCount;
while (tier && (!modifierPool.hasOwnProperty(tier) || !modifierPool[tier].length)) {
tier--;
if (upgradeCount)
upgradeCount--;
}
}
const thresholds = player ? modifierPoolThresholds : pool !== enemyBuffModifierPool ? enemyModifierPoolThresholds : enemyBuffModifierPoolThresholds;
@ -1251,14 +1289,14 @@ function getNewModifierTypeOption(party: Pokemon[], poolType: ModifierPoolType,
modifierType = (modifierType as ModifierTypeGenerator).generateType(party);
if (modifierType === null) {
if (player)
console.log(ModifierTier[tier], upgrade);
return getNewModifierTypeOption(party, poolType, tier, upgrade);
console.log(ModifierTier[tier], upgradeCount);
return getNewModifierTypeOption(party, poolType, tier, upgradeCount);
}
}
console.log(modifierType, !player ? '(enemy)' : '');
return new ModifierTypeOption(modifierType as ModifierType, upgrade);
return new ModifierTypeOption(modifierType as ModifierType, upgradeCount);
}
export function getDefaultModifierTypeForTier(tier: ModifierTier): ModifierType {
@ -1270,12 +1308,12 @@ export function getDefaultModifierTypeForTier(tier: ModifierTier): ModifierType
export class ModifierTypeOption {
public type: ModifierType;
public upgraded: boolean;
public upgradeCount: integer;
public cost: integer;
constructor(type: ModifierType, upgraded: boolean, cost: number = 0) {
constructor(type: ModifierType, upgradeCount: integer, cost: number = 0) {
this.type = type;
this.upgraded = upgraded;
this.upgradeCount = upgradeCount;
this.cost = Math.round(cost);
}
}

View File

@ -1,7 +1,7 @@
import BattleScene from "../battle-scene";
import { TrainerType } from "../data/enums/trainer-type";
import { ModifierTier } from "../modifier/modifier-tier";
import { Achv, achvs } from "./achv";
import { Achv, AchvTier, achvs } from "./achv";
export enum VoucherType {
REGULAR,
@ -35,16 +35,16 @@ export class Voucher {
return getVoucherTypeIcon(this.voucherType);
}
getTier(): ModifierTier {
getTier(): AchvTier {
switch (this.voucherType) {
case VoucherType.REGULAR:
return ModifierTier.COMMON;
return AchvTier.COMMON;
case VoucherType.PLUS:
return ModifierTier.GREAT;
return AchvTier.GREAT;
case VoucherType.PREMIUM:
return ModifierTier.ULTRA;
return AchvTier.ULTRA;
case VoucherType.GOLDEN:
return ModifierTier.MASTER;
return AchvTier.MASTER;
}
}
}

View File

@ -1,6 +1,6 @@
import { CommandPhase } from "../phases";
import BattleScene, { Button } from "../battle-scene";
import { getPokeballName, PokeballType } from "../data/pokeball";
import { getPokeballName } from "../data/pokeball";
import { addTextObject, TextStyle } from "./text";
import { Command } from "./command-ui-handler";
import { Mode } from "./ui";

View File

@ -1,15 +1,15 @@
import BattleScene, { Button } from "../battle-scene";
import { Mode } from "./ui";
import { TextStyle, addTextObject, getModifierTierTextTint } from "./text";
import { TextStyle, addTextObject, getEggTierTextTint } from "./text";
import MessageUiHandler from "./message-ui-handler";
import * as Utils from "../utils";
import { ModifierTier } from "../modifier/modifier-tier";
import { EGG_SEED, Egg, GachaType, getEggTierDefaultHatchWaves, getEggDescriptor, getLegendaryGachaSpeciesForTimestamp, getTypeGachaTypeForTimestamp } from "../data/egg";
import { VoucherType, getVoucherTypeIcon } from "../system/voucher";
import { getPokemonSpecies } from "../data/pokemon-species";
import { Type } from "../data/type";
import { addWindow } from "./window";
import { Tutorial, handleTutorial } from "../tutorial";
import { EggTier } from "../data/enums/egg-type";
const defaultText = 'Select a machine.';
@ -343,13 +343,13 @@ export default class EggGachaUiHandler extends MessageUiHandler {
eggs = [];
const tierValueOffset = this.gachaCursor === GachaType.LEGENDARY ? 1 : 0;
const tiers = new Array(pullCount).fill(null).map(() => {
const tierValue = Utils.randInt(256);
return tierValue >= 52 + tierValueOffset ? ModifierTier.COMMON : tierValue + tierValueOffset >= 8 ? ModifierTier.GREAT : tierValue >= 1 + tierValueOffset ? ModifierTier.ULTRA : ModifierTier.MASTER;
const tierValue = Utils.randInt(1024);
return tierValue >= 52 + tierValueOffset ? EggTier.COMMON : tierValue + tierValueOffset >= 8 ? EggTier.GREAT : tierValue >= 1 + tierValueOffset ? EggTier.ULTRA : EggTier.MASTER;
});
if (pullCount >= 25 && !tiers.filter(t => t >= ModifierTier.ULTRA).length)
tiers[Utils.randInt(tiers.length)] = ModifierTier.ULTRA;
else if (pullCount >= 10 && !tiers.filter(t => t >= ModifierTier.GREAT).length)
tiers[Utils.randInt(tiers.length)] = ModifierTier.GREAT;
if (pullCount >= 25 && !tiers.filter(t => t >= EggTier.ULTRA).length)
tiers[Utils.randInt(tiers.length)] = EggTier.ULTRA;
else if (pullCount >= 10 && !tiers.filter(t => t >= EggTier.GREAT).length)
tiers[Utils.randInt(tiers.length)] = EggTier.GREAT;
const timestamp = new Date().getTime();
@ -357,16 +357,16 @@ export default class EggGachaUiHandler extends MessageUiHandler {
const egg = new Egg(Utils.randInt(EGG_SEED, EGG_SEED * tier), this.gachaCursor, getEggTierDefaultHatchWaves(tier), timestamp);
if (egg.isManaphyEgg()) {
this.scene.gameData.gameStats.manaphyEggsPulled++;
egg.hatchWaves = getEggTierDefaultHatchWaves(ModifierTier.ULTRA);
egg.hatchWaves = getEggTierDefaultHatchWaves(EggTier.ULTRA);
} else {
switch (tier) {
case ModifierTier.GREAT:
case EggTier.GREAT:
this.scene.gameData.gameStats.rareEggsPulled++;
break;
case ModifierTier.ULTRA:
case EggTier.ULTRA:
this.scene.gameData.gameStats.epicEggsPulled++;
break;
case ModifierTier.MASTER:
case EggTier.MASTER:
this.scene.gameData.gameStats.legendaryEggsPulled++;
break;
}
@ -417,7 +417,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
const eggText = addTextObject(this.scene, 0, 14, getEggDescriptor(egg), TextStyle.PARTY, { align: 'center' });
eggText.setOrigin(0.5, 0);
eggText.setTint(getModifierTierTextTint(!egg.isManaphyEgg() ? egg.tier : ModifierTier.ULTRA));
eggText.setTint(getEggTierTextTint(!egg.isManaphyEgg() ? egg.tier : EggTier.ULTRA));
ret.add(eggText);
this.eggGachaSummaryContainer.addAt(ret, 0);

View File

@ -117,7 +117,7 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
this.shopOptionsRows[row].push(option);
}
const hasUpgrade = typeOptions.filter(to => to.upgraded).length;
const maxUpgradeCount = typeOptions.map(to => to.upgradeCount).reduce((max, current) => Math.max(current, max), 0);
this.scene.showFieldOverlay(750);
@ -130,18 +130,19 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
const value = t.getValue();
const index = Math.floor(value * typeOptions.length);
if (index > i && index <= typeOptions.length) {
const option = this.options[i++];
option?.show(Math.floor((1 - value) * 1250) * 0.325 + (hasUpgrade ? 2000 : 0));
const option = this.options[i];
option?.show(Math.floor((1 - value) * 1250) * 0.325 + 2000 * maxUpgradeCount, -(maxUpgradeCount - typeOptions[i].upgradeCount));
i++;
}
}
});
this.scene.time.delayedCall(1000 + (hasUpgrade ? 2000 : 0), () => {
this.scene.time.delayedCall(1000 + maxUpgradeCount * 2000, () => {
for (let shopOption of this.shopOptionsRows.flat())
shopOption.show(0);
shopOption.show(0, 0);
});
this.scene.time.delayedCall(4000 + (hasUpgrade ? 2000 : 0), () => {
this.scene.time.delayedCall(4000 + maxUpgradeCount * 2000, () => {
if (partyHasHeldItem) {
this.transferButtonContainer.setAlpha(0);
this.transferButtonContainer.setVisible(true);
@ -385,7 +386,7 @@ class ModifierOption extends Phaser.GameObjects.Container {
setup() {
if (!this.modifierTypeOption.cost) {
const getPb = (): Phaser.GameObjects.Sprite => {
const pb = this.scene.add.sprite(0, -182, 'pb', this.getPbAtlasKey(true));
const pb = this.scene.add.sprite(0, -182, 'pb', this.getPbAtlasKey(-this.modifierTypeOption.upgradeCount));
pb.setScale(2);
return pb;
};
@ -434,7 +435,7 @@ class ModifierOption extends Phaser.GameObjects.Container {
}
}
show(remainingDuration: integer) {
show(remainingDuration: integer, upgradeCountOffset: integer) {
if (!this.modifierTypeOption.cost) {
this.scene.tweens.add({
targets: this.pb,
@ -465,9 +466,10 @@ class ModifierOption extends Phaser.GameObjects.Container {
}
});
if (this.modifierTypeOption.upgraded) {
this.scene.time.delayedCall(remainingDuration, () => {
(this.scene as BattleScene).playSound('upgrade');
for (let u = 0; u < this.modifierTypeOption.upgradeCount; u++) {
const upgradeIndex = u;
this.scene.time.delayedCall(remainingDuration - 2000 * (this.modifierTypeOption.upgradeCount - (upgradeIndex + 1 + upgradeCountOffset)), () => {
(this.scene as BattleScene).playSound('upgrade', { rate: 1 + 0.25 * upgradeIndex });
this.pbTint.setPosition(this.pb.x, this.pb.y);
this.pbTint.setTintFill(0xFFFFFF);
this.pbTint.setAlpha(0);
@ -478,11 +480,11 @@ class ModifierOption extends Phaser.GameObjects.Container {
duration: 1000,
ease: 'Sine.easeIn',
onComplete: () => {
this.pb.setTexture('pb', this.getPbAtlasKey(false));
this.pb.setTexture('pb', this.getPbAtlasKey(-this.modifierTypeOption.upgradeCount + (upgradeIndex + 1)));
this.scene.tweens.add({
targets: this.pbTint,
alpha: 0,
duration: 1000,
duration: 750,
ease: 'Sine.easeOut',
onComplete: () => {
this.pbTint.setVisible(false);
@ -499,7 +501,7 @@ class ModifierOption extends Phaser.GameObjects.Container {
return;
if (!this.modifierTypeOption.cost) {
this.pb.setTexture('pb', `${this.getPbAtlasKey(false)}_open`);
this.pb.setTexture('pb', `${this.getPbAtlasKey(0)}_open`);
(this.scene as BattleScene).playSound('pb_rel');
this.scene.tweens.add({
@ -547,8 +549,8 @@ class ModifierOption extends Phaser.GameObjects.Container {
});
}
getPbAtlasKey(beforeUpgrade: boolean) {
return getPokeballAtlasKey((this.modifierTypeOption.type.tier - (beforeUpgrade && this.modifierTypeOption.upgraded ? 1 : 0)) as integer as PokeballType);
getPbAtlasKey(tierOffset: integer = 0) {
return getPokeballAtlasKey((this.modifierTypeOption.type.tier + tierOffset) as integer as PokeballType);
}
updateCostText(): void {

View File

@ -1,6 +1,7 @@
import BBCodeText from "phaser3-rex-plugins/plugins/gameobjects/tagtext/bbcodetext/BBCodeText";
import InputText from "phaser3-rex-plugins/plugins/inputtext";
import { ModifierTier } from "../modifier/modifier-tier";
import { EggTier } from "../data/enums/egg-type";
export enum TextStyle {
MESSAGE,
@ -145,7 +146,7 @@ export function getTextColor(textStyle: TextStyle, shadow?: boolean): string {
}
}
export function getModifierTierTextTint(tier: integer): integer {
export function getModifierTierTextTint(tier: ModifierTier): integer {
switch (tier) {
case ModifierTier.COMMON:
return 0xffffff;
@ -153,9 +154,24 @@ export function getModifierTierTextTint(tier: integer): integer {
return 0x3890f8;
case ModifierTier.ULTRA:
return 0xf8d038;
case ModifierTier.ROGUE:
return 0xd52929;
case ModifierTier.MASTER:
return 0xe020c0;
case ModifierTier.LUXURY:
return 0xe64a18;
}
}
export function getEggTierTextTint(tier: EggTier): integer {
switch (tier) {
case EggTier.COMMON:
return getModifierTierTextTint(ModifierTier.COMMON);
case EggTier.GREAT:
return getModifierTierTextTint(ModifierTier.GREAT);
case EggTier.ULTRA:
return getModifierTierTextTint(ModifierTier.ULTRA);
case EggTier.MASTER:
return getModifierTierTextTint(ModifierTier.MASTER);
}
}

View File

@ -326,7 +326,7 @@ export default class UI extends Phaser.GameObjects.Container {
};
if (((!chainMode && ((transitionModes.indexOf(this.mode) > -1 || transitionModes.indexOf(mode) > -1)
&& (noTransitionModes.indexOf(this.mode) === -1 && noTransitionModes.indexOf(mode) === -1)))
|| (chainMode && noTransitionModes.indexOf(mode) === -1)) && !(this.scene as BattleScene).auto) {
|| (chainMode && noTransitionModes.indexOf(mode) === -1))) {
this.fadeOut(250).then(() => {
this.scene.time.delayedCall(100, () => {
doSetMode();