Advertisement
TechSkylander1518

Substitube Held Items Handlers v20 WIP

May 22nd, 2023 (edited)
1,069
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 8.79 KB | None | 0 0
  1. Battle::ItemEffects::OnBeingHit.add(:OIL,
  2.   proc { |item, user, target, move, battle|
  3.     next if move.calcType != :FIRE
  4.     next if !target.pbCanRaiseStatStage?(:SPEED, target)
  5.     battle.pbCommonAnimation("UseItem", target)
  6.     target.pbRaiseStatStageByCause(:SPEED, 1, target, target.itemName)
  7.     target.pbHeldItemTriggered(item)
  8.   }
  9. )
  10.  
  11. Battle::ItemEffects::OnBeingHit.add(:ESPSHARE,
  12.   proc { |item, user, target, move, battle|
  13.     next if move.calcType != :PSYCHIC
  14.     next if !target.pbCanRaiseStatStage?(:SPECIAL_ATTACK, target)
  15.     battle.pbCommonAnimation("UseItem", target)
  16.     target.pbRaiseStatStageByCause(:SPECIAL_ATTACK, 1, target, target.itemName)
  17.     target.pbHeldItemTriggered(item)
  18.   }
  19. )
  20.  
  21. #Beam Mirror - Reduces 3/4 damage from beam attacks, sends 1/4 damage back, consumes item
  22. #Glue Trap - on contact, holder and foe can't escape. (presumably on holder being contacted by move, and not holder attacking)
  23. #Wanna figure out an animation here
  24. #Should it be consumed?
  25. Battle::ItemEffects::OnBeingHit.add(:GLUETRAP,
  26.   proc { |item, user, target, move, battle|
  27.     next if !move.pbContactMove?(user) || !user.affectedByContactEffect?
  28. #    battle.pbCommonAnimation("UseItem", target)
  29.     target.effects[PBEffects::MeanLook] = user.index
  30.     user.effects[PBEffects::MeanLook] = target.index
  31.     battle.pbDisplay(_INTL("{1} and {2} were stuck together by the {3}!", user.pbThis, target.pbThis, target.itemName))
  32.   }
  33. )
  34. #Reset Button - on attack, ability reactivated. (on send out, like intimidate, on hit, like gooey, or end of turn, like speed boost). consumed
  35. #Not sure of triggerEndOfRoundHealing/triggerEndOfRoundWeather
  36. #Maybe double-check how Symbiosis plays with this
  37. Battle::ItemEffects::AfterMoveUseFromTarget.add(:RESETBUTTON,
  38.   proc { |item, battler, user, move, switched_battlers, battle|
  39.     battle.pbCommonAnimation("UseItem", battler)
  40.     battle.pbDisplay(_INTL("{1}'s {2} activated!", battler.pbThis, battler.itemName))
  41.     battler.pbConsumeItem(true, false)
  42.     Battle::AbilityEffects.triggerOnSwitchIn(battler.ability, battler, battle, false)
  43.     Battle::AbilityEffects.triggerOnBeingHit(battler.ability, user, battler, move, battle)
  44.     Battle::AbilityEffects.triggerEndOfRoundEffect(battler.ability, battler, battle)
  45.   }
  46. )
  47. #Magic Balloon - Gives Psychic or Fairy type until holder is attacked, where it'll pop
  48. #Water Balloon - Gives Water type when pops
  49. #Not sure why Symbiosis works like this but that's how Air Balloon is set up
  50. #May revisit fling
  51. Battle::ItemEffects::OnBeingHit.add(:WATERBALLOON,
  52.   proc { |item, user, target, move, battle|
  53.     battle.pbDisplay(_INTL("{1}'s {2} burst! It's soaking wet!", target.pbThis, target.itemName))
  54.     target.pbChangeTypes(:WATER)
  55.     target.pbConsumeItem(false, true)
  56.     target.pbSymbiosis
  57.   }
  58. )
  59. #Dirty Balloon - POison
  60. #Fertilizer - Grass
  61. #Sand Bag - Ground
  62. #Party Hat - any move that would be cured by mental herb becomes random stat boost instead
  63. #Dunce Cap - Any status ailment (not clear if nonvolatile or not) becomes confusion
  64. #Rebreather - prevents secondary poison
  65. #Rubber Stamp - prevents secondary paralyze
  66. #Chill Patch - prevents secondary burn
  67. #Thaw Patch - prevents secondary freeze
  68. #Buzz Band - prevents secondary sleep
  69. #Starry Band - prevents confusion
  70. #Chastity Knot - prevents attraction
  71. #Hall Pass - prevents entrapment and pursuit
  72. #Harness - prevents "phasing"?
  73. #Chain Mail - immune to crits
  74. Battle::ItemEffects::CriticalCalcFromTarget.add(:CHAINMAIL,
  75.   proc { |item, user, target, c|
  76.     next -1
  77.   }
  78. )
  79. #Talisman - prevents Destiny Bond, Perish Song, Curse
  80. #Siege Vest - halves damage from weakness (like Filter/Solid Rock), prevents switching and/or healing
  81. #Substitube likened this to Solid Rock/Filter, but said it would reduce by half? (Those abilities only reduce by 1/4)
  82. #If you want half, just change 0.75 to 0.5
  83. Battle::ItemEffects::DamageCalcFromTarget.add(:SIEGEVEST,
  84.   proc { |item, user, target, move, mults, baseDmg, type|
  85.     if Effectiveness.super_effective?(target.damageState.typeMod)
  86.       mults[:final_damage_multiplier] *= 0.75
  87.     end
  88.   }
  89. )
  90. #To prevent healing:
  91. #Battle_Battler, this section:
  92.   def canHeal?
  93.     return false if fainted? || @hp >= @totalhp
  94.     return false if @effects[PBEffects::HealBlock] > 0
  95.     return true
  96.   end
  97. #add condition to check for Siege Vest, like so:
  98.   def canHeal?
  99.     return false if fainted? || @hp >= @totalhp
  100.     return false if @effects[PBEffects::HealBlock] > 0
  101.     return false if hasActiveItem?(:SIEGEVEST)
  102.     return true
  103.   end
  104.  
  105. #Tactical Vest - Min/max variance is always maxed
  106. #in Move_UsageCalculations
  107.     # Random variance
  108.     if !self.is_a?(Battle::Move::Confusion)
  109.       random = 85 + @battle.pbRandom(16)
  110.       multipliers[:final_damage_multiplier] *= random / 100.0
  111.     end
  112.     # Random variance
  113.     if !self.is_a?(Battle::Move::Confusion)
  114.       random = 85 + @battle.pbRandom(16)
  115.       random = 100 if user.hasActiveItem?(:TACTICALVEST) || target.hasActiveItem?(:TACTICALVEST)
  116.       multipliers[:final_damage_multiplier] *= random / 100.0
  117.     end
  118.  
  119. #Ammo Belt - extra hit on multistrike moves
  120. #I think the best way would be to go to Battler_UseMove, and under these lines:
  121.       # Get the number of hits
  122.       numHits = move.pbNumHits(user, targets)
  123. #add
  124.       numHits += 1 if numHits>1 && user.hasActiveItem?(:AMMOBELT)
  125. #Blast Powder - boosts explosion and selfdestruct damage (doubled)
  126.  
  127. Battle::ItemEffects::DamageCalcFromUser.add(:BLASTPOWDER,
  128.   proc { |item, user, target, move, mults, baseDmg, type|
  129.     next if !move.function == "UserFaintsExplosive"
  130.     battle.pbDisplay(_INTL("The {1} strengthened the attack!", user.itemName))
  131.     mults[:base_damage_multiplier] *= 2
  132.   }
  133. )
  134.  
  135. #Padded Helmet - item form of Rock Head
  136. #In Move_BaseEffects, find this line:
  137.     return if user.hasActiveAbility?(:ROCKHEAD)
  138. #Change it to:
  139.     return if user.hasActiveAbility?(:ROCKHEAD) || user.hasActiveItem?(:PADDEDHELMET)
  140. #Metal Grin - boosts biting moves
  141. Battle::ItemEffects::DamageCalcFromUser.add(:METALGRIN,
  142.   proc { |item, user, target, move, mults, baseDmg, type|
  143.     mults[:base_damage_multiplier] *= 1.5 if move.bitingMove?
  144.   }
  145. )
  146. #Hidden Glyph - boosts Hidden Power (specific amt not mentioned)
  147. Battle::ItemEffects::DamageCalcFromUser.add(:HIDDENGLYPH,
  148.   proc { |item, user, target, move, mults, baseDmg, type|
  149.     next if !move.id == :HIDDENPOWER
  150.     battle.pbDisplay(_INTL("The {1} strengthened the attack!", user.itemName))
  151.     mults[:base_damage_multiplier] *= 2
  152.   }
  153. )
  154. #Burden Glyph - boosts HM moves except for Surf and Waterfall, doubles stat effects of Flash/Defog
  155. #Still need double stat effects
  156. Battle::ItemEffects::DamageCalcFromUser.add(:BURDENGLYPH,
  157.   proc { |item, user, target, move, mults, baseDmg, type|
  158.     #battle.pbDisplay(_INTL("The {1} strengthened the attack!", user.itemName))
  159.     mults[:base_damage_multiplier] *= 2 if HiddenMoveHandlers.hasHandler(move.id)
  160.   }
  161. )
  162. #Jingle Bells - Deer Pokemon (should be flag added to swords of justice, Deerling line, Stantler line, Xerneas, Calyrex, Ting-Lu) levitate in Hail and aren't affected by Hail damage
  163. #Battle_Battler:
  164.   def airborne?
  165.     return false if hasActiveItem?(:IRONBALL)
  166.     return false if @effects[PBEffects::Ingrain]
  167.     return false if @effects[PBEffects::SmackDown]
  168.     return false if @battle.field.effects[PBEffects::Gravity] > 0
  169.     return true if pbHasType?(:FLYING)
  170.     return true if hasActiveAbility?(:LEVITATE) && !@battle.moldBreaker
  171.     return true if hasActiveItem?(:AIRBALLOON)
  172.     return true if @effects[PBEffects::MagnetRise] > 0
  173.     return true if @effects[PBEffects::Telekinesis] > 0
  174.     return false
  175.   end
  176. #Add check for Jingle Bells and Deer flag
  177.     return true if hasActiveItem?(:JINGLEBELLS) && @pokemon.species_data.has_flag?("Deer")
  178. #Do the same for takesHailDamage?
  179.   def takesHailDamage?
  180.     return false if !takesIndirectDamage?
  181.     return false if pbHasType?(:ICE)
  182.     return false if inTwoTurnAttack?("TwoTurnAttackInvulnerableUnderground",
  183.                                      "TwoTurnAttackInvulnerableUnderwater")
  184.     return false if hasActiveAbility?([:OVERCOAT, :ICEBODY, :SNOWCLOAK])
  185.     return false if hasActiveItem?(:SAFETYGOGGLES)
  186.     return true
  187.   end
  188.     return false if hasActiveItem?(:JINGLEBELLS) && @pokemon.species_data.has_flag?("Deer")
  189.  
  190. Battle::ItemEffects::OnSwitchIn.add(:JINGLEBELLS,
  191.   proc { |item, battler, battle|
  192.     next unless battler.pokemon.species_data.has_flag?("Deer")
  193.     battle.pbDisplay(_INTL("{1} floats in the air with its {2}!",
  194.        battler.pbThis, battler.itemName))
  195.   }
  196. )
  197.  
  198.  
  199. #Neverstone - Ignores abilities
  200. #Handy Cap - increased rate of incoming crits
  201. Battle::ItemEffects::CriticalCalcFromTarget.add(:HANDYCAP,
  202.   proc { |item, user, target, c|
  203.     next c + 1
  204.   }
  205. )
  206. #Singolite - raises all non-HP stats equally until BST is 530. Can't be part of evo line, can't have BST over 500.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement