local MakePlayerCharacter = require "prefabs/player_common"

local assets = {
        Asset( "ANIM", "anim/player_basic.zip" ),
        Asset( "ANIM", "anim/player_idles_shiver.zip" ),
        Asset( "ANIM", "anim/player_actions.zip" ),
        Asset( "ANIM", "anim/player_actions_axe.zip" ),
        Asset( "ANIM", "anim/player_actions_pickaxe.zip" ),
        Asset( "ANIM", "anim/player_actions_shovel.zip" ),
        Asset( "ANIM", "anim/player_actions_blowdart.zip" ),
        Asset( "ANIM", "anim/player_actions_eat.zip" ),
        Asset( "ANIM", "anim/player_actions_item.zip" ),
        Asset( "ANIM", "anim/player_actions_uniqueitem.zip" ),
        Asset( "ANIM", "anim/player_actions_bugnet.zip" ),
        Asset( "ANIM", "anim/player_actions_fishing.zip" ),
        Asset( "ANIM", "anim/player_actions_boomerang.zip" ),
        Asset( "ANIM", "anim/player_bush_hat.zip" ),
        Asset( "ANIM", "anim/player_attacks.zip" ),
        Asset( "ANIM", "anim/player_idles.zip" ),
        Asset( "ANIM", "anim/player_rebirth.zip" ),
        Asset( "ANIM", "anim/player_jump.zip" ),
        Asset( "ANIM", "anim/player_amulet_resurrect.zip" ),
        Asset( "ANIM", "anim/player_teleport.zip" ),
        Asset( "ANIM", "anim/wilson_fx.zip" ),
        Asset( "ANIM", "anim/player_one_man_band.zip" ),
        Asset( "ANIM", "anim/shadow_hands.zip" ),
        Asset( "SOUND", "sound/sfx.fsb" ),
        Asset( "SOUND", "sound/maxwell.fsb" ),
	Asset("SOUND", "sound/willow.fsb"),    
        Asset( "ANIM", "anim/beard.zip" ),

        Asset( "ANIM", "anim/musha_battle.zip" ),
        Asset( "ANIM", "anim/musha.zip" ),
        Asset( "ANIM", "anim/musha_normal.zip" ),
Asset( "ANIM", "anim/musha_hunger.zip" ),
}
local prefabs = {
	"shadowmusha",
        "book_birds",
        "book_tentacles",
        "book_gardening",
        "book_sleep",
        "book_brimstone",
}

local start_inv = 
{
      "musha_small",
 --     "musha_egg",
      "broken_frosthammer",
   --   "frosthammer",
   --   "hat_mbunny",
   --   "hat_mcrown",
     "hat_mprincess",
   --   "armor_mushaa",
   --   "armor_mushab",
	"mushasword_base",
--	"mushasword",
--	"mushasword2",
--	"mushasword3",
--	"mushasword4",
--	"musha_flute",
	"glowdust",
	"glowdust",
	"glowdust",
--	"cristal",
}

local function levelexp(inst,data)

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

	--local hunger_percent = inst.components.hunger:GetPercent()
	local health_percent = inst.components.health:GetPercent()
	local sanity_percent = inst.components.sanity:GetPercent()

	--inst.components.hunger.max = math.ceil (200 + exp* 0.02)
	--inst.components.health.maxhealth = math.ceil (50 + exp* 0.05)
	--inst.components.sanity.max = math.ceil (100 + exp* 0.05)
	
	inst.components.talker:Say("[经验] \n".. (inst.level))
 --inst.components.talker:Say("[下一级 : 升级] \n 经验 ".. (inst.level))

--[test]
--[[
if inst.level >0 then
inst:AddTag("level1")
	inst:AddTag("healshield1")
	inst:AddTag("hitcritical1")
	inst:AddTag("Valkyrie")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("fshield1")
	inst:AddTag("hpregen1")
	inst:AddTag("hitfreeze1")
	inst:AddTag("lessercure1")
	inst:AddTag("cure0")
 	inst:AddTag("berserkarmor")
 	inst:AddTag("shadowimage")
 	inst:AddTag("backstab")

]]--
			if inst.level >0 and inst.level <= 4 then
--inst.components.talker:Say("下一级 :经验[5]\n[当前经验] ".. (inst.level))
inst:AddTag("level1")

			elseif inst.level >4 and inst.level <= 5 then
	inst.components.talker:Say("等级 2\n 解锁 : [闪电护盾]\n 解锁 : [护盾]")
	inst:AddTag("healshield1")
	inst:AddTag("cure0")
	inst:AddTag("level2")
	inst:RemoveTag("level1")

inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")


			elseif inst.level >5 and inst.level <= 9 then
--inst.components.talker:Say("下一级 :经验[10]\n[当前经验] + ".. (inst.level))
	inst:AddTag("healshield1")
	inst:AddTag("cure0")
	inst:AddTag("level2")
	inst:RemoveTag("level1")

		elseif inst.level >9 and inst.level <= 10 then
	inst.components.talker:Say("等级 3\n 解锁 : [女武神状态]\n1/1")
	inst:AddTag("Valkyrie")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("healshield1")
	inst:AddTag("cure0")
	inst:AddTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

			elseif inst.level >10 and inst.level <= 29 then
--inst.components.talker:Say("下一级 :经验[30]\n[当前经验] + ".. (inst.level))
	inst:AddTag("Valkyrie")
	inst:AddTag("healshield1")
	inst:AddTag("cure0")
	inst:AddTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

		elseif inst.level >29 and inst.level <= 30 then
	inst.components.talker:Say("等级 4\n 解锁 : [致命一击]\n1/4")
	inst:AddTag("hitcritical1")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("Valkyrie")
	inst:AddTag("healshield1")
	inst:AddTag("cure0")
	inst:AddTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

			elseif inst.level > 30 and inst.level <= 49  then
--inst.components.talker:Say("下一级 :经验[50]\n[当前经验] + ".. (inst.level))
	inst:AddTag("hitcritical1")
	inst:AddTag("Valkyrie")
	inst:AddTag("healshield1")
	inst:AddTag("cure0")
	inst:AddTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

		elseif inst.level >49 and inst.level <= 50 then
	inst.components.talker:Say("等级 5\n 解锁 : [闪电攻击]\n1/2")
	inst:AddTag("hitlightning1")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("Valkyrie")
	inst:AddTag("healshield1")
	inst:AddTag("hitcritical1")
	inst:AddTag("cure0")
	inst:AddTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")


			elseif inst.level >50 and inst.level <=79  then
--inst.components.talker:Say("下一级 :经验[80]\n[当前经验] + ".. (inst.level))
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:AddTag("healshield1")
	inst:AddTag("hitcritical1")
	inst:AddTag("cure0")
	inst:AddTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

		elseif inst.level >79 and inst.level <= 80 then
	inst.components.talker:Say("等级 6\n 解锁 : [小治疗]\n1/2")
	inst:AddTag("lessercure1")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:AddTag("healshield1")
	inst:AddTag("hitcritical1")
	inst:AddTag("cure0")
	inst:AddTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

			elseif inst.level >80 and inst.level <=124  then
--inst.components.talker:Say("下一级 :经验[125]\n[当前经验] + ".. (inst.level))
	inst:AddTag("lessercure1")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:AddTag("healshield1")
	inst:AddTag("hitcritical1")
	inst:AddTag("cure0")
	inst:AddTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

		elseif inst.level >124 and inst.level <= 125 then
	inst.components.talker:Say("等级 7\n 解锁 : [狂暴状态]\n1/1")
	inst:AddTag("Berserk")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("lessercure1")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:AddTag("healshield1")
	inst:AddTag("hitcritical1")
	inst:AddTag("cure0")
	inst:AddTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

			elseif inst.level >125 and inst.level <=199  then
--inst.components.talker:Say("下一级 :经验[200]\n[当前经验] + ".. (inst.level))
inst:AddTag("Berserk")
	inst:AddTag("lessercure1")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:AddTag("healshield1")
	inst:AddTag("hitcritical1")
	inst:AddTag("cure0")
	inst:AddTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

		elseif inst.level >199 and inst.level <= 200 then
	inst.components.talker:Say("等级 8\n 解锁 : [火焰护盾]\n1/4")
	inst:AddTag("fshield1")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
inst:AddTag("Berserk")
	inst:AddTag("lessercure1")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:AddTag("healshield1")
	inst:AddTag("hitcritical1")
	inst:AddTag("cure0")
	inst:AddTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

			elseif inst.level >200 and inst.level <=339  then
--inst.components.talker:Say("下一级 :经验[340]\n[当前经验] + ".. (inst.level))
	inst:AddTag("fshield1")
inst:AddTag("Berserk")
	inst:AddTag("lessercure1")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:AddTag("healshield1")
	inst:AddTag("hitcritical1")
	inst:AddTag("cure0")
	inst:AddTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")
		elseif inst.level >339 and inst.level <= 340 then
	inst.components.talker:Say("等级 9\n 解锁 : [血量回复]\n1/4")
	inst:AddTag("hpregen1")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("lessercure1")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:AddTag("healshield1")
	inst:AddTag("hitcritical1")
	inst:AddTag("cure0")
	inst:AddTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

			elseif inst.level >340 and inst.level <=429  then
--inst.components.talker:Say("下一级 :经验[430]\n[当前经验] + ".. (inst.level))
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("lessercure1")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:AddTag("healshield1")
	inst:AddTag("hitcritical1")
	inst:AddTag("cure0")
	inst:AddTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

		elseif inst.level >429 and inst.level <= 430 then
	inst.components.talker:Say("等级 10\n 解锁 : [背刺] 1/3\n 解锁 : [冻结攻击] 1/4")
	inst:AddTag("hitfreeze1")
 	inst:AddTag("backstab1") 
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("lessercure1")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:AddTag("healshield1")
	inst:AddTag("hitcritical1")
	inst:AddTag("cure0")
	inst:AddTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

			elseif inst.level >430 and inst.level <=529  then
--inst.components.talker:Say("下一级 :经验[530]\n[当前经验] + ".. (inst.level))
	inst:AddTag("hitfreeze1")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("lessercure1")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:AddTag("healshield1")
	inst:AddTag("hitcritical1")
	inst:AddTag("cure0")
	inst:AddTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")
 	inst:AddTag("backstab1") 

		elseif inst.level >529 and inst.level <= 530 then
	inst.components.talker:Say("等级 11\n 解锁 : [致命一击]\n2/4")
	inst:RemoveTag("hitcritical1")
	inst:AddTag("hitcritical2")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("hitfreeze1")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("lessercure1")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:AddTag("healshield1")
	inst:AddTag("cure0")
	inst:AddTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")
 	inst:AddTag("backstab1") 

			elseif inst.level >530 and inst.level <=639  then
--inst.components.talker:Say("下一级 :经验[640]\n[当前经验] + ".. (inst.level))
	inst:AddTag("hitcritical2")
	inst:AddTag("hitfreeze1")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("lessercure1")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:AddTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:AddTag("cure0")
	inst:AddTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")
 	inst:AddTag("backstab1") 

		elseif inst.level >639 and inst.level <= 640 then
	inst.components.talker:Say("等级 12\n 解锁 : [致命一击]\n3/4")
	inst:RemoveTag("hitcritical2")
	inst:AddTag("hitcritical3")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("hitfreeze1")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("lessercure1")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:AddTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:AddTag("cure0")
	inst:AddTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")
 	inst:AddTag("backstab1") 

			elseif inst.level >640 and inst.level <=759  then
--inst.components.talker:Say("下一级 :经验[760]\n[当前经验] + ".. (inst.level))
	inst:AddTag("hitcritical3")
	inst:AddTag("hitfreeze1")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("lessercure1")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:AddTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:AddTag("cure0")
	inst:AddTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")
 	inst:AddTag("backstab1") 

		elseif inst.level >759 and inst.level <= 760 then
inst.components.talker:Say("等级 13\n 解锁 : [致命一击 满级]\n4/4")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("hitcritical4")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("hitfreeze1")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("lessercure1")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:AddTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:AddTag("cure0")
	inst:AddTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")
 	inst:AddTag("backstab1") 

			elseif inst.level >760 and inst.level <=889  then
--inst.components.talker:Say("下一级 :经验[890]\n[当前经验] + ".. (inst.level))
	inst:AddTag("hitcritical4")
	inst:AddTag("hitfreeze1")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("lessercure1")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:AddTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")
 	inst:AddTag("backstab1") 

		elseif inst.level >889 and inst.level <= 890 then
	inst.components.talker:Say("等级 14\n 解锁 : [闪电护盾]\n2/4")
	inst:RemoveTag("healshield1")
	inst:AddTag("healshield2")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("hitcritical4")
	inst:AddTag("hitfreeze1")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("lessercure1")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")
 	inst:AddTag("backstab1") 

			elseif inst.level >890 and inst.level <=1029  then
--inst.components.talker:Say("下一级 :经验[1030]\n[当前经验] + ".. (inst.level))
	inst:AddTag("healshield2")
	inst:AddTag("hitcritical4")
	inst:AddTag("hitfreeze1")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("lessercure1")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")
 	inst:AddTag("backstab1") 

		elseif inst.level >1029 and inst.level <= 1030 then
	inst.components.talker:Say("等级 15\n 解锁 : [闪电护盾]\n3/4")
	inst:RemoveTag("healshield2")
	inst:AddTag("healshield3")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("hitcritical4")
	inst:AddTag("hitfreeze1")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("lessercure1")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")
 	inst:AddTag("backstab1") 

			elseif inst.level >1030 and inst.level <=1179  then
--inst.components.talker:Say("下一级 :经验[1180]\n[当前经验] + ".. (inst.level))
	inst:AddTag("healshield3")
	inst:AddTag("hitcritical4")
	inst:AddTag("hitfreeze1")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("lessercure1")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")
 	inst:AddTag("backstab1") 

		elseif inst.level >1179 and inst.level <= 1180 then
inst.components.talker:Say("等级 16\n 解锁 : [闪电护盾 满级]\n4/4")
	inst:RemoveTag("healshield3")
	inst:AddTag("healshield4")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("hitcritical4")
	inst:AddTag("hitfreeze1")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("lessercure1")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")
 	inst:AddTag("backstab1") 

			elseif inst.level >1180 and inst.level <=1339  then
--inst.components.talker:Say("下一级 :经验[1340]\n[当前经验] + ".. (inst.level))
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("hitfreeze1")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("lessercure1")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")
 	inst:AddTag("backstab1") 

		elseif inst.level >1339 and inst.level <= 1340 then
inst.components.talker:Say("等级 17\n 解锁 : [小治疗 满级]\n2/2")
	inst:RemoveTag("lessercure1")
	inst:AddTag("lessercure2")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("hitfreeze1")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")
 	inst:AddTag("backstab1") 

			elseif inst.level >1340 and inst.level <=1509  then
--inst.components.talker:Say("下一级 :经验[1510]\n[当前经验] + ".. (inst.level))
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("hitfreeze1")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")
 	inst:AddTag("backstab1") 

		elseif inst.level >1509 and inst.level <= 1510 then
	inst.components.talker:Say("等级 18\n 解锁 : [冻结攻击]\n2/4")
	inst:RemoveTag("hitfreeze1")
	inst:AddTag("hitfreeze2")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("hitfreeze1")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")
 	inst:AddTag("backstab1") 

			elseif inst.level >1510 and inst.level <=1689  then
--inst.components.talker:Say("下一级 :经验[1690]\n[当前经验] + ".. (inst.level))
	inst:AddTag("hitfreeze2")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")
 	inst:AddTag("backstab1") 

		elseif inst.level >1689 and inst.level <= 1690 then
inst.components.talker:Say("等级 19\n 解锁 : [冻结攻击]\n3/4")
	inst:RemoveTag("hitfreeze2")
	inst:AddTag("hitfreeze3")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")
 	inst:AddTag("backstab1") 

			elseif inst.level >1690 and inst.level <=1879  then
--inst.components.talker:Say("下一级 :经验[1880]\n[当前经验] + ".. (inst.level))
	inst:AddTag("hitfreeze3")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")
 	inst:AddTag("backstab1") 

		elseif inst.level >1879 and inst.level <= 1880 then
inst.components.talker:Say("等级 20\n 解锁 : [背刺] 2/3\n 解锁 : [冻结攻击 满级] 4/4")
	inst:RemoveTag("hitfreeze3")
	inst:AddTag("hitfreeze4")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("hitfreeze4")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("hitfreeze3")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level20")
 	inst:AddTag("backstab2") 
 	inst:RemoveTag("backstab1") 

	inst:RemoveTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

			elseif inst.level >1880 and inst.level <=2079  then
--inst.components.talker:Say("下一级 :经验[2080]\n[当前经验] + ".. (inst.level))
	inst:AddTag("hitfreeze4")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("hitfreeze3")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level20")
 	inst:AddTag("backstab2") 
 	inst:RemoveTag("backstab1") 

	inst:RemoveTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

		elseif inst.level >2079 and inst.level <= 2080 then
	inst.components.talker:Say("等级 21\n 解锁 : [血量回复]\n2/4")
	inst:RemoveTag("hpregen1")
	inst:AddTag("hpregen2")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("hitfreeze4")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("hitfreeze3")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level21")
 	inst:AddTag("backstab2") 
 	inst:RemoveTag("backstab1") 

	inst:RemoveTag("level20")
	inst:RemoveTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

			elseif inst.level >2080 and inst.level <=2289  then
