Skip to content

Commit

Permalink
Merge pull request #12 from Lee-Talman/development
Browse files Browse the repository at this point in the history
Release 0.2.2
  • Loading branch information
Lee-Talman authored Mar 8, 2024
2 parents c2fb484 + acdd832 commit af49b7e
Show file tree
Hide file tree
Showing 36 changed files with 199 additions and 104 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# 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
- Armor can be unequipped for AP calculations without being removed from inventory
- Clicking item names or icons in inventory sends their descriptions to chat (only when items have descriptions)
- Fix labels for toggleable buttons on items in actor inventory

## 0.2.1
- Added support for reverse AP rolls for PCs/recruits
- Reduced size of chat message header font
Expand Down
9 changes: 5 additions & 4 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,11 @@

"KNAVE2E.QuantityPerSlot": "# per Slot",

"KNAVE2E.BreakWeaponDetail": "Toggle Broken Weapon",
"KNAVE2E.CastSpellbookDetail": "Toggle Cast Spellbook",
"KNAVE2E.ActiveBlessingDetail": "Toggle Active Blessing",
"KNAVE2E.ActivateLightSourceDetail": "Toggle Light Source",
"KNAVE2E.BreakWeaponDetail": "Break",
"KNAVE2E.CastSpellbookDetail": "Cast",
"KNAVE2E.ActiveBlessingDetail": "Bless",
"KNAVE2E.ActivateLightSourceDetail": "Light",
"KNAVE2E.EquipArmorDetail": "Equip",

"KNAVE2E.AttackRoll": "Attack Roll",
"KNAVE2E.PowerAttackRoll": "Power Attack Roll",
Expand Down
1 change: 1 addition & 0 deletions module/data/armor.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default class Knave2eArmor extends Knave2eItemType {
const schema = super.defineSchema();

schema.armorPoints = new fields.NumberField({ ...requiredInteger, initial: 1, min: 1});
schema.equipped = new fields.BooleanField({ initial: true });

return schema;
}
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
26 changes: 24 additions & 2 deletions module/sheets/actor-sheet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export default class Knave2eActorSheet extends ActorSheet {
}

