Called whenever the player attacks mtmp; also called in other situations where mtmp gets annoyed at the player. Handles mtmp getting annoyed at the attack and any ramifications that might have. Useful also in situations where mtmp was already hostile; it checks for situations where the player shouldn't be attacking and any ramifications /that/ might have. */
| 4262 | where mtmp was already hostile; it checks for situations where the player |
| 4263 | shouldn't be attacking and any ramifications /that/ might have. */ |
| 4264 | void |
| 4265 | setmangry(struct monst *mtmp, boolean via_attack) |
| 4266 | { |
| 4267 | if (via_attack && sengr_at("Elbereth", u.ux, u.uy, TRUE) |
| 4268 | /* only hypocritical if monster is vulnerable to Elbereth (or |
| 4269 | peaceful--not vulnerable but attacking it is hypocritical) */ |
| 4270 | && (onscary(u.ux, u.uy, mtmp) || mtmp->mpeaceful)) { |
| 4271 | You_feel("like a hypocrite."); |
| 4272 | /* AIS: Yes, I know alignment penalties and bonuses aren't balanced |
| 4273 | at the moment. This is about correct relative to other "small" |
| 4274 | penalties; it should be fairly large, as attacking while standing |
| 4275 | on an Elbereth means that you're requesting peace and then |
| 4276 | violating your own request. I know 5 isn't actually large, but |
| 4277 | it's intentionally larger than the 1s and 2s that are normally |
| 4278 | given for this sort of thing. */ |
| 4279 | /* reduce to 3 (average) when alignment is already very low */ |
| 4280 | adjalign((u.ualign.record > 5) ? -5 : -rnd(5)); |
| 4281 | |
| 4282 | if (!Blind) |
| 4283 | pline("The engraving beneath you fades."); |
| 4284 | del_engr_at(u.ux, u.uy); |
| 4285 | } |
| 4286 | |
| 4287 | /* AIS: Should this be in both places, or just in wakeup()? */ |
| 4288 | mtmp->mstrategy &= ~STRAT_WAITMASK; |
| 4289 | if (!mtmp->mpeaceful) |
| 4290 | return; |
| 4291 | /* [FIXME: this logic seems wrong; peaceful humanoids gasp or exclaim |
| 4292 | when they see you attack a peaceful monster but they just casually |
| 4293 | look the other way when you attack a pet?] */ |
| 4294 | if (mtmp->mtame) |
| 4295 | return; |
| 4296 | mtmp->mpeaceful = 0; |
| 4297 | if (mtmp->ispriest) { |
| 4298 | if (p_coaligned(mtmp)) |
| 4299 | adjalign(-5); /* very bad */ |
| 4300 | else |
| 4301 | adjalign(2); |
| 4302 | } else |
| 4303 | adjalign(-1); /* attacking peaceful monsters is bad */ |
| 4304 | if (humanoid(mtmp->data) || mtmp->isshk || mtmp->isgd) { |
| 4305 | if (couldsee(mtmp->mx, mtmp->my)) |
| 4306 | pline_mon(mtmp, "%s gets angry!", Monnam(mtmp)); |
| 4307 | } else { |
| 4308 | growl(mtmp); |
| 4309 | } |
| 4310 | |
| 4311 | /* attacking your own quest leader will anger his or her guardians */ |
| 4312 | if (mtmp->data == &mons[quest_info(MS_LEADER)]) |
| 4313 | qst_guardians_respond(); |
| 4314 | |
| 4315 | /* make other peaceful monsters react */ |
| 4316 | if (!svc.context.mon_moving) |
| 4317 | peacefuls_respond(mtmp); |
| 4318 | } |
| 4319 | |
| 4320 | /* Indicate via message that a monster has awoken. */ |
| 4321 | void |
no test coverage detected