Data Structures | Defines | Functions | Variables

weapon.c File Reference

#include "hack.h"
Include dependency graph for weapon.c:

Data Structures

struct  skill_range

Defines

#define PN_BARE_HANDED   (-1)
#define PN_TWO_WEAPONS   (-2)
#define PN_RIDING   (-3)
#define PN_POLEARMS   (-4)
#define PN_SABER   (-5)
#define PN_HAMMER   (-6)
#define PN_WHIP   (-7)
#define PN_ATTACK_SPELL   (-8)
#define PN_HEALING_SPELL   (-9)
#define PN_DIVINATION_SPELL   (-10)
#define PN_ENCHANTMENT_SPELL   (-11)
#define PN_CLERIC_SPELL   (-12)
#define PN_ESCAPE_SPELL   (-13)
#define PN_MATTER_SPELL   (-14)
#define P_NAME(type)
#define Oselect(x)   if ((otmp = oselect(mtmp, x)) != 0) return(otmp);

Functions

STATIC_DCL int FDECL (enhance_skill,(boolean))
STATIC_DCL void FDECL (give_may_advance_msg,(int))
STATIC_OVL void give_may_advance_msg (int skill)
STATIC_DCL boolean FDECL (can_advance,(int, BOOLEAN_P))
STATIC_DCL boolean FDECL (could_advance,(int))
STATIC_DCL boolean FDECL (peaked_skill,(int))
STATIC_DCL int FDECL (slots_required,(int))
STATIC_DCL char * FDECL (skill_level_name,(int, char *))
STATIC_DCL void FDECL (skill_advance,(int))
int hitval (struct obj *otmp, struct monst *mon)
int dmgval (struct obj *otmp, struct monst *mon)
STATIC_DCL struct objFDECL (oselect,(struct monst *, int))
STATIC_OVL struct objoselect (struct monst *mtmp, int x)
struct objselect_rwep (struct monst *mtmp)
struct objselect_hwep (struct monst *mtmp)
void possibly_unwield (struct monst *mon, boolean polyspot)
int mon_wield_item (struct monst *mon)
int abon ()
int dbon ()
STATIC_OVL char * skill_level_name (int skill, char *buf)
STATIC_OVL int slots_required (int skill)
STATIC_OVL boolean can_advance (int skill, boolean speedy)
boolean can_advance_something ()
STATIC_OVL boolean could_advance (int skill)
STATIC_OVL boolean peaked_skill (int skill)
STATIC_OVL void skill_advance (int skill)
int enhance_weapon_skill ()
void dump_weapon_skill ()
int enhance_skill (boolean want_dump)
void unrestrict_weapon_skill (int skill)
void use_skill (int skill, int degree)
void add_weapon_skill (int n)
void lose_weapon_skill (int n)
int weapon_type (struct obj *obj)
int uwep_skill_type ()
int weapon_hit_bonus (struct obj *weapon)
int weapon_dam_bonus (struct obj *weapon)
void skill_init (struct def_skill *class_skill) const
void setmnotwielded (struct monst *mon, struct obj *obj)

Variables

STATIC_VAR NEARDATA const short skill_names_indices [P_NUM_SKILLS]
STATIC_VAR NEARDATA const char
*const 
odd_skill_names []
STATIC_VAR NEARDATA const char
*const 
barehands_or_martial []
static NEARDATA const char kebabable []
static NEARDATA const int rwep []
static NEARDATA const int pwep []
static struct objpropellor
static const NEARDATA short hwep []
static struct skill_range skill_ranges []

Define Documentation

#define Oselect (   x )    if ((otmp = oselect(mtmp, x)) != 0) return(otmp);

Referenced by select_hwep(), and select_rwep().

#define P_NAME (   type )
#define PN_ATTACK_SPELL   (-8)
#define PN_BARE_HANDED   (-1)
#define PN_CLERIC_SPELL   (-12)
#define PN_DIVINATION_SPELL   (-10)
#define PN_ENCHANTMENT_SPELL   (-11)
#define PN_ESCAPE_SPELL   (-13)
#define PN_HAMMER   (-6)
#define PN_HEALING_SPELL   (-9)
#define PN_MATTER_SPELL   (-14)
#define PN_POLEARMS   (-4)
#define PN_RIDING   (-3)
#define PN_SABER   (-5)
#define PN_TWO_WEAPONS   (-2)
#define PN_WHIP   (-7)

Function Documentation

int abon (  )

References A_DEX, A_STR, ACURR, adj_lev(), mons, STR18, u, you::ulevel, you::umonnum, and Upolyd.

Referenced by dig(), and find_roll_to_hit().

