diff --git a/assets/icons/gemme_bleue.webp b/assets/icons/gemme_bleue.webp new file mode 100644 index 0000000..adb6cf2 Binary files /dev/null and b/assets/icons/gemme_bleue.webp differ diff --git a/assets/icons/gemme_noire.webp b/assets/icons/gemme_noire.webp new file mode 100644 index 0000000..1bd1a43 Binary files /dev/null and b/assets/icons/gemme_noire.webp differ diff --git a/assets/icons/gemme_rouge.webp b/assets/icons/gemme_rouge.webp new file mode 100644 index 0000000..ec0db13 Binary files /dev/null and b/assets/icons/gemme_rouge.webp differ diff --git a/assets/logos/logo_pause_hawkmoon_beige.webp b/assets/logos/logo_pause_hawkmoon_beige.webp new file mode 100644 index 0000000..68f5459 Binary files /dev/null and b/assets/logos/logo_pause_hawkmoon_beige.webp differ diff --git a/assets/logos/logo_pause_hawkmoon_rouge.webp b/assets/logos/logo_pause_hawkmoon_rouge.webp new file mode 100644 index 0000000..bc45ad2 Binary files /dev/null and b/assets/logos/logo_pause_hawkmoon_rouge.webp differ diff --git a/assets/logos/logo_pause_hawkmoon_stone.webp b/assets/logos/logo_pause_hawkmoon_stone.webp new file mode 100644 index 0000000..e9094e6 Binary files /dev/null and b/assets/logos/logo_pause_hawkmoon_stone.webp differ diff --git a/assets/logos/logo_pause_hawkmoon_violet.webp b/assets/logos/logo_pause_hawkmoon_violet.webp new file mode 100644 index 0000000..cd782b1 Binary files /dev/null and b/assets/logos/logo_pause_hawkmoon_violet.webp differ diff --git a/assets/logos/logo_pause_resistance.webp b/assets/logos/logo_pause_resistance.webp new file mode 100644 index 0000000..f52f769 Binary files /dev/null and b/assets/logos/logo_pause_resistance.webp differ diff --git a/modules/hawkmoon-actor-sheet.js b/modules/hawkmoon-actor-sheet.js index cb44bcb..87828f0 100644 --- a/modules/hawkmoon-actor-sheet.js +++ b/modules/hawkmoon-actor-sheet.js @@ -43,6 +43,7 @@ export class HawkmoonActorSheet extends ActorSheet { protections: duplicate(this.actor.getArmors()), historique: duplicate(this.actor.getHistorique() || {}), talents: duplicate(this.actor.getTalents() || {}), + talentsCell: this.getCelluleTalents(), profils: duplicate(this.actor.getProfils() || {}), combat: this.actor.getCombatValues(), equipements: duplicate(this.actor.getEquipments()), @@ -58,7 +59,20 @@ export class HawkmoonActorSheet extends ActorSheet { return formData; } - + /* -------------------------------------------- */ + getCelluleTalents( ) { + let talents = [] + for(let cellule of game.actors) { + if (cellule.type == "cellule") { + let found = cellule.system.members.find( it => it.id == this.actor.id) + if (found) { + talents = talents.concat( cellule.getTalents() ) + } + } + } + return talents + } + /* -------------------------------------------- */ /** @override */ activateListeners(html) { @@ -105,10 +119,14 @@ export class HawkmoonActorSheet extends ActorSheet { this.actor.incDecQuantity( li.data("item-id"), +1 ); } ); + html.find('.roll-initiative').click((event) => { + this.actor.rollAttribut("pre", 1) + }) + html.find('.roll-attribut').click((event) => { const li = $(event.currentTarget).parents(".item") let attrKey = li.data("attr-key") - this.actor.rollAttribut(attrKey) + this.actor.rollAttribut(attrKey, 2) }) html.find('.roll-competence').click((event) => { const li = $(event.currentTarget).parents(".item") diff --git a/modules/hawkmoon-actor.js b/modules/hawkmoon-actor.js index b31a1a2..139aad1 100644 --- a/modules/hawkmoon-actor.js +++ b/modules/hawkmoon-actor.js @@ -82,7 +82,18 @@ export class HawkmoonActor extends Actor { return armes } - /* -------------------------------------------- */ + /* ----------------------- --------------------- */ + addMember( actorId) { + let members = duplicate(this.system.members) + members.push( {id: actorId} ) + this.update ({'system.members': members}) + } + async removeMember(actorId) { + let members = this.system.members.filter(it => it.id != actorId ) + this.update ({'system.members': members}) + } + + /* ----------------------- --------------------- */ getEquipments() { return this.items.filter(item => item.type == "equipement") } @@ -99,6 +110,12 @@ export class HawkmoonActor extends Actor { getTalents() { return this.items.filter(item => item.type == "talent") } + getRessources() { + return this.items.filter(item => item.type == "ressource") + } + getContacts() { + return this.items.filter(item => item.type == "contact") + } /* -------------------------------------------- */ getSkills() { let comp = [] @@ -396,16 +413,13 @@ export class HawkmoonActor extends Actor { } /* -------------------------------------------- */ getBestDefenseValue() { - let defenseList = this.items.filter(item => (item.type == "arme" || item.type == "bouclier") && item.system.equipped) + let defenseList = this.items.filter(item => (item.type == "arme") && item.system.equipped) let maxDef = 0 let bestArme for (let arme of defenseList) { - if (arme.type == "arme" && arme.system.isdefense) { + if (arme.type == "arme" ) { arme = this.prepareArme(arme) } - if (arme.type == "bouclier") { - arme = this.prepareBouclier(arme) - } if (arme.system.totalDefensif > maxDef) { maxDef = arme.system.totalDefensif bestArme = duplicate(arme) @@ -470,8 +484,9 @@ export class HawkmoonActor extends Actor { } /* -------------------------------------------- */ - async rollAttribut(attrKey) { + async rollAttribut(attrKey, multiplier = 1) { let rollData = this.getCommonRollData(attrKey) + rollData.multiplier = multiplier let rollDialog = await HawkmoonRollDialog.create(this, rollData) rollDialog.render(true) } @@ -479,6 +494,7 @@ export class HawkmoonActor extends Actor { /* -------------------------------------------- */ async rollCompetence(attrKey, compId) { let rollData = this.getCommonRollData(attrKey, compId) + rollData.multiplier = 1 // Attr multiplier, always 1 in competence mode console.log("RollDatra", rollData) let rollDialog = await HawkmoonRollDialog.create(this, rollData) rollDialog.render(true) diff --git a/modules/hawkmoon-cellule-sheet.js b/modules/hawkmoon-cellule-sheet.js new file mode 100644 index 0000000..050c7f1 --- /dev/null +++ b/modules/hawkmoon-cellule-sheet.js @@ -0,0 +1,165 @@ +/** + * Extend the basic ActorSheet with some very simple modifications + * @extends {ActorSheet} + */ + +import { HawkmoonUtility } from "./hawkmoon-utility.js"; +import { HawkmoonAutomation } from "./hawkmoon-automation.js"; + +/* -------------------------------------------- */ +const __ALLOWED_ITEM_CELLULE = { "talent": 1, "ressource": 1, "contact": 1} + +/* -------------------------------------------- */ +export class HawkmoonCelluleSheet extends ActorSheet { + + /** @override */ + static get defaultOptions() { + + return mergeObject(super.defaultOptions, { + classes: ["fvtt-hawkmoon-cyd", "sheet", "actor"], + template: "systems/fvtt-hawkmoon-cyd/templates/cellule-sheet.html", + width: 640, + height: 720, + tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "talents" }], + dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }], + editScore: false + }); + } + + /* -------------------------------------------- */ + async getData() { + const objectData = duplicate(this.object) + + let formData = { + title: this.title, + id: objectData.id, + type: objectData.type, + img: objectData.img, + name: objectData.name, + editable: this.isEditable, + cssClass: this.isEditable ? "editable" : "locked", + system: objectData.system, + effects: this.object.effects.map(e => foundry.utils.deepClone(e.data)), + limited: this.object.limited, + talents: duplicate(this.actor.getTalents() || {}), + ressources: duplicate(this.actor.getRessources()), + contacts: duplicate(this.actor.getContacts()), + members: this.getMembers(), + description: await TextEditor.enrichHTML(this.object.system.description, { async: true }), + options: this.options, + owner: this.document.isOwner, + editScore: this.options.editScore, + isGM: game.user.isGM + } + this.formData = formData; + + console.log("CELLULE : ", formData, this.object); + return formData; + } + + /* -------------------------------------------- */ + getMembers( ) { + let membersFull = [] + for(let def of this.actor.system.members) { + let actor = game.actors.get(def.id) + membersFull.push( { name: actor.name, id: actor.id, img: actor.img } ) + } + return membersFull + } + + /* -------------------------------------------- */ + /** @override */ + activateListeners(html) { + super.activateListeners(html); + + // Everything below here is only needed if the sheet is editable + if (!this.options.editable) return; + + // Update Inventory Item + html.find('.actor-edit').click(ev => { + const li = $(ev.currentTarget).parents(".item") + let actorId = li.data("actor-id") + const actor = game.actors.get(actorId) + actor.sheet.render(true) + }) + html.find('.actor-delete').click(ev => { + const li = $(ev.currentTarget).parents(".item") + let actorId = li.data("actor-id") + this.actor.removeMember(actorId) + }) + + // Update Inventory Item + html.find('.item-edit').click(ev => { + const li = $(ev.currentTarget).parents(".item") + let itemId = li.data("item-id") + const item = this.actor.items.get(itemId) + item.sheet.render(true) + }) + // Delete Inventory Item + html.find('.item-delete').click(ev => { + const li = $(ev.currentTarget).parents(".item"); + HawkmoonUtility.confirmDelete(this, li); + }) + html.find('.edit-item-data').change(ev => { + const li = $(ev.currentTarget).parents(".item") + let itemId = li.data("item-id") + let itemType = li.data("item-type") + let itemField = $(ev.currentTarget).data("item-field") + let dataType = $(ev.currentTarget).data("dtype") + let value = ev.currentTarget.value + this.actor.editItemField(itemId, itemType, itemField, dataType, value) + }) + + html.find('.quantity-minus').click(event => { + const li = $(event.currentTarget).parents(".item"); + this.actor.incDecQuantity(li.data("item-id"), -1); + }); + html.find('.quantity-plus').click(event => { + const li = $(event.currentTarget).parents(".item"); + this.actor.incDecQuantity(li.data("item-id"), +1); + }); + + html.find('.lock-unlock-sheet').click((event) => { + this.options.editScore = !this.options.editScore; + this.render(true); + }); + } + + /* -------------------------------------------- */ + async _onDropActor(event, dragData) { + const actor = fromUuidSync(dragData.uuid) + if (actor) { + this.actor.addMember(actor.id) + } else { + ui.notifications.warn("Cet acteur n'a pas été trouvé.") + } + super._onDropActor(event) + } + + /* -------------------------------------------- */ + async _onDropItem(event, dragData) { + let data = event.dataTransfer.getData('text/plain') + let dataItem = JSON.parse(data) + let item = fromUuidSync(dataItem.uuid) + if (item.pack) { + item = await HawkmoonUtility.searchItem(item) + } + if ( __ALLOWED_ITEM_CELLULE[item.type]) { + super._onDropItem(event, dragData) + return + } + ui.notifications("Ce type d'item n'est pas autorisé sur une Cellule.") + } + + + /* -------------------------------------------- */ + /** @override */ + setPosition(options = {}) { + const position = super.setPosition(options); + const sheetBody = this.element.find(".sheet-body"); + const bodyHeight = position.height - 192; + sheetBody.css("height", bodyHeight); + return position; + } + +} diff --git a/modules/hawkmoon-main.js b/modules/hawkmoon-main.js index e956073..751d98d 100644 --- a/modules/hawkmoon-main.js +++ b/modules/hawkmoon-main.js @@ -11,6 +11,7 @@ import { HawkmoonActor } from "./hawkmoon-actor.js"; import { HawkmoonItemSheet } from "./hawkmoon-item-sheet.js"; import { HawkmoonActorSheet } from "./hawkmoon-actor-sheet.js"; +import { HawkmoonCelluleSheet } from "./hawkmoon-cellule-sheet.js"; import { HawkmoonUtility } from "./hawkmoon-utility.js"; import { HawkmoonCombat } from "./hawkmoon-combat.js"; import { HawkmoonItem } from "./hawkmoon-item.js"; @@ -31,7 +32,7 @@ Hooks.once("init", async function () { /* -------------------------------------------- */ // Set an initiative formula for the system CONFIG.Combat.initiative = { - formula: "1d6", + formula: "1d10", decimals: 1 }; @@ -54,7 +55,7 @@ Hooks.once("init", async function () { // Register sheet application classes Actors.unregisterSheet("core", ActorSheet); Actors.registerSheet("fvtt-hawkmoon-cyd", HawkmoonActorSheet, { types: ["personnage"], makeDefault: true }) - //Actors.registerSheet("fvtt-hawkmoon-cyd", HawkmoonNPCSheet, { types: ["npc"], makeDefault: false }); + Actors.registerSheet("fvtt-hawkmoon-cyd", HawkmoonCelluleSheet, { types: ["cellule"], makeDefault: false }); Items.unregisterSheet("core", ItemSheet); Items.registerSheet("fvtt-hawkmoon-cyd", HawkmoonItemSheet, { makeDefault: true }) diff --git a/modules/hawkmoon-utility.js b/modules/hawkmoon-utility.js index 926dd8e..e70c319 100644 --- a/modules/hawkmoon-utility.js +++ b/modules/hawkmoon-utility.js @@ -42,6 +42,23 @@ export class HawkmoonUtility { return parseInt(a) * parseInt(b); }) + game.settings.register("fvtt-hawkmoon-cyd", "hawkmoon-pause-logo", { + name: "Logo de pause", + scope: "world", + config: true, + requiresReload: true, + default: "logo_pause_resistance", + type: String, + choices: { // If choices are defined, the resulting setting will be a select menu + "hawkmoon_logo": "Hawmoon (Texte)", + "logo_pause_resistance": "Résistance", + "logo_pause_hawkmoon_stone": "Hawkmoon (Pierre)", + "logo_pause_hawkmoon_violet": "Hawkmoon (Violet)", + "logo_pause_hawkmoon_beiget": "Hawkmoon (Beige)", + "logo_pause_hawkmoon_rouge": "Hawkmoon (Rouge)" + }, + }) + } /* -------------------------------------------- */ @@ -79,6 +96,11 @@ export class HawkmoonUtility { static async ready() { const skills = await HawkmoonUtility.loadCompendium("fvtt-hawkmoon-cyd.skills") this.skills = skills.map(i => i.toObject()) + + // Setup pause logo + let logoPause = "systems/fvtt-hawkmoon-cyd/assets/logos/" + game.settings.get("fvtt-hawkmoon-cyd", "hawkmoon-pause-logo") + ".webp" + let logoImg = document.querySelector('#pause').children[0] + logoImg.setAttribute('style', `content: url(${logoPause})`) } /* -------------------------------------------- */ @@ -333,7 +355,7 @@ export class HawkmoonUtility { } } } else { - rollData.diceFormula += `+${rollData.attr.value}*2+${rollData.modificateur}` + rollData.diceFormula += `+${rollData.attr.value}*${rollData.multiplier}+${rollData.modificateur}` } // Ajout adversités diff --git a/styles/simple.css b/styles/simple.css index c8121d1..e2d1056 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -844,6 +844,25 @@ ul, li { height: 52px; } +.adversite-text { + font-weight: bold; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} +.icon-adversite-container { + position: relative; + text-align: center; + color: white; + width: 64px; + min-height: 48px; +} +.icon-adversite { + width: 48px; + border: 0px; +} + .actor-icon { float: left; width: 48px; @@ -1159,16 +1178,18 @@ ul, li { box-shadow: inset 0px 1px 0px 0px #a6827e; background: linear-gradient(to bottom, #21374afc 5%, #152833ab 100%); background-color: #7d5d3b00; - border-radius: 3px; + border-radius: 4px; border: 2px ridge #846109; display: inline-block; cursor: pointer; color: #ffffff; - padding: 2px 6px 0px 6px; + padding: 3px 6px 2px 6px; text-decoration: none; text-shadow: 0px 1px 0px #4d3534; position: relative; margin:3px; + max-width: 24px; + max-height: 24px; } .river-button:hover, diff --git a/system.json b/system.json index a4fc27d..1a42ef8 100644 --- a/system.json +++ b/system.json @@ -1,11 +1,31 @@ { "id": "fvtt-hawkmoon-cyd", "description": "Hawmoon RPG for FoundryVTT (CYD system - French)", - "version": "10.0.9", + "version": "10.0.16", "authors": [ { "name": "Uberwald/LeRatierBretonnien", "flags": {} + }, + { + "name": "Prêtre", + "flags": {} + }, + { + "name": "Blondin", + "flags": {} + }, + { + "name": "Zechrub/Chris", + "flags": {} + }, + { + "name": "Kyllian", + "flags": {} + }, + { + "name": "Lightbringer", + "flags": {} } ], "esmodules": [ @@ -15,7 +35,7 @@ "gridUnits": "m", "license": "LICENSE.txt", "manifest": "https://www.uberwald.me/gitea/public/fvtt-hawkmoon-cyd/raw/branch/master/system.json", - "download": "https://www.uberwald.me/gitea/public/fvtt-hawkmoon-cyd/archive/fvtt-hawkmoon-cyd-10.0.9.zip", + "download": "https://www.uberwald.me/gitea/public/fvtt-hawkmoon-cyd/archive/fvtt-hawkmoon-cyd-10.0.16.zip", "packs": [ { "type": "Item", diff --git a/template.json b/template.json index 9a99f40..828eef7 100644 --- a/template.json +++ b/template.json @@ -1,7 +1,8 @@ { "Actor": { "types": [ - "personnage" + "personnage", + "cellule" ], "templates": { "biodata": { @@ -91,6 +92,13 @@ "core" ] }, + "cellule": { + "notoriete": 0, + "resistance": 0, + "developpement": 0, + "members": [], + "description": "" + }, "pnj": { "templates": [ "npccore" @@ -123,8 +131,20 @@ "protection", "monnaie", "equipement", - "artefact" + "artefact", + "ressource", + "contact" ], + "ressource": { + "pointdev": 0, + "description": "" + }, + "contact": { + "contacttype": "", + "niveau": "", + "pointdev": 0, + "description": "" + }, "talent": { "talenttype": "", "utilisation": "", diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index 7ac8669..00caf71 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -83,12 +83,15 @@ @@ -114,7 +117,7 @@

Combat

@@ -209,6 +212,33 @@ {{/each}} + + +
+
+ +
diff --git a/templates/cellule-sheet.html b/templates/cellule-sheet.html new file mode 100644 index 0000000..88f643f --- /dev/null +++ b/templates/cellule-sheet.html @@ -0,0 +1,188 @@ +
+ + {{!-- Sheet Header --}} +
+
+
+ +
+

+
+ +
    + +
  • +

    Notoriété

    + + +

    Résistance

    + +
  • + +
  • +

    Développement

    + +
  • + +
+
+ +
+
+
+ + {{!-- Sheet Tab Navigation --}} + + + {{!-- Sheet Body --}} +
+ + {{!-- Talents Tab --}} +
+ +
+
    +
  • + +

    +
    +
     
    +
  • + {{#each members as |membre key|}} +
  • + + {{membre.name}} + +
     
    +
    + + +
    +
  • + {{/each}} +
+
+ +
+
    +
  • + +

    +
    + + + +
     
    +
  • + {{#each talents as |talent key|}} +
  • + + {{talent.name}} + {{talent.system.resumebonus}} + +
     
    +
    + + +
    +
  • + {{/each}} +
+
+ +
+ + {{!-- Contacts Tab --}} +
+ +
+ +
+
    +
  • + +

    +
    + + + + + + +
     
    +
  • + {{#each contacts as |contact key|}} +
  • + + {{contact.name}} + {{upperFirst contact.system.contacttype}} + {{contact.system.niveau}} + +
     
    +
    + + +
    +
  • + {{/each}} +
+
+ +
+ +
+ + {{!-- Ressources Tab --}} +
+ +
+ +
+
    +
  • + +

    +
    +
     
    +
  • + {{#each ressources as |ressource key|}} +
  • + + {{ressource.name}} + +
     
    +
    + + +
    +
  • + {{/each}} +
+
+ +
+ +
+ + + {{!-- Biography Tab --}} +
+ +

Description

+
+
+ {{editor description target="system.description" button=true owner=owner editable=editable}} +
+ +
+ +
+
\ No newline at end of file diff --git a/templates/item-contact-sheet.html b/templates/item-contact-sheet.html new file mode 100644 index 0000000..d1451dc --- /dev/null +++ b/templates/item-contact-sheet.html @@ -0,0 +1,50 @@ +
+
+ +
+

+
+
+ + {{> systems/fvtt-hawkmoon-cyd/templates/partial-item-nav.html}} + + {{!-- Sheet Body --}} +
+ + {{> systems/fvtt-hawkmoon-cyd/templates/partial-item-description.html}} + +
+ +
    +
  • + + + + + + +
  • + +
  • + + +
  • + +
+ +
+ +
+
\ No newline at end of file diff --git a/templates/item-ressource-sheet.html b/templates/item-ressource-sheet.html new file mode 100644 index 0000000..387f9c6 --- /dev/null +++ b/templates/item-ressource-sheet.html @@ -0,0 +1,31 @@ +
+
+ +
+

+
+
+ + {{> systems/fvtt-hawkmoon-cyd/templates/partial-item-nav.html}} + + {{!-- Sheet Body --}} +
+ + {{> systems/fvtt-hawkmoon-cyd/templates/partial-item-description.html}} + +
+ +
    + +
  • + + +
  • + +
+ +
+ +
+
\ No newline at end of file