game: extract effectHandlers

This commit is contained in:
He4eT 2025-06-06 23:20:15 +02:00
commit 66a70082cf

View file

@ -396,7 +396,7 @@ const effectHandlers = {
line(x, y, x, y - dy * w, color) line(x, y, x, y - dy * w, color)
}) })
}, },
} }
function drawFX() { function drawFX() {
effects effects
@ -405,9 +405,7 @@ function drawFX() {
from: arenaToScreen(effect.from ?? {}), from: arenaToScreen(effect.from ?? {}),
to: arenaToScreen(effect.to ?? {}), to: arenaToScreen(effect.to ?? {}),
})) }))
.forEach((effect) => .forEach((effect) => effectHandlers[effect.type](effect))
effectHandlers[effect.type](effect),
)
effects = effects.filter(({ frames }) => frames.length > 0) effects = effects.filter(({ frames }) => frames.length > 0)
} }