24
lang/de.json
24
lang/de.json
|
|
@ -183,7 +183,11 @@
|
|||
"meditieren": "Meditieren",
|
||||
"menschenkenntnis": "Menschenkenntnis",
|
||||
"meucheln": "Meucheln",
|
||||
"musizieren": "Musizieren",
|
||||
"musizierenFloete": "Musizieren (Flöten)",
|
||||
"musizierenBlas": "Musizieren (Blasinstrumente)",
|
||||
"musizierenRythmus": "Musizieren (Rythmusinstrumente)",
|
||||
"musizierenStreich": "Musizieren (Streichinstrumente)",
|
||||
"musizierenZupf": "Musizieren (Zupfinstrumente)",
|
||||
"naturkunde": "Naturkunde",
|
||||
"ninjutsu": "NinJutsu",
|
||||
"orakelkunst": "Orakelkunst",
|
||||
|
|
@ -213,7 +217,9 @@
|
|||
"thaumagraphie": "Thaumagraphie",
|
||||
"thaumalogie": "Thaumalogie",
|
||||
"tierkunde": "Tierkunde",
|
||||
"ueberleben": "Überleben",
|
||||
"ueberlebenWald": "Überleben (Wald)",
|
||||
"ueberlebenSteppe": "Überleben (Steppe)",
|
||||
"ueberlebenGebirge": "Überleben (Gebirge)",
|
||||
"verfuehren": "Verführen",
|
||||
"verhoeren": "Verhören",
|
||||
"verstellen": "Verstellen",
|
||||
|
|
@ -241,8 +247,11 @@
|
|||
"enduranceBonus": "Ausdauerbonus",
|
||||
"lpProtection": "Rüstungsschutz (LP)",
|
||||
"apProtection": "Rüstungsschutz (AP)",
|
||||
"perception": "Wahrnehmung",
|
||||
"drinking": "Trinken",
|
||||
"deprivation": "Zähigkeit",
|
||||
"deprivations": "Entbehrungen",
|
||||
"deprivationCold": "Zähigkeit Kälte",
|
||||
"deprivationHeat": "Zähigkeit Hitze",
|
||||
"deprivationFood": "Zähigkeit Durst/Hunger",
|
||||
|
||||
"new-skill": "Neue Fertigkeit",
|
||||
"special": "Spezial",
|
||||
|
|
@ -300,7 +309,7 @@
|
|||
"spell-process-veraendern": "Verändern",
|
||||
"spell-process-vigilsignien": "Vigilsignien",
|
||||
"spell-process-wundertat": "Wundertat",
|
||||
"spell-process-wilder_Dweomer": "Wilder Dweomer",
|
||||
"spell-process-wilder_dweomer": "Wilder Dweomer",
|
||||
"spell-process-zerstoeren": "Zerstören",
|
||||
"spell-process-zauberlied": "Zauberlieder",
|
||||
"spell-process-zaubersalz": "Zaubersalze",
|
||||
|
|
@ -401,8 +410,9 @@
|
|||
"mod-stat-ap": "Ausdauerpunkte",
|
||||
"mod-stat-lpProtection": "Rüstungsschutz (LP)",
|
||||
"mod-stat-apProtection": "Rüstungsschutz (AP)",
|
||||
"mod-stat-perception": "Wahrnehmung",
|
||||
"mod-stat-drinking": "Trinken",
|
||||
"mod-stat-deprivationCold": "Entbehrungen Kälte",
|
||||
"mod-stat-deprivationHeat": "Entbehrungen Hitze",
|
||||
"mod-stat-deprivationFood": "Entbehrungen Durst/Hunger",
|
||||
|
||||
"mod-type": "Typ der Modifikation",
|
||||
"mod-id": "Was soll modifiziert werden",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,110 @@
|
|||
/* global Handlebars, game, TextEditor, WOD5E */
|
||||
|
||||
import { M5Skill } from "./module/M5Base";
|
||||
import { M5Character } from "./module/actors/M5Character";
|
||||
|
||||
/**
|
||||
* Define any helpers necessary for working with Handlebars
|
||||
* @return {Promise}
|
||||
*/
|
||||
export const loadHelpers = async function () {
|
||||
Handlebars.registerHelper("times", (n: number, block) => {
|
||||
var accum = "";
|
||||
for (let i = 0; i < n; ++i) accum += block.fn(i);
|
||||
return accum;
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("array", (arr: any[], index: number) => {
|
||||
return arr[index];
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("m5concat", (...values) => {
|
||||
const options = values.pop();
|
||||
const join = options.hash?.join || "";
|
||||
//return new Handlebars.SafeString(values.join(join));
|
||||
return values.map((val) => val.toString()).join(join);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("add", (...values) => {
|
||||
const options = values.pop();
|
||||
return values.reduce((prev, cur) => prev + cur);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("localizeMidgard", (str: string) => {
|
||||
const template = Handlebars.compile("{{localize value}}");
|
||||
return template({
|
||||
value: "midgard5." + str,
|
||||
});
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("skillBonus", (actorId: string, skill: M5Skill) => {
|
||||
const actor = (game as Game).actors.get(actorId) as M5Character;
|
||||
return actor.skillBonus(skill).toString();
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("skillEw", (actorId: string, skill: M5Skill) => {
|
||||
const actor = (game as Game).actors.get(actorId) as M5Character;
|
||||
return actor.skillEw(skill).toString();
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("skill", (skillId: string) => {
|
||||
return (game as Game).items.get(skillId);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("itemValue", (id: string, path: string) => {
|
||||
let obj = (game as Game).items.get(id);
|
||||
path.split(".").forEach((p) => (obj = obj[p]));
|
||||
return `${obj}`;
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("actorItemValue", (actorId: any, itemId: string, path: string, token?: boolean) => {
|
||||
//console.log("actorItemValue", actorId, itemId, path)
|
||||
const actor = (game as Game).actors.get(actorId);
|
||||
let obj = actor.items.get(itemId)?.system;
|
||||
path.split(".").forEach((p) => {
|
||||
if (obj) obj = obj[p];
|
||||
});
|
||||
return `${obj}`;
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("icon", (relpath: string) => {
|
||||
return `systems/midgard5/assets/icons/${relpath}`;
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("isSkillInList", (skillName: string, list: any) => {
|
||||
for (let key in list) {
|
||||
if (list[key]?.label?.toLowerCase() === skillName?.toLowerCase()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("skillEwInList", (skillName: string, list: any) => {
|
||||
for (let key in list) {
|
||||
if (list[key]?.label?.toLowerCase() === skillName?.toLowerCase()) {
|
||||
return list[key].calc.ew;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("stripHtml", function (param) {
|
||||
var regex = /(<([^>]+)>)/gi;
|
||||
return param.replace(regex, "");
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("contains", (label: string, contains: string) => {
|
||||
return label.toLowerCase().includes(contains.toLowerCase());
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("count", (object: any) => {
|
||||
var length = 0;
|
||||
for (var key in object) {
|
||||
if (object.hasOwnProperty(key)) {
|
||||
++length;
|
||||
}
|
||||
}
|
||||
return length;
|
||||
});
|
||||
};
|
||||
107
source/index.ts
107
source/index.ts
|
|
@ -2,113 +2,18 @@ import Logger from "./utils/Logger";
|
|||
import M5CharacterSheet from "./module/sheets/M5CharacterSheet";
|
||||
import preloadTemplates from "./PreloadTemplates";
|
||||
import { M5Character } from "./module/actors/M5Character";
|
||||
import { M5ItemMod, M5ModOperation, M5Skill, M5TimeUnit } from "./module/M5Base";
|
||||
import { M5ModOperation, M5TimeUnit } from "./module/M5Base";
|
||||
import { M5ItemSheet } from "./module/sheets/M5ItemSheet";
|
||||
import { M5Item } from "./module/items/M5Item";
|
||||
import { reroll } from "./module/rolls/reroll";
|
||||
import { loadHelpers } from "./helpers";
|
||||
import { loadSettings } from "./settings";
|
||||
|
||||
Hooks.once("init", async () => {
|
||||
Logger.log("M5 | Initialisierung Midgard 5");
|
||||
|
||||
Handlebars.registerHelper("times", (n: number, block) => {
|
||||
var accum = "";
|
||||
for (let i = 0; i < n; ++i) accum += block.fn(i);
|
||||
return accum;
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("array", (arr: any[], index: number) => {
|
||||
return arr[index];
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("m5concat", (...values) => {
|
||||
const options = values.pop();
|
||||
const join = options.hash?.join || "";
|
||||
//return new Handlebars.SafeString(values.join(join));
|
||||
return values.map((val) => val.toString()).join(join);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("add", (...values) => {
|
||||
const options = values.pop();
|
||||
return values.reduce((prev, cur) => prev + cur);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("localizeMidgard", (str: string) => {
|
||||
const template = Handlebars.compile("{{localize value}}");
|
||||
return template({
|
||||
value: "midgard5." + str,
|
||||
});
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("skillBonus", (actorId: string, skill: M5Skill) => {
|
||||
const actor = (game as Game).actors.get(actorId) as M5Character;
|
||||
return actor.skillBonus(skill).toString();
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("skillEw", (actorId: string, skill: M5Skill) => {
|
||||
const actor = (game as Game).actors.get(actorId) as M5Character;
|
||||
return actor.skillEw(skill).toString();
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("skill", (skillId: string) => {
|
||||
return (game as Game).items.get(skillId);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("itemValue", (id: string, path: string) => {
|
||||
let obj = (game as Game).items.get(id);
|
||||
path.split(".").forEach((p) => (obj = obj[p]));
|
||||
return `${obj}`;
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("actorItemValue", (actorId: any, itemId: string, path: string, token?: boolean) => {
|
||||
//console.log("actorItemValue", actorId, itemId, path)
|
||||
const actor = (game as Game).actors.get(actorId);
|
||||
let obj = actor.items.get(itemId)?.system;
|
||||
path.split(".").forEach((p) => {
|
||||
if (obj) obj = obj[p];
|
||||
});
|
||||
return `${obj}`;
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("icon", (relpath: string) => {
|
||||
return `systems/midgard5/assets/icons/${relpath}`;
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("isSkillInList", (skillName: string, list: any) => {
|
||||
for (let key in list) {
|
||||
if (list[key]?.label?.toLowerCase() === skillName?.toLowerCase()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("skillEwInList", (skillName: string, list: any) => {
|
||||
for (let key in list) {
|
||||
if (list[key]?.label?.toLowerCase() === skillName?.toLowerCase()) {
|
||||
return list[key].calc.ew;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("stripHtml", function (param) {
|
||||
var regex = /(<([^>]+)>)/gi;
|
||||
return param.replace(regex, "");
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("contains", (label: string, contains: string) => {
|
||||
return label.toLowerCase().includes(contains.toLowerCase());
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("count", (object: any) => {
|
||||
var length = 0;
|
||||
for (var key in object) {
|
||||
if (object.hasOwnProperty(key)) {
|
||||
++length;
|
||||
}
|
||||
}
|
||||
return length;
|
||||
});
|
||||
// Load settings into Foundry
|
||||
loadSettings();
|
||||
|
||||
// Default Sheet für Items definieren und das Standardsheet deaktivieren
|
||||
Items.unregisterSheet("core", ItemSheet);
|
||||
|
|
@ -122,6 +27,8 @@ Hooks.once("init", async () => {
|
|||
CONFIG.Item.documentClass = M5Item;
|
||||
//RegisterSettings();
|
||||
await preloadTemplates();
|
||||
|
||||
loadHelpers();
|
||||
});
|
||||
|
||||
Hooks.once("setup", () => {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ export interface M5RollData {
|
|||
i: any;
|
||||
b: any;
|
||||
iType: string;
|
||||
rolls: {};
|
||||
rolls: any;
|
||||
res: {
|
||||
label: string;
|
||||
};
|
||||
|
|
@ -104,17 +104,9 @@ export enum M5Stats {
|
|||
AP = "ap",
|
||||
PROTECTION_LP = "lpProtection",
|
||||
PROTECTION_AP = "apProtection",
|
||||
PERCEPTION = "perception",
|
||||
DRINKING = "drinking",
|
||||
HOARD = "hoard",
|
||||
HOARD_NEXT = "hoardNext",
|
||||
HOARD_MIN = "hoardMin",
|
||||
WEALTH = "wealth",
|
||||
LOAD = "load",
|
||||
HEAVY_LOAD = "heavyLoad",
|
||||
LOAD_MAX = "loadMax",
|
||||
THRUST_LOAD = "thrustLoad",
|
||||
ENCUMBRANCE = "encumbrance",
|
||||
DEPRIVATION_COLD = "deprivationCold",
|
||||
DEPRIVATION_HEAT = "deprivationHeat",
|
||||
DEPRIVATION_FOOD = "deprivationFood",
|
||||
}
|
||||
|
||||
export enum M5ModType {
|
||||
|
|
@ -199,10 +191,9 @@ export interface M5CharacterCalculatedData {
|
|||
brawlFw: number;
|
||||
poisonResistance: M5ModResult;
|
||||
enduranceBonus: number;
|
||||
perception: M5ModResult;
|
||||
perceptionFW: number;
|
||||
drinking: M5ModResult;
|
||||
drinkingFW: number;
|
||||
deprivationCold: M5ModResult;
|
||||
deprivationHeat: M5ModResult;
|
||||
deprivationFood: M5ModResult;
|
||||
hoard: number;
|
||||
hoardNext: number;
|
||||
hoardMin: number;
|
||||
|
|
|
|||
|
|
@ -114,10 +114,9 @@ export class M5Character extends Actor {
|
|||
brawlFw: 0,
|
||||
poisonResistance: { value: 0, mods: [] },
|
||||
enduranceBonus: 0,
|
||||
perception: { value: 0, mods: [] },
|
||||
perceptionFW: 0,
|
||||
drinking: { value: 0, mods: [] },
|
||||
drinkingFW: 0,
|
||||
deprivationCold: { value: 0, mods: [] },
|
||||
deprivationHeat: { value: 0, mods: [] },
|
||||
deprivationFood: { value: 0, mods: [] },
|
||||
hoard: 0,
|
||||
encumbrance: 0,
|
||||
load: 0,
|
||||
|
|
@ -189,10 +188,9 @@ export class M5Character extends Actor {
|
|||
ret.stats.brawlFw = ret.stats.brawl.value + ret.stats.attackBonus.value + (data.info.race === "Zwerg" ? 1 : 0);
|
||||
ret.stats.poisonResistance = this.modResult(30 + Math.floor(ret.attributes.ko.value / 2));
|
||||
ret.stats.enduranceBonus = Math.floor(ret.attributes.ko.value / 10) + Math.floor(ret.attributes.st.value / 20);
|
||||
ret.stats.perception = this.modResult(0);
|
||||
ret.stats.perceptionFW = 6;
|
||||
ret.stats.drinking = this.modResult(0);
|
||||
ret.stats.drinkingFW = Math.floor(ret.attributes.ko.value / 10);
|
||||
ret.stats.deprivationCold = this.modResult(Math.floor(ret.attributes.ko.value / 2));
|
||||
ret.stats.deprivationHeat = this.modResult(Math.floor(ret.attributes.ko.value / 2));
|
||||
ret.stats.deprivationFood = this.modResult(Math.floor(40 + ret.attributes.ko.value / 2));
|
||||
ret.stats.hoardMin = M5Character.levelThreshold.at(ret.level - 1) / 2;
|
||||
ret.stats.hoardNext = M5Character.levelThreshold.at(ret.level) / 2;
|
||||
ret.stats.wealth = parseFloat((data.info.gold + data.info.silver / 10 + data.info.copper / 100).toPrecision(3));
|
||||
|
|
@ -207,7 +205,10 @@ export class M5Character extends Actor {
|
|||
const aggregate = new M5ModAggregate(data, ret);
|
||||
|
||||
context.items
|
||||
?.filter((item) => (item.type === "item" || item.type === "effect" || item.type === "armor" || item.type === "container" || item.type === "class") && item.system.equipped)
|
||||
?.filter(
|
||||
(item) =>
|
||||
(item.type === "item" || item.type === "skill" || item.type === "effect" || item.type === "armor" || item.type === "container" || item.type === "class") && item.system.equipped
|
||||
)
|
||||
.forEach((item) => {
|
||||
const mods = item.system.mods;
|
||||
//console.log("Actor item mods", mods)
|
||||
|
|
@ -250,6 +251,7 @@ export class M5Character extends Actor {
|
|||
calc: item.system.calc,
|
||||
equipped: item.system?.equipped,
|
||||
weight: item.system.weight || 0,
|
||||
capacity: item.system.capacity || 0,
|
||||
value: item.system.value || 0,
|
||||
currency: item.system.currency || "",
|
||||
quantity: item.system.quantity || 0,
|
||||
|
|
@ -447,41 +449,7 @@ export class M5Character extends Actor {
|
|||
containerId: item.system.containerId || "",
|
||||
};
|
||||
});
|
||||
|
||||
//if (!skip?.encumbrance) {
|
||||
//const item = context.items.filter((x) => x.name === "Belastung");
|
||||
//if (item.length === 0) {
|
||||
// this.createEffect("Belastung", [
|
||||
// { id: "movement", operation: M5ModOperation.DIVISION, type: M5ModType.STAT, value: 2 },
|
||||
// { id: "attackBonus", operation: M5ModOperation.SUBTRACT, type: M5ModType.STAT, value: 4 },
|
||||
// { id: "defenseBonus", operation: M5ModOperation.SUBTRACT, type: M5ModType.STAT, value: 4 }
|
||||
// ]);
|
||||
//} else if (item.length === 2) {
|
||||
// item[1]?.delete();
|
||||
//}
|
||||
//
|
||||
//if (item.length === 1) {
|
||||
// item[0]?.update({
|
||||
// img: "icons/containers/bags/sack-simple-leather-orange.webp" });
|
||||
// }
|
||||
//
|
||||
//if (ret.stats.encumbrance <= ret.stats.heavyLoad) {
|
||||
// item[0]?.update({
|
||||
// data: {
|
||||
// equipped: false,
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
//if (ret.stats.encumbrance > ret.stats.heavyLoad) {
|
||||
// item[0].update({
|
||||
// data: {
|
||||
// equipped: true,
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
if (!skip?.class) {
|
||||
context.items
|
||||
|
|
@ -540,16 +508,6 @@ export class M5Character extends Actor {
|
|||
pp: item.system.pp,
|
||||
calc: item.system.calc,
|
||||
} as M5SkillCalculated;
|
||||
|
||||
// Adjust attribute Aussehen based on Athletik skill
|
||||
if (item.name === "Athletik") {
|
||||
ret.attributes.au.value += Math.floor(item.system.fw / 3);
|
||||
}
|
||||
|
||||
// Adjust stat Bewegungsweite based on Laufen skill
|
||||
if (item.name === "Laufen") {
|
||||
ret.stats.movement.value += Math.floor(item.system.fw / 3);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,8 +41,9 @@ export default class M5ModAggregate {
|
|||
this.push({ type: M5ModType.STAT, id: M5Stats.AP, operation: M5ModOperation.SET, value: calc.stats.ap.value }, characterString);
|
||||
this.push({ type: M5ModType.STAT, id: M5Stats.PROTECTION_LP, operation: M5ModOperation.SET, value: calc.stats.lpProtection.value }, characterString);
|
||||
this.push({ type: M5ModType.STAT, id: M5Stats.PROTECTION_AP, operation: M5ModOperation.SET, value: calc.stats.apProtection.value }, characterString);
|
||||
this.push({ type: M5ModType.STAT, id: M5Stats.PERCEPTION, operation: M5ModOperation.SET, value: calc.stats.perception.value }, characterString);
|
||||
this.push({ type: M5ModType.STAT, id: M5Stats.DRINKING, operation: M5ModOperation.SET, value: calc.stats.drinking.value }, characterString);
|
||||
this.push({ type: M5ModType.STAT, id: M5Stats.DEPRIVATION_COLD, operation: M5ModOperation.SET, value: calc.stats.deprivationCold.value }, characterString);
|
||||
this.push({ type: M5ModType.STAT, id: M5Stats.DEPRIVATION_HEAT, operation: M5ModOperation.SET, value: calc.stats.deprivationHeat.value }, characterString);
|
||||
this.push({ type: M5ModType.STAT, id: M5Stats.DEPRIVATION_FOOD, operation: M5ModOperation.SET, value: calc.stats.deprivationFood.value }, characterString);
|
||||
}
|
||||
|
||||
push(mod: M5ItemMod, source: string) {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ export class M5Item extends Item {
|
|||
const character = actor as M5Character;
|
||||
const itemData = (this as any).system;
|
||||
const calc = itemData.calc;
|
||||
const name = (this as any).name;
|
||||
|
||||
if (itemType === "item") {
|
||||
calc.containers = null;
|
||||
|
|
@ -45,6 +46,29 @@ export class M5Item extends Item {
|
|||
},
|
||||
];
|
||||
|
||||
// Adjust attribute Aussehen based on Athletik skill
|
||||
if (name === "Athletik") {
|
||||
itemData.mods[0] = { type: "attribute", id: "au", operation: "add100", value: Math.floor(calc.fw / 3) };
|
||||
}
|
||||
// Adjust stat Bewegungsweite based on Laufen skill
|
||||
if (name === "Laufen") {
|
||||
itemData.mods[0] = { type: "stat", id: "movement", operation: "add", value: Math.floor(calc.fw / 3) };
|
||||
}
|
||||
|
||||
// Adjust stat Kälte based on Überleben (Gebirge) skill
|
||||
if (name === "Überleben (Gebirge)") {
|
||||
itemData.mods[0] = { type: "stat", id: "deprivationCold", operation: "add", value: Math.floor(calc.fw * 5) };
|
||||
}
|
||||
|
||||
// // Adjust stat Kälte based on Überleben (Steppe) skill
|
||||
if (name === "Überleben (Steppe)") {
|
||||
itemData.mods[0] = { type: "stat", id: "deprivationHeat", operation: "add", value: Math.floor(calc.fw * 5) };
|
||||
}
|
||||
// // Adjust stat Durst & Hunger based on Robustheit skill
|
||||
if (name === "Robustheit") {
|
||||
itemData.mods[0] = { type: "stat", id: "deprivationFood", operation: "add", value: Math.floor(calc.fw * 5) };
|
||||
}
|
||||
|
||||
if (character) {
|
||||
const actorCalc = character.derivedData({
|
||||
containers: true,
|
||||
|
|
@ -323,7 +347,7 @@ export class M5Item extends Item {
|
|||
}
|
||||
}
|
||||
|
||||
const roll = new M5Roll(rollData, this.actor, item.name);
|
||||
const roll = new M5Roll(rollData, this.actor, item.name, item.id);
|
||||
return roll.toMessage();
|
||||
} else {
|
||||
ChatMessage.create({
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ export class M5Roll {
|
|||
public _total: number = 0;
|
||||
public pool: PoolTerm = null;
|
||||
|
||||
constructor(public data: M5RollData, public actor: any, public label: string) {
|
||||
constructor(public data: M5RollData, public actor: any, public label: string, public id?: string) {
|
||||
//super(null)
|
||||
//this.data = rollData
|
||||
}
|
||||
|
|
@ -89,6 +89,51 @@ export class M5Roll {
|
|||
});
|
||||
|
||||
this.data.res.label = this.label;
|
||||
console.log(this.data);
|
||||
if ((game as Game).settings.get("midgard5", "automatedPP") && this.data.iType !== null) {
|
||||
if ((this.data.i.type === "language" || this.data.i.type === "general") && this.data.rolls[0].dice[0] >= 16) {
|
||||
this.actor.items.get(this.id).update({
|
||||
system: {
|
||||
pp: this.data.i.pp + 1,
|
||||
},
|
||||
});
|
||||
} else if (this.data.rolls[0].dice[0] === 20) {
|
||||
if (this.data.i.type === "combat") {
|
||||
// Rolling through skill
|
||||
this.actor.items.get(this.id).update({
|
||||
system: {
|
||||
pp: this.data.i.pp + 1,
|
||||
},
|
||||
});
|
||||
} else if (this.data.iType === "weapon") {
|
||||
// Rolling through Weapon Item
|
||||
const skill = this.actor.items.get(this.data.i.skillId);
|
||||
skill.update({
|
||||
system: {
|
||||
pp: skill.system.pp + 1,
|
||||
},
|
||||
});
|
||||
} else if (this.data.iType === "defensiveWeapon") {
|
||||
// Rolling through defensiveWeapon Item
|
||||
const skill = this.actor.items.get(this.data.i.skillId);
|
||||
skill.update({
|
||||
system: {
|
||||
pp: skill.system.pp + 1,
|
||||
},
|
||||
});
|
||||
} else if (this.data.iType === "spell") {
|
||||
// Rolling through Spell Item
|
||||
const klasse = this.actor.items.find((x) => x.type === "class" && x.system.equipped);
|
||||
klasse.update({
|
||||
system: {
|
||||
lernKostenZauber: {
|
||||
[this.data.i.process]: { pp: klasse.system.lernKostenZauber[this.data.i.process].pp + 1 },
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this._evaluated = true;
|
||||
return this;
|
||||
|
|
@ -204,13 +249,13 @@ export class M5Roll {
|
|||
return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.brawl"));
|
||||
}
|
||||
|
||||
static perception(actor: any) {
|
||||
static deprivationCold(actor: any) {
|
||||
const rollData = actor.getRollData() as M5RollData;
|
||||
|
||||
rollData.rolls["0"] = {
|
||||
formula: "1d20 + @c.calc.stats.perception.value + @c.calc.stats.perceptionFW",
|
||||
formula: "@c.calc.stats.deprivationCold.value -1D100",
|
||||
enabled: true,
|
||||
label: (game as Game).i18n.localize("midgard5.perception"),
|
||||
label: (game as Game).i18n.localize("midgard5.deprivationCold"),
|
||||
result: "",
|
||||
total: 0,
|
||||
totalStr: "",
|
||||
|
|
@ -218,16 +263,16 @@ export class M5Roll {
|
|||
css: "",
|
||||
} as M5RollResult;
|
||||
|
||||
return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.perception"));
|
||||
return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.deprivationCold"));
|
||||
}
|
||||
|
||||
static drinking(actor: any) {
|
||||
static deprivationHeat(actor: any) {
|
||||
const rollData = actor.getRollData() as M5RollData;
|
||||
|
||||
rollData.rolls["0"] = {
|
||||
formula: "1d20 + @c.calc.stats.drinking.value + @c.calc.stats.drinkingFW",
|
||||
formula: "@c.calc.stats.deprivationHeat.value -1D100",
|
||||
enabled: true,
|
||||
label: (game as Game).i18n.localize("midgard5.drinking"),
|
||||
label: (game as Game).i18n.localize("midgard5.deprivationHeat"),
|
||||
result: "",
|
||||
total: 0,
|
||||
totalStr: "",
|
||||
|
|
@ -235,7 +280,41 @@ export class M5Roll {
|
|||
css: "",
|
||||
} as M5RollResult;
|
||||
|
||||
return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.drinking"));
|
||||
return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.deprivationHeat"));
|
||||
}
|
||||
|
||||
static deprivationFood(actor: any) {
|
||||
const rollData = actor.getRollData() as M5RollData;
|
||||
|
||||
rollData.rolls["0"] = {
|
||||
formula: "@c.calc.stats.deprivationFood.value -1D100",
|
||||
enabled: true,
|
||||
label: (game as Game).i18n.localize("midgard5.deprivationFood"),
|
||||
result: "",
|
||||
total: 0,
|
||||
totalStr: "",
|
||||
dice: {},
|
||||
css: "",
|
||||
} as M5RollResult;
|
||||
|
||||
return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.deprivationFood"));
|
||||
}
|
||||
|
||||
static cleanSpell(actor: any) {
|
||||
const rollData = actor.getRollData() as M5RollData;
|
||||
|
||||
rollData.rolls["0"] = {
|
||||
formula: "1d20 + @c.calc.stats.spellCasting.value",
|
||||
enabled: true,
|
||||
label: (game as Game).i18n.localize("midgard5.spellCasting"),
|
||||
result: "",
|
||||
total: 0,
|
||||
totalStr: "",
|
||||
dice: {},
|
||||
css: "",
|
||||
} as M5RollResult;
|
||||
|
||||
return new M5Roll(rollData, actor, (game as Game).i18n.localize("midgard5.spellCasting"));
|
||||
}
|
||||
|
||||
static defense(actor: any) {
|
||||
|
|
|
|||
|
|
@ -246,13 +246,23 @@ export default class M5CharacterSheet extends ActorSheet {
|
|||
await roll.toMessage();
|
||||
});
|
||||
|
||||
html.find(".roll-perception-button").on("click", async (event) => {
|
||||
const roll = M5Roll.perception(this.actor);
|
||||
html.find(".roll-cleanSpell-button").on("click", async (event) => {
|
||||
const roll = M5Roll.cleanSpell(this.actor);
|
||||
await roll.toMessage();
|
||||
});
|
||||
|
||||
html.find(".roll-drinking-button").on("click", async (event) => {
|
||||
const roll = M5Roll.drinking(this.actor);
|
||||
html.find(".roll-deprivationCold-button").on("click", async (event) => {
|
||||
const roll = M5Roll.deprivationCold(this.actor);
|
||||
await roll.toMessage();
|
||||
});
|
||||
|
||||
html.find(".roll-deprivationHeat-button").on("click", async (event) => {
|
||||
const roll = M5Roll.deprivationHeat(this.actor);
|
||||
await roll.toMessage();
|
||||
});
|
||||
|
||||
html.find(".roll-deprivationFood-button").on("click", async (event) => {
|
||||
const roll = M5Roll.deprivationFood(this.actor);
|
||||
await roll.toMessage();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
/* global game */
|
||||
|
||||
/**
|
||||
* Define all game settings here
|
||||
* @return {Promise}
|
||||
*/
|
||||
export const loadSettings = async function () {
|
||||
(game as Game).settings.register("midgard5", "automatedPP", {
|
||||
name: "Automatische Praxispunkte",
|
||||
hint: "Falls aktiv, werden Praxispunkte automatisch angerechnet.",
|
||||
scope: "world",
|
||||
config: true,
|
||||
default: true,
|
||||
type: Boolean,
|
||||
});
|
||||
};
|
||||
|
|
@ -101,7 +101,11 @@
|
|||
"meditieren": { "fw": 0, "attribute": "wk", "initial": 8, "pp": 0 },
|
||||
"menschenkenntnis": { "fw": 3, "attribute": "in", "initial": 8, "pp": 0 },
|
||||
"meucheln": { "fw": 0, "attribute": "gs", "initial": 8, "pp": 0 },
|
||||
"musizieren": { "fw": 0, "attribute": "gs", "initial": 12, "pp": 0 },
|
||||
"musizierenFloete": { "fw": 0, "attribute": "gs", "initial": 12, "pp": 0 },
|
||||
"musizierenBlas": { "fw": 0, "attribute": "gs", "initial": 12, "pp": 0 },
|
||||
"musizierenRythmus": { "fw": 0, "attribute": "gs", "initial": 12, "pp": 0 },
|
||||
"musizierenStreich": { "fw": 0, "attribute": "gs", "initial": 12, "pp": 0 },
|
||||
"musizierenZupf": { "fw": 0, "attribute": "gs", "initial": 12, "pp": 0 },
|
||||
"ninjutsu": { "fw": 0, "attribute": "gw", "initial": 8, "pp": 0 },
|
||||
"naturkunde": { "fw": 0, "attribute": "in", "initial": 8, "pp": 0 },
|
||||
"orakelkunst": { "fw": 0, "attribute": "in", "initial": 8, "pp": 0 },
|
||||
|
|
@ -131,7 +135,9 @@
|
|||
"tauchen": { "fw": 6, "attribute": "ko", "initial": 8, "pp": 0 },
|
||||
"tanzen": { "fw": 6, "attribute": "ko", "initial": 8, "pp": 0 },
|
||||
"tierkunde": { "fw": 0, "attribute": "in", "initial": 8, "pp": 0 },
|
||||
"ueberleben": { "fw": 6, "attribute": "in", "initial": 8, "pp": 0 },
|
||||
"ueberlebenWald": { "fw": 6, "attribute": "in", "initial": 8, "pp": 0 },
|
||||
"ueberlebenSteppe": { "fw": 6, "attribute": "in", "initial": 8, "pp": 0 },
|
||||
"ueberlebenGebirge": { "fw": 6, "attribute": "in", "initial": 8, "pp": 0 },
|
||||
"verfuehren": { "fw": 3, "attribute": "pa", "initial": 8, "pp": 0 },
|
||||
"verhoeren": { "fw": 3, "attribute": "pa", "initial": 8, "pp": 0 },
|
||||
"verstellen": { "fw": 3, "attribute": "pa", "initial": 8, "pp": 0 },
|
||||
|
|
@ -216,6 +222,7 @@
|
|||
"physical": {
|
||||
"value": 0,
|
||||
"weight": 0,
|
||||
"capacity": 0,
|
||||
"containerId": "",
|
||||
"magic": false
|
||||
},
|
||||
|
|
@ -315,6 +322,7 @@
|
|||
"templates": ["itemDescription", "attributeSelection"],
|
||||
"fw": 0,
|
||||
"attribute": "st",
|
||||
"equipped": true,
|
||||
"skill": "",
|
||||
"type": "general",
|
||||
"rolls": {
|
||||
|
|
@ -328,7 +336,8 @@
|
|||
"output": ""
|
||||
},
|
||||
"pp": 0,
|
||||
"calc": {}
|
||||
"calc": {},
|
||||
"mods": {}
|
||||
},
|
||||
"item": {
|
||||
"templates": ["itemDescription", "equippable", "physical", "valuable", "hoarded"],
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@
|
|||
<tr>
|
||||
<td>{{localize "midgard5.luckPoints"}}</td>
|
||||
<td><input name="data.gp" type="text" value="{{data.gp}}" data-dtype="Number" /></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>{{localize "midgard5.valuable"}}</td>
|
||||
<td class="fixed-value">{{data.calc.stats.wealth}}</td>
|
||||
</tr>
|
||||
<tr height = 10px></tr>
|
||||
</tbody>
|
||||
|
|
@ -104,23 +104,43 @@
|
|||
<td class="fixed-value">{{data.calc.stats.resistanceBody.value}}</td>
|
||||
</tr>
|
||||
{{#if (eq data.info.race "Zwerg")}}
|
||||
<tr>
|
||||
<td>{{localize "midgard5.hoard"}}</td>
|
||||
<td class="fixed-value">{{data.calc.stats.hoard}}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{localize "midgard5.hoardMin"}}</td>
|
||||
<td class="fixed-value">{{data.calc.stats.hoardMin}}</td>
|
||||
<td>{{localize "midgard5.hoard-next"}}</td>
|
||||
<td class="fixed-value">{{data.calc.stats.hoardNext}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{localize "midgard5.hoard"}}</td>
|
||||
<td class="fixed-value">{{data.calc.stats.hoard}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{localize "midgard5.hoardMin"}}</td>
|
||||
<td class="fixed-value">{{data.calc.stats.hoardMin}}</td>
|
||||
<td>{{localize "midgard5.hoard-next"}}</td>
|
||||
<td class="fixed-value">{{data.calc.stats.hoardNext}}</td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
|
||||
<tr height = 10px></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flexcolumn-1">
|
||||
<div class="flexpart">
|
||||
<div class="flexpart-header"><img src="icons/skills/wounds/injury-body-pain-gray.webp" class="flexpart-icon">{{localize "midgard5.deprivations"}} & {{localize "midgard5.deprivation"}}</div>
|
||||
<table>
|
||||
<tr height = 10px></tr>
|
||||
<tr>
|
||||
<td class="flexpart-img"><img src="/icons/consumables/food/plate-fish-bowl-bones-brown.webp" class="flexpart-icon"></td>
|
||||
<td class="padding highlight">{{localize "midgard5.deprivationFood"}}</td>
|
||||
<td class="center">{{data.calc.stats.deprivationFood.value}}</td>
|
||||
<td class="fixed-value" style="border-right: 1px solid black;"><button class="roll-button roll-deprivationFood-button"></button></td>
|
||||
<td class="flexpart-img"><img src="/icons/magic/fire/orb-lightning-sun.webp" class="flexpart-icon"></td>
|
||||
<td class="padding highlight">{{localize "midgard5.deprivationHeat"}}</td>
|
||||
<td class="center">{{ data.calc.stats.deprivationHeat.value}}</td>
|
||||
<td class="fixed-value" style="border-right: 1px solid black;"><button class="roll-button roll-deprivationHeat-button"></button></td>
|
||||
<td class="flexpart-img"><img src="/icons/magic/water/snowflake-ice-blue.webp" class="flexpart-icon"></td>
|
||||
<td class="padding highlight">{{localize "midgard5.deprivationCold"}}</td>
|
||||
<td class="center">{{data.calc.stats.deprivationCold.value}}</td>
|
||||
<td class="fixed-value"><button class="roll-button roll-deprivationCold-button"></button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -48,9 +48,9 @@
|
|||
<tr height = 10px></tr>
|
||||
<tr>
|
||||
<td class="fixed-value"><input type="number" disabled="true" name="data.info.load" value="{{data.calc.stats.load}}"></td>
|
||||
<td class="fixed-value"><input type="number" disabled="true" {{#if (gte data.calc.stats.encumbrance data.calc.stats.heavyLoad) }}style="background:#FF6666"{{/if}} name="data.info.heavyLoad" value="{{data.calc.stats.heavyLoad}}"></td>
|
||||
<td class="fixed-value"><input type="number" disabled="true" {{#if (gte data.calc.stats.encumbrance data.calc.stats.loadMax) }}style="background:#FF6666"{{/if}} name="data.info.loadMax" value="{{data.calc.stats.loadMax}}"></td>
|
||||
<td class="fixed-value"><input type="number" disabled="true" {{#if (gte data.calc.stats.encumbrance data.calc.stats.thrustLoad) }}style="background:#FF6666"{{/if}} name="data.info.thrustLoad" value="{{data.calc.stats.thrustLoad}}"></td>
|
||||
<td class="fixed-value"><input type="number" disabled="true" {{#if (gt data.calc.stats.encumbrance data.calc.stats.heavyLoad) }}style="background:#FF6666"{{/if}} name="data.info.heavyLoad" value="{{data.calc.stats.heavyLoad}}"></td>
|
||||
<td class="fixed-value"><input type="number" disabled="true" {{#if (gt data.calc.stats.encumbrance data.calc.stats.loadMax) }}style="background:#FF6666"{{/if}} name="data.info.loadMax" value="{{data.calc.stats.loadMax}}"></td>
|
||||
<td class="fixed-value"><input type="number" disabled="true" {{#if (gt data.calc.stats.encumbrance data.calc.stats.thrustLoad) }}style="background:#FF6666"{{/if}} name="data.info.thrustLoad" value="{{data.calc.stats.thrustLoad}}"></td>
|
||||
<td class="fixed-value"><input type="number" disabled="true" name="data.info.encumbrance" value="{{data.calc.stats.encumbrance}}"></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
|
@ -231,6 +231,7 @@
|
|||
<th class="title">{{localize "TYPES.Item.container"}}</th>
|
||||
<th class="title center">{{localize "midgard5.item-value"}}</th>
|
||||
<th class="title center">{{localize "midgard5.item-weight"}}</th>
|
||||
<th class="title center">{{localize "midgard5.capacity"}}</th>
|
||||
<th class="title center"><img src="/systems/midgard5/assets/icons/icon/battle-gear.svg" class="table-icon"></th>
|
||||
<th class="title"><img src="/icons/svg/d20.svg" class="table-icon"></th>
|
||||
<td><a class="title add-container"><i class="fa-regular fa-plus"></i></a></th>
|
||||
|
|
@ -254,6 +255,11 @@
|
|||
<span class="spell-process">{{item.weight}} kg</span>
|
||||
{{/unless}}
|
||||
</td>
|
||||
<td style="text-align: start">
|
||||
{{#unless (eq item.capacity "")}}
|
||||
<span class="spell-process">{{item.capacity}} kg</span>
|
||||
{{/unless}}
|
||||
</td>
|
||||
<td class="change-equipped">
|
||||
{{#if item.equipped}}
|
||||
<i class="fa-solid fa-circle-check"></i>
|
||||
|
|
|
|||
|
|
@ -27,24 +27,6 @@
|
|||
<td><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
<tr data-item-id="{{itemId}}">
|
||||
<td class="flexpart-img"><img src="icons/skills/toxins/cup-goblet-poisoned-spilled.webp" class="flexpart-icon"></td>
|
||||
<td class="padding edit-item">{{localize "midgard5.drinking"}}</td>
|
||||
<td class="fixed-value">{{data.calc.stats.drinkingFW}}</td>
|
||||
<td class="fixed-value">{{data.calc.stats.drinking.value}}</td>
|
||||
<td class="fixed-value">{{add data.calc.stats.drinking.value data.calc.stats.drinkingFW}}</td>
|
||||
<td><button class="roll-button roll-drinking-button"></button></td>
|
||||
<td class="fixed-value"></td>
|
||||
</tr>
|
||||
<tr data-item-id="{{itemId}}">
|
||||
<td class="flexpart-img"><img src="icons/magic/perception/eye-ringed-green.webp" class="flexpart-icon"></td>
|
||||
<td class="padding edit-item">{{localize "midgard5.perception"}}</td>
|
||||
<td class="fixed-value">{{data.calc.stats.perceptionFW}}</td>
|
||||
<td class="fixed-value">{{data.calc.stats.perception.value}}</td>
|
||||
<td class="fixed-value">{{add data.calc.stats.perception.value data.calc.stats.perceptionFW}}</td>
|
||||
<td><button class="roll-button roll-perception-button"></button></td>
|
||||
<td class="fixed-value"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
<tr>
|
||||
<td bgcolor="#eaead7" class="padding edit-item highlight" >{{localize "midgard5.spellCasting"}}</td>
|
||||
<td bgcolor="#eaead7" class="center">{{data.calc.stats.spellCasting.value}}</td>
|
||||
<td bgcolor="#eaead7" class="fixed-value" style="border-right: 1px solid black;"><button class="roll-button roll-weapon-button" /></td>
|
||||
<td bgcolor="#eaead7" class="fixed-value" style="border-right: 1px solid black;"><button class="roll-button roll-cleanSpell-button" /></td>
|
||||
<td class="padding edit-item highlight">{{localize "midgard5.defense"}}</td>
|
||||
<td class="center">{{add data.calc.stats.defense.value data.calc.stats.defenseBonus.value}}</td>
|
||||
<td class="fixed-value" style="border-right: 1px solid black;"><button class="roll-button roll-defense-button"></button></td>
|
||||
|
|
@ -72,8 +72,8 @@
|
|||
<td class="fixed-value"><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody> </table>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@
|
|||
{{#each data.lernKostenZauber as |wert name|}}
|
||||
<span style="flex: 1 0 26%">
|
||||
<label for="data.lernKostenZauber.{{name}}">{{localize (m5concat "midgard5.spell-process-" name)}}</label>
|
||||
<input style="width:35px" name="data.lernKostenZauber.{{name}}" type="number" value={{wert.kosten}} data-dtype="Number" />
|
||||
<input style="width:35px" name="data.lernKostenZauber.{{name}}.kosten" type="number" value={{wert.kosten}} data-dtype="Number" />
|
||||
</span>
|
||||
{{/each}}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -26,6 +26,12 @@
|
|||
<input id="data.quantity" type="number" name="data.quantity" value="{{data.quantity}}">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="flexrow">
|
||||
<span>{{localize "midgard5.capacity"}}</span>
|
||||
<input id="data.capacity" type="number" name="data.capacity" value="{{data.capacity}}">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
|
@ -42,6 +48,12 @@
|
|||
</select>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="flexrow">
|
||||
<span>{{localize "midgard5.item-weight"}}</span>
|
||||
<input id="data.weight" type="number" name="data.weight" value="{{data.weight}}">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue