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

function Test1()
    --镜头转到CupCamera
    KEY()
    ANP("LocalCamera1","disable_focus")
    FON("CupCamera")WAI(90)
    ANP("Lock1",0,1)--解锁
    SOU("CS_012_block_destroy")
    WAI(30)
    FOM()
    ANP("LocalCamera1","enable_focus")
end

function CheckNormalGame(bossStr)
    local bNormalMode = true;
    if(bossStr == "Malco" or 
        bossStr == "Arowana") then
        if(FLJ("UsingKanpa") == false) then
            bNormalMode = false;
        end
    elseif(bossStr == "Flower&Hive" or 
        bossStr == "Ironhead" or 
        bossStr == "Puu&Tala") then
        if(FLJ("UsingJack&Santa") == false) then
            bNormalMode = false;
        end
    elseif(bossStr == "RedDemon" or 
        bossStr == "GolemTower" or 
        bossStr == "GolemHall" or 
        bossStr == "Tap" ) then
        if(FLJ("UsingKing") == false) then
            bNormalMode = false;
        end
    elseif(bossStr == "Lei" or 
        bossStr == "Trap" or 
        bossStr == "MonsterX") then
        if(FLJ("UsingQuote&Curly") == false) then
            bNormalMode = false;
        end
    end
    return bNormalMode;
end

function CheckSwitchFreeMode(bossStr)
    if(FLJ("FreeMode")) then
        return false;
    elseif(not CheckNormalGame(bossStr)) then
        GIT("NikumaruCounter")
        MS4("Do you want to turn off the timer")
        CAT("\nand play in Free Mode?")YNJ()CLR()
        GIT()
        if(YES()) then
            TIM(false,false)
            FLP("FreeMode")
            CAT("\nTimer has been turned off.")NOD()CLO()
            return false;
        else
            return true;
        end
    end
    return false;
end

function Unlock()
    --如果完成了所有挑战 则奖杯门会解锁
    if(FLJ("DefeatedMalco") and
        FLJ("DefeatedArowana") and 
        FLJ("DefeatedFlower&Hive") and 
        FLJ("DefeatedIronhead") and 
        FLJ("DefeatedPuu&Tala") and 
        FLJ("DefeatedRedDemon") and 
        FLJ("DefeatedGolemTower") and
        FLJ("DefeatedGolemHall") and
        FLJ("DefeatedTap") and
        FLJ("DefeatedLei") and
        FLJ("DefeatedTrap") and
        FLJ("DefeatedMonsterX")
    ) then
        --镜头转到CupCamera
        KEY()
        ANP("LocalCamera1","disable_focus")
        FON("CupCamera")WAI(90)
        ANP("Lock1",0,1)--解锁
        SOU("CS_012_block_destroy")
        PMU(5)
        WAI(30)
        FOM()
        ANP("LocalCamera1","enable_focus")
    end
end

function GameStart()
    PRI()
    MOV(3,14)
    GIT("Spikes")
    ITP("Spikes")
    SOU("CS_038_get_item")
    AMC(204,"CS_mychar_kanpa")
    MSG("\nGot =SPIKED BOOTS=.")NOD()CLR()
    GIT("NikumaruCounter")
    ITP("NikumaruCounter")
    TIM(true,true)
    SOU("CS_043_computer_beep")
    CAT("\nCounter activated.")NOD()CLO()GIT()
    CMU("CS_Grand")
    AMC("show_fishing_rod","CS_mychar_kanpa");--显示鱼竿
    SetUsingMycharFlag("UsingKanpa")
    DNP("Kanpa1")
    --一起创建其他角色
    SGP("CS_mychar_jack",0,0,0,"CS_mychar_jack_p1")AMC("show_gun",0,"CS_mychar_jack_p1")HMC("CS_mychar_jack_p1")
    SGP("CS_mychar_santa",0,0,0,"CS_mychar_santa_p2")AMC("show_gun",0,"CS_mychar_santa_p2")HMC("CS_mychar_santa_p2")
    SGP("CS_mychar_king",0,0,0,"CS_mychar_king_p1")HMC("CS_mychar_king_p1")
    SGP("CS_mychar_quote",0,0,0,"CS_mychar_quote_p1")HMC("CS_mychar_quote_p1")
    SGP("CS_mychar_curly",0,0,0,"CS_mychar_curly_p2")HMC("CS_mychar_curly_p2")
    FAI(3)
