mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
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:
parent
2608c4a5ae
commit
8e516df7cb
19 changed files with 172 additions and 86 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue