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


local function onAttackfenji(inst, attacker, target)

		
		--if math.random() < .08 then
		--target.components.health:DoDelta(-200)
		--inst.components.talker:Say("暴击！")
--end
end




local function onequip(inst, owner)
    owner.AnimState:OverrideSymbol("swap_object", "swap_fenji", "swap_fenji")
    owner.AnimState:Show("ARM_carry")
    owner.AnimState:Hide("ARM_normal")

end

local function onunequip(inst, owner)
    owner.AnimState:Hide("ARM_carry")
    owner.AnimState:Show("ARM_normal")

end






local function fn()
    local inst = CreateEntity()

    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    MakeInventoryPhysics(inst)

    inst.AnimState:SetBank("fenji")
    inst.AnimState:SetBuild("fenji")
    --inst.AnimState:PlayAnimation("idle")
	inst.AnimState:PlayAnimation("idle_loop", true)

    inst:AddTag("sharp")
    inst:AddTag("weapon_sword")

    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(47)

    inst.components.weapon:SetRange(1.9)
    inst.components.weapon:SetOnAttack(onAttackfenji)

    inst:AddComponent("inspectable")

    inst:AddComponent("inventoryitem")
	inst.components.inventoryitem.imagename = "fenji"
    inst.components.inventoryitem.atlasname = "images/inventoryimages/fenji.xml"

    inst:AddComponent("equippable")
    inst.components.equippable:SetOnEquip(onequip)
    inst.components.equippable:SetOnUnequip(onunequip)
    --inst.components.equippable.walkspeedmult = 0.8

	inst:AddComponent("talker")
    inst.components.talker.fontsize = 36
    inst.components.talker.font = TALKINGFONT
    inst.components.talker.colour = Vector3(.9, .4, .4)
    inst.components.talker.offset = Vector3(0, 0, 0)
    inst.components.talker.symbol = "swap_object"

    return inst
end

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