About: Source:NetHack 3.0.0/exper.c   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

Below is the full text to exper.c from the source code of NetHack 3.0.0. To link to a particular line, write [[NetHack 3.0.0/exper.c#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code

AttributesValues
rdfs:label
  • Source:NetHack 3.0.0/exper.c
rdfs:comment
  • Below is the full text to exper.c from the source code of NetHack 3.0.0. To link to a particular line, write [[NetHack 3.0.0/exper.c#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code
dcterms:subject
dbkwik:nethack/pro...iPageUsesTemplate
abstract
  • Below is the full text to exper.c from the source code of NetHack 3.0.0. To link to a particular line, write [[NetHack 3.0.0/exper.c#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code 1. /* SCCS Id: @(#)exper.c 3.0 89/04/21 2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3. /* NetHack may be freely redistributed. See license for details. */ 4. 5. #include "hack.h" 6. 7. #ifdef LINT 8. #define NEW_SCORING 9. #endif 10. long 11. newuexp(lev) 12. register unsigned lev; 13. { 14. #ifdef LINT /* long conversion */ 15. return(0L * lev); 16. #else 17. if(lev < 10) return (10L*(1L << lev)); 18. if(lev < 20) return (10000L*(1L << lev-10)); 19. return (10000000L*(lev-19)); 20. #endif 21. } 22. 23. int 24. experience(mtmp, nk) /* return # of exp points for mtmp after nk killed */ 25. register struct monst *mtmp; 26. register int nk; 27. { 28. register struct permonst *ptr = mtmp->data; 29. int i, tmp, tmp2; 30. 31. tmp = 1 + mtmp->m_lev * mtmp->m_lev; 32. 33. /* For higher ac values, give extra experience */ 34. if(ptr->ac < 3) tmp += (7 - ptr->ac) * (ptr->ac < 0) ? 2 : 1; 35. 36. /* For very fast monsters, give extra experience */ 37. if(ptr->mmove >= 12) tmp += (ptr->mmove >= 18) ? 5 : 3; 38. 39. /* For each "special" attack type give extra experience */ 40. for(i = 0; i < NATTK; i++) { 41. 42. tmp2 = ptr->mattk[i].aatyp; 43. if(tmp2 > AT_BUTT) { 44. 45. if(tmp2 == AT_WEAP) tmp += 5; 46. else if(tmp2 == AT_MAGC) tmp += 10; 47. else tmp += 3; 48. } 49. } 50. 51. /* For each "special" damage type give extra experience */ 52. for(i = 0; i < NATTK; i++) { 53. 54. tmp2 = ptr->mattk[i].adtyp; 55. if(tmp2 > AD_PHYS && tmp2 < AD_BLND) tmp += 2*mtmp->m_lev; 56. else if((tmp2 == AD_DRLI) || (tmp2 == AD_STON)) tmp += 50; 57. else if(tmp != AD_PHYS) tmp += mtmp->m_lev; 58. /* extra heavy damage bonus */ 59. if((ptr->mattk[i].damd * ptr->mattk[i].damn) > 23) 60. tmp += mtmp->m_lev; 61. } 62. 63. /* For certain "extra nasty" monsters, give even more */ 64. if(extra_nasty(ptr)) tmp += (7*mtmp->m_lev); 65. if(ptr->mlet == S_EEL) tmp += 1000; 66. 67. /* For higher level monsters, an additional bonus is given */ 68. if(mtmp->m_lev > 8) tmp += 50; 69. 70. #ifdef NEW_SCORING 71. /* ------- recent addition: make nr of points decrease 72. when this is not the first of this kind */ 73. { unsigned ul = u.ulevel; 74. int ml = mtmp->m_lev; 75. /* points are given based on present and future level */ 76. if(ul < MAXULEV) 77. for(tmp2 = 0; !tmp2 || ul + tmp2 <= ml; tmp2++) 78. if(u.uexp + 1 + (tmp + ((tmp2 <= 0) ? 0 : 4<<(tmp2-1)))/nk 79. >= newuexp(ul) ) 80. if(++ul == MAXULEV) break; 81. 82. tmp2 = ml - ul -1; 83. tmp = (tmp + ((tmp2 < 0) ? 0 : 4< 84. if(tmp <= 0) tmp = 1; 85. } 86. /* note: ul is not necessarily the future value of u.ulevel */ 87. /* ------- end of recent valuation change ------- */ 88. #endif /* NEW_SCORING /**/ 89. 90. #ifdef MAIL 91. /* Mail daemons put up no fight. */ 92. if(mtmp->data == &mons[PM_MAIL_DAEMON]) tmp = 1; 93. #endif 94. 95. return(tmp); 96. } 97. 98. void 99. more_experienced(exp, rexp) 100. register int exp, rexp; 101. { 102. u.uexp += exp; 103. u.urexp += 4*exp + rexp; 104. if(exp) flags.botl = 1; 105. if(u.urexp >= ((pl_character[0] == 'W') ? 1000 : 2000)) 106. flags.beginner = 0; 107. } 108. 109. void 110. losexp() { /* hit by drain life attack */ 111. 112. register int num; 113. 114. #ifdef POLYSELF 115. if(resists_drli(uasmon)) return; 116. #endif 117. 118. if(u.ulevel > 1) { 119. pline("Goodbye level %u.", u.ulevel--); 120. adjabil(-1); /* remove intrinsic abilities */ 121. } else 122. u.uhp = -1; 123. num = newhp(); 124. u.uhp -= num; 125. u.uhpmax -= num; 126. #ifdef SPELLS 127. num = rnd((int)u.ulevel/2+1) + 1; /* M. Stephenson */ 128. u.uen -= num; 129. if (u.uen < 0) u.uen = 0; 130. u.uenmax -= num; 131. if (u.uenmax < 0) u.uenmax = 0; 132. #endif 133. u.uexp = newuexp(u.ulevel) - 1; 134. flags.botl = 1; 135. } 136. 137. /* 138. * Make experience gaining similar to AD&D(tm), whereby you can at most go 139. * up by one level at a time, extra expr possibly helping you along. 140. * After all, how much real experience does one get shooting a wand of death 141. * at a dragon created with a wand of polymorph?? 142. */ 143. void 144. newexplevel() { 145. 146. register int tmp; 147. 148. if(u.ulevel < MAXULEV && u.uexp >= newuexp(u.ulevel)) { 149. 150. u.ulevel++; 151. if (u.uexp >= newuexp(u.ulevel)) u.uexp = newuexp(u.ulevel) - 1; 152. pline("Welcome to experience level %u.", u.ulevel); 153. set_uasmon(); /* set up for the new level. */ 154. adjabil(1); /* give new intrinsic abilities */ 155. tmp = newhp(); 156. u.uhpmax += tmp; 157. u.uhp += tmp; 158. #ifdef SPELLS 159. tmp = rnd((int)ACURR(A_WIS)/2+1) + 1; /* M. Stephenson */ 160. u.uenmax += tmp; 161. u.uen += tmp; 162. #endif 163. flags.botl = 1; 164. } 165. } 166. 167. void 168. pluslvl() { 169. register int num; 170. 171. You("feel more experienced."); 172. num = newhp(); 173. u.uhpmax += num; 174. u.uhp += num; 175. #ifdef SPELLS 176. num = rnd((int)ACURR(A_WIS)/2+1) + 1; /* M. Stephenson */ 177. u.uenmax += num; 178. u.uen += num; 179. #endif 180. if(u.ulevel < MAXULEV) { 181. u.uexp = newuexp(u.ulevel); 182. pline("Welcome to experience level %u.", ++u.ulevel); 183. adjabil(1); 184. } 185. flags.botl = 1; 186. } 187. 188. long 189. rndexp() 190. { 191. register long minexp,maxexp; 192. 193. if(u.ulevel == 1) 194. return rn2((int)newuexp(1)); 195. else { 196. minexp = newuexp(u.ulevel - 1); 197. maxexp = newuexp(u.ulevel); 198. return(minexp + rn2((int)(maxexp - minexp))); 199. } 200. }
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software