提高楼传分区的性能

This commit is contained in:
unanmed 2023-07-12 12:08:46 +08:00
parent d09da5711b
commit 2860dccc01
2 changed files with 11 additions and 11 deletions

View File

@ -226,8 +226,8 @@ export class EnemyCollection implements RangeCollection<DamageEnemy> {
});
// 然后根据位置依次绘制对应位置的伤害
for (const dam of v.damage) {
const d = (dam.damage - min) / delta;
const color = core.arrayToRGB([d * 255, 255 - d * 255, 0]);
const d = ((dam.damage - min) / delta) * 255;
const color = core.arrayToRGB([d, 255 - d, 0]);
if (dam.dir === 'down' || dam.dir === 'up') {
const dir = dam.dir === 'down' ? '↑' : '↓';
core.status.damage.extraData.push({

View File

@ -27,11 +27,11 @@ const bfsCache: Partial<Record<FloorIds, MapBFSResult>> = {};
*/
const drawCache: Record<string, MapDrawData> = {};
const arrow: Partial<Record<AllIds, Dir>> = {
leftPortal: 'left',
rightPortal: 'right',
upPortal: 'up',
downPortal: 'down'
const arrow: Partial<Record<AllNumbers, Dir>> = {
92: 'left',
94: 'right',
91: 'up',
93: 'down'
};
/**
@ -175,13 +175,13 @@ export function getMapData(
while (queue.length > 0) {
const now = queue.shift()!;
const change = core.floors[now].changeFloor;
const blocks = core.getMapBlocksObj(now, noCache);
const floor = core.floors[now];
const change = floor.changeFloor;
for (const [loc, ev] of Object.entries(change)) {
const target = ev.floorId as FloorIds;
if (target.startsWith(':')) continue;
const block = blocks[loc as LocString];
const id = block.event.id;
const [x, y] = loc.split(',').map(v => parseInt(v));
const id = floor.map[y][x] as AllNumbers;
if (id in arrow) {
if (!used[target]) {
const from = `${now},${loc},${arrow[id]}` as BFSFromString;