Take over project
Changes: + Update macros for crits + update lookup for Abwehr and Zaubern to display correct value
This commit is contained in:
parent
c8f111dd18
commit
0e67ab06dc
2
LICENSE
2
LICENSE
|
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2022 Michael Stein
|
Copyright (c) 2022
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"moduleName": "Midgard 5. Edition",
|
"moduleName": "Midgard 5. Edition",
|
||||||
"repository": "https://github.com/michaelstein/foundry-vtt-system-midgard5",
|
"repository": "https://github.com/Byroks/foundry-vtt-system-midgard5",
|
||||||
"rawURL": "https://raw.githubusercontent.com/michaelstein/foundry-vtt-system-midgard5"
|
"rawURL": "https://raw.githubusercontent.com/Byroks/foundry-vtt-system-midgard5"
|
||||||
}
|
}
|
||||||
|
|
@ -78,6 +78,7 @@
|
||||||
"midgard5.exp-available": "Erfahrungspunkte",
|
"midgard5.exp-available": "Erfahrungspunkte",
|
||||||
"midgard5.grace": "Göttliche Gnade",
|
"midgard5.grace": "Göttliche Gnade",
|
||||||
"midgard5.destiny": "Schicksalsgunst",
|
"midgard5.destiny": "Schicksalsgunst",
|
||||||
|
"midgard5.luckPoints": "Glückspunkte",
|
||||||
|
|
||||||
"midgard5.akrobatik": "Akrobatik",
|
"midgard5.akrobatik": "Akrobatik",
|
||||||
"midgard5.alchimie": "Alchimie",
|
"midgard5.alchimie": "Alchimie",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "foundry-system-midgard5",
|
"name": "foundry-system-midgard5",
|
||||||
"version": "1.1.0",
|
"version": "1.2.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
"build:watch:target": "gulp watchTarget",
|
"build:watch:target": "gulp watchTarget",
|
||||||
"clean": "gulp clean && gulp link --clean"
|
"clean": "gulp clean && gulp link --clean"
|
||||||
},
|
},
|
||||||
"author": "Michael Stein",
|
"author": "Simon Gustavs",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.15.0",
|
"@babel/core": "^7.15.0",
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scope": "global",
|
"scope": "global",
|
||||||
"command": "main()\nasync function main() {\n\n//Das richtige Pack (Kompendium) holen\n\nconst pack = game.packs.get(\"midgard5.tabellen-kritische-ereignisse\");\n\nawait pack.getIndex();\n\n// Richtige Tabelle aus dem Pack holen\n\nlet entry = pack.index.find(e => e.name === \"Kritische Fehler beim Zaubern\");\n\n\n// Zum Schluss drauf würfeln\n\npack.getEntity(entry._id).then(table => table.draw());\n\n}",
|
"command": "await game.tables.getName(\"Kritische Fehler beim Zaubern\").draw()",
|
||||||
"author": "CBq5YXAqbO7HoJ03",
|
"author": "CBq5YXAqbO7HoJ03",
|
||||||
"img": "systems/midgard5/assets/icons/macro/kritfehlerzauber.svg",
|
"img": "systems/midgard5/assets/icons/macro/kritfehlerzauber.svg",
|
||||||
"actorIds": [],
|
"actorIds": [],
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scope": "global",
|
"scope": "global",
|
||||||
"command": "main()\nasync function main() {\n\n//Das richtige Pack (Kompendium) holen\n\nconst pack = game.packs.get(\"midgard5.tabellen-kritische-ereignisse\");\n\nawait pack.getIndex();\n\n// Richtige Tabelle aus dem Pack holen\n\nlet entry = pack.index.find(e => e.name === \"Kritischer Erfolg bei der Abwehr\");\n\n// Zum Schluss drauf würfeln\n\npack.getEntity(entry._id).then(table => table.draw());\n\n}",
|
"command": "await game.tables.getName(\"Kritische Erfolg bei der Abwehr\").draw()",
|
||||||
"author": "CBq5YXAqbO7HoJ03",
|
"author": "CBq5YXAqbO7HoJ03",
|
||||||
"img": "systems/midgard5/assets/icons/macro/kriterfolgabwehr.svg",
|
"img": "systems/midgard5/assets/icons/macro/kriterfolgabwehr.svg",
|
||||||
"actorIds": [],
|
"actorIds": [],
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scope": "global",
|
"scope": "global",
|
||||||
"command": "main()\nasync function main() {\n\n//Das richtige Pack (Kompendium) holen\n\nconst pack = game.packs.get(\"midgard5.tabellen-kritische-ereignisse\");\n\nawait pack.getIndex();\n\n// Richtige Tabelle aus dem Pack holen\n\nlet entry = pack.index.find(e => e.name === \"Kritischer Fehler bei Angriffen\");\n\n// Zum Schluss drauf würfeln\n\npack.getEntity(entry._id).then(table => table.draw());\n\n}",
|
"command": "await game.tables.getName(\"Kritische Fehler bei Angriffen\").draw()",
|
||||||
"author": "CBq5YXAqbO7HoJ03",
|
"author": "CBq5YXAqbO7HoJ03",
|
||||||
"img": "systems/midgard5/assets/icons/macro/kritfehlerangriff.svg",
|
"img": "systems/midgard5/assets/icons/macro/kritfehlerangriff.svg",
|
||||||
"actorIds": [],
|
"actorIds": [],
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scope": "global",
|
"scope": "global",
|
||||||
"command": "main()\nasync function main() {\n\n//Das richtige Pack (Kompendium) holen\n\nconst pack = game.packs.get(\"midgard5.tabellen-kritische-ereignisse\");\n\nawait pack.getIndex();\n\n// Richtige Tabelle aus dem Pack holen\n\nlet entry = pack.index.find(e => e.name === \"Kritischer Fehler bei der Abwehr\");\n\n// Zum Schluss drauf würfeln\n\npack.getEntity(entry._id).then(table => table.draw());\n\n}",
|
"command": "await game.tables.getName(\"Kritische Fehler bei der Abwehr\").draw()",
|
||||||
"author": "CBq5YXAqbO7HoJ03",
|
"author": "CBq5YXAqbO7HoJ03",
|
||||||
"img": "systems/midgard5/assets/icons/macro/kritfehlerabwehr.svg",
|
"img": "systems/midgard5/assets/icons/macro/kritfehlerabwehr.svg",
|
||||||
"actorIds": [],
|
"actorIds": [],
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scope": "global",
|
"scope": "global",
|
||||||
"command": "main()\nasync function main() {\n\n//Das richtige Pack (Kompendium) holen\n\nconst pack = game.packs.get(\"midgard5.tabellen-kritische-ereignisse\");\n\nawait pack.getIndex();\n\n// Richtige Tabelle aus dem Pack holen\n\nlet entry = pack.index.find(e => e.name === \"Kritischer Schaden\");\n\n// Zum Schluss drauf würfeln\n\npack.getEntity(entry._id).then(table => table.draw());\n\n}",
|
"command": "await game.tables.getName(\"Kritischer Schaden\").draw()",
|
||||||
"author": "CBq5YXAqbO7HoJ03",
|
"author": "CBq5YXAqbO7HoJ03",
|
||||||
"img": "systems/midgard5/assets/icons/macro/kriterfolgangriff.svg",
|
"img": "systems/midgard5/assets/icons/macro/kriterfolgangriff.svg",
|
||||||
"actorIds": [],
|
"actorIds": [],
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
import { M5Item } from "../items/M5Item"
|
import { M5Item } from "../items/M5Item";
|
||||||
import { M5Attribute, M5CharacterCalculatedData, M5ItemMod, M5ModOperation, M5ModResult, M5RollData, M5Skill, M5SkillCalculated, M5SkillLearned } from "../M5Base"
|
import { M5Attribute, M5CharacterCalculatedData, M5ItemMod, M5ModOperation, M5ModResult, 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(
|
||||||
// data: ConstructorParameters<typeof foundry.documents.BaseActor>[0],
|
// data: ConstructorParameters<typeof foundry.documents.BaseActor>[0],
|
||||||
// context?: ConstructorParameters<typeof foundry.documents.BaseActor>[1]
|
// context?: ConstructorParameters<typeof foundry.documents.BaseActor>[1]
|
||||||
|
|
@ -13,23 +12,19 @@ export class M5Character extends Actor {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
static attributeMinMax(attribute: M5Attribute) {
|
static attributeMinMax(attribute: M5Attribute) {
|
||||||
return Math.min(100, Math.max(0, attribute.value + attribute.bonus))
|
return Math.min(100, Math.max(0, attribute.value + attribute.bonus));
|
||||||
}
|
}
|
||||||
|
|
||||||
static attributeBonus(attribute: M5Attribute) {
|
static attributeBonus(attribute: M5Attribute) {
|
||||||
const value = this.attributeMinMax(attribute)
|
const value = this.attributeMinMax(attribute);
|
||||||
if (value > 95)
|
if (value > 95) return 2;
|
||||||
return 2
|
if (value > 80) return 1;
|
||||||
if (value > 80)
|
if (value > 20) return 0;
|
||||||
return 1
|
if (value > 5) return -1;
|
||||||
if (value > 20)
|
return -2;
|
||||||
return 0
|
|
||||||
if (value > 5)
|
|
||||||
return -1
|
|
||||||
return -2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
derivedData(skip: { mods?: boolean, skills?: boolean, weapons?: boolean, defensiveWeapons?: boolean, armor?: boolean, items?: boolean, spells?: boolean } = {} ): M5CharacterCalculatedData {
|
derivedData(skip: { mods?: boolean; skills?: boolean; weapons?: boolean; defensiveWeapons?: boolean; armor?: boolean; items?: boolean; spells?: boolean } = {}): M5CharacterCalculatedData {
|
||||||
let ret: M5CharacterCalculatedData = {
|
let ret: M5CharacterCalculatedData = {
|
||||||
level: 0,
|
level: 0,
|
||||||
attributes: {
|
attributes: {
|
||||||
|
|
@ -41,7 +36,7 @@ export class M5Character extends Actor {
|
||||||
zt: { value: 0, bonus: 0, mods: [] },
|
zt: { value: 0, bonus: 0, mods: [] },
|
||||||
au: { value: 0, bonus: 0, mods: [] },
|
au: { value: 0, bonus: 0, mods: [] },
|
||||||
pa: { value: 0, bonus: 0, mods: [] },
|
pa: { value: 0, bonus: 0, mods: [] },
|
||||||
wk: { value: 0, bonus: 0, mods: [] }
|
wk: { value: 0, bonus: 0, mods: [] },
|
||||||
},
|
},
|
||||||
stats: {
|
stats: {
|
||||||
lp: { value: 0, mods: [] },
|
lp: { value: 0, mods: [] },
|
||||||
|
|
@ -58,7 +53,7 @@ export class M5Character extends Actor {
|
||||||
brawl: { value: 0, mods: [] },
|
brawl: { value: 0, mods: [] },
|
||||||
brawlEw: 0,
|
brawlEw: 0,
|
||||||
poisonResistance: { value: 0, mods: [] },
|
poisonResistance: { value: 0, mods: [] },
|
||||||
enduranceBonus: 0
|
enduranceBonus: 0,
|
||||||
},
|
},
|
||||||
skillMods: {},
|
skillMods: {},
|
||||||
skills: {
|
skills: {
|
||||||
|
|
@ -66,187 +61,200 @@ export class M5Character extends Actor {
|
||||||
general: {},
|
general: {},
|
||||||
combat: {},
|
combat: {},
|
||||||
language: {},
|
language: {},
|
||||||
custom: {}
|
custom: {},
|
||||||
},
|
},
|
||||||
gear: {
|
gear: {
|
||||||
weapons: {},
|
weapons: {},
|
||||||
defensiveWeapons: {},
|
defensiveWeapons: {},
|
||||||
armor: {},
|
armor: {},
|
||||||
items: {}
|
items: {},
|
||||||
},
|
},
|
||||||
spells: {}
|
spells: {},
|
||||||
} as M5CharacterCalculatedData
|
} as M5CharacterCalculatedData;
|
||||||
|
|
||||||
const context = (this as any)
|
const context = this as any;
|
||||||
if (!context)
|
if (!context) return null;
|
||||||
return null
|
|
||||||
|
|
||||||
const data = (this as any).system
|
const data = (this as any).system;
|
||||||
if (!data)
|
if (!data) return null;
|
||||||
return null
|
|
||||||
|
|
||||||
ret.level = M5Character.levelFromExp(data.es)
|
ret.level = M5Character.levelFromExp(data.es);
|
||||||
|
|
||||||
ret.attributes.st.value = M5Character.attributeMinMax(data.attributes.st) // TODO item effects
|
ret.attributes.st.value = M5Character.attributeMinMax(data.attributes.st); // TODO item effects
|
||||||
ret.attributes.gs.value = M5Character.attributeMinMax(data.attributes.gs)
|
ret.attributes.gs.value = M5Character.attributeMinMax(data.attributes.gs);
|
||||||
ret.attributes.gw.value = M5Character.attributeMinMax(data.attributes.gw)
|
ret.attributes.gw.value = M5Character.attributeMinMax(data.attributes.gw);
|
||||||
ret.attributes.ko.value = M5Character.attributeMinMax(data.attributes.ko)
|
ret.attributes.ko.value = M5Character.attributeMinMax(data.attributes.ko);
|
||||||
ret.attributes.in.value = M5Character.attributeMinMax(data.attributes.in)
|
ret.attributes.in.value = M5Character.attributeMinMax(data.attributes.in);
|
||||||
ret.attributes.zt.value = M5Character.attributeMinMax(data.attributes.zt)
|
ret.attributes.zt.value = M5Character.attributeMinMax(data.attributes.zt);
|
||||||
ret.attributes.au.value = M5Character.attributeMinMax(data.attributes.au)
|
ret.attributes.au.value = M5Character.attributeMinMax(data.attributes.au);
|
||||||
ret.attributes.pa.value = M5Character.attributeMinMax(data.attributes.pa)
|
ret.attributes.pa.value = M5Character.attributeMinMax(data.attributes.pa);
|
||||||
ret.attributes.wk.value = M5Character.attributeMinMax(data.attributes.wk)
|
ret.attributes.wk.value = M5Character.attributeMinMax(data.attributes.wk);
|
||||||
|
|
||||||
ret.attributes.st.bonus = M5Character.attributeBonus(data.attributes.st)
|
ret.attributes.st.bonus = M5Character.attributeBonus(data.attributes.st);
|
||||||
ret.attributes.gs.bonus = M5Character.attributeBonus(data.attributes.gs)
|
ret.attributes.gs.bonus = M5Character.attributeBonus(data.attributes.gs);
|
||||||
ret.attributes.gw.bonus = M5Character.attributeBonus(data.attributes.gw)
|
ret.attributes.gw.bonus = M5Character.attributeBonus(data.attributes.gw);
|
||||||
ret.attributes.ko.bonus = M5Character.attributeBonus(data.attributes.ko)
|
ret.attributes.ko.bonus = M5Character.attributeBonus(data.attributes.ko);
|
||||||
ret.attributes.in.bonus = M5Character.attributeBonus(data.attributes.in)
|
ret.attributes.in.bonus = M5Character.attributeBonus(data.attributes.in);
|
||||||
ret.attributes.zt.bonus = M5Character.attributeBonus(data.attributes.zt)
|
ret.attributes.zt.bonus = M5Character.attributeBonus(data.attributes.zt);
|
||||||
ret.attributes.au.bonus = M5Character.attributeBonus(data.attributes.au)
|
ret.attributes.au.bonus = M5Character.attributeBonus(data.attributes.au);
|
||||||
ret.attributes.pa.bonus = M5Character.attributeBonus(data.attributes.pa)
|
ret.attributes.pa.bonus = M5Character.attributeBonus(data.attributes.pa);
|
||||||
ret.attributes.wk.bonus = M5Character.attributeBonus(data.attributes.wk)
|
ret.attributes.wk.bonus = M5Character.attributeBonus(data.attributes.wk);
|
||||||
|
|
||||||
ret.stats.lp = this.modResult(data.lp)
|
ret.stats.lp = this.modResult(data.lp);
|
||||||
ret.stats.ap = this.modResult(data.ap)
|
ret.stats.ap = this.modResult(data.ap);
|
||||||
ret.stats.armor = 0
|
ret.stats.armor = 0;
|
||||||
ret.stats.defense = this.modResult(M5Character.defenseFromLevel(ret.level))
|
ret.stats.defense = this.modResult(M5Character.defenseFromLevel(ret.level));
|
||||||
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.movementBonus = this.modResult(0)
|
ret.stats.movementBonus = this.modResult(0);
|
||||||
ret.stats.resistanceMind = this.modResult(ret.stats.defense.value)
|
ret.stats.resistanceMind = this.modResult(ret.stats.defense.value);
|
||||||
ret.stats.resistanceBody = this.modResult(ret.stats.defense.value + 1)
|
ret.stats.resistanceBody = this.modResult(ret.stats.defense.value + 1);
|
||||||
ret.stats.spellCasting = this.modResult((data.info.magicUsing ? M5Character.spellCastingFromLevel(ret.level) : 3) + ret.attributes.zt.bonus)
|
ret.stats.spellCasting = this.modResult((data.info.magicUsing ? M5Character.spellCastingFromLevel(ret.level) : 3) + ret.attributes.zt.bonus);
|
||||||
ret.stats.brawl = this.modResult(Math.floor((ret.attributes.st.value + ret.attributes.gw.value) / 20))
|
ret.stats.brawl = this.modResult(Math.floor((ret.attributes.st.value + ret.attributes.gw.value) / 20));
|
||||||
ret.stats.brawlEw = ret.stats.brawl.value + ret.stats.attackBonus.value
|
ret.stats.brawlEw = ret.stats.brawl.value + ret.stats.attackBonus.value;
|
||||||
ret.stats.poisonResistance = this.modResult(30 + Math.floor(ret.attributes.ko.value / 2))
|
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.enduranceBonus = Math.floor(ret.attributes.ko.value / 10) + Math.floor(ret.attributes.st.value / 20);
|
||||||
|
|
||||||
if (!skip?.mods) {
|
if (!skip?.mods) {
|
||||||
const aggregate = new M5ModAggregate(data, ret)
|
const aggregate = new M5ModAggregate(data, ret);
|
||||||
|
|
||||||
context.items?.filter(item => item.type === "item").forEach(item => {
|
context.items
|
||||||
const mods = item.system.mods
|
?.filter((item) => item.type === "item")
|
||||||
|
.forEach((item) => {
|
||||||
|
const mods = item.system.mods;
|
||||||
//console.log("Actor item mods", mods)
|
//console.log("Actor item mods", mods)
|
||||||
Object.keys(mods).forEach(modIndex => {
|
Object.keys(mods).forEach((modIndex) => {
|
||||||
const mod = mods[modIndex] as M5ItemMod
|
const mod = mods[modIndex] as M5ItemMod;
|
||||||
aggregate.push(mod, item.name)
|
aggregate.push(mod, item.name);
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
ret.skillMods = aggregate.calculate()
|
ret.skillMods = aggregate.calculate();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skip?.items) {
|
if (!skip?.items) {
|
||||||
context.items?.filter(item => item.type === "item").forEach(item => {
|
context.items
|
||||||
item.prepareDerivedData()
|
?.filter((item) => item.type === "item")
|
||||||
|
.forEach((item) => {
|
||||||
|
item.prepareDerivedData();
|
||||||
|
|
||||||
let label = item.name
|
let label = item.name;
|
||||||
if (item.system.magic) {
|
if (item.system.magic) {
|
||||||
label += "*"
|
label += "*";
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.gear.items[item.id] = {
|
ret.gear.items[item.id] = {
|
||||||
label: label,
|
label: label,
|
||||||
magic: item.system.magic,
|
magic: item.system.magic,
|
||||||
calc: item.system.calc
|
calc: item.system.calc,
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skip?.skills) {
|
if (!skip?.skills) {
|
||||||
context.items?.filter(item => item.type === "skill").forEach(item => {
|
context.items
|
||||||
item.prepareDerivedData()
|
?.filter((item) => item.type === "skill")
|
||||||
const skillMap = ret.skills[item.system.type]
|
.forEach((item) => {
|
||||||
|
item.prepareDerivedData();
|
||||||
|
const skillMap = ret.skills[item.system.type];
|
||||||
skillMap[item.id] = {
|
skillMap[item.id] = {
|
||||||
label: item.name,
|
label: item.name,
|
||||||
fw: item.system.fw,
|
fw: item.system.fw,
|
||||||
attribute: item.system.attribute,
|
attribute: item.system.attribute,
|
||||||
pp: item.system.pp,
|
pp: item.system.pp,
|
||||||
calc: item.system.calc
|
calc: item.system.calc,
|
||||||
} as M5SkillCalculated
|
} as M5SkillCalculated;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skip?.weapons) {
|
if (!skip?.weapons) {
|
||||||
context.items?.filter(item => item.type === "weapon").forEach(item => {
|
context.items
|
||||||
item.prepareDerivedData()
|
?.filter((item) => item.type === "weapon")
|
||||||
|
.forEach((item) => {
|
||||||
|
item.prepareDerivedData();
|
||||||
|
|
||||||
let label = item.name
|
let label = item.name;
|
||||||
if (item.system.magic) {
|
if (item.system.magic) {
|
||||||
label += "*("
|
label +=
|
||||||
+ (item.system.stats.attackBonus < 0 ? "" : "+")
|
"*(" +
|
||||||
+ item.system.stats.attackBonus + "/"
|
(item.system.stats.attackBonus < 0 ? "" : "+") +
|
||||||
+ (item.system.stats.damageBonus < 0 ? "" : "+")
|
item.system.stats.attackBonus +
|
||||||
+ item.system.stats.damageBonus + ")"
|
"/" +
|
||||||
|
(item.system.stats.damageBonus < 0 ? "" : "+") +
|
||||||
|
item.system.stats.damageBonus +
|
||||||
|
")";
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.gear.weapons[item.id] = {
|
ret.gear.weapons[item.id] = {
|
||||||
label: label,
|
label: label,
|
||||||
skillId: item.system.skillId,
|
skillId: item.system.skillId,
|
||||||
magic: item.system.magic,
|
magic: item.system.magic,
|
||||||
calc: item.system.calc
|
calc: item.system.calc,
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skip?.defensiveWeapons) {
|
if (!skip?.defensiveWeapons) {
|
||||||
context.items?.filter(item => item.type === "defensiveWeapon").forEach(item => {
|
context.items
|
||||||
item.prepareDerivedData()
|
?.filter((item) => item.type === "defensiveWeapon")
|
||||||
|
.forEach((item) => {
|
||||||
|
item.prepareDerivedData();
|
||||||
|
|
||||||
let label = item.name
|
let label = item.name;
|
||||||
if (item.system.magic) {
|
if (item.system.magic) {
|
||||||
label += "*("
|
label += "*(" + (item.system.stats.defenseBonus < 0 ? "" : "+") + item.system.stats.defenseBonus + ")";
|
||||||
+ (item.system.stats.defenseBonus < 0 ? "" : "+")
|
|
||||||
+ item.system.stats.defenseBonus + ")"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.gear.defensiveWeapons[item.id] = {
|
ret.gear.defensiveWeapons[item.id] = {
|
||||||
label: label,
|
label: label,
|
||||||
skillId: item.system.skillId,
|
skillId: item.system.skillId,
|
||||||
magic: item.system.magic,
|
magic: item.system.magic,
|
||||||
calc: item.system.calc
|
calc: item.system.calc,
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skip?.armor) {
|
if (!skip?.armor) {
|
||||||
context.items?.filter(item => item.type === "armor").forEach(item => {
|
context.items
|
||||||
item.prepareDerivedData()
|
?.filter((item) => item.type === "armor")
|
||||||
|
.forEach((item) => {
|
||||||
|
item.prepareDerivedData();
|
||||||
|
|
||||||
let label = item.name
|
let label = item.name;
|
||||||
if (item.system.magic) {
|
if (item.system.magic) {
|
||||||
label += "*"
|
label += "*";
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.gear.armor[item.id] = {
|
ret.gear.armor[item.id] = {
|
||||||
label: label,
|
label: label,
|
||||||
magic: item.system.magic,
|
magic: item.system.magic,
|
||||||
calc: item.system.calc
|
calc: item.system.calc,
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skip?.spells) {
|
if (!skip?.spells) {
|
||||||
context.items?.filter(item => item.type === "spell").forEach(item => {
|
context.items
|
||||||
item.prepareDerivedData()
|
?.filter((item) => item.type === "spell")
|
||||||
|
.forEach((item) => {
|
||||||
|
item.prepareDerivedData();
|
||||||
|
|
||||||
ret.spells[item.id] = {
|
ret.spells[item.id] = {
|
||||||
label: item.name,
|
label: item.name,
|
||||||
process: "midgard5.spell-process-" + item.system.process,
|
process: "midgard5.spell-process-" + item.system.process,
|
||||||
calc: item.system.calc
|
calc: item.system.calc,
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
prepareDerivedData() {
|
prepareDerivedData() {
|
||||||
console.log("M5Character", "prepareDerivedData")
|
console.log("M5Character", "prepareDerivedData");
|
||||||
const data = (this as any).system
|
const data = (this as any).system;
|
||||||
data.calc = this.derivedData({})
|
data.calc = this.derivedData({});
|
||||||
}
|
}
|
||||||
|
|
||||||
override getRollData(): any {
|
override getRollData(): any {
|
||||||
|
|
@ -255,88 +263,93 @@ export class M5Character extends Actor {
|
||||||
i: null,
|
i: null,
|
||||||
iType: null,
|
iType: null,
|
||||||
rolls: {},
|
rolls: {},
|
||||||
res: {}
|
res: {},
|
||||||
} as M5RollData
|
} as M5RollData;
|
||||||
}
|
}
|
||||||
|
|
||||||
static readonly levelThreshold: Array<number> = [0, 100, 250, 500, 750, 1000, 1250, 1500, 1750, 2000, 2500, 3000, 3500, 4000, 4500, 5000, 6000, 7000, 8000, 9000, 10000, 12500, 15000, 17500, 20000, 22500, 25000, 30000, 35000, 40000, 45000, 50000, 55000, 60000, 65000, 70000, 75000, 80000, 85000, 90000, 95000, 100000, 105000, 110000, 115000, 120000, 125000, 130000, 135000, 140000, 145000, 150000, 155000, 160000, 165000, 170000, 175000, 180000, 185000, 190000, 195000, 200000, 205000, 210000, 215000, 220000, 225000, 230000, 235000, 240000, 245000, 250000, 255000, 260000, 265000, 270000, 275000, 280000]
|
static readonly levelThreshold: Array<number> = [
|
||||||
|
0, 100, 250, 500, 750, 1000, 1250, 1500, 1750, 2000, 2500, 3000, 3500, 4000, 4500, 5000, 6000, 7000, 8000, 9000, 10000, 12500, 15000, 17500, 20000, 22500, 25000, 30000, 35000, 40000,
|
||||||
|
45000, 50000, 55000, 60000, 65000, 70000, 75000, 80000, 85000, 90000, 95000, 100000, 105000, 110000, 115000, 120000, 125000, 130000, 135000, 140000, 145000, 150000, 155000, 160000,
|
||||||
|
165000, 170000, 175000, 180000, 185000, 190000, 195000, 200000, 205000, 210000, 215000, 220000, 225000, 230000, 235000, 240000, 245000, 250000, 255000, 260000, 265000, 270000, 275000,
|
||||||
|
280000,
|
||||||
|
];
|
||||||
static levelFromExp(exp: number): number {
|
static levelFromExp(exp: number): number {
|
||||||
const ret = M5Character.levelThreshold.findIndex(val => val > exp)
|
const ret = M5Character.levelThreshold.findIndex((val) => val > exp);
|
||||||
return ret === -1 ? M5Character.levelThreshold.length : ret
|
return ret === -1 ? M5Character.levelThreshold.length : ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static readonly defenseThreshold: Array<[number, number]> = [
|
static readonly defenseThreshold: Array<[number, number]> = [
|
||||||
[1, 11],
|
[30, 18],
|
||||||
[2, 12],
|
|
||||||
[5, 13],
|
|
||||||
[10, 14],
|
|
||||||
[15, 15],
|
|
||||||
[20, 16],
|
|
||||||
[25, 17],
|
[25, 17],
|
||||||
[30, 18]
|
[20, 16],
|
||||||
]
|
[15, 15],
|
||||||
|
[10, 14],
|
||||||
|
[5, 13],
|
||||||
|
[2, 12],
|
||||||
|
[1, 11],
|
||||||
|
];
|
||||||
static defenseFromLevel(lvl: number): number {
|
static defenseFromLevel(lvl: number): number {
|
||||||
const ret = M5Character.defenseThreshold.find(val => val[0] >= lvl)
|
const ret = M5Character.defenseThreshold.find((val) => val[0] <= lvl);
|
||||||
return ret ? ret[1] : M5Character.defenseThreshold[M5Character.defenseThreshold.length - 1][1]
|
return ret ? ret[1] : M5Character.defenseThreshold[M5Character.defenseThreshold.length - 1][1];
|
||||||
}
|
}
|
||||||
|
|
||||||
static readonly spellCastingThreshold: Array<[number, number]> = [
|
static readonly spellCastingThreshold: Array<[number, number]> = [
|
||||||
[1, 11],
|
[20, 18],
|
||||||
[2, 12],
|
|
||||||
[4, 13],
|
|
||||||
[6, 14],
|
|
||||||
[8, 15],
|
|
||||||
[10, 16],
|
|
||||||
[15, 17],
|
[15, 17],
|
||||||
[20, 18]
|
[10, 16],
|
||||||
]
|
[8, 15],
|
||||||
|
[6, 14],
|
||||||
|
[4, 13],
|
||||||
|
[2, 12],
|
||||||
|
[1, 11],
|
||||||
|
];
|
||||||
static spellCastingFromLevel(lvl: number): number {
|
static spellCastingFromLevel(lvl: number): number {
|
||||||
const ret = M5Character.spellCastingThreshold.find(val => val[0] >= lvl)
|
const ret = M5Character.spellCastingThreshold.find((val) => val[0] <= lvl);
|
||||||
return ret ? ret[1] : M5Character.spellCastingThreshold[M5Character.spellCastingThreshold.length - 1][1]
|
return ret ? ret[1] : M5Character.spellCastingThreshold[M5Character.spellCastingThreshold.length - 1][1];
|
||||||
}
|
}
|
||||||
|
|
||||||
skillBonus(skill: M5Skill, skillName?: string) {
|
skillBonus(skill: M5Skill, skillName?: string) {
|
||||||
const data = (this as any).system
|
const data = (this as any).system;
|
||||||
return data.calc?.attributes[skill.attribute]?.bonus ?? 0
|
return data.calc?.attributes[skill.attribute]?.bonus ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
skillEw(skill: M5Skill, skillName?: string) {
|
skillEw(skill: M5Skill, skillName?: string) {
|
||||||
const bonus = this.skillBonus(skill, skillName)
|
const bonus = this.skillBonus(skill, skillName);
|
||||||
return skill.fw + bonus
|
return skill.fw + bonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
attribute(name: string): M5Attribute {
|
attribute(name: string): M5Attribute {
|
||||||
const data = (this as any).system
|
const data = (this as any).system;
|
||||||
return data?.attributes[name]
|
return data?.attributes[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
createSkill(skillName: string): Promise<M5Item> {
|
createSkill(skillName: string): Promise<M5Item> {
|
||||||
const itemData = {
|
const itemData = {
|
||||||
name: skillName,
|
name: skillName,
|
||||||
type: "skill"
|
type: "skill",
|
||||||
};
|
};
|
||||||
|
|
||||||
return (this as any).createEmbeddedDocuments("Item", [itemData]).then(docs => {
|
return (this as any).createEmbeddedDocuments("Item", [itemData]).then((docs) => {
|
||||||
const item = docs[0]
|
const item = docs[0];
|
||||||
return item
|
return item;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getItem(itemId: string): any {
|
getItem(itemId: string): any {
|
||||||
if (!(this as any).items)
|
if (!(this as any).items) return null;
|
||||||
return null
|
return (this as any).getEmbeddedDocument("Item", itemId);
|
||||||
return (this as any).getEmbeddedDocument("Item", itemId)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private modResult(value: number): M5ModResult {
|
private modResult(value: number): M5ModResult {
|
||||||
return {
|
return {
|
||||||
value: value,
|
value: value,
|
||||||
mods: [{
|
mods: [
|
||||||
|
{
|
||||||
item: (game as Game).i18n.localize("ACTOR.TypeCharacter"),
|
item: (game as Game).i18n.localize("ACTOR.TypeCharacter"),
|
||||||
operation: M5ModOperation.SET,
|
operation: M5ModOperation.SET,
|
||||||
value: value
|
value: value,
|
||||||
}]
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,37 +1,39 @@
|
||||||
import { M5Character } from "../actors/M5Character"
|
import { M5Character } from "../actors/M5Character";
|
||||||
import M5ModAggregate from "../actors/M5ModAggregate"
|
import M5ModAggregate from "../actors/M5ModAggregate";
|
||||||
import { enumKeys, M5Attributes, M5ModOperation, M5ModPair, M5ModType, M5RollData, M5RollResult, M5Stats } from "../M5Base"
|
import { enumKeys, M5Attributes, M5ModOperation, M5ModPair, M5ModType, M5RollData, M5RollResult, M5Stats } from "../M5Base";
|
||||||
import { M5Roll } from "../rolls/M5Roll"
|
import { M5Roll } from "../rolls/M5Roll";
|
||||||
|
|
||||||
export class M5Item extends Item {
|
export class M5Item extends Item {
|
||||||
static readonly SKILL = "skill"
|
static readonly SKILL = "skill";
|
||||||
|
|
||||||
prepareDerivedData() {
|
prepareDerivedData() {
|
||||||
const itemId: string = (this as any).id
|
const itemId: string = (this as any).id;
|
||||||
const itemType: string = (this as any).type
|
const itemType: string = (this as any).type;
|
||||||
const actor = (this.actor as any)
|
const actor = this.actor as any;
|
||||||
const character = actor as M5Character
|
const character = actor as M5Character;
|
||||||
const itemData = (this as any).system
|
const itemData = (this as any).system;
|
||||||
const calc = itemData.calc
|
const calc = itemData.calc;
|
||||||
|
|
||||||
if (itemType === "skill") {
|
if (itemType === "skill") {
|
||||||
calc.fw = itemData.fw
|
calc.fw = itemData.fw;
|
||||||
calc.bonus = 0
|
calc.bonus = 0;
|
||||||
|
|
||||||
let pairs: Array<M5ModPair> = [{
|
let pairs: Array<M5ModPair> = [
|
||||||
|
{
|
||||||
source: (this as any).name,
|
source: (this as any).name,
|
||||||
mod: {
|
mod: {
|
||||||
type: M5ModType.SKILL,
|
type: M5ModType.SKILL,
|
||||||
id: itemId,
|
id: itemId,
|
||||||
operation: M5ModOperation.SET,
|
operation: M5ModOperation.SET,
|
||||||
value: itemData.fw
|
value: itemData.fw,
|
||||||
}
|
},
|
||||||
}]
|
},
|
||||||
|
];
|
||||||
|
|
||||||
if (character) {
|
if (character) {
|
||||||
const actorCalc = character.derivedData({ skills: true, weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true })
|
const actorCalc = character.derivedData({ skills: true, weapons: true, defensiveWeapons: true, armor: true, items: true, spells: 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]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemData?.attribute && itemData.attribute !== "") {
|
if (itemData?.attribute && itemData.attribute !== "") {
|
||||||
|
|
@ -41,171 +43,165 @@ export class M5Item extends Item {
|
||||||
type: M5ModType.SKILL,
|
type: M5ModType.SKILL,
|
||||||
id: itemId,
|
id: itemId,
|
||||||
operation: M5ModOperation.ADD,
|
operation: M5ModOperation.ADD,
|
||||||
value: actorCalc.attributes[itemData.attribute].bonus
|
value: actorCalc.attributes[itemData.attribute].bonus,
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = M5ModAggregate.processPairs(pairs)
|
const res = M5ModAggregate.processPairs(pairs);
|
||||||
res.mods.forEach(mod => {
|
res.mods.forEach((mod) => {
|
||||||
if ([M5ModOperation.SET, M5ModOperation.FIXED].includes(mod.operation))
|
if ([M5ModOperation.SET, M5ModOperation.FIXED].includes(mod.operation)) calc.fw = mod.value;
|
||||||
calc.fw = mod.value
|
else calc.bonus += mod.value;
|
||||||
else
|
});
|
||||||
calc.bonus += mod.value
|
|
||||||
})
|
|
||||||
|
|
||||||
calc.ew = calc.fw + calc.bonus
|
calc.ew = calc.fw + calc.bonus;
|
||||||
calc.sources = res.mods
|
calc.sources = res.mods;
|
||||||
} else if (itemType === "weapon") {
|
} else if (itemType === "weapon") {
|
||||||
calc.fw = 0
|
calc.fw = 0;
|
||||||
calc.bonus = 0
|
calc.bonus = 0;
|
||||||
calc.special = itemData.special ? 2 : 0
|
calc.special = itemData.special ? 2 : 0;
|
||||||
calc.ew = calc.special + itemData.stats.attackBonus
|
calc.ew = calc.special + itemData.stats.attackBonus;
|
||||||
calc.combatSkills = null
|
calc.combatSkills = null;
|
||||||
|
|
||||||
if (actor) {
|
if (actor) {
|
||||||
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true })
|
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
skill.prepareDerivedData()
|
skill.prepareDerivedData();
|
||||||
const skillData = skill.system
|
const skillData = skill.system;
|
||||||
calc.ew += skillData.calc.ew
|
calc.ew += skillData.calc.ew;
|
||||||
calc.bonus += skillData.calc.bonus
|
calc.bonus += skillData.calc.bonus;
|
||||||
calc.fw += skillData.fw
|
calc.fw += skillData.fw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (itemType === "defensiveWeapon") {
|
} else if (itemType === "defensiveWeapon") {
|
||||||
calc.fw = 0
|
calc.fw = 0;
|
||||||
calc.bonus = 0
|
calc.bonus = 0;
|
||||||
calc.special = itemData.special ? 2 : 0
|
calc.special = itemData.special ? 2 : 0;
|
||||||
calc.ew = calc.special + itemData.stats.defenseBonus
|
calc.ew = calc.special + itemData.stats.defenseBonus;
|
||||||
calc.combatSkills = null
|
calc.combatSkills = null;
|
||||||
|
|
||||||
if (actor) {
|
if (actor) {
|
||||||
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true })
|
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
skill.prepareDerivedData()
|
skill.prepareDerivedData();
|
||||||
const skillData = skill.system
|
const skillData = skill.system;
|
||||||
calc.ew += skillData.calc.ew
|
calc.ew += skillData.calc.ew;
|
||||||
calc.bonus += skillData.calc.bonus
|
calc.bonus += skillData.calc.bonus;
|
||||||
calc.fw += skillData.fw
|
calc.fw += skillData.fw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (itemType === "spell") {
|
} else if (itemType === "spell") {
|
||||||
calc.ew = itemData.bonus
|
calc.fw = 0;
|
||||||
if (actor) {
|
if (actor) {
|
||||||
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true })
|
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true });
|
||||||
if (actorCalc) {
|
if (actorCalc) {
|
||||||
calc.ew += actorCalc.stats.spellCasting.value
|
calc.ew += actorCalc.stats.spellCasting.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (itemType === "item") {
|
} else if (itemType === "item") {
|
||||||
calc.mods = {}
|
calc.mods = {};
|
||||||
Object.keys(itemData?.mods).forEach(key => {
|
Object.keys(itemData?.mods).forEach((key) => {
|
||||||
const mod = itemData.mods[key]
|
const mod = itemData.mods[key];
|
||||||
const modCalc = {}
|
const modCalc = {};
|
||||||
switch (mod.type) {
|
switch (mod.type) {
|
||||||
case M5ModType.ATTRIBUTE: {
|
case M5ModType.ATTRIBUTE: {
|
||||||
for (const key of enumKeys(M5Attributes)) {
|
for (const key of enumKeys(M5Attributes)) {
|
||||||
const val: string = M5Attributes[key]
|
const val: string = M5Attributes[key];
|
||||||
modCalc[val] = (game as Game).i18n.localize(`midgard5.actor-${val}-long`)
|
modCalc[val] = (game as Game).i18n.localize(`midgard5.actor-${val}-long`);
|
||||||
}
|
}
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
case M5ModType.STAT: {
|
case M5ModType.STAT: {
|
||||||
for (const key of enumKeys(M5Stats)) {
|
for (const key of enumKeys(M5Stats)) {
|
||||||
const val: string = M5Stats[key]
|
const val: string = M5Stats[key];
|
||||||
modCalc[val] = (game as Game).i18n.localize(`midgard5.mod-stat-${val}`)
|
modCalc[val] = (game as Game).i18n.localize(`midgard5.mod-stat-${val}`);
|
||||||
}
|
}
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
case M5ModType.SKILL: {
|
case M5ModType.SKILL: {
|
||||||
if (character) {
|
if (character) {
|
||||||
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true })
|
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: 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) => {
|
||||||
const skill = character.getItem(skillId)
|
const skill = character.getItem(skillId);
|
||||||
if (skill)
|
if (skill) modCalc[skillId] = `${category}: ${skill.name}`;
|
||||||
modCalc[skillId] = `${category}: ${skill.name}`
|
});
|
||||||
})
|
|
||||||
|
|
||||||
category = (game as Game).i18n.localize("midgard5.language")
|
category = (game as Game).i18n.localize("midgard5.language");
|
||||||
Object.keys(actorCalc.skills.language).forEach(skillId => {
|
Object.keys(actorCalc.skills.language).forEach((skillId) => {
|
||||||
const skill = character.getItem(skillId)
|
const skill = character.getItem(skillId);
|
||||||
if (skill)
|
if (skill) modCalc[skillId] = `${category}: ${skill.name}`;
|
||||||
modCalc[skillId] = `${category}: ${skill.name}`
|
});
|
||||||
})
|
|
||||||
|
|
||||||
category = (game as Game).i18n.localize("midgard5.weapon-skill")
|
category = (game as Game).i18n.localize("midgard5.weapon-skill");
|
||||||
Object.keys(actorCalc.skills.combat).forEach(skillId => {
|
Object.keys(actorCalc.skills.combat).forEach((skillId) => {
|
||||||
const skill = character.getItem(skillId)
|
const skill = character.getItem(skillId);
|
||||||
if (skill)
|
if (skill) modCalc[skillId] = `${category}: ${skill.name}`;
|
||||||
modCalc[skillId] = `${category}: ${skill.name}`
|
});
|
||||||
})
|
|
||||||
|
|
||||||
category = (game as Game).i18n.localize("midgard5.innate-ability")
|
category = (game as Game).i18n.localize("midgard5.innate-ability");
|
||||||
Object.keys(actorCalc.skills.innate).forEach(skillId => {
|
Object.keys(actorCalc.skills.innate).forEach((skillId) => {
|
||||||
const skill = character.getItem(skillId)
|
const skill = character.getItem(skillId);
|
||||||
if (skill)
|
if (skill) modCalc[skillId] = `${category}: ${skill.name}`;
|
||||||
modCalc[skillId] = `${category}: ${skill.name}`
|
});
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
calc.mods[key] = modCalc
|
calc.mods[key] = modCalc;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getRollData() {
|
getRollData() {
|
||||||
const actor = this.actor as any
|
const actor = this.actor as any;
|
||||||
const item = this as any
|
const item = this as any;
|
||||||
|
|
||||||
let ret: M5RollData = actor?.getRollData() ?? {
|
let ret: M5RollData = actor?.getRollData() ?? {
|
||||||
c: null,
|
c: null,
|
||||||
i: null,
|
i: null,
|
||||||
iType: null,
|
iType: null,
|
||||||
rolls: {},
|
rolls: {},
|
||||||
res: {}
|
res: {},
|
||||||
}
|
};
|
||||||
|
|
||||||
ret.i = item.system
|
ret.i = item.system;
|
||||||
ret.iType = item.type
|
ret.iType = item.type;
|
||||||
return ret
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
async roll() {
|
async roll() {
|
||||||
const item = (this as any)
|
const item = this as any;
|
||||||
|
|
||||||
// Initialize chat data.
|
// Initialize chat data.
|
||||||
const speaker = ChatMessage.getSpeaker({ actor: this.actor })
|
const speaker = ChatMessage.getSpeaker({ actor: this.actor });
|
||||||
const rollMode = (game as Game).settings.get('core', 'rollMode')
|
const rollMode = (game as Game).settings.get("core", "rollMode");
|
||||||
const label = `[${item.type}] ${item.name}`
|
const label = `[${item.type}] ${item.name}`;
|
||||||
|
|
||||||
// If there's no roll data, send a chat message.
|
// If there's no roll data, send a chat message.
|
||||||
const formulaNames = item.system.rolls?.formulas ? Object.keys(item.system.rolls.formulas) : []
|
const formulaNames = item.system.rolls?.formulas ? Object.keys(item.system.rolls.formulas) : [];
|
||||||
if (formulaNames.length > 0) {
|
if (formulaNames.length > 0) {
|
||||||
const rollData = this.getRollData()
|
const rollData = this.getRollData();
|
||||||
formulaNames.forEach(formulaName => {
|
formulaNames.forEach((formulaName) => {
|
||||||
const formula = item.system.rolls.formulas[formulaName]
|
const formula = item.system.rolls.formulas[formulaName];
|
||||||
if (formula) {
|
if (formula) {
|
||||||
rollData.rolls[formulaName] = {
|
rollData.rolls[formulaName] = {
|
||||||
formula: formula.formula,
|
formula: formula.formula,
|
||||||
|
|
@ -214,26 +210,26 @@ export class M5Item extends Item {
|
||||||
result: "",
|
result: "",
|
||||||
total: 0,
|
total: 0,
|
||||||
totalStr: "",
|
totalStr: "",
|
||||||
dice: {}
|
dice: {},
|
||||||
} as M5RollResult
|
} as M5RollResult;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
const roll = new M5Roll(rollData, this.actor, item.name)
|
const roll = new M5Roll(rollData, this.actor, item.name);
|
||||||
return roll.toMessage()
|
return roll.toMessage();
|
||||||
} else {
|
} else {
|
||||||
ChatMessage.create({
|
ChatMessage.create({
|
||||||
speaker: speaker,
|
speaker: speaker,
|
||||||
rollMode: rollMode,
|
rollMode: rollMode,
|
||||||
flavor: label,
|
flavor: label,
|
||||||
content: item.system.description ?? ''
|
content: item.system.description ?? "",
|
||||||
})
|
});
|
||||||
return null
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getItem(itemId: string): any {
|
getItem(itemId: string): any {
|
||||||
return (this as any).getEmbeddedDocument("Item", itemId)
|
return (this as any).getEmbeddedDocument("Item", itemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// migrateSystemData(): any {
|
// migrateSystemData(): any {
|
||||||
|
|
@ -248,5 +244,4 @@ export class M5Item extends Item {
|
||||||
|
|
||||||
// return super.migrateSystemData()
|
// return super.migrateSystemData()
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,18 @@
|
||||||
import Logger from "../../utils/Logger"
|
import Logger from "../../utils/Logger";
|
||||||
import { M5Character } from "../actors/M5Character"
|
import { M5Character } from "../actors/M5Character";
|
||||||
import { M5Item } from "../items/M5Item"
|
import { M5Item } from "../items/M5Item";
|
||||||
import { M5SkillLearned, M5SkillUnlearned } from "../M5Base"
|
import { M5SkillLearned, M5SkillUnlearned } from "../M5Base";
|
||||||
import { M5Roll } from "../rolls/M5Roll"
|
import { M5Roll } from "../rolls/M5Roll";
|
||||||
|
|
||||||
export default class M5CharacterSheet extends ActorSheet {
|
export default class M5CharacterSheet extends ActorSheet {
|
||||||
|
|
||||||
static get defaultOptions() {
|
static get defaultOptions() {
|
||||||
return mergeObject(super.defaultOptions, {
|
return mergeObject(super.defaultOptions, {
|
||||||
template: "systems/midgard5/templates/sheets/character/main.hbs",
|
template: "systems/midgard5/templates/sheets/character/main.hbs",
|
||||||
width: 800,
|
width: 800,
|
||||||
height: 800,
|
height: 800,
|
||||||
classes: ["midgard5", "sheet", "character"],
|
classes: ["midgard5", "sheet", "character"],
|
||||||
tabs: [{ navSelector: ".sheet-navigation", contentSelector: ".sheet-content", initial: "base_values" }]
|
tabs: [{ navSelector: ".sheet-navigation", contentSelector: ".sheet-content", initial: "base_values" }],
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// get template() {
|
// get template() {
|
||||||
|
|
@ -21,155 +20,152 @@ export default class M5CharacterSheet extends ActorSheet {
|
||||||
// }Options extends ActorSheet.Options = ActorSheet.Options, Data extends object = ActorSheet.Data<Options>
|
// }Options extends ActorSheet.Options = ActorSheet.Options, Data extends object = ActorSheet.Data<Options>
|
||||||
|
|
||||||
override getData(options?: Partial<ActorSheet.Options>): ActorSheet.Data<ActorSheet.Options> | Promise<ActorSheet.Data<ActorSheet.Options>> {
|
override getData(options?: Partial<ActorSheet.Options>): ActorSheet.Data<ActorSheet.Options> | Promise<ActorSheet.Data<ActorSheet.Options>> {
|
||||||
const actor = this.actor as M5Character
|
const actor = this.actor as M5Character;
|
||||||
//console.log("Sheet getData", (actor as any).data)
|
//console.log("Sheet getData", (actor as any).data)
|
||||||
return Promise.resolve(super.getData(options)).then(context => {
|
return Promise.resolve(super.getData(options)).then((context) => {
|
||||||
actor.prepareDerivedData()
|
actor.prepareDerivedData();
|
||||||
|
|
||||||
context.actor = (actor as any).toObject(false)
|
context.actor = (actor as any).toObject(false);
|
||||||
context.data = (actor as any).system
|
context.data = (actor as any).system;
|
||||||
|
|
||||||
//console.log("Sheet Promise", context.actor, context.data)
|
//console.log("Sheet Promise", context.actor, context.data)
|
||||||
return context
|
return context;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
override setPosition(options = {}) {
|
override setPosition(options = {}) {
|
||||||
const position = super.setPosition(options)
|
const position = super.setPosition(options);
|
||||||
const fillerWidth = this.element.find(".attributes .filler:first").width()
|
const fillerWidth = this.element.find(".attributes .filler:first").width();
|
||||||
this.element.find(".attributes .attribute-filler-fixed").width(fillerWidth)
|
this.element.find(".attributes .attribute-filler-fixed").width(fillerWidth);
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
override activateListeners(html: JQuery) {
|
override activateListeners(html: JQuery) {
|
||||||
super.activateListeners(html)
|
super.activateListeners(html);
|
||||||
|
|
||||||
html.find(".update-lp").on("click", async (event) => {
|
html.find(".update-lp").on("click", async (event) => {
|
||||||
const valueStr = event.target.dataset["value"]
|
const valueStr = event.target.dataset["value"];
|
||||||
const value = parseInt(valueStr)
|
const value = parseInt(valueStr);
|
||||||
this.actor.update({
|
this.actor.update({
|
||||||
data: {
|
data: {
|
||||||
lp: {
|
lp: {
|
||||||
value: value + 1
|
value: value + 1,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
html.find(".update-ap").on("click", async (event) => {
|
html.find(".update-ap").on("click", async (event) => {
|
||||||
const valueStr = event.target.dataset["value"]
|
const valueStr = event.target.dataset["value"];
|
||||||
const value = parseInt(valueStr)
|
const value = parseInt(valueStr);
|
||||||
this.actor.update({
|
this.actor.update({
|
||||||
data: {
|
data: {
|
||||||
ap: {
|
ap: {
|
||||||
value: value + 1
|
value: value + 1,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
html.find(".roll-attribute-button").on("click", async (event) => {
|
html.find(".roll-attribute-button").on("click", async (event) => {
|
||||||
let elem = event.target
|
let elem = event.target;
|
||||||
let attributeStr = elem.dataset["attribute"]
|
let attributeStr = elem.dataset["attribute"];
|
||||||
while (!attributeStr) {
|
while (!attributeStr) {
|
||||||
elem = elem.parentElement
|
elem = elem.parentElement;
|
||||||
if (!elem)
|
if (!elem) return;
|
||||||
return
|
attributeStr = elem.dataset["attribute"];
|
||||||
attributeStr = elem.dataset["attribute"]
|
|
||||||
}
|
}
|
||||||
const attributeValue = parseInt(elem.dataset["value"])
|
const attributeValue = parseInt(elem.dataset["value"]);
|
||||||
|
|
||||||
const roll = M5Roll.fromAttributeValue(this.actor, attributeStr, attributeValue)
|
const roll = M5Roll.fromAttributeValue(this.actor, attributeStr, attributeValue);
|
||||||
//console.log("roll-attribute-button", parent, attributeStr, attributeValue, roll)
|
//console.log("roll-attribute-button", parent, attributeStr, attributeValue, roll)
|
||||||
await roll.toMessage()
|
await roll.toMessage();
|
||||||
})
|
});
|
||||||
|
|
||||||
html.find(".edit-item").on("click", async (event) => {
|
html.find(".edit-item").on("click", async (event) => {
|
||||||
let row = event.target.parentElement
|
let row = event.target.parentElement;
|
||||||
let itemId = row.dataset["item"]
|
let itemId = row.dataset["item"];
|
||||||
while (!itemId) {
|
while (!itemId) {
|
||||||
row = row.parentElement
|
row = row.parentElement;
|
||||||
if (!row)
|
if (!row) return;
|
||||||
return
|
itemId = row.dataset["item"];
|
||||||
itemId = row.dataset["item"]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const context = this.actor as any
|
const context = this.actor as any;
|
||||||
const item = context.items.get(itemId)
|
const item = context.items.get(itemId);
|
||||||
console.log("edit-item", item)
|
console.log("edit-item", item);
|
||||||
item.sheet.render(true)
|
item.sheet.render(true);
|
||||||
})
|
});
|
||||||
|
|
||||||
html.find(".item-delete").on("click", async (event) => {
|
html.find(".item-delete").on("click", async (event) => {
|
||||||
let row = event.target.parentElement
|
let row = event.target.parentElement;
|
||||||
let itemId = row.dataset["item"]
|
let itemId = row.dataset["item"];
|
||||||
while (!itemId) {
|
while (!itemId) {
|
||||||
row = row.parentElement
|
row = row.parentElement;
|
||||||
if (!row)
|
if (!row) return;
|
||||||
return
|
itemId = row.dataset["item"];
|
||||||
itemId = row.dataset["item"]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const context = this.actor as any
|
const context = this.actor as any;
|
||||||
const item = context.items.get(itemId)
|
const item = context.items.get(itemId);
|
||||||
item.delete()
|
item.delete();
|
||||||
this.render(false)
|
this.render(false);
|
||||||
})
|
});
|
||||||
|
|
||||||
html.find(".roll-learned-button").on("click", async (event) => {
|
html.find(".roll-learned-button").on("click", async (event) => {
|
||||||
const row = event.target.parentElement.parentElement
|
const row = event.target.parentElement.parentElement;
|
||||||
let skillId = row.dataset["item"]
|
let skillId = row.dataset["item"];
|
||||||
|
|
||||||
const actor = this.actor as any
|
const actor = this.actor as any;
|
||||||
const item = actor.items.get(skillId) as M5Item
|
const item = actor.items.get(skillId) as M5Item;
|
||||||
await item.roll()
|
await item.roll();
|
||||||
})
|
});
|
||||||
|
|
||||||
html.find(".roll-general-button").on("click", async (event) => {
|
html.find(".roll-general-button").on("click", async (event) => {
|
||||||
const row = event.target.parentElement.parentElement
|
const row = event.target.parentElement.parentElement;
|
||||||
let skillName = row.dataset["skill"]
|
let skillName = row.dataset["skill"];
|
||||||
|
|
||||||
const data = this.actor.system
|
const data = this.actor.system;
|
||||||
const unlearnedSkill = data.skills.general[skillName] as M5SkillUnlearned
|
const unlearnedSkill = data.skills.general[skillName] as M5SkillUnlearned;
|
||||||
|
|
||||||
const roll = M5Roll.fromUnlearnedSkill(this.actor, unlearnedSkill, skillName)
|
const roll = M5Roll.fromUnlearnedSkill(this.actor, unlearnedSkill, skillName);
|
||||||
await roll.toMessage()
|
await roll.toMessage();
|
||||||
})
|
});
|
||||||
|
|
||||||
html.find(".learn-button").on("click", async (event) => {
|
html.find(".learn-button").on("click", async (event) => {
|
||||||
const row = event.target.parentElement.parentElement
|
const row = event.target.parentElement.parentElement;
|
||||||
let skillName = row.dataset["skill"]
|
let skillName = row.dataset["skill"];
|
||||||
|
|
||||||
const data = this.actor.system
|
const data = this.actor.system;
|
||||||
const unlearnedSkill = data.skills.general[skillName] as M5SkillUnlearned
|
const unlearnedSkill = data.skills.general[skillName] as M5SkillUnlearned;
|
||||||
|
|
||||||
const character = this.actor as M5Character
|
const character = this.actor as M5Character;
|
||||||
character.createSkill((game as Game).i18n.localize("midgard5." + skillName)).then(skill => {
|
character.createSkill((game as Game).i18n.localize("midgard5." + skillName)).then((skill) => {
|
||||||
const item = skill as any
|
const item = skill as any;
|
||||||
item.update({
|
item.update({
|
||||||
data: {
|
data: {
|
||||||
fw: unlearnedSkill.initial,
|
fw: unlearnedSkill.initial,
|
||||||
attribute: unlearnedSkill.attribute,
|
attribute: unlearnedSkill.attribute,
|
||||||
skill: skillName,
|
skill: skillName,
|
||||||
type: "general"
|
type: "general",
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
html.find(".roll-weapon-button").on("click", async (event) => {
|
html.find(".roll-weapon-button").on("click", async (event) => {
|
||||||
const row = event.target.parentElement.parentElement
|
const row = event.target.parentElement.parentElement;
|
||||||
let itemId = row.dataset["item"]
|
let itemId = row.dataset["item"];
|
||||||
|
|
||||||
const context = this.actor as any
|
const context = this.actor as any;
|
||||||
const item = context.items.get(itemId) as M5Item
|
const item = context.items.get(itemId) as M5Item;
|
||||||
await item.roll()
|
await item.roll();
|
||||||
})
|
});
|
||||||
|
|
||||||
html.find(".roll-brawl-button").on("click", async (event) => {
|
html.find(".roll-brawl-button").on("click", async (event) => {
|
||||||
const roll = M5Roll.brawl(this.actor)
|
const roll = M5Roll.brawl(this.actor);
|
||||||
await roll.toMessage()
|
await roll.toMessage();
|
||||||
})
|
});
|
||||||
|
|
||||||
// Drag & Drop
|
// Drag & Drop
|
||||||
const dragDrop = new DragDrop({
|
const dragDrop = new DragDrop({
|
||||||
|
|
@ -177,8 +173,8 @@ export default class M5CharacterSheet extends ActorSheet {
|
||||||
dropSelector: ".sheet-body",
|
dropSelector: ".sheet-body",
|
||||||
permissions: { dragstart: this._canDragStart.bind(this), drop: this._canDragDrop.bind(this) },
|
permissions: { dragstart: this._canDragStart.bind(this), drop: this._canDragDrop.bind(this) },
|
||||||
callbacks: { dragstart: this._onTransferItemDragStart.bind(this), drop: this._onTransferItemDrop.bind(this) },
|
callbacks: { dragstart: this._onTransferItemDragStart.bind(this), drop: this._onTransferItemDrop.bind(this) },
|
||||||
})
|
});
|
||||||
dragDrop.bind(html[0])
|
dragDrop.bind(html[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_canDragStart(selector) {
|
_canDragStart(selector) {
|
||||||
|
|
@ -190,9 +186,9 @@ export default class M5CharacterSheet extends ActorSheet {
|
||||||
}
|
}
|
||||||
|
|
||||||
_onTransferItemDragStart(event) {
|
_onTransferItemDragStart(event) {
|
||||||
const li = event.currentTarget
|
const li = event.currentTarget;
|
||||||
$(event.currentTarget).attr("data-item-actorid", this.actor.id)
|
$(event.currentTarget).attr("data-item-actorid", this.actor.id);
|
||||||
const item = this.actor.items.get(li.dataset.itemId)
|
const item = this.actor.items.get(li.dataset.itemId);
|
||||||
|
|
||||||
// limit transfer on personal weapons/armour/gear
|
// limit transfer on personal weapons/armour/gear
|
||||||
if (["skill", "item", "weapon", "defensiveWeapon", "armor", "spell"].includes(item.type)) {
|
if (["skill", "item", "weapon", "defensiveWeapon", "armor", "spell"].includes(item.type)) {
|
||||||
|
|
@ -200,45 +196,40 @@ export default class M5CharacterSheet extends ActorSheet {
|
||||||
type: "Transfer",
|
type: "Transfer",
|
||||||
actorId: this.actor.id,
|
actorId: this.actor.id,
|
||||||
data: item.toObject(false),
|
data: item.toObject(false),
|
||||||
tokenId: null
|
tokenId: null,
|
||||||
}
|
};
|
||||||
|
|
||||||
if (this.actor.isToken)
|
if (this.actor.isToken) dragData.tokenId = this.actor.token.id;
|
||||||
dragData.tokenId = this.actor.token.id
|
|
||||||
|
|
||||||
event.dataTransfer.setData("text/plain", JSON.stringify(dragData))
|
event.dataTransfer.setData("text/plain", JSON.stringify(dragData));
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async _onTransferItemDrop(event) {
|
async _onTransferItemDrop(event) {
|
||||||
// Try to extract the data
|
// Try to extract the data
|
||||||
let data = null
|
let data = null;
|
||||||
try {
|
try {
|
||||||
data = JSON.parse(event.dataTransfer.getData("text/plain"))
|
data = JSON.parse(event.dataTransfer.getData("text/plain"));
|
||||||
if (data.type !== "Transfer")
|
if (data.type !== "Transfer") return false;
|
||||||
return false
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data.data)
|
if (!data.data) return false;
|
||||||
return false
|
|
||||||
|
|
||||||
if (data.actorId === this.actor.id)
|
if (data.actorId === this.actor.id) return false;
|
||||||
return false
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.actor.createEmbeddedDocuments("Item", [duplicate(data.data)]) // Create a new Item
|
this.actor.createEmbeddedDocuments("Item", [duplicate(data.data)]); // Create a new Item
|
||||||
const actor = (game as any).actors.get(data.actorId)
|
const actor = (game as any).actors.get(data.actorId);
|
||||||
await actor.items.get(data.data._id)?.delete() // Delete originating item from other actor
|
await actor.items.get(data.data._id)?.delete(); // Delete originating item from other actor
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Error transfering item between actors", e)
|
console.error("Error transfering item between actors", e);
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,12 @@
|
||||||
"id": "midgard5",
|
"id": "midgard5",
|
||||||
"title": "Midgard 5. Edition",
|
"title": "Midgard 5. Edition",
|
||||||
"description": "The German RPG Midgard 5. Edition",
|
"description": "The German RPG Midgard 5. Edition",
|
||||||
"version": "1.1.0",
|
"version": "1.2.0",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "10",
|
"minimum": "10",
|
||||||
"verified": "10"
|
"verified": "10"
|
||||||
},
|
},
|
||||||
"authors": [
|
"authors": [{ "name": "Byroks" }],
|
||||||
{ "name": "Michael Stein" }
|
|
||||||
],
|
|
||||||
"scripts": ["bundle.js"],
|
"scripts": ["bundle.js"],
|
||||||
"styles": ["bundle.css"],
|
"styles": ["bundle.css"],
|
||||||
"packs": [
|
"packs": [
|
||||||
|
|
@ -67,9 +65,9 @@
|
||||||
"gridUnits": "m",
|
"gridUnits": "m",
|
||||||
"primaryTokenAttribute": "lp",
|
"primaryTokenAttribute": "lp",
|
||||||
"secondaryTokenAttribute": "ap",
|
"secondaryTokenAttribute": "ap",
|
||||||
"url": "https://github.com/michaelstein/foundry-vtt-system-midgard5",
|
"url": "https://github.com/Byroks/foundry-vtt-system-midgard5",
|
||||||
"manifest": "https://github.com/michaelstein/foundry-vtt-system-midgard5/releases/download/v1.1.0/system.json",
|
"manifest": "https://github.com/Byroks/foundry-vtt-system-midgard5/releases/download/v1.2.0/system.json",
|
||||||
"download": "https://github.com/michaelstein/foundry-vtt-system-midgard5/releases/download/v1.1.0/midgard5-v1.1.0.zip",
|
"download": "https://github.com/Byroks/foundry-vtt-system-midgard5/releases/download/v1.2.0/midgard5-v1.2.0.zip",
|
||||||
"initiative": "@calc.attributes.gw.value",
|
"initiative": "@calc.attributes.gw.value",
|
||||||
"license": "LICENSE.txt"
|
"license": "LICENSE.txt"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,10 @@
|
||||||
<td>{{localize "midgard5.exp-available"}}</td>
|
<td>{{localize "midgard5.exp-available"}}</td>
|
||||||
<td><input name="data.ep" type="text" value="{{data.ep}}" data-dtype="Number" /></td>
|
<td><input name="data.ep" type="text" value="{{data.ep}}" data-dtype="Number" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{localize "midgard5.luckPoints"}}</td>
|
||||||
|
<td><input name="data.gp" type="text" value="{{data.gp}}" data-dtype="Number" /></td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,29 +9,23 @@
|
||||||
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
||||||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||||
/* Language and Environment */
|
/* Language and Environment */
|
||||||
"target": "ES2017", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
"target": "ES2017" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
||||||
"lib": [
|
"lib": ["DOM", "ES6", "ES2017"] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
|
||||||
"DOM",
|
|
||||||
"ES6",
|
|
||||||
"ES2017"
|
|
||||||
], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
||||||
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
||||||
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
||||||
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
||||||
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
||||||
/* Modules */
|
/* Modules */
|
||||||
"module": "commonjs", /* Specify what module code is generated. */
|
"module": "commonjs" /* Specify what module code is generated. */,
|
||||||
"rootDir": "./source", /* Specify the root folder within your source files. */
|
"rootDir": "./source" /* Specify the root folder within your source files. */,
|
||||||
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
"moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
|
||||||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||||
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||||
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
||||||
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
|
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
|
||||||
"types": [
|
"types": ["@league-of-foundry-developers/foundry-vtt-types"] /* Specify type package names to be included without being referenced in a source file. */,
|
||||||
"@league-of-foundry-developers/foundry-vtt-types"
|
|
||||||
], /* Specify type package names to be included without being referenced in a source file. */
|
|
||||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||||
"resolveJsonModule": true, /* Enable importing .json files */
|
"resolveJsonModule": true /* Enable importing .json files */,
|
||||||
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
|
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
|
||||||
/* JavaScript Support */
|
/* JavaScript Support */
|
||||||
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
|
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
|
||||||
|
|
@ -45,7 +39,7 @@
|
||||||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
|
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
|
||||||
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
||||||
// "removeComments": true, /* Disable emitting comments. */
|
// "removeComments": true, /* Disable emitting comments. */
|
||||||
"noEmit": true, /* Disable emitting files from a compilation. */
|
"noEmit": true /* Disable emitting files from a compilation. */,
|
||||||
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
||||||
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
|
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
|
||||||
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
||||||
|
|
@ -63,7 +57,7 @@
|
||||||
/* Interop Constraints */
|
/* Interop Constraints */
|
||||||
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
||||||
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
||||||
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
|
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */,
|
||||||
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
||||||
//"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
//"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
||||||
/* Type Checking */
|
/* Type Checking */
|
||||||
|
|
@ -93,7 +87,5 @@
|
||||||
//"include": [
|
//"include": [
|
||||||
// "./Source/**/*.ts"
|
// "./Source/**/*.ts"
|
||||||
//]
|
//]
|
||||||
"exclude": [
|
"exclude": ["gulpfile.ts"]
|
||||||
"gulpfile.ts"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue