4 Commits

Author SHA1 Message Date
uberwald 48660c9430 Fix target selection
Release Creation / build (release) Successful in 1m45s
2026-06-01 13:54:55 +02:00
uberwald 0b88e53d77 Gestion degats à deux mains, suppression bonus degats inutiles
Release Creation / build (release) Successful in 1m58s
2026-06-01 08:26:01 +02:00
uberwald 2c73108f63 SUpression bonus degats, gestion armes à 2mains 2026-05-31 23:23:55 +02:00
uberwald 8718cfff05 AUto-select current target if any
Release Creation / build (release) Successful in 55s
2026-05-29 23:27:33 +02:00
27 changed files with 92 additions and 75 deletions
-1
View File
@@ -104,7 +104,6 @@
"DNC.Dialog.InitiativeIntro": "<strong>{actorName}</strong> lance l'initiative.",
"DNC.Dialog.InitiativeCurrent": "DEX actuelle : <strong>{dex}</strong>, bonus de fiche : <strong>{initiativeBonus}</strong>",
"DNC.Dialog.CharacteristicUsed": "Caracteristique utilisee",
"DNC.Dialog.ActorDamageBonus": "Bonus de degats de l'acteur",
"DNC.Dialog.DamageCappedByDv": "Le DV martial actuel ({dv}) plafonne cette arme : {base} devient {damage}.",
"DNC.Dialog.SpellAutoDisadvantage": "Le cout depasse le rang du lanceur : le jet se fera automatiquement avec desavantage.",
"DNC.Dialog.UseUsageDie": "Utiliser <strong>{itemName}</strong> et lancer son de d'usage actuel.",
+9 -1
View File
@@ -225,9 +225,17 @@
.chat-targeting {
position: relative;
z-index: 1;
display: grid;
display: flex;
gap: @spacing-sm;
margin-top: @spacing-sm;
flex-wrap: wrap;
align-items: end;
.chat-action-button {
padding: 0.35rem 0.65rem;
min-height: 1.75rem;
font-size: 0.82rem;
}
}
.chat-control {
@@ -202,16 +202,18 @@ export class DonjonEtCieRollDialog {
static async createDamage(actor, item) {
const damageContext = DonjonEtCieUtility.getMartialDamageContext(actor, item);
const isMeleeTwoHanded = item.type === "arme" && item.system?.categorie === "melee" && Number(item.system?.mains ?? 1) > 1;
const defaultMode = isMeleeTwoHanded ? "avantage" : "normal";
const content = await foundry.applications.handlebars.renderTemplate(
"systems/fvtt-donjon-et-cie/templates/dialogs/damage-roll.hbs",
{
actorName: actor?.name ?? item.actor?.name ?? "",
item,
actorBonus: actor?.system?.combat?.degatsBonus ?? 0,
damageFormula: damageContext.effectiveFormula || item.system.degats,
damageBase: damageContext.baseFormula || item.system.degats,
damageCapped: damageContext.capped,
martialDvLabel: damageContext.martialDvSides ? `d${damageContext.martialDvSides}` : damageContext.martialDvFormula
martialDvLabel: damageContext.martialDvSides ? `d${damageContext.martialDvSides}` : damageContext.martialDvFormula,
defaultMode
}
);
+13 -5
View File
@@ -372,11 +372,15 @@ export class DonjonEtCieRolls {
}
if (!isUsageDie && !item.system.degats) return null;
// Arme à 2 mains de corps à corps : avantage automatique
const isMeleeTwoHanded = item.type === "arme" && item.system?.categorie === "melee" && Number(item.system?.mains ?? 1) > 1;
if (isMeleeTwoHanded && mode === "normal") {
mode = "avantage";
}
const damageContext = DonjonEtCieUtility.getMartialDamageContext(actor, item);
const actorBonus = Number(actor?.system?.combat?.degatsBonus ?? 0);
const totalBonus = actorBonus;
const effectiveDamage = damageContext.effectiveFormula || (isUsageDie ? `1d${degatsDelta}` : item.system.degats);
const formula = totalBonus ? `${effectiveDamage} + ${totalBonus}` : effectiveDamage;
const formula = effectiveDamage;
const result = await this.#resolveFormulaRoll(formula, {}, { mode, favorable: "high" });
const targets = DonjonEtCieUtility.getSceneDamageTargets();
const rollDieLabels = result.rolls.map((roll) => {
@@ -396,7 +400,6 @@ export class DonjonEtCieRolls {
keptDieLabel,
values: result.values,
total: result.kept,
bonus: totalBonus,
baseDamage: baseDamageDisplay,
effectiveDamage,
damageCapped: damageContext.capped,
@@ -414,7 +417,6 @@ export class DonjonEtCieRolls {
baseDamage: baseDamageDisplay,
effectiveDamage,
damageCapped: damageContext.capped,
bonus: totalBonus,
values: result.values,
mode: result.mode
};
@@ -427,6 +429,12 @@ export class DonjonEtCieRolls {
return null;
}
// Arme à 2 mains de corps à corps : avantage automatique
const isMeleeTwoHanded = item.type === "arme" && item.system?.categorie === "melee" && Number(item.system?.mains ?? 1) > 1;
if (isMeleeTwoHanded && mode === "normal") {
mode = "avantage";
}
const resolved = await this.#resolveFormulaRoll(`1d${before}`, {}, { mode, favorable: "high" });
const result = resolved.kept;
const degraded = result <= 3;
+5 -1
View File
@@ -75,6 +75,9 @@ export class DonjonEtCieUtility {
static getSceneDamageTargets() {
const scene = canvas?.scene ?? game.scenes?.current;
const tokens = scene?.tokens?.contents ?? [];
const targetedTokens = game.user?.targets ?? new Set();
const targetedTokenUuid = targetedTokens?.first()?.document.uuid ?? null;
return tokens
.map((token) => {
@@ -89,7 +92,8 @@ export class DonjonEtCieUtility {
tokenId: token.id,
tokenUuid: token.uuid,
actorUuid: actor.uuid,
label
label,
isSelected: token.uuid === targetedTokenUuid
};
})
.filter(Boolean)
-1
View File
@@ -50,7 +50,6 @@ export default class EmployeDataModel extends foundry.abstract.TypeDataModel {
}),
combat: new fields.SchemaField({
initiativeBonus: new fields.NumberField({ initial: 0, integer: true }),
degatsBonus: new fields.NumberField({ initial: 0, integer: true }),
attaquesCorpsACorps: new fields.NumberField({ initial: 1, integer: true }),
attaquesDistance: new fields.NumberField({ initial: 1, integer: true })
}),
+1 -1
View File
@@ -1 +1 @@
MANIFEST-000085
MANIFEST-000169
+7 -7
View File
@@ -1,7 +1,7 @@
2026/05/22-09:28:26.005874 7fb57dfee6c0 Recovering log #83
2026/05/22-09:28:26.015537 7fb57dfee6c0 Delete type=3 #81
2026/05/22-09:28:26.015651 7fb57dfee6c0 Delete type=0 #83
2026/05/22-09:49:57.296086 7fb567fff6c0 Level-0 table #88: started
2026/05/22-09:49:57.296112 7fb567fff6c0 Level-0 table #88: 0 bytes OK
2026/05/22-09:49:57.302010 7fb567fff6c0 Delete type=0 #86
2026/05/22-09:49:57.319148 7fb567fff6c0 Manual compaction at level-0 from '!folders!K9aiFu0dE6UYiXBd' @ 72057594037927935 : 1 .. '!items!zyqLzmpbHxK3jt5q' @ 0 : 0; will stop at (end)
2026/06/01-08:00:33.882857 7f52c53fc6c0 Recovering log #167
2026/06/01-08:00:33.938200 7f52c53fc6c0 Delete type=3 #165
2026/06/01-08:00:33.938259 7f52c53fc6c0 Delete type=0 #167
2026/06/01-08:25:27.517975 7f52c4bfb6c0 Level-0 table #172: started
2026/06/01-08:25:27.518020 7f52c4bfb6c0 Level-0 table #172: 0 bytes OK
2026/06/01-08:25:27.527546 7f52c4bfb6c0 Delete type=0 #170
2026/06/01-08:25:27.538006 7f52c4bfb6c0 Manual compaction at level-0 from '!folders!K9aiFu0dE6UYiXBd' @ 72057594037927935 : 1 .. '!items!zyqLzmpbHxK3jt5q' @ 0 : 0; will stop at (end)
+7 -7
View File
@@ -1,7 +1,7 @@
2026/05/09-23:56:26.228807 7fe7211fe6c0 Recovering log #79
2026/05/09-23:56:26.239813 7fe7211fe6c0 Delete type=3 #77
2026/05/09-23:56:26.239859 7fe7211fe6c0 Delete type=0 #79
2026/05/09-23:58:32.093072 7fe6d37fe6c0 Level-0 table #84: started
2026/05/09-23:58:32.093102 7fe6d37fe6c0 Level-0 table #84: 0 bytes OK
2026/05/09-23:58:32.100189 7fe6d37fe6c0 Delete type=0 #82
2026/05/09-23:58:32.106644 7fe6d37fe6c0 Manual compaction at level-0 from '!folders!K9aiFu0dE6UYiXBd' @ 72057594037927935 : 1 .. '!items!zyqLzmpbHxK3jt5q' @ 0 : 0; will stop at (end)
2026/05/28-20:45:21.096499 7f3977fff6c0 Recovering log #163
2026/05/28-20:45:21.107112 7f3977fff6c0 Delete type=3 #161
2026/05/28-20:45:21.107149 7f3977fff6c0 Delete type=0 #163
2026/05/28-20:46:40.064748 7f39767fc6c0 Level-0 table #168: started
2026/05/28-20:46:40.064805 7f39767fc6c0 Level-0 table #168: 0 bytes OK
2026/05/28-20:46:40.070966 7f39767fc6c0 Delete type=0 #166
2026/05/28-20:46:40.093671 7f39767fc6c0 Manual compaction at level-0 from '!folders!K9aiFu0dE6UYiXBd' @ 72057594037927935 : 1 .. '!items!zyqLzmpbHxK3jt5q' @ 0 : 0; will stop at (end)
+1 -1
View File
@@ -1 +1 @@
MANIFEST-000072
MANIFEST-000156
+7 -7
View File
@@ -1,7 +1,7 @@
2026/05/22-09:28:26.020644 7fb57d7ed6c0 Recovering log #70
2026/05/22-09:28:26.031504 7fb57d7ed6c0 Delete type=3 #68
2026/05/22-09:28:26.031624 7fb57d7ed6c0 Delete type=0 #70
2026/05/22-09:49:57.312571 7fb567fff6c0 Level-0 table #75: started
2026/05/22-09:49:57.312612 7fb567fff6c0 Level-0 table #75: 0 bytes OK
2026/05/22-09:49:57.318950 7fb567fff6c0 Delete type=0 #73
2026/05/22-09:49:57.319188 7fb567fff6c0 Manual compaction at level-0 from '!tables!PPsxQgHwLCQ2gjSW' @ 72057594037927935 : 1 .. '!tables.results!wJZXUo4q5b5vE3Dy.zFTPLMc9zOl5hISV' @ 0 : 0; will stop at (end)
2026/06/01-08:00:33.958934 7f52c6bff6c0 Recovering log #154
2026/06/01-08:00:34.023819 7f52c6bff6c0 Delete type=3 #152
2026/06/01-08:00:34.023899 7f52c6bff6c0 Delete type=0 #154
2026/06/01-08:25:27.615107 7f52c4bfb6c0 Level-0 table #159: started
2026/06/01-08:25:27.615150 7f52c4bfb6c0 Level-0 table #159: 0 bytes OK
2026/06/01-08:25:27.624874 7f52c4bfb6c0 Delete type=0 #157
2026/06/01-08:25:27.643263 7f52c4bfb6c0 Manual compaction at level-0 from '!tables!PPsxQgHwLCQ2gjSW' @ 72057594037927935 : 1 .. '!tables.results!wJZXUo4q5b5vE3Dy.zFTPLMc9zOl5hISV' @ 0 : 0; will stop at (end)
+7 -7
View File
@@ -1,7 +1,7 @@
2026/05/09-23:56:26.242643 7fe7219ff6c0 Recovering log #66
2026/05/09-23:56:26.252924 7fe7219ff6c0 Delete type=3 #64
2026/05/09-23:56:26.252971 7fe7219ff6c0 Delete type=0 #66
2026/05/09-23:58:32.087004 7fe6d37fe6c0 Level-0 table #71: started
2026/05/09-23:58:32.087037 7fe6d37fe6c0 Level-0 table #71: 0 bytes OK
2026/05/09-23:58:32.092951 7fe6d37fe6c0 Delete type=0 #69
2026/05/09-23:58:32.106635 7fe6d37fe6c0 Manual compaction at level-0 from '!tables!PPsxQgHwLCQ2gjSW' @ 72057594037927935 : 1 .. '!tables.results!wJZXUo4q5b5vE3Dy.zFTPLMc9zOl5hISV' @ 0 : 0; will stop at (end)
2026/05/28-20:45:21.112773 7f3976ffd6c0 Recovering log #150
2026/05/28-20:45:21.122136 7f3976ffd6c0 Delete type=3 #148
2026/05/28-20:45:21.122181 7f3976ffd6c0 Delete type=0 #150
2026/05/28-20:46:40.081166 7f39767fc6c0 Level-0 table #155: started
2026/05/28-20:46:40.081191 7f39767fc6c0 Level-0 table #155: 0 bytes OK
2026/05/28-20:46:40.087200 7f39767fc6c0 Delete type=0 #153
2026/05/28-20:46:40.093692 7f39767fc6c0 Manual compaction at level-0 from '!tables!PPsxQgHwLCQ2gjSW' @ 72057594037927935 : 1 .. '!tables.results!wJZXUo4q5b5vE3Dy.zFTPLMc9zOl5hISV' @ 0 : 0; will stop at (end)
+1 -1
View File
@@ -1 +1 @@
MANIFEST-000006
MANIFEST-000091
+8 -15
View File
@@ -1,15 +1,8 @@
2026/05/22-09:28:26.037049 7fb57dfee6c0 Recovering log #4
2026/05/22-09:28:26.047411 7fb57dfee6c0 Delete type=3 #2
2026/05/22-09:28:26.047498 7fb57dfee6c0 Delete type=0 #4
2026/05/22-09:49:57.302133 7fb567fff6c0 Level-0 table #9: started
2026/05/22-09:49:57.305585 7fb567fff6c0 Level-0 table #9: 3183 bytes OK
2026/05/22-09:49:57.312423 7fb567fff6c0 Delete type=0 #7
2026/05/22-09:49:57.319164 7fb567fff6c0 Manual compaction at level-0 from '!journal!69Da9YvF9BfOV7oK' @ 72057594037927935 : 1 .. '!journal.pages!69Da9YvF9BfOV7oK.XM0eLkgKXPyskV65' @ 0 : 0; will stop at (end)
2026/05/22-09:49:57.319233 7fb567fff6c0 Manual compaction at level-1 from '!journal!69Da9YvF9BfOV7oK' @ 72057594037927935 : 1 .. '!journal.pages!69Da9YvF9BfOV7oK.XM0eLkgKXPyskV65' @ 0 : 0; will stop at '!journal.pages!69Da9YvF9BfOV7oK.XM0eLkgKXPyskV65' @ 3 : 1
2026/05/22-09:49:57.319246 7fb567fff6c0 Compacting 1@1 + 1@2 files
2026/05/22-09:49:57.322612 7fb567fff6c0 Generated table #10@1: 2 keys, 3183 bytes
2026/05/22-09:49:57.322655 7fb567fff6c0 Compacted 1@1 + 1@2 files => 3183 bytes
2026/05/22-09:49:57.328541 7fb567fff6c0 compacted to: files[ 0 0 1 0 0 0 0 ]
2026/05/22-09:49:57.328673 7fb567fff6c0 Delete type=2 #5
2026/05/22-09:49:57.328793 7fb567fff6c0 Delete type=2 #9
2026/05/22-09:49:57.351951 7fb567fff6c0 Manual compaction at level-1 from '!journal.pages!69Da9YvF9BfOV7oK.XM0eLkgKXPyskV65' @ 3 : 1 .. '!journal.pages!69Da9YvF9BfOV7oK.XM0eLkgKXPyskV65' @ 0 : 0; will stop at (end)
2026/06/01-08:00:34.033489 7f52c5bfd6c0 Recovering log #89
2026/06/01-08:00:34.082405 7f52c5bfd6c0 Delete type=3 #87
2026/06/01-08:00:34.082456 7f52c5bfd6c0 Delete type=0 #89
2026/06/01-08:25:27.527672 7f52c4bfb6c0 Level-0 table #94: started
2026/06/01-08:25:27.527708 7f52c4bfb6c0 Level-0 table #94: 0 bytes OK
2026/06/01-08:25:27.537856 7f52c4bfb6c0 Delete type=0 #92
2026/06/01-08:25:27.538199 7f52c4bfb6c0 Manual compaction at level-0 from '!journal!69Da9YvF9BfOV7oK' @ 72057594037927935 : 1 .. '!journal.pages!69Da9YvF9BfOV7oK.XM0eLkgKXPyskV65' @ 0 : 0; will stop at (end)
2026/06/01-08:25:27.566799 7f52c4bfb6c0 Manual compaction at level-1 from '!journal!69Da9YvF9BfOV7oK' @ 72057594037927935 : 1 .. '!journal.pages!69Da9YvF9BfOV7oK.XM0eLkgKXPyskV65' @ 0 : 0; will stop at (end)
+8 -5
View File
@@ -1,5 +1,8 @@
2026/05/22-08:07:40.563282 7f63427ef6c0 Delete type=3 #1
2026/05/22-08:07:40.567990 7f6323fff6c0 Level-0 table #5: started
2026/05/22-08:07:40.571414 7f6323fff6c0 Level-0 table #5: 3056 bytes OK
2026/05/22-08:07:40.577623 7f6323fff6c0 Delete type=0 #3
2026/05/22-08:07:40.577857 7f6323fff6c0 Manual compaction at level-0 from '!journal!69Da9YvF9BfOV7oK' @ 72057594037927935 : 1 .. '!journal.pages!69Da9YvF9BfOV7oK.XM0eLkgKXPyskV65' @ 0 : 0; will stop at (end)
2026/05/28-20:45:21.125760 7f39777fe6c0 Recovering log #85
2026/05/28-20:45:21.135844 7f39777fe6c0 Delete type=3 #83
2026/05/28-20:45:21.135894 7f39777fe6c0 Delete type=0 #85
2026/05/28-20:46:40.071060 7f39767fc6c0 Level-0 table #90: started
2026/05/28-20:46:40.071086 7f39767fc6c0 Level-0 table #90: 0 bytes OK
2026/05/28-20:46:40.081072 7f39767fc6c0 Delete type=0 #88
2026/05/28-20:46:40.093682 7f39767fc6c0 Manual compaction at level-0 from '!journal!69Da9YvF9BfOV7oK' @ 72057594037927935 : 1 .. '!journal.pages!69Da9YvF9BfOV7oK.XM0eLkgKXPyskV65' @ 0 : 0; will stop at (end)
2026/05/28-20:46:40.093703 7f39767fc6c0 Manual compaction at level-1 from '!journal!69Da9YvF9BfOV7oK' @ 72057594037927935 : 1 .. '!journal.pages!69Da9YvF9BfOV7oK.XM0eLkgKXPyskV65' @ 0 : 0; will stop at (end)
Binary file not shown.
Binary file not shown.
+8 -1
View File
@@ -879,9 +879,16 @@
.chat-targeting {
position: relative;
z-index: 1;
display: grid;
display: flex;
gap: 0.4rem;
margin-top: 0.4rem;
flex-wrap: wrap;
align-items: end;
}
.chat-targeting .chat-action-button {
padding: 0.35rem 0.65rem;
min-height: 1.75rem;
font-size: 0.82rem;
}
.chat-control {
display: grid;
File diff suppressed because one or more lines are too long
-4
View File
@@ -46,10 +46,6 @@
<span>Attaques distance</span>
<input type="number" name="system.combat.attaquesDistance" value="{{system.combat.attaquesDistance}}">
</label>
<label>
<span>Bonus degats</span>
<input type="number" name="system.combat.degatsBonus" value="{{system.combat.degatsBonus}}">
</label>
</div>
</header>
+2 -3
View File
@@ -14,7 +14,6 @@
{{#if modeLabel}}<span class="chat-pill">{{modeLabel}}</span>{{/if}}
<span class="chat-pill success">Dé {{keptDieLabel}}</span>
{{#if damageCapped}}<span class="chat-pill">{{localize "DNC.Chat.DamageCapped" damage=effectiveDamage dv=martialDvLabel}}</span>{{/if}}
{{#if bonus}}<span class="chat-pill">Bonus +{{bonus}}</span>{{/if}}
</div>
<p class="chat-formula">{{formula}}</p>
{{#if rollDieLabels.[1]}}
@@ -23,14 +22,14 @@
<p class="roll-values">{{#each rollDieLabels}}<span>{{this}}</span>{{/each}}</p>
</div>
{{/if}}
<p class="chat-note"><strong>Base</strong> : {{baseDamage}}{{#if damageCapped}} · <strong>{{localize "DNC.Chat.MartialDv"}}</strong> : {{martialDvLabel}} · <strong>{{localize "DNC.Chat.EffectiveDamage"}}</strong> : {{effectiveDamage}}{{/if}}{{#if bonus}} · <strong>Bonus</strong> : +{{bonus}}{{/if}}</p>
<p class="chat-note"><strong>Base</strong> : {{baseDamage}}{{#if damageCapped}} · <strong>{{localize "DNC.Chat.MartialDv"}}</strong> : {{martialDvLabel}} · <strong>{{localize "DNC.Chat.EffectiveDamage"}}</strong> : {{effectiveDamage}}{{/if}}</p>
<div class="chat-targeting">
<label class="chat-control">
<span class="chat-keyline-label">Cible</span>
<select class="chat-select" data-role="damage-target" {{#unless hasTargets}}disabled{{/unless}}>
{{#if hasTargets}}
{{#each targets}}
<option value="{{this.tokenUuid}}">{{this.label}}</option>
<option value="{{this.tokenUuid}}"{{#if this.isSelected}} selected{{/if}}>{{this.label}}</option>
{{/each}}
{{else}}
<option value="">Aucune cible sur la scène</option>
+3 -4
View File
@@ -3,13 +3,12 @@
{{#if damageCapped}}
<p>{{localize "DNC.Dialog.DamageCappedByDv" dv=martialDvLabel damage=damageFormula base=damageBase}}</p>
{{/if}}
<p>{{localize "DNC.Dialog.ActorDamageBonus"}} : <strong>{{actorBonus}}</strong></p>
<label>
<span>{{localize "DNC.UI.Mode"}}</span>
<select name="mode">
<option value="normal">{{localize "DNC.UI.ModeNormal"}}</option>
<option value="avantage">{{localize "DNC.UI.ModeAdvantage"}}</option>
<option value="desavantage">{{localize "DNC.UI.ModeDisadvantage"}}</option>
<option value="normal" {{#if (eq defaultMode "normal")}}selected{{/if}}>{{localize "DNC.UI.ModeNormal"}}</option>
<option value="avantage" {{#if (eq defaultMode "avantage")}}selected{{/if}}>{{localize "DNC.UI.ModeAdvantage"}}</option>
<option value="desavantage" {{#if (eq defaultMode "desavantage")}}selected{{/if}}>{{localize "DNC.UI.ModeDisadvantage"}}</option>
</select>
</label>
</div>