#6-lasten-und-belastung
Changes: + berechne belastung + füge effect für belastung hinzu was B halbiert + Container berechnen lasten von gegenständen in ihnen (#16)
This commit is contained in:
parent
fa818e963a
commit
2afaba9827
|
|
@ -1,5 +1,5 @@
|
||||||
import { M5Item } from "../items/M5Item";
|
import { M5Item } from "../items/M5Item";
|
||||||
import { M5Attribute, M5CharacterCalculatedData, M5ItemMod, M5ItemType, M5ModOperation, M5ModResult, M5RollData, M5Skill, M5SkillCalculated, M5SkillLearned } from "../M5Base";
|
import { M5Attribute, M5CharacterCalculatedData, M5ItemMod, M5ItemType, M5ModOperation, M5ModResult, M5ModType, M5RollData, M5Skill, M5SkillCalculated, M5SkillLearned } from "../M5Base";
|
||||||
import M5ModAggregate from "./M5ModAggregate";
|
import M5ModAggregate from "./M5ModAggregate";
|
||||||
export class M5Character extends Actor {
|
export class M5Character extends Actor {
|
||||||
// constructor(
|
// constructor(
|
||||||
|
|
@ -75,14 +75,12 @@ export class M5Character extends Actor {
|
||||||
skip: {
|
skip: {
|
||||||
mods?: boolean;
|
mods?: boolean;
|
||||||
skills?: boolean;
|
skills?: boolean;
|
||||||
weapons?: boolean;
|
|
||||||
defensiveWeapons?: boolean;
|
|
||||||
armor?: boolean;
|
|
||||||
items?: boolean;
|
items?: boolean;
|
||||||
containers?: boolean;
|
|
||||||
spells?: boolean;
|
spells?: boolean;
|
||||||
effects?: boolean;
|
effects?: boolean;
|
||||||
|
containers?: boolean;
|
||||||
kampfkuenste?: boolean;
|
kampfkuenste?: boolean;
|
||||||
|
encumbrance?: boolean;
|
||||||
} = {}
|
} = {}
|
||||||
): M5CharacterCalculatedData {
|
): M5CharacterCalculatedData {
|
||||||
let ret: M5CharacterCalculatedData = {
|
let ret: M5CharacterCalculatedData = {
|
||||||
|
|
@ -182,7 +180,7 @@ export class M5Character extends Actor {
|
||||||
ret.stats.damageBonus = this.modResult(Math.floor(ret.attributes.st.value / 20) + Math.floor(ret.attributes.gs.value / 30) - 3);
|
ret.stats.damageBonus = this.modResult(Math.floor(ret.attributes.st.value / 20) + Math.floor(ret.attributes.gs.value / 30) - 3);
|
||||||
ret.stats.attackBonus = this.modResult(ret.attributes.gs.bonus);
|
ret.stats.attackBonus = this.modResult(ret.attributes.gs.bonus);
|
||||||
ret.stats.defenseBonus = this.modResult(ret.attributes.gw.bonus);
|
ret.stats.defenseBonus = this.modResult(ret.attributes.gw.bonus);
|
||||||
ret.stats.movement = this.modResult(data.info.encumbrance > data.info.heavyLoad ? data.movement / 2 : data.movement);
|
ret.stats.movement = this.modResult(data.movement);
|
||||||
ret.stats.resistanceMind = this.modResult(
|
ret.stats.resistanceMind = this.modResult(
|
||||||
(data.info.magicUsing ? 2 : 0) + ret.stats.defense.value + (data.info.race === "Mensch" ? ret.attributes.in.bonus : this.raceBonus(data.info.race))
|
(data.info.magicUsing ? 2 : 0) + ret.stats.defense.value + (data.info.race === "Mensch" ? ret.attributes.in.bonus : this.raceBonus(data.info.race))
|
||||||
);
|
);
|
||||||
|
|
@ -242,6 +240,44 @@ export class M5Character extends Actor {
|
||||||
ret.skillMods = aggregate.calculate();
|
ret.skillMods = aggregate.calculate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!skip?.containers) {
|
||||||
|
context.items
|
||||||
|
?.filter((item) => item.type === "container")
|
||||||
|
.forEach((item) => {
|
||||||
|
item.prepareDerivedData();
|
||||||
|
|
||||||
|
let label = item.name;
|
||||||
|
if (item.system.magic) {
|
||||||
|
label += "*";
|
||||||
|
}
|
||||||
|
|
||||||
|
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.containers[item.id] = {
|
||||||
|
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,
|
||||||
|
value: item.system.value || 0,
|
||||||
|
currency: item.system.currency || "",
|
||||||
|
quantity: item.system.quantity || 0,
|
||||||
|
rollExist: rollable,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (!skip?.items) {
|
if (!skip?.items) {
|
||||||
context.items
|
context.items
|
||||||
?.filter((item) => item.type === "item")
|
?.filter((item) => item.type === "item")
|
||||||
|
|
@ -258,7 +294,13 @@ export class M5Character extends Actor {
|
||||||
if (item.system.hoarded) {
|
if (item.system.hoarded) {
|
||||||
ret.stats.hoard += item.system.value || 0;
|
ret.stats.hoard += item.system.value || 0;
|
||||||
}
|
}
|
||||||
if (item.system.equipped) {
|
|
||||||
|
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.stats.encumbrance += item.system.weight || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -289,11 +331,93 @@ export class M5Character extends Actor {
|
||||||
rollExist: rollable,
|
rollExist: rollable,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
if (!skip?.containers) {
|
|
||||||
context.items
|
context.items
|
||||||
?.filter((item) => item.type === "container")
|
?.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.currency);
|
||||||
|
}
|
||||||
|
if (item.system.hoarded) {
|
||||||
|
ret.stats.hoard += item.system.value || 0;
|
||||||
|
}
|
||||||
|
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,
|
||||||
|
calc: item.system.calc,
|
||||||
|
special: item.system.special,
|
||||||
|
damageBase: item.system.damageBase,
|
||||||
|
equipped: item.system?.equipped,
|
||||||
|
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.currency);
|
||||||
|
}
|
||||||
|
if (item.system.hoarded) {
|
||||||
|
ret.stats.hoard += item.system.value || 0;
|
||||||
|
}
|
||||||
|
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,
|
||||||
|
defenseBonus: item.system.stats.defenseBonus,
|
||||||
|
calc: item.system.calc,
|
||||||
|
equipped: item.system?.equipped,
|
||||||
|
containerId: item.system.containerId || "",
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
context.items
|
||||||
|
?.filter((item) => item.type === "armor")
|
||||||
.forEach((item) => {
|
.forEach((item) => {
|
||||||
item.prepareDerivedData();
|
item.prepareDerivedData();
|
||||||
|
|
||||||
|
|
@ -301,34 +425,61 @@ export class M5Character extends Actor {
|
||||||
if (item.system.magic) {
|
if (item.system.magic) {
|
||||||
label += "*";
|
label += "*";
|
||||||
}
|
}
|
||||||
let icon = item.img;
|
if (item.system.valuable) {
|
||||||
let rollable = false;
|
ret.stats.wealth += this.calculateValue(item.system.value, item.system.currency);
|
||||||
|
|
||||||
// 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.containers[item.id] = {
|
if (item.system.hoarded) {
|
||||||
|
ret.stats.hoard += item.system.value || 0;
|
||||||
|
}
|
||||||
|
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,
|
label: label,
|
||||||
icon: icon,
|
|
||||||
magic: item.system.magic,
|
magic: item.system.magic,
|
||||||
valuable: item.system?.valuable,
|
valuable: item.system?.valuable,
|
||||||
hoarded: item.system?.hoarded,
|
hoarded: item.system?.hoarded,
|
||||||
|
value: item.system.value || 0,
|
||||||
|
lpProtection: item.system.lpProtection,
|
||||||
calc: item.system.calc,
|
calc: item.system.calc,
|
||||||
equipped: item.system?.equipped,
|
equipped: item.system?.equipped,
|
||||||
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?.encumbrance) {
|
||||||
|
const item = context.items.find((x) => x.name === "Belastung");
|
||||||
|
if (ret.stats.encumbrance > data.info.heavyLoad) {
|
||||||
|
if (!item) {
|
||||||
|
this.createEffect("Belastung", [{ id: "movement", operation: M5ModOperation.DIVISION, type: M5ModType.STAT, value: 2 }]);
|
||||||
|
} else {
|
||||||
|
item.update({
|
||||||
|
data: {
|
||||||
|
equipped: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (ret.stats.encumbrance <= data.info.heavyLoad) {
|
||||||
|
if (!!item) {
|
||||||
|
item.update({
|
||||||
|
data: {
|
||||||
|
equipped: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skip?.items) {
|
if (!skip?.effects) {
|
||||||
context.items
|
context.items
|
||||||
?.filter((item) => item.type === "effect")
|
?.filter((item) => item.type === "effect")
|
||||||
.forEach((item) => {
|
.forEach((item) => {
|
||||||
|
|
@ -365,120 +516,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.currency);
|
|
||||||
}
|
|
||||||
if (item.system.hoarded) {
|
|
||||||
ret.stats.hoard += item.system.value || 0;
|
|
||||||
}
|
|
||||||
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,
|
|
||||||
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.currency);
|
|
||||||
}
|
|
||||||
if (item.system.hoarded) {
|
|
||||||
ret.stats.hoard += item.system.value || 0;
|
|
||||||
}
|
|
||||||
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,
|
|
||||||
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.currency);
|
|
||||||
}
|
|
||||||
if (item.system.hoarded) {
|
|
||||||
ret.stats.hoard += item.system.value || 0;
|
|
||||||
}
|
|
||||||
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,
|
|
||||||
lpProtection: item.system.lpProtection,
|
|
||||||
calc: item.system.calc,
|
|
||||||
equipped: item.system?.equipped,
|
|
||||||
containerId: item.system.containerId || "",
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!skip?.spells) {
|
if (!skip?.spells) {
|
||||||
context.items
|
context.items
|
||||||
?.filter((item) => item.type === "spell")
|
?.filter((item) => item.type === "spell")
|
||||||
|
|
@ -599,7 +636,7 @@ export class M5Character extends Actor {
|
||||||
return data?.attributes[name];
|
return data?.attributes[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
createSkill(skillName: string): Promise<M5Item> {
|
async createSkill(skillName: string): Promise<M5Item> {
|
||||||
const itemData = {
|
const itemData = {
|
||||||
name: skillName,
|
name: skillName,
|
||||||
type: "skill",
|
type: "skill",
|
||||||
|
|
@ -611,7 +648,7 @@ export class M5Character extends Actor {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
createItem(itemName: string, itemType: M5ItemType): Promise<M5Item> {
|
async createItem(itemName: string, itemType: M5ItemType): Promise<M5Item> {
|
||||||
const itemData = {
|
const itemData = {
|
||||||
name: itemName,
|
name: itemName,
|
||||||
type: itemType,
|
type: itemType,
|
||||||
|
|
@ -623,6 +660,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 {
|
getItem(itemId: string): any {
|
||||||
if (!(this as any).items) return null;
|
if (!(this as any).items) return null;
|
||||||
return (this as any).getEmbeddedDocument("Item", itemId);
|
return (this as any).getEmbeddedDocument("Item", itemId);
|
||||||
|
|
|
||||||
|
|
@ -14,22 +14,22 @@ export class M5Item extends Item {
|
||||||
const itemData = (this as any).system;
|
const itemData = (this as any).system;
|
||||||
const calc = itemData.calc;
|
const calc = itemData.calc;
|
||||||
|
|
||||||
if (itemType === "item") {
|
if (itemType === "item") {
|
||||||
calc.containers = null;
|
calc.containers = null;
|
||||||
|
|
||||||
if (actor) {
|
if (actor) {
|
||||||
const actorCalc = actor.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
|
const actorCalc = actor.derivedData({ containers: false, items: true, spells: true, effects: true, kampfkuenste: true, encumbrance: true });
|
||||||
if (actorCalc) {
|
if (actorCalc) {
|
||||||
calc.containers = actorCalc.gear.containers;
|
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);
|
} else if (itemType === "skill") {
|
||||||
//console.log("M5Item.prepareDerivedData:containers", itemData, container?.system)
|
|
||||||
if (container) {
|
|
||||||
container.prepareDerivedData();
|
|
||||||
const containerData = container.system;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (itemType === "skill") {
|
|
||||||
calc.fw = itemData.fw;
|
calc.fw = itemData.fw;
|
||||||
calc.bonus = 0;
|
calc.bonus = 0;
|
||||||
|
|
||||||
|
|
@ -46,7 +46,14 @@ export class M5Item extends Item {
|
||||||
];
|
];
|
||||||
|
|
||||||
if (character) {
|
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) {
|
if (actorCalc?.skillMods && Object.keys(actorCalc.skillMods).indexOf(itemId) !== -1) {
|
||||||
pairs = pairs.concat(actorCalc.skillMods[itemId]);
|
pairs = pairs.concat(actorCalc.skillMods[itemId]);
|
||||||
}
|
}
|
||||||
|
|
@ -81,9 +88,8 @@ export class M5Item extends Item {
|
||||||
calc.combatSkills = null;
|
calc.combatSkills = null;
|
||||||
calc.containers = null;
|
calc.containers = null;
|
||||||
|
|
||||||
|
|
||||||
if (actor) {
|
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) {
|
if (actorCalc) {
|
||||||
calc.ew += actorCalc.stats.attackBonus.value;
|
calc.ew += actorCalc.stats.attackBonus.value;
|
||||||
calc.combatSkills = actorCalc.skills.combat;
|
calc.combatSkills = actorCalc.skills.combat;
|
||||||
|
|
@ -94,8 +100,8 @@ export class M5Item extends Item {
|
||||||
if (container) {
|
if (container) {
|
||||||
container.prepareDerivedData();
|
container.prepareDerivedData();
|
||||||
const containerData = container.system;
|
const containerData = container.system;
|
||||||
}
|
}
|
||||||
|
|
||||||
const skill = character.getItem(itemData.skillId);
|
const skill = character.getItem(itemData.skillId);
|
||||||
//console.log("M5Item.prepareDerivedData:weapon", itemData, skill?.system)
|
//console.log("M5Item.prepareDerivedData:weapon", itemData, skill?.system)
|
||||||
if (skill) {
|
if (skill) {
|
||||||
|
|
@ -115,7 +121,7 @@ export class M5Item extends Item {
|
||||||
calc.containers = null;
|
calc.containers = null;
|
||||||
|
|
||||||
if (actor) {
|
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) {
|
if (actorCalc) {
|
||||||
calc.ew += actorCalc.stats.defense.value + actorCalc.stats.defenseBonus.value;
|
calc.ew += actorCalc.stats.defense.value + actorCalc.stats.defenseBonus.value;
|
||||||
calc.combatSkills = actorCalc.skills.combat;
|
calc.combatSkills = actorCalc.skills.combat;
|
||||||
|
|
@ -127,7 +133,7 @@ export class M5Item extends Item {
|
||||||
if (container) {
|
if (container) {
|
||||||
container.prepareDerivedData();
|
container.prepareDerivedData();
|
||||||
const containerData = container.system;
|
const containerData = container.system;
|
||||||
}
|
}
|
||||||
|
|
||||||
const skill = character.getItem(itemData.skillId);
|
const skill = character.getItem(itemData.skillId);
|
||||||
//console.log("M5Item.prepareDerivedData:weapon", itemData, skill?.system)
|
//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 };
|
itemData.mods[5] = { type: "stat", id: "apProtection", operation: "set", value: itemData.apProtection };
|
||||||
calc.containers = null;
|
calc.containers = null;
|
||||||
if (actor) {
|
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) {
|
if (actorCalc) {
|
||||||
calc.containers = actorCalc.gear.containers;
|
calc.containers = actorCalc.gear.containers;
|
||||||
}
|
}
|
||||||
|
|
@ -157,12 +163,12 @@ export class M5Item extends Item {
|
||||||
if (container) {
|
if (container) {
|
||||||
container.prepareDerivedData();
|
container.prepareDerivedData();
|
||||||
const containerData = container.system;
|
const containerData = container.system;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (itemType === "spell") {
|
} else if (itemType === "spell") {
|
||||||
calc.fw = 0;
|
calc.fw = 0;
|
||||||
if (actor) {
|
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) {
|
if (actorCalc) {
|
||||||
calc.ew = actorCalc.stats.spellCasting.value;
|
calc.ew = actorCalc.stats.spellCasting.value;
|
||||||
}
|
}
|
||||||
|
|
@ -174,7 +180,7 @@ export class M5Item extends Item {
|
||||||
calc.generalSkills = null;
|
calc.generalSkills = null;
|
||||||
|
|
||||||
if (actor) {
|
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) {
|
if (actorCalc) {
|
||||||
calc.generalSkills = actorCalc.skills.general;
|
calc.generalSkills = actorCalc.skills.general;
|
||||||
}
|
}
|
||||||
|
|
@ -217,7 +223,13 @@ export class M5Item extends Item {
|
||||||
}
|
}
|
||||||
case M5ModType.SKILL: {
|
case M5ModType.SKILL: {
|
||||||
if (character) {
|
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) {
|
if (actorCalc) {
|
||||||
let category = (game as Game).i18n.localize("midgard5.skill");
|
let category = (game as Game).i18n.localize("midgard5.skill");
|
||||||
Object.keys(actorCalc.skills.general).forEach((skillId) => {
|
Object.keys(actorCalc.skills.general).forEach((skillId) => {
|
||||||
|
|
|
||||||
|
|
@ -270,11 +270,11 @@ export default class M5CharacterSheet extends ActorSheet {
|
||||||
|
|
||||||
const context = this.actor as any;
|
const context = this.actor as any;
|
||||||
const item = context.items.get(itemId);
|
const item = context.items.get(itemId);
|
||||||
if (item.system.equipped === true) {
|
item.update({
|
||||||
item.system.equipped = false;
|
data: {
|
||||||
} else {
|
equipped: !item.system.equipped,
|
||||||
item.system.equipped = true;
|
},
|
||||||
}
|
});
|
||||||
this.render();
|
this.render();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -193,6 +193,30 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flexcolumn-2">
|
<div class="flexcolumn-2">
|
||||||
|
<div class="flexpart">
|
||||||
|
<div class="flexpart-header"><img src="icons/tools/hand/scale-balances-merchant-brown.webp" class="flexpart-icon">Lasten in Kilogramm</div>
|
||||||
|
<table>
|
||||||
|
<thead class="theader">
|
||||||
|
<tr>
|
||||||
|
<th class="title" style="text-align: center">{{localize "midgard5.load"}}</th>
|
||||||
|
<th class="title" style="text-align: center">{{localize "midgard5.heavy-load"}}</th>
|
||||||
|
<th class="title" style="text-align: center">{{localize "midgard5.load-max"}}</th>
|
||||||
|
<th class="title" style="text-align: center">{{localize "midgard5.thrust-load"}}</th>
|
||||||
|
<th class="title" style="text-align: center">{{localize "midgard5.encumbrance"}}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tfoot>
|
||||||
|
<tr height = 10px></tr>
|
||||||
|
<tr>
|
||||||
|
<td class="fixed-value"><input type="number" name="data.info.load" value="{{data.calc.stats.load}}"></td>
|
||||||
|
<td class="fixed-value"><input type="number" name="data.info.heavyLoad" value="{{data.calc.stats.heavyLoad}}"></td>
|
||||||
|
<td class="fixed-value"><input type="number" name="data.info.loadMax" value="{{data.calc.stats.loadMax}}"></td>
|
||||||
|
<td class="fixed-value"><input type="number" name="data.info.thrustLoad" value="{{data.calc.stats.thrustLoad}}"></td>
|
||||||
|
<td class="fixed-value"><input type="number" name="data.info.encumbrance" value="{{data.calc.stats.encumbrance}}"></td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="flexpart">
|
<div class="flexpart">
|
||||||
<div class="flexpart-header"><img src="icons/containers/chest/chest-simple-box-brown.webp" class="flexpart-icon">{{localize "TYPES.Item.container"}}</div>
|
<div class="flexpart-header"><img src="icons/containers/chest/chest-simple-box-brown.webp" class="flexpart-icon">{{localize "TYPES.Item.container"}}</div>
|
||||||
|
|
@ -293,30 +317,5 @@
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
<div class="flexpart">
|
|
||||||
<div class="flexpart-header"><img src="icons/tools/hand/scale-balances-merchant-brown.webp" class="flexpart-icon">Lasten in Kilogramm</div>
|
|
||||||
<table>
|
|
||||||
<thead class="theader">
|
|
||||||
<tr>
|
|
||||||
<th class="title" style="text-align: center">{{localize "midgard5.load"}}</th>
|
|
||||||
<th class="title" style="text-align: center">{{localize "midgard5.heavy-load"}}</th>
|
|
||||||
<th class="title" style="text-align: center">{{localize "midgard5.load-max"}}</th>
|
|
||||||
<th class="title" style="text-align: center">{{localize "midgard5.thrust-load"}}</th>
|
|
||||||
<th class="title" style="text-align: center">{{localize "midgard5.encumbrance"}}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tfoot>
|
|
||||||
<tr height = 10px></tr>
|
|
||||||
<tr>
|
|
||||||
<td class="fixed-value"><input type="number" name="data.info.load" value="{{data.calc.stats.load}}"></td>
|
|
||||||
<td class="fixed-value"><input type="number" name="data.info.heavyLoad" value="{{data.calc.stats.heavyLoad}}"></td>
|
|
||||||
<td class="fixed-value"><input type="number" name="data.info.loadMax" value="{{data.calc.stats.loadMax}}"></td>
|
|
||||||
<td class="fixed-value"><input type="number" name="data.info.thrustLoad" value="{{data.calc.stats.thrustLoad}}"></td>
|
|
||||||
<td class="fixed-value"><input type="number" name="data.info.encumbrance" value="{{data.calc.stats.encumbrance}}"></td>
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
Loading…
Reference in New Issue