diff --git a/lang/en.json b/lang/en.json index e7136bd..7601052 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1,6 +1,6 @@ { "TYPES": { - "Actor":{ + "Actor": { "Personnage": "PC" }, "Item": { @@ -54,12 +54,12 @@ "ecrymology": "Ecrymology", "traumatology": "Traumatology", "traversology": "Traversology", - "urbatechnology": "Urbatechnology", + "urbatechnology": "Urbatechnology", "quibbling": "Quibbling", "creativity": "Creativity", "loquacity": "Loquacity", "guile": "Guile", - "performance" :"Performance", + "performance": "Performance", "skill": "Skill", "troublesome": "Troublesome", "occasional": "Occasional", @@ -84,8 +84,16 @@ "confrontation": "Confrontation", "rollnormal": "Normal (4d6)", "rollspleen": "With Spleen (5d6, worst 4 are kept)", - "rollideal": "With Ideal (5d6, best 4 are kept)" - + "rollideal": "With Ideal (5d6, best 4 are kept)", + "superficial": "Superficial", + "light": "Light", + "serious": "Serious", + "major": "Major", + "impactType": "Impact type", + "impactLevel": "Impact level", + "impactphysical": "Physical", + "impactmental": "Mental", + "impactsocial": "Social" } } } \ No newline at end of file diff --git a/lang/fr.json b/lang/fr.json index 697e6e8..f185c3a 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -84,7 +84,16 @@ "confrontation": "Confrontation", "rollnormal": "Normal (4d6)", "rollspleen": "Avec le Spleen (5d6, 4 plus bas conservés)", - "rollideal": "Avec l'Idéal (5d6, 4 plus haut conservés)" + "rollideal": "Avec l'Idéal (5d6, 4 plus haut conservés)", + "superficial": "Superficiel", + "light": "Léger", + "serious": "Grave", + "major": "Majeur", + "impactType": "Type d'Impact", + "impactLevel": "Niveau d'impact", + "impactphysical": "Physique", + "impactmental": "Mental", + "impactsocial": "Social" } } } \ No newline at end of file diff --git a/modules/actors/ecryme-actor-sheet.js b/modules/actors/ecryme-actor-sheet.js index ac4724a..bbae448 100644 --- a/modules/actors/ecryme-actor-sheet.js +++ b/modules/actors/ecryme-actor-sheet.js @@ -39,9 +39,9 @@ export class EcrymeActorSheet extends ActorSheet { traits: this.actor.getRollTraits(), ideal: this.actor.getIdeal(), spleen: this.actor.getSpleen(), - system: duplicate(this.object.system), + impacts: this.object.getImpacts(), config: duplicate(game.system.ecryme.config), - weapons: duplicate(this.actor.getWeapons()), + weapons: this.actor.getWeapons(), archetype: duplicate(this.actor.getArchetype()), equipements: duplicate(this.actor.getEquipements()), subActors: duplicate(this.actor.getSubActors()), @@ -121,6 +121,13 @@ export class EcrymeActorSheet extends ActorSheet { this.actor.rollSkillConfront(categKey, skillKey) }); + html.find('.impact-modify').click((event) => { + let impactType = $(event.currentTarget).data("impact-type") + let impactLevel = $(event.currentTarget).data("impact-level") + let modifier = Number($(event.currentTarget).data("impact-modifier")) + this.actor.modifyImpact(impactType, impactLevel, modifier) + }); + html.find('.roll-weapon').click((event) => { const armeId = $(event.currentTarget).data("arme-id") this.actor.rollArme(armeId) diff --git a/modules/actors/ecryme-actor.js b/modules/actors/ecryme-actor.js index 436c4d7..866745f 100644 --- a/modules/actors/ecryme-actor.js +++ b/modules/actors/ecryme-actor.js @@ -107,7 +107,8 @@ export class EcrymeActor extends Actor { } /* -------------------------------------------- */ getSpecialization(id) { - return this.items.find(it => it.type == "specialization" && it.id == id) + let spec = this.items.find(it => it.type == "specialization" && it.id == id) + return spec } /* -------------------------------------------- */ getSpecializations(skillKey) { @@ -126,6 +127,11 @@ export class EcrymeActor extends Actor { return skills } /* -------------------------------------------- */ + getImpacts() { + let comp = duplicate(this.items.filter(item => item.type == 'impact') || []) + return comp; + } + /* -------------------------------------------- */ getWeapons() { let comp = duplicate(this.items.filter(item => item.type == 'weapon') || []) EcrymeUtility.sortArrayObjectsByName(comp) @@ -214,12 +220,26 @@ export class EcrymeActor extends Actor { /* -------------------------------------------- */ async equipGear(equipmentId) { let item = this.items.find(item => item.id == equipmentId); - if (item && item.system) { + if (item?.system) { let update = { _id: item.id, "system.equipped": !item.system.equipped }; await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity } } + /* -------------------------------------------- */ + modifyImpact(impactType, impactLevel, modifier) { + console.log(impactType, impactLevel, modifier) + let current = this.system.impacts[impactType][impactLevel] + if (modifier > 0) { + while ( EcrymeUtility.getImpactMax(impactLevel) == current && impactLevel != "major") { + impactLevel = EcrymeUtility.getNextImpactLevel(impactLevel) + current = this.system.impacts[impactType][impactLevel] + } + } + let newImpact = Math.max(this.system.impacts[impactType][impactLevel] + modifier, 0) + this.update({ [`system.impacts.${impactType}.${impactLevel}`]: newImpact}) + } + /* -------------------------------------------- */ clearInitiative() { this.getFlag("world", "initiative", -1) diff --git a/modules/common/ecryme-config.js b/modules/common/ecryme-config.js index 6941d17..f27a21f 100644 --- a/modules/common/ecryme-config.js +++ b/modules/common/ecryme-config.js @@ -6,6 +6,7 @@ export const ECRYME_CONFIG = { spleen: "Spleen", ideal: "Ideal" }, + traitLevel: [ {value: -3, text: "-3"}, {value: -2, text: "-2"}, @@ -14,6 +15,17 @@ export const ECRYME_CONFIG = { {value: +2, text: "+2"}, {value: +3, text: "+3"} ], + impactTypes: { + physical: "ECRY.ui.physical", + mental: "ECRY.ui.mental", + social: "ECRY.ui.social" + }, + impactLevels: { + superficial: "ECRY.ui.superficial", + light: "ECRY.ui.light", + serious: "ECRY.ui.serious", + major: "ECRY.ui.major" + }, difficulty: { "-1": {difficulty: "ECRY.ui.none", frequency: "ECRY.ui.none", value: "-"}, "8": { difficulty: "ECRY.ui.troublesome", frequency: "ECRY.ui.occasional", value: 8 }, diff --git a/modules/common/ecryme-utility.js b/modules/common/ecryme-utility.js index 29f4514..0f0338e 100644 --- a/modules/common/ecryme-utility.js +++ b/modules/common/ecryme-utility.js @@ -1,6 +1,9 @@ /* -------------------------------------------- */ import { EcrymeCommands } from "../app/ecryme-commands.js"; +/* -------------------------------------------- */ +const __maxImpacts = {superficial: 4, light: 3, serious: 2, major: 1} +const __nextImpacts = {superficial: "light", light: "serious", serious: "major", major: "major"} /* -------------------------------------------- */ export class EcrymeUtility { @@ -150,7 +153,8 @@ export class EcrymeUtility { 'systems/fvtt-ecryme/templates/items/partial-item-nav.hbs', 'systems/fvtt-ecryme/templates/items/partial-item-equipment.hbs', 'systems/fvtt-ecryme/templates/items/partial-item-description.hbs', - 'systems/fvtt-ecryme/templates/dialogs/partial-common-roll-dialog.hbs' + 'systems/fvtt-ecryme/templates/dialogs/partial-common-roll-dialog.hbs', + 'systems/fvtt-ecryme/templates/actors/partial-impacts.hbs' ] return loadTemplates(templatePaths); } @@ -264,7 +268,13 @@ export class EcrymeUtility { return chatData; } - + /* -------------------------------------------- */ + static getImpactMax(impactLevel) { + return __maxImpacts[impactLevel] + } + static getNextImpactLevel(impactLevel) { + return __nextImpacts[impactLevel] + } /* -------------------------------------------- */ static async showDiceSoNice(roll, rollMode) { if (game.modules.get("dice-so-nice")?.active) { @@ -304,7 +314,7 @@ export class EcrymeUtility { } /* -------------------------------------------- */ - static computeRollFormula(rollData, isConfrontation = false) { + static computeRollFormula(rollData, actor, isConfrontation = false) { // Build the dice formula let diceFormula = (isConfrontation) ? "4d6" : "2d6" if (rollData.useIdeal) { @@ -358,7 +368,7 @@ export class EcrymeUtility { } rollData.difficulty = Number(rollData.difficulty) - let diceFormula = this.computeRollFormula(rollData) + let diceFormula = this.computeRollFormula(rollData, actor) // Performs roll let myRoll = new Roll(diceFormula).roll({ async: false }) @@ -369,7 +379,7 @@ export class EcrymeUtility { this.computeResults(rollData) - console.log("ERRRRR", rollData) + console.log("rollData", rollData) let msg = await this.createChatWithRollMode(rollData.alias, { content: await renderTemplate(`systems/fvtt-ecryme/templates/chat/chat-generic-result.hbs`, rollData) }) diff --git a/modules/dialogs/ecryme-confront-dialog.js b/modules/dialogs/ecryme-confront-dialog.js index cc1bd85..b5d7de5 100644 --- a/modules/dialogs/ecryme-confront-dialog.js +++ b/modules/dialogs/ecryme-confront-dialog.js @@ -69,7 +69,7 @@ export class EcrymeConfrontDialog extends Dialog { let dataJSON = event.dataTransfer.getData('text/plain') let data = JSON.parse(dataJSON) let idx = Number(data.diceIndex) - console.log("DATA", data, event, event.srcElement.className) + //console.log("DATA", data, event, event.srcElement.className) if ( event.srcElement.className.includes("execution")) { this.rollData.availableDices[idx].location = "execution" } diff --git a/postcss/ecryme.css b/postcss/ecryme.css index 948c2b5..9ed876d 100644 --- a/postcss/ecryme.css +++ b/postcss/ecryme.css @@ -1201,7 +1201,17 @@ ul, li { color: rgba(19, 18, 18, 0.95); } +.impact-box { + border-width: 2px; + border-color: #000000; + border-radius: 6px; + border: 2px ridge #443307; + margin: 2px; +} + .items-title-text { + text-align: center; + font-family: MailartRubberstamp; margin-left: 4px; } .lock-icon { diff --git a/styles/ecryme.css b/styles/ecryme.css index 58d4273..19d29f6 100644 --- a/styles/ecryme.css +++ b/styles/ecryme.css @@ -1181,7 +1181,16 @@ ul, li { color: rgba(19, 18, 18, 0.95); } +.impact-box { + border-width: 2px; + border-color: #000000; + border-radius: 6px; + border: 2px ridge #443307; +} + .items-title-text { + text-align: center; + font-family: MailartRubberstamp; margin-left: 4px; } .lock-icon { diff --git a/system.json b/system.json index 8f47dee..bbac8dd 100644 --- a/system.json +++ b/system.json @@ -43,7 +43,7 @@ ], "title": "Ecryme, le Jeu de Rôles", "url": "https://www.uberwald.me/gitea/uberwald/fvtt-ecryme", - "version": "10.0.4", + "version": "11.0.1", "download": "https://www.uberwald.me/gitea/uberwald/fvtt-ecryme/archive/fvtt-ecryme-v10.0.0.zip", "background": "systems/fvtt-ecryme/images/assets/ecryme_extract_panel_01.webp" } \ No newline at end of file diff --git a/template.json b/template.json index c23e44e..08437ab 100644 --- a/template.json +++ b/template.json @@ -115,6 +115,26 @@ } } } + }, + "impacts": { + "physical": { + "superficial": 0, + "light": 0, + "serious": 0, + "major": 0 + }, + "mental": { + "superficial": 0, + "light": 0, + "serious": 0, + "major": 0 + }, + "social": { + "superficial": 0, + "light": 0, + "serious": 0, + "major": 0 + } } }, "npccore": { @@ -130,7 +150,16 @@ } }, "Item": { - "types": ["equipment", "trait", "weapon", "specialization","annency", "boheme", "contact"], + "types": [ + "equipment", + "trait", + "weapon", + "specialization", + "annency", + "boheme", + "contact", + "impact" + ], "templates": { "common": { "description": "" @@ -141,46 +170,75 @@ "costunit": "" } }, + "impact": { + "templates": [ + "common" + ], + "impacttype": "physical", + "impactlevel": "superficial" + }, "equipment": { - "templates": ["common","equipement"], + "templates": [ + "common", + "equipement" + ], "quantity": 1, "weight": 0 }, "trait": { - "templates": ["common"], + "templates": [ + "common" + ], "traitype": "normal", "level": 1 }, "weapon": { - "templates": ["common", "equipement"], + "templates": [ + "common", + "equipement" + ], "effect": 0 }, "specialization": { - "templates": ["common"], + "templates": [ + "common" + ], "skillkey": "" }, "scar": { - "templates": ["common"], - "skillcategory": ["physical", "mental", "social", "cephalie"], + "templates": [ + "common" + ], + "skillcategory": [ + "physical", + "mental", + "social", + "cephalie" + ], "scarLevel": 1 }, "annency": { - "templates": ["common"], + "templates": [ + "common" + ], "collective": false, "multiple": false, "improvements": "" }, "boheme": { - "templates": ["common"], + "templates": [ + "common" + ], "ideals": "", "political": "" }, "contact": { - "templates": ["common"], + "templates": [ + "common" + ], "attitude": "neutral", "organization": "", - "location":"" + "location": "" } } - } \ No newline at end of file diff --git a/templates/actors/actor-sheet.hbs b/templates/actors/actor-sheet.hbs index 275865e..3b906f0 100644 --- a/templates/actors/actor-sheet.hbs +++ b/templates/actors/actor-sheet.hbs @@ -8,11 +8,11 @@
- +

-
+
  • @@ -39,10 +39,19 @@
+
+ {{> 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"}}
+
+ @@ -60,56 +69,60 @@ {{!-- Skills Tab --}}
- +
{{#each skills as |category categkey|}}
-
- {{/each}} + {{/each}}
@@ -150,7 +163,7 @@
-

+

{{editor equipementlibre target="system.equipementlibre" button=true owner=owner editable=editable}} @@ -266,33 +279,37 @@
  • - +
  • -
    +
    • - +
    • - +
    • - +
    -
    + -
    +

    -

    +

    {{editor description target="system.biodata.description" button=true owner=owner @@ -300,7 +317,7 @@

    -

    +

    {{editor notes target="system.biodata.notes" button=true owner=owner editable=editable}} @@ -308,7 +325,7 @@
    -
    +
    \ No newline at end of file diff --git a/templates/actors/partial-impacts.hbs b/templates/actors/partial-impacts.hbs new file mode 100644 index 0000000..37cbb59 --- /dev/null +++ b/templates/actors/partial-impacts.hbs @@ -0,0 +1,14 @@ +
    + + + +
    \ No newline at end of file diff --git a/templates/dialogs/partial-common-roll-dialog.hbs b/templates/dialogs/partial-common-roll-dialog.hbs index 8231bac..8a1ec77 100644 --- a/templates/dialogs/partial-common-roll-dialog.hbs +++ b/templates/dialogs/partial-common-roll-dialog.hbs @@ -20,8 +20,8 @@
    {{localize "ECRY.ui.spec"}} :
    diff --git a/templates/items/item-impact-sheet.hbs b/templates/items/item-impact-sheet.hbs new file mode 100644 index 0000000..ee0cf14 --- /dev/null +++ b/templates/items/item-impact-sheet.hbs @@ -0,0 +1,48 @@ +
    +
    + +
    +

    +
    +
    + + {{> systems/fvtt-ecryme/templates/items/partial-item-nav.hbs}} + + + {{!-- Sheet Body --}} +
    + + {{> systems/fvtt-ecryme/templates/items/partial-item-description.hbs}} + +
    + +
    +
      + +
    • + + +
    • + +
    • + + +
    • +
    +
    +
    + +
    +