Manage ers
This commit is contained in:
@ -5,7 +5,7 @@ export const defaultItemImg = {
|
||||
skill: "systems/fvtt-cthulhu-eternal/assets/icons/icon_skill.svg",
|
||||
archetype: "systems/fvtt-cthulhu-eternal/assets/icons/icon_archetype.svg",
|
||||
bond: "systems/fvtt-cthulhu-eternal/assets/icons/icon_bond.svg",
|
||||
mentaldisorder: "systems/fvtt-cthulhu-eternal/assets/icons/icon_mentaldisorder.svg",
|
||||
mentaldisorder: "systems/fvtt-cthulhu-eternal/assets/icons/icon_mental_disorder.svg",
|
||||
arcane: "systems/fvtt-cthulhu-eternal/assets/icons/icon_arcane.svg",
|
||||
injury: "systems/fvtt-cthulhu-eternal/assets/icons/icon_injury.svg",
|
||||
motivation: "systems/fvtt-cthulhu-eternal/assets/icons/icon_motivation.svg",
|
||||
|
@ -130,6 +130,8 @@ export default class CthulhuEternalRoll extends Roll {
|
||||
rollItem: foundry.utils.duplicate(options.rollItem), // Object only, no class
|
||||
initialScore: options.initialScore,
|
||||
targetScore: options.initialScore,
|
||||
isLowWP: options.isLowWP,
|
||||
isZeroWP: options.isZeroWP,
|
||||
rollModes,
|
||||
fieldRollMode,
|
||||
choiceModifier,
|
||||
@ -167,24 +169,23 @@ export default class CthulhuEternalRoll extends Roll {
|
||||
// If the user cancels the dialog, exit
|
||||
if (rollContext === null) return
|
||||
|
||||
const rollData = {
|
||||
rollType: options.rollType,
|
||||
rollItem: options.rollItem,
|
||||
actorId: options.actorId,
|
||||
actorName: options.actorName,
|
||||
actorImage: options.actorImage,
|
||||
rollMode: rollContext.visibility,
|
||||
hasTarget: options.hasTarget,
|
||||
initialScore: options.initialScore,
|
||||
targetName,
|
||||
targetArmor,
|
||||
targetMalus,
|
||||
...rollContext,
|
||||
}
|
||||
let rollData = foundry.utils.mergeObject(foundry.utils.duplicate(options), rollContext)
|
||||
rollData.rollMode = rollContext.visibility
|
||||
rollData.targetName = targetName
|
||||
rollData.targetArmor = targetArmor
|
||||
rollData.targetMalus = targetMalus
|
||||
|
||||
// Update target score
|
||||
console.log(rollData)
|
||||
rollData.targetScore = Math.min( Math.max(options.initialScore + Number(rollData.modifier), 0), 100)
|
||||
|
||||
if ( rollData.isLowWP ) {
|
||||
rollData.targetScore -= 20
|
||||
}
|
||||
if ( rollData.isZeroWP ) {
|
||||
rollData.targetScore = 0
|
||||
}
|
||||
rollData.targetScore = Math.min( Math.max(rollData.targetScore, 0), 100)
|
||||
|
||||
/**
|
||||
* A hook event that fires before the roll is made.
|
||||
*/
|
||||
@ -270,32 +271,25 @@ export default class CthulhuEternalRoll extends Roll {
|
||||
* @property {string} tooltip - The tooltip text for the chat card.
|
||||
*/
|
||||
async _getChatCardData(isPrivate) {
|
||||
const cardData = {
|
||||
css: [SYSTEM.id, "dice-roll"],
|
||||
data: this.data,
|
||||
diceTotal: this.dice.reduce((t, d) => t + d.total, 0),
|
||||
isGM: game.user.isGM,
|
||||
rollItem: this.options.rollItem,
|
||||
initialScore: this.options.initialScore,
|
||||
targetScore: this.options.targetScore,
|
||||
rollType: this.options.rollType,
|
||||
modifier: this.options.modifier,
|
||||
formula: this.formula,
|
||||
total: this.total,
|
||||
isSuccess: this.options.isSuccess,
|
||||
isFailure: this.options.isFailure,
|
||||
isCritical: this.options.isCritical,
|
||||
actorId: this.actorId,
|
||||
actingCharName: this.actorName,
|
||||
actingCharImg: this.actorImage,
|
||||
resultType: this.resultType,
|
||||
hasTarget: this.hasTarget,
|
||||
targetName: this.targetName,
|
||||
targetArmor: this.targetArmor,
|
||||
realDamage: this.realDamage,
|
||||
isPrivate: isPrivate,
|
||||
}
|
||||
let cardData = foundry.utils.duplicate(this.options)
|
||||
cardData.css = [SYSTEM.id, "dice-roll"]
|
||||
cardData.data = this.data
|
||||
cardData.diceTotal = this.dice.reduce((t, d) => t + d.total, 0)
|
||||
cardData.isGM = game.user.isGM
|
||||
cardData.formula = this.formula
|
||||
cardData.total = this.total
|
||||
cardData.actorId = this.actorId
|
||||
cardData.actingCharName = this.actorName
|
||||
cardData.actingCharImg = this.actorImage
|
||||
cardData.resultType = this.resultType
|
||||
cardData.hasTarget = this.hasTarget
|
||||
cardData.targetName = this.targetName
|
||||
cardData.targetArmor = this.targetArmor
|
||||
cardData.realDamage = this.realDamage
|
||||
cardData.isPrivate = isPrivate
|
||||
|
||||
console.log(cardData)
|
||||
|
||||
cardData.cssClass = cardData.css.join(" ")
|
||||
cardData.tooltip = isPrivate ? "" : await this.getTooltip()
|
||||
return cardData
|
||||
|
Reference in New Issue
Block a user