class EFS_Battler < Game_Character
attr_accessor :base_atk, :character_name, :勋章, :神器, :头盔, :盔甲, :战靴
attr_reader :soldier_id
def initialize(data_id)
super()
@character_name = Figter_data::CHARACTER_NAME[data_id]
@basic_character_name = @character_name
@base_atk = Figter_data::BASE_ATK[data_id]
@base_base_atk = @base_atk
@soldier_id = data_id
@勋章 = []
@神器 = []
@头盔 = []
@盔甲 = []
@战靴 = []
end
def refill
@base_atk = calculate_total_base_atk
end
def calculate_total_base_atk
get_勋章_base_atk + get_神器_base_atk + get_头盔_base_atk + get_盔甲_base_atk + get_战靴_base_atk
end
def get_勋章_base_atk(const = false)
n = const ? @base_base_atk : 0
@勋章.each do |i|
n += 勋章_data::BASE_ATK[i] if i
end
n
end
def get_神器_base_atk(const = false)
n = const ? @base_base_atk : 0
@神器.each do |i|
n += 神器_data::BASE_ATK[i] if i
end
n
end
def get_头盔_base_atk(const = false)
n = const ? @base_base_atk : 0
@头盔.each do |i|
n += 头盔_data::BASE_ATK[i] if i
end
n
end
def get_盔甲_base_atk(const = false)
n = const ? @base_base_atk : 0
@盔甲.each do |i|
n += 盔甲_data::BASE_ATK[i] if i
end
n
end
def get_战靴_base_atk(const = false)
n = const ? @base_base_atk : 0
@战靴.each do |i|
n += 战靴_data::BASE_ATK[i] if i
end
n
end
# 添加装备
def add_equipment(equipment_type, equipment_id)
send("#{equipment_type}_add", equipment_id)
refill
end
# 私有方法,用于实际添加装备到对应的数组
private
def 勋章_add(equipment_id)
@勋章 << equipment_id
end
def 神器_add(equipment_id)
@神器 << equipment_id
end
def 头盔_add(equipment_id)
@头盔 << equipment_id
end
def 盔甲_add(equipment_id)
@盔甲 << equipment_id
end
def 战靴_add(equipment_id)
@战靴 << equipment_id
end
public
# 更换装备
def replace_equipment(equipment_type, new_equipment_id)
send("#{equipment_type}_replace", new_equipment_id)
refill
end
# 私有方法,用于实际更换装备
private
def 勋章_replace(new_equipment_id)
@勋章.clear
@勋章 << new_equipment_id
end
def 神器_replace(new_equipment_id)
@神器.clear
@神器 << new_equipment_id
end
def 头盔_replace(new_equipment_id)
@头盔.clear
@头盔 << new_equipment_id
end
def 盔甲_replace(new_equipment_id)
@盔甲.clear
@盔甲 << new_equipment_id
end
def 战靴_replace(new_equipment_id)
@战靴.clear
@战靴 << new_equipment_id
end
public
# 卸除装备
def remove_equipment(equipment_type)
send("#{equipment_type}_remove")
refill
end
# 私有方法,用于实际卸除装备
private
def 勋章_remove
@勋章.clear
end
def 神器_remove
@神器.clear
end
def 头盔_remove
@头盔.clear
end
def 盔甲_remove
@盔甲.clear
end
def 战靴_remove
@战靴.clear
end
end