abstract
| - Below is the full text to pray.c from the source code of NetHack 1.3d. To link to a particular line, write [[NetHack 1.3d/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.3 87/07/14 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. #ifdef KAA 88. if(!uwep) { 89. pline("but nothing seems to happen."); 90. break; 91. } 92. if(uwep->olet == WEAPON_SYM) { 93. if (uwep->cursed) { 94. uwep->cursed=0; 95. pline("Your %s %s.", aobjnam(uwep,"softly glow"), 96. Hallucination ? hcolor() : "amber"); 97. } else if(uwep->otyp >= ARROW && uwep->otyp <= SPEAR) { 98. uwep->dknown=1; 99. tmp = Hallucination ? hcolor() : "light blue"; 100. pline("Your %s with a%s %s aura.", aobjnam(uwep,"softly glow"), 101. index("aeiou",*tmp) ? "n" : "", tmp); 102. } 103. } else 104. #endif 105. pline("but nothing seems to happen."); 106. break; 107. case 2: 108. case 3: 109. pline("A %s glow surrounds you", 110. Hallucination ? hcolor() : "golden"); 111. u.uhp = u.uhpmax += 5; 112. u.ustr = u.ustrmax; 113. if (u.uhunger < 900) init_uhunger(); 114. if (u.uluck < 0) u.uluck = 0; 115. if (Blind) Blind = 1; 116. break; 117. case 4: 118. case 5: pline("A voice booms out: We are pleased with your progress,"); 119. pline("and grant you the gift of"); 120. if (!(HTelepat & INTRINSIC)) { 121. HTelepat = HTelepat || INTRINSIC; 122. pline ("Telepathy,"); 123. } else if (!(Fast & INTRINSIC)) { 124. Fast = Fast || INTRINSIC; 125. pline ("Speed,"); 126. } else if (!(Stealth & INTRINSIC)) { 127. Stealth = Stealth || INTRINSIC; 128. pline ("Stealth,"); 129. } else { 130. if (!(Protection & INTRINSIC)) { 131. Protection = Protection || INTRINSIC; 132. if (!u.ublessed) u.ublessed = rnd(3) + 1; 133. } else u.ublessed++; 134. pline ("our protection,"); 135. } 136. pline ("Use it wisely in our names!"); 137. break; 138. 139. case 6: pline ("An object appears at your feet!"); 140. mkobj_at("+", u.ux, u.uy); 141. break; 142. 143. case 7: pline("A voice booms out: We crown thee..."); 144. pline("The Hand of Elbereth!"); 145. HInvis |= INTRINSIC; 146. HSee_invisible |= INTRINSIC; 147. HFire_resistance |= INTRINSIC; 148. HCold_resistance |= INTRINSIC; 149. HPoison_resistance |= INTRINSIC; 150. break; 151. 152. default: impossible("Confused deity!"); 153. break; 154. } 155. u.ublesscnt = 300; 156. #ifdef HARD 157. u.ublesscnt += (u.udemigod * 1000); 158. #endif 159. return(0); 160. } 161. #endif /* PRAYERS /**/ 162.
|