pokemon-showdown/data/mods/stadium/statuses.js
Guangcong Luo f3e45fbb72 Move server code to server/
Also move mods/ to data/mods/

This makes PS more monorepo-like. The intent is to further separate
the sim and the server code, but without fully committing to splitting
the repository itself.

We now support `./pokemon-showdown start` in addition to
`./pokemon-showdown`. I'm not clear which I want to be the default
yet.
2019-02-03 16:07:06 -06:00

147 lines
3.8 KiB
JavaScript

'use strict';
/**@type {{[k: string]: ModdedEffectData}} */
let BattleStatuses = {
brn: {
name: 'brn',
id: 'brn',
num: 0,
effectType: 'Status',
onStart: function (target) {
this.add('-status', target, 'brn');
},
onAfterMoveSelfPriority: 2,
onAfterMoveSelf: function (pokemon) {
this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
},
onAfterSwitchInSelf: function (pokemon) {
this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
},
},
par: {
name: 'par',
id: 'par',
num: 0,
effectType: 'Status',
onStart: function (target) {
this.add('-status', target, 'par');
},
onBeforeMovePriority: 2,
onBeforeMove: function (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',
id: 'slp',
num: 0,
effectType: 'Status',
onStart: function (target) {
this.add('-status', target, 'slp');
// 1-3 turns
this.effectData.startTime = this.random(1, 4);
this.effectData.time = this.effectData.startTime;
},
onBeforeMovePriority: 2,
onBeforeMove: function (pokemon, target, move) {
pokemon.statusData.time--;
this.add('cant', pokemon, 'slp');
pokemon.lastMove = null;
return false;
},
onAfterMoveSelf: function (pokemon) {
if (pokemon.statusData.time <= 0) pokemon.cureStatus();
},
},
frz: {
name: 'frz',
id: 'frz',
num: 0,
effectType: 'Status',
onStart: function (target) {
this.add('-status', target, 'frz');
},
onBeforeMovePriority: 2,
onBeforeMove: function (pokemon, target, move) {
this.add('cant', pokemon, 'frz');
pokemon.lastMove = null;
return false;
},
onHit: function (target, source, move) {
if (move.type === 'Fire' && move.category !== 'Status') {
target.cureStatus();
}
},
},
psn: {
name: 'psn',
id: 'psn',
num: 0,
effectType: 'Status',
onStart: function (target) {
this.add('-status', target, 'psn');
},
onAfterMoveSelfPriority: 2,
onAfterMoveSelf: function (pokemon) {
this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
},
onAfterSwitchInSelf: function (pokemon) {
this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
},
},
tox: {
name: 'tox',
id: 'tox',
num: 0,
effectType: 'Status',
onStart: function (target) {
this.add('-status', target, 'tox');
},
onAfterMoveSelfPriority: 2,
onAfterMoveSelf: function (pokemon) {
this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
},
onAfterSwitchInSelf: function (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',
id: 'partiallytrapped',
num: 0,
duration: 2,
onBeforeMovePriority: 1,
onStart: function (target, source, effect) {
this.add('-activate', target, 'move: ' + effect, '[of] ' + source);
},
onBeforeMove: function (pokemon) {
if (this.effectData.source && (!this.effectData.source.isActive || this.effectData.source.hp <= 0)) {
pokemon.removeVolatile('partiallytrapped');
return;
}
this.add('cant', pokemon, 'partiallytrapped');
return false;
},
onEnd: function (pokemon) {
this.add('-end', pokemon, this.effectData.sourceEffect, '[partiallytrapped]');
},
},
};
exports.BattleStatuses = BattleStatuses;