Roll damages and so on
All checks were successful
Release Creation / build (release) Successful in 56s

This commit is contained in:
2025-12-14 21:18:00 +01:00
parent f6b35536de
commit 96062c6fd9
34 changed files with 285 additions and 100 deletions

View File

@@ -120,7 +120,7 @@ export default class LethalFantasyActor extends Actor {
}
/* *************************************************/
fuzzyNameSearchWeaponSkills(weaponName, weaponClass=null) {
fuzzyNameSearchWeaponSkills(weaponName, weaponClass = null) {
// Get all weapon skills without the " skill" suffix
let skills = this.items.filter((i) => i.type === "skill" && i.system.weaponClass === weaponClass && i.system.category === "weapon")
// Remove parenthesis in the weapon name for better matching
@@ -227,11 +227,14 @@ export default class LethalFantasyActor extends Actor {
ui.notifications.warn(game.i18n.localize("LETHALFANTASY.Notifications.skillNotFound"))
return
}
rollTarget = skill
rollTarget.weapon = weapon
rollTarget.weaponSkillModifier = skill.weaponSkillModifier
rollTarget.rollKey = rollKey
rollTarget.combat = foundry.utils.duplicate(this.system.combat)
// Créer un objet plain au lieu de modifier directement le skill
rollTarget = {
...skill,
weapon: weapon,
weaponSkillModifier: skill.weaponSkillModifier,
rollKey: rollKey,
combat: foundry.utils.duplicate(this.system.combat)
}
if (rollType === "weapon-damage-small" || rollType === "weapon-damage-medium") {
rollTarget.grantedDice = this.system.granted.damageDice
}

View File

@@ -1139,6 +1139,20 @@ export default class LethalFantasyRoll extends Roll {
}
}
// Récupérer les informations de l'arme pour les attaques réussies
let weaponDamageOptions = null
console.log("Roll type:", this.type, "rollTarget:", this.rollTarget, "Has weapon:", !!this.rollTarget?.weapon)
if (this.type === "weapon-attack" && this.rollTarget?.weapon) {
const weapon = this.rollTarget.weapon
weaponDamageOptions = {
weaponId: weapon._id || weapon.id,
weaponName: weapon.name,
damageS: weapon.system?.damage?.damageS,
damageM: weapon.system?.damage?.damageM
}
console.log("Weapon damage options:", weaponDamageOptions)
}
const cardData = {
css: [SYSTEM.id, "dice-roll"],
data: this.data,
@@ -1163,7 +1177,8 @@ export default class LethalFantasyRoll extends Roll {
badResult: this.badResult,
rollData: this.rollData,
isPrivate: isPrivate,
combatants: combatants
combatants: combatants,
weaponDamageOptions: weaponDamageOptions
}
cardData.cssClass = cardData.css.join(" ")
cardData.tooltip = isPrivate ? "" : await this.getTooltip()