Gestion des signes draconiques #455
@ -691,7 +691,7 @@ export class RdDActor extends Actor {
|
||||
else
|
||||
update['data.carac_value'] = compValue;
|
||||
//console.log(update);
|
||||
const updated = await this.updateEmbeddedEntity("OwnedItem", update); // Updates one EmbeddedEntity
|
||||
const updated = await this.updateEmbeddedEntity("Item", update); // Updates one EmbeddedEntity
|
||||
}
|
||||
}
|
||||
|
||||
@ -712,7 +712,7 @@ export class RdDActor extends Actor {
|
||||
});
|
||||
}
|
||||
const update = { _id: comp._id, 'data.niveau': nouveauNiveau };
|
||||
await this.updateEmbeddedEntity("OwnedItem", update); // Updates one EmbeddedEntity
|
||||
await this.updateEmbeddedEntity("Item", update); // Updates one EmbeddedEntity
|
||||
} else {
|
||||
console.log("Competence not found", compName);
|
||||
}
|
||||
@ -948,7 +948,8 @@ export class RdDActor extends Actor {
|
||||
async computeEncombrementTotalEtMalusArmure() {
|
||||
let encTotal = 0;
|
||||
let newMalusArmure = 0;
|
||||
for (const itemData of this.data.items.filter(it => Misc.templateData(it).encombrement != undefined)) {
|
||||
for (const item of this.data.items.filter(it => Misc.templateData(it).encombrement != undefined)) {
|
||||
let itemData = item.data; // v0.8 normalization
|
||||
if (itemData.type == 'armure' && itemData.data.equipe) { // Armure équipée, intégration du malus armure total
|
||||
newMalusArmure += itemData.data.malus;
|
||||
}
|
||||
@ -971,7 +972,7 @@ export class RdDActor extends Actor {
|
||||
if (newMalusArmure && Misc.templateData(this).attributs?.malusarmure?.value != newMalusArmure) {
|
||||
await this.updateAttributeValue("malusarmure", newMalusArmure);
|
||||
}
|
||||
return this.encTotal;
|
||||
return encTotal;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -979,7 +980,8 @@ export class RdDActor extends Actor {
|
||||
let prixTotalEquipement = 0;
|
||||
|
||||
// prix total de l'équipement est la somme du cout de chaque équipement multiplié par sa quantité.
|
||||
for (const itemData of this.data.items) {
|
||||
for (const item of this.data.items) {
|
||||
let itemData = item.data; // v0.8 normalization
|
||||
if (itemData.data && itemData.data.cout != undefined) {
|
||||
if (!Number(itemData.data.cout)) itemData.data.cout = 0; // Auto-fix
|
||||
if (itemData.data.quantite == undefined) itemData.data.quantite = 1; // Auto-fix
|
||||
@ -2904,16 +2906,16 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async monnaieIncDec(id, value) {
|
||||
let monnaie = this.data.items.find(item => item.type == 'monnaie' && item._id == id);
|
||||
let monnaie = this.data.items.find(item => item.type == 'monnaie' && item.id == id);
|
||||
if (monnaie) {
|
||||
const quantite = Math.max(0, monnaie.data.quantite + value);
|
||||
await this.updateEmbeddedEntity("OwnedItem", { _id: monnaie._id, 'data.quantite': quantite });
|
||||
const quantite = Math.max(0, monnaie.data.data.quantite + value);
|
||||
await this.updateEmbeddedEntity("OwnedItem", { _id: monnaie.id, 'data.quantite': quantite });
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async effectuerTacheAlchimie(recetteId, alchimieName, alchimieData) {
|
||||
let recette = this.data.items.find(item => item.type == 'recettealchimique' && item._id == recetteId);
|
||||
let recette = this.data.items.find(item => item.type == 'recettealchimique' && item.id == recetteId);
|
||||
const actorData = Misc.data(this);
|
||||
if (recette) {
|
||||
let competence = this.data.items.find(item => item.type == 'competence' && item.name.toLowerCase() == "alchimie");
|
||||
@ -3109,7 +3111,7 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_deleteStatusEffectsByIds(effectIds, options) {
|
||||
this.deleteEmbeddedDocument('ActiveEffect', effectIds, options);
|
||||
this.deleteEmbeddedDocuments('ActiveEffect', [effectIds], options);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -112,7 +112,7 @@ export class RdDCalendrier extends Application {
|
||||
/* -------------------------------------------- */
|
||||
ajouterNombreAstral(index) {
|
||||
return {
|
||||
nombreAstral: new Roll("1d12").roll().total,
|
||||
nombreAstral: new Roll("1d12").evaluate( {async:false} ).total,
|
||||
valeursFausses: [],
|
||||
index: index
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user