class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
@actor.skills.each do |skill_id|
skill = $data_skills[skill_id]
if $game_temp.in_battle &&
!skill.element_set.empty? &&
(skill.element_set & required_element_set).empty?
skill = nil
end
if skill != nil
@data.push(skill)
end
end
# 如果项目数不是 0 就生成位图、重新描绘全部项目
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
def required_element_set
result = []
weapon = $data_weapons[@actor.weapon_id]
armor1 = $data_armors[@actor.armor1_id]
result |= weapon.nil? ? [] : weapon.element_set
result |= armor1.nil? ? [] : armor1.guard_element_set
result
end
end