Add compendium data
All checks were successful
Release Creation / build (release) Successful in 1m2s

This commit is contained in:
2025-06-30 21:11:23 +02:00
parent fb5c408bbd
commit 4d96c15066
30 changed files with 92 additions and 8 deletions

View File

@@ -19,6 +19,7 @@ export default class HellbornCharacterSheet extends HellbornActorSheet {
createMalefica: HellbornCharacterSheet.#onCreateMalefica,
createRitual: HellbornCharacterSheet.#onCreateRitual,
createPerk: HellbornCharacterSheet.#onCreatePerk,
modifyAmmo: HellbornCharacterSheet.#onModifyAmmo,
},
}
@@ -169,6 +170,18 @@ export default class HellbornCharacterSheet extends HellbornActorSheet {
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("HELLBORN.Label.newPerk"), type: "perk" }])
}
static async #onModifyAmmo(event, target) {
const quantity = parseInt($(event.target).data("quantity"))
const itemId = $(event.target).data("item-id")
const item = this.document.items.get(itemId)
if (!item) {
console.warn(`HellbornCharacterSheet: Item with ID ${itemId} not found`)
return
}
const currentAmmo = item.system.ammoQuantity || 0
const newAmmo = Math.max(0, currentAmmo + quantity) // Ensure ammo doesn't go below 0
await item.update({ "system.ammoQuantity": newAmmo })
}
/**
* Handles the roll action triggered by user interaction.

View File

@@ -202,11 +202,11 @@ export default class HellbornRoll extends Roll {
options.nbDisadvantages = Number(options.nbDisadvantages)
let dice = 3;
let keep = ""
if ( options.nbAdvantages > 0 || options.nbDisadvantages > 0) {
if ( (options.nbAdvantages !== options.nbDisadvantages) && options.nbAdvantages > 0 || options.nbDisadvantages > 0) {
dice = 4;
if ( options.nbAdvantages > options.nbDisadvantages) {
keep = "kh3"
} else {
} else if (options.nbAdvantages < options.nbDisadvantages) {
keep = "kl3"
}
}

View File

@@ -18,6 +18,7 @@ export default class HellbornWeapon extends foundry.abstract.TypeDataModel {
schema.damageType = new fields.StringField({ required: false, initial : "Physical" })
schema.ammo = new fields.StringField({ required: false, initial: "" })
schema.ammoQuantity = new fields.NumberField({ required: true, initial: 0, min: 0 })
schema.range = new fields.StringField({ required: false, initial: "" })
schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0 })