Angband
Data Structures | Macros | Typedefs | Functions | Variables
project-obj.c File Reference

projection effects on objects More...

#include "angband.h"
#include "cave.h"
#include "mon-util.h"
#include "obj-chest.h"
#include "obj-desc.h"
#include "obj-gear.h"
#include "obj-ignore.h"
#include "obj-pile.h"
#include "obj-tval.h"
#include "obj-util.h"
#include "player-calcs.h"
#include "source.h"
#include "list-elements.h"
#include "list-projections.h"

Data Structures

struct  project_object_handler_context_s
 

Object handlers

More...
 

Macros

#define ELEM(a)   project_object_handler_##a,
 
#define PROJ(a)   project_object_handler_##a,
 

Typedefs

typedef struct
project_object_handler_context_s 
project_object_handler_context_t
 

Object handlers

More...
 
typedef void(* project_object_handler_f )(project_object_handler_context_t *)
 

Functions

int inven_damage (struct player *p, int type, int cperc)
 Destroys a type of item on a given percent chance. More...
 
static void project_object_elemental (project_object_handler_context_t *context, int element, const char *singular_verb, const char *plural_verb)
 Project an effect onto an object. More...
 
static void project_object_handler_ACID (project_object_handler_context_t *context)
 
static void project_object_handler_ELEC (project_object_handler_context_t *context)
 
static void project_object_handler_FIRE (project_object_handler_context_t *context)
 
static void project_object_handler_COLD (project_object_handler_context_t *context)
 
static void project_object_handler_POIS (project_object_handler_context_t *context)
 
static void project_object_handler_LIGHT (project_object_handler_context_t *context)
 
static void project_object_handler_DARK (project_object_handler_context_t *context)
 
static void project_object_handler_SOUND (project_object_handler_context_t *context)
 
static void project_object_handler_SHARD (project_object_handler_context_t *context)
 
static void project_object_handler_NEXUS (project_object_handler_context_t *context)
 
static void project_object_handler_NETHER (project_object_handler_context_t *context)
 
static void project_object_handler_CHAOS (project_object_handler_context_t *context)
 
static void project_object_handler_DISEN (project_object_handler_context_t *context)
 
static void project_object_handler_WATER (project_object_handler_context_t *context)
 
static void project_object_handler_ICE (project_object_handler_context_t *context)
 
static void project_object_handler_GRAVITY (project_object_handler_context_t *context)
 
static void project_object_handler_INERTIA (project_object_handler_context_t *context)
 
static void project_object_handler_FORCE (project_object_handler_context_t *context)
 
static void project_object_handler_TIME (project_object_handler_context_t *context)
 
static void project_object_handler_PLASMA (project_object_handler_context_t *context)
 
static void project_object_handler_METEOR (project_object_handler_context_t *context)
 
static void project_object_handler_MISSILE (project_object_handler_context_t *context)
 
static void project_object_handler_MANA (project_object_handler_context_t *context)
 
static void project_object_handler_HOLY_ORB (project_object_handler_context_t *context)
 
static void project_object_handler_ARROW (project_object_handler_context_t *context)
 
static void project_object_handler_LIGHT_WEAK (project_object_handler_context_t *context)
 
static void project_object_handler_DARK_WEAK (project_object_handler_context_t *context)
 
static void project_object_handler_KILL_WALL (project_object_handler_context_t *context)
 
static void project_object_handler_KILL_DOOR (project_object_handler_context_t *context)
 
static void project_object_handler_KILL_TRAP (project_object_handler_context_t *context)
 
static void project_object_handler_MAKE_DOOR (project_object_handler_context_t *context)
 
static void project_object_handler_MAKE_TRAP (project_object_handler_context_t *context)
 
static void project_object_handler_AWAY_UNDEAD (project_object_handler_context_t *context)
 
static void project_object_handler_AWAY_EVIL (project_object_handler_context_t *context)
 
static void project_object_handler_AWAY_ALL (project_object_handler_context_t *context)
 
static void project_object_handler_TURN_UNDEAD (project_object_handler_context_t *context)
 
static void project_object_handler_TURN_EVIL (project_object_handler_context_t *context)
 
