mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-04-26 02:39:38 -05:00
ESLint has a whole new config format, so I figure it's a good time to make the config system saner. - First, we no longer have separate eslint-no-types configs. Lint performance shouldn't be enough of a problem to justify the relevant maintenance complexity. - Second, our base config should work out-of-the-box now. `npx eslint` will work as expected, without any CLI flags. You should still use `npm run lint` which adds the `--cached` flag for performance. - Third, whatever updates I did fixed style linting, which apparently has been bugged for quite some time, considering all the obvious mixed-tabs-and-spaces issues I found in the upgrade. Also here are some changes to our style rules. In particular: - Curly brackets (for objects etc) now have spaces inside them. Sorry for the huge change. ESLint doesn't support our old style, and most projects use Prettier style, so we might as well match them in this way. See https://github.com/eslint-stylistic/eslint-stylistic/issues/415 - String + number concatenation is no longer allowed. We now consistently use template strings for this.
75 lines
2.8 KiB
TypeScript
75 lines
2.8 KiB
TypeScript
export const Rulesets: import('../../../sim/dex-formats').ModdedFormatDataTable = {
|
|
standard: {
|
|
effectType: 'ValidatorRule',
|
|
name: 'Standard',
|
|
ruleset: ['Obtainable', 'Desync Clause Mod', 'Sleep Clause Mod', 'Freeze Clause Mod', 'Species Clause', 'Nickname Clause', 'OHKO Clause', 'Evasion Moves Clause', 'Endless Battle Clause', 'HP Percentage Mod', 'Cancel Mod'],
|
|
banlist: ['Dig', 'Fly'],
|
|
},
|
|
'350cupmod': {
|
|
effectType: 'Rule',
|
|
name: '350 Cup Mod',
|
|
desc: "If a Pokémon's BST is 350 or lower, all of its stats get doubled.",
|
|
onBegin() {
|
|
this.add('rule', '350 Cup Mod: If a Pokemon\'s BST is 350 or lower, all of its stats get doubled.');
|
|
},
|
|
onModifySpecies(species) {
|
|
const newSpecies = this.dex.deepClone(species);
|
|
const bst = newSpecies.bst;
|
|
if (bst <= 350) {
|
|
newSpecies.bst = 0;
|
|
for (const stat in newSpecies.baseStats) {
|
|
if (stat === 'spd') continue;
|
|
newSpecies.baseStats[stat] = this.clampIntRange(newSpecies.baseStats[stat] * 2, 1, 255);
|
|
newSpecies.bst += newSpecies.baseStats[stat];
|
|
}
|
|
newSpecies.baseStats['spd'] = newSpecies.baseStats['spa'];
|
|
}
|
|
return newSpecies;
|
|
},
|
|
},
|
|
flippedmod: {
|
|
effectType: 'Rule',
|
|
name: 'Flipped Mod',
|
|
desc: "Every Pokémon's stats are reversed. HP becomes Spe, Atk becomes Spc, Def stays the same.",
|
|
onBegin() {
|
|
this.add('rule', 'Pokemon have their stats flipped (HP becomes Spe, vice versa).');
|
|
},
|
|
onModifySpecies(species) {
|
|
const newSpecies = this.dex.deepClone(species);
|
|
const stats: { [k: string]: number } = {
|
|
hp: newSpecies.baseStats.spe,
|
|
atk: newSpecies.baseStats.spa,
|
|
def: newSpecies.baseStats.def,
|
|
spa: newSpecies.baseStats.atk,
|
|
spd: newSpecies.baseStats.atk,
|
|
spe: newSpecies.baseStats.hp,
|
|
};
|
|
for (const i in newSpecies.baseStats) {
|
|
newSpecies.baseStats[i] = stats[i];
|
|
}
|
|
return newSpecies;
|
|
},
|
|
},
|
|
scalemonsmod: {
|
|
effectType: 'Rule',
|
|
name: 'Scalemons Mod',
|
|
desc: "Every Pokémon's stats, barring HP, are scaled to give them a BST as close to 500 as possible",
|
|
onBegin() {
|
|
this.add('rule', 'Scalemons Mod: Every Pokemon\'s stats, barring HP, are scaled to come as close to a BST of 500 as possible');
|
|
},
|
|
onModifySpecies(species, target, source) {
|
|
const newSpecies = this.dex.deepClone(species);
|
|
const pst: number = newSpecies.bst - newSpecies.baseStats['hp'];
|
|
const scale = 500 - newSpecies.baseStats['hp'];
|
|
newSpecies.bst = newSpecies.baseStats['hp'];
|
|
for (const stat in newSpecies.baseStats) {
|
|
if (stat === 'hp' || stat === 'spd') continue;
|
|
newSpecies.baseStats[stat] = this.clampIntRange(newSpecies.baseStats[stat] * scale / pst, 1, 255);
|
|
newSpecies.bst += newSpecies.baseStats[stat];
|
|
}
|
|
newSpecies.baseStats['spd'] = newSpecies.baseStats['spa'];
|
|
return newSpecies;
|
|
},
|
|
},
|
|
};
|