123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432 |
- /* =============================================================================
- * PROGRAM: ularn
- * FILENAME: monster.h
- *
- * DESCRIPTION:
- * This module handles most aspects of monsters in the game.
- * It provides the monster definitions.
- * Handles monster creation.
- * All monster movement, including attacking the player (including special
- * attacks) is handled here.
- * Also handles loading and saving monster state data.
- *
- * =============================================================================
- * EXPORTED VARIABLES
- *
- * monstnamelist : The character code for displaying each monster
- * monsttilelist : The gfx tile for each monster
- * monster : The monster data
- * lastmonst : The name of the last monster being processed.
- * last_monst_id : The id of the last monster being processed.
- * last_monst_hx : The x location of the last monster hit by the player
- * last_monst_hy : The y location of the last monster hit by the player
- * rmst : The random monster creation countdown.
- *
- * =============================================================================
- * EXPORTED FUNCTIONS
- *
- * createmonster
- * mon_has_item : Checks if a monster has a specific item
- * fullhit : Do full damage to a monster
- * ifblind : Display the monster hir, accounting for blindness
- * hitmonster : Function to hit a monster
- * hitm : Function to just hit a monster (no checks for AC)
- * hitplayer : Function for a monster to hit the player
- * makemonst : Make a monster number appropriate to a dungeon level
- * randmonst : Create a random monster on the current cave level
- * teleportmonst : Teleport a monster
- * movemonst : Move monsters.
- * parse2 : Function to call when player is not to move, but monsters are
- * write_monster_data : Function to write the monster data to the save file
- * read_monster_data : Function to read the monster data from the save file
- *
- * =============================================================================
- */
- #ifndef __MONSTER_H
- #define __MONSTER_H
- #include "dungeon.h"
- #define MAXMONST 57 /* maximum # monsters in the dungeon */
- struct monst {
- char *name;
- char level;
- char armorclass;
- char damage;
- char attack;
- char intelligence;
- short gold;
- short hitpoints;
- long experience;
- long flags;
- };
- /*
- * Flags for monst structure
- */
- #define FL_NONE 0x00 /* Nothing of interest */
- #define FL_GENOCIDED 0x01 /* Monster has been genocided */
- #define FL_HEAD 0x02 /* Monster has a head */
- #define FL_NOBEHEAD 0x04 /* Monster cannot be beheaded by Vorpy */
- #define FL_SLOW 0x08 /* Monster moves at 1/2 nornal speed */
- #define FL_FLY 0x10 /* Monster can fly over pits and trapdoors */
- #define FL_SPIRIT 0x20 /* Is a spirit (affected by spirit prot) */
- #define FL_UNDEAD 0x40 /* Is undead (affected by undead prot) */
- #define FL_INFRAVIS 0x80 /* Monster has infravision (see invisible) */
- /************* Defines for the monsters as objects *************/
- typedef enum {
- MONST_NONE,
- LEMMING,
- GNOME,
- HOBGOBLIN,
- JACKAL,
- KOBOLD,
- ORC,
- SNAKE,
- CENTIPEDE,
- JACULI,
- TROGLODYTE,
- ANT,
- EYE,
- LEPRECHAUN,
- NYMPH,
- QUASIT,
- RUSTMONSTER,
- ZOMBIE,
- ASSASSINBUG,
- BUGBEAR,
- HELLHOUND,
- ICELIZARD,
- CENTAUR,
- TROLL,
- YETI,
- WHITEDRAGON,
- ELF,
- CUBE,
- METAMORPH,
- VORTEX,
- ZILLER,
- VIOLETFUNGI,
- WRAITH,
- FORVALAKA,
- LAMANOBE,
- OSEQUIP,
- ROTHE,
- XORN,
- VAMPIRE,
- INVISIBLESTALKER,
- POLTERGEIST,
- DISENCHANTRESS,
- SHAMBLINGMOUND,
- YELLOWMOLD,
- UMBERHULK,
- GNOMEKING,
- MIMIC,
- WATERLORD,
- BRONZEDRAGON,
- GREENDRAGON,
- PURPLEWORM,
- XVART,
- SPIRITNAGA,
- SILVERDRAGON,
- PLATINUMDRAGON,
- GREENURCHIN,
- REDDRAGON,
- DEMONLORD,
- DEMONLORD_II,
- DEMONLORD_III,
- DEMONLORD_IV,
- DEMONLORD_V,
- DEMONLORD_VI,
- DEMONLORD_VII,
- DEMONPRINCE,
- LUCIFER,
- MONST_COUNT
- } MonsterIdType;
- /*
- * Character codes to use for monsters
- */
- extern char monstnamelist[MONST_COUNT];
- /*
- * Tile numbers to use for monsters
- */
- extern int monsttilelist[MONST_COUNT];
- /*
- * The monster data
- */
- extern struct monst monster[MONST_COUNT];
- /*
- * Name of the current monster
- */
- extern char lastmonst[40];
- /* number of the last monster hitting the player */
- extern MonsterIdType last_monst_id;
- extern int last_monst_hx; /* x location of the last monster hit by player */
- extern int last_monst_hy; /* y location of the last monster hit by player */
- extern char rmst; /* Random monster creation timer */
- /* =============================================================================
- * FUNCTION: createmonster
- *
- * DESCRIPTION:
- * Function to create a monster next to the player.
- *
- * PARAMETERS:
- *
- * mon : The id of the monster to create.
- *
- * RETURN VALUE:
- *
- * None.
- */
- void createmonster(MonsterIdType mon);
- /* =============================================================================
- * FUNCTION: mon_has_item
- *
- * DESCRIPTION:
- * This function returns true if the monster at location x, y has Item
- * in its inventory.
- * If there is no monster at x, y then the function returns false.
- *
- * PARAMETERS:
- *
- * x : The x location to check
- *
- * y : The y location to check
- *
- * Item : The item to check for.
- *
- * RETURN VALUE:
- *
- * true if the monster at (x, y) has Item, false otherwise.
- */
- int mon_has_item(int x, int y, int Item);
- /* =============================================================================
- * FUNCTION: fullhit
- *
- * DESCRIPTION:
- * Function to return hp damage to monster due to a number of full hits.
- *
- * PARAMETERS:
- *
- * xx : The number of full hits.
- *
- * RETURN VALUE:
- *
- * The total damage done by xx full hits.
- */
- int fullhit(int xx);
- /* =============================================================================
- * FUNCTION: ifblind
- *
- * DESCRIPTION:
- * Subroutine to copy the word "monster" into lastmonst if the player is blind,
- * or the monster name if not.
- *
- * PARAMETERS:
- *
- * x : The x location of the monster
- *
- * y : The y location of the monster
- *
- * RETURN VALUE:
- *
- * None.
- */
- void ifblind(int x, int y);
- /* =============================================================================
- * FUNCTION: hitmonster
- *
- * DESCRIPTION:
- * Function to hit a monster at the designated coordinates.
- * This routine is used for a bash & slash type attack on a monster.
- *
- * PARAMETERS:
- *
- * x : The x location of the monster
- *
- * y : The y location of the monster
- *
- * RETURN VALUE:
- *
- * None
- */
- void hitmonster(int x, int y);
- /* =============================================================================
- * FUNCTION: hitm
- *
- * DESCRIPTION:
- * Function to just hit a monster at a given coordinates.
- * This routine is used to specifically damage a monster at a location.
- * The function handles damage from both weapons and spells.
- *
- * PARAMETERS:
- *
- * x : The x location of the monster.
- *
- * y : The y location of the monster.
- *
- * amt : The amount of damage being dealt.
- *
- * SpellFlag : This flag is to be set to true if the damage is from a spell.
- *
- * RETURN VALUE:
- *
- * Returns the number of hitpoints the monster absorbed.
- */
- int hitm(int x, int y, int amt, int SpellFlag);
- /* =============================================================================
- * FUNCTION: hitplayer
- *
- * DESCRIPTION:
- * Function for the monster at the designated location to hit the player.
- *
- * PARAMETERS:
- *
- * x : The x location of the monster.
- *
- * y : THe y location of the monster.
- *
- * RETURN VALUE:
- *
- * None.
- */
- void hitplayer(int x, int y);
- /* =============================================================================
- * FUNCTION: makemonst
- *
- * DESCRIPTION:
- * Function to return monster number for a randomly selected monster for the
- * given cave level.
- *
- * PARAMETERS:
- *
- * lev : The cave level for the monster
- *
- * RETURN VALUE:
- *
- * None.
- */
- int makemonst(int lev);
- /* =============================================================================
- * FUNCTION: randmonst
- *
- * DESCRIPTION:
- * Function to randomly create monsters if needed.
- *
- * PARAMETERS:
- *
- * None.
- *
- * RETURN VALUE:
- *
- * None.
- */
- void randmonst(void);
- /* =============================================================================
- * FUNCTION: teleportmonst
- *
- * DESCRIPTION:
- * Function to teleport a monster.
- *
- * PARAMETERS:
- *
- * xx : The x location of the monster
- *
- * yy : The y location of the monster
- *
- * monst : The monster id.
- *
- * RETURN VALUE:
- *
- * None.
- */
- void teleportmonst(int xx, int yy, int monst);
- /* =============================================================================
- * FUNCTION: movemonst
- *
- * DESCRIPTION:
- * This routine has the responsibility to determine which monsters are to
- * move, and to perform the movement.
- *
- * PARAMETERS:
- *
- * None.
- *
- * RETURN VALUE:
- *
- * None.
- */
- void movemonst(void);
- /* =============================================================================
- * FUNCTION: parse2
- *
- * DESCRIPTION:
- * Move things while player is out of action.
- *
- * PARAMETERS:
- *
- * None.
- *
- * RETURN VALUE:
- *
- * None.
- */
- void parse2(void);
- /* =============================================================================
- * FUNCTION: write_monster_data
- *
- * DESCRIPTION:
- * Function to write the monster data to the save file.
- *
- * PARAMETERS:
- *
- * fp : A pointer to the save file being written.
- *
- * RETURN VALUE:
- *
- * None.
- */
- void write_monster_data(FILE *fp);
- /* =============================================================================
- * FUNCTION: read_monster_data
- *
- * DESCRIPTION:
- * Function to read the monster data from the save file.
- *
- * PARAMETERS:
- *
- * fp : A pointer to the save file being read.
- *
- * RETURN VALUE:
- *
- * None.
- */
- void read_monster_data(FILE *fp);
- #endif
|