diff --git a/module/actor/actor.js b/module/actor/actor.js index cdcb25d..b9c7a1c 100644 --- a/module/actor/actor.js +++ b/module/actor/actor.js @@ -22,6 +22,17 @@ export class BoLActor extends Actor { super.prepareData() } + /* -------------------------------------------- */ + isHeroAdversary() { + if (this.type === 'character') { + return true + } + if (this.type === 'encounter' && this.chartype == "adversary") { + return true + } + return false + } + /* -------------------------------------------- */ getCharType() { if (this.type === 'character') { @@ -32,10 +43,10 @@ export class BoLActor extends Actor { /* -------------------------------------------- */ getVillainy() { - if (this.type === 'character') { - return false + if (this.type === 'encounter' && this.chartype == "adversary") { + return true } - return true + return false } /* -------------------------------------------- */ @@ -734,7 +745,7 @@ export class BoLActor extends Actor { 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 }) + 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) { diff --git a/module/controllers/bol-rolls.js b/module/controllers/bol-rolls.js index a2eaad2..1fd4434 100644 --- a/module/controllers/bol-rolls.js +++ b/module/controllers/bol-rolls.js @@ -523,6 +523,7 @@ export class BoLRoll { rollData.nbBoons = 0 rollData.nbFlaws = 0 rollData.nbDice = 0 + rollData.isHeroAdversary = actor.isHeroAdversary() if (rollData.shieldBlock == 'blockall') { rollData.shieldMalus = rollData.shieldAttackMalus; } else { diff --git a/module/system/bol-utility.js b/module/system/bol-utility.js index b1032c0..b94a635 100644 --- a/module/system/bol-utility.js +++ b/module/system/bol-utility.js @@ -191,29 +191,6 @@ export class BoLUtility { CONFIG.statusEffects = duplicate(game.bol.config.statusEffects) } - /* -------------------------------------------- */ - static templateData(it) { - return BoLUtility.data(it)?.data ?? {} - } - - /* -------------------------------------------- */ - static data(it) { - if (it instanceof Actor || it instanceof Item || it instanceof Combatant) { - return it.data; - } - return it; - } - - /* -------------------------------------------- */ - static storeRoll(roll) { - this.rollTab[roll.id] = roll - } - - /* -------------------------------------------- */ - static getRoll(rollId) { - return this.rollTab[roll.id] - } - /* -------------------------------------------- */ static createDirectOptionList(min, max) { let options = {}; @@ -258,7 +235,7 @@ export class BoLUtility { } /* -------------------------------------------- */ static getUsers(filter) { - return game.users.filter(filter).map(user => user.data._id); + return game.users.filter(filter).map(user => user.id); } /* -------------------------------------------- */ static getWhisperRecipients(rollMode, name) { @@ -522,7 +499,7 @@ export class BoLUtility { } /* -------------------------------------------- */ static isRangedWeapon(weapon) { - return weapon.data.type == 'ranged' || weapon.data.thrown; + return weapon.system.type == 'ranged' || weapon.system.thrown; } /* -------------------------------------------- */ @@ -604,15 +581,15 @@ export class BoLUtility { /* -------------------------------------------- */ static computeSpellCost(spell, nbOptCond = 0) { - let pp = spell.data.properties.ppcost - let minpp = __circle2minpp[spell.data.properties.circle] + let pp = spell.system.properties.ppcost + let minpp = __circle2minpp[spell.system.properties.circle] pp = (pp - nbOptCond < minpp) ? minpp : pp - nbOptCond return pp } /* -------------------------------------------- */ static getDamageFormula(weaponData, fightOption) { - let upgradeDamage = (fightOption && fightOption.data.properties.fightoptiontype == "twoweaponsatt") + let upgradeDamage = (fightOption && fightOption.system.properties.fightoptiontype == "twoweaponsatt") let damageString = weaponData.properties.damage let modifier = weaponData.properties.damageModifiers ?? 0 let multiplier = weaponData.properties.damageMultiplier ?? 1 diff --git a/module/system/helpers.js b/module/system/helpers.js index 8d9d7e8..5c40121 100644 --- a/module/system/helpers.js +++ b/module/system/helpers.js @@ -118,7 +118,7 @@ export const registerHandlebarsHelpers = function () { }) Handlebars.registerHelper('includesKey', function (items, type, key) { // console.log(items); - return items.filter(i => i.type === type).map(i => i.data.key).includes(key); + return items.filter(i => i.type === type).map(i => i.system.key).includes(key); }) Handlebars.registerHelper('includes', function (array, val) { return array.includes(val); diff --git a/module/system/hooks.js b/module/system/hooks.js index 01be958..02d7c77 100644 --- a/module/system/hooks.js +++ b/module/system/hooks.js @@ -49,7 +49,7 @@ export default function registerHooks() { let macro = game.macros.entities.find(m => (m.name === actor.name) && (m.command === command)); if (!macro) { macro = await Macro.create({ - name: actor.data.name, + name: actor.name, type: "script", img: "icons/svg/dice-target.svg", command: command @@ -65,9 +65,9 @@ export default function registerHooks() { let macro = game.macros.entities.find(m => (m.name === journal.name) && (m.command === command)); if (!macro) { macro = await Macro.create({ - name: journal.data.name, + name: journal.name, type: "script", - img: (journal.data.img) ? journal.data.img : "icons/svg/book.svg", + img: (journal.img) ? journal.img : "icons/svg/book.svg", command: command }, {displaySheet: false}) game.user.assignHotbarMacro(macro, slot); diff --git a/module/system/macros.js b/module/system/macros.js index fa57b71..1b1a1da 100644 --- a/module/system/macros.js +++ b/module/system/macros.js @@ -37,13 +37,13 @@ export class Macros { }; if(rollType === "attribute") { - let attribute = eval(`actor.data.data.attributes.${key}`); + let attribute = eval(`actor.system.attributes.${key}`); let rollLabel = (attribute.label) ? game.i18n.localize(attribute.label) : null; let description = actor.name + " - " + game.i18n.localize('BOL.ui.attributeCheck') + " - " + game.i18n.localize(attribute.label) ; BoLRoll.attributeRollDialog(actor, actorData, attribute, rollLabel, description, adv, mod); } else if(rollType === "aptitude") { - let aptitude = eval(`actor.data.data.aptitudes.${key}`); + let aptitude = eval(`actor.system.aptitudes.${key}`); let rollLabel = (aptitude.label) ? game.i18n.localize(aptitude.label) : null; let description = actor.name + " - " + game.i18n.localize('BOL.ui.aptitudeCheck') + " - " + game.i18n.localize(aptitude.label) ; BoLRoll.aptitudeRollDialog(actor, actorData, aptitude, rollLabel, description, adv, mod); diff --git a/system.json b/system.json index 77bb2b5..7f89bba 100644 --- a/system.json +++ b/system.json @@ -14,7 +14,7 @@ ], "url": "https://www.uberwald.me/gitea/public/bol", "license": "LICENSE.txt", - "version": "10.5.12", + "version": "10.5.13", "compatibility": { "minimum": "10", "verified": "10" @@ -202,7 +202,7 @@ ], "socket": true, "manifest": "https://www.uberwald.me/gitea/public/bol/raw/v10/system.json", - "download": "https://www.uberwald.me/gitea/public/bol/archive/bol-v10.5.12.zip", + "download": "https://www.uberwald.me/gitea/public/bol/archive/bol-v10.5.13.zip", "background": "systems/bol/ui/page_accueil.webp", "gridDistance": 1.5, "gridUnits": "m", diff --git a/templates/chat/chat-vitality-zero.hbs b/templates/chat/chat-vitality-zero.hbs index cd3619f..9576804 100644 --- a/templates/chat/chat-vitality-zero.hbs +++ b/templates/chat/chat-vitality-zero.hbs @@ -4,20 +4,25 @@
- - {{#if (eq hp 0)}} - {{localize "BOL.chat.vitalityzero" name=name hp=hp}} -
{{localize "BOL.chat.vitalityheroism"}} -
{{localize "BOL.chat.vitalityheroismhint"}} - {{else}} - {{localize "BOL.chat.vitalitydying" name=name hp=hp}} -
{{localize "BOL.chat.vitalitydyingheroism"}} - {{/if}} - {{#if (lt hp -5)}} -
{{localize "BOL.chat.isdead" name=name}} -
{{localize "BOL.chat.epitaph"}} - {{/if}} + {{#if isHeroAdversary}} + {{#if (eq hp 0)}} + {{localize "BOL.chat.vitalityzero" name=name hp=hp}} +
{{localize "BOL.chat.vitalityheroism"}} +
{{localize "BOL.chat.vitalityheroismhint"}} + {{else}} + {{localize "BOL.chat.vitalitydying" name=name hp=hp}} +
{{localize "BOL.chat.vitalitydyingheroism"}} + {{/if}} + + {{#if (lt hp -5)}} +
{{localize "BOL.chat.isdead" name=name}} +
{{localize "BOL.chat.epitaph"}} + {{/if}} + {{else}} +
{{localize "BOL.chat.isdead" name=name}} +
{{localize "BOL.chat.epitaph"}} + {{/if}}
diff --git a/templates/chat/rolls/defense-request-card.hbs b/templates/chat/rolls/defense-request-card.hbs index e41135d..3ca9093 100644 --- a/templates/chat/rolls/defense-request-card.hbs +++ b/templates/chat/rolls/defense-request-card.hbs @@ -8,13 +8,15 @@ -{{#if defender.system.resources.hero.value}} - +{{#if isHeroAdversary}} + {{#if (gt defender.system.resources.hero.value 0)}} + -{{#each defenderWeapons as |weapon idx|}} - -{{/each}} + {{#each defenderWeapons as |weapon idx|}} + + {{/each}} + {{/if}} +{{/if}} -{{/if}} \ No newline at end of file