Skip to content

Commit

Permalink
Fiunishing move fixes (#72)
Browse files Browse the repository at this point in the history
* Refactored Token Menu to a new file

* Fixed bug with doSomethingOnDamageApply

* Add Shake on attack features

* Fixed issue with toke nsettings

* Added handling proper for dice so nice on new shake on attack

* Changed Rotate Easing
- for a cooler effect feel

* Possible fixes for module.json

* Shake on attack on by default

* Added machine translated (French. german, spanish, polish)

* removed broken translations

* changelog

* Add new header text for shake on attack

* moving code back to run on the creator of the chat message's machine

* Fixes
- Added z index to Crits so they play nice with finishing move
- Added Sync groups to crits & finishingMoves
  • Loading branch information
ChasarooniZ authored Aug 5, 2024
1 parent f4763ec commit 59a69b4
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
1 change: 1 addition & 0 deletions languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"title": "Token Damage Shake",
"scaling": "Token Damage Shake - Scaling"
},
"shake-on-attack": "Shake on Attack",
"rotate-on-attack": "Rotate on Attack",
"finishing-move": {
"title": "Finishing Moves",
Expand Down
5 changes: 5 additions & 0 deletions scripts/helpers/animation/crit/fireEmblemCrit.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export async function fireEmblemCrit(token, users, imgData, config) {
await new Sequence()
//background
.effect()
.zIndex(-1)
.syncGroup(`fe-crit-${token.uuid}`)
.shape("rectangle", {
lineSize: 0,
width: windowWidth,
Expand All @@ -62,6 +64,8 @@ export async function fireEmblemCrit(token, users, imgData, config) {
.screenSpaceAboveUI()
//Image
.effect()
.zIndex(0)
.syncGroup(`fe-crit-${token.uuid}`)
.file(imageUrl)
.animateProperty("sprite", "position.x", {
from: -distance * 1.5 / (scaleFactorHalf),
Expand All @@ -84,6 +88,7 @@ export async function fireEmblemCrit(token, users, imgData, config) {
.screenSpaceAboveUI()
//Sound
.sound()
.syncGroup(`fe-crit-${token.uuid}`)
.file(soundUrl)
.fadeOutAudio(duration / 4)
.volume(volumeLevel)
Expand Down
12 changes: 8 additions & 4 deletions scripts/helpers/animation/crit/personaCrit.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ export function personaCrit(token, users, imgData, config) {

await Sequencer.Preloader.preloadForClients([imageUrl, soundUrl]);
await new Sequence()
//BG Color
.effect()
.syncGroup(`p5-crit-${token.uuid}`)
.shape("polygon", { points: centeredPoints, fillColor: game.user.color.css, fillAlpha: 1 })
.screenSpace()
.screenSpacePosition({ x: 0, y: 0 })
Expand All @@ -128,8 +130,9 @@ export function personaCrit(token, users, imgData, config) {
.duration(duration)
.forUsers(users)
.delay(config.delay)

.effect() // Image
//Image
.effect()
.syncGroup(`p5-crit-${token.uuid}`)
.file(imageUrl)
.zIndex(0)
.shape("polygon", { isMask: true, points: centeredPoints })
Expand All @@ -143,8 +146,9 @@ export function personaCrit(token, users, imgData, config) {
.duration(duration)
.forUsers(users)
.delay(config.delay)

.effect() //Outline
//Outline
.effect()
.syncGroup(`p5-crit-${token.uuid}`)
.zIndex(1)
.shape("polygon", { points: centeredPoints, fillAlpha: 0, lineSize: 10, lineColor: "white" })
.screenSpace()
Expand Down
2 changes: 2 additions & 0 deletions scripts/helpers/animation/finishingMove.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export async function createFinishingMoveAnimation(text) {
words.forEach((word, i) => {
word = ` ${word} `;
seq.effect()
.zIndex(-2)
.syncGroup(`finishing-move-${text}`)
.text(word, style)
.screenSpace()
.screenSpaceAnchor({ x: sideBorderAmt + moveAmt * i + moveAmt / 2, y: 0.4 })
Expand Down
8 changes: 4 additions & 4 deletions scripts/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ Hooks.on("init", () => {
Hooks.on("ready", () => {
console.log("PF2e RPG Numbers is starting");
createAPI();
if (game.user.isGM) {
Hooks.on("createChatMessage", async function (msg, _status, _userid) {
Hooks.on("createChatMessage", async function (msg, _status, userid) {
if (game.user.id === userid) {
if (!getSetting("enabled")) return;
debugLog({
msg,
Expand All @@ -83,8 +83,8 @@ Hooks.on("ready", () => {
onDamageApplication(dat, msg);

basicActionAnimations(msg);
});
}
}
});

/**
* TODO Add visual pop ups over characters who's modifiers to rolls mattered (IDK how feasible this is)
Expand Down

0 comments on commit 59a69b4

Please sign in to comment.