Skip to content
This repository has been archived by the owner on Jul 10, 2021. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
espositos committed Nov 25, 2020
2 parents 735b168 + e0717b4 commit eafc4ea
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [0.9.23] 2020-11-25
### Added
- SotDL - Added attribute rolls for multiple token selection thanks to Xacas

## [0.9.22] 2020-11-25
### Added
- PF2E - Added subcategory for toggles under Strikes
Expand Down
28 changes: 27 additions & 1 deletion scripts/actions/demonlord/demonlord-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,31 @@ export class ActionHandlerDemonlord extends ActionHandler {
return result;
}

_addMultiAttributes(list, tokenId, actors) {
let result = this.initializeEmptyCategory('attributes');
let attributes = this.initializeEmptySubcategory();
let macroType = 'challenge';

let attributesMap = null;

if (actors.every(actor => {
let rollableAttributes = Object.entries(actor.data.data.attributes);

attributesMap = rollableAttributes.map(c => {
let name = this.i18n('tokenactionhud.attribute.' + c[0]);
let encodedValue = [macroType, tokenId, c[0]].join(this.delimiter);
return { name: name, encodedValue: encodedValue, id: c[0] }
});
}));

if (attributesMap != null) {
attributes.actions = this._produceMap(tokenId, attributesMap, macroType);

this._combineSubcategoryWithCategory(result, this.i18n('tokenactionhud.settings.demonlord.challenge'), attributes);
this._combineCategoryWithList(list, this.i18n('tokenactionhud.settings.demonlord.challenge'), result)
}
}

_getTalents(actor, tokenId) {
let macroType = 'talent';
let result = this.initializeEmptyCategory('talents');
Expand Down Expand Up @@ -180,9 +205,10 @@ export class ActionHandlerDemonlord extends ActionHandler {
list.tokenId = 'multi';
list.actorId = 'multi';

const allowedTypes = ['monster', 'character'];
const allowedTypes = ['creature', 'character'];
let actors = canvas.tokens.controlled.map(t => t.actor).filter(a => allowedTypes.includes(a.data.type));

this._addMultiAttributes(list, list.tokenId, actors);
this._addMultiUtilities(list, list.tokenId, actors);
}

Expand Down

0 comments on commit eafc4ea

Please sign in to comment.