Here is the call graph for this function:

Here is the caller graph for this function:

void add_weapon_skill ( int  n )

References can_advance(), FALSE, give_may_advance_msg(), P_NONE, P_NUM_SKILLS, u, and you::weapon_slots.

Referenced by adjabil().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL boolean can_advance ( int  skill,
boolean  speedy 
)

References P_ADVANCE, P_MAX_SKILL, P_RESTRICTED, P_SKILL, P_SKILL_LIMIT, practice_needed_to_advance, you::skills_advanced, slots_required(), u, you::weapon_slots, and wizard.

Referenced by add_weapon_skill(), can_advance_something(), enhance_skill(), and use_skill().

Here is the call graph for this function:

Here is the caller graph for this function:

boolean can_advance_something (  )

References can_advance(), and P_NUM_SKILLS.

Referenced by maybe_tutorial().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL boolean could_advance ( int  skill )

References P_ADVANCE, P_MAX_SKILL, P_RESTRICTED, P_SKILL, P_SKILL_LIMIT, practice_needed_to_advance, you::skills_advanced, and u.

Referenced by enhance_skill().

Here is the caller graph for this function:

int dbon (  )

References A_STR, ACURR, STR18, and Upolyd.

Referenced by hmon_hitmon(), use_pick_axe2(), and use_whip().

Here is the caller graph for this function:

int dmgval ( struct obj otmp,
struct monst mon 
)
void dump_weapon_skill (  )

References enhance_skill(), and TRUE.

Referenced by disclose().

Here is the call graph for this function:

Here is the caller graph for this function:

int enhance_skill ( boolean  want_dump )
int enhance_weapon_skill (  )

References enhance_skill(), and FALSE.

Here is the call graph for this function:

