diff --git a/assets/icons/contacts.webp b/assets/icons/contacts.webp new file mode 100644 index 0000000..767d585 Binary files /dev/null and b/assets/icons/contacts.webp differ diff --git a/assets/icons/ressources.webp b/assets/icons/ressources.webp new file mode 100644 index 0000000..b41d99d Binary files /dev/null and b/assets/icons/ressources.webp differ diff --git a/modules/hawkmoon-actor-sheet.js b/modules/hawkmoon-actor-sheet.js index 87828f0..0366273 100644 --- a/modules/hawkmoon-actor-sheet.js +++ b/modules/hawkmoon-actor-sheet.js @@ -20,7 +20,7 @@ export class HawkmoonActorSheet extends ActorSheet { tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "stats" }], dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }], editScore: false - }); + }) } /* -------------------------------------------- */ @@ -48,6 +48,7 @@ export class HawkmoonActorSheet extends ActorSheet { combat: this.actor.getCombatValues(), equipements: duplicate(this.actor.getEquipments()), description: await TextEditor.enrichHTML(this.object.system.biodata.description, {async: true}), + habitat: await TextEditor.enrichHTML(this.object.system.biodata.habitat, {async: true}), options: this.options, owner: this.document.isOwner, editScore: this.options.editScore, @@ -120,13 +121,13 @@ export class HawkmoonActorSheet extends ActorSheet { } ); html.find('.roll-initiative').click((event) => { - this.actor.rollAttribut("pre", 1) + this.actor.rollAttribut("pre", true) }) html.find('.roll-attribut').click((event) => { const li = $(event.currentTarget).parents(".item") let attrKey = li.data("attr-key") - this.actor.rollAttribut(attrKey, 2) + this.actor.rollAttribut(attrKey, false) }) html.find('.roll-competence').click((event) => { const li = $(event.currentTarget).parents(".item") @@ -184,10 +185,4 @@ export class HawkmoonActorSheet extends ActorSheet { } } - /* -------------------------------------------- */ - /** @override */ - _updateObject(event, formData) { - // Update the Actor - return this.object.update(formData); - } } diff --git a/modules/hawkmoon-actor.js b/modules/hawkmoon-actor.js index 139aad1..0e19db9 100644 --- a/modules/hawkmoon-actor.js +++ b/modules/hawkmoon-actor.js @@ -291,6 +291,10 @@ export class HawkmoonActor extends Actor { return { isValid: false } } /* -------------------------------------------- */ + getVigueur() { + return this.system.sante.vigueur + } + /* -------------------------------------------- */ getBonneAventure() { return this.system.bonneaventure.actuelle } @@ -409,8 +413,9 @@ export class HawkmoonActor extends Actor { /* -------------------------------------------- */ getInitiativeScore() { - return Number(this.system.attributs.adr.value) + Number(this.system.combat.initbonus) + return this.lastInit || -1 } + /* -------------------------------------------- */ getBestDefenseValue() { let defenseList = this.items.filter(item => (item.type == "arme") && item.system.equipped) @@ -484,9 +489,10 @@ export class HawkmoonActor extends Actor { } /* -------------------------------------------- */ - async rollAttribut(attrKey, multiplier = 1) { + async rollAttribut(attrKey, isInit = false) { let rollData = this.getCommonRollData(attrKey) - rollData.multiplier = multiplier + rollData.multiplier = (isInit)? 1 : 2 + rollData.isInit = isInit let rollDialog = await HawkmoonRollDialog.create(this, rollData) rollDialog.render(true) } @@ -506,9 +512,6 @@ export class HawkmoonActor extends Actor { if (arme.type == "arme") { arme = this.prepareArme(arme) } - if (arme.type == "bouclier") { - arme = this.prepareBouclier(arme) - } let rollData = this.getCommonRollData(arme.system.attrKey, arme.system.competence._id) rollData.arme = arme console.log("ARME!", rollData) @@ -517,17 +520,18 @@ export class HawkmoonActor extends Actor { } /* -------------------------------------------- */ - async rollArmeDegats(armeId) { + async rollArmeDegats(armeId, targetVigueur = undefined) { let arme = this.items.get(armeId) if (arme.type == "arme") { arme = this.prepareArme(arme) } - if (arme.type == "bouclier") { - arme = this.prepareBouclier(arme) - } console.log("DEGATS", arme) let roll = new Roll( "1d10+"+arme.system.totalDegats).roll({ async: false }) await HawkmoonUtility.showDiceSoNice(roll, game.settings.get("core", "rollMode")); + let nbEtatPerdus = 0 + if (targetVigueur) { + nbEtatPerdus = Math.floor(roll.total / targetVigueur) + } let rollData = { arme: arme, finalResult: roll.total, @@ -535,6 +539,8 @@ export class HawkmoonActor extends Actor { actorImg: this.img, actorId: this.id, actionImg: arme.img, + targetVigueur: targetVigueur, + nbEtatPerdus: nbEtatPerdus } HawkmoonUtility.createChatWithRollMode(rollData.alias, { content: await renderTemplate(`systems/fvtt-hawkmoon-cyd/templates/chat-degats-result.html`, rollData) diff --git a/modules/hawkmoon-combat.js b/modules/hawkmoon-combat.js index 5ec1a42..7ee1a97 100644 --- a/modules/hawkmoon-combat.js +++ b/modules/hawkmoon-combat.js @@ -9,11 +9,9 @@ export class HawkmoonCombat extends Combat { 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() : 0 - let roll = new Roll("1d10 + "+initBonus).roll({ async: false}) - await HawkmoonUtility.showDiceSoNice(roll, game.settings.get("core", "rollMode")) + let initValue = c.actor ? c.actor.getInitiativeScore() : 0 //console.log("Init bonus", initBonus, roll.total) - await this.updateEmbeddedDocuments("Combatant", [ { _id: id, initiative: roll.total } ]); + await this.updateEmbeddedDocuments("Combatant", [ { _id: id, initiative: initValue } ]); } return this; diff --git a/modules/hawkmoon-creature-sheet.js b/modules/hawkmoon-creature-sheet.js new file mode 100644 index 0000000..fb27b59 --- /dev/null +++ b/modules/hawkmoon-creature-sheet.js @@ -0,0 +1,26 @@ +/** + * Extend the basic ActorSheet with some very simple modifications + * @extends {ActorSheet} + */ + + import { HawkmoonActorSheet } from "./hawkmoon-actor-sheet.js"; +import { HawkmoonUtility } from "./hawkmoon-utility.js"; +import { HawkmoonAutomation } from "./hawkmoon-automation.js"; + +/* -------------------------------------------- */ +export class HawkmoonCreatureSheet extends HawkmoonActorSheet { + + /** @override */ + static get defaultOptions() { + + return mergeObject(super.defaultOptions, { + classes: ["fvtt-hawkmoon-cyd", "sheet", "actor"], + template: "systems/fvtt-hawkmoon-cyd/templates/creature-sheet.html", + width: 640, + height: 720, + tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "stats" }], + dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }], + editScore: false + }) + } +} diff --git a/modules/hawkmoon-item.js b/modules/hawkmoon-item.js index cd580f8..b55a8fd 100644 --- a/modules/hawkmoon-item.js +++ b/modules/hawkmoon-item.js @@ -11,6 +11,8 @@ export const defaultItemImg = { historique: "systems/fvtt-hawkmoon-cyd/assets/icons/historique.webp", profil: "systems/fvtt-hawkmoon-cyd/assets/icons/profil.webp", artefact: "systems/fvtt-hawkmoon-cyd/assets/icons/artefact.webp", + contact: "systems/fvtt-hawkmoon-cyd/assets/icons/contacts.webp", + ressource: "systems/fvtt-hawkmoon-cyd/assets/icons/ressources.webp", } /** diff --git a/modules/hawkmoon-main.js b/modules/hawkmoon-main.js index 751d98d..53b6289 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 { HawkmoonCreatureSheet } from "./hawkmoon-creature-sheet.js"; import { HawkmoonCelluleSheet } from "./hawkmoon-cellule-sheet.js"; import { HawkmoonUtility } from "./hawkmoon-utility.js"; import { HawkmoonCombat } from "./hawkmoon-combat.js"; @@ -55,7 +56,8 @@ 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", HawkmoonCelluleSheet, { types: ["cellule"], makeDefault: false }); + Actors.registerSheet("fvtt-hawkmoon-cyd", HawkmoonCreatureSheet, { types: ["creature"], makeDefault: true }) + Actors.registerSheet("fvtt-hawkmoon-cyd", HawkmoonCelluleSheet, { types: ["cellule"], makeDefault: true }); 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 e70c319..721ec90 100644 --- a/modules/hawkmoon-utility.js +++ b/modules/hawkmoon-utility.js @@ -132,6 +132,14 @@ export class HawkmoonUtility { rollData.competence = duplicate(actor.getCompetence(rollData.competence._id)) HawkmoonUtility.rollHawkmoon(rollData) }) + + html.on("click", '.roll-chat-degat', async event => { + let messageId = HawkmoonUtility.findChatMessageId(event.currentTarget) + let message = game.messages.get(messageId) + let rollData = message.getFlag("world", "hawkmoon-roll") + let actor = game.actors.get(rollData.actorId) + actor.rollArmeDegats(rollData.arme._id, rollData.targetVigueur) + }) } /* -------------------------------------------- */ @@ -290,10 +298,9 @@ export class HawkmoonUtility { /* -------------------------------------------- */ static computeResult(rollData) { - if (rollData.mainDice == "1d20") { + rollData.diceResult = rollData.roll.terms[0].results[0].result + if (rollData.mainDice.includes("d20") ) { let diceValue = rollData.roll.terms[0].results[0].result - diceValue *= (rollData.doubleD20) ? 2 : 1 - //console.log("PAIR/IMP", diceValue) if (diceValue % 2 == 1) { //console.log("PAIR/IMP2", diceValue) rollData.finalResult -= rollData.roll.terms[0].results[0].result // Substract value @@ -310,6 +317,7 @@ export class HawkmoonUtility { rollData.isHeroique = ((rollData.finalResult - rollData.difficulte) >= 10) rollData.isDramatique = ((rollData.finalResult - rollData.difficulte) <= -10) } + } /* -------------------------------------------- */ @@ -372,6 +380,9 @@ export class HawkmoonUtility { rollData.finalResult = myRoll.total this.computeResult(rollData) + if (rollData.isInit) { + actor.lastInit = rollData.finalResult + } this.createChatWithRollMode(rollData.alias, { content: await renderTemplate(`systems/fvtt-hawkmoon-cyd/templates/chat-generic-result.html`, rollData) @@ -423,7 +434,7 @@ export class HawkmoonUtility { chatGM.whisper = this.getUsers(user => user.isGM); chatGM.content = "Blinde message of " + game.user.name + "
" + chatOptions.content; console.log("blindMessageToGM", chatGM); - game.socket.emit("system.fvtt-weapons-of-the-gods", { msg: "msg_gm_chat_message", data: chatGM }); + game.socket.emit("system.fvtt-hawkmoon-cyd", { msg: "msg_gm_chat_message", data: chatGM }); } /* -------------------------------------------- */ @@ -501,6 +512,7 @@ export class HawkmoonUtility { rollData.defenderTokenId = target.id let defender = game.canvas.tokens.get(rollData.defenderTokenId).actor rollData.armeDefense = defender.getBestDefenseValue() + rollData.targetVigueur = defender.getVigueur() if ( rollData.armeDefense) { rollData.difficulte = rollData.armeDefense.system.totalDefensif } else { diff --git a/styles/simple.css b/styles/simple.css index e2d1056..7337f9d 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -401,8 +401,9 @@ table {border: 1px solid #7a7971;} .window-app.sheet .window-content .sheet-header input[type="text"], .window-app.sheet .window-content .sheet-header input[type="number"], .window-app.sheet .window-content .sheet-header input[type="password"], .window-app.sheet .window-content .sheet-header input[type="date"], .window-app.sheet .window-content .sheet-header input[type="time"] { color: rgba(36, 37, 37, 0.75); - background: rgba(255, 255, 255, 0.05); - border: 0 none; + /*background: rgba(255, 255, 255, 0.05);*/ + border: 2px saddlebrown; + border-width: 2px; margin-bottom: 0.25rem; } @@ -420,6 +421,7 @@ section.sheet-body{padding: 0.25rem 0.5rem;} object-position: 50% 0; margin: 0.5rem 0 0.5rem 0.5rem; padding: 0; + border:0px; } .sheet nav.sheet-tabs { @@ -1373,4 +1375,14 @@ ul, li { .item-field { justify-content: flex-start; flex-grow: 1; +} +.chat-success { + font-size: 1.2rem; + font-weight: bold; + color: darkgreen; +} +.chat-failure { + font-size: 1.2rem; + font-weight: bold; + color: darkred; } \ No newline at end of file diff --git a/system.json b/system.json index 1a42ef8..e79efe8 100644 --- a/system.json +++ b/system.json @@ -1,7 +1,7 @@ { "id": "fvtt-hawkmoon-cyd", "description": "Hawmoon RPG for FoundryVTT (CYD system - French)", - "version": "10.0.16", + "version": "10.0.17", "authors": [ { "name": "Uberwald/LeRatierBretonnien", @@ -35,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.16.zip", + "download": "https://www.uberwald.me/gitea/public/fvtt-hawkmoon-cyd/archive/fvtt-hawkmoon-cyd-10.0.17.zip", "packs": [ { "type": "Item", diff --git a/template.json b/template.json index 828eef7..9fb69b3 100644 --- a/template.json +++ b/template.json @@ -2,7 +2,8 @@ "Actor": { "types": [ "personnage", - "cellule" + "cellule", + "creature" ], "templates": { "biodata": { @@ -15,7 +16,7 @@ "sexe": "", "yeux": "", "description": "", - "amemultiplier": 2, + "habitat": "", "notes": "", "statut": "", "gmnotes": "" @@ -74,6 +75,9 @@ "rouge": 0, "noire": 0 }, + "vitesse": { + "value": 0 + }, "combat": { "initbonus": 0, "vitessebonus": 0, @@ -99,10 +103,14 @@ "members": [], "description": "" }, - "pnj": { + "creature": { "templates": [ - "npccore" - ] + "core", + "biodata" + ], + "ressources": { + "value": 0 + } } }, "Item": { diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index 00caf71..1da5b2c 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -11,11 +11,6 @@ - - -
-

Adversité

- -
- -

Santé

+ +
+ +
+

Adversité

+ + +

Vitesse

+ + +
@@ -284,10 +287,10 @@ {{#if arme.system.isdefense}} - + {{else}} - + {{/if}} @@ -375,50 +378,58 @@ {{!-- Biography Tab --}}
-
-
-
    -
  • - - + +
    +
      +
    • + + + +
      + + +
      +
    • + {{#each profils as |profil key|}} +
    • + + +
    • - {{#each profils as |profil key|}} -
    • - - -
      - - -
      -
    • - {{/each}} -
    -
    + {{/each}} +
+
+ +
  • -
  • -
  • +
+
+
+
  • -
  • -
@@ -427,17 +438,17 @@
  • -
  • -
  • -
  • @@ -447,7 +458,7 @@

    Description

    - {{editor description target="system.biosystem.description" button=true owner=owner editable=editable}} + {{editor description target="system.biodata.description" button=true owner=owner editable=editable}}
    diff --git a/templates/chat-degats-result.html b/templates/chat-degats-result.html index 453b2c6..c375b20 100644 --- a/templates/chat-degats-result.html +++ b/templates/chat-degats-result.html @@ -20,7 +20,9 @@
    • Arme : {{arme.name}} (+{{arme.system.totalDegats}})
    • Dégats : {{finalResult}}
    • + {{#if targetVigueur}} +
    • Vigueur de la cible : {{targetVigueur}}
    • +
    • Etats de Combativité perdus : {{nbEtatPerdus}}
    • + {{/if}}
    - -
    \ No newline at end of file diff --git a/templates/chat-generic-result.html b/templates/chat-generic-result.html index 44913c0..ac9b02f 100644 --- a/templates/chat-generic-result.html +++ b/templates/chat-generic-result.html @@ -18,10 +18,10 @@
      -
    • Attribut : {{attr.label}}
    • +
    • Attribut : {{attr.label}} ({{attr.value}})
    • {{#if competence}} -
    • Compétence : {{competence.name}}
    • +
    • Compétence : {{competence.name}} ({{competence.system.niveau}})
    • {{/if}} {{#if selectedMaitrise}} @@ -34,35 +34,50 @@ {{/if}}
    • Formule : {{diceFormula}}
    • - +
    • Résultat du dé : {{diceResult}}
    • + {{#if bonusRoll}}
    • {{textBonus}} : +{{bonusRoll.total}}
    • {{/if}} - +
    • Total : {{finalResult}}
    • {{#if difficulte}} {{#if isSuccess}} -
    • Succés!!!
    • +
    • Succés!!!
    • {{else}} -
    • Echec ...
    • +
    • Echec ...
    • {{/if}} {{/if}} {{#if isHeroique}} -
    • Succés Héroïque!!!
    • +
    • Succés Héroïque!!!
    • {{/if}} {{#if isDramatique}} -
    • Echec Dramatique!!!
    • +
    • Echec Dramatique!!!
    • {{/if}} + {{#if isInit}} +
    • Initiative stockée !
    • + {{/if}} + + {{#if isSuccess}} + {{#if arme}} +
    • Votre adversaire perd 1 Etat de Combativité
    • + {{#if (not arme.system.onlevelonly)}} + + {{/if}} + {{/if}} + {{/if}} + + {{#each predilections as |pred key|}}
    • - +
    • {{/each}}
    -
    \ No newline at end of file diff --git a/templates/creature-sheet.html b/templates/creature-sheet.html new file mode 100644 index 0000000..75f2307 --- /dev/null +++ b/templates/creature-sheet.html @@ -0,0 +1,357 @@ +
    + + {{!-- Sheet Header --}} +
    +
    +
    + +
    +

    +
    + +
      + +
    • +

      Ressources

      + +
    • +
    +
    +
    +
    +
    + + {{!-- Sheet Tab Navigation --}} + + + {{!-- Sheet Body --}} +
    + + {{!-- Main Tab --}} +
    + +
    + +
    +
      + {{#each system.attributs as |attr key|}} +
    • + + {{attr.label}} + +
    • + {{/each}} +
    +

    Santé

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

    Combat

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

    Adversité

    +
      + {{#each system.adversite as |adv key|}} +
    • + - +
      + +
      {{adv}}
      +
      + + +
       
      +
       
      +
       
      +
    • + {{/each}} +
    + +

    Vitesse

    +
      +
    • + +
    • +
    + + +
    + +
    + +
    + + {{!-- Competence Tab --}} +
    + +
    + +
    +
      +
    • + +

      +
      + + + +
       
      +
    • + {{#each skills as |skill key|}} +
    • + + {{skill.name}} + + + {{#if (ne skill.system.attribut1 "none")}} + + {{/if}} + {{#if (ne skill.system.attribut2 "none")}} + + {{/if}} + {{#if (ne skill.system.attribut3 "none")}} + + {{/if}} + +
       
      +
      + + +
      +
    • + {{/each}} +
    +
    + +
    + +
    + + {{!-- Talents Tab --}} +
    + +
    + +
    +
      +
    • + +

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

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

      +
      + + + + + + + + + +
       
      +
      + +
      +
    • + {{#each armes as |arme key|}} +
    • + + {{arme.name}} + + + {{#if arme.system.equipped}} + + {{else}} + + {{/if}} + + + {{#if arme.system.isdefense}} + + {{else}} + + {{/if}} + + + {{#if arme.system.equipped}} + + {{else}} + + {{/if}} + + +
       
      + +
    • + {{/each}} +
    +
    + +
    +
      +
    • + +

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

    Description

    +
    +
    + {{editor description target="system.biodata.description" button=true owner=owner editable=editable}} +
    + + +

    Habitat

    +
    +
    + {{editor habitat target="system.biodata.habitat" button=true owner=owner editable=editable}} +
    + +
    + +
    +
    \ No newline at end of file diff --git a/templates/item-talent-sheet.html b/templates/item-talent-sheet.html index d8600f0..c09e5bc 100644 --- a/templates/item-talent-sheet.html +++ b/templates/item-talent-sheet.html @@ -24,6 +24,7 @@ {{#select system.talenttype}} + {{/select}}