mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-05-21 14:59:50 -05:00
Due to a quirk of history (namely, programmers having a poor understanding of the mod inheritance system), Gen 3 inherited from Gen 5 for a long time, resulting in a lot of duplicate code. This commit changes up the inheritance system and removes some duplicate code (specifically, statuses.js and moves.js besides Metronome and Mirror Move which need more investigation), the rest is reserved for a future commit.
49 lines
1.2 KiB
JavaScript
49 lines
1.2 KiB
JavaScript
'use strict';
|
|
|
|
exports.BattleStatuses = {
|
|
slp: {
|
|
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 () { },
|
|
},
|
|
};
|