cyberdemon.c

dystopia/src/cyberdemon.c · 16.5 KB

From the archive dystopia-1.4-CE.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.                                               *
 *                                                                         *
 *  Dystopia Mud improvements copyright (C) 2000, 2001 by Brian Graversen  *
 *                                                                         *
 *  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.                                                  *
 ***************************************************************************/

#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"

/* this one bypasses shields */
void do_radarscan(CHAR_DATA *ch, char *argument)
{
  CHAR_DATA *victim;
  ROOM_INDEX_DATA *chroom;
  ROOM_INDEX_DATA *victimroom;
  char arg[MAX_INPUT_LENGTH];

  argument = one_argument(argument, arg);

  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_CYBERDEMON))
  {
    send_to_char("Huh?\n\r", ch);
    return;
  }
  if (!IS_SET(ch->pcdata->powers[CDEMON_IMPLANTS], IMPLANT_RADAR))
  {
    send_to_char("You don't have the radar implant.\n\r", ch);
    return;
  }
  if (arg[0] == '\0')
  {
    send_to_char("Scan for whom?\n\r", ch);
    return;
  }
  if ((victim = get_char_world(ch, arg)) == NULL)
  {
    send_to_char("They aren't here.\n\r", ch);
    return;
  }
  chroom = ch->in_room;
  victimroom = victim->in_room;
  char_from_room(ch);
  char_to_room(ch,victimroom);
  do_look(ch,"scry");
  char_from_room(ch);
  char_to_room(ch,chroom);
  if (!IS_NPC(victim)) ch->fight_timer += 5;
  return;
}

void do_battlestation(CHAR_DATA *ch, char *argument)
{
  char buf [MAX_STRING_LENGTH];

  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_CYBERDEMON))
  {
    send_to_char("Huh?\n\r", ch);
    return;
  }
  if (!IS_SET(ch->pcdata->powers[CDEMON_IMPLANTS], IMPLANT_BATTLESTATION))
  {
    send_to_char("You don't have the battlestation implant.\n\r", ch);
    return;
  }
  if (IS_SET(ch->newbits, NEW_CUBEFORM))
  {
    if (ch->fighting)
    {
      send_to_char("Not while fighting.\n\r", ch);
      return;
    }
    REMOVE_BIT(ch->newbits, NEW_CUBEFORM);
    REMOVE_BIT(ch->affected_by, AFF_POLYMORPH);
    act("$n reverts to demonform.",ch,NULL,NULL,TO_ROOM);
    send_to_char("You turn into your normal form.\n\r",ch);
    ch->damroll -= 250;
    ch->hitroll -= 250;
    free_string(ch->morph);
    ch->morph=str_dup("");
    return;
  }
  else
  {
    act( "$n transforms into a powerful looking battlestation.",ch,NULL,NULL,TO_ROOM);
    send_to_char("You change into a powerful battlestation.\n\r",ch);
    SET_BIT(ch->newbits, NEW_CUBEFORM);  
    SET_BIT(ch->affected_by, AFF_POLYMORPH);
    sprintf(buf,"%s the battlestation", ch->name); 
    free_string(ch->morph);
    ch->morph = str_dup(buf);
    ch->damroll += 250;
    ch->hitroll += 250;
    if (ch->fighting) WAIT_STATE(ch, 12);
  }
  return;
}

