From e6c31966d79e71746f0893f4354d6890ebb88b3c Mon Sep 17 00:00:00 2001 From: dielle000 <168655502+dielle000@users.noreply.github.com> Date: Wed, 1 May 2024 21:10:31 +0200 Subject: [PATCH] Change pokemon stats chart Stats are arranged like in the mainline games --- src/ui/stats-container.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ui/stats-container.ts b/src/ui/stats-container.ts index 014465805..b8d9c59a4 100644 --- a/src/ui/stats-container.ts +++ b/src/ui/stats-container.ts @@ -4,7 +4,8 @@ import { Stat, getStatName } from "../data/pokemon-stat"; import { TextStyle, addBBCodeTextObject, addTextObject, getTextColor } from "./text"; 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 ivChartStatCoordMultipliers = [ [ 0, -1 ], [ 0.825, -0.5 ], [ 0.825, 0.5 ], [ -0.825, -0.5 ], [ -0.825, 0.5 ], [ 0, 1 ] ]; +const ivChartStatIndexes = [0,1,2,5,4,3] // swap special attack and speed const defaultIvChartData = new Array(12).fill(null).map(() => 0); export class StatsContainer extends Phaser.GameObjects.Container { @@ -22,7 +23,7 @@ export class StatsContainer extends Phaser.GameObjects.Container { } setup() { - const ivChartBgData = new Array(6).fill(null).map((_, i: integer) => [ ivChartSize * ivChartStatCoordMultipliers[i][0], ivChartSize * ivChartStatCoordMultipliers[i][1] ] ).flat(); + const ivChartBgData = new Array(6).fill(null).map((_, i: integer) => [ ivChartSize * ivChartStatCoordMultipliers[ivChartStatIndexes[i]][0], ivChartSize * ivChartStatCoordMultipliers[ivChartStatIndexes[i]][1] ] ).flat(); const ivChartBg = this.scene.add.polygon(48, 44, ivChartBgData, 0xd8e0f0, 0.625); ivChartBg.setOrigin(0, 0); @@ -62,7 +63,7 @@ export class StatsContainer extends Phaser.GameObjects.Container { 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 ivChartData = new Array(6).fill(null).map((_, i) => [ (ivs[ivChartStatIndexes[i]] / 31) * ivChartSize * ivChartStatCoordMultipliers[ivChartStatIndexes[i]][0], (ivs[ivChartStatIndexes[i]] / 31) * ivChartSize * ivChartStatCoordMultipliers[ivChartStatIndexes[i]][1] ] ).flat(); const lastIvChartData = this.statsIvsCache || defaultIvChartData; this.statsIvsCache = ivChartData.slice(0);