STATIC_DCL char* FDECL ( skill_level_name  ,
(int, char *)   
)
STATIC_DCL int FDECL ( enhance_skill  ,
(boolean  
)
STATIC_DCL void FDECL ( skill_advance  ,
(int)   
)
STATIC_DCL boolean FDECL ( can_advance  ,
(int, BOOLEAN_P)   
)
STATIC_DCL boolean FDECL ( could_advance  ,
(int)   
)
STATIC_DCL void FDECL ( give_may_advance_msg  ,
(int)   
)
STATIC_DCL struct obj* FDECL ( oselect  ,
(struct monst *, int)   
) [read]
STATIC_DCL boolean FDECL ( peaked_skill  ,
(int)   
)
STATIC_DCL int FDECL ( slots_required  ,
(int)   
)
STATIC_OVL void give_may_advance_msg ( int  skill )

References P_LAST_SPELL, P_LAST_WEAPON, and P_NONE.

Referenced by add_weapon_skill(), and use_skill().

Here is the caller graph for this function:

int hitval ( struct obj otmp,
struct monst mon 
)

References monst::data, index, is_demon, is_pick, is_pool(), is_spear, is_swimmer, is_undead, is_weptool, permonst::mlet, monst::mx, monst::my, objects, passes_walls, perceives, S_EEL, S_SNAKE, spec_abon(), thick_skinned, TRIDENT, and WEAPON_CLASS.

Referenced by find_roll_to_hit(), hmonas(), mattackm(), mattacku(), and omon_adj().

Here is the call graph for this function:

Here is the caller graph for this function:

void lose_weapon_skill ( int  n )

References P_SKILL, P_UNSKILLED, you::skill_record, you::skills_advanced, slots_required(), u, and you::weapon_slots.

Referenced by adjabil().

Here is the call graph for this function:

Here is the caller graph for this function:

int mon_wield_item ( struct monst mon )
STATIC_OVL struct obj* oselect ( struct monst mtmp,
int  x 
) [read]

References CORPSE, obj::corpsenm, EGG, mons, obj::nobj, obj::oartifact, otmp, obj::otyp, touch_artifact(), and touch_petrifies.

Referenced by select_rwep().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL boolean peaked_skill ( int  skill )

References P_ADVANCE, P_MAX_SKILL, P_RESTRICTED, P_SKILL, and practice_needed_to_advance.

Referenced by enhance_skill().

Here is the caller graph for this function:

void possibly_unwield ( struct monst mon,
boolean  polyspot 
)
struct obj* select_hwep ( struct monst mtmp ) [read]

References CLUB, CORPSE, hates_silver(), is_giant, mons, obj::nobj, obj::oartifact, objects, oc_bimanual, obj::oclass, Oselect, otmp, obj::otyp, PM_BLACK_MARKETEER, SILVER, SIZE, strongmonst, touch_artifact(), W_ARMG, W_ARMS, and WEAPON_CLASS.

Referenced by final_level(), and mon_wield_item().

Here is the call graph for this function:

Here is the caller graph for this function:

struct obj* select_rwep ( struct monst mtmp ) [read]
void setmnotwielded ( struct monst mon,
struct obj obj 
)

References artifact_light(), canseemon, end_burn(), FALSE, HAND, mbodypart(), mon_nam(), otense(), pline(), s_suffix(), The(), W_WEP, and xname().

Referenced by hmon_hitmon(), m_throw(), mdamagem(), mdrop_obj(), mon_arrive(), mon_wield_item(), monstone(), possibly_unwield(), rot_corpse(), steal_it(), and use_whip().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL void skill_advance ( int  skill )

References P_MAX_SKILL, P_NAME, P_SKILL, you::skill_record, you::skills_advanced, slots_required(), u, and you::weapon_slots.

Referenced by enhance_skill().

Here is the call graph for this function:

Here is the caller graph for this function:

void skill_init ( struct def_skill class_skill ) const
STATIC_OVL char* skill_level_name ( int  skill,
char *  buf 
)

References P_BASIC, P_EXPERT, P_GRAND_MASTER, P_MASTER, P_SKILL, P_SKILLED, P_UNSKILLED, and Strcpy.

Referenced by enhance_skill().

Here is the caller graph for this function:

STATIC_OVL int slots_required ( int  skill )

References P_LAST_WEAPON, P_SKILL, and P_TWO_WEAPON_COMBAT.

Referenced by can_advance(), lose_weapon_skill(), and skill_advance().

Here is the caller graph for this function:

void unrestrict_weapon_skill ( int  skill )

References P_ADVANCE, P_BASIC, P_MAX_SKILL, P_NUM_SKILLS, P_RESTRICTED, P_SKILL, and P_UNSKILLED.

Referenced by dosacrifice().

Here is the caller graph for this function:

void use_skill ( int  skill,
int  degree 
)

References can_advance(), FALSE, give_may_advance_msg(), P_ADVANCE, P_NONE, and P_RESTRICTED.

Referenced by hmon_hitmon(), kickdmg(), and spelleffects().

Here is the call graph for this function:

Here is the caller graph for this function:

int uwep_skill_type (  )

References P_TWO_WEAPON_COMBAT, you::twoweap, u, uwep, and weapon_type().

Referenced by hmon_hitmon(), use_grapple(), and use_pole().

Here is the call graph for this function:

Here is the caller graph for this function:

int weapon_dam_bonus ( struct obj weapon )

References martial_bonus, max, P_BARE_HANDED_COMBAT, P_BASIC, P_EXPERT, P_ISRESTRICTED, P_LAST_WEAPON, P_NONE, P_SKILL, P_SKILLED, P_TWO_WEAPON_COMBAT, P_UNSKILLED, you::twoweap, u, uswapwep, uwep, and weapon_type().

Referenced by hmon_hitmon(), and maybe_tutorial().

Here is the call graph for this function:

Here is the caller graph for this function:

int weapon_hit_bonus ( struct obj weapon )

References martial_bonus, max, P_BARE_HANDED_COMBAT, P_BASIC, P_EXPERT, P_ISRESTRICTED, P_LAST_WEAPON, P_NONE, P_SKILL, P_SKILLED, P_TWO_WEAPON_COMBAT, P_UNSKILLED, you::twoweap, u, uswapwep, uwep, and weapon_type().

Referenced by find_roll_to_hit(), hmonas(), and thitmonst().

Here is the call graph for this function:

Here is the caller graph for this function:

int weapon_type ( struct obj obj )

Variable Documentation

STATIC_VAR NEARDATA const char* const barehands_or_martial[]
Initial value:
 {
    "bare handed combat", "martial arts"
}
const NEARDATA short hwep[] [static]
NEARDATA const char kebabable[] [static]
Initial value:
STATIC_VAR NEARDATA const char* const odd_skill_names[]
Initial value:
 {
    "no skill",
    "bare hands",               
    "two weapon combat",
    "riding",
    "polearms",
    "saber",
    "hammer",
    "whip",
    "attack spells",
    "healing spells",
    "divination spells",
    "enchantment spells",
    "clerical spells",
    "escape spells",
    "matter spells",
}
struct obj* propellor [static]

Referenced by mon_wield_item().

NEARDATA const int pwep[] [static]
NEARDATA const int rwep[] [static]
STATIC_VAR NEARDATA const short skill_names_indices[P_NUM_SKILLS]
struct skill_range skill_ranges[] [static]

Referenced by enhance_skill().