This commit is contained in:
André Bastos Dias 2026-06-02 14:06:11 +01:00 committed by GitHub
commit c6760c3997
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 64 additions and 35 deletions

View File

@ -482,9 +482,8 @@ export const Moves: import('../../../sim/dex-moves').ModdedMoveDataTable = {
inherit: true,
onHit(pokemon) {
const foe = pokemon.side.foe.active[0];
if (!foe?.lastMove || foe.lastMove.id === 'mirrormove') {
return false;
}
// only Mirror Move isn't mirrorable
if (!foe?.lastMove?.flags['mirror']) return false;
pokemon.side.lastSelectedMove = foe.lastMove.id;
this.actions.useMove(foe.lastMove.id, pokemon);
},

View File

@ -21,6 +21,16 @@ export const Scripts: ModdedBattleScriptsData = {
poke.gender = 'N';
poke.eggGroups = null;
}
for (const i in this.data.Moves) {
const move = this.data.Moves[i];
if (i === 'mirrormove') {
const flags = { ...move.flags };
delete flags['mirror'];
this.modData('Moves', i).flags = flags;
} else {
this.modData('Moves', i).flags = { mirror: 1, ...move.flags };
}
}
},
// BattlePokemon scripts.
pokemon: {

View File

@ -343,13 +343,10 @@ export const Moves: import('../../../sim/dex-moves').ModdedMoveDataTable = {
inherit: true,
flags: { metronome: 1, failencore: 1, nosketch: 1 },
onHit(pokemon) {
const noMirror = ['metronome', 'mimic', 'mirrormove', 'sketch', 'sleeptalk', 'transform'];
const target = pokemon.side.foe.active[0];
const lastMove = target?.lastMove && target?.lastMove.id;
if (!lastMove || (!pokemon.activeTurns && !target.moveThisTurn)) {
return false;
}
if (noMirror.includes(lastMove) || pokemon.moves.includes(lastMove)) {
const lastMove = target?.lastMove;
if (!lastMove?.flags['mirror'] || pokemon.moves.includes(lastMove.id) ||
(!pokemon.activeTurns && !target.moveThisTurn)) {
return false;
}
this.actions.useMove(lastMove, pokemon);

View File

@ -5,6 +5,19 @@
export const Scripts: ModdedBattleScriptsData = {
inherit: 'gen3',
gen: 2,
init() {
const noMirror = ['metronome', 'mimic', 'mirrormove', 'sketch', 'sleeptalk', 'transform'];
for (const i in this.data.Moves) {
const move = this.data.Moves[i];
if (noMirror.includes(i)) {
const flags = { ...move.flags };
delete flags['mirror'];
this.modData('Moves', i).flags = flags;
} else {
this.modData('Moves', i).flags = { mirror: 1, ...move.flags };
}
}
},
pokemon: {
inherit: true,
getStat(statName, unboosted, unmodified, fastReturn) {

View File

@ -428,21 +428,6 @@ export const Moves: import('../../../sim/dex-moves').ModdedMoveDataTable = {
mirrormove: {
inherit: true,
flags: { metronome: 1, failencore: 1, nosleeptalk: 1, noassist: 1 },
onTryHit: undefined, // no inherit
onHit(pokemon) {
const noMirror = [
'assist', 'curse', 'doomdesire', 'focuspunch', 'futuresight', 'magiccoat', 'metronome', 'mimic', 'mirrormove', 'naturepower', 'psychup', 'roleplay', 'sketch', 'sleeptalk', 'spikes', 'spitup', 'taunt', 'teeterdance', 'transform',
];
const lastAttackedBy = pokemon.getLastAttackedBy();
if (!lastAttackedBy?.source.lastMove || !lastAttackedBy.move) {
return false;
}
if (noMirror.includes(lastAttackedBy.move) || !lastAttackedBy.source.hasMove(lastAttackedBy.move)) {
return false;
}
this.actions.useMove(lastAttackedBy.move, pokemon);
},
target: "self",
},
naturepower: {
inherit: true,

View File

@ -3,14 +3,25 @@ export const Scripts: ModdedBattleScriptsData = {
gen: 3,
init() {
const specialTypes = ['Fire', 'Water', 'Grass', 'Ice', 'Electric', 'Dark', 'Psychic', 'Dragon'];
const noMirror = [
'assist', 'curse', 'doomdesire', 'focuspunch', 'futuresight', 'magiccoat', 'metronome', 'mimic', 'mirrormove', 'naturepower', 'psychup', 'roleplay', 'sketch', 'sleeptalk', 'spikes', 'spitup', 'taunt', 'teeterdance', 'transform',
];
let newCategory = '';
for (const i in this.data.Moves) {
if (!this.data.Moves[i]) console.log(i);
if (this.data.Moves[i].category === 'Status') continue;
newCategory = specialTypes.includes(this.data.Moves[i].type) ? 'Special' : 'Physical';
if (newCategory !== this.data.Moves[i].category) {
const move = this.data.Moves[i];
if (!move) console.log(i);
if (move.category === 'Status') continue;
newCategory = specialTypes.includes(move.type) ? 'Special' : 'Physical';
if (newCategory !== move.category) {
this.modData('Moves', i).category = newCategory;
}
if (noMirror.includes(i)) {
const flags = { ...move.flags };
delete flags['mirror'];
this.modData('Moves', i).flags = flags;
} else {
this.modData('Moves', i).flags = { mirror: 1, ...move.flags };
}
}
},
pokemon: {

View File

@ -895,13 +895,11 @@ export const Moves: import('../../../sim/dex-moves').ModdedMoveDataTable = {
if (!lastAttackedBy?.source.lastMove || !lastAttackedBy.move) {
return false;
}
const noMirror = [
'acupressure', 'aromatherapy', 'assist', 'chatter', 'copycat', 'counter', 'curse', 'doomdesire', 'feint', 'focuspunch', 'futuresight', 'gravity', 'hail', 'haze', 'healbell', 'helpinghand', 'lightscreen', 'luckychant', 'magiccoat', 'mefirst', 'metronome', 'mimic', 'mirrorcoat', 'mirrormove', 'mist', 'mudsport', 'naturepower', 'perishsong', 'psychup', 'raindance', 'reflect', 'roleplay', 'safeguard', 'sandstorm', 'sketch', 'sleeptalk', 'snatch', 'spikes', 'spitup', 'stealthrock', 'struggle', 'sunnyday', 'tailwind', 'toxicspikes', 'transform', 'watersport',
];
if (noMirror.includes(lastAttackedBy.move) || !lastAttackedBy.source.hasMove(lastAttackedBy.move)) {
const move = this.dex.moves.get(lastAttackedBy.move);
if (!move.flags['mirror'] || !lastAttackedBy.source.hasMove(move.id)) {
return false;
}
this.actions.useMove(lastAttackedBy.move, pokemon);
this.actions.useMove(move, pokemon);
},
target: "self",
},

View File

@ -1,6 +1,21 @@
export const Scripts: ModdedBattleScriptsData = {
inherit: 'gen5',
gen: 4,
init() {
const noMirror = [
'acupressure', 'aromatherapy', 'assist', 'chatter', 'copycat', 'counter', 'curse', 'doomdesire', 'feint', 'focuspunch', 'futuresight', 'gravity', 'hail', 'haze', 'healbell', 'helpinghand', 'lightscreen', 'luckychant', 'magiccoat', 'mefirst', 'metronome', 'mimic', 'mirrorcoat', 'mirrormove', 'mist', 'mudsport', 'naturepower', 'perishsong', 'psychup', 'raindance', 'reflect', 'roleplay', 'safeguard', 'sandstorm', 'sketch', 'sleeptalk', 'snatch', 'spikes', 'spitup', 'stealthrock', 'struggle', 'sunnyday', 'tailwind', 'toxicspikes', 'transform', 'watersport',
];
for (const i in this.data.Moves) {
const move = this.data.Moves[i];
if (noMirror.includes(i)) {
const flags = { ...move.flags };
delete flags['mirror'];
this.modData('Moves', i).flags = flags;
} else {
this.modData('Moves', i).flags = { mirror: 1, ...move.flags };
}
}
},
pokemon: {
inherit: true,
getActionSpeed() {

View File

@ -594,11 +594,12 @@ export class DexSpecies {
species.canHatch = species.canHatch ||
(!['Ditto', 'Undiscovered'].includes(species.eggGroups[0]) && !species.prevo && species.name !== 'Manaphy');
if (this.dex.gen === 1) species.bst -= species.baseStats.spd;
if (this.dex.gen < 5) {
if (this.dex.gen <= 2) species.abilities = { 0: 'No Ability' };
else if (this.dex.gen < 5) {
species.abilities = this.dex.deepClone(species.abilities);
delete species.abilities['H'];
if (this.dex.gen === 3 && this.dex.abilities.get(species.abilities['1']).gen === 4) delete species.abilities['1'];
}
if (this.dex.gen === 3 && this.dex.abilities.get(species.abilities['1']).gen === 4) delete species.abilities['1'];
if (this.dex.parentMod) {
// if this species is exactly identical to parentMod's species, reuse parentMod's copy