All fixes requested
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
/* -------------------------------------------- */
|
||||
import { Hero6Utility } from "./hero6-utility.js";
|
||||
import { Hero6RollDialog } from "./hero6-roll-dialog.js";
|
||||
import { Hero6LiftDice } from "./hero6-lift-dice.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
const __speed2Segments = [[0], [7], [6, 12], [4, 8, 12], [3, 6, 9, 12], [3, 5, 8, 10, 12], [2, 4, 6, 8, 10, 12]
|
||||
[2, 4, 6, 7, 9, 11, 12], [2, 3, 5, 6, 8, 9, 11, 12], [2, 3, 4, 6, 7, 8, 10, 11, 12], [2, 3, 4, 5, 6, 8, 9, 10, 11, 12],
|
||||
[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]
|
||||
[2, 4, 6, 7, 9, 11, 12], [2, 3, 5, 6, 8, 9, 11, 12], [2, 3, 4, 6, 7, 8, 10, 11, 12], [2, 3, 4, 5, 6, 8, 9, 10, 11, 12],
|
||||
[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* -------------------------------------------- */
|
||||
@@ -65,7 +66,8 @@ export class Hero6Actor extends Actor {
|
||||
}
|
||||
computeDicesValue() {
|
||||
this.system.biodata.presenceattack = Hero6Utility.getDerivatedDiceFormulas(this.system.characteristics.pre.value)
|
||||
this.system.characteristics.str.strdice = Hero6Utility.getDerivatedDiceFormulas(this.system.characteristics.str.value)
|
||||
this.system.characteristics.str.strdice = Hero6LiftDice.getLiftDice(this.system.characteristics.str.value)
|
||||
this.system.characteristics.str.lift = Hero6LiftDice.getLift(this.system.characteristics.str.value)
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
prepareDerivedData() {
|
||||
@@ -169,22 +171,23 @@ export class Hero6Actor extends Actor {
|
||||
prepareSkill(skill) {
|
||||
skill.roll = 0
|
||||
skill.charac = "N/A"
|
||||
skill.system.skilltype = skill.system.skilltype.toLowerCase()
|
||||
if (skill.system.skillfamiliarity) {
|
||||
skill.roll = 8;
|
||||
} else if (skill.system.skillprofiency) {
|
||||
skill.roll = 10;
|
||||
} else if (skill.system.skilltype == "agility") {
|
||||
skill.charac = "DEX"
|
||||
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"
|
||||
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"
|
||||
skill.charac = "int"
|
||||
let charac = duplicate(this.system.characteristics.int)
|
||||
this.prepareCharacValues(charac)
|
||||
skill.roll = charac.roll
|
||||
@@ -194,12 +197,13 @@ export class Hero6Actor extends Actor {
|
||||
if (skill.system.characteristic == "manual") {
|
||||
skill.roll = skill.system.base
|
||||
} else {
|
||||
skill.charac = skill.system.characteristic
|
||||
skill.charac = (skill.system.characteristic == "") ? "str" : skill.system.characteristic
|
||||
let charac = duplicate(this.system.characteristics[skill.system.characteristic])
|
||||
this.prepareCharacValues(charac)
|
||||
skill.roll = charac.roll
|
||||
}
|
||||
}
|
||||
console.log("SILL", skill)
|
||||
if (skill.system.levels > 0) {
|
||||
skill.roll += skill.system.levels
|
||||
}
|
||||
@@ -223,6 +227,7 @@ export class Hero6Actor extends Actor {
|
||||
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 })
|
||||
c.enrichNotes = c.name + "<br>" + await TextEditor.enrichHTML(c.system.notes, { async: true })
|
||||
}
|
||||
Hero6Utility.sortArrayObjectsByName(comp)
|
||||
return comp
|
||||
@@ -411,19 +416,19 @@ export class Hero6Actor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
hasPhase( segmentNumber) {
|
||||
let index = Math.min( Math.max(this.system.characteristics.spd.value, 1), 12) // Security bounds
|
||||
let phases = __speed2Segments[index]
|
||||
hasPhase(segmentNumber) {
|
||||
let index = Math.min(Math.max(this.system.characteristics.spd.value, 1), 12) // Security bounds
|
||||
let phases = __speed2Segments[index]
|
||||
return phases.includes(segmentNumber)
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getSegments() {
|
||||
let index = Math.min( Math.max(this.system.characteristics.spd.value, 1), 12) // Security bounds
|
||||
let index = Math.min(Math.max(this.system.characteristics.spd.value, 1), 12) // Security bounds
|
||||
return __speed2Segments[index]
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getBaseInit() {
|
||||
let r = new Roll("1d6").roll({async: false})
|
||||
let r = new Roll("1d6").roll({ async: false })
|
||||
let base = this.system.characteristics.dex.value + (r.total / 10)
|
||||
return base
|
||||
}
|
||||
@@ -461,7 +466,12 @@ export class Hero6Actor extends Actor {
|
||||
prepareCharac() {
|
||||
let characs = duplicate(this.system.characteristics)
|
||||
for (let key in characs) {
|
||||
this.prepareCharacValues(characs[key])
|
||||
let ch = characs[key]
|
||||
this.prepareCharacValues(ch)
|
||||
if (key == "str") {
|
||||
ch.lift = Hero6LiftDice.getLift(ch.value)
|
||||
ch.liftDice = Hero6LiftDice.getLiftDice(ch.value)
|
||||
}
|
||||
}
|
||||
return characs
|
||||
}
|
||||
@@ -569,7 +579,45 @@ export class Hero6Actor extends Actor {
|
||||
}
|
||||
this.startRoll(rollData)
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async rollDamage(itemId) {
|
||||
let item = this.items.get(itemId)
|
||||
let rollData = this.getCommonRollData()
|
||||
rollData.mode = "damage"
|
||||
rollData.item = duplicate(item)
|
||||
rollData.diceFormula = Hero6Utility.convertRollHeroSyntax(item.system.damage)
|
||||
let myRoll = new Roll(rollData.diceFormula).roll({ async: false })
|
||||
await Hero6Utility.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
|
||||
|
||||
rollData.roll = myRoll
|
||||
rollData.result = myRoll.total
|
||||
rollData.bodyValue = Hero6Utility.computeBodyValue(myRoll)
|
||||
|
||||
let msg = await Hero6Utility.createChatWithRollMode(rollData.alias, {
|
||||
content: await renderTemplate(`systems/fvtt-hero-system-6/templates/chat/chat-damage-result.hbs`, rollData)
|
||||
})
|
||||
msg.setFlag("world", "rolldata", rollData)
|
||||
console.log("Rolldata result", rollData)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollLiftDice() {
|
||||
let rollData = this.getCommonRollData()
|
||||
rollData.mode = "lift-dice"
|
||||
rollData.diceFormula = Hero6Utility.convertRollHeroSyntax( Hero6LiftDice.getLiftDice(this.system.characteristics.str.value))
|
||||
let myRoll = new Roll(rollData.diceFormula).roll({ async: false })
|
||||
await Hero6Utility.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
|
||||
|
||||
rollData.roll = myRoll
|
||||
rollData.result = myRoll.total
|
||||
|
||||
let msg = await Hero6Utility.createChatWithRollMode(rollData.alias, {
|
||||
content: await renderTemplate(`systems/fvtt-hero-system-6/templates/chat/chat-lift-dice-result.hbs`, rollData)
|
||||
})
|
||||
msg.setFlag("world", "rolldata", rollData)
|
||||
console.log("Rolldata result", rollData)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollSkill(skillId) {
|
||||
let skill = this.items.get(skillId)
|
||||
|
||||
Reference in New Issue
Block a user