function E0090()
    InitRoom()FAI(0)
end
function E0091()
    InitRoom()FAI(1)
end
function E0092()
    InitRoom()FAI(2)
end
function E0093()
    InitRoom()FAI(3)
end
function E0094()
    InitRoom()FAI(4)
end

function InitRoom()
    MNA()
    if(FLJ("KingBack")) then
        CMU("CS_Kodou")
    else
        CMU("CS_Mura")
    end
end

--去外面
function Door_GoVillage()
    if(FLJ("Night")) then
        PRI()MM0()SOU("CS_011_door")ANP("Door_GoVillage",0,1)FAO(2)TRA("CS_village_night","E0090",23,14)
    else
        PRI()MM0()SOU("CS_011_door")ANP("Door_GoVillage",0,1)FAO(2)TRA("CS_village","E0090",23,14)
    end
end


--和杰克对话
function Jack1()
    if(FLJ("ThreeDaysLater")) then
        KEY()
        FAC("jack_normal")
        MS3("早去早回啊，")NOD()
        CAT("\n拜托了！")NOD()CLR()
    elseif(FLJ("AskedJack")) then
        KEY()
        FAC("jack_normal")
        MS3("今天不早了，")NOD()
        CAT("\n间八你也赶紧回去休息吧。")NOD()CLR()
    else
        KEY()
        FAC("jack_normal")MS3("金这几天有事外出了，")NOD()
        CAT("\n所以村子暂时就由No.2的我来管理。")NOD()CLR()
        CAT("什么？")NOD()
        CAT("\n我上任第一天就有人不见踪影了？")NOD()CLR()
        CAT("啊...马宾啊...")NOD()
        CAT("\n不用担心他，")NOD()
        CAT("\n外面如果找不到吃的")NOD()
        CAT("\n他会乖乖自己回来的")NOD()
        CAT("\n你就再等一两天吧...")NOD()CLR()
        FLP("AskedJack")
        if(FLJ("AskedToroko")) then
            MSR("AskEveryoneAboutMahin","GoHomeSleep")
            FLP("Night")
        end
    end
end

function ThreeDaysLater()
    KEY()
    FLS("AskedJack")
    FLS("Night")
    CMU("CS_Kodou")WAI(64)
    LIP(1000)
    MS2("在那之后过了三天")
    CAT("\n马宾仍然没有回来...")NOD()CLO()
    WAI(64)
    AMC(0,1,PLY())
    FAI(2)
    WAI(32)
    FAC("jack_normal")MS4("这样啊，")NOD()
    CAT("\n他还是没回来。")NOD()CLR()
    CAT("你是想去找他对吧？")NOD()
    CAT("\n那我给你一个东西好了。")NOD()CLO()
    ANP("Jack1",1,0)
    WAI(2*16)
    ANP("Jack1",0,0)
    GIT("Spikes")
    ITP("Spikes")
    SOU("CS_038_get_item")
    AMC(204,"CS_mychar_kanpa")
    MS4("\n获得了 =钉鞋= 。")WAI(30)NOD()GIT()CLR()
    FAC("jack_normal")CAT("有了它之后，")NOD()
    CAT("\n你行动起来就会更加敏捷了，")NOD()
    CAT("\n也可以从上方踩踏敌人。")NOD()CLR()
    CAT("本来金叮嘱我")
    CAT("\n这段时间不能让任何人出村的，")NOD()
    CAT("\n但是现在也没办法了。")NOD()CLR()
    CAT("间八你要早去早回啊，")NOD()
    CAT("\n出门时最好不要让其他人看到。")NOD()
    CAT("\n拜托了！")NOD()
    FLP("ThreeDaysLater")
    MSR("GoHomeSleep","SearchForMahin")
end

function JackWaitKanpa()
    KEY()
    CMU("CS_Kodou")
    MNP("Jack1",22,15,0)
    ANP("Jack1","wander")
    FAI(0)
    WAI(120)
    ANP("Jack1","normal")
    WAI(32)
    FAC("jack_><")MS3("都这么晚了，")NOD()
    CAT("\n间八怎么还没回来...")NOD()CLR()CLO()
    WAI(32)
    ANP("Jack1","normal",1)
    WAI(16)
    ANP("Jack1","normal",0)
    WAI(32)
    FAC("jack_normal")MS3("有点不太安心，")NOD()
    CAT("\n还是去看看其他人是否睡了吧...")NOD()CLO()
    ANP("Jack1","walk",0)
    WAI(64)
    FAO(3)
    TRA("CS_bar","Party",28,14)
end

function KnockTheDoor()
    for i=0,2,1 do
        SOU("CS_023_thud")
        SNP("CS_pe_gunshothit",14,15,0,"mainLayer","null")
        WAI(16)
    end
end

function ChakoWakeJackUp()
    KEY()
    CMU("XXXX")
    --杰克还在睡觉
    DNP("FirePlace1")
    ANP("Jack1","sleep")
    FAI(2)
    WAI(32)
    --恰可敲门
    KnockTheDoor()
    WAI(64)
    MS3("桑塔...")NOD()
    CAT("\n让我再多睡一会...")NOD()CLO()
    WAI(32)
    KnockTheDoor()
    WAI(32)
    FAC("jack_><")MS3("\n什么事啊...")NOD()CLO()
    WAI(32)
    KnockTheDoor()
    WAI(32)
    FAC("jack_><")MS3("别敲了...")NOD()
    CAT("\n我现在就来...")NOD()CLO()
    WAI(32)
    ANP("Jack1","normal",0)
    WAI(32)
    ANP("Jack1","walk",0)
    WAI(32)
    KnockTheDoor()
    WAI(60)
    ANP("Jack1","normal",0)
    WAI(16)
    SOU("CS_011_door")ANP("Door_GoVillage",0,1)
    WAI(32)
    --恰可出现
    SNP("CS_chako_animate",14,15,0,"mainLayer","Chako1")--恰可
    WAI(16)
    ANP("Chako1","walk",1)
    WAI(8)
    ANP("Jack1","normal",1)
    WAI(8)
    ANP("Chako1","normal",0)
    WAI(32)
    FAC("jack_normal")MS3("原来是恰可啊...")NOD()
    CAT("\n找我是有什么..")CLR()
    ANP("Chako1","jump")
    SNP("CS_exclamation",15,13,0,"mainLayer","null")--感叹号
    FAC("chako_sigh")CAT("\n多隆子她们被怪物抓走了！！")NOD()CLR()
    FAC("jack_normal")CAT("什么！")NOD()
    CAT("\n多隆子被抓走了？！")NOD()
    CAT("\n我得赶快告诉金")
    for i=0,6,1 do
        CAT(".")
        WAI(16)
    end
    CLR()
    ANP("Jack1","normal",0)
    FAC("jack_><")CAT("\n啊啊啊这几天他不在...")NOD()CLR()
    CAT("（要是多隆子有个什么万一的话，")NOD()
    CAT("\n金会把我大卸八块的...）")NOD()CLO()
    WAI(64)
    FAC("chako_normal")MS3("\n所以你得去救她们！")ANP("Jack1","normal",1)NOD()CLO()
    WAI(16)
    SNP("CS_santa_animate",14,15,0,"mainLayer","Santa1")--桑塔
    ANP("Santa1","walk")
    WAI(16)
    ANP("Santa1","normal",1)
    FAC("chako_happy")MS3("\n桑塔也会一同和你前去。")NOD()CLR()
    FAC("jack_normal")CAT("\n那科恩们就拜托你了！")NOD()CLR()
    FAC("chako_happy")CAT("\n早日打倒大魔王回来~")NOD()CLO()
    FAO(2)
    WAI(32)
    TRA("CS_king_house","JackAndSantaReadyToGo",20,15)
end

