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

local prefabs =
{
	--"collapse_small",
	--"collapse_big",
}
---------------------------
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("-[冰霜之锤] \n下一级:[10]\n[成长点数]".. (inst.level))
inst:AddTag("level1")
elseif inst.level >=10 and inst.level <30 then
inst.components.talker:Say("-[冰霜之锤] \n下一级:[30]\n[成长点数]".. (inst.level))
inst:AddTag("level2")
inst:RemoveTag("level1")
elseif inst.level >=30 and inst.level <60 then
inst.components.talker:Say("-[冰霜之锤] \n下一级:[60]\n[成长点数]".. (inst.level))
inst:AddTag("level3")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
elseif inst.level >=60 and inst.level <100 then
inst.components.talker:Say("-[冰霜之锤] \n下一级:[100]\n[成长点数]".. (inst.level))
inst:AddTag("level4")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
elseif inst.level >=100 and inst.level <150 then
inst.components.talker:Say("-[冰霜之锤] \n下一级:[150]\n[成长点数]".. (inst.level))
inst:AddTag("level5")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
elseif inst.level >=150 and inst.level <200 then
inst.components.talker:Say("-[冰霜之锤] \n下一级:[200]\n[成长点数]".. (inst.level))
inst:AddTag("level6")
inst:RemoveTag("level1")
inst:RemoveTag("level2")
inst:RemoveTag("level3")
inst:RemoveTag("level4")
inst:RemoveTag("level5")
elseif inst.level >=200 and inst.level <250 then
inst.components.talker:Say("-[冰霜之锤] \n下一级:[250]\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 >=250 and inst.level <300 then
inst.components.talker:Say("-[冰霜之锤] \n下一级:[300]\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 >=300 and inst.level <350 then
inst.components.talker:Say("-[冰霜之锤] \n下一级:[350]\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 >=350 and inst.level <450 then
inst.components.talker:Say("-[冰霜之锤] \n下一级:[450]\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 >=450 and inst.level <600 then
inst.components.talker:Say("-[冰霜之锤] \n下一级:[600]\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 >=600 and inst.level <700 then
inst.components.talker:Say("-[冰霜之锤] \n下一级:[700]\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 >=700 and inst.level <800 then
inst.components.talker:Say("-[冰霜之锤] \n下一级:[800]\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 >=800 and inst.level <900 then
inst.components.talker:Say("-[冰霜之锤] \n下一级:[900]\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 >=900 and inst.level <1000 then
inst.components.talker:Say("-[冰霜之锤] \n下一级:[1000]\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 >=1000 and inst.level <1100 then
inst.components.talker:Say("-[冰霜之锤] \n下一级:[1100]\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 >=1100 and inst.level <1200 then
inst.components.talker:Say("-[冰霜之锤] \n下一级:[1200]\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 >=1200 and inst.level <1300 then
inst.components.talker:Say("-[冰霜之锤] \n下一级:[1300]\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 >=1300 and inst.level <1400 then
inst.components.talker:Say("-[冰霜之锤] \n下一级:[1400]\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 >=1400 and inst.level <1500 then
inst.components.talker:Say("-[冰霜之锤] \n下一级:[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 >=1500 and inst.level <1600 then
inst.components.talker:Say("-[冰霜之锤] \n下一级:[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("-[冰霜之锤] \n下一级:[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("-[冰霜之锤] \n下一级:[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("-[冰霜之锤] \n下一级:[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("-[冰霜之锤] \n下一级:[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("-[冰霜之锤] \n下一级:[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("-[冰霜之锤] \n下一级:[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("-[冰霜之锤] \n下一级:[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("-[冰霜之锤] \n下一级:[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[满级]")
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 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(40)
	inst.components.talker:Say("-[冰霜之锤 (1级)]\n伤害 (40)\n属性攻击(1%)")
        elseif inst:HasTag("level2") then
    inst.components.weapon:SetDamage(41)
	inst.components.talker:Say("-[冰霜之锤 (2级)]\n伤害 (41)\n属性攻击(2%)")
        elseif inst:HasTag("level3") then
    inst.components.weapon:SetDamage(42)
	inst.components.talker:Say("-[冰霜之锤 (3级)]\n伤害 (42)\n属性攻击(3%)")
        elseif inst:HasTag("level4") then
    inst.components.weapon:SetDamage(43)
	inst.components.talker:Say("-[冰霜之锤 (4级)]\n伤害 (43)\n属性攻击(4%)")
        elseif inst:HasTag("level5") then
    inst.components.weapon:SetDamage(44)
	inst.components.talker:Say("-[冰霜之锤 (5级)]\n伤害 (44)\n属性攻击(5%)")
        elseif inst:HasTag("level6") then
    inst.components.weapon:SetDamage(45)
	inst.components.talker:Say("-[冰霜之锤 (6级)]\n伤害 (45)\n属性攻击(6%)")
        elseif inst:HasTag("level7") then
    inst.components.weapon:SetDamage(46)
	inst.components.talker:Say("-[冰霜之锤 (7级)]\n伤害 (46)\n属性攻击(7%)")
        elseif inst:HasTag("level8") then
    inst.components.weapon:SetDamage(47)
	inst.components.talker:Say("-[冰霜之锤 (8级)]\n伤害 (47)\n属性攻击(8%)")
        elseif inst:HasTag("level9") then
    inst.components.weapon:SetDamage(48)
	inst.components.talker:Say("-[冰霜之锤 (9级)]\n伤害 (48)\n属性攻击(9%)")
        elseif inst:HasTag("level10") then
    inst.components.weapon:SetDamage(49)
	inst.components.talker:Say("-[冰霜之锤 (10级)]\n伤害 (49)\n属性攻击(10%)")
        elseif inst:HasTag("level11") then
    inst.components.weapon:SetDamage(50)
	inst.components.talker:Say("-[冰霜之锤 (11级)]\n伤害 (50)\n属性攻击(11%)")
        elseif inst:HasTag("level12") then
    inst.components.weapon:SetDamage(51)
	inst.components.talker:Say("-[冰霜之锤 (12级)]\n伤害 (51)\n属性攻击(12%)")
        elseif inst:HasTag("level13") then
    inst.components.weapon:SetDamage(52)
	inst.components.talker:Say("-[冰霜之锤 (13级)]\n伤害 (52)\n属性攻击(13%)")
        elseif inst:HasTag("level14") then
    inst.components.weapon:SetDamage(53)
	inst.components.talker:Say("-[冰霜之锤 (14级)]\n伤害 (53)\n属性攻击(14%)")
        elseif inst:HasTag("level15") then
    inst.components.weapon:SetDamage(54)
	inst.components.talker:Say("-[冰霜之锤 (15级)]\n伤害 (54)\n属性攻击(15%)")
        elseif inst:HasTag("level16") then
    inst.components.weapon:SetDamage(55)
	inst.components.talker:Say("-[冰霜之锤 (16级)]\n伤害 (55)\n属性攻击(16%)")
        elseif inst:HasTag("level17") then
    inst.components.weapon:SetDamage(56)
	inst.components.talker:Say("-[冰霜之锤 (17级)]\n伤害 (56)\n属性攻击(17%)")
        elseif inst:HasTag("level18") then
    inst.components.weapon:SetDamage(57)
	inst.components.talker:Say("-[冰霜之锤 (18级)]\n伤害 (57)\n属性攻击(18%)")
        elseif inst:HasTag("level19") then
    inst.components.weapon:SetDamage(58)
	inst.components.talker:Say("-[冰霜之锤 (19级)]\n伤害 (58)\n属性攻击(19%)")
        elseif inst:HasTag("level20") then
    inst.components.weapon:SetDamage(59)
	inst.components.talker:Say("-[冰霜之锤 (20级)]\n伤害 (59)\n属性攻击(20%)")
        elseif inst:HasTag("level21") then
    inst.components.weapon:SetDamage(60)
	inst.components.talker:Say("-[冰霜之锤 (21级)]\n伤害 (60)\n属性攻击(21%)")
        elseif inst:HasTag("level22") then
    inst.components.weapon:SetDamage(61)
	inst.components.talker:Say("-[冰霜之锤 (22级)]\n伤害 (61)\n属性攻击(22%)")
        elseif inst:HasTag("level23") then
    inst.components.weapon:SetDamage(62)
	inst.components.talker:Say("-[冰霜之锤 (23级)]\n伤害 (62)\n属性攻击(23%)")
        elseif inst:HasTag("level24") then
    inst.components.weapon:SetDamage(63)
	inst.components.talker:Say("-[冰霜之锤 (24级)]\n伤害 (63)\n属性攻击(24%)")
        elseif inst:HasTag("level25") then
    inst.components.weapon:SetDamage(64)
	inst.components.talker:Say("-[冰霜之锤 (25级)]\n伤害 (64)\n属性攻击(25%)")
        elseif inst:HasTag("level26") then
    inst.components.weapon:SetDamage(65)
	inst.components.talker:Say("-[冰霜之锤 (26级)]\n伤害 (65)\n属性攻击(26%)")
        elseif inst:HasTag("level27") then
    inst.components.weapon:SetDamage(66)
	inst.components.talker:Say("-[冰霜之锤 (27级)]\n伤害 (66)\n属性攻击(27%)")
        elseif inst:HasTag("level28") then
    inst.components.weapon:SetDamage(67)
	inst.components.talker:Say("-[冰霜之锤 (28级)]\n伤害 (67)\n属性攻击(28%)")
        elseif inst:HasTag("level29") then
    inst.components.weapon:SetDamage(68)
	inst.components.talker:Say("-[冰霜之锤 (29级)]\n伤害 (68)\n属性攻击(29%)")
        elseif inst:HasTag("level30") then
    inst.components.weapon:SetDamage(70)
	inst.components.talker:Say("-[冰霜之锤 (满级30级)]\n伤害 (70)\n属性攻击(30%)")
end
end
end

-------- --------
local function TakeItem(inst, item, data)
local expchance0 = 1
local expchance1 = 0.3
local expchance2 = 0.2
local expchance3 = 0.12
	inst.components.fueled:DoDelta(5000000)
	SpawnPrefab("splash").Transform:SetPosition(inst:GetPosition():Get())
inst:RemoveTag ("broken")     
Upgradedamage(inst)
   if math.random() < expchance1 and inst.level <= 4005 then
	inst.level = inst.level + 2
	levelexp(inst)
	inst.components.talker:Say("幸运点数 ! +(2)\n[成长点数]".. (inst.level))
    elseif  math.random() < expchance2 and inst.level <= 4005 then
	inst.level = inst.level + 5
	levelexp(inst)
	inst.components.talker:Say("幸运点数 ! +(5)\n[成长点数]".. (inst.level))
	elseif  math.random() < expchance3 and inst.level <= 4005 then
	inst.level = inst.level + 8
	levelexp(inst)
	inst.components.talker:Say("幸运点数 ! +(8)\n[成长点数]".. (inst.level))
	elseif  math.random() < expchance0 and inst.level <= 4005 then
	inst.level = inst.level + 1
	levelexp(inst)
    end
end

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

--------
local function cansummon(staff, caster, target, pos)
    local ground = GetWorld()
    if ground and pos then
        local tile = ground.Map:GetTileAtPoint(pos.x, pos.y, pos.z)
        return tile ~= GROUND.IMPASSIBLE and tile < GROUND.UNDERGROUND
    end
    return false
end

local function summoning(staff, target, pos)
local player = GetPlayer()
    local caster = staff.components.inventoryitem.owner
if caster.components.sanity.current >= 40 then
    local light = SpawnPrefab("splash")
    local light2 = SpawnPrefab("tentacle_frost")

    light.Transform:SetPosition(pos.x, pos.y, pos.z)
    light2.Transform:SetPosition(pos.x, pos.y, pos.z)
        light2.components.follower:SetLeader(player)
caster.components.sanity:DoDelta(-30)

    elseif caster.components.sanity.current < 40 then
	player.components.talker:Say("没有足够的 [SAN]..")
        
    end

end


local function onattack_FROST(inst, attacker, target)
local freezechance1 = 0.01
local freezechance2 = 0.02
local freezechance3 = 0.03
local freezechance4 = 0.04
local freezechance5 = 0.05
local freezechance6 = 0.06
local freezechance7 = 0.07
local freezechance8 = 0.08
local freezechance9 = 0.09
local freezechance10 = 0.1
local freezechance11 = 0.11
local freezechance12 = 0.12
local freezechance13 = 0.13
local freezechance14 = 0.14
local freezechance15 = 0.15
local freezechance16 = 0.16
local freezechance17 = 0.17
local freezechance18 = 0.18
local freezechance19 = 0.19
local freezechance20 = 0.2
local freezechance21 = 0.21
local freezechance22 = 0.22
local freezechance23 = 0.23
local freezechance24 = 0.24
local freezechance28 = 0.25
local freezechance26 = 0.26
local freezechance27 = 0.27
local freezechance28 = 0.28
local freezechance29 = 0.29
local freezechance30 = 0.3

local player = GetPlayer()

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") and inst.level < 4010 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 not player:HasTag("frosta") then
        target.components.freezable:AddColdness(0.15)
        target.components.freezable:SpawnShatterFX()
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance1 and inst:HasTag("level1") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
        target.components.health:DoDelta(-20)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance2 and inst:HasTag("level2") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
        target.components.health:DoDelta(-21)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance3 and inst:HasTag("level3") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
        target.components.health:DoDelta(-22)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance4 and inst:HasTag("level4") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-23)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance5 and inst:HasTag("level5") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-24)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance6 and inst:HasTag("level6") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-25)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance7 and inst:HasTag("level7") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-26)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance8 and inst:HasTag("level8") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-27)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance9 and inst:HasTag("level9") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-28)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance10 and inst:HasTag("level10") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-29)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance11 and inst:HasTag("level11") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-30)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance12 and inst:HasTag("level12") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-31)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance13 and inst:HasTag("level13") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-32)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance14 and inst:HasTag("level14") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-33)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance15 and inst:HasTag("level15") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-34)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance16 and inst:HasTag("level16") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-35)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance17 and inst:HasTag("level17") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-36)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance18 and inst:HasTag("level18") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-37)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance19 and inst:HasTag("level19") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-38)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance20 and inst:HasTag("level20") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-39)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance21 and inst:HasTag("level21") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-40)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance22 and inst:HasTag("level22") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-41)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance23 and inst:HasTag("level23") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-42)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance24 and inst:HasTag("level24") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-43)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance25 and inst:HasTag("level25") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-44)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance26 and inst:HasTag("level26") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-45)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance27 and inst:HasTag("level27") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-46)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance28 and inst:HasTag("level28") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-47)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance29 and inst:HasTag("level29") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-48)
     elseif target.components.freezable and not player:HasTag("frosta") and math.random() < freezechance30 and inst:HasTag("level30") and target.components.health then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
      target.components.health:DoDelta(-50)

