mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-05 07:52:17 +02:00
Make statOrder specific to subclass
This commit is contained in:
parent
1f14325ac7
commit
d69fc04188
@ -13,7 +13,7 @@ import type BattleFlyout from "../battle-flyout";
|
|||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { ExpGainsSpeed } from "#app/enums/exp-gains-speed";
|
import { ExpGainsSpeed } from "#app/enums/exp-gains-speed";
|
||||||
|
|
||||||
export default class BattleInfo extends Phaser.GameObjects.Container {
|
export default abstract class BattleInfo extends Phaser.GameObjects.Container {
|
||||||
public static readonly EXP_GAINS_DURATION_BASE = 1650;
|
public static readonly EXP_GAINS_DURATION_BASE = 1650;
|
||||||
|
|
||||||
protected baseY: number;
|
protected baseY: number;
|
||||||
@ -71,18 +71,9 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
public flyoutMenu?: BattleFlyout;
|
public flyoutMenu?: BattleFlyout;
|
||||||
|
|
||||||
protected statOrder: Stat[];
|
get statOrder(): Stat[] {
|
||||||
protected readonly statOrderPlayer = [Stat.ATK, Stat.DEF, Stat.SPATK, Stat.SPDEF, Stat.ACC, Stat.EVA, Stat.SPD];
|
return [];
|
||||||
protected readonly statOrderEnemy = [
|
}
|
||||||
Stat.HP,
|
|
||||||
Stat.ATK,
|
|
||||||
Stat.DEF,
|
|
||||||
Stat.SPATK,
|
|
||||||
Stat.SPDEF,
|
|
||||||
Stat.ACC,
|
|
||||||
Stat.EVA,
|
|
||||||
Stat.SPD,
|
|
||||||
];
|
|
||||||
|
|
||||||
constructor(x: number, y: number, player: boolean) {
|
constructor(x: number, y: number, player: boolean) {
|
||||||
super(globalScene, x, y);
|
super(globalScene, x, y);
|
||||||
@ -201,9 +192,8 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
|
|||||||
const startingX = this.player ? -this.statsBox.width + 8 : -this.statsBox.width + 5;
|
const startingX = this.player ? -this.statsBox.width + 8 : -this.statsBox.width + 5;
|
||||||
const paddingX = this.player ? 4 : 2;
|
const paddingX = this.player ? 4 : 2;
|
||||||
const statOverflow = this.player ? 1 : 0;
|
const statOverflow = this.player ? 1 : 0;
|
||||||
this.statOrder = this.player ? this.statOrderPlayer : this.statOrderEnemy; // this tells us whether or not to use the player or enemy battle stat order
|
|
||||||
|
|
||||||
this.statOrder.map((s, i) => {
|
for (const [i, s] of this.statOrder.entries()) {
|
||||||
// we do a check for i > statOverflow to see when the stat labels go onto the next column
|
// we do a check for i > statOverflow to see when the stat labels go onto the next column
|
||||||
// For enemies, we have HP (i=0) by itself then a new column, so we check for i > 0
|
// For enemies, we have HP (i=0) by itself then a new column, so we check for i > 0
|
||||||
// For players, we don't have HP, so we start with i = 0 and i = 1 for our first column, and so need to check for i > 1
|
// For players, we don't have HP, so we start with i = 0 and i = 1 for our first column, and so need to check for i > 1
|
||||||
@ -241,7 +231,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
|
|||||||
statLabel.setVisible(false);
|
statLabel.setVisible(false);
|
||||||
statNumber.setVisible(false);
|
statNumber.setVisible(false);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
this.type1Icon = globalScene.add.sprite(
|
this.type1Icon = globalScene.add.sprite(
|
||||||
player ? -139 : -15,
|
player ? -139 : -15,
|
||||||
|
@ -3,8 +3,25 @@ import { globalScene } from "#app/global-scene";
|
|||||||
import BattleFlyout from "../battle-flyout";
|
import BattleFlyout from "../battle-flyout";
|
||||||
import { addTextObject, TextStyle } from "#app/ui/text";
|
import { addTextObject, TextStyle } from "#app/ui/text";
|
||||||
import { addWindow, WindowVariant } from "#app/ui/ui-theme";
|
import { addWindow, WindowVariant } from "#app/ui/ui-theme";
|
||||||
|
import { Stat } from "#enums/stat";
|
||||||
|
|
||||||
export class EnemyBattleInfo extends BattleInfo {
|
export class EnemyBattleInfo extends BattleInfo {
|
||||||
|
protected player: false = false;
|
||||||
|
protected championRibbon: Phaser.GameObjects.Sprite;
|
||||||
|
protected ownedIcon: Phaser.GameObjects.Sprite;
|
||||||
|
public flyoutMenu: BattleFlyout;
|
||||||
|
|
||||||
|
// #region Type effectiveness hint objects
|
||||||
|
protected effectivenessContainer: Phaser.GameObjects.Container;
|
||||||
|
protected effectivenessWindow: Phaser.GameObjects.NineSlice;
|
||||||
|
protected effectivenessText: Phaser.GameObjects.Text;
|
||||||
|
protected currentEffectiveness?: string;
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
override get statOrder(): Stat[] {
|
||||||
|
return [Stat.HP, Stat.ATK, Stat.DEF, Stat.SPATK, Stat.SPDEF, Stat.ACC, Stat.EVA, Stat.SPD];
|
||||||
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super(140, -141, false);
|
super(140, -141, false);
|
||||||
|
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
|
import { Stat } from "#enums/stat";
|
||||||
import BattleInfo from "./battle-info";
|
import BattleInfo from "./battle-info";
|
||||||
|
|
||||||
export class PlayerBattleInfo extends BattleInfo {
|
export class PlayerBattleInfo extends BattleInfo {
|
||||||
|
override get statOrder(): Stat[] {
|
||||||
|
return [Stat.ATK, Stat.DEF, Stat.SPATK, Stat.SPDEF, Stat.ACC, Stat.EVA, Stat.SPD];
|
||||||
|
}
|
||||||
constructor() {
|
constructor() {
|
||||||
super(Math.floor(globalScene.game.canvas.width / 6) - 10, -72, true);
|
super(Math.floor(globalScene.game.canvas.width / 6) - 10, -72, true);
|
||||||
|
|
||||||
this.hpNumbersContainer = globalScene.add.container(-15, 10);
|
this.hpNumbersContainer = globalScene.add.container(-15, 10).setName("container_hp");
|
||||||
this.hpNumbersContainer.setName("container_hp");
|
|
||||||
this.add(this.hpNumbersContainer);
|
this.add(this.hpNumbersContainer);
|
||||||
|
|
||||||
const expBar = globalScene.add.image(-98, 18, "overlay_exp");
|
const expBar = globalScene.add.image(-98, 18, "overlay_exp").setName("overlay_exp").setOrigin(0);
|
||||||
expBar.setName("overlay_exp");
|
|
||||||
expBar.setOrigin(0);
|
|
||||||
this.add(expBar);
|
this.add(expBar);
|
||||||
|
|
||||||
const expMaskRect = globalScene.make
|
const expMaskRect = globalScene.make
|
||||||
|
Loading…
Reference in New Issue
Block a user