Apply suggestions from code review

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>
This commit is contained in:
Wlowscha 2025-08-03 15:52:01 +02:00 committed by GitHub
parent 88ace888eb
commit e9318ec4c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1832,14 +1832,14 @@ class PartySlot extends Phaser.GameObjects.Container {
const isDoubleBattle = globalScene.currentBattle.double; const isDoubleBattle = globalScene.currentBattle.double;
const isItemManageMode = partyUiMode === PartyUiMode.MODIFIER_TRANSFER || partyUiMode === PartyUiMode.DISCARD; const isItemManageMode = partyUiMode === PartyUiMode.MODIFIER_TRANSFER || partyUiMode === PartyUiMode.DISCARD;
/** /*
Here we determine the position of the slot. * Here we determine the position of the slot.
The x coordinate depends on whether the pokemon is on the field or in the bench. * The x coordinate depends on whether the pokemon is on the field or in the bench.
The y coordinate is more complex to determine * The y coordinate depends on various factors, such as
*/ */
const slotPositionX = isBenched ? 143 : 9; const slotPositionX = isBenched ? 143 : 9;
let slotPositionY = 0; let slotPositionY: number;
if (isBenched) { if (isBenched) {
slotPositionY = -196 + (isDoubleBattle ? -40 : 0); slotPositionY = -196 + (isDoubleBattle ? -40 : 0);
slotPositionY += (28 + (isDoubleBattle ? 8 : 0)) * slotIndex; slotPositionY += (28 + (isDoubleBattle ? 8 : 0)) * slotIndex;
@ -1854,8 +1854,7 @@ class PartySlot extends Phaser.GameObjects.Container {
super(globalScene, slotPositionX, slotPositionY); super(globalScene, slotPositionX, slotPositionY);
this.slotIndex = slotIndex; this.slotIndex = slotIndex;
const battlerCount = globalScene.currentBattle.getBattlerCount(); this.isBenched = isBenched;
this.isBenched = this.slotIndex >= battlerCount;
this.pokemon = pokemon; this.pokemon = pokemon;
this.iconAnimHandler = iconAnimHandler; this.iconAnimHandler = iconAnimHandler;
@ -1925,7 +1924,6 @@ class PartySlot extends Phaser.GameObjects.Container {
this.add(this.slotPb); this.add(this.slotPb);
this.pokemonIcon = globalScene.addPokemonIcon(this.pokemon, this.slotPb.x, this.slotPb.y, 0.5, 0.5, true); this.pokemonIcon = globalScene.addPokemonIcon(this.pokemon, this.slotPb.x, this.slotPb.y, 0.5, 0.5, true);
// this.pokemonIcon.setPosition();
this.add(this.pokemonIcon); this.add(this.pokemonIcon);
this.iconAnimHandler.addOrUpdate(this.pokemonIcon, PokemonIconAnimMode.PASSIVE); this.iconAnimHandler.addOrUpdate(this.pokemonIcon, PokemonIconAnimMode.PASSIVE);