void do_reload(CHAR_DATA *ch, char *argument)
{
  char arg[MAX_INPUT_LENGTH];

  argument = one_argument( argument, arg );

  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_CYBERDEMON))
  {
    send_to_char("Huh?\n\r", ch );
    return;
  }
  if (arg[0] == '\0')
  {
    send_to_char("What do you wish to reload : ammo or rockets ?\n\r", ch);
    return;
  }
  if (!str_cmp(arg, "ammo"))
  {
    if (!IS_SET(ch->pcdata->powers[CDEMON_IMPLANTS], IMPLANT_SUBMACHINEGUN))
    {
      send_to_char("You don't have a submachine gun.\n\r", ch);
      return;
    }
    if ((!IS_SET(ch->pcdata->powers[CDEMON_IMPLANTS], IMPLANT_ARMORY) && ch->pcdata->powers[CDEMON_AMMO] >= 2)
      || ch->pcdata->powers[CDEMON_AMMO] >= 4)
    {
      send_to_char("You are already fully reloaded.\n\r", ch);
      return;
    }
    send_to_char("*Click*\n\r", ch);
    WAIT_STATE(ch, 8);
    ch->pcdata->powers[CDEMON_AMMO]++;
    return;
  }
  else if (!str_cmp(arg, "rockets"))
  {
    if (!IS_SET(ch->pcdata->powers[CDEMON_IMPLANTS], IMPLANT_ROCKETLAUNCHER))
    {
      send_to_char("You don't have a rocket launcher.\n\r", ch);
      return;
    }
    if ((!IS_SET(ch->pcdata->powers[CDEMON_IMPLANTS], IMPLANT_ARMORY) && ch->pcdata->powers[CDEMON_ROCKET] >= 1)
      || ch->pcdata->powers[CDEMON_ROCKET] >= 2)
    {
      send_to_char("You are already fully reloaded.\n\r", ch);
      return;
    }
    send_to_char("*Ka-Chunk*\n\r", ch);
    WAIT_STATE(ch, 8); 
    ch->pcdata->powers[CDEMON_ROCKET]++;
    return;
  }
  else
  {
    do_reload(ch, "");
    return;
  }
  return;
}

void do_implant(CHAR_DATA *ch, char *argument)
{
  char arg[MAX_INPUT_LENGTH];
  int cost, power;

  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_CYBERDEMON))
  {  
    send_to_char("Huh?\n\r", ch );
    return;
  }
  one_argument(argument, arg);
  if (arg[0] == '\0')
  {
    send_to_char("                 #p{{{#0-#p}}} #0Cyberdemon Implants #p{{{#0-#p}}}#n\n\r\n\r", ch);
    send_to_char(" #PEyes         #0[#p25000#0]  #PExtra Arms      #0[#p15000#0]  #PRadar         #0[#p10000#0]#n\n\r", ch);
    send_to_char(" #PMachinegun   #0[#p50000#0]  #PRocket Launcher #0[#p50000#0]  #PBody Armor    #0[#p10000#0]#n\n\r", ch);
    send_to_char(" #PArmwires     #0[#p50000#0]  #P360 Vision      #0[#p50000#0]  #PArmory        #0[#p20000#0]#n\n\r", ch);
    send_to_char(" #PSteam Engine #0[#p40000#0]  #PBreath Cannon   #0[#p40000#0]  #PBattlestation #0[#p40000#0]#n\n\r", ch);
    send_to_char(" #PDemongate    #0[#p35000#0]  #PTuned Engine    #0[#p40000#0]  #PRegrowth      #0[#p25000#0]#n\n\r", ch);
    send_to_char(" #PLarvafeet    #0[#p50000#0]#n\n\r", ch);
    return;
  }
  if (!str_cmp(arg, "eyes"))
  {
    cost = 25000;
    power = IMPLANT_EYES;
  }
  else if (!str_cmp(arg, "extra") || !str_cmp(arg, "arms"))
  {
    cost = 15000;
    power = IMPLANT_EXTRA_ARMS;
  }
  else if (!str_cmp(arg, "radar"))
  {
    cost = 10000;
    power = IMPLANT_RADAR;
  }
  else if (!str_cmp(arg, "machinegun"))
  {
    cost = 50000;
    power = IMPLANT_SUBMACHINEGUN;
  }
  else if (!str_cmp(arg, "rocket") || !str_cmp(arg, "launcher"))
  {
    cost = 50000;
    power = IMPLANT_ROCKETLAUNCHER;
  }
  else if (!str_cmp(arg, "body") || !str_cmp(arg, "armor"))
  {
    cost = 10000;
    power = IMPLANT_BODYARMOR;
  }
  else if (!str_cmp(arg, "armwires"))
  {
    cost = 50000;
    power = IMPLANT_ARMWIRE;
  }
  else if (!str_cmp(arg, "360") || !str_cmp(arg, "vision"))
  {
    cost = 50000;
    power = IMPLANT_360VISION;
  }
  else if (!str_cmp(arg, "armory"))
  {
    cost = 20000;
    power = IMPLANT_ARMORY;
  }
  else if (!str_cmp(arg, "steam"))
  {
    cost = 40000;
    power = IMPLANT_STEAMENGINE;
  }
  else if (!str_cmp(arg, "breath") || !str_cmp(arg, "cannon"))
  {
    cost = 40000;
    power = IMPLANT_BREATHCANNON;
  }
  else if (!str_cmp(arg, "battlestation"))
  {
    cost = 40000;
    power = IMPLANT_BATTLESTATION;
  }
  else if (!str_cmp(arg, "larvafeet"))
  {
    cost = 50000;
    power = IMPLANT_LARVAFEET;
  }
  else if (!str_cmp(arg, "demongate"))
  {
    cost = 35000;
    power = IMPLANT_DEMONGATE;
  }
  else if (!str_cmp(arg, "tuned"))
  {
    cost = 40000;
    power = IMPLANT_TUNEDENGINE;
  }
  else if (!str_cmp(arg, "regrowth"))
  {
    cost = 25000;
    power = IMPLANT_REGROWTH;
  }
  else
  {
    do_implant(ch, "");
    return;
  }
  if (IS_SET(ch->pcdata->powers[CDEMON_IMPLANTS], power))
  {
    send_to_char("You already have that implant.\n\r", ch);
    return;
  }
  if (ch->pcdata->powers[CDEMON_POWER] < cost)
  {
    send_to_char("You do not have enough droid points to buy this implant.\n\r", ch);
    return;
  }
  if (ch->exp < 250 * cost)
  {
    send_to_char("You do not have enough exp to buy this implant.\n\r", ch);
    return;
  }
  ch->exp -= cost * 250;
  ch->pcdata->powers[CDEMON_POWER] -= cost;
  send_to_char("You gain a new implant.\n\r", ch);
  SET_BIT(ch->pcdata->powers[CDEMON_IMPLANTS], power);
  return;
}

