From 051d9ca943201ede2a12fbc0de2eeb69285c004b Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Fri, 3 Feb 2023 17:45:15 +0100 Subject: [PATCH] Minot fixes + archetype --- README.md | 31 ++++ modules/malefices-actor-sheet.js | 1 + modules/malefices-actor.js | 9 +- modules/malefices-item-sheet.js | 4 + modules/malefices-main.js | 5 +- modules/malefices-utility.js | 213 +---------------------- styles/simple.css | 20 ++- system.json | 4 +- template.json | 4 + templates/actors/actor-sheet.hbs | 63 ++++--- templates/items/item-archetype-sheet.hbs | 37 ++++ 11 files changed, 152 insertions(+), 239 deletions(-) create mode 100644 README.md create mode 100644 templates/items/item-archetype-sheet.hbs diff --git a/README.md b/README.md new file mode 100644 index 0000000..5587823 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# Système Foundry pour Maléfices (French RPG, Arkhane Asylum Publishing) + +## EN + +Unofficial system for Maléfices v4 (French version from Arkhane Asylum Publishing). + +This system has been approved by Arkhane Asylum Publishing ( https://arkhane-asylum.fr ), thanks ! +The Tarot assets, as well as other graphical elements has been provide by Arkhane Asylum. + +Books are mandatory to play and are available at : https://arkhane-asylum.fr/en/malefices + +## FR + +Système non-officiel pour le JDR Maléfices, version 4 (Arkhane Asylum Publishing). + +Ce système a été autorisé par le Arkhane Asylum Publishing ( https://arkhane-asylum.fr ), merci à eux ! +Les images du Tarot et autres éléments graphiques ont été fournis par Arkhane Asylum. + +Les livres du jeu sont nécessaires pour jouer, et sont disponibles ici : https://arkhane-asylum.fr/fr/malefices + +# Credits + +Maléfices, le jeu de rôle qui sent le souffre, is a property of Arkhane Asylum Publishing. + +# Developmement + +LeRatierBretonnien + +# Tests, icones et saisie des données + +Dame du Lac, Malik \ No newline at end of file diff --git a/modules/malefices-actor-sheet.js b/modules/malefices-actor-sheet.js index 58e373b..b8775e6 100644 --- a/modules/malefices-actor-sheet.js +++ b/modules/malefices-actor-sheet.js @@ -37,6 +37,7 @@ export class MaleficesActorSheet extends ActorSheet { limited: this.object.limited, armes: duplicate(this.actor.getArmes()), tarots: duplicate(this.actor.getTarots()), + archetype: duplicate(this.actor.getArchetype()), equipements: duplicate(this.actor.getEquipements()), subActors: duplicate(this.actor.getSubActors()), phyMalus: this.actor.getPhysiqueMalus(), diff --git a/modules/malefices-actor.js b/modules/malefices-actor.js index 5fe0f0b..80f2656 100644 --- a/modules/malefices-actor.js +++ b/modules/malefices-actor.js @@ -86,7 +86,14 @@ export class MaleficesActor extends Actor { MaleficesUtility.sortArrayObjectsByName(comp) return comp; } - + getArchetype() { + let comp = duplicate(this.items.find(item => item.type == 'archetype') || {name: "Pas d'archetype"}) + if (comp) { + comp.tarot = MaleficesUtility.getTarot(comp.system.lametutelaire) + } + + return comp; + } /* -------------------------------------------- */ getTarots() { let comp = duplicate(this.items.filter(item => item.type == 'tarot') || []) diff --git a/modules/malefices-item-sheet.js b/modules/malefices-item-sheet.js index 8586ca5..d3e3569 100644 --- a/modules/malefices-item-sheet.js +++ b/modules/malefices-item-sheet.js @@ -67,6 +67,10 @@ export class MaleficesItemSheet extends ItemSheet { isGM: game.user.isGM } + if ( this.object.type == "archetype") { + formData.tarots = MaleficesUtility.getTarots() + } + this.options.editable = !(this.object.origin == "embeddedItem"); console.log("ITEM DATA", formData, this); return formData; diff --git a/modules/malefices-main.js b/modules/malefices-main.js index 14a3484..1aea5b5 100644 --- a/modules/malefices-main.js +++ b/modules/malefices-main.js @@ -71,8 +71,11 @@ function welcomeMessage() { ChatMessage.create({ user: game.user.id, whisper: [game.user.id], - content: `
+ content: `
Bienvenu dans Malefices, le JDR qui sent le souffre ! +

Le Livre de Base de Maléfices v4 est nécessaire pour jouer : https://arkhane-asylum.fr/en/malefices/

+

Maléfices et un jeu de rôle publié par Arkhane Asylum Publishing, tout les droits leur appartiennent.

+

Système développé par LeRatierBretonnien avec l'aide de la Dame du Lac et Malik, support sur le Discord FR de Foundry.

` }); } diff --git a/modules/malefices-utility.js b/modules/malefices-utility.js index 0c652a1..164194c 100644 --- a/modules/malefices-utility.js +++ b/modules/malefices-utility.js @@ -53,54 +53,17 @@ export class MaleficesUtility { } /*-------------------------------------------- */ - static getSkills() { - return duplicate(this.skills) + static getTarots() { + return duplicate(this.tarots) } - /*-------------------------------------------- */ - static getWeaponSkills() { - return duplicate(this.weaponSkills) - } - /*-------------------------------------------- */ - static getShieldSkills() { - return duplicate(this.shieldSkills) - } - - /* -------------------------------------------- */ - static isModuleItemAllowed(type) { - return __ALLOWED_MODULE_TYPES[type] - } - - /* -------------------------------------------- */ - static buildBonusList() { - let bonusList = [] - for (let key in game.system.model.Actor.character.bonus) { - let bonuses = game.system.model.Actor.character.bonus[key] - for (let bonus in bonuses) { - bonusList.push(key + "." + bonus) - } - } - for (let key in game.system.model.Actor.character.attributes) { - let attrs = game.system.model.Actor.character.attributes[key] - for (let skillKey in attrs.skills) { - bonusList.push(key + ".skills." + skillKey + ".modifier") - } - } - for (let key in game.system.model.Actor.character.universal.skills) { - bonusList.push("universal.skills." + key + ".modifier") - } - return bonusList + static getTarot(tId) { + return this.tarots.find(t => t._id == tId) } /* -------------------------------------------- */ static async ready() { - const skills = await MaleficesUtility.loadCompendium("fvtt-malefices.skills") - this.skills = skills.map(i => i.toObject()) - this.weaponSkills = duplicate(this.skills.filter(item => item.system.isweaponskill)) - this.shieldSkills = duplicate(this.skills.filter(item => item.system.isshieldskill)) - - const rollTables = await MaleficesUtility.loadCompendium("fvtt-malefices.rolltables") - this.rollTables = rollTables.map(i => i.toObject()) - + const tarots = await MaleficesUtility.loadCompendium("fvtt-malefices.malefices-tarots") + this.tarots = tarots.map(i => i.toObject()) } /* -------------------------------------------- */ @@ -218,145 +181,6 @@ export class MaleficesUtility { let newRollData = mergeObject(oldRollData, rollData) this.rollDataStore[id] = newRollData } - /* -------------------------------------------- */ - static saveRollData(rollData) { - game.socket.emit("system.fvtt-malefices", { - name: "msg_update_roll", data: rollData - }); // Notify all other clients of the roll - this.updateRollData(rollData) - } - - /* -------------------------------------------- */ - static getRollData(id) { - return this.rollDataStore[id] - } - - /* -------------------------------------------- */ - static async displayDefenseMessage(rollData) { - if (rollData.mode == "weapon" && rollData.defenderTokenId) { - let defender = game.canvas.tokens.get(rollData.defenderTokenId).actor - if (game.user.isGM || (game.user.character && game.user.character.id == defender.id)) { - rollData.defender = defender - rollData.defenderWeapons = defender.getEquippedWeapons() - rollData.isRangedAttack = rollData.weapon?.system.isranged - this.createChatWithRollMode(defender.name, { - name: defender.name, - alias: defender.name, - //user: defender.id, - content: await renderTemplate(`systems/fvtt-malefices/templates/chat-request-defense.html`, rollData), - whisper: [defender.id].concat(ChatMessage.getWhisperRecipients('GM')), - }) - } - } - } - - /* -------------------------------------------- */ - static getSuccessResult(rollData) { - if (rollData.sumSuccess <= -3) { - if (rollData.attackRollData.weapon.system.isranged) { - return { result: "miss", fumble: true, hpLossType: "melee" } - } else { - return { result: "miss", fumble: true, attackerHPLoss: "2d3", hpLossType: "melee" } - } - } - if (rollData.sumSuccess == -2) { - if (rollData.attackRollData.weapon.system.isranged) { - return { result: "miss", dangerous_fumble: true } - } else { - return { result: "miss", dangerous_fumble: true, attackerHPLoss: "1d3", hpLossType: "melee" } - } - } - if (rollData.sumSuccess == -1) { - return { result: "miss" } - } - if (rollData.sumSuccess == 0) { - if (rollData.attackRollData.weapon.system.isranged) { - return { result: "target_space", aoe: true } - } else { - return { result: "clash", hack_vs_shields: true } - } - } - if (rollData.sumSuccess == 1) { - return { result: "hit", defenderDamage: "1", entangle: true, knockback: true } - } - if (rollData.sumSuccess == 2) { - return { result: "hit", defenderDamage: "2", critical_1: true, entangle: true, knockback: true, penetrating_impale: true, hack_armors: true } - } - if (rollData.sumSuccess >= 3) { - return { result: "hit", defenderDamage: "3", critical_2: true, entangle: true, knockback: true, penetrating_impale: true, hack_armors: true } - } - } - - /* -------------------------------------------- */ - static async getFumble(weapon) { - const pack = game.packs.get("fvtt-malefices.rolltables") - const index = await pack.getIndex() - let entry - - if (weapon.isranged) { - entry = index.find(e => e.name === "Fumble! (ranged)") - } - if (!weapon.isranged) { - entry = index.find(e => e.name === "Fumble! (melee)") - } - let table = await pack.getDocument(entry._id) - const draw = await table.draw({ displayChat: false, rollMode: "gmroll" }) - return draw.results.length > 0 ? draw.results[0] : undefined - } - - /* -------------------------------------------- */ - static async processSuccessResult(rollData) { - if (game.user.isGM) { // Only GM process this - let result = rollData.successDetails - let attacker = game.actors.get(rollData.actorId) - let defender = game.canvas.tokens.get(rollData.attackRollData.defenderTokenId).actor - - if (attacker && result.attackerHPLoss) { - result.attackerHPLossValue = await attacker.incDecHP("-" + result.attackerHPLoss) - } - if (attacker && defender && result.defenderDamage) { - let dmgDice = (rollData.attackRollData.weapon.system.isranged) ? "d6" : "d8" - result.damageWeaponFormula = result.defenderDamage + dmgDice - result.defenderHPLossValue = await defender.incDecHP("-" + result.damageWeaponFormula) - } - if (result.fumble || (result.dangerous_fumble && MaleficesUtility.isWeaponDangerous(rollData.attackRollData.weapon))) { - result.fumbleDetails = await this.getFumble(rollData.weapon) - } - if (result.critical_1 || result.critical_2) { - let isDeadly = MaleficesUtility.isWeaponDeadly(rollData.attackRollData.weapon) - result.critical = await this.getCritical((result.critical_1) ? "I" : "II", rollData.attackRollData.weapon) - result.criticalText = result.critical.text - } - this.createChatWithRollMode(rollData.alias, { - content: await renderTemplate(`systems/fvtt-malefices/templates/chat-attack-defense-result.html`, rollData) - }) - console.log("Results processed", rollData) - } - } - - /* -------------------------------------------- */ - static async processAttackDefense(rollData) { - if (rollData.attackRollData) { - //console.log("Defender token, ", rollData, rollData.defenderTokenId) - let defender = game.canvas.tokens.get(rollData.attackRollData.defenderTokenId).actor - let sumSuccess = rollData.attackRollData.nbSuccess - rollData.nbSuccess - if (sumSuccess > 0) { - let armorResult = await defender.rollArmorDie(rollData) - rollData.armorResult = armorResult - sumSuccess += rollData.armorResult.nbSuccess - if (sumSuccess < 0) { // Never below 0 - sumSuccess = 0 - } - } - rollData.sumSuccess = sumSuccess - rollData.successDetails = this.getSuccessResult(rollData) - if (game.user.isGM) { - this.processSuccessResult(rollData) - } else { - game.socket.emit("system.fvtt-malefices", { msg: "msg_gm_process_attack_defense", data: rollData }); - } - } - } /* -------------------------------------------- */ static async onSocketMesssage(msg) { @@ -379,18 +203,6 @@ export class MaleficesUtility { } } - /* -------------------------------------------- */ - static computeFocusData(focus) { - let focusData = { - focusPoints: __focusCore[focus.core] + __focusPointTreatment[focus.treatment], - burnChance: __burnChanceTreatment[focus.treatment], - focusRegen: __focusRegenBond[focus.bond], - spellAttackBonus: __bonusSpellAttackBond[focus.bond], - spellDamageBonus: __bonusSpellDamageBond[focus.bond] - } - return focusData - } - /* -------------------------------------------- */ static async searchItem(dataItem) { let item @@ -404,19 +216,6 @@ export class MaleficesUtility { return item } - /* -------------------------------------------- */ - static getSpellCost(spell) { - return __spellCost[spell.system.level] - } - - /* -------------------------------------------- */ - static getArmorPenalty(item) { - if (item && (item.type == "shield" || item.type == "armor")) { - return __armorPenalties[item.system.category] - } - return {} - } - /* -------------------------------------------- */ static chatDataSetup(content, modeOverride, isRoll = false, forceWhisper) { let chatData = { diff --git a/styles/simple.css b/styles/simple.css index 45b3638..e0f44f8 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -786,8 +786,11 @@ ul, li { /* Sidebar CSS */ #sidebar { font-size: 1rem; - background-position: 100%; - background: url("../images/ui/background_01.webp"); + /*background-position: 100%;*/ + background-color:#f5f5f5; + background-position: 0px 35px; + background-repeat: no-repeat; + background-image: url("../images/ui/background_01.webp"); color: rgba(19, 18, 18, 0.95); } @@ -1229,11 +1232,19 @@ ul, li { min-width: 10rem; } .item-name-label-long { + margin-top: 4px; flex-grow:2; - max-width: 12rem; - min-width: 12rem; + max-width: 10rem; + min-width: 10rem; +} +.item-name-label-medium { + margin-top: 4px; + flex-grow:2; + max-width: 6rem; + min-width: 6rem; } .item-name-label-long2 { + margin-top: 4px; flex-grow:2; max-width: 22rem; min-width: 22rem; @@ -1259,7 +1270,6 @@ ul, li { min-width: 6.8rem; } .item-field-label-long { - margin-top: 4px; flex-grow:1; max-width: 10rem; min-width: 10rem; diff --git a/system.json b/system.json index b58fcec..594826d 100644 --- a/system.json +++ b/system.json @@ -55,7 +55,7 @@ ], "title": "Maléfices, le Jeu de Rôle", "url": "https://www.uberwald.me/gitea/public/fvtt-malefices", - "version": "10.0.7", - "download": "https://www.uberwald.me/gitea/public/fvtt-malefices/archive/fvtt-malefices-v10.0.7.zip", + "version": "10.0.8", + "download": "https://www.uberwald.me/gitea/public/fvtt-malefices/archive/fvtt-malefices-v10.0.8.zip", "background": "systems/fvtt-malefices/images/ui/malefice_welcome_page.webp" } \ No newline at end of file diff --git a/template.json b/template.json index dffdb4d..0fb211a 100644 --- a/template.json +++ b/template.json @@ -98,6 +98,7 @@ "types": [ "arme", "equipement", + "archetype", "tarot" ], "templates": {}, @@ -109,6 +110,9 @@ "isreversed": false, "description": "" }, + "archetype": { + "lametutelaire": "" + }, "arme": { "armetype": 0, "porteecourte": "", diff --git a/templates/actors/actor-sheet.hbs b/templates/actors/actor-sheet.hbs index 9064253..a45c9c2 100644 --- a/templates/actors/actor-sheet.hbs +++ b/templates/actors/actor-sheet.hbs @@ -8,7 +8,17 @@

-
+
+
    +
  • + + +
  • +
  • + + +
  • +
@@ -43,7 +53,7 @@ {{#each system.attributs as |attr key|}}
  • - {{attr.label}} + {{attr.label}} {{#if attr.hasmax}} @@ -163,60 +173,67 @@ {{!-- Biography Tab --}}
    +
    +
      +
    • + + + {{archetype.name}} + + {{archetype.tarot.name}} +
      + +
      +
    • +
    +
    +
    • - +
    • - +
    • - +
    • - +
    • - +
    • -
    • - - -
      -
    • - - -
    • - - -
    • -
    • - +
    • - +
    • - + + +
    • +
    • +
    • - +
    diff --git a/templates/items/item-archetype-sheet.hbs b/templates/items/item-archetype-sheet.hbs new file mode 100644 index 0000000..7d763a5 --- /dev/null +++ b/templates/items/item-archetype-sheet.hbs @@ -0,0 +1,37 @@ +
    +
    + +
    +

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