local assets=
{
	Asset("ANIM", "anim/mushasword_frost.zip"),
    	Asset("ATLAS", "images/inventoryimages/mushasword_frost.xml"),
	Asset("IMAGE", "images/inventoryimages/mushasword_frost.tex"),

	Asset("ANIM", "anim/swap_mushasword_base.zip"),
	Asset("ANIM", "anim/swap_mushasword_frost1.zip"),
	Asset("ANIM", "anim/swap_mushasword_frost2.zip"),
	Asset("ANIM", "anim/swap_mushasword_frost3.zip"),

}
---------------------------
local function levelexp(inst,data)

	local max_exp = 4100
	local exp = math.min(inst.level, max_exp)

if inst.level <= 4000 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ]-\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:RemoveTag("levelup")
end
if inst.level >=0 and inst.level <10 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[10]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level1")
elseif inst.level >=10 and inst.level <30 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[30]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level2")
inst:RemoveTag("level1")
elseif inst.level >=30 and inst.level <50 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[50]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level3")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
elseif inst.level >=50 and inst.level <70 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[70]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level4")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
elseif inst.level >=70 and inst.level <90 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[90]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level5")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
elseif inst.level >=90 and inst.level <120 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[120]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level6")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
elseif inst.level >=120 and inst.level <150 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[150]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level7")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
elseif inst.level >=150 and inst.level <180 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[180]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level8")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
elseif inst.level >=180 and inst.level <210 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[210]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level9")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
inst:RemoveTag("level8")
elseif inst.level >=210 and inst.level <250 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[250]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level10")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
inst:RemoveTag("level8")
inst:RemoveTag("level9")
elseif inst.level >=250 and inst.level <350 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[350]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level11")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
inst:RemoveTag("level8")
inst:RemoveTag("level9")
inst:RemoveTag("level10")
elseif inst.level >=350 and inst.level <450 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[450]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level12")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
inst:RemoveTag("level8")
inst:RemoveTag("level9")
inst:RemoveTag("level10")
inst:RemoveTag("level11")
elseif inst.level >=450 and inst.level <550 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[550]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level13")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
inst:RemoveTag("level8")
inst:RemoveTag("level9")
inst:RemoveTag("level10")
inst:RemoveTag("level11")
inst:RemoveTag("level12")
elseif inst.level >=550 and inst.level <650 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[650]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level14")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
inst:RemoveTag("level8")
inst:RemoveTag("level9")
inst:RemoveTag("level10")
inst:RemoveTag("level11")
inst:RemoveTag("level12")
inst:RemoveTag("level13")
elseif inst.level >=650 and inst.level <750 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[750]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level15")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
inst:RemoveTag("level8")
inst:RemoveTag("level9")
inst:RemoveTag("level10")
inst:RemoveTag("level11")
inst:RemoveTag("level12")
inst:RemoveTag("level13")
inst:RemoveTag("level14")
elseif inst.level >=750 and inst.level <850 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[850]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level16")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
inst:RemoveTag("level8")
inst:RemoveTag("level9")
inst:RemoveTag("level10")
inst:RemoveTag("level11")
inst:RemoveTag("level12")
inst:RemoveTag("level13")
inst:RemoveTag("level14")
inst:RemoveTag("level15")
elseif inst.level >=850 and inst.level <950 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[950]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level17")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
inst:RemoveTag("level8")
inst:RemoveTag("level9")
inst:RemoveTag("level10")
inst:RemoveTag("level11")
inst:RemoveTag("level12")
inst:RemoveTag("level13")
inst:RemoveTag("level14")
inst:RemoveTag("level15")
inst:RemoveTag("level16")
elseif inst.level >=950 and inst.level <1050 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[1050]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level18")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
inst:RemoveTag("level8")
inst:RemoveTag("level9")
inst:RemoveTag("level10")
inst:RemoveTag("level11")
inst:RemoveTag("level12")
inst:RemoveTag("level13")
inst:RemoveTag("level14")
inst:RemoveTag("level15")
inst:RemoveTag("level16")
inst:RemoveTag("level17")
elseif inst.level >=1050 and inst.level <1200 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[1200]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level19")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
inst:RemoveTag("level8")
inst:RemoveTag("level9")
inst:RemoveTag("level10")
inst:RemoveTag("level11")
inst:RemoveTag("level12")
inst:RemoveTag("level13")
inst:RemoveTag("level14")
inst:RemoveTag("level15")
inst:RemoveTag("level16")
inst:RemoveTag("level17")
inst:RemoveTag("level18")
elseif inst.level >=1200 and inst.level <1400 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[1500]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level20")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
inst:RemoveTag("level8")
inst:RemoveTag("level9")
inst:RemoveTag("level10")
inst:RemoveTag("level11")
inst:RemoveTag("level12")
inst:RemoveTag("level13")
inst:RemoveTag("level14")
inst:RemoveTag("level15")
inst:RemoveTag("level16")
inst:RemoveTag("level17")
inst:RemoveTag("level18")
inst:RemoveTag("level19")
elseif inst.level >=1400 and inst.level <1600 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[1600]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level21")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
inst:RemoveTag("level8")
inst:RemoveTag("level9")
inst:RemoveTag("level10")
inst:RemoveTag("level11")
inst:RemoveTag("level12")
inst:RemoveTag("level13")
inst:RemoveTag("level14")
inst:RemoveTag("level15")
inst:RemoveTag("level16")
inst:RemoveTag("level17")
inst:RemoveTag("level18")
inst:RemoveTag("level19")
inst:RemoveTag("level20")
elseif inst.level >=1600 and inst.level <1800 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[1800]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level22")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
inst:RemoveTag("level8")
inst:RemoveTag("level9")
inst:RemoveTag("level10")
inst:RemoveTag("level11")
inst:RemoveTag("level12")
inst:RemoveTag("level13")
inst:RemoveTag("level14")
inst:RemoveTag("level15")
inst:RemoveTag("level16")
inst:RemoveTag("level17")
inst:RemoveTag("level18")
inst:RemoveTag("level19")
inst:RemoveTag("level20")
inst:RemoveTag("level21")
elseif inst.level >=1800 and inst.level <2000 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[2000]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level23")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
inst:RemoveTag("level8")
inst:RemoveTag("level9")
inst:RemoveTag("level10")
inst:RemoveTag("level11")
inst:RemoveTag("level12")
inst:RemoveTag("level13")
inst:RemoveTag("level14")
inst:RemoveTag("level15")
inst:RemoveTag("level16")
inst:RemoveTag("level17")
inst:RemoveTag("level18")
inst:RemoveTag("level19")
inst:RemoveTag("level20")
inst:RemoveTag("level21")
inst:RemoveTag("level22")
elseif inst.level >=2000 and inst.level <2200 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[2200]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level24")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
inst:RemoveTag("level8")
inst:RemoveTag("level9")
inst:RemoveTag("level10")
inst:RemoveTag("level11")
inst:RemoveTag("level12")
inst:RemoveTag("level13")
inst:RemoveTag("level14")
inst:RemoveTag("level15")
inst:RemoveTag("level16")
inst:RemoveTag("level17")
inst:RemoveTag("level18")
inst:RemoveTag("level19")
inst:RemoveTag("level20")
inst:RemoveTag("level21")
inst:RemoveTag("level22")
inst:RemoveTag("level23")
elseif inst.level >=2200 and inst.level <2400 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[2400]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level25")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
inst:RemoveTag("level8")
inst:RemoveTag("level9")
inst:RemoveTag("level10")
inst:RemoveTag("level11")
inst:RemoveTag("level12")
inst:RemoveTag("level13")
inst:RemoveTag("level14")
inst:RemoveTag("level15")
inst:RemoveTag("level16")
inst:RemoveTag("level17")
inst:RemoveTag("level18")
inst:RemoveTag("level19")
inst:RemoveTag("level20")
inst:RemoveTag("level21")
inst:RemoveTag("level22")
inst:RemoveTag("level23")
inst:RemoveTag("level24")
elseif inst.level >=2400 and inst.level <2600 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[2600]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level26")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
inst:RemoveTag("level8")
inst:RemoveTag("level9")
inst:RemoveTag("level10")
inst:RemoveTag("level11")
inst:RemoveTag("level12")
inst:RemoveTag("level13")
inst:RemoveTag("level14")
inst:RemoveTag("level15")
inst:RemoveTag("level16")
inst:RemoveTag("level17")
inst:RemoveTag("level18")
inst:RemoveTag("level19")
inst:RemoveTag("level20")
inst:RemoveTag("level21")
inst:RemoveTag("level22")
inst:RemoveTag("level23")
inst:RemoveTag("level24")
inst:RemoveTag("level25")
elseif inst.level >=2600 and inst.level <2800 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[2800]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level27")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
inst:RemoveTag("level8")
inst:RemoveTag("level9")
inst:RemoveTag("level10")
inst:RemoveTag("level11")
inst:RemoveTag("level12")
inst:RemoveTag("level13")
inst:RemoveTag("level14")
inst:RemoveTag("level15")
inst:RemoveTag("level16")
inst:RemoveTag("level17")
inst:RemoveTag("level18")
inst:RemoveTag("level19")
inst:RemoveTag("level20")
inst:RemoveTag("level21")
inst:RemoveTag("level22")
inst:RemoveTag("level23")
inst:RemoveTag("level24")
inst:RemoveTag("level25")
inst:RemoveTag("level26")
elseif inst.level >=2800 and inst.level <3000 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[3000]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level28")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
inst:RemoveTag("level8")
inst:RemoveTag("level9")
inst:RemoveTag("level10")
inst:RemoveTag("level11")
inst:RemoveTag("level12")
inst:RemoveTag("level13")
inst:RemoveTag("level14")
inst:RemoveTag("level15")
inst:RemoveTag("level16")
inst:RemoveTag("level17")
inst:RemoveTag("level18")
inst:RemoveTag("level19")
inst:RemoveTag("level20")
inst:RemoveTag("level21")
inst:RemoveTag("level22")
inst:RemoveTag("level23")
inst:RemoveTag("level24")
inst:RemoveTag("level25")
inst:RemoveTag("level26")
inst:RemoveTag("level27")
elseif inst.level >=3000 and inst.level <4000 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \nNext:[4000]\n[ ³É ³¤ µã Êý ]".. (inst.level))
inst:AddTag("level29")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
inst:RemoveTag("level8")
inst:RemoveTag("level9")
inst:RemoveTag("level10")
inst:RemoveTag("level11")
inst:RemoveTag("level12")
inst:RemoveTag("level13")
inst:RemoveTag("level14")
inst:RemoveTag("level15")
inst:RemoveTag("level16")
inst:RemoveTag("level17")
inst:RemoveTag("level18")
inst:RemoveTag("level19")
inst:RemoveTag("level20")
inst:RemoveTag("level21")
inst:RemoveTag("level22")
inst:RemoveTag("level23")
inst:RemoveTag("level24")
inst:RemoveTag("level25")
inst:RemoveTag("level26")
inst:RemoveTag("level27")
inst:RemoveTag("level28")
elseif inst.level >=4000 then
inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ] \n[MAX]")
inst:AddTag("level30")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
inst:RemoveTag("level6")
inst:RemoveTag("level7")
inst:RemoveTag("level8")
inst:RemoveTag("level9")
inst:RemoveTag("level10")
inst:RemoveTag("level11")
inst:RemoveTag("level12")
inst:RemoveTag("level13")
inst:RemoveTag("level14")
inst:RemoveTag("level15")
inst:RemoveTag("level16")
inst:RemoveTag("level17")
inst:RemoveTag("level18")
inst:RemoveTag("level19")
inst:RemoveTag("level20")
inst:RemoveTag("level21")
inst:RemoveTag("level22")
inst:RemoveTag("level23")
inst:RemoveTag("level24")
inst:RemoveTag("level25")
inst:RemoveTag("level26")
inst:RemoveTag("level27")
inst:RemoveTag("level28")
inst:RemoveTag("level29")
end
end

