Adds item-sheet CSS class to item sheets.
This commit is contained in:
Michael Stein
2023-04-19 01:33:04 +02:00
parent f91c64f91f
commit ae3381b3d1
13 changed files with 41 additions and 25 deletions
+1
View File
@@ -3,6 +3,7 @@ import { BooleanField } from "@league-of-foundry-developers/foundry-vtt-types/sr
export interface M5Skill {
fw: number
attribute: string
pp: number
}
export interface M5SkillUnlearned extends M5Skill {
+5 -5
View File
@@ -122,7 +122,7 @@ export class M5Character extends Actor {
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.enduranceBonus = Math.floor(ret.attributes.ko.value/10) + Math.floor(ret.attributes.st.value/20)
if (!skip?.mods) {
const aggregate = new M5ModAggregate(data, ret)
@@ -136,7 +136,6 @@ export class M5Character extends Actor {
})
ret.skillMods = aggregate.calculate()
// TODO apply attribute and stat calculation to ret.
}
if (!skip?.items) {
@@ -164,6 +163,7 @@ export class M5Character extends Actor {
label: item.name,
fw: item.system.fw,
attribute: item.system.attribute,
pp: item.system.pp,
calc: item.system.calc
} as M5SkillCalculated
})
@@ -244,6 +244,7 @@ export class M5Character extends Actor {
}
prepareDerivedData() {
console.log("M5Character", "prepareDerivedData")
const data = (this as any).system
data.calc = this.derivedData({})
}
@@ -295,9 +296,8 @@ export class M5Character extends Actor {
}
skillBonus(skill: M5Skill, skillName?: string) {
const attribute = this.attribute(skill.attribute)
let ret = attribute ? M5Character.attributeBonus(attribute) : 0
return ret
const data = (this as any).system
return data.calc?.attributes[skill.attribute]?.bonus ?? 0
}
skillEw(skill: M5Skill, skillName?: string) {
+10 -10
View File
@@ -236,17 +236,17 @@ export class M5Item extends Item {
return (this as any).getEmbeddedDocument("Item", itemId)
}
override migrateSystemData(): any {
const item = (this as any)
const data = item.system
// migrateSystemData(): any {
// const item = (this as any)
// const data = item.system
if (item.type === "spell") {
if (typeof data.ap !== "string") {
data.ap = Number.isFinite(data.ap) ? "" + data.ap : ""
}
}
// if (item.type === "spell") {
// if (typeof data.ap !== "string") {
// data.ap = Number.isFinite(data.ap) ? "" + data.ap : ""
// }
// }
return super.migrateSystemData()
}
// return super.migrateSystemData()
// }
}
+2 -2
View File
@@ -5,8 +5,8 @@ export class M5ItemSheet extends ItemSheet {
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
width: 420,
height: 240,
width: 640,
height: 480,
classes: ["midgard5", "sheet", "item"]
})
}