
function E0090()
    MNA()CMU("CS_Azarashi")FAI(0)
end
function E0091()
    MNA()CMU("CS_Azarashi")FAI(1)
end
function E0092()
    MNA()CMU("CS_Azarashi")FAI(2)
end
function E0093()
    MNA()CMU("CS_Azarashi")FAI(3)
end
function E0094()
    MNA()CMU("CS_Azarashi")FAI(4)
end

function Door_GoPeaceTownHotel()
    PRI()MM0()SOU("CS_011_door")ANP("Door_GoPeaceTownHotel",0,1)FAO(0)TRA("CS_peace_town_hotel","E0092",25,19)
end

function Door_GoPeaceTownNoodle()
    PRI()MM0()SOU("CS_011_door")ANP("Door_GoPeaceTownNoodle",0,1)FAO(0)TRA("CS_peace_town_noodle","E0092",11,14)
end

function Door_GoPeaceTownDisco()
    PRI()MM0()SOU("CS_011_door")ANP("Door_GoPeaceTownDisco",0,1)FAO(0)TRA("CS_peace_town_disco","E0092",5,16)
end

function Door_GoPeaceTownRepair()
    PRI()MM0()SOU("CS_011_door")ANP("Door_GoPeaceTownRepair",0,1)FAO(0)TRA("CS_peace_town_repair","E0092",9,12)
end

function Door_GoPeaceTownRecycle()
    PRI()MM0()SOU("CS_011_door")ANP("Door_GoPeaceTownRecycle",0,1)FAO(0)TRA("CS_peace_town_recycle","E0092",11,14)
end

function Door_GoPeaceTownBakery()
    PRI()MM0()SOU("CS_011_door")ANP("Door_GoPeaceTownBakery",0,1)FAO(0)TRA("CS_peace_town_bakery","E0092",11,14)
end

function GoPeaceTownAround()
    if(FLJ("BringHoneycomb")) then
        PRI()FAO(3)TRA("CS_peace_town_around","E0091",38,14,1,15)
    else
        KEY()
        MYB(0,PLY())WAS()
        FAC("jack_normal")MS4("Without enough information,")
        CAT("\nWe'd better not leave town yet.")NOD()
    end
end

function Door_GoPeaceTownDivination()
    if(FLJ("GoFindJenka")) then
        KEY()FAC("jack_normal")MS4("We should get going soon.")
        CAT("\nLet's not bother Misali anymore.")NOD()
    elseif(FLJ("GiveToMisery")) then
        PRI()MM0()SOU("CS_011_door")ANP("Door_GoPeaceTownDivination",0,1)FAO(0)TRA("CS_peace_town_divination","E0092",28,12)
    elseif(FLJ("FireflyCatch20")) then
        if(ITJ("Firefly")) then
            local num = ITC("Firefly")
            if(num >= 20) then
                KEY()FAC("jack_normal")MS4("Before visiting Misery,")
                CAT("\nI should talk to Balrog first.")NOD()
            else
                KEY()FAC("jack_normal")MS4("We don't have enough")
                CAT("\nfireflies yet...")NOD()
                CAT("\nLet's go back to the cave") 
                CAT("\nand catch 20 more.")NOD()
            end
        else
            KEY()FAC("jack_normal")MS4("We'd better hurry and catch")
            CAT("\nthose fireflies...")NOD()
        end
    elseif(FLJ("CatchFirefly")) then
        if(ITJ("Firefly")) then
            local num = ITC("Firefly")
            if(num >= 20) then
                KEY()FAC("jack_normal")MS4("Before visiting Misery,")
                CAT("\nI should talk to Balrog first.")NOD()
            else
                KEY()FAC("jack_normal")MS4("Not sure if we have enough...")NOD()
                CAT("\nLet's go ask Balrog.")NOD()
            end
        else
            KEY()FAC("jack_normal")MS4("We'd better hurry and catch")
            CAT("\nthose fireflies...")NOD()
        end
    elseif(FLJ("GetOutDivination")) then
        KEY()
        MS4("You sense an invisible murderous aura.")NOD()
        CAT("\n(If I go back in there, I'm definitely dead...)")NOD()
    else
        if(FLJ("DivinationOpen")) then
            PRI()MM0()SOU("CS_011_door")ANP("Door_GoPeaceTownDivination",0,1)FAO(0)TRA("CS_peace_town_divination","E0092",28,12)
        else
            KEY()FAC("jack_normal")MS4("Seems it's not opening hours yet.")NOD()
            CAT("\nLet's check out some other")
            CAT("\nplaces first.")NOD()
        end
    end
end