--inst.components.talker:Say("下一级 :经验[2289]\n[当前经验] + ".. (inst.level))
	inst:AddTag("hpregen2")
	inst:AddTag("hitfreeze4")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("hpregen1")
	inst:RemoveTag("hitfreeze3")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level21")
 	inst:AddTag("backstab2") 
 	inst:RemoveTag("backstab1") 

	inst:RemoveTag("level20")
	inst:RemoveTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

		elseif inst.level >2189 and inst.level <= 2290 then
	inst.components.talker:Say("等级 22\n 解锁 : [血量回复]\n3/4")
	inst:RemoveTag("hpregen2")
	inst:AddTag("hpregen3")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("hitfreeze4")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("hpregen1")
	inst:RemoveTag("hitfreeze3")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level22")
 	inst:AddTag("backstab2") 
 	inst:RemoveTag("backstab1") 

	inst:RemoveTag("level21")
	inst:RemoveTag("level20")
	inst:RemoveTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

			elseif inst.level >2290 and inst.level <=2499  then
--inst.components.talker:Say("下一级 :经验[2500]\n[当前经验] + ".. (inst.level))
	inst:AddTag("hpregen3")
	inst:AddTag("hitfreeze4")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("hpregen1")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("hpregen2")
	inst:RemoveTag("hpregen1")
	inst:RemoveTag("hitfreeze3")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level22")
 	inst:AddTag("backstab2") 
 	inst:RemoveTag("backstab1") 

	inst:RemoveTag("level21")
	inst:RemoveTag("level20")
	inst:RemoveTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

		elseif inst.level >2499 and inst.level <= 2500 then
	inst.components.talker:Say("等级 23\n 解锁 : [火焰护盾]\n2/4")
	inst:RemoveTag("fshield1")
	inst:AddTag("fshield2")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("hpregen3")
	inst:AddTag("hitfreeze4")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("hpregen1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("hpregen2")
	inst:RemoveTag("hpregen1")
	inst:RemoveTag("hitfreeze3")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level23")
 	inst:AddTag("backstab2") 
 	inst:RemoveTag("backstab1") 

	inst:RemoveTag("level22")
	inst:RemoveTag("level21")
	inst:RemoveTag("level20")
	inst:RemoveTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

			elseif inst.level >2500 and inst.level <=2849  then
--inst.components.talker:Say("下一级 :经验[2850]\n[当前经验] + ".. (inst.level))
	inst:AddTag("fshield2")
	inst:AddTag("hpregen3")
	inst:AddTag("hitfreeze4")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("fshield1")
	inst:RemoveTag("hpregen2")
	inst:RemoveTag("hpregen1")
	inst:RemoveTag("hitfreeze3")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level23")
 	inst:AddTag("backstab2") 
 	inst:RemoveTag("backstab1") 

	inst:RemoveTag("level22")
	inst:RemoveTag("level21")
	inst:RemoveTag("level20")
	inst:RemoveTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

		elseif inst.level >2849 and inst.level <= 2850 then
	inst.components.talker:Say("等级 24\n 解锁 : [火焰护盾]\n3/4")
	inst:RemoveTag("fshield2")
	inst:AddTag("fshield3")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("hpregen3")
	inst:AddTag("hitfreeze4")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("fshield1")
	inst:RemoveTag("hpregen2")
	inst:RemoveTag("hpregen1")
	inst:RemoveTag("hitfreeze3")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level24")
 	inst:AddTag("backstab2") 
 	inst:RemoveTag("backstab1") 

	inst:RemoveTag("level23")
	inst:RemoveTag("level22")
	inst:RemoveTag("level21")
	inst:RemoveTag("level20")
	inst:RemoveTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

			elseif inst.level >2850 and inst.level <=3199  then
--inst.components.talker:Say("下一级 :经验[3200]\n[当前经验] + ".. (inst.level))
	inst:AddTag("fshield3")
	inst:AddTag("hpregen3")
	inst:AddTag("hitfreeze4")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("fshield2")
	inst:RemoveTag("fshield1")
	inst:RemoveTag("hpregen2")
	inst:RemoveTag("hpregen1")
	inst:RemoveTag("hitfreeze3")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level24")
 	inst:AddTag("backstab2") 
 	inst:RemoveTag("backstab1") 

	inst:RemoveTag("level23")
	inst:RemoveTag("level22")
	inst:RemoveTag("level21")
	inst:RemoveTag("level20")
	inst:RemoveTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

		elseif inst.level >3199 and inst.level <= 3200 then
inst.components.talker:Say("等级 25\n 解锁 : [火焰护盾 满级]\n4/4")
	inst:RemoveTag("fshield3")
	inst:AddTag("fshield4")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("hpregen3")
	inst:AddTag("hitfreeze4")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("fshield2")
	inst:RemoveTag("fshield1")
	inst:RemoveTag("hpregen2")
	inst:RemoveTag("hpregen1")
	inst:RemoveTag("hitfreeze3")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level25")
 	inst:AddTag("backstab2") 
 	inst:RemoveTag("backstab1") 

	inst:RemoveTag("level24")
	inst:RemoveTag("level23")
	inst:RemoveTag("level22")
	inst:RemoveTag("level21")
	inst:RemoveTag("level20")
	inst:RemoveTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

			elseif inst.level >3200 and inst.level <=3699  then
--inst.components.talker:Say("下一级 :经验[3700]\n[当前经验] + ".. (inst.level))
	inst:AddTag("fshield4")
	inst:AddTag("hpregen3")
	inst:AddTag("hitfreeze4")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("fshield3")
	inst:RemoveTag("fshield2")
	inst:RemoveTag("fshield1")
	inst:RemoveTag("hpregen2")
	inst:RemoveTag("hpregen1")
	inst:RemoveTag("hitfreeze3")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:AddTag("cure0")
	inst:AddTag("level25")
 	inst:AddTag("backstab2") 
 	inst:RemoveTag("backstab1") 

	inst:RemoveTag("level24")
	inst:RemoveTag("level23")
	inst:RemoveTag("level22")
	inst:RemoveTag("level21")
	inst:RemoveTag("level20")
	inst:RemoveTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

		elseif inst.level >3699 and inst.level <= 3700 then
inst.components.talker:Say("等级 26\n 解锁 : [护盾]\n2/3")
	inst:AddTag("cure1")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("fshield4")
	inst:AddTag("hpregen3")
	inst:AddTag("hitfreeze4")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("fshield3")
	inst:RemoveTag("fshield2")
	inst:RemoveTag("fshield1")
	inst:RemoveTag("hpregen2")
	inst:RemoveTag("hpregen1")
	inst:RemoveTag("hitfreeze3")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:RemoveTag("cure0")
	inst:AddTag("level26")
 	inst:AddTag("backstab2") 
 	inst:RemoveTag("backstab1") 

	inst:RemoveTag("level25")
	inst:RemoveTag("level24")
	inst:RemoveTag("level23")
	inst:RemoveTag("level22")
	inst:RemoveTag("level21")
	inst:RemoveTag("level20")
	inst:RemoveTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

			elseif inst.level >3700 and inst.level <=4199  then
--inst.components.talker:Say("下一级 :经验[4200]\n[当前经验] + ".. (inst.level))
	inst:AddTag("cure1")
	inst:AddTag("fshield4")
	inst:AddTag("hpregen3")
	inst:AddTag("hitfreeze4")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("fshield3")
	inst:RemoveTag("fshield2")
	inst:RemoveTag("fshield1")
	inst:RemoveTag("hpregen2")
	inst:RemoveTag("hpregen1")
	inst:RemoveTag("hitfreeze3")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:RemoveTag("cure0")
	inst:AddTag("level26")
 	inst:AddTag("backstab2") 
 	inst:RemoveTag("backstab1") 

	inst:RemoveTag("level25")
	inst:RemoveTag("level24")
	inst:RemoveTag("level23")
	inst:RemoveTag("level22")
	inst:RemoveTag("level21")
	inst:RemoveTag("level20")
	inst:RemoveTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

		elseif inst.level >4199 and inst.level <= 4200 then
inst.components.talker:Say("等级 27\n 解锁 : [护盾 满级]\n3/3")
	inst:RemoveTag("cure1")
	inst:AddTag("cure2")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("fshield4")
	inst:AddTag("hpregen3")
	inst:AddTag("hitfreeze4")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("fshield3")
	inst:RemoveTag("fshield2")
	inst:RemoveTag("fshield1")
	inst:RemoveTag("hpregen2")
	inst:RemoveTag("hpregen1")
	inst:RemoveTag("hitfreeze3")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:RemoveTag("cure0")
	inst:AddTag("level27")
 	inst:AddTag("backstab2") 
 	inst:RemoveTag("backstab1") 

	inst:RemoveTag("level26")
	inst:RemoveTag("level25")
	inst:RemoveTag("level24")
	inst:RemoveTag("level23")
	inst:RemoveTag("level22")
	inst:RemoveTag("level21")
	inst:RemoveTag("level20")
	inst:RemoveTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

			elseif inst.level >4200 and inst.level <=4699  then
--inst.components.talker:Say("下一级 :经验[4700]\n[当前经验] + ".. (inst.level))
	inst:AddTag("cure2")
	inst:AddTag("fshield4")
	inst:AddTag("hpregen3")
	inst:AddTag("hitfreeze4")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("fshield3")
	inst:RemoveTag("fshield2")
	inst:RemoveTag("fshield1")
	inst:RemoveTag("hpregen2")
	inst:RemoveTag("hpregen1")
	inst:RemoveTag("hitfreeze3")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:RemoveTag("cure1")
	inst:RemoveTag("cure0")
	inst:AddTag("level27")
 	inst:AddTag("backstab2") 
 	inst:RemoveTag("backstab1") 

	inst:RemoveTag("level26")
	inst:RemoveTag("level25")
	inst:RemoveTag("level24")
	inst:RemoveTag("level23")
	inst:RemoveTag("level22")
	inst:RemoveTag("level21")
	inst:RemoveTag("level20")
	inst:RemoveTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

		elseif inst.level >4699 and inst.level <= 4700 then
inst.components.talker:Say("等级 28\n 解锁 : [狂暴护甲]\n1/1")
	inst:AddTag("berserkarmor")

inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("cure2")
	inst:AddTag("fshield4")
	inst:AddTag("hpregen3")
	inst:AddTag("hitfreeze4")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("fshield3")
	inst:RemoveTag("fshield2")
	inst:RemoveTag("fshield1")
	inst:RemoveTag("hpregen2")
	inst:RemoveTag("hpregen1")
	inst:RemoveTag("hitfreeze3")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:RemoveTag("cure1")
	inst:RemoveTag("cure0")
	inst:AddTag("level28")
 	inst:AddTag("backstab2") 
 	inst:RemoveTag("backstab1") 

	inst:RemoveTag("level27")
	inst:RemoveTag("level26")
	inst:RemoveTag("level25")
	inst:RemoveTag("level24")
	inst:RemoveTag("level23")
	inst:RemoveTag("level22")
	inst:RemoveTag("level21")
	inst:RemoveTag("level20")
	inst:RemoveTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

			elseif inst.level >4700 and inst.level <=5499  then
--inst.components.talker:Say("下一级 :经验[5500]\n[当前经验] + ".. (inst.level))
	inst:AddTag("cure2")
	inst:AddTag("fshield4")
	inst:AddTag("hpregen3")
	inst:AddTag("hitfreeze4")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("fshield3")
	inst:RemoveTag("fshield2")
	inst:RemoveTag("fshield1")
	inst:RemoveTag("hpregen2")
	inst:RemoveTag("hpregen1")
	inst:RemoveTag("hitfreeze3")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:RemoveTag("cure1")
 	inst:AddTag("berserkarmor")
	inst:RemoveTag("cure0")
	inst:AddTag("level28")
 	inst:AddTag("backstab2") 
 	inst:RemoveTag("backstab1") 

	inst:RemoveTag("level27")
	inst:RemoveTag("level26")
	inst:RemoveTag("level25")
	inst:RemoveTag("level24")
	inst:RemoveTag("level23")
	inst:RemoveTag("level22")
	inst:RemoveTag("level21")
	inst:RemoveTag("level20")
	inst:RemoveTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

		elseif inst.level >5499 and inst.level <= 5500 then
	inst.components.talker:Say("等级 29\n 解锁 : [血量回复 满级]\n4/4")
	inst:RemoveTag("hpregen3")
	inst:AddTag("hpregen4")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("cure2")
	inst:AddTag("fshield4")
	inst:AddTag("hitfreeze4")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("fshield3")
	inst:RemoveTag("fshield2")
	inst:RemoveTag("fshield1")
	inst:RemoveTag("hpregen2")
	inst:RemoveTag("hpregen1")
	inst:RemoveTag("hitfreeze3")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:RemoveTag("cure1")
 	inst:AddTag("berserkarmor")
	inst:RemoveTag("cure0")
	inst:AddTag("level29")
 	inst:AddTag("backstab2") 
 	inst:RemoveTag("backstab1") 

	inst:RemoveTag("level28")
	inst:RemoveTag("level27")
	inst:RemoveTag("level26")
	inst:RemoveTag("level25")
	inst:RemoveTag("level24")
	inst:RemoveTag("level23")
	inst:RemoveTag("level22")
	inst:RemoveTag("level21")
	inst:RemoveTag("level20")
	inst:RemoveTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

			elseif inst.level >5500 and inst.level <=6999  then
--inst.components.talker:Say("下一级 :经验[7000]\n[当前经验] + ".. (inst.level))
	inst:AddTag("hpregen4")
	inst:AddTag("cure2")
	inst:AddTag("fshield4")
	inst:AddTag("hitfreeze4")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("hitlightning1")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("fshield3")
	inst:RemoveTag("fshield2")
	inst:RemoveTag("fshield1")
	inst:RemoveTag("hpregen2")
	inst:RemoveTag("hpregen1")
	inst:RemoveTag("hitfreeze3")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:RemoveTag("cure1")
	inst:RemoveTag("hpregen3")
 	inst:AddTag("berserkarmor")
	inst:RemoveTag("cure0")
	inst:AddTag("level29")
 	inst:AddTag("backstab2") 
 	inst:RemoveTag("backstab1") 

	inst:RemoveTag("level28")
	inst:RemoveTag("level27")
	inst:RemoveTag("level26")
	inst:RemoveTag("level25")
	inst:RemoveTag("level24")
	inst:RemoveTag("level23")
	inst:RemoveTag("level22")
	inst:RemoveTag("level21")
	inst:RemoveTag("level20")
	inst:RemoveTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

		elseif inst.level >6999 and inst.level <= 7000 then
inst.components.talker:Say("等级 30\n 解锁 : [闪电攻击 满级] 2/2\n 解锁 : [背刺 满级]3/3\n 解锁 : [影子]1/1")
	inst:RemoveTag("hitlightning1")
	inst:AddTag("hitlightning2")
inst.SoundEmitter:PlaySound("dontstarve/common/cookingpot_finish", "snd")
inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
	inst:AddTag("hpregen4")
	inst:AddTag("cure2")
	inst:AddTag("fshield4")
	inst:AddTag("hitfreeze4")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("fshield3")
	inst:RemoveTag("fshield2")
	inst:RemoveTag("fshield1")
	inst:RemoveTag("hpregen2")
	inst:RemoveTag("hpregen1")
	inst:RemoveTag("hitfreeze3")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:RemoveTag("cure1")
	inst:RemoveTag("hpregen3")
 	inst:AddTag("berserkarmor")
	inst:RemoveTag("cure0")
 	inst:AddTag("shadowb")
	inst:AddTag("level30")
 	inst:AddTag("backstab3") 
 	inst:RemoveTag("backstab2") 
 	inst:RemoveTag("backstab1") 

	inst:RemoveTag("level29")
	inst:RemoveTag("level28")
	inst:RemoveTag("level27")
	inst:RemoveTag("level26")
	inst:RemoveTag("level25")
	inst:RemoveTag("level24")
	inst:RemoveTag("level23")
	inst:RemoveTag("level22")
	inst:RemoveTag("level21")
	inst:RemoveTag("level20")
	inst:RemoveTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")

---
		elseif inst.level > 7000 then
	inst:AddTag("hitlightning2")
	inst:AddTag("hpregen4")
	inst:AddTag("cure2")
	inst:AddTag("fshield4")
	inst:AddTag("hitfreeze4")
	inst:AddTag("lessercure2")
	inst:AddTag("healshield4")
	inst:AddTag("hitcritical4")
	inst:AddTag("fshield1")
	inst:AddTag("Berserk")
	inst:AddTag("Valkyrie")
	inst:RemoveTag("hitlightning1")
	inst:RemoveTag("fshield3")
	inst:RemoveTag("fshield2")
	inst:RemoveTag("fshield1")
	inst:RemoveTag("hpregen2")
	inst:RemoveTag("hpregen1")
	inst:RemoveTag("hitfreeze3")
	inst:RemoveTag("hitfreeze2")
	inst:RemoveTag("hitfreeze1")
	inst:RemoveTag("lessercure1")
	inst:RemoveTag("healshield3")
	inst:RemoveTag("healshield2")
	inst:RemoveTag("healshield1")
	inst:RemoveTag("hitcritical1")
	inst:RemoveTag("hitcritical2")
	inst:RemoveTag("hitcritical3")
	inst:RemoveTag("cure1")
	inst:RemoveTag("hpregen3")
 	inst:AddTag("berserkarmor")
	inst:RemoveTag("cure0")
	inst:AddTag("level30")
 	inst:AddTag("shadowb")
 	inst:AddTag("backstab3") 
 	inst:RemoveTag("backstab2") 
 	inst:RemoveTag("backstab1") 

	inst:RemoveTag("level29")
	inst:RemoveTag("level28")
	inst:RemoveTag("level27")
	inst:RemoveTag("level26")
	inst:RemoveTag("level25")
	inst:RemoveTag("level24")
	inst:RemoveTag("level23")
	inst:RemoveTag("level22")
	inst:RemoveTag("level21")
	inst:RemoveTag("level20")
	inst:RemoveTag("level19")
	inst:RemoveTag("level18")
	inst:RemoveTag("level17")
	inst:RemoveTag("level16")
	inst:RemoveTag("level15")
	inst:RemoveTag("level14")
	inst:RemoveTag("level13")
	inst:RemoveTag("level12")
	inst:RemoveTag("level11")
	inst:RemoveTag("level10")
	inst:RemoveTag("level9")
	inst:RemoveTag("level8")
	inst:RemoveTag("level7")
	inst:RemoveTag("level6")
	inst:RemoveTag("level5")
	inst:RemoveTag("level4")
	inst:RemoveTag("level3")
	inst:RemoveTag("level2")
	inst:RemoveTag("level1")
	end

		if inst:HasTag("normalh") then
--level1~5
		if inst.level < 51 then
	inst.components.health.maxhealth = math.ceil (60 + exp* 0.5)
	inst.components.sanity.max = math.ceil (100 + exp* 0.3)
--level5~10(380)
		elseif inst.level >= 51 and inst.level <431 then
	inst.components.health.maxhealth = math.ceil (85 + exp* 0.2)
	inst.components.sanity.max = math.ceil (115 + exp* 0.2)
--level10~15(500)
		elseif inst.level >= 431 and inst.level <1031 then
	inst.components.health.maxhealth = math.ceil (161 + exp* 0.1)
	inst.components.sanity.max = math.ceil (191 + exp* 0.1)
--level15~20(850)
		elseif inst.level >= 1031 and inst.level <1881 then
	inst.components.health.maxhealth = math.ceil (211 + exp* 0.05)
	inst.components.sanity.max = math.ceil (241 + exp* 0.05)
--level20~25(2320)
		elseif inst.level >= 1881 and inst.level <4201 then
	inst.components.health.maxhealth = math.ceil (254 + exp* 0.01)
	inst.components.sanity.max = math.ceil (284 + exp* 0.02)
--level25~30(2800)
		elseif inst.level >= 4201 and inst.level <7001 then
	inst.components.health.maxhealth = math.ceil (277+ exp* 0.01)
	inst.components.sanity.max = math.ceil (340 + exp* 0.02)
--level30~
		elseif inst.level >= 7001 then
	inst.components.health.maxhealth = math.ceil (305 + exp* 0.005)
	inst.components.sanity.max = math.ceil (396 + exp* 0.01)
	end

		elseif inst:HasTag("hardh") then
--level1~5
		if inst.level < 51 then
	inst.components.health.maxhealth = math.ceil (50 + exp* 0.25)
	inst.components.sanity.max = math.ceil (100 + exp* 0.3)
--level5~10(380)
		elseif inst.level >= 51 and inst.level <431 then
	inst.components.health.maxhealth = math.ceil (63 + exp* 0.1)
	inst.components.sanity.max = math.ceil (115 + exp* 0.2)
--level10~15(500)
		elseif inst.level >= 431 and inst.level <1031 then
	inst.components.health.maxhealth = math.ceil (101 + exp* 0.05)
	inst.components.sanity.max = math.ceil (191 + exp* 0.1)
--level15~20(850)
		elseif inst.level >= 1031 and inst.level <1881 then
	inst.components.health.maxhealth = math.ceil (151 + exp* 0.025)
	inst.components.sanity.max = math.ceil (241 + exp* 0.05)
--level20~25(2320)
		elseif inst.level >= 1881 and inst.level <4201 then
	inst.components.health.maxhealth = math.ceil (173 + exp* 0.02)
	inst.components.sanity.max = math.ceil (284 + exp* 0.02)
--level25~30(2800)
		elseif inst.level >= 4201 then
	inst.components.health.maxhealth = math.ceil (220 + exp* 0.01)
	inst.components.sanity.max = math.ceil (340 + exp* 0.01)
--level30~
		elseif inst.level >= 7001 then
	inst.components.health.maxhealth = math.ceil (248 + exp* 0.005)
	inst.components.sanity.max = math.ceil (368 + exp* 0.01)
	end

		elseif inst:HasTag("hardcoreh") then
--level1~5
		if inst.level < 51 then
	inst.components.health.maxhealth = math.ceil (40 + exp* 0.25)
	inst.components.sanity.max = math.ceil (80 + exp* 0.3)
--level5~10(380)
		elseif inst.level >= 51 and inst.level <431 then
	inst.components.health.maxhealth = math.ceil (53 + exp* 0.1)
	inst.components.sanity.max = math.ceil (95 + exp* 0.2)
--level10~15(500)
		elseif inst.level >= 431 and inst.level <1031 then
	inst.components.health.maxhealth = math.ceil (91 + exp* 0.05)
	inst.components.sanity.max = math.ceil (171 + exp* 0.1)
--level15~20(850)
		elseif inst.level >= 1031 and inst.level <1881 then
	inst.components.health.maxhealth = math.ceil (141 + exp* 0.025)
	inst.components.sanity.max = math.ceil (221 + exp* 0.05)
--level20~25(2320)
		elseif inst.level >= 1881 and inst.level <4201 then
	inst.components.health.maxhealth = math.ceil (163 + exp* 0.02)
	inst.components.sanity.max = math.ceil (264 + exp* 0.02)
--level25~30(2800)
		elseif inst.level >= 4201 then
	inst.components.health.maxhealth = math.ceil (210 + exp* 0.005)
	inst.components.sanity.max = math.ceil (320 + exp* 0.01)
--level30~
		elseif inst.level >= 7001 then
	inst.components.health.maxhealth = math.ceil (224 + exp* 0.005)
	inst.components.sanity.max = math.ceil (348 + exp* 0.005)
	end

		elseif inst:HasTag("hellh") then

--level1~5
		if inst.level < 51 then
	inst.components.health.maxhealth = math.ceil (40 + exp* 0.25)
	inst.components.sanity.max = math.ceil (80 + exp* 0.3)
--level5~10(380)
		elseif inst.level >= 51 and inst.level <431 then
	inst.components.health.maxhealth = math.ceil (53 + exp* 0.1)
	inst.components.sanity.max = math.ceil (95 + exp* 0.2)
--level10~15(500)
		elseif inst.level >= 431 and inst.level <1031 then
	inst.components.health.maxhealth = math.ceil (91 + exp* 0.05)
	inst.components.sanity.max = math.ceil (171 + exp* 0.1)
--level15~20(850)
		elseif inst.level >= 1031 and inst.level <1881 then
	inst.components.health.maxhealth = math.ceil (141 + exp* 0.025)
	inst.components.sanity.max = math.ceil (221 + exp* 0.05)
--level20~25(2320)
		elseif inst.level >= 1881 and inst.level <4201 then
	inst.components.health.maxhealth = math.ceil (163 + exp* 0.005)
	inst.components.sanity.max = math.ceil (264 + exp* 0.005)
--level25~30(2800)
--level30~
	end

		elseif inst:HasTag("easyh") then
--level1~5
		if inst.level < 51 then
	inst.components.health.maxhealth = math.ceil (75 + exp* 0.5)
	inst.components.sanity.max = math.ceil (120 + exp* 0.3)
--level5~10(380)
		elseif inst.level >= 51 and inst.level <431 then
	inst.components.health.maxhealth = math.ceil (100 + exp* 0.2)
	inst.components.sanity.max = math.ceil (135 + exp* 0.2)
--level10~15(500)
		elseif inst.level >= 431 and inst.level <1031 then
	inst.components.health.maxhealth = math.ceil (176 + exp* 0.1)
	inst.components.sanity.max = math.ceil (211 + exp* 0.1)
--level15~20(850)
		elseif inst.level >= 1031 and inst.level <1881 then
	inst.components.health.maxhealth = math.ceil (226 + exp* 0.05)
	inst.components.sanity.max = math.ceil (261 + exp* 0.05)
--level20~25(2320)
		elseif inst.level >= 1881 and inst.level <4201 then
	inst.components.health.maxhealth = math.ceil (269 + exp* 0.02)
	inst.components.sanity.max = math.ceil (304 + exp* 0.02)
--level25~30(2800)
		elseif inst.level >= 4201 and inst.level <7001 then
	inst.components.health.maxhealth = math.ceil (315 + exp* 0.01)
	inst.components.sanity.max = math.ceil (360 + exp* 0.02)
--level30~
		elseif inst.level >= 7001 then
	inst.components.health.maxhealth = math.ceil (343 + exp* 0.005)
	inst.components.sanity.max = math.ceil (416 + exp* 0.01)
	end

		elseif inst:HasTag("veasyh") then
--level1~5
		if inst.level < 51 then
	inst.components.health.maxhealth = math.ceil (100 + exp* 0.5)
	inst.components.sanity.max = math.ceil (150 + exp* 0.3)
--level5~10(380)
		elseif inst.level >= 51 and inst.level <431 then
	inst.components.health.maxhealth = math.ceil (175 + exp* 0.2)
	inst.components.sanity.max = math.ceil (165 + exp* 0.2)
--level10~15(500)
		elseif inst.level >= 431 and inst.level <1031 then
	inst.components.health.maxhealth = math.ceil (251 + exp* 0.1)
	inst.components.sanity.max = math.ceil (241 + exp* 0.1)
--level15~20(850)
		elseif inst.level >= 1031 and inst.level <1881 then
	inst.components.health.maxhealth = math.ceil (301 + exp* 0.05)
	inst.components.sanity.max = math.ceil (291 + exp* 0.05)
--level20~25(2320)
		elseif inst.level >= 1881 and inst.level <4201 then
	inst.components.health.maxhealth = math.ceil (344 + exp* 0.02)
	inst.components.sanity.max = math.ceil (334 + exp* 0.02)
--level25~30(2800)
		elseif inst.level >= 4201 and inst.level <7001 then
	inst.components.health.maxhealth = math.ceil (390 + exp* 0.01)
	inst.components.sanity.max = math.ceil (390 + exp* 0.02)
--level30~
		elseif inst.level >= 7001 then
	inst.components.health.maxhealth = math.ceil (418 + exp* 0.01)
	inst.components.sanity.max = math.ceil (446 + exp* 0.01)
	end

	--inst.components.hunger:SetPercent(hunger_percent)
	inst.components.health:SetPercent(health_percent)
	inst.components.sanity:SetPercent(sanity_percent)
end
end
---
local exp1x = 0.1
local exp2x = 0.4
local exp3x = 0.6
local exp4x = 0.7
local tynychance = 0.05
local smallllchance = 0.1
local smallchance = 0.2
local normalchance = 0.3
local largechance = 0.7
local berserkchance = 0.25
local foodnormalchance = 0.4
local foodgoodchance = 0.6
local foodlargechance = 0.8

local function onkilll(inst, data)
	if data.cause == inst.prefab and not data.inst:HasTag("companion") then
                if math.random() < normalchance and data.inst:HasTag("prey") then
        			inst.level = inst.level + 1
	levelexp(inst)	

	elseif math.random() < largechance and not data.inst:HasTag("prey") and not data.inst:HasTag("eyeplant") and not data.inst:HasTag("insect") and not data.inst:HasTag("giant1x") and not data.inst:HasTag("giant2x") and not data.inst:HasTag("giant3x") and not data.inst:HasTag("giant4x") and not data.inst:HasTag("small_giant2x") and not data.inst:HasTag("small_giant3x") and not data.inst:HasTag("small_giant4x") then
    				inst.level = inst.level + 1
	levelexp(inst)

	elseif math.random() < tynychance and data.inst:HasTag("insect") then
    				inst.level = inst.level + 1
	levelexp(inst)

	elseif math.random() < smallllchance and data.inst:HasTag("eyeplant") then
    				inst.level = inst.level + 1
	levelexp(inst)

	elseif math.random() < smallllchance and data.inst:HasTag("arm") then
    				inst.level = inst.level + 1
	levelexp(inst)

------extra
	elseif math.random() < exp1x and data.inst:HasTag("spider1x") then
	local fx = SpawnPrefab("statue_transition")
	local fx2 = SpawnPrefab("exp")
        		fx.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx2.Transform:SetPosition(data.inst:GetPosition():Get())
	elseif math.random() < exp1x and data.inst:HasTag("hound1x") then
	local fx = SpawnPrefab("statue_transition")
	local fx2 = SpawnPrefab("exp")
        		fx.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx2.Transform:SetPosition(data.inst:GetPosition():Get())

	elseif math.random() < exp2x and data.inst:HasTag("spider2x") then
	local fx = SpawnPrefab("statue_transition")
	local fx2 = SpawnPrefab("exp")
        		fx.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx2.Transform:SetPosition(data.inst:GetPosition():Get())
	elseif math.random() < exp3x and data.inst:HasTag("spider3x") then
	local fx = SpawnPrefab("statue_transition")
	local fx2 = SpawnPrefab("exp")
        		fx.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx2.Transform:SetPosition(data.inst:GetPosition():Get())
	elseif math.random() < exp4x and data.inst:HasTag("spider4x") then
	local fx = SpawnPrefab("statue_transition")
	local fx2 = SpawnPrefab("exp")
        		fx.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx2.Transform:SetPosition(data.inst:GetPosition():Get())
	elseif math.random() < exp2x and data.inst:HasTag("hound2x") then
	local fx = SpawnPrefab("statue_transition")
	local fx2 = SpawnPrefab("exp")
        		fx.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx2.Transform:SetPosition(data.inst:GetPosition():Get())
	elseif math.random() < exp3x and data.inst:HasTag("hound3x") then
	local fx = SpawnPrefab("statue_transition")
	local fx2 = SpawnPrefab("exp")
        		fx.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx2.Transform:SetPosition(data.inst:GetPosition():Get())
	elseif math.random() < exp4x and data.inst:HasTag("hound4x") then
	local fx = SpawnPrefab("statue_transition")
	local fx2 = SpawnPrefab("exp")
        		fx.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx2.Transform:SetPosition(data.inst:GetPosition():Get())

	elseif data.inst:HasTag("giant1x") then
	local fx = SpawnPrefab("statue_transition")
	local fx2 = SpawnPrefab("redgem")
	local fx3 = SpawnPrefab("bluegem")
	local fx4 = SpawnPrefab("glowdust")
        		fx.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx2.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx3.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx4.Transform:SetPosition(data.inst:GetPosition():Get())
    				inst.level = inst.level + 10
	levelexp(inst)
	inst.components.talker:Say("额外 [经验](+10) \n".. (inst.level))

	elseif data.inst:HasTag("giant2x") then
	local fx = SpawnPrefab("statue_transition")
	local fx2 = SpawnPrefab("redgem")
	local fx3 = SpawnPrefab("bluegem")
	local fx4 = SpawnPrefab("hat_mprincess")
        		fx.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx2.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx3.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx4.Transform:SetPosition(data.inst:GetPosition():Get())
    				inst.level = inst.level + 20
	levelexp(inst)
	inst.components.talker:Say("额外 [经验](+20) \n".. (inst.level))

	elseif data.inst:HasTag("giant3x") then
	local fx = SpawnPrefab("statue_transition")
	local fx2 = SpawnPrefab("redgem")
	local fx3 = SpawnPrefab("bluegem")
	local fx4 = SpawnPrefab("hat_mcrown")
        		fx.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx2.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx3.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx4.Transform:SetPosition(data.inst:GetPosition():Get())
    				inst.level = inst.level + 30
	levelexp(inst)
	inst.components.talker:Say("额外 [经验](+30) \n".. (inst.level))

	elseif data.inst:HasTag("giant4x") then
	local fx = SpawnPrefab("statue_transition")
	local fx2 = SpawnPrefab("redgem")
	local fx3 = SpawnPrefab("bluegem")
	local fx4 = SpawnPrefab("hat_mcrown")
	local fx5 = SpawnPrefab("armor_mushaa")
        		fx.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx2.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx3.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx4.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx5.Transform:SetPosition(data.inst:GetPosition():Get())
    				inst.level = inst.level + 40
	levelexp(inst)
	inst.components.talker:Say("额外 [经验](+40) \n".. (inst.level))

	elseif data.inst:HasTag("small_giant2x") then
	local fx = SpawnPrefab("statue_transition")
	local fx2 = SpawnPrefab("exp")
        		fx.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx2.Transform:SetPosition(data.inst:GetPosition():Get())
	local fx3 = SpawnPrefab("glowdust")
        		fx3.Transform:SetPosition(data.inst:GetPosition():Get())
    				inst.level = inst.level + 5
	levelexp(inst)
	inst.components.talker:Say("额外 [经验](+4) \n".. (inst.level))

	elseif data.inst:HasTag("small_giant3x") then
	local fx = SpawnPrefab("statue_transition")
	local fx2 = SpawnPrefab("exp")
        		fx.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx2.Transform:SetPosition(data.inst:GetPosition():Get())
	local fx3 = SpawnPrefab("glowdust")
        		fx3.Transform:SetPosition(data.inst:GetPosition():Get())
    				inst.level = inst.level + 8
	levelexp(inst)
	inst.components.talker:Say("额外 [经验](+8) \n".. (inst.level))
	elseif data.inst:HasTag("small_giant4x") then
	local fx = SpawnPrefab("statue_transition")
	local fx2 = SpawnPrefab("exp")
        		fx.Transform:SetPosition(data.inst:GetPosition():Get())
        		fx2.Transform:SetPosition(data.inst:GetPosition():Get())
	local fx3 = SpawnPrefab("glowdust")
        		fx3.Transform:SetPosition(data.inst:GetPosition():Get())
    				inst.level = inst.level + 12
	levelexp(inst)
	inst.components.talker:Say("额外 [经验](+12) \n".. (inst.level))

    			 end
		          end
			end

local function expeat(inst, food)

if food.components.edible.hungervalue >= 150 and food.components.edible.healthvalue >= 100 then 
if food.components.edible then
	inst.level = inst.level + 50
	levelexp(inst)
inst.components.talker:Say(" 我爱曼德拉汤 !! \n经验 + 50 ")
end
elseif food.components.edible.hungervalue > 100 or food.components.edible.healthvalue > 35 then 
if food.components.edible and math.random() < foodlargechance then
	inst.level = inst.level + 1
	levelexp(inst)
end
elseif food.components.edible.hungervalue > 55 or food.components.edible.healthvalue > 29 or food.components.edible.sanityvalue > 19 then 
if food.components.edible and math.random() < foodgoodchance then
	inst.level = inst.level + 1
	levelexp(inst)
end
elseif food.components.edible.hungervalue > 24 or food.components.edible.healthvalue > 19 or food.components.edible.sanityvalue > 14 then 
if food.components.edible and math.random() < foodnormalchance then
	inst.level = inst.level + 1
	levelexp(inst)
end
elseif food.components.edible.hungervalue > 9 or food.components.edible.healthvalue > 9 or food.components.edible.sanityvalue > 9 then 
if food.components.edible and math.random() < tynychance then
	inst.level = inst.level + 1
	levelexp(inst)
end
end
--force bersek
if inst:HasTag("berserk") then
	if string.find(tostring(food),"monsterm") then
 if math.random() < berserkchance then 
		 	inst:AddTag("fberserk") 

	end
	end
end
end

--normal bersek
local function berserkchanger(inst, data)

if inst:HasTag("berserk") and inst.components.hunger.current < 40  then
	inst:AddTag("berserks") 
	inst:RemoveTag("Valkyrieh") 
elseif inst:HasTag("berserk") and inst.components.hunger.current > 40  then
	inst:RemoveTag("berserks") 
	end
	end


local function onpreload(inst, data)
	if data then
		if data.level then
		inst.level = data.level
			levelexp(inst)
--
			if data.health and data.health.health then inst.components.health.currenthealth = data.health.health end
			if data.hunger and data.hunger.hunger then inst.components.hunger.current = data.hunger.hunger end
--
			if data.sanity and data.sanity.current then inst.components.sanity.current = data.sanity.current end
			inst.components.health:DoDelta(0)
			inst.components.hunger:DoDelta(0)
			inst.components.sanity:DoDelta(0)
end
	end
		end

local function onsave(inst, data)
	data.level = inst.level
	data.charge_time = inst.charge_time
end
    local function lessercure_proc(inst, data)
	if inst.components.sanity:GetPercent() > 0.5 and inst.components.health:GetPercent() < .3 and not inst.components.health:IsDead() then
        inst.components.health:DoDelta(75)
        inst.components.sanity:DoDelta(-20)
inst.components.talker:Say("小治疗 !!")
        local fx = SpawnPrefab("sparklefx")
            inst.SoundEmitter:PlaySound("dontstarve/creatures/chester/raise")
            inst.SoundEmitter:PlaySound("dontstarve/creatures/chester/pop")
        fx.entity:SetParent(inst.entity)
	fx.Transform:SetScale(1.3, 1.3, 1.3)
        fx.Transform:SetPosition(0, -0.2, 0)
        local fx_hitanim = function()
            fx.AnimState:PlayAnimation("hit")
            fx.AnimState:PushAnimation("idle_loop")
        end
        fx:ListenForEvent("blocked", fx_hitanim, inst)
        inst.activelc = true
        inst:DoTaskInTime(--[[Duration]] 5, function()
            fx:RemoveEventCallback("blocked", fx_hitanim, inst)
            if inst:IsValid() then
                inst:DoTaskInTime(--[[Cooldown]] 1800, function() inst.activelc = false 			end)
            end
        end)
    end
end
    local function lessercure2_proc(inst, data)
	if inst.components.sanity:GetPercent() > 0.5 and inst.components.health:GetPercent() < .3 and not inst.components.health:IsDead() then
        inst.components.health:DoDelta(150)
        inst.components.sanity:DoDelta(-20)
inst.components.talker:Say("小治疗 !!")
        local fx = SpawnPrefab("sparklefx")
            inst.SoundEmitter:PlaySound("dontstarve/creatures/chester/raise")
            inst.SoundEmitter:PlaySound("dontstarve/creatures/chester/pop")
        fx.entity:SetParent(inst.entity)
	fx.Transform:SetScale(1.3, 1.3, 1.3)
        fx.Transform:SetPosition(0, -0.2, 0)
        local fx_hitanim = function()
            fx.AnimState:PlayAnimation("hit")
            fx.AnimState:PushAnimation("idle_loop")
        end
        fx:ListenForEvent("blocked", fx_hitanim, inst)
        inst.activelc2 = true
        inst:DoTaskInTime(--[[Duration]] 5, function()
            fx:RemoveEventCallback("blocked", fx_hitanim, inst)
            if inst:IsValid() then
                inst:DoTaskInTime(--[[Cooldown]] 900, function() inst.activelc2 = false 			end)
            end
        end)
    end
end

    local function cure0_proc(inst, attacked, data)
if inst:HasTag("cure0") and inst:HasTag("cureo0") and inst:HasTag("DLC") and not inst.components.health:IsDead() then

inst.components.talker:Say("护盾打开!!")
inst:RemoveTag("shieldon2") 

      --  local fx = SpawnPrefab("sparklefx")
        local fx = SpawnPrefab("forcefieldfxx")

        --inst.components.health:DoDelta(2)
      --  inst.components.sanity:DoDelta(-1)
	inst.components.health:SetAbsorptionAmount(1)

            inst.SoundEmitter:PlaySound("dontstarve/creatures/chester/raise")
            inst.SoundEmitter:PlaySound("dontstarve/creatures/chester/pop")
        fx.entity:SetParent(inst.entity)
	fx.Transform:SetScale(0.8, 0.8, 0.8)
        fx.Transform:SetPosition(0, 0.2, 0)
        local fx_hitanim = function()
            fx.AnimState:PlayAnimation("hit")
            fx.AnimState:PushAnimation("idle_loop")
        end
        fx:ListenForEvent("blocked", fx_hitanim, inst)
        inst.activec0 = true
   inst:DoTaskInTime(--[[Duration]] 5, function()
            fx:RemoveEventCallback("blocked", fx_hitanim, inst)
            if inst:IsValid() then
            fx.kill_fx(fx)
	inst.components.health:SetAbsorptionAmount(0)
inst:RemoveTag("Cureo0") 
inst:RemoveTag("Cureoo0") 
inst:RemoveTag("shieldon") 
inst:AddTag("effectsheild2") 
inst:RemoveTag("frameon1")
inst:RemoveTag("frameon2")
inst:RemoveTag("frameon3")
inst:RemoveTag("frameon4")

                inst:DoTaskInTime(--[[Cooldown]] 200, function() inst.activec0 = false 			end)

            end
        end)
    end

if inst:HasTag("cure0") and inst:HasTag("cureo0") and not inst:HasTag("DLC") and not inst.components.health:IsDead() then

inst.components.talker:Say("护盾打开!!")
inst:RemoveTag("shieldon2") 

      --  local fx = SpawnPrefab("sparklefx")
        local fx = SpawnPrefab("forcefieldfxx")

      --  inst.components.health:DoDelta(20)
      --  inst.components.sanity:DoDelta(-1)
	inst.components.health:SetAbsorbAmount(1)

            inst.SoundEmitter:PlaySound("dontstarve/creatures/chester/raise")
            inst.SoundEmitter:PlaySound("dontstarve/creatures/chester/pop")
        fx.entity:SetParent(inst.entity)
	fx.Transform:SetScale(0.8, 0.8, 0.8)
        fx.Transform:SetPosition(0, 0.2, 0)
        local fx_hitanim = function()
            fx.AnimState:PlayAnimation("hit")
            fx.AnimState:PushAnimation("idle_loop")
        end
        fx:ListenForEvent("blocked", fx_hitanim, inst)
        inst.activec0 = true
   inst:DoTaskInTime(--[[Duration]] 5, function()
            fx:RemoveEventCallback("blocked", fx_hitanim, inst)
            if inst:IsValid() then
            fx.kill_fx(fx)
	inst.components.health:SetAbsorbAmount(0)
inst:RemoveTag("Cureo0") 
inst:RemoveTag("Cureoo0") 
inst:RemoveTag("shieldon") 
inst:AddTag("effectsheild2") 
inst:RemoveTag("frameon1")
inst:RemoveTag("frameon2")
inst:RemoveTag("frameon3")
inst:RemoveTag("frameon4")

                inst:DoTaskInTime(--[[Cooldown]] 200, function() inst.activec0 = false 			end)

            end
        end)
    end

end

    local function cure1_proc(inst, data)
	if inst:HasTag("cure1") and inst:HasTag("cureo1") and inst:HasTag("DLC") and not inst.components.health:IsDead() then

inst.components.talker:Say("护盾打开!!")
inst:RemoveTag("shieldon2") 
	inst.components.health:SetAbsorptionAmount(1)

      --  local fx = SpawnPrefab("sparklefx")
        local fx = SpawnPrefab("forcefieldfxx")

            inst.SoundEmitter:PlaySound("dontstarve/creatures/chester/raise")
            inst.SoundEmitter:PlaySound("dontstarve/creatures/chester/pop")
        fx.entity:SetParent(inst.entity)
	fx.Transform:SetScale(0.8, 0.8, 0.8)
        fx.Transform:SetPosition(0, 0.2, 0)
        local fx_hitanim = function()
            fx.AnimState:PlayAnimation("hit")
            fx.AnimState:PushAnimation("idle_loop")
        end
        fx:ListenForEvent("blocked", fx_hitanim, inst)
        inst.activec1 = true
   inst:DoTaskInTime(--[[Duration]] 7, function()
            fx:RemoveEventCallback("blocked", fx_hitanim, inst)
            if inst:IsValid() then
            fx.kill_fx(fx)
	inst.components.health:SetAbsorptionAmount(0)
inst:RemoveTag("Cureo1") 
inst:RemoveTag("Cureoo1") 
inst:RemoveTag("shieldon") 
inst:AddTag("effectsheild2") 
inst:RemoveTag("frameon1")
inst:RemoveTag("frameon2")
inst:RemoveTag("frameon3")
inst:RemoveTag("frameon4")

                inst:DoTaskInTime(--[[Cooldown]] 200, function() inst.activec1 = false 			end)

            end
        end)
    end
if inst:HasTag("cure1") and inst:HasTag("cureo1") and not inst:HasTag("DLC") and not inst.components.health:IsDead() then

inst.components.talker:Say("护盾打开!!")
inst:RemoveTag("shieldon2") 
	inst.components.health:SetAbsorbAmount(1)

      --  local fx = SpawnPrefab("sparklefx")
        local fx = SpawnPrefab("forcefieldfxx")

            inst.SoundEmitter:PlaySound("dontstarve/creatures/chester/raise")
            inst.SoundEmitter:PlaySound("dontstarve/creatures/chester/pop")
        fx.entity:SetParent(inst.entity)
	fx.Transform:SetScale(0.8, 0.8, 0.8)
        fx.Transform:SetPosition(0, 0.2, 0)
        local fx_hitanim = function()
            fx.AnimState:PlayAnimation("hit")
            fx.AnimState:PushAnimation("idle_loop")
        end
        fx:ListenForEvent("blocked", fx_hitanim, inst)
        inst.activec1 = true
   inst:DoTaskInTime(--[[Duration]] 7, function()
            fx:RemoveEventCallback("blocked", fx_hitanim, inst)
            if inst:IsValid() then
            fx.kill_fx(fx)
	inst.components.health:SetAbsorbAmount(0)
inst:RemoveTag("Cureo1") 
inst:RemoveTag("Cureoo1") 
inst:RemoveTag("shieldon") 
inst:AddTag("effectsheild2") 
inst:RemoveTag("frameon1")
inst:RemoveTag("frameon2")
inst:RemoveTag("frameon3")
inst:RemoveTag("frameon4")

                inst:DoTaskInTime(--[[Cooldown]] 200, function() inst.activec1 = false 			end)

            end
        end)
    end

end

    local function cure2_proc(inst, data)
	if inst:HasTag("cure2") and inst:HasTag("cureo2") and inst:HasTag("DLC") and not inst.components.health:IsDead() then

inst.components.talker:Say("护盾打开!!")
inst:RemoveTag("shieldon2") 
	inst.components.health:SetAbsorptionAmount(1)

      --  local fx = SpawnPrefab("sparklefx")
        local fx = SpawnPrefab("forcefieldfxx")

            inst.SoundEmitter:PlaySound("dontstarve/creatures/chester/raise")
            inst.SoundEmitter:PlaySound("dontstarve/creatures/chester/pop")
        fx.entity:SetParent(inst.entity)
	fx.Transform:SetScale(0.8, 0.8, 0.8)
        fx.Transform:SetPosition(0, 0.2, 0)
        local fx_hitanim = function()
            fx.AnimState:PlayAnimation("hit")
            fx.AnimState:PushAnimation("idle_loop")
        end
        fx:ListenForEvent("blocked", fx_hitanim, inst)
        inst.activec2 = true
   inst:DoTaskInTime(--[[Duration]] 9, function()
            fx:RemoveEventCallback("blocked", fx_hitanim, inst)
            if inst:IsValid() then
            fx.kill_fx(fx)
	inst.components.health:SetAbsorptionAmount(0)
inst:RemoveTag("Cureo2") 
inst:RemoveTag("Cureoo2") 
inst:RemoveTag("shieldon") 
inst:AddTag("effectsheild2") 
inst:RemoveTag("frameon1")
inst:RemoveTag("frameon2")
inst:RemoveTag("frameon3")
inst:RemoveTag("frameon4")

                inst:DoTaskInTime(--[[Cooldown]] 200, function() inst.activec2 = false 			end)

            end
        end)
    end
	if inst:HasTag("cure2") and inst:HasTag("cureo2") and not inst:HasTag("DLC") and not inst.components.health:IsDead() then

inst.components.talker:Say("护盾打开!!")
inst:RemoveTag("shieldon2") 
	inst.components.health:SetAbsorbAmount(1)

      --  local fx = SpawnPrefab("sparklefx")
        local fx = SpawnPrefab("forcefieldfxx")

            inst.SoundEmitter:PlaySound("dontstarve/creatures/chester/raise")
            inst.SoundEmitter:PlaySound("dontstarve/creatures/chester/pop")
        fx.entity:SetParent(inst.entity)
	fx.Transform:SetScale(0.8, 0.8, 0.8)
        fx.Transform:SetPosition(0, 0.2, 0)
        local fx_hitanim = function()
            fx.AnimState:PlayAnimation("hit")
            fx.AnimState:PushAnimation("idle_loop")
        end
        fx:ListenForEvent("blocked", fx_hitanim, inst)
        inst.activec2 = true
   inst:DoTaskInTime(--[[Duration]] 9, function()
            fx:RemoveEventCallback("blocked", fx_hitanim, inst)
            if inst:IsValid() then
            fx.kill_fx(fx)
	inst.components.health:SetAbsorbAmount(0)
inst:RemoveTag("Cureo2") 
inst:RemoveTag("Cureoo2") 
inst:RemoveTag("shieldon") 
inst:AddTag("effectsheild2") 
inst:RemoveTag("frameon1")
inst:RemoveTag("frameon2")
inst:RemoveTag("frameon3")
inst:RemoveTag("frameon4")

                inst:DoTaskInTime(--[[Cooldown]] 200, function() inst.activec2 = false 			end)

            end
        end)
    end

end

    local function healshield1_proc(inst, data)
	if inst.components.sanity.current > 3 and inst.components.health:GetPercent() < .9 and not inst.components.health:IsDead() then
        inst.components.health:DoDelta(5)
        inst.components.sanity:DoDelta(-1)
        local sfx = SpawnPrefab("shock_fx2")
        local fx = SpawnPrefab("sparklefx")
    inst.SoundEmitter:PlaySound("dontstarve/common/lightningrod")
        sfx.entity:SetParent(inst.entity)
	sfx.Transform:SetScale(1.3, 1.3, 1.3)
        sfx.Transform:SetPosition(0, -0.2, 0)
        fx.entity:SetParent(inst.entity)
	fx.Transform:SetScale(1.3, 1.3, 1.3)
        fx.Transform:SetPosition(0, -0.2, 0)
        local fx_hitanim = function()
            fx.AnimState:PlayAnimation("hit")
            fx.AnimState:PushAnimation("idle_loop")
        end
        fx:ListenForEvent("blocked", fx_hitanim, inst)
        inst.activeh1 = true
        inst:DoTaskInTime(--[[Duration]] 1, function()
            fx:RemoveEventCallback("blocked", fx_hitanim, inst)
            if inst:IsValid() then
                inst:DoTaskInTime(--[[Cooldown]] 2, function() inst.activeh1 = false 			end)
            end
        end)
    end
end
    local function healshield2_proc(inst, data)
	if inst.components.sanity.current > 3 and inst.components.health:GetPercent() < .9 and not inst.components.health:IsDead() then
        inst.components.health:DoDelta(6)
        inst.components.sanity:DoDelta(-1)
        local sfx = SpawnPrefab("shock_fx2")
        local fx = SpawnPrefab("sparklefx")
    inst.SoundEmitter:PlaySound("dontstarve/common/lightningrod")
        sfx.entity:SetParent(inst.entity)
	sfx.Transform:SetScale(1.3, 1.3, 1.3)
        sfx.Transform:SetPosition(0, -0.2, 0)
        fx.entity:SetParent(inst.entity)
	fx.Transform:SetScale(1.3, 1.3, 1.3)
        fx.Transform:SetPosition(0, -0.2, 0)
        local fx_hitanim = function()
            fx.AnimState:PlayAnimation("hit")
            fx.AnimState:PushAnimation("idle_loop")
        end
        fx:ListenForEvent("blocked", fx_hitanim, inst)
        inst.activeh1 = true
        inst:DoTaskInTime(--[[Duration]] 1, function()
            fx:RemoveEventCallback("blocked", fx_hitanim, inst)
            if inst:IsValid() then
                inst:DoTaskInTime(--[[Cooldown]] 2, function() inst.activeh1 = false 			end)
            end
        end)
    end
end
    local function healshield3_proc(inst, data)
	if inst.components.sanity.current > 3 and inst.components.health:GetPercent() < .9 and not inst.components.health:IsDead() then
        inst.components.health:DoDelta(7)
        inst.components.sanity:DoDelta(-1)
        local sfx = SpawnPrefab("shock_fx2")
        local fx = SpawnPrefab("sparklefx")
    inst.SoundEmitter:PlaySound("dontstarve/common/lightningrod")
        sfx.entity:SetParent(inst.entity)
	sfx.Transform:SetScale(1.3, 1.3, 1.3)
        sfx.Transform:SetPosition(0, -0.2, 0)
        fx.entity:SetParent(inst.entity)
	fx.Transform:SetScale(1.3, 1.3, 1.3)
        fx.Transform:SetPosition(0, -0.2, 0)
        local fx_hitanim = function()
            fx.AnimState:PlayAnimation("hit")
            fx.AnimState:PushAnimation("idle_loop")
        end
        fx:ListenForEvent("blocked", fx_hitanim, inst)
        inst.activeh3 = true
        inst:DoTaskInTime(--[[Duration]] 1, function()
            fx:RemoveEventCallback("blocked", fx_hitanim, inst)
            if inst:IsValid() then
                inst:DoTaskInTime(--[[Cooldown]] 2, function() inst.activeh3 = false 			end)
              end
        end)
    end
end
    local function healshield4_proc(inst, data)
	if inst.components.sanity.current > 3 and inst.components.health:GetPercent() < .9 and not inst.components.health:IsDead() then
        inst.components.health:DoDelta(8)
        inst.components.sanity:DoDelta(-1)
        local sfx = SpawnPrefab("shock_fx2")
        local fx = SpawnPrefab("sparklefx")
    inst.SoundEmitter:PlaySound("dontstarve/common/lightningrod")
        sfx.entity:SetParent(inst.entity)
	sfx.Transform:SetScale(1.3, 1.3, 1.3)
        sfx.Transform:SetPosition(0, -0.2, 0)
        fx.entity:SetParent(inst.entity)
	fx.Transform:SetScale(1.3, 1.3, 1.3)
        fx.Transform:SetPosition(0, -0.2, 0)
        local fx_hitanim = function()
            fx.AnimState:PlayAnimation("hit")
            fx.AnimState:PushAnimation("idle_loop")
        end
        fx:ListenForEvent("blocked", fx_hitanim, inst)
        inst.activeh4 = true
        inst:DoTaskInTime(--[[Duration]] 1, function()
            fx:RemoveEventCallback("blocked", fx_hitanim, inst)
            if inst:IsValid() then
                inst:DoTaskInTime(--[[Cooldown]] 2, function() inst.activeh4 = false 			end)
              end
        end)
    end
end

------------------    
--test
local function berserkattack(inst, data)
local other = data.target
   local pos = other:GetPosition()
	            SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get())
