Automatic Battler AI Script, Need help!

Hello everyone!

I have been making a prototype in the last few days using VX ACE.
I'm using this script to enhance the artificial intelligence of my auto-battlers. It works extremely well for the project I'm working on, but unfortunately, there seems to be a game-breaking bug.

The script does not recognize skills learned via item equips, which means that the AI will never utilize those abilities. This is extremely weird to me, since in the vanilla version abilities learned with equipment are used by auto-battlers just fine.

Help would be immensely appreciated!

I've moved this thread to Script Support. Thank you.

Search for this part in Victor's script:
Spoiler
Code:
  def set_auto_skill(item)
    list = []
    item.id.each do |id|
      next unless skill_learn?($data_skills[id.to_i]) ||
                  id.to_i == attack_skill_id || id.to_i == guard_skill_id
      list.push(Game_Action.new(self).set_skill(id.to_i).evaluate_auto(item))
    end
    list.max_by {|action| action.value }
  end

Replace this line there:
Code:
next unless skill_learn?($data_skills[id.to_i]) ||
With this:
Code:
next unless skills.include?($data_skills[id.to_i]) ||

Note:
Not tested.
Search for this part in Victor's script:
Spoiler
Code:
  def set_auto_skill(item)
    list = []
    item.id.each do |id|
      next unless skill_learn?($data_skills[id.to_i]) ||
                  id.to_i == attack_skill_id || id.to_i == guard_skill_id
      list.push(Game_Action.new(self).set_skill(id.to_i).evaluate_auto(item))
    end
    list.max_by {|action| action.value }
  end

Replace this line there:
Code:
next unless skill_learn?($data_skills[id.to_i]) ||
With this:
Code:
next unless skills.include?($data_skills[id.to_i]) ||

Note:
Not tested.

WORKS! You are the MVP.
Thank you so much!

Original thread: https://forums.rpgmakerweb.com/threads/automatic-battler-ai-script-need-help.126142/