Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ironmonk88 authored Jan 23, 2021
1 parent bfb1297 commit f1ef782
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions alwayshp.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,20 @@ export class AlwaysHP {
let effect = a && status ? status : CONFIG.controlIcons.defeated;
const exists = (effect.icon == undefined ? (t.data.overlayEffect == effect) : (a.effects.find(e => e.getFlag("core", "statusId") === effect.id) != undefined));
if (exists != active)
t.toggleEffect(effect, { overlay: true, active: active });
t.toggleEffect(effect, { overlay: true, active: (active == 'toggle' ? !exists : active) });
}

log('applying damage', a, value);
if (game.system.id == "dnd5e") {
a.applyDamage(value).then(() => {
AlwaysHP.refreshSelected();
});
} else {
AlwaysHP.applyDamage(a, value).then(() => {
AlwaysHP.refreshSelected();
});
if (value != 0) {
if (game.system.id == "dnd5e") {
a.applyDamage(value).then(() => {
AlwaysHP.refreshSelected();
});
} else {
AlwaysHP.applyDamage(a, value).then(() => {
AlwaysHP.refreshSelected();
});
}
}
}));
}
Expand Down Expand Up @@ -149,9 +151,13 @@ export class AlwaysHPApp extends Application {

html.find('#alwayshp-btn-dead').click(ev => {
ev.preventDefault();
log('set character to dead');
AlwaysHP.changeHP('zero', true);
this.clearInput();
if (ev.shiftKey == true)
AlwaysHP.changeHP(0, 'toggle');
else {
log('set character to dead');
AlwaysHP.changeHP('zero', true);
this.clearInput();
}
}).contextmenu(ev => {
ev.preventDefault();
log('set character to hurt');
Expand Down

0 comments on commit f1ef782

Please sign in to comment.