Rebalanace vouchers and add golden voucher
parent
830d3fde57
commit
524cd99eda
|
@ -126,7 +126,8 @@ export class GameData {
|
||||||
this.voucherCounts = {
|
this.voucherCounts = {
|
||||||
[VoucherType.REGULAR]: 0,
|
[VoucherType.REGULAR]: 0,
|
||||||
[VoucherType.PLUS]: 0,
|
[VoucherType.PLUS]: 0,
|
||||||
[VoucherType.PREMIUM]: 0
|
[VoucherType.PREMIUM]: 0,
|
||||||
|
[VoucherType.GOLDEN]: 0
|
||||||
};
|
};
|
||||||
this.eggs = [];
|
this.eggs = [];
|
||||||
this.initDexData();
|
this.initDexData();
|
||||||
|
@ -206,6 +207,16 @@ export class GameData {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.voucherCounts) {
|
if (data.voucherCounts) {
|
||||||
|
// TODO: Remove
|
||||||
|
if (data.voucherUnlocks && !data.voucherCounts.hasOwnProperty(VoucherType.GOLDEN)) {
|
||||||
|
data.voucherCounts[VoucherType.GOLDEN] = 0;
|
||||||
|
for (let v of Object.keys(data.voucherUnlocks)) {
|
||||||
|
const voucherType = vouchers[v].voucherType;
|
||||||
|
if (voucherType > VoucherType.REGULAR)
|
||||||
|
data.voucherCounts[VoucherType.REGULAR] += voucherType === VoucherType.GOLDEN ? 15 : voucherType === VoucherType.PREMIUM ? 5 : 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Utils.getEnumKeys(VoucherType).forEach(key => {
|
Utils.getEnumKeys(VoucherType).forEach(key => {
|
||||||
const index = VoucherType[key];
|
const index = VoucherType[key];
|
||||||
this.voucherCounts[index] = data.voucherCounts[index] || 0;
|
this.voucherCounts[index] = data.voucherCounts[index] || 0;
|
||||||
|
|
|
@ -6,7 +6,8 @@ import { Achv, achvs } from "./achv";
|
||||||
export enum VoucherType {
|
export enum VoucherType {
|
||||||
REGULAR,
|
REGULAR,
|
||||||
PLUS,
|
PLUS,
|
||||||
PREMIUM
|
PREMIUM,
|
||||||
|
GOLDEN
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Voucher {
|
export class Voucher {
|
||||||
|
@ -37,10 +38,12 @@ export class Voucher {
|
||||||
getTier(): ModifierTier {
|
getTier(): ModifierTier {
|
||||||
switch (this.voucherType) {
|
switch (this.voucherType) {
|
||||||
case VoucherType.REGULAR:
|
case VoucherType.REGULAR:
|
||||||
return ModifierTier.GREAT;
|
return ModifierTier.COMMON;
|
||||||
case VoucherType.PLUS:
|
case VoucherType.PLUS:
|
||||||
return ModifierTier.ULTRA;
|
return ModifierTier.GREAT;
|
||||||
case VoucherType.PREMIUM:
|
case VoucherType.PREMIUM:
|
||||||
|
return ModifierTier.ULTRA;
|
||||||
|
case VoucherType.GOLDEN:
|
||||||
return ModifierTier.MASTER;
|
return ModifierTier.MASTER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,6 +57,8 @@ export function getVoucherTypeName(voucherType: VoucherType): string {
|
||||||
return 'Egg Voucher Plus';
|
return 'Egg Voucher Plus';
|
||||||
case VoucherType.PREMIUM:
|
case VoucherType.PREMIUM:
|
||||||
return 'Egg Voucher Premium';
|
return 'Egg Voucher Premium';
|
||||||
|
case VoucherType.GOLDEN:
|
||||||
|
return 'Egg Voucher Gold';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +70,8 @@ export function getVoucherTypeIcon(voucherType: VoucherType): string {
|
||||||
return 'pair_of_tickets';
|
return 'pair_of_tickets';
|
||||||
case VoucherType.PREMIUM:
|
case VoucherType.PREMIUM:
|
||||||
return 'mystic_ticket';
|
return 'mystic_ticket';
|
||||||
|
case VoucherType.GOLDEN:
|
||||||
|
return 'golden_mystic_ticket';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,10 +88,12 @@ const voucherAchvs: Achv[] = [ achvs.CLASSIC_VICTORY ];
|
||||||
(function() {
|
(function() {
|
||||||
for (let achv of voucherAchvs) {
|
for (let achv of voucherAchvs) {
|
||||||
const voucherType = achv.score >= 150
|
const voucherType = achv.score >= 150
|
||||||
? VoucherType.PREMIUM
|
? VoucherType.GOLDEN
|
||||||
: achv.score >= 75
|
: achv.score >= 100
|
||||||
? VoucherType.PLUS
|
? VoucherType.PREMIUM
|
||||||
: VoucherType.REGULAR;
|
: achv.score >= 75
|
||||||
|
? VoucherType.PLUS
|
||||||
|
: VoucherType.REGULAR;
|
||||||
vouchers[achv.id] = new Voucher(voucherType, achv.description);
|
vouchers[achv.id] = new Voucher(voucherType, achv.description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,8 +102,8 @@ const voucherAchvs: Achv[] = [ achvs.CLASSIC_VICTORY ];
|
||||||
|
|
||||||
for (let trainerType of bossTrainerTypes) {
|
for (let trainerType of bossTrainerTypes) {
|
||||||
const voucherType = trainerConfigs[trainerType].moneyMultiplier < 10
|
const voucherType = trainerConfigs[trainerType].moneyMultiplier < 10
|
||||||
? VoucherType.REGULAR
|
? VoucherType.PLUS
|
||||||
: VoucherType.PLUS;
|
: VoucherType.PREMIUM;
|
||||||
const key = TrainerType[trainerType];
|
const key = TrainerType[trainerType];
|
||||||
vouchers[key] = new Voucher(voucherType, `Defeat ${trainerConfigs[trainerType].name}`);
|
vouchers[key] = new Voucher(voucherType, `Defeat ${trainerConfigs[trainerType].name}`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import MessageUiHandler from "./message-ui-handler";
|
||||||
import * as Utils from "../utils";
|
import * as Utils from "../utils";
|
||||||
import { ModifierTier } from "../modifier/modifier-type";
|
import { ModifierTier } from "../modifier/modifier-type";
|
||||||
import { EGG_SEED, Egg, GachaType, getEggTierDefaultHatchWaves, getEggDescriptor, getLegendaryGachaSpeciesForTimestamp, getTypeGachaTypeForTimestamp } from "../data/egg";
|
import { EGG_SEED, Egg, GachaType, getEggTierDefaultHatchWaves, getEggDescriptor, getLegendaryGachaSpeciesForTimestamp, getTypeGachaTypeForTimestamp } from "../data/egg";
|
||||||
import { VoucherType, getVoucherTypeIcon } from "../system/voucher";
|
import { Voucher, 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";
|
||||||
|
|
||||||
|
@ -144,18 +144,18 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
||||||
this.eggGachaOptionsContainer = this.scene.add.container((this.scene.game.canvas.width / 6), 148);
|
this.eggGachaOptionsContainer = this.scene.add.container((this.scene.game.canvas.width / 6), 148);
|
||||||
this.eggGachaContainer.add(this.eggGachaOptionsContainer);
|
this.eggGachaContainer.add(this.eggGachaOptionsContainer);
|
||||||
|
|
||||||
this.eggGachaOptionSelectBg = this.scene.add.nineslice(0, 0, 'window', null, 96, 96, 6, 6, 6, 6);
|
this.eggGachaOptionSelectBg = this.scene.add.nineslice(0, 0, 'window', null, 96, 112, 6, 6, 6, 6);
|
||||||
this.eggGachaOptionSelectBg.setOrigin(1, 1);
|
this.eggGachaOptionSelectBg.setOrigin(1, 1);
|
||||||
this.eggGachaOptionsContainer.add(this.eggGachaOptionSelectBg);
|
this.eggGachaOptionsContainer.add(this.eggGachaOptionSelectBg);
|
||||||
|
|
||||||
const optionText = addTextObject(this.scene, 0, 0, ' x1 1 Pull\n x10 10 Pulls\n x1 5 Pulls\n x1 10 Pulls\nCancel', TextStyle.WINDOW, { maxLines: 5 });
|
const optionText = addTextObject(this.scene, 0, 0, ' x1 1 Pull\n x10 10 Pulls\n x1 5 Pulls\n x1 10 Pulls\n x1 25 Pulls\nCancel', TextStyle.WINDOW);
|
||||||
optionText.setLineSpacing(12);
|
optionText.setLineSpacing(12);
|
||||||
this.eggGachaOptionsContainer.add(optionText);
|
this.eggGachaOptionsContainer.add(optionText);
|
||||||
|
|
||||||
optionText.setPositionRelative(this.eggGachaOptionSelectBg, 16, 9);
|
optionText.setPositionRelative(this.eggGachaOptionSelectBg, 16, 9);
|
||||||
|
|
||||||
new Array(4).fill(null).map((_, i) => {
|
new Array(5).fill(null).map((_, i) => {
|
||||||
const voucherType = i < 2 ? VoucherType.REGULAR : i === 2 ? VoucherType.PLUS : VoucherType.PREMIUM;
|
const voucherType = i < 2 ? VoucherType.REGULAR : i === 2 ? VoucherType.PLUS : i === 3 ? VoucherType.PREMIUM : VoucherType.GOLDEN;
|
||||||
const icon = this.scene.add.sprite(0, 0, 'items', getVoucherTypeIcon(voucherType));
|
const icon = this.scene.add.sprite(0, 0, 'items', getVoucherTypeIcon(voucherType));
|
||||||
icon.setScale(0.5);
|
icon.setScale(0.5);
|
||||||
icon.setPositionRelative(this.eggGachaOptionSelectBg, 20, 17 + i * 16);
|
icon.setPositionRelative(this.eggGachaOptionSelectBg, 20, 17 + i * 16);
|
||||||
|
@ -253,9 +253,9 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
||||||
const tierValue = Utils.randInt(256);
|
const tierValue = Utils.randInt(256);
|
||||||
return tierValue >= 52 ? ModifierTier.COMMON : tierValue >= 8 ? ModifierTier.GREAT : tierValue >= 1 ? ModifierTier.ULTRA : ModifierTier.MASTER;
|
return tierValue >= 52 ? ModifierTier.COMMON : tierValue >= 8 ? ModifierTier.GREAT : tierValue >= 1 ? ModifierTier.ULTRA : ModifierTier.MASTER;
|
||||||
});
|
});
|
||||||
/*if (pullCount >= 100 && !tiers.filter(t => t >= ModifierTier.ULTRA).length)
|
if (pullCount >= 25 && !tiers.filter(t => t >= ModifierTier.ULTRA).length)
|
||||||
tiers[Utils.randInt(tiers.length)] = ModifierTier.ULTRA;*/
|
tiers[Utils.randInt(tiers.length)] = ModifierTier.ULTRA;
|
||||||
if (pullCount >= 10 && !tiers.filter(t => t >= ModifierTier.GREAT).length)
|
else if (pullCount >= 10 && !tiers.filter(t => t >= ModifierTier.GREAT).length)
|
||||||
tiers[Utils.randInt(tiers.length)] = ModifierTier.GREAT;
|
tiers[Utils.randInt(tiers.length)] = ModifierTier.GREAT;
|
||||||
|
|
||||||
const timestamp = new Date().getTime();
|
const timestamp = new Date().getTime();
|
||||||
|
@ -355,18 +355,21 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
||||||
this.transitioning = false;
|
this.transitioning = false;
|
||||||
this.eggGachaSummaryContainer.setVisible(true);
|
this.eggGachaSummaryContainer.setVisible(true);
|
||||||
|
|
||||||
|
const eggScale = eggs.length < 20 ? 1 : 0.5;
|
||||||
|
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: this.eggGachaOverlay,
|
targets: this.eggGachaOverlay,
|
||||||
alpha: 0.5,
|
alpha: 0.5,
|
||||||
ease: 'Sine.easeOut',
|
ease: 'Sine.easeOut',
|
||||||
duration: 750,
|
duration: 750,
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
const rows = Math.ceil(eggs.length / 5);
|
const rowItems = 5;
|
||||||
const cols = Math.min(eggs.length, 5);
|
const rows = Math.ceil(eggs.length / rowItems);
|
||||||
|
const cols = Math.min(eggs.length, rowItems);
|
||||||
const height = this.eggGachaOverlay.displayHeight - this.eggGachaMessageBox.displayHeight;
|
const height = this.eggGachaOverlay.displayHeight - this.eggGachaMessageBox.displayHeight;
|
||||||
const eggContainers = eggs.map((egg, t) => {
|
const eggContainers = eggs.map((egg, t) => {
|
||||||
const col = t % 5;
|
const col = t % rowItems;
|
||||||
const row = Math.floor(t / 5);
|
const row = Math.floor(t / rowItems);
|
||||||
const sliceWidth = this.eggGachaOverlay.displayWidth / (cols + 2);
|
const sliceWidth = this.eggGachaOverlay.displayWidth / (cols + 2);
|
||||||
const sliceHeight = height / (rows + 2);
|
const sliceHeight = height / (rows + 2);
|
||||||
const yOffset = (sliceHeight / 2 * (row / Math.max(rows - 1, 1))) + sliceHeight / 4;
|
const yOffset = (sliceHeight / 2 * (row / Math.max(rows - 1, 1))) + sliceHeight / 4;
|
||||||
|
@ -381,7 +384,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
||||||
eggText.setTint(getModifierTierTextTint(!egg.isManaphyEgg() ? egg.tier : ModifierTier.ULTRA));
|
eggText.setTint(getModifierTierTextTint(!egg.isManaphyEgg() ? egg.tier : ModifierTier.ULTRA));
|
||||||
ret.add(eggText);
|
ret.add(eggText);
|
||||||
|
|
||||||
this.eggGachaSummaryContainer.add(ret);
|
this.eggGachaSummaryContainer.addAt(ret, 0);
|
||||||
return ret;
|
return ret;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -390,7 +393,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
||||||
targets: eggContainer,
|
targets: eggContainer,
|
||||||
delay: this.getDelayValue(e * 100),
|
delay: this.getDelayValue(e * 100),
|
||||||
duration: this.getDelayValue(350),
|
duration: this.getDelayValue(350),
|
||||||
scale: 1,
|
scale: eggScale,
|
||||||
ease: 'Sine.easeOut'
|
ease: 'Sine.easeOut'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -520,6 +523,19 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
|
if (!this.scene.gameData.voucherCounts[VoucherType.GOLDEN]) {
|
||||||
|
error = true;
|
||||||
|
this.showError('You don\'t have enough vouchers!');
|
||||||
|
} else if (this.scene.gameData.eggs.length < 75) {
|
||||||
|
this.consumeVouchers(VoucherType.GOLDEN, 1);
|
||||||
|
this.pull(25);
|
||||||
|
success = true;
|
||||||
|
} else {
|
||||||
|
error = true;
|
||||||
|
this.showError('You have too many eggs!');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
ui.revertMode();
|
ui.revertMode();
|
||||||
success = true;
|
success = true;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue