Cleanup enemybattleinfo constructor to use chaining

This commit is contained in:
Sirz Benjie 2025-04-23 10:05:26 -05:00
parent b65399bb3d
commit 95c7d34009
No known key found for this signature in database
GPG Key ID: 4A524B4D196C759E

View File

@ -25,17 +25,15 @@ export class EnemyBattleInfo extends BattleInfo {
constructor() { constructor() {
super(140, -141, false); super(140, -141, false);
this.ownedIcon = globalScene.add.sprite(0, 0, "icon_owned"); this.ownedIcon = globalScene.add.sprite(0, 0, "icon_owned").setName("icon_owned").setVisible(false).setOrigin(0, 0);
this.ownedIcon.setName("icon_owned");
this.ownedIcon.setVisible(false);
this.ownedIcon.setOrigin(0, 0);
this.ownedIcon.setPositionRelative(this.nameText, 0, 11.75); this.ownedIcon.setPositionRelative(this.nameText, 0, 11.75);
this.add(this.ownedIcon); this.add(this.ownedIcon);
this.championRibbon = globalScene.add.sprite(0, 0, "champion_ribbon"); this.championRibbon = globalScene.add
this.championRibbon.setName("icon_champion_ribbon"); .sprite(0, 0, "champion_ribbon")
this.championRibbon.setVisible(false); .setName("icon_champion_ribbon")
this.championRibbon.setOrigin(0, 0); .setVisible(false)
.setOrigin(0, 0);
this.championRibbon.setPositionRelative(this.nameText, 8, 11.75); this.championRibbon.setPositionRelative(this.nameText, 8, 11.75);
this.add(this.championRibbon); this.add(this.championRibbon);
@ -44,16 +42,14 @@ export class EnemyBattleInfo extends BattleInfo {
this.moveBelow<Phaser.GameObjects.GameObject>(this.flyoutMenu, this.box); this.moveBelow<Phaser.GameObjects.GameObject>(this.flyoutMenu, this.box);
this.effectivenessContainer = globalScene.add.container(0, 0); this.effectivenessContainer = globalScene.add.container(0, 0).setVisible(false);
this.effectivenessContainer.setPositionRelative(this.type1Icon, 22, 4); this.effectivenessContainer.setPositionRelative(this.type1Icon, 22, 4);
this.effectivenessContainer.setVisible(false);
this.add(this.effectivenessContainer); this.add(this.effectivenessContainer);
this.effectivenessText = addTextObject(5, 4.5, "", TextStyle.BATTLE_INFO); this.effectivenessText = addTextObject(5, 4.5, "", TextStyle.BATTLE_INFO);
this.effectivenessWindow = addWindow(0, 0, 0, 20, undefined, false, undefined, undefined, WindowVariant.XTHIN); this.effectivenessWindow = addWindow(0, 0, 0, 20, undefined, false, undefined, undefined, WindowVariant.XTHIN);
this.effectivenessContainer.add(this.effectivenessWindow); this.effectivenessContainer.add([this.effectivenessWindow, this.effectivenessText]);
this.effectivenessContainer.add(this.effectivenessText);
} }
setMini(_mini: boolean): void {} // Always mini setMini(_mini: boolean): void {} // Always mini