Spaces:
Running
Running
{ | |
"version": 3, | |
"sources": ["../../sim/dex-moves.ts"], | |
"sourcesContent": ["import { Utils } from '../lib/utils';\nimport type { ConditionData } from './dex-conditions';\nimport { assignMissingFields, BasicEffect, toID } from './dex-data';\n\n/**\n * Describes the acceptable target(s) of a move.\n * adjacentAlly - Only relevant to Doubles or Triples, the move only targets an ally of the user.\n * adjacentAllyOrSelf - The move can target the user or its ally.\n * adjacentFoe - The move can target a foe, but not (in Triples) a distant foe.\n * all - The move targets the field or all Pok\u00E9mon at once.\n * allAdjacent - The move is a spread move that also hits the user's ally.\n * allAdjacentFoes - The move is a spread move.\n * allies - The move affects all active Pok\u00E9mon on the user's team.\n * allySide - The move adds a side condition on the user's side.\n * allyTeam - The move affects all unfainted Pok\u00E9mon on the user's team.\n * any - The move can hit any other active Pok\u00E9mon, not just those adjacent.\n * foeSide - The move adds a side condition on the foe's side.\n * normal - The move can hit one adjacent Pok\u00E9mon of your choice.\n * randomNormal - The move targets an adjacent foe at random.\n * scripted - The move targets the foe that damaged the user.\n * self - The move affects the user of the move.\n */\nexport type MoveTarget =\n\t'adjacentAlly' | 'adjacentAllyOrSelf' | 'adjacentFoe' | 'all' | 'allAdjacent' | 'allAdjacentFoes' |\n\t'allies' | 'allySide' | 'allyTeam' | 'any' | 'foeSide' | 'normal' | 'randomNormal' | 'scripted' | 'self';\n\n/** Possible move flags. */\ninterface MoveFlags {\n\tallyanim?: 1; // The move plays its animation when used on an ally.\n\tbypasssub?: 1; // Ignores a target's substitute.\n\tbite?: 1; // Power is multiplied by 1.5 when used by a Pokemon with the Ability Strong Jaw.\n\tbullet?: 1; // Has no effect on Pokemon with the Ability Bulletproof.\n\tcantusetwice?: 1; // The user cannot select this move after a previous successful use.\n\tcharge?: 1; // The user is unable to make a move between turns.\n\tcontact?: 1; // Makes contact.\n\tdance?: 1; // When used by a Pokemon, other Pokemon with the Ability Dancer can attempt to execute the same move.\n\tdefrost?: 1; // Thaws the user if executed successfully while the user is frozen.\n\tdistance?: 1; // Can target a Pokemon positioned anywhere in a Triple Battle.\n\tfailcopycat?: 1; // Cannot be selected by Copycat.\n\tfailencore?: 1; // Encore fails if target used this move.\n\tfailinstruct?: 1; // Cannot be repeated by Instruct.\n\tfailmefirst?: 1; // Cannot be selected by Me First.\n\tfailmimic?: 1; // Cannot be copied by Mimic.\n\tfuturemove?: 1; // Targets a slot, and in 2 turns damages that slot.\n\tgravity?: 1; // Prevented from being executed or selected during Gravity's effect.\n\theal?: 1; // Prevented from being executed or selected during Heal Block's effect.\n\tmetronome?: 1; // Can be selected by Metronome.\n\tmirror?: 1; // Can be copied by Mirror Move.\n\tmustpressure?: 1; // Additional PP is deducted due to Pressure when it ordinarily would not.\n\tnoassist?: 1; // Cannot be selected by Assist.\n\tnonsky?: 1; // Prevented from being executed or selected in a Sky Battle.\n\tnoparentalbond?: 1; // Cannot be made to hit twice via Parental Bond.\n\tnosketch?: 1; // Cannot be copied by Sketch.\n\tnosleeptalk?: 1; // Cannot be selected by Sleep Talk.\n\tpledgecombo?: 1; // Gems will not activate. Cannot be redirected by Storm Drain / Lightning Rod.\n\tpowder?: 1; // Has no effect on Pokemon which are Grass-type, have the Ability Overcoat, or hold Safety Goggles.\n\tprotect?: 1; // Blocked by Detect, Protect, Spiky Shield, and if not a Status move, King's Shield.\n\tpulse?: 1; // Power is multiplied by 1.5 when used by a Pokemon with the Ability Mega Launcher.\n\tpunch?: 1; // Power is multiplied by 1.2 when used by a Pokemon with the Ability Iron Fist.\n\trecharge?: 1; // If this move is successful, the user must recharge on the following turn and cannot make a move.\n\treflectable?: 1; // Bounced back to the original user by Magic Coat or the Ability Magic Bounce.\n\tslicing?: 1; // Power is multiplied by 1.5 when used by a Pokemon with the Ability Sharpness.\n\tsnatch?: 1; // Can be stolen from the original user and instead used by another Pokemon using Snatch.\n\tsound?: 1; // Has no effect on Pokemon with the Ability Soundproof.\n\twind?: 1; // Activates the Wind Power and Wind Rider Abilities.\n}\n\nexport interface HitEffect {\n\tonHit?: MoveEventMethods['onHit'];\n\n\t// set pokemon conditions\n\tboosts?: SparseBoostsTable | null;\n\tstatus?: string;\n\tvolatileStatus?: string;\n\n\t// set side/slot conditions\n\tsideCondition?: string;\n\tslotCondition?: string;\n\n\t// set field conditions\n\tpseudoWeather?: string;\n\tterrain?: string;\n\tweather?: string;\n}\n\nexport interface SecondaryEffect extends HitEffect {\n\tchance?: number;\n\t/** Used to flag a secondary effect as added by Poison Touch */\n\tability?: Ability;\n\t/**\n\t * Applies to Sparkling Aria's secondary effect: Affected by\n\t * Sheer Force but not Shield Dust.\n\t */\n\tdustproof?: boolean;\n\t/**\n\t * Gen 2 specific mechanics: Bypasses Substitute only on Twineedle,\n\t * and allows it to flinch sleeping/frozen targets\n\t */\n\tkingsrock?: boolean;\n\tself?: HitEffect;\n}\n\nexport interface MoveEventMethods {\n\tbasePowerCallback?: (this: Battle, pokemon: Pokemon, target: Pokemon, move: ActiveMove) => number | false | null;\n\t/** Return true to stop the move from being used */\n\tbeforeMoveCallback?: (this: Battle, pokemon: Pokemon, target: Pokemon | null, move: ActiveMove) => boolean | void;\n\tbeforeTurnCallback?: (this: Battle, pokemon: Pokemon, target: Pokemon) => void;\n\tdamageCallback?: (this: Battle, pokemon: Pokemon, target: Pokemon) => number | false;\n\tpriorityChargeCallback?: (this: Battle, pokemon: Pokemon) => void;\n\n\tonDisableMove?: (this: Battle, pokemon: Pokemon) => void;\n\n\tonAfterHit?: CommonHandlers['VoidSourceMove'];\n\tonAfterSubDamage?: (this: Battle, damage: number, target: Pokemon, source: Pokemon, move: ActiveMove) => void;\n\tonAfterMoveSecondarySelf?: CommonHandlers['VoidSourceMove'];\n\tonAfterMoveSecondary?: CommonHandlers['VoidMove'];\n\tonAfterMove?: CommonHandlers['VoidSourceMove'];\n\tonDamagePriority?: number;\n\tonDamage?: (\n\t\tthis: Battle, damage: number, target: Pokemon, source: Pokemon, effect: Effect\n\t) => number | boolean | null | void;\n\n\t/* Invoked by the global BasePower event (onEffect = true) */\n\tonBasePower?: CommonHandlers['ModifierSourceMove'];\n\n\tonEffectiveness?: (\n\t\tthis: Battle, typeMod: number, target: Pokemon | null, type: string, move: ActiveMove\n\t) => number | void;\n\tonHit?: CommonHandlers['ResultMove'];\n\tonHitField?: CommonHandlers['ResultMove'];\n\tonHitSide?: (this: Battle, side: Side, source: Pokemon, move: ActiveMove) => boolean | null | \"\" | void;\n\tonModifyMove?: (this: Battle, move: ActiveMove, pokemon: Pokemon, target: Pokemon | null) => void;\n\tonModifyPriority?: CommonHandlers['ModifierSourceMove'];\n\tonMoveFail?: CommonHandlers['VoidMove'];\n\tonModifyType?: (this: Battle, move: ActiveMove, pokemon: Pokemon, target: Pokemon) => void;\n\tonModifyTarget?: (\n\t\tthis: Battle, relayVar: { target: Pokemon }, pokemon: Pokemon, target: Pokemon, move: ActiveMove\n\t) => void;\n\tonPrepareHit?: CommonHandlers['ResultMove'];\n\tonTry?: CommonHandlers['ResultSourceMove'];\n\tonTryHit?: CommonHandlers['ExtResultSourceMove'];\n\tonTryHitField?: CommonHandlers['ResultMove'];\n\tonTryHitSide?: (this: Battle, side: Side, source: Pokemon, move: ActiveMove) => boolean | null | \"\" | void;\n\tonTryImmunity?: CommonHandlers['ResultMove'];\n\tonTryMove?: CommonHandlers['ResultSourceMove'];\n\tonUseMoveMessage?: CommonHandlers['VoidSourceMove'];\n}\n\nexport interface MoveData extends EffectData, MoveEventMethods, HitEffect {\n\tname: string;\n\t/** move index number, used for Metronome rolls */\n\tnum?: number;\n\tcondition?: ConditionData;\n\tbasePower: number;\n\taccuracy: true | number;\n\tpp: number;\n\tcategory: 'Physical' | 'Special' | 'Status';\n\ttype: string;\n\tpriority: number;\n\ttarget: MoveTarget;\n\tflags: MoveFlags;\n\t/** Hidden Power */\n\trealMove?: string;\n\n\tdamage?: number | 'level' | false | null;\n\tcontestType?: string;\n\tnoPPBoosts?: boolean;\n\n\t// Z-move data\n\t// -----------\n\t/**\n\t * ID of the Z-Crystal that calls the move.\n\t * `true` for Z-Powered status moves like Z-Encore.\n\t */\n\tisZ?: boolean | IDEntry;\n\tzMove?: {\n\t\tbasePower?: number,\n\t\teffect?: IDEntry,\n\t\tboost?: SparseBoostsTable,\n\t};\n\n\t// Max move data\n\t// -------------\n\t/**\n\t * `true` for Max moves like Max Airstream. If its a G-Max moves, this is\n\t * the species name of the Gigantamax Pokemon that can use this G-Max move.\n\t */\n\tisMax?: boolean | string;\n\tmaxMove?: {\n\t\tbasePower: number,\n\t};\n\n\t// Hit effects\n\t// -----------\n\tohko?: boolean | 'Ice';\n\tthawsTarget?: boolean;\n\theal?: number[] | null;\n\tforceSwitch?: boolean;\n\tselfSwitch?: 'copyvolatile' | 'shedtail' | boolean;\n\tselfBoost?: { boosts?: SparseBoostsTable };\n\tselfdestruct?: 'always' | 'ifHit' | boolean;\n\tbreaksProtect?: boolean;\n\t/**\n\t * Note that this is only \"true\" recoil. Other self-damage, like Struggle,\n\t * crash (High Jump Kick), Mind Blown, Life Orb, and even Substitute and\n\t * Healing Wish, are sometimes called \"recoil\" by the community, but don't\n\t * count as \"real\" recoil.\n\t */\n\trecoil?: [number, number];\n\tdrain?: [number, number];\n\tmindBlownRecoil?: boolean;\n\tstealsBoosts?: boolean;\n\tstruggleRecoil?: boolean;\n\tsecondary?: SecondaryEffect | null;\n\tsecondaries?: SecondaryEffect[] | null;\n\tself?: SecondaryEffect | null;\n\thasSheerForce?: boolean;\n\n\t// Hit effect modifiers\n\t// --------------------\n\talwaysHit?: boolean; // currently unused\n\tbaseMoveType?: string;\n\tbasePowerModifier?: number;\n\tcritModifier?: number;\n\tcritRatio?: number;\n\t/**\n\t * Pokemon for the attack stat. Ability and Item damage modifiers still come from the real attacker.\n\t */\n\toverrideOffensivePokemon?: 'target' | 'source';\n\t/**\n\t * Physical moves use attack stat modifiers, special moves use special attack stat modifiers.\n\t */\n\toverrideOffensiveStat?: StatIDExceptHP;\n\t/**\n\t * Pokemon for the defense stat. Ability and Item damage modifiers still come from the real defender.\n\t */\n\toverrideDefensivePokemon?: 'target' | 'source';\n\t/**\n\t * uses modifiers that match the new stat\n\t */\n\toverrideDefensiveStat?: StatIDExceptHP;\n\tforceSTAB?: boolean;\n\tignoreAbility?: boolean;\n\tignoreAccuracy?: boolean;\n\tignoreDefensive?: boolean;\n\tignoreEvasion?: boolean;\n\tignoreImmunity?: boolean | { [typeName: string]: boolean };\n\tignoreNegativeOffensive?: boolean;\n\tignoreOffensive?: boolean;\n\tignorePositiveDefensive?: boolean;\n\tignorePositiveEvasion?: boolean;\n\tmultiaccuracy?: boolean;\n\tmultihit?: number | number[];\n\tmultihitType?: 'parentalbond';\n\tnoDamageVariance?: boolean;\n\tnonGhostTarget?: MoveTarget;\n\tpressureTarget?: MoveTarget;\n\tspreadModifier?: number;\n\tsleepUsable?: boolean;\n\t/**\n\t * Will change target if current target is unavailable. (Dragon Darts)\n\t */\n\tsmartTarget?: boolean;\n\t/**\n\t * Tracks the original target through Ally Switch and other switch-out-and-back-in\n\t * situations, rather than just targeting a slot. (Stalwart, Snipe Shot)\n\t */\n\ttracksTarget?: boolean;\n\twillCrit?: boolean;\n\tcallsMove?: boolean;\n\n\t// Mechanics flags\n\t// ---------------\n\thasCrashDamage?: boolean;\n\tisConfusionSelfHit?: boolean;\n\tstallingMove?: boolean;\n\tbaseMove?: ID;\n}\n\nexport type ModdedMoveData = MoveData | Partial<Omit<MoveData, 'name'>> & {\n\tinherit: true,\n\tigniteBoosted?: boolean,\n\tsettleBoosted?: boolean,\n\tbodyofwaterBoosted?: boolean,\n\tlongWhipBoost?: boolean,\n\tgen?: number,\n};\n\nexport interface MoveDataTable { [moveid: IDEntry]: MoveData }\nexport interface ModdedMoveDataTable { [moveid: IDEntry]: ModdedMoveData }\n\nexport interface Move extends Readonly<BasicEffect & MoveData> {\n\treadonly effectType: 'Move';\n}\n\ninterface MoveHitData {\n\t[targetSlotid: string]: {\n\t\t/** Did this move crit against the target? */\n\t\tcrit: boolean,\n\t\t/** The type effectiveness of this move against the target */\n\t\ttypeMod: number,\n\t\t/**\n\t\t * Is this move a Z-Move that broke the target's protection?\n\t\t * (does 0.25x regular damage)\n\t\t */\n\t\tzBrokeProtect: boolean,\n\t};\n}\n\ntype MutableMove = BasicEffect & MoveData;\nexport interface ActiveMove extends MutableMove {\n\treadonly name: string;\n\treadonly effectType: 'Move';\n\treadonly id: ID;\n\tnum: number;\n\tweather?: ID;\n\tstatus?: ID;\n\thit: number;\n\tmoveHitData?: MoveHitData;\n\tability?: Ability;\n\tallies?: Pokemon[];\n\tauraBooster?: Pokemon;\n\tcausedCrashDamage?: boolean;\n\tforceStatus?: ID;\n\thasAuraBreak?: boolean;\n\thasBounced?: boolean;\n\thasSheerForce?: boolean;\n\t/** Is the move called by Dancer? Used to prevent infinite Dancer recursion. */\n\tisExternal?: boolean;\n\tlastHit?: boolean;\n\tmagnitude?: number;\n\tnegateSecondary?: boolean;\n\tpranksterBoosted?: boolean;\n\tselfDropped?: boolean;\n\tselfSwitch?: 'copyvolatile' | 'shedtail' | boolean;\n\tspreadHit?: boolean;\n\tstatusRoll?: string;\n\t/** Hardcode to make Tera Stellar STAB work with multihit moves */\n\tstellarBoosted?: boolean;\n\ttotalDamage?: number | false;\n\ttypeChangerBoosted?: Effect;\n\twillChangeForme?: boolean;\n\tinfiltrates?: boolean;\n\truinedAtk?: Pokemon;\n\truinedDef?: Pokemon;\n\truinedSpA?: Pokemon;\n\truinedSpD?: Pokemon;\n\n\t/**\n\t * Has this move been boosted by a Z-crystal or used by a Dynamax Pokemon? Usually the same as\n\t * `isZ` or `isMax`, but hacked moves will have this be `false` and `isZ` / `isMax` be truthy.\n\t */\n\tisZOrMaxPowered?: boolean;\n}\n\ntype MoveCategory = 'Physical' | 'Special' | 'Status';\n\nexport class DataMove extends BasicEffect implements Readonly<BasicEffect & MoveData> {\n\tdeclare readonly effectType: 'Move';\n\t/** Move type. */\n\treadonly type: string;\n\t/** Move target. */\n\treadonly target: MoveTarget;\n\t/** Move base power. */\n\treadonly basePower: number;\n\t/** Move base accuracy. True denotes a move that always hits. */\n\treadonly accuracy: true | number;\n\t/** Critical hit ratio. Defaults to 1. */\n\treadonly critRatio: number;\n\t/** Will this move always or never be a critical hit? */\n\tdeclare readonly willCrit?: boolean;\n\t/** Can this move OHKO foes? */\n\tdeclare readonly ohko?: boolean | 'Ice';\n\t/**\n\t * Base move type. This is the move type as specified by the games,\n\t * tracked because it often differs from the real move type.\n\t */\n\treadonly baseMoveType: string;\n\t/**\n\t * Secondary effect. You usually don't want to access this\n\t * directly; but through the secondaries array.\n\t */\n\treadonly secondary: SecondaryEffect | null;\n\t/**\n\t * Secondary effects. An array because there can be more than one\n\t * (for instance, Fire Fang has both a burn and a flinch\n\t * secondary).\n\t */\n\treadonly secondaries: SecondaryEffect[] | null;\n\t/**\n\t * Moves manually boosted by Sheer Force that don't have secondary effects.\n\t * e.g. Jet Punch\n\t */\n\treadonly hasSheerForce: boolean;\n\t/**\n\t * Move priority. Higher priorities go before lower priorities,\n\t * trumping the Speed stat.\n\t */\n\treadonly priority: number;\n\t/** Move category. */\n\treadonly category: MoveCategory;\n\t/**\n\t * Pokemon for the attack stat. Ability and Item damage modifiers still come from the real attacker.\n\t */\n\treadonly overrideOffensivePokemon?: 'target' | 'source';\n\t/**\n\t * Physical moves use attack stat modifiers, special moves use special attack stat modifiers.\n\t */\n\treadonly overrideOffensiveStat?: StatIDExceptHP;\n\t/**\n\t * Pokemon for the defense stat. Ability and Item damage modifiers still come from the real defender.\n\t */\n\treadonly overrideDefensivePokemon?: 'target' | 'source';\n\t/**\n\t * uses modifiers that match the new stat\n\t */\n\treadonly overrideDefensiveStat?: StatIDExceptHP;\n\t/** Whether or not this move ignores negative attack boosts. */\n\treadonly ignoreNegativeOffensive: boolean;\n\t/** Whether or not this move ignores positive defense boosts. */\n\treadonly ignorePositiveDefensive: boolean;\n\t/** Whether or not this move ignores attack boosts. */\n\treadonly ignoreOffensive: boolean;\n\t/** Whether or not this move ignores defense boosts. */\n\treadonly ignoreDefensive: boolean;\n\t/**\n\t * Whether or not this move ignores type immunities. Defaults to\n\t * true for Status moves and false for Physical/Special moves.\n\t *\n\t * If an Object, its keys represent the types whose immunities are\n\t * ignored, and its values should only be true.\n\t */\n\treadonly ignoreImmunity: { [typeName: string]: boolean } | boolean;\n\t/** Base move PP. */\n\treadonly pp: number;\n\t/** Whether or not this move can receive PP boosts. */\n\treadonly noPPBoosts: boolean;\n\t/** How many times does this move hit? */\n\tdeclare readonly multihit?: number | number[];\n\t/** Is this move a Z-Move? */\n\treadonly isZ: boolean | IDEntry;\n\t/* Z-Move fields */\n\tdeclare readonly zMove?: {\n\t\tbasePower?: number,\n\t\teffect?: IDEntry,\n\t\tboost?: SparseBoostsTable,\n\t};\n\t/** Is this move a Max move? string = Gigantamax species name */\n\treadonly isMax: boolean | string;\n\t/** Max/G-Max move fields */\n\tdeclare readonly maxMove?: {\n\t\tbasePower: number,\n\t};\n\treadonly flags: MoveFlags;\n\t/** Whether or not the user must switch after using this move. */\n\treadonly selfSwitch?: 'copyvolatile' | 'shedtail' | boolean;\n\t/** Move target only used by Pressure. */\n\treadonly pressureTarget: MoveTarget;\n\t/** Move target used if the user is not a Ghost type (for Curse). */\n\treadonly nonGhostTarget: MoveTarget;\n\t/** Whether or not the move ignores abilities. */\n\treadonly ignoreAbility: boolean;\n\t/**\n\t * Move damage against the current target\n\t * false = move will always fail with \"But it failed!\"\n\t * null = move will always silently fail\n\t * undefined = move does not deal fixed damage\n\t */\n\treadonly damage: number | 'level' | false | null;\n\t/** Whether or not this move hit multiple targets. */\n\treadonly spreadHit: boolean;\n\t/** Modifier that affects damage when multiple targets are hit. */\n\tdeclare readonly spreadModifier?: number;\n\t/** Modifier that affects damage when this move is a critical hit. */\n\tdeclare readonly critModifier?: number;\n\t/** Forces the move to get STAB even if the type doesn't match. */\n\treadonly forceSTAB: boolean;\n\n\treadonly volatileStatus?: ID;\n\n\tconstructor(data: AnyObject) {\n\t\tsuper(data);\n\n\t\tthis.fullname = `move: ${this.name}`;\n\t\tthis.effectType = 'Move';\n\t\tthis.type = Utils.getString(data.type);\n\t\tthis.target = data.target;\n\t\tthis.basePower = Number(data.basePower);\n\t\tthis.accuracy = data.accuracy!;\n\t\tthis.critRatio = Number(data.critRatio) || 1;\n\t\tthis.baseMoveType = Utils.getString(data.baseMoveType) || this.type;\n\t\tthis.secondary = data.secondary || null;\n\t\tthis.secondaries = data.secondaries || (this.secondary && [this.secondary]) || null;\n\t\tthis.hasSheerForce = !!(data.hasSheerForce && !this.secondaries);\n\t\tthis.priority = Number(data.priority) || 0;\n\t\tthis.category = data.category!;\n\t\tthis.overrideOffensiveStat = data.overrideOffensiveStat || undefined;\n\t\tthis.overrideOffensivePokemon = data.overrideOffensivePokemon || undefined;\n\t\tthis.overrideDefensiveStat = data.overrideDefensiveStat || undefined;\n\t\tthis.overrideDefensivePokemon = data.overrideDefensivePokemon || undefined;\n\t\tthis.ignoreNegativeOffensive = !!data.ignoreNegativeOffensive;\n\t\tthis.ignorePositiveDefensive = !!data.ignorePositiveDefensive;\n\t\tthis.ignoreOffensive = !!data.ignoreOffensive;\n\t\tthis.ignoreDefensive = !!data.ignoreDefensive;\n\t\tthis.ignoreImmunity = (data.ignoreImmunity !== undefined ? data.ignoreImmunity : this.category === 'Status');\n\t\tthis.pp = Number(data.pp);\n\t\tthis.noPPBoosts = !!(data.noPPBoosts ?? data.isZ);\n\t\tthis.isZ = data.isZ || false;\n\t\tthis.isMax = data.isMax || false;\n\t\tthis.flags = data.flags || {};\n\t\tthis.selfSwitch = (typeof data.selfSwitch === 'string' ? (data.selfSwitch as ID) : data.selfSwitch) || undefined;\n\t\tthis.pressureTarget = data.pressureTarget || '';\n\t\tthis.nonGhostTarget = data.nonGhostTarget || '';\n\t\tthis.ignoreAbility = data.ignoreAbility || false;\n\t\tthis.damage = data.damage!;\n\t\tthis.spreadHit = data.spreadHit || false;\n\t\tthis.forceSTAB = !!data.forceSTAB;\n\t\tthis.volatileStatus = typeof data.volatileStatus === 'string' ? (data.volatileStatus as ID) : undefined;\n\n\t\tif (this.category !== 'Status' && !data.maxMove && this.id !== 'struggle') {\n\t\t\tthis.maxMove = { basePower: 1 };\n\t\t\tif (this.isMax || this.isZ) {\n\t\t\t\t// already initialized to 1\n\t\t\t} else if (!this.basePower) {\n\t\t\t\tthis.maxMove.basePower = 100;\n\t\t\t} else if (['Fighting', 'Poison'].includes(this.type)) {\n\t\t\t\tif (this.basePower >= 150) {\n\t\t\t\t\tthis.maxMove.basePower = 100;\n\t\t\t\t} else if (this.basePower >= 110) {\n\t\t\t\t\tthis.maxMove.basePower = 95;\n\t\t\t\t} else if (this.basePower >= 75) {\n\t\t\t\t\tthis.maxMove.basePower = 90;\n\t\t\t\t} else if (this.basePower >= 65) {\n\t\t\t\t\tthis.maxMove.basePower = 85;\n\t\t\t\t} else if (this.basePower >= 55) {\n\t\t\t\t\tthis.maxMove.basePower = 80;\n\t\t\t\t} else if (this.basePower >= 45) {\n\t\t\t\t\tthis.maxMove.basePower = 75;\n\t\t\t\t} else {\n\t\t\t\t\tthis.maxMove.basePower = 70;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (this.basePower >= 150) {\n\t\t\t\t\tthis.maxMove.basePower = 150;\n\t\t\t\t} else if (this.basePower >= 110) {\n\t\t\t\t\tthis.maxMove.basePower = 140;\n\t\t\t\t} else if (this.basePower >= 75) {\n\t\t\t\t\tthis.maxMove.basePower = 130;\n\t\t\t\t} else if (this.basePower >= 65) {\n\t\t\t\t\tthis.maxMove.basePower = 120;\n\t\t\t\t} else if (this.basePower >= 55) {\n\t\t\t\t\tthis.maxMove.basePower = 110;\n\t\t\t\t} else if (this.basePower >= 45) {\n\t\t\t\t\tthis.maxMove.basePower = 100;\n\t\t\t\t} else {\n\t\t\t\t\tthis.maxMove.basePower = 90;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (this.category !== 'Status' && !data.zMove && !this.isZ && !this.isMax && this.id !== 'struggle') {\n\t\t\tlet basePower = this.basePower;\n\t\t\tthis.zMove = {};\n\t\t\tif (Array.isArray(data.multihit)) basePower *= 3;\n\t\t\tif (!basePower) {\n\t\t\t\tthis.zMove.basePower = 100;\n\t\t\t} else if (basePower >= 140) {\n\t\t\t\tthis.zMove.basePower = 200;\n\t\t\t} else if (basePower >= 130) {\n\t\t\t\tthis.zMove.basePower = 195;\n\t\t\t} else if (basePower >= 120) {\n\t\t\t\tthis.zMove.basePower = 190;\n\t\t\t} else if (basePower >= 110) {\n\t\t\t\tthis.zMove.basePower = 185;\n\t\t\t} else if (basePower >= 100) {\n\t\t\t\tthis.zMove.basePower = 180;\n\t\t\t} else if (basePower >= 90) {\n\t\t\t\tthis.zMove.basePower = 175;\n\t\t\t} else if (basePower >= 80) {\n\t\t\t\tthis.zMove.basePower = 160;\n\t\t\t} else if (basePower >= 70) {\n\t\t\t\tthis.zMove.basePower = 140;\n\t\t\t} else if (basePower >= 60) {\n\t\t\t\tthis.zMove.basePower = 120;\n\t\t\t} else {\n\t\t\t\tthis.zMove.basePower = 100;\n\t\t\t}\n\t\t}\n\n\t\tif (!this.gen) {\n\t\t\t// special handling for gen8 gmax moves (all of them have num 1000 but they are part of gen8)\n\t\t\tif (this.num >= 827 && !this.isMax) {\n\t\t\t\tthis.gen = 9;\n\t\t\t} else if (this.num >= 743) {\n\t\t\t\tthis.gen = 8;\n\t\t\t} else if (this.num >= 622) {\n\t\t\t\tthis.gen = 7;\n\t\t\t} else if (this.num >= 560) {\n\t\t\t\tthis.gen = 6;\n\t\t\t} else if (this.num >= 468) {\n\t\t\t\tthis.gen = 5;\n\t\t\t} else if (this.num >= 355) {\n\t\t\t\tthis.gen = 4;\n\t\t\t} else if (this.num >= 252) {\n\t\t\t\tthis.gen = 3;\n\t\t\t} else if (this.num >= 166) {\n\t\t\t\tthis.gen = 2;\n\t\t\t} else if (this.num >= 1) {\n\t\t\t\tthis.gen = 1;\n\t\t\t}\n\t\t}\n\t\tassignMissingFields(this, data);\n\t}\n}\n\nconst EMPTY_MOVE = Utils.deepFreeze(new DataMove({ name: '', exists: false }));\n\nexport class DexMoves {\n\treadonly dex: ModdedDex;\n\treadonly moveCache = new Map<ID, Move>();\n\tallCache: readonly Move[] | null = null;\n\n\tconstructor(dex: ModdedDex) {\n\t\tthis.dex = dex;\n\t}\n\n\tget(name?: string | Move): Move {\n\t\tif (name && typeof name !== 'string') return name;\n\t\tconst id = name ? toID(name.trim()) : '' as ID;\n\t\treturn this.getByID(id);\n\t}\n\n\tgetByID(id: ID): Move {\n\t\tif (id === '') return EMPTY_MOVE;\n\t\tlet move = this.moveCache.get(id);\n\t\tif (move) return move;\n\t\tif (this.dex.data.Aliases.hasOwnProperty(id)) {\n\t\t\tmove = this.get(this.dex.data.Aliases[id]);\n\t\t\tif (move.exists) {\n\t\t\t\tthis.moveCache.set(id, move);\n\t\t\t}\n\t\t\treturn move;\n\t\t}\n\t\tif (id.startsWith('hiddenpower')) {\n\t\t\tid = /([a-z]*)([0-9]*)/.exec(id)![1] as ID;\n\t\t}\n\t\tif (id && this.dex.data.Moves.hasOwnProperty(id)) {\n\t\t\tconst moveData = this.dex.data.Moves[id] as any;\n\t\t\tconst moveTextData = this.dex.getDescs('Moves', id, moveData);\n\t\t\tmove = new DataMove({\n\t\t\t\tname: id,\n\t\t\t\t...moveData,\n\t\t\t\t...moveTextData,\n\t\t\t});\n\t\t\tif (move.gen > this.dex.gen) {\n\t\t\t\t(move as any).isNonstandard = 'Future';\n\t\t\t}\n\t\t\tif (this.dex.parentMod) {\n\t\t\t\t// If move is exactly identical to parentMod's move, reuse parentMod's copy\n\t\t\t\tconst parentMod = this.dex.mod(this.dex.parentMod);\n\t\t\t\tif (moveData === parentMod.data.Moves[id]) {\n\t\t\t\t\tconst parentMove = parentMod.moves.getByID(id);\n\t\t\t\t\tif (\n\t\t\t\t\t\tmove.isNonstandard === parentMove.isNonstandard &&\n\t\t\t\t\t\tmove.desc === parentMove.desc && move.shortDesc === parentMove.shortDesc\n\t\t\t\t\t) {\n\t\t\t\t\t\tmove = parentMove;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tmove = new DataMove({\n\t\t\t\tname: id, exists: false,\n\t\t\t});\n\t\t}\n\t\tif (move.exists) this.moveCache.set(id, this.dex.deepFreeze(move));\n\t\treturn move;\n\t}\n\n\tall(): readonly Move[] {\n\t\tif (this.allCache) return this.allCache;\n\t\tconst moves = [];\n\t\tfor (const id in this.dex.data.Moves) {\n\t\t\tmoves.push(this.getByID(id as ID));\n\t\t}\n\t\tthis.allCache = Object.freeze(moves);\n\t\treturn this.allCache;\n\t}\n}\n"], | |
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsB;AAEtB,sBAAuD;AAmWhD,MAAM,iBAAiB,4BAAwD;AAAA,EA2HrF,YAAY,MAAiB;AAC5B,UAAM,IAAI;AAEV,SAAK,WAAW,SAAS,KAAK;AAC9B,SAAK,aAAa;AAClB,SAAK,OAAO,mBAAM,UAAU,KAAK,IAAI;AACrC,SAAK,SAAS,KAAK;AACnB,SAAK,YAAY,OAAO,KAAK,SAAS;AACtC,SAAK,WAAW,KAAK;AACrB,SAAK,YAAY,OAAO,KAAK,SAAS,KAAK;AAC3C,SAAK,eAAe,mBAAM,UAAU,KAAK,YAAY,KAAK,KAAK;AAC/D,SAAK,YAAY,KAAK,aAAa;AACnC,SAAK,cAAc,KAAK,eAAgB,KAAK,aAAa,CAAC,KAAK,SAAS,KAAM;AAC/E,SAAK,gBAAgB,CAAC,EAAE,KAAK,iBAAiB,CAAC,KAAK;AACpD,SAAK,WAAW,OAAO,KAAK,QAAQ,KAAK;AACzC,SAAK,WAAW,KAAK;AACrB,SAAK,wBAAwB,KAAK,yBAAyB;AAC3D,SAAK,2BAA2B,KAAK,4BAA4B;AACjE,SAAK,wBAAwB,KAAK,yBAAyB;AAC3D,SAAK,2BAA2B,KAAK,4BAA4B;AACjE,SAAK,0BAA0B,CA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