From b7b382611d6ae7cd01a271252c520cb6ac275b48 Mon Sep 17 00:00:00 2001 From: coderzlh Date: Mon, 25 Sep 2023 17:06:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=A6=96=E5=B1=82?= =?UTF-8?q?=E6=97=A0=E6=80=AA=E5=8D=A1=E6=AD=BB=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/libs/maps.js | 8 ++++---- src/plugin/game/enemy/checkblock.ts | 6 +++--- src/plugin/ui/fixed.ts | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/public/libs/maps.js b/public/libs/maps.js index 5011f21..493f872 100644 --- a/public/libs/maps.js +++ b/public/libs/maps.js @@ -851,7 +851,7 @@ maps.prototype._canMoveHero_checkPoint = function ( !core.flags.canGoDeadZone && !core.status.lockControl && Math.max(core.status.hero.hp, 1) <= - (floor.enemy.mapDamage[`${nx},${ny}`]?.damage ?? 0) && + (floor.enemy?.mapDamage[`${nx},${ny}`]?.damage ?? 0) && arrays.eventArray[ny][nx] == 0 ) return false; @@ -939,7 +939,7 @@ maps.prototype._canMoveDirectly_checkGlobal = function () { }; maps.prototype._canMoveDirectly_checkStartPoint = function (sx, sy) { - if (core.status.thisMap.enemy.mapDamage[`${sx},${sy}`]) return false; + if (core.status.thisMap.enemy?.mapDamage[`${sx},${sy}`]) return false; var block = core.getBlock(sx, sy); if (block != null) { // 只有起点是传送点才是能无视 @@ -1023,7 +1023,7 @@ maps.prototype._canMoveDirectly_checkNextPoint = function (blocksObj, x, y) { if (!ignore) return false; } // 是否存在阻激夹域伤害 - const damage = core.status.thisMap.enemy.mapDamage[index]; + const damage = core.status.thisMap.enemy?.mapDamage[index]; if (damage) { if (damage.damage !== 0) return false; if (damage.mockery) return false; @@ -1117,7 +1117,7 @@ maps.prototype._automaticRoute_deepAdd = function (x, y, blocks) { deepAdd += 100; } // 绕过存在伤害的地方 - const damage = core.status.thisMap.enemy.mapDamage[`${x},${y}`]; + const damage = core.status.thisMap.enemy?.mapDamage[`${x},${y}`]; if (damage) { deepAdd += damage.damage * 100; deepAdd += !!damage.mockery ? 1e5 : 0; diff --git a/src/plugin/game/enemy/checkblock.ts b/src/plugin/game/enemy/checkblock.ts index f17fbc5..9c75a49 100644 --- a/src/plugin/game/enemy/checkblock.ts +++ b/src/plugin/game/enemy/checkblock.ts @@ -6,7 +6,7 @@ control.prototype.checkBlock = function (forceMockery: boolean = false) { const x = core.getHeroLoc('x'), y = core.getHeroLoc('y'), loc = x + ',' + y; - const info = core.status.thisMap.enemy.mapDamage[loc]; + const info = core.status.thisMap.enemy?.mapDamage[loc]; const damage = info?.damage; if (damage) { if (!main.replayChecking) { @@ -145,7 +145,7 @@ control.prototype.moveHero = function (direction: Dir, callback: () => void) { const nx = core.nextX(); const ny = core.nextY(); - if (core.status.thisMap.enemy.mapDamage[`${nx},${ny}`]?.mockery) { + if (core.status.thisMap.enemy?.mapDamage[`${nx},${ny}`]?.mockery) { core.autosave(); } @@ -155,7 +155,7 @@ control.prototype.moveHero = function (direction: Dir, callback: () => void) { function checkMockery(loc: string, force: boolean = false) { if (core.status.lockControl && !force) return; - const mockery = core.status.thisMap.enemy.mapDamage[loc]?.mockery; + const mockery = core.status.thisMap.enemy?.mapDamage[loc]?.mockery; if (mockery) { mockery.sort((a, b) => (a[0] === b[0] ? a[1] - b[1] : a[0] - b[0])); const action = []; diff --git a/src/plugin/ui/fixed.ts b/src/plugin/ui/fixed.ts index 3aee28d..f5dfcf9 100644 --- a/src/plugin/ui/fixed.ts +++ b/src/plugin/ui/fixed.ts @@ -15,7 +15,7 @@ const show = debounce((ev: MouseEvent) => { flags.clientLoc = [ev.clientX, ev.clientY]; const [mx, my] = getLocFromMouseLoc(...flags.mouseLoc); - const e = core.status.thisMap.enemy.list.find(v => { + const e = core.status.thisMap.enemy?.list.find(v => { return v.x === mx && v.y === my; });