Skip to content

Commit

Permalink
fix damage calculation post edge/trouble.
Browse files Browse the repository at this point in the history
closes issue #43 #43
  • Loading branch information
mjording committed Sep 11, 2024
1 parent ccec601 commit f5e2393
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ If either of these conditions are not met on the commit that tag points at, the
- The `system.json` file's `download` url must match the expected outcome of the release CI artifact. This should simply be changing version numbers in the url to match the release version.

```text
https://github.com/mjording/marvel-multiverse/releases/download/release-1.6.7/marvel-multiverse-1.6.7.zip
https://github.com/mjording/marvel-multiverse/releases/download/release-1.6.8/marvel-multiverse-1.6.8.zip
└─ Tag Name ──┘ └─ V ─┘ (version)
```

Expand Down
7 changes: 4 additions & 3 deletions module/documents/chat-message.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ export class ChatMessageMarvel extends ChatMessage {
const marvelRoll = sixOneSixPool.rolls[1];
const actor = game.actors.contents.find((a) => a.name === chatMessage.alias);

const [marvelDie] = marvelRoll.dice;
const damageMultiplier = actor.system.abilities[abilityAbr].damageMultiplier;

const targetToken = canvas.tokens.controlled[0];
Expand All @@ -282,11 +283,11 @@ export class ChatMessageMarvel extends ChatMessage {
let lessDamage = 0;
if (target){
damageReduction = damageType && damageType === "focus" ? target.system.focusDamageReduction : target.system.healthDamageReduction;
lessDamage = marvelRoll.total * damageReduction;
lessDamage = marvelDie.total * damageReduction;
}
const abilityValue = actor.system.abilities[abilityAbr].value;

const dmg = marvelRoll.total * damageMultiplier + abilityValue;
const dmg = marvelDie.total * damageMultiplier + abilityValue;
let fantasticDmg;
let fantasticLessDmg;

Expand All @@ -295,7 +296,7 @@ export class ChatMessageMarvel extends ChatMessage {
fantasticLessDmg = lessDamage * 2;
}

const content = `Delivers <b>${dmg}</b> points [ MarvelDie: ${marvelRoll.total} * ${ability} damage multiplier: ${damageMultiplier} + ${ability} score ${abilityValue} ] of damage.<p> ${fantastic ? 'fantastic roll 2x close attack Dmg: <b>' + fantasticDmg : ''}</b></p>`;
const content = `Delivers <b>${dmg}</b> points [ MarvelDie: ${marvelDie.total} * ${ability} damage multiplier: ${damageMultiplier} + ${ability} score ${abilityValue} ] of damage.<p> ${fantastic ? 'fantastic roll 2x close attack Dmg: <b>' + fantasticDmg : ''}</b></p>`;
if(damageReduction){
content.concat(' ', `<br>Target Has damageReduction of ${damageReduction}</br><p>With Damage Reduced damage is: <b>${lessDamage}</b> ${fantastic ? 'fantastic roll 2x attack dmg: ' + fantasticLessDmg : ''}</p>` );
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "marvel-multiverse",
"version": "1.6.7",
"version": "1.6.8",
"description": "CSS compiler for the MarvelMultiverse system",
"scripts": {
"build:css": "sass src/scss/marvel-multiverse.scss css/marvel-multiverse.css --style=expanded --no-source-map",
Expand Down
4 changes: 2 additions & 2 deletions system.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"thumbnail": "systems/marvel-multiverse/ui/official/mmrpg-setup-thumbnail.png"
}
],
"version": "1.6.7",
"version": "1.6.8",
"compatibility": {
"minimum": 12,
"verified": "12.328"
Expand Down Expand Up @@ -116,7 +116,7 @@
],
"socket": true,
"manifest": "https://raw.githubusercontent.com/mjording/marvel-multiverse/main/system.json",
"download": "https://github.com/mjording/marvel-multiverse/releases/download/release-1.6.7/marvel-multiverse-release-1.6.7.zip",
"download": "https://github.com/mjording/marvel-multiverse/releases/download/release-1.6.8/marvel-multiverse-release-1.6.8.zip",
"background": "systems/marvel-multiverse/ui/official/mmrpg-background.webp",
"grid": {
"distance": 5,
Expand Down

0 comments on commit f5e2393

Please sign in to comment.