#============================================================================== # ■ VX-RGSS2-4-opt 武器属性スキル制限 [Ver.1.0.0] by Claimh #------------------------------------------------------------------------------ # ・武器属性にない属性のスキルを使用できないようにします #============================================================================== module SysUpdate # 武器属性によってスキル使用可否を制限する属性 RESTRICATION_ELE = [FIGHT, SLASH, THRUST, BANG, BOW, WHIP] #-------------------------------------------------------------------------- # ● スキルの属性制限判定 # actor : アクター(Game_Actor) # skill : スキル(RPG::Skill) #-------------------------------------------------------------------------- def self.restrication?(actor, skill) return false unless skill.is_a?(RPG::Skill) return false if skill.nil? restrication_elements = [] for ele in RESTRICATION_ELE if skill.element_set.include?(ele) restrication_elements.push(ele) # 制限対象の属性 end end restrication = false if !restrication_elements.empty? # 制限あり for ele in restrication_elements unless actor.element_set.include?(ele) restrication = true # 制限対象の属性がない break end end end return restrication end end class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ● スキルの使用可能判定 # skill : スキル #-------------------------------------------------------------------------- alias restrication_skill_can_use? skill_can_use? def skill_can_use?(skill) return false if SysUpdate.restrication?(self, skill) # 制限あり return restrication_skill_can_use?(skill) end end class Window_Skill < Window_Selectable #-------------------------------------------------------------------------- # ● リフレッシュ <再定義> #-------------------------------------------------------------------------- def refresh @data = [] restrication_skills = [] for skill in @actor.skills if SysUpdate.restrication?(@actor, skill) # 制限あり restrication_skills.push(skill) else @data.push(skill) # 制限なし end end @data += restrication_skills # 制限されたスキルは最後尾に # カーソル位置補正 for skill in @data if skill.id == @actor.last_skill_id self.index = @data.size - 1 break end end @item_max = @data.size create_contents for i in 0...@item_max draw_item(i) end end end