end

local function OnHitfreeze(inst, data)
    local other = data.target
     if other and other.components.freezable and inst:HasTag("Hitfreeze1") then
        other.components.freezable:AddColdness(0.15)
        other.components.freezable:SpawnShatterFX()
     elseif other and other.components.freezable and inst:HasTag("Hitfreeze2") then
        other.components.freezable:AddColdness(0.2)
        other.components.freezable:SpawnShatterFX()
     elseif other and other.components.freezable and inst:HasTag("Hitfreeze3") then
        other.components.freezable:AddColdness(0.25)
        other.components.freezable:SpawnShatterFX()
     elseif other and other.components.freezable and inst:HasTag("Hitfreeze4") then
        other.components.freezable:AddColdness(0.3)
        other.components.freezable:SpawnShatterFX()
    end
    if other.components.burnable and other.components.burnable:IsBurning() then
        other.components.burnable:Extinguish()
end
end

local function Onframeshield1(attacked, data)
        if data and data.attacker and data.attacker.components.health and data.attacker.components.burnable and not data.attacker:HasTag("thorny") and not data.attacker:HasTag("gruef") then
            data.attacker.components.health:DoDelta(-5)
            data.attacker.components.burnable:Ignite()
		end
    if data.attacker.components.burnable and data.attacker.components.burnable:IsBurning() then
        data.attacker.components.burnable:Extinguish()
        end 
    end
