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


Function Documentation

bool effect_aim ( struct effect effect)
const char* effect_desc ( struct effect effect)
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::dice, dice_roll(), effect_valid(), effect_kind::handler, effect_handler_context_s::ident, effect::index, msg, effect::next, NULL, effect::params, randint0, value, and void().

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

const char* effect_info ( struct effect effect)
effect_index effect_lookup ( const char *  name)

References EF_MAX, effect_names, i, N_ELEMENTS, NULL, and streq.

Referenced by do_cmd_wiz_effect().

int effect_param ( int  index,
const char *  type 
void effect_simple ( int  index,
struct source  origin,
const char *  dice_string,
int  p1,
int  p2,
int  p3,
bool *  ident 
bool effect_valid ( struct effect 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().