function JackAndSantaReadyToGo()
    KEY()
    CMU("CS_Mura")
    --切换杰克（玩家） 加入 玩家2加入桑塔
    MOV(20,15,0)
    SLR(1,0)
    MOV(22,15,1)
    SLR(0,1)
    SWC(0,"CS_mychar_jack","CS_mychar_jack_p1")
    SWC(1,"CS_mychar_santa","CS_mychar_santa_p2")
    FLP("JackSantaGo")
    FLP("ColonLeave")
    FLP("Colon1GiveExp")
    FLP("Colon2GiveExp")
    FLP("Colon3GiveExp")
    FLP("Colon4GiveExp")
    FLP("ChakoGiveExp")
    FLP("SueGiveExp")
    FLP("TorokoGiveExp")
    FLP("TorokoNecklace")
    FLS("PowerOn")
    DNP("Jack1")
    --让指令先执行
    WAI(1)
   
    FLP("HideHomeJack")
    FLS("Night")
    FAI(0)
    WAI(32)
    --显示枪
    SOU("CS_004_switchweapon")
    AMC("show_gun",1,0)
    FAC("jack_normal")MS3("\n武器带上了嘛？")NOD()CLO()
    WAI(32)
    AMC("show_gun")
    SOU("CS_004_switchweapon")
    WAI(32)
    MS3("\n带上了。")NOD()CLR()
    FAC("jack_normal")CAT("\n那么准备出发吧！")NOD()CLR()
    FAC()MS2("在多角色场景时，")NOD()
    CAT("\n按下[交换角色]键")
    CAT("\n就可以控制另一个角色了。")NOD()CLO()
    --如果只有1个玩家
    if(GOP() == 1) then
        --玩家2由AI控制
        AGP("CS_mychar_santa_p2",true)
    end
    P2A(true)--允许玩家2使用AI切换
    --设置地图系统在岔路口捡到
    if(ITJ("MapSystem")) then
        FLP("KanpaMapSystemDrop")
    end
    --清空所有物品
    ITS()
    --带上枪
    ITP("Bubbler")
    ITP("Fireball")
    --移除所有任务
    MSD()
    --增加现在的任务
    MSA("SaveToroko")
end

function PuuSearch()
    KEY()
    ANP("Door_GoVillage",0,1)
    DNP("FirePlace1")
    SNP("CS_puu_animate",19,15,0,"mainLayer","Puu1")
    ANP("Puu1","walk",1)
    FAI(0)
    WAI(64)
    ANP("Puu1","normal",1)
    WAI(32)
    ANP("Puu1","normal",0)
    WAI(32)
    ANP("Puu1","normal",1)
    WAI(64)
    ANP("Puu1","walk",0)
    WAI(128)
    WAI(32)
    ANP("Puu1","normal",0)
    WAI(32)
    DNP("Puu1")
    WAI(32)
    SOU("CS_011_door")ANP("Door_GoVillage",0,0)
    WAI(32)
    FAO(2)TRA("CS_village","SoapSearch",0,0)
end

function ChakoHidden()
    KEY()
    SNP("CS_chako_animate",16,15,1,"mainLayer","Chako1")
    ANP("Chako1","back",1)
    ANP("Blackboard1",0,1)
    DNP("FirePlace1")
    FAI(0)
    WAI(16)
    FAC("chako_sad")MS3("事到如今只能这么做了，")NOD()
    CAT("\n我现在能做到的最好的事情")
    CAT("\n就是留下怪物的长相线索。")NOD()CLO()
    ANP("Chako1","normal",1)
    WAI(32)
    GIT("ChakoLipstick")
    MS3("\n*把口红丢在了地上。")NOD()CLO()
    GIT()
    SNP("CS_sparkitem",17,15,0,"mainLayer","Chako1")
    WAI(32)
    FAC("chako_sad")MS3("\n就这样吧...")NOD()CLO()
    KnockTheDoor()
    ANP("Chako1","normal",0)
    WAI(16)
    MS3("在嘛？小美人，")NOD()
    CAT("\n不要躲了快点出来吧...")NOD()CLR()
    CAT("如果不想让我用")
    CAT("\n更粗暴一点的方法的话。")NOD()CLO()
    FLP("ChakoClue")
    WAI(32)
    ANP("Chako1","walk",0)
    WAI(32)
    ANP("Chako1","back",0)
    WAI(16)
    FAC("chako_sad")MS3("怪物并不可怕...")NOD()
    CAT("\n可怕的是，")NOD()
    CAT("\n如果科恩们被暴露的话，")NOD()
    CAT("\n他们抓够了7只，把我们")
    CAT("\n交给高第们才是最可怕的事情。")NOD()CLO()
    ANP("Chako1","normal",0)
    WAI(32)
    KnockTheDoor()
    MS3("\n小美人，不要让我等太久哦~")NOD()CLO()
    WAI(64)
    FAC("chako_happy")MS3("\n恰可请你鼓起勇气吧！")NOD()CLO()
    ANP("Chako1","back",0)
    WAI(64)
    SOU("CS_011_door")ANP("Door_GoVillage",0,1)
    WAI(16)
    DNP("Chako1")
    WAI(16)
    SOU("CS_011_door")ANP("Door_GoVillage",0,0)
    WAI(16)
    FAO(2)TRA("CS_village","ChakoGetCaught",0,0)
