#effect edit

1 messages · Page 1 of 1 (latest)

frozen torrent
#

Banish you!

#

@scarlet musk @winged jasper

#

@scarlet musk duplicating nothing won't help you get something ^^

scarlet musk
#

Got it

frozen torrent
#

I was originally under the impression your array had something to begin with

winged jasper
#
const {tokenUuid, actorId} = args[0];
const tactor = tokenUuid ? await fromUuid(tokenUuid) : game.actors.get(actorId);
const itemName = "Reactive Resistance";
const options = ["Acid", "Cold", "Fire", "Lightning", "Poison"].reduce((acc, e) => {
  const slug = e.slugify();  
  return acc + `<option value="${slug}">${e}</option>`;
}, ``);
new Dialog({
  title: 'Choose a damage type',
  content: `
    <form>
      <div class="form-group">
        <label for="element">Pick type:</label>
        <div class="form-fields">
          <select id="element">${options}</select>
        </div>
      </div>
    </form>`,
  buttons: {
    yes: {
      icon: '<i class="fas fa-poo-storm"></i>',
      label: 'Select',
      callback: async (html) => {
        const element = html[0].querySelector('#element').value;
        const effect = tactor.effects.find(i => i.data.label === itemName);
        const changes = [{
          key: "data.traits.dr.value",
          mode: CONST.ACTIVE_EFFECT_MODES.ADD,
          value: element
        }];
        await effect.update({changes});
      }
    }
  }
}).render(true);
scarlet musk
#

Ah, you added the array at the top.

winged jasper
#

Is the effect called "Reactive Resistance Resistance"? 🤔

scarlet musk
#

I thought that line referred to the resistance type?

frozen torrent
#

He's talking about the label find

#

You look for itemName Resistance

scarlet musk
#

Right

frozen torrent
#

But itsm name itself is Reactive Resistance

#

So the result is

Reactive Resistance Resistance

#

On phone so please forgive the missing quotationmarks on my end

#

Sooooo is the effect's label that or should the second Resistance be cut?

winged jasper
#

Cutting it. You can't stop me.

#

My god, there's no div class="form-fields">

#

heresy

#

Okay, it's done

winged jasper
#

💩

frozen torrent
#

Testing time!