有两种理解方式,第一种是如果角色有了1号技能,那么2号技能消失(但是没有忘记),当角色忘记1号技能时,2号技能会恢复显示。
第二种是如果角色有了1号技能,那么2号技能消失,并且已经忘记。当角色忘记1号技能时,2号技能不会恢复显示。
第一种方式:
class Game_Actor def skills skills_excluded = [] [1,8,9,35].each_with_index do |skill_id, index| skills_excluded << [2,6,7,65][index] if @skills.include?(skill_id) end @skills - skills_excluded end end
class Game_Actor
def skills
skills_excluded = []
[1,8,9,35].each_with_index do |skill_id, index|
skills_excluded << [2,6,7,65][index] if @skills.include?(skill_id)
end
@skills - skills_excluded
end
end
第二种方式:
class Game_Actor def skills [1,8,9,35].each_with_index do |skill_id, index| @skills.delete([2,6,7,65][index]) if @skills.include?(skill_id) end @skills end end
class Game_Actor
def skills
[1,8,9,35].each_with_index do |skill_id, index|
@skills.delete([2,6,7,65][index]) if @skills.include?(skill_id)
end
@skills
end
end
|