Masquer attributs magiques si non-magique

This commit is contained in:
Vincent Vandemeulebrouck
2021-05-06 21:36:40 +02:00
parent b531e97fd1
commit 474a6a7ed8
8 changed files with 18 additions and 16 deletions

View File

@ -349,7 +349,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
async verifierPotionsEnchantees() {
let potionsEnchantees = this.filterItemsData(it => it.type == 'potion' && it.data.isEnchante);
let potionsEnchantees = this.filterItemsData(it => it.type == 'potion' && it.data.magique);
for (let potion of potionsEnchantees) {
if (!potion.prpermanent) {
console.log(potion);
@ -3444,7 +3444,7 @@ export class RdDActor extends Actor {
potionData.alias = this.name;
potionData.supprimer = true;
if (potionData.data.isEnchante) {
if (potionData.data.magique) {
ChatMessage.create({
whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-soin.html`, potionData)
@ -3476,7 +3476,7 @@ export class RdDActor extends Actor {
potionData.alias = this.name;
potionData.supprimer = true;
if (potionData.data.isEnchante) {
if (potionData.data.magique) {
ChatMessage.create({
whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-repos.html`, potionData)

View File

@ -64,8 +64,7 @@ export class RdDItemSheet extends ItemSheet {
owner: this.document.isOwner,
editable: this.isEditable,
cssClass: this.isEditable ? "editable" : "locked",
isSoins: false,
isEnchante: false
isSoins: false
}
if ( this.actor ) {
formData.isOwned = true;

View File

@ -43,6 +43,9 @@ export class RdDItem extends Item {
return itemData.type == 'objet' && Grammar.toLowerCaseNoAccent(itemData.name) == 'cristal alchimique' && itemData.data.quantite > 0;
}
isMagique(){
return Misc.templateData(this.object).magique;
}
getEnc() {
const itemData = Misc.data(this);
@ -68,8 +71,8 @@ export class RdDItem extends Item {
prepareDataPotion() {
const tplData = Misc.templateData(this);
const categorie = Grammar.toLowerCaseNoAccent(tplData.categorie);
tplData.isEnchante = categorie.includes('enchante');
if (tplData.isEnchante) {
tplData.magique = categorie.includes('enchante');
if (tplData.magique) {
if (categorie.includes('soin') || categorie.includes('repos')) {
tplData.puissance = tplData.herbebonus * tplData.pr;
}