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

@ -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];