diff --git a/src/@types/attack-move-result.ts b/src/@types/attack-move-result.ts index ec79e761499..c6aedf8096d 100644 --- a/src/@types/attack-move-result.ts +++ b/src/@types/attack-move-result.ts @@ -1,5 +1,5 @@ import type { BattlerIndex } from "#enums/battler-index"; -import type { DamageResult } from "#app/field/pokemon"; +import type { DamageResult } from "#app/@types/damage-result"; import type { MoveId } from "#enums/move-id"; export interface AttackMoveResult { diff --git a/src/@types/damage-result.ts b/src/@types/damage-result.ts new file mode 100644 index 00000000000..b6eb6b82770 --- /dev/null +++ b/src/@types/damage-result.ts @@ -0,0 +1,21 @@ +import type { HitResult } from "#enums/hit-result"; + +/** Union type containing all damage-dealing {@linkcode HitResult}s. */ +export type DamageResult = + | HitResult.EFFECTIVE + | HitResult.SUPER_EFFECTIVE + | HitResult.NOT_VERY_EFFECTIVE + | HitResult.ONE_HIT_KO + | HitResult.CONFUSION + | HitResult.INDIRECT_KO + | HitResult.INDIRECT; + +/** Interface containing the results of a damage calculation for a given move. */ +export interface DamageCalculationResult { + /** `true` if the move was cancelled (thus suppressing "No Effect" messages) */ + cancelled: boolean; + /** The effectiveness of the move */ + result: HitResult; + /** The damage dealt by the move */ + damage: number; +} diff --git a/src/field/damage-number-handler.ts b/src/field/damage-number-handler.ts index b8b3ed76e18..24c5e107d15 100644 --- a/src/field/damage-number-handler.ts +++ b/src/field/damage-number-handler.ts @@ -1,5 +1,5 @@ import { TextStyle, addTextObject } from "../ui/text"; -import type { DamageResult } from "./pokemon"; +import type { DamageResult } from "../@types/damage-result"; import type Pokemon from "./pokemon"; import { HitResult } from "#enums/hit-result"; import { formatStat, fixedInt } from "#app/utils/common"; diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index e2d41427925..794cca5e6ac 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -169,7 +169,14 @@ import { getPokemonNameWithAffix } from "#app/messages"; import { Challenges } from "#enums/challenges"; import { PokemonAnimType } from "#enums/pokemon-anim-type"; import { PLAYER_PARTY_MAX_SIZE } from "#app/constants"; -import { CustomPokemonData, PokemonBattleData, PokemonSummonData, PokemonTempSummonData, PokemonTurnData, PokemonWaveData } from "#app/data/pokemon/pokemon-data"; +import { + CustomPokemonData, + PokemonBattleData, + PokemonSummonData, + PokemonTempSummonData, + PokemonTurnData, + PokemonWaveData, +} from "#app/data/pokemon/pokemon-data"; import { SwitchType } from "#enums/switch-type"; import { SpeciesFormKey } from "#enums/species-form-key"; import { getStatusEffectOverlapText } from "#app/data/status-effect"; @@ -193,6 +200,7 @@ import { PokemonMove } from "#app/data/moves/pokemon-move"; import type { AbAttrMap, AbAttrString } from "#app/@types/ability-types"; import type { IllusionData } from "#app/@types/illusion-data"; import type { TurnMove } from "#app/@types/turn-move"; +import type { DamageCalculationResult, DamageResult } from "#app/@types/damage-result"; /** Base typeclass for damage parameter methods, used for DRY */ type damageParams = { @@ -6690,22 +6698,3 @@ export class EnemyPokemon extends Pokemon { this.battleInfo.toggleFlyout(visible); } } - -export type DamageResult = - | HitResult.EFFECTIVE - | HitResult.SUPER_EFFECTIVE - | HitResult.NOT_VERY_EFFECTIVE - | HitResult.ONE_HIT_KO - | HitResult.CONFUSION - | HitResult.INDIRECT_KO - | HitResult.INDIRECT; - -/** Interface containing the results of a damage calculation for a given move */ -export interface DamageCalculationResult { - /** `true` if the move was cancelled (thus suppressing "No Effect" messages) */ - cancelled: boolean; - /** The effectiveness of the move */ - result: HitResult; - /** The damage dealt by the move */ - damage: number; -} diff --git a/src/phases/damage-anim-phase.ts b/src/phases/damage-anim-phase.ts index aa5a0a6c3e6..8dc377cdaf5 100644 --- a/src/phases/damage-anim-phase.ts +++ b/src/phases/damage-anim-phase.ts @@ -1,7 +1,7 @@ import { globalScene } from "#app/global-scene"; import type { BattlerIndex } from "#enums/battler-index"; import { BattleSpec } from "#enums/battle-spec"; -import type { DamageResult } from "#app/field/pokemon"; +import type { DamageResult } from "#app/@types/damage-result"; import { HitResult } from "#enums/hit-result"; import { fixedInt } from "#app/utils/common"; import { PokemonPhase } from "#app/phases/pokemon-phase"; diff --git a/src/phases/move-effect-phase.ts b/src/phases/move-effect-phase.ts index dc3e222da24..c9852016b17 100644 --- a/src/phases/move-effect-phase.ts +++ b/src/phases/move-effect-phase.ts @@ -27,7 +27,7 @@ import { MoveTarget } from "#enums/MoveTarget"; import { MoveCategory } from "#enums/MoveCategory"; import { SpeciesFormChangePostMoveTrigger } from "#app/data/pokemon-forms/form-change-triggers"; import { PokemonType } from "#enums/pokemon-type"; -import type { DamageResult } from "#app/field/pokemon"; +import type { DamageResult } from "#app/@types/damage-result"; import type { TurnMove } from "#app/@types/turn-move"; import { PokemonMove } from "#app/data/moves/pokemon-move"; import type Pokemon from "#app/field/pokemon"; diff --git a/src/system/pokemon-data.ts b/src/system/pokemon-data.ts index aabdee768d7..d1efedd86c3 100644 --- a/src/system/pokemon-data.ts +++ b/src/system/pokemon-data.ts @@ -12,7 +12,7 @@ import type { Variant } from "#app/sprites/variant"; import type { BiomeId } from "#enums/biome-id"; import type { MoveId } from "#enums/move-id"; import type { SpeciesId } from "#enums/species-id"; -import { CustomPokemonData, PokemonBattleData, PokemonSummonData} from "#app/data/pokemon/pokemon-data"; +import { CustomPokemonData, PokemonBattleData, PokemonSummonData } from "#app/data/pokemon/pokemon-data"; import type { PokemonType } from "#enums/pokemon-type"; export default class PokemonData { diff --git a/test/moves/steamroller.test.ts b/test/moves/steamroller.test.ts index 4eb011c47f5..67c63ff32e4 100644 --- a/test/moves/steamroller.test.ts +++ b/test/moves/steamroller.test.ts @@ -1,7 +1,7 @@ import { BattlerIndex } from "#enums/battler-index"; import { allMoves } from "#app/data/data-lists"; import { BattlerTagType } from "#app/enums/battler-tag-type"; -import type { DamageCalculationResult } from "#app/field/pokemon"; +import type { DamageCalculationResult } from "#app/@types/damage-result"; import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id";