Added a duplicate of a function just for fun

Deleted a deprecated function
Added some !s around to fix some errors
This commit is contained in:
RedstonewolfX 2024-08-20 20:25:51 -04:00
parent 8695ff7c5c
commit a7e5201b75
3 changed files with 22 additions and 11 deletions

View File

@ -1879,7 +1879,6 @@ export class EncounterPhase extends BattlePhase {
const enemyField = this.scene.getEnemyField();
enemyField.forEach((enemyPokemon, e) => {
enemyPokemon.flyout.revealMoves()
if (enemyPokemon.isShiny()) {
this.scene.unshiftPhase(new ShinySparklePhase(this.scene, BattlerIndex.ENEMY + e));
}

View File

@ -161,7 +161,7 @@ export default class BattleFlyout extends Phaser.GameObjects.Container {
if (foundInfo) {
foundInfo.ppUsed = moveUsedEvent.ppUsed;
} else {
var idx = this.pokemon.moveset.indexOf(this.pokemon.moveset.find((v) => (v.getMove().id == moveUsedEvent.move.id)))
var idx = this.pokemon.moveset.indexOf(this.pokemon.moveset.find((v) => (v!.getMove().id == moveUsedEvent.move.id))!)
if (idx == -1) {
this.moveInfo.push({move: moveUsedEvent.move, maxPp: moveUsedEvent.move.pp, ppUsed: moveUsedEvent.ppUsed});
} else {
@ -189,15 +189,6 @@ export default class BattleFlyout extends Phaser.GameObjects.Container {
this.setText();
}
public revealMoves() {
return;
this.moveInfo = new Array<MoveInfo>(4);
this.pokemon.moveset.forEach((mv, idx) => {
this.moveInfo[idx] = {move: mv.getMove(), maxPp: mv.getMovePp(), ppUsed: mv.ppUsed}
})
this.setText()
}
/** Animates the flyout to either show or hide it by applying a fade and translation */
toggleFlyout(visible: boolean): void {
this.flyoutVisible = visible;

View File

@ -555,6 +555,27 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
}
}
}
updateBossSegmentDividers_override(pokemon: Pokemon, bars: integer, index: integer): void {
while (this.hpBarSegmentDividers.length) {
this.hpBarSegmentDividers.pop()?.destroy();
}
if (bars > 1) {
const uiTheme = (this.scene as BattleScene).uiTheme;
const maxHp = pokemon.getMaxHp();
for (let s = 1; s < bars; s++) {
const dividerX = (Math.round((maxHp / bars) * s) / maxHp) * this.hpBar.width;
const divider = this.scene.add.rectangle(0, 0, 1, this.hpBar.height - (uiTheme ? 0 : 1), index >= s ? 0xFFFFFF : 0x404040);
divider.setOrigin(0.5, 0);
divider.setName("hpBar_divider_" + s.toString());
this.add(divider);
this.moveBelow(divider as Phaser.GameObjects.GameObject, this.statsContainer);
divider.setPositionRelative(this.hpBar, dividerX, uiTheme ? 0 : 1);
this.hpBarSegmentDividers.push(divider);
}
}
}
displayParty(overwriteparty?: Pokemon[], useparty?: EnemyPokemon[]): void {
// Floor 8: 2 pokemon