Advertisement
TechSkylander1518

PhoenixDex Abilities Handlers WIP

May 24th, 2023 (edited)
1,176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 10.30 KB | None | 0 0
  1. #Amplify - Powers up sound-based moves.
  2. AbilityEffects::DamageCalcFromUser.copy(:PUNKROCK, :AMPLIFY)
  3.  
  4. #Benevolence - The Pokémon and its allies restore a little HP each turn.
  5. Battle::AbilityEffects::EndOfRoundHealing.add(:BENEVOLENCE,
  6.   proc { |ability, battler, battle|
  7.     team = battler.allAllies
  8.     team.push(battler)
  9.     team.each do |b|
  10.       heal = true if b.canHeal? && (b.near?(battler) || b == battler)
  11.     end
  12.     if heal == true
  13.         battle.pbShowAbilitySplash(battler)
  14.         team.each do |b|
  15.           next if !b.canHeal? || !b.near?(battler)
  16.           b.pbRecoverHP(b.totalhp / 16)
  17.         end
  18.       battle.pbDisplay(_INTL("{1}'s {2} restored its team's HP!", battler.pbThis, battler.abilityName))
  19.       battle.pbHideAbilitySplash(battler)
  20.     end
  21.   }
  22. )
  23.  
  24. #Bombardier - Powers up ball and bomb moves.
  25. Battle::AbilityEffects::DamageCalcFromUser.add(:BOMBARDIER,
  26.   proc { |ability, user, target, move, mults, baseDmg, type|
  27.     mults[:attack_multiplier] *= 1.3 if move.bombMove?
  28.   }
  29. )
  30.  
  31. #Cast Off - Restores the Pokémon's lost stats at the end of the turn.
  32. Battle::AbilityEffects::EndOfRoundEffect.add(:CASTOFF,
  33.   proc { |ability, battler, battle|
  34.     if battler.hasLoweredStatStages?
  35.       GameData::Stat.each_battle { |s| battler.stages[s.id] = 0 if battler.stages[s.id] < 0 }
  36.     end
  37.     battle.pbDisplay(_INTL("{1}'s {2} restored its lowered stats!", battler.pbThis, battler.abilityName))
  38.   }
  39. )
  40.  
  41. # Cursed Fangs - Bites from this Pokémon spread this ability.
  42. Battle::AbilityEffects::OnDealingHit.add(:CURSEDFANGS,
  43.   proc { |ability, user, target, move, battle|
  44.     next if !move.bitingMove?
  45.     next if target.fainted?
  46.     next if target.unstoppableAbility? || target.ability == ability
  47.     oldAbil = nil
  48.     battle.pbShowAbilitySplash(target) if target.opposes?(user)
  49.     if target.affectedByContactEffect?(Battle::Scene::USE_ABILITY_SPLASH)
  50.       oldAbil = target.ability
  51.       battle.pbShowAbilitySplash(target, true, false) if target.opposes?(user)
  52.       target.ability = ability
  53.       battle.pbReplaceAbilitySplash(target) if target.opposes?(user)
  54.       if Battle::Scene::USE_ABILITY_SPLASH
  55.         battle.pbDisplay(_INTL("{1}'s Ability became {2}!", target.pbThis, target.abilityName))
  56.       else
  57.         battle.pbDisplay(_INTL("{1}'s Ability became {2} because of {3}!",
  58.            target.pbThis, target.abilityName, user.pbThis(true)))
  59.       end
  60.       battle.pbHideAbilitySplash(target) if target.opposes?(user)
  61.     end
  62.     battle.pbHideAbilitySplash(user) if target.opposes?(user)
  63.     target.pbOnLosingAbility(oldAbil)
  64.     target.pbTriggerAbilityOnGainingIt
  65.   }
  66. )
  67.  
  68. #Diabolate - Normal-type moves become Dark-type moves.
  69. Battle::AbilityEffects::ModifyMoveBaseType.add(:DIABOLATE,
  70.   proc { |ability, user, move, type|
  71.     next if type != :NORMAL || !GameData::Type.exists?(:DARK)
  72.     move.powerBoost = true
  73.     next :DARK
  74.   }
  75. )
  76. Battle::AbilityEffects::DamageCalcFromUser.copy(:AERILATE, :DIABOLATE)
  77.  
  78. #Draft Rider - Boosts the Speed stat when it’s hit by a Flying-type move.
  79. Battle::AbilityEffects::OnBeingHit.add(:DRAFTRIDER,
  80.   proc { |ability, user, target, move, battle|
  81.     next if ![:FLYING].include?(move.calcType)
  82.     target.pbRaiseStatStageByAbility(:SPEED, 1, target)
  83.   }
  84. )
  85.  
  86. #Eclipse Veil -  Boosts the Pokémon's evasion when it enters a battle.
  87. #On the turn this Pokémon enters battle, including the very first turn of battle, this Pokémon has 1.5× its evasion. Its evasion returns to normal at the end of that turn.
  88. #The evasion bonus does not count as a stat modifier.
  89. Battle::AbilityEffects::AccuracyCalcFromTarget.add(:ECLIPSEVEIL,
  90.   proc { |ability, mods, user, target, move, type|
  91.     mods[:evasion_multiplier] *= 1.5 if target.turnCount < 1
  92.   }
  93. )
  94.  
  95. #Fighting Spirit - Powers up Fighting-type moves when the Pokémon is in trouble.
  96. Battle::AbilityEffects::DamageCalcFromUser.add(:FIGHTINGSPIRIT,
  97.   proc { |ability, user, target, move, mults, baseDmg, type|
  98.     if user.hp <= user.totalhp / 3 && type == :FIGHTING
  99.       mults[:attack_multiplier] *= 1.5
  100.     end
  101.   }
  102. )
  103.  
  104. #Frozen Armor - Boosts the Defense stat when hit by an Ice-type move.
  105. Battle::AbilityEffects::MoveImmunity.add(:FROZENARMOR,
  106.   proc { |ability, user, target, move, type, battle, show_message|
  107.     next target.pbMoveImmunityStatRaisingAbility(user, move, type,
  108.        :ICE, :DEFENSE, 2, show_message)
  109.   }
  110. )
  111.  
  112. #Gas Guzzler - Doubles the Pokémon’s Speed stat in Miasma Terrain.
  113. Battle::AbilityEffects::SpeedCalc.add(:GASGUZZLER,
  114.   proc { |ability, battler, mult|
  115.     next mult * 2 if battler.battle.field.terrain == :Miasma
  116.   }
  117. )
  118.  
  119. #Grass Cloak - Boosts evasion in Grassy Terrain.
  120. Battle::AbilityEffects::AccuracyCalcFromTarget.add(:GRASSCLOAK,
  121.   proc { |ability, mods, user, target, move, type|
  122.     mods[:evasion_multiplier] *= 1.25 if user.battle.field.terrain == :Grassy
  123.   }
  124. )
  125.  
  126.  
  127. #Heat Wall - Evaporates Water-type moves aimed at this Pokémon's team.
  128. Battle::AbilityEffects::MoveImmunity.add(:HEATWALL,
  129.   proc { |ability, user, target, move, type, battle, show_message|
  130.     next false if type != :WATER
  131.     if show_message
  132.       battle.pbShowAbilitySplash(target)
  133.       if Battle::Scene::USE_ABILITY_SPLASH
  134.         battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true)))
  135.       else
  136.         battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",
  137.            target.pbThis, target.abilityName, move.name))
  138.       end
  139.       battle.pbHideAbilitySplash(target)
  140.     end
  141.     next true
  142.   }
  143. )
  144. Battle::AbilityEffects::DamageCalcFromTargetAlly.add(:HEATWALL,
  145.   proc { |ability, user, target, move, mults, baseDmg, type|
  146.     mults[:defense_multiplier] *= 1.5 if type == :WATER
  147.   }
  148. )
  149.  
  150. # Indomitable - Restores the Pokémon's lost stats at the end of the turn.
  151. AbilityEffects::EndOfRoundEffect.copy(:CASTOFF, :INDOMITABLE)
  152.  
  153. # Last-Ditch - Powers up Dark-type moves when the Pokémon is in trouble.
  154. Battle::AbilityEffects::DamageCalcFromUser.add(:LASTDITCH,
  155.   proc { |ability, user, target, move, mults, baseDmg, type|
  156.     if user.hp <= user.totalhp / 3 && type == :DARK
  157.       mults[:attack_multiplier] *= 1.5
  158.     end
  159.   }
  160. )
  161.  
  162. #Lucky Shot -  Boosts the Attack and Special Attack stats, but lowers accuracy.
  163. Battle::AbilityEffects::AccuracyCalcFromUser.add(:LUCKYSHOT,
  164.   proc { |ability, mods, user, target, move, type|
  165.     mods[:accuracy_multiplier] *= 0.8
  166.   }
  167. )
  168. Battle::AbilityEffects::DamageCalcFromUser.add(:LUCKYSHOT,
  169.   proc { |ability, user, target, move, mults, baseDmg, type|
  170.     mults[:attack_multiplier] *= 1.3
  171.   }
  172. )
  173.  
  174.  
  175. #Miasma Surge - Turns the ground into Miasma Terrain when the Pokémon enters a battle.
  176. Battle::AbilityEffects::OnSwitchIn.add(:MIASMASURGE,
  177.   proc { |ability, battler, battle, switch_in|
  178.     next if battle.field.terrain == :Miasma
  179.     battle.pbShowAbilitySplash(battler)
  180.     battle.pbStartTerrain(battler, :Miasma)
  181.     # NOTE: The ability splash is hidden again in def pbStartTerrain.
  182.   }
  183. )
  184.  
  185. #Need to get the calculation still
  186. #Nine Curses - Special Attacks do more damage the more the Pokémon has been harmed.
  187. Battle::AbilityEffects::DamageCalcFromUser.add(:NINECURSES,
  188.   proc { |ability, user, target, move, mults, baseDmg, type|
  189.     if move.specialMove?
  190.       mults[:attack_multiplier] *= 1.5
  191.     end
  192.   }
  193. )
  194.  
  195.  
  196. #Play Dead - Gives full immunity to all Normal- and Fighting-type moves.
  197. Battle::AbilityEffects::MoveImmunity.add(:PLAYDEAD,
  198.   proc { |ability, user, target, move, type, battle, show_message|
  199.     next false if ![:NORMAL,:FIGHTING].include?(type) || user.hasActiveAbility?(:SCRAPPY)
  200.     if show_message
  201.       battle.pbShowAbilitySplash(target)
  202.       if Battle::Scene::USE_ABILITY_SPLASH
  203.         battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true)))
  204.       else
  205.         battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",
  206.            target.pbThis, target.abilityName, move.name))
  207.       end
  208.       battle.pbHideAbilitySplash(target)
  209.     end
  210.     next true
  211.   }
  212. )
  213.  
  214. #Ravenous -  Greedily steals the target’s energy with a bite.
  215. Battle::AbilityEffects::OnEndOfUsingMove.add(:RAVENOUS,
  216.   proc { |ability, user, targets, move, battle|
  217.     next if !user.canHeal?
  218.     next if !move.bitingMove?
  219.     targets.each { |b|
  220.         hpGain = (b.damageState.hpLost / 4.0).round
  221.         user.pbRecoverHPFromDrain(hpGain, b)
  222.     }
  223.   }
  224. )
  225.  
  226. #Reverberate - The Pokémon makes harmful sound waves echo back at attackers.
  227.  
  228. Battle::AbilityEffects::OnBeingHit.add(:REVERBERATE,
  229.   proc { |ability, user, target, move, battle|
  230.     next if !move.soundMove?
  231.     battle.pbShowAbilitySplash(target)
  232.     if user.takesSoundDamage?(Battle::Scene::USE_ABILITY_SPLASH) &&
  233.        user.takesIndirectDamage?(Battle::Scene::USE_ABILITY_SPLASH)
  234.       battle.scene.pbDamageAnimation(user)
  235.       user.pbReduceHP(user.totalhp / 4, false)
  236.       if Battle::Scene::USE_ABILITY_SPLASH
  237.         battle.pbDisplay(_INTL("{1} was hurt by the reverberation!", user.pbThis))
  238.       else
  239.         battle.pbDisplay(_INTL("{1} is hurt by {2}'s {3}!", user.pbThis,
  240.            target.pbThis(true), target.abilityName))
  241.       end
  242.     end
  243.     battle.pbHideAbilitySplash(target)
  244.   }
  245. )
  246.  
  247. #Solar Boost - Boosts the Pokémon’s Speed stat in sunshine.
  248. AbilityEffects::DamageCalcFromUser.copy(:CHLOROPHYLL, :SOLARBOOST)
  249.  
  250. #Spirit Call -  Draws in all Ghost-type moves to boost its Sp. Atk stat.
  251. Battle::AbilityEffects::MoveImmunity.add(:SPIRITCALL,
  252.   proc { |ability, user, target, move, type, battle, show_message|
  253.     next target.pbMoveImmunityStatRaisingAbility(user, move, type,
  254.        :GHOST, :SPECIAL_ATTACK, 1, show_message)
  255.   }
  256. )
  257. Battle::AbilityEffects::AccuracyCalcFromTarget.add(:SPIRITCALL,
  258.   proc { |ability, mods, user, target, move, type|
  259.     mods[:base_accuracy] = 0 if type == :GHOST
  260.   }
  261. )
  262.  
  263. # Steam Cloud - Boosts the Pokémon's evasion when it enters a battle.
  264. Battle::AbilityEffects::AccuracyCalcFromTarget.copy(:ECLIPSEVEIL, :STEAMCLOUD)
  265.  
  266. #Streamlined - Boosts resistance to Flying- and Water-type moves.
  267. Battle::AbilityEffects::DamageCalcFromTarget.add(:STREAMLINED,
  268.   proc { |ability, user, target, move, mults, baseDmg, type|
  269.     mults[:base_damage_multiplier] /= 2 if [:WATER, :FLYING].include?(type)
  270.   }
  271. )
  272.  
  273. #Third Eye - Powers up Psychic-type moves when the Pokémon is in trouble.
  274. Battle::AbilityEffects::DamageCalcFromUser.add(:THIRDEYE,
  275.   proc { |ability, user, target, move, mults, baseDmg, type|
  276.     if user.hp <= user.totalhp / 3 && type == :PSYCHIC
  277.       mults[:attack_multiplier] *= 1.5
  278.     end
  279.   }
  280. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement