Skip to content

Commit

Permalink
Added check for missing hp to create message
Browse files Browse the repository at this point in the history
  • Loading branch information
ChasarooniZ committed May 17, 2024
1 parent 8ef8b5d commit 62c9c6e
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions scripts/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Hooks.once("ready", function () {
await updateFrequencyOfActors(
actors,
total,
diff
diff,
!game.combat ? "updateTime" : "default"
);
});
Expand Down Expand Up @@ -73,7 +73,12 @@ function checkActionSupport() {
);
}

async function updateFrequencyOfActors(party, total, diff, situation = "default") {
async function updateFrequencyOfActors(
party,
total,
diff,
situation = "default"
) {
for (const character of party) {
await updateFrequency(character, total, diff, situation);
}
Expand Down Expand Up @@ -154,12 +159,18 @@ export function getCombatActor() {
export function checkAndHandleSpecialCase(item, _total, diff, _situation) {
const slug = item.system.slug;
const actor = item.actor;
switch(slug) {
case 'aeon-stone-pearly-white-spindle':
game.settings.get(MODULE_ID, "automate-item.aeon-pearly-white")
const health = Math.floor(diff/60);
switch (slug) {
case "aeon-stone-pearly-white-spindle":
game.settings.get(MODULE_ID, "automate-item.aeon-pearly-white");
const health = Math.min(
Math.floor(diff / 60),
actor.system.attributes.hp.max - actor.system.attributes.hp.value
);
if (health > 0) {
new Roll(`${health}[Healing]`).toMessage({flavor: item.name, speaker: ChatMessage.getSpeaker()})
new Roll(`${health}[Healing]`).toMessage({
flavor: item.name,
speaker: ChatMessage.getSpeaker(),
});
}
break;
default:
Expand Down

0 comments on commit 62c9c6e

Please sign in to comment.