# By SephirothSpawn
class RPG::Skill
# { skill_id => percent or points, ... }
Hp_Drain_Percent = {}
Hp_Drain_Points = {}
Sp_Drain_Percent = {}
Sp_Drain_Points = {}
Hp_Drain_Percent.default = 0
Hp_Drain_Points.default = 0
Sp_Drain_Percent.default = 0
Sp_Drain_Points.default = 0
# [ skill_id, ... ]
Skills_That_Can_Kill_Draining = []
def hp_drain_percent
return Hp_Drain_Percent[@id]
end
def hp_drain_points
return Hp_Drain_Points[@id]
end
def sp_drain_percent
return Sp_Drain_Percent[@id]
end
def sp_drain_points
return Sp_Drain_Points[@id]
end
def drain_can_kill?
return Skills_That_Can_Kill_Draining.include?(@id)
end
end
class Game_Battler
alias_method :seph_skilldrains_gmbltr_se, :skill_effect
def skill_effect(user, skill)
effective = seph_skilldrains_gmbltr_se(user, skill)
if effective
hp_percent = skill.hp_drain_percent
hp_points = skill.hp_drain_points
sp_percent = skill.sp_drain_percent
sp_points = skill.sp_drain_points
hp_drain = Integer(self.hp * (hp_percent / 100.0)) + hp_points
sp_drain = Integer(self.sp * (sp_percent / 100.0)) + sp_points
unless skill.drain_can_kill?
hp_drain = [hp_drain, self.hp - 1].min
end
hp_drain = [hp_drain, self.hp].min
sp_drain = [sp_drain, self.sp].min
self.hp - hp_drain
self.sp - sp_drain
if self.damage.is_a?(Integer)
self.damage += hp_drain
end
user.hp += hp_drain
user.sp += sp_drain
end
return effective
end
end