Merkmale und Eigenschaften im Chat
This commit is contained in:
1 parent
bbb92445c6
commit
00473d3afc
11 files changed
+158
-62
No files matched your search
@@ -32,7 +32,7 @@ export async function rollSpell(event, target) {
|
||||
}
|
||||
|
||||
let rollTerm = "@die + @skill";
|
||||
let rollFlavor = dataset.name;
|
||||
let rollFlavor = game.i18n.localize("Midgard6.Zaubern") + ": " + item.name;
|
||||
let roll;
|
||||
|
||||
if (dialogResult.spezLevel) {
|
||||
@@ -41,7 +41,7 @@ export async function rollSpell(event, target) {
|
||||
}
|
||||
|
||||
if (dialogResult.customRoll) {
|
||||
roll = new Roll(dialogResult.customRoll);
|
||||
roll = new Roll(dialogResult.customRoll, {}, { title: rollFlavor });
|
||||
} else {
|
||||
roll = new Roll(
|
||||
rollTerm,
|
||||
@@ -54,19 +54,31 @@ export async function rollSpell(event, target) {
|
||||
);
|
||||
}
|
||||
|
||||
if (item.system.eigenschaften.schaden) {
|
||||
const attackRoll = await roll.evaluate();
|
||||
roll = [
|
||||
attackRoll,
|
||||
await new Roll(
|
||||
"@die",
|
||||
{ die: item.system.eigenschaften.schaden },
|
||||
{ title: game.i18n.localize("Midgard6.Schaden") }
|
||||
).evaluate()
|
||||
];
|
||||
} else {
|
||||
// Execute the roll
|
||||
await roll.evaluate();
|
||||
}
|
||||
|
||||
// The parsed terms of the roll formula
|
||||
console.log("Roll:", roll); // [Die, OperatorTerm, NumericTerm, OperatorTerm, NumericTerm]
|
||||
|
||||
// Execute the roll
|
||||
await roll.evaluate();
|
||||
|
||||
const chatData = {
|
||||
rolls: roll,
|
||||
speaker: ChatMessage.getSpeaker(),
|
||||
flags: {
|
||||
"midgard6-lvd": {
|
||||
title: rollFlavor,
|
||||
eigenschaften: item.eigenschaften,
|
||||
eigenschaften: item.system.eigenschaften,
|
||||
isSpell: true,
|
||||
beschreibung: await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
||||
item.system.beschreibung,
|
||||
@@ -102,7 +114,7 @@ export async function rollSkill(event, target) {
|
||||
return;
|
||||
}
|
||||
// Construct the Roll instance
|
||||
const skillValue = skill.value;
|
||||
const skillValue = skill.value || skill;
|
||||
let die = "";
|
||||
switch (dialogResult.vorteil) {
|
||||
case -1:
|
||||
@@ -126,7 +138,7 @@ export async function rollSkill(event, target) {
|
||||
}
|
||||
|
||||
if (dialogResult.customRoll) {
|
||||
roll = new Roll(dialogResult.customRoll);
|
||||
roll = new Roll(dialogResult.customRoll, {}, { title: rollFlavor });
|
||||
} else {
|
||||
roll = new Roll(
|
||||
rollTerm,
|
||||
@@ -154,7 +166,6 @@ export async function rollSkill(event, target) {
|
||||
}
|
||||
}
|
||||
};
|
||||
console.warn(dialogResult);
|
||||
|
||||
// Nutze applyRollMode, um Sichtbarkeiten (Whisper, Blind) korrekt zu setzen
|
||||
ChatMessage.applyMode(chatData, dialogResult.rollMode);
|
||||
@@ -206,7 +217,7 @@ export async function rollWeapon(event, target) {
|
||||
rollFlavor += ": " + weapon.name;
|
||||
|
||||
if (dialogResult.customRoll) {
|
||||
attackRoll = await new Roll(dialogResult.customRoll).evaluate();
|
||||
attackRoll = await new Roll(dialogResult.customRoll, {}, { title: rollFlavor }).evaluate();
|
||||
} else {
|
||||
attackRoll = await new Roll(
|
||||
rollTerm,
|
||||
@@ -215,7 +226,9 @@ export async function rollWeapon(event, target) {
|
||||
skill: skillValue,
|
||||
spezBonus: dialogResult.spezLevel + 1
|
||||
},
|
||||
{ title: rollFlavor }
|
||||
{
|
||||
title: rollFlavor
|
||||
}
|
||||
).evaluate();
|
||||
}
|
||||
|
||||
@@ -226,7 +239,6 @@ export async function rollWeapon(event, target) {
|
||||
).evaluate();
|
||||
|
||||
// The parsed terms of the roll formula
|
||||
console.warn(dialogResult);
|
||||
const chatData = {
|
||||
rolls: [attackRoll, damageRoll],
|
||||
speaker: ChatMessage.getSpeaker(),
|
||||
@@ -234,6 +246,7 @@ export async function rollWeapon(event, target) {
|
||||
"midgard6-lvd": {
|
||||
title: rollFlavor,
|
||||
eigenschaften: weapon.eigenschaften,
|
||||
merkmale: weapon.system.merkmale,
|
||||
beschreibung: await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
||||
weapon.system.beschreibung,
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user