Macros | Enumerations | Functions
effects.h File Reference

effect handling More...

#include "source.h"
#include "object.h"
#include "player-attack.h"
#include "cmds.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, EFFECT, EFFECT }


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

Execution of effects

void effect_simple (int index, struct source origin, const char *dice_string, int subtype, int radius, int other, int y, int x, 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...
int recharge_failure_chance (const struct object *obj, int strength)
 Returns N which is the 1 in N chance for recharging to fail. 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 ( const struct effect effect)

◆ effect_desc()

const char* effect_desc ( const 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,
struct command cmd 

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.
cmdIf the effect is invoked as part of a command, this is the the command structure - used primarily so repeating the command can use the same information without prompting the player again. Use NULL for this if not invoked as part of a command.

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, effect::msg, effect_handler_context_s::msg, effect::next, effect_handler_context_s::obj, effect_handler_context_s::origin, effect::other, effect::radius, randint0, effect::subtype, effect_handler_context_s::value, void(), effect::x, and effect::y.

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

◆ effect_info()

const char* effect_info ( const struct effect effect)

◆ effect_lookup()

effect_index effect_lookup ( const char *  name)

◆ effect_simple()

void effect_simple ( int  index,
struct source  origin,
const char *  dice_string,
int  subtype,
int  radius,
int  other,
int  y,
int  x,
bool *  ident 

◆ effect_subtype()

int effect_subtype ( int  index,
const char *  type 

◆ effect_valid()

bool effect_valid ( const struct effect effect)

References EF_NONE, and effect::index.

Referenced by effect_aim(), effect_desc(), effect_do(), and effect_info().

◆ 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(), effect::msg, effect::next, and string_free().

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

◆ recharge_failure_chance()

int recharge_failure_chance ( const struct object obj,
int  strength 

Returns N which is the 1 in N chance for recharging to fail.

References object::kind, object_kind::level, object::number, and object::pval.

Referenced by effect_handler_RECHARGE(), and show_obj().