mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 00:52:47 +02:00
Merge branch 'beta' into terrain-fail-msg
This commit is contained in:
commit
83efdda0a1
@ -78,10 +78,15 @@ export class FaintPhase extends PokemonPhase {
|
||||
}
|
||||
}
|
||||
|
||||
/** In case the current pokemon was just switched in, make sure it is counted as participating in the combat */
|
||||
/**
|
||||
* In case the current pokemon was just switched in, make sure it is counted as participating in the combat.
|
||||
* For EXP_SHARE purposes, if the current pokemon faints as the combat ends and it was the ONLY player pokemon
|
||||
* involved in combat, it needs to be counted as a participant so the other party pokemon can get their EXP,
|
||||
* so the fainted pokemon has been included.
|
||||
*/
|
||||
for (const pokemon of globalScene.getPlayerField()) {
|
||||
if (pokemon?.isActive(true) && pokemon.isPlayer()) {
|
||||
globalScene.currentBattle.addParticipant(pokemon as PlayerPokemon);
|
||||
if (pokemon?.isActive() || pokemon?.isFainted()) {
|
||||
globalScene.currentBattle.addParticipant(pokemon);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import { truncateString } from "../../utils/common";
|
||||
import { Button } from "#enums/buttons";
|
||||
import { SettingKeyboard } from "#app/system/settings/settings-keyboard";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import i18next from "i18next";
|
||||
|
||||
export enum SettingGamepad {
|
||||
Controller = "CONTROLLER",
|
||||
@ -27,11 +28,11 @@ export enum SettingGamepad {
|
||||
Button_Submit = "BUTTON_SUBMIT",
|
||||
}
|
||||
|
||||
const pressAction = "Press action to assign";
|
||||
const pressAction = i18next.t("settings:pressActionToAssign");
|
||||
|
||||
export const settingGamepadOptions = {
|
||||
[SettingGamepad.Controller]: ["Default", "Change"],
|
||||
[SettingGamepad.Gamepad_Support]: ["Auto", "Disabled"],
|
||||
[SettingGamepad.Controller]: [i18next.t("settings:controllerDefault"), i18next.t("settings:controllerChange")],
|
||||
[SettingGamepad.Gamepad_Support]: [i18next.t("settings:gamepadSupportAuto"), i18next.t("settings:gamepadSupportDisabled")],
|
||||
[SettingGamepad.Button_Up]: [`KEY ${Button.UP.toString()}`, pressAction],
|
||||
[SettingGamepad.Button_Down]: [`KEY ${Button.DOWN.toString()}`, pressAction],
|
||||
[SettingGamepad.Button_Left]: [`KEY ${Button.LEFT.toString()}`, pressAction],
|
||||
@ -140,7 +141,7 @@ export function setSettingGamepad(setting: SettingGamepad, value: number): boole
|
||||
handler: () => changeGamepadHandler(g),
|
||||
})),
|
||||
{
|
||||
label: "Cancel",
|
||||
label: i18next.t("settings:cancelContollerChoice"),
|
||||
handler: cancelHandler,
|
||||
},
|
||||
],
|
||||
|
@ -108,7 +108,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
||||
let pokemonIconX = -20;
|
||||
let pokemonIconY = 6;
|
||||
|
||||
if (["de", "es-ES", "es-MX", "fr", "ko", "pt-BR"].includes(currentLanguage)) {
|
||||
if (["de", "es-ES", "es-MX", "fr", "ko", "pt-BR", "ru"].includes(currentLanguage)) {
|
||||
gachaTextStyle = TextStyle.SMALLER_WINDOW_ALT;
|
||||
gachaX = 2;
|
||||
gachaY = 2;
|
||||
@ -150,7 +150,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
||||
gachaInfoContainer.add(pokemonIcon);
|
||||
break;
|
||||
case GachaType.MOVE:
|
||||
if (["de", "es-ES", "fr", "pt-BR"].includes(currentLanguage)) {
|
||||
if (["de", "es-ES", "fr", "pt-BR", "ru"].includes(currentLanguage)) {
|
||||
gachaUpLabel.setAlign("center");
|
||||
gachaUpLabel.setY(0);
|
||||
}
|
||||
@ -160,7 +160,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
||||
gachaUpLabel.setOrigin(0.5, 0);
|
||||
break;
|
||||
case GachaType.SHINY:
|
||||
if (["de", "fr", "ko"].includes(currentLanguage)) {
|
||||
if (["de", "fr", "ko", "ru"].includes(currentLanguage)) {
|
||||
gachaUpLabel.setAlign("center");
|
||||
gachaUpLabel.setY(0);
|
||||
}
|
||||
@ -206,7 +206,17 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
||||
this.eggGachaOptionsContainer = globalScene.add.container(globalScene.game.canvas.width / 6, 148);
|
||||
this.eggGachaContainer.add(this.eggGachaOptionsContainer);
|
||||
|
||||
this.eggGachaOptionSelectBg = addWindow(0, 0, 96, 16 + 576 * this.scale);
|
||||
// Increase egg box width on certain languages
|
||||
let eggGachaOptionSelectWidth = 0;
|
||||
switch (i18next.resolvedLanguage) {
|
||||
case "ru":
|
||||
eggGachaOptionSelectWidth = 100;
|
||||
break;
|
||||
default:
|
||||
eggGachaOptionSelectWidth = 96;
|
||||
}
|
||||
|
||||
this.eggGachaOptionSelectBg = addWindow(0, 0, eggGachaOptionSelectWidth, 16 + 576 * this.scale);
|
||||
this.eggGachaOptionSelectBg.setOrigin(1, 1);
|
||||
this.eggGachaOptionsContainer.add(this.eggGachaOptionSelectBg);
|
||||
|
||||
|
@ -35,81 +35,70 @@ export default class EggListUiHandler extends MessageUiHandler {
|
||||
setup() {
|
||||
const ui = this.getUi();
|
||||
|
||||
this.eggListContainer = globalScene.add.container(0, -globalScene.game.canvas.height / 6);
|
||||
this.eggListContainer.setVisible(false);
|
||||
this.eggListContainer = globalScene.add.container(0, -globalScene.game.canvas.height / 6).setVisible(false);
|
||||
ui.add(this.eggListContainer);
|
||||
|
||||
const bgColor = globalScene.add.rectangle(
|
||||
0,
|
||||
0,
|
||||
globalScene.game.canvas.width / 6,
|
||||
globalScene.game.canvas.height / 6,
|
||||
0x006860,
|
||||
);
|
||||
bgColor.setOrigin(0, 0);
|
||||
this.eggListContainer.add(bgColor);
|
||||
const bgColor = globalScene.add
|
||||
.rectangle(0, 0, globalScene.game.canvas.width / 6, globalScene.game.canvas.height / 6, 0x006860)
|
||||
.setOrigin(0);
|
||||
|
||||
const eggListBg = globalScene.add.image(0, 0, "egg_list_bg");
|
||||
eggListBg.setOrigin(0, 0);
|
||||
this.eggListContainer.add(eggListBg);
|
||||
|
||||
this.eggListContainer.add(addWindow(1, 85, 106, 22));
|
||||
this.eggListContainer.add(addWindow(1, 102, 106, 50, true));
|
||||
this.eggListContainer.add(addWindow(1, 147, 106, 32, true));
|
||||
this.eggListContainer.add(addWindow(107, 1, 212, 178));
|
||||
const eggListBg = globalScene.add.image(0, 0, "egg_list_bg").setOrigin(0);
|
||||
|
||||
this.iconAnimHandler = new PokemonIconAnimHandler();
|
||||
this.iconAnimHandler.setup();
|
||||
|
||||
this.eggNameText = addTextObject(8, 68, "", TextStyle.SUMMARY);
|
||||
this.eggNameText.setOrigin(0, 0);
|
||||
this.eggListContainer.add(this.eggNameText);
|
||||
this.eggNameText = addTextObject(8, 68, "", TextStyle.SUMMARY).setOrigin(0);
|
||||
|
||||
this.eggDateText = addTextObject(8, 91, "", TextStyle.TOOLTIP_CONTENT);
|
||||
this.eggListContainer.add(this.eggDateText);
|
||||
|
||||
this.eggHatchWavesText = addTextObject(8, 108, "", TextStyle.TOOLTIP_CONTENT);
|
||||
this.eggHatchWavesText.setWordWrapWidth(540);
|
||||
this.eggListContainer.add(this.eggHatchWavesText);
|
||||
this.eggHatchWavesText = addTextObject(8, 108, "", TextStyle.TOOLTIP_CONTENT).setWordWrapWidth(540);
|
||||
|
||||
this.eggGachaInfoText = addTextObject(8, 152, "", TextStyle.TOOLTIP_CONTENT);
|
||||
this.eggGachaInfoText.setWordWrapWidth(540);
|
||||
this.eggListContainer.add(this.eggGachaInfoText);
|
||||
this.eggGachaInfoText = addTextObject(8, 152, "", TextStyle.TOOLTIP_CONTENT).setWordWrapWidth(540);
|
||||
|
||||
this.eggListIconContainer = globalScene.add.container(113, 5);
|
||||
this.eggListContainer.add(this.eggListIconContainer);
|
||||
|
||||
this.cursorObj = globalScene.add.image(0, 0, "select_cursor");
|
||||
this.cursorObj.setOrigin(0, 0);
|
||||
this.eggListContainer.add(this.cursorObj);
|
||||
this.cursorObj = globalScene.add.image(0, 0, "select_cursor").setOrigin(0);
|
||||
|
||||
this.eggSprite = globalScene.add.sprite(54, 37, "egg");
|
||||
this.eggListContainer.add(this.eggSprite);
|
||||
|
||||
const scrollBar = new ScrollBar(310, 5, 4, 170, this.ROWS);
|
||||
this.eggListContainer.add(scrollBar);
|
||||
|
||||
this.scrollGridHandler = new ScrollableGridUiHandler(this, this.ROWS, this.COLUMNS)
|
||||
.withScrollBar(scrollBar)
|
||||
.withUpdateGridCallBack(() => this.updateEggIcons())
|
||||
.withUpdateSingleElementCallback((i: number) => this.setEggDetails(i));
|
||||
|
||||
this.eggListMessageBoxContainer = globalScene.add.container(0, globalScene.game.canvas.height / 6);
|
||||
this.eggListMessageBoxContainer.setVisible(false);
|
||||
this.eggListContainer.add(this.eggListMessageBoxContainer);
|
||||
this.eggListMessageBoxContainer = globalScene.add
|
||||
.container(0, globalScene.game.canvas.height / 6)
|
||||
.setVisible(false);
|
||||
|
||||
const eggListMessageBox = addWindow(1, -1, 318, 28);
|
||||
eggListMessageBox.setOrigin(0, 1);
|
||||
const eggListMessageBox = addWindow(1, -1, 318, 28).setOrigin(0, 1);
|
||||
this.eggListMessageBoxContainer.add(eggListMessageBox);
|
||||
|
||||
this.message = addTextObject(8, -8, "", TextStyle.WINDOW, { maxLines: 1 });
|
||||
this.message.setOrigin(0, 1);
|
||||
this.eggListMessageBoxContainer.add(this.message);
|
||||
// Message isn't used, but is expected to exist as this subclasses MessageUiHandler
|
||||
this.message = addTextObject(8, -8, "", TextStyle.WINDOW, { maxLines: 1 }).setActive(false).setVisible(false);
|
||||
|
||||
this.cursor = -1;
|
||||
|
||||
this.eggListContainer.add([
|
||||
bgColor,
|
||||
eggListBg,
|
||||
addWindow(1, 85, 106, 22),
|
||||
addWindow(1, 102, 106, 50, true),
|
||||
addWindow(1, 147, 106, 32, true),
|
||||
addWindow(107, 1, 212, 178),
|
||||
this.eggNameText,
|
||||
this.eggDateText,
|
||||
this.eggHatchWavesText,
|
||||
this.eggGachaInfoText,
|
||||
this.eggListIconContainer,
|
||||
this.cursorObj,
|
||||
this.eggSprite,
|
||||
scrollBar,
|
||||
]);
|
||||
}
|
||||
|
||||
show(args: any[]): boolean {
|
||||
override show(args: any[]): boolean {
|
||||
super.show(args);
|
||||
|
||||
this.initEggIcons();
|
||||
@ -134,9 +123,10 @@ export default class EggListUiHandler extends MessageUiHandler {
|
||||
for (let i = 0; i < Math.min(this.ROWS * this.COLUMNS, globalScene.gameData.eggs.length); i++) {
|
||||
const x = (i % this.COLUMNS) * 18;
|
||||
const y = Math.floor(i / this.COLUMNS) * 18;
|
||||
const icon = globalScene.add.sprite(x - 2, y + 2, "egg_icons");
|
||||
icon.setScale(0.5);
|
||||
icon.setOrigin(0, 0);
|
||||
const icon = globalScene.add
|
||||
.sprite(x - 2, y + 2, "egg_icons")
|
||||
.setScale(0.5)
|
||||
.setOrigin(0);
|
||||
this.eggListIconContainer.add(icon);
|
||||
this.eggIcons.push(icon);
|
||||
}
|
||||
@ -148,15 +138,13 @@ export default class EggListUiHandler extends MessageUiHandler {
|
||||
private updateEggIcons() {
|
||||
const indexOffset = this.scrollGridHandler.getItemOffset();
|
||||
const eggsToShow = Math.min(this.eggIcons.length, globalScene.gameData.eggs.length - indexOffset);
|
||||
|
||||
this.eggIcons.forEach((icon, i) => {
|
||||
if (i !== this.cursor) {
|
||||
this.iconAnimHandler.addOrUpdate(icon, PokemonIconAnimMode.NONE);
|
||||
}
|
||||
if (i < eggsToShow) {
|
||||
const egg = globalScene.gameData.eggs[i + indexOffset];
|
||||
icon.setFrame(egg.getKey());
|
||||
icon.setVisible(true);
|
||||
icon.setFrame(egg.getKey()).setVisible(true);
|
||||
} else {
|
||||
icon.setVisible(false);
|
||||
}
|
||||
@ -187,7 +175,6 @@ export default class EggListUiHandler extends MessageUiHandler {
|
||||
const ui = this.getUi();
|
||||
|
||||
let success = false;
|
||||
const error = false;
|
||||
|
||||
if (button === Button.CANCEL) {
|
||||
ui.revertMode();
|
||||
@ -198,11 +185,9 @@ export default class EggListUiHandler extends MessageUiHandler {
|
||||
|
||||
if (success) {
|
||||
ui.playSelect();
|
||||
} else if (error) {
|
||||
ui.playError();
|
||||
}
|
||||
|
||||
return success || error;
|
||||
return success;
|
||||
}
|
||||
|
||||
setCursor(cursor: number): boolean {
|
||||
|
@ -108,10 +108,12 @@ export default class AbstractSettingsUiHandler extends MessageUiHandler {
|
||||
|
||||
this.reloadSettings = this.settings.filter(s => s?.requireReload);
|
||||
|
||||
let anyReloadRequired = false;
|
||||
this.settings.forEach((setting, s) => {
|
||||
let settingName = setting.label;
|
||||
if (setting?.requireReload) {
|
||||
settingName += ` (${i18next.t("settings:requireReload")})`;
|
||||
settingName += "*";
|
||||
anyReloadRequired = true;
|
||||
}
|
||||
|
||||
this.settingLabels[s] = addTextObject(8, 28 + s * 16, settingName, TextStyle.SETTINGS_LABEL);
|
||||
@ -187,6 +189,14 @@ export default class AbstractSettingsUiHandler extends MessageUiHandler {
|
||||
this.settingsContainer.add(iconAction);
|
||||
this.settingsContainer.add(iconCancel);
|
||||
this.settingsContainer.add(actionText);
|
||||
// Only add the ReloadRequired text on pages that have settings that require a reload.
|
||||
if (anyReloadRequired) {
|
||||
const reloadRequired = addTextObject(0, 0, `*${i18next.t("settings:requireReload")}`, TextStyle.SETTINGS_LABEL)
|
||||
.setOrigin(0, 0.15)
|
||||
.setPositionRelative(actionsBg, 6, 0)
|
||||
.setY(actionText.y);
|
||||
this.settingsContainer.add(reloadRequired);
|
||||
}
|
||||
this.settingsContainer.add(cancelText);
|
||||
this.settingsContainer.add(this.messageBoxContainer);
|
||||
|
||||
|
@ -4,6 +4,7 @@ import { Device } from "#enums/devices";
|
||||
import { getIconWithSettingName, getKeyWithKeycode } from "#app/configs/inputs/configHandler";
|
||||
import { addTextObject, TextStyle } from "#app/ui/text";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import i18next from "i18next";
|
||||
|
||||
export default class GamepadBindingUiHandler extends AbstractBindingUiHandler {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
@ -19,7 +20,7 @@ export default class GamepadBindingUiHandler extends AbstractBindingUiHandler {
|
||||
this.newButtonIcon.setOrigin(0.5);
|
||||
this.newButtonIcon.setVisible(false);
|
||||
|
||||
this.swapText = addTextObject(0, 0, "will swap with", TextStyle.WINDOW);
|
||||
this.swapText = addTextObject(0, 0, i18next.t("settings:willSwapWith"), TextStyle.WINDOW);
|
||||
this.swapText.setOrigin(0.5);
|
||||
this.swapText.setPositionRelative(
|
||||
this.optionSelectBg,
|
||||
@ -33,7 +34,7 @@ export default class GamepadBindingUiHandler extends AbstractBindingUiHandler {
|
||||
this.targetButtonIcon.setOrigin(0.5);
|
||||
this.targetButtonIcon.setVisible(false);
|
||||
|
||||
this.actionLabel = addTextObject(0, 0, "Confirm swap", TextStyle.SETTINGS_LABEL);
|
||||
this.actionLabel = addTextObject(0, 0, i18next.t("settings:confirmSwap"), TextStyle.SETTINGS_LABEL);
|
||||
this.actionLabel.setOrigin(0, 0.5);
|
||||
this.actionLabel.setPositionRelative(this.actionBg, this.actionBg.width - 75, this.actionBg.height / 2);
|
||||
this.actionsContainer.add(this.actionLabel);
|
||||
|
@ -4,6 +4,7 @@ import { getKeyWithKeycode } from "#app/configs/inputs/configHandler";
|
||||
import { Device } from "#enums/devices";
|
||||
import { addTextObject, TextStyle } from "#app/ui/text";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import i18next from "i18next";
|
||||
|
||||
export default class KeyboardBindingUiHandler extends AbstractBindingUiHandler {
|
||||
constructor(mode: UiMode | null = null) {
|
||||
@ -21,7 +22,7 @@ export default class KeyboardBindingUiHandler extends AbstractBindingUiHandler {
|
||||
this.newButtonIcon.setOrigin(0.5);
|
||||
this.newButtonIcon.setVisible(false);
|
||||
|
||||
this.actionLabel = addTextObject(0, 0, "Assign button", TextStyle.SETTINGS_LABEL);
|
||||
this.actionLabel = addTextObject(0, 0, i18next.t("settings:assignButton"), TextStyle.SETTINGS_LABEL);
|
||||
this.actionLabel.setOrigin(0, 0.5);
|
||||
this.actionLabel.setPositionRelative(this.actionBg, this.actionBg.width - 80, this.actionBg.height / 2);
|
||||
this.actionsContainer.add(this.actionLabel);
|
||||
|
Loading…
Reference in New Issue
Block a user