local function Onframeshield2(attacked, data)
        if data and data.attacker and data.attacker.components.health and data.attacker.components.burnable and not data.attacker:HasTag("thorny") and not data.attacker:HasTag("gruef") then
            data.attacker.components.health:DoDelta(-8)
            data.attacker.components.burnable:Ignite()
		end
    if data.attacker.components.burnable and data.attacker.components.burnable:IsBurning() then
        data.attacker.components.burnable:Extinguish()
        end 
    end
local function Onframeshield3(attacked, data)
        if data and data.attacker and data.attacker.components.health and data.attacker.components.burnable and not data.attacker:HasTag("thorny") and not data.attacker:HasTag("gruef") then
            data.attacker.components.health:DoDelta(-11)
            data.attacker.components.burnable:Ignite()
		end
    if data.attacker.components.burnable and data.attacker.components.burnable:IsBurning() then
        data.attacker.components.burnable:Extinguish()
        end 
    end
local function Onframeshield4(attacked, data)
        if data and data.attacker and data.attacker.components.health and data.attacker.components.burnable and not data.attacker:HasTag("thorny") and not data.attacker:HasTag("gruef") then
            data.attacker.components.health:DoDelta(-15)
            data.attacker.components.burnable:Ignite()
		end
    if data.attacker.components.burnable and data.attacker.components.burnable:IsBurning() then
        data.attacker.components.burnable:Extinguish()
        end 
    end
