Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| db3e8b5d35 | |||
| 54421e4a83 | |||
| ac44419b7a | |||
| a3fc0a42b9 | |||
| c8ce840e98 | |||
| 55a040062a | |||
| 1818a76499 | |||
| 55d1b41ca4 | |||
| 841ed82277 | |||
| 968d156d09 | |||
| 59ff098fca | |||
| b8174d5e22 |
@@ -60,4 +60,4 @@ jobs:
|
|||||||
manifest: "https://www.uberwald.me/gitea/${{gitea.repository}}/releases/download/${{github.event.release.tag_name}}/system.json"
|
manifest: "https://www.uberwald.me/gitea/${{gitea.repository}}/releases/download/${{github.event.release.tag_name}}/system.json"
|
||||||
notes: "https://www.uberwald.me/gitea/public/fvtt-lethal-fantasy/raw/branch/main/changelog.md"
|
notes: "https://www.uberwald.me/gitea/public/fvtt-lethal-fantasy/raw/branch/main/changelog.md"
|
||||||
compatibility-minimum: "13"
|
compatibility-minimum: "13"
|
||||||
compatibility-verified: "13"
|
compatibility-verified: "14"
|
||||||
|
|||||||
@@ -1178,6 +1178,45 @@ i.lethalfantasy {
|
|||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
}
|
}
|
||||||
|
.lethalfantasy .tab.monster-combat .ranged-attacks {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
.lethalfantasy .tab.monster-combat .ranged-attacks .attack .name {
|
||||||
|
min-width: 10rem;
|
||||||
|
max-width: 10rem;
|
||||||
|
}
|
||||||
|
.lethalfantasy .tab.monster-combat .ranged-attacks .attack .damage-dice {
|
||||||
|
width: 5rem;
|
||||||
|
max-width: 5rem;
|
||||||
|
}
|
||||||
|
.lethalfantasy .tab.monster-combat .ranged-attacks .ranged-weapon-range {
|
||||||
|
margin-top: 8px;
|
||||||
|
border-top: 1px solid var(--color-border-light-tertiary, #ccc);
|
||||||
|
padding-top: 6px;
|
||||||
|
}
|
||||||
|
.lethalfantasy .tab.monster-combat .ranged-attacks .ranged-weapon-range > label {
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.lethalfantasy .tab.monster-combat .ranged-attacks .ranged-weapon-range .range-fields {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
.lethalfantasy .tab.monster-combat .ranged-attacks .ranged-weapon-range .range-fields .range-field {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.lethalfantasy .tab.monster-combat .ranged-attacks .ranged-weapon-range .range-fields .range-field label {
|
||||||
|
font-size: 0.7rem;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.lethalfantasy .tab.monster-combat .ranged-attacks .ranged-weapon-range .range-fields .range-field input {
|
||||||
|
width: 3.5rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
.lethalfantasy .tab.monster-combat .armors {
|
.lethalfantasy .tab.monster-combat .armors {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, 1fr);
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
|||||||
+14
-1
@@ -382,9 +382,12 @@
|
|||||||
"rollProgressionCount": "Roll progression count",
|
"rollProgressionCount": "Roll progression count",
|
||||||
"rollProgressionDice": "Roll progression/Lethargy dice",
|
"rollProgressionDice": "Roll progression/Lethargy dice",
|
||||||
"earned": "Earned",
|
"earned": "Earned",
|
||||||
"divinityPoints": "Divinity points",
|
"divinityPoints": "Grace",
|
||||||
"aetherPoints": "Aether points",
|
"aetherPoints": "Aether points",
|
||||||
"attacks": "Attacks",
|
"attacks": "Attacks",
|
||||||
|
"attackMode": "Attack Mode",
|
||||||
|
"meleeModeLabel": "Melee (8 attacks)",
|
||||||
|
"rangedModeLabel": "Ranged (4 attacks)",
|
||||||
"monster": "Monster",
|
"monster": "Monster",
|
||||||
"Resist": "Resist",
|
"Resist": "Resist",
|
||||||
"resist": "Resist",
|
"resist": "Resist",
|
||||||
@@ -459,6 +462,13 @@
|
|||||||
"notes": "Notes",
|
"notes": "Notes",
|
||||||
"pc": "PC",
|
"pc": "PC",
|
||||||
"perception": "Perception",
|
"perception": "Perception",
|
||||||
|
"pointBlank": "Point blank",
|
||||||
|
"short": "Short",
|
||||||
|
"medium": "Medium",
|
||||||
|
"long": "Long",
|
||||||
|
"extreme": "Extreme",
|
||||||
|
"outOfSkill": "Out of skill",
|
||||||
|
"range": "Range",
|
||||||
"rangeDefenseDialog": "Ranged defense dialog",
|
"rangeDefenseDialog": "Ranged defense dialog",
|
||||||
"rangeDefenseRoll": "Ranged defense roll",
|
"rangeDefenseRoll": "Ranged defense roll",
|
||||||
"rangedAttackDefense": "Ranged attack defense",
|
"rangedAttackDefense": "Ranged attack defense",
|
||||||
@@ -978,6 +988,9 @@
|
|||||||
"diceResult": "Dice result",
|
"diceResult": "Dice result",
|
||||||
"progressionCount": "Progression count:"
|
"progressionCount": "Progression count:"
|
||||||
},
|
},
|
||||||
|
"Combat": {
|
||||||
|
"RollMonsters": "Roll Monsters"
|
||||||
|
},
|
||||||
"EquipmentCategories": {
|
"EquipmentCategories": {
|
||||||
"ClassKit": "Class Kit",
|
"ClassKit": "Class Kit",
|
||||||
"Clothing": "Clothing",
|
"Clothing": "Clothing",
|
||||||
|
|||||||
+285
-235
@@ -129,301 +129,284 @@ Hooks.once("ready", function () {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// Test if version below 13
|
Hooks.on("renderChatMessageHTML", (message, html, data) => {
|
||||||
let hookName = "renderChatMessage"
|
|
||||||
if (foundry.utils.isNewerVersion(game.version, "12.0",)) {
|
|
||||||
hookName = "renderChatMessageHTML"
|
|
||||||
}
|
|
||||||
Hooks.on(hookName, (message, html, data) => {
|
|
||||||
const typeMessage = data.message.flags.lethalFantasy?.typeMessage
|
const typeMessage = data.message.flags.lethalFantasy?.typeMessage
|
||||||
// Message de demande de jet de dés
|
// Message de demande de jet de dés
|
||||||
if (typeMessage === "askRoll") {
|
if (typeMessage === "askRoll") {
|
||||||
// Affichage des boutons de jet de dés uniquement pour les joueurs
|
// Affichage des boutons de jet de dés uniquement pour les joueurs
|
||||||
if (game.user.isGM) {
|
if (game.user.isGM) {
|
||||||
html.find(".ask-roll-dice").each((i, btn) => {
|
for (const btn of html.querySelectorAll(".ask-roll-dice")) {
|
||||||
btn.style.display = "none"
|
btn.style.display = "none"
|
||||||
})
|
}
|
||||||
} else {
|
} else {
|
||||||
html.find(".ask-roll-dice").click((event) => {
|
for (const btn of html.querySelectorAll(".ask-roll-dice")) {
|
||||||
const btn = $(event.currentTarget)
|
btn.addEventListener("click", () => {
|
||||||
const type = btn.data("type")
|
const type = btn.dataset.type
|
||||||
const value = btn.data("value")
|
const value = btn.dataset.value
|
||||||
const avantage = btn.data("avantage") ?? "="
|
const avantage = btn.dataset.avantage ?? "="
|
||||||
const character = game.user.character
|
const character = game.user.character
|
||||||
if (type === SYSTEM.ROLL_TYPE.RESOURCE) character.rollResource(value)
|
if (type === SYSTEM.ROLL_TYPE.RESOURCE) character.rollResource(value)
|
||||||
else if (type === SYSTEM.ROLL_TYPE.SAVE) character.rollSave(value, avantage)
|
else if (type === SYSTEM.ROLL_TYPE.SAVE) character.rollSave(value, avantage)
|
||||||
})
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gestion du survol et du clic sur les boutons de dégâts pour les GMs
|
// Gestion du survol et du clic sur les boutons de dégâts pour les GMs
|
||||||
if (game.user.isGM) {
|
if (game.user.isGM) {
|
||||||
// Show damage buttons only for GM
|
// Show damage buttons only for GM
|
||||||
$(html).find(".li-apply-wounds").each((i, btn) => {
|
for (const btn of html.querySelectorAll(".li-apply-wounds")) {
|
||||||
btn.style.display = "block"
|
btn.style.display = "block"
|
||||||
})
|
}
|
||||||
|
|
||||||
$(html).find(".apply-wounds-btn").hover(
|
for (const btn of html.querySelectorAll(".apply-wounds-btn")) {
|
||||||
function (event) {
|
btn.addEventListener("mouseenter", () => {
|
||||||
// Mouse enter - select the token and pan to it
|
const combatantId = btn.dataset.combatantId
|
||||||
let combatantId = $(this).data("combatant-id")
|
|
||||||
if (combatantId && game.combat) {
|
if (combatantId && game.combat) {
|
||||||
let combatant = game.combat.combatants.get(combatantId)
|
const combatant = game.combat.combatants.get(combatantId)
|
||||||
if (combatant?.token) {
|
if (combatant?.token) {
|
||||||
let token = canvas.tokens.get(combatant.token.id)
|
const token = canvas.tokens.get(combatant.token.id)
|
||||||
if (token) {
|
if (token) {
|
||||||
token.control({ releaseOthers: true })
|
token.control({ releaseOthers: true })
|
||||||
canvas.animatePan(token.center)
|
canvas.animatePan(token.center)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
function (event) {
|
btn.addEventListener("mouseleave", () => canvas.tokens.releaseAll())
|
||||||
// Mouse leave - release selection
|
btn.addEventListener("click", event => LethalFantasyUtils.applyDamage(message, event))
|
||||||
canvas.tokens.releaseAll()
|
}
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
$(html).find(".apply-wounds-btn").click((event) => {
|
|
||||||
LethalFantasyUtils.applyDamage(message, event)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gestion du survol et du clic sur les boutons de défense
|
// Gestion du survol et du clic sur les boutons de défense
|
||||||
$(html).find(".request-defense-btn").hover(
|
for (const btn of html.querySelectorAll(".request-defense-btn")) {
|
||||||
function (event) {
|
btn.addEventListener("mouseenter", () => {
|
||||||
// Mouse enter - select the token and pan to it
|
const tokenId = btn.dataset.tokenId
|
||||||
let tokenId = $(this).data("token-id")
|
|
||||||
if (tokenId) {
|
if (tokenId) {
|
||||||
let token = canvas.tokens.get(tokenId)
|
const token = canvas.tokens.get(tokenId)
|
||||||
if (token) {
|
if (token) {
|
||||||
token.control({ releaseOthers: true })
|
token.control({ releaseOthers: true })
|
||||||
canvas.animatePan(token.center)
|
canvas.animatePan(token.center)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
function (event) {
|
btn.addEventListener("mouseleave", () => canvas.tokens.releaseAll())
|
||||||
// Mouse leave - release selection
|
|
||||||
canvas.tokens.releaseAll()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// Gestionnaire pour les boutons de demande de défense
|
// Gestionnaire pour les boutons de demande de défense
|
||||||
$(html).find(".request-defense-btn").off("click").on("click", (event) => {
|
btn.addEventListener("click", event => {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
|
|
||||||
const button = $(event.currentTarget)
|
const combatantId = btn.dataset.combatantId
|
||||||
const combatantId = button.data("combatant-id")
|
const tokenId = btn.dataset.tokenId
|
||||||
const tokenId = button.data("token-id")
|
|
||||||
|
|
||||||
// Récupérer le combattant soit du combat, soit directement du token
|
// Récupérer le combattant soit du combat, soit directement du token
|
||||||
let combatant = null
|
let combatant = null
|
||||||
let token = null
|
let token = null
|
||||||
|
|
||||||
if (game.combat && combatantId) {
|
if (game.combat && combatantId) {
|
||||||
combatant = game.combat.combatants.get(combatantId)
|
combatant = game.combat.combatants.get(combatantId)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si pas de combattant trouvé, chercher le token directement
|
// Si pas de combattant trouvé, chercher le token directement
|
||||||
if (!combatant && tokenId) {
|
if (!combatant && tokenId) {
|
||||||
token = canvas.tokens.get(tokenId)
|
token = canvas.tokens.get(tokenId)
|
||||||
if (token) {
|
if (token) {
|
||||||
// Créer un pseudo-combattant avec les infos du token
|
// Créer un pseudo-combattant avec les infos du token
|
||||||
combatant = {
|
combatant = {
|
||||||
actor: token.actor,
|
actor: token.actor,
|
||||||
name: token.name,
|
name: token.name,
|
||||||
token: token,
|
token: token,
|
||||||
actorId: token.actorId
|
actorId: token.actorId
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!combatant) return
|
if (!combatant) return
|
||||||
|
|
||||||
// Récupérer les informations de l'attaquant depuis le message
|
// Récupérer les informations de l'attaquant depuis le message
|
||||||
const attackerName = message.rolls[0]?.actorName || "Unknown"
|
const attackerName = message.rolls[0]?.actorName || "Unknown"
|
||||||
const attackerId = message.rolls[0]?.actorId
|
const attackerId = message.rolls[0]?.actorId
|
||||||
const weaponName = message.rolls[0]?.rollName || "weapon"
|
const weaponName = message.rolls[0]?.rollName || "weapon"
|
||||||
const attackRoll = message.rolls[0]?.rollTotal || 0
|
const attackRoll = message.rolls[0]?.rollTotal || 0
|
||||||
const defenderName = combatant.name
|
const defenderName = combatant.name
|
||||||
const attackWeaponId = message.rolls[0]?.rollTarget?.weapon?.id || message.rolls[0]?.rollTarget?.weapon?._id
|
const attackWeaponId = message.rolls[0]?.rollTarget?.weapon?.id || message.rolls[0]?.rollTarget?.weapon?._id
|
||||||
const attackRollType = message.rolls[0]?.type
|
const attackRollType = message.rolls[0]?.type
|
||||||
const attackRollKey = message.rolls[0]?.rollTarget?.rollKey
|
const attackRollKey = message.rolls[0]?.rollTarget?.rollKey
|
||||||
console.log(`[LF] request-defense-btn | attackRollType=${attackRollType} defender=${defenderName} defenderType=${combatant.actor?.type}`)
|
console.log(`[LF] request-defense-btn | attackRollType=${attackRollType} defender=${defenderName} defenderType=${combatant.actor?.type}`)
|
||||||
const attackD30result = message.rolls[0]?.options?.D30result || null
|
const attackD30result = message.rolls[0]?.options?.D30result || null
|
||||||
const attackD30message = message.rolls[0]?.options?.D30message || null
|
const attackD30message = message.rolls[0]?.options?.D30message || null
|
||||||
const attackRerollContext = {
|
const attackRerollContext = {
|
||||||
rollType: message.rolls[0]?.options?.rollType,
|
rollType: message.rolls[0]?.options?.rollType,
|
||||||
rollTarget: foundry.utils.duplicate(message.rolls[0]?.options?.rollTarget ?? {}),
|
rollTarget: foundry.utils.duplicate(message.rolls[0]?.options?.rollTarget ?? {}),
|
||||||
actorId: message.rolls[0]?.options?.actorId,
|
actorId: message.rolls[0]?.options?.actorId,
|
||||||
actorName: message.rolls[0]?.options?.actorName,
|
actorName: message.rolls[0]?.options?.actorName,
|
||||||
actorImage: message.rolls[0]?.options?.actorImage,
|
actorImage: message.rolls[0]?.options?.actorImage,
|
||||||
defenderId: combatant.actor?.id || null,
|
defenderId: combatant.actor?.id || null,
|
||||||
defenderTokenId: tokenId || combatant.token?.id || null,
|
defenderTokenId: tokenId || combatant.token?.id || null,
|
||||||
rollContext: foundry.utils.duplicate(message.rolls[0]?.options?.rollData ?? {})
|
rollContext: foundry.utils.duplicate(message.rolls[0]?.options?.rollData ?? {})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Préparer le message de demande de défense
|
// Préparer le message de demande de défense
|
||||||
const defenseMsg = {
|
// isRanged: true si le monstre était en mode ranged (via rollTarget.attackMode stocké dans le roll)
|
||||||
type: "requestDefense",
|
// OU si l'attaquant utilisait une arme ranged (weapon-attack avec weaponType === "ranged")
|
||||||
attackerName: attackerName,
|
const attacker = game.actors.get(attackerId)
|
||||||
attackerId: attackerId,
|
const rollTargetOptions = message.rolls[0]?.options?.rollTarget
|
||||||
defenderName: defenderName,
|
const attackerWeapon = rollTargetOptions?.weapon
|
||||||
weaponName: weaponName,
|
const isRangedAttack = (rollTargetOptions?.attackMode === "ranged")
|
||||||
attackRoll: attackRoll,
|
|| (attacker?.type === "monster" && attacker.system.attackMode === "ranged")
|
||||||
attackWeaponId: attackWeaponId,
|
|| (attackerWeapon?.system?.weaponType === "ranged")
|
||||||
attackRollType: attackRollType,
|
|
||||||
attackRollKey: attackRollKey,
|
|
||||||
attackD30result: attackD30result,
|
|
||||||
attackD30message: attackD30message,
|
|
||||||
attackRerollContext: attackRerollContext,
|
|
||||||
combatantId: combatantId,
|
|
||||||
tokenId: tokenId
|
|
||||||
}
|
|
||||||
|
|
||||||
// Envoyer le message socket à l'utilisateur contrôlant le combatant
|
const defenseMsg = {
|
||||||
// Only consider active (online) users; fall back to any active GM for unowned/GM monsters.
|
type: "requestDefense",
|
||||||
let owners = game.users.filter(u =>
|
attackerName,
|
||||||
u.active && combatant.actor.testUserPermission(u, "OWNER")
|
attackerId,
|
||||||
)
|
defenderName,
|
||||||
if (owners.length === 0) {
|
weaponName,
|
||||||
owners = game.users.filter(u => u.active && u.isGM)
|
attackRoll,
|
||||||
}
|
attackWeaponId,
|
||||||
|
attackRollType,
|
||||||
|
attackRollKey,
|
||||||
|
attackD30result,
|
||||||
|
attackD30message,
|
||||||
|
attackRerollContext,
|
||||||
|
combatantId,
|
||||||
|
tokenId,
|
||||||
|
isRanged: isRangedAttack
|
||||||
|
}
|
||||||
|
|
||||||
// Récupérer l'acteur attaquant pour vérifier qui l'a lancé
|
// Envoyer le message socket à l'utilisateur contrôlant le combatant
|
||||||
const attacker = game.actors.get(attackerId)
|
// Only consider active (online) users; fall back to any active GM for unowned/GM monsters.
|
||||||
const attackerOwners = attacker ? game.users.filter(u => attacker.testUserPermission(u, "OWNER")).map(u => u.id) : []
|
let owners = game.users.filter(u => u.active && combatant.actor.testUserPermission(u, "OWNER"))
|
||||||
|
if (owners.length === 0) {
|
||||||
|
owners = game.users.filter(u => u.active && u.isGM)
|
||||||
|
}
|
||||||
|
|
||||||
// Monsters always need their owner (usually the GM) to roll a save/defense,
|
// Récupérer l'acteur attaquant pour vérifier qui l'a lancé
|
||||||
// even if that owner also controls the attacker. Only skip for same-player PC-vs-PC.
|
const attackerOwners = attacker ? game.users.filter(u => attacker.testUserPermission(u, "OWNER")).map(u => u.id) : []
|
||||||
const defenderIsMonster = combatant.actor?.type === "monster"
|
|
||||||
|
|
||||||
let messageSent = false
|
// Monsters always need their owner (usually the GM) to roll a save/defense,
|
||||||
owners.forEach(owner => {
|
// even if that owner also controls the attacker. Only skip for same-player PC-vs-PC.
|
||||||
// Don't let a player be both attacker and defender for their own PC, unless defending a monster.
|
const defenderIsMonster = combatant.actor?.type === "monster"
|
||||||
if (attackerOwners.includes(owner.id) && owner.id === game.user.id && !defenderIsMonster) {
|
|
||||||
// Ne rien faire - on ne veut pas que l'attaquant se défende contre lui-même
|
let messageSent = false
|
||||||
|
owners.forEach(owner => {
|
||||||
|
// Don't let a player be both attacker and defender for their own PC, unless defending a monster.
|
||||||
|
if (attackerOwners.includes(owner.id) && owner.id === game.user.id && !defenderIsMonster) {
|
||||||
|
// Ne rien faire - on ne veut pas que l'attaquant se défende contre lui-même
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (owner.id === game.user.id) {
|
||||||
|
// Si l'utilisateur actuel est le propriétaire du défenseur (mais pas l'attaquant), appeler directement
|
||||||
|
LethalFantasyUtils.showDefenseRequest({ ...defenseMsg, userId: owner.id })
|
||||||
|
messageSent = true
|
||||||
|
} else {
|
||||||
|
// Sinon, envoyer via socket
|
||||||
|
game.socket.emit(`system.${SYSTEM.id}`, { ...defenseMsg, userId: owner.id })
|
||||||
|
messageSent = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// Notification pour l'attaquant
|
||||||
|
if (messageSent) {
|
||||||
|
ui.notifications.info(`Defense request sent to ${defenderName}'s controller`)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gestionnaire pour les boutons de jet de dégâts (armes et résultats de combat)
|
||||||
|
for (const btn of html.querySelectorAll(".damage-roll-btn, .roll-damage-btn")) {
|
||||||
|
btn.addEventListener("click", async event => {
|
||||||
|
event.preventDefault()
|
||||||
|
event.stopPropagation()
|
||||||
|
|
||||||
|
const weaponId = btn.dataset.weaponId
|
||||||
|
const attackKey = btn.dataset.attackKey
|
||||||
|
const attackerId = btn.dataset.attackerId
|
||||||
|
const defenderId = btn.dataset.defenderId
|
||||||
|
const defenderTokenId = btn.dataset.defenderTokenId || null
|
||||||
|
const extraShieldDr = Number(btn.dataset.extraShieldDr || 0)
|
||||||
|
const damageType = btn.dataset.damageType
|
||||||
|
const damageFormula = btn.dataset.damageFormula
|
||||||
|
const damageModifier = btn.dataset.damageModifier
|
||||||
|
const isMonster = btn.dataset.isMonster
|
||||||
|
|
||||||
|
// Récupérer l'acteur (soit depuis le message, soit depuis attackerId)
|
||||||
|
const actor = attackerId ? game.actors.get(attackerId) : game.actors.get(message.rolls[0]?.actorId)
|
||||||
|
if (!actor) {
|
||||||
|
ui.notifications.error("Actor not found")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (owner.id === game.user.id) {
|
// Pour les sorts, rouler les dés de dégâts avec option bypass DR
|
||||||
// Si l'utilisateur actuel est le propriétaire du défenseur (mais pas l'attaquant), appeler directement
|
if (damageType === "spell" && damageFormula) {
|
||||||
LethalFantasyUtils.showDefenseRequest({ ...defenseMsg, userId: owner.id })
|
const bypassArmor = await foundry.applications.api.DialogV2.confirm({
|
||||||
messageSent = true
|
window: { title: "Spell Damage" },
|
||||||
} else {
|
classes: ["lethalfantasy"],
|
||||||
// Sinon, envoyer via socket
|
content: "<p>Does this spell's damage bypass armor DR?</p>",
|
||||||
game.socket.emit(`system.${SYSTEM.id}`, {
|
yes: { label: "Yes (ignore armor)", icon: "fa-solid fa-wand-magic-sparkles" },
|
||||||
...defenseMsg,
|
no: { label: "No (apply armor DR)", icon: "fa-solid fa-shield" }
|
||||||
userId: owner.id
|
|
||||||
})
|
})
|
||||||
messageSent = true
|
const rollOpts = {
|
||||||
|
type: "spell-damage",
|
||||||
|
rollType: "spell-damage",
|
||||||
|
rollName: damageFormula,
|
||||||
|
isDamage: true,
|
||||||
|
rollData: { isDamage: true },
|
||||||
|
bypassArmor: bypassArmor ?? false,
|
||||||
|
defenderId,
|
||||||
|
defenderTokenId,
|
||||||
|
actorId: actor.id,
|
||||||
|
actorName: actor.name,
|
||||||
|
actorImage: actor.img
|
||||||
|
}
|
||||||
|
const roll = new LethalFantasyRoll(damageFormula, {}, rollOpts)
|
||||||
|
await roll.evaluate()
|
||||||
|
roll.options.rollTotal = roll.total
|
||||||
|
if (game?.dice3d) await game.dice3d.showForRoll(roll, game.user, true)
|
||||||
|
await roll.toMessage()
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pour les boutons de résultat de combat (monster damage)
|
||||||
|
if (damageType === "monster" && attackKey) {
|
||||||
|
await actor.system.prepareMonsterRoll("monster-damage", attackKey, undefined, undefined, undefined, defenderId, defenderTokenId, extraShieldDr)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pour les monstres, utiliser prepareMonsterRoll
|
||||||
|
if (isMonster || actor.type === "monster") {
|
||||||
|
await actor.system.prepareMonsterRoll("monster-damage", weaponId, undefined, undefined, damageModifier)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pour les personnages, récupérer l'arme
|
||||||
|
const weapon = actor.items.get(weaponId)
|
||||||
|
if (!weapon) {
|
||||||
|
ui.notifications.error("Weapon not found")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lancer les dégâts avec la bonne méthode
|
||||||
|
const rollType = damageType === "small" ? "weapon-damage-small" : "weapon-damage-medium"
|
||||||
|
await actor.prepareRoll(rollType, weaponId, undefined, defenderId, defenderTokenId, extraShieldDr)
|
||||||
})
|
})
|
||||||
|
}
|
||||||
// Notification pour l'attaquant
|
|
||||||
if (messageSent) {
|
|
||||||
ui.notifications.info(`Defense request sent to ${defenderName}'s controller`)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// Gestionnaire pour les boutons de jet de dégâts (armes et résultats de combat)
|
|
||||||
$(html).find(".damage-roll-btn, .roll-damage-btn").off("click").on("click", async (event) => {
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
|
|
||||||
const button = $(event.currentTarget)
|
|
||||||
const weaponId = button.data("weapon-id")
|
|
||||||
const attackKey = button.data("attack-key")
|
|
||||||
let attackerId = button.data("attacker-id")
|
|
||||||
const defenderId = button.data("defender-id")
|
|
||||||
const defenderTokenId = button.data("defender-token-id") || null
|
|
||||||
const extraShieldDr = Number(button.data("extra-shield-dr") || 0)
|
|
||||||
const damageType = button.data("damage-type")
|
|
||||||
const damageFormula = button.data("damage-formula")
|
|
||||||
const damageModifier = button.data("damage-modifier")
|
|
||||||
const isMonster = button.data("is-monster")
|
|
||||||
|
|
||||||
// Récupérer l'acteur (soit depuis le message, soit depuis attackerId)
|
|
||||||
let actor = attackerId ? game.actors.get(attackerId) : game.actors.get(message.rolls[0]?.actorId)
|
|
||||||
if (!actor) {
|
|
||||||
ui.notifications.error("Actor not found")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pour les sorts, rouler les dés de dégâts avec option bypass DR
|
|
||||||
if (damageType === "spell" && damageFormula) {
|
|
||||||
const bypassArmor = await foundry.applications.api.DialogV2.confirm({
|
|
||||||
window: { title: "Spell Damage" },
|
|
||||||
classes: ["lethalfantasy"],
|
|
||||||
content: "<p>Does this spell's damage bypass armor DR?</p>",
|
|
||||||
yes: { label: "Yes (ignore armor)", icon: "fa-solid fa-wand-magic-sparkles" },
|
|
||||||
no: { label: "No (apply armor DR)", icon: "fa-solid fa-shield" }
|
|
||||||
})
|
|
||||||
const rollOpts = {
|
|
||||||
type: "spell-damage",
|
|
||||||
rollType: "spell-damage",
|
|
||||||
rollName: damageFormula,
|
|
||||||
isDamage: true,
|
|
||||||
rollData: { isDamage: true },
|
|
||||||
bypassArmor: bypassArmor ?? false,
|
|
||||||
defenderId,
|
|
||||||
defenderTokenId,
|
|
||||||
actorId: actor.id,
|
|
||||||
actorName: actor.name,
|
|
||||||
actorImage: actor.img
|
|
||||||
}
|
|
||||||
const roll = new LethalFantasyRoll(damageFormula, {}, rollOpts)
|
|
||||||
await roll.evaluate()
|
|
||||||
roll.options.rollTotal = roll.total
|
|
||||||
if (game?.dice3d) await game.dice3d.showForRoll(roll, game.user, true)
|
|
||||||
await roll.toMessage()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pour les boutons de résultat de combat (monster damage)
|
|
||||||
if (damageType === "monster" && attackKey) {
|
|
||||||
await actor.system.prepareMonsterRoll("monster-damage", attackKey, undefined, undefined, undefined, defenderId, defenderTokenId, extraShieldDr)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pour les monstres, utiliser prepareMonsterRoll
|
|
||||||
if (isMonster || actor.type === "monster") {
|
|
||||||
await actor.system.prepareMonsterRoll("monster-damage", weaponId, undefined, undefined, damageModifier)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pour les personnages, récupérer l'arme
|
|
||||||
const weapon = actor.items.get(weaponId)
|
|
||||||
if (!weapon) {
|
|
||||||
ui.notifications.error("Weapon not found")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lancer les dégâts avec la bonne méthode
|
|
||||||
const rollType = damageType === "small" ? "weapon-damage-small" : "weapon-damage-medium"
|
|
||||||
await actor.prepareRoll(rollType, weaponId, undefined, defenderId, defenderTokenId, extraShieldDr)
|
|
||||||
})
|
|
||||||
|
|
||||||
// Masquer les boutons de dommages dans les messages de résultat de combat si l'utilisateur n'est pas l'attaquant
|
// Masquer les boutons de dommages dans les messages de résultat de combat si l'utilisateur n'est pas l'attaquant
|
||||||
$(html).find(".roll-damage-btn").each(function() {
|
for (const btn of html.querySelectorAll(".roll-damage-btn")) {
|
||||||
const button = $(this)
|
const attackerId = btn.dataset.attackerId
|
||||||
const attackerId = button.data("attacker-id")
|
|
||||||
|
|
||||||
if (attackerId) {
|
if (attackerId) {
|
||||||
const attacker = game.actors.get(attackerId)
|
const attacker = game.actors.get(attackerId)
|
||||||
// Masquer le bouton si l'utilisateur n'est pas GM et ne possède pas l'attaquant
|
// Masquer le bouton si l'utilisateur n'est pas GM et ne possède pas l'attaquant
|
||||||
if (!game.user.isGM && !attacker?.testUserPermission(game.user, "OWNER")) {
|
if (!game.user.isGM && !attacker?.testUserPermission(game.user, "OWNER")) {
|
||||||
button.hide()
|
btn.style.display = "none"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
Hooks.on("getCombatTrackerEntryContext", (html, options) => {
|
|
||||||
LethalFantasyUtils.pushCombatOptions(html, options);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Hook pour ajouter les données d'attaque au message de défense
|
// Hook pour ajouter les données d'attaque au message de défense
|
||||||
Hooks.on("preCreateChatMessage", (message) => {
|
Hooks.on("preCreateChatMessage", (message) => {
|
||||||
const rollType = message.rolls[0]?.options?.rollType
|
const rollType = message.rolls[0]?.options?.rollType
|
||||||
@@ -597,7 +580,7 @@ Hooks.on("createChatMessage", async (message) => {
|
|||||||
<div class="combat-status">
|
<div class="combat-status">
|
||||||
<p><strong>${attackerName}</strong> rolled <strong>${attackRoll}</strong></p>
|
<p><strong>${attackerName}</strong> rolled <strong>${attackRoll}</strong></p>
|
||||||
<p><strong>${defenderName}</strong> currently has <strong>${defenseRoll}</strong></p>
|
<p><strong>${defenderName}</strong> currently has <strong>${defenseRoll}</strong></p>
|
||||||
${defenseD30message ? `<p class="bonus-info">D30 special: ${defenseD30message}</p>` : ""}
|
${defenseD30message ? `<p class="bonus-info">D30 special: ${defenseD30message.description}</p>` : ""}
|
||||||
</div>
|
</div>
|
||||||
<p class="offer-text">Choose how to improve the defense before resolving the hit.</p>
|
<p class="offer-text">Choose how to improve the defense before resolving the hit.</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -751,7 +734,7 @@ Hooks.on("createChatMessage", async (message) => {
|
|||||||
<div class="combat-status">
|
<div class="combat-status">
|
||||||
<p><strong>${attackerName}</strong> currently has <strong>${attackRollFinal}</strong></p>
|
<p><strong>${attackerName}</strong> currently has <strong>${attackRollFinal}</strong></p>
|
||||||
<p><strong>${defenderName}</strong> rolled <strong>${defenseRoll}</strong></p>
|
<p><strong>${defenderName}</strong> rolled <strong>${defenseRoll}</strong></p>
|
||||||
${attackD30message ? `<p class="bonus-info">D30 special: ${attackD30message}</p>` : ""}
|
${attackD30message ? `<p class="bonus-info">D30 special: ${attackD30message.description}</p>` : ""}
|
||||||
</div>
|
</div>
|
||||||
<p class="offer-text">Choose how to improve the attack before resolving the combat result.</p>
|
<p class="offer-text">Choose how to improve the attack before resolving the combat result.</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -819,6 +802,73 @@ Hooks.on("createChatMessage", async (message) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Hook: deduct aether when a spell-attack or spell-power roll is posted to chat
|
||||||
|
Hooks.on("createChatMessage", async (message) => {
|
||||||
|
if (!["spell-attack", "spell-power"].includes(message.rolls[0]?.options?.rollType)) return
|
||||||
|
|
||||||
|
const actorId = message.rolls[0]?.options?.actorId
|
||||||
|
if (!actorId) return
|
||||||
|
const actor = game.actors.get(actorId)
|
||||||
|
if (!actor) return
|
||||||
|
|
||||||
|
// Only the primary controller (player owner or GM) handles this
|
||||||
|
const activePlayerOwners = game.users.filter(u => u.active && !u.isGM && actor.testUserPermission(u, "OWNER"))
|
||||||
|
const isPrimary = activePlayerOwners.length > 0
|
||||||
|
? activePlayerOwners[0].id === game.user.id
|
||||||
|
: game.user.isGM
|
||||||
|
if (!isPrimary) return
|
||||||
|
|
||||||
|
const rollTarget = message.rolls[0]?.options?.rollTarget
|
||||||
|
const spellId = rollTarget?.id || rollTarget?._id
|
||||||
|
const spell = spellId ? actor.items.get(spellId) : null
|
||||||
|
if (!spell || spell.type !== "spell") return
|
||||||
|
|
||||||
|
const cost = Number(spell.system?.cost) || 0
|
||||||
|
if (cost <= 0) return
|
||||||
|
|
||||||
|
const currentAether = Number(actor.system.aetherPoints?.value) || 0
|
||||||
|
const newAether = Math.max(0, currentAether - cost)
|
||||||
|
await actor.update({ "system.aetherPoints.value": newAether })
|
||||||
|
|
||||||
|
await ChatMessage.create({
|
||||||
|
content: `<p>🔮 <strong>${actor.name}</strong> casts <em>${spell.name}</em> — spends <strong>${cost}</strong> Aether <span style="color:#888;">(${currentAether} → ${newAether})</span>.</p>`,
|
||||||
|
speaker: ChatMessage.getSpeaker({ actor })
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
// Hook: deduct grace when a miracle-attack or miracle-power roll is posted to chat
|
||||||
|
Hooks.on("createChatMessage", async (message) => {
|
||||||
|
if (!["miracle-attack", "miracle-power"].includes(message.rolls[0]?.options?.rollType)) return
|
||||||
|
|
||||||
|
const actorId = message.rolls[0]?.options?.actorId
|
||||||
|
if (!actorId) return
|
||||||
|
const actor = game.actors.get(actorId)
|
||||||
|
if (!actor) return
|
||||||
|
|
||||||
|
const activePlayerOwners = game.users.filter(u => u.active && !u.isGM && actor.testUserPermission(u, "OWNER"))
|
||||||
|
const isPrimary = activePlayerOwners.length > 0
|
||||||
|
? activePlayerOwners[0].id === game.user.id
|
||||||
|
: game.user.isGM
|
||||||
|
if (!isPrimary) return
|
||||||
|
|
||||||
|
const rollTarget = message.rolls[0]?.options?.rollTarget
|
||||||
|
const miracleId = rollTarget?.id || rollTarget?._id
|
||||||
|
const miracle = miracleId ? actor.items.get(miracleId) : null
|
||||||
|
if (!miracle || miracle.type !== "miracle") return
|
||||||
|
|
||||||
|
const cost = Number(miracle.system?.level) || 0
|
||||||
|
if (cost <= 0) return
|
||||||
|
|
||||||
|
const currentGrace = Number(actor.system.divinityPoints?.value) || 0
|
||||||
|
const newGrace = Math.max(0, currentGrace - cost)
|
||||||
|
await actor.update({ "system.divinityPoints.value": newGrace })
|
||||||
|
|
||||||
|
await ChatMessage.create({
|
||||||
|
content: `<p>✨ <strong>${actor.name}</strong> invokes <em>${miracle.name}</em> — spends <strong>${cost}</strong> Grace <span style="color:#888;">(${currentGrace} → ${newGrace})</span>.</p>`,
|
||||||
|
speaker: ChatMessage.getSpeaker({ actor })
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
// Hook pour appliquer automatiquement les dégâts si une cible est définie
|
// Hook pour appliquer automatiquement les dégâts si une cible est définie
|
||||||
Hooks.on("createChatMessage", async (message) => {
|
Hooks.on("createChatMessage", async (message) => {
|
||||||
// Vérifier si c'est un message de dégâts avec un defenderId
|
// Vérifier si c'est un message de dégâts avec un defenderId
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ export class LethalFantasyCombatTracker extends foundry.applications.sidebar.tab
|
|||||||
actions: {
|
actions: {
|
||||||
initiativePlus: LethalFantasyCombatTracker.#initiativePlus,
|
initiativePlus: LethalFantasyCombatTracker.#initiativePlus,
|
||||||
initiativeMinus: LethalFantasyCombatTracker.#initiativeMinus,
|
initiativeMinus: LethalFantasyCombatTracker.#initiativeMinus,
|
||||||
|
rollMonsterProgression: LethalFantasyCombatTracker.#rollMonsterProgression,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -49,6 +50,15 @@ export class LethalFantasyCombatTracker extends foundry.applications.sidebar.tab
|
|||||||
c.update({ 'initiative': newInit });
|
c.update({ 'initiative': newInit });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Roll progression dice for all monster combatants that are eligible this round.
|
||||||
|
* @param {Event} ev Click event.
|
||||||
|
*/
|
||||||
|
static async #rollMonsterProgression(ev) {
|
||||||
|
ev.preventDefault();
|
||||||
|
await game.combat.rollMonsterProgression();
|
||||||
|
}
|
||||||
|
|
||||||
activateListeners(html) {
|
activateListeners(html) {
|
||||||
super.activateListeners(html);
|
super.activateListeners(html);
|
||||||
// Display Combat settings
|
// Display Combat settings
|
||||||
@@ -130,6 +140,17 @@ export class LethalFantasyCombat extends Combat {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Roll progression dice for all eligible monster combatants this round. Called manually by the GM. */
|
||||||
|
async rollMonsterProgression() {
|
||||||
|
const currentRound = this.round;
|
||||||
|
for (let c of this.combatants) {
|
||||||
|
if (c.actor.type !== "monster") continue;
|
||||||
|
if (c.initiative !== null && currentRound >= c.initiative) {
|
||||||
|
await c.actor.system.rollProgressionDice(this.id, c.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
resetProgression(cId) {
|
resetProgression(cId) {
|
||||||
let c = this.combatants.get(cId);
|
let c = this.combatants.get(cId);
|
||||||
c.update({ 'system.progressionCount': 0 });
|
c.update({ 'system.progressionCount': 0 });
|
||||||
@@ -203,6 +224,7 @@ export class LethalFantasyCombat extends Combat {
|
|||||||
|
|
||||||
for (let c of this.combatants) {
|
for (let c of this.combatants) {
|
||||||
if (nextRound >= c.initiative) {
|
if (nextRound >= c.initiative) {
|
||||||
|
if (c.actor.type === "monster") continue; // Monsters roll manually via the "Roll Monsters" button
|
||||||
const playerOwner = game.users.find(u => u.active && !u.isGM && u.character?.id === c.actor.id);
|
const playerOwner = game.users.find(u => u.active && !u.isGM && u.character?.id === c.actor.id);
|
||||||
if (game.user.isGM && playerOwner) {
|
if (game.user.isGM && playerOwner) {
|
||||||
game.socket.emit(`system.${SYSTEM.id}`, { type: "rollProgressionDice", userId: playerOwner.id, progressionCount: c.system.progressionCount + 1, actorId: c.actor.id, combatId: this.id, combatantId: c.id });
|
game.socket.emit(`system.${SYSTEM.id}`, { type: "rollProgressionDice", userId: playerOwner.id, progressionCount: c.system.progressionCount + 1, actorId: c.actor.id, combatId: this.id, combatantId: c.id });
|
||||||
|
|||||||
@@ -75,39 +75,53 @@ export function injectDiceTray(_chatLog, html) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Roll one or more dice of the given type and post the result to chat.
|
* Roll one or more dice of the given type and post the result to chat.
|
||||||
|
* For exploding dice, follows the Lethal Fantasy rule: each exploded reroll
|
||||||
|
* contributes (result − 1) to the total, same as all other system rolls.
|
||||||
*
|
*
|
||||||
* @param {string} dieType Die face, e.g. "d20"
|
* @param {string} dieType Die face, e.g. "d20"
|
||||||
* @param {number} count Number of dice to roll (1–9)
|
* @param {number} count Number of dice to roll (1–9)
|
||||||
* @param {boolean} explode Whether to use the exploding modifier (x = max-value explode)
|
* @param {boolean} explode Whether to use the exploding variant (max triggers reroll at −1)
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
export async function rollFreeDie(dieType, count = 1, explode = false) {
|
export async function rollFreeDie(dieType, count = 1, explode = false) {
|
||||||
const sides = parseInt(dieType.replace("d", "")) || 20
|
const sides = parseInt(dieType.replace("d", "")) || 20
|
||||||
const formula = explode ? `${count}d${sides}x` : `${count}d${sides}`
|
const baseFormula = `1d${sides}`
|
||||||
const label = explode
|
const label = explode
|
||||||
? `${count}${dieType.toUpperCase()}E`
|
? `${count}${dieType.toUpperCase()}E`
|
||||||
: `${count}${dieType.toUpperCase()}`
|
: `${count}${dieType.toUpperCase()}`
|
||||||
|
|
||||||
const roll = new Roll(formula)
|
|
||||||
await roll.evaluate()
|
|
||||||
|
|
||||||
const results = roll.terms
|
|
||||||
.filter(t => t.results)
|
|
||||||
.flatMap(t => t.results)
|
|
||||||
|
|
||||||
const total = roll.total
|
|
||||||
|
|
||||||
const dieLabel = dieType.toUpperCase()
|
const dieLabel = dieType.toUpperCase()
|
||||||
const resultHtml = results.map(r => {
|
const dieChips = []
|
||||||
const val = r.result
|
let total = 0
|
||||||
const isMax = val === sides
|
|
||||||
const isMin = val === 1
|
for (let i = 0; i < count; i++) {
|
||||||
const explodeIcon = r.exploded ? `<i class="fa-solid fa-burst lf-dt-explode-icon"></i>` : ""
|
const r0 = await new Roll(baseFormula).evaluate()
|
||||||
|
if (game?.dice3d) await game.dice3d.showForRoll(r0, game.user, true)
|
||||||
|
let diceResult = r0.dice[0].results[0].result
|
||||||
|
dieChips.push({ label: dieLabel, value: diceResult, exploded: false })
|
||||||
|
total += diceResult
|
||||||
|
|
||||||
|
if (explode) {
|
||||||
|
while (diceResult === sides) {
|
||||||
|
const rx = await new Roll(baseFormula).evaluate()
|
||||||
|
if (game?.dice3d) await game.dice3d.showForRoll(rx, game.user, true)
|
||||||
|
diceResult = rx.dice[0].results[0].result
|
||||||
|
const contrib = diceResult - 1
|
||||||
|
dieChips.push({ label: `${dieLabel}-1`, value: contrib, exploded: true })
|
||||||
|
total += contrib
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const resultHtml = dieChips.map(chip => {
|
||||||
|
const isMax = !chip.exploded && chip.value === sides
|
||||||
|
const isMin = chip.value === 1
|
||||||
|
const explodeIcon = chip.exploded ? `<i class="fa-solid fa-burst lf-dt-explode-icon"></i>` : ""
|
||||||
const classes = ["lf-frc-die-chip", isMax ? "lf-frc-max" : "", isMin ? "lf-frc-min" : ""].filter(Boolean).join(" ")
|
const classes = ["lf-frc-die-chip", isMax ? "lf-frc-max" : "", isMin ? "lf-frc-min" : ""].filter(Boolean).join(" ")
|
||||||
return `<div class="${classes}">
|
return `<div class="${classes}">
|
||||||
<span class="lf-frc-die-type">${dieLabel}</span>
|
<span class="lf-frc-die-type">${chip.label}</span>
|
||||||
<span class="lf-frc-die-sep">→</span>
|
<span class="lf-frc-die-sep">→</span>
|
||||||
<span class="lf-frc-die-val">${val}${explodeIcon}</span>
|
<span class="lf-frc-die-val">${chip.value}${explodeIcon}</span>
|
||||||
</div>`
|
</div>`
|
||||||
}).join("")
|
}).join("")
|
||||||
|
|
||||||
@@ -131,9 +145,8 @@ export async function rollFreeDie(dieType, count = 1, explode = false) {
|
|||||||
const msgData = {
|
const msgData = {
|
||||||
speaker: ChatMessage.getSpeaker(),
|
speaker: ChatMessage.getSpeaker(),
|
||||||
content,
|
content,
|
||||||
rolls: [roll],
|
|
||||||
sound: CONFIG.sounds.dice,
|
sound: CONFIG.sounds.dice,
|
||||||
}
|
}
|
||||||
ChatMessage.applyRollMode(msgData, rollMode)
|
ChatMessage.applyMode(msgData, rollMode)
|
||||||
await ChatMessage.create(msgData)
|
await ChatMessage.create(msgData)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
|
|||||||
})
|
})
|
||||||
if (!roll) return null
|
if (!roll) return null
|
||||||
|
|
||||||
await roll.toMessage({}, { rollMode: roll.options.rollMode })
|
await roll.toMessage({}, { messageMode: roll.options.rollMode })
|
||||||
}
|
}
|
||||||
|
|
||||||
static async #onRollInitiative(event, target) {
|
static async #onRollInitiative(event, target) {
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ export default class LethalFantasyMonsterSheet extends LethalFantasyActorSheet {
|
|||||||
})
|
})
|
||||||
if (!roll) return null
|
if (!roll) return null
|
||||||
|
|
||||||
await roll.toMessage({}, { rollMode: roll.options.rollMode })
|
await roll.toMessage({}, { messageMode: roll.options.rollMode })
|
||||||
}
|
}
|
||||||
|
|
||||||
static async #onRollInitiative(event, target) {
|
static async #onRollInitiative(event, target) {
|
||||||
|
|||||||
@@ -1,148 +1,615 @@
|
|||||||
{
|
{
|
||||||
"d30_dice_results": {
|
"d30_dice_results": {
|
||||||
"30": {
|
"30": {
|
||||||
"melee_attack": "Possible Lethal or Vital Strike or Add D20E to Attack",
|
"melee_attack": {
|
||||||
"ranged_attack": "Possible Lethal or Vital Strike or Add D20E to Attack",
|
"type": "choice",
|
||||||
"melee_defense": "Possible Flawless or Legendary Defense or Add D20E to Defense",
|
"choices": [
|
||||||
"arcane_spell_attack": "Possible Lethal or Vital Magical Strike or Add D20E to Spell Attack",
|
{
|
||||||
"arcane_spell_defense": "Possible Spell Catastrophe or adds D20E to Spell Defense",
|
"type": "special_strike",
|
||||||
"skill_rolls": "Skill Succeeds Regardless of Opposing Roll"
|
"options": [
|
||||||
|
"lethal",
|
||||||
|
"vital"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bonus_dice",
|
||||||
|
"dice": "D20E",
|
||||||
|
"target": "attack"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Possible Lethal or Vital Strike or Add D20E to Attack"
|
||||||
|
},
|
||||||
|
"ranged_attack": {
|
||||||
|
"type": "choice",
|
||||||
|
"choices": [
|
||||||
|
{
|
||||||
|
"type": "special_strike",
|
||||||
|
"options": [
|
||||||
|
"lethal",
|
||||||
|
"vital"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bonus_dice",
|
||||||
|
"dice": "D20E",
|
||||||
|
"target": "attack"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Possible Lethal or Vital Strike or Add D20E to Attack"
|
||||||
|
},
|
||||||
|
"melee_defense": {
|
||||||
|
"type": "choice",
|
||||||
|
"choices": [
|
||||||
|
{
|
||||||
|
"type": "special_defense",
|
||||||
|
"options": [
|
||||||
|
"flawless",
|
||||||
|
"legendary"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bonus_dice",
|
||||||
|
"dice": "D20E",
|
||||||
|
"target": "defense"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Possible Flawless or Legendary Defense or Add D20E to Defense"
|
||||||
|
},
|
||||||
|
"arcane_spell_attack": {
|
||||||
|
"type": "choice",
|
||||||
|
"choices": [
|
||||||
|
{
|
||||||
|
"type": "special_strike",
|
||||||
|
"options": [
|
||||||
|
"lethal_magical",
|
||||||
|
"vital_magical"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bonus_dice",
|
||||||
|
"dice": "D20E",
|
||||||
|
"target": "spell_attack"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Possible Lethal or Vital Magical Strike or Add D20E to Spell Attack"
|
||||||
|
},
|
||||||
|
"arcane_spell_defense": {
|
||||||
|
"type": "choice",
|
||||||
|
"choices": [
|
||||||
|
{
|
||||||
|
"type": "spell_calamity"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bonus_dice",
|
||||||
|
"dice": "D20E",
|
||||||
|
"target": "spell_defense"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Possible Spell Catastrophe or adds D20E to Spell Defense"
|
||||||
|
},
|
||||||
|
"skill_rolls": {
|
||||||
|
"type": "skill_auto_success",
|
||||||
|
"description": "Skill Succeeds Regardless of Opposing Roll"
|
||||||
|
},
|
||||||
|
"ranged_defense": {
|
||||||
|
"type": "choice",
|
||||||
|
"choices": [
|
||||||
|
{
|
||||||
|
"type": "special_defense",
|
||||||
|
"options": [
|
||||||
|
"flawless",
|
||||||
|
"legendary"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bonus_dice",
|
||||||
|
"dice": "D20E",
|
||||||
|
"target": "defense"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Possible Flawless or Legendary Defense or Add D20E to Defense"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"29": {
|
"29": {
|
||||||
"melee_attack": "Gain 1 Grit",
|
"melee_attack": {
|
||||||
"ranged_attack": "Gain 1 Grit",
|
"type": "gain_grit",
|
||||||
"melee_defense": "Gain 1 Grit",
|
"amount": 1,
|
||||||
"arcane_spell_attack": "Gain 1 Grit",
|
"description": "Gain 1 Grit"
|
||||||
"arcane_spell_defense": "Gain 1 Grit",
|
},
|
||||||
"skill_rolls": "Gain 1 Grit"
|
"ranged_attack": {
|
||||||
|
"type": "gain_grit",
|
||||||
|
"amount": 1,
|
||||||
|
"description": "Gain 1 Grit"
|
||||||
|
},
|
||||||
|
"melee_defense": {
|
||||||
|
"type": "gain_grit",
|
||||||
|
"amount": 1,
|
||||||
|
"description": "Gain 1 Grit"
|
||||||
|
},
|
||||||
|
"arcane_spell_attack": {
|
||||||
|
"type": "gain_grit",
|
||||||
|
"amount": 1,
|
||||||
|
"description": "Gain 1 Grit"
|
||||||
|
},
|
||||||
|
"arcane_spell_defense": {
|
||||||
|
"type": "gain_grit",
|
||||||
|
"amount": 1,
|
||||||
|
"description": "Gain 1 Grit"
|
||||||
|
},
|
||||||
|
"skill_rolls": {
|
||||||
|
"type": "gain_grit",
|
||||||
|
"amount": 1,
|
||||||
|
"description": "Gain 1 Grit"
|
||||||
|
},
|
||||||
|
"ranged_defense": {
|
||||||
|
"type": "gain_grit",
|
||||||
|
"amount": 1,
|
||||||
|
"description": "Gain 1 Grit"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"28": {
|
"28": {
|
||||||
"melee_attack": "Shield Destruction",
|
"melee_attack": {
|
||||||
"ranged_attack": "empty",
|
"type": "shield_destruction",
|
||||||
"melee_defense": "empty",
|
"description": "Shield Destruction"
|
||||||
"arcane_spell_attack": "empty",
|
}
|
||||||
"arcane_spell_defense": "empty",
|
|
||||||
"skill_rolls": "empty"
|
|
||||||
},
|
},
|
||||||
"27": {
|
"27": {
|
||||||
"melee_attack": "Granted D6 (1-6) Attack Modifier for This Melee Attack",
|
"melee_attack": {
|
||||||
"ranged_attack": "Granted D6 (1-6) Attack Modifier for This Ranged Attack",
|
"type": "bonus_dice",
|
||||||
"melee_defense": "Granted 1 Luck dice for Use in This Combat Only",
|
"dice": "D6",
|
||||||
"arcane_spell_attack": "No Spell Lethargy the Aether Approves of Characters Efforts",
|
"target": "attack",
|
||||||
"arcane_spell_defense": "Caster Suffers Severe pain and will be under a flash of pain for 1D6E seconds",
|
"description": "Granted D6 (1-6) Attack Modifier for This Melee Attack"
|
||||||
"skill_rolls": "empty"
|
},
|
||||||
|
"ranged_attack": {
|
||||||
|
"type": "bonus_dice",
|
||||||
|
"dice": "D6",
|
||||||
|
"target": "attack",
|
||||||
|
"description": "Granted D6 (1-6) Attack Modifier for This Ranged Attack"
|
||||||
|
},
|
||||||
|
"melee_defense": {
|
||||||
|
"type": "luck_die",
|
||||||
|
"scope": "combat",
|
||||||
|
"description": "Granted 1 Luck dice for Use in This Combat Only"
|
||||||
|
},
|
||||||
|
"arcane_spell_attack": {
|
||||||
|
"type": "no_lethargy",
|
||||||
|
"description": "No Spell Lethargy the Aether Approves of Characters Efforts"
|
||||||
|
},
|
||||||
|
"arcane_spell_defense": {
|
||||||
|
"type": "flash_of_pain",
|
||||||
|
"duration_dice": "1D6E",
|
||||||
|
"target": "caster",
|
||||||
|
"description": "Caster Suffers Severe pain and will be under a flash of pain for 1D6E seconds"
|
||||||
|
},
|
||||||
|
"ranged_defense": {
|
||||||
|
"type": "luck_die",
|
||||||
|
"scope": "combat",
|
||||||
|
"description": "Granted 1 Luck dice for Use in This Combat Only"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"26": {
|
"26": {
|
||||||
"melee_attack": "Shield Destruction",
|
"melee_attack": {
|
||||||
"ranged_attack": "empty",
|
"type": "shield_destruction",
|
||||||
"melee_defense": "empty",
|
"description": "Shield Destruction"
|
||||||
"arcane_spell_attack": "empty",
|
}
|
||||||
"arcane_spell_defense": "empty",
|
|
||||||
"skill_rolls": "empty"
|
|
||||||
},
|
},
|
||||||
"25": {
|
"25": {
|
||||||
"melee_attack": "empty",
|
"skill_rolls": {
|
||||||
"ranged_attack": "empty",
|
"type": "bonus_flat",
|
||||||
"melee_defense": "empty",
|
"amount": 1,
|
||||||
"arcane_spell_attack": "empty",
|
"target": "skill",
|
||||||
"arcane_spell_defense": "empty",
|
"description": "Add 1 to Skill Roll"
|
||||||
"skill_rolls": "Add 1 to Skill Roll"
|
}
|
||||||
},
|
},
|
||||||
"21": {
|
"21": {
|
||||||
"melee_attack": "Hit Inflicts Flash of Pain 1D6E seconds",
|
"melee_attack": {
|
||||||
"ranged_attack": "Hit Inflicts Flash of Pain 1D6E seconds",
|
"type": "flash_of_pain",
|
||||||
"melee_defense": "Defender Recovers or ignores any flash of pain",
|
"duration_dice": "1D6E",
|
||||||
"arcane_spell_attack": "Magical Damage inflicts Flash of pain 1D6E seconds",
|
"target": "defender",
|
||||||
"arcane_spell_defense": "Caster Suffers Severe pain and will be under a flash of pain for 1D6E seconds",
|
"description": "Hit Inflicts Flash of Pain 1D6E seconds"
|
||||||
"skill_rolls": "Granted D6 (1-6) Skill Modifier for this Skill Attempt"
|
},
|
||||||
|
"ranged_attack": {
|
||||||
|
"type": "flash_of_pain",
|
||||||
|
"duration_dice": "1D6E",
|
||||||
|
"target": "defender",
|
||||||
|
"description": "Hit Inflicts Flash of Pain 1D6E seconds"
|
||||||
|
},
|
||||||
|
"melee_defense": {
|
||||||
|
"type": "recover_pain",
|
||||||
|
"description": "Defender Recovers or ignores any flash of pain"
|
||||||
|
},
|
||||||
|
"arcane_spell_attack": {
|
||||||
|
"type": "flash_of_pain",
|
||||||
|
"duration_dice": "1D6E",
|
||||||
|
"target": "defender",
|
||||||
|
"description": "Magical Damage inflicts Flash of pain 1D6E seconds"
|
||||||
|
},
|
||||||
|
"arcane_spell_defense": {
|
||||||
|
"type": "flash_of_pain",
|
||||||
|
"duration_dice": "1D6E",
|
||||||
|
"target": "caster",
|
||||||
|
"description": "Caster Suffers Severe pain and will be under a flash of pain for 1D6E seconds"
|
||||||
|
},
|
||||||
|
"skill_rolls": {
|
||||||
|
"type": "bonus_dice",
|
||||||
|
"dice": "D6",
|
||||||
|
"target": "skill",
|
||||||
|
"description": "Granted D6 (1-6) Skill Modifier for this Skill Attempt"
|
||||||
|
},
|
||||||
|
"ranged_defense": {
|
||||||
|
"type": "recover_pain",
|
||||||
|
"description": "Defender Recovers or ignores any flash of pain"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"20": {
|
"20": {
|
||||||
"melee_attack": "Possible Vicious Strike or Add D12 to attack",
|
"melee_attack": {
|
||||||
"ranged_attack": "Possible Vicious Strike or add D12 to attack",
|
"type": "choice",
|
||||||
"melee_defense": "Possible 20/20 defense that avoids Any Attack Except a Lethal Strike or adds D12 to defense",
|
"choices": [
|
||||||
"arcane_spell_attack": "Possible Vicious Application of a Magical Attack or add D12 to attack",
|
{
|
||||||
"arcane_spell_defense": "Possible 20/20 Spell defense that Saves Against Any Magical Attack Except a Lethal Magical Strike or add D12 to defense",
|
"type": "special_strike",
|
||||||
"skill_rolls": "20 Added to Skill Roll"
|
"options": [
|
||||||
|
"vicious"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bonus_dice",
|
||||||
|
"dice": "D12",
|
||||||
|
"target": "attack"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Possible Vicious Strike or Add D12 to attack"
|
||||||
|
},
|
||||||
|
"ranged_attack": {
|
||||||
|
"type": "choice",
|
||||||
|
"choices": [
|
||||||
|
{
|
||||||
|
"type": "special_strike",
|
||||||
|
"options": [
|
||||||
|
"vicious"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bonus_dice",
|
||||||
|
"dice": "D12",
|
||||||
|
"target": "attack"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Possible Vicious Strike or add D12 to attack"
|
||||||
|
},
|
||||||
|
"melee_defense": {
|
||||||
|
"type": "choice",
|
||||||
|
"choices": [
|
||||||
|
{
|
||||||
|
"type": "special_defense",
|
||||||
|
"options": [
|
||||||
|
"perfect"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bonus_dice",
|
||||||
|
"dice": "D12",
|
||||||
|
"target": "defense"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Possible 20/20 defense that avoids Any Attack Except a Lethal Strike or adds D12 to defense"
|
||||||
|
},
|
||||||
|
"arcane_spell_attack": {
|
||||||
|
"type": "choice",
|
||||||
|
"choices": [
|
||||||
|
{
|
||||||
|
"type": "special_strike",
|
||||||
|
"options": [
|
||||||
|
"vicious_magical"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bonus_dice",
|
||||||
|
"dice": "D12",
|
||||||
|
"target": "spell_attack"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Possible Vicious Application of a Magical Attack or add D12 to attack"
|
||||||
|
},
|
||||||
|
"arcane_spell_defense": {
|
||||||
|
"type": "choice",
|
||||||
|
"choices": [
|
||||||
|
{
|
||||||
|
"type": "special_defense",
|
||||||
|
"options": [
|
||||||
|
"perfect_spell"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bonus_dice",
|
||||||
|
"dice": "D12",
|
||||||
|
"target": "spell_defense"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Possible 20/20 Spell defense that Saves Against Any Magical Attack Except a Lethal Magical Strike or add D12 to defense"
|
||||||
|
},
|
||||||
|
"skill_rolls": {
|
||||||
|
"type": "bonus_flat",
|
||||||
|
"amount": 20,
|
||||||
|
"target": "skill",
|
||||||
|
"description": "20 Added to Skill Roll"
|
||||||
|
},
|
||||||
|
"ranged_defense": {
|
||||||
|
"type": "choice",
|
||||||
|
"choices": [
|
||||||
|
{
|
||||||
|
"type": "special_defense",
|
||||||
|
"options": [
|
||||||
|
"perfect"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bonus_dice",
|
||||||
|
"dice": "D12",
|
||||||
|
"target": "defense"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Possible 20/20 defense that avoids Any Attack Except a Lethal Strike or adds D12 to defense"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"15": {
|
"15": {
|
||||||
"melee_attack": "Bleed, Knock-back on Hit",
|
"melee_attack": {
|
||||||
"ranged_attack": "Bleed",
|
"type": "combo",
|
||||||
"melee_defense": "Kick, Punch or Shield Bash",
|
"effects": [
|
||||||
"arcane_spell_attack": "empty",
|
{
|
||||||
"arcane_spell_defense": "empty",
|
"type": "bleed"
|
||||||
"skill_rolls": "Add 1 to Skill Roll"
|
},
|
||||||
},
|
{
|
||||||
"13": {
|
"type": "knockback"
|
||||||
"melee_attack": "empty",
|
}
|
||||||
"ranged_attack": "empty",
|
],
|
||||||
"melee_defense": "empty",
|
"description": "Bleed, Knock-back on Hit"
|
||||||
"arcane_spell_attack": "empty",
|
},
|
||||||
"arcane_spell_defense": "empty",
|
"ranged_attack": {
|
||||||
"skill_rolls": "empty"
|
"type": "bleed",
|
||||||
|
"description": "Bleed"
|
||||||
|
},
|
||||||
|
"melee_defense": {
|
||||||
|
"type": "counter_attack",
|
||||||
|
"options": [
|
||||||
|
"kick",
|
||||||
|
"punch",
|
||||||
|
"shield_bash"
|
||||||
|
],
|
||||||
|
"description": "Kick, Punch or Shield Bash"
|
||||||
|
},
|
||||||
|
"skill_rolls": {
|
||||||
|
"type": "bonus_flat",
|
||||||
|
"amount": 1,
|
||||||
|
"target": "skill",
|
||||||
|
"description": "Add 1 to Skill Roll"
|
||||||
|
},
|
||||||
|
"ranged_defense": {
|
||||||
|
"type": "counter_attack",
|
||||||
|
"options": [
|
||||||
|
"kick",
|
||||||
|
"punch",
|
||||||
|
"shield_bash"
|
||||||
|
],
|
||||||
|
"description": "Kick, Punch or Shield Bash"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
"13": {},
|
||||||
"11": {
|
"11": {
|
||||||
"melee_attack": "Flurry Attack or Hit to Miss",
|
"melee_attack": {
|
||||||
"ranged_attack": "Roll 2x Damage Dice",
|
"type": "flurry",
|
||||||
"melee_defense": "empty",
|
"condition": "hit_or_miss",
|
||||||
"arcane_spell_attack": "empty",
|
"description": "Flurry Attack or Hit to Miss"
|
||||||
"arcane_spell_defense": "empty",
|
},
|
||||||
"skill_rolls": "empty"
|
"ranged_attack": {
|
||||||
|
"type": "double_damage_dice",
|
||||||
|
"description": "Roll 2x Damage Dice"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"10": {
|
"10": {
|
||||||
"melee_attack": "Bleed, Knock-back on Hit",
|
"melee_attack": {
|
||||||
"ranged_attack": "Bleed",
|
"type": "combo",
|
||||||
"melee_defense": "Kick, Punch or Shield Bash",
|
"effects": [
|
||||||
"arcane_spell_attack": "empty",
|
{
|
||||||
"arcane_spell_defense": "empty",
|
"type": "bleed"
|
||||||
"skill_rolls": "Add 1 to Skill Roll"
|
},
|
||||||
|
{
|
||||||
|
"type": "knockback"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Bleed, Knock-back on Hit"
|
||||||
|
},
|
||||||
|
"ranged_attack": {
|
||||||
|
"type": "bleed",
|
||||||
|
"description": "Bleed"
|
||||||
|
},
|
||||||
|
"melee_defense": {
|
||||||
|
"type": "counter_attack",
|
||||||
|
"options": [
|
||||||
|
"kick",
|
||||||
|
"punch",
|
||||||
|
"shield_bash"
|
||||||
|
],
|
||||||
|
"description": "Kick, Punch or Shield Bash"
|
||||||
|
},
|
||||||
|
"skill_rolls": {
|
||||||
|
"type": "bonus_flat",
|
||||||
|
"amount": 1,
|
||||||
|
"target": "skill",
|
||||||
|
"description": "Add 1 to Skill Roll"
|
||||||
|
},
|
||||||
|
"ranged_defense": {
|
||||||
|
"type": "counter_attack",
|
||||||
|
"options": [
|
||||||
|
"kick",
|
||||||
|
"punch",
|
||||||
|
"shield_bash"
|
||||||
|
],
|
||||||
|
"description": "Kick, Punch or Shield Bash"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"8": {
|
"8": {
|
||||||
"melee_attack": "Mulligan, Can Choose to Re-roll This Attack",
|
"melee_attack": {
|
||||||
"ranged_attack": "Mulligan, Can Choose to Re-Roll This Attack",
|
"type": "mulligan",
|
||||||
"melee_defense": "Mulligan, Can Choose to Re-Roll This Defense",
|
"description": "Mulligan, Can Choose to Re-roll This Attack"
|
||||||
"arcane_spell_attack": "Mulligan, Can Re-Roll This Spell Attack",
|
},
|
||||||
"arcane_spell_defense": "Mulligan, Can Re-Roll This Spell Defense",
|
"ranged_attack": {
|
||||||
"skill_rolls": "Mulligan, Can Re-Roll This Skill roll"
|
"type": "mulligan",
|
||||||
|
"description": "Mulligan, Can Choose to Re-Roll This Attack"
|
||||||
|
},
|
||||||
|
"melee_defense": {
|
||||||
|
"type": "mulligan",
|
||||||
|
"description": "Mulligan, Can Choose to Re-Roll This Defense"
|
||||||
|
},
|
||||||
|
"arcane_spell_attack": {
|
||||||
|
"type": "mulligan",
|
||||||
|
"description": "Mulligan, Can Re-Roll This Spell Attack"
|
||||||
|
},
|
||||||
|
"arcane_spell_defense": {
|
||||||
|
"type": "mulligan",
|
||||||
|
"description": "Mulligan, Can Re-Roll This Spell Defense"
|
||||||
|
},
|
||||||
|
"skill_rolls": {
|
||||||
|
"type": "mulligan",
|
||||||
|
"description": "Mulligan, Can Re-Roll This Skill roll"
|
||||||
|
},
|
||||||
|
"ranged_defense": {
|
||||||
|
"type": "mulligan",
|
||||||
|
"description": "Mulligan, Can Choose to Re-Roll This Defense"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"7": {
|
"7": {
|
||||||
"melee_attack": "Flurry Attack on Hit or Miss",
|
"melee_attack": {
|
||||||
"ranged_attack": "Roll 2x Damage Dice",
|
"type": "flurry",
|
||||||
"melee_defense": "empty",
|
"condition": "hit_or_miss",
|
||||||
"arcane_spell_attack": "empty",
|
"description": "Flurry Attack on Hit or Miss"
|
||||||
"arcane_spell_defense": "empty",
|
},
|
||||||
"skill_rolls": "empty"
|
"ranged_attack": {
|
||||||
|
"type": "double_damage_dice",
|
||||||
|
"description": "Roll 2x Damage Dice"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"5": {
|
"5": {
|
||||||
"melee_attack": "Bleed, Knock-back on Hit",
|
"melee_attack": {
|
||||||
"ranged_attack": "Bleed",
|
"type": "combo",
|
||||||
"melee_defense": "Kick, Punch, or Shield Bash",
|
"effects": [
|
||||||
"arcane_spell_attack": "empty",
|
{
|
||||||
"arcane_spell_defense": "empty",
|
"type": "bleed"
|
||||||
"skill_rolls": "Add 1 to Skill Roll"
|
},
|
||||||
|
{
|
||||||
|
"type": "knockback"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Bleed, Knock-back on Hit"
|
||||||
|
},
|
||||||
|
"ranged_attack": {
|
||||||
|
"type": "bleed",
|
||||||
|
"description": "Bleed"
|
||||||
|
},
|
||||||
|
"melee_defense": {
|
||||||
|
"type": "counter_attack",
|
||||||
|
"options": [
|
||||||
|
"kick",
|
||||||
|
"punch",
|
||||||
|
"shield_bash"
|
||||||
|
],
|
||||||
|
"description": "Kick, Punch, or Shield Bash"
|
||||||
|
},
|
||||||
|
"skill_rolls": {
|
||||||
|
"type": "bonus_flat",
|
||||||
|
"amount": 1,
|
||||||
|
"target": "skill",
|
||||||
|
"description": "Add 1 to Skill Roll"
|
||||||
|
},
|
||||||
|
"ranged_defense": {
|
||||||
|
"type": "counter_attack",
|
||||||
|
"options": [
|
||||||
|
"kick",
|
||||||
|
"punch",
|
||||||
|
"shield_bash"
|
||||||
|
],
|
||||||
|
"description": "Kick, Punch, or Shield Bash"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"3": {
|
"3": {
|
||||||
"melee_attack": "Triple Damage",
|
"melee_attack": {
|
||||||
"ranged_attack": "Triple Damage",
|
"type": "damage_multiplier",
|
||||||
"melee_defense": "DR Tripled including Shield",
|
"multiplier": 3,
|
||||||
"arcane_spell_attack": "Triple Damage on Spell Damage",
|
"description": "Triple Damage"
|
||||||
"arcane_spell_defense": "D12 Added to Spell Defense Modifier",
|
},
|
||||||
"skill_rolls": "empty"
|
"ranged_attack": {
|
||||||
|
"type": "damage_multiplier",
|
||||||
|
"multiplier": 3,
|
||||||
|
"description": "Triple Damage"
|
||||||
|
},
|
||||||
|
"melee_defense": {
|
||||||
|
"type": "dr_multiplier",
|
||||||
|
"multiplier": 3,
|
||||||
|
"includes_shield": true,
|
||||||
|
"description": "DR Tripled including Shield"
|
||||||
|
},
|
||||||
|
"arcane_spell_attack": {
|
||||||
|
"type": "damage_multiplier",
|
||||||
|
"multiplier": 3,
|
||||||
|
"description": "Triple Damage on Spell Damage"
|
||||||
|
},
|
||||||
|
"arcane_spell_defense": {
|
||||||
|
"type": "bonus_dice",
|
||||||
|
"dice": "D12",
|
||||||
|
"target": "spell_defense",
|
||||||
|
"description": "D12 Added to Spell Defense Modifier"
|
||||||
|
},
|
||||||
|
"ranged_defense": {
|
||||||
|
"type": "dr_multiplier",
|
||||||
|
"multiplier": 3,
|
||||||
|
"includes_shield": true,
|
||||||
|
"description": "DR Tripled including Shield"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"2": {
|
"2": {
|
||||||
"melee_attack": "Double Damage",
|
"melee_attack": {
|
||||||
"ranged_attack": "Double Damage",
|
"type": "damage_multiplier",
|
||||||
"melee_defense": "DR Doubled including Shield",
|
"multiplier": 2,
|
||||||
"arcane_spell_attack": "Double Damage on Spell Damage",
|
"description": "Double Damage"
|
||||||
"arcane_spell_defense": "D6 Added to Spell Defense Modifier",
|
},
|
||||||
"skill_rolls": "empty"
|
"ranged_attack": {
|
||||||
|
"type": "damage_multiplier",
|
||||||
|
"multiplier": 2,
|
||||||
|
"description": "Double Damage"
|
||||||
|
},
|
||||||
|
"melee_defense": {
|
||||||
|
"type": "dr_multiplier",
|
||||||
|
"multiplier": 2,
|
||||||
|
"includes_shield": true,
|
||||||
|
"description": "DR Doubled including Shield"
|
||||||
|
},
|
||||||
|
"arcane_spell_attack": {
|
||||||
|
"type": "damage_multiplier",
|
||||||
|
"multiplier": 2,
|
||||||
|
"description": "Double Damage on Spell Damage"
|
||||||
|
},
|
||||||
|
"arcane_spell_defense": {
|
||||||
|
"type": "bonus_dice",
|
||||||
|
"dice": "D6",
|
||||||
|
"target": "spell_defense",
|
||||||
|
"description": "D6 Added to Spell Defense Modifier"
|
||||||
|
},
|
||||||
|
"ranged_defense": {
|
||||||
|
"type": "dr_multiplier",
|
||||||
|
"multiplier": 2,
|
||||||
|
"includes_shield": true,
|
||||||
|
"description": "DR Doubled including Shield"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"1": {
|
"1": {
|
||||||
"melee_attack": "empty",
|
"ranged_attack": {
|
||||||
"ranged_attack": "Possible Fumble Ranged ammo is broken unrecoverable",
|
"type": "fumble",
|
||||||
"melee_defense": "empty",
|
"detail": "ranged_ammo_broken",
|
||||||
"arcane_spell_attack": "Possible Spell Calamity or Catastrophe",
|
"description": "Possible Fumble Ranged ammo is broken unrecoverable"
|
||||||
"arcane_spell_defense": "empty",
|
},
|
||||||
"skill_rolls": "empty"
|
"arcane_spell_attack": {
|
||||||
|
"type": "spell_calamity",
|
||||||
|
"description": "Possible Spell Calamity or Catastrophe"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
|
|||||||
@@ -193,6 +193,7 @@ export const DICE_VALUES = {
|
|||||||
export const CHARACTERISTIC_ATTACK = ["str", "int", "wis", "dex"]
|
export const CHARACTERISTIC_ATTACK = ["str", "int", "wis", "dex"]
|
||||||
export const CHARACTERISTIC_RANGED_ATTACK = ["int", "wis", "dex"]
|
export const CHARACTERISTIC_RANGED_ATTACK = ["int", "wis", "dex"]
|
||||||
export const CHARACTERISTIC_DEFENSE = ["int", "wis", "dex"]
|
export const CHARACTERISTIC_DEFENSE = ["int", "wis", "dex"]
|
||||||
|
export const CHARACTERISTIC_RANGED_DEFENSE = ["int", "wis", "dex"]
|
||||||
export const CHARACTERISTIC_DAMAGE = ["str"]
|
export const CHARACTERISTIC_DAMAGE = ["str"]
|
||||||
|
|
||||||
export const DEFENSE_DICE_VALUES = {
|
export const DEFENSE_DICE_VALUES = {
|
||||||
@@ -304,6 +305,7 @@ export const SYSTEM = {
|
|||||||
CHARACTERISTIC_ATTACK,
|
CHARACTERISTIC_ATTACK,
|
||||||
CHARACTERISTIC_RANGED_ATTACK,
|
CHARACTERISTIC_RANGED_ATTACK,
|
||||||
CHARACTERISTIC_DEFENSE,
|
CHARACTERISTIC_DEFENSE,
|
||||||
|
CHARACTERISTIC_RANGED_DEFENSE,
|
||||||
CHARACTERISTIC_DAMAGE,
|
CHARACTERISTIC_DAMAGE,
|
||||||
INITIATIVE_DICE_CHOICES_PER_CLASS,
|
INITIATIVE_DICE_CHOICES_PER_CLASS,
|
||||||
CHAR_CLASSES,
|
CHAR_CLASSES,
|
||||||
|
|||||||
@@ -198,6 +198,22 @@ export default class LethalFantasyActor extends Actor {
|
|||||||
case "miracle-power":
|
case "miracle-power":
|
||||||
rollTarget = this.items.find((i) => (i.type === "miracle" || i.type == "spell") && i.id === rollKey)
|
rollTarget = this.items.find((i) => (i.type === "miracle" || i.type == "spell") && i.id === rollKey)
|
||||||
rollTarget.rollKey = rollKey
|
rollTarget.rollKey = rollKey
|
||||||
|
if (rollType === "spell-attack" || rollType === "spell-power") {
|
||||||
|
const cost = Number(rollTarget.system?.cost) || 0
|
||||||
|
const currentAether = Number(this.system.aetherPoints?.value) || 0
|
||||||
|
if (cost > currentAether) {
|
||||||
|
ui.notifications.warn(`${this.name} cannot cast ${rollTarget.name}: insufficient Aether (needs ${cost}, has ${currentAether}).`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rollType === "miracle-attack" || rollType === "miracle-power") {
|
||||||
|
const cost = Number(rollTarget.system?.level) || 0
|
||||||
|
const currentGrace = Number(this.system.divinityPoints?.value) || 0
|
||||||
|
if (cost > currentGrace) {
|
||||||
|
ui.notifications.warn(`${this.name} cannot invoke ${rollTarget.name}: insufficient Grace (needs ${cost}, has ${currentGrace}).`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
break
|
break
|
||||||
case "shield-roll": {
|
case "shield-roll": {
|
||||||
rollTarget = this.items.find((i) => i.type === "shield" && i.id === rollKey)
|
rollTarget = this.items.find((i) => i.type === "shield" && i.id === rollKey)
|
||||||
@@ -256,6 +272,8 @@ export default class LethalFantasyActor extends Actor {
|
|||||||
if (rollType === "weapon-defense") {
|
if (rollType === "weapon-defense") {
|
||||||
rollTarget.armorDefense = this.getArmorDefenseValue()
|
rollTarget.armorDefense = this.getArmorDefenseValue()
|
||||||
rollTarget.grantedDice = this.system.granted.defenseDice
|
rollTarget.grantedDice = this.system.granted.defenseDice
|
||||||
|
// Check if this is a ranged defense
|
||||||
|
rollTarget.isRangedDefense = game.lethalFantasy?.nextDefenseData?.isRanged ?? false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export default class D30Roll {
|
|||||||
MELEE_ATTACK: "melee_attack",
|
MELEE_ATTACK: "melee_attack",
|
||||||
RANGED_ATTACK: "ranged_attack",
|
RANGED_ATTACK: "ranged_attack",
|
||||||
MELEE_DEFENSE: "melee_defense",
|
MELEE_DEFENSE: "melee_defense",
|
||||||
|
RANGED_DEFENSE: "ranged_defense",
|
||||||
ARCANE_SPELL_ATTACK: "arcane_spell_attack",
|
ARCANE_SPELL_ATTACK: "arcane_spell_attack",
|
||||||
ARCANE_SPELL_DEFENSE: "arcane_spell_defense",
|
ARCANE_SPELL_DEFENSE: "arcane_spell_defense",
|
||||||
SKILL_ROLLS: "skill_rolls"
|
SKILL_ROLLS: "skill_rolls"
|
||||||
@@ -47,26 +48,26 @@ export default class D30Roll {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Récupère le résultat d'un jet de D30
|
* Récupère le résultat d'un jet de D30 sous forme d'objet structuré.
|
||||||
* @param {number} diceValue La valeur du dé (1-30)
|
* @param {number} diceValue La valeur du dé (1-30)
|
||||||
* @param {string} rollType Le type de jet externe (ex: "weapon-attack", "spell-attack", etc.)
|
* @param {string} rollType Le type de jet externe (ex: "weapon-attack", "spell-attack", etc.)
|
||||||
* @param {Object} weapon L'arme ou l'objet utilisé (optionnel, nécessaire pour certains types)
|
* @param {Object} weapon L'arme ou l'objet utilisé (optionnel, nécessaire pour certains types)
|
||||||
* @returns {string|null} Le résultat correspondant ou null si vide/non trouvé
|
* @param {Object} options Options supplémentaires (optionnel)
|
||||||
|
* @param {boolean} options.isRanged Si true, utilise ranged_defense au lieu de melee_defense
|
||||||
|
* @returns {Object|null} L'objet effet `{ type, description, ...fields }` ou null si aucun effet
|
||||||
*/
|
*/
|
||||||
static getResult(diceValue, rollType, weapon = null) {
|
static getResult(diceValue, rollType, weapon = null, options = {}) {
|
||||||
if (!this.resultsTable) {
|
if (!this.resultsTable) {
|
||||||
console.warn("D30Roll | Results table is not initialized. Call D30Roll.initialize() first.")
|
console.warn("D30Roll | Results table is not initialized. Call D30Roll.initialize() first.")
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validation des paramètres
|
|
||||||
if (diceValue < 1 || diceValue > 30) {
|
if (diceValue < 1 || diceValue > 30) {
|
||||||
console.warn(`D30Roll | Invalid dice value: ${diceValue}. Must be between 1 and 30.`)
|
console.warn(`D30Roll | Invalid dice value: ${diceValue}. Must be between 1 and 30.`)
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert external rollType to internal rollType
|
const internalType = this.convertToInternalType(rollType, weapon, options)
|
||||||
const internalType = this.convertToInternalType(rollType, weapon)
|
|
||||||
|
|
||||||
if (!internalType) {
|
if (!internalType) {
|
||||||
console.warn(`D30Roll | Could not convert roll type: ${rollType}`)
|
console.warn(`D30Roll | Could not convert roll type: ${rollType}`)
|
||||||
@@ -85,22 +86,27 @@ export default class D30Roll {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const result = resultEntry[internalType]
|
const result = resultEntry[internalType]
|
||||||
|
return result ?? null
|
||||||
|
}
|
||||||
|
|
||||||
// Retourne null si le résultat est "empty"
|
/**
|
||||||
if (result === "empty" || !result) {
|
* Retourne le type d'effet d'un résultat D30.
|
||||||
return null
|
* @param {Object|null} result L'objet retourné par getResult()
|
||||||
}
|
* @returns {string|null} Le type d'effet ou null
|
||||||
|
*/
|
||||||
return result
|
static getEffectType(result) {
|
||||||
|
return result?.type ?? null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convertit un rollType externe en rollType interne
|
* Convertit un rollType externe en rollType interne
|
||||||
* @param {string} externalType Le type de jet externe (ex: "weapon-attack")
|
* @param {string} externalType Le type de jet externe (ex: "weapon-attack")
|
||||||
* @param {Object} weapon L'arme ou l'objet utilisé (optionnel)
|
* @param {Object} weapon L'arme ou l'objet utilisé (optionnel)
|
||||||
|
* @param {Object} options Options supplémentaires (optionnel)
|
||||||
|
* @param {boolean} options.isRanged Si true, utilise ranged_defense au lieu de melee_defense
|
||||||
* @returns {string|null} Le type interne correspondant ou null
|
* @returns {string|null} Le type interne correspondant ou null
|
||||||
*/
|
*/
|
||||||
static convertToInternalType(externalType, weapon = null) {
|
static convertToInternalType(externalType, weapon = null, options = {}) {
|
||||||
// Attack types - need weapon to determine if melee or ranged
|
// Attack types - need weapon to determine if melee or ranged
|
||||||
if (externalType === "weapon-attack") {
|
if (externalType === "weapon-attack") {
|
||||||
if (!weapon) {
|
if (!weapon) {
|
||||||
@@ -123,7 +129,7 @@ export default class D30Roll {
|
|||||||
|
|
||||||
// Defense types
|
// Defense types
|
||||||
if (externalType === "weapon-defense" || externalType === "monster-defense") {
|
if (externalType === "weapon-defense" || externalType === "monster-defense") {
|
||||||
return this.ROLL_TYPES.MELEE_DEFENSE
|
return options.isRanged ? this.ROLL_TYPES.RANGED_DEFENSE : this.ROLL_TYPES.MELEE_DEFENSE
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spell types
|
// Spell types
|
||||||
@@ -177,11 +183,11 @@ export default class D30Roll {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Vérifie si un résultat est vide
|
* Vérifie si un résultat est vide
|
||||||
* @param {string} result Le résultat à vérifier
|
* @param {Object|null} result Le résultat à vérifier
|
||||||
* @returns {boolean} True si le résultat est vide
|
* @returns {boolean} True si le résultat est vide
|
||||||
*/
|
*/
|
||||||
static isEmptyResult(result) {
|
static isEmptyResult(result) {
|
||||||
return !result || result === "empty"
|
return !result || !result.type
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -189,11 +195,12 @@ export default class D30Roll {
|
|||||||
* @param {number} diceValue La valeur du dé (1-30)
|
* @param {number} diceValue La valeur du dé (1-30)
|
||||||
* @param {string} rollType Le type de jet externe
|
* @param {string} rollType Le type de jet externe
|
||||||
* @param {Object} weapon L'arme ou l'objet utilisé (optionnel)
|
* @param {Object} weapon L'arme ou l'objet utilisé (optionnel)
|
||||||
|
* @param {Object} options Options supplémentaires (optionnel)
|
||||||
* @returns {Object} Un objet avec le résultat et des informations de formatage
|
* @returns {Object} Un objet avec le résultat et des informations de formatage
|
||||||
*/
|
*/
|
||||||
static getFormattedResult(diceValue, rollType, weapon = null) {
|
static getFormattedResult(diceValue, rollType, weapon = null, options = {}) {
|
||||||
const result = this.getResult(diceValue, rollType, weapon)
|
const result = this.getResult(diceValue, rollType, weapon, options)
|
||||||
const internalType = this.convertToInternalType(rollType, weapon)
|
const internalType = this.convertToInternalType(rollType, weapon, options)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
value: diceValue,
|
value: diceValue,
|
||||||
|
|||||||
+35
-14
@@ -182,6 +182,7 @@ export default class LethalFantasyRoll extends Roll {
|
|||||||
} else {
|
} else {
|
||||||
options.rollTarget.value = options.rollTarget.defenseModifier
|
options.rollTarget.value = options.rollTarget.defenseModifier
|
||||||
options.rollTarget.charModifier = 0
|
options.rollTarget.charModifier = 0
|
||||||
|
options.isRangedDefense = options.rollTarget.isRangedDefense ?? false
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (options.rollType === "monster-skill") {
|
} else if (options.rollType === "monster-skill") {
|
||||||
@@ -219,8 +220,14 @@ export default class LethalFantasyRoll extends Roll {
|
|||||||
options.rollTarget.charModifier = options.rollTarget.combat.rangedAttackModifier
|
options.rollTarget.charModifier = options.rollTarget.combat.rangedAttackModifier
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
options.rollTarget.value = options.rollTarget.combat.defenseModifier + options.rollTarget.weaponSkillModifier + options.rollTarget.weapon.system.bonuses.defenseBonus + options.rollTarget.armorDefense
|
// For defense, check if it's a ranged defense
|
||||||
options.rollTarget.charModifier = options.rollTarget.combat.defenseModifier
|
const defenseModifier = options.rollTarget.isRangedDefense
|
||||||
|
? options.rollTarget.combat.rangedDefenseModifier
|
||||||
|
: options.rollTarget.combat.defenseModifier
|
||||||
|
options.rollTarget.value = defenseModifier + options.rollTarget.weaponSkillModifier + options.rollTarget.weapon.system.bonuses.defenseBonus + options.rollTarget.armorDefense
|
||||||
|
options.rollTarget.charModifier = defenseModifier
|
||||||
|
// Store isRanged flag for D30 lookup
|
||||||
|
options.isRangedDefense = options.rollTarget.isRangedDefense
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (options.rollType === "spell" || options.rollType === "spell-attack" || options.rollType === "spell-power") {
|
} else if (options.rollType === "spell" || options.rollType === "spell-attack" || options.rollType === "spell-power") {
|
||||||
@@ -265,6 +272,7 @@ export default class LethalFantasyRoll extends Roll {
|
|||||||
hasChangeDice = false
|
hasChangeDice = false
|
||||||
hasMaxValue = false
|
hasMaxValue = false
|
||||||
hasExplode = false
|
hasExplode = false
|
||||||
|
hasFavor = true
|
||||||
options.rollTarget.value = 0
|
options.rollTarget.value = 0
|
||||||
|
|
||||||
} else if (options.rollType.includes("weapon-damage")) {
|
} else if (options.rollType.includes("weapon-damage")) {
|
||||||
@@ -282,7 +290,11 @@ export default class LethalFantasyRoll extends Roll {
|
|||||||
options.damageMedium = true
|
options.damageMedium = true
|
||||||
dice = options.rollTarget.weapon.system.damage.damageM
|
dice = options.rollTarget.weapon.system.damage.damageM
|
||||||
}
|
}
|
||||||
dice = dice.replace("E", "")
|
if (/NE$/i.test(dice)) {
|
||||||
|
hasMaxValue = false
|
||||||
|
hasExplode = false
|
||||||
|
}
|
||||||
|
dice = dice.replace(/NE$/i, "").replace("E", "")
|
||||||
baseFormula = dice
|
baseFormula = dice
|
||||||
|
|
||||||
} else if (options.rollType.includes("monster-damage")) {
|
} else if (options.rollType.includes("monster-damage")) {
|
||||||
@@ -295,6 +307,10 @@ export default class LethalFantasyRoll extends Roll {
|
|||||||
dice = options.rollTarget.damageDice
|
dice = options.rollTarget.damageDice
|
||||||
dice = dice.replace("E", "")
|
dice = dice.replace("E", "")
|
||||||
baseFormula = dice
|
baseFormula = dice
|
||||||
|
if (options.rollTarget.noExplode) {
|
||||||
|
hasMaxValue = false
|
||||||
|
hasExplode = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -304,7 +320,7 @@ export default class LethalFantasyRoll extends Roll {
|
|||||||
hasModifier = false
|
hasModifier = false
|
||||||
}
|
}
|
||||||
|
|
||||||
const rollModes = foundry.utils.duplicate(CONFIG.Dice.rollModes); // v12 : Object.fromEntries(Object.entries(CONFIG.Dice.rollModes).map(([key, value]) => [key, game.i18n.localize(value)]))
|
const rollModes = foundry.utils.duplicate(CONFIG.ChatMessage.modes);
|
||||||
console.log("Roll mode", rollModes)
|
console.log("Roll mode", rollModes)
|
||||||
|
|
||||||
const fieldRollMode = new foundry.data.fields.StringField({
|
const fieldRollMode = new foundry.data.fields.StringField({
|
||||||
@@ -490,7 +506,8 @@ export default class LethalFantasyRoll extends Roll {
|
|||||||
rollContext.favor = "none"
|
rollContext.favor = "none"
|
||||||
}
|
}
|
||||||
|
|
||||||
maxValue = Number(baseFormula.match(/\d+$/)[0]) // Update the max value agains
|
const maxMatch = baseFormula ? baseFormula.match(/\d+$/) : null
|
||||||
|
maxValue = maxMatch ? Number(maxMatch[0]) : 0
|
||||||
|
|
||||||
const rollData = {
|
const rollData = {
|
||||||
type: options.rollType,
|
type: options.rollType,
|
||||||
@@ -577,7 +594,8 @@ export default class LethalFantasyRoll extends Roll {
|
|||||||
const d30Message = D30Roll.getResult(
|
const d30Message = D30Roll.getResult(
|
||||||
rollD30.total,
|
rollD30.total,
|
||||||
options.rollType,
|
options.rollType,
|
||||||
options.rollTarget?.weapon
|
options.rollTarget?.weapon,
|
||||||
|
{ isRanged: options.isRangedDefense }
|
||||||
)
|
)
|
||||||
options.D30message = d30Message
|
options.D30message = d30Message
|
||||||
}
|
}
|
||||||
@@ -658,7 +676,7 @@ export default class LethalFantasyRoll extends Roll {
|
|||||||
|
|
||||||
/* ***********************************************************/
|
/* ***********************************************************/
|
||||||
static async promptInitiative(options = {}) {
|
static async promptInitiative(options = {}) {
|
||||||
const rollModes = foundry.utils.duplicate(CONFIG.Dice.rollModes); // v12 : Object.fromEntries(Object.entries(CONFIG.Dice.rollModes).map(([key, value]) => [key, game.i18n.localize(value)]))
|
const rollModes = foundry.utils.duplicate(CONFIG.ChatMessage.modes); // v12 : Object.fromEntries(Object.entries(CONFIG.Dice.rollModes).map(([key, value]) => [key, game.i18n.localize(value)]))
|
||||||
const fieldRollMode = new foundry.data.fields.StringField({
|
const fieldRollMode = new foundry.data.fields.StringField({
|
||||||
choices: rollModes,
|
choices: rollModes,
|
||||||
blank: false,
|
blank: false,
|
||||||
@@ -712,7 +730,7 @@ export default class LethalFantasyRoll extends Roll {
|
|||||||
|
|
||||||
let initRoll = new Roll(formula, options.data)
|
let initRoll = new Roll(formula, options.data)
|
||||||
await initRoll.evaluate()
|
await initRoll.evaluate()
|
||||||
let msg = await initRoll.toMessage({ flavor: `Initiative for ${options.actorName}` }, { rollMode: rollContext.visibility })
|
let msg = await initRoll.toMessage({ flavor: `Initiative for ${options.actorName}` }, { messageMode: rollContext.visibility })
|
||||||
if (game?.dice3d && initRoll.dice?.length) {
|
if (game?.dice3d && initRoll.dice?.length) {
|
||||||
await game.dice3d.waitFor3DAnimationByMessageID(msg.id)
|
await game.dice3d.waitFor3DAnimationByMessageID(msg.id)
|
||||||
}
|
}
|
||||||
@@ -726,7 +744,7 @@ export default class LethalFantasyRoll extends Roll {
|
|||||||
/* ***********************************************************/
|
/* ***********************************************************/
|
||||||
static async promptCombatAction(options = {}) {
|
static async promptCombatAction(options = {}) {
|
||||||
|
|
||||||
const rollModes = foundry.utils.duplicate(CONFIG.Dice.rollModes); // v12 : Object.fromEntries(Object.entries(CONFIG.Dice.rollModes).map(([key, value]) => [key, game.i18n.localize(value)]))
|
const rollModes = foundry.utils.duplicate(CONFIG.ChatMessage.modes); // v12 : Object.fromEntries(Object.entries(CONFIG.Dice.rollModes).map(([key, value]) => [key, game.i18n.localize(value)]))
|
||||||
const fieldRollMode = new foundry.data.fields.StringField({
|
const fieldRollMode = new foundry.data.fields.StringField({
|
||||||
choices: rollModes,
|
choices: rollModes,
|
||||||
blank: false,
|
blank: false,
|
||||||
@@ -983,7 +1001,7 @@ export default class LethalFantasyRoll extends Roll {
|
|||||||
|
|
||||||
let max = roll.dice[0].faces - 1
|
let max = roll.dice[0].faces - 1
|
||||||
max = Math.min(currentAction.progressionCount, max)
|
max = Math.min(currentAction.progressionCount, max)
|
||||||
let msg = await roll.toMessage({ flavor: `Progression Roll for ${currentAction.name}, progression count : ${currentAction.progressionCount}/${max}` }, { rollMode: rollContext.visibility })
|
let msg = await roll.toMessage({ flavor: `Progression Roll for ${currentAction.name}, progression count : ${currentAction.progressionCount}/${max}` }, { messageMode: rollContext.visibility })
|
||||||
if (game?.dice3d) {
|
if (game?.dice3d) {
|
||||||
await game.dice3d.waitFor3DAnimationByMessageID(msg.id)
|
await game.dice3d.waitFor3DAnimationByMessageID(msg.id)
|
||||||
}
|
}
|
||||||
@@ -1025,7 +1043,7 @@ export default class LethalFantasyRoll extends Roll {
|
|||||||
/* ***********************************************************/
|
/* ***********************************************************/
|
||||||
static async promptRangedDefense(options = {}) {
|
static async promptRangedDefense(options = {}) {
|
||||||
|
|
||||||
const rollModes = foundry.utils.duplicate(CONFIG.Dice.rollModes);
|
const rollModes = foundry.utils.duplicate(CONFIG.ChatMessage.modes);
|
||||||
const fieldRollMode = new foundry.data.fields.StringField({
|
const fieldRollMode = new foundry.data.fields.StringField({
|
||||||
choices: rollModes,
|
choices: rollModes,
|
||||||
blank: false,
|
blank: false,
|
||||||
@@ -1105,6 +1123,7 @@ export default class LethalFantasyRoll extends Roll {
|
|||||||
// Merge rollContext object into options object
|
// Merge rollContext object into options object
|
||||||
options = { ...options, ...rollContext }
|
options = { ...options, ...rollContext }
|
||||||
options.rollName = "Ranged Defense"
|
options.rollName = "Ranged Defense"
|
||||||
|
options.rollType = "weapon-defense"
|
||||||
|
|
||||||
const rollBase = new this(rollContext.movement, options.data, rollData)
|
const rollBase = new this(rollContext.movement, options.data, rollData)
|
||||||
const rollModifier = new Roll(modifierFormula, options.data, rollData)
|
const rollModifier = new Roll(modifierFormula, options.data, rollData)
|
||||||
@@ -1112,6 +1131,7 @@ export default class LethalFantasyRoll extends Roll {
|
|||||||
await rollBase.evaluate()
|
await rollBase.evaluate()
|
||||||
let rollD30 = await new Roll("1D30").evaluate()
|
let rollD30 = await new Roll("1D30").evaluate()
|
||||||
options.D30result = rollD30.total
|
options.D30result = rollD30.total
|
||||||
|
options.D30message = D30Roll.getResult(rollD30.total, options.rollType, options.rollTarget?.weapon, { isRanged: true })
|
||||||
|
|
||||||
let badResult = 0
|
let badResult = 0
|
||||||
if (rollContext.movement.includes("kh")) {
|
if (rollContext.movement.includes("kh")) {
|
||||||
@@ -1154,6 +1174,7 @@ export default class LethalFantasyRoll extends Roll {
|
|||||||
rollBase.options.rollTarget = options.rollTarget
|
rollBase.options.rollTarget = options.rollTarget
|
||||||
rollBase.options.titleFormula = `1D20E + ${modifierFormula}`
|
rollBase.options.titleFormula = `1D20E + ${modifierFormula}`
|
||||||
rollBase.options.D30result = options.D30result
|
rollBase.options.D30result = options.D30result
|
||||||
|
rollBase.options.D30message = options.D30message
|
||||||
rollBase.options.rollName = "Ranged Defense"
|
rollBase.options.rollName = "Ranged Defense"
|
||||||
rollBase.options.badResult = badResult
|
rollBase.options.badResult = badResult
|
||||||
rollBase.options.rollData = foundry.utils.duplicate(rollData)
|
rollBase.options.rollData = foundry.utils.duplicate(rollData)
|
||||||
@@ -1311,11 +1332,11 @@ export default class LethalFantasyRoll extends Roll {
|
|||||||
*
|
*
|
||||||
* @param {Object} [messageData={}] Additional data to include in the message.
|
* @param {Object} [messageData={}] Additional data to include in the message.
|
||||||
* @param {Object} options Options for message creation.
|
* @param {Object} options Options for message creation.
|
||||||
* @param {string} options.rollMode The mode of the roll (e.g., public, private).
|
* @param {string} options.messageMode The mode of the roll (e.g., public, private).
|
||||||
* @param {boolean} [options.create=true] Whether to create the message.
|
* @param {boolean} [options.create=true] Whether to create the message.
|
||||||
* @returns {Promise} - A promise that resolves when the message is created.
|
* @returns {Promise} - A promise that resolves when the message is created.
|
||||||
*/
|
*/
|
||||||
async toMessage(messageData = {}, { rollMode, create = true } = {}) {
|
async toMessage(messageData = {}, { messageMode, create = true } = {}) {
|
||||||
return await super.toMessage(
|
return await super.toMessage(
|
||||||
{
|
{
|
||||||
isSave: this.isSave,
|
isSave: this.isSave,
|
||||||
@@ -1333,7 +1354,7 @@ export default class LethalFantasyRoll extends Roll {
|
|||||||
rollData: this.rollData,
|
rollData: this.rollData,
|
||||||
...messageData,
|
...messageData,
|
||||||
},
|
},
|
||||||
{ rollMode, create },
|
{ messageMode, create },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
|
|||||||
attackModifier: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
attackModifier: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||||
rangedAttackModifier: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
rangedAttackModifier: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||||
defenseModifier: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
defenseModifier: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||||
|
rangedDefenseModifier: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||||
defenseBonus: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
defenseBonus: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||||
damageModifier: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
damageModifier: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||||
armorHitPoints: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
armorHitPoints: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||||
@@ -259,6 +260,12 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
|
|||||||
this.combat.defenseModifier += chaDef.defense
|
this.combat.defenseModifier += chaDef.defense
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.combat.rangedDefenseModifier = this.combat.defenseBonus
|
||||||
|
for (let chaKey of SYSTEM.CHARACTERISTIC_RANGED_DEFENSE) {
|
||||||
|
let chaDef = SYSTEM.CHARACTERISTICS_TABLES[chaKey].find(s => s.value === this.characteristics[chaKey].value)
|
||||||
|
this.combat.rangedDefenseModifier += chaDef.defense
|
||||||
|
}
|
||||||
|
|
||||||
this.combat.damageModifier = 0
|
this.combat.damageModifier = 0
|
||||||
for (let chaKey of SYSTEM.CHARACTERISTIC_DAMAGE) {
|
for (let chaKey of SYSTEM.CHARACTERISTIC_DAMAGE) {
|
||||||
let chaDef = SYSTEM.CHARACTERISTICS_TABLES[chaKey].find(s => s.value === this.characteristics[chaKey].value)
|
let chaDef = SYSTEM.CHARACTERISTICS_TABLES[chaKey].find(s => s.value === this.characteristics[chaKey].value)
|
||||||
@@ -290,7 +297,7 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
|
|||||||
})
|
})
|
||||||
if (!roll) return null
|
if (!roll) return null
|
||||||
|
|
||||||
await roll.toMessage({}, { rollMode: roll.options.rollMode })
|
await roll.toMessage({}, { messageMode: roll.options.rollMode })
|
||||||
}
|
}
|
||||||
|
|
||||||
async rollInitiative(combatId = undefined, combatantId = undefined) {
|
async rollInitiative(combatId = undefined, combatantId = undefined) {
|
||||||
@@ -311,7 +318,7 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
|
|||||||
})
|
})
|
||||||
if (!roll) return null
|
if (!roll) return null
|
||||||
|
|
||||||
await roll.toMessage({}, { rollMode: roll.options.rollMode })
|
await roll.toMessage({}, { messageMode: roll.options.rollMode })
|
||||||
}
|
}
|
||||||
|
|
||||||
async rollProgressionDice(combatId, combatantId, rollProgressionCount) {
|
async rollProgressionDice(combatId, combatantId, rollProgressionCount) {
|
||||||
|
|||||||
+41
-11
@@ -64,7 +64,7 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
|
|||||||
painDamage: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
|
painDamage: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
|
||||||
})
|
})
|
||||||
|
|
||||||
const attackField = (label) => {
|
const attackField = (label, initialNoExplode = false) => {
|
||||||
const schema = {
|
const schema = {
|
||||||
key: new fields.StringField({ required: true, nullable: false, initial: `attack${label}` }),
|
key: new fields.StringField({ required: true, nullable: false, initial: `attack${label}` }),
|
||||||
name: new fields.StringField({ required: true, nullable: false, initial: `Attack ${label}` }),
|
name: new fields.StringField({ required: true, nullable: false, initial: `Attack ${label}` }),
|
||||||
@@ -74,6 +74,7 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
|
|||||||
damageDice: new fields.StringField({ required: true, nullable: false, initial: "1D6" }),
|
damageDice: new fields.StringField({ required: true, nullable: false, initial: "1D6" }),
|
||||||
damageModifier: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
damageModifier: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||||
enabled: new fields.BooleanField({ initial: true, required: true, nullable: false }),
|
enabled: new fields.BooleanField({ initial: true, required: true, nullable: false }),
|
||||||
|
noExplode: new fields.BooleanField({ initial: initialNoExplode, required: true, nullable: false }),
|
||||||
}
|
}
|
||||||
return new fields.SchemaField(schema, { label })
|
return new fields.SchemaField(schema, { label })
|
||||||
}
|
}
|
||||||
@@ -123,10 +124,32 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
|
|||||||
shieldDefenseDice: new fields.StringField({ required: true, nullable: false, initial: "d4" })
|
shieldDefenseDice: new fields.StringField({ required: true, nullable: false, initial: "d4" })
|
||||||
})
|
})
|
||||||
schema.combatHTH = new fields.SchemaField({
|
schema.combatHTH = new fields.SchemaField({
|
||||||
attack1: attackField("1"),
|
attack1: attackField("1", true),
|
||||||
attack2: attackField("2")
|
attack2: attackField("2", true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
schema.attackMode = new fields.StringField({
|
||||||
|
required: true,
|
||||||
|
nullable: false,
|
||||||
|
initial: "melee",
|
||||||
|
choices: { melee: "Melee", ranged: "Ranged" }
|
||||||
|
})
|
||||||
|
|
||||||
|
schema.rangedAttacks = new fields.SchemaField({
|
||||||
|
attack1: attackField("1"),
|
||||||
|
attack2: attackField("2"),
|
||||||
|
attack3: attackField("3"),
|
||||||
|
attack4: attackField("4")
|
||||||
|
})
|
||||||
|
|
||||||
|
schema.rangedWeaponRange = new fields.SchemaField({
|
||||||
|
pointBlank: new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 }),
|
||||||
|
short: new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 }),
|
||||||
|
medium: new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 }),
|
||||||
|
long: new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 }),
|
||||||
|
extreme: new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 }),
|
||||||
|
outOfSkill: new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
|
||||||
|
})
|
||||||
|
|
||||||
return schema
|
return schema
|
||||||
}
|
}
|
||||||
@@ -157,7 +180,7 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
|
|||||||
})
|
})
|
||||||
if (!roll) return null
|
if (!roll) return null
|
||||||
|
|
||||||
await roll.toMessage({}, { rollMode: roll.options.rollMode })
|
await roll.toMessage({}, { messageMode: roll.options.rollMode })
|
||||||
}
|
}
|
||||||
|
|
||||||
async prepareMonsterRoll(rollType, rollKey, rollDice = undefined, tokenId = undefined, damageModifier = undefined, defenderId = undefined, defenderTokenId = undefined, extraShieldDr = 0) {
|
async prepareMonsterRoll(rollType, rollKey, rollDice = undefined, tokenId = undefined, damageModifier = undefined, defenderId = undefined, defenderTokenId = undefined, extraShieldDr = 0) {
|
||||||
@@ -165,14 +188,20 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
|
|||||||
switch (rollType) {
|
switch (rollType) {
|
||||||
case "monster-attack":
|
case "monster-attack":
|
||||||
case "monster-defense":
|
case "monster-defense":
|
||||||
case "monster-damage":
|
case "monster-damage": {
|
||||||
rollTarget = foundry.utils.duplicate(this.attacks[rollKey])
|
const attacksSet = this.attackMode === "ranged" ? this.rangedAttacks : this.attacks
|
||||||
|
rollTarget = foundry.utils.duplicate(attacksSet[rollKey])
|
||||||
rollTarget.rollKey = rollKey
|
rollTarget.rollKey = rollKey
|
||||||
|
rollTarget.attackMode = this.attackMode
|
||||||
|
if (rollType === "monster-defense") {
|
||||||
|
rollTarget.isRangedDefense = game.lethalFantasy?.nextDefenseData?.isRanged ?? false
|
||||||
|
}
|
||||||
// Si damageModifier est fourni (depuis le chat), l'utiliser au lieu de celui de la fiche
|
// Si damageModifier est fourni (depuis le chat), l'utiliser au lieu de celui de la fiche
|
||||||
if (damageModifier !== undefined && rollType === "monster-damage") {
|
if (damageModifier !== undefined && rollType === "monster-damage") {
|
||||||
rollTarget.damageModifier = damageModifier
|
rollTarget.damageModifier = damageModifier
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
}
|
||||||
case "monster-attack-hth":
|
case "monster-attack-hth":
|
||||||
case "monster-defense-hth":
|
case "monster-defense-hth":
|
||||||
case "monster-damage-hth":
|
case "monster-damage-hth":
|
||||||
@@ -241,7 +270,7 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
rollTarget = skill
|
rollTarget = skill
|
||||||
rollTarget.weapon = weapon
|
rollTarget.weapon = foundry.utils.duplicate(weapon)
|
||||||
rollTarget.weaponSkillModifier = skill.weaponSkillModifier
|
rollTarget.weaponSkillModifier = skill.weaponSkillModifier
|
||||||
rollTarget.rollKey = rollKey
|
rollTarget.rollKey = rollKey
|
||||||
rollTarget.combat = foundry.utils.duplicate(this.combat)
|
rollTarget.combat = foundry.utils.duplicate(this.combat)
|
||||||
@@ -276,7 +305,7 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
|
|||||||
})
|
})
|
||||||
if (!roll) return null
|
if (!roll) return null
|
||||||
|
|
||||||
await roll.toMessage({}, { rollMode: roll.options.rollMode })
|
await roll.toMessage({}, { messageMode: roll.options.rollMode })
|
||||||
}
|
}
|
||||||
|
|
||||||
async rollProgressionDice(combatId, combatantId) {
|
async rollProgressionDice(combatId, combatantId) {
|
||||||
@@ -288,7 +317,7 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const rollModes = foundry.utils.duplicate(CONFIG.Dice.rollModes)
|
const rollModes = foundry.utils.duplicate(CONFIG.ChatMessage.modes)
|
||||||
const fieldRollMode = new foundry.data.fields.StringField({
|
const fieldRollMode = new foundry.data.fields.StringField({
|
||||||
choices: rollModes,
|
choices: rollModes,
|
||||||
blank: false,
|
blank: false,
|
||||||
@@ -304,8 +333,9 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
let hasAttack = false
|
let hasAttack = false
|
||||||
for (let key in this.attacks) {
|
const attacksSet = this.attackMode === "ranged" ? this.rangedAttacks : this.attacks
|
||||||
let attack = this.attacks[key]
|
for (let key in attacksSet) {
|
||||||
|
let attack = attacksSet[key]
|
||||||
if (attack.enabled && attack.attackScore > 0 && attack.attackScore === roll.total) {
|
if (attack.enabled && attack.attackScore > 0 && attack.attackScore === roll.total) {
|
||||||
hasAttack = true
|
hasAttack = true
|
||||||
const messageContent = await foundry.applications.handlebars.renderTemplate(
|
const messageContent = await foundry.applications.handlebars.renderTemplate(
|
||||||
|
|||||||
+54
-13
@@ -304,7 +304,8 @@ export default class LethalFantasyUtils {
|
|||||||
|
|
||||||
// Pour les monstres, récupérer les attaques activées
|
// Pour les monstres, récupérer les attaques activées
|
||||||
if (isMonster) {
|
if (isMonster) {
|
||||||
const enabledAttacks = Object.entries(defender.system.attacks).filter(([key, attack]) => attack.enabled)
|
const attacksSet = defender.system.attackMode === "ranged" ? defender.system.rangedAttacks : defender.system.attacks
|
||||||
|
const enabledAttacks = Object.entries(attacksSet).filter(([key, attack]) => attack.enabled)
|
||||||
|
|
||||||
if (enabledAttacks.length === 0) {
|
if (enabledAttacks.length === 0) {
|
||||||
ui.notifications.warn("No enabled attacks available for defense")
|
ui.notifications.warn("No enabled attacks available for defense")
|
||||||
@@ -333,7 +334,7 @@ export default class LethalFantasyUtils {
|
|||||||
|
|
||||||
// Afficher le dialogue
|
// Afficher le dialogue
|
||||||
const result = await foundry.applications.api.DialogV2.wait({
|
const result = await foundry.applications.api.DialogV2.wait({
|
||||||
window: { title: "Defense Roll" },
|
window: { title: msg.isRanged ? "Ranged Defense Roll" : "Defense Roll" },
|
||||||
classes: ["lethalfantasy"],
|
classes: ["lethalfantasy"],
|
||||||
content,
|
content,
|
||||||
buttons: [
|
buttons: [
|
||||||
@@ -365,7 +366,8 @@ export default class LethalFantasyUtils {
|
|||||||
attackD30message,
|
attackD30message,
|
||||||
attackRerollContext,
|
attackRerollContext,
|
||||||
defenderId: defender.id,
|
defenderId: defender.id,
|
||||||
defenderTokenId
|
defenderTokenId,
|
||||||
|
isRanged: msg.isRanged
|
||||||
}
|
}
|
||||||
|
|
||||||
defender.system.prepareMonsterRoll("monster-defense", result)
|
defender.system.prepareMonsterRoll("monster-defense", result)
|
||||||
@@ -373,6 +375,37 @@ export default class LethalFantasyUtils {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pour les personnages, récupérer les armes équipées
|
||||||
|
// Si l'attaque est une attaque à distance, utiliser le dialogue de défense à distance
|
||||||
|
if (msg.isRanged) {
|
||||||
|
const { default: LethalFantasyRoll } = await import("./documents/roll.mjs")
|
||||||
|
const roll = await LethalFantasyRoll.promptRangedDefense({
|
||||||
|
actorId: defender.id,
|
||||||
|
actorName: defender.name,
|
||||||
|
actorImage: defender.img,
|
||||||
|
})
|
||||||
|
if (roll) {
|
||||||
|
game.lethalFantasy = game.lethalFantasy || {}
|
||||||
|
game.lethalFantasy.nextDefenseData = {
|
||||||
|
attackerId,
|
||||||
|
attackRoll,
|
||||||
|
attackerName,
|
||||||
|
defenderName,
|
||||||
|
attackWeaponId,
|
||||||
|
attackRollType,
|
||||||
|
attackRollKey,
|
||||||
|
attackD30result,
|
||||||
|
attackD30message,
|
||||||
|
attackRerollContext,
|
||||||
|
defenderId: defender.id,
|
||||||
|
defenderTokenId,
|
||||||
|
isRanged: true
|
||||||
|
}
|
||||||
|
await roll.toMessage({}, { messageMode: roll.options.rollMode })
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Pour les personnages, récupérer les armes équipées
|
// Pour les personnages, récupérer les armes équipées
|
||||||
const equippedWeapons = defender.items.filter(i =>
|
const equippedWeapons = defender.items.filter(i =>
|
||||||
i.type === "weapon" && i.system.equipped === true
|
i.type === "weapon" && i.system.equipped === true
|
||||||
@@ -437,7 +470,8 @@ export default class LethalFantasyUtils {
|
|||||||
attackD30message,
|
attackD30message,
|
||||||
attackRerollContext,
|
attackRerollContext,
|
||||||
defenderId: defender.id,
|
defenderId: defender.id,
|
||||||
defenderTokenId
|
defenderTokenId,
|
||||||
|
isRanged: msg.isRanged
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("Storing defense data for character:", defender.id)
|
console.log("Storing defense data for character:", defender.id)
|
||||||
@@ -448,7 +482,7 @@ export default class LethalFantasyUtils {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static hasD30Reroll(d30Message) {
|
static hasD30Reroll(d30Message) {
|
||||||
return /mulligan|re-?roll/i.test(d30Message || "")
|
return d30Message?.type === "mulligan"
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@@ -1058,25 +1092,32 @@ export default class LethalFantasyUtils {
|
|||||||
static async applyDamage(message, event) {
|
static async applyDamage(message, event) {
|
||||||
// Récupérer les données du message
|
// Récupérer les données du message
|
||||||
let combatantId = event.currentTarget.dataset.combatantId
|
let combatantId = event.currentTarget.dataset.combatantId
|
||||||
if (!combatantId || !game.combat) {
|
if (!combatantId) {
|
||||||
ui.notifications.error("No combatant selected")
|
ui.notifications.error("No combatant selected")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let combatant = game.combat.combatants.get(combatantId)
|
// Try to find the target: first as a combat combatant, then as a scene token
|
||||||
if (!combatant) {
|
let targetActor = null
|
||||||
ui.notifications.error("Combatant not found")
|
if (game.combat) {
|
||||||
return
|
const combatant = game.combat.combatants.get(combatantId)
|
||||||
|
if (combatant) {
|
||||||
|
targetActor = combatant.token?.actor || game.actors.get(combatant.actorId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!targetActor) {
|
||||||
|
// Fall back to scene token lookup (non-combat tokens use tokenId as their combatantId)
|
||||||
|
const token = canvas.tokens?.placeables?.find(t => t.id === combatantId)
|
||||||
|
targetActor = token?.actor
|
||||||
}
|
}
|
||||||
|
|
||||||
let targetActor = combatant.token?.actor || game.actors.get(combatant.actorId)
|
|
||||||
if (!targetActor) {
|
if (!targetActor) {
|
||||||
ui.notifications.error("Target actor not found")
|
ui.notifications.error("Target actor not found")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Récupérer les données de dégâts du message
|
// Récupérer les données de dégâts du message
|
||||||
let damageTotal = message.rolls[0]?.total || 0
|
// Use options.rollTotal (includes weapon modifier bonus) rather than roll.total (dice formula only)
|
||||||
|
let damageTotal = message.rolls[0]?.options?.rollTotal ?? message.rolls[0]?.total ?? 0
|
||||||
let weaponName = message.rolls[0]?.options?.rollName || "Unknown Weapon"
|
let weaponName = message.rolls[0]?.options?.rollName || "Unknown Weapon"
|
||||||
|
|
||||||
// Calculer les DR
|
// Calculer les DR
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
MANIFEST-000567
|
MANIFEST-000591
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
2026/04/17-15:59:28.854423 7fc1d9fbd6c0 Recovering log #565
|
2026/05/17-11:57:50.231387 7f16423fc6c0 Recovering log #589
|
||||||
2026/04/17-15:59:28.865018 7fc1d9fbd6c0 Delete type=3 #563
|
2026/05/17-11:57:50.249229 7f16423fc6c0 Delete type=3 #587
|
||||||
2026/04/17-15:59:28.865088 7fc1d9fbd6c0 Delete type=0 #565
|
2026/05/17-11:57:50.249281 7f16423fc6c0 Delete type=0 #589
|
||||||
2026/04/17-17:32:42.752073 7fc1d8fbb6c0 Level-0 table #570: started
|
2026/05/17-13:21:53.429711 7f1641bfb6c0 Level-0 table #594: started
|
||||||
2026/04/17-17:32:42.752102 7fc1d8fbb6c0 Level-0 table #570: 0 bytes OK
|
2026/05/17-13:21:53.429759 7f1641bfb6c0 Level-0 table #594: 0 bytes OK
|
||||||
2026/04/17-17:32:42.757979 7fc1d8fbb6c0 Delete type=0 #568
|
2026/05/17-13:21:53.437714 7f1641bfb6c0 Delete type=0 #592
|
||||||
2026/04/17-17:32:42.764071 7fc1d8fbb6c0 Manual compaction at level-0 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end)
|
2026/05/17-13:21:53.449134 7f1641bfb6c0 Manual compaction at level-0 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end)
|
||||||
2026/04/17-17:32:42.764104 7fc1d8fbb6c0 Manual compaction at level-1 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end)
|
2026/05/17-13:21:53.461721 7f1641bfb6c0 Manual compaction at level-1 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
2026/04/16-08:58:49.556234 7fc1d97bc6c0 Recovering log #561
|
2026/05/02-08:40:55.892385 7fd7557ee6c0 Recovering log #585
|
||||||
2026/04/16-08:58:49.566786 7fc1d97bc6c0 Delete type=3 #559
|
2026/05/02-08:40:55.903385 7fd7557ee6c0 Delete type=3 #583
|
||||||
2026/04/16-08:58:49.566849 7fc1d97bc6c0 Delete type=0 #561
|
2026/05/02-08:40:55.903442 7fd7557ee6c0 Delete type=0 #585
|
||||||
2026/04/16-10:53:23.903167 7fc1d8fbb6c0 Level-0 table #566: started
|
2026/05/02-08:41:12.057856 7fd7477fe6c0 Level-0 table #590: started
|
||||||
2026/04/16-10:53:23.903203 7fc1d8fbb6c0 Level-0 table #566: 0 bytes OK
|
2026/05/02-08:41:12.057882 7fd7477fe6c0 Level-0 table #590: 0 bytes OK
|
||||||
2026/04/16-10:53:23.909050 7fc1d8fbb6c0 Delete type=0 #564
|
2026/05/02-08:41:12.121845 7fd7477fe6c0 Delete type=0 #588
|
||||||
2026/04/16-10:53:23.921766 7fc1d8fbb6c0 Manual compaction at level-0 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end)
|
2026/05/02-08:41:12.122077 7fd7477fe6c0 Manual compaction at level-0 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end)
|
||||||
2026/04/16-10:53:23.921790 7fc1d8fbb6c0 Manual compaction at level-1 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end)
|
2026/05/02-08:41:12.122121 7fd7477fe6c0 Manual compaction at level-1 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end)
|
||||||
|
|||||||
Binary file not shown.
@@ -1 +1 @@
|
|||||||
MANIFEST-000564
|
MANIFEST-000588
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
2026/04/17-15:59:28.871085 7fc1dafbf6c0 Recovering log #562
|
2026/05/17-11:57:50.260046 7f16433fe6c0 Recovering log #586
|
||||||
2026/04/17-15:59:28.880683 7fc1dafbf6c0 Delete type=3 #560
|
2026/05/17-11:57:50.276348 7f16433fe6c0 Delete type=3 #584
|
||||||
2026/04/17-15:59:28.880729 7fc1dafbf6c0 Delete type=0 #562
|
2026/05/17-11:57:50.276460 7f16433fe6c0 Delete type=0 #586
|
||||||
2026/04/17-17:32:42.744598 7fc1d8fbb6c0 Level-0 table #567: started
|
2026/05/17-13:21:53.474443 7f1641bfb6c0 Level-0 table #591: started
|
||||||
2026/04/17-17:32:42.744627 7fc1d8fbb6c0 Level-0 table #567: 0 bytes OK
|
2026/05/17-13:21:53.474485 7f1641bfb6c0 Level-0 table #591: 0 bytes OK
|
||||||
2026/04/17-17:32:42.751972 7fc1d8fbb6c0 Delete type=0 #565
|
2026/05/17-13:21:53.481502 7f1641bfb6c0 Delete type=0 #589
|
||||||
2026/04/17-17:32:42.764061 7fc1d8fbb6c0 Manual compaction at level-0 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end)
|
2026/05/17-13:21:53.490389 7f1641bfb6c0 Manual compaction at level-0 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end)
|
||||||
2026/04/17-17:32:42.764085 7fc1d8fbb6c0 Manual compaction at level-1 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end)
|
2026/05/17-13:21:53.512946 7f1641bfb6c0 Manual compaction at level-1 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
2026/04/16-08:58:49.571861 7fc1da7be6c0 Recovering log #558
|
2026/05/02-08:40:55.909564 7fd747fff6c0 Recovering log #582
|
||||||
2026/04/16-08:58:49.581625 7fc1da7be6c0 Delete type=3 #556
|
2026/05/02-08:40:55.919159 7fd747fff6c0 Delete type=3 #580
|
||||||
2026/04/16-08:58:49.581687 7fc1da7be6c0 Delete type=0 #558
|
2026/05/02-08:40:55.919214 7fd747fff6c0 Delete type=0 #582
|
||||||
2026/04/16-10:53:23.896992 7fc1d8fbb6c0 Level-0 table #563: started
|
2026/05/02-08:41:11.999050 7fd7477fe6c0 Level-0 table #587: started
|
||||||
2026/04/16-10:53:23.897059 7fc1d8fbb6c0 Level-0 table #563: 0 bytes OK
|
2026/05/02-08:41:11.999076 7fd7477fe6c0 Level-0 table #587: 0 bytes OK
|
||||||
2026/04/16-10:53:23.903074 7fc1d8fbb6c0 Delete type=0 #561
|
2026/05/02-08:41:12.057672 7fd7477fe6c0 Delete type=0 #585
|
||||||
2026/04/16-10:53:23.921755 7fc1d8fbb6c0 Manual compaction at level-0 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end)
|
2026/05/02-08:41:12.122063 7fd7477fe6c0 Manual compaction at level-0 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end)
|
||||||
2026/04/16-10:53:23.921797 7fc1d8fbb6c0 Manual compaction at level-1 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end)
|
2026/05/02-08:41:12.122111 7fd7477fe6c0 Manual compaction at level-1 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end)
|
||||||
|
|||||||
Binary file not shown.
@@ -1 +1 @@
|
|||||||
MANIFEST-000569
|
MANIFEST-000593
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
2026/04/17-15:59:28.839432 7fc1da7be6c0 Recovering log #567
|
2026/05/17-11:57:50.206131 7f1643bff6c0 Recovering log #591
|
||||||
2026/04/17-15:59:28.849242 7fc1da7be6c0 Delete type=3 #565
|
2026/05/17-11:57:50.222037 7f1643bff6c0 Delete type=3 #589
|
||||||
2026/04/17-15:59:28.849292 7fc1da7be6c0 Delete type=0 #567
|
2026/05/17-11:57:50.222089 7f1643bff6c0 Delete type=0 #591
|
||||||
2026/04/17-17:32:42.764151 7fc1d8fbb6c0 Level-0 table #572: started
|
2026/05/17-13:21:53.292176 7f1641bfb6c0 Level-0 table #596: started
|
||||||
2026/04/17-17:32:42.764181 7fc1d8fbb6c0 Level-0 table #572: 0 bytes OK
|
2026/05/17-13:21:53.292219 7f1641bfb6c0 Level-0 table #596: 0 bytes OK
|
||||||
2026/04/17-17:32:42.770357 7fc1d8fbb6c0 Delete type=0 #570
|
2026/05/17-13:21:53.299322 7f1641bfb6c0 Delete type=0 #594
|
||||||
2026/04/17-17:32:42.789018 7fc1d8fbb6c0 Manual compaction at level-0 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)
|
2026/05/17-13:21:53.306548 7f1641bfb6c0 Manual compaction at level-0 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)
|
||||||
2026/04/17-17:32:42.789049 7fc1d8fbb6c0 Manual compaction at level-1 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)
|
2026/05/17-13:21:53.318889 7f1641bfb6c0 Manual compaction at level-1 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
2026/04/16-08:58:49.542216 7fc1dafbf6c0 Recovering log #563
|
2026/05/02-08:40:55.873571 7fd747fff6c0 Recovering log #587
|
||||||
2026/04/16-08:58:49.551998 7fc1dafbf6c0 Delete type=3 #561
|
2026/05/02-08:40:55.883892 7fd747fff6c0 Delete type=3 #585
|
||||||
2026/04/16-08:58:49.552067 7fc1dafbf6c0 Delete type=0 #563
|
2026/05/02-08:40:55.883950 7fd747fff6c0 Delete type=0 #587
|
||||||
2026/04/16-10:53:23.915570 7fc1d8fbb6c0 Level-0 table #568: started
|
2026/05/02-08:41:11.870087 7fd7477fe6c0 Level-0 table #592: started
|
||||||
2026/04/16-10:53:23.915589 7fc1d8fbb6c0 Level-0 table #568: 0 bytes OK
|
2026/05/02-08:41:11.870140 7fd7477fe6c0 Level-0 table #592: 0 bytes OK
|
||||||
2026/04/16-10:53:23.921669 7fc1d8fbb6c0 Delete type=0 #566
|
2026/05/02-08:41:11.937524 7fd7477fe6c0 Delete type=0 #590
|
||||||
2026/04/16-10:53:23.921782 7fc1d8fbb6c0 Manual compaction at level-0 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)
|
2026/05/02-08:41:12.122025 7fd7477fe6c0 Manual compaction at level-0 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)
|
||||||
2026/04/16-10:53:23.921813 7fc1d8fbb6c0 Manual compaction at level-1 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)
|
2026/05/02-08:41:12.122087 7fd7477fe6c0 Manual compaction at level-1 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)
|
||||||
|
|||||||
Binary file not shown.
@@ -1 +1 @@
|
|||||||
MANIFEST-000264
|
MANIFEST-000288
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
2026/04/17-15:59:28.899464 7fc1d97bc6c0 Recovering log #262
|
2026/05/17-11:57:50.303535 7f16433fe6c0 Recovering log #286
|
||||||
2026/04/17-15:59:28.910004 7fc1d97bc6c0 Delete type=3 #260
|
2026/05/17-11:57:50.318955 7f16433fe6c0 Delete type=3 #284
|
||||||
2026/04/17-15:59:28.910074 7fc1d97bc6c0 Delete type=0 #262
|
2026/05/17-11:57:50.319061 7f16433fe6c0 Delete type=0 #286
|
||||||
2026/04/17-17:32:42.770457 7fc1d8fbb6c0 Level-0 table #267: started
|
2026/05/17-13:21:53.481662 7f1641bfb6c0 Level-0 table #291: started
|
||||||
2026/04/17-17:32:42.770479 7fc1d8fbb6c0 Level-0 table #267: 0 bytes OK
|
2026/05/17-13:21:53.481693 7f1641bfb6c0 Level-0 table #291: 0 bytes OK
|
||||||
2026/04/17-17:32:42.777091 7fc1d8fbb6c0 Delete type=0 #265
|
2026/05/17-13:21:53.490187 7f1641bfb6c0 Delete type=0 #289
|
||||||
2026/04/17-17:32:42.789028 7fc1d8fbb6c0 Manual compaction at level-0 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end)
|
2026/05/17-13:21:53.502325 7f1641bfb6c0 Manual compaction at level-0 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end)
|
||||||
2026/04/17-17:32:42.789054 7fc1d8fbb6c0 Manual compaction at level-1 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end)
|
2026/05/17-13:21:53.512979 7f1641bfb6c0 Manual compaction at level-1 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
2026/04/16-08:58:49.600337 7fc1dafbf6c0 Recovering log #258
|
2026/05/02-08:40:55.939668 7fd754fed6c0 Recovering log #282
|
||||||
2026/04/16-08:58:49.610136 7fc1dafbf6c0 Delete type=3 #256
|
2026/05/02-08:40:55.949715 7fd754fed6c0 Delete type=3 #280
|
||||||
2026/04/16-08:58:49.610209 7fc1dafbf6c0 Delete type=0 #258
|
2026/05/02-08:40:55.949784 7fd754fed6c0 Delete type=0 #282
|
||||||
2026/04/16-10:53:23.940580 7fc1d8fbb6c0 Level-0 table #263: started
|
2026/05/02-08:41:12.184448 7fd7477fe6c0 Level-0 table #287: started
|
||||||
2026/04/16-10:53:23.940611 7fc1d8fbb6c0 Level-0 table #263: 0 bytes OK
|
2026/05/02-08:41:12.184496 7fd7477fe6c0 Level-0 table #287: 0 bytes OK
|
||||||
2026/04/16-10:53:23.947242 7fc1d8fbb6c0 Delete type=0 #261
|
2026/05/02-08:41:12.252892 7fd7477fe6c0 Delete type=0 #285
|
||||||
2026/04/16-10:53:23.947402 7fc1d8fbb6c0 Manual compaction at level-0 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end)
|
2026/05/02-08:41:12.365481 7fd7477fe6c0 Manual compaction at level-0 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end)
|
||||||
2026/04/16-10:53:23.947419 7fc1d8fbb6c0 Manual compaction at level-1 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end)
|
2026/05/02-08:41:12.365509 7fd7477fe6c0 Manual compaction at level-1 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end)
|
||||||
|
|||||||
BIN
Binary file not shown.
@@ -1 +1 @@
|
|||||||
MANIFEST-000563
|
MANIFEST-000587
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
2026/04/17-15:59:28.886104 7fc1da7be6c0 Recovering log #561
|
2026/05/17-11:57:50.282340 7f16423fc6c0 Recovering log #585
|
||||||
2026/04/17-15:59:28.896104 7fc1da7be6c0 Delete type=3 #559
|
2026/05/17-11:57:50.297125 7f16423fc6c0 Delete type=3 #583
|
||||||
2026/04/17-15:59:28.896157 7fc1da7be6c0 Delete type=0 #561
|
2026/05/17-11:57:50.297189 7f16423fc6c0 Delete type=0 #585
|
||||||
2026/04/17-17:32:42.758102 7fc1d8fbb6c0 Level-0 table #566: started
|
2026/05/17-13:21:53.299508 7f1641bfb6c0 Level-0 table #590: started
|
||||||
2026/04/17-17:32:42.758128 7fc1d8fbb6c0 Level-0 table #566: 0 bytes OK
|
2026/05/17-13:21:53.299854 7f1641bfb6c0 Level-0 table #590: 0 bytes OK
|
||||||
2026/04/17-17:32:42.763950 7fc1d8fbb6c0 Delete type=0 #564
|
2026/05/17-13:21:53.306309 7f1641bfb6c0 Delete type=0 #588
|
||||||
2026/04/17-17:32:42.764079 7fc1d8fbb6c0 Manual compaction at level-0 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)
|
2026/05/17-13:21:53.318877 7f1641bfb6c0 Manual compaction at level-0 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)
|
||||||
2026/04/17-17:32:42.764099 7fc1d8fbb6c0 Manual compaction at level-1 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)
|
2026/05/17-13:21:53.325564 7f1641bfb6c0 Manual compaction at level-1 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
2026/04/16-08:58:49.586323 7fc1d9fbd6c0 Recovering log #557
|
2026/05/02-08:40:55.925402 7fd755fef6c0 Recovering log #581
|
||||||
2026/04/16-08:58:49.596973 7fc1d9fbd6c0 Delete type=3 #555
|
2026/05/02-08:40:55.935869 7fd755fef6c0 Delete type=3 #579
|
||||||
2026/04/16-08:58:49.597026 7fc1d9fbd6c0 Delete type=0 #557
|
2026/05/02-08:40:55.935924 7fd755fef6c0 Delete type=0 #581
|
||||||
2026/04/16-10:53:23.909144 7fc1d8fbb6c0 Level-0 table #562: started
|
2026/05/02-08:41:11.937698 7fd7477fe6c0 Level-0 table #586: started
|
||||||
2026/04/16-10:53:23.909174 7fc1d8fbb6c0 Level-0 table #562: 0 bytes OK
|
2026/05/02-08:41:11.937727 7fd7477fe6c0 Level-0 table #586: 0 bytes OK
|
||||||
2026/04/16-10:53:23.915478 7fc1d8fbb6c0 Delete type=0 #560
|
2026/05/02-08:41:11.998871 7fd7477fe6c0 Delete type=0 #584
|
||||||
2026/04/16-10:53:23.921775 7fc1d8fbb6c0 Manual compaction at level-0 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)
|
2026/05/02-08:41:12.122041 7fd7477fe6c0 Manual compaction at level-0 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)
|
||||||
2026/04/16-10:53:23.921804 7fc1d8fbb6c0 Manual compaction at level-1 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)
|
2026/05/02-08:41:12.122099 7fd7477fe6c0 Manual compaction at level-1 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)
|
||||||
|
|||||||
BIN
Binary file not shown.
@@ -410,6 +410,48 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ranged-attacks {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
.attack {
|
||||||
|
.name {
|
||||||
|
min-width: 10rem;
|
||||||
|
max-width: 10rem;
|
||||||
|
}
|
||||||
|
.damage-dice {
|
||||||
|
width: 5rem;
|
||||||
|
max-width: 5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ranged-weapon-range {
|
||||||
|
margin-top: 8px;
|
||||||
|
border-top: 1px solid var(--color-border-light-tertiary, #ccc);
|
||||||
|
padding-top: 6px;
|
||||||
|
> label {
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.range-fields {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 6px;
|
||||||
|
.range-field {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
label {
|
||||||
|
font-size: 0.7rem;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
input {
|
||||||
|
width: 3.5rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.armors {
|
.armors {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, 1fr);
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
|||||||
+2
-2
@@ -6,7 +6,7 @@
|
|||||||
"download": "#{DOWNLOAD}#",
|
"download": "#{DOWNLOAD}#",
|
||||||
"url": "#{URL}#",
|
"url": "#{URL}#",
|
||||||
"license": "LICENSE",
|
"license": "LICENSE",
|
||||||
"version": "13.0.0",
|
"version": "14.0.0",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Uberwald",
|
"name": "Uberwald",
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
],
|
],
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "13",
|
"minimum": "13",
|
||||||
"verified": "13"
|
"verified": "14"
|
||||||
},
|
},
|
||||||
"esmodules": ["lethal-fantasy.mjs"],
|
"esmodules": ["lethal-fantasy.mjs"],
|
||||||
"styles": ["css/fvtt-lethal-fantasy.css"],
|
"styles": ["css/fvtt-lethal-fantasy.css"],
|
||||||
|
|||||||
@@ -127,7 +127,7 @@
|
|||||||
{{#if D30message}}
|
{{#if D30message}}
|
||||||
<div class="d30-message">
|
<div class="d30-message">
|
||||||
<i class="fa-solid fa-wand-magic-sparkles"></i>
|
<i class="fa-solid fa-wand-magic-sparkles"></i>
|
||||||
<span>{{D30message}}</span>
|
<span>{{D30message.description}}</span>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,6 +13,14 @@
|
|||||||
<span>{{ localize "COMBAT.End" }}</span>
|
<span>{{ localize "COMBAT.End" }}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
{{#if combat.round}}
|
||||||
|
<button type="button" class="combat-control combat-control-lg" data-action="rollMonsterProgression"
|
||||||
|
data-tooltip="{{ localize 'LETHALFANTASY.Combat.RollMonsters' }}">
|
||||||
|
<i class="fa-solid fa-dragon" inert></i>
|
||||||
|
<span>{{ localize "LETHALFANTASY.Combat.RollMonsters" }}</span>
|
||||||
|
</button>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<!-- <button type="button" class="inline-control combat-control icon fa-solid fa-arrow-right" data-action="nextTurn"
|
<!-- <button type="button" class="inline-control combat-control icon fa-solid fa-arrow-right" data-action="nextTurn"
|
||||||
data-tooltip aria-label="{{ localize "COMBAT.TurnNext" }}"></button> -->
|
data-tooltip aria-label="{{ localize "COMBAT.TurnNext" }}"></button> -->
|
||||||
<button type="button" class="inline-control combat-control icon fa-solid fa-forward-step" data-action="nextRound"
|
<button type="button" class="inline-control combat-control icon fa-solid fa-forward-step" data-action="nextRound"
|
||||||
|
|||||||
@@ -18,7 +18,16 @@
|
|||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{{localize "LETHALFANTASY.Label.attacks"}}</legend>
|
<legend>{{localize "LETHALFANTASY.Label.attacks"}}</legend>
|
||||||
<div class="attacks">
|
<div class="attack-mode-selector">
|
||||||
|
<label>{{localize "LETHALFANTASY.Label.attackMode"}}</label>
|
||||||
|
<select name="system.attackMode">
|
||||||
|
<option value="melee" {{#if (eq system.attackMode "melee")}}selected{{/if}}>{{localize "LETHALFANTASY.Label.meleeModeLabel"}}</option>
|
||||||
|
<option value="ranged" {{#if (eq system.attackMode "ranged")}}selected{{/if}}>{{localize "LETHALFANTASY.Label.rangedModeLabel"}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{#if (eq system.attackMode "melee")}}
|
||||||
|
<div class="attacks melee-attacks">
|
||||||
{{#each system.attacks as |item key|}}
|
{{#each system.attacks as |item key|}}
|
||||||
<div class="attack" data-attack-key="{{key}}" >
|
<div class="attack" data-attack-key="{{key}}" >
|
||||||
<div class="">
|
<div class="">
|
||||||
@@ -42,6 +51,9 @@
|
|||||||
<div class="numeric">
|
<div class="numeric">
|
||||||
<input type="number" name="system.attacks.{{item.key}}.damageModifier" value="{{item.damageModifier}}" data-tooltip="Damage modifier"/>
|
<input type="number" name="system.attacks.{{item.key}}.damageModifier" value="{{item.damageModifier}}" data-tooltip="Damage modifier"/>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="">
|
||||||
|
<input type="checkbox" name="system.attacks.{{item.key}}.noExplode" {{checked item.noExplode}} data-tooltip="No exploding dice on damage" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="attack-icons">
|
<div class="attack-icons">
|
||||||
|
|
||||||
@@ -64,6 +76,87 @@
|
|||||||
</div>
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
|
{{else}}
|
||||||
|
<div class="attacks ranged-attacks">
|
||||||
|
{{#each system.rangedAttacks as |item key|}}
|
||||||
|
<div class="attack" data-attack-key="{{key}}" >
|
||||||
|
<div class="">
|
||||||
|
<input type="checkbox" name="system.rangedAttacks.{{item.key}}.enabled" {{checked item.enabled}} data-tooltip="Attack enabled/disabled" />
|
||||||
|
</div>
|
||||||
|
<div class="name">
|
||||||
|
<input type="text" name="system.rangedAttacks.{{item.key}}.name" value="{{item.name}}" data-tooltip="Attack name" />
|
||||||
|
</div>
|
||||||
|
<div class="numeric">
|
||||||
|
<input type="number" name="system.rangedAttacks.{{item.key}}.attackScore" value="{{item.attackScore}}" data-tooltip="Progression number" />
|
||||||
|
</div>
|
||||||
|
<div class="numeric">
|
||||||
|
<input type="number" name="system.rangedAttacks.{{item.key}}.attackModifier" value="{{item.attackModifier}}" data-tooltip="Attack modifier" />
|
||||||
|
</div>
|
||||||
|
<div class="numeric">
|
||||||
|
<input type="number" name="system.rangedAttacks.{{item.key}}.defenseModifier" value="{{item.defenseModifier}}" data-tooltip="Defense modifier"/>
|
||||||
|
</div>
|
||||||
|
<div class="damage-dice">
|
||||||
|
<input type="text" name="system.rangedAttacks.{{item.key}}.damageDice" value="{{item.damageDice}}" data-tooltip="Damage dice"/>
|
||||||
|
</div>
|
||||||
|
<div class="numeric">
|
||||||
|
<input type="number" name="system.rangedAttacks.{{item.key}}.damageModifier" value="{{item.damageModifier}}" data-tooltip="Damage modifier"/>
|
||||||
|
</div>
|
||||||
|
<div class="">
|
||||||
|
<input type="checkbox" name="system.rangedAttacks.{{item.key}}.noExplode" {{checked item.noExplode}} data-tooltip="No exploding dice on damage" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="attack-icons">
|
||||||
|
|
||||||
|
<a class="rollable" data-roll-type="monster-attack" data-roll-key="{{item.key}}" data-tooltip="Roll Attack">
|
||||||
|
<i class="lf-roll-small fa-solid fa-bow-arrow" data-roll-type="monster-attack" data-roll-key="{{item.key}}"></i>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a class="rollable" data-roll-type="monster-defense" data-roll-key="{{item.key}}" data-tooltip="Roll Defense">
|
||||||
|
<i class="fa-solid fa-shield-halved" data-roll-type="monster-defense" data-roll-key="{{item.key}}"></i>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a class="rollable" data-roll-type="monster-damage" data-roll-key="{{item.key}}"
|
||||||
|
data-tooltip="Roll Damage">
|
||||||
|
<i class="fa-regular fa-face-head-bandage" data-roll-type="monster-damage"
|
||||||
|
data-roll-key="{{item.key}}"></i>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
<div class="ranged-weapon-range">
|
||||||
|
<label>{{localize "LETHALFANTASY.Label.range"}}</label>
|
||||||
|
<div class="range-fields">
|
||||||
|
<div class="range-field">
|
||||||
|
<label>{{localize "LETHALFANTASY.Label.pointBlank"}}</label>
|
||||||
|
<input type="number" name="system.rangedWeaponRange.pointBlank" value="{{system.rangedWeaponRange.pointBlank}}" />
|
||||||
|
</div>
|
||||||
|
<div class="range-field">
|
||||||
|
<label>{{localize "LETHALFANTASY.Label.short"}}</label>
|
||||||
|
<input type="number" name="system.rangedWeaponRange.short" value="{{system.rangedWeaponRange.short}}" />
|
||||||
|
</div>
|
||||||
|
<div class="range-field">
|
||||||
|
<label>{{localize "LETHALFANTASY.Label.medium"}}</label>
|
||||||
|
<input type="number" name="system.rangedWeaponRange.medium" value="{{system.rangedWeaponRange.medium}}" />
|
||||||
|
</div>
|
||||||
|
<div class="range-field">
|
||||||
|
<label>{{localize "LETHALFANTASY.Label.long"}}</label>
|
||||||
|
<input type="number" name="system.rangedWeaponRange.long" value="{{system.rangedWeaponRange.long}}" />
|
||||||
|
</div>
|
||||||
|
<div class="range-field">
|
||||||
|
<label>{{localize "LETHALFANTASY.Label.extreme"}}</label>
|
||||||
|
<input type="number" name="system.rangedWeaponRange.extreme" value="{{system.rangedWeaponRange.extreme}}" />
|
||||||
|
</div>
|
||||||
|
<div class="range-field">
|
||||||
|
<label>{{localize "LETHALFANTASY.Label.outOfSkill"}}</label>
|
||||||
|
<input type="number" name="system.rangedWeaponRange.outOfSkill" value="{{system.rangedWeaponRange.outOfSkill}}" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
@@ -92,6 +185,9 @@
|
|||||||
<div class="numeric">
|
<div class="numeric">
|
||||||
<input type="number" name="system.combatHTH.{{item.key}}.damageModifier" value="{{item.damageModifier}}" data-tooltip="Damage modifier"/>
|
<input type="number" name="system.combatHTH.{{item.key}}.damageModifier" value="{{item.damageModifier}}" data-tooltip="Damage modifier"/>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="">
|
||||||
|
<input type="checkbox" name="system.combatHTH.{{item.key}}.noExplode" {{checked item.noExplode}} data-tooltip="No exploding dice on damage" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="attack-icons">
|
<div class="attack-icons">
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user