add simple zauber rolls
This commit is contained in:
parent
1cb0f89dff
commit
ae0ca2018f
@ -580,7 +580,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div class="center" data-action="post-zauber" data-roll-type="zauber">
|
<div class="center" data-action="roll" data-roll-type="zauber">
|
||||||
{{>die-type type=system.attribute1}}
|
{{>die-type type=system.attribute1}}
|
||||||
{{>die-type type=system.attribute2}}
|
{{>die-type type=system.attribute2}}
|
||||||
{{>die-type type=system.attribute3}}
|
{{>die-type type=system.attribute3}}
|
||||||
|
|||||||
39
src/Chat/Zauber.hbs
Normal file
39
src/Chat/Zauber.hbs
Normal 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}})</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>
|
||||||
4
src/Dialogs/Zauber.hbs
Normal file
4
src/Dialogs/Zauber.hbs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<div>
|
||||||
|
<span class="colspan2">{{localize "DSA41.kampf.modifikator"}}</span>
|
||||||
|
<input class="colspan2" type="number" name="modifikator" value="{{lookup formData "modifikator"}}">
|
||||||
|
</div>
|
||||||
@ -79,7 +79,8 @@
|
|||||||
"value": "Wert",
|
"value": "Wert",
|
||||||
"roll": "Wurf",
|
"roll": "Wurf",
|
||||||
|
|
||||||
"talentwert_short": "TaW",
|
"talentwert_short": "TaW",
|
||||||
|
"zauberfertigkeitswert_short": "ZfW",
|
||||||
|
|
||||||
"targets": "Ziele",
|
"targets": "Ziele",
|
||||||
"trefferpunkte_apply": "Zuweisen"
|
"trefferpunkte_apply": "Zuweisen"
|
||||||
@ -146,7 +147,8 @@
|
|||||||
"constitution": "Konstitution",
|
"constitution": "Konstitution",
|
||||||
"strength": "Körperkraft",
|
"strength": "Körperkraft",
|
||||||
|
|
||||||
"talent": "Talent",
|
"talent": "Talent",
|
||||||
|
"zauber": "Zauber",
|
||||||
|
|
||||||
"attacke": "Attacke",
|
"attacke": "Attacke",
|
||||||
"parade": "Parade",
|
"parade": "Parade",
|
||||||
|
|||||||
18
src/main.css
18
src/main.css
@ -644,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 {
|
#tooltip.DSA41 {
|
||||||
max-width: 650px;
|
max-width: 650px;
|
||||||
|
|||||||
49
src/main.mjs
49
src/main.mjs
@ -147,6 +147,7 @@ Hooks.once("init", async function() {
|
|||||||
"CHAT_HEADER": "systems/dsa-4th-edition/src/Chat/Header.hbs",
|
"CHAT_HEADER": "systems/dsa-4th-edition/src/Chat/Header.hbs",
|
||||||
"TrefferpunkteTargets": "systems/dsa-4th-edition/src/Chat/TrefferpunkteTargets.hbs",
|
"TrefferpunkteTargets": "systems/dsa-4th-edition/src/Chat/TrefferpunkteTargets.hbs",
|
||||||
"talent_chat": "systems/dsa-4th-edition/src/Chat/Talent.hbs",
|
"talent_chat": "systems/dsa-4th-edition/src/Chat/Talent.hbs",
|
||||||
|
"zauber_chat": "systems/dsa-4th-edition/src/Chat/Zauber.hbs",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1142,6 +1143,7 @@ class DSA41_Dialog extends DSA41_ApplicationMixin(ApplicationV2) {
|
|||||||
static PARTS = {
|
static PARTS = {
|
||||||
Eigenschaft: { template: "systems/dsa-4th-edition/src/Dialogs/Attribute.hbs" },
|
Eigenschaft: { template: "systems/dsa-4th-edition/src/Dialogs/Attribute.hbs" },
|
||||||
Talent: { template: "systems/dsa-4th-edition/src/Dialogs/Talent.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" },
|
Attacke: { template: "systems/dsa-4th-edition/src/Dialogs/Attacke.hbs" },
|
||||||
Parade: { template: "systems/dsa-4th-edition/src/Dialogs/Parade.hbs" },
|
Parade: { template: "systems/dsa-4th-edition/src/Dialogs/Parade.hbs" },
|
||||||
@ -1437,6 +1439,53 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (roll_type == "zauber") {
|
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;
|
||||||
|
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,
|
||||||
|
|
||||||
|
attribute1: { type: item.system.attribute1, value: attribute1 },
|
||||||
|
attribute2: { type: item.system.attribute2, value: attribute3 },
|
||||||
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user