From 0be4556bfe913f733723453f3aa952428d484694 Mon Sep 17 00:00:00 2001 From: U~man Date: Tue, 30 Jun 2020 21:05:18 +0200 Subject: [PATCH] ENH: retainers and items --- src/lang/en.json | 8 +- src/lang/fr.json | 1 - src/module/actor/character-sheet.js | 8 ++ src/module/actor/entity.js | 15 +++ src/template.json | 113 +++++++++--------- .../actors/dialogs/tweaks-dialog.html | 12 ++ .../partials/character-attributes-tab.html | 47 ++++---- .../partials/monster-attributes-tab.html | 9 ++ src/templates/items/armor-sheet.html | 19 +++ src/templates/items/weapon-sheet.html | 19 +++ 10 files changed, 167 insertions(+), 84 deletions(-) create mode 100644 src/templates/items/armor-sheet.html create mode 100644 src/templates/items/weapon-sheet.html diff --git a/src/lang/en.json b/src/lang/en.json index 31da6dc..5e36dbf 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -7,7 +7,7 @@ "OSE.Formula": "Formula", "OSE.SitMod": "Situational Modifier", - "OSE.RollMod": "Roll Mode", + "OSE.RollMode": "Roll Mode", "OSE.RollExample": "Roll Example", "OSE.Name": "Name", @@ -19,8 +19,13 @@ "OSE.Treasure": "Treasure type", "OSE.Size": "Size", "OSE.Morale": "Morale", + "OSE.Retainer": "Retainer", "OSE.Appearing": "NA", + "OSE.Loyalty": "Loyalty Rating", + "OSE.LoyaltyShort": "LR", + + "OSE.AbilityCheck": "Ability Check", "OSE.scores.str.long": "Strength", "OSE.scores.str.short": "STR", "OSE.scores.wis.long": "Wisdom", @@ -52,7 +57,6 @@ "OSE.HitDiceShort": "HD", "OSE.Movement": "Movement", "OSE.MovementShort": "MOV", - "OSE.SpecialMovement": "Special Movement", "OSE.ArmorClass": "Armor Class", "OSE.ArmorClassShort": "AC", "OSE.SpellDC": "DC", diff --git a/src/lang/fr.json b/src/lang/fr.json index 1ff3656..66ee21d 100644 --- a/src/lang/fr.json +++ b/src/lang/fr.json @@ -44,7 +44,6 @@ "OSE.HitDiceShort": "DV", "OSE.Movement": "Mouvement", "OSE.MovementShort": "MOUV", - "OSE.SpecialMovement": "Mouvement Spécial", "OSE.ArmorClass": "Classe d'Armure", "OSE.ArmorClassShort": "CA", "OSE.SpellDC": "DF", diff --git a/src/module/actor/character-sheet.js b/src/module/actor/character-sheet.js index 4ee2145..f60d12d 100644 --- a/src/module/actor/character-sheet.js +++ b/src/module/actor/character-sheet.js @@ -133,6 +133,14 @@ export class OseActorSheetCharacter extends OseActorSheet { // Item summaries html.find('.item .item-name h4').click(event => this._onItemSummary(event)); + + html.find('.ability-score .attribute-name a').click(ev => { + let actorObject = this.actor; + let element = event.currentTarget; + let score = element.parentElement.parentElement.dataset.score; + actorObject.rollCheck(score, { event: event }); + }) + // Handle default listeners last so system listeners are triggered first super.activateListeners(html); } diff --git a/src/module/actor/entity.js b/src/module/actor/entity.js index 752f305..5262f04 100644 --- a/src/module/actor/entity.js +++ b/src/module/actor/entity.js @@ -26,4 +26,19 @@ export class OseActor extends Actor { title: `${label} ${game.i18n.localize('OSE.SavingThrow')}`, }); } + + rollCheck(score, options = {}) { + const label = game.i18n.localize(`OSE.scores.${score}.long`); + const rollParts = ['1d20']; + + // Roll and return + return OseDice.Roll({ + event: options.event, + parts: rollParts, + data: this.data, + speaker: ChatMessage.getSpeaker({ actor: this }), + flavor: `${label} ${game.i18n.localize('OSE.AbilityCheck')}`, + title: `${label} ${game.i18n.localize('OSE.AbilityCheck')}`, + }); + } } diff --git a/src/template.json b/src/template.json index 042ad9f..e4951c2 100644 --- a/src/template.json +++ b/src/template.json @@ -2,6 +2,36 @@ "Actor": { "types": ["character", "monster"], "templates": { + "common": { + "retainer": { + "enabled": false, + "loyalty": 0 + }, + "hp": { + "hd": "", + "value": 20, + "max": 20 + }, + "ac": { + "value": 0, + "mod": 0 + }, + "thac0": { + "value": 19, + "mod": 0 + }, + "saves": { + "death": 10, + "wand": 10, + "paralysis": 10, + "breath": 10, + "spell": 10 + }, + "movement": { + "base": 0, + "encounter": 0 + } + }, "spellcaster": { "spells": { "enabled": false, @@ -34,7 +64,7 @@ } }, "character": { - "templates": ["spellcaster"], + "templates": ["common", "spellcaster"], "details": { "biography": "", "class": "", @@ -76,32 +106,6 @@ "silver": 0, "copper": 0 }, - "hp": { - "hd": "", - "value": 20, - "max": 20 - }, - "ac": { - "value": 0, - "mod": 0 - }, - "thac0": { - "value": 19, - "mod": 0, - "missile": 0, - "melee": 0 - }, - "saves": { - "D": 10, - "W": 10, - "P": 10, - "B": 10, - "S": 10 - }, - "movement": { - "base": 0, - "encounter": 0 - }, "initative": { "value": 0, "mod": 0 @@ -109,7 +113,7 @@ "languages": [] }, "monster": { - "templates": ["spellcaster"], + "templates": ["common", "spellcaster"], "details": { "biography": "", "alignment": "", @@ -119,45 +123,44 @@ "appearing": "", "morale": 0 }, - "saves": { - "death": 10, - "wand": 10, - "paralysis": 10, - "breath": 10, - "spell": 10 - }, - "thac0": { - "value": 19, - "mod": 0 - }, - "hp": { - "hd": "", - "max": 0, - "value": 0 - }, - "ac": { - "value": 0, - "mod": 0 - }, "attacks": { "value": 1 - }, - "movement": { - "base": 0, - "encounter": 0 } } }, "Item": { - "types": ["item", "spell", "ability"], + "types": ["item", "weapon", "armor", "spell", "ability"], "item": { "description": "", - "quantity": 1, + "quantity": { + "value": 1, + "max": 0 + }, + "cost": 0, + "weight": 0 + }, + "weapon": { + "description": "", + "damage": "1d6", + "qualities": "", + "slow": false, + "melee": true, + "ranged": true, + "cost": 0, + "weight": 0 + }, + "armor": { + "description": "", + "ac": 9, + "aac": 10, + "cost": 0, "weight": 0 }, "spell": { "lvl": 1, - "class": "", + "class": "Magic-User", + "duration": "", + "range": "", "description": "" }, "ability": { diff --git a/src/templates/actors/dialogs/tweaks-dialog.html b/src/templates/actors/dialogs/tweaks-dialog.html index fe376d4..893a513 100644 --- a/src/templates/actors/dialogs/tweaks-dialog.html +++ b/src/templates/actors/dialogs/tweaks-dialog.html @@ -11,6 +11,18 @@ /> +
+ +
+ +
+