mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-09 00:49:27 +02:00
Rename HELD_ITEM_EFFECT
enum-object to HeldItemEffect
This commit is contained in:
parent
79779765e2
commit
d576d66617
@ -141,7 +141,7 @@ import { timedEventManager } from "./global-event-manager";
|
|||||||
import { starterColors } from "./global-vars/starter-colors";
|
import { starterColors } from "./global-vars/starter-colors";
|
||||||
import { startingWave } from "./starting-wave";
|
import { startingWave } from "./starting-wave";
|
||||||
import { applyHeldItems } from "./items/all-held-items";
|
import { applyHeldItems } from "./items/all-held-items";
|
||||||
import { HELD_ITEM_EFFECT } from "./items/held-item";
|
import { HeldItemEffect } from "./items/held-item";
|
||||||
import { PhaseManager } from "./phase-manager";
|
import { PhaseManager } from "./phase-manager";
|
||||||
import { HeldItemId } from "#enums/held-item-id";
|
import { HeldItemId } from "#enums/held-item-id";
|
||||||
import { assignEnemyHeldItemsForWave, assignItemsFromConfiguration } from "./items/held-item-pool";
|
import { assignEnemyHeldItemsForWave, assignItemsFromConfiguration } from "./items/held-item-pool";
|
||||||
@ -3222,7 +3222,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
expMultiplier = Overrides.XP_MULTIPLIER_OVERRIDE;
|
expMultiplier = Overrides.XP_MULTIPLIER_OVERRIDE;
|
||||||
}
|
}
|
||||||
const pokemonExp = new NumberHolder(expValue * expMultiplier);
|
const pokemonExp = new NumberHolder(expValue * expMultiplier);
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.EXP_BOOSTER, { pokemon: partyMember, expAmount: pokemonExp });
|
applyHeldItems(HeldItemEffect.EXP_BOOSTER, { pokemon: partyMember, expAmount: pokemonExp });
|
||||||
partyMemberExp.push(Math.floor(pokemonExp.value));
|
partyMemberExp.push(Math.floor(pokemonExp.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
import { MoveChargeAnim } from "../battle-anims";
|
import { MoveChargeAnim } from "../battle-anims";
|
||||||
import { ChargeAnim } from "#enums/move-anims-common";
|
import { ChargeAnim } from "#enums/move-anims-common";
|
||||||
import {
|
import {
|
||||||
CommandedTag,
|
CommandedTag,
|
||||||
EncoreTag,
|
EncoreTag,
|
||||||
GulpMissileTag,
|
GulpMissileTag,
|
||||||
HelpingHandTag,
|
HelpingHandTag,
|
||||||
SemiInvulnerableTag,
|
SemiInvulnerableTag,
|
||||||
ShellTrapTag,
|
ShellTrapTag,
|
||||||
StockpilingTag,
|
StockpilingTag,
|
||||||
SubstituteTag,
|
SubstituteTag,
|
||||||
TrappedTag,
|
TrappedTag,
|
||||||
TypeBoostTag,
|
TypeBoostTag,
|
||||||
} from "../battler-tags";
|
} from "../battler-tags";
|
||||||
import { getPokemonNameWithAffix } from "../../messages";
|
import { getPokemonNameWithAffix } from "../../messages";
|
||||||
import type { TurnMove } from "#app/@types/turn-move";
|
import type { TurnMove } from "#app/@types/turn-move";
|
||||||
@ -22,9 +22,9 @@ import { MoveResult } from "#enums/move-result";
|
|||||||
import { HitResult } from "#enums/hit-result";
|
import { HitResult } from "#enums/hit-result";
|
||||||
import { FieldPosition } from "#enums/field-position";
|
import { FieldPosition } from "#enums/field-position";
|
||||||
import {
|
import {
|
||||||
getNonVolatileStatusEffects,
|
getNonVolatileStatusEffects,
|
||||||
getStatusEffectHealText,
|
getStatusEffectHealText,
|
||||||
isNonVolatileStatusEffect,
|
isNonVolatileStatusEffect,
|
||||||
} from "../status-effect";
|
} from "../status-effect";
|
||||||
import { getTypeDamageMultiplier } from "../type";
|
import { getTypeDamageMultiplier } from "../type";
|
||||||
import { PokemonType } from "#enums/pokemon-type";
|
import { PokemonType } from "#enums/pokemon-type";
|
||||||
@ -34,13 +34,12 @@ import type { ArenaTrapTag } from "../arena-tag";
|
|||||||
import { WeakenMoveTypeTag } from "../arena-tag";
|
import { WeakenMoveTypeTag } from "../arena-tag";
|
||||||
import { ArenaTagSide } from "#enums/arena-tag-side";
|
import { ArenaTagSide } from "#enums/arena-tag-side";
|
||||||
import {
|
import {
|
||||||
applyAbAttrs
|
applyAbAttrs
|
||||||
} from "../abilities/apply-ab-attrs";
|
} from "../abilities/apply-ab-attrs";
|
||||||
import { allAbilities, allHeldItems, allMoves } from "../data-lists";
|
import { allAbilities, allHeldItems, allMoves } from "../data-lists";
|
||||||
import type { BattlerIndex } from "#enums/battler-index";
|
import type { BattlerIndex } from "#enums/battler-index";
|
||||||
import { BattleType } from "#enums/battle-type";
|
import { BattleType } from "#enums/battle-type";
|
||||||
import { TerrainType } from "../terrain";
|
import { TerrainType } from "../terrain";
|
||||||
import { ModifierPoolType } from "#enums/modifier-pool-type";
|
|
||||||
import { Command } from "#enums/command";
|
import { Command } from "#enums/command";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import type { Localizable } from "#app/@types/locales";
|
import type { Localizable } from "#app/@types/locales";
|
||||||
@ -53,11 +52,11 @@ import { MoveId } from "#enums/move-id";
|
|||||||
import { SpeciesId } from "#enums/species-id";
|
import { SpeciesId } from "#enums/species-id";
|
||||||
import { MoveUsedEvent } from "#app/events/battle-scene";
|
import { MoveUsedEvent } from "#app/events/battle-scene";
|
||||||
import {
|
import {
|
||||||
BATTLE_STATS,
|
BATTLE_STATS,
|
||||||
type BattleStat,
|
type BattleStat,
|
||||||
type EffectiveStat,
|
type EffectiveStat,
|
||||||
getStatKey,
|
getStatKey,
|
||||||
Stat,
|
Stat,
|
||||||
} from "#app/enums/stat";
|
} from "#app/enums/stat";
|
||||||
import { MoveEndPhase } from "#app/phases/move-end-phase";
|
import { MoveEndPhase } from "#app/phases/move-end-phase";
|
||||||
import { MovePhase } from "#app/phases/move-phase";
|
import { MovePhase } from "#app/phases/move-phase";
|
||||||
@ -78,14 +77,14 @@ import { MoveEffectTrigger } from "#enums/MoveEffectTrigger";
|
|||||||
import { MultiHitType } from "#enums/MultiHitType";
|
import { MultiHitType } from "#enums/MultiHitType";
|
||||||
import { invalidAssistMoves, invalidCopycatMoves, invalidMetronomeMoves, invalidMirrorMoveMoves, invalidSleepTalkMoves, invalidSketchMoves } from "./invalid-moves";
|
import { invalidAssistMoves, invalidCopycatMoves, invalidMetronomeMoves, invalidMirrorMoveMoves, invalidSleepTalkMoves, invalidSketchMoves } from "./invalid-moves";
|
||||||
import { isVirtual, MoveUseMode } from "#enums/move-use-mode";
|
import { isVirtual, MoveUseMode } from "#enums/move-use-mode";
|
||||||
import { HELD_ITEM_EFFECT } from "#app/items/held-item";
|
import { HeldItemEffect } from "#app/items/held-item";
|
||||||
import { BerryHeldItem, berryTypeToHeldItem } from "#app/items/held-items/berry";
|
import { BerryHeldItem, berryTypeToHeldItem } from "#app/items/held-items/berry";
|
||||||
import { HeldItemCategoryId, HeldItemId, isItemInCategory } from "#enums/held-item-id";
|
import { HeldItemCategoryId, HeldItemId, isItemInCategory } from "#enums/held-item-id";
|
||||||
import type { ChargingMove, MoveAttrMap, MoveAttrString, MoveKindString, MoveClassMap } from "#app/@types/move-types";
|
import type { ChargingMove, MoveAttrMap, MoveAttrString, MoveKindString, MoveClassMap } from "#app/@types/move-types";
|
||||||
import { applyMoveAttrs } from "./apply-attrs";
|
import { applyMoveAttrs } from "./apply-attrs";
|
||||||
import { frenzyMissFunc, getMoveTargets } from "./move-utils";
|
import { frenzyMissFunc, getMoveTargets } from "./move-utils";
|
||||||
import { TRAINER_ITEM_EFFECT } from "#app/items/trainer-item";
|
import { TRAINER_ITEM_EFFECT } from "#app/items/trainer-item";
|
||||||
import { AbAttrBaseParams, AbAttrParamsWithCancel, PreAttackModifyPowerAbAttrParams } from "../abilities/ability";
|
import { AbAttrParamsWithCancel, PreAttackModifyPowerAbAttrParams } from "../abilities/ability";
|
||||||
import { applyHeldItems } from "#app/items/all-held-items";
|
import { applyHeldItems } from "#app/items/all-held-items";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -766,7 +765,7 @@ export default abstract class Move implements Localizable {
|
|||||||
const isOhko = this.hasAttr("OneHitKOAccuracyAttr");
|
const isOhko = this.hasAttr("OneHitKOAccuracyAttr");
|
||||||
|
|
||||||
if (!isOhko) {
|
if (!isOhko) {
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.ACCURACY_BOOSTER, { pokemon: user, moveAccuracy: moveAccuracy });
|
applyHeldItems(HeldItemEffect.ACCURACY_BOOSTER, { pokemon: user, moveAccuracy: moveAccuracy });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (globalScene.arena.weather?.weatherType === WeatherType.FOG) {
|
if (globalScene.arena.weather?.weatherType === WeatherType.FOG) {
|
||||||
@ -848,7 +847,7 @@ export default abstract class Move implements Localizable {
|
|||||||
|
|
||||||
if (!this.hasAttr("TypelessAttr")) {
|
if (!this.hasAttr("TypelessAttr")) {
|
||||||
globalScene.arena.applyTags(WeakenMoveTypeTag, simulated, typeChangeHolder.value, power);
|
globalScene.arena.applyTags(WeakenMoveTypeTag, simulated, typeChangeHolder.value, power);
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.ATTACK_TYPE_BOOST, {
|
applyHeldItems(HeldItemEffect.ATTACK_TYPE_BOOST, {
|
||||||
pokemon: source,
|
pokemon: source,
|
||||||
moveType: typeChangeHolder.value,
|
moveType: typeChangeHolder.value,
|
||||||
movePower: power,
|
movePower: power,
|
||||||
|
@ -35,7 +35,7 @@ import {
|
|||||||
} from "#app/data/pokemon-forms/form-change-triggers";
|
} from "#app/data/pokemon-forms/form-change-triggers";
|
||||||
import { WeatherType } from "#enums/weather-type";
|
import { WeatherType } from "#enums/weather-type";
|
||||||
import { applyHeldItems } from "#app/items/all-held-items";
|
import { applyHeldItems } from "#app/items/all-held-items";
|
||||||
import { HELD_ITEM_EFFECT } from "#app/items/held-item";
|
import { HeldItemEffect } from "#app/items/held-item";
|
||||||
|
|
||||||
export class Arena {
|
export class Arena {
|
||||||
public biomeType: BiomeId;
|
public biomeType: BiomeId;
|
||||||
@ -339,7 +339,7 @@ export class Arena {
|
|||||||
|
|
||||||
if (!isNullOrUndefined(user)) {
|
if (!isNullOrUndefined(user)) {
|
||||||
weatherDuration.value = 5;
|
weatherDuration.value = 5;
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.FIELD_EFFECT, { pokemon: user, fieldDuration: weatherDuration });
|
applyHeldItems(HeldItemEffect.FIELD_EFFECT, { pokemon: user, fieldDuration: weatherDuration });
|
||||||
}
|
}
|
||||||
|
|
||||||
this.weather = weather ? new Weather(weather, weatherDuration.value) : null;
|
this.weather = weather ? new Weather(weather, weatherDuration.value) : null;
|
||||||
@ -426,7 +426,7 @@ export class Arena {
|
|||||||
|
|
||||||
if (!isNullOrUndefined(user)) {
|
if (!isNullOrUndefined(user)) {
|
||||||
terrainDuration.value = 5;
|
terrainDuration.value = 5;
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.FIELD_EFFECT, { pokemon: user, fieldDuration: terrainDuration });
|
applyHeldItems(HeldItemEffect.FIELD_EFFECT, { pokemon: user, fieldDuration: terrainDuration });
|
||||||
}
|
}
|
||||||
|
|
||||||
this.terrain = terrain ? new Terrain(terrain, terrainDuration.value) : null;
|
this.terrain = terrain ? new Terrain(terrain, terrainDuration.value) : null;
|
||||||
|
@ -154,7 +154,7 @@ import { timedEventManager } from "#app/global-event-manager";
|
|||||||
import { loadMoveAnimations } from "#app/sprites/pokemon-asset-loader";
|
import { loadMoveAnimations } from "#app/sprites/pokemon-asset-loader";
|
||||||
import { PokemonItemManager } from "./pokemon-held-item-manager";
|
import { PokemonItemManager } from "./pokemon-held-item-manager";
|
||||||
import { applyHeldItems } from "#app/items/all-held-items";
|
import { applyHeldItems } from "#app/items/all-held-items";
|
||||||
import { HELD_ITEM_EFFECT } from "#app/items/held-item";
|
import { HeldItemEffect } from "#app/items/held-item";
|
||||||
import { HeldItemId } from "#enums/held-item-id";
|
import { HeldItemId } from "#enums/held-item-id";
|
||||||
import { isVirtual, isIgnorePP, MoveUseMode } from "#enums/move-use-mode";
|
import { isVirtual, isIgnorePP, MoveUseMode } from "#enums/move-use-mode";
|
||||||
import { FieldPosition } from "#enums/field-position";
|
import { FieldPosition } from "#enums/field-position";
|
||||||
@ -1346,7 +1346,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
getCritStage(source: Pokemon, move: Move): number {
|
getCritStage(source: Pokemon, move: Move): number {
|
||||||
const critStage = new NumberHolder(0);
|
const critStage = new NumberHolder(0);
|
||||||
applyMoveAttrs("HighCritAttr", source, this, move, critStage);
|
applyMoveAttrs("HighCritAttr", source, this, move, critStage);
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.CRIT_BOOST, { pokemon: source, critStage: critStage });
|
applyHeldItems(HeldItemEffect.CRIT_BOOST, { pokemon: source, critStage: critStage });
|
||||||
globalScene.applyPlayerItems(TRAINER_ITEM_EFFECT.TEMP_CRIT_BOOSTER, { numberHolder: critStage });
|
globalScene.applyPlayerItems(TRAINER_ITEM_EFFECT.TEMP_CRIT_BOOSTER, { numberHolder: critStage });
|
||||||
applyAbAttrs("BonusCritAbAttr", { pokemon: source, critStage });
|
applyAbAttrs("BonusCritAbAttr", { pokemon: source, critStage });
|
||||||
const critBoostTag = source.getTag(CritBoostTag);
|
const critBoostTag = source.getTag(CritBoostTag);
|
||||||
@ -1401,7 +1401,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
): number {
|
): number {
|
||||||
const statVal = new NumberHolder(this.getStat(stat, false));
|
const statVal = new NumberHolder(this.getStat(stat, false));
|
||||||
if (!ignoreHeldItems) {
|
if (!ignoreHeldItems) {
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: this, stat: stat, statValue: statVal });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: this, stat: stat, statValue: statVal });
|
||||||
}
|
}
|
||||||
|
|
||||||
// The Ruin abilities here are never ignored, but they reveal themselves on summon anyway
|
// The Ruin abilities here are never ignored, but they reveal themselves on summon anyway
|
||||||
@ -1509,7 +1509,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
const statHolder = new NumberHolder(Math.floor((2 * baseStats[s] + this.ivs[s]) * this.level * 0.01));
|
const statHolder = new NumberHolder(Math.floor((2 * baseStats[s] + this.ivs[s]) * this.level * 0.01));
|
||||||
if (s === Stat.HP) {
|
if (s === Stat.HP) {
|
||||||
statHolder.value = statHolder.value + this.level + 10;
|
statHolder.value = statHolder.value + this.level + 10;
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.INCREMENTING_STAT, { pokemon: this, stat: s, statHolder: statHolder });
|
applyHeldItems(HeldItemEffect.INCREMENTING_STAT, { pokemon: this, stat: s, statHolder: statHolder });
|
||||||
if (this.hasAbility(AbilityId.WONDER_GUARD, false, true)) {
|
if (this.hasAbility(AbilityId.WONDER_GUARD, false, true)) {
|
||||||
statHolder.value = 1;
|
statHolder.value = 1;
|
||||||
}
|
}
|
||||||
@ -1524,14 +1524,14 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
} else {
|
} else {
|
||||||
statHolder.value += 5;
|
statHolder.value += 5;
|
||||||
const natureStatMultiplier = new NumberHolder(getNatureStatMultiplier(this.getNature(), s));
|
const natureStatMultiplier = new NumberHolder(getNatureStatMultiplier(this.getNature(), s));
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.NATURE_WEIGHT_BOOSTER, { pokemon: this, multiplier: natureStatMultiplier });
|
applyHeldItems(HeldItemEffect.NATURE_WEIGHT_BOOSTER, { pokemon: this, multiplier: natureStatMultiplier });
|
||||||
if (natureStatMultiplier.value !== 1) {
|
if (natureStatMultiplier.value !== 1) {
|
||||||
statHolder.value = Math.max(
|
statHolder.value = Math.max(
|
||||||
Math[natureStatMultiplier.value > 1 ? "ceil" : "floor"](statHolder.value * natureStatMultiplier.value),
|
Math[natureStatMultiplier.value > 1 ? "ceil" : "floor"](statHolder.value * natureStatMultiplier.value),
|
||||||
1,
|
1,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.INCREMENTING_STAT, { pokemon: this, stat: s, statHolder: statHolder });
|
applyHeldItems(HeldItemEffect.INCREMENTING_STAT, { pokemon: this, stat: s, statHolder: statHolder });
|
||||||
}
|
}
|
||||||
|
|
||||||
statHolder.value = Phaser.Math.Clamp(statHolder.value, 1, Number.MAX_SAFE_INTEGER);
|
statHolder.value = Phaser.Math.Clamp(statHolder.value, 1, Number.MAX_SAFE_INTEGER);
|
||||||
@ -1544,9 +1544,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
const baseStats = this.getSpeciesForm(true).baseStats.slice(0);
|
const baseStats = this.getSpeciesForm(true).baseStats.slice(0);
|
||||||
applyChallenges(ChallengeType.FLIP_STAT, this, baseStats);
|
applyChallenges(ChallengeType.FLIP_STAT, this, baseStats);
|
||||||
// Shuckle Juice
|
// Shuckle Juice
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.BASE_STAT_TOTAL, { pokemon: this, baseStats: baseStats });
|
applyHeldItems(HeldItemEffect.BASE_STAT_TOTAL, { pokemon: this, baseStats: baseStats });
|
||||||
// Old Gateau
|
// Old Gateau
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.BASE_STAT_FLAT, { pokemon: this, baseStats: baseStats });
|
applyHeldItems(HeldItemEffect.BASE_STAT_FLAT, { pokemon: this, baseStats: baseStats });
|
||||||
if (this.isFusion()) {
|
if (this.isFusion()) {
|
||||||
const fusionBaseStats = this.getFusionSpeciesForm(true).baseStats;
|
const fusionBaseStats = this.getFusionSpeciesForm(true).baseStats;
|
||||||
applyChallenges(ChallengeType.FLIP_STAT, this, fusionBaseStats);
|
applyChallenges(ChallengeType.FLIP_STAT, this, fusionBaseStats);
|
||||||
@ -1560,7 +1560,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Vitamins
|
// Vitamins
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.BASE_STAT_BOOSTER, { pokemon: this, baseStats: baseStats });
|
applyHeldItems(HeldItemEffect.BASE_STAT_BOOSTER, { pokemon: this, baseStats: baseStats });
|
||||||
|
|
||||||
return baseStats;
|
return baseStats;
|
||||||
}
|
}
|
||||||
@ -3707,7 +3707,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
applyMoveAttrs("FixedDamageAttr", source, this, move, fixedDamage);
|
applyMoveAttrs("FixedDamageAttr", source, this, move, fixedDamage);
|
||||||
if (fixedDamage.value) {
|
if (fixedDamage.value) {
|
||||||
const multiLensMultiplier = new NumberHolder(1);
|
const multiLensMultiplier = new NumberHolder(1);
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.MULTI_HIT, {
|
applyHeldItems(HeldItemEffect.MULTI_HIT, {
|
||||||
pokemon: source,
|
pokemon: source,
|
||||||
moveId: move.id,
|
moveId: move.id,
|
||||||
damageMultiplier: multiLensMultiplier,
|
damageMultiplier: multiLensMultiplier,
|
||||||
@ -3755,7 +3755,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
/** Multiplier for moves enhanced by Multi-Lens and/or Parental Bond */
|
/** Multiplier for moves enhanced by Multi-Lens and/or Parental Bond */
|
||||||
const multiStrikeEnhancementMultiplier = new NumberHolder(1);
|
const multiStrikeEnhancementMultiplier = new NumberHolder(1);
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.MULTI_HIT, {
|
applyHeldItems(HeldItemEffect.MULTI_HIT, {
|
||||||
pokemon: source,
|
pokemon: source,
|
||||||
moveId: move.id,
|
moveId: move.id,
|
||||||
damageMultiplier: multiStrikeEnhancementMultiplier,
|
damageMultiplier: multiStrikeEnhancementMultiplier,
|
||||||
@ -3993,7 +3993,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
surviveDamage.value = this.lapseTag(BattlerTagType.ENDURE_TOKEN);
|
surviveDamage.value = this.lapseTag(BattlerTagType.ENDURE_TOKEN);
|
||||||
}
|
}
|
||||||
if (!surviveDamage.value) {
|
if (!surviveDamage.value) {
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.SURVIVE_CHANCE, { pokemon: this, surviveDamage: surviveDamage });
|
applyHeldItems(HeldItemEffect.SURVIVE_CHANCE, { pokemon: this, surviveDamage: surviveDamage });
|
||||||
}
|
}
|
||||||
if (surviveDamage.value) {
|
if (surviveDamage.value) {
|
||||||
damage = this.hp - 1;
|
damage = this.hp - 1;
|
||||||
@ -5748,7 +5748,7 @@ export class PlayerPokemon extends Pokemon {
|
|||||||
fusionStarterSpeciesId ? globalScene.gameData.starterData[fusionStarterSpeciesId] : null,
|
fusionStarterSpeciesId ? globalScene.gameData.starterData[fusionStarterSpeciesId] : null,
|
||||||
].filter(d => !!d);
|
].filter(d => !!d);
|
||||||
const amount = new NumberHolder(friendship);
|
const amount = new NumberHolder(friendship);
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.FRIENDSHIP_BOOSTER, { pokemon: this, friendship: amount });
|
applyHeldItems(HeldItemEffect.FRIENDSHIP_BOOSTER, { pokemon: this, friendship: amount });
|
||||||
const candyFriendshipMultiplier = globalScene.gameMode.isClassic
|
const candyFriendshipMultiplier = globalScene.gameMode.isClassic
|
||||||
? timedEventManager.getClassicFriendshipMultiplier()
|
? timedEventManager.getClassicFriendshipMultiplier()
|
||||||
: 1;
|
: 1;
|
||||||
|
@ -6,7 +6,7 @@ import type { PokemonType } from "#enums/pokemon-type";
|
|||||||
import { SpeciesId } from "#enums/species-id";
|
import { SpeciesId } from "#enums/species-id";
|
||||||
import { Stat, type PermanentStat } from "#enums/stat";
|
import { Stat, type PermanentStat } from "#enums/stat";
|
||||||
import { StatusEffect } from "#enums/status-effect";
|
import { StatusEffect } from "#enums/status-effect";
|
||||||
import { HELD_ITEM_EFFECT } from "./held-item";
|
import { HeldItemEffect } from "./held-item";
|
||||||
import { type ACCURACY_BOOST_PARAMS, AccuracyBoosterHeldItem } from "./held-items/accuracy-booster";
|
import { type ACCURACY_BOOST_PARAMS, AccuracyBoosterHeldItem } from "./held-items/accuracy-booster";
|
||||||
import {
|
import {
|
||||||
type ATTACK_TYPE_BOOST_PARAMS,
|
type ATTACK_TYPE_BOOST_PARAMS,
|
||||||
@ -174,36 +174,36 @@ export function initHeldItems() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type APPLY_HELD_ITEMS_PARAMS = {
|
type APPLY_HELD_ITEMS_PARAMS = {
|
||||||
[HELD_ITEM_EFFECT.ATTACK_TYPE_BOOST]: ATTACK_TYPE_BOOST_PARAMS;
|
[HeldItemEffect.ATTACK_TYPE_BOOST]: ATTACK_TYPE_BOOST_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.TURN_END_HEAL]: TURN_END_HEAL_PARAMS;
|
[HeldItemEffect.TURN_END_HEAL]: TURN_END_HEAL_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.HIT_HEAL]: HIT_HEAL_PARAMS;
|
[HeldItemEffect.HIT_HEAL]: HIT_HEAL_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.RESET_NEGATIVE_STAT_STAGE]: RESET_NEGATIVE_STAT_STAGE_PARAMS;
|
[HeldItemEffect.RESET_NEGATIVE_STAT_STAGE]: RESET_NEGATIVE_STAT_STAGE_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.EXP_BOOSTER]: EXP_BOOST_PARAMS;
|
[HeldItemEffect.EXP_BOOSTER]: EXP_BOOST_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.BERRY]: BERRY_PARAMS;
|
[HeldItemEffect.BERRY]: BERRY_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.BASE_STAT_BOOSTER]: BASE_STAT_BOOSTER_PARAMS;
|
[HeldItemEffect.BASE_STAT_BOOSTER]: BASE_STAT_BOOSTER_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.INSTANT_REVIVE]: INSTANT_REVIVE_PARAMS;
|
[HeldItemEffect.INSTANT_REVIVE]: INSTANT_REVIVE_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.STAT_BOOST]: STAT_BOOST_PARAMS;
|
[HeldItemEffect.STAT_BOOST]: STAT_BOOST_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.CRIT_BOOST]: CRIT_BOOST_PARAMS;
|
[HeldItemEffect.CRIT_BOOST]: CRIT_BOOST_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.TURN_END_STATUS]: TURN_END_STATUS_PARAMS;
|
[HeldItemEffect.TURN_END_STATUS]: TURN_END_STATUS_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.SURVIVE_CHANCE]: SURVIVE_CHANCE_PARAMS;
|
[HeldItemEffect.SURVIVE_CHANCE]: SURVIVE_CHANCE_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.BYPASS_SPEED_CHANCE]: BYPASS_SPEED_CHANCE_PARAMS;
|
[HeldItemEffect.BYPASS_SPEED_CHANCE]: BYPASS_SPEED_CHANCE_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.FLINCH_CHANCE]: FLINCH_CHANCE_PARAMS;
|
[HeldItemEffect.FLINCH_CHANCE]: FLINCH_CHANCE_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.FIELD_EFFECT]: FIELD_EFFECT_PARAMS;
|
[HeldItemEffect.FIELD_EFFECT]: FIELD_EFFECT_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.FRIENDSHIP_BOOSTER]: FRIENDSHIP_BOOST_PARAMS;
|
[HeldItemEffect.FRIENDSHIP_BOOSTER]: FRIENDSHIP_BOOST_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.NATURE_WEIGHT_BOOSTER]: NATURE_WEIGHT_BOOST_PARAMS;
|
[HeldItemEffect.NATURE_WEIGHT_BOOSTER]: NATURE_WEIGHT_BOOST_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.ACCURACY_BOOSTER]: ACCURACY_BOOST_PARAMS;
|
[HeldItemEffect.ACCURACY_BOOSTER]: ACCURACY_BOOST_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.MULTI_HIT]: MULTI_HIT_PARAMS;
|
[HeldItemEffect.MULTI_HIT]: MULTI_HIT_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.DAMAGE_MONEY_REWARD]: DAMAGE_MONEY_REWARD_PARAMS;
|
[HeldItemEffect.DAMAGE_MONEY_REWARD]: DAMAGE_MONEY_REWARD_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.BATON]: BATON_PARAMS;
|
[HeldItemEffect.BATON]: BATON_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.CONTACT_ITEM_STEAL_CHANCE]: ITEM_STEAL_PARAMS;
|
[HeldItemEffect.CONTACT_ITEM_STEAL_CHANCE]: ITEM_STEAL_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.TURN_END_ITEM_STEAL]: ITEM_STEAL_PARAMS;
|
[HeldItemEffect.TURN_END_ITEM_STEAL]: ITEM_STEAL_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.BASE_STAT_TOTAL]: BASE_STAT_TOTAL_PARAMS;
|
[HeldItemEffect.BASE_STAT_TOTAL]: BASE_STAT_TOTAL_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.BASE_STAT_FLAT]: BASE_STAT_FLAT_PARAMS;
|
[HeldItemEffect.BASE_STAT_FLAT]: BASE_STAT_FLAT_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.INCREMENTING_STAT]: INCREMENTING_STAT_PARAMS;
|
[HeldItemEffect.INCREMENTING_STAT]: INCREMENTING_STAT_PARAMS;
|
||||||
[HELD_ITEM_EFFECT.EVO_TRACKER]: EVO_TRACKER_PARAMS;
|
[HeldItemEffect.EVO_TRACKER]: EVO_TRACKER_PARAMS;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function applyHeldItems<T extends HELD_ITEM_EFFECT>(effect: T, params: APPLY_HELD_ITEMS_PARAMS[T]) {
|
export function applyHeldItems<T extends HeldItemEffect>(effect: T, params: APPLY_HELD_ITEMS_PARAMS[T]) {
|
||||||
const pokemon = params.pokemon;
|
const pokemon = params.pokemon;
|
||||||
if (pokemon) {
|
if (pokemon) {
|
||||||
for (const item of Object.keys(pokemon.heldItemManager.heldItems)) {
|
for (const item of Object.keys(pokemon.heldItemManager.heldItems)) {
|
||||||
|
@ -4,7 +4,8 @@ import { globalScene } from "#app/global-scene";
|
|||||||
import { HeldItemNames, type HeldItemId } from "#enums/held-item-id";
|
import { HeldItemNames, type HeldItemId } from "#enums/held-item-id";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
|
||||||
export const HELD_ITEM_EFFECT = {
|
// TODO: this should be moved to its own file
|
||||||
|
export const HeldItemEffect = {
|
||||||
ATTACK_TYPE_BOOST: 1,
|
ATTACK_TYPE_BOOST: 1,
|
||||||
TURN_END_HEAL: 2,
|
TURN_END_HEAL: 2,
|
||||||
HIT_HEAL: 3,
|
HIT_HEAL: 3,
|
||||||
@ -35,7 +36,7 @@ export const HELD_ITEM_EFFECT = {
|
|||||||
INCREMENTING_STAT: 52,
|
INCREMENTING_STAT: 52,
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export type HELD_ITEM_EFFECT = (typeof HELD_ITEM_EFFECT)[keyof typeof HELD_ITEM_EFFECT];
|
export type HeldItemEffect = (typeof HeldItemEffect)[keyof typeof HeldItemEffect];
|
||||||
|
|
||||||
export class HeldItem {
|
export class HeldItem {
|
||||||
// public pokemonId: number;
|
// public pokemonId: number;
|
||||||
|
@ -1,7 +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 { HeldItem, HELD_ITEM_EFFECT } from "../held-item";
|
import { HeldItemEffect, HeldItem } from "../held-item";
|
||||||
|
|
||||||
export interface ACCURACY_BOOST_PARAMS {
|
export interface ACCURACY_BOOST_PARAMS {
|
||||||
/** The pokemon with the item */
|
/** The pokemon with the item */
|
||||||
@ -11,7 +11,7 @@ export interface ACCURACY_BOOST_PARAMS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class AccuracyBoosterHeldItem extends HeldItem {
|
export class AccuracyBoosterHeldItem extends HeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.ACCURACY_BOOSTER];
|
public effects: HeldItemEffect[] = [HeldItemEffect.ACCURACY_BOOSTER];
|
||||||
|
|
||||||
private accuracyAmount: number;
|
private accuracyAmount: number;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ import { PokemonType } from "#enums/pokemon-type";
|
|||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import type { NumberHolder } from "#app/utils/common";
|
import type { NumberHolder } from "#app/utils/common";
|
||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { HeldItem, HELD_ITEM_EFFECT } from "#app/items/held-item";
|
import { HeldItemEffect, HeldItem } from "#app/items/held-item";
|
||||||
|
|
||||||
export interface ATTACK_TYPE_BOOST_PARAMS {
|
export interface ATTACK_TYPE_BOOST_PARAMS {
|
||||||
/** The pokemon with the item */
|
/** The pokemon with the item */
|
||||||
@ -41,7 +41,7 @@ export const attackTypeToHeldItem: AttackTypeToHeldItemMap = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export class AttackTypeBoosterHeldItem extends HeldItem {
|
export class AttackTypeBoosterHeldItem extends HeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.TURN_END_HEAL];
|
public effects: HeldItemEffect[] = [HeldItemEffect.TURN_END_HEAL];
|
||||||
public moveType: PokemonType;
|
public moveType: PokemonType;
|
||||||
public powerBoost: number;
|
public powerBoost: number;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import type Pokemon from "#app/field/pokemon";
|
|||||||
import { HeldItemId } from "#enums/held-item-id";
|
import { HeldItemId } from "#enums/held-item-id";
|
||||||
import { getStatKey, type PermanentStat, Stat } from "#enums/stat";
|
import { getStatKey, type PermanentStat, Stat } from "#enums/stat";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { HeldItem, HELD_ITEM_EFFECT } from "../held-item";
|
import { HeldItemEffect, HeldItem } from "../held-item";
|
||||||
|
|
||||||
export interface BASE_STAT_BOOSTER_PARAMS {
|
export interface BASE_STAT_BOOSTER_PARAMS {
|
||||||
/** The pokemon with the item */
|
/** The pokemon with the item */
|
||||||
@ -33,7 +33,7 @@ export const statBoostItems: Record<PermanentStat, string> = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export class BaseStatBoosterHeldItem extends HeldItem {
|
export class BaseStatBoosterHeldItem extends HeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.BASE_STAT_BOOSTER];
|
public effects: HeldItemEffect[] = [HeldItemEffect.BASE_STAT_BOOSTER];
|
||||||
public stat: PermanentStat;
|
public stat: PermanentStat;
|
||||||
|
|
||||||
constructor(type: HeldItemId, maxStackCount = 1, stat: PermanentStat) {
|
constructor(type: HeldItemId, maxStackCount = 1, stat: PermanentStat) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { HeldItem, HELD_ITEM_EFFECT } from "../held-item";
|
import { HeldItemEffect, HeldItem } from "../held-item";
|
||||||
import { Stat } from "#enums/stat";
|
import { Stat } from "#enums/stat";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ export interface BASE_STAT_FLAT_PARAMS {
|
|||||||
* Currently used by Old Gateau item
|
* Currently used by Old Gateau item
|
||||||
*/
|
*/
|
||||||
export class BaseStatFlatHeldItem extends HeldItem {
|
export class BaseStatFlatHeldItem extends HeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.BASE_STAT_FLAT];
|
public effects: HeldItemEffect[] = [HeldItemEffect.BASE_STAT_FLAT];
|
||||||
public isTransferable = false;
|
public isTransferable = false;
|
||||||
|
|
||||||
get description(): string {
|
get description(): string {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { HeldItem, HELD_ITEM_EFFECT } from "../held-item";
|
import { HeldItemEffect, HeldItem } from "../held-item";
|
||||||
import type { HeldItemId } from "#enums/held-item-id";
|
import type { HeldItemId } from "#enums/held-item-id";
|
||||||
|
|
||||||
export interface BASE_STAT_TOTAL_PARAMS {
|
export interface BASE_STAT_TOTAL_PARAMS {
|
||||||
@ -14,7 +14,7 @@ export interface BASE_STAT_TOTAL_PARAMS {
|
|||||||
* Currently used by Shuckle Juice item
|
* Currently used by Shuckle Juice item
|
||||||
*/
|
*/
|
||||||
export class BaseStatTotalHeldItem extends HeldItem {
|
export class BaseStatTotalHeldItem extends HeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.BASE_STAT_TOTAL];
|
public effects: HeldItemEffect[] = [HeldItemEffect.BASE_STAT_TOTAL];
|
||||||
public isTransferable = false;
|
public isTransferable = false;
|
||||||
public statModifier: number;
|
public statModifier: number;
|
||||||
|
|
||||||
|
@ -1,6 +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 { HeldItem, HELD_ITEM_EFFECT } from "../held-item";
|
import { HeldItemEffect, HeldItem } from "../held-item";
|
||||||
|
|
||||||
export interface BATON_PARAMS {
|
export interface BATON_PARAMS {
|
||||||
/** The pokemon with the item */
|
/** The pokemon with the item */
|
||||||
@ -10,7 +10,7 @@ export interface BATON_PARAMS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class BatonHeldItem extends HeldItem {
|
export class BatonHeldItem extends HeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.BATON];
|
public effects: HeldItemEffect[] = [HeldItemEffect.BATON];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies {@linkcode SwitchEffectTransferModifier}
|
* Applies {@linkcode SwitchEffectTransferModifier}
|
||||||
|
@ -2,7 +2,7 @@ import { getBerryEffectDescription, getBerryEffectFunc, getBerryName, getBerryPr
|
|||||||
import { BerryUsedEvent } from "#app/events/battle-scene";
|
import { BerryUsedEvent } from "#app/events/battle-scene";
|
||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import { ConsumableHeldItem, HELD_ITEM_EFFECT } from "#app/items/held-item";
|
import { ConsumableHeldItem, HeldItemEffect } from "#app/items/held-item";
|
||||||
import { BooleanHolder } from "#app/utils/common";
|
import { BooleanHolder } from "#app/utils/common";
|
||||||
import { BerryType } from "#enums/berry-type";
|
import { BerryType } from "#enums/berry-type";
|
||||||
import { HeldItemId } from "#enums/held-item-id";
|
import { HeldItemId } from "#enums/held-item-id";
|
||||||
@ -33,7 +33,7 @@ export interface BERRY_PARAMS {
|
|||||||
|
|
||||||
// TODO: Maybe split up into subclasses?
|
// TODO: Maybe split up into subclasses?
|
||||||
export class BerryHeldItem extends ConsumableHeldItem {
|
export class BerryHeldItem extends ConsumableHeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.BERRY];
|
public effects: HeldItemEffect[] = [HeldItemEffect.BERRY];
|
||||||
public berryType: BerryType;
|
public berryType: BerryType;
|
||||||
|
|
||||||
constructor(berryType: BerryType, maxStackCount = 1) {
|
constructor(berryType: BerryType, maxStackCount = 1) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { HeldItem, HELD_ITEM_EFFECT } from "#app/items/held-item";
|
import { HeldItemEffect, HeldItem } from "#app/items/held-item";
|
||||||
import type { BooleanHolder } from "#app/utils/common";
|
import type { BooleanHolder } from "#app/utils/common";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
@ -19,7 +19,7 @@ export interface BYPASS_SPEED_CHANCE_PARAMS {
|
|||||||
* @see {@linkcode apply}
|
* @see {@linkcode apply}
|
||||||
*/
|
*/
|
||||||
export class BypassSpeedChanceHeldItem extends HeldItem {
|
export class BypassSpeedChanceHeldItem extends HeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.BYPASS_SPEED_CHANCE];
|
public effects: HeldItemEffect[] = [HeldItemEffect.BYPASS_SPEED_CHANCE];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if {@linkcode BypassSpeedChanceModifier} should be applied
|
* Checks if {@linkcode BypassSpeedChanceModifier} should be applied
|
||||||
|
@ -2,7 +2,7 @@ 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 type { SpeciesId } from "#enums/species-id";
|
import type { SpeciesId } from "#enums/species-id";
|
||||||
import { HeldItem, HELD_ITEM_EFFECT } from "../held-item";
|
import { HeldItemEffect, HeldItem } from "../held-item";
|
||||||
|
|
||||||
export interface CRIT_BOOST_PARAMS {
|
export interface CRIT_BOOST_PARAMS {
|
||||||
/** The pokemon with the item */
|
/** The pokemon with the item */
|
||||||
@ -17,7 +17,7 @@ export interface CRIT_BOOST_PARAMS {
|
|||||||
* @see {@linkcode apply}
|
* @see {@linkcode apply}
|
||||||
*/
|
*/
|
||||||
export class CritBoostHeldItem extends HeldItem {
|
export class CritBoostHeldItem extends HeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.CRIT_BOOST];
|
public effects: HeldItemEffect[] = [HeldItemEffect.CRIT_BOOST];
|
||||||
|
|
||||||
/** The amount of stages by which the held item increases the current critical-hit stage value */
|
/** The amount of stages by which the held item increases the current critical-hit stage value */
|
||||||
protected stageIncrement: number;
|
protected stageIncrement: number;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import { NumberHolder } from "#app/utils/common";
|
import { NumberHolder } from "#app/utils/common";
|
||||||
import { HeldItem, HELD_ITEM_EFFECT } from "../held-item";
|
import { HeldItemEffect, HeldItem } from "../held-item";
|
||||||
import { TRAINER_ITEM_EFFECT } from "../trainer-item";
|
import { TRAINER_ITEM_EFFECT } from "../trainer-item";
|
||||||
|
|
||||||
export interface DAMAGE_MONEY_REWARD_PARAMS {
|
export interface DAMAGE_MONEY_REWARD_PARAMS {
|
||||||
@ -12,7 +12,7 @@ export interface DAMAGE_MONEY_REWARD_PARAMS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class DamageMoneyRewardHeldItem extends HeldItem {
|
export class DamageMoneyRewardHeldItem extends HeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.DAMAGE_MONEY_REWARD];
|
public effects: HeldItemEffect[] = [HeldItemEffect.DAMAGE_MONEY_REWARD];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies {@linkcode DamageMoneyRewardModifier}
|
* Applies {@linkcode DamageMoneyRewardModifier}
|
||||||
|
@ -3,7 +3,7 @@ import { globalScene } from "#app/global-scene";
|
|||||||
import { HeldItemId } from "#enums/held-item-id";
|
import { HeldItemId } from "#enums/held-item-id";
|
||||||
import type { SpeciesId } from "#enums/species-id";
|
import type { SpeciesId } from "#enums/species-id";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { HeldItem, HELD_ITEM_EFFECT } from "../held-item";
|
import { HeldItemEffect, HeldItem } from "../held-item";
|
||||||
import { TrainerItemId } from "#enums/trainer-item-id";
|
import { TrainerItemId } from "#enums/trainer-item-id";
|
||||||
|
|
||||||
export interface EVO_TRACKER_PARAMS {
|
export interface EVO_TRACKER_PARAMS {
|
||||||
@ -12,7 +12,7 @@ export interface EVO_TRACKER_PARAMS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class EvoTrackerHeldItem extends HeldItem {
|
export class EvoTrackerHeldItem extends HeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.EVO_TRACKER];
|
public effects: HeldItemEffect[] = [HeldItemEffect.EVO_TRACKER];
|
||||||
|
|
||||||
protected species: SpeciesId;
|
protected species: SpeciesId;
|
||||||
protected required: number;
|
protected required: number;
|
||||||
|
@ -2,7 +2,7 @@ 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 i18next from "i18next";
|
||||||
import { HeldItem, HELD_ITEM_EFFECT } from "../held-item";
|
import { HeldItemEffect, HeldItem } from "../held-item";
|
||||||
|
|
||||||
export interface EXP_BOOST_PARAMS {
|
export interface EXP_BOOST_PARAMS {
|
||||||
/** The pokemon with the item */
|
/** The pokemon with the item */
|
||||||
@ -12,7 +12,7 @@ export interface EXP_BOOST_PARAMS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class ExpBoosterHeldItem extends HeldItem {
|
export class ExpBoosterHeldItem extends HeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.EXP_BOOSTER];
|
public effects: HeldItemEffect[] = [HeldItemEffect.EXP_BOOSTER];
|
||||||
private boostPercent: number;
|
private boostPercent: number;
|
||||||
private boostMultiplier: number;
|
private boostMultiplier: number;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { HeldItem, HELD_ITEM_EFFECT } from "#app/items/held-item";
|
import { HeldItemEffect, HeldItem } from "#app/items/held-item";
|
||||||
import type { NumberHolder } from "#app/utils/common";
|
import type { NumberHolder } from "#app/utils/common";
|
||||||
|
|
||||||
export interface FIELD_EFFECT_PARAMS {
|
export interface FIELD_EFFECT_PARAMS {
|
||||||
@ -15,7 +15,7 @@ export interface FIELD_EFFECT_PARAMS {
|
|||||||
* @see {@linkcode apply}
|
* @see {@linkcode apply}
|
||||||
*/
|
*/
|
||||||
export class FieldEffectHeldItem extends HeldItem {
|
export class FieldEffectHeldItem extends HeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.FIELD_EFFECT];
|
public effects: HeldItemEffect[] = [HeldItemEffect.FIELD_EFFECT];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides two more turns per stack to any weather or terrain effect caused
|
* Provides two more turns per stack to any weather or terrain effect caused
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { HeldItem, HELD_ITEM_EFFECT } from "#app/items/held-item";
|
import { HeldItemEffect, HeldItem } from "#app/items/held-item";
|
||||||
import type { BooleanHolder } from "#app/utils/common";
|
import type { BooleanHolder } from "#app/utils/common";
|
||||||
import type { HeldItemId } from "#enums/held-item-id";
|
import type { HeldItemId } from "#enums/held-item-id";
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ export interface FLINCH_CHANCE_PARAMS {
|
|||||||
* @see {@linkcode apply}
|
* @see {@linkcode apply}
|
||||||
*/
|
*/
|
||||||
export class FlinchChanceHeldItem extends HeldItem {
|
export class FlinchChanceHeldItem extends HeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.FLINCH_CHANCE];
|
public effects: HeldItemEffect[] = [HeldItemEffect.FLINCH_CHANCE];
|
||||||
private chance: number;
|
private chance: number;
|
||||||
|
|
||||||
constructor(type: HeldItemId, maxStackCount = 1, chance: number) {
|
constructor(type: HeldItemId, maxStackCount = 1, chance: number) {
|
||||||
|
@ -1,7 +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 i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { HeldItem, HELD_ITEM_EFFECT } from "../held-item";
|
import { HeldItemEffect, HeldItem } from "../held-item";
|
||||||
|
|
||||||
export interface FRIENDSHIP_BOOST_PARAMS {
|
export interface FRIENDSHIP_BOOST_PARAMS {
|
||||||
/** The pokemon with the item */
|
/** The pokemon with the item */
|
||||||
@ -11,7 +11,7 @@ export interface FRIENDSHIP_BOOST_PARAMS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class FriendshipBoosterHeldItem extends HeldItem {
|
export class FriendshipBoosterHeldItem extends HeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.FRIENDSHIP_BOOSTER];
|
public effects: HeldItemEffect[] = [HeldItemEffect.FRIENDSHIP_BOOSTER];
|
||||||
|
|
||||||
get description(): string {
|
get description(): string {
|
||||||
return i18next.t("modifierType:ModifierType.PokemonFriendshipBoosterModifierType.description");
|
return i18next.t("modifierType:ModifierType.PokemonFriendshipBoosterModifierType.description");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { HeldItem, HELD_ITEM_EFFECT } from "#app/items/held-item";
|
import { HeldItemEffect, HeldItem } from "#app/items/held-item";
|
||||||
import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
|
import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
|
||||||
import { toDmgValue } from "#app/utils/common";
|
import { toDmgValue } from "#app/utils/common";
|
||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
@ -12,7 +12,7 @@ export interface HIT_HEAL_PARAMS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class HitHealHeldItem extends HeldItem {
|
export class HitHealHeldItem extends HeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.TURN_END_HEAL];
|
public effects: HeldItemEffect[] = [HeldItemEffect.TURN_END_HEAL];
|
||||||
|
|
||||||
get name(): string {
|
get name(): string {
|
||||||
return i18next.t("modifierType:ModifierType.SHELL_BELL.name");
|
return i18next.t("modifierType:ModifierType.SHELL_BELL.name");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { HeldItem, HELD_ITEM_EFFECT } from "../held-item";
|
import { HeldItemEffect, HeldItem } 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";
|
import i18next from "i18next";
|
||||||
@ -16,7 +16,7 @@ export interface INCREMENTING_STAT_PARAMS {
|
|||||||
* Currently used by Macho Brace item
|
* Currently used by Macho Brace item
|
||||||
*/
|
*/
|
||||||
export class IncrementingStatHeldItem extends HeldItem {
|
export class IncrementingStatHeldItem extends HeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.INCREMENTING_STAT];
|
public effects: HeldItemEffect[] = [HeldItemEffect.INCREMENTING_STAT];
|
||||||
public isTransferable = false;
|
public isTransferable = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { ConsumableHeldItem, HELD_ITEM_EFFECT } from "../held-item";
|
import { ConsumableHeldItem, HeldItemEffect } from "../held-item";
|
||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
|
import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
|
||||||
import { toDmgValue } from "#app/utils/common";
|
import { toDmgValue } from "#app/utils/common";
|
||||||
@ -19,7 +19,7 @@ export interface INSTANT_REVIVE_PARAMS {
|
|||||||
* @see {@linkcode apply}
|
* @see {@linkcode apply}
|
||||||
*/
|
*/
|
||||||
export class InstantReviveHeldItem extends ConsumableHeldItem {
|
export class InstantReviveHeldItem extends ConsumableHeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.INSTANT_REVIVE];
|
public effects: HeldItemEffect[] = [HeldItemEffect.INSTANT_REVIVE];
|
||||||
|
|
||||||
get name(): string {
|
get name(): string {
|
||||||
return i18next.t("modifierType:ModifierType.REVIVER_SEED.name");
|
return i18next.t("modifierType:ModifierType.REVIVER_SEED.name");
|
||||||
|
@ -2,7 +2,7 @@ import Pokemon from "#app/field/pokemon";
|
|||||||
import { randSeedFloat } from "#app/utils/common";
|
import { randSeedFloat } 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 i18next from "i18next";
|
||||||
import { HeldItem, HELD_ITEM_EFFECT } from "../held-item";
|
import { HeldItemEffect, HeldItem } from "../held-item";
|
||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
import { allHeldItems } from "../all-held-items";
|
import { allHeldItems } from "../all-held-items";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
@ -83,7 +83,7 @@ export abstract class ItemTransferHeldItem extends HeldItem {
|
|||||||
* @see {@linkcode modifierTypes[MINI_BLACK_HOLE]}
|
* @see {@linkcode modifierTypes[MINI_BLACK_HOLE]}
|
||||||
*/
|
*/
|
||||||
export class TurnEndItemStealHeldItem extends ItemTransferHeldItem {
|
export class TurnEndItemStealHeldItem extends ItemTransferHeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.TURN_END_ITEM_STEAL];
|
public effects: HeldItemEffect[] = [HeldItemEffect.TURN_END_ITEM_STEAL];
|
||||||
isTransferable = true;
|
isTransferable = true;
|
||||||
|
|
||||||
get description(): string {
|
get description(): string {
|
||||||
@ -125,7 +125,7 @@ export class TurnEndItemStealHeldItem extends ItemTransferHeldItem {
|
|||||||
* @see {@linkcode HeldItemTransferModifier}
|
* @see {@linkcode HeldItemTransferModifier}
|
||||||
*/
|
*/
|
||||||
export class ContactItemStealChanceHeldItem extends ItemTransferHeldItem {
|
export class ContactItemStealChanceHeldItem extends ItemTransferHeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.CONTACT_ITEM_STEAL_CHANCE];
|
public effects: HeldItemEffect[] = [HeldItemEffect.CONTACT_ITEM_STEAL_CHANCE];
|
||||||
public readonly chancePercent: number;
|
public readonly chancePercent: number;
|
||||||
public readonly chance: number;
|
public readonly chance: number;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { HeldItem, HELD_ITEM_EFFECT } from "#app/items/held-item";
|
import { HeldItemEffect, HeldItem } 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";
|
||||||
@ -19,7 +19,7 @@ export interface MULTI_HIT_PARAMS {
|
|||||||
* @see {@linkcode apply}
|
* @see {@linkcode apply}
|
||||||
*/
|
*/
|
||||||
export class MultiHitHeldItem extends HeldItem {
|
export class MultiHitHeldItem extends HeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.MULTI_HIT];
|
public effects: HeldItemEffect[] = [HeldItemEffect.MULTI_HIT];
|
||||||
|
|
||||||
get description(): string {
|
get description(): string {
|
||||||
return i18next.t("modifierType:ModifierType.PokemonMultiHitModifierType.description");
|
return i18next.t("modifierType:ModifierType.PokemonMultiHitModifierType.description");
|
||||||
|
@ -1,6 +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 { HeldItem, HELD_ITEM_EFFECT } from "../held-item";
|
import { HeldItemEffect, HeldItem } from "../held-item";
|
||||||
|
|
||||||
export interface NATURE_WEIGHT_BOOST_PARAMS {
|
export interface NATURE_WEIGHT_BOOST_PARAMS {
|
||||||
/** The pokemon with the item */
|
/** The pokemon with the item */
|
||||||
@ -10,7 +10,7 @@ export interface NATURE_WEIGHT_BOOST_PARAMS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class NatureWeightBoosterHeldItem extends HeldItem {
|
export class NatureWeightBoosterHeldItem extends HeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.NATURE_WEIGHT_BOOSTER];
|
public effects: HeldItemEffect[] = [HeldItemEffect.NATURE_WEIGHT_BOOSTER];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies {@linkcode PokemonNatureWeightModifier}
|
* Applies {@linkcode PokemonNatureWeightModifier}
|
||||||
|
@ -2,7 +2,7 @@ import type Pokemon from "#app/field/pokemon";
|
|||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import { BATTLE_STATS } from "#enums/stat";
|
import { BATTLE_STATS } from "#enums/stat";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { ConsumableHeldItem, HELD_ITEM_EFFECT } from "../held-item";
|
import { ConsumableHeldItem, HeldItemEffect } from "../held-item";
|
||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
|
|
||||||
export interface RESET_NEGATIVE_STAT_STAGE_PARAMS {
|
export interface RESET_NEGATIVE_STAT_STAGE_PARAMS {
|
||||||
@ -19,7 +19,7 @@ export interface RESET_NEGATIVE_STAT_STAGE_PARAMS {
|
|||||||
* @see {@linkcode apply}
|
* @see {@linkcode apply}
|
||||||
*/
|
*/
|
||||||
export class ResetNegativeStatStageHeldItem extends ConsumableHeldItem {
|
export class ResetNegativeStatStageHeldItem extends ConsumableHeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.RESET_NEGATIVE_STAT_STAGE];
|
public effects: HeldItemEffect[] = [HeldItemEffect.RESET_NEGATIVE_STAT_STAGE];
|
||||||
|
|
||||||
get name(): string {
|
get name(): string {
|
||||||
return i18next.t("modifierType:ModifierType.WHITE_HERB.name");
|
return i18next.t("modifierType:ModifierType.WHITE_HERB.name");
|
||||||
|
@ -4,7 +4,7 @@ import type { NumberHolder } from "#app/utils/common";
|
|||||||
import { HeldItemId } from "#enums/held-item-id";
|
import { HeldItemId } from "#enums/held-item-id";
|
||||||
import type { SpeciesId } from "#enums/species-id";
|
import type { SpeciesId } from "#enums/species-id";
|
||||||
import type { Stat } from "#enums/stat";
|
import type { Stat } from "#enums/stat";
|
||||||
import { HeldItem, HELD_ITEM_EFFECT } from "../held-item";
|
import { HeldItemEffect, HeldItem } from "../held-item";
|
||||||
|
|
||||||
export interface STAT_BOOST_PARAMS {
|
export interface STAT_BOOST_PARAMS {
|
||||||
/** The pokemon with the item */
|
/** The pokemon with the item */
|
||||||
@ -20,7 +20,7 @@ export interface STAT_BOOST_PARAMS {
|
|||||||
* @see {@linkcode apply}
|
* @see {@linkcode apply}
|
||||||
*/
|
*/
|
||||||
export class StatBoostHeldItem extends HeldItem {
|
export class StatBoostHeldItem extends HeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.STAT_BOOST];
|
public effects: HeldItemEffect[] = [HeldItemEffect.STAT_BOOST];
|
||||||
/** The stats that the held item boosts */
|
/** The stats that the held item boosts */
|
||||||
protected stats: Stat[];
|
protected stats: Stat[];
|
||||||
/** The multiplier used to increase the relevant stat(s) */
|
/** The multiplier used to increase the relevant stat(s) */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { HeldItem, HELD_ITEM_EFFECT } from "#app/items/held-item";
|
import { HeldItemEffect, HeldItem } from "#app/items/held-item";
|
||||||
import type { BooleanHolder } from "#app/utils/common";
|
import type { BooleanHolder } from "#app/utils/common";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
@ -18,7 +18,7 @@ export interface SURVIVE_CHANCE_PARAMS {
|
|||||||
* @see {@linkcode apply}
|
* @see {@linkcode apply}
|
||||||
*/
|
*/
|
||||||
export class SurviveChanceHeldItem extends HeldItem {
|
export class SurviveChanceHeldItem extends HeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.SURVIVE_CHANCE];
|
public effects: HeldItemEffect[] = [HeldItemEffect.SURVIVE_CHANCE];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the {@linkcode SurviveDamageModifier} should be applied
|
* Checks if the {@linkcode SurviveDamageModifier} should be applied
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { HeldItem, HELD_ITEM_EFFECT } from "#app/items/held-item";
|
import { HeldItemEffect, HeldItem } from "#app/items/held-item";
|
||||||
import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
|
import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
|
||||||
import { toDmgValue } from "#app/utils/common";
|
import { toDmgValue } from "#app/utils/common";
|
||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
@ -12,7 +12,7 @@ export interface TURN_END_HEAL_PARAMS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class TurnEndHealHeldItem extends HeldItem {
|
export class TurnEndHealHeldItem extends HeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.TURN_END_HEAL];
|
public effects: HeldItemEffect[] = [HeldItemEffect.TURN_END_HEAL];
|
||||||
|
|
||||||
apply(params: TURN_END_HEAL_PARAMS): boolean {
|
apply(params: TURN_END_HEAL_PARAMS): boolean {
|
||||||
const pokemon = params.pokemon;
|
const pokemon = params.pokemon;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { HeldItem, HELD_ITEM_EFFECT } from "#app/items/held-item";
|
import { HeldItemEffect, HeldItem } from "#app/items/held-item";
|
||||||
import type { StatusEffect } from "#enums/status-effect";
|
import type { StatusEffect } from "#enums/status-effect";
|
||||||
import type { HeldItemId } from "#enums/held-item-id";
|
import type { HeldItemId } from "#enums/held-item-id";
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ export interface TURN_END_STATUS_PARAMS {
|
|||||||
* @see {@linkcode apply}
|
* @see {@linkcode apply}
|
||||||
*/
|
*/
|
||||||
export class TurnEndStatusHeldItem extends HeldItem {
|
export class TurnEndStatusHeldItem extends HeldItem {
|
||||||
public effects: HELD_ITEM_EFFECT[] = [HELD_ITEM_EFFECT.TURN_END_STATUS];
|
public effects: HeldItemEffect[] = [HeldItemEffect.TURN_END_STATUS];
|
||||||
/** The status effect to be applied by the held item */
|
/** The status effect to be applied by the held item */
|
||||||
public effect: StatusEffect;
|
public effect: StatusEffect;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import { FieldPhase } from "./field-phase";
|
|||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { allHeldItems, applyHeldItems } from "#app/items/all-held-items";
|
import { allHeldItems, applyHeldItems } from "#app/items/all-held-items";
|
||||||
import { HELD_ITEM_EFFECT } from "#app/items/held-item";
|
import { HeldItemEffect } from "#app/items/held-item";
|
||||||
import { HeldItemCategoryId, isItemInCategory } from "#enums/held-item-id";
|
import { HeldItemCategoryId, isItemInCategory } from "#enums/held-item-id";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,7 +59,7 @@ export class BerryPhase extends FieldPhase {
|
|||||||
CommonAnim.USE_ITEM,
|
CommonAnim.USE_ITEM,
|
||||||
);
|
);
|
||||||
|
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.BERRY, { pokemon: pokemon });
|
applyHeldItems(HeldItemEffect.BERRY, { pokemon: pokemon });
|
||||||
globalScene.updateItems(pokemon.isPlayer());
|
globalScene.updateItems(pokemon.isPlayer());
|
||||||
|
|
||||||
// AbilityId.CHEEK_POUCH only works once per round of nom noms
|
// AbilityId.CHEEK_POUCH only works once per round of nom noms
|
||||||
|
@ -21,7 +21,7 @@ import { isNullOrUndefined } from "#app/utils/common";
|
|||||||
import { FRIENDSHIP_LOSS_FROM_FAINT } from "#app/data/balance/starters";
|
import { FRIENDSHIP_LOSS_FROM_FAINT } from "#app/data/balance/starters";
|
||||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
import { applyHeldItems } from "#app/items/all-held-items";
|
import { applyHeldItems } from "#app/items/all-held-items";
|
||||||
import { HELD_ITEM_EFFECT } from "#app/items/held-item";
|
import { HeldItemEffect } from "#app/items/held-item";
|
||||||
|
|
||||||
export class FaintPhase extends PokemonPhase {
|
export class FaintPhase extends PokemonPhase {
|
||||||
public readonly phaseName = "FaintPhase";
|
public readonly phaseName = "FaintPhase";
|
||||||
@ -55,7 +55,7 @@ export class FaintPhase extends PokemonPhase {
|
|||||||
faintPokemon.resetSummonData();
|
faintPokemon.resetSummonData();
|
||||||
|
|
||||||
if (!this.preventInstantRevive) {
|
if (!this.preventInstantRevive) {
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.INSTANT_REVIVE, { pokemon: faintPokemon });
|
applyHeldItems(HeldItemEffect.INSTANT_REVIVE, { pokemon: faintPokemon });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,7 +41,7 @@ import type Move from "#app/data/moves/move";
|
|||||||
import { isFieldTargeted } from "#app/data/moves/move-utils";
|
import { isFieldTargeted } from "#app/data/moves/move-utils";
|
||||||
import { DamageAchv } from "#app/system/achv";
|
import { DamageAchv } from "#app/system/achv";
|
||||||
import { applyHeldItems } from "#app/items/all-held-items";
|
import { applyHeldItems } from "#app/items/all-held-items";
|
||||||
import { HELD_ITEM_EFFECT } from "#app/items/held-item";
|
import { HeldItemEffect } from "#app/items/held-item";
|
||||||
import { isVirtual, isReflected, MoveUseMode } from "#enums/move-use-mode";
|
import { isVirtual, isReflected, MoveUseMode } from "#enums/move-use-mode";
|
||||||
import { TRAINER_ITEM_EFFECT } from "#app/items/trainer-item";
|
import { TRAINER_ITEM_EFFECT } from "#app/items/trainer-item";
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ export class MoveEffectPhase extends PokemonPhase {
|
|||||||
// If Parental Bond is applicable, add another hit
|
// If Parental Bond is applicable, add another hit
|
||||||
applyAbAttrs("AddSecondStrikeAbAttr", { pokemon: user, move, hitCount });
|
applyAbAttrs("AddSecondStrikeAbAttr", { pokemon: user, move, hitCount });
|
||||||
// If Multi-Lens is applicable, add hits equal to the number of held Multi-Lenses
|
// If Multi-Lens is applicable, add hits equal to the number of held Multi-Lenses
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.MULTI_HIT, { pokemon: user, moveId: move.id, count: hitCount });
|
applyHeldItems(HeldItemEffect.MULTI_HIT, { pokemon: user, moveId: move.id, count: hitCount });
|
||||||
// Set the user's relevant turnData fields to reflect the final hit count
|
// Set the user's relevant turnData fields to reflect the final hit count
|
||||||
user.turnData.hitCount = hitCount.value;
|
user.turnData.hitCount = hitCount.value;
|
||||||
user.turnData.hitsLeft = hitCount.value;
|
user.turnData.hitsLeft = hitCount.value;
|
||||||
@ -413,7 +413,7 @@ export class MoveEffectPhase extends PokemonPhase {
|
|||||||
globalScene.phaseManager.queueMessage(i18next.t("battle:attackHitsCount", { count: hitsTotal }));
|
globalScene.phaseManager.queueMessage(i18next.t("battle:attackHitsCount", { count: hitsTotal }));
|
||||||
}
|
}
|
||||||
|
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.HIT_HEAL, { pokemon: user });
|
applyHeldItems(HeldItemEffect.HIT_HEAL, { pokemon: user });
|
||||||
this.getTargets().forEach(target => {
|
this.getTargets().forEach(target => {
|
||||||
target.turnData.moveEffectiveness = null;
|
target.turnData.moveEffectiveness = null;
|
||||||
});
|
});
|
||||||
@ -455,7 +455,7 @@ export class MoveEffectPhase extends PokemonPhase {
|
|||||||
!this.move.hitsSubstitute(user, target)
|
!this.move.hitsSubstitute(user, target)
|
||||||
) {
|
) {
|
||||||
const flinched = new BooleanHolder(false);
|
const flinched = new BooleanHolder(false);
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.FLINCH_CHANCE, { pokemon: user, flinched: flinched });
|
applyHeldItems(HeldItemEffect.FLINCH_CHANCE, { pokemon: user, flinched: flinched });
|
||||||
if (flinched.value) {
|
if (flinched.value) {
|
||||||
target.addTag(BattlerTagType.FLINCHED, undefined, this.move.id, user.id);
|
target.addTag(BattlerTagType.FLINCHED, undefined, this.move.id, user.id);
|
||||||
}
|
}
|
||||||
@ -900,7 +900,7 @@ export class MoveEffectPhase extends PokemonPhase {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (user.isPlayer() && target.isEnemy()) {
|
if (user.isPlayer() && target.isEnemy()) {
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.DAMAGE_MONEY_REWARD, { pokemon: user, damage: damage });
|
applyHeldItems(HeldItemEffect.DAMAGE_MONEY_REWARD, { pokemon: user, damage: damage });
|
||||||
}
|
}
|
||||||
|
|
||||||
return [result, isCritical];
|
return [result, isCritical];
|
||||||
@ -1013,7 +1013,7 @@ export class MoveEffectPhase extends PokemonPhase {
|
|||||||
|
|
||||||
// Apply Grip Claw's chance to steal an item from the target
|
// Apply Grip Claw's chance to steal an item from the target
|
||||||
if (this.move.is("AttackMove")) {
|
if (this.move.is("AttackMove")) {
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.CONTACT_ITEM_STEAL_CHANCE, { pokemon: user, target: target });
|
applyHeldItems(HeldItemEffect.CONTACT_ITEM_STEAL_CHANCE, { pokemon: user, target: target });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import { Stat, type BattleStat, getStatKey, getStatStageChangeDescriptionKey } f
|
|||||||
import { OctolockTag } from "#app/data/battler-tags";
|
import { OctolockTag } from "#app/data/battler-tags";
|
||||||
import { ArenaTagType } from "#app/enums/arena-tag-type";
|
import { ArenaTagType } from "#app/enums/arena-tag-type";
|
||||||
import { applyHeldItems } from "#app/items/all-held-items";
|
import { applyHeldItems } from "#app/items/all-held-items";
|
||||||
import { HELD_ITEM_EFFECT } from "#app/items/held-item";
|
import { HeldItemEffect } from "#app/items/held-item";
|
||||||
import type {
|
import type {
|
||||||
ConditionalUserFieldProtectStatAbAttrParams,
|
ConditionalUserFieldProtectStatAbAttrParams,
|
||||||
PreStatStageChangeAbAttrParams,
|
PreStatStageChangeAbAttrParams,
|
||||||
@ -236,7 +236,7 @@ export class StatStageChangePhase extends PokemonPhase {
|
|||||||
);
|
);
|
||||||
if (!existingPhase?.is("StatStageChangePhase")) {
|
if (!existingPhase?.is("StatStageChangePhase")) {
|
||||||
// Apply White Herb if needed
|
// Apply White Herb if needed
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.RESET_NEGATIVE_STAT_STAGE, { pokemon: pokemon, isPlayer: this.player });
|
applyHeldItems(HeldItemEffect.RESET_NEGATIVE_STAT_STAGE, { pokemon: pokemon, isPlayer: this.player });
|
||||||
}
|
}
|
||||||
|
|
||||||
pokemon.updateInfo();
|
pokemon.updateInfo();
|
||||||
|
@ -9,7 +9,7 @@ import i18next from "i18next";
|
|||||||
import { FieldPhase } from "./field-phase";
|
import { FieldPhase } from "./field-phase";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import { applyHeldItems } from "#app/items/all-held-items";
|
import { applyHeldItems } from "#app/items/all-held-items";
|
||||||
import { HELD_ITEM_EFFECT } from "#app/items/held-item";
|
import { HeldItemEffect } from "#app/items/held-item";
|
||||||
import { TRAINER_ITEM_EFFECT } from "#app/items/trainer-item";
|
import { TRAINER_ITEM_EFFECT } from "#app/items/trainer-item";
|
||||||
|
|
||||||
export class TurnEndPhase extends FieldPhase {
|
export class TurnEndPhase extends FieldPhase {
|
||||||
@ -26,7 +26,7 @@ export class TurnEndPhase extends FieldPhase {
|
|||||||
if (!pokemon.switchOutStatus) {
|
if (!pokemon.switchOutStatus) {
|
||||||
pokemon.lapseTags(BattlerTagLapseType.TURN_END);
|
pokemon.lapseTags(BattlerTagLapseType.TURN_END);
|
||||||
|
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.TURN_END_HEAL, { pokemon: pokemon });
|
applyHeldItems(HeldItemEffect.TURN_END_HEAL, { pokemon: pokemon });
|
||||||
|
|
||||||
if (globalScene.arena.terrain?.terrainType === TerrainType.GRASSY && pokemon.isGrounded()) {
|
if (globalScene.arena.terrain?.terrainType === TerrainType.GRASSY && pokemon.isGrounded()) {
|
||||||
globalScene.phaseManager.unshiftNew(
|
globalScene.phaseManager.unshiftNew(
|
||||||
@ -48,9 +48,9 @@ export class TurnEndPhase extends FieldPhase {
|
|||||||
applyAbAttrs("PostTurnAbAttr", { pokemon });
|
applyAbAttrs("PostTurnAbAttr", { pokemon });
|
||||||
}
|
}
|
||||||
|
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.TURN_END_STATUS, { pokemon: pokemon });
|
applyHeldItems(HeldItemEffect.TURN_END_STATUS, { pokemon: pokemon });
|
||||||
|
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.TURN_END_ITEM_STEAL, { pokemon: pokemon });
|
applyHeldItems(HeldItemEffect.TURN_END_ITEM_STEAL, { pokemon: pokemon });
|
||||||
|
|
||||||
pokemon.tempSummonData.turnCount++;
|
pokemon.tempSummonData.turnCount++;
|
||||||
pokemon.tempSummonData.waveTurnCount++;
|
pokemon.tempSummonData.waveTurnCount++;
|
||||||
|
@ -10,7 +10,7 @@ import { BattlerIndex } from "#enums/battler-index";
|
|||||||
import { TrickRoomTag } from "#app/data/arena-tag";
|
import { TrickRoomTag } from "#app/data/arena-tag";
|
||||||
import { SwitchType } from "#enums/switch-type";
|
import { SwitchType } from "#enums/switch-type";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import { HELD_ITEM_EFFECT } from "#app/items/held-item";
|
import { HeldItemEffect } from "#app/items/held-item";
|
||||||
import { applyHeldItems } from "#app/items/all-held-items";
|
import { applyHeldItems } from "#app/items/all-held-items";
|
||||||
|
|
||||||
export class TurnStartPhase extends FieldPhase {
|
export class TurnStartPhase extends FieldPhase {
|
||||||
@ -73,7 +73,7 @@ export class TurnStartPhase extends FieldPhase {
|
|||||||
canCheckHeldItems: canCheckHeldItems,
|
canCheckHeldItems: canCheckHeldItems,
|
||||||
});
|
});
|
||||||
if (canCheckHeldItems.value) {
|
if (canCheckHeldItems.value) {
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.BYPASS_SPEED_CHANCE, { pokemon: p, doBypassSpeed: bypassSpeed });
|
applyHeldItems(HeldItemEffect.BYPASS_SPEED_CHANCE, { pokemon: p, doBypassSpeed: bypassSpeed });
|
||||||
}
|
}
|
||||||
battlerBypassSpeed[p.getBattlerIndex()] = bypassSpeed;
|
battlerBypassSpeed[p.getBattlerIndex()] = bypassSpeed;
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { applyHeldItems } from "#app/items/all-held-items";
|
import { applyHeldItems } from "#app/items/all-held-items";
|
||||||
import { HELD_ITEM_EFFECT } from "#app/items/held-item";
|
import { HeldItemEffect } from "#app/items/held-item";
|
||||||
import { NumberHolder, randItem } from "#app/utils/common";
|
import { NumberHolder, randItem } from "#app/utils/common";
|
||||||
import { HeldItemId } from "#enums/held-item-id";
|
import { HeldItemId } from "#enums/held-item-id";
|
||||||
import { SpeciesId } from "#enums/species-id";
|
import { SpeciesId } from "#enums/species-id";
|
||||||
@ -34,7 +34,7 @@ describe("Items - Eviolite", () => {
|
|||||||
|
|
||||||
vi.spyOn(partyMember, "getEffectiveStat").mockImplementation((stat, _opponent?, _move?, _isCritical?) => {
|
vi.spyOn(partyMember, "getEffectiveStat").mockImplementation((stat, _opponent?, _move?, _isCritical?) => {
|
||||||
const statValue = new NumberHolder(partyMember.getStat(stat, false));
|
const statValue = new NumberHolder(partyMember.getStat(stat, false));
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: stat, statValue: statValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: stat, statValue: statValue });
|
||||||
|
|
||||||
return Math.floor(statValue.value);
|
return Math.floor(statValue.value);
|
||||||
});
|
});
|
||||||
@ -53,7 +53,7 @@ describe("Items - Eviolite", () => {
|
|||||||
|
|
||||||
vi.spyOn(partyMember, "getEffectiveStat").mockImplementation((stat, _opponent?, _move?, _isCritical?) => {
|
vi.spyOn(partyMember, "getEffectiveStat").mockImplementation((stat, _opponent?, _move?, _isCritical?) => {
|
||||||
const statValue = new NumberHolder(partyMember.getStat(stat, false));
|
const statValue = new NumberHolder(partyMember.getStat(stat, false));
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: stat, statValue: statValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: stat, statValue: statValue });
|
||||||
|
|
||||||
// Ignore other calculations for simplicity
|
// Ignore other calculations for simplicity
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ describe("Items - Eviolite", () => {
|
|||||||
|
|
||||||
vi.spyOn(partyMember, "getEffectiveStat").mockImplementation((stat, _opponent?, _move?, _isCritical?) => {
|
vi.spyOn(partyMember, "getEffectiveStat").mockImplementation((stat, _opponent?, _move?, _isCritical?) => {
|
||||||
const statValue = new NumberHolder(partyMember.getStat(stat, false));
|
const statValue = new NumberHolder(partyMember.getStat(stat, false));
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: stat, statValue: statValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: stat, statValue: statValue });
|
||||||
|
|
||||||
// Ignore other calculations for simplicity
|
// Ignore other calculations for simplicity
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ describe("Items - Eviolite", () => {
|
|||||||
|
|
||||||
vi.spyOn(partyMember, "getEffectiveStat").mockImplementation((stat, _opponent?, _move?, _isCritical?) => {
|
vi.spyOn(partyMember, "getEffectiveStat").mockImplementation((stat, _opponent?, _move?, _isCritical?) => {
|
||||||
const statValue = new NumberHolder(partyMember.getStat(stat, false));
|
const statValue = new NumberHolder(partyMember.getStat(stat, false));
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: stat, statValue: statValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: stat, statValue: statValue });
|
||||||
|
|
||||||
// Ignore other calculations for simplicity
|
// Ignore other calculations for simplicity
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ describe("Items - Eviolite", () => {
|
|||||||
|
|
||||||
vi.spyOn(partyMember, "getEffectiveStat").mockImplementation((stat, _opponent?, _move?, _isCritical?) => {
|
vi.spyOn(partyMember, "getEffectiveStat").mockImplementation((stat, _opponent?, _move?, _isCritical?) => {
|
||||||
const statValue = new NumberHolder(partyMember.getStat(stat, false));
|
const statValue = new NumberHolder(partyMember.getStat(stat, false));
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: stat, statValue: statValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: stat, statValue: statValue });
|
||||||
|
|
||||||
// Ignore other calculations for simplicity
|
// Ignore other calculations for simplicity
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ describe("Items - Eviolite", () => {
|
|||||||
|
|
||||||
vi.spyOn(partyMember, "getEffectiveStat").mockImplementation((stat, _opponent?, _move?, _isCritical?) => {
|
vi.spyOn(partyMember, "getEffectiveStat").mockImplementation((stat, _opponent?, _move?, _isCritical?) => {
|
||||||
const statValue = new NumberHolder(partyMember.getStat(stat, false));
|
const statValue = new NumberHolder(partyMember.getStat(stat, false));
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: stat, statValue: statValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: stat, statValue: statValue });
|
||||||
|
|
||||||
// Ignore other calculations for simplicity
|
// Ignore other calculations for simplicity
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ describe("Items - Eviolite", () => {
|
|||||||
|
|
||||||
vi.spyOn(partyMember, "getEffectiveStat").mockImplementation((stat, _opponent?, _move?, _isCritical?) => {
|
vi.spyOn(partyMember, "getEffectiveStat").mockImplementation((stat, _opponent?, _move?, _isCritical?) => {
|
||||||
const statValue = new NumberHolder(partyMember.getStat(stat, false));
|
const statValue = new NumberHolder(partyMember.getStat(stat, false));
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: stat, statValue: statValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: stat, statValue: statValue });
|
||||||
|
|
||||||
// Ignore other calculations for simplicity
|
// Ignore other calculations for simplicity
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import Phase from "phaser";
|
|||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||||
import { HeldItemId } from "#enums/held-item-id";
|
import { HeldItemId } from "#enums/held-item-id";
|
||||||
import { applyHeldItems } from "#app/items/all-held-items";
|
import { applyHeldItems } from "#app/items/all-held-items";
|
||||||
import { HELD_ITEM_EFFECT } from "#app/items/held-item";
|
import { HeldItemEffect } from "#app/items/held-item";
|
||||||
|
|
||||||
describe("EXP Modifier Items", () => {
|
describe("EXP Modifier Items", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
@ -34,7 +34,7 @@ describe("EXP Modifier Items", () => {
|
|||||||
const partyMember = game.scene.getPlayerPokemon()!;
|
const partyMember = game.scene.getPlayerPokemon()!;
|
||||||
partyMember.exp = 100;
|
partyMember.exp = 100;
|
||||||
const expHolder = new NumberHolder(partyMember.exp);
|
const expHolder = new NumberHolder(partyMember.exp);
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.EXP_BOOSTER, { pokemon: partyMember, expAmount: expHolder });
|
applyHeldItems(HeldItemEffect.EXP_BOOSTER, { pokemon: partyMember, expAmount: expHolder });
|
||||||
expect(expHolder.value).toBe(440);
|
expect(expHolder.value).toBe(440);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -7,7 +7,7 @@ import Phase from "phaser";
|
|||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
import { HeldItemId } from "#enums/held-item-id";
|
import { HeldItemId } from "#enums/held-item-id";
|
||||||
import { applyHeldItems } from "#app/items/all-held-items";
|
import { applyHeldItems } from "#app/items/all-held-items";
|
||||||
import { HELD_ITEM_EFFECT } from "#app/items/held-item";
|
import { HeldItemEffect } from "#app/items/held-item";
|
||||||
|
|
||||||
describe("Items - Light Ball", () => {
|
describe("Items - Light Ball", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
@ -92,17 +92,17 @@ describe("Items - Light Ball", () => {
|
|||||||
|
|
||||||
// Making sure modifier is not applied without holding item
|
// Making sure modifier is not applied without holding item
|
||||||
const atkValue = new NumberHolder(atkStat);
|
const atkValue = new NumberHolder(atkStat);
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: Stat.DEF, statValue: atkValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.DEF, statValue: atkValue });
|
||||||
const spAtkValue = new NumberHolder(spAtkStat);
|
const spAtkValue = new NumberHolder(spAtkStat);
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPDEF, statValue: spAtkValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPDEF, statValue: spAtkValue });
|
||||||
expect(atkValue.value / atkStat).toBe(1);
|
expect(atkValue.value / atkStat).toBe(1);
|
||||||
expect(spAtkValue.value / spAtkStat).toBe(1);
|
expect(spAtkValue.value / spAtkStat).toBe(1);
|
||||||
|
|
||||||
// Giving Light Ball to party member and testing if it applies
|
// Giving Light Ball to party member and testing if it applies
|
||||||
partyMember.heldItemManager.add(HeldItemId.LIGHT_BALL);
|
partyMember.heldItemManager.add(HeldItemId.LIGHT_BALL);
|
||||||
|
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: Stat.ATK, statValue: atkValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.ATK, statValue: atkValue });
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPATK, statValue: spAtkValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPATK, statValue: spAtkValue });
|
||||||
|
|
||||||
expect(atkValue.value / atkStat).toBe(2);
|
expect(atkValue.value / atkStat).toBe(2);
|
||||||
expect(spAtkValue.value / spAtkStat).toBe(2);
|
expect(spAtkValue.value / spAtkStat).toBe(2);
|
||||||
@ -128,9 +128,9 @@ describe("Items - Light Ball", () => {
|
|||||||
|
|
||||||
// Making sure modifier is not applied without holding item
|
// Making sure modifier is not applied without holding item
|
||||||
const atkValue = new NumberHolder(atkStat);
|
const atkValue = new NumberHolder(atkStat);
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: Stat.DEF, statValue: atkValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.DEF, statValue: atkValue });
|
||||||
const spAtkValue = new NumberHolder(spAtkStat);
|
const spAtkValue = new NumberHolder(spAtkStat);
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPDEF, statValue: spAtkValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPDEF, statValue: spAtkValue });
|
||||||
|
|
||||||
expect(atkValue.value / atkStat).toBe(1);
|
expect(atkValue.value / atkStat).toBe(1);
|
||||||
expect(spAtkValue.value / spAtkStat).toBe(1);
|
expect(spAtkValue.value / spAtkStat).toBe(1);
|
||||||
@ -138,8 +138,8 @@ describe("Items - Light Ball", () => {
|
|||||||
// Giving Light Ball to party member and testing if it applies
|
// Giving Light Ball to party member and testing if it applies
|
||||||
partyMember.heldItemManager.add(HeldItemId.LIGHT_BALL);
|
partyMember.heldItemManager.add(HeldItemId.LIGHT_BALL);
|
||||||
|
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: Stat.ATK, statValue: atkValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.ATK, statValue: atkValue });
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPATK, statValue: spAtkValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPATK, statValue: spAtkValue });
|
||||||
|
|
||||||
expect(atkValue.value / atkStat).toBe(2);
|
expect(atkValue.value / atkStat).toBe(2);
|
||||||
expect(spAtkValue.value / spAtkStat).toBe(2);
|
expect(spAtkValue.value / spAtkStat).toBe(2);
|
||||||
@ -165,9 +165,9 @@ describe("Items - Light Ball", () => {
|
|||||||
|
|
||||||
// Making sure modifier is not applied without holding item
|
// Making sure modifier is not applied without holding item
|
||||||
const atkValue = new NumberHolder(atkStat);
|
const atkValue = new NumberHolder(atkStat);
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: Stat.DEF, statValue: atkValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.DEF, statValue: atkValue });
|
||||||
const spAtkValue = new NumberHolder(spAtkStat);
|
const spAtkValue = new NumberHolder(spAtkStat);
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPDEF, statValue: spAtkValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPDEF, statValue: spAtkValue });
|
||||||
|
|
||||||
expect(atkValue.value / atkStat).toBe(1);
|
expect(atkValue.value / atkStat).toBe(1);
|
||||||
expect(spAtkValue.value / spAtkStat).toBe(1);
|
expect(spAtkValue.value / spAtkStat).toBe(1);
|
||||||
@ -175,8 +175,8 @@ describe("Items - Light Ball", () => {
|
|||||||
// Giving Light Ball to party member and testing if it applies
|
// Giving Light Ball to party member and testing if it applies
|
||||||
partyMember.heldItemManager.add(HeldItemId.LIGHT_BALL);
|
partyMember.heldItemManager.add(HeldItemId.LIGHT_BALL);
|
||||||
|
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: Stat.ATK, statValue: atkValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.ATK, statValue: atkValue });
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPATK, statValue: spAtkValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPATK, statValue: spAtkValue });
|
||||||
|
|
||||||
expect(atkValue.value / atkStat).toBe(2);
|
expect(atkValue.value / atkStat).toBe(2);
|
||||||
expect(spAtkValue.value / spAtkStat).toBe(2);
|
expect(spAtkValue.value / spAtkStat).toBe(2);
|
||||||
@ -192,17 +192,17 @@ describe("Items - Light Ball", () => {
|
|||||||
|
|
||||||
// Making sure modifier is not applied without holding item
|
// Making sure modifier is not applied without holding item
|
||||||
const atkValue = new NumberHolder(atkStat);
|
const atkValue = new NumberHolder(atkStat);
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: Stat.DEF, statValue: atkValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.DEF, statValue: atkValue });
|
||||||
const spAtkValue = new NumberHolder(spAtkStat);
|
const spAtkValue = new NumberHolder(spAtkStat);
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPDEF, statValue: spAtkValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPDEF, statValue: spAtkValue });
|
||||||
|
|
||||||
expect(atkValue.value / atkStat).toBe(1);
|
expect(atkValue.value / atkStat).toBe(1);
|
||||||
expect(spAtkValue.value / spAtkStat).toBe(1);
|
expect(spAtkValue.value / spAtkStat).toBe(1);
|
||||||
|
|
||||||
// Giving Light Ball to party member and testing if it applies
|
// Giving Light Ball to party member and testing if it applies
|
||||||
partyMember.heldItemManager.add(HeldItemId.LIGHT_BALL);
|
partyMember.heldItemManager.add(HeldItemId.LIGHT_BALL);
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: Stat.ATK, statValue: atkValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.ATK, statValue: atkValue });
|
||||||
applyHeldItems(HELD_ITEM_EFFECT.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPATK, statValue: spAtkValue });
|
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: Stat.SPATK, statValue: spAtkValue });
|
||||||
|
|
||||||
expect(atkValue.value / atkStat).toBe(1);
|
expect(atkValue.value / atkStat).toBe(1);
|
||||||
expect(spAtkValue.value / spAtkStat).toBe(1);
|
expect(spAtkValue.value / spAtkStat).toBe(1);
|
||||||
|
Loading…
Reference in New Issue
Block a user