From 47572a7946c2df3c55d2b0f060c6c9175e4e33f7 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 9 Jul 2016 16:15:37 -0700 Subject: [PATCH] fix #H4428 - mon vs mon thrown cockatrice egg There was no code in ohitmon() (for object thrown or launched at a monster by someone or something other than the hero) to handle an egg hitting a monster. Cockatrice egg is monsters' preferred missile, but if one hit a monster instead of hero it just did minimal damage without any chance of the side-effect that makes it be preferred. --- doc/fixes36.1 | 2 ++ src/mthrowu.c | 58 ++++++++++++++++++++++++++++++++------------------- 2 files changed, 39 insertions(+), 21 deletions(-) diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 49e65e7e5..bac5863f3 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -316,6 +316,8 @@ when confused scroll of light summoned lights, player would be asked what to call the scroll even if scroll of light was already identified if a visible monster becomes invisible, mark its spot with the 'remembered, unseen monster' glyph ('I' character or '?' tile) +monsters can throw cockatrice eggs at hero, but there was no handling for eggs + when the missile hit an intervening monster Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository diff --git a/src/mthrowu.c b/src/mthrowu.c index a448ba8e6..c36c0fe75 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -338,10 +338,15 @@ boolean verbose; /* give message(s) even when you can't see what happened */ if (ismimic) seemimic(mtmp); mtmp->msleeping = 0; - if (vis) - hit(distant_name(otmp, mshot_xname), mtmp, exclam(damage)); - else if (verbose && !target) - pline("%s is hit%s", Monnam(mtmp), exclam(damage)); + if (vis) { + if (otmp->otyp == EGG) + pline("Splat! %s is hit with %s egg!", Monnam(mtmp), + otmp->known ? an(mons[otmp->corpsenm].mname) : "an"); + else + hit(distant_name(otmp, mshot_xname), mtmp, exclam(damage)); + } else if (verbose && !target) + pline("%s%s is hit%s", (otmp->otyp == EGG) ? "Splat! " : "", + Monnam(mtmp), exclam(damage)); if (otmp->opoisoned && is_poisonable(otmp)) { if (resists_poison(mtmp)) { @@ -369,7 +374,6 @@ boolean verbose; /* give message(s) even when you can't see what happened */ if (resists_acid(mtmp)) { if (vis || (verbose && !target)) pline("%s is unaffected.", Monnam(mtmp)); - damage = 0; } else { if (vis) pline_The("%s burns %s!", hliquid("acid"), mon_nam(mtmp)); @@ -377,24 +381,36 @@ boolean verbose; /* give message(s) even when you can't see what happened */ pline("It is burned!"); } } - mtmp->mhp -= damage; - if (mtmp->mhp < 1) { - if (vis || (verbose && !target)) - pline("%s is %s!", Monnam(mtmp), - (nonliving(mtmp->data) || is_vampshifter(mtmp) - || !canspotmon(mtmp)) ? "destroyed" : "killed"); - /* don't blame hero for unknown rolling boulder trap */ - if (!context.mon_moving - && (otmp->otyp != BOULDER || range >= 0 || otmp->otrapped)) - xkilled(mtmp, XKILL_NOMSG); - else - mondied(mtmp); + if (otmp->otyp == EGG && touch_petrifies(&mons[otmp->corpsenm])) { + if (!munstone(mtmp, TRUE)) + minstapetrify(mtmp, TRUE); + if (resists_ston(mtmp)) + damage = 0; + } + + if (mtmp->mhp > 0) { /* might already be dead (if petrified) */ + mtmp->mhp -= damage; + if (mtmp->mhp < 1) { + if (vis || (verbose && !target)) + pline("%s is %s!", Monnam(mtmp), + (nonliving(mtmp->data) || is_vampshifter(mtmp) + || !canspotmon(mtmp)) ? "destroyed" : "killed"); + /* don't blame hero for unknown rolling boulder trap */ + if (!context.mon_moving && (otmp->otyp != BOULDER + || range >= 0 || otmp->otrapped)) + xkilled(mtmp, XKILL_NOMSG); + else + mondied(mtmp); + } } - if (can_blnd((struct monst *) 0, mtmp, - (uchar) ((otmp->otyp == BLINDING_VENOM) ? AT_SPIT - : AT_WEAP), - otmp)) { + /* blinding venom and cream pie do 0 damage, but verify + that the target is still alive anyway */ + if (mtmp->mhp > 0 + && can_blnd((struct monst *) 0, mtmp, + (uchar) ((otmp->otyp == BLINDING_VENOM) ? AT_SPIT + : AT_WEAP), + otmp)) { if (vis && mtmp->mcansee) pline("%s is blinded by %s.", Monnam(mtmp), the(xname(otmp))); mtmp->mcansee = 0; -- 2.40.0