| 1592 | } |
| 1593 | |
| 1594 | staticfn int |
| 1595 | trapeffect_rust_trap( |
| 1596 | struct monst *mtmp, |
| 1597 | struct trap *trap, |
| 1598 | unsigned int trflags UNUSED) |
| 1599 | { |
| 1600 | struct obj *otmp, *nextobj; |
| 1601 | |
| 1602 | if (mtmp == &gy.youmonst) { |
| 1603 | seetrap(trap); |
| 1604 | |
| 1605 | /* Unlike monsters, traps cannot aim their rust attacks at |
| 1606 | * you, so instead of looping through and taking either the |
| 1607 | * first rustable one or the body, we take whatever we get, |
| 1608 | * even if it is not rustable. |
| 1609 | */ |
| 1610 | switch (rn2(5)) { |
| 1611 | case 0: |
| 1612 | pline("%s you on the %s!", A_gush_of_water_hits, body_part(HEAD)); |
| 1613 | (void) water_damage(uarmh, helm_simple_name(uarmh), TRUE); |
| 1614 | break; |
| 1615 | case 1: |
| 1616 | pline("%s your left %s!", A_gush_of_water_hits, body_part(ARM)); |
| 1617 | if (water_damage(uarms, "shield", TRUE) != ER_NOTHING) |
| 1618 | break; |
| 1619 | if (u.twoweap || (uwep && bimanual(uwep))) |
| 1620 | (void) water_damage(u.twoweap ? uswapwep : uwep, 0, TRUE); |
| 1621 | uglovecheck: |
| 1622 | (void) water_damage(uarmg, gloves_simple_name(uarmg), TRUE); |
| 1623 | break; |
| 1624 | case 2: |
| 1625 | pline("%s your right %s!", A_gush_of_water_hits, body_part(ARM)); |
| 1626 | (void) water_damage(uwep, 0, TRUE); |
| 1627 | goto uglovecheck; |
| 1628 | default: |
| 1629 | pline("%s you!", A_gush_of_water_hits); |
| 1630 | /* note: exclude primary and secondary weapons from splashing |
| 1631 | because cases 1 and 2 target them [via water_damage()] */ |
| 1632 | for (otmp = gi.invent; otmp; otmp = nextobj) { |
| 1633 | nextobj = otmp->nobj; |
| 1634 | if (otmp->lamplit && otmp != uwep |
| 1635 | && (otmp != uswapwep || !u.twoweap)) |
| 1636 | (void) splash_lit(otmp); |
| 1637 | } |
| 1638 | if (uarmc) |
| 1639 | (void) water_damage(uarmc, cloak_simple_name(uarmc), TRUE); |
| 1640 | else if (uarm) |
| 1641 | (void) water_damage(uarm, suit_simple_name(uarm), TRUE); |
| 1642 | else if (uarmu) |
| 1643 | (void) water_damage(uarmu, "shirt", TRUE); |
| 1644 | } |
| 1645 | update_inventory(); |
| 1646 | |
| 1647 | if (u.umonnum == PM_IRON_GOLEM) { |
| 1648 | int dam = u.mhmax; |
| 1649 | |
| 1650 | You("are covered with rust!"); |
| 1651 | losehp(Maybe_Half_Phys(dam), "rusting away", KILLED_BY); |
no test coverage detected