Source:NetHack 3.6.1/include/skills.h

From NetHackWiki
(Redirected from Skills.h)
Jump to: navigation, search

Below is the full text to skills.h from the source code of NetHack 3.6.1. To link to a particular line, write [[Source:NetHack 3.6.1/include/skills.h#line123]], for example.

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

  1.  /* NetHack 3.6	skills.h	$NHDT-Date: 1432512778 2015/05/25 00:12:58 $  $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ */
  2.  /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985-1999. */
  3.  /*-Copyright (c) Pasi Kallinen, 2017. */
  4.  /* NetHack may be freely redistributed.  See license for details. */
  5.  
  6.  #ifndef SKILLS_H
  7.  #define SKILLS_H
  8.  
  9.  /* Much of this code was taken from you.h.  It is now
  10.   * in a separate file so it can be included in objects.c.
  11.   */
  12.  
  13.  enum p_skills {
  14.      /* Code to denote that no skill is applicable */
  15.      P_NONE = 0,
  16.  
  17.  /* Weapon Skills -- Stephen White
  18.   * Order matters and are used in macros.
  19.   * Positive values denote hand-to-hand weapons or launchers.
  20.   * Negative values denote ammunition or missiles.
  21.   * Update weapon.c if you amend any skills.
  22.   * Also used for oc_subtyp.
  23.   */
  24.      P_DAGGER,
  25.      P_KNIFE,
  26.      P_AXE,
  27.      P_PICK_AXE,
  28.      P_SHORT_SWORD,
  29.      P_BROAD_SWORD,
  30.      P_LONG_SWORD,
  31.      P_TWO_HANDED_SWORD,
  32.      P_SCIMITAR,
  33.      P_SABER,
  34.      P_CLUB, /* Heavy-shafted bludgeon */
  35.      P_MACE,
  36.      P_MORNING_STAR, /* Spiked bludgeon */
  37.      P_FLAIL,        /* Two pieces hinged or chained together */
  38.      P_HAMMER,       /* Heavy head on the end */
  39.      P_QUARTERSTAFF, /* Long-shafted bludgeon */
  40.      P_POLEARMS,
  41.      P_SPEAR, /* includes javelin */
  42.      P_TRIDENT,
  43.      P_LANCE,
  44.      P_BOW,
  45.      P_SLING,
  46.      P_CROSSBOW,
  47.      P_DART,
  48.      P_SHURIKEN,
  49.      P_BOOMERANG,
  50.      P_WHIP,
  51.      P_UNICORN_HORN, /* last weapon */
  52.  
  53.      /* Spell Skills added by Larry Stewart-Zerba */
  54.      P_ATTACK_SPELL,
  55.      P_HEALING_SPELL,
  56.      P_DIVINATION_SPELL,
  57.      P_ENCHANTMENT_SPELL,
  58.      P_CLERIC_SPELL,
  59.      P_ESCAPE_SPELL,
  60.      P_MATTER_SPELL,
  61.  
  62.      /* Other types of combat */
  63.      P_BARE_HANDED_COMBAT, /* actually weaponless; gloves are ok */
  64.      P_TWO_WEAPON_COMBAT,
  65.      P_RIDING,             /* How well you control your steed */
  66.  
  67.      P_NUM_SKILLS
  68.  };
  69.  
  70.  #define P_MARTIAL_ARTS P_BARE_HANDED_COMBAT /* Role distinguishes */
  71.  
  72.  #define P_FIRST_WEAPON P_DAGGER
  73.  #define P_LAST_WEAPON P_UNICORN_HORN
  74.  
  75.  #define P_FIRST_SPELL P_ATTACK_SPELL
  76.  #define P_LAST_SPELL P_MATTER_SPELL
  77.  
  78.  #define P_LAST_H_TO_H P_RIDING
  79.  #define P_FIRST_H_TO_H P_BARE_HANDED_COMBAT
  80.  
  81.  /* These roles qualify for a martial arts bonus */
  82.  #define martial_bonus() (Role_if(PM_SAMURAI) || Role_if(PM_MONK))
  83.  
  84.  /*
  85.   * These are the standard weapon skill levels.  It is important that
  86.   * the lowest "valid" skill be be 1.  The code calculates the
  87.   * previous amount to practice by calling  practice_needed_to_advance()
  88.   * with the current skill-1.  To work out for the UNSKILLED case,
  89.   * a value of 0 needed.
  90.   */
  91.  enum skill_levels {
  92.      P_ISRESTRICTED = 0,
  93.      P_UNSKILLED,
  94.      P_BASIC,
  95.      P_SKILLED,
  96.      P_EXPERT,
  97.      P_MASTER,       /* Unarmed combat/martial arts only */
  98.      P_GRAND_MASTER  /* Unarmed combat/martial arts only */
  99.  };
  100.  
  101.  #define practice_needed_to_advance(level) ((level) * (level) *20)
  102.  
  103.  /* The hero's skill in various weapons. */
  104.  struct skills {
  105.      xchar skill;
  106.      xchar max_skill;
  107.      unsigned short advance;
  108.  };
  109.  
  110.  #define P_SKILL(type) (u.weapon_skills[type].skill)
  111.  #define P_MAX_SKILL(type) (u.weapon_skills[type].max_skill)
  112.  #define P_ADVANCE(type) (u.weapon_skills[type].advance)
  113.  #define P_RESTRICTED(type) (u.weapon_skills[type].skill == P_ISRESTRICTED)
  114.  
  115.  #define P_SKILL_LIMIT 60 /* Max number of skill advancements */
  116.  
  117.  /* Initial skill matrix structure; used in u_init.c and weapon.c */
  118.  struct def_skill {
  119.      xchar skill;
  120.      xchar skmax;
  121.  };
  122.  
  123.  #endif /* SKILLS_H */