All fixes requested
This commit is contained in:
@@ -163,6 +163,16 @@ export class Hero6ActorSheet extends ActorSheet {
|
||||
let itemId = li.data("item-id")
|
||||
this.actor.rollItem(itemId);
|
||||
});
|
||||
html.find('.roll-damage').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
let itemId = li.data("item-id")
|
||||
this.actor.rollDamage(itemId);
|
||||
});
|
||||
html.find('.roll-lift-dice').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
let itemId = li.data("item-id")
|
||||
this.actor.rollLiftDice(itemId);
|
||||
});
|
||||
|
||||
html.find('.roll-weapon').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
|
@@ -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)
|
||||
|
@@ -4,18 +4,28 @@ import { Hero6Utility } from "./hero6-utility.js";
|
||||
import { Hero6RollDialog } from "./hero6-roll-dialog.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
const __saveFirstToKey = { r: "reflex", f: "fortitude", w: "willpower"}
|
||||
const __saveFirstToKey = { r: "reflex", f: "fortitude", w: "willpower" }
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class Hero6Commands {
|
||||
|
||||
static init() {
|
||||
static ready() {
|
||||
if (!game.system.hero6.commands) {
|
||||
const hero6Commands = new Hero6Commands();
|
||||
hero6Commands.registerCommand({ path: ["/rtarget"], func: (content, msg, params) => Hero6Commands.rollTarget(msg, params), descr: "Launch the target roll window" });
|
||||
hero6Commands.registerCommand({ path: ["/rsave"], func: (content, msg, params) => Hero6Commands.rollSave(msg, params), descr: "Performs a save roll" });
|
||||
hero6Commands.registerCommand({ path: ["/rh"], func: (content, msg, params) => Hero6Commands.rollSpecialHero(msg, params), descr: "Special roll hero roll (1/2d6 like)" });
|
||||
game.system.hero6.commands = hero6Commands;
|
||||
}
|
||||
|
||||
Hooks.on("chatMessage", (html, content, msg) => {
|
||||
if (content[0] == '/') {
|
||||
let regExp = /(\S+)/g;
|
||||
let commands = content.match(regExp);
|
||||
if (game.hero6.commands.processChatCommand(commands, content, msg)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
constructor() {
|
||||
@@ -108,37 +118,17 @@ export class Hero6Commands {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static rollTarget(msg, params) {
|
||||
const speaker = ChatMessage.getSpeaker()
|
||||
let actor
|
||||
if (speaker.token) actor = game.actors.tokens[speaker.token]
|
||||
if (!actor) actor = game.actors.get(speaker.actor)
|
||||
if (!actor) {
|
||||
return ui.notifications.warn(`Select your actor to run the macro`)
|
||||
}
|
||||
actor.rollDefenseRanged()
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static rollSave(msg, params) {
|
||||
console.log(msg, params)
|
||||
if ( params.length == 0) {
|
||||
ui.notifications.warn("/rsave command error : syntax is /rsave reflex, /rsave fortitude or /rsave willpower")
|
||||
return
|
||||
}
|
||||
let saveKey = params[0].toLowerCase()
|
||||
if ( saveKey.length > 0 && (saveKey[0] == "r" || saveKey[0] == "f" || saveKey[0] == "w")) {
|
||||
const speaker = ChatMessage.getSpeaker()
|
||||
let actor
|
||||
if (speaker.token) actor = game.actors.tokens[speaker.token]
|
||||
if (!actor) actor = game.actors.get(speaker.actor)
|
||||
if (!actor) {
|
||||
return ui.notifications.warn(`Select your actor to run the macro`)
|
||||
}
|
||||
actor.rollSave( __saveFirstToKey[saveKey[0]] )
|
||||
} else {
|
||||
ui.notifications.warn("/rsave syntax error : syntax is /rsave reflex, /rsave fortitude or /rsave willpower")
|
||||
static async rollSpecialHero(msg, params) {
|
||||
console.log("ROLL HERE", msg, params)
|
||||
let formula = params.join(' ')
|
||||
if (formula) {
|
||||
let foundryFormula = Hero6Utility.convertRollHeroSyntax(formula)
|
||||
let myRoll = new Roll(foundryFormula).roll({ async: false })
|
||||
await Hero6Utility.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
|
||||
myRoll.toMessage()
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
@@ -60,6 +60,7 @@ export class Hero6ItemSheet extends ItemSheet {
|
||||
editable: this.isEditable,
|
||||
cssClass: this.isEditable ? "editable" : "locked",
|
||||
description: await TextEditor.enrichHTML(this.object.system.description, {async: true}),
|
||||
notes: await TextEditor.enrichHTML(this.object.system.notes, {async: true}),
|
||||
config: game.system.hero6.config,
|
||||
system: objectData,
|
||||
limited: this.object.limited,
|
||||
|
641
modules/hero6-lift-dice.js
Normal file
641
modules/hero6-lift-dice.js
Normal file
@@ -0,0 +1,641 @@
|
||||
const __LiftDiceValues = {
|
||||
"0": {
|
||||
"weight": "25 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"1": {
|
||||
"weight": "29 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"2": {
|
||||
"weight": "33 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"3": {
|
||||
"weight": "37.5 kg",
|
||||
"dice": "0.5d6"
|
||||
},
|
||||
"4": {
|
||||
"weight": "44 kg",
|
||||
"dice": "0.5d6"
|
||||
},
|
||||
"5": {
|
||||
"weight": "50 kg",
|
||||
"dice": "1d6"
|
||||
},
|
||||
"6": {
|
||||
"weight": "58 kg",
|
||||
"dice": "1d6"
|
||||
},
|
||||
"7": {
|
||||
"weight": "67 kg",
|
||||
"dice": "1d6"
|
||||
},
|
||||
"8": {
|
||||
"weight": "75 kg",
|
||||
"dice": "1.5d6"
|
||||
},
|
||||
"9": {
|
||||
"weight": "88 kg",
|
||||
"dice": "1.5d6"
|
||||
},
|
||||
"10": {
|
||||
"weight": "100 kg",
|
||||
"dice": "2d6"
|
||||
},
|
||||
"11": {
|
||||
"weight": "117 kg",
|
||||
"dice": "2d6"
|
||||
},
|
||||
"12": {
|
||||
"weight": "133 kg",
|
||||
"dice": "2d6"
|
||||
},
|
||||
"13": {
|
||||
"weight": "150 kg",
|
||||
"dice": "2.5d6"
|
||||
},
|
||||
"14": {
|
||||
"weight": "175 kg",
|
||||
"dice": "2.5d6"
|
||||
},
|
||||
"15": {
|
||||
"weight": "200 kg",
|
||||
"dice": "3d6"
|
||||
},
|
||||
"16": {
|
||||
"weight": "233 kg",
|
||||
"dice": "3d6"
|
||||
},
|
||||
"17": {
|
||||
"weight": "267 kg",
|
||||
"dice": "3d6"
|
||||
},
|
||||
"18": {
|
||||
"weight": "300 kg",
|
||||
"dice": "3.5d6"
|
||||
},
|
||||
"19": {
|
||||
"weight": "350 kg",
|
||||
"dice": "3.5d6"
|
||||
},
|
||||
"20": {
|
||||
"weight": "400 kg",
|
||||
"dice": "4d6"
|
||||
},
|
||||
"21": {
|
||||
"weight": "467 kg",
|
||||
"dice": "4d6"
|
||||
},
|
||||
"22": {
|
||||
"weight": "533 kg",
|
||||
"dice": "4d6"
|
||||
},
|
||||
"23": {
|
||||
"weight": "600 kg",
|
||||
"dice": "4.5d6"
|
||||
},
|
||||
"24": {
|
||||
"weight": "700 kg",
|
||||
"dice": "4.5d6"
|
||||
},
|
||||
"25": {
|
||||
"weight": "800 kg",
|
||||
"dice": "5d6"
|
||||
},
|
||||
"26": {
|
||||
"weight": "933 kg",
|
||||
"dice": "5d6"
|
||||
},
|
||||
"27": {
|
||||
"weight": "1,067 kg",
|
||||
"dice": "5d6"
|
||||
},
|
||||
"28": {
|
||||
"weight": "1,200 kg",
|
||||
"dice": "5.5d6"
|
||||
},
|
||||
"29": {
|
||||
"weight": "1,400 kg",
|
||||
"dice": "5.5d6"
|
||||
},
|
||||
"30": {
|
||||
"weight": "1,600 kg",
|
||||
"dice": "6d6"
|
||||
},
|
||||
"31": {
|
||||
"weight": "1,867 kg",
|
||||
"dice": "6d6"
|
||||
},
|
||||
"32": {
|
||||
"weight": "2,133 kg",
|
||||
"dice": "6d6"
|
||||
},
|
||||
"33": {
|
||||
"weight": "2,400 kg",
|
||||
"dice": "6.5d6"
|
||||
},
|
||||
"34": {
|
||||
"weight": "2,800 kg",
|
||||
"dice": "6.5d6"
|
||||
},
|
||||
"35": {
|
||||
"weight": "3,200 kg",
|
||||
"dice": "7d6"
|
||||
},
|
||||
"36": {
|
||||
"weight": "3,733 kg",
|
||||
"dice": "7d6"
|
||||
},
|
||||
"37": {
|
||||
"weight": "4,267 kg",
|
||||
"dice": "7d6"
|
||||
},
|
||||
"38": {
|
||||
"weight": "4,800 kg",
|
||||
"dice": "7.5d6"
|
||||
},
|
||||
"39": {
|
||||
"weight": "5,600 kg",
|
||||
"dice": "7.5d6"
|
||||
},
|
||||
"40": {
|
||||
"weight": "6,400 kg",
|
||||
"dice": "8d6"
|
||||
},
|
||||
"41": {
|
||||
"weight": "7,467 kg",
|
||||
"dice": "8d6"
|
||||
},
|
||||
"42": {
|
||||
"weight": "8,533 kg",
|
||||
"dice": "8d6"
|
||||
},
|
||||
"43": {
|
||||
"weight": "9,600 kg",
|
||||
"dice": "8.5d6"
|
||||
},
|
||||
"44": {
|
||||
"weight": "11 tons",
|
||||
"dice": "8.5d6"
|
||||
},
|
||||
"45": {
|
||||
"weight": "12.5 tons",
|
||||
"dice": "9d6"
|
||||
},
|
||||
"46": {
|
||||
"weight": "15 tons",
|
||||
"dice": "9d6"
|
||||
},
|
||||
"47": {
|
||||
"weight": "17 tons",
|
||||
"dice": "9d6"
|
||||
},
|
||||
"48": {
|
||||
"weight": "19 tons",
|
||||
"dice": "9.5d6"
|
||||
},
|
||||
"49": {
|
||||
"weight": "22 tons",
|
||||
"dice": "9.5d6"
|
||||
},
|
||||
"50": {
|
||||
"weight": "25 tons",
|
||||
"dice": "10d6"
|
||||
},
|
||||
"51": {
|
||||
"weight": "29 tons",
|
||||
"dice": "10d6"
|
||||
},
|
||||
"52": {
|
||||
"weight": "33 tons",
|
||||
"dice": "10d6"
|
||||
},
|
||||
"53": {
|
||||
"weight": "37.5 tons",
|
||||
"dice": "10.5d6"
|
||||
},
|
||||
"54": {
|
||||
"weight": "44 tons",
|
||||
"dice": "10.5d6"
|
||||
},
|
||||
"55": {
|
||||
"weight": "50 tons",
|
||||
"dice": "11d6"
|
||||
},
|
||||
"56": {
|
||||
"weight": "58 tons",
|
||||
"dice": "11d6"
|
||||
},
|
||||
"57": {
|
||||
"weight": "67 tons",
|
||||
"dice": "11d6"
|
||||
},
|
||||
"58": {
|
||||
"weight": "75 tons",
|
||||
"dice": "11.5d6"
|
||||
},
|
||||
"59": {
|
||||
"weight": "88 tons",
|
||||
"dice": "11.5d6"
|
||||
},
|
||||
"60": {
|
||||
"weight": "100 tons",
|
||||
"dice": "12d6"
|
||||
},
|
||||
"61": {
|
||||
"weight": "117 tons",
|
||||
"dice": "12d6"
|
||||
},
|
||||
"62": {
|
||||
"weight": "133 tons",
|
||||
"dice": "12d6"
|
||||
},
|
||||
"63": {
|
||||
"weight": "150 tons",
|
||||
"dice": "12.5d6"
|
||||
},
|
||||
"64": {
|
||||
"weight": "175 tons",
|
||||
"dice": "12.5d6"
|
||||
},
|
||||
"65": {
|
||||
"weight": "200 tons",
|
||||
"dice": "13d6"
|
||||
},
|
||||
"66": {
|
||||
"weight": "233 tons",
|
||||
"dice": "13d6"
|
||||
},
|
||||
"67": {
|
||||
"weight": "267 tons",
|
||||
"dice": "13d6"
|
||||
},
|
||||
"68": {
|
||||
"weight": "300 tons",
|
||||
"dice": "13.5d6"
|
||||
},
|
||||
"69": {
|
||||
"weight": "350 tons",
|
||||
"dice": "13.5d6"
|
||||
},
|
||||
"70": {
|
||||
"weight": "400 tons",
|
||||
"dice": "14d6"
|
||||
},
|
||||
"71": {
|
||||
"weight": "467 tons",
|
||||
"dice": "14d6"
|
||||
},
|
||||
"72": {
|
||||
"weight": "533 tons",
|
||||
"dice": "14d6"
|
||||
},
|
||||
"73": {
|
||||
"weight": "600 tons",
|
||||
"dice": "14.5d6"
|
||||
},
|
||||
"74": {
|
||||
"weight": "700 tons",
|
||||
"dice": "14.5d6"
|
||||
},
|
||||
"75": {
|
||||
"weight": "800 tons",
|
||||
"dice": "15d6"
|
||||
},
|
||||
"76": {
|
||||
"weight": "933 tons",
|
||||
"dice": "15d6"
|
||||
},
|
||||
"77": {
|
||||
"weight": "1 kton 15d6",
|
||||
"dice": ""
|
||||
},
|
||||
"78": {
|
||||
"weight": "1.2 ktons",
|
||||
"dice": "15.5d6"
|
||||
},
|
||||
"79": {
|
||||
"weight": "1.4 ktons",
|
||||
"dice": "15.5d6"
|
||||
},
|
||||
"80": {
|
||||
"weight": "1.6 ktons",
|
||||
"dice": "16d6"
|
||||
},
|
||||
"81": {
|
||||
"weight": "1.9 ktons",
|
||||
"dice": "16d6"
|
||||
},
|
||||
"82": {
|
||||
"weight": "2 ktons",
|
||||
"dice": "16d6"
|
||||
},
|
||||
"83": {
|
||||
"weight": "2.4 ktons",
|
||||
"dice": "16.5d6"
|
||||
},
|
||||
"84": {
|
||||
"weight": "2.8 ktons",
|
||||
"dice": "16.5d6"
|
||||
},
|
||||
"85": {
|
||||
"weight": "3.2 ktons",
|
||||
"dice": "17d6"
|
||||
},
|
||||
"86": {
|
||||
"weight": "3.7 ktons",
|
||||
"dice": "17d6"
|
||||
},
|
||||
"87": {
|
||||
"weight": "4.3 ktons",
|
||||
"dice": "17d6"
|
||||
},
|
||||
"88": {
|
||||
"weight": "4.8 ktons",
|
||||
"dice": "17.5d6"
|
||||
},
|
||||
"89": {
|
||||
"weight": "5.6 ktons",
|
||||
"dice": "17.5d6"
|
||||
},
|
||||
"90": {
|
||||
"weight": "6.4 ktons",
|
||||
"dice": "18d6"
|
||||
},
|
||||
"91": {
|
||||
"weight": "7.5 ktons",
|
||||
"dice": "18d6"
|
||||
},
|
||||
"92": {
|
||||
"weight": "8.5 ktons",
|
||||
"dice": "18d6"
|
||||
},
|
||||
"93": {
|
||||
"weight": "9.6 ktons",
|
||||
"dice": "18.5d6"
|
||||
},
|
||||
"94": {
|
||||
"weight": "11 ktons",
|
||||
"dice": "18.5d6"
|
||||
},
|
||||
"95": {
|
||||
"weight": "12.5 ktons",
|
||||
"dice": "19d6"
|
||||
},
|
||||
"96": {
|
||||
"weight": "15 ktons",
|
||||
"dice": "19d6"
|
||||
},
|
||||
"97": {
|
||||
"weight": "17 ktons",
|
||||
"dice": "19d6"
|
||||
},
|
||||
"98": {
|
||||
"weight": "19 ktons",
|
||||
"dice": "19.5d6"
|
||||
},
|
||||
"99": {
|
||||
"weight": "22 ktons",
|
||||
"dice": "19.5d6"
|
||||
},
|
||||
"100": {
|
||||
"weight": "25 ktons",
|
||||
"dice": "20d6"
|
||||
},
|
||||
"105": {
|
||||
"weight": "50 ktons",
|
||||
"dice": "21d6"
|
||||
},
|
||||
"110": {
|
||||
"weight": "100 ktons",
|
||||
"dice": "22d6"
|
||||
},
|
||||
"115": {
|
||||
"weight": "200 ktons",
|
||||
"dice": "23d6"
|
||||
},
|
||||
"120": {
|
||||
"weight": "400 ktons",
|
||||
"dice": "24d6"
|
||||
},
|
||||
"125": {
|
||||
"weight": "800 ktons",
|
||||
"dice": "25d6"
|
||||
},
|
||||
"130": {
|
||||
"weight": "1.6 mtons",
|
||||
"dice": "26d6"
|
||||
},
|
||||
"135": {
|
||||
"weight": "3.2 mtons",
|
||||
"dice": "27d6"
|
||||
},
|
||||
"140": {
|
||||
"weight": "6.4 mtons",
|
||||
"dice": "28d6"
|
||||
},
|
||||
"145": {
|
||||
"weight": "12.5 mtons",
|
||||
"dice": "29d6"
|
||||
},
|
||||
"150": {
|
||||
"weight": "25 mtons",
|
||||
"dice": "30d6"
|
||||
},
|
||||
"155": {
|
||||
"weight": "50 mtons",
|
||||
"dice": "31d6"
|
||||
},
|
||||
"160": {
|
||||
"weight": "100 mtons",
|
||||
"dice": "32d6"
|
||||
},
|
||||
"165": {
|
||||
"weight": "200 mtons",
|
||||
"dice": "33d6"
|
||||
},
|
||||
"170": {
|
||||
"weight": "400 mtons",
|
||||
"dice": "34d6"
|
||||
},
|
||||
"175": {
|
||||
"weight": "800 mtons",
|
||||
"dice": "35d6"
|
||||
},
|
||||
"180": {
|
||||
"weight": "1.6 gtons",
|
||||
"dice": "36d6"
|
||||
},
|
||||
"185": {
|
||||
"weight": "3.2 gtons",
|
||||
"dice": "37d6"
|
||||
},
|
||||
"190": {
|
||||
"weight": "6.4 gtons",
|
||||
"dice": "38d6"
|
||||
},
|
||||
"195": {
|
||||
"weight": "12.5 gtons",
|
||||
"dice": "39d6"
|
||||
},
|
||||
"200": {
|
||||
"weight": "25 gtons",
|
||||
"dice": "40d6"
|
||||
},
|
||||
"-50": {
|
||||
"weight": "0.025 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-45": {
|
||||
"weight": "0.05 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-40": {
|
||||
"weight": "0.1 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-35": {
|
||||
"weight": "0.2 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-30": {
|
||||
"weight": "0.4 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-29": {
|
||||
"weight": "0.5 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-28": {
|
||||
"weight": "0.5 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-27": {
|
||||
"weight": "0.6 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-26": {
|
||||
"weight": "0.7 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-25": {
|
||||
"weight": "0.8 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-24": {
|
||||
"weight": "0.9 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-23": {
|
||||
"weight": "1.0 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-22": {
|
||||
"weight": "1.2 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-21": {
|
||||
"weight": "1.4 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-20": {
|
||||
"weight": "1.6 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-19": {
|
||||
"weight": "1.8 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-18": {
|
||||
"weight": "2.0 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-17": {
|
||||
"weight": "2.4 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-16": {
|
||||
"weight": "2.8 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-15": {
|
||||
"weight": "3.2 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-14": {
|
||||
"weight": "3.6 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-13": {
|
||||
"weight": "4.0 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-12": {
|
||||
"weight": "4.8 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-11": {
|
||||
"weight": "5.6 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-10": {
|
||||
"weight": "6.4 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-9": {
|
||||
"weight": "7.2 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-8": {
|
||||
"weight": "8.0 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-7": {
|
||||
"weight": "9.5 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-6": {
|
||||
"weight": "11 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-5": {
|
||||
"weight": "12.5 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-4": {
|
||||
"weight": "14 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-3": {
|
||||
"weight": "16 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-2": {
|
||||
"weight": "19 kg",
|
||||
"dice": ""
|
||||
},
|
||||
"-1": {
|
||||
"weight": "22 kg",
|
||||
"dice": ""
|
||||
}
|
||||
}
|
||||
|
||||
export class Hero6LiftDice{
|
||||
|
||||
static getLift(value) {
|
||||
let data = __LiftDiceValues[String(value)]
|
||||
if (data) {
|
||||
return data.weight
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
static getLiftDice(value) {
|
||||
let data = __LiftDiceValues[String(value)]
|
||||
if (data) {
|
||||
return data.dice
|
||||
}
|
||||
return 0
|
||||
}
|
||||
}
|
@@ -67,7 +67,6 @@ Hooks.once("init", async function () {
|
||||
Items.registerSheet("fvtt-hero-system-6", Hero6ItemSheet, { makeDefault: true });
|
||||
|
||||
Hero6Utility.init()
|
||||
Hero6Combat.init()
|
||||
});
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@@ -96,7 +95,7 @@ Hooks.once("ready", function () {
|
||||
|
||||
welcomeMessage();
|
||||
Hero6Utility.ready()
|
||||
Hero6Commands.init()
|
||||
Hero6Commands.ready()
|
||||
})
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@@ -15,8 +15,6 @@ export class Hero6Utility {
|
||||
Hero6Utility.dropItemOnToken(canvas, data)
|
||||
});*/
|
||||
|
||||
Hero6Commands.init();
|
||||
|
||||
Handlebars.registerHelper('count', function (list) {
|
||||
return list.length;
|
||||
})
|
||||
@@ -142,24 +140,6 @@ export class Hero6Utility {
|
||||
html.on("click", '.view-item-from-chat', event => {
|
||||
game.system.crucible.creator.openItemView(event)
|
||||
})
|
||||
html.on("click", '.roll-defense-melee', event => {
|
||||
let rollId = $(event.currentTarget).data("roll-id")
|
||||
let rollData = Hero6Utility.getRollData(rollId)
|
||||
rollData.defenseWeaponId = $(event.currentTarget).data("defense-weapon-id")
|
||||
let actor = game.canvas.tokens.get(rollData.defenderTokenId).actor
|
||||
if (actor && (game.user.isGM || actor.isOwner)) {
|
||||
actor.rollDefenseMelee(rollData)
|
||||
}
|
||||
})
|
||||
html.on("click", '.roll-defense-ranged', event => {
|
||||
let rollId = $(event.currentTarget).data("roll-id")
|
||||
let rollData = Hero6Utility.getRollData(rollId)
|
||||
let defender = game.canvas.tokens.get(rollData.defenderTokenId).actor
|
||||
if (defender && (game.user.isGM || defender.isOwner)) {
|
||||
defender.rollDefenseRanged(rollData)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@@ -376,10 +356,6 @@ export class Hero6Utility {
|
||||
}
|
||||
rollData.margin = target - rollData.result
|
||||
|
||||
if (rollData.item && rollData.item.system.computebody) {
|
||||
rollData.bodyValue = this.computeBody(myRoll)
|
||||
}
|
||||
|
||||
this.outputRollMessage(rollData)
|
||||
}
|
||||
|
||||
@@ -389,7 +365,7 @@ export class Hero6Utility {
|
||||
rollData.roll = roll
|
||||
|
||||
rollData.result = roll.total
|
||||
rollData.bodyValue = this.computeBody(rollData.roll)
|
||||
rollData.bodyValue = this.computeBodyValue(rollData.roll)
|
||||
|
||||
this.outputRollMessage(rollData)
|
||||
}
|
||||
@@ -403,6 +379,22 @@ export class Hero6Utility {
|
||||
console.log("Rolldata result", rollData)
|
||||
}
|
||||
|
||||
/* -------------- ----------------------------- */
|
||||
static convertRollHeroSyntax( hero6Formula) {
|
||||
// Ensure we have no space at all
|
||||
//hero6Formula = hero6Formula.replace(/\s/g, '')
|
||||
let hasHalfDice = ""
|
||||
if (hero6Formula.match("1/2d6")) {
|
||||
hero6Formula = hero6Formula.replace("1/2d6", "d6")
|
||||
hasHalfDice = "+round(1d6)"
|
||||
}
|
||||
|
||||
let foundryFormula = hero6Formula + hasHalfDice
|
||||
foundryFormula = foundryFormula.replace(' ', '')
|
||||
console.log("Parsed formula : ", hero6Formula, foundryFormula)
|
||||
return foundryFormula
|
||||
}
|
||||
|
||||
/* -------------- ----------------------------- */
|
||||
static sortArrayObjectsByName(myArray) {
|
||||
myArray.sort((a, b) => {
|
||||
|
Reference in New Issue
Block a user