void do_demonspeed(CHAR_DATA *ch, char *argument)
{
  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_CYBERDEMON))
  {  
    send_to_char("Huh?\n\r", ch );
    return;
  }
  if (ch->position != POS_FIGHTING)
  {
    send_to_char("You are not fighting anyone.\n\r", ch);
    return;
  }
  if (ch->pcdata->powers[CDEMON_SPEED] >= 6)
  {
    send_to_char("But you are already moving at max speed.\n\r", ch);
    return;
  }
  send_to_char("You feel a rush of power as your fighting speed picks up.\n\r", ch);
  ch->pcdata->powers[CDEMON_SPEED]++;
  WAIT_STATE(ch, 8);
  return;
}

void do_steam(CHAR_DATA *ch, char *argument)
{
  CHAR_DATA *victim;
  char arg[MAX_INPUT_LENGTH];
  int cost = 500;

  one_argument(argument, arg);

  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_CYBERDEMON))
  {
    send_to_char("Huh?\n\r", ch );
    return;
  }
  if (!IS_SET(ch->pcdata->powers[CDEMON_IMPLANTS], IMPLANT_BREATHCANNON))
  {
    send_to_char("You don't have that implant.\n\r", ch);
    return;
  }
  if (arg[0] == '\0')
  {
    if ((victim = ch->fighting) == NULL)
    {
      send_to_char("But you are not fighting anyone.\n\r", ch);
      return;
    }
  }
  else if ((victim = get_char_room(ch, arg)) == NULL)
  {
    send_to_char("They are not here.\n\r", ch);
    return;
  }
  if (ch->move < cost)
  {
    send_to_char("you don't have enough move.\n\r", ch);
    return;
  }
  if (is_safe(ch, victim)) return;
  one_hit(ch, victim, gsn_steam, 1);
  one_hit(ch, victim, gsn_steam, 1);
  if (!IS_AFFECTED(victim, AFF_FLAMING))
  {
    act("$n catches on fire.", victim, NULL, NULL, TO_ROOM);
    SET_BIT(victim->affected_by, AFF_FLAMING);
  }
  ch->move -= cost;
  WAIT_STATE(ch, 12);
  return;
}

