PNJ: ajout mains nues et empoignade

This commit is contained in:
Vincent Vandemeulebrouck 2024-10-27 00:02:03 +02:00
parent 1760d26014
commit 2de9ea49c8

View File

@ -140,16 +140,15 @@ export class Mapping {
static prepareArmes(actor) {
const armes = actor.items.filter(it => it.type == ITEM_TYPES.arme)
return armes.map(arme =>
[
RdDItemArme.ajoutCorpsACorps(armes, actor)
return armes.map(arme => [
arme.system.unemain ? Mapping.prepareArme(actor, arme, 'unemain') : undefined,
arme.system.deuxmains ? Mapping.prepareArme(actor, arme, 'deuxmains') : undefined,
!(arme.system.unemain || arme.system.deuxmains) ? Mapping.prepareArme(actor, arme, 'competence') : undefined,
arme.system.lancer != "" ? Mapping.prepareArme(actor, arme, 'lancer') : undefined,
arme.system.tir != "" ? Mapping.prepareArme(actor, arme, 'tir') : undefined
]
.filter(it => it != undefined)
).reduce((a, b) => a.concat(b), [])
arme.system.tir != "" ? Mapping.prepareArme(actor, arme, 'tir') : undefined]
.filter(it => it != undefined))
.reduce((a, b) => a.concat(b), [])
}
static prepareArme(actor, arme, maniement) {
@ -158,18 +157,26 @@ export class Mapping {
if (RdDItemCompetence.isNiveauBase(competence)) {
return undefined
}
const dmgArme = RdDItemArme.dommagesReels(arme, maniement)
const dommages = dmgArme + RdDBonus.bonusDmg(actor, maniement, dmgArme)
const categorie = Mapping.complementCategorie(arme, maniement)
const dommages = Mapping.dommagesArme(actor, arme, maniement)
return {
name: arme.name + categorie,
niveau: Misc.toSignedString(competence.system.niveau),
init: Mapping.calculBaseInit(actor, competence.system.categorie) + competence.system.niveau,
dommages: Misc.toSignedString(dommages),
dommages: dommages,
competence: competence,
arme: arme
}
}
static dommagesArme(actor, arme, maniement){
const dmgArme = RdDItemArme.dommagesReels(arme, maniement)
const dommages = Misc.toSignedString(dmgArme + RdDBonus.bonusDmg(actor, maniement, dmgArme))
switch(arme.system.mortalite) {
case 'non-mortel': return `(${dommages})`
case 'empoignade': return '-'
}
return dommages
}
static complementCategorie(arme, maniement) {
switch (maniement) {