foundryvtt / dnd5e

An implementation of the 5th Edition game system for Foundry Virtual Tabletop (http://foundryvtt.com).
MIT License
303 stars 206 forks source link

Dragging their own item to enchant it with a concentration spell causes an error for non-GMs #3883

Open kaelad02 opened 1 month ago

kaelad02 commented 1 month ago

There seems to be an issue for regular players (i.e. non-GMs) when you enchant your own item from a spell w/ concentration on it. Instead of enchanting the item you get an error message at the top of the screen saying, "Applying an effect that is being concentrated on by another character requires GM permissions."

Steps to Reproduce (as a player)

  1. Add the Magic Weapon spell from the SRD compendium to your character
  2. Cast the Magic Weapon spell
  3. Drag one of your weapons onto the chat message to enchant it
  4. See the error message

I'm pretty sure the error is thrown from the EnchantmentApplicationElement#_onDrop function. I tested this with dnd5e version 3.3.1.

codestripper commented 1 month ago

concentration.actor?.isOwner seems to evaluate as "undefined" as "actor" does not exist on the "concentration" object.

isOwner does exist on concentration.parent however, which also seems to be the actor. Changing it to concentration.parent?.isOwner seems to fix the issue

Unsure if "actor" is just missing or the intended implementation was "parent", but that does appear to fix the issue.