Skip to content

Commit

Permalink
Fix Macro calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Vendare committed Jun 17, 2023
1 parent 2a84a19 commit 4a42160
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@
"NPC_TYPE.ELITE": "Elite",

"NOTIFICATION.MACRO_ITEM_NOT_FOUND": "Couldn't find the Item. You may not have a Token selected or the Actor doesn't posses the item",
"NOTIFICATION.MACRO_ACTOR_NOT_FOUND": "Couldn't find the Actor. You not have a Token selected or your default Actor is not set.",

"PSYCHIC_POWER.NAME": "Name",
"PSYCHIC_POWER.COST": "Cost",
Expand Down
4 changes: 2 additions & 2 deletions script/common/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ Dh.aimModes = {
20: "AIMING.FULL"
};

DH.characteristicCosts = [
Dh.characteristicCosts = [
[0, 0, 0],
[100, 250, 500],
[250, 500, 750],
[500, 750, 1000],
[750, 1000, 1500],
[1250, 1500, 2500]];

DH.talentCosts = [[200, 300, 600], [300, 450, 900], [400, 600, 1200]];
Dh.talentCosts = [[200, 300, 600], [300, 450, 900], [400, 600, 1200]];


CONFIG.statusEffects = [
Expand Down
11 changes: 8 additions & 3 deletions script/common/macro.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ export default class DhMacroUtil {

static rollAttack(itemName, itemType) {
let actor = this.getActor();

if (!actor) return ui.notifications.warn(`${game.i18n.localize("NOTIFICATION.MACRO_ACTOR_NOT_FOUND")}`);

item = actor ? actor.items.find(i => i.name === itemName && i.type === itemType) : null;
let item = actor.items.find(i => i.name === itemName && i.type === itemType);

if (!item) return ui.notifications.warn(`${game.i18n.localize("NOTIFICATION.MACRO_ITEM_NOT_FOUND")} ${itemName}`);

Expand All @@ -47,7 +49,10 @@ export default class DhMacroUtil {
}

static rollTest(name, type, specialty) {
let actor = getActor();
let actor = this.getActor();

if (!actor) return ui.notifications.warn(`${game.i18n.localize("NOTIFICATION.MACRO_ACTOR_NOT_FOUND")}`);

let rollData;

if (specialty) {
Expand All @@ -57,7 +62,7 @@ export default class DhMacroUtil {
} else if (name === "fear") {
rollData = DarkHeresyUtil.createFearTestRolldata(actor);
} else if (name === "malignancy") {
rollData = DarkHeresyUtil.createCorruptionTestRolldata(actor);
rollData = DarkHeresyUtil.createMalignancyTestRolldata(actor);
} else if (name === "trauma") {
rollData = DarkHeresyUtil.createTraumaTestRolldata(actor);
} else {
Expand Down
10 changes: 5 additions & 5 deletions script/common/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class DarkHeresyUtil {
rollData.isMelee= isMelee;
rollData.isRange= !isMelee;
rollData.clip= weapon.clip;
rollData.range = weapon.range;
rollData.range = 10;
rollData.rateOfFire= rateOfFire;
rollData.weaponTraits= this.extractWeaponTraits(weapon.special);
let attributeMod = (isMelee && !weapon.damage.match(/SB/gi) ? "+SB" : "");
Expand Down Expand Up @@ -64,7 +64,7 @@ export default class DarkHeresyUtil {
const skill = actor.skills[skillName];
const defaultChar = skill.defaultCharacteristic || skill.characteristics[0];

let characteristics = getCharacteristicOptions(actor, defaultChar);
let characteristics = this.getCharacteristicOptions(actor, defaultChar);
characteristics = characteristics.map(char => {
char.target += skill.advance;
return char;
Expand Down Expand Up @@ -113,9 +113,9 @@ export default class DarkHeresyUtil {
static createMalignancyTestRolldata(actor) {
const characteristic = actor.characteristics.willpower;
return {
name: "CORRUPTION.HEADER",
name: "CORRUPTION.MALIGNANCY",
baseTarget: characteristic.total,
modifier: getMalignancyModifier(actor.corruption),
modifier: this.getMalignancyModifier(actor.corruption),
ownerId: actor.id
};
}
Expand All @@ -125,7 +125,7 @@ export default class DarkHeresyUtil {
return {
name: "TRAUMA.HEADER",
baseTarget: characteristic.total,
modifier: getTraumaModifier(actor.insanity),
modifier: this.getTraumaModifier(actor.insanity),
ownerId: actor.id
};
}
Expand Down

0 comments on commit 4a42160

Please sign in to comment.