end

function SetUsingMycharFlag(flagStr)
    FLS("UsingKanpa")
    FLS("UsingJack&Santa")
    FLS("UsingKing")
    FLS("UsingQuote&Curly")
    FLP(flagStr)
end

function HideCurrentPlayer()
    if(FLJ("UsingKanpa")) then
        HMC("CS_mychar_kanpa_p1")
    elseif(FLJ("UsingJack&Santa")) then
        HMC("CS_mychar_jack_p1")
        HMC("CS_mychar_santa_p2")
    elseif(FLJ("UsingKing")) then
        HMC("CS_mychar_king_p1")
    elseif(FLJ("UsingQuote&Curly")) then
        HMC("CS_mychar_quote_p1")
        HMC("CS_mychar_curly_p2")
    end
end

function ShowCurrentPlayer()
    if(FLJ("UsingKanpa")) then
        SMC("CS_mychar_kanpa_p1")
    elseif(FLJ("UsingJack&Santa")) then
        SMC("CS_mychar_jack_p1")
        SMC("CS_mychar_santa_p2")
    elseif(FLJ("UsingKing")) then
        SMC("CS_mychar_king_p1")
    elseif(FLJ("UsingQuote&Curly")) then
        SMC("CS_mychar_quote_p1")
        SMC("CS_mychar_curly_p2")
    end
end
-----------------------------间八篇--------------------------
function MalcoBoss()
    PRI()
    if(FLJ("DefeatedMalco")) then
        TUR()MS4("\nMalco challenge cleared!")NOD()
    else
        if(CheckSwitchFreeMode("Malco")) then
            return;
        end
        MS4("\nChallenge Malco?")YNJ()
        if(YES()) then
            CLO()
            FAO(3)TRA("CS_bossrush_malco","QuickMalcoBoss",23,14)
        end
    end
end

function KuronBoss()
    PRI()
    if(FLJ("DefeatedArowana")) then
        TUR()MS4("\nKuron challenge cleared!")NOD()
    else
        if(CheckSwitchFreeMode("Arowana")) then
            return;
        end
        MS4("\nChallenge Kuron?")YNJ()
        if(YES()) then
            CLO()
            FAO(3)TRA("CS_bossrush_kuron","QuickFishBoss",23,14)
        end
    end
end

--生命胶囊
function PathLifeCapsule1()
    PRI()SOU("CS_022_chest_open")DNP("PathLifeCapsule1")FLP("PathLifeCapsule1")
    MS4("Obtained =LIFE CAPSULE=!")NOD()
    MLP(5)
    CAT("\nMaximum HP increased by 5!")NOD()
end

function PathLifeCapsule2()
    PRI()SOU("CS_022_chest_open")DNP("PathLifeCapsule2")FLP("PathLifeCapsule2")
    MS4("Obtained =LIFE CAPSULE=!")NOD()
    MLP(5)
    CAT("\nMaximum HP increased by 5!")NOD()
end

function Fishing1()
    PRI()
    if(WET()) then
        MS4("The fish is still thrashing") 
        CAT("\nabout in the water,")NOD()
        CAT("\nmaking it difficult to catch.")NOD()
    else
        MS4("It's a chinfish commonly") 
        CAT("\nfound in the village pond...")NOD()CLR()
        ITP("Chinfish")
        GIT("Chinfish")
        SOU("CS_038_get_item")
        DNP("Fishing1")
        FLP("Fishing1")
        CAT("\nGot a =CHINFISH=.")NOD()
    end
end

function Fishing2()
    PRI()
    if(WET()) then
        MS4("The fish is still thrashing") 
        CAT("\nabout in the water,")NOD()
        CAT("\nmaking it difficult to catch.")NOD()
    else
        MS4("It's a Blue Fish commonly")
        CAT("\nfound in wild lakes...")NOD()CLR()
        ITP("Bluefish")
        GIT("Bluefish")
        SOU("CS_038_get_item")
        DNP("Fishing2")
        FLP("Fishing2")
        CAT("\nGot a =BLUE FISH=.")NOD()
    end
end

function Fishing3()
    PRI()
    if(WET()) then
        MS4("The fish is still thrashing") 
        CAT("\nabout in the water,")NOD()
        CAT("\nmaking it difficult to catch.")NOD()
    else
        MS4("It's a Blue Fish commonly")
        CAT("\nfound in wild lakes...")NOD()CLR()
        ITP("Bluefish")
        GIT("Bluefish")
        SOU("CS_038_get_item")
        DNP("Fishing3")
        FLP("Fishing3")
        CAT("\nGot a =BLUE FISH=.")NOD()
    end
end

function Fishing4()
    PRI()
    if(WET()) then
        MS4("The fish is still thrashing") 
        CAT("\nabout in the water,")NOD()
        CAT("\nmaking it difficult to catch.")NOD()
    else
        MS4("\nIt's a timid Red Fish...")NOD()CLR()
        ITP("Redfish")
        GIT("Redfish")
        SOU("CS_038_get_item")
        DNP("Fishing4")
        FLP("Fishing4")
        CAT("\nGot a =RED FISH=.")NOD()
    end
end

function Door_GoJackSantaChapter()
    KEY()
    SOU("CS_011_door")
    ANP("Door_GoJackSantaChapter",0,1)WAI(10)HideCurrentPlayer()
    ANP("Door_GoJackSantaChapter",0,0)
    MOV(35,37)WAI(50)
    SOU("CS_011_door")
    ANP("Door_GoKanpaChapter",0,1)SLR(0)ShowCurrentPlayer()WAI(10)
    ANP("Door_GoKanpaChapter",0,0)
end

function Door_GoKanpaChapter()
    KEY()
    SOU("CS_011_door")
    ANP("Door_GoKanpaChapter",0,1)WAI(10)HideCurrentPlayer()
    ANP("Door_GoKanpaChapter",0,0)
    MOV(35,14)WAI(50)
    SOU("CS_011_door")
    ANP("Door_GoJackSantaChapter",0,1)SLR(0)ShowCurrentPlayer()WAI(10)
    ANP("Door_GoJackSantaChapter",0,0)
end

function Kanpa1()
    PRI()
    MS4("\nSwitch to Kanpachi?")YNJ()
    if(YES()) then
        CLR()
        CAT("\nI’ve got this~")NOD()CLO()
        FAO(2)
        HideCurrentPlayer();
        --切换为间八
        SetUsingMycharFlag("UsingKanpa")
        TRA("CS_bossrush_mainstage","KanpaGo",0,0)
    end
end

function KanpaGo()
    PRI()
    HMC(0)
    HMC(1)
    SMC("CS_mychar_kanpa_p1")
    SPL(0,"CS_mychar_kanpa_p1")
    SPL(1,"null")
    MOV(32,14,0)
    MOV(0,0,1)
    FAI(0)
end

-----------------------------杰克桑塔篇--------------------------
function FlowerAndHiveBoss()
    PRI()
    if(FLJ("DefeatedFlower&Hive")) then
        TUR()MS4("\nDemon Flower & Hive challenge cleared!")NOD()
    elseif(FLJ("UsingKanpa")) then
        TUR()MS4("Kanpachi isn't suited for this challenge...")NOD()
        CAT("\nor any of the ones that follow.")NOD()
    else
        if(CheckSwitchFreeMode("Flower&Hive")) then
            return;
        end
        MS4("\nChallenge Demon Flower & Hive?")YNJ()
        if(YES()) then
            CLO()
            FAO(3)TRA("CS_bossrush_flower","QuickFlowerBoss",0,0)
        end
    end
end

function IronheadBoss()
    PRI()
    if(FLJ("DefeatedIronhead")) then
        TUR()MS4("\nIronhead challenge cleared!")NOD()
    elseif(FLJ("UsingJack&Santa")) then
        if(CheckSwitchFreeMode("Ironhead")) then
            return;
        end
        MS4("\nChallenge Ironhead?")YNJ()
        if(YES()) then
            CLO()
            FAO(3)TRA("CS_bossrush_ironhead","QuickIronheadBoss",43,12)
        end
    else
        TUR()MS4("\nOnly Jack & Santa can play this challenge.")NOD()
    end
end

function PuuAndTalaBoss()
    PRI()
    if(FLJ("DefeatedPuu&Tala")) then
        TUR()MS4("\nPuu & Tala challenge cleared!")NOD()
    elseif(FLJ("UsingKanpa")) then
        TUR()MS4("Kanpachi isn't suited for this challenge...")NOD()
        CAT("\nor any of the ones that follow.")NOD()
    else
        if(CheckSwitchFreeMode("Puu&Tala")) then
            return;
        end
        MS4("\nChallenge Puu & Tala?")YNJ()
        if(YES()) then
            CLO()
            FAO(3)TRA("CS_bossrush_puutala","QuickPuuAndTalaBoss",35,15)
        end
    end
