Various fixes

This commit is contained in:
sladecraven 2022-05-14 20:39:01 +02:00
parent 6d00efa70e
commit 54d546b941
4 changed files with 11 additions and 9 deletions

View File

@ -3748,7 +3748,7 @@ export class RdDActor extends Actor {
vendeur.ajouterDeniers(coutDeniers); vendeur.ajouterDeniers(coutDeniers);
let resteQuantite = (itemVendu.data.quantite ?? 1) - achat.quantiteTotal; let resteQuantite = (itemVendu.data.quantite ?? 1) - achat.quantiteTotal;
if (resteQuantite == 0) { if (resteQuantite == 0) {
vendeur.deleteEmbeddedDocuments("Item", [itemId]); vendeur.deleteEmbeddedDocuments("Item", [itemId])
} }
else { else {
vendeur.updateEmbeddedDocuments("Item", [{ _id: itemId, 'data.quantite': resteQuantite }]); vendeur.updateEmbeddedDocuments("Item", [{ _id: itemId, 'data.quantite': resteQuantite }]);

View File

@ -42,27 +42,29 @@ export class RdDPossession {
if (possession.ptsPossession >= 2 ) { if (possession.ptsPossession >= 2 ) {
possession.isPosseder = true possession.isPosseder = true
} }
if (possession.ptsConjuration <= -2 ) { if (possession.ptsConjuration >= 2 ) {
possession.isConjurer = true possession.isConjurer = true
} }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async resultConjuration( rollData) { static async resultConjuration( rollData) {
console.log("RollData!!!", rollData) let actor = game.actors.get(rollData.possession.data.possedeid)
if ( !rollData.rolled.isSuccess ) { if ( !rollData.rolled.isSuccess ) {
if( rollData.isECNIDefender) { if( rollData.isECNIDefender) {
rollData.possession.data.compteur-- rollData.possession.data.compteur--
} else { } else {
rollData.possession.data.compteur++ rollData.possession.data.compteur++
} }
let actor = game.actors.get(rollData.possession.data.possedeid)
let update = { _id: rollData.possession._id, "data.compteur": rollData.possession.data.compteur } let update = { _id: rollData.possession._id, "data.compteur": rollData.possession.data.compteur }
await actor.updateEmbeddedDocuments('Item', [update]) await actor.updateEmbeddedDocuments('Item', [update])
} }
this.updateEtatPossession(rollData.possession) this.updateEtatPossession(rollData.possession)
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-possession.html') await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-possession.html')
if ( rollData.possession.isPosseder || rollData.possession.isConjurer) {
actor.deleteEmbeddedDocuments("Item", [rollData.possession._id])
}
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -29,7 +29,7 @@
"url": "https://gitlab.com/LeRatierBretonnien/foundryvtt-reve-de-dragon/", "url": "https://gitlab.com/LeRatierBretonnien/foundryvtt-reve-de-dragon/",
"license": "LICENSE.txt", "license": "LICENSE.txt",
"flags": {}, "flags": {},
"version": "1.5.73", "version": "1.5.74",
"minimumCoreVersion": "0.8.0", "minimumCoreVersion": "0.8.0",
"compatibleCoreVersion": "9", "compatibleCoreVersion": "9",
"scripts": [], "scripts": [],

View File

@ -31,10 +31,10 @@
<br>Points de Possession: {{possession.ptsPossession}} <br>Points de Possession: {{possession.ptsPossession}}
<br>Points de Conjuration: {{possession.ptsConjuration}} <br>Points de Conjuration: {{possession.ptsConjuration}}
{{#if isPosseder}} {{#if possession.isPosseder}}
<br><strong>Vous êtes été possédé par {{possesseur}} !</strong> <br><strong>Vous êtes été possédé par {{possession.data.typepossession}} ! La possession en cours a été supprimée.</strong>
{{/if}} {{/if}}
{{#if isConjurer}} {{#if possession.isConjurer}}
<br><strong>Vous avez conjuré {{possesseur}} !</strong> <br><strong>Vous avez conjuré {{possession.data.typepossession}} ! La possession en cours a été supprimée.</strong>
{{/if}} {{/if}}
</div> </div>