Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
etiquettestartshere committed May 13, 2024
1 parent 6cd79e1 commit 2f2e455
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions scripts/damage-application.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { MODULE, socketID } from "./const.mjs";
/**
* Check targets for ownership when determining which target selection mode to use.
* @param {Array} targets Array of objects with target data, including UUID.
* @returns {boolean}
* @returns {boolean}
*/
async function ownershipCheck(targets) {
for (const target of targets) {
Expand All @@ -28,6 +28,9 @@ const MULTIPLIERS = [[-1, "-1"], [0, "0"], [.25, "¼"], [.5, "½"], [1, "1"], [2

export default class EffectiveDAE extends dnd5e.applications.components.DamageApplicationElement {

/**
* Determine which target selection mode to use based on damageTarget setting state.
*/
/** @override */
async connectedCallback() {
// Fetch the associated chat message
Expand Down Expand Up @@ -73,6 +76,7 @@ export default class EffectiveDAE extends dnd5e.applications.components.DamageAp
);
if (!this.chatMessage.getFlag("dnd5e", "targets")?.length) this.targetSourceControl.hidden = true;

// If damageTarget setting is disabled, check if users own any targeted tokens, otherwise use "selected" mode
if (!game.settings.get(MODULE, "damageTarget")) {
const targets = this.chatMessage.getFlag("dnd5e", "targets");
if (!await ownershipCheck(targets)) this.targetSourceControl.hidden = true;
Expand Down Expand Up @@ -154,11 +158,11 @@ export default class EffectiveDAE extends dnd5e.applications.components.DamageAp
}

/**
* Handle clicking the apply damage button.
* @param {PointerEvent} event Triggering click event.
* Extends this method to emit a request for the active GM client to damage a non-owned actor.
* Special handling is required for the Set `this.damages.properties`.
*/
* Handle clicking the apply damage button.
* @param {PointerEvent} event Triggering click event.
* Extends this method to emit a request for the active GM client to damage a non-owned actor.
* Special handling is required for the Set `this.damages.properties`.
*/
/** @override */
async _onApplyDamage(event) {
event.preventDefault();
Expand Down

0 comments on commit 2f2e455

Please sign in to comment.