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

Function Ring_on

src/do_wear.c:1241–1344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1239}
1240
1241void
1242Ring_on(struct obj *obj)
1243{
1244 long oldprop = u.uprops[objects[obj->otyp].oc_oprop].extrinsic;
1245 boolean observable;
1246
1247 /* make sure ring isn't wielded; can't use remove_worn_item()
1248 here because it has already been set worn in a ring slot */
1249 if (obj == uwep)
1250 setuwep((struct obj *) 0);
1251 else if (obj == uswapwep)
1252 setuswapwep((struct obj *) 0);
1253 else if (obj == uquiver)
1254 setuqwep((struct obj *) 0);
1255
1256 /* only mask out W_RING when we don't have both
1257 left and right rings of the same type */
1258 if ((oldprop & W_RING) != W_RING)
1259 oldprop &= ~W_RING;
1260
1261 switch (obj->otyp) {
1262 case RIN_TELEPORTATION:
1263 case RIN_REGENERATION:
1264 case RIN_SEARCHING:
1265 case RIN_HUNGER:
1266 case RIN_AGGRAVATE_MONSTER:
1267 case RIN_POISON_RESISTANCE:
1268 case RIN_FIRE_RESISTANCE:
1269 case RIN_COLD_RESISTANCE:
1270 case RIN_SHOCK_RESISTANCE:
1271 case RIN_CONFLICT:
1272 case RIN_TELEPORT_CONTROL:
1273 case RIN_POLYMORPH:
1274 case RIN_POLYMORPH_CONTROL:
1275 case RIN_FREE_ACTION:
1276 case RIN_SLOW_DIGESTION:
1277 case RIN_SUSTAIN_ABILITY:
1278 break;
1279 case MEAT_RING:
1280 /* wearing a meat ring does not affect vegan conduct */
1281 break;
1282 case RIN_STEALTH:
1283 toggle_stealth(obj, oldprop, TRUE);
1284 break;
1285 case RIN_WARNING:
1286 see_monsters();
1287 break;
1288 case RIN_SEE_INVISIBLE:
1289 /* can now see invisible monsters */
1290 set_mimic_blocking(); /* do special mimic handling */
1291 see_monsters();
1292
1293 if (Invis && !oldprop && !HSee_invisible && !Blind) {
1294 newsym(u.ux, u.uy);
1295 pline("Suddenly you are transparent, but there!");
1296 learnring(obj, TRUE);
1297 }
1298 break;

Callers 4

set_wearFunction · 0.85
accessory_or_armor_onFunction · 0.85
doseduceFunction · 0.85
rechargeFunction · 0.85

Calls 15

setuwepFunction · 0.85
setuswapwepFunction · 0.85
setuqwepFunction · 0.85
toggle_stealthFunction · 0.85
see_monstersFunction · 0.85
set_mimic_blockingFunction · 0.85
newsymFunction · 0.85
learnringFunction · 0.85
self_invis_messageFunction · 0.85
float_upFunction · 0.85
spoteffectsFunction · 0.85
float_vs_flightFunction · 0.85

Tested by

no test coverage detected