From 3b3f57dbd938eecc7d5fe91ae8d99ad64f048b99 Mon Sep 17 00:00:00 2001 From: snap01 <43982555+snap01@users.noreply.github.com> Date: Tue, 3 Dec 2024 13:58:16 +0000 Subject: [PATCH 1/5] Fix ranged combat damage if no dice are rolled --- module/chat/rangecombat.js | 25 ++++++++-------------- templates/chat/combat/range-initiator.html | 5 ++++- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/module/chat/rangecombat.js b/module/chat/rangecombat.js index 9e8c91f9..c5298aed 100644 --- a/module/chat/rangecombat.js +++ b/module/chat/rangecombat.js @@ -70,29 +70,24 @@ export class CoC7RangeInitiator { t.pointBlankRange = false const pbRangeInYd = this.actor.system.characteristics.dex.value / 15 - if (distInYd <= pbRangeInYd) t.pointBlankRange = true + if (distInYd <= pbRangeInYd) t.toggleFlag('pointBlankRange') } - if (this.weapon) { + if (t.pointBlankRange !== true && this.weapon) { if (this.weapon.baseRange) { t.baseRange = false t.longRange = false t.extremeRange = false t.outOfRange = false if (this.weapon.system.properties.shotgun) { - if (distInYd <= this.weapon.baseRange) t.baseRange = true - if ( - distInYd > this.weapon.baseRange && - distInYd <= this.weapon.longRange - ) { + if (distInYd <= this.weapon.baseRange) { + t.baseRange = true + } else if (distInYd <= this.weapon.longRange) { t.longRange = true - } - if ( - distInYd > this.weapon.longRange && - distInYd <= this.weapon.extremeRange - ) { + } else if (distInYd <= this.weapon.extremeRange) { t.extremeRange = true + } else { + t.outOfRange = true } - if (distInYd > this.weapon.extremeRange) t.outOfRange = true } else { if (distInYd <= this.weapon.baseRange) t.baseRange = true if ( @@ -801,10 +796,8 @@ export class CoC7RangeInitiator { } for (let index = 0; index < impalingShots; index++) { const roll = new Roll(criticalDamageFormula) - /** MODIF 0.8.x **/ - await roll.evaluate({ async: true }) + await roll.evaluate() await CoC7Dice.showRollDice3d(roll) - /*****************/ const dice = [] for (const die of roll.dice) { for (const result of die.results) { diff --git a/templates/chat/combat/range-initiator.html b/templates/chat/combat/range-initiator.html index 5452c905..0f700d58 100644 --- a/templates/chat/combat/range-initiator.html +++ b/templates/chat/combat/range-initiator.html @@ -112,7 +112,6 @@

{{localize 'CoC7.rangeCombatCard.InMelee'}} {{localize 'CoC7.rangeCombatCard.FastMovingTarget'}} - {{log ../this}}
{{localize 'CoC7.AdditionalBonusDie'}} {{localize 'CoC7.AdditionalBonusDie'}} @@ -341,6 +340,10 @@

{{roll.malfunctionTxt}}

{{#each roll.dice as |die|}}
  • {{die.result}}
  • {{/each}} + {{#unless roll.dice.length}} +
  • {{roll.total}}
  • + {{log roll}} + {{/unless}} {{/each}}
    From f4ff1ce3ef58974d1468c77a073be779f25ca327 Mon Sep 17 00:00:00 2001 From: snap01 <43982555+snap01@users.noreply.github.com> Date: Tue, 3 Dec 2024 13:59:35 +0000 Subject: [PATCH 2/5] Fix ranged combat damage if no dice are rolled --- templates/chat/combat/range-initiator.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/templates/chat/combat/range-initiator.html b/templates/chat/combat/range-initiator.html index 0f700d58..65f4a890 100644 --- a/templates/chat/combat/range-initiator.html +++ b/templates/chat/combat/range-initiator.html @@ -341,8 +341,7 @@

    {{roll.malfunctionTxt}}

  • {{die.result}}
  • {{/each}} {{#unless roll.dice.length}} -
  • {{roll.total}}
  • - {{log roll}} +
  • {{roll.total}}
  • {{/unless}} {{/each}} From e790870996ef6e17d7f2f3923271139e1c7bc1a0 Mon Sep 17 00:00:00 2001 From: snap01 <43982555+snap01@users.noreply.github.com> Date: Tue, 3 Dec 2024 20:27:45 +0000 Subject: [PATCH 3/5] Add ChatMessage Roll.0 pushing/pushed and luckSpent --- module/check.js | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/module/check.js b/module/check.js index d860f8b5..2a1a712f 100644 --- a/module/check.js +++ b/module/check.js @@ -421,6 +421,15 @@ export class CoC7Check { if (oldCheck.parent) pushedRoll.parent = oldCheck.parent pushedRoll.pushing = true await pushedRoll.roll() + if (oldCheck.messageId) { + const o = await game.messages.get(oldCheck.messageId) + if (typeof o.rolls?.[0]?.options?.coc7Result !== 'undefined') { + o.rolls[0].options.coc7Result.pushing = true + await o.update({ + rolls: o.rolls + }) + } + } if (publish) pushedRoll.toMessage(true, card) } @@ -1101,10 +1110,23 @@ export class CoC7Check { this.canIncreaseSuccess = this.increaseSuccess.length > 0 if (this.isFumble) this.canIncreaseSuccess = false } - this.dice.roll.options.coc7Result = { - successLevel: Object.keys(CoC7Check.successLevel).find(key => CoC7Check.successLevel[key] === this.successLevel) ?? 'unknown', - difficultySet: !this.isUnknown, - passed: this.passed + if (this.dice) { + this.dice.roll.options.coc7Result = { + successLevel: Object.keys(CoC7Check.successLevel).find(key => CoC7Check.successLevel[key] === this.successLevel) ?? 'unknown', + difficultySet: !this.isUnknown, + passed: this.passed, + pushing: false, + pushed: this.pushing, + luckSpent: this.totalLuckSpent ?? 0 + } + } else if (typeof this.messageId === 'string') { + const o = await game.messages.get(this.messageId) + if (typeof o.rolls?.[0]?.options?.coc7Result !== 'undefined') { + o.rolls[0].options.coc7Result.luckSpent = this.totalLuckSpent ?? 0 + await o.update({ + rolls: o.rolls + }) + } } this.canAwardExperience = From 483b178c043b36ae56852d32fb123d8002e83706 Mon Sep 17 00:00:00 2001 From: snap01 <43982555+snap01@users.noreply.github.com> Date: Tue, 3 Dec 2024 20:43:06 +0000 Subject: [PATCH 4/5] Update CHANGELOG.md --- .github/CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index f88a38b2..9c445c98 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -9,6 +9,9 @@ Happy gaming ! When not specified, all changes were made by @castanhocorreia, @HavlockV, and @snap01. +- Add ChatMessage Roll.0 pushing/pushed and luckSpent values +- Fix ranged combat damage if no dice are rolled + ## Version 7.5 When not specified, all changes were made by @castanhocorreia, @HavlockV, and @snap01. From d0f6ad8704ea7e8424fc24bd3871132332e8a72e Mon Sep 17 00:00:00 2001 From: snap01 <43982555+snap01@users.noreply.github.com> Date: Sat, 7 Dec 2024 13:50:03 +0000 Subject: [PATCH 5/5] Prepare system for 7.6 --- .github/CHANGELOG.md | 4 ++++ module/updater.js | 4 +++- system.json | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 9c445c98..510ddcf0 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -9,6 +9,10 @@ Happy gaming ! When not specified, all changes were made by @castanhocorreia, @HavlockV, and @snap01. +## Version 7.6 + +When not specified, all changes were made by @castanhocorreia, @HavlockV, and @snap01. + - Add ChatMessage Roll.0 pushing/pushed and luckSpent values - Fix ranged combat damage if no dice are rolled diff --git a/module/updater.js b/module/updater.js index 3f42dd5f..78c5cfe0 100644 --- a/module/updater.js +++ b/module/updater.js @@ -22,7 +22,9 @@ export class Updater { if (runMigrate || !Object.prototype.hasOwnProperty.call(this.updatedModules, module.id) || String(this.updatedModules[module.id]) !== String(module.version)) { // A migration is required, module has not been updated before, or the version number has changed, check against known good values const knownModuleVersions = { - 'call-of-cthulhu-foundryvtt-investigator-wizard': '1.0.3' + 'call-of-cthulhu-foundryvtt-investigator-wizard': '1.0.3', + 'cha-coc-fvtt-en-quickstart': '7.0', + 'cha-coc-fvtt-en-starterset': '7.0' } if (typeof knownModuleVersions[module.id] === 'string') { if (foundry.utils.isNewerVersion(module.version, knownModuleVersions[module.id])) { diff --git a/system.json b/system.json index 604f02f1..31f4d661 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "id": "CoC7", "title": "Call of Cthulhu 7th Edition", "description": "An implementation of the Call of Cthulhu 7th Edition game system for Foundry Virtual Tabletop.", - "version": "7.5", + "version": "7.6", "authors": [ { "name": "Miskatonic Investigative Society" @@ -207,7 +207,7 @@ "secondaryTokenAttribute": "attribs.san", "url": "https://github.com/Miskatonic-Investigative-Society/CoC7-FoundryVTT", "manifest": "https://github.com/Miskatonic-Investigative-Society/CoC7-FoundryVTT/releases/latest/download/system.json", - "download": "https://github.com/Miskatonic-Investigative-Society/CoC7-FoundryVTT/releases/download/7.5/system.zip", + "download": "https://github.com/Miskatonic-Investigative-Society/CoC7-FoundryVTT/releases/download/7.6/system.zip", "media": [ { "type": "setup",