#---------------------------------------------------------------------
module Fy
#用开关关联技能,对应的开关未打开时,无论多少等级,所有角色对应技能都不能学会。
#包括用事件强制学也不能。
#下面设置格式是:技能ID=>开关ID 。需要更多的可以照格式添加。
Restricted_class_skills = {3=>10, 4=>11}
end
#---------------------------------------------------------------------
class Game_Actor < Game_Battler
alias fy_learn_skill learn_skill
def learn_skill(skill_id)
return if Fy::Restricted_class_skills.keys.include?(skill_id) and
! $game_switches[Fy::Restricted_class_skills[skill_id]]
fy_learn_skill(skill_id)
end
def skill_refresh
for i in 1..@level
for j in $data_classes[@class_id].learnings
if j.level == i
learn_skill(j.skill_id)
end
end
end
end
end
#---------------------------------------------------------------------
class Game_Switches
def []=(switch_id, value)
if switch_id <= 5000
@data[switch_id] = value
if value and Fy::Restricted_class_skills.values.include?(switch_id)
$data_actors.size.times do |i|
next if $game_actors[i].nil?
$game_actors[i].skill_refresh
end
end
end
end
end
#---------------------------------------------------------------------