diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8af50ec5..61cf4cf4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,10 @@
# Releases
-## Version 4.0.7 [Hero System 6e (Unofficial) v2](https://github.com/dmdorman/hero6e-foundryvtt)
+## Version 4.0.8 [Hero System 6e (Unofficial) v2](https://github.com/dmdorman/hero6e-foundryvtt)
+
+- Improved DEADLYBLOW so it does not apply to adjustment powers, sense-affecting powers, or ENTANGLES. GM still has to confirm DEADLYBLOW with applicable powers. [#1493](https://github.com/dmdorman/hero6e-foundryvtt/issues/1493)
+
+## Version 4.0.7
- Fixed Flash, which now has a unique icon per sense group. [#1486](https://github.com/dmdorman/hero6e-foundryvtt/issues/1486)
- Conditional DAMAGEREDUCTION and DAMAGENEGATION defenses now prompt for applicability. [#1478](https://github.com/dmdorman/hero6e-foundryvtt/issues/1478)
diff --git a/module/actor/actor.mjs b/module/actor/actor.mjs
index e2114880..7ac71006 100644
--- a/module/actor/actor.mjs
+++ b/module/actor/actor.mjs
@@ -2398,10 +2398,6 @@ export class HeroSystem6eActor extends Actor {
this.system.pointsDetail[item.parentItem?.type || item.type] += _realCost;
this.system.activePointsDetail[item.parentItem?.type || item.type] += _activePoints;
-
- if ((item.parentItem?.type || item.type) === "power") {
- console.log(_realCost, item.name);
- }
}
}
diff --git a/module/config.mjs b/module/config.mjs
index 7185bd4e..f00cf052 100644
--- a/module/config.mjs
+++ b/module/config.mjs
@@ -3921,6 +3921,14 @@ function addPower(powerDescription6e, powerOverrideFor5e) {
return 0;
}
},
+ appliesTo: function (item) {
+ // Maneuver or other poorly defined item, assume it applies
+ if (!item || !item.baseInfo) return true;
+ if (item.baseInfo.type.includes("adjustment")) return false;
+ if (item.baseInfo.type.includes("sense-affecting")) return false;
+ if (item.system.XMLID === "ENTANGLE") return false;
+ return true;
+ },
xml: ``,
},
{},
diff --git a/module/handlebars-helpers.mjs b/module/handlebars-helpers.mjs
index 14d339b7..5648bc25 100644
--- a/module/handlebars-helpers.mjs
+++ b/module/handlebars-helpers.mjs
@@ -12,6 +12,7 @@ export function initializeHandlebarsHelpers() {
Handlebars.registerHelper("isdefined", isDefined);
Handlebars.registerHelper("toLowerCase", toLowerCase);
Handlebars.registerHelper("toUpperCase", toUpperCase);
+ Handlebars.registerHelper("appliesTo", appliesTo);
}
function indexOf(str, searchTerm) {
@@ -63,3 +64,9 @@ function concat() {
function isDefined(value) {
return value !== undefined;
}
+
+// Typically to determine if DEADLYBLOW applies to a specific attack
+function appliesTo(power, attack) {
+ if (typeof power?.baseInfo?.appliesTo !== "function") return false;
+ return power.baseInfo.appliesTo(attack);
+}
diff --git a/module/heroCompendiums.mjs b/module/heroCompendiums.mjs
index c227a783..908772c0 100644
--- a/module/heroCompendiums.mjs
+++ b/module/heroCompendiums.mjs
@@ -167,7 +167,7 @@ async function CreateHeroItems() {
)) {
const itemData = HeroSystem6eItem.itemDataFromXml(power.xml, bogusActor);
itemData.system.versionHeroSystem6eManuallyCreated = game.system.version;
- console.log(power, itemData, bogusActor);
+ //console.log(power, itemData, bogusActor);
if (power.type.includes("characteristic")) {
itemData.folder = folderPowerCharacteristic[0].id;
} else if (power.type.includes("perk")) {
diff --git a/module/item/item-attack-application.mjs b/module/item/item-attack-application.mjs
index a187cd48..e90a643b 100644
--- a/module/item/item-attack-application.mjs
+++ b/module/item/item-attack-application.mjs
@@ -262,11 +262,8 @@ export class ItemAttackFormApplication extends FormApplication {
const DEADLYBLOW = item.actor.items.find((o) => o.system.XMLID === "DEADLYBLOW");
if (DEADLYBLOW) {
item.system.conditionalAttacks ??= {};
- item.system.conditionalAttacks[DEADLYBLOW.id] ??= {
- ...DEADLYBLOW,
- id: DEADLYBLOW.id,
- };
- item.system.conditionalAttacks[DEADLYBLOW.id].checked ??= true;
+ item.system.conditionalAttacks[DEADLYBLOW.id] = DEADLYBLOW;
+ item.system.conditionalAttacks[DEADLYBLOW.id].system.checked ??= true;
}
data.action = Attack.getActionInfo(
@@ -402,10 +399,10 @@ export class ItemAttackFormApplication extends FormApplication {
// Save conditionalAttack check
const expandedData = foundry.utils.expandObject(formData);
for (const ca in expandedData?.system?.conditionalAttacks) {
- console.log(ca);
- this.data.item.system.conditionalAttacks[ca].checked = expandedData.system.conditionalAttacks[ca].checked;
- await this.data.item.update({
- [`system.conditionalAttacks`]: this.data.item.system.conditionalAttacks,
+ // this.data.item.system.conditionalAttacks[ca].system.checked =
+ // expandedData.system.conditionalAttacks[ca].system.checked;
+ await this.data.item.system.conditionalAttacks[ca].update({
+ [`system.checked`]: expandedData.system.conditionalAttacks[ca].system.checked,
});
}
diff --git a/module/utility/damage.mjs b/module/utility/damage.mjs
index 832c5041..31072625 100644
--- a/module/utility/damage.mjs
+++ b/module/utility/damage.mjs
@@ -396,11 +396,8 @@ export function convertToDcFromItem(item, options) {
const DEADLYBLOW = item.actor?.items.find((o) => o.system.XMLID === "DEADLYBLOW");
if (DEADLYBLOW) {
item.system.conditionalAttacks ??= {};
- item.system.conditionalAttacks[DEADLYBLOW.id] ??= {
- ...DEADLYBLOW,
- id: DEADLYBLOW.id,
- };
- item.system.conditionalAttacks[DEADLYBLOW.id].checked ??= true;
+ item.system.conditionalAttacks[DEADLYBLOW.id] = DEADLYBLOW;
+ item.system.conditionalAttacks[DEADLYBLOW.id].system.checked ??= true;
}
if (item.actor) {
@@ -421,7 +418,12 @@ export function convertToDcFromItem(item, options) {
}
// If unchecked or missing then assume it is enabled
- if (!item.system.conditionalAttacks[key].checked) continue;
+ if (!conditionalAttack.system.checked) continue;
+
+ // Make sure conditionalAttack applies (only for DEADLYBLOW at the moment)
+ if (typeof conditionalAttack.baseInfo?.appliesTo === "function") {
+ if (!conditionalAttack.baseInfo.appliesTo(item)) continue;
+ }
switch (conditionalAttack.system.XMLID) {
case "DEADLYBLOW": {
@@ -442,6 +444,7 @@ export function convertToDcFromItem(item, options) {
: ""
}`,
});
+
break;
}
default:
diff --git a/templates/attack/item-attack-application.hbs b/templates/attack/item-attack-application.hbs
index 669abb5b..205438e5 100644
--- a/templates/attack/item-attack-application.hbs
+++ b/templates/attack/item-attack-application.hbs
@@ -1,4 +1,4 @@
-{{!-- {{ log 'HEROSYS ITEM ATTACK APPLICATION CARD item-attack-application' this }} --}}
+{{ log 'HEROSYS ITEM ATTACK APPLICATION CARD item-attack-application' this }}