Initial Modpack Upload
This commit is contained in:
1 parent
268b0650aa
commit
3d8b956ee4
1429 files changed
+820128
No files matched your search
@@ -0,0 +1,96 @@
|
||||
"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 conditions_exports = {};
|
||||
__export(conditions_exports, {
|
||||
Conditions: () => Conditions
|
||||
});
|
||||
module.exports = __toCommonJS(conditions_exports);
|
||||
const Conditions = {
|
||||
slp: {
|
||||
inherit: true,
|
||||
onBeforeMove(pokemon, target, move) {
|
||||
if (this.effectState.timerDecreased !== this.turn) {
|
||||
this.effectState.timerDecreased = this.turn;
|
||||
if (pokemon.hasAbility("earlybird")) {
|
||||
pokemon.statusState.time--;
|
||||
}
|
||||
pokemon.statusState.time--;
|
||||
if (pokemon.statusState.time <= 0) {
|
||||
pokemon.cureStatus();
|
||||
return;
|
||||
}
|
||||
this.add("cant", pokemon, "slp");
|
||||
}
|
||||
if (move.sleepUsable)
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
},
|
||||
frz: {
|
||||
inherit: true,
|
||||
onBeforeMove(pokemon, target, move) {
|
||||
if (move.flags["defrost"])
|
||||
return;
|
||||
if (this.effectState.durationRolled !== this.turn && this.randomChance(1, 5)) {
|
||||
pokemon.cureStatus();
|
||||
return;
|
||||
}
|
||||
if (this.effectState.durationRolled !== this.turn) {
|
||||
this.effectState.durationRolled = this.turn;
|
||||
this.add("cant", pokemon, "frz");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
confusion: {
|
||||
inherit: true,
|
||||
onBeforeMove(pokemon) {
|
||||
if (this.effectState.timerDecreased !== this.turn) {
|
||||
this.effectState.timerDecreased = this.turn;
|
||||
pokemon.volatiles.confusion.time--;
|
||||
if (!pokemon.volatiles.confusion.time) {
|
||||
pokemon.removeVolatile("confusion");
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.add("-activate", pokemon, "confusion");
|
||||
if (!this.randomChance(1, 3)) {
|
||||
return;
|
||||
}
|
||||
this.activeTarget = pokemon;
|
||||
const damage = this.actions.getDamage(pokemon, pokemon, 40);
|
||||
if (typeof damage !== "number")
|
||||
throw new Error("Confusion damage not dealt");
|
||||
this.damage(damage, pokemon, pokemon, {
|
||||
id: "confused",
|
||||
effectType: "Move",
|
||||
type: "???"
|
||||
});
|
||||
return false;
|
||||
}
|
||||
},
|
||||
gem: {
|
||||
inherit: true,
|
||||
onBeforeMove(pokemon) {
|
||||
if (pokemon.moveThisTurn)
|
||||
pokemon.removeVolatile("gem");
|
||||
}
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=conditions.js.map
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../../../../data/mods/gen8linked/conditions.ts"],
|
||||
"sourcesContent": ["export const Conditions: {[k: string]: ModdedConditionData} = {\r\n\tslp: {\r\n\t\tinherit: true,\r\n\t\tonBeforeMove(pokemon, target, move) {\r\n\t\t\tif (this.effectState.timerDecreased !== this.turn) {\r\n\t\t\t\tthis.effectState.timerDecreased = this.turn;\r\n\t\t\t\tif (pokemon.hasAbility('earlybird')) {\r\n\t\t\t\t\tpokemon.statusState.time--;\r\n\t\t\t\t}\r\n\t\t\t\tpokemon.statusState.time--;\r\n\t\t\t\tif (pokemon.statusState.time <= 0) {\r\n\t\t\t\t\tpokemon.cureStatus();\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tthis.add('cant', pokemon, 'slp');\r\n\t\t\t}\r\n\t\t\tif (move.sleepUsable) return;\r\n\t\t\treturn false;\r\n\t\t},\r\n\t},\r\n\tfrz: {\r\n\t\tinherit: true,\r\n\t\tonBeforeMove(pokemon, target, move) {\r\n\t\t\tif (move.flags['defrost']) return;\r\n\t\t\tif (this.effectState.durationRolled !== this.turn && this.randomChance(1, 5)) {\r\n\t\t\t\tpokemon.cureStatus();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif (this.effectState.durationRolled !== this.turn) {\r\n\t\t\t\t// Display the `frozen` message only once per turn.\r\n\t\t\t\tthis.effectState.durationRolled = this.turn;\r\n\t\t\t\tthis.add('cant', pokemon, 'frz');\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t},\r\n\t},\r\n\tconfusion: {\r\n\t\tinherit: true,\r\n\t\tonBeforeMove(pokemon) {\r\n\t\t\tif (this.effectState.timerDecreased !== this.turn) {\r\n\t\t\t\tthis.effectState.timerDecreased = this.turn;\r\n\t\t\t\tpokemon.volatiles.confusion.time--;\r\n\t\t\t\tif (!pokemon.volatiles.confusion.time) {\r\n\t\t\t\t\tpokemon.removeVolatile('confusion');\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.add('-activate', pokemon, 'confusion');\r\n\t\t\tif (!this.randomChance(1, 3)) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tthis.activeTarget = pokemon;\r\n\t\t\tconst damage = this.actions.getDamage(pokemon, pokemon, 40);\r\n\t\t\tif (typeof damage !== 'number') throw new Error(\"Confusion damage not dealt\");\r\n\t\t\tthis.damage(damage, pokemon, pokemon, {\r\n\t\t\t\tid: 'confused' as ID,\r\n\t\t\t\teffectType: 'Move',\r\n\t\t\t\ttype: '???',\r\n\t\t\t} as unknown as ActiveMove);\r\n\t\t\treturn false;\r\n\t\t},\r\n\t},\r\n\tgem: {\r\n\t\tinherit: true,\r\n\t\tonBeforeMove(pokemon) {\r\n\t\t\tif (pokemon.moveThisTurn) pokemon.removeVolatile('gem');\r\n\t\t},\r\n\t},\r\n};\r\n"],
|
||||
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,aAAiD;AAAA,EAC7D,KAAK;AAAA,IACJ,SAAS;AAAA,IACT,aAAa,SAAS,QAAQ,MAAM;AACnC,UAAI,KAAK,YAAY,mBAAmB,KAAK,MAAM;AAClD,aAAK,YAAY,iBAAiB,KAAK;AACvC,YAAI,QAAQ,WAAW,WAAW,GAAG;AACpC,kBAAQ,YAAY;AAAA,QACrB;AACA,gBAAQ,YAAY;AACpB,YAAI,QAAQ,YAAY,QAAQ,GAAG;AAClC,kBAAQ,WAAW;AACnB;AAAA,QACD;AACA,aAAK,IAAI,QAAQ,SAAS,KAAK;AAAA,MAChC;AACA,UAAI,KAAK;AAAa;AACtB,aAAO;AAAA,IACR;AAAA,EACD;AAAA,EACA,KAAK;AAAA,IACJ,SAAS;AAAA,IACT,aAAa,SAAS,QAAQ,MAAM;AACnC,UAAI,KAAK,MAAM,SAAS;AAAG;AAC3B,UAAI,KAAK,YAAY,mBAAmB,KAAK,QAAQ,KAAK,aAAa,GAAG,CAAC,GAAG;AAC7E,gBAAQ,WAAW;AACnB;AAAA,MACD;AACA,UAAI,KAAK,YAAY,mBAAmB,KAAK,MAAM;AAElD,aAAK,YAAY,iBAAiB,KAAK;AACvC,aAAK,IAAI,QAAQ,SAAS,KAAK;AAAA,MAChC;AACA,aAAO;AAAA,IACR;AAAA,EACD;AAAA,EACA,WAAW;AAAA,IACV,SAAS;AAAA,IACT,aAAa,SAAS;AACrB,UAAI,KAAK,YAAY,mBAAmB,KAAK,MAAM;AAClD,aAAK,YAAY,iBAAiB,KAAK;AACvC,gBAAQ,UAAU,UAAU;AAC5B,YAAI,CAAC,QAAQ,UAAU,UAAU,MAAM;AACtC,kBAAQ,eAAe,WAAW;AAClC;AAAA,QACD;AAAA,MACD;AACA,WAAK,IAAI,aAAa,SAAS,WAAW;AAC1C,UAAI,CAAC,KAAK,aAAa,GAAG,CAAC,GAAG;AAC7B;AAAA,MACD;AACA,WAAK,eAAe;AACpB,YAAM,SAAS,KAAK,QAAQ,UAAU,SAAS,SAAS,EAAE;AAC1D,UAAI,OAAO,WAAW;AAAU,cAAM,IAAI,MAAM,4BAA4B;AAC5E,WAAK,OAAO,QAAQ,SAAS,SAAS;AAAA,QACrC,IAAI;AAAA,QACJ,YAAY;AAAA,QACZ,MAAM;AAAA,MACP,CAA0B;AAC1B,aAAO;AAAA,IACR;AAAA,EACD;AAAA,EACA,KAAK;AAAA,IACJ,SAAS;AAAA,IACT,aAAa,SAAS;AACrB,UAAI,QAAQ;AAAc,gBAAQ,eAAe,KAAK;AAAA,IACvD;AAAA,EACD;AACD;",
|
||||
"names": []
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
"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 items_exports = {};
|
||||
__export(items_exports, {
|
||||
Items: () => Items
|
||||
});
|
||||
module.exports = __toCommonJS(items_exports);
|
||||
const Items = {
|
||||
leppaberry: {
|
||||
inherit: true,
|
||||
onUpdate(pokemon) {
|
||||
if (!pokemon.hp)
|
||||
return;
|
||||
const moveSlot = pokemon.getMoveData(pokemon.m.lastMoveAbsolute);
|
||||
if (moveSlot?.pp === 0) {
|
||||
pokemon.addVolatile("leppaberry");
|
||||
pokemon.volatiles["leppaberry"].moveSlot = moveSlot;
|
||||
pokemon.eatItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=items.js.map
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../../../../data/mods/gen8linked/items.ts"],
|
||||
"sourcesContent": ["export const Items: {[k: string]: ModdedItemData} = {\r\n\tleppaberry: {\r\n\t\tinherit: true,\r\n\t\tonUpdate(pokemon) {\r\n\t\t\tif (!pokemon.hp) return;\r\n\t\t\tconst moveSlot = pokemon.getMoveData(pokemon.m.lastMoveAbsolute);\r\n\t\t\tif (moveSlot?.pp === 0) {\r\n\t\t\t\tpokemon.addVolatile('leppaberry');\r\n\t\t\t\tpokemon.volatiles['leppaberry'].moveSlot = moveSlot;\r\n\t\t\t\tpokemon.eatItem();\r\n\t\t\t}\r\n\t\t},\r\n\t},\r\n};\r\n"],
|
||||
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,QAAuC;AAAA,EACnD,YAAY;AAAA,IACX,SAAS;AAAA,IACT,SAAS,SAAS;AACjB,UAAI,CAAC,QAAQ;AAAI;AACjB,YAAM,WAAW,QAAQ,YAAY,QAAQ,EAAE,gBAAgB;AAC/D,UAAI,UAAU,OAAO,GAAG;AACvB,gBAAQ,YAAY,YAAY;AAChC,gBAAQ,UAAU,YAAY,EAAE,WAAW;AAC3C,gBAAQ,QAAQ;AAAA,MACjB;AAAA,IACD;AAAA,EACD;AACD;",
|
||||
"names": []
|
||||
}
|
||||
@@ -0,0 +1,471 @@
|
||||
"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 moves_exports = {};
|
||||
__export(moves_exports, {
|
||||
Moves: () => Moves
|
||||
});
|
||||
module.exports = __toCommonJS(moves_exports);
|
||||
const Moves = {
|
||||
pursuit: {
|
||||
inherit: true,
|
||||
beforeTurnCallback(pokemon, target) {
|
||||
const linkedMoves = pokemon.getLinkedMoves();
|
||||
if (linkedMoves.length) {
|
||||
if (linkedMoves[0] !== "pursuit" && linkedMoves[1] === "pursuit")
|
||||
return;
|
||||
}
|
||||
target.side.addSideCondition("pursuit", pokemon);
|
||||
if (!target.side.sideConditions["pursuit"].sources) {
|
||||
target.side.sideConditions["pursuit"].sources = [];
|
||||
}
|
||||
target.side.sideConditions["pursuit"].sources.push(pokemon);
|
||||
}
|
||||
},
|
||||
mefirst: {
|
||||
inherit: true,
|
||||
onTryHit(target, pokemon) {
|
||||
const action = this.queue.willMove(target);
|
||||
if (action) {
|
||||
const move = this.dex.getActiveMove(action.linked?.[0] || action.move);
|
||||
if (move.category !== "Status" && !move.flags["failmefirst"]) {
|
||||
pokemon.addVolatile("mefirst");
|
||||
this.actions.useMove(move, pokemon, target);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
// Modify Sucker Punch to check if both moves in a link are status
|
||||
suckerpunch: {
|
||||
inherit: true,
|
||||
onTry(source, target) {
|
||||
const action = this.queue.willMove(target);
|
||||
if (!action || action.choice !== "move") {
|
||||
this.attrLastMove("[still]");
|
||||
this.add("-fail", source);
|
||||
return null;
|
||||
}
|
||||
if (target.volatiles.mustrecharge && target.volatiles.mustrecharge.duration < 2) {
|
||||
this.attrLastMove("[still]");
|
||||
this.add("-fail", source);
|
||||
return null;
|
||||
}
|
||||
if (!action.linked) {
|
||||
if (action.move.category === "Status" && action.move.id !== "mefirst") {
|
||||
this.attrLastMove("[still]");
|
||||
this.add("-fail", source);
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
for (const linkedMove of action.linked) {
|
||||
if (linkedMove.category !== "Status" || linkedMove.id === "mefirst")
|
||||
return;
|
||||
}
|
||||
this.attrLastMove("[still]");
|
||||
this.add("-fail", source);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
// Copy the last used move of a link
|
||||
sketch: {
|
||||
inherit: true,
|
||||
onHit(target, source) {
|
||||
const disallowedMoves = ["chatter", "sketch", "struggle"];
|
||||
const lastMove = target.m.lastMoveAbsolute;
|
||||
if (source.transformed || !lastMove || disallowedMoves.includes(lastMove.id) || source.moves.includes(lastMove.id) || lastMove.isZ)
|
||||
return false;
|
||||
const sketchIndex = source.moves.indexOf("sketch");
|
||||
if (sketchIndex < 0)
|
||||
return false;
|
||||
const move = this.dex.moves.get(lastMove);
|
||||
const sketchedMove = {
|
||||
move: move.name,
|
||||
id: move.id,
|
||||
pp: move.pp,
|
||||
maxpp: move.pp,
|
||||
target: move.target,
|
||||
disabled: false,
|
||||
used: false
|
||||
};
|
||||
source.moveSlots[sketchIndex] = sketchedMove;
|
||||
source.baseMoveSlots[sketchIndex] = sketchedMove;
|
||||
this.add("-activate", source, "move: Sketch", move.name);
|
||||
}
|
||||
},
|
||||
mimic: {
|
||||
inherit: true,
|
||||
onHit(target, source) {
|
||||
const lastMove = target.m.lastMoveAbsolute;
|
||||
if (source.transformed || !lastMove || lastMove.flags["failmimic"] || source.moves.includes(lastMove.id) || lastMove.isZ)
|
||||
return false;
|
||||
const mimicIndex = source.moves.indexOf("mimic");
|
||||
if (mimicIndex < 0)
|
||||
return false;
|
||||
const move = this.dex.moves.get(lastMove);
|
||||
source.moveSlots[mimicIndex] = {
|
||||
move: move.name,
|
||||
id: move.id,
|
||||
pp: move.pp,
|
||||
maxpp: move.pp,
|
||||
target: move.target,
|
||||
disabled: false,
|
||||
used: false,
|
||||
virtual: true
|
||||
};
|
||||
this.add("-start", source, "Mimic", move.name);
|
||||
}
|
||||
},
|
||||
// Copy/call last move of a link
|
||||
instruct: {
|
||||
inherit: true,
|
||||
onHit(target, source) {
|
||||
const lastMove = target.m.lastMoveAbsolute;
|
||||
if (!lastMove || target.volatiles["dynamax"])
|
||||
return false;
|
||||
const moveIndex = target.moves.indexOf(lastMove.id);
|
||||
if (lastMove.flags["failinstruct"] || lastMove.isZ || lastMove.isMax || lastMove.flags["charge"] || lastMove.flags["recharge"] || target.volatiles["beakblast"] || target.volatiles["focuspunch"] || target.volatiles["shelltrap"] || target.moveSlots[moveIndex] && target.moveSlots[moveIndex].pp <= 0) {
|
||||
return false;
|
||||
}
|
||||
this.add("-singleturn", target, "move: Instruct", "[of] " + source);
|
||||
this.actions.runMove(lastMove.id, target, target.lastMoveTargetLoc);
|
||||
}
|
||||
},
|
||||
mirrormove: {
|
||||
inherit: true,
|
||||
onTryHit(target, pokemon) {
|
||||
const move = target.m.lastMoveAbsolute;
|
||||
if (!move || !move.flags["mirror"] || move.isZ || move.isMax) {
|
||||
return false;
|
||||
}
|
||||
this.actions.useMove(move.id, pokemon, target);
|
||||
return null;
|
||||
}
|
||||
},
|
||||
// Disabling effects
|
||||
disable: {
|
||||
inherit: true,
|
||||
condition: {
|
||||
duration: 5,
|
||||
noCopy: true,
|
||||
// doesn't get copied by Baton Pass
|
||||
onStart(pokemon, source, effect) {
|
||||
const lastMove = pokemon.m.lastMoveAbsolute;
|
||||
if (this.queue.willMove(pokemon) || pokemon === this.activePokemon && this.activeMove && !this.activeMove.isExternal) {
|
||||
this.effectState.duration--;
|
||||
}
|
||||
if (!lastMove) {
|
||||
this.debug("pokemon hasn't moved yet");
|
||||
return false;
|
||||
}
|
||||
for (const moveSlot of pokemon.moveSlots) {
|
||||
if (moveSlot.id === lastMove.id) {
|
||||
if (!moveSlot.pp) {
|
||||
this.debug("Move out of PP");
|
||||
return false;
|
||||
} else {
|
||||
if (effect.id === "cursedbody") {
|
||||
this.add("-start", pokemon, "Disable", moveSlot.move, "[from] ability: Cursed Body", "[of] " + source);
|
||||
} else {
|
||||
this.add("-start", pokemon, "Disable", moveSlot.move);
|
||||
}
|
||||
this.effectState.move = lastMove.id;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
onResidualOrder: 14,
|
||||
onEnd(pokemon) {
|
||||
this.add("-end", pokemon, "Disable");
|
||||
},
|
||||
onBeforeMovePriority: 7,
|
||||
onBeforeMove(attacker, defender, move) {
|
||||
if (!move.isZ && move.id === this.effectState.move) {
|
||||
this.add("cant", attacker, "Disable", move);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
onDisableMove(pokemon) {
|
||||
for (const moveSlot of pokemon.moveSlots) {
|
||||
if (moveSlot.id === this.effectState.move) {
|
||||
pokemon.disableMove(moveSlot.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
encore: {
|
||||
inherit: true,
|
||||
condition: {
|
||||
duration: 3,
|
||||
noCopy: true,
|
||||
// doesn't get copied by Z-Baton Pass
|
||||
onStart(target) {
|
||||
let lastMove = target.m.lastMoveAbsolute;
|
||||
if (!lastMove || target.volatiles["dynamax"])
|
||||
return false;
|
||||
if (lastMove.isZOrMaxPowered)
|
||||
lastMove = this.dex.moves.get(lastMove.baseMove);
|
||||
const linkedMoves = target.getLinkedMoves(true);
|
||||
const moveIndex = target.moves.indexOf(lastMove.id);
|
||||
if (linkedMoves.includes(lastMove.id) && this.dex.moves.get(linkedMoves[0]).flags["failencore"] && this.dex.moves.get(linkedMoves[1]).flags["failencore"]) {
|
||||
delete target.volatiles["encore"];
|
||||
return false;
|
||||
}
|
||||
if (lastMove.isZ || lastMove.flags["failencore"] || target.moveSlots[moveIndex] && target.moveSlots[moveIndex].pp <= 0) {
|
||||
delete target.volatiles["encore"];
|
||||
return false;
|
||||
}
|
||||
this.effectState.turnsActivated = {};
|
||||
this.effectState.move = lastMove.id;
|
||||
this.add("-start", target, "Encore");
|
||||
if (linkedMoves.includes(lastMove.id)) {
|
||||
this.effectState.move = linkedMoves;
|
||||
}
|
||||
if (!this.queue.willMove(target)) {
|
||||
this.effectState.duration++;
|
||||
}
|
||||
},
|
||||
onOverrideAction(pokemon, target, move) {
|
||||
if (!this.effectState.turnsActivated[this.turn]) {
|
||||
this.effectState.turnsActivated[this.turn] = 0;
|
||||
} else if (this.effectState.turnsActivated[this.turn] >= (Array.isArray(this.effectState.move) ? this.effectState.move.length : 1)) {
|
||||
return;
|
||||
}
|
||||
this.effectState.turnsActivated[this.turn]++;
|
||||
if (!Array.isArray(this.effectState.move)) {
|
||||
this.queue.cancelAction(pokemon);
|
||||
if (move.id !== this.effectState.move)
|
||||
return this.effectState.move;
|
||||
return;
|
||||
}
|
||||
switch (this.effectState.turnsActivated[this.turn]) {
|
||||
case 1: {
|
||||
if (this.effectState.move[0] !== move.id)
|
||||
return this.effectState.move[0];
|
||||
return;
|
||||
}
|
||||
case 2:
|
||||
if (this.effectState.move[1] !== move.id)
|
||||
return this.effectState.move[1];
|
||||
return;
|
||||
}
|
||||
},
|
||||
onResidualOrder: 13,
|
||||
onResidual(target) {
|
||||
const lastMove = target.m.lastMoveAbsolute;
|
||||
const index = target.moves.indexOf(lastMove.id);
|
||||
if (index === -1)
|
||||
return;
|
||||
if (target.hasLinkedMove(lastMove.id)) {
|
||||
if (target.moveSlots[0].pp <= 0 || target.moveSlots[1].pp <= 0) {
|
||||
delete target.volatiles.encore;
|
||||
this.add("-end", target, "Encore");
|
||||
}
|
||||
} else {
|
||||
if (target.moveSlots[index].pp <= 0) {
|
||||
delete target.volatiles.encore;
|
||||
this.add("-end", target, "Encore");
|
||||
}
|
||||
}
|
||||
},
|
||||
onEnd(target) {
|
||||
this.add("-end", target, "Encore");
|
||||
},
|
||||
onDisableMove(pokemon) {
|
||||
if (Array.isArray(this.effectState.move)) {
|
||||
for (const moveSlot of pokemon.moveSlots) {
|
||||
if (moveSlot.id !== this.effectState.move[0] && moveSlot.id !== this.effectState.move[1]) {
|
||||
pokemon.disableMove(moveSlot.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!this.effectState.move || !pokemon.hasMove(this.effectState.move)) {
|
||||
return;
|
||||
}
|
||||
for (const moveSlot of pokemon.moveSlots) {
|
||||
if (moveSlot.id !== this.effectState.move) {
|
||||
pokemon.disableMove(moveSlot.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
torment: {
|
||||
inherit: true,
|
||||
condition: {
|
||||
noCopy: true,
|
||||
onStart(pokemon) {
|
||||
if (pokemon.volatiles["dynamax"]) {
|
||||
delete pokemon.volatiles["torment"];
|
||||
return false;
|
||||
}
|
||||
this.add("-start", pokemon, "Torment");
|
||||
},
|
||||
onEnd(pokemon) {
|
||||
this.add("-end", pokemon, "Torment");
|
||||
},
|
||||
onDisableMove(pokemon) {
|
||||
const lastMove = pokemon.lastMove;
|
||||
if (!lastMove || lastMove.id === "struggle")
|
||||
return;
|
||||
if (Array.isArray(lastMove)) {
|
||||
for (const move of lastMove) {
|
||||
pokemon.disableMove(move.id);
|
||||
}
|
||||
} else {
|
||||
pokemon.disableMove(lastMove.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// PP-decreasing moves
|
||||
grudge: {
|
||||
inherit: true,
|
||||
condition: {
|
||||
onStart(pokemon) {
|
||||
this.add("-singlemove", pokemon, "Grudge");
|
||||
},
|
||||
onFaint(target, source, effect) {
|
||||
if (!source || source.fainted || !effect)
|
||||
return;
|
||||
const lastMove = source.m.lastMoveAbsolute;
|
||||
if (effect.effectType === "Move" && !effect.flags["futuremove"] && lastMove) {
|
||||
for (const moveSlot of source.moveSlots) {
|
||||
if (moveSlot.id === lastMove.id) {
|
||||
moveSlot.pp = 0;
|
||||
this.add("-activate", source, "move: Grudge", this.dex.moves.get(lastMove.id).name);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onBeforeMovePriority: 100,
|
||||
onBeforeMove(pokemon) {
|
||||
if (pokemon.moveThisTurn)
|
||||
return;
|
||||
this.debug("removing Grudge before attack");
|
||||
pokemon.removeVolatile("grudge");
|
||||
}
|
||||
}
|
||||
},
|
||||
spite: {
|
||||
inherit: true,
|
||||
onHit(target) {
|
||||
const lastMove = target.m.lastMoveAbsolute;
|
||||
if (!lastMove || lastMove.isZ || lastMove.isMax)
|
||||
return false;
|
||||
const ppDeducted = target.deductPP(lastMove.id, 4);
|
||||
if (!ppDeducted)
|
||||
return false;
|
||||
this.add("-activate", target, "move: Spite", lastMove.name, ppDeducted);
|
||||
}
|
||||
},
|
||||
// Other lastMove checks
|
||||
conversion2: {
|
||||
inherit: true,
|
||||
onHit(target, source) {
|
||||
const lastMove = target.m.lastMoveAbsolute;
|
||||
if (!lastMove)
|
||||
return false;
|
||||
const possibleTypes = [];
|
||||
const attackType = lastMove.type;
|
||||
for (const type in this.dex.data.TypeChart) {
|
||||
if (source.hasType(type))
|
||||
continue;
|
||||
const typeCheck = this.dex.data.TypeChart[type].damageTaken[attackType];
|
||||
if (typeCheck === 2 || typeCheck === 3) {
|
||||
possibleTypes.push(type);
|
||||
}
|
||||
}
|
||||
if (!possibleTypes.length) {
|
||||
return false;
|
||||
}
|
||||
const randomType = this.sample(possibleTypes);
|
||||
if (!source.setType(randomType))
|
||||
return false;
|
||||
this.add("-start", source, "typechange", randomType);
|
||||
}
|
||||
},
|
||||
destinybond: {
|
||||
inherit: true,
|
||||
condition: {
|
||||
onStart(pokemon) {
|
||||
this.add("-singlemove", pokemon, "Destiny Bond");
|
||||
},
|
||||
onFaint(target, source, effect) {
|
||||
if (!source || !effect || target.side === source.side)
|
||||
return;
|
||||
if (effect.effectType === "Move" && !effect.flags["futuremove"]) {
|
||||
if (source.volatiles["dynamax"]) {
|
||||
this.add("-hint", "Dynamaxed Pok\xE9mon are immune to Destiny Bond.");
|
||||
return;
|
||||
}
|
||||
this.add("-activate", target, "move: Destiny Bond");
|
||||
source.faint();
|
||||
}
|
||||
},
|
||||
onBeforeMovePriority: -1,
|
||||
onBeforeMove(pokemon, target, move) {
|
||||
if (pokemon.moveThisTurn || move.id === "destinybond")
|
||||
return;
|
||||
this.debug("removing Destiny Bond before attack");
|
||||
pokemon.removeVolatile("destinybond");
|
||||
},
|
||||
onMoveAborted(pokemon, target, move) {
|
||||
pokemon.removeVolatile("destinybond");
|
||||
}
|
||||
}
|
||||
},
|
||||
iceball: {
|
||||
inherit: true,
|
||||
condition: {
|
||||
duration: 1,
|
||||
onLockMove: "iceball",
|
||||
onStart() {
|
||||
this.effectState.hitCount = 0;
|
||||
},
|
||||
onResidual(target) {
|
||||
const lastMove = target.m.lastMoveAbsolute;
|
||||
if (lastMove?.id === "struggle") {
|
||||
delete target.volatiles["iceball"];
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
rollout: {
|
||||
inherit: true,
|
||||
condition: {
|
||||
duration: 1,
|
||||
onLockMove: "rollout",
|
||||
onStart() {
|
||||
this.effectState.hitCount = 0;
|
||||
},
|
||||
onResidual(target) {
|
||||
const lastMove = target.m.lastMoveAbsolute;
|
||||
if (lastMove?.id === "struggle") {
|
||||
delete target.volatiles["rollout"];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=moves.js.map
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../../../../data/mods/gen8linked/moves.ts"],
|
||||
"sourcesContent": ["export const Moves: {[k: string]: ModdedMoveData} = {\r\n\tpursuit: {\r\n\t\tinherit: true,\r\n\t\tbeforeTurnCallback(pokemon, target) {\r\n\t\t\t// @ts-ignore\r\n\t\t\tconst linkedMoves: [string, string] = pokemon.getLinkedMoves();\r\n\t\t\tif (linkedMoves.length) {\r\n\t\t\t\tif (linkedMoves[0] !== 'pursuit' && linkedMoves[1] === 'pursuit') return;\r\n\t\t\t}\r\n\r\n\t\t\ttarget.side.addSideCondition('pursuit', pokemon);\r\n\t\t\tif (!target.side.sideConditions['pursuit'].sources) {\r\n\t\t\t\ttarget.side.sideConditions['pursuit'].sources = [];\r\n\t\t\t}\r\n\t\t\ttarget.side.sideConditions['pursuit'].sources.push(pokemon);\r\n\t\t},\r\n\t},\r\n\tmefirst: {\r\n\t\tinherit: true,\r\n\t\tonTryHit(target, pokemon) {\r\n\t\t\tconst action = this.queue.willMove(target);\r\n\t\t\tif (action) {\r\n\t\t\t\t// Mod-specific: Me First copies the first move in the link\r\n\t\t\t\t// @ts-ignore\r\n\t\t\t\tconst move = this.dex.getActiveMove(action.linked?.[0] || action.move);\r\n\t\t\t\tif (move.category !== 'Status' && !move.flags['failmefirst']) {\r\n\t\t\t\t\tpokemon.addVolatile('mefirst');\r\n\t\t\t\t\tthis.actions.useMove(move, pokemon, target);\r\n\t\t\t\t\treturn null;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t},\r\n\t},\r\n\r\n\t// Modify Sucker Punch to check if both moves in a link are status\r\n\tsuckerpunch: {\r\n\t\tinherit: true,\r\n\t\tonTry(source, target) {\r\n\t\t\tconst action = this.queue.willMove(target);\r\n\t\t\tif (!action || action.choice !== 'move') {\r\n\t\t\t\tthis.attrLastMove('[still]');\r\n\t\t\t\tthis.add('-fail', source);\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t\tif (target.volatiles.mustrecharge && target.volatiles.mustrecharge.duration < 2) {\r\n\t\t\t\t// Duration may not be lower than 2 if Sucker Punch is used as a low-priority move\r\n\t\t\t\t// i.e. if Sucker Punch is linked with a negative priority move\r\n\t\t\t\tthis.attrLastMove('[still]');\r\n\t\t\t\tthis.add('-fail', source);\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t\t// @ts-ignore\r\n\t\t\tif (!action.linked) {\r\n\t\t\t\tif (action.move.category === 'Status' && action.move.id !== 'mefirst') {\r\n\t\t\t\t\tthis.attrLastMove('[still]');\r\n\t\t\t\t\tthis.add('-fail', source);\r\n\t\t\t\t\treturn null;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\t// @ts-ignore\r\n\t\t\t\tfor (const linkedMove of action.linked) {\r\n\t\t\t\t\tif (linkedMove.category !== 'Status' || linkedMove.id === 'mefirst') return;\r\n\t\t\t\t}\r\n\t\t\t\tthis.attrLastMove('[still]');\r\n\t\t\t\tthis.add('-fail', source);\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t},\r\n\t},\r\n\r\n\t// Copy the last used move of a link\r\n\tsketch: {\r\n\t\tinherit: true,\r\n\t\tonHit(target, source) {\r\n\t\t\tconst disallowedMoves = ['chatter', 'sketch', 'struggle'];\r\n\t\t\tconst lastMove: Move = target.m.lastMoveAbsolute;\r\n\t\t\tif (source.transformed || !lastMove || disallowedMoves.includes(lastMove.id) ||\r\n\t\t\t\tsource.moves.includes(lastMove.id) || lastMove.isZ) return false;\r\n\t\t\tconst sketchIndex = source.moves.indexOf('sketch');\r\n\t\t\tif (sketchIndex < 0) return false;\r\n\t\t\tconst move = this.dex.moves.get(lastMove);\r\n\t\t\tconst sketchedMove = {\r\n\t\t\t\tmove: move.name,\r\n\t\t\t\tid: move.id,\r\n\t\t\t\tpp: move.pp,\r\n\t\t\t\tmaxpp: move.pp,\r\n\t\t\t\ttarget: move.target,\r\n\t\t\t\tdisabled: false,\r\n\t\t\t\tused: false,\r\n\t\t\t};\r\n\t\t\tsource.moveSlots[sketchIndex] = sketchedMove;\r\n\t\t\tsource.baseMoveSlots[sketchIndex] = sketchedMove;\r\n\t\t\tthis.add('-activate', source, 'move: Sketch', move.name);\r\n\t\t},\r\n\t},\r\n\tmimic: {\r\n\t\tinherit: true,\r\n\t\tonHit(target, source) {\r\n\t\t\tconst lastMove: Move = target.m.lastMoveAbsolute;\r\n\t\t\tif (source.transformed || !lastMove || lastMove.flags['failmimic'] ||\r\n\t\t\t\tsource.moves.includes(lastMove.id) || lastMove.isZ) return false;\r\n\t\t\tconst mimicIndex = source.moves.indexOf('mimic');\r\n\t\t\tif (mimicIndex < 0) return false;\r\n\t\t\tconst move = this.dex.moves.get(lastMove);\r\n\t\t\tsource.moveSlots[mimicIndex] = {\r\n\t\t\t\tmove: move.name,\r\n\t\t\t\tid: move.id,\r\n\t\t\t\tpp: move.pp,\r\n\t\t\t\tmaxpp: move.pp,\r\n\t\t\t\ttarget: move.target,\r\n\t\t\t\tdisabled: false,\r\n\t\t\t\tused: false,\r\n\t\t\t\tvirtual: true,\r\n\t\t\t};\r\n\t\t\tthis.add('-start', source, 'Mimic', move.name);\r\n\t\t},\r\n\t},\r\n\r\n\t// Copy/call last move of a link\r\n\tinstruct: {\r\n\t\tinherit: true,\r\n\t\tonHit(target, source) {\r\n\t\t\tconst lastMove: Move | ActiveMove | null = target.m.lastMoveAbsolute;\r\n\t\t\tif (!lastMove || target.volatiles['dynamax']) return false;\r\n\t\t\tconst moveIndex = target.moves.indexOf(lastMove.id);\r\n\t\t\tif (\r\n\t\t\t\tlastMove.flags['failinstruct'] || lastMove.isZ || lastMove.isMax ||\r\n\t\t\t\tlastMove.flags['charge'] || lastMove.flags['recharge'] ||\r\n\t\t\t\ttarget.volatiles['beakblast'] || target.volatiles['focuspunch'] || target.volatiles['shelltrap'] ||\r\n\t\t\t\t(target.moveSlotLine truncated
|
||||
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,M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AACtB,mBAAW,YAAY,QAAQ,WAAW;AACzC,cAAI,SAAS,OAAO,KAAK,YAAY,MAAM;AAC1C,oBAAQ,YAAY,SAAS,EAAE;AAAA,UAChC;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EACA,QAAQ;AAAA,IACP,SAAS;AAAA,IACT,WAAW;AAAA,MACV,UAAU;AAAA,MACV,QAAQ;AAAA;AAAA,MACR,QAAQ,QAAQ;AACf,YAAI,WAAqC,OAAO,EAAE;AAClD,YAAI,CAAC,YAAY,OAAO,UAAU,SAAS;AAAG,iBAAO;AACrD,YAAK,SAAwB;AAAiB,qBAAW,KAAK,IAAI,MAAM,IAAI,SAAS,QAAQ;AAE7F,cAAM,cAAgC,OAAO,eAAe,IAAI;AAChE,cAAM,YAAY,OAAO,MAAM,QAAQ,SAAS,EAAE;AAClD,YAAI,YAAY,SAAS,SAAS,EAAE,KAAK,KAAK,IAAI,MAAM,IAAK,YAAY,CAAC,CAAE,EAAE,MAAM,YAAY,KAC/F,KAAK,IAAI,MAAM,IAAK,YAAY,CAAC,CAAE,EAAE,MAAM,YAAY,GAAG;AAE1D,iBAAO,OAAO,UAAU,QAAQ;AAChC,iBAAO;AAAA,QACR;AACA,YAAI,SAAS,OAAO,SAAS,MAAM,YAAY,KAC7C,OAAO,UAAU,SAAS,KAAK,OAAO,UAAU,SAAS,EAAE,MAAM,GAAI;AAEtE,iBAAO,OLine truncated
|
||||
"names": []
|
||||
}
|
||||
@@ -0,0 +1,558 @@
|
||||
"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 = {
|
||||
inherit: "gen8",
|
||||
gen: 8,
|
||||
getActionSpeed(action) {
|
||||
if (action.choice === "move") {
|
||||
let move = action.move;
|
||||
if (action.zmove) {
|
||||
const zMoveName = this.actions.getZMove(action.move, action.pokemon, true);
|
||||
if (zMoveName) {
|
||||
const zMove = this.dex.getActiveMove(zMoveName);
|
||||
if (zMove.exists && zMove.isZ) {
|
||||
move = zMove;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (action.maxMove) {
|
||||
const maxMoveName = this.actions.getMaxMove(action.maxMove, action.pokemon);
|
||||
if (maxMoveName) {
|
||||
const maxMove = this.actions.getActiveMaxMove(action.move, action.pokemon);
|
||||
if (maxMove.exists && maxMove.isMax) {
|
||||
move = maxMove;
|
||||
}
|
||||
}
|
||||
}
|
||||
let priority = this.dex.moves.get(move.id).priority;
|
||||
priority = this.singleEvent("ModifyPriority", move, null, action.pokemon, null, null, priority);
|
||||
priority = this.runEvent("ModifyPriority", action.pokemon, null, move, priority);
|
||||
const linkedMoves = action.pokemon.getLinkedMoves();
|
||||
let linkIndex = -1;
|
||||
if (linkedMoves.length && !move.isZ && !move.isMax && (linkIndex = linkedMoves.indexOf(this.toID(action.move))) >= 0) {
|
||||
const linkedActions = action.linked || linkedMoves.map((moveid) => this.dex.getActiveMove(moveid));
|
||||
const altMove = linkedActions[1 - linkIndex];
|
||||
const thisPriority = this.runEvent("ModifyPriority", action.pokemon, null, linkedActions[linkIndex], priority);
|
||||
const thatPriority = this.runEvent("ModifyPriority", action.pokemon, null, altMove, altMove.priority);
|
||||
priority = Math.min(thisPriority, thatPriority);
|
||||
action.priority = priority + action.fractionalPriority;
|
||||
if (this.gen > 5) {
|
||||
linkedActions[linkIndex].priority = priority;
|
||||
altMove.priority = priority;
|
||||
}
|
||||
} else {
|
||||
action.priority = priority + action.fractionalPriority;
|
||||
if (this.gen > 5)
|
||||
action.move.priority = priority;
|
||||
}
|
||||
}
|
||||
if (!action.pokemon) {
|
||||
action.speed = 1;
|
||||
} else {
|
||||
action.speed = action.pokemon.getActionSpeed();
|
||||
}
|
||||
},
|
||||
runAction(action) {
|
||||
const pokemonOriginalHP = action.pokemon?.hp;
|
||||
let residualPokemon = [];
|
||||
switch (action.choice) {
|
||||
case "start": {
|
||||
for (const side of this.sides) {
|
||||
if (side.pokemonLeft)
|
||||
side.pokemonLeft = side.pokemon.length;
|
||||
}
|
||||
this.add("start");
|
||||
if (this.format.onBattleStart)
|
||||
this.format.onBattleStart.call(this);
|
||||
for (const rule of this.ruleTable.keys()) {
|
||||
if ("+*-!".includes(rule.charAt(0)))
|
||||
continue;
|
||||
const subFormat = this.dex.formats.get(rule);
|
||||
if (subFormat.onBattleStart)
|
||||
subFormat.onBattleStart.call(this);
|
||||
}
|
||||
for (const side of this.sides) {
|
||||
for (let i = 0; i < side.active.length; i++) {
|
||||
if (!side.pokemonLeft) {
|
||||
side.active[i] = side.pokemon[i];
|
||||
side.active[i].fainted = true;
|
||||
side.active[i].hp = 0;
|
||||
} else {
|
||||
this.actions.switchIn(side.pokemon[i], i);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const pokemon of this.getAllPokemon()) {
|
||||
this.singleEvent("Start", this.dex.conditions.getByID(pokemon.species.id), pokemon.speciesState, pokemon);
|
||||
}
|
||||
this.midTurn = true;
|
||||
break;
|
||||
}
|
||||
case "move":
|
||||
if (!action.pokemon.isActive)
|
||||
return false;
|
||||
if (action.pokemon.fainted)
|
||||
return false;
|
||||
if (action.linked) {
|
||||
const linkedMoves = action.linked;
|
||||
for (let i = linkedMoves.length - 1; i >= 0; i--) {
|
||||
const validTarget = this.validTargetLoc(action.targetLoc, action.pokemon, linkedMoves[i].target);
|
||||
const targetLoc = validTarget ? action.targetLoc : 0;
|
||||
const pseudoAction = {
|
||||
choice: "move",
|
||||
priority: action.priority,
|
||||
speed: action.speed,
|
||||
pokemon: action.pokemon,
|
||||
targetLoc,
|
||||
moveid: linkedMoves[i].id,
|
||||
move: linkedMoves[i],
|
||||
mega: action.mega,
|
||||
order: action.order,
|
||||
fractionalPriority: action.fractionalPriority,
|
||||
originalTarget: action.originalTarget
|
||||
};
|
||||
this.queue.unshift(pseudoAction);
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.actions.runMove(
|
||||
action.move,
|
||||
action.pokemon,
|
||||
action.targetLoc,
|
||||
action.sourceEffect,
|
||||
action.zmove,
|
||||
void 0,
|
||||
action.maxMove,
|
||||
action.originalTarget
|
||||
);
|
||||
break;
|
||||
case "megaEvo":
|
||||
this.actions.runMegaEvo(action.pokemon);
|
||||
break;
|
||||
case "runDynamax":
|
||||
action.pokemon.addVolatile("dynamax");
|
||||
action.pokemon.side.dynamaxUsed = true;
|
||||
if (action.pokemon.side.allySide)
|
||||
action.pokemon.side.allySide.dynamaxUsed = true;
|
||||
break;
|
||||
case "beforeTurnMove": {
|
||||
if (!action.pokemon.isActive)
|
||||
return false;
|
||||
if (action.pokemon.fainted)
|
||||
return false;
|
||||
this.debug("before turn callback: " + action.move.id);
|
||||
const target = this.getTarget(action.pokemon, action.move, action.targetLoc);
|
||||
if (!target)
|
||||
return false;
|
||||
if (!action.move.beforeTurnCallback)
|
||||
throw new Error(`beforeTurnMove has no beforeTurnCallback`);
|
||||
action.move.beforeTurnCallback.call(this, action.pokemon, target);
|
||||
break;
|
||||
}
|
||||
case "event":
|
||||
this.runEvent(action.event, action.pokemon);
|
||||
break;
|
||||
case "team":
|
||||
if (action.index === 0) {
|
||||
action.pokemon.side.pokemon = [];
|
||||
}
|
||||
action.pokemon.side.pokemon.push(action.pokemon);
|
||||
action.pokemon.position = action.index;
|
||||
return;
|
||||
case "pass":
|
||||
return;
|
||||
case "instaswitch":
|
||||
case "switch":
|
||||
if (action.choice === "switch" && action.pokemon.status) {
|
||||
this.singleEvent("CheckShow", this.dex.abilities.getByID("naturalcure"), null, action.pokemon);
|
||||
}
|
||||
if (this.actions.switchIn(action.target, action.pokemon.position, action.sourceEffect) === "pursuitfaint") {
|
||||
if (this.gen <= 4) {
|
||||
this.hint("Previously chosen switches continue in Gen 2-4 after a Pursuit target faints.");
|
||||
action.priority = -101;
|
||||
this.queue.unshift(action);
|
||||
break;
|
||||
} else {
|
||||
this.hint("A Pokemon can't switch between when it runs out of HP and when it faints");
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "runUnnerve":
|
||||
this.singleEvent("PreStart", action.pokemon.getAbility(), action.pokemon.abilityState, action.pokemon);
|
||||
break;
|
||||
case "runSwitch":
|
||||
this.actions.runSwitch(action.pokemon);
|
||||
break;
|
||||
case "runPrimal":
|
||||
if (!action.pokemon.transformed) {
|
||||
this.singleEvent("Primal", action.pokemon.getItem(), action.pokemon.itemState, action.pokemon);
|
||||
}
|
||||
break;
|
||||
case "shift":
|
||||
if (!action.pokemon.isActive)
|
||||
return false;
|
||||
if (action.pokemon.fainted)
|
||||
return false;
|
||||
this.swapPosition(action.pokemon, 1);
|
||||
break;
|
||||
case "beforeTurn":
|
||||
this.eachEvent("BeforeTurn");
|
||||
break;
|
||||
case "residual":
|
||||
this.add("");
|
||||
this.clearActiveMove(true);
|
||||
this.updateSpeed();
|
||||
residualPokemon = this.getAllActive().map((pokemon) => [pokemon, pokemon.getUndynamaxedHP()]);
|
||||
this.residualEvent("Residual");
|
||||
this.add("upkeep");
|
||||
break;
|
||||
}
|
||||
for (const side of this.sides) {
|
||||
for (const pokemon of side.active) {
|
||||
if (pokemon.forceSwitchFlag) {
|
||||
if (pokemon.hp)
|
||||
this.actions.dragIn(pokemon.side, pokemon.position);
|
||||
pokemon.forceSwitchFlag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.clearActiveMove();
|
||||
this.faintMessages();
|
||||
if (this.ended)
|
||||
return true;
|
||||
if (!this.queue.peek() || this.gen <= 3 && ["move", "residual"].includes(this.queue.peek().choice)) {
|
||||
this.checkFainted();
|
||||
} else if (action.choice === "megaEvo" && this.gen === 7) {
|
||||
this.eachEvent("Update");
|
||||
for (const [i, queuedAction] of this.queue.list.entries()) {
|
||||
if (queuedAction.pokemon === action.pokemon && queuedAction.choice === "move") {
|
||||
this.queue.list.splice(i, 1);
|
||||
queuedAction.mega = "done";
|
||||
this.queue.insertChoice(queuedAction, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else if (this.queue.peek()?.choice === "instaswitch") {
|
||||
return false;
|
||||
}
|
||||
if (this.gen >= 5) {
|
||||
this.eachEvent("Update");
|
||||
for (const [pokemon, originalHP] of residualPokemon) {
|
||||
const maxhp = pokemon.getUndynamaxedHP(pokemon.maxhp);
|
||||
if (pokemon.hp && pokemon.getUndynamaxedHP() <= maxhp / 2 && originalHP > maxhp / 2) {
|
||||
this.runEvent("EmergencyExit", pokemon);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (action.choice === "runSwitch") {
|
||||
const pokemon = action.pokemon;
|
||||
if (pokemon.hp && pokemon.hp <= pokemon.maxhp / 2 && pokemonOriginalHP > pokemon.maxhp / 2) {
|
||||
this.runEvent("EmergencyExit", pokemon);
|
||||
}
|
||||
}
|
||||
const switches = this.sides.map(
|
||||
(side) => side.active.some((pokemon) => pokemon && !!pokemon.switchFlag)
|
||||
);
|
||||
for (let i = 0; i < this.sides.length; i++) {
|
||||
if (switches[i] && !this.canSwitch(this.sides[i])) {
|
||||
for (const pokemon of this.sides[i].active) {
|
||||
pokemon.switchFlag = false;
|
||||
}
|
||||
switches[i] = false;
|
||||
} else if (switches[i]) {
|
||||
for (const pokemon of this.sides[i].active) {
|
||||
if (pokemon.switchFlag && !pokemon.skipBeforeSwitchOutEventFlag) {
|
||||
this.runEvent("BeforeSwitchOut", pokemon);
|
||||
pokemon.skipBeforeSwitchOutEventFlag = true;
|
||||
this.faintMessages();
|
||||
if (this.ended)
|
||||
return true;
|
||||
if (pokemon.fainted) {
|
||||
switches[i] = this.sides[i].active.some((sidePokemon) => sidePokemon && !!sidePokemon.switchFlag);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const playerSwitch of switches) {
|
||||
if (playerSwitch) {
|
||||
this.makeRequest("switch");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (this.gen < 5)
|
||||
this.eachEvent("Update");
|
||||
if (this.gen >= 8 && this.queue.peek()?.choice === "move") {
|
||||
this.updateSpeed();
|
||||
for (const queueAction of this.queue.list) {
|
||||
if (queueAction.pokemon)
|
||||
this.getActionSpeed(queueAction);
|
||||
}
|
||||
this.queue.sort();
|
||||
}
|
||||
return false;
|
||||
},
|
||||
actions: {
|
||||
runMove(moveOrMoveName, pokemon, targetLoc, sourceEffect, zMove, externalMove, maxMove, originalTarget) {
|
||||
pokemon.activeMoveActions++;
|
||||
let target = this.battle.getTarget(pokemon, maxMove || zMove || moveOrMoveName, targetLoc, originalTarget);
|
||||
let baseMove = this.dex.getActiveMove(moveOrMoveName);
|
||||
const pranksterBoosted = baseMove.pranksterBoosted;
|
||||
if (baseMove.id !== "struggle" && !zMove && !maxMove && !externalMove) {
|
||||
const changedMove = this.battle.runEvent("OverrideAction", pokemon, target, baseMove);
|
||||
if (changedMove && changedMove !== true) {
|
||||
baseMove = this.dex.getActiveMove(changedMove);
|
||||
if (pranksterBoosted)
|
||||
baseMove.pranksterBoosted = pranksterBoosted;
|
||||
target = this.battle.getRandomTarget(pokemon, baseMove);
|
||||
}
|
||||
}
|
||||
let move = baseMove;
|
||||
if (zMove) {
|
||||
move = this.getActiveZMove(baseMove, pokemon);
|
||||
} else if (maxMove) {
|
||||
move = this.getActiveMaxMove(baseMove, pokemon);
|
||||
}
|
||||
move.isExternal = externalMove;
|
||||
this.battle.setActiveMove(move, pokemon, target);
|
||||
const willTryMove = this.battle.runEvent("BeforeMove", pokemon, target, move);
|
||||
if (!willTryMove) {
|
||||
if (pokemon.volatiles["twoturnmove"]?.move === move.id) {
|
||||
pokemon.removeVolatile("twoturnmove");
|
||||
}
|
||||
this.battle.runEvent("MoveAborted", pokemon, target, move);
|
||||
this.battle.clearActiveMove(true);
|
||||
pokemon.moveThisTurnResult = willTryMove;
|
||||
return;
|
||||
}
|
||||
if (move.beforeMoveCallback) {
|
||||
if (move.beforeMoveCallback.call(this.battle, pokemon, target, move)) {
|
||||
this.battle.clearActiveMove(true);
|
||||
pokemon.moveThisTurnResult = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
pokemon.lastDamage = 0;
|
||||
let lockedMove;
|
||||
if (!externalMove) {
|
||||
lockedMove = this.battle.runEvent("LockMove", pokemon);
|
||||
if (lockedMove === true)
|
||||
lockedMove = false;
|
||||
if (!lockedMove) {
|
||||
if (!pokemon.deductPP(baseMove, null, target) && move.id !== "struggle") {
|
||||
this.battle.add("cant", pokemon, "nopp", move);
|
||||
const gameConsole = [
|
||||
null,
|
||||
"Game Boy",
|
||||
"Game Boy Color",
|
||||
"Game Boy Advance",
|
||||
"DS",
|
||||
"DS",
|
||||
"3DS",
|
||||
"3DS"
|
||||
][this.battle.gen] || "Switch";
|
||||
this.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.`);
|
||||
this.battle.clearActiveMove(true);
|
||||
pokemon.moveThisTurnResult = false;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
sourceEffect = this.dex.conditions.get("lockedmove");
|
||||
}
|
||||
pokemon.moveUsed(move, targetLoc);
|
||||
}
|
||||
const noLock = externalMove && !pokemon.volatiles.lockedmove;
|
||||
if (zMove) {
|
||||
if (pokemon.illusion) {
|
||||
this.battle.singleEvent("End", this.dex.abilities.get("Illusion"), pokemon.abilityState, pokemon);
|
||||
}
|
||||
this.battle.add("-zpower", pokemon);
|
||||
pokemon.side.zMoveUsed = true;
|
||||
}
|
||||
const moveDidSomething = this.useMove(baseMove, pokemon, target, sourceEffect, zMove, maxMove);
|
||||
this.battle.lastSuccessfulMoveThisTurn = moveDidSomething ? this.battle.activeMove && this.battle.activeMove.id : null;
|
||||
if (this.battle.activeMove)
|
||||
move = this.battle.activeMove;
|
||||
this.battle.singleEvent("AfterMove", move, null, pokemon, target, move);
|
||||
this.battle.runEvent("AfterMove", pokemon, target, move);
|
||||
if (move.flags["dance"] && moveDidSomething && !move.isExternal) {
|
||||
const dancers = [];
|
||||
for (const currentPoke of this.battle.getAllActive()) {
|
||||
if (pokemon === currentPoke)
|
||||
continue;
|
||||
if (currentPoke.hasAbility("dancer") && !currentPoke.isSemiInvulnerable()) {
|
||||
dancers.push(currentPoke);
|
||||
}
|
||||
}
|
||||
dancers.sort(
|
||||
(a, b) => -(b.storedStats["spe"] - a.storedStats["spe"]) || b.abilityOrder - a.abilityOrder
|
||||
);
|
||||
for (const dancer of dancers) {
|
||||
if (this.battle.faintMessages())
|
||||
break;
|
||||
if (dancer.fainted)
|
||||
continue;
|
||||
this.battle.add("-activate", dancer, "ability: Dancer");
|
||||
const dancersTarget = !target.isAlly(dancer) && pokemon.isAlly(dancer) ? target : pokemon;
|
||||
this.runMove(move.id, dancer, dancer.getLocOf(dancersTarget), this.dex.abilities.get("dancer"), void 0, true);
|
||||
}
|
||||
}
|
||||
if (noLock && pokemon.volatiles["lockedmove"])
|
||||
delete pokemon.volatiles["lockedmove"];
|
||||
this.battle.faintMessages();
|
||||
this.battle.checkWin();
|
||||
}
|
||||
},
|
||||
queue: {
|
||||
resolveAction(action, midTurn = false) {
|
||||
if (!action)
|
||||
throw new Error(`Action not passed to resolveAction`);
|
||||
if (action.choice === "pass")
|
||||
return [];
|
||||
const actions = [action];
|
||||
if (!action.side && action.pokemon)
|
||||
action.side = action.pokemon.side;
|
||||
if (!action.move && action.moveid)
|
||||
action.move = this.battle.dex.getActiveMove(action.moveid);
|
||||
if (!action.order) {
|
||||
const orders = {
|
||||
team: 1,
|
||||
start: 2,
|
||||
instaswitch: 3,
|
||||
beforeTurn: 4,
|
||||
beforeTurnMove: 5,
|
||||
runUnnerve: 100,
|
||||
runSwitch: 101,
|
||||
runPrimal: 102,
|
||||
switch: 103,
|
||||
megaEvo: 104,
|
||||
runDynamax: 105,
|
||||
shift: 200,
|
||||
// default is 200 (for moves)
|
||||
residual: 300
|
||||
};
|
||||
if (action.choice in orders) {
|
||||
action.order = orders[action.choice];
|
||||
} else {
|
||||
action.order = 200;
|
||||
if (!["move", "event"].includes(action.choice)) {
|
||||
throw new Error(`Unexpected orderless action ${action.choice}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!midTurn) {
|
||||
if (action.choice === "move") {
|
||||
if (!action.maxMove && !action.zmove && action.move.beforeTurnCallback) {
|
||||
actions.unshift(...this.resolveAction({
|
||||
choice: "beforeTurnMove",
|
||||
pokemon: action.pokemon,
|
||||
move: action.move,
|
||||
targetLoc: action.targetLoc
|
||||
}));
|
||||
}
|
||||
if (action.mega && !action.pokemon.isSkyDropped()) {
|
||||
actions.unshift(...this.resolveAction({
|
||||
choice: "megaEvo",
|
||||
pokemon: action.pokemon
|
||||
}));
|
||||
}
|
||||
if (action.maxMove && !action.pokemon.volatiles["dynamax"]) {
|
||||
actions.unshift(...this.resolveAction({
|
||||
choice: "runDynamax",
|
||||
pokemon: action.pokemon
|
||||
}));
|
||||
}
|
||||
action.fractionalPriority = this.battle.runEvent("FractionalPriority", action.pokemon, null, action.move, 0);
|
||||
const linkedMoves = action.pokemon.getLinkedMoves();
|
||||
if (linkedMoves.length && !(action.pokemon.getItem().isChoice || action.pokemon.hasAbility("gorillatactics")) && !action.zmove && !action.maxMove) {
|
||||
const decisionMove = this.battle.toID(action.move);
|
||||
if (linkedMoves.includes(decisionMove)) {
|
||||
action.linked = linkedMoves.map((moveid) => this.battle.dex.getActiveMove(moveid));
|
||||
const linkedOtherMove = action.linked[1 - linkedMoves.indexOf(decisionMove)];
|
||||
if (linkedOtherMove.beforeTurnCallback) {
|
||||
this.addChoice({
|
||||
choice: "beforeTurnMove",
|
||||
pokemon: action.pokemon,
|
||||
move: linkedOtherMove,
|
||||
targetLoc: action.targetLoc
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (["switch", "instaswitch"].includes(action.choice)) {
|
||||
if (typeof action.pokemon.switchFlag === "string") {
|
||||
action.sourceEffect = this.battle.dex.moves.get(action.pokemon.switchFlag);
|
||||
}
|
||||
action.pokemon.switchFlag = false;
|
||||
}
|
||||
}
|
||||
const deferPriority = this.battle.gen === 7 && action.mega && action.mega !== "done";
|
||||
if (action.move) {
|
||||
let target = null;
|
||||
action.move = this.battle.dex.getActiveMove(action.move);
|
||||
if (!action.targetLoc) {
|
||||
target = this.battle.getRandomTarget(action.pokemon, action.move);
|
||||
if (target)
|
||||
action.targetLoc = action.pokemon.getLocOf(target);
|
||||
}
|
||||
action.originalTarget = action.pokemon.getAtLoc(action.targetLoc);
|
||||
}
|
||||
if (!deferPriority)
|
||||
this.battle.getActionSpeed(action);
|
||||
return actions;
|
||||
}
|
||||
},
|
||||
pokemon: {
|
||||
moveUsed(move, targetLoc) {
|
||||
if (!this.moveThisTurn)
|
||||
this.m.lastMoveAbsolute = move;
|
||||
this.lastMove = move;
|
||||
this.moveThisTurn = move.id;
|
||||
this.lastMoveTargetLoc = targetLoc;
|
||||
},
|
||||
getLinkedMoves(ignoreDisabled) {
|
||||
const linkedMoves = this.moveSlots.slice(0, 2);
|
||||
if (linkedMoves.length !== 2 || linkedMoves[0].pp <= 0 || linkedMoves[1].pp <= 0)
|
||||
return [];
|
||||
const ret = [linkedMoves[0].id, linkedMoves[1].id];
|
||||
if (ignoreDisabled)
|
||||
return ret;
|
||||
if (!this.ateBerry && ret.includes("belch"))
|
||||
return [];
|
||||
if (this.hasItem("assaultvest") && (this.battle.dex.moves.get(ret[0]).category === "Status" || this.battle.dex.moves.get(ret[1]).category === "Status")) {
|
||||
return [];
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
hasLinkedMove(moveid) {
|
||||
const linkedMoves = this.getLinkedMoves(true);
|
||||
if (!linkedMoves.length)
|
||||
return false;
|
||||
return linkedMoves.some((x) => x === moveid);
|
||||
}
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=scripts.js.map
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../../../../data/mods/gen8linked/scripts.ts"],
|
||||
"sourcesContent": ["export const Scripts: ModdedBattleScriptsData = {\r\n\tinherit: 'gen8',\r\n\tgen: 8,\r\n\tgetActionSpeed(action) {\r\n\t\tif (action.choice === 'move') {\r\n\t\t\tlet move = action.move;\r\n\t\t\tif (action.zmove) {\r\n\t\t\t\tconst zMoveName = this.actions.getZMove(action.move, action.pokemon, true);\r\n\t\t\t\tif (zMoveName) {\r\n\t\t\t\t\tconst zMove = this.dex.getActiveMove(zMoveName);\r\n\t\t\t\t\tif (zMove.exists && zMove.isZ) {\r\n\t\t\t\t\t\tmove = zMove;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (action.maxMove) {\r\n\t\t\t\tconst maxMoveName = this.actions.getMaxMove(action.maxMove, action.pokemon);\r\n\t\t\t\tif (maxMoveName) {\r\n\t\t\t\t\tconst maxMove = this.actions.getActiveMaxMove(action.move, action.pokemon);\r\n\t\t\t\t\tif (maxMove.exists && maxMove.isMax) {\r\n\t\t\t\t\t\tmove = maxMove;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// take priority from the base move, so abilities like Prankster only apply once\r\n\t\t\t// (instead of compounding every time `getActionSpeed` is called)\r\n\t\t\tlet priority = this.dex.moves.get(move.id).priority;\r\n\t\t\t// Grassy Glide priority\r\n\t\t\tpriority = this.singleEvent('ModifyPriority', move, null, action.pokemon, null, null, priority);\r\n\t\t\tpriority = this.runEvent('ModifyPriority', action.pokemon, null, move, priority);\r\n\t\t\t// Linked mod\r\n\t\t\tconst linkedMoves: [string, string] = action.pokemon.getLinkedMoves();\r\n\t\t\tlet linkIndex = -1;\r\n\t\t\tif (linkedMoves.length && !move.isZ && !move.isMax && (linkIndex = linkedMoves.indexOf(this.toID(action.move))) >= 0) {\r\n\t\t\t\tconst linkedActions = action.linked || linkedMoves.map(moveid => this.dex.getActiveMove(moveid));\r\n\t\t\t\tconst altMove = linkedActions[1 - linkIndex];\r\n\t\t\t\tconst thisPriority = this.runEvent('ModifyPriority', action.pokemon, null, linkedActions[linkIndex], priority);\r\n\t\t\t\tconst thatPriority = this.runEvent('ModifyPriority', action.pokemon, null, altMove, altMove.priority);\r\n\t\t\t\tpriority = Math.min(thisPriority, thatPriority);\r\n\t\t\t\taction.priority = priority + action.fractionalPriority;\r\n\t\t\t\tif (this.gen > 5) {\r\n\t\t\t\t\t// Gen 6+: Quick Guard blocks moves with artificially enhanced priority.\r\n\t\t\t\t\t// This also applies to Psychic Terrain.\r\n\t\t\t\t\tlinkedActions[linkIndex].priority = priority;\r\n\t\t\t\t\taltMove.priority = priority;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\taction.priority = priority + action.fractionalPriority;\r\n\t\t\t\t// In Gen 6, Quick Guard blocks moves with artificially enhanced priority.\r\n\t\t\t\tif (this.gen > 5) action.move.priority = priority;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (!action.pokemon) {\r\n\t\t\taction.speed = 1;\r\n\t\t} else {\r\n\t\t\taction.speed = action.pokemon.getActionSpeed();\r\n\t\t}\r\n\t},\r\n\trunAction(action) {\r\n\t\tconst pokemonOriginalHP = action.pokemon?.hp;\r\n\t\tlet residualPokemon: (readonly [Pokemon, number])[] = [];\r\n\t\t// returns whether or not we ended in a callback\r\n\t\tswitch (action.choice) {\r\n\t\tcase 'start': {\r\n\t\t\tfor (const side of this.sides) {\r\n\t\t\t\tif (side.pokemonLeft) side.pokemonLeft = side.pokemon.length;\r\n\t\t\t}\r\n\r\n\t\t\tthis.add('start');\r\n\r\n\t\t\tif (this.format.onBattleStart) this.format.onBattleStart.call(this);\r\n\t\t\tfor (const rule of this.ruleTable.keys()) {\r\n\t\t\t\tif ('+*-!'.includes(rule.charAt(0))) continue;\r\n\t\t\t\tconst subFormat = this.dex.formats.get(rule);\r\n\t\t\t\tif (subFormat.onBattleStart) subFormat.onBattleStart.call(this);\r\n\t\t\t}\r\n\r\n\t\t\tfor (const side of this.sides) {\r\n\t\t\t\tfor (let i = 0; i < side.active.length; i++) {\r\n\t\t\t\t\tif (!side.pokemonLeft) {\r\n\t\t\t\t\t\t// forfeited before starting\r\n\t\t\t\t\t\tside.active[i] = side.pokemon[i];\r\n\t\t\t\t\t\tside.active[i].fainted = true;\r\n\t\t\t\t\t\tside.active[i].hp = 0;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis.actions.switchIn(side.pokemon[i], i);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfor (const pokemon of this.getAllPokemon()) {\r\n\t\t\t\tthis.singleEvent('Start', this.dex.conditions.getByID(pokemon.species.id), pokemon.speciesState, pokemon);\r\n\t\t\t}\r\n\t\t\tthis.midTurn = true;\r\n\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\tcase 'move':\r\n\t\t\tif (!action.pokemon.isActive) return false;\r\n\t\t\tif (action.pokemon.fainted) return false;\r\n\t\t\t// Linked moves\r\n\t\t\t// @ts-ignore\r\n\t\t\tif (action.linked) {\r\n\t\t\t\t// @ts-ignore\r\n\t\t\t\tconst linkedMoves: ActiveMove[] = action.linked;\r\n\t\t\t\tfor (let i = linkedMoves.length - 1; i >= 0; i--) {\r\n\t\t\t\t\tconst validTarget = this.validTargetLoc(action.targetLoc, action.pokemon, linkedMoves[i].target);\r\n\t\t\t\t\tconst targetLoc = validTarget ? action.targetLoc : 0;\r\n\t\t\t\t\tconst pseudoAction: Action = {\r\n\t\t\t\t\t\tchoice: 'move', priority: action.priority, speed: action.speed, pokemon: action.pokemon,\r\n\t\t\t\t\t\ttargetLoc: targetLoc, moveid: linkedMoves[i].id, moLine truncated
|
||||
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,UAAmC;AAAA,EAC/C,SAAS;AAAA,EACT,KAAK;AAAA,EACL,eAAe,QAAQ;AACtB,QAAI,OAAO,WAAW,QAAQ;AAC7B,UAAI,OAAO,OAAO;AAClB,UAAI,OAAO,OAAO;AACjB,cAAM,YAAY,KAAK,QAAQ,SAAS,OAAO,MAAM,OAAO,SAAS,IAAI;AACzE,YAAI,WAAW;AACd,gBAAM,QAAQ,KAAK,IAAI,cAAc,SAAS;AAC9C,cAAI,MAAM,UAAU,MAAM,KAAK;AAC9B,mBAAO;AAAA,UACR;AAAA,QACD;AAAA,MACD;AACA,UAAI,OAAO,SAAS;AACnB,cAAM,cAAc,KAAK,QAAQ,WAAW,OAAO,SAAS,OAAO,OAAO;AAC1E,YAAI,aAAa;AAChB,gBAAM,UAAU,KAAK,QAAQ,iBAAiB,OAAO,MAAM,OAAO,OAAO;AACzE,cAAI,QAAQ,UAAU,QAAQ,OAAO;AACpC,mBAAO;AAAA,UACR;AAAA,QACD;AAAA,MACD;AAGA,UAAI,WAAW,KAAK,IAAI,MAAM,IAAI,KAAK,EAAE,EAAE;AAE3C,iBAAW,KAAK,YAAY,kBAAkB,MAAM,MAAM,OAAO,SAAS,MAAM,MAAM,QAAQ;AAC9F,iBAAW,KAAK,SAAS,kBAAkB,OAAO,SAAS,MAAM,MAAM,QAAQ;AAE/E,YAAM,cAAgC,OAAO,QAAQ,eAAe;AACpE,UAAI,YAAY;AAChB,UAAI,YAAY,UAAU,CAAC,KAAK,OAAO,CAAC,KAAK,UAAU,YAAY,YAAY,QAAQ,KAAK,KAAK,OAAO,IAAI,CAAC,MAAM,GAAG;AACrH,c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