---berserk shield
local function Onfreeze(attacked, data)
        if data and data.attacker and data.attacker.components.freezable then
            data.attacker.components.freezable:AddColdness(0.4)
            data.attacker.components.freezable:SpawnShatterFX()
        end 
    end

--simple

local function OnHitlightning1(inst, data)
local other = data.target
   local pos = other:GetPosition()
if inst:HasTag("lightningblue1") and inst:HasTag("DLC")  then
if other and other.components.burnable and other.components.health and not other:HasTag("wall") and not other:HasTag("structure")  then
        other.components.burnable:Ignite()
            SpawnPrefab("lightning").Transform:SetPosition(other:GetPosition():Get())
        other.components.health:DoDelta(-110)
SpawnPrefab("shock_fx2").Transform:SetPosition(other:GetPosition():Get())
            SpawnPrefab("groundpoundring_fx").Transform:SetPosition(other:GetPosition():Get())
    inst.components.sanity:DoDelta(-20)
inst.components.combat:SetRange(2)
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue1")
inst:RemoveTag("lightningo1") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning1)

	elseif other and not other.components.burnable and other.components.health and not other:HasTag("wall") and not other:HasTag("structure") and inst:HasTag("DLC") then
            SpawnPrefab("lightning").Transform:SetPosition(other:GetPosition():Get())
        other.components.health:DoDelta(-110)
SpawnPrefab("shock_fx2").Transform:SetPosition(other:GetPosition():Get())
            SpawnPrefab("groundpoundring_fx").Transform:SetPosition(other:GetPosition():Get())
    inst.components.sanity:DoDelta(-20)
inst.components.combat:SetRange(2)
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue1")
inst:RemoveTag("lightningo1") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning1)

	elseif other:HasTag("wall") or other:HasTag("structure") and inst:HasTag("DLC") then
            SpawnPrefab("lightning").Transform:SetPosition(other:GetPosition():Get())
SpawnPrefab("shock_fx2").Transform:SetPosition(other:GetPosition():Get())
	            SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get())
		other.components.health:DoDelta(-110)
    inst.components.sanity:DoDelta(-20)
inst.components.combat:SetRange(2)
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue1")
inst:RemoveTag("lightningo1") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning1)
end
    if other.components.burnable and other.components.burnable:IsBurning() and inst:HasTag("DLC") then
        other.components.burnable:Extinguish()
   		 end
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue1")
inst:RemoveTag("lightningo1") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning1)
		
inst.components.combat:SetRange(2)

end

if inst:HasTag("lightningblue1") and not inst:HasTag("DLC") then
if other and other.components.burnable and other.components.health and not other:HasTag("wall") and not other:HasTag("structure")  then
        other.components.burnable:Ignite()
            SpawnPrefab("lightning").Transform:SetPosition(other:GetPosition():Get())
        other.components.health:DoDelta(-110)
            SpawnPrefab("shock_fx2").Transform:SetPosition(other:GetPosition():Get())
    inst.components.sanity:DoDelta(-20)
inst.components.combat:SetRange(2)
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue1")
inst:RemoveTag("lightningo1") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning1)

elseif other and not other.components.burnable and other.components.health and not other:HasTag("wall") and not other:HasTag("structure") and not inst:HasTag("DLC")  then
            SpawnPrefab("lightning").Transform:SetPosition(other:GetPosition():Get())
        other.components.health:DoDelta(-110)
            SpawnPrefab("shock_fx2").Transform:SetPosition(other:GetPosition():Get())
    inst.components.sanity:DoDelta(-20)
inst.components.combat:SetRange(2)
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue1")
inst:RemoveTag("lightningo1") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning1)

	elseif other:HasTag("wall") or other:HasTag("structure") and not inst:HasTag("DLC") then
            SpawnPrefab("lightning").Transform:SetPosition(other:GetPosition():Get())
	            SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get())
		other.components.health:DoDelta(-110)
    inst.components.sanity:DoDelta(-20)
inst.components.combat:SetRange(2)
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue1")
inst:RemoveTag("lightningo1") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning1)
end

    if other.components.burnable and other.components.burnable:IsBurning() and not inst:HasTag("DLC") then
        other.components.burnable:Extinguish()
   		 end
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue1")
inst:RemoveTag("lightningo1") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning1)
		end
inst.components.combat:SetRange(2)

end
----


local function OnHitlightning2(inst, data)
local other = data.target
   local pos = other:GetPosition()
if inst:HasTag("lightningblue2") and inst:HasTag("DLC")  then
if other and other.components.burnable and other.components.health and not other:HasTag("wall") and not other:HasTag("structure")  then
        other.components.burnable:Ignite()
            SpawnPrefab("lightning").Transform:SetPosition(other:GetPosition():Get())
        other.components.health:DoDelta(-220)
SpawnPrefab("shock_fx2").Transform:SetPosition(other:GetPosition():Get())
            SpawnPrefab("groundpoundring_fx").Transform:SetPosition(other:GetPosition():Get())
    inst.components.sanity:DoDelta(-20)
inst.components.combat:SetRange(2)
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue2")
inst:RemoveTag("lightningo2") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning2)

	elseif other and not other.components.burnable and other.components.health and not other:HasTag("wall") and not other:HasTag("structure") and inst:HasTag("DLC") then
            SpawnPrefab("lightning").Transform:SetPosition(other:GetPosition():Get())
        other.components.health:DoDelta(-220)
SpawnPrefab("shock_fx2").Transform:SetPosition(other:GetPosition():Get())
            SpawnPrefab("groundpoundring_fx").Transform:SetPosition(other:GetPosition():Get())
    inst.components.sanity:DoDelta(-20)
inst.components.combat:SetRange(2)
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue2")
inst:RemoveTag("lightningo2") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning2)

	elseif other:HasTag("wall") or other:HasTag("structure") and inst:HasTag("DLC") then
            SpawnPrefab("lightning").Transform:SetPosition(other:GetPosition():Get())
SpawnPrefab("shock_fx2").Transform:SetPosition(other:GetPosition():Get())
	            SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get())
		other.components.health:DoDelta(-220)
    inst.components.sanity:DoDelta(-20)
inst.components.combat:SetRange(2)
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue2")
inst:RemoveTag("lightningo2") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning2)
end
    if other.components.burnable and other.components.burnable:IsBurning() and inst:HasTag("DLC") then
        other.components.burnable:Extinguish()
   		 end
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue2")
inst:RemoveTag("lightningo2") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning2)
		
inst.components.combat:SetRange(2)

end

if inst:HasTag("lightningblue2") and not inst:HasTag("DLC") then
if other and other.components.burnable and other.components.health and not other:HasTag("wall") and not other:HasTag("structure")  then
        other.components.burnable:Ignite()
            SpawnPrefab("lightning").Transform:SetPosition(other:GetPosition():Get())
        other.components.health:DoDelta(-220)
            SpawnPrefab("shock_fx2").Transform:SetPosition(other:GetPosition():Get())
    inst.components.sanity:DoDelta(-20)
inst.components.combat:SetRange(2)
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue2")
inst:RemoveTag("lightningo2") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning2)

elseif other and not other.components.burnable and other.components.health and not other:HasTag("wall") and not other:HasTag("structure") and not inst:HasTag("DLC")  then
            SpawnPrefab("lightning").Transform:SetPosition(other:GetPosition():Get())
        other.components.health:DoDelta(-220)
            SpawnPrefab("shock_fx2").Transform:SetPosition(other:GetPosition():Get())
    inst.components.sanity:DoDelta(-20)
inst.components.combat:SetRange(2)
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue2")
inst:RemoveTag("lightningo2") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning2)

	elseif other:HasTag("wall") or other:HasTag("structure") and not inst:HasTag("DLC") then
            SpawnPrefab("lightning").Transform:SetPosition(other:GetPosition():Get())
	            SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get())
		other.components.health:DoDelta(-220)
    inst.components.sanity:DoDelta(-20)
inst.components.combat:SetRange(2)
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue2")
inst:RemoveTag("lightningo2") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning2)
end

    if other.components.burnable and other.components.burnable:IsBurning() and not inst:HasTag("DLC") then
        other.components.burnable:Extinguish()
   		 end
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue2")
inst:RemoveTag("lightningo2") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning2)
		end
inst.components.combat:SetRange(2)

end


--[[
local function OnHitlightning1(inst, data)
local other = data.target
   local pos = other:GetPosition()
	if inst:HasTag("lightningblue1") and inst:HasTag("DLC") then
	if not other.components.burnable then
            SpawnPrefab("groundpoundring_fx").Transform:SetPosition(other:GetPosition():Get())
	            SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get())
		other.components.health:DoDelta(-100)
    inst.components.sanity:DoDelta(-10)
inst.components.combat:SetRange(2)
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue1")
inst:RemoveTag("lightningo1") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning1)

	elseif other:HasTag("wall") or other:HasTag("structure") then
            SpawnPrefab("groundpoundring_fx").Transform:SetPosition(other:GetPosition():Get())
	            SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get())
		other.components.health:DoDelta(-100)
    inst.components.sanity:DoDelta(-10)
inst.components.combat:SetRange(2)
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue1")
inst:RemoveTag("lightningo1") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning1)

	elseif other.components.burnable and not other:HasTag("wall") and not other:HasTag("structure") then
	do
	GetSeasonManager():DoLightningStrike(pos)
	inst.components.health:SetAbsorptionAmount(1)

            SpawnPrefab("groundpoundring_fx").Transform:SetPosition(other:GetPosition():Get())
	            SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get())
	other.components.burnable:Ignite()
		other.components.health:DoDelta(-100)
    inst.components.sanity:DoDelta(-10)
    if other.components.burnable and other.components.burnable:IsBurning() then
        other.components.burnable:Extinguish()
   		 end
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue1")
inst:RemoveTag("lightningo1") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning1)
		end
	--inst.components.health:SetAbsorptionAmount(0.5)
inst.components.combat:SetRange(2)

	end
end
	if inst:HasTag("lightningblue1") and not inst:HasTag("DLC") then
	if not other.components.burnable then
            SpawnPrefab("statue_transition").Transform:SetPosition(other:GetPosition():Get())
	            SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get())
		other.components.health:DoDelta(-100)
    inst.components.sanity:DoDelta(-10)
inst.components.combat:SetRange(2)
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue1")
inst:RemoveTag("lightningo1") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning1)

	elseif other:HasTag("wall") or other:HasTag("structure") then
            SpawnPrefab("statue_transition").Transform:SetPosition(other:GetPosition():Get())
	            SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get())
		other.components.health:DoDelta(-100)
    inst.components.sanity:DoDelta(-10)
