mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Action chat message + formatTarget fix (#410)
This commit is contained in:
parent
62b9a8fbee
commit
fcba5041e9
6 changed files with 6 additions and 10 deletions
|
|
@ -117,6 +117,8 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
||||||
async use(event, ...args) {
|
async use(event, ...args) {
|
||||||
if (!this.actor) throw new Error("An Action can't be used outside of an Actor context.");
|
if (!this.actor) throw new Error("An Action can't be used outside of an Actor context.");
|
||||||
|
|
||||||
|
if(this.chatDisplay) this.toChat();
|
||||||
|
|
||||||
let config = this.prepareConfig(event);
|
let config = this.prepareConfig(event);
|
||||||
for(let i = 0; i < this.constructor.extraSchemas.length; i++) {
|
for(let i = 0; i < this.constructor.extraSchemas.length; i++) {
|
||||||
let clsField = this.constructor.getActionField(this.constructor.extraSchemas[i]);
|
let clsField = this.constructor.getActionField(this.constructor.extraSchemas[i]);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import DHBaseAction from '../../data/action/baseAction.mjs';
|
|
||||||
|
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
|
|
||||||
export default class DHAdversaryRoll extends foundry.abstract.TypeDataModel {
|
export default class DHAdversaryRoll extends foundry.abstract.TypeDataModel {
|
||||||
|
|
@ -44,7 +42,7 @@ export default class DHAdversaryRoll extends foundry.abstract.TypeDataModel {
|
||||||
this.hasHitTarget = this.targets.filter(t => t.hit === true).length > 0;
|
this.hasHitTarget = this.targets.filter(t => t.hit === true).length > 0;
|
||||||
this.currentTargets =
|
this.currentTargets =
|
||||||
this.targetSelection !== true
|
this.targetSelection !== true
|
||||||
? Array.from(game.user.targets).map(t => DHBaseAction.formatTarget(t))
|
? Array.from(game.user.targets).map(t => game.system.api.fields.ActionFields.TargetField.formatTarget(t))
|
||||||
: this.targets;
|
: this.targets;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import DHBaseAction from "../action/baseAction.mjs";
|
|
||||||
|
|
||||||
export default class DHApplyEffect extends foundry.abstract.TypeDataModel {
|
export default class DHApplyEffect extends foundry.abstract.TypeDataModel {
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
|
|
@ -27,7 +25,7 @@ export default class DHApplyEffect extends foundry.abstract.TypeDataModel {
|
||||||
this.hasHitTarget = this.targets.filter(t => t.hit === true).length > 0;
|
this.hasHitTarget = this.targets.filter(t => t.hit === true).length > 0;
|
||||||
this.currentTargets =
|
this.currentTargets =
|
||||||
this.targetSelection !== true
|
this.targetSelection !== true
|
||||||
? Array.from(game.user.targets).map(t => DHBaseAction.formatTarget(t))
|
? Array.from(game.user.targets).map(t => game.system.api.fields.ActionFields.TargetField.formatTarget(t))
|
||||||
: this.targets;
|
: this.targets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ export default class DHDamageRoll extends foundry.abstract.TypeDataModel {
|
||||||
this.hasHitTarget = this.targets.filter(t => t.hit === true).length > 0;
|
this.hasHitTarget = this.targets.filter(t => t.hit === true).length > 0;
|
||||||
this.currentTargets =
|
this.currentTargets =
|
||||||
this.targetSelection !== true
|
this.targetSelection !== true
|
||||||
? Array.from(game.user.targets).map(t => DHBaseAction.formatTarget(t))
|
? Array.from(game.user.targets).map(t => game.system.api.fields.ActionFields.TargetField.formatTarget(t))
|
||||||
: this.targets;
|
: this.targets;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -106,8 +106,6 @@ export default class DHItem extends foundry.documents.Item {
|
||||||
}
|
}
|
||||||
if (action) return action.use(event);
|
if (action) return action.use(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.toChat();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async toChat(origin) {
|
async toChat(origin) {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<label class="button-target-selection{{#unless @root.targetSelection}} target-selected{{/unless}}">{{localize "DAGGERHEART.UI.Chat.damageRoll.selectedTarget"}}</label>
|
<label class="button-target-selection{{#unless @root.targetSelection}} target-selected{{/unless}}">{{localize "DAGGERHEART.UI.Chat.damageRoll.selectedTarget"}}</label>
|
||||||
</div>
|
</div>
|
||||||
{{#if (and hasSave @root.targetSelection @root.hasHitTarget)}}
|
{{#if (and hasSave @root.targetSelection @root.hasHitTarget)}}
|
||||||
<button class="inner-button inner-button-right roll-all-save-button">{{localize "DAGERHEART.GENERAL.rollAll"}} <i class="fa-solid fa-shield"></i></button>
|
<button class="inner-button inner-button-right roll-all-save-button">{{localize "DAGGERHEART.GENERAL.rollAll"}} <i class="fa-solid fa-shield"></i></button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<div class="target-section">
|
<div class="target-section">
|
||||||
{{#each currentTargets as |target|}}
|
{{#each currentTargets as |target|}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue