Add spells and alchemy

This commit is contained in:
2022-01-23 09:25:09 +01:00
parent 5eb059a2fa
commit aeb7739879
28 changed files with 696 additions and 71 deletions

View File

@ -1,5 +1,8 @@
import { BoLDefaultRoll } from "../controllers/bol-rolls.js";
// Spell circle to min PP cost
const __circle2minpp = { 0: 0, 1: 2,2: 6, 3: 11}
export class BoLUtility {
@ -375,6 +378,14 @@ export class BoLUtility {
if (sockmsg.name == "msg_damage_handling") {
BoLUtility.processDamageHandling(sockmsg.data.event, sockmsg.data.attackId, sockmsg.data.defenseMode)
}
}
/* -------------------------------------------- */
static computeSpellCost( spell, nbOptCond= 0) {
let pp = spell.data.data.properties.ppcost
let minpp = __circle2minpp[spell.data.data.properties.circle]
pp = (pp-nbOptCond<minpp) ? minpp : pp-nbOptCond
return pp
}
/* -------------------------------------------- */

View File

@ -27,6 +27,20 @@ BOL.damageMultiplier = {
"4": "x4",
}
BOL.spellType = {
"0": "BOL.spellItem.charm",
"1": "BOL.spellItem.circle1",
"2": "BOL.spellItem.circle2",
"3": "BOL.spellItem.circle3"
}
BOL.alchemyType = {
"common": "BOL.alchemyItem.common",
"scarce": "BOL.alchemyItem.scarce",
"legend": "BOL.alchemyItem.legend",
"mythic": "BOL.alchemyItem.mythic",
}
BOL.equipmentSlots = {
"none" : "BOL.equipmentSlots.none",
"head" : "BOL.equipmentSlots.head",
@ -115,6 +129,7 @@ BOL.itemCategories = {
"equipment" : "BOL.itemCategory.equipment",
"capacity" : "BOL.itemCategory.capacity",
"spell" : "BOL.itemCategory.spell",
"alchemy" : "BOL.itemCategory.alchemy",
"vehicle" : "BOL.itemCategory.vehicle",
"other" : "BOL.itemCategory.other"
}

View File

@ -63,7 +63,14 @@ export const registerHandlebarsHelpers = function () {
Handlebars.registerHelper('or3', function (val1, val2, val3) {
return val1 || val2 || val3;
});
Handlebars.registerHelper('for', function(from, to, incr, block) {
var accum = '';
for(var i = from; i < to; i += incr)
accum += block.fn(i);
return accum;
});
Handlebars.registerHelper('not', function (cond) {
return !cond;
});
@ -94,6 +101,10 @@ export const registerHandlebarsHelpers = function () {
Handlebars.registerHelper('add', function (a, b) {
return parseInt(a) + parseInt(b);
});
Handlebars.registerHelper('sub', function (a, b) {
return parseInt(a) - parseInt(b);
});
Handlebars.registerHelper('valueAtIndex', function (arr, idx) {
return arr[idx];

View File

@ -14,6 +14,7 @@ export const preloadHandlebarsTemplates = async function () {
"systems/bol/templates/actor/parts/tabs/actor-actions.hbs",
"systems/bol/templates/actor/parts/tabs/actor-features.hbs",
"systems/bol/templates/actor/parts/tabs/actor-equipment.hbs",
"systems/bol/templates/actor/parts/tabs/actor-spellalchemy.hbs",
// ITEMS
"systems/bol/templates/item/parts/item-header.hbs",
"systems/bol/templates/item/parts/properties/feature-properties.hbs",
@ -24,6 +25,7 @@ export const preloadHandlebarsTemplates = async function () {
"systems/bol/templates/item/parts/properties/item/protection-properties.hbs",
"systems/bol/templates/item/parts/properties/item/weapon-properties.hbs",
"systems/bol/templates/item/parts/properties/item/spell-properties.hbs",
"systems/bol/templates/item/parts/properties/item/alchemy-properties.hbs",
"systems/bol/templates/item/parts/properties/item/magical-properties.hbs",
"systems/bol/templates/item/parts/properties/feature/career-properties.hbs",
"systems/bol/templates/item/parts/properties/feature/boon-properties.hbs",
@ -33,6 +35,8 @@ export const preloadHandlebarsTemplates = async function () {
// DIALOGS
"systems/bol/templates/chat/rolls/attack-damage-card.hbs",
"systems/bol/templates/chat/rolls/spell-roll-card.hbs",
"systems/bol/templates/chat/rolls/alchemy-roll-card.hbs",
"systems/bol/templates/roll/parts/roll-dialog-modifiers.hbs",
"systems/bol/templates/roll/parts/roll-dialog-attribute.hbs",
"systems/bol/templates/dialogs/aptitude-roll-part.hbs",