when a monster zaps a wand give a message, deduct a charge, and if it isn't directly seen, remove hero's memory of the number of charges */
| 162 | /* when a monster zaps a wand give a message, deduct a charge, and if it |
| 163 | isn't directly seen, remove hero's memory of the number of charges */ |
| 164 | staticfn void |
| 165 | mzapwand( |
| 166 | struct monst *mtmp, |
| 167 | struct obj *otmp, |
| 168 | boolean self) |
| 169 | { |
| 170 | if (otmp->spe < 1) { |
| 171 | impossible("Mon zapping wand with %d charges?", otmp->spe); |
| 172 | return; |
| 173 | } |
| 174 | if (!canseemon(mtmp)) { |
| 175 | int range = couldsee(mtmp->mx, mtmp->my) /* 9 or 5 */ |
| 176 | ? (BOLT_LIM + 1) : (BOLT_LIM - 3); |
| 177 | |
| 178 | Soundeffect(se_zap, 100); |
| 179 | You_hear("a %s zap.", (mdistu(mtmp) <= range * range) |
| 180 | ? "nearby" : "distant"); |
| 181 | unknow_object(otmp); /* hero loses info when unseen obj is used */ |
| 182 | } else if (self) { |
| 183 | pline("%s with %s!", |
| 184 | monverbself(mtmp, Monnam(mtmp), "zap", (char *) 0), |
| 185 | doname(otmp)); |
| 186 | } else { |
| 187 | pline_mon(mtmp, "%s zaps %s!", Monnam(mtmp), an(xname(otmp))); |
| 188 | stop_occupation(); |
| 189 | } |
| 190 | otmp->spe -= 1; |
| 191 | } |
| 192 | |
| 193 | /* similar to mzapwand() but for magical horns (only instrument mons play) */ |
| 194 | staticfn void |
no test coverage detected