Various fixes

This commit is contained in:
sladecraven 2022-05-14 20:25:47 +02:00
parent fd32c21297
commit 7cae820a40
3 changed files with 18 additions and 14 deletions

View File

@ -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,
{

View File

@ -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": [],

View File

@ -30,4 +30,11 @@
{{/if}}
<br>Points de Possession: {{possession.ptsPossession}}
<br>Points de Conjuration: {{possession.ptsConjuration}}
{{#is isPosseder}}
<br><strong>Vous êtes été possédé par {{possesseur}} !</strong>
{{/if}}
{{#is isConjurer}}
<br><strong>Vous avez conjuré {{possesseur}} !</strong>
{{/if}}
</div>