Re: do_rescue spaghetti

From: Tony Robbins (tonyr@NWPACLINK.COM)
Date: 03/19/98


At 08:53 PM 3/18/98 -0500, you wrote:
I would have changed one part of the patch...

diff -uprN -X .exclude stk/act.offensive.c rescue/act.offensive.c
--- stk/act.offensive.c Wed Oct 29 00:16:21 1997
+++ rescue/act.offensive.c      Wed Mar 18 20:44:05 1998
@@ -329,52 +329,46 @@ ACMD(do_rescue)

   one_argument(argument, arg);

-  if (!(vict = get_char_room_vis(ch, arg))) {
+  if (!(vict = get_char_room_vis(ch, arg)))
     send_to_char("Whom do you want to rescue?\r\n", ch);
-    return;
-  }
-  if (vict == ch) {
+  else if (vict == ch)
     send_to_char("What about fleeing instead?\r\n", ch);
-    return;
-  }
-  if (FIGHTING(ch) == vict) {
+  else if (FIGHTING(ch) == vict)
     send_to_char("How can you rescue someone you are trying to kill?\r\n",
ch);
-    return;
-  }
-  for (tmp_ch = world[ch->in_room].people; tmp_ch &&
-       (FIGHTING(tmp_ch) != vict); tmp_ch = tmp_ch->next_in_room);
-
-  if (!tmp_ch) {
-    act("But nobody is fighting $M!", FALSE, ch, 0, vict, TO_CHAR);
-    return;
-  }
-  if (GET_CLASS(ch) != CLASS_WARRIOR)
-    send_to_char("But only true warriors can do this!", ch);
   else {
-    percent = number(1, 101);  /* 101% is a complete failure */
-    prob = GET_SKILL(ch, SKILL_RESCUE);
+    for (tmp_ch = world[ch->in_room].people; tmp_ch; tmp_ch =
tmp_ch->next_in_room)
+      if (FIGHTING(tmp_ch) == vict)
+       break;
+
+    if (!tmp_ch)
+      act("But nobody is fighting $M!", FALSE, ch, 0, vict, TO_CHAR);
+  #ifdef GEORGE_GREER_ANTI_SPAGHETTI                 /* I oppose the
IS_WARRIOR
+    else if (!IS_WARRIOR(ch))                         * method because my
way is
+  #else                                                        * more expandable.  Just a
+    else if (!GET_SKILL(ch, SKILL_RESCUE))             * thought...  TR   :)
+  #endif                                                       */
+      send_to_char("But only true warriors can do this!\r\n", ch);
+    else {
+      percent = number(1, 101);        /* 101% is a complete failure */
+      prob = GET_SKILL(ch, SKILL_RESCUE);
+
+      if (percent > prob) {
+        send_to_char("You fail the rescue!\r\n", ch);
+        return;
+      }
+      send_to_char("Banzai!  To the rescue...\r\n", ch);
+      act("You are rescued by $N, you are confused!", FALSE, vict, 0, ch,
TO_CHAR);
+      act("$n heroically rescues $N!", FALSE, ch, 0, vict, TO_NOTVICT);
+
+      if (FIGHTING(vict) == tmp_ch)
+        stop_fighting(vict);
+      if (FIGHTING(tmp_ch))
+        stop_fighting(tmp_ch);
+      if (FIGHTING(ch))
+        stop_fighting(ch);

-    if (percent > prob) {
-      send_to_char("You fail the rescue!\r\n", ch);
-      return;
-    }
-    send_to_char("Banzai!  To the rescue...\r\n", ch);
-    act("You are rescued by $N, you are confused!", FALSE, vict, 0, ch,
TO_CHAR);
-    act("$n heroically rescues $N!", FALSE, ch, 0, vict, TO_NOTVICT);
-
-    if (FIGHTING(vict) == tmp_ch)
-      stop_fighting(vict);
-    if (FIGHTING(tmp_ch))
-      stop_fighting(tmp_ch);
-    if (FIGHTING(ch))
-      stop_fighting(ch);
-
-    set_fighting(ch, tmp_ch);
-    set_fighting(tmp_ch, ch);
+      set_fighting(ch, tmp_ch);
+      set_fighting(tmp_ch, ch);

-    WAIT_STATE(vict, 2 * PULSE_VIOLENCE);
+      WAIT_STATE(vict, 2 * PULSE_VIOLENCE);
+    }
   }
-
 }

/* End Code */
As you can see, I would check to see if a character has the skill, rather
than if they're a warrior.  More expandable.  Just my .002 cents.

-B.


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST