fix:自动清怪判定变严格
This commit is contained in:
parent
ba98bb5634
commit
b19b7e47d0
@ -1978,33 +1978,29 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
* 判断一个点是否能遍历
|
* 判断一个点是否能遍历
|
||||||
*/
|
*/
|
||||||
function judge(block, nx, ny, tx, ty, dir, floorId, autoBattle, autoGet) {
|
function judge(block, nx, ny, tx, ty, dir, floorId, autoBattle, autoGet) {
|
||||||
if (!has(block)) return {};
|
if (!has(block)) { // 说明什么都没有,没事件也没图块
|
||||||
|
return { type: "none", canGoThrough: true };
|
||||||
|
}
|
||||||
const cls = block.event.cls;
|
const cls = block.event.cls;
|
||||||
const loc = `${tx},${ty}`;
|
const loc = `${tx},${ty}`;
|
||||||
const floor = core.floors[floorId];
|
const floor = core.floors[floorId];
|
||||||
const changeFloor = floor.changeFloor[loc];
|
const changeFloor = floor.changeFloor[loc];
|
||||||
const isEnemy = autoBattle && cls.startsWith('enemy'),
|
const isEnemy = autoBattle && cls.startsWith('enemy'),
|
||||||
isItem = autoGet && cls === 'items';
|
isItem = autoGet && cls === 'items';
|
||||||
|
// 因为没有判定往来图块的通行性,这里宁可严格一点,非空地(block.id === 0)一律不给穿
|
||||||
if (has(changeFloor)) {
|
if (has(changeFloor)) {
|
||||||
if (!core.noPass(tx, ty, floorId) && !core.canMoveHero(nx, ny, dir)) {
|
if ((changeFloor.ignoreChangeFloor ?? core.flags.ignoreChangeFloor) && block.id === 0) {
|
||||||
return false;
|
return { type: "unknown", canGoThrough: true };
|
||||||
}
|
}
|
||||||
if (changeFloor.ignoreChangeFloor ?? core.flags.ignoreChangeFloor) {
|
return { type: "unknown", canGoThrough: false };
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has(core.floors[floorId].events[loc])) return false;
|
if (has(core.floors[floorId].events[loc])) return { type: "unknown", canGoThrough: false };
|
||||||
|
|
||||||
if (isEnemy || isItem)
|
if (isEnemy) return { type: "enemy", canGoThrough: true };
|
||||||
return {
|
if (isItem) return { type: "item", canGoThrough: true };
|
||||||
isEnemy,
|
|
||||||
isItem,
|
|
||||||
};
|
|
||||||
|
|
||||||
return false;
|
return { type: "unknown", canGoThrough: false };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2097,21 +2093,20 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
}
|
}
|
||||||
const loc = `${tx},${ty}`;
|
const loc = `${tx},${ty}`;
|
||||||
if (mapped[loc]) return;
|
if (mapped[loc]) return;
|
||||||
if (core.onSki(bgMap[ty][tx])) return; // 寻路不允许穿过滑冰
|
|
||||||
const block = objs[loc];
|
const block = objs[loc];
|
||||||
mapped[loc] = true;
|
mapped[loc] = true;
|
||||||
const type = judge(block, nx, ny, tx, ty, v[0], floorId, autoBattle, autoGet);
|
if (core.onSki(bgMap[ty][tx])) return; // bfs不允许穿过滑冰
|
||||||
if (type === false) return;
|
const { type, canGoThrough } = judge(block, nx, ny, tx, ty, v[0], floorId, autoBattle, autoGet);
|
||||||
const { isEnemy, isItem } = type;
|
if (!canGoThrough) return;
|
||||||
|
|
||||||
if (isEnemy) {
|
if (type === 'enemy') {
|
||||||
if (canBattle(block.event.id, tx, ty) && !block.disable) {
|
if (canBattle(block.event.id, tx, ty) && !block.disable) {
|
||||||
core.battle(block.event.id, tx, ty);
|
core.battle(block.event.id, tx, ty);
|
||||||
core.updateCheckBlock();
|
core.updateCheckBlock();
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (isItem) {
|
} else if (type === 'item') {
|
||||||
const item = core.material.items[block.event.id];
|
const item = core.material.items[block.event.id];
|
||||||
if (canGetItem(item, loc, floorId)) {
|
if (canGetItem(item, loc, floorId)) {
|
||||||
core.getItem(item.id, 1, tx, ty);
|
core.getItem(item.id, 1, tx, ty);
|
||||||
@ -2164,6 +2159,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
const loc = `${x},${y}`;
|
const loc = `${x},${y}`;
|
||||||
const hasEvent = has(floor.events[loc]);
|
const hasEvent = has(floor.events[loc]);
|
||||||
if (hasEvent) return; // 如果有事件,直接不清了
|
if (hasEvent) return; // 如果有事件,直接不清了
|
||||||
|
const block = core.getBlock(x,y);
|
||||||
|
if (block != null && block.event.cls !== 'items') return; // 角色站的位置为空地和物品以外的图块,不清(例如箭头,可能无法返回)
|
||||||
|
|
||||||
let deep = Infinity;
|
let deep = Infinity;
|
||||||
if (hasBlockDamage(loc)) {
|
if (hasBlockDamage(loc)) {
|
||||||
deep = core.flags.enableGentleClick ? 1 : 0; // 角色站的位置有地图伤害时,仍然允许轻点附近1格
|
deep = core.flags.enableGentleClick ? 1 : 0; // 角色站的位置有地图伤害时,仍然允许轻点附近1格
|
||||||
@ -2422,7 +2420,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
|
|
||||||
const oriClosePanel = core.ui.closePanel;
|
const oriClosePanel = core.ui.closePanel;
|
||||||
core.ui.closePanel = function () {
|
core.ui.closePanel = function () {
|
||||||
oriClosePanel.apply(core.ui, []);
|
oriClosePanel.apply(core.ui, [arguments]);
|
||||||
clearAll();
|
clearAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2528,7 +2526,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
const oriStartReplay = core.control.startReplay; // 进入播放录像模式时清空道具栏选中目标的缓存
|
const oriStartReplay = core.control.startReplay; // 进入播放录像模式时清空道具栏选中目标的缓存
|
||||||
core.control.startReplay = function (list) {
|
core.control.startReplay = function (list) {
|
||||||
clearItemBoxCache();
|
clearItemBoxCache();
|
||||||
oriStartReplay.apply(core.control, list);
|
oriStartReplay.apply(core.control, [list, ...arguments]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 复写items._afterUseItem
|
// 复写items._afterUseItem
|
||||||
|
|||||||
6
runtime.d.ts
vendored
6
runtime.d.ts
vendored
@ -3042,6 +3042,12 @@ interface icons {
|
|||||||
interface plugin {
|
interface plugin {
|
||||||
// aniMap: Map<any, Function>
|
// aniMap: Map<any, Function>
|
||||||
|
|
||||||
|
/** 高级动画相关的类 */
|
||||||
|
animate: {
|
||||||
|
Animation: any, AnimationBase: any, Ticker: any, Transition: any, bezier: any, bezierPath: any, circle: any,
|
||||||
|
hyper: any, inverseTrigo: any, linear: any, power: any, shake: any, sleep: any, trigo: any,
|
||||||
|
} & {}
|
||||||
|
|
||||||
/** 打开一个道具商店 */
|
/** 打开一个道具商店 */
|
||||||
openItemShop: (itemShopId: string) => void
|
openItemShop: (itemShopId: string) => void
|
||||||
/** 某个全局商店是否被访问过 */
|
/** 某个全局商店是否被访问过 */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user