nqp.effects package¶
Submodules¶
nqp.effects.actions module¶
- apply_effects(entities: List[EntityID])[source]¶
Enable effects for entity by checking the sentinels.
Should be called whenever a new entity or sentinel is created.
New entities may be created after an effect was started. This can be used to search for effects that would affect the entity and apply them.
- new_stats_effect(stat: nqp.base_classes.stat.Stat, stats: nqp.world_elements.entity_components.Stats, modifier: str, ttl: float = 999) int [source]¶
Apply StatsEffect to Stat
- Parameters
stat – Stat instance to modify
stats – Stats Component containing
stat
modifier – Modifier string; “50%”, “-50”, “-200%”, etc
ttl – Time To Live
nqp.effects.burn module¶
not in design docs, just testing. maybe use later?
- class OnFireStatusProcessor[source]¶
Bases:
nqp.base_classes.effect_processor.EffectProcessor
- burning = <snecs.query.Query object>¶
nqp.effects.effect_components module¶
- class AddItemEffect(item_type: str, item_count: int, trigger=None)[source]¶
Bases:
snecs.component.RegisteredComponent
- class StatsEffect(stat: Any, ttl: float = 999)[source]¶
Bases:
snecs.component.RegisteredComponent
Currently, only modifying
Stats
components are supported- Parameters
stat – Stat instance on the Stats component
ttl – Time To Live
- ttl:
- INFINITEnever removed
0 : runs once
> 0 : lasts X seconds
- class StatsEffectSentinel(target: str, unit_type: str, attribute: str, modifier: str, params: Optional[Dict[str:Any]] = None, ttl: float = 999)[source]¶
Bases:
snecs.component.RegisteredComponent
Fancy way to search for targets of an effect
- __init__(target: str, unit_type: str, attribute: str, modifier: str, params: Optional[Dict[str:Any]] = None, ttl: float = 999)[source]¶
- classmethod from_dict(data: Dict[str, str], params: Dict)[source]¶
Return new instance using data loaded from a file
- Parameters
data – Dictionary of generic params, probably from a file
params – Dictionary of data unique to the context
For params, consider an effect which would affect the users “team”. We cannot know which team that is in the data files, since it is only known when the effect is created. So the
params
dictionary is required to get the team value when the effect is created. Seemaybe_apply
.
- maybe_apply(allegiance: nqp.world_elements.entity_components.Allegiance, stats: nqp.world_elements.entity_components.Stats)[source]¶
Match and test modifier. Apply if needed.
nqp.effects.processors module¶
- class AddItemEffectProcessor[source]¶
Bases:
nqp.base_classes.effect_processor.EffectProcessor
- queued_items = <snecs.query.Query object>¶
- class EffectProcessorComponent(effect: nqp.base_classes.effect_processor.EffectProcessor)[source]¶
Bases:
snecs.component.RegisteredComponent
- __init__(effect: nqp.base_classes.effect_processor.EffectProcessor)[source]¶
- class StatsEffectProcessor[source]¶
Bases:
nqp.base_classes.effect_processor.EffectProcessor
Processor for Effects
Remove expired effects