Add rituals !
Some checks failed
Release Creation / build (release) Failing after 44s

This commit is contained in:
2025-04-25 00:26:28 +02:00
parent a43bebc63b
commit b21c5ac9bb
12 changed files with 54 additions and 39 deletions

View File

@ -147,6 +147,24 @@ export default class CthulhuEternalRoll extends Roll {
options.isNudge = false
break
case "damage":
let isLethal = false
options.isNudge = false
if (options.rollItem.system.lethality > 0) {
let lethalityRoll = new Roll("1d100")
await lethalityRoll.evaluate()
isLethal = (lethalityRoll.total <= options.rollItem.system.lethality)
let flavor = `${options.rollItem.name} - <strong>Lethality Roll</strong> : ${lethalityRoll.total} <= ${options.rollItem.system.lethality} => ${isLethal}`
if ( isLethal) {
flavor += `<br>The target is lethally wounded => HP = 0`
} else {
let wounds = Math.floor(lethalityRoll.total/10) + (lethalityRoll.total % 10)
flavor += `<br>The target is not lethally wounded => HP loss = ${wounds}`
}
await lethalityRoll.toMessage({
flavor:flavor
});
return
}
let formula = options.rollItem.system.damage
if ( options.rollItem.system.weaponType === "melee" || options.rollItem.system.weaponType === "unarmed") {
formula += ` + ${options.rollItem.damageBonus}`
@ -156,16 +174,6 @@ export default class CthulhuEternalRoll extends Roll {
await damageRoll.toMessage({
flavor: `${options.rollItem.name} - Damage Roll`
});
let isLethal = false
options.isNudge = false
if (options.rollItem.system.lethality > 0) {
let lethalityRoll = new Roll("1d100")
await lethalityRoll.evaluate()
isLethal = (lethalityRoll.total <= options.rollItem.system.lethality)
await lethalityRoll.toMessage({
flavor: `${options.rollItem.name} - Lethality Roll : ${lethalityRoll.total} <= ${options.rollItem.system.lethality} => ${isLethal}`
});
}
return
case "weapon":
let era = game.settings.get("fvtt-cthulhu-eternal", "settings-era")
@ -186,7 +194,7 @@ export default class CthulhuEternalRoll extends Roll {
options.initialScore = options.weapon.system.directSkillValue
} else {
let skillName = game.i18n.localize(SYSTEM.WEAPON_SKILL_MAPPING[era][options.rollItem.system.weaponType])
let actor = game.actors.get(options.actorId)
let actor = game.actors.get(options.actorId)
options.rollItem = actor.items.find(i => i.type === "skill" && i.name.toLowerCase() === skillName.toLowerCase())
if (!options.rollItem) {
ui.notifications.error(game.i18n.localize("CTHULHUETERNAL.Notifications.NoWeaponSkill"))
@ -321,19 +329,19 @@ export default class CthulhuEternalRoll extends Roll {
let unit = this.total - (dec * 10)
if (this.total <= rollData.targetScore) {
resultType = "success"
// Detect if decimal == unit in the dire total result
// Detect if decimal == unit in the dire total result
if (dec === unit || this.total === 1) {
resultType = "successCritical"
}
} else {
// Detect if decimal == unit in the dire total result
// Detect if decimal == unit in the dire total result
if (dec === unit || this.total === 100) {
resultType = "failureCritical"
}
}
this.options.resultType = resultType
if (this.options.isNudgedRoll) {
if (this.options.isNudgedRoll) {
this.options.isSuccess = resultType === "success" || resultType === "successCritical"
this.options.isFailure = resultType === "failure" || resultType === "failureCritical"
this.options.isCritical = false