pokemon-showdown/data/mods/gen3/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

55 lines
1.3 KiB
JavaScript

'use strict';
/**@type {{[k: string]: ModdedEffectData}} */
let BattleStatuses = {
slp: {
name: 'slp',
id: 'slp',
num: 0,
effectType: 'Status',
onStart: function (target) {
this.add('-status', target, 'slp');
// 1-4 turns
this.effectData.time = this.random(2, 6);
// Turns spent using Sleep Talk/Snore immediately before switching out while asleep
this.effectData.skippedTime = 0;
},
onSwitchIn: function (target) {
this.effectData.time += this.effectData.skippedTime;
this.effectData.skippedTime = 0;
},
onBeforeMovePriority: 10,
onBeforeMove: function (pokemon, target, move) {
if (pokemon.hasAbility('earlybird')) {
pokemon.statusData.time--;
}
pokemon.statusData.time--;
if (pokemon.statusData.time <= 0) {
pokemon.cureStatus();
return;
}
this.add('cant', pokemon, 'slp');
if (move.sleepUsable) {
this.effectData.skippedTime++;
return;
}
this.effectData.skippedTime = 0;
return false;
},
},
frz: {
inherit: true,
onHit: function (target, source, move) {
if (move.thawsTarget || move.type === 'Fire' && move.category !== 'Status' && move.id !== 'hiddenpower' && move.id !== 'weatherball') {
target.cureStatus();
}
},
},
sandstorm: {
inherit: true,
onModifySpD: function () { },
},
};
exports.BattleStatuses = BattleStatuses;