pokemon-showdown/data/mods/gen3/statuses.ts
Guangcong Luo e0f6453b60 Refactor data definitions
- `Modded[Effect]Data` are now correctly defined: they must either have
  `inherit: true` and be partial, or not have `inherit: true` and be a
	complete `[Effect]Data` entry

- `id` is no longer allowed; instead, it's calculated directly from
  `toID(name)`. The one exception, Hidden Power, gets a `realMove`
	property to track this (it's still used to set `.id`, though;
	TODO: really fix it properly).

- `num` is still required in `data/pokedex.ts` (dex number),
  `data/moves.ts` (move index number, for Metronome), and
	`data/items.ts` (minisprite sprite-sheet location). It's still not
	required for mod-only items and moves.

- `num` is no longer allowed for PureEffects (in `statuses.ts`) where
  it's always been meaningless.

- `color` and `heightm`, being completely flavor, are still not
  required for `pokedex.ts` in mods. They're still required in the base
	pokedex.
2020-04-30 21:39:29 -07:00

53 lines
1.4 KiB
TypeScript

export const BattleStatuses: {[k: string]: ModdedPureEffectData} = {
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-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(target) {
this.effectData.time += this.effectData.skippedTime;
this.effectData.skippedTime = 0;
},
onBeforeMovePriority: 10,
onBeforeMove(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(target, source, move) {
// don't count Hidden Power or Weather Ball as Fire-type
if (move.thawsTarget || this.dex.getMove(move.id).type === 'Fire' && move.category !== 'Status') {
target.cureStatus();
}
},
},
sandstorm: {
inherit: true,
onModifySpD() {},
},
};