Skip to content

Commit

Permalink
Merge pull request dmdorman#1171 from phBalance/phBalance/clean-and-p…
Browse files Browse the repository at this point in the history
…ublish

Clean and publish and 3.0.90
  • Loading branch information
phBalance authored Aug 25, 2024
2 parents 6c075c7 + 71b9cba commit 90dbc5f
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 82 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Releases

## Version 3.0.90 So far... [Hero System 6e (Unofficial) v2](https://github.com/dmdorman/hero6e-foundryvtt)
## Version 3.0.90 [Hero System 6e (Unofficial) v2](https://github.com/dmdorman/hero6e-foundryvtt)

- Added NOTES to item descriptions [#1140](https://github.com/dmdorman/hero6e-foundryvtt/issues/1140)
- Initial support for Enhanced Perception [#1157](https://github.com/dmdorman/hero6e-foundryvtt/issues/1157)
Expand Down
3 changes: 2 additions & 1 deletion module/item/item.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,8 @@ export class HeroSystem6eItem extends Item {
item.system.active = !itemEffects.disabled;
}

const actorEffects = item.actor.effects.find((o) => o.origin === item.actor.items.get(item._id).uuid);
// NOTE: item._id can be null in the case of a temporary/effective item.
const actorEffects = item.actor.effects.find((o) => o.origin === item.actor.items.get(item._id)?.uuid);
{
if (actorEffects) {
item.system.showToggle = true;
Expand Down
49 changes: 12 additions & 37 deletions module/testing/testing-damage-functions.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ export function registerDamageFunctionTests(quench) {
});
});

describe("convertToDcFromItem 6e", function () {
describe("convertToDcFromItem 6e - Killing Strike", function () {
const contents = `
<MANEUVER XMLID="MANEUVER" ID="1723406694834" BASECOST="4.0" LEVELS="0" ALIAS="Killing Strike" POSITION="0" MULTIPLIER="1.0" GRAPHIC="Burst" COLOR="255 255 255" SFX="Default" SHOW_ACTIVE_COST="Yes" INCLUDE_NOTES_IN_PRINTOUT="Yes" NAME="" CATEGORY="Hand To Hand" DISPLAY="Killing Strike" OCV="-2" DCV="+0" DC="2" PHASE="1/2" EFFECT="[KILLINGDC]" ADDSTR="Yes" ACTIVECOST="10" DAMAGETYPE="0" MAXSTR="0" STRMULT="1" USEWEAPON="No" WEAPONEFFECT="[WEAPONKILLINGDC]">
<NOTES />
<NOTES />
</MANEUVER>
`;
let item;
Expand All @@ -169,30 +169,9 @@ export function registerDamageFunctionTests(quench) {
await item._postUpload();
actor.items.set(item.system.XMLID, item);
});
// const item = new HeroSystem6eItem({
// name: "Test",
// type: "attack",
// system: {
// dice: 1,
// extraDice: "pip",
// killing: true,
// },
// parent: actor,
// });

// const item_nk = new HeroSystem6eItem({
// name: "Test",
// type: "attack",
// system: {
// dice: 1,
// extraDice: "pip",
// killing: false,
// },
// parent: actor,
// });

it("6e Killing Strike dc", function () {
// +2DC Kiling Strike; +2DC from STR
// +2DC Killing Strike; +2DC from STR
assert.equal(convertToDcFromItem(item).dc, 4);
});

Expand All @@ -203,16 +182,12 @@ export function registerDamageFunctionTests(quench) {
it("6e Killing Strike description", function () {
assert.equal(item.system.description, "1/2 Phase, -2 OCV, +0 DCV, HKA 1d6+1");
});

// it("normal", function () {
// assert.equal(convertToDcFromItem(item_nk).dc, 1.2);
// });
});

describe("convertToDcFromItem 5e", function () {
describe("convertToDcFromItem 5e - Killing Strike", function () {
const contents = `
<MANEUVER XMLID="MANEUVER" ID="1724519971623" BASECOST="4.0" LEVELS="0" ALIAS="Killing Strike" POSITION="0" MULTIPLIER="1.0" GRAPHIC="Burst" COLOR="255 255 255" SFX="Default" SHOW_ACTIVE_COST="Yes" INCLUDE_NOTES_IN_PRINTOUT="Yes" NAME="" CATEGORY="Hand To Hand" DISPLAY="Killing Strike" OCV="-2" DCV="+0" DC="4" PHASE="1/2" EFFECT="[KILLINGDC]" ADDSTR="Yes" ACTIVECOST="10" DAMAGETYPE="0" MAXSTR="0" STRMULT="1" USEWEAPON="No" WEAPONEFFECT="[WEAPONKILLINGDC]">
<NOTES />
<NOTES />
</MANEUVER>
`;
let item;
Expand All @@ -236,7 +211,7 @@ export function registerDamageFunctionTests(quench) {
});

it("5e Killing Strike dc", function () {
// +2DC Kiling Strike; +2DC from STR
// +2DC Killing Strike; +2DC from STR
assert.equal(convertToDcFromItem(item).dc, 4);
});

Expand All @@ -249,10 +224,10 @@ export function registerDamageFunctionTests(quench) {
});
});

describe("convertToDcFromItem 6e", function () {
describe("convertToDcFromItem 6e - Martial Strike", function () {
const contents = `
<MANEUVER XMLID="MANEUVER" ID="1724545320876" BASECOST="4.0" LEVELS="0" ALIAS="Martial Strike" POSITION="1" MULTIPLIER="1.0" GRAPHIC="Burst" COLOR="255 255 255" SFX="Default" SHOW_ACTIVE_COST="Yes" INCLUDE_NOTES_IN_PRINTOUT="Yes" NAME="" CATEGORY="Hand To Hand" DISPLAY="Martial Strike" OCV="+0" DCV="+2" DC="2" PHASE="1/2" EFFECT="[NORMALDC] Strike" ADDSTR="Yes" ACTIVECOST="20" DAMAGETYPE="0" MAXSTR="0" STRMULT="1" USEWEAPON="No" WEAPONEFFECT="Weapon [WEAPONDC] Strike">
<NOTES />
<NOTES />
</MANEUVER>
`;
let item;
Expand All @@ -275,7 +250,7 @@ export function registerDamageFunctionTests(quench) {
});

it("6e Martial Strike dc", function () {
// +2DC Kiling Strike; +2DC from STR
// +2DC Martial Strike; +2DC from STR
assert.equal(convertToDcFromItem(item).dc, 4);
});

Expand All @@ -288,10 +263,10 @@ export function registerDamageFunctionTests(quench) {
});
});

describe("NND", function () {
describe("NND 6e - Choke Hold", function () {
const contents = `
<MANEUVER XMLID="MANEUVER" ID="1724607722912" BASECOST="4.0" LEVELS="0" ALIAS="Choke Hold" POSITION="2" MULTIPLIER="1.0" GRAPHIC="Burst" COLOR="255 255 255" SFX="Default" SHOW_ACTIVE_COST="Yes" INCLUDE_NOTES_IN_PRINTOUT="Yes" NAME="" CATEGORY="Hand To Hand" DISPLAY="Choke Hold" OCV="-2" DCV="+0" DC="4" PHASE="1/2" EFFECT="Grab One Limb; [NNDDC]" ADDSTR="No" ACTIVECOST="20" DAMAGETYPE="0" MAXSTR="0" STRMULT="1" USEWEAPON="No" WEAPONEFFECT="Grab One Limb; [NNDDC]">
<NOTES />
<NOTES />
</MANEUVER>
`;
let item;
Expand All @@ -314,7 +289,7 @@ export function registerDamageFunctionTests(quench) {
});

it("NND Choke Hold dc", function () {
// NND (the DC should be halved; suspect because of AVAD/NND implied limitation; Choak, Nerve Strike)
// NND (the DC should be halved; suspect because of AVAD/NND implied limitation (e.g. Choke, Nerve Strike)) (note: no str added)
assert.equal(convertToDcFromItem(item).dc, 2);
});

Expand Down
55 changes: 13 additions & 42 deletions module/utility/damage.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function convertToDcFromItem(item, options) {
let tags = [];
let end = 0;
let baseDcParts = {};
let tooltip = null;
let tooltip = "";

// MartialArts & Maneuvers have DC
dc = parseInt(item.system.DC) || 0;
Expand All @@ -51,7 +51,7 @@ export function convertToDcFromItem(item, options) {
(item.system.XMLID === "MANEUVER" || ["maneuver", "martialart"].includes(item.type))
) {
dc = Math.floor(dc / 2);
tooltip = "it takes two Extra DCs to add +1 DC to a Killing Damage attack";
tooltip = "It takes two Extra DCs to add +1 DC to a Killing Damage attack";
}

// NND (the DC should be halved; suspect because of AVAD/NND implied limitation; Nerve Strike)
Expand All @@ -61,69 +61,40 @@ export function convertToDcFromItem(item, options) {
}

// Powers use LEVELS, which we will convert to DCs
if (!dc) {
if (dc === 0) {
dc = parseInt(item.system.LEVELS) || 0;
if (item.system.killing) {
dc *= 3;
} else {
console.log(item);
}
}

// Killing Attack
if (item.system.killing) {
//dc += parseInt(item.system.dice) * 3;
//dc += parseInt(item.system.DC) || (parseInt(item.system.value) * 3)
// switch (item.system.extraDice) {
// case "pip":
// dc += 1;
// break;
// case "half":
// case "one-pip":
// dc += 2;
// break;
// }
if (item.findModsByXmlid("PLUSONEPIP")) {
dc += 1;
}
if (item.findModsByXmlid("PLUSONEHALFDIE")) {
} else if (item.findModsByXmlid("PLUSONEHALFDIE")) {
dc += 2;
}
if (item.findModsByXmlid("MINUSONEPIP")) {
} else if (item.findModsByXmlid("MINUSONEPIP")) {
// +1d6-1 is equal to +1/2 d6 DC-wise but is uncommon.
dc += 2;
}

tags.push({ value: `${dc.signedString()}DC`, name: item.name, title: tooltip });
} else {
// Normal Attack
//dc += parseInt(item.system.dice);
// let _tag = `${dc.signedString()}DC`;
// switch (item.system.extraDice) {
// case "pip":
// dc += 0.2;
// _tag += " plus 1";
// break;
// case "half":
// dc += 0.5;
// _tag += " plus 1d3";
// break;
// }
//tags.push({ value: _tag, name: item.name });

if (item.findModsByXmlid("PLUSONEPIP")) {
dc += 0.2;
}
if (item.findModsByXmlid("PLUSONEHALFDIE")) {
} else if (item.findModsByXmlid("PLUSONEHALFDIE")) {
dc += 0.5;
}
if (item.findModsByXmlid("MINUSONEPIP")) {
} else if (item.findModsByXmlid("MINUSONEPIP")) {
// +1d6-1 is equal to +1/2 d6 DC-wise but is uncommon.
dc += 0.5;
}
tags.push({ value: `${dc.signedString()}DC`, name: item.name, title: tooltip });
}

tags.push({
value: `${getDiceFormulaFromItemDC(item, dc)}`,
name: item.name,
title: `${dc.signedString()}DC${tooltip ? `\n${tooltip}` : ""}`,
});

baseDcParts.item = dc;

// Add in STR
Expand Down
2 changes: 1 addition & 1 deletion system.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "hero6e-foundryvtt-v2",
"title": "Hero System 6e (Unofficial) v2",
"description": "The Hero System 6e for FoundryVTT!",
"version": "3.0.89",
"version": "3.0.90",
"compatibility": {
"minimum": "11",
"verified": "12.330",
Expand Down

0 comments on commit 90dbc5f

Please sign in to comment.