From 56f14e12a23427a537edeb2b7e1faab775d32a0e Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 3 Aug 2023 00:33:56 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20regression=20sur=20les=20particuli=C3=A8?= =?UTF-8?q?res?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit L'utilisation de la méthode clone() pôur cloner la compétence supprime l'id de la compétence, du coup l'update pour y ajouter de l'expérience ne marchait plus et bloquait la suite de la résolution (pas de messages dans le tchat, ...) --- module/actor.js | 8 ++++---- module/rdd-combat.js | 6 +++--- module/rdd-empoignade.js | 6 +++--- module/rdd-possession.js | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/module/actor.js b/module/actor.js index ef356895..f7a62b52 100644 --- a/module/actor.js +++ b/module/actor.js @@ -265,7 +265,7 @@ export class RdDActor extends RdDBaseActor { } /* -------------------------------------------- */ getDraconicList() { - return this.items.filter(it => it.isCompetencePersonnage() && it.system.categorie == 'draconic') + return this.itemTypes[TYPES.competence].filter(it => it.system.categorie == 'draconic') } /* -------------------------------------------- */ getBestDraconic() { @@ -275,13 +275,13 @@ export class RdDActor extends RdDBaseActor { } getDraconicOuPossession() { - const possession = this.items.filter(it => it.type == TYPES.competencecreature && it.system.categorie == 'possession') + const possession = this.itemTypes[TYPES.competencecreature].filter(it => it.system.categorie == 'possession') .sort(Misc.descending(it => it.system.niveau)) .find(it => true); if (possession) { - return possession.clone(); + return possession; } - const draconics = [...this.getDraconicList().filter(it => it.system.niveau >= 0).map(it => it.clone()), + const draconics = [...this.getDraconicList().filter(it => it.system.niveau >= 0), POSSESSION_SANS_DRACONIC] .sort(Misc.descending(it => it.system.niveau)); return draconics[0]; diff --git a/module/rdd-combat.js b/module/rdd-combat.js index 84826d67..ba99000f 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -789,7 +789,7 @@ export class RdDCombat { let rollData = { passeArme: randomID(16), mortalite: arme?.system.mortalite, - competence: competence.clone(), + competence: competence, surprise: this.attacker.getSurprise(true), surpriseDefenseur: this.defender.getSurprise(true), targetToken: Targets.extractTokenData(this.target), @@ -1044,7 +1044,7 @@ export class RdDCombat { passeArme: attackerRoll.passeArme, diffLibre: attackerRoll.diffLibre, attackerRoll: attackerRoll, - competence: this.defender.getCompetence(competenceParade).clone(), + competence: this.defender.getCompetence(competenceParade), arme: armeParade, surprise: this.defender.getSurprise(true), needParadeSignificative: ReglesOptionnelles.isUsing('categorieParade') && RdDItemArme.needParadeSignificative(attackerRoll.arme, armeParade), @@ -1125,7 +1125,7 @@ export class RdDCombat { passeArme: attackerRoll.passeArme, diffLibre: attackerRoll.diffLibre, attackerRoll: attackerRoll, - competence: competence.clone(), + competence: competence, surprise: this.defender.getSurprise(true), surpriseDefenseur: this.defender.getSurprise(true), carac: this.defender.system.carac, diff --git a/module/rdd-empoignade.js b/module/rdd-empoignade.js index 2654b977..0694dc79 100644 --- a/module/rdd-empoignade.js +++ b/module/rdd-empoignade.js @@ -181,7 +181,7 @@ export class RdDEmpoignade { let rollData = { mode, empoignade, attacker, defender, isEmpoignade: true, - competence: attacker.getCompetence("Corps à corps").clone(), + competence: attacker.getCompetence("Corps à corps"), selectedCarac: attacker.system.carac.melee, malusTaille: RdDEmpoignade.getMalusTaille(empoignade, attacker, defender) } @@ -210,7 +210,7 @@ export class RdDEmpoignade { mode: "immobilise", empoignade, attacker, defender, isEmpoignade: true, - competence: attacker.getCompetence("Corps à corps").clone() + competence: attacker.getCompetence("Corps à corps") } const msg = await ChatMessage.create({ whisper: ChatUtility.getWhisperRecipientsAndGMs(attacker.name), @@ -272,7 +272,7 @@ export class RdDEmpoignade { mode, attacker, defender, empoignade, attackerRoll, diffLibre: attackerRoll.diffLibre, attaqueParticuliere: attackerRoll.particuliere, - competence: defender.getCompetence(competenceName).clone(), + competence: defender.getCompetence(competenceName), surprise: defender.getSurprise(true), carac: defender.system.carac, selectedCarac: defender.system.carac[carac], diff --git a/module/rdd-possession.js b/module/rdd-possession.js index 06bee19c..c0278522 100644 --- a/module/rdd-possession.js +++ b/module/rdd-possession.js @@ -39,7 +39,7 @@ export class RdDPossession { let rollData = { mode: "attaque", isECNIDefender: false, - competence: competence.clone(), + competence: competence, possession: possession, attacker: attacker, defender: defender,