local function onpreload(inst, data)
	if data then
		if data.level then
		inst.level = data.level
			levelexp(inst)
end
	end
		end
local function onsave(inst, data)
	data.level = inst.level
	data.charge_time = inst.charge_time
end

local function OnDurability(inst, data)
inst:AddTag("broken")
    inst.components.weapon:SetDamage(1)
	inst.components.talker:Say("- ÆÆ ¾É µÄ ±ù Ëª ·ï »Ë ½£\nÉË º¦ (1)")
end
--------
    local function TakeItem(inst)
	inst.components.fueled:DoDelta(5000000)
	inst.level = inst.level + 1
	levelexp(inst)
		local fx = SpawnPrefab("splash")
	local pos = Vector3(inst.Transform:GetWorldPosition())
fx.Transform:SetPosition(pos:Get())
if inst:HasTag ("broken") then
inst:RemoveTag ("broken")
--inst.components.fueled:StartConsuming()        
    end
end

local function onblink(staff, pos, caster)

    if caster.components.sanity then
        caster.components.sanity:DoDelta(-10)
    end
end

local function Upgradedamage(inst)
if inst.components.fueled:IsEmpty() then
inst:AddTag("broken") 
   inst.components.weapon:SetDamage(1)
	inst.components.talker:Say("- ÆÆ ¾É µÄ ±ù Ëª ·ï »Ë ½£\nÉË º¦ (1)")
end
if inst:HasTag("broken") then
   inst.components.weapon:SetDamage(1)
	inst.components.talker:Say("- ÆÆ ¾É µÄ ±ù Ëª ·ï »Ë ½£\nÉË º¦ (1)")
   end
if not inst:HasTag("broken") then
        if inst:HasTag("level1") then
    inst.components.weapon:SetDamage(30)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV1)\nÉË º¦ (30)\n±ù ¶³ ÉË º¦ (10)")
        elseif inst:HasTag("level2") then
    inst.components.weapon:SetDamage(31)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV2)\nÉË º¦ (31)\n±ù ¶³ ÉË º¦ (11)")
        elseif inst:HasTag("level3") then
    inst.components.weapon:SetDamage(32)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV3)\nÉË º¦ (32)\n±ù ¶³ ÉË º¦ (12)")
        elseif inst:HasTag("level4") then
    inst.components.weapon:SetDamage(33)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV4)]\nÉË º¦ (33)\n±ù ¶³ ÉË º¦ (13)")
        elseif inst:HasTag("level5") then
    inst.components.weapon:SetDamage(34)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV5)\nÉË º¦ (34)\n±ù ¶³ ÉË º¦ (14)")
        elseif inst:HasTag("level6") then
    inst.components.weapon:SetDamage(35)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV6)\nÉË º¦ (35)\n±ù ¶³ ÉË º¦ (15)")
        elseif inst:HasTag("level7") then
    inst.components.weapon:SetDamage(36)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV7)\nÉË º¦ (36)\n±ù ¶³ ÉË º¦ (16)")
        elseif inst:HasTag("level8") then
    inst.components.weapon:SetDamage(37)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV8)\nÉË º¦ (37)\n±ù ¶³ ÉË º¦ (17)")
        elseif inst:HasTag("level9") then
    inst.components.weapon:SetDamage(38)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV9)\nÉË º¦ (38)\n±ù ¶³ ÉË º¦ (18)")
        elseif inst:HasTag("level10") then
    inst.components.weapon:SetDamage(42)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV10)\nÉË º¦ (42)\n±ù ¶³ ÉË º¦ (19)")
        elseif inst:HasTag("level11") then
    inst.components.weapon:SetDamage(43)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV11)\nÉË º¦ (43)\n±ù ¶³ ÉË º¦ (20)")
        elseif inst:HasTag("level12") then
    inst.components.weapon:SetDamage(44)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV12)\nÉË º¦ (44)\n±ù ¶³ ÉË º¦ (21)")
        elseif inst:HasTag("level13") then
    inst.components.weapon:SetDamage(45)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV13)\nÉË º¦ (46)\n±ù ¶³ ÉË º¦ (22)")
        elseif inst:HasTag("level14") then
    inst.components.weapon:SetDamage(47)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV14)\nÉË º¦ (47)\n±ù ¶³ ÉË º¦ (23)")
        elseif inst:HasTag("level15") then
    inst.components.weapon:SetDamage(48)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV15)\nÉË º¦ (48)\n±ù ¶³ ÉË º¦ (24)")
        elseif inst:HasTag("level16") then
    inst.components.weapon:SetDamage(49)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV16)\nÉË º¦ (49)\n±ù ¶³ ÉË º¦ (25)")
        elseif inst:HasTag("level17") then
    inst.components.weapon:SetDamage(50)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV17)\nÉË º¦ (50)\n±ù ¶³ ÉË º¦ (26)")
        elseif inst:HasTag("level18") then
    inst.components.weapon:SetDamage(51)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV18)\nÉË º¦ (51)\n±ù ¶³ ÉË º¦ (27)")
        elseif inst:HasTag("level19") then
    inst.components.weapon:SetDamage(54)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV19)\nÉË º¦ (54)\n±ù ¶³ ÉË º¦ (28)")
        elseif inst:HasTag("level20") then
    inst.components.weapon:SetDamage(55)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV20)\nÉË º¦ (55)\n±ù ¶³ ÉË º¦ (29)")
        elseif inst:HasTag("level21") then
    inst.components.weapon:SetDamage(56)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV21)\nÉË º¦ (56)\n±ù ¶³ ÉË º¦ (30)")
        elseif inst:HasTag("level22") then
    inst.components.weapon:SetDamage(57)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV22)\nÉË º¦ (57)\n±ù ¶³ ÉË º¦ (31)")
        elseif inst:HasTag("level23") then
    inst.components.weapon:SetDamage(58)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV23)\nÉË º¦ (58)\n±ù ¶³ ÉË º¦ (32)")
        elseif inst:HasTag("level24") then
    inst.components.weapon:SetDamage(59)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV24)\nÉË º¦ (59)\n±ù ¶³ ÉË º¦ (33)")
        elseif inst:HasTag("level25") then
    inst.components.weapon:SetDamage(60)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV25)\nÉË º¦ (60)\n±ù ¶³ ÉË º¦ (34)")
        elseif inst:HasTag("level26") then
    inst.components.weapon:SetDamage(61)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV26)\nÉË º¦ (61)\n±ù ¶³ ÉË º¦ (35)")
        elseif inst:HasTag("level27") then
    inst.components.weapon:SetDamage(62)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV27)\nÉË º¦ (62)\n±ù ¶³ ÉË º¦ (36)")
        elseif inst:HasTag("level28") then
    inst.components.weapon:SetDamage(63)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV28)\nÉË º¦ (63)\n±ù ¶³ ÉË º¦ (37)")
        elseif inst:HasTag("level29") then
    inst.components.weapon:SetDamage(64)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (LV29)\nÉË º¦ (64)\n±ù ¶³ ÉË º¦ (38)")
        elseif inst:HasTag("level30") then
    inst.components.weapon:SetDamage(68)
	inst.components.talker:Say("- ±ù Ëª ·ï »Ë ½£ (Max30)\nÉË º¦ (68)\n±ù ¶³ ÉË º¦ (40)")
