Source:NetHack 3.6.0/include/you.h

From NetHackWiki
Jump to: navigation, search

Below is the full text to you.h from the source code of NetHack 3.6.0. To link to a particular line, write [[Source:NetHack 3.6.0/include/you.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	you.h	$NHDT-Date: 1432512782 2015/05/25 00:13:02 $  $NHDT-Branch: master $:$NHDT-Revision: 1.29 $ */
  2.  /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  3.  /* NetHack may be freely redistributed.  See license for details. */
  4.  
  5.  #ifndef YOU_H
  6.  #define YOU_H
  7.  
  8.  #include "attrib.h"
  9.  #include "monst.h"
  10.  #ifndef PROP_H
  11.  #include "prop.h" /* (needed here for util/makedefs.c) */
  12.  #endif
  13.  #include "skills.h"
  14.  
  15.  /*** Substructures ***/
  16.  
  17.  struct RoleName {
  18.      const char *m; /* name when character is male */
  19.      const char *f; /* when female; null if same as male */
  20.  };
  21.  
  22.  struct RoleAdvance {
  23.      /* "fix" is the fixed amount, "rnd" is the random amount */
  24.      xchar infix, inrnd; /* at character initialization */
  25.      xchar lofix, lornd; /* gained per level <  urole.xlev */
  26.      xchar hifix, hirnd; /* gained per level >= urole.xlev */
  27.  };
  28.  
  29.  struct u_have {
  30.      Bitfield(amulet, 1);   /* carrying Amulet	*/
  31.      Bitfield(bell, 1);     /* carrying Bell	*/
  32.      Bitfield(book, 1);     /* carrying Book	*/
  33.      Bitfield(menorah, 1);  /* carrying Candelabrum */
  34.      Bitfield(questart, 1); /* carrying the Quest Artifact */
  35.      Bitfield(unused, 3);
  36.  };
  37.  
  38.  struct u_event {
  39.      Bitfield(minor_oracle, 1); /* received at least 1 cheap oracle */
  40.      Bitfield(major_oracle, 1); /*  "  expensive oracle */
  41.      Bitfield(read_tribute, 1); /* read a passage from a novel */
  42.      Bitfield(qcalled, 1);      /* called by Quest leader to do task */
  43.      Bitfield(qexpelled, 1);    /* expelled from the Quest dungeon */
  44.      Bitfield(qcompleted, 1);   /* successfully completed Quest task */
  45.      Bitfield(uheard_tune, 2);  /* 1=know about, 2=heard passtune */
  46.  
  47.      Bitfield(uopened_dbridge, 1);   /* opened the drawbridge */
  48.      Bitfield(invoked, 1);           /* invoked Gate to the Sanctum level */
  49.      Bitfield(gehennom_entered, 1);  /* entered Gehennom via Valley */
  50.      Bitfield(uhand_of_elbereth, 2); /* became Hand of Elbereth */
  51.      Bitfield(udemigod, 1);          /* killed the wiz */
  52.      Bitfield(uvibrated, 1);         /* stepped on "vibrating square" */
  53.      Bitfield(ascended, 1);          /* has offered the Amulet */
  54.  };
  55.  
  56.  struct u_achieve {
  57.      Bitfield(amulet, 1);  /* touched Amulet */
  58.      Bitfield(bell, 1);    /* touched Bell */
  59.      Bitfield(book, 1);    /* touched Book */
  60.      Bitfield(menorah, 1); /* touched Candelabrum */
  61.      Bitfield(enter_gehennom,
  62.               1);           /* entered Gehennom (or Valley) by any means */
  63.      Bitfield(ascended, 1); /* not quite the same as u.uevent.ascended */
  64.      Bitfield(mines_luckstone, 1); /* got a luckstone at end of mines */
  65.      Bitfield(finish_sokoban, 1);  /* obtained the sokoban prize */
  66.  
  67.      Bitfield(killed_medusa, 1);
  68.  };
  69.  
  70.  struct u_realtime {
  71.      long
  72.          realtime; /* actual playing time up until the last restore, seconds */
  73.      time_t restored; /* time the game was started or restored */
  74.      time_t endtime;
  75.  };
  76.  
  77.  /* KMH, conduct --
  78.   * These are voluntary challenges.  Each field denotes the number of
  79.   * times a challenge has been violated.
  80.   */
  81.  struct u_conduct {     /* number of times... */
  82.      long unvegetarian; /* eaten any animal */
  83.      long unvegan;      /* ... or any animal byproduct */
  84.      long food;         /* ... or any comestible */
  85.      long gnostic;      /* used prayer, priest, or altar */
  86.      long weaphit;      /* hit a monster with a weapon */
  87.      long killer;       /* killed a monster yourself */
  88.      long literate;     /* read something (other than BotD) */
  89.      long polypiles;    /* polymorphed an object */
  90.      long polyselfs;    /* transformed yourself */
  91.      long wishes;       /* used a wish */
  92.      long wisharti;     /* wished for an artifact */
  93.      /* genocides already listed at end of game */
  94.  };
  95.  
  96.  struct u_roleplay {
  97.      boolean blind;  /* permanently blind */
  98.      boolean nudist; /* has not worn any armor, ever */
  99.      long numbones;  /* # of bones files loaded  */
  100.  };
  101.  
  102.  /*** Unified structure containing role information ***/
  103.  struct Role {
  104.      /*** Strings that name various things ***/
  105.      struct RoleName name;    /* the role's name (from u_init.c) */
  106.      struct RoleName rank[9]; /* names for experience levels (from botl.c) */
  107.      const char *lgod, *ngod, *cgod; /* god names (from pray.c) */
  108.      const char *filecode;           /* abbreviation for use in file names */
  109.      const char *homebase; /* quest leader's location (from questpgr.c) */
  110.      const char *intermed; /* quest intermediate goal (from questpgr.c) */
  111.  
  112.      /*** Indices of important monsters and objects ***/
  113.      short malenum, /* index (PM_) as a male (botl.c) */
  114.          femalenum, /* ...or as a female (NON_PM == same) */
  115.          petnum,    /* PM_ of preferred pet (NON_PM == random) */
  116.          ldrnum,    /* PM_ of quest leader (questpgr.c) */
  117.          guardnum,  /* PM_ of quest guardians (questpgr.c) */
  118.          neminum,   /* PM_ of quest nemesis (questpgr.c) */
  119.          enemy1num, /* specific quest enemies (NON_PM == random) */
  120.          enemy2num;
  121.      char enemy1sym, /* quest enemies by class (S_) */
  122.          enemy2sym;
  123.      short questarti; /* index (ART_) of quest artifact (questpgr.c) */
  124.  
  125.      /*** Bitmasks ***/
  126.      short allow;             /* bit mask of allowed variations */
  127.  #define ROLE_RACEMASK 0x0ff8 /* allowable races */
  128.  #define ROLE_GENDMASK 0xf000 /* allowable genders */
  129.  #define ROLE_MALE 0x1000
  130.  #define ROLE_FEMALE 0x2000
  131.  #define ROLE_NEUTER 0x4000
  132.  #define ROLE_ALIGNMASK AM_MASK /* allowable alignments */
  133.  #define ROLE_LAWFUL AM_LAWFUL
  134.  #define ROLE_NEUTRAL AM_NEUTRAL
  135.  #define ROLE_CHAOTIC AM_CHAOTIC
  136.  
  137.      /*** Attributes (from attrib.c and exper.c) ***/
  138.      xchar attrbase[A_MAX];    /* lowest initial attributes */
  139.      xchar attrdist[A_MAX];    /* distribution of initial attributes */
  140.      struct RoleAdvance hpadv; /* hit point advancement */
  141.      struct RoleAdvance enadv; /* energy advancement */
  142.      xchar xlev;               /* cutoff experience level */
  143.      xchar initrecord;         /* initial alignment record */
  144.  
  145.      /*** Spell statistics (from spell.c) ***/
  146.      int spelbase; /* base spellcasting penalty */
  147.      int spelheal; /* penalty (-bonus) for healing spells */
  148.      int spelshld; /* penalty for wearing any shield */
  149.      int spelarmr; /* penalty for wearing metal armour */
  150.      int spelstat; /* which stat (A_) is used */
  151.      int spelspec; /* spell (SPE_) the class excels at */
  152.      int spelsbon; /* penalty (-bonus) for that spell */
  153.  
  154.      /*** Properties in variable-length arrays ***/
  155.      /* intrinsics (see attrib.c) */
  156.      /* initial inventory (see u_init.c) */
  157.      /* skills (see u_init.c) */
  158.  
  159.      /*** Don't forget to add... ***/
  160.      /* quest leader, guardians, nemesis (monst.c) */
  161.      /* quest artifact (artilist.h) */
  162.      /* quest dungeon definition (dat/Xyz.dat) */
  163.      /* quest text (dat/quest.txt) */
  164.      /* dictionary entries (dat/data.bas) */
  165.  };
  166.  
  167.  extern const struct Role roles[]; /* table of available roles */
  168.  extern struct Role urole;
  169.  #define Role_if(X) (urole.malenum == (X))
  170.  #define Role_switch (urole.malenum)
  171.  
  172.  /* used during initialization for race, gender, and alignment
  173.     as well as for character class */
  174.  #define ROLE_NONE (-1)
  175.  #define ROLE_RANDOM (-2)
  176.  
  177.  /*** Unified structure specifying race information ***/
  178.  
  179.  struct Race {
  180.      /*** Strings that name various things ***/
  181.      const char *noun;           /* noun ("human", "elf") */
  182.      const char *adj;            /* adjective ("human", "elven") */
  183.      const char *coll;           /* collective ("humanity", "elvenkind") */
  184.      const char *filecode;       /* code for filenames */
  185.      struct RoleName individual; /* individual as a noun ("man", "elf") */
  186.  
  187.      /*** Indices of important monsters and objects ***/
  188.      short malenum, /* PM_ as a male monster */
  189.          femalenum, /* ...or as a female (NON_PM == same) */
  190.          mummynum,  /* PM_ as a mummy */
  191.          zombienum; /* PM_ as a zombie */
  192.  
  193.      /*** Bitmasks ***/
  194.      short allow;    /* bit mask of allowed variations */
  195.      short selfmask, /* your own race's bit mask */
  196.          lovemask,   /* bit mask of always peaceful */
  197.          hatemask;   /* bit mask of always hostile */
  198.  
  199.      /*** Attributes ***/
  200.      xchar attrmin[A_MAX];     /* minimum allowable attribute */
  201.      xchar attrmax[A_MAX];     /* maximum allowable attribute */
  202.      struct RoleAdvance hpadv; /* hit point advancement */
  203.      struct RoleAdvance enadv; /* energy advancement */
  204.  #if 0                         /* DEFERRED */
  205.  	int   nv_range;		/* night vision range */
  206.  	int   xray_range;	/* X-ray vision range */
  207.  #endif
  208.  
  209.      /*** Properties in variable-length arrays ***/
  210.      /* intrinsics (see attrib.c) */
  211.  
  212.      /*** Don't forget to add... ***/
  213.      /* quest leader, guardians, nemesis (monst.c) */
  214.      /* quest dungeon definition (dat/Xyz.dat) */
  215.      /* quest text (dat/quest.txt) */
  216.      /* dictionary entries (dat/data.bas) */
  217.  };
  218.  
  219.  extern const struct Race races[]; /* Table of available races */
  220.  extern struct Race urace;
  221.  #define Race_if(X) (urace.malenum == (X))
  222.  #define Race_switch (urace.malenum)
  223.  
  224.  /*** Unified structure specifying gender information ***/
  225.  struct Gender {
  226.      const char *adj;      /* male/female/neuter */
  227.      const char *he;       /* he/she/it */
  228.      const char *him;      /* him/her/it */
  229.      const char *his;      /* his/her/its */
  230.      const char *filecode; /* file code */
  231.      short allow;          /* equivalent ROLE_ mask */
  232.  };
  233.  #define ROLE_GENDERS 2 /* number of permitted player genders */
  234.  /* increment to 3 if you allow neuter roles */
  235.  
  236.  extern const struct Gender genders[]; /* table of available genders */
  237.  #define uhe() (genders[flags.female ? 1 : 0].he)
  238.  #define uhim() (genders[flags.female ? 1 : 0].him)
  239.  #define uhis() (genders[flags.female ? 1 : 0].his)
  240.  #define mhe(mtmp) (genders[pronoun_gender(mtmp)].he)
  241.  #define mhim(mtmp) (genders[pronoun_gender(mtmp)].him)
  242.  #define mhis(mtmp) (genders[pronoun_gender(mtmp)].his)
  243.  
  244.  /*** Unified structure specifying alignment information ***/
  245.  struct Align {
  246.      const char *noun;     /* law/balance/chaos */
  247.      const char *adj;      /* lawful/neutral/chaotic */
  248.      const char *filecode; /* file code */
  249.      short allow;          /* equivalent ROLE_ mask */
  250.      aligntyp value;       /* equivalent A_ value */
  251.  };
  252.  #define ROLE_ALIGNS 3 /* number of permitted player alignments */
  253.  
  254.  extern const struct Align aligns[]; /* table of available alignments */
  255.  
  256.  /*** Information about the player ***/
  257.  struct you {
  258.      xchar ux, uy;
  259.      schar dx, dy, dz;  /* direction of move (or zap or ... ) */
  260.      schar di;          /* direction of FF */
  261.      xchar tx, ty;      /* destination of travel */
  262.      xchar ux0, uy0;    /* initial position FF */
  263.      d_level uz, uz0;   /* your level on this and the previous turn */
  264.      d_level utolev;    /* level monster teleported you to, or uz */
  265.      uchar utotype;     /* bitmask of goto_level() flags for utolev */
  266.      boolean umoved;    /* changed map location (post-move) */
  267.      int last_str_turn; /* 0: none, 1: half turn, 2: full turn */
  268.                         /* +: turn right, -: turn left */
  269.      int ulevel;        /* 1 to MAXULEV */
  270.      int ulevelmax;
  271.      unsigned utrap;     /* trap timeout */
  272.      unsigned utraptype; /* defined if utrap nonzero */
  273.  #define TT_BEARTRAP 0
  274.  #define TT_PIT 1
  275.  #define TT_WEB 2
  276.  #define TT_LAVA 3
  277.  #define TT_INFLOOR 4
  278.  #define TT_BURIEDBALL 5
  279.      char urooms[5];         /* rooms (roomno + 3) occupied now */
  280.      char urooms0[5];        /* ditto, for previous position */
  281.      char uentered[5];       /* rooms (roomno + 3) entered this turn */
  282.      char ushops[5];         /* shop rooms (roomno + 3) occupied now */
  283.      char ushops0[5];        /* ditto, for previous position */
  284.      char ushops_entered[5]; /* ditto, shops entered this turn */
  285.      char ushops_left[5];    /* ditto, shops exited this turn */
  286.  
  287.      int uhunger;  /* refd only in eat.c and shk.c */
  288.      unsigned uhs; /* hunger state - see eat.c */
  289.  
  290.      struct prop uprops[LAST_PROP + 1];
  291.  
  292.      unsigned umconf;
  293.      Bitfield(usick_type, 2);
  294.  #define SICK_VOMITABLE 0x01
  295.  #define SICK_NONVOMITABLE 0x02
  296.  #define SICK_ALL 0x03
  297.  
  298.      /* These ranges can never be more than MAX_RANGE (vision.h). */
  299.      int nv_range;   /* current night vision range */
  300.      int xray_range; /* current xray vision range */
  301.  
  302.  /*
  303.   * These variables are valid globally only when punished and blind.
  304.   */
  305.  #define BC_BALL 0x01  /* bit mask for ball  in 'bc_felt' below */
  306.  #define BC_CHAIN 0x02 /* bit mask for chain in 'bc_felt' below */
  307.      int bglyph;       /* glyph under the ball */
  308.      int cglyph;       /* glyph under the chain */
  309.      int bc_order;     /* ball & chain order [see bc_order() in ball.c] */
  310.      int bc_felt;      /* mask for ball/chain being felt */
  311.  
  312.      int umonster; /* hero's "real" monster num */
  313.      int umonnum;  /* current monster number */
  314.  
  315.      int mh, mhmax, mtimedone; /* for polymorph-self */
  316.      struct attribs macurr,    /* for monster attribs */
  317.          mamax;                /* for monster attribs */
  318.      int ulycn;                /* lycanthrope type */
  319.  
  320.      unsigned ucreamed;
  321.      unsigned uswldtim; /* time you have been swallowed */
  322.  
  323.      Bitfield(uswallow, 1);      /* true if swallowed */
  324.      Bitfield(uinwater, 1);      /* if you're currently in water (only
  325.                                     underwater possible currently) */
  326.      Bitfield(uundetected, 1);   /* if you're a hiding monster/piercer */
  327.      Bitfield(mfemale, 1);       /* saved human value of flags.female */
  328.      Bitfield(uinvulnerable, 1); /* you're invulnerable (praying) */
  329.      Bitfield(uburied, 1);       /* you're buried */
  330.      Bitfield(uedibility, 1); /* blessed food detection; sense unsafe food */
  331.      /* 1 free bit! */
  332.  
  333.      unsigned udg_cnt;          /* how long you have been demigod */
  334.      struct u_achieve uachieve; /* achievements */
  335.      struct u_event uevent;     /* certain events have happened */
  336.      struct u_have uhave;       /* you're carrying special objects */
  337.      struct u_conduct uconduct; /* KMH, conduct */
  338.      struct u_roleplay uroleplay;
  339.      struct attribs acurr, /* your current attributes (eg. str)*/
  340.          aexe,             /* for gain/loss via "exercise" */
  341.          abon,             /* your bonus attributes (eg. str) */
  342.          amax,             /* your max attributes (eg. str) */
  343.          atemp,            /* used for temporary loss/gain */
  344.          atime;            /* used for loss/gain countdown */
  345.      align ualign;         /* character alignment */
  346.  #define CONVERT 2
  347.  #define A_ORIGINAL 1
  348.  #define A_CURRENT 0
  349.      aligntyp ualignbase[CONVERT]; /* for ualign conversion record */
  350.      schar uluck, moreluck;        /* luck and luck bonus */
  351.  #define Luck (u.uluck + u.moreluck)
  352.  #define LUCKADD 3 /* added value when carrying luck stone */
  353.  #define LUCKMAX 10
  354.  #define LUCKMIN (-10)
  355.      schar uhitinc;
  356.      schar udaminc;
  357.      schar uac;
  358.      uchar uspellprot; /* protection by SPE_PROTECTION */
  359.      uchar usptime;    /* #moves until uspellprot-- */
  360.      uchar uspmtime;   /* #moves between uspellprot-- */
  361.      int uhp, uhpmax;
  362.      int uen, uenmax; /* magical energy - M. Stephenson */
  363.      xchar uhpinc[MAXULEV], ueninc[MAXULEV]; /* increases from level gain */
  364.      int ugangr;                             /* if the gods are angry at you */
  365.      int ugifts;                             /* number of artifacts bestowed */
  366.      int ublessed, ublesscnt;                /* blessing/duration from #pray */
  367.      long umoney0;
  368.      long uspare1;
  369.      long uexp, urexp;
  370.      long ucleansed; /* to record moves when player was cleansed */
  371.      long usleep;    /* sleeping; monstermove you last started */
  372.      int uinvault;
  373.      struct monst *ustuck;
  374.      struct monst *usteed;
  375.      long ugallop;
  376.      int urideturns;
  377.      int umortality;      /* how many times you died */
  378.      int ugrave_arise;    /* you die and become something aside from a ghost */
  379.      int weapon_slots;    /* unused skill slots */
  380.      int skills_advanced; /* # of advances made so far */
  381.      xchar skill_record[P_SKILL_LIMIT]; /* skill advancements */
  382.      struct skills weapon_skills[P_NUM_SKILLS];
  383.      boolean twoweap; /* KMH -- Using two-weapon combat */
  384.  
  385.  }; /* end of `struct you' */
  386.  
  387.  #define Upolyd (u.umonnum != u.umonster)
  388.  
  389.  #endif /* YOU_H */