Ajout des impacts

This commit is contained in:
2023-05-31 09:16:30 +02:00
parent 688d67751c
commit 8800c32e8c
12 changed files with 131 additions and 27 deletions

View File

@ -37,13 +37,15 @@ export class EcrymeActorSheet extends ActorSheet {
limited: this.object.limited,
skills: this.actor.prepareSkills(),
traits: this.actor.getRollTraits(),
confrontations: this.actor.getConfrontations(),
ideal: this.actor.getIdeal(),
spleen: this.actor.getSpleen(),
impacts: this.object.getImpacts(),
config: duplicate(game.system.ecryme.config),
weapons: this.actor.getWeapons(),
impactsMalus: this.actor.getImpactsMalus(),
archetype: duplicate(this.actor.getArchetype()),
equipements: duplicate(this.actor.getEquipements()),
equipements: this.actor.getEquipements(),
subActors: duplicate(this.actor.getSubActors()),
description: await TextEditor.enrichHTML(this.object.system.description, { async: true }),
notes: await TextEditor.enrichHTML(this.object.system.notes, { async: true }),

View File

@ -90,6 +90,9 @@ export class EcrymeActor extends Actor {
return comp;
}
/* -------------------------------------------- */
getConfrontations() {
return this.items.filter(it => it.type == "confrontation")
}
getRollTraits() {
return this.items.filter(it => it.type == "trait" && it.system.traitype == "normal")
}
@ -240,6 +243,22 @@ export class EcrymeActor extends Actor {
this.update({ [`system.impacts.${impactType}.${impactLevel}`]: newImpact})
}
/* -------------------------------------------- */
getImpactMalus(impactKey) {
let impacts = this.system.impacts[impactKey]
return - ((impacts.serious*2) + (impacts.major*4))
}
/* -------------------------------------------- */
getImpactsMalus() {
let impactsMalus = {
physical: this.getImpactMalus("physical"),
mental: this.getImpactMalus("mental"),
social: this.getImpactMalus("social")
}
return impactsMalus
}
/* -------------------------------------------- */
clearInitiative() {
this.getFlag("world", "initiative", -1)
@ -327,12 +346,16 @@ export class EcrymeActor extends Actor {
getCommonSkill(categKey, skillKey) {
let skill = this.system.skills[categKey].skilllist[skillKey]
let rollData = this.getCommonRollData()
skill = duplicate(skill)
skill.categKey = categKey
skill.skillKey = skillKey
skill.spec = this.getSpecializations(skillKey)
rollData.skill = skill
rollData.img = skill.img
rollData.impactMalus = this.getImpactMalus(categKey)
return rollData
}

View File

@ -47,6 +47,9 @@ export class EcrymeUtility {
Handlebars.registerHelper('add', function (a, b) {
return parseInt(a) + parseInt(b);
})
Handlebars.registerHelper('valueAtIndex', function (arr, idx) {
return arr[idx];
})
Handlebars.registerHelper('for', function (from, to, incr, block) {
var accum = '';
for (var i = from; i <= to; i += incr)
@ -354,6 +357,7 @@ export class EcrymeUtility {
}
diceFormula += "+" + rollData.bonusMalusTraits
diceFormula += "+" + rollData.bonusMalusPerso
diceFormula += "+" + rollData.impactMalus
rollData.diceFormula = diceFormula
return diceFormula
}
@ -509,6 +513,7 @@ export class EcrymeUtility {
difficulty: "-",
useSpleen: false,
useIdeal: false,
impactMalus: 0,
config: duplicate(game.system.ecryme.config)
}
EcrymeUtility.updateWithTarget(rollData)