#==============================================================================
# Equipamentos Com Habilidades
# Por Atoa
#==============================================================================
# Este script permite configurar equipamentos que adicionam habilidades aos
# personagens quando são equipados, você pode também configurar um nível
# mínimo para que estas habilidades estejam disponíveis.
#==============================================================================
module Atoa
# Não apague ou altere estas linhas
Equip_Skills = {}
Skill_Restriction = {}
# Não apague ou altere estas linhas
# Equip_Skills[Equip_Type] = {Equip_ID => {Min_Level => Skill_ID}}
# Equip_Type = 'Weapon' para armas, 'Armor' para armaduras
# Equips_ID = ID do equipamento
# Min_Level = nível minimo requirido para se aprender a skill
# Skill_ID = ID da skill aprendida
Equip_Skills['Weapon'] = {1 => {1 => 1, 15 => 2, 30 => 3}}
Equip_Skills['Armor'] = {1 => {1 => 1, 15 => 2, 30 => 3}}
# Definir habilidades que o personagem não pode aprender com equipamentos.
# Skill_Restriction[Actor_ID] = [Skill_IDs]
Skill_Restriction[1] = []
#=============================================================================
end
#==============================================================================
# ■ Atoa Module
#==============================================================================
$atoa_script = {} if $atoa_script.nil?
$atoa_script['Atoa Equiment Skill'] = true
#==============================================================================
# ■ RPG::Weapon
#==============================================================================
class RPG::Weapon
#--------------------------------------------------------------------------
def type_name
return 'Weapon'
end
end
#==============================================================================
# ■ RPG::Armor
#==============================================================================
class RPG::Armor
#--------------------------------------------------------------------------
def type_name
return 'Armor'
end
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
include Atoa
#--------------------------------------------------------------------------
alias initialize_equiskill initialize
def initialize(actor_id)
@equipment_skills = []
initialize_equiskill(actor_id)
gain_equip_skills
end
#--------------------------------------------------------------------------
def weapons
return [$data_weapons[@weapon_id]]
end
#--------------------------------------------------------------------------
def armors
armor = []
armor << $data_armors[@armor1_id]
armor << $data_armors[@armor2_id]
armor << $data_armors[@armor3_id]
armor << $data_armors[@armor4_id]
return armor
end
#--------------------------------------------------------------------------
def equips
return weapons + armors
end
#--------------------------------------------------------------------------
alias exp_equiskill exp=
def exp=(exp)
lose_equip_skills
exp_equiskill(exp)
gain_equip_skills
end
#--------------------------------------------------------------------------
alias forget_skill_equiskill forget_skill
def forget_skill(skill_id)
lose_equip_skills
forget_skill_equiskill(skill_id)
gain_equip_skills
end
#--------------------------------------------------------------------------
alias learn_skill_equiskill learn_skill
def learn_skill(skill_id)
lose_equip_skills
learn_skill_equiskill(skill_id)
gain_equip_skills
end
#--------------------------------------------------------------------------
alias equip_equiskill equip
def equip(equip_type, id)
equip_equiskill(equip_type, id)
gain_equip_skills
end
#--------------------------------------------------------------------------
def gain_equip_skills
lose_equip_skills
for eqp in equips
next if eqp.nil?
if Equip_Skills[eqp.type_name] != nil and
Equip_Skills[eqp.type_name][eqp.id] != nil
skills = Equip_Skills[eqp.type_name][eqp.id].dup
for skill_level in skills.keys
next if Skill_Restriction[@actor_id] != nil and
Skill_Restriction[@actor_id].include?(skills[skill_level])
get_new_equip_skill(skills[skill_level]) if skill_level <= @level
end
end
end
end
#--------------------------------------------------------------------------
def lose_equip_skills
for skill_id in @equipment_skills
@skills.delete(skill_id)
end
@equipment_skills.clear
end
#--------------------------------------------------------------------------
def get_new_equip_skill(skill)
unless self.skill_learn?(skill) or @equipment_skills.include?(skill)
@equipment_skills << skill
@skills.push(skill)
@skills.sort!
end
end
end