let lore = await ValueDialog.create({text : "Choisissez un Savoir", title:  "Savoir"}, "", {"fire" : "Fire", "death" : "Death", "metal" : "Metal", "shadow" : "Discret"});

let filters = [
    {
        property : "type",
        value : "spell"
    },
    {
        property : "system.lore.value",
        value : "petty"
    }
]

let petty = await ItemDialog.createFromFilters(filters, 6, {title : this.effect.name, text : "Choisissez 6 Sorts Mineurs"})


filters = [
    {
        property : "type",
        value : "spell"
    },
    {
        property : "system.lore.value",
        value : [""]
    }
]

let arcane = await ItemDialog.createFromFilters(filters, 12, {title : this.effect.name, text : "Choisissez 12 Sorts d'Arcane"})

let items = petty.map(i => i.toObject()).concat(arcane.map(i => {
    let spell = i.toObject();
    spell.img = `modules/wfrp4e-core/icons/spells/${lore}.png`
    spell.system.lore.value = lore;
    return spell;
}));


this.actor.createEmbeddedDocuments("Item", items);