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 int(* 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, bool actual)
 Adjust damage according to resistance or vulnerability. More...
 
static void project_player_drain_stats (int num)
 

Player handlers

More...
 
static int project_player_handler_ACID (project_player_handler_context_t *context)
 
static int project_player_handler_ELEC (project_player_handler_context_t *context)
 
static int project_player_handler_FIRE (project_player_handler_context_t *context)
 
static int project_player_handler_COLD (project_player_handler_context_t *context)
 
static int project_player_handler_POIS (project_player_handler_context_t *context)
 
static int project_player_handler_LIGHT (project_player_handler_context_t *context)
 
static int project_player_handler_DARK (project_player_handler_context_t *context)
 
static int project_player_handler_SOUND (project_player_handler_context_t *context)
 
static int project_player_handler_SHARD (project_player_handler_context_t *context)
 
static int project_player_handler_NEXUS (project_player_handler_context_t *context)
 
static int project_player_handler_NETHER (project_player_handler_context_t *context)
 
static int project_player_handler_CHAOS (project_player_handler_context_t *context)
 
static int project_player_handler_DISEN (project_player_handler_context_t *context)
 
static int project_player_handler_WATER (project_player_handler_context_t *context)
 
static int project_player_handler_ICE (project_player_handler_context_t *context)
 
static int project_player_handler_GRAVITY (project_player_handler_context_t *context)
 
static int project_player_handler_INERTIA (project_player_handler_context_t *context)
 
static int project_player_handler_FORCE (project_player_handler_context_t *context)
 
static int project_player_handler_TIME (project_player_handler_context_t *context)
 
static int project_player_handler_PLASMA (project_player_handler_context_t *context)
 
static int project_player_handler_METEOR (project_player_handler_context_t *context)
 
static int project_player_handler_MISSILE (project_player_handler_context_t *context)
 
static int project_player_handler_MANA (project_player_handler_context_t *context)
 
static int project_player_handler_HOLY_ORB (project_player_handler_context_t *context)
 
static int project_player_handler_ARROW (project_player_handler_context_t *context)
 
static int project_player_handler_LIGHT_WEAK (project_player_handler_context_t *context)
 
static int project_player_handler_DARK_WEAK (project_player_handler_context_t *context)
 
static int project_player_handler_KILL_WALL (project_player_handler_context_t *context)
 
static int project_player_handler_KILL_DOOR (project_player_handler_context_t *context)
 
static int project_player_handler_KILL_TRAP (project_player_handler_context_t *context)
 
static int project_player_handler_MAKE_DOOR (project_player_handler_context_t *context)
 
static int project_player_handler_MAKE_TRAP (project_player_handler_context_t *context)
 
static int project_player_handler_AWAY_UNDEAD (project_player_handler_context_t *context)
 
static int project_player_handler_AWAY_EVIL (project_player_handler_context_t *context)
 
static int project_player_handler_AWAY_SPIRIT (project_player_handler_context_t *context)
 
static int project_player_handler_AWAY_ALL (project_player_handler_context_t *context)
 
static int project_player_handler_TURN_UNDEAD (project_player_handler_context_t *context)
 
static int project_player_handler_TURN_EVIL (project_player_handler_context_t *context)
 
static int project_player_handler_TURN_LIVING (project_player_handler_context_t *context)
 
static int project_player_handler_TURN_ALL (project_player_handler_context_t *context)
 
static int project_player_handler_DISP_UNDEAD (project_player_handler_context_t *context)
 
static int project_player_handler_DISP_EVIL (project_player_handler_context_t *context)
 
static int project_player_handler_DISP_ALL (project_player_handler_context_t *context)
 
static int project_player_handler_SLEEP_UNDEAD (project_player_handler_context_t *context)
 
static int project_player_handler_SLEEP_EVIL (project_player_handler_context_t *context)
 
static int project_player_handler_SLEEP_ALL (project_player_handler_context_t *context)
 
static int project_player_handler_MON_CLONE (project_player_handler_context_t *context)
 
static int project_player_handler_MON_POLY (project_player_handler_context_t *context)
 
static int project_player_handler_MON_HEAL (project_player_handler_context_t *context)
 
static int project_player_handler_MON_SPEED (project_player_handler_context_t *context)
 
static int project_player_handler_MON_SLOW (project_player_handler_context_t *context)
 
static int project_player_handler_MON_CONF (project_player_handler_context_t *context)
 
static int project_player_handler_MON_HOLD (project_player_handler_context_t *context)
 
static int project_player_handler_MON_STUN (project_player_handler_context_t *context)
 
