local function DoDamage(inst, x, y, z, r, dmg, dmg_phy)
	local ents = TheSim:FindEntities(x, y, z, r, nil, {"campfire"})
	for k, v in pairs(ents) do
	
		--技能忽视规则模版
		
		if v and v ~= inst.master and 
			not (v.components.follower and v.components.follower.leader == inst.master ) and 
			(TheNet:GetPVPEnabled() or not v:HasTag("player"))

		then
		
			if v.components.health and not v.components.health:IsDead() and v.components.combat then
			
				v.components.health:DoDelta(-dmg)
				
				if not v:HasTag("player") then
					v.components.combat:SuggestTarget(inst.master)
				end
				
				if dmg_phy then
					if v.components.combat.Zg_GetAttacked then
						v.components.combat.Zg_GetAttacked(inst.master, dmg_phy)
					else
						v.components.combat:GetAttacked(inst.master, dmg_phy)
					end
				end
			end
			
		end
	end
end


local function fn()
    local inst = CreateEntity()
    inst.entity:AddTransform()
	inst.entity:AddAnimState()
    inst.entity:AddNetwork()
	
	inst.AnimState:SetBank("ice")
	inst.AnimState:SetBuild("ice")
	inst.AnimState:PlayAnimation("f1")
	
    MakeInventoryPhysics(inst)
    RemovePhysicsColliders(inst)
	
	inst:AddTag("NOCLICK")
	--inst:AddTag("FX")
	
    inst.entity:SetPristine()
	
    if not TheWorld.ismastersim then
        return inst
    end
	
	inst.persists = false
	
	----平均火焰伤害
	inst._can_explode = false

	local period = 10/30
	inst:DoPeriodicTask(period, function()
		local x, y, z = inst.Transform:GetWorldPosition()
		
		if inst._can_explode == false and y <= 0.1 then
		
			SpawnPrefab("explode_small").Transform:SetPosition(x,0,z)
			
			----爆炸伤害
			DoDamage(inst, x, y, z, 50, 100)
			
			inst._can_explode = true
			
			inst:Remove()
		end
		
	end)

    return inst
end

return Prefab ("suofeiya_icerain_ele", fn)