From b21c5ac9bb5f4a0b0411cf3def50c1b78dc2deb7 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Fri, 25 Apr 2025 00:26:28 +0200 Subject: [PATCH] Add rituals ! --- module/documents/roll.mjs | 36 +++++++++++------- .../rituals/{000004.log => 000012.log} | 0 packs-system/rituals/CURRENT | 2 +- packs-system/rituals/LOG | 13 ++++--- packs-system/rituals/LOG.old | 8 ++++ packs-system/rituals/MANIFEST-000002 | Bin 135 -> 0 bytes packs-system/rituals/MANIFEST-000010 | Bin 0 -> 135 bytes .../skills/{000168.log => 000176.log} | 0 packs-system/skills/CURRENT | 2 +- packs-system/skills/LOG | 14 +++---- packs-system/skills/LOG.old | 18 ++++----- .../{MANIFEST-000166 => MANIFEST-000174} | Bin 178 -> 178 bytes 12 files changed, 54 insertions(+), 39 deletions(-) rename packs-system/rituals/{000004.log => 000012.log} (100%) create mode 100644 packs-system/rituals/LOG.old delete mode 100644 packs-system/rituals/MANIFEST-000002 create mode 100644 packs-system/rituals/MANIFEST-000010 rename packs-system/skills/{000168.log => 000176.log} (100%) rename packs-system/skills/{MANIFEST-000166 => MANIFEST-000174} (71%) diff --git a/module/documents/roll.mjs b/module/documents/roll.mjs index 05de50f..ddb0cfb 100644 --- a/module/documents/roll.mjs +++ b/module/documents/roll.mjs @@ -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} - Lethality Roll : ${lethalityRoll.total} <= ${options.rollItem.system.lethality} => ${isLethal}` + if ( isLethal) { + flavor += `
The target is lethally wounded => HP = 0` + } else { + let wounds = Math.floor(lethalityRoll.total/10) + (lethalityRoll.total % 10) + flavor += `
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 diff --git a/packs-system/rituals/000004.log b/packs-system/rituals/000012.log similarity index 100% rename from packs-system/rituals/000004.log rename to packs-system/rituals/000012.log diff --git a/packs-system/rituals/CURRENT b/packs-system/rituals/CURRENT index 1a84852..3051f81 100644 --- a/packs-system/rituals/CURRENT +++ b/packs-system/rituals/CURRENT @@ -1 +1 @@ -MANIFEST-000002 +MANIFEST-000010 diff --git a/packs-system/rituals/LOG b/packs-system/rituals/LOG index 257ab32..60018c2 100644 --- a/packs-system/rituals/LOG +++ b/packs-system/rituals/LOG @@ -1,5 +1,8 @@ -2025/04/24-23:51:45.159777 7fd07ffff6c0 Delete type=3 #1 -2025/04/24-23:53:49.085539 7fd07effd6c0 Level-0 table #5: started -2025/04/24-23:53:49.093043 7fd07effd6c0 Level-0 table #5: 60804 bytes OK -2025/04/24-23:53:49.104293 7fd07effd6c0 Delete type=0 #3 -2025/04/24-23:53:49.119460 7fd07effd6c0 Manual compaction at level-0 from '!items!4oyPRBWPBWAChrJP' @ 72057594037927935 : 1 .. '!items!zVFfp3o0G0Zg3Ia4' @ 0 : 0; will stop at (end) +2025/04/25-00:23:55.566074 7fd0855fa6c0 Recovering log #8 +2025/04/25-00:23:55.627155 7fd0855fa6c0 Delete type=3 #6 +2025/04/25-00:23:55.627214 7fd0855fa6c0 Delete type=0 #8 +2025/04/25-00:24:39.296644 7fd07effd6c0 Level-0 table #13: started +2025/04/25-00:24:39.296707 7fd07effd6c0 Level-0 table #13: 0 bytes OK +2025/04/25-00:24:39.302890 7fd07effd6c0 Delete type=0 #11 +2025/04/25-00:24:39.309638 7fd07effd6c0 Manual compaction at level-0 from '!items!4oyPRBWPBWAChrJP' @ 72057594037927935 : 1 .. '!items!zVFfp3o0G0Zg3Ia4' @ 0 : 0; will stop at (end) +2025/04/25-00:24:39.309671 7fd07effd6c0 Manual compaction at level-1 from '!items!4oyPRBWPBWAChrJP' @ 72057594037927935 : 1 .. '!items!zVFfp3o0G0Zg3Ia4' @ 0 : 0; will stop at (end) diff --git a/packs-system/rituals/LOG.old b/packs-system/rituals/LOG.old new file mode 100644 index 0000000..32bd59b --- /dev/null +++ b/packs-system/rituals/LOG.old @@ -0,0 +1,8 @@ +2025/04/24-23:56:15.236151 7fd0855fa6c0 Recovering log #4 +2025/04/24-23:56:15.247158 7fd0855fa6c0 Delete type=0 #4 +2025/04/24-23:56:15.247228 7fd0855fa6c0 Delete type=3 #2 +2025/04/25-00:23:51.709456 7fd07effd6c0 Level-0 table #9: started +2025/04/25-00:23:51.709498 7fd07effd6c0 Level-0 table #9: 0 bytes OK +2025/04/25-00:23:51.747489 7fd07effd6c0 Delete type=0 #7 +2025/04/25-00:23:51.747677 7fd07effd6c0 Manual compaction at level-0 from '!items!4oyPRBWPBWAChrJP' @ 72057594037927935 : 1 .. '!items!zVFfp3o0G0Zg3Ia4' @ 0 : 0; will stop at (end) +2025/04/25-00:23:51.809910 7fd07effd6c0 Manual compaction at level-1 from '!items!4oyPRBWPBWAChrJP' @ 72057594037927935 : 1 .. '!items!zVFfp3o0G0Zg3Ia4' @ 0 : 0; will stop at (end) diff --git a/packs-system/rituals/MANIFEST-000002 b/packs-system/rituals/MANIFEST-000002 deleted file mode 100644 index d57bd395e88ed2fd080062bdd226e83c3a06b447..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 135 zcmWIhx#Ncn10$nUPHI_dPD+xVQ)NkNd1i5{bAE0?Vo_pAe$kRS-TOEg7@3$k8JJmE z7^a?LnCb`QvH-bkEK=-DtSz^hdxuq2t=Nq^iM5P;hCYmtvK;%`X^1k3;U}WOv VWMJlDkuv 311006 bytes -2025/04/24-23:51:01.572344 7fd07effd6c0 compacted to: files[ 0 1 0 0 0 0 0 ] -2025/04/24-23:51:01.572607 7fd07effd6c0 Delete type=2 #152 -2025/04/24-23:51:01.585776 7fd07effd6c0 Manual compaction at level-0 from '!items!zvoUByzWSWZ87fxA' @ 526 : 1 .. '!items!zvoUByzWSWZ87fxA' @ 0 : 0; will stop at (end) +2025/04/24-23:56:15.221751 7fd07f7fe6c0 Recovering log #168 +2025/04/24-23:56:15.231420 7fd07f7fe6c0 Delete type=0 #168 +2025/04/24-23:56:15.231515 7fd07f7fe6c0 Delete type=3 #166 +2025/04/25-00:23:51.673765 7fd07effd6c0 Level-0 table #173: started +2025/04/25-00:23:51.673830 7fd07effd6c0 Level-0 table #173: 0 bytes OK +2025/04/25-00:23:51.709271 7fd07effd6c0 Delete type=0 #171 +2025/04/25-00:23:51.747663 7fd07effd6c0 Manual compaction at level-0 from '!folders!5PrT9QmN1cFPzDFP' @ 72057594037927935 : 1 .. '!items!zvoUByzWSWZ87fxA' @ 0 : 0; will stop at (end) diff --git a/packs-system/skills/MANIFEST-000166 b/packs-system/skills/MANIFEST-000174 similarity index 71% rename from packs-system/skills/MANIFEST-000166 rename to packs-system/skills/MANIFEST-000174 index 2f51f356ee7aa0a22ad94878df212bd7232349ea..ac6e1fbcf637718da3617d5e433b50ae2822ec04 100644 GIT binary patch delta 43 tcmdnQxQTH>pUUfbcK+N9j7;kpIT@HYFtWU44VRxU2@=@=64?Y20RRps3d#Tg delta 43 tcmdnQxQTH>p9;&2WdYm_j7-ZJIT@H&FtWU4Wma^k0g0>tiL3&N008pB3D^Jt