From 8800c32e8c516cb8c258a07be35a6bc7aa686036 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Wed, 31 May 2023 09:16:30 +0200 Subject: [PATCH] Ajout des impacts --- lang/en.json | 6 +- lang/fr.json | 6 +- modules/actors/ecryme-actor-sheet.js | 4 +- modules/actors/ecryme-actor.js | 23 ++++++++ modules/common/ecryme-utility.js | 5 ++ postcss/ecryme.css | 12 +++- styles/ecryme.css | 11 ++++ template.json | 13 ++++- templates/actors/actor-sheet.hbs | 57 +++++++++++++------ templates/actors/partial-impacts.hbs | 5 +- templates/chat/chat-generic-result.hbs | 5 +- .../dialogs/partial-common-roll-dialog.hbs | 11 +++- 12 files changed, 131 insertions(+), 27 deletions(-) diff --git a/lang/en.json b/lang/en.json index 7601052..458d7a3 100644 --- a/lang/en.json +++ b/lang/en.json @@ -39,6 +39,7 @@ "coin": "Coin", "notes": "Notes", "bio": "Bio", + "bionotes": "Bio&Notes", "skills": "Skills", "traits": "Traits", "equipment": "Equipment", @@ -93,7 +94,10 @@ "impactLevel": "Impact level", "impactphysical": "Physical", "impactmental": "Mental", - "impactsocial": "Social" + "impactsocial": "Social", + "impactmalus": "Impact Malus", + "ongoingconfront": "Ongoing confrontation", + "confront":"Confrontation" } } } \ No newline at end of file diff --git a/lang/fr.json b/lang/fr.json index f185c3a..c3d56a6 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -39,6 +39,7 @@ "coin": "Sous", "notes": "Notes", "bio": "Bio", + "bionotes": "Bio&Notes", "skills": "Compétences", "traits": "Traits", "equipment": "Equipement", @@ -93,7 +94,10 @@ "impactLevel": "Niveau d'impact", "impactphysical": "Physique", "impactmental": "Mental", - "impactsocial": "Social" + "impactsocial": "Social", + "impactmalus": "Malus d'Impact", + "ongoingconfront": "Confrontations en cours", + "confront":"Confrontation" } } } \ No newline at end of file diff --git a/modules/actors/ecryme-actor-sheet.js b/modules/actors/ecryme-actor-sheet.js index bbae448..cd6591c 100644 --- a/modules/actors/ecryme-actor-sheet.js +++ b/modules/actors/ecryme-actor-sheet.js @@ -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 }), diff --git a/modules/actors/ecryme-actor.js b/modules/actors/ecryme-actor.js index 866745f..c33e7a2 100644 --- a/modules/actors/ecryme-actor.js +++ b/modules/actors/ecryme-actor.js @@ -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 } diff --git a/modules/common/ecryme-utility.js b/modules/common/ecryme-utility.js index 0f0338e..5fe1613 100644 --- a/modules/common/ecryme-utility.js +++ b/modules/common/ecryme-utility.js @@ -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) diff --git a/postcss/ecryme.css b/postcss/ecryme.css index 9ed876d..79f8c53 100644 --- a/postcss/ecryme.css +++ b/postcss/ecryme.css @@ -1206,7 +1206,17 @@ ul, li { border-color: #000000; border-radius: 6px; border: 2px ridge #443307; - margin: 2px; + margin: 4px; + padding: 4px; +} +.impact-title { + font-size: bold; + display: flex; + align-items: center; + justify-content: center; + margin-left: auto; + margin-right: auto; + text-align: center; } .items-title-text { diff --git a/styles/ecryme.css b/styles/ecryme.css index 19d29f6..3f7fda3 100644 --- a/styles/ecryme.css +++ b/styles/ecryme.css @@ -1186,6 +1186,17 @@ ul, li { border-color: #000000; border-radius: 6px; border: 2px ridge #443307; + margin: 4px; + padding: 4px; +} +.impact-title { + font-size: bold; + display: flex; + align-items: center; + justify-content: center; + margin-left: auto; + margin-right: auto; + text-align: center; } .items-title-text { diff --git a/template.json b/template.json index 4d62f03..7026fdd 100644 --- a/template.json +++ b/template.json @@ -157,7 +157,8 @@ "specialization", "annency", "boheme", - "contact" + "contact", + "confrontation" ], "templates": { "common": { @@ -169,6 +170,16 @@ "costunit": "" } }, + "confrontation": { + "templates": [ + "common" + ], + "attackerId": "", + "defenserId": "", + "rolllist": [], + "bonusexecution": 0, + "bonuspreservation": 0 + }, "equipment": { "templates": [ "common", diff --git a/templates/actors/actor-sheet.hbs b/templates/actors/actor-sheet.hbs index 3b906f0..344434b 100644 --- a/templates/actors/actor-sheet.hbs +++ b/templates/actors/actor-sheet.hbs @@ -39,15 +39,6 @@ -
- {{> systems/fvtt-ecryme/templates/actors/partial-impacts.hbs impacts=system.impacts.physical - impacttype="physical"}} - {{> systems/fvtt-ecryme/templates/actors/partial-impacts.hbs impacts=system.impacts.mental - impacttype="mental"}} - {{> systems/fvtt-ecryme/templates/actors/partial-impacts.hbs impacts=system.impacts.social - impacttype="social"}} -
- @@ -59,9 +50,9 @@ {{!-- Sheet Body --}} @@ -77,8 +68,8 @@
+
+ +
+ {{> systems/fvtt-ecryme/templates/actors/partial-impacts.hbs impacts=system.impacts.physical + impacttype="physical" impactMalus=impactsMalus.physical}} + {{> systems/fvtt-ecryme/templates/actors/partial-impacts.hbs impacts=system.impacts.mental + impacttype="mental" impactMalus=impactsMalus.mental}} + {{> systems/fvtt-ecryme/templates/actors/partial-impacts.hbs impacts=system.impacts.social + impacttype="social" impactMalus=impactsMalus.social}} +
+ + + +
+ + {{!-- Equipement Tab --}}
@@ -304,9 +329,7 @@
- -

@@ -323,9 +346,9 @@ {{editor notes target="system.biodata.notes" button=true owner=owner editable=editable}}

- - + + \ No newline at end of file diff --git a/templates/actors/partial-impacts.hbs b/templates/actors/partial-impacts.hbs index 37cbb59..0da3375 100644 --- a/templates/actors/partial-impacts.hbs +++ b/templates/actors/partial-impacts.hbs @@ -1,6 +1,9 @@
- +
+ +
+