end
end
end


local function OnLoad(inst, data)
    Upgradedamage(inst)
end


local function onattack_Frost(inst, attacker, target)
local player = GetPlayer()
local freezechance1 = 0.45
local freezechance2 = 0.45
local expchance = 0.05
local damagedur1 = 0.2
local damagedur2 = 0.5
local damagedur3 = 0.7
local damagedur4 = 1


if math.random() < expchance and not inst:HasTag("broken") then
	inst.level = inst.level + 1
	levelexp(inst)
end
    if target and not inst:HasTag("broken") and math.random() < damagedur1 then
inst.components.fueled:DoDelta(-150000)
    elseif target and not inst:HasTag("broken") and math.random() < damagedur2 then
inst.components.fueled:DoDelta(-75000)
    elseif target and not inst:HasTag("broken") and math.random() < damagedur3 then
inst.components.fueled:DoDelta(-35000)
    elseif target and not inst:HasTag("broken") and math.random() < damagedur4 then
inst.components.fueled:DoDelta(-20000)
    elseif target and inst:HasTag("broken") then
		local fx = SpawnPrefab("splash")
	local pos = Vector3(target.Transform:GetWorldPosition())
fx.Transform:SetPosition(pos:Get())
	inst.components.talker:Say("- ÆÆ ¾É µÄ Îä Æ÷ \nÉË º¦ (1)")
    end