inst.components.combat:SetRange(2)
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue1")
inst:RemoveTag("lightningo1") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning1)

	elseif other.components.burnable and not other:HasTag("wall") and not other:HasTag("structure") then
	do
	GetSeasonManager():DoLightningStrike(pos)
	inst.components.health:SetAbsorbAmount(1)

            SpawnPrefab("statue_transition").Transform:SetPosition(other:GetPosition():Get())
	            SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get())
	other.components.burnable:Ignite()
		other.components.health:DoDelta(-100)
    inst.components.sanity:DoDelta(-10)
    if other.components.burnable and other.components.burnable:IsBurning() then
        other.components.burnable:Extinguish()
   		 end
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue1")
inst:RemoveTag("lightningo1") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning1)
		end
	--inst.components.health:SetAbsorbAmount(0.5)
inst.components.combat:SetRange(2)

	end
end
end

local function OnHitlightning2(inst, data)
local other = data.target
   local pos = other:GetPosition()
	if inst:HasTag("lightningblue2") and inst:HasTag("DLC") then
	if not other.components.burnable then
            SpawnPrefab("groundpoundring_fx").Transform:SetPosition(other:GetPosition():Get())
	            SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get())
		other.components.health:DoDelta(-200)
    inst.components.sanity:DoDelta(-15)
inst.components.combat:SetRange(2)
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue2")
inst:RemoveTag("lightningo2") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning2)

	elseif other:HasTag("wall") or other:HasTag("structure") then
            SpawnPrefab("groundpoundring_fx").Transform:SetPosition(other:GetPosition():Get())
	            SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get())
		other.components.health:DoDelta(-200)
    inst.components.sanity:DoDelta(-15)
inst.components.combat:SetRange(2)
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue2")
inst:RemoveTag("lightningo2") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning2)

	elseif other.components.burnable and not other:HasTag("wall") and not other:HasTag("structure") then
	do
	GetSeasonManager():DoLightningStrike(pos)
	inst.components.health:SetAbsorptionAmount(1)

            SpawnPrefab("groundpoundring_fx").Transform:SetPosition(other:GetPosition():Get())
	            SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get())
	other.components.burnable:Ignite()
		other.components.health:DoDelta(-200)
    inst.components.sanity:DoDelta(-15)
    if other.components.burnable and other.components.burnable:IsBurning() then
        other.components.burnable:Extinguish()
   		 end
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue2")
inst:RemoveTag("lightningo2") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning2)
		end
	--inst.components.health:SetAbsorptionAmount(0.5)
inst.components.combat:SetRange(2)
	end
end
	if inst:HasTag("lightningblue2") and not inst:HasTag("DLC") then
	if not other.components.burnable then
            SpawnPrefab("statue_transition").Transform:SetPosition(other:GetPosition():Get())
	            SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get())
		other.components.health:DoDelta(-200)
    inst.components.sanity:DoDelta(-15)
inst.components.combat:SetRange(2)
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue2")
inst:RemoveTag("lightningo2") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning2)

	elseif other:HasTag("wall") or other:HasTag("structure") then
            SpawnPrefab("statue_transition").Transform:SetPosition(other:GetPosition():Get())
	            SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get())
		other.components.health:DoDelta(-200)
    inst.components.sanity:DoDelta(-15)
inst.components.combat:SetRange(2)
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue2")
inst:RemoveTag("lightningo2") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning2)

	elseif other.components.burnable and not other:HasTag("wall") and not other:HasTag("structure") then
	do
	GetSeasonManager():DoLightningStrike(pos)
	inst.components.health:SetAbsorbAmount(1)

            SpawnPrefab("statue_transition").Transform:SetPosition(other:GetPosition():Get())
	            SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get())
	other.components.burnable:Ignite()
		other.components.health:DoDelta(-200)
    inst.components.sanity:DoDelta(-15)
    if other.components.burnable and other.components.burnable:IsBurning() then
        other.components.burnable:Extinguish()
   		 end
	inst.Light:Enable(false)
inst:RemoveTag("lightningblue2")
inst:RemoveTag("lightningo2") 
inst.AnimState:SetBloomEffectHandle( "" )
inst:RemoveEventCallback("onhitother", OnHitlightning2)
		end
	--inst.components.health:SetAbsorbAmount(0.5)
inst.components.combat:SetRange(2)
	end
end
end
]]--


local function fshieldupgrade(inst, data)

	if inst:HasTag("Fshield1") and inst:HasTag("frameon1") then
    inst:ListenForEvent("attacked", Onframeshield1)
	elseif inst:HasTag("Fshield2") and inst:HasTag("frameon2") then
    inst:ListenForEvent("attacked", Onframeshield2)
	elseif inst:HasTag("Fshield3") and inst:HasTag("frameon3") then
    inst:ListenForEvent("attacked", Onframeshield3)
	elseif inst:HasTag("Fshield4") and inst:HasTag("frameon4") then
    inst:ListenForEvent("attacked", Onframeshield4)
end
	if not inst:HasTag("frameon1") and not inst:HasTag("frameon2") and not inst:HasTag("frameon3") and not inst:HasTag("frameon4") then
	     inst:RemoveEventCallback("attacked", Onframeshield1)
	     inst:RemoveEventCallback("attacked", Onframeshield2)
	     inst:RemoveEventCallback("attacked", Onframeshield3)
	     inst:RemoveEventCallback("attacked", Onframeshield4)
end
end

local function OnHitcritical(inst, data)
local hitcriticalchance1 = 0.1
local hitcriticalchance2 = 0.15
local hitcriticalchance3 = 0.2
local hitcriticalchance4 = 0.25

    local other = data.target
    if math.random() < hitcriticalchance1 and inst:HasTag("Hitcritical1") then
        other.components.health:DoDelta(-50)
       local fx = SpawnPrefab("staffcastfx")
        fx.entity:SetParent(inst.entity)
	fx.Transform:SetScale(.08, .08, .08)
        fx.Transform:SetPosition(0, 4, 0)
    elseif math.random() < hitcriticalchance2 and inst:HasTag("Hitcritical2") then
        other.components.health:DoDelta(-50)
       local fx = SpawnPrefab("staffcastfx")
        fx.entity:SetParent(inst.entity)
	fx.Transform:SetScale(.08, .08, .08)
        fx.Transform:SetPosition(0, 4, 0)
    elseif math.random() < hitcriticalchance3 and inst:HasTag("Hitcritical3") then
        other.components.health:DoDelta(-50)
       local fx = SpawnPrefab("staffcastfx")
        fx.entity:SetParent(inst.entity)
	fx.Transform:SetScale(.08, .08, .08)
        fx.Transform:SetPosition(0, 4, 0)
    elseif math.random() < hitcriticalchance4 and inst:HasTag("Hitcritical4") then
        other.components.health:DoDelta(-50)
       local fx = SpawnPrefab("staffcastfx")
        fx.entity:SetParent(inst.entity)
	fx.Transform:SetScale(.08, .08, .08)
        fx.Transform:SetPosition(0, 4, 0)

    end
end

local function removeskill(inst, data)
	if not inst:HasTag("frameon1") and not inst:HasTag("frameon2") and not inst:HasTag("frameon3") and not inst:HasTag("frameon4") then
	     inst:RemoveEventCallback("attacked", Onframeshield1)
	     inst:RemoveEventCallback("attacked", Onframeshield2)
	     inst:RemoveEventCallback("attacked", Onframeshield3)
	     inst:RemoveEventCallback("attacked", Onframeshield4)
end
if not inst:HasTag("Valkyrieh") then
    inst:RemoveEventCallback("onhitother", OnHitcritical)
end
end

----------

    local function tryproc(inst)

 if not inst.activeh1 and math.random() < .2 and inst:HasTag("healshield1") and not inst:HasTag("healshield2") and not inst:HasTag("healshield3") and not inst:HasTag("healshield4") and not inst.components.health:IsDead() then
           healshield1_proc(inst)
 elseif not inst.activeh2 and math.random() < .25 and inst:HasTag("healshield2") and not inst:HasTag("healshield1") and not inst:HasTag("healshield3") and not inst:HasTag("healshield4")   and not inst.components.health:IsDead() then
           healshield2_proc(inst)
 elseif not inst.activeh3 and math.random() < .3 and inst:HasTag("healshield3") and not inst:HasTag("healshield1") and not inst:HasTag("healshield2") and not inst:HasTag("healshield4")  and not inst.components.health:IsDead() then
           healshield3_proc(inst)
 elseif not inst.activeh4 and math.random() < .35 and inst:HasTag("healshield4") and not inst:HasTag("healshield1") and not inst:HasTag("healshield2") and not inst:HasTag("healshield3")  and not inst.components.health:IsDead() then
           healshield4_proc(inst)
 	elseif not inst.activelc1 and math.random() < .1 and inst:HasTag("lessercure1") and not inst:HasTag("lessercure2") and not inst.components.health:IsDead() then
           lessercure_proc(inst)
 	elseif not inst.activelc2 and math.random() < .1 and inst:HasTag("lessercure2") and not inst:HasTag("lessercure1") and not inst.components.health:IsDead() then
           lessercure2_proc(inst)
end
end

    local function shieldproc(inst)

---shield cooltime
	if not inst.activec0 and inst:HasTag("cure0") and not inst:HasTag("cure1") and not inst:HasTag("cure2") and not inst:HasTag("shieldon") and not inst.components.health:IsDead() then
           cure0_proc(inst)
	inst:AddTag("cureoo0") 
	inst:AddTag("shieldon2") 
	inst:AddTag("effectsheild") 

	--inst.components.talker:Say("[护盾]充能中\n((T))")

    elseif not inst.activec1 and inst:HasTag("cure1") and not inst:HasTag("cure0") and not inst:HasTag("cure2") and not inst:HasTag("shieldon") and not inst.components.health:IsDead() then
           cure1_proc(inst)
	inst:AddTag("cureoo1") 
	inst:AddTag("shieldon2") 
	inst:AddTag("effectsheild") 

	---inst.components.talker:Say("[护盾]充能中\n((T))")

    elseif not inst.activec2 and inst:HasTag("cure2") and not inst:HasTag("cure0") and not inst:HasTag("cure1") and not inst:HasTag("shieldon") and not inst.components.health:IsDead() then
           cure2_proc(inst)
	inst:AddTag("cureoo2") 
	inst:AddTag("shieldon2") 
	inst:AddTag("effectsheild") 

	---inst.components.talker:Say("[护盾]充能中\n((T))")


end
if inst:HasTag("cureo0") and inst:HasTag("shieldon2") 
then
           cure0_proc(inst)
	inst:AddTag("shieldon") 
inst:RemoveTag("effectsheild") 


elseif inst:HasTag("cureo1") and inst:HasTag("shieldon2") 
then

           cure1_proc(inst)
	inst:AddTag("shieldon") 
inst:RemoveTag("effectsheild") 

elseif inst:HasTag("cureo2") and inst:HasTag("shieldon2") 
then

           cure2_proc(inst)
	inst:AddTag("shieldon") 
inst:RemoveTag("effectsheild") 

elseif inst:HasTag("effectsheild") and inst:HasTag("effectsheild2") 
then
	local sparks = SpawnPrefab("sparks")
	local pos = Vector3(inst.Transform:GetWorldPosition())
	sparks.Transform:SetPosition(pos:Get())
	inst.components.talker:Say("[护盾]准备就绪")
inst:RemoveTag("effectsheild2") 
        end
    end

local shieldchance = .25
--local lightningchance = 0.2

local function powerattack(inst, data)
if inst:HasTag("Valkyrieh") and inst:HasTag("Hitlightning1") and not inst:HasTag("lightningo1") and not inst:HasTag("lightningblue1") then
	inst:AddTag("lightningo1") 
	local sparks = SpawnPrefab("sparks")
	local pos = Vector3(inst.Transform:GetWorldPosition())
	sparks.Transform:SetPosition(pos:Get())
   inst:ListenForEvent("onhitother", OnHitlightning1)

elseif inst:HasTag("Valkyrieh") and inst:HasTag("Hitlightning2") and not inst:HasTag("lightningo2") and not inst:HasTag("lightningblue2") then
	inst:AddTag("lightningo2") 
	local sparks = SpawnPrefab("sparks")
	local pos = Vector3(inst.Transform:GetWorldPosition())
	sparks.Transform:SetPosition(pos:Get())
    inst:ListenForEvent("onhitother", OnHitlightning2)

	end

				if not inst:HasTag("Valkyrieh") then
	inst:RemoveTag("lightningo1") 
	inst:RemoveTag("lightningblue1") 
	inst:RemoveTag("lightningo2") 
	inst:RemoveTag("lightningblue2") 
	inst.Light:Enable(false)
inst.AnimState:SetBloomEffectHandle( "" )
inst.components.combat:SetRange(2)
    inst:RemoveEventCallback("onhitother", OnHitlightning1)
    inst:RemoveEventCallback("onhitother", OnHitlightning2)

end
end

local function sneakattack(inst, data)
    local other = data.target
  
if inst:HasTag("backstab1") and inst:HasTag("sneaka") and not other:HasTag("wall") and not other:HasTag("structure") then

if not other.sg:HasStateTag("attack") and not other.sg:HasStateTag("shield") and not other.sg:HasStateTag("moving") and not other:HasTag("wall") and not other:HasTag("structure") and not other.sg:HasStateTag("frozen") then
	inst.components.colourtweener:StartTween({1,1,1,1}, 0)
inst:RemoveTag("sneaka") 
	inst.components.talker:Say("成功的背刺!!")
        other.components.health:DoDelta(-400)
	local dark1 = SpawnPrefab("statue_transition")
	local pos = Vector3(other.Transform:GetWorldPosition())
	dark1.Transform:SetPosition(pos:Get())
	dark1.Transform:SetScale(0.5,4,0.5)
	local fx = SpawnPrefab("explode_small")
	local pos = Vector3(other.Transform:GetWorldPosition())
	fx.Transform:SetPosition(pos:Get())
inst:RemoveTag("notarget") 
        other.SoundEmitter:PlaySound("dontstarve/wilson/blowdart_impact_sleep")
	--inst.components.sanityaura.penalty = 0
	--inst.components.sanity:RecalculatePenalty()
	inst.components.sanity:DoDelta(80)

elseif other.sg:HasStateTag("frozen") then
	inst.components.colourtweener:StartTween({1,1,1,1}, 0)
inst:RemoveTag("sneaka") 
	inst.components.talker:Say("成功的背刺!!\n冰冻目标 - 伤害减半")
        other.components.health:DoDelta(-200)
	local dark1 = SpawnPrefab("statue_transition")
	local pos = Vector3(other.Transform:GetWorldPosition())
	dark1.Transform:SetPosition(pos:Get())
	dark1.Transform:SetScale(0.5,4,0.5)
	local fx = SpawnPrefab("explode_small")
	local pos = Vector3(other.Transform:GetWorldPosition())
	fx.Transform:SetPosition(pos:Get())
inst:RemoveTag("notarget") 
        other.SoundEmitter:PlaySound("dontstarve/wilson/blowdart_impact_sleep")
	--inst.components.sanityaura.penalty = 0
	--inst.components.sanity:RecalculatePenalty()
	inst.components.sanity:DoDelta(80)

    elseif other.sg:HasStateTag("attack") or other.sg:HasStateTag("shield") or other.sg:HasStateTag("moving") then
	inst.components.colourtweener:StartTween({1,1,1,1}, 0)
inst:RemoveTag("sneaka") 
	inst.components.talker:Say("失败的背刺..")
	local fx = SpawnPrefab("splash")
	local pos = Vector3(other.Transform:GetWorldPosition())
	fx.Transform:SetPosition(pos:Get())
	inst:RemoveTag("notarget") 

end
elseif inst:HasTag("backstab2") and inst:HasTag("sneaka") and not other:HasTag("wall") and not other:HasTag("structure") then
	    if not other.sg:HasStateTag("attack") and not other.sg:HasStateTag("shield") and not other.sg:HasStateTag("moving") and not other:HasTag("wall") and not other:HasTag("structure") and not other.sg:HasStateTag("frozen") then
	inst.components.colourtweener:StartTween({1,1,1,1}, 0)
inst:RemoveTag("sneaka") 
	inst.components.talker:Say("成功的背刺 !!")
        other.components.health:DoDelta(-700)
	local dark1 = SpawnPrefab("statue_transition")
	local pos = Vector3(other.Transform:GetWorldPosition())
	dark1.Transform:SetPosition(pos:Get())
	dark1.Transform:SetScale(0.5,4,0.5)
	local fx = SpawnPrefab("explode_small")
	local pos = Vector3(other.Transform:GetWorldPosition())
	fx.Transform:SetPosition(pos:Get())
inst:RemoveTag("notarget") 
        other.SoundEmitter:PlaySound("dontstarve/wilson/blowdart_impact_sleep")
	inst.components.sanity:DoDelta(160)

elseif other.sg:HasStateTag("frozen") then
	inst.components.colourtweener:StartTween({1,1,1,1}, 0)
inst:RemoveTag("sneaka") 
	inst.components.talker:Say("成功的背刺!!\n冰冻目标 - 伤害减半")
        other.components.health:DoDelta(-350)
	local dark1 = SpawnPrefab("statue_transition")
	local pos = Vector3(other.Transform:GetWorldPosition())
	dark1.Transform:SetPosition(pos:Get())
	dark1.Transform:SetScale(0.5,4,0.5)
	local fx = SpawnPrefab("explode_small")
	local pos = Vector3(other.Transform:GetWorldPosition())
	fx.Transform:SetPosition(pos:Get())
inst:RemoveTag("notarget") 
        other.SoundEmitter:PlaySound("dontstarve/wilson/blowdart_impact_sleep")
	inst.components.sanity:DoDelta(160)

    elseif other.sg:HasStateTag("attack") or other.sg:HasStateTag("shield") or other.sg:HasStateTag("moving") then
	inst.components.colourtweener:StartTween({1,1,1,1}, 0)