static void project_object_handler_TURN_ALL (project_object_handler_context_t *context)
 
static void project_object_handler_DISP_UNDEAD (project_object_handler_context_t *context)
 
static void project_object_handler_DISP_EVIL (project_object_handler_context_t *context)
 
static void project_object_handler_DISP_ALL (project_object_handler_context_t *context)
 
static void project_object_handler_MON_CLONE (project_object_handler_context_t *context)
 
static void project_object_handler_MON_POLY (project_object_handler_context_t *context)
 
static void project_object_handler_MON_HEAL (project_object_handler_context_t *context)
 
static void project_object_handler_MON_SPEED (project_object_handler_context_t *context)
 
static void project_object_handler_MON_SLOW (project_object_handler_context_t *context)
 
static void project_object_handler_MON_CONF (project_object_handler_context_t *context)
 
static void project_object_handler_MON_SLEEP (project_object_handler_context_t *context)
 
static void project_object_handler_MON_HOLD (project_object_handler_context_t *context)
 
static void project_object_handler_MON_STUN (project_object_handler_context_t *context)
 
static void project_object_handler_MON_DRAIN (project_object_handler_context_t *context)
 
bool project_o (struct source origin, int r, int y, int x, int dam, int typ, const struct object *protected_obj)
 Called from project() to affect objects. More...
 

Variables

static const
project_object_handler_f 
object_handlers []
 

Detailed Description

projection effects on objects

Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke

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 ELEM (   a)    project_object_handler_##a,
#define PROJ (   a)    project_object_handler_##a,

Typedef Documentation


Object handlers

typedef void(* project_object_handler_f)(project_object_handler_context_t *)

Function Documentation

int inven_damage ( struct player p,
int  type,
int  cperc 
)
bool project_o ( struct source  origin,
int  r,
int  y,
int  x,
int  dam,
int  typ,
const struct object protected_obj 
)

Called from project() to affect objects.

Called for projections with the PROJECT_ITEM flag set, which includes beam, ball and breath effects.

Parameters
originis the origin of the effect
ris the distance from the centre of the effect
ythe coordinates of the grid being handled
xthe coordinates of the grid being handled
damis the "damage" from the effect at distance r from the centre
typis the projection (PROJ_) type
protected_objis an object that should not be affected by the projection, typically the object that created it
Returns
whether the effects were obvious

Note that this function determines if the player can see anything that happens by taking into account: blindness, line-of-sight, and illumination.

Hack – effects on objects which are memorized but not in view are also seen.

References object::artifact, become_aware(), cave, cave_monster(), delist_object(), project_object_handler_context_s::do_kill, project_object_handler_context_s::ignore, ignore_item_ok(), object::known, object::mimicking_m_idx, msg, msgt(), object::next, project_object_handler_context_s::note_kill, NULL, object::number, object_delete(), object_desc(), object_handlers, project_object_handler_context_s::obvious, ODESC_BASE, object::origin, square_excise_object(), square_isseen(), square_light_spot(), square_note_spot(), square_object(), and VERB_AGREEMENT.

Referenced by project().

static void project_object_elemental ( project_object_handler_context_t context,
int  element,
const char *  singular_verb,
const char *  plural_verb 
)
static

Project an effect onto an object.

Parameters
contextis the project_o context.
elementis for elements that will destroy an object, or that it will ignore.
singular_verbis the verb that is displayed when one object is destroyed.
plural_verbis the verb that is displayed in multiple objects are destroyed.

References project_object_handler_context_s::do_kill, object::el_info, EL_INFO_HATES, EL_INFO_IGNORE, element_info::flags, project_object_handler_context_s::ignore, project_object_handler_context_s::note_kill, object::number, project_object_handler_context_s::obj, and VERB_AGREEMENT.

Referenced by project_object_handler_ACID(), project_object_handler_COLD(), project_object_handler_ELEC(), project_object_handler_FIRE(), project_object_handler_FORCE(), project_object_handler_ICE(), project_object_handler_METEOR(), project_object_handler_PLASMA(), project_object_handler_SHARD(), and project_object_handler_SOUND().

