Meilleure gestion du loksyu + degats des armes corrigés
Release Creation / build (release) Successful in 1m28s

This commit is contained in:
2026-06-09 14:21:05 +02:00
parent 440755d8a1
commit 066e3bbaf5
86 changed files with 361 additions and 221 deletions
+16 -4
View File
@@ -133,9 +133,21 @@ async function _drawFromLoksyu(message, aspect, type, aspectLabel) {
return
}
// Remove 1 die (prefer yang first)
if (entry.yang > 0) entry.yang--
else entry.yin--
// Remove 1 die according to the consumption order setting
const order = game.settings.get(SYSTEM_ID, "loksyuConsumptionOrder")
if (order === "yin-first") {
if (entry.yin > 0) entry.yin--
else entry.yang--
} else if (order === "balanced") {
if (entry.yin > entry.yang) entry.yin--
else if (entry.yang > entry.yin) entry.yang--
else if (entry.yang > 0) entry.yang--
else entry.yin--
} else {
// yang-first (default)
if (entry.yang > 0) entry.yang--
else entry.yin--
}
data[aspect] = entry
await setLoksyuData(data)
@@ -147,7 +159,7 @@ async function _drawFromLoksyu(message, aspect, type, aspectLabel) {
updated.successesdice = (updated.successesdice ?? 0) + 1
updated.loksyuBonusSuc = (updated.loksyuBonusSuc ?? 0) + 1
// Recalculate weapon damage if applicable
if (updated.damageBase) updated.totalDamage = updated.successesdice * updated.damageBase
if (updated.damageBase != null) updated.totalDamage = updated.damageBase + (updated.damageAspectValue ?? 0)
} else {
updated.auspiciousdice = (updated.auspiciousdice ?? 0) + 1
updated.loksyuBonusFaste = (updated.loksyuBonusFaste ?? 0) + 1
+12 -6
View File
@@ -193,7 +193,7 @@ async function showWeaponPrompt(params) {
weaponTypeLabel: params.weaponTypeLabel ?? "CDE.Weapon",
weaponAspectIcon: params.weaponAspectIcon ?? "",
weaponAspectLabel: params.weaponAspectLabel ?? "",
damageBase: params.damageBase ?? 1,
damageBase: params.damageBase ?? 0,
weaponskill: params.weaponskill ?? "kungfu",
aspect: Number(params.aspect ?? 0),
effectiverange: params.effectiverange ?? "contact",
@@ -350,7 +350,7 @@ export async function rollForActor(actor, rollKey) {
weaponTypeLabel: WEAPON_TYPE_LABELS[wpType] ?? "CDE.Weapon",
weaponAspectIcon: ASPECT_ICONS[ASPECT_NAMES[wpAspectIdx]] ?? "",
weaponAspectLabel: game.i18n.localize(ASPECT_LABELS[ASPECT_NAMES[wpAspectIdx]] ?? ""),
damageBase: wpItem.system.damageBase ?? 1,
damageBase: wpItem.system.damageBase ?? 0,
weaponskill: wpSkill,
aspect: wpAspectIdx,
effectiverange: wpRange,
@@ -372,7 +372,7 @@ export async function rollForActor(actor, rollKey) {
const wpWoundMalus = Number(wParams.woundmalus ?? 0)
const wpBonusAusp = Number(wParams.bonusauspiciousdice ?? 0)
const wpThrowMode = Number(wParams.typeofthrow ?? 0)
const wpDamageBase = wpItem.system.damageBase ?? 1
const wpDamageBase = wpItem.system.damageBase ?? 0
const wpTotalDice = wpSkillDice + wpAspectDice + wpRangeMalus + wpBonusMalus - wpWoundMalus
if (wpTotalDice <= 0) {
@@ -394,6 +394,10 @@ export async function rollForActor(actor, rollKey) {
if (wpWoundMalus !== 0) wpModParts.push(`-${wpWoundMalus} ${game.i18n.localize("CDE.WoundMalus")}`)
if (wpBonusAusp !== 0) wpModParts.push(`+${wpBonusAusp} ${game.i18n.localize("CDE.BonusAuspiciousDice")}`)
// Damage = character's aspect value + weapon base damage (additive, not multiplied by successes)
const wpDamageAspectValue = sys.aspect?.[ASPECT_NAMES[wpAspFinal]]?.value ?? 0
const wpDamageAspectLabel = game.i18n.localize(ASPECT_LABELS[ASPECT_NAMES[wpAspFinal]] ?? "")
const wpMsg = await sendResultMessage(actor, {
rollLabel: `${wpItem.name}`,
aspectName: wpAspectName,
@@ -406,9 +410,11 @@ export async function rollForActor(actor, rollKey) {
actorName: actor.name ?? "",
actorImg: actor.img ?? "",
// weapon-specific
weaponName: wpItem.name,
damageBase: wpDamageBase,
totalDamage: wpResults.successesdice * wpDamageBase,
weaponName: wpItem.name,
damageBase: wpDamageBase,
damageAspectValue: wpDamageAspectValue,
damageAspectLabel: wpDamageAspectLabel,
totalDamage: wpDamageBase + wpDamageAspectValue,
...wpResults,
aspect: wpAspectName,
d1: wpFaces[1], d2: wpFaces[2], d3: wpFaces[3], d4: wpFaces[4], d5: wpFaces[5],