wand discovery gets special handling when hero is blinded */
| 120 | |
| 121 | /* wand discovery gets special handling when hero is blinded */ |
| 122 | void |
| 123 | learnwand(struct obj *obj) |
| 124 | { |
| 125 | /* For a wand (or wand-like tool) zapped by the player, if the |
| 126 | effect was observable (determined by caller; usually seen, but |
| 127 | possibly heard or felt if the hero is blinded) then discover the |
| 128 | object type provided that the object itself is known (as more |
| 129 | than just "a wand"). If object type is already discovered and |
| 130 | we observed the effect, mark the individual wand as having been |
| 131 | seen. Suppress spells (which use fake spellbook object for `obj') |
| 132 | so that casting a spell won't re-discover its forgotten book. */ |
| 133 | if (obj->oclass != SPBOOK_CLASS) { |
| 134 | /* if type already discovered, treat this item has having been seen |
| 135 | even if hero is currently blinded (skips redundant makeknown) */ |
| 136 | if (objects[obj->otyp].oc_name_known) { |
| 137 | observe_object(obj); /* will usually be dknown already */ |
| 138 | |
| 139 | /* otherwise discover it if item itself has been or can be seen */ |
| 140 | } else { |
| 141 | /* in case it was picked up while blind and then zapped without |
| 142 | examining inventory after regaining sight (bypassing xname) */ |
| 143 | if (!Blind) |
| 144 | observe_object(obj); |
| 145 | /* make the discovery iff we know what we're manipulating */ |
| 146 | if (obj->dknown) |
| 147 | makeknown(obj->otyp); |
| 148 | } |
| 149 | update_inventory(); |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | /* |
| 154 | * Routines for IMMEDIATE wands and spells. |
no test coverage detected