Got it working, decided to nerf it a bit. Checks for liquid ooze, heal block, and if the user is holding big root!
#Heal user for 1/8th damage dealt when using bite moves
module Battle
module Effects
class Ability
class Vampirism < Ability
def on_post_damage(handler, hp, target, launcher, skill)
new_hp = (hp/8).floor.clamp(1, Float::INFINITY) #Sets it to a minimum of 1
new_hp = new_hp*130/100 if(launcher.item_db_symbol == :big_root) #Big root check
log_data("Launcher item DB symbol: #{launcher.item_db_symbol}")
log_data("Target item DB symbol: #{target.item_db_symbol}")
log_data("Damage = #{hp} new_hp = #{new_hp}")
log_data("Bite move: #{skill&.bite?}")
log_data("Heal block effect: #{launcher.effects.has?(:heal_block)}")
return unless skill&.bite? && target != @target && !launcher.effects.has?(:heal_block) #Heal block check
handler.scene.visual.show_ability(launcher) #Shows that vampirism activated
if (target.ability_db_symbol == :liquid_ooze) #Liquid ooze check
handler.scene.visual.show_ability(target) #Shows that liquid ooze activated
handler.damage_change(new_hp, launcher, launcher, nil) #Damages user
else
handler.logic.damage_handler.heal(launcher, new_hp) #Heals user
end
end
#In case they die, you'll still heal
def on_post_damage_death(handler, hp, target, launcher, skill)
new_hp = (hp/8).floor.clamp(1, Float::INFINITY) #Sets it to a minimum of 1
new_hp = new_hp*130/100 if(launcher.item_db_symbol == :big_root) #Big root check
log_data("Launcher item DB symbol: #{launcher.item_db_symbol}")
log_data("Target item DB symbol: #{target.item_db_symbol}")
log_data("Damage = #{hp} new_hp = #{new_hp}")
log_data("Bite move: #{skill&.bite?}")
log_data("Heal block effect: #{launcher.effects.has?(:heal_block)}")
return unless skill&.bite? && target != @target && !launcher.effects.has?(:heal_block) #Heal block check
handler.scene.visual.show_ability(launcher) #Shows that vampirism activated
if (target.ability_db_symbol == :liquid_ooze) #Liquid ooze check
handler.scene.visual.show_ability(target) #Shows that liquid ooze activated
handler.damage_change(new_hp, launcher, launcher, nil) #Damages user
else
handler.logic.damage_handler.heal(launcher, new_hp) #Heals user
end
end
end
register(:vampirism, Vampirism)
end
end
end