About: Source:NetHack 2.2a/wield.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 wield.c from the source code of NetHack 2.2a. To link to a particular line, write [[NetHack 2.2a/wield.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 2.2a/wield.c
rdfs:comment
  • Below is the full text to wield.c from the source code of NetHack 2.2a. To link to a particular line, write [[NetHack 2.2a/wield.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 wield.c from the source code of NetHack 2.2a. To link to a particular line, write [[NetHack 2.2a/wield.c#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code 1. /* SCCS Id: @(#)wield.c 2.1 87/11/09 2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3. 4. #include "hack.h" 5. extern struct obj zeroobj; 6. extern char *hcolor(); 7. #ifdef KAA 8. extern boolean unweapon; 9. #endif 10. 11. setuwep(obj) register struct obj *obj; { 12. setworn(obj, W_WEP); 13. } 14. 15. dowield() 16. { 17. register struct obj *wep; 18. register int res = 0; 19. 20. multi = 0; 21. #ifdef KAA 22. if (cantwield(u.usym)) { 23. pline("Don't be ridiculous!"); 24. return(0); 25. } 26. #endif 27. if(!(wep = getobj("#-)", "wield"))) /* nothing */; 28. else if(wep == &zeroobj) { 29. if(uwep == 0) { 30. pline("You are already empty handed."); 31. } else if (welded(uwep)) 32. pline("The %s welded to your hand!",aobjnam(uwep,"are")); 33. else { 34. setuwep((struct obj *) 0); 35. res++; 36. pline("You are empty handed."); 37. } 38. } else if(uwep == wep) 39. pline("You are already wielding that!"); 40. else if(welded(uwep)) 41. pline("The %s welded to your hand!", 42. aobjnam(uwep, "are")); 43. /* Prevent wielding a cockatrice in pack when not wearing gloves KAA*/ 44. else if (!uarmg && wep->otyp == DEAD_COCKATRICE) { 45. pline("You wield the dead cockatrice in your bare hands."); 46. pline("You turn to stone ..."); 47. killer="dead cockatrice"; 48. done("died"); 49. } else if(uarms && wep->otyp == TWO_HANDED_SWORD) 50. pline("You cannot wield a two-handed sword and wear a shield."); 51. else if(wep->owornmask & (W_ARMOR | W_RING)) 52. pline("You cannot wield that!"); 53. else { 54. setuwep(wep); 55. res++; 56. if(welded(uwep)) 57. pline("The %s %s to your hand!", 58. aobjnam(uwep, "weld"), 59. (uwep->quan == 1) ? "itself" : "themselves"); /* a3 */ 60. else prinv(uwep); 61. } 62. #ifdef KAA 63. if(res && uwep) 64. unweapon = (uwep->otyp >= BOW || uwep->otyp <= BOOMERANG) ? 65. TRUE : FALSE; 66. #endif 67. return(res); 68. } 69. 70. corrode_weapon(){ 71. if(!uwep || uwep->olet != WEAPON_SYM) return; /* %% */ 72. if(uwep->rustfree) 73. pline("Your %s not affected.", aobjnam(uwep, "are")); 74. else if (uwep->spe > -6) { 75. pline("Your %s!", aobjnam(uwep, "corrode")); 76. uwep->spe--; 77. } else pline("Your %s quite rusted now.", aobjnam(uwep, "look")); 78. } 79. 80. chwepon(otmp,amount) 81. register struct obj *otmp; 82. register amount; 83. { 84. register char *color = (amount < 0) ? "black" : "green"; 85. register char *time; 86. 87. if(Hallucination) color=hcolor(); 88. if(!uwep || uwep->olet != WEAPON_SYM) { 89. strange_feeling(otmp, 90. (amount > 0) ? "Your hands twitch." 91. : "Your hands itch."); 92. return(0); 93. } 94. 95. if(uwep->otyp == WORM_TOOTH && amount > 0) { 96. uwep->otyp = CRYSKNIFE; 97. pline("Your weapon seems sharper now."); 98. uwep->cursed = 0; 99. return(1); 100. } 101. 102. if(uwep->otyp == CRYSKNIFE && amount < 0) { 103. uwep->otyp = WORM_TOOTH; 104. pline("Your weapon looks duller now."); 105. return(1); 106. } 107. 108. /* there is a (soft) upper limit to uwep->spe */ 109. if(amount > 0 && uwep->spe > 5 && rn2(3)) { 110. pline("Your %s violently %s for a while and then evaporate%s.", 111. aobjnam(uwep,"glow"),Hallucination ? hcolor() : "green", 112. plur(uwep->quan)); 113. 114. while(uwep) /* let all of them disappear */ 115. /* note: uwep->quan = 1 is nogood if unpaid */ 116. useup(uwep); 117. return(1); 118. } 119. if(!rn2(6)) amount *= 2; 120. time = (amount*amount == 1) ? "moment" : "while"; 121. pline("Your %s %s for a %s.", 122. aobjnam(uwep, "glow"), color, time); 123. uwep->spe += amount; 124. if(amount > 0) uwep->cursed = 0; 125. return(1); 126. } 127. 128. int 129. welded(obj) register struct obj *obj; { 130. return(obj && obj == uwep && obj->cursed && 131. (obj->olet == WEAPON_SYM || obj->otyp == HEAVY_IRON_BALL || 132. obj->otyp == CAN_OPENER || obj->otyp == PICK_AXE)); 133. }
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