Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement impacts/debilities as ActiveEffects #770

Draft
wants to merge 178 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
178 commits
Select commit Hold shift + click to select a range
0e28183
icons. first pass at status
rsek May 23, 2023
80bf494
Merge branch 'data-model' into active-effects-impacts
rsek May 23, 2023
1cb8e9c
momentumMax/Reset as true attributes
rsek May 23, 2023
88e2740
bind burnMomentum
rsek May 23, 2023
e21fbaa
fix svg height/width
rsek May 23, 2023
bc922cc
force resource to 0 when e.g. wounded
rsek May 23, 2023
e2cd92c
adjust impact key. rewire sheet impact toggles
rsek May 23, 2023
44ec344
dynamic statusEffects (by toolset)
rsek May 23, 2023
9d63ad4
bind methods to parent instead
rsek May 23, 2023
417c6b9
Merge branch 'data-model' into active-effects-impacts
rsek May 24, 2023
c30bff2
change corrupted icon
rsek May 24, 2023
4ebb9b2
fallback icon for custom impacts
rsek May 24, 2023
8af0d07
implement custom impact toggles
rsek May 24, 2023
aae3e90
adjust comment
rsek May 24, 2023
7e6c218
clean up imports
rsek May 25, 2023
4ac4d99
rm duplicate const
rsek May 25, 2023
335a0d9
clean up imports
rsek May 25, 2023
5648673
use type import instead
rsek May 25, 2023
060b8a7
ux fixes. works on v11, except token global toggle
rsek May 25, 2023
a4f0c1f
trim commented code
rsek May 25, 2023
1becc17
Merge branch 'main' into active-effects-impacts
rsek May 29, 2023
f2b9374
Merge branch 'data-model' into active-effects-impacts
rsek Jun 5, 2023
9746558
rm unneeded escape
rsek Jun 5, 2023
25b5425
adjust ActiveEffect type inheritance
rsek Jun 6, 2023
60306b9
Merge branch 'main' into active-effects-impacts
rsek Jun 6, 2023
b53a0de
minor type adjustments. trim old code
rsek Jun 6, 2023
4787a5f
experiment: chat alerts from IronActiveEffect?
rsek Jun 7, 2023
4fec4fe
rm extraneous jsdoc type
rsek Jun 7, 2023
d7fc0f5
Merge remote-tracking branch 'origin/main' into active-effects-impacts
rsek Jun 9, 2023
952d8d3
Merge branch 'bar-shaped-attributes' into active-effects-impacts
rsek Jun 9, 2023
f5c53c4
mv _enableV10Validation to top
rsek Jun 9, 2023
164511f
clean up some code. introduce more constants
rsek Jun 9, 2023
8393d01
replace canBurnMomentum; adjust methods
rsek Jun 9, 2023
bc438a9
add another static prop
rsek Jun 9, 2023
562cf3e
rm starship debilities; standardize constants
rsek Jun 9, 2023
92d8bcd
types for FVTT Set enhancements
rsek Jun 10, 2023
192c916
status effect toggle by actor type
rsek Jun 10, 2023
2682d5e
trim some commented code. add document interface
rsek Jun 11, 2023
2821312
update to match new bar format
rsek Jun 11, 2023
9439f83
adjust types
rsek Jun 11, 2023
dd1f842
rm unused ts-expect-error directives
rsek Jun 12, 2023
a966e39
adjust type parameters
rsek Jun 12, 2023
c50de76
adjust type params... again
rsek Jun 12, 2023
6a6d515
Merge branch 'main' into active-effects-impacts
rsek Jun 12, 2023
eb37f7e
rm empty interface that tsc gets cranky about
rsek Jun 12, 2023
0bda748
update traumatized icon
rsek Jun 12, 2023
bda0475
new icon for indebted
rsek Jun 12, 2023
b328acc
use foundry icon instead of pulling in a new one
rsek Jun 12, 2023
de96e09
~~ no props ~ interface empty ~~
rsek Jun 12, 2023
6fe4f50
adjust momentum field migration
rsek Jun 12, 2023
747ff70
describe migrations in comments
rsek Jun 13, 2023
75daa68
rm template data that's overridden by data models
rsek Jun 13, 2023
0d7d543
new icon, more legible at small sizes
rsek Jun 13, 2023
7d1c984
expose IronActiveEffect ctor in CONFIG.IRONSWORN
rsek Jun 13, 2023
6929dca
make die 200% more cursed
rsek Jun 13, 2023
9fd2bf9
use `name` instead of `label`
rsek Jun 13, 2023
4667c7b
revert change ActiveEffect to label from name
rsek Jun 13, 2023
53f0c4b
general purpose impact component
rsek Jun 13, 2023
20475be
fix formatted locale strings
rsek Jun 13, 2023
de5b562
fix bad reference
rsek Jun 13, 2023
2938f68
freeze static property
rsek Jun 13, 2023
85ed098
mostly fixed but scrolly text not localized
rsek Jun 13, 2023
f3af7d9
localize in a getter so i18n loads first
rsek Jun 13, 2023
2f5998e
fix starship impacts
rsek Jun 13, 2023
21f635e
embiggen impact icons
rsek Jun 13, 2023
737d48b
add workaround for missing title attributes
rsek Jun 13, 2023
7c5f447
revert pkg updates to match main
rsek Jun 13, 2023
30da4eb
*really* match main this time
rsek Jun 13, 2023
8a18bdf
Merge remote-tracking branch 'upstream/main' into active-effects-impacts
rsek Jun 13, 2023
92aa078
clean up unused code
rsek Jun 13, 2023
684150c
rm unused import
rsek Jun 13, 2023
234ee66
Merge branch 'main' into active-effects-impacts
rsek Jun 14, 2023
9abff60
Merge branch 'main' into active-effects-impacts
rsek Jun 15, 2023
409d1f6
provide some additional methods from datamodel
rsek Jun 15, 2023
a17947c
Merge remote-tracking branch 'upstream/main' into active-effects-impacts
rsek Jun 15, 2023
1e8955e
fix momentum max regress; add barMax prop
rsek Jun 16, 2023
21e02ed
adjustments to props
rsek Jun 16, 2023
90c3a65
clarify property names; localize fallback name
rsek Jun 16, 2023
24db289
clean up imports, eslint directive
rsek Jun 16, 2023
65bae31
WIP: initial pass at setting-sensitive impacts
rsek Jun 16, 2023
1e282de
rm bad import
rsek Jun 16, 2023
680e947
clean up renderTokenHUD hook
rsek Jun 16, 2023
f378e66
steamline getters
rsek Jun 16, 2023
f0d1cbe
rm comment
rsek Jun 17, 2023
70c6e2b
use ctor in CONFIG at runtime
rsek Jun 17, 2023
44ccdd7
prefer indirect references
rsek Jun 17, 2023
66aa28c
prefer ctor in CONFIG
rsek Jun 17, 2023
2e0e423
prefer ctor in config
rsek Jun 17, 2023
387bad7
prefer indirect reference
rsek Jun 17, 2023
3212b99
explicit typing instead of relying on alias
rsek Jun 17, 2023
e37d11f
Revert "WIP: initial pass at setting-sensitive impacts"
rsek Jun 17, 2023
6212c9b
brand impacts with ruleset; infer starship toolset
rsek Jun 17, 2023
08f86e4
full replacement for status icons
rsek Jun 17, 2023
12b0fb2
Merge branch 'main' into active-effects-impacts
rsek Jun 17, 2023
9f23a5a
rm status effects declaration
rsek Jun 17, 2023
753d160
begin reimplementing settings
rsek Jun 17, 2023
0cf4d46
WIP - nearly working again
rsek Jun 17, 2023
4ab5102
WIP - circumvent type recursion
rsek Jun 17, 2023
da2418d
Merge branch 'active-effects-impacts' of https://github.com/rsek/foun…
rsek Jun 17, 2023
ffab748
new custom impact implementation
rsek Jun 17, 2023
9d2d781
working PC sheet; new custom impact handler
rsek Jun 18, 2023
6141399
rm console msg and adjust type
rsek Jun 18, 2023
9fa5c4c
"locked" bars for certain impacts
rsek Jun 18, 2023
a38c2df
fix some bar styling. icons in tooltip when locked
rsek Jun 18, 2023
7c49fda
momentum meter fixes
rsek Jun 18, 2023
088f483
adjust hover color
rsek Jun 18, 2023
fabca39
adjust icon (reserve lock for UX lock/unlock)
rsek Jun 18, 2023
381b5df
"globalConditionChanged" => "globalImpactChanged"
rsek Jun 19, 2023
8aecd6a
extra active effect config to its own config file
rsek Jun 19, 2023
ec5037c
add resource lock hint
rsek Jun 19, 2023
5854882
adjust slider props, styles
rsek Jun 19, 2023
f49090e
use relative sizing for img
rsek Jun 19, 2023
2a6ae8f
rm compatibility warning hider
rsek Jun 19, 2023
4effd49
add a missing inherited method
rsek Jun 19, 2023
edadccf
statusEffects checks current actor instead
rsek Jun 19, 2023
b901468
comment out some code for now
rsek Jun 19, 2023
25e6ee7
rm console.log
rsek Jun 19, 2023
ee71a64
rm console.log
rsek Jun 19, 2023
472aad5
adjust highlight filters
rsek Jun 19, 2023
d47df80
restore global condition highlight
rsek Jun 19, 2023
909c255
highlight children so it doesn't double up
rsek Jun 19, 2023
0823a3d
adjust custom impact styling
rsek Jun 19, 2023
79dbcb9
rm shared sheet impacts for now
rsek Jun 19, 2023
850b6be
restore localization keys
rsek Jun 19, 2023
a43049d
add page numbers
rsek Jun 19, 2023
7ced7bd
fix compact sheet buttons
rsek Jun 19, 2023
99cc368
merge updated HeaderButton type declaration
rsek Jun 19, 2023
6d892c5
compact header buttons for the compact sheet
rsek Jun 19, 2023
943ab81
adjust custom impact flex. adjust overlay contrast
rsek Jun 19, 2023
b1c6bb9
relabel HUD button + disable when no impacts
rsek Jun 19, 2023
2127f40
match main's import order
rsek Jun 19, 2023
ceab5a8
clean up imports
rsek Jun 19, 2023
1f73df0
prune + update some comments
rsek Jun 19, 2023
5928d55
clean up comments
rsek Jun 19, 2023
fcf0824
clean up comments
rsek Jun 19, 2023
bfa6494
rm _enableV10Validation, not in FVTT src?
rsek Jun 19, 2023
e612546
rename and prune some i18n keys
rsek Jun 19, 2023
63aea56
clean up some console logging
rsek Jun 19, 2023
5df39b9
expand hook description
rsek Jun 19, 2023
c91c5e7
more concise getter
rsek Jun 19, 2023
c69b8d6
provide explanation for getter
rsek Jun 19, 2023
3355887
Merge remote-tracking branch 'upstream/main' into active-effects-impacts
rsek Jun 19, 2023
1d976c8
compact sheet adjusts height for custom impacts
rsek Jun 19, 2023
36fe758
add a field minimum
rsek Jun 20, 2023
1776d94
qualified namespace
rsek Jun 20, 2023
5b11344
override apply instead of adding hook
rsek Jun 20, 2023
5cf692c
update impacts setting from first start menu
rsek Jun 20, 2023
10e1faf
update changelog
rsek Jun 20, 2023
82228cb
Merge branch 'main' into active-effects-impacts
rsek Jun 20, 2023
cc49ace
improve method and getter logic
rsek Jun 20, 2023
45391cf
more annotations for `apply` override
rsek Jun 20, 2023
d9fcad9
annotate clampFieldChange parameters
rsek Jun 20, 2023
e175133
tweak jsdoc description
rsek Jun 20, 2023
3895a20
tweak jsdoc description
rsek Jun 20, 2023
afabe01
Merge remote-tracking branch 'upstream/main' into active-effects-impacts
rsek Jun 22, 2023
13f3978
jiggle types around until tsc stops complaining
rsek Jun 22, 2023
c75b30d
rename data models
rsek Jun 25, 2023
8b68047
Merge branch 'main' into active-effects-impacts
rsek Jun 25, 2023
bc8e3d5
Merge branch 'main' into active-effects-impacts
rsek Jun 25, 2023
5a2e63d
organize imports
rsek Jun 25, 2023
34b8f95
rm const for now
rsek Jun 25, 2023
1c1f762
strip some `as const` for now
rsek Jun 25, 2023
976d84d
Merge branch 'main' into active-effects-impacts
rsek Jun 25, 2023
078f7ea
organize imports
rsek Jun 25, 2023
66b073c
add deleteDialog override
rsek Jun 25, 2023
f5332f3
add fake typeLabel + typeIcon to config
rsek Jun 25, 2023
2dddf72
Merge branch 'main' into active-effects-impacts
rsek Sep 25, 2023
edbf7d4
clean up imports
rsek Sep 25, 2023
4b3052f
typing for asset import, fix condition prop
rsek Sep 25, 2023
f1d8499
include super call just in case
rsek Sep 26, 2023
9630b6e
add missing await
rsek Sep 26, 2023
46e1129
clean up imports
rsek Sep 26, 2023
fcb20e3
fix property path in migration
rsek Sep 26, 2023
cdd13b2
hard reset of resetValue on migration
rsek Sep 26, 2023
1d87216
rm old comment
rsek Sep 26, 2023
d436341
rm defunct field class
rsek Sep 26, 2023
1bccb61
clean up imports + code order
rsek Sep 26, 2023
d6cc51a
Merge branch 'main' into active-effects-impacts
rsek Sep 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## Next Release

