本帖最后由 无忧谷主幻 于 2015-8-3 23:54 编辑
具体用法:设定几个新的属性。
比如【冥】,给武器勾上该属性后,再查看特技栏,把所有能被该武器使用的技能勾上同样的属性
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
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
|