Rebalance item weights and add Rogue tier

This commit is contained in:
Flashfyre committed 2024-02-28 23:13:05 -05:00
1 parent ce64eb6c70
commit ffd785d534
22 files changed
+1518 -1360

No files matched your search

+1 -1
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";
+13 -13
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);
+18 -16
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 {
+17 -1
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);
}
}
+1 -1
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();