From cae8cd5ae8b41489f0184a545cf580045195efe8 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Tue, 7 Feb 2023 15:18:00 +0100 Subject: [PATCH] Lates fixes --- lang/en.json | 12 ++- modules/warhero-actor-sheet.js | 2 + modules/warhero-actor.js | 30 +++++- modules/warhero-utility.js | 21 ++++- styles/simple.css | 6 ++ system.json | 4 +- template.json | 16 ++-- templates/actor-sheet.html | 119 +++++++++++++++++++++--- templates/chat-generic-result.html | 22 ++++- templates/chat-parry-result.html | 12 +++ templates/item-condition-sheet.html | 4 + templates/item-money-sheet.html | 28 ------ templates/item-poison-sheet.html | 28 ------ templates/item-skill-sheet.html | 27 +++--- templates/partial-actor-stat-block.html | 2 +- 15 files changed, 230 insertions(+), 103 deletions(-) delete mode 100644 templates/item-money-sheet.html delete mode 100644 templates/item-poison-sheet.html diff --git a/lang/en.json b/lang/en.json index dab5661..0b08f89 100644 --- a/lang/en.json +++ b/lang/en.json @@ -70,12 +70,18 @@ "WH.ui.parrybonustotal": "Parry bonus total", "WH.ui.drbonustotal": "DR bonus total", "WH.ui.counterspell": "Counter spell", - "WH.ui.createitem": "Create item", + "WH.ui.createitem": "Bonus to percentage throws", "WH.ui.classSkills": "Class Skills", - "WH.ui.skills": "Skills", + "WH.ui.skills": "Skills based on level", "WH.ui.isclassskill": "Class skill ?", "WH.ui.unlimited": "Unlimited use ?", "WH.ui.currentuse": "Current use", "WH.ui.maxuse": "Max use", - "WH.ui.languages": "Languages" + "WH.ui.languages": "Languagess", + "WH.ui.languagesbonus": "Bonus Languages (mind/2)", + "WH.ui.competency": "Competency", + "WH.ui.conditions": "Conditions", + "WH.ui.effect": "Effect", + + "WH.chat.save": "Save" } \ No newline at end of file diff --git a/modules/warhero-actor-sheet.js b/modules/warhero-actor-sheet.js index 585867f..2156a94 100644 --- a/modules/warhero-actor-sheet.js +++ b/modules/warhero-actor-sheet.js @@ -46,12 +46,14 @@ export class WarheroActorSheet extends ActorSheet { classSkills: this.actor.getClassSkills( ), languages: this.actor.getLanguages( ), weapons: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getWeapons()) ), + conditions: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getConditions()) ), armors: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getArmors())), shields: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getShields())), powers: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getPowers())), equipments: this.actor.checkAndPrepareEquipments(duplicate(this.actor.getEquipmentsOnly()) ), slotEquipments: this.actor.buildEquipmentsSlot(), subActors: duplicate(this.actor.getSubActors()), + competency: this.actor.getCompetency(), race: duplicate(race), class: duplicate(this.actor.getClass()), moneys: duplicate(this.actor.getMoneys()), diff --git a/modules/warhero-actor.js b/modules/warhero-actor.js index e7d1915..0ed93fd 100644 --- a/modules/warhero-actor.js +++ b/modules/warhero-actor.js @@ -203,6 +203,12 @@ export class WarheroActor extends Actor { return comp; } /* -------------------------------------------- */ + getConditions() { + let comp = duplicate(this.items.filter(item => item.type == 'condition') || []); + WarheroUtility.sortArrayObjectsByName(comp) + return comp; + } + /* -------------------------------------------- */ getItemById(id) { let item = this.items.find(item => item.id == id); if (item) { @@ -365,6 +371,28 @@ export class WarheroActor extends Actor { this.update({ 'system.secondary.hp': hp }) return Number(dmgRoll.total) } + /* -------------------------------------------- */ + updateCompetency(competency, obj) { + for(let key in obj) { + if (obj[key]) { + competency[key] = true + } + } + } + getCompetency() { + let myRace = this.getRace() + let myClass = this.getClass() + let competency = { weapons: {}, armors: {}, shields: {}} + if ( myRace.system && myClass.system) { + this.updateCompetency(competency.weapons, myRace.system.weapons) + this.updateCompetency(competency.armors, myRace.system.armors) + this.updateCompetency(competency.shields, myRace.system.shields) + this.updateCompetency(competency.weapons, myClass.system.weapons) + this.updateCompetency(competency.armors, myClass.system.armors) + this.updateCompetency(competency.shields, myClass.system.shields) + } + return competency + } /* -------------------------------------------- */ getAbility(abilKey) { @@ -549,7 +577,7 @@ export class WarheroActor extends Actor { /* -------------------------------------------- */ setLevel() { let xp = this.system.secondary.xp.value - this.system.secondary.xp.level = Math.floor(xp/10) + this.system.secondary.xp.level = 1 + Math.floor(xp/10) } /* -------------------------------------------- */ computeDRTotal() { diff --git a/modules/warhero-utility.js b/modules/warhero-utility.js index eac2f85..b1df65f 100644 --- a/modules/warhero-utility.js +++ b/modules/warhero-utility.js @@ -519,12 +519,18 @@ export class WarheroUtility { await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode")) } rollData.roll = myRoll + rollData.diceFormula = diceFormula + rollData.diceResult = myRoll.terms[0].results[0].result rollData.isSuccess = false - if (myRoll.total >= 12 || myRoll.terms[0].results[0].result == 12) { + if (myRoll.total >= 12 || rollData.diceResult == 12) { rollData.isSuccess = true + if (rollData.diceResult == 12) { + rollData.isCriticalSuccess = true + } } - if (myRoll.terms[0].results[0].result == 1) { + if (rollData.diceResult == 1) { rollData.isSuccess = false + rollData.isCriticalFailure = true } let msg = await this.createChatWithRollMode(rollData.alias, { content: await renderTemplate(`systems/fvtt-warhero/templates/chat-parry-result.html`, rollData) @@ -554,6 +560,8 @@ export class WarheroUtility { let myRoll = new Roll(rollData.weapon.damageFormula + "+" + rollData.bonusMalus).roll({ async: false }) await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode")) rollData.roll = myRoll + rollData.diceFormula = myRoll.formula + rollData.diceResult = myRoll.terms[0].results[0].result let msg = await this.createChatWithRollMode(rollData.alias, { content: await renderTemplate(`systems/fvtt-warhero/templates/chat-generic-result.html`, rollData) @@ -571,7 +579,6 @@ export class WarheroUtility { diceFormula += "+" + rollData.mWeaponMalus } diceFormula += "+" + rollData.bonusMalus - rollData.diceFormula = diceFormula // Performs roll console.log("Roll formula", diceFormula) @@ -581,6 +588,14 @@ export class WarheroUtility { await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode")) } rollData.roll = myRoll + rollData.diceFormula = diceFormula + rollData.diceResult = myRoll.terms[0].results[0].result + if (rollData.diceResult == 20) { + rollData.isCriticalSuccess = true + } + if (rollData.diceResult == 1) { + rollData.isCriticalFailure = true + } let msg = await this.createChatWithRollMode(rollData.alias, { content: await renderTemplate(`systems/fvtt-warhero/templates/chat-generic-result.html`, rollData) diff --git a/styles/simple.css b/styles/simple.css index 57106fe..d357ec6 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -1494,4 +1494,10 @@ } form .notes { color: rgba(214, 230, 230, 0.95); + } + .crit-success { + color: darkgreen; + } + .crit-failure { + color: darkred; } \ No newline at end of file diff --git a/system.json b/system.json index 4266b1d..9df51e2 100644 --- a/system.json +++ b/system.json @@ -100,7 +100,7 @@ "styles": [ "styles/simple.css" ], - "version": "10.0.18", + "version": "10.0.19", "compatibility": { "minimum": "10", "verified": "10", @@ -108,7 +108,7 @@ }, "title": "Warhero RPG", "manifest": "https://www.uberwald.me/gitea/public/fvtt-warhero/raw/branch/master/system.json", - "download": "https://www.uberwald.me/gitea/uberwald/fvtt-warhero/archive/fvtt-warhero-10.0.18.zip", + "download": "https://www.uberwald.me/gitea/uberwald/fvtt-warhero/archive/fvtt-warhero-10.0.19.zip", "url": "https://www.uberwald.me/gitea/public/fvtt-warhero", "background": "images/ui/warhero_welcome_page.webp", "id": "fvtt-warhero" diff --git a/template.json b/template.json index e884dc1..0ed5a8f 100644 --- a/template.json +++ b/template.json @@ -56,6 +56,7 @@ "abbrev": "hp", "style": "edit", "hasmax": true, + "isheader": true, "max": 1, "value": 1 }, @@ -98,6 +99,7 @@ "abbrev": "pm", "style": "edit", "hasmax": true, + "isheader": true, "max": 1, "value": 1 }, @@ -187,7 +189,7 @@ "value": 0 }, "nblanguage": { - "label": "WH.ui.languages", + "label": "WH.ui.languagesbonus", "abbrev": "nblanguage", "style": "edit", "disabled": true, @@ -208,14 +210,15 @@ } }, "Item": { - "types": [ "equipment", "race", "weapon", "armor", "shield", "money" , "skill", "power", "language", "condition", "class"], + "types": [ "equipment", "race", "weapon", "armor", "shield", "skill", "power", "language", "condition", "class"], "templates": { "commonclassrace": { "weapons": { "short": false, "long": false, "twohanded": false, - "shotgun": false, + "shooting": false, + "polearm": false, "throwing": false }, "armors": { @@ -231,6 +234,7 @@ } }, "condition": { + "shortdescription": "", "description": "" }, "class": { @@ -247,6 +251,7 @@ "templates": ["commonclassrace"] }, "language": { + "shortdescription": "", "description": "" }, "skill": { @@ -303,11 +308,6 @@ "level4_2": "", "description": "" }, - "money" : { - "value": 0, - "quantity": 0, - "description": "" - }, "spell":{ "lore": "", "circle": 1, diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index 68864ea..bc783be 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -23,18 +23,36 @@ +
+ +
  • +
    + +
  • - + + + +
    + {{#each system.attributes as |attr key|}} + {{#if attr.isheader}} +
    + {{> systems/fvtt-warhero/templates/partial-actor-stat-block.html stat=attr key=key path="attributes" fieldClass="item-field-label-medium"}} +
    + {{/if}} + {{/each}} + +
    @@ -65,18 +83,47 @@
    + +
    +
      +
    • + +

      +
      +
    • + {{#each competency.weapons as |flag key|}} + {{#if flag}} +
    • + {{localize "WH.ui.weapons"}} {{key}} +
    • + {{/if}} + {{/each}} + {{#each competency.shields as |flag key|}} + {{#if flag}} +
    • + {{localize "WH.ui.shields"}} {{key}} +
    • + {{/if}} + {{/each}} + {{#each competency.armors as |flag key|}} + {{#if flag}} +
    • + {{localize "WH.ui.armors"}} {{key}} +
    • + {{/if}} + {{/each}} +
    +
    +
    + +
    +
      +
    • + +

      +
      +
    • + {{#each languages as |language key|}} +
    • + + {{language.name}} + +
       
      +
      + +
      +
    • + {{/each}} +
    +
    +
    @@ -242,6 +317,12 @@

    + + + + + + {{#each skills as |skill key|}}
  • @@ -249,6 +330,14 @@ src="{{skill.img}}" /> {{skill.name}} + {{#if skill.system.unlimited}} + N/A + N/A + {{else}} + {{skill.system.currentuse}} + {{skill.system.maxuse}} + {{/if}} +
     
    @@ -262,14 +351,19 @@
    • -

      +

      +
      + +
    • - {{#each languages as |language key|}} -
    • + {{#each conditions as |cond key|}} +
    • - {{language.name}} + src="{{cond.img}}" /> + {{cond.name}} + + {{cond.system.shortdescription}}
       
      @@ -280,6 +374,7 @@
    + diff --git a/templates/chat-generic-result.html b/templates/chat-generic-result.html index 44e2e4a..8de512c 100644 --- a/templates/chat-generic-result.html +++ b/templates/chat-generic-result.html @@ -15,20 +15,36 @@
      - {{#if stat}} -
    • {{localize stat.label}} : {{stat.value}}
    • + {{#if (eq mode "save")}} +
    • {{localize "WH.chat.save"}} {{localize stat.label}} : {{stat.save}}
    • + {{else}} + {{#if stat}} +
    • {{localize stat.label}} : {{stat.value}}
    • + {{/if}} {{/if}} + {{#if weapon}}
    • {{localize "WH.ui.weapon"}} : {{weapon.name}}
    • {{/if}} {{#if hasBM}}
    • Bonus/Malus : {{bonusMalus}}
    • {{/if}} -* + {{#if usemWeaponMalus}}
    • Multiple weapons malus : {{mWeaponMalus}}
    • {{/if}} +
    • Formula : {{diceFormula}}
    • + {{#if isCriticalSuccess}} +
    • Dice result : {{diceResult}}
    • + {{else}} + {{#if isCriticalFailure}} +
    • Dice result : {{diceResult}}
    • + {{else}} +
    • Dice result : {{diceResult}}
    • + {{/if}} + {{/if}} + {{#if power}}
    • {{localize "WH.ui.power"}} : {{power.name}}
    • {{{powerText}}}
    • diff --git a/templates/chat-parry-result.html b/templates/chat-parry-result.html index 73463f8..35e007b 100644 --- a/templates/chat-parry-result.html +++ b/templates/chat-parry-result.html @@ -17,6 +17,18 @@
      • {{localize stat.label}} : {{stat.value}}
      • Result : {{roll.total}}
      • + +
      • Formula : {{diceFormula}}
      • + {{#if isCriticalSuccess}} +
      • Dice result : {{diceResult}}
      • + {{else}} + {{#if isCriticalFailure}} +
      • Dice result : {{diceResult}}
      • + {{else}} +
      • Dice result : {{diceResult}}
      • + {{/if}} + {{/if}} + {{#if isSuccess}}
      • Parry success !
      • {{else}} diff --git a/templates/item-condition-sheet.html b/templates/item-condition-sheet.html index 3453352..38f0ed1 100644 --- a/templates/item-condition-sheet.html +++ b/templates/item-condition-sheet.html @@ -21,6 +21,10 @@
          +
        • + +
        • +
        diff --git a/templates/item-money-sheet.html b/templates/item-money-sheet.html deleted file mode 100644 index 5ed7909..0000000 --- a/templates/item-money-sheet.html +++ /dev/null @@ -1,28 +0,0 @@ -
        -
        - -
        -

        -
        -
        - - {{> systems/fvtt-warhero/templates/partial-item-nav.html}} - - {{!-- Sheet Body --}} -
        - - {{> systems/fvtt-warhero/templates/partial-item-description.html}} - -
        -
          -
        • - -
        • -
        • - -
        • -
        -
        - -
        -
        diff --git a/templates/item-poison-sheet.html b/templates/item-poison-sheet.html deleted file mode 100644 index 18b2eb5..0000000 --- a/templates/item-poison-sheet.html +++ /dev/null @@ -1,28 +0,0 @@ -
        -
        - -
        -

        -
        -
        - {{> systems/fvtt-warhero/templates/partial-item-nav.html}} - - {{!-- Sheet Body --}} -
        - -
        - - -
        - {{editor description target="system.description" button=true owner=owner editable=editable}} -
        -
        - -
        -
          -
        - -
        - -
        -
        \ No newline at end of file diff --git a/templates/item-skill-sheet.html b/templates/item-skill-sheet.html index 0b00490..f6866ff 100644 --- a/templates/item-skill-sheet.html +++ b/templates/item-skill-sheet.html @@ -18,21 +18,20 @@
      • - {{#if system.classskill}} -
      • - + +
      • + +
      • + + {{#if system.unlimited}} + + {{else}} +
      • + +
      • +
      • +
      • - - {{#if system.unlimited}} - - {{else}} -
      • - -
      • -
      • - -
      • - {{/if}} {{/if}}
      diff --git a/templates/partial-actor-stat-block.html b/templates/partial-actor-stat-block.html index ea155e2..d99bfe2 100644 --- a/templates/partial-actor-stat-block.html +++ b/templates/partial-actor-stat-block.html @@ -37,7 +37,7 @@

      - + {{localize "WH.ui.save"}}