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
+37 -8
View File
@@ -595,6 +595,20 @@ function registerSettings() {
water: { yin: 0, yang: 0 }
}
});
game.settings.register(SYSTEM_ID, "loksyuConsumptionOrder", {
name: "CDE.Settings.LoksyuConsumptionOrder",
hint: "CDE.Settings.LoksyuConsumptionOrderHint",
scope: "world",
config: true,
type: String,
choices: {
"yang-first": "CDE.Settings.LoksyuOrderYangFirst",
"yin-first": "CDE.Settings.LoksyuOrderYinFirst",
"balanced": "CDE.Settings.LoksyuOrderBalanced"
},
default: "yang-first",
onChange: () => Hooks.callAll("cde:loksyuUpdated")
});
game.settings.register(SYSTEM_ID, "tinjiData", {
scope: "world",
config: false,
@@ -991,7 +1005,7 @@ var WeaponDataModel = class extends foundry.abstract.TypeDataModel {
weaponType: stringField("melee"),
material: stringField(""),
damageAspect: stringField("metal"),
damageBase: intField(1),
damageBase: intField(0),
range: stringField("contact"),
// contact | courte | mediane | longue | extreme
obtainLevel: intField(0, { min: 0, max: 5 }),
@@ -1580,7 +1594,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",
@@ -1724,7 +1738,7 @@ 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,
@@ -1743,7 +1757,7 @@ 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) {
ui.notifications.warn(game.i18n.localize("CDE.Error0"));
@@ -1760,6 +1774,8 @@ async function rollForActor(actor, rollKey) {
if (wpBonusMalus !== 0) wpModParts.push(`${wpBonusMalus > 0 ? "+" : ""}${wpBonusMalus} ${game.i18n.localize("CDE.BonusMalus")}`);
if (wpWoundMalus !== 0) wpModParts.push(`-${wpWoundMalus} ${game.i18n.localize("CDE.WoundMalus")}`);
if (wpBonusAusp !== 0) wpModParts.push(`+${wpBonusAusp} ${game.i18n.localize("CDE.BonusAuspiciousDice")}`);
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,
@@ -1774,7 +1790,9 @@ async function rollForActor(actor, rollKey) {
// weapon-specific
weaponName: wpItem.name,
damageBase: wpDamageBase,
totalDamage: wpResults.successesdice * wpDamageBase,
damageAspectValue: wpDamageAspectValue,
damageAspectLabel: wpDamageAspectLabel,
totalDamage: wpDamageBase + wpDamageAspectValue,
...wpResults,
aspect: wpAspectName,
d1: wpFaces[1],
@@ -2936,8 +2954,19 @@ async function _drawFromLoksyu(message, aspect, type, aspectLabel) {
ui.notifications.warn(game.i18n.localize("CDE.LoksyuEmpty"));
return;
}
if (entry.yang > 0) entry.yang--;
else entry.yin--;
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 {
if (entry.yang > 0) entry.yang--;
else entry.yin--;
}
data[aspect] = entry;
await setLoksyuData(data);
const flags = message?.flags?.[SYSTEM_ID];
@@ -2946,7 +2975,7 @@ async function _drawFromLoksyu(message, aspect, type, aspectLabel) {
if (type === "success") {
updated.successesdice = (updated.successesdice ?? 0) + 1;
updated.loksyuBonusSuc = (updated.loksyuBonusSuc ?? 0) + 1;
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;