Compare commits

...

2 Commits

Author SHA1 Message Date
Sven Balzer
b6b0411473 add anzahl to Gegenstaende 2025-11-09 12:44:37 +01:00
Sven Balzer
bf5a3fa06b invert modifikator for talente 2025-10-24 00:39:32 +02:00
5 changed files with 34 additions and 7 deletions

View File

@ -357,6 +357,7 @@
<div>{{localize "DSA41.inventar.bewaffnung"}}</div> <div>{{localize "DSA41.inventar.bewaffnung"}}</div>
<div></div> <div></div>
<div></div> <div></div>
<div></div>
<div class="center">{{localize "DSA41.weight.label"}}</div> <div class="center">{{localize "DSA41.weight.label"}}</div>
<div></div> <div></div>
</div> </div>
@ -380,6 +381,7 @@
</div> </div>
</div> </div>
<div></div> <div></div>
<div></div>
<div class="center fas fa-sword" data-action="toggle_equipped" data-equipped="{{system.angelegt}}"></div> <div class="center fas fa-sword" data-action="toggle_equipped" data-equipped="{{system.angelegt}}"></div>
<div class="center">{{this.system.gewicht.value}} {{localize (concat "DSA41.weight." this.system.gewicht.unit)}}</div> <div class="center">{{this.system.gewicht.value}} {{localize (concat "DSA41.weight." this.system.gewicht.unit)}}</div>
<div class="center fas fa-trash" data-action="item-delete"></div> <div class="center fas fa-trash" data-action="item-delete"></div>
@ -392,7 +394,9 @@
<div class="row">{{localize "DSA41.inventar.ruestungen"}}</div> <div class="row">{{localize "DSA41.inventar.ruestungen"}}</div>
<div></div> <div></div>
<div></div> <div></div>
<div></div>
<div class="center">{{localize "DSA41.weight.label"}}</div> <div class="center">{{localize "DSA41.weight.label"}}</div>
<div></div>
</div> </div>
{{#unless (ne actor.itemTypes.Ruestung.length 0)}} {{#unless (ne actor.itemTypes.Ruestung.length 0)}}
@ -406,6 +410,7 @@
<span class="center">{{this.name}}</span> <span class="center">{{this.name}}</span>
</div> </div>
<div></div> <div></div>
<div></div>
<div class="center fas fa-shield-halved" data-action="toggle_equipped" data-equipped="{{system.angelegt}}"></div> <div class="center fas fa-shield-halved" data-action="toggle_equipped" data-equipped="{{system.angelegt}}"></div>
<div class="center">{{this.system.gewicht.value}} {{localize (concat "DSA41.weight." this.system.gewicht.unit)}}</div> <div class="center">{{this.system.gewicht.value}} {{localize (concat "DSA41.weight." this.system.gewicht.unit)}}</div>
<div class="center fas fa-trash" data-action="item-delete"></div> <div class="center fas fa-trash" data-action="item-delete"></div>
@ -417,8 +422,10 @@
<div class="list-header"> <div class="list-header">
<div>{{localize "DSA41.inventar.gegenstaende"}}</div> <div>{{localize "DSA41.inventar.gegenstaende"}}</div>
<div></div> <div></div>
<div class="center">{{localize "DSA41.inventar.anzahl"}}</div>
<div></div> <div></div>
<div class="center">{{localize "DSA41.weight.label"}}</div> <div class="center">{{localize "DSA41.weight.label"}}</div>
<div></div>
</div> </div>
{{#unless (ne actor.itemTypes.Gegenstand.length 0)}} {{#unless (ne actor.itemTypes.Gegenstand.length 0)}}
@ -432,8 +439,9 @@
<span class="center">{{this.name}}</span> <span class="center">{{this.name}}</span>
</div> </div>
<div></div> <div></div>
<div class="center anzahl">{{>editable-input type="number" size=(string-length system.anzahl) data-name="system.anzahl" value=system.anzahl}}</div>
<div></div> <div></div>
<div class="center">{{this.system.gewicht.value}} {{localize (concat "DSA41.weight." this.system.gewicht.unit)}}</div> <div class="center">{{mul this.system.gewicht.value this.system.anzahl}} {{localize (concat "DSA41.weight." this.system.gewicht.unit)}}</div>
<div class="center fas fa-trash" data-action="item-delete"></div> <div class="center fas fa-trash" data-action="item-delete"></div>
</div> </div>
{{/each}} {{/each}}

View File

@ -2,7 +2,7 @@
{{#if (eq type "checkbox")}} {{#if (eq type "checkbox")}}
<input type="checkbox" name="{{name}}" {{#if data-name}}data-name="{{data-name}}"{{/if}} {{checked value}}> <input type="checkbox" name="{{name}}" {{#if data-name}}data-name="{{data-name}}"{{/if}} {{checked value}}>
{{else}} {{else}}
<input type="{{type}}" name="{{name}}" {{#if data-name}}data-name="{{data-name}}"{{/if}} value="{{value}}" placeholder="{{placeholder}}"> <input type="{{type}}" name="{{name}}" {{#if data-name}}data-name="{{data-name}}"{{/if}} {{#if size}}size="{{size}}"{{/if}} value="{{value}}" placeholder="{{placeholder}}">
{{/if}} {{/if}}
{{#if placeholder}} {{#if placeholder}}

View File

@ -479,7 +479,8 @@
"inventar": { "inventar": {
"bewaffnung": "Bewaffnung", "bewaffnung": "Bewaffnung",
"ruestungen": "Rüstungen", "ruestungen": "Rüstungen",
"gegenstaende": "Gegenstände" "gegenstaende": "Gegenstände",
"anzahl": "Anzahl"
}, },
"kampf": { "kampf": {

View File

@ -588,7 +588,7 @@ html {
} }
&[data-tab="inventar"] { &[data-tab="inventar"] {
grid-template-columns: minmax(min-content, max-content) auto min-content minmax(min-content, max-content) min-content; grid-template-columns: minmax(min-content, max-content) auto max-content min-content minmax(min-content, max-content) min-content;
& > * { & > * {
grid-column: 1 / -1; grid-column: 1 / -1;
@ -597,6 +597,11 @@ html {
& [data-equipped="false"] { & [data-equipped="false"] {
color: #464c5f; color: #464c5f;
} }
& .anzahl input {
background: transparent;
field-sizing: content;
}
} }
&[data-tab="kampf"] { &[data-tab="kampf"] {

View File

@ -80,6 +80,18 @@ Hooks.once("init", async function() {
] ]
}); });
Handlebars.registerHelper({
"string-length": (value, options) => {
return value.toString().length;
}
});
Handlebars.registerHelper({
"mul": (a, b, options) => {
return a * b;
}
});
Handlebars.registerHelper({ Handlebars.registerHelper({
maybeLocalize: (value, options) => { maybeLocalize: (value, options) => {
const prefix = options.hash.prefix ? options.hash.prefix.string : null; const prefix = options.hash.prefix ? options.hash.prefix.string : null;
@ -927,6 +939,7 @@ class DSA41_GegenstandData extends TypeDataModel {
return { return {
gewicht: new GewichtField(), gewicht: new GewichtField(),
preis: new PreisField(), preis: new PreisField(),
anzahl: new NumberField({ integer: true, initial: 1, min: 0 }),
beschreibung: new StringField({ initial: "" }), beschreibung: new StringField({ initial: "" }),
}; };
@ -1385,9 +1398,9 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
const data = await DSA41_Dialog.wait("Talent", { window: {title: title}, item: item }); const data = await DSA41_Dialog.wait("Talent", { window: {title: title}, item: item });
const eBE = (await new Roll(item.system.behinderung || "0", { BE: this.document.system.computed.kampf.ruestungen_gesamt.gesamt_behinderung }).evaluate()).total; const eBE = (await new Roll(item.system.behinderung || "0", { BE: this.document.system.computed.kampf.ruestungen_gesamt.gesamt_behinderung }).evaluate()).total;
data.modifikator += eBE; data.modifikator -= eBE;
const talentwert = item.system.talentwert - data.modifikator; const talentwert = item.system.talentwert + data.modifikator;
const roll_modifier = talentwert < 0 ? -talentwert: 0; const roll_modifier = talentwert < 0 ? -talentwert: 0;
if (hp_roll_modifier !== 0) if (hp_roll_modifier !== 0)
@ -1409,7 +1422,7 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
const context = { const context = {
talent: item, talent: item,
modifikator: -data.modifikator, modifikator: data.modifikator,
attribute1: { type: item.system.attribute1, value: attribute1 }, attribute1: { type: item.system.attribute1, value: attribute1 },
attribute2: { type: item.system.attribute2, value: attribute2 }, attribute2: { type: item.system.attribute2, value: attribute2 },