Angband
Macros | Functions
mon-blow-effects.c File Reference

Monster melee effects module. More...

#include "angband.h"
#include "init.h"
#include "monster.h"
#include "mon-attack.h"
#include "mon-blow-effects.h"
#include "mon-blow-methods.h"
#include "mon-lore.h"
#include "mon-util.h"
#include "obj-desc.h"
#include "obj-gear.h"
#include "obj-make.h"
#include "obj-pile.h"
#include "obj-tval.h"
#include "obj-util.h"
#include "player-timed.h"
#include "player-util.h"
#include "project.h"
#include "list-blow-effects.h"

Macros

#define RBE(x, p, e, d)   melee_effect_handler_##x,
#define RBE(x, p, e, d)   p,
#define RBE(x, p, e, d)   d,
#define RBE(x, p, e, d)   e,
#define RBE(x, p, e, d)   #x,

Functions

static void melee_effect_elemental (melee_effect_handler_context_t *context, int type, bool pure_element)
 Do damage as the result of a melee attack that has an elemental aspect.
static void melee_effect_timed (melee_effect_handler_context_t *context, int type, int amount, int of_flag, bool attempt_save, const char *save_msg)
 Do damage as the result of a melee attack that has a status effect.
static void melee_effect_stat (melee_effect_handler_context_t *context, int stat)
 Do damage as the result of a melee attack that drains a stat.
static void melee_effect_experience (melee_effect_handler_context_t *context, int chance, int drain_amount)
 Do damage as the result of an experience draining melee attack.
static void melee_effect_handler_NONE (melee_effect_handler_context_t *context)
 Melee effect handler: Hit the player, but don't do any damage.
static void melee_effect_handler_HURT (melee_effect_handler_context_t *context)
 Melee effect handler: Hurt the player with no side effects.
static void melee_effect_handler_POISON (melee_effect_handler_context_t *context)
 Melee effect handler: Poison the player.
static void melee_effect_handler_DISENCHANT (melee_effect_handler_context_t *context)
 Melee effect handler: Disenchant the player.
static void melee_effect_handler_DRAIN_CHARGES (melee_effect_handler_context_t *context)
 Melee effect handler: Drain charges from the player's inventory.
static void melee_effect_handler_EAT_GOLD (melee_effect_handler_context_t *context)
 Melee effect handler: Take the player's gold.
static void melee_effect_handler_EAT_ITEM (melee_effect_handler_context_t *context)
 Melee effect handler: Take something from the player's inventory.
static void melee_effect_handler_EAT_FOOD (melee_effect_handler_context_t *context)
 Melee effect handler: Eat the player's food.
static void melee_effect_handler_EAT_LIGHT (melee_effect_handler_context_t *context)
 Melee effect handler: Absorb the player's light.
static void melee_effect_handler_ACID (melee_effect_handler_context_t *context)
 Melee effect handler: Attack the player with acid.
static void melee_effect_handler_ELEC (melee_effect_handler_context_t *context)
 Melee effect handler: Attack the player with electricity.
static void melee_effect_handler_FIRE (melee_effect_handler_context_t *context)
 Melee effect handler: Attack the player with fire.
static void melee_effect_handler_COLD (melee_effect_handler_context_t *context)
 Melee effect handler: Attack the player with cold.
static void melee_effect_handler_BLIND (melee_effect_handler_context_t *context)
 Melee effect handler: Blind the player.
static void melee_effect_handler_CONFUSE (melee_effect_handler_context_t *context)
 Melee effect handler: Confuse the player.
static void melee_effect_handler_TERRIFY (melee_effect_handler_context_t *context)
 Melee effect handler: Terrify the player.
static void melee_effect_handler_PARALYZE (melee_effect_handler_context_t *context)
 Melee effect handler: Paralyze the player.
static void melee_effect_handler_LOSE_STR (melee_effect_handler_context_t *context)
 Melee effect handler: Drain the player's strength.
static void melee_effect_handler_LOSE_INT (melee_effect_handler_context_t *context)
 Melee effect handler: Drain the player's intelligence.
static void melee_effect_handler_LOSE_WIS (melee_effect_handler_context_t *context)
 Melee effect handler: Drain the player's wisdom.
static void melee_effect_handler_LOSE_DEX (melee_effect_handler_context_t *context)
 Melee effect handler: Drain the player's dexterity.
static void melee_effect_handler_LOSE_CON (melee_effect_handler_context_t *context)
 Melee effect handler: Drain the player's constitution.
static void melee_effect_handler_LOSE_ALL (melee_effect_handler_context_t *context)
 Melee effect handler: Drain all of the player's stats.
static void melee_effect_handler_SHATTER (melee_effect_handler_context_t *context)
 Melee effect handler: Cause an earthquake around the player.
