mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-12-11 08:07:15 +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": {
|
||||
"AddPokeballModifierType": {
|
||||
"name": "{{modifierCount}}x {{pokeballName}}",
|
||||
"description": "Receive {{pokeballName}} x{{modifierCount}} (Inventory: {{pokeballAmount}}) \nCatch Rate: {{catchRate}}",
|
||||
"catchRateGenerator": "{{normalCatchRate}}x ({{boostedCatchRate}}x for uncaught Pokémon)"
|
||||
"name": "Receive {{pokeballName}} x{{modifierCount}}\nInventory: {{pokeballAmount}}",
|
||||
"description": "Catch Rate: {{catchRate}}",
|
||||
"catchRateGenerator": "{{normalCatchRate}}x ({{boostedCatchRate}}x if Pokémon has new gender, variant, form, or ability)"
|
||||
},
|
||||
"AddVoucherModifierType": {
|
||||
"name": "{{modifierCount}}x {{voucherTypeName}}",
|
||||
|
@ -163,9 +163,10 @@ export interface GeneratedPersistentModifierType {
|
||||
getPregenArgs(): any[];
|
||||
}
|
||||
|
||||
class AddPokeballModifierType extends ModifierType {
|
||||
export class AddPokeballModifierType extends ModifierType {
|
||||
private pokeballType: PokeballType;
|
||||
private count: integer;
|
||||
private scene: BattleScene;
|
||||
|
||||
constructor(iconImage: string, pokeballType: PokeballType, count: integer) {
|
||||
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", {
|
||||
"modifierCount": this.count,
|
||||
"pokeballName": getPokeballName(this.pokeballType),
|
||||
"pokeballAmount": `${this.scene.pokeballCounts[this.pokeballType]}`,
|
||||
});
|
||||
}
|
||||
|
||||
addScene(scene: BattleScene) {
|
||||
this.scene = scene;
|
||||
}
|
||||
|
||||
getDescription(scene: BattleScene): string {
|
||||
let catchRate: String = "";
|
||||
if (this.pokeballType === PokeballType.ROGUE_BALL) {
|
||||
@ -194,7 +200,6 @@ class AddPokeballModifierType extends ModifierType {
|
||||
"modifierCount": this.count,
|
||||
"pokeballName": getPokeballName(this.pokeballType),
|
||||
"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);
|
||||
new Array(count).fill(0).map((_, i) => {
|
||||
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;
|
||||
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);
|
||||
if (candidate?.type instanceof AddPokeballModifierType) {
|
||||
candidate.type.addScene(party[0].scene);
|
||||
}
|
||||
}
|
||||
if (candidate) {
|
||||
options.push(candidate);
|
||||
|
@ -1,5 +1,5 @@
|
||||
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 { addTextObject, getTextStyleOptions, getModifierTierTextTint, getTextColor, TextStyle } from "./text";
|
||||
import AwaitableUiHandler from "./awaitable-ui-handler";
|
||||
@ -426,6 +426,7 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
||||
}
|
||||
|
||||
const type = options[this.cursor].modifierTypeOption.type;
|
||||
|
||||
type && ui.showText(type.getDescription(this.scene));
|
||||
if (type instanceof TmModifierType) {
|
||||
// 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);
|
||||
}
|
||||
|
||||
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.setOrigin(0.5, 0);
|
||||
this.itemText.setAlpha(0);
|
||||
|
Loading…
Reference in New Issue
Block a user