Fix inititiative rolls
All checks were successful
Release Creation / build (release) Successful in 52s

This commit is contained in:
2026-04-06 00:02:14 +02:00
parent df6f8e5710
commit 3ad5681539
4 changed files with 48 additions and 9 deletions

View File

@@ -113,6 +113,16 @@ export default class LethalFantasyUtils {
console.log(`handleSocketEvent !`, msg)
let actor
switch (msg.type) {
case "applyDamage":
if (game.user.isGM) {
// Prefer the specific token actor (correct for unlinked monsters); fall back to world actor.
actor = msg.tokenId
? canvas.tokens?.placeables?.find(t => t.id === msg.tokenId)?.actor
: (game.combat?.combatants?.find(c => c.actorId === msg.actorId)?.actor
?? game.actors.get(msg.actorId))
if (actor) actor.applyDamage(msg.damage)
}
break
case "rollInitiative":
actor = game.actors.get(msg.actorId)
actor.system.rollInitiative(msg.combatId, msg.combatantId)