#==============================================================================
# ■ Game_Battler
#------------------------------------------------------------------------------
# 处理战斗者的类。这个类作为 Game_Actor 类与 Game_Enemy 类的
# 超级类来使用。
#==============================================================================
SW_SET = [17,18,19,20,21,22,23,24] # 此处设定武器和技能关联的属性id
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 判断是否可以使用技能
# skill : 技能
# self.weapons : 武器id的数组
#--------------------------------------------------------------------------
def skill_can_use?(skill)
if self.is_a?(Game_Actor)
$data_weapons[0] = RPG::Weapon.new
$data_weapons[0].element_set =[]
sw_boolean = false # 判断武器和技能关联
s = SW_SET & $data_skills[skill.id].element_set
if s.empty?
sw_boolean = true
else
for i in s
if $data_weapons[self.weapon_id].element_set.include?(i)
sw_boolean = true
break
end
end
end
$data_weapons[0] = nil
return false if sw_boolean == false
end
return false unless skill.is_a?(RPG::Skill)
return false unless movable?
return false if silent? and skill.spi_f > 0
return false if calc_mp_cost(skill) > mp
if $game_temp.in_battle
return skill.battle_ok?
else
return skill.menu_ok?
end
end
end