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 "ularn_win.h"
  31. #include "dungeon.h"
  32. typedef enum
  33. {
  34. SPELL_PRO, /* Protection */
  35. SPELL_MLE, /* Magic missile */
  36. SPELL_DEX, /* Dexterity */
  37. SPELL_SLE, /* Sleep */
  38. SPELL_CHM, /* Charm monster */
  39. SPELL_SSP, /* Sonic spear */
  40. SPELL_WEB, /* Web */
  41. SPELL_STR, /* Strength */
  42. SPELL_ENL, /* Enlightenment */
  43. SPELL_HEL, /* Healing */
  44. SPELL_CBL, /* Cure blindness */
  45. SPELL_CRE, /* Create monster */
  46. SPELL_PHA, /* Phantasmal forces */
  47. SPELL_INV, /* Invisibility */
  48. SPELL_BAL, /* Fireball */
  49. SPELL_CLD, /* Cold */
  50. SPELL_PLY, /* Polymorph */
  51. SPELL_CAN, /* Cancellation */
  52. SPELL_HAS, /* Haste */
  53. SPELL_CKL, /* Cloud kill */
  54. SPELL_VPR, /* Vaporise rock */
  55. SPELL_DRY, /* Dehydration */
  56. SPELL_LIT, /* Lightning */
  57. SPELL_DRL, /* Drain life */
  58. SPELL_GLO, /* Invulnerability */
  59. SPELL_FLO, /* Flood */
  60. SPELL_FGR, /* Finger of Death */
  61. SPELL_SCA, /* Scare monster */
  62. SPELL_HLD, /* Hold monster */
  63. SPELL_STP, /* Stop time */
  64. SPELL_TEL, /* Teleport away */
  65. SPELL_MFI, /* Magic fire */
  66. SPELL_MKW, /* Make wall */
  67. SPELL_SPH, /* Sphere of annihilation */
  68. SPELL_GEN, /* Genocide */
  69. SPELL_SUM, /* Summon demon */
  70. SPELL_WTW, /* Walk through walls */
  71. SPELL_ALT, /* Alter reality */
  72. SPELL_PER, /* Permanence */
  73. SPELL_COUNT
  74. } SpellType;
  75. /* The dexterity boost from the DEX spell */
  76. #define SDEXTERITY_BOOST 3
  77. /* The strength boost from the STR spell */
  78. #define SSTRENGTH_BOOST 3
  79. /* The protection boost from the PRO spell */
  80. #define SPELL_PRO_BOOST 2
  81. /* The protection boost from a globe of invulnerability */
  82. #define SPELL_GLOBE_BOOST 10
  83. /*
  84. * This array defines the highest spell number that may be learnt from a
  85. * book found on each level of the dungeon
  86. */
  87. extern char splev[NLEVELS];
  88. /*
  89. * The spell codes
  90. */
  91. extern char *spelcode[SPELL_COUNT];
  92. /*
  93. * The spell names
  94. */
  95. extern char *spelname[SPELL_COUNT];
  96. /*
  97. * The spell descriptions
  98. */
  99. extern char *speldescript[SPELL_COUNT];
  100. /* =============================================================================
  101. * FUNCTION: godirect
  102. *
  103. * DESCRIPTION:
  104. * Function to hit in a direction from a missile weapon and have it keep on
  105. * going in that direction until its power is exhausted Enter with the spell
  106. * number in spnum, the power of the weapon in hp, Printf format string in
  107. * str, the # of milliseconds to delay between locations in delay, and the
  108. * character to represent the weapon in cshow. Returns no value.
  109. *
  110. * PARAMETERS:
  111. *
  112. * spnum : The number of the spell being cast
  113. *
  114. * dam : The initial amount of damage assigned to the spell
  115. *
  116. * delay : The delay between moving the spell effect in milliseconds
  117. *
  118. * cshow : The effect to show for this spell.
  119. *
  120. * RETURN VALUE:
  121. *
  122. * None.
  123. */
  124. void godirect(SpellType spnum, int dam, char *str, int delay, 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