mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-04-19 08:56:08 +08:00
删除所有使用checkblock的地图伤害
This commit is contained in:
parent
6e90b4cf00
commit
e5f025ec55
@ -979,11 +979,10 @@ control.prototype.tryMoveDirectly = function (destX, destY) {
|
|||||||
];
|
];
|
||||||
var canMoveDirectlyArray = core.canMoveDirectlyArray(dirs, canMoveArray);
|
var canMoveDirectlyArray = core.canMoveDirectlyArray(dirs, canMoveArray);
|
||||||
|
|
||||||
for (var i = 0; i < dirs.length; ++i) {
|
for (let i = 0; i < dirs.length; ++i) {
|
||||||
var d = dirs[i],
|
var d = dirs[i];
|
||||||
dx = d[0],
|
const [dx, dy, dir] = d;
|
||||||
dy = d[1],
|
|
||||||
dir = d[2];
|
|
||||||
if (
|
if (
|
||||||
dx < 0 ||
|
dx < 0 ||
|
||||||
dx >= core.bigmap.width ||
|
dx >= core.bigmap.width ||
|
||||||
@ -1461,20 +1460,7 @@ control.prototype._checkBlock_disableQuickShop = function () {
|
|||||||
|
|
||||||
////// 阻击 //////
|
////// 阻击 //////
|
||||||
control.prototype._checkBlock_repulse = function (repulse) {
|
control.prototype._checkBlock_repulse = function (repulse) {
|
||||||
if (!repulse || repulse.length == 0) return;
|
// Deprecated.
|
||||||
var actions = [];
|
|
||||||
repulse.forEach(function (t) {
|
|
||||||
actions.push({
|
|
||||||
type: 'move',
|
|
||||||
loc: [t[0], t[1]],
|
|
||||||
steps: [t[3]],
|
|
||||||
time: 250,
|
|
||||||
keep: true,
|
|
||||||
async: true
|
|
||||||
});
|
|
||||||
});
|
|
||||||
actions.push({ type: 'waitAsync' });
|
|
||||||
core.insertAction(actions);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
////// 更新全地图显伤 //////
|
////// 更新全地图显伤 //////
|
||||||
|
@ -793,6 +793,7 @@ maps.prototype._canMoveHero_checkPoint = function (
|
|||||||
floorId = floorId || core.status.floorId;
|
floorId = floorId || core.status.floorId;
|
||||||
if (!floorId) return false;
|
if (!floorId) return false;
|
||||||
arrays = arrays || this._generateMovableArray_arrays(floorId);
|
arrays = arrays || this._generateMovableArray_arrays(floorId);
|
||||||
|
const floor = core.status.maps[floorId];
|
||||||
|
|
||||||
// 1. 检查该点 cannotMove
|
// 1. 检查该点 cannotMove
|
||||||
if (
|
if (
|
||||||
@ -845,13 +846,12 @@ maps.prototype._canMoveHero_checkPoint = function (
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// 4. 检查是否能进将死的领域
|
// 4. 检查是否能进将死的领域
|
||||||
// todo: 不使用 core.status.checkBlock
|
|
||||||
if (
|
if (
|
||||||
floorId == core.status.floorId &&
|
floorId == core.status.floorId &&
|
||||||
!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) <=
|
||||||
((core.status.checkBlock.damage || {})[nx + ',' + ny] || 0) &&
|
(floor.enemy.mapDamage[`${nx},${ny}`]?.damage ?? 0) &&
|
||||||
arrays.eventArray[ny][nx] == 0
|
arrays.eventArray[ny][nx] == 0
|
||||||
)
|
)
|
||||||
return false;
|
return false;
|
||||||
@ -1023,10 +1023,11 @@ maps.prototype._canMoveDirectly_checkNextPoint = function (blocksObj, x, y) {
|
|||||||
if (!ignore) return false;
|
if (!ignore) return false;
|
||||||
}
|
}
|
||||||
// 是否存在阻激夹域伤害
|
// 是否存在阻激夹域伤害
|
||||||
// todo: 不使用 core.status.checkBlock
|
const damage = core.status.thisMap.enemy.mapDamage[index];
|
||||||
// if (core.status.checkBlock.damage[index]) return false;
|
if (damage) {
|
||||||
// if (core.status.checkBlock.repulse[index]) return false;
|
if (damage.damage !== 0) return false;
|
||||||
// if (core.status.checkBlock.mockery[index]) return false;
|
if (damage.mockery) return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -1107,24 +1108,21 @@ maps.prototype._automaticRoute_deepAdd = function (x, y, blocks) {
|
|||||||
var block = blocks[x + ',' + y];
|
var block = blocks[x + ',' + y];
|
||||||
if (block && !block.disable) {
|
if (block && !block.disable) {
|
||||||
var id = block.event.id;
|
var id = block.event.id;
|
||||||
// 绕过亮灯
|
|
||||||
if (id == 'light') deepAdd += 100;
|
|
||||||
// 绕过路障
|
|
||||||
if (id.endsWith('Net') && !core.hasFlag(id.substring(0, id.length - 3)))
|
|
||||||
deepAdd += 100;
|
|
||||||
// 绕过血瓶和绿宝石
|
// 绕过血瓶和绿宝石
|
||||||
if (
|
if (
|
||||||
core.hasFlag('__potionNoRouting__') &&
|
core.hasFlag('__potionNoRouting__') &&
|
||||||
(id.endsWith('Potion') || id == 'greenGem')
|
(id.endsWith('Potion') || id == 'greenGem')
|
||||||
)
|
)
|
||||||
deepAdd += 100;
|
deepAdd += 100;
|
||||||
// 绕过传送点
|
|
||||||
// if (block.event.trigger == 'changeFloor') deepAdd+=10;
|
|
||||||
}
|
}
|
||||||
// 绕过存在伤害的地方
|
// 绕过存在伤害的地方
|
||||||
// todo: 不使用 core.status.checkBlock
|
const damage = core.status.thisMap.enemy.mapDamage[`${x},${y}`];
|
||||||
// deepAdd += (core.status.checkBlock.damage[x + ',' + y] || 0) * 100;
|
if (damage) {
|
||||||
// deepAdd += core.status.checkBlock.mockery[`${x},${y}`] ? 1000 : 0;
|
deepAdd += damage.damage * 100;
|
||||||
|
deepAdd += !!damage.mockery ? 1e5 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
return deepAdd;
|
return deepAdd;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,8 +36,12 @@ export default function init() {
|
|||||||
|
|
||||||
tran.transition('x', ox).transition('y', oy);
|
tran.transition('x', ox).transition('y', oy);
|
||||||
|
|
||||||
needSmooth = true;
|
if (tran.easeTime > 0) {
|
||||||
func();
|
needSmooth = true;
|
||||||
|
func();
|
||||||
|
} else {
|
||||||
|
core.setViewport(tran.value.x, tran.value.y);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let time2 = Date.now();
|
let time2 = Date.now();
|
||||||
@ -45,19 +49,19 @@ export default function init() {
|
|||||||
control.prototype._moveAction_moving = function (...params: any[]) {
|
control.prototype._moveAction_moving = function (...params: any[]) {
|
||||||
if (Date.now() - time2 > 20)
|
if (Date.now() - time2 > 20)
|
||||||
tran.mode(hyper('sin', 'out')).time(200).absolute();
|
tran.mode(hyper('sin', 'out')).time(200).absolute();
|
||||||
origin1.call(this, ...params);
|
return origin1.call(this, ...params);
|
||||||
};
|
};
|
||||||
|
|
||||||
const origin2 = control.prototype.moveDirectly;
|
const origin2 = control.prototype.moveDirectly;
|
||||||
control.prototype.moveDirectly = function (...params: any[]) {
|
control.prototype.moveDirectly = function (...params: any[]) {
|
||||||
time2 = Date.now();
|
time2 = Date.now();
|
||||||
tran.mode(hyper('sin', 'out')).time(600).absolute();
|
tran.mode(hyper('sin', 'out')).time(600).absolute();
|
||||||
origin2.call(this, ...params);
|
return origin2.call(this, ...params);
|
||||||
};
|
};
|
||||||
|
|
||||||
const origin3 = events.prototype._changeFloor_beforeChange;
|
const origin3 = events.prototype._changeFloor_beforeChange;
|
||||||
events.prototype._changeFloor_beforeChange = function (...params: any[]) {
|
events.prototype._changeFloor_beforeChange = function (...params: any[]) {
|
||||||
tran.time(1).absolute();
|
tran.time(1).absolute();
|
||||||
origin3.call(this, ...params);
|
return origin3.call(this, ...params);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,6 @@ export class EnemyCollection implements RangeCollection<DamageEnemy> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算地图伤害
|
* 计算地图伤害
|
||||||
* @param noCache 是否不使用缓存
|
|
||||||
*/
|
*/
|
||||||
calMapDamage() {
|
calMapDamage() {
|
||||||
this.mapDamage = {};
|
this.mapDamage = {};
|
||||||
|
@ -3,23 +3,24 @@ import { drawHalo } from './halo';
|
|||||||
|
|
||||||
// 伤害弹出
|
// 伤害弹出
|
||||||
// 复写阻激夹域检测
|
// 复写阻激夹域检测
|
||||||
control.prototype.checkBlock = function (forceMockery) {
|
control.prototype.checkBlock = function (forceMockery: boolean = false) {
|
||||||
// todo: 不使用 core.status.checkBlock
|
|
||||||
var x = core.getHeroLoc('x'),
|
var x = core.getHeroLoc('x'),
|
||||||
y = core.getHeroLoc('y'),
|
y = core.getHeroLoc('y'),
|
||||||
loc = x + ',' + y;
|
loc = x + ',' + y;
|
||||||
var damage = 0;
|
const floor = core.status.floorId;
|
||||||
|
const info = core.status.maps[floor].enemy.mapDamage[loc];
|
||||||
|
var damage = info.damage;
|
||||||
if (damage) {
|
if (damage) {
|
||||||
if (!main.replayChecking)
|
if (!main.replayChecking) {
|
||||||
core.addPop(
|
core.addPop(
|
||||||
(x - core.bigmap.offsetX / 32) * 32 + 12,
|
(x - core.bigmap.offsetX / 32) * 32 + 12,
|
||||||
(y - core.bigmap.offsetY / 32) * 32 + 20,
|
(y - core.bigmap.offsetY / 32) * 32 + 20,
|
||||||
-damage.toString()
|
(-damage).toString()
|
||||||
);
|
);
|
||||||
|
}
|
||||||
core.status.hero.hp -= damage;
|
core.status.hero.hp -= damage;
|
||||||
var text =
|
const type = Array.from(info.type.keys());
|
||||||
Object.keys(core.status.checkBlock.type[loc] || {}).join(',') ||
|
var text = type.join(',') || '伤害';
|
||||||
'伤害';
|
|
||||||
core.drawTip('受到' + text + damage + '点');
|
core.drawTip('受到' + text + damage + '点');
|
||||||
core.drawHeroAnimate('zone');
|
core.drawHeroAnimate('zone');
|
||||||
this._checkBlock_disableQuickShop();
|
this._checkBlock_disableQuickShop();
|
||||||
@ -33,14 +34,14 @@ control.prototype.checkBlock = function (forceMockery) {
|
|||||||
core.updateStatusBar();
|
core.updateStatusBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// this._checkBlock_repulse(core.status.checkBlock.repulse[loc]);
|
checkMockery(loc, forceMockery);
|
||||||
// checkMockery(loc, forceMockery);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
control.prototype._drawDamage_draw = function (
|
||||||
* @param {CanvasRenderingContext2D} ctx
|
ctx: CanvasRenderingContext2D,
|
||||||
*/
|
onMap: boolean,
|
||||||
control.prototype._drawDamage_draw = function (ctx, onMap, floorId) {
|
floorId: FloorIds
|
||||||
|
) {
|
||||||
if (!core.hasItem('book')) return;
|
if (!core.hasItem('book')) return;
|
||||||
drawHalo(ctx, onMap, floorId);
|
drawHalo(ctx, onMap, floorId);
|
||||||
|
|
||||||
@ -62,7 +63,7 @@ control.prototype._drawDamage_draw = function (ctx, onMap, floorId) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var alpha = core.setAlpha(ctx, one.alpha);
|
var alpha = core.setAlpha(ctx, one.alpha);
|
||||||
core.fillBoldText(ctx, one.text, px, py, one.color);
|
core.fillBoldText(ctx, one.text, px, py, one.color as string);
|
||||||
core.setAlpha(ctx, alpha);
|
core.setAlpha(ctx, alpha);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -82,7 +83,7 @@ control.prototype._drawDamage_draw = function (ctx, onMap, floorId) {
|
|||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
core.fillBoldText(ctx, one.text, px, py, one.color);
|
core.fillBoldText(ctx, one.text, px, py, one.color as string);
|
||||||
});
|
});
|
||||||
|
|
||||||
ctx.save();
|
ctx.save();
|
||||||
@ -132,38 +133,31 @@ control.prototype._drawDamage_draw = function (ctx, onMap, floorId) {
|
|||||||
ctx.strokeStyle = 'black';
|
ctx.strokeStyle = 'black';
|
||||||
ctx.lineWidth = 2.5;
|
ctx.lineWidth = 2.5;
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
ctx.strokeStyle = v.color;
|
ctx.strokeStyle = v.color as string;
|
||||||
ctx.lineWidth = 1;
|
ctx.lineWidth = 1;
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
});
|
});
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
};
|
};
|
||||||
|
|
||||||
control.prototype.moveHero = function (direction, callback) {
|
control.prototype.moveHero = function (direction: Dir, callback: () => void) {
|
||||||
// todo: 不使用 core.status.checkBlock
|
|
||||||
// 如果正在移动,直接return
|
// 如果正在移动,直接return
|
||||||
if (core.status.heroMoving != 0) return;
|
if (core.status.heroMoving != 0) return;
|
||||||
if (core.isset(direction)) core.setHeroLoc('direction', direction);
|
if (core.isset(direction)) core.setHeroLoc('direction', direction);
|
||||||
|
|
||||||
const nx = core.nextX();
|
const nx = core.nextX();
|
||||||
const ny = core.nextY();
|
const ny = core.nextY();
|
||||||
// if (core.status.checkBlock.mockery[`${nx},${ny}`]) {
|
if (core.status.thisMap.enemy.mapDamage[`${nx},${ny}`]?.mockery) {
|
||||||
// core.autosave();
|
core.autosave();
|
||||||
// }
|
}
|
||||||
|
|
||||||
if (callback) return this.moveAction(callback);
|
if (callback) return this.moveAction(callback);
|
||||||
this._moveHero_moving();
|
this._moveHero_moving();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
function checkMockery(loc: string, force: boolean = false) {
|
||||||
* 电摇嘲讽
|
|
||||||
* @param {LocString} loc
|
|
||||||
* @param {boolean} force
|
|
||||||
*/
|
|
||||||
function checkMockery(loc, force) {
|
|
||||||
// todo: 不使用 core.status.checkBlock
|
|
||||||
if (core.status.lockControl && !force) return;
|
if (core.status.lockControl && !force) return;
|
||||||
const mockery = core.status.checkBlock.mockery[loc];
|
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 = [];
|
||||||
@ -179,7 +173,6 @@ function checkMockery(loc, force) {
|
|||||||
y += dy;
|
y += dy;
|
||||||
const block = blocks[`${x},${y}`];
|
const block = blocks[`${x},${y}`];
|
||||||
if (block) {
|
if (block) {
|
||||||
block.event.cls === '';
|
|
||||||
if (
|
if (
|
||||||
[
|
[
|
||||||
'animates',
|
'animates',
|
@ -1,4 +1,5 @@
|
|||||||
// 示例插件:文字弹出
|
// 示例插件:文字弹出
|
||||||
|
// todo: 重写
|
||||||
|
|
||||||
let pop: any[] = [];
|
let pop: any[] = [];
|
||||||
|
|
||||||
|
2
src/types/function.d.ts
vendored
2
src/types/function.d.ts
vendored
@ -145,7 +145,7 @@ interface EventData {
|
|||||||
* 游戏失败
|
* 游戏失败
|
||||||
* @param reason 失败原因
|
* @param reason 失败原因
|
||||||
*/
|
*/
|
||||||
lose(reason: string): void;
|
lose(reason?: string): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 切换楼层中,即屏幕完全变黑的那一刻
|
* 切换楼层中,即屏幕完全变黑的那一刻
|
||||||
|
4
src/types/status.d.ts
vendored
4
src/types/status.d.ts
vendored
@ -774,7 +774,7 @@ interface GameStatus extends InitGameStatus {
|
|||||||
/**
|
/**
|
||||||
* 获得当前楼层信息,等价于core.status.maps[core.status.floorId]
|
* 获得当前楼层信息,等价于core.status.maps[core.status.floorId]
|
||||||
*/
|
*/
|
||||||
thisMap: ResolvedFloor;
|
thisMap: Floor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 地图伤害
|
* 地图伤害
|
||||||
@ -950,6 +950,8 @@ interface HeroStatus {
|
|||||||
*/
|
*/
|
||||||
followers: Follower[];
|
followers: Follower[];
|
||||||
|
|
||||||
|
statistics: HeroStatistics;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 勇士拥有的道具
|
* 勇士拥有的道具
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user