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

projection effects on the player More...

#include "angband.h"
#include "cave.h"
#include "effects.h"
#include "init.h"
#include "mon-desc.h"
#include "mon-predicate.h"
#include "obj-desc.h"
#include "obj-gear.h"
#include "obj-knowledge.h"
#include "player-calcs.h"
#include "player-timed.h"
#include "player-util.h"
#include "project.h"
#include "source.h"
#include "trap.h"
#include "list-elements.h"
#include "list-projections.h"

Data Structures

struct  project_player_handler_context_s
 

Macros

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

Typedefs

typedef struct
project_player_handler_context_s 
project_player_handler_context_t
 
typedef void(* project_player_handler_f )(project_player_handler_context_t *)
 

Functions

int adjust_dam (struct player *p, int type, int dam, aspect dam_aspect, int resist)
 Adjust damage according to resistance or vulnerability. More...
 
static void project_player_drain_stats (int num)
 

Player handlers

More...
 
static void project_player_swap_stats (void)
 Swap stats at random to temporarily scramble the player's stats. More...
 
static void project_player_handler_ACID (project_player_handler_context_t *context)
 
static void project_player_handler_ELEC (project_player_handler_context_t *context)
 
static void project_player_handler_FIRE (project_player_handler_context_t *context)
 
static void project_player_handler_COLD (project_player_handler_context_t *context)
 
static void project_player_handler_POIS (project_player_handler_context_t *context)
 
static void project_player_handler_LIGHT (project_player_handler_context_t *context)
 
static void project_player_handler_DARK (project_player_handler_context_t *context)
 
static void project_player_handler_SOUND (project_player_handler_context_t *context)
 
static void project_player_handler_SHARD (project_player_handler_context_t *context)
 
static void project_player_handler_NEXUS (project_player_handler_context_t *context)
 
static void project_player_handler_NETHER (project_player_handler_context_t *context)
 
static void project_player_handler_CHAOS (project_player_handler_context_t *context)
 
static void project_player_handler_DISEN (project_player_handler_context_t *context)
 
static void project_player_handler_WATER (project_player_handler_context_t *context)
 
static void project_player_handler_ICE (project_player_handler_context_t *context)
 
static void project_player_handler_GRAVITY (project_player_handler_context_t *context)
 
static void project_player_handler_INERTIA (project_player_handler_context_t *context)
 
static void project_player_handler_FORCE (project_player_handler_context_t *context)
 
static void project_player_handler_TIME (project_player_handler_context_t *context)
 
static void project_player_handler_PLASMA (project_player_handler_context_t *context)
 
static void project_player_handler_METEOR (project_player_handler_context_t *context)
 
static void project_player_handler_MISSILE (project_player_handler_context_t *context)
 
static void project_player_handler_MANA (project_player_handler_context_t *context)
 
static void project_player_handler_HOLY_ORB (project_player_handler_context_t *context)
 
static void project_player_handler_ARROW (project_player_handler_context_t *context)
 
static void project_player_handler_LIGHT_WEAK (project_player_handler_context_t *context)
 
static void project_player_handler_DARK_WEAK (project_player_handler_context_t *context)
 
static void project_player_handler_KILL_WALL (project_player_handler_context_t *context)
 
static void project_player_handler_KILL_DOOR (project_player_handler_context_t *context)
 
static void project_player_handler_KILL_TRAP (project_player_handler_context_t *context)
 
static void project_player_handler_MAKE_DOOR (project_player_handler_context_t *context)
 
static void project_player_handler_MAKE_TRAP (project_player_handler_context_t *context)
 
static void project_player_handler_AWAY_UNDEAD (project_player_handler_context_t *context)
 
static void project_player_handler_AWAY_EVIL (project_player_handler_context_t *context)
 
static void project_player_handler_AWAY_ALL (project_player_handler_context_t *context)
 
static void project_player_handler_TURN_UNDEAD (project_player_handler_context_t *context)
 
static void project_player_handler_TURN_EVIL (project_player_handler_context_t *context)
 
