mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-26 17:29:30 +02:00
Display opponents on saves
Adds a text label displaying how many items aren't shown due to size limitations Reduces the items shown from 12 to 9 (or 8 items and the text label, if you have more than 9 items) Shows the opponent's team in the bottom right
This commit is contained in:
parent
3c99c727c3
commit
3ee29d4e5d
@ -19,6 +19,9 @@ export function getPokemonMessage(pokemon: Pokemon, content: string): string {
|
|||||||
* @returns {string} ex: "Wild Gengar", "Ectoplasma sauvage"
|
* @returns {string} ex: "Wild Gengar", "Ectoplasma sauvage"
|
||||||
*/
|
*/
|
||||||
export function getPokemonNameWithAffix(pokemon: Pokemon): string {
|
export function getPokemonNameWithAffix(pokemon: Pokemon): string {
|
||||||
|
if (pokemon.scene.currentBattle == null) {
|
||||||
|
return pokemon.getNameToRender()
|
||||||
|
}
|
||||||
switch (pokemon.scene.currentBattle.battleSpec) {
|
switch (pokemon.scene.currentBattle.battleSpec) {
|
||||||
case BattleSpec.DEFAULT:
|
case BattleSpec.DEFAULT:
|
||||||
return !pokemon.isPlayer()
|
return !pokemon.isPlayer()
|
||||||
|
@ -377,6 +377,15 @@ class SessionSlot extends Phaser.GameObjects.Container {
|
|||||||
const modifierIconsContainer = this.scene.add.container(148, 30);
|
const modifierIconsContainer = this.scene.add.container(148, 30);
|
||||||
modifierIconsContainer.setScale(0.5);
|
modifierIconsContainer.setScale(0.5);
|
||||||
let visibleModifierIndex = 0;
|
let visibleModifierIndex = 0;
|
||||||
|
let numberOfModifiers = 0
|
||||||
|
const itemDisplayLimit = 9
|
||||||
|
for (const m of data.modifiers) {
|
||||||
|
const modifier = m.toModifier(this.scene, modifiersModule[m.className]);
|
||||||
|
if (modifier instanceof PokemonHeldItemModifier) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
numberOfModifiers++;
|
||||||
|
}
|
||||||
for (const m of data.modifiers) {
|
for (const m of data.modifiers) {
|
||||||
const modifier = m.toModifier(this.scene, modifiersModule[m.className]);
|
const modifier = m.toModifier(this.scene, modifiersModule[m.className]);
|
||||||
if (modifier instanceof PokemonHeldItemModifier) {
|
if (modifier instanceof PokemonHeldItemModifier) {
|
||||||
@ -385,11 +394,42 @@ class SessionSlot extends Phaser.GameObjects.Container {
|
|||||||
const icon = modifier.getIcon(this.scene, false);
|
const icon = modifier.getIcon(this.scene, false);
|
||||||
icon.setPosition(24 * visibleModifierIndex, 0);
|
icon.setPosition(24 * visibleModifierIndex, 0);
|
||||||
modifierIconsContainer.add(icon);
|
modifierIconsContainer.add(icon);
|
||||||
if (++visibleModifierIndex === 12) {
|
if (++visibleModifierIndex === (numberOfModifiers == itemDisplayLimit ? itemDisplayLimit : itemDisplayLimit - 1)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (numberOfModifiers > itemDisplayLimit) {
|
||||||
|
var plusText = addTextObject(this.scene, 24 * visibleModifierIndex + 20, 4, `+${numberOfModifiers - visibleModifierIndex}`, TextStyle.PARTY, { fontSize: "80px", color: "#f8f8f8" });
|
||||||
|
plusText.setShadow(0, 0, null);
|
||||||
|
plusText.setStroke("#424242", 14);
|
||||||
|
plusText.setOrigin(1, 0);
|
||||||
|
modifierIconsContainer.add(plusText);
|
||||||
|
}
|
||||||
|
var spacing = 20
|
||||||
|
if (data.enemyParty.length == 4) {
|
||||||
|
spacing = 17
|
||||||
|
}
|
||||||
|
if (data.enemyParty.length == 5) {
|
||||||
|
spacing = 12
|
||||||
|
}
|
||||||
|
if (data.enemyParty.length == 6) {
|
||||||
|
spacing = 10
|
||||||
|
}
|
||||||
|
data.enemyParty.forEach((p, i) => {
|
||||||
|
const iconContainer = this.scene.add.container(24 * 9 + 1 + i*spacing, -1);
|
||||||
|
const pokemon = p.toPokemon(this.scene);
|
||||||
|
const icon = this.scene.addPokemonIcon(pokemon, 0, 0, 0, 0);
|
||||||
|
iconContainer.add(icon);
|
||||||
|
pokemon.destroy();
|
||||||
|
modifierIconsContainer.add(iconContainer);
|
||||||
|
})
|
||||||
|
if (true) {
|
||||||
|
const vsLabel = addTextObject(this.scene, 24 * 9 + 20, 15, `vs`, TextStyle.PARTY, { fontSize: "80px", color: "#f8f8f8" });
|
||||||
|
vsLabel.setShadow(0, 0, null);
|
||||||
|
vsLabel.setStroke("#424242", 14);
|
||||||
|
vsLabel.setOrigin(1, 0);
|
||||||
|
modifierIconsContainer.add(vsLabel);
|
||||||
|
}
|
||||||
this.add(modifierIconsContainer);
|
this.add(modifierIconsContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user