-----------
local require = GLOBAL.require
local Ingredient = GLOBAL.Ingredient
local RECIPETABS = GLOBAL.RECIPETABS
Recipe = GLOBAL.Recipe
local STRINGS = GLOBAL.STRINGS
local ACTIONS = GLOBAL.ACTIONS
TECH = GLOBAL.TECH
local IsServer = GLOBAL.TheNet:GetIsServer()
local containers = require("containers")
ACTIONS.GIVE.priority = 3
ACTIONS.ADDFUEL.priority = 4
local ThePlayer = GLOBAL.ThePlayer
-----------
local TheInput = GLOBAL.TheInput
-----------difficulty-- test
local Difficult = GetModConfigData("difficultover")
-----------specific
modimport("libs/env.lua")
use "data/actions/init"
use "data/components/init"
-----------
local oldwidgetsetup = containers.widgetsetup
containers.widgetsetup = function(container, prefab)
if not prefab and container.inst.prefab == "armor_mushaa" then
prefab = "icepack" end
if not prefab and container.inst.prefab == "broken_frosthammer" then
prefab = "piggyback" end
if not prefab and container.inst.prefab == "armor_mushab" then
prefab = "piggyback" end
  if not prefab and container.inst.prefab == "musha_tall3" then  prefab = "chester" end   if not prefab and container.inst.prefab == "musha_tallrrr1" then  prefab = "chester" end   if not prefab and container.inst.prefab == "musha_tallrrr2" then  prefab = "chester" end   if not prefab and container.inst.prefab == "musha_tallrrr3" then  prefab = "chester" end   if not prefab and container.inst.prefab == "musha_tallrrr4" then  prefab = "chester" end   if not prefab and container.inst.prefab == "musha_tallrrr5" then  prefab = "chester" end   if not prefab and container.inst.prefab == "musha_tallrrrice" then  prefab = "chester" end 
oldwidgetsetup(container, prefab)
end
 
