mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 23:49:02 +01:00
Added DestroyOnEmpty property
This commit is contained in:
parent
4dfc18f727
commit
7082cc009f
65 changed files with 87 additions and 20 deletions
|
|
@ -660,10 +660,21 @@ export default class DhpActor extends Actor {
|
|||
|
||||
resources.forEach(r => {
|
||||
if (r.itemId) {
|
||||
updates.items[r.key] = {
|
||||
target: r.target,
|
||||
resources: game.system.api.fields.ActionFields.CostField.getItemIdCostUpdate(r)
|
||||
};
|
||||
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