mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-07 07:59:26 +02:00
Merge cc8312b24a
into 5bfcb1d379
This commit is contained in:
commit
50c9063bad
Binary file not shown.
Before Width: | Height: | Size: 837 B After Width: | Height: | Size: 4.0 KiB |
146
public/images/ui/party_slot_main_short.json
Normal file
146
public/images/ui/party_slot_main_short.json
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
{
|
||||||
|
"textures": [
|
||||||
|
{
|
||||||
|
"image": "party_slot_main_short.png",
|
||||||
|
"format": "RGBA8888",
|
||||||
|
"size": {
|
||||||
|
"w": 110,
|
||||||
|
"h": 294
|
||||||
|
},
|
||||||
|
"scale": 1,
|
||||||
|
"frames": [
|
||||||
|
{
|
||||||
|
"filename": "party_slot_main_short",
|
||||||
|
"rotated": false,
|
||||||
|
"trimmed": false,
|
||||||
|
"sourceSize": {
|
||||||
|
"w": 110,
|
||||||
|
"h": 41
|
||||||
|
},
|
||||||
|
"spriteSourceSize": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"w": 110,
|
||||||
|
"h": 41
|
||||||
|
},
|
||||||
|
"frame": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"w": 110,
|
||||||
|
"h": 41
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "party_slot_main_short_sel",
|
||||||
|
"rotated": false,
|
||||||
|
"trimmed": false,
|
||||||
|
"sourceSize": {
|
||||||
|
"w": 110,
|
||||||
|
"h": 41
|
||||||
|
},
|
||||||
|
"spriteSourceSize": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"w": 110,
|
||||||
|
"h": 41
|
||||||
|
},
|
||||||
|
"frame": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 41,
|
||||||
|
"w": 110,
|
||||||
|
"h": 41
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "party_slot_main_short_fnt",
|
||||||
|
"rotated": false,
|
||||||
|
"trimmed": false,
|
||||||
|
"sourceSize": {
|
||||||
|
"w": 110,
|
||||||
|
"h": 41
|
||||||
|
},
|
||||||
|
"spriteSourceSize": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"w": 110,
|
||||||
|
"h": 41
|
||||||
|
},
|
||||||
|
"frame": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 82,
|
||||||
|
"w": 110,
|
||||||
|
"h": 41
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "party_slot_main_short_fnt_sel",
|
||||||
|
"rotated": false,
|
||||||
|
"trimmed": false,
|
||||||
|
"sourceSize": {
|
||||||
|
"w": 110,
|
||||||
|
"h": 41
|
||||||
|
},
|
||||||
|
"spriteSourceSize": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"w": 110,
|
||||||
|
"h": 41
|
||||||
|
},
|
||||||
|
"frame": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 123,
|
||||||
|
"w": 110,
|
||||||
|
"h": 41
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "party_slot_main_short_swap",
|
||||||
|
"rotated": false,
|
||||||
|
"trimmed": false,
|
||||||
|
"sourceSize": {
|
||||||
|
"w": 110,
|
||||||
|
"h": 41
|
||||||
|
},
|
||||||
|
"spriteSourceSize": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"w": 110,
|
||||||
|
"h": 41
|
||||||
|
},
|
||||||
|
"frame": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 164,
|
||||||
|
"w": 110,
|
||||||
|
"h": 41
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "party_slot_main_short_swap_sel",
|
||||||
|
"rotated": false,
|
||||||
|
"trimmed": false,
|
||||||
|
"sourceSize": {
|
||||||
|
"w": 110,
|
||||||
|
"h": 41
|
||||||
|
},
|
||||||
|
"spriteSourceSize": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"w": 110,
|
||||||
|
"h": 41
|
||||||
|
},
|
||||||
|
"frame": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 205,
|
||||||
|
"w": 110,
|
||||||
|
"h": 41
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"meta": {
|
||||||
|
"app": "https://www.codeandweb.com/texturepacker",
|
||||||
|
"version": "3.0",
|
||||||
|
"smartupdate": "$TexturePacker:SmartUpdate:29685f2f538901cf5bf7f0ed2ea867c3:a080ea6c8cccd1e03244214053e79796:565f7afc5ca419b6ba8dbce51ea30818$"
|
||||||
|
}
|
||||||
|
}
|
BIN
public/images/ui/party_slot_main_short.png
Normal file
BIN
public/images/ui/party_slot_main_short.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
@ -121,6 +121,7 @@ export class LoadingScene extends SceneBase {
|
|||||||
this.loadImage("party_bg_double", "ui");
|
this.loadImage("party_bg_double", "ui");
|
||||||
this.loadImage("party_bg_double_manage", "ui");
|
this.loadImage("party_bg_double_manage", "ui");
|
||||||
this.loadAtlas("party_slot_main", "ui");
|
this.loadAtlas("party_slot_main", "ui");
|
||||||
|
this.loadAtlas("party_slot_main_short", "ui");
|
||||||
this.loadAtlas("party_slot", "ui");
|
this.loadAtlas("party_slot", "ui");
|
||||||
this.loadImage("party_slot_overlay_lv", "ui");
|
this.loadImage("party_slot_overlay_lv", "ui");
|
||||||
this.loadImage("party_slot_hp_bar", "ui");
|
this.loadImage("party_slot_hp_bar", "ui");
|
||||||
|
@ -31,6 +31,11 @@ import { toTitleCase } from "#utils/strings";
|
|||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import type BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext";
|
import type BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext";
|
||||||
|
|
||||||
|
const DISCARD_BUTTON_X = 60;
|
||||||
|
const DISCARD_BUTTON_X_DOUBLES = 64;
|
||||||
|
const DISCARD_BUTTON_Y = -73;
|
||||||
|
const DISCARD_BUTTON_Y_DOUBLES = -58;
|
||||||
|
|
||||||
const defaultMessage = i18next.t("partyUiHandler:choosePokemon");
|
const defaultMessage = i18next.t("partyUiHandler:choosePokemon");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -301,7 +306,7 @@ export class PartyUiHandler extends MessageUiHandler {
|
|||||||
const partyMessageText = addTextObject(10, 8, defaultMessage, TextStyle.WINDOW, { maxLines: 2 });
|
const partyMessageText = addTextObject(10, 8, defaultMessage, TextStyle.WINDOW, { maxLines: 2 });
|
||||||
partyMessageText.setName("text-party-msg");
|
partyMessageText.setName("text-party-msg");
|
||||||
|
|
||||||
partyMessageText.setOrigin(0, 0);
|
partyMessageText.setOrigin(0);
|
||||||
partyMessageBoxContainer.add(partyMessageText);
|
partyMessageBoxContainer.add(partyMessageText);
|
||||||
|
|
||||||
this.message = partyMessageText;
|
this.message = partyMessageText;
|
||||||
@ -317,10 +322,8 @@ export class PartyUiHandler extends MessageUiHandler {
|
|||||||
this.iconAnimHandler = new PokemonIconAnimHandler();
|
this.iconAnimHandler = new PokemonIconAnimHandler();
|
||||||
this.iconAnimHandler.setup();
|
this.iconAnimHandler.setup();
|
||||||
|
|
||||||
const partyDiscardModeButton = new PartyDiscardModeButton(60, -globalScene.game.canvas.height / 15 - 1, this);
|
const partyDiscardModeButton = new PartyDiscardModeButton(DISCARD_BUTTON_X, DISCARD_BUTTON_Y, this);
|
||||||
|
|
||||||
partyContainer.add(partyDiscardModeButton);
|
partyContainer.add(partyDiscardModeButton);
|
||||||
|
|
||||||
this.partyDiscardModeButton = partyDiscardModeButton;
|
this.partyDiscardModeButton = partyDiscardModeButton;
|
||||||
|
|
||||||
// prepare move overlay. in case it appears to be too big, set the overlayScale to .5
|
// prepare move overlay. in case it appears to be too big, set the overlayScale to .5
|
||||||
@ -1235,7 +1238,7 @@ export class PartyUiHandler extends MessageUiHandler {
|
|||||||
}
|
}
|
||||||
if (!this.optionsCursorObj) {
|
if (!this.optionsCursorObj) {
|
||||||
this.optionsCursorObj = globalScene.add.image(0, 0, "cursor");
|
this.optionsCursorObj = globalScene.add.image(0, 0, "cursor");
|
||||||
this.optionsCursorObj.setOrigin(0, 0);
|
this.optionsCursorObj.setOrigin(0);
|
||||||
this.optionsContainer.add(this.optionsCursorObj);
|
this.optionsContainer.add(this.optionsCursorObj);
|
||||||
}
|
}
|
||||||
this.optionsCursorObj.setPosition(
|
this.optionsCursorObj.setPosition(
|
||||||
@ -1607,7 +1610,7 @@ export class PartyUiHandler extends MessageUiHandler {
|
|||||||
optionText.setColor("#40c8f8");
|
optionText.setColor("#40c8f8");
|
||||||
optionText.setShadowColor("#006090");
|
optionText.setShadowColor("#006090");
|
||||||
}
|
}
|
||||||
optionText.setOrigin(0, 0);
|
optionText.setOrigin(0);
|
||||||
|
|
||||||
/** For every item that has stack bigger than 1, display the current quantity selection */
|
/** For every item that has stack bigger than 1, display the current quantity selection */
|
||||||
const itemModifiers = this.getItemModifiers(pokemon);
|
const itemModifiers = this.getItemModifiers(pokemon);
|
||||||
@ -1804,6 +1807,7 @@ class PartySlot extends Phaser.GameObjects.Container {
|
|||||||
private selected: boolean;
|
private selected: boolean;
|
||||||
private transfer: boolean;
|
private transfer: boolean;
|
||||||
private slotIndex: number;
|
private slotIndex: number;
|
||||||
|
private isBenched: boolean;
|
||||||
private pokemon: PlayerPokemon;
|
private pokemon: PlayerPokemon;
|
||||||
|
|
||||||
private slotBg: Phaser.GameObjects.Image;
|
private slotBg: Phaser.GameObjects.Image;
|
||||||
@ -1814,6 +1818,7 @@ class PartySlot extends Phaser.GameObjects.Container {
|
|||||||
public slotHpText: Phaser.GameObjects.Text;
|
public slotHpText: Phaser.GameObjects.Text;
|
||||||
public slotDescriptionLabel: Phaser.GameObjects.Text; // this is used to show text instead of the HP bar i.e. for showing "Able"/"Not Able" for TMs when you try to learn them
|
public slotDescriptionLabel: Phaser.GameObjects.Text; // this is used to show text instead of the HP bar i.e. for showing "Able"/"Not Able" for TMs when you try to learn them
|
||||||
|
|
||||||
|
private slotBgKey: string;
|
||||||
private pokemonIcon: Phaser.GameObjects.Container;
|
private pokemonIcon: Phaser.GameObjects.Container;
|
||||||
private iconAnimHandler: PokemonIconAnimHandler;
|
private iconAnimHandler: PokemonIconAnimHandler;
|
||||||
|
|
||||||
@ -1824,19 +1829,33 @@ class PartySlot extends Phaser.GameObjects.Container {
|
|||||||
partyUiMode: PartyUiMode,
|
partyUiMode: PartyUiMode,
|
||||||
tmMoveId: MoveId,
|
tmMoveId: MoveId,
|
||||||
) {
|
) {
|
||||||
super(
|
const isBenched = slotIndex >= globalScene.currentBattle.getBattlerCount();
|
||||||
globalScene,
|
const isDoubleBattle = globalScene.currentBattle.double;
|
||||||
slotIndex >= globalScene.currentBattle.getBattlerCount() ? 230.5 : 64,
|
const isItemManageMode = partyUiMode === PartyUiMode.MODIFIER_TRANSFER || partyUiMode === PartyUiMode.DISCARD;
|
||||||
slotIndex >= globalScene.currentBattle.getBattlerCount()
|
|
||||||
? -184 +
|
/*
|
||||||
(globalScene.currentBattle.double ? -40 : 0) +
|
* Here we determine the position of the slot.
|
||||||
(28 + (globalScene.currentBattle.double ? 8 : 0)) * slotIndex
|
* The x coordinate depends on whether the pokemon is on the field or in the bench.
|
||||||
: partyUiMode === PartyUiMode.MODIFIER_TRANSFER
|
* The y coordinate depends on various factors, such as
|
||||||
? -124 + (globalScene.currentBattle.double ? -20 : 0) + slotIndex * 55
|
*/
|
||||||
: -124 + (globalScene.currentBattle.double ? -8 : 0) + slotIndex * 64,
|
const slotPositionX = isBenched ? 143 : 9;
|
||||||
);
|
|
||||||
|
let slotPositionY: number;
|
||||||
|
if (isBenched) {
|
||||||
|
slotPositionY = -196 + (isDoubleBattle ? -40 : 0);
|
||||||
|
slotPositionY += (28 + (isDoubleBattle ? 8 : 0)) * slotIndex;
|
||||||
|
} else {
|
||||||
|
slotPositionY = -148.5;
|
||||||
|
if (isDoubleBattle) {
|
||||||
|
slotPositionY += isItemManageMode ? -20 : -8;
|
||||||
|
}
|
||||||
|
slotPositionY += (isItemManageMode ? (isDoubleBattle ? 47 : 55) : 64) * slotIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
super(globalScene, slotPositionX, slotPositionY);
|
||||||
|
|
||||||
this.slotIndex = slotIndex;
|
this.slotIndex = slotIndex;
|
||||||
|
this.isBenched = isBenched;
|
||||||
this.pokemon = pokemon;
|
this.pokemon = pokemon;
|
||||||
this.iconAnimHandler = iconAnimHandler;
|
this.iconAnimHandler = iconAnimHandler;
|
||||||
|
|
||||||
@ -1850,27 +1869,62 @@ class PartySlot extends Phaser.GameObjects.Container {
|
|||||||
setup(partyUiMode: PartyUiMode, tmMoveId: MoveId) {
|
setup(partyUiMode: PartyUiMode, tmMoveId: MoveId) {
|
||||||
const currentLanguage = i18next.resolvedLanguage ?? "en";
|
const currentLanguage = i18next.resolvedLanguage ?? "en";
|
||||||
const offsetJa = currentLanguage === "ja";
|
const offsetJa = currentLanguage === "ja";
|
||||||
|
const isItemManageMode = partyUiMode === PartyUiMode.MODIFIER_TRANSFER || partyUiMode === PartyUiMode.DISCARD;
|
||||||
|
|
||||||
const battlerCount = globalScene.currentBattle.getBattlerCount();
|
const slotKey = this.isBenched
|
||||||
|
? "party_slot"
|
||||||
|
: isItemManageMode && globalScene.currentBattle.double
|
||||||
|
? "party_slot_main_short"
|
||||||
|
: "party_slot_main";
|
||||||
|
this.slotBgKey = this.pokemon.hp ? slotKey : `${slotKey}${"_fnt"}`;
|
||||||
|
this.slotBg = globalScene.add.sprite(0, 0, slotKey, this.slotBgKey);
|
||||||
|
this.slotBg.setOrigin(0);
|
||||||
|
this.add(this.slotBg);
|
||||||
|
|
||||||
const slotKey = `party_slot${this.slotIndex >= battlerCount ? "" : "_main"}`;
|
const genderSymbol = getGenderSymbol(this.pokemon.getGender(true));
|
||||||
|
const isFusion = this.pokemon.fusionSpecies;
|
||||||
|
|
||||||
const slotBg = globalScene.add.sprite(0, 0, slotKey, `${slotKey}${this.pokemon.hp ? "" : "_fnt"}`);
|
// Here we define positions and offsets
|
||||||
this.slotBg = slotBg;
|
const magicNumbers = {
|
||||||
|
slotPb: { x: 4, y: 4 },
|
||||||
|
namePosition: { x: 24, y: 10 + (offsetJa ? 2 : 0) },
|
||||||
|
nameTextWidth: 76 - (isFusion ? 8 : 0),
|
||||||
|
levelLabelPosition: { x: 24 + 8, y: 10 + 12 },
|
||||||
|
levelTextToLevelLabelOffset: { x: 9, y: offsetJa ? 1.5 : 0 },
|
||||||
|
genderTextToLevelLabelOffset: { x: 68 - (isFusion ? 8 : 0), y: -9 },
|
||||||
|
splicedIconToLevelLabelOffset: { x: 68, y: 3.5 - 12 },
|
||||||
|
statusIconToLevelLabelOffset: { x: 55, y: 0 },
|
||||||
|
shinyIconToNameOffset: { x: -9, y: 3 },
|
||||||
|
hpBarPosition: { x: 8, y: 31 },
|
||||||
|
hpOverlayToBarOffset: { x: 16, y: 2 }, // This should stay fixed
|
||||||
|
hpTextToBarOffset: { x: -3, y: -2 + (offsetJa ? 2 : 0) }, // This should stay fixed; relative to HP bar length
|
||||||
|
descriptionLabelPosition: { x: 32, y: 46 },
|
||||||
|
};
|
||||||
|
|
||||||
this.add(slotBg);
|
if (isItemManageMode && globalScene.currentBattle.double && !this.isBenched) {
|
||||||
|
magicNumbers.namePosition.y -= 8;
|
||||||
|
magicNumbers.levelLabelPosition.y -= 8;
|
||||||
|
magicNumbers.hpBarPosition.y -= 8;
|
||||||
|
magicNumbers.descriptionLabelPosition.y -= 8;
|
||||||
|
}
|
||||||
|
|
||||||
const slotPb = globalScene.add.sprite(
|
if (this.isBenched) {
|
||||||
this.slotIndex >= battlerCount ? -85.5 : -51,
|
magicNumbers.slotPb = { x: 2, y: 12 };
|
||||||
this.slotIndex >= battlerCount ? 0 : -20.5,
|
magicNumbers.namePosition = { x: 21, y: 2 + (offsetJa ? 2 : 0) };
|
||||||
"party_pb",
|
magicNumbers.nameTextWidth = 52;
|
||||||
);
|
magicNumbers.levelLabelPosition = { x: 21 + 8, y: 2 + 12 };
|
||||||
this.slotPb = slotPb;
|
magicNumbers.genderTextToLevelLabelOffset = { x: 36, y: 0 };
|
||||||
|
magicNumbers.splicedIconToLevelLabelOffset = { x: 36 + (genderSymbol ? 8 : 0), y: 0.5 };
|
||||||
|
magicNumbers.statusIconToLevelLabelOffset = { x: 43, y: 0 };
|
||||||
|
magicNumbers.hpBarPosition = { x: 72, y: 6 };
|
||||||
|
magicNumbers.descriptionLabelPosition = { x: 94, y: 16 };
|
||||||
|
}
|
||||||
|
|
||||||
this.add(slotPb);
|
this.slotPb = globalScene.add.sprite(0, 0, "party_pb");
|
||||||
|
this.slotPb.setPosition(magicNumbers.slotPb.x, magicNumbers.slotPb.y);
|
||||||
this.pokemonIcon = globalScene.addPokemonIcon(this.pokemon, slotPb.x, slotPb.y, 0.5, 0.5, true);
|
this.add(this.slotPb);
|
||||||
|
|
||||||
|
this.pokemonIcon = globalScene.addPokemonIcon(this.pokemon, this.slotPb.x, this.slotPb.y, 0.5, 0.5, true);
|
||||||
this.add(this.pokemonIcon);
|
this.add(this.pokemonIcon);
|
||||||
|
|
||||||
this.iconAnimHandler.addOrUpdate(this.pokemonIcon, PokemonIconAnimMode.PASSIVE);
|
this.iconAnimHandler.addOrUpdate(this.pokemonIcon, PokemonIconAnimMode.PASSIVE);
|
||||||
@ -1884,7 +1938,7 @@ class PartySlot extends Phaser.GameObjects.Container {
|
|||||||
const nameSizeTest = addTextObject(0, 0, displayName, TextStyle.PARTY);
|
const nameSizeTest = addTextObject(0, 0, displayName, TextStyle.PARTY);
|
||||||
nameTextWidth = nameSizeTest.displayWidth;
|
nameTextWidth = nameSizeTest.displayWidth;
|
||||||
|
|
||||||
while (nameTextWidth > (this.slotIndex >= battlerCount ? 52 : 76 - (this.pokemon.fusionSpecies ? 8 : 0))) {
|
while (nameTextWidth > magicNumbers.nameTextWidth) {
|
||||||
displayName = `${displayName.slice(0, displayName.endsWith(".") ? -2 : -1).trimEnd()}.`;
|
displayName = `${displayName.slice(0, displayName.endsWith(".") ? -2 : -1).trimEnd()}.`;
|
||||||
nameSizeTest.setText(displayName);
|
nameSizeTest.setText(displayName);
|
||||||
nameTextWidth = nameSizeTest.displayWidth;
|
nameTextWidth = nameSizeTest.displayWidth;
|
||||||
@ -1893,78 +1947,75 @@ class PartySlot extends Phaser.GameObjects.Container {
|
|||||||
nameSizeTest.destroy();
|
nameSizeTest.destroy();
|
||||||
|
|
||||||
this.slotName = addTextObject(0, 0, displayName, TextStyle.PARTY);
|
this.slotName = addTextObject(0, 0, displayName, TextStyle.PARTY);
|
||||||
this.slotName.setPositionRelative(
|
this.slotName.setPositionRelative(this.slotBg, magicNumbers.namePosition.x, magicNumbers.namePosition.y);
|
||||||
slotBg,
|
this.slotName.setOrigin(0);
|
||||||
this.slotIndex >= battlerCount ? 21 : 24,
|
|
||||||
(this.slotIndex >= battlerCount ? 2 : 10) + (offsetJa ? 2 : 0),
|
|
||||||
);
|
|
||||||
this.slotName.setOrigin(0, 0);
|
|
||||||
|
|
||||||
const slotLevelLabel = globalScene.add.image(0, 0, "party_slot_overlay_lv");
|
const slotLevelLabel = globalScene.add
|
||||||
slotLevelLabel.setPositionRelative(
|
.image(0, 0, "party_slot_overlay_lv")
|
||||||
slotBg,
|
.setPositionRelative(this.slotBg, magicNumbers.levelLabelPosition.x, magicNumbers.levelLabelPosition.y)
|
||||||
(this.slotIndex >= battlerCount ? 21 : 24) + 8,
|
.setOrigin(0);
|
||||||
(this.slotIndex >= battlerCount ? 2 : 10) + 12,
|
|
||||||
);
|
|
||||||
slotLevelLabel.setOrigin(0, 0);
|
|
||||||
|
|
||||||
const slotLevelText = addTextObject(
|
const slotLevelText = addTextObject(
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
this.pokemon.level.toString(),
|
this.pokemon.level.toString(),
|
||||||
this.pokemon.level < globalScene.getMaxExpLevel() ? TextStyle.PARTY : TextStyle.PARTY_RED,
|
this.pokemon.level < globalScene.getMaxExpLevel() ? TextStyle.PARTY : TextStyle.PARTY_RED,
|
||||||
);
|
)
|
||||||
slotLevelText.setPositionRelative(slotLevelLabel, 9, offsetJa ? 1.5 : 0);
|
.setPositionRelative(
|
||||||
slotLevelText.setOrigin(0, 0.25);
|
slotLevelLabel,
|
||||||
|
magicNumbers.levelTextToLevelLabelOffset.x,
|
||||||
|
magicNumbers.levelTextToLevelLabelOffset.y,
|
||||||
|
)
|
||||||
|
.setOrigin(0, 0.25);
|
||||||
slotInfoContainer.add([this.slotName, slotLevelLabel, slotLevelText]);
|
slotInfoContainer.add([this.slotName, slotLevelLabel, slotLevelText]);
|
||||||
|
|
||||||
const genderSymbol = getGenderSymbol(this.pokemon.getGender(true));
|
|
||||||
|
|
||||||
if (genderSymbol) {
|
if (genderSymbol) {
|
||||||
const slotGenderText = addTextObject(0, 0, genderSymbol, TextStyle.PARTY);
|
const slotGenderText = addTextObject(0, 0, genderSymbol, TextStyle.PARTY)
|
||||||
slotGenderText.setColor(getGenderColor(this.pokemon.getGender(true)));
|
.setColor(getGenderColor(this.pokemon.getGender(true)))
|
||||||
slotGenderText.setShadowColor(getGenderColor(this.pokemon.getGender(true), true));
|
.setShadowColor(getGenderColor(this.pokemon.getGender(true), true))
|
||||||
if (this.slotIndex >= battlerCount) {
|
.setPositionRelative(
|
||||||
slotGenderText.setPositionRelative(slotLevelLabel, 36, 0);
|
slotLevelLabel,
|
||||||
} else {
|
magicNumbers.genderTextToLevelLabelOffset.x,
|
||||||
slotGenderText.setPositionRelative(this.slotName, 76 - (this.pokemon.fusionSpecies ? 8 : 0), 3);
|
magicNumbers.genderTextToLevelLabelOffset.y,
|
||||||
}
|
)
|
||||||
slotGenderText.setOrigin(0, 0.25);
|
.setOrigin(0, 0.25);
|
||||||
|
|
||||||
slotInfoContainer.add(slotGenderText);
|
slotInfoContainer.add(slotGenderText);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.pokemon.fusionSpecies) {
|
if (isFusion) {
|
||||||
const splicedIcon = globalScene.add.image(0, 0, "icon_spliced");
|
const splicedIcon = globalScene.add
|
||||||
splicedIcon.setScale(0.5);
|
.image(0, 0, "icon_spliced")
|
||||||
splicedIcon.setOrigin(0, 0);
|
.setScale(0.5)
|
||||||
if (this.slotIndex >= battlerCount) {
|
.setOrigin(0)
|
||||||
splicedIcon.setPositionRelative(slotLevelLabel, 36 + (genderSymbol ? 8 : 0), 0.5);
|
.setPositionRelative(
|
||||||
} else {
|
slotLevelLabel,
|
||||||
splicedIcon.setPositionRelative(this.slotName, 76, 3.5);
|
magicNumbers.splicedIconToLevelLabelOffset.x,
|
||||||
}
|
magicNumbers.splicedIconToLevelLabelOffset.y,
|
||||||
|
);
|
||||||
slotInfoContainer.add(splicedIcon);
|
slotInfoContainer.add(splicedIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.pokemon.status) {
|
if (this.pokemon.status) {
|
||||||
const statusIndicator = globalScene.add.sprite(0, 0, getLocalizedSpriteKey("statuses"));
|
const statusIndicator = globalScene.add
|
||||||
statusIndicator.setFrame(StatusEffect[this.pokemon.status?.effect].toLowerCase());
|
.sprite(0, 0, getLocalizedSpriteKey("statuses"))
|
||||||
statusIndicator.setOrigin(0, 0);
|
.setFrame(StatusEffect[this.pokemon.status?.effect].toLowerCase())
|
||||||
statusIndicator.setPositionRelative(slotLevelLabel, this.slotIndex >= battlerCount ? 43 : 55, 0);
|
.setOrigin(0)
|
||||||
|
.setPositionRelative(
|
||||||
|
slotLevelLabel,
|
||||||
|
magicNumbers.statusIconToLevelLabelOffset.x,
|
||||||
|
magicNumbers.statusIconToLevelLabelOffset.y,
|
||||||
|
);
|
||||||
slotInfoContainer.add(statusIndicator);
|
slotInfoContainer.add(statusIndicator);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.pokemon.isShiny()) {
|
if (this.pokemon.isShiny()) {
|
||||||
const doubleShiny = this.pokemon.isDoubleShiny(false);
|
const doubleShiny = this.pokemon.isDoubleShiny(false);
|
||||||
|
|
||||||
const shinyStar = globalScene.add.image(0, 0, `shiny_star_small${doubleShiny ? "_1" : ""}`);
|
const shinyStar = globalScene.add
|
||||||
shinyStar.setOrigin(0, 0);
|
.image(0, 0, `shiny_star_small${doubleShiny ? "_1" : ""}`)
|
||||||
shinyStar.setPositionRelative(this.slotName, -9, 3);
|
.setOrigin(0)
|
||||||
shinyStar.setTint(getVariantTint(this.pokemon.getBaseVariant()));
|
.setPositionRelative(this.slotName, magicNumbers.shinyIconToNameOffset.x, magicNumbers.shinyIconToNameOffset.y)
|
||||||
|
.setTint(getVariantTint(this.pokemon.getBaseVariant()));
|
||||||
slotInfoContainer.add(shinyStar);
|
slotInfoContainer.add(shinyStar);
|
||||||
|
|
||||||
if (doubleShiny) {
|
if (doubleShiny) {
|
||||||
@ -1973,50 +2024,42 @@ class PartySlot extends Phaser.GameObjects.Container {
|
|||||||
.setOrigin(0)
|
.setOrigin(0)
|
||||||
.setPosition(shinyStar.x, shinyStar.y)
|
.setPosition(shinyStar.x, shinyStar.y)
|
||||||
.setTint(getVariantTint(this.pokemon.fusionVariant));
|
.setTint(getVariantTint(this.pokemon.fusionVariant));
|
||||||
|
|
||||||
slotInfoContainer.add(fusionShinyStar);
|
slotInfoContainer.add(fusionShinyStar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.slotHpBar = globalScene.add.image(0, 0, "party_slot_hp_bar");
|
this.slotHpBar = globalScene.add
|
||||||
this.slotHpBar.setPositionRelative(
|
.image(0, 0, "party_slot_hp_bar")
|
||||||
slotBg,
|
.setOrigin(0)
|
||||||
this.slotIndex >= battlerCount ? 72 : 8,
|
.setVisible(false)
|
||||||
this.slotIndex >= battlerCount ? 6 : 31,
|
.setPositionRelative(this.slotBg, magicNumbers.hpBarPosition.x, magicNumbers.hpBarPosition.y);
|
||||||
);
|
|
||||||
this.slotHpBar.setOrigin(0, 0);
|
|
||||||
this.slotHpBar.setVisible(false);
|
|
||||||
|
|
||||||
const hpRatio = this.pokemon.getHpRatio();
|
const hpRatio = this.pokemon.getHpRatio();
|
||||||
|
|
||||||
this.slotHpOverlay = globalScene.add.sprite(
|
this.slotHpOverlay = globalScene.add
|
||||||
0,
|
.sprite(0, 0, "party_slot_hp_overlay", hpRatio > 0.5 ? "high" : hpRatio > 0.25 ? "medium" : "low")
|
||||||
0,
|
.setOrigin(0)
|
||||||
"party_slot_hp_overlay",
|
.setPositionRelative(this.slotHpBar, magicNumbers.hpOverlayToBarOffset.x, magicNumbers.hpOverlayToBarOffset.y)
|
||||||
hpRatio > 0.5 ? "high" : hpRatio > 0.25 ? "medium" : "low",
|
.setScale(hpRatio, 1)
|
||||||
);
|
.setVisible(false);
|
||||||
this.slotHpOverlay.setPositionRelative(this.slotHpBar, 16, 2);
|
|
||||||
this.slotHpOverlay.setOrigin(0, 0);
|
|
||||||
this.slotHpOverlay.setScale(hpRatio, 1);
|
|
||||||
this.slotHpOverlay.setVisible(false);
|
|
||||||
|
|
||||||
this.slotHpText = addTextObject(0, 0, `${this.pokemon.hp}/${this.pokemon.getMaxHp()}`, TextStyle.PARTY);
|
this.slotHpText = addTextObject(0, 0, `${this.pokemon.hp}/${this.pokemon.getMaxHp()}`, TextStyle.PARTY)
|
||||||
this.slotHpText.setPositionRelative(
|
.setOrigin(1, 0)
|
||||||
|
.setPositionRelative(
|
||||||
this.slotHpBar,
|
this.slotHpBar,
|
||||||
this.slotHpBar.width - 3,
|
this.slotHpBar.width + magicNumbers.hpTextToBarOffset.x,
|
||||||
this.slotHpBar.height - 2 + (offsetJa ? 2 : 0),
|
this.slotHpBar.height + magicNumbers.hpTextToBarOffset.y,
|
||||||
);
|
) // TODO: annoying because it contains the width
|
||||||
this.slotHpText.setOrigin(1, 0);
|
.setVisible(false);
|
||||||
this.slotHpText.setVisible(false);
|
|
||||||
|
|
||||||
this.slotDescriptionLabel = addTextObject(0, 0, "", TextStyle.MESSAGE);
|
this.slotDescriptionLabel = addTextObject(0, 0, "", TextStyle.MESSAGE)
|
||||||
this.slotDescriptionLabel.setPositionRelative(
|
.setOrigin(0, 1)
|
||||||
slotBg,
|
.setVisible(false)
|
||||||
this.slotIndex >= battlerCount ? 94 : 32,
|
.setPositionRelative(
|
||||||
this.slotIndex >= battlerCount ? 16 : 46,
|
this.slotBg,
|
||||||
|
magicNumbers.descriptionLabelPosition.x,
|
||||||
|
magicNumbers.descriptionLabelPosition.y,
|
||||||
);
|
);
|
||||||
this.slotDescriptionLabel.setOrigin(0, 1);
|
|
||||||
this.slotDescriptionLabel.setVisible(false);
|
|
||||||
|
|
||||||
slotInfoContainer.add([this.slotHpBar, this.slotHpOverlay, this.slotHpText, this.slotDescriptionLabel]);
|
slotInfoContainer.add([this.slotHpBar, this.slotHpOverlay, this.slotHpText, this.slotDescriptionLabel]);
|
||||||
|
|
||||||
@ -2078,10 +2121,9 @@ class PartySlot extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private updateSlotTexture(): void {
|
private updateSlotTexture(): void {
|
||||||
const battlerCount = globalScene.currentBattle.getBattlerCount();
|
|
||||||
this.slotBg.setTexture(
|
this.slotBg.setTexture(
|
||||||
`party_slot${this.slotIndex >= battlerCount ? "" : "_main"}`,
|
this.slotBgKey,
|
||||||
`party_slot${this.slotIndex >= battlerCount ? "" : "_main"}${this.transfer ? "_swap" : this.pokemon.hp ? "" : "_fnt"}${this.selected ? "_sel" : ""}`,
|
`${this.slotBgKey}${this.transfer ? "_swap" : this.pokemon.hp ? "" : "_fnt"}${this.selected ? "_sel" : ""}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2200,10 +2242,6 @@ class PartyDiscardModeButton extends Phaser.GameObjects.Container {
|
|||||||
this.discardIcon.setVisible(false);
|
this.discardIcon.setVisible(false);
|
||||||
this.textBox.setVisible(true);
|
this.textBox.setVisible(true);
|
||||||
this.textBox.setText(i18next.t("partyUiHandler:TRANSFER"));
|
this.textBox.setText(i18next.t("partyUiHandler:TRANSFER"));
|
||||||
this.setPosition(
|
|
||||||
globalScene.currentBattle.double ? 64 : 60,
|
|
||||||
globalScene.currentBattle.double ? -48 : -globalScene.game.canvas.height / 15 - 1,
|
|
||||||
);
|
|
||||||
this.transferIcon.displayWidth = this.textBox.text.length * 9 + 3;
|
this.transferIcon.displayWidth = this.textBox.text.length * 9 + 3;
|
||||||
break;
|
break;
|
||||||
case PartyUiMode.DISCARD:
|
case PartyUiMode.DISCARD:
|
||||||
@ -2211,13 +2249,13 @@ class PartyDiscardModeButton extends Phaser.GameObjects.Container {
|
|||||||
this.discardIcon.setVisible(true);
|
this.discardIcon.setVisible(true);
|
||||||
this.textBox.setVisible(true);
|
this.textBox.setVisible(true);
|
||||||
this.textBox.setText(i18next.t("partyUiHandler:DISCARD"));
|
this.textBox.setText(i18next.t("partyUiHandler:DISCARD"));
|
||||||
this.setPosition(
|
|
||||||
globalScene.currentBattle.double ? 64 : 60,
|
|
||||||
globalScene.currentBattle.double ? -48 : -globalScene.game.canvas.height / 15 - 1,
|
|
||||||
);
|
|
||||||
this.discardIcon.displayWidth = this.textBox.text.length * 9 + 3;
|
this.discardIcon.displayWidth = this.textBox.text.length * 9 + 3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
this.setPosition(
|
||||||
|
globalScene.currentBattle.double ? DISCARD_BUTTON_X_DOUBLES : DISCARD_BUTTON_X,
|
||||||
|
globalScene.currentBattle.double ? DISCARD_BUTTON_Y_DOUBLES : DISCARD_BUTTON_Y,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
clear() {
|
clear() {
|
||||||
|
Loading…
Reference in New Issue
Block a user