pokemon-showdown/mods/gen4/items.js
2012-06-23 19:11:01 -07:00

44 lines
1.1 KiB
JavaScript

exports.BattleItems = {
"custapberry": {
id: "custapberry",
name: "Custap Berry",
spritenum: 86,
isBerry: true,
naturalGift: {
basePower: 80,
type: "Ghost"
},
onBeforeTurn: function(pokemon) {
if (pokemon.hp <= pokemon.maxhp/4 || (pokemon.hp <= pokemon.maxhp/2 && pokemon.ability === 'Gluttony')) {
var decision = this.willMove(pokemon);
if (!decision) return;
this.addQueue({
choice: 'event',
event: 'Custap',
priority: decision.priority + .1,
pokemon: decision.pokemon,
move: decision.move,
target: decision.target
});
}
},
onCustap: function(pokemon) {
var decision = this.willMove(pokemon);
this.debug('custap decision: '+decision);
if (decision) {
pokemon.eatItem();
}
},
onEat: function(pokemon) {
var decision = this.willMove(pokemon);
this.debug('custap eaten: '+decision);
if (decision) {
this.cancelDecision(pokemon);
this.add('r-custap '+pokemon.id);
this.runDecision(decision);
}
},
desc: "Activates at 25% HP. Next move used goes first. One-time use."
},
};