mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-03-21 17:25:10 -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.
126 lines
3.2 KiB
TypeScript
126 lines
3.2 KiB
TypeScript
export const Conditions: import('../../../sim/dex-conditions').ModdedConditionDataTable = {
|
|
brn: {
|
|
name: 'brn',
|
|
effectType: 'Status',
|
|
onStart(target) {
|
|
this.add('-status', target, 'brn');
|
|
},
|
|
onAfterMoveSelfPriority: 2,
|
|
onAfterMoveSelf(pokemon) {
|
|
this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
|
|
},
|
|
onAfterSwitchInSelf(pokemon) {
|
|
this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
|
|
},
|
|
},
|
|
par: {
|
|
name: 'par',
|
|
effectType: 'Status',
|
|
onStart(target) {
|
|
this.add('-status', target, 'par');
|
|
},
|
|
onBeforeMovePriority: 2,
|
|
onBeforeMove(pokemon) {
|
|
if (this.randomChance(63, 256)) {
|
|
this.add('cant', pokemon, 'par');
|
|
pokemon.removeVolatile('bide');
|
|
pokemon.removeVolatile('lockedmove');
|
|
pokemon.removeVolatile('twoturnmove');
|
|
pokemon.removeVolatile('invulnerability');
|
|
pokemon.removeVolatile('partialtrappinglock');
|
|
return false;
|
|
}
|
|
},
|
|
},
|
|
slp: {
|
|
name: 'slp',
|
|
effectType: 'Status',
|
|
onStart(target, source, sourceEffect) {
|
|
if (sourceEffect && sourceEffect.effectType === 'Move') {
|
|
this.add('-status', target, 'slp', `[from] move: ${sourceEffect.name}`);
|
|
} else {
|
|
this.add('-status', target, 'slp');
|
|
}
|
|
// 1-3 turns
|
|
this.effectState.startTime = this.random(1, 4);
|
|
this.effectState.time = this.effectState.startTime;
|
|
|
|
if (target.removeVolatile('nightmare')) {
|
|
this.add('-end', target, 'Nightmare', '[silent]');
|
|
}
|
|
},
|
|
onBeforeMovePriority: 2,
|
|
onBeforeMove(pokemon, target, move) {
|
|
pokemon.statusState.time--;
|
|
this.add('cant', pokemon, 'slp');
|
|
pokemon.lastMove = null;
|
|
return false;
|
|
},
|
|
onAfterMoveSelf(pokemon) {
|
|
if (pokemon.statusState.time <= 0) pokemon.cureStatus();
|
|
},
|
|
},
|
|
frz: {
|
|
name: 'frz',
|
|
effectType: 'Status',
|
|
onStart(target) {
|
|
this.add('-status', target, 'frz');
|
|
},
|
|
onBeforeMovePriority: 2,
|
|
onBeforeMove(pokemon, target, move) {
|
|
this.add('cant', pokemon, 'frz');
|
|
pokemon.lastMove = null;
|
|
return false;
|
|
},
|
|
onHit(target, source, move) {
|
|
if (move.type === 'Fire' && move.category !== 'Status') {
|
|
target.cureStatus();
|
|
}
|
|
},
|
|
},
|
|
psn: {
|
|
name: 'psn',
|
|
effectType: 'Status',
|
|
onStart(target) {
|
|
this.add('-status', target, 'psn');
|
|
},
|
|
onAfterMoveSelfPriority: 2,
|
|
onAfterMoveSelf(pokemon) {
|
|
this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
|
|
},
|
|
onAfterSwitchInSelf(pokemon) {
|
|
this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
|
|
},
|
|
},
|
|
confusion: {
|
|
inherit: true,
|
|
onStart(target) {
|
|
this.add('-start', target, 'confusion');
|
|
this.effectState.time = this.random(2, 6);
|
|
},
|
|
},
|
|
flinch: {
|
|
inherit: true,
|
|
onStart() {},
|
|
},
|
|
partiallytrapped: {
|
|
name: 'partiallytrapped',
|
|
duration: 2,
|
|
onBeforeMovePriority: 1,
|
|
onStart(target, source, effect) {
|
|
this.add('-activate', target, `move: ${effect}`, `[of] ${source}`);
|
|
},
|
|
onBeforeMove(pokemon) {
|
|
if (this.effectState.source && (!this.effectState.source.isActive || this.effectState.source.hp <= 0)) {
|
|
pokemon.removeVolatile('partiallytrapped');
|
|
return;
|
|
}
|
|
this.add('cant', pokemon, 'partiallytrapped');
|
|
return false;
|
|
},
|
|
onEnd(pokemon) {
|
|
this.add('-end', pokemon, this.effectState.sourceEffect, '[partiallytrapped]');
|
|
},
|
|
},
|
|
};
|