Merge branch 'develop' into Anpassung-des-Character-Sheet-Headers-#13

This commit is contained in:
2024-01-07 21:03:18 +01:00
15 changed files with 247 additions and 34 deletions
+1
View File
@@ -8,6 +8,7 @@ const preloadTemplates = async (): Promise<Handlebars.TemplateDelegate<any>[]> =
const templates: Array<string> = [
"sheets/character/attribute.hbs",
"sheets/character/base_values.hbs",
"sheets/character/main.hbs",
"sheets/character/skills.hbs",
"sheets/character/gear.hbs",
"sheets/character/spells.hbs",
+8
View File
@@ -86,6 +86,10 @@ export enum M5Stats {
PROTECTION_AP = "apProtection",
PERCEPTION = "perception",
DRINKING = "drinking",
HOARD = "hoard",
HOARD_NEXT = "hoardNext",
HOARD_MIN = "hoardMin",
WEALTH = "wealth",
}
export enum M5ModType {
@@ -173,6 +177,10 @@ export interface M5CharacterCalculatedData {
perceptionFW: number;
drinking: M5ModResult;
drinkingFW: number;
hoard: number;
hoardNext: number;
hoardMin: number;
wealth: number;
};
skillMods: {};
skills: {
+52 -7
View File
@@ -1,7 +1,6 @@
import { M5Item } from "../items/M5Item";
import { M5Attribute, M5CharacterCalculatedData, M5ItemMod, M5ModOperation, M5ModResult, M5RollData, M5Skill, M5SkillCalculated, M5SkillLearned } from "../M5Base";
import M5ModAggregate from "./M5ModAggregate";
export class M5Character extends Actor {
// constructor(
// data: ConstructorParameters<typeof foundry.documents.BaseActor>[0],
@@ -72,6 +71,7 @@ export class M5Character extends Actor {
perceptionFW: 0,
drinking: { value: 0, mods: [] },
drinkingFW: 0,
hoard: 0,
},
skillMods: {},
skills: {
@@ -99,7 +99,7 @@ export class M5Character extends Actor {
const data = (this as any).system;
if (!data) return null;
ret.level = M5Character.levelFromExp(data.es);
ret.level = M5Character.levelFromExp(data.info.race === "Zwerg" ? Math.min(data.calc.stats?.hoard * 2 || 0, data.es) : data.es);
ret.attributes.st.value = M5Character.attributeMinMax(data.attributes.st); // TODO item effects
ret.attributes.gs.value = M5Character.attributeMinMax(data.attributes.gs);
@@ -145,6 +145,11 @@ export class M5Character extends Actor {
ret.stats.perceptionFW = 6;
ret.stats.drinking = this.modResult(0);
ret.stats.drinkingFW = Math.floor(ret.attributes.ko.value / 10);
ret.stats.hoardMin = M5Character.levelThreshold.at (ret.level - 1)/2;
ret.stats.hoardNext = M5Character.levelThreshold.at (ret.level)/2;
ret.stats.wealth = data.info.gold + data.info.silver/10 + data.info.copper/100;
ret.stats.hoard = 0;
if (!skip?.mods) {
const aggregate = new M5ModAggregate(data, ret);
@@ -172,7 +177,14 @@ export class M5Character extends Actor {
let label = item.name;
if (item.system.magic) {
label += "*";
};
if (item.system.valuable) {
ret.stats.wealth += item.system.value || 0;
};
if (item.system.hoarded) {
ret.stats.hoard += item.system.value || 0;
}
let icon = item.img;
let rollable = false;
@@ -183,12 +195,15 @@ export class M5Character extends Actor {
break;
}
}
ret.gear.items[item.id] = {
label: label,
icon: icon,
magic: item.system.magic,
calc: item.system.calc,
equipped: item.system?.equipped,
valuable: item.system?.valuable,
hoarded: item.system?.hoarded,
weight: item.system.weight || 0,
containerId: item.system.containerId || "",
value: item.system.value || 0,
@@ -223,6 +238,8 @@ export class M5Character extends Actor {
label: label,
icon: icon,
magic: item.system.magic,
valuable: item.system?.valuable,
hoarded: item.system?.hoarded,
calc: item.system.calc,
equipped: item.system?.equipped,
weight: item.system.weight || 0,
@@ -232,6 +249,7 @@ export class M5Character extends Actor {
quantity: item.system.quantity || 0,
rollExist: rollable,
};
});
}
@@ -244,8 +262,8 @@ export class M5Character extends Actor {
let label = item.name;
if (item.system.magic) {
label += "*";
}
};
ret.gear.effects[item.id] = {
label: label,
magic: item.system.magic,
@@ -288,12 +306,21 @@ export class M5Character extends Actor {
(item.system.stats.damageBonus < 0 ? "" : "+") +
item.system.stats.damageBonus +
")";
};
if (item.system.valuable) {
ret.stats.wealth += item.system.value || 0;
};
if (item.system.hoarded) {
ret.stats.hoard += item.system.value || 0;
}
ret.gear.weapons[item.id] = {
label: label,
skillId: item.system.skillId,
magic: item.system.magic,
valuable: item.system?.valuable,
hoarded: item.system?.hoarded,
value: item.system.value || 0,
calc: item.system.calc,
};
});
@@ -308,12 +335,21 @@ export class M5Character extends Actor {
let label = item.name;
if (item.system.magic) {
label += "*(" + (item.system.stats.defenseBonus < 0 ? "" : "+") + item.system.stats.defenseBonus + ")";
};
if (item.system.valuable) {
ret.stats.wealth += item.system.value || 0;
};
if (item.system.hoarded) {
ret.stats.hoard += item.system.value || 0;
}
ret.gear.defensiveWeapons[item.id] = {
label: label,
skillId: item.system.skillId,
magic: item.system.magic,
valuable: item.system?.valuable,
hoarded: item.system?.hoarded,
value: item.system.value || 0,
calc: item.system.calc,
};
});
@@ -328,11 +364,20 @@ export class M5Character extends Actor {
let label = item.name;
if (item.system.magic) {
label += "*";
};
if (item.system.valuable) {
ret.stats.wealth += item.system.value || 0;
};
if (item.system.hoarded) {
ret.stats.hoard += item.system.value || 0;
}
ret.gear.armor[item.id] = {
label: label,
magic: item.system.magic,
valuable: item.system?.valuable,
hoarded: item.system?.hoarded,
value: item.system.value || 0,
calc: item.system.calc,
equipped: item.system?.equipped,
};
+25 -9
View File
@@ -9,7 +9,7 @@
"verified": "11",
"maximum": "11"
},
"authors": [{ "name": "Byroks" }],
"authors": [{"name": "Byroks"}],
"scripts": ["bundle.js"],
"styles": ["bundle.css"],
"packs": [
@@ -103,25 +103,41 @@
"name": "Midgard 5",
"sorting": "a",
"color": "#0000FF",
"packs": ["blaupause-spielfiguren", "tabellen-kritische-ereignisse", "makros-kritische-ereignisse", "makros-standardwurfel"],
"packs": [
"blaupause-spielfiguren",
"tabellen-kritische-ereignisse",
"makros-kritische-ereignisse",
"makros-standardwurfel"
],
"folders": [
{
"name": "Ausrüstung",
"sorting": "a",
"color": "#008000",
"packs": ["ausruestung", "ruestkammer", "waffenkammer"]
"packs": [
"ausruestung",
"ruestkammer",
"waffenkammer"
]
},
{
"name": "Effekte",
"sorting": "a",
"color": "#800080",
"packs": ["kampfzustaende", "verletzungen", "zauberwirkungen"]
"packs": [
"kampfzustaende",
"verletzungen",
"zauberwirkungen"
]
},
{
"name": "Fähigkeiten",
"sorting": "a",
"color": "#800000",
"packs": ["fertigkeiten", "kampf"]
"packs": [
"fertigkeiten",
"kampf"
]
}
]
}
@@ -137,9 +153,9 @@
"gridUnits": "m",
"primaryTokenAttribute": "lp",
"secondaryTokenAttribute": "ap",
"url": "https://git.byroks.de/Byroks/foundry-vtt-system-midgard5",
"manifest": "https://git.byroks.de/Byroks/foundry-vtt-system-midgard5/releases/download/v2.3.1/system.json",
"download": "https://git.byroks.de/Byroks/foundry-vtt-system-midgard5/releases/download/v2.3.1/midgard5-v2.3.1.zip",
"url": "https://github.com/Byroks/foundry-vtt-system-midgard5",
"manifest": "https://github.com/Byroks/foundry-vtt-system-midgard5/releases/download/v2.3.1/system.json",
"download": "https://github.com/Byroks/foundry-vtt-system-midgard5/releases/download/v2.3.1/midgard5-v2.3.1.zip",
"initiative": "@c.calc.attributes.gw.value",
"license": "LICENSE.txt"
}
}
+18 -4
View File
@@ -205,6 +205,14 @@
"equippable": false,
"equipped": true
},
"valuable": {
"valuable": false,
"item-wealth": true
},
"hoarded": {
"hoarded": false,
"inHoard": true
},
"physical": {
"value": 0,
"weight": 0,
@@ -304,7 +312,7 @@
"calc": {}
},
"item": {
"templates": ["itemDescription", "equippable", "physical"],
"templates": ["itemDescription", "equippable", "physical","valuable","hoarded"],
"rolls": {
"formulas": {},
"output": ""
@@ -331,9 +339,11 @@
"calc": {}
},
"weapon": {
"templates": ["itemDescription", "stats", "equippable", "physical"],
"templates": ["itemDescription", "stats", "equippable", "physical","valuable","hoarded"],
"special": false,
"ranged": false,
"valuable": false,
"hoarded": false,
"skillId": "",
"damageBase": "1d6",
"rolls": {
@@ -354,8 +364,10 @@
"calc": {}
},
"defensiveWeapon": {
"templates": ["itemDescription", "stats", "equippable", "physical"],
"templates": ["itemDescription", "stats", "equippable", "physical","valuable","hoarded"],
"special": false,
"valuable": false,
"hoarded": false,
"skillId": "",
"rolls": {
"formulas": {
@@ -370,9 +382,11 @@
"calc": {}
},
"armor": {
"templates": ["itemDescription", "stats", "equippable", "attributeMod", "physical"],
"templates": ["itemDescription", "stats", "equippable", "attributeMod", "physical","valuable","hoarded"],
"lpProtection": 0,
"apProtection": 0,
"valuable": false,
"hoarded": false,
"rolls": {
"formulas": {},
"output": ""