Skip to content

Commit

Permalink
feat: auto-dead adds prone
Browse files Browse the repository at this point in the history
If you fall unconcious you are also made prone, that is not auto-removed on gaining hits
  • Loading branch information
draconas1 committed Jul 21, 2024
1 parent 38d8515 commit 5538f7d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions module/hooks/auto-bloodied-dead.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import DnD4eTools from "../4e-tools.js";
const dead = "dead"
const dying = "dying"
const bloodied = "bloodied"
const prone = "prone"

export async function setBloodiedDeadOnHPChange(actor, change, options, userId) {
// only fire this for the user that changed the hp in the first place
Expand Down Expand Up @@ -34,6 +35,7 @@ export async function setBloodiedDeadOnHPChange(actor, change, options, userId)
DnD4eTools.log(false, "NPC Dead!")
await deleteIfPresent(bloodied, actor)
await setIfNotPresent(dead, actor)
await setIfNotPresent(prone, actor, false)
await defeatInCombat(actor)
}
else {
Expand All @@ -42,14 +44,19 @@ export async function setBloodiedDeadOnHPChange(actor, change, options, userId)
await deleteIfPresent(bloodied, actor)
await deleteIfPresent(dying, actor)

await setIfNotPresent(prone, actor, false)
await setIfNotPresent(dead, actor)

await defeatInCombat(actor)
}
else {
DnD4eTools.log(false, "PC Dying!")
await deleteIfPresent(bloodied, actor)
await deleteIfPresent(dead, actor)

await setIfNotPresent(dying, actor)
await setIfNotPresent(prone, actor, false)

await defeatInCombat(actor, false)
}
}
Expand Down

0 comments on commit 5538f7d

Please sign in to comment.