Skip to content

Commit d7ef0a8

Browse files
committed
0.3.3
1 parent 4c3ae25 commit d7ef0a8

6 files changed

Lines changed: 83 additions & 53 deletions

File tree

CHANGELOG.md

Lines changed: 20 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,21 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
> Dictionary
9+
> (P) - A premium version of that animation is available.
10+
811
## [Unreleased]
912

13+
## [0.3.3] - 2024-08-09
14+
15+
### Added
16+
17+
- **New Animations**: Inner Radiance Torrent (P)
18+
19+
### Fixed
20+
21+
- Animations not properly inheriting multi-layer deep options and predicates.
22+
1023
## [0.3.2] - 2024-08-09
1124

1225
### Fixed
@@ -31,8 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3144
- Item Custom Animations Menu (#3)
3245
- `opacity`, `size`, `loopProperty`, and `animateProperty` effect options.
3346

34-
#### Animations
35-
- Rage
47+
- **New Animations**: Rage
3648

3749
### Fixed
3850

@@ -63,10 +75,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6375

6476
- Added a toggle to see the predicate data in the Token Image Manager.
6577
- Added an option to use existing feats in the Token Image Manager.
66-
67-
#### Animations
68-
69-
- Jaws
78+
- **New Animations**: Jaws
7079

7180
## [0.1.1] - 2024-08-01
7281

@@ -80,12 +89,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8089

8190
- "Developer mode" setting. Puts into console what is being played with what roll options. Automatically on in `npm run dev`.
8291
- Token Image Manager (#4)
83-
84-
#### Animations
85-
86-
- Melee Ignition
87-
- Jaws
88-
- Unarmed Attack / Fist
92+
- **New Animations**: Melee Ignition, Jaws, Unarmed Attack / Fist
8993

9094
### Changed
9195

@@ -110,22 +114,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
110114
### Changed
111115

112116
- `options.shape.value` to `options.shape.type`
113-
114-
#### Animations
115-
116-
- Light Pick
117-
- Firearm Group
118-
- Arquebus
119-
120-
#### Sounds
121-
122-
- Chain Lightning / Electric Arc
123-
- Bow Shots
124-
- Crossbow Shots
125-
126-
#### Unfinished
127-
128-
- Actor Animations Menu (#3)
117+
- **New Animations**: Light Pick, Firearm Group, Arquebus
118+
- **New Sounds**: Chain Lightning / Electric Arc, Bow Shots, Crossbow Shots
129119

130120
### Fixed
131121

@@ -153,15 +143,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
153143
- Moved internal structure
154144
- Pre-release versions to be semver compliant
155145

156-
[Unreleased]: https://github.com/MrVauxs/pf2e-graphics/compare/v0.2.0...HEAD
157-
[0.2.0]: https://github.com/MrVauxs/pf2e-graphics/compare/v0.1.3...v0.2.0
158-
[0.1.3]: https://github.com/MrVauxs/pf2e-graphics/compare/v0.1.2...v0.1.3
159-
[0.1.2]: https://github.com/MrVauxs/pf2e-graphics/compare/v0.1.1...v0.1.2
160-
[0.1.1]: https://github.com/MrVauxs/pf2e-graphics/compare/v0.1.0...v0.1.1
161-
[0.1.0]: https://github.com/MrVauxs/pf2e-graphics/compare/v0.0.9...v0.1.0
162-
[0.0.9]: https://github.com/MrVauxs/pf2e-graphics/compare/v0.0.8-alpha...v0.0.9
163-
164-
[Unreleased]: https://github.com/MrVauxs/pf2e-graphics/compare/v0.3.2...HEAD
146+
[Unreleased]: https://github.com/MrVauxs/pf2e-graphics/compare/v0.3.3...HEAD
147+
[0.3.3]: https://github.com/MrVauxs/pf2e-graphics/compare/v0.3.2...v0.3.3
165148
[0.3.2]: https://github.com/MrVauxs/pf2e-graphics/compare/v0.3.1...v0.3.2
166149
[0.3.1]: https://github.com/MrVauxs/pf2e-graphics/compare/v0.3.0...v0.3.1
167150
[0.3.0]: https://github.com/MrVauxs/pf2e-graphics/compare/v0.2.1...v0.3.0

animations/spells.json

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
"file": "jb2a.unarmed_strike.magical.{01,02}.blue"
102102
}
103103
],
104-
"item:slug:fireball": [
104+
"origin:item:slug:fireball": [
105105
{
106106
"trigger": "place-template",
107107
"default": true,
@@ -132,5 +132,20 @@
132132
}
133133
]
134134
}
135+
],
136+
"origin:item:slug:inner-radiance-torrent": [
137+
{
138+
"trigger": "place-template",
139+
"preset": "ranged",
140+
"file": "jb2a.ranged.beam.001.01.orange",
141+
"options": {
142+
"atLocation": {
143+
"offset": {
144+
"x": 0.5
145+
},
146+
"gridUnits": true
147+
}
148+
}
149+
}
135150
]
136-
}
151+
}