static int project_player_handler_MON_DRAIN (project_player_handler_context_t *context)
 
static int project_player_handler_MON_CRUSH (project_player_handler_context_t *context)
 
bool project_p (struct source origin, int r, struct loc grid, int dam, int typ, int power)
 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

◆ ELEM

#define ELEM (   a)    project_player_handler_##a,

◆ PROJ

#define PROJ (   a)    project_player_handler_##a,

Typedef Documentation

◆ project_player_handler_context_t

◆ project_player_handler_f

typedef int(* project_player_handler_f) (project_player_handler_context_t *)

Function Documentation

◆ adjust_dam()

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

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 melee_effect_elemental(), player_check_terrain_damage(), project_p(), and project_player_handler_POIS().

◆ project_p()

bool project_p ( struct source  origin,
int  r,
struct loc  grid,
int  dam,
int  typ,
int  power 
)

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(), project_player_handler_context_s::dam, trap_kind::desc, disturb(), player_state::el_info, ELEM_MAX, project_player_handler_context_s::grid, player::is_dead, trap::kind, MDESC_DIED_FROM, source::monster, monster_desc(), monster_is_visible(), msg, source::object, object_desc(), project_player_handler_context_s::obvious, ODESC_BASE, ODESC_PREFIX, project_player_handler_context_s::origin, player_handlers, project_player_handler_context_s::power, projections, project_player_handler_context_s::r, RANDOMISE, element_info::res_level, square_destroy_decoy(), square_isdecoyed(), square_isplayer(), player::state, strnfmt(), take_hit(), player::timed, source::trap, source::what, and source::which.

Referenced by project().

◆ project_player_drain_stats()

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, num, player_stat_dec(), and randint1.

Referenced by project_player_handler_TIME().

◆ project_player_handler_ACID()

static int project_player_handler_ACID ( project_player_handler_context_t context)
static

◆ project_player_handler_ARROW()

static int project_player_handler_ARROW ( project_player_handler_context_t context)
static

◆ project_player_handler_AWAY_ALL()

static int project_player_handler_AWAY_ALL ( project_player_handler_context_t context)
static

◆ project_player_handler_AWAY_EVIL()

static int project_player_handler_AWAY_EVIL ( project_player_handler_context_t context)
static

◆ project_player_handler_AWAY_SPIRIT()

static int project_player_handler_AWAY_SPIRIT ( project_player_handler_context_t context)
static

◆ project_player_handler_AWAY_UNDEAD()

static int project_player_handler_AWAY_UNDEAD ( project_player_handler_context_t context)
static

◆ project_player_handler_CHAOS()

static int project_player_handler_CHAOS ( project_player_handler_context_t context)
static

◆ project_player_handler_COLD()

static int project_player_handler_COLD ( project_player_handler_context_t context)
static

◆ project_player_handler_DARK()

static int project_player_handler_DARK ( project_player_handler_context_t context)
static

◆ project_player_handler_DARK_WEAK()

static int project_player_handler_DARK_WEAK ( project_player_handler_context_t context)
static

◆ project_player_handler_DISEN()

static int project_player_handler_DISEN ( project_player_handler_context_t context)
static

◆ project_player_handler_DISP_ALL()

static int project_player_handler_DISP_ALL ( project_player_handler_context_t context)
static

◆ project_player_handler_DISP_EVIL()

static int project_player_handler_DISP_EVIL ( project_player_handler_context_t context)
static

◆ project_player_handler_DISP_UNDEAD()

static int project_player_handler_DISP_UNDEAD ( project_player_handler_context_t context)
static

◆ project_player_handler_ELEC()

static int project_player_handler_ELEC ( project_player_handler_context_t context)
static

◆ project_player_handler_FIRE()

static int project_player_handler_FIRE ( project_player_handler_context_t context)
static

◆ project_player_handler_FORCE()

static int project_player_handler_FORCE ( project_player_handler_context_t context)
static

◆ project_player_handler_GRAVITY()

static int project_player_handler_GRAVITY ( project_player_handler_context_t context)
static

◆ project_player_handler_HOLY_ORB()

static int project_player_handler_HOLY_ORB ( project_player_handler_context_t context)
static

◆ project_player_handler_ICE()

static int project_player_handler_ICE ( project_player_handler_context_t context)
static

◆ project_player_handler_INERTIA()

static int project_player_handler_INERTIA ( project_player_handler_context_t context)
static

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

◆ project_player_handler_KILL_DOOR()

static int project_player_handler_KILL_DOOR ( project_player_handler_context_t context)
static

