function canCastLight(name) {
      let actor = game.actors.get(data.actorId);
      if (actor === undefined) return false;
      let hasLight = false;

      actor.data.items.forEach((item) => {
        if (item.type === "spell") {
          if (item.name.toLowerCase() === name) hasLight = true;
        }
      });
      return hasLight;
    }
// This also returns true if the game system is not D&D 5e...
This also returns true if the game system is not D&D 5e
This also returns true if the game system is not D&D 5e
function canCastLight(name) {
      let actor = game.actors.get(data.actorId);
      if (actor === undefined) return false;
      let hasLight = false;
      actor.data.items.forEach((item) => {
        if (item.type === "spell") {
          if (item.name.toLowerCase() === name) hasLight = true;
        }
      });
      return hasLight;
    }
function canCastLight ( name ) { let actor = game . actors . get ( data . actorId ) ; if ( actor === undefined ) return false ; let hasLight = false ; actor . data . items . forEach ( ( item ) => { if ( item . type === "spell" ) { if ( item . name . toLowerCase ( ) === name ) hasLight = true ; } } ) ; return hasLight ; }
This also returns true if the game system is not D&D 5e...
This also returns true if the game system is not D&D 5e ...