File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -134,6 +134,10 @@ class Character extends EventEmitter
134134 this . attributes . get ( attr ) . lower ( amount ) ;
135135 }
136136
137+ hasEffectType ( type ) {
138+ return this . effects . hasEffectType ( type ) ;
139+ }
140+
137141 addEffect ( effect ) {
138142 return this . effects . add ( effect ) ;
139143 }
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ var EffectModifiers;
1212 * @property {boolean } config.unique If multiple effects with the same `config.type` can be applied at once
1313 * @property {number } config.maxStacks When adding an effect of the same type it adds a stack to the current
1414 * effect up to maxStacks instead of adding the effect. Implies `config.unique`
15+ * @property {boolean } config.persists If false the effect will not save to the player
1516 * @property {string } config.type The effect category, mainly used when disallowing stacking
1617 * @property {boolean|number } config.tickInterval Number of seconds between calls to the `updateTick` listener
1718 * @property {string } description
@@ -36,11 +37,12 @@ class Effect extends EventEmitter {
3637 description : '' ,
3738 duration : Infinity ,
3839 hidden : false ,
39- name : 'Unnamed Effect' ,
4040 maxStacks : 0 ,
41- unique : true ,
42- type : 'undef' ,
41+ name : 'Unnamed Effect' ,
42+ persists : true ,
4343 tickInterval : false ,
44+ type : 'undef' ,
45+ unique : true ,
4446 } , def . config ) ;
4547
4648 this . target = target ;
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ class EffectList {
3636
3737 getByType ( type ) {
3838 return [ ...this . effects ] . find ( effect => {
39- return effect . type === type ;
39+ return effect . config . type === type ;
4040 } ) ;
4141 }
4242
@@ -168,7 +168,16 @@ class EffectList {
168168
169169 serialize ( ) {
170170 this . validateEffects ( ) ;
171- return [ ...this . effects ] . map ( effect => effect . serialize ( ) ) ;
171+ let serialized = [ ] ;
172+ for ( const effect of this . effects ) {
173+ if ( ! effect . config . persists ) {
174+ continue ;
175+ }
176+
177+ serialized . push ( effect . serialize ( ) ) ;
178+ }
179+
180+ return serialized ;
172181 }
173182
174183 hydrate ( state ) {
You can’t perform that action at this time.
0 commit comments