Fixes skill calculation.
This commit is contained in:
parent
b104480a48
commit
0ac8107772
|
|
@ -123,7 +123,7 @@ export class M5Character extends Actor {
|
||||||
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?.filter(item => item.type === "item").forEach(item => {
|
||||||
|
|
@ -136,9 +136,10 @@ export class M5Character extends Actor {
|
||||||
})
|
})
|
||||||
|
|
||||||
ret.skillMods = aggregate.calculate()
|
ret.skillMods = aggregate.calculate()
|
||||||
|
// TODO apply attribute and stat calculation to ret.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skip.items) {
|
if (!skip?.items) {
|
||||||
context.items?.filter(item => item.type === "item").forEach(item => {
|
context.items?.filter(item => item.type === "item").forEach(item => {
|
||||||
item.prepareDerivedData()
|
item.prepareDerivedData()
|
||||||
|
|
||||||
|
|
@ -155,7 +156,7 @@ export class M5Character extends Actor {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skip.skills) {
|
if (!skip?.skills) {
|
||||||
context.items?.filter(item => item.type === "skill").forEach(item => {
|
context.items?.filter(item => item.type === "skill").forEach(item => {
|
||||||
item.prepareDerivedData()
|
item.prepareDerivedData()
|
||||||
const skillMap = ret.skills[item.system.type]
|
const skillMap = ret.skills[item.system.type]
|
||||||
|
|
@ -168,7 +169,7 @@ export class M5Character extends Actor {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skip.weapons) {
|
if (!skip?.weapons) {
|
||||||
context.items?.filter(item => item.type === "weapon").forEach(item => {
|
context.items?.filter(item => item.type === "weapon").forEach(item => {
|
||||||
item.prepareDerivedData()
|
item.prepareDerivedData()
|
||||||
|
|
||||||
|
|
@ -190,7 +191,7 @@ export class M5Character extends Actor {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skip.defensiveWeapons) {
|
if (!skip?.defensiveWeapons) {
|
||||||
context.items?.filter(item => item.type === "defensiveWeapon").forEach(item => {
|
context.items?.filter(item => item.type === "defensiveWeapon").forEach(item => {
|
||||||
item.prepareDerivedData()
|
item.prepareDerivedData()
|
||||||
|
|
||||||
|
|
@ -210,7 +211,7 @@ export class M5Character extends Actor {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skip.armor) {
|
if (!skip?.armor) {
|
||||||
context.items?.filter(item => item.type === "armor").forEach(item => {
|
context.items?.filter(item => item.type === "armor").forEach(item => {
|
||||||
item.prepareDerivedData()
|
item.prepareDerivedData()
|
||||||
|
|
||||||
|
|
@ -227,7 +228,7 @@ export class M5Character extends Actor {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skip.spells) {
|
if (!skip?.spells) {
|
||||||
context.items?.filter(item => item.type === "spell").forEach(item => {
|
context.items?.filter(item => item.type === "spell").forEach(item => {
|
||||||
item.prepareDerivedData()
|
item.prepareDerivedData()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,18 +32,18 @@ export class M5Item extends Item {
|
||||||
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 !== "") {
|
||||||
pairs.push({
|
pairs.push({
|
||||||
source: (this as any).name,
|
source: (this as any).name,
|
||||||
mod: {
|
mod: {
|
||||||
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
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,9 @@ export class M5ItemSheet extends ItemSheet {
|
||||||
let actor = this.object?.parent ?? null
|
let actor = this.object?.parent ?? null
|
||||||
if (actor) {
|
if (actor) {
|
||||||
context.rollData = actor.getRollData()
|
context.rollData = actor.getRollData()
|
||||||
} else {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the actor's data to context.data for easier access, as well as flags.
|
context.data = itemData.system
|
||||||
context.system = itemData.system
|
|
||||||
context.flags = itemData.flags
|
context.flags = itemData.flags
|
||||||
|
|
||||||
return context
|
return context
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue