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

function InitRoom()
    if(FLJ("KanpaGoSaveMahin")) then
        CMU("CS_Escape")
        SNP("CS_quake",1,1,0,"mainLayer","Quake1")
    else
        CMU("CS_Grand")
    end
end

function GoFortressCrashedRoom()
    PRI()FAO(1)TRA("CS_fortress_crashedroom","E0093",7,15)
end

function GoFortressEntrance()
    PRI()
    FAC("curly_normal")MS3("回去的路被闸门关闭了，")NOD()
    CAT("\n我们只能往前走了。")NOD()
end

function MonsterXAppear()
    KEY()
    SNP("CS_monsterx_animate",15,55,0,"mainLayer","MonsterX0")
    ANP("MonsterX0","face1")
    CMU("CS_Dr")
    FON("Camera1",1)
    ANP("Kanpa1",204)
    FAI(2)
    WAI(32)
    MS3("什么叫咪咪卡和鱼都可兼得，")NOD()ANP("MonsterX0","face2")
    CAT("\n这就是啊~")NOD()CLR()ANP("MonsterX0","face1")
    CAT("原来当时让你帮我找马宾")
    CAT("\n都是骗人的嘛...")NOD()CLR()
    ANP("MonsterX0","face2")CAT("是说那只胖咪咪卡嘛？")NOD()
    CAT("\n当时就是我绑架他的。")NOD()CLR()
    CAT("\n而且我知道你一定会出来找他。")NOD()CLR()ANP("MonsterX0","face1")
    CAT("\n你为什么要绑架马宾？")NOD()CLR()
    ANP("MonsterX0","face2")CAT("\n因为我想要这条大鱼呀~")NOD()CLR()ANP("MonsterX0","face1")
    ANP("Sue1","angry")
    FAC("sue_angry")CAT("真可恶！你这只大坏猫！")NOD()
    CAT("\n库特和卡莉一定痛扁你一顿的。")NOD()CLO()
    ANP("Sue1","normal")
    WAI(16)
    FAC("sue_normal")MS3("\n!")
    ANP("MonsterX0","sit")
    for i=0,15,1 do
        SOU("CS_026_quake")
        WAI(8)
    end
    NOD()CLR()
    CAT("\n那是什么声音？")NOD()CLR()
    FAC()CAT("看来真是说到就到啊，")NOD()
    ANP("MonsterX0","face1")CAT("\n他们马上就要到")
    CAT("\n我精心准备的陷阱房了。")NOD()CLR()
    ANP("MonsterX0","face2")CAT("用不了多久他们就会变成废铁，")NOD()
    CAT("\n而你们就变成我的玩物。")NOD()CLO()ANP("MonsterX0","face1")
    WAI(32)
    WAI(16)
    ANP("MonsterX0","sit")MS3("不过既然他们来了，")
    CAT("\n我也不能在这干等着，")NOD()CLR()
    ANP("MonsterX0","sit",1)
    CAT("你们几个，")NOD()
    CAT("\n给我看好这些咪咪卡和鱼。")NOD()
    CAT("\n我去去就回~")NOD()CLR()
    CAT("\n遵命！")NOD()CLO()
    FAO(2)
    DNP("MonsterX0")
    FAI(0)
    WAI(32)
    ANP("Shutter1","down")
    WAI(128)
    ANP("Shutter1","stop")
    WAI(32)
    PMU(5)
    FAC("sue_sad")MS3("\n库特、卡莉你们要小心啊。")NOD()CLR()
    FAC("toroko_><")CAT("\n祈祷！")NOD()CLO()
    MOV(10,36)
    FOM()
    WAI(32)
    SMC(0)SMC(1)
    CMU("CS_Grand")
end

function Test1()
    DNP("Test1")
    --PRI()FAO(2)HMC()Escape()
    MOV(42,23)DefeatedMonsterX()
    --PRI()FAO(2)HMC()TRA("CS_fortress","KanpaGoSaveMahin",52,49)
end

