fix export Corps à Corps

This commit is contained in:
Vincent Vandemeulebrouck 2024-11-26 23:23:34 +01:00
parent e71088fe2f
commit 62dfa8a580
6 changed files with 11 additions and 15 deletions

View File

@ -80,7 +80,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
const actor = this.actor; const actor = this.actor;
formData.combat = foundry.utils.duplicate(formData.armes); formData.combat = foundry.utils.duplicate(formData.armes);
RdDItemArme.computeNiveauArmes(formData.combat, formData.competences); 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.combat.push(RdDItemArme.empoignade(actor));
formData.esquives = this.actor.getCompetences("Esquive"); formData.esquives = this.actor.getCompetences("Esquive");

View File

@ -137,8 +137,8 @@ export class RdDActor extends RdDBaseActorSang {
const actions = RdDCombatManager.listActionsArmes( const actions = RdDCombatManager.listActionsArmes(
this.itemTypes[ITEM_TYPES.arme] this.itemTypes[ITEM_TYPES.arme]
.filter(it => RdDItemArme.isAttaque(it)) .filter(it => RdDItemArme.isAttaque(it))
.concat(RdDItemArme.corpsACorps(this))
.concat(RdDItemArme.empoignade(this)) .concat(RdDItemArme.empoignade(this))
.concat(RdDItemArme.mainsNues(this))
, ,
this.itemTypes[ITEM_TYPES.competence], this.itemTypes[ITEM_TYPES.competence],
this.system.carac) this.system.carac)

View File

@ -140,7 +140,8 @@ export class Mapping {
static prepareArmes(actor) { static prepareArmes(actor) {
const armes = actor.items.filter(it => it.type == ITEM_TYPES.arme) 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 => [ return armes.map(arme => [
arme.system.unemain ? Mapping.prepareArme(actor, arme, 'unemain') : undefined, arme.system.unemain ? Mapping.prepareArme(actor, arme, 'unemain') : undefined,
arme.system.deuxmains ? Mapping.prepareArme(actor, arme, 'deuxmains') : undefined, arme.system.deuxmains ? Mapping.prepareArme(actor, arme, 'deuxmains') : undefined,

View File

@ -31,7 +31,7 @@ export class RdDItemArme extends Item {
case ITEM_TYPES.competencecreature: case ITEM_TYPES.competencecreature:
return RdDItemCompetenceCreature.armeCreature(arme); return RdDItemCompetenceCreature.armeCreature(arme);
} }
return RdDItemArme.mainsNues(); return RdDItemArme.corpsACorps();
} }
static getCompetenceArme(arme, maniement) { static getCompetenceArme(arme, maniement) {
@ -235,11 +235,6 @@ export class RdDItemArme extends Item {
return false return false
} }
static ajoutCorpsACorps(armes, actor) {
armes.push(RdDItemArme.mainsNues(actor));
armes.push(RdDItemArme.empoignade(actor));
}
static corpsACorps(actor) { static corpsACorps(actor) {
let competence = actor?.getCompetenceCorpsACorps() ?? { system: { niveau: -6 } }; let competence = actor?.getCompetenceCorpsACorps() ?? { system: { niveau: -6 } };
let melee = actor ? actor.system.carac['melee'].value : 0 let melee = actor ? actor.system.carac['melee'].value : 0
@ -258,6 +253,8 @@ export class RdDItemArme extends Item {
mortalite: 'non-mortel', mortalite: 'non-mortel',
competence: 'Corps à corps', competence: 'Corps à corps',
resistance: 1, resistance: 1,
baseInit: 4,
cac: 'pugilat',
deuxmains: true, deuxmains: true,
categorie_parade: 'sans-armes' categorie_parade: 'sans-armes'
} }
@ -267,8 +264,6 @@ export class RdDItemArme extends Item {
static mainsNues(actor) { static mainsNues(actor) {
const mainsNues = RdDItemArme.corpsACorps(actor) const mainsNues = RdDItemArme.corpsACorps(actor)
mainsNues.name = 'Mains nues' mainsNues.name = 'Mains nues'
mainsNues.system.cac = 'pugilat'
mainsNues.system.baseInit = 4
return mainsNues; return mainsNues;
} }

View File

@ -773,9 +773,9 @@ export class RdDCombat {
} }
else { else {
// sans armes: à mains nues // sans armes: à mains nues
const niveau = competence.system.niveau; rollData.arme = RdDItemArme.corpsACorps(this.attacker)
const init = RdDCombatManager.calculInitiative(niveau, this.attacker.system.carac['melee'].value); rollData.arme.system.niveau = competence.system.niveau
rollData.arme = RdDItemArme.mainsNues({ niveau: niveau, initiative: init }); rollData.arme.system.initiative = RdDCombatManager.calculInitiative(competence.system.niveau, this.attacker.system.carac['melee'].value);
} }
return rollData; return rollData;
} }

View File

@ -121,7 +121,7 @@ export class RdDHotbar {
if (item.isCorpsACorps()) { if (item.isCorpsACorps()) {
switch (categorieArme) { switch (categorieArme) {
case 'pugilat': case 'pugilat':
return actor.rollArme(RdDItemArme.mainsNues(actor), 'competence'); return actor.rollArme(RdDItemArme.corpsACorps(actor), 'competence');
case 'empoignade': case 'empoignade':
return actor.rollArme(RdDItemArme.empoignade(actor), 'competence'); return actor.rollArme(RdDItemArme.empoignade(actor), 'competence');
} }