elseif target.components.freezable and player:HasTag("frosta") and not player:HasTag("DLC") then
        target.components.freezable:AddColdness(10)
        target.components.freezable:SpawnShatterFX()
local fx = SpawnPrefab("statue_transition_2")
local pos = Vector3(target.Transform:GetWorldPosition())
	fx.Transform:SetPosition(pos:Get())
		target.components.health:DoDelta(-90)
	player:RemoveTag("frosta") 
elseif target.components.freezable and player:HasTag("frosta") and player:HasTag("DLC") then
        target.components.freezable:AddColdness(10)
        target.components.freezable:SpawnShatterFX()
        attacker.components.sanity:DoDelta(-20)
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.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) 
local player = GetPlayer()
   inst:AddTag("talkf")
    Upgradedamage(inst)

    owner.AnimState:OverrideSymbol("swap_object", "swap_frosthammer", "swap_umbrella")
    owner.AnimState:Show("ARM_carry") 
    owner.AnimState:Hide("ARM_normal") 
	player:AddTag("frosthammer") 

 --   owner.components.inventory:SetOverflow(inst)
-- inst.components.container:Open(owner)

end

local function onunequip(inst, owner) 
   inst:RemoveTag("talkf")
local player = GetPlayer()
    owner.AnimState:Hide("ARM_carry") 
    owner.AnimState:Show("ARM_normal") 
