From cfaa131559bc5df69e7610c37b0d9874633500a0 Mon Sep 17 00:00:00 2001 From: Lee Talman Date: Fri, 8 Mar 2024 14:53:07 -0500 Subject: [PATCH] add descriptions to attack rolls, ap to monster rolls, and change pcs/recruits to have link actor data selected by default. --- CHANGELOG.md | 5 + module/data/character.mjs | 1 - module/data/monster.mjs | 4 + module/documents/actor.mjs | 8 ++ module/helpers/items.mjs | 12 ++- packs/actors/CURRENT | 2 +- packs/actors/LOG | 6 +- packs/actors/LOG.old | 6 +- .../{MANIFEST-000058 => MANIFEST-000064} | Bin 202 -> 202 bytes packs/items/CURRENT | 2 +- packs/items/LOG | 6 +- packs/items/LOG.old | 6 +- .../{MANIFEST-000058 => MANIFEST-000064} | Bin 153 -> 153 bytes packs/monsters/CURRENT | 2 +- packs/monsters/LOG | 6 +- packs/monsters/LOG.old | 6 +- .../{MANIFEST-000058 => MANIFEST-000064} | Bin 202 -> 202 bytes packs/spells/CURRENT | 2 +- packs/spells/LOG | 6 +- packs/spells/LOG.old | 6 +- packs/spells/MANIFEST-000046 | Bin 50 -> 0 bytes packs/spells/MANIFEST-000052 | Bin 0 -> 50 bytes system.json | 4 +- templates/actor/actor-monster-sheet.hbs | 101 ++++++++++-------- templates/item/item-chat-message.hbs | 6 +- 25 files changed, 113 insertions(+), 84 deletions(-) rename packs/actors/{MANIFEST-000058 => MANIFEST-000064} (63%) rename packs/items/{MANIFEST-000058 => MANIFEST-000064} (83%) rename packs/monsters/{MANIFEST-000058 => MANIFEST-000064} (63%) delete mode 100644 packs/spells/MANIFEST-000046 create mode 100644 packs/spells/MANIFEST-000052 diff --git a/CHANGELOG.md b/CHANGELOG.md index 60b6138..2dc49db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # CHANGELOG +## 0.2.2 +- All attacks roll their description (not just relics) +- Monster sheets display AP and can roll reverse AP +- New PCs and recruits have "Link Actor Data" selected by default + ## 0.2.1 - Added support for reverse AP rolls for PCs/recruits - Reduced size of chat message header font diff --git a/module/data/character.mjs b/module/data/character.mjs index e99b250..da5b040 100644 --- a/module/data/character.mjs +++ b/module/data/character.mjs @@ -54,6 +54,5 @@ export default class Knave2eCharacter extends Knave2eActorType { } prepareBaseData(){ - } } \ No newline at end of file diff --git a/module/data/monster.mjs b/module/data/monster.mjs index 09fe842..ad9273d 100644 --- a/module/data/monster.mjs +++ b/module/data/monster.mjs @@ -11,6 +11,7 @@ export default class Knave2eRecruit extends Knave2eActorType { const requiredInteger = { required: true, nullable: false, integer: true }; const schema = super.defineSchema(); + schema.armorPoints = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0}); schema.morale = new fields.NumberField({ ...requiredInteger, initial: 7, min: 2, max: 12 }); schema.numberAppearing = new fields.SchemaField({ combined: new fields.StringField({ initial: "1d6(3d6)" }), @@ -22,6 +23,9 @@ export default class Knave2eRecruit extends Knave2eActorType { prepareDerivedData() { + // Prepare armorPoints in reverse + this.armorPoints = this.armorClass - 11; + // Rip single NA roll of format 1d6(3d6) into separate rolls const combined = this.numberAppearing.combined; diff --git a/module/documents/actor.mjs b/module/documents/actor.mjs index cb3779a..ba86854 100644 --- a/module/documents/actor.mjs +++ b/module/documents/actor.mjs @@ -1,5 +1,12 @@ export default class Knave2eActor extends Actor { + async _preCreate(data) { + if (data.type === 'character' || data.type === 'recruit') { + this.updateSource({"prototypeToken.actorLink" : true}); + } + super._preCreate(data) +} + prepareData() { super.prepareData(); } @@ -51,6 +58,7 @@ export default class Knave2eActor extends Actor { if (actorData.type !== 'monster') return; const systemData = actorData.system; + systemData.armorPoints = systemData.armorClass - 11; } diff --git a/module/helpers/items.mjs b/module/helpers/items.mjs index 201cef2..eb24c37 100644 --- a/module/helpers/items.mjs +++ b/module/helpers/items.mjs @@ -105,6 +105,7 @@ export async function onAttack(event) { const li = a.closest("li"); const item = li.dataset.itemId ? this.actor.items.get(li.dataset.itemId) : null; const itemData = item.system; + const hasDescription = itemData.description === "" ? false: true; const systemData = this.actor.system; // Return if the weapon is broken @@ -140,8 +141,9 @@ export async function onAttack(event) { actor: this.actor._id, buttons: true, character: true, - relic: false, + // relic: false, description: itemData.description, + hasDescription: hasDescription }, flavor: flavor, rolls: [] @@ -209,10 +211,10 @@ export async function onAttack(event) { rollData.data.buttons = false; } - // Send relic descriptions to chat when active - if (itemData.relic.isRelic && itemData.relic.isActive) { - rollData.data.relic = true; - } + // // Send relic descriptions to chat when active + // if (itemData.relic.isRelic && itemData.relic.isActive) { + // rollData.data.relic = true; + // } } // Attack from characters get free maneuvers diff --git a/packs/actors/CURRENT b/packs/actors/CURRENT index 717cf9a..5d746f2 100644 --- a/packs/actors/CURRENT +++ b/packs/actors/CURRENT @@ -1 +1 @@ -MANIFEST-000058 +MANIFEST-000064 diff --git a/packs/actors/LOG b/packs/actors/LOG index d4d618b..4e56ec2 100644 --- a/packs/actors/LOG +++ b/packs/actors/LOG @@ -1,3 +1,3 @@ -2024/03/06-02:21:51.117 a634 Recovering log #57 -2024/03/06-02:21:51.120 a634 Delete type=0 #57 -2024/03/06-02:21:51.120 a634 Delete type=3 #56 +2024/03/08-14:02:24.827 676c Recovering log #63 +2024/03/08-14:02:24.830 676c Delete type=0 #63 +2024/03/08-14:02:24.830 676c Delete type=3 #62 diff --git a/packs/actors/LOG.old b/packs/actors/LOG.old index eec288a..368ecf6 100644 --- a/packs/actors/LOG.old +++ b/packs/actors/LOG.old @@ -1,3 +1,3 @@ -2024/03/06-02:03:45.318 a534 Recovering log #55 -2024/03/06-02:03:45.322 a534 Delete type=0 #55 -2024/03/06-02:03:45.322 a534 Delete type=3 #54 +2024/03/08-13:32:41.661 5198 Recovering log #61 +2024/03/08-13:32:41.664 5198 Delete type=0 #61 +2024/03/08-13:32:41.664 5198 Delete type=3 #60 diff --git a/packs/actors/MANIFEST-000058 b/packs/actors/MANIFEST-000064 similarity index 63% rename from packs/actors/MANIFEST-000058 rename to packs/actors/MANIFEST-000064 index 56d03be05069c1e7ca0105114b30dfec1cd2d699..bd3885eadf38519a522677b901c604c702047407 100644 GIT binary patch delta 22 dcmX@bc#3htZhqN(5j745MkYs224*J~HULJv1X} literal 0 HcmV?d00001 diff --git a/system.json b/system.json index 54dc164..557201c 100644 --- a/system.json +++ b/system.json @@ -14,7 +14,7 @@ "readme": "https://github.com/Lee-Talman/knave2e/blob/main/README.md", "bugs": "https://github.com/Lee-Talman/knave2e/issues", "changelog": "https://github.com/Lee-Talman/knave2e/blob/main/CHANGELOG.md", - "version": "0.2.1", + "version": "0.2.2", "compatibility": { "minimum": "10", "verified": "11", @@ -85,7 +85,7 @@ } ], "manifest": "https://raw.githubusercontent.com/Lee-Talman/knave2e/main/system.json", - "download": "https://github.com/Lee-Talman/knave2e/releases/download/0.2.1/system.zip", + "download": "https://github.com/Lee-Talman/knave2e/releases/download/0.2.2/system.zip", "background": "systems/knave2e/assets/anvil-bg.png", "gridDistance": 5, "gridUnits": "ft", diff --git a/templates/actor/actor-monster-sheet.hbs b/templates/actor/actor-monster-sheet.hbs index 61124a6..e01e446 100644 --- a/templates/actor/actor-monster-sheet.hbs +++ b/templates/actor/actor-monster-sheet.hbs @@ -37,18 +37,20 @@ value="{{system.movement}}" data-dtype="Number" />
- {{localize "KNAVE2E.NumberAppearing"}} + {{localize + "KNAVE2E.NumberAppearing"}}
-
+
{{localize "KNAVE2E.HitPoints"}}
-
+
+
@@ -64,6 +66,12 @@
+
+ {{localize "KNAVE2E.ArmorPoints"}} +
+ {{system.armorPoints}} +
+
@@ -73,51 +81,52 @@
{{localize "KNAVE2E.Description"}}
- {{editor system.enrichedHTML target="system.description" button=true owner=owner - editable=editable}} + {{editor system.enrichedHTML target="system.description" button=true owner=owner + editable=editable}}
-
-
-
-
    -
  1. -
    {{localize "KNAVE2E.AttackName"}} -
    -
    {{localize "KNAVE2E.Attacks"}} -
    - -
  2. - {{#each items as |item id|}} -
  3. -
    {{item.name}}
    -
    - - -
    -
    {{item.system.attackAmount}}
    -
    - - -
    -
  4. - {{/each}} -
- - - +
+
    +
  1. +
    {{localize "KNAVE2E.AttackName"}} +
    +
    {{localize "KNAVE2E.Attacks"}} +
    + +
  2. + {{#each items as |item id|}} +
  3. +
    {{item.name}}
    +
    + + +
    +
    {{item.system.attackAmount}} +
    +
    + + +
    +
  4. + {{/each}} +
+
+ + + + \ No newline at end of file diff --git a/templates/item/item-chat-message.hbs b/templates/item/item-chat-message.hbs index 65af214..c54abda 100644 --- a/templates/item/item-chat-message.hbs +++ b/templates/item/item-chat-message.hbs @@ -1,6 +1,6 @@ {{title}} -{{#if data.relic}} +{{#if data.hasDescription}}
{{{data.description}}} @@ -35,4 +35,6 @@

{{rolls.[0].total}}

-{{/if}} \ No newline at end of file +{{/if}} + +{{log data}} \ No newline at end of file