function DefeatedMonsterX()
    KEY()
    ANP("Kanpa1",204)
    FAC("curly_happy")MS3("\n我们击败它了！")NOD()CLO()
    WAI(60)
    SOU("CS_Cat")
    WAI(16)
    MS3("可恶，")NOD()
    CAT("\n就算我无法打败你们，")NOD()
    CAT("\n我也不会就让你们这么便宜的离开。")NOD()CLR()
    CAT("我先撤了，")NOD()
    CAT("\n你们自己看着办吧...")NOD()CLR()
    FAC("curly_normal")MS3("\n？")NOD()CLR()
    SOU("CS_043_computer_beep")
    FAC()MS3("[要塞自毁程序已经启动！")NOD()
    CAT("\n距离爆炸还有5分钟。]")WAI(16)NOD()CLO()
    SNP("CS_quake",1,1,0,"mainLayer","Quake1")
    FAC("curly_normal")MS3("库特！我们得在爆炸前")
    CAT("\n赶快找到大家逃离这里。")NOD()
    CAT("\n他们一定就在这里的某个地方！")NOD()CLO()
    ANP("CenterCamera","disable_focus")
    FON("Camera1")
    ANP("Shutter1","reset_pos")
    ANP("Shutter1","down_immed")
    WAI(32)
    CMU("CS_Escape")
    WAI(32)
    HMC()
    FAC("sue_normal")MS3("发生什么事了！")NOD()
    CAT("\n怎么突然开始摇晃了？")NOD()CLO()
    ANP("GaudiArmoured2","normal",1)
    WAI(16)
    ANP("GaudiArmoured1","normal",1)
    FAC()MS3("不好！基地要自爆了，")NOD()
    CAT("\n我们得溜了。")NOD()CLO()
    ANP("GaudiArmoured2","walk")
    WAI(16)
    ANP("GaudiArmoured1","walk")
    WAI(32)
    ANP("Terminal1","wake_up")
    ANP("GaudiArmoured2","normal")
    WAI(16)
    TUR()MS3("\n[请输入密码:")WAI(60)
    CAT("*")WAI(16)CAT("*")WAI(16)
    ANP("GaudiArmoured1","normal")
    CAT("*")WAI(16)CAT("*")WAI(16)CAT("*")WAI(16)CAT("*")WAI(16)CLR()
    CAT("\n[密码正确]")WAI(32)CLR()
    CAT("\n[正在打开闸门....]")WAI(32)CLO()
    ANP("Shutter1","up")
    WAI(64)
    ANP("GaudiArmoured2","walk")
    WAI(16)
    ANP("GaudiArmoured1","walk")
    WAI(48)
    ANP("Shutter1","stop")
    WAI(48)
    ANP("Sue1","angry")
    FAC("sue_angry")MS3("嘿！")WAI(32)CAT("你们倒是回来")WAI(32)
    CAT("\n把我们的铁门打开啊！")WAI(120)CLO()
    DNP("GaudiArmoured2")
    DNP("GaudiArmoured1")
    ANP("Sue1","back")
    TUR(false)FAC("sue_sad")MS3("\n唉，我们没救了嘛...")NOD()CLR()
    FAC("toroko_><")CAT("不要放弃啊数姐姐！")NOD()
    CAT("\n我们肯定还有办法的。")NOD()CLR()
    ANP("Sue1","normal")
    FAC("jack_normal")CAT("没错！")NOD()
    CAT("\n这个铁门虽然牢固，")NOD()
    CAT("\n但它的门框在刚才的爆炸震动时")
    CAT("\n已经几乎损坏了。")NOD()CLR()
    CAT("我们所有人只要同时一起使劲")
    CAT("\n肯定能把它撞开的！")NOD()CLR()
    FAC("sue_normal")CAT("我知道了，")NOD()
    CAT("\n我们一起使劲吧！")NOD()CLO()
    WAI(32)
    MS3("\n3..")WAI(32)CAT("2..")WAI(32)CAT("1..")WAI(32)CLO()
    SOU("CS_071_little_crash")
    CMP("cmpLayer_1","bk","CS_pe_smoke")
    WAI(32)
    FAC("sue_normal")MS3("成功了！")NOD()
    ANP("Sue1","angry")
    FAC("sue_angry")CAT("\n我们赶快逃离这个地方吧！")NOD()CLO()
    FAO(2)
    FOM()
    TRA("CS_fortress","Escape",51,49)
