Skip to content

Commit

Permalink
Merge pull request dmdorman#1326 from phBalance/phBalance/support-dif…
Browse files Browse the repository at this point in the history
…ferent-effects-in-AoE

Support different damage results for different targets (typically based on range)
  • Loading branch information
phBalance authored Dec 20, 2024
2 parents 43f30bb + 446238f commit f5a5d7b
Show file tree
Hide file tree
Showing 8 changed files with 219 additions and 237 deletions.
30 changes: 27 additions & 3 deletions module/handlebars-helpers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ export function initializeHandlebarsHelpers() {
Handlebars.registerHelper("gameConfigValue", gameConfigValue);
Handlebars.registerHelper("getModulePath", getModulePath);
Handlebars.registerHelper("includes", includes);
Handlebars.registerHelper("toJSON", toJSON);
Handlebars.registerHelper("toArray", toArray);
Handlebars.registerHelper("toJsonArray", toJsonArray);
Handlebars.registerHelper("increment", increment);
Handlebars.registerHelper("indexOf", indexOf);
Handlebars.registerHelper("is_active_segment", isActiveSegment);
Expand Down Expand Up @@ -39,6 +42,25 @@ function includes(str, searchTerm) {
return str?.includes(searchTerm);
}

function toJSON(context) {
return JSON.stringify(context);
}

/**
* Takes args and turns it into an array.
*
* @returns Array
*/
function toArray(arg) {
if (arg == null) return [];

return [arg];
}

function toJsonArray(arg) {
return toJSON(toArray(arg));
}

function toLowerCase(str) {
return str?.toLowerCase();
}
Expand All @@ -52,12 +74,14 @@ function isActiveSegment(actives, index) {
}

function concat() {
var outStr = "";
for (var arg in arguments) {
if (typeof arguments[arg] != "object") {
let outStr = "";

for (const arg in arguments) {
if (typeof arguments[arg] !== "object") {
outStr += arguments[arg];
}
}

return outStr;
}

Expand Down
2 changes: 1 addition & 1 deletion module/item/item-attack-application.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export class ItemAttackFormApplication extends FormApplication {
data.action = Attack.getActionInfo(
data.item,
data.targets,
data.formData, // use formdata to include player options from the form
data.formData, // use formData to include player options from the form
);
// the title seems to be fixed when the form is initialized,
// and doesn't change afterwards even if we come through here again
Expand Down
Loading

0 comments on commit f5a5d7b

Please sign in to comment.