Spaces:
Running
Running
File size: 8,992 Bytes
5c2ed06 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var scripts_exports = {};
__export(scripts_exports, {
Scripts: () => Scripts
});
module.exports = __toCommonJS(scripts_exports);
const Scripts = {
gen: 9,
field: {
suppressingWeather() {
for (const pokemon of this.battle.getAllActive()) {
if (pokemon && !pokemon.fainted && !pokemon.ignoringAbility() && (pokemon.getAbility().suppressWeather || pokemon.m.innates?.some((k) => this.battle.dex.abilities.get(k).suppressWeather))) {
return true;
}
}
return false;
}
},
pokemon: {
ignoringAbility() {
let neutralizinggas = false;
for (const pokemon of this.battle.getAllActive()) {
if ((pokemon.ability === "neutralizinggas" || pokemon.m.innates?.some((k) => k === "neutralizinggas")) && !pokemon.volatiles["gastroacid"] && !pokemon.abilityState.ending) {
neutralizinggas = true;
break;
}
}
return !!(this.battle.gen >= 5 && !this.isActive || (this.volatiles["gastroacid"] || neutralizinggas && (this.ability !== "neutralizinggas" || this.m.innates?.some((k) => k === "neutralizinggas"))) && !this.getAbility().flags["cantsuppress"]);
},
hasAbility(ability) {
if (this.ignoringAbility())
return false;
if (Array.isArray(ability))
return ability.some((abil) => this.hasAbility(abil));
ability = this.battle.toID(ability);
return this.ability === ability || !!this.volatiles["ability:" + ability];
},
transformInto(pokemon, effect) {
const species = pokemon.species;
if (pokemon.fainted || this.illusion || pokemon.illusion || pokemon.volatiles["substitute"] && this.battle.gen >= 5 || pokemon.transformed && this.battle.gen >= 2 || this.transformed && this.battle.gen >= 5 || species.name === "Eternatus-Eternamax") {
return false;
}
if (!this.setSpecies(species, effect, true))
return false;
this.transformed = true;
this.weighthg = pokemon.weighthg;
const types = pokemon.getTypes(true, true);
this.setType(pokemon.volatiles["roost"] ? pokemon.volatiles["roost"].typeWas : types, true);
this.addedType = pokemon.addedType;
this.knownType = this.isAlly(pokemon) && pokemon.knownType;
this.apparentType = pokemon.apparentType;
let statName;
for (statName in this.storedStats) {
this.storedStats[statName] = pokemon.storedStats[statName];
if (this.modifiedStats)
this.modifiedStats[statName] = pokemon.modifiedStats[statName];
}
this.moveSlots = [];
this.set.ivs = this.battle.gen >= 5 ? this.set.ivs : pokemon.set.ivs;
this.hpType = this.battle.gen >= 5 ? this.hpType : pokemon.hpType;
this.hpPower = this.battle.gen >= 5 ? this.hpPower : pokemon.hpPower;
this.timesAttacked = pokemon.timesAttacked;
for (const moveSlot of pokemon.moveSlots) {
let moveName = moveSlot.move;
if (moveSlot.id === "hiddenpower") {
moveName = "Hidden Power " + this.hpType;
}
this.moveSlots.push({
move: moveName,
id: moveSlot.id,
pp: moveSlot.maxpp === 1 ? 1 : 5,
maxpp: this.battle.gen >= 5 ? moveSlot.maxpp === 1 ? 1 : 5 : moveSlot.maxpp,
target: moveSlot.target,
disabled: false,
used: false,
virtual: true
});
}
let boostName;
for (boostName in pokemon.boosts) {
this.boosts[boostName] = pokemon.boosts[boostName];
}
if (this.battle.gen >= 6) {
const volatilesToCopy = ["dragoncheer", "focusenergy", "gmaxchistrike", "laserfocus"];
for (const volatile of volatilesToCopy)
this.removeVolatile(volatile);
for (const volatile of volatilesToCopy) {
if (pokemon.volatiles[volatile]) {
this.addVolatile(volatile);
if (volatile === "gmaxchistrike")
this.volatiles[volatile].layers = pokemon.volatiles[volatile].layers;
if (volatile === "dragoncheer")
this.volatiles[volatile].hasDragonType = pokemon.volatiles[volatile].hasDragonType;
}
}
}
if (effect) {
this.battle.add("-transform", this, pokemon, "[from] " + effect.fullname);
} else {
this.battle.add("-transform", this, pokemon);
}
if (this.terastallized && this.terastallized !== this.apparentType) {
this.battle.add("-start", this, "typechange", this.terastallized, "[silent]");
this.apparentType = this.terastallized;
}
if (this.battle.gen > 2) {
this.setAbility(pokemon.ability, this, true);
if (this.m.innates) {
for (const innate of this.m.innates) {
this.removeVolatile("ability:" + innate);
}
}
if (pokemon.m.innates) {
for (const innate of pokemon.m.innates) {
this.addVolatile("ability:" + innate, this);
}
}
}
if (this.battle.gen === 4) {
if (this.species.num === 487) {
if (this.species.name === "Giratina" && this.item === "griseousorb") {
this.formeChange("Giratina-Origin");
} else if (this.species.name === "Giratina-Origin" && this.item !== "griseousorb") {
this.formeChange("Giratina");
}
}
if (this.species.num === 493) {
const item = this.getItem();
const targetForme = item?.onPlate ? "Arceus-" + item.onPlate : "Arceus";
if (this.species.name !== targetForme) {
this.formeChange(targetForme);
}
}
}
return true;
},
/**
* Changes this Pokemon's forme to match the given speciesId (or species).
* This function handles all changes to stats, ability, type, species, etc.
* as well as sending all relevant messages sent to the client.
*/
formeChange(speciesId, source, isPermanent, message) {
if (!source)
source = this.battle.effect;
const rawSpecies = this.battle.dex.species.get(speciesId);
const species = this.setSpecies(rawSpecies, source);
if (!species)
return false;
if (this.battle.gen <= 2)
return true;
const apparentSpecies = this.illusion ? this.illusion.species.name : species.baseSpecies;
if (isPermanent) {
this.baseSpecies = rawSpecies;
this.details = this.getUpdatedDetails();
this.battle.add("detailschange", this, (this.illusion || this).details);
if (source.effectType === "Item") {
this.canTerastallize = null;
if (source.zMove) {
this.battle.add("-burst", this, apparentSpecies, species.requiredItem);
this.moveThisTurnResult = true;
} else if (source.isPrimalOrb) {
if (this.illusion) {
this.ability = "";
this.battle.add("-primal", this.illusion);
} else {
this.battle.add("-primal", this);
}
} else {
this.battle.add("-mega", this, apparentSpecies, species.requiredItem);
this.moveThisTurnResult = true;
}
} else if (source.effectType === "Status") {
this.battle.add("-formechange", this, species.name, message);
}
} else {
if (source.effectType === "Ability") {
this.battle.add("-formechange", this, species.name, message, `[from] ability: ${source.name}`);
} else {
this.battle.add("-formechange", this, this.illusion ? this.illusion.species.name : species.name, message);
}
}
if (isPermanent && !["disguise", "iceface", "ability:disguise", "ability:iceface"].includes(source.id)) {
if (this.illusion) {
this.ability = "";
}
this.setAbility(species.abilities["0"], null, true);
this.baseAbility = this.ability;
}
if (this.terastallized && this.terastallized !== this.apparentType) {
this.battle.add("-start", this, "typechange", this.terastallized, "[silent]");
this.apparentType = this.terastallized;
}
return true;
}
}
};
//# sourceMappingURL=scripts.js.map
|