From e573f5b3829ae0a3cf1dabbeb3a66928ee7e9201 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Fri, 24 Mar 2023 13:29:19 +0100 Subject: [PATCH] New combat features --- lang/en.json | 6 +++- modules/warhero-actor-sheet.js | 3 +- modules/warhero-actor.js | 34 +++++++++++++----- system.json | 4 +-- template.json | 17 ++++++++- templates/actor-sheet.html | 63 ++++++++++++++++++--------------- templates/item-class-sheet.html | 4 +++ 7 files changed, 89 insertions(+), 42 deletions(-) diff --git a/lang/en.json b/lang/en.json index dd9d93e..1a49654 100644 --- a/lang/en.json +++ b/lang/en.json @@ -203,7 +203,11 @@ "WH.ui.ignoreeffect": "Ignore effect", "WH.ui.raceSkills": "Race skills", "WH.ui.identified": "Identified", - + "WH.ui.isclasssecondary": "Secondary class ?", + "WH.ui.secondaryclass": "Super warhero", + "WH.ui.meleedamagebonus": "Melee damage bonus", + "WH.ui.rangeddamagebonus": "Ranged damage bonus", + "WH.ui.bodyslots": "Body", "WH.ui.containerslot": "Containers", diff --git a/modules/warhero-actor-sheet.js b/modules/warhero-actor-sheet.js index 9d0b7ca..67f5afa 100644 --- a/modules/warhero-actor-sheet.js +++ b/modules/warhero-actor-sheet.js @@ -58,7 +58,8 @@ export class WarheroActorSheet extends ActorSheet { subActors: duplicate(this.actor.getSubActors()), competency: this.actor.getCompetency(), race: duplicate(race), - classes: duplicate(this.actor.getClasses()), + mainClass: this.actor.getMainClass(), + secondaryClass: this.actor.getSecondaryClass(), totalMoney: this.actor.computeTotalMoney(), equipments: duplicate(this.actor.getEquipmentsOnly()), //moneys: duplicate(this.actor.getMoneys()), diff --git a/modules/warhero-actor.js b/modules/warhero-actor.js index 645b8c4..30ec74b 100644 --- a/modules/warhero-actor.js +++ b/modules/warhero-actor.js @@ -168,9 +168,13 @@ export class WarheroActor extends Actor { return race[0] ?? []; } /* -------------------------------------------- */ - getClass() { - let classWH = this.items.filter(item => item.type == 'class') - return classWH[0] ?? []; + getMainClass() { + let classWH = this.items.find(item => item.type == 'class' && !item.system.issecondary) + return classWH + } + getSecondaryClass() { + let classWH = this.items.find(item => item.type == 'class' && item.system.issecondary) + return classWH } getClasses() { let comp = duplicate(this.items.filter(item => item.type == "class") || []); @@ -289,6 +293,14 @@ export class WarheroActor extends Actor { formula += "+" + Math.floor(this.system.statistics.str.value * 1) weapon.damageFormula2Hands = weapon.system.damage2hands + "+" + Math.floor(this.system.statistics.str.value * 1.5) } + if (weapon.system.weapontype == "throwing" || weapon.system.weapontype == "shooting") { + formula += "+"+this.system.secondary.rangeddamagebonus.value + } else if ( weapon.system.weapontype != "special" ) { + formula += "+"+this.system.secondary.meleedamagebonus.value + if (weapon.damageFormula2Hands) { + weapon.damageFormula2Hands += "+"+this.system.secondary.meleedamagebonus.value + } + } weapon.damageFormula = formula } /* -------------------------------------------- */ @@ -496,17 +508,23 @@ export class WarheroActor extends Actor { } getCompetency() { let myRace = this.getRace() - let myClass = this.getClass() + let myClass1 = this.getMainClass() + let myClass2 = this.getSecondaryClass() let competency = { weapons: {}, armors: {}, shields: {} } if (myRace.system) { this.updateCompetency(competency.weapons, myRace.system.weapons, game.system.warhero.config.weaponTypes) this.updateCompetency(competency.armors, myRace.system.armors, game.system.warhero.config.armorTypes) this.updateCompetency(competency.shields, myRace.system.shields, game.system.warhero.config.shieldTypes) } - if (myClass.system) { - this.updateCompetency(competency.weapons, myClass.system.weapons, game.system.warhero.config.weaponTypes) - this.updateCompetency(competency.armors, myClass.system.armors, game.system.warhero.config.armorTypes) - this.updateCompetency(competency.shields, myClass.system.shields, game.system.warhero.config.shieldTypes) + if (myClass1 && myClass1.system) { + this.updateCompetency(competency.weapons, myClass1.system.weapons, game.system.warhero.config.weaponTypes) + this.updateCompetency(competency.armors, myClass1.system.armors, game.system.warhero.config.armorTypes) + this.updateCompetency(competency.shields, myClass1.system.shields, game.system.warhero.config.shieldTypes) + } + if (myClass2 && myClass2.system) { + this.updateCompetency(competency.weapons, myClass2.system.weapons, game.system.warhero.config.weaponTypes) + this.updateCompetency(competency.armors, myClass2.system.armors, game.system.warhero.config.armorTypes) + this.updateCompetency(competency.shields, myClass2.system.shields, game.system.warhero.config.shieldTypes) } return competency } diff --git a/system.json b/system.json index baff51a..800c748 100644 --- a/system.json +++ b/system.json @@ -107,7 +107,7 @@ "styles": [ "styles/simple.css" ], - "version": "10.0.44", + "version": "10.0.46", "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.44.zip", + "download": "https://www.uberwald.me/gitea/uberwald/fvtt-warhero/archive/fvtt-warhero-10.0.46.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 73de2bb..6e4606b 100644 --- a/template.json +++ b/template.json @@ -11,7 +11,7 @@ "biodata": { "class": "", "age": 0, - "size": 3, + "size": "medium", "weight": "", "height": "", "hair": "", @@ -172,6 +172,20 @@ "iscombat": true, "value": 0 }, + "meleedamagebonus": { + "label": "WH.ui.meleedamagebonus", + "abbrev": "meleedamagebonus", + "iscombat": true, + "style": "edit", + "value": 0 + }, + "rangeddamagebonus": { + "label": "WH.ui.rangeddamagebonus", + "abbrev": "rangeddamagebonus", + "iscombat": true, + "style": "edit", + "value": 0 + }, "parrybonus": { "label": "WH.ui.parrybonus", "abbrev": "parrybonus", @@ -360,6 +374,7 @@ "templates": [ "commonclassrace" ], + "issecondary": false, "description": "" }, "race": { diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index bba5539..937ea35 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -27,30 +27,42 @@ - {{#if (count classes)}} - {{#each classes as |class idx|}} -
  • - - - -
    - -
    -
  • - {{/each}} - {{else}} -
  • +
  • - - + {{#if mainClass}} + + +
    + +
    + {{else}} + + {{/if}} +
  • +
  • + + {{#if secondaryClass}} + +
    + {{else}} + + {{/if}}
  • - {{/if}}
  • +    + +
  • @@ -167,6 +179,9 @@ {{#with system.attributes.ini as |stat|}} {{> systems/fvtt-warhero/templates/partial-actor-stat-block.html stat=stat key="ini" path="attributes" fieldClass="item-field-label-vlong"}} {{/with}} + {{#with system.secondary.meleedamagebonus as |stat|}} + {{> systems/fvtt-warhero/templates/partial-actor-stat-block.html stat=stat key="meleedamagebonus" path="secondary" fieldClass="item-field-label-vlong"}} + {{/with}} @@ -592,19 +610,6 @@