mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-26 00:36:25 +00:00
Change pokemon stats chart
Stats are arranged like in the mainline games
This commit is contained in:
parent
68f3326607
commit
e6c31966d7
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user