static void melee_effect_handler_EXP_10 (melee_effect_handler_context_t *context)
 Melee effect handler: Drain the player's experience.
static void melee_effect_handler_EXP_20 (melee_effect_handler_context_t *context)
 Melee effect handler: Drain the player's experience.
static void melee_effect_handler_EXP_40 (melee_effect_handler_context_t *context)
 Melee effect handler: Drain the player's experience.
static void melee_effect_handler_EXP_80 (melee_effect_handler_context_t *context)
 Melee effect handler: Drain the player's experience.
static void melee_effect_handler_HALLU (melee_effect_handler_context_t *context)
 Melee effect handler: Make the player hallucinate.
static void melee_effect_handler_MAX (melee_effect_handler_context_t *context)
 Dummy melee effect handler.
bool monster_blow_effect_is_valid (monster_blow_effect_t effect)
 Return whether the given effect is valid.

Detailed Description

Monster melee effects module.

Copyright (c) 1997 Ben Harrison, David Reeve Sward, Keldon Jones. 2013 Ben Semmler

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 RBE (   x,
  p,
  e,
 
)    melee_effect_handler_##x,
#define RBE (   x,
  p,
  e,
 
)    p,
#define RBE (   x,
  p,
  e,
 
)    d,
#define RBE (   x,
  p,
  e,
 
)    e,
#define RBE (   x,
  p,
  e,
 
)    #x,

Function Documentation

static void melee_effect_elemental ( melee_effect_handler_context_t context,
int  type,
bool  pure_element 
)
static
static void melee_effect_experience ( melee_effect_handler_context_t context,
int  chance,
int  drain_amount 
)
static

Do damage as the result of an experience draining melee attack.

Parameters
contextis the information for the current attack.
chanceis the player's chance of resisting drain if they have OF_HOLD_LIFE.
drain_amountis the base amount of experience to drain.

References melee_effect_handler_context_s::damage, melee_effect_handler_context_s::ddesc, player::exp, FALSE, angband_constants::life_drain_percent, melee_effect_handler_context_s::m_ptr, msg, melee_effect_handler_context_s::obvious, melee_effect_handler_context_s::p, player_exp_lose(), player_of_has(), randint0, take_hit(), TRUE, update_smart_learn(), and z_info.

Referenced by melee_effect_handler_EXP_10(), melee_effect_handler_EXP_20(), melee_effect_handler_EXP_40(), and melee_effect_handler_EXP_80().

static void melee_effect_handler_ACID ( melee_effect_handler_context_t context)
static

Melee effect handler: Attack the player with acid.

References melee_effect_elemental(), and TRUE.

static void melee_effect_handler_BLIND ( melee_effect_handler_context_t context)
static

Melee effect handler: Blind the player.

References FALSE, melee_effect_timed(), randint1, and melee_effect_handler_context_s::rlev.

static void melee_effect_handler_COLD ( melee_effect_handler_context_t context)
static

Melee effect handler: Attack the player with cold.

References melee_effect_elemental(), and TRUE.

static void melee_effect_handler_CONFUSE ( melee_effect_handler_context_t context)
static

Melee effect handler: Confuse the player.

References FALSE, melee_effect_timed(), randint1, and melee_effect_handler_context_s::rlev.

static void melee_effect_handler_DISENCHANT ( melee_effect_handler_context_t context)
static
static void melee_effect_handler_DRAIN_CHARGES ( melee_effect_handler_context_t context)
static
static void melee_effect_handler_EAT_FOOD ( melee_effect_handler_context_t context)
static
static void melee_effect_handler_EAT_GOLD ( melee_effect_handler_context_t context)
static
static void melee_effect_handler_EAT_ITEM ( melee_effect_handler_context_t context)
static
static void melee_effect_handler_EAT_LIGHT ( melee_effect_handler_context_t context)
static
static void melee_effect_handler_ELEC ( melee_effect_handler_context_t context)
static

Melee effect handler: Attack the player with electricity.

References melee_effect_elemental(), and TRUE.

static void melee_effect_handler_EXP_10 ( melee_effect_handler_context_t context)
static

Melee effect handler: Drain the player's experience.

References damroll(), and melee_effect_experience().

static void melee_effect_handler_EXP_20 ( melee_effect_handler_context_t context)
static

Melee effect handler: Drain the player's experience.

References damroll(), and melee_effect_experience().

static void melee_effect_handler_EXP_40 ( melee_effect_handler_context_t context)
static

Melee effect handler: Drain the player's experience.

References damroll(), and melee_effect_experience().

static void melee_effect_handler_EXP_80 ( melee_effect_handler_context_t context)
static

