Handles pilot effects.
More...
#include "effect.h"
#include "array.h"
#include "conf.h"
#include "gui.h"
#include "log.h"
#include "ndata.h"
#include "nlua_pilot.h"
#include "nxml.h"
#include "rng.h"
Go to the source code of this file.
|
| static int | effect_cmp (const void *p1, const void *p2) |
| | Compares effects based on name.
|
| static int | effect_cmpTimer (const void *p1, const void *p2) |
| | Compares effects based on priority, then timer.
|
| static int | effect_parse (EffectData *efx, const char *file) |
| | Parsess an effect.
|
| int | effect_load (void) |
| | Loads all the effects.
|
| void | effect_exit (void) |
| | Gets rid of all the effects.
|
| const EffectData * | effect_get (const char *name) |
| | Gets an effect by name.
|
| int | effect_update (Effect **efxlist, double dt) |
| | Updates an effect list.
|
| int | effect_add (Effect **efxlist, const EffectData *efx, double duration, double strength, unsigned int parent) |
| | Adds an effect to an effect list.
|
| int | effect_rm (Effect **efxlist, int idx) |
| | Removes an effect from an effect list by index.
|
| int | effect_rmType (Effect **efxlist, const EffectData *efx, int all) |
| | Removes an effect type from an effect list.
|
| void | effect_clearSpecific (Effect **efxlist, int debuffs, int buffs, int others) |
| | Clears specific types of effects.
|
| void | effect_clear (Effect **efxlist) |
| | Clears an effect list, removing all active effects.
|
| void | effect_compute (ShipStats *s, const Effect *efxlist) |
| | Updates shipstats from effect list.
|
| void | effect_cleanup (Effect *efxlist) |
| | Cleans up an effect list freeing it.
|
Handles pilot effects.
Definition in file effect.c.
◆ MELEMENT
| #define MELEMENT |
( |
| o, |
|
|
| s ) |
Value: if ( o ) \
WARN( _( "Effect '%s' missing/invalid '%s' element" ), efx->name, \
s )
◆ effect_add()
| int effect_add |
( |
Effect ** | efxlist, |
|
|
const EffectData * | efx, |
|
|
double | duration, |
|
|
double | strength, |
|
|
unsigned int | parent ) |
Adds an effect to an effect list.
- Parameters
-
| efxlist | List of effects. |
| efx | Effect to add. |
| duration | Duration of the effect or set to negative for default. |
| strength | Scaling strength of the effect. |
| parent | Pilot the effect is being added to. |
- Returns
- 0 on success.
Definition at line 322 of file effect.c.
◆ effect_cleanup()
| void effect_cleanup |
( |
Effect * | efxlist | ) |
|
Cleans up an effect list freeing it.
- Parameters
-
Definition at line 561 of file effect.c.
◆ effect_clear()
| void effect_clear |
( |
Effect ** | efxlist | ) |
|
Clears an effect list, removing all active effects.
- Parameters
-
Definition at line 524 of file effect.c.
◆ effect_clearSpecific()
| void effect_clearSpecific |
( |
Effect ** | efxlist, |
|
|
int | debuffs, |
|
|
int | buffs, |
|
|
int | others ) |
Clears specific types of effects.
- Parameters
-
| efxlist | List of effects. |
| debuffs | Whether or not to clear debuffs. |
| buffs | Whether or not to clear buffs. |
| others | Whether or not to clear other effects. |
Definition at line 485 of file effect.c.
◆ effect_cmp()
| int effect_cmp |
( |
const void * | p1, |
|
|
const void * | p2 ) |
|
static |
Compares effects based on name.
Definition at line 31 of file effect.c.
◆ effect_cmpTimer()
| int effect_cmpTimer |
( |
const void * | p1, |
|
|
const void * | p2 ) |
|
static |
Compares effects based on priority, then timer.
Definition at line 41 of file effect.c.
◆ effect_compute()
Updates shipstats from effect list.
- Parameters
-
| s | Stats to update. |
| efxlist | List of effects. |
Definition at line 548 of file effect.c.
◆ effect_exit()
| void effect_exit |
( |
void | | ) |
|
Gets rid of all the effects.
Definition at line 244 of file effect.c.
◆ effect_get()
| const EffectData * effect_get |
( |
const char * | name | ) |
|
Gets an effect by name.
- Parameters
-
| name | Name of the base effect to get. |
- Returns
- The base effect or NULL if not applicable.
Definition at line 265 of file effect.c.
◆ effect_load()
Loads all the effects.
- Returns
- 0 on success
Definition at line 199 of file effect.c.
◆ effect_parse()
| int effect_parse |
( |
EffectData * | efx, |
|
|
const char * | file ) |
|
static |
Parsess an effect.
Definition at line 55 of file effect.c.
◆ effect_rm()
| int effect_rm |
( |
Effect ** | efxlist, |
|
|
int | idx ) |
Removes an effect from an effect list by index.
- Parameters
-
| efxlist | List of effects. |
| idx | Index to remove. |
- Returns
- Number of instances removed.
Definition at line 420 of file effect.c.
◆ effect_rmType()
Removes an effect type from an effect list.
- Parameters
-
| efxlist | List of effects. |
| efx | Effect type to remove. |
| all | Whether or not to remove all instances. |
- Returns
- Number of instances removed.
Definition at line 452 of file effect.c.
◆ effect_update()
| int effect_update |
( |
Effect ** | efxlist, |
|
|
double | dt ) |
Updates an effect list.
- Parameters
-
| efxlist | The effect list. |
| dt | The time update. |
- Returns
- The number of effects that ended or changed.
Definition at line 282 of file effect.c.
◆ effect_list