monster spits substance at monster */
| 1013 | |
| 1014 | /* monster spits substance at monster */ |
| 1015 | int |
| 1016 | spitmm(struct monst *mtmp, struct attack *mattk, struct monst *mtarg) |
| 1017 | { |
| 1018 | struct obj *otmp; |
| 1019 | |
| 1020 | if (mtmp->mcan) { |
| 1021 | if (!Deaf && mdistu(mtmp) < BOLT_LIM * BOLT_LIM) { |
| 1022 | if (canspotmon(mtmp)) { |
| 1023 | pline("A dry rattle comes from %s throat.", |
| 1024 | s_suffix(mon_nam(mtmp))); |
| 1025 | } else { |
| 1026 | Soundeffect(se_dry_throat_rattle, 50); |
| 1027 | You_hear("a dry rattle nearby."); |
| 1028 | } |
| 1029 | } |
| 1030 | return M_ATTK_MISS; |
| 1031 | } |
| 1032 | if (m_lined_up(mtarg, mtmp)) { |
| 1033 | boolean utarg = (mtarg == &gy.youmonst); |
| 1034 | coordxy tx = utarg ? mtmp->mux : mtarg->mx; |
| 1035 | coordxy ty = utarg ? mtmp->muy : mtarg->my; |
| 1036 | |
| 1037 | switch (mattk->adtyp) { |
| 1038 | case AD_BLND: |
| 1039 | case AD_DRST: |
| 1040 | otmp = mksobj(BLINDING_VENOM, TRUE, FALSE); |
| 1041 | break; |
| 1042 | default: |
| 1043 | impossible("bad attack type in spitmm"); |
| 1044 | FALLTHROUGH; |
| 1045 | /*FALLTHRU*/ |
| 1046 | case AD_ACID: |
| 1047 | otmp = mksobj(ACID_VENOM, TRUE, FALSE); |
| 1048 | break; |
| 1049 | } |
| 1050 | if (!rn2(BOLT_LIM-distmin(mtmp->mx,mtmp->my,tx,ty))) { |
| 1051 | if (canseemon(mtmp)) |
| 1052 | pline("%s spits venom!", Monnam(mtmp)); |
| 1053 | if (!utarg) |
| 1054 | gm.mtarget = mtarg; |
| 1055 | m_throw(mtmp, mtmp->mx, mtmp->my, sgn(gt.tbx), sgn(gt.tby), |
| 1056 | distmin(mtmp->mx,mtmp->my,tx,ty), otmp); |
| 1057 | gm.mtarget = (struct monst *) 0; |
| 1058 | nomul(0); |
| 1059 | |
| 1060 | /* If this is a pet, it'll get hungry. Minions and |
| 1061 | * spell beings won't hunger */ |
| 1062 | if (mtmp->mtame && !mtmp->isminion) { |
| 1063 | struct edog *dog = EDOG(mtmp); |
| 1064 | |
| 1065 | /* Hunger effects will catch up next move */ |
| 1066 | if (dog->hungrytime > 1) |
| 1067 | dog->hungrytime -= 5; |
| 1068 | } |
| 1069 | |
| 1070 | return M_ATTK_HIT; |
| 1071 | } else { |
| 1072 | obj_extract_self(otmp); |
no test coverage detected