Fight helper !
This commit is contained in:
@@ -229,7 +229,7 @@ export default class CthulhuEternalUtils {
|
||||
let healingFormula = rollData.rollItem.system.healingFormula
|
||||
let healingMsg = "CTHULHUETERNAL.Label.healingRoll"
|
||||
if (rollData.resultType === "successCritical") {
|
||||
healingFormula += " * 2"
|
||||
healingFormula += " * 2"
|
||||
}
|
||||
if (rollData.resultType === "failureCritical") {
|
||||
healingMsg = "CTHULHUETERNAL.Label.healingRollFailure"
|
||||
@@ -268,11 +268,11 @@ export default class CthulhuEternalUtils {
|
||||
}
|
||||
|
||||
static async registerBabeleTranslations(babele) {
|
||||
babele.registerConverters( {
|
||||
'translateRangeUnit': (originalValue) => {
|
||||
babele.registerConverters({
|
||||
'translateRangeUnit': (originalValue) => {
|
||||
return CthulhuEternalUtils.translateRangeUnit(originalValue)
|
||||
},
|
||||
'translateRange' : (originalValue) => {
|
||||
'translateRange': (originalValue) => {
|
||||
return CthulhuEternalUtils.translateRange(originalValue)
|
||||
}
|
||||
})
|
||||
@@ -280,7 +280,7 @@ export default class CthulhuEternalUtils {
|
||||
|
||||
static async damageRoll(rollMessage, formula = null) {
|
||||
let rollData = rollMessage.rolls[0]?.options?.rollData
|
||||
let actor = game.actors.get(rollData.actorId)
|
||||
let actor = game.actors.get(rollData.actorId)
|
||||
if (!actor) {
|
||||
ui.notifications.error(game.i18n.localize("CTHULHUETERNAL.Label.noActorFound"))
|
||||
return
|
||||
@@ -336,8 +336,8 @@ export default class CthulhuEternalUtils {
|
||||
rejectClose: false, // Click on Close button will not launch an error
|
||||
render: (event, dialog) => {
|
||||
$(".nudged-score-select").change(event => {
|
||||
dialogContext.nudgedValue = Number(event.target.value)+1
|
||||
dialogContext.wpCost = Math.ceil(Math.abs(rollMessage.rolls[0].total - dialogContext.nudgedValue) / 5)
|
||||
dialogContext.nudgedValue = Number(event.target.value) + 1
|
||||
dialogContext.wpCost = Math.ceil(Math.abs(rollMessage.rolls[0].total - dialogContext.nudgedValue) / 5)
|
||||
$("#nudged-wp-cost").val(dialogContext.wpCost)
|
||||
})
|
||||
}
|
||||
@@ -375,4 +375,24 @@ 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 applyWounds(message, event) {
|
||||
let woundData = message.getFlag("fvtt-cthulhu-eternal", "woundData")
|
||||
if (!woundData) {
|
||||
ui.notifications.error(game.i18n.localize("CTHULHUETERNAL.Notifications.noRollDataFound"))
|
||||
return
|
||||
}
|
||||
let actor = game.actors.get(woundData.actorId)
|
||||
if (!actor) {
|
||||
ui.notifications.error(game.i18n.localize("CTHULHUETERNAL.Notifications.noActorFound"))
|
||||
return
|
||||
}
|
||||
// Get the targetted actorId from the HTML select event
|
||||
let targetActorId = event.target.value
|
||||
let targetActor = game.actors.get(targetActorId)
|
||||
if (!targetActor) {
|
||||
ui.notifications.error(game.i18n.localize("CTHULHUETERNAL.Notifications.noTargetActorFound") + targetActorId)
|
||||
return
|
||||
}
|
||||
targetActor.applyWounds(woundData)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user