This commit is contained in:
+8
-2
@@ -230,9 +230,15 @@ Hooks.on("renderChatMessageHTML", (message, html, data) => {
|
||||
const weaponName = message.rolls[0]?.rollName || "weapon"
|
||||
const attackRoll = message.rolls[0]?.rollTotal || 0
|
||||
const defenderName = combatant.name
|
||||
const attackWeaponId = message.rolls[0]?.rollTarget?.weapon?.id || message.rolls[0]?.rollTarget?.weapon?._id
|
||||
const attackRollType = message.rolls[0]?.type
|
||||
const attackRollKey = message.rolls[0]?.rollTarget?.rollKey
|
||||
const rollTargetData = message.rolls[0]?.rollTarget
|
||||
// For spell/miracle attacks, rollTarget IS the spell item (serialised as its data object).
|
||||
// For weapon attacks, rollTarget is a plain skill+weapon object and weapon.id is the weapon.
|
||||
const isSpellMiracleAttack = attackRollType === "spell-attack" || attackRollType === "miracle-attack"
|
||||
const attackWeaponId = isSpellMiracleAttack
|
||||
? (rollTargetData?._id || rollTargetData?.id)
|
||||
: (rollTargetData?.weapon?.id || rollTargetData?.weapon?._id)
|
||||
const attackRollKey = rollTargetData?.rollKey
|
||||
console.log(`[LF] request-defense-btn | attackRollType=${attackRollType} defender=${defenderName} defenderType=${combatant.actor?.type}`)
|
||||
const attackD30result = message.rolls[0]?.options?.D30result || null
|
||||
const attackD30message = message.rolls[0]?.options?.D30message || null
|
||||
|
||||
Reference in New Issue
Block a user