Reworked most entries in Modifier Types

This commit is contained in:
Wlowscha 2025-06-09 16:02:59 +02:00
parent faa387a67e
commit 87b0035463
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04
8 changed files with 156 additions and 703 deletions

View File

@ -1,7 +1,8 @@
import type Pokemon from "#app/field/pokemon";
import type { HeldItemId } from "#enums/held-item-id";
import { HeldItem, ITEM_EFFECT } from "../held-item";
import type { Stat } from "#enums/stat";
import { getStatKey, type Stat } from "#enums/stat";
import i18next from "i18next";
export interface BASE_STAT_FLAT_PARAMS {
/** The pokemon with the item */
@ -27,6 +28,13 @@ export class BaseStatFlatHeldItem extends HeldItem {
this.stats = stats;
}
get description(): string {
return i18next.t("modifierType:ModifierType.PokemonBaseStatFlatModifierType.description", {
stats: this.stats.map(stat => i18next.t(getStatKey(stat))).join("/"),
statValue: this.statModifier,
});
}
/**
* Checks if the {@linkcode PokemonBaseStatFlatModifier} should be applied to the {@linkcode Pokemon}.
* @param pokemon The {@linkcode Pokemon} that holds the item

View File

@ -1,6 +1,7 @@
import type Pokemon from "#app/field/pokemon";
import type { NumberHolder } from "#app/utils/common";
import type { HeldItemId } from "#enums/held-item-id";
import i18next from "i18next";
import { HeldItem, ITEM_EFFECT } from "../held-item";
export interface EXP_BOOST_PARAMS {
@ -12,13 +13,21 @@ export interface EXP_BOOST_PARAMS {
export class ExpBoosterHeldItem extends HeldItem {
public effects: ITEM_EFFECT[] = [ITEM_EFFECT.EXP_BOOSTER];
private boostPercent: number;
private boostMultiplier: number;
constructor(type: HeldItemId, maxStackCount = 1, boostPercent: number) {
super(type, maxStackCount);
this.boostPercent = boostPercent;
this.boostMultiplier = boostPercent * 0.01;
}
get description(): string {
return i18next.t("modifierType:ModifierType.PokemonExpBoosterModifierType.description", {
boostPercent: this.boostPercent,
});
}
// TODO: What do we do with this? Need to look up all the shouldApply
/**
* Checks if {@linkcode PokemonExpBoosterModifier} should be applied

View File

@ -1,5 +1,6 @@
import type Pokemon from "#app/field/pokemon";
import type { NumberHolder } from "#app/utils/common";
import i18next from "i18next";
import { HeldItem, ITEM_EFFECT } from "../held-item";
export interface FRIENDSHIP_BOOST_PARAMS {
@ -12,6 +13,10 @@ export interface FRIENDSHIP_BOOST_PARAMS {
export class FriendshipBoosterHeldItem extends HeldItem {
public effects: ITEM_EFFECT[] = [ITEM_EFFECT.FRIENDSHIP_BOOSTER];
get description(): string {
return i18next.t("modifierType:ModifierType.PokemonFriendshipBoosterModifierType.description");
}
/**
* Applies {@linkcode PokemonFriendshipBoosterModifier}
* @param _pokemon The {@linkcode Pokemon} to apply the friendship boost to

View File

@ -2,6 +2,7 @@ import type Pokemon from "#app/field/pokemon";
import { HeldItem, ITEM_EFFECT } from "../held-item";
import { Stat } from "#enums/stat";
import type { NumberHolder } from "#app/utils/common";
import i18next from "i18next";
export interface INCREMENTING_STAT_PARAMS {
/** The pokemon with the item */
@ -28,6 +29,14 @@ export class IncrementingStatHeldItem extends HeldItem {
// return super.shouldApply(pokemon, stat, statHolder) && !!statHolder;
// }
get name(): string {
return i18next.t("modifierType:ModifierType.MYSTERY_ENCOUNTER_MACHO_BRACE.name") + " (new)";
}
get description(): string {
return i18next.t("modifierType:ModifierType.MYSTERY_ENCOUNTER_MACHO_BRACE.description");
}
/**
* Applies the {@linkcode PokemonIncrementingStatModifier}
* @param _pokemon The {@linkcode Pokemon} that holds the item

View File

@ -85,6 +85,10 @@ export class TurnEndItemStealHeldItem extends ItemTransferHeldItem {
public effects: ITEM_EFFECT[] = [ITEM_EFFECT.TURN_END_ITEM_STEAL];
isTransferable = true;
get description(): string {
return i18next.t("modifierType:ModifierType.TurnHeldItemTransferModifierType.description");
}
/**
* Determines the targets to transfer items from when this applies.
* @param pokemon the {@linkcode Pokemon} holding this item
@ -121,14 +125,22 @@ export class TurnEndItemStealHeldItem extends ItemTransferHeldItem {
*/
export class ContactItemStealChanceHeldItem extends ItemTransferHeldItem {
public effects: ITEM_EFFECT[] = [ITEM_EFFECT.CONTACT_ITEM_STEAL_CHANCE];
public readonly chancePercent: number;
public readonly chance: number;
constructor(type: HeldItemId, maxStackCount = 1, chancePercent: number) {
super(type, maxStackCount);
this.chancePercent = chancePercent;
this.chance = chancePercent / 100;
}
get description(): string {
return i18next.t("modifierType:ModifierType.ContactHeldItemTransferChanceModifierType.description", {
chancePercent: this.chancePercent,
});
}
/**
* Determines the target to steal items from when this applies.
* @param _holderPokemon The {@linkcode Pokemon} holding this item

View File

@ -3,6 +3,7 @@ import { HeldItem, ITEM_EFFECT } from "#app/items/held-item";
import { isNullOrUndefined, type NumberHolder } from "#app/utils/common";
import type { MoveId } from "#enums/move-id";
import { allMoves } from "#app/data/data-lists";
import i18next from "i18next";
export interface MULTI_HIT_PARAMS {
pokemon: Pokemon;
@ -20,6 +21,10 @@ export interface MULTI_HIT_PARAMS {
export class MultiHitHeldItem extends HeldItem {
public effects: ITEM_EFFECT[] = [ITEM_EFFECT.MULTI_HIT];
get description(): string {
return i18next.t("modifierType:ModifierType.PokemonMultiHitModifierType.description");
}
/**
* For each stack, converts 25 percent of attack damage into an additional strike.
* @param pokemon The {@linkcode Pokemon} using the move

File diff suppressed because it is too large Load Diff

View File

@ -16,12 +16,7 @@ import {
PokemonHeldItemReward,
} from "#app/modifier/modifier-type";
import type { Modifier } from "#app/modifier/modifier";
import {
ExtraModifierModifier,
HealShopCostModifier,
PokemonHeldItemModifier,
TempExtraModifierModifier,
} from "#app/modifier/modifier";
import { ExtraModifierModifier, HealShopCostModifier, TempExtraModifierModifier } from "#app/modifier/modifier";
import type ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler";
import { SHOP_OPTIONS_ROW_LIMIT } from "#app/ui/modifier-select-ui-handler";
import PartyUiHandler, { PartyUiMode, PartyOption } from "#app/ui/party-ui-handler";
@ -76,9 +71,6 @@ export class SelectModifierPhase extends BattlePhase {
}
const modifierCount = this.getModifierCount();
this.typeOptions = this.getModifierTypeOptions(modifierCount);
const modifierCount = this.getModifierCount();
this.typeOptions = this.getModifierTypeOptions(modifierCount);
const modifierSelectCallback = (rowCursor: number, cursor: number) => {
@ -176,6 +168,9 @@ export class SelectModifierPhase extends BattlePhase {
modifierSelectCallback: ModifierSelectCallback,
): boolean {
if (modifierType instanceof PokemonModifierType) {
if (modifierType instanceof PokemonHeldItemReward) {
this.openGiveHeldItemMenu(modifierType, modifierSelectCallback);
}
if (modifierType instanceof FusePokemonModifierType) {
this.openFusionMenu(modifierType, cost, modifierSelectCallback);
} else {
@ -226,17 +221,15 @@ export class SelectModifierPhase extends BattlePhase {
fromSlotIndex !== toSlotIndex &&
itemIndex > -1
) {
const itemModifiers = globalScene.findModifiers(
m => m instanceof PokemonHeldItemModifier && m.isTransferable && m.pokemonId === party[fromSlotIndex].id,
) as PokemonHeldItemModifier[];
const itemModifier = itemModifiers[itemIndex];
globalScene.tryTransferHeldItemModifier(
itemModifier,
const items = party[fromSlotIndex].heldItemManager.getTransferableHeldItems();
const item = items[itemIndex];
globalScene.tryTransferHeldItem(
item,
party[fromSlotIndex],
party[toSlotIndex],
true,
itemQuantity,
undefined,
undefined,
true,
false,
);
} else {
@ -373,7 +366,7 @@ export class SelectModifierPhase extends BattlePhase {
(slotIndex: number, _option: PartyOption) => {
if (slotIndex < 6) {
globalScene.ui.setMode(UiMode.MODIFIER_SELECT, this.isPlayer()).then(() => {
party[slotIndex].heldItemManager.add(reward.itemId);
reward.apply(party[slotIndex]);
globalScene.ui.clearText();
globalScene.ui.setMode(UiMode.MESSAGE);
super.end();