Compare commits

...

4 Commits

Author SHA1 Message Date
Sven Balzer
f21a5ebf06 allow spell rolls to be affeted by MR 2025-05-24 16:20:21 +02:00
Sven Balzer
ae0ca2018f add simple zauber rolls 2025-05-24 15:55:41 +02:00
Sven Balzer
1cb0f89dff add text shadow to die values 2025-05-24 15:02:09 +02:00
Sven Balzer
d6983cf9c7 move zauber into their own tab 2025-05-24 14:59:13 +02:00
7 changed files with 186 additions and 34 deletions

View File

@ -22,6 +22,7 @@
<a class="fas fa-list {{#if (eq tabGroups.primary 'talente') }}active{{/if}}" data-action="tab" data-group="primary" data-tab="talente" data-tooltip-direction="RIGHT" data-tooltip="{{localize "DSA41.character.talente"}}"></a>
<a class="fas fa-sack {{#if (eq tabGroups.primary 'inventar') }}active{{/if}}" data-action="tab" data-group="primary" data-tab="inventar" data-tooltip-direction="RIGHT" data-tooltip="{{localize "DSA41.character.inventar"}}"></a>
<a class="fas fa-swords {{#if (eq tabGroups.primary 'kampf') }}active{{/if}}" data-action="tab" data-group="primary" data-tab="kampf" data-tooltip-direction="RIGHT" data-tooltip="{{localize "DSA41.character.kampf"}}"></a>
<a class="fas fa-bolt {{#if (eq tabGroups.primary 'zauber') }}active{{/if}}" data-action="tab" data-group="primary" data-tab="zauber" data-tooltip-direction="RIGHT" data-tooltip="{{localize "DSA41.character.zauber"}}"></a>
</nav>
<div class="scroll-container">
@ -474,29 +475,6 @@
{{/each}}
</div>
<div class="list Zauber">
<div class="list-header ">
<div>{{localize "DSA41.kampf.zauber"}}</div>
<div class="center"></div>
</div>
{{#unless (ne actor.itemTypes.Zauber.length 0)}}
<div class="list-item">{{localize "DSA41.list_empty"}}</div>
{{/unless}}
{{#each actor.itemTypes.Zauber}}
<div class="list-item" data-item-id="{{_id}}">
<div class="row" data-action="item-open" data-tooltip="{{system.beschreibung}}">
<img class="item-image" src="{{img}}" title="{{name}}">
<div class="col">
<span>{{name}}</span>
</div>
</div>
<button class="right" data-action="post-zauber">Post to Chat</button>
</div>
{{/each}}
</div>
<div class="list Ruestung">
<div class="list-header rowspan2">
<div class="rowspan2">{{localize "DSA41.kampf.ruestungen"}}</div>
@ -577,6 +555,43 @@
{{/each}}
</div>
</div>
<div class="tab Zauber {{#if (eq tabGroups.primary 'zauber')}}active{{/if}}" data-group="primary" data-tab="zauber">
<div class="list Zauber subgrid-columns">
<div class="list-header ">
<div>{{localize "DSA41.kampf.zauber"}}</div>
<div></div>
<div class="center">Eigenschaften</div>
<div></div>
<div class="center">{{localize "DSA41.zauber.label_zauberfertigkeitswert"}}</div>
<div></div>
</div>
{{#unless (ne actor.itemTypes.Zauber.length 0)}}
<div class="list-item">{{localize "DSA41.list_empty"}}</div>
{{/unless}}
{{#each actor.itemTypes.Zauber}}
<div class="list-item" data-item-id="{{_id}}">
<div class="row" data-action="item-open" data-tooltip-direction="LEFT" data-tooltip="{{system.beschreibung}}">
<img class="item-image" src="{{img}}" title="{{name}}">
<div class="col">
<span>{{name}}</span>
</div>
</div>
<div></div>
<div class="center" data-action="roll" data-roll-type="zauber">
{{>die-type type=system.attribute1}}
{{>die-type type=system.attribute2}}
{{>die-type type=system.attribute3}}
</div>
<div></div>
<div>{{>editable-input type="number" data-name="system.zauberfertigkeitswert" value=system.zauberfertigkeitswert}}</div>
<div class="center fas fa-trash" data-action="item-delete"></div>
</div>
{{/each}}
</div>
</div>
</div>
</div>
</div>

39
src/Chat/Zauber.hbs Normal file
View File

@ -0,0 +1,39 @@
<div class="zauber_chat_message">
<h3>{{zauber.name}} ({{localize (concat "DSA41.chat.zauberfertigkeitswert_short")}}: {{zauber.system.zauberfertigkeitswert}}{{#if (ne modifikator 0)}} + {{modifikator}}{{/if}}{{#if (ne magieresistenz 0)}} + {{magieresistenz}}{{/if}})</h3>
<div class="info">
<div>
<div>{{localize (concat "DSA41.chat.attribute")}}</div>
<div>{{localize (concat "DSA41.chat.value")}}</div>
<div>{{localize (concat "DSA41.chat.roll")}}</div>
<div>{{localize (concat "DSA41.chat.zauberfertigkeitswert_short")}}</div>
</div>
<div>
<div>{{localize (concat "DSA41.attributes.long." attribute1.type)}}</div>
<div>{{attribute1.value}}</div>
<div>{{roll1}}</div>
<div>{{needed_zfw_roll1}}</div>
</div>
<div>
<div>{{localize (concat "DSA41.attributes.long." attribute2.type)}}</div>
<div>{{attribute2.value}}</div>
<div>{{roll2}}</div>
<div>{{needed_zfw_roll2}}</div>
</div>
<div>
<div>{{localize (concat "DSA41.attributes.long." attribute3.type)}}</div>
<div>{{attribute3.value}}</div>
<div>{{roll3}}</div>
<div>{{needed_zfw_roll3}}</div>
</div>
</div>
<div>
{{localize (concat "DSA41.chat.result")}}:
{{#if (lt leftover_zfw 0)}}
<b>{{localize (concat "DSA41.chat.failure")}}</b>
{{else}}
<b>{{localize (concat "DSA41.chat.success")}}</b>
{{/if}}
({{localize (concat "DSA41.chat.zauberfertigkeitswert_short")}}: {{leftover_zfw}})
</div>
</div>

9
src/Dialogs/Zauber.hbs Normal file
View File

@ -0,0 +1,9 @@
<div>
<span class="colspan2">{{localize "DSA41.kampf.modifikator"}}</span>
<input class="colspan2" type="number" name="modifikator" value="{{lookup formData "modifikator"}}">
{{#if options.item.system.magieresistenz}}
<span class="colspan2">{{localize "DSA41.zauber.label_magieresistenz"}}</span>
<input class="colspan2" type="number" name="magieresistenz" value="{{lookup formData "magieresistenz"}}">
{{/if}}
</div>

View File

@ -24,6 +24,9 @@
<span>{{localize "DSA41.zauber.merkmale.label"}}</span>
{{DSA41_input "system.merkmale"}}
<span>{{localize "DSA41.zauber.label_magieresistenz"}}</span>
{{DSA41_input "system.magieresistenz"}}
</div>
<div>

View File

@ -79,7 +79,8 @@
"value": "Wert",
"roll": "Wurf",
"talentwert_short": "TaW",
"talentwert_short": "TaW",
"zauberfertigkeitswert_short": "ZfW",
"targets": "Ziele",
"trefferpunkte_apply": "Zuweisen"
@ -146,7 +147,8 @@
"constitution": "Konstitution",
"strength": "Körperkraft",
"talent": "Talent",
"talent": "Talent",
"zauber": "Zauber",
"attacke": "Attacke",
"parade": "Parade",
@ -161,7 +163,8 @@
"talente": "Talente",
"inventar": "Inventar",
"kampf": "Kampf",
"allgemein": "Allgemein"
"allgemein": "Allgemein",
"zauber": "Zauber"
},
"allgemein": {
@ -538,9 +541,11 @@
},
"zauber": {
"label_komplexitaet": "Komplexität",
"label_zauberdauer": "Zauberdauer",
"label_wirkungsdauer": "Wirkungsdauer",
"label_komplexitaet": "Komplexität",
"label_zauberdauer": "Zauberdauer",
"label_wirkungsdauer": "Wirkungsdauer",
"label_zauberfertigkeitswert": "Zauberfertigkeitswert",
"label_magieresistenz": "Magieresistenz",
"merkmale": {
"label": "Merkmale",

View File

@ -236,6 +236,8 @@ html {
width: 3.5em;
height: 3.5em;
text-shadow: 1px 1px 1px black;
& > * {
grid-row: 1;
grid-column: 1;
@ -598,10 +600,6 @@ html {
}
}
& .Zauber {
grid-template-columns: minmax(0, max-content) minmax(0, auto);
}
& .Ruestung {
grid-template-columns: 2fr repeat(8, 1fr) repeat(2, 1.5fr);
text-align: center;
@ -611,6 +609,14 @@ html {
grid-template-columns: minmax(min-content, max-content) auto min-content;
}
}
&[data-tab="zauber"] {
grid-template-columns: minmax(0, max-content) auto minmax(0, max-content) auto minmax(0, max-content) min-content;
& > * {
grid-column: 1 / -1;
}
}
}
}
@ -638,6 +644,24 @@ html {
}
}
.zauber_chat_message {
& .info {
display: grid;
grid-template-columns: repeat(4, minmax(min-content, 1fr));
text-wrap: nowrap;
& > * {
display: grid;
grid-column: 1 / -1;
grid-template-columns: subgrid;
& > *:not(:first-child) {
text-align: center;
}
}
}
}
#tooltip.DSA41 {
max-width: 650px;

View File

@ -147,6 +147,7 @@ Hooks.once("init", async function() {
"CHAT_HEADER": "systems/dsa-4th-edition/src/Chat/Header.hbs",
"TrefferpunkteTargets": "systems/dsa-4th-edition/src/Chat/TrefferpunkteTargets.hbs",
"talent_chat": "systems/dsa-4th-edition/src/Chat/Talent.hbs",
"zauber_chat": "systems/dsa-4th-edition/src/Chat/Zauber.hbs",
});
});
@ -1114,6 +1115,8 @@ class DSA41_ZauberData extends TypeDataModel {
},
})),
magieresistenz: new BooleanField({ initial: false }),
haus: new BooleanField({ initial: false }),
zauberfertigkeitswert: new NumberField({ integer: true, initial: 0 }),
@ -1142,6 +1145,7 @@ class DSA41_Dialog extends DSA41_ApplicationMixin(ApplicationV2) {
static PARTS = {
Eigenschaft: { template: "systems/dsa-4th-edition/src/Dialogs/Attribute.hbs" },
Talent: { template: "systems/dsa-4th-edition/src/Dialogs/Talent.hbs" },
Zauber: { template: "systems/dsa-4th-edition/src/Dialogs/Zauber.hbs" },
Attacke: { template: "systems/dsa-4th-edition/src/Dialogs/Attacke.hbs" },
Parade: { template: "systems/dsa-4th-edition/src/Dialogs/Parade.hbs" },
@ -1291,7 +1295,7 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
modifikator: -data.modifikator,
attribute1: { type: item.system.attribute1, value: attribute1 },
attribute2: { type: item.system.attribute2, value: attribute3 },
attribute2: { type: item.system.attribute2, value: attribute2 },
attribute3: { type: item.system.attribute3, value: attribute3 },
roll1: roll1,
@ -1436,6 +1440,59 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
return;
}
if (roll_type == "zauber") {
const title = game.i18n.localize("DSA41.roll_types." + roll_type) + ": " + item.name;
const data = await DSA41_Dialog.wait("Zauber", { window: {title: title}, item: item });
const zauberfertigkeitswert = item.system.zauberfertigkeitswert - data.modifikator - data.magieresistenz;
const roll_modifier = zauberfertigkeitswert < 0 ? -zauberfertigkeitswert: 0;
const roll1 = (await new Roll("1d20").evaluate()).total + roll_modifier;
const roll2 = (await new Roll("1d20").evaluate()).total + roll_modifier;
const roll3 = (await new Roll("1d20").evaluate()).total + roll_modifier;
const attribute1 = this.document.system.computed.attributes[item.system.attribute1];
const attribute2 = this.document.system.computed.attributes[item.system.attribute2];
const attribute3 = this.document.system.computed.attributes[item.system.attribute3];
const needed_zfw_roll1 = Math.max(roll1 - attribute1, 0);
const needed_zfw_roll2 = Math.max(roll2 - attribute2, 0);
const needed_zfw_roll3 = Math.max(roll3 - attribute3, 0);
const leftover_zfw = Math.max(zauberfertigkeitswert, 0) - needed_zfw_roll1 - needed_zfw_roll2 - needed_zfw_roll3;
const context = {
zauber: item,
modifikator: -data.modifikator,
magieresistenz: -data.magieresistenz,
attribute1: { type: item.system.attribute1, value: attribute1 },
attribute2: { type: item.system.attribute2, value: attribute2 },
attribute3: { type: item.system.attribute3, value: attribute3 },
roll1: roll1,
roll2: roll2,
roll3: roll3,
needed_zfw_roll1: -needed_zfw_roll1,
needed_zfw_roll2: -needed_zfw_roll2,
needed_zfw_roll3: -needed_zfw_roll3,
leftover_zfw: Math.min(leftover_zfw, item.system.zauberfertigkeitswert),
};
const message = await ChatMessage.create(
{
content: await renderTemplate("zauber_chat", context),
speaker: { actor: this.actor },
sound: CONFIG.sounds.dice,
},
);
return;
}
let roll = new Roll(roll_formula, this.document.system);
roll.toMessage({
speaker: ChatMessage.getSpeaker({ actor: this.document }),