void do_submachine(CHAR_DATA *ch, char *argument)
{  
  CHAR_DATA *victim;  
  char arg[MAX_INPUT_LENGTH];

  one_argument(argument, arg);

  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_CYBERDEMON))
  {
    send_to_char("Huh?\n\r", ch );
    return;
  }
  if (!IS_SET(ch->pcdata->powers[CDEMON_IMPLANTS], IMPLANT_SUBMACHINEGUN))
  {
    send_to_char("You don't have that implant.\n\r", ch);
    return;
  }
  if (arg[0] == '\0')
  {
    if ((victim = ch->fighting) == NULL)
    {
      send_to_char("But you are not fighting anyone.\n\r", ch);
      return;
    }
  }
  else if ((victim = get_char_room(ch, arg)) == NULL)
  {
    send_to_char("They are not here.\n\r", ch);
    return;
  }
  if (ch->pcdata->powers[CDEMON_AMMO] <= 0)
  {
    send_to_char("*Click* You are out of ammo.\n\r", ch);
    do_say(ch, "Damn, out of ammo...");
    return;
  }
  if (is_safe(ch, victim)) return;
  ch->pcdata->powers[CDEMON_AMMO]--;
  one_hit(ch, victim, gsn_machinegun, 1);
  one_hit(ch, victim, gsn_machinegun, 1);
  one_hit(ch, victim, gsn_machinegun, 1);
  if (number_range(1, 5) == 3)
  {
    send_to_char("You are blessed by Lloth and fire of another volley.\n\r", ch);
    one_hit(ch, victim, gsn_machinegun, 1);
    one_hit(ch, victim, gsn_machinegun, 1);
  }
  act("$n reels back in shock.", victim, NULL, NULL, TO_ROOM);
  WAIT_STATE(victim, 12);
  WAIT_STATE(ch, 12);
  return;
}

void do_rocketblast(CHAR_DATA *ch, char *argument)
{
  CHAR_DATA *victim;  
  CHAR_DATA *ich;
  CHAR_DATA *ich_next;
  char arg[MAX_INPUT_LENGTH];

  one_argument(argument, arg);

  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_CYBERDEMON))
  {
    send_to_char("Huh?\n\r", ch );
    return;
  }
  if (!IS_SET(ch->pcdata->powers[CDEMON_IMPLANTS], IMPLANT_ROCKETLAUNCHER))
  {
    send_to_char("You don't have that implant.\n\r", ch);
    return;
  }
  if (arg[0] == '\0')
  {
    if ((victim = ch->fighting) == NULL)
    {
      send_to_char("But you are not fighting anyone.\n\r", ch);
      return;
    }
  }
  else if ((victim = get_char_room(ch, arg)) == NULL)
  {
    send_to_char("They are not here.\n\r", ch);
    return;
  }
  if (ch->pcdata->powers[CDEMON_ROCKET] <= 0)
  {
    send_to_char("You are out of rockets.\n\r", ch);
    return;
  }
  if (is_safe(ch, victim)) return;
  ch->pcdata->powers[CDEMON_ROCKET]--;
  one_hit(ch, victim, gsn_rocket, 1);
  one_hit(ch, victim, gsn_rocket, 1);
  ich_next = ch->in_room->people;
  ich = ich_next;
  while (ich_next != NULL)
  {
    ich_next = ich->next_in_room;
    if (ich != ch)
    {
      if (is_safe(ch,ich)) break;
      one_hit(ch, ich, gsn_rocket, 1);
    }
    ich = ich_next;
  }
  WAIT_STATE(ch, 12);
  return;
}

void do_cybertalk(CHAR_DATA *ch, char *argument)
{
  int class = ch->class;

  if (IS_NPC(ch) || (!IS_IMMORTAL(ch) && !IS_CLASS(ch, CLASS_CYBERDEMON)))
  {
    send_to_char("Huh?\n\r", ch);
    return;
  }
  ch->class = CLASS_CYBERDEMON;
  talk_channel(ch, argument, CHANNEL_CLASS, CC_CYBERDEMON, "communicate");
  ch->class = class;
  return;
}

