Skip to content

Commit

Permalink
0.0.35 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisk123999 committed Feb 28, 2023
1 parent 10c2cab commit 255da0e
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 9 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 0.0.35:
## New Monster Content:
- Fire Elemental: Fire Form and Touch
- Zombie: Undead Fortitude

# 0.0.32:
## New Monster Content:
- Gallows Speaker: Foretelling Touch and Suffering Echoes
Expand All @@ -9,9 +14,9 @@
- Chain Lightning
## New Monster Content:
- Homunculus: Bite
- Shadow: Strength Drain
- Shadow Demon: Claws
- Incubus & Succubus: Draining Kiss
- Shadow Demon: Claws
- Shadow: Strength Drain
## Updated Features:
- Improvements to automation detection function for NPCs.

Expand Down
6 changes: 4 additions & 2 deletions packs/cpr-monster-features.db

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions scripts/macros.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {elderOblex} from './macros/monsterFeatures/elderOblex/elderOblex.js';
import {experimentalElixir} from './macros/classFeatures/artificer/alchemist/experimentalElixir.js'
import {expertDivination} from './macros/classFeatures/wizard/schoolOfDivination/expertDivination.js';
import {fallenPuppet} from './macros/classFeatures/bloodHunter/bloodCurses/fallenPuppet.js';
import {fireElemental} from './macros/monsterFeatures/fireElemental/fireElemental.js';
import {focusedAim} from './macros/classFeatures/monk/focusedAim.js';
import {formOfDread} from './macros/classFeatures/warlock/undead/formOfDread.js';
import {gallowsSpeaker} from './macros/monsterFeatures/gallowsSpeaker/gallowsSpeaker.js';
Expand Down Expand Up @@ -66,9 +67,10 @@ import {vampiricTouch} from './macros/spells/vampiricTouch/vampiricTouch.js';
import {wildhunt} from './macros/raceFeatures/shifter/wildhunt.js';
import {witherAndBloom} from './macros/spells/witherAndBloom/witherAndBloom.js';
import {wrathOfTheStorm} from './macros/classFeatures/cleric/tempestDomain/wrathOfTheStorm.js';
import {fireElemental} from './macros/monsterFeatures/fireElemental/fireElemental.js';
import {zombie} from './macros/monsterFeatures/zombie/zombie.js';
export async function onHitMacro(workflow) {
if (workflow.targets.size === 0) return;
if (workflow.targets.first().document.uuid === workflow.token.document.uuid) return;
let onHitName = workflow.targets.first().actor.flags['chris-premades']?.feature?.onHit;
if (!onHitName) return;
let onHitFunction = macros.onHit[onHitName];
Expand All @@ -85,13 +87,14 @@ let monster = {
'dybbuk': dybbuk,
'elderBrain': elderBrain,
'elderOblex': elderOblex,
'fireElemental': fireElemental,
'gallowsSpeaker': gallowsSpeaker,
'homunculus': homunculus,
'intellectDevourer': intellectDevourer,
'shadow': shadow,
'shadowDemon': shadowDemon,
'succubus': succubus,
'fireElemental': fireElemental
'zombie': zombie
}
let onHit = {
'fireForm': fireElemental.fireForm
Expand Down Expand Up @@ -141,6 +144,7 @@ export let macros = {
'mirrorImage': mirrorImage,
'monster': monster,
'muddledMind': muddledMind,
'onHit': onHit,
'protectionFromEvilAndGood': protectionFromEvilAndGood,
'radiantSoul': radiantSoul,
'reaper': reaper,
Expand All @@ -156,8 +160,7 @@ export let macros = {
'vampiricTouch': vampiricTouch,
'wildhunt': wildhunt,
'witherAndBloom': witherAndBloom,
'wrathOfTheStorm': wrathOfTheStorm,
'onHit': onHit
'wrathOfTheStorm': wrathOfTheStorm
}
function actorOnUseMacro(itemName) {
return 'await chrisPremades.macros.actorOnUse(this, "' + itemName + '");';
Expand Down
27 changes: 27 additions & 0 deletions scripts/macros/monsterFeatures/zombie/undeadFortitude.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import {chris} from '../../../helperFunctions.js';
export async function undeadFortitude(targetToken, {workflow, ditem}) {
if (ditem.newHP != 0) return;
let targetActor = targetToken.actor;
let effect = chris.findEffect(targetActor, 'Undead Fortitude');
if (!effect) return;
if (workflow.isCritical || chris.checkTrait(targetActor, 'di', 'healing') || chris.totalDamageType(targetActor, ditem.damageDetail[0], 'radiant') > 0) return;
let originItem = await fromUuid(effect.origin);
if (!originItem) return;
let featureData = duplicate(originItem.toObject());
let damageDealt = ditem.appliedDamage;
featureData.system.save.dc = damageDealt + featureData.system.save.dc;
let feature = new CONFIG.Item.documentClass(featureData, {parent: targetActor});
let options = {
'showFullCard': false,
'createWorkflow': true,
'targetUuids': [targetToken.document.uuid],
'configureDialog': false,
'versatile': false,
'consumeResource': false,
'consumeSlot': false,
};
let featureWorkflow = await MidiQOL.completeItemUse(feature, {}, options);
if (featureWorkflow.failedSaves.size === 1) return;
ditem.newHP = 1;
ditem.hpDamage = Math.abs(ditem.newHP - ditem.oldHP);
}
4 changes: 4 additions & 0 deletions scripts/macros/monsterFeatures/zombie/zombie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import {undeadFortitude} from './undeadFortitude.js';
export let zombie = {
'undeadFortitude': undeadFortitude
}
1 change: 1 addition & 0 deletions scripts/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Hooks.once('ready', async function() {
if (game.settings.get('chris-premades', 'DMG Cleave')) Hooks.on('midi-qol.RollComplete', macros.cleave);
if (game.settings.get('chris-premades', 'Wildhunt')) Hooks.on('midi-qol.preAttackRoll', macros.wildhunt);
if (game.settings.get('chris-premades', 'On Hit')) Hooks.on('midi-qol.RollComplete', onHitMacro);
if (game.settings.get('chris-premades', 'Undead Fortitude')) Hooks.on('midi-qol.damageApplied', macros.monster.zombie.undeadFortitude);
});
globalThis['chrisPremades'] = {
helpers,
Expand Down
17 changes: 16 additions & 1 deletion scripts/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export function registerSettings() {
}
});
game.settings.register(moduleName, 'Wildhunt', {
'name': 'Shifter Wildhunt',
'name': 'Shifter Wildhunt Automation',
'hint': 'Enabling this allows the automation of the Shifter Wildhunt feature via the use of Midi-Qol hooks.',
'scope': 'world',
'config': true,
Expand Down Expand Up @@ -209,4 +209,19 @@ export function registerSettings() {
}
}
});
game.settings.register(moduleName, 'Undead Fortitude', {
'name': 'Undead Fortitude Automation',
'hint': 'Enabling this allows the automation of the Undead Fortitude feature via the use of Midi-Qol hooks.',
'scope': 'world',
'config': true,
'type': Boolean,
'default': false,
'onChange': value => {
if (value) {
Hooks.on('midi-qol.damageApplied', macros.monster.zombie.undeadFortitude);
} else {
Hooks.off('midi-qol.damageApplied', macros.monster.zombie.undeadFortitude);
}
}
});
}

0 comments on commit 255da0e

Please sign in to comment.