]> granicus.if.org Git - nethack/commitdiff
another conflict abuse
authorcohrs <cohrs>
Fri, 24 Oct 2003 01:59:48 +0000 (01:59 +0000)
committercohrs <cohrs>
Fri, 24 Oct 2003 01:59:48 +0000 (01:59 +0000)
Reported a really long time ago (June 2001) by <Someone>:
 - stand on the upstairs and engrave Elbereth with a /oFire
 - create Demogorgon and e.g. a tame dragon
 - cause conflict
 - Dragon will kill Demogorgon and Demogorgon will never ever attack Dragon.
All monsters could still attack Demogorgon without response via fightm().
Modified fightm() to include a bit of code in m_move and dog_move, allowing
response to an attack.  Testing this in action, Demogorgon still usually
did things detrimental to the player, mostly summoning nasty monsters.

doc/fixes34.3
src/mhitm.c

index 8d8eaf76f91f01269718fba955acd7bb2b8646da..70adbbf9e4d9924bf35840063f72848fecc5cd10 100644 (file)
@@ -78,6 +78,8 @@ when polymorphed into a quantum mechanic, it was possible to jump into
        the water on a no teleport level and instinctively teleport
 when polymorphed into a quantum mechanic on a no teleport level and swallowed,
        no feedback was given when you teleported the swallower away
+allow Conflict-resistant monsters to respond to conflict attacks rather than
+       sitting there and taking the attacks until they die
 
 
 Platform- and/or Interface-Specific Fixes
index 3e2a3592ad70188dba7c0a7b2b796f33f62ec59b..d3d941b660d86244fef4a468ea4335fc5b802006 100644 (file)
@@ -151,6 +151,16 @@ fightm(mtmp)               /* have monsters fight each other */
                     */
                    if (has_u_swallowed) return 0;
 
+                   /* Allow attacked monsters a chance to hit back. Primarily
+                    * to allow monsters that resist conflict to respond.
+                    */
+                   if ((result & MM_HIT) && !(result & MM_DEF_DIED) &&
+                       rn2(4) && mon->movement >= NORMAL_SPEED) {
+                       mon->movement -= NORMAL_SPEED;
+                       notonhead = 0;
+                       (void) mattackm(mon, mtmp);     /* return attack */
+                   }
+
                    return ((result & MM_HIT) ? 1 : 0);
                }
            }