Skip to content

Commit

Permalink
Merge pull request dmdorman#1222 from jasonareid/remove_plusses_from_…
Browse files Browse the repository at this point in the history
…cv_tabs

Remove plusses from CV displays on actor sheet (and fix Haymaker CV typo)
  • Loading branch information
phBalance authored Oct 19, 2024
2 parents 8a30e55 + 451daa2 commit d0cf5f3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 36 deletions.
28 changes: 8 additions & 20 deletions module/item/item.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1284,11 +1284,7 @@ export class HeroSystem6eItem extends Item {
const token = tokens[0];
const velocity = calculateVelocityInSystemUnits(item.actor, token);

item.system.ocvEstimated = (
ocv +
parseInt(cslSummary.ocv) +
parseInt(velocity / 10)
).signedString();
item.system.ocvEstimated = `${ocv + parseInt(cslSummary.ocv) + parseInt(velocity / 10)}`;

if (parseInt(velocity / 10) != 0) {
if (item.flags.tag.ocv) {
Expand All @@ -1306,11 +1302,7 @@ export class HeroSystem6eItem extends Item {
default:
item.system.ocv = parseInt(item.system.ocv).signedString();

item.system.ocvEstimated = (
ocv +
parseInt(item.system.ocv) +
parseInt(cslSummary.ocv || cslSummary.omcv || 0)
).signedString();
item.system.ocvEstimated = `${ocv + parseInt(item.system.ocv) + parseInt(cslSummary.ocv || cslSummary.omcv || 0)}`;

if (parseInt(item.system.ocv) != 0) {
if (item.flags.tags.ocv) {
Expand All @@ -1334,11 +1326,7 @@ export class HeroSystem6eItem extends Item {
item.flags.tags.dcv = `${item.flags.tags.dcv}${dcv.signedString()} DCV`;
}
item.system.dcv = parseInt(item.system.dcv).signedString();
item.system.dcvEstimated = (
dcv +
parseInt(item.system.dcv) +
parseInt(cslSummary.dcv || cslSummary.dmcv || 0)
).signedString();
item.system.dcvEstimated = `${dcv + parseInt(item.system.dcv) + parseInt(cslSummary.dcv || cslSummary.dmcv || 0)}`;

if (parseInt(item.system.dcv) != 0) {
if (item.flags.tags.dcv) {
Expand All @@ -1352,7 +1340,7 @@ export class HeroSystem6eItem extends Item {

if (item.system.uses === "omcv") {
const omcv = parseInt(item.actor?.system.characteristics.omcv?.value || 0);
item.system.ocvEstimated = (omcv + parseInt(cslSummary.omcv || 0)).signedString();
item.system.ocvEstimated = `${omcv + parseInt(cslSummary.omcv || 0)}`;
if (omcv != 0) {
if (item.flags.tags.omcv) {
item.flags.tags.omcv += "\n";
Expand All @@ -1363,7 +1351,7 @@ export class HeroSystem6eItem extends Item {
}

const dmcv = parseInt(item.actor?.system.characteristics.dmcv?.value || 0);
item.system.dcvEstimated = (dmcv + parseInt(cslSummary.dmcv || 0)).signedString();
item.system.dcvEstimated = `${dmcv + parseInt(cslSummary.dmcv || 0)}`;
if (dmcv != 0) {
if (item.flags.tags.dmcv) {
item.flags.tags.dmcv += "\n";
Expand All @@ -1379,7 +1367,7 @@ export class HeroSystem6eItem extends Item {
(o) => o.type == "maneuver" && o.name === "Set" && o.system.active,
);
if (setManeuver) {
item.system.ocvEstimated = (parseInt(item.system.ocvEstimated) + 1).signedString();
item.system.ocvEstimated = `${parseInt(item.system.ocvEstimated) + 1}`;

if (item.flags.tags.ocv) {
item.flags.tags.ocv += "\n";
Expand All @@ -1394,14 +1382,14 @@ export class HeroSystem6eItem extends Item {
(o) => o.type == "maneuver" && o.name === "Haymaker" && o.system.active,
);
if (haymakerManeuver) {
item.system.dcvEstimated = (parseInt(item.system.dcvEstimated) - 4).signedString();
item.system.dcvEstimated = `${parseInt(item.system.dcvEstimated) - 5}`;

if (item.flags.tags.dcv) {
item.flags.tags.dcv += "\n";
} else {
item.flags.tags.dcv = "";
}
item.flags.tags.dcv += `-4 Haymaker`;
item.flags.tags.dcv += `-5 Haymaker`;
}

item.system.phase = item.system.PHASE;
Expand Down
20 changes: 4 additions & 16 deletions module/testing/testing-full.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1548,35 +1548,23 @@ export function registerFullTests(quench) {
});

it("Killing Strike OCV", async function () {
assert.equal(
actor.items.find((o) => o.system.ALIAS === "Killing Strike").system.ocvEstimated,
"+1",
);
assert.equal(actor.items.find((o) => o.system.ALIAS === "Killing Strike").system.ocvEstimated, "1");
});

it("Killing Strike DCV", async function () {
assert.equal(
actor.items.find((o) => o.system.ALIAS === "Killing Strike").system.dcvEstimated,
"+3",
);
assert.equal(actor.items.find((o) => o.system.ALIAS === "Killing Strike").system.dcvEstimated, "3");
});

it("Martial Strike damage", async function () {
assert.equal(actor.items.find((o) => o.system.ALIAS === "Martial Strike").system.damage, "34d6");
});

it("Martial Strike OCV", async function () {
assert.equal(
actor.items.find((o) => o.system.ALIAS === "Martial Strike").system.ocvEstimated,
"+3",
);
assert.equal(actor.items.find((o) => o.system.ALIAS === "Martial Strike").system.ocvEstimated, "3");
});

it("Martial Strike DCV", async function () {
assert.equal(
actor.items.find((o) => o.system.ALIAS === "Martial Strike").system.dcvEstimated,
"+5",
);
assert.equal(actor.items.find((o) => o.system.ALIAS === "Martial Strike").system.dcvEstimated, "5");
});

it("HKA damage", async function () {
Expand Down

0 comments on commit d0cf5f3

Please sign in to comment.