From 536739fced46f966956dd5400a6c837d3812a20e Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Sun, 7 May 2023 14:03:14 +0200 Subject: [PATCH] All fixes requested --- modules/hero6-actor-sheet.js | 10 + modules/hero6-actor.js | 74 +- modules/hero6-commands.js | 58 +- modules/hero6-item-sheet.js | 1 + modules/hero6-lift-dice.js | 641 ++++++++++++++++++ modules/hero6-main.js | 3 +- modules/hero6-utility.js | 42 +- styles/simple.css | 122 +--- system.json | 4 +- template.json | 26 +- templates/actors/actor-sheet.hbs | 27 +- templates/chat/chat-damage-result.hbs | 30 + templates/chat/chat-lift-dice-result.hbs | 28 + templates/items/item-power-sheet.hbs | 2 +- .../partial-actor-equipment-section.hbs | 15 +- .../partials/partial-actor-equipment.hbs | 10 +- .../partials/partial-actor-full-charac.hbs | 6 + .../partials/partial-item-description.hbs | 14 +- templates/partials/partial-item-hasroll.hbs | 5 +- 19 files changed, 894 insertions(+), 224 deletions(-) create mode 100644 modules/hero6-lift-dice.js create mode 100644 templates/chat/chat-damage-result.hbs create mode 100644 templates/chat/chat-lift-dice-result.hbs diff --git a/modules/hero6-actor-sheet.js b/modules/hero6-actor-sheet.js index f9ea2d2..ff9c70d 100644 --- a/modules/hero6-actor-sheet.js +++ b/modules/hero6-actor-sheet.js @@ -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"); diff --git a/modules/hero6-actor.js b/modules/hero6-actor.js index efb6c92..0f1de6c 100644 --- a/modules/hero6-actor.js +++ b/modules/hero6-actor.js @@ -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 + "
" + await TextEditor.enrichHTML(c.system.description, { async: true }) + c.enrichNotes = c.name + "
" + 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) diff --git a/modules/hero6-commands.js b/modules/hero6-commands.js index 776effd..1d39f66 100644 --- a/modules/hero6-commands.js +++ b/modules/hero6-commands.js @@ -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 } } \ No newline at end of file diff --git a/modules/hero6-item-sheet.js b/modules/hero6-item-sheet.js index 8b6c9d6..5d1d2f4 100644 --- a/modules/hero6-item-sheet.js +++ b/modules/hero6-item-sheet.js @@ -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, diff --git a/modules/hero6-lift-dice.js b/modules/hero6-lift-dice.js new file mode 100644 index 0000000..678224f --- /dev/null +++ b/modules/hero6-lift-dice.js @@ -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 + } +} \ No newline at end of file diff --git a/modules/hero6-main.js b/modules/hero6-main.js index 2bfa2ad..bba3928 100644 --- a/modules/hero6-main.js +++ b/modules/hero6-main.js @@ -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() }) /* -------------------------------------------- */ diff --git a/modules/hero6-utility.js b/modules/hero6-utility.js index 99ba541..3f34a55 100644 --- a/modules/hero6-utility.js +++ b/modules/hero6-utility.js @@ -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) => { diff --git a/styles/simple.css b/styles/simple.css index bf0549c..03e37ec 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -39,42 +39,44 @@ text-align: justify; font-size: 16px; letter-spacing: 1px; - color: rgba(44, 133, 133, 0.75); - background: rgba(66, 66, 64, 0.95); - + color: rgba(6, 56, 56, 0.75); + background: rgba(228, 240, 240, 1); } /* Fonts */ .sheet header.sheet-header h1 input, .window-app .window-header, #actors .directory-list, #navigation #scene-list .scene.nav-item { font-size: 1.0rem; color: rgba(224, 208, 197, 0.9); - background: rgba(66, 66, 64, 0.95); + /*background: rgba(66, 66, 64, 0.95);*/ } /* For title, sidebar character and scene */ .sheet nav.sheet-tabs { font-size: 0.7rem; color: rgba(224, 208, 197, 0.9); - background: rgba(66, 66, 64, 0.95); + /*background: rgba(66, 66, 64, 0.95);*/ } /* For nav and title */ .fvtt-hero-system-6 .item-form, .sheet header.sheet-header .flex-group-center.flex-compteurs, .sheet header.sheet-header .flex-group-center.flex-fatigue, select, button, .item-checkbox, #sidebar, #players, #navigation #nav-toggle { font-size: 0.8rem; - color: rgba(224, 208, 197, 0.9); - background: rgba(66, 66, 64, 0.95); + color: rgba(4, 44, 44, 0.98); + /*background: rgba(66, 66, 64, 0.95);*/ +} +.window-app { + } .window-header{ background: rgba(0,0,0,0.75); } .dialog .window-content { - color: rgba(66, 66, 64, 0.95); + color: rgba(224, 208, 197, 0.9); } .dialog-content, .dialog-buttons, .form-fields { - color: rgba(66, 66, 64, 0.95); + color: rgba(224, 208, 197, 0.9); } .dialog-buttons { - color: rgba(66, 66, 64, 0.95); + color: rgba(224, 208, 197, 0.9); } .dialog .dialog-buttons button.default { - color: rgba(66, 66, 64, 0.95); + color: rgba(224, 208, 197, 0.9); } .window-app.sheet .window-content { margin: 0; @@ -211,8 +213,7 @@ table { border: 1px solid #7a7971;} flex: 'flex-shrink' ; } -/* Styles limited to foundryvtt-vadentis sheets */ - +/* Styles limited to foundryvtt-hero6 sheets */ .fvtt-hero-system-6 .sheet-header { -webkit-box-flex: 0; -ms-flex: 0 0 210px; @@ -399,14 +400,9 @@ form .form-group label { text-align: right; } - -/* ======================================== */ -/* Sheet */ -.window-app.sheet .window-content .sheet-header{ - background: url("../images/ui/pc_sheet_bg.webp") +.window-app.sheet .window-content .sheet-header { + background: rgba(228, 240, 240, 0.75); } -/* background: #011d33 url("../images/ui/fond1.webp") repeat left top;*/ -/*color: rgba(168, 139, 139, 0.5);*/ .window-app.sheet .window-content .sheet-header input[type="text"], .window-app.sheet .window-content .sheet-header input[type="number"], .window-app.sheet .window-content .sheet-header input[type="password"], .window-app.sheet .window-content .sheet-header input[type="date"], .window-app.sheet .window-content .sheet-header input[type="time"] { background: rgba(228, 240, 240, 0.75); @@ -434,13 +430,10 @@ form .form-group label { .window-app .window-content, .window-app.sheet .window-content .sheet-body{ font-size: 0.8rem; - /*background: url("../images/ui/pc_sheet_bg.webp") repeat left top;*/ background: rgba(228, 240, 240, 0.75); color: rgba(66, 66, 64, 0.95); } -/* background: rgba(245,245,240,0.6) url("../images/ui/sheet_background.webp") left top;*/ - section.sheet-body{padding: 0.25rem 0.5rem;} .sheet header.sheet-header .profile-img { @@ -466,8 +459,6 @@ section.sheet-body{padding: 0.25rem 0.5rem;} color:beige; } -/* background: rgb(245,245,240) url("../images/ui/fond4.webp") repeat left top;*/ - nav.sheet-tabs .item { position: relative; padding: 0 0.15rem; @@ -480,7 +471,7 @@ nav.sheet-tabs .item:after { right: 0; height: 2rem; width: 1px; - border-right: 1px dashed rgba(52, 52, 52, 0.25); + /*border-right: 1px dashed rgba(52, 52, 52, 0.25);*/ } .sheet .tab[data-tab] { @@ -586,9 +577,6 @@ ul, li { .item-display-hide { display: none; } -.conteneur-type { - background: rgb(200, 10, 100, 0.25); -} .item-quantite { margin-left: 0.5rem; } @@ -780,8 +768,6 @@ ul, li { color: rgba(220,220,220,0.75); } -/* background: rgb(105,85,65) url("../images/ui/texture_feuille_perso_onglets.webp") no-repeat right bottom;*/ - #sidebar.collapsed { height: 470px !important; } @@ -865,18 +851,6 @@ ul, li { padding-bottom: .2rem; } -.div-river-full { - height: 5rem; - align-items: flex-start; -} - -.div-river { - align-content: center; - margin-left: 8px; - align-content:space-around; - justify-content: space-around; -} - .div-center { align-self: center; } @@ -1051,38 +1025,9 @@ ul, li { transition: opacity 0.3s; } -.tooltip .ttt-fatigue{ - width: 360px; - - background: rgba(30, 25, 20, 0.9); - border-image: url(img/ui/bg_control.jpg) 21 repeat; - border-image-slice: 6 6 6 6 fill; - border-image-width: 6px 6px 6px 6px; - border-image-outset: 0px 0px 0px 0px; - border-radius: 0px; - - font-size: 0.8rem; - padding: 3px 0; -} - -.tooltip .ttt-ajustements { - width: 150px; - background: rgba(220,220,210,0.95); - border-radius: 6px; - font-size: 0.9rem; - padding: 3px 0; -} - .tooltip-nobottom { border-bottom: unset; /* If you want dots under the hoverable text */ } -.tooltip .ttt-xp { - width: 250px; - background: rgba(220,220,210,0.95); - border-radius: 6px; - font-size: 0.9rem; - padding: 3px 0; -} /* Show the tooltip text when you mouse over the tooltip container */ .tooltip:hover .tooltiptext { @@ -1154,34 +1099,6 @@ ul, li { padding-left: 2rem; } -.drop-equipment-effect, -.drop-power-effect, -.drop-perk-effect, -.drop-ability-effect, -.drop-effect-specaffected, -.drop-effect-spec, -.drop-ability-weapon, -.drop-ability-armor, -.drop-race-perk, -.drop-spec-perk, -.drop-ability-power, -.drop-ability-spec, -.drop-spec-power, -.drop-specialability, -.drop-abilities, -.drop-optionnal-abilities, -.drop-virtue-vice-effect, -.drop-virtue-vice, -.drop-vice-virtue, -.drop-specialperk1, -.drop-perk2, -.drop-spec1 , -.drop-spec2 { - background: linear-gradient(to bottom, #6c95b9fc 5%, #105177ab 100%); - background-color: #7d5d3b00; - border-radius: 3px; - border: 2px ridge #846109; -} /*************************************************************/ #pause @@ -1436,6 +1353,11 @@ Focus FOC: #ff0084 .margin-image-right { margin-right: 4px; } +.fixed-separator { + width: 12px; + max-width: 12px; + min-width: 12px; +} .alternate-list { margin-top: 4px; flex-wrap: nowrap; diff --git a/system.json b/system.json index 7444a90..2f01123 100644 --- a/system.json +++ b/system.json @@ -91,7 +91,7 @@ "styles": [ "styles/simple.css" ], - "version": "10.0.34", + "version": "10.0.36", "compatibility": { "minimum": "10", "verified": "10", @@ -99,7 +99,7 @@ }, "title": "Hero System v6 for FoundrtVTT (Official)", "manifest": "https://www.uberwald.me/gitea/uberwald/fvtt-hero-system-6/raw/branch/main/system.json", - "download": "https://www.uberwald.me/gitea/uberwald/fvtt-hero-system-6/archive/fvtt-hero-system-6-v10.0.34.zip", + "download": "https://www.uberwald.me/gitea/uberwald/fvtt-hero-system-6/archive/fvtt-hero-system-6-v10.0.36.zip", "url": "https://www.uberwald.me/gitea/uberwald/", "background": "images/ui/hro6_welcome_page.webp", "id": "fvtt-hero-system-6" diff --git a/template.json b/template.json index 28b7955..1960d3f 100644 --- a/template.json +++ b/template.json @@ -39,11 +39,11 @@ "characteristics": { "characteristics": { "str": { - "label": "Strength", + "label": "STR", "value": 10, "base": 10, "category": "main", - "strdice": {}, + "strdice": "", "lift": "", "strend": 0, "hasroll": true, @@ -51,21 +51,21 @@ "activecost": 0 }, "dex": { - "label": "Dexterity", + "label": "DEX", "value": 10, "base": 10, "hasroll": true, "category": "main" }, "con": { - "label": "Constitution", + "label": "CON", "hasroll": true, "category": "main", "value": 10, "base": 10 }, "int": { - "label": "Intelligence", + "label": "INT", "hasroll": true, "category": "main", "value": 10, @@ -73,14 +73,14 @@ "perceptionroll": 10 }, "ego": { - "label": "Ego", + "label": "EGO", "hasroll": true, "category": "main", "value": 10, "base": 10 }, "pre": { - "label": "Presence", + "label": "PRE", "hasroll": true, "category": "main", "value": 10, @@ -123,7 +123,7 @@ "modifier": 1 }, "spd": { - "label": "Speed", + "label": "SPD", "hasroll": false, "value": 2, "base": 2 @@ -172,14 +172,6 @@ "value": 20, "max": 20 }, - "other": { - "label": "OTHER", - "hasroll": false, - "isvital": true, - "damage": 0, - "value": 20, - "max": 20 - }, "body": { "label": "BODY", "hasroll": false, @@ -375,7 +367,7 @@ }, "skill": { "skilltype": "agility", - "characteristic": "", + "characteristic": "str", "base": "", "levelscost": 0, "levels": 0, diff --git a/templates/actors/actor-sheet.hbs b/templates/actors/actor-sheet.hbs index 20561c3..b1c4cf9 100644 --- a/templates/actors/actor-sheet.hbs +++ b/templates/actors/actor-sheet.hbs @@ -4,7 +4,13 @@
- + + + +
+   +
+

