{ "version": 3, "sources": ["../../../../../data/mods/ssb/scripts.ts"], "sourcesContent": ["export const Scripts: ModdedBattleScriptsData = {\r\n\tgen: 8,\r\n\tinherit: 'gen8',\r\n\tactions: {\r\n\t\t// 1 mega per pokemon\r\n\t\trunMegaEvo(pokemon) {\r\n\t\t\tif (pokemon.name === 'Struchni' && pokemon.species.name === 'Aggron') pokemon.canMegaEvo = 'Aggron-Mega';\r\n\t\t\tif (pokemon.name === 'Raj.Shoot' && pokemon.species.name === 'Charizard') pokemon.canMegaEvo = 'Charizard-Mega-X';\r\n\t\t\tconst speciesid = pokemon.canMegaEvo || pokemon.canUltraBurst;\r\n\t\t\tif (!speciesid) return false;\r\n\r\n\t\t\tpokemon.formeChange(speciesid, pokemon.getItem(), true);\r\n\t\t\tif (pokemon.canMegaEvo) {\r\n\t\t\t\tpokemon.canMegaEvo = null;\r\n\t\t\t} else {\r\n\t\t\t\tpokemon.canUltraBurst = null;\r\n\t\t\t}\r\n\r\n\t\t\tthis.battle.runEvent('AfterMega', pokemon);\r\n\r\n\t\t\tif (['Kaiju Bunny', 'Overneat', 'EpicNikolai'].includes(pokemon.name) && !pokemon.illusion) {\r\n\t\t\t\tthis.battle.add('-start', pokemon, 'typechange', pokemon.types.join('/'));\r\n\t\t\t}\r\n\r\n\t\t\tthis.battle.add('-ability', pokemon, `${pokemon.getAbility().name}`);\r\n\r\n\t\t\treturn true;\r\n\t\t},\r\n\r\n\t\t// Modded for Mega Rayquaza\r\n\t\tcanMegaEvo(pokemon) {\r\n\t\t\tconst species = pokemon.baseSpecies;\r\n\t\t\tconst altForme = species.otherFormes && this.dex.species.get(species.otherFormes[0]);\r\n\t\t\tconst item = pokemon.getItem();\r\n\t\t\t// Mega Rayquaza\r\n\t\t\tif (altForme?.isMega && altForme?.requiredMove &&\r\n\t\t\t\tpokemon.baseMoves.includes(this.battle.toID(altForme.requiredMove)) && !item.zMove) {\r\n\t\t\t\treturn altForme.name;\r\n\t\t\t}\r\n\t\t\t// a hacked-in Megazard X can mega evolve into Megazard Y, but not into Megazard X\r\n\t\t\tif (item.megaEvolves === species.baseSpecies && item.megaStone !== species.name) {\r\n\t\t\t\treturn item.megaStone;\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t},\r\n\r\n\t\t// 1 Z per pokemon\r\n\t\tcanZMove(pokemon) {\r\n\t\t\tif (pokemon.m.zMoveUsed ||\r\n\t\t\t\t(pokemon.transformed &&\r\n\t\t\t\t\t(pokemon.species.isMega || pokemon.species.isPrimal || pokemon.species.forme === \"Ultra\"))\r\n\t\t\t) return;\r\n\t\t\tconst item = pokemon.getItem();\r\n\t\t\tif (!item.zMove) return;\r\n\t\t\tif (item.itemUser && !item.itemUser.includes(pokemon.species.name)) return;\r\n\t\t\tlet atLeastOne = false;\r\n\t\t\tlet mustStruggle = true;\r\n\t\t\tconst zMoves: ZMoveOptions = [];\r\n\t\t\tfor (const moveSlot of pokemon.moveSlots) {\r\n\t\t\t\tif (moveSlot.pp <= 0) {\r\n\t\t\t\t\tzMoves.push(null);\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\tif (!moveSlot.disabled) {\r\n\t\t\t\t\tmustStruggle = false;\r\n\t\t\t\t}\r\n\t\t\t\tconst move = this.dex.moves.get(moveSlot.move);\r\n\t\t\t\tlet zMoveName = this.getZMove(move, pokemon, true) || '';\r\n\t\t\t\tif (zMoveName) {\r\n\t\t\t\t\tconst zMove = this.dex.moves.get(zMoveName);\r\n\t\t\t\t\tif (!zMove.isZ && zMove.category === 'Status') zMoveName = \"Z-\" + zMoveName;\r\n\t\t\t\t\tzMoves.push({move: zMoveName, target: zMove.target});\r\n\t\t\t\t} else {\r\n\t\t\t\t\tzMoves.push(null);\r\n\t\t\t\t}\r\n\t\t\t\tif (zMoveName) atLeastOne = true;\r\n\t\t\t}\r\n\t\t\tif (atLeastOne && !mustStruggle) return zMoves;\r\n\t\t},\r\n\r\n\t\tgetZMove(move, pokemon, skipChecks) {\r\n\t\t\tconst item = pokemon.getItem();\r\n\t\t\tif (!skipChecks) {\r\n\t\t\t\tif (pokemon.m.zMoveUsed) return;\r\n\t\t\t\tif (!item.zMove) return;\r\n\t\t\t\tif (item.itemUser && !item.itemUser.includes(pokemon.species.name)) return;\r\n\t\t\t\tconst moveData = pokemon.getMoveData(move);\r\n\t\t\t\t// Draining the PP of the base move prevents the corresponding Z-move from being used.\r\n\t\t\t\tif (!moveData?.pp) return;\r\n\t\t\t}\r\n\r\n\t\t\tif (move.name === item.zMoveFrom) {\r\n\t\t\t\treturn item.zMove as string;\r\n\t\t\t} else if (item.zMove === true && move.type === item.zMoveType) {\r\n\t\t\t\tif (move.category === \"Status\") {\r\n\t\t\t\t\treturn move.name;\r\n\t\t\t\t} else if (move.zMove?.basePower) {\r\n\t\t\t\t\treturn this.Z_MOVES[move.type];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\trunMove(moveOrMoveName, pokemon, targetLoc, sourceEffect, zMove, externalMove, maxMove, originalTarget) {\r\n\t\t\tpokemon.activeMoveActions++;\r\n\t\t\tlet target = this.battle.getTarget(pokemon, maxMove || zMove || moveOrMoveName, targetLoc, originalTarget);\r\n\t\t\tlet baseMove = this.dex.getActiveMove(moveOrMoveName);\r\n\t\t\tconst pranksterBoosted = baseMove.pranksterBoosted;\r\n\t\t\tif (baseMove.id !== 'struggle' && !zMove && !maxMove && !externalMove) {\r\n\t\t\t\tconst changedMove = this.battle.runEvent('OverrideAction', pokemon, target, baseMove);\r\n\t\t\t\tif (changedMove && changedMove !== true) {\r\n\t\t\t\t\tbaseMove = this.dex.getActiveMove(changedMove);\r\n\t\t\t\t\tif (pranksterBoosted) baseMove.pranksterBoosted = pranksterBoosted;\r\n\t\t\t\t\ttarget = this.battle.getRandomTarget(pokemon, baseMove);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tlet move = baseMove;\r\n\t\t\tif (zMove) {\r\n\t\t\t\tmove = this.getActiveZMove(baseMove, pokemon);\r\n\t\t\t} else if (maxMove) {\r\n\t\t\t\tmove = this.getActiveMaxMove(baseMove, pokemon);\r\n\t\t\t}\r\n\r\n\t\t\tmove.isExternal = externalMove;\r\n\r\n\t\t\tthis.battle.setActiveMove(move, pokemon, target);\r\n\r\n\t\t\t/* if (pokemon.moveThisTurn) {\r\n\t\t\t\t// THIS IS PURELY A SANITY CHECK\r\n\t\t\t\t// DO NOT TAKE ADVANTAGE OF THIS TO PREVENT A POKEMON FROM MOVING;\r\n\t\t\t\t// USE this.battle.queue.cancelMove INSTEAD\r\n\t\t\t\tthis.battle.debug('' + pokemon.id + ' INCONSISTENT STATE, ALREADY MOVED: ' + pokemon.moveThisTurn);\r\n\t\t\t\tthis.battle.clearActiveMove(true);\r\n\t\t\t\treturn;\r\n\t\t\t} */\r\n\t\t\tconst willTryMove = this.battle.runEvent('BeforeMove', pokemon, target, move);\r\n\t\t\tif (!willTryMove) {\r\n\t\t\t\tthis.battle.runEvent('MoveAborted', pokemon, target, move);\r\n\t\t\t\tthis.battle.clearActiveMove(true);\r\n\t\t\t\t// The event 'BeforeMove' could have returned false or null\r\n\t\t\t\t// false indicates that this counts as a move failing for the purpose of calculating Stomping Tantrum's base power\r\n\t\t\t\t// null indicates the opposite, as the Pokemon didn't have an option to choose anything\r\n\t\t\t\tpokemon.moveThisTurnResult = willTryMove;\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif (move.beforeMoveCallback) {\r\n\t\t\t\tif (move.beforeMoveCallback.call(this.battle, pokemon, target, move)) {\r\n\t\t\t\t\tthis.battle.clearActiveMove(true);\r\n\t\t\t\t\tpokemon.moveThisTurnResult = false;\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tpokemon.lastDamage = 0;\r\n\t\t\tlet lockedMove;\r\n\t\t\tif (!externalMove) {\r\n\t\t\t\tlockedMove = this.battle.runEvent('LockMove', pokemon);\r\n\t\t\t\tif (lockedMove === true) lockedMove = false;\r\n\t\t\t\tif (!lockedMove) {\r\n\t\t\t\t\tif (!pokemon.deductPP(baseMove, null, target) && (move.id !== 'struggle')) {\r\n\t\t\t\t\t\tthis.battle.add('cant', pokemon, 'nopp', move);\r\n\t\t\t\t\t\tconst gameConsole = [\r\n\t\t\t\t\t\t\tnull, 'Game Boy', 'Game Boy Color', 'Game Boy Advance', 'DS', 'DS', '3DS', '3DS',\r\n\t\t\t\t\t\t][this.battle.gen] || 'Switch';\r\n\t\t\t\t\t\tthis.battle.hint(`This is not a bug, this is really how it works on the ${gameConsole}; try it yourself if you don't believe us.`);\r\n\t\t\t\t\t\tthis.battle.clearActiveMove(true);\r\n\t\t\t\t\t\tpokemon.moveThisTurnResult = false;\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tsourceEffect = this.dex.conditions.get('lockedmove');\r\n\t\t\t\t}\r\n\t\t\t\tpokemon.moveUsed(move, targetLoc);\r\n\t\t\t}\r\n\r\n\t\t\t// Dancer Petal Dance hack\r\n\t\t\t// TODO: implement properly\r\n\t\t\tconst noLock = externalMove && !pokemon.volatiles['lockedmove'];\r\n\r\n\t\t\tif (zMove) {\r\n\t\t\t\tif (pokemon.illusion) {\r\n\t\t\t\t\tthis.battle.singleEvent('End', this.dex.abilities.get('Illusion'), pokemon.abilityState, pokemon);\r\n\t\t\t\t}\r\n\t\t\t\tthis.battle.add('-zpower', pokemon);\r\n\t\t\t\t// In SSB Z-Moves are limited to 1 per pokemon.\r\n\t\t\t\tpokemon.m.zMoveUsed = true;\r\n\t\t\t}\r\n\t\t\tconst moveDidSomething = this.battle.actions.useMove(baseMove, pokemon, target, sourceEffect, zMove, maxMove);\r\n\t\t\tif (this.battle.activeMove) move = this.battle.activeMove;\r\n\t\t\tthis.battle.singleEvent('AfterMove', move, null, pokemon, target, move);\r\n\t\t\tthis.battle.runEvent('AfterMove', pokemon, target, move);\r\n\r\n\t\t\t// Dancer's activation order is completely different from any other event, so it's handled separately\r\n\t\t\tif (move.flags['dance'] && moveDidSomething && !move.isExternal) {\r\n\t\t\t\tconst dancers = [];\r\n\t\t\t\tfor (const currentPoke of this.battle.getAllActive()) {\r\n\t\t\t\t\tif (pokemon === currentPoke) continue;\r\n\t\t\t\t\tif (currentPoke.hasAbility('dancer') && !currentPoke.isSemiInvulnerable()) {\r\n\t\t\t\t\t\tdancers.push(currentPoke);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// Dancer activates in order of lowest speed stat to highest\r\n\t\t\t\t// Note that the speed stat used is after any volatile replacements like Speed Swap,\r\n\t\t\t\t// but before any multipliers like Agility or Choice Scarf\r\n\t\t\t\t// Ties go to whichever Pokemon has had the ability for the least amount of time\r\n\t\t\t\tdancers.sort(\r\n\t\t\t\t\t(a, b) => -(b.storedStats['spe'] - a.storedStats['spe']) || b.abilityOrder - a.abilityOrder\r\n\t\t\t\t);\r\n\t\t\t\tfor (const dancer of dancers) {\r\n\t\t\t\t\tif (this.battle.faintMessages()) break;\r\n\t\t\t\t\tif (dancer.fainted) continue;\r\n\t\t\t\t\tthis.battle.add('-activate', dancer, 'ability: Dancer');\r\n\t\t\t\t\tconst dancersTarget = !target!.isAlly(dancer) && pokemon.isAlly(dancer) ? target! : pokemon;\r\n\t\t\t\t\tconst dancersTargetLoc = dancer.getLocOf(dancersTarget);\r\n\t\t\t\t\tthis.runMove(move.id, dancer, dancersTargetLoc, this.dex.abilities.get('dancer'), undefined, true);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (noLock && pokemon.volatiles['lockedmove']) delete pokemon.volatiles['lockedmove'];\r\n\t\t},\r\n\r\n\t\t// Dollar Store Brand prankster immunity implementation\r\n\t\thitStepTryImmunity(targets, pokemon, move) {\r\n\t\t\tconst hitResults = [];\r\n\t\t\tfor (const [i, target] of targets.entries()) {\r\n\t\t\t\tif (this.battle.gen >= 6 && move.flags['powder'] && target !== pokemon && !this.dex.getImmunity('powder', target)) {\r\n\t\t\t\t\tthis.battle.debug('natural powder immunity');\r\n\t\t\t\t\tthis.battle.add('-immune', target);\r\n\t\t\t\t\thitResults[i] = false;\r\n\t\t\t\t} else if (!this.battle.singleEvent('TryImmunity', move, {}, target, pokemon, move)) {\r\n\t\t\t\t\tthis.battle.add('-immune', target);\r\n\t\t\t\t\thitResults[i] = false;\r\n\t\t\t\t} else if (\r\n\t\t\t\t\tthis.battle.gen >= 7 && move.pranksterBoosted &&\r\n\t\t\t\t\t(pokemon.hasAbility('prankster') || pokemon.hasAbility('plausibledeniability') || pokemon.volatiles['nol']) &&\r\n\t\t\t\t\t!targets[i].isAlly(pokemon) && !this.dex.getImmunity('prankster', target)\r\n\t\t\t\t) {\r\n\t\t\t\t\tthis.battle.debug('natural prankster immunity');\r\n\t\t\t\t\tif (!target.illusion) this.battle.hint(\"Since gen 7, Dark is immune to Prankster moves.\");\r\n\t\t\t\t\tthis.battle.add('-immune', target);\r\n\t\t\t\t\thitResults[i] = false;\r\n\t\t\t\t} else {\r\n\t\t\t\t\thitResults[i] = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn hitResults;\r\n\t\t},\r\n\r\n\t\t// For Jett's The Hunt is On!\r\n\t\tuseMoveInner(moveOrMoveName, pokemon, target, sourceEffect, zMove, maxMove) {\r\n\t\t\tif (!sourceEffect && this.battle.effect.id) sourceEffect = this.battle.effect;\r\n\t\t\tif (sourceEffect && ['instruct', 'custapberry'].includes(sourceEffect.id)) sourceEffect = null;\r\n\r\n\t\t\tlet move = this.dex.getActiveMove(moveOrMoveName);\r\n\t\t\tif (move.id === 'weatherball' && zMove) {\r\n\t\t\t\t// Z-Weather Ball only changes types if it's used directly,\r\n\t\t\t\t// not if it's called by Z-Sleep Talk or something.\r\n\t\t\t\tthis.battle.singleEvent('ModifyType', move, null, pokemon, target, move, move);\r\n\t\t\t\tif (move.type !== 'Normal') sourceEffect = move;\r\n\t\t\t}\r\n\t\t\tif (zMove || (move.category !== 'Status' && sourceEffect && (sourceEffect as ActiveMove).isZ)) {\r\n\t\t\t\tmove = this.getActiveZMove(move, pokemon);\r\n\t\t\t}\r\n\t\t\tif (maxMove && move.category !== 'Status') {\r\n\t\t\t\t// Max move outcome is dependent on the move type after type modifications from ability and the move itself\r\n\t\t\t\tthis.battle.singleEvent('ModifyType', move, null, pokemon, target, move, move);\r\n\t\t\t\tthis.battle.runEvent('ModifyType', pokemon, target, move, move);\r\n\t\t\t}\r\n\t\t\tif (maxMove || (move.category !== 'Status' && sourceEffect && (sourceEffect as ActiveMove).isMax)) {\r\n\t\t\t\tmove = this.getActiveMaxMove(move, pokemon);\r\n\t\t\t}\r\n\r\n\t\t\tif (this.battle.activeMove) {\r\n\t\t\t\tmove.priority = this.battle.activeMove.priority;\r\n\t\t\t\tif (!move.hasBounced) move.pranksterBoosted = this.battle.activeMove.pranksterBoosted;\r\n\t\t\t}\r\n\t\t\tconst baseTarget = move.target;\r\n\t\t\tif (target === undefined) target = this.battle.getRandomTarget(pokemon, move);\r\n\t\t\tif (move.target === 'self' || move.target === 'allies') {\r\n\t\t\t\ttarget = pokemon;\r\n\t\t\t}\r\n\t\t\tif (sourceEffect) {\r\n\t\t\t\tmove.sourceEffect = sourceEffect.id;\r\n\t\t\t\tmove.ignoreAbility = false;\r\n\t\t\t}\r\n\t\t\tlet moveResult = false;\r\n\r\n\t\t\tthis.battle.setActiveMove(move, pokemon, target);\r\n\r\n\t\t\tthis.battle.singleEvent('ModifyType', move, null, pokemon, target, move, move);\r\n\t\t\tthis.battle.singleEvent('ModifyMove', move, null, pokemon, target, move, move);\r\n\t\t\tif (baseTarget !== move.target) {\r\n\t\t\t\t// Target changed in ModifyMove, so we must adjust it here\r\n\t\t\t\t// Adjust before the next event so the correct target is passed to the\r\n\t\t\t\t// event\r\n\t\t\t\ttarget = this.battle.getRandomTarget(pokemon, move);\r\n\t\t\t}\r\n\t\t\tmove = this.battle.runEvent('ModifyType', pokemon, target, move, move);\r\n\t\t\tmove = this.battle.runEvent('ModifyMove', pokemon, target, move, move);\r\n\t\t\tif (baseTarget !== move.target) {\r\n\t\t\t\t// Adjust again\r\n\t\t\t\ttarget = this.battle.getRandomTarget(pokemon, move);\r\n\t\t\t}\r\n\t\t\tif (!move || pokemon.fainted) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\tlet attrs = '';\r\n\r\n\t\t\tlet movename = move.name;\r\n\t\t\tif (move.id === 'hiddenpower') movename = 'Hidden Power';\r\n\t\t\tif (sourceEffect) attrs += '|[from]' + this.dex.conditions.get(sourceEffect);\r\n\t\t\tif (zMove && move.isZ === true) {\r\n\t\t\t\tattrs = '|[anim]' + movename + attrs;\r\n\t\t\t\tmovename = 'Z-' + movename;\r\n\t\t\t}\r\n\t\t\tthis.battle.addMove('move', pokemon, movename, target + attrs);\r\n\r\n\t\t\tif (zMove) this.runZPower(move, pokemon);\r\n\r\n\t\t\tif (!target) {\r\n\t\t\t\tthis.battle.attrLastMove('[notarget]');\r\n\t\t\t\tthis.battle.add(this.battle.gen >= 5 ? '-fail' : '-notarget', pokemon);\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\tconst {targets, pressureTargets} = pokemon.getMoveTargets(move, target);\r\n\t\t\tif (targets.length) {\r\n\t\t\t\ttarget = targets[targets.length - 1]; // in case of redirection\r\n\t\t\t}\r\n\r\n\t\t\tif (!sourceEffect || sourceEffect.id === 'pursuit' || sourceEffect.id === 'thehuntison') {\r\n\t\t\t\tlet extraPP = 0;\r\n\t\t\t\tfor (const source of pressureTargets) {\r\n\t\t\t\t\tconst ppDrop = this.battle.runEvent('DeductPP', source, pokemon, move);\r\n\t\t\t\t\tif (ppDrop !== true) {\r\n\t\t\t\t\t\textraPP += ppDrop || 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (extraPP > 0) {\r\n\t\t\t\t\tpokemon.deductPP(move, extraPP);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (!this.battle.singleEvent('TryMove', move, null, pokemon, target, move) ||\r\n\t\t\t\t!this.battle.runEvent('TryMove', pokemon, target, move)) {\r\n\t\t\t\tmove.mindBlownRecoil = false;\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\tthis.battle.singleEvent('UseMoveMessage', move, null, pokemon, target, move);\r\n\r\n\t\t\tif (move.ignoreImmunity === undefined) {\r\n\t\t\t\tmove.ignoreImmunity = (move.category === 'Status');\r\n\t\t\t}\r\n\r\n\t\t\tif (this.battle.gen !== 4 && move.selfdestruct === 'always') {\r\n\t\t\t\tthis.battle.faint(pokemon, pokemon, move);\r\n\t\t\t}\r\n\r\n\t\t\tlet damage: number | false | undefined | '' = false;\r\n\t\t\tif (move.target === 'all' || move.target === 'foeSide' || move.target === 'allySide' || move.target === 'allyTeam') {\r\n\t\t\t\tdamage = this.tryMoveHit(target, pokemon, move);\r\n\t\t\t\tif (damage === this.battle.NOT_FAIL) pokemon.moveThisTurnResult = null;\r\n\t\t\t\tif (damage || damage === 0 || damage === undefined) moveResult = true;\r\n\t\t\t} else {\r\n\t\t\t\tif (!targets.length) {\r\n\t\t\t\t\tthis.battle.attrLastMove('[notarget]');\r\n\t\t\t\t\tthis.battle.add(this.battle.gen >= 5 ? '-fail' : '-notarget', pokemon);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t\tif (this.battle.gen === 4 && move.selfdestruct === 'always') {\r\n\t\t\t\t\tthis.battle.faint(pokemon, pokemon, move);\r\n\t\t\t\t}\r\n\t\t\t\tmoveResult = this.trySpreadMoveHit(targets, pokemon, move);\r\n\t\t\t}\r\n\t\t\tif (move.selfBoost && moveResult) this.moveHit(pokemon, pokemon, move, move.selfBoost, false, true);\r\n\t\t\tif (!pokemon.hp) {\r\n\t\t\t\tthis.battle.faint(pokemon, pokemon, move);\r\n\t\t\t}\r\n\r\n\t\t\tif (!moveResult) {\r\n\t\t\t\tthis.battle.singleEvent('MoveFail', move, null, target, pokemon, move);\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\tif (\r\n\t\t\t\t!move.negateSecondary &&\r\n\t\t\t\t!(move.hasSheerForce && pokemon.hasAbility(['sheerforce', 'aquilasblessing'])) &&\r\n\t\t\t\t!this.battle.getAllActive().some(x => x.hasAbility('skilldrain'))\r\n\t\t\t) {\r\n\t\t\t\tconst originalHp = pokemon.hp;\r\n\t\t\t\tthis.battle.singleEvent('AfterMoveSecondarySelf', move, null, pokemon, target, move);\r\n\t\t\t\tthis.battle.runEvent('AfterMoveSecondarySelf', pokemon, target, move);\r\n\t\t\t\tif (pokemon !== target && move.category !== 'Status') {\r\n\t\t\t\t\tif (pokemon.hp <= pokemon.maxhp / 2 && originalHp > pokemon.maxhp / 2) {\r\n\t\t\t\t\t\tthis.battle.runEvent('EmergencyExit', pokemon, pokemon);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (move.selfSwitch && this.battle.getAllActive().some(x => x.hasAbility('skilldrain'))) {\r\n\t\t\t\tthis.battle.hint(`Self-switching doesn't trigger when a Pokemon with Skill Drain is active.`);\r\n\t\t\t}\r\n\r\n\t\t\treturn true;\r\n\t\t},\r\n\t\tafterMoveSecondaryEvent(targets, pokemon, move) {\r\n\t\t\t// console.log(`${targets}, ${pokemon}, ${move}`)\r\n\t\t\tif (\r\n\t\t\t\t!move.negateSecondary &&\r\n\t\t\t\t!(move.hasSheerForce && pokemon.hasAbility(['sheerforce', 'aquilasblessing'])) &&\r\n\t\t\t\t!this.battle.getAllActive().some(x => x.hasAbility('skilldrain'))\r\n\t\t\t) {\r\n\t\t\t\tthis.battle.singleEvent('AfterMoveSecondary', move, null, targets[0], pokemon, move);\r\n\t\t\t\tthis.battle.runEvent('AfterMoveSecondary', targets, pokemon, move);\r\n\t\t\t}\r\n\t\t\treturn undefined;\r\n\t\t},\r\n\t\thitStepMoveHitLoop(targets, pokemon, move) { // Temporary name\r\n\t\t\tconst damage: (number | boolean | undefined)[] = [];\r\n\t\t\tfor (const i of targets.keys()) {\r\n\t\t\t\tdamage[i] = 0;\r\n\t\t\t}\r\n\t\t\tmove.totalDamage = 0;\r\n\t\t\tpokemon.lastDamage = 0;\r\n\t\t\tlet targetHits = move.multihit || 1;\r\n\t\t\tif (Array.isArray(targetHits)) {\r\n\t\t\t\t// yes, it's hardcoded... meh\r\n\t\t\t\tif (targetHits[0] === 2 && targetHits[1] === 5) {\r\n\t\t\t\t\tif (this.battle.gen >= 5) {\r\n\t\t\t\t\t\ttargetHits = this.battle.sample([2, 2, 3, 3, 4, 5]);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\ttargetHits = this.battle.sample([2, 2, 2, 3, 3, 3, 4, 5]);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttargetHits = this.battle.random(targetHits[0], targetHits[1] + 1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\ttargetHits = Math.floor(targetHits);\r\n\t\t\tlet nullDamage = true;\r\n\t\t\tlet moveDamage: (number | boolean | undefined)[];\r\n\t\t\t// There is no need to recursively check the \u00B4sleepUsable\u00B4 flag as Sleep Talk can only be used while asleep.\r\n\t\t\tconst isSleepUsable = move.sleepUsable || this.dex.moves.get(move.sourceEffect).sleepUsable;\r\n\r\n\t\t\tlet targetsCopy: (Pokemon | false | null)[] = targets.slice(0);\r\n\t\t\tlet hit: number;\r\n\t\t\tfor (hit = 1; hit <= targetHits; hit++) {\r\n\t\t\t\tif (damage.includes(false)) break;\r\n\t\t\t\tif (hit > 1 && pokemon.status === 'slp' && !isSleepUsable) break;\r\n\t\t\t\tif (targets.every(target => !target?.hp)) break;\r\n\t\t\t\tmove.hit = hit;\r\n\t\t\t\tif (move.smartTarget && targets.length > 1) {\r\n\t\t\t\t\ttargetsCopy = [targets[hit - 1]];\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttargetsCopy = targets.slice(0);\r\n\t\t\t\t}\r\n\t\t\t\tconst target = targetsCopy[0]; // some relevant-to-single-target-moves-only things are hardcoded\r\n\t\t\t\tif (target && typeof move.smartTarget === 'boolean') {\r\n\t\t\t\t\tif (hit > 1) {\r\n\t\t\t\t\t\tthis.battle.addMove('-anim', pokemon, move.name, target);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis.battle.retargetLastMove(target);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// like this (Triple Kick)\r\n\t\t\t\tif (target && move.multiaccuracy && hit > 1) {\r\n\t\t\t\t\tlet accuracy = move.accuracy;\r\n\t\t\t\t\tconst boostTable = [1, 4 / 3, 5 / 3, 2, 7 / 3, 8 / 3, 3];\r\n\t\t\t\t\tif (accuracy !== true) {\r\n\t\t\t\t\t\tif (!move.ignoreAccuracy) {\r\n\t\t\t\t\t\t\tconst boosts = this.battle.runEvent('ModifyBoost', pokemon, null, null, {...pokemon.boosts});\r\n\t\t\t\t\t\t\tconst boost = this.battle.clampIntRange(boosts['accuracy'], -6, 6);\r\n\t\t\t\t\t\t\tif (boost > 0) {\r\n\t\t\t\t\t\t\t\taccuracy *= boostTable[boost];\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\taccuracy /= boostTable[-boost];\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (!move.ignoreEvasion) {\r\n\t\t\t\t\t\t\tconst boosts = this.battle.runEvent('ModifyBoost', target, null, null, {...target.boosts});\r\n\t\t\t\t\t\t\tconst boost = this.battle.clampIntRange(boosts['evasion'], -6, 6);\r\n\t\t\t\t\t\t\tif (boost > 0) {\r\n\t\t\t\t\t\t\t\taccuracy /= boostTable[boost];\r\n\t\t\t\t\t\t\t} else if (boost < 0) {\r\n\t\t\t\t\t\t\t\taccuracy *= boostTable[-boost];\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\taccuracy = this.battle.runEvent('ModifyAccuracy', target, pokemon, move, accuracy);\r\n\t\t\t\t\tif (!move.alwaysHit) {\r\n\t\t\t\t\t\taccuracy = this.battle.runEvent('Accuracy', target, pokemon, move, accuracy);\r\n\t\t\t\t\t\tif (accuracy !== true && !this.battle.randomChance(accuracy, 100)) break;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst moveData = move;\r\n\t\t\t\tif (!moveData.flags) moveData.flags = {};\r\n\r\n\t\t\t\t// Modifies targetsCopy (which is why it's a copy)\r\n\t\t\t\t[moveDamage, targetsCopy] = this.spreadMoveHit(targetsCopy, pokemon, move, moveData);\r\n\r\n\t\t\t\tif (!moveDamage.some(val => val !== false)) break;\r\n\t\t\t\tnullDamage = false;\r\n\r\n\t\t\t\tfor (const [i, md] of moveDamage.entries()) {\r\n\t\t\t\t\t// Damage from each hit is individually counted for the\r\n\t\t\t\t\t// purposes of Counter, Metal Burst, and Mirror Coat.\r\n\t\t\t\t\tdamage[i] = md === true || !md ? 0 : md;\r\n\t\t\t\t\t// Total damage dealt is accumulated for the purposes of recoil (Parental Bond).\r\n\t\t\t\t\t// @ts-ignore\r\n\t\t\t\t\tmove.totalDamage += damage[i];\r\n\t\t\t\t}\r\n\t\t\t\tif (move.mindBlownRecoil) {\r\n\t\t\t\t\tthis.battle.damage(Math.round(pokemon.maxhp / 2), pokemon, pokemon, this.dex.conditions.get('Mind Blown'), true);\r\n\t\t\t\t\tmove.mindBlownRecoil = false;\r\n\t\t\t\t}\r\n\t\t\t\tthis.battle.eachEvent('Update');\r\n\t\t\t\tif (!pokemon.hp && targets.length === 1) {\r\n\t\t\t\t\thit++; // report the correct number of hits for multihit moves\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// hit is 1 higher than the actual hit count\r\n\t\t\tif (hit === 1) return damage.fill(false);\r\n\t\t\tif (nullDamage) damage.fill(false);\r\n\t\t\tif (move.multihit && typeof move.smartTarget !== 'boolean') {\r\n\t\t\t\tthis.battle.add('-hitcount', targets[0], hit - 1);\r\n\t\t\t}\r\n\r\n\t\t\tif (move.recoil && move.totalDamage) {\r\n\t\t\t\tthis.battle.damage(this.calcRecoilDamage(move.totalDamage, move), pokemon, pokemon, 'recoil');\r\n\t\t\t}\r\n\r\n\t\t\tif (move.struggleRecoil) {\r\n\t\t\t\tlet recoilDamage;\r\n\t\t\t\tif (this.dex.gen >= 5) {\r\n\t\t\t\t\trecoilDamage = this.battle.clampIntRange(Math.round(pokemon.baseMaxhp / 4), 1);\r\n\t\t\t\t} else {\r\n\t\t\t\t\trecoilDamage = this.battle.trunc(pokemon.maxhp / 4);\r\n\t\t\t\t}\r\n\t\t\t\tthis.battle.directDamage(recoilDamage, pokemon, pokemon, {id: 'strugglerecoil'} as Condition);\r\n\t\t\t}\r\n\r\n\t\t\t// smartTarget messes up targetsCopy, but smartTarget should in theory ensure that targets will never fail, anyway\r\n\t\t\tif (move.smartTarget) targetsCopy = targets.slice(0);\r\n\r\n\t\t\tfor (const [i, target] of targetsCopy.entries()) {\r\n\t\t\t\tif (target && pokemon !== target) {\r\n\t\t\t\t\ttarget.gotAttacked(move, damage[i] as number | false | undefined, pokemon);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (move.ohko && !targets[0].hp) this.battle.add('-ohko');\r\n\r\n\t\t\tif (!damage.some(val => !!val || val === 0)) return damage;\r\n\r\n\t\t\tthis.battle.eachEvent('Update');\r\n\r\n\t\t\tthis.afterMoveSecondaryEvent(targetsCopy.filter(val => !!val) as Pokemon[], pokemon, move);\r\n\r\n\t\t\tif (\r\n\t\t\t\t!move.negateSecondary &&\r\n\t\t\t\t!(move.hasSheerForce && pokemon.hasAbility(['sheerforce', 'aquilasblessing'])) &&\r\n\t\t\t\t!this.battle.getAllActive().some(x => x.hasAbility('skilldrain'))\r\n\t\t\t) {\r\n\t\t\t\tfor (const [i, d] of damage.entries()) {\r\n\t\t\t\t\t// There are no multihit spread moves, so it's safe to use move.totalDamage for multihit moves\r\n\t\t\t\t\t// The previous check was for `move.multihit`, but that fails for Dragon Darts\r\n\t\t\t\t\tconst curDamage = targets.length === 1 ? move.totalDamage : d;\r\n\t\t\t\t\tif (typeof curDamage === 'number' && targets[i].hp) {\r\n\t\t\t\t\t\tif (targets[i].hp <= targets[i].maxhp / 2 && targets[i].hp + curDamage > targets[i].maxhp / 2) {\r\n\t\t\t\t\t\t\tthis.battle.runEvent('EmergencyExit', targets[i], pokemon);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn damage;\r\n\t\t},\r\n\r\n\t\t// For Spandan's custom move and Brandon's ability\r\n\t\tgetDamage(source, target, move, suppressMessages = false) {\r\n\t\t\tif (typeof move === 'string') move = this.dex.getActiveMove(move);\r\n\r\n\t\t\tif (typeof move === 'number') {\r\n\t\t\t\tconst basePower = move;\r\n\t\t\t\tmove = new Dex.Move({\r\n\t\t\t\t\tbasePower,\r\n\t\t\t\t\ttype: '???',\r\n\t\t\t\t\tcategory: 'Physical',\r\n\t\t\t\t\twillCrit: false,\r\n\t\t\t\t}) as unknown as ActiveMove;\r\n\t\t\t\tmove.hit = 0;\r\n\t\t\t}\r\n\r\n\t\t\tif (!move.ignoreImmunity || (move.ignoreImmunity !== true && !move.ignoreImmunity[move.type])) {\r\n\t\t\t\tif (!target.runImmunity(move.type, !suppressMessages)) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (move.ohko) return target.maxhp;\r\n\t\t\tif (move.damageCallback) return move.damageCallback.call(this.battle, source, target);\r\n\t\t\tif (move.damage === 'level') {\r\n\t\t\t\treturn source.level;\r\n\t\t\t} else if (move.damage) {\r\n\t\t\t\treturn move.damage;\r\n\t\t\t}\r\n\r\n\t\t\tconst category = this.battle.getCategory(move);\r\n\r\n\t\t\tlet basePower: number | false | null = move.basePower;\r\n\t\t\tif (move.basePowerCallback) {\r\n\t\t\t\tbasePower = move.basePowerCallback.call(this.battle, source, target, move);\r\n\t\t\t}\r\n\t\t\tif (!basePower) return basePower === 0 ? undefined : basePower;\r\n\t\t\tbasePower = this.battle.clampIntRange(basePower, 1);\r\n\r\n\t\t\tlet critMult;\r\n\t\t\tlet critRatio = this.battle.runEvent('ModifyCritRatio', source, target, move, move.critRatio || 0);\r\n\t\t\tif (this.battle.gen <= 5) {\r\n\t\t\t\tcritRatio = this.battle.clampIntRange(critRatio, 0, 5);\r\n\t\t\t\tcritMult = [0, 16, 8, 4, 3, 2];\r\n\t\t\t} else {\r\n\t\t\t\tcritRatio = this.battle.clampIntRange(critRatio, 0, 4);\r\n\t\t\t\tif (this.battle.gen === 6) {\r\n\t\t\t\t\tcritMult = [0, 16, 8, 2, 1];\r\n\t\t\t\t} else {\r\n\t\t\t\t\tcritMult = [0, 24, 8, 2, 1];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tconst moveHit = target.getMoveHitData(move);\r\n\t\t\tmoveHit.crit = move.willCrit || false;\r\n\t\t\tif (move.willCrit === undefined) {\r\n\t\t\t\tif (critRatio) {\r\n\t\t\t\t\tmoveHit.crit = this.battle.randomChance(1, critMult[critRatio]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (moveHit.crit) {\r\n\t\t\t\tmoveHit.crit = this.battle.runEvent('CriticalHit', target, null, move);\r\n\t\t\t}\r\n\r\n\t\t\t// happens after crit calculation\r\n\t\t\tbasePower = this.battle.runEvent('BasePower', source, target, move, basePower, true);\r\n\r\n\t\t\tif (!basePower) return 0;\r\n\t\t\tbasePower = this.battle.clampIntRange(basePower, 1);\r\n\r\n\t\t\tconst level = source.level;\r\n\r\n\t\t\tconst attacker = move.overrideOffensivePokemon === 'target' ? target : source;\r\n\t\t\tconst defender = move.overrideDefensivePokemon === 'source' ? source : target;\r\n\r\n\t\t\tconst isPhysical = move.category === 'Physical';\r\n\t\t\tlet attackStat: StatIDExceptHP = move.overrideOffensiveStat || (isPhysical ? 'atk' : 'spa');\r\n\t\t\tconst defenseStat: StatIDExceptHP = move.overrideDefensiveStat || (isPhysical ? 'def' : 'spd');\r\n\r\n\t\t\tconst statTable = {atk: 'Atk', def: 'Def', spa: 'SpA', spd: 'SpD', spe: 'Spe'};\r\n\r\n\t\t\tlet atkBoosts = attacker.boosts[attackStat];\r\n\t\t\tlet defBoosts = defender.boosts[defenseStat];\r\n\r\n\t\t\tlet ignoreNegativeOffensive = !!move.ignoreNegativeOffensive;\r\n\t\t\tlet ignorePositiveDefensive = !!move.ignorePositiveDefensive;\r\n\r\n\t\t\tif (moveHit.crit) {\r\n\t\t\t\tignoreNegativeOffensive = true;\r\n\t\t\t\tignorePositiveDefensive = true;\r\n\t\t\t}\r\n\t\t\tconst ignoreOffensive = !!(move.ignoreOffensive || (ignoreNegativeOffensive && atkBoosts < 0));\r\n\t\t\tconst ignoreDefensive = !!(move.ignoreDefensive || (ignorePositiveDefensive && defBoosts > 0));\r\n\r\n\t\t\tif (ignoreOffensive) {\r\n\t\t\t\tthis.battle.debug('Negating (sp)atk boost/penalty.');\r\n\t\t\t\tatkBoosts = 0;\r\n\t\t\t}\r\n\t\t\tif (ignoreDefensive) {\r\n\t\t\t\tthis.battle.debug('Negating (sp)def boost/penalty.');\r\n\t\t\t\tdefBoosts = 0;\r\n\t\t\t}\r\n\r\n\t\t\tlet attack = attacker.calculateStat(attackStat, atkBoosts);\r\n\t\t\tlet defense = defender.calculateStat(defenseStat, defBoosts);\r\n\r\n\t\t\tattackStat = (category === 'Physical' ? 'atk' : 'spa');\r\n\r\n\t\t\t// Apply Stat Modifiers\r\n\t\t\tattack = this.battle.runEvent('Modify' + statTable[attackStat], source, target, move, attack);\r\n\t\t\tdefense = this.battle.runEvent('Modify' + statTable[defenseStat], target, source, move, defense);\r\n\r\n\t\t\tif (this.battle.gen <= 4 && ['explosion', 'selfdestruct'].includes(move.id) && defenseStat === 'def') {\r\n\t\t\t\tdefense = this.battle.clampIntRange(Math.floor(defense / 2), 1);\r\n\t\t\t}\r\n\r\n\t\t\tconst tr = this.battle.trunc;\r\n\r\n\t\t\t// int(int(int(2 * L / 5 + 2) * A * P / D) / 50);\r\n\t\t\tconst baseDamage = tr(tr(tr(tr(2 * level / 5 + 2) * basePower * attack) / defense) / 50);\r\n\r\n\t\t\t// Calculate damage modifiers separately (order differs between generations)\r\n\t\t\treturn this.modifyDamage(baseDamage, source, target, move, suppressMessages);\r\n\t\t},\r\n\r\n\t\trunMoveEffects(damage, targets, pokemon, move, moveData, isSecondary, isSelf) {\r\n\t\t\tlet didAnything: number | boolean | null | undefined = damage.reduce(this.combineResults);\r\n\t\t\tfor (const [i, target] of targets.entries()) {\r\n\t\t\t\tif (target === false) continue;\r\n\t\t\t\tlet hitResult;\r\n\t\t\t\tlet didSomething: number | boolean | null | undefined = undefined;\r\n\r\n\t\t\t\tif (target) {\r\n\t\t\t\t\tif (moveData.boosts && !target.fainted) {\r\n\t\t\t\t\t\thitResult = this.battle.boost(moveData.boosts, target, pokemon, move, isSecondary, isSelf);\r\n\t\t\t\t\t\tdidSomething = this.combineResults(didSomething, hitResult);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (moveData.heal && !target.fainted) {\r\n\t\t\t\t\t\tif (target.hp >= target.maxhp) {\r\n\t\t\t\t\t\t\tthis.battle.add('-fail', target, 'heal');\r\n\t\t\t\t\t\t\tthis.battle.attrLastMove('[still]');\r\n\t\t\t\t\t\t\tdamage[i] = this.combineResults(damage[i], false);\r\n\t\t\t\t\t\t\tdidAnything = this.combineResults(didAnything, null);\r\n\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconst amount = target.baseMaxhp * moveData.heal[0] / moveData.heal[1];\r\n\t\t\t\t\t\tconst d = target.heal((this.battle.gen < 5 ? Math.floor : Math.round)(amount));\r\n\t\t\t\t\t\tif (!d && d !== 0) {\r\n\t\t\t\t\t\t\tthis.battle.add('-fail', pokemon);\r\n\t\t\t\t\t\t\tthis.battle.attrLastMove('[still]');\r\n\t\t\t\t\t\t\tthis.battle.debug('heal interrupted');\r\n\t\t\t\t\t\t\tdamage[i] = this.combineResults(damage[i], false);\r\n\t\t\t\t\t\t\tdidAnything = this.combineResults(didAnything, null);\r\n\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tthis.battle.add('-heal', target, target.getHealth);\r\n\t\t\t\t\t\tdidSomething = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (moveData.status) {\r\n\t\t\t\t\t\thitResult = target.trySetStatus(moveData.status, pokemon, moveData.ability ? moveData.ability : move);\r\n\t\t\t\t\t\tif (!hitResult && move.status) {\r\n\t\t\t\t\t\t\tdamage[i] = this.combineResults(damage[i], false);\r\n\t\t\t\t\t\t\tdidAnything = this.combineResults(didAnything, null);\r\n\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tdidSomething = this.combineResults(didSomething, hitResult);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (moveData.forceStatus) {\r\n\t\t\t\t\t\thitResult = target.setStatus(moveData.forceStatus, pokemon, move);\r\n\t\t\t\t\t\tdidSomething = this.combineResults(didSomething, hitResult);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (moveData.volatileStatus) {\r\n\t\t\t\t\t\thitResult = target.addVolatile(moveData.volatileStatus, pokemon, move);\r\n\t\t\t\t\t\tdidSomething = this.combineResults(didSomething, hitResult);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (moveData.sideCondition) {\r\n\t\t\t\t\t\thitResult = target.side.addSideCondition(moveData.sideCondition, pokemon, move);\r\n\t\t\t\t\t\tdidSomething = this.combineResults(didSomething, hitResult);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (moveData.slotCondition) {\r\n\t\t\t\t\t\thitResult = target.side.addSlotCondition(target, moveData.slotCondition, pokemon, move);\r\n\t\t\t\t\t\tdidSomething = this.combineResults(didSomething, hitResult);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (moveData.weather) {\r\n\t\t\t\t\t\thitResult = this.battle.field.setWeather(moveData.weather, pokemon, move);\r\n\t\t\t\t\t\tdidSomething = this.combineResults(didSomething, hitResult);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (moveData.terrain) {\r\n\t\t\t\t\t\thitResult = this.battle.field.setTerrain(moveData.terrain, pokemon, move);\r\n\t\t\t\t\t\tdidSomething = this.combineResults(didSomething, hitResult);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (moveData.pseudoWeather) {\r\n\t\t\t\t\t\thitResult = this.battle.field.addPseudoWeather(moveData.pseudoWeather, pokemon, move);\r\n\t\t\t\t\t\tdidSomething = this.combineResults(didSomething, hitResult);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (moveData.forceSwitch && !this.battle.getAllActive().some(x => x.hasAbility('skilldrain'))) {\r\n\t\t\t\t\t\thitResult = !!this.battle.canSwitch(target.side);\r\n\t\t\t\t\t\tdidSomething = this.combineResults(didSomething, hitResult);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Hit events\r\n\t\t\t\t\t// These are like the TryHit events, except we don't need a FieldHit event.\r\n\t\t\t\t\t// Scroll up for the TryHit event documentation, and just ignore the \"Try\" part. ;)\r\n\t\t\t\t\tif (move.target === 'all' && !isSelf) {\r\n\t\t\t\t\t\tif (moveData.onHitField) {\r\n\t\t\t\t\t\t\thitResult = this.battle.singleEvent('HitField', moveData, {}, target, pokemon, move);\r\n\t\t\t\t\t\t\tdidSomething = this.combineResults(didSomething, hitResult);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else if ((move.target === 'foeSide' || move.target === 'allySide') && !isSelf) {\r\n\t\t\t\t\t\tif (moveData.onHitSide) {\r\n\t\t\t\t\t\t\thitResult = this.battle.singleEvent('HitSide', moveData, {}, target.side, pokemon, move);\r\n\t\t\t\t\t\t\tdidSomething = this.combineResults(didSomething, hitResult);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (moveData.onHit) {\r\n\t\t\t\t\t\t\thitResult = this.battle.singleEvent('Hit', moveData, {}, target, pokemon, move);\r\n\t\t\t\t\t\t\tdidSomething = this.combineResults(didSomething, hitResult);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (!isSelf && !isSecondary) {\r\n\t\t\t\t\t\t\tthis.battle.runEvent('Hit', target, pokemon, move);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (moveData.selfdestruct === 'ifHit' && damage[i] !== false) {\r\n\t\t\t\t\tthis.battle.faint(pokemon, pokemon, move);\r\n\t\t\t\t}\r\n\t\t\t\tif (moveData.selfSwitch && !this.battle.getAllActive().some(x => x.hasAbility('skilldrain'))) {\r\n\t\t\t\t\tif (this.battle.canSwitch(pokemon.side)) {\r\n\t\t\t\t\t\tdidSomething = true;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tdidSomething = this.combineResults(didSomething, false);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// Move didn't fail because it didn't try to do anything\r\n\t\t\t\tif (didSomething === undefined) didSomething = true;\r\n\t\t\t\tdamage[i] = this.combineResults(damage[i], didSomething === null ? false : didSomething);\r\n\t\t\t\tdidAnything = this.combineResults(didAnything, didSomething);\r\n\t\t\t}\r\n\r\n\r\n\t\t\tif (!didAnything && didAnything !== 0 && !moveData.self && !moveData.selfdestruct) {\r\n\t\t\t\tif (!isSelf && !isSecondary) {\r\n\t\t\t\t\tif (didAnything === false) {\r\n\t\t\t\t\t\tthis.battle.add('-fail', pokemon);\r\n\t\t\t\t\t\tthis.battle.attrLastMove('[still]');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tthis.battle.debug('move failed because it did nothing');\r\n\t\t\t} else if (move.selfSwitch && pokemon.hp && !this.battle.getAllActive().some(x => x.hasAbility('skilldrain'))) {\r\n\t\t\t\tpokemon.switchFlag = move.id;\r\n\t\t\t}\r\n\r\n\t\t\treturn damage;\r\n\t\t},\r\n\t},\r\n\r\n\tpokemon: {\r\n\t\tisGrounded(negateImmunity) {\r\n\t\t\tif ('gravity' in this.battle.field.pseudoWeather) return true;\r\n\t\t\tif ('ingrain' in this.volatiles && this.battle.gen >= 4) return true;\r\n\t\t\tif ('smackdown' in this.volatiles) return true;\r\n\t\t\tconst item = (this.ignoringItem() ? '' : this.item);\r\n\t\t\tif (item === 'ironball') return true;\r\n\t\t\t// If a Fire/Flying type uses Burn Up and Roost, it becomes ???/Flying-type, but it's still grounded.\r\n\t\t\tif (!negateImmunity && this.hasType('Flying') && !('roost' in this.volatiles)) return false;\r\n\t\t\tif (this.hasAbility('levitate') && !this.battle.suppressingAbility()) return null;\r\n\t\t\tif ('magnetrise' in this.volatiles) return false;\r\n\t\t\tif ('telekinesis' in this.volatiles) return false;\r\n\t\t\treturn item !== 'airballoon';\r\n\t\t},\r\n\t\tsetStatus(status, source, sourceEffect, ignoreImmunities) {\r\n\t\t\tif (!this.hp) return false;\r\n\t\t\tstatus = this.battle.dex.conditions.get(status);\r\n\t\t\tif (this.battle.event) {\r\n\t\t\t\tif (!source) source = this.battle.event.source;\r\n\t\t\t\tif (!sourceEffect) sourceEffect = this.battle.effect;\r\n\t\t\t}\r\n\t\t\tif (!source) source = this;\r\n\r\n\t\t\tif (this.status === status.id) {\r\n\t\t\t\tif ((sourceEffect as Move)?.status === this.status) {\r\n\t\t\t\t\tthis.battle.add('-fail', this, this.status);\r\n\t\t\t\t} else if ((sourceEffect as Move)?.status) {\r\n\t\t\t\t\tthis.battle.add('-fail', source);\r\n\t\t\t\t\tthis.battle.attrLastMove('[still]');\r\n\t\t\t\t}\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\tif (!ignoreImmunities && status.id &&\r\n\t\t\t\t\t!((source?.hasAbility('corrosion') || source?.hasAbility('hackedcorrosion') || sourceEffect?.id === 'cradilychaos') &&\r\n\t\t\t\t\t['tox', 'psn'].includes(status.id))) {\r\n\t\t\t\t// the game currently never ignores immunities\r\n\t\t\t\tif (!this.runStatusImmunity(status.id === 'tox' ? 'psn' : status.id)) {\r\n\t\t\t\t\tthis.battle.debug('immune to status');\r\n\t\t\t\t\tif ((sourceEffect as Move)?.status) {\r\n\t\t\t\t\t\tthis.battle.add('-immune', this);\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tconst prevStatus = this.status;\r\n\t\t\tconst prevStatusState = this.statusState;\r\n\t\t\tif (status.id) {\r\n\t\t\t\tconst result: boolean = this.battle.runEvent('SetStatus', this, source, sourceEffect, status);\r\n\t\t\t\tif (!result) {\r\n\t\t\t\t\tthis.battle.debug('set status [' + status.id + '] interrupted');\r\n\t\t\t\t\treturn result;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tthis.status = status.id;\r\n\t\t\tthis.statusState = {id: status.id, target: this};\r\n\t\t\tif (source) this.statusState.source = source;\r\n\t\t\tif (status.duration) this.statusState.duration = status.duration;\r\n\t\t\tif (status.durationCallback) {\r\n\t\t\t\tthis.statusState.duration = status.durationCallback.call(this.battle, this, source, sourceEffect);\r\n\t\t\t}\r\n\r\n\t\t\tif (status.id && !this.battle.singleEvent('Start', status, this.statusState, this, source, sourceEffect)) {\r\n\t\t\t\tthis.battle.debug('status start [' + status.id + '] interrupted');\r\n\t\t\t\t// cancel the setstatus\r\n\t\t\t\tthis.status = prevStatus;\r\n\t\t\t\tthis.statusState = prevStatusState;\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\tif (status.id && !this.battle.runEvent('AfterSetStatus', this, source, sourceEffect, status)) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t},\r\n\t},\r\n\r\n\t// Modded to add a property to work with Struchni's move\r\n\tnextTurn() {\r\n\t\tthis.turn++;\r\n\t\tthis.lastSuccessfulMoveThisTurn = null;\r\n\r\n\t\tconst trappedBySide: boolean[] = [];\r\n\t\tconst stalenessBySide: ('internal' | 'external' | undefined)[] = [];\r\n\t\tfor (const side of this.sides) {\r\n\t\t\tlet sideTrapped = true;\r\n\t\t\tlet sideStaleness: 'internal' | 'external' | undefined;\r\n\t\t\tfor (const pokemon of side.active) {\r\n\t\t\t\tif (!pokemon) continue;\r\n\t\t\t\tpokemon.moveThisTurn = '';\r\n\t\t\t\tpokemon.newlySwitched = false;\r\n\t\t\t\tpokemon.moveLastTurnResult = pokemon.moveThisTurnResult;\r\n\t\t\t\tpokemon.moveThisTurnResult = undefined;\r\n\t\t\t\tif (this.turn !== 1) {\r\n\t\t\t\t\tpokemon.usedItemThisTurn = false;\r\n\t\t\t\t\t// Used for Veto\r\n\t\t\t\t\tpokemon.m.statsRaisedLastTurn = !!pokemon.statsRaisedThisTurn;\r\n\t\t\t\t\tpokemon.statsRaisedThisTurn = false;\r\n\t\t\t\t\tpokemon.statsLoweredThisTurn = false;\r\n\t\t\t\t\t// It shouldn't be possible in a normal battle for a Pokemon to be damaged before turn 1's move selection\r\n\t\t\t\t\t// However, this could be potentially relevant in certain OMs\r\n\t\t\t\t\tpokemon.hurtThisTurn = null;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tpokemon.maybeDisabled = false;\r\n\t\t\t\tfor (const moveSlot of pokemon.moveSlots) {\r\n\t\t\t\t\tmoveSlot.disabled = false;\r\n\t\t\t\t\tmoveSlot.disabledSource = '';\r\n\t\t\t\t}\r\n\t\t\t\tthis.runEvent('DisableMove', pokemon);\r\n\t\t\t\tif (!pokemon.ateBerry) pokemon.disableMove('belch');\r\n\t\t\t\tif (!pokemon.getItem().isBerry) pokemon.disableMove('stuffcheeks');\r\n\r\n\t\t\t\t// If it was an illusion, it's not any more\r\n\t\t\t\tif (pokemon.getLastAttackedBy() && this.gen >= 7) pokemon.knownType = true;\r\n\r\n\t\t\t\tfor (let i = pokemon.attackedBy.length - 1; i >= 0; i--) {\r\n\t\t\t\t\tconst attack = pokemon.attackedBy[i];\r\n\t\t\t\t\tif (attack.source.isActive) {\r\n\t\t\t\t\t\tattack.thisTurn = false;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tpokemon.attackedBy.splice(pokemon.attackedBy.indexOf(attack), 1);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (this.gen >= 7) {\r\n\t\t\t\t\t// In Gen 7, the real type of every Pokemon is visible to all players via the bottom screen while making choices\r\n\t\t\t\t\tconst seenPokemon = pokemon.illusion || pokemon;\r\n\t\t\t\t\tconst realTypeString = seenPokemon.getTypes(true).join('/');\r\n\t\t\t\t\tif (realTypeString !== seenPokemon.apparentType) {\r\n\t\t\t\t\t\tthis.add('-start', pokemon, 'typechange', realTypeString, '[silent]');\r\n\t\t\t\t\t\tseenPokemon.apparentType = realTypeString;\r\n\t\t\t\t\t\tif (pokemon.addedType) {\r\n\t\t\t\t\t\t\t// The typechange message removes the added type, so put it back\r\n\t\t\t\t\t\t\tthis.add('-start', pokemon, 'typeadd', pokemon.addedType, '[silent]');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tpokemon.trapped = pokemon.maybeTrapped = false;\r\n\t\t\t\tthis.runEvent('TrapPokemon', pokemon);\r\n\t\t\t\tif (!pokemon.knownType || this.dex.getImmunity('trapped', pokemon)) {\r\n\t\t\t\t\tthis.runEvent('MaybeTrapPokemon', pokemon);\r\n\t\t\t\t}\r\n\t\t\t\t// canceling switches would leak information\r\n\t\t\t\t// if a foe might have a trapping ability\r\n\t\t\t\tif (this.gen > 2) {\r\n\t\t\t\t\tfor (const source of pokemon.foes()) {\r\n\t\t\t\t\t\tconst species = (source.illusion || source).species;\r\n\t\t\t\t\t\tif (!species.abilities) continue;\r\n\t\t\t\t\t\tfor (const abilitySlot in species.abilities) {\r\n\t\t\t\t\t\t\tconst abilityName = species.abilities[abilitySlot as keyof Species['abilities']];\r\n\t\t\t\t\t\t\tif (abilityName === source.ability) {\r\n\t\t\t\t\t\t\t\t// pokemon event was already run above so we don't need\r\n\t\t\t\t\t\t\t\t// to run it again.\r\n\t\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tconst ruleTable = this.ruleTable;\r\n\t\t\t\t\t\t\tif ((ruleTable.has('+hackmons') || !ruleTable.has('obtainableabilities')) && !this.format.team) {\r\n\t\t\t\t\t\t\t\t// hackmons format\r\n\t\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t\t} else if (abilitySlot === 'H' && species.unreleasedHidden) {\r\n\t\t\t\t\t\t\t\t// unreleased hidden ability\r\n\t\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tconst ability = this.dex.abilities.get(abilityName);\r\n\t\t\t\t\t\t\tif (ruleTable.has('-ability:' + ability.id)) continue;\r\n\t\t\t\t\t\t\tif (pokemon.knownType && !this.dex.getImmunity('trapped', pokemon)) continue;\r\n\t\t\t\t\t\t\tthis.singleEvent('FoeMaybeTrapPokemon', ability, {}, pokemon, source);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (pokemon.fainted) continue;\r\n\r\n\t\t\t\tsideTrapped = sideTrapped && pokemon.trapped;\r\n\t\t\t\tconst staleness = pokemon.volatileStaleness || pokemon.staleness;\r\n\t\t\t\tif (staleness) sideStaleness = sideStaleness === 'external' ? sideStaleness : staleness;\r\n\t\t\t\tpokemon.activeTurns++;\r\n\t\t\t}\r\n\t\t\ttrappedBySide.push(sideTrapped);\r\n\t\t\tstalenessBySide.push(sideStaleness);\r\n\t\t\tside.faintedLastTurn = side.faintedThisTurn;\r\n\t\t\tside.faintedThisTurn = null;\r\n\t\t}\r\n\r\n\t\tif (this.maybeTriggerEndlessBattleClause(trappedBySide, stalenessBySide)) return;\r\n\r\n\t\tif (this.gameType === 'triples' && !this.sides.filter(side => side.pokemonLeft > 1).length) {\r\n\t\t\t// If both sides have one Pokemon left in triples and they are not adjacent, they are both moved to the center.\r\n\t\t\tconst actives = this.getAllActive();\r\n\t\t\tif (actives.length > 1 && !actives[0].isAdjacent(actives[1])) {\r\n\t\t\t\tthis.swapPosition(actives[0], 1, '[silent]');\r\n\t\t\t\tthis.swapPosition(actives[1], 1, '[silent]');\r\n\t\t\t\tthis.add('-center');\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis.add('turn', this.turn);\r\n\r\n\t\tthis.makeRequest('move');\r\n\t},\r\n};\r\n"], "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,UAAmC;AAAA,EAC/C,KAAK;AAAA,EACL,SAAS;AAAA,EACT,SAAS;AAAA;AAAA,IAER,WAAW,SAAS;AACnB,UAAI,QAAQ,SAAS,cAAc,QAAQ,QAAQ,SAAS;AAAU,gBAAQ,aAAa;AAC3F,UAAI,QAAQ,SAAS,eAAe,QAAQ,QAAQ,SAAS;AAAa,gBAAQ,aAAa;AAC/F,YAAM,YAAY,QAAQ,cAAc,QAAQ;AAChD,UAAI,CAAC;AAAW,eAAO;AAEvB,cAAQ,YAAY,WAAW,QAAQ,QAAQ,GAAG,IAAI;AACtD,UAAI,QAAQ,YAAY;AACvB,gBAAQ,aAAa;AAAA,MACtB,OAAO;AACN,gBAAQ,gBAAgB;AAAA,MACzB;AAEA,WAAK,OAAO,SAAS,aAAa,OAAO;AAEzC,UAAI,CAAC,eAAe,YAAY,aAAa,EAAE,SAAS,QAAQ,IAAI,KAAK,CAAC,QAAQ,UAAU;AAC3F,aAAK,OAAO,IAAI,UAAU,SAAS,cAAc,QAAQ,MAAM,KAAK,GAAG,CAAC;AAAA,MACzE;AAEA,WAAK,OAAO,IAAI,YAAY,SAAS,GAAG,QAAQ,WAAW,EAAE,MAAM;AAEnE,aAAO;AAAA,IACR;AAAA;AAAA,IAGA,WAAW,SA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