mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-12-04 20:56:09 +00:00
Updated the shop to show inventory of pokeballs under pokeball count
This commit is contained in:
parent
df5780236e
commit
55fc310424
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"ModifierType": {
|
"ModifierType": {
|
||||||
"AddPokeballModifierType": {
|
"AddPokeballModifierType": {
|
||||||
"name": "{{modifierCount}}x {{pokeballName}}",
|
"name": "Receive {{pokeballName}} x{{modifierCount}}\nInventory: {{pokeballAmount}}",
|
||||||
"description": "Receive {{pokeballName}} x{{modifierCount}} (Inventory: {{pokeballAmount}}) \nCatch Rate: {{catchRate}}",
|
"description": "Catch Rate: {{catchRate}}",
|
||||||
"catchRateGenerator": "{{normalCatchRate}}x ({{boostedCatchRate}}x for uncaught Pokémon)"
|
"catchRateGenerator": "{{normalCatchRate}}x ({{boostedCatchRate}}x if Pokémon has new gender, variant, form, or ability)"
|
||||||
},
|
},
|
||||||
"AddVoucherModifierType": {
|
"AddVoucherModifierType": {
|
||||||
"name": "{{modifierCount}}x {{voucherTypeName}}",
|
"name": "{{modifierCount}}x {{voucherTypeName}}",
|
||||||
|
@ -163,9 +163,10 @@ export interface GeneratedPersistentModifierType {
|
|||||||
getPregenArgs(): any[];
|
getPregenArgs(): any[];
|
||||||
}
|
}
|
||||||
|
|
||||||
class AddPokeballModifierType extends ModifierType {
|
export class AddPokeballModifierType extends ModifierType {
|
||||||
private pokeballType: PokeballType;
|
private pokeballType: PokeballType;
|
||||||
private count: integer;
|
private count: integer;
|
||||||
|
private scene: BattleScene;
|
||||||
|
|
||||||
constructor(iconImage: string, pokeballType: PokeballType, count: integer) {
|
constructor(iconImage: string, pokeballType: PokeballType, count: integer) {
|
||||||
super("", iconImage, (_type, _args) => new Modifiers.AddPokeballModifier(this, pokeballType, count), "pb", "se/pb_bounce_1");
|
super("", iconImage, (_type, _args) => new Modifiers.AddPokeballModifier(this, pokeballType, count), "pb", "se/pb_bounce_1");
|
||||||
@ -177,9 +178,14 @@ class AddPokeballModifierType extends ModifierType {
|
|||||||
return i18next.t("modifierType:ModifierType.AddPokeballModifierType.name", {
|
return i18next.t("modifierType:ModifierType.AddPokeballModifierType.name", {
|
||||||
"modifierCount": this.count,
|
"modifierCount": this.count,
|
||||||
"pokeballName": getPokeballName(this.pokeballType),
|
"pokeballName": getPokeballName(this.pokeballType),
|
||||||
|
"pokeballAmount": `${this.scene.pokeballCounts[this.pokeballType]}`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addScene(scene: BattleScene) {
|
||||||
|
this.scene = scene;
|
||||||
|
}
|
||||||
|
|
||||||
getDescription(scene: BattleScene): string {
|
getDescription(scene: BattleScene): string {
|
||||||
let catchRate: String = "";
|
let catchRate: String = "";
|
||||||
if (this.pokeballType === PokeballType.ROGUE_BALL) {
|
if (this.pokeballType === PokeballType.ROGUE_BALL) {
|
||||||
@ -194,7 +200,6 @@ class AddPokeballModifierType extends ModifierType {
|
|||||||
"modifierCount": this.count,
|
"modifierCount": this.count,
|
||||||
"pokeballName": getPokeballName(this.pokeballType),
|
"pokeballName": getPokeballName(this.pokeballType),
|
||||||
"catchRate": catchRate,
|
"catchRate": catchRate,
|
||||||
"pokeballAmount": `${scene.pokeballCounts[this.pokeballType]}`,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1982,9 +1987,15 @@ export function getPlayerModifierTypeOptions(count: integer, party: PlayerPokemo
|
|||||||
const retryCount = Math.min(count * 5, 50);
|
const retryCount = Math.min(count * 5, 50);
|
||||||
new Array(count).fill(0).map((_, i) => {
|
new Array(count).fill(0).map((_, i) => {
|
||||||
let candidate = getNewModifierTypeOption(party, ModifierPoolType.PLAYER, modifierTiers && modifierTiers.length > i ? modifierTiers[i] : undefined);
|
let candidate = getNewModifierTypeOption(party, ModifierPoolType.PLAYER, modifierTiers && modifierTiers.length > i ? modifierTiers[i] : undefined);
|
||||||
|
if (candidate?.type instanceof AddPokeballModifierType) {
|
||||||
|
candidate.type.addScene(party[0].scene);
|
||||||
|
}
|
||||||
let r = 0;
|
let r = 0;
|
||||||
while (options.length && ++r < retryCount && options.filter(o => o.type?.name === candidate?.type?.name || o.type?.group === candidate?.type?.group).length) {
|
while (options.length && ++r < retryCount && options.filter(o => o.type?.name === candidate?.type?.name || o.type?.group === candidate?.type?.group).length) {
|
||||||
candidate = getNewModifierTypeOption(party, ModifierPoolType.PLAYER, candidate?.type?.tier, candidate?.upgradeCount);
|
candidate = getNewModifierTypeOption(party, ModifierPoolType.PLAYER, candidate?.type?.tier, candidate?.upgradeCount);
|
||||||
|
if (candidate?.type instanceof AddPokeballModifierType) {
|
||||||
|
candidate.type.addScene(party[0].scene);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (candidate) {
|
if (candidate) {
|
||||||
options.push(candidate);
|
options.push(candidate);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import BattleScene from "../battle-scene";
|
import BattleScene from "../battle-scene";
|
||||||
import { getPlayerShopModifierTypeOptionsForWave, ModifierTypeOption, TmModifierType } from "../modifier/modifier-type";
|
import { getPlayerShopModifierTypeOptionsForWave, ModifierTypeOption, TmModifierType, AddPokeballModifierType } from "../modifier/modifier-type";
|
||||||
import { getPokeballAtlasKey, PokeballType } from "../data/pokeball";
|
import { getPokeballAtlasKey, PokeballType } from "../data/pokeball";
|
||||||
import { addTextObject, getTextStyleOptions, getModifierTierTextTint, getTextColor, TextStyle } from "./text";
|
import { addTextObject, getTextStyleOptions, getModifierTierTextTint, getTextColor, TextStyle } from "./text";
|
||||||
import AwaitableUiHandler from "./awaitable-ui-handler";
|
import AwaitableUiHandler from "./awaitable-ui-handler";
|
||||||
@ -426,6 +426,7 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const type = options[this.cursor].modifierTypeOption.type;
|
const type = options[this.cursor].modifierTypeOption.type;
|
||||||
|
|
||||||
type && ui.showText(type.getDescription(this.scene));
|
type && ui.showText(type.getDescription(this.scene));
|
||||||
if (type instanceof TmModifierType) {
|
if (type instanceof TmModifierType) {
|
||||||
// prepare the move overlay to be shown with the toggle
|
// prepare the move overlay to be shown with the toggle
|
||||||
@ -619,6 +620,10 @@ class ModifierOption extends Phaser.GameObjects.Container {
|
|||||||
this.itemContainer.add(this.itemTint);
|
this.itemContainer.add(this.itemTint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.modifierTypeOption.type instanceof AddPokeballModifierType) {
|
||||||
|
this.modifierTypeOption.type.addScene(this.scene as BattleScene);
|
||||||
|
}
|
||||||
|
|
||||||
this.itemText = addTextObject(this.scene, 0, 35, this.modifierTypeOption.type?.name!, TextStyle.PARTY, { align: "center" }); // TODO: is this bang correct?
|
this.itemText = addTextObject(this.scene, 0, 35, this.modifierTypeOption.type?.name!, TextStyle.PARTY, { align: "center" }); // TODO: is this bang correct?
|
||||||
this.itemText.setOrigin(0.5, 0);
|
this.itemText.setOrigin(0.5, 0);
|
||||||
this.itemText.setAlpha(0);
|
this.itemText.setAlpha(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user