Various fixes

This commit is contained in:
2022-04-30 23:42:55 +02:00
parent f64928858c
commit 5214b036d3
11 changed files with 96 additions and 98 deletions

View File

@ -56,48 +56,45 @@ export class RdDItem extends Item {
}
isCompetence() {
return Misc.data(this).type == 'competence';
return this.type == 'competence';
}
isConteneur() {
return Misc.data(this).type == 'conteneur';
return this.type == 'conteneur';
}
isConteneurNonVide() {
return this.isConteneur() && (Misc.templateData(this).contenu?.length ?? 0) > 0;
return this.isConteneur() && (this.system.contenu?.length ?? 0) > 0;
}
isConteneurVide() {
return this.isConteneur() && (Misc.templateData(this).contenu?.length ?? 0) == 0;
return this.isConteneur() && (this.system.contenu?.length ?? 0) == 0;
}
isVideOuNonConteneur() {
return !this.isConteneur() || (Misc.templateData(this).contenu?.length ?? 0) == 0;
return !this.isConteneur() || (this.system.contenu?.length ?? 0) == 0;
}
isAlcool() {
const itemData = Misc.data(this);
return itemData.type == 'nourritureboisson' && itemData.data.boisson && itemData.data.alcoolise;
return this.type == 'nourritureboisson' && this.system.boisson && this.system.alcoolise;
}
isHerbeAPotion() {
const itemData = Misc.data(this);
return itemData.type == 'herbe' && (itemData.data.categorie == 'Soin' || itemData.data.categorie == 'Repos');
return this.type == 'herbe' && (this.system.categorie == 'Soin' || this.system.categorie == 'Repos');
}
isPotion() {
return Misc.data(this).type == 'potion';
return this.type == 'potion';
}
isEquipement() {
return RdDItem.getTypeObjetsEquipement().includes(Misc.data(this).type);
return RdDItem.getTypeObjetsEquipement().includes(this.type)
}
isCristalAlchimique() {
const itemData = Misc.data(this);
return itemData.type == 'objet' && Grammar.toLowerCaseNoAccent(itemData.name) == 'cristal alchimique' && itemData.data.quantite > 0;
return this.type == 'objet' && Grammar.toLowerCaseNoAccent(this.name) == 'cristal alchimique' && this.system.quantite > 0;
}
isMagique() {
return Misc.templateData(this).magique;
return this.system.magique;
}
getEncTotal() {
@ -121,8 +118,7 @@ export class RdDItem extends Item {
if (this.isPotion()) {
this.prepareDataPotion()
}
const itemData = Misc.data(this);
itemData.data.actionPrincipale = this.getActionPrincipale({ warnIfNot: false });
this.system.actionPrincipale = this.getActionPrincipale({ warnIfNot: false });
}
}