MBE achievement now tracks held items

This commit is contained in:
Wlowscha 2025-06-09 18:56:05 +02:00
parent d22f7b1d4a
commit 4a3a442ebd
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04
2 changed files with 22 additions and 4 deletions

View File

@ -87,7 +87,7 @@ import { pokemonPrevolutions } from "#app/data/balance/pokemon-evolutions";
import PokeballTray from "#app/ui/pokeball-tray";
import InvertPostFX from "#app/pipelines/invert";
import type { Achv } from "#app/system/achv";
import { achvs, ModifierAchv, MoneyAchv } from "#app/system/achv";
import { achvs, HeldItemAchv, ModifierAchv, MoneyAchv } from "#app/system/achv";
import type { Voucher } from "#app/system/voucher";
import { vouchers } from "#app/system/voucher";
import { Gender } from "#app/data/gender";
@ -2698,6 +2698,10 @@ export default class BattleScene extends SceneBase {
if (playSound && !this.sound.get(soundName)) {
this.playSound(soundName);
}
if (pokemon.isPlayer()) {
this.validateAchvs(HeldItemAchv, pokemon);
}
}
addFormChangeItem(itemId: FormChangeItem, pokemon: Pokemon, ignoreUpdate?: boolean) {

View File

@ -1,5 +1,4 @@
import type { Modifier } from "typescript";
import { TurnHeldItemTransferModifier } from "../modifier/modifier";
import { pokemonEvolutions } from "#app/data/balance/pokemon-evolutions";
import i18next from "i18next";
import { NumberHolder } from "#app/utils/common";
@ -16,6 +15,8 @@ import type { ConditionFn } from "#app/@types/common";
import { Stat, getShortenedStatKey } from "#app/enums/stat";
import { Challenges } from "#app/enums/challenges";
import { globalScene } from "#app/global-scene";
import { HeldItemId } from "#enums/held-item-id";
import type Pokemon from "#app/field/pokemon";
export enum AchvTier {
COMMON,
@ -189,6 +190,19 @@ export class ModifierAchv extends Achv {
}
}
export class HeldItemAchv extends Achv {
constructor(
localizationKey: string,
name: string,
description: string,
iconImage: string,
score: number,
pokemonFunc: (pokemon: Pokemon) => boolean,
) {
super(localizationKey, name, description, iconImage, score, (args: any[]) => pokemonFunc(args[0] as Pokemon));
}
}
export class ChallengeAchv extends Achv {
constructor(
localizationKey: string,
@ -490,13 +504,13 @@ export const achvs = {
25,
).setSecret(true),
SPLICE: new Achv("SPLICE", "", "SPLICE.description", "dna_splicers", 10),
MINI_BLACK_HOLE: new ModifierAchv(
MINI_BLACK_HOLE: new HeldItemAchv(
"MINI_BLACK_HOLE",
"",
"MINI_BLACK_HOLE.description",
"mini_black_hole",
25,
modifier => modifier instanceof TurnHeldItemTransferModifier,
pokemon => pokemon.heldItemManager.hasItem(HeldItemId.MINI_BLACK_HOLE),
).setSecret(),
CATCH_MYTHICAL: new Achv("CATCH_MYTHICAL", "", "CATCH_MYTHICAL.description", "strange_ball", 50).setSecret(),
CATCH_SUB_LEGENDARY: new Achv("CATCH_SUB_LEGENDARY", "", "CATCH_SUB_LEGENDARY.description", "rb", 75).setSecret(),