| 1321 | } |
| 1322 | |
| 1323 | staticfn void |
| 1324 | seffect_destroy_armor(struct obj **sobjp) |
| 1325 | { |
| 1326 | struct obj *sobj = *sobjp; |
| 1327 | struct obj *otmp = some_armor(&gy.youmonst); |
| 1328 | boolean scursed = sobj->cursed; |
| 1329 | boolean confused = (Confusion != 0); |
| 1330 | boolean old_erodeproof, new_erodeproof; |
| 1331 | |
| 1332 | if (confused) { |
| 1333 | if (!otmp) { |
| 1334 | strange_feeling(sobj, "Your bones itch."); |
| 1335 | *sobjp = 0; /* useup() in strange_feeling() */ |
| 1336 | exercise(A_STR, FALSE); |
| 1337 | exercise(A_CON, FALSE); |
| 1338 | return; |
| 1339 | } |
| 1340 | old_erodeproof = (otmp->oerodeproof != 0); |
| 1341 | new_erodeproof = scursed; |
| 1342 | otmp->oerodeproof = 0; /* for messages */ |
| 1343 | p_glow2(otmp, NH_PURPLE); |
| 1344 | if (old_erodeproof && !new_erodeproof) { |
| 1345 | /* restore old_erodeproof before shop charges */ |
| 1346 | otmp->oerodeproof = 1; |
| 1347 | costly_alteration(otmp, COST_DEGRD); |
| 1348 | } |
| 1349 | otmp->oerodeproof = new_erodeproof ? 1 : 0; |
| 1350 | return; |
| 1351 | } |
| 1352 | |
| 1353 | if (scursed) { |
| 1354 | if (otmp && otmp->cursed) { |
| 1355 | /* armor and scroll both cursed */ |
| 1356 | pline("%s.", Yobjnam2(otmp, "vibrate")); |
| 1357 | if (otmp->spe >= -6) { |
| 1358 | otmp->spe += -1; |
| 1359 | adj_abon(otmp, -1); |
| 1360 | } |
| 1361 | make_stunned((HStun & TIMEOUT) + (long) rn1(10, 10), TRUE); |
| 1362 | } else if (disintegrate_arm(otmp)) { |
| 1363 | gk.known = TRUE; |
| 1364 | return; |
| 1365 | } |
| 1366 | } else { |
| 1367 | boolean gets_choice = (otmp && sobj && sobj->blessed |
| 1368 | && count_worn_armor() > 1); |
| 1369 | |
| 1370 | if (gets_choice) { |
| 1371 | struct obj *atmp; |
| 1372 | |
| 1373 | if (!objects[sobj->otyp].oc_name_known) |
| 1374 | pline("This is %s!", an(actualoname(sobj))); |
| 1375 | gk.known = TRUE; |
| 1376 | atmp = getobj("destroy", any_worn_armor_ok, GETOBJ_PROMPT); |
| 1377 | /* check the return value, if user picked non-valid obj */ |
| 1378 | if (any_worn_armor_ok(atmp) == GETOBJ_SUGGEST) |
| 1379 | otmp = atmp; |
| 1380 | if (disintegrate_arm(otmp)) { |
no test coverage detected