From 0dc381da2df9cd296d064bcd8a9bd1050592dfb6 Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Thu, 13 Dec 2012 14:29:03 -0800 Subject: [PATCH] Correct implementation of Custap Berry --- data/items.js | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/data/items.js b/data/items.js index 8a57409dce..99c7e03aab 100644 --- a/data/items.js +++ b/data/items.js @@ -581,20 +581,13 @@ exports.BattleItems = { basePower: 80, type: "Ghost" }, - onResidual: function(pokemon) { + onModifyPriority: function(priority, pokemon) { if (pokemon.hp <= pokemon.maxhp/4 || (pokemon.hp <= pokemon.maxhp/2 && pokemon.ability === 'gluttony')) { - pokemon.eatItem(); - } - }, - onEat: function(pokemon) { - pokemon.addVolatile('custapberry'); - }, - effect: { - duration: 2, - onModifyPriority: function(priority, pokemon) { - this.add('-enditem', pokemon, 'Custap Berry'); - pokemon.removeVolatile('custapberry'); - return priority + 0.1; + if (pokemon.eatItem()) { + this.add('-enditem', pokemon, 'Custap Berry'); + pokemon.removeVolatile('custapberry'); + return priority + 0.1; + } } }, desc: "Activates at 25% HP. Next move used goes first. Unobtainable in BW. One-time use."