end

function Escape()
    KEY()
    DNP("GaudiArmoured1")
    DNP("GaudiArmoured2")
    DNP("Jack1")
    DNP("Santa1")
    DNP("Sue1")
    DNP("Chako1")
    DNP("Toroko1")
    DNP("Kanpa1")

    CMP("cmpLayer_1","bk","CS_pe_smoke")
    SNP("CS_quake",1,1,0,"mainLayer","Quake1")
    local start_x = 50;
    MNP("Pushcart1",start_x,49,0)
    MNP("Fishtank1",start_x+1,48,0)
    ANP("Fishtank1","wink",1)
    ANP("Pushcart1","move",1)
    SNP("CS_mychar_kanpa_animate",47,49,1,"mainLayer","Kanpa1")
    ANP("Kanpa1","walk",1)
    SNP("CS_jack_animate",50,49,1,"mainLayer","Jack1")
    ANP("Jack1","ignoreMovePlatform",1)
    ANP("Jack1","walk",1)
    SNP("CS_santa_animate",start_x+1,49,1,"mainLayer","Santa1")
    ANP("Santa1","ignoreMovePlatform",1)
    ANP("Santa1","walk",1)
    SNP("CS_chako_animate",start_x+2,49,1,"mainLayer","Chako1")
    ANP("Chako1","ignoreMovePlatform",1)
    ANP("Chako1","walk",1)
    SNP("CS_sue_animate",start_x+3,49,1,"mainLayer","Sue1")
    ANP("Sue1","ignoreMovePlatform",1)
    ANP("Sue1","walk",1)
    SNP("CS_toroko_animate",start_x+4,49,1,"mainLayer","Toroko1")
    ANP("Toroko1","ignoreMovePlatform",1)
    ANP("Toroko1","walk",1)
    CMU("CS_Escape")
    FON("Camera2",1)
    ANP("Kanpa1",204)
    FAI(0)
    WAI(64)
    ANP("Kanpa1","normal",1)
    WAI(96)
    ANP("Jack1","normal",0)
    WAI(32)
    FAC("jack_normal")MS3("间八！你怎么停下来了")NOD()
    CAT("\n快和我们一起逃啊！")NOD()CLR()
    FAC()CAT("\n可是还没有找到马宾...")NOD()CLR()
    FAC("jack_><")CAT("啊，")NOD()
    CAT("\n我都把他忘的一干二净了。")NOD()CLR()
    FAC("jack_normal")CAT("那你快去找他吧！")NOD()
    CAT("\n我们在后面等你。")NOD()CLO()
    ANP("Jack1","walk",1)
    WAI(64)
    FAO(2)
    FOM()
    TRA("CS_fortress","KanpaGoSaveMahin",52,49)
end

function KanpaGoSaveMahin()
    KEY()
    DNP("GaudiArmoured1")
    DNP("GaudiArmoured2")
    DNP("Jack1")
    DNP("Santa1")
    DNP("Sue1")
    DNP("Chako1")
    DNP("Toroko1")
    DNP("Kanpa1")
    DNP("Pushcart1")
    DNP("Fishtank1")
    FLP("KanpaGoSaveMahin")
    CMU("CS_Escape")
    CMP("cmpLayer_1","bk","CS_pe_smoke")
    SNP("CS_quake",1,1,0,"mainLayer","Quake1")
    --创建间八
    SGP("CS_mychar_kanpa",52,49,1,"CS_mychar_kanpa_p1")
    SPL(0,"CS_mychar_kanpa_p1")
    if(GOP() == 2) then
        --再加入一个间八让玩家2控制
        SGP("CS_mychar_kanpa",52,49,1,"CS_mychar_kanpa_p2")
        SPL(1,"CS_mychar_kanpa_p2")
        P2A(false)--禁止玩家2使用AI切换
    else
        --玩家2置为NULL
        SGP("null",73,27,0,"CS_mychar_null_p2")
        SPL(1,"CS_mychar_null_p2")
    end
    WAI(1)
    AMC("show_fishing_rod","CS_mychar_kanpa")
    AMC(204,"CS_mychar_kanpa")
    FAI(0)
    SNP("pe_smog",43,36,0,"mainLayer","null")
    CNP("SavePoint","CS_savepoint",0)
    --设定血量
    if(FLJ("GaveTheFish")) then
        MLP(5)
    end
    if(FLJ("PathLifeCapsule1")) then
        MLP(5)
    end
    if(FLJ("Fishing1")) then
        MLP(1)
    end
    if(FLJ("Fishing2")) then
        MLP(2)
    end
    if(FLJ("Fishing3")) then
        MLP(3)
    end
    if(FLJ("Fishing4")) then
        MLP(2)
    end
    --清除物品
    ITS()
    ITP("Spikes")
    --设置任务
    MSD()
    MSA("SaveEveryoneKing")
