finish stealing an item of armor which takes multiple turns to take off */
| 162 | |
| 163 | /* finish stealing an item of armor which takes multiple turns to take off */ |
| 164 | staticfn int |
| 165 | stealarm(void) |
| 166 | { |
| 167 | struct monst *mtmp; |
| 168 | struct obj *otmp, *nextobj; |
| 169 | |
| 170 | if (!gs.stealoid || !gs.stealmid) |
| 171 | goto botm; |
| 172 | |
| 173 | for (otmp = gi.invent; otmp; otmp = nextobj) { |
| 174 | nextobj = otmp->nobj; |
| 175 | if (otmp->o_id == gs.stealoid) { |
| 176 | for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { |
| 177 | if (mtmp->m_id == gs.stealmid) { |
| 178 | if (DEADMONSTER(mtmp)) { |
| 179 | impossible("stealarm(): dead monster stealing"); |
| 180 | goto botm; /* (could just use 'break' here) */ |
| 181 | } |
| 182 | /* maybe the thief polymorphed into something without a |
| 183 | steal attack, or perhaps while stealing hero's suit |
| 184 | the thief took away other items causing hero to fall |
| 185 | into water or lava and then teleport to safety */ |
| 186 | if (!dmgtype(mtmp->data, AD_SITM) |
| 187 | || distu(mtmp->mx, mtmp->my) > 2) |
| 188 | goto botm; /* (could just use 'break' here) */ |
| 189 | if (otmp->unpaid) |
| 190 | subfrombill(otmp, shop_keeper(*u.ushops)); |
| 191 | freeinv(otmp); |
| 192 | pline("%s steals %s!", Monnam(mtmp), doname(otmp)); |
| 193 | (void) mpickobj(mtmp, otmp); /* may free otmp */ |
| 194 | /* Implies seduction, "you gladly hand over ..." |
| 195 | so we don't set mavenge bit here. */ |
| 196 | monflee(mtmp, 0, FALSE, FALSE); |
| 197 | if (!tele_restrict(mtmp)) |
| 198 | (void) rloc(mtmp, RLOC_MSG); |
| 199 | break; |
| 200 | } |
| 201 | } |
| 202 | break; |
| 203 | } |
| 204 | } |
| 205 | botm: |
| 206 | gs.stealoid = gs.stealmid = 0; /* in case only one has been reset so far */ |
| 207 | return 0; |
| 208 | } |
| 209 | |
| 210 | /* An object you're wearing has been taken off by a monster (theft or |
| 211 | seduction). Also used if a worn item gets transformed (stone to flesh). */ |
nothing calls this directly
no test coverage detected