import{_ as e,c as t,o as a,N as o}from"./chunks/framework.0799945b.js";const m=JSON.parse('{"title":"Module: features/decorators/common","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"api/modules/features/common.md","lastUpdated":null}'),r={name:"api/modules/features/common.md"},c=o(`
• EffectFeatureOptions: Object
Name | Type |
---|---|
effect | any |
profectus/src/features/decorators/common.ts:14
Ƭ Decorator<FeatureOptions
, BaseFeature
, GenericFeature
, S
>: Object
Name | Type |
---|---|
FeatureOptions | FeatureOptions |
BaseFeature | object |
GenericFeature | BaseFeature |
S | extends State = State |
Name | Type |
---|---|
getGatheredProps? | (feature : OptionsObject <FeatureOptions , BaseFeature & { id : string }, GenericFeature >) => Partial <OptionsObject <FeatureOptions , BaseFeature & { id : string }, GenericFeature >> |
getPersistentData? | () => Record <string , Persistent <S >> |
postConstruct? | (feature : OptionsObject <FeatureOptions , BaseFeature & { id : string }, GenericFeature >) => void |
preConstruct? | (feature : OptionsObject <FeatureOptions , BaseFeature & { id : string }, GenericFeature >) => void |
profectus/src/features/decorators/common.ts:5
Ƭ EffectFeature<T
>: Replace
<T
, { effect
: GetComputableType
<T
["effect"
]> }>
Name | Type |
---|---|
T | extends EffectFeatureOptions |
profectus/src/features/decorators/common.ts:18
Ƭ GenericDecorator: Decorator
<unknown
>
profectus/src/features/decorators/common.ts:12
Ƭ GenericEffectFeature: Replace
<EffectFeature
<EffectFeatureOptions
>, { effect
: ProcessedComputable
<any
> }>
profectus/src/features/decorators/common.ts:22
• Const
effectDecorator: Decorator
<EffectFeatureOptions
, unknown
, GenericEffectFeature
>
Allows the usage of an effect
field in the decorated feature.
To function properly, the createFeature()
function must have its generic type extended by EffectFeatureOptions
.
To allow access to the decorated values outside the createFeature()
function, the output type must be extended by GenericEffectFeature
.
Example
createRepeatable<RepeatableOptions & EffectFeatureOptions>(() => ({
effect() { return Decimal.pow(2, this.amount); },
...
}), effectDecorator) as GenericUpgrade & GenericEffectFeature;