Hugging angers monsters that don't like you enough. Fix some bugs that were preventin...
[rogue-pphs.git] / romance.c
index 3c5c2e1..7d92edc 100644 (file)
--- a/romance.c
+++ b/romance.c
@@ -63,7 +63,7 @@ int ydelta, xdelta;
                 "You catch the %s staring at you out of the corner of eir eye.",
                 "The %s blushes and waves cautiously.",
             };
-            msg(rndchoice(msgs), monsters[tp->t_type - 'A'].m_name);
+            msg(rndchoice(msgs), killname(tp->t_type));
         }
         else if (attr <= 0)
         {
@@ -73,7 +73,7 @@ int ydelta, xdelta;
                 "The %s tells you to stop it.",
                 "The %s is sick of your crap.",
             };
-            msg(rndchoice(msgs), monsters[tp->t_type - 'A'].m_name);
+            msg(rndchoice(msgs), killname(tp->t_type));
         }
         else
         {
@@ -83,7 +83,7 @@ int ydelta, xdelta;
                 "The %s acts like it can't hear you.",
                 "The %s doesn't care.",
             };
-            msg(rndchoice(msgs), monsters[tp->t_type - 'A'].m_name);
+            msg(rndchoice(msgs), killname(tp->t_type));
         }
     }
 }
@@ -119,8 +119,7 @@ int ydelta, xdelta;
             "The %s ignores %s",
             "The %s isn't interested in %s",
         };
-        msg(rndchoice(msgs), monsters[tp->t_type - 'A'].m_name,
-            inv_name(op, TRUE));
+        msg(rndchoice(msgs), killname(tp->t_type), inv_name(op, TRUE));
         return;
     }    
     else if (liking > 0)
@@ -129,8 +128,7 @@ int ydelta, xdelta;
             "The %s accepts %s.",
             "The %s takes %s.",
         };
-        msg(rndchoice(msgs), monsters[tp->t_type - 'A'].m_name,
-            inv_name(op, TRUE));
+        msg(rndchoice(msgs), killname(tp->t_type), inv_name(op, TRUE));
         tp->t_stats.s_int += liking * 10;
     }
     else if (liking < 0)
@@ -140,8 +138,7 @@ int ydelta, xdelta;
             "The %s breaks %s.",
             "The %s hates %s.",
         };
-        msg(rndchoice(msgs), monsters[tp->t_type - 'A'].m_name,
-            inv_name(op, TRUE));
+        msg(rndchoice(msgs), killname(tp->t_type), inv_name(op, TRUE));
         tp->t_stats.s_int -= liking * 2;
     }
     
@@ -166,14 +163,46 @@ int ydelta, xdelta;
 
 embrace()
 {
-    // Figure out if the player is near something w/ enough interest.
-    // Otherwise, hug something random, and make things worse.
+    register struct thing *tp = NULL;
+    register int liking;
+    register int dx, dy;
+
+    for (dx = -1; dx <= 1; ++dx)
+    {
+        for (dy = -1; dy <= 1; ++dy)
+        {
+            register struct linked_list *mob;
+            if ((mob = find_mons(hero.y + dy, hero.x + dx)))
+            {
+                register struct thing *atp = (struct thing *)ldata(mob);
+                if (!tp || atp->t_stats.s_int > tp->t_stats.s_int)
+                    tp = atp;
+            }
+        }
+    }
+
+
+    if (tp == NULL)
+    {
+        msg("You wrap your arms around yourself.");
+       return;
+    }
+    else if (tp->t_stats.s_int < INTERESTED)
+    {
+        if (tp->t_stats.s_int > 0)
+            tp->t_stats.s_int /= 2;
+        else
+            tp->t_stats.s_int--;
+        msg("The %s dodges out of the way.", killname(tp->t_type));
+        return;
+    }
+
     if (amulet)
     {
-        total_winner('K');
+        total_winner(tp->t_type);
     }
     else
     {
-        mostly_winner('K');
+        mostly_winner(tp->t_type);
     }
 }