src/storage/AnimCore.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ErrorMsg, dedupeStrings, dev, devMessage, findTokenByActor, getPlayerOwners, log, nonNullable } from 'src/utils.ts'
1+
import { ErrorMsg, dedupeStrings, dev, devMessage, findTokenByActor, getPlayerOwners, log, mergeObjectsConcatArrays, nonNullable } from 'src/utils.ts'
22
import type { Entries, TokenOrDoc } from 'src/extensions'
33
import { settings } from 'src/settings'
44
import { type PresetKeys, presets } from './presets'
@@ -157,20 +157,8 @@ export let AnimCore = class AnimCore {
157157
if (!isFolder(folder)) return [folder]
158158
const { contents, ...parentProps } = folder
159159

160-
// Function to merge two arrays without duplicates
161-
const mergeArrays = (arr1: PredicateStatement[], arr2: PredicateStatement[]) => {
162-
return Array.from(new Set([...(arr1 || []), ...(arr2 || [])]))
163-
}
164-
165160
const mergeProps = (parent: FolderObject, child: AnimationDataObject) => {
166-
const result = foundry.utils.mergeObject(child, parent, { overwrite: false })
167-
168-
// Merge arrays
169-
for (const [key, val] of Object.entries(parent) as Entries<FolderObject>) {
170-
if (Array.isArray(val) && key !== 'contents') {
171-
result[key] = mergeArrays(parent[key], child[key] || [])
172-
}
173-
}
161+
const result = mergeObjectsConcatArrays(parent, child)
174162

175163
return result
176164
}
@@ -344,6 +332,7 @@ interface AnimationDataObject {
344332
default?: boolean
345333
predicate?: PredicateStatement[]
346334
options?: any
335+
[key: string]: any
347336
}
348337

349338
// #endregion

src/storage/presets.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ export const helpers = {
4242
},
4343
genericSequencerFunctions<T extends PresetKeys>(seq: EffectSection, _item: ItemPF2e, _target: Target, options?: EffectOptions<T>) {
4444
options = clearEmpties(options || {})
45+
if (options?.zIndex)
46+
seq.zIndex(options.zIndex)
4547
if (options?.scale)
4648
seq.scale(options.scale.min, options.scale.max)
4749
if (options?.scaleToObject)
@@ -142,6 +144,7 @@ export interface EffectOptions<T extends PresetKeys> {
142144
tieToDocuments?: true
143145
belowTokens?: boolean
144146
waitUntilFinished?: number
147+
zIndex?: number
145148
duration?: number
146149
tint?: string
147150
rotate?: number

src/utils.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-prototype-builtins */
12
/* eslint-disable no-console */
23
export class ErrorMsg extends Error {
34
constructor(message: string) {
@@ -74,3 +75,41 @@ export function clearEmpties(o: Record<string, any>) {
7475
}
7576
return o
7677
}
78+
79+
type Primitive = string | number | boolean | null | undefined
80+
type Mergeable = Primitive | MergeableObject | MergeableArray
81+
type MergeableArray = Mergeable[]
82+
interface MergeableObject {
83+
[key: string]: Mergeable
84+
}
85+
86+
export function mergeObjectsConcatArrays<T extends MergeableObject, U extends MergeableObject>(obj1: T, obj2: U): T & U {
87+
const result: any = {}
88+
89+
for (const key in obj1) {
90+
if (obj1.hasOwnProperty(key)) {
91+
if (obj2.hasOwnProperty(key)) {
92+
const value1 = obj1[key]
93+
const value2 = obj2[key]
94+
95+
if (Array.isArray(value1) && Array.isArray(value2)) {
96+
result[key] = value1.concat(value2)
97+
} else if (typeof value1 === 'object' && typeof value2 === 'object' && value1 !== null && value2 !== null) {
98+
result[key] = mergeObjectsConcatArrays(value1 as MergeableObject, value2 as MergeableObject)
99+
} else {
100+
result[key] = value2
101+
}
102+
} else {
103+
result[key] = obj1[key]
104+
}
105+
}
106+
}
107+
108+
for (const key in obj2) {
109+
if (obj2.hasOwnProperty(key) && !result.hasOwnProperty(key)) {
110+
result[key] = obj2[key]
111+
}
112+
}
113+
114+
return result as T & U
115+
}

src/view/_components/SubAnimationEditor.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
type='text'
6161
bind:value={animation.file}
6262
/>
63+
<!-- svelte-ignore missing-declaration -->
6364
<button
6465
class='fas fa-database w-min h-full'
6566
data-tooltip='SEQUENCER.SidebarButtons.Database'

0 commit comments

Comments
 (0)