Functions | Variables
mon-attack.h File Reference

Monster attacks. More...

Go to the source code of this file.


bool make_attack_spell (struct monster *m)
 Creatures can cast spells, shoot missiles, and breathe.
bool check_hit (struct player *p, int power, int level)
 Determine if a monster attack against the player succeeds.
int adjust_dam_armor (int damage, int ac)
 Calculate how much damage remains after armor is taken into account (does for a physical attack what adjust_dam does for an elemental attack).
bool make_attack_normal (struct monster *m_ptr, struct player *p)
 Attack the player via physical attacks.


bool(* testfn_make_attack_normal )(struct monster *m, struct player *p)

Detailed Description

Monster attacks.

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

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.

Function Documentation

int adjust_dam_armor ( int  damage,
int  ac 

Calculate how much damage remains after armor is taken into account (does for a physical attack what adjust_dam does for an elemental attack).

Referenced by melee_effect_elemental(), melee_effect_handler_HURT(), and melee_effect_handler_SHATTER().

bool check_hit ( struct player p,
int  power,
int  level 

Determine if a monster attack against the player succeeds.

References player_state::ac, equip_notice_on_defend(), player::state, test_hit(), player_state::to_a, and TRUE.

Referenced by do_mon_spell(), and make_attack_normal().

bool make_attack_normal ( struct monster m_ptr,
struct player p 
bool make_attack_spell ( struct monster m_ptr)

Creatures can cast spells, shoot missiles, and breathe.

Returns "TRUE" if a spell (or whatever) was (successfully) cast.

XXX XXX XXX This function could use some work, but remember to keep it as optimized as possible, while retaining generic code.

Verify the various "blind-ness" checks in the code.

XXX XXX XXX Note that several effects should really not be "seen" if the player is blind.

Perhaps monsters should breathe at locations near the player, since this would allow them to inflict "partial" damage.

Perhaps smart monsters should decline to use "bolt" spells if there is a monster in the way, unless they wish to kill it.

It will not be possible to "correctly" handle the case in which a monster attempts to attack a location which is thought to contain the player, but which in fact is nowhere near the player, since this might induce all sorts of messages about the attack itself, and about the effects of the attack, which the player might or might not be in a position to observe. Thus, for simplicity, it is probably best to only allow "faulty" attacks by a monster if one of the important grids (probably the initial or final grid) is in fact in view of the player. It may be necessary to actually prevent spell attacks except when the monster actually has line of sight to the player. Note that a monster could be left in a bizarre situation after the player ducked behind a pillar and then teleported away, for example.

Note that this function attempts to optimize the use of spells for the cases in which the monster has no spells, or has spells but cannot use them, or has spells but they will have no "useful" effect. Note that this function has been an efficiency bottleneck in the past.

Note the special "MFLAG_NICE" flag, which prevents a monster from using any spell attacks until the player has had a single chance to move.

References become_aware(), monster_lore::cast_innate, monster_lore::cast_spell, cave, monster::cdis, choose_attack_spell(), monster_lore::deaths, disturb(), do_mon_spell(), FALSE, monster_race::flags, monster_race::freq_innate, monster_race::freq_spell, monster::fx, monster::fy, get_lore(), monster::hp, player::is_dead, monster_race::level, lore_update(), monster::m_timed, angband_constants::max_range, MAX_SHORT, MAX_UCHAR, monster::maxhp, MDESC_DIED_FROM, MDESC_POSS, MDESC_PRO_VIS, MDESC_STANDARD, monster::mflag, mflag_has, MIN_NONINNATE_SPELL, mon_inc_timed(), monster_desc(), msg, PROJECT_NONE, PROJECT_STOP, projectable(), player::px, player::py, monster::race, randint0, remove_bad_spells(), rf_has, rsf_copy, rsf_is_empty, rsf_on, RSF_SIZE, RST_ANNOY, RST_BOLT, RST_ESCAPE, RST_HASTE, RST_HEAL, RST_SUMMON, RST_TACTIC, set_spells(), monster_lore::spell_flags, monster_race::spell_flags, summon_possible(), test_spells(), player::timed, TRUE, void(), and z_info.

Referenced by process_monster().

Variable Documentation

bool(* testfn_make_attack_normal)(struct monster *m, struct player *p)