end

function Terminal1()
    PRI()
    TUR()MS3("\n[闸门已打开]")NOD()
end

function GoFindMahin()
    KEY()
    MYB(1,PLY())
    WAS()
    MS4("\n我必须去寻找马宾...")NOD()
end

function InitCmpMap()
    DNP("InitCmpMap")
    CMP("cmpLayer_1","bk")
    SNP("CS_quake",1,1,0,"mainLayer","Quake1")
end

function HelloMonsterX()
    KEY()
    DNP("HelloMonsterX")
    --[[
    if true then
        --StartWaterSpaceTrap()
        FightWithMonsterX()
        return
    end
    --]]
    FAO(2)
    MOV(37,23,MCI("CS_mychar_quote"))
    MOV(35,23,MCI("CS_mychar_curly"))
    SLR(1)
    MM0()
    --暂时解除AI
    if(GOP() == 1) then
        if(PLY() == 0) then
            AGP("CS_mychar_curly_p2",false)
        else
            AGP("CS_mychar_quote_p1",false)
        end
    end
    AMC("walk",1)
    FAI(0)
    PMU(5)
    WAI(60)
    AMC("normal")
    ANP("CenterCamera","disable_focus")
    FON("Camera3")
    ANP("Shutter2","down")
    WAI(128)
    ANP("Shutter2","stop")
    SLR(0)
    FON("Camera4")
    ANP("Shutter3","down")
    WAI(128)
    ANP("Shutter3","stop")
    FOM()
    ANP("CenterCamera","enable_focus")
    WAI(64)
    SLR(1,MCI("CS_mychar_curly"))
    FAC("curly_normal")MS3("糟了库特，")NOD()
    CAT("\n我们被困在这里了。")NOD()CLO()
    WAI(64)
    ANP("Eye","show")
    WAI(32)
    ANP("Eye",1)
    WAI(32)
    ANP("Eye",2)
    WAI(32)
    ANP("Eye","down")
    ANP("Eye",3)
    WAI(16)
    ANP("Eye",4)
    WAI(16)
    ANP("Eye","stop")
    WAI(32)
    MS3("你们就是那些咪咪卡")
    CAT("\n所说的机器人伙伴了吧，")NOD()
    CAT("\n好像还有一个有点面熟...")NOD()CLO()
    AMC("back")
    WAI(32)
    FAC("curly_normal")MS3("\n！")NOD()CLR()
    CAT("\n你是谁？")NOD()CLR()
    FAC()CAT("\n我是抓走你们咪咪卡的主谋。")NOD()CLR()
    FAC("curly_normal")CAT("\n你把他们藏到哪里了？")NOD()CLR()
    FAC()CAT("这个嘛，")NOD()
    CAT("\n就算告诉你们了也没有用。")NOD()CLR()
    CAT("因为你们马上就要死在这里了，")NOD()
    CAT("\n抓你们比抓老鼠还简单。")NOD()CLR()
    FAC("curly_normal")CAT("\n老鼠？")NOD()CLR()
    ANP("Eye",5)
    FAC()CAT("这里是捕鼠笼，")NOD()
    CAT("\n你们是老鼠！！")NOD()CLR()
    ANP("Eye",4)
    FAC()CAT("\n.")WAI(16)CAT(".")WAI(16)CAT(".")WAI(16)CAT(".")WAI(16)CAT(".")WAI(16)CAT(".")WAI(16)CLR()
    ANP("Eye",0)
    FAC()CAT("算了不解释了，")NOD()
    CAT("\n你们两个脑容量不足的机器人，")NOD()
    ANP("Eye",2)
    CAT("\n在这个房间里好好享受吧...")NOD()CLO()
    WAI(16)
    ANP("Eye",1)
    WAI(16)
    ANP("Eye",0)
    WAI(16)
    ANP("Eye","hide")
    WAI(60)
    AMC("normal")
    WAI(60)
    FAC("curly_normal")MS3("库特，看样子大家有可能就在附近，")NOD()
    CAT("\n等我们离开这个房间之后，")NOD()
    CAT("\n应该就可以找到他们了。")NOD()CLO()
    --启用AI
    if(GOP() == 1) then
        if(PLY() == 0) then
            AGP("CS_mychar_curly_p2",true)
        else
            AGP("CS_mychar_quote_p1",true)
        end
    end
    WAI(32)
    local smallBlockIndex = math.random(0,19)
    local setX = 22;
    local setY = 6;
    for i=0,19,1 do
        if(i == smallBlockIndex) then
            SNP("CS_fortblock_small",setX,setY+1,0,"mainLayer","FortBlock1")
            SNP("CS_fortblock_small",setX,setY,0,"mainLayer","FortBlock1")
            setX = setX + 1;
        else
            SNP("CS_fortblock",setX,setY,0,"mainLayer","FortBlock1")
            setX = setX + 2;
        end
    end
    ANP("FortBlock1","adjust_pos")
    ANP("FortBlock1","set_smog")
    WAI(30)
    ANP("FortBlock1","press")
    WAI(30)
    AMC("look_up")
    WAI(30)
    CMU("CS_Zonbie")
    PRI()
    FAC("curly_normal")MS3("是液压机！")NOD()
    CAT("\n它想直接把我们压成铁片。")NOD()CLR()
    CAT("快点想想办法怎么")
    CAT("\n逃离这个危机")NOD()CLO()
    --设置事件延时计时器
    ANP("HydraulicPressCountdown","countdown",1080)
