Spaces:
Running
Running
{ | |
"version": 3, | |
"sources": ["../../../../data/mods/gen1/scripts.ts"], | |
"sourcesContent": ["/**\n * Gen 1 mechanics are fairly different to those we know on current gen.\n * Therefor we need to make a lot of changes to the battle engine for this game simulation.\n * This generation inherits all the changes from older generations, that must be taken into account when editing code.\n */\n\nconst SKIP_LASTDAMAGE = new Set([\n\t'confuseray', 'conversion', 'counter', 'focusenergy', 'glare', 'haze', 'leechseed', 'lightscreen',\n\t'mimic', 'mist', 'poisongas', 'poisonpowder', 'recover', 'reflect', 'rest', 'softboiled',\n\t'splash', 'stunspore', 'substitute', 'supersonic', 'teleport', 'thunderwave', 'toxic', 'transform',\n]);\n\nconst TWO_TURN_MOVES = ['dig', 'fly', 'razorwind', 'skullbash', 'skyattack', 'solarbeam'];\n\nexport const Scripts: ModdedBattleScriptsData = {\n\tinherit: 'gen2',\n\tgen: 1,\n\tinit() {\n\t\tfor (const i in this.data.Pokedex) {\n\t\t\tconst poke = this.modData('Pokedex', i);\n\t\t\tpoke.gender = 'N';\n\t\t\tpoke.eggGroups = null;\n\t\t}\n\t},\n\t// BattlePokemon scripts.\n\tpokemon: {\n\t\tinherit: true,\n\t\tgetStat(statName, unmodified) {\n\t\t\t// @ts-expect-error type checking prevents 'hp' from being passed, but we're paranoid\n\t\t\tif (statName === 'hp') throw new Error(\"Please read `maxhp` directly\");\n\t\t\tif (unmodified) return this.baseStoredStats[statName];\n\t\t\treturn this.modifiedStats![statName];\n\t\t},\n\t\t// Gen 1 function to apply a stat modification that is only active until the stat is recalculated or mon switched.\n\t\tmodifyStat(statName, modifier) {\n\t\t\tif (!(statName in this.storedStats)) throw new Error(\"Invalid `statName` passed to `modifyStat`\");\n\t\t\tconst modifiedStats = this.battle.clampIntRange(Math.floor(this.modifiedStats![statName] * modifier), 1);\n\t\t\tthis.modifiedStats![statName] = modifiedStats;\n\t\t},\n\t\t// In generation 1, boosting function increases the stored modified stat and checks for opponent's status.\n\t\tboostBy(boost) {\n\t\t\tlet changed: boolean | number = false;\n\t\t\tlet i: BoostID;\n\t\t\tfor (i in boost) {\n\t\t\t\tconst delta = boost[i];\n\t\t\t\tif (delta === undefined) continue;\n\t\t\t\tif (delta > 0 && this.boosts[i] >= 6) continue;\n\t\t\t\tif (delta < 0 && this.boosts[i] <= -6) continue;\n\t\t\t\tif (i === 'evasion' || i === 'accuracy') {\n\t\t\t\t\tthis.boosts[i] += delta;\n\t\t\t\t\tif (this.boosts[i] > 6) {\n\t\t\t\t\t\tthis.boosts[i] = 6;\n\t\t\t\t\t}\n\t\t\t\t\tif (this.boosts[i] < -6) {\n\t\t\t\t\t\tthis.boosts[i] = -6;\n\t\t\t\t\t}\n\t\t\t\t\tchanged = true;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t// Stat being modified is not evasion or accuracy, so change modifiedStats.\n\t\t\t\tif (delta > 0) {\n\t\t\t\t\tif (this.modifiedStats![i] === 999) {\n\t\t\t\t\t\t// Intended max stat value\n\t\t\t\t\t\tthis.boosts[i] += delta;\n\t\t\t\t\t\tif (this.boosts[i] > 6) {\n\t\t\t\t\t\t\tthis.boosts[i] = 6;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.boosts[i]--;\n\t\t\t\t\t\t// changed = 0 corresponds to increasing stats at 999 (or decreasing at 1).\n\t\t\t\t\t\tchanged = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.boosts[i] += delta;\n\t\t\t\t\t\tif (this.boosts[i] > 6) {\n\t\t\t\t\t\t\tthis.boosts[i] = 6;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tchanged = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (delta < 0) {\n\t\t\t\t\tif (this.modifiedStats![i] === 1) {\n\t\t\t\t\t\t// Minimum stat value\n\t\t\t\t\t\tthis.boosts[i] += delta;\n\t\t\t\t\t\tif (this.boosts[i] < -6) {\n\t\t\t\t\t\t\tthis.boosts[i] = -6;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.boosts[i]++;\n\t\t\t\t\t\t// changed = 0 corresponds to increasing stats at 999 (or decreasing at 1).\n\t\t\t\t\t\tchanged = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.boosts[i] += delta;\n\t\t\t\t\t\tif (this.boosts[i] < -6) {\n\t\t\t\t\t\t\tthis.boosts[i] = -6;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tchanged = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (changed) {\n\t\t\t\t\t// Recalculate the modified stat\n\t\t\t\t\tthis.modifiedStats![i] = this.storedStats[i];\n\t\t\t\t\tif (this.boosts[i] >= 0) {\n\t\t\t\t\t\tthis.modifyStat!(i, [1, 1.5, 2, 2.5, 3, 3.5, 4][this.boosts[i]]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.modifyStat!(i, [100, 66, 50, 40, 33, 28, 25][-this.boosts[i]] / 100);\n\t\t\t\t\t}\n\t\t\t\t\tif (delta > 0 && this.modifiedStats![i] > 999) {\n\t\t\t\t\t\t// Cap the stat at 999\n\t\t\t\t\t\tthis.modifiedStats![i] = 999;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn changed;\n\t\t},\n\t\tclearBoosts() {\n\t\t\tlet i: BoostID;\n\t\t\tfor (i in this.boosts) {\n\t\t\t\tthis.boosts[i] = 0;\n\t\t\t\t// Recalculate the modified stat\n\t\t\t\tif (i === 'evasion' || i === 'accuracy') continue;\n\t\t\t\tthis.modifiedStats![i] = this.storedStats[i];\n\t\t\t}\n\t\t},\n\t},\n\tactions: {\n\t\tinherit: true,\n\t\t// This function is the main one when running a move.\n\t\t// It deals with the beforeMove event.\n\t\t// It also deals with how PP reduction works on gen 1.\n\t\trunMove(moveOrMoveName, pokemon, targetLoc, options) {\n\t\t\tlet sourceEffect = options?.sourceEffect;\n\t\t\tconst target = this.battle.getTarget(pokemon, moveOrMoveName, targetLoc);\n\t\t\tlet move = this.battle.dex.getActiveMove(moveOrMoveName);\n\n\t\t\t// If a faster partial trapping move misses against a user of Hyper Beam during a recharge turn,\n\t\t\t// the user of Hyper Beam will automatically use Hyper Beam during that turn.\n\t\t\tconst autoHyperBeam = (\n\t\t\t\tmove.id === 'recharge' && !pokemon.volatiles['mustrecharge'] && !pokemon.volatiles['partiallytrapped']\n\t\t\t);\n\t\t\tif (autoHyperBeam) {\n\t\t\t\tmove = this.battle.dex.getActiveMove('hyperbeam');\n\t\t\t\tthis.battle.hint(`In Gen 1, If a faster partial trapping move misses against a user of Hyper Beam during a recharge turn, ` +\n\t\t\t\t\t`the user of Hyper Beam will automatically use Hyper Beam during that turn.`, true);\n\t\t\t}\n\n\t\t\tif (target?.subFainted) target.subFainted = null;\n\n\t\t\tthis.battle.setActiveMove(move, pokemon, target);\n\n\t\t\tif (pokemon.moveThisTurn || !this.battle.runEvent('BeforeMove', pokemon, target, move)) {\n\t\t\t\tthis.battle.clearActiveMove(true);\n\t\t\t\t// This is only run for sleep.\n\t\t\t\tthis.battle.runEvent('AfterMoveSelf', pokemon, target, move);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (move.beforeMoveCallback) {\n\t\t\t\tif (move.beforeMoveCallback.call(this.battle, pokemon, target, move)) {\n\t\t\t\t\tthis.battle.clearActiveMove(true);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tlet lockedMove = this.battle.runEvent('LockMove', pokemon);\n\t\t\tif (lockedMove === true) lockedMove = false;\n\t\t\tif (\n\t\t\t\t!lockedMove &&\n\t\t\t\t(!pokemon.volatiles['partialtrappinglock'] || pokemon.volatiles['partialtrappinglock'].locked !== target)\n\t\t\t) {\n\t\t\t\tpokemon.deductPP(move, null, target);\n\t\t\t} else {\n\t\t\t\tsourceEffect = move;\n\t\t\t\tif (pokemon.volatiles['twoturnmove']) {\n\t\t\t\t\t// Two-turn moves like Sky Attack deduct PP on their second turn.\n\t\t\t\t\tpokemon.deductPP(pokemon.volatiles['twoturnmove'].originalMove, null, target);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (\n\t\t\t\t(pokemon.volatiles['partialtrappinglock'] && target !== pokemon.volatiles['partialtrappinglock'].locked) ||\n\t\t\t\tautoHyperBeam\n\t\t\t) {\n\t\t\t\tconst moveSlot = pokemon.moveSlots.find(ms => ms.id === move.id);\n\t\t\t\tif (moveSlot && moveSlot.pp < 0) {\n\t\t\t\t\tmoveSlot.pp = 63;\n\t\t\t\t\tthis.battle.hint(\"In Gen 1, if a player is forced to use a move with 0 PP, the move will underflow to have 63 PP.\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.useMove(move, pokemon, { target, sourceEffect });\n\t\t\t// Restore PP if the move is the first turn of a charging move. Save the move from which PP should be deducted if the move succeeds.\n\t\t\tif (pokemon.volatiles['twoturnmove']) {\n\t\t\t\tpokemon.deductPP(move, -1, target);\n\t\t\t\tpokemon.volatiles['twoturnmove'].originalMove = move.id;\n\t\t\t}\n\t\t},\n\t\t// This function deals with AfterMoveSelf events.\n\t\t// This leads with partial trapping moves shenanigans after the move has been used.\n\t\tuseMove(moveOrMoveName, pokemon, options) {\n\t\t\tlet sourceEffect = options?.sourceEffect;\n\t\t\tlet target = options?.target;\n\t\t\tif (!sourceEffect && this.battle.effect.id) sourceEffect = this.battle.effect;\n\t\t\tconst baseMove = this.battle.dex.moves.get(moveOrMoveName);\n\t\t\tlet move = this.battle.dex.getActiveMove(baseMove);\n\t\t\tif (target === undefined) target = this.battle.getRandomTarget(pokemon, move);\n\t\t\tif (move.target === 'self') {\n\t\t\t\ttarget = pokemon;\n\t\t\t}\n\t\t\tif (sourceEffect) move.sourceEffect = sourceEffect.id;\n\n\t\t\tthis.battle.singleEvent('ModifyMove', move, null, pokemon, target, move, move);\n\t\t\tif (baseMove.target !== move.target) {\n\t\t\t\t// Target changed in ModifyMove, so we must adjust it here\n\t\t\t\ttarget = this.battle.getRandomTarget(pokemon, move);\n\t\t\t}\n\t\t\tmove = this.battle.runEvent('ModifyMove', pokemon, target, move, move);\n\t\t\tif (baseMove.target !== move.target) {\n\t\t\t\t// Check again, this shouldn't ever happen on Gen 1.\n\t\t\t\ttarget = this.battle.getRandomTarget(pokemon, move);\n\t\t\t}\n\t\t\t// The charging turn of a two-turn move does not update pokemon.lastMove\n\t\t\tif (!TWO_TURN_MOVES.includes(move.id) || pokemon.volatiles['twoturnmove']) pokemon.lastMove = move;\n\n\t\t\tconst moveResult = this.useMoveInner(moveOrMoveName, pokemon, { target, sourceEffect });\n\n\t\t\tif (move.id !== 'metronome') {\n\t\t\t\tif (move.id !== 'mirrormove' ||\n\t\t\t\t\t(!pokemon.side.foe.active[0]?.lastMove || pokemon.side.foe.active[0].lastMove?.id === 'mirrormove')) {\n\t\t\t\t\t// The move is our 'final' move (a failed Mirror Move, or any move that isn't Metronome or Mirror Move).\n\t\t\t\t\tpokemon.side.lastMove = move;\n\n\t\t\t\t\tif (pokemon.volatiles['lockedmove']?.time <= 0) pokemon.removeVolatile('lockedmove');\n\n\t\t\t\t\t// If target fainted\n\t\t\t\t\tif (target && target.hp <= 0) {\n\t\t\t\t\t\t// We remove recharge\n\t\t\t\t\t\tif (pokemon.volatiles['mustrecharge']) pokemon.removeVolatile('mustrecharge');\n\t\t\t\t\t\tdelete pokemon.volatiles['partialtrappinglock'];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (pokemon.volatiles['mustrecharge']) this.battle.add('-mustrecharge', pokemon);\n\t\t\t\t\t\tif (pokemon.hp) this.battle.runEvent('AfterMoveSelf', pokemon, target, move);\n\t\t\t\t\t}\n\n\t\t\t\t\t// For partial trapping moves, we are saving the target\n\t\t\t\t\tif (move.volatileStatus === 'partiallytrapped' && target && target.hp > 0) {\n\t\t\t\t\t\t// Let's check if the lock exists\n\t\t\t\t\t\tif (pokemon.volatiles['partialtrappinglock'] && target.volatiles['partiallytrapped']) {\n\t\t\t\t\t\t\t// Here the partialtrappinglock volatile has been already applied\n\t\t\t\t\t\t\tconst sourceVolatile = pokemon.volatiles['partialtrappinglock'];\n\t\t\t\t\t\t\tconst targetVolatile = target.volatiles['partiallytrapped'];\n\t\t\t\t\t\t\tif (!sourceVolatile.locked) {\n\t\t\t\t\t\t\t\t// If it's the first hit, we save the target\n\t\t\t\t\t\t\t\tsourceVolatile.locked = target;\n\t\t\t\t\t\t\t} else if (target !== pokemon && target !== sourceVolatile.locked) {\n\t\t\t\t\t\t\t\t// Our target switched out! Re-roll the duration, damage, and accuracy.\n\t\t\t\t\t\t\t\tconst duration = this.battle.sample([2, 2, 2, 3, 3, 3, 4, 5]);\n\t\t\t\t\t\t\t\tsourceVolatile.duration = duration;\n\t\t\t\t\t\t\t\tsourceVolatile.locked = target;\n\t\t\t\t\t\t\t\t// Duration reset thus partially trapped at 2 always.\n\t\t\t\t\t\t\t\ttargetVolatile.duration = 2;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} // If we move to here, the move failed and there's no partial trapping lock.\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn moveResult;\n\t\t},\n\t\t// This is the function that actually uses the move, running ModifyMove events.\n\t\t// It uses the move and then deals with the effects after the move.\n\t\tuseMoveInner(moveOrMoveName, pokemon, options) {\n\t\t\tlet sourceEffect = options?.sourceEffect;\n\t\t\tlet target = options?.target;\n\t\t\tif (!sourceEffect && this.battle.effect.id) sourceEffect = this.battle.effect;\n\t\t\tconst baseMove = this.battle.dex.moves.get(moveOrMoveName);\n\t\t\tlet move = this.battle.dex.getActiveMove(baseMove);\n\t\t\tif (target === undefined) target = this.battle.getRandomTarget(pokemon, move);\n\t\t\tif (move.target === 'self') {\n\t\t\t\ttarget = pokemon;\n\t\t\t}\n\t\t\tif (sourceEffect) move.sourceEffect = sourceEffect.id;\n\n\t\t\tthis.battle.setActiveMove(move, pokemon, target);\n\n\t\t\tthis.battle.singleEvent('ModifyMove', move, null, pokemon, target, move, move);\n\t\t\tif (baseMove.target !== move.target) {\n\t\t\t\t// Target changed in ModifyMove, so we must adjust it here\n\t\t\t\ttarget = this.battle.getRandomTarget(pokemon, move);\n\t\t\t}\n\t\t\tmove = this.battle.runEvent('ModifyMove', pokemon, target, move, move);\n\t\t\tif (baseMove.target !== move.target) {\n\t\t\t\t// Check again, this shouldn't ever happen on Gen 1.\n\t\t\t\ttarget = this.battle.getRandomTarget(pokemon, move);\n\t\t\t\tthis.battle.debug('not a gen 1 mechanic');\n\t\t\t}\n\t\t\tif (!move) return false;\n\n\t\t\tlet attrs = '';\n\t\t\tif (pokemon.fainted) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (sourceEffect) attrs += `|[from]${this.battle.dex.conditions.get(sourceEffect)}`;\n\t\t\tthis.battle.addMove('move', pokemon, move.name, `${target}${attrs}`);\n\n\t\t\tif (!this.battle.singleEvent('Try', move, null, pokemon, target, move)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (!this.battle.singleEvent('TryMove', move, null, pokemon, target, move) ||\n\t\t\t\t!this.battle.runEvent('TryMove', pokemon, target, move)) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif (move.ignoreImmunity === undefined) {\n\t\t\t\tmove.ignoreImmunity = (move.category === 'Status');\n\t\t\t}\n\n\t\t\tlet damage: number | undefined | false | '' = false;\n\t\t\tif (!target || target.fainted) {\n\t\t\t\tthis.battle.attrLastMove('[notarget]');\n\t\t\t\tthis.battle.add('-notarget');\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t// Store 0 damage for last damage if the move is not in the array.\n\t\t\tif (!SKIP_LASTDAMAGE.has(move.id)) this.battle.lastDamage = 0;\n\n\t\t\tdamage = this.tryMoveHit(target, pokemon, move);\n\n\t\t\t// Disable and Selfdestruct/Explosion boost rage, regardless of whether they miss/fail.\n\t\t\tif (target.boosts.atk < 6 && (move.selfdestruct || move.id === 'disable') && target.volatiles['rage']) {\n\t\t\t\tthis.battle.boost({ atk: 1 }, target, pokemon, this.dex.conditions.get('rage'));\n\t\t\t\tthis.battle.hint(`In Gen 1, using ${move.name} causes the target to build Rage, ` +\n\t\t\t\t\t`even if it misses or fails`, true);\n\t\t\t}\n\n\t\t\t// Go ahead with results of the used move.\n\t\t\tif (damage === false) {\n\t\t\t\tthis.battle.singleEvent('MoveFail', move, null, target, pokemon, move);\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif (!move.negateSecondary) {\n\t\t\t\tthis.battle.singleEvent('AfterMoveSecondarySelf', move, null, pokemon, target, move);\n\t\t\t\tthis.battle.runEvent('AfterMoveSecondarySelf', pokemon, target, move);\n\t\t\t}\n\t\t\treturn true;\n\t\t},\n\t\t// This function attempts a move hit and returns the attempt result before the actual hit happens.\n\t\t// It deals with partial trapping weirdness and accuracy bugs as well.\n\t\ttryMoveHit(target, pokemon, move) {\n\t\t\tlet damage: number | false | undefined = 0;\n\n\t\t\t// Add Thrashing effect before the move does damage, or add confusion if Thrash effect is ending\n\t\t\tif (move?.self?.volatileStatus === 'lockedmove') {\n\t\t\t\tif (pokemon.volatiles['lockedmove']) {\n\t\t\t\t\tpokemon.volatiles['lockedmove'].time--;\n\t\t\t\t\tif (!pokemon.volatiles['lockedmove'].time) {\n\t\t\t\t\t\t// Confusion begins even if already confused.\n\t\t\t\t\t\t// Remove lockedmove volatile when dealing with after move effects.\n\t\t\t\t\t\tdelete pokemon.volatiles['confusion'];\n\t\t\t\t\t\tpokemon.addVolatile('confusion', pokemon, this.dex.conditions.get('lockedmove'));\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tpokemon.addVolatile('lockedmove', pokemon, move);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// First, check if the target is semi-invulnerable\n\t\t\tlet hitResult = this.battle.runEvent('Invulnerability', target, pokemon, move);\n\t\t\tif (hitResult === false) {\n\t\t\t\tthis.battle.attrLastMove('[miss]');\n\t\t\t\tthis.battle.add('-miss', pokemon);\n\t\t\t\tif (move.selfdestruct) {\n\t\t\t\t\tthis.battle.faint(pokemon, pokemon, move);\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// Then, check if the Pok\u00E9mon is immune to this move.\n\t\t\tif (\n\t\t\t\t(!move.ignoreImmunity || (move.ignoreImmunity !== true && !move.ignoreImmunity[move.type])) &&\n\t\t\t\t!target.runImmunity(move.type, true)\n\t\t\t) {\n\t\t\t\tif (move.selfdestruct) {\n\t\t\t\t\tthis.battle.faint(pokemon, pokemon, move);\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\thitResult = this.battle.singleEvent('TryImmunity', move, null, target, pokemon, move);\n\t\t\tif (hitResult === false) {\n\t\t\t\tthis.battle.add('-immune', target);\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// Now, let's calculate the accuracy.\n\t\t\tlet accuracy = move.accuracy;\n\n\t\t\t// Partial trapping moves: true accuracy while it lasts\n\t\t\tif (move.volatileStatus === 'partiallytrapped' && target === pokemon.volatiles['partialtrappinglock']?.locked) {\n\t\t\t\taccuracy = true;\n\t\t\t}\n\n\t\t\t// If a sleep inducing move is used while the user is recharging, the accuracy is true.\n\t\t\tif (move.status === 'slp' && target?.volatiles['mustrecharge']) {\n\t\t\t\taccuracy = true;\n\t\t\t}\n\n\t\t\t// OHKO moves only have a chance to hit if the user is at least as fast as the target\n\t\t\tif (move.ohko) {\n\t\t\t\tif (target.getStat('spe') > pokemon.getStat('spe')) {\n\t\t\t\t\tthis.battle.add('-immune', target, '[ohko]');\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Calculate true accuracy for gen 1, which uses 0-255.\n\t\t\t// Gen 1 uses the same boost table for accuracy and evasiveness as every other stat\n\t\t\tconst boostTable = [25, 28, 33, 40, 50, 66, 100, 150, 200, 250, 300, 350, 400];\n\t\t\tif (accuracy !== true) {\n\t\t\t\taccuracy = Math.floor(accuracy * 255 / 100);\n\t\t\t\t// Rage and Thrash/Petal Dance accuracy bug\n\t\t\t\tif (pokemon.volatiles['lockedmove']) accuracy = pokemon.volatiles['lockedmove'].accuracy;\n\t\t\t\tif (pokemon.volatiles['rage']) accuracy = pokemon.volatiles['rage'].accuracy;\n\n\t\t\t\t// This line is just to satisfy TypeScript, accuracy should never be true at this point\n\t\t\t\tif (accuracy !== true) {\n\t\t\t\t\t// Check also for accuracy modifiers.\n\t\t\t\t\tif (!move.ignoreAccuracy) {\n\t\t\t\t\t\taccuracy = Math.floor(accuracy * (boostTable[pokemon.boosts.accuracy + 6] / 100));\n\t\t\t\t\t}\n\t\t\t\t\tif (!move.ignoreEvasion) {\n\t\t\t\t\t\taccuracy = Math.floor(accuracy * (boostTable[-target.boosts.evasion + 6] / 100));\n\t\t\t\t\t}\n\t\t\t\t\taccuracy = this.battle.clampIntRange(accuracy, 1, 255);\n\t\t\t\t}\n\t\t\t\tif (pokemon.volatiles['lockedmove']) pokemon.volatiles['lockedmove'].accuracy = accuracy;\n\t\t\t\tif (pokemon.volatiles['rage']) pokemon.volatiles['rage'].accuracy = accuracy;\n\t\t\t}\n\t\t\taccuracy = this.battle.runEvent('Accuracy', target, pokemon, move, accuracy);\n\t\t\t// Moves that target the user do not suffer from the 1/256 miss chance.\n\t\t\tif (move.target === 'self' && accuracy !== true) accuracy++;\n\t\t\t// 1/256 chance of missing always, no matter what. Besides the aforementioned exceptions.\n\t\t\tif (accuracy !== true && !this.battle.randomChance(accuracy, 256)) {\n\t\t\t\tthis.battle.attrLastMove('[miss]');\n\t\t\t\tthis.battle.add('-miss', pokemon);\n\t\t\t\tif (accuracy === 255) this.battle.hint(\"In Gen 1, moves with 100% accuracy can still miss 1/256 of the time.\");\n\t\t\t\tdamage = false;\n\t\t\t\tthis.battle.lastDamage = 0;\n\t\t\t}\n\n\t\t\t// If damage is 0 and not false it means it didn't miss, let's calc.\n\t\t\tif (damage !== false) {\n\t\t\t\tif (move.multihit) {\n\t\t\t\t\tlet hits = move.multihit;\n\t\t\t\t\tif (Array.isArray(hits)) {\n\t\t\t\t\t\t// Yes, it's hardcoded... meh\n\t\t\t\t\t\tif (hits[0] === 2 && hits[1] === 5) {\n\t\t\t\t\t\t\thits = this.battle.sample([2, 2, 2, 3, 3, 3, 4, 5]);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\thits = this.battle.random(hits[0], hits[1] + 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\thits = Math.floor(hits);\n\t\t\t\t\t// In gen 1, all the hits have the same damage for multihits move\n\t\t\t\t\tlet moveDamage: number | undefined | false = 0;\n\t\t\t\t\tlet i: number;\n\t\t\t\t\tfor (i = 0; i < hits && target.hp && pokemon.hp; i++) {\n\t\t\t\t\t\tmove.hit = i + 1;\n\t\t\t\t\t\tif (move.hit === hits) move.lastHit = true;\n\t\t\t\t\t\tmoveDamage = this.moveHit(target, pokemon, move);\n\t\t\t\t\t\tif (moveDamage === false) break;\n\t\t\t\t\t\tdamage = (moveDamage || 0);\n\t\t\t\t\t\t// Move damage is fixed to be the first move's damage\n\t\t\t\t\t\tif (i === 0) move.damage = damage;\n\t\t\t\t\t\tif (target.subFainted) {\n\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tmove.damage = null;\n\t\t\t\t\tif (i === 0) return 1;\n\t\t\t\t\tthis.battle.add('-hitcount', target, i);\n\t\t\t\t} else {\n\t\t\t\t\tdamage = this.moveHit(target, pokemon, move);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (move.category !== 'Status') {\n\t\t\t\ttarget.gotAttacked(move, damage, pokemon);\n\t\t\t}\n\n\t\t\tif (move.selfdestruct) {\n\t\t\t\tif (!target.subFainted) {\n\t\t\t\t\tthis.battle.faint(pokemon, pokemon, move);\n\t\t\t\t} else {\n\t\t\t\t\tthis.battle.hint(`In Gen 1, the user of ${move.name} will not take damage if it breaks a Substitute.`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// The move missed.\n\t\t\tif (damage === false) {\n\t\t\t\t// Delete the partial trap lock if necessary.\n\t\t\t\tdelete pokemon.volatiles['partialtrappinglock'];\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (move.ohko) this.battle.add('-ohko');\n\n\t\t\tif (!move.negateSecondary) {\n\t\t\t\tthis.battle.singleEvent('AfterMoveSecondary', move, null, target, pokemon, move);\n\t\t\t\tthis.battle.runEvent('AfterMoveSecondary', target, pokemon, move);\n\t\t\t}\n\n\t\t\treturn damage;\n\t\t},\n\t\t// It deals with the actual move hit, as the name indicates, dealing damage and/or effects.\n\t\t// This function also deals with the Gen 1 Substitute behaviour on the hitting process.\n\t\tmoveHit(target, pokemon, move, moveData, isSecondary, isSelf) {\n\t\t\tlet damage: number | false | null | undefined = 0;\n\n\t\t\tif (!isSecondary && !isSelf) this.battle.setActiveMove(move, pokemon, target);\n\t\t\tlet hitResult: number | boolean = true;\n\t\t\tif (!moveData) moveData = move;\n\n\t\t\tif (move.ignoreImmunity === undefined) {\n\t\t\t\tmove.ignoreImmunity = (move.category === 'Status');\n\t\t\t}\n\n\t\t\t// We get the sub to the target to see if it existed\n\t\t\tconst targetSub = (target) ? target.volatiles['substitute'] : false;\n\t\t\tconst targetHadSub = (targetSub !== null && targetSub !== false && (typeof targetSub !== 'undefined'));\n\t\t\tlet targetHasSub: boolean | undefined = undefined;\n\n\t\t\tif (target) {\n\t\t\t\thitResult = this.battle.singleEvent('TryHit', moveData, {}, target, pokemon, move);\n\n\t\t\t\t// Handle here the applying of partial trapping moves to Pok\u00E9mon with Substitute\n\t\t\t\tif (targetSub && moveData.volatileStatus && moveData.volatileStatus === 'partiallytrapped') {\n\t\t\t\t\ttarget.addVolatile(moveData.volatileStatus, pokemon, move);\n\t\t\t\t\tif (!pokemon.volatiles['partialtrappinglock'] || pokemon.volatiles['partialtrappinglock'].duration! > 1) {\n\t\t\t\t\t\ttarget.volatiles[moveData.volatileStatus].duration = 2;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!hitResult) {\n\t\t\t\t\tif (hitResult === false) this.battle.add('-fail', target);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// Only run the hit events for the hit itself, not the secondary or self hits\n\t\t\t\tif (!isSelf && !isSecondary) {\n\t\t\t\t\thitResult = this.battle.runEvent('TryHit', target, pokemon, move);\n\t\t\t\t\tif (!hitResult) {\n\t\t\t\t\t\tif (hitResult === false) this.battle.add('-fail', target);\n\t\t\t\t\t\t// Special Substitute hit flag\n\t\t\t\t\t\tif (hitResult !== 0) {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!this.battle.runEvent('TryFieldHit', target, pokemon, move)) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t} else if (isSecondary && !moveData.self) {\n\t\t\t\t\thitResult = this.battle.runEvent('TrySecondaryHit', target, pokemon, moveData);\n\t\t\t\t}\n\n\t\t\t\tif (hitResult === 0) {\n\t\t\t\t\ttargetHasSub = !!(target?.volatiles['substitute']);\n\t\t\t\t\ttarget = null;\n\t\t\t\t} else if (!hitResult) {\n\t\t\t\t\tif (hitResult === false) this.battle.add('-fail', target);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (target) {\n\t\t\t\tlet didSomething = false;\n\n\t\t\t\tdamage = this.getDamage(pokemon, target, moveData);\n\n\t\t\t\t// getDamage has several possible return values:\n\t\t\t\t//\n\t\t\t\t// a number:\n\t\t\t\t// means that much damage is dealt (0 damage still counts as dealing\n\t\t\t\t// damage for the purposes of things like Static)\n\t\t\t\t// false:\n\t\t\t\t// gives error message: \"But it failed!\" and move ends\n\t\t\t\t// null:\n\t\t\t\t// the move ends, with no message (usually, a custom fail message\n\t\t\t\t// was already output by an event handler)\n\t\t\t\t// undefined:\n\t\t\t\t// means no damage is dealt and the move continues\n\t\t\t\t//\n\t\t\t\t// basically, these values have the same meanings as they do for event\n\t\t\t\t// handlers.\n\n\t\t\t\tif (damage && damage > target.hp) {\n\t\t\t\t\tdamage = target.hp;\n\t\t\t\t}\n\t\t\t\tif ((damage || damage === 0) && !target.fainted) {\n\t\t\t\t\tdamage = this.battle.damage(damage, target, pokemon, move);\n\t\t\t\t\tif (!(damage || damage === 0)) return false;\n\t\t\t\t\tdidSomething = true;\n\t\t\t\t} else if (damage === false && typeof hitResult === 'undefined') {\n\t\t\t\t\tthis.battle.add('-fail', target);\n\t\t\t\t}\n\t\t\t\tif (damage === false || damage === null) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (moveData.boosts && target.hp) {\n\t\t\t\t\tconst willBoost = this.battle.boost(moveData.boosts, target, pokemon, move);\n\t\t\t\t\tif (!willBoost) {\n\t\t\t\t\t\tthis.battle.add('-fail', target);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tdidSomething = true;\n\t\t\t\t\t// Check the status of the Pok\u00E9mon whose turn is not.\n\t\t\t\t\t// When a move that affects stat levels is used, if the Pok\u00E9mon whose turn it is not right now is paralyzed or\n\t\t\t\t\t// burned, the correspoding stat penalties will be applied again to that Pok\u00E9mon.\n\t\t\t\t\tif (pokemon.side.foe.active[0].status) {\n\t\t\t\t\t\t// If it's paralysed, quarter its speed.\n\t\t\t\t\t\tif (pokemon.side.foe.active[0].status === 'par') {\n\t\t\t\t\t\t\tpokemon.side.foe.active[0].modifyStat!('spe', 0.25);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If it's burned, halve its attack.\n\t\t\t\t\t\tif (pokemon.side.foe.active[0].status === 'brn') {\n\t\t\t\t\t\t\tpokemon.side.foe.active[0].modifyStat!('atk', 0.5);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (moveData.heal && !target.fainted) {\n\t\t\t\t\tconst d = target.heal(Math.floor(target.maxhp * moveData.heal[0] / moveData.heal[1]));\n\t\t\t\t\tif (!d) {\n\t\t\t\t\t\tthis.battle.add('-fail', target);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tthis.battle.add('-heal', target, target.getHealth);\n\t\t\t\t\tdidSomething = true;\n\t\t\t\t}\n\t\t\t\tif (moveData.status) {\n\t\t\t\t\t// Gen 1 bug: If the target has just used hyperbeam and must recharge, its status will be ignored and put to sleep.\n\t\t\t\t\t// This does NOT revert the paralyse speed drop or the burn attack drop.\n\t\t\t\t\t// Also, being put to sleep clears the recharge condition.\n\t\t\t\t\tif (moveData.status === 'slp' && target.volatiles['mustrecharge']) {\n\t\t\t\t\t\t// The sleep move is guaranteed to hit in this situation, unless Sleep Clause activates.\n\t\t\t\t\t\t// Do not clear recharge in that case.\n\t\t\t\t\t\tif (target.setStatus(moveData.status, pokemon, move)) {\n\t\t\t\t\t\t\ttarget.removeVolatile('mustrecharge');\n\t\t\t\t\t\t\tthis.battle.hint(\n\t\t\t\t\t\t\t\t\"In Gen 1, if a Pok\u00E9mon that has just used Hyper Beam and has yet to recharge is targeted with a sleep inducing move, \" +\n\t\t\t\t\t\t\t\t\"any other status it may already have will be ignored and sleep will be induced regardless.\"\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (!target.status) {\n\t\t\t\t\t\tif (target.setStatus(moveData.status, pokemon, move)) {\n\t\t\t\t\t\t\t// Gen 1 mechanics: The burn attack drop and the paralyse speed drop are applied here directly on stat modifiers.\n\t\t\t\t\t\t\tif (moveData.status === 'brn') target.modifyStat!('atk', 0.5);\n\t\t\t\t\t\t\tif (moveData.status === 'par') target.modifyStat!('spe', 0.25);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (!isSecondary) {\n\t\t\t\t\t\tif (target.status === moveData.status) {\n\t\t\t\t\t\t\tthis.battle.add('-fail', target, target.status);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.battle.add('-fail', target);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdidSomething = true;\n\t\t\t\t}\n\t\t\t\tif (moveData.forceStatus) {\n\t\t\t\t\tif (target.setStatus(moveData.forceStatus, pokemon, move)) {\n\t\t\t\t\t\tif (moveData.forceStatus === 'brn') target.modifyStat!('atk', 0.5);\n\t\t\t\t\t\tif (moveData.forceStatus === 'par') target.modifyStat!('spe', 0.25);\n\t\t\t\t\t\tdidSomething = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (moveData.volatileStatus) {\n\t\t\t\t\tif (target.addVolatile(moveData.volatileStatus, pokemon, move)) {\n\t\t\t\t\t\tdidSomething = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (moveData.sideCondition) {\n\t\t\t\t\tif (target.side.addSideCondition(moveData.sideCondition, pokemon, move)) {\n\t\t\t\t\t\tdidSomething = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (moveData.pseudoWeather) {\n\t\t\t\t\tif (this.battle.field.addPseudoWeather(moveData.pseudoWeather, pokemon, move)) {\n\t\t\t\t\t\tdidSomething = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Hit events\n\t\t\t\thitResult = this.battle.singleEvent('Hit', moveData, {}, target, pokemon, move);\n\t\t\t\tif (!isSelf && !isSecondary) {\n\t\t\t\t\tthis.battle.runEvent('Hit', target, pokemon, move);\n\t\t\t\t}\n\t\t\t\tif (!hitResult && !didSomething) {\n\t\t\t\t\tif (hitResult === false) this.battle.add('-fail', target);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (targetHasSub === undefined) targetHasSub = !!(target?.volatiles['substitute']);\n\n\t\t\t// Here's where self effects are applied.\n\t\t\tconst doSelf = (targetHadSub && targetHasSub) || !targetHadSub;\n\t\t\tif (moveData.self && (moveData.self.volatileStatus !== 'lockedmove') &&\n\t\t\t\t(doSelf || moveData.self.volatileStatus === 'partialtrappinglock')) {\n\t\t\t\tthis.moveHit(pokemon, pokemon, move, moveData.self, isSecondary, true);\n\t\t\t}\n\n\t\t\t// Now we can save the partial trapping damage.\n\t\t\tif (pokemon.volatiles['partialtrappinglock']) {\n\t\t\t\tpokemon.volatiles['partialtrappinglock'].damage = this.battle.lastDamage;\n\t\t\t}\n\n\t\t\t// Apply move secondaries.\n\t\t\tif (moveData.secondaries && target && target.hp > 0) {\n\t\t\t\tfor (const secondary of moveData.secondaries) {\n\t\t\t\t\t// Multi-hit moves only roll for status once\n\t\t\t\t\tif (!move.multihit || move.lastHit) {\n\t\t\t\t\t\t// We check here whether to negate the probable secondary status if it's para, burn, or freeze.\n\t\t\t\t\t\t// In the game, this is checked and if true, the random number generator is not called.\n\t\t\t\t\t\t// That means that a move that does not share the type of the target can status it.\n\t\t\t\t\t\t// If a move that was not fire-type would exist on Gen 1, it could burn a Pok\u00E9mon.\n\t\t\t\t\t\tif (!(secondary.status && ['par', 'brn', 'frz'].includes(secondary.status) && target.hasType(move.type))) {\n\t\t\t\t\t\t\tif (secondary.chance === undefined) {\n\t\t\t\t\t\t\t\tthis.moveHit(target, pokemon, move, secondary, true, isSelf);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tlet secondaryChance = Math.ceil(secondary.chance * 256 / 100);\n\t\t\t\t\t\t\t\t// If the secondary effect is confusion, the numerator should be decreased by 1 (10% = 25/256 not 26/256).\n\t\t\t\t\t\t\t\tif (secondary?.volatileStatus === 'confusion') secondaryChance--;\n\t\t\t\t\t\t\t\tif (this.battle.randomChance(secondaryChance, 256)) {\n\t\t\t\t\t\t\t\t\tthis.moveHit(target, pokemon, move, secondary, true, isSelf);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (move.selfSwitch && pokemon.hp) {\n\t\t\t\tpokemon.switchFlag = move.selfSwitch === true ? true : this.dex.toID(move.selfSwitch);\n\t\t\t}\n\n\t\t\treturn damage;\n\t\t},\n\t\t// This calculates the damage pokemon does to target with move.\n\t\tgetDamage(source, target, move, suppressMessages) {\n\t\t\t// First of all, we get the move.\n\t\t\tif (typeof move === 'string') {\n\t\t\t\tmove = this.battle.dex.getActiveMove(move);\n\t\t\t} else if (typeof move === 'number') {\n\t\t\t\tmove = {\n\t\t\t\t\tbasePower: move,\n\t\t\t\t\ttype: '???',\n\t\t\t\t\tcategory: 'Physical',\n\t\t\t\t\twillCrit: false,\n\t\t\t\t\tflags: {},\n\t\t\t\t} as ActiveMove;\n\t\t\t}\n\n\t\t\t// Let's see if the target is immune to the move.\n\t\t\tif (!move.ignoreImmunity || (move.ignoreImmunity !== true && !move.ignoreImmunity[move.type])) {\n\t\t\t\tif (!target.runImmunity(move.type, true)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Is it an OHKO move?\n\t\t\tif (move.ohko) {\n\t\t\t\treturn 65535;\n\t\t\t}\n\n\t\t\t// We edit the damage through move's damage callback if necessary.\n\t\t\tif (move.damageCallback) {\n\t\t\t\treturn move.damageCallback.call(this.battle, source, target);\n\t\t\t}\n\n\t\t\t// We take damage from damage=level moves (seismic toss).\n\t\t\tif (move.damage === 'level') {\n\t\t\t\treturn source.level;\n\t\t\t}\n\n\t\t\t// If there's a fix move damage, we return that.\n\t\t\tif (move.damage || move.damage === 0) {\n\t\t\t\treturn move.damage;\n\t\t\t}\n\n\t\t\t// If it's the first hit on a Normal-type partially trap move, it hits Ghosts anyways but damage is 0.\n\t\t\tif (move.volatileStatus === 'partiallytrapped' && move.type === 'Normal' && target.hasType('Ghost')) {\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\t// Let's check if we are in middle of a partial trap sequence to return the previous damage.\n\t\t\tif (source.volatiles['partialtrappinglock'] && (target === source.volatiles['partialtrappinglock'].locked)) {\n\t\t\t\treturn source.volatiles['partialtrappinglock'].damage;\n\t\t\t}\n\n\t\t\t// We check the category and typing to calculate later on the damage.\n\t\t\tif (!move.category) move.category = 'Physical';\n\t\t\t// '???' is typeless damage: used for Struggle and Confusion etc\n\t\t\tif (!move.type) move.type = '???';\n\t\t\tconst type = move.type;\n\n\t\t\t// We get the base power and apply basePowerCallback if necessary.\n\t\t\tlet basePower: number | false | null = move.basePower;\n\t\t\tif (move.basePowerCallback) {\n\t\t\t\tbasePower = move.basePowerCallback.call(this.battle, source, target, move);\n\t\t\t}\n\t\t\tif (!basePower) {\n\t\t\t\treturn basePower === 0 ? undefined : basePower;\n\t\t\t}\n\t\t\tbasePower = this.battle.clampIntRange(basePower, 1);\n\n\t\t\t// Checking for the move's Critical Hit possibility. We check if it's a 100% crit move, otherwise we calculate the chance.\n\t\t\tlet isCrit = move.willCrit || false;\n\t\t\tif (!isCrit) {\n\t\t\t\t// In gen 1, the critical chance is based on speed.\n\t\t\t\t// First, we get the base speed, divide it by 2 and floor it. This is our current crit chance.\n\t\t\t\tlet critChance = Math.floor(this.dex.species.get(source.set.species).baseStats['spe'] / 2);\n\n\t\t\t\t// Now we check for focus energy volatile.\n\t\t\t\tif (source.volatiles['focusenergy']) {\n\t\t\t\t\t// If it exists, crit chance is divided by 2 again and floored.\n\t\t\t\t\tcritChance = Math.floor(critChance / 2);\n\t\t\t\t} else {\n\t\t\t\t\t// Normally, without focus energy, crit chance is multiplied by 2 and capped at 255 here.\n\t\t\t\t\tcritChance = this.battle.clampIntRange(critChance * 2, 1, 255);\n\t\t\t\t}\n\n\t\t\t\t// Now we check for the move's critical hit ratio.\n\t\t\t\tif (move.critRatio === 1) {\n\t\t\t\t\t// Normal hit ratio, we divide the crit chance by 2 and floor the result again.\n\t\t\t\t\tcritChance = Math.floor(critChance / 2);\n\t\t\t\t} else if (move.critRatio === 2) {\n\t\t\t\t\t// High crit ratio, we multiply the result so far by 4 and cap it at 255.\n\t\t\t\t\tcritChance = this.battle.clampIntRange(critChance * 4, 1, 255);\n\t\t\t\t}\n\n\t\t\t\t// Last, we check deppending on ratio if the move critical hits or not.\n\t\t\t\t// We compare our critical hit chance against a random number between 0 and 255.\n\t\t\t\t// If the random number is lower, we get a critical hit. This means there is always a 1/255 chance of not hitting critically.\n\t\t\t\tif (critChance > 0) {\n\t\t\t\t\tisCrit = this.battle.randomChance(critChance, 256);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (isCrit) target.getMoveHitData(move).crit = true;\n\n\t\t\t// Happens after crit calculation.\n\t\t\tif (basePower) {\n\t\t\t\tbasePower = this.battle.runEvent('BasePower', source, target, move, basePower);\n\t\t\t\tif (basePower && move.basePowerModifier) {\n\t\t\t\t\tbasePower *= move.basePowerModifier;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!basePower) return 0;\n\t\t\tbasePower = this.battle.clampIntRange(basePower, 1);\n\n\t\t\t// We now check attacker's and defender's stats.\n\t\t\tlet level = source.level;\n\t\t\tconst attacker = move.overrideOffensivePokemon === 'target' ? target : source;\n\t\t\tconst defender = move.overrideDefensivePokemon === 'source' ? source : target;\n\n\t\t\tconst isPhysical = move.category === 'Physical';\n\t\t\tconst atkType: StatIDExceptHP = move.overrideOffensiveStat || (isPhysical ? 'atk' : 'spa');\n\t\t\tconst defType: StatIDExceptHP = move.overrideDefensiveStat || (isPhysical ? 'def' : 'spd');\n\n\t\t\tlet attack = attacker.getStat(atkType);\n\t\t\tlet defense = defender.getStat(defType);\n\n\t\t\t// In gen 1, screen effect is applied here.\n\t\t\tif ((defType === 'def' && defender.volatiles['reflect']) || (defType === 'spd' && defender.volatiles['lightscreen'])) {\n\t\t\t\tthis.battle.debug('Screen doubling (Sp)Def');\n\t\t\t\tdefense *= 2;\n\t\t\t}\n\n\t\t\t// In the event of a critical hit, the offense and defense changes are ignored.\n\t\t\t// This includes both boosts and screens.\n\t\t\t// Also, level is doubled in damage calculation.\n\t\t\tif (isCrit) {\n\t\t\t\tmove.ignoreOffensive = true;\n\t\t\t\tmove.ignoreDefensive = true;\n\t\t\t\tlevel *= 2;\n\t\t\t\tif (!suppressMessages) this.battle.add('-crit', target);\n\t\t\t}\n\n\t\t\tif (move.ignoreOffensive) {\n\t\t\t\tthis.battle.debug('Negating (sp)atk boost/penalty.');\n\t\t\t\tattack = attacker.getStat(atkType, true);\n\t\t\t}\n\n\t\t\tif (move.ignoreDefensive) {\n\t\t\t\tthis.battle.debug('Negating (sp)def boost/penalty.');\n\t\t\t\t// No screens\n\t\t\t\tdefense = target.getStat(defType, true);\n\t\t\t}\n\n\t\t\t// When either attack or defense are higher than 256, both are divided by 4.\n\t\t\t// If that's still over 256, it rolls over (%256), which is what causes rollover bugs.\n\t\t\tif (attack >= 256 || defense >= 256) {\n\t\t\t\tif (attack >= 1024 || defense >= 1024) {\n\t\t\t\t\tthis.battle.hint(\"In Gen 1, a stat will roll over to a small number if it is larger than 1024.\");\n\t\t\t\t}\n\t\t\t\tattack = this.battle.clampIntRange(Math.floor(attack / 4) % 256, 1);\n\t\t\t\t// Defense isn't checked on the cartridge, but we don't want those / 0 bugs on the sim.\n\t\t\t\tdefense = Math.floor(defense / 4) % 256;\n\t\t\t\tif (defense === 0) {\n\t\t\t\t\tthis.battle.hint('Pokemon Showdown avoids division by zero by rounding defense up to 1. ' +\n\t\t\t\t\t\t'In game, the battle would have crashed.');\n\t\t\t\t\tdefense = 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Self destruct moves halve defense at this point.\n\t\t\tif (move.selfdestruct && defType === 'def') {\n\t\t\t\tdefense = this.battle.clampIntRange(Math.floor(defense / 2), 1);\n\t\t\t}\n\n\t\t\t// Let's go with the calculation now that we have what we need.\n\t\t\t// We do it step by step just like the game does.\n\t\t\tlet damage = level * 2;\n\t\t\tdamage = Math.floor(damage / 5);\n\t\t\tdamage += 2;\n\t\t\tdamage *= basePower;\n\t\t\tdamage *= attack;\n\t\t\tdamage = Math.floor(damage / defense);\n\t\t\tdamage = this.battle.clampIntRange(Math.floor(damage / 50), 0, 997);\n\t\t\tdamage += 2;\n\n\t\t\t// STAB damage bonus, the \"???\" type never gets STAB\n\t\t\tif (type !== '???' && source.hasType(type)) {\n\t\t\t\tdamage += Math.floor(damage / 2);\n\t\t\t}\n\n\t\t\t// Type effectiveness.\n\t\t\t// In Gen 1, type effectiveness is applied against each of the target's types.\n\t\t\tfor (const targetType of target.types) {\n\t\t\t\tlet typeMod = this.battle.dex.getEffectiveness(type, targetType);\n\t\t\t\ttypeMod = this.battle.runEvent('Effectiveness', this.battle, targetType, move, typeMod);\n\t\t\t\tif (typeMod > 0) {\n\t\t\t\t\t// Super effective against targetType\n\t\t\t\t\tdamage *= 20;\n\t\t\t\t\tdamage = Math.floor(damage / 10);\n\t\t\t\t}\n\t\t\t\tif (typeMod < 0) {\n\t\t\t\t\t// Not very effective against targetType\n\t\t\t\t\tdamage *= 5;\n\t\t\t\t\tdamage = Math.floor(damage / 10);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst totalTypeMod = target.runEffectiveness(move);\n\t\t\tif (totalTypeMod > 0) {\n\t\t\t\tif (!suppressMessages) this.battle.add('-supereffective', target);\n\t\t\t}\n\t\t\tif (totalTypeMod < 0) {\n\t\t\t\tif (!suppressMessages) this.battle.add('-resisted', target);\n\t\t\t}\n\n\t\t\t// If damage becomes 0, the move is made to miss.\n\t\t\t// This occurs when damage was either 2 or 3 prior to applying STAB/Type matchup, and target is 4x resistant to the move.\n\t\t\tif (damage === 0) return damage;\n\n\t\t\t// Apply random factor if damage is greater than 1\n\t\t\tif (damage > 1) {\n\t\t\t\tdamage *= this.battle.random(217, 256);\n\t\t\t\tdamage = Math.floor(damage / 255);\n\t\t\t}\n\n\t\t\t// And we are done.\n\t\t\treturn Math.floor(damage);\n\t\t},\n\t},\n\t// deals with Pok\u00E9mon stat boosting.\n\tboost(boost, target, source = null, effect = null) {\n\t\tif (this.event) {\n\t\t\tif (!target) target = this.event.target;\n\t\t\tif (!source) source = this.event.source;\n\t\t\tif (!effect) effect = this.effect;\n\t\t}\n\t\tif (typeof effect === 'string') effect = this.dex.conditions.get(effect);\n\t\tif (!target?.hp) return 0;\n\t\tlet success = null;\n\t\tboost = this.runEvent('TryBoost', target, source, effect, { ...boost });\n\t\tlet i: BoostID;\n\t\tfor (i in boost) {\n\t\t\tconst currentBoost: SparseBoostsTable = {};\n\t\t\tcurrentBoost[i] = boost[i];\n\t\t\tif (boost[i] !== 0) {\n\t\t\t\tconst boostResult = target.boostBy(currentBoost);\n\t\t\t\tif (boostResult) {\n\t\t\t\t\tsuccess = true;\n\t\t\t\t\tlet msg = '-boost';\n\t\t\t\t\tif (boost[i]! < 0) {\n\t\t\t\t\t\tmsg = '-unboost';\n\t\t\t\t\t\tboost[i] = -boost[i]!;\n\t\t\t\t\t}\n\t\t\t\t\tif (!effect || effect.effectType === 'Move') {\n\t\t\t\t\t\tthis.add(msg, target, i, boost[i]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.add(msg, target, i, boost[i], '[from] ' + effect.fullname);\n\t\t\t\t\t}\n\t\t\t\t\tthis.runEvent('AfterEachBoost', target, source, effect, currentBoost);\n\t\t\t\t}\n\t\t\t\t// Tried to boost at 999 or unboost at 1. This does not count as a success: par/brn effects are not applied afterwards.\n\t\t\t\tif (boostResult === 0) {\n\t\t\t\t\tlet msg = '-boost';\n\t\t\t\t\tlet secondmsg = '-unboost';\n\t\t\t\t\tif (boost[i]! < 0) {\n\t\t\t\t\t\tmsg = '-unboost';\n\t\t\t\t\t\tsecondmsg = '-boost';\n\t\t\t\t\t\tboost[i] = -boost[i]!;\n\t\t\t\t\t}\n\t\t\t\t\tif (!effect || effect.effectType === 'Move') {\n\t\t\t\t\t\tthis.add(msg, target, i, boost[i]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.add(msg, target, i, boost[i], '[from] ' + effect.fullname);\n\t\t\t\t\t}\n\t\t\t\t\tthis.add(secondmsg, target, i, 1);\n\t\t\t\t\tif (msg === '-boost') {\n\t\t\t\t\t\tthis.hint(`In Gen 1, boosting a stat at 999 will apply a -1 drop afterwards, and the stat remains at 999.`, true);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.hint(`In Gen 1, dropping a stat at 1 will apply a +1 boost afterwards, and the stat remains at 1.`, true);\n\t\t\t\t\t}\n\t\t\t\t\tthis.runEvent('AfterEachBoost', target, source, effect, currentBoost);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.runEvent('AfterBoost', target, source, effect, boost);\n\t\treturn success;\n\t},\n};\n"], | |
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,MAAM,kBAAkB,oBAAI,IAAI;AAAA,EAC/B;AAAA,EAAc;AAAA,EAAc;AAAA,EAAW;AAAA,EAAe;AAAA,EAAS;AAAA,EAAQ;AAAA,EAAa;AAAA,EACpF;AAAA,EAAS;AAAA,EAAQ;AAAA,EAAa;AAAA,EAAgB;AAAA,EAAW;AAAA,EAAW;AAAA,EAAQ;AAAA,EAC5E;AAAA,EAAU;AAAA,EAAa;AAAA,EAAc;AAAA,EAAc;AAAA,EAAY;AAAA,EAAe;AAAA,EAAS;AACxF,CAAC;AAED,MAAM,iBAAiB,CAAC,OAAO,OAAO,aAAa,aAAa,aAAa,WAAW;AAEjF,MAAM,UAAmC;AAAA,EAC/C,SAAS;AAAA,EACT,KAAK;AAAA,EACL,OAAO;AACN,eAAW,KAAK,KAAK,KAAK,SAAS;AAClC,YAAM,OAAO,KAAK,QAAQ,WAAW,CAAC;AACtC,WAAK,SAAS;AACd,WAAK,YAAY;AAAA,IAClB;AAAA,EACD;AAAA;AAAA,EAEA,SAAS;AAAA,IACR,SAAS;AAAA,IACT,QAAQ,UAAU,YAAY;AAE7B,UAAI,aAAa;AAAM,cAAM,IAAI,MAAM,8BAA8B;AACrE,UAAI;AAAY,eAAO,KAAK,gBAAgB,QAAQ;AACpD,aAAO,KAAK,cAAe,QAAQ;AAAA,IACpC;AAAA;AAAA,IAEA,WAAW,UAAU,UAAU;AAC9B,UAAI,EAAE,YAAY,KAAK;AAAc,cAAM,IAAI,MAAM,2CAA2C;AAChG,YAAM,gBAAgB,KAAK,OAAO,cAAc,KAAK,MAAM,KAAK,cAAe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