#--------------------------------------------------------------------------
# X☆R: 装备拆解。
#--------------------------------------------------------------------------
def demolish
if self.is_a?(X☆R_Weapon)
materials = $data_weapons[@id].materials
else
materials = $data_armors[@id].materials
end
ma = materials.keys.clone
if ma.size > 0
n = 30 * ma.size
until n <= 0
id = ma[rand (ma.size)]
if (rand 100) < n and id != nil
$game_party.gain_item(id, 1)
ma.delete(id)
end
n -= 30
end
end
if @level >= 2
n = @level / 2 * 10
items = X☆R::Lup_Items.keys.clone
until n <= 0
if (rand 100) < n
$game_party.gain_item(items[rand(items.size)], 1)
end
n -= 10
end
end
if @gem != []
n = 10 * gem_size
until n <= 0
id = @gem[rand (@gem.size)]
if (rand 100) < n and id != nil
$game_party.gain_item(id, 1)
@gem.delete(id)
end
n -= 10
end
end
if self.is_a?(X☆R_Weapon)
$game_party.lose_weapon(@index)
else
$game_party.lose_armor(@index)
end
end