Skip to content

Commit b315c2a

Browse files
committed
fix: 🐛 Critical Injuries dragged on to sheet
1 parent 861e660 commit b315c2a

File tree

22 files changed

+32
-32
lines changed

22 files changed

+32
-32
lines changed

Diff for: .changeset/cyan-pots-drive.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"forbidden-lands": patch
3+
---
4+
5+
Fixed an issue where critical injuries dragged onto character sheets would not be created

Diff for: src/actor/actor-document.js

+6-11
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,12 @@ export class ForbiddenLandsActor extends Actor {
8282
for await (const entity of newData) {
8383
if (!entity.system) continue;
8484

85-
entity.system = await Object.entries(entity.system).reduce(
86-
async (obj, [key, value]) => {
87-
if (typeof value === "string" && value.match(inlineRoll)) {
88-
const result = await createRoll(inlineRoll.exec(value));
89-
value = value.replace(inlineRoll, result);
90-
}
91-
const resolved = await obj;
92-
return { ...resolved, [key]: value };
93-
},
94-
{},
95-
);
85+
for await (const [key, value] of Object.entries(entity.system)) {
86+
if (typeof value === "string" && value.match(inlineRoll)) {
87+
const result = await createRoll(inlineRoll.exec(value));
88+
entity.system[key] = value.replace(inlineRoll, result);
89+
}
90+
}
9691

9792
// We only want to touch flags of items that are considered "gear"
9893
if (!CONFIG.fbl.carriedItemTypes.includes(entity.type)) continue;

Diff for: src/actor/character/character-sheet.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class ForbiddenLandsCharacterSheet extends ForbiddenLandsActorSheet {
1111
"forbidden-lands",
1212
"useHealthAndResolve",
1313
);
14-
return mergeObject(super.defaultOptions, {
14+
return foundry.utils.mergeObject(super.defaultOptions, {
1515
classes: ["forbidden-lands", "sheet", "actor"],
1616
width: 660,
1717
height: useHealthAndResolve ? 790 : 740,

Diff for: src/actor/monster/monster-sheet.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import localizeString from "@utils/localize-string.js";
55
//import { ActorSheetConfig } from "@utils/sheet-config.js";
66
export class ForbiddenLandsMonsterSheet extends ForbiddenLandsActorSheet {
77
static get defaultOptions() {
8-
return mergeObject(super.defaultOptions, {
8+
return foundry.utils.mergeObject(super.defaultOptions, {
99
...super.defaultOptions,
1010
classes: ["forbidden-lands", "sheet", "actor"],
1111
template:

Diff for: src/actor/party/party-sheet.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class ForbiddenLandsPartySheet extends ActorSheet {
99
dragSelector: ".party-member",
1010
dropSelector: ".party-member-list",
1111
});
12-
return mergeObject(super.defaultOptions, {
12+
return foundry.utils.mergeObject(super.defaultOptions, {
1313
classes: ["forbidden-lands", "sheet", "actor", "party"],
1414
template: "systems/forbidden-lands/templates/actor/party/party-sheet.hbs",
1515
width: window.innerWidth * 0.05 + 650,

Diff for: src/actor/stronghold/stronghold-sheet.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ForbiddenLandsActorSheet } from "../actor-sheet.js";
22
export class ForbiddenLandsStrongholdSheet extends ForbiddenLandsActorSheet {
33
static get defaultOptions() {
4-
return mergeObject(super.defaultOptions, {
4+
return foundry.utils.mergeObject(super.defaultOptions, {
55
...super.defaultOptions,
66
classes: ["forbidden-lands", "sheet", "actor"],
77
template:

Diff for: src/components/character-generator/character-generator.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class ForbiddenLandsCharacterGenerator extends Application {
1010
}
1111

1212
static get defaultOptions() {
13-
return mergeObject(super.defaultOptions, {
13+
return foundry.utils.mergeObject(super.defaultOptions, {
1414
classes: ["forbidden-lands", "sheet", "actor"],
1515
template:
1616
"systems/forbidden-lands/templates/components/character-generator/generator-sheet.hbs",

Diff for: src/components/roll-engine/engine.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export class FBLRollHandler extends FormApplication {
9494
* Foundry override intended to customize the window render.
9595
*/
9696
static get defaultOptions() {
97-
return mergeObject(super.defaultOptions, {
97+
return foundry.utils.mergeObject(super.defaultOptions, {
9898
classes: ["forbidden-lands"],
9999
width: "500",
100100
height: "auto",

Diff for: src/item/armor/armor-sheet.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ForbiddenLandsItemSheet } from "@item/item-sheet";
22

33
export class ForbiddenLandsArmorSheet extends ForbiddenLandsItemSheet {
44
static get defaultOptions() {
5-
return mergeObject(super.defaultOptions, {
5+
return foundry.utils.mergeObject(super.defaultOptions, {
66
...super.defaultOptions,
77
template: "systems/forbidden-lands/templates/item/armor/armor-sheet.hbs",
88
tabs: [

Diff for: src/item/building/building-sheet.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ForbiddenLandsItemSheet } from "@item/item-sheet";
22
export class ForbiddenLandsBuildingSheet extends ForbiddenLandsItemSheet {
33
static get defaultOptions() {
4-
return mergeObject(super.defaultOptions, {
4+
return foundry.utils.mergeObject(super.defaultOptions, {
55
...super.defaultOptions,
66
template:
77
"systems/forbidden-lands/templates/item/building/building-sheet.hbs",

Diff for: src/item/critical-injury/critical-injury-sheet.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ForbiddenLandsItemSheet } from "@item/item-sheet";
22
export class ForbiddenLandsCriticalInjurySheet extends ForbiddenLandsItemSheet {
33
static get defaultOptions() {
4-
return mergeObject(super.defaultOptions, {
4+
return foundry.utils.mergeObject(super.defaultOptions, {
55
...super.defaultOptions,
66
template:
77
"systems/forbidden-lands/templates/item/critical-injury/critical-injury-sheet.hbs",

Diff for: src/item/gear/gear-sheet.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ForbiddenLandsItemSheet } from "@item/item-sheet";
22
export class ForbiddenLandsGearSheet extends ForbiddenLandsItemSheet {
33
static get defaultOptions() {
4-
return mergeObject(super.defaultOptions, {
4+
return foundry.utils.mergeObject(super.defaultOptions, {
55
...super.defaultOptions,
66
template: "systems/forbidden-lands/templates/item/gear/gear-sheet.hbs",
77
tabs: [

Diff for: src/item/hireling/hireling-sheet.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ForbiddenLandsItemSheet } from "@item/item-sheet";
22
export class ForbiddenLandsHirelingSheet extends ForbiddenLandsItemSheet {
33
static get defaultOptions() {
4-
return mergeObject(super.defaultOptions, {
4+
return foundry.utils.mergeObject(super.defaultOptions, {
55
...super.defaultOptions,
66
template:
77
"systems/forbidden-lands/templates/item/hireling/hireling-sheet.hbs",

Diff for: src/item/item-document.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ export class ForbiddenLandsItem extends Item {
166166
}
167167
const message = await ChatMessage.create(chatData);
168168
if (itemData.isCriticalInjury) {
169-
const content = $(message.data.content);
169+
const content = $(message.content);
170170
const limit = content.find("[data-type='limit']").text().trim();
171171
const healingTime = content.find("[data-type='healtime']").text().trim();
172172
itemData.system.limit = limit;

Diff for: src/item/item-sheet.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class ForbiddenLandsItemSheet extends ItemSheet {
1212
}
1313

1414
static get defaultOptions() {
15-
return mergeObject(super.defaultOptions, {
15+
return foundry.utils.mergeObject(super.defaultOptions, {
1616
...super.defaultOptions,
1717
classes: ["forbidden-lands", "sheet", "item"],
1818
width: window.innerWidth * 0.08 + 350,

Diff for: src/item/monster-attack/monster-attack-sheet.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ForbiddenLandsItemSheet } from "@item/item-sheet";
22
export class ForbiddenLandsMonsterAttackSheet extends ForbiddenLandsItemSheet {
33
static get defaultOptions() {
4-
return mergeObject(super.defaultOptions, {
4+
return foundry.utils.mergeObject(super.defaultOptions, {
55
...super.defaultOptions,
66
template:
77
"systems/forbidden-lands/templates/item/monster-attack/monster-attack-sheet.hbs",

Diff for: src/item/raw-material/raw-material-sheet.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ForbiddenLandsItemSheet } from "@item/item-sheet";
22
export class ForbiddenLandsRawMaterialSheet extends ForbiddenLandsItemSheet {
33
static get defaultOptions() {
4-
return mergeObject(super.defaultOptions, {
4+
return foundry.utils.mergeObject(super.defaultOptions, {
55
...super.defaultOptions,
66
template:
77
"systems/forbidden-lands/templates/item/raw-material/raw-material-sheet.hbs",

Diff for: src/item/spell/spell-sheet.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ForbiddenLandsItemSheet } from "@item/item-sheet";
22
export class ForbiddenLandsSpellSheet extends ForbiddenLandsItemSheet {
33
static get defaultOptions() {
4-
return mergeObject(super.defaultOptions, {
4+
return foundry.utils.mergeObject(super.defaultOptions, {
55
...super.defaultOptions,
66
template: "systems/forbidden-lands/templates/item/spell/spell-sheet.hbs",
77
});

Diff for: src/item/talent/talent-sheet.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ForbiddenLandsItemSheet } from "@item/item-sheet";
22
export class ForbiddenLandsTalentSheet extends ForbiddenLandsItemSheet {
33
static get defaultOptions() {
4-
return mergeObject(super.defaultOptions, {
4+
return foundry.utils.mergeObject(super.defaultOptions, {
55
...super.defaultOptions,
66
template:
77
"systems/forbidden-lands/templates/item/talent/talent-sheet.hbs",

Diff for: src/item/weapon/weapon-sheet.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ForbiddenLandsItemSheet } from "@item/item-sheet";
22
export class ForbiddenLandsWeaponSheet extends ForbiddenLandsItemSheet {
33
static get defaultOptions() {
4-
return mergeObject(super.defaultOptions, {
4+
return foundry.utils.mergeObject(super.defaultOptions, {
55
...super.defaultOptions,
66
template:
77
"systems/forbidden-lands/templates/item/weapon/weapon-sheet.hbs",

Diff for: src/system/core/migration.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ const migrateSceneData = (scene) => {
207207
const updates = new Map(update[embeddedName].map((u) => [u._id, u]));
208208
for (const embedded of actorData[embeddedName]) {
209209
const toUpdate = updates.get(embedded._id);
210-
if (toUpdate) mergeObject(embedded, toUpdate);
210+
if (toUpdate) foundry.utils.mergeObject(embedded, toUpdate);
211211
}
212212
delete update[embeddedName];
213213
}

Diff for: src/system/core/settings.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class TableConfigMenu extends FormApplication {
3838
});
3939

4040
static get defaultOptions() {
41-
return mergeObject(super.defaultOptions, {
41+
return foundry.utils.mergeObject(super.defaultOptions, {
4242
template:
4343
"systems/forbidden-lands/templates/components/tables-config.hbs",
4444
classes: ["tables-config"],
@@ -127,7 +127,7 @@ export class SheetConfigMenu extends FormApplication {
127127
});
128128

129129
static get defaultOptions() {
130-
return mergeObject(super.defaultOptions, {
130+
return foundry.utils.mergeObject(super.defaultOptions, {
131131
template: "systems/forbidden-lands/templates/components/sheet-config.hbs",
132132
classes: ["sheet-config"],
133133
title: "CONFIG.SHEET_CONFIG.TITLE",

0 commit comments

Comments
 (0)