Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncap the value of the wounded condition #17638

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/module/actor/creature/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ interface CreatureAttributes extends ActorAttributes {
/** The current dying level (and maximum) for this creature. */
dying: ValueAndMax & { recoveryDC: number };
/** The current wounded level (and maximum) for this creature. */
wounded: ValueAndMax;
wounded: ValueAndMaybeMax;
/** The current doomed level (and maximum) for this creature. */
doomed: ValueAndMax;

Expand Down
9 changes: 6 additions & 3 deletions src/module/actor/creature/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ abstract class CreaturePF2e<

attributes.doomed = { value: 0, max: 3 };
attributes.dying = { value: 0, max: 4, recoveryDC: 10 };
attributes.wounded = { value: 0, max: 3 };
attributes.wounded = { value: 0 };

// Set IWR guaranteed by traits
setImmunitiesFromTraits(this);
Expand Down Expand Up @@ -437,18 +437,21 @@ abstract class CreaturePF2e<
rollOptions.all[`self:size:${sizeSlug}`] = true;

// Handle caps derived from dying
attributes.wounded.max = Math.max(0, attributes.dying.max - 1);
attributes.doomed.max = attributes.dying.max;

// Set dying, doomed, and wounded statuses according to embedded conditions
for (const conditionSlug of ["doomed", "wounded", "dying"] as const) {
for (const conditionSlug of ["doomed", "dying"] as const) {
const condition = this.conditions.bySlug(conditionSlug, { active: true }).at(0);
const status = attributes[conditionSlug];
if (conditionSlug === "dying") {
status.max -= attributes.doomed.value;
}
status.value = Math.min(condition?.value ?? 0, status.max);
}
const woundedconditionslug = this.conditions.bySlug("wounded", { active: true }).at(0);
if (woundedconditionslug !== null && woundedconditionslug !== undefined) {
attributes.wounded.value = Math.min(woundedconditionslug.value ?? 0);
}

// Clamp certain core resources
const resources = this.system.resources;
Expand Down
2 changes: 0 additions & 2 deletions src/module/actor/creature/sheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ abstract class CreatureSheetPF2e<TActor extends CreaturePF2e> extends ActorSheet
dying: {
maxed: actor.attributes.dying.value >= actor.attributes.dying.max,
remainingDying: Math.max(actor.attributes.dying.max - actor.attributes.dying.value),
remainingWounded: Math.max(actor.attributes.wounded.max - actor.attributes.wounded.value),
},
specialResources: Object.values(this.actor.synthetics.resources).map((r) =>
R.pick(r, ["slug", "label", "value", "max"]),
Expand Down Expand Up @@ -506,7 +505,6 @@ interface CreatureSheetData<TActor extends CreaturePF2e> extends ActorSheetDataP
dying: {
maxed: boolean;
remainingDying: number;
remainingWounded: number;
};
specialResources: ResourceData[];
}
Expand Down
2 changes: 1 addition & 1 deletion src/module/system/conditions/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class ConditionManager {
await condition.delete();
} else if (actor?.isOfType("creature")) {
// Cap the value if a capped condition
const cappedConditions = ["dying", "wounded", "doomed"] as const;
const cappedConditions = ["dying", "doomed"] as const;
if (tupleHasValue(cappedConditions, condition.slug)) {
value = Math.min(value, actor.attributes[condition.slug].max);
}
Expand Down
3 changes: 3 additions & 0 deletions src/styles/actor/character/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,9 @@ aside {
label {
@include micro;
}
h3 {
color: var(--text-light);
}

i.fa-regular,
i.fa-solid {
Expand Down
7 changes: 3 additions & 4 deletions static/templates/actors/character/partials/sidebar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@
</a>
<a class="condition-pips" data-action="adjust-condition-value" data-condition="wounded">
<span class="sidebar_label">{{localize "PF2E.condition.wounded.name"}}</span>
<span class="pips">
{{#times data.attributes.wounded.value}}<i class="fa-solid fa-dot-circle"></i>{{/times}}
{{#times dying.remainingWounded}}<i class="fa-regular fa-circle"></i>{{/times}}
</span>
<h3>
{{data.attributes.wounded.value}}
</h3>
</a>
<a class="roll-icon rest" data-action="rest" data-tooltip="PF2E.Actor.Character.Rest.Label">
<i class="fa-solid fa-bed"></i>
Expand Down
Loading