fix: 解决不拿怪物手册报错

This commit is contained in:
unanmed 2023-09-29 17:53:42 +08:00
parent 02e2934b9a
commit 17633b094d
4 changed files with 9 additions and 9 deletions

View File

@ -851,7 +851,7 @@ maps.prototype._canMoveHero_checkPoint = function (
!core.flags.canGoDeadZone && !core.flags.canGoDeadZone &&
!core.status.lockControl && !core.status.lockControl &&
Math.max(core.status.hero.hp, 1) <= 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 arrays.eventArray[ny][nx] == 0
) )
return false; return false;
@ -939,7 +939,7 @@ maps.prototype._canMoveDirectly_checkGlobal = function () {
}; };
maps.prototype._canMoveDirectly_checkStartPoint = function (sx, sy) { 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); var block = core.getBlock(sx, sy);
if (block != null) { if (block != null) {
// 只有起点是传送点才是能无视 // 只有起点是传送点才是能无视
@ -1023,7 +1023,7 @@ maps.prototype._canMoveDirectly_checkNextPoint = function (blocksObj, x, y) {
if (!ignore) return false; if (!ignore) return false;
} }
// 是否存在阻激夹域伤害 // 是否存在阻激夹域伤害
const damage = core.status.thisMap.enemy?.mapDamage[index]; const damage = core.status.thisMap.enemy.mapDamage[index];
if (damage) { if (damage) {
if (damage.damage !== 0) return false; if (damage.damage !== 0) return false;
if (damage.mockery) return false; if (damage.mockery) return false;
@ -1117,7 +1117,7 @@ maps.prototype._automaticRoute_deepAdd = function (x, y, blocks) {
deepAdd += 100; deepAdd += 100;
} }
// 绕过存在伤害的地方 // 绕过存在伤害的地方
const damage = core.status.thisMap.enemy?.mapDamage[`${x},${y}`]; const damage = core.status.thisMap.enemy.mapDamage[`${x},${y}`];
if (damage) { if (damage) {
deepAdd += damage.damage * 100; deepAdd += damage.damage * 100;
deepAdd += !!damage.mockery ? 1e5 : 0; deepAdd += !!damage.mockery ? 1e5 : 0;

View File

@ -6,7 +6,7 @@ control.prototype.checkBlock = function (forceMockery: boolean = false) {
const x = core.getHeroLoc('x'), const x = core.getHeroLoc('x'),
y = core.getHeroLoc('y'), y = core.getHeroLoc('y'),
loc = x + ',' + y; loc = x + ',' + y;
const info = core.status.thisMap.enemy?.mapDamage[loc]; const info = core.status.thisMap.enemy.mapDamage[loc];
const damage = info?.damage; const damage = info?.damage;
if (damage) { if (damage) {
if (!main.replayChecking) { if (!main.replayChecking) {
@ -145,7 +145,7 @@ control.prototype.moveHero = function (direction: Dir, callback: () => void) {
const nx = core.nextX(); const nx = core.nextX();
const ny = core.nextY(); const ny = core.nextY();
if (core.status.thisMap.enemy?.mapDamage[`${nx},${ny}`]?.mockery) { if (core.status.thisMap.enemy.mapDamage[`${nx},${ny}`]?.mockery) {
core.autosave(); core.autosave();
} }
@ -155,7 +155,7 @@ control.prototype.moveHero = function (direction: Dir, callback: () => void) {
function checkMockery(loc: string, force: boolean = false) { function checkMockery(loc: string, force: boolean = false) {
if (core.status.lockControl && !force) return; 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) { if (mockery) {
mockery.sort((a, b) => (a[0] === b[0] ? a[1] - b[1] : a[0] - b[0])); mockery.sort((a, b) => (a[0] === b[0] ? a[1] - b[1] : a[0] - b[0]));
const action = []; const action = [];

View File

@ -6,7 +6,7 @@ core.control.updateDamage = function (floorId = core.status.floorId, ctx) {
const floor = core.status.maps[floorId]; const floor = core.status.maps[floorId];
// 没有怪物手册 // 没有怪物手册
if (!core.hasItem('book')) return; // if (!core.hasItem('book')) return;
core.status.damage.posX = core.bigmap.posX; core.status.damage.posX = core.bigmap.posX;
core.status.damage.posY = core.bigmap.posY; core.status.damage.posY = core.bigmap.posY;
if (!onMap) { if (!onMap) {

View File

@ -15,7 +15,7 @@ const show = debounce((ev: MouseEvent) => {
flags.clientLoc = [ev.clientX, ev.clientY]; flags.clientLoc = [ev.clientX, ev.clientY];
const [mx, my] = getLocFromMouseLoc(...flags.mouseLoc); 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; return v.x === mx && v.y === my;
}); });