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 "init.h"
#include "mon-desc.h"
#include "obj-gear.h"
#include "obj-identify.h"
#include "player-timed.h"
#include "player-util.h"
#include "project.h"
#include "list-elements.h"
#include "list-project-environs.h"
#include "list-project-monsters.h"

Data Structures

struct  project_player_handler_context_s

Macros

#define ELEM(a, b, c, d, e, f, g, col)   project_player_handler_##a,
#define PROJ_ENV(a, col)   NULL,
#define PROJ_MON(a, obv)   NULL,

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.
static void project_player_drain_stats (int num)
 

Player handlers


static void project_player_swap_stats (void)
 Swap a random pair of stats.
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)
bool project_p (int who, int r, int y, int x, int dam, int typ)
 Called from project() to affect the player.

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,
  b,
  c,
  d,
  e,
  f,
  g,
  col 
)    project_player_handler_##a,
#define PROJ_ENV (   a,
  col 
)    NULL,
#define PROJ_MON (   a,
  obv 
)    NULL,

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_notice_element(), EXTREMIFY, gf_denom(), gf_num(), i, MAXIMISE, MINIMISE, minus_ac(), player::race, randcalc(), RANDOMISE, element_info::res_level, player::state, and type.

Referenced by best_spell_power(), effect_handler_TRAP_SPOT_ACID(), effect_handler_TRAP_SPOT_FIRE(), melee_effect_elemental(), and project_p().

bool project_p ( int  who,
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
whois the monster list index of the caster
ris the distance from the centre of the effect
y
xthe coordinates of the grid being handled
damis the "damage" from the effect at distance r from the centre
typis the projection (GF_) 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(), disturb(), player_state::el_info, FALSE, gf_desc(), MDESC_DIED_FROM, monster::mflag, mflag_has, square::mon, monster_desc(), msg, project_player_handler_context_s::obvious, player_handlers, RANDOMISE, element_info::res_level, chunk::squares, player::state, take_hit(), player::timed, and TRUE.

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 FALSE, i, msg, 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_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_DISEN ( 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

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

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
static void project_player_handler_LIGHT ( 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_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_WATER ( project_player_handler_context_t context)
static
static void project_player_swap_stats ( void  )
static

Variable Documentation

const project_player_handler_f player_handlers[]
static

Referenced by project_p().