Skip to content

Commit

Permalink
add descriptions to attack rolls, ap to monster rolls, and change pcs…
Browse files Browse the repository at this point in the history
…/recruits to have link actor data selected by default.
  • Loading branch information
Lee-Talman committed Mar 8, 2024
1 parent 040f380 commit cfaa131
Show file tree
Hide file tree
Showing 25 changed files with 113 additions and 84 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion module/data/character.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,5 @@ export default class Knave2eCharacter extends Knave2eActorType {
}

prepareBaseData(){

}
}
4 changes: 4 additions & 0 deletions module/data/monster.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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)" }),
Expand All @@ -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;

Expand Down
8 changes: 8 additions & 0 deletions module/documents/actor.mjs
Original file line number Diff line number Diff line change
@@ -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();
}
Expand Down Expand Up @@ -51,6 +58,7 @@ export default class Knave2eActor extends Actor {
if (actorData.type !== 'monster') return;

const systemData = actorData.system;
systemData.armorPoints = systemData.armorClass - 11;

}

Expand Down
12 changes: 7 additions & 5 deletions module/helpers/items.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: []
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packs/actors/CURRENT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MANIFEST-000058
MANIFEST-000064
6 changes: 3 additions & 3 deletions packs/actors/LOG
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions packs/actors/LOG.old
Original file line number Diff line number Diff line change
@@ -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
Binary file not shown.
2 changes: 1 addition & 1 deletion packs/items/CURRENT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MANIFEST-000058
MANIFEST-000064
6 changes: 3 additions & 3 deletions packs/items/LOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
2024/03/06-02:21:51.106 37dc Recovering log #57
2024/03/06-02:21:51.109 37dc Delete type=0 #57
2024/03/06-02:21:51.109 37dc Delete type=3 #56
2024/03/08-14:02:24.820 6194 Recovering log #63
2024/03/08-14:02:24.823 6194 Delete type=0 #63
2024/03/08-14:02:24.823 6194 Delete type=3 #62
6 changes: 3 additions & 3 deletions packs/items/LOG.old
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
2024/03/06-02:03:45.310 a478 Recovering log #55
2024/03/06-02:03:45.313 a478 Delete type=0 #55
2024/03/06-02:03:45.313 a478 Delete type=3 #54
2024/03/08-13:32:41.653 60e4 Recovering log #61
2024/03/08-13:32:41.657 60e4 Delete type=0 #61
2024/03/08-13:32:41.657 60e4 Delete type=3 #60
Binary file not shown.
2 changes: 1 addition & 1 deletion packs/monsters/CURRENT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MANIFEST-000058
MANIFEST-000064
6 changes: 3 additions & 3 deletions packs/monsters/LOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
2024/03/06-02:21:51.100 a634 Recovering log #57
2024/03/06-02:21:51.102 a634 Delete type=0 #57
2024/03/06-02:21:51.102 a634 Delete type=3 #56
2024/03/08-14:02:24.815 676c Recovering log #63
2024/03/08-14:02:24.817 676c Delete type=0 #63
2024/03/08-14:02:24.817 676c Delete type=3 #62
6 changes: 3 additions & 3 deletions packs/monsters/LOG.old
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
2024/03/06-02:03:45.304 a534 Recovering log #55
2024/03/06-02:03:45.307 a534 Delete type=0 #55
2024/03/06-02:03:45.307 a534 Delete type=3 #54
2024/03/08-13:32:41.647 5198 Recovering log #61
2024/03/08-13:32:41.650 5198 Delete type=0 #61
2024/03/08-13:32:41.650 5198 Delete type=3 #60
Binary file not shown.
2 changes: 1 addition & 1 deletion packs/spells/CURRENT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MANIFEST-000046
MANIFEST-000052
6 changes: 3 additions & 3 deletions packs/spells/LOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
2024/03/06-02:21:51.125 37dc Recovering log #45
2024/03/06-02:21:51.128 37dc Delete type=0 #45
2024/03/06-02:21:51.128 37dc Delete type=3 #44
2024/03/08-14:02:24.834 6194 Recovering log #51
2024/03/08-14:02:24.837 6194 Delete type=0 #51
2024/03/08-14:02:24.837 6194 Delete type=3 #50
6 changes: 3 additions & 3 deletions packs/spells/LOG.old
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
2024/03/06-02:03:45.325 a478 Recovering log #43
2024/03/06-02:03:45.327 a478 Delete type=0 #43
2024/03/06-02:03:45.328 a478 Delete type=3 #42
2024/03/08-13:32:41.669 60e4 Recovering log #49
2024/03/08-13:32:41.672 60e4 Delete type=0 #49
2024/03/08-13:32:41.672 60e4 Delete type=3 #48
Binary file removed packs/spells/MANIFEST-000046
Binary file not shown.
Binary file added packs/spells/MANIFEST-000052
Binary file not shown.
4 changes: 2 additions & 2 deletions system.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
101 changes: 55 additions & 46 deletions templates/actor/actor-monster-sheet.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,20 @@
value="{{system.movement}}" data-dtype="Number" />
</div>
<div class="grid-span-1 flexcol no-wrap flex-group-center numAppearing">
<a class="resource-label actor-button numberAppearing">{{localize "KNAVE2E.NumberAppearing"}}</a>
<a class="resource-label actor-button numberAppearing">{{localize
"KNAVE2E.NumberAppearing"}}</a>
<input class="resource-label content narrow" type="text"
name="system.numberAppearing.combined" value="{{system.numberAppearing.combined}}"
data-dtype="String" />
</div>
</div>
<div class="grid grid-4col no-wrap flex-between flex-group-center info-3" style="margin-top: 5px;">
<div class="grid-span-2 flexcol no-wrap flex-group-center">
<div class="grid-span-1 flexcol no-wrap flex-group-center">
<div class="resource-label">{{localize "KNAVE2E.HitPoints"}}</div>
<div class="progress-container horizontal hitPoints">
<div class="progress-bar">
<div class="progress-fill hitPoints" style="width:{{system.hitPoints.progress}}%"></div>
<div class="progress-fill hitPoints" style="width:{{system.hitPoints.progress}}%">
</div>
<input class="progress-input resource-label content" name="system.hitPoints.value"
value="{{system.hitPoints.value}}" />
</div>
Expand All @@ -64,6 +66,12 @@
<input class="resource-label transparent shield character" type="text"
name="system.armorClass" value="{{system.armorClass}}" />
</div>
<div class="grid-span-1 flexcol no-wrap flex-group-center">
<a class="resource-label transparent actor-button ap">{{localize "KNAVE2E.ArmorPoints"}}</a>
<div class="resource-label content circle character">
{{system.armorPoints}}
</div>
</div>
</div>
</div>
</header>
Expand All @@ -73,51 +81,52 @@
<div class="resources">
<div class="resource-label">{{localize "KNAVE2E.Description"}}</div>
<section class="editor">
{{editor system.enrichedHTML target="system.description" button=true owner=owner
editable=editable}}
{{editor system.enrichedHTML target="system.description" button=true owner=owner
editable=editable}}
</section>
</div>
</div>
<div class="items">
<ol class="items-list">
<li class="item grid grid-12col items-header">
<div class="resource-label item-name-header grid-span-8">{{localize "KNAVE2E.AttackName"}}
</div>
<div class="resource-label item-slots-header grid-span-2">{{localize "KNAVE2E.Attacks"}}
</div>
<div class="resource-label item-controls-header grid-span-2">
<a class="item-control item-create" title="Add Attack" data-type="item"><i
class="fas fa-plus"></i> Add attack</a>
</div>
</li>
{{#each items as |item id|}}
<li class="item grid grid-12col" data-item-id="{{item._id}}">
<div class="item-name detail grid-span-6" style="margin-left:2px;">{{item.name}}</div>
<div class="item-buttons grid-span-2 flexrow flex-group-center">
<button class="item-button attack sheet" data-action="attack" type="button"
title={{localize "KNAVE2E.AttackRoll" }}>{{localize "KNAVE2E.AttackAbbr"}}</button>
<button class="item-button damage sheet" data-action="damage" type="button"
title={{localize "KNAVE2E.DamageRoll" }}>{{localize "KNAVE2E.DamageAbbr"}}</button>
</div>
<div class="item-slots detail grid-span-2 flexrow flex-group-center">{{item.system.attackAmount}}</div>
<div class="item-controls grid-span-2 flexrow flex-group-center">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ol>
</div>
</section>

<footer class="footer">
<div class="flexrow no-wrap flex-group-center ">
<p style="font-size:smaller">Copyright &#169; 2023 <a
href="https://www.patreon.com/questingbeast/posts">Ben
Milton and Questing Beast LLC.</a> Logo Design by <a
href="https://www.behance.net/MindkillerINK?locale=en_US">Tim Hastings</a>.</p>
</div>
</footer>
</div>
<div class="items">
<ol class="items-list">
<li class="item grid grid-12col items-header">
<div class="resource-label item-name-header grid-span-8">{{localize "KNAVE2E.AttackName"}}
</div>
<div class="resource-label item-slots-header grid-span-2">{{localize "KNAVE2E.Attacks"}}
</div>
<div class="resource-label item-controls-header grid-span-2">
<a class="item-control item-create" title="Add Attack" data-type="item"><i
class="fas fa-plus"></i> Add attack</a>
</div>
</li>
{{#each items as |item id|}}
<li class="item grid grid-12col" data-item-id="{{item._id}}">
<div class="item-name detail grid-span-6" style="margin-left:2px;">{{item.name}}</div>
<div class="item-buttons grid-span-2 flexrow flex-group-center">
<button class="item-button attack sheet" data-action="attack" type="button"
title={{localize "KNAVE2E.AttackRoll" }}>{{localize "KNAVE2E.AttackAbbr"}}</button>
<button class="item-button damage sheet" data-action="damage" type="button"
title={{localize "KNAVE2E.DamageRoll" }}>{{localize "KNAVE2E.DamageAbbr"}}</button>
</div>
<div class="item-slots detail grid-span-2 flexrow flex-group-center">{{item.system.attackAmount}}
</div>
<div class="item-controls grid-span-2 flexrow flex-group-center">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ol>
</div>
</section>

<footer class="footer">
<div class="flexrow no-wrap flex-group-center ">
<p style="font-size:smaller">Copyright &#169; 2023 <a
href="https://www.patreon.com/questingbeast/posts">Ben
Milton and Questing Beast LLC.</a> Logo Design by <a
href="https://www.behance.net/MindkillerINK?locale=en_US">Tim Hastings</a>.</p>
</div>
</footer>
</div>
</div>
</form>
6 changes: 4 additions & 2 deletions templates/item/item-chat-message.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{title}}

{{#if data.relic}}
{{#if data.hasDescription}}
<hr>
<div class="renderedHTML" style="margin-top: 5px">
{{{data.description}}}
Expand Down Expand Up @@ -35,4 +35,6 @@
<h4 class="dice-total">{{rolls.[0].total}}</h4>
</div>
</div>
{{/if}}
{{/if}}

{{log data}}

0 comments on commit cfaa131

Please sign in to comment.