mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
[Feature] 1033 - Consume Quantity On Use (#1106)
* Initial migration * Updated compendium YML * Added Quantity as a possible cost * Added quantity consumption to all Compendium Consumables * . * Added DestroyOnEmpty property
This commit is contained in:
parent
9dd773001d
commit
8fd63d5963
397 changed files with 1276 additions and 930 deletions
|
|
@ -659,13 +659,22 @@ export default class DhpActor extends Actor {
|
|||
};
|
||||
|
||||
resources.forEach(r => {
|
||||
if (r.keyIsID) {
|
||||
updates.items[r.key] = {
|
||||
target: r.target,
|
||||
resources: {
|
||||
'system.resource.value': r.target.system.resource.value + r.value
|
||||
}
|
||||
};
|
||||
if (r.itemId) {
|
||||
const { path, value } = game.system.api.fields.ActionFields.CostField.getItemIdCostUpdate(r);
|
||||
|
||||
if (
|
||||
r.key === 'quantity' &&
|
||||
r.target.type === 'consumable' &&
|
||||
value === 0 &&
|
||||
r.target.system.destroyOnEmpty
|
||||
) {
|
||||
r.target.delete();
|
||||
} else {
|
||||
updates.items[r.key] = {
|
||||
target: r.target,
|
||||
resources: { [path]: value }
|
||||
};
|
||||
}
|
||||
} else {
|
||||
switch (r.key) {
|
||||
case 'fear':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue