From ada8b1c54788e87219e910917f4dc083d845a557 Mon Sep 17 00:00:00 2001 From: Paul Maskelyne Date: Tue, 3 Oct 2023 22:34:04 +0100 Subject: [PATCH] add rollable class abilities to character sheet --- i18n/en.yaml | 15 +++- scss/sheets/actors/_player.scss | 57 +++++++++++++- scss/sheets/items/_item.scss | 4 +- system/src/config.mjs | 35 +++++---- system/src/dice/RollSD.mjs | 1 + system/src/documents/ActorSD.mjs | 72 +++++++++++++++++- system/src/documents/CompendiumsSD.mjs | 1 + system/src/documents/ItemSD.mjs | 3 +- system/src/sheets/ActorSheetSD.mjs | 15 +--- system/src/sheets/ItemSheetSD.mjs | 9 ++- system/src/sheets/PlayerSheetSD.mjs | 60 +++++++++++++-- system/src/templates.mjs | 5 +- system/system.json | 10 +++ system/template.json | 15 +++- system/templates/actors/player/abilities.hbs | 4 +- .../actors/player/abilities/class.hbs | 75 ++++++++++++++++--- system/templates/actors/player/spells.hbs | 6 +- system/templates/chat/ability-card.hbs | 7 +- system/templates/chat/use-ability.hbs | 14 ++++ .../items/partials/class-ability.hbs | 41 ++++++++++ system/templates/items/partials/class.hbs | 17 ++++- system/templates/items/tabs/details.hbs | 4 + 22 files changed, 400 insertions(+), 70 deletions(-) create mode 100644 system/templates/chat/use-ability.hbs create mode 100644 system/templates/items/partials/class-ability.hbs diff --git a/i18n/en.yaml b/i18n/en.yaml index 6a9219b0..e0b40aee 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -99,12 +99,20 @@ SHADOWDARK.chat.spell_learn.failure: "{name} failed to learn anything from the s SHADOWDARK.chat.spell_learn.success: "{name} successfully learnt the {spellName} spell" SHADOWDARK.chat.spell_learn.title: Learning Spell SHADOWDARK.chat.spell_roll.title: "{name}, DC {spellDC}" +SHADOWDARK.chat.use_ability.failure: "{name} failed to used the {ability} ability" +SHADOWDARK.chat.use_ability.success: "{name} successfully used the {ability} ability" +SHADOWDARK.chat.use_ability.title: "Using Ability" SHADOWDARK.chat.welcome_message.intro: "To quickly get familiar with the system, check out the provided guided tours by clicking on the following button:" SHADOWDARK.chat.welcome_message.issue_tracker_button: Issue Tracker SHADOWDARK.chat.welcome_message.issues: "If you find any issues or have ideas for new features for the system. Check out our issue tracker:" SHADOWDARK.chat.welcome_message.title: Shadowdark RPG for Foundry SHADOWDARK.chat.welcome_message.tour_button: Shadowdark RPG Tours SHADOWDARK.chatcard.default: Roll +SHADOWDARK.class-ability.ability.label: Ability +SHADOWDARK.class-ability.dc.label: DC +SHADOWDARK.class-ability.group.label: Ability Group +SHADOWDARK.class-ability.lose_on_failure.label: Lose on Failure? +SHADOWDARK.class-ability.lost.label: Lost SHADOWDARK.class.armor.all.label: All Armor SHADOWDARK.class.armor.label: Armor SHADOWDARK.class.armor.prompt: Select Armor... @@ -478,6 +486,8 @@ SHADOWDARK.settings.track_light_sources.pause_with_game.hint: If checked the Rea SHADOWDARK.settings.track_light_sources.pause_with_game.name: Pause Light Tracking SHADOWDARK.settings.track_light_sources.realtime_tracking.hint: If checked the Light Tracking will follow real time. Disable if an external time/calendar module is used. SHADOWDARK.settings.track_light_sources.realtime_tracking.name: Realtime Light Tracking +SHADOWDARK.sheet.abilities.label: Abilities +SHADOWDARK.sheet.abilities.ungrouped.label: Miscellaneous SHADOWDARK.sheet.actor.ac: AC SHADOWDARK.sheet.actor.alignment: Alignment SHADOWDARK.sheet.actor.hp_max: Max @@ -518,24 +528,25 @@ SHADOWDARK.sheet.player.deity.tooltip: Your character’s cosmic link to the opp SHADOWDARK.sheet.player.languages: Languages SHADOWDARK.sheet.player.luck: Luck SHADOWDARK.sheet.player.melee_attacks: Melee Attacks -SHADOWDARK.sheet.player.tab.notes: Notes SHADOWDARK.sheet.player.ranged_attacks: Ranged Attacks SHADOWDARK.sheet.player.roll_initiative: Roll Initiative SHADOWDARK.sheet.player.spells_tier: Tier SHADOWDARK.sheet.player.spells: Spells -SHADOWDARK.sheet.abilities.label: Abilities SHADOWDARK.sheet.player.tab.abilities: Abilities SHADOWDARK.sheet.player.tab.background: Background SHADOWDARK.sheet.player.tab.inventory: Inventory +SHADOWDARK.sheet.player.tab.notes: Notes SHADOWDARK.sheet.player.tab.spells: Spells SHADOWDARK.sheet.player.tab.talents: Talents SHADOWDARK.sheet.player.talents_level: Level SHADOWDARK.sheet.player.talents_name: Name SHADOWDARK.sheet.player.talents: Talents SHADOWDARK.sheet.player.title: Title +SHADOWDARK.sheet.player.toggle_ability_lost: Toggle Ability Lost SHADOWDARK.sheet.player.toggle_spell_lost: Toggle Spell Lost SHADOWDARK.sheet.player.tooltip.cast_spell: Cast Spell SHADOWDARK.sheet.player.tooltip.learn_spell: Learn Spell +SHADOWDARK.sheet.player.tooltip.use_class_ability: Use Class Ability SHADOWDARK.sheet.player.tooltip.use_potion: Use Potion SHADOWDARK.sheet.player.tooltip.use_scroll: Use Scroll SHADOWDARK.sheet.player.tooltip.use_wand: Use Wand diff --git a/scss/sheets/actors/_player.scss b/scss/sheets/actors/_player.scss index 75a6f44b..d78d19f1 100644 --- a/scss/sheets/actors/_player.scss +++ b/scss/sheets/actors/_player.scss @@ -561,10 +561,11 @@ } } - .spell-lost { + .strike-through { text-decoration: line-through; } + .class-abilities-body, .spells-body { @include p-reset; margin: 4px; @@ -641,6 +642,60 @@ } } + .class-abilities-list { + margin-bottom: 8px; + + table { + @include p-reset; + font-family: "Montserrat-Medium"; + font-size: 14px; + text-align: left; + border: none; + + & td:first-child { + padding-left: 8px; + } + + & th:first-child { + text-align: left; + padding-left: 4px; + } + + & th:last-child { + text-align: right; + padding-right: 4px; + } + + & td:last-child { + text-align: center; + padding-right: 4px; + } + + // & tr:first-child { + // // background-color: #00000020; + + // & td { + // @include p-reset; + // } + // } + + // Only highlight on hover rows that have actual items in them, + // not the section headers or header/footer rows + // + & tr:not( + :first-child, + .spell-tier-header, + .item-details + ) { + &:hover { + cursor: pointer; + background-color: var(--secondary); + color: white; + } + } + } + } + .talents-body { @include p-reset; margin: 4px; diff --git a/scss/sheets/items/_item.scss b/scss/sheets/items/_item.scss index 69588f8a..8529df66 100644 --- a/scss/sheets/items/_item.scss +++ b/scss/sheets/items/_item.scss @@ -93,14 +93,14 @@ } } - .class-details{ + .class-details { grid-column: span 3; display: grid; grid-template-columns: repeat(4, 1fr); grid-column-gap: 4px; } - .class-equipment-details{ + .class-equipment-details { grid-column: span 3; display: grid; grid-template-columns: 1.5fr 1.5fr 1fr; diff --git a/system/src/config.mjs b/system/src/config.mjs index d27646c7..5064e16a 100644 --- a/system/src/config.mjs +++ b/system/src/config.mjs @@ -63,6 +63,7 @@ SHADOWDARK.DICE = { d20: "d20", }; +/* eslint-disable quote-props */ SHADOWDARK.DEFAULTS = { BASE_ARMOR_CLASS: 10, GEAR_SLOTS: 10, @@ -70,26 +71,28 @@ SHADOWDARK.DEFAULTS = { LEARN_SPELL_DC: 15, LIGHT_TRACKER_UPDATE_INTERVAL_SECS: 30, ITEM_IMAGES: { - Ancestry: "icons/environment/people/group.webp", - Armor: "icons/equipment/chest/breastplate-banded-steel-gold.webp", - Background: "icons/environment/people/commoner.webp", - Basic: "icons/containers/bags/pouch-simple-brown.webp", - Class: "icons/sundries/documents/document-sealed-brown-red.webp", - Deity: "icons/magic/holy/yin-yang-balance-symbol.webp", - Effect: "icons/commodities/tech/cog-brass.webp", - Gem: "icons/commodities/gems/gem-faceted-navette-red.webp", - Language: "icons/tools/scribal/ink-quill-pink.webp", + "Ancestry": "icons/environment/people/group.webp", + "Armor": "icons/equipment/chest/breastplate-banded-steel-gold.webp", + "Background": "icons/environment/people/commoner.webp", + "Basic": "icons/containers/bags/pouch-simple-brown.webp", + "Class Ability": "icons/tools/navigation/map-chart-tan.webp", + "Class": "icons/sundries/documents/document-sealed-brown-red.webp", + "Deity": "icons/magic/holy/yin-yang-balance-symbol.webp", + "Effect": "icons/commodities/tech/cog-brass.webp", + "Gem": "icons/commodities/gems/gem-faceted-navette-red.webp", + "Language": "icons/tools/scribal/ink-quill-pink.webp", "NPC Attack": "icons/skills/melee/weapons-crossed-swords-yellow.webp", "NPC Feature": "icons/creatures/abilities/dragon-breath-purple.webp", - Potion: "icons/consumables/potions/bottle-corked-red.webp", - Property: "icons/sundries/documents/document-torn-diagram-tan.webp", - Scroll: "icons/sundries/scrolls/scroll-runed-brown-purple.webp", - Spell: "icons/magic/symbols/runes-star-blue.webp", - Talent: "icons/sundries/books/book-worn-brown-grey.webp", - Wand: "icons/weapons/wands/wand-gem-violet.webp", - Weapon: "icons/weapons/swords/swords-short.webp", + "Potion": "icons/consumables/potions/bottle-corked-red.webp", + "Property": "icons/sundries/documents/document-torn-diagram-tan.webp", + "Scroll": "icons/sundries/scrolls/scroll-runed-brown-purple.webp", + "Spell": "icons/magic/symbols/runes-star-blue.webp", + "Talent": "icons/sundries/books/book-worn-brown-grey.webp", + "Wand": "icons/weapons/wands/wand-gem-violet.webp", + "Weapon": "icons/weapons/swords/swords-short.webp", }, }; +/* eslint-enable quote-props */ SHADOWDARK.INVENTORY = { GEMS_PER_SLOT: 10, diff --git a/system/src/dice/RollSD.mjs b/system/src/dice/RollSD.mjs index dcb85bac..8443fd71 100644 --- a/system/src/dice/RollSD.mjs +++ b/system/src/dice/RollSD.mjs @@ -530,6 +530,7 @@ export default class RollSD extends Roll { isVersatile: false, isRoll: true, isNPC: data.actor?.type === "NPC", + targetDC: options.target ?? false, }; if (data.rolls.main) { templateData._formula = data.rolls.main.roll._formula; diff --git a/system/src/documents/ActorSD.mjs b/system/src/documents/ActorSD.mjs index a578741f..510ba5ee 100644 --- a/system/src/documents/ActorSD.mjs +++ b/system/src/documents/ActorSD.mjs @@ -207,7 +207,7 @@ export default class ActorSD extends Actor { itemId, }); } - if (item.hasProperty("thrown")) { + if (await item.hasProperty("thrown")) { weaponOptions.attackBonus = baseAttackBonus + parseInt(this.system.bonuses.rangedAttackBonus, 10) + parseInt(item.system.bonuses.attackBonus, 10) @@ -503,9 +503,12 @@ export default class ActorSD extends Actor { async isSpellcaster() { const characterClass = this.backgroundItems.class; - const spellcastingAbility = characterClass?.system?.spellcasting?.ability ?? ""; + const spellcastingAbility = + characterClass?.system?.spellcasting?.class ?? "__not_spellcaster__"; - return characterClass && spellcastingAbility !== "" ? true : false; + return characterClass && spellcastingAbility !== "__not_spellcaster__" + ? true + : false; } /** @inheritDoc */ @@ -904,6 +907,68 @@ export default class ActorSD extends Actor { return newArmorClass; } + async useAbility(itemId) { + const item = this.items.get(itemId); + + const result = await this.rollAbility( + item.system.ability, + {target: item.system.dc} + ); + + const success = result?.rolls?.main?.success ?? false; + + const messageType = success + ? "SHADOWDARK.chat.use_ability.success" + : "SHADOWDARK.chat.use_ability.failure"; + + let message = game.i18n.format( + messageType, + { + name: this.name, + ability: item.name, + } + ); + + const abilityDescription = await TextEditor.enrichHTML( + item.system.description, + { + secrets: this.isOwner, + async: true, + relativeTo: this, + } + ); + + if (success) { + message = `

${message}

${abilityDescription}`; + } + + const cardData = { + actor: this, + item: item, + message, + }; + + let template = "systems/shadowdark/templates/chat/use-ability.hbs"; + + const content = await renderTemplate(template, cardData); + + const title = game.i18n.localize("SHADOWDARK.chat.use_ability.title"); + + await ChatMessage.create({ + title, + content, + flags: { "core.canPopout": true }, + flavor: title, + speaker: ChatMessage.getSpeaker({actor: this, token: this.token}), + type: CONST.CHAT_MESSAGE_TYPES.OTHER, + user: game.user.id, + }); + + if (!success && item.system.loseOnFailure) { + item.update({"system.lost": true}); + } + } + async usePotion(itemId) { const item = this.items.get(itemId); @@ -990,7 +1055,6 @@ export default class ActorSD extends Actor { } _preparePlayerData() { - this._populateBackgroundItems(); this._populatePlayerModifiers(); } diff --git a/system/src/documents/CompendiumsSD.mjs b/system/src/documents/CompendiumsSD.mjs index 6bca7147..6939a63a 100644 --- a/system/src/documents/CompendiumsSD.mjs +++ b/system/src/documents/CompendiumsSD.mjs @@ -238,6 +238,7 @@ export default class CompendiumsSD { const filteredDocuments = documents.filter( document => document.system.spellcasting.ability !== "" + && document.system.spellcasting.class !== "NONE" ); // re-create the collection from the filtered Items diff --git a/system/src/documents/ItemSD.mjs b/system/src/documents/ItemSD.mjs index e646d06c..573c3d7c 100644 --- a/system/src/documents/ItemSD.mjs +++ b/system/src/documents/ItemSD.mjs @@ -185,7 +185,8 @@ export default class ItemSD extends Item { async hasProperty(property) { property = property.slugify(); - const propertyItem = (await this.propertyItems()).find( + const propertyItems = await this.propertyItems(); + const propertyItem = propertyItems.find( p => p.name.slugify() === property ); diff --git a/system/src/sheets/ActorSheetSD.mjs b/system/src/sheets/ActorSheetSD.mjs index 522743cc..bd1c3241 100644 --- a/system/src/sheets/ActorSheetSD.mjs +++ b/system/src/sheets/ActorSheetSD.mjs @@ -386,19 +386,6 @@ export default class ActorSheetSD extends ActorSheet { _sortAllItems(context) { // Pre-sort all items so that when they are filtered into their relevant // categories they are already sorted alphabetically (case-sensitive) - const allItems = []; - (context.items ?? []).forEach(item => allItems.push(item)); - - allItems.sort((a, b) => { - if (a.name < b.name) { - return -1; - } - if (a.name > b.name) { - return 1; - } - return 0; - }); - - return allItems; + return (context.items ?? []).sort((a, b) => a.name.localeCompare(b.name)); } } diff --git a/system/src/sheets/ItemSheetSD.mjs b/system/src/sheets/ItemSheetSD.mjs index 4440c5c8..d3192182 100644 --- a/system/src/sheets/ItemSheetSD.mjs +++ b/system/src/sheets/ItemSheetSD.mjs @@ -29,6 +29,11 @@ export default class ItemSheetSD extends ItemSheet { return "systems/shadowdark/templates/items/item.hbs"; } + /** @inheritdoc */ + get title() { + return `[${this.item.type}] ${this.item.name}`; + } + /** @inheritdoc */ activateListeners(html) { @@ -198,6 +203,7 @@ export default class ItemSheetSD extends ItemSheet { context.spellcastingClasses = {}; for (const spellcastingClass of spellcastingClasses) { + if (spellcastingClass.name === this.item.name) continue; context.spellcastingClasses[spellcastingClass.uuid] = spellcastingClass.name; } @@ -249,10 +255,11 @@ export default class ItemSheetSD extends ItemSheet { "Ancestry", "Armor", "Basic", + "Class Ability", "Class", "Deity", - "Gem", "Effect", + "Gem", "Language", "NPC Attack", "Potion", diff --git a/system/src/sheets/PlayerSheetSD.mjs b/system/src/sheets/PlayerSheetSD.mjs index bec15523..fa6610b0 100644 --- a/system/src/sheets/PlayerSheetSD.mjs +++ b/system/src/sheets/PlayerSheetSD.mjs @@ -12,8 +12,8 @@ export default class PlayerSheetSD extends ActorSheetSD { static get defaultOptions() { return foundry.utils.mergeObject(super.defaultOptions, { classes: ["shadowdark", "sheet", "player"], - width: 560, - height: 560, + width: 600, + height: 580, resizable: true, tabs: [ { @@ -63,8 +63,12 @@ export default class PlayerSheetSD extends ActorSheetSD { event => this._onSellTreasure(event) ); - html.find(".toggle-spell-lost").click( - event => this._onToggleSpellLost(event) + html.find(".toggle-lost").click( + event => this._onToggleLost(event) + ); + + html.find("[data-action='use-ability']").click( + event => this._onUseAbility(event) ); html.find("[data-action='use-potion']").click( @@ -114,8 +118,7 @@ export default class PlayerSheetSD extends ActorSheetSD { /** @override */ async getData(options) { - // Update the Gem Bag, but don't render it unless it's already showing - this.gemBag.render(false); + await this.actor._populateBackgroundItems(); const context = await super.getData(options); @@ -135,6 +138,7 @@ export default class PlayerSheetSD extends ActorSheetSD { context.knownLanguages = await this.actor.languageItems(); context.backgroundSelectors = await this.getBackgroundSelectors(); + // Get the inventory ready await this._prepareItems(context); @@ -143,14 +147,19 @@ export default class PlayerSheetSD extends ActorSheetSD { this.actor.overrides?.system?.abilities || {} ) ); + context.attributeOverrides = Object.keys( foundry.utils.flattenObject( this.actor.overrides?.system?.attributes || {} ) ); + context.characterClass = this.actor.backgroundItems.class?.name; context.classTitle = this.actor.backgroundItems.title; + // Update the Gem Bag, but don't render it unless it's already showing + this.gemBag.render(false); + return context; } @@ -159,7 +168,7 @@ export default class PlayerSheetSD extends ActorSheetSD { case "Ancestry": return this.actor.addAncestry(item); case "Background": - return this.actor.addBackground(item); + return this.actor.addBackground(item);1 case "Class": return this.actor.addClass(item); case "Deity": @@ -519,6 +528,14 @@ export default class PlayerSheetSD extends ActorSheetSD { if (item.type === "Armor") this.actor.updateArmor(updatedItem); } + async _onUseAbility(event) { + event.preventDefault(); + + const itemId = $(event.currentTarget).data("item-id"); + + this.actor.useAbility(itemId); + } + async _onUsePotion(event) { event.preventDefault(); @@ -558,7 +575,7 @@ export default class PlayerSheetSD extends ActorSheetSD { this._toggleLightSource(item); } - async _onToggleSpellLost(event) { + async _onToggleLost(event) { event.preventDefault(); const itemId = $(event.currentTarget).data("item-id"); const item = this.actor.getEmbeddedDocument("Item", itemId); @@ -684,6 +701,8 @@ export default class PlayerSheetSD extends ActorSheetSD { const attacks = {melee: [], ranged: []}; + const allClassAbilities = {}; + let slotCount = 0; for (const i of this._sortAllItems(context)) { @@ -755,6 +774,18 @@ export default class PlayerSheetSD extends ActorSheetSD { const category = i.system.category; effects[category].items.push(i); } + else if (i.type === "Class Ability") { + const group = i.system.group !== "" + ? i.system.group + : game.i18n.localize("SHADOWDARK.sheet.abilities.ungrouped.label"); + + if (Array.isArray(allClassAbilities[group])) { + allClassAbilities[group].push(i); + } + else { + allClassAbilities[group] = [i]; + } + } } // Work out how many slots all these coins are taking up... @@ -775,6 +806,19 @@ export default class PlayerSheetSD extends ActorSheetSD { gemSlots = Math.ceil(totalGems / CONFIG.SHADOWDARK.INVENTORY.GEMS_PER_SLOT); } + const classAbilities = []; + + const sortedGroups = Object.keys(allClassAbilities).sort((a, b) => a.localeCompare(b)); + for (const group of sortedGroups) { + classAbilities.push({ + name: group, + abilities: allClassAbilities[group], + }); + } + + context.classAbilities = classAbilities; + context.hasClassAbilities = classAbilities.length > 0; + context.attacks = attacks; context.coins = {totalCoins, coinSlots}; context.gems = {items: gems, totalGems, gemSlots}; diff --git a/system/src/templates.mjs b/system/src/templates.mjs index a7945a7c..0b6110c1 100644 --- a/system/src/templates.mjs +++ b/system/src/templates.mjs @@ -12,21 +12,22 @@ export default function() { "systems/shadowdark/templates/actors/player/abilities.hbs", "systems/shadowdark/templates/actors/player/abilities/ac.hbs", "systems/shadowdark/templates/actors/player/abilities/attacks.hbs", - "systems/shadowdark/templates/actors/player/abilities/hp.hbs", "systems/shadowdark/templates/actors/player/abilities/class.hbs", + "systems/shadowdark/templates/actors/player/abilities/hp.hbs", "systems/shadowdark/templates/actors/player/abilities/initiative.hbs", "systems/shadowdark/templates/actors/player/abilities/luck.hbs", "systems/shadowdark/templates/actors/player/background.hbs", "systems/shadowdark/templates/actors/player/inventory.hbs", "systems/shadowdark/templates/actors/player/inventory/coins.hbs", "systems/shadowdark/templates/actors/player/inventory/slots.hbs", - "systems/shadowdark/templates/actors/player/spells.hbs", "systems/shadowdark/templates/actors/player/notes.hbs", + "systems/shadowdark/templates/actors/player/spells.hbs", "systems/shadowdark/templates/actors/player/talents.hbs", "systems/shadowdark/templates/items/partials/active-effects.hbs", "systems/shadowdark/templates/items/partials/ancestry.hbs", "systems/shadowdark/templates/items/partials/armor.hbs", "systems/shadowdark/templates/items/partials/choice-selector.hbs", + "systems/shadowdark/templates/items/partials/class-ability.hbs", "systems/shadowdark/templates/items/partials/class.hbs", "systems/shadowdark/templates/items/partials/cost.hbs", "systems/shadowdark/templates/items/partials/deity.hbs", diff --git a/system/system.json b/system/system.json index a6f67071..aee0aec5 100644 --- a/system/system.json +++ b/system/system.json @@ -84,6 +84,15 @@ "private": false, "flags": {} }, + { + "name": "class-abilities", + "label": "Class Abilities", + "system": "shadowdark", + "path": "packs/class-abilities", + "type": "Item", + "private": false, + "flags": {} + }, { "name": "classes", "label": "Classes", @@ -253,6 +262,7 @@ "packs": [ "ancestries", "backgrounds", + "class-abilities", "classes", "deities", "languages", diff --git a/system/template.json b/system/template.json index edb5d11b..42cb150a 100644 --- a/system/template.json +++ b/system/template.json @@ -136,10 +136,11 @@ "Armor", "Background", "Basic", + "Class Ability", "Class", "Deity", - "Gem", "Effect", + "Gem", "Language", "NPC Attack", "NPC Feature", @@ -254,7 +255,7 @@ "hitPoints": "", "spellcasting": { "ability": "", - "class": "" + "class": "NONE" }, "talents": [], "talentChoices": [], @@ -262,6 +263,16 @@ "titles": [], "weapons": [] }, + "Class Ability": { + "templates": [ + "common" + ], + "ability": "", + "group": "", + "dc": 10, + "loseOnFailure": true, + "lost": false + }, "Deity": { "templates": [ "common" diff --git a/system/templates/actors/player/abilities.hbs b/system/templates/actors/player/abilities.hbs index a2fd0b32..01d26858 100644 --- a/system/templates/actors/player/abilities.hbs +++ b/system/templates/actors/player/abilities.hbs @@ -26,7 +26,9 @@
{{> actors/player/abilities/attacks }} - {{> actors/player/abilities/class }} + {{#if hasClassAbilities}} + {{> actors/player/abilities/class }} + {{/if}}
diff --git a/system/templates/actors/player/abilities/class.hbs b/system/templates/actors/player/abilities/class.hbs index 82b8838b..244434ac 100644 --- a/system/templates/actors/player/abilities/class.hbs +++ b/system/templates/actors/player/abilities/class.hbs @@ -1,12 +1,65 @@ -
    - {{#each classAbilities as |ability|}} -
  1. - {{{ability.name}}} -
  2. - {{/each}} -
+
+
+ {{#each classAbilities as |group|}} + + + + + + {{#each group.abilities}} + {{> ability ability=this}} + {{/each}} +
+ {{group.name}} +  
+ {{/each}} +
+
+ +{{#*inline "ability"}} + + +
+ +
+ + {{ability.name}} + + + + {{#unless ability.system.lost}} + + + +   + {{/unless}} + + {{#if ability.system.lost}} + + {{else}} + + {{/if}} + + + +{{/inline}} diff --git a/system/templates/actors/player/spells.hbs b/system/templates/actors/player/spells.hbs index e65f9b49..d3160194 100644 --- a/system/templates/actors/player/spells.hbs +++ b/system/templates/actors/player/spells.hbs @@ -24,7 +24,7 @@ {{#each tier as |spell|}} @@ -36,7 +36,7 @@ {{spell.name}} @@ -54,7 +54,7 @@ {{/unless}} diff --git a/system/templates/chat/ability-card.hbs b/system/templates/chat/ability-card.hbs index 920aa941..2418cdfe 100644 --- a/system/templates/chat/ability-card.hbs +++ b/system/templates/chat/ability-card.hbs @@ -1,7 +1,12 @@
-

{{title}}

+

+ {{title}} + {{#if targetDC}} + (DC {{targetDC}}) + {{/if}} +

{{#if data.rolls.main}} diff --git a/system/templates/chat/use-ability.hbs b/system/templates/chat/use-ability.hbs new file mode 100644 index 00000000..4bcd4677 --- /dev/null +++ b/system/templates/chat/use-ability.hbs @@ -0,0 +1,14 @@ +
+
+ +

{{item.name}}

+
+ +
+ {{{message}}} +
+
diff --git a/system/templates/items/partials/class-ability.hbs b/system/templates/items/partials/class-ability.hbs new file mode 100644 index 00000000..dd3ca73e --- /dev/null +++ b/system/templates/items/partials/class-ability.hbs @@ -0,0 +1,41 @@ +
+
+ + +
+
+ + +
+
+ + {{numberInput + item.system.dc + name="system.dc" + placeholder="0" + }} +
+
+
+ + +
+ {{#if system.loseOnFailure}} +
+ + +
+ {{/if}} +
+
diff --git a/system/templates/items/partials/class.hbs b/system/templates/items/partials/class.hbs index 12c27cc5..de84b578 100644 --- a/system/templates/items/partials/class.hbs +++ b/system/templates/items/partials/class.hbs @@ -36,7 +36,22 @@