ironmonk88 / monks-combat-details

GNU General Public License v3.0
11 stars 7 forks source link

[BUG] Placeholder breaks Combat Tracker in Non-D20-Systems #81

Open Enkrod opened 4 months ago

Enkrod commented 4 months ago

Describe the bug When using monks-combat-details placeholders in the initiative tracker with (for example) earthdawn4e an error message appears, no initiative for the placeholder is rolled and the combat tracker does not advance to the next round (it's always round 1).

Console message:

Uncaught (in promise) TypeError: CONFIG.Dice.D20Roll is not a constructor
CombatantInitiative https://[my url]/modules/monks-combat-details/js/placeholder.js:48
[...]

To Reproduce Steps to reproduce the behavior:

  1. install earthdawn4e as system
  2. create a combat encounter with a placeholder and start the encounter
  3. advance through the turns to the end of the round and begin next round,
  4. Earthdawn system initiates initiative roll at start of new round
  5. See error in console and still round 1 in combat tracker

Expected behavior Combat tracker increments round number by one.

Desired behavior Desired behavior is hard to pin down. In general different systems use different ways to generate initiative, I recognize there is no easy one-size-fits-all solution, but the solution implemented right now is either only compatible with D20 systems or uses deprecated CONFIG elements. There should be a way to "keep last rounds initiative value" for placeholders or a way to input a formula like 1d20 or 1d8x or 20 and roll that without the CONFIG.Dice.D20Roll constructor.

Quick fix In /js/placeholder.js:48 use a different way to roll a D20, like ~return new CONFIG.Dice.D20Roll("1d20", {});~ -> return new CONFIG.Dice.rolls[0]("1d20", {});, but this seems like a really dirty solution.

Please complete as much of the following information as possible: