DataModels + Appv2 migration : OK

This commit is contained in:
2026-03-01 01:12:00 +01:00
parent 1ffb8b08fc
commit 6c70dc147c
130 changed files with 2998 additions and 741 deletions

View File

@@ -7,6 +7,8 @@ import { BoLUtility } from "../system/bol-utility.js";
*/
export class BoLActor extends Actor {
static _healthLock = new Set()
static async create(data, options) {
// Case of compendium global import
@@ -357,7 +359,7 @@ export class BoLActor extends Actor {
ChatMessage.create({
alias: this.name,
whisper: BoLUtility.getWhisperRecipientsAndGMs(this.name),
content: await renderTemplate('systems/bol/templates/chat/chat-activate-fight-option.hbs', { name: this.name, img: fightOption.img, foName: fightOption.name, state: state })
content: await foundry.applications.handlebars.foundry.applications.handlebars.renderTemplate('systems/bol/templates/chat/chat-activate-fight-option.hbs', { name: this.name, img: fightOption.img, foName: fightOption.name, state: state })
})
}
@@ -852,36 +854,42 @@ export class BoLActor extends Actor {
/*-------------------------------------------- */
async manageHealthState() {
let hpID = "lastHP" + this.id
let lastHP = await this.getFlag("world", hpID)
if (lastHP != this.system.resources.hp.value && game.user.isGM) { // Only GM sends this
await this.setFlag("world", hpID, this.system.resources.hp.value)
let prone = this.effects.find(ef => ef.name == game.i18n.localize("EFFECT.StatusProne"))
let dead = this.effects.find(ef => ef.name == game.i18n.localize("EFFECT.StatusDead"))
if (this.system.resources.hp.value <= 0) {
if (!prone) {
await this.createEmbeddedDocuments("ActiveEffect", [
{ name: game.i18n.localize('EFFECT.StatusProne'), icon: 'icons/svg/falling.svg', statuses: 'prone' }
])
}
if (this.system.resources.hp.value < -5 && !dead) {
await this.createEmbeddedDocuments("ActiveEffect", [
{ name: game.i18n.localize('EFFECT.StatusDead'), icon: 'icons/svg/skull.svg', statuses: 'dead' }
])
}
ChatMessage.create({
alias: this.name,
whisper: BoLUtility.getWhisperRecipientsAndGMs(this.name),
content: await renderTemplate('systems/bol/templates/chat/chat-vitality-zero.hbs', { name: this.name, img: this.img, hp: this.system.resources.hp.value, isHeroAdversary: this.isHeroAdversary() })
})
} else {
if (prone) {
await this.deleteEmbeddedDocuments("ActiveEffect", [prone.id])
}
if (dead) {
await this.deleteEmbeddedDocuments("ActiveEffect", [dead.id])
if (BoLActor._healthLock.has(this.id)) return
BoLActor._healthLock.add(this.id)
try {
let hpID = "lastHP" + this.id
let lastHP = await this.getFlag("world", hpID)
if (lastHP != this.system.resources.hp.value && game.user.isGM) { // Only GM sends this
await this.setFlag("world", hpID, this.system.resources.hp.value)
let prone = this.effects.find(ef => ef.name == game.i18n.localize("EFFECT.StatusProne"))
let dead = this.effects.find(ef => ef.name == game.i18n.localize("EFFECT.StatusDead"))
if (this.system.resources.hp.value <= 0) {
if (!prone) {
await this.createEmbeddedDocuments("ActiveEffect", [
{ name: game.i18n.localize('EFFECT.StatusProne'), icon: 'icons/svg/falling.svg', statuses: 'prone' }
])
}
if (this.system.resources.hp.value < -5 && !dead) {
await this.createEmbeddedDocuments("ActiveEffect", [
{ name: game.i18n.localize('EFFECT.StatusDead'), icon: 'icons/svg/skull.svg', statuses: 'dead' }
])
}
ChatMessage.create({
alias: this.name,
whisper: BoLUtility.getWhisperRecipientsAndGMs(this.name),
content: await foundry.applications.handlebars.foundry.applications.handlebars.renderTemplate('systems/bol/templates/chat/chat-vitality-zero.hbs', { name: this.name, img: this.img, hp: this.system.resources.hp.value, isHeroAdversary: this.isHeroAdversary() })
})
} else {
if (prone) {
await this.deleteEmbeddedDocuments("ActiveEffect", [prone.id])
}
if (dead) {
await this.deleteEmbeddedDocuments("ActiveEffect", [dead.id])
}
}
}
} finally {
BoLActor._healthLock.delete(this.id)
}
}
@@ -904,7 +912,7 @@ export class BoLActor extends Actor {
let msg = await ChatMessage.create({
alias: this.name,
whisper: BoLUtility.getWhisperRecipientsAndGMs(this.name),
content: await renderTemplate('systems/bol/templates/chat/chat-recup-information.hbs', {
content: await foundry.applications.handlebars.foundry.applications.handlebars.renderTemplate('systems/bol/templates/chat/chat-recup-information.hbs', {
name: this.name,
img: this.img,
actorId: this.id,

View File

@@ -31,7 +31,7 @@ export default class BoLHordeSheet extends BoLBaseActorSheet {
context.options = this.options
context.editScore = this.options.editScore
context.description = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
actor.system.description || "", { async: true }
actor.system.details?.biography || "", { async: true }
)
console.log("HORDE (AppV2)", context)

View File

@@ -35,7 +35,7 @@ export default class BoLVehicleSheet extends BoLBaseActorSheet {
actor.system.description || "", { async: true }
)
console.log("VEHICLE (AppV2)", context)
console.log("VEHICLE (AppV2)", context) // TODO: remove before release
return context
}
@@ -56,10 +56,14 @@ export default class BoLVehicleSheet extends BoLBaseActorSheet {
})
})
// Create generic item
this.element.querySelectorAll(".create_item").forEach((el) => {
// Create vehicle weapon
this.element.querySelectorAll(".vehicle-weapon-add").forEach((el) => {
el.addEventListener("click", () => {
this.actor.createEmbeddedDocuments("Item", [{ name: "Nouvel Equipement", type: "item" }], { renderSheet: true })
this.actor.createEmbeddedDocuments("Item", [{
name: game.i18n.localize("BOL.ui.newEquipment"),
type: "item",
system: { category: "vehicleweapon" },
}], { renderSheet: true })
})
})
}

View File

@@ -110,35 +110,22 @@ Hooks.once('init', async function () {
/* -------------------------------------------- */
function welcomeMessage() {
let content = `<div id="welcome-message-bol"><span class="rdd-roll-part">
<strong>` + game.i18n.localize("BOL.chat.welcome1") + `</strong><p>` +
game.i18n.localize("BOL.chat.welcome2") + "</p><p>" +
game.i18n.localize("BOL.chat.welcome3") + "</p><p>" +
game.i18n.localize("BOL.chat.welcome4") + "</p><p>" +
game.i18n.localize("BOL.chat.welcome5") + "</p>" +
game.i18n.localize("BOL.chat.welcome6")
async function welcomeMessage() {
const noRulebook = !game.modules.find(m => m.id === "bol-rulebook")
const content = await foundry.applications.handlebars.renderTemplate(
"systems/bol/templates/chat/chat-welcome.hbs",
{ noRulebook }
)
ChatMessage.create({ user: game.user.id, whisper: [game.user.id], content })
let rulebook = game.modules.find( m => m.id === "bol-rulebook")
if ( !rulebook ) {
content += "<p>" + game.i18n.localize("BOL.chat.bolRulebookMessage") + "</p>"
}
ChatMessage.create({
user: game.user.id,
whisper: [game.user.id],
content: content
})
if (game.user.isGM && game.i18n.lang == 'en' && !game.modules.find(m => m.id == "babele") ){
if (game.user.isGM && game.i18n.lang == 'en' && !game.modules.find(m => m.id == "babele")) {
ChatMessage.create({
user: game.user.id,
whisper: [game.user.id],
content: `<div id="welcome-message-bol"><span class="rdd-roll-part">
<strong>WARNING ! English language selected, but Babele module is not installed !<br>Please install babele from the module tab in Foundry interface.`
} )
content: `<div class="bol-welcome-card"><div class="welcome-body"><p class="welcome-warning">⚠ WARNING ! English language selected, but Babele module is not installed !<br>Please install babele from the module tab in Foundry interface.</p></div></div>`
})
ui.notifications.warn("WARNING ! English language selected, but babele module is not installed !<br>Please install babele from the module tab in Foundry interface.")
}
}
/* -------------------------------------------- */

View File

@@ -5,11 +5,6 @@ const _apt2attr = { init: "mind", melee: "agility", ranged: "agility", def: "vig
/* -------------------------------------------- */
export class BoLRoll {
/* -------------------------------------------- */
static options() {
return { classes: ["bol", "dialog"], width: 480, height: 'fit-content' };
}
/* -------------------------------------------- */
static getDefaultAttribute(key) {
return _apt2attr[key]
@@ -129,7 +124,7 @@ export class BoLRoll {
rangeMsg = "BOL.chat.range6"
}
ChatMessage.create({
content: await renderTemplate('systems/bol/templates/chat/chat-info-range.hbs', {
content: await foundry.applications.handlebars.renderTemplate('systems/bol/templates/chat/chat-info-range.hbs', {
weapon: weapon,
attackerName: _token.actor.name,
defenderName: target.actor.name,
@@ -308,26 +303,31 @@ export class BoLRoll {
// Final number of dices
this.rollData.nbDice = 2 + Math.abs(this.rollData.bmDice)
// Bonus or Malus ?
if (this.rollData.bmDice == 0) {
$('#roll-nbdice').val("2")
} else {
let letter = (this.rollData.bmDice > 0) ? "B" : "M"
$('#roll-nbdice').val("2 + " + String(Math.abs(this.rollData.bmDice)) + letter)
const nbDiceEl = document.querySelector('#roll-nbdice')
if (nbDiceEl) {
if (this.rollData.bmDice == 0) {
nbDiceEl.value = "2"
} else {
let letter = (this.rollData.bmDice > 0) ? "B" : "M"
nbDiceEl.value = "2 + " + String(Math.abs(this.rollData.bmDice)) + letter
}
}
let rollbase = this.rollData.attrValue + "+" + this.rollData.aptValue
if (this.rollData.weapon && this.rollData.weapon.system.properties.onlymodifier) {
rollbase = ""
}
$('#roll-modifier').val(rollbase + "+" + this.rollData.careerBonus + "+" + this.rollData.mod + "+" +
const modifierEl = document.querySelector('#roll-modifier')
if (modifierEl) modifierEl.value = rollbase + "+" + this.rollData.careerBonus + "+" + this.rollData.mod + "+" +
this.rollData.modRanged + "+" + this.rollData.weaponModifier + "-" + this.rollData.defence + "-" + this.rollData.modArmorMalus + "-" +
this.rollData.shieldMalus + "+" + this.rollData.attackModifier + "+" + this.rollData.appliedArmorMalus + "+" + effectModifier)
this.rollData.shieldMalus + "+" + this.rollData.attackModifier + "+" + this.rollData.appliedArmorMalus + "+" + effectModifier
// Rebuild lits of applicable effects
// Rebuild list of applicable effects
let selectEffects = ""
for (let effect of this.rollData.bolApplicableEffects) {
selectEffects += `<option value="${effect.id}" selected>${effect.name}</option>`
}
$('#applicable-effects').html(selectEffects)
const effectsEl = document.querySelector('#applicable-effects')
if (effectsEl) effectsEl.innerHTML = selectEffects
}
/* -------------------------------------------- */
@@ -360,46 +360,48 @@ export class BoLRoll {
/* -------------------------------------------- */
static updateArmorMalus(rollData) {
rollData.appliedArmorMalus = 0
const agiEl = document.querySelector('#armor-agi-malus')
if (rollData.attribute.key == "agility") {
$("#armor-agi-malus").show()
if (agiEl) agiEl.style.display = ''
rollData.appliedArmorMalus += rollData.armorAgiMalus
} else {
$("#armor-agi-malus").hide()
if (agiEl) agiEl.style.display = 'none'
}
const initEl = document.querySelector('#armor-init-malus')
if (rollData.aptitude && rollData.aptitude.key == "init") {
$("#armor-init-malus").show()
if (initEl) initEl.style.display = ''
rollData.appliedArmorMalus += rollData.armorInitMalus
} else {
$("#armor-init-malus").hide()
if (initEl) initEl.style.display = 'none'
}
}
/* ------------------------------ -------------- */
static updatePPCost(rollData) {
$('#ppcost').html(rollData.ppCost + " + Armor(" + rollData.ppCostArmor + ")=" + Number(rollData.ppCost + rollData.ppCostArmor))
const el = document.querySelector('#ppcost')
if (el) el.innerHTML = rollData.ppCost + " + Armor(" + rollData.ppCostArmor + ")=" + Number(rollData.ppCost + rollData.ppCostArmor)
}
/* ------------------------------ -------------- */
static rollDialogListener(html) {
this.updateTotalDice()
html.find('#optcond').change((event) => { // Dynamic change of PP cost of spell
html.querySelector('#optcond')?.addEventListener('change', (event) => {
let pp = BoLUtility.computeSpellCost(this.rollData.spell, event.currentTarget.selectedOptions.length)
this.rollData.ppCost = pp
this.updatePPCost(this.rollData)
})
html.find('#mod').change((event) => {
html.querySelector('#mod')?.addEventListener('change', (event) => {
this.rollData.mod = Number(event.currentTarget.value)
this.updateTotalDice()
})
html.find('#modRanged').change((event) => {
html.querySelector('#modRanged')?.addEventListener('change', (event) => {
this.rollData.modRanged = Number(event.currentTarget.value)
this.updateTotalDice()
})
html.find('#attr').change((event) => {
html.querySelector('#attr')?.addEventListener('change', (event) => {
let attrKey = event.currentTarget.value
let actor = BoLUtility.getActorFromRollData(this.rollData)
this.rollData.attribute = foundry.utils.duplicate(actor.system.attributes[attrKey])
@@ -407,7 +409,7 @@ export class BoLRoll {
this.rollData.bolApplicableEffects = this.updateApplicableEffects(this.rollData)
this.updateTotalDice()
})
html.find('#apt').change((event) => {
html.querySelector('#apt')?.addEventListener('change', (event) => {
let aptKey = event.currentTarget.value
let actor = BoLUtility.getActorFromRollData(this.rollData)
this.rollData.aptitude = foundry.utils.duplicate(actor.system.aptitudes[aptKey])
@@ -416,65 +418,58 @@ export class BoLRoll {
this.updateTotalDice()
})
html.find('#applyShieldMalus').click((event) => {
if (event.currentTarget.checked) {
this.rollData.shieldMalus = this.rollData.shieldAttackMalus
} else {
this.rollData.shieldMalus = 0
}
html.querySelector('#applyShieldMalus')?.addEventListener('click', (event) => {
this.rollData.shieldMalus = event.currentTarget.checked ? this.rollData.shieldAttackMalus : 0
this.updateTotalDice()
})
html.find('#career').change((event) => {
let careers = $('#career').val()
html.querySelector('#career')?.addEventListener('change', (event) => {
let careers = Array.from(event.currentTarget.selectedOptions).map(o => o.value)
this.rollData.careerBonus = (!careers || careers.length == 0) ? 0 : Math.max(...careers.map(i => parseInt(i)))
this.updateTotalDice()
})
html.find('#boon').change((event) => {
let boons = $('#boon').val()
html.querySelector('#boon')?.addEventListener('change', (event) => {
let boons = Array.from(event.currentTarget.selectedOptions).map(o => o.value)
this.rollData.nbBoons = (!boons || boons.length == 0) ? 0 : boons.length
this.updateTotalDice()
})
html.find('#flaw').change((event) => {
let flaws = $('#flaw').val()
html.querySelector('#flaw')?.addEventListener('change', (event) => {
let flaws = Array.from(event.currentTarget.selectedOptions).map(o => o.value)
this.rollData.nbFlaws = (!flaws || flaws.length == 0) ? 0 : flaws.length
this.updateTotalDice()
})
html.find('.bdice').click((event) => {
html.querySelectorAll('.bdice').forEach(el => el.addEventListener('click', (event) => {
this.rollData.mDice = 0
this.rollData.bDice = Number(event.currentTarget.value)
this.updateTotalDice()
})
html.find('.mdice').click((event) => {
}))
html.querySelectorAll('.mdice').forEach(el => el.addEventListener('click', (event) => {
this.rollData.bDice = 0
this.rollData.mDice = Number(event.currentTarget.value)
this.updateTotalDice()
})
html.find('#horoscope-bonus-applied').change((event) => {
}))
html.querySelector('#horoscope-bonus-applied')?.addEventListener('change', (event) => {
this.rollData.selectedHoroscope = []
for (let option of event.currentTarget.selectedOptions) {
this.rollData.selectedHoroscope.push(foundry.utils.duplicate(this.rollData.horoscopeBonusList[Number(option.index)]))
}
let horoscopes = $('#horoscope-bonus-applied').val()
let horoscopes = Array.from(event.currentTarget.selectedOptions).map(o => o.value)
this.rollData.horoscopeBonus = (!horoscopes || horoscopes.length == 0) ? 0 : horoscopes.length
this.updateTotalDice()
})
html.find('#horoscope-malus-applied').change((event) => {
html.querySelector('#horoscope-malus-applied')?.addEventListener('change', (event) => {
this.rollData.selectedHoroscope = []
for (let option of event.currentTarget.selectedOptions) {
this.rollData.selectedHoroscope.push(foundry.utils.duplicate(this.rollData.horoscopeBonusList[Number(option.index)]))
}
let horoscopes = $('#horoscope-malus-applied').val()
let horoscopes = Array.from(event.currentTarget.selectedOptions).map(o => o.value)
this.rollData.horoscopeMalus = (!horoscopes || horoscopes.length == 0) ? 0 : horoscopes.length
this.updateTotalDice()
})
html.find('#horoscope-group-applied').change((event) => {
html.querySelector('#horoscope-group-applied')?.addEventListener('change', (event) => {
this.rollData.selectedGroupHoroscopeIndex = event.currentTarget.value
this.updateTotalDice()
})
}
/* -------------------------------------------- */
@@ -552,41 +547,47 @@ export class BoLRoll {
} else {
rollData.shieldMalus = 0
}
// Save
// Save & pre-initialize computed fields
this.rollData = rollData
this.updateTotalDice()
console.log("ROLLDATA", rollData)
// Then display+process the dialog
const rollOptionContent = await foundry.applications.handlebars.renderTemplate(rollOptionTpl, rollData);
let d = new Dialog({
title: rollData.label,
// Use Hooks to reliably get the rendered HTMLElement (renderDialogV2 receives (app, element, context))
Hooks.once('renderDialogV2', (app, element) => {
element.classList.add('bol');
this.rollDialogListener(element);
});
return foundry.applications.api.DialogV2.wait({
window: { title: rollData.label },
content: rollOptionContent,
rollData: rollData,
render: html => this.rollDialogListener(html),
buttons: {
cancel: {
icon: '<i class="fas fa-times"></i>',
rejectClose: false,
buttons: [
{
type: 'button',
label: game.i18n.localize("BOL.ui.cancel"),
callback: () => {
}
icon: 'fas fa-times',
action: 'cancel'
},
submit: {
icon: '<i class="fas fa-check"></i>',
{
type: 'submit',
label: game.i18n.localize("BOL.ui.submit"),
callback: (html) => {
icon: 'fas fa-check',
action: 'submit',
callback: (event, button, dialog) => {
console.log("Submit Roll!!!!");
if (rollData.mode == 'spell' && rollData.ppCurrent < rollData.ppCost) { // Check PP available
if (rollData.mode == 'spell' && rollData.ppCurrent < rollData.ppCost) {
ui.notifications.warn("Pas assez de Points de Pouvoir !")
return
return false
}
rollData.registerInit = (rollData.aptitude && rollData.aptitude.key == 'init') ? $('#register-init').is(":checked") : false;
rollData.registerInit = (rollData.aptitude && rollData.aptitude.key == 'init') ?
(dialog.element.querySelector('#register-init')?.checked ?? false) : false;
const isMalus = (rollData.bmDice < 0)
let rollbase = rollData.attrValue + rollData.aptValue
if (rollData.weapon?.system.properties.onlymodifier) {
rollbase = 0
}
if (rollData.weapon?.system.properties.onlymodifier) rollbase = 0
let diceData = BoLUtility.getDiceData()
let malusInit = rollData.combatData?.malusInit || 0
const modifiers = rollbase + rollData.careerBonus + rollData.mod + rollData.weaponModifier - rollData.defence - rollData.modArmorMalus + rollData.shieldMalus + rollData.attackModifier + rollData.appliedArmorMalus + rollData.effectModifier - malusInit
@@ -599,12 +600,8 @@ export class BoLRoll {
r.roll();
}
}
},
default: onEnter,
close: () => { }
}, this.options());
return d.render(true);
]
}, { classes: ['bol', 'dialog'], width: 480 });
}
}
@@ -698,18 +695,15 @@ export class BoLDefaultRoll {
/* -------------------------------------------- */
async sendChatMessage() {
let actor = BoLUtility.getActorFromRollData(this.rollData)
this._buildChatMessage(this.rollData).then(async msgFlavor => {
//console.log("MSG", msgFlavor )
let msg = await this.rollData.roll.toMessage({
user: game.user.id,
rollMode: game.settings.get("core", "rollMode"),
flavor: msgFlavor,
speaker: ChatMessage.getSpeaker({ actor: actor }),
})
this.rollData.roll = foundry.utils.duplicate(this.rollData.roll) // Remove object, keep data (v111 ready)
msg.setFlag("world", "bol-roll-data", this.rollData)
})
const actor = BoLUtility.getActorFromRollData(this.rollData)
const rollMode = game.settings.get("core", "rollMode")
const msgFlavor = await this._buildChatMessage(this.rollData)
const msg = await this.rollData.roll.toMessage({
flavor: msgFlavor,
speaker: ChatMessage.getSpeaker({ actor: actor }),
}, { rollMode })
this.rollData.roll = foundry.utils.duplicate(this.rollData.roll)
if (msg) await msg.setFlag("world", "bol-roll-data", this.rollData)
}
/* -------------------------------------------- */

View File

@@ -249,7 +249,7 @@ export class BoLUtility {
payload: chatData,
});
renderTemplate('systems/bol/templates/item/post-item.hbs', chatData).then(html => {
foundry.applications.handlebars.renderTemplate('systems/bol/templates/item/post-item.hbs', chatData).then(html => {
let chatOptions = BoLUtility.chatDataSetup(html);
ChatMessage.create(chatOptions)
});
@@ -487,13 +487,17 @@ export class BoLUtility {
if (defenseMode == 'damage-with-armor') {
let armorFormula = defender.getArmorFormula()
rollData.rollArmor = new Roll(armorFormula)
await rollData.rollArmor.roll()
let msg = await rollData.rollArmor.toMessage({ flavor: game.i18n.localize("BOL.chat.armorRoll") + " : " + armorFormula });
if (game.dice3d) { // wait animation end when DsN is there
await game.dice3d.waitFor3DAnimationByMessageID(msg.id);
if (armorFormula === "0") {
rollData.armorProtect = 0
} else {
rollData.rollArmor = new Roll(armorFormula)
await rollData.rollArmor.roll()
let msg = await rollData.rollArmor.toMessage({ flavor: game.i18n.localize("BOL.chat.armorRoll") + " : " + armorFormula })
if (game.dice3d && msg) {
await game.dice3d.waitFor3DAnimationByMessageID(msg.id)
}
rollData.armorProtect = (rollData.rollArmor.total < 0) ? 0 : rollData.rollArmor.total
}
rollData.armorProtect = (rollData.rollArmor.total < 0) ? 0 : rollData.rollArmor.total
rollData.finalDamage = rollData.damageTotal - rollData.armorProtect
rollData.finalDamage = (rollData.finalDamage < 0) ? 0 : rollData.finalDamage
await defender.sufferDamage(rollData.finalDamage)
@@ -505,9 +509,17 @@ export class BoLUtility {
}
if (defenseMode == 'hero-reduce-damage') {
let armorFormula = defender.getArmorFormula()
rollData.rollArmor = new Roll(armorFormula)
await rollData.rollArmor.roll()
rollData.armorProtect = (rollData.rollArmor.total < 0) ? 0 : rollData.rollArmor.total
if (armorFormula === "0") {
rollData.armorProtect = 0
} else {
rollData.rollArmor = new Roll(armorFormula)
await rollData.rollArmor.roll()
let msg = await rollData.rollArmor.toMessage({ flavor: game.i18n.localize("BOL.chat.armorRoll") + " : " + armorFormula })
if (game.dice3d && msg) {
await game.dice3d.waitFor3DAnimationByMessageID(msg.id)
}
rollData.armorProtect = (rollData.rollArmor.total < 0) ? 0 : rollData.rollArmor.total
}
rollData.rollHero = new Roll("1d6")
await rollData.rollHero.roll()
rollData.finalDamage = rollData.damageTotal - rollData.rollHero.total - rollData.armorProtect
@@ -542,13 +554,13 @@ export class BoLUtility {
ChatMessage.create({
alias: defender.name,
whisper: BoLUtility.getWhisperRecipientsAndGMs(defender.name),
content: await renderTemplate('systems/bol/templates/chat/rolls/defense-result-card.hbs', damageResults)
content: await foundry.applications.handlebars.foundry.applications.handlebars.renderTemplate('systems/bol/templates/chat/rolls/defense-result-card.hbs', damageResults)
})
console.log("Defender data : ", defenderUser)
ChatMessage.create({
alias: defender.name,
whisper: BoLUtility.getOtherWhisperRecipients(defenderUser?.name),
content: await renderTemplate('systems/bol/templates/chat/rolls/defense-summary-card.hbs', damageResults)
content: await foundry.applications.handlebars.foundry.applications.handlebars.renderTemplate('systems/bol/templates/chat/rolls/defense-summary-card.hbs', damageResults)
})
}
}
@@ -635,7 +647,7 @@ export class BoLUtility {
let msg = await ChatMessage.create({
alias: defender.name,
whisper: BoLUtility.getWhisperRecipientsAndGMs(defender.name),
content: await renderTemplate('systems/bol/templates/chat/rolls/defense-request-card.hbs', {
content: await foundry.applications.handlebars.foundry.applications.handlebars.renderTemplate('systems/bol/templates/chat/rolls/defense-request-card.hbs', {
attackId: rollData.id,
attacker: rollData.attacker,
defender: defender,

View File

@@ -188,25 +188,25 @@ BOL.rangeModifiers = {
"-8": "BOL.dialog.utmost"
}
BOL.difficultyModifiers = {
"4": "BOL.dialog.soeasy",
"3": "BOL.dialog.soeasy3",
"2": "BOL.dialog.veryeasy",
"1": "BOL.dialog.easy",
"0": "BOL.dialog.moderate",
"-1": "BOL.dialog.hard",
"-2": "BOL.dialog.tough",
"-3": "BOL.dialog.tough3",
"-4": "BOL.dialog.demanding",
"-5": "BOL.dialog.demanding5",
"-6": "BOL.dialog.formidable",
"-7": "BOL.dialog.formidable7",
"-8": "BOL.dialog.heroic",
"-9": "BOL.dialog.heroic9",
"-10": "BOL.dialog.mythic",
"-11": "BOL.dialog.mythic11",
"-12": "BOL.dialog.divine"
}
BOL.difficultyModifiers = [
{ value: "-12", label: "BOL.dialog.divine" },
{ value: "-11", label: "BOL.dialog.mythic11" },
{ value: "-10", label: "BOL.dialog.mythic" },
{ value: "-9", label: "BOL.dialog.heroic9" },
{ value: "-8", label: "BOL.dialog.heroic" },
{ value: "-7", label: "BOL.dialog.formidable7" },
{ value: "-6", label: "BOL.dialog.formidable" },
{ value: "-5", label: "BOL.dialog.demanding5" },
{ value: "-4", label: "BOL.dialog.demanding" },
{ value: "-3", label: "BOL.dialog.tough3" },
{ value: "-2", label: "BOL.dialog.tough" },
{ value: "-1", label: "BOL.dialog.hard" },
{ value: "0", label: "BOL.dialog.moderate" },
{ value: "1", label: "BOL.dialog.easy" },
{ value: "2", label: "BOL.dialog.veryeasy" },
{ value: "3", label: "BOL.dialog.soeasy3" },
{ value: "4", label: "BOL.dialog.soeasy" },
]
BOL.alchemyModifiers = {
"2": "BOL.dialog.veryeasy",

View File

@@ -52,6 +52,7 @@ export const preloadHandlebarsTemplates = async function () {
"systems/bol/templates/chat/rolls/alchemy-roll-card.hbs",
"systems/bol/templates/chat/rolls/selected-horoscope-roll-card.hbs",
"systems/bol/templates/chat/rolls/horoscope-roll-card.hbs",
"systems/bol/templates/chat/chat-welcome.hbs",
"systems/bol/templates/dialogs/aptitude-roll-part.hbs",
"systems/bol/templates/dialogs/attribute-roll-part.hbs",
"systems/bol/templates/dialogs/mod-roll-part.hbs",
@@ -62,7 +63,8 @@ export const preloadHandlebarsTemplates = async function () {
"systems/bol/templates/dialogs/flaws-roll-part.hbs",
"systems/bol/templates/dialogs/total-roll-part.hbs",
"systems/bol/templates/dialogs/fightoptions-roll-part.hbs",
"systems/bol/templates/dialogs/horoscope-roll-part.hbs"
"systems/bol/templates/dialogs/horoscope-roll-part.hbs",
"systems/bol/templates/apps/character-summary-template.html"
];
// Load the template parts