◆ project_player_handler_KILL_TRAP()

static int project_player_handler_KILL_TRAP ( project_player_handler_context_t context)
static

◆ project_player_handler_KILL_WALL()

static int project_player_handler_KILL_WALL ( project_player_handler_context_t context)
static

◆ project_player_handler_LIGHT()

static int project_player_handler_LIGHT ( project_player_handler_context_t context)
static

◆ project_player_handler_LIGHT_WEAK()

static int project_player_handler_LIGHT_WEAK ( project_player_handler_context_t context)
static

◆ project_player_handler_MAKE_DOOR()

static int project_player_handler_MAKE_DOOR ( project_player_handler_context_t context)
static

◆ project_player_handler_MAKE_TRAP()

static int project_player_handler_MAKE_TRAP ( project_player_handler_context_t context)
static

◆ project_player_handler_MANA()

static int project_player_handler_MANA ( project_player_handler_context_t context)
static

◆ project_player_handler_METEOR()

static int project_player_handler_METEOR ( project_player_handler_context_t context)
static

◆ project_player_handler_MISSILE()

static int project_player_handler_MISSILE ( project_player_handler_context_t context)
static

◆ project_player_handler_MON_CLONE()

static int project_player_handler_MON_CLONE ( project_player_handler_context_t context)
static

◆ project_player_handler_MON_CONF()

static int project_player_handler_MON_CONF ( project_player_handler_context_t context)
static

◆ project_player_handler_MON_CRUSH()

static int project_player_handler_MON_CRUSH ( project_player_handler_context_t context)
static

◆ project_player_handler_MON_DRAIN()

static int project_player_handler_MON_DRAIN ( project_player_handler_context_t context)
static

◆ project_player_handler_MON_HEAL()

static int project_player_handler_MON_HEAL ( project_player_handler_context_t context)
static

◆ project_player_handler_MON_HOLD()

static int project_player_handler_MON_HOLD ( project_player_handler_context_t context)
static

◆ project_player_handler_MON_POLY()

static int project_player_handler_MON_POLY ( project_player_handler_context_t context)
static

◆ project_player_handler_MON_SLOW()

static int project_player_handler_MON_SLOW ( project_player_handler_context_t context)
static

◆ project_player_handler_MON_SPEED()

static int project_player_handler_MON_SPEED ( project_player_handler_context_t context)
static

◆ project_player_handler_MON_STUN()

static int project_player_handler_MON_STUN ( project_player_handler_context_t context)
static

◆ project_player_handler_NETHER()

static int project_player_handler_NETHER ( project_player_handler_context_t context)
static

◆ project_player_handler_NEXUS()

static int project_player_handler_NEXUS ( project_player_handler_context_t context)
static

◆ project_player_handler_PLASMA()

static int project_player_handler_PLASMA ( project_player_handler_context_t context)
static

◆ project_player_handler_POIS()

static int project_player_handler_POIS ( project_player_handler_context_t context)
static

◆ project_player_handler_SHARD()

static int project_player_handler_SHARD ( project_player_handler_context_t context)
static

◆ project_player_handler_SLEEP_ALL()

static int project_player_handler_SLEEP_ALL ( project_player_handler_context_t context)
static

◆ project_player_handler_SLEEP_EVIL()

static int project_player_handler_SLEEP_EVIL ( project_player_handler_context_t context)
static

◆ project_player_handler_SLEEP_UNDEAD()

static int project_player_handler_SLEEP_UNDEAD ( project_player_handler_context_t context)
static

◆ project_player_handler_SOUND()

static int project_player_handler_SOUND ( project_player_handler_context_t context)
static

◆ project_player_handler_TIME()

static int project_player_handler_TIME ( project_player_handler_context_t context)
static

◆ project_player_handler_TURN_ALL()

static int project_player_handler_TURN_ALL ( project_player_handler_context_t context)
static

◆ project_player_handler_TURN_EVIL()

static int project_player_handler_TURN_EVIL ( project_player_handler_context_t context)
static

◆ project_player_handler_TURN_LIVING()

static int project_player_handler_TURN_LIVING ( project_player_handler_context_t context)
static

◆ project_player_handler_TURN_UNDEAD()

static int project_player_handler_TURN_UNDEAD ( project_player_handler_context_t context)
static

◆ project_player_handler_WATER()

static int project_player_handler_WATER ( project_player_handler_context_t context)
static

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

Variable Documentation

◆ player_handlers

const project_player_handler_f player_handlers[]
static

Referenced by project_p().