From 7cae820a403bb64decab057e6729450789967cd2 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Sat, 14 May 2022 20:25:47 +0200 Subject: [PATCH] Various fixes --- module/rdd-possession.js | 23 ++++++++++------------- system.json | 2 +- templates/chat-resultat-possession.html | 7 +++++++ 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/module/rdd-possession.js b/module/rdd-possession.js index d47b160e..28b41e84 100644 --- a/module/rdd-possession.js +++ b/module/rdd-possession.js @@ -1,7 +1,4 @@ /* -------------------------------------------- */ -import { Misc } from "./misc.js"; -import { RdDDice } from "./rdd-dice.js"; -import { RdDUtility } from "./rdd-utility.js"; import { RdDCombat } from "./rdd-combat.js"; import { RdDResolutionTable } from "./rdd-resolution-table.js"; import { RdDRoll } from "./rdd-roll.js"; @@ -31,21 +28,23 @@ export class RdDPossession { /* -------------------------------------------- */ static updateEtatPossession( possession ) { - possession.ptsConjuration = 0; - possession.ptsPossession = 0; + possession.ptsConjuration = 0 + possession.ptsPossession = 0 + console.log("Possession", possession) if ( possession.data.compteur > 0) { possession.ptsPossession = possession.data.compteur } if ( possession.data.compteur < 0) { possession.ptsConjuration = Math.abs(possession.data.compteur) } + possession.isPosseder = false + possession.isConjurer = false if (possession.ptsPossession >= 2 ) { - // Possede + possession.isPosseder = true } if (possession.ptsConjuration <= -2 ) { - // Libere + possession.isConjurer = true } - console.log("Poss", possession); } /* -------------------------------------------- */ @@ -59,7 +58,7 @@ export class RdDPossession { } let actor = game.actors.get(rollData.possession.data.possedeid) let update = { _id: rollData.possession._id, "data.compteur": rollData.possession.data.compteur } - await this.updateEmbeddedDocuments('Item', [update]) + await actor.updateEmbeddedDocuments('Item', [update]) } this.updateEtatPossession(rollData.possession) @@ -89,7 +88,7 @@ export class RdDPossession { if ( defender.type == "personnage") { rollData.competence = duplicate(defender.getDraconicOrZero()) rollData.competence.data.defaut_carac = 'reve-actuel' - rollData.forceCarac = { 'reve-actuel': { label: "Rêve Actuel", value: actor.getReveActuel() } } + rollData.forceCarac = { 'reve-actuel': { label: "Rêve Actuel", value: defender.getReveActuel() } } rollData.selectedCarac = defender.data.data.carac.reve rollData.isECNIDefender = false } else { @@ -102,7 +101,6 @@ export class RdDPossession { } rollData.mode = "conjuration" rollData.possesseur = attacker.name - console.log("onDefensePossession", rollData) const dialog = await RdDRoll.create(defender, rollData, { @@ -143,7 +141,7 @@ export class RdDPossession { if ( !possession) { possession = this.searchPossessionFromEntite( attacker, defender) if ( !possession) { - possession = this.createPossession(attacker, defender) + possession = await this.createPossession(attacker, defender) } } possession = duplicate(possession) @@ -161,7 +159,6 @@ export class RdDPossession { if ( attacker.isCreature()) { RdDItemCompetenceCreature.setRollDataCreature(rollData) } - console.log("Creation de possession2", attacker, rollData) const dialog = await RdDRoll.create( attacker, rollData, { diff --git a/system.json b/system.json index 75593302..6543f759 100644 --- a/system.json +++ b/system.json @@ -29,7 +29,7 @@ "url": "https://gitlab.com/LeRatierBretonnien/foundryvtt-reve-de-dragon/", "license": "LICENSE.txt", "flags": {}, - "version": "1.5.71", + "version": "1.5.72", "minimumCoreVersion": "0.8.0", "compatibleCoreVersion": "9", "scripts": [], diff --git a/templates/chat-resultat-possession.html b/templates/chat-resultat-possession.html index 9b0c6d7c..93c80e92 100644 --- a/templates/chat-resultat-possession.html +++ b/templates/chat-resultat-possession.html @@ -30,4 +30,11 @@ {{/if}}
Points de Possession: {{possession.ptsPossession}}
Points de Conjuration: {{possession.ptsConjuration}} + + {{#is isPosseder}} +
Vous êtes été possédé par {{possesseur}} ! + {{/if}} + {{#is isConjurer}} +
Vous avez conjuré {{possesseur}} ! + {{/if}}