Skip to content

Commit

Permalink
Fixed crit animation visibility
Browse files Browse the repository at this point in the history
fixed tokens dissappearing
  • Loading branch information
ChasarooniZ committed Mar 19, 2024
1 parent ff54f15 commit f430376
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions scripts/helpers/anim.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,9 @@ export function getTokenShakeScale(token, dmg) {
}
});
}

export function getVisibleAndMsgVisibleUsers(roll_deets) {
getVisibleUsers(roll_deets.token).filter((player) =>
(roll_deets.whisper.length === 0 ? game.users.map((u) => u.id) : roll_deets.whisper).includes(player)
);
}
4 changes: 2 additions & 2 deletions scripts/helpers/animation/crit-animation.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { getVisibleUsers } from "../anim.js";
import { getVisibleAndMsgVisibleUsers} from "../anim.js";
import { MODULE_ID } from "../misc.js";

export function createCritAnimation(roll_deets) {
const isAttack = roll_deets.type === "attack-roll";
const showOn = game.settings.get(MODULE_ID, "critical.show-on");
if ((showOn === "checks" && isAttack) || (showOn === "attacks" && !isAttack)) return;
const users = getVisibleUsers(roll_deets.token);
const users = getVisibleAndMsgVisibleUsers(roll_deets)
switch (game.settings.get(MODULE_ID, "critical.type")) {
case "persona":
personaCrit(roll_deets.token, users);
Expand Down
3 changes: 2 additions & 1 deletion scripts/helpers/animation/shakeOnDamageToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export function shakeOnDamageToken(actor_uuid, dmg) {
new Sequence()
.animation()
.on(token)
.delay(duration / 10)
.opacity(0)
.effect()
.atLocation(token)
Expand All @@ -36,10 +37,10 @@ export function shakeOnDamageToken(actor_uuid, dmg) {
pingPong: true,
})
.duration(duration)
.waitUntilFinished()
.forUsers(usersToPlayFor)
.animation()
.on(token)
.opacity(original_opacity)
.waitUntilFinished()
.play();
}

0 comments on commit f430376

Please sign in to comment.