diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index f88a38b2..510ddcf0 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -9,6 +9,13 @@ 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 + ## Version 7.5 When not specified, all changes were made by @castanhocorreia, @HavlockV, and @snap01. 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/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 = 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", diff --git a/templates/chat/combat/range-initiator.html b/templates/chat/combat/range-initiator.html index 5452c905..65f4a890 100644 --- a/templates/chat/combat/range-initiator.html +++ b/templates/chat/combat/range-initiator.html @@ -112,7 +112,6 @@