spell.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /* =============================================================================
  2. * PROGRAM: ularn
  3. * FILENAME: spell.h
  4. *
  5. * DESCRIPTION:
  6. * This module contains the functions used to process spells and spell like
  7. * effects.
  8. *
  9. * =============================================================================
  10. * EXPORTED VARIABLES
  11. *
  12. * splev : The maximum spell num to be learnt from a book found on each
  13. * dungeon level
  14. * spelcode : The three letter codes for the spells
  15. * spelname : The text name of each spell
  16. * speldescript : The text description of each spell.
  17. *
  18. * =============================================================================
  19. * EXPORTED FUNCTIONS
  20. *
  21. * godirect : Function to process ranged spell effects (including scrolls)
  22. * annihilate : Function to process the annihilate scroll
  23. * get_spell_code : Function to get the three letter spell code from the player
  24. * cast : Function to cast a spell
  25. *
  26. * =============================================================================
  27. */
  28. #ifndef __SPELL_H
  29. #define __SPELL_H
  30. #include "dungeon.h"
  31. #include "ularn_win.h"
  32. typedef enum {
  33. SPELL_PRO, /* Protection */
  34. SPELL_MLE, /* Magic missile */
  35. SPELL_DEX, /* Dexterity */
  36. SPELL_SLE, /* Sleep */
  37. SPELL_CHM, /* Charm monster */
  38. SPELL_SSP, /* Sonic spear */
  39. SPELL_WEB, /* Web */
  40. SPELL_STR, /* Strength */
  41. SPELL_ENL, /* Enlightenment */
  42. SPELL_HEL, /* Healing */
  43. SPELL_CBL, /* Cure blindness */
  44. SPELL_CRE, /* Create monster */
  45. SPELL_PHA, /* Phantasmal forces */
  46. SPELL_INV, /* Invisibility */
  47. SPELL_BAL, /* Fireball */
  48. SPELL_CLD, /* Cold */
  49. SPELL_PLY, /* Polymorph */
  50. SPELL_CAN, /* Cancellation */
  51. SPELL_HAS, /* Haste */
  52. SPELL_CKL, /* Cloud kill */
  53. SPELL_VPR, /* Vaporise rock */
  54. SPELL_DRY, /* Dehydration */
  55. SPELL_LIT, /* Lightning */
  56. SPELL_DRL, /* Drain life */
  57. SPELL_GLO, /* Invulnerability */
  58. SPELL_FLO, /* Flood */
  59. SPELL_FGR, /* Finger of Death */
  60. SPELL_SCA, /* Scare monster */
  61. SPELL_HLD, /* Hold monster */
  62. SPELL_STP, /* Stop time */
  63. SPELL_TEL, /* Teleport away */
  64. SPELL_MFI, /* Magic fire */
  65. SPELL_MKW, /* Make wall */
  66. SPELL_SPH, /* Sphere of annihilation */
  67. SPELL_GEN, /* Genocide */
  68. SPELL_SUM, /* Summon demon */
  69. SPELL_WTW, /* Walk through walls */
  70. SPELL_ALT, /* Alter reality */
  71. SPELL_PER, /* Permanence */
  72. SPELL_COUNT
  73. } SpellType;
  74. /* The dexterity boost from the DEX spell */
  75. #define SDEXTERITY_BOOST 3
  76. /* The strength boost from the STR spell */
  77. #define SSTRENGTH_BOOST 3
  78. /* The protection boost from the PRO spell */
  79. #define SPELL_PRO_BOOST 2
  80. /* The protection boost from a globe of invulnerability */
  81. #define SPELL_GLOBE_BOOST 10
  82. /*
  83. * This array defines the highest spell number that may be learnt from a
  84. * book found on each level of the dungeon
  85. */
  86. extern char splev[NLEVELS];
  87. /*
  88. * The spell codes
  89. */
  90. extern char *spelcode[SPELL_COUNT];
  91. /*
  92. * The spell names
  93. */
  94. extern char *spelname[SPELL_COUNT];
  95. /*
  96. * The spell descriptions
  97. */
  98. extern char *speldescript[SPELL_COUNT];
  99. /* =============================================================================
  100. * FUNCTION: godirect
  101. *
  102. * DESCRIPTION:
  103. * Function to hit in a direction from a missile weapon and have it keep on
  104. * going in that direction until its power is exhausted Enter with the spell
  105. * number in spnum, the power of the weapon in hp, Printf format string in
  106. * str, the # of milliseconds to delay between locations in delay, and the
  107. * character to represent the weapon in cshow. Returns no value.
  108. *
  109. * PARAMETERS:
  110. *
  111. * spnum : The number of the spell being cast
  112. *
  113. * dam : The initial amount of damage assigned to the spell
  114. *
  115. * delay : The delay between moving the spell effect in milliseconds
  116. *
  117. * cshow : The effect to show for this spell.
  118. *
  119. * RETURN VALUE:
  120. *
  121. * None.
  122. */
  123. void godirect(SpellType spnum, int dam, char *str, int delay,
  124. DirEffectsType cshow);
  125. /* =============================================================================
  126. * FUNCTION: annihilate
  127. *
  128. * DESCRIPTION:
  129. * Routine to annihilate all monsters around player (playerx,playery)
  130. * Gives player experience, but no dropped objects Returns the experience gained
  131. * from all monsters killed
  132. *
  133. * PARAMETERS:
  134. *
  135. * None.
  136. *
  137. * RETURN VALUE:
  138. *
  139. * None.
  140. */
  141. void annihilate(void);
  142. /* =============================================================================
  143. * FUNCTION: get_spell_code
  144. *
  145. * DESCRIPTION:
  146. * Function to get the player to input the three letter spell code.
  147. *
  148. * PARAMETERS:
  149. *
  150. * prompt : The prompt to display
  151. *
  152. * code : A pointer to the string to contain the spell code.
  153. * Must be at least 3 characters.
  154. * If the spell code entry is aborted (ESC pressed) then the first
  155. * character of code is set to 0.
  156. *
  157. * RETURN VALUE:
  158. *
  159. * None.
  160. */
  161. void get_spell_code(char *prompt, char *code);
  162. /* =============================================================================
  163. * FUNCTION: cast
  164. *
  165. * DESCRIPTION:
  166. * Subroutine called by parse to cast a spell for the player.
  167. *
  168. * PARAMETERS:
  169. *
  170. * None.
  171. *
  172. * RETURN VALUE:
  173. *
  174. * None.
  175. */
  176. void cast(void);
  177. #endif