- Ironsworn debilities and Starforged impacts have been rewritten to take advantage of FVTT's ActiveEffects API.
- Unlimited Suffering! Player characters can now have any number of custom impacts.
- Note that custom impacts can't be managed from the token HUD yet, but we plan to add this in the future
- Ironsworn-style debilities or Starforged-style impacts can be selected independent of toolbox (though certain Starforged-specific sheets will override this)
- Plus some features standard to ActiveEffects, including token HUD integration
- Impacts/debilities that prevent recovery of resources (e.g. wounded, shaken, unprepared) now 'lock' the condition meter in question (with a tooltip that identifies the culprit)
- Make player condition meters and momentum available as bar displays on actor tokens

## 1.22.4

- Fix a bug with "highest-of" stat selection, as with _Endure Stress_ ([#880](https://github.com/ben/foundry-ironsworn/pull/880))
Expand Down
5 changes: 4 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ import {
registerOracleTree
} from './module/features/customoracles'
import { OracleTable } from './module/roll-table/oracle-table'
import { IronActiveEffect } from './module/active-effect/active-effect'

export interface EmitterEvents extends Record<EventType, unknown> {
highlightMove: string // Foundry UUID
highlightOracle: string // DF ID
globalConditionChanged: { name: string; enabled: boolean } // info about condition that changed
globalImpactChanged: { id: string; enabled: boolean } // info about condition that changed
dragStart: string // type of item
dragEnd: string // type of item
}
Expand All @@ -33,6 +34,7 @@ export type IronswornEmitter = Emitter<EmitterEvents>
export interface IronswornConfig {
actorClass: typeof IronswornActor
OracleTable: typeof OracleTable
IronActiveEffect: typeof IronActiveEffect

showdown: showdown.Converter

Expand Down Expand Up @@ -67,6 +69,7 @@ export interface IronswornConfig {
export const IRONSWORN: IronswornConfig = {
actorClass: IronswornActor,
OracleTable,
IronActiveEffect,

// TODO: if we wanted to implement enrichMarkdown as a showdown plugin, we could use our own instance instead.
get showdown() {
Expand Down
15 changes: 14 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import type {
DocumentType
} from '@league-of-foundry-developers/foundry-vtt-types/src/types/helperTypes'
import ActorConfig from './module/actor/config'
import { ConfigActiveEffect } from './module/active-effect/config'
import ItemConfig from './module/item/config'

declare global {
Expand Down Expand Up @@ -78,8 +79,20 @@ Hooks.once('init', async () => {

mergeObject(CONFIG.Actor, ActorConfig)
mergeObject(CONFIG.Item, ItemConfig)
mergeObject(CONFIG.ActiveEffect, ConfigActiveEffect)

/**
* FVTT provides the same status effects to everyone by default. We circumvent this by making it a getter that accesses the current actor of the token HUD.
*
* Since the HUD is a singleton, that actor *should* always be the same as the actor who we're rendering status effects for.
*
* @see https://github.com/foundryvtt/foundryvtt/issues/9593
*/
Object.defineProperty(CONFIG, 'statusEffects', {
get: () => canvas?.hud?.token.object?.actor?.validImpacts ?? []
})

// Define custom Entity classes
// Define custom Document classes

CONFIG.JournalEntry.documentClass = IronswornJournalEntry
CONFIG.JournalEntryPage.documentClass = IronswornJournalPage
Expand Down
Loading