Add starship, creature and vehicle

This commit is contained in:
2025-03-15 20:31:50 +01:00
parent 9013229c20
commit 7eee4fab7e
23 changed files with 1080 additions and 746 deletions

View File

@@ -7,9 +7,11 @@ export default class FTLNomadCreature extends foundry.abstract.TypeDataModel {
const requiredInteger = { required: true, nullable: false, integer: true }
const schema = {}
// Carac
const skillField = (label) => {
const schema = {
value: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0, max: 5 }),
label: new fields.StringField({ required: true, nullable: false, initial: label }),
enabled: new fields.BooleanField({ required: true, initial: true }),
}
return new fields.SchemaField(schema, { label })
@@ -42,32 +44,29 @@ export default class FTLNomadCreature extends foundry.abstract.TypeDataModel {
/** @override */
static LOCALIZATION_PREFIXES = ["FTLNOMAD.Creature"]
/** */
/**
* Rolls a dice for a character.
* @param {("save"|"resource|damage")} rollType The type of the roll.
* @param {number} rollItem The target value for the roll. Which caracteristic or resource. If the roll is a damage roll, this is the id of the item.
* @returns {Promise<null>} - A promise that resolves to null if the roll is cancelled.
*/
async roll(rollType, rollItem) {
let opponentTarget
const hasTarget = opponentTarget !== undefined
let roll = await CthulhuEternalRoll.prompt({
rollType,
rollItem,
isLowWP: false,
isZeroWP: false,
isExhausted: false,
actorId: this.parent.id,
actorName: this.parent.name,
actorImage: this.parent.img,
hasTarget,
target: opponentTarget
})
if (!roll) return null
await roll.toMessage({}, { rollMode: roll.options.rollMode })
}
isEncumbered() {
return false
}
async roll(rollType, rollItem) {
let opponentTarget
const hasTarget = opponentTarget !== undefined
let roll = await FTLNomadRoll.prompt({
rollType,
rollItem,
actorId: this.parent.id,
actorName: this.parent.name,
actorImage: this.parent.img,
traits: this.parent.items.filter(i => i.type === "creature-trait" && i.system.isAdvantage),
abilities: this.parent.items.filter(i => i.type === "creature-ability" && i.system.isAdvantage),
isEncumbered: this.isEncumbered(),
hasTarget,
target: opponentTarget
})
if (!roll) return null
await roll.toMessage({}, { rollMode: roll.options.rollMode })
}
}