From 23966c105694a6638ddc3be956dd0c16c8df709a Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Wed, 13 Jan 2021 23:47:12 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20tactique=20cr=C3=A9atures?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit les créatures peuvent charger (aligate!) --- module/actor.js | 3 ++- module/item-competence.js | 8 -------- module/item-competencecreature.js | 14 ++++++++++++++ module/rdd-combat.js | 7 ++++--- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/module/actor.js b/module/actor.js index 9bedb279..df3afb1d 100644 --- a/module/actor.js +++ b/module/actor.js @@ -19,6 +19,7 @@ import { RdDItemCompetence } from "./item-competence.js"; import { RdDItemArme } from "./item-arme.js"; import { RdDAlchimie } from "./rdd-alchimie.js"; import { StatusEffects } from "./status-effects.js"; +import { RdDItemCompetenceCreature } from "./item-competencecreature.js"; /* -------------------------------------------- */ @@ -1746,7 +1747,7 @@ export class RdDActor extends Actor { if (rollData.competence.type == 'competencecreature') { // Fake competence pour créature - RdDItemCompetence.setRollDataCreature(rollData); + RdDItemCompetenceCreature.setRollDataCreature(rollData); } else { rollData.carac = this.data.data.carac; diff --git a/module/item-competence.js b/module/item-competence.js index 5d8be8a4..4c08b548 100644 --- a/module/item-competence.js +++ b/module/item-competence.js @@ -31,14 +31,6 @@ export class RdDItemCompetence extends Item { return competence?.name.toLowerCase().match(/(natation|acrobatie)/); } - /* -------------------------------------------- */ - static setRollDataCreature(rollData) { - rollData.carac = { "carac_creature": { label: rollData.competence.name, value: rollData.competence.data.carac_value } }; - rollData.competence = duplicate(rollData.competence); - rollData.competence.data.defaut_carac = "carac_creature"; - rollData.competence.data.categorie = "creature"; - rollData.selectedCarac = rollData.carac.carac_creature - } /* -------------------------------------------- */ static isTronc(compName) { for (let troncList of competenceTroncs) { diff --git a/module/item-competencecreature.js b/module/item-competencecreature.js index 0f2782b4..73c58ef1 100644 --- a/module/item-competencecreature.js +++ b/module/item-competencecreature.js @@ -1,6 +1,20 @@ /* -------------------------------------------- */ export class RdDItemCompetenceCreature extends Item { + + /* -------------------------------------------- */ + static setRollDataCreature(rollData) { + rollData.carac = { "carac_creature": { label: rollData.competence.name, value: rollData.competence.data.carac_value } }; + rollData.competence = duplicate(rollData.competence); + rollData.competence.data.defaut_carac = "carac_creature"; + rollData.competence.data.categorie = "creature"; + rollData.selectedCarac = rollData.carac.carac_creature; + if (rollData.competence.data.iscombat) { + rollData.arme = RdDItemCompetenceCreature.toArme(rollData.competence) + } + + } + /* -------------------------------------------- */ static toArme(item) { if (item.type == 'competencecreature' && item.data.iscombat) { diff --git a/module/rdd-combat.js b/module/rdd-combat.js index 87dffda8..2daadbbb 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -1,6 +1,7 @@ import { ChatUtility } from "./chat-utility.js"; import { RdDItemArme } from "./item-arme.js"; import { RdDItemCompetence } from "./item-competence.js"; +import { RdDItemCompetenceCreature } from "./item-competencecreature.js"; import { Misc } from "./misc.js"; import { RdDBonus } from "./rdd-bonus.js"; import { RdDResolutionTable } from "./rdd-resolution-table.js"; @@ -394,7 +395,7 @@ export class RdDCombat { rollData.diviseurSignificative = this._getDiviseurSignificative(rollData); if (this.attacker.isCreature()) { - RdDItemCompetence.setRollDataCreature(rollData); + RdDItemCompetenceCreature.setRollDataCreature(rollData); } else if (arme) { // Usual competence @@ -578,7 +579,7 @@ export class RdDCombat { rollData.diviseurSignificative = this._getDiviseurSignificative(rollData); if (this.defender.isCreature()) { - RdDItemCompetence.setRollDataCreature(rollData); + RdDItemCompetenceCreature.setRollDataCreature(rollData); } return rollData; } @@ -672,7 +673,7 @@ export class RdDCombat { rollData.diviseurSignificative = this._getDiviseurSignificative(rollData); if (this.defender.isCreature()) { - RdDItemCompetence.setRollDataCreature(rollData); + RdDItemCompetenceCreature.setRollDataCreature(rollData); } return rollData; }