| 1486 | } |
| 1487 | |
| 1488 | staticfn void |
| 1489 | seffect_remove_curse(struct obj **sobjp) |
| 1490 | { |
| 1491 | struct obj *sobj = *sobjp; /* scroll or fake spellbook */ |
| 1492 | int otyp = sobj->otyp; |
| 1493 | boolean sblessed = sobj->blessed; |
| 1494 | boolean scursed = sobj->cursed; |
| 1495 | boolean confused = (Confusion != 0); |
| 1496 | struct obj *obj, *nxto; |
| 1497 | long wornmask; |
| 1498 | |
| 1499 | You_feel(!Hallucination |
| 1500 | ? (!confused ? "like someone is helping you." |
| 1501 | : "like you need some help.") |
| 1502 | : (!confused ? "in touch with the Universal Oneness." |
| 1503 | : "the power of the Force against you!")); |
| 1504 | |
| 1505 | if (scursed) { |
| 1506 | pline_The("scroll disintegrates."); |
| 1507 | } else { |
| 1508 | /* 5.0: this used to use a straight |
| 1509 | for (obj = invent; obj; obj = obj->nobj) {} |
| 1510 | traversal, but for the confused case, secondary weapon might |
| 1511 | become cursed and be dropped, moving it from the invent chain |
| 1512 | to the floor chain at hero's spot, so we have to remember the |
| 1513 | next object prior to processing the current one */ |
| 1514 | for (obj = gi.invent; obj; obj = nxto) { |
| 1515 | nxto = obj->nobj; |
| 1516 | /* gold isn't subject to cursing and blessing */ |
| 1517 | if (obj->oclass == COIN_CLASS) |
| 1518 | continue; |
| 1519 | /* hide current scroll from itself so that perm_invent won't |
| 1520 | show known blessed scroll losing bknown when confused */ |
| 1521 | if (obj == sobj && obj->quan == 1L) |
| 1522 | continue; |
| 1523 | wornmask = (obj->owornmask & ~(W_BALL | W_ART | W_ARTI)); |
| 1524 | if (wornmask && !sblessed) { |
| 1525 | /* handle a couple of special cases; we don't |
| 1526 | allow auxiliary weapon slots to be used to |
| 1527 | artificially increase number of worn items */ |
| 1528 | if (obj == uswapwep) { |
| 1529 | if (!u.twoweap) |
| 1530 | wornmask = 0L; |
| 1531 | } else if (obj == uquiver) { |
| 1532 | if (obj->oclass == WEAPON_CLASS) { |
| 1533 | /* mergeable weapon test covers ammo, |
| 1534 | missiles, spears, daggers & knives */ |
| 1535 | if (!objects[obj->otyp].oc_merge) |
| 1536 | wornmask = 0L; |
| 1537 | } else if (obj->oclass == GEM_CLASS) { |
| 1538 | /* possibly ought to check whether |
| 1539 | alternate weapon is a sling... */ |
| 1540 | if (!uslinging()) |
| 1541 | wornmask = 0L; |
| 1542 | } else { |
| 1543 | /* weptools don't merge and aren't |
| 1544 | reasonable quivered weapons */ |
| 1545 | wornmask = 0L; |
no test coverage detected