About: Source:Hack 1.0/hack.do wear.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 hack.do_wear.c from the source code of Hack 1.0. To link to a particular line, write [[Hack 1.0/hack.do_wear.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:Hack 1.0/hack.do wear.c
rdfs:comment
  • Below is the full text to hack.do_wear.c from the source code of Hack 1.0. To link to a particular line, write [[Hack 1.0/hack.do_wear.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 hack.do_wear.c from the source code of Hack 1.0. To link to a particular line, write [[Hack 1.0/hack.do_wear.c#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code 1. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1984. */ 2. 3. #include "hack.h" 4. #include 5. extern char *nomovemsg; 6. 7. off_msg(otmp) register struct obj *otmp; { 8. pline("You were wearing %s.", doname(otmp)); 9. } 10. 11. doremarm() { 12. register struct obj *otmp; 13. if(!uarm && !uarmh && !uarms && !uarmg) { 14. pline("Not wearing any armor."); 15. return(0); 16. } 17. otmp = (!uarmh && !uarms && !uarmg) ? uarm : 18. (!uarms && !uarm && !uarmg) ? uarmh : 19. (!uarmh && !uarm && !uarmg) ? uarms : 20. (!uarmh && !uarm && !uarms) ? uarmg : 21. getobj("[", "take off"); 22. if(!otmp) return(0); 23. if(!(otmp->owornmask & (W_ARMOR - W_ARM2))) { 24. pline("You can't take that off."); 25. return(0); 26. } 27. (void) armoroff(otmp); 28. return(1); 29. } 30. 31. doremring() { 32. if(!uleft && !uright){ 33. pline("Not wearing any ring."); 34. return(0); 35. } 36. if(!uleft) 37. return(dorr(uright)); 38. if(!uright) 39. return(dorr(uleft)); 40. if(uleft && uright) while(1) { 41. pline("What ring, Right or Left? "); 42. switch(readchar()) { 43. case ' ': 44. case ' ': 45. case '\033': 46. return(0); 47. case 'l': 48. case 'L': 49. return(dorr(uleft)); 50. case 'r': 51. case 'R': 52. return(dorr(uright)); 53. } 54. } 55. /* NOTREACHED */ 56. #ifdef lint 57. return(0); 58. #endif lint 59. } 60. 61. dorr(otmp) register struct obj *otmp; { 62. if(cursed(otmp)) return(0); 63. ringoff(otmp); 64. off_msg(otmp); 65. return(1); 66. } 67. 68. cursed(otmp) register struct obj *otmp; { 69. if(otmp->cursed){ 70. pline("You can't. It appears to be cursed."); 71. return(1); 72. } 73. return(0); 74. } 75. 76. armoroff(otmp) register struct obj *otmp; { 77. register int delay = -objects[otmp->otyp].oc_delay; 78. if(cursed(otmp)) return(0); 79. setworn((struct obj *) 0, otmp->owornmask & W_ARMOR); 80. if(delay) { 81. nomul(delay); 82. switch(otmp->otyp) { 83. case HELMET: 84. nomovemsg = "You finished taking off your helmet."; 85. break; 86. case PAIR_OF_GLOVES: 87. nomovemsg = "You finished taking off your gloves"; 88. break; 89. default: 90. nomovemsg = "You finished taking off your suit."; 91. } 92. } else { 93. off_msg(otmp); 94. } 95. return(1); 96. } 97. 98. doweararm() { 99. register struct obj *otmp; 100. register int delay; 101. register int err = 0; 102. long mask = 0; 103. 104. otmp = getobj("[", "wear"); 105. if(!otmp) return(0); 106. if(otmp->owornmask & W_ARMOR) { 107. pline("You are already wearing that!"); 108. return(0); 109. } 110. if(otmp->otyp == HELMET){ 111. if(uarmh) { 112. pline("You are already wearing a helmet."); 113. err++; 114. } else 115. mask = W_ARMH; 116. } else if(otmp->otyp == SHIELD){ 117. if(uarms) pline("You are already wearing a shield."), err++; 118. if(uwep && uwep->otyp == TWO_HANDED_SWORD) 119. pline("You cannot wear a shield and wield a two-handed sword."), err++; 120. if(!err) mask = W_ARMS; 121. } else if(otmp->otyp == PAIR_OF_GLOVES){ 122. if(uarmg) pline("You are already wearing gloves."); else 123. if(uwep && uwep->cursed) 124. pline("You cannot wear gloves over your weapon."); 125. else mask = W_ARMG; 126. } else { 127. if(uarm) { 128. if(otmp->otyp != ELVEN_CLOAK || uarm2) { 129. pline("You are already wearing some armor."); 130. err++; 131. } 132. } 133. if(!err) mask = W_ARM; 134. } 135. if(err) return(0); 136. setworn(otmp, mask); 137. if(otmp == uwep) 138. setuwep((struct obj *) 0); 139. delay = -objects[otmp->otyp].oc_delay; 140. if(delay){ 141. nomul(delay); 142. nomovemsg = "You finished your dressing manoeuvre."; 143. } 144. otmp->known = 1; 145. return(1); 146. } 147. 148. dowearring() { 149. register struct obj *otmp; 150. long mask = 0; 151. long oldprop; 152. 153. if(uleft && uright){ 154. pline("There are no more ring-fingers to fill."); 155. return(0); 156. } 157. otmp = getobj("=", "wear"); 158. if(!otmp) return(0); 159. if(otmp->owornmask & W_RING) { 160. pline("You are already wearing that!"); 161. return(0); 162. } 163. if(otmp == uleft || otmp == uright) { 164. pline("You are already wearing that."); 165. return(0); 166. } 167. if(uleft) mask = RIGHT_RING; 168. else if(uright) mask = LEFT_RING; 169. else do { 170. pline("What ring-finger, Right or Left? "); 171. switch(readchar()){ 172. case 'l': 173. case 'L': 174. mask = LEFT_RING; 175. break; 176. case 'r': 177. case 'R': 178. mask = RIGHT_RING; 179. break; 180. case ' ': 181. case ' ': 182. case '\033': 183. return(0); 184. } 185. } while(!mask); 186. setworn(otmp, mask); 187. if(otmp == uwep) 188. setuwep((struct obj *) 0); 189. oldprop = u.uprops[PROP(otmp->otyp)].p_flgs; 190. u.uprops[PROP(otmp->otyp)].p_flgs |= mask; 191. switch(otmp->otyp){ 192. case RIN_LEVITATION: 193. if(!oldprop) float_up(); 194. break; 195. case RIN_PROTECTION_FROM_SHAPE_CHANGERS: 196. rescham(); 197. break; 198. case RIN_GAIN_STRENGTH: 199. u.ustr += otmp->spe; 200. u.ustrmax += otmp->spe; 201. flags.botl=1; 202. break; 203. case RIN_INCREASE_DAMAGE: 204. u.udaminc += otmp->spe; 205. break; 206. } 207. prinv(otmp); 208. return(1); 209. } 210. 211. ringoff(obj) 212. register struct obj *obj; 213. { 214. register unsigned mask; 215. mask = obj->owornmask & W_RING; 216. setworn((struct obj *) 0, obj->owornmask); 217. if(!(u.uprops[PROP(obj->otyp)].p_flgs & mask)){ 218. pline("Strange... I didnt know you had that ring."); 219. impossible(); 220. } 221. u.uprops[PROP(obj->otyp)].p_flgs &= ~mask; 222. switch(obj->otyp) { 223. case RIN_LEVITATION: 224. if(!Levitation) { /* no longer floating */ 225. float_down(); 226. } 227. break; 228. case RIN_GAIN_STRENGTH: 229. u.ustr -= obj->spe; 230. u.ustrmax -= obj->spe; 231. flags.botl = 1; 232. break; 233. case RIN_INCREASE_DAMAGE: 234. u.udaminc -= obj->spe; 235. break; 236. } 237. } 238. 239. find_ac(){ 240. register int uac = 10; 241. if(uarm) uac -= uarm->spe; 242. if(uarm2) uac -= uarm2->spe; 243. if(uarmh) uac -= uarmh->spe; 244. if(uarms) uac -= uarms->spe; 245. if(uarmg) uac -= uarmg->spe; 246. if(uleft && uleft->otyp == RIN_PROTECTION) uac -= uleft->spe; 247. if(uright && uright->otyp == RIN_PROTECTION) uac -= uright->spe; 248. if(uac != u.uac){ 249. u.uac = uac; 250. flags.botl = 1; 251. } 252. } 253. 254. glibr(){ 255. register struct obj *otmp; 256. int xfl = 0; 257. if(!uarmg) if(uleft || uright) { 258. /* Note: at present also cursed rings fall off */ 259. pline("Your %s off your fingers.", 260. (uleft && uright) ? "rings slip" : "ring slips"); 261. xfl++; 262. if(otmp = uleft){ 263. ringoff(uleft); 264. dropx(otmp); 265. } 266. if(otmp = uright){ 267. ringoff(uright); 268. dropx(otmp); 269. } 270. } 271. if(otmp = uwep){ 272. /* Note: at present also cursed weapons fall */ 273. setuwep((struct obj *) 0); 274. dropx(otmp); 275. pline("Your weapon %sslips from your hands.", 276. xfl ? "also " : ""); 277. } 278. } 279. 280. struct obj * 281. some_armor(){ 282. register struct obj *otmph = uarm; 283. if(uarmh && (!otmph || !rn2(4))) otmph = uarmh; 284. if(uarmg && (!otmph || !rn2(4))) otmph = uarmg; 285. if(uarms && (!otmph || !rn2(4))) otmph = uarms; 286. return(otmph); 287. } 288. 289. corrode_armor(){ 290. register struct obj *otmph = some_armor(); 291. if(otmph){ 292. if(otmph->rustfree || 293. otmph->otyp == ELVEN_CLOAK || 294. otmph->otyp == LEATHER_ARMOR || 295. otmph->otyp == STUDDED_LEATHER_ARMOR) { 296. pline("Your %s not affected!", 297. aobjnam(otmph, "are")); 298. return; 299. } 300. pline("Your %s!", aobjnam(otmph, "corrode")); 301. otmph->spe--; 302. } 303. }
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