Add egg gacha system and various minor changes

Add egg gacha system; remove certain mythical Pokemon from the wild pool as egg exclusive; add egg vouchers with UI; rework Shiny Charm odds; fix trainer Pokemon shiny odds not properly ignoring Shiny Charm modifier
This commit is contained in:
Flashfyre committed 2023-12-19 23:51:48 -05:00
1 parent 50d4858caa
commit aa94e044ab
71 files changed
+4303 -2241

No files matched your search

+20 -6
View File
@@ -1,19 +1,24 @@
import BBCodeText from "phaser3-rex-plugins/plugins/gameobjects/tagtext/bbcodetext/BBCodeText";
import BattleScene from "../battle-scene";
import { Stat, getStatName } from "../data/pokemon-stat";
import { TextStyle, addTextObject } from "./text";
import { TextStyle, addBBCodeTextObject, addTextObject, getTextColor } from "./text";
import { Gender, getGenderColor } from "../data/gender";
const ivChartSize = 24;
const ivChartStatCoordMultipliers = [ [ 0, 1 ], [ 0.825, 0.5 ], [ 0.825, -0.5 ], [ 0, -1 ], [ -0.825, -0.5 ], [ -0.825, 0.5 ] ];
const defaultIvChartData = new Array(12).fill(null).map(() => 0);
export class StatsContainer extends Phaser.GameObjects.Container {
private showDiff: boolean;
private statsIvsCache: integer[];
private ivChart: Phaser.GameObjects.Polygon;
private ivStatValueTexts: Phaser.GameObjects.Text[];
private ivStatValueTexts: BBCodeText[];
constructor(scene: BattleScene, x: number, y: number) {
constructor(scene: BattleScene, x: number, y: number, showDiff?: boolean) {
super(scene, x, y);
this.showDiff = !!showDiff;
this.setup();
}
@@ -48,7 +53,7 @@ export class StatsContainer extends Phaser.GameObjects.Container {
const statLabel = addTextObject(this.scene, ivChartBg.x + (ivChartSize) * ivChartStatCoordMultipliers[i][0] * 1.325, ivChartBg.y + (ivChartSize) * ivChartStatCoordMultipliers[i][1] * 1.325 - 4, getStatName(i as Stat), TextStyle.TOOLTIP_CONTENT);
statLabel.setOrigin(0.5);
this.ivStatValueTexts[i] = addTextObject(this.scene, statLabel.x, statLabel.y + 8, '0', TextStyle.TOOLTIP_CONTENT);
this.ivStatValueTexts[i] = addBBCodeTextObject(this.scene, statLabel.x, statLabel.y + 8, '0', TextStyle.TOOLTIP_CONTENT);
this.ivStatValueTexts[i].setOrigin(0.5)
this.add(statLabel);
@@ -56,13 +61,22 @@ export class StatsContainer extends Phaser.GameObjects.Container {
});
}
updateIvs(ivs: integer[]): void {
updateIvs(ivs: integer[], originalIvs?: integer[]): void {
if (ivs) {
const ivChartData = new Array(6).fill(null).map((_, i) => [ (ivs[i] / 31) * ivChartSize * ivChartStatCoordMultipliers[i][0], (ivs[i] / 31) * ivChartSize * ivChartStatCoordMultipliers[i][1] ] ).flat();
const lastIvChartData = this.statsIvsCache || defaultIvChartData;
this.statsIvsCache = ivChartData.slice(0);
this.ivStatValueTexts.map((t: Phaser.GameObjects.Text, i: integer) => t.setText(ivs[i].toString()));
this.ivStatValueTexts.map((t: BBCodeText, i: integer) => {
let label = ivs[i].toString();
if (this.showDiff && originalIvs) {
if (originalIvs[i] < ivs[i])
label += ` ([color=${getGenderColor(Gender.MALE)}]+${ivs[i] - originalIvs[i]}[/color])`;
else
label += ' (-)';
}
t.setText(`[shadow]${label}[/shadow]`);
});
this.scene.tweens.addCounter({
from: 0,