local assets = 
{
	Asset("ANIM", "anim/rongyan_1.zip"),
	Asset("ANIM", "anim/rongyan_2.zip"),
	Asset("ANIM", "anim/zhiliao.zip"),
	Asset("ANIM", "anim/jianyu.zip"),
	Asset("ANIM", "anim/lingli_fx.zip"),
	Asset("ANIM", "anim/toso_xuanfeng.zip"),
	Asset("ANIM", "anim/xuanfeng.zip"),
	Asset("ANIM", "anim/toso_leiting.zip"),
	Asset("ANIM", "anim/luoyan_toso.zip"),
	Asset("ANIM", "anim/dilie.zip"),
	Asset("ANIM", "anim/baoliehuoyan_toso.zip"),
	Asset("ANIM", "anim/changefx_toso.zip"),
	Asset("ANIM", "anim/chuanxinjianfa_toso.zip"),
	Asset("ANIM", "anim/appear1.zip"),
	Asset("ANIM", "anim/liehuodaofa_toso.zip"),
	Asset("ANIM", "anim/baguadun.zip"),
	Asset("ANIM", "anim/ziwen.zip"),
	Asset("ANIM", "anim/baojitexiao.zip"),
	Asset("ANIM", "anim/liekaitexiao.zip"),
	Asset("ANIM", "anim/shaqi_start.zip"),
	Asset("ANIM", "anim/shaqi_over.zip"),
	Asset("ANIM", "anim/shaistate.zip"),

}

local function OnThrown(inst, owner, target)
	inst:FacePoint(Point(target.Transform:GetWorldPosition()))
	GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/boomerang_throw")
end

local function OnHit(inst, owner, target)
    inst:Remove()
    inst.SoundEmitter:PlaySound("dontstarve/creatures/bishop/shotexplo")
end
--[[
local function OnHit(inst, owner, target)
    local impactfx = SpawnPrefab("impact")
    if impactfx then
	    local follower = impactfx.entity:AddFollower()
	    follower:FollowSymbol(target.GUID, target.components.combat.hiteffectsymbol, 0, 0, 0 )
        impactfx:FacePoint(inst.Transform:GetWorldPosition())
    end
    inst:Remove()
end
]]

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

    anim:SetBank("shaistate")
    anim:SetBuild("shaistate")
    anim:PushAnimation("idle", true)

	anim:SetLayer( LAYER_BACKGROUND )
    anim:SetSortOrder( 3 )
    trans:SetScale(1, 1, 1)

    --inst:AddComponent("lighttweener")
    --local light = inst.entity:AddLight()
    --inst.components.lighttweener:StartTween(light, 0, .9, 0.9, {1,1,1}, 0)
    --inst.components.lighttweener:StartTween(nil, 3, .9, 0.9, nil, .2)
    inst:AddTag("FX")
	inst:AddTag("NOCLICK")

    return inst
end

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

    anim:SetBank("shaqi_over")
    anim:SetBuild("shaqi_over")
	anim:PlayAnimation("idle")
    anim:PushAnimation("idle", true)

	anim:SetLayer( LAYER_BACKGROUND )
    anim:SetSortOrder( 3 )
    trans:SetScale(1, 1, 1)

    --inst:AddComponent("lighttweener")
    --local light = inst.entity:AddLight()
    --inst.components.lighttweener:StartTween(light, 0, .9, 0.9, {1,1,1}, 0)
    --inst.components.lighttweener:StartTween(nil, 3, .9, 0.9, nil, .2)
    inst:AddTag("FX")
	inst:AddTag("NOCLICK")

    inst:ListenForEvent("animover", function() inst:Remove() end)
    return inst
end

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

    anim:SetBank("shaqi_start")
    anim:SetBuild("shaqi_start")
    anim:PushAnimation("idle", true)
    trans:SetScale(3, 3, 3)

    inst:AddTag("FX")
	inst:AddTag("NOCLICK")
    inst:ListenForEvent("animover", function() inst:Remove() end)

    return inst
end

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

    anim:SetBank("liekaitexiao")
    anim:SetBuild("liekaitexiao")
    anim:PushAnimation("idle", true)
    trans:SetScale(2.5, 2.5, 2.5)

    inst:AddTag("FX")
	inst:AddTag("NOCLICK")
    inst:ListenForEvent("animover", function() inst:Remove() end)

    return inst
end

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

    anim:SetBank("baojitexiao")
    anim:SetBuild("baojitexiao")
    anim:PushAnimation("idle", true)
    trans:SetScale(2.5, 2.5, 2.5)

    inst:AddTag("FX")
	inst:AddTag("NOCLICK")
    inst:ListenForEvent("animover", function() inst:Remove() end)

    return inst
end

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

    anim:SetBank("ziwen")
    anim:SetBuild("ziwen")
    anim:PushAnimation("idle", true)
    trans:SetScale(2.5, 2.5, 2.5)

    inst:AddTag("FX")
	inst:AddTag("NOCLICK")
    inst:ListenForEvent("animover", function() inst:Remove() end)

    return inst
end

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

    anim:SetBank("baguadun")
    anim:SetBuild("baguadun")
	--anim:PlayAnimation("idle")
    anim:PushAnimation("idle", true)

    trans:SetScale(5, 5, 5)
	
    inst:AddTag("FX")
	inst:AddTag("NOCLICK")

    inst:ListenForEvent("animover", function() inst:Remove() end)
    return inst
end

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

    anim:SetBank("liehuodaofa_toso")
    anim:SetBuild("liehuodaofa_toso")
	anim:PlayAnimation("idle")
    anim:PushAnimation("idle", true)

	anim:SetLayer( LAYER_BACKGROUND )
    anim:SetSortOrder( 3 )
    trans:SetScale(1, 1, 1)

    --inst:AddComponent("lighttweener")
    --local light = inst.entity:AddLight()
    --inst.components.lighttweener:StartTween(light, 0, .9, 0.9, {1,1,1}, 0)
    --inst.components.lighttweener:StartTween(nil, 3, .9, 0.9, nil, .2)
    inst:AddTag("FX")
	inst:AddTag("NOCLICK")

    inst:ListenForEvent("animover", function() inst:Remove() end)
    return inst
end

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

    anim:SetBank("appear1")
    anim:SetBuild("appear1")
	anim:PlayAnimation("idle")
    anim:PushAnimation("idle", true)

    trans:SetScale(1, 1, 1)
    --inst.Transform:SetFourFaced()
    inst:AddTag("FX")
	inst:AddTag("NOCLICK")

    inst:ListenForEvent("animover", function() inst:Remove() end)
    return inst
end

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

    anim:SetBank("chuanxinjianfa_toso")
    anim:SetBuild("chuanxinjianfa_toso")
	anim:PlayAnimation("idle")
    anim:PushAnimation("idle", true)

    trans:SetScale(1, 1, 1)
    --inst.Transform:SetFourFaced()
    inst:AddTag("FX")
	inst:AddTag("NOCLICK")

    inst:ListenForEvent("animover", function() inst:Remove() end)
    return inst
end


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

    anim:SetBank("changefx_toso")
    anim:SetBuild("changefx_toso")
	--anim:PlayAnimation("idle")
    anim:PushAnimation("idle")

    trans:SetScale(3, 3, 3)
    --inst.Transform:SetFourFaced()
    inst:AddTag("FX")
	inst:AddTag("NOCLICK")

    inst:ListenForEvent("animover", function() inst:Remove() end)
    return inst
end

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

    anim:SetBank("baoliehuoyan_toso")
    anim:SetBuild("baoliehuoyan_toso")
	--anim:PlayAnimation("idle")
    anim:PushAnimation("idle")

    trans:SetScale(3, 3, 3)
    --inst.Transform:SetFourFaced()
    inst:AddTag("FX")
	inst:AddTag("NOCLICK")

    inst:ListenForEvent("animover", function() inst:Remove() end)
    return inst
end

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

    anim:SetBank("dilie")
    anim:SetBuild("dilie")
	--anim:PlayAnimation("idle")
    anim:PushAnimation("loops")

    trans:SetScale(1, 1, 1)
    --inst.Transform:SetFourFaced()
    inst:AddTag("FX")
	inst:AddTag("NOCLICK")

    inst:ListenForEvent("animover", function() inst:Remove() end)
    return inst
end

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

    anim:SetBank("luoyan_toso")
    anim:SetBuild("luoyan_toso")
	anim:PlayAnimation("idle")
    --anim:PushAnimation("idle", true)

    trans:SetScale(1, 1, 1)

    inst:AddTag("FX")
	inst:AddTag("NOCLICK")

    inst:ListenForEvent("animover", function() inst:Remove() end)
    return inst
end

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

    anim:SetBank("xuanfeng")
    anim:SetBuild("xuanfeng")
	--anim:PlayAnimation("idle")
    anim:PushAnimation("idle", true)

    trans:SetScale(1, 1, 1)

    inst:AddTag("FX")
	inst:AddTag("NOCLICK")

    inst:ListenForEvent("animover", function() inst:Remove() end)
    return inst
end

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

    anim:SetBank("toso_leiting")
    anim:SetBuild("toso_leiting")
	anim:PlayAnimation("idle")
    anim:PushAnimation("idle", true)

    trans:SetScale(1, 1, 1)

    inst:AddTag("FX")
	inst:AddTag("NOCLICK")

    inst:ListenForEvent("animover", function() inst:Remove() end)
    return inst
end

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

    anim:SetBank("lingli_fx")
    anim:SetBuild("lingli_fx")
    anim:PushAnimation("lunar_3_loop", true)

	anim:SetLayer( LAYER_BACKGROUND )
    anim:SetSortOrder( 3 )
    trans:SetScale(1, 1, 1)

    inst:AddComponent("lighttweener")
    local light = inst.entity:AddLight()
    inst.components.lighttweener:StartTween(light, 0, .9, 0.9, {1,1,1}, 0)
    inst.components.lighttweener:StartTween(nil, 3, .9, 0.9, nil, .2)
    inst:AddTag("FX")
	inst:AddTag("NOCLICK")

    return inst