void do_pentagram(CHAR_DATA *ch, char *argument)  
{
  CHAR_DATA *victim;
  CHAR_DATA *gch;
  int pcounter = 0;
  char arg [MAX_INPUT_LENGTH];  
  ROOM_INDEX_DATA *location;
   
  one_argument( argument, arg );
   
  if (IS_NPC(ch)) return;
  if (ch->in_room == NULL) return;
  if (!IS_CLASS(ch, CLASS_CYBERDEMON))
  {
    send_to_char("Huh?\n\r",ch);
    return;
  }
  if (ch->pcdata->powers[CDEMON_SOULS] < 10)
  {
    send_to_char("You do not have enough souls to use this power.\n\r",ch);
    return;
  }
  if (ch->mana < 1500)
  {
    send_to_char("And how would you do that, you got no mana.\n\r",ch);
    return;
  }
  if (arg[0] == '\0')
  {
    send_to_char("Whom do you wish to summon with your pentagram?\n\r", ch);
    return;
  }
  if (ch->in_room != NULL)
  {
    if (IS_SET(ch->in_room->room_flags,ROOM_SAFE) )
    {
      send_to_char( "You cannot draw a pentagram in a safe room.\n\r", ch );
      return;
    }
  }
  if ((victim = get_char_world(ch, arg)) == NULL
    ||   victim == ch
    ||   victim->in_room == NULL
    ||   victim->level > 2000
    ||   (!IS_NPC(victim) && !IS_IMMUNE(victim, IMM_SUMMON))
    ||   IS_SET(ch->in_room->room_flags, ROOM_PRIVATE)
    ||   IS_SET(ch->in_room->room_flags, ROOM_ASTRAL)
    ||   IS_SET(victim->in_room->room_flags, ROOM_ASTRAL)
    ||   IS_SET(victim->in_room->room_flags, ROOM_SAFE)
    ||   victim->in_room->vnum == ch->in_room->vnum)
  {
    send_to_char( "You failed.\n\r", ch );
    return;
  }
  if (victim->position == POS_FIGHTING)
  {
    send_to_char( "You failed, the victim was fighting someone.\n\r", ch );
    return;
  }
  gch = ch->in_room->people;
  while ((gch = gch->next_in_room) != NULL) pcounter++;
  if (pcounter > 30)
  {
    send_to_char("The room is to crowded.\n\r",ch);
    return;
  }
  location = ch->in_room;
  act("You draw an unholy pentagram on the floor and call upon your dark god.", ch, NULL, NULL, TO_CHAR);
  act("$n draws an unholy pentagram on the floor and starts chanting.", ch, NULL, NULL, TO_ROOM);
  act("A pentagram forms under your feet and the world is suddenly a big blurr.", victim, NULL, NULL, TO_CHAR); 
  act("A pentagram forms under $n and $e becomes blurry and fades out of existance.", victim, NULL, NULL, TO_ROOM);
  ch->mana -= 1500;
  char_from_room(victim);
  char_to_room(victim, location);
  do_look(victim, "auto");
  act("$N appears in your pentagram.", ch, NULL, victim, TO_CHAR);
  act("$N appears in $n's pentagram.", ch, NULL, victim, TO_ROOM);
  WAIT_STATE(ch, 8);
  return;
}

void do_enrage(CHAR_DATA *ch, char *argument)
{
  char arg[MAX_INPUT_LENGTH];
  CHAR_DATA *victim; 

  argument = one_argument( argument, arg );
  
  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_CYBERDEMON))
  {
    send_to_char("Huh?\n\r",ch);
    return;
  }
  if (ch->pcdata->powers[CDEMON_SOULS] < 20)
  {
    send_to_char("You do not have enough souls to use this power.\n\r",ch);
    return;
  }
  if ((victim = get_char_room(ch, arg)) == NULL)
  {
    send_to_char("They are not here.\n\r", ch);
    return;
  }
  if (victim == ch)
  {
    send_to_char("Your unable to enrage yourself.\n\r", ch);
    return;
  }
  if (IS_NPC(victim) || victim->level < 3)
  {
    send_to_char("Not on them\n\r",ch);
    return;
  }
  do_say(ch, "Kara, Kara, Xenos!");
  if (number_percent() > 40)
    do_berserk2(victim,"");
  else
    send_to_char("#RSomeone is trying to control your actions!!!#n\n\r",victim);
  WAIT_STATE(ch,18);
}

Site Stats

Snippets: 1791
Codebases: 571