end

function HydraulicPressCountdown()
    KEY()
    ANP("FortBlock1","destroy")
    PMU(5)
    WAI(60)
    ANP("Eye","reset_pos")
    ANP("Eye","show")
    WAI(32)
    ANP("Eye",1)
    WAI(32)
    ANP("Eye",2)
    WAI(32)
    ANP("Eye","down")
    ANP("Eye",3)
    WAI(16)
    ANP("Eye",4)
    WAI(16)
    ANP("Eye","stop")
    WAI(32)
    MS3("\n果然处理你们没有这么容易嘛...")NOD()CLR()
    CAT("不过没关系，")NOD()
    CAT("\n我还有其他陷阱。")NOD()CLR()
    CAT("\n你们好好期待吧~")NOD()CLO()
    ANP("Eye",1)
    WAI(16)
    ANP("Eye",0)
    WAI(16)
    ANP("Eye","hide")
    WAI(60)
    FAC("curly_sad")MS3("看样子接下来")
    CAT("\n我们还要遭受蛮多折磨")NOD()CLR()
    FAC("curly_normal")CAT("在击败它之前")
    CAT("\n库特，我们一定要坚持住！")NOD()CLO()
    WAI(60)
    --放置激光武器
    local delaycount = 60;
    for i=1,39,1 do
        local eventName = "LasertrapEvent"..i;
        CNP(eventName,"CS_enemy_lasertrap",0)
        ANP(eventName,"set_smog")
        ANP(eventName,"delay",delaycount)
        delaycount = delaycount + 20;
    end
    CMU("CS_Gravity")
end