end

--生命胶囊
function PathLifeCapsule3()
    PRI()SOU("CS_022_chest_open")DNP("PathLifeCapsule3")FLP("PathLifeCapsule3")
    MS4("Obtained =LIFE CAPSULE=!")NOD()
    MLP(5)
    CAT("\nMaximum HP increased by 5!")NOD()
end

function PathLifeCapsule4()
    PRI()SOU("CS_022_chest_open")DNP("PathLifeCapsule4")FLP("PathLifeCapsule4")
    MS4("Obtained =LIFE CAPSULE=!")NOD()
    MLP(5)
    CAT("\nMaximum HP increased by 5!")NOD()
end

function PathLifeCapsule5()
    PRI()SOU("CS_022_chest_open")DNP("PathLifeCapsule5")FLP("PathLifeCapsule5")
    MS4("Obtained =LIFE CAPSULE=!")NOD()
    MLP(5)
    CAT("\nMaximum HP increased by 5!")NOD()
end

function SwitchJackAndSanta()
    PRI()
    MS4("\nSwitch to Jack & Santa?")YNJ()
    if(YES()) then
        CLR()
        FAC("jack_normal")CAT("\nOur turn now~")NOD()CLO()
        FAO(2)
        HideCurrentPlayer();
        --切换为杰克桑塔
        SetUsingMycharFlag("UsingJack&Santa")
        TRA("CS_bossrush_mainstage","JackAndSantaGo",32,37)
    end
end

function JackAndSantaGo()
    PRI()
    HMC(0)
    HMC(1)
    SMC("CS_mychar_jack_p1")
    SMC("CS_mychar_santa_p2")
    if(GOP() == 1) then
        AGP("CS_mychar_santa_p2",true)
    end
    SPL(0,"CS_mychar_jack_p1")
    SPL(1,"CS_mychar_santa_p2")
    MOV(32,37,0)
    MOV(31,37,1)
    FAI(0)
end

function Jack1()
    SwitchJackAndSanta()
end
function Santa1()
    SwitchJackAndSanta()
end

--捕获者
function Chest_Catcher()
    if(FLJ("Chest_Catcher")) then
        Chest_Catcher_Opened()
    elseif(FLJ("UsingJack&Santa")) then
        PRI()
        SOU("CS_022_chest_open")
        ANP("Chest_Catcher",0,1)
        MS4("Opened the chest.")NOD()CLR()
        GIT("Catcher")
        SOU("CS_038_get_item")
        MS4("=BUBBLER=")
        CAT("\nupgraded to =CATCHER=")NOD()CLO()
        AMC("catcher_get")
        FLP("Chest_Catcher")
    else
        PRI()
        MS4("\nCannot open it...")NOD()
    end
end
function Chest_Catcher_Opened()
    PRI()
    MS4("\nIt's empty...")NOD()
end

--幽灵火球
function Chest_GhostFire()
    if(FLJ("Chest_GhostFire")) then
        Chest_GhostFire_Opened()
    elseif(FLJ("UsingJack&Santa")) then
        PRI()
        SOU("CS_022_chest_open")
        ANP("Chest_GhostFire",0,1)
        MS4("Opened the chest.")NOD()CLR()
        GIT("GhostFire")
        SOU("CS_038_get_item")
        MS3("=FIREBALL=")
        CAT("\nupgraded to =GHOSTFIRE=")NOD()CLO()
        AMC("ghostfire_get")
        FLP("Chest_GhostFire")
    else
        PRI()
        MS4("\nCannot open it...")NOD()
    end
end
function Chest_GhostFire_Opened()
    PRI()
    MS4("\nIt's empty...")NOD()
end

-----------------------------金篇--------------------------
function RedDemonBoss()
    PRI()
    if(FLJ("DefeatedRedDemon")) then
        TUR()MS4("\nRed Demon challenge cleared!")NOD()
    elseif(FLJ("UsingKanpa")) then
        TUR()MS4("Kanpachi isn't suited for this challenge...")NOD()
        CAT("\nor any of the ones that follow.")NOD()
    else
        if(CheckSwitchFreeMode("RedDemon")) then
            return;
        end
        MS4("\nChallenge Red Demon?")YNJ()
        if(YES()) then
            CLO()
            FAO(3)TRA("CS_bossrush_reddemon","QuickRedDemonBoss",13,17)
        end
    end