end

function GetChakoLipstick()
    KEY()
    FAC("king_normal")MS3("现场还是保持原样，")NOD()
    CAT("\n这个线索也留给库特、卡莉他们好了。")NOD()
end

function Blackboard1()
    PRI()
    MS4("\n上面没什么可值得注意的。")NOD()
end

function ChakoClue()
    KEY()
    FAC("king_normal")MS3("这是怪物的长相，")NOD()
    CAT("\n看样子是住在洞窟下方的雕像妖它们。")NOD()
end

function KingBack()
    KEY()
    --CMU("CS_Kodou")
    HMC(0)
    SLR(1,0)
    FAI(2)
    WAI(16)
    SOU("CS_011_door")ANP("Door_GoVillage",0,1)
    WAI(16)
    SMC(0)
    WAI(16)
    SOU("CS_011_door")ANP("Door_GoVillage",0,0)
    WAI(32)
    FAC("king_normal")MS3("杰克？")NOD()
    CAT("\n杰克也不在吗...")NOD()CLO()
    WAI(32)
    AMC("walk")
    WAI(32)
    AMC("normal")
    WAI(32)
    GIT("ChakoLipstick")
    FAC("king_normal")MS3("这是恰可的口红...")NOD()
    CAT("\n它为什么会在这里。")NOD()CLO()
    GIT()
    WAI(32)
    AMC("back")
    WAI(32)
    FAC("king_normal")MS3("这上面画的红色图案是什么东西？")NOD()
    CAT("\n似乎是用口红画的...")NOD()
    CAT("\n难道大家遇难了？！")NOD()CLR()
    AMC("normal")
    CAT("\n我必须立刻去确认下！！")NOD()CLO()
    WAI(16)
    FAO(0)
    TRA("CS_santa_house","KingBack",18,14)
end

function KingReadyToGo()
    KEY()
    AMC("back",1)
    FAI(2)
    WAI(32)
    FAC("king_normal")MS3("这应该就是恰可留下的怪物长相线索，")NOD()
    CAT("\n对于怪物在哪我有点线索。")NOD()CLO()
    AMC("normal",1)
    WAI(32)
    FAC("king_normal")MS3("虽然想等库特卡莉他们")
    CAT("\n一起回来再行动，")NOD()
    CAT("\n但我的直觉告诉我")
    CAT("\n时间已经所剩无几了。")NOD()CLR()
    CAT("\n现在就赶紧出发吧！")NOD()
    ---[[
    --如果是双玩家模式
    if(GOP() == 2) then
        --再加入一个金让玩家2控制
        CGP("CS_mychar_king_p1","CS_mychar_king_p2")
        SPL(1,"CS_mychar_king_p2")
        P2A(false)--禁止玩家2使用AI切换
    else
        --玩家2置为NULL
        SGP("null",73,27,0,"CS_mychar_null_p2")
        SPL(1,"CS_mychar_null_p2")
    end
    --]]
    MSD()
    MSA("SaveEveryoneKing")
end