Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Created new method for 10% berries (Resto, Sub, etc) -
- def canConsumeDireBerry?(check_gluttony = true)
- return false if !canConsumeBerry?
- return true if @hp <= @totalhp / 10
- return true if @hp <= @totalhp / 5 && (!check_gluttony || hasActiveAbility?(:GLUTTONY))
- return false
- end
- #Resto Berry - Functions like Rest - restores HP, changes status to Sleep. When held, triggers at 10% HP. (Not sure how/if Gluttony should affect)
- #Item handler still needs to add sleep
- ItemHandlers::UseOnPokemon.add(:RESTOBERRY, proc { |item, qty, pkmn, scene|
- next pbHPItem(pkmn, pkmn.totalhp, scene)
- })
- ItemHandlers::CanUseInBattle.add(:RESTOBERRY, proc { |item, pokemon, battler, move, firstAction, battle, scene, showMessages|
- if !pokemon.able? || pokemon.hp == pokemon.totalhp
- scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
- next false
- end
- next true
- })
- #Handler still needs to add sleep,
- ItemHandlers::BattleUseOnPokemon.add(:RESTOBERRY, proc { |item, pokemon, battler, choices, scene|
- pbBattleHPItem(pokemon, battler, pokemon.totalhp, scene)
- })
- #Handler still needs to add sleep,
- Battle::ItemEffects::HPHeal.add(:RESTOBERRY,
- proc { |item, battler, battle, forced|
- next false if !battler.canHeal?
- next false if !forced && !battler.canConsumeDireBerry?(false)
- amt = battler.totalhp
- ripening = false
- if battler.hasActiveAbility?(:RIPEN)
- battle.pbShowAbilitySplash(battler, forced)
- amt *= 2
- ripening = true
- end
- battle.pbCommonAnimation("EatBerry", battler) if !forced
- battle.pbHideAbilitySplash(battler) if ripening
- battler.pbRecoverHP(amt)
- itemName = GameData::Item.get(item).name
- if forced
- PBDebug.log("[Item triggered] Forced consuming of #{itemName}")
- battle.pbDisplay(_INTL("{1}'s HP was restored.", battler.pbThis))
- else
- battle.pbDisplay(_INTL("{1} restored its health using its {2}!", battler.pbThis, itemName))
- end
- next true
- }
- )
- #Imitation Berry - When HP below 1/3, restores 1/2HP for inorganic Pokemon. Otherwise, damages. (I'm putting damage for same amount)
- #Not sure if this should still work with natural gift, be in berry pocket, have berry flag, etc. since it's imitation...
- #Need to add check for inorganic and damaging
- ItemHandlers::UseOnPokemon.add(:IMITATIONBERRY, proc { |item, qty, pkmn, scene|
- next pbHPItem(pkmn, pkmn.totalhp / 2, scene)
- })
- #Handler needs to check if Pokemon would be damaged by berry
- ItemHandlers::CanUseInBattle.add(:IMITATIONBERRY, proc { |item, pokemon, battler, move, firstAction, battle, scene, showMessages|
- if !pokemon.able? || pokemon.hp == pokemon.totalhp
- scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
- next false
- end
- next true
- })
- ItemHandlers::BattleUseOnPokemon.add(:IMITATIONBERRY, proc { |item, pokemon, battler, choices, scene|
- pbBattleHPItem(pokemon, battler, pokemon.totalhp / 2, scene)
- })
- Battle::ItemEffects::HPHeal.add(:IMITATIONBERRY,
- proc { |item, battler, battle, forced|
- next false if !battler.canHeal?
- next false if !forced && !battler.canConsumePinchBerry?(false)
- amt = battler.totalhp / 2
- ripening = false
- if battler.hasActiveAbility?(:RIPEN)
- battle.pbShowAbilitySplash(battler, forced)
- amt *= 2
- ripening = true
- end
- battle.pbCommonAnimation("EatBerry", battler) if !forced
- battle.pbHideAbilitySplash(battler) if ripening
- battler.pbRecoverHP(amt)
- itemName = GameData::Item.get(item).name
- if forced
- PBDebug.log("[Item triggered] Forced consuming of #{itemName}")
- battle.pbDisplay(_INTL("{1}'s HP was restored.", battler.pbThis))
- else
- battle.pbDisplay(_INTL("{1} restored its health using its {2}!", battler.pbThis, itemName))
- end
- next true
- }
- )
- #Rot Berry - When HP below 1/3, restores 1/2HP for Grass/Poison/Bug Pokemon. Otherwise, damages. (I'm putting damage for same amount)
- #Need to add check for type and damaging
- ItemHandlers::UseOnPokemon.add(:ROTBERRY, proc { |item, qty, pkmn, scene|
- next pbHPItem(pkmn, pkmn.totalhp / 2, scene)
- })
- #Handler needs to check if Pokemon would be damaged by berry
- ItemHandlers::CanUseInBattle.add(:ROTBERRY, proc { |item, pokemon, battler, move, firstAction, battle, scene, showMessages|
- if !pokemon.able? || pokemon.hp == pokemon.totalhp
- scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
- next false
- end
- next true
- })
- ItemHandlers::BattleUseOnPokemon.add(:ROTBERRY, proc { |item, pokemon, battler, choices, scene|
- pbBattleHPItem(pokemon, battler, pokemon.totalhp / 2, scene)
- })
- Battle::ItemEffects::HPHeal.add(:ROTBERRY,
- proc { |item, battler, battle, forced|
- next false if !battler.canHeal?
- next false if !forced && !battler.canConsumePinchBerry?(false)
- amt = battler.totalhp / 2
- ripening = false
- if battler.hasActiveAbility?(:RIPEN)
- battle.pbShowAbilitySplash(battler, forced)
- amt *= 2
- ripening = true
- end
- battle.pbCommonAnimation("EatBerry", battler) if !forced
- battle.pbHideAbilitySplash(battler) if ripening
- battler.pbRecoverHP(amt)
- itemName = GameData::Item.get(item).name
- if forced
- PBDebug.log("[Item triggered] Forced consuming of #{itemName}")
- battle.pbDisplay(_INTL("{1}'s HP was restored.", battler.pbThis))
- else
- battle.pbDisplay(_INTL("{1} restored its health using its {2}!", battler.pbThis, itemName))
- end
- next true
- }
- )
- #Nuevo Berry - full restore for HP and PP when evo conditions are met. a little tricky - have to consider pokemon without levels in their evos
- #Sub Berry - Activates at 10% HP, creates substitute doll with no HP cost
- #What if Ripen made a really strong substitute lol
- #Field use doesn't make sense bc no substitutes outside of battle, but maybe it should still be usable from the bag?
- #Handler needs to check if there's already a substitute
- ItemHandlers::CanUseInBattle.add(:SUBBERRY, proc { |item, pokemon, battler, move, firstAction, battle, scene, showMessages|
- if !pokemon.able? || pokemon.hp == pokemon.totalhp
- scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
- next false
- end
- next true
- })
- ItemHandlers::BattleUseOnPokemon.add(:SUBBERRY, proc { |item, pokemon, battler, choices, scene|
- })
- Battle::ItemEffects::HPHeal.add(:SUBBERRY,
- proc { |item, battler, battle, forced|
- next false if !forced && !battler.canConsumeDireBerry?(false)
- amt = battler.totalhp
- ripening = false
- if battler.hasActiveAbility?(:RIPEN)
- battle.pbShowAbilitySplash(battler, forced)
- amt *= 2
- ripening = true
- end
- battle.pbCommonAnimation("EatBerry", battler) if !forced
- battle.pbHideAbilitySplash(battler) if ripening
- battler.pbRecoverHP(amt)
- itemName = GameData::Item.get(item).name
- if forced
- PBDebug.log("[Item triggered] Forced consuming of #{itemName}")
- battle.pbDisplay(_INTL("{1}'s HP was restored.", battler.pbThis))
- else
- battle.pbDisplay(_INTL("{1} restored its health using its {2}!", battler.pbThis, itemName))
- end
- next true
- }
- )
- #Exp Berry - If battler faints, activates and grants Exp anyways
- #No use cases, only hold
- #Splendor Berry - makes Pokemon shiny
- ItemHandlers::UseOnPokemon.add(:SPLENDORBERRY, proc { |item, qty, pkmn, scene|
- if pkmn.shiny? == false
- pbSEPlay('Item Used', 100, 100)
- pbMessage(_INTL("The strange berry changed the color of your Pokémon!"))
- pkmn.shiny = true
- elsif pkmn.shiny? == true
- pbMessage(_INTL("It won't have any effect."))
- next false
- end
- })
- #adapted from reliccastle.com/resources/1209/
- #Keckle Berry - Activates at 25% HP, changes ability to Color Change
- #Field use doesn't make sense, but maybe it should still be usable from the bag?
- #Handler needs to check if ability is already Color Change
- ItemHandlers::CanUseInBattle.add(:KECKLEBERRY, proc { |item, pokemon, battler, move, firstAction, battle, scene, showMessages|
- if !pokemon.able? || pokemon.hp == pokemon.totalhp
- scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
- next false
- end
- next true
- })
- ItemHandlers::BattleUseOnPokemon.add(:KECKLEBERRY, proc { |item, pokemon, battler, choices, scene|
- })
- Battle::ItemEffects::HPHeal.add(:KECKLEBERRY,
- proc { |item, battler, battle, forced|
- next false if !forced && !battler.canConsumePinchBerry?(false)
- amt = battler.totalhp
- ripening = false
- if battler.hasActiveAbility?(:RIPEN)
- battle.pbShowAbilitySplash(battler, forced)
- amt *= 2
- ripening = true
- end
- battle.pbCommonAnimation("EatBerry", battler) if !forced
- battle.pbHideAbilitySplash(battler) if ripening
- battler.pbRecoverHP(amt)
- itemName = GameData::Item.get(item).name
- if forced
- PBDebug.log("[Item triggered] Forced consuming of #{itemName}")
- battle.pbDisplay(_INTL("{1}'s HP was restored.", battler.pbThis))
- else
- battle.pbDisplay(_INTL("{1} restored its health using its {2}!", battler.pbThis, itemName))
- end
- next true
- }
- )
- #Variations on this:
- #Paroom Berry - Dry Skin
- #Dragle Berry - Rough Skin
- #Alma Berry - Wonder Skin
- #Planton Berry - Shed Skin
- #Rambuka Berry - Fluffy
- #No spellings were provided for these... They mentioned anagrams of fruit?
- #Ice Berry - Ice Body
- #Clear Berry - Clear Body
- #Goo Berry - Gooey
- #Ooze Berry - Liquid Ooze
- #Thick Berry - Thick Fat
- #Carrot Berry - Compound Eyes
- #A bunch more weren't even given names:
- #Effect Spore
- #Poison Point
- #Static
- #Flame Body
- #Quick Feet
- #Guts
- #Toxic Heal
- #Should I just make a template version of this, and just tell people to Ctrl+H it?
- #Cheek Pouch
- #Harvest
- #Ripen
- #One-turn berries - I guess we could look at the SE move berries?
- Battle::ItemEffects::DamageCalcFromTarget.add(:BABIRIBERRY,
- proc { |item, user, target, move, mults, baseDmg, type|
- target.pbMoveTypeWeakeningBerry(:STEEL, type, mults)
- }
- )
- #Immunity bypass - Scrappy, Mold Breaker (those would have to be DamageCalcFromUser...
- #Stat boost berries - Simple, Contrary, Moxie, Moody
- #Pyuku Berry - Gives Innards Out/Aftermath before fainting (tbh I think it should just work on its own - that way you could even stack!)
- #Berry equivalents for Regenerator and Natural Cure
- #Immunity Herb - Allows one neutral hit when move would normally be ineffective (another DamageCalcFromUser)
- #Focus Herb - lets you retry immediately when move misses, or is blocked by protect/endure
- #Bitter Herb - Prevents critical hit/flinching
- #Amnesia Herb - Consumed when fainted. resets happiness and evs
- #Savior Herb - prevents money loss
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement