Skip to content

Commit 4c0dafa

Browse files
committed
a
1 parent c93bbd4 commit 4c0dafa

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/config.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -818,19 +818,20 @@ export function initConfig() {
818818
get quantity() {
819819
if (!this.activity) return null;
820820
const showQuantityItemTypes = ["consumable"];
821-
const consumeType = this.activity.consume?.type;
822-
if (consumeType === "ammo") {
823-
const ammoItem = this.actor.items.get(this.activity.consume.target);
821+
const consumeType = this.activity?.consume?.type;
822+
const useAmmo = this.item.system.ammunition?.type;
823+
if (useAmmo) {
824+
const ammoItem = this.item.system.ammunitionOptions[0]?.item;
824825
if (!ammoItem) return null;
825-
return Math.floor((ammoItem.quantity ?? 0) / this.activity.consume.amount);
826+
return Math.floor((ammoItem.system.quantity ?? 0));
826827
} else if (consumeType === "attribute") {
827828
return Math.floor(getProperty(this.actor, this.activity.consume.target) / this.activity.consume.amount);
828829
} else if (consumeType === "charges") {
829830
const chargesItem = this.actor.items.get(this.activity.consume.target);
830831
if (!chargesItem) return null;
831832
return Math.floor((chargesItem.uses?.value ?? 0) / this.activity.consume.amount);
832-
} else if (showQuantityItemTypes.includes(this.activity.type)) {
833-
return this.activity.uses?.value ?? this.activity.quantity;
833+
} else if (showQuantityItemTypes.includes(this.item.type) && !this.activity.uses.max) {
834+
return this.item.system.quantity;
834835
} else if (this.activity.uses.value !== null && this.activity.uses.per !== null && this.activity.uses.max) {
835836
return this.activity.uses.value;
836837
}

0 commit comments

Comments
 (0)