diff --git a/lang/en.json b/lang/en.json index 586c2db..496f9f1 100644 --- a/lang/en.json +++ b/lang/en.json @@ -357,6 +357,9 @@ "newArchetype": "New Archetype", "newSkill": "New Skill" }, + "ChatMessage": { + "exhausted": "Your protagonist is exhausted. He loses [[/r 1d6]] Willpower Points." + }, "Edit": "Edit", "Delete": "Delete", "ToggleSheet": "Toggle Sheet", diff --git a/module/applications/sheets/protagonist-sheet.mjs b/module/applications/sheets/protagonist-sheet.mjs index 42f1ad1..a43a5cb 100644 --- a/module/applications/sheets/protagonist-sheet.mjs +++ b/module/applications/sheets/protagonist-sheet.mjs @@ -195,7 +195,7 @@ export default class CthulhuEternalProtagonistSheet extends CthulhuEternalActorS case "char": let charId = $(event.currentTarget).data("char-id") item = foundry.utils.duplicate(this.actor.system.characteristics[charId]) - item.name = game.i18n.localize("CTHULHUETERNAL.Label." + charId + "Long") + item.name = game.i18n.localize(`CTHULHUETERNAL.Label.${charId}Long`) item.targetScore = item.value * 5 break case "skill": diff --git a/module/documents/actor.mjs b/module/documents/actor.mjs index 91d3e14..ee82081 100644 --- a/module/documents/actor.mjs +++ b/module/documents/actor.mjs @@ -28,6 +28,19 @@ export default class CthulhuEternalActor extends Actor { return super.create(data, options); } + _onUpdate(changed, options, userId) { + // DEBUG : console.log("CthulhuEternalActor.update", changed, options, userId) + if ( changed?.system?.wp?.exhausted) { + ChatMessage.create({ + user: userId, + speaker: { alias: this.name }, + rollMode: "selfroll", + content: game.i18n.localize("CTHULHUETERNAL.ChatMessage.exhausted"), + type: CONST.CHAT_MESSAGE_STYLES.OTHER + }) + } + return super._onUpdate(changed, options, userId) + } async _preCreate(data, options, user) { await super._preCreate(data, options, user) diff --git a/module/documents/roll.mjs b/module/documents/roll.mjs index c6e7409..baf0513 100644 --- a/module/documents/roll.mjs +++ b/module/documents/roll.mjs @@ -79,6 +79,18 @@ export default class CthulhuEternalRoll extends Roll { return this.options.weapon } + get isLowWP() { + return this.options.isLowWP + } + + get isZeroWP() { + return this.options.isZeroWP + } + + get isExhausted() { + return this.options.isExhausted + } + /** * Prompt the user with a dialog to configure and execute a roll. * @@ -165,6 +177,7 @@ export default class CthulhuEternalRoll extends Roll { targetScore: options.initialScore, isLowWP: options.isLowWP, isZeroWP: options.isZeroWP, + isExhausted: options.isExhausted, rollModes, fieldRollMode, choiceModifier, @@ -211,7 +224,7 @@ export default class CthulhuEternalRoll extends Roll { // Update target score console.log(rollData) rollData.targetScore = Math.min( Math.max(options.initialScore + Number(rollData.modifier), 0), 100) - if ( rollData.isLowWP ) { + if ( rollData.isLowWP || rollData.isExhausted) { rollData.targetScore -= 20 } if ( rollData.isZeroWP ) { @@ -248,6 +261,9 @@ export default class CthulhuEternalRoll extends Roll { roll.options.isSuccess = resultType === "success" || resultType === "successCritical" roll.options.isFailure = resultType === "failure" || resultType === "failureCritical" roll.options.isCritical = resultType === "successCritical" || resultType === "failureCritical" + roll.options.isLowWP = rollData.isLowWP + roll.options.isZeroWP = rollData.isZeroWP + roll.options.isExhausted = rollData.isExhausted /** * A hook event that fires after the roll has been made. @@ -327,6 +343,10 @@ export default class CthulhuEternalRoll extends Roll { cardData.realDamage = this.realDamage cardData.isPrivate = isPrivate cardData.weapon = this.weapon + cardData.isLowWP = this.isLowWP + cardData.isZeroWP = this.isZeroWP + cardData.isExhausted = this.isExhausted + console.log(cardData) diff --git a/module/models/protagonist.mjs b/module/models/protagonist.mjs index 6dba796..ab7542f 100644 --- a/module/models/protagonist.mjs +++ b/module/models/protagonist.mjs @@ -154,6 +154,10 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData return this.wp.value === 0 } + isExhausted() { + return this.wp.exhausted + } + /** */ /** * Rolls a dice for a character. @@ -170,6 +174,7 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData rollItem, isLowWP: this.isLowWP(), isZeroWP: this.isZeroWP(), + isExhausted: this.isExhausted(), actorId: this.parent.id, actorName: this.parent.name, actorImage: this.parent.img, diff --git a/packs/skills/CURRENT b/packs/skills/CURRENT index 2581c87..6e219f2 100644 --- a/packs/skills/CURRENT +++ b/packs/skills/CURRENT @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:befea596b4676ccf7cc37ea8048044bfa0556c8931d76fdeeb693d20264e50d6 +oid sha256:01bd196d6a114691ec642082ebf6591765c0168d4098a0cd834869bd11c8b87d size 16 diff --git a/packs/skills/LOG b/packs/skills/LOG index d7fc279..a974022 100644 --- a/packs/skills/LOG +++ b/packs/skills/LOG @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d63e51e65f5851187a85a7a837b184ae57f8243b1037b04d01bf737da77d0fad +oid sha256:6d59c6d2254ffe202163060c24e513c31e94816c54ab14f8a8334094c9404871 size 736 diff --git a/packs/skills/LOG.old b/packs/skills/LOG.old index a0099c2..d7fc279 100644 --- a/packs/skills/LOG.old +++ b/packs/skills/LOG.old @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c3b8abd5dd4babc51e588edc81d6e40a79ca0c861a1a88a82dbd0bb63e1788eb -size 175 +oid sha256:d63e51e65f5851187a85a7a837b184ae57f8243b1037b04d01bf737da77d0fad +size 736 diff --git a/packs/skills/MANIFEST-000016 b/packs/skills/MANIFEST-000016 deleted file mode 100644 index 9f3457f..0000000 --- a/packs/skills/MANIFEST-000016 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:125b601ea27bd0f54a7429cac179678ac5fcfba91d406d96b566ef51745ea4dc -size 139 diff --git a/templates/chat-ask-roll.hbs b/templates/chat-ask-roll.hbs deleted file mode 100644 index 5c609d2..0000000 --- a/templates/chat-ask-roll.hbs +++ /dev/null @@ -1,6 +0,0 @@ -
-

{{title}}
{{text}}

- - {{localize 'TENEBRIS.Manager.roll'}} - -
\ No newline at end of file diff --git a/templates/chat-message.hbs b/templates/chat-message.hbs index 8a683ae..6812864 100644 --- a/templates/chat-message.hbs +++ b/templates/chat-message.hbs @@ -1,55 +1,70 @@ {{!log 'chat-message' this}}
-
-
- -
-
-
    - {{#if (eq rollType "char")}} -
  • {{localize "CTHULHUETERNAL.Label.charRoll"}}
  • - {{/if}} - - {{#if (eq rollType "skill")}} -
  • {{localize "CTHULHUETERNAL.Label.skillRoll"}}
  • - {{/if}} - - {{#if weapon}} -
  • Weapon : {{weapon.name}}
  • - {{/if}} - -
  • {{rollItem.name}} : {{initialScore}}%
  • -
  • {{localize "CTHULHUETERNAL.Label.modifier"}} : {{modifier}}%
  • -
  • {{localize "CTHULHUETERNAL.Label.targetScore"}} : {{targetScore}}%
  • - {{#if isSuccess}} - {{#if isCritical}} -
  • {{localize "CTHULHUETERNAL.Label.criticalSuccess"}}
  • - {{else}} -
  • {{localize "CTHULHUETERNAL.Label.success"}}
  • - {{/if}} - {{/if}} - {{#if isFailure}} - {{#if isCritical}} -
  • {{localize "CTHULHUETERNAL.Label.criticalFailure"}}
  • - {{else}} -
  • {{localize "CTHULHUETERNAL.Label.failure"}}
  • - {{/if}} - {{/if}} -
-
+
+
+
- {{#if isDamage}} -
- {{#if (and isGM hasTarget)}} - {{{localize "CTHULHUETERNAL.Roll.displayArmor" targetName=targetName targetArmor=targetArmor realDamage=realDamage}}} - {{/if}} -
- {{/if}} - {{#unless isPrivate}} -
-

{{total}}

-
{{formula}}
- {{{tooltip}}} -
- {{/unless}} -
+
+
    + {{#if (eq rollType "char")}} +
  • {{localize "CTHULHUETERNAL.Label.charRoll"}}
  • + {{/if}} + + {{#if (eq rollType "skill")}} +
  • {{localize "CTHULHUETERNAL.Label.skillRoll"}}
  • + {{/if}} + + {{#if weapon}} +
  • Weapon : {{weapon.name}}
  • + {{/if}} + +
  • {{rollItem.name}} : {{initialScore}}%
  • + + {{#if isZeroWP}} +
  • Zero WP : Automatic failure (ie 0%)
  • + {{else}} + {{#if isLowWP}} +
  • Low WP : -20%
  • + {{/if}} + {{/if}} + + {{#if isExhausted}} +
  • Exhausted : -20%
  • + {{/if}} + +
  • {{localize "CTHULHUETERNAL.Label.modifier"}} : {{modifier}}%
  • + +
  • {{localize "CTHULHUETERNAL.Label.targetScore"}} : {{targetScore}}%
  • + {{#if isSuccess}} + {{#if isCritical}} +
  • {{localize "CTHULHUETERNAL.Label.criticalSuccess"}}
  • + {{else}} +
  • {{localize "CTHULHUETERNAL.Label.success"}}
  • + {{/if}} + {{/if}} + {{#if isFailure}} + {{#if isCritical}} +
  • {{localize "CTHULHUETERNAL.Label.criticalFailure"}}
  • + {{else}} +
  • {{localize "CTHULHUETERNAL.Label.failure"}}
  • + {{/if}} + {{/if}} +
+
+
+ {{#if isDamage}} +
+ {{#if (and isGM hasTarget)}} + {{{localize "CTHULHUETERNAL.Roll.displayArmor" targetName=targetName targetArmor=targetArmor + realDamage=realDamage}}} + {{/if}} +
+ {{/if}} + {{#unless isPrivate}} +
+

{{total}}

+
{{formula}}
+ {{{tooltip}}} +
+ {{/unless}} +
\ No newline at end of file diff --git a/templates/roll-dialog.hbs b/templates/roll-dialog.hbs index 43cea56..2bdcd80 100644 --- a/templates/roll-dialog.hbs +++ b/templates/roll-dialog.hbs @@ -21,6 +21,11 @@
Low WP : -20%
{{/if}} {{/if}} + + {{#if isExhausted}} +
Exhausted : -20%
+ {{/if}} +