From 3a8ad674bd5830728e0d24a8a16e4c0fd2e6bcd1 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Mon, 27 Feb 2023 22:04:03 +0100 Subject: [PATCH] Add new items --- lang/en.json | 70 +++++++++++++++++++++++- modules/warhero-actor-sheet.js | 5 ++ modules/warhero-actor.js | 23 +++++++- modules/warhero-config.js | 36 +++++++++++++ modules/warhero-utility.js | 4 ++ system.json | 4 +- template.json | 71 +++++++++++++++++++++++-- templates/actor-sheet.html | 54 ++++++++++++++++++- templates/item-classitem-sheet.html | 32 +++++++++++ templates/item-competency-sheet.html | 24 +++++++++ templates/item-condition-sheet.html | 57 ++++++++++++++++++++ templates/item-poison-sheet.html | 64 ++++++++++++++++++++++ templates/item-potion-sheet.html | 36 +++++++++++++ templates/item-skill-sheet.html | 4 ++ templates/item-trap-sheet.html | 40 ++++++++++++++ templates/partial-actor-stat-block.html | 5 ++ 16 files changed, 520 insertions(+), 9 deletions(-) create mode 100644 templates/item-classitem-sheet.html create mode 100644 templates/item-competency-sheet.html create mode 100644 templates/item-poison-sheet.html create mode 100644 templates/item-potion-sheet.html create mode 100644 templates/item-trap-sheet.html diff --git a/lang/en.json b/lang/en.json index fdbdef4..479f9dc 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1,4 +1,29 @@ { + "ACTOR": { + "TypeCharacter": "Character", + "TypeNpc": "NPC", + "TypeMonster": "Monster" + }, + "ITEM": { + "TypeWeapon": "Weapon", + "TypeEquipment": "Equipment", + "TypeRace": "Race", + "TypeArmor": "Armor", + "TypeShield": "Shield", + "TypeSkill": "Skill", + "TypePower": "Power", + "TypeLanguage": "Language", + "TypeCondition": "Condition", + "TypeClass": "Class", + "TypeGenericitem": "Class", + "TypeMoney": "Money", + "TypePotion": "Potion", + "TypePoison": "Poison", + "TypeTrap": "Trap", + "TypeClassitem": "Class item", + "TypeCompetency": "Competency" + }, + "WH.conf.short": "Short", "WH.conf.long": "Long", "WH.conf.twohanded": "Two-Handed", @@ -79,6 +104,7 @@ "WH.ui.classSkills": "Class Skills", "WH.ui.skills": "Skills based on level", "WH.ui.isclassskill": "Class skill ?", + "WH.ui.israceskill": "Race skill ?", "WH.ui.unlimited": "Unlimited use ?", "WH.ui.currentuse": "Current use", "WH.ui.maxuse": "Max use", @@ -120,7 +146,46 @@ "WH.ui.providedslot": "Provided slot", "WH.ui.skilllevelacquired": "Acquired at level", "WH.ui.totalmoney": "Total money owned", - + "WH.ui.preparetime": "Time to prepare", + "WH.ui.durationrounds": "Duration in rounds", + "WH.ui.application": "Application", + "WH.ui.savesdc": "Saves DC", + "WH.ui.savetype": "Save type", + "WH.ui.Touch": "Touch", + "WH.ui.Ingestion": "Ingestion", + "WH.ui.Weapon": "Weapon", + "WH.ui.halfdamage": "Half-damage", + "WH.ui.ignore": "Ignore effect", + "WH.ui.dcfind": "DC to find", + "WH.ui.dcdisable": "DC to disable", + "WH.ui.throwtohit": "Throw to hit", + "WH.ui.mandatoryfor": "Mandatory for", + "WH.ui.generic": "Generic", + "WH.ui.bless": "Bless", + "WH.ui.spell": "Spell", + "WH.ui.poison": "Poison", + "WH.ui.disease": "Disease", + "WH.ui.curse": "Curse", + "WH.ui.permanent": "Permanent", + "WH.ui.temporary": "Temporary", + "WH.ui.begin": "Begin", + "WH.ui.specialduration": "Special duration", + "WH.ui.infinite": "Infinite", + "WH.uiwithineor": "Within end of round", + "WH.ui.beginr": "Beginning of round", + "WH.ui.nextr": "Next round", + "WH.ui.nextcombat": "Next combat", + "WH.ui.untilendcombat": "Until end of combat", + "WH.ui.beginturn": "Beginning of turn", + "WH.ui.endturn": "End of turn", + "WH.ui.durationvalue": "Duration value", + "WH.ui.durationunit": "Duration unit", + "WH.ui.dcsave": "DC save", + "WH.ui.incubationtime": "Incubation time", + "WH.ui.diseaseduration": "Disease duration", + "WH.ui.ignoreeffect": "Ignore effect", + "WH.ui.raceSkills": "Race skills", + "WH.chat.save": "Save", "WH.chat.mweaponmalus": "Multiple weapons malus ", "WH.chat.diceresult": "Dice result", @@ -132,5 +197,6 @@ "WH.chat.power": "Power", "WH.chat.powerlevel": "Power Level", - "WH.notif.skillmaxuse": "Maximum skill usage reach - Use is not allowed" + "WH.notif.skillmaxuse": "Maximum skill usage reach - Use is not allowed", + "WH.notif.toomanyuses": "Maximum use reach - Roll is not allowed" } \ No newline at end of file diff --git a/modules/warhero-actor-sheet.js b/modules/warhero-actor-sheet.js index 12f30e7..caa0238 100644 --- a/modules/warhero-actor-sheet.js +++ b/modules/warhero-actor-sheet.js @@ -42,7 +42,9 @@ export class WarheroActorSheet extends ActorSheet { cssClass: this.isEditable ? "editable" : "locked", system: objectData, limited: this.object.limited, + compentencyItems:this.actor.getCompetencyItems( ), skills: this.actor.getNormalSkills( ), + raceSkills: this.actor.getRaceSkills( ), classSkills: this.actor.getClassSkills( ), languages: this.actor.getLanguages( ), weapons: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getWeapons()) ), @@ -65,6 +67,9 @@ export class WarheroActorSheet extends ActorSheet { editScore: this.options.editScore, isGM: game.user.isGM } + // Dynamic patch + formData.system.secondary.counterspell.hasmax = false + // Race mngt if ( race && race.name) { formData.hpprogression = game.system.warhero.config.progressionList[race.system.hpprogresion] } diff --git a/modules/warhero-actor.js b/modules/warhero-actor.js index 139577e..7c20d10 100644 --- a/modules/warhero-actor.js +++ b/modules/warhero-actor.js @@ -258,6 +258,11 @@ export class WarheroActor extends Actor { WarheroUtility.sortArrayObjectsByName(comp) return comp } + getRaceSkills() { + let comp = this.items.filter(it => it.type == "skill" && it.system.raceskill) + WarheroUtility.sortArrayObjectsByName(comp) + return comp + } getClassSkills() { let comp = this.items.filter(it => it.type == "skill" && it.system.classskill) WarheroUtility.sortArrayObjectsByName(comp) @@ -312,7 +317,10 @@ export class WarheroActor extends Actor { /* ------------------------------------------- */ getEquipments() { - return this.items.filter(item => item.type == 'shield' || item.type == 'armor' || item.type == "weapon" || item.type == "equipment"); + return this.items.filter(item => item.type == 'shield' || item.type == 'armor' || item.type == "weapon" || item.type == "equipment" || item.type == "potion" || item.type == "poison"|| item.type == "trap" || item.type == "classitem"); + } + getCompetencyItems() { + return duplicate(this.items.filter(item => item.type == "competency") || []) } /* ------------------------------------------- */ getEquipmentsOnly() { @@ -655,6 +663,14 @@ export class WarheroActor extends Actor { this.update({ 'system.attributes.mana': mana }) return true } + + /* -------------------------------------------- */ + incrementUse(rollData) { + let stat = duplicate(this.system[rollData.mode][rollData.statKey]) + stat.nbuse++ + this.update( { [`system.${rollData.mode}.${rollData.statKey}`]: stat }) + } + /* -------------------------------------------- */ getCommonRollData() { let rollData = WarheroUtility.getBasicRollData() @@ -672,11 +688,16 @@ export class WarheroActor extends Actor { let stat = duplicate(this.system[rollType][rollKey]) let rollData = this.getCommonRollData() rollData.mode = rollType + rollData.statKey = rollKey rollData.stat = stat if (stat && stat.stat) { rollData.statBonus = duplicate(this.system.statistics[stat.stat]) } + if ( stat.hasuse && stat.nbuse >= stat.maxuse) { + ui.notifications.warn(game.i18n.localize("WH.notif.toomanyuses")) + return + } if (rollKey == "parrybonustotal") { WarheroUtility.rollParry(rollData) return diff --git a/modules/warhero-config.js b/modules/warhero-config.js index eba4ed6..dde1e60 100644 --- a/modules/warhero-config.js +++ b/modules/warhero-config.js @@ -45,6 +45,42 @@ export const WARHERO_CONFIG = { "high": "High (+6HP/Lvl)", "medium": "Medium (+4HP/Lvl)", "low": "Low (+2 HP/Lvl)" + }, + + poisonApplication: { + touch: "WH.ui.Touch", + ingestion: "WH.ui.Ingestion", + weapon: "WH.ui.Weapon" + }, + + saveType: { + halfdmg: "WH.ui.halfdamage", + ignore: "WH.ui.ignoreeffect" + }, + + conditionType : { + generic: "WH.ui.generic", + bless: "WH.ui.bless", + spell: "WH.ui.spell", + disease: "WH.ui.disease", + poison: "WH.ui.poison", + curse: "WH.u,i.curse" + }, + + conditionDuration: { + permanent: "WH.ui.permanent", + temporary: "WH.ui.temporary" + }, + + conditionSpecialDuration : { + infinite: "WH.ui.infinite", + withineor: "WH.uiwithineor", + beginr: "WH.ui.beginr", + nextr: "WH.ui.nextr", + nextcombat: "WH.ui.nextcombat", + untilendcombat: "WH.ui.untilendcombat", + beginturn: "WH.ui.beginturn", + endturn: "WH.ui.endturn" } } \ No newline at end of file diff --git a/modules/warhero-utility.js b/modules/warhero-utility.js index ecff4da..7b32e56 100644 --- a/modules/warhero-utility.js +++ b/modules/warhero-utility.js @@ -618,6 +618,10 @@ export class WarheroUtility { rollData.isCriticalFailure = true } + if ( rollData.stat.hasuse ) { + actor.incrementUse(rollData) + } + let msg = await this.createChatWithRollMode(rollData.alias, { content: await renderTemplate(`systems/fvtt-warhero/templates/chat-generic-result.html`, rollData) }) diff --git a/system.json b/system.json index b76b3f5..4000fff 100644 --- a/system.json +++ b/system.json @@ -107,7 +107,7 @@ "styles": [ "styles/simple.css" ], - "version": "10.0.33", + "version": "10.0.35", "compatibility": { "minimum": "10", "verified": "10", @@ -115,7 +115,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.33.zip", + "download": "https://www.uberwald.me/gitea/uberwald/fvtt-warhero/archive/fvtt-warhero-10.0.35.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 f578182..b25d5fd 100644 --- a/template.json +++ b/template.json @@ -184,10 +184,13 @@ "stat": "min", "abbrev": "counterspell", "style": "edit", - "hasmax": true, + "hasmax": false, "roll": true, "max": 1, - "value": 0 + "value": 0, + "hasuse": true, + "nbuse": 0, + "maxuse": 0 }, "createitem": { "label": "WH.ui.createitem", @@ -241,7 +244,12 @@ "condition", "class", "genericitem", - "money" + "money", + "potion", + "poison", + "trap", + "classitem", + "competency" ], "templates": { "commonclassrace": { @@ -265,6 +273,53 @@ } } }, + "competency": { + "description": "" + }, + "potion": { + "cost": 0, + "quantity": 1, + "slotused": 1, + "slotlocation": "armor", + "alchemycost": "", + "preparetime": "", + "durationround": 0, + "description": "" + }, + "poison": { + "cost": 0, + "quantity": 1, + "slotused": 1, + "slotlocation": "armor", + "application": "", + "preparecost": "", + "preparetime": "", + "damageroll": "", + "durationround": 0, + "savesdc": 0, + "savetype": "", + "description": "" + }, + "trap": { + "cost": 0, + "quantity": 1, + "slotused": 1, + "slotlocation": "armor", + "dcfind": 0, + "dcdisable": 0, + "throwtohit": 0, + "damageroll": "", + "description": "" + }, + "classitem": { + "cost": 0, + "quantity": 1, + "slotused": 1, + "slotlocation": "armor", + "class": "", + "mandatoryfor": "", + "description": "" + }, "money": { "quantity": 0, "slotlocation": "backpack", @@ -274,7 +329,16 @@ "description": "" }, "condition": { + "conditiontype": "", + "duration": "", + "begin": "", + "specialduration": "", + "durationvalue": 0, + "durationunit": "", "shortdescription": "", + "dcsave": 0, + "incubationtime": "", + "diseaseduration": "", "description": "" }, "class": { @@ -299,6 +363,7 @@ "description": "" }, "skill": { + "raceskill": false, "classskill": false, "unlimited": false, "acquiredatlevel": 0, diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index 9920504..f04279b 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -75,7 +75,7 @@ {{!-- Sheet Body --}}
- {{!-- Skills Tab --}} + {{!-- Main Tab --}}
@@ -117,6 +117,20 @@ {{/if}} {{/each}} + + {{#each compentencyItems as |comp key|}} +
  • + + {{comp.name}} + +
     
    +
    + +
    +
  • + {{/each}} +
    @@ -283,6 +297,44 @@
    +
    +
      +
    • + +

      +
      + + + + + + +
    • + {{#each raceSkills as |skill key|}} +
    • + + {{skill.name}} + + {{#if skill.system.unlimited}} + N/A + N/A + {{else}} + {{skill.system.currentuse}} + ( -/+) + + {{skill.system.maxuse}} + {{/if}} + +
       
      +
      + +
      +
    • + {{/each}} +
    +
    +
    • diff --git a/templates/item-classitem-sheet.html b/templates/item-classitem-sheet.html new file mode 100644 index 0000000..88d05f5 --- /dev/null +++ b/templates/item-classitem-sheet.html @@ -0,0 +1,32 @@ +
      +
      + +
      +

      +
      +
      + + {{> systems/fvtt-warhero/templates/partial-item-nav.html}} + + {{!-- Sheet Body --}} +
      + + {{> systems/fvtt-warhero/templates/partial-item-description.html}} + +
      +
        +
      • + +
      • + +
      • + +
      • + + {{> systems/fvtt-warhero/templates/partial-item-common-equipment.html}} + +
      + +
      +
      +
      diff --git a/templates/item-competency-sheet.html b/templates/item-competency-sheet.html new file mode 100644 index 0000000..63f8b2c --- /dev/null +++ b/templates/item-competency-sheet.html @@ -0,0 +1,24 @@ +
      +
      + +
      +

      +
      +
      + {{> systems/fvtt-warhero/templates/partial-item-nav.html}} + + {{!-- Sheet Body --}} +
      + + {{> systems/fvtt-warhero/templates/partial-item-description.html}} + + +
      +
        + +
      + +
      + +
      +
      \ No newline at end of file diff --git a/templates/item-condition-sheet.html b/templates/item-condition-sheet.html index e1e4d4a..685db2c 100644 --- a/templates/item-condition-sheet.html +++ b/templates/item-condition-sheet.html @@ -16,6 +16,63 @@
        +
      • + +
      • + +
      • + +
      • + +
      • + +
      • + +
      • + +
      • + +
      • + +
      • + +
      • + +
      • + + {{#if (eq conditiontype "disease")}} +
      • + +
      • + +
      • + +
      • + +
      • + +
      • + + {{/if}} +
      • diff --git a/templates/item-poison-sheet.html b/templates/item-poison-sheet.html new file mode 100644 index 0000000..697a3d6 --- /dev/null +++ b/templates/item-poison-sheet.html @@ -0,0 +1,64 @@ +
        +
        + +
        +

        +
        +
        + + {{> systems/fvtt-warhero/templates/partial-item-nav.html}} + + {{!-- Sheet Body --}} +
        + + {{> systems/fvtt-warhero/templates/partial-item-description.html}} + +
        +
          +
        • + +
        • + +
        • + +
        • + +
        • + +
        • + +
        • + +
        • + +
        • + +
        • + +
        • + +
        • + +
        • + +
        • + + {{> systems/fvtt-warhero/templates/partial-item-common-equipment.html}} + +
        + +
        +
        +
        diff --git a/templates/item-potion-sheet.html b/templates/item-potion-sheet.html new file mode 100644 index 0000000..295b0b2 --- /dev/null +++ b/templates/item-potion-sheet.html @@ -0,0 +1,36 @@ +
        +
        + +
        +

        +
        +
        + + {{> systems/fvtt-warhero/templates/partial-item-nav.html}} + + {{!-- Sheet Body --}} +
        + + {{> systems/fvtt-warhero/templates/partial-item-description.html}} + +
        +
          +
        • + +
        • + +
        • + +
        • + +
        • + +
        • + + {{> systems/fvtt-warhero/templates/partial-item-common-equipment.html}} + +
        + +
        +
        +
        diff --git a/templates/item-skill-sheet.html b/templates/item-skill-sheet.html index 4800a2a..fa9bab5 100644 --- a/templates/item-skill-sheet.html +++ b/templates/item-skill-sheet.html @@ -15,6 +15,10 @@
          +
        • + +
        • +
        • diff --git a/templates/item-trap-sheet.html b/templates/item-trap-sheet.html new file mode 100644 index 0000000..0ff0c4b --- /dev/null +++ b/templates/item-trap-sheet.html @@ -0,0 +1,40 @@ +
          +
          + +
          +

          +
          +
          + + {{> systems/fvtt-warhero/templates/partial-item-nav.html}} + + {{!-- Sheet Body --}} +
          + + {{> systems/fvtt-warhero/templates/partial-item-description.html}} + +
          +
            +
          • + +
          • + +
          • + +
          • + +
          • + +
          • + +
          • + +
          • + + {{> systems/fvtt-warhero/templates/partial-item-common-equipment.html}} + +
          + +
          +
          +
          diff --git a/templates/partial-actor-stat-block.html b/templates/partial-actor-stat-block.html index 232ea77..b70fefc 100644 --- a/templates/partial-actor-stat-block.html +++ b/templates/partial-actor-stat-block.html @@ -31,6 +31,11 @@ {{#if hasmax}} {{/if}} + {{#if hasuse}} + + + {{/if}} + {{/if}} {{#if hassave}}