#===============================================================================
# ■ 武器限制技能脚本
#-------------------------------------------------------------------------------
# 使用方法:
# 1. 插入Game_Actor之后,Main之前的任意位置。
# 1. 在下面设置需要被视为武器种类的属性名称。
# 2. 在属性列表内增加相对应的属性
# 3. 利用武器属性来设置种类,每个武器只能归类到一个种类。
# 4. 利用技能属性来设置发动技能需要的武器种类,可以设置多个,但只需满足其中
# 一个便可发动。
# 5. 没有设定条件的技能在任何武器或没有武器的情况下皆可发动。
#===============================================================================
module WLS
#-----------------------------------------------------------------------------
# 名称列在此的属性会被视为武器种类处理。
# 被视为武器种类的属性将不会对伤害造成任何影响。
#-----------------------------------------------------------------------------
TYPES = ["剑", "刀", "杖"]
#-----------------------------------------------------------------------------
unless defined?(ACTOR)
ACTOR = ::Game_Actor.clone
WEAPON = ::RPG::Weapon.clone
SKILL = ::RPG::Skill.clone
ITEM = ::RPG::Item.clone
ARMOR = ::RPG::Armor.clone
ENEMY = ::RPG::Enemy.clone
CLASS = ::RPG::Class.clone
STATE = ::RPG::State.clone
end
end
class Game_Actor < WLS::ACTOR
def skill_can_use?(id)
weapon = $data_weapons[@weapon_id]
skill = $data_skills[id]
return ((skill.required_types.empty? or (skill.required_types.include?(weapon.type))) and super)
end
end
class RPG::Weapon < WLS::WEAPON
def type
temp = WLS::TYPES.map{|t|$data_system.elements.index(t)}
return @element_set.find{|e|temp.include?(e)}
end
def element_set
set = super.clone
temp = WLS::TYPES.map{|t|$data_system.elements.index(t)}
set.delete_if{|e|temp.include?(e)}
return set
end
end
class RPG::Skill < WLS::SKILL
def required_types
temp = WLS::TYPES.map{|t|$data_system.elements.index(t)}
return @element_set.find_all{|e|temp.include?(e)}
end
def element_set
set = super.clone
temp = WLS::TYPES.map{|t|$data_system.elements.index(t)}
set.delete_if{|e|temp.include?(e)}
return set
end
end
class RPG::Item < WLS::ITEM
def element_set
set = super.clone
temp = WLS::TYPES.map{|t|$data_system.elements.index(t)}
set.delete_if{|e|temp.include?(e)}
return set
end
end
class RPG::Armor < WLS::ARMOR
def guard_element_set
set = super.clone
temp = WLS::TYPES.map{|t|$data_system.elements.index(t)}
set.delete_if{|e|temp.include?(e)}
return set
end
end
class RPG::Enemy < WLS::ENEMY
Action = WLS::ENEMY::Action
def element_ranks
ranks = super.clone
WLS::TYPES.each do |t|
ranks[$data_system.elements.index(t)] = 3
end
return ranks
end
end
class RPG::State < WLS::STATE
def guard_element_set
set = super.clone
temp = WLS::TYPES.map{|t|$data_system.elements.index(t)}
set.delete_if{|e|temp.include?(e)}
return set
end
end
class RPG::Class < WLS::CLASS
Learning = WLS::CLASS::Learning
def element_ranks
ranks = super.clone
WLS::TYPES.each do |t|
ranks[$data_system.elements.index(t)] = 3
end
return ranks
end
end