function LasertrapAllDestroy()
    --检查所有的激光是否被摧毁
    if(FLJ("Lasertrap1") and FLJ("Lasertrap2") and FLJ("Lasertrap3") and FLJ("Lasertrap4") and FLJ("Lasertrap5") and
    FLJ("Lasertrap6") and FLJ("Lasertrap7") and FLJ("Lasertrap8") and FLJ("Lasertrap9") and FLJ("Lasertrap10") and
    FLJ("Lasertrap11") and FLJ("Lasertrap12") and FLJ("Lasertrap13") and FLJ("Lasertrap14") and FLJ("Lasertrap15") and
    FLJ("Lasertrap16") and FLJ("Lasertrap17") and FLJ("Lasertrap18") and FLJ("Lasertrap19") and FLJ("Lasertrap20") and
    FLJ("Lasertrap21") and FLJ("Lasertrap22") and FLJ("Lasertrap23") and FLJ("Lasertrap24") and FLJ("Lasertrap25") and
    FLJ("Lasertrap26") and FLJ("Lasertrap27") and FLJ("Lasertrap28") and FLJ("Lasertrap29") and FLJ("Lasertrap30") and
    FLJ("Lasertrap31") and FLJ("Lasertrap32") and FLJ("Lasertrap33") and FLJ("Lasertrap34") and FLJ("Lasertrap35") and
    FLJ("Lasertrap36") and FLJ("Lasertrap37") and FLJ("Lasertrap38") and FLJ("Lasertrap39")) then
        StartWaterSpaceTrap()
    end
end

function LasertrapEvent1()FLP("Lasertrap1")LasertrapAllDestroy()end
function LasertrapEvent2()FLP("Lasertrap2")LasertrapAllDestroy()end
function LasertrapEvent3()FLP("Lasertrap3")LasertrapAllDestroy()end
function LasertrapEvent4()FLP("Lasertrap4")LasertrapAllDestroy()end
function LasertrapEvent5()FLP("Lasertrap5")LasertrapAllDestroy()end
function LasertrapEvent6()FLP("Lasertrap6")LasertrapAllDestroy()end
function LasertrapEvent7()FLP("Lasertrap7")LasertrapAllDestroy()end
function LasertrapEvent8()FLP("Lasertrap8")LasertrapAllDestroy()end
function LasertrapEvent9()FLP("Lasertrap9")LasertrapAllDestroy()end
function LasertrapEvent10()FLP("Lasertrap10")LasertrapAllDestroy()end
function LasertrapEvent11()FLP("Lasertrap11")LasertrapAllDestroy()end
function LasertrapEvent12()FLP("Lasertrap12")LasertrapAllDestroy()end
function LasertrapEvent13()FLP("Lasertrap13")LasertrapAllDestroy()end
function LasertrapEvent14()FLP("Lasertrap14")LasertrapAllDestroy()end
function LasertrapEvent15()FLP("Lasertrap15")LasertrapAllDestroy()end
function LasertrapEvent16()FLP("Lasertrap16")LasertrapAllDestroy()end
function LasertrapEvent17()FLP("Lasertrap17")LasertrapAllDestroy()end
function LasertrapEvent18()FLP("Lasertrap18")LasertrapAllDestroy()end
function LasertrapEvent19()FLP("Lasertrap19")LasertrapAllDestroy()end
function LasertrapEvent20()FLP("Lasertrap20")LasertrapAllDestroy()end
function LasertrapEvent21()FLP("Lasertrap21")LasertrapAllDestroy()end
function LasertrapEvent22()FLP("Lasertrap22")LasertrapAllDestroy()end
function LasertrapEvent23()FLP("Lasertrap23")LasertrapAllDestroy()end
function LasertrapEvent24()FLP("Lasertrap24")LasertrapAllDestroy()end
function LasertrapEvent25()FLP("Lasertrap25")LasertrapAllDestroy()end
function LasertrapEvent26()FLP("Lasertrap26")LasertrapAllDestroy()end
function LasertrapEvent27()FLP("Lasertrap27")LasertrapAllDestroy()end
function LasertrapEvent28()FLP("Lasertrap28")LasertrapAllDestroy()end
function LasertrapEvent29()FLP("Lasertrap29")LasertrapAllDestroy()end
function LasertrapEvent30()FLP("Lasertrap30")LasertrapAllDestroy()end
function LasertrapEvent31()FLP("Lasertrap31")LasertrapAllDestroy()end
function LasertrapEvent32()FLP("Lasertrap32")LasertrapAllDestroy()end
function LasertrapEvent33()FLP("Lasertrap33")LasertrapAllDestroy()end
function LasertrapEvent34()FLP("Lasertrap34")LasertrapAllDestroy()end
function LasertrapEvent35()FLP("Lasertrap35")LasertrapAllDestroy()end
function LasertrapEvent36()FLP("Lasertrap36")LasertrapAllDestroy()end
function LasertrapEvent37()FLP("Lasertrap37")LasertrapAllDestroy()end
function LasertrapEvent38()FLP("Lasertrap38")LasertrapAllDestroy()end
function LasertrapEvent39()FLP("Lasertrap39")LasertrapAllDestroy()end