if target.components.freezable and player:HasTag("frosta") and not inst:HasTag("boost") then
        target.components.freezable:AddColdness(10)
        target.components.freezable:SpawnShatterFX()
        attacker.components.sanity:DoDelta(-4)
local fx = SpawnPrefab("statue_transition_2")
local pos = Vector3(target.Transform:GetWorldPosition())
	fx.Transform:SetPosition(pos:Get())
		--target.components.health:DoDelta(-80)
	player:RemoveTag("frosta") 

elseif target.components.freezable and player:HasTag("frosta") and not player:HasTag("DLC") and inst:HasTag("boost") then
        target.components.freezable:AddColdness(10)
        target.components.freezable:SpawnShatterFX()
        attacker.components.sanity:DoDelta(-12)
local fx = SpawnPrefab("statue_transition_2")
local pos = Vector3(target.Transform:GetWorldPosition())
	fx.Transform:SetPosition(pos:Get())
		target.components.health:DoDelta(-100)
	player:RemoveTag("frosta") 

elseif target.components.freezable and player:HasTag("frosta") and player:HasTag("DLC") and inst:HasTag("boost") then
        target.components.freezable:AddColdness(10)
        target.components.freezable:SpawnShatterFX()
        attacker.components.sanity:DoDelta(-12)
local fx = SpawnPrefab("groundpoundring_fx")
local pos = Vector3(target.Transform:GetWorldPosition())
	fx.Transform:SetPosition(pos:Get())
		target.components.health:DoDelta(-100)
	player:RemoveTag("frosta") 
    end

     if target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level1") and math.random() < freezechance1 then
        target.components.freezable:AddColdness(0.1)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level2") and math.random() < freezechance1 then
        target.components.freezable:AddColdness(0.11)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level3") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.12)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level4") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.13)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level5") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.14)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level6") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.15)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level7") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.16)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level8") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.17)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level9") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.18)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level10") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.19)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level11") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.2)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level12") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.21)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level13") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.22)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level14") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.23)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level15") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.24)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level16") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.25)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level17") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.26)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level18") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.27)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level19") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.28)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level20") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.29)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level21") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.3)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level22") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.31)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level23") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.32)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level24") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.33)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level25") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.34)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level26") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.35)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level27") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.36)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level28") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.37)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level29") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.38)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level30") and math.random() < freezechance1 then
       target.components.freezable:AddColdness(0.4)
        target.components.freezable:SpawnShatterFX()
