foundryvtt-dcc / dcc

Foundry Tabletop System for Dungeon Crawl Classics RPG
MIT License
32 stars 20 forks source link

Damage rolls should at least be 1 #200

Closed algnc closed 3 years ago

algnc commented 3 years ago

Several times yesterday I had level 0s roll 0 damage because of their -2 STR mod.

futurekill commented 3 years ago

213 should fix this I think.

mooped commented 3 years ago

I'd like to add some messaging to let the user know that we adjusted the result. I can see us getting queries if the roll outcome doesn't match the dice and formula with no explanation.

futurekill commented 3 years ago

Gotcha. Then perhaps a check in the rollWeaponAttack method or the _formatDamageRoll would be better?

futurekill commented 3 years ago

Something like this maybe?

    if (rollResult.rolled) {
      const rollData = escape(JSON.stringify(rollResult.roll))
      if (rollResult.damage <= 0) {
        return `<a class="inline-roll inline-result damage-applyable" data-roll="${rollData}" data-damage="1" title="${rollResult.formula}"><i class="fas fa-dice-d20"></i> 1 (min dmg)</a>`
      } else {
        return `<a class="inline-roll inline-result damage-applyable" data-roll="${rollData}" data-damage="${rollResult.damage}" title="${rollResult.formula}"><i class="fas fa-dice-d20"></i> ${rollResult.damage}</a>`
      }
    } else {
      return game.i18n.format('DCC.DamageRollInvalidFormulaInline', { formula: rollResult.formula })
    }
  }