pokemon-showdown/data/mods/gen1/rulesets.ts
Guangcong Luo 13189fdb02
Update Dex API (#8181)
This is the change that renames:

- `Dex.getMove` -> `Dex.moves.get`
- `Dex.getAbility` -> `Dex.abilities.get`
- `Dex.getItem` -> `Dex.items.get`
- `Dex.getSpecies` -> `Dex.species.get`
- `Dex.getEffect` -> `Dex.conditions.get`
- `Dex.getNature` -> `Dex.natures.get`
- `Dex.getType` -> `Dex.types.get`
- `Dex.getFormat` -> `Dex.formats.get`

In addition, some other APIs have been updated:

- `getByID` methods have also been added to every other table.
- `Dex.moves.all()` now gets an array of all moves
  - Plus equivalent methods for `abilities`, `items`, `species`, `formats`, `natures`, `types`
  - Note: there's no `Dex.conditions.all()`
- new API: `Dex.stats` for naming/iterating stats
- `Dex.getEffectByID` -> `Dex.conditions.getByID`
- `Dex.getType` -> `Dex.types.get`
- `Dex.data.Formats` -> `Dex.data.Rulesets`
- `Dex.formats` -> now an array `Dex.formats.all()`
- `Dex.getRuleTable` -> `Dex.formats.getRuleTable`
- `Dex.validateFormat` -> `Dex.formats.validate`

Team functions have been split off into a new `sim/teams` package:

- `Dex.packTeam` -> `Teams.pack`
- `Dex.fastUnpackTeam` -> `Teams.unpack`
- `Dex.generateTeam` -> `Teams.generate`
- `Dex.stringifyTeam` -> `Teams.export`

`Teams.export` has also been rewritten to better match how it works in client.

This implements #8178
2021-04-08 03:00:37 -07:00

73 lines
2.6 KiB
TypeScript

export const Rulesets: {[k: string]: ModdedFormatData} = {
standard: {
effectType: 'ValidatorRule',
name: 'Standard',
ruleset: ['Obtainable', 'Desync Clause Mod', 'Sleep Clause Mod', 'Freeze Clause Mod', 'Species 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];
}
}
return newSpecies;
},
},
flippedmod: {
effectType: 'Rule',
name: 'Flipped Mod',
desc: "Every Pok&eacute;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&eacute;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];
}
return newSpecies;
},
},
};