diff --git a/data/mods/gen4/moves.ts b/data/mods/gen4/moves.ts index 6d9f4f320bd1..e38589fcf941 100644 --- a/data/mods/gen4/moves.ts +++ b/data/mods/gen4/moves.ts @@ -503,7 +503,32 @@ export const Moves: import('../../../sim/dex-moves').ModdedMoveDataTable = { fling: { inherit: true, onPrepareHit(target, source, move) { + if (source.ignoringItem()) return false; if (source.hasAbility('multitype')) return false; + const item = source.getItem(); + if (!this.singleEvent('TakeItem', item, source.itemState, source, source, move, item)) return false; + if (!item.fling) return false; + move.basePower = item.fling.basePower; + this.debug('BP: ' + move.basePower); + if (item.isBerry) { + move.onHit = function (foe) { + if (this.singleEvent('Eat', item, null, foe, null, null)) { + this.runEvent('EatItem', foe, null, null, item); + if (item.id === 'leppaberry') foe.staleness = 'external'; + } + if (item.onEat) foe.ateBerry = true; + }; + } else if (item.fling.effect) { + move.onHit = item.fling.effect; + } else { + if (!move.secondaries) move.secondaries = []; + if (item.fling.status) { + move.secondaries.push({status: item.fling.status}); + } else if (item.fling.volatileStatus) { + move.secondaries.push({volatileStatus: item.fling.volatileStatus}); + } + } + source.addVolatile('fling'); }, }, focuspunch: {