mob_act.c

demise/src/mob_act.c · 4.3 KB

From the archive dodbackup-final.tar.gz

Download the archive   « Back to the archive contents

/***************************************************************************
 *  Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,        *
 *  Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe.   *
 *                                                                         *
 *  Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael          *
 *  Chastain, Michael Quan, and Mitchell Tse.                              *
 *                                                                         *
 *  In order to use any part of this Merc Diku Mud, you must comply with   *
 *  both the original Diku license in 'license.doc' as well the Merc       *
 *  license in 'license.txt'.  In particular, you may not remove either of *
 *  these copyright notices.                                               *
 *                                                                         *
 *  Much time and thought has gone into this software and you are          *
 *  benefitting.  We hope that you share your changes too.  What goes      *
 *  around, comes around.                                                  *
 ***************************************************************************/

/***************************************************************************
 *  God Wars Mud improvements copyright (C) 1994, 1995, 1996 by Richard    *
 *  Woolcock.  This mud is NOT to be copied in whole or in part, or to be  *
 *  run without the permission of Richard Woolcock.  Nobody else has       *
 *  permission to authorise the use of this code.                          *
 ***************************************************************************/

#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"

void
do_resign (CHAR_DATA * ch, char *argument)
{
  OBJ_DATA *obj;
  CHAR_DATA *mage;
  char buf[MSL];
  char arg1[MIL];
  char arg2[MIL];
  int rune;

  argument = one_argument (argument, arg1);
  argument = one_argument (argument, arg2);

  for (mage = ch->in_room->people; mage != NULL; mage = mage->next_in_room)
    {
      if (!IS_NPC (mage))
	continue;
      if (mage->spec_fun == spec_lookup ("spec_mastermage"))
	break;
    }

  if (mage == NULL || mage->spec_fun != spec_lookup ("spec_mastermage"))
    {
      send_to_char ("You can't do that here.\n\r", ch);
      return;
    }

  if (mage->fighting != NULL)
    {
      send_to_char ("Wait until the fighting stops.\n\r", ch);
      return;
    }

  if (!IS_MAGE (ch) && !IS_DRAC_MAGE (ch) && !IS_RAKSHASA (ch))
    {
      do_huh (ch, "");
      return;
    }

  if (arg1[0] == '\0')
    {
      do_say (mage,
	      "Syntax: resign <page> <air/fire/water/earth/spirit/dragon>.");
      return;
    }
  if (ch->pcdata->runes[0] == WHITE_MAGIC)
    {
      sprintf (buf,
	       "You need to be part of one of the school's of magic before I will help you.");
      do_say (mage, buf);
      return;
    }

  if ((obj = get_obj_carry (ch, arg1)) == NULL)
    {
      do_say (mage, "You are not carrying that.");
      return;
    }

  if (!IS_SET (obj->spectype, ADV_FINISHED))
    {
      do_say (mage, "Finish the spell first...");
      return;
    }

  if (!str_cmp (arg2, "air"))
    rune = PURPLE_MAGIC;
  else if (!str_cmp (arg2, "fire"))
    rune = RED_MAGIC;
  else if (!str_cmp (arg2, "earth"))
    rune = GREEN_MAGIC;
  else if (!str_cmp (arg2, "water"))
    rune = BLUE_MAGIC;
  else if (!str_cmp (arg2, "spirit"))
    rune = YELLOW_MAGIC;
  else if (!str_cmp (arg2, "dragon"))
    rune = DRAGON_MAGIC;
  else
    {
      send_to_char ("Thats not a valid option!\n\r", ch);
      return;
    }

  if (ch->pcdata->quest < 50)
    {
      sprintf (buf,
	       "I want 50 credits to resign your page, which you obviously don't have.");
      do_say (mage, buf);
      return;
    }

  act ("$n hands over a page to $N for resigning.", ch, NULL, mage, TO_ROOM);
  act ("You hand over a page to $N for resigning.", ch, NULL, mage, TO_CHAR);
  obj->toughness = rune;
  do_say (mage,
	  "Done. Now it is time for my payment, give me 50 credits for the sign.");
  ch->pcdata->quest -= 50;
  act ("$n gives $N 50 credits for $S services.", ch, NULL, mage, TO_ROOM);
  act ("You give $N 50 credits for $S services.", ch, NULL, mage, TO_CHAR);
  do_say (mage, "Thank you, return at any time!");
  return;
}

Site Stats

Snippets: 1791
Codebases: 571