Co-authored-by: LeFrique <lefrique@live.de> Reviewed-on: #52
This commit was merged in pull request #52.
This commit is contained in:
@@ -109,6 +109,11 @@ export enum M5Stats {
|
||||
HOARD_NEXT = "hoardNext",
|
||||
HOARD_MIN = "hoardMin",
|
||||
WEALTH = "wealth",
|
||||
LOAD = "load",
|
||||
HEAVY_LOAD = "heavyLoad",
|
||||
LOAD_MAX = "loadMax",
|
||||
THRUST_LOAD = "thrustLoad",
|
||||
ENCUMBRANCE = "encumbrance",
|
||||
}
|
||||
|
||||
export enum M5ModType {
|
||||
@@ -200,6 +205,11 @@ export interface M5CharacterCalculatedData {
|
||||
hoardNext: number;
|
||||
hoardMin: number;
|
||||
wealth: number;
|
||||
load: number;
|
||||
heavyLoad: number;
|
||||
loadMax: number;
|
||||
thrustLoad: number;
|
||||
encumbrance: number;
|
||||
};
|
||||
skillMods: {};
|
||||
skills: {
|
||||
|
||||
+314
-157
@@ -1,5 +1,5 @@
|
||||
import { M5Item } from "../items/M5Item";
|
||||
import { M5Attribute, M5CharacterCalculatedData, M5ItemMod, M5ItemType, M5ModOperation, M5ModResult, M5RollData, M5Skill, M5SkillCalculated, M5SkillLearned, M5SkillType } from "../M5Base";
|
||||
import { M5Attribute, M5CharacterCalculatedData, M5ItemMod, M5ItemType, M5ModOperation, M5ModResult, M5ModType, M5RollData, M5Skill, M5SkillCalculated, M5SkillLearned, M5SkillType } from "../M5Base";
|
||||
import M5ModAggregate from "./M5ModAggregate";
|
||||
export class M5Character extends Actor {
|
||||
// constructor(
|
||||
@@ -23,18 +23,64 @@ export class M5Character extends Actor {
|
||||
return -2;
|
||||
}
|
||||
|
||||
static loadValue(attribute: M5Attribute) {
|
||||
const value = this.attributeMinMax(attribute);
|
||||
if (value > 99) return 35;
|
||||
if (value > 95) return 30;
|
||||
if (value > 80) return 25;
|
||||
if (value > 60) return 20;
|
||||
if (value > 30) return 15;
|
||||
if (value > 10) return 10;
|
||||
if (value > 0) return 5;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static heavyLoadValue(attribute: M5Attribute) {
|
||||
const value = this.attributeMinMax(attribute);
|
||||
if (value > 99) return 50;
|
||||
if (value > 95) return 45;
|
||||
if (value > 80) return 40;
|
||||
if (value > 60) return 35;
|
||||
if (value > 30) return 30;
|
||||
if (value > 10) return 25;
|
||||
if (value > 0) return 20;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static maxLoadValue(attribute: M5Attribute) {
|
||||
const value = this.attributeMinMax(attribute);
|
||||
if (value > 99) return 90;
|
||||
if (value > 95) return 80;
|
||||
if (value > 80) return 75;
|
||||
if (value > 60) return 70;
|
||||
if (value > 30) return 60;
|
||||
if (value > 10) return 50;
|
||||
if (value > 0) return 40;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static thrustLoadValue(attribute: M5Attribute) {
|
||||
const value = this.attributeMinMax(attribute);
|
||||
if (value > 99) return 200;
|
||||
if (value > 95) return 170;
|
||||
if (value > 80) return 150;
|
||||
if (value > 60) return 140;
|
||||
if (value > 30) return 120;
|
||||
if (value > 10) return 70;
|
||||
if (value > 0) return 50;
|
||||
return 0;
|
||||
}
|
||||
|
||||
derivedData(
|
||||
skip: {
|
||||
mods?: boolean;
|
||||
skills?: boolean;
|
||||
weapons?: boolean;
|
||||
defensiveWeapons?: boolean;
|
||||
armor?: boolean;
|
||||
items?: boolean;
|
||||
containers?: boolean;
|
||||
spells?: boolean;
|
||||
effects?: boolean;
|
||||
containers?: boolean;
|
||||
kampfkuenste?: boolean;
|
||||
encumbrance?: boolean;
|
||||
} = {}
|
||||
): M5CharacterCalculatedData {
|
||||
let ret: M5CharacterCalculatedData = {
|
||||
@@ -72,6 +118,11 @@ export class M5Character extends Actor {
|
||||
drinking: { value: 0, mods: [] },
|
||||
drinkingFW: 0,
|
||||
hoard: 0,
|
||||
encumbrance: 0,
|
||||
load: 0,
|
||||
heavyLoad: 0,
|
||||
thrustLoad: 0,
|
||||
loadMax: 0,
|
||||
},
|
||||
skillMods: {},
|
||||
skills: {
|
||||
@@ -149,6 +200,11 @@ export class M5Character extends Actor {
|
||||
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));
|
||||
ret.stats.hoard = 0;
|
||||
ret.stats.load = M5Character.loadValue(data.attributes.st);
|
||||
ret.stats.heavyLoad = M5Character.heavyLoadValue(data.attributes.st);
|
||||
ret.stats.loadMax = M5Character.maxLoadValue(data.attributes.st);
|
||||
ret.stats.thrustLoad = M5Character.thrustLoadValue(data.attributes.st);
|
||||
ret.stats.encumbrance = 0;
|
||||
|
||||
if (!skip?.mods) {
|
||||
const aggregate = new M5ModAggregate(data, ret);
|
||||
@@ -167,51 +223,6 @@ export class M5Character extends Actor {
|
||||
ret.skillMods = aggregate.calculate();
|
||||
}
|
||||
|
||||
if (!skip?.items) {
|
||||
context.items
|
||||
?.filter((item) => item.type === "item")
|
||||
.forEach((item) => {
|
||||
item.prepareDerivedData();
|
||||
|
||||
let label = item.name;
|
||||
if (item.system.magic) {
|
||||
label += "*";
|
||||
}
|
||||
if (item.system.valuable) {
|
||||
ret.stats.wealth += this.calculateValue(item.system.value * item.system.quantity, item.system.currency);
|
||||
}
|
||||
if (item.system.hoarded) {
|
||||
ret.stats.hoard += this.calculateValue(item.system.value * item.system.quantity, item.system.currency);
|
||||
}
|
||||
|
||||
let icon = item.img;
|
||||
let rollable = false;
|
||||
|
||||
for (let key in item.system.rolls.formulas) {
|
||||
rollable = item.system.rolls.formulas[key]?.enabled;
|
||||
if (rollable) {
|
||||
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,
|
||||
currency: item.system.currency || "",
|
||||
quantity: item.system.quantity || 0,
|
||||
rollExist: rollable,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
if (!skip?.containers) {
|
||||
context.items
|
||||
?.filter((item) => item.type === "container")
|
||||
@@ -222,6 +233,7 @@ export class M5Character extends Actor {
|
||||
if (item.system.magic) {
|
||||
label += "*";
|
||||
}
|
||||
|
||||
let icon = item.img;
|
||||
let rollable = false;
|
||||
|
||||
@@ -249,6 +261,243 @@ export class M5Character extends Actor {
|
||||
}
|
||||
|
||||
if (!skip?.items) {
|
||||
context.items
|
||||
?.filter((item) => item.type === "item")
|
||||
.forEach((item) => {
|
||||
item.prepareDerivedData();
|
||||
|
||||
let label = item.name;
|
||||
if (item.system.magic) {
|
||||
label += "*";
|
||||
}
|
||||
if (item.system.valuable) {
|
||||
ret.stats.wealth += parseFloat(this.calculateValue(item.system.value * item.system.quantity, item.system.currency).toPrecision(3));
|
||||
}
|
||||
if (item.system.hoarded) {
|
||||
ret.stats.hoard += parseFloat(this.calculateValue(item.system.value * item.system.quantity, item.system.currency).toPrecision(3));
|
||||
}
|
||||
|
||||
if (!!item.system.containerId) {
|
||||
ret.gear.containers[item.system.containerId].weight += parseFloat((item.system.weight * item.system.quantity).toPrecision(4));
|
||||
if (ret.gear.containers[item.system.containerId].equipped) {
|
||||
ret.stats.encumbrance += (item.system.weight * item.system.quantity);
|
||||
}
|
||||
} else if (item.system.equipped) {
|
||||
ret.stats.encumbrance += (item.system.weight * item.system.quantity);
|
||||
}
|
||||
|
||||
let icon = item.img;
|
||||
let rollable = false;
|
||||
|
||||
// console.log(item.system.rolls.formulas.map((p) => p.enabled));
|
||||
for (let key in item.system.rolls.formulas) {
|
||||
rollable = item.system.rolls.formulas[key]?.enabled;
|
||||
if (rollable) {
|
||||
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,
|
||||
currency: item.system.currency || "",
|
||||
quantity: item.system.quantity || 0,
|
||||
rollExist: rollable,
|
||||
};
|
||||
});
|
||||
|
||||
context.items
|
||||
?.filter((item) => item.type === "weapon")
|
||||
.forEach((item) => {
|
||||
item.prepareDerivedData();
|
||||
|
||||
let label = item.name;
|
||||
if (item.system.magic) {
|
||||
label +=
|
||||
"*(" +
|
||||
(item.system.stats.attackBonus < 0 ? "" : "+") +
|
||||
item.system.stats.attackBonus +
|
||||
"/" +
|
||||
(item.system.stats.damageBonus < 0 ? "" : "+") +
|
||||
item.system.stats.damageBonus +
|
||||
")";
|
||||
}
|
||||
if (item.system.valuable) {
|
||||
ret.stats.wealth += this.calculateValue(item.system.value * item.system.quantity, item.system.currency);
|
||||
}
|
||||
if (item.system.hoarded) {
|
||||
ret.stats.hoard += this.calculateValue(item.system.value * item.system.quantity, item.system.currency);
|
||||
}
|
||||
if (!!item.system.containerId) {
|
||||
ret.gear.containers[item.system.containerId].weight += item.system.weight;
|
||||
if (ret.gear.containers[item.system.containerId].equipped) {
|
||||
ret.stats.encumbrance += item.system.weight;
|
||||
}
|
||||
} else if (item.system.equipped) {
|
||||
ret.stats.encumbrance += item.system.weight || 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,
|
||||
currency: item.system.currency || "",
|
||||
calc: item.system.calc,
|
||||
special: item.system.special,
|
||||
damageBase: item.system.damageBase,
|
||||
equipped: item.system?.equipped,
|
||||
weight: item.system.weight || 0,
|
||||
containerId: item.system.containerId || "",
|
||||
};
|
||||
});
|
||||
|
||||
context.items
|
||||
?.filter((item) => item.type === "defensiveWeapon")
|
||||
.forEach((item) => {
|
||||
item.prepareDerivedData();
|
||||
|
||||
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 += this.calculateValue(item.system.value * item.system.quantity, item.system.currency);
|
||||
}
|
||||
if (item.system.hoarded) {
|
||||
ret.stats.hoard += this.calculateValue(item.system.value * item.system.quantity, item.system.currency);
|
||||
}
|
||||
if (!!item.system.containerId) {
|
||||
ret.gear.containers[item.system.containerId].weight += item.system.weight;
|
||||
if (ret.gear.containers[item.system.containerId].equipped) {
|
||||
ret.stats.encumbrance += item.system.weight;
|
||||
}
|
||||
} else if (item.system.equipped) {
|
||||
ret.stats.encumbrance += item.system.weight || 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,
|
||||
currency: item.system.currency || "",
|
||||
defenseBonus: item.system.stats.defenseBonus,
|
||||
calc: item.system.calc,
|
||||
equipped: item.system?.equipped,
|
||||
weight: item.system.weight || 0,
|
||||
containerId: item.system.containerId || "",
|
||||
};
|
||||
});
|
||||
|
||||
context.items
|
||||
?.filter((item) => item.type === "armor")
|
||||
.forEach((item) => {
|
||||
item.prepareDerivedData();
|
||||
|
||||
let label = item.name;
|
||||
if (item.system.magic) {
|
||||
label += "*";
|
||||
}
|
||||
if (item.system.valuable) {
|
||||
ret.stats.wealth += this.calculateValue(item.system.value * item.system.quantity, item.system.currency);
|
||||
}
|
||||
if (item.system.hoarded) {
|
||||
ret.stats.hoard += this.calculateValue(item.system.value * item.system.quantity, item.system.currency);
|
||||
}
|
||||
if (!!item.system.containerId) {
|
||||
ret.gear.containers[item.system.containerId].weight += item.system.weight;
|
||||
if (ret.gear.containers[item.system.containerId].equipped) {
|
||||
ret.stats.encumbrance += item.system.weight;
|
||||
}
|
||||
} else if (item.system.equipped) {
|
||||
ret.stats.encumbrance += 0;
|
||||
} else {
|
||||
ret.stats.encumbrance += item.system.weight || 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,
|
||||
currency: item.system.currency || "",
|
||||
lpProtection: item.system.lpProtection,
|
||||
calc: item.system.calc,
|
||||
equipped: item.system?.equipped,
|
||||
weight: item.system.weight || 0,
|
||||
containerId: item.system.containerId || "",
|
||||
};
|
||||
});
|
||||
|
||||
if (!skip?.encumbrance) {
|
||||
const item = context.items.filter((x) => x.name === "Belastung");
|
||||
if (ret.stats.encumbrance > ret.stats.heavyLoad) {
|
||||
if (item.length === 0) {
|
||||
this.createEffect("Belastung", [{ id: "movement", operation: M5ModOperation.DIVISION, type: M5ModType.STAT, value: 2 }]);
|
||||
} else if (item.length === 1) {
|
||||
item[0].update({
|
||||
data: {
|
||||
equipped: true,
|
||||
},
|
||||
});
|
||||
} else if (item.length === 2) {
|
||||
item[1]?.delete();
|
||||
}
|
||||
} else if (ret.stats.encumbrance <= ret.stats.heavyLoad) {
|
||||
if (item.length === 1) {
|
||||
item[0].update({
|
||||
data: {
|
||||
equipped: false,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!skip?.encumbrance) {
|
||||
const item = context.items.filter((x) => x.name === "Höchstlast");
|
||||
if (ret.stats.encumbrance > ret.stats.loadMax) {
|
||||
if (item.length === 0) {
|
||||
let messageContent = `Höchstlast wurde überschritten: 1 AP Schaden durch Belastung alle 10 Minuten abziehen!`;
|
||||
let chatData = {
|
||||
speaker: ChatMessage.getSpeaker({actor: Actor.name}),
|
||||
content: messageContent,
|
||||
};
|
||||
ChatMessage.create(chatData, {});
|
||||
ui.notifications.warn(messageContent);
|
||||
this.createEffect("Höchstlast", [{ id: "ap", operation: M5ModOperation.SUBTRACT, type: M5ModType.STAT, value: 1 }]);
|
||||
} else if (item.length === 2) {
|
||||
item[1]?.delete();
|
||||
} else if (item.length === 1) {
|
||||
item[0].update({
|
||||
data: {
|
||||
equipped: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
} else if (ret.stats.encumbrance < ret.stats.loadMax) {
|
||||
if (item.length === 1) {
|
||||
item[0]?.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!skip?.effects) {
|
||||
context.items
|
||||
?.filter((item) => item.type === "effect")
|
||||
.forEach((item) => {
|
||||
@@ -285,112 +534,6 @@ export class M5Character extends Actor {
|
||||
});
|
||||
}
|
||||
|
||||
if (!skip?.weapons) {
|
||||
context.items
|
||||
?.filter((item) => item.type === "weapon")
|
||||
.forEach((item) => {
|
||||
item.prepareDerivedData();
|
||||
|
||||
let label = item.name;
|
||||
if (item.system.magic) {
|
||||
label +=
|
||||
"*(" +
|
||||
(item.system.stats.attackBonus < 0 ? "" : "+") +
|
||||
item.system.stats.attackBonus +
|
||||
"/" +
|
||||
(item.system.stats.damageBonus < 0 ? "" : "+") +
|
||||
item.system.stats.damageBonus +
|
||||
")";
|
||||
}
|
||||
if (item.system.valuable) {
|
||||
ret.stats.wealth += this.calculateValue(item.system.value * item.system.quantity, item.system.currency);
|
||||
}
|
||||
if (item.system.hoarded) {
|
||||
ret.stats.hoard += this.calculateValue(item.system.value * item.system.quantity, item.system.currency);
|
||||
}
|
||||
|
||||
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,
|
||||
currency: item.system.currency || "",
|
||||
calc: item.system.calc,
|
||||
special: item.system.special,
|
||||
damageBase: item.system.damageBase,
|
||||
equipped: item.system?.equipped,
|
||||
containerId: item.system.containerId || "",
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
if (!skip?.defensiveWeapons) {
|
||||
context.items
|
||||
?.filter((item) => item.type === "defensiveWeapon")
|
||||
.forEach((item) => {
|
||||
item.prepareDerivedData();
|
||||
|
||||
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 += this.calculateValue(item.system.value * item.system.quantity, item.system.currency);
|
||||
}
|
||||
if (item.system.hoarded) {
|
||||
ret.stats.hoard += this.calculateValue(item.system.value * item.system.quantity, item.system.currency);
|
||||
}
|
||||
|
||||
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,
|
||||
currency: item.system.currency || "",
|
||||
defenseBonus: item.system.stats.defenseBonus,
|
||||
calc: item.system.calc,
|
||||
equipped: item.system?.equipped,
|
||||
containerId: item.system.containerId || "",
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
if (!skip?.armor) {
|
||||
context.items
|
||||
?.filter((item) => item.type === "armor")
|
||||
.forEach((item) => {
|
||||
item.prepareDerivedData();
|
||||
|
||||
let label = item.name;
|
||||
if (item.system.magic) {
|
||||
label += "*";
|
||||
}
|
||||
if (item.system.valuable) {
|
||||
ret.stats.wealth += this.calculateValue(item.system.value * item.system.quantity, item.system.currency);
|
||||
}
|
||||
if (item.system.hoarded) {
|
||||
ret.stats.hoard += this.calculateValue(item.system.value * item.system.quantity, item.system.currency);
|
||||
}
|
||||
|
||||
ret.gear.armor[item.id] = {
|
||||
label: label,
|
||||
magic: item.system.magic,
|
||||
valuable: item.system?.valuable,
|
||||
hoarded: item.system?.hoarded,
|
||||
value: item.system.value || 0,
|
||||
currency: item.system.currency || "",
|
||||
lpProtection: item.system.lpProtection,
|
||||
calc: item.system.calc,
|
||||
equipped: item.system?.equipped,
|
||||
containerId: item.system.containerId || "",
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
if (!skip?.spells) {
|
||||
context.items
|
||||
?.filter((item) => item.type === "spell")
|
||||
@@ -511,7 +654,7 @@ export class M5Character extends Actor {
|
||||
return data?.attributes[name];
|
||||
}
|
||||
|
||||
createSkill(skillName: string): Promise<M5Item> {
|
||||
async createSkill(skillName: string): Promise<M5Item> {
|
||||
const itemData = {
|
||||
name: skillName,
|
||||
type: "skill",
|
||||
@@ -536,6 +679,20 @@ export class M5Character extends Actor {
|
||||
});
|
||||
}
|
||||
|
||||
async createEffect(itemName: string, mods: M5ItemMod[]): Promise<M5Item> {
|
||||
const itemData = {
|
||||
name: itemName,
|
||||
type: "effect",
|
||||
|
||||
system: { mods: mods, equipped: true },
|
||||
};
|
||||
|
||||
return (this as any).createEmbeddedDocuments("Item", [itemData]).then((docs) => {
|
||||
const item = docs[0];
|
||||
return item;
|
||||
});
|
||||
}
|
||||
|
||||
getItem(itemId: string): any {
|
||||
if (!(this as any).items) return null;
|
||||
return (this as any).getEmbeddedDocument("Item", itemId);
|
||||
|
||||
@@ -14,22 +14,22 @@ export class M5Item extends Item {
|
||||
const itemData = (this as any).system;
|
||||
const calc = itemData.calc;
|
||||
|
||||
if (itemType === "item") {
|
||||
calc.containers = null;
|
||||
if (itemType === "item") {
|
||||
calc.containers = null;
|
||||
|
||||
if (actor) {
|
||||
const actorCalc = actor.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
|
||||
if (actorCalc) {
|
||||
calc.containers = actorCalc.gear.containers;
|
||||
if (actor) {
|
||||
const actorCalc = actor.derivedData({ containers: false, items: true, spells: true, effects: true, kampfkuenste: true, encumbrance: true });
|
||||
if (actorCalc) {
|
||||
calc.containers = actorCalc.gear.containers;
|
||||
}
|
||||
const container = character.getItem(itemData.containerId);
|
||||
//console.log("M5Item.prepareDerivedData:containers", itemData, container?.system)
|
||||
if (container) {
|
||||
container.prepareDerivedData();
|
||||
const containerData = container.system;
|
||||
}
|
||||
}
|
||||
const container = character.getItem(itemData.containerId);
|
||||
//console.log("M5Item.prepareDerivedData:containers", itemData, container?.system)
|
||||
if (container) {
|
||||
container.prepareDerivedData();
|
||||
const containerData = container.system;
|
||||
}
|
||||
}
|
||||
} else if (itemType === "skill") {
|
||||
} else if (itemType === "skill") {
|
||||
calc.fw = itemData.fw;
|
||||
calc.bonus = 0;
|
||||
|
||||
@@ -46,7 +46,14 @@ export class M5Item extends Item {
|
||||
];
|
||||
|
||||
if (character) {
|
||||
const actorCalc = character.derivedData({ skills: true, weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
|
||||
const actorCalc = character.derivedData({
|
||||
skills: true,
|
||||
items: true,
|
||||
spells: true,
|
||||
effects: true,
|
||||
kampfkuenste: true,
|
||||
encumbrance: true,
|
||||
});
|
||||
if (actorCalc?.skillMods && Object.keys(actorCalc.skillMods).indexOf(itemId) !== -1) {
|
||||
pairs = pairs.concat(actorCalc.skillMods[itemId]);
|
||||
}
|
||||
@@ -81,9 +88,8 @@ export class M5Item extends Item {
|
||||
calc.combatSkills = null;
|
||||
calc.containers = null;
|
||||
|
||||
|
||||
if (actor) {
|
||||
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
|
||||
const actorCalc = character.derivedData({ items: true, spells: true, effects: true, kampfkuenste: true, encumbrance: true });
|
||||
if (actorCalc) {
|
||||
calc.ew += actorCalc.stats.attackBonus.value;
|
||||
calc.combatSkills = actorCalc.skills.combat;
|
||||
@@ -94,8 +100,8 @@ export class M5Item extends Item {
|
||||
if (container) {
|
||||
container.prepareDerivedData();
|
||||
const containerData = container.system;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const skill = character.getItem(itemData.skillId);
|
||||
//console.log("M5Item.prepareDerivedData:weapon", itemData, skill?.system)
|
||||
if (skill) {
|
||||
@@ -115,7 +121,7 @@ export class M5Item extends Item {
|
||||
calc.containers = null;
|
||||
|
||||
if (actor) {
|
||||
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
|
||||
const actorCalc = character.derivedData({ items: true, spells: true, effects: true, kampfkuenste: true, encumbrance: true });
|
||||
if (actorCalc) {
|
||||
calc.ew += actorCalc.stats.defense.value + actorCalc.stats.defenseBonus.value;
|
||||
calc.combatSkills = actorCalc.skills.combat;
|
||||
@@ -127,7 +133,7 @@ export class M5Item extends Item {
|
||||
if (container) {
|
||||
container.prepareDerivedData();
|
||||
const containerData = container.system;
|
||||
}
|
||||
}
|
||||
|
||||
const skill = character.getItem(itemData.skillId);
|
||||
//console.log("M5Item.prepareDerivedData:weapon", itemData, skill?.system)
|
||||
@@ -148,7 +154,7 @@ export class M5Item extends Item {
|
||||
itemData.mods[5] = { type: "stat", id: "apProtection", operation: "set", value: itemData.apProtection };
|
||||
calc.containers = null;
|
||||
if (actor) {
|
||||
const actorCalc = actor.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
|
||||
const actorCalc = actor.derivedData({ items: true, spells: true, effects: true, kampfkuenste: true, encumbrance: true });
|
||||
if (actorCalc) {
|
||||
calc.containers = actorCalc.gear.containers;
|
||||
}
|
||||
@@ -157,12 +163,12 @@ export class M5Item extends Item {
|
||||
if (container) {
|
||||
container.prepareDerivedData();
|
||||
const containerData = container.system;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (itemType === "spell") {
|
||||
calc.fw = 0;
|
||||
if (actor) {
|
||||
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
|
||||
const actorCalc = character.derivedData({ items: true, spells: true, effects: true, kampfkuenste: true, encumbrance: true });
|
||||
if (actorCalc) {
|
||||
calc.ew = actorCalc.stats.spellCasting.value;
|
||||
}
|
||||
@@ -174,7 +180,7 @@ export class M5Item extends Item {
|
||||
calc.generalSkills = null;
|
||||
|
||||
if (actor) {
|
||||
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
|
||||
const actorCalc = character.derivedData({ items: true, spells: true, effects: true, kampfkuenste: true, encumbrance: true });
|
||||
if (actorCalc) {
|
||||
calc.generalSkills = actorCalc.skills.general;
|
||||
}
|
||||
@@ -217,7 +223,13 @@ export class M5Item extends Item {
|
||||
}
|
||||
case M5ModType.SKILL: {
|
||||
if (character) {
|
||||
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
|
||||
const actorCalc = character.derivedData({
|
||||
items: true,
|
||||
spells: true,
|
||||
effects: true,
|
||||
kampfkuenste: true,
|
||||
encumbrance: true,
|
||||
});
|
||||
if (actorCalc) {
|
||||
let category = (game as Game).i18n.localize("midgard5.skill");
|
||||
Object.keys(actorCalc.skills.general).forEach((skillId) => {
|
||||
|
||||
@@ -275,7 +275,6 @@ export default class M5CharacterSheet extends ActorSheet {
|
||||
equipped: !item.system.equipped,
|
||||
},
|
||||
});
|
||||
|
||||
this.render();
|
||||
});
|
||||
|
||||
|
||||
@@ -11,41 +11,38 @@
|
||||
|
||||
.flexcolumn {
|
||||
flex-wrap: wrap;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.flexcolumn-1 {
|
||||
flex-basis: 100%;
|
||||
flex: 100%;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.flexcolumn-2 {
|
||||
flex-basis: 50%;
|
||||
flex: 50%;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.flexcolumn-3 {
|
||||
flex-basis: 33%;
|
||||
flex: 33%;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.flexcolumn-4 {
|
||||
flex-basis: 25%;
|
||||
flex: 25%;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.flexcolumn-5 {
|
||||
flex-basis: 20%;
|
||||
flex: 20%;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.flexpart {
|
||||
gap: 0;
|
||||
padding: 0;
|
||||
margin: 2px;
|
||||
margin: 5px;
|
||||
background-color: beige;
|
||||
border-collapse: separate;
|
||||
border-radius: 10px;
|
||||
border: 2px solid black;
|
||||
}
|
||||
|
||||
@@ -68,15 +65,10 @@
|
||||
|
||||
h3 {
|
||||
padding: 0.5rem 0.5rem 0.5rem 0.5rem;
|
||||
margin-top: 0.5rem;
|
||||
margin-bottom: 0;
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
background-color: #eeede0;
|
||||
color: black;
|
||||
border-collapse: separate;
|
||||
border: 2px solid black;
|
||||
border-radius: 10px;
|
||||
background-color: dimgray;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.profile-img {
|
||||
@@ -258,8 +250,7 @@
|
||||
padding: 1px;
|
||||
//align-items: stretch;
|
||||
|
||||
input,
|
||||
.max-value {
|
||||
input {
|
||||
flex: 0 0 2rem;
|
||||
text-align: center;
|
||||
height: 100%;
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
"name": "midgard5",
|
||||
"title": "Midgard 5. Edition",
|
||||
"description": "The German RPG Midgard 5. Edition",
|
||||
"version": "2.4.2",
|
||||
"version": "2.4.0",
|
||||
"compatibility": {
|
||||
"minimum": "10",
|
||||
"verified": "11",
|
||||
@@ -158,8 +158,8 @@
|
||||
"primaryTokenAttribute": "lp",
|
||||
"secondaryTokenAttribute": "ap",
|
||||
"url": "https://git.byroks.de/MidgardVTT-Entwicklung/foundry-vtt-system-midgard5",
|
||||
"manifest": "https://git.byroks.de/MidgardVTT-Entwicklung/foundry-vtt-system-midgard5/releases/download/v2.4.2/system.json",
|
||||
"download": "https://git.byroks.de/MidgardVTT-Entwicklung/foundry-vtt-system-midgard5/releases/download/v2.4.2/midgard5-v2.4.2.zip",
|
||||
"manifest": "https://git.byroks.de/MidgardVTT-Entwicklung/foundry-vtt-system-midgard5/releases/download/v2.4.0/system.json",
|
||||
"download": "https://git.byroks.de/MidgardVTT-Entwicklung/foundry-vtt-system-midgard5/releases/download/v2.4.0/midgard5-v2.4.0.zip",
|
||||
"initiative": "@c.calc.attributes.gw.value",
|
||||
"license": "LICENSE.txt"
|
||||
}
|
||||
Reference in New Issue
Block a user