Macros | Enumerations | Functions
effects.h File Reference

effect handling More...

#include "source.h"
#include "object.h"
#include "list-effects.h"

Go to the source code of this file.


#define EFFECT(x, a, b, c, d, e)   EF_##x,


enum  effect_index { EF_NONE, EF_MAX }


void free_effect (struct effect *source)
 Free all the effects in a structure. More...
bool effect_valid (struct effect *effect)
bool effect_aim (struct effect *effect)
const char * effect_info (struct effect *effect)
const char * effect_desc (struct effect *effect)
effect_index effect_lookup (const char *name)
int effect_param (int index, const char *type)
 Translate a string to an effect parameter index. More...
bool effect_do (struct effect *effect, struct source origin, struct object *obj, bool *ident, bool aware, int dir, int beam, int boost)

Execution of effects

void effect_simple (int index, struct source origin, const char *dice_string, int p1, int p2, int p3, bool *ident)
 Perform a single effect with a simple dice string and parameters Calling with ident a valid pointer will (depending on effect) give success information; ident = NULL will ignore this. More...

Detailed Description

effect handling

Copyright (c) 2007 Andi Sidwell Copyright (c) 2014 Ben Semmler, Nick McConnell

This work is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation, version 2, or

b) the "Angband licence": This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.

Macro Definition Documentation


#define EFFECT (   x,
)    EF_##x,

Enumeration Type Documentation

◆ effect_index


Function Documentation

◆ effect_aim()

bool effect_aim ( struct effect effect)

◆ effect_desc()

const char* effect_desc ( struct effect effect)

◆ effect_do()

bool effect_do ( struct effect effect,
struct source  origin,
struct object obj,
bool *  ident,
bool  aware,
int  dir,
int  beam,
int  boost 

Execution of effects

Execute an effect chain.

effectis the effect chain
originis the origin of the effect (player, monster etc.)
objis the object making the effect happen (or NULL)
identwill be updated if the effect is identifiable (NB: no effect ever sets *ident to false)
awareindicates whether the player is aware of the effect already
diris the direction the effect will go in
beamis the base chance out of 100 that a BOLT_OR_BEAM effect will beam
boostis the extent to which skill surpasses difficulty, used as % boost. It ranges from 0 to 138.

References effect_handler_context_s::aware, effect_handler_context_s::beam, effect_handler_context_s::boost, effect::dice, dice_roll(), effect_handler_context_s::dir, effect_valid(), effect_kind::handler, effect_handler_context_s::ident, effect::index, msg, effect::next, NULL, effect_handler_context_s::obj, effect_handler_context_s::origin, effect::params, randint0, effect_handler_context_s::value, and void().

Referenced by do_curse_effect(), do_mon_spell(), effect_simple(), hit_trap(), spell_cast(), and use_aux().

◆ effect_info()

const char* effect_info ( struct effect effect)

◆ effect_lookup()

effect_index effect_lookup ( const char *  name)

◆ effect_param()

int effect_param ( int  index,
const char *  type 

◆ effect_simple()

void effect_simple ( int  index,
struct source  origin,
const char *  dice_string,
int  p1,
int  p2,
int  p3,
bool *  ident 

◆ effect_valid()

bool effect_valid ( struct effect effect)

◆ free_effect()

void free_effect ( struct effect source)

Free all the effects in a structure.

sourcethe effects being freed

References effect::dice, dice_free(), mem_free(), and effect::next.

Referenced by cleanup_act(), cleanup_class(), cleanup_curse(), cleanup_ego(), cleanup_mon_spell(), cleanup_object(), and cleanup_trap().