static void project_object_handler_ACID ( project_object_handler_context_t context)
static
static void project_object_handler_ARROW ( project_object_handler_context_t context)
static
static void project_object_handler_AWAY_ALL ( project_object_handler_context_t context)
static
static void project_object_handler_AWAY_EVIL ( project_object_handler_context_t context)
static
static void project_object_handler_AWAY_UNDEAD ( project_object_handler_context_t context)
static
static void project_object_handler_CHAOS ( project_object_handler_context_t context)
static
static void project_object_handler_COLD ( project_object_handler_context_t context)
static
static void project_object_handler_DARK ( project_object_handler_context_t context)
static
static void project_object_handler_DARK_WEAK ( project_object_handler_context_t context)
static
static void project_object_handler_DISEN ( project_object_handler_context_t context)
static
static void project_object_handler_DISP_ALL ( project_object_handler_context_t context)
static
static void project_object_handler_DISP_EVIL ( project_object_handler_context_t context)
static
static void project_object_handler_DISP_UNDEAD ( project_object_handler_context_t context)
static
static void project_object_handler_ELEC ( project_object_handler_context_t context)
static
static void project_object_handler_FIRE ( project_object_handler_context_t context)
static
static void project_object_handler_FORCE ( project_object_handler_context_t context)
static
static void project_object_handler_GRAVITY ( project_object_handler_context_t context)
static
static void project_object_handler_HOLY_ORB ( project_object_handler_context_t context)
static
static void project_object_handler_ICE ( project_object_handler_context_t context)
static
static void project_object_handler_INERTIA ( project_object_handler_context_t context)
static
static void project_object_handler_KILL_DOOR ( project_object_handler_context_t context)
static
static void project_object_handler_KILL_TRAP ( project_object_handler_context_t context)
static
static void project_object_handler_KILL_WALL ( project_object_handler_context_t context)
static
static void project_object_handler_LIGHT ( project_object_handler_context_t context)
static
static void project_object_handler_LIGHT_WEAK ( project_object_handler_context_t context)
static
static void project_object_handler_MAKE_DOOR ( project_object_handler_context_t context)
static
static void project_object_handler_MAKE_TRAP ( project_object_handler_context_t context)
static
static void project_object_handler_MANA ( project_object_handler_context_t context)
static
static void project_object_handler_METEOR ( project_object_handler_context_t context)
static
static void project_object_handler_MISSILE ( project_object_handler_context_t context)
static
static void project_object_handler_MON_CLONE ( project_object_handler_context_t context)
static
static void project_object_handler_MON_CONF ( project_object_handler_context_t context)
static
static void project_object_handler_MON_DRAIN ( project_object_handler_context_t context)
static
static void project_object_handler_MON_HEAL ( project_object_handler_context_t context)
static
static void project_object_handler_MON_HOLD ( project_object_handler_context_t context)
static
static void project_object_handler_MON_POLY ( project_object_handler_context_t context)
static
static void project_object_handler_MON_SLEEP ( project_object_handler_context_t context)
static
static void project_object_handler_MON_SLOW ( project_object_handler_context_t context)
static
static void project_object_handler_MON_SPEED ( project_object_handler_context_t context)
static
static void project_object_handler_MON_STUN ( project_object_handler_context_t context)
static
static void project_object_handler_NETHER ( project_object_handler_context_t context)
static
static void project_object_handler_NEXUS ( project_object_handler_context_t context)
static
static void project_object_handler_PLASMA ( project_object_handler_context_t context)
static
static void project_object_handler_POIS ( project_object_handler_context_t context)
static
static void project_object_handler_SHARD ( project_object_handler_context_t context)
static
static void project_object_handler_SOUND ( project_object_handler_context_t context)
static
static void project_object_handler_TIME ( project_object_handler_context_t context)
static
static void project_object_handler_TURN_ALL ( project_object_handler_context_t context)
static
static void project_object_handler_TURN_EVIL ( project_object_handler_context_t context)
static
static void project_object_handler_TURN_UNDEAD ( project_object_handler_context_t context)
static
static void project_object_handler_WATER ( project_object_handler_context_t context)
static

Variable Documentation

const project_object_handler_f object_handlers[]
static

Referenced by project_o().