Jet V2 pour les créatures

This commit is contained in:
2025-10-19 23:45:30 +02:00
parent e5e271e424
commit 8e1c11eaca
20 changed files with 47 additions and 37 deletions

View File

@@ -1,4 +1,9 @@
# 13.0
## 13.0.13 - Le familier d'Illysis
- Nouvelle fenêtre de jets de dés
- Attaque/défense des créatures
## 13.0.13 - L'épanouissement d'Illysis
- Fix d'erreur au chargement de templates RollDialog

View File

@@ -186,12 +186,12 @@ export class RdDActor extends RdDBaseActorSang {
const uniques = []
const addAttaque = (arme, main = undefined, action = 'attaque') => {
const dommagesArme = RdDItemArme.valeurMain(arme.system.dommages, main)
const dommages = RdDItemArme.valeurMain(arme.system.dommages, main)
const forceRequise = RdDItemArme.valeurMain(arme.system.force ?? 0, main)
const ecaillesEfficacite = arme.system.magique ? arme.system.ecaille_efficacite : 0;
const comp = this.getCompetence(RdDActor.$getCompetenceAction(arme, main))
const unique = [comp.id, arme.name, dommagesArme, forceRequise, ecaillesEfficacite].join('|');
const unique = [comp.id, arme.name, dommages, forceRequise, ecaillesEfficacite].join('|');
if (uniques.includes(unique)) {
return
}
@@ -212,7 +212,7 @@ export class RdDActor extends RdDBaseActorSang {
main: main,
carac: { key: caracCode, value: caracValue },
equipe: arme.system.equipe,
dommagesArme: dommagesArme,
dommages: dommages,
forceRequise: forceRequise,
initiative: RdDInitiative.getRollInitiative(caracValue, niveau, ajustement)
})

View File

@@ -176,10 +176,11 @@ export class RdDBaseActorReve extends RdDBaseActor {
}
getCompetences(name = undefined, options = { onMessage: message => { } }) {
const all = [...this.itemTypes[ITEM_TYPES.competence], ...this.itemTypes[ITEM_TYPES.competencecreature]]
if (name == undefined) {
return this.itemTypes[ITEM_TYPES.competence]
return all
}
return RdDItemCompetence.findCompetences(this.itemTypes[ITEM_TYPES.competence], name, options)
return RdDItemCompetence.findCompetences(all, name, options)
}
getCompetenceCorpsACorps(options = { onMessage: message => { } }) {

View File

@@ -56,8 +56,7 @@ export class RdDBaseActorSheet extends foundry.appv1.sheets.ActorSheet {
this._appliquerRechercheObjets(formData.conteneurs, formData.inventaires);
formData.conteneurs = RdDUtility.conteneursRacine(formData.conteneurs);
formData.competences.filter(it => it.type == ITEM_TYPES.competencecreature)
.forEach(it => it.isdommages = it.isDommages()
)
.forEach(it => it.isdommages = it.isDommages())
return formData;
}

View File

@@ -160,7 +160,7 @@ export class Mapping {
return undefined
}
const categorie = Mapping.complementCategorie(arme, maniement)
const dommages = Mapping.dommagesArme(actor, arme, maniement)
const dommages = Mapping.dommages(actor, arme, maniement)
return {
name: arme.name + categorie,
niveau: Misc.toSignedString(competence.system.niveau),
@@ -170,7 +170,8 @@ export class Mapping {
arme: arme
}
}
static dommagesArme(actor, arme, maniement) {
static dommages(actor, arme, maniement) {
const dmgArme = RdDItemArme.dommagesReels(arme, maniement)
const dommages = Misc.toSignedString(dmgArme + RdDBonus.bonusDmg(actor, maniement, dmgArme))
switch (arme.system.mortalite) {

View File

@@ -32,6 +32,7 @@ export class RdDItemCompetenceCreature extends RdDItem {
initiative: initative,
mortalite: this.system.mortalite,
dommages: this.system.dommages,
forceRequise: 0,
equipe: true,
resistance: 100,
penetration: 0,
@@ -43,7 +44,8 @@ export class RdDItemCompetenceCreature extends RdDItem {
carac: { key: this.name, value: this.system.carac_value },
equipe: true,
mortalite: this.system.mortalite,
dmg: this.system.dommages,
dommages: this.system.dommages,
//dmg: this.system.dommages,
initiative: initative
};
return attaque

View File

@@ -727,8 +727,6 @@ export class RdDCombat {
RollBasicParts.loadSurprises(attackerRoll)
attackerRoll.passeArme = attackerRoll.passeArme ?? foundry.utils.randomID(16)
attackerRoll.dmg = RdDBonus.dmgRollV2(attackerRoll, attackerRoll.current.attaque)
// attackerRoll.current.attaque.dmg = attackerRoll.dmg
// attaque.dmg = attackerRoll.current.attaque.dmg
const attaque = RollDialog.saveParts(attackerRoll)
const defense = {
attackerRoll: attaque,

View File

@@ -36,7 +36,7 @@ export class RollPartAttaque extends RollPartSelect {
restore(rollData) {
const saved = this.getSaved(rollData)
super.restore(rollData)
if (saved.dmg) {
if (saved.dmg != undefined) {
this.getCurrent(rollData).dmg = this.getSaved(rollData).dmg
}
}

View File

@@ -12,22 +12,30 @@ export class RollPartCarac extends RollPartSelect {
loadRefs(rollData) {
const refs = this.getRefs(rollData)
refs.all = this.$getActorCaracs(rollData)
const actor = rollData.active.actor
refs.all = [...this.$getActorCaracs(actor), ...this.$getCaracCompetenceCreature(actor)]
refs.caracs = refs.all
this.$selectCarac(rollData)
}
choices(refs) { return refs.caracs }
$getActorCaracs(rollData) {
return Object.entries(rollData.active.actor.getCarac())
$getActorCaracs(actor) {
return Object.entries(actor.getCarac())
.filter(([key, c]) => key != 'taille')
/* TODO: filter by context */
.map(([key, carac]) => {
return RollPartCarac.$extractCarac(key, carac)
})
}
$getCaracCompetenceCreature(actor) {
if (actor.isPersonnage()) {
return []
}
return actor.getCompetences()
.map(it => { return { key: it.name, label: it.name, value: parseInt(it.system.carac_value) } })
}
static $extractCarac(key, carac) {
return {
key: key,
@@ -40,7 +48,6 @@ export class RollPartCarac extends RollPartSelect {
allowed = allowed.filter(it => it != undefined)
const refs = this.getRefs(rollData)
refs.caracs = allowed.length > 0
// ? refs.all.filter(it => allowed.includes(Grammar.toLowerCaseNoAccent(it.key)))
? refs.all.filter(it => allowed.includes(it.key))
: refs.all
this.$selectCarac(rollData)

View File

@@ -20,7 +20,7 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/item/icon-arme-broken.hbs" action.arme}}
</span>
<span class="competence-value">{{plusMoins action.comp.system.niveau}}</span>
<span class="competence-value">{{plusMoins action.dommagesArme}}</span>
<span class="competence-value">{{plusMoins action.dommages}}</span>
<span class="competence-value"></span>
<span class="initiative-value">
<a class="roll-init-arme" data-tooltip="{{action.name}}: initiative {{action.initiative}}">

View File

@@ -10,8 +10,7 @@
</div>
<div class="chat-resume">
{{current.carac.label}} / {{current.comp.label}} à {{current.diff.value}}
<br>{{> 'partial-infojet'}}
{{> 'partial-infojet'}}
</div>
<div class="chat-details">

View File

@@ -8,8 +8,7 @@
</div>
<div class="chat-resume">
{{current.carac.label}}{{#unless (eq current.comp.key '')}} / {{current.comp.label}}{{/unless}} à {{current.diff.value}}
<br>{{> 'partial-infojet'}}
{{> 'partial-infojet'}}
</div>
<div class="chat-details">

View File

@@ -13,8 +13,7 @@
</div>
<div class="chat-resume">
{{current.carac.label}} / {{current.comp.label}} à {{current.diff.value}}
<br>{{> "partial-infojet"}}
{{> 'partial-infojet'}}
</div>
<div class="chat-details">

View File

@@ -10,8 +10,7 @@
</div>
<div class="chat-resume">
{{current.carac.label}} / {{current.comp.label}} à {{current.diff.value}}
<br>{{> 'partial-infojet'}}
{{> 'partial-infojet'}}
</div>
<div class="chat-details">

View File

@@ -8,8 +8,7 @@
</div>
<div class="chat-resume">
{{current.carac.label}} / {{current.comp.label}} à {{current.diff.value}}
<br>{{> 'partial-infojet'}}
{{> 'partial-infojet'}}
</div>
<div class="chat-details">

View File

@@ -8,8 +8,7 @@
</div>
<div class="chat-resume">
{{current.carac.label}} / {{current.comp.label}} à {{current.diff.value}}
<br>{{> 'partial-infojet'}}
{{> 'partial-infojet'}}
</div>
<div class="chat-details">

View File

@@ -8,8 +8,7 @@
</div>
<div class="chat-resume">
{{current.carac.label}} / {{current.comp.label}} à {{current.diff.value}}
<br>{{> 'partial-infojet'}}
{{> 'partial-infojet'}}
</div>
<div class="chat-details">

View File

@@ -15,8 +15,7 @@
</div>
<div class="chat-resume">
{{current.carac.label}} / {{current.comp.label}} à {{current.diff.value}}
<br>{{> 'partial-infojet'}}
{{> 'partial-infojet'}}
</div>
<hr>

View File

@@ -8,8 +8,7 @@
</div>
<div class="chat-resume">
{{current.carac.label}} / {{current.comp.label}} à {{current.diff.value}}
<br>{{> 'partial-infojet'}}
{{> 'partial-infojet'}}
</div>
<div class="chat-details">

View File

@@ -1,3 +1,9 @@
{{current.carac.label}}
{{#if (and (ne current.comp.key '') (ne current.carac.label current.comp.label))}}
/ {{current.comp.label}}
{{/if}}
à {{current.diff.value}}
<br>
{{#if ajustements}}
<div>
<span class="tooltip-overflow tooltip-dotted" >