-----boost
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level1") and math.random() < freezechance2 and inst:HasTag("boost2") then
        target.components.freezable:AddColdness(0.1)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level2") and math.random() < freezechance2 and inst:HasTag("boost2") then
        target.components.freezable:AddColdness(0.11)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level3") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.12)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level4") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.13)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level5") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.14)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level6") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.15)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level7") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.16)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level8") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.17)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level9") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.18)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level10") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.19)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level11") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.2)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level12") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.21)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level13") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.22)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level14") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.23)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level15") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.24)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level16") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.25)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level17") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.26)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level18") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.27)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level19") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.28)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level20") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.29)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level21") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.3)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level22") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.31)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level23") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.32)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level24") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.33)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level25") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.34)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level26") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.35)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level27") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.36)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level28") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.37)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level29") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.38)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and inst:HasTag("level30") and math.random() < freezechance2 and inst:HasTag("boost2") then
       target.components.freezable:AddColdness(0.4)
        target.components.freezable:SpawnShatterFX()

    end

    if target.components.sleeper and target.components.sleeper:IsAsleep() then
        target.components.sleeper:WakeUp()
    end
    if target.components.burnable and target.components.burnable:IsBurning() then
        target.components.burnable:Extinguish()
    end

    if target.components.combat then
        target.components.combat:SuggestTarget(attacker)


    end
	player:RemoveTag("frosta") 
end

local function OnDropped(inst,data)
   inst:AddTag("talkf")
    end
local function OnPutInInventory(inst)
   inst:RemoveTag("talkf")
    end

local function onequip(inst, owner)
   inst:AddTag("talkf")
    Upgradedamage(inst)
--inst.components.fueled:StartConsuming()        

local player = GetPlayer()
	player:AddTag("frosthammer") 
    owner.AnimState:OverrideSymbol("swap_object", "swap_mushasword_frost1", "swap_nightmaresword")
    owner.AnimState:Show("ARM_carry") 
    owner.AnimState:Hide("ARM_normal") 
if inst.level >=0 and inst.level <250 then
    owner.AnimState:OverrideSymbol("swap_object", "swap_mushasword_base", "swap_nightmaresword")
    owner.AnimState:Show("ARM_carry") 
    owner.AnimState:Hide("ARM_normal") 
elseif inst.level >=250 and inst.level <1400 then
    owner.AnimState:OverrideSymbol("swap_object", "swap_mushasword_frost1", "swap_nightmaresword")
    owner.AnimState:Show("ARM_carry") 
    owner.AnimState:Hide("ARM_normal") 
elseif inst.level >=1400 then
    owner.AnimState:OverrideSymbol("swap_object", "swap_mushasword_frost2", "swap_nightmaresword")
    owner.AnimState:Show("ARM_carry") 
    owner.AnimState:Hide("ARM_normal") 
        inst.entity:AddLight()
	inst.Light:SetRadius(.8)
    inst.Light:SetFalloff(.5)
    inst.Light:SetIntensity(.5)
    inst.Light:SetColour(80/255,120/255,250/255)
end
end

local function onunequip(inst, owner) 
   inst:RemoveTag("talkf")
    inst:RemoveComponent("blinkstaff")
    Upgradedamage(inst)
inst:RemoveTag("boost") 
	inst:RemoveTag("boost2") 
    if inst.task then inst.task:Cancel() inst.task = nil end
local player = GetPlayer()
    owner.AnimState:Hide("ARM_carry") 
    owner.AnimState:Show("ARM_normal") 
		player:RemoveTag("frosthammer") 
		player:RemoveTag("frosta") 

end

local function consume(inst, owner)
if not inst:HasTag("broken") then
inst.components.fueled:DoDelta(-50000)
end
end

  local function boost(inst, data, owner, fname_override)
local player = GetPlayer()
        local owner = inst.components.inventoryitem.owner
