export const Rulesets: {[k: string]: FormatData} = {
teampreview: {
effectType: 'Rule',
name: 'Team Preview',
desc: "Allows each player to see the Pokémon on their opponent's team before they choose their lead Pokémon",
onTeamPreview() {
this.add('clearpoke');
for (const pokemon of this.getAllPokemon()) {
const details = pokemon.details.replace(', shiny', '')
.replace(/(Arceus|Gourgeist|Pumpkaboo|Silvally|Urshifu|Silvino)(-[a-zA-Z?-]+)?/g, '$1-*');
this.add('poke', pokemon.side.id, details, '');
}
this.makeRequest('teampreview');
},
},
datamod: {
effectType: 'Rule',
name: 'Data Mod',
desc: 'When a new Pokémon switches in for the first time, information about its types, stats and Abilities is displayed to both players.',
onBegin() {
for (const pokemon of this.getAllPokemon()) {
const species = this.dex.species.get(pokemon.species.name);
const baseSpecies = this.dex.mod('gen8').species.get(pokemon.species.name);
let modded = false;
for (const type of [0, 1]) {
if (species.types[type] !== baseSpecies.types[type]) {
modded = true;
break;
}
}
if (Object.values(species.baseStats).join('/') !== Object.values(baseSpecies.baseStats).join('/')) {
modded = true;
}
for (const i of ['0', '1', 'H', 'S'] as ('0' | '1' | 'H' | 'S')[]) {
if (species.abilities[i] !== baseSpecies.abilities[i]) {
modded = true;
break;
}
}
if (modded) {
pokemon.m.isModded = true;
}
}
},
onSwitchIn(pokemon) {
let species = pokemon.species;
if (pokemon.illusion) {
species = pokemon.illusion.species;
if (!pokemon.illusion.m.isModded) return;
this.add('-start', pokemon, 'typechange', pokemon.illusion.getTypes(true).join('/'), '[silent]');
if (pokemon.illusion.m.switchedIn) return;
pokemon.illusion.m.switchedIn = true;
} else {
if (!pokemon.m.isModded) return;
this.add('-start', pokemon, 'typechange', pokemon.getTypes(true).join('/'), '[silent]');
if (pokemon.m.switchedIn) return;
pokemon.m.switchedIn = true;
}
const abilities = Object.values(species.abilities).join(' / ');
const baseStats = species.baseStats;
const type = species.types[0];
if (species.types[1]) {
const type2 = species.types[1];
this.add(`raw|
- ` + species.name + `

` + abilities + `
`);
} else {
this.add(`raw|- ` + species.name + `
` + abilities + `
`);
}
this.add(`raw|- HP
` + baseStats.hp + ` Atk
` + baseStats.atk + ` Def
` + baseStats.def + ` SpA
` + baseStats.spa + ` SpD
` + baseStats.spd + ` Spe
` + baseStats.spe + `
`);
},
onDamagingHit(damage, target, source, move) {
if (target.hasAbility('illusion')) { // making sure the correct information is given when an Illusion breaks
if (target.m.isModded) {
this.add('-start', target, 'typechange', target.getTypes(true).join('/'), '[silent]');
if (!target.m.switchedIn) {
target.m.switchedIn = true;
const species = target.species;
const abilities = Object.values(species.abilities).join(' / ');
const baseStats = species.baseStats;
const type = species.types[0];
const type2 = species.types[1];
this.add(
`raw|- ${species.name} ` +
`${type2 ? `` : ''} ` +
`${abilities}` +
`
`
);
this.add(
`raw|- HP
` +
`${baseStats.hp} Atk
${baseStats.atk} Def
` +
`${baseStats.def} SpA
${baseStats.spa} SpD
` +
`${baseStats.spd} Spe
${baseStats.spe}
`
);
}
} else {
const types = target.baseSpecies.types;
if (target.getTypes().join() === types.join()) {
this.add('-end', target, 'typechange', '[silent]');
}
}
}
},
},
megadatamod: {
effectType: 'Rule',
name: 'Mega Data Mod',
desc: 'Gives data on stats, Ability and types when a Pokémon Mega Evolves or undergoes Ultra Burst.',
onSwitchIn(pokemon) {
const mon = pokemon.illusion || pokemon;
if (mon.species.isMega || mon.species.forme.startsWith('Ultra')) {
this.add('-start', pokemon, 'typechange', mon.getTypes(true).join('/'), '[silent]');
}
},
onDamagingHit(damage, target, source, move) {
if (target.hasAbility('illusion')) {
if (target.species.forme.startsWith('Mega') || target.species.forme.startsWith('Ultra')) {
this.add('-start', target, 'typechange', target.getTypes(true).join('/'), '[silent]');
} else {
const types = target.baseSpecies.types;
if (target.getTypes().join() === types.join()) {
this.add('-end', target, 'typechange', '[silent]');
}
}
}
},
onAfterMega(pokemon) {
this.add('-start', pokemon, 'typechange', pokemon.getTypes(true).join('/'), '[silent]');
const species = pokemon.species;
const abilities = Object.values(species.abilities).join(' / ');
const baseStats = species.baseStats;
const type = species.types[0];
const type2 = species.types[1];
this.add(
`raw|- ${species.name} ` +
`${type2 ? `` : ''} ` +
`${abilities}` +
`HP
` +
`${baseStats.hp} Atk
${baseStats.atk} Def
` +
`${baseStats.def} SpA
${baseStats.spa} SpD
` +
`${baseStats.spd} Spe
${baseStats.spe}
`
);
pokemon.m.switchedIn = true;
},
},
};