Basic actor sheet
This commit is contained in:
@ -46,7 +46,7 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
|
||||
// Challenges
|
||||
const challengeField = (label) => {
|
||||
const schema = {
|
||||
value: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
|
||||
value: new fields.StringField({ initial: "0", required: true, nullable: false }),
|
||||
}
|
||||
return new fields.SchemaField(schema, { label })
|
||||
}
|
||||
@ -129,6 +129,24 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
|
||||
}
|
||||
}
|
||||
this.grit.starting = Math.round(grit / 6)
|
||||
|
||||
let strDef = SYSTEM.CHARACTERISTICS_TABLES.str.find(s => s.value === this.characteristics.str.value)
|
||||
this.challenges.str.value = strDef.challenge
|
||||
|
||||
let dexDef = SYSTEM.CHARACTERISTICS_TABLES.dex.find(s => s.value === this.characteristics.dex.value)
|
||||
this.challenges.agility.value = dexDef.challenge
|
||||
this.saves.dodge.value = dexDef.dodge
|
||||
|
||||
let wisDef = SYSTEM.CHARACTERISTICS_TABLES.wis.find(s => s.value === this.characteristics.wis.value)
|
||||
this.saves.will.value = wisDef.willpower_save
|
||||
|
||||
let conDef = SYSTEM.CHARACTERISTICS_TABLES.con.find(s => s.value === this.characteristics.con.value)
|
||||
this.saves.pain.value = conDef.pain_save
|
||||
this.saves.toughness.value = conDef.toughness_save
|
||||
this.challenges.dying.value = conDef.stabilization_dice
|
||||
|
||||
this.saves.contagion.value = this.characteristics.con.value
|
||||
this.saves.poison.value = this.characteristics.con.value
|
||||
}
|
||||
|
||||
/**
|
||||
@ -138,46 +156,16 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
|
||||
* @param {"="|"+"|"++"|"-"|"--"} rollAdvantage If there is an avantage (+), a disadvantage (-), a double advantage (++), a double disadvantage (--) or a normal roll (=).
|
||||
* @returns {Promise<null>} - A promise that resolves to null if the roll is cancelled.
|
||||
*/
|
||||
async roll(rollType, rollTarget, rollAdvantage = "=") {
|
||||
let rollValue
|
||||
let opponentTarget
|
||||
switch (rollType) {
|
||||
case ROLL_TYPE.SAVE:
|
||||
rollValue = this.caracteristiques[rollTarget].valeur
|
||||
opponentTarget = game.user.targets.first()
|
||||
break
|
||||
case ROLL_TYPE.DAMAGE:
|
||||
rollValue = this.parent.items.get(rollTarget).system.degats
|
||||
opponentTarget = game.user.targets.first()
|
||||
break
|
||||
default:
|
||||
// Handle other cases or do nothing
|
||||
break
|
||||
}
|
||||
await this._roll(rollType, rollTarget, rollValue, opponentTarget, rollAdvantage)
|
||||
}
|
||||
|
||||
/**
|
||||
* Rolls a dice for a character.
|
||||
* @param {("save"|"resource|damage")} rollType The type of the roll.
|
||||
* @param {number} rollTarget The target value for the roll. Which caracteristic or resource. If the roll is a damage roll, this is the id of the item.
|
||||
* @param {number} rollValue The value of the roll. If the roll is a damage roll, this is the dice to roll.
|
||||
* @param {Token} opponentTarget The target of the roll : used for save rolls to get the oppponent's malus.
|
||||
* @param {"="|"+"|"++"|"-"|"--"} rollAdvantage If there is an avantage (+), a disadvantage (-), a double advantage (++), a double disadvantage (--) or a normal roll (=).
|
||||
* @returns {Promise<null>} - A promise that resolves to null if the roll is cancelled.
|
||||
*/
|
||||
async _roll(rollType, rollTarget, rollValue, opponentTarget = undefined, rollAdvantage = "=") {
|
||||
const hasTarget = opponentTarget !== undefined
|
||||
async roll(rollType, rollTarget) {
|
||||
const hasTarget = false
|
||||
let roll = await LethalFantasyRoll.prompt({
|
||||
rollType,
|
||||
rollTarget,
|
||||
rollValue,
|
||||
actorId: this.parent.id,
|
||||
actorName: this.parent.name,
|
||||
actorImage: this.parent.img,
|
||||
hasTarget,
|
||||
target: opponentTarget,
|
||||
rollAdvantage,
|
||||
target: false
|
||||
})
|
||||
if (!roll) return null
|
||||
|
||||
|
Reference in New Issue
Block a user