function StartWaterSpaceTrap()
    KEY()
    PMU(5)
    WAS()
    WAI(60)
    FAC("curly_normal")MS3("\n呼，总算是活下来了")NOD()CLO()
    WAI(60)
    ANP("Eye","reset_pos")
    ANP("Eye","show")
    WAI(32)
    ANP("Eye",1)
    WAI(32)
    ANP("Eye",2)
    WAI(32)
    ANP("Eye","down")
    ANP("Eye",3)
    WAI(16)
    ANP("Eye",4)
    WAI(16)
    ANP("Eye","stop")
    WAI(32)
    MS3("\n还没完呢！")NOD()CLR()
    CAT("接下来是食人鱼...")NOD()CLO()
    ANP("Eye",1)
    WAI(16)
    ANP("Eye",0)
    WAI(16)
    ANP("Eye","hide")
    WAI(60)
    FAC("curly_normal")MS3("这次是鱼嘛...")NOD()
    CAT("\n不过在这种空荡荡的地方...")NOD()CLO()
    SNP("CS_pe_waterfallbase",22,5,0,"mainLayer","Waterfallbase1")ANP("Waterfallbase1","set_style",0)
    SNP("CS_pe_waterfallbase",23,5,0,"mainLayer","Waterfallbase2")ANP("Waterfallbase2","set_style",1)
    SNP("CS_pe_waterfallbase",24,5,0,"mainLayer","Waterfallbase3")ANP("Waterfallbase3","set_style",2)
    SNP("CS_pe_waterfallbase",58,5,0,"mainLayer","Waterfallbase1")ANP("Waterfallbase1","set_style",0)
    SNP("CS_pe_waterfallbase",59,5,0,"mainLayer","Waterfallbase2")ANP("Waterfallbase2","set_style",1)
    SNP("CS_pe_waterfallbase",60,5,0,"mainLayer","Waterfallbase3")ANP("Waterfallbase3","set_style",2)
    SNP("CS_stream_noise",0,0,0,"mainLayer","StreamNoise1")
    WAI(120)
    FAC("curly_sad")TUR()MS3("\n居然是这样...")WAI(120)CLO()
    KEY(false)
    ANP("Waterlevel1","up")
    WAI(60)
    for i=22,60,2 do
        SNP("CS_pe_bubble_base",i,23,0,"mainLayer","PeBubbleBase1")
    end
    WAI(200)
    ANP("Waterlevel1","stop")
    DNP("Waterfallbase1")
    DNP("Waterfallbase2")
    DNP("Waterfallbase3")
    DNP("Waterfallbase4")
    DNP("Waterfallbase5")
    DNP("Waterfallbase6")
    WAI(60)
    DNP("StreamNoise1")
    ANP("PiranhaSetter1","set_npc_type")ANP("PiranhaSetter1","CS_enemy_piranha")
    ANP("PiranhaSetter1","set_npc_num",10)
    ANP("PiranhaSetter1","set_npc_interval",60)
    ANP("PiranhaSetter1","start")
    ANP("PiranhaSetter2","set_npc_type")ANP("PiranhaSetter2","CS_enemy_piranha")
    ANP("PiranhaSetter2","set_npc_num",10)
    ANP("PiranhaSetter2","set_npc_interval",60)
    ANP("PiranhaSetter2","start")
    CMU("CS_OppressionBetaExtra")
