def equips_effict(ability)
n = {}
case ability
when "death"
#獲取敵方死亡發動的能力
equip_slots.size.times do |i|
if @equips[i] != nil
value = @equips[i].death
if n.has_key?(value[0])
n[value[0]] += value[1]
else
n[value[0]] = value[1]
end
end
add_ability(n)
end
when "install_cost"
#獲取敵方死亡發動的能力
equip_slots.size.times do |i|
if @equips[i] != nil
value = @equips[i].install_cost
puts "value為#{value}"
if value != nil
if n.has_key?(value[0])
n[value[0]] += value[1]
else
n[value[0]] = value[1]
end
end
end
puts "install_cost為#{n}"
add_ability(n)
end
when "atk_settle"
#獲取敵方死亡發動的能力
equip_slots.size.times do |i|
if @equips[i] != nil
value = @equips[i].atk_settle
if value != nil
if n.has_key?(value[0])
n[value[0]] += value[1]
else
n[value[0]] = value[1]
end
end
end
end
puts "atk_settle為#{n}"
#增加能力
add_ability(n)
end
end
def equips_effict(ability)
n = {}
case ability
when "death"
#獲取敵方死亡發動的能力
equip_slots.size.times do |i|
if @equips[i] != nil
value = @equips[i].death
if n.has_key?(value[0])
n[value[0]] += value[1]
else
n[value[0]] = value[1]
end
end
add_ability(n)
end
when "install_cost"
#獲取敵方死亡發動的能力
equip_slots.size.times do |i|
if @equips[i] != nil
value = @equips[i].install_cost
puts "value為#{value}"
if value != nil
if n.has_key?(value[0])
n[value[0]] += value[1]
else
n[value[0]] = value[1]
end
end
end
puts "install_cost為#{n}"
add_ability(n)
end
when "atk_settle"
#獲取敵方死亡發動的能力
equip_slots.size.times do |i|
if @equips[i] != nil
value = @equips[i].atk_settle
if value != nil
if n.has_key?(value[0])
n[value[0]] += value[1]
else
n[value[0]] = value[1]
end
end
end
end
puts "atk_settle為#{n}"
#增加能力
add_ability(n)
end
end