@@ -117,10 +123,10 @@
  • - {{characteristics.str.strdice.displayFormula}} + {{characteristics.str.strdice}} - + @@ -508,8 +514,14 @@ + + + - + + + + @@ -521,10 +533,11 @@ {{#each powers as |power key|}}
  • + src="{{power.img}}" /> {{power.system.cost}} - {{{power.enrichDescription}}} - + {{power.name}} + {{power.system.displayname}} + {{power.system.damage}} {{#if power.system.hasroll}} {{power.system.roll}}- {{else}} diff --git a/templates/chat/chat-damage-result.hbs b/templates/chat/chat-damage-result.hbs new file mode 100644 index 0000000..db78acd --- /dev/null +++ b/templates/chat/chat-damage-result.hbs @@ -0,0 +1,30 @@ +
    + {{#if actorImg}} + {{alias}} + {{/if}} +

    {{alias}}

    +
    + +
    + + {{#if img}} +
    + {{name}} +
    + {{/if}} + +
    +
    + +
    +
      +
    • Damage formula : {{diceFormula}}
    • + +
    • Result : {{result}}
    • + +
    • BODY : {{bodyValue}}
    • + +
    +
    + +
diff --git a/templates/chat/chat-lift-dice-result.hbs b/templates/chat/chat-lift-dice-result.hbs new file mode 100644 index 0000000..ed72a8e --- /dev/null +++ b/templates/chat/chat-lift-dice-result.hbs @@ -0,0 +1,28 @@ +
+ {{#if actorImg}} + {{alias}} + {{/if}} +

{{alias}}

+
+ +
+ + {{#if img}} +
+ {{name}} +
+ {{/if}} + +
+
+ +
+
    +
  • Lift dice formula : {{diceFormula}}
  • + +
  • Result : {{result}}
  • + +
+
+ +
diff --git a/templates/items/item-power-sheet.hbs b/templates/items/item-power-sheet.hbs index 09bc8e6..de16e37 100644 --- a/templates/items/item-power-sheet.hbs +++ b/templates/items/item-power-sheet.hbs @@ -18,7 +18,7 @@
    {{> systems/fvtt-hero-system-6/templates/partials/partial-item-hasroll.hbs}} - {{> systems/fvtt-hero-system-6/templates/partials/partial-power-maneuver-effect.hbs}} + {{> systems/fvtt-hero-system-6/templates/partials/partial-power-equipment-cost.hbs}} diff --git a/templates/partials/partial-actor-equipment-section.hbs b/templates/partials/partial-actor-equipment-section.hbs index 4eba843..1f69d20 100644 --- a/templates/partials/partial-actor-equipment-section.hbs +++ b/templates/partials/partial-actor-equipment-section.hbs @@ -1,16 +1,16 @@
    • + + + - - + + - - - - - + + @@ -18,7 +18,6 @@ -
       
      diff --git a/templates/partials/partial-actor-equipment.hbs b/templates/partials/partial-actor-equipment.hbs index 5ec8ef1..5ed435e 100644 --- a/templates/partials/partial-actor-equipment.hbs +++ b/templates/partials/partial-actor-equipment.hbs @@ -2,17 +2,13 @@ {{equip.name}} -
    • \ No newline at end of file diff --git a/templates/partials/partial-item-description.hbs b/templates/partials/partial-item-description.hbs index bbfe3e8..8863fad 100644 --- a/templates/partials/partial-item-description.hbs +++ b/templates/partials/partial-item-description.hbs @@ -3,16 +3,18 @@
-
- -
- {{editor description target="system.description" button=true owner=owner editable=editable}} -
-
+
{{editor notes target="system.notes" button=true owner=owner editable=editable}}
+ +
+ +
+ {{editor description target="system.description" button=true owner=owner editable=editable}} +
+
diff --git a/templates/partials/partial-item-hasroll.hbs b/templates/partials/partial-item-hasroll.hbs index ed69c71..9bf682c 100644 --- a/templates/partials/partial-item-hasroll.hbs +++ b/templates/partials/partial-item-hasroll.hbs @@ -7,7 +7,8 @@ -
  • + + {{/if}}