--    owner.components.inventory:SetOverflow(nil)
    inst.components.container:Close(owner)
	player:RemoveTag("frosthammer") 
	player:RemoveTag("frosta") 
       inst:RemoveComponent("spellcaster")
      inst:RemoveComponent("heater")

 end
 
local function OnOpen(inst)
  inst.SoundEmitter:PlaySound("dontstarve/common/gem_shatter")
	inst.components.talker:Say("-[冰霜之锤]\n速度下降(大)\n召唤怪物\n降温\n(无冰箱效果)")
    inst.components.equippable.walkspeedmult = 0.6
      inst:AddComponent("heater")
     inst.components.heater.iscooler = true
     inst.components.heater.equippedheat = -1
       inst:AddComponent("spellcaster")
    inst.components.spellcaster:SetSpellFn(summoning)
    inst.components.spellcaster:SetSpellTestFn(cansummon)
    inst.components.spellcaster.canuseonpoint = true
    inst.components.spellcaster.canusefrominventory = false
	inst:AddTag("nocool")

end 

local function OnClose(inst) 
  inst.SoundEmitter:PlaySound("dontstarve/common/fireOut")
	inst.components.talker:Say("-[冰霜之锤]\n速度下降(小)\n冷冰箱\n\n")
    inst.components.equippable.walkspeedmult = 0.8
       inst:RemoveComponent("spellcaster")
      inst:RemoveComponent("heater")
	inst:RemoveTag("nocool")

end 

local slotpos_2 = {}

for y = 0, 1 do
table.insert(slotpos_2, Vector3(-126, -y*75 + 114 ,-126 +75, -y*75 + 114 ))

	--table.insert(slotpos_2, Vector3(-162, -y*75 + 114 ,0))
	--table.insert(slotpos_2, Vector3( -162 +75, -y*75 + 114 ,0))

end



local function itemtest(inst, item, slot)
	if not item:HasTag("tstonehammer") then
			return true
end
end

local function fn(Sim)

	local inst = CreateEntity()
	local trans = inst.entity:AddTransform()
	local anim = inst.entity:AddAnimState()
	inst.entity:AddSoundEmitter()

    MakeInventoryPhysics(inst)

 --   anim:SetBank("hammer")
    anim:SetBank("umbrella")

    anim:SetBuild("frosthammer")
    anim:PlayAnimation("idle")
     
    inst:AddComponent("weapon")
    inst.components.weapon:SetOnAttack(Upgradedamage)

    inst.components.weapon:SetRange(1.65)
	
  inst.components.weapon:SetOnAttack(onattack_FROST)
  

    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("tool")
    inst.components.tool:SetAction(ACTIONS.HAMMER)
    -------
    -------
    
    inst:AddComponent("inspectable")
    
    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem:SetOnDroppedFn(OnDropped)
    inst.components.inventoryitem:SetOnPutInInventoryFn(OnPutInInventory)
    	inst.components.inventoryitem.atlasname = "images/inventoryimages/frosthammer.xml"
     inst.entity:AddMiniMapEntity()
	inst.MiniMapEntity:SetIcon( "frosthammer.tex" )
   ---------------------  
	inst:AddTag("fridge")
     
     ----------------------
    inst:AddComponent("container")
    inst.components.container.itemtestfn = itemtest
    inst.components.container:SetNumSlots(#slotpos_2)
    inst.components.container.onopenfn = OnOpen
    inst.components.container.onclosefn = OnClose
    
    inst.components.container.widgetslotpos = slotpos_2
    inst.components.container.widgetanimbank = "ui_backpack_2x4"
    inst.components.container.widgetanimbuild = "ui_frostsmall"

   -- inst.components.container.widgetpos = Vector3(120,-180,0)
   -- inst.components.container.widgetpos = Vector3(-5,-50,0)
    inst.components.container.widgetpos = Vector3(-9,75,0)

    inst.components.container.side_widget = true

    --inst.components.container.side_align_tip = 160
   -- inst.components.container.acceptsstacks = false
   -- inst.components.container.type = "pack"

------------------------
        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:AddComponent("equippable")

    inst.components.equippable:SetOnEquip( onequip )
    inst.components.equippable:SetOnUnequip( onunequip )

    inst.components.equippable.walkspeedmult = 0.7
    inst.components.equippable.runspeedmult = 0.7

    inst:AddComponent("reticule")
    inst.components.reticule.targetfn = function() 
        return Vector3(GetPlayer().entity:LocalToWorldSpace(5,0,0))
    end
    inst.components.reticule.ease = true

    inst:AddTag("nopunch")
inst:AddTag("level1")
	inst.level = 0
inst:ListenForEvent("levelup", levelexp)
	inst.OnSave = onsave
	inst.OnPreLoad = onpreload

    return inst
end


return Prefab( "common/inventory/frosthammer", fn, assets, prefabs) 