static void project_player_handler_TURN_ALL (project_player_handler_context_t *context)
 
static void project_player_handler_DISP_UNDEAD (project_player_handler_context_t *context)
 
static void project_player_handler_DISP_EVIL (project_player_handler_context_t *context)
 
static void project_player_handler_DISP_ALL (project_player_handler_context_t *context)
 
static void project_player_handler_MON_CLONE (project_player_handler_context_t *context)
 
static void project_player_handler_MON_POLY (project_player_handler_context_t *context)
 
static void project_player_handler_MON_HEAL (project_player_handler_context_t *context)
 
static void project_player_handler_MON_SPEED (project_player_handler_context_t *context)
 
static void project_player_handler_MON_SLOW (project_player_handler_context_t *context)
 
static void project_player_handler_MON_CONF (project_player_handler_context_t *context)
 
static void project_player_handler_MON_SLEEP (project_player_handler_context_t *context)
 
static void project_player_handler_MON_HOLD (project_player_handler_context_t *context)
 
static void project_player_handler_MON_STUN (project_player_handler_context_t *context)
 
static void project_player_handler_MON_DRAIN (project_player_handler_context_t *context)
 
bool project_p (struct source origin, int r, int y, int x, int dam, int typ)
 Called from project() to affect the player. More...
 

Variables

static const
project_player_handler_f 
player_handlers []
 

Detailed Description

projection effects on the player

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_player_handler_##a,
#define PROJ (   a)    project_player_handler_##a,

Typedef Documentation

typedef void(* project_player_handler_f)(project_player_handler_context_t *)

Function Documentation

int adjust_dam ( struct player p,
int  type,
int  dam,
aspect  dam_aspect,
int  resist 
)

Adjust damage according to resistance or vulnerability.

Parameters
pis the player
typeis the attack type we are checking.
damis the unadjusted damage.
dam_aspectis the calc we want (min, avg, max, random).
resistis the degree of resistance (-1 = vuln, 3 = immune).

References AVERAGE, player_state::el_info, equip_learn_element(), EXTREMIFY, i, MAXIMISE, MINIMISE, minus_ac(), projection::numerator, projections, player::race, randcalc(), RANDOMISE, element_info::res_level, player::state, and type.

Referenced by best_spell_power(), effect_handler_THRUST_AWAY(), melee_effect_elemental(), move_player(), and project_p().

bool project_p ( struct source  origin,
int  r,
int  y,
int  x,
int  dam,
int  typ 
)

Called from project() to affect the player.

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

Parameters
srcis 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
Returns
whether the effects were obvious

If "r" is non-zero, then the blast was centered elsewhere; the damage is reduced in project() before being passed in here. This can happen if a monster breathes at the player and hits a wall instead.

We assume the player is aware of some effect, and always return "true".

References adjust_dam(), cave, cave_monster(), trap_kind::desc, disturb(), player_state::el_info, player::is_dead, trap::kind, MDESC_DIED_FROM, source::monster, monster_desc(), monster_is_visible(), msg, NULL, source::object, object_desc(), project_player_handler_context_s::obvious, ODESC_BASE, ODESC_PREFIX, player_handlers, projections, RANDOMISE, element_info::res_level, square_isplayer(), player::state, strnfmt(), take_hit(), player::timed, source::trap, source::what, and source::which.

Referenced by project().

static void project_player_drain_stats ( int  num)
static


Player handlers

Drain stats at random

Parameters
numis the number of points to drain

References i, msg, NULL, num, player_stat_dec(), and randint1.

Referenced by project_player_handler_TIME().

