Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Region Triggers not respecting token lists passed in region event #868

Open
gludington opened this issue Dec 29, 2024 · 1 comment

Comments

@gludington
Copy link

Describe the bug
Region triggers do not appear to use the token triggering the behavior

To Reproduce
Steps to reproduce the behavior:

  1. Create tile with a landing for _turn, and, past that, a single behavior applied to current tokens, Hurt/Heal, hurting for 3hp. Allow All Tokens, Controlled By Anybody, Manually Triggered
  2. Create a region that triggers this behavior, subscribing to turn start and passing along data
  3. Place two tokens, A and B, in this region
  4. Start a combat
  5. Rotate through turns

Expected behavior
On start turn, the token whose turn began takes 3hp of damage

Actual Behavior
Controlled tokens take damage

Additional context
This appears to be related to this line:

let tokens = canvas.tokens.controlled.map(t => t.document);

If, in browser dev tools, I set a conditional breakpoint to set tokens = [event.data.tokens] if the event passes a list of tokens, it works; however, not including a PR because I do not know what ripple effects that might cause or if other behaviors rely on this, or if I just have a configuration error in the above, and it does work if I correct it.

@Zephyr2011
Copy link

I was able to replicate this. I also noticed some additional behavior that I think is related.

To Reproduce

  1. Create tile with a landing for _turn, and, past that, a single behavior applied to current tokens, Hurt/Heal, hurting for 3hp. Allow All Tokens, Controlled By Anybody, Manually Triggered
  2. Create a region that triggers this behavior, subscribing to turn start and passing along data
  3. Place two tokens, A and B, in this region
  4. Place a third token, C, outside the region
  5. Start a combat
  6. Rotate through turns

Expected Behavior
Regardless of what token is controlled: on Token A's turn, A takes damage, on Token B's turn, B takes damage, on Token C's turn, nothing takes damage.

Actual Behavior

  • With any controlled token: on any turn start, controlled token takes damage.
  • With no controlled token: on any turn start, all tokens inside of the region (A and B) take damage.

Additional Context
I tested the same region with an additional "scrolling text" behavior on Token Turn Start in the region, and the scrolling text only appears above a token inside of the region when it starts it's turn there (when token A's turn starts, scrolling text appears above A; when token B's turn starts, scrolling text appears above B; when token C's turn starts, no scrolling text appears). So it does not appear to be an issue inherent to regions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants