Advertisement
TechSkylander1518

Substitube Berry Concepts Essentials v20 WIP

May 24th, 2023 (edited)
1,019
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 10.55 KB | None | 0 0
  1. #Created new method for 10% berries (Resto, Sub, etc) -
  2.   def canConsumeDireBerry?(check_gluttony = true)
  3.     return false if !canConsumeBerry?
  4.     return true if @hp <= @totalhp / 10
  5.     return true if @hp <= @totalhp / 5 && (!check_gluttony || hasActiveAbility?(:GLUTTONY))
  6.     return false
  7.   end
  8.  
  9. #Resto Berry - Functions like Rest - restores HP, changes status to Sleep. When held, triggers at 10% HP. (Not sure how/if Gluttony should affect)
  10. #Item handler still needs to add sleep
  11. ItemHandlers::UseOnPokemon.add(:RESTOBERRY, proc { |item, qty, pkmn, scene|
  12.   next pbHPItem(pkmn, pkmn.totalhp, scene)
  13. })
  14. ItemHandlers::CanUseInBattle.add(:RESTOBERRY, proc { |item, pokemon, battler, move, firstAction, battle, scene, showMessages|
  15.   if !pokemon.able? || pokemon.hp == pokemon.totalhp
  16.     scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
  17.     next false
  18.   end
  19.   next true
  20. })
  21. #Handler still needs to add sleep,
  22. ItemHandlers::BattleUseOnPokemon.add(:RESTOBERRY, proc { |item, pokemon, battler, choices, scene|
  23.   pbBattleHPItem(pokemon, battler, pokemon.totalhp, scene)
  24. })
  25. #Handler still needs to add sleep,
  26. Battle::ItemEffects::HPHeal.add(:RESTOBERRY,
  27.   proc { |item, battler, battle, forced|
  28.     next false if !battler.canHeal?
  29.     next false if !forced && !battler.canConsumeDireBerry?(false)
  30.     amt = battler.totalhp
  31.     ripening = false
  32.     if battler.hasActiveAbility?(:RIPEN)
  33.       battle.pbShowAbilitySplash(battler, forced)
  34.       amt *= 2
  35.       ripening = true
  36.     end
  37.     battle.pbCommonAnimation("EatBerry", battler) if !forced
  38.     battle.pbHideAbilitySplash(battler) if ripening
  39.     battler.pbRecoverHP(amt)
  40.     itemName = GameData::Item.get(item).name
  41.     if forced
  42.       PBDebug.log("[Item triggered] Forced consuming of #{itemName}")
  43.       battle.pbDisplay(_INTL("{1}'s HP was restored.", battler.pbThis))
  44.     else
  45.       battle.pbDisplay(_INTL("{1} restored its health using its {2}!", battler.pbThis, itemName))
  46.     end
  47.     next true
  48.   }
  49. )
  50. #Imitation Berry - When HP below 1/3, restores 1/2HP for inorganic Pokemon. Otherwise, damages. (I'm putting damage for same amount)
  51. #Not sure if this should still work with natural gift, be in berry pocket, have berry flag, etc. since it's imitation...
  52. #Need to add check for inorganic and damaging
  53. ItemHandlers::UseOnPokemon.add(:IMITATIONBERRY, proc { |item, qty, pkmn, scene|
  54.   next pbHPItem(pkmn, pkmn.totalhp / 2, scene)
  55. })
  56. #Handler needs to check if Pokemon would be damaged by berry
  57. ItemHandlers::CanUseInBattle.add(:IMITATIONBERRY, proc { |item, pokemon, battler, move, firstAction, battle, scene, showMessages|
  58.   if !pokemon.able? || pokemon.hp == pokemon.totalhp
  59.     scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
  60.     next false
  61.   end
  62.   next true
  63. })
  64. ItemHandlers::BattleUseOnPokemon.add(:IMITATIONBERRY, proc { |item, pokemon, battler, choices, scene|
  65.   pbBattleHPItem(pokemon, battler, pokemon.totalhp / 2, scene)
  66. })
  67. Battle::ItemEffects::HPHeal.add(:IMITATIONBERRY,
  68.   proc { |item, battler, battle, forced|
  69.     next false if !battler.canHeal?
  70.     next false if !forced && !battler.canConsumePinchBerry?(false)
  71.     amt = battler.totalhp / 2
  72.     ripening = false
  73.     if battler.hasActiveAbility?(:RIPEN)
  74.       battle.pbShowAbilitySplash(battler, forced)
  75.       amt *= 2
  76.       ripening = true
  77.     end
  78.     battle.pbCommonAnimation("EatBerry", battler) if !forced
  79.     battle.pbHideAbilitySplash(battler) if ripening
  80.     battler.pbRecoverHP(amt)
  81.     itemName = GameData::Item.get(item).name
  82.     if forced
  83.       PBDebug.log("[Item triggered] Forced consuming of #{itemName}")
  84.       battle.pbDisplay(_INTL("{1}'s HP was restored.", battler.pbThis))
  85.     else
  86.       battle.pbDisplay(_INTL("{1} restored its health using its {2}!", battler.pbThis, itemName))
  87.     end
  88.     next true
  89.   }
  90. )
  91. #Rot Berry - When HP below 1/3, restores 1/2HP for Grass/Poison/Bug Pokemon. Otherwise, damages. (I'm putting damage for same amount)
  92. #Need to add check for type and damaging
  93. ItemHandlers::UseOnPokemon.add(:ROTBERRY, proc { |item, qty, pkmn, scene|
  94.   next pbHPItem(pkmn, pkmn.totalhp / 2, scene)
  95. })
  96. #Handler needs to check if Pokemon would be damaged by berry
  97. ItemHandlers::CanUseInBattle.add(:ROTBERRY, proc { |item, pokemon, battler, move, firstAction, battle, scene, showMessages|
  98.   if !pokemon.able? || pokemon.hp == pokemon.totalhp
  99.     scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
  100.     next false
  101.   end
  102.   next true
  103. })
  104. ItemHandlers::BattleUseOnPokemon.add(:ROTBERRY, proc { |item, pokemon, battler, choices, scene|
  105.   pbBattleHPItem(pokemon, battler, pokemon.totalhp / 2, scene)
  106. })
  107. Battle::ItemEffects::HPHeal.add(:ROTBERRY,
  108.   proc { |item, battler, battle, forced|
  109.     next false if !battler.canHeal?
  110.     next false if !forced && !battler.canConsumePinchBerry?(false)
  111.     amt = battler.totalhp / 2
  112.     ripening = false
  113.     if battler.hasActiveAbility?(:RIPEN)
  114.       battle.pbShowAbilitySplash(battler, forced)
  115.       amt *= 2
  116.       ripening = true
  117.     end
  118.     battle.pbCommonAnimation("EatBerry", battler) if !forced
  119.     battle.pbHideAbilitySplash(battler) if ripening
  120.     battler.pbRecoverHP(amt)
  121.     itemName = GameData::Item.get(item).name
  122.     if forced
  123.       PBDebug.log("[Item triggered] Forced consuming of #{itemName}")
  124.       battle.pbDisplay(_INTL("{1}'s HP was restored.", battler.pbThis))
  125.     else
  126.       battle.pbDisplay(_INTL("{1} restored its health using its {2}!", battler.pbThis, itemName))
  127.     end
  128.     next true
  129.   }
  130. )
  131. #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
  132. #Sub Berry - Activates at 10% HP, creates substitute doll with no HP cost
  133. #What if Ripen made a really strong substitute lol
  134. #Field use doesn't make sense bc no substitutes outside of battle, but maybe it should still be usable from the bag?
  135. #Handler needs to check if there's already a substitute
  136. ItemHandlers::CanUseInBattle.add(:SUBBERRY, proc { |item, pokemon, battler, move, firstAction, battle, scene, showMessages|
  137.   if !pokemon.able? || pokemon.hp == pokemon.totalhp
  138.     scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
  139.     next false
  140.   end
  141.   next true
  142. })
  143. ItemHandlers::BattleUseOnPokemon.add(:SUBBERRY, proc { |item, pokemon, battler, choices, scene|
  144.    
  145. })
  146. Battle::ItemEffects::HPHeal.add(:SUBBERRY,
  147.   proc { |item, battler, battle, forced|
  148.     next false if !forced && !battler.canConsumeDireBerry?(false)
  149.     amt = battler.totalhp
  150.     ripening = false
  151.     if battler.hasActiveAbility?(:RIPEN)
  152.       battle.pbShowAbilitySplash(battler, forced)
  153.       amt *= 2
  154.       ripening = true
  155.     end
  156.     battle.pbCommonAnimation("EatBerry", battler) if !forced
  157.     battle.pbHideAbilitySplash(battler) if ripening
  158.     battler.pbRecoverHP(amt)
  159.     itemName = GameData::Item.get(item).name
  160.     if forced
  161.       PBDebug.log("[Item triggered] Forced consuming of #{itemName}")
  162.       battle.pbDisplay(_INTL("{1}'s HP was restored.", battler.pbThis))
  163.     else
  164.       battle.pbDisplay(_INTL("{1} restored its health using its {2}!", battler.pbThis, itemName))
  165.     end
  166.     next true
  167.   }
  168. )
  169. #Exp Berry - If battler faints, activates and grants Exp anyways
  170. #No use cases, only hold
  171. #Splendor Berry - makes Pokemon shiny
  172. ItemHandlers::UseOnPokemon.add(:SPLENDORBERRY, proc { |item, qty, pkmn, scene|
  173.   if pkmn.shiny? == false
  174.     pbSEPlay('Item Used', 100, 100)
  175.     pbMessage(_INTL("The strange berry changed the color of your Pokémon!"))
  176.     pkmn.shiny = true
  177.   elsif pkmn.shiny? == true
  178.     pbMessage(_INTL("It won't have any effect."))
  179.     next false
  180.   end
  181. })
  182. #adapted from reliccastle.com/resources/1209/
  183. #Keckle Berry - Activates at 25% HP, changes ability to Color Change
  184. #Field use doesn't make sense, but maybe it should still be usable from the bag?
  185. #Handler needs to check if ability is already Color Change
  186. ItemHandlers::CanUseInBattle.add(:KECKLEBERRY, proc { |item, pokemon, battler, move, firstAction, battle, scene, showMessages|
  187.   if !pokemon.able? || pokemon.hp == pokemon.totalhp
  188.     scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
  189.     next false
  190.   end
  191.   next true
  192. })
  193. ItemHandlers::BattleUseOnPokemon.add(:KECKLEBERRY, proc { |item, pokemon, battler, choices, scene|
  194.    
  195. })
  196. Battle::ItemEffects::HPHeal.add(:KECKLEBERRY,
  197.   proc { |item, battler, battle, forced|
  198.     next false if !forced && !battler.canConsumePinchBerry?(false)
  199.     amt = battler.totalhp
  200.     ripening = false
  201.     if battler.hasActiveAbility?(:RIPEN)
  202.       battle.pbShowAbilitySplash(battler, forced)
  203.       amt *= 2
  204.       ripening = true
  205.     end
  206.     battle.pbCommonAnimation("EatBerry", battler) if !forced
  207.     battle.pbHideAbilitySplash(battler) if ripening
  208.     battler.pbRecoverHP(amt)
  209.     itemName = GameData::Item.get(item).name
  210.     if forced
  211.       PBDebug.log("[Item triggered] Forced consuming of #{itemName}")
  212.       battle.pbDisplay(_INTL("{1}'s HP was restored.", battler.pbThis))
  213.     else
  214.       battle.pbDisplay(_INTL("{1} restored its health using its {2}!", battler.pbThis, itemName))
  215.     end
  216.     next true
  217.   }
  218. )
  219. #Variations on this:
  220. #Paroom Berry - Dry Skin
  221. #Dragle Berry - Rough Skin
  222. #Alma Berry - Wonder Skin
  223. #Planton Berry - Shed Skin
  224. #Rambuka Berry - Fluffy
  225. #No spellings were provided for these... They mentioned anagrams of fruit?
  226. #Ice Berry - Ice Body
  227. #Clear Berry - Clear Body
  228. #Goo Berry - Gooey
  229. #Ooze Berry - Liquid Ooze
  230. #Thick Berry - Thick Fat
  231. #Carrot Berry - Compound Eyes
  232. #A bunch more weren't even given names:
  233. #Effect Spore
  234. #Poison Point
  235. #Static
  236. #Flame Body
  237. #Quick Feet
  238. #Guts
  239. #Toxic Heal
  240. #Should I just make a template version of this, and just tell people to Ctrl+H it?
  241. #Cheek Pouch
  242. #Harvest
  243. #Ripen
  244.  
  245. #One-turn berries - I guess we could look at the SE move berries?
  246. Battle::ItemEffects::DamageCalcFromTarget.add(:BABIRIBERRY,
  247.   proc { |item, user, target, move, mults, baseDmg, type|
  248.     target.pbMoveTypeWeakeningBerry(:STEEL, type, mults)
  249.   }
  250. )
  251. #Immunity bypass - Scrappy, Mold Breaker (those would have to be DamageCalcFromUser...
  252. #Stat boost berries - Simple, Contrary, Moxie, Moody
  253. #Pyuku Berry - Gives Innards Out/Aftermath before fainting (tbh I think it should just work on its own - that way you could even stack!)
  254. #Berry equivalents for Regenerator and Natural Cure
  255.  
  256. #Immunity Herb - Allows one neutral hit when move would normally be ineffective (another DamageCalcFromUser)
  257. #Focus Herb - lets you retry immediately when move misses, or is blocked by protect/endure
  258. #Bitter Herb - Prevents critical hit/flinching
  259. #Amnesia Herb - Consumed when fainted. resets happiness and evs
  260. #Savior Herb - prevents money loss
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement