
module Sp_Hit
SP = {actor_id => float + int, actor_id => float + int, ...}
DEFAULT = 0
Show_Recovery = true
end
class Scene_Battle
alias sp_per_hit_make_basic_action_result make_basic_action_result
def make_basic_action_result
if @active_battler.is_a?(Game_Actor) and @active_battler.current_action.basic == 0
if Sp_Hit.has_key?(@active_battler.id)
amount = Sp_Hit::SP[@active_battler.id]
else
amount = Sp_Hit::DEFAULT
end
percentage = amount - amount.to_i
amount = amount.to_i
restored = max * percentage + amount
max = @active_battler.maxsp
@active_battler.sp += restored
if Sp_Hit::Show_Recovery
@active_battler.damage = - restored
@active_battler.damage_pop = true
end
@status_window.refresh if @status_window != nil and restored != 0
end
end
end
module Sp_Hit
#syntax {actor_id => Integer + Decimal, ...}
# actor id is the actor id from the database without zeros
# Integer is the amount recovered
# Decimal is the percentage recovered
# so {1 => 10.75} means actor 1 when attacking gains
# 75% of his max sp + 10 sp
SP = {actor_id => Integer + Decimal, ...}
DEFAULT = 0
Show_Recovery = true
end
class Scene_Battle
alias sp_per_hit_make_basic_action_result make_basic_action_result
def make_basic_action_result
if @active_battler.is_a?(Game_Actor) and @active_battler.current_action.basic == 0
if Sp_Hit::SP.has_key?(@active_battler.id)
amount = Sp_Hit::SP[@active_battler.id]
else
amount = Sp_Hit::DEFAULT
end
percentage = amount - amount.to_i
amount = amount.to_i
max = @active_battler.maxsp
restored = max * percentage + amount
@active_battler.sp += restored
if Sp_Hit::Show_Recovery
@active_battler.damage = - restored
@active_battler.damage_pop = true
end
@status_window.refresh if @status_window != nil and restored != 0
end
sp_per_hit_make_basic_action_result
end
end