end

function PiranhaSetter1()
    FLP("PiranhaSetter1")
    PiranhaSetterAllDestroy()
end

function PiranhaSetter2()
    FLP("PiranhaSetter2")
    PiranhaSetterAllDestroy()
end

function PiranhaSetterAllDestroy()
    if(FLJ("PiranhaSetter1") and FLJ("PiranhaSetter2")) then
        --水位下降
        PMU(5)
        ANP("Waterlevel1","down")
        WAI(200)
        DNP("PeBubbleBase1")
        WAI(60)
        ANP("Waterlevel1","stop")
        WAI(60)
        KEY()
        ANP("Eye","reset_pos")
        ANP("Eye","show")
        WAI(32)
        ANP("Eye",1)
        WAI(32)
        ANP("Eye",2)
        WAI(32)
        ANP("Eye","down")
        ANP("Eye",3)
        WAI(16)
        ANP("Eye",4)
        WAI(16)
        ANP("Eye","stop")
        WAI(32)
        MS3("\n没想到鱼都被你们处理掉了...")NOD()CLR()
        CAT("接下来是最后一个...")NOD()CLO()
        ANP("Eye",1)
        WAI(16)
        ANP("Eye",0)
        WAI(16)
        ANP("Eye","hide")
        WAI(60)
        FAC("curly_normal")MS3("最后一个嘛...")NOD()
        CAT("\n有种不太好的预感...")NOD()CLO()
        WAI(60)
        ANP("BombSetter1","set_npc_type")ANP("BombSetter1","CS_enemy_trackingbomb")
        ANP("BombSetter1","set_npc_num",10)
        ANP("BombSetter1","set_npc_interval",60)
        ANP("BombSetter1","start")
        ANP("BombSetter2","set_npc_type")ANP("BombSetter2","CS_enemy_trackingbomb")
        ANP("BombSetter2","set_npc_num",10)
        ANP("BombSetter2","set_npc_interval",60)
        ANP("BombSetter2","start")
        CMU("CS_ironH")
    end
end

function BombSetter1()
    FLP("BombSetter1")
    BombSetterAllDestroy()
end

function BombSetter2()
    FLP("BombSetter2")
    BombSetterAllDestroy()
end

function BombSetterAllDestroy()
    if(FLJ("BombSetter1") and FLJ("BombSetter2")) then
        WAI(300)
        FightWithMonsterX()
    end
end

function FightWithMonsterX()
    KEY()
    PMU(5)
    WAS()
    WAI(60)
    FAC("curly_happy")MS3("\n我们熬过来了！")NOD()CLO()
    WAI(60)
    ANP("Eye","reset_pos")
    ANP("Eye","show")
    WAI(32)
    ANP("Eye",1)
    WAI(32)
    ANP("Eye",2)
    WAI(32)
    MS3("真是受不了，")NOD()
    CAT("\n还是得我亲自来处理你们！")NOD()CLO()
    ANP("MonsterX1","fight")
    ANP("Eye","hide")
    BSL("MonsterX1")
    CMU("CS_FireEye")
    --CMU("CS_LastBtl3")
    --ANP("MonsterX1","second_form")
end

function ScreenShattered()
    ANP("MonsterXScreen1",1,0)
end

function MonsterXSecondForm()
    KEY()
    PMU(5)
    WAS()
    WAI(60)
    FAC()MS3("你们怎么还不倒下，")NOD()
    CAT("\n我要生气了！嗷呜————————！")NOD()CLO()
    CMU("CS_LastBtl3")
    ANP("MonsterX1","second_form")
end

function MonsterX1()
    PMU(5)
    ANP("MonsterXScreen1","defeated")
    WAI(100)
    DNP("MonsterX1")
    WAI(60)
    DefeatedMonsterX()
end