dev7355608 / vision-5e

Foundry VTT Module: Vision/Detection Modes for D&D 5e
https://foundryvtt.com/packages/vision-5e
MIT License
13 stars 12 forks source link

Devils Sight and Darkvision create an infinite Darkvision vision range (but no actual token visibility to that range) #111

Closed dineshm72 closed 1 month ago

dineshm72 commented 1 month ago

Using FTC with only Vision 5e and libraries active. I have a character who has both 60' of Darkvision (from elf) and 120' of Devil's Sight (from warlock invocation).

Characters with only Darkvision correctly get 60' of Darkvision detection by default: image

For some reason, this combination of Darkvision and DS is creating a default detection mode of infinite darkvision in addition to the 120' of Devil's Sight detection: image

(As an aside, DDB incorrectly shows this as 120 feet of darkvision on the char sheet, but I don't think that matters at all.) image

The visuals being generated seem to be mostly right. In this example, the token on the right is the one with both DV and DS. The two tokens on the left are 120 and 125 feet away. The wall behind them is 140 feet away. GM view with nothing selected. image

When switched to Devil's Sight Vision mode for the right hand token, it seems to work perfectly, token config shows the Vision range at 120', colored vision out to 120', one token visible, one not visible and not detected by anything.
image

When set to Darkvision, the token config indicates an infinite vision range (which is wrong for the char sheet, but correct to the detection mode setting). The dim light polygon is generated out to infinity (or at least to 140 feet), which is wrong to the character sheet but correct to the config dialog. But even weirder, tokens in that dim light are actually only visible out to 120 feet, past that there is a dim light polygon being generated apparently, but no tokens past 120' in that polygon are actually getting illuminated by it (i.e. the left most token in this pic is at 125 feet and standing in the darkvision dim light polygon and so should be visible to the token on the right, but isn't). But detection (correctly, I think) only works out to 120' (presumably from the DS).
image

Manually overriding the Darkvision Detection mode to 60' seems to give what I'd expect, 60 feet of vision range, 60 feet of dim light polygon, nothing illuminated by dim light beyond that, then a token detected (by the Devil's Sight) out at 120, and no detection of the token at 125 feet. image

So, to summarize, I think there are 2 issues. One, this char with 60' DV and 120' DS is getting generated with an infinite darkvision range. Two, tokens at more than 120' with the incorrect defaults should be visible, but aren't for some reason.

dineshm72 commented 1 month ago

I should add that the notes say: Note: Remove the active effect that gives 120 feet Darkvision from the Invocation: Devil's Sight feat if it exists: Devil's Sight doesn't increase the range of Darkvision.

But my invocation only has the CPR AE listed (and CPR isn't even enabled at the time of testing): image

dineshm72 commented 1 month ago

Finally, just to confirm: the proto token detection modes table is supposed to be blank, correct? And then gets generated automatically when the token is dropped? That seems to be what I am seeing.

Adding in the override for DV in that blank table does seem to get saved and does override all new tokens, which is perfect. I was just a little surprised to find it blank.

dev7355608 commented 1 month ago

On token creation the prototype data is cloned. So any detection modes the prototype token had are copied to the token, which then override the detection mode ranges that automatically calculated from the actor by Vision 5e. So with Vision 5e you actually don't want any entries in the prototype's detection modes.

dev7355608 commented 1 month ago

You say the prototype token that infinite Darkvision configured? But the fact that the Darkvision entry in the token config is disabled tells me it can't be from the prototype token: only automatically calculated range from the actor are disabled. So that's odd. Not sure how you can end up with infinite darkvision. What does _token.document.actor.system.attributes.senses return?

dineshm72 commented 1 month ago

No, in the prototype token the detection modes table is blank/empty. When the token gets dropped, it generates the detection modes shown above, with the infinite darkvision.

I then manually put a 60' darkvision detection on the token prototype, and it behaved as you described and as I hoped - it overrode the default darkvision infinite with my manual 60' darkvision. So I at least have a way to manually fix it for this PC actor.

If I then later deleted that manual entry, it reverted back to blank prototype token table, and the infinite darkvision on the tokens created from it.

The console command above returns: image

dev7355608 commented 1 month ago

Is darkvision undefined even if you disable all modules? If so that would be a system bug, I think. The sense ranges should always be a number. What version of dnd5e do you use?

dineshm72 commented 1 month ago

yep (at least with everything off but FTC):

image

On dnd 3.3.1

dev7355608 commented 1 month ago

Since 3.2.0 the prepared sense ranges should always be numeric. Are you sure there isn't an active effect that somehow breaks the darkvision range? Look at _token.document.actor.overrides to be sure.

dineshm72 commented 1 month ago

I'm not exactly sure what I'm looking for here, but here is what that command returns:

image

The CPR and midi flags are expected I think. There is an effect for darkvision: undefined but it is a system one, I have no idea why it is there.

As info, here is the effects tab: image

dev7355608 commented 1 month ago

One of these active effects must affect darkvision. Doesn't the Belt of Dwarvenkind give darkvision?

dineshm72 commented 1 month ago

D'oh! You are of course correct, it seems that having that item attuned and equipped is causing the DV setting to go undefined. Since the char already has 60' DV from its racial it didn't occur to me.

I tried deleting and bringing in a fresh copy and it's still doing it, so I'm guessing maybe it's an issue with the item or the DDBI import. I'll have a loot and then take it to MrPrimate.

Sorry to bother you with this!

dev7355608 commented 1 month ago

No problem!

dineshm72 commented 1 month ago

As an FYI, MrP reports it is a core dnd bug in 3.3 (but not in 4.x, which I can't verify since I'm on 3.3), whenever an AE with an UPGRADE is set with a value less than or equal to the existing value.

https://discord.com/channels/759781688011522069/1293611619225698314/1293889623243882571

Not sure whether it is worth reporting, you may have a better idea if there is still work being done on 3.3 heh