main.floors.MT21=
{
    "floorId": "MT21",
    "title": "第 21 层",
    "name": "第 21 层",
    "width": 13,
    "height": 13,
    "canFlyTo": false,
    "canUseQuickShop": false,
    "cannotViewMap": false,
    "images": [],
    "ratio": 1,
    "defaultGround": "ground",
    "firstArrive": [],
    "eachArrive": [],
    "parallelDo": "",
    "events": {
        "4,2": [
            {
                "type": "if",
                "condition": "flag:击败魔王",
                "true": [
                    "\t[hero]\b[hero]公主，我们走吧。",
                    {
                        "type": "playSound",
                        "name": "dialogue.mp3"
                    },
                    "\t[公主,princess]\b[down]好，快走吧。",
                    {
                        "type": "playSound",
                        "name": "dialogue.mp3"
                    },
                    {
                        "type": "setValue",
                        "name": "flag:救出公主",
                        "value": "true"
                    },
                    {
                        "type": "hide",
                        "remove": true
                    }
                ],
                "false": [
                    "\t[公主,princess]\b[down]你终于来了，快杀死大恶魔了。",
                    {
                        "type": "playSound",
                        "name": "dialogue.mp3"
                    },
                    "\t[hero]\b[hero]好，公主，你等着。",
                    {
                        "type": "playSound",
                        "name": "dialogue.mp3"
                    }
                ]
            }
        ],
        "8,2": [
            {
                "type": "if",
                "condition": "flag:击败魔王",
                "true": [
                    {
                        "type": "if",
                        "condition": "flag:救出公主",
                        "true": [
                            "\t[hero]\b[hero]杰克，快走吧。",
                            {
                                "type": "playSound",
                                "name": "dialogue.mp3"
                            },
                            "\t[杰克,thief]\b[down]好，我去开门。",
                            {
                                "type": "setValue",
                                "name": "item:fly",
                                "value": "0"
                            },
                            {
                                "type": "playSound",
                                "name": "dialogue.mp3"
                            },
                            "\t[hero]\b[hero]啊，<风之罗盘>不见了，怎么办？",
                            {
                                "type": "playSound",
                                "name": "dialogue.mp3"
                            },
                            {
                                "type": "hide",
                                "remove": true
                            },
                            {
                                "type": "hide",
                                "loc": [
                                    [
                                        5,
                                        8
                                    ],
                                    [
                                        7,
                                        8
                                    ]
                                ],
                                "remove": true
                            }
                        ],
                        "false": [
                            "\t[杰克,thief]\b[down]别管我，先去救公主。",
                            {
                                "type": "playSound",
                                "name": "dialogue.mp3"
                            }
                        ]
                    }
                ],
                "false": [
                    "\t[hero]\b[hero]杰克，你可以帮我打开旁那神秘的门吗？",
                    {
                        "type": "playSound",
                        "name": "dialogue.mp3"
                    },
                    "\t[杰克,thief]\b[down]如果你可以让旁边的恶魔解开我身上的定身咒语，我就可以帮你打开门。",
                    {
                        "type": "playSound",
                        "name": "dialogue.mp3"
                    },
                    "\t[hero]\b[hero]好，你等一下。",
                    {
                        "type": "playSound",
                        "name": "dialogue.mp3"
                    }
                ]
            }
        ]
    },
    "changeFloor": {
        "6,8": {
            "floorId": ":before",
            "stair": "upFloor"
        }
    },
    "afterBattle": {
        "6,2": [
            "\t[冥灵魔王,vampire]\b[down]啊，怎么可能，我怎么可能会被你打败呢？不，不要这样。",
            {
                "type": "playSound",
                "name": "dialogue.mp3"
            },
            "\t[hero]\b[hero]我现在就要带走公主，你不等阻止我了吧？",
            {
                "type": "playSound",
                "name": "dialogue.mp3"
            },
            "\t[冥灵魔王,vampire]\b[down]哈哈哈，就算你现在带走公主也来不及了，因为我使用了魔法，这座塔还有90秒就倒了，",
            {
                "type": "playSound",
                "name": "dialogue.mp3"
            },
            "\t[冥灵魔王,vampire]\b[down]我先走了。",
            {
                "type": "playSound",
                "name": "dialogue.mp3"
            },
            {
                "type": "setValue",
                "name": "flag:击败魔王",
                "value": "true"
            },
            {
                "type": "choices",
                "text": "\t[作者,king]直接提交成绩？还是继续剧情？继续剧情将必须手动跑到0层！",
                "choices": [
                    {
                        "text": "直接提交",
                        "action": [
                            {
                                "type": "insert",
                                "name": "结局"
                            }
                        ]
                    },
                    {
                        "text": "继续剧情",
                        "action": [
                            "\t[作者,king]瞬移禁用！寻路改为至多3步！按键长按禁用！",
                            {
                                "type": "setValue",
                                "name": "flag:转场弹窗",
                                "value": "true"
                            },
                            {
                                "type": "setGlobalFlag",
                                "name": "enableMoveDirectly",
                                "value": false
                            },
                            {
                                "type": "function",
                                "function": "function(){\ncore.values.moveSpeed = 50;\n}"
                            },
                            {
                                "type": "function",
                                "function": "function(){\n// 初始化倒计时相关变量\ncore.setFlag(\"limitTimeLeft\", 1.5 * 60 * 1000);\ncore.setFlag(\"limitTimeUp\", false);\ncore.setFlag(\"limitTimePause\", false);\ncore.setFlag(\"__limitTimeLast__\", -1);\ncore.setFlag('__forbidSave__', true);\n\n\n// 注册倒计时帧动画\ncore.registerAnimationFrame(\n\t\"limitTimeFrame\",\n\ttrue,\n\tfunction (timestamp) {\n\t\t// 获取倒计时相关状态\n\t\tconst limitTimeLeft = core.getFlag(\"limitTimeLeft\");\n\t\tconst limitTimeUp = core.getFlag(\"limitTimeUp\");\n\t\tconst limitTimePause = core.getFlag(\"limitTimePause\");\n\n\t\t// 检查 limitTimeLeft 是否为 undefined，如果是则注销动画帧\n\t\tif (limitTimeLeft === undefined) {\n\t\t\tconsole.warn(\"limitTimeLeft is undefined, unregistering animation frame\");\n\t\t\tcore.unregisterAnimationFrame(\"limitTimeFrame\");\n\t\t\tcore.deleteCanvas(\"limitTime\"); // 删除画布\n\t\t\treturn;\n\t\t}\n\n\t\t// 如果时间已到或暂停，直接返回\n\t\tif (limitTimeUp || limitTimePause) return;\n\n\t\t// 获取上次时间戳并更新\n\t\tlet lastTimestamp = core.getFlag(\"__limitTimeLast__\");\n\t\tif (lastTimestamp === null || lastTimestamp < 0) {\n\t\t\tcore.setFlag(\"__limitTimeLast__\", timestamp);\n\t\t\treturn;\n\t\t}\n\n\t\t// 计算时间差并更新倒计时\n\t\tconst delta = timestamp - lastTimestamp;\n\t\tcore.setFlag(\"__limitTimeLast__\", timestamp);\n\n\t\tconst newTime = limitTimeLeft - delta;\n\t\tcore.setFlag(\"limitTimeLeft\", newTime);\n\n\t\t// 倒计时结束处理\n\t\tif (newTime <= 0) {\n\t\t\tcore.setFlag(\"limitTimeLeft\", 0);\n\t\t\tcore.setFlag(\"limitTimeUp\", true);\n\n\t\t\t// 注销动画帧\n\t\t\tcore.unregisterAnimationFrame(\"limitTimeFrame\");\n\n\t\t\t// 延迟一段时间后显示失败信息并结束游戏\n\t\t\tcore.insertAction([{ \"type\": \"waitAsync\" }, \"突然传来了一阵巨响，魔塔倒了，勇士和公主却没有逃出塔外。\", \"勇士请重新再来过吧。\", { \"type\": \"lose\", \"reason\": \"\" }])\n\n\t\t\treturn;\n\t\t}\n\n\t\t// ===== 绘制倒计时 =====\n\t\t// 创建或获取画布\n\t\tlet ctx = core.getContextByName(\"limitTime\");\n\t\tif (!ctx) {\n\t\t\tctx = core.createCanvas(\n\t\t\t\t\"limitTime\",\n\t\t\t\t0, 0,\n\t\t\t\t200, 40,\n\t\t\t\t200\n\t\t\t);\n\t\t}\n\n\t\t// 清空画布\n\t\tcore.clearMap(\"limitTime\");\n\n\t\t// 格式化时间显示\n\t\tconst sec = Math.floor(newTime / 1000);\n\t\tconst m = Math.floor(sec / 60);\n\t\tconst s = sec % 60;\n\t\tconst text = String(m).padStart(2, \"0\") + \":\" + String(s).padStart(2, \"0\");\n\n\t\t// 根据剩余时间设置颜色\n\t\tlet color = \"#FFD700\"; // 金色，正常时间\n\t\tif (newTime <= 10 * 1000) color = \"#FF4444\"; // 红色，最后10秒\n\t\tif (core.getFlag(\"limitTimeUp\")) color = \"#888888\"; // 灰色，时间已到\n\n\t\t// 绘制倒计时文本\n\t\tcore.fillBoldText(\n\t\t\t\"limitTime\",\n\t\t\t\"TIME \" + text,\n\t\t\t10, 20,\n\t\t\tcolor, // 文字颜色\n\t\t\t'#000', // 描边颜色\n\t\t\t\"bold 18px Arial\"\n\t\t);\n\t}\n);\n\n// 添加一个函数用于手动停止倒计时\ncore.stopLimitTimer = function () {\n\tcore.unregisterAnimationFrame(\"limitTimeFrame\");\n\tcore.deleteCanvas(\"limitTime\");\n\tcore.setFlag(\"limitTimePause\", true);\n};\n}"
                            },
                            {
                                "type": "show",
                                "loc": [
                                    [
                                        6,
                                        11
                                    ]
                                ],
                                "floorId": "MT0"
                            }
                        ]
                    }
                ]
            }
        ]
    },
    "afterGetItem": {},
    "afterOpenDoor": {},
    "cannotMove": {},
    "map": [
    [  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3],
    [  3,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  3],
    [  3,  4,  4,  0,132,  4,208,  4,123,  0,  4,  4,  3],
    [  3,  4,  0,  0,  4,  4,247,  4,  4,  0,  0,  4,  3],
    [  3,  4,  0,  0,  0,  4,247,  4,  0,  0,  0,  4,  3],
    [  3,  4,  4,  0,  0,  0,  0,  0,  0,  0,  4,  4,  3],
    [  3,  4,  4,  0,  0,  0,  0,  0,  0,  0,  4,  4,  3],
    [  3,  4,  4,  4,  0,  0,  4,  0,  0,  4,  4,  4,  3],
    [  3,  4,  4,  4,  4, 85, 88, 85,  4,  4,  4,  4,  3],
    [  3,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  3],
    [  3,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  3],
    [  3,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  3],
    [  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3]
],
    "bgmap": [

],
    "fgmap": [

],
    "bgm": "startText.mp3",
    "downFloor": [
        6,
        6
    ],
    "upFloor": [
        6,
        3
    ],
    "beforeBattle": {
        "6,2": [
            "\t[hero]\b[hero]大魔王，我来了。",
            {
                "type": "playSound",
                "name": "dialogue.mp3"
            },
            "\t[冥灵魔王,vampire]\b[down]好，你能来到我这里，还真是不简单。",
            {
                "type": "playSound",
                "name": "dialogue.mp3"
            },
            "\t[hero]\b[hero]哈，要打败你的手下还不是小菜一碟？",
            {
                "type": "playSound",
                "name": "dialogue.mp3"
            },
            "\t[冥灵魔王,vampire]\b[down]我和那些家伙不一样。",
            {
                "type": "playSound",
                "name": "dialogue.mp3"
            },
            "\t[hero]\b[hero]那杰克是怎么回事？",
            {
                "type": "playSound",
                "name": "dialogue.mp3"
            },
            "\t[冥灵魔王,vampire]\b[down]那是我叫灵法师放的定身咒语。",
            {
                "type": "playSound",
                "name": "dialogue.mp3"
            },
            "\t[hero]\b[hero]快叫灵法师解开咒语。",
            {
                "type": "playSound",
                "name": "dialogue.mp3"
            },
            "\t[冥灵魔王,vampire]\b[down]很遗憾，两个灵法师刚才都被你打死了。",
            {
                "type": "playSound",
                "name": "dialogue.mp3"
            },
            "\t[hero]\b[hero]那你亲自解开咒语。",
            {
                "type": "playSound",
                "name": "dialogue.mp3"
            },
            "\t[冥灵魔王,vampire]\b[down]打败我之后自动解开！",
            {
                "type": "playSound",
                "name": "dialogue.mp3"
            }
        ]
    },
    "cannotMoveIn": {},
    "autoEvent": {}
}