mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-05-24 00:36:27 -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
196 lines
4.6 KiB
TypeScript
196 lines
4.6 KiB
TypeScript
export const Abilities: {[k: string]: ModdedAbilityData} = {
|
|
cutecharm: {
|
|
inherit: true,
|
|
onDamagingHit(damage, target, source, move) {
|
|
if (damage && move.flags['contact']) {
|
|
if (this.randomChance(1, 3)) {
|
|
source.addVolatile('attract', target);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
effectspore: {
|
|
inherit: true,
|
|
onDamagingHit(damage, target, source, move) {
|
|
if (damage && move.flags['contact'] && !source.status) {
|
|
const r = this.random(300);
|
|
if (r < 10) {
|
|
source.setStatus('slp', target);
|
|
} else if (r < 20) {
|
|
source.setStatus('par', target);
|
|
} else if (r < 30) {
|
|
source.setStatus('psn', target);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
flamebody: {
|
|
inherit: true,
|
|
onDamagingHit(damage, target, source, move) {
|
|
if (damage && move.flags['contact']) {
|
|
if (this.randomChance(1, 3)) {
|
|
source.trySetStatus('brn', target);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
flashfire: {
|
|
inherit: true,
|
|
onTryHit(target, source, move) {
|
|
if (target !== source && move.type === 'Fire') {
|
|
if (move.id === 'willowisp' && (target.hasType('Fire') || target.status || target.volatiles['substitute'])) {
|
|
return;
|
|
}
|
|
if (target.status === 'frz') {
|
|
return;
|
|
}
|
|
if (!target.addVolatile('flashfire')) {
|
|
this.add('-immune', target, '[from] ability: Flash Fire');
|
|
}
|
|
return null;
|
|
}
|
|
},
|
|
},
|
|
intimidate: {
|
|
inherit: true,
|
|
onStart(pokemon) {
|
|
let activated = false;
|
|
for (const target of pokemon.adjacentFoes()) {
|
|
if (!target.volatiles['substitute']) {
|
|
activated = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (!activated) {
|
|
this.hint("In Gen 3, Intimidate does not activate if every target has a Substitute.", false, pokemon.side);
|
|
return;
|
|
}
|
|
this.add('-ability', pokemon, 'Intimidate', 'boost');
|
|
|
|
for (const target of pokemon.adjacentFoes()) {
|
|
if (target.volatiles['substitute']) {
|
|
this.add('-immune', target);
|
|
} else {
|
|
this.boost({atk: -1}, target, pokemon, null, true);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
lightningrod: {
|
|
onFoeRedirectTarget(target, source, source2, move) {
|
|
if (move.type !== 'Electric') return;
|
|
if (this.validTarget(this.effectState.target, source, move.target)) {
|
|
return this.effectState.target;
|
|
}
|
|
},
|
|
name: "Lightning Rod",
|
|
rating: 0,
|
|
num: 32,
|
|
},
|
|
minus: {
|
|
inherit: true,
|
|
onModifySpA(spa, pokemon) {
|
|
for (const active of this.getAllActive()) {
|
|
if (!active.fainted && active.hasAbility('plus')) {
|
|
return this.chainModify(1.5);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
plus: {
|
|
inherit: true,
|
|
onModifySpA(spa, pokemon) {
|
|
for (const active of this.getAllActive()) {
|
|
if (!active.fainted && active.hasAbility('minus')) {
|
|
return this.chainModify(1.5);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
poisonpoint: {
|
|
inherit: true,
|
|
onDamagingHit(damage, target, source, move) {
|
|
if (damage && move.flags['contact']) {
|
|
if (this.randomChance(1, 3)) {
|
|
source.trySetStatus('psn', target);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
pressure: {
|
|
inherit: true,
|
|
onStart(pokemon) {
|
|
this.addSplit(pokemon.side.id, ['-ability', pokemon, 'Pressure', '[silent]']);
|
|
},
|
|
},
|
|
roughskin: {
|
|
inherit: true,
|
|
onDamagingHit(damage, target, source, move) {
|
|
if (damage && move.flags['contact']) {
|
|
this.damage(source.baseMaxhp / 16, source, target);
|
|
}
|
|
},
|
|
},
|
|
shadowtag: {
|
|
inherit: true,
|
|
onFoeTrapPokemon(pokemon) {
|
|
pokemon.trapped = true;
|
|
},
|
|
},
|
|
static: {
|
|
inherit: true,
|
|
onDamagingHit(damage, target, source, move) {
|
|
if (damage && move.flags['contact']) {
|
|
if (this.randomChance(1, 3)) {
|
|
source.trySetStatus('par', target);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
trace: {
|
|
inherit: true,
|
|
onUpdate(pokemon) {
|
|
if (!pokemon.isStarted) return;
|
|
const target = pokemon.side.randomFoe();
|
|
if (!target || target.fainted) return;
|
|
const ability = target.getAbility();
|
|
const bannedAbilities = ['forecast', 'multitype', 'trace'];
|
|
if (bannedAbilities.includes(target.ability)) {
|
|
return;
|
|
}
|
|
if (pokemon.setAbility(ability)) {
|
|
this.add('-ability', pokemon, ability, '[from] ability: Trace', '[of] ' + target);
|
|
}
|
|
},
|
|
},
|
|
truant: {
|
|
inherit: true,
|
|
onStart() {},
|
|
onSwitchIn(pokemon) {
|
|
pokemon.truantTurn = this.turn !== 0;
|
|
},
|
|
onBeforeMove(pokemon) {
|
|
if (pokemon.truantTurn) {
|
|
this.add('cant', pokemon, 'ability: Truant');
|
|
return false;
|
|
}
|
|
},
|
|
onResidualOrder: 27,
|
|
onResidual(pokemon) {
|
|
pokemon.truantTurn = !pokemon.truantTurn;
|
|
},
|
|
},
|
|
voltabsorb: {
|
|
inherit: true,
|
|
onTryHit(target, source, move) {
|
|
if (target !== source && move.type === 'Electric' && move.id !== 'thunderwave') {
|
|
if (!this.heal(target.baseMaxhp / 4)) {
|
|
this.add('-immune', target, '[from] ability: Volt Absorb');
|
|
}
|
|
return null;
|
|
}
|
|
},
|
|
},
|
|
};
|