_updateArmor(context) {
const armorPieces = context.items.filter(i => i.type === "armor" && i.system.dropped === false);
const armorPieces = context.items.filter(i => i.type === "armor" && i.system.dropped === false && i.system.equipped === true);
const uniqueCategories = [];
let armorPoints = 0;

Expand Down Expand Up @@ -318,11 +318,13 @@ export default class Knave2eActorSheet extends ActorSheet {
// Rollable elements (e.g. Abilities)
html.on('click', '.rollable', this._onRollable.bind(this));

// Item Description to chat
html.on('click', '.item-name', this._onItemName.bind(this));

// Toggle Item Icons
html.on('click', '.item-toggle', this._onItemToggle.bind(this));



/* -------------------------------------------- */
/* Item Rolls */
/* -------------------------------------------- */
Expand Down Expand Up @@ -356,6 +358,24 @@ export default class Knave2eActorSheet extends ActorSheet {
html.on('click', '.actor-button.numberAppearing', this._onNumberAppearing.bind(this));
}

async _onItemName(event) {
event.preventDefault();
const a = event.currentTarget;
const systemData = this.actor.system;

const li = a.closest("li");
const item = li.dataset.itemId ? this.actor.items.get(li.dataset.itemId) : null;

if (item.system.description !== ""){
ChatMessage.create({
speaker: ChatMessage.getSpeaker({ actor: this.actor }),
flavor: `${item.name}`,
content:`${item.system.description}`,
rollMode: game.settings.get('core', 'rollMode')
});
}
}

async _onItemToggle(event) {
event.preventDefault();
const a = event.currentTarget;
Expand All @@ -370,6 +390,8 @@ export default class Knave2eActorSheet extends ActorSheet {
return item.update({ "system.broken": !item.system.broken })
case "cast":
return item.update({ "system.cast": !item.system.cast })
case "equip":
return item.update({"system.equipped": !item.system.equipped})
case "blessing":
if (item.system.relic.isActive) {
this.actor.update({
Expand Down
Binary file removed packs/actors/000019.ldb
Binary file not shown.
Binary file added packs/actors/000070.ldb
Binary file not shown.
2 changes: 1 addition & 1 deletion packs/actors/CURRENT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MANIFEST-000058
MANIFEST-000071
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-16:02:40.580 bf0c Recovering log #68
2024/03/08-16:02:40.584 bf0c Delete type=0 #68
2024/03/08-16:02:40.584 bf0c Delete type=3 #66
17 changes: 14 additions & 3 deletions packs/actors/LOG.old
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
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-15:06:29.615 3708 Recovering log #65
2024/03/08-15:06:29.618 3708 Delete type=0 #65
2024/03/08-15:06:29.618 3708 Delete type=3 #64
2024/03/08-16:00:25.524 cb84 Level-0 table #69: started
2024/03/08-16:00:25.526 cb84 Level-0 table #69: 2717 bytes OK
2024/03/08-16:00:25.526 cb84 Delete type=0 #67
2024/03/08-16:00:25.526 cb84 Manual compaction at level-0 from '!actors!trjwBEQQMtRgNF55' @ 72057594037927935 : 1 .. '!actors.items!trjwBEQQMtRgNF55.ruMHE8dQmioMrKyQ' @ 0 : 0; will stop at '!actors.items!trjwBEQQMtRgNF55.ruMHE8dQmioMrKyQ' @ 17 : 1
2024/03/08-16:00:25.526 cb84 Compacting 1@0 + 1@1 files
2024/03/08-16:00:25.529 cb84 Generated table #70@0: 6 keys, 2626 bytes
2024/03/08-16:00:25.529 cb84 Compacted 1@0 + 1@1 files => 2626 bytes
2024/03/08-16:00:25.530 cb84 compacted to: files[ 0 1 0 0 0 0 0 ]
2024/03/08-16:00:25.530 cb84 Delete type=2 #19
2024/03/08-16:00:25.530 cb84 Delete type=2 #69
2024/03/08-16:00:25.531 cb84 Manual compaction at level-0 from '!actors.items!trjwBEQQMtRgNF55.ruMHE8dQmioMrKyQ' @ 17 : 1 .. '!actors.items!trjwBEQQMtRgNF55.ruMHE8dQmioMrKyQ' @ 0 : 0; will stop at (end)
Binary file removed packs/actors/MANIFEST-000058
Binary file not shown.
Binary file added packs/actors/MANIFEST-000071
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-000070
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-16:02:40.573 a7e8 Recovering log #68
2024/03/08-16:02:40.576 a7e8 Delete type=0 #68
2024/03/08-16:02:40.576 a7e8 Delete type=3 #66
10 changes: 7 additions & 3 deletions packs/items/LOG.old
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
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-15:06:29.609 a7e8 Recovering log #65
2024/03/08-15:06:29.611 a7e8 Delete type=0 #65
2024/03/08-15:06:29.612 a7e8 Delete type=3 #64
2024/03/08-16:00:25.521 cb84 Level-0 table #69: started
2024/03/08-16:00:25.521 cb84 Level-0 table #69: 0 bytes OK
2024/03/08-16:00:25.522 cb84 Delete type=0 #67
2024/03/08-16:00:25.522 cb84 Manual compaction at level-0 from '!items!sV2GWqGVqxfb3PD2' @ 72057594037927935 : 1 .. '!items!sV2GWqGVqxfb3PD2' @ 0 : 0; will stop at (end)
Binary file not shown.
Binary file removed packs/monsters/000019.ldb
Binary file not shown.
Binary file added packs/monsters/000070.ldb
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-000071
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-16:02:40.564 bf0c Recovering log #68
2024/03/08-16:02:40.569 bf0c Delete type=0 #68
2024/03/08-16:02:40.569 bf0c Delete type=3 #66
17 changes: 14 additions & 3 deletions packs/monsters/LOG.old
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
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-15:06:29.603 3708 Recovering log #65
2024/03/08-15:06:29.605 3708 Delete type=0 #65
2024/03/08-15:06:29.605 3708 Delete type=3 #64
2024/03/08-16:00:25.513 cb84 Level-0 table #69: started
2024/03/08-16:00:25.514 cb84 Level-0 table #69: 1821 bytes OK
2024/03/08-16:00:25.515 cb84 Delete type=0 #67
2024/03/08-16:00:25.518 cb84 Manual compaction at level-0 from '!actors!GuNBsOpZWgJF8PEZ' @ 72057594037927935 : 1 .. '!actors.items!GuNBsOpZWgJF8PEZ.rcEop0TaEm8qlpXt' @ 0 : 0; will stop at '!actors.items!H9MttKr2aT05fSVJ.rcEop0TaEm8qlpXt' @ 4 : 0
2024/03/08-16:00:25.518 cb84 Compacting 1@0 + 1@1 files
2024/03/08-16:00:25.519 cb84 Generated table #70@0: 3 keys, 1766 bytes
2024/03/08-16:00:25.519 cb84 Compacted 1@0 + 1@1 files => 1766 bytes
2024/03/08-16:00:25.520 cb84 compacted to: files[ 0 1 0 0 0 0 0 ]
2024/03/08-16:00:25.520 cb84 Delete type=2 #19
2024/03/08-16:00:25.520 cb84 Delete type=2 #69
2024/03/08-16:00:25.522 cb84 Manual compaction at level-0 from '!actors.items!H9MttKr2aT05fSVJ.rcEop0TaEm8qlpXt' @ 4 : 0 .. '!actors.items!GuNBsOpZWgJF8PEZ.rcEop0TaEm8qlpXt' @ 0 : 0; will stop at (end)
Binary file removed packs/monsters/MANIFEST-000058
Binary file not shown.
Binary file added packs/monsters/MANIFEST-000071
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-000058
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-16:02:40.588 a7e8 Recovering log #56
2024/03/08-16:02:40.591 a7e8 Delete type=0 #56
2024/03/08-16:02:40.591 a7e8 Delete type=3 #54
10 changes: 7 additions & 3 deletions packs/spells/LOG.old
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
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-15:06:29.622 a7e8 Recovering log #53
2024/03/08-15:06:29.625 a7e8 Delete type=0 #53
2024/03/08-15:06:29.625 a7e8 Delete type=3 #52
2024/03/08-16:00:25.523 cb84 Level-0 table #57: started
2024/03/08-16:00:25.523 cb84 Level-0 table #57: 0 bytes OK
2024/03/08-16:00:25.524 cb84 Delete type=0 #55
2024/03/08-16:00:25.526 cb84 Manual compaction at level-0 from 'undefined' @ 72057594037927935 : 1 .. 'undefined' @ 0 : 0; will stop at (end)
Binary file removed packs/spells/MANIFEST-000046
Binary file not shown.
Binary file added packs/spells/MANIFEST-000058
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
Loading

0 comments on commit af49b7e

Please sign in to comment.