Skip to content

Commit

Permalink
Deathly Choir effect
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPrimate committed Nov 8, 2023
1 parent 5ba8314 commit 4de2f6c
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

- Sleep Spell Effect improvements for elfs and half-elfs
- Stone of Good Luck no longer needs a initiative boosting effect separately to checks.
- Mask of the Wild effect: PC's and NPC's will now roll stealth if this ability is clicked. (Thanks @MotoMoto)
- Rahadin Deathly Choir effect exclusions (Thanks MotoMoto)

# 3.5.8

Expand Down
10 changes: 10 additions & 0 deletions macros/monsterFeatures/deathlyChoir.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if (args[0].macroPass === "preambleComplete") {
if (workflow.targets.size === 0) return;
let validTargets = [];
for (let i of Array.from(workflow.targets)) {
const nullEffects = game.modules.get("ddb-importer").api.effects.findEffects(i.actor, ["Deafened", "Dead", "Mind Blank"]);
if (nullEffects.length > 0) continue;
validTargets.push(i.id);
}
game.modules.get("ddb-importer").api.effects.updateTargets(validTargets);
}
11 changes: 11 additions & 0 deletions src/effects/monsterFeatures/deathlyChoir.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import DDBMacros from "../macros.js";

export async function deathlyChoirEffect(document) {
await DDBMacros.setItemMacroFlag(document, "monsterFeature", "deathlyChoir.js");
DDBMacros.setMidiOnUseMacroFlag(document, "monsterFeature", "deathlyChoir.js", ["preambleComplete"]);

setProperty(document, "system.target", { value: 10, width: null, units: "ft", type: "creature" });
setProperty(document, "system.range", { value: null, long: null, units: "spec" });

return document;
}
5 changes: 5 additions & 0 deletions src/effects/specialFeats.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import { deftStrikeEffect } from "./feats/deftStike.js";
import { hadozeDodgeEffect } from "./feats/hadozeeDodge.js";
import { mindLinkEffect } from "./feats/mindLink.js";
import { holdBreathEffect } from "./feats/holdBreath.js";
import { maskOfTheWildEffect } from "./feats/maskOfTheWild.js";

export function baseFeatEffect(document, label) {
let effect = {
Expand Down Expand Up @@ -252,6 +253,10 @@ export async function featureEffectAdjustment(ddb, character, document) {
document = await mantleOfInspirationEffect(document);
break;
}
case "Mask of the Wild": {
document = await maskOfTheWildEffect(document);
break;
}
case "Patient Defense": {
document = patientDefenseEffect(document);
break;
Expand Down
20 changes: 17 additions & 3 deletions src/effects/specialMonsters.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-await-in-loop */
/* eslint-disable require-atomic-updates */
import { effectModules, forceItemEffect, generateStatusEffectChange } from "./effects.js";
import { uncannyDodgeEffect } from "./feats/uncannyDodge.js";
Expand All @@ -14,6 +15,8 @@ import { venomTrollEffects } from "./monsterFeatures/venomTroll.js";
import { quasitEffects } from "./monsterFeatures/quasit.js";
import { invisibilityFeatureEffect } from "./monsterFeatures/invisibility.js";
import { recklessAttackEffect } from "./feats/recklessAttack.js";
import { maskOfTheWildEffect } from "./feats/maskOfTheWild.js";
import { deathlyChoirEffect } from "./monsterFeatures/deathlyChoir.js";

export function baseMonsterFeatureEffect(document, label) {
let effect = {
Expand Down Expand Up @@ -75,6 +78,7 @@ export function transferEffectsToActor(document) {
* This function is mainly for effects that can't be dynamically generated
* @param {*} document
*/
// eslint-disable-next-line complexity
export async function monsterFeatureEffectAdjustment(ddbMonster) {
let npc = duplicate(ddbMonster.npc);

Expand All @@ -86,7 +90,7 @@ export async function monsterFeatureEffectAdjustment(ddbMonster) {
}

// damage over time effects
npc.items.forEach(function(item, index) {
for (let [index, item] of npc.items.entries()) {
// Legendary Resistance Effects
if (item.name.startsWith("Legendary Resistance")) item = generateLegendaryEffect(item);
else if (item.name.startsWith("Pack Tactics")) item = generatePackTacticsEffect(item);
Expand All @@ -97,16 +101,18 @@ export async function monsterFeatureEffectAdjustment(ddbMonster) {
else if (["Shared Invisibility", "Fallible Invisibility", "Invisibility", "Superior Invisibility"].includes(item.name))
item = invisibilityFeatureEffect(item);
else if (item.name.includes("Absorption")) item = absorptionEffect(item);
else if (item.name === "Mask of the Wild") item = await maskOfTheWildEffect(item);

// auto overtime effect
if (item.type !== "spell") {
const overTimeResults = generateOverTimeEffect(ddbMonster, npc, item);
this[index] = overTimeResults.document;
item = overTimeResults.document;
npc = overTimeResults.actor;
}

item = forceItemEffect(item);
}, npc.items);
npc.items[index] = item;
};

switch (npc.name) {
case "Bard": {
Expand All @@ -132,6 +138,14 @@ export async function monsterFeatureEffectAdjustment(ddbMonster) {
npc = await quasitEffects(npc);
break;
}
case "Rahadin": {
for (let [index, item] of npc.items.entries()) {
if (item.name === "Deathly Choir") {
npc.items[index] = await deathlyChoirEffect(item);
}
}
break;
}
case "Skeletal Juggernaut": {
npc = await skeletalJuggernautEffects(npc);
break;
Expand Down

0 comments on commit 4de2f6c

Please sign in to comment.