mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-03-07 02:17:47 +00:00
Updated to make tests work
This commit is contained in:
parent
9d8703bd56
commit
c62ddc2fe5
src
modifier
test/mystery-encounter/encounters
ui
@ -168,10 +168,10 @@ export interface GeneratedPersistentModifierType {
|
||||
|
||||
export class AddPokeballModifierType extends ModifierType {
|
||||
private pokeballType: PokeballType;
|
||||
private count: integer;
|
||||
private scene: BattleScene;
|
||||
private count: number;
|
||||
private currentAmount: number;
|
||||
|
||||
constructor(iconImage: string, pokeballType: PokeballType, count: integer) {
|
||||
constructor(iconImage: string, pokeballType: PokeballType, count: number) {
|
||||
super("", iconImage, (_type, _args) => new Modifiers.AddPokeballModifier(this, pokeballType, count), "pb", "se/pb_bounce_1");
|
||||
this.pokeballType = pokeballType;
|
||||
this.count = count;
|
||||
@ -181,12 +181,16 @@ export class AddPokeballModifierType extends ModifierType {
|
||||
return i18next.t("modifierType:ModifierType.AddPokeballModifierType.name", {
|
||||
"modifierCount": this.count,
|
||||
"pokeballName": getPokeballName(this.pokeballType),
|
||||
"pokeballAmount": `${this.scene.pokeballCounts[this.pokeballType]}`,
|
||||
"pokeballAmount": `${this.currentAmount}`,
|
||||
});
|
||||
}
|
||||
|
||||
addScene(scene: BattleScene) {
|
||||
this.scene = scene;
|
||||
addAmount(currentAmount: number) {
|
||||
this.currentAmount = currentAmount;
|
||||
}
|
||||
|
||||
getPokeballType(): PokeballType {
|
||||
return this.pokeballType as PokeballType;
|
||||
}
|
||||
|
||||
getDescription(scene: BattleScene): string {
|
||||
@ -2153,13 +2157,13 @@ function getModifierTypeOptionWithRetry(existingOptions: ModifierTypeOption[], r
|
||||
allowLuckUpgrades = allowLuckUpgrades ?? true;
|
||||
let candidate = getNewModifierTypeOption(party, ModifierPoolType.PLAYER, tier, undefined, 0, allowLuckUpgrades);
|
||||
if (candidate?.type instanceof AddPokeballModifierType) {
|
||||
candidate.type.addScene(party[0].scene);
|
||||
candidate.type.addAmount(party[0].scene.pokeballCounts[candidate.type.getPokeballType()]);
|
||||
}
|
||||
let r = 0;
|
||||
while (existingOptions.length && ++r < retryCount && existingOptions.filter(o => o.type.name === candidate?.type.name || o.type.group === candidate?.type.group).length) {
|
||||
candidate = getNewModifierTypeOption(party, ModifierPoolType.PLAYER, candidate?.type.tier ?? tier, candidate?.upgradeCount, 0, allowLuckUpgrades);
|
||||
if (candidate?.type instanceof AddPokeballModifierType) {
|
||||
candidate.type.addScene(party[0].scene);
|
||||
candidate.type.addAmount(party[0].scene.pokeballCounts[candidate.type.getPokeballType()]);
|
||||
}
|
||||
}
|
||||
return candidate!;
|
||||
|
@ -214,7 +214,7 @@ describe("Field Trip - Mystery Encounter", () => {
|
||||
expect(modifierSelectHandler.options.length).toEqual(5);
|
||||
expect(modifierSelectHandler.options[0].modifierTypeOption.type.name).toBe("X Accuracy");
|
||||
expect(modifierSelectHandler.options[1].modifierTypeOption.type.name).toBe("X Speed");
|
||||
expect(modifierSelectHandler.options[2].modifierTypeOption.type.name).toBe("5x Great Ball");
|
||||
expect(modifierSelectHandler.options[2].modifierTypeOption.type.name).toBe("Great Ball x5\nInventory: 0");
|
||||
expect(modifierSelectHandler.options[3].modifierTypeOption.type.name).toBe("IV Scanner");
|
||||
expect(modifierSelectHandler.options[4].modifierTypeOption.type.name).toBe("Rarer Candy");
|
||||
});
|
||||
|
@ -678,7 +678,7 @@ class ModifierOption extends Phaser.GameObjects.Container {
|
||||
}
|
||||
|
||||
if (this.modifierTypeOption.type instanceof AddPokeballModifierType) {
|
||||
this.modifierTypeOption.type.addScene(this.scene as BattleScene);
|
||||
this.modifierTypeOption.type.addAmount((this.scene as BattleScene).pokeballCounts[this.modifierTypeOption.type.getPokeballType()]);
|
||||
}
|
||||
|
||||
this.itemText = addTextObject(this.scene, 0, 35, this.modifierTypeOption.type?.name!, TextStyle.PARTY, { align: "center" }); // TODO: is this bang correct?
|
||||
|
Loading…
x
Reference in New Issue
Block a user