打怪碎裂特效

This commit is contained in:
unanmed 2023-08-01 16:29:35 +08:00
parent c6a7f418cf
commit 6b412c1691
2 changed files with 32 additions and 1 deletions

4
.gitignore vendored
View File

@ -29,4 +29,6 @@ dist-ssr
dist.zip
story.md
dist.rar
index.cjs
index.cjs
_temp
_bundle

View File

@ -424,6 +424,35 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
// 如果已有事件正在处理中
if (core.status.event.id == null) core.continueAutomaticRoute();
else core.clearContinueAutomaticRoute();
// 打怪特效
if (core.has(x) && core.has(y)) {
const frame = core.status.globalAnimateStatus % 2;
const canvas = document.createElement('canvas');
canvas.width = 32;
canvas.height = 32;
core.drawIcon(canvas, enemy.id, 0, 0, 32, 32, frame);
const manager = core.applyFragWith(canvas);
const frag = manager.canvas;
frag.style.imageRendering = 'pixelated';
frag.style.width = `${frag.width * core.domStyle.scale}px`;
frag.style.height = `${frag.height * core.domStyle.scale}px`;
const left =
(x * 32 + 16 - frag.width / 2 - core.bigmap.offsetX) *
core.domStyle.scale;
const top =
(y * 32 + 16 - frag.height / 2 - core.bigmap.offsetY) *
core.domStyle.scale;
frag.style.left = `${left}px`;
frag.style.top = `${top}px`;
frag.style.zIndex = '45';
frag.style.position = 'absolute';
frag.style.filter = 'sepia(20%)brightness(120%)';
core.dom.gameDraw.appendChild(frag);
manager.onEnd.then(() => {
frag.remove();
});
}
},
afterOpenDoor: function (doorId, x, y) {
// 开一个门后触发的事件