Advertisement
Sonicover

Vampirism code

May 7th, 2024
808
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.68 KB | None | 0 0
  1. #==================================================
  2. # Add an OnDealingHit handler to apply the healing
  3. Battle::AbilityEffects::OnDealingHit.add(:VAMPIRISM,
  4.   proc { |ability, user, targets, move, battle|
  5.     # Apply healing to the user
  6.     next if !move.bitingMove?
  7.     next if !user.canHeal?
  8.     heal = (targets.damageState.hpLost / 2)
  9.     next if heal <= 0
  10.     battle.pbShowAbilitySplash(user)
  11.     user.pbRecoverHP(heal)
  12.     if Battle::Scene::USE_ABILITY_SPLASH
  13.         battle.pbDisplay(_INTL("{1}'s stole some health!", user.pbThis))
  14.       else
  15.         battle.pbDisplay(_INTL("{1}'s {2} recovers it a bit!", user.pbThis,
  16.           user.abilityName))
  17.     end
  18.     battle.pbHideAbilitySplash(user)
  19.   }
  20. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement