mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +01:00
Adding the ability to target downtime actions.
This commit is contained in:
parent
c83fe25a47
commit
88b61c3a94
8 changed files with 70 additions and 17 deletions
|
|
@ -33,7 +33,8 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
initial: 'action',
|
||||
nullable: false,
|
||||
required: true
|
||||
})
|
||||
}),
|
||||
targetUuid: new fields.StringField({ initial: undefined })
|
||||
};
|
||||
|
||||
this.extraSchemas.forEach(s => {
|
||||
|
|
@ -241,7 +242,8 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
selectedRollMode: game.settings.get('core', 'rollMode'),
|
||||
data: this.getRollData(),
|
||||
evaluate: this.hasRoll,
|
||||
resourceUpdates: new ResourceUpdateMap(this.actor)
|
||||
resourceUpdates: new ResourceUpdateMap(this.actor),
|
||||
targetUuid: this.targetUuid
|
||||
};
|
||||
|
||||
DHBaseAction.applyKeybindings(config);
|
||||
|
|
|
|||
|
|
@ -25,9 +25,12 @@ export default class TargetField extends fields.SchemaField {
|
|||
config.hasTarget = true;
|
||||
let targets;
|
||||
// If the Action is configured as self-targeted, set targets as the owner. Probably better way than to fallback to getDependentTokens
|
||||
if (this.target?.type === CONFIG.DH.GENERAL.targetTypes.self.id)
|
||||
if (this.target?.type === CONFIG.DH.GENERAL.targetTypes.self.id) {
|
||||
targets = [this.actor.token ?? this.actor.prototypeToken];
|
||||
else {
|
||||
} else if (config.targetUuid) {
|
||||
const actor = fromUuidSync(config.targetUuid);
|
||||
targets = [actor.token ?? actor.prototypeToken];
|
||||
} else {
|
||||
targets = Array.from(game.user.targets);
|
||||
if (this.target.type !== CONFIG.DH.GENERAL.targetTypes.any.id) {
|
||||
targets = targets.filter(target => TargetField.isTargetFriendly(this.actor, target, this.target.type));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue