mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-05-17 10:46:53 -05:00
For side conditions, `onStart`/`onRestart`/`onResidual`/`onEnd` have been renamed `onSideStart`/`onSideRestart`/`onSideResidual`/`onSideEnd`, with the `onResidualOrder` properties renamed `onSideResidualOrder`. For field conditions, `onStart`/`onRestart`/`onResidual`/`onEnd` have been renamed `onFieldStart`/`onFieldRestart`/`onFieldResidual`/`onFieldEnd`, with the `onResidualOrder` properties renamed `onFieldResidualOrder`. (The `onField` and `onSide` part helps make it clear to the type system that the first argument is a Field or Side, not a Pokemon.) Side and field conditions can now use `onResidual` to tick separately on each pokemon in Speed order. `onResidualOrder` (the per-pokemon tick) can be timed separate from `onSideResidualOrder` (the per-condition tick), allowing conditions to end at a different priority than they tick per-pokemon. Relatedly, `onTeamPreview` and `onStart` in formats now need to be `onFieldTeamPreview` and `onFieldStart`. Unrelatedly, `effectData` has been renamed `effectState`, and the corresponding state containers (`pokemon.statusData`, `pokemon.speciesData`, `pokemon.itemData`, `pokemon.abilityData`, `field.weatherData`, `field.terrainData`) have been similarly renamed. I renamed the types a while ago, but I was holding off renaming the fields because it would be a breaking change. But this is a breaking change anyway, so we might as well do it now. Note: `onResidual` will tick even on `onSideEnd` turns, although `onSideResidual` won't. When refactoring weather, remember to check `this.state.duration` so you don't deal weather damage on the ending turn. Intended as a better fix for #8216
132 lines
3.5 KiB
TypeScript
132 lines
3.5 KiB
TypeScript
export const Conditions: {[k: string]: ModdedConditionData} = {
|
|
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('lockedmovee');
|
|
pokemon.removeVolatile('twoturnmove');
|
|
pokemon.removeVolatile('fly');
|
|
pokemon.removeVolatile('dig');
|
|
pokemon.removeVolatile('solarbeam');
|
|
pokemon.removeVolatile('skullbash');
|
|
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;
|
|
},
|
|
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));
|
|
},
|
|
},
|
|
tox: {
|
|
name: 'tox',
|
|
effectType: 'Status',
|
|
onStart(target) {
|
|
this.add('-status', target, 'tox');
|
|
},
|
|
onAfterMoveSelfPriority: 2,
|
|
onAfterMoveSelf(pokemon) {
|
|
this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
|
|
},
|
|
onAfterSwitchInSelf(pokemon) {
|
|
// Regular poison status and damage after a switchout -> switchin.
|
|
pokemon.setStatus('psn');
|
|
pokemon.addVolatile('residualdmg');
|
|
pokemon.volatiles['residualdmg'].counter = 1;
|
|
this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
|
|
},
|
|
},
|
|
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]');
|
|
},
|
|
},
|
|
};
|