Nazrax / fvtt-combat-range-overlay

MIT License
2 stars 4 forks source link

Support for SWADE system #10

Open loofou opened 1 year ago

loofou commented 1 year ago

It would be great if you could support the SWADE system. I looked into creating a PR, but it seems you have hardcoded basically every assumption that comes with DND, which is unfortunate, as other systems just don't always work this way. One is for example the 6ft grid size.

To fully support another system (and also SWADE) the following would need to be done:

  1. Use the canvas grid size instead of hardcoding 6ft grids. SWADE default distance is 2 yards per Pace (which is the speed of a character). The grid itself is also defined as 2 yards per grid, which means you could simplify the system to just count grids. 1 grid per Pace. Handling it by using the canvas measurements means this should work automatically (set one map grid to be 2 yards and have each Pace count for 2 yards - done). At best allow people to specify the amount of grid units per speed value, this way you would be open for other systems. For DND etc it can be defaulted to 6ft for example.
  2. Auto-detect pace: system.stats.speed.value (There is also a running system in which you can roll a die to get a value to add to your pace this round. It would be great to support it, but I think a simple start is fine)
  3. Weapon ranges are tricky: Basically any value is allowed and there are three "bands" each doubling the distance of the one before. So a value of "12/24/48" is typical for a pistol, meaning you can hit easily up to 12 grid units, get a slight malus up to 24 units and then a bigger malus up to 48 and anything above is nearly impossible to hit. This counts for ranged weapons. Close-combat weapons usually just hit the grid right next to the character, but rarely weapons have a "reach" value, which I don't think is actually implemented into the system itself. The range is found under system.range of the weapon item. This is a string in the above format, so a simple "split" should suffice to give the separate values.
  4. You can find currently equipped weapons by scanning through all items a character has and check for the equipment status. If the system.equipStatus is >= 3 the weapon is equipped.

There is the concept of multi-actions in SWADE, but it's complex and I wouldn't try to implement it from the start. I would instead assume that every character can do one action per turn for now. This can already be set up with the slider in the settings.

I think the most important change should be the first one. Actually using the canvas grid units and letting the user decide in the settings how the speed value is supposed to be interpreted will help a lot in making this module work with non-dnd systems.

As a fellow developer I would recommend to try to refactor the system to have less hardcoded values. Instead using an OOP system might work well here. This way new values for a system could be as simple as inheriting a class and implementing the differences. THis makes it easier for other people to provide PRs as well.

This is a long text and I hope I didn't disencourage you with it :D it's a really great module and I just want more people to be able to enjoy it :)

elpossum commented 4 months ago

Sorry I haven't noticed this issue before as issues do not transfer to forks. This module was taken over by me June 16 2023 and is now at this repository. I hope this issue has been resolved since, but if it still persists, please open it again at this page.