diff --git a/battle-engine.js b/battle-engine.js index 3447f8359b..b4da159e12 100644 --- a/battle-engine.js +++ b/battle-engine.js @@ -1013,10 +1013,11 @@ BattlePokemon = (() => { if (!sourceEffect && this.battle.effect) sourceEffect = this.battle.effect; if (!source && this.battle.event && this.battle.event.target) source = this.battle.event.target; item = this.getItem(); - if (this.battle.runEvent('UseItem', this, null, null, item) && this.battle.runEvent('EatItem', this, null, null, item)) { + if (this.battle.runEvent('UseItem', this, null, null, item) && this.battle.runEvent('TryEatItem', this, null, null, item)) { this.battle.add('-enditem', this, item, '[eat]'); this.battle.singleEvent('Eat', item, this.itemData, this, source, sourceEffect); + this.battle.runEvent('EatItem', this, null, null, item); this.lastItem = this.item; this.item = ''; diff --git a/data/abilities.js b/data/abilities.js index bb89dfe564..b65e24a397 100644 --- a/data/abilities.js +++ b/data/abilities.js @@ -3124,7 +3124,7 @@ exports.BattleAbilities = { onStart: function (pokemon) { this.add('-ability', pokemon, 'Unnerve', pokemon.side.foe); }, - onFoeEatItem: false, + onFoeTryEatItem: false, id: "unnerve", name: "Unnerve", rating: 1.5, diff --git a/data/items.js b/data/items.js index 7d234c363d..5b12ae905f 100644 --- a/data/items.js +++ b/data/items.js @@ -104,7 +104,7 @@ exports.BattleItems = { pokemon.eatItem(); } }, - onEatItem: function (item, pokemon) { + onTryEatItem: function (item, pokemon) { if (!this.runEvent('TryHeal', pokemon)) return false; }, onEat: function (pokemon) { @@ -1290,7 +1290,7 @@ exports.BattleItems = { target.eatItem(); } }, - onEatItem: function (item, pokemon) { + onTryEatItem: function (item, pokemon) { if (!this.runEvent('TryHeal', pokemon)) return false; }, onEat: function (pokemon) { @@ -1399,7 +1399,7 @@ exports.BattleItems = { pokemon.eatItem(); } }, - onEatItem: function (item, pokemon) { + onTryEatItem: function (item, pokemon) { if (!this.runEvent('TryHeal', pokemon)) return false; }, onEat: function (pokemon) { @@ -1935,7 +1935,7 @@ exports.BattleItems = { pokemon.eatItem(); } }, - onEatItem: function (item, pokemon) { + onTryEatItem: function (item, pokemon) { if (!this.runEvent('TryHeal', pokemon)) return false; }, onEat: function (pokemon) { @@ -2602,7 +2602,7 @@ exports.BattleItems = { pokemon.eatItem(); } }, - onEatItem: function (item, pokemon) { + onTryEatItem: function (item, pokemon) { if (!this.runEvent('TryHeal', pokemon)) return false; }, onEat: function (pokemon) { @@ -3139,7 +3139,7 @@ exports.BattleItems = { pokemon.eatItem(); } }, - onEatItem: function (item, pokemon) { + onTryEatItem: function (item, pokemon) { if (!this.runEvent('TryHeal', pokemon)) return false; }, onEat: function (pokemon) { @@ -4107,7 +4107,7 @@ exports.BattleItems = { pokemon.eatItem(); } }, - onEatItem: function (item, pokemon) { + onTryEatItem: function (item, pokemon) { if (!this.runEvent('TryHeal', pokemon)) return false; }, onEat: function (pokemon) { @@ -4773,7 +4773,7 @@ exports.BattleItems = { pokemon.eatItem(); } }, - onEatItem: function (item, pokemon) { + onTryEatItem: function (item, pokemon) { if (!this.runEvent('TryHeal', pokemon)) return false; }, onEat: function (pokemon) { @@ -4894,7 +4894,7 @@ exports.BattleItems = { pokemon.eatItem(); } }, - onEatItem: function (item, pokemon) { + onTryEatItem: function (item, pokemon) { if (!this.runEvent('TryHeal', pokemon)) return false; }, onEat: function (pokemon) { @@ -4979,7 +4979,7 @@ exports.BattleItems = { pokemon.eatItem(); } }, - onEatItem: function (item, pokemon) { + onTryEatItem: function (item, pokemon) { if (!this.runEvent('TryHeal', pokemon)) return false; }, onEat: function (pokemon) { diff --git a/data/moves.js b/data/moves.js index 8fbf4dd223..8d2a25804c 100644 --- a/data/moves.js +++ b/data/moves.js @@ -1433,6 +1433,7 @@ exports.BattleMovedex = { if (source.hp && item.isBerry && target.takeItem(source)) { this.add('-enditem', target, item.name, '[from] stealeat', '[move] Bug Bite', '[of] ' + source); this.singleEvent('Eat', item, null, source, null, null); + this.runEvent('EatItem', source, null, null, item); source.ateBerry = true; } }, @@ -4445,6 +4446,7 @@ exports.BattleMovedex = { if (item.isBerry && item.id !== 'enigmaberry') { move.onHit = function (foe) { this.singleEvent('Eat', item, null, foe, null, null); + this.runEvent('EatItem', foe, null, null, item); foe.ateBerry = true; }; } else if (item.fling.effect) { @@ -9765,6 +9767,7 @@ exports.BattleMovedex = { if (source.hp && item.isBerry && target.takeItem(source)) { this.add('-enditem', target, item.name, '[from] stealeat', '[move] Pluck', '[of] ' + source); this.singleEvent('Eat', item, null, source, null, null); + this.runEvent('EatItem', source, null, null, item); source.ateBerry = true; } },