From 62dfa8a580c0ebc51244ad6eadc1b9d6379dfabd Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Tue, 26 Nov 2024 23:23:34 +0100 Subject: [PATCH] =?UTF-8?q?fix=20export=20Corps=20=C3=A0=20Corps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/actor-sheet.js | 2 +- module/actor.js | 2 +- module/actor/export-scriptarium/mapping.js | 3 ++- module/item-arme.js | 11 +++-------- module/rdd-combat.js | 6 +++--- module/rdd-hotbar-drop.js | 2 +- 6 files changed, 11 insertions(+), 15 deletions(-) diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 1b2f7abf..b41baf20 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -80,7 +80,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet { const actor = this.actor; formData.combat = foundry.utils.duplicate(formData.armes); RdDItemArme.computeNiveauArmes(formData.combat, formData.competences); - formData.combat.push(RdDItemArme.mainsNues(actor)); + formData.combat.push(RdDItemArme.corpsACorps(actor)); formData.combat.push(RdDItemArme.empoignade(actor)); formData.esquives = this.actor.getCompetences("Esquive"); diff --git a/module/actor.js b/module/actor.js index d0c962cf..081103ee 100644 --- a/module/actor.js +++ b/module/actor.js @@ -137,8 +137,8 @@ export class RdDActor extends RdDBaseActorSang { const actions = RdDCombatManager.listActionsArmes( this.itemTypes[ITEM_TYPES.arme] .filter(it => RdDItemArme.isAttaque(it)) + .concat(RdDItemArme.corpsACorps(this)) .concat(RdDItemArme.empoignade(this)) - .concat(RdDItemArme.mainsNues(this)) , this.itemTypes[ITEM_TYPES.competence], this.system.carac) diff --git a/module/actor/export-scriptarium/mapping.js b/module/actor/export-scriptarium/mapping.js index cae270b9..2f94c522 100644 --- a/module/actor/export-scriptarium/mapping.js +++ b/module/actor/export-scriptarium/mapping.js @@ -140,7 +140,8 @@ export class Mapping { static prepareArmes(actor) { const armes = actor.items.filter(it => it.type == ITEM_TYPES.arme) - RdDItemArme.ajoutCorpsACorps(armes, actor) + armes.push(RdDItemArme.corpsACorps(actor)); + armes.push(RdDItemArme.empoignade(actor)); return armes.map(arme => [ arme.system.unemain ? Mapping.prepareArme(actor, arme, 'unemain') : undefined, arme.system.deuxmains ? Mapping.prepareArme(actor, arme, 'deuxmains') : undefined, diff --git a/module/item-arme.js b/module/item-arme.js index 1d860dd4..d4b664e7 100644 --- a/module/item-arme.js +++ b/module/item-arme.js @@ -31,7 +31,7 @@ export class RdDItemArme extends Item { case ITEM_TYPES.competencecreature: return RdDItemCompetenceCreature.armeCreature(arme); } - return RdDItemArme.mainsNues(); + return RdDItemArme.corpsACorps(); } static getCompetenceArme(arme, maniement) { @@ -235,11 +235,6 @@ export class RdDItemArme extends Item { return false } - static ajoutCorpsACorps(armes, actor) { - armes.push(RdDItemArme.mainsNues(actor)); - armes.push(RdDItemArme.empoignade(actor)); - } - static corpsACorps(actor) { let competence = actor?.getCompetenceCorpsACorps() ?? { system: { niveau: -6 } }; let melee = actor ? actor.system.carac['melee'].value : 0 @@ -258,6 +253,8 @@ export class RdDItemArme extends Item { mortalite: 'non-mortel', competence: 'Corps à corps', resistance: 1, + baseInit: 4, + cac: 'pugilat', deuxmains: true, categorie_parade: 'sans-armes' } @@ -267,8 +264,6 @@ export class RdDItemArme extends Item { static mainsNues(actor) { const mainsNues = RdDItemArme.corpsACorps(actor) mainsNues.name = 'Mains nues' - mainsNues.system.cac = 'pugilat' - mainsNues.system.baseInit = 4 return mainsNues; } diff --git a/module/rdd-combat.js b/module/rdd-combat.js index fb0a7c09..9521828b 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -773,9 +773,9 @@ export class RdDCombat { } else { // sans armes: à mains nues - const niveau = competence.system.niveau; - const init = RdDCombatManager.calculInitiative(niveau, this.attacker.system.carac['melee'].value); - rollData.arme = RdDItemArme.mainsNues({ niveau: niveau, initiative: init }); + rollData.arme = RdDItemArme.corpsACorps(this.attacker) + rollData.arme.system.niveau = competence.system.niveau + rollData.arme.system.initiative = RdDCombatManager.calculInitiative(competence.system.niveau, this.attacker.system.carac['melee'].value); } return rollData; } diff --git a/module/rdd-hotbar-drop.js b/module/rdd-hotbar-drop.js index 979c2a08..76610d53 100644 --- a/module/rdd-hotbar-drop.js +++ b/module/rdd-hotbar-drop.js @@ -121,7 +121,7 @@ export class RdDHotbar { if (item.isCorpsACorps()) { switch (categorieArme) { case 'pugilat': - return actor.rollArme(RdDItemArme.mainsNues(actor), 'competence'); + return actor.rollArme(RdDItemArme.corpsACorps(actor), 'competence'); case 'empoignade': return actor.rollArme(RdDItemArme.empoignade(actor), 'competence'); }