if owner and inst:HasTag("broken") then
	inst:RemoveTag("boost") 
	inst:RemoveTag("boost2") 
	player.components.talker:Say("±ù Ëª ·ï »Ë ½£ ¶Ï ÁË £¡")
	inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ]\nÄÍ ¾Ã ¶È (0)")
    inst.components.equippable.walkspeedmult = 1
	inst.Light:Enable(false)
    owner.AnimState:OverrideSymbol("swap_object", "swap_mushasword_base", "swap_nightmaresword")
    owner.AnimState:Show("ARM_carry") 
    owner.AnimState:Hide("ARM_normal") 
        inst.components.useableitem:StopUsingItem()
end
if owner and not inst:HasTag("boost") and not inst:HasTag("broken") then
	inst:AddTag("boost")
	player.components.talker:Say("¶¯ Á¦ ½£ !")
    inst.task = inst:DoPeriodicTask(1, function() consume(inst, owner) end)
  inst.SoundEmitter:PlaySound("dontstarve/common/gem_shatter")
        inst.entity:AddLight()
		local fx = SpawnPrefab("splash")
	local pos = Vector3(inst.Transform:GetWorldPosition())
fx.Transform:SetPosition(pos:Get())

        inst.components.useableitem:StopUsingItem()

if inst.level >=0 and inst.level <250 then
	inst.components.talker:Say("-[ ¶¯ Á¦ ½£ I ]\n¼Ó ËÙ (10)\n·¢ ¹â ( Ð¡ )\nµç Á¦ ¹¥ »÷")
    inst.components.equippable.walkspeedmult = 1.1
	inst.Light:SetRadius(.4)
    inst.Light:SetFalloff(.5)
    inst.Light:SetIntensity(.5)
    inst.Light:SetColour(80/255,120/255,250/255)
	inst.Light:Enable(true)
    owner.AnimState:OverrideSymbol("swap_object", "swap_mushasword_frost1", "swap_nightmaresword")
    owner.AnimState:Show("ARM_carry") 
    owner.AnimState:Hide("ARM_normal") 
elseif inst.level >=250 and inst.level <1400 then
	inst.components.talker:Say("-[ ¶¯ Á¦ ½£ II]\n¼Ó ËÙ (20)\n·¢ ¹â ( ÖÐ )\nµç Á¦ ¹¥ »÷\nÉÁ Ë¸")
    inst:AddComponent("blinkstaff")
    inst.components.blinkstaff.onblinkfn = onblink
        inst:AddComponent("reticule")
    inst.components.reticule.targetfn = function() 
        return inst.components.blinkstaff:GetBlinkPoint()
    end
    inst.components.reticule.ease = true
    inst:AddTag("nopunch")
    inst.components.equippable.walkspeedmult = 1.2
	inst.Light:SetRadius(.6)
    inst.Light:SetFalloff(.5)
    inst.Light:SetIntensity(.5)
    inst.Light:SetColour(80/255,120/255,250/255)
	inst.Light:Enable(true)
    owner.AnimState:OverrideSymbol("swap_object", "swap_mushasword_frost2", "swap_nightmaresword")
    owner.AnimState:Show("ARM_carry") 
    owner.AnimState:Hide("ARM_normal") 
elseif inst.level >=1400 then
	inst.components.talker:Say("-[ ¶¯ Á¦ ½£ III]\n¼Ó ËÙ (30)\n·¢ ¹â ( ´ó )\nµç Á¦ ¹¥ »÷\nÉÁ Ë¸\nË« ÖØ ¶³ ½á")
    inst:AddComponent("blinkstaff")
    inst.components.blinkstaff.onblinkfn = onblink
        inst:AddComponent("reticule")
    inst.components.reticule.targetfn = function() 
        return inst.components.blinkstaff:GetBlinkPoint()
    end
    inst.components.reticule.ease = true
    inst:AddTag("nopunch")
    inst:AddTag("boost2")
    inst.components.equippable.walkspeedmult = 1.3
	inst.Light:SetRadius(.8)
    inst.Light:SetFalloff(.5)
    inst.Light:SetIntensity(.5)
    inst.Light:SetColour(80/255,120/255,250/255)
	inst.Light:Enable(true)
    owner.AnimState:OverrideSymbol("swap_object", "swap_mushasword_frost3", "swap_nightmaresword")
    owner.AnimState:Show("ARM_carry") 
    owner.AnimState:Hide("ARM_normal") 
