abstract
| - Below is the full text to pray.c from the source code of NetHack 1.4f. To link to a particular line, write [[NetHack 1.4f/pray.c#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code 1. /* SCCS Id: @(#)pray.c 1.4 87/08/08 2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3. /* pray.c - version 1.0 */ 4. 5. #include "hack.h" 6. 7. extern char *nomovemsg; 8. /* 9. #ifdef KAA 10. extern char *xname(); 11. #endif 12. */ 13. dopray() { /* M. Stephenson (1.0.3b) */ 14. #ifdef PRAYERS 15. if (u.ublesscnt > 0) { /* disturbing the gods too much */ 16. 17. u.ublesscnt += 200; 18. u.uluck -= 3; 19. if (u.uluck < LUCKMIN) u.uluck = LUCKMIN; 20. if (u.ugangr++) angrygods(); 21. else { /* exactly one warning */ 22. pline("A voice booms out: You have angered us,"); 23. pline("Disturb us again at your own risk!"); 24. } 25. } else if (u.uluck < 0) angrygods(); /* a bad boy/girl */ 26. else pleased(); /* or a good boy/girl */ 27. #endif 28. nomovemsg = "You finished your prayer."; 29. nomul(-3); 30. return(1); 31. } 32. 33. #ifdef PRAYERS 34. angrygods() { 35. register int tmp; 36. 37. pline ("You get the felling the gods are angry..."); 38. tmp = u.ugangr + (u.uluck > 0) ? u.uluck : -u.uluck; 39. switch (tmp ? rn2(tmp): 0) { 40. 41. case 0: 42. case 1: pline("but nothing appears to happen."); 43. break; 44. case 2: 45. case 3: pline("A voice booms out: You are arrogant, mortal."); 46. pline("You must relearn your lessons!"); 47. if (u.ulevel > 1) losexp(); 48. else { 49. u.uexp = 0; 50. flags.botl = 1; 51. } 52. break; 53. case 4: 54. case 5: 55. case 6: pline("A black glow surrounds you."); 56. rndcurse(); 57. break; 58. case 7: 59. case 8: pline("A voice booms out: You dare to call upon us?"); 60. pline("Then, die mortal!"); 61. mkmon_at('&', u.ux, u.uy); 62. break; 63. 64. default: pline("Suddenly, a bolt of lightning strikes you!"); 65. pline("You are fried to a crisp."); 66. killer = "pissed off deity"; 67. done("died"); 68. break; 69. } 70. u.ublesscnt = 250; 71. return(0); 72. } 73. 74. pleased() { 75. 76. char *tmp, *hcolor(); 77. 78. u.ugangr--; 79. if (u.ugangr < 0) u.ugangr = 0; 80. pline("You feel the gods are pleased."); 81. 82. switch(rn2((u.uluck + 6)/2)) { 83. 84. case 0: pline("but nothing seems to happen."); 85. break; 86. case 1: 87. if(!uwep) { 88. if(uleft->cursed) { 89. pline("your left hand glows amber."); 90. uleft->cursed = 0; 91. } else if(uright->cursed) { 92. pline("your right hand glows amber."); 93. uleft->cursed = 0; 94. } else pline("but nothing seems to happen."); 95. break; 96. } 97. #ifdef KAA 98. if(uwep->olet == WEAPON_SYM) { 99. if (uwep->cursed) { 100. uwep->cursed=0; 101. pline("Your %s %s.", aobjnam(uwep,"softly glow"), 102. Hallucination ? hcolor() : "amber"); 103. } else if(uwep->otyp >= ARROW && uwep->otyp <= SPEAR) { 104. uwep->dknown=1; 105. tmp = Hallucination ? hcolor() : "light blue"; 106. pline("Your %s with a%s %s aura.", aobjnam(uwep,"softly glow"), 107. index("aeiou",*tmp) ? "n" : "", tmp); 108. } 109. } else 110. #endif 111. pline("but nothing seems to happen."); 112. break; 113. case 2: 114. case 3: 115. pline("A %s glow surrounds you", 116. Hallucination ? hcolor() : "golden"); 117. u.uhp = u.uhpmax += 5; 118. u.ustr = u.ustrmax; 119. if (u.uhunger < 900) init_uhunger(); 120. if (u.uluck < 0) u.uluck = 0; 121. if (Blind) Blind = 1; 122. flags.botl = 1; 123. break; 124. case 4: 125. case 5: pline("A voice booms out: We are pleased with your progress,"); 126. pline("and grant you the gift of"); 127. if (!(HTelepat & INTRINSIC)) { 128. HTelepat |= INTRINSIC; 129. pline ("Telepathy,"); 130. } else if (!(Fast & INTRINSIC)) { 131. Fast |= INTRINSIC; 132. pline ("Speed,"); 133. } else if (!(Stealth & INTRINSIC)) { 134. Stealth |= INTRINSIC; 135. pline ("Stealth,"); 136. } else { 137. if (!(Protection & INTRINSIC)) { 138. Protection |= INTRINSIC; 139. if (!u.ublessed) u.ublessed = rnd(3) + 1; 140. } else u.ublessed++; 141. pline ("our protection,"); 142. } 143. pline ("Use it wisely in our names!"); 144. break; 145. 146. case 6: pline ("An object appears at your feet!"); 147. mkobj_at('+', u.ux, u.uy); 148. break; 149. 150. case 7: pline("A voice booms out: We crown thee..."); 151. pline("The Hand of Elbereth!"); 152. HInvis |= INTRINSIC; 153. HSee_invisible |= INTRINSIC; 154. HFire_resistance |= INTRINSIC; 155. HCold_resistance |= INTRINSIC; 156. HPoison_resistance |= INTRINSIC; 157. break; 158. 159. default: impossible("Confused deity!"); 160. break; 161. } 162. u.ublesscnt = 300; 163. #ifdef HARD 164. u.ublesscnt += (u.udemigod * 1000); 165. #endif 166. return(0); 167. } 168. #endif /* PRAYERS /**/ 169. #ifdef NEWCLASS 170. doturn() { /* Knights & Priest(esse)s only please */ 171. 172. register struct monst *mtmp; 173. register int xlev = 6; 174. extern char pl_character[]; 175. 176. if((pl_character[0] != 'P') && 177. (pl_character[0] != 'K')) { 178. 179. pline("You don't know how to turn undead!"); 180. return(0); 181. } 182. if (Inhell) { 183. 184. pline("Being in hell, your gods won't help you."); 185. aggravate(); 186. return(0); 187. } 188. pline("Calling upon your gods, you chant an arcane formula."); 189. for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) 190. if(cansee(mtmp->mx,mtmp->my)) { 191. if(index(UNDEAD,mtmp->data->mlet) || 192. ((mtmp->data->mlet == '&') && (u.ulevel > 10))) { 193. 194. if(Confusion) { 195. pline("Unfortunately, your voice falters."); 196. mtmp->mflee = mtmp->mfroz = mtmp->msleep = 0; 197. } else if (! resist(mtmp, '+', 0, TELL)) 198. switch (mtmp->data->mlet) { 199. case 'V': xlev += 2; 200. case 'W': xlev += 4; 201. case 'Z': if(u.ulevel >= xlev) { 202. if(!resist(mtmp, '+', 0, NOTELL)) { 203. pline("You destroy the %s", monnam(mtmp)); 204. mondied(mtmp); 205. } else mtmp->mflee = 1; 206. } else mtmp->mflee = 1; 207. break; 208. default: mtmp->mflee = 1; 209. break; 210. } 211. } 212. } 213. nomul(-5); 214. return(1); 215. } 216. #endif /* NEWCLASS /**/ 217.
|