Update fight options
All checks were successful
Release Creation / build (release) Successful in 53s

This commit is contained in:
2025-11-11 19:56:33 +01:00
parent 8d9cc1045c
commit 68a0d03740
30 changed files with 406 additions and 213 deletions

View File

@@ -375,6 +375,15 @@ export default class CthulhuEternalUtils {
document.documentElement.style.setProperty('--background-image-base', `linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.8)), url("../assets/ui/${era}_background_main.webp")`);
}
static getTarget() {
if (game.user.targets && game.user.targets.size === 1) {
for (let target of game.user.targets) {
return target
}
}
return undefined;
}
static applyWounds(message, event) {
let woundData = message.getFlag("fvtt-cthulhu-eternal", "woundData")
if (!woundData) {
@@ -387,10 +396,11 @@ export default class CthulhuEternalUtils {
return
}
// Get the targetted actorId from the HTML select event
let targetActorId = event.target.value
let targetActor = game.actors.get(targetActorId)
let targetCombatantId = event.target.value
let combatant = game.combat.combatants.get(targetCombatantId)
let targetActor = combatant.token?.actor || game.actors.get(combatant.actorId)
if (!targetActor) {
ui.notifications.error(game.i18n.localize("CTHULHUETERNAL.Notifications.noTargetActorFound") + targetActorId)
ui.notifications.error(game.i18n.localize("CTHULHUETERNAL.Notifications.noTargetActorFound") + targetCombatantId)
return
}
targetActor.applyWounds(woundData)