Fix history

This commit is contained in:
2024-12-17 09:25:02 +01:00
parent 2ac69e2108
commit 2c29acd56c
32 changed files with 395 additions and 779 deletions

View File

@ -92,27 +92,18 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
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.
/** Main roll function
*/
async _roll(rollType, rollTarget, rollValue, opponentTarget = undefined, rollAdvantage = "=") {
async _roll(rollType, rollItem, opponentTarget = undefined) {
const hasTarget = opponentTarget !== undefined
let roll = await CthulhuEternalRoll.prompt({
rollType,
rollTarget,
rollValue,
rollItem,
actorId: this.parent.id,
actorName: this.parent.name,
actorImage: this.parent.img,
hasTarget,
target: opponentTarget,
rollAdvantage,
target: opponentTarget
})
if (!roll) return null

View File

@ -1,5 +1,5 @@
import { SYSTEM } from "../config/system.mjs"
export default class LethalFantasySkill extends foundry.abstract.TypeDataModel {
export default class CthulhuEternalSkill extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields
const schema = {}
@ -22,10 +22,10 @@ export default class LethalFantasySkill extends foundry.abstract.TypeDataModel {
prepareDerivedData() {
super.prepareDerivedData();
this.skillTotal = this.computeBase();
this.skillTotal = this.computeScore();
}
computeBase() {
computeScore() {
let actor = this.parent?.actor;
if (Number(this.base)) {
return Number(this.base) + this.bonus;