end



local function nature_wave(Sim)
	local inst = CreateEntity()
	local trans = inst.entity:AddTransform()
    local anim = inst.entity:AddAnimState()
	inst.Transform:SetFourFaced()
    local sound = inst.entity:AddSoundEmitter()

    anim:SetBank("nature_wave")
    anim:SetBuild("nature_wave")
    anim:PushAnimation("idle_side")
    trans:SetScale(1.25, 1.25, 1.25)
--    inst.Transform:SetFourFaced()

    MakeInventoryPhysics(inst)
    RemovePhysicsColliders(inst)

    inst:AddTag("projectile")
    inst.persists = false
    
    inst:AddComponent("projectile")
    inst.components.projectile:SetSpeed(30)
    inst.components.projectile:SetHoming(false)
    inst.components.projectile:SetHitDist(2)
    inst.components.projectile:SetOnHitFn(OnHit)
    inst.components.projectile:SetOnMissFn(OnHit)
    return inst
end

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

    anim:SetBank("jianyu")
    anim:SetBuild("jianyu")
	anim:PlayAnimation("idle")
	anim:PushAnimation("idle", true)
    inst.Transform:SetFourFaced()
    MakeInventoryPhysics(inst)
    RemovePhysicsColliders(inst)

    trans:SetScale(4, 4, 4)

	inst:AddTag("FX")
	inst:AddTag("NOCLICK")

    inst:ListenForEvent("animover", function() inst:Remove() end)
	
    return inst
end

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

    anim:SetBank("rongyan_1")
    anim:SetBuild("rongyan_1")
	anim:PlayAnimation("idle")
	anim:PushAnimation("idle", true)
    --inst.Transform:SetFourFaced()
    MakeInventoryPhysics(inst)
    --RemovePhysicsColliders(inst)

    trans:SetScale(1.2, 1.2, 1.2)

	inst:AddTag("FX")
	inst:AddTag("NOCLICK")

    inst:ListenForEvent("animover", function() inst:Remove() end)
	
    return inst
end

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

    anim:SetBank("rongyan_2")
    anim:SetBuild("rongyan_2")
	anim:PlayAnimation("idle")
	anim:PushAnimation("idle", true)
    --inst.Transform:SetFourFaced()
    MakeInventoryPhysics(inst)
    --RemovePhysicsColliders(inst)

    trans:SetScale(1.2, 1.2, 1.2)

	inst:AddTag("FX")
	inst:AddTag("NOCLICK")

    inst:ListenForEvent("animover", function() inst:Remove() end)
	
    return inst
end

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

    anim:SetBank("deer_ice_flakes")
    anim:SetBuild("zhiliao")
	anim:PlayAnimation("pst")
	anim:PushAnimation("pst", true)
    --inst.Transform:SetFourFaced()
    --MakeInventoryPhysics(inst)
    --RemovePhysicsColliders(inst)

    trans:SetScale(1, 1, 1)

	inst:AddTag("FX")
	inst:AddTag("NOCLICK")

    inst:ListenForEvent("animover", function() inst:Remove() end)
	
    return inst
end

--Prefab( "common/nature_wave", nature_wave, assets),

return Prefab( "common/rongyan_1", rongyan_1, assets),
       Prefab( "common/rongyan_2", rongyan_2, assets),
	   Prefab( "common/zhiliaofx", zhiliaofx, assets),
       Prefab( "common/jianyu", jianyu, assets),
       Prefab( "common/lingli_fx", lingli_fx, assets),
       Prefab( "common/toso_xuanfeng", toso_xuanfeng, assets),
       Prefab( "common/toso_leiting", toso_leiting, assets),
       Prefab( "common/luoyan_toso",luoyan_toso, assets),
       Prefab( "common/dilie_toso",dilie_toso, assets),
       Prefab( "common/baoliehuoyan_toso",baoliehuoyan_toso, assets),
       Prefab( "common/changefx_toso",changefx_toso, assets),
       Prefab( "common/chuanxinjianfa_toso",chuanxinjianfa_toso, assets),
       Prefab( "common/appear1",appear1, assets),
       Prefab( "common/baguadun",baguadun, assets),
       Prefab( "common/ziwen",ziwen, assets),
       Prefab( "common/baojitexiao",baojitexiao, assets),
       Prefab( "common/liekaitexiao",liekaitexiao, assets),
       Prefab( "common/shaqi_start",shaqi_start, assets),
       Prefab( "common/shaqi_over",shaqi_over, assets),
       Prefab( "common/shaistate",shaistate, assets),
       Prefab( "common/liehuodaofa_toso",liehuodaofa_toso, assets)