static void project_player_handler_ACID ( project_player_handler_context_t context)
static
static void project_player_handler_ARROW ( project_player_handler_context_t context)
static
static void project_player_handler_AWAY_ALL ( project_player_handler_context_t context)
static
static void project_player_handler_AWAY_EVIL ( project_player_handler_context_t context)
static
static void project_player_handler_AWAY_UNDEAD ( project_player_handler_context_t context)
static
static void project_player_handler_CHAOS ( project_player_handler_context_t context)
static
static void project_player_handler_COLD ( project_player_handler_context_t context)
static
static void project_player_handler_DARK ( project_player_handler_context_t context)
static
static void project_player_handler_DARK_WEAK ( project_player_handler_context_t context)
static
static void project_player_handler_DISEN ( project_player_handler_context_t context)
static
static void project_player_handler_DISP_ALL ( project_player_handler_context_t context)
static
static void project_player_handler_DISP_EVIL ( project_player_handler_context_t context)
static
static void project_player_handler_DISP_UNDEAD ( project_player_handler_context_t context)
static
static void project_player_handler_ELEC ( project_player_handler_context_t context)
static
static void project_player_handler_FIRE ( project_player_handler_context_t context)
static
static void project_player_handler_FORCE ( project_player_handler_context_t context)
static
static void project_player_handler_GRAVITY ( project_player_handler_context_t context)
static
static void project_player_handler_HOLY_ORB ( project_player_handler_context_t context)
static
static void project_player_handler_ICE ( project_player_handler_context_t context)
static
static void project_player_handler_INERTIA ( project_player_handler_context_t context)
static

References player_inc_timed(), randint0, and void().

static void project_player_handler_KILL_DOOR ( project_player_handler_context_t context)
static
static void project_player_handler_KILL_TRAP ( project_player_handler_context_t context)
static
static void project_player_handler_KILL_WALL ( project_player_handler_context_t context)
static
static void project_player_handler_LIGHT ( project_player_handler_context_t context)
static
static void project_player_handler_LIGHT_WEAK ( project_player_handler_context_t context)
static
static void project_player_handler_MAKE_DOOR ( project_player_handler_context_t context)
static
static void project_player_handler_MAKE_TRAP ( project_player_handler_context_t context)
static
static void project_player_handler_MANA ( project_player_handler_context_t context)
static
static void project_player_handler_METEOR ( project_player_handler_context_t context)
static
static void project_player_handler_MISSILE ( project_player_handler_context_t context)
static
static void project_player_handler_MON_CLONE ( project_player_handler_context_t context)
static
static void project_player_handler_MON_CONF ( project_player_handler_context_t context)
static
static void project_player_handler_MON_DRAIN ( project_player_handler_context_t context)
static
static void project_player_handler_MON_HEAL ( project_player_handler_context_t context)
static
static void project_player_handler_MON_HOLD ( project_player_handler_context_t context)
static
static void project_player_handler_MON_POLY ( project_player_handler_context_t context)
static
static void project_player_handler_MON_SLEEP ( project_player_handler_context_t context)
static
static void project_player_handler_MON_SLOW ( project_player_handler_context_t context)
static
static void project_player_handler_MON_SPEED ( project_player_handler_context_t context)
static
static void project_player_handler_MON_STUN ( project_player_handler_context_t context)
static
static void project_player_handler_NETHER ( project_player_handler_context_t context)
static
static void project_player_handler_NEXUS ( project_player_handler_context_t context)
static
static void project_player_handler_PLASMA ( project_player_handler_context_t context)
static
static void project_player_handler_POIS ( project_player_handler_context_t context)
static
static void project_player_handler_SHARD ( project_player_handler_context_t context)
static
static void project_player_handler_SOUND ( project_player_handler_context_t context)
static
static void project_player_handler_TIME ( project_player_handler_context_t context)
static
static void project_player_handler_TURN_ALL ( project_player_handler_context_t context)
static
static void project_player_handler_TURN_EVIL ( project_player_handler_context_t context)
static
static void project_player_handler_TURN_UNDEAD ( project_player_handler_context_t context)
static
static void project_player_handler_WATER ( project_player_handler_context_t context)
static

References player_inc_timed(), randint1, and void().

static void project_player_swap_stats ( void  )
static

Swap stats at random to temporarily scramble the player's stats.

References i, player_inc_timed(), randint0, player::stat_cur, player::stat_map, STAT_MAX, player::stat_max, and swap.

Referenced by project_player_handler_NEXUS().

Variable Documentation

const project_player_handler_f player_handlers[]
static

Referenced by project_p().