mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-05-19 13:45:19 -05:00
31 lines
865 B
JavaScript
31 lines
865 B
JavaScript
'use strict';
|
|
|
|
exports.BattleScripts = {
|
|
getEffect: function (name) {
|
|
if (name && typeof name !== 'string') {
|
|
return name;
|
|
}
|
|
let id = toId(name);
|
|
if (id.startsWith('ability')) return Object.assign(Object.create(this.getAbility(id.slice(7))), {id});
|
|
return Object.getPrototypeOf(this).getEffect.call(this, name);
|
|
},
|
|
suppressingWeather() {
|
|
for (const side of this.sides) {
|
|
for (const pokemon of side.active) {
|
|
if (pokemon && !pokemon.ignoringAbility() && pokemon.hasAbility('Cloud Nine')) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
},
|
|
pokemon: {
|
|
hasAbility: function (ability) {
|
|
if (this.ignoringAbility()) return false;
|
|
if (Array.isArray(ability)) return ability.some(ability => this.hasAbility(ability));
|
|
ability = toId(ability);
|
|
return this.ability === ability || !!this.volatiles['ability' + ability];
|
|
},
|
|
},
|
|
};
|