Various changes
All checks were successful
Release Creation / build (release) Successful in 58s

This commit is contained in:
2025-05-29 22:41:15 +02:00
parent ee3a5764f0
commit 0ee42aef99
12 changed files with 150 additions and 28 deletions

View File

@@ -53,7 +53,7 @@ export const CHOICE_ADVANTAGES_DISADVANTAGES ={
export const PERK_ROLES = {
"abbetor": { id: "abbetor", label: "Abbetor" },
"blade": { id: "blade", label: "Blade" },
"brawler": { id: "brawler", label: "Brawler" },
"other": { id: "other", label: "Other" },
"gunslinger": { id: "gunslinger", label: "Gunslinger" },
"malefic": { id: "malefic", label: "Malefic" },
"mastermind": { id: "mastermind", label: "Mastermind" },
@@ -64,8 +64,7 @@ export const PERK_ROLES = {
export const MALEFICA_DOMAINS = {
"adfectus": { id: "adfectus", label: "Adfectus" },
"animalis": { id: "animalis", label: "Animalis" },
"carnes ": { id: "carnes", label: "Carnes" },
"other": { id: "other", label: "Other" },
"divinus": { id: "divinus", label: "Divinus" },
"ignis": { id: "ignis", label: "Ignis" },
"iunctio": { id: "iunctio", label: "Iunctio" },

View File

@@ -84,12 +84,18 @@ export default class HellbornRoll extends Roll {
static async prompt(options = {}) {
let formula = `3D6 + 0D6KH - 0D6KH + ${options?.rollItem?.value}`
let actor = game.actors.get(options.actorId)
switch (options.rollType) {
case "stat":
break
case "damage":
{
let formula = options.rollItem.system.damage
if (options.rollItem.system.damageStat !== "none") {
let statKey = options.rollItem.system.damageStat.toLowerCase()
let statValue = actor.system.stats[statKey].value
formula = `${formula} + ${statValue}`
}
let damageRoll = new Roll(formula)
await damageRoll.evaluate()
await damageRoll.toMessage({
@@ -99,14 +105,8 @@ export default class HellbornRoll extends Roll {
}
case "weapon":
{
let actor = game.actors.get(options.actorId)
options.weapon = foundry.utils.duplicate(options.rollItem)
let statKey = "skin"
if (options.weapon.system.weaponType === "melee") {
if ( options.weapon.system.properties.toLowerCase().match("heavy") || options.weapon.system.properties.toLowerCase().match("oversized")) {
statKey = "flesh"
}
}
let statKey = options.weapon.system.stat.toLowerCase()
options.rollItem = actor.system.stats[statKey]
}
break
@@ -224,16 +224,16 @@ export default class HellbornRoll extends Roll {
this.options.fiendishFailure = false
this.options.rollData = foundry.utils.duplicate(rollData)
if (resultType === "success") {
let nb6 = roll.terms[0].results.filter(r => r.result === 6).length
nb6 += roll.terms[3].total === 6 ? 1 : 0
let nb6 = roll.terms[0].results.filter(r => r.result >= 4).length
nb6 += roll.terms[2].total <= 4 ? 1 : 0
this.options.satanicSuccess = nb6 >= 3
if (this.options.satanicSuccess) {
resultType = "success"
}
}
if (resultType === "failure") {
let nb1 = roll.terms[0].results.filter(r => r.result === 1).length
nb1 += roll.terms[5].total === 1 ? 1 : 0
let nb1 = roll.terms[0].results.filter(r => r.result <= 3).length
nb1 += roll.terms[4].total <= 3 ? 1 : 0
this.options.fiendishFailure = nb1 >= 3
if (this.options.fiendishFailure) {
resultType = "failure"
@@ -242,6 +242,9 @@ export default class HellbornRoll extends Roll {
this.options.resultType = resultType
this.options.isSuccess = resultType === "success"
this.options.isFailure = resultType === "failure"
this.options.results = roll.terms[0].results
this.options.advantageResult = roll.terms[2].total
this.options.disadvantageResult = roll.terms[4].total
}
/**

View File

@@ -42,6 +42,21 @@ export default class HellbornEnemy extends foundry.abstract.TypeDataModel {
value: new fields.NumberField({ ...requiredInteger, initial: 1, min: 0 }),
})
// Ailments
const ailmentField = (label) => {
const schema = {
enabled: new fields.BooleanField({ required: true, initial: false }),
label: new fields.StringField({ required: true, initial: label })
}
return new fields.SchemaField(schema, { label })
}
schema.ailments = new fields.SchemaField(
Object.values(SYSTEM.AILMENTS).reduce((obj, ailment) => {
obj[ailment.id] = ailmentField(ailment.label)
return obj
}, {}),
)
schema.defense = new fields.SchemaField({
base: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
bonus: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),

View File

@@ -7,12 +7,14 @@ export default class HellbornWeapon extends foundry.abstract.TypeDataModel {
const requiredInteger = { required: true, nullable: false, integer: true }
schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.stat = new fields.StringField({ required: true, initial: "skin", choices: {"skin": "Skin", "flesh": "Flesh" }})
schema.weaponType = new fields.StringField({ required: true, initial: "melee", choices: SYSTEM.WEAPON_TYPES })
schema.subType = new fields.StringField({ required: false, initial: "pistols", choices: SYSTEM.RANGED_SUBTYPES })
schema.properties = new fields.StringField({required: true, initial: ""})
schema.damage = new fields.StringField({required: true, initial: "1d6"})
schema.damageStat = new fields.StringField({ required: true, initial: "none", choices: {"none": "None", "skin": "Skin", "flesh": "Flesh", "heart": "Heart", "mind": "Mind", "soul": "Soul" }})
schema.damageType = new fields.StringField({ required: false, initial : "Physical" })
schema.ammo = new fields.StringField({ required: false, initial: "" })
@@ -25,4 +27,14 @@ export default class HellbornWeapon extends foundry.abstract.TypeDataModel {
/** @override */
static LOCALIZATION_PREFIXES = ["HELLBORN.Weapon"]
prepareDerivedData() {
super.prepareDerivedData();
let actor = this.parent?.actor;
if (actor) {
this.damageFormula = this.damage + (this.damageStat !== "none" ? `+${actor.system.stats[this.damageStat].value}` : "");
} else {
this.damageFormula = this.damage;
}
}
}