Skip to content

Commit

Permalink
Merge pull request #1650 from Miskatonic-Investigative-Society/develop
Browse files Browse the repository at this point in the history
7.6
  • Loading branch information
snap01 authored Dec 7, 2024
2 parents f12185b + cbedcbf commit 716918c
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 24 deletions.
7 changes: 7 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
25 changes: 9 additions & 16 deletions module/chat/rangecombat.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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) {
Expand Down
30 changes: 26 additions & 4 deletions module/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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 =
Expand Down
4 changes: 3 additions & 1 deletion module/updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -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])) {
Expand Down
4 changes: 2 additions & 2 deletions system.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 3 additions & 1 deletion templates/chat/combat/range-initiator.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ <h3 style="text-align: center;font-weight: bolder;" class="item-name card-title"
<span class="flex1 toggle-switch inMelee target-flag {{#unless ../rolled}}simple-flag{{/unless}} {{#if trgt.inMelee}}switched-on{{/if}} gm-select-only" title="{{localize 'CoC7.rangeCombatCard.InMeleeTitle'}}" style="text-align:center" data-flag="in-melee" data-selected={{trgt.inMelee}}>{{localize 'CoC7.rangeCombatCard.InMelee'}}</span>
<span class="flex1 toggle-switch fast target-flag {{#unless ../rolled}}simple-flag{{/unless}} {{#if trgt.fast}}switched-on{{/if}} gm-select-only" title="{{localize 'CoC7.rangeCombatCard.FastMovingTargetTitle'}}" style="text-align:center" data-flag="fast" data-selected={{trgt.fast}}>{{localize 'CoC7.rangeCombatCard.FastMovingTarget'}}</span>
</div>
{{log ../this}}
<div class="flexrow range-selection" style="border-top: 2px groove #fff; padding-top: 3px">
<span class="flex1 toggle-switch {{#unless ../rolled}}simple-flag{{/unless}} {{#if ../bonusDieA}}switched-on{{/if}} gm-select-only" title="{{localize 'CoC7.AdditionalBonusDie'}}" style="text-align:center" data-flag="bonus-die-a">{{localize 'CoC7.AdditionalBonusDie'}}</span>
<span class="flex1 toggle-switch {{#unless ../rolled}}simple-flag{{/unless}} {{#if ../bonusDieB}}switched-on{{/if}} gm-select-only" title="{{localize 'CoC7.AdditionalBonusDie'}}" style="text-align:center" data-flag="bonus-die-b">{{localize 'CoC7.AdditionalBonusDie'}}</span>
Expand Down Expand Up @@ -341,6 +340,9 @@ <h4 class="malfunction">{{roll.malfunctionTxt}}</h4>
{{#each roll.dice as |die|}}
<li class="roll die d{{die.faces}}" data-group="{{group}}" data-formula="{{roll.formula}}" data-total="{{roll.total}}" data-die="{{roll.die}}" data-critical="{{roll.critical}}" data-faces="{{die.faces}}" data-result="{{die.result}}">{{die.result}}</li>
{{/each}}
{{#unless roll.dice.length}}
<li class="roll die d6" data-group="{{group}}" data-formula="{{roll.formula}}" data-total="{{roll.total}}" data-die="{{roll.die}}" data-critical="{{roll.critical}}" data-faces="6" data-result="{{roll.total}}">{{roll.total}}</li>
{{/unless}}
{{/each}}
</ol>
</div>
Expand Down

0 comments on commit 716918c

Please sign in to comment.