MCPcopy Create free account
hub / github.com/NetHack/NetHack / learnring

Function learnring

src/do_wear.c:1192–1220  ·  view source on GitHub ↗

handle ring discovery; comparable to learnwand() */

Source from the content-addressed store, hash-verified

1190
1191/* handle ring discovery; comparable to learnwand() */
1192staticfn void
1193learnring(struct obj *ring, boolean observed)
1194{
1195 int ringtype = ring->otyp;
1196
1197 /* if effect was observable then we usually discover the type */
1198 if (observed) {
1199 /* if we already know the ring type which accomplishes this
1200 effect (assumes there is at most one type for each effect),
1201 mark this ring as having been seen (no need for makeknown);
1202 otherwise if we have seen this ring, discover its type */
1203 if (objects[ringtype].oc_name_known)
1204 observe_object(ring);
1205 else if (ring->dknown)
1206 makeknown(ringtype);
1207#if 0 /* see learnwand() */
1208 else
1209 observe_object(ring);
1210#endif
1211 }
1212
1213 /* make enchantment of charged ring known (might be +0) and update
1214 perm invent window if we've seen this ring and know its type */
1215 if (ring->dknown && objects[ringtype].oc_name_known) {
1216 if (objects[ringtype].oc_charged)
1217 ring->known = 1;
1218 update_inventory();
1219 }
1220}
1221
1222staticfn void
1223adjust_attrib(struct obj *obj, int which, int val)

Callers 4

toggle_stealthFunction · 0.85
adjust_attribFunction · 0.85
Ring_onFunction · 0.85
Ring_off_or_goneFunction · 0.85

Calls 2

observe_objectFunction · 0.85
update_inventoryFunction · 0.85

Tested by

no test coverage detected