Melee effect handler: Drain the player's experience.

References damroll(), and melee_effect_experience().

static void melee_effect_handler_FIRE ( melee_effect_handler_context_t context)
static

Melee effect handler: Attack the player with fire.

References melee_effect_elemental(), and TRUE.

static void melee_effect_handler_HALLU ( melee_effect_handler_context_t context)
static
static void melee_effect_handler_HURT ( melee_effect_handler_context_t context)
static
static void melee_effect_handler_LOSE_ALL ( melee_effect_handler_context_t context)
static
static void melee_effect_handler_LOSE_CON ( melee_effect_handler_context_t context)
static

Melee effect handler: Drain the player's constitution.

References melee_effect_stat().

static void melee_effect_handler_LOSE_DEX ( melee_effect_handler_context_t context)
static

Melee effect handler: Drain the player's dexterity.

References melee_effect_stat().

static void melee_effect_handler_LOSE_INT ( melee_effect_handler_context_t context)
static

Melee effect handler: Drain the player's intelligence.

References melee_effect_stat().

static void melee_effect_handler_LOSE_STR ( melee_effect_handler_context_t context)
static

Melee effect handler: Drain the player's strength.

References melee_effect_stat().

static void melee_effect_handler_LOSE_WIS ( melee_effect_handler_context_t context)
static

Melee effect handler: Drain the player's wisdom.

References melee_effect_stat().

static void melee_effect_handler_MAX ( melee_effect_handler_context_t context)
static

Dummy melee effect handler.

static void melee_effect_handler_NONE ( melee_effect_handler_context_t context)
static

Melee effect handler: Hit the player, but don't do any damage.

References melee_effect_handler_context_s::damage, melee_effect_handler_context_s::obvious, and TRUE.

static void melee_effect_handler_PARALYZE ( melee_effect_handler_context_t context)
static
static void melee_effect_handler_POISON ( melee_effect_handler_context_t context)
static

Melee effect handler: Poison the player.

We can't use melee_effect_timed(), because this is both and elemental attack and a status attack. Note the FALSE value for pure_element for melee_effect_elemental().

References FALSE, melee_effect_handler_context_s::m_ptr, melee_effect_elemental(), melee_effect_handler_context_s::obvious, melee_effect_handler_context_s::p, player_inc_timed(), randint1, melee_effect_handler_context_s::rlev, TRUE, and update_smart_learn().

static void melee_effect_handler_SHATTER ( melee_effect_handler_context_t context)
static
static void melee_effect_handler_TERRIFY ( melee_effect_handler_context_t context)
static

Melee effect handler: Terrify the player.

References melee_effect_timed(), randint1, melee_effect_handler_context_s::rlev, and TRUE.

static void melee_effect_stat ( melee_effect_handler_context_t context,
int  stat 
)
static

Do damage as the result of a melee attack that drains a stat.

Parameters
contextis the information for the current attack.
statis the STAT_ constant for the desired stat.

References melee_effect_handler_context_s::damage, melee_effect_handler_context_s::ddesc, effect_simple(), melee_effect_handler_context_s::obvious, melee_effect_handler_context_s::p, and take_hit().

Referenced by melee_effect_handler_LOSE_CON(), melee_effect_handler_LOSE_DEX(), melee_effect_handler_LOSE_INT(), melee_effect_handler_LOSE_STR(), and melee_effect_handler_LOSE_WIS().

static void melee_effect_timed ( melee_effect_handler_context_t context,
int  type,
int  amount,
int  of_flag,
bool  attempt_save,
const char *  save_msg 
)
static

Do damage as the result of a melee attack that has a status effect.

Parameters
contextis the information for the current attack.
typeis the TMD_ constant for the effect.
amountis the amount that the timer should be increased by.
of_flagis the OF_ flag that is passed on to monster learning for this effect.
attempt_saveindicates if a saving throw should be attempted for this effect.
save_msgis the message that is displayed if the saving throw is successful.

References melee_effect_handler_context_s::damage, melee_effect_handler_context_s::ddesc, melee_effect_handler_context_s::m_ptr, msg, melee_effect_handler_context_s::obvious, melee_effect_handler_context_s::p, player_inc_timed(), randint0, SKILL_SAVE, player_state::skills, player::state, take_hit(), TRUE, and update_smart_learn().

Referenced by melee_effect_handler_BLIND(), melee_effect_handler_CONFUSE(), melee_effect_handler_PARALYZE(), and melee_effect_handler_TERRIFY().

bool monster_blow_effect_is_valid ( monster_blow_effect_t  effect)

Return whether the given effect is valid.

Parameters
effectis the RBE_ constant for the effect.

Referenced by parse_lore_b(), and parse_monster_blow().