--被米莎莉赶了出来
function GetOutDivination()
    KEY()
    ANP("Door_GoPeaceTownDivination",0,1)
    FON("Door_GoPeaceTownDivination",1)
    --设置泡泡跟踪目标
    SNP("null",25,30,0,"mainLayer","Bubble1_target")--泡泡
    SNP("null",23,30,0,"mainLayer","Bubble2_target")--泡泡
    MOV(25,30,PLY())
    MOV(23,30,1-PLY())
    SLR(1)
    FAI(0)
    WAI(32)
    SNP("CS_bubble_catcher",20,31,1,"mainLayer","Bubble1")--泡泡
    ANP("Bubble1","set_target")
    ANP("Bubble1","Bubble1_target")
    if(MCN(PLY()) == "CS_mychar_jack") then
        ANP("Bubble1","caught_jack")
    else
        ANP("Bubble1","caught_santa")
    end
    WAI(32)
    DNP("Bubble1")
    SMC(PLY())
    AMC("hurt",1,PLY())
    --玩家2
    SNP("CS_bubble_catcher",20,31,1,"mainLayer","Bubble2")--泡泡
    ANP("Bubble2","set_target")
    ANP("Bubble2","Bubble2_target")
    if(MCN(1-PLY()) == "CS_mychar_jack") then
        ANP("Bubble2","caught_jack")
    else
        ANP("Bubble2","caught_santa")
    end
    WAI(16)
    AMC("lie",1,PLY())
    SOU("CS_071_little_crash")
    AMC("smoke",0,PLY())
    WAI(8)
    DNP("Bubble2")
    SMC(1-PLY())
    AMC("hurt",1,1-PLY())
    WAI(16)
    AMC("lie",1,1-PLY())
    SOU("CS_071_little_crash")
    AMC("smoke",0,1-PLY())
    WAI(64)
    SOU("CS_011_door")ANP("Door_GoPeaceTownDivination",0,0)
    AMC("show_gun")
    WAI(32)
    AMC("normal",1,PLY())
    WAI(16)
    AMC("normal",1,1-PLY())
    WAI(16)
    AMC("normal",0,PLY())
    WAI(16)
    AMC("normal",0,1-PLY())
    WAI(64)
    FAC("jack_><")MS3("Now we're in trouble.")NOD()
    FAC("jack_normal")CAT("\nLet's go back and ask Balrog again.")NOD()
    CMU("CS_Azarashi")
    FOM()
    FLP("GetOutDivination")
    MSR("AskMiseryForHelp","AskBalrogForHelp")
end

--在酒店和小巴对完话
function ChatWithBalrog()
    KEY()
    SMC()
    AMC("show_gun")
    MOV(30,15,PLY())
    SLR(1,PLY())
    MOV(32,15,1-PLY())
    SLR(0,1-PLY())
    CMU("CS_Azarashi")
    FAI(0)
    WAI(32)
    FAC("jack_normal")MS3("The fortune-teller's shop") 
    CAT("\nshould be open by now.")NOD()
    CAT("\nLet's head over there.")NOD()
end

function SantaAndJackArrive()
    KEY()
    CMU("XXXX")
    --玩家1切换为杰克
    if(MCN(0) ~= "CS_mychar_jack") then
        SWP()
    end
    MV0()
    SNP("sys_trigger_v_allplayer",50,0,0,"mainLayer","Camera1")
    WAI(1)
    FON("Camera1",1)
    MOV(49,0,0)
    SLR(1,0)
    MOV(51,0,1)
    SLR(0,1)
    AMC("hurt")
    FAI(0)
    WAS()
    SOU("CS_071_little_crash")
    AMC("smoke")
    AMC("lie")
    WAI(128)
    AMC("normal","CS_mychar_santa")
    WAI(32)
    AMC("normal",1,1)--桑塔往右看
    WAI(32)
    AMC("back",1,1)--桑塔往右看
    WAI(32)
    AMC("back",0,1)--桑塔往右看
    WAI(32)
    MS3("Whoa!")NOD()
    CAT("\nWhat is this place?!")NOD()CLO()
    WAI(32)
    FAC("jack_><")MS3("Ugh...")
    AMC("normal",0,1)--桑塔往左看
    NOD()
    CAT("\nI'm getting dizzy from") 
    CAT("\nall this spinning...")NOD()CLO()
    WAI(16)
    AMC("normal","CS_mychar_jack")
    WAI(32)
    AMC("normal",0,0)--杰克往左看
    WAI(48)
    AMC("back",0,0)
    WAI(48)
    AMC("back",1,0)
    WAI(32)
    AMC("normal",1,0)--杰克往右看
    WAI(32)
    FAC("jack_normal")MS3("Never thought there'd be a place")
    CAT("\nlike this outside the village...")NOD()CLO()
    WAI(32)
    SOU("CS_052_enemy_hurt_big")
    WAI(64)
    MS3("Come to think of it,")
    CAT("\nI haven't eaten breakfast yet...")NOD()CLR()
    FAC("jack_><")MS3("\nDon't remind me... Me neither...")NOD()CLR()
    FAC("jack_normal")MS3("Let's look around the area first...")NOD()
    CAT("\nAnd maybe we can find out")
    CAT("\nwhere Toroko and the others went...")NOD()CLR()
    FAC()CAT("\nThen let's get moving!")NOD()
    DNP("Camera1")
    FOM()
    CMU("CS_Azarashi")
end