let ingredients = this.actor.itemTypes.trapping.filter(i => i.system.trappingType.value == "ingredient");

if (ingredients.length == 0)
{
  return this.script.notification("Aucun ingrédient !");
}
this.script.notification("Affecté : " + ingredients.map(i => i.name).join(", "));

for(let i of ingredients)
{
  await i.update({
    name: i.setSpecifier("Souillé"),
    effects: [{
      name: "Souillé",
      img: i.img,
      system: {
        transferData :{
          documentType: "Item"
        },
        scriptData: [
          {
            label: "Influence Maléfique",
            script: "args.fields.malignantInfluence = true;",
            trigger: "dialog",
            options: {
              activateScript: "return true;"
            }
          }
        ]
      }
    }]         
  });
}