Enhance march

This commit is contained in:
2023-03-14 19:23:19 +01:00
parent b23d0836fe
commit 3489dc6254
10 changed files with 158 additions and 91 deletions

View File

@@ -91,7 +91,7 @@ export class Hero6Actor extends Actor {
/* -------------------------------------------- */
getMoneys() {
let comp = this.items.filter(item => item.type == 'money');
let comp = this.items.filter(item => item.type == 'currency');
Hero6Utility.sortArrayObjectsByName(comp)
return comp;
}
@@ -163,10 +163,52 @@ export class Hero6Actor extends Actor {
}
return item;
}
/* -------------------------------------------- */
prepareSkill(skill) {
skill.roll = 0
skill.charac = "N/A"
if (skill.system.skillfamiliarity) {
skill.roll = 8;
} else if (skill.system.skillprofiency) {
skill.roll = 10;
} else if (skill.system.skilltype == "agility") {
skill.charac = "DEX"
let charac = duplicate(this.system.characteristics.dex)
this.prepareCharacValues(charac)
skill.roll = charac.roll
} else if (skill.system.skilltype == "interaction") {
skill.charac = "PRE"
let charac = duplicate(this.system.characteristics.pre)
this.prepareCharacValues(charac)
skill.roll = charac.roll
} else if (skill.system.skilltype == "intellect") {
skill.charac = "INT"
let charac = duplicate(this.system.characteristics.int)
this.prepareCharacValues(charac)
skill.roll = charac.roll
} else if (skill.system.skilltype == "background") {
skill.roll = 11
} else if (skill.system.skilltype == "custom") {
if (skill.system.characteristic == "manual") {
skill.roll = skill.system.base
} else {
skill.charac = skill.system.characteristic
let charac = duplicate(this.system.characteristics[skill.system.characteristic])
this.prepareCharacValues(charac)
skill.roll = charac.roll
}
}
if (skill.system.levels > 0) {
skill.roll += skill.system.levels
}
}
/* -------------------------------------------- */
getSkills() {
let comp = duplicate(this.items.filter(item => item.type == 'skill') || [])
for (let skill of comp) {
this.prepareSkill(skill)
}
Hero6Utility.sortArrayObjectsByName(comp)
return comp
}
@@ -177,8 +219,8 @@ export class Hero6Actor extends Actor {
}
async getPowers() {
let comp = duplicate(this.items.filter(item => item.type == 'power') || [])
for(let c of comp) {
c.enrichDescription = c.name + "<br>" + await TextEditor.enrichHTML(c.system.description, {async: true})
for (let c of comp) {
c.enrichDescription = c.name + "<br>" + await TextEditor.enrichHTML(c.system.description, { async: true })
}
Hero6Utility.sortArrayObjectsByName(comp)
return comp
@@ -192,7 +234,7 @@ export class Hero6Actor extends Actor {
let comp = duplicate(this.items.filter(item => item.type == 'martialart') || [])
Hero6Utility.sortArrayObjectsByName(comp)
return comp
}
}
getComplications() {
let comp = duplicate(this.items.filter(item => item.type == 'complication') || [])
Hero6Utility.sortArrayObjectsByName(comp)
@@ -296,7 +338,7 @@ export class Hero6Actor extends Actor {
/* -------------------------------------------- */
async incDecHP(formula) {
let dmgRoll = new Roll(formula+"[dark-starsorange]").roll({ async: false })
let dmgRoll = new Roll(formula + "[dark-starsorange]").roll({ async: false })
await Hero6Utility.showDiceSoNice(dmgRoll, game.settings.get("core", "rollMode"))
let hp = duplicate(this.system.secondary.hp)
hp.value = Number(hp.value) + Number(dmgRoll.total)
@@ -377,14 +419,14 @@ export class Hero6Actor extends Actor {
}
/* -------------------------------------------- */
prepareCharacValues( charac) {
prepareCharacValues(charac) {
charac.total = charac.value
charac.roll = 9 + Math.floor((charac.value)/5)
charac.roll = 9 + Math.floor((charac.value) / 5)
}
prepareCharac() {
let characs = duplicate(this.system.characteristics)
for(let key in characs) {
this.prepareCharacValues( characs[key])
for (let key in characs) {
this.prepareCharacValues(characs[key])
}
return characs
}
@@ -483,10 +525,13 @@ export class Hero6Actor extends Actor {
}
/* -------------------------------------------- */
rollItem(itemId) {
let item = this.items.get( itemId)
let item = this.items.get(itemId)
let rollData = this.getCommonRollData()
rollData.mode = "item"
rollData.item = duplicate(item)
if ( item.type == "skill") {
this.prepareSkill(rollData.item)
}
this.startRoll(rollData)
}