module Auto_Life
#--------------------------------------------------------------------------
# * Skills
# syntax - skill_id => [amount, percentage, animation]
#--------------------------------------------------------------------------
Skills = {81 => [1, 0, 25]}
end
class Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :autolife
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias_method :trick_autolife_battler_initialize, :initialize
def initialize
trick_autolife_battler_initialize
@autolife = false
end
#--------------------------------------------------------------------------
# * Skill Effect
#--------------------------------------------------------------------------
alias_method :trick_autolife_battler_skill_effect, :skill_effect
def skill_effect(user, skill)
effective = trick_autolife_battler_skill_effect(user, skill)
if Auto_Life::Skills.include?(skill.id) and not @autolife
@autolife = Auto_Life::Skills[skill.id]
effective = true
@damage = ''
end
return effective
end
end
class Scene_Battle
#--------------------------------------------------------------------------
# * Main
#--------------------------------------------------------------------------
alias_method :trick_autolife_battle_main, :main
def main
$game_party.actors.each {|actor| actor.autolife = false}
trick_autolife_battle_main
end
#--------------------------------------------------------------------------
# * Update Phase 4 Step 6
#--------------------------------------------------------------------------
alias_method :trick_autolife_battle_update_phase4_step6, :update_phase4_step6
def update_phase4_step6
trick_autolife_battle_update_phase4_step6
@target_battlers.each do |target|
next if target.exist? or not target.autolife
amount, percentage, animation = target.autolife
target.remove_state(1, true)
target.hp = amount + percentage * target.maxhp / 100
target.damage = 'Auto-Life'
target.animation_id = animation
target.damage_pop = true
target.autolife = false
end
end
end