PrefabFiles = {
"musha",
"mushasword_frost",
"mushasword_base",
"mushasword",
"frosthammer",
"tentacle_frost",
"broken_frosthammer",
"armor_mushaa",
"armor_mushab",
"hat_mprincess",
"hat_mbunny",
"hat_mphoenix",
"musha_flute",

"musha_small",
"musha_egg",
"musha_egg1",
"musha_egg2",
"musha_egg3",
"musha_eggs1",
"musha_eggs2",
"musha_eggs3",
"musha_egg8",

"ghosthound",	
"ghosthound2",	
"shadowmusha",

"cristal",
"forcefieldfxx",
"glowdust"
}
Assets = {
Asset( "ANIM", "anim/musha_normal.zip"),
Asset( "ANIM", "anim/musha_battle.zip"),
Asset( "ANIM", "anim/musha.zip"),
Asset( "ANIM", "anim/musha_hunger.zip"),
Asset( "ANIM", "anim/musha_hunger.zip"),
----
Asset( "ANIM", "anim/musha_old.zip"),
Asset( "ANIM", "anim/musha_normal_old.zip"),
Asset( "ANIM", "anim/musha_battle_old.zip"),
Asset( "ANIM", "anim/musha_hunger_old.zip"),
Asset( "ANIM", "anim/musha_full_p_old.zip"),
Asset( "ANIM", "anim/musha_normal_p_old.zip"),
Asset( "ANIM", "anim/musha_battle_p_old.zip"),
Asset( "ANIM", "anim/musha_hunger_p_old.zip"),
----
Asset("ANIM", "anim/musha_egg8.zip"),
Asset("ANIM", "anim/musha_egg.zip"),
Asset("ANIM", "anim/musha_egg1.zip"),
Asset("ANIM", "anim/musha_egg2.zip"),
Asset("ANIM", "anim/musha_egg3.zip"),
Asset("ANIM", "anim/musha_eggs1.zip"),
Asset("ANIM", "anim/musha_eggs2.zip"),
Asset("ANIM", "anim/musha_eggs3.zip"),
Asset("ANIM", "anim/musha_ice.zip"),
Asset("ANIM", "anim/musha_small.zip"),
Asset("ANIM", "anim/musha_teen.zip"),
Asset("ANIM", "anim/musha_tall.zip"),
Asset("ANIM", "anim/musha_tall2.zip"),
Asset("ANIM", "anim/musha_tall3.zip"),
Asset("ANIM", "anim/musha_tall4.zip"),
Asset("ANIM", "anim/musha_tall5.zip"),

Asset("ANIM", "anim/frosthammer.zip"),
Asset("ANIM", "anim/swap_frosthammer.zip"),
Asset("ANIM", "anim/broken_frosthammer.zip"),
Asset("ANIM", "anim/swap_frostback.zip"),
Asset("ANIM", "anim/swap_frostpocket.zip"),
Asset("ANIM", "anim/hat_mbunny.zip"),
Asset("ANIM", "anim/hat_mbunny2.zip"),
Asset("ANIM", "anim/hat_mphoenix.zip"),
Asset("ANIM", "anim/hat_mphoenix2.zip"),
Asset("ANIM", "anim/hat_mcrown.zip"),
Asset("ANIM", "anim/hat_mprincess.zip"),
Asset("ANIM", "anim/ghosthound.zip"),
Asset("ANIM", "anim/armor_mushaa.zip"),
Asset("ANIM", "anim/armor_mushab.zip"),
--box 

Asset("ANIM", "anim/ui_chest_yamche0.zip"),
Asset("ANIM", "anim/ui_chest_yamche1.zip"),
Asset("ANIM", "anim/ui_chest_yamche2.zip"),
Asset("ANIM", "anim/hat_yamche.zip"),
Asset("ANIM", "anim/ui_frostsmall.zip"),
Asset("ANIM", "anim/ui_chest_frosthammer.zip"),
Asset("ANIM", "anim/ui_chest_frosthammer2.zip"),
Asset("ANIM", "anim/ui_mushab_2x3.zip"),

Asset("ANIM", "anim/forcefieldx.zip"),
Asset("ANIM", "anim/glowdust.zip"),
Asset("ANIM", "anim/cristal.zip"),
Asset("ANIM", "anim/exp.zip"),
Asset("ANIM", "anim/musha_flute.zip"),
Asset("ANIM", "anim/mushasword_base.zip"),
Asset("ANIM", "anim/mushasword_frost.zip"),
Asset("ANIM", "anim/mushasword.zip"),
Asset("ANIM", "anim/mushasword2.zip"),
Asset("ANIM", "anim/mushasword3.zip"),
Asset("ANIM", "anim/mushasword4.zip"),
Asset("ANIM", "anim/swap_mushasword_base.zip"),
Asset("ANIM", "anim/swap_mushasword_frost1.zip"),
Asset("ANIM", "anim/swap_mushasword_frost2.zip"),
Asset("ANIM", "anim/swap_mushasword_frost3.zip"),
Asset("ANIM", "anim/swap_mushasword.zip"),
Asset("ANIM", "anim/swap_mushasword2.zip"),
Asset("ANIM", "anim/swap_mushasword3.zip"),
Asset("ANIM", "anim/swap_mushasword4.zip"),
Asset("ANIM", "anim/tentacle_frost.zip"),
Asset("IMAGE", "images/inventoryimages/musha_egg.tex"),
Asset("IMAGE", "images/inventoryimages/musha_egg1.tex"),
Asset("IMAGE", "images/inventoryimages/musha_egg2.tex"),
Asset("IMAGE", "images/inventoryimages/musha_egg3.tex"),
Asset("IMAGE", "images/inventoryimages/musha_eggs1.tex"),
Asset("IMAGE", "images/inventoryimages/musha_eggs2.tex"),
Asset("IMAGE", "images/inventoryimages/musha_eggs3.tex"),
Asset("IMAGE", "images/inventoryimages/musha_egg_cracked.tex"),
Asset("IMAGE", "images/inventoryimages/musha_egg_cracked1.tex"),
Asset("IMAGE", "images/inventoryimages/musha_egg_cracked2.tex"),
Asset("IMAGE", "images/inventoryimages/musha_egg_cracked3.tex"),
Asset("IMAGE", "images/inventoryimages/musha_egg_crackeds1.tex"),
Asset("IMAGE", "images/inventoryimages/musha_egg_crackeds2.tex"),
Asset("IMAGE", "images/inventoryimages/musha_egg_crackeds3.tex"),
Asset("IMAGE", "images/inventoryimages/musha_egg_cooked.tex"),
Asset("IMAGE", "images/inventoryimages/musha_egg8.tex"),
Asset("IMAGE", "images/inventoryimages/musha_egg_cracked8.tex"),
Asset("IMAGE", "images/inventoryimages/musha_small.tex"),
Asset("IMAGE", "images/inventoryimages/musha_teen.tex"),
Asset("IMAGE", "images/inventoryimages/musha_tall.tex"),
Asset("IMAGE", "images/inventoryimages/frosthammer.tex"),
Asset("IMAGE", "images/inventoryimages/broken_frosthammer.tex"),
Asset("IMAGE", "images/inventoryimages/frostback.tex"),
Asset("IMAGE", "images/inventoryimages/hat_mbunny.tex"),
Asset("IMAGE", "images/inventoryimages/hat_mphoenix.tex"),
Asset("IMAGE", "images/inventoryimages/hat_mcrown.tex"),
Asset("IMAGE", "images/inventoryimages/hat_mprincess.tex"),
Asset("IMAGE", "images/inventoryimages/armor_mushaa.tex"),
Asset("IMAGE", "images/inventoryimages/armor_mushab.tex"),
Asset("IMAGE", "images/inventoryimages/musha_flute.tex"),
Asset("IMAGE", "images/inventoryimages/mushasword_base.tex"),
Asset("IMAGE", "images/inventoryimages/mushasword_frost.tex"),
Asset("IMAGE", "images/inventoryimages/mushasword.tex"),
Asset("IMAGE", "images/inventoryimages/mushasword2.tex"),
Asset("IMAGE", "images/inventoryimages/mushasword3.tex"),
Asset("IMAGE", "images/inventoryimages/mushasword4.tex"),
Asset("IMAGE", "images/inventoryimages/blade_b.tex"),
Asset("IMAGE", "images/inventoryimages/blade_1.tex"),
Asset("IMAGE", "images/inventoryimages/blade_2.tex"),
Asset("IMAGE", "images/inventoryimages/blade_3.tex"),
Asset("IMAGE", "images/inventoryimages/blade_4.tex"),
Asset("IMAGE", "images/inventoryimages/blade_f.tex"),
Asset("IMAGE", "images/inventoryimages/glowdust.tex"),
Asset("IMAGE", "images/inventoryimages/cristal.tex"),
Asset("IMAGE", "images/inventoryimages/exp.tex"),
Asset("ATLAS", "images/inventoryimages/frosthammer.xml"),
Asset("ATLAS", "images/inventoryimages/broken_frosthammer.xml"),
Asset("ATLAS", "images/inventoryimages/hat_mbunny.xml"),
Asset("ATLAS", "images/inventoryimages/hat_mcrown.xml"),
Asset("ATLAS", "images/inventoryimages/hat_mprincess.xml"),
Asset("ATLAS", "images/inventoryimages/armor_mushaa.xml"),
Asset("ATLAS", "images/inventoryimages/armor_mushab.xml"),
Asset("ATLAS", "images/inventoryimages/musha_flute.xml"),
Asset("ATLAS", "images/inventoryimages/mushasword_base.xml"),
Asset("ATLAS", "images/inventoryimages/mushasword.xml"),
Asset("ATLAS", "images/inventoryimages/mushasword2.xml"),
Asset("ATLAS", "images/inventoryimages/mushasword3.xml"),
Asset("ATLAS", "images/inventoryimages/mushasword4.xml"),
Asset("ATLAS", "images/inventoryimages/blade_f.xml"),
Asset("ATLAS", "images/inventoryimages/blade_b.xml"),
Asset("ATLAS", "images/inventoryimages/blade_1.xml"),
Asset("ATLAS", "images/inventoryimages/blade_2.xml"),
Asset("ATLAS", "images/inventoryimages/blade_3.xml"),
Asset("ATLAS", "images/inventoryimages/blade_4.xml"),
Asset("ATLAS", "images/musha.xml"),
Asset("ATLAS", "images/mushas.xml"),
Asset( "ATLAS", "images/saveslot_portraits/musha.xml" ),
Asset( "ATLAS", "images/selectscreen_portraits/musha.xml" ),
Asset( "ATLAS", "images/selectscreen_portraits/musha_silho.xml" ),
Asset( "ATLAS", "bigportraits/musha.xml" ),
Asset("ATLAS", "images/inventoryimages/frosthammer.xml"),
Asset("ATLAS", "images/inventoryimages/broken_frosthammer.xml"),
Asset("ATLAS", "images/inventoryimages/frostback.xml"),
Asset("ATLAS", "images/inventoryimages/hat_mbunny.xml"),
Asset("ATLAS", "images/inventoryimages/hat_mphoenix.xml"),
Asset("ATLAS", "images/inventoryimages/hat_mcrown.xml"),
Asset("ATLAS", "images/inventoryimages/hat_mprincess.xml"),
Asset("ATLAS", "images/inventoryimages/armor_mushaa.xml"),
Asset("ATLAS", "images/inventoryimages/armor_mushab.xml"),
Asset("ATLAS", "images/inventoryimages/musha_flute.xml"),
Asset("ATLAS", "images/inventoryimages/mushasword_base.xml"),
Asset("ATLAS", "images/inventoryimages/mushasword_frost.xml"),
Asset("ATLAS", "images/inventoryimages/mushasword.xml"),
Asset("ATLAS", "images/inventoryimages/mushasword2.xml"),
Asset("ATLAS", "images/inventoryimages/mushasword3.xml"),
Asset("ATLAS", "images/inventoryimages/mushasword4.xml"),
Asset("ATLAS", "images/inventoryimages/blade_b.xml"),
Asset("ATLAS", "images/inventoryimages/blade_1.xml"),
Asset("ATLAS", "images/inventoryimages/blade_2.xml"),
Asset("ATLAS", "images/inventoryimages/blade_3.xml"),
Asset("ATLAS", "images/inventoryimages/blade_4.xml"),
Asset("ATLAS", "images/inventoryimages/musha_egg8.xml"),
Asset("ATLAS", "images/inventoryimages/musha_egg_cracked8.xml"),
Asset("ATLAS", "images/inventoryimages/musha_egg.xml"),
Asset("ATLAS", "images/inventoryimages/musha_egg1.xml"),
Asset("ATLAS", "images/inventoryimages/musha_egg2.xml"),
Asset("ATLAS", "images/inventoryimages/musha_egg3.xml"),
Asset("ATLAS", "images/inventoryimages/musha_egg_cracked.xml"),
Asset("ATLAS", "images/inventoryimages/musha_egg_cracked1.xml"),
Asset("ATLAS", "images/inventoryimages/musha_egg_cracked2.xml"),
Asset("ATLAS", "images/inventoryimages/musha_egg_cracked3.xml"),
Asset("ATLAS", "images/inventoryimages/musha_eggs1.xml"),
Asset("ATLAS", "images/inventoryimages/musha_eggs2.xml"),
Asset("ATLAS", "images/inventoryimages/musha_eggs3.xml"),
Asset("ATLAS", "images/inventoryimages/musha_egg_cracked.xml"),
Asset("ATLAS", "images/inventoryimages/musha_egg_crackeds1.xml"),
Asset("ATLAS", "images/inventoryimages/musha_egg_crackeds2.xml"),
Asset("ATLAS", "images/inventoryimages/musha_egg_crackeds3.xml"),
Asset("ATLAS", "images/inventoryimages/musha_egg_cooked.xml"),
Asset("ATLAS", "images/inventoryimages/musha_small.xml"),
Asset("ATLAS", "images/inventoryimages/musha_teen.xml"),
Asset("ATLAS", "images/inventoryimages/musha_tall.xml"),
Asset("ATLAS", "images/inventoryimages/glowdust.xml"),
Asset("ATLAS", "images/inventoryimages/cristal.xml"),
Asset("ATLAS", "images/inventoryimages/exp.xml"),
-----------------
Asset( "IMAGE", "images/saveslot_portraits/musha.tex"),
Asset( "ATLAS", "images/saveslot_portraits/musha.xml"),
Asset( "IMAGE", "images/saveslot_portraits/musha.tex" ),
Asset( "ATLAS", "images/saveslot_portraits/musha.xml" ),
Asset( "IMAGE", "images/selectscreen_portraits/musha.tex" ),
Asset( "ATLAS", "images/selectscreen_portraits/musha.xml" ),
Asset( "IMAGE", "bigportraits/musha.tex" ),
Asset( "ATLAS", "bigportraits/musha.xml" ),
Asset( "IMAGE", "images/musha.tex" ),
Asset( "ATLAS", "images/musha.xml" ),
Asset( "IMAGE", "images/musha_mapicon.tex" ),
Asset( "ATLAS", "images/musha_mapicon.xml" ),
Asset( "IMAGE", "images/avatars/avatar_musha.tex" ),
Asset( "ATLAS", "images/avatars/avatar_musha.xml" ),
Asset( "IMAGE", "images/avatars/avatar_ghost_musha.tex" ),
Asset( "ATLAS", "images/avatars/avatar_ghost_musha.xml" ),
}
AddMinimapAtlas("images/inventoryimages/hat_mphoenix.xml")
AddMinimapAtlas("images/inventoryimages/hat_mbunny.xml")
AddMinimapAtlas("images/inventoryimages/hat_mprincess.xml")
AddMinimapAtlas("images/inventoryimages/armor_mushaa.xml")
AddMinimapAtlas("images/inventoryimages/armor_mushab.xml")
AddMinimapAtlas("images/musha.xml")
AddMinimapAtlas("images/musha_mapicon.xml")
AddMinimapAtlas("images/mushas.xml")
AddMinimapAtlas("images/inventoryimages/musha_egg8.xml")
AddMinimapAtlas("images/inventoryimages/musha_egg_cracked8.xml")
AddMinimapAtlas("images/inventoryimages/musha_egg.xml")
AddMinimapAtlas("images/inventoryimages/musha_egg_cracked.xml")
AddMinimapAtlas("images/inventoryimages/musha_egg1.xml")
AddMinimapAtlas("images/inventoryimages/musha_egg_cracked1.xml")
AddMinimapAtlas("images/inventoryimages/musha_egg2.xml")
AddMinimapAtlas("images/inventoryimages/musha_egg_cracked2.xml")
AddMinimapAtlas("images/inventoryimages/musha_egg3.xml")
AddMinimapAtlas("images/inventoryimages/musha_egg_cracked3.xml")
AddMinimapAtlas("images/inventoryimages/musha_eggs1.xml")
AddMinimapAtlas("images/inventoryimages/musha_egg_crackeds1.xml")
AddMinimapAtlas("images/inventoryimages/musha_eggs2.xml")
AddMinimapAtlas("images/inventoryimages/musha_egg_crackeds2.xml")
AddMinimapAtlas("images/inventoryimages/musha_eggs3.xml")
AddMinimapAtlas("images/inventoryimages/musha_egg_crackeds3.xml")
AddMinimapAtlas("images/inventoryimages/musha_small.xml")
AddMinimapAtlas("images/inventoryimages/musha_teen.xml")
AddMinimapAtlas("images/inventoryimages/musha_tall.xml")
AddMinimapAtlas("images/inventoryimages/frosthammer.xml")
--AddMinimapAtlas("images/inventoryimages/frostback.xml")
AddMinimapAtlas("images/inventoryimages/broken_frosthammer.xml")
AddMinimapAtlas("images/inventoryimages/mushasword_base.xml")
AddMinimapAtlas("images/inventoryimages/mushasword.xml")
--AddMinimapAtlas("images/inventoryimages/mushasword2.xml")
--AddMinimapAtlas("images/inventoryimages/mushasword3.xml")
--AddMinimapAtlas("images/inventoryimages/mushasword4.xml")
AddMinimapAtlas("images/inventoryimages/blade_f.xml")
AddMinimapAtlas("images/inventoryimages/blade_b.xml")
AddMinimapAtlas("images/inventoryimages/blade_1.xml")
--AddMinimapAtlas("images/inventoryimages/blade_2.xml")
--AddMinimapAtlas("images/inventoryimages/blade_3.xml")
--AddMinimapAtlas("images/inventoryimages/blade_4.xml")
AddMinimapAtlas("images/inventoryimages/cristal.xml")
AddMinimapAtlas("images/inventoryimages/exp.xml")
------------------box
--small icebox1
local params = {}
local OVERRIDE_WIDGETSETUP = false
local containers_widgetsetup_base = containers.widgetsetup
function containers.widgetsetup(container, prefab)
    local t = params[prefab or container.inst.prefab]
    if t ~= nil then
        for k, v in pairs(t) do
            container[k] = v
        end
        container:SetNumSlots(container.widget.slotpos ~= nil and #container.widget.slotpos or 0)
        if OVERRIDE_WIDGETSETUP then
            container.type = "frostsmall"
        end
    else
        containers_widgetsetup_base(container, prefab)
    end
end
local function frostsmall()
    local container =
    {
        widget =
        {
            slotpos = {},
            animbank = "ui_backpack_2x4",
            animbuild = "ui_chest_frosthammer",
            pos = GLOBAL.Vector3(-5, 100, 0),
            side_align_tip = 160,
        },
		 issidewidget = true,
        type = "chest",
    }
    
	for y = 0, 1 do
		table.insert(container.widget.slotpos, GLOBAL.Vector3(-126, -y*75 + 114 ,-126 +75, -y*75 + 114 ))

end
    return container
end
params.frostsmall = frostsmall()
for k, v in pairs(params) do
    containers.MAXITEMSLOTS = math.max(containers.MAXITEMSLOTS, v.widget.slotpos ~= nil and #v.widget.slotpos or 0)
end
local containers_widgetsetup_custom = containers.widgetsetup
local MAXITEMSLOTS = containers.MAXITEMSLOTS
AddPrefabPostInit("world_network", function(inst)
    if containers.widgetsetup ~= containers_widgetsetup_custom then
        OVERRIDE_WIDGETSETUP = true
        local containers_widgetsetup_base2 = containers.widgetsetup
        function containers.widgetsetup(container, prefab)
            containers_widgetsetup_base2(container, prefab)
            if container.type == "frostsmall" then
                container.type = "chest"
            end end end
    if containers.MAXITEMSLOTS < MAXITEMSLOTS then
        containers.MAXITEMSLOTS = MAXITEMSLOTS
    end
end)

function params.frostsmall.itemtestfn(container, item, slot)
    return not item:HasTag("heatrock") 

end
--------------------------------------------------
--icebox1
local params = {}
local OVERRIDE_WIDGETSETUP = false
local containers_widgetsetup_base = containers.widgetsetup
function containers.widgetsetup(container, prefab)
    local t = params[prefab or container.inst.prefab]
    if t ~= nil then
        for k, v in pairs(t) do
            container[k] = v
        end
        container:SetNumSlots(container.widget.slotpos ~= nil and #container.widget.slotpos or 0)
        if OVERRIDE_WIDGETSETUP then
            container.type = "frostbox"
        end
    else
        containers_widgetsetup_base(container, prefab)
    end
end
local function frostbox()
    local container =
    {
        widget =
        {
            slotpos = {},
            animbank = "ui_backpack_2x4",
            animbuild = "ui_chest_frosthammer2",
            pos = GLOBAL.Vector3(-5, -70, 0),
            side_align_tip = 160,
        },
		 issidewidget = true,
			type = "pack",
    }
    	for y = 0, 4 do
	table.insert(container.widget.slotpos, GLOBAL.Vector3(-162, -y*58 + 124 ,0))
	table.insert(container.widget.slotpos, GLOBAL.Vector3(-162 +75, -y*58 + 124 ,0))

end
    return container
end
params.frostbox = frostbox()
for k, v in pairs(params) do
    containers.MAXITEMSLOTS = math.max(containers.MAXITEMSLOTS, v.widget.slotpos ~= nil and #v.widget.slotpos or 0)
end
local containers_widgetsetup_custom = containers.widgetsetup
local MAXITEMSLOTS = containers.MAXITEMSLOTS
AddPrefabPostInit("world_network", function(inst)
    if containers.widgetsetup ~= containers_widgetsetup_custom then
        OVERRIDE_WIDGETSETUP = true
        local containers_widgetsetup_base2 = containers.widgetsetup
        function containers.widgetsetup(container, prefab)
            containers_widgetsetup_base2(container, prefab)
            if container.type == "frostbox" then
                container.type = "pack"
            end end end
    if containers.MAXITEMSLOTS < MAXITEMSLOTS then
        containers.MAXITEMSLOTS = MAXITEMSLOTS
    end
end)

function params.frostbox.itemtestfn(container, item, slot)
    return not item:HasTag("heatrock") 

end
--------------------------------------------------

--box1
local params = {}
local OVERRIDE_WIDGETSETUP = false
local containers_widgetsetup_base = containers.widgetsetup
function containers.widgetsetup(container, prefab)
    local t = params[prefab or container.inst.prefab]
    if t ~= nil then
        for k, v in pairs(t) do
            container[k] = v
        end
        container:SetNumSlots(container.widget.slotpos ~= nil and #container.widget.slotpos or 0)
        if OVERRIDE_WIDGETSETUP then
            container.type = "chest_yamche0"
        end
    else
        containers_widgetsetup_base(container, prefab)
    end
end
local function chest_yamche0()
    local container =
    {
        widget =
        {
            slotpos = {},
            animbank = "ui_chest_3x2",
            animbuild = "ui_chest_yamche0",
            pos = GLOBAL.Vector3(0, 200, 0),
            side_align_tip = 160,
        },
        type = "chest",
    }
    for y = 1, 0, -1 do
        table.insert(container.widget.slotpos, GLOBAL.Vector3(74*y-74*2+70, 0))
 
end
    return container
end
params.chest_yamche0 = chest_yamche0()
for k, v in pairs(params) do
    containers.MAXITEMSLOTS = math.max(containers.MAXITEMSLOTS, v.widget.slotpos ~= nil and #v.widget.slotpos or 0)
end
local containers_widgetsetup_custom = containers.widgetsetup
local MAXITEMSLOTS = containers.MAXITEMSLOTS
AddPrefabPostInit("world_network", function(inst)
    if containers.widgetsetup ~= containers_widgetsetup_custom then
        OVERRIDE_WIDGETSETUP = true
        local containers_widgetsetup_base2 = containers.widgetsetup
        function containers.widgetsetup(container, prefab)
            containers_widgetsetup_base2(container, prefab)
            if container.type == "chest_yamche0" then
                container.type = "chest"
            end end end
    if containers.MAXITEMSLOTS < MAXITEMSLOTS then
        containers.MAXITEMSLOTS = MAXITEMSLOTS
    end
end)
---------------------------------------------------------------
--box2
local params = {}
local OVERRIDE_WIDGETSETUP = false
local containers_widgetsetup_base = containers.widgetsetup
function containers.widgetsetup(container, prefab)
    local t = params[prefab or container.inst.prefab]
    if t ~= nil then
        for k, v in pairs(t) do
            container[k] = v
        end
        container:SetNumSlots(container.widget.slotpos ~= nil and #container.widget.slotpos or 0)
        if OVERRIDE_WIDGETSETUP then
            container.type = "chest_yamche1"
        end
    else
        containers_widgetsetup_base(container, prefab)
    end
end
local function chest_yamche1()
    local container =
    {
        widget =
        {
            slotpos = {},
            animbank = "ui_chest_3x3",
            animbuild = "ui_chest_yamche1",
            pos = GLOBAL.Vector3(0, 200, 0),
            side_align_tip = 160,
        },
        type = "chest",
    }
 for y = 1, 0, -1 do
    for x = 0, 1 do
        table.insert(container.widget.slotpos, GLOBAL.Vector3(80*x-80*2+78, 80*y-80*2+80,0))
    end
end
    return container
end
params.chest_yamche1 = chest_yamche1()
for k, v in pairs(params) do
    containers.MAXITEMSLOTS = math.max(containers.MAXITEMSLOTS, v.widget.slotpos ~= nil and #v.widget.slotpos or 0)
end
local containers_widgetsetup_custom = containers.widgetsetup
local MAXITEMSLOTS = containers.MAXITEMSLOTS
AddPrefabPostInit("world_network", function(inst)
    if containers.widgetsetup ~= containers_widgetsetup_custom then
        OVERRIDE_WIDGETSETUP = true
        local containers_widgetsetup_base2 = containers.widgetsetup
        function containers.widgetsetup(container, prefab)
            containers_widgetsetup_base2(container, prefab)
            if container.type == "chest_yamche1" then
                container.type = "chest"
            end end end
    if containers.MAXITEMSLOTS < MAXITEMSLOTS then
        containers.MAXITEMSLOTS = MAXITEMSLOTS
    end
end)
---------------------------------------------------------------
--box3
local params = {}
local OVERRIDE_WIDGETSETUP = false
local containers_widgetsetup_base = containers.widgetsetup
function containers.widgetsetup(container, prefab)
    local t = params[prefab or container.inst.prefab]
    if t ~= nil then
        for k, v in pairs(t) do
            container[k] = v
        end
        container:SetNumSlots(container.widget.slotpos ~= nil and #container.widget.slotpos or 0)
        if OVERRIDE_WIDGETSETUP then
            container.type = "chest_yamche2"
        end
    else
        containers_widgetsetup_base(container, prefab)
    end
end
local function chest_yamche2()
    local container =
    {
        widget =
        {
            slotpos = {},
            animbank = "ui_chest_3x3",
            animbuild = "ui_chest_yamche2",
            pos = GLOBAL.Vector3(0, 200, 0),
            side_align_tip = 160,
        },
        type = "chest",
    }
		
for y = 2, 0, -1 do
    for x = 0, 1 do
        table.insert(container.widget.slotpos, GLOBAL.Vector3(80*x-80*2+78, 80*y-80*2+80,0))
    end
end
    return container
end
params.chest_yamche2 = chest_yamche2()
for k, v in pairs(params) do
    containers.MAXITEMSLOTS = math.max(containers.MAXITEMSLOTS, v.widget.slotpos ~= nil and #v.widget.slotpos or 0)
end
local containers_widgetsetup_custom = containers.widgetsetup
local MAXITEMSLOTS = containers.MAXITEMSLOTS
AddPrefabPostInit("world_network", function(inst)
    if containers.widgetsetup ~= containers_widgetsetup_custom then
        OVERRIDE_WIDGETSETUP = true
        local containers_widgetsetup_base2 = containers.widgetsetup
        function containers.widgetsetup(container, prefab)
            containers_widgetsetup_base2(container, prefab)
            if container.type == "chest_yamche2" then
                container.type = "chest"
        end end end
    if containers.MAXITEMSLOTS < MAXITEMSLOTS then
        containers.MAXITEMSLOTS = MAXITEMSLOTS
    end
end)
---------------------------------------------------------------
--box5
local params = {}
local OVERRIDE_WIDGETSETUP = false
local containers_widgetsetup_base = containers.widgetsetup
function containers.widgetsetup(container, prefab)
    local t = params[prefab or container.inst.prefab]
    if t ~= nil then
        for k, v in pairs(t) do
            container[k] = v
        end
        container:SetNumSlots(container.widget.slotpos ~= nil and #container.widget.slotpos or 0)
        if OVERRIDE_WIDGETSETUP then
            container.type = "chest_yamche4"
        end
    else
        containers_widgetsetup_base(container, prefab)
    end
end
local function chest_yamche4()
    local container =
    {
        widget =
        {
            slotpos = {},
            animbank = "ui_chest_3x3",
            animbuild = "ui_chest_3x3",
            pos = GLOBAL.Vector3(0, 200, 0),
            side_align_tip = 160,
        },
        type = "chest",
    }
for y = 3, 0, -1 do
    for x = 0, 2 do
        table.insert(container.widget.slotpos, GLOBAL.Vector3(75*x-75*2+75, 60*y-60*2+32,0))
    end
end
    return container
end
params.chest_yamche4 = chest_yamche4()
for k, v in pairs(params) do
    containers.MAXITEMSLOTS = math.max(containers.MAXITEMSLOTS, v.widget.slotpos ~= nil and #v.widget.slotpos or 0)
end
local containers_widgetsetup_custom = containers.widgetsetup
local MAXITEMSLOTS = containers.MAXITEMSLOTS
AddPrefabPostInit("world_network", function(inst)
    if containers.widgetsetup ~= containers_widgetsetup_custom then
        OVERRIDE_WIDGETSETUP = true
        local containers_widgetsetup_base2 = containers.widgetsetup
        function containers.widgetsetup(container, prefab)
            containers_widgetsetup_base2(container, prefab)
            if container.type == "chest_yamche4" then
                container.type = "chest"
        end end end
    if containers.MAXITEMSLOTS < MAXITEMSLOTS then
        containers.MAXITEMSLOTS = MAXITEMSLOTS
    end
end)
---------------------------------------------------------------
--box6
local params = {}
local OVERRIDE_WIDGETSETUP = false
local containers_widgetsetup_base = containers.widgetsetup
function containers.widgetsetup(container, prefab)
    local t = params[prefab or container.inst.prefab]
    if t ~= nil then
        for k, v in pairs(t) do
            container[k] = v
        end
        container:SetNumSlots(container.widget.slotpos ~= nil and #container.widget.slotpos or 0)
        if OVERRIDE_WIDGETSETUP then
            container.type = "chest_yamche5"
        end
    else
        containers_widgetsetup_base(container, prefab)
    end
end
local function chest_yamche5()
    local container =
    {
        widget =
        {
            slotpos = {},
            animbank = "ui_chest_3x3",
            animbuild = "ui_chest_3x3",
            pos = GLOBAL.Vector3(0, 200, 0),
            side_align_tip = 160,
        },
        type = "chest",
    }
for y = 3, 0, -1 do
    for x = 0, 3 do
        table.insert(container.widget.slotpos, GLOBAL.Vector3(60*x-60*2+30, 60*y-60*2+30,0))
    end
end
    return container
end
params.chest_yamche5 = chest_yamche5()
for k, v in pairs(params) do
    containers.MAXITEMSLOTS = math.max(containers.MAXITEMSLOTS, v.widget.slotpos ~= nil and #v.widget.slotpos or 0)
end
local containers_widgetsetup_custom = containers.widgetsetup
local MAXITEMSLOTS = containers.MAXITEMSLOTS
AddPrefabPostInit("world_network", function(inst)
    if containers.widgetsetup ~= containers_widgetsetup_custom then
        OVERRIDE_WIDGETSETUP = true
        local containers_widgetsetup_base2 = containers.widgetsetup
        function containers.widgetsetup(container, prefab)
            containers_widgetsetup_base2(container, prefab)
            if container.type == "chest_yamche5" then
                container.type = "chest"
    end end end
    if containers.MAXITEMSLOTS < MAXITEMSLOTS then
        containers.MAXITEMSLOTS = MAXITEMSLOTS
    end
end)
---------------------------------------------------------------
------------------
STRINGS.NAMES.MUSHA = "Musha"
STRINGS.CHARACTER_TITLES.musha = "精灵公主暮莎"
STRINGS.CHARACTER_NAMES.musha = "暮莎"
STRINGS.CHARACTER_DESCRIPTIONS.musha = "[升级后解锁技能]\n显示等级(L) 显示技能(K) Yamche命令(Z,V,B) \n改变外形(P) 闪电攻击(R) 电光护盾(C) 表演(X)"
STRINGS.CHARACTER_QUOTES.musha = "\" 我是真正的公主! \""
STRINGS.CHARACTERS.MUSHA= require "speech_musha"

--STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA = "Feels good.."
STRINGS.CHARACTERS.MUSHA.DESCRIBE.MUSHA = {"she pretty", "Resembles me.."}
STRINGS.CHARACTERS.WICKERBOTTOM.DESCRIBE.MUSHA = ("maybe she can join my Books club members.")
STRINGS.CHARACTERS.WAXWELL.DESCRIBE.MUSHA = ("Royal blood ? Hmm...")
STRINGS.CHARACTERS.WOODIE.DESCRIBE.MUSHA = ("she can transform?..no, maybe not")
STRINGS.CHARACTERS.WOLFGANG.DESCRIBE.MUSHA = ("She is weak force .. but seems going to help us.")
STRINGS.CHARACTERS.WENDY.DESCRIBE.MUSHA = ("I feel a strong spirit..")
STRINGS.CHARACTERS.WX78.DESCRIBE.MUSHA = ("I feel my heart.")
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA = 
{
GENERIC = "Feels good!",
ATTACKER = "Fight fight fight",
MURDERER = "Assasin!",
REVIVER = "Return..",
GHOST = "go away !",
}
--STRINGS.CHARACTERS.MUSHA.ANNOUNCE_NOSANITY = ""	

-----------[[--recipe--]]-----------

local bladeb = Ingredient( "mushasword_base", 1)
bladeb.atlas = "images/inventoryimages/mushasword_base.xml"
local armora = Ingredient( "armor_mushaa", 1)
armora.atlas = "images/inventoryimages/armor_mushaa.xml"
local phoenixb = Ingredient( "mushasword", 1)
phoenixb.atlas = "images/inventoryimages/mushasword.xml"

local phoenix_egg = Ingredient( "musha_egg", 1)
phoenix_egg.atlas = "images/inventoryimages/musha_egg.xml"
local phoenix_eggs1 = Ingredient( "musha_eggs1", 1)
phoenix_eggs1.atlas = "images/inventoryimages/musha_eggs1.xml"
local phoenix_eggs2 = Ingredient( "musha_eggs2", 1)
phoenix_eggs2.atlas = "images/inventoryimages/musha_eggs2.xml"
local phoenix_eggs3 = Ingredient( "musha_eggs3", 1)
phoenix_eggs3.atlas = "images/inventoryimages/musha_eggs3.xml"
local phoenix_egg1 = Ingredient( "musha_egg1", 1)
phoenix_egg1.atlas = "images/inventoryimages/musha_egg1.xml"
local phoenix_egg2 = Ingredient( "musha_egg2", 1)
phoenix_egg2.atlas = "images/inventoryimages/musha_egg2.xml"
local phoenix_egg3 = Ingredient( "musha_egg3", 1)
phoenix_egg3.atlas = "images/inventoryimages/musha_egg3.xml"
local phoenix_egg8 = Ingredient( "musha_egg8", 1)
phoenix_egg8.atlas = "images/inventoryimages/musha_egg8.xml"

local glowdust = Ingredient( "glowdust", 1)
glowdust.atlas = "images/inventoryimages/glowdust.xml"
local glowdust3 = Ingredient( "glowdust", 3)
glowdust3.atlas = "images/inventoryimages/glowdust.xml"
local glowdust5 = Ingredient( "glowdust", 5)
glowdust5.atlas = "images/inventoryimages/glowdust.xml"
local glowdust10 = Ingredient( "glowdust", 10)
glowdust10.atlas = "images/inventoryimages/glowdust.xml"
----
----
local mushasword_base = AddRecipe("mushasword_base", { glowdust, GLOBAL.Ingredient("goldnugget", 2)}, RECIPETABS.WAR, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/mushasword_base.xml", "mushasword_base.tex" )
mushasword_base.tagneeded = false
mushasword_base.builder_tag ="musha"

local mushasword = AddRecipe("mushasword", {bladeb, GLOBAL.Ingredient("redgem", 5), glowdust}, RECIPETABS.WAR, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/mushasword.xml", "mushasword.tex" )
mushasword.tagneeded = false
mushasword.builder_tag ="musha"

local mushasword_frost = AddRecipe("mushasword_frost", {bladeb, GLOBAL.Ingredient("bluegem", 4), glowdust}, RECIPETABS.WAR, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/mushasword_frost.xml", "mushasword_frost.tex" )
mushasword_frost.tagneeded = false
mushasword_frost.builder_tag ="musha"

local frosthammer = AddRecipe("frosthammer", {GLOBAL.Ingredient( "deerclops_eyeball", 1), GLOBAL.Ingredient( "bluegem", 6), GLOBAL.Ingredient("livinglog", 2), GLOBAL.Ingredient("gears", 2)}, RECIPETABS.WAR, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/frosthammer.xml", "frosthammer.tex" )
frosthammer.tagneeded = false
frosthammer.builder_tag ="musha"

local armor_mushaa = AddRecipe("armor_mushaa", {glowdust3, GLOBAL.Ingredient("goldnugget", 20), GLOBAL.Ingredient("nitre", 5)}, RECIPETABS.WAR, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/armor_mushaa.xml", "armor_mushaa.tex" )
armor_mushaa.tagneeded = false
armor_mushaa.builder_tag ="musha"		

local broken_frosthammer = AddRecipe("broken_frosthammer", {armora, GLOBAL.Ingredient("bluegem", 8), GLOBAL.Ingredient("butterfly", 10),GLOBAL.Ingredient("gears", 3)}, RECIPETABS.WAR, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/broken_frosthammer.xml", "broken_frosthammer.tex" )
broken_frosthammer.tagneeded = true
broken_frosthammer.builder_tag ="musha"	

local armor_mushab = AddRecipe("armor_mushab", {armora, GLOBAL.Ingredient("purplegem", 25), GLOBAL.Ingredient("thulecite", 4),GLOBAL.Ingredient("thulecite_pieces", 8)}, RECIPETABS.WAR, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/armor_mushab.xml", "armor_mushab.tex" )
armor_mushab.tagneeded = false
armor_mushab.builder_tag ="musha"	

--manrabbit_tail
local hat_mbunny = AddRecipe("hat_mbunny", {GLOBAL.Ingredient("walrus_tusk", 2), GLOBAL.Ingredient("purplegem", 2), GLOBAL.Ingredient("rabbit", 2),GLOBAL.Ingredient("beefalowool", 15)}, RECIPETABS.WAR, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/hat_mbunny.xml", "hat_mbunny.tex" )
hat_mbunny.tagneeded = false
hat_mbunny.builder_tag ="musha"

local hat_mprincess = AddRecipe("hat_mprincess", {glowdust5, GLOBAL.Ingredient("purplegem", 4), GLOBAL.Ingredient("amulet", 1) }, RECIPETABS.WAR, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/hat_mprincess.xml", "hat_mprincess.tex" )
hat_mprincess.tagneeded = false
hat_mprincess.builder_tag ="musha"	
--phoenixb
local hat_mphoenix = AddRecipe("hat_mphoenix", { armora, GLOBAL.Ingredient("panflute", 1), GLOBAL.Ingredient("redgem", 20), GLOBAL.Ingredient("feather_robin", 10)}, RECIPETABS.WAR, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/hat_mphoenix.xml", "hat_mphoenix.tex" )
hat_mphoenix.tagneeded = false
hat_mphoenix.builder_tag ="musha"
--magic
--flute
local musha_flute = AddRecipe("musha_flute", { glowdust10, GLOBAL.Ingredient("horn", 1), GLOBAL.Ingredient("spidergland", 40)}, RECIPETABS.MAGIC, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/musha_flute.xml", "musha_flute.tex" )
musha_flute.tagneeded = false
musha_flute.builder_tag ="musha"
--glowdust
local glowdust = AddRecipe("glowdust", { GLOBAL.Ingredient("berries", 5),GLOBAL.Ingredient("goldnugget", 1)}, RECIPETABS.MAGIC, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/glowdust.xml", "glowdust.tex" )
glowdust.tagneeded = false
glowdust.builder_tag ="musha"
--phoenix_egg
local musha_egg = AddRecipe("musha_egg", { GLOBAL.Ingredient("purplegem", 10), GLOBAL.Ingredient("redgem", 20), GLOBAL.Ingredient("bluegem", 10)}, RECIPETABS.MAGIC, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/musha_egg.xml", "musha_egg.tex" )
musha_egg.tagneeded = false
musha_egg.builder_tag ="musha"

local musha_eggs1 = AddRecipe("musha_eggs1", { phoenix_egg, GLOBAL.Ingredient("goldnugget", 1)}, RECIPETABS.MAGIC, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/musha_eggs1.xml", "musha_eggs1.tex" )
musha_eggs1.tagneeded = false
musha_eggs1.builder_tag ="musha"

local musha_eggs2 = AddRecipe("musha_eggs2", { phoenix_eggs1, GLOBAL.Ingredient("goldnugget", 15)}, RECIPETABS.MAGIC, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/musha_eggs2.xml", "musha_eggs2.tex" )
musha_eggs2.tagneeded = false
musha_eggs2.builder_tag ="musha"

local musha_eggs3 = AddRecipe("musha_eggs3", { phoenix_eggs2, GLOBAL.Ingredient("goldnugget", 30)}, RECIPETABS.MAGIC, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/musha_eggs3.xml", "musha_eggs3.tex" )
musha_eggs3.tagneeded = false
musha_eggs3.builder_tag ="musha"

local musha_egg1 = AddRecipe("musha_egg1", { phoenix_eggs3, GLOBAL.Ingredient("goldnugget", 45), GLOBAL.Ingredient("purplegem", 1)}, RECIPETABS.MAGIC, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/musha_egg1.xml", "musha_egg1.tex" )
musha_egg1.tagneeded = false
musha_egg1.builder_tag ="musha"

local musha_egg2 = AddRecipe("musha_egg2", { phoenix_egg1, GLOBAL.Ingredient("goldnugget", 60), GLOBAL.Ingredient("purplegem", 2)}, RECIPETABS.MAGIC, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/musha_egg2.xml", "musha_egg2.tex" )
musha_egg2.tagneeded = false
musha_egg2.builder_tag ="musha"

local musha_egg3 = AddRecipe("musha_egg3", { phoenix_egg2, GLOBAL.Ingredient("goldnugget", 80), GLOBAL.Ingredient("purplegem", 5)}, RECIPETABS.MAGIC, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/musha_egg3.xml", "musha_egg3.tex" )
musha_egg3.tagneeded = false
musha_egg3.builder_tag ="musha"

local musha_egg8 = AddRecipe("musha_egg8", { phoenix_egg3, GLOBAL.Ingredient("goldnugget", 100), GLOBAL.Ingredient("purplegem", 10)}, RECIPETABS.MAGIC, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/musha_egg8.xml", "musha_egg8.tex" )
musha_egg8.tagneeded = false
musha_egg8.builder_tag ="musha"


--crystal
local cristal = AddRecipe("cristal", { glowdust10, GLOBAL.Ingredient("bluegem", 1)}, RECIPETABS.MAGIC, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/cristal.xml", "cristal.tex" )
cristal.tagneeded = false
cristal.builder_tag ="musha"

--nitre
--function rockss(inst)
--[[AddRecipe("nitre", {Ingredient( "goldnugget",1),}, RECIPETABS.REFINE, {SCIENCE=0})]]
AddRecipe("bluegem", {Ingredient( "redgem",1),Ingredient( "nitre",1)}, RECIPETABS.REFINE, {SCIENCE=0})
AddRecipe("redgem", {Ingredient( "bluegem",1),Ingredient( "nitre",1)}, RECIPETABS.REFINE, {SCIENCE=0})
----BOOK----

--end
--AddPrefabPostInit("musha", rockss)
--elemental
local function elemental( inst )
inst:AddComponent("fuel")
inst.components.fuel.fuelvalue = TUNING.SMALL_FUEL
--inst.components.fuel.fuelvalue = TUNING.MED_LARGE_FUEL
inst.components.fuel.fueltype = "CHEMICAL"
inst:AddTag("test")
end
AddPrefabPostInit("rocks",elemental)
AddPrefabPostInit("goldnugget",elemental)
AddPrefabPostInit("flint",elemental)
AddPrefabPostInit("moonrocknugget",elemental)
AddPrefabPostInit("marble",elemental)
AddPrefabPostInit("stinger",elemental)
AddPrefabPostInit("spidergland",elemental)
AddPrefabPostInit("houndstooth",elemental)

function gruefix(inst)
inst:AddTag("gruef")
end
AddPrefabPostInit("grue", gruefix)

--active key
-- Import the lib use.
modimport("libs/use.lua")

-- Import the mod environment as our environment.
use "libs/mod_env"(env)
-- Imports to keep the keyhandler from working while typing in chat.
use "data/widgets/controls"
use "data/screens/chatinputscreen"
use "data/screens/consolescreen"

GLOBAL.TUNING.MUSHA = {}
GLOBAL.TUNING.MUSHA.KEY = GetModConfigData("key") or 108  --L
GLOBAL.TUNING.MUSHA.KEY2 = GetModConfigData("key2") or 114  --R
GLOBAL.TUNING.MUSHA.KEY3 = GetModConfigData("key3") or 99  --C
GLOBAL.TUNING.MUSHA.KEY4 = GetModConfigData("key4") or 120  --X  
GLOBAL.TUNING.MUSHA.KEY5 = GetModConfigData("key5") or 107  --K
GLOBAL.TUNING.MUSHA.KEY6 = GetModConfigData("key6") or 122  --Z
GLOBAL.TUNING.MUSHA.KEY7 = GetModConfigData("key7") or 112  --P
GLOBAL.TUNING.MUSHA.KEY8 = GetModConfigData("key8") or 118  --V
GLOBAL.TUNING.MUSHA.KEY9 = GetModConfigData("key9") or 98  --B
GLOBAL.TUNING.MUSHA.KEY10 = GetModConfigData("key10") or 110  --N
---------------
local function on_yamcheinfo(inst)
local x,y,z = inst.Transform:GetWorldPosition()
local ents = TheSim:FindEntities(x,y,z, 25, {"yamcheb"})
for k,v in pairs(ents) do
if inst.components.leader:IsFollower(v) then
v.yamcheinfo = true
v.yamche = true
end end end
local function INFO(inst)
--Active info level?
local TheInput = TheInput
local max_exp = 999997000
local level = math.min(inst.level, max_exp)
inst.components.talker:Say("[下一级:升级] \n当前经验 ".. (inst.level))	
on_yamcheinfo(inst)
if inst.level <5 then
inst.components.talker:Say("等级1 \n下一级:经验[5]\n经验 ".. (inst.level))
elseif inst.level >=5 and inst.level <9  then
inst.components.talker:Say("等级2 \n下一级:经验[10]\n经验 ".. (inst.level))
elseif inst.level >=10 and inst.level <29  then
inst.components.talker:Say("等级3 \n下一级:经验[30]\n经验 ".. (inst.level))
elseif inst.level >=30 and inst.level <49  then
inst.components.talker:Say("等级4 \n下一级:经验[50]\n经验 ".. (inst.level))
elseif inst.level >=50 and inst.level <79  then
inst.components.talker:Say("等级5 \n下一级:经验[80]\n经验 ".. (inst.level))
elseif inst.level >=80 and inst.level <124  then
inst.components.talker:Say("等级6 \n下一级:经验[125]\n经验 ".. (inst.level))
elseif inst.level >=125 and inst.level <199  then
inst.components.talker:Say("等级7 \n下一级:经验[200]\n经验 ".. (inst.level))
elseif inst.level >=200 and inst.level <339  then
inst.components.talker:Say("等级8 \n下一级:经验[340]\n经验 ".. (inst.level))
elseif inst.level >=340 and inst.level <429  then
inst.components.talker:Say("等级9 \n下一级:经验[430]\n经验 ".. (inst.level))
elseif inst.level >=430 and inst.level <529  then
inst.components.talker:Say("等级10 \n下一级:经验[530]\n经验 ".. (inst.level))
elseif inst.level >=530 and inst.level <639  then
inst.components.talker:Say("等级11 \n下一级:经验[640]\n经验 ".. (inst.level))
elseif inst.level >=640 and inst.level <759  then
inst.components.talker:Say("等级12 \n下一级:经验[760]\n经验 ".. (inst.level))
elseif inst.level >=760 and inst.level <889  then
inst.components.talker:Say("等级13 \n下一级:经验[890]\n经验 ".. (inst.level))
elseif inst.level >=890 and inst.level <1029  then
inst.components.talker:Say("等级14 \n下一级:经验[1030]\n经验 ".. (inst.level))
elseif inst.level >=1030 and inst.level <1179  then
inst.components.talker:Say("等级15 \n下一级:经验[1180]\n经验 ".. (inst.level))
elseif inst.level >=1180 and inst.level <1339  then
inst.components.talker:Say("等级16 \n下一级:经验[1340]\n经验 ".. (inst.level))
elseif inst.level >=1340 and inst.level <1509  then
inst.components.talker:Say("等级17 \n下一级:经验[1510]\n经验 ".. (inst.level))
elseif inst.level >=1510 and inst.level <1689  then
inst.components.talker:Say("等级18 \n下一级:经验[1690]\n经验 ".. (inst.level))
elseif inst.level >=1690 and inst.level <1879  then
inst.components.talker:Say("等级19 \n下一级:经验[1880]\n经验 ".. (inst.level))
elseif inst.level >=1880 and inst.level <2079  then
inst.components.talker:Say("等级20 \n下一级:经验[2080]\n经验 ".. (inst.level))
elseif inst.level >=2080 and inst.level <2289  then
inst.components.talker:Say("等级21 \n下一级:经验[2289]\n经验 ".. (inst.level))
elseif inst.level >=2290 and inst.level <2499  then
inst.components.talker:Say("等级22 \n下一级:经验[2500]\n经验 ".. (inst.level))
elseif inst.level >=2500 and inst.level <2849  then
inst.components.talker:Say("等级23 \n下一级:经验[2850]\n经验 ".. (inst.level))
elseif inst.level >=2850 and inst.level <3199  then
inst.components.talker:Say("等级24 \n下一级:经验[3200]\n经验 ".. (inst.level))
elseif inst.level >=3200 and inst.level <3699  then
inst.components.talker:Say("等级25 \n下一级:经验[3700]\n经验 ".. (inst.level))
elseif inst.level >=3700 and inst.level <4199  then
inst.components.talker:Say("等级26 \n下一级:经验[4200]\n经验 ".. (inst.level))
elseif inst.level >=4200 and inst.level <4699  then
inst.components.talker:Say("等级27 \n下一级:经验[4700]\n经验 ".. (inst.level))
elseif inst.level >=4700 and inst.level <5499 then
inst.components.talker:Say("等级28 \n下一级:经验[5500]\n经验 ".. (inst.level))
elseif inst.level >=5500 and inst.level <6999 then
inst.components.talker:Say("等级29 \n下一级:经验[7000]\n经验 ".. (inst.level))
elseif inst.level >=7000  then
inst.components.talker:Say("等级30 \n[满级]\n 额外经验 ".. (inst.level -7000))
end
end
AddModRPCHandler("musha", "INFO", INFO)

--active skill?  --skill_info
local function INFO2(inst)
local TheInput = TheInput
local max_exp = 999997000
local level = math.min(inst.level, max_exp)

if inst.level >=0 and inst.level <=4 then --level[1]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [1/4]-(R)\n[*]电光护盾 [1/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [0/14] \n[*]狂暴状态 [1/4] \n[*]电气护盾 [0/5] \n[*]致命一击 [0/7] \n[*]双倍伤害 [0/1]")
elseif inst.level >4 and inst.level <10 then --level[2]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [1/4]-(R)\n[*]电光护盾 [1/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [0/14] \n[*]狂暴状态 [1/4] \n[*]电气护盾 [1/5] \n[*]致命一击 [0/7] \n[*]双倍伤害 [0/1]")
elseif inst.level >10 and inst.level <30  then --level[3]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [1/4]-(R)\n[*]电光护盾 [1/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [0/14] \n[*]狂暴状态 [1/4] \n[*]电气护盾 [1/5] \n[*]致命一击 [1/7] \n[*]双倍伤害 [0/1]")
elseif inst.level >=30 and inst.level <50  then --level[4]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [1/4]-(R)\n[*]电光护盾 [1/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [1/14] \n[*]狂暴状态 [1/4] \n[*]电气护盾 [1/5] \n[*]致命一击 [1/7] \n[*]双倍伤害 [0/1]")
elseif inst.level >=50 and inst.level <80  then --level[5]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [1/4]-(R)\n[*]电光护盾 [1/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [2/14] \n[*]狂暴状态 [1/4] \n[*]电气护盾 [1/5] \n[*]致命一击 [1/7] \n[*]双倍伤害 [0/1]")
elseif inst.level >=80 and inst.level <124  then --level[6]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [1/4]-(R)\n[*]电光护盾 [1/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [2/14] \n[*]狂暴状态 [1/4] \n[*]电气护盾 [2/5] \n[*]致命一击 [1/7] \n[*]双倍伤害 [0/1]")
elseif inst.level >=125 and inst.level <200  then --level[7]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [1/4]-(R)\n[*]电光护盾 [1/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [2/14] \n[*]狂暴状态 [1/4] \n[*]电气护盾 [2/5] \n[*]致命一击 [2/7] \n[*]双倍伤害 [0/1]")
elseif inst.level >=200 and inst.level <340  then --level[8]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [1/4]-(R)\n[*]电光护盾 [1/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [3/14] \n[*]狂暴状态 [1/4] \n[*]电气护盾 [2/5] \n[*]致命一击 [2/7] \n[*]双倍伤害 [0/1]")
elseif inst.level >=340 and inst.level <430  then --level[9]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [1/4]-(R)\n[*]电光护盾 [1/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [4/14] \n[*]狂暴状态 [1/4] \n[*]电气护盾 [2/5] \n[*]致命一击 [2/7] \n[*]双倍伤害 [0/1]")
elseif inst.level >=430 and inst.level <530  then --level[10]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [2/4]-(R)\n[*]电光护盾 [2/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [4/14] \n[*]狂暴状态 [1/4] \n[*]电气护盾 [3/5] \n[*]致命一击 [2/7] \n[*]双倍伤害 [0/1]")
elseif inst.level >=530 and inst.level <640  then --level[11]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [2/4]-(R)\n[*]电光护盾 [2/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [4/14] \n[*]狂暴状态 [1/4] \n[*]电气护盾 [3/5] \n[*]致命一击 [3/7] \n[*]双倍伤害 [0/1]")
elseif inst.level >=640 and inst.level <760  then --level[12]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [2/4]-(R)\n[*]电光护盾 [2/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [4/14] \n[*]狂暴状态 [2/4] \n[*]电气护盾 [3/5] \n[*]致命一击 [3/7] \n[*]双倍伤害 [0/1]")
elseif inst.level >=760 and inst.level <890  then --level[13]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [2/4]-(R)\n[*]电光护盾 [2/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [5/14] \n[*]狂暴状态 [2/4] \n[*]电气护盾 [3/5] \n[*]致命一击 [3/7] \n[*]双倍伤害 [0/1]")
elseif inst.level >=890 and inst.level <1030  then --level[14]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [2/4]-(R)\n[*]电光护盾 [2/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [6/14] \n[*]狂暴状态 [2/4] \n[*]电气护盾 [3/5] \n[*]致命一击 [3/7] \n[*]双倍伤害 [0/1]")
elseif inst.level >=1030 and inst.level <1180  then --level[15]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [2/4]-(R)\n[*]电光护盾 [2/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [6/14] \n[*]狂暴状态 [2/4] \n[*]电气护盾 [4/5] \n[*]致命一击 [3/7] \n[*]双倍伤害 [0/1]")
elseif inst.level >=1180 and inst.level <1340  then --level[16]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [2/4]-(R)\n[*]电光护盾 [2/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [6/14] \n[*]狂暴状态 [2/4] \n[*]电气护盾 [4/5] \n[*]致命一击 [4/7] \n[*]双倍伤害 [0/1]")	
elseif inst.level >=1340 and inst.level <1510  then --level[17]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [2/4]-(R)\n[*]电光护盾 [2/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [7/14] \n[*]狂暴状态 [2/4] \n[*]电气护盾 [4/5] \n[*]致命一击 [4/7] \n[*]双倍伤害 [0/1]")	
elseif inst.level >=1510 and inst.level <1690  then --level[18]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [2/4]-(R)\n[*]电光护盾 [2/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [8/14] \n[*]狂暴状态 [2/4] \n[*]电气护盾 [4/5] \n[*]致命一击 [4/7] \n[*]双倍伤害 [0/1]")	
elseif inst.level >=1690 and inst.level <1880  then --level[19]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [2/4]-(R)\n[*]电光护盾 [2/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [8/14] \n[*]狂暴状态 [3/4] \n[*]电气护盾 [4/5] \n[*]致命一击 [4/7] \n[*]双倍伤害 [0/1]")	
elseif inst.level >=1880 and inst.level <2080  then --level[20]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [3/4]-(R)\n[*]电光护盾 [3/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [8/14] \n[*]狂暴状态 [3/4] \n[*]电气护盾 [4/5] \n[*]致命一击 [5/7] \n[*]双倍伤害 [0/1]")	
elseif inst.level >=2080 and inst.level <2290  then --level[21]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [3/4]-(R)\n[*]电光护盾 [3/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [8/14] \n[*]狂暴状态 [3/4] \n[*]电气护盾 [5/5] \n[*]致命一击 [5/7] \n[*]双倍伤害 [0/1]")	
elseif inst.level >=2290 and inst.level <2500  then --level[22]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [3/4]-(R)\n[*]电光护盾 [3/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [9/14] \n[*]狂暴状态 [3/4] \n[*]电气护盾 [5/5] \n[*]致命一击 [5/7] \n[*]双倍伤害 [0/1]")	
elseif inst.level >=2500 and inst.level <2850  then --level[23]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [3/4]-(R)\n[*]电光护盾 [3/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [10/14] \n[*]狂暴状态 [3/4] \n[*]电气护盾 [5/5] \n[*]致命一击 [5/7] \n[*]双倍伤害 [0/1]")	
elseif inst.level >=2850 and inst.level <3200  then --level[24]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [3/4]-(R)\n[*]电光护盾 [3/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [10/14] \n[*]狂暴状态 [4/4] \n[*]电气护盾 [5/5] \n[*]致命一击 [5/7] \n[*]双倍伤害 [0/1]")
elseif inst.level >=3200 and inst.level <3700  then --level[25]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [3/4]-(R)\n[*]电光护盾 [3/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [10/14] \n[*]狂暴状态 [4/4] \n[*]电气护盾 [5/5] \n[*]致命一击 [6/7] \n[*]双倍伤害 [0/1]")
elseif inst.level >=3700 and inst.level <4200  then --level[26]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [3/4]-(R)\n[*]电光护盾 [3/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [11/14] \n[*]狂暴状态 [4/4] \n[*]电气护盾 [5/5] \n[*]致命一击 [6/7] \n[*]双倍伤害 [0/1]")	
elseif inst.level >=4200 and inst.level <4700  then --level[27]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [3/4]-(R)\n[*]电光护盾 [3/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [11/14] \n[*]狂暴状态 [4/4] \n[*]电气护盾 [5/5] \n[*]致命一击 [7/7] \n[*]双倍伤害 [0/1]")	
elseif inst.level >=4700 and inst.level <5500 then --level[28]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [3/4]-(R)\n[*]电光护盾 [3/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [12/14] \n[*]狂暴状态 [4/4] \n[*]电气护盾 [5/5] \n[*]致命一击 [7/7] \n[*]双倍伤害 [0/1]")	
elseif inst.level >=5500 and inst.level <7000 then --level[29]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [3/4]-(R)\n[*]电光护盾 [3/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [13/14] \n[*]狂暴状态 [4/4] \n[*]电气护盾 [5/5] \n[*]致命一击 [7/7] \n[*]双倍伤害 [0/1]")	
elseif inst.level >=7000  then --level[30]
inst.components.talker:Say("[------主动技能------] \n[*]闪电攻击 [4/4]-(R)\n[*]电光护盾 [4/4]-(C)\n[*]表演 [1/1]-(X)\n\n[------被动技能------] \n[*]女武神状态 [14/14] \n[*]狂暴状态 [4/4] \n[*]电气护盾 [5/5] \n[*]致命一击 [7/7] \n[*]双倍伤害 [1/1]")	
end
end
AddModRPCHandler("musha", "INFO2", INFO2)
--exp kill

local function spawnspirit(inst, x, y, z, scale)
    local fx = SpawnPrefab("wathgrithr_spirit")
    fx.Transform:SetPosition(x, y, z)
    fx.Transform:SetScale(scale, scale, scale)
end

local function onkilll(inst, data)
local smallScale = 0.5
local medScale = 0.7
local largeScale = 1.1

	local victim = data.victim
	   if not (victim:HasTag("prey") or
            victim:HasTag("veggie") or
            victim:HasTag("eyeplant") or
            victim:HasTag("insect") or			
            victim:HasTag("structure")) then
    local delta = victim.components.combat.defaultdamage * 0.25
		   if math.random() < 0.7 then
    				inst.level = inst.level + 1
 		--inst.components.health:DoDelta(delta, false, "battleborn")
		inst.components.sanity:DoDelta(delta)
			inst.components.talker:Say("额外[经验](+1) \n".. (inst.level))	
			
            local time = victim.components.health.destroytime or 2
            local x, y, z = victim.Transform:GetWorldPosition()
            local scale = (victim:HasTag("smallcreature") and smallScale)
                        or (victim:HasTag("largecreature") and largeScale)
                        or medScale
					inst:DoTaskInTime(time, spawnspirit, x, y, z, scale)
				 	   if not inst.berserk and math.random() < 0.05 then
					   --inst.components.talker:Say("到我这来!幽灵小狗")
					     scheduler:ExecuteInTime(1, function() SpawnPrefab("statue_transition_2").Transform:SetPosition(victim:GetPosition():Get()) SpawnPrefab("ghosthound2").Transform:SetPosition(victim:GetPosition():Get()) end) end
					end					
				end
		  if (victim:HasTag("prey") or
              victim:HasTag("insect") or			
            victim:HasTag("frog")) then
    local delta = victim.components.combat.defaultdamage * 0.1
		   if math.random() < 0.15 then
    				inst.level = inst.level + 1
 			inst.components.sanity:DoDelta(delta)
			inst.components.talker:Say("闪电击杀\n额外[经验](+1) \n".. (inst.level))					
            local time = victim.components.health.destroytime or 2
            local x, y, z = victim.Transform:GetWorldPosition()
            local scale = (victim:HasTag("smallcreature") and smallScale)
                        or (victim:HasTag("largecreature") and largeScale)
                        or medScale
					inst:DoTaskInTime(time, spawnspirit, x, y, z, scale)
					end end 	
							  if (victim:HasTag("epic") ) then
    local delta = victim.components.combat.defaultdamage * 0.1
		   if math.random() <= 1 then
    				inst.level = inst.level + 10
 			inst.components.sanity:DoDelta(delta)
			inst.components.talker:Say("闪电击杀\n额外[经验](+10) \n".. (inst.level))		
			
            local time = victim.components.health.destroytime or 2
            local x, y, z = victim.Transform:GetWorldPosition()
            local scale = (victim:HasTag("smallcreature") and smallScale)
                        or (victim:HasTag("largecreature") and largeScale)
                        or medScale
					inst:DoTaskInTime(time, spawnspirit, x, y, z, scale)
					end end 	
							  if ( victim:HasTag("deerclops") or 
							  victim:HasTag("bearger") or
							  victim:HasTag("moose") or 
							  victim:HasTag("dragonfly")  ) then
    local delta = victim.components.combat.defaultdamage * 0.1
		   if math.random() <= 1 then
    				inst.level = inst.level + 25
 			inst.components.sanity:DoDelta(delta)
			inst.components.talker:Say("闪电击杀\n额外[经验](+25) \n".. (inst.level))		
			
            local time = victim.components.health.destroytime or 2
            local x, y, z = victim.Transform:GetWorldPosition()
            local scale = (victim:HasTag("smallcreature") and smallScale)
                        or (victim:HasTag("largecreature") and largeScale)
                        or medScale
					inst:DoTaskInTime(time, spawnspirit, x, y, z, scale)
					end 
					end 	
					inst:RemoveEventCallback("killed", onkilll)
				end 

--active lightning strike
local function on_hitLightnings_9(inst, data)
local other = data.target
if other and other.components.health and inst.level <=430 and not other:HasTag("player") then
SpawnPrefab("lightning").Transform:SetPosition(other:GetPosition():Get())
SpawnPrefab("shock_fx").Transform:SetPosition(other:GetPosition():Get())
SpawnPrefab("groundpoundring_fx").Transform:SetPosition(other:GetPosition():Get())
other.components.health:DoDelta(-40)
inst.components.sanity:DoDelta(-6)
inst.components.combat:SetRange(2)
inst.AnimState:SetBloomEffectHandle( "" )
inst.switch = false
inst:RemoveEventCallback("onhitother", on_hitLightnings_9)
if inst.frost and other.components.freezable then
other.components.freezable:AddColdness(10)
other.components.health:DoDelta(-5)
elseif inst.fire and other.components.burnable then
other.components.burnable:Ignite()
other.components.health:DoDelta(-12)
end
elseif other and other.components.health and inst.level > 430 and inst.level <= 1880 and not other:HasTag("player") then
SpawnPrefab("lightning").Transform:SetPosition(other:GetPosition():Get())
SpawnPrefab("shock_fx").Transform:SetPosition(other:GetPosition():Get())
SpawnPrefab("groundpoundring_fx").Transform:SetPosition(other:GetPosition():Get())
other.components.health:DoDelta(-60)
inst.components.sanity:DoDelta(-8)
inst.components.combat:SetRange(2)
inst.AnimState:SetBloomEffectHandle( "" )
inst.switch = false
inst:RemoveEventCallback("onhitother", on_hitLightnings_9)
if inst.frost and other.components.freezable then
other.components.freezable:AddColdness(20)
other.components.health:DoDelta(-10)
elseif inst.fire and other.components.burnable then
other.components.burnable:Ignite()
other.components.health:DoDelta(-24)
end
elseif other and other.components.health and inst.level > 1880 and inst.level <= 6999 and not other:HasTag("player") then
SpawnPrefab("lightning").Transform:SetPosition(other:GetPosition():Get())
SpawnPrefab("shock_fx").Transform:SetPosition(other:GetPosition():Get())
SpawnPrefab("groundpoundring_fx").Transform:SetPosition(other:GetPosition():Get())
other.components.health:DoDelta(-80)
inst.components.sanity:DoDelta(-10)
inst.components.combat:SetRange(2)
inst.AnimState:SetBloomEffectHandle( "" )
inst.switch = false
inst:RemoveEventCallback("onhitother", on_hitLightnings_9)
if inst.frost and other.components.freezable then
other.components.freezable:AddColdness(30)
other.components.health:DoDelta(-15)
elseif inst.fire and other.components.burnable then
other.components.burnable:Ignite()
other.components.health:DoDelta(-36)
end
elseif other and other.components.health and inst.level >= 7000 and not other:HasTag("player") then
SpawnPrefab("lightning").Transform:SetPosition(other:GetPosition():Get())
SpawnPrefab("shock_fx").Transform:SetPosition(other:GetPosition():Get())
SpawnPrefab("groundpoundring_fx").Transform:SetPosition(other:GetPosition():Get())
other.components.health:DoDelta(-100)
inst.components.sanity:DoDelta(-12)
inst.components.combat:SetRange(2)
inst.AnimState:SetBloomEffectHandle( "" )
inst.switch = false
inst:RemoveEventCallback("onhitother", on_hitLightnings_9)
if inst.frost and other.components.freezable then
other.components.freezable:AddColdness(40)
other.components.health:DoDelta(-20)
elseif inst.fire and other.components.burnable then
other.components.burnable:Ignite()
other.components.health:DoDelta(-48)
end
elseif other and other.components.health and other:HasTag("player") then
--SpawnPrefab("lightning").Transform:SetPosition(other:GetPosition():Get())
--SpawnPrefab("shock_fx").Transform:SetPosition(other:GetPosition():Get())
--SpawnPrefab("groundpoundring_fx").Transform:SetPosition(other:GetPosition():Get())
inst.components.combat:SetRange(2)
inst.AnimState:SetBloomEffectHandle( "" )
inst.components.talker:Say("暮莎不是刺客.")
inst.switch = false
inst:RemoveEventCallback("onhitother", on_hitLightnings_9)
end 
if other.components.burnable and other.components.burnable:IsBurning() then
        other.components.burnable:Extinguish()
end
end
  

--power lightning
local function Lightning_a(inst)
inst:ListenForEvent("killed", onkilll)
if not inst.switch and inst.components.sanity.current > 50 and inst.level < 430  and not inst.components.health:IsDead() and not inst:HasTag("playerghost") then
inst.components.combat:SetRange(9)
inst:ListenForEvent("onhitother", on_hitLightnings_9)
inst.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" )
inst.SoundEmitter:PlaySound("dontstarve/maxwell/shadowmax_appear")
SpawnPrefab("sparks").Transform:SetPosition(inst:GetPosition():Get())
inst.switch = true
inst.components.sanity:DoDelta(-6)
if inst.frost then
inst.components.talker:Say("冰霜闪电攻击!\n[LV1]")
elseif inst.fire then
inst.components.talker:Say("火焰闪电攻击!\n[LV1]")
elseif not inst.frost and not inst.fire then
inst.components.talker:Say("闪电攻击!\n[等级1]")
end
elseif not inst.switch and inst.components.sanity.current > 50 and inst.level >= 430 and inst.level < 1880  and not inst.components.health:IsDead() and not inst:HasTag("playerghost") then
inst.components.combat:SetRange(10)
inst:ListenForEvent("onhitother", on_hitLightnings_9)
inst.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" )
inst.SoundEmitter:PlaySound("dontstarve/maxwell/shadowmax_appear")
SpawnPrefab("sparks").Transform:SetPosition(inst:GetPosition():Get())
inst.switch = true
inst.components.sanity:DoDelta(-8)
if inst.frost then
inst.components.talker:Say("冰霜闪电攻击!\n[等级2]")
elseif inst.fire then
inst.components.talker:Say("火焰闪电攻击!\n[等级2]")
elseif not inst.frost and not inst.fire then
inst.components.talker:Say("闪电攻击!\n[等级2]")
end
elseif not inst.switch and inst.components.sanity.current > 50 and inst.level >= 1880 and inst.level < 7000  and not inst.components.health:IsDead() and not inst:HasTag("playerghost") then
inst.components.combat:SetRange(11)
inst:ListenForEvent("onhitother", on_hitLightnings_9)
inst.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" )
inst.SoundEmitter:PlaySound("dontstarve/maxwell/shadowmax_appear")
SpawnPrefab("sparks").Transform:SetPosition(inst:GetPosition():Get())
inst.switch = true
inst.components.sanity:DoDelta(-10)
if inst.frost then
inst.components.talker:Say("冰霜闪电攻击\n[等级3]")
elseif inst.fire then
inst.components.talker:Say("火焰闪电攻击!\n[等级3]")
elseif not inst.frost and not inst.fire then
inst.components.talker:Say("闪电攻击!\n[等级3]")
end
elseif not inst.switch and inst.components.sanity.current > 50 and inst.level >= 7000 and not inst.components.health:IsDead() and not inst:HasTag("playerghost") then
inst.components.combat:SetRange(12)
inst:ListenForEvent("onhitother", on_hitLightnings_9)
inst.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" )
inst.SoundEmitter:PlaySound("dontstarve/maxwell/shadowmax_appear")
SpawnPrefab("sparks").Transform:SetPosition(inst:GetPosition():Get())
inst.switch = true
inst.components.sanity:DoDelta(-12)
if inst.frost then
inst.components.talker:Say("冰霜闪电攻击!\n[4级]")
elseif inst.fire then
inst.components.talker:Say("火焰闪电攻击!\n[等级4]")
elseif not inst.frost and not inst.fire then
inst.components.talker:Say("闪电攻击!\n[等级4]")
end
elseif inst.switch and not inst.components.health:IsDead() then
inst.components.combat:SetRange(2)
inst:RemoveEventCallback("onhitother", on_hitLightnings_9)
inst.AnimState:SetBloomEffectHandle( "" )
inst.components.sanity:DoDelta(4)
inst.SoundEmitter:PlaySound("dontstarve/common/fireOut")
SpawnPrefab("sparks").Transform:SetPosition(inst:GetPosition():Get())
inst.switch = false
elseif not inst.switch and inst.components.sanity.current < 30 and not inst.components.health:IsDead() and not inst:HasTag("playerghost") then
inst.components.talker:Say("没有足够的[脑残]..")
elseif not inst.switch and inst:HasTag("playerghost") then
inst.components.talker:Say("Ooooh ! ohhoooho !!")
elseif inst.switch and inst:HasTag("playerghost") then
inst.components.talker:Say("Ooooh ? ooohhh ??")
end
local x,y,z = inst.Transform:GetWorldPosition()
local ents = TheSim:FindEntities(x,y,z, 250, {"yamcheb"})
for k,v in pairs(ents) do
if inst.components.leader:IsFollower(v) and not inst.switch then
v.yamche_lightning = false
elseif inst.components.leader:IsFollower(v) and inst.switch then
v.yamche_lightning = true
end end
end
AddModRPCHandler("musha", "Lightning_a", Lightning_a)

--shield
--active shield
local function shield_go(inst, attacked, data)
if not inst.components.health:IsDead() and inst.level < 430 and not inst.activec0 and inst.shield_level1 then
--inst.components.talker:Say("护盾开启!!")
inst.components.health:SetAbsorptionAmount(1)
local fx = SpawnPrefab("forcefieldfxx")
inst.on_sparkshield = true
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.timec1 = true
inst:DoTaskInTime(--[[Duration]] 4, function()
fx:RemoveEventCallback("blocked", fx_hitanim, inst)
if inst:IsValid() then
fx.kill_fx(fx)
--inst.components.health:SetAbsorptionAmount(0)
inst.components.talker:Say("[护盾]冷却 - [180秒]")
inst.on_sparkshield = false
if not inst.berserk and not inst.valkyrie then
	inst.components.health:SetAbsorptionAmount(0)
elseif inst.berserk and inst.berserk_armor_1 then
	inst.components.health:SetAbsorptionAmount(0.15)
elseif inst.berserk and inst.berserk_armor_2 then
	inst.components.health:SetAbsorptionAmount(0.3)	
elseif inst.berserk and inst.berserk_armor_3 then
	inst.components.health:SetAbsorptionAmount(0.45)
elseif inst.valkyrie and inst.valkyrie_armor_1 then
	inst.components.health:SetAbsorptionAmount(0.05)	
elseif inst.valkyrie and inst.valkyrie_armor_2 then
	inst.components.health:SetAbsorptionAmount(0.05)	
elseif inst.valkyrie and inst.valkyrie_armor_3 then
	inst.components.health:SetAbsorptionAmount(0.05)	
elseif inst.valkyrie and inst.valkyrie_armor_4 then
	inst.components.health:SetAbsorptionAmount(0.05)	
end	
inst:DoTaskInTime(--[[Cooldown]] 180, function() inst.activec0 = false inst.timec1 = false end)
end end) 
end 
if not inst.components.health:IsDead() and inst.level >= 430 and inst.level < 1880 and not inst.activec0 and inst.shield_level2 then
--inst.components.talker:Say("护盾开启!!")
inst.components.health:SetAbsorptionAmount(1)
local fx = SpawnPrefab("forcefieldfxx")
inst.on_sparkshield = true
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.timec2 = 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.components.talker:Say("[护盾]冷却 - [140秒]")
inst.on_sparkshield = false
if not inst.berserk and not inst.valkyrie then
	inst.components.health:SetAbsorptionAmount(0)
elseif inst.berserk and inst.berserk_armor_1 then
	inst.components.health:SetAbsorptionAmount(0.15)
elseif inst.berserk and inst.berserk_armor_2 then
	inst.components.health:SetAbsorptionAmount(0.3)	
elseif inst.berserk and inst.berserk_armor_3 then
	inst.components.health:SetAbsorptionAmount(0.45)
elseif inst.valkyrie and inst.valkyrie_armor_1 then
	inst.components.health:SetAbsorptionAmount(0.05)	
elseif inst.valkyrie and inst.valkyrie_armor_2 then
	inst.components.health:SetAbsorptionAmount(0.05)	
elseif inst.valkyrie and inst.valkyrie_armor_3 then
	inst.components.health:SetAbsorptionAmount(0.05)	
elseif inst.valkyrie and inst.valkyrie_armor_4 then
	inst.components.health:SetAbsorptionAmount(0.05)	
end	
inst:DoTaskInTime(--[[Cooldown]] 140, function() inst.activec0 = false inst.timec2 = false end)
end end) 
end 
if not inst.components.health:IsDead() and inst.level >= 1880 and inst.level < 7000 and not inst.activec0 and inst.shield_level3 then
--inst.components.talker:Say("护盾开启!!")
inst.components.health:SetAbsorptionAmount(1)
local fx = SpawnPrefab("forcefieldfxx")
inst.on_sparkshield = true
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.timec3 = true
inst:DoTaskInTime(--[[Duration]] 6, function()
fx:RemoveEventCallback("blocked", fx_hitanim, inst)
if inst:IsValid() then
fx.kill_fx(fx)
--inst.components.health:SetAbsorptionAmount(0)
inst.components.talker:Say("[护盾]冷却 - [100秒]")
inst.on_sparkshield = false
if not inst.berserk and not inst.valkyrie then
	inst.components.health:SetAbsorptionAmount(0)
elseif inst.berserk and inst.berserk_armor_1 then
	inst.components.health:SetAbsorptionAmount(0.15)
elseif inst.berserk and inst.berserk_armor_2 then
	inst.components.health:SetAbsorptionAmount(0.3)	
elseif inst.berserk and inst.berserk_armor_3 then
	inst.components.health:SetAbsorptionAmount(0.45)
elseif inst.valkyrie and inst.valkyrie_armor_1 then
	inst.components.health:SetAbsorptionAmount(0.05)	
elseif inst.valkyrie and inst.valkyrie_armor_2 then
	inst.components.health:SetAbsorptionAmount(0.05)	
elseif inst.valkyrie and inst.valkyrie_armor_3 then
	inst.components.health:SetAbsorptionAmount(0.05)	
elseif inst.valkyrie and inst.valkyrie_armor_4 then
	inst.components.health:SetAbsorptionAmount(0.05)	
end	
inst:DoTaskInTime(--[[Cooldown]] 100, function() inst.activec0 = false inst.timec3 = false end)
end end) 
end 
if not inst.components.health:IsDead() and inst.level >= 7000 and not inst.activec0 and inst.shield_level4 then
--inst.components.talker:Say("护盾开启!!")
inst.components.health:SetAbsorptionAmount(1)
local fx = SpawnPrefab("forcefieldfxx")
inst.on_sparkshield = true
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.timec4 = 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.components.talker:Say("[护盾]冷却 - [60秒]")
inst.on_sparkshield = false
if not inst.berserk and not inst.valkyrie then
	inst.components.health:SetAbsorptionAmount(0)
elseif inst.berserk and inst.berserk_armor_1 then
	inst.components.health:SetAbsorptionAmount(0.15)
elseif inst.berserk and inst.berserk_armor_2 then
	inst.components.health:SetAbsorptionAmount(0.3)	
elseif inst.berserk and inst.berserk_armor_3 then
	inst.components.health:SetAbsorptionAmount(0.45)
elseif inst.valkyrie and inst.valkyrie_armor_1 then
	inst.components.health:SetAbsorptionAmount(0.05)	
elseif inst.valkyrie and inst.valkyrie_armor_2 then
	inst.components.health:SetAbsorptionAmount(0.05)	
elseif inst.valkyrie and inst.valkyrie_armor_3 then
	inst.components.health:SetAbsorptionAmount(0.05)	
elseif inst.valkyrie and inst.valkyrie_armor_4 then
	inst.components.health:SetAbsorptionAmount(0.05)	
end	
inst:DoTaskInTime(--[[Cooldown]] 60, function() inst.activec0 = false inst.timec4 = false end)
end end) 
end 
end

---
local function shieldgo(inst)
if not inst.activec0 and not inst.timec1 and inst.level < 430  then
inst.components.talker:Say("[护盾]冷却完成")
SpawnPrefab("sparks").Transform:SetPosition(inst:GetPosition():Get())
inst.timec1 = true
elseif not inst.activec0 and not inst.timec2 and inst.level >= 430 and inst.level < 1880  then
inst.components.talker:Say("[护盾]冷却完成")
SpawnPrefab("sparks").Transform:SetPosition(inst:GetPosition():Get())
inst.timec2 = true
elseif not inst.activec0 and not inst.timec3 and inst.level >= 1880 and inst.level < 7000  then
inst.components.talker:Say("[护盾]冷却完成")
SpawnPrefab("sparks").Transform:SetPosition(inst:GetPosition():Get())
inst.timec3 = true
elseif not inst.activec0 and not inst.timec4 and inst.level >= 7000 then
inst.components.talker:Say("[护盾]冷却完成")
SpawnPrefab("sparks").Transform:SetPosition(inst:GetPosition():Get())
inst.timec4 = true
end 
end
local function on_shield_act(inst)
inst:ListenForEvent("hungerdelta", shieldgo )
inst:ListenForEvent("attacked", Sparkshield_1)
if inst.level < 430 then
inst.shield_level1 = true
elseif inst.level >= 430 and inst.level < 1880 then
inst.shield_level2 = true
inst.shield_level1 = false
elseif inst.level >= 1880 and inst.level < 7000 then
inst.shield_level3 = true
inst.shield_level2 = false
inst.shield_level1 = false
elseif inst.level >= 7000 then
inst.shield_level4 = true
inst.shield_level3 = false
inst.shield_level2 = false
inst.shield_level1 = false
end
if inst.level < 430 and not inst.activec0 and not inst.components.health:IsDead() and not inst:HasTag("playerghost") then
inst.components.talker:Say("电光护盾!!\n(1级)")
shield_go(inst)
elseif inst.level >= 430 and inst.level < 1880  and not inst.activec0 and not inst.components.health:IsDead() and not inst:HasTag("playerghost") then
inst.components.talker:Say("电光护盾!!\n(2级)")
shield_go(inst)
elseif inst.level >= 1880 and inst.level < 7000  and not inst.activec0 and not inst.components.health:IsDead() and not inst:HasTag("playerghost") then
inst.components.talker:Say("电光护盾!!\n(3级)")
shield_go(inst)
elseif inst.level >= 7000 and not inst.activec0 and not inst.components.health:IsDead() and not inst:HasTag("playerghost") then
inst.components.talker:Say("电光护盾!!\n(4级)")
shield_go(inst)
elseif inst.activec0 and not inst.components.health:IsDead() and not inst:HasTag("playerghost") then
inst.components.talker:Say("[护盾]没有足够的能量.")
inst.shield_level1 = false
inst.shield_level2 = false
inst.shield_level3 = false
inst.shield_level4 = false
elseif inst.activec0 and inst:HasTag("playerghost") then
inst.components.talker:Say("Oooohhhhh.!!")
elseif not inst.activec0 and inst:HasTag("playerghost") then
inst.components.talker:Say("Ooooh....")
end
end
  
 
AddModRPCHandler("musha", "on_shield_act", on_shield_act)

local function on_music_act1(inst)
if inst.components.playercontroller then

inst.components.playercontroller:Enable(false)
inst.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" )
local flute = inst.sg:GoToState("play_flute")
inst.AnimState:PlayAnimation("flute")
inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband")
inst.switlight = true
inst.entity:AddLight()
inst.Light:SetRadius(2.5)
inst.Light:SetFalloff(.8)
inst.Light:SetIntensity(.8)
inst.Light:SetColour(150/255,150/255,150/255)
inst.components.health:SetAbsorptionAmount(1)
inst.music_armor = true
inst.components.sanityaura.aura = (TUNING.SANITYAURA_HUGE*5)
scheduler:ExecuteInTime(3, function() inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband") inst.sg:GoToState("play_flute")
scheduler:ExecuteInTime(3, function() inst.sg:GoToState("enter_onemanband")
scheduler:ExecuteInTime(3, function() inst.components.playercontroller:Enable(true) inst.AnimState:SetBloomEffectHandle("") inst.Light:Enable(true) inst.components.sanity:DoDelta(25) inst.components.talker:Say("[Light Aura] -on !") SpawnPrefab("statue_transition_2").Transform:SetPosition(inst:GetPosition():Get()) SpawnPrefab("ghosthound2").Transform:SetPosition(inst:GetPosition():Get())  inst.components.sanityaura.aura = (TUNING.SANITYAURA_MED) inst.components.sanity:DoDelta(30) inst.music_armor = false scheduler:ExecuteInTime(180, function() inst.components.talker:Say("[Light Aura] -off \n[performance] CoolDown -[1200sec]") inst.SoundEmitter:PlaySound("dontstarve/common/fireOut") SpawnPrefab("statue_transition_2").Transform:SetPosition(inst:GetPosition():Get()) inst.components.sanityaura.aura = 0 inst.Light:Enable(false) scheduler:ExecuteInTime(1200, function() inst.switlight = false inst.components.talker:Say("Musha Ready to [performance]") inst.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" ) inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband") scheduler:ExecuteInTime(2, function() inst.AnimState:SetBloomEffectHandle( "" ) inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband") end)end)end)end)end)end)
end
end 
local function on_music_act2(inst)
if inst.components.playercontroller then

inst.components.playercontroller:Enable(false)
inst.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" )
local flute = inst.sg:GoToState("play_flute")
inst.AnimState:PlayAnimation("flute")
inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband")
inst.switlight = true
inst.entity:AddLight()
inst.Light:SetRadius(2.5)
inst.Light:SetFalloff(.8)
inst.Light:SetIntensity(.8)
inst.Light:SetColour(150/255,150/255,150/255)
inst.components.health:SetAbsorptionAmount(1)
inst.music_armor = true
inst.components.sanityaura.aura = (TUNING.SANITYAURA_HUGE*5)
scheduler:ExecuteInTime(3, function() inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband") inst.sg:GoToState("play_flute")
scheduler:ExecuteInTime(3, function() inst.sg:GoToState("enter_onemanband")scheduler:ExecuteInTime(3, function() inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband") inst.sg:GoToState("play_flute")
scheduler:ExecuteInTime(3, function() inst.components.playercontroller:Enable(true) inst.AnimState:SetBloomEffectHandle("") inst.Light:Enable(true) inst.components.sanity:DoDelta(25) inst.components.talker:Say("[Light Aura] -on !") SpawnPrefab("statue_transition_2").Transform:SetPosition(inst:GetPosition():Get()) SpawnPrefab("ghosthound").Transform:SetPosition(inst:GetPosition():Get())  inst.components.sanityaura.aura = (TUNING.SANITYAURA_MED) inst.components.sanity:DoDelta(30) inst.music_armor = false scheduler:ExecuteInTime(180, function() inst.components.talker:Say("[Light Aura] -off \n[performance] CoolDown -[1200sec]") inst.SoundEmitter:PlaySound("dontstarve/common/fireOut") SpawnPrefab("statue_transition_2").Transform:SetPosition(inst:GetPosition():Get()) inst.components.sanityaura.aura = 0 inst.Light:Enable(false) scheduler:ExecuteInTime(1200, function() inst.switlight = false inst.components.talker:Say("Musha Ready to [performance]") inst.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" ) inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband") scheduler:ExecuteInTime(2, function() inst.AnimState:SetBloomEffectHandle( "" ) inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband") end)end)end)end)end)end)end)
end
end 
local function on_music_act3(inst)
if inst.components.playercontroller then

inst.components.playercontroller:Enable(false)
inst.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" )
local flute = inst.sg:GoToState("play_flute")
inst.AnimState:PlayAnimation("flute")
inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband")
inst.switlight = true
inst.entity:AddLight()
inst.Light:SetRadius(2.5)
inst.Light:SetFalloff(.8)
inst.Light:SetIntensity(.8)
inst.Light:SetColour(150/255,150/255,150/255)
inst.components.health:SetAbsorptionAmount(1)
inst.music_armor = true
inst.components.sanityaura.aura = (TUNING.SANITYAURA_HUGE*5)
scheduler:ExecuteInTime(3, function() inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband") inst.sg:GoToState("play_flute")
scheduler:ExecuteInTime(3, function() inst.sg:GoToState("enter_onemanband")scheduler:ExecuteInTime(3, function() inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband") inst.sg:GoToState("play_flute")scheduler:ExecuteInTime(3, function() inst.sg:GoToState("enter_onemanband")
scheduler:ExecuteInTime(3, function() inst.components.playercontroller:Enable(true) inst.AnimState:SetBloomEffectHandle("") inst.Light:Enable(true) inst.components.sanity:DoDelta(25) inst.components.talker:Say("[Light Aura] -on !") SpawnPrefab("statue_transition_2").Transform:SetPosition(inst:GetPosition():Get()) SpawnPrefab("shadowmusha").Transform:SetPosition(inst:GetPosition():Get())  inst.components.sanityaura.aura = (TUNING.SANITYAURA_MED) inst.components.sanity:DoDelta(30) inst.music_armor = false scheduler:ExecuteInTime(180, function() inst.components.talker:Say("[Light Aura] -off \n[performance] CoolDown -[1200sec]") inst.SoundEmitter:PlaySound("dontstarve/common/fireOut") SpawnPrefab("statue_transition_2").Transform:SetPosition(inst:GetPosition():Get()) inst.components.sanityaura.aura = 0 inst.Light:Enable(false) scheduler:ExecuteInTime(1200, function() inst.switlight = false inst.components.talker:Say("Musha Ready to [performance]") inst.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" ) inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband") scheduler:ExecuteInTime(2, function() inst.AnimState:SetBloomEffectHandle( "" ) inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband") end)end)end)end)end)end)end)end)
end
end 
local function on_music_act4(inst)
if inst.components.playercontroller then

inst.components.playercontroller:Enable(false)
inst.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" )
local flute = inst.sg:GoToState("play_flute")
inst.AnimState:PlayAnimation("flute")
inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband")
inst.switlight = true
inst.entity:AddLight()
inst.Light:SetRadius(2.5)
inst.Light:SetFalloff(.8)
inst.Light:SetIntensity(.8)
inst.Light:SetColour(150/255,150/255,150/255)
inst.components.health:SetAbsorptionAmount(1)
inst.music_armor = true
inst.components.sanityaura.aura = (TUNING.SANITYAURA_HUGE*5)
scheduler:ExecuteInTime(3, function() inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband") inst.sg:GoToState("play_flute")
scheduler:ExecuteInTime(3, function() inst.sg:GoToState("enter_onemanband")scheduler:ExecuteInTime(3, function() inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband") inst.sg:GoToState("play_flute")scheduler:ExecuteInTime(3, function() inst.sg:GoToState("enter_onemanband")
scheduler:ExecuteInTime(3, function() inst.components.playercontroller:Enable(true) inst.AnimState:SetBloomEffectHandle("") inst.Light:Enable(true) inst.components.sanity:DoDelta(25) inst.components.talker:Say("[Light Aura] -on !") SpawnPrefab("statue_transition_2").Transform:SetPosition(inst:GetPosition():Get()) SpawnPrefab("tentacle_frost").Transform:SetPosition(inst:GetPosition():Get())  inst.components.sanityaura.aura = (TUNING.SANITYAURA_MED) inst.components.sanity:DoDelta(30) inst.music_armor = false scheduler:ExecuteInTime(180, function() inst.components.talker:Say("[Light Aura] -off \n[performance] CoolDown -[1200sec]") inst.SoundEmitter:PlaySound("dontstarve/common/fireOut") SpawnPrefab("statue_transition_2").Transform:SetPosition(inst:GetPosition():Get()) inst.components.sanityaura.aura = 0 inst.Light:Enable(false) scheduler:ExecuteInTime(1200, function() inst.switlight = false inst.components.talker:Say("Musha Ready to [performance]") inst.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" ) inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband") scheduler:ExecuteInTime(2, function() inst.AnimState:SetBloomEffectHandle( "" ) inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband") end)end)end)end)end)end)end)end)
end
end 
local function on_music_act0(inst)
if inst.components.playercontroller then

inst.components.playercontroller:Enable(false)
inst.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" )
local flute = inst.sg:GoToState("play_flute")
inst.AnimState:PlayAnimation("flute")
inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband")
inst.switlight = true
inst.entity:AddLight()
inst.Light:SetRadius(2.5)
inst.Light:SetFalloff(.8)
inst.Light:SetIntensity(.8)
inst.Light:SetColour(150/255,150/255,150/255)
inst.components.health:SetAbsorptionAmount(1)
inst.music_armor = true
inst.components.sanityaura.aura = (TUNING.SANITYAURA_MED)
inst.components.sanityaura.aura = (TUNING.SANITYAURA_HUGE*5)
scheduler:ExecuteInTime(3, function() inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband") inst.sg:GoToState("play_flute")
scheduler:ExecuteInTime(3, function() inst.sg:GoToState("enter_onemanband")
scheduler:ExecuteInTime(3, function() inst.components.playercontroller:Enable(true) inst.AnimState:SetBloomEffectHandle("") inst.Light:Enable(true) inst.components.sanity:DoDelta(25) inst.components.talker:Say("[Light Aura] -on !")   inst.components.sanity:DoDelta(30) inst.music_armor = false scheduler:ExecuteInTime(180, function() inst.components.talker:Say("[Light Aura] -off \n[performance] CoolDown -[1200sec]") inst.SoundEmitter:PlaySound("dontstarve/common/fireOut") SpawnPrefab("statue_transition_2").Transform:SetPosition(inst:GetPosition():Get()) inst.components.sanityaura.aura = 0 inst.Light:Enable(false) scheduler:ExecuteInTime(1200, function() inst.switlight = false inst.components.talker:Say("Musha Ready to [performance]") inst.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" ) inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband") scheduler:ExecuteInTime(2, function() inst.AnimState:SetBloomEffectHandle( "" ) inst.SoundEmitter:PlaySound("dontstarve/wilson/onemanband") end)end)end)end)end)end)
end
end 
local function on_buff_act(inst)
local performance0 = 1
local performance1 = 0.25
local performance2 = 0.2
local performance3 = 0.15
local performance4 = 0.1
if math.random() < performance1 and not inst.switlight and not inst.components.health:IsDead() and not inst:HasTag("playerghost") then
inst.components.talker:Say("现在, 看着我!\n表演[第1种]")
on_music_act1(inst)
elseif math.random() < performance2 and not inst.switlight and not inst.components.health:IsDead() and not inst:HasTag("playerghost") then
inst.components.talker:Say("现在, 看着我!\n表演[第2种]")
on_music_act2(inst)
elseif math.random() < performance3 and not inst.switlight and not inst.components.health:IsDead() and not inst:HasTag("playerghost") then
inst.components.talker:Say("现在, 看着我!\n表演[第3种]")
on_music_act3(inst)
elseif math.random() < performance4 and not inst.switlight and not inst.components.health:IsDead() and not inst:HasTag("playerghost") then
inst.components.talker:Say("现在, 看着我!\n表演[第4种]")
on_music_act4(inst)
elseif math.random() < performance1 and not inst.switlight and not inst.components.health:IsDead() and not inst:HasTag("playerghost") then
inst.components.talker:Say("现在, 看着我!\n表演[第1种]")
on_music_act1(inst)
elseif math.random() < performance2 and not inst.switlight and not inst.components.health:IsDead() and not inst:HasTag("playerghost") then
inst.components.talker:Say("现在, 看着我!\n表演[第2种]")
on_music_act2(inst)
elseif math.random() < performance3 and not inst.switlight and not inst.components.health:IsDead() and not inst:HasTag("playerghost") then
inst.components.talker:Say("现在, 看着我!\n表演[第3种]")
on_music_act3(inst)
elseif math.random() < performance4 and not inst.switlight and not inst.components.health:IsDead() and not inst:HasTag("playerghost") then
inst.components.talker:Say("现在, 看着我!\n表演[第4种]")
on_music_act4(inst)
elseif math.random() < performance0 and not inst.switlight and not inst.components.health:IsDead() and not inst:HasTag("playerghost") then
inst.components.talker:Say("现在, 看着我!\n表演[第0种]")
on_music_act0(inst)
elseif inst.switlight and not inst.components.health:IsDead() and not inst:HasTag("playerghost") then
inst.components.talker:Say("我最喜欢的节目? 好吧,以后再说..")
elseif inst.components.health:IsDead() or inst:HasTag("playerghost") then
inst.components.talker:Say("Oooh Ohoooh..")
end
end

AddModRPCHandler("musha", "buff", on_buff_act)

 
--and inst.components.leader.numfollowers < 1 
local function yamche_update(inst)
local x,y,z = inst.Transform:GetWorldPosition()
local ents = TheSim:FindEntities(x,y,z, 25, {"yamcheb"})
for k,v in pairs(ents) do
if inst.follow and v.components.follower and not v.components.follower.leader and not inst.components.leader:IsFollower(v) and inst.components.leader:CountFollowers("yamcheb") == 0 and not v.hat then
inst.components.leader:AddFollower(v)
--on_yamche(inst)
v.yamche = true
v.sleepn = false 
v.fightn = false

--off_yamche(inst)
elseif not inst.follow and v.components.follower and v.components.follower.leader and inst.components.leader:IsFollower(v) and inst.components.leader:CountFollowers("yamcheb") == 1 and not v.hat then
v.sleepn = true
v.yamche = true 
v.fightn = true
v.active_hunt = false
inst.components.leader:RemoveFollowersByTag("yamcheb")

if v.pick1 then
v.components.talker:Say("[放下收集的道具]")
v.pick1 = false
v.working_food = false
end
end end end
 
local function order_yamche(inst)
if not inst.follow and not inst.components.health:IsDead() and not inst:HasTag("playerghost") then
inst.components.talker:Say("Yamche,跟着我!")
inst.follow = true
--master_yamche(inst)
yamche_update(inst)
elseif inst.follow and not inst.components.health:IsDead() and not inst:HasTag("playerghost") then
inst.components.talker:Say("Yamche,呆在这")
inst.follow = false
--master_yamche(inst)
yamche_update(inst)
elseif not inst.follow and inst:HasTag("playerghost") then
inst.components.talker:Say("跟--- 着--- 我---...")
inst.follow = true
yamche_update(inst)
elseif inst.follow and inst:HasTag("playerghost") then
inst.components.talker:Say("呆--- 在--- 这---...")
inst.follow = false
yamche_update(inst)
end
end 

AddModRPCHandler("musha","yamche", order_yamche)

--specific
local function BabyPostInit(inst)
	if not inst.components.characterspecific then
		inst:AddComponent("characterspecific")	end
	inst.components.characterspecific:SetOwner("musha")
	inst.components.characterspecific:SetStorable(true)
	inst.components.characterspecific:SetComment("Phoenix seems difficult to tame..")
	return inst
end
AddPrefabPostInit("musha_small", BabyPostInit)
-----------------------------------------------
local function visual_hold(inst)
if not inst.visual_hold and not inst.components.health:IsDead() and not inst:HasTag("playerghost") and not inst.full_hold and not inst.normal_hold and not inst.berserk_hold and not inst.valkyrie_hold and not inst.hold_old1 and not inst.hold_old2 and not inst.hold_old3 and not inst.hold_old4 and not inst.hold_old5 and not inst.hold_old6 and not inst.hold_old7 and not inst.hold_old8 then
inst.components.talker:Say("[改变外形 - 开启] \n状态:[当前]")
inst.visual_hold = true

inst.full_hold = true
inst.normal_hold = false
inst.valkyrie_hold = true
inst.berserk_hold = true
inst.hold_old1 = true
inst.hold_old2 = true
inst.hold_old3 = true
inst.hold_old4 = true
inst.hold_old5 = true
inst.hold_old6 = true
inst.hold_old7 = true
inst.hold_old8 = true
inst.AnimState:SetBuild("musha")

elseif inst.visual_hold and not inst.components.health:IsDead() and not inst:HasTag("playerghost") and inst.full_hold and not inst.normal_hold and inst.valkyrie_hold and inst.berserk_hold and inst.hold_old1 and inst.hold_old2 and inst.hold_old3 and inst.hold_old4 and inst.hold_old5 and inst.hold_old6 and inst.hold_old7 and inst.hold_old8 then
inst.components.talker:Say("[改变外形 - 开启] \n状态:[普通]")
inst.visual_hold = true
inst.full_hold = true
inst.normal_hold = true
inst.valkyrie_hold = false
inst.berserk_hold = true
inst.hold_old1 = true
inst.hold_old2 = true
inst.hold_old3 = true
inst.hold_old4 = true
inst.hold_old5 = true
inst.hold_old6 = true
inst.hold_old7 = true
inst.hold_old8 = true
inst.AnimState:SetBuild("musha_normal")

elseif inst.visual_hold and not inst.components.health:IsDead() and not inst:HasTag("playerghost") and inst.full_hold and inst.normal_hold and not inst.valkyrie_hold and inst.berserk_hold and inst.hold_old1 and inst.hold_old2 and inst.hold_old3 and inst.hold_old4 and inst.hold_old5 and inst.hold_old6 and inst.hold_old7 and inst.hold_old8 then
inst.components.talker:Say("[改变外形 - 开启] \n状态:[女武神]")
inst.visual_hold = true
inst.full_hold = true
inst.normal_hold = true
inst.valkyrie_hold = true
inst.berserk_hold = false
inst.hold_old1 = true
inst.hold_old2 = true
inst.hold_old3 = true
inst.hold_old4 = true
inst.hold_old5 = true
inst.hold_old6 = true
inst.hold_old7 = true
inst.hold_old8 = true
inst.AnimState:SetBuild("musha_battle")

elseif inst.visual_hold and not inst.components.health:IsDead() and not inst:HasTag("playerghost") and inst.full_hold and inst.normal_hold and inst.valkyrie_hold and not inst.berserk_hold and inst.hold_old1 and inst.hold_old2 and inst.hold_old3 and inst.hold_old4 and inst.hold_old5 and inst.hold_old6 and inst.hold_old7 and inst.hold_old8 then
inst.components.talker:Say("[改变外形 - 开启] \n状态:[狂暴]")
inst.visual_hold = true
inst.full_hold = true
inst.normal_hold = true
inst.valkyrie_hold = true
inst.berserk_hold = true
inst.hold_old1 = false
inst.hold_old2 = true
inst.hold_old3 = true
inst.hold_old4 = true
inst.hold_old5 = true
inst.hold_old6 = true
inst.hold_old7 = true
inst.hold_old8 = true
inst.AnimState:SetBuild("musha_hunger")

elseif inst.visual_hold and not inst.components.health:IsDead() and not inst:HasTag("playerghost") and inst.full_hold and inst.normal_hold and inst.valkyrie_hold and inst.berserk_hold and not inst.hold_old1 and inst.hold_old2 and inst.hold_old3 and inst.hold_old4 and inst.hold_old5 and inst.hold_old6 and inst.hold_old7 and inst.hold_old8 then
inst.components.talker:Say("[改变外形 - 开启] \n状态:[老版1]")
inst.visual_hold = true
inst.full_hold = true
inst.normal_hold = true
inst.valkyrie_hold = true
inst.berserk_hold = true
inst.hold_old1 = true
inst.hold_old2 = false
inst.hold_old3 = true
inst.hold_old4 = true
inst.hold_old5 = true
inst.hold_old6 = true
inst.hold_old7 = true
inst.hold_old8 = true
inst.AnimState:SetBuild("musha_old")

elseif inst.visual_hold and not inst.components.health:IsDead() and not inst:HasTag("playerghost") and inst.full_hold and inst.normal_hold and inst.valkyrie_hold and inst.berserk_hold and inst.hold_old1 and not inst.hold_old2 and inst.hold_old3 and inst.hold_old4 and inst.hold_old5 and inst.hold_old6 and inst.hold_old7 and inst.hold_old8 then
inst.components.talker:Say("[改变外形 - 开启] \n状态:[老版2]")
inst.visual_hold = true
inst.full_hold = true
inst.normal_hold = true
inst.valkyrie_hold = true
inst.berserk_hold = true
inst.hold_old1 = true
inst.hold_old2 = true
inst.hold_old3 = false
inst.hold_old4 = true
inst.hold_old5 = true
inst.hold_old6 = true
inst.hold_old7 = true
inst.hold_old8 = true
inst.AnimState:SetBuild("musha_normal_old")

elseif inst.visual_hold and not inst.components.health:IsDead() and not inst:HasTag("playerghost") and inst.full_hold and inst.normal_hold and inst.valkyrie_hold and inst.berserk_hold and inst.hold_old1 and inst.hold_old2 and not inst.hold_old3 and inst.hold_old4 and inst.hold_old5 and inst.hold_old6 and inst.hold_old7 and inst.hold_old8 then
inst.components.talker:Say("[改变外形 - 开启] \n状态:[老版3]")
inst.visual_hold = true
inst.full_hold = true
inst.normal_hold = true
inst.valkyrie_hold = true
inst.berserk_hold = true
inst.hold_old1 = true
inst.hold_old2 = true
inst.hold_old3 = true
inst.hold_old4 = false
inst.hold_old5 = true
inst.hold_old6 = true
inst.hold_old7 = true
inst.hold_old8 = true
inst.AnimState:SetBuild("musha_battle_old")

elseif inst.visual_hold and not inst.components.health:IsDead() and not inst:HasTag("playerghost") and inst.full_hold and inst.normal_hold and inst.valkyrie_hold and inst.berserk_hold and inst.hold_old1 and inst.hold_old2 and inst.hold_old3 and not inst.hold_old4 and inst.hold_old5 and inst.hold_old6 and inst.hold_old7 and inst.hold_old8 then
inst.components.talker:Say("[改变外形 - 开启] \n状态:[老版4]")
inst.visual_hold = true
inst.full_hold = true
inst.normal_hold = true
inst.valkyrie_hold = true
inst.berserk_hold = true
inst.hold_old1 = true
inst.hold_old2 = true
inst.hold_old3 = true
inst.hold_old4 = true
inst.hold_old5 = false
inst.hold_old6 = true
inst.hold_old7 = true
inst.hold_old8 = true
inst.AnimState:SetBuild("musha_hunger_old")

elseif inst.visual_hold and not inst.components.health:IsDead() and not inst:HasTag("playerghost") and inst.full_hold and inst.normal_hold and inst.valkyrie_hold and inst.berserk_hold and inst.hold_old1 and inst.hold_old2 and inst.hold_old3 and inst.hold_old4 and not inst.hold_old5 and inst.hold_old6 and inst.hold_old7 and inst.hold_old8 then
inst.components.talker:Say("[改变外形 - 开启] \n状态:[老版5]")
inst.visual_hold = true
inst.full_hold = true
inst.normal_hold = true
inst.valkyrie_hold = true
inst.berserk_hold = true
inst.hold_old1 = true
inst.hold_old2 = true
inst.hold_old3 = true
inst.hold_old4 = true
inst.hold_old5 = true
inst.hold_old6 = false
inst.hold_old7 = true
inst.hold_old8 = true
inst.AnimState:SetBuild("musha_full_p_old")

elseif inst.visual_hold and not inst.components.health:IsDead() and not inst:HasTag("playerghost") and inst.full_hold and inst.normal_hold and inst.valkyrie_hold and inst.berserk_hold and inst.hold_old1 and inst.hold_old2 and inst.hold_old3 and inst.hold_old4 and inst.hold_old5 and not inst.hold_old6 and inst.hold_old7 and inst.hold_old8 then
inst.components.talker:Say("[改变外形 - 开启] \n状态:[老版6]")
inst.visual_hold = true
inst.full_hold = true
inst.normal_hold = true
inst.valkyrie_hold = true
inst.berserk_hold = true
inst.hold_old1 = true
inst.hold_old2 = true
inst.hold_old3 = true
inst.hold_old4 = true
inst.hold_old5 = true
inst.hold_old6 = true
inst.hold_old7 = false
inst.hold_old8 = true
inst.AnimState:SetBuild("musha_normal_p_old")

elseif inst.visual_hold and not inst.components.health:IsDead() and not inst:HasTag("playerghost") and inst.full_hold and inst.normal_hold and inst.valkyrie_hold and inst.berserk_hold and inst.hold_old1 and inst.hold_old2 and inst.hold_old3 and inst.hold_old4 and inst.hold_old5 and inst.hold_old6 and not inst.hold_old7 and inst.hold_old8 then
inst.components.talker:Say("[改变外形 - 开启] \n状态:[老版7]")
inst.visual_hold = true
inst.full_hold = true
inst.normal_hold = true
inst.valkyrie_hold = true
inst.berserk_hold = true
inst.hold_old1 = true
inst.hold_old2 = true
inst.hold_old3 = true
inst.hold_old4 = true
inst.hold_old5 = true
inst.hold_old6 = true
inst.hold_old7 = true
inst.hold_old8 = false
inst.AnimState:SetBuild("musha_battle_p_old")

elseif inst.visual_hold and not inst.components.health:IsDead() and not inst:HasTag("playerghost") and inst.full_hold and inst.normal_hold and inst.valkyrie_hold and inst.berserk_hold and inst.hold_old1 and inst.hold_old2 and inst.hold_old3 and inst.hold_old4 and inst.hold_old5 and inst.hold_old6 and inst.hold_old7 and not inst.hold_old8 then
inst.components.talker:Say("[改变外形 - 开启] \n状态:[老版8]")
inst.visual_hold = true
inst.full_hold = true
inst.normal_hold = true
inst.valkyrie_hold = true
inst.berserk_hold = true
inst.hold_old1 = true
inst.hold_old2 = true
inst.hold_old3 = true
inst.hold_old4 = true
inst.hold_old5 = true
inst.hold_old6 = true
inst.hold_old7 = true
inst.hold_old8 = true
inst.AnimState:SetBuild("musha_hunger_p_old")

elseif inst.visual_hold and not inst.components.health:IsDead() and not inst:HasTag("playerghost") and inst.full_hold and inst.normal_hold and inst.valkyrie_hold and inst.berserk_hold and inst.hold_old1 and inst.hold_old2 and inst.hold_old3 and inst.hold_old4 and inst.hold_old5 and inst.hold_old6 and inst.hold_old7 and inst.hold_old8 then
inst.components.talker:Say("[改变外形 - 关闭] \n状态:[自动]")
inst.visual_hold = false
inst.full_hold = false
inst.normal_hold = false
inst.valkyrie_hold = false
inst.berserk_hold = false
inst.hold_old1 = false
inst.hold_old2 = false
inst.hold_old3 = false
inst.hold_old4 = false
inst.hold_old5 = false
inst.hold_old6 = false
inst.hold_old7 = false
inst.hold_old8 = false
end end 
AddModRPCHandler("musha","visual_hold", visual_hold)

local function yamche2(inst)

--hunt --defense --avoid
local x,y,z = inst.Transform:GetWorldPosition()
local ents = TheSim:FindEntities(x,y,z, 30, {"yamcheb"})
for k,v in pairs(ents) do

if v.components.follower and v.components.follower.leader and inst.components.leader:IsFollower(v) and not v.peace and not v.active_hunt and not v.defense and not inst:HasTag("playerghost") then
inst.components.talker:Say("Yamche,一起狩猎去!")
v.components.talker:Say("[主动进攻]\n护甲:35")
v.yamche = true 
v.peace = false
v.active_hunt = true
v.defense = false

elseif v.components.follower and v.components.follower.leader and inst.components.leader:IsFollower(v) and not v.peace and v.active_hunt and not v.defense and inst.components.leader:IsFollower(v) and not inst:HasTag("playerghost") then
inst.components.talker:Say("Yamche,避免战斗!")
v.components.talker:Say("[避免战斗]\n护甲:90")
v.yamche = true 
v.peace = true
v.active_hunt = false
v.defense = true

elseif v.components.follower and v.components.follower.leader and inst.components.leader:IsFollower(v) and v.peace and not v.active_hunt and v.defense and inst.components.leader:IsFollower(v) and not inst:HasTag("playerghost") then
inst.components.talker:Say("Yamche, 保护我!")
v.components.talker:Say("[被动防御]\n护甲:50")
v.yamche = true 
v.peace = false
v.active_hunt = false
v.defense = false

elseif v.components.follower and v.components.follower.leader and not v.peace and inst.components.leader:IsFollower(v) and inst:HasTag("playerghost") then
inst.components.talker:Say("Yaaaam.. 不----要----战------..")
v.components.talker:Say("[避免战斗]\n[护甲:90]")
v.yamche = true 
v.peace = true
v.active_hunt = false
v.defense = true
elseif v.components.follower and v.components.follower.leader and v.peace and inst.components.leader:IsFollower(v) and inst:HasTag("playerghost") then
inst.components.talker:Say("Oooooooh Ooooh")
v.components.talker:Say("[被动防御]\n[保护]")
v.yamche = true 
v.peace = false
v.active_hunt = false
v.defense = false
end
end end
AddModRPCHandler("musha","yamche2", yamche2)

local function yamche3(inst)
local x,y,z = inst.Transform:GetWorldPosition()
local ents = TheSim:FindEntities(x,y,z, 25, {"yamcheb"})
for k,v in pairs(ents) do
if v.components.follower and v.components.follower.leader and inst.components.leader:IsFollower(v) and not v.pick1 and not inst:HasTag("playerghost") then
inst.components.talker:Say("Yamche,采集道具.")
v.working_food = true
v.pick1 = true
v.drop = false
v.yamche = true 
if not v.light_on then
v.components.talker:Say("[采集道具]\n饥饿速度(x6)")
elseif v.light_on then
v.components.talker:Say("[发光]+[采集道具]\n饥饿速度(x14)")
end
elseif v.components.follower and v.components.follower.leader and inst.components.leader:IsFollower(v) and v.pick1 and not inst:HasTag("playerghost") then
inst.components.talker:Say("Yamche, 给我看-采集的东西.\n[放下 - 所有]")
v.working_food = false
v.pick1 = false
v.drop = true
if not v.light_on then
v.components.talker:Say("[休息]\n饥饿速度(x1)")
elseif v.light_on then
v.components.talker:Say("[发光]\n饥饿速度(x8)")
end
elseif not inst.components.leader:IsFollower(v) and not inst:HasTag("playerghost") and inst.components.leader:CountFollowers("yamcheb") == 0 then
inst.components.talker:Say("她需要多休息..")
elseif v.components.follower and v.components.follower.leader and inst.components.leader:IsFollower(v) and not v.pick1 and inst:HasTag("playerghost") then
inst.components.talker:Say("冷--- 却-- 中--...")
v.working_food = true
v.pick1 = true
v.drop = false
v.yamche = true 
if not v.light_on then
v.components.talker:Say("[采集道具]\n饥饿速度(x6)")
elseif v.light_on then
v.components.talker:Say("[发光]+[采集道具]\n饥饿速度(x14)")
end
elseif v.components.follower and v.components.follower.leader and inst.components.leader:IsFollower(v) and v.pick1 and inst:HasTag("playerghost") then
inst.components.talker:Say("放---- 下----...")
v.working_food = false
v.pick1 = false
v.drop = true
if not v.light_on then
v.components.talker:Say("[休息]\n饥饿速度(x1)")
elseif v.light_on then
v.components.talker:Say("[发光]\n饥饿速度(x8)")
end
end end end
AddModRPCHandler("musha","yamche3", yamche3)

local function ydebug(inst)
local x,y,z = inst.Transform:GetWorldPosition()
local ents = TheSim:FindEntities(x,y,z, 25, {"yamcheb"})
for k,v in pairs(ents) do
v.components.talker:Say("[丢下所有]\n容器调试按键")
if v.components.follower and v.components.follower.leader and inst.components.leader:IsFollower(v) and not v.level1 then
v.components.container:DropEverything()
v.components.inventory:DropEverything(true)
end
end end

AddModRPCHandler("musha","ydebug", ydebug)
------------------------------------------------
-------------comfortable health info
local healthinfoActive = 0
for _, moddir in ipairs(GLOBAL.KnownModIndex:GetModsToLoad()) do
    if GLOBAL.KnownModIndex:GetModInfo(moddir).name == "Health Info" or GLOBAL.KnownModIndex:GetModInfo(moddir).name == "c12怪物显示血量" then
		healthinfoActive = 1
   end end 
 
--yamche health info (thx health info)
if healthinfoActive == 0 then
AddClassPostConstruct("components/health_replica", function(self)
self.SetCurrent = function(self, current)
if self.inst.components and self.inst.components.health and self.inst.components.healthinfo_copy then
local str = self.inst.components.healthinfo_copy.text
if str ~= nil then
local h=self.inst.components.health
local mx=math.floor(h.maxhealth-h.minhealth)
local cur=math.floor(h.currenthealth-h.minhealth)
local i,j = string.find(str, " [", nil, true)
if i ~= nil and i > 1 then str = string.sub(str, 1, (i-1)) end
str = "["..math.floor(cur*100/mx).."%]"
if self.inst.components.healthinfo_copy and self.inst:HasTag("yamcheb") then
self.inst.components.healthinfo_copy:SetText(str)
end end end
if self.classified ~= nil then
self.classified:SetValue("currenthealth", current)
end end end)
--hover text
AddGlobalClassPostConstruct('widgets/hoverer', 'HoverText', function(self)
self.OnUpdate = function(self)
local using_mouse = self.owner.components and self.owner.components.playercontroller:UsingMouse()
if using_mouse ~= self.shown then
if using_mouse then
self:Show()
else
self:Hide()
end end
if not self.shown then
return
end
local str = nil
if self.isFE == false then
str = self.owner.HUD.controls:GetTooltip() or self.owner.components.playercontroller:GetHoverTextOverride()
else
str = self.owner:GetTooltip()
end
local secondarystr = nil
local lmb = nil
if not str and self.isFE == false then
lmb = self.owner.components.playercontroller:GetLeftMouseAction()
if lmb then
str = lmb:GetActionString()
if lmb.target and lmb.invobject == nil and lmb.target ~= lmb.doer then
local name = lmb.target:GetDisplayName() or (lmb.target.components.named and lmb.target.components.named.name)
if name then
local adjective = lmb.target:GetAdjective()
if adjective then
str = str.. " " .. adjective .. " " .. name
else
str = str.. " " .. name
end
if lmb.target.replica.stackable ~= nil and lmb.target.replica.stackable:IsStack() then
str = str .. " x" .. tostring(lmb.target.replica.stackable:StackSize())
end
if lmb.target.components.inspectable and lmb.target.components.inspectable.recordview and lmb.target.prefab then
GLOBAL.ProfileStatsSet(lmb.target.prefab .. "_seen", true)
end end end
if lmb.target and lmb.target ~= lmb.doer and lmb.target.components and lmb.target.components.healthinfo_copy and lmb.target.components.healthinfo_copy.text ~= '' then
local name = lmb.target:GetDisplayName() or (lmb.target.components.named and lmb.target.components.named.name) or ""
local i,j = string.find(str, " " .. name, nil, true)
if i ~= nil and i > 1 then str = string.sub(str, 1, (i-1)) end
str = str.. " " .. name .. " " .. lmb.target.components.healthinfo_copy.text
end end
local rmb = self.owner.components.playercontroller:GetRightMouseAction()
if rmb then
secondarystr = GLOBAL.STRINGS.RMB .. ": " .. rmb:GetActionString()
end end
if str then
if self.strFrames == nil then self.strFrames = 1 end
if self.str ~= self.lastStr then
--print("new string")
self.lastStr = self.str
self.strFrames = SHOW_DELAY
else
self.strFrames = self.strFrames - 1
if self.strFrames <= 0 then
if lmb and lmb.target and lmb.target:HasTag("player") then
self.text:SetColour(lmb.target.playercolour)
else
self.text:SetColour(1,1,1,1)
end
self.text:SetString(str)
self.text:Show()
end end
else
self.text:Hide()
end
if secondarystr then
YOFFSETUP = -80
YOFFSETDOWN = -50
self.secondarytext:SetString(secondarystr)
self.secondarytext:Show()
else
self.secondarytext:Hide()
end
local changed = (self.str ~= str) or (self.secondarystr ~= secondarystr)
self.str = str
self.secondarystr = secondarystr
if changed then
local pos = TheInput:GetScreenPosition()
self:UpdatePosition(pos.x, pos.y)
end end end)

AddPrefabPostInitAny(function(inst)
	if inst.components.healthinfo_copy == nil then
		inst:AddComponent("healthinfo_copy")
	if inst.components.health and inst:HasTag("yamcheb") then
			str = ""
			local h=inst.components.health
			local mx=math.floor(h.maxhealth-h.minhealth)
			local cur=math.floor(h.currenthealth-h.minhealth)
			
				str = "["..math.floor(cur*100/mx).."%]"
		inst.components.healthinfo_copy:SetText(str)
		end	end end)
end
-------------------------------------------------
-------------------------------------------------
--[[
-------yamche floating badge 
local function Yamchebadge ( inst )

	inst:DoTaskInTime( 0, function() 
		local controls = inst.HUD.controls
	local YamcheStatusDisplays = require "widgets/yamchestatusdisplays"
	controls.YamcheStatus = controls:AddChild(YamcheStatusDisplays(inst))
		controls.YamcheStatus:SetPosition(0, -250, 0)
	end)	
end
AddSimPostInit( Yamchebadge )
]]
-------------describe
---------------
STRINGS.NAMES.MUSHA_EGG = "凤凰蛋"
STRINGS.NAMES.MUSHA_EGG_CRACKED = "有裂缝的凤凰蛋"
STRINGS.NAMES.MUSHA_EGGS1 = "凤凰蛋(2级)"
STRINGS.NAMES.MUSHA_EGG_CRACKEDS1 = "有裂缝的凤凰蛋(2级)"
STRINGS.NAMES.MUSHA_EGGS2 = "凤凰蛋(3级)"
STRINGS.NAMES.MUSHA_EGG_CRACKEDS2 = "有裂缝的凤凰蛋(3级)"
STRINGS.NAMES.MUSHA_EGGS3 = "凤凰蛋(4级)"
STRINGS.NAMES.MUSHA_EGG_CRACKEDS3 = "有裂缝的凤凰蛋(4级)"
STRINGS.NAMES.MUSHA_EGG1 = "凤凰蛋(5级)"
STRINGS.NAMES.MUSHA_EGG_CRACKED1 = "有裂缝的凤凰蛋(5级)"
STRINGS.NAMES.MUSHA_EGG2 = "凤凰蛋(6级)"
STRINGS.NAMES.MUSHA_EGG_CRACKED2 = "有裂缝的凤凰蛋(6级)"
STRINGS.NAMES.MUSHA_EGG3 = "凤凰蛋(7级)"
STRINGS.NAMES.MUSHA_EGG_CRACKED3 = "有裂缝的凤凰蛋(7级)"
STRINGS.NAMES.MUSHA_EGG8 = "凤凰蛋(8级)"
STRINGS.NAMES.MUSHA_EGG_CRACKED8 = "有裂缝的凤凰蛋(8级)"
STRINGS.NAMES.MUSHA_EGG = "凤凰蛋"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_EGG = "凤凰蛋"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_EGGS1 = "凤凰蛋(2级)"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_EGGS2 = "凤凰蛋(3级)"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_EGGS3 = "凤凰蛋(4级)"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_EGG1 = "凤凰蛋(5级)"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_EGG2 = "凤凰蛋(6级)"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_EGG3 = "凤凰蛋(7级)"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_EGG8 = "凤凰蛋(8级)"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_EGG_CRACKED = "这不是矿石. 暮莎说这是Yamche的萌芽."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_EGG_CRACKEDS1 = "这不是矿石. 暮莎说这是Yamche的萌芽."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_EGG_CRACKEDS2 = "这不是矿石. 暮莎说这是Yamche的萌芽."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_EGG_CRACKEDS3 = "这不是矿石. 暮莎说这是Yamche的萌芽."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_EGG_CRACKED1 = "这不是矿石. 暮莎说这是Yamche的萌芽."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_EGG_CRACKED2 = "这不是矿石. 暮莎说这是Yamche的萌芽."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_EGG_CRACKED3 = "这不是矿石. 暮莎说这是Yamche的萌芽."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_EGG_CRACKED8 = "这不是矿石. 暮莎说这是Yamche的萌芽."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_SMALL = "多么可爱的小鸟!"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TEEN = "它... 是... Yamche. Yamche 长的真快."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TEENR1 = "它... 是... Yamche. Yamche 长的真快."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TEENR2 = "它... 是... Yamche. Yamche 长的真快."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TEENR3 = "它... 是... Yamche. Yamche 长的真快."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TEENR4 = "它... 是... Yamche. Yamche 长的真快."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TEENICE = "它... 是... Yamche. Yamche 长的真快."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALL = "Yamche什么都吃. 这很不错."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLR1 = "Yamche什么都吃. 这很不错."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLR2 = "Yamche什么都吃. 这很不错."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLR3 = "Yamche什么都吃. 这很不错."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLR4 = "Yamche什么都吃. 这很不错."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRICE = "Yamche什么都吃. 这很不错."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALL2 = "它是只多么有用的鸟!"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRR1 = "它是只多么有用的鸟!"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRR2 = "它是只多么有用的鸟!"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRR3 = "它是只多么有用的鸟!"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRR4 = "它是只多么有用的鸟!"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRR5 = "它是只多么有用的鸟!"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRRICE = "它是只多么有用的鸟!"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALL3 = "Yamche 不只是一只鸟. 它也是我的朋友."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRRR1 = "Yamche 不只是一只鸟. 它也是我的朋友."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRRR2 = "Yamche 不只是一只鸟. 它也是我的朋友."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRRR3 = "Yamche 不只是一只鸟. 它也是我的朋友."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRRR4 = "Yamche 不只是一只鸟. 它也是我的朋友."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRRR5 = "Yamche 不只是一只鸟. 它也是我的朋友."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRRRICE = "Yamche 不只是一只鸟. 它也是我的朋友."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALL4 = "是的. 我同意. 我们是家人."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRRRR1 = "是的. 我同意. 我们是家人."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRRRR2 = "是的. 我同意. 我们是家人."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRRRR3 = "是的. 我同意. 我们是家人."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRRRR4 = "是的. 我同意. 我们是家人."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRRRR5 = "是的. 我同意. 我们是家人."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRRRR6 = "是的. 我同意. 我们是家人."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRRRRICE = "是的. 我同意. 我们是家人."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALL5 = "能和你一起旅行. 这太棒了."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRRRRR1 = "能和你一起旅行. 这太棒了."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRRRRR2 = "能和你一起旅行. 这太棒了."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRRRRR3 = "能和你一起旅行. 这太棒了."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRRRRR4 = "能和你一起旅行. 这太棒了."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRRRRR5 = "能和你一起旅行. 这太棒了."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRRRRR6 = "能和你一起旅行. 这太棒了."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_TALLRRRRRICE = "能和你一起旅行. 这太棒了."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_RP1 = "你是我在饥荒中的伙伴."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_RP2 = "你是我在饥荒中的伙伴."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_RP3 = "你是我在饥荒中的伙伴."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_RP4 = "你是我在饥荒中的伙伴."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_RP5 = "你是我在饥荒中的伙伴."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_RP6 = "你是我在饥荒中的伙伴."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_RP7 = "你是我在饥荒中的伙伴."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHA_RPICE = "你是我在饥荒中的伙伴."
STRINGS.NAMES.GHOSTHOUND = "幽灵猎犬"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.GHOSTHOUND = "暮莎召唤了猎犬."
STRINGS.NAMES.GHOSTHOUND2 = "幽灵小狗"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.GHOSTHOUND2 = "暮莎召唤了猎犬."
STRINGS.NAMES.SHADOWMUSHA = "暮莎的影子"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.SHADOWMUSHA = "这影子看起来像是暮莎."
STRINGS.NAMES.TENTACLE_FROST = "冰冻触手"
STRINGS.RECIPE_DESC.MUSHA_EGG = "凤凰蛋 (按键'Z')"
STRINGS.RECIPE_DESC.MUSHA_EGGS1 = "凤凰蛋 (2级)"
STRINGS.RECIPE_DESC.MUSHA_EGGS2 = "凤凰蛋 (3级)"
STRINGS.RECIPE_DESC.MUSHA_EGGS3 = "凤凰蛋 (4级)"
STRINGS.RECIPE_DESC.MUSHA_EGG1 = "凤凰蛋 (5级)"
STRINGS.RECIPE_DESC.MUSHA_EGG2 = "凤凰蛋 (6级)"
STRINGS.RECIPE_DESC.MUSHA_EGG3 = "凤凰蛋 (7级)"
STRINGS.RECIPE_DESC.MUSHA_EGG8 = "凤凰蛋 (满级)"
STRINGS.RECIPE_DESC.REDGEM = "宝石炼金 (蓝->红)"
STRINGS.RECIPE_DESC.BLUEGEM = "宝石炼金 (红->蓝)" 
STRINGS.RECIPE_DESC.NITRE = "金块炼金 (金块->硝石)" 
STRINGS.NAMES.NITRE = "硝石"
STRINGS.NAMES.REDGEM = "红宝石"
STRINGS.NAMES.REDGEM2 = "红宝石"
STRINGS.NAMES.BLUEGEM = "蓝宝石" 
STRINGS.NAMES.BLUEGEM2 = "蓝宝石" 
STRINGS.NAMES.MUSHASWORD_BASE = "残破的剑"
STRINGS.NAMES.MUSHASWORD = "凤凰剑"
STRINGS.NAMES.MUSHASWORD_FROST = "冰霜凤凰剑"
STRINGS.RECIPE_DESC.MUSHASWORD_BASE = "残破的凤凰剑, 改变样子"
STRINGS.RECIPE_DESC.MUSHASWORD = "可成长的武器, 改变样子"

STRINGS.RECIPE_DESC.MUSHASWORD_FROST = "可成长的武器, 改变样子"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHASWORD_BASE = "它是可以用材料修复的剑."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHASWORD = "它是可以用材料修复的火焰剑."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.MUSHASWORD_FROST = "它是可以用材料修复的冰霜剑."
STRINGS.NAMES.MUSHA_FLUTE = "暮莎短笛"
STRINGS.RECIPE_DESC.MUSHA_FLUTE = "治愈之光-治愈附近队友.维修-光之尘埃;会发光."
STRINGS.NAMES.GLOWDUST = "光之尘埃"
STRINGS.RECIPE_DESC.GLOWDUST = "闪闪发光的粉末"
STRINGS.NAMES.CRISTAL = "水晶糖果"
STRINGS.RECIPE_DESC.CRISTAL = "召唤 => 荧光花, Yamche => 蛋"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.CRISTAL = "看上去不是普通的结晶."
STRINGS.NAMES.EXP = "能量精华"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.EXP = "它给玩家少量经验."
STRINGS.NAMES.EXP1000CHEAT = "作弊精华"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.EXP1000CHEAT = "它给玩家一吨经验."
STRINGS.RECIPE_DESC.EXP = "能量精化, 能修复暮莎的装备."
STRINGS.RECIPE_DESC.EXP10 = "增加经验10"
STRINGS.RECIPE_DESC.EXP50 = "增加经验50"
STRINGS.RECIPE_DESC.EXP100 = "增加经验100"
STRINGS.NAMES.FROSTHAMMER = "冰霜之锤"
STRINGS.RECIPE_DESC.FROSTHAMMER = "可成长, 可修复, 锤子, 冰箱"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.FROSTHAMMER = "很重的蓝色锤子."
STRINGS.NAMES.BROKEN_FROSTHAMMER = "冰霜战甲"
STRINGS.RECIPE_DESC.BROKEN_FROSTHAMMER = "可成长, 可修复, 冰箱, 改变外形"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.BROKEN_FROSTHAMMER =  "它有多种功能."
STRINGS.NAMES.HAT_MPHOENIX = "凤凰头盔"
STRINGS.RECIPE_DESC.HAT_MPHOENIX = "可成长, 可拆卸的面罩(右键)"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.HAT_MPHOENIX = "一个中世纪头盔."
STRINGS.NAMES.HAT_MPRINCESS = "精灵公主的皇冠"
STRINGS.RECIPE_DESC.HAT_MPRINCESS = "防 护, 益 智, 改变外形"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.HAT_MPRINCESS = "一个金色的小皇冠."
STRINGS.NAMES.HAT_MCROWN = "精灵女王的皇冠"
STRINGS.RECIPE_DESC.HAT_MCROWN = "防 护, 益 智, 特殊功能"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.HAT_MCROWN = "看起来多漂亮."
STRINGS.NAMES.HAT_MBUNNY = "兔子侦查帽"
STRINGS.RECIPE_DESC.HAT_MBUNNY = "可成长, 可拆卸的护目镜(右键)"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.HAT_MBUNNY = "看起来像一个兔耳朵."
STRINGS.NAMES.ARMOR_MUSHAA = "暮莎的盔甲"
STRINGS.RECIPE_DESC.ARMOR_MUSHAA = "可成长的盔甲, 背包"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.ARMOR_MUSHAA = "它是个很大的连衣裙."
STRINGS.NAMES.ARMOR_MUSHAB = "公主的盔甲"
STRINGS.RECIPE_DESC.ARMOR_MUSHAB = "可成长的盔甲, 背包"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.ARMOR_MUSHAB = "它很大, 也很安全." 
---------------
STRINGS.PHOENIXS=
{    --random
"Captain Yamche","Hulk Yamche","Iron Yamche","Torr Yamche","Yamche","Brave Yamche","Cutie Yamche","Owl Yamche","Sunny Yamche","Moon Yamche","Seoul Yamche","Suri Yamche","Vilja Yamche","Sunny Yamche","Sunnyholic","Musha Yamche","Mellisa Yamche","Lidia Yamche ","Battleborn Yamche ","Grey Yamche","Sky Yamche","Lucia Yamche","Khajit Yamche","Pig Yamche","Mjoll Yamche","Lioness Yamche","Muiri Yamche","Ysolda Yamche","Rayya Yamche","Falkas Yamche","Vilkas Yamche","Aela Yamche","Huter Yamche","Huntress Yamche","Queen Yamche","Fire Yamche","Cicero Yamche","Top Yamche","Lina Yamche","Totoro Yamche","Yu-na Yamche","Winter Yamche","White Yamche","Mellisa Yamche","Riften Yamche","Dawnstar Yamche","Windhelm Yamche","Pho Yamche","Sneaky Yamche","Kiwis Yamche","Coco Yamche","Moon Yamche","Pizza Yamche","Sugar Yamche","Orc Yamche","Elf Yamche","Knight Yamche","Lich Yamche","Azeroth Yamche","Tauren Yamche","Troll Yamche","Thrall Yamche","Narugar Yamche","Yancook Yamche","Tirano Yamche","Honey Yamche","Isis Yamche","Bosom Yamche","Esmeralda Yamche","Pluvia Yamche","Doraemon Yamche","Dooly Yamche","Apple Yamche","IU Yamche","Gandalf Yamche","Frodo Yamche","Sam Yamche","Regolas Yamche","Gimli Yamche","Boromir Yamche","Wilxon Yamche","Willo Yamche","Wolfkong Yamche","Wenil Yamche","WX79 Yamche","Wickerbi Yamche","Woorie Yamche","Wex Yamche","Maximus Yamche","Wigfreedom Yamche","Webbers Yamche","Naruto Yamche","Sasuke Yamche","Withcer",
 }
-----------------------------difficulty test
--
function giants_1x(inst)
  inst:AddTag("giant1x")
end
function deerclops_2x(inst)
    inst.components.health:SetMaxHealth(TUNING.DEERCLOPS_HEALTH*2)
    inst.components.combat:SetDefaultDamage(TUNING.DEERCLOPS_DAMAGE*2)
    inst.components.combat:SetAttackPeriod(2.75)
  inst:AddTag("giant2x")
end
function bearger_2x(inst)
    inst.components.health:SetMaxHealth(TUNING.BEARGER_HEALTH*2)
    inst.components.combat:SetDefaultDamage(TUNING.DEERCLOPS_DAMAGE*2)
    inst.components.combat:SetAttackPeriod(2.75)
  inst:AddTag("giant2x")
end
function dragonfly_2x(inst)
    inst.components.health:SetMaxHealth(TUNING.DRAGONFLY_HEALTH*2)
    inst.components.combat:SetDefaultDamage(TUNING.DEERCLOPS_DAMAGE*2)
    inst.components.combat:SetAttackPeriod(2.25)
  inst:AddTag("giant2x")
end
function moose_2x(inst)
    inst.components.health:SetMaxHealth(TUNING.MOOSE_HEALTH*2)
    inst.components.combat:SetDefaultDamage(TUNING.DEERCLOPS_DAMAGE*2)
    inst.components.combat:SetAttackPeriod(2.75)
  inst:AddTag("giant2x")
end
function mossling_2x(inst)
    inst.components.health:SetMaxHealth(TUNING.MOSSLING_HEALTH*2)
    inst.components.combat:SetDefaultDamage(TUNING.DEERCLOPS_DAMAGE*1.5)
  inst:AddTag("small_giant2x")
end
function deerclops_3x(inst)
    inst.components.health:SetMaxHealth(TUNING.DEERCLOPS_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.DEERCLOPS_DAMAGE*2.5)
    inst.components.combat:SetAttackPeriod(2.6)
  inst:AddTag("giant3x")
end
function bearger_3x(inst)
    inst.components.health:SetMaxHealth(TUNING.BEARGER_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.BEARGER_DAMAGE*2.5)
    inst.components.combat:SetRange(TUNING.BEARGER_ATTACK_RANGE, TUNING.BEARGER_MELEE_RANGE)
    inst.components.combat:SetAttackPeriod(2.6)
  inst:AddTag("giant3x")
end
function dragonfly_3x(inst)
    inst.components.health:SetMaxHealth(TUNING.DRAGONFLY_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.DRAGONFLY_DAMAGE*2.5)
    inst.components.combat:SetAttackPeriod(2.1)
  inst:AddTag("giant3x")
end
function moose_3x(inst)
    inst.components.health:SetMaxHealth(TUNING.MOOSE_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.MOOSE_DAMAGE*2.5)
    inst.components.combat:SetAttackPeriod(2.6)
   inst:AddTag("giant3x")
end
function mossling_3x(inst)
    inst.components.health:SetMaxHealth(TUNING.MOSSLING_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.MOSSLING_DAMAGE*2.5)
   inst:AddTag("small_giant3x")
end
function deerclops_4x(inst)
    inst.components.health:SetMaxHealth(TUNING.DEERCLOPS_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.DEERCLOPS_DAMAGE*3)
 --   inst.components.combat:SetAreaDamage(TUNING.DEERCLOPS_AOE_RANGE, TUNING.DEERCLOPS_AOE_SCALE)
    inst.components.combat:SetAttackPeriod(2.3)
   inst:AddTag("giant4x")
end
function bearger_4x(inst)
    inst.components.health:SetMaxHealth(TUNING.BEARGER_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.BEARGER_DAMAGE*3)
    inst.components.combat:SetRange(TUNING.BEARGER_ATTACK_RANGE, TUNING.BEARGER_MELEE_RANGE)
 --   inst.components.combat:SetAreaDamage(6, 0.8)
    inst.components.combat:SetAttackPeriod(2.3)
   inst:AddTag("giant4x")
end
function dragonfly_4x(inst)
    inst.components.health:SetMaxHealth(TUNING.DRAGONFLY_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.DRAGONFLY_DAMAGE*3)
   -- inst.components.combat:SetAreaDamage(6, 0.8)
    inst.components.combat:SetAttackPeriod(1.8)
   inst:AddTag("giant4x")
end
function moose_4x(inst)
    inst.components.health:SetMaxHealth(TUNING.MOOSE_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.MOOSE_DAMAGE*3)
    inst.components.combat:SetAttackPeriod(2.3)
    inst:AddTag("giant4x")
end
function mossling_4x(inst)
    inst.components.health:SetMaxHealth(TUNING.MOSSLING_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.MOSSLING_DAMAGE*3)
    inst:AddTag("small_giant4x")
end

------------
function nspider_1x(inst)
    inst:AddTag("monster1x")
end
function nspider_2x(inst)
    inst.components.health:SetMaxHealth(TUNING.SPIDER_HEALTH*2)
    inst:AddTag("monster2x")
end
function wspider_2x(inst)
    inst.components.health:SetMaxHealth(TUNING.SPIDER_WARRIOR_HEALTH*2)
    inst:AddTag("monster2x")
end
function qspider_2x(inst)
    inst.components.health:SetMaxHealth(TUNING.SPIDERQUEEN_HEALTH*2)
    inst:AddTag("small_giant2x")
end
function chspider_2x(inst)
    inst.components.health:SetMaxHealth(TUNING.SPIDER_HIDER_HEALTH*2)
    inst:AddTag("monster2x")
end
function csspider_2x(inst)
    inst.components.health:SetMaxHealth(TUNING.SPIDER_SPITTER_HEALTH*2)
    inst:AddTag("monster2x")
end
function cdspider_2x(inst)
    inst.components.health:SetMaxHealth(TUNING.SPIDER_WARRIOR_HEALTH*2)
     inst:AddTag("monster2x")
end
function nspider_3x(inst)
    inst.components.health:SetMaxHealth(TUNING.SPIDER_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.SPIDER_DAMAGE*1.5)
    inst.components.combat:SetAttackPeriod(2.75)
     inst:AddTag("monster3x")
end
function wspider_3x(inst)
    inst.components.health:SetMaxHealth(TUNING.SPIDER_WARRIOR_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.SPIDER_WARRIOR_DAMAGE*1.5)
    inst.components.combat:SetAttackPeriod(3.75 + math.random()*2)
     inst:AddTag("monster3x")
end
function qspider_3x(inst)
    inst.components.health:SetMaxHealth(TUNING.SPIDERQUEEN_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.SPIDERQUEEN_DAMAGE*1.5)
    inst.components.combat:SetAttackPeriod(2.75)
     inst:AddTag("small_giant3x")
end
function chspider_3x(inst)
    inst.components.health:SetMaxHealth(TUNING.SPIDER_HIDER_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.SPIDER_HIDER_DAMAGE*1.5)
    inst.components.combat:SetAttackPeriod(2.75)
     inst:AddTag("monster3x")
end
function csspider_3x(inst)
    inst.components.health:SetMaxHealth(TUNING.SPIDER_SPITTER_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.SPIDER_SPITTER_DAMAGE_MELEE*1.5)
    inst.components.combat:SetAttackPeriod(4.75 + math.random()*2)
     inst:AddTag("monster3x")
end
function cdspider_3x(inst)
    inst.components.health:SetMaxHealth(TUNING.SPIDER_WARRIOR_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.SPIDER_WARRIOR_DAMAGE*1.5)
    inst.components.combat:SetAttackPeriod(2.75 + math.random()*2)
     inst:AddTag("monster3x")
end
function nspider_4x(inst)
    inst.components.health:SetMaxHealth(TUNING.SPIDER_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.SPIDER_DAMAGE*2)
    inst.components.combat:SetAttackPeriod(2.5)
     inst:AddTag("monster4x")
end
function wspider_4x(inst)
    inst.components.health:SetMaxHealth(TUNING.SPIDER_WARRIOR_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.SPIDER_WARRIOR_DAMAGE*2)
    inst.components.combat:SetAttackPeriod(3.5 + math.random()*2)
     inst:AddTag("monster4x")
end
function qspider_4x(inst)
    inst.components.health:SetMaxHealth(TUNING.SPIDERQUEEN_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.SPIDERQUEEN_DAMAGE*2)
    inst.components.combat:SetAttackPeriod(2.5)
     inst:AddTag("small_giant4x")
end
function chspider_4x(inst)
    inst.components.health:SetMaxHealth(TUNING.SPIDER_HIDER_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.SPIDER_HIDER_DAMAGE*2)
    inst.components.combat:SetAttackPeriod(2.5)
     inst:AddTag("monster4x")
end
function csspider_4x(inst)
    inst.components.health:SetMaxHealth(TUNING.SPIDER_SPITTER_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.SPIDER_SPITTER_DAMAGE_MELEE*2)
    inst.components.combat:SetAttackPeriod(4.5 + math.random()*2)
        inst:AddTag("monster4x")
end
function cdspider_4x(inst)
    inst.components.health:SetMaxHealth(TUNING.SPIDER_WARRIOR_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.SPIDER_WARRIOR_DAMAGE*2)
    inst.components.combat:SetAttackPeriod(3.5 + math.random()*2)
        inst:AddTag("monster4x")
end
------
function hound_1x(inst)
        inst:AddTag("monster1x")
end
function nhound_2x(inst)
    inst.components.health:SetMaxHealth(TUNING.HOUND_HEALTH*2)
        inst:AddTag("monster2x")
end
function fhound_2x(inst)
    inst.components.health:SetMaxHealth(TUNING.FIREHOUND_HEALTH*2)
        inst:AddTag("monster2x")
end
function ihound_2x(inst)
    inst.components.health:SetMaxHealth(TUNING.ICEHOUND_HEALTH*2)
        inst:AddTag("monster2x")
end
function warg_2x(inst)
    inst.components.health:SetMaxHealth(TUNING.WARG_HEALTH*2)
        inst:AddTag("small_giant2x")
end

function nhound_3x(inst)
    inst.components.health:SetMaxHealth(TUNING.HOUND_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.HOUND_DAMAGE*1.5)
    inst.components.combat:SetAttackPeriod(1.75)
        inst:AddTag("monster3x")
end
function fhound_3x(inst)
    inst.components.health:SetMaxHealth(TUNING.FIREHOUND_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.FIREHOUND_DAMAGE*1.5)
    inst.components.combat:SetAttackPeriod(1.75)
        inst:AddTag("monster3x")
end
function ihound_3x(inst)
    inst.components.health:SetMaxHealth(TUNING.ICEHOUND_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.ICEHOUND_DAMAGE*1.5)
    inst.components.combat:SetAttackPeriod(1.75)
        inst:AddTag("monster3x")
end
function warg_3x(inst)
    inst.components.health:SetMaxHealth(TUNING.WARG_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.WARG_DAMAGE*1.5)
    inst.components.combat:SetAttackPeriod(2.75)
        inst:AddTag("small_giant3x")
end

function nhound_4x(inst)
    inst.components.health:SetMaxHealth(TUNING.HOUND_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.HOUND_DAMAGE*2)
    inst.components.combat:SetAttackPeriod(1.5)
        inst:AddTag("monster4x")
end
function fhound_4x(inst)
    inst.components.health:SetMaxHealth(TUNING.FIREHOUND_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.FIREHOUND_DAMAGE*2)
    inst.components.combat:SetAttackPeriod(1.5)
        inst:AddTag("monster4x")
end
function ihound_4x(inst)
    inst.components.health:SetMaxHealth(TUNING.ICEHOUND_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.ICEHOUND_DAMAGE*2)
    inst.components.combat:SetAttackPeriod(1.5)
        inst:AddTag("monster4x")
end
function warg_4x(inst)
    inst.components.health:SetMaxHealth(TUNING.WARG_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.WARG_DAMAGE*2)
    inst.components.combat:SetAttackPeriod(2.5)
        inst:AddTag("small_giant4x")
end
function tentacle_1x(inst)
        inst:AddTag("monster1x")
end
function tentacle_2x(inst)
    inst.components.health:SetMaxHealth(TUNING.TENTACLE_HEALTH*2)
    inst.components.combat:SetDefaultDamage(TUNING.TENTACLE_DAMAGE*1.5)
        inst:AddTag("monster2x")
end
function tentacle_3x(inst)
    inst.components.health:SetMaxHealth(TUNING.TENTACLE_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.TENTACLE_DAMAGE*2)
        inst:AddTag("monster3x")
end
function tentacle_4x(inst)
    inst.components.health:SetMaxHealth(TUNING.TENTACLE_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.TENTACLE_DAMAGE*2.5)
        inst:AddTag("monster4x")
end
function rook_1x(inst)
        inst:AddTag("monster1x")
end
function rook_2x(inst)
    inst.components.health:SetMaxHealth(TUNING.ROOK_HEALTH*2)
    inst.components.combat:SetDefaultDamage(TUNING.ROOK_DAMAGE*1.5)
        inst:AddTag("monster2x")
end
function rook_3x(inst)
    inst.components.health:SetMaxHealth(TUNING.ROOK_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.ROOK_DAMAGE*2)
        inst:AddTag("monster3x")
end
function rook_4x(inst)
    inst.components.health:SetMaxHealth(TUNING.ROOK_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.ROOK_DAMAGE*3)
        inst:AddTag("monster4x")
end
function minotaur_1x(inst)
        inst:AddTag("monster1x")
end
function minotaur_2x(inst)
    inst.components.health:SetMaxHealth(TUNING.MINOTAUR_HEALTH*2)
    inst.components.combat:SetDefaultDamage(TUNING.MINOTAUR_DAMAGE*1.5)
        inst:AddTag("monster2x")
end
function minotaur_3x(inst)
    inst.components.health:SetMaxHealth(TUNING.MINOTAUR_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.MINOTAUR_DAMAGE*2)
        inst:AddTag("monster3x")
end
function minotaur_4x(inst)
    inst.components.health:SetMaxHealth(TUNING.MINOTAUR_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.MINOTAUR_DAMAGE*2.5)
        inst:AddTag("monster4x")
end
function bishop_1x(inst)
        inst:AddTag("monster1x")
end
function bishop_2x(inst)
    inst.components.health:SetMaxHealth(TUNING.BISHOP_HEALTH*2)
    inst.components.combat:SetDefaultDamage(TUNING.BISHOP_DAMAGE*1.2)
        inst:AddTag("monster2x")
end
function bishop_3x(inst)
    inst.components.health:SetMaxHealth(TUNING.BISHOP_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.BISHOP_DAMAGE*1.6)
        inst:AddTag("monster3x")
end
function bishop_4x(inst)
    inst.components.health:SetMaxHealth(TUNING.BISHOP_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.BISHOP_DAMAGE*2)
        inst:AddTag("monster4x")
end
function tallbird_1x(inst)
        inst:AddTag("monster1x")
end
function tallbird_2x(inst)
    inst.components.health:SetMaxHealth(TUNING.TALLBIRD_HEALTH*2)
        inst:AddTag("monster2x")
end
function tallbird_3x(inst)
    inst.components.health:SetMaxHealth(TUNING.TALLBIRD_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.TALLBIRD_DAMAGE*1.5)
    inst.components.combat:SetAttackPeriod(1.75)
        inst:AddTag("monster3x")
end
function tallbird_4x(inst)
    inst.components.health:SetMaxHealth(TUNING.TALLBIRD_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.TALLBIRD_DAMAGE*2)
    inst.components.combat:SetAttackPeriod(1.5)
        inst:AddTag("monster4x")
end
function leif_1x(inst)
        inst:AddTag("small_giant1x")
    
end
function leif_2x(inst)
        inst:AddTag("small_giant2x")
    inst.components.health:SetMaxHealth(TUNING.LEIF_HEALTH*2)
end
function leif_3x(inst)
        inst:AddTag("small_giant3x")
    inst.components.health:SetMaxHealth(TUNING.LEIF_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.LEIF_DAMAGE*1.5)
end
function leif_4x(inst)
        inst:AddTag("small_giant4x")
    inst.components.health:SetMaxHealth(TUNING.LEIF_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.LEIF_DAMAGE*2)
end
function birchnutdrake_1x(inst)
        inst:AddTag("monster1x")
end
function birchnutdrake_2x(inst)
        inst:AddTag("monster2x")
    inst.components.health:SetMaxHealth(100)
end
function birchnutdrake_3x(inst)
        inst:AddTag("monster3x")
    inst.components.health:SetMaxHealth(150)
    inst.components.combat:SetDefaultDamage(10)
end
function birchnutdrake_4x(inst)
        inst:AddTag("monster4x")
    inst.components.health:SetMaxHealth(200)
    inst.components.combat:SetDefaultDamage(15)
end
function merm_1x(inst)
        inst:AddTag("monster1x")
   
end
function merm_2x(inst)
        inst:AddTag("monster2x")
    inst.components.health:SetMaxHealth(TUNING.MERM_HEALTH*4)
end
function merm_3x(inst)
        inst:AddTag("monster3x")
    inst.components.health:SetMaxHealth(TUNING.MERM_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.MERM_DAMAGE*1.5)
end
function merm_4x(inst)
        inst:AddTag("monster4x")
    inst.components.health:SetMaxHealth(TUNING.MERM_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.MERM_DAMAGE*2)
end
function bat_1x(inst)
        inst:AddTag("monster1x")
    
end
function bat_2x(inst)
        inst:AddTag("monster2x")
    inst.components.health:SetMaxHealth(TUNING.BAT_HEALTH*2)
end
function bat_3x(inst)
        inst:AddTag("monster3x")
    inst.components.health:SetMaxHealth(TUNING.BAT_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.BAT_DAMAGE*1.5)
end
function bat_4x(inst)
        inst:AddTag("monster4x")
    inst.components.health:SetMaxHealth(TUNING.BAT_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.BAT_DAMAGE*2)
end
function monkey_1x(inst)
        inst:AddTag("monster1x")
    
end
function monkey_2x(inst)
        inst:AddTag("monster2x")
    inst.components.health:SetMaxHealth(TUNING.MONKEY_HEALTH*2)
end
function monkey_3x(inst)
        inst:AddTag("monster3x")
    inst.components.health:SetMaxHealth(TUNING.MONKEY_HEALTH*4)
end
function monkey_4x(inst)
        inst:AddTag("monster4x")
    inst.components.health:SetMaxHealth(TUNING.MONKEY_HEALTH*6)
end
function walus_1x(inst)
        inst:AddTag("monster1x")
    
end
function walus_2x(inst)
        inst:AddTag("monster2x")
    inst.components.health:SetMaxHealth(TUNING.WALRUS_HEALTH*2)
end
function walus_3x(inst)
        inst:AddTag("monster3x")
    inst.components.health:SetMaxHealth(TUNING.WALRUS_HEALTH*4)
    inst.components.locomotor.runspeed = 6
    inst.components.locomotor.walkspeed = 2
end
function walus_4x(inst)
        inst:AddTag("monster4x")
    inst.components.health:SetMaxHealth(TUNING.WALRUS_HEALTH*6)
    inst.components.locomotor.runspeed = 8
    inst.components.locomotor.walkspeed = 2
end
function eyeplant_1x(inst)
end
function eyeplant_2x(inst)
        inst:AddTag("monster1x")
    inst.components.health:SetMaxHealth(TUNING.EYEPLANT_HEALTH*2)
end
function eyeplant_3x(inst)
        inst:AddTag("monster1x")
    inst.components.health:SetMaxHealth(TUNING.EYEPLANT_HEALTH*4)
    inst.components.combat:SetDefaultDamage(TUNING.EYEPLANT_DAMAGE*1.5)
end
function eyeplant_4x(inst)
        inst:AddTag("monster2x")
    inst.components.health:SetMaxHealth(TUNING.EYEPLANT_HEALTH*6)
    inst.components.combat:SetDefaultDamage(TUNING.EYEPLANT_DAMAGE*2)
end


-------difficult option
if Difficult == "monster1x" then
AddPrefabPostInit("deerclops", giants_1x)
AddPrefabPostInit("bearger", giants_1x)
AddPrefabPostInit("dragonfly", giants_1x)
AddPrefabPostInit("moose", giants_1x)
AddPrefabPostInit("mossling", giants_1x)
AddPrefabPostInit("spider", nspider_1x)
AddPrefabPostInit("spider_warrior", spider_1x)
AddPrefabPostInit("spiderqueen", spider_1x)
AddPrefabPostInit("spider_hider", spider_1x)
AddPrefabPostInit("spider_spitter", spider_1x)
AddPrefabPostInit("spider_dropper", spider_1x)
AddPrefabPostInit("hound", hound_1x)
AddPrefabPostInit("firehound", hound_1x)
AddPrefabPostInit("icehound", hound_1x)
AddPrefabPostInit("warg", hound_1x)
AddPrefabPostInit("tentacle", tentacle_1x)
AddPrefabPostInit("rook", rook_1x)
AddPrefabPostInit("minotaur", minotaur_1x)
AddPrefabPostInit("bishop", bishop_1x)
AddPrefabPostInit("tallbird", tallbird_1x)
AddPrefabPostInit("leif", leif_1x)
AddPrefabPostInit("merm", merm_1x)
AddPrefabPostInit("birchnutdrake", birchnutdrake_1x)
AddPrefabPostInit("bat", bat_1x)
AddPrefabPostInit("walus", walus_1x)
AddPrefabPostInit("monkey", monkey_1x)
AddPrefabPostInit("eyeplant", eyeplant_1x)
end
if Difficult == "monster2x" then
AddPrefabPostInit("deerclops", deerclops_2x)
AddPrefabPostInit("bearger", bearger_2x)
AddPrefabPostInit("dragonfly", dragonfly_2x)
AddPrefabPostInit("moose", moose_2x)
AddPrefabPostInit("mossling", mossling_2x)
AddPrefabPostInit("spider", nspider_2x)
AddPrefabPostInit("spider_warrior", wspider_2x)
AddPrefabPostInit("spiderqueen", qspider_2x)
AddPrefabPostInit("spider_hider", chspider_2x)
AddPrefabPostInit("spider_spitter", csspider_2x)
AddPrefabPostInit("spider_dropper", cdspider_2x)
AddPrefabPostInit("hound", nhound_2x)
AddPrefabPostInit("firehound", fhound_2x)
AddPrefabPostInit("icehound", ihound_2x)
AddPrefabPostInit("warg", warg_2x)
AddPrefabPostInit("tentacle", tentacle_2x)
AddPrefabPostInit("rook", rook_2x)
AddPrefabPostInit("minotaur", minotaur_2x)
AddPrefabPostInit("bishop", bishop_2x)
AddPrefabPostInit("tallbird", tallbird_2x)
AddPrefabPostInit("leif", leif_2x)
AddPrefabPostInit("merm", merm_2x)
AddPrefabPostInit("birchnutdrake", birchnutdrake_2x)
AddPrefabPostInit("bat", bat_2x)
AddPrefabPostInit("walus", walus_2x)
AddPrefabPostInit("monkey", monkey_2x)
AddPrefabPostInit("eyeplant", eyeplant_2x)
end
if Difficult == "monster3x" then
AddPrefabPostInit("deerclops", deerclops_3x)
AddPrefabPostInit("bearger", bearger_3x)
AddPrefabPostInit("dragonfly", dragonfly_3x)
AddPrefabPostInit("moose", moose_3x)
AddPrefabPostInit("mossling", mossling_3x)
AddPrefabPostInit("spider", nspider_3x)
AddPrefabPostInit("spider_warrior", wspider_3x)
AddPrefabPostInit("spiderqueen", qspider_3x)
AddPrefabPostInit("spider_hider", chspider_3x)
AddPrefabPostInit("spider_spitter", csspider_3x)
AddPrefabPostInit("spider_dropper", cdspider_3x)
AddPrefabPostInit("hound", nhound_3x)
AddPrefabPostInit("firehound", fhound_3x)
AddPrefabPostInit("icehound", ihound_3x)
AddPrefabPostInit("warg", warg_3x)
AddPrefabPostInit("tentacle", tentacle_3x)
AddPrefabPostInit("rook", rook_3x)
AddPrefabPostInit("minotaur", minotaur_3x)
AddPrefabPostInit("bishop", bishop_3x)
AddPrefabPostInit("tallbird", tallbird_3x)
AddPrefabPostInit("leif", leif_3x)
AddPrefabPostInit("merm", merm_3x)
AddPrefabPostInit("birchnutdrake", birchnutdrake_3x)
AddPrefabPostInit("bat", bat_3x)
AddPrefabPostInit("walus", walus_3x)
AddPrefabPostInit("monkey", monkey_3x)
AddPrefabPostInit("eyeplant", eyeplant_3x)
end
if Difficult == "monster4x" then
AddPrefabPostInit("deerclops", deerclops_4x)
AddPrefabPostInit("bearger", bearger_4x)
AddPrefabPostInit("dragonfly", dragonfly_4x)
AddPrefabPostInit("moose", moose_4x)
AddPrefabPostInit("mossling", mossling_4x)
AddPrefabPostInit("spider", nspider_4x)
AddPrefabPostInit("spider_warrior", wspider_4x)
AddPrefabPostInit("spiderqueen", qspider_4x)
AddPrefabPostInit("spider_hider", chspider_4x)
AddPrefabPostInit("spider_spitter", csspider_4x)
AddPrefabPostInit("spider_dropper", cdspider_4x)
AddPrefabPostInit("hound", nhound_4x)
AddPrefabPostInit("firehound", fhound_4x)
AddPrefabPostInit("icehound", ihound_4x)
AddPrefabPostInit("warg", warg_4x)
AddPrefabPostInit("tentacle", tentacle_4x)
AddPrefabPostInit("rook", rook_4x)
AddPrefabPostInit("minotaur", minotaur_4x)
AddPrefabPostInit("bishop", bishop_4x)
AddPrefabPostInit("tallbird", tallbird_4x)
AddPrefabPostInit("leif", leif_4x)
AddPrefabPostInit("merm", merm_4x)
AddPrefabPostInit("birchnutdrake", birchnutdrake_4x)
AddPrefabPostInit("bat", bat_4x)
AddPrefabPostInit("walus", walus_4x)
AddPrefabPostInit("monkey", monkey_4x)
AddPrefabPostInit("eyeplant", eyeplant_4x)
end

-------
 
 
AddModCharacter("musha","FEMALE")
--table.insert(GLOBAL.CHARACTER_GENDERS.FEMALE, "musha")
