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

Further damage model improvements and extras #229

Merged
merged 13 commits into from
Feb 26, 2025
Merged

Conversation

Azurelol
Copy link
Collaborator

@Azurelol Azurelol commented Feb 20, 2025

  • It was brought to my attention that we actually need two evaluations when adding extra damage from expressions:. As a bonus when making the roll for the skill (Shadow Strike) and as a bonus when applying the damage on the target (Cheap Shot)
  • Fix bug in open check modifiers
  • Fix negative damage results leading to corruption in the pipeline
  • Add overrides data model to characters; Add Lone Wolf effect to grant extra turns for PCs
  • Add a weapon for mutants that has automation for akromorphosis.
  • Update dancer dance entries to use newer automation, including support for blanket override of damage types, done via @AFFINITY[dark damage]

image
image

@Azurelol Azurelol marked this pull request as ready for review February 20, 2025 17:10
@Azurelol Azurelol force-pushed the add/damage_on_roll_apply branch 2 times, most recently from 345ccfe to 9339e1e Compare February 21, 2025 17:00
@Azurelol Azurelol force-pushed the add/damage_on_roll_apply branch from 9339e1e to fabbaa8 Compare February 21, 2025 17:31
@Azurelol Azurelol changed the title Add two distinct evaluations for the damage data model Further damage model improvements and extras Feb 21, 2025
@Azurelol
Copy link
Collaborator Author

Don't panic! The culprit behind the big line count change came from the formatter redoing the line endings on en.json. They should be LF now.

@Shourn Shourn self-requested a review February 23, 2025 20:22
if (actor.system instanceof CharacterDataModel) {
const characterData = actor.system;
const damageType = characterData.overrides.damageType;
if (damageType && damageType !== 'untyped') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why the special case for untyped?
It's a standard damage type, just like all the others.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, I wasn't sure whether someone would want to override to untyped.

const { StringField, NumberField } = foundry.data.fields;
return {
turns: new NumberField({ initial: 1, min: 1, integer: true, nullable: false }),
damageType: new StringField({ initial: '', choices: Object.keys(FU.damageTypes), blank: true, nullable: false }),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't blame you for not following the discussion, but we figured out that we'll need at least the following differentiated override possibilities:

  • attacks (accuracy check)
  • spells (magic check)
  • skills (flat damage, not damage by free attacks or spells)

Additionally, we will need fields for both "normal" and "priority" changes.
The rationale is as follows:
An accessory may change the damage type of all attacks, spells and skills to a specific type (CRB p284).
A dance, like "Angel Dance", changes the damage type of attacks and spells, but not skills (HF p144).
The "Arcanum of the Sword" (CRB p181) changes the damage type of attacks and only attacks to "untyped".

It is reasonable for a character to have an accessory equipped that changes their damage to "earth", while dancing the "Angel Dance" and being merged with the "Arcanum of the Sword".
In this constellation their attacks should do "untyped" damage, their spells "light" damage and their skills "earth" damage.

Skills that change the damage type for a single attack or spell occupy something of a middle ground between "normal" and "priority" changes.
They take precedence over "normal", but yield to "priority".
They also come in "normal" and "priority" variations:
A tinkerers "Pyro Infusion" will add 5 damage to a "Shadow Strike", but won't change the damage type from "dark" to "fire".

I'd say implementing damage type changes for flat damage is outside the scope of this PR, but both attacks and spells should be supported independently.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Very well. I think we could make sure of a nice table on a feature request that lists the use cases. I will sub-divide the damage override data structure.

@@ -14,7 +15,8 @@ export class DamageDataModelV2 extends foundry.abstract.DataModel {
hasDamage: new BooleanField(),
hrZero: new BooleanField(),
value: new NumberField({ initial: 0, integer: true, nullable: false }),
extra: new StringField({ nullable: true }),
onRoll: new StringField({ nullable: true }),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd prefer blank to nullable, since exposing these fields on the sheets will basically guarantee that they are filled with empty strings.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah I wasn't aware of this option. Will do.

static defineSchema() {
const { StringField, NumberField } = foundry.data.fields;
return {
turns: new NumberField({ initial: 1, min: 1, integer: true, nullable: false }),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not a fan of having this under overrides.
Personally, I feel like having this under bonuses and starting with 0 is more intuitive.
This would make the usual usecases of "lose a turn"/"gain an additional turn" very straightforward and applicable to both PCs and NPCs: ["system.bonuses.turns", "add", "1"].

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh that's a great idea.

const localizedType = game.i18n.localize(FU.damageTypes[type]);
const affValue = FU.affValue[value];
const localizedValue = game.i18n.localize(FU.affType[affValue]);
if (value === 'damage') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel like this is conflating different usecases by lumping together changes to affinities and changes to outgoing damage.
It's not a 100% fit, but the inline weapon enchantments feel like a more sensible place for this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I wanted to avoid having to define a new inline command, but I may as well at this point.

@@ -48,7 +48,8 @@
"hasDamage": true,
"value": 0,
"type": "",
"extra": "$sl+$tsc"
"onRoll": "",
"onApply": "$sl+$tsc"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This formula is actually not correct.
"Cheap Shot" only deals its bonus damage if the target is suffering from at least 1 status effect.
Untested, but (min($tsc, 1) * $sl) + $tsc might work.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah. Will try it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yup!
image

- Add new inline, @type that now supports damage
- Redeisgn the damage type override fields
- Cry a little
@Azurelol Azurelol requested a review from Shourn February 24, 2025 22:23
@Shourn Shourn merged commit 64c4e05 into dev Feb 26, 2025
@Azurelol Azurelol linked an issue Mar 8, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow manual adjustment of turns per round
2 participants