monster breathes at monster (ranged) */
| 1090 | |
| 1091 | /* monster breathes at monster (ranged) */ |
| 1092 | int |
| 1093 | breamm(struct monst *mtmp, struct attack *mattk, struct monst *mtarg) |
| 1094 | { |
| 1095 | int typ = get_atkdam_type(mattk->adtyp); |
| 1096 | boolean utarget = (mtarg == &gy.youmonst); |
| 1097 | |
| 1098 | if (m_lined_up(mtarg, mtmp)) { |
| 1099 | if (mtmp->mcan) { |
| 1100 | if (!Deaf) { |
| 1101 | if (canseemon(mtmp)) { |
| 1102 | pline("%s coughs.", Monnam(mtmp)); |
| 1103 | } else { |
| 1104 | Soundeffect(se_cough, 100); |
| 1105 | You_hear("a cough."); |
| 1106 | } |
| 1107 | } |
| 1108 | return M_ATTK_MISS; |
| 1109 | } |
| 1110 | |
| 1111 | /* if we've seen the actual resistance, don't bother, or |
| 1112 | if we're close by and they reflect, just jump the player */ |
| 1113 | if (utarget && (m_seenres(mtmp, cvt_adtyp_to_mseenres(typ)) |
| 1114 | || m_seenres(mtmp, M_SEEN_REFL))) |
| 1115 | return M_ATTK_HIT; |
| 1116 | |
| 1117 | if (!mtmp->mspec_used && rn2(3)) { |
| 1118 | if (BZ_VALID_ADTYP(typ)) { |
| 1119 | if (canseemon(mtmp)) |
| 1120 | pline("%s breathes %s!", |
| 1121 | Monnam(mtmp), breathwep_name(typ)); |
| 1122 | gb.buzzer = mtmp; |
| 1123 | dobuzz(BZ_M_BREATH(BZ_OFS_AD(typ)), (int) mattk->damn, |
| 1124 | mtmp->mx, mtmp->my, sgn(gt.tbx), sgn(gt.tby), |
| 1125 | utarget, utarget, FALSE); |
| 1126 | gb.buzzer = 0; |
| 1127 | nomul(0); |
| 1128 | /* breath runs out sometimes. Also, give monster some |
| 1129 | * cunning; don't breath if the target fell asleep. |
| 1130 | */ |
| 1131 | if (!utarget || !rn2(3)) |
| 1132 | mtmp->mspec_used = 8 + rn2(18); |
| 1133 | if (utarget && typ == AD_SLEE && !Sleep_resistance) |
| 1134 | mtmp->mspec_used += rnd(20); |
| 1135 | |
| 1136 | /* If this is a pet, it'll get hungry. Minions and |
| 1137 | * spell beings won't hunger */ |
| 1138 | if (mtmp->mtame && !mtmp->isminion) { |
| 1139 | struct edog *dog = EDOG(mtmp); |
| 1140 | |
| 1141 | /* Hunger effects will catch up next move */ |
| 1142 | if (dog->hungrytime >= 10) |
| 1143 | dog->hungrytime -= 10; |
| 1144 | } |
| 1145 | } else impossible("Breath weapon %d used", typ-1); |
| 1146 | } else |
| 1147 | return M_ATTK_MISS; |
| 1148 | } |
| 1149 | return M_ATTK_HIT; |
no test coverage detected