inst:RemoveTag("sneaka") 
	inst.components.talker:Say("失败的背刺..")
	local fx = SpawnPrefab("splash")
	local pos = Vector3(other.Transform:GetWorldPosition())
	fx.Transform:SetPosition(pos:Get())
	inst:RemoveTag("notarget") 


end
elseif inst:HasTag("backstab3") and inst:HasTag("sneaka") and not other:HasTag("wall") and not other:HasTag("structure") then
	    if not other.sg:HasStateTag("attack") and not other.sg:HasStateTag("shield") and not other.sg:HasStateTag("moving") and not other:HasTag("wall") and not other:HasTag("structure") and not other.sg:HasStateTag("frozen") then
	inst.components.colourtweener:StartTween({1,1,1,1}, 0)
inst:RemoveTag("sneaka") 
	inst.components.talker:Say("成功的背刺!!")
        other.components.health:DoDelta(-1000)
	local dark1 = SpawnPrefab("statue_transition")
	local pos = Vector3(other.Transform:GetWorldPosition())
	dark1.Transform:SetPosition(pos:Get())
	dark1.Transform:SetScale(0.5,4,0.5)
	local fx = SpawnPrefab("explode_small")
	local pos = Vector3(other.Transform:GetWorldPosition())
	fx.Transform:SetPosition(pos:Get())
inst:RemoveTag("notarget") 
        other.SoundEmitter:PlaySound("dontstarve/wilson/blowdart_impact_sleep")
	inst.components.sanity:DoDelta(240)

elseif other.sg:HasStateTag("frozen") then
	inst.components.colourtweener:StartTween({1,1,1,1}, 0)
inst:RemoveTag("sneaka") 
	inst.components.talker:Say("成功的背刺!!\n冰冻目标 - 伤害减半")
        other.components.health:DoDelta(-500)
	local dark1 = SpawnPrefab("statue_transition")
	local pos = Vector3(other.Transform:GetWorldPosition())
	dark1.Transform:SetPosition(pos:Get())
	dark1.Transform:SetScale(0.5,4,0.5)
	local fx = SpawnPrefab("explode_small")
	local pos = Vector3(other.Transform:GetWorldPosition())
	fx.Transform:SetPosition(pos:Get())
inst:RemoveTag("notarget") 
        other.SoundEmitter:PlaySound("dontstarve/wilson/blowdart_impact_sleep")
	inst.components.sanity:DoDelta(240)

    elseif other.sg:HasStateTag("attack") or other.sg:HasStateTag("shield") or other.sg:HasStateTag("moving") then
	inst.components.colourtweener:StartTween({1,1,1,1}, 0)
inst:RemoveTag("sneaka") 
	inst.components.talker:Say("失败的背刺..")
	local fx = SpawnPrefab("splash")
	local pos = Vector3(other.Transform:GetWorldPosition())
	fx.Transform:SetPosition(pos:Get())
	inst:RemoveTag("notarget") 

end
    end
end

local function fsneakattack(inst, data)
    if inst:HasTag("sneaka") then
	inst.components.colourtweener:StartTween({1,1,1,1}, 0)
inst:RemoveTag("sneaka") 
	local fx = SpawnPrefab("statue_transition_2")
        fx.entity:SetParent(inst.entity)
	fx.Transform:SetScale(1.2, 1.2, 1.2)
        fx.Transform:SetPosition(0, 0, 0)
	inst.components.talker:Say("Musha被敌人发现了!")
inst:RemoveTag("notarget") 
    end
end

local function shadows(inst, data)
--if inst.level >7002 and 
--and not inst:HasTag("shadowmusha") 
	local player = GetPlayer()
if inst.level >7003 and inst:HasTag("shadowb") and inst:HasTag("shadows") and inst.components.sanity:GetMaxSanity() >= 50 and inst.components.health.currenthealth >= 40 then

        			inst.level = inst.level - 2

        local bunsin = SpawnPrefab("shadowmusha")
	local dark2 = SpawnPrefab("statue_transition_2")
	local pos = Vector3(inst.Transform:GetWorldPosition())
	dark2.Transform:SetPosition(pos:Get())
	bunsin.Transform:SetPosition(pos:Get())
        bunsin.components.follower:SetLeader(player)
        inst.components.health:DoDelta(-30)
        inst.SoundEmitter:PlaySound("dontstarve/maxwell/shadowmax_appear")

	levelexp(inst)	

end
inst:RemoveTag("shadows") 
end

local function gdogs(inst, data)
--and not inst:HasTag("shadowmusha") 
local dogchance = 0.3
local dogchance2 = 0.2
	local player = GetPlayer()
if math.random() < dogchance and inst:HasTag("ghoundb") and inst:HasTag("ghound") and inst.components.health.currenthealth >= 40 and not inst:HasTag("ghounds") then
inst:AddTag("ghounds") 
if inst.components.playercontroller then
  inst.components.playercontroller:Enable(false)
inst.sg:GoToState("play_flute")
--inst.sg:GoToState("enter_onemanband")
scheduler:ExecuteInTime(3, function()
inst.components.playercontroller:Enable(true) 
        local dog = SpawnPrefab("ghosthound")
	local dark2 = SpawnPrefab("statue_transition_2")
	local pos = Vector3(inst.Transform:GetWorldPosition())
	dark2.Transform:SetPosition(pos:Get())
	dog.Transform:SetPosition(pos:Get())
        dog.components.follower:SetLeader(player)
        inst.components.health:DoDelta(-20)
       -- inst.components.sanity:DoDelta(-20)
inst.SoundEmitter:PlaySound("dontstarve/maxwell/shadowmax_appear")
inst:RemoveTag("ghound")
 end) end 
elseif math.random() < dogchance2 and inst:HasTag("ghoundb") and inst:HasTag("ghound") and inst.components.health.currenthealth >= 40 and not inst:HasTag("ghounds") then
inst:AddTag("ghounds") 
if inst.components.playercontroller then
  inst.components.playercontroller:Enable(false)
--inst.sg:GoToState("play_flute")
inst.sg:GoToState("enter_onemanband")
scheduler:ExecuteInTime(5, function()
inst.components.playercontroller:Enable(true) 
        local dog = SpawnPrefab("ghosthound")
	local dog2 = SpawnPrefab("ghosthound")
	local dark2 = SpawnPrefab("statue_transition_2")
	local pos = Vector3(inst.Transform:GetWorldPosition())
	dark2.Transform:SetPosition(pos:Get())
	dog.Transform:SetPosition(pos:Get())
        dog.components.follower:SetLeader(player)
	dog2.Transform:SetPosition(pos:Get())
        dog2.components.follower:SetLeader(player)
        inst.components.health:DoDelta(-20)
        inst.components.sanity:DoDelta(20)
inst.SoundEmitter:PlaySound("dontstarve/maxwell/shadowmax_appear")
inst:RemoveTag("ghound")
 end) end 
elseif inst:HasTag("ghoundb") and inst:HasTag("ghound") and inst.components.health.currenthealth >= 40 and not inst:HasTag("ghounds") then
inst:AddTag("ghounds") 
if inst.components.playercontroller then
  inst.components.playercontroller:Enable(false)
inst.sg:GoToState("play_flute")
--inst.sg:GoToState("enter_onemanband")
scheduler:ExecuteInTime(3, function()
inst.components.playercontroller:Enable(true) 
        local dog = SpawnPrefab("ghosthound")
	local dark2 = SpawnPrefab("statue_transition_2")
	local pos = Vector3(inst.Transform:GetWorldPosition())
	dark2.Transform:SetPosition(pos:Get())
	dog.Transform:SetPosition(pos:Get())
        dog.components.follower:SetLeader(player)
        inst.components.health:DoDelta(-20)
       -- inst.components.sanity:DoDelta(-20)
inst.SoundEmitter:PlaySound("dontstarve/maxwell/shadowmax_appear")
inst:RemoveTag("ghound")
 end) end 

 end end

local function valkyriehp(inst, data)

--[[valkyrie status and DLC]]

if inst:HasTag("DLC") and not inst:HasTag("cureo0") and not inst:HasTag("cureo1") and not inst:HasTag("cureo2") and not inst.components.health:IsDead() then
if inst:HasTag("valkyrieh") and inst.components.health:GetPercent() < .3 then
	inst.components.health:StartRegen(0, 0)
	inst.components.health:SetAbsorptionAmount(0.5)
elseif inst:HasTag("valkyrieh") and inst.components.health:GetPercent() >= .3 and inst.components.health:GetPercent() < .4 then
	inst.components.health:StartRegen(-1, 5)
	inst.components.health:SetAbsorptionAmount(0.45)
elseif inst:HasTag("valkyrieh") and inst.components.health:GetPercent() >= .4 and inst.components.health:GetPercent() < .5 then
	inst.components.health:StartRegen(-1, 4)
	inst.components.health:SetAbsorptionAmount(0.4)
elseif inst:HasTag("valkyrieh") and inst.components.health:GetPercent() >= .5 and inst.components.health:GetPercent() < .6 then
	inst.components.health:StartRegen(-1, 3)
	inst.components.health:SetAbsorptionAmount(0.35)
elseif inst:HasTag("valkyrieh") and inst.components.health:GetPercent() >= .6 and inst.components.health:GetPercent() < .7 then
	inst.components.health:StartRegen(-1, 2)
	inst.components.health:SetAbsorptionAmount(0.3)
elseif inst:HasTag("valkyrieh") and inst.components.health:GetPercent() >= .7 and inst.components.health:GetPercent() < .8 then
	inst.components.health:StartRegen(-1, 1.5)
	inst.components.health:SetAbsorptionAmount(0.25)
elseif inst:HasTag("valkyrieh") and inst.components.health:GetPercent() >= .8 and inst.components.health:GetPercent() <= 1 then
	inst.components.health:StartRegen(-1, 1)
	inst.components.health:SetAbsorptionAmount(0.2)

	elseif inst:HasTag("berserkarmor") and inst:HasTag("crazy") and not inst:HasTag("valkyrieh") then
	inst.components.health:StartRegen(1, 1)
	inst.components.health:SetAbsorptionAmount(0.2)

	elseif not inst:HasTag("berserkarmor") and inst:HasTag("crazy")  then
	inst.components.health:StartRegen(0, 0)
	inst.components.health:SetAbsorptionAmount(0)

	elseif not inst:HasTag("valkyrieh") and not inst:HasTag("crazy")  then
	inst.components.health:StartRegen(0, 0)
	inst.components.health:SetAbsorptionAmount(0)

	end


--[[valkyrie status and Orizinal]]


if not inst:HasTag("DLC") and not inst:HasTag("cureo0") and not inst:HasTag("cureo1") and not inst:HasTag("cureo2") and not inst.components.health:IsDead() then
if inst:HasTag("valkyrieh") and inst.components.health:GetPercent() < .3 then
	inst.components.health:StartRegen(0, 0)
	inst.components.health:SetAbsorbAmount(0.5)
elseif inst:HasTag("valkyrieh") and inst.components.health:GetPercent() >= .3 and inst.components.health:GetPercent() < .4 then
	inst.components.health:StartRegen(-1, 5)
	inst.components.health:SetAbsorbAmount(0.45)
elseif inst:HasTag("valkyrieh") and inst.components.health:GetPercent() >= .4 and inst.components.health:GetPercent() < .5 then
	inst.components.health:StartRegen(-1, 4)
	inst.components.health:SetAbsorbAmount(0.4)
elseif inst:HasTag("valkyrieh") and inst.components.health:GetPercent() >= .5 and inst.components.health:GetPercent() < .6 then
	inst.components.health:StartRegen(-1, 3)
	inst.components.health:SetAbsorbAmount(0.35)
elseif inst:HasTag("valkyrieh") and inst.components.health:GetPercent() >= .6 and inst.components.health:GetPercent() < .7 then
	inst.components.health:StartRegen(-1, 2)
	inst.components.health:SetAbsorbAmount(0.3)
elseif inst:HasTag("valkyrieh") and inst.components.health:GetPercent() >= .7 and inst.components.health:GetPercent() < .8 then
	inst.components.health:StartRegen(-1, 1)
	inst.components.health:SetAbsorbAmount(0.25)
elseif inst:HasTag("valkyrieh") and inst.components.health:GetPercent() >= .8 and inst.components.health:GetPercent() <= 1 then
	inst.components.health:StartRegen(-1, 0.5)
	inst.components.health:SetAbsorbAmount(0.2)

	elseif inst:HasTag("berserkarmor") and inst:HasTag("crazy") and not inst:HasTag("valkyrieh") then
	inst.components.health:StartRegen(1, 1)
	inst.components.health:SetAbsorbAmount(0.2)

	elseif not inst:HasTag("valkyrieh") and not  inst:HasTag("berserkarmor") and not inst:HasTag("crazy") then
	inst.components.health:StartRegen(0, 0)
	inst.components.health:SetAbsorbAmount(0)

	end

end
end

end


local function applystats(inst)

    if GetClock():IsDay() then
		if inst.strength == "full" then
			inst.AnimState:SetBuild("musha")
			inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 1.3)
			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1)
			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1)
			TUNING.SANITY_DAY_GAIN = 10/60

		elseif inst.strength == "normal" then	
			inst.AnimState:SetBuild("musha_normal")
			inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 1.0)
			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.1)
			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.1)
			TUNING.SANITY_DAY_GAIN = 0/60

		elseif inst.strength == "Valkyrie" then
			inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 5)
			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.3 )
			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.3 )
			TUNING.SANITY_DAY_GAIN = 0/60

		elseif inst.strength == "berserk" then
			inst.components.temperature.hurtrate = 0
			inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 0.6)
			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.5 )
			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.5 )
			TUNING.SANITY_DAY_GAIN = -25/60
			inst.components.temperature.hurtrate = 0

		end

 	elseif GetClock():IsDusk() then
		if inst.strength == "full" then	
			inst.AnimState:SetBuild("musha")
			inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 1.2)
			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 0.9)
			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 0.9)
			TUNING.SANITY_NIGHT_LIGHT = 5/60
			TUNING.SANITY_NIGHT_MID = 2/60

		elseif inst.strength == "normal" then	
			inst.AnimState:SetBuild("musha_normal")
			inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 0.9)
			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1)
			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1)
			TUNING.SANITY_NIGHT_LIGHT = 0/60
			TUNING.SANITY_NIGHT_MID = -8/60

		elseif inst.strength == "Valkyrie" then
			inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 5)
			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.3)
			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.3 )
			TUNING.SANITY_NIGHT_LIGHT = 0/60
			TUNING.SANITY_NIGHT_MID = -10/60

		elseif inst.strength == "berserk" then
			inst.components.temperature.hurtrate = 0
			inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 0.5)
			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.4 )
			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.4 )
			TUNING.SANITY_NIGHT_LIGHT = -25/60
			TUNING.SANITY_NIGHT_MID = -25/60
			inst.components.temperature.hurtrate = 0

		end

    elseif GetClock():IsNight() then
		if inst.strength == "full" then	
			inst.AnimState:SetBuild("musha")
			inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 1.0)
			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 0.8)
			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 0.8)
			TUNING.SANITY_NIGHT_LIGHT = 2/60
			TUNING.SANITY_NIGHT_DARK = 0/60

		elseif inst.strength == "normal" then	
			inst.AnimState:SetBuild("musha_normal")
			inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 0.8)
			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 0.9)
			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 0.9)
			TUNING.SANITY_NIGHT_LIGHT = -8/60
			TUNING.SANITY_NIGHT_DARK = -15/60

		elseif inst.strength == "Valkyrie" then
			inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 5)
			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.3)
			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.3)
			TUNING.SANITY_NIGHT_LIGHT = -10/60
			TUNING.SANITY_NIGHT_DARK = -17/60

		elseif inst.strength == "berserk" then
			inst.components.temperature.hurtrate = 0
			inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 0.4 )
			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.3 )
			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.3 )
			TUNING.SANITY_NIGHT_LIGHT = -25/60
			TUNING.SANITY_NIGHT_DARK = -25/60
			inst.components.temperature.hurtrate = 0

		end	
	end
end


local function phasechange(inst, data)

if inst.strength == "full" then

	if inst:HasTag("Valkyrie") and inst:HasTag("Valkyrieh") and not inst:HasTag("berserks") and not inst:HasTag("fberserk") then

			inst.strength = "Valkyrie"
			inst.AnimState:SetBuild("musha_battle")
	inst.soundsname = "willow"
inst:RemoveTag("crazy")
    inst.components.combat:SetAttackPeriod(.15)
inst.components.combat:SetAreaDamage(0, 0)
    inst:RemoveEventCallback("attacked", Onfreeze)
    inst:RemoveEventCallback("onhitother", berserkattack)
    inst:RemoveEventCallback("onhitother", OnHitfreeze)
    inst:ListenForEvent("onhitother", OnHitcritical)

inst.components.health.fire_damage_scale = 0
inst.components.temperature.hurtrate = 1
	local sparks = SpawnPrefab("sparks")
	local pos = Vector3(inst.Transform:GetWorldPosition())
	sparks.Transform:SetPosition(pos:Get())

		--inst.components.talker:Say("我是女武神 !")

		elseif inst.components.hunger.current < 160 and inst.components.hunger.current > 40 and not inst:HasTag("Valkyrieh") and not inst:HasTag("berserks") and not inst:HasTag("fberserk") then

			inst.strength = "normal"
			inst.AnimState:SetBuild("musha_normal")
	inst.soundsname = "willow"
inst:RemoveTag("crazy")
    inst.components.combat:SetAttackPeriod(.5)
