ActiveEffects & Roll Refactor
This commit is contained in:
1 parent
59f887fa5e
commit
b940e8f251
16 files changed
+480
-715
No files matched your search
@@ -204,6 +204,11 @@
|
|||||||
"hint": "Legt die Maximale Anzahl der möglichen Spezialisierungen für einen Skill fest die man besitzen kann."
|
"hint": "Legt die Maximale Anzahl der möglichen Spezialisierungen für einen Skill fest die man besitzen kann."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Effect": {
|
||||||
|
"Temporary": "Temporär",
|
||||||
|
"Passive": "Passiv",
|
||||||
|
"Inactive": "Inaktiv"
|
||||||
|
},
|
||||||
"Warnings": {
|
"Warnings": {
|
||||||
"maxSpezReached": "Die Maximale Anzahl erlaubter Spezialisierungen für einen Skill sind erreicht"
|
"maxSpezReached": "Die Maximale Anzahl erlaubter Spezialisierungen für einen Skill sind erreicht"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
import { SKILLS_CONFIG } from "../data/fields/skill-fields.mjs";
|
||||||
|
|
||||||
|
export class M6ActiveEffect extends ActiveEffect {
|
||||||
|
/** @override */
|
||||||
|
static applyChange(targetDoc, change, options) {
|
||||||
|
const originalKey = change.key?.trim().toLowerCase();
|
||||||
|
|
||||||
|
if (originalKey && originalKey.startsWith("@")) {
|
||||||
|
const parts = originalKey.slice(1).split(".");
|
||||||
|
const target = parts[0];
|
||||||
|
const subField = parts[1];
|
||||||
|
|
||||||
|
let finalPath = null;
|
||||||
|
|
||||||
|
const globalPaths = {
|
||||||
|
rüstwert: subField ? `system.rüstwert.${subField}` : "system.rüstwert.base",
|
||||||
|
|
||||||
|
reflexe: subField
|
||||||
|
? `system.resistenzen.reflexe.${subField}`
|
||||||
|
: "system.resistenzen.reflexe.value",
|
||||||
|
willenskraft: subField
|
||||||
|
? `system.resistenzen.willenskraft.${subField}`
|
||||||
|
: "system.resistenzen.willenskraft.value",
|
||||||
|
zähigkeit: subField
|
||||||
|
? `system.resistenzen.zähigkeit.${subField}`
|
||||||
|
: "system.resistenzen.zähigkeit.value",
|
||||||
|
|
||||||
|
schaden: "system.bonuses.schaden",
|
||||||
|
};
|
||||||
|
|
||||||
|
if (globalPaths[target]) {
|
||||||
|
finalPath = globalPaths[target];
|
||||||
|
} else {
|
||||||
|
if (!this._skillPathCache) {
|
||||||
|
this._skillPathCache = {};
|
||||||
|
for (const [category, skills] of Object.entries(SKILLS_CONFIG)) {
|
||||||
|
for (const skill of skills) {
|
||||||
|
this._skillPathCache[skill.toLowerCase()] = `system.skills.${category}.${skill}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const skillBasePath = this._skillPathCache[target];
|
||||||
|
if (skillBasePath) {
|
||||||
|
const field = subField || "value";
|
||||||
|
finalPath = `${skillBasePath}.${field}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (finalPath) {
|
||||||
|
const modifiedChange = foundry.utils.mergeObject({}, change);
|
||||||
|
modifiedChange.key = finalPath;
|
||||||
|
|
||||||
|
console.log(`System V14 | AE Key übersetzt: ${originalKey} -> ${modifiedChange.key}`);
|
||||||
|
|
||||||
|
return super.applyChange(targetDoc, modifiedChange, options);
|
||||||
|
} else {
|
||||||
|
console.error(
|
||||||
|
`System V14 | Das Kürzel "${target}" existiert weder in den Resistenzen noch in den Skills.`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.applyChange(targetDoc, change, options);
|
||||||
|
}
|
||||||
|
}
|
||||||
+160
-313
@@ -1,5 +1,37 @@
|
|||||||
|
import { SKILLS_CONFIG } from "./fields/skill-fields.mjs";
|
||||||
|
|
||||||
function defineSchema() {
|
function defineSchema() {
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
|
|
||||||
|
const createSkillField = (skillName) => {
|
||||||
|
return new fields.SchemaField({
|
||||||
|
value: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
nullable: false,
|
||||||
|
max: 15,
|
||||||
|
min: 5,
|
||||||
|
initial: 5,
|
||||||
|
label: skillName,
|
||||||
|
}),
|
||||||
|
vorteil: new fields.NumberField({ min: 0, initial: 0 }),
|
||||||
|
nachteil: new fields.NumberField({ min: 0, initial: 0 }),
|
||||||
|
bonuses: new fields.ArrayField(new fields.ObjectField()),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const skillsSchemaFields = Object.entries(SKILLS_CONFIG).reduce(
|
||||||
|
(categories, [categoryName, skillList]) => {
|
||||||
|
const categorySkills = skillList.reduce((skills, skillName) => {
|
||||||
|
skills[skillName] = createSkillField(skillName);
|
||||||
|
return skills;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
categories[categoryName] = new fields.SchemaField(categorySkills, { label: categoryName });
|
||||||
|
return categories;
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
locked: new fields.BooleanField({ initial: false }),
|
locked: new fields.BooleanField({ initial: false }),
|
||||||
biographie: new fields.SchemaField({
|
biographie: new fields.SchemaField({
|
||||||
@@ -8,373 +40,188 @@ function defineSchema() {
|
|||||||
glaube: new fields.StringField({ initial: "" }),
|
glaube: new fields.StringField({ initial: "" }),
|
||||||
spezies: new fields.StringField({ initial: "" }),
|
spezies: new fields.StringField({ initial: "" }),
|
||||||
kultur: new fields.StringField({ initial: "" }),
|
kultur: new fields.StringField({ initial: "" }),
|
||||||
beschreibung: new fields.HTMLField({ initial: "" })
|
beschreibung: new fields.HTMLField({ initial: "" }),
|
||||||
}),
|
}),
|
||||||
legende: new fields.HTMLField({ initial: "" }),
|
|
||||||
schicksalsmünzen: new fields.NumberField({ initial: 3, min: 0, required: true }),
|
schicksalsmünzen: new fields.NumberField({ initial: 3, min: 0, required: true }),
|
||||||
grad: new fields.SchemaField({
|
grad: new fields.SchemaField({
|
||||||
erfahrungspunkteFrei: new fields.NumberField({
|
erfahrungspunkteFrei: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
min: 0,
|
min: 0,
|
||||||
initial: 0
|
initial: 0,
|
||||||
}),
|
}),
|
||||||
erfahrungspunkteEingesetzt: new fields.NumberField({
|
erfahrungspunkteEingesetzt: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
min: 0,
|
min: 0,
|
||||||
initial: 0
|
initial: 0,
|
||||||
}),
|
}),
|
||||||
erfahrungsschatz: new fields.NumberField({
|
erfahrungsschatz: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
min: 0,
|
min: 0,
|
||||||
initial: 0
|
initial: 0,
|
||||||
}),
|
}),
|
||||||
grad: new fields.NumberField({
|
grad: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
min: 1,
|
min: 1,
|
||||||
initial: 1
|
initial: 1,
|
||||||
})
|
}),
|
||||||
}),
|
}),
|
||||||
rüstwert: new fields.SchemaField({
|
rüstwert: new fields.SchemaField({
|
||||||
base: new fields.NumberField({
|
base: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
min: 0,
|
min: 0,
|
||||||
initial: 0
|
initial: 0,
|
||||||
}),
|
}),
|
||||||
mod: new fields.NumberField({
|
mod: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
initial: 0
|
initial: 0,
|
||||||
})
|
}),
|
||||||
}),
|
}),
|
||||||
resources: new fields.SchemaField({
|
resources: new fields.SchemaField({
|
||||||
leben: new fields.SchemaField({
|
leben: new fields.SchemaField({
|
||||||
value: new fields.NumberField({
|
value: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
min: 0,
|
min: 0,
|
||||||
initial: 4
|
initial: 4,
|
||||||
}),
|
}),
|
||||||
max: new fields.NumberField({
|
max: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
initial: 8
|
initial: 8,
|
||||||
})
|
}),
|
||||||
}),
|
}),
|
||||||
ausdauer: new fields.SchemaField({
|
ausdauer: new fields.SchemaField({
|
||||||
value: new fields.NumberField({
|
value: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
min: 0,
|
min: 0,
|
||||||
initial: 4
|
initial: 4,
|
||||||
}),
|
}),
|
||||||
max: new fields.NumberField({
|
max: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
initial: 44
|
initial: 44,
|
||||||
})
|
}),
|
||||||
})
|
}),
|
||||||
}),
|
}),
|
||||||
resistenzen: new fields.SchemaField(
|
resistenzen: new fields.SchemaField(
|
||||||
{
|
{
|
||||||
reflexe: new fields.NumberField({
|
reflexe: new fields.SchemaField({
|
||||||
required: true,
|
value: new fields.NumberField({
|
||||||
nullable: false,
|
required: true,
|
||||||
min: 0,
|
nullable: false,
|
||||||
initial: 4
|
min: 0,
|
||||||
|
initial: 4,
|
||||||
|
}),
|
||||||
|
vorteil: new fields.NumberField({ min: 0, initial: 0 }),
|
||||||
|
nachteil: new fields.NumberField({ min: 0, initial: 0 }),
|
||||||
}),
|
}),
|
||||||
willenskraft: new fields.NumberField({
|
willenskraft: new fields.SchemaField({
|
||||||
required: true,
|
value: new fields.NumberField({
|
||||||
nullable: false,
|
required: true,
|
||||||
min: 0,
|
nullable: false,
|
||||||
initial: 4
|
min: 0,
|
||||||
|
initial: 4,
|
||||||
|
}),
|
||||||
|
vorteil: new fields.NumberField({ min: 0, initial: 0 }),
|
||||||
|
nachteil: new fields.NumberField({ min: 0, initial: 0 }),
|
||||||
|
}),
|
||||||
|
zähigkeit: new fields.SchemaField({
|
||||||
|
value: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
nullable: false,
|
||||||
|
min: 0,
|
||||||
|
initial: 4,
|
||||||
|
}),
|
||||||
|
vorteil: new fields.NumberField({ min: 0, initial: 0 }),
|
||||||
|
nachteil: new fields.NumberField({ min: 0, initial: 0 }),
|
||||||
}),
|
}),
|
||||||
zähigkeit: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
min: 0,
|
|
||||||
initial: 4
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
{ label: "resistenzen" }
|
{ label: "resistenzen" },
|
||||||
),
|
),
|
||||||
skills: new fields.SchemaField({
|
skills: new fields.SchemaField(skillsSchemaFields),
|
||||||
kampf: new fields.SchemaField(
|
bonuses: new fields.SchemaField({
|
||||||
{
|
schaden: new fields.ArrayField(
|
||||||
anführen: new fields.SchemaField({
|
new fields.AnyField({
|
||||||
value: new fields.NumberField({
|
initial: {},
|
||||||
required: true,
|
}),
|
||||||
nullable: false,
|
{ initial: [] },
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "anführen"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
fernkampf: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "fernkampf"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
nahkampf: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "nahkampf"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{ label: "kampf" }
|
|
||||||
),
|
),
|
||||||
körper: new fields.SchemaField(
|
}),
|
||||||
{
|
|
||||||
athletik: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "athletik"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
beweglichkeit: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "beweglichkeit"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
fingerfertigkeit: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "fingerfertigkeit"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
heimlichkeit: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "heimlichkeit"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
wahrnehmung: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "wahrnehmung"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{ label: "körper" }
|
|
||||||
),
|
|
||||||
ausdruck: new fields.SchemaField(
|
|
||||||
{
|
|
||||||
darbietung: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "darbietung"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
einschüchterung: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "einschüchterung"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
empathie: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "empathie"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
gassenwissen: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "gassenwissen"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
manipulation: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "manipulation"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
überzeugen: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "überzeugen"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{ label: "ausdruck" }
|
|
||||||
),
|
|
||||||
geist: new fields.SchemaField(
|
|
||||||
{
|
|
||||||
bildung: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "bildung"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
handwerk: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "handwerk"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
heilkunst: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "heilkunst"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
kulturwissen: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "kulturwissen"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
tierführung: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "tierführung"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
überlebenskunst: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "überlebenskunst"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{ label: "geist" }
|
|
||||||
),
|
|
||||||
magie: new fields.SchemaField(
|
|
||||||
{
|
|
||||||
thaumaturgie: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "thaumaturgie"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
zaubern: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "zaubern"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
zauberwissen: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "zauberwissen"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{ label: "magie" }
|
|
||||||
)
|
|
||||||
})
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CharacterData extends foundry.abstract.TypeDataModel {
|
export class CharacterData extends foundry.abstract.TypeDataModel {
|
||||||
static defineSchema = defineSchema;
|
static defineSchema = defineSchema;
|
||||||
|
|
||||||
|
prepareDerivedData() {
|
||||||
|
const actor = this.parent;
|
||||||
|
if (!actor) return;
|
||||||
|
|
||||||
|
const leben = this.resources.leben;
|
||||||
|
const ausdauer = this.resources.ausdauer;
|
||||||
|
|
||||||
|
const istVerwundet = leben.value <= 4;
|
||||||
|
const istErschöpft = ausdauer.value === 0;
|
||||||
|
|
||||||
|
const verwundetId = "verwundet";
|
||||||
|
const erschöpftId = "erschöpft";
|
||||||
|
|
||||||
|
if (istVerwundet && !actor.effects.find((x) => x.flags?.core?.statusId === verwundetId)) {
|
||||||
|
this._addVerwundetEffect(actor, verwundetId);
|
||||||
|
} else if (
|
||||||
|
!istVerwundet &&
|
||||||
|
actor.effects.find((x) => x.flags?.core?.statusId === verwundetId)
|
||||||
|
) {
|
||||||
|
actor.effects.get(verwundetId)?.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (istErschöpft && !actor.effects.find((x) => x.flags?.core?.statusId === erschöpftId)) {
|
||||||
|
this._addErschöpftEffect(actor, erschöpftId);
|
||||||
|
} else if (
|
||||||
|
!istErschöpft &&
|
||||||
|
actor.effects.find((x) => x.flags?.core?.statusId === erschöpftId)
|
||||||
|
) {
|
||||||
|
actor.effects.get(erschöpftId)?.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async _addVerwundetEffect(actor, statusId) {
|
||||||
|
await ActiveEffect.create(
|
||||||
|
{
|
||||||
|
name: "Verwundet",
|
||||||
|
icon: "icons/svg/blood.svg",
|
||||||
|
changes: [
|
||||||
|
{ key: "@athletik.nachteil", mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD, value: "1" },
|
||||||
|
{
|
||||||
|
key: "@beweglichkeit.nachteil",
|
||||||
|
mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD,
|
||||||
|
value: "1",
|
||||||
|
},
|
||||||
|
{ key: "@heimlichkeit.nachteil", mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD, value: "1" },
|
||||||
|
{
|
||||||
|
key: "@fingerfertigkeit.nachteil",
|
||||||
|
mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD,
|
||||||
|
value: "1",
|
||||||
|
},
|
||||||
|
{ key: "@fernkampf.nachteil", mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD, value: "1" },
|
||||||
|
{ key: "@nahkampf.nachteil", mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD, value: "1" },
|
||||||
|
],
|
||||||
|
flags: { core: { statusId } },
|
||||||
|
},
|
||||||
|
{ parent: actor },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async _addErschöpftEffect(actor, statusId) {
|
||||||
|
await ActiveEffect.create(
|
||||||
|
{
|
||||||
|
name: "Erschöpft",
|
||||||
|
icon: "icons/svg/blood.svg",
|
||||||
|
changes: [
|
||||||
|
{ key: "@reflexe.nachteil", mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD, value: "1" },
|
||||||
|
{ key: "@willenskraft.nachteil", mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD, value: "1" },
|
||||||
|
{ key: "@zähigkeit.nachteil", mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD, value: "1" },
|
||||||
|
],
|
||||||
|
flags: { core: { statusId } },
|
||||||
|
},
|
||||||
|
{ parent: actor },
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
export const SKILLS_CONFIG = {
|
||||||
|
kampf: ["anführen", "fernkampf", "nahkampf"],
|
||||||
|
körper: ["athletik", "beweglichkeit", "fingerfertigkeit", "heimlichkeit", "wahrnehmung"],
|
||||||
|
ausdruck: [
|
||||||
|
"darbietung",
|
||||||
|
"einschüchterung",
|
||||||
|
"empathie",
|
||||||
|
"gassenwissen",
|
||||||
|
"manipulation",
|
||||||
|
"überzeugen",
|
||||||
|
],
|
||||||
|
geist: ["bildung", "handwerk", "heilkunst", "kulturwissen", "tierführung", "überlebenskunst"],
|
||||||
|
magie: ["thaumaturgie", "zaubern", "zauberwissen"],
|
||||||
|
};
|
||||||
@@ -27,19 +27,19 @@ export function prepareActiveEffectCategories(effects) {
|
|||||||
const categories = {
|
const categories = {
|
||||||
temporary: {
|
temporary: {
|
||||||
type: "temporary",
|
type: "temporary",
|
||||||
label: game.i18n.localize("M6.Effect.Temporary"),
|
label: game.i18n.localize("Midgard6.Effect.Temporary"),
|
||||||
effects: []
|
effects: [],
|
||||||
},
|
},
|
||||||
passive: {
|
passive: {
|
||||||
type: "passive",
|
type: "passive",
|
||||||
label: game.i18n.localize("M6.Effect.Passive"),
|
label: game.i18n.localize("Midgard6.Effect.Passive"),
|
||||||
effects: []
|
effects: [],
|
||||||
},
|
},
|
||||||
inactive: {
|
inactive: {
|
||||||
type: "inactive",
|
type: "inactive",
|
||||||
label: game.i18n.localize("M6.Effect.Inactive"),
|
label: game.i18n.localize("Midgard6.Effect.Inactive"),
|
||||||
effects: []
|
effects: [],
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Iterate over active effects, classifying them into categories
|
// Iterate over active effects, classifying them into categories
|
||||||
|
|||||||
+24
-24
@@ -13,8 +13,8 @@ export class M6ArmorSheet extends M6ItemSheet {
|
|||||||
actions: {
|
actions: {
|
||||||
...super.DEFAULT_OPTIONS.actions,
|
...super.DEFAULT_OPTIONS.actions,
|
||||||
cycleEquip: this.#cycleEquip, // Fügt NUR für dieses Sheet die neue Action hinzu
|
cycleEquip: this.#cycleEquip, // Fügt NUR für dieses Sheet die neue Action hinzu
|
||||||
cycleHelmet: this.#cycleHelmet
|
cycleHelmet: this.#cycleHelmet,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,57 +23,57 @@ export class M6ArmorSheet extends M6ItemSheet {
|
|||||||
tabs: [
|
tabs: [
|
||||||
{
|
{
|
||||||
id: "eigenschaften",
|
id: "eigenschaften",
|
||||||
icon: "fa-shield-halved"
|
icon: "fa-shield-halved",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "beschreibung",
|
id: "beschreibung",
|
||||||
icon: "fa-feather-pointed"
|
icon: "fa-feather-pointed",
|
||||||
}
|
},
|
||||||
// {
|
{
|
||||||
// id: "effects",
|
id: "effects",
|
||||||
// icon: "fa-bolt"
|
icon: "fa-bolt",
|
||||||
// }
|
},
|
||||||
],
|
],
|
||||||
initial: "eigenschaften",
|
initial: "eigenschaften",
|
||||||
labelPrefix: "Midgard6.Sheets.Tabs"
|
labelPrefix: "Midgard6.Sheets.Tabs",
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
static PARTS = {
|
static PARTS = {
|
||||||
header: {
|
header: {
|
||||||
template: systemPath("templates/item/header.hbs")
|
template: systemPath("templates/item/header.hbs"),
|
||||||
},
|
},
|
||||||
tabs: {
|
tabs: {
|
||||||
template: systemPath("templates/shared/tabs.hbs")
|
template: systemPath("templates/shared/tabs.hbs"),
|
||||||
},
|
},
|
||||||
eigenschaften: {
|
eigenschaften: {
|
||||||
template: systemPath("templates/item/rüstung/eigenschaften.hbs"),
|
template: systemPath("templates/item/rüstung/eigenschaften.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
},
|
},
|
||||||
beschreibung: {
|
beschreibung: {
|
||||||
template: systemPath("templates/item/description.hbs"),
|
template: systemPath("templates/item/description.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
}
|
},
|
||||||
// effects: {
|
effects: {
|
||||||
// template: systemPath("templates/shared/effects.hbs"),
|
template: systemPath("templates/shared/effects.hbs"),
|
||||||
// scrollable: [""]
|
scrollable: [""],
|
||||||
// }
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static #cycleEquip() {
|
static #cycleEquip() {
|
||||||
this.item.update({
|
this.item.update({
|
||||||
system: {
|
system: {
|
||||||
equipped: !this.item.system.equipped
|
equipped: !this.item.system.equipped,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static #cycleHelmet() {
|
static #cycleHelmet() {
|
||||||
this.item.update({
|
this.item.update({
|
||||||
system: {
|
system: {
|
||||||
zusätzlich: !this.item.system.zusätzlich
|
zusätzlich: !this.item.system.zusätzlich,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,9 @@ import { systemPath } from "../constants.mjs";
|
|||||||
import { prepareActiveEffectCategories } from "../helpers/utils.mjs";
|
import { prepareActiveEffectCategories } from "../helpers/utils.mjs";
|
||||||
import { addSpezialisierung, editSepzialisierung } from "./components/spezialisierung-actions.mjs";
|
import { addSpezialisierung, editSepzialisierung } from "./components/spezialisierung-actions.mjs";
|
||||||
import { prepArmor, prepWeapons, prepWeight, prepSpells } from "./components/character-prep.mjs";
|
import { prepArmor, prepWeapons, prepWeight, prepSpells } from "./components/character-prep.mjs";
|
||||||
import { rollSpell, rollWeapon, rollSkill } from "./components/roll-actions.mjs";
|
import { roll } from "./components/roll-actions.mjs";
|
||||||
import { M6ActorSheet } from "./actor-sheet.mjs";
|
import { M6ActorSheet } from "./actor-sheet.mjs";
|
||||||
|
import { SKILLS_CONFIG } from "../data/fields/skill-fields.mjs";
|
||||||
|
|
||||||
const { api, sheets } = foundry.applications;
|
const { api, sheets } = foundry.applications;
|
||||||
|
|
||||||
@@ -18,10 +19,7 @@ export class M6CharacterSheet extends M6ActorSheet {
|
|||||||
actions: {
|
actions: {
|
||||||
...super.DEFAULT_OPTIONS.actions, // Kopiert alle bestehenden Actions aus M6ActorSheet
|
...super.DEFAULT_OPTIONS.actions, // Kopiert alle bestehenden Actions aus M6ActorSheet
|
||||||
cycleEquip: this.#cycleEquip,
|
cycleEquip: this.#cycleEquip,
|
||||||
rollSkill: rollSkill,
|
roll: roll,
|
||||||
rollWeapon: rollWeapon,
|
|
||||||
rollSpell: rollSpell,
|
|
||||||
cycleEquip: this.#cycleEquip,
|
|
||||||
addSpezialisierung: addSpezialisierung,
|
addSpezialisierung: addSpezialisierung,
|
||||||
editSepzialisierung: editSepzialisierung,
|
editSepzialisierung: editSepzialisierung,
|
||||||
},
|
},
|
||||||
@@ -53,10 +51,10 @@ export class M6CharacterSheet extends M6ActorSheet {
|
|||||||
id: "biographie",
|
id: "biographie",
|
||||||
icon: "fa-feather-pointed",
|
icon: "fa-feather-pointed",
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// id: "effects",
|
id: "effects",
|
||||||
// icon: "fa-bolt"
|
icon: "fa-bolt",
|
||||||
// }
|
},
|
||||||
],
|
],
|
||||||
initial: "eigenschaften",
|
initial: "eigenschaften",
|
||||||
labelPrefix: "Midgard6.Sheets.Tabs",
|
labelPrefix: "Midgard6.Sheets.Tabs",
|
||||||
@@ -93,10 +91,10 @@ export class M6CharacterSheet extends M6ActorSheet {
|
|||||||
template: systemPath("templates/actor/biographie.hbs"),
|
template: systemPath("templates/actor/biographie.hbs"),
|
||||||
scrollable: [""],
|
scrollable: [""],
|
||||||
},
|
},
|
||||||
// effects: {
|
effects: {
|
||||||
// template: systemPath("templates/shared/effects.hbs"),
|
template: systemPath("templates/shared/effects.hbs"),
|
||||||
// scrollable: [""]
|
scrollable: [""],
|
||||||
// }
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
@@ -116,7 +114,7 @@ export class M6CharacterSheet extends M6ActorSheet {
|
|||||||
});
|
});
|
||||||
|
|
||||||
context.itemTypes = await super._getItems();
|
context.itemTypes = await super._getItems();
|
||||||
|
console.warn(context);
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,7 +197,7 @@ export class M6CharacterSheet extends M6ActorSheet {
|
|||||||
const path = `${_path}.${field.name}`;
|
const path = `${_path}.${field.name}`;
|
||||||
if (field instanceof foundry.data.fields.SchemaField) {
|
if (field instanceof foundry.data.fields.SchemaField) {
|
||||||
this.#addSkillFields(fieldset, field.fields, source, path);
|
this.#addSkillFields(fieldset, field.fields, source, path);
|
||||||
} else if (field.constructor.hasFormSupport) {
|
} else if (field.name === "value") {
|
||||||
fieldset.fields.push({
|
fieldset.fields.push({
|
||||||
field,
|
field,
|
||||||
value: foundry.utils.getProperty(source, path),
|
value: foundry.utils.getProperty(source, path),
|
||||||
|
|||||||
@@ -1,294 +1,144 @@
|
|||||||
import { systemPath } from "../../constants.mjs";
|
import { systemPath } from "../../constants.mjs";
|
||||||
|
|
||||||
export async function rollSpell(event, target) {
|
function _getDieType(vorteilStatus) {
|
||||||
const dataset = target.dataset;
|
switch (vorteilStatus) {
|
||||||
const skill = foundry.utils.getProperty(this.actor, "system.skills.magie.zaubern");
|
|
||||||
const item = this.actor.items.get(dataset.itemId);
|
|
||||||
const actor = this.actor;
|
|
||||||
const dialogResult = await rollDialog({
|
|
||||||
name: dataset.name,
|
|
||||||
skill,
|
|
||||||
damageRoll: item.system.eigenschaften.schaden,
|
|
||||||
preSelectedSpez: item.system.eigenschaften.ursprung,
|
|
||||||
actor,
|
|
||||||
});
|
|
||||||
console.log("Dialog Result", dialogResult);
|
|
||||||
if (dialogResult === "abort") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Construct the Roll instance
|
|
||||||
const skillValue = skill.value;
|
|
||||||
let die = "";
|
|
||||||
switch (dialogResult.vorteil) {
|
|
||||||
case -1:
|
case -1:
|
||||||
die = "2d20kl";
|
return "2d20kl";
|
||||||
break;
|
|
||||||
case 1:
|
case 1:
|
||||||
die = "2d20kh";
|
return "2d20kh";
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
die = "1d20";
|
return "1d20";
|
||||||
break;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _applyBonusDamage(actor, baseDamage, skill) {
|
||||||
|
if (!baseDamage) return "";
|
||||||
|
let formula = baseDamage;
|
||||||
|
const bonusArray = actor.system.bonuses?.schaden || [];
|
||||||
|
for (const bonus of bonusArray) {
|
||||||
|
if (bonus.schaden && skill.includes(bonus.condition.toLowerCase()))
|
||||||
|
formula += ` + ${bonus.schaden}`;
|
||||||
|
}
|
||||||
|
return formula;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
/* Universelle Würfel-Aktion */
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
export async function roll(event, target) {
|
||||||
|
const actor = this.actor;
|
||||||
|
const dataset = target.dataset;
|
||||||
|
|
||||||
|
const item = dataset.itemId ? actor.items.get(dataset.itemId) : null;
|
||||||
|
const itemType = item?.type;
|
||||||
|
|
||||||
|
let skill;
|
||||||
|
let damageRoll = "";
|
||||||
|
let preSelectedSpez = "";
|
||||||
|
let rollFlavor = "";
|
||||||
|
|
||||||
|
if (itemType === "zauber") {
|
||||||
|
skill = await foundry.utils.getProperty(actor, "system.skills.magie.zaubern");
|
||||||
|
damageRoll = _applyBonusDamage(actor, item.system.eigenschaften.schaden, skill);
|
||||||
|
preSelectedSpez = item.system.eigenschaften.ursprung;
|
||||||
|
rollFlavor = `${game.i18n.localize("Midgard6.Zaubern")}: ${item.name}`;
|
||||||
|
} else if (itemType === "weapon") {
|
||||||
|
skill = await foundry.utils.getProperty(actor, item.system.fertigkeit);
|
||||||
|
console.warn(skill);
|
||||||
|
damageRoll = _applyBonusDamage(actor, item.system.schaden, item.system.fertigkeit);
|
||||||
|
preSelectedSpez = item.system.spezialisierung;
|
||||||
|
rollFlavor = `${game.i18n.localize("Midgard6.Angriff")}: ${item.name}`;
|
||||||
|
} else {
|
||||||
|
const cleanPath = dataset.path.replace(".value", "");
|
||||||
|
skill = foundry.utils.getProperty(actor, cleanPath);
|
||||||
|
rollFlavor = dataset.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!skill) return ui.notifications.error("Zugehörige Fertigkeit nicht gefunden.");
|
||||||
|
|
||||||
|
const vorteil = (skill.vorteil || 0) - (skill.nachteil || 0);
|
||||||
|
|
||||||
|
const dialogResult = await rollDialog({
|
||||||
|
name: item ? item.name : dataset.name,
|
||||||
|
skill,
|
||||||
|
damageRoll,
|
||||||
|
preSelectedSpez,
|
||||||
|
vorteil,
|
||||||
|
actor,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!dialogResult || dialogResult === "abort") return;
|
||||||
|
|
||||||
|
const die = _getDieType(dialogResult.vorteil);
|
||||||
let rollTerm = "@die + @skill";
|
let rollTerm = "@die + @skill";
|
||||||
let rollFlavor = game.i18n.localize("Midgard6.Zaubern") + ": " + item.name;
|
|
||||||
|
|
||||||
if (dialogResult.spezLevel) {
|
if (dialogResult.spezLevel) {
|
||||||
rollTerm += " + @spezBonus";
|
rollTerm += " + @spezBonus";
|
||||||
rollFlavor += ": " + dialogResult.spezName;
|
rollFlavor +=
|
||||||
|
itemType === "weapon" ? ` (${dialogResult.spezName})` : `: ${dialogResult.spezName}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
let rolls;
|
const rolls = [];
|
||||||
if (dialogResult.customRoll) {
|
if (dialogResult.customRoll) {
|
||||||
rolls = [await new Roll(dialogResult.customRoll, {}, { title: rollFlavor }).evaluate()];
|
rolls.push(await new Roll(dialogResult.customRoll, {}, { title: rollFlavor }).evaluate());
|
||||||
} else {
|
} else {
|
||||||
rolls = [
|
rolls.push(
|
||||||
await new Roll(
|
await new Roll(
|
||||||
rollTerm,
|
rollTerm,
|
||||||
{
|
{ die: die, skill: skill.value || skill, spezBonus: dialogResult.spezLevel + 1 },
|
||||||
die: die,
|
|
||||||
skill: skillValue,
|
|
||||||
spezBonus: dialogResult.spezLevel + 1,
|
|
||||||
},
|
|
||||||
{ title: rollFlavor },
|
{ title: rollFlavor },
|
||||||
).evaluate(),
|
).evaluate(),
|
||||||
];
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dialogResult.customDamageRoll) {
|
const finalDamageFormula = dialogResult.customDamageRoll || damageRoll;
|
||||||
|
if (finalDamageFormula && (itemType === "weapon" || itemType === "zauber")) {
|
||||||
rolls.push(
|
rolls.push(
|
||||||
await new Roll(
|
await new Roll(
|
||||||
"@die",
|
finalDamageFormula,
|
||||||
{ die: dialogResult.customDamageRoll },
|
{ die: finalDamageFormula },
|
||||||
{ title: game.i18n.localize("Midgard6.Schaden") },
|
|
||||||
).evaluate(),
|
|
||||||
);
|
|
||||||
} else if (item.system.eigenschaften.schaden) {
|
|
||||||
rolls.push(
|
|
||||||
await new Roll(
|
|
||||||
"@die",
|
|
||||||
{ die: item.system.eigenschaften.schaden },
|
|
||||||
{ title: game.i18n.localize("Midgard6.Schaden") },
|
{ title: game.i18n.localize("Midgard6.Schaden") },
|
||||||
).evaluate(),
|
).evaluate(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The parsed terms of the roll formula
|
const flagsData = { title: rollFlavor };
|
||||||
console.log("Roll:", roll); // [Die, OperatorTerm, NumericTerm, OperatorTerm, NumericTerm]
|
|
||||||
|
if (item) {
|
||||||
|
flagsData.beschreibung = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
||||||
|
item.system.beschreibung || "",
|
||||||
|
{ secrets: false, rollData: actor.getRollData(), relativeTo: actor },
|
||||||
|
);
|
||||||
|
flagsData.eigenschaften = item.system?.eigenschaften || item?.eigenschaften || [];
|
||||||
|
flagsData.merkmale = item.system?.merkmale || [];
|
||||||
|
flagsData.isSpell = itemType === "zauber";
|
||||||
|
}
|
||||||
|
|
||||||
const chatData = {
|
const chatData = {
|
||||||
rolls: rolls,
|
rolls: rolls,
|
||||||
speaker: ChatMessage.getSpeaker(),
|
speaker: ChatMessage.getSpeaker(),
|
||||||
flags: {
|
flags: { "midgard6-lvd": flagsData },
|
||||||
"midgard6-lvd": {
|
|
||||||
title: rollFlavor,
|
|
||||||
eigenschaften: item.system.eigenschaften,
|
|
||||||
isSpell: true,
|
|
||||||
beschreibung: await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
|
||||||
item.system.beschreibung,
|
|
||||||
{
|
|
||||||
// Whether to show secret blocks in the finished html
|
|
||||||
secrets: false,
|
|
||||||
// Data to fill in for inline rolls
|
|
||||||
rollData: this.actor.getRollData(),
|
|
||||||
// Relative UUID resolution
|
|
||||||
relativeTo: this.actor,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ChatMessage.applyMode(chatData, dialogResult.rollMode);
|
ChatMessage.applyMode(chatData, dialogResult.rollMode);
|
||||||
|
|
||||||
await ChatMessage.create(chatData);
|
await ChatMessage.create(chatData);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function rollSkill(event, target) {
|
/* -------------------------------------------------- */
|
||||||
const dataset = target.dataset;
|
/* Dialog-Fenster */
|
||||||
const skill = foundry.utils.getProperty(this.actor, target.dataset.path.replace(".value", ""));
|
/* -------------------------------------------------- */
|
||||||
const actor = this.actor;
|
|
||||||
const dialogResult = await rollDialog({
|
|
||||||
name: dataset.name,
|
|
||||||
skill,
|
|
||||||
actor,
|
|
||||||
});
|
|
||||||
console.log("Dialog Result", dialogResult);
|
|
||||||
if (dialogResult === "abort") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Construct the Roll instance
|
|
||||||
const skillValue = skill.value || skill;
|
|
||||||
let die = "";
|
|
||||||
switch (dialogResult.vorteil) {
|
|
||||||
case -1:
|
|
||||||
die = "2d20kl";
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
die = "2d20kh";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
die = "1d20";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
let rollTerm = "@die + @skill";
|
|
||||||
let rollFlavor = dataset.name;
|
|
||||||
let roll;
|
|
||||||
|
|
||||||
if (dialogResult.spezLevel) {
|
|
||||||
rollTerm += " + @spezBonus";
|
|
||||||
rollFlavor += ": " + dialogResult.spezName;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dialogResult.customRoll) {
|
|
||||||
roll = new Roll(dialogResult.customRoll, {}, { title: rollFlavor });
|
|
||||||
} else {
|
|
||||||
roll = new Roll(
|
|
||||||
rollTerm,
|
|
||||||
{
|
|
||||||
die: die,
|
|
||||||
skill: skillValue,
|
|
||||||
spezBonus: dialogResult.spezLevel + 1,
|
|
||||||
},
|
|
||||||
{ title: rollFlavor },
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// Nutze applyRollMode, um Sichtbarkeiten (Whisper, Blind) korrekt zu setzen
|
|
||||||
ChatMessage.applyMode(chatData, dialogResult.rollMode);
|
|
||||||
|
|
||||||
// Erstelle die Nachricht mit den manipulierten Daten
|
|
||||||
await ChatMessage.create(chatData);
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function rollWeapon(event, target) {
|
|
||||||
const dataset = target.dataset;
|
|
||||||
const weapon = this.actor.items.get(dataset.itemId);
|
|
||||||
const skill = foundry.utils.getProperty(this.actor, weapon.system.fertigkeit);
|
|
||||||
const actor = this.actor;
|
|
||||||
const dialogResult = await rollDialog({
|
|
||||||
name: weapon.name,
|
|
||||||
skill,
|
|
||||||
damageRoll: weapon.system.schaden,
|
|
||||||
preSelectedSpez: weapon.system.spezialisierung,
|
|
||||||
actor,
|
|
||||||
});
|
|
||||||
console.log("Dialog Result", dialogResult);
|
|
||||||
if (dialogResult === "abort") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Construct the Roll instance
|
|
||||||
const skillValue = skill.value;
|
|
||||||
let die = "";
|
|
||||||
switch (dialogResult.vorteil) {
|
|
||||||
case -1:
|
|
||||||
die = "2d20kl";
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
die = "2d20kh";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
die = "1d20";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
let rollTerm = "@die + @skill";
|
|
||||||
let rollFlavor = game.i18n.localize("Midgard6.Angriff");
|
|
||||||
let attackRoll;
|
|
||||||
let damageRoll;
|
|
||||||
|
|
||||||
if (dialogResult.spezLevel) {
|
|
||||||
rollTerm += " + @spezBonus";
|
|
||||||
rollFlavor += " (" + dialogResult.spezName + ")";
|
|
||||||
}
|
|
||||||
rollFlavor += ": " + weapon.name;
|
|
||||||
|
|
||||||
if (dialogResult.customRoll) {
|
|
||||||
attackRoll = await new Roll(dialogResult.customRoll, {}, { title: rollFlavor }).evaluate();
|
|
||||||
} else {
|
|
||||||
attackRoll = await new Roll(
|
|
||||||
rollTerm,
|
|
||||||
{
|
|
||||||
die: die,
|
|
||||||
skill: skillValue,
|
|
||||||
spezBonus: dialogResult.spezLevel + 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: rollFlavor,
|
|
||||||
},
|
|
||||||
).evaluate();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dialogResult.customDamageRoll) {
|
|
||||||
damageRoll = await new Roll(
|
|
||||||
dialogResult.customDamageRoll,
|
|
||||||
{},
|
|
||||||
{ title: game.i18n.localize("Midgard6.Schaden") },
|
|
||||||
).evaluate();
|
|
||||||
} else if (weapon.system.schaden) {
|
|
||||||
damageRoll = await new Roll(
|
|
||||||
"@die",
|
|
||||||
{ die: weapon.system.schaden },
|
|
||||||
{ title: game.i18n.localize("Midgard6.Schaden") },
|
|
||||||
).evaluate();
|
|
||||||
}
|
|
||||||
|
|
||||||
// The parsed terms of the roll formula
|
|
||||||
const chatData = {
|
|
||||||
rolls: [attackRoll, damageRoll],
|
|
||||||
speaker: ChatMessage.getSpeaker(),
|
|
||||||
flags: {
|
|
||||||
"midgard6-lvd": {
|
|
||||||
title: rollFlavor,
|
|
||||||
eigenschaften: weapon.eigenschaften,
|
|
||||||
merkmale: weapon.system.merkmale,
|
|
||||||
beschreibung: await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
|
||||||
weapon.system.beschreibung,
|
|
||||||
{
|
|
||||||
secrets: false,
|
|
||||||
rollData: this.actor.getRollData(),
|
|
||||||
relativeTo: this.actor,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
ChatMessage.applyMode(chatData, dialogResult.rollMode);
|
|
||||||
|
|
||||||
await ChatMessage.create(chatData);
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function rollDialog(rollDialogRequest) {
|
export async function rollDialog(rollDialogRequest) {
|
||||||
// Assamble dialog depending on roll type
|
|
||||||
let label = rollDialogRequest.name;
|
|
||||||
let skillValue = rollDialogRequest.skill?.value || rollDialogRequest.skill;
|
let skillValue = rollDialogRequest.skill?.value || rollDialogRequest.skill;
|
||||||
let bonuses = rollDialogRequest.skill?.bonuses || [];
|
let bonuses = rollDialogRequest.skill?.bonuses || [];
|
||||||
let damageRoll = rollDialogRequest.damageRoll || "";
|
let damageRoll = rollDialogRequest.damageRoll || "";
|
||||||
let preSelectedSpez = rollDialogRequest.preSelectedSpez || "";
|
let preSelectedSpez = rollDialogRequest.preSelectedSpez || "";
|
||||||
let vorteil = 0;
|
let vorteil = rollDialogRequest.vorteil || 0;
|
||||||
let customRoll = "";
|
let customRoll = "";
|
||||||
let spezLevel;
|
let spezLevel;
|
||||||
let spezName = "";
|
let spezName = "";
|
||||||
// 1. Define the path to .hbs template
|
|
||||||
const templatePath = systemPath("templates/dialog/roll-dialog.hbs");
|
const templatePath = systemPath("templates/dialog/roll-dialog.hbs");
|
||||||
const templateData = {
|
const templateData = {
|
||||||
skillValue,
|
skillValue,
|
||||||
@@ -299,26 +149,21 @@ export async function rollDialog(rollDialogRequest) {
|
|||||||
customRoll,
|
customRoll,
|
||||||
rollModes: CONFIG.ChatMessage.modes,
|
rollModes: CONFIG.ChatMessage.modes,
|
||||||
};
|
};
|
||||||
// 2. Render the Handlebars template into an HTML string
|
|
||||||
const content = await foundry.applications.handlebars.renderTemplate(templatePath, templateData);
|
const content = await foundry.applications.handlebars.renderTemplate(templatePath, templateData);
|
||||||
// return new Promise((resolve, reject) => {
|
|
||||||
// const dialog = new foundry.applications.api.DialogV2({
|
|
||||||
return foundry.applications.api.DialogV2.wait({
|
return foundry.applications.api.DialogV2.wait({
|
||||||
window: { title: "Würfel Modifikatoren: " + label },
|
window: { title: "Würfel Modifikatoren: " + rollDialogRequest.name },
|
||||||
position: {
|
position: { width: 600 },
|
||||||
width: 600,
|
|
||||||
},
|
|
||||||
classes: ["M6", "dialog"],
|
classes: ["M6", "dialog"],
|
||||||
content,
|
content,
|
||||||
actions: {},
|
|
||||||
render: (_event, dialog) => {
|
render: (_event, dialog) => {
|
||||||
const dialogHTML = dialog.element;
|
const dialogHTML = dialog.element;
|
||||||
|
|
||||||
const display = dialogHTML.querySelector("#rollDisplay");
|
const display = dialogHTML.querySelector("#rollDisplay");
|
||||||
let mainRoll = `1d20 + ${skillValue}`;
|
let mainRoll = `1d20 + ${skillValue}`;
|
||||||
let spezText = "";
|
let spezText = "";
|
||||||
// Variable bei jeder Änderung aktualisieren
|
|
||||||
document.querySelectorAll('input[name="vorteil-segment"]').forEach((radio) => {
|
dialogHTML.querySelectorAll('input[name="vorteil-segment"]').forEach((radio) => {
|
||||||
radio.addEventListener("change", (e) => {
|
radio.addEventListener("change", (e) => {
|
||||||
vorteil = parseInt(e.target.value);
|
vorteil = parseInt(e.target.value);
|
||||||
switch (vorteil) {
|
switch (vorteil) {
|
||||||
@@ -334,9 +179,10 @@ export async function rollDialog(rollDialogRequest) {
|
|||||||
}
|
}
|
||||||
display.placeholder = mainRoll + spezText;
|
display.placeholder = mainRoll + spezText;
|
||||||
});
|
});
|
||||||
|
if (radio.dataset.value == vorteil) radio.click();
|
||||||
});
|
});
|
||||||
|
|
||||||
document.querySelectorAll('input[name="spezialisierung-segment"]').forEach((radio) => {
|
dialogHTML.querySelectorAll('input[name="spezialisierung-segment"]').forEach((radio) => {
|
||||||
radio.addEventListener("click", (e) => {
|
radio.addEventListener("click", (e) => {
|
||||||
if (spezName !== e.target.dataset.name) {
|
if (spezName !== e.target.dataset.name) {
|
||||||
spezLevel = parseInt(e.target.value);
|
spezLevel = parseInt(e.target.value);
|
||||||
@@ -357,19 +203,13 @@ export async function rollDialog(rollDialogRequest) {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{ action: "abort", label: "Midgard6.Dialog.abbrechen", callback: () => null },
|
||||||
action: "abort",
|
|
||||||
label: "Midgard6.Dialog.abbrechen",
|
|
||||||
callback: (event, button, dialog) => {
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
action: "roll",
|
action: "roll",
|
||||||
label: "Midgard6.Dialog.würfeln",
|
label: "Midgard6.Dialog.würfeln",
|
||||||
default: true,
|
default: true,
|
||||||
callback: (event, button, dialog) => {
|
callback: (event, button) => {
|
||||||
const rollData = {
|
return {
|
||||||
customRoll: button.form.elements.customRoll.value,
|
customRoll: button.form.elements.customRoll.value,
|
||||||
customDamageRoll: button.form.elements.customDamageRoll?.value || "",
|
customDamageRoll: button.form.elements.customDamageRoll?.value || "",
|
||||||
vorteil,
|
vorteil,
|
||||||
@@ -378,7 +218,6 @@ export async function rollDialog(rollDialogRequest) {
|
|||||||
rollMode:
|
rollMode:
|
||||||
button.form.elements.rollMode?.value || game.settings.get("core", "messageMode"),
|
button.form.elements.rollMode?.value || game.settings.get("core", "messageMode"),
|
||||||
};
|
};
|
||||||
return rollData;
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ export class M6HintergrundSheet extends M6ItemSheet {
|
|||||||
return {
|
return {
|
||||||
...super.DEFAULT_OPTIONS, // Kopiert alle bestehenden Actions aus M6ItemSheet
|
...super.DEFAULT_OPTIONS, // Kopiert alle bestehenden Actions aus M6ItemSheet
|
||||||
actions: {
|
actions: {
|
||||||
...super.DEFAULT_OPTIONS.actions
|
...super.DEFAULT_OPTIONS.actions,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,34 +21,34 @@ export class M6HintergrundSheet extends M6ItemSheet {
|
|||||||
tabs: [
|
tabs: [
|
||||||
{
|
{
|
||||||
id: "beschreibung",
|
id: "beschreibung",
|
||||||
icon: "fa-feather-pointed"
|
icon: "fa-feather-pointed",
|
||||||
}
|
},
|
||||||
// {
|
{
|
||||||
// id: "effects",
|
id: "effects",
|
||||||
// icon: "fa-bolt"
|
icon: "fa-bolt",
|
||||||
// }
|
},
|
||||||
],
|
],
|
||||||
initial: "beschreibung",
|
initial: "beschreibung",
|
||||||
labelPrefix: "Midgard6.Sheets.Tabs"
|
labelPrefix: "Midgard6.Sheets.Tabs",
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
static PARTS = {
|
static PARTS = {
|
||||||
header: {
|
header: {
|
||||||
template: systemPath("templates/hintergrund/header.hbs")
|
template: systemPath("templates/hintergrund/header.hbs"),
|
||||||
},
|
},
|
||||||
tabs: {
|
tabs: {
|
||||||
template: systemPath("templates/shared/tabs.hbs")
|
template: systemPath("templates/shared/tabs.hbs"),
|
||||||
},
|
},
|
||||||
beschreibung: {
|
beschreibung: {
|
||||||
template: systemPath("templates/hintergrund/description.hbs"),
|
template: systemPath("templates/hintergrund/description.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
}
|
},
|
||||||
// effects: {
|
effects: {
|
||||||
// template: systemPath("templates/shared/effects.hbs"),
|
template: systemPath("templates/shared/effects.hbs"),
|
||||||
// scrollable: [""]
|
scrollable: [""],
|
||||||
// }
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
_addSpecifics(context) {
|
_addSpecifics(context) {
|
||||||
|
|||||||
+30
-31
@@ -10,24 +10,24 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
|
|
||||||
static DEFAULT_OPTIONS = {
|
static DEFAULT_OPTIONS = {
|
||||||
window: {
|
window: {
|
||||||
resizable: true
|
resizable: true,
|
||||||
},
|
},
|
||||||
position: {
|
position: {
|
||||||
width: 650,
|
width: 650,
|
||||||
height: 450
|
height: 450,
|
||||||
},
|
},
|
||||||
classes: ["M6", "item", "standard-form"],
|
classes: ["M6", "item", "standard-form"],
|
||||||
actions: {
|
actions: {
|
||||||
viewDoc: this.#viewEffect,
|
viewDoc: this.#viewEffect,
|
||||||
createDoc: this.#createEffect,
|
createDoc: this.#createEffect,
|
||||||
deleteDoc: this.#deleteEffect,
|
deleteDoc: this.#deleteEffect,
|
||||||
toggleEffect: this.#toggleEffect
|
toggleEffect: this.#toggleEffect,
|
||||||
},
|
},
|
||||||
form: {
|
form: {
|
||||||
submitOnChange: true
|
submitOnChange: true,
|
||||||
},
|
},
|
||||||
// Custom property that's merged into `this.options`
|
// Custom property that's merged into `this.options`
|
||||||
dragDrop: [{ dragSelector: ".draggable", dropSelector: null }]
|
dragDrop: [{ dragSelector: ".draggable", dropSelector: null }],
|
||||||
};
|
};
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
@@ -37,16 +37,16 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
tabs: [
|
tabs: [
|
||||||
{
|
{
|
||||||
id: "beschreibung",
|
id: "beschreibung",
|
||||||
icon: "fa-feather-pointed"
|
icon: "fa-feather-pointed",
|
||||||
}
|
},
|
||||||
// {
|
{
|
||||||
// id: "effects",
|
id: "effects",
|
||||||
// icon: "fa-bolt"
|
icon: "fa-bolt",
|
||||||
// }
|
},
|
||||||
],
|
],
|
||||||
initial: "beschreibung",
|
initial: "beschreibung",
|
||||||
labelPrefix: "Midgard6.Sheets.Tabs"
|
labelPrefix: "Midgard6.Sheets.Tabs",
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
@@ -54,19 +54,19 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
static PARTS = {
|
static PARTS = {
|
||||||
header: {
|
header: {
|
||||||
template: systemPath("templates/item/header.hbs")
|
template: systemPath("templates/item/header.hbs"),
|
||||||
},
|
},
|
||||||
tabs: {
|
tabs: {
|
||||||
template: systemPath("templates/shared/tabs.hbs")
|
template: systemPath("templates/shared/tabs.hbs"),
|
||||||
},
|
},
|
||||||
beschreibung: {
|
beschreibung: {
|
||||||
template: systemPath("templates/item/description.hbs"),
|
template: systemPath("templates/item/description.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
}
|
},
|
||||||
// effects: {
|
effects: {
|
||||||
// template: systemPath("templates/shared/effects.hbs"),
|
template: systemPath("templates/shared/effects.hbs"),
|
||||||
// scrollable: [""]
|
scrollable: [""],
|
||||||
// }
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
_attachPartListeners(partId, html, bubble) {
|
_attachPartListeners(partId, html, bubble) {
|
||||||
@@ -89,7 +89,6 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
const currentInput = event.currentTarget;
|
const currentInput = event.currentTarget;
|
||||||
const value = currentInput.value;
|
const value = currentInput.value;
|
||||||
const location = currentInput.name || currentInput.id;
|
const location = currentInput.name || currentInput.id;
|
||||||
console.log("Feld verlassen! Aktueller Wert:", value);
|
|
||||||
this.item.update({ [`${location}`]: value.split(/[\s,]+/) });
|
this.item.update({ [`${location}`]: value.split(/[\s,]+/) });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,7 +117,7 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
system: this.item.system,
|
system: this.item.system,
|
||||||
flags: this.item.flags,
|
flags: this.item.flags,
|
||||||
itemFields: this.item.schema.fields,
|
itemFields: this.item.schema.fields,
|
||||||
config: CONFIG
|
config: CONFIG,
|
||||||
});
|
});
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
@@ -145,8 +144,8 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
// Data to fill in for inline rolls
|
// Data to fill in for inline rolls
|
||||||
rollData: this.item.getRollData(),
|
rollData: this.item.getRollData(),
|
||||||
// Relative UUID resolution
|
// Relative UUID resolution
|
||||||
relativeTo: this.item
|
relativeTo: this.item,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
context.tab = context.tabs[partId];
|
context.tab = context.tabs[partId];
|
||||||
break;
|
break;
|
||||||
@@ -258,8 +257,8 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
const effectData = {
|
const effectData = {
|
||||||
name: aeCls.defaultName({
|
name: aeCls.defaultName({
|
||||||
type: target.dataset.type,
|
type: target.dataset.type,
|
||||||
parent: this.item
|
parent: this.item,
|
||||||
})
|
}),
|
||||||
};
|
};
|
||||||
for (const [dataKey, value] of Object.entries(target.dataset)) {
|
for (const [dataKey, value] of Object.entries(target.dataset)) {
|
||||||
if (["action", "documentClass"].includes(dataKey)) continue;
|
if (["action", "documentClass"].includes(dataKey)) continue;
|
||||||
@@ -429,7 +428,7 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
// Perform the sort
|
// Perform the sort
|
||||||
const sortUpdates = foundry.utils.performIntegerSort(effect, {
|
const sortUpdates = foundry.utils.performIntegerSort(effect, {
|
||||||
target,
|
target,
|
||||||
siblings
|
siblings,
|
||||||
});
|
});
|
||||||
const updateData = sortUpdates.map((u) => {
|
const updateData = sortUpdates.map((u) => {
|
||||||
const update = u.update;
|
const update = u.update;
|
||||||
@@ -503,7 +502,7 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
// Perform the sort
|
// Perform the sort
|
||||||
const sortUpdates = foundry.utils.SortingHelpers.performIntegerSort(item, {
|
const sortUpdates = foundry.utils.SortingHelpers.performIntegerSort(item, {
|
||||||
target,
|
target,
|
||||||
siblings
|
siblings,
|
||||||
});
|
});
|
||||||
const updateData = sortUpdates.map((u) => {
|
const updateData = sortUpdates.map((u) => {
|
||||||
const update = u.update;
|
const update = u.update;
|
||||||
@@ -557,12 +556,12 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
return this.options.dragDrop.map((d) => {
|
return this.options.dragDrop.map((d) => {
|
||||||
d.permissions = {
|
d.permissions = {
|
||||||
dragstart: this._canDragStart.bind(this),
|
dragstart: this._canDragStart.bind(this),
|
||||||
drop: this._canDragDrop.bind(this)
|
drop: this._canDragDrop.bind(this),
|
||||||
};
|
};
|
||||||
d.callbacks = {
|
d.callbacks = {
|
||||||
dragstart: this._onDragStart.bind(this),
|
dragstart: this._onDragStart.bind(this),
|
||||||
dragover: this._onDragOver.bind(this),
|
dragover: this._onDragOver.bind(this),
|
||||||
drop: this._onDrop.bind(this)
|
drop: this._onDrop.bind(this),
|
||||||
};
|
};
|
||||||
return new foundry.applications.ux.DragDrop(d);
|
return new foundry.applications.ux.DragDrop(d);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import { systemPath } from "../constants.mjs";
|
import { systemPath } from "../constants.mjs";
|
||||||
import { prepareActiveEffectCategories } from "../helpers/utils.mjs";
|
import { prepareActiveEffectCategories } from "../helpers/utils.mjs";
|
||||||
import { addSpezialisierung, editSepzialisierung } from "./components/spezialisierung-actions.mjs";
|
import { prepArmor, prepWeapons, prepSpells } from "./components/nsc-prep.mjs";
|
||||||
import { prepArmor, prepWeapons, prepWeight, prepSpells } from "./components/nsc-prep.mjs";
|
import { roll, rollDialog } from "./components/roll-actions.mjs";
|
||||||
import { rollSpell, rollWeapon, rollSkill, rollDialog } from "./components/roll-actions.mjs";
|
|
||||||
import { M6ActorSheet } from "./actor-sheet.mjs";
|
import { M6ActorSheet } from "./actor-sheet.mjs";
|
||||||
|
|
||||||
const { api, sheets } = foundry.applications;
|
const { api, sheets } = foundry.applications;
|
||||||
@@ -19,9 +18,7 @@ export class M6NSCSheet extends M6ActorSheet {
|
|||||||
...super.DEFAULT_OPTIONS.actions, // Kopiert alle bestehenden Actions aus M6ActorSheet
|
...super.DEFAULT_OPTIONS.actions, // Kopiert alle bestehenden Actions aus M6ActorSheet
|
||||||
cycleEquip: this.#cycleEquip,
|
cycleEquip: this.#cycleEquip,
|
||||||
rollKompetenz: this.#rollKompetenz,
|
rollKompetenz: this.#rollKompetenz,
|
||||||
// rollWeapon: this.#rollWeapon,
|
rollSpell: roll,
|
||||||
rollSpell: rollSpell,
|
|
||||||
cycleEquip: this.#cycleEquip,
|
|
||||||
addKompetenz: this.#addKompetenz,
|
addKompetenz: this.#addKompetenz,
|
||||||
deleteKompetenz: this.#deleteKompetenz,
|
deleteKompetenz: this.#deleteKompetenz,
|
||||||
editKompetenz: this.#editKompetenz,
|
editKompetenz: this.#editKompetenz,
|
||||||
@@ -411,7 +408,6 @@ export class M6NSCSheet extends M6ActorSheet {
|
|||||||
actions: {},
|
actions: {},
|
||||||
render: (_event, dialog) => {
|
render: (_event, dialog) => {
|
||||||
const dialogHTML = dialog.element;
|
const dialogHTML = dialog.element;
|
||||||
// Variable bei jeder Änderung aktualisieren
|
|
||||||
for (const key in resistenzen) {
|
for (const key in resistenzen) {
|
||||||
dialogHTML.querySelectorAll(`input[name="${key}-segment"]`).forEach((radio) => {
|
dialogHTML.querySelectorAll(`input[name="${key}-segment"]`).forEach((radio) => {
|
||||||
if (radio.value == resistenzen[key].kompetent) {
|
if (radio.value == resistenzen[key].kompetent) {
|
||||||
|
|||||||
+22
-22
@@ -12,8 +12,8 @@ export class M6WeaponSheet extends M6ItemSheet {
|
|||||||
...super.DEFAULT_OPTIONS, // Kopiert alle bestehenden Actions aus M6ItemSheet
|
...super.DEFAULT_OPTIONS, // Kopiert alle bestehenden Actions aus M6ItemSheet
|
||||||
actions: {
|
actions: {
|
||||||
...super.DEFAULT_OPTIONS.actions,
|
...super.DEFAULT_OPTIONS.actions,
|
||||||
cycleEquip: this.#cycleEquip
|
cycleEquip: this.#cycleEquip,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,42 +22,42 @@ export class M6WeaponSheet extends M6ItemSheet {
|
|||||||
tabs: [
|
tabs: [
|
||||||
{
|
{
|
||||||
id: "eigenschaften",
|
id: "eigenschaften",
|
||||||
icon: "fa-shield-halved"
|
icon: "fa-shield-halved",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "beschreibung",
|
id: "beschreibung",
|
||||||
icon: "fa-feather-pointed"
|
icon: "fa-feather-pointed",
|
||||||
}
|
},
|
||||||
// {
|
{
|
||||||
// id: "effects",
|
id: "effects",
|
||||||
// icon: "fa-bolt"
|
icon: "fa-bolt",
|
||||||
// }
|
},
|
||||||
],
|
],
|
||||||
initial: "eigenschaften",
|
initial: "eigenschaften",
|
||||||
labelPrefix: "Midgard6.Sheets.Tabs"
|
labelPrefix: "Midgard6.Sheets.Tabs",
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
static PARTS = {
|
static PARTS = {
|
||||||
header: {
|
header: {
|
||||||
template: systemPath("templates/item/header.hbs")
|
template: systemPath("templates/item/header.hbs"),
|
||||||
},
|
},
|
||||||
tabs: {
|
tabs: {
|
||||||
template: systemPath("templates/shared/tabs.hbs")
|
template: systemPath("templates/shared/tabs.hbs"),
|
||||||
},
|
},
|
||||||
eigenschaften: {
|
eigenschaften: {
|
||||||
template: systemPath("templates/item/waffen/eigenschaften.hbs"),
|
template: systemPath("templates/item/waffen/eigenschaften.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
},
|
},
|
||||||
beschreibung: {
|
beschreibung: {
|
||||||
template: systemPath("templates/item/description.hbs"),
|
template: systemPath("templates/item/description.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
}
|
},
|
||||||
// effects: {
|
effects: {
|
||||||
// template: systemPath("templates/shared/effects.hbs"),
|
template: systemPath("templates/shared/effects.hbs"),
|
||||||
// scrollable: [""]
|
scrollable: [""],
|
||||||
// }
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
async _addSpecifics(context) {
|
async _addSpecifics(context) {
|
||||||
@@ -68,8 +68,8 @@ export class M6WeaponSheet extends M6ItemSheet {
|
|||||||
static #cycleEquip() {
|
static #cycleEquip() {
|
||||||
this.item.update({
|
this.item.update({
|
||||||
system: {
|
system: {
|
||||||
equipped: !this.item.system.equipped
|
equipped: !this.item.system.equipped,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-1
@@ -17,14 +17,15 @@ import { M6WeaponSheet } from "./sheets/weapon-sheet.mjs";
|
|||||||
import { M6ArmorSheet } from "./sheets/armor-sheet.mjs";
|
import { M6ArmorSheet } from "./sheets/armor-sheet.mjs";
|
||||||
import { M6ZauberSheet } from "./sheets/zauber-sheet.mjs";
|
import { M6ZauberSheet } from "./sheets/zauber-sheet.mjs";
|
||||||
import { M6HintergrundSheet } from "./sheets/hintergrund-sheet.mjs";
|
import { M6HintergrundSheet } from "./sheets/hintergrund-sheet.mjs";
|
||||||
|
import { M6ActiveEffect } from "./active-effects/m6-active-effects.mjs";
|
||||||
import { M6ChatMessage } from "./ui/chat-message.mjs";
|
import { M6ChatMessage } from "./ui/chat-message.mjs";
|
||||||
import "./styles/M6.scss";
|
import "./styles/M6.scss";
|
||||||
import { localizeHelper } from "./helpers/utils.mjs";
|
|
||||||
|
|
||||||
Hooks.once("init", () => {
|
Hooks.once("init", () => {
|
||||||
CONFIG.ChatMessage.documentClass = M6ChatMessage;
|
CONFIG.ChatMessage.documentClass = M6ChatMessage;
|
||||||
CONFIG.ChatMessage.template = systemPath("templates/chat/message-default.hbs");
|
CONFIG.ChatMessage.template = systemPath("templates/chat/message-default.hbs");
|
||||||
|
|
||||||
|
CONFIG.ActiveEffect.documentClass = M6ActiveEffect;
|
||||||
CONFIG.Actor.dataModels = {
|
CONFIG.Actor.dataModels = {
|
||||||
character: CharacterData,
|
character: CharacterData,
|
||||||
nsc: NSCData,
|
nsc: NSCData,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<div class="col-6 row align-items-center" style="width: 100%; margin-left: 0">
|
<div class="col-6 row align-items-center" style="width: 100%; margin-left: 0">
|
||||||
<a
|
<a
|
||||||
class="col-8"
|
class="col-8"
|
||||||
data-action="rollSkill"
|
data-action="roll"
|
||||||
data-name="{{localize localizationName}}"
|
data-name="{{localize localizationName}}"
|
||||||
data-path="{{field.fieldPath}}"
|
data-path="{{field.fieldPath}}"
|
||||||
{{#unless @root.editable}}disabled{{/unless}}
|
{{#unless @root.editable}}disabled{{/unless}}
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
}}</p>
|
}}</p>
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
data-action="rollSkill"
|
data-action="roll"
|
||||||
data-name="{{localize localizationName}}"
|
data-name="{{localize localizationName}}"
|
||||||
data-path="{{field.fieldPath}}"
|
data-path="{{field.fieldPath}}"
|
||||||
{{#unless @root.editable}}disabled{{/unless}}
|
{{#unless @root.editable}}disabled{{/unless}}
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
<div class="d-flex justify-content-center align-items-center">
|
<div class="d-flex justify-content-center align-items-center">
|
||||||
<a
|
<a
|
||||||
class=""
|
class=""
|
||||||
data-action="rollSkill"
|
data-action="roll"
|
||||||
data-name="{{localize localizationName}}"
|
data-name="{{localize localizationName}}"
|
||||||
data-path="{{field.fieldPath}}"
|
data-path="{{field.fieldPath}}"
|
||||||
{{#unless @root.editable}}disabled{{/unless}}
|
{{#unless @root.editable}}disabled{{/unless}}
|
||||||
@@ -93,8 +93,8 @@
|
|||||||
<input
|
<input
|
||||||
class="resistenzenAttribut"
|
class="resistenzenAttribut"
|
||||||
type="number"
|
type="number"
|
||||||
name="{{field.fieldPath}}"
|
name="{{field.fields.value.fieldPath}}"
|
||||||
value="{{value}}"
|
value="{{value.value}}"
|
||||||
{{#if @root.system.locked}}disabled{{/if}}
|
{{#if @root.system.locked}}disabled{{/if}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -202,7 +202,7 @@
|
|||||||
<a
|
<a
|
||||||
class="item-control"
|
class="item-control"
|
||||||
title="{{localize 'Midgard6.Angriff'}} {{weapon.name}}"
|
title="{{localize 'Midgard6.Angriff'}} {{weapon.name}}"
|
||||||
data-action="rollWeapon"
|
data-action="roll"
|
||||||
data-item-id="{{weapon.id}}"
|
data-item-id="{{weapon.id}}"
|
||||||
data-skillPath="{{weapon.path}}"
|
data-skillPath="{{weapon.path}}"
|
||||||
{{#unless @root.editable}}disabled{{/unless}}
|
{{#unless @root.editable}}disabled{{/unless}}
|
||||||
@@ -261,7 +261,7 @@
|
|||||||
<a
|
<a
|
||||||
class="item-control"
|
class="item-control"
|
||||||
title="{{localize 'Midgard6.Angriff'}} {{weapon.name}}"
|
title="{{localize 'Midgard6.Angriff'}} {{weapon.name}}"
|
||||||
data-action="rollSpell"
|
data-action="roll"
|
||||||
data-item-id="{{weapon.id}}"
|
data-item-id="{{weapon.id}}"
|
||||||
data-skillPath="{{weapon.path}}"
|
data-skillPath="{{weapon.path}}"
|
||||||
{{#unless @root.editable}}disabled{{/unless}}
|
{{#unless @root.editable}}disabled{{/unless}}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
<p class="col-3 item-name">{{zauber.system.eigenschaften.ursprung}}</p>
|
<p class="col-3 item-name">{{zauber.system.eigenschaften.ursprung}}</p>
|
||||||
<p class="col-2 item-name">{{localize "Midgard6.Zauber.stufe"}} {{zauber.system.eigenschaften.stufe}}</p>
|
<p class="col-2 item-name">{{localize "Midgard6.Zauber.stufe"}} {{zauber.system.eigenschaften.stufe}}</p>
|
||||||
<a class="align-self-center col-1 fa-solid fa-book-open" {{#unless @root.editable}}disabled{{/unless}} data-action="cycleEquip" data-item-id="{{zauber._id}}" style="{{#if zauber.system.equipped}}color: var(--M6-text-brown);{{/if}}"></a>
|
<a class="align-self-center col-1 fa-solid fa-book-open" {{#unless @root.editable}}disabled{{/unless}} data-action="cycleEquip" data-item-id="{{zauber._id}}" style="{{#if zauber.system.equipped}}color: var(--M6-text-brown);{{/if}}"></a>
|
||||||
<a class="align-self-center col-2 fa-solid fa-dice-d20" data-action="rollSpell" {{#unless @root.editable}}disabled{{/unless}} data-name="{{zauber.name}}" data-item-id="{{zauber._id}}"></a>
|
<a class="align-self-center col-2 fa-solid fa-dice-d20" data-action="roll" {{#unless @root.editable}}disabled{{/unless}} data-name="{{zauber.name}}" data-item-id="{{zauber._id}}"></a>
|
||||||
<div class="col-1 d-flex document-controls" style="margin: 0.5rem 0; padding: 0">
|
<div class="col-1 d-flex document-controls" style="margin: 0.5rem 0; padding: 0">
|
||||||
{{#if @root.editable}}
|
{{#if @root.editable}}
|
||||||
<a
|
<a
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<div class="segmented-button-row">
|
<div class="segmented-button-row">
|
||||||
<!-- Option 1 -->
|
<!-- Option 1 -->
|
||||||
<label class="segmented-button">
|
<label class="segmented-button">
|
||||||
<input type="radio" name="vorteil-segment" value="-1" />
|
<input type="radio" name="vorteil-segment" value="-1" data-value="-1" />
|
||||||
<span class="segmented-button__content">
|
<span class="segmented-button__content">
|
||||||
<i class="icon fa-solid fa-caret-down"></i>
|
<i class="icon fa-solid fa-caret-down"></i>
|
||||||
<i class="icon fa-solid fa-dice-d20"></i>
|
<i class="icon fa-solid fa-dice-d20"></i>
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
<!-- Option 2 -->
|
<!-- Option 2 -->
|
||||||
<label class="segmented-button">
|
<label class="segmented-button">
|
||||||
<input type="radio" name="vorteil-segment" value="0" checked />
|
<input type="radio" name="vorteil-segment" value="0" data-value="0" checked />
|
||||||
<span class="segmented-button__content">
|
<span class="segmented-button__content">
|
||||||
<i class="icon fa-solid fa-dice-d20" ></i>
|
<i class="icon fa-solid fa-dice-d20" ></i>
|
||||||
</span>
|
</span>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
<!-- Option 3 -->
|
<!-- Option 3 -->
|
||||||
<label class="segmented-button">
|
<label class="segmented-button">
|
||||||
<input type="radio" name="vorteil-segment" value="1" />
|
<input type="radio" name="vorteil-segment" value="1" data-value="1"/>
|
||||||
<span class="segmented-button__content">
|
<span class="segmented-button__content">
|
||||||
<i class="icon fa-solid fa-dice-d20"></i>
|
<i class="icon fa-solid fa-dice-d20"></i>
|
||||||
<i class="icon fa-solid fa-caret-up"></i>
|
<i class="icon fa-solid fa-caret-up"></i>
|
||||||
|
|||||||
Reference in new issue
Block a user