From c8be217e7eb9b9c458b557da6b97683e116ae98d Mon Sep 17 00:00:00 2001 From: U~man Date: Thu, 2 Jul 2020 18:13:08 +0200 Subject: [PATCH] ENH: Abilities --- src/lang/en.json | 7 +- src/module/actor/character-sheet.js | 1 + src/module/actor/entity.js | 40 ++++++++++++ src/scss/actor-base.scss | 8 +++ src/scss/character.scss | 12 +++- src/scss/item.scss | 6 +- src/template.json | 7 +- .../actors/dialogs/tweaks-dialog.html | 13 ++++ .../partials/character-abilities-tab.html | 64 ++++++++----------- .../partials/character-attributes-tab.html | 13 ++++ .../actors/partials/character-header.html | 5 +- src/templates/items/ability-sheet.html | 18 +++++- 12 files changed, 145 insertions(+), 49 deletions(-) diff --git a/src/lang/en.json b/src/lang/en.json index a48e864..2a6f65d 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -16,6 +16,7 @@ "OSE.Alignment": "Alignment", "OSE.Level": "Level", "OSE.Experience": "Experience", + "OSE.ExperienceBonus": "Bonus Experience", "OSE.Treasure": "Treasure type", "OSE.Size": "Size", "OSE.Morale": "Morale", @@ -109,6 +110,8 @@ "OSE.items.Melee": "Melee", "OSE.items.Missile": "Missile", "OSE.items.Slow": "Slow", + "OSE.items.ArmorAC": "AC", + "OSE.items.ArmorAAC": "AAC", "OSE.spells.Memorized": "Memorized", "OSE.spells.Cast": "Cast", @@ -117,6 +120,6 @@ "OSE.spells.Class": "Class", "OSE.spells.Duration": "Duration", "OSE.spells.Level": "Level", - "OSE.items.ArmorAC": "AC", - "OSE.items.ArmorAAC": "AAC" + + "OSE.abilities.Requirements": "Requirements" } \ No newline at end of file diff --git a/src/module/actor/character-sheet.js b/src/module/actor/character-sheet.js index fe569fd..de05bab 100644 --- a/src/module/actor/character-sheet.js +++ b/src/module/actor/character-sheet.js @@ -51,6 +51,7 @@ export class OseActorSheetCharacter extends OseActorSheet { data.config.ascendingAC = game.settings.get("ose", "ascendingAC"); data.config.individualInit = game.settings.get("ose", "individualInit"); + data.mods = this.actor.computeModifiers(); return data; } diff --git a/src/module/actor/entity.js b/src/module/actor/entity.js index 5262f04..f3fd59f 100644 --- a/src/module/actor/entity.js +++ b/src/module/actor/entity.js @@ -41,4 +41,44 @@ export class OseActor extends Actor { title: `${label} ${game.i18n.localize('OSE.AbilityCheck')}`, }); } + + computeModifiers() { + let _valueToMod = (val) => { + switch (val) { + case 3: + return -3; + case 4: + case 5: + return -2; + case 6: + case 7: + case 8: + return -1; + case 9: + case 10: + case 11: + case 12: + return 0; + case 13: + case 14: + case 15: + return 1; + case 16: + case 17: + return 2; + case 18: + return 3; + default: + return 0; + } + }; + return { + str: _valueToMod(this.data.data.scores.str.value), + int: _valueToMod(this.data.data.scores.int.value), + dex: _valueToMod(this.data.data.scores.dex.value), + cha: _valueToMod(this.data.data.scores.cha.value), + wis: _valueToMod(this.data.data.scores.wis.value), + con: _valueToMod(this.data.data.scores.con.value), + } + } } diff --git a/src/scss/actor-base.scss b/src/scss/actor-base.scss index 189ded6..2ee8b45 100644 --- a/src/scss/actor-base.scss +++ b/src/scss/actor-base.scss @@ -95,6 +95,7 @@ margin: 0; padding: 0; .attribute { + position: relative; margin: 10px 2px; border: 1px solid $colorTan; .attribute-name { @@ -109,6 +110,13 @@ display: flex; flex-direction: row; } + .attribute-mod { + position: absolute; + color: $colorTan; + right: 5px; + top: 0; + font-size: 13px; + } } } .attribute-group { diff --git a/src/scss/character.scss b/src/scss/character.scss index f32a585..cab8782 100644 --- a/src/scss/character.scss +++ b/src/scss/character.scss @@ -12,6 +12,13 @@ /* ----------------------------------------- */ .sheet-header { + .xp-bonus { + top: -15px; + right: 3px; + color: $colorTan; + font-size: 10px; + position: absolute; + } } /* ----------------------------------------- */ @@ -20,7 +27,6 @@ .sheet-body { .inventory { overflow: auto; - height: 520px; .header-spells { line-height: 30px; } @@ -60,7 +66,9 @@ } .item-entry { &:nth-child(even) { - background: rgba(0, 0, 0, 0.1); + .item { + background: rgba(0, 0, 0, 0.1); + } } } .item { diff --git a/src/scss/item.scss b/src/scss/item.scss index 0ef93c2..9463920 100644 --- a/src/scss/item.scss +++ b/src/scss/item.scss @@ -1,6 +1,8 @@ .ose.sheet.item { .profile-img { border: none; + flex: 0 0 84px; + height: 84px; } .sheet-body { .stats { @@ -26,10 +28,10 @@ } } .editor { - height: 255px; + height: 240px; } .weapon-editor .editor { - height: 230px; + height: 215px; } } } \ No newline at end of file diff --git a/src/template.json b/src/template.json index ee9c1e3..a0ebbc9 100644 --- a/src/template.json +++ b/src/template.json @@ -78,8 +78,11 @@ "alignment": "", "literate": false, "level": 1, - "xp": 0, - "xpmod": 0 + "xp": { + "next": 0, + "value": 0, + "bonus": 0 + } }, "scores": { "str": { diff --git a/src/templates/actors/dialogs/tweaks-dialog.html b/src/templates/actors/dialogs/tweaks-dialog.html index 893a513..964c834 100644 --- a/src/templates/actors/dialogs/tweaks-dialog.html +++ b/src/templates/actors/dialogs/tweaks-dialog.html @@ -23,6 +23,19 @@ /> + {{#if (eq this.type 'character')}} +
+ +
+ +
+
+ {{/if}}