diff --git a/images/icons/blessure.webp b/images/icons/blessure.webp new file mode 100644 index 0000000..637ec61 Binary files /dev/null and b/images/icons/blessure.webp differ diff --git a/images/icons/maladie.webp b/images/icons/maladie.webp new file mode 100644 index 0000000..79ccc40 Binary files /dev/null and b/images/icons/maladie.webp differ diff --git a/images/icons/simple.webp b/images/icons/simple.webp new file mode 100644 index 0000000..1d5de63 Binary files /dev/null and b/images/icons/simple.webp differ diff --git a/images/ui/femme_gauche.webp b/images/ui/femme_gauche.webp new file mode 100644 index 0000000..7d49681 Binary files /dev/null and b/images/ui/femme_gauche.webp differ diff --git a/images/ui/homme_droit.webp b/images/ui/homme_droit.webp new file mode 100644 index 0000000..a358585 Binary files /dev/null and b/images/ui/homme_droit.webp differ diff --git a/lang/fr.json b/lang/fr.json index c6a51db..563bc8c 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -11,7 +11,10 @@ "armure": "Armure", "grace": "Grace", "origine": "Origine", - "education": "Education" + "education": "Education", + "blessure": "Blessure", + "maladie": "Maladie", + "simple": "Simple" } } } \ No newline at end of file diff --git a/modules/actors/tedeum-actor-sheet.js b/modules/actors/tedeum-actor-sheet.js index 3d57e54..87423c4 100644 --- a/modules/actors/tedeum-actor-sheet.js +++ b/modules/actors/tedeum-actor-sheet.js @@ -11,7 +11,7 @@ export class TeDeumActorPJSheet extends ActorSheet { /** @override */ static get defaultOptions() { - return mergeObject(super.defaultOptions, { + return foundry.utils.mergeObject(super.defaultOptions, { classes: ["fvtt-te-deum", "sheet", "actor"], template: "systems/fvtt-te-deum/templates/actors/actor-sheet.hbs", width: 860, @@ -33,10 +33,10 @@ export class TeDeumActorPJSheet extends ActorSheet { name: this.actor.name, editable: this.isEditable, cssClass: this.isEditable ? "editable" : "locked", - system: duplicate(this.object.system), + system: foundry.utils.duplicate(this.object.system), limited: this.object.limited, competences: this.actor.getCompetences(), - config: duplicate(game.system.tedeum.config), + config: foundry.utils.duplicate(game.system.tedeum.config), armes: this.actor.getArmes(), caracList: this.actor.prepareCaracteristiques(), providence: this.actor.prepareProvidence(), @@ -44,6 +44,11 @@ export class TeDeumActorPJSheet extends ActorSheet { equipements: this.actor.getEquipements(), armures: this.actor.getArmures(), graces: this.actor.getGraces(), + blessures: this.actor.getBlessures(), + maladies: this.actor.getMaladies(), + poisons: this.actor.getPoisons(), + combat: this.actor.prepareCombat(), + santeModifier: this.actor.getSanteModifier(), description: await TextEditor.enrichHTML(this.object.system.description, { async: true }), notes: await TextEditor.enrichHTML(this.object.system.notes, { async: true }), options: this.options, diff --git a/modules/actors/tedeum-actor.js b/modules/actors/tedeum-actor.js index e4042c2..7cb6669 100644 --- a/modules/actors/tedeum-actor.js +++ b/modules/actors/tedeum-actor.js @@ -89,48 +89,91 @@ export class TeDeumActor extends Actor { /* -------------------------------------------- */ getCompetences() { - let comp = duplicate(this.items.filter(item => item.type == 'competence') || []) + let comp = foundry.utils.duplicate(this.items.filter(item => item.type == 'competence') || []) return comp; } /* -------------------------------------------- */ getGraces() { - let comp = duplicate(this.items.filter(item => item.type == 'grace') || []) + let comp = foundry.utils.duplicate(this.items.filter(item => item.type == 'grace') || []) TeDeumUtility.sortArrayObjectsByName(comp) return comp; } getArmes() { - let comp = duplicate(this.items.filter(item => item.type == 'arme') || []) + let comp = foundry.utils.duplicate(this.items.filter(item => item.type == 'arme') || []) TeDeumUtility.sortArrayObjectsByName(comp) return comp; } getEquipements() { - let comp = duplicate(this.items.filter(item => item.type == 'equipement') || []) + let comp = foundry.utils.duplicate(this.items.filter(item => item.type == 'equipement') || []) TeDeumUtility.sortArrayObjectsByName(comp) return comp; } getArmures() { - let comp = duplicate(this.items.filter(item => item.type == 'armure') || []) + let comp = foundry.utils.duplicate(this.items.filter(item => item.type == 'armure') || []) + TeDeumUtility.sortArrayObjectsByName(comp) + return comp; + } + getBlessures() { + let comp = foundry.utils.duplicate(this.items.filter(item => item.type == 'blessure') || []) + for (let c of comp) { + let blessDef = game.system.tedeum.config.blessures[c.system.typeBlessure] + c.malus = blessDef.modifier + } + TeDeumUtility.sortArrayObjectsByName(comp) + return comp; + } + getMaladies() { + let comp = foundry.utils.duplicate(this.items.filter(item => item.type == 'maladie') || []) + for (let c of comp) { + c.malus = "N/A" + if (c.system.appliquee) { + let malDef = game.system.tedeum.config.virulence[c.system.virulence] + c.malus = malDef.modifier + } + } + TeDeumUtility.sortArrayObjectsByName(comp) + return comp; + } + getPoisons() { + let comp = foundry.utils.duplicate(this.items.filter(item => item.type == 'poison') || []) + for (let c of comp) { + c.malus = "N/A" + if (c.system.appliquee) { + let poisDef = game.system.tedeum.config.virulencePoison[c.system.virulence] + c.malus = poisDef.modifier + } + } TeDeumUtility.sortArrayObjectsByName(comp) return comp; } - /* -------------------------------------------- */ - calculMalusBlessures() { - let modifierBlessures = 0 - let nbBlessures = 0 - // Cumul des malus de blessures - for (let locKey in this.system.localisation) { - let loc = this.system.localisation[locKey] - let bDef = game.system.tedeum.config.blessures[loc.blessures] - modifierBlessures += bDef.modifier - nbBlessures += bDef.count + getSanteModifier() { + let comp = foundry.utils.duplicate(this.items.filter(item => item.type == 'maladie') || []) + let modTotal = 0 + for (let c of comp) { + if (c.system.appliquee) { + let maladieDef = game.system.tedeum.config.virulence[c.system.virulence] + modTotal += maladieDef.modifier + } + } + let simples= foundry.utils.duplicate(this.items.filter(item => item.type == 'simple') || []) + for (let c of simples) { + if (c.system.appliquee) { + let simpleDef = game.system.tedeum.config.virulencePoison[c.system.virulence] + modTotal += simpleDef.modifier + } + } + let blessures = foundry.utils.duplicate(this.items.filter(item => item.type == 'blessure') || []) + for (let c of blessures) { + let blessDef = game.system.tedeum.config.blessures[c.system.typeBlessure] + modTotal += blessDef.modifier } // Si le nombre de blessures est supérieur au score d'endurance, alors malus supplémentaire let endurance = this.items.find(item => item.type == "competence" && item.name.toLowerCase() == "endurance") - if ( nbBlessures > endurance.system.score) { - modifierBlessures += -1 - } - return modifierBlessures + if ( blessures.length > endurance.system.score) { + modTotal += -1 + } + return modTotal } /* -------------------------------------------- */ @@ -160,7 +203,26 @@ export class TeDeumActor extends Actor { providence.dice = game.system.tedeum.config.providence[providence.value].diceValue return providence } - + /* -------------------------------------------- */ + prepareCombat() { + let combatLoc = foundry.utils.deepClone(this.system.localisation) + for (let key in combatLoc) { + combatLoc[key] = foundry.utils.mergeObject(combatLoc[key], game.system.tedeum.config.LOCALISATION[key]) + combatLoc[key].armures = [] + combatLoc[key].protectionTotal = 0 + let armures = this.getArmures() + for (let armure of armures) { + if (armure.system.equipe && armure.system.localisation[key].protege) { + combatLoc[key].armures.push(armure) + combatLoc[key].protectionTotal += armure.system.protection + } + } + let endurance = this.items.find(item => item.type == "competence" && item.name.toLowerCase() == "endurance") + combatLoc[key].endurance = endurance.system.score + game.system.tedeum.config.LOCALISATION[key].locMod + combatLoc[key].touche = combatLoc[key].endurance + combatLoc[key].protectionTotal + } + return combatLoc + } /* -------------------------------------------- */ modifyProvidence(value) { let providence = foundry.utils.duplicate(this.system.providence) @@ -202,7 +264,7 @@ export class TeDeumActor extends Actor { getItemById(id) { let item = this.items.find(item => item.id == id); if (item) { - item = duplicate(item) + item = foundry.utils.duplicate(item) } return item; } @@ -232,7 +294,7 @@ export class TeDeumActor extends Actor { /* ------------------------------------------- */ async buildContainerTree() { - let equipments = duplicate(this.items.filter(item => item.type == "equipment") || []) + let equipments = foundry.utils.duplicate(this.items.filter(item => item.type == "equipment") || []) for (let equip1 of equipments) { if (equip1.system.iscontainer) { equip1.system.contents = [] @@ -288,10 +350,13 @@ export class TeDeumActor extends Actor { } /* -------------------------------------------- */ - getInitiativeScore(combatId, combatantId) { - let init = Math.floor((this.system.attributs.physique.value + this.system.attributs.habilite.value) / 2) - let subValue = new Roll("1d20").roll({ async: false }) - return init + (subValue.total / 100) + getInitiativeScore() { + let initiative = this.items.find(it=>it.type == "competence" && it.name.toLowerCase() == "initiative") + if ( initiative ) { + return initiative.system.score + } + ui.notifications.warn("Impossible de trouver la compétence Initiative pour l'acteur " + this.name) + return -1; } /* -------------------------------------------- */ @@ -327,8 +392,8 @@ export class TeDeumActor extends Actor { rollData.actorId = this.id rollData.img = this.img rollData.providence = this.prepareProvidence() - rollData.malusBlessures = this.calculMalusBlessures() - + rollData.santeModifier = this.getSanteModifier() + return rollData } @@ -336,7 +401,7 @@ export class TeDeumActor extends Actor { getCommonCompetence(compId) { let rollData = this.getCommonRollData() - let competence = duplicate(this.items.find(it => it.type =="competence" && it.id == compId)) + let competence = foundry.utils.duplicate(this.items.find(it => it.type =="competence" && it.id == compId)) rollData.competence = competence let c = foundry.utils.duplicate(this.system.caracteristiques[competence.system.caracteristique]) @@ -357,15 +422,30 @@ export class TeDeumActor extends Actor { /* -------------------------------------------- */ - rollArme(armeId) { + rollArme(armeId, compName = undefined) { let weapon = this.items.get(armeId) if (weapon) { - weapon = duplicate(weapon) + weapon = foundry.utils.duplicate(weapon) let rollData = this.getCommonRollData() rollData.mode = "arme" rollData.arme = weapon rollData.img = weapon.img rollData.title = weapon.name + + // Setup competence + carac + if (!compName) { + compName = weapon.system.competence + } + let competence = this.items.find(item => item.type == "competence" && item.name.toLowerCase() == compName.toLowerCase()) + if ( competence) { + rollData.competence = competence + let c = foundry.utils.duplicate(this.system.caracteristiques[competence.system.caracteristique]) + this.updateCarac( c, competence.system.caracteristique) + rollData.carac = c + } else { + ui.notifications.warn("Impossible de trouver la compétence " + compName) + return + } this.startRoll(rollData).catch("Error on startRoll") } else { ui.notifications.warn("Impossible de trouver l'arme concernée ") diff --git a/modules/app/tedeum-combat.js b/modules/app/tedeum-combat.js index ba53f27..238c366 100644 --- a/modules/app/tedeum-combat.js +++ b/modules/app/tedeum-combat.js @@ -6,11 +6,10 @@ export class TeDeumCombat extends Combat { /* -------------------------------------------- */ async rollInitiative(ids, formula = undefined, messageOptions = {} ) { ids = typeof ids === "string" ? [ids] : ids; - for (let cId = 0; cId < ids.length; cId++) { - const c = this.combatants.get(ids[cId]); - let id = c._id || c.id; - let initBonus = c.actor ? c.actor.getInitiativeScore( this.id, id ) : -1; - await this.updateEmbeddedDocuments("Combatant", [ { _id: id, initiative: initBonus } ]); + for (let cId of ids) { + const c = this.combatants.get(cId); + let initBonus = c.actor ? c.actor.getInitiativeScore( this.id, cId ) : -1; + await this.updateEmbeddedDocuments("Combatant", [ { _id: cId, initiative: initBonus } ]); } return this; diff --git a/modules/common/tedeum-config.js b/modules/common/tedeum-config.js index 4ce4df2..5680991 100644 --- a/modules/common/tedeum-config.js +++ b/modules/common/tedeum-config.js @@ -13,17 +13,16 @@ export const TEDEUM_CONFIG = { { value: 10 }, { value: 30 }, { value: 50 }], LOCALISATION: { - "pieddroit": { label: "Pied Droit", value: 1, id: "pieddroit", nbArmure: 1 }, - "jambedroite": { label: "Jambe Droite", value: 1, id: "jambedroite", nbArmure: 1 }, - "jambegauche": { label: "Jambe Gauche", value: 1, id: "jambegauche", nbArmure: 1 }, - "piedgauche": { label: "Pied Gauche", value: 1, id: "piedgauche", nbArmure: 1 }, - "piedgauche": { label: "Pied Gauche", value: 1, id: "piedgauche", nbArmure: 1 }, - "maindroite": { label: "Main Droite", value: 1, id: "maindroite", nbArmure: 1 }, - "maingauche": { label: "Main Gauche", value: 1, id: "maingauche", nbArmure: 1 }, - "brasdroit": { label: "Bras Droit", value: 1, id: "brasdroit", nbArmure: 2 }, - "brasgauche": { label: "Bras Gauche", value: 1, id: "brasgauche", nbArmure: 2 }, - "corps": { label: "Corps", value: 1, id: "corps", nbArmure: 2 }, - "tete": { label: "Tête", value: 1, id: "tete", nbArmure: 2 }, + "pieddroit": { label: "Pied Droit", value: 1, locMod:0, id: "pieddroit", nbArmure: 1, score: {min: 1, max:1}, coord: { top: 500, left: 0 } }, + "jambedroite": { label: "Jambe Droite", value: 1, locMod:-1,id: "jambedroite", nbArmure: 1, score: {min: 3, max:4},coord: { top: 400, left: 100 } }, + "jambegauche": { label: "Jambe Gauche", value: 1, locMod:-1,id: "jambegauche", nbArmure: 1, score: {min: 5, max:6},coord: { top: 400, left: 300 } }, + "piedgauche": { label: "Pied Gauche", value: 1, locMod:0,id: "piedgauche", nbArmure: 1, score: {min: 2, max:2},coord: { top: 500, left: 400 } }, + "maindroite": { label: "Main Droite", value: 1, locMod:0,id: "maindroite", nbArmure: 1, score: {min: 7, max:7},coord: { top: 0, left: 0 } }, + "maingauche": { label: "Main Gauche", value: 1, locMod:0,id: "maingauche", nbArmure: 1, score: {min: 8, max:8},coord: { top: 0, left: 400 } }, + "brasdroit": { label: "Bras Droit", value: 1, locMod:-1,id: "brasdroit", nbArmure: 2, score: {min: 9, max:10},coord: { top: 200, left: 0 } }, + "brasgauche": { label: "Bras Gauche", value: 1, locMod:-1,id: "brasgauche", nbArmure: 2, score: {min: 11, max:12},coord: { top: 200, left: 400 } }, + "corps": { label: "Corps", value: 1, id: "corps", locMod:-2,nbArmure: 2, score: {min: 13, max:17},coord: { top: 200, left: 200 } }, + "tete": { label: "Tête", value: 1, id: "tete", locMod:-2,nbArmure: 2 , score: {min: 18, max:20},coord: { top: 0, left: 200 }}, }, ARME_SPECIFICITE: { @@ -157,13 +156,32 @@ export const TEDEUM_CONFIG = { { value: "1", label: "+1 niveau" }, { value: "2", label: "+2 niveaux" } ], - blessures: [ - { value: 0, label: "Indemne", degatsMax: -1, count: 0, modifier: 0 }, - { value: 1, label: "Estafilade/Contusion", degatsMax: 2, count: 1, modifier: 0 }, - { value: 2, label: "Plaie", degatsMax: 4, count: 1, modifier: -1 }, - { value: 3, label: "Plaie béante", degatsMax: 6, count: 1, modifier: -2 }, - { value: 4, label: "Plaie atroce", degatsMax: 6, count: 1, horsCombat: true, modifier: -12 }, - { value: 5, label: "Tué net", degatsMax: 100, count: 1, horsCombat: true, mort: true, modifier: -12 } - ] - + blessures: { + indemne: { value: 0, label: "Indemne", key: "indemne", degatsMax: -1, count: 0, modifier: 0 }, + estafilade: { value: 1, label: "Estafilade", key: "estafilade", degatsMax: 2, count: 1, modifier: 0 }, + plaie: { value: 2, label: "Plaie", key: "plaie", degatsMax: 4, count: 1, modifier: -1 }, + plaiebeante: { value: 3, label: "Plaie béante", key: "plaiebeante", degatsMax: 6, count: 1, modifier: -2 }, + plaieatroce: { value: 4, label: "Plaie atroce", key: "plaieatroce", degatsMax: 6, count: 1, horsCombat: true, modifier: -12 }, + tunenet: { value: 5, label: "Tué net", key: "tuenet", degatsMax: 100, count: 1, horsCombat: true, mort: true, modifier: -12 } + }, + virulence: { + fatigue: { label: "Fatigue", value: "fatigue", modifier: 0 }, + epuisement: { label: "Epuisement", value: "epuisement",modifier: -1 }, + souffrance: { label: "Souffrance", value: "souffrance", modifier: -2 }, + agonie: { label: "Agonie", value: "agonie", modifier: -3 } + }, + fievre: { + aucune: { label: "Aucune", value: "aucune" }, + legere: { label: "Légère", value: "legere" }, + forte: { label: "Forte", value: "forte" }, + grave: { label: "Grave", value: "grave" } + }, + virulencePoison: { + aucune: { label: "Aucune", value: "nausee", modifier: 0 }, + nausee: { label: "Nausées & Vertiges", value: "nausee", modifier:0 }, + inflammation: { label: "Inflammations & Vomissements", value: "inflammation", modifier: -1 }, + elancement: { label: "Elancements & Hémorragies", value: "elancement" , modifier: -2 }, + convulsion: { label: "Convulsions & Délire hallucinatoire", value: "convulsion", modifier: -3 }, + mort: { label: "Inconscience & Mort", value: "mort", modifier: -12 } + } } \ No newline at end of file diff --git a/modules/common/tedeum-utility.js b/modules/common/tedeum-utility.js index a1896b8..48297c1 100644 --- a/modules/common/tedeum-utility.js +++ b/modules/common/tedeum-utility.js @@ -50,6 +50,10 @@ export class TeDeumUtility { //console.log("getConfigLabel", configName, key) return game.system.tedeum.config[configName][key].label }) + Handlebars.registerHelper('getConfigLabelArray', function (configName, key) { + //console.log("getConfigLabel", configName, key) + return game.system.tedeum.config[configName][key].label + }) Handlebars.registerHelper('isSpecArmeType', function (key, armeType) { return game.system.tedeum.config.ARME_SPECIFICITE[key][armeType] }) @@ -360,6 +364,10 @@ export class TeDeumUtility { /* -------------------------------------------- */ static modifyDice(dice, bonusMalus) { let newIndex = game.system.tedeum.config.diceValeur.indexOf(dice) + Number(bonusMalus) + if (newIndex < 0) { + ui.notifications.error("Vos blessures ou maladies vous empêchent de réaliser cette action, vous êtes trop faibles") + return undefined + } newIndex = Math.min(Math.max(newIndex, 0), game.system.tedeum.config.diceValeur.length - 1) return game.system.tedeum.config.diceValeur[newIndex] } @@ -368,7 +376,8 @@ export class TeDeumUtility { static computeRollFormula(rollData, actor, isConfrontation = false) { let diceFormula = "" if (rollData.competence) { - let diceBase = this.modifyDice(rollData.carac.dice, rollData.bonusMalus+rollData.malusBlessures) + let diceBase = this.modifyDice(rollData.carac.dice, Number(rollData.bonusMalus)+rollData.santeModifier) + if (!diceBase) return; diceFormula = diceBase + "x + " + rollData.competence.system.score } if (rollData.enableProvidence) { @@ -386,8 +395,9 @@ export class TeDeumUtility { rollData.difficulty = 7 } rollData.difficulty = game.system.tedeum.config.difficulte[rollData.difficulty].value - let diceFormula = this.computeRollFormula(rollData, actor) + if (!diceFormula) return; + console.log("RollData", rollData, diceFormula ) // Performs roll let myRoll = await new Roll(diceFormula).roll() @@ -501,7 +511,7 @@ export class TeDeumUtility { /* -------------------------------------------- */ static getBasicRollData() { let rollData = { - rollId: randomID(16), + rollId: foundry.utils.randomID(16), type: "roll-data", rollMode: game.settings.get("core", "rollMode"), difficulty: "pardefaut", @@ -509,7 +519,7 @@ export class TeDeumUtility { isReroll : false, enableProvidence : false, malusBlessures: 0, - config: duplicate(game.system.tedeum.config) + config: foundry.utils.duplicate(game.system.tedeum.config) } TeDeumUtility.updateWithTarget(rollData) return rollData diff --git a/modules/data/tedeum-schema-arme.js b/modules/data/tedeum-schema-arme.js index 5a4d544..b10e883 100644 --- a/modules/data/tedeum-schema-arme.js +++ b/modules/data/tedeum-schema-arme.js @@ -48,7 +48,9 @@ export class TeDeumArmeSchema extends foundry.abstract.TypeDataModel { schema.prix = new fields.NumberField({ ...requiredDouble, initial: 0, min: 0 }); schema.monnaie = new fields.StringField({ required: true, blank: false, initial: "denier" }); - + + schema.equipe = new fields.BooleanField({initial: false}), + schema.description = new fields.HTMLField({ required: true, blank: true }); return schema; diff --git a/modules/data/tedeum-schema-armure.js b/modules/data/tedeum-schema-armure.js index 93e09d4..40eb0b9 100644 --- a/modules/data/tedeum-schema-armure.js +++ b/modules/data/tedeum-schema-armure.js @@ -19,6 +19,8 @@ export class TeDeumArmureSchema extends foundry.abstract.TypeDataModel { schema.prix = new fields.NumberField({ ...requiredDouble, initial: 0, min: 0 }); schema.monnaie = new fields.StringField({ required: true, blank: false, initial: "denier" }); + + schema.equipe = new fields.BooleanField({initial: false}), schema.description = new fields.HTMLField({ required: true, blank: true }); diff --git a/modules/data/tedeum-schema-blessure.js b/modules/data/tedeum-schema-blessure.js new file mode 100644 index 0000000..f88d55d --- /dev/null +++ b/modules/data/tedeum-schema-blessure.js @@ -0,0 +1,14 @@ +export class TeDeumBlessureSchema extends foundry.abstract.TypeDataModel { + static defineSchema() { + const fields = foundry.data.fields; + const requiredInteger = { required: true, nullable: false, integer: true }; + const schema = {}; + + schema.typeBlessure = new fields.StringField({required: true, choices: ["indemne", "estafilade", "plaie", "plaiebeante", "plaieatroce", "tuenet"], initial: "estafilade"}); + schema.localisation = new fields.StringField({required: true, choices: ["piedgauche", "pieddroit", "jambegauche", "jambedroite", "maingauche", "maindroite", "brasgauche", "brasdroit", "tete", "corps"], initial: "corps"}); + + schema.description = new fields.HTMLField({ required: true, blank: true }); + + return schema; + } +} \ No newline at end of file diff --git a/modules/data/tedeum-schema-maladie.js b/modules/data/tedeum-schema-maladie.js new file mode 100644 index 0000000..bc17435 --- /dev/null +++ b/modules/data/tedeum-schema-maladie.js @@ -0,0 +1,18 @@ +export class TeDeumMaladieSchema extends foundry.abstract.TypeDataModel { + static defineSchema() { + const fields = foundry.data.fields; + const requiredInteger = { required: true, nullable: false, integer: true }; + const schema = {}; + + schema.transmission = new fields.HTMLField({ required: true, blank: true }); + schema.difficulteEndurance = new fields.StringField({required:true, initial:"routine"}); + schema.virulence = new fields.StringField({required: true, choices: ["fatigue", "epuisement", "souffrance", "agonie"], initial: "fatigue"}); + schema.fievre = new fields.StringField({required: true, choices: ["aucune", "legere", "forte", "grave"], initial: "aucune"}); + schema.symptomes = new fields.HTMLField({ required: true, blank: true }); + schema.appliquee = new fields.BooleanField({initial: false}), + + schema.description = new fields.HTMLField({ required: true, blank: true }); + + return schema; + } +} \ No newline at end of file diff --git a/modules/data/tedeum-schema-pj.js b/modules/data/tedeum-schema-pj.js index c826f17..fbb212e 100644 --- a/modules/data/tedeum-schema-pj.js +++ b/modules/data/tedeum-schema-pj.js @@ -23,7 +23,9 @@ export class TeDeumPJSchema extends foundry.abstract.TypeDataModel { schema.localisation = new fields.SchemaField( Object.values(game.system.tedeum.config.LOCALISATION).reduce((obj, loc) => { - obj[loc.id] =new fields.SchemaField({ + obj[loc.id] = new fields.SchemaField({ + armure: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0, max: 20 }), + touche: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0, max: 20 }), blessures: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0, max: 20 }) }); return obj; diff --git a/modules/data/tedeum-schema-simple.js b/modules/data/tedeum-schema-simple.js new file mode 100644 index 0000000..6c4d882 --- /dev/null +++ b/modules/data/tedeum-schema-simple.js @@ -0,0 +1,20 @@ +export class TeDeumMaladieSchema extends foundry.abstract.TypeDataModel { + static defineSchema() { + const fields = foundry.data.fields; + const requiredInteger = { required: true, nullable: false, integer: true }; + const schema = {}; + + schema.difficulteEndurance = new fields.StringField({required:true, initial:"routine"}); + schema.virulence = new fields.StringField({required: true, choices: ["aucune", "nausee", "inflammation", "elancement", "convulsion", "mort"], initial: "fatigue"}); + schema.vertus = new fields.HTMLField({ required: true, blank: true }); + schema.toxicite = new fields.HTMLField({ required: true, blank: true }); + schema.appliquee = new fields.BooleanField({initial: false}), + + schema.prix = new fields.NumberField({ ...requiredDouble, initial: 0, min: 0 }); + schema.monnaie = new fields.StringField({ required: true, blank: false, initial: "denier" }); + + schema.description = new fields.HTMLField({ required: true, blank: true }); + + return schema; + } +} \ No newline at end of file diff --git a/modules/items/tedeum-item-sheet.js b/modules/items/tedeum-item-sheet.js index 3049333..8b7c90a 100644 --- a/modules/items/tedeum-item-sheet.js +++ b/modules/items/tedeum-item-sheet.js @@ -8,7 +8,7 @@ export class TeDeumItemSheet extends ItemSheet { /** @override */ static get defaultOptions() { - return mergeObject(super.defaultOptions, { + return foundry.utils.mergeObject(super.defaultOptions, { classes: ["fvtt-te-deum", "sheet", "item"], template: "systems/fvtt-te-deum/templates/item-sheet.hbs", dragDrop: [{ dragSelector: null, dropSelector: null }], diff --git a/modules/items/tedeum-item.js b/modules/items/tedeum-item.js index 4b6a318..4714071 100644 --- a/modules/items/tedeum-item.js +++ b/modules/items/tedeum-item.js @@ -7,6 +7,9 @@ export const defaultItemImg = { competence: "systems/fvtt-te-deum/images/icons/competence.webp", education: "systems/fvtt-te-deum/images/icons/education.webp", grace: "systems/fvtt-te-deum/images/icons/grace.webp", + blessure: "systems/fvtt-te-deum/images/icons/blessure.webp", + maladie: "systems/fvtt-te-deum/images/icons/maladie.webp", + simple: "systems/fvtt-te-deum/images/icons/simple.webp", } /** diff --git a/modules/tedeum-main.js b/modules/tedeum-main.js index 76e1bbc..940a1c2 100644 --- a/modules/tedeum-main.js +++ b/modules/tedeum-main.js @@ -19,6 +19,8 @@ import { TeDeumEquipementSchema } from "./data/tedeum-schema-equipement.js"; import { TeDeumOrigineSchema } from "./data/tedeum-schema-origine.js"; import { TeDeumEducationSchema } from "./data/tedeum-schema-education.js"; import { TeDeumGraceSchema } from "./data/tedeum-schema-grace.js"; +import { TeDeumBlessureSchema } from "./data/tedeum-schema-blessure.js"; +import { TeDeumMaladieSchema } from "./data/tedeum-schema-maladie.js"; import { TeDeumItem } from "./items/tedeum-item.js"; import { TeDeumItemSheet } from "./items/tedeum-item-sheet.js"; @@ -71,7 +73,9 @@ Hooks.once("init", async function () { armure: TeDeumArmureSchema, origine: TeDeumOrigineSchema, education: TeDeumEducationSchema, - grace: TeDeumGraceSchema + grace: TeDeumGraceSchema, + blessure: TeDeumBlessureSchema, + maladie: TeDeumMaladieSchema, }; console.log("TeDeum RPG | Ready"); diff --git a/packs/competences/000096.ldb b/packs/competences/000096.ldb deleted file mode 100644 index 65dda05..0000000 Binary files a/packs/competences/000096.ldb and /dev/null differ diff --git a/packs/competences/000121.ldb b/packs/competences/000121.ldb new file mode 100644 index 0000000..2012772 Binary files /dev/null and b/packs/competences/000121.ldb differ diff --git a/packs/competences/000107.log b/packs/competences/000148.log similarity index 100% rename from packs/competences/000107.log rename to packs/competences/000148.log diff --git a/packs/competences/CURRENT b/packs/competences/CURRENT index 2a5d251..ffd4a01 100644 --- a/packs/competences/CURRENT +++ b/packs/competences/CURRENT @@ -1 +1 @@ -MANIFEST-000105 +MANIFEST-000146 diff --git a/packs/competences/LOG b/packs/competences/LOG index 623db38..bd0b990 100644 --- a/packs/competences/LOG +++ b/packs/competences/LOG @@ -1,8 +1,8 @@ -2024/06/06-16:27:16.818495 7fcfb2a006c0 Recovering log #103 -2024/06/06-16:27:16.829929 7fcfb2a006c0 Delete type=3 #101 -2024/06/06-16:27:16.830004 7fcfb2a006c0 Delete type=0 #103 -2024/06/06-17:16:48.801172 7fcfb16006c0 Level-0 table #108: started -2024/06/06-17:16:48.801212 7fcfb16006c0 Level-0 table #108: 0 bytes OK -2024/06/06-17:16:48.838666 7fcfb16006c0 Delete type=0 #106 -2024/06/06-17:16:48.894707 7fcfb16006c0 Manual compaction at level-0 from '!folders!4OPhigzcPv46qbWW' @ 72057594037927935 : 1 .. '!items!zwC0H39ar5Pl1l92' @ 0 : 0; will stop at (end) -2024/06/06-17:16:48.894760 7fcfb16006c0 Manual compaction at level-1 from '!folders!4OPhigzcPv46qbWW' @ 72057594037927935 : 1 .. '!items!zwC0H39ar5Pl1l92' @ 0 : 0; will stop at (end) +2024/07/07-21:34:33.552483 7fdbf4c006c0 Recovering log #144 +2024/07/07-21:34:33.562583 7fdbf4c006c0 Delete type=3 #142 +2024/07/07-21:34:33.562681 7fdbf4c006c0 Delete type=0 #144 +2024/07/08-07:54:26.000826 7fdbefe006c0 Level-0 table #149: started +2024/07/08-07:54:26.000937 7fdbefe006c0 Level-0 table #149: 0 bytes OK +2024/07/08-07:54:26.043881 7fdbefe006c0 Delete type=0 #147 +2024/07/08-07:54:26.179609 7fdbefe006c0 Manual compaction at level-0 from '!folders!4OPhigzcPv46qbWW' @ 72057594037927935 : 1 .. '!items!zwC0H39ar5Pl1l92' @ 0 : 0; will stop at (end) +2024/07/08-07:54:26.179705 7fdbefe006c0 Manual compaction at level-1 from '!folders!4OPhigzcPv46qbWW' @ 72057594037927935 : 1 .. '!items!zwC0H39ar5Pl1l92' @ 0 : 0; will stop at (end) diff --git a/packs/competences/LOG.old b/packs/competences/LOG.old index dbb5ef9..70ad342 100644 --- a/packs/competences/LOG.old +++ b/packs/competences/LOG.old @@ -1,8 +1,8 @@ -2024/06/05-23:00:55.185946 7f1e64e006c0 Recovering log #99 -2024/06/05-23:00:55.196553 7f1e64e006c0 Delete type=3 #97 -2024/06/05-23:00:55.196655 7f1e64e006c0 Delete type=0 #99 -2024/06/05-23:35:36.332443 7f1e5da006c0 Level-0 table #104: started -2024/06/05-23:35:36.332474 7f1e5da006c0 Level-0 table #104: 0 bytes OK -2024/06/05-23:35:36.338443 7f1e5da006c0 Delete type=0 #102 -2024/06/05-23:35:36.338563 7f1e5da006c0 Manual compaction at level-0 from '!folders!4OPhigzcPv46qbWW' @ 72057594037927935 : 1 .. '!items!zwC0H39ar5Pl1l92' @ 0 : 0; will stop at (end) -2024/06/05-23:35:36.338586 7f1e5da006c0 Manual compaction at level-1 from '!folders!4OPhigzcPv46qbWW' @ 72057594037927935 : 1 .. '!items!zwC0H39ar5Pl1l92' @ 0 : 0; will stop at (end) +2024/07/07-13:46:28.434141 7fdbf6a006c0 Recovering log #140 +2024/07/07-13:46:28.444184 7fdbf6a006c0 Delete type=3 #138 +2024/07/07-13:46:28.444239 7fdbf6a006c0 Delete type=0 #140 +2024/07/07-16:48:21.944701 7fdbefe006c0 Level-0 table #145: started +2024/07/07-16:48:21.944735 7fdbefe006c0 Level-0 table #145: 0 bytes OK +2024/07/07-16:48:21.951284 7fdbefe006c0 Delete type=0 #143 +2024/07/07-16:48:21.964341 7fdbefe006c0 Manual compaction at level-0 from '!folders!4OPhigzcPv46qbWW' @ 72057594037927935 : 1 .. '!items!zwC0H39ar5Pl1l92' @ 0 : 0; will stop at (end) +2024/07/07-16:48:21.975753 7fdbefe006c0 Manual compaction at level-1 from '!folders!4OPhigzcPv46qbWW' @ 72057594037927935 : 1 .. '!items!zwC0H39ar5Pl1l92' @ 0 : 0; will stop at (end) diff --git a/packs/competences/MANIFEST-000105 b/packs/competences/MANIFEST-000105 deleted file mode 100644 index ccfedcf..0000000 Binary files a/packs/competences/MANIFEST-000105 and /dev/null differ diff --git a/packs/competences/MANIFEST-000146 b/packs/competences/MANIFEST-000146 new file mode 100644 index 0000000..bb6a40f Binary files /dev/null and b/packs/competences/MANIFEST-000146 differ diff --git a/packs/equipment/000168.log b/packs/equipment/000208.log similarity index 100% rename from packs/equipment/000168.log rename to packs/equipment/000208.log diff --git a/packs/equipment/CURRENT b/packs/equipment/CURRENT index 830373b..b04a015 100644 --- a/packs/equipment/CURRENT +++ b/packs/equipment/CURRENT @@ -1 +1 @@ -MANIFEST-000166 +MANIFEST-000206 diff --git a/packs/equipment/LOG b/packs/equipment/LOG index fd9fb9b..7bd2be0 100644 --- a/packs/equipment/LOG +++ b/packs/equipment/LOG @@ -1,7 +1,7 @@ -2024/06/06-16:27:16.805501 7fcfb8e006c0 Recovering log #164 -2024/06/06-16:27:16.816044 7fcfb8e006c0 Delete type=3 #162 -2024/06/06-16:27:16.816128 7fcfb8e006c0 Delete type=0 #164 -2024/06/06-17:16:48.641100 7fcfb16006c0 Level-0 table #169: started -2024/06/06-17:16:48.641163 7fcfb16006c0 Level-0 table #169: 0 bytes OK -2024/06/06-17:16:48.684021 7fcfb16006c0 Delete type=0 #167 -2024/06/06-17:16:48.684347 7fcfb16006c0 Manual compaction at level-0 from 'undefined' @ 72057594037927935 : 1 .. 'undefined' @ 0 : 0; will stop at (end) +2024/07/07-21:34:33.538979 7fdbf60006c0 Recovering log #204 +2024/07/07-21:34:33.549574 7fdbf60006c0 Delete type=3 #202 +2024/07/07-21:34:33.549666 7fdbf60006c0 Delete type=0 #204 +2024/07/08-07:54:26.137628 7fdbefe006c0 Level-0 table #209: started +2024/07/08-07:54:26.137703 7fdbefe006c0 Level-0 table #209: 0 bytes OK +2024/07/08-07:54:26.179305 7fdbefe006c0 Delete type=0 #207 +2024/07/08-07:54:26.179685 7fdbefe006c0 Manual compaction at level-0 from 'undefined' @ 72057594037927935 : 1 .. 'undefined' @ 0 : 0; will stop at (end) diff --git a/packs/equipment/LOG.old b/packs/equipment/LOG.old index 2425f32..3c0f9e0 100644 --- a/packs/equipment/LOG.old +++ b/packs/equipment/LOG.old @@ -1,7 +1,7 @@ -2024/06/05-23:00:55.173863 7f1e5ea006c0 Recovering log #160 -2024/06/05-23:00:55.183501 7f1e5ea006c0 Delete type=3 #158 -2024/06/05-23:00:55.183581 7f1e5ea006c0 Delete type=0 #160 -2024/06/05-23:35:36.305356 7f1e5da006c0 Level-0 table #165: started -2024/06/05-23:35:36.305385 7f1e5da006c0 Level-0 table #165: 0 bytes OK -2024/06/05-23:35:36.311763 7f1e5da006c0 Delete type=0 #163 -2024/06/05-23:35:36.321710 7f1e5da006c0 Manual compaction at level-0 from 'undefined' @ 72057594037927935 : 1 .. 'undefined' @ 0 : 0; will stop at (end) +2024/07/07-13:46:28.422245 7fdbf56006c0 Recovering log #200 +2024/07/07-13:46:28.431962 7fdbf56006c0 Delete type=3 #198 +2024/07/07-13:46:28.432013 7fdbf56006c0 Delete type=0 #200 +2024/07/07-16:48:21.951406 7fdbefe006c0 Level-0 table #205: started +2024/07/07-16:48:21.951432 7fdbefe006c0 Level-0 table #205: 0 bytes OK +2024/07/07-16:48:21.957697 7fdbefe006c0 Delete type=0 #203 +2024/07/07-16:48:21.964354 7fdbefe006c0 Manual compaction at level-0 from 'undefined' @ 72057594037927935 : 1 .. 'undefined' @ 0 : 0; will stop at (end) diff --git a/packs/equipment/MANIFEST-000166 b/packs/equipment/MANIFEST-000166 deleted file mode 100644 index 67b6770..0000000 Binary files a/packs/equipment/MANIFEST-000166 and /dev/null differ diff --git a/packs/equipment/MANIFEST-000206 b/packs/equipment/MANIFEST-000206 new file mode 100644 index 0000000..1beaaea Binary files /dev/null and b/packs/equipment/MANIFEST-000206 differ diff --git a/postcss/tedeum.css b/postcss/tedeum.css index ed6a86e..4928fa6 100644 --- a/postcss/tedeum.css +++ b/postcss/tedeum.css @@ -493,7 +493,7 @@ ul, li { flex: 1 1 5rem; } .list-item-shadow { - background: rgba(87, 60, 32, 0.35); + background: rgba(170, 168, 167, 0.35); flex-grow: 0; flex-wrap: nowrap; justify-content: flex-start; @@ -1205,3 +1205,34 @@ ul, li { align-items: center; justify-content: center; } +.corps-combat-block { + position: relative; + width: 600px; + height: 600px; +} +.silhouette-combat-picture { + width: 250px; + max-width: 250px; + border: 0; +} +.silhouette-combat-block { + position: absolute; + background: white; + border-color: darkgray; + border-style: ridge; + border: 1; + width: 180px; + height: 84px; + margin: 0 auto; + font-size: 0.8rem; + align-self: center; +} +.silhouette-combat-space { + width: 60px; + min-width: 60px; +} +.center-content { + display: flex; + justify-content: center; + align-items: center; +} \ No newline at end of file diff --git a/styles/tedeum.css b/styles/tedeum.css index 98c0beb..827d7e5 100644 --- a/styles/tedeum.css +++ b/styles/tedeum.css @@ -455,7 +455,7 @@ ul, li { flex: 1 1 5rem; } .list-item-shadow { - background: rgba(87, 60, 32, 0.35); + background: rgba(170, 168, 167, 0.35); flex-grow: 0; flex-wrap: nowrap; justify-content: flex-start; @@ -1133,3 +1133,34 @@ ul, li { align-items: center; justify-content: center; } +.corps-combat-block { + position: relative; + width: 600px; + height: 600px; +} +.silhouette-combat-picture { + width: 250px; + max-width: 250px; + border: 0; +} +.silhouette-combat-block { + position: absolute; + background: white; + border-color: darkgray; + border-style: ridge; + border: 1; + width: 180px; + height: 84px; + margin: 0 auto; + font-size: 0.8rem; + align-self: center; +} +.silhouette-combat-space { + width: 60px; + min-width: 60px; +} +.center-content { + display: flex; + justify-content: center; + align-items: center; +} \ No newline at end of file diff --git a/template.json b/template.json index 62678a0..bb34255 100644 --- a/template.json +++ b/template.json @@ -6,8 +6,10 @@ "pnj": {} }, "Item": { - "types": ["arme", "competence", "armure", "grace", "equipement", "origine", "education"], - "htmlFields": ["description"], + "types": ["arme", "competence", "armure", "grace", "equipement", "origine", "education", "blessure", "maladie", "simple"], + "htmlFields": ["description", "transmission", "symptomes", "vertus", "toxicité"], + "blessure": {}, + "maladie": {}, "arme": {}, "competence": {}, "armure": {}, diff --git a/templates/actors/actor-sheet.hbs b/templates/actors/actor-sheet.hbs index fcb93dd..96093f4 100644 --- a/templates/actors/actor-sheet.hbs +++ b/templates/actors/actor-sheet.hbs @@ -36,62 +36,147 @@ {{!-- Skills Tab --}}
- +
- + +
    - {{#each caracList as |char key|}} + {{#each caracList as |char key|}}
  • - - + {{selectOptions @root.config.descriptionValeur selected=char.value labelAttr="valeur"}} - - + +
  • - {{/each}} + {{/each}}
+ +
+

Malus de santé : {{santeModifier}} niveaux

+
+ +
    +
  • + +

    +
    +
  • + {{#each blessures as |blessure key|}} +
  • + + + {{blessure.name}} + + + {{getConfigLabel "blessures" blessure.system.typeBlessure}} + + + {{getConfigLabel "LOCALISATION" blessure.system.localisation}} + + + {{blessure.malus}} + +
     
    +
    + + +
    +
  • + {{/each}} +
+ + {{#if (or (count maladies) (count poisons))}} +
    +
  • + +

    +
    +
  • + {{#each maladies as |maladie key|}} +
  • + + + {{maladie.name}} + + + {{maladie.malus}} + +
     
    +
    + + +
    +
  • + {{/each}} + {{#each poisons as |poison key|}} +
  • + + + {{poison.name}} + + + {{poison.malus}} + +
     
    +
    + + +
    +
  • + {{/each}} + +
+ {{/if}} + +
  • - + - - + +
  • - + - - + +
    -
  • - -

    -
    -
  • - {{#each graces as |grace key|}} -
  • - - +
  • + +

    +
    +
  • + {{#each graces as |grace key|}} +
  • + + {{grace.name}} - -
     
    -
    - - -
    -
  • - {{/each}} -
+ +
 
+
+ + +
+ + {{/each}} +
@@ -101,26 +186,26 @@
{{#each arbreCompetences as |carac key|}} -
@@ -151,7 +236,7 @@ - + {{arme.name}} @@ -191,6 +276,28 @@ {{/each}} +
+
+ +
+ + + {{#each combat as |loc key|}} +
+

{{loc.score.min}}-{{loc.score.max}}. {{loc.label}}

+
+ {{#each loc.armures as |armure idx| }} + {{armure.name}} ({{armure.system.protection}}) + {{/each}} + Touché : {{touche}} + Blessures : {{blessuresTete}} +
+
+ {{/each}} + +
+
+
@@ -214,7 +321,8 @@
 
- +
diff --git a/templates/chat/chat-generic-result.hbs b/templates/chat/chat-generic-result.hbs index cc98f20..f1050b4 100644 --- a/templates/chat/chat-generic-result.hbs +++ b/templates/chat/chat-generic-result.hbs @@ -27,6 +27,9 @@ {{#if bonusMalus}}
  • Bonus/Malus: {{bonusMalus}}
  • {{/if}} + {{#if santeModifier}} +
  • Santé: {{santeModifier}} niveaux
  • + {{/if}} {{#if enableProvidence}}
  • Un niveau de Providence a été utilisé !
  • {{/if}} diff --git a/templates/dialogs/roll-dialog-generic.hbs b/templates/dialogs/roll-dialog-generic.hbs index d0455d5..f2f3edc 100644 --- a/templates/dialogs/roll-dialog-generic.hbs +++ b/templates/dialogs/roll-dialog-generic.hbs @@ -19,10 +19,10 @@ {{/if}} - {{#if malusBlessures}} + {{#if santeModifier}}
    Malus Blessures - {{malusBlessures}} niveaux + {{santeModifier}} niveaux
    {{/if}} diff --git a/templates/items/item-arme-sheet.hbs b/templates/items/item-arme-sheet.hbs index b588513..41d9aa0 100644 --- a/templates/items/item-arme-sheet.hbs +++ b/templates/items/item-arme-sheet.hbs @@ -85,6 +85,12 @@ {{/each}}

    Autres

    + +
  • + + +
  • +
  • +
  • + + +
  • +
  • +
    + +
    +

    +
    +
    + + {{> systems/fvtt-te-deum/templates/items/partial-item-nav.hbs}} + + + {{!-- Sheet Body --}} +
    + + {{> systems/fvtt-te-deum/templates/items/partial-item-description.hbs}} + +
    + +
      +
    • + + +
    • +
    • + + +
    • +
    + +
    + + +
    + \ No newline at end of file diff --git a/templates/items/item-maladie-sheet.hbs b/templates/items/item-maladie-sheet.hbs new file mode 100644 index 0000000..04015d1 --- /dev/null +++ b/templates/items/item-maladie-sheet.hbs @@ -0,0 +1,59 @@ +
    +
    + +
    +

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

    Transmission

    + + +

    Symptômes

    + + +
      +
    • + + +
    • +
    • + + +
    • +
    • + + +
    • +
    • + + +
    • + +
    + +
    + + +
    +
    \ No newline at end of file diff --git a/templates/items/item-simple-sheet.hbs b/templates/items/item-simple-sheet.hbs new file mode 100644 index 0000000..5b01864 --- /dev/null +++ b/templates/items/item-simple-sheet.hbs @@ -0,0 +1,62 @@ +
    +
    + +
    +

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

    Vertus médicinales

    + + +

    Toxicité

    + + +
      +
    • + + +
    • +
    • + + +
    • +
    • + + +
    • + +
    • + + + +
    • + +
    + +
    + + +
    +
    \ No newline at end of file