Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,38 @@
"value": 1
},
{
"key": "AdjustModifier",
"mode": "add",
"selector": "fortitude",
"slug": "drained",
"value": 1
"key": "RollOption",
"option": "svetocher"
},
{
"key": "RollOption",
"option": "drained-hp-effective-minus-one"
},
{
"key": "FlatModifier",
"predicate": [
"self:condition:drained"
"self:condition:drained",
{
"not": "sanguine-tenacity"
}
],
"selector": "hp",
"value": "@actor.level"
},
{
"key": "AdjustModifier",
"mode": "add",
"predicate": [
"self:condition:drained",
{
"not": "sanguine-tenacity"
}
],
"selectors": [
"fortitude"
],
"slug": "drained",
"value": 1
}
],
"traits": {
Expand Down
24 changes: 16 additions & 8 deletions packs/pf2e/feats/general/level-11/sanguine-tenacity.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@
"title": "Pathfinder #213: Thirst for Blood"
},
"rules": [
{
"key": "RollOption",
"option": "sanguine-tenacity"
},
{
"key": "RollOption",
"option": "drained-hp-effective-minus-one"
},
{
"key": "FlatModifier",
"predicate": [
"self:condition:drained"
],
"selector": "hp",
"value": "@actor.level"
},
{
"key": "Resistance",
"type": "bleed",
Expand Down Expand Up @@ -62,14 +78,6 @@
"str-damage"
],
"value": 1
},
{
"key": "FlatModifier",
"predicate": [
"self:condition:drained"
],
"selector": "hp",
"value": "@actor.level"
}
],
"traits": {
Expand Down
16 changes: 14 additions & 2 deletions src/module/rules/rule-element/lose-hit-points.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class LoseHitPointsRuleElement extends RuleElement<LoseHitPointsRuleSchema> {

override onCreate(actorUpdates: Record<string, unknown>): void {
if (this.ignored) return;
const value = Math.trunc(Math.abs(Number(this.resolveValue(this.value)) || 0));
const value = this.#resolveInitialHpLoss();
const currentHP = this.actor._source.system.attributes.hp.value;
actorUpdates["system.attributes.hp.value"] = Math.max(currentHP - value, 0);
}
Expand All @@ -29,7 +29,7 @@ class LoseHitPointsRuleElement extends RuleElement<LoseHitPointsRuleSchema> {

const { actor } = this;
if (!this.recoverable) {
const value = Math.trunc(Math.abs(Number(this.resolveValue(this.value)) || 0));
const value = this.#resolveInitialHpLoss();
actor.system.attributes.hp.unrecoverable += value;
}
}
Expand All @@ -51,6 +51,18 @@ class LoseHitPointsRuleElement extends RuleElement<LoseHitPointsRuleSchema> {
);
}
}

/** HP loss that occurs when this rule first applies to the actor (including any Drained-specific mitigation) */
#resolveInitialHpLoss(): number {
if (
this.item.isOfType("condition") &&
this.item.slug === "drained" &&
this.actor.getRollOptions().includes("drained-hp-effective-minus-one")
) {
return this.actor.level * ((this.item.value ?? 1) - 1);
}
return Math.trunc(Math.abs(Number(this.resolveValue(this.value)) || 0));
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not going to adjust an RE for a specific item. What problem are you trying to solve?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Application of Drained reduces current HP - I'm trying to mitigate that for Svetocher and Sanguine Tenacity, since they treat HP loss from that as if condition was 1 lower.
I didn't find a way to do that with only data changes, so had to adjust the method that applies the HP loss - if I missed it, could you suggest a better way of approaching this please?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stwlam I found a different approach: implemented predicates for LoseHitPoints and adjusted Drained RE - could you take another look please?

}

type LoseHitPointsSource = fields.SourceFromSchema<LoseHitPointsRuleSchema>;
Expand Down
Loading