From e36f30a7872e31a2d66e41b1e927202613e306d0 Mon Sep 17 00:00:00 2001 From: Johannes Loher Date: Wed, 13 Jan 2021 17:20:25 +0100 Subject: [PATCH] Add special abilities to creature sheet --- src/lang/de.json | 1 + src/lang/en.json | 1 + src/module/actor/actor.ts | 4 +- src/module/actor/{ => sheets}/actor-sheet.ts | 10 ++- src/module/actor/sheets/character-sheet.ts | 11 ++++ src/module/actor/sheets/creature-sheet.ts | 11 ++++ src/module/ds4.ts | 9 ++- src/templates/actor/creature-sheet.hbs | 6 +- .../actor/partials/items-overview.hbs | 2 +- .../special-creature-abilites-overview.hbs | 61 +++++++++++++++++++ .../actor/partials/spells-overview.hbs | 2 +- .../actor/partials/talents-overview.hbs | 4 +- 12 files changed, 107 insertions(+), 15 deletions(-) rename src/module/actor/{ => sheets}/actor-sheet.ts (96%) create mode 100644 src/module/actor/sheets/character-sheet.ts create mode 100644 src/module/actor/sheets/creature-sheet.ts create mode 100644 src/templates/actor/partials/special-creature-abilites-overview.hbs diff --git a/src/lang/de.json b/src/lang/de.json index ba6d5569..aafc8506 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -11,6 +11,7 @@ "DS4.HeadingTalents": "Talente & Fähigkeiten", "DS4.HeadingSpells": "Zaubersprüche", "DS4.HeadingDescription": "Beschreibung", + "DS4.HeadingSpecialCreatureAbilites": "Besondere Fähigkeiten", "DS4.AttackType": "Angriffs Typ", "DS4.AttackTypeAbbr": "AT", "DS4.WeaponBonus": "Waffen Bonus", diff --git a/src/lang/en.json b/src/lang/en.json index 3e6fdc93..2c74d9d9 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -11,6 +11,7 @@ "DS4.HeadingTalents": "Talents & Abilities", "DS4.HeadingSpells": "Spells", "DS4.HeadingDescription": "Description", + "DS4.HeadingSpecialCreatureAbilites": "Special Abilites", "DS4.AttackType": "Attack Type", "DS4.AttackTypeAbbr": "AT", "DS4.WeaponBonus": "Weapon Bonus", diff --git a/src/module/actor/actor.ts b/src/module/actor/actor.ts index 9d4ac8e0..29d80199 100644 --- a/src/module/actor/actor.ts +++ b/src/module/actor/actor.ts @@ -33,16 +33,16 @@ export class DS4Actor extends Actor "weapon", "armor", "shield", - "spell", "trinket", "equipment", + "spell", "talent", "racialAbility", "language", "alphabet", ]; case "creature": - return ["weapon", "armor", "spell", "specialCreatureAbility"]; + return ["weapon", "armor", "shield", "trinket", "equipment", "spell", "specialCreatureAbility"]; default: []; } diff --git a/src/module/actor/actor-sheet.ts b/src/module/actor/sheets/actor-sheet.ts similarity index 96% rename from src/module/actor/actor-sheet.ts rename to src/module/actor/sheets/actor-sheet.ts index d8a3b6dc..bfb58b01 100644 --- a/src/module/actor/actor-sheet.ts +++ b/src/module/actor/sheets/actor-sheet.ts @@ -1,7 +1,7 @@ -import { DS4Item } from "../item/item"; -import { DS4ItemDataType, ItemType } from "../item/item-data"; -import { DS4Actor } from "./actor"; -import { DS4ActorDataType } from "./actor-data"; +import { DS4Item } from "../../item/item"; +import { DS4ItemDataType, ItemType } from "../../item/item-data"; +import { DS4Actor } from "../actor"; +import { DS4ActorDataType } from "../actor-data"; /** * Extend the basic ActorSheet with some very simple modifications @@ -14,7 +14,6 @@ export class DS4ActorSheet extends ActorSheet {{localize 'DS4.HeadingInventory'}} - {{localize 'DS4.HeadingDescription'}} + {{localize 'DS4.HeadingSpecialCreatureAbilites'}} {{localize 'DS4.HeadingSpells'}} + {{localize 'DS4.HeadingDescription'}} {{!-- Sheet Body --}} @@ -62,6 +63,9 @@ {{!-- Items Tab --}} {{> systems/ds4/templates/actor/partials/items-overview.hbs}} + {{!-- Special Creature Abilities Tab --}} + {{> systems/ds4/templates/actor/partials/special-creature-abilites-overview.hbs}} + {{!-- Spells Tab --}} {{> systems/ds4/templates/actor/partials/spells-overview.hbs}} diff --git a/src/templates/actor/partials/items-overview.hbs b/src/templates/actor/partials/items-overview.hbs index 4dbd269b..a76c714e 100644 --- a/src/templates/actor/partials/items-overview.hbs +++ b/src/templates/actor/partials/items-overview.hbs @@ -1,5 +1,5 @@ {{!-- TODO: For items list: only show header, if list is not empty --}} - +{{!-- TODO: Refactor to avoid code duplication with special-creature-abilites-overview and talents-overview --}} {{!-- ======================================================================== --}} {{!-- INLINE PARTIAL DEFINITIONS --}} diff --git a/src/templates/actor/partials/special-creature-abilites-overview.hbs b/src/templates/actor/partials/special-creature-abilites-overview.hbs new file mode 100644 index 00000000..28637149 --- /dev/null +++ b/src/templates/actor/partials/special-creature-abilites-overview.hbs @@ -0,0 +1,61 @@ +{{!-- TODO: Refactor to avoid code duplication with items-overview and talents-overview --}} + +{{!-- ======================================================================== --}} +{{!-- INLINE PARTIAL DEFINITIONS --}} +{{!-- ======================================================================== --}} + +{{!-- +!-- Render a list row for a base item from a given item. +!-- Base item means it just has an image, a description, and a name (and effects). +!-- It is a flexbox with a child for each item value of interest. +!-- The partial assumes a variable item to be given in the context. +!-- +!-- @param item: hand over the item to the partial as hash parameter +--}} +{{#*inline "baseItemListEntry"}} +
  • + {{!-- image --}} +
    + +
    + {{!-- name --}} + + {{!-- description --}} +
    {{{item.data.data.description}}}
    + {{!-- control buttons --}} + {{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }} +
  • +{{/inline}} + +{{!-- +!-- Render a list header for a base item list entries from a given item. +!-- The partial assumes a variable dataType to be given in the context. +!-- +!-- @param dataType: the string item type for the list +--}} +{{#*inline "baseItemListHeader"}} +
  • + {{!-- image --}} +
    + {{!-- name --}} +
    {{localize 'DS4.ItemName'}}
    + {{!-- description --}} +
    {{localize 'DS4.Description'}}
    + {{!-- add button --}} + {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }} +
  • +{{/inline}} + + +{{!-- ======================================================================== --}} + + +
    +
      + {{> baseItemListHeader dataType='specialCreatureAbility' }} + {{#each itemsByType.specialCreatureAbility as |item id|}} + {{> baseItemListEntry item=item}} + {{/each}} +
    +
    \ No newline at end of file diff --git a/src/templates/actor/partials/spells-overview.hbs b/src/templates/actor/partials/spells-overview.hbs index 5338955c..f72af894 100644 --- a/src/templates/actor/partials/spells-overview.hbs +++ b/src/templates/actor/partials/spells-overview.hbs @@ -27,7 +27,7 @@ {{!-- ======================================================================== --}} -
    +
    1. {{!-- equipped --}} diff --git a/src/templates/actor/partials/talents-overview.hbs b/src/templates/actor/partials/talents-overview.hbs index 8ef93113..96974d04 100644 --- a/src/templates/actor/partials/talents-overview.hbs +++ b/src/templates/actor/partials/talents-overview.hbs @@ -1,3 +1,5 @@ +{{!-- TODO: Refactor to avoid code duplication with creature-special-abilities-overview and talents-overview --}} + {{!-- ======================================================================== --}} {{!-- INLINE PARTIAL DEFINITIONS --}} {{!-- ======================================================================== --}} @@ -118,7 +120,7 @@ {{!-- ======================================================================== --}} -
      +

      {{localize 'DS4.ItemTypeTalentPlural'}}

      {{#> ifHasItemOfType itemsArray=itemsByType.talent dataType='talent' }}