From d6b59f8af2d1c3e18132a53233160de5395b98e6 Mon Sep 17 00:00:00 2001 From: Erdnase <1398341065@qq.com> Date: Wed, 14 Jun 2023 23:02:22 +0800 Subject: [PATCH] =?UTF-8?q?34=E5=B1=82=E9=97=A8=EF=BC=8C21=E5=B1=82?= =?UTF-8?q?=E5=BD=95=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/floors/MT21.js | 12 +-- project/floors/MT34.js | 233 +---------------------------------------- project/functions.js | 74 ++++++++++--- project/maps.js | 6 +- project/plugins.js | 18 ---- 5 files changed, 64 insertions(+), 279 deletions(-) diff --git a/project/floors/MT21.js b/project/floors/MT21.js index eaab936..ef93480 100644 --- a/project/floors/MT21.js +++ b/project/floors/MT21.js @@ -51,15 +51,9 @@ main.floors.MT21= "condition": "core.isReplaying()", "true": [ { - "type": "if", - "condition": "switch:A", - "true": [ - { - "type": "moveHero", - "steps": [ - "down:1" - ] - } + "type": "moveHero", + "steps": [ + "down:1" ] } ] diff --git a/project/floors/MT34.js b/project/floors/MT34.js index 4db1475..f1c13c8 100644 --- a/project/floors/MT34.js +++ b/project/floors/MT34.js @@ -99,238 +99,7 @@ main.floors.MT34= } ] }, - "afterOpenDoor": { - "5,4": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ], - "9,4": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ], - "9,6": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ], - "9,8": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ], - "9,10": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ], - "10,9": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ], - "8,9": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ], - "6,9": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ], - "4,9": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ], - "5,10": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ], - "5,8": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ], - "5,6": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ], - "4,5": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ], - "6,5": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ], - "8,5": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ], - "10,5": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ], - "7,4": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ], - "7,6": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ], - "7,8": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ], - "7,10": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ], - "6,7": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ], - "10,7": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ], - "4,7": [ - { - "type": "insert", - "name": "34door" - }, - { - "type": "hide", - "remove": true - } - ] - }, + "afterOpenDoor": {}, "cannotMove": {}, "ratio": 8, "bgmap": [ diff --git a/project/functions.js b/project/functions.js index b459195..bd5aa58 100644 --- a/project/functions.js +++ b/project/functions.js @@ -437,26 +437,66 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = }, "afterOpenDoor": function (doorId, x, y) { - // 开一个门后触发的事件 + // 开一个门后触发的事件 + if (core.status.floorId == "MT34") { + let doorInfo = { + "5,4": 1, + "7,4": 2, + "9,4": 0, + "4,5": 2, + "6,5": 1, + "8,5": 0, + "10,5": 2, + "5,6": 0, + "7,6": 1, + "9,6": 2, + "4,7": 1, + "6,7": 2, + "8,7": 1, + "10,7": 1, + "5,8": 0, + "7,8": 0, + "9,8": 2, + "4,9": 1, + "6,9": 1, + "8,9": 1, + "10,9": 1, + "5,10": 2, + "7,10": 0, + "9,10": 1 + }, + doorIds = ['A538', 'A539', 'A540']; - var todo = []; - // 检查该点的开门后事件 - if (core.status.floorId) { - core.push(todo, core.floors[core.status.floorId].afterOpenDoor[x + "," + y]); - } - // 检查批量开门事件 - var door = core.getBlockById(doorId); - if (door && door.event.doorInfo) { - core.push(todo, door.event.doorInfo.afterOpenDoor); - } + core.addFlag("_MT34OpenDoors_", 1); - if (todo.length > 0) core.insertAction(todo, x, y); + for (let loc in doorInfo) { + let [dx, dy] = loc.split(','); + dx = parseInt(dx) + dy = parseInt(dy) + if (x == dx && y == dy) continue; - if (core.status.event.id == null) - core.continueAutomaticRoute(); - else - core.clearContinueAutomaticRoute(); - }, + let calIndex = (core.getFlag("_MT34OpenDoors_", 0) + doorInfo[loc]) % doorIds.length; + core.setBlock(doorIds[calIndex], dx, dy); + } + } + var todo = []; + // 检查该点的开门后事件 + if (core.status.floorId) { + core.push(todo, core.floors[core.status.floorId].afterOpenDoor[x + "," + y]); + } + // 检查批量开门事件 + var door = core.getBlockById(doorId); + if (door && door.event.doorInfo) { + core.push(todo, door.event.doorInfo.afterOpenDoor); + } + + if (todo.length > 0) core.insertAction(todo, x, y); + + if (core.status.event.id == null) + core.continueAutomaticRoute(); + else + core.clearContinueAutomaticRoute(); +}, "afterGetItem": function (itemId, x, y, isGentleClick) { // 获得一个道具后触发的事件 // itemId:获得的道具ID;x和y是该道具所在的坐标 diff --git a/project/maps.js b/project/maps.js index 2e4421e..3963bf2 100644 --- a/project/maps.js +++ b/project/maps.js @@ -423,9 +423,9 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e = "535": {"cls":"items","id":"I535"}, "536": {"cls":"items","id":"I536"}, "537": {"cls":"items","id":"I537"}, - "538": {"cls":"animates","id":"A538","doorInfo":{"time":160,"openSound":"door.ogg","closeSound":"door.ogg","keys":{"yellowKey":1}},"trigger":"openDoor","animate":1,"script":"if (core.itemCount('yellowKey') > 0) {\n\tcore.mydoor34();\n\tflags.door_34 = { x: core.nextX(), y: core.nextY(), door: core.getBlockId(core.nextX(), core.nextY()) }\n}"}, - "539": {"cls":"animates","id":"A539","doorInfo":{"time":160,"openSound":"door.ogg","closeSound":"door.ogg","keys":{"blueKey":1}},"trigger":"openDoor","animate":1,"script":"if (core.itemCount('blueKey') > 0) {\n\tcore.mydoor34();\n\tflags.door_34 = { x: core.nextX(), y: core.nextY(), door: core.getBlockId(core.nextX(), core.nextY()) }\n}"}, - "540": {"cls":"animates","id":"A540","doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"redKey":1}},"trigger":"openDoor","animate":1,"script":"if (core.itemCount('redKey') > 0) {\n\tcore.mydoor34();\n\tflags.door_34 = { x: core.nextX(), y: core.nextY(), door: core.getBlockId(core.nextX(), core.nextY()) }\n}"}, + "538": {"cls":"animates","id":"A538","doorInfo":{"time":160,"openSound":"door.ogg","closeSound":"door.ogg","keys":{"yellowKey":1}},"trigger":"openDoor","animate":1,"script":""}, + "539": {"cls":"animates","id":"A539","doorInfo":{"time":160,"openSound":"door.ogg","closeSound":"door.ogg","keys":{"blueKey":1}},"trigger":"openDoor","animate":1,"script":""}, + "540": {"cls":"animates","id":"A540","doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"redKey":1}},"trigger":"openDoor","animate":1,"script":""}, "541": {"cls":"animates","id":"A541"}, "542": {"cls":"animates","id":"A542"}, "543": {"cls":"animates","id":"A543"}, diff --git a/project/plugins.js b/project/plugins.js index c11230a..bbc84ec 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -1545,26 +1545,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = return ids.indexOf(blockId) >= 0; } - core.mydoor34 = function () { - if (flags.door_34) { - var x = flags.door_34.x, - y = flags.door_34.y; - switch (flags.door_34.door) { - case 'A538': - core.setBlock('A539', x, y); - break; - case 'A539': - core.setBlock('A540', x, y); - break; - case 'A540': - core.setBlock('A538', x, y); - break; - } - } - } - }, "drawLight": function () {