Rughalt / D35E

3.5e SRD implementation for Foundry VTT.
https://legaciesofthedragon.com
GNU General Public License v3.0
37 stars 30 forks source link

Low-light vision affects dim & bright vision #473

Open dev7355608 opened 3 years ago

dev7355608 commented 3 years ago

All light and vision sources radius are doubled currently. But only light sources should be doubled. The PF1 system handles it correctly; see here. Token.prototype.updateSource needs to be overridden to make the distinction between vision and light. PF1 had this issue also a while ago; see here.

I also think it's not right to override Token.prototype.getLightRadius(), since it's used for vision as well and not only for light; it's just a helper to calculate the radius in pixels given a range in units. The PF1 system overrides getLightRadius as well, but then divides by two in the updateSource patch to get the correct vision radii; I don't think this is the right approach. Instead override Token.prototype.dimRadius and Token.prototype.brightRadius like this:

  get dimRadius() {
    let dimLight = this.getLightRadius(this.data.dimLight);
    let dimSight = this.getLightRadius(this.data.dimSight);
    if (canvas.sight.hasLowLight()) {
        dimLight *= 2;
    }
    return Math.abs(dimLight) > Math.abs(dimSight) ? dimLight : dimSight;
  }
github-actions[bot] commented 3 years ago

Thanks for opening an issue, traveller! If your issue is related to an actor or an item, sending thing that is broken will help a lot and speed up debugging.

How to send an item? > - If item is owned by a character, drag and drop it to world item list. > - Right click on item in browser item list and click export. > - Attach downloaded item to this ticket. How to send an actor? > - Right click on actor in browser actor list and click export. > - Attach downloaded actor to this ticket.

Rughalt commented 3 years ago

Thanks for pointing that out! For now I ported PF1 solution as it is drop in for 3.5e so it at least has correct result, I will work on it more when I get to #383 that also deals with vision stuff.