mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 00:52:47 +02:00
Merge 5554c491ce
into 4b70fab608
This commit is contained in:
commit
d05aa78c52
@ -218,8 +218,6 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
|||||||
this.updateGachaInfo(g);
|
this.updateGachaInfo(g);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.eggGachaOptionsContainer = globalScene.add.container();
|
|
||||||
|
|
||||||
this.eggGachaOptionsContainer = globalScene.add.container(globalScene.game.canvas.width / 6, 148);
|
this.eggGachaOptionsContainer = globalScene.add.container(globalScene.game.canvas.width / 6, 148);
|
||||||
this.eggGachaContainer.add(this.eggGachaOptionsContainer);
|
this.eggGachaContainer.add(this.eggGachaOptionsContainer);
|
||||||
|
|
||||||
@ -239,6 +237,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
|||||||
|
|
||||||
const multiplierOne = "x1";
|
const multiplierOne = "x1";
|
||||||
const multiplierTen = "x10";
|
const multiplierTen = "x10";
|
||||||
|
const multiplierNone = "";
|
||||||
const pullOptions = [
|
const pullOptions = [
|
||||||
{
|
{
|
||||||
multiplier: multiplierOne,
|
multiplier: multiplierOne,
|
||||||
@ -265,6 +264,11 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
|||||||
description: `25 ${i18next.t("egg:pulls")}`,
|
description: `25 ${i18next.t("egg:pulls")}`,
|
||||||
icon: getVoucherTypeIcon(VoucherType.GOLDEN),
|
icon: getVoucherTypeIcon(VoucherType.GOLDEN),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
multiplier: multiplierNone,
|
||||||
|
description: `${i18next.t("egg:all")}`,
|
||||||
|
icon: getVoucherTypeIcon(VoucherType.GOLDEN),
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const resolvedLanguage = i18next.resolvedLanguage ?? "en";
|
const resolvedLanguage = i18next.resolvedLanguage ?? "en";
|
||||||
@ -283,7 +287,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
|||||||
|
|
||||||
const optionText = addTextObject(0, 0, `${pullOptionsText}\n${i18next.t("menu:cancel")}`, TextStyle.WINDOW);
|
const optionText = addTextObject(0, 0, `${pullOptionsText}\n${i18next.t("menu:cancel")}`, TextStyle.WINDOW);
|
||||||
|
|
||||||
optionText.setLineSpacing(28);
|
optionText.setLineSpacing(13);
|
||||||
optionText.setFontSize("80px");
|
optionText.setFontSize("80px");
|
||||||
|
|
||||||
this.eggGachaOptionsContainer.add(optionText);
|
this.eggGachaOptionsContainer.add(optionText);
|
||||||
@ -293,7 +297,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
|||||||
pullOptions.forEach((option, i) => {
|
pullOptions.forEach((option, i) => {
|
||||||
const icon = globalScene.add.sprite(0, 0, "items", option.icon);
|
const icon = globalScene.add.sprite(0, 0, "items", option.icon);
|
||||||
icon.setScale(3 * this.scale);
|
icon.setScale(3 * this.scale);
|
||||||
icon.setPositionRelative(this.eggGachaOptionSelectBg, 20, 9 + (48 + i * 96) * this.scale);
|
icon.setPositionRelative(this.eggGachaOptionSelectBg, 20, 9 + (48 + i * 81) * this.scale);
|
||||||
this.eggGachaOptionsContainer.add(icon);
|
this.eggGachaOptionsContainer.add(icon);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -550,7 +554,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
|||||||
ease: "Sine.easeOut",
|
ease: "Sine.easeOut",
|
||||||
duration: overlayEaseInDuration,
|
duration: overlayEaseInDuration,
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
const rowItems = 5;
|
const rowItems = Math.max(Math.ceil(eggs.length / 11), 5);
|
||||||
const rows = Math.ceil(eggs.length / rowItems);
|
const rows = Math.ceil(eggs.length / rowItems);
|
||||||
const cols = Math.min(eggs.length, rowItems);
|
const cols = Math.min(eggs.length, rowItems);
|
||||||
const height = this.eggGachaOverlay.displayHeight - this.eggGachaMessageBox.displayHeight;
|
const height = this.eggGachaOverlay.displayHeight - this.eggGachaMessageBox.displayHeight;
|
||||||
@ -788,6 +792,45 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
|
if (
|
||||||
|
!globalScene.gameData.voucherCounts[VoucherType.REGULAR]
|
||||||
|
&& !globalScene.gameData.voucherCounts[VoucherType.PLUS]
|
||||||
|
&& !globalScene.gameData.voucherCounts[VoucherType.PREMIUM]
|
||||||
|
&& !globalScene.gameData.voucherCounts[VoucherType.GOLDEN]
|
||||||
|
&& !Overrides.EGG_FREE_GACHA_PULLS_OVERRIDE
|
||||||
|
) {
|
||||||
|
error = true;
|
||||||
|
this.showError(i18next.t("egg:noVouchers"));
|
||||||
|
} else if (globalScene.gameData.eggs.length < 99 || Overrides.UNLIMITED_EGG_COUNT_OVERRIDE) {
|
||||||
|
let pulls = 0;
|
||||||
|
let eggSpace = 99 - globalScene.gameData.eggs.length;
|
||||||
|
|
||||||
|
if (!Overrides.EGG_FREE_GACHA_PULLS_OVERRIDE) {
|
||||||
|
const voucherTypes = [[ VoucherType.GOLDEN, 25 ], [ VoucherType.PREMIUM, 10 ], [ VoucherType.PLUS, 5 ], [ VoucherType.REGULAR, 1 ]];
|
||||||
|
voucherTypes.forEach(voucherType => {
|
||||||
|
const vouchersUsed = Math.min(globalScene.gameData.voucherCounts[voucherType[0]], Math.floor(eggSpace / voucherType[1]));
|
||||||
|
this.consumeVouchers(voucherType[0], vouchersUsed);
|
||||||
|
const pullsUsed = vouchersUsed * voucherType[1];
|
||||||
|
pulls += pullsUsed;
|
||||||
|
eggSpace -= pullsUsed;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
pulls = eggSpace;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pulls === 0) {
|
||||||
|
error = true;
|
||||||
|
this.showError(i18next.t("egg:vouchersExceedEggCap"));
|
||||||
|
} else {
|
||||||
|
this.pull(pulls);
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
error = true;
|
||||||
|
this.showError(i18next.t("egg:tooManyEggs"));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
ui.revertMode();
|
ui.revertMode();
|
||||||
success = true;
|
success = true;
|
||||||
break;
|
break;
|
||||||
@ -803,7 +846,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Button.DOWN:
|
case Button.DOWN:
|
||||||
if (this.cursor < 5) {
|
if (this.cursor < 6) {
|
||||||
success = this.setCursor(this.cursor + 1);
|
success = this.setCursor(this.cursor + 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -839,7 +882,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.cursorObj.setScale(this.scale * 6);
|
this.cursorObj.setScale(this.scale * 6);
|
||||||
this.cursorObj.setPositionRelative(this.eggGachaOptionSelectBg, 10, 9 + (48 + this.cursor * 96) * this.scale);
|
this.cursorObj.setPositionRelative(this.eggGachaOptionSelectBg, 10, 9 + (48 + this.cursor * 81) * this.scale);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user