Préparation roll-dialog attaques

Les attaques ne sont plus des armes modifiées
This commit is contained in:
2025-09-18 01:56:42 +02:00
parent 74c1f33427
commit 652c435833
17 changed files with 239 additions and 201 deletions

View File

@@ -80,6 +80,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
getBonusDegat() { return RdDCarac.getCaracDerivee(this.getEncombrementMax()).plusdom }
getMoralTotal() { return 0 }
listeAmoureux() {return []}
getProtectionNaturelle() { return Number(this.system.attributs?.protection?.value ?? 0) }
getSConst() { return 0 }
@@ -109,10 +110,11 @@ export class RdDBaseActorReve extends RdDBaseActor {
}
return this.system.carac[competence.system.defaut_carac].value;
}
listActionsCombat() {
listActions({ isAttaque = false, isEquipe = false }) {
return this.itemTypes[ITEM_TYPES.competencecreature]
.filter(it => RdDItemCompetenceCreature.isAttaque(it))
.map(it => RdDItemCompetenceCreature.armeCreature(it))
.map(it => RdDItemCompetenceCreature.attaqueCreature(it))
.filter(it => it != undefined);
}
@@ -165,7 +167,9 @@ export class RdDBaseActorReve extends RdDBaseActor {
if (idOrName instanceof Item) {
return idOrName.isCompetence() ? idOrName : undefined
}
return RdDItemCompetence.findCompetence(this.items, idOrName, options)
return RdDItemCompetence.findCompetence(
this.items.filter(it => [ITEM_TYPES.competence, ITEM_TYPES.competencecreature].includes(it.type)),
idOrName, options)
}
getCompetences(name, options = { onMessage: message => { } }) {
@@ -434,9 +438,9 @@ export class RdDBaseActorReve extends RdDBaseActor {
* @param {*} categorieArme catégorie d'attaque à utiliser: competence (== melee), lancer, tir; naturelle, possession
* @returns
*/
rollArme(arme, categorieArme, token) {
rollArme(arme, categorieArme = 'competence', token = undefined) {
token = token ?? RdDUtility.getSelectedToken(this)
const compToUse = this.$getCompetenceArme(arme, categorieArme)
const compToUse = RdDItemArme.getCompetenceArme(arme, categorieArme)
if (!RdDItemArme.isUtilisable(arme)) {
ui.notifications.warn(`Arme inutilisable: ${arme.name} a une résistance de 0 ou moins`)
return
@@ -470,10 +474,6 @@ export class RdDBaseActorReve extends RdDBaseActor {
})
}
$getCompetenceArme(arme, competenceName) {
return RdDItemArme.getCompetenceArme(arme, competenceName)
}
verifierForceMin(item) { }
/* -------------------------------------------- */

View File

@@ -755,18 +755,21 @@ export class RdDBaseActor extends Actor {
isActorCombat() { return false }
getCaracInit(competence) { return 0 }
listActionsCombat() { return [] }
listAttaques() {
return this.listActions({ isAttaque: true, isEquipe:false })
}
listActions({ isAttaque = false, isEquipe=false }) { return [] }
listActionsPossessions() {
return this.itemTypes[ITEM_TYPES.possession]
.map(p => {
return {
name: p.name,
action: 'possession',
system: {
competence: p.name,
possessionid: p.system.possessionid,
}
possessionid: p.system.possessionid,
}
})
}
}

View File

@@ -9,6 +9,7 @@ export class RdDActorExportSheet extends RdDActorSheet {
static init() {
foundry.applications.handlebars.loadTemplates([
"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs",
"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme-titre.hbs",
"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/blessure.hbs",
"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/blessures.hbs",
"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs",
@@ -41,6 +42,7 @@ export class RdDActorExportSheet extends RdDActorSheet {
const formData = await super.getData()
// Add any structured, precomputed list of data
formData.context = Mapping.prepareContext(this.actor)
formData.attaques = this.actor.listActionsAttaque()
formData.export = this.getMappingValues(formData.context, this.actor)
formData.competences = this.getCompetences(CATEGORIES_COMPETENCES)
formData.draconic = this.getCompetences(CATEGORIES_DRACONIC)

View File

@@ -144,7 +144,7 @@ export class Mapping {
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.unemain ? Mapping.prepareArme(actor, arme, '(1 main)') : 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,