end
-----------
elseif owner and inst:HasTag("boost") and not inst:HasTag("broken") then
	inst:RemoveTag("boost") 
	inst:RemoveTag("boost2") 
	player.components.talker:Say("Power off !")
	inst.components.talker:Say("-[ ±ù Ëª ·ï »Ë ½£ ]\n¹Ø ±Õ µç Ô´")
    inst:RemoveComponent("blinkstaff")
    if inst.task then inst.task:Cancel() inst.task = nil end
    inst.components.equippable.walkspeedmult = 1
    inst.components.equippable.runspeedmult = 1
	inst.Light:Enable(false)
		local fx = SpawnPrefab("splash")
	local pos = Vector3(inst.Transform:GetWorldPosition())
fx.Transform:SetPosition(pos:Get())
  inst.SoundEmitter:PlaySound("dontstarve/common/fireOut")

if inst.level >=0 and inst.level <250 then
    owner.AnimState:OverrideSymbol("swap_object", "swap_mushasword_base", "swap_nightmaresword")
    owner.AnimState:Show("ARM_carry") 
    owner.AnimState:Hide("ARM_normal") 
elseif inst.level >=250 and inst.level <1400 then
    owner.AnimState:OverrideSymbol("swap_object", "swap_mushasword_frost1", "swap_nightmaresword")
    owner.AnimState:Show("ARM_carry") 
    owner.AnimState:Hide("ARM_normal") 
elseif inst.level >=1400 then
    owner.AnimState:OverrideSymbol("swap_object", "swap_mushasword_frost2", "swap_nightmaresword")
    owner.AnimState:Show("ARM_carry") 
    owner.AnimState:Hide("ARM_normal") 
end

        inst.components.useableitem:StopUsingItem()
end
end

local function fn(Sim)
	local inst = CreateEntity()
	local trans = inst.entity:AddTransform()
	local anim = inst.entity:AddAnimState()
    MakeInventoryPhysics(inst)
    	inst.entity:AddSoundEmitter()

    inst.AnimState:SetBank("nightmaresword")
    inst.AnimState:SetBuild("mushasword_frost")
    inst.AnimState:PlayAnimation("idle")
    inst.AnimState:SetMultColour(1, 1, 1, 0.7)

    inst:AddTag("sharp")
    
    inst:AddComponent("weapon")
    inst.components.weapon:SetOnAttack(Upgradedamage)

      inst.components.weapon:SetOnAttack(onattack_Frost)

    -------
    
    inst:AddComponent("inspectable")
        inst:AddComponent("inventoryitem")
    inst.components.inventoryitem:SetOnDroppedFn(OnDropped)
    inst.components.inventoryitem:SetOnPutInInventoryFn(OnPutInInventory)
    	inst.components.inventoryitem.atlasname = "images/inventoryimages/mushasword_frost.xml"
     inst.entity:AddMiniMapEntity()
	inst.MiniMapEntity:SetIcon( "blade_f.tex" )

        inst.entity:AddLight()
	inst.Light:SetRadius(.4)
    inst.Light:SetFalloff(.5)
    inst.Light:SetIntensity(.5)
    inst.Light:SetColour(80/255,120/255,250/255)
	inst.Light:Enable(true)

    inst.OnLoad = OnLoad

    inst:AddComponent("talker")
    inst.components.talker.fontsize = 19
    inst.components.talker.font = TALKINGFONT
    inst.components.talker.colour = Vector3(0.7, 0.85, 1, 1)
    inst.components.talker.offset = Vector3(200,-250,0)

    inst.components.talker.symbol = "swap_object"

            inst:AddComponent("useableitem")
     inst.components.useableitem:SetOnUseFn(boost)
    inst:AddComponent("equippable")
    inst.components.equippable:SetOnEquip( onequip )
    inst.components.equippable:SetOnUnequip( onunequip )

  --[[  inst:AddComponent("blinkstaff")
    inst.components.blinkstaff.onblinkfn = onblink
        inst:AddComponent("reticule")
    inst.components.reticule.targetfn = function() 
        return inst.components.blinkstaff:GetBlinkPoint()
    end
    inst.components.reticule.ease = true
    inst:AddTag("nopunch")]]

        inst:AddComponent("fueled")
       inst.components.fueled.fueltype = "CHEMICAL"
        inst.components.fueled:InitializeFuelLevel(30000000)
       inst.components.fueled:SetDepletedFn(OnDurability)
        inst.components.fueled.ontakefuelfn = TakeItem
        inst.components.fueled.accepting = true
inst.components.fueled:StopConsuming()        
inst:RemoveTag("boost") 
inst:AddTag("level1")
	inst.level = 0
inst:ListenForEvent("levelup", levelexp)
	inst.OnSave = onsave
	inst.OnPreLoad = onpreload

    return inst
end

return Prefab( "common/inventory/mushasword_frost", fn, assets) 