end

function GolemTower()
    PRI()
    if(FLJ("DefeatedGolemTower")) then
        TUR()MS4("\nGolem Tower challenge cleared!")NOD()
    elseif(FLJ("UsingKanpa")) then
        TUR()MS4("Kanpachi isn't suited for this challenge...")NOD()
        CAT("\nor any of the ones that follow.")NOD()
    else
        if(CheckSwitchFreeMode("GolemTower")) then
            return;
        end
        MS4("\nChallenge Golem Tower?")YNJ()
        if(YES()) then
            CLO()
            FAO(3)TRA("CS_bossrush_golemtower","QuickGolemTower",6,60)
        end
    end
end

function GolemHall()
    PRI()
    if(FLJ("DefeatedGolemHall")) then
        TUR()MS4("\nGolem Hall challenge cleared!")NOD()
    elseif(FLJ("UsingKanpa")) then
        TUR()MS4("Kanpachi isn't suited for this challenge...")NOD()
        CAT("\nor any of the ones that follow.")NOD()
    else
        if(CheckSwitchFreeMode("GolemHall")) then
            return;
        end
        MS4("\nChallenge Golem Hall?")YNJ()
        if(YES()) then
            CLO()
            FAO(3)TRA("CS_bossrush_golemhall","QuickGolemHall",39,18)
        end
    end
end

function TapBoss()
    PRI()
    if(FLJ("DefeatedTap")) then
        TUR()MS4("\nTap challenge cleared!")NOD()
    elseif(FLJ("UsingKanpa")) then
        TUR()MS4("Kanpachi isn't suited for this challenge...")NOD()
        CAT("\nor any of the ones that follow.")NOD()
    else
        if(CheckSwitchFreeMode("Tap")) then
            return;
        end
        MS4("\nChallenge Tap?")YNJ()
        if(YES()) then
            CLO()
            FAO(3)TRA("CS_bossrush_tap","QuickTapBoss",39,18)
        end
    end
end

function Door_GoKingChapter()
    KEY()
    SOU("CS_011_door")
    ANP("Door_GoKingChapter",0,1)WAI(10)HideCurrentPlayer()
    ANP("Door_GoKingChapter",0,0)
    MOV(4,60)WAI(50)
    SOU("CS_011_door")
    ANP("Door_GoJackSantaChapter2",0,1)SLR(1)ShowCurrentPlayer()WAI(10)
    ANP("Door_GoJackSantaChapter2",0,0)
end

function Door_GoJackSantaChapter2()
    KEY()
    SOU("CS_011_door")
    ANP("Door_GoJackSantaChapter2",0,1)WAI(10)HideCurrentPlayer()
    ANP("Door_GoJackSantaChapter2",0,0)
    MOV(4,37)WAI(50)
    SOU("CS_011_door")
    ANP("Door_GoKingChapter",0,1)SLR(1)ShowCurrentPlayer()WAI(10)
    ANP("Door_GoKingChapter",0,0)
end

function PathLifeCapsule6()
    PRI()SOU("CS_022_chest_open")DNP("PathLifeCapsule6")FLP("PathLifeCapsule6")
    MS4("Obtained =LIFE CAPSULE=!")NOD()
    MLP(5)
    CAT("\nMaximum HP increased by 5!")NOD()
end
--电容器
function Chest_Capacitor()
    if(FLJ("Chest_Capacitor")) then
        Chest_Capacitor_Opened()
    elseif(FLJ("UsingKing")) then
        PRI()
        SOU("CS_022_chest_open")
        ANP("Chest_Capacitor",0,1)
        MS4("Opened the chest.")NOD()CLR()
        GIT("Capacitor")
        ITP("Capacitor")
        SOU("CS_038_get_item")
        MS3("\nGot the =CAPACITOR=.")NOD()CLO()
        FLP("Chest_Capacitor")
    else
        PRI()
        MS4("\nCannot open it...")NOD()
    end
end
function Chest_Capacitor_Opened()
    PRI()
    MS4("\nIt's empty...")NOD()
end

function King1()
    PRI()
    MS4("\nSwitch to King?")YNJ()
    if(YES()) then
        CLR()
        FAC("king_normal")CAT("\nI’ve got this~")NOD()CLO()
        FAO(2)
        HideCurrentPlayer();
        --切换为金
        SetUsingMycharFlag("UsingKing")
        TRA("CS_bossrush_mainstage","KingGo",6,60)
    end
end

function KingGo()
    PRI()
    HMC(0)
    HMC(1)
    SMC("CS_mychar_king_p1")
    SPL(0,"CS_mychar_king_p1")
    SPL(1,"null")
    MOV(6,60,0)
    FAI(0)
end
-----------------------------库特卡莉篇--------------------------
function LeiBoss()
    PRI()
    if(FLJ("DefeatedLei")) then
        TUR()MS4("\nLei challenge cleared!")NOD()
    elseif(FLJ("UsingQuote&Curly")) then
        if(CheckSwitchFreeMode("Lei")) then
            return;
        end
        MS4("\nChallenge Lei?")YNJ()
        if(YES()) then
            CLO()
            FAO(3)TRA("CS_bossrush_lei","QuickLeiBoss",34,18)
        end
    else
        TUR()MS4("\nOnly Quote & Curly can play this challenge.")NOD()
    end
end

function FortressTrap()
    PRI()
    if(FLJ("DefeatedTrap")) then
        TUR()MS4("\nTrap Room challenge cleared!")NOD()
    elseif(FLJ("UsingQuote&Curly")) then
        if(CheckSwitchFreeMode("Trap")) then
            return;
        end
        MS4("\nChallenge Trap Room?")YNJ()
        if(YES()) then
            CLO()
            FAO(3)TRA("CS_bossrush_trap","QuickTrap",40,23)
        end
    else
        TUR()MS4("\nOnly Quote & Curly can play this challenge.")NOD()
    end
end

function MonsterXBoss()
    PRI()
    if(FLJ("DefeatedMonsterX")) then
        TUR()MS4("\nMonsterX challenge cleared!")NOD()
    elseif(FLJ("UsingQuote&Curly")) then
        if(CheckSwitchFreeMode("MonsterX")) then
            return;
        end
        MS4("\nChallenge MonsterX?")YNJ()
        if(YES()) then
            CLO()
            FAO(3)TRA("CS_bossrush_eyex","QuickMonsterXBoss",40,23)
        end
    else
        TUR()MS4("\nOnly Quote & Curly can play this challenge.")NOD()
    end
end

function SwitchQuoteAndCurly()
    PRI()
    MS4("\nSwitch to Quote & Curly?")YNJ()
    if(YES()) then
        CLR()
        FAC("curly_happy")CAT("\nLeave it to us!")NOD()CLO()
        FAO(2)
        HideCurrentPlayer();
        --切换为库特卡莉
        SetUsingMycharFlag("UsingQuote&Curly")
        TRA("CS_bossrush_mainstage","QuoteAndCurlyGo",32,83)
    end
end

function QuoteAndCurlyGo()
    PRI()
    HMC(0)
    HMC(1)
    SMC("CS_mychar_quote_p1")
    SMC("CS_mychar_curly_p2")
    if(GOP() == 1) then
        AGP("CS_mychar_curly_p2",true)
    end
    SPL(0,"CS_mychar_quote_p1")
    SPL(1,"CS_mychar_curly_p2")
    MOV(32,83,0)
    MOV(31,83,1)
    FAI(0)
end

function Quote1()
    SwitchQuoteAndCurly()
end
function Curly1()
    SwitchQuoteAndCurly()
end

function Door_GoQuoteCurlyChapter()
    KEY()
    SOU("CS_011_door")
    ANP("Door_GoQuoteCurlyChapter",0,1)WAI(10)HideCurrentPlayer()
    ANP("Door_GoQuoteCurlyChapter",0,0)
    MOV(35,83)WAI(50)
    SOU("CS_011_door")
    ANP("Door_GoKingChapter2",0,1)SLR(0)ShowCurrentPlayer()WAI(10)
    ANP("Door_GoKingChapter2",0,0)
end

function Door_GoKingChapter2()
    KEY()
    SOU("CS_011_door")
    ANP("Door_GoKingChapter2",0,1)WAI(10)HideCurrentPlayer()
    ANP("Door_GoKingChapter2",0,0)
    MOV(35,60)WAI(50)
    SOU("CS_011_door")
    ANP("Door_GoQuoteCurlyChapter",0,1)SLR(0)ShowCurrentPlayer()WAI(10)
    ANP("Door_GoQuoteCurlyChapter",0,0)
