Feature/443 adversary action roll type (#456)

* Some tests

* Filter types choices

* Resource/Uses max as FormulaField

* Removed isReversed on item resources

* Stuffs

---------

Co-authored-by: WBHarry <williambjrklund@gmail.com>
This commit is contained in:
Dapoulp 2025-07-29 22:34:09 +02:00 committed by GitHub
parent 2608c4a5ae
commit 8e516df7cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 172 additions and 86 deletions

View file

@ -481,7 +481,7 @@ export default class DhpActor extends Actor {
this.system.armor &&
this.#canReduceDamage(hpDamage.value, hpDamage.damageTypes)
) {
const armorStackResult = await this.owner.query('armorStack', {
const armorSlotResult = await this.owner.query('armorSlot', {
actorId: this.uuid,
damage: hpDamage.value,
type: [...hpDamage.damageTypes]
@ -490,11 +490,11 @@ export default class DhpActor extends Actor {
timeout: 30000
}
);
if (armorStackResult) {
const { modifiedDamage, armorSpent, stressSpent } = armorStackResult;
if (armorSlotResult) {
const { modifiedDamage, armorSpent, stressSpent } = armorSlotResult;
updates.find(u => u.key === 'hitPoints').value = modifiedDamage;
updates.push(
...(armorSpent ? [{ value: armorSpent, key: 'armorStack' }] : []),
...(armorSpent ? [{ value: armorSpent, key: 'armor' }] : []),
...(stressSpent ? [{ value: stressSpent, key: 'stress' }] : [])
);
}
@ -569,6 +569,7 @@ export default class DhpActor extends Actor {
armor: { target: this.system.armor, resources: {} },
items: {}
};
resources.forEach(r => {
if (r.keyIsID) {
updates.items[r.key] = {
@ -584,7 +585,7 @@ export default class DhpActor extends Actor {
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear) + r.value
);
break;
case 'armorStack':
case 'armor':
updates.armor.resources['system.marks.value'] = Math.max(
Math.min(this.system.armor.system.marks.value + r.value, this.system.armorScore),
0