help with healing spell

1678379612682.png

Ruby:
module TLB
  HEALSKILL_ID = 26
end

class Scene_Battle < Scene_Base
  def use_item
    intended_item = @subject.current_action.item
    should_replace = @subject.hp_rate <= 0.75 && intended_item.magical?
    item = should_replace ? $data_skills[TLB::HEALSKILL_ID] : intended_item
    @log_window.display_use_item(@subject, item)
    @subject.use_item(item)
    refresh_status
    if should_replace
      $game_message.face_name = $game_party.leader.face_name
      $game_message.face_index = $game_party.leader.face_index
      $game_message.add("Screw that order, I'm gonna heal myself.")
      BattleManager.wait_for_message
    end
    targets = should_replace ? [@subject] : @subject.current_action.make_targets.compact
    show_animation(targets, item.animation_id)
    targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  end
end
View attachment 255492
Ruby:
module TLB
  HEALSKILL_ID = 26
end

class Scene_Battle < Scene_Base
  def use_item
    intended_item = @subject.current_action.item
    should_replace = @subject.hp_rate <= 0.75 && intended_item.magical?
    item = should_replace ? $data_skills[TLB::HEALSKILL_ID] : intended_item
    @log_window.display_use_item(@subject, item)
    @subject.use_item(item)
    refresh_status
    if should_replace
      $game_message.face_name = $game_party.leader.face_name
      $game_message.face_index = $game_party.leader.face_index
      $game_message.add("Screw that order, I'm gonna heal myself.")
      BattleManager.wait_for_message
    end
    targets = should_replace ? [@subject] : @subject.current_action.make_targets.compact
    show_animation(targets, item.animation_id)
    targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  end
end
Thanks a lot and sorry for all the problems. T~T
FIETfopXoAgZrPF.jpg

Original thread: https://forums.rpgmakerweb.com/threads/help-with-healing-spell.155572/