mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-04 23:42:18 +02:00
Reworked most entries in Modifier Types
This commit is contained in:
parent
faa387a67e
commit
87b0035463
@ -1,7 +1,8 @@
|
|||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import type { HeldItemId } from "#enums/held-item-id";
|
import type { HeldItemId } from "#enums/held-item-id";
|
||||||
import { HeldItem, ITEM_EFFECT } from "../held-item";
|
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 {
|
export interface BASE_STAT_FLAT_PARAMS {
|
||||||
/** The pokemon with the item */
|
/** The pokemon with the item */
|
||||||
@ -27,6 +28,13 @@ export class BaseStatFlatHeldItem extends HeldItem {
|
|||||||
this.stats = stats;
|
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}.
|
* Checks if the {@linkcode PokemonBaseStatFlatModifier} should be applied to the {@linkcode Pokemon}.
|
||||||
* @param pokemon The {@linkcode Pokemon} that holds the item
|
* @param pokemon The {@linkcode Pokemon} that holds the item
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import type { NumberHolder } from "#app/utils/common";
|
import type { NumberHolder } from "#app/utils/common";
|
||||||
import type { HeldItemId } from "#enums/held-item-id";
|
import type { HeldItemId } from "#enums/held-item-id";
|
||||||
|
import i18next from "i18next";
|
||||||
import { HeldItem, ITEM_EFFECT } from "../held-item";
|
import { HeldItem, ITEM_EFFECT } from "../held-item";
|
||||||
|
|
||||||
export interface EXP_BOOST_PARAMS {
|
export interface EXP_BOOST_PARAMS {
|
||||||
@ -12,13 +13,21 @@ export interface EXP_BOOST_PARAMS {
|
|||||||
|
|
||||||
export class ExpBoosterHeldItem extends HeldItem {
|
export class ExpBoosterHeldItem extends HeldItem {
|
||||||
public effects: ITEM_EFFECT[] = [ITEM_EFFECT.EXP_BOOSTER];
|
public effects: ITEM_EFFECT[] = [ITEM_EFFECT.EXP_BOOSTER];
|
||||||
|
private boostPercent: number;
|
||||||
private boostMultiplier: number;
|
private boostMultiplier: number;
|
||||||
|
|
||||||
constructor(type: HeldItemId, maxStackCount = 1, boostPercent: number) {
|
constructor(type: HeldItemId, maxStackCount = 1, boostPercent: number) {
|
||||||
super(type, maxStackCount);
|
super(type, maxStackCount);
|
||||||
|
this.boostPercent = boostPercent;
|
||||||
this.boostMultiplier = boostPercent * 0.01;
|
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
|
// TODO: What do we do with this? Need to look up all the shouldApply
|
||||||
/**
|
/**
|
||||||
* Checks if {@linkcode PokemonExpBoosterModifier} should be applied
|
* Checks if {@linkcode PokemonExpBoosterModifier} should be applied
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import type { NumberHolder } from "#app/utils/common";
|
import type { NumberHolder } from "#app/utils/common";
|
||||||
|
import i18next from "i18next";
|
||||||
import { HeldItem, ITEM_EFFECT } from "../held-item";
|
import { HeldItem, ITEM_EFFECT } from "../held-item";
|
||||||
|
|
||||||
export interface FRIENDSHIP_BOOST_PARAMS {
|
export interface FRIENDSHIP_BOOST_PARAMS {
|
||||||
@ -12,6 +13,10 @@ export interface FRIENDSHIP_BOOST_PARAMS {
|
|||||||
export class FriendshipBoosterHeldItem extends HeldItem {
|
export class FriendshipBoosterHeldItem extends HeldItem {
|
||||||
public effects: ITEM_EFFECT[] = [ITEM_EFFECT.FRIENDSHIP_BOOSTER];
|
public effects: ITEM_EFFECT[] = [ITEM_EFFECT.FRIENDSHIP_BOOSTER];
|
||||||
|
|
||||||
|
get description(): string {
|
||||||
|
return i18next.t("modifierType:ModifierType.PokemonFriendshipBoosterModifierType.description");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies {@linkcode PokemonFriendshipBoosterModifier}
|
* Applies {@linkcode PokemonFriendshipBoosterModifier}
|
||||||
* @param _pokemon The {@linkcode Pokemon} to apply the friendship boost to
|
* @param _pokemon The {@linkcode Pokemon} to apply the friendship boost to
|
||||||
|
@ -2,6 +2,7 @@ import type Pokemon from "#app/field/pokemon";
|
|||||||
import { HeldItem, ITEM_EFFECT } from "../held-item";
|
import { HeldItem, ITEM_EFFECT } from "../held-item";
|
||||||
import { Stat } from "#enums/stat";
|
import { Stat } from "#enums/stat";
|
||||||
import type { NumberHolder } from "#app/utils/common";
|
import type { NumberHolder } from "#app/utils/common";
|
||||||
|
import i18next from "i18next";
|
||||||
|
|
||||||
export interface INCREMENTING_STAT_PARAMS {
|
export interface INCREMENTING_STAT_PARAMS {
|
||||||
/** The pokemon with the item */
|
/** The pokemon with the item */
|
||||||
@ -28,6 +29,14 @@ export class IncrementingStatHeldItem extends HeldItem {
|
|||||||
// return super.shouldApply(pokemon, stat, statHolder) && !!statHolder;
|
// 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}
|
* Applies the {@linkcode PokemonIncrementingStatModifier}
|
||||||
* @param _pokemon The {@linkcode Pokemon} that holds the item
|
* @param _pokemon The {@linkcode Pokemon} that holds the item
|
||||||
|
@ -85,6 +85,10 @@ export class TurnEndItemStealHeldItem extends ItemTransferHeldItem {
|
|||||||
public effects: ITEM_EFFECT[] = [ITEM_EFFECT.TURN_END_ITEM_STEAL];
|
public effects: ITEM_EFFECT[] = [ITEM_EFFECT.TURN_END_ITEM_STEAL];
|
||||||
isTransferable = true;
|
isTransferable = true;
|
||||||
|
|
||||||
|
get description(): string {
|
||||||
|
return i18next.t("modifierType:ModifierType.TurnHeldItemTransferModifierType.description");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines the targets to transfer items from when this applies.
|
* Determines the targets to transfer items from when this applies.
|
||||||
* @param pokemon the {@linkcode Pokemon} holding this item
|
* @param pokemon the {@linkcode Pokemon} holding this item
|
||||||
@ -121,14 +125,22 @@ export class TurnEndItemStealHeldItem extends ItemTransferHeldItem {
|
|||||||
*/
|
*/
|
||||||
export class ContactItemStealChanceHeldItem extends ItemTransferHeldItem {
|
export class ContactItemStealChanceHeldItem extends ItemTransferHeldItem {
|
||||||
public effects: ITEM_EFFECT[] = [ITEM_EFFECT.CONTACT_ITEM_STEAL_CHANCE];
|
public effects: ITEM_EFFECT[] = [ITEM_EFFECT.CONTACT_ITEM_STEAL_CHANCE];
|
||||||
|
public readonly chancePercent: number;
|
||||||
public readonly chance: number;
|
public readonly chance: number;
|
||||||
|
|
||||||
constructor(type: HeldItemId, maxStackCount = 1, chancePercent: number) {
|
constructor(type: HeldItemId, maxStackCount = 1, chancePercent: number) {
|
||||||
super(type, maxStackCount);
|
super(type, maxStackCount);
|
||||||
|
|
||||||
|
this.chancePercent = chancePercent;
|
||||||
this.chance = chancePercent / 100;
|
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.
|
* Determines the target to steal items from when this applies.
|
||||||
* @param _holderPokemon The {@linkcode Pokemon} holding this item
|
* @param _holderPokemon The {@linkcode Pokemon} holding this item
|
||||||
|
@ -3,6 +3,7 @@ import { HeldItem, ITEM_EFFECT } from "#app/items/held-item";
|
|||||||
import { isNullOrUndefined, type NumberHolder } from "#app/utils/common";
|
import { isNullOrUndefined, type NumberHolder } from "#app/utils/common";
|
||||||
import type { MoveId } from "#enums/move-id";
|
import type { MoveId } from "#enums/move-id";
|
||||||
import { allMoves } from "#app/data/data-lists";
|
import { allMoves } from "#app/data/data-lists";
|
||||||
|
import i18next from "i18next";
|
||||||
|
|
||||||
export interface MULTI_HIT_PARAMS {
|
export interface MULTI_HIT_PARAMS {
|
||||||
pokemon: Pokemon;
|
pokemon: Pokemon;
|
||||||
@ -20,6 +21,10 @@ export interface MULTI_HIT_PARAMS {
|
|||||||
export class MultiHitHeldItem extends HeldItem {
|
export class MultiHitHeldItem extends HeldItem {
|
||||||
public effects: ITEM_EFFECT[] = [ITEM_EFFECT.MULTI_HIT];
|
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.
|
* For each stack, converts 25 percent of attack damage into an additional strike.
|
||||||
* @param pokemon The {@linkcode Pokemon} using the move
|
* @param pokemon The {@linkcode Pokemon} using the move
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -16,12 +16,7 @@ import {
|
|||||||
PokemonHeldItemReward,
|
PokemonHeldItemReward,
|
||||||
} from "#app/modifier/modifier-type";
|
} from "#app/modifier/modifier-type";
|
||||||
import type { Modifier } from "#app/modifier/modifier";
|
import type { Modifier } from "#app/modifier/modifier";
|
||||||
import {
|
import { ExtraModifierModifier, HealShopCostModifier, TempExtraModifierModifier } from "#app/modifier/modifier";
|
||||||
ExtraModifierModifier,
|
|
||||||
HealShopCostModifier,
|
|
||||||
PokemonHeldItemModifier,
|
|
||||||
TempExtraModifierModifier,
|
|
||||||
} from "#app/modifier/modifier";
|
|
||||||
import type ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler";
|
import type ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler";
|
||||||
import { SHOP_OPTIONS_ROW_LIMIT } 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";
|
import PartyUiHandler, { PartyUiMode, PartyOption } from "#app/ui/party-ui-handler";
|
||||||
@ -76,9 +71,6 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
}
|
}
|
||||||
const modifierCount = this.getModifierCount();
|
const modifierCount = this.getModifierCount();
|
||||||
|
|
||||||
this.typeOptions = this.getModifierTypeOptions(modifierCount);
|
|
||||||
const modifierCount = this.getModifierCount();
|
|
||||||
|
|
||||||
this.typeOptions = this.getModifierTypeOptions(modifierCount);
|
this.typeOptions = this.getModifierTypeOptions(modifierCount);
|
||||||
|
|
||||||
const modifierSelectCallback = (rowCursor: number, cursor: number) => {
|
const modifierSelectCallback = (rowCursor: number, cursor: number) => {
|
||||||
@ -176,6 +168,9 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
modifierSelectCallback: ModifierSelectCallback,
|
modifierSelectCallback: ModifierSelectCallback,
|
||||||
): boolean {
|
): boolean {
|
||||||
if (modifierType instanceof PokemonModifierType) {
|
if (modifierType instanceof PokemonModifierType) {
|
||||||
|
if (modifierType instanceof PokemonHeldItemReward) {
|
||||||
|
this.openGiveHeldItemMenu(modifierType, modifierSelectCallback);
|
||||||
|
}
|
||||||
if (modifierType instanceof FusePokemonModifierType) {
|
if (modifierType instanceof FusePokemonModifierType) {
|
||||||
this.openFusionMenu(modifierType, cost, modifierSelectCallback);
|
this.openFusionMenu(modifierType, cost, modifierSelectCallback);
|
||||||
} else {
|
} else {
|
||||||
@ -226,17 +221,15 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
fromSlotIndex !== toSlotIndex &&
|
fromSlotIndex !== toSlotIndex &&
|
||||||
itemIndex > -1
|
itemIndex > -1
|
||||||
) {
|
) {
|
||||||
const itemModifiers = globalScene.findModifiers(
|
const items = party[fromSlotIndex].heldItemManager.getTransferableHeldItems();
|
||||||
m => m instanceof PokemonHeldItemModifier && m.isTransferable && m.pokemonId === party[fromSlotIndex].id,
|
const item = items[itemIndex];
|
||||||
) as PokemonHeldItemModifier[];
|
globalScene.tryTransferHeldItem(
|
||||||
const itemModifier = itemModifiers[itemIndex];
|
item,
|
||||||
globalScene.tryTransferHeldItemModifier(
|
party[fromSlotIndex],
|
||||||
itemModifier,
|
|
||||||
party[toSlotIndex],
|
party[toSlotIndex],
|
||||||
true,
|
true,
|
||||||
itemQuantity,
|
itemQuantity,
|
||||||
undefined,
|
true,
|
||||||
undefined,
|
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -373,7 +366,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
(slotIndex: number, _option: PartyOption) => {
|
(slotIndex: number, _option: PartyOption) => {
|
||||||
if (slotIndex < 6) {
|
if (slotIndex < 6) {
|
||||||
globalScene.ui.setMode(UiMode.MODIFIER_SELECT, this.isPlayer()).then(() => {
|
globalScene.ui.setMode(UiMode.MODIFIER_SELECT, this.isPlayer()).then(() => {
|
||||||
party[slotIndex].heldItemManager.add(reward.itemId);
|
reward.apply(party[slotIndex]);
|
||||||
globalScene.ui.clearText();
|
globalScene.ui.clearText();
|
||||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||||
super.end();
|
super.end();
|
||||||
|
Loading…
Reference in New Issue
Block a user