end

function PathLifeCapsule7()
    PRI()SOU("CS_022_chest_open")DNP("PathLifeCapsule7")FLP("PathLifeCapsule7")
    MS4("Obtained =LIFE CAPSULE=!")NOD()
    MLP(5)
    CAT("\nMaximum HP increased by 5!")NOD()
end

function Chest_SpurCharger()
    if(FLJ("Chest_SpurCharger")) then
        Chest_SpurCharger_Opened()
    else
        PRI()
        FLP("Chest_SpurCharger")
        ITP("SpurCharger")
        SOU("CS_022_chest_open")
        ANP("Chest_SpurCharger",0,1)
        MS4("Opened the chest.")NOD()CLR()
        GIT("SpurCharger")
        SOU("CS_038_get_item")
        CAT("\nGot the =SPUR CHARGER=.")NOD()
    end
end

function Chest_SpurCharger_Opened()
    PRI()
    MS4("\nIt's empty...")NOD()CLR()
end

function Chest_MachinegunWheelModule()
    if(FLJ("Chest_MachinegunWheelModule")) then
        Chest_MachinegunWheelModule_Opened()
    else
        PRI()
        FLP("Chest_MachinegunWheelModule")
        ITP("MachinegunWheelModule")
        SOU("CS_022_chest_open")
        ANP("Chest_MachinegunWheelModule",0,1)
        MS4("Opened the chest.")NOD()CLR()
        GIT("MachinegunWheelModule")
        SOU("CS_038_get_item")
        CAT("\nGot the =MACHINEGUN WHEEL MODULE=.")NOD()
    end
end

function Chest_MachinegunWheelModule_Opened()
    PRI()
    MS4("\nIt's empty...")NOD()CLR()
end

function Chest_LiftPot1_Opened()
    PRI()
    MS4("\nIt's empty...")NOD()CLR()
end

function Chest_LiftPot1()
    if(FLJ("Chest_LiftPot1")) then
        Chest_LiftPot1_Opened()
    else
        PRI()
        FLP("Chest_LiftPot1")
        ITP("LifePot")
        SOU("CS_022_chest_open")
        ANP("Chest_LiftPot1",0,1)
        MS4("Opened the chest.")NOD()CLR()
        GIT("LifePot")
        SOU("CS_038_get_item")
        CAT("\nGot the =LIFE POT=.")NOD()
    end
end

function Chest_LiftPot2_Opened()
    PRI()
    MS4("\nIt's empty...")NOD()CLR()
end

function Chest_LiftPot2()
    if(FLJ("Chest_LiftPot2")) then
        Chest_LiftPot2_Opened()
    else
        PRI()
        FLP("Chest_LiftPot2")
        ITP("LifePot")
        SOU("CS_022_chest_open")
        ANP("Chest_LiftPot2",0,1)
        MS4("Opened the chest.")NOD()CLR()
        GIT("LifePot")
        SOU("CS_038_get_item")
        CAT("\nGot the =LIFE POT=.")NOD()
    end
end
-----------------------------奖杯--------------------------
function Door_GoCup()
    KEY()
    SOU("CS_011_door")
    ANP("Door_GoCup",0,1)WAI(10)HideCurrentPlayer()
    ANP("Door_GoCup",0,0)
    MOV(4,112)WAI(50)
    SOU("CS_011_door")
    ANP("Door_Back",0,1)SLR(1)ShowCurrentPlayer()WAI(10)
    ANP("Door_Back",0,0)
end

function Door_Back()
    KEY()
    TUR()MS4("\nCannot return!")NOD()
end

function TouchCup1()
    KEY()
    DNP()
    CMU("XXXX")
    CNP("Firework1","CS_pe_fireworks",0)
    --停止计时器
    if(not FLJ("FreeMode")) then
        TIM(true,false)
        --如果是新纪录
        if(STC()) then
            CMU("CS_White")
        else
            CMU("CS_Toroko")
        end
    else
        CMU("CS_Balcony")
    end
    ANP("Cup1","get")
    SOU("CS_022_chest_open")
    WAI(60)
    MS2("\n")
    CAT("Boss Rush cleared! Congratulations!~",2)
    WAI(9999)
end