inst.components.combat:SetAreaDamage(0, 0)
    inst:RemoveEventCallback("attacked", Onfreeze)
    inst:RemoveEventCallback("onhitother", berserkattack)
    inst:RemoveEventCallback("onhitother", OnHitfreeze)

inst.components.health.fire_damage_scale = 1
inst.components.temperature.hurtrate = 1
	
		---inst.components.talker:Say("有点饿了.")

		elseif inst:HasTag("berserks") or inst:HasTag("fberserk") then
 
			inst.strength = "berserk"
			inst.AnimState:SetBuild("musha_hunger")
	inst.soundsname = "wendy"
inst:AddTag("crazy")
    inst.components.combat:SetAttackPeriod(.05)
inst.components.combat:SetAreaDamage(2.5, .5)
    inst:ListenForEvent("attacked", Onfreeze)
    inst:ListenForEvent("onhitother", berserkattack)
    inst:ListenForEvent("onhitother", OnHitfreeze)

inst.components.health.fire_damage_scale = 1
inst.components.temperature.hurtrate = 0
	inst:RemoveTag("Valkyrieh") 
	inst:AddTag("Valkyriech2") 
	local dark1 = SpawnPrefab("statue_transition")
	local pos = Vector3(inst.Transform:GetWorldPosition())
	dark1.Transform:SetPosition(pos:Get())

			inst.components.talker:Say("Krrrrrr...")

		end

else
if inst.strength == "Valkyrie" then

		if inst.components.hunger.current < 160 and inst:HasTag("Valkyriech2") and not inst:HasTag("berserks") and not inst:HasTag("fberserk") then

			inst.strength = "normal"
			inst.AnimState:SetBuild("musha_normal")
	inst.soundsname = "willow"
inst:RemoveTag("crazy")
    inst.components.combat:SetAttackPeriod(.5)
inst.components.combat:SetAreaDamage(0, 0)
inst.components.combat:SetRange(2)
    inst:RemoveEventCallback("attacked", Onfreeze)
    inst:RemoveEventCallback("onhitother", berserkattack)
    inst:RemoveEventCallback("onhitother", OnHitfreeze)
inst.components.health.fire_damage_scale = 1
inst.components.temperature.hurtrate = 1
		inst:RemoveTag("Valkyrieh")
	local sparks = SpawnPrefab("sparks")
	local pos = Vector3(inst.Transform:GetWorldPosition())
	sparks.Transform:SetPosition(pos:Get())
		inst.Light:Enable(false)
inst.AnimState:SetBloomEffectHandle( "" )
			--inst.components.talker:Say("Musha, 感觉不错")

		elseif inst.components.hunger.current > 160 and inst:HasTag("Valkyriech2") and not inst:HasTag("fberserk") and not inst:HasTag("berserks") then

			inst.strength = "full"
			inst.AnimState:SetBuild("musha")
	inst.soundsname = "willow"
inst:RemoveTag("crazy")
    inst.components.combat:SetAttackPeriod(.6)
inst.components.combat:SetAreaDamage(0, 0)
inst.components.combat:SetRange(2)
    inst:RemoveEventCallback("attacked", Onfreeze)
    inst:RemoveEventCallback("onhitother", berserkattack)
    inst:RemoveEventCallback("onhitother", OnHitfreeze)
inst.components.health.fire_damage_scale = 1
inst.components.temperature.hurtrate = 1
		inst:RemoveTag("Valkyrieh")
	local sparks = SpawnPrefab("sparks")
	local pos = Vector3(inst.Transform:GetWorldPosition())
	sparks.Transform:SetPosition(pos:Get())
		inst.Light:Enable(false)
inst.AnimState:SetBloomEffectHandle( "" )

	--	inst.components.talker:Say("简单")

		elseif inst:HasTag("berserks") or inst:HasTag("fberserk") then
 
			inst.strength = "berserk"
			inst.AnimState:SetBuild("musha_hunger")
	inst.soundsname = "wendy"
inst:AddTag("crazy")
    inst.components.combat:SetAttackPeriod(.05)
inst.components.combat:SetAreaDamage(2.5, .5)
inst.components.combat:SetRange(2)
    inst:ListenForEvent("attacked", Onfreeze)
    inst:ListenForEvent("onhitother", berserkattack)
    inst:ListenForEvent("onhitother", OnHitfreeze)
inst.components.health.fire_damage_scale = 1
inst.components.temperature.hurtrate = 0
	inst:RemoveTag("Valkyrieh") 
	inst:AddTag("Valkyriech2") 
	local dark1 = SpawnPrefab("statue_transition")
	local pos = Vector3(inst.Transform:GetWorldPosition())
		dark1.Transform:SetPosition(pos:Get())
inst.AnimState:SetBloomEffectHandle( "" )
			inst.components.talker:Say("Grrrrrr...")

		end

else
if inst.strength == "normal" then

	if inst:HasTag("Valkyrieh") and not inst:HasTag("berserks") and not inst:HasTag("fberserk") then

			inst.strength = "Valkyrie"
			inst.AnimState:SetBuild("musha_battle")
	inst.soundsname = "willow"
inst:RemoveTag("crazy")
    inst.components.combat:SetAttackPeriod(.15)
inst.components.combat:SetAreaDamage(0, 0)
    inst:RemoveEventCallback("attacked", Onfreeze)
    inst:RemoveEventCallback("onhitother", berserkattack)
    inst:RemoveEventCallback("onhitother", OnHitfreeze)
    inst:ListenForEvent("onhitother", OnHitcritical)

inst.components.health.fire_damage_scale = 0
inst.components.temperature.hurtrate = 1
	local sparks = SpawnPrefab("sparks")
	local pos = Vector3(inst.Transform:GetWorldPosition())
	sparks.Transform:SetPosition(pos:Get())

		--inst.components.talker:Say("战斗 !!")

		elseif inst.components.hunger.current > 160 and not inst:HasTag("Valkyrieh") and not inst:HasTag("berserks") and not inst:HasTag("fberserk") then

			inst.strength = "full"
			inst.AnimState:SetBuild("musha")
	inst.soundsname = "willow"
inst:RemoveTag("crazy")
    inst.components.combat:SetAttackPeriod(.6)
inst.components.combat:SetAreaDamage(0, 0)
    inst:RemoveEventCallback("attacked", Onfreeze)
    inst:RemoveEventCallback("onhitother", berserkattack)
    inst:RemoveEventCallback("onhitother", OnHitfreeze)

inst.components.health.fire_damage_scale = 1
	
		--inst.components.talker:Say("快乐的心情!")

		elseif inst:HasTag("berserks") or inst:HasTag("fberserk") then
 
			inst.strength = "berserk"
			inst.AnimState:SetBuild("musha_hunger")
	inst.soundsname = "wendy"
inst:AddTag("crazy")
    inst.components.combat:SetAttackPeriod(.05)
inst.components.combat:SetAreaDamage(2.5, .5)
    inst:ListenForEvent("attacked", Onfreeze)
    inst:ListenForEvent("onhitother", berserkattack)
    inst:ListenForEvent("onhitother", OnHitfreeze)
	local dark1 = SpawnPrefab("statue_transition")
	local pos = Vector3(inst.Transform:GetWorldPosition())
	dark1.Transform:SetPosition(pos:Get())

inst.components.health.fire_damage_scale = 1
inst.components.temperature.hurtrate = 0
	inst:RemoveTag("Valkyrieh") 
	inst:AddTag("Valkyriech2") 
	
			inst.components.talker:Say("Krrrrrr...")

		end
else
if inst.strength == "berserk" then

	if inst.components.hunger.current > 160 and not inst:HasTag("berserks") and not inst:HasTag("fberserk") then
			inst.strength = "full"
			inst.AnimState:SetBuild("musha")
	inst.soundsname = "willow"
		inst:RemoveTag("berserks") 
		inst:RemoveTag("fberserk") 
inst:RemoveTag("crazy")
    inst.components.combat:SetAttackPeriod(.6)
inst.components.combat:SetAreaDamage(0, 0)
    inst:RemoveEventCallback("attacked", Onfreeze)
    inst:RemoveEventCallback("onhitother", berserkattack)
    inst:RemoveEventCallback("onhitother", OnHitfreeze)
	local dark2 = SpawnPrefab("statue_transition_2")
	local pos = Vector3(inst.Transform:GetWorldPosition())
	dark2.Transform:SetPosition(pos:Get())
inst.components.health.fire_damage_scale = 1
inst.components.temperature.hurtrate = 1
	
	inst.components.talker:Say("...我不记得.. ")

	elseif inst.components.hunger.current < 160 and not inst:HasTag("berserks") and not inst:HasTag("fberserk") then

			inst.strength = "normal"
			inst.AnimState:SetBuild("musha_normal")
	inst.soundsname = "willow"
		inst:RemoveTag("berserks") 
		inst:RemoveTag("fberserk") 
inst:RemoveTag("crazy")
    inst.components.combat:SetAttackPeriod(.5)
inst.components.combat:SetAreaDamage(0, 0)
    inst:RemoveEventCallback("attacked", Onfreeze)
    inst:RemoveEventCallback("onhitother", berserkattack)
    inst:RemoveEventCallback("onhitother", OnHitfreeze)
	local dark2 = SpawnPrefab("statue_transition_2")
	local pos = Vector3(inst.Transform:GetWorldPosition())
	dark2.Transform:SetPosition(pos:Get())
inst.components.health.fire_damage_scale = 1
inst.components.temperature.hurtrate = 1
	
	inst.components.talker:Say("...我不记得.. ")

------force berserk

		elseif inst:HasTag("fberserk") and inst.components.sanity:GetPercent() < 0.3 and inst.components.hunger.current > 160  then
			inst.strength = "full"
			inst.AnimState:SetBuild("musha")
	inst.soundsname = "willow"
		inst:RemoveTag("berserks") 
		inst:RemoveTag("fberserk") 
inst:RemoveTag("crazy")
    inst.components.combat:SetAttackPeriod(.5)
inst.components.combat:SetAreaDamage(0, 0)
    inst:RemoveEventCallback("attacked", Onfreeze)
    inst:RemoveEventCallback("onhitother", berserkattack)
    inst:RemoveEventCallback("onhitother", OnHitfreeze)
	local dark2 = SpawnPrefab("statue_transition_2")
	local pos = Vector3(inst.Transform:GetWorldPosition())
	dark2.Transform:SetPosition(pos:Get())
inst.components.health.fire_damage_scale = 1
inst.components.temperature.hurtrate = 1
		inst:RemoveTag("berserks") 
		inst:RemoveTag("fberserk") 
inst:RemoveTag("crazy")
		inst.components.talker:Say("...我 不 记 得 上 次 吃 东 西 是 什 么 时 候 了?")

		elseif not inst:HasTag("berserks") and inst:HasTag("fberserk") and inst.components.sanity:GetPercent() < 0.3 and inst.components.hunger.current < 160 then
			inst.strength = "normal"
			inst.AnimState:SetBuild("musha_normal")
	inst.soundsname = "willow"
		inst:RemoveTag("berserks") 
		inst:RemoveTag("fberserk") 
inst:RemoveTag("crazy")
    inst.components.combat:SetAttackPeriod(.5)
inst.components.combat:SetAreaDamage(0, 0)
    inst:RemoveEventCallback("attacked", Onfreeze)
    inst:RemoveEventCallback("onhitother", berserkattack)
    inst:RemoveEventCallback("onhitother", OnHitfreeze)
	local dark2 = SpawnPrefab("statue_transition_2")
	local pos = Vector3(inst.Transform:GetWorldPosition())
	dark2.Transform:SetPosition(pos:Get())
inst.components.health.fire_damage_scale = 1
inst.components.temperature.hurtrate = 1
	
		inst.components.talker:Say("...我 不 记 得 上 次 吃 东 西 是 什 么 时 候 了?")

		end

	end
	end
	end
end
	
	applystats(inst)
end

local fn = function(inst)

	inst.soundsname = "willow"
    inst.entity:AddMiniMapEntity()
	inst.MiniMapEntity:SetIcon( "mushas.tex" )
	inst.level = 0
	inst.components.eater:SetOnEatFn(expeat)
inst:ListenForEvent("levelup", levelexp)
	inst.strength = "normal"
	--inst.components.health:SetMaxHealth(50)
	inst.components.hunger:SetMax(200)
    	inst.components.sanity:SetMax(100)
 --inst.components.combat.damagemultiplier = TUNING.WENDY_DAMAGE_MULT
inst:AddTag("musha")
--inst:AddTag("yamcheb")
inst:AddTag("effectsheild2") 
inst:AddTag("level1") 
--inst:AddTag("shadowb") 
inst:AddTag("ghoundb") 

    inst:AddComponent("talker")
    --inst.components.talker.ontalk = ontalk

  --  inst.components.talker.fontsize = 30
   -- inst.components.talker.font = TALKINGFONT
    inst.components.talker.colour = Vector3(1, 0.75, 1, 1)

--   inst:AddComponent("sanityaura")
	inst:AddComponent("colourtweener")
   inst:ListenForEvent("onhitother", sneakattack)
   inst:ListenForEvent("attacked", fsneakattack)

-----------light on
    inst.entity:AddLight()
	inst.Light:SetRadius(.6)
    inst.Light:SetFalloff(.8)
    inst.Light:SetIntensity(.5)
    inst.Light:SetColour(255/255,255/255,255/255)
	inst.Light:Enable(false)

        inst.procfn = function() tryproc(inst) end
        inst:ListenForEvent("attacked", inst.procfn)

        inst.shieldfn = function() shieldproc(inst) end
inst:ListenForEvent( "healthdelta", inst.shieldfn )
inst:ListenForEvent("hungerdelta", inst.shieldfn )

	inst:AddComponent("playerlightningtarget")
--------------------------------------------------------------
--test bird
--[[
    inst:AddComponent("childspawner")
    inst.components.childspawner.childname = "musha_tall2"
    inst.components.childspawner:StartSpawning()
    inst.components.childspawner.maxchildren = 1
]]--

    ----------------------------------------------------------
   -- inst.userfunctions =    {updatestats = updatestats}
	-- eater
    inst.components.eater:SetOmnivore()

	--inst.components.eater.strongstomach = true

inst:ListenForEvent( "attacked", fshieldupgrade)
inst:ListenForEvent("hungerdelta", removeskill)
--inst:ListenForEvent("healthdelta", removeskill)
inst:ListenForEvent("hungerdelta", shadows)
inst:ListenForEvent("hungerdelta", gdogs)
inst:ListenForEvent("hungerdelta", berserkchanger)
--inst:ListenForEvent( "onhitother", powerattack)
inst:ListenForEvent( "hungerdelta", powerattack)
inst:ListenForEvent( "attacked", powerattack)
inst:ListenForEvent( "healthdelta", valkyriehp)
inst:ListenForEvent("hungerdelta", phasechange)

	inst:ListenForEvent( "dusktime", function() applystats(inst) end , GetWorld())
        inst:ListenForEvent( "daytime", function() applystats(inst) end , GetWorld())
        inst:ListenForEvent( "nighttime", function() applystats(inst) end , GetWorld())
         applystats(inst)

	inst:AddComponent("reader")
    inst.components.eater.stale_hunger = .5
--TUNING.WICKERBOTTOM_STALE_FOOD_HUNGER
    inst.components.eater.stale_health =  TUNING.WICKERBOTTOM_STALE_FOOD_HEALTH
    inst.components.eater.spoiled_hunger = TUNING.WICKERBOTTOM_SPOILED_FOOD_HUNGER
    inst.components.eater.spoiled_health = TUNING.WICKERBOTTOM_SPOILED_FOOD_HEALTH

	--inst.components.builder.science_bonus = 1
	local booktab = {str = STRINGS.TABS.BOOKS, sort=999, icon = "tab_book.tex"}
	inst.components.builder:AddRecipeTab(booktab)

	Recipe("book_birds", {Ingredient("papyrus", 2), Ingredient("bird_egg", 2)}, booktab, {SCIENCE = 0, MAGIC = 0, ANCIENT = 0})
	Recipe("book_gardening", {Ingredient("papyrus", 2), Ingredient("seeds", 1), Ingredient("poop", 1)}, booktab, {SCIENCE = 1})
	Recipe("book_sleep", {Ingredient("papyrus", 2), Ingredient("nightmarefuel", 2)}, booktab, {MAGIC = 2})
	Recipe("book_brimstone", {Ingredient("papyrus", 2), Ingredient("redgem", 1)}, booktab, {MAGIC = 3})
	Recipe("book_tentacles", {Ingredient("papyrus", 2), Ingredient("tentaclespots", 1)}, booktab, {SCIENCE = 3})

	inst.OnSave = onsave
	inst.OnPreLoad = onpreload

    inst:ListenForEvent("entity_death", function(wrld, data) onkilll(inst, data) end, GetWorld())

    return inst

end


--------------------------------------------------------------

STRINGS.CHARACTER_TITLES.musha = "精灵公主 Musha"
STRINGS.CHARACTER_NAMES.musha = "musha"
STRINGS.CHARACTER_DESCRIPTIONS.musha = "[升级和解锁技能] 等级(C) 技能(X)\n[宠物 Yamche] 战斗指挥(Y)\n护盾(T)女武神(V)闪电攻击(G)狗(J)影子(H)"
STRINGS.CHARACTER_QUOTES.musha = "\" 我是真正的公主 ! \""
STRINGS.CHARACTERS.musha = {}
STRINGS.CHARACTERS.musha.DESCRIBE = {}


return MakePlayerCharacter("musha", prefabs, assets, fn, start_inv)
