Fix Cheek Pouch (#2497)

* Cheek pouch triggers after berry effect
* Cheek pouch triggers on Fling, Bug Bite, and Pluck
This commit is contained in:
alex-taxiera 2016-04-08 23:37:01 -04:00 committed by Marty-D
parent 76afe40909
commit 9b66ba25d3
4 changed files with 16 additions and 12 deletions

View File

@ -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 = '';

View File

@ -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,

View File

@ -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) {

View File

@ -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;
}
},