From 1c24f208f3780cb5ff064a10cd03dbbb72405290 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 17 Mar 2023 16:00:44 -0700 Subject: [PATCH] genetic engineer attacks When a genetic engineer polymorphs someone it normally teleports away. Also set mspec_used so that it can't polymorph someone [else] on its next turn, it case of a no-teleport level or it happens to randomly land adjacent to the target. --- src/mhitm.c | 6 ++++++ src/mhitu.c | 6 ++++-- src/uhitm.c | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/mhitm.c b/src/mhitm.c index c0d711dfc..88ebf4c03 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -1015,6 +1015,7 @@ int mon_poly(struct monst *magr, struct monst *mdef, int dmg) { static const char freaky[] = " undergoes a freakish metamorphosis"; + struct permonst *oldform = mdef->data; if (mdef == &gy.youmonst) { if (Antimagic) { @@ -1090,6 +1091,11 @@ mon_poly(struct monst *magr, struct monst *mdef, int dmg) pline1(nothing_happens); } } + /* when a transformation has happened, can't attack again for poly + effect during next turn or two; not enforced for poly'd hero */ + if (mdef->data != oldform && magr != &gy.youmonst) + magr->mspec_used += rnd(2); + return dmg; } diff --git a/src/mhitu.c b/src/mhitu.c index edcf9977e..1b44894bb 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -343,10 +343,12 @@ getmattk(struct monst *magr, struct monst *mdef, } /* holders/engulfers who release the hero have mspec_used set to rnd(2) - and can't re-hold/re-engulf until it has been decremented to zero */ + and can't re-hold/re-engulf until it has been decremented to zero; + likewise for transformation by genetic engineer */ } else if (magr->mspec_used && (attk->aatyp == AT_ENGL || attk->aatyp == AT_HUGS - || attk->adtyp == AD_STCK)) { + || attk->adtyp == AD_STCK + || attk->adtyp == AD_POLY)) { boolean wimpy = (attk->damd == 0); /* lichen, violet fungus */ /* can't re-engulf or re-grab yet; switch to simpler attack */ diff --git a/src/uhitm.c b/src/uhitm.c index 4d7588adc..e4ce21134 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -3455,7 +3455,8 @@ mhitm_ad_poly( struct monst *magr, struct attack *mattk, struct monst *mdef, struct mhitm_data *mhm) { - boolean negated = mhitm_mgc_atk_negated(magr, mdef, FALSE); + boolean negated = (mhitm_mgc_atk_negated(magr, mdef, FALSE) + || magr->mspec_used); if (magr == &gy.youmonst) { /* uhitm */