cabal2.c

forsaken/src/cabal2.c · 333.3 KB

From the archive forsakenl2.tgz

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 Envy Diku Mud, you must comply with   *
 *  the original Diku license in 'license.doc', the Merc license in        *
 *  'license.txt', as well as the Envy license in 'license.nvy'.           *
 *  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.                                                  *
 ***************************************************************************/

#include <sys/types.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include "merc.h"
#include "magic.h"
#include "recycle.h"
#include "interp.h"
#include "cabal.h"
#include "jail.h"
#include "olc.h"
#include "mob_cmds.h"


#define CD CHAR_DATA
CD *    find_keeper     args( (CHAR_DATA *ch ) );
#undef CD

extern void dam_update args ((CHAR_DATA *ch, CHAR_DATA *victim, int dam) );
extern void do_mpzecho	( CHAR_DATA *ch, char *argument );
extern bool check_social( CHAR_DATA *ch, char *command, char *argument) ;
extern void cast_new( CHAR_DATA *ch, char *argument, bool iscommune, bool fIgnorePos );
extern inline int check_anatomy(CHAR_DATA* ch, CHAR_DATA* victim);
char *target_name;

/* CABAL SPELLS SKILLS ETC */

void throatcut(CHAR_DATA* ch, CHAR_DATA* victim, bool fMantis){
  AFFECT_DATA af, *paf;
  const int sn = skill_lookup("throat cut");
  int  chance = 4 * get_skill(ch, sn) / 5;

  /* chance */
  chance += 2 * (get_curr_stat(ch,STAT_DEX) - get_curr_stat(victim,STAT_DEX));
  chance += (ch->level - victim->level);
  chance += affect_by_size(ch,victim);
  chance += (get_curr_stat(ch,STAT_LUCK) - get_curr_stat(victim,STAT_LUCK));

  /* yells */
  a_yell(ch, victim);
  if (victim->fighting != ch && victim != ch){
    char arg1[MIL];
    sprintf(arg1, "Die %s you bloody fool!",PERS(ch,victim));
    j_yell(victim,arg1);
  }
  
  /* check for success */
  if (is_affected(victim, gen_bleed)){
    send_to_char("Their throat has already been cut open.\n\r", ch);
    chance = 0;
  }

  if (number_percent() > chance){
    damage(ch, victim, 0, sn, DAM_SLASH, TRUE );
    check_improve(ch, sn, FALSE, 2 );
    return;
  }
  else
    check_improve(ch, sn, TRUE, 0 );

//MANTIS CHECK
  if (fMantis && is_affected(victim,gsn_mantis) && IS_AWAKE(victim)){
    act("You sense $n's movement and throw $m to the ground!",ch,NULL,victim,TO_VICT);
    act("$N senses your attack, and throws you to the ground!",ch,NULL,victim,TO_CHAR);
    act("$N senses $n's attack, and throws $m to the ground.",ch,NULL,victim,TO_NOTVICT);
    WAIT_STATE2(ch, URANGE(2, 1 + number_range(1, victim->size), 4) * PULSE_VIOLENCE);
    do_visible(ch, "");
    
    affect_strip(victim,gsn_mantis);
    damage(victim,ch,10,gsn_mantis,DAM_BASH,TRUE);
    return;
  }//END MATIS

  damage(ch, victim, 5, sn, DAM_SLASH, TRUE );
  act("With a deft slice you gore $N's throat!", ch, NULL, victim, TO_CHAR );
  act("With a deft slice $n gores $N's throat!", ch, NULL, victim, TO_NOTVICT );
  act("With a deft slice $n gores your throat!", ch, NULL, victim, TO_VICT );
  if (IS_UNDEAD(victim))
    return;
  /* we hit their throat, attach the gen and do the damage */
  af.type = gen_bleed;
  af.level = ch->level;
  af.duration = number_range(2, 4);
  af.where = TO_NONE;
  af.bitvector = 0;
  af.location = APPLY_NONE;
  /* modifier controls how many individuals bleeds happen (8 /tick) */
  af.modifier = af.duration * 8;
  paf = affect_to_char(victim, &af);
  string_to_affect(paf, ch->name);
}

/* ***** KNIGHT POWERS ***** */

void spell_stand_ground( int sn, int level, CHAR_DATA *ch, void *vo,int target){
  CHAR_DATA* victim = (CHAR_DATA*) vo;
  AFFECT_DATA af;
  int skill = 0;

  if (is_affected(victim, sn)){
    if (ch == victim)
      send_to_char("You've already enhanced your defenses!\n\r", ch );
    else
      act("$N has already enhanced $S defenses!", ch, NULL, victim, TO_CHAR );
    return;
  }

  if (ch == victim)
    act("You enhance your ability to stand ground in combat.", victim, NULL, NULL, TO_CHAR);
  else
    act("You enhance $N's ability to stand ground in combat.", ch, NULL, victim, TO_CHAR);

  if (get_skill(victim, gsn_shield_block) > 1)
    skill = gsn_shield_block;
  else if (get_skill(victim, gsn_2hands) > 1)
    skill = gsn_2hands;
  else if (get_skill(victim, gsn_dodge) > 1)
    skill = gsn_dodge;
  else
    skill = gsn_parry;
  
  af.type	= sn;
  af.level	= level;
  af.duration	= -1;
  af.where	= TO_SKILL;
  af.bitvector	= 0;
  af.location	= skill;
  af.modifier	= 10;
  affect_to_char( victim, &af );

  af.where	= TO_AFFECTS;
  af.location	= APPLY_AC;
  af.modifier	= -level;
  affect_to_char( victim, &af );

  af.where	= TO_AFFECTS;
  af.location	= APPLY_DAMROLL;
  af.modifier	= number_range(4, 6);
  affect_to_char( victim, &af );
}

  
    
void spell_holy_weapon( int sn, int level, CHAR_DATA *ch, void *vo,int target)
{
    char buf[MSL], buf2[MSL], arg[MIL], arg2[MIL];
    OBJ_DATA *obj;
    AFFECT_DATA *paf;
    AFFECT_DATA af;
    int temp = 0;
    target_name = one_argument(target_name, arg);
    target_name = one_argument(target_name, arg2);



/* Checks to see if the caster is a mob */
    if (IS_NPC(ch)) 
        return;
    buf[0]='\0';
    buf2[0]='\0';
    if (arg[0] == '\0')
    {
	send_to_char("syntax: cast 'chaosbane' <weapon type or \"beads\">.\n\r",ch);
	return;
    }
    if (is_affected(ch, sn))
      {
	send_to_char("You are not ready to create a new weapon.\n\r", ch);
	return;
      }

    obj = create_object( get_obj_index( OBJ_VNUM_HOLY_WEAPON ), level);
    if (!str_cmp(arg, "dagger"))
    {
	free_string( obj->name );
	strcat(buf, "a gleaming steel dagger");
	obj->name = str_dup( buf );
	free_string( obj->short_descr );
	obj->short_descr = str_dup( buf );
	strcat(buf, " is here.");
	free_string( obj->description );
	obj->description = str_dup( buf );
	obj->value[0] = WEAPON_DAGGER;
	obj->value[3] = attack_lookup("pierce");
	obj->weight = 40;
    }
    else if (!str_cmp(arg, "mace"))
    {
	free_string( obj->name );
	strcat(buf, "a gleaming steel mace");
	obj->name = str_dup( buf );
	free_string( obj->short_descr );
	obj->short_descr = str_dup( buf );
	strcat(buf, " is here.");
	free_string( obj->description );
	obj->description = str_dup( buf );
	obj->value[0] = WEAPON_MACE;
	obj->value[3] = attack_lookup("crush");
	obj->weight = 250;
    }
    else if (!str_cmp(arg, "flail"))
    {
	free_string( obj->name );
	strcat(buf, "a gleaming steel flail");
	obj->name = str_dup( buf );
	free_string( obj->short_descr );
	obj->short_descr = str_dup( buf );
	strcat(buf, " is here.");
	free_string( obj->description );
	obj->description = str_dup( buf );
	obj->value[0] = WEAPON_FLAIL;
	obj->value[3] = attack_lookup("pound");
	obj->weight = 120;
    }
    else if (!str_cmp(arg, "sword"))
    {
	free_string( obj->name );
	strcat(buf, "a gleaming steel sword");
	obj->name = str_dup( buf );
	free_string( obj->short_descr );
	obj->short_descr = str_dup( buf );
	strcat(buf, " is here.");
	free_string( obj->description );
	obj->description = str_dup( buf );
	obj->value[0] = WEAPON_SWORD;
	obj->value[3] = attack_lookup("slash");
	obj->weight = 180;
    }
    else if (!str_cmp(arg, "axe"))
    {
	free_string( obj->name );
	strcat(buf, "a gleaming two-handed axe");
	obj->name = str_dup( buf );
	free_string( obj->short_descr );
	obj->short_descr = str_dup( buf );
	strcat(buf, " is here.");
	free_string( obj->description );
	obj->description = str_dup( buf );
	obj->value[0] = WEAPON_AXE;
	obj->value[3] = attack_lookup("cleave");
	obj->value[4] |= (flag_value( weapon_type2, "twohands" ) != NO_FLAG
              ? flag_value( weapon_type2, "twohands" ) : 0 ); 
	obj->weight = 350;
    }
    else if (!str_cmp(arg, "staff"))
    {
	free_string( obj->name );
	strcat(buf, "a gleaming steel staff");
	obj->name = str_dup( buf );
	free_string( obj->short_descr );
	obj->short_descr = str_dup( buf );
	strcat(buf, " is here.");
	free_string( obj->description );
	obj->description = str_dup( buf );
	obj->value[0] = WEAPON_STAFF;
	obj->value[3] = attack_lookup("smash");
	obj->value[4] |= (flag_value( weapon_type2, "twohands" ) != NO_FLAG
              ? flag_value( weapon_type2, "twohands" ) : 0 ); 
	obj->weight = 50;
    }
    else if (!str_cmp(arg, "polearm") || !str_cmp(arg, "glaive"))
    {
	free_string( obj->name );
	strcat(buf, "a gleaming steel glaive");
	obj->name = str_dup( buf );
	free_string( obj->short_descr );
	obj->short_descr = str_dup( buf );
	strcat(buf, " is here.");
	free_string( obj->description );
	obj->description = str_dup( buf );
	obj->value[0] = WEAPON_POLEARM;
	obj->value[3] = attack_lookup("cleave");
	obj->value[4] |= (flag_value( weapon_type2, "twohands" ) != NO_FLAG
			  ? flag_value( weapon_type2, "twohands" ) : 0 ); 
	obj->weight = 280;
    }
    else if (!str_cmp(arg, "spear"))
    {
	free_string( obj->name );
	strcat(buf, "a gleaming steel spear");
	obj->name = str_dup( buf );
	free_string( obj->short_descr );
	obj->short_descr = str_dup( buf );
	strcat(buf, " is here.");
	free_string( obj->description );
	obj->description = str_dup( buf );
	obj->value[0] = WEAPON_SPEAR;
	obj->value[3] = attack_lookup("pierce");
	obj->weight = 150;
    }
    else if (!str_cmp(arg, "exotic"))
    {
	free_string( obj->name );
	strcat(buf, "a gleaming steel katar");
	obj->name = str_dup( buf );
	free_string( obj->short_descr );
	obj->short_descr = str_dup( buf );
	strcat(buf, " is here.");
	free_string( obj->description );
	obj->description = str_dup( buf );
	obj->value[0] = WEAPON_EXOTIC;
	obj->value[3] = attack_lookup("pierce");
	obj->weight = 50;
    }
    else if (!str_cmp(arg, "beads")){
      int level = ch->level;
      OBJ_DATA* beads;
      OBJ_SPELL_DATA sp, *spb;

      beads = create_object( get_obj_index( OBJ_VNUM_PRAYER_BEADS ), 0);

      beads->level = level;
      beads->timer = 24;

      af.type       = gsn_beads;
      af.level      = ch->level;
      af.duration   = -1;
      af.location   = APPLY_HITROLL;
      af.modifier   = 10;
      af.bitvector  = 0;
      affect_to_obj( beads, &af );

      af.location   = APPLY_AC;
      af.modifier   = -50;
      affect_to_obj( beads, &af );

      af.location   = APPLY_SAVING_SPELL;
      af.modifier   = -5;
      affect_to_obj( beads, &af );

      af.location   = APPLY_LUCK;
      af.modifier   = 5;
      affect_to_obj( beads, &af );

      /* change the short desc */
      free_string( beads->short_descr );
      beads->short_descr = str_dup("gleaming steel beads");

      free_string( beads->description );
      beads->description = str_dup("You see gleaming steel beads here.");
      
      /* add the spell */
      sp.spell	= skill_lookup("cure serious");
      sp.target = SPELL_TAR_SELF;
      sp.percent= 30;

      spb = spell_to_obj(beads, &sp, FALSE);

      spb->message = str_dup("$p shine with inner light.");
      spb->message2= str_dup("$p shine with inner light.");

      obj_to_char(beads, ch); 
      act( "You create $p.", ch, beads, NULL, TO_CHAR );
      act( "$n creates $p.", ch, beads, NULL, TO_ROOM );

      af.type = sn;
      af.level = level;
      af.duration = 24;
      af.location = APPLY_NONE;
      af.modifier = 0;
      af.where = TO_AFFECTS;
      af.bitvector = 0;
      affect_to_char(ch, &af);

      if (ch->pcdata->rank >= 2)
	SET_BIT(obj->extra_flags, ITEM_NODROP);
      if (ch->pcdata->rank >= 3)
	SET_BIT(obj->extra_flags, ITEM_NOREMOVE);
      return;
    }
    else
    {
      send_to_char("You can't make a Chaosbane like that!\n\r", ch);
      return;
    }

    temp = UMAX(3, (get_skill(ch, sn) - 50) / 7);
    obj->value[1] = number_range(temp, 7);
    obj->value[2] = number_range(3, level / 10) + 3;
    obj->level = level;
    obj->timer = 24;
    paf = new_affect();
    paf->type       = sn;
    paf->level      = level;
    paf->duration   = -1;
    paf->location   = APPLY_HITROLL;
    paf->modifier   = level/10 + 1;
    paf->bitvector  = 0;
    paf->next       = obj->affected;
    obj->affected   = paf;
    paf = new_affect();
    paf->type       = sn;
    paf->level      = level;
    paf->duration   = -1;
    paf->location   = APPLY_DAMROLL;
    paf->modifier   = level/10 + (IS_WEAPON_STAT(obj, WEAPON_TWO_HANDS) ? 3 : 1);
    paf->bitvector  = 0;
    paf->next       = obj->affected;
    obj->affected   = paf;

    if (ch->pcdata->rank >= 2)
      SET_BIT(obj->extra_flags, ITEM_NODROP);
    if (ch->pcdata->rank >= 3)
      SET_BIT(obj->extra_flags, ITEM_NOREMOVE);

    if (IS_ELDER(ch))
    {
	free_string( obj->name );
	strcat(buf2, "'Chaosbane' the Bringer of Order");
	obj->name = str_dup( buf2 );
	free_string( obj->short_descr );
	obj->short_descr = str_dup( buf2 );
	strcat(buf2, " is here.");
	free_string( obj->description );
	obj->description = str_dup( buf2 );
    	obj->timer = 48;
    	obj->value[1] = 7;
    	obj->value[2] = 8;
	obj->value[3] = attack_lookup("divine");
    }
    obj->value[4] |= flag_value( weapon_type2, "sharp" );
/* tack on "spiked" */
    sprintf(buf, "%s spiked", obj->name );
    free_string(obj->name);
    obj->name = str_dup( buf );

    obj_to_char(obj, ch);
    act( "You create $p.", ch, obj, NULL, TO_CHAR );
    act( "$n creates $p.", ch, obj, NULL, TO_ROOM );

    af.type = sn;
    af.level = level;
    af.duration = 24;
    af.location = APPLY_NONE;
    af.modifier = 0;
    af.where = TO_AFFECTS;
    af.bitvector = 0;
    affect_to_char(ch, &af);
}

void do_guard(CHAR_DATA *ch, char *argument)
{
    char arg[MIL];
    CHAR_DATA *victim;
    const int cost = skill_table[gsn_guard].min_mana;
    const int lag = skill_table[gsn_guard].beats;


    one_argument(argument, arg);

    if (IS_NPC(ch))
	return;
    if ( get_skill(ch,gsn_guard) < 2){
      send_to_char( "Huh?\n\r", ch );
      return;
    }
    if ( arg[0] == '\0' )
      {
        send_to_char("Guard whom?\n\r", ch);
        return;
      }
    if ( ( victim = get_char_room( ch, NULL, arg ) ) == NULL )
      {
        send_to_char( "They aren't here.\n\r", ch );
        return;
      }
    if (IS_NPC(victim))
      {
        sendf(ch, "%s doesn't need any of your help!\n\r", PERS2(victim));
        return;
      }
    if (!str_cmp(arg, "none") || !str_cmp(arg, "self") || victim == ch)
      {
	if (ch->pcdata->guarding == NULL)
	{
	    send_to_char("You can't guard yourself!\n\r", ch);
	    return;
	}
	else
        {
	    act("You stop guarding $N.", ch, NULL, ch->pcdata->guarding, TO_CHAR);
	    act("$n stops guarding you.", ch, NULL, ch->pcdata->guarding, TO_VICT);
	    act("$n stops guarding $N.", ch, NULL, ch->pcdata->guarding, TO_NOTVICT);
	    ch->pcdata->guarding->pcdata->guarded_by = NULL;
	    ch->pcdata->guarding = NULL;
	    return;
        }
    }
    if (ch->pcdata->guarding == victim)
    {
        sendf(ch, "You're already guarding %s!\n\r", PERS2(victim));
        return;
    }
    if (ch->pcdata->guarding != NULL)
    {
        send_to_char("But you're already guarding someone else!\n\r", ch);
        return;
    }
    if (victim->pcdata->guarded_by != NULL)
    {
        sendf(ch, "%s is already being guarded by someone.\n\r", PERS2(victim));
        return;
    }
    if (victim->pcdata->guarding == ch)
    {
        sendf(ch, "But %s is guarding you!\n\r", PERS2(victim));
        return;
    }
    if (!is_same_group(victim, ch))
    {
        sendf(ch, "But you aren't in the same group as %s.\n\r", PERS2(victim));
        return;
    }
    if (IS_AFFECTED(ch,AFF_CHARM))
    {
        sendf(ch, "You like your master too much to bother guarding %s!\n\r", PERS2(victim));
        return;
    }
    if (victim->fighting != NULL)
    {
        sendf(ch, "Why don't you let %s stop fighting first?\n\r", PERS2(victim));
        return;
    }
    if (ch->fighting != NULL)
    {
        send_to_char("Better finish your own battle before you worry about guarding someone else.\n\r",ch);
        return;
    }
    if (ch->mana < cost){
      send_to_char("You lack the concentration.\n\r", ch );
      return;
    }
    else
      ch->mana -= cost;
    WAIT_STATE( ch, lag );

    /* subtract cp's */
    handle_skill_cost( ch, ch->pCabal, gsn_guard );
    
    act("You are now guarding $N.", ch, NULL, victim, TO_CHAR);
    act_new("You are being guarded by $n.", ch, NULL, victim, TO_VICT, POS_DEAD);
    act("$n is now guarding $N.", ch, NULL, victim, TO_NOTVICT);
    ch->pcdata->guarding = victim;
    victim->pcdata->guarded_by = ch;
}

void spell_vengeance( int sn, int level, CHAR_DATA *ch, void *vo, int target ){
  AFFECT_DATA af;

  if (is_affected(ch, gen_vengeance)){
    send_to_char("You've already shielded yourself with Vengeance of Light.\n\r", ch );
    return;
  }
  act("An angry white aura surrounds $n.", ch, NULL, NULL, TO_ROOM );
  act("An angry white aura surrounds you.", ch, NULL, NULL, TO_CHAR );

  af.type	= gen_vengeance;
  af.level	= level;
  af.duration	= number_fuzzy( 8 );
  
  af.where	= TO_AFFECTS;
  af.bitvector	= 0;
  af.location	= APPLY_NONE;
  af.modifier	= 0;
  affect_to_char(ch, &af );
}
     

void spell_sense_evil( int sn, int level, CHAR_DATA *ch, void *vo, int target )
{
    AFFECT_DATA af;

/* Checks to see if the caster is a mob */
    if (IS_NPC(ch)) 
        return;
    if ( is_affected( ch, sn ) )
    {
	send_to_char("You are already sensing evil presences.\n\r",ch);
	return;
    }
    af.where	 = TO_AFFECTS2;
    af.type      = sn;
    af.level	 = level;
    af.duration  = level;
    af.modifier  = 0;
    af.location  = APPLY_NONE;
    af.bitvector = AFF_SENSE_EVIL;
    affect_to_char( ch, &af );
    af.where	 = TO_AFFECTS;
    af.bitvector = AFF_DETECT_EVIL;
    affect_to_char( ch, &af );
    send_to_char( "You feel more aware of the evil surrounding you.\n\r", ch );
}
 
void spell_ward_of_light( int sn, int level, CHAR_DATA *ch, void *vo, int target )
{
    AFFECT_DATA af;

/* Checks to see if the caster is a mob */
    if (IS_NPC(ch)) 
        return;
    if ( is_affected( ch, sn ) )
      {
	send_to_char("You are already divinely blessed.\n\r",ch);
	return;
    }
    af.where	 = TO_AFFECTS;
    af.type      = sn;
    af.level	 = level;
    af.duration  = 24;
    af.modifier  = 15;
    af.location  = APPLY_MANA_GAIN;
    af.bitvector = AFF_WARD_LIGHT;
    affect_to_char( ch, &af );
    af.location  = APPLY_DAMROLL;
    af.modifier  = level / 15;
    affect_to_char( ch, &af );
    send_to_char( "You feel divinely blessed.\n\r", ch );
}
 

/* Minor Banishment for Knights(linked in const.c & magic.h) */
void spell_mbanish( int sn, int level, CHAR_DATA *ch, void *vo,int target )
{
    CHAR_DATA *victim = (CHAR_DATA *) vo;
    AFFECT_DATA af;
    int dam;

    //const
    const int dur = number_range(0, 1);

/* Checks to see if the victim is a demon */
    if (victim->race != race_lookup("demon"))
    {
	send_to_char("The spell seems to fail.\n\r",ch);
	return;
    }
/* Checks to see if the victim is casting on themselves */
    if (victim == ch)
    {
    	send_to_char("Banish yourself?  What a novel idea.\n\r",ch);
	return;
    }
    
    dam = number_range(level / 2, level);
    if (ch->race == race_lookup("demon") && !IS_IMMORTAL(ch)){
      send_to_char("Something goes horribly wrong.\n\r", ch);
      damage(ch,victim,3 * dam,sn,DAM_INTERNAL, TRUE);
      return;
    }


//we do small amount of damage and set hysteria and drained on failed save.

    if ( saves_spell( level, victim,DAM_OTHER,skill_table[sn].spell_type))
    {
      act("You momentarly weaken $N's link to the Nexus.", ch, NULL, victim, TO_CHAR);
      act("You feel your link to Chaos falter.", ch, NULL, victim, TO_VICT);
      damage(ch,victim,dam,sn,DAM_INTERNAL, TRUE);
      return;
    }
    dam *= 2;
    act("You completely severe $N's link to the Nexus!", ch, NULL, victim, TO_CHAR);
    act("You panic as your link to Chaos is severed!", ch, NULL, victim, TO_VICT);
    act("$N begins to panic.", victim, NULL, victim, TO_ROOM);
    damage(ch,victim,dam,sn,DAM_INTERNAL, TRUE);

    //setup hysteria and drain for one tick.
    af.where     = TO_AFFECTS; 
    af.type      = gsn_hysteria;
    af.level     = level;
    af.location  = APPLY_HITROLL;
    af.duration  = dur;
    af.bitvector = 0;
    af.modifier  = -2;
    if (!is_affected(victim, gsn_hysteria))
      affect_to_char(victim,&af);
    af.where     = TO_AFFECTS; 
    af.type      = gsn_drained;
    af.level     = level;
    af.location  = APPLY_DAMROLL;
    af.duration  = dur;
    af.bitvector = 0;
    af.modifier  = -2;
    if (!is_affected(victim, gsn_drained))
      affect_to_char(victim,&af);

}

/* ***** LEGION POWERS ***** */


/* void spell_nightmare(int sn, int level, CHAR_DATA *ch, void *vo,int target )
{
    CHAR_DATA *victim = (CHAR_DATA *) vo;
    AFFECT_DATA af;
    if ( IS_AFFECTED2(victim, AFF_NIGHTMARE) )
    {
        if (victim == ch)
            act("You are already under the effects of nightmare.",ch,NULL,victim,TO_CHAR);
        else
            act("$N has already been terrorized by nightmares.",ch,NULL,victim,TO_CHAR);
	return;
    }
    if ( saves_spell( level, victim,DAM_NEGATIVE,skill_table[sn].spell_type) )
    {
	act("You failed to invade $N's dreams.",ch,NULL,victim,TO_CHAR);
	return;
    }
    af.where     = TO_AFFECTS2;
    af.type      = sn;
    af.level	 = level;
    af.duration  = 10;
    af.location  = 0;
    af.modifier  = 0;
    af.bitvector = AFF_NIGHTMARE;
    affect_to_char( victim, &af );
    affect_strip ( victim, gsn_invis			);
    affect_strip ( victim, gsn_mass_invis		);
    if ( IS_NPC(victim) || !IS_SET(race_table[victim->race].aff,AFF_SNEAK) )
    {
    	affect_strip ( victim, gsn_sneak			);
	REMOVE_BIT   ( victim->affected_by, AFF_SNEAK	);
    }
    REMOVE_BIT   ( victim->affected_by, AFF_HIDE	);
    REMOVE_BIT   ( victim->affected_by, AFF_INVISIBLE	);
    affect_strip(victim,gsn_camouflage);
    REMOVE_BIT   ( victim->affected2_by, AFF_CAMOUFLAGE	);
    act_new( "You are surrounded by a pink outline.", victim, NULL, NULL, TO_CHAR, POS_DEAD );
    act( "$n is surrounded by a pink outline.", victim, NULL, NULL, TO_ROOM );
} */


/* remove shadowdemon */
void spell_shadowdemon( int sn, int level, CHAR_DATA *ch, void *vo, int target )   
{
    AFFECT_DATA af;
    CHAR_DATA *mob;
    int i;
    if (get_summoned(ch, MOB_VNUM_SHADOWDEMON) > 0)
    {
        send_to_char("Your shadowdemon is already in existence.\n\r",ch);
        return;
    }
    if ( is_affected( ch, sn ) )
    {
        send_to_char("You are too weak to summon a shadowdemon.\n\r",ch);
        return;
    }
    af.where     = TO_AFFECTS2;   
    af.type      = sn;
    af.level     = level;
    af.duration  = 24;
    af.location  = 0;
    af.modifier  = 0;
    af.bitvector = 0;  
    affect_to_char( ch, &af );
    act ("You summon a shadowdemon from the depths of darkness!", ch, NULL, NULL, TO_CHAR);
    act ("$n summons a shadowdemon from the depths of darkness!", ch, NULL, NULL, TO_ROOM);
    mob = create_mobile( get_mob_index( MOB_VNUM_SHADOWDEMON ) );
    char_to_room(mob,ch->in_room);
    mob->level      = ch->level;
    mob->max_hit    = ch->level * 20;
    mob->hit        = mob->max_hit;
    mob->hitroll    = ch->level /2;
    mob->damroll    = ch->level /2;
    mob->damage[DICE_NUMBER]	= 5;
    mob->damage[DICE_TYPE]	= 9;
    for (i = 0; i < 4; i++)
        mob->armor[i] = ch->armor[i];
    for (i = 0; i < MAX_STATS; i++)
    {
        mob->perm_stat[i]     = ch->perm_stat[i];
        mob->mod_stat[i]      = ch->mod_stat[i];
    }
    SET_BIT(mob->affected_by, AFF_CHARM);
    mob->comm = COMM_NOTELL|COMM_NOYELL|COMM_NOCHANNELS;
    mob->summoner = ch;
    add_follower(mob,ch);
    mob->leader=ch;
}

/* ***** WARLORD POWERS ***** */
bool cyclone( CHAR_DATA*ch, CHAR_DATA* victim, int skill, int sn ){
  int chance = skill;
  
  chance += get_curr_stat(ch,STAT_DEX) - get_curr_stat(victim,STAT_DEX);
  chance += (ch->level - victim->level);
  chance -= get_skill(victim,gsn_dodge) / 10;
//bigger people are easier tohit
  chance -= affect_by_size(ch,victim);
  chance += (get_curr_stat(ch,STAT_LUCK) - get_curr_stat(victim,STAT_LUCK));
  
  switch(ch->in_room->sector_type){
  case(SECT_INSIDE):		chance -= 25;	break;
  case(SECT_CITY):		chance -= 15;	break;
  case(SECT_FIELD):		chance +=  5;	break;
  case(SECT_FOREST):				break;
  case(SECT_HILLS):				break;
  case(SECT_MOUNTAIN):	chance += 10;	break;
  case(SECT_WATER_SWIM):	chance  =  0;	break;
  case(SECT_WATER_NOSWIM):	chance  =  0;	break;
  case(SECT_AIR):		chance  =  0;  	break;
  case(SECT_DESERT):		chance += 25;   break;
  }
  
  if (chance == 0){
    send_to_char("There isn't any dirt here.\n\r",ch);
    return FALSE;
  }

  chance = chance - 25 + UMIN(ch->level, 25);
  
  if (is_affected(victim, gsn_mist_form)){
      act("The dirt flies right through the mist.", ch, NULL, victim, TO_CHAR);
      act("The dirt flies right through $N.", ch, NULL, victim, TO_NOTVICT);
      act("The dirt flies through your non-corporeal form.", ch, NULL, victim, TO_CHAR);
      chance = 0;
  }
  
  if (number_percent() < chance){
    bool fDirtProt =  (victim->race == race_lookup("slith") && number_percent() < victim->level);
    AFFECT_DATA af;
    
    act("$n is blinded by the dirt in $s eyes!",victim,NULL,NULL,TO_ROOM);
    act("$n kicks dirt in your eyes!",ch,NULL,victim,TO_VICT);
    send_to_char("You can't see a thing!\n\r",victim);
    check_improve(ch,gsn_dirt,TRUE,1);
    
    if (fDirtProt){
      send_to_char("Your lizard ancestry serves you well and you easly recover.\n\r", victim);
    }
    else if (!is_affected(victim, gsn_dirt)){
      af.where	= TO_AFFECTS;
      af.type 	= gsn_dirt;
      af.level 	= ch->level;
      af.duration	= 0;
      af.location	= APPLY_HITROLL;
      if (!IS_NPC(victim) && number_percent() < get_skill(victim,gsn_blind_fighting)){
      if (is_affected(victim, gsn_battletrance))
	af.modifier      = 0;
      else
	af.modifier      = -3;
      }
      else
	af.modifier      = -6;
      af.bitvector 	= AFF_BLIND;
      
      affect_to_char(victim,&af);
      
      af.location     = APPLY_AC;
      if (!IS_NPC(victim) && number_percent() < get_skill(victim,gsn_blind_fighting)){
      if (is_affected(victim, gsn_battletrance))
	af.modifier      = 0;
      else
	af.modifier      = +5;
      }
      else
	af.modifier      = +15;
      affect_to_char(victim,&af);
    }
    damage(ch, victim, number_range(ch->level, 3 * ch->level / 2), sn, DAM_PIERCE, TRUE );
    if (victim && victim->in_room)
      return TRUE;
    else
      return FALSE;
  }
  else{
    damage(ch,victim,0,sn,DAM_NONE,TRUE);
    check_improve(ch,gsn_dirt,FALSE,1);
    return FALSE;
  }
}
void do_cyclone(CHAR_DATA *ch, char *argument){
  CHAR_DATA *victim, *vch, *vch_next;
  AFFECT_DATA af, *paf;
  char buf[MSL];
  
  const int sn = gsn_cyclone;
  const int skill = get_skill(ch, sn );
  const int lag = skill_table[sn].beats;
  const int cost = skill_table[sn].min_mana;

  if ( skill < 2){
    send_to_char("Huh?\n\r", ch);
    return;
  }
  else if (IS_NULLSTR(argument)){
    if ( (victim = ch->fighting) == NULL){
      send_to_char("But you aren't in combat!\n\r",ch);
      return;
    }
  }
  else if ((victim = get_char_room(ch, NULL, argument)) == NULL){
    send_to_char("They aren't here.\n\r",ch);
    return;
  }
  else if (is_safe(ch,victim))
    return;

  if (ch->mana < cost ){
    send_to_char("You cannot concentrate sufficiently.\n\r", ch);
    return;
  }
  else
    ch->mana -= cost;

  handle_skill_cost( ch, ch->pCabal, sn);

  /* all safe to go */
  WAIT_STATE2( ch, lag );

  if (number_percent() > skill){
    send_to_char("You failed to execute the form.\n\r", ch);
    check_improve(ch, sn, FALSE, 5);
    return;
  }
  else
    check_improve(ch, sn, TRUE, 1);

  act("$n executes the 'Cyclone'.", ch, NULL, victim, TO_ROOM);
  send_to_char("You execute the 'Cyclone'.\n\r", ch);

  if (ch->fighting != victim && victim->fighting != ch){
    sprintf(buf, "Help! %s blew dirt into my eyes!",PERS(ch,victim));
    j_yell(victim,buf);
  }

  a_yell(ch, victim );
  /* target first */
  if (cyclone(ch, victim, skill, sn )){
    /* attach the skill marker on the user for dblow */
    af.type	= sn;
    af.level	= ch->level;
    af.duration	= 3;
    af.where	= TO_NONE;
    af.bitvector	= 0;
    af.location	= APPLY_NONE;
    af.modifier	= 0;
    affect_to_char( ch, &af );
    
    /* maelstrom refresh */
    if ( (paf = affect_find(ch->affected, gsn_maelstrom)) != NULL)
      paf->duration = af.duration;
  }

  /* we run through all the group mates kicking dirt and damaging */
  for (vch = ch->in_room->people; vch; vch = vch_next){
    vch_next = vch->next_in_room;
    
    if (victim == vch 
	|| IS_AFFECTED(vch, AFF_BLIND) 
	|| !is_same_group(vch, victim) 
	|| is_area_safe_quiet(ch, vch )){
      continue;
    }

    /* check if we can dirt */
    if ( vch->in_room->sector_type != SECT_WATER_SWIM
	 && vch->in_room->sector_type != SECT_WATER_NOSWIM
	 && vch->in_room->sector_type != SECT_AIR
	 && !is_affected(vch, gsn_dirt )){
      if (ch->fighting != vch && vch->fighting != ch){
	sprintf(buf, "Help! %s blew dirt into my eyes!",PERS(ch,vch));
	j_yell(vch, buf);
      }
      a_yell(ch, vch );
      cyclone(ch, vch, skill, sn );
    }
  }
}

void do_maelstrom(CHAR_DATA *ch, char *argument){
  CHAR_DATA *victim;
  AFFECT_DATA af, *paf;
  OBJ_DATA* wield;
  char buf[MSL];
  
  const int sn = gsn_maelstrom;
  const int skill = get_skill(ch, sn );
  const int lag = skill_table[sn].beats;
  const int cost = skill_table[sn].min_mana;
  const int hits = 4;
  int dam_type = DAM_SLASH;

  int i = 0;

  if ( skill < 2){
    send_to_char("Huh?\n\r", ch);
    return;
  }
  else if (IS_NULLSTR(argument)){
    if ( (victim = ch->fighting) == NULL){
      send_to_char("But you aren't in combat!\n\r",ch);
      return;
    }
  }
  else if ((victim = get_char_room(ch, NULL, argument)) == NULL){
    send_to_char("They aren't here.\n\r",ch);
    return;
  }
  else if (is_safe(ch,victim))
    return;

  if (ch->mana < cost ){
    send_to_char("You cannot concentrate sufficiently.\n\r", ch);
    return;
  }
  else
    ch->mana -= cost;

  handle_skill_cost( ch, ch->pCabal, sn);

  /* all safe to go */
  WAIT_STATE2( ch, lag );

  if (number_percent() > skill){
    send_to_char("You failed to execute the form.\n\r", ch);
    check_improve(ch, sn, FALSE, 5);
    return;
  }
  else
    check_improve(ch, sn, TRUE, 1);

  act("$n executes the 'Maelstrom'.", ch, NULL, victim, TO_ROOM);
  send_to_char("You execute the 'Maelstrom'!\n\r", ch);

  if (ch->fighting != victim && victim->fighting != ch){
    sprintf(buf, "Help! %s is trying to chop me into bits!",PERS(ch,victim));
    j_yell(victim, buf);
  }
  a_yell(ch, victim );

  if ( (wield = get_eq_char( ch, WEAR_WIELD)) != NULL){
    dam_type = attack_table[wield->value[3]].damage;
  }
  for (i = 0; i < hits; i ++){
    int dam = number_range(ch->level / 3, 3 * ch->level / 4);
    
    /* occasionaly we try to disarm stuff */
    if (number_percent() < (skill - 75) || i == 2){
      if (get_eq_char(victim, WEAR_WIELD) != NULL)
	disarm( ch, victim );
      else if (get_eq_char(victim, WEAR_SHIELD) != NULL)
	shield_disarm( ch, victim );
      else if (get_eq_char(victim, WEAR_SECONDARY) != NULL)
	disarm_offhand(ch, victim );
    }
    damage( ch, victim, dam, sn, dam_type,  TRUE );
    if (victim->fighting == NULL)
      break;
  }
  /* attach the skill marker on the user for dblow */
  af.type	= sn;
  af.level	= ch->level;
  af.duration	= 3;
  af.where	= TO_NONE;
  af.bitvector	= 0;
  af.location	= APPLY_NONE;
  af.modifier	= 0;
  affect_to_char( ch, &af );

  /* check for cyclone refresh */
  if ( (paf = affect_find(ch->affected, gsn_cyclone)) != NULL)
    paf->duration = af.duration;
}

/* DEATHBLOW 
   NORMAL: no gsn_cyclone, and no gsn_maelstrom
   STRIP : gsn_maelstrom present
   SPLIT : gsn_cyclone present
   FULL  : both gsn_cyclone and gsn_maelstrom present
*/
void deathblow( CHAR_DATA* ch, CHAR_DATA* victim, int type, bool fMiss ){
  AFFECT_DATA af;
  OBJ_DATA* wield;
  int dam = 0, i= 0;
  int dam_type = DAM_SLASH;
  bool fStrip = FALSE;

  if (ch == NULL || victim == NULL)
    return;
  wield = get_eq_char( ch, WEAR_WIELD );

  switch( type ){
  default:
  case DB_NORMAL:
    send_to_char("You execute 'Power Strike'!\n\r", ch );
    act("$n executes 'Power Strike'!", ch, NULL, victim, TO_ROOM);
    if (fMiss)
      dam = 0;
    else{
      dam = get_wepdam( wield, ch, victim, gsn_deathblow, &dam_type );
      dam = 150 * dam / 100;
    }
    damage(ch, victim, dam, gsn_deathblow, dam_type, TRUE);
    WAIT_STATE2(ch, skill_table[gsn_deathblow].beats);
    break;
  case DB_SPLIT:
    send_to_char("You execute the 'Ground Splitter'!\n\r", ch );
    act("$n executes the 'Ground Splitter'!", ch, NULL, victim, TO_ROOM);
    if (fMiss)
      dam = 0;
    else{
      dam = get_wepdam( wield, ch, victim, gsn_deathblow, &dam_type );
      dam = 150 * dam / 100;
    }
    if (!is_affected(victim, gsn_deathblow)){
      af.type		= gsn_deathblow;
      af.level		= ch->level;
      af.duration	= 1;
      af.where		= TO_SKILL;
      af.bitvector	= 0;
      af.location	= skill_lookup("second attack");
      af.modifier	= -50;
      affect_to_char( victim, &af );
    }
    damage(ch, victim, dam, gsn_trophy, dam_type, TRUE);
    WAIT_STATE2(ch, skill_table[gsn_deathblow].beats / 2);
    break;
  case DB_STRIP:
    send_to_char("You execute the 'Flesh Stripper'!\n\r", ch );
    act("$n executes the 'Flesh Stripper'!", ch, NULL, victim, TO_ROOM);
    for ( i = 0; i < 4; i++){
      dam = get_wepdam( wield, ch, victim, wield->value[3], &dam_type );
      if (fMiss)
	dam = 15 * dam / 100;
      else
	dam = 40 * dam / 100;
      
      /* increases the rate of losing concentration */
      dam = damage(ch, victim, dam, wield->value[3] + TYPE_HIT, dam_type, TRUE);
      if (victim->fighting == NULL)
	break;
      if (dam > 1){
	AFFECT_DATA* paf;
	if  ( (paf = affect_find(victim->affected, gsn_mind_disrupt)) == NULL
	      || paf->modifier > -40){
	  af.type		= gsn_mind_disrupt;
	  af.level		= ch->level;
	  af.duration		= 1;
	  af.where		= TO_AFFECTS;
	  af.bitvector		= 0;
	  af.location		= APPLY_NONE;
	  af.modifier		= -10;
	  affect_join( victim, &af );
	  fStrip = TRUE;
	}
      }
    }
    if (fStrip)
      act("You've hampered $N's ability to concentrate on spells.", ch, NULL, victim, TO_CHAR);
    WAIT_STATE2(ch, skill_table[gsn_deathblow].beats / 2);
    break;
  case DB_FULL:
    send_to_char("You've delivered a Deathblow'!\n\r", ch );
    act("$n delivers a Deathblow!", ch, NULL, victim, TO_ROOM);
    if (fMiss)
      dam = 0;
    else{
      dam = get_wepdam( wield, ch, victim, gsn_deathblow, &dam_type );
      dam = 250 * dam / 100;
      if (dam > 450)
	dam = 450;
    }
    damage(ch, victim, dam, gsn_forms, dam_type, TRUE);
    WAIT_STATE2(ch, skill_table[gsn_deathblow].beats / 2);
    break;
  }
}
void do_deathblow(CHAR_DATA *ch, char *argument){
  CHAR_DATA *victim;
  AFFECT_DATA *paf;
  
  const int sn = gsn_deathblow;
  const int skill = get_skill(ch, sn );
  const int cost = skill_table[sn].min_mana;

  bool fMiss = FALSE;
  bool fMae = FALSE;
  bool fCyc = FALSE;

  if ( skill < 2){
    send_to_char("Huh?\n\r", ch);
    return;
  }
  else if ( (victim = ch->fighting) == NULL){
    send_to_char("But you aren't in combat!\n\r",ch);
    return;
  }
  else if (is_safe(ch,victim))
    return;

  if (ch->mana < cost ){
    send_to_char("You cannot concentrate sufficiently.\n\r", ch);
    return;
  }
  else
    ch->mana -= cost;

  handle_skill_cost( ch, ch->pCabal, sn);

  /* all safe to go */
//  (lag done in void deathblow)
  if (number_percent() > 9 * skill / 10)
    fMiss = TRUE;
  check_improve(ch, sn, TRUE, 5 );

  if ( (paf = affect_find(ch->affected, gsn_cyclone)) != NULL)
    fCyc = TRUE;
  if ( (paf = affect_find(ch->affected, gsn_maelstrom)) != NULL)
    fMae = TRUE;
       
  if (fMae && fCyc)
    deathblow(ch, victim, DB_FULL, fMiss );
  else if (fMae)
    deathblow(ch, victim, DB_STRIP, fMiss );
  else if (fCyc)
    deathblow(ch, victim, DB_SPLIT, fMiss );
  else
    deathblow(ch, victim, DB_NORMAL, fMiss );
}

void do_cognizance(CHAR_DATA *ch, char *argument)
{

    if (is_affected(ch,gsn_cognizance))
    {
        send_to_char("Your awareness is as sharp as it will get.\n\r",ch);
        return;
    }
    if (ch->mana < 50)
    {
        send_to_char("You cannot seem to focus enough.\n\r",ch);
	return;
    }
    WAIT_STATE( ch, skill_table[gsn_cognizance].beats );
    if (!IS_NPC(ch) && number_percent() < get_skill(ch,gsn_cognizance))
    {
        AFFECT_DATA af;
	af.where  = TO_AFFECTS;
        af.type   = gsn_cognizance;
        af.level  = ch->level;
        af.duration = ch->level;
        af.location = APPLY_NONE;
        af.modifier = 0;
        af.bitvector = AFF_DETECT_INVIS;
        affect_to_char(ch,&af);
        af.bitvector = AFF_DETECT_MAGIC;
	affect_to_char(ch,&af);
        ch->mana -= 50;
        act("You feel more alive as your awareness improves!",ch,NULL,NULL,TO_CHAR);
        act("$n looks more enlightened.",ch,NULL,NULL,TO_ROOM);
        check_improve(ch,gsn_cognizance,TRUE,3);
    }
    else
    {
        ch->mana -= 25;
        act("You look about sharply, but you don't see anything new.",ch,NULL,NULL,TO_CHAR);
        act("$n looks around sharply but doesn't seem enlightened.",ch,NULL,NULL,TO_ROOM);
        check_improve(ch,gsn_cognizance,FALSE,3);
    }
}

void do_stance(CHAR_DATA *ch, char *argument){
  CHAR_DATA* vch;
  int cost = skill_table[gsn_stance].min_mana;
  int lag = skill_table[gsn_stance].beats;
  int skill = get_skill(ch, gsn_stance );

  if (skill < 1){
    send_to_char("Huh?\n\r", ch);
    return;
  }
  if (is_affected(ch,gsn_stance)){
    check_dispel( -99, ch, gsn_stance);
    return;
  }

  if (ch->mana < cost){
    send_to_char("You cannot muster up the energy.\n\r",ch);
    return;
  }

  if (ch->class == class_lookup("monk")
      && !is_empowered_quiet(ch,0)
      && !is_empowered_quiet(ch,1)){
    send_to_char("You must be in either offensive, or defensive empowerment.\n\r", ch);
    return;
  }

  if ( (vch = get_group_room( ch, TRUE)) != NULL){
    act("$N gets in your way.", ch, NULL, vch, TO_CHAR);
    return;
  }

  if (ch->fighting)
    WAIT_STATE( ch, lag / 2 );
  else
    WAIT_STATE( ch, lag );

  if (number_percent() < get_skill(ch,gsn_stance)){
    AFFECT_DATA af;
    int monk_def = FALSE;	//0 = offense, 1 = defense;

    af.type   = gsn_stance;
    af.level  = ch->level;
    af.duration = number_range(3, 4);
    af.where = TO_AFFECTS;
    af.bitvector = 0;    

    if (ch->class == class_lookup("monk") && is_empowered_quiet(ch,1)){
      af.duration += 5;
      monk_def = TRUE;
    }
    
    /* add the effects */
    if (monk_def){
      af.location = APPLY_SAVING_SPELL;
      af.modifier = -1 * number_range(3, 6);
    }
    else{
      af.location = APPLY_DAMROLL;
      af.modifier = 1 + (skill - 75) / 6;
    }
    affect_to_char(ch,&af);
    if (monk_def){
      af.location = APPLY_HITROLL;
      af.modifier = 1 + (skill - 75) / 8;
    }
    else{
      af.location = APPLY_HITROLL;
      af.modifier = 1 + (skill - 75) / 6;
    }
    affect_to_char(ch,&af);

    ch->mana -= cost;
    /* subtract cp's */
    handle_skill_cost_percent( ch, ch->pCabal, gsn_stance, 100 );

    act("You drop into a combat stance.",ch,NULL,NULL,TO_CHAR);
    act("$n drops into a combat stance.",ch,NULL,NULL,TO_ROOM);
    check_improve(ch,gsn_stance,TRUE,3);
  }
  else{
    ch->mana -= cost / 2;
    /* subtract cp's */
    handle_skill_cost_percent( ch, ch->pCabal, gsn_stance, 50);
    act("Your fail to assume the correct stance.",ch,NULL,NULL,TO_CHAR);
    act("$n's tries to assume a combat stance, but fails.",ch,NULL,NULL,TO_ROOM);
    check_improve(ch,gsn_stance,FALSE,3);
  }
}

/* this is a sort of fake duplication of things in one_hit */
int get_wepdam( OBJ_DATA* wield, CHAR_DATA* ch, CHAR_DATA* vch, int dt, int* dam_t ){
  AFFECT_DATA* paf;
  int dam = GET_DAMROLL(ch);
  int diceroll, dam_type;
  

  if (wield)
    dam += dice(wield->value[1], wield->value[2]);
  else
    dam = dice(1 + (ch->level / 8), 6);

  if (dt < TYPE_HIT)
    {
/* check for control damage here, stored in paf->modifier */
      if (wield != NULL){
	dam_type = attack_table[wield->value[3]].damage;
      }
      else
	dam_type = attack_table[ch->dam_type].damage;
    }
  else{
    /* check for monk magical chii level 2 */
    if ( (paf = affect_find(ch->affected, gsn_chii_bolt)) != NULL
	 && paf->modifier == 2)
      dam_type = attack_table[attack_lookup("magic")].damage;
    else
      dam_type = attack_table[dt - TYPE_HIT].damage;
  }
  if (dam_type == -1)
    dam_type = DAM_BASH;
  
//ENHANCED DAMAGE
  if ( get_skill(ch, gsn_enhanced_damage) > 0 && !vamp_check(ch)){
    diceroll = number_percent();
    diceroll -= 2*(get_curr_stat(ch,STAT_LUCK) - 16);
    if (diceroll <= get_skill(ch,gsn_enhanced_damage)){
      check_improve(ch,gsn_enhanced_damage,TRUE,0);
      dam += (dam * URANGE(20,diceroll,80)) /100;
	    
      /* Extra race bonus */
      if (ch->race == race_lookup("ogre") )
	dam += (dam * URANGE(0,diceroll,20)) /100;
      else if ( ch->race == race_lookup("fire") && wield 
		&& (dam_type == DAM_FIRE || !str_cmp("fire", wield->material)) )
	dam += (dam * URANGE(0,diceroll,25)) /100;
    }
  }    
//DOUBLE GRIP /2handed (not staffs )
  if  (is_affected(ch,gsn_double_grip) 
       && get_skill(ch,gsn_double_grip) > 0)
    {
      diceroll = number_percent();
      diceroll -= (get_curr_stat(ch,STAT_LUCK) - 16);
      if (diceroll <= get_skill(ch,gsn_double_grip)){
	dam += (dam * number_range(15, 30)) /100;
	check_improve(ch, gsn_double_grip, TRUE, 1);
      }
    }
  else if ( wield 
	    && (IS_WEAPON_STAT(wield, WEAPON_TWO_HANDS) || is_affected(ch, gsn_double_grip))
	    && wield->value[0] != WEAPON_STAFF)
    dam += (dam * number_range(5, 15)) /100;
  
    
  //ANATOMY 
  dam += dam * check_anatomy(ch, vch) / 100;            

  *dam_t = dam_type;
  return dam;
}
    
/* FORM FUNCTIONS USED IN DO_FORMS */
void form_sword( OBJ_DATA* obj, CHAR_DATA* ch, CHAR_DATA* vch, bool fAutoFail){
  int dam;
  int dt = obj ? obj->value[3] : gsn_martial_arts_a;
  int dam_type;

  if (obj == NULL)
    return;
  else if (fAutoFail)
    dam = 0;
  else{
    dam = get_wepdam( obj, ch, vch, dt + TYPE_HIT, &dam_type);
    dam = 130 * dam / 100;
//    sendf(ch, "dam: %d\n\r", dam);
  }
  damage(ch, vch, dam, dt + TYPE_NOBLOCKHIT, dam_type, TRUE );
}

void form_mace( OBJ_DATA* obj, CHAR_DATA* ch, CHAR_DATA* vch, bool fAutoFail){
  CHAR_DATA* wch, *wch_next;
  int dam;
  int dt = obj ? obj->value[3] : gsn_martial_arts_a;
  int dam_type;

  if (obj == NULL)
    return;
  else if (fAutoFail)
    dam = 0;

  for (wch = vch->in_room->people; wch; wch = wch_next ){
    wch_next = wch->next_in_room;
    if ((!is_same_group(wch, vch) || is_area_safe_quiet(ch, wch))
	&& (wch->fighting == NULL || !is_same_group(wch->fighting, ch))
	)
      continue;
    if (!fAutoFail){
      dam = get_wepdam( obj, ch, wch, dt + TYPE_NOBLOCKHIT, &dam_type);
      if (!IS_NPC(wch) 
	  && get_lagprot( wch ) == LAG_SHIELD_NONE
	  && !saves_spell( ch->level, wch, DAM_BASH, SPELL_AFFLICTIVE )){
	send_to_char("You've been stunned by the shockwave!\n\r", wch);
	act("$N is stunned by the shockwave.", ch, NULL, wch, TO_CHAR);
	WAIT_STATE2(wch, 2 * PULSE_VIOLENCE);
      }
    }
    else
      dam = 0;
    damage(ch, wch, dam, dt + TYPE_NOBLOCKHIT, dam_type, TRUE );
  }
  return;
}
void form_dagger( OBJ_DATA* obj, CHAR_DATA* ch, CHAR_DATA* vch, bool fAutoFail){
  OBJ_DATA* wield;
  int dam;
  int dt = obj ? obj->value[3] : gsn_martial_arts_a;
  int dam_type;

  if (obj == NULL)
    return;
  else if (fAutoFail)
    dam = 0;
  else{
    int ful_dam = get_wepdam( obj, ch, vch, dt + TYPE_HIT, &dam_type);
    
    //first hit
    dam = 10 * ful_dam / 100;
    damage(ch, vch, dam, dt + TYPE_NOBLOCKHIT, dam_type, TRUE );
    if (ch->fighting == NULL)
      return;
    //second hit
    dam = 20 * ful_dam / 100;
    damage(ch, vch, dam, dt + TYPE_NOBLOCKHIT, dam_type, TRUE );
    if (ch->fighting == NULL)
      return;
    //disarm
    switch(number_range(0, 5)){
    case 0:
    case 1:
      if ( (wield = get_eq_char( vch, WEAR_WIELD )) != NULL)
	disarm(ch, vch);
      break;
    case 2:
    case 3:
      if ( (wield = get_eq_char( vch, WEAR_SECONDARY )) != NULL )
	disarm_offhand(ch, vch);
      break;
    default:
      if ( (wield = get_eq_char( vch, WEAR_SHIELD )) != NULL )
	shield_disarm(ch, vch);
      break;
    }
    if (ch->fighting == NULL)
      return;
    //third
    dam = 30 * ful_dam / 100;
    damage(ch, vch, dam, dt + TYPE_NOBLOCKHIT, dam_type, TRUE );
    if (ch->fighting == NULL)
      return;
    //kick
    kick(ch, vch, number_range(50, 100));
    //fourth
    dam = 40 * ful_dam / 100;
    damage(ch, vch, dam, dt + TYPE_NOBLOCKHIT, dam_type, TRUE );
    if (ch->fighting == NULL)
      return;
    if (vch->mana > 0){
      send_to_char("Dazed by the attacks you lose some mana.\n\r", vch);
      act("Dazed by the attacks, $n loses some mana.", vch, NULL,NULL, TO_ROOM);
    }
    vch->mana -= number_range(35, 70);
    if (vch->mana < 0)
      vch->mana = 0;
  }
}

void form_axe( OBJ_DATA* obj, CHAR_DATA* ch, CHAR_DATA* vch, bool fAutoFail){
  AFFECT_DATA af, *paf;
  int dam;
  int dt = obj ? obj->value[3] : gsn_martial_arts_a;
  int dam_type;

  if (obj == NULL)
    return;
  else if (fAutoFail)
    dam = 0;
  else{
    dam = get_wepdam( obj, ch, vch, dt, &dam_type);
    dam = 75 * dam / 100;
  }

  if ( (paf = affect_find(vch->affected, gsn_scourge)) == NULL
       || paf->modifier < 150){
    af.type	= gsn_scourge;
    af.level	= ch->level;
    af.duration	= number_range(2, 4);
    
    af.where	= TO_AFFECTS;
    af.bitvector= 0;
    af.location	= APPLY_AC;
    af.modifier	= number_range(10, 25);
    affect_join(vch, &af);
  }
  dt = gsn_apierce;
  damage(ch, vch, dam, dt, dam_type, TRUE );
}

void form_staff( OBJ_DATA* obj, CHAR_DATA* ch, CHAR_DATA* vch, bool fAutoFail ){
  int dam;
  int dt = obj ? obj->value[3] : gsn_martial_arts_a;
  int dam_type;
  int hits = 0;		//twohits make for poison/paralyze on second

  if (obj == NULL)
    return;
  else if (fAutoFail)
    dam = 0;
  else{
    dam = get_wepdam( obj, ch, vch, dt, &dam_type);
    dam = 40 * dam / 100;
  }
  if( damage(ch, vch, dam, dt + TYPE_HIT, dam_type, TRUE ) > 0)
    hits ++;
  if (ch->fighting == NULL)
    return;

  if (fAutoFail)
    dam = 0;
  else{
    dam = get_wepdam( obj, ch, vch, dt, &dam_type);
    dam = 40 * dam / 100;
  }
  if( damage(ch, vch, dam, dt + TYPE_HIT, dam_type, TRUE ) > 0)
    hits ++;

  if (hits > 0)
    spell_poison(skill_lookup("poison"), ch->level - 3, ch, vch, TARGET_CHAR);
  if (hits > 1){
    paralyze_effect(vch, ch->level - 3,  dam,  TARGET_CHAR);
  }
}

void form_spear( OBJ_DATA* obj, CHAR_DATA* ch, CHAR_DATA* vch, int chance ){
  int dam;
  int dt = obj ? obj->value[3] : gsn_martial_arts_a;
  int dam_type;
  int attacks = 3 + (get_curr_stat(ch,STAT_LUCK) - 12) / 5;
  int hits = 0, i;
  int total = 0; //(debug)
  if (obj == NULL)
    return;
  for (i = 0; i  < attacks; i++){
    if (number_percent() > chance)
      dam = 0;
    else{
      dam = get_wepdam( obj, ch, vch, dt, &dam_type);
      dam = (5 + 13 * hits) * dam / 100;
      total+= dam;
    }

    if (damage(ch, vch, dam, dt + TYPE_HIT, dam_type, TRUE ) > 1){
      if (ch->fighting == NULL)
	break;
      if (hits < 4)
	hits++;
      if (hits >= 3 && !IS_AFFECTED(vch, AFF_BLIND))
	spell_blindness( gsn_blindness, ch->level - 3, ch, vch, 0);
    }
    if (ch->fighting == NULL)
      break;
  }
//  sendf(ch, "total:%d\n\r", total);
}

void form_flail( OBJ_DATA* obj, CHAR_DATA* ch, CHAR_DATA* vch, bool fAutoFail){
  int dam;
  int dt = attack_lookup("smash");
  int dam_type;

  if (obj == NULL)
    return;
  else if (fAutoFail)
    dam = 0;
  else{
    dam = get_wepdam( obj, ch, vch, dt, &dam_type);
    dam = 115 * dam / 100;
  }
  dam = damage(ch, vch, dam,  dt + TYPE_HIT, dam_type, TRUE );  
  if (ch->fighting && dam && !IS_AFFECTED(vch, AFF_CURSE))
    spell_curse( gsn_curse, ch->level - 3, ch, vch, TARGET_CHAR);

}

void form_pole( OBJ_DATA* obj, CHAR_DATA* ch, CHAR_DATA* vch, bool fAutoFail){
  int dam;
  int dt = obj ? obj->value[3] : gsn_martial_arts_a;
  int dam_type;

  if (obj == NULL)
    return;
  else if (fAutoFail)
    dam = 0;
  else{
    dam = get_wepdam( obj, ch, vch, dt + TYPE_HIT, &dam_type);
    dam = 175 * dam / 100;
  }
  damage(ch, vch, dam, dt + TYPE_HIT, dam_type, TRUE );
}

void form_whip( OBJ_DATA* obj, CHAR_DATA* ch, CHAR_DATA* vch, bool fAutoFail){
  AFFECT_DATA af;
  int dam;
  int dt = obj ? obj->value[3] : gsn_martial_arts_a;
  int dam_type;

  if (obj == NULL)
    return;
  else if (fAutoFail)
    dam = 0;
  else{
    dam = get_wepdam( obj, ch, vch, dt, &dam_type);
  }

  if (damage(ch, vch, dam, dt + TYPE_HIT, dam_type, TRUE ) > 1){
    if (ch->fighting == NULL)
      return;

    if (is_affected(ch, gsn_forms) && number_percent() < 50)
      return;
    if (number_percent() < 50)
      return;
    act("Your weapon has been pulled aside!", ch, NULL, vch, TO_VICT);
    act("$n's weapon has been pulled aside!", vch, NULL, NULL,TO_ROOM);

    af.type		= gsn_rake;
    af.level		= ch->level;
    af.duration		= 1;
    af.where		= TO_AFFECTS;
    af.bitvector	= 0;
    af.location		= APPLY_NONE;
    af.modifier		= 1;

    affect_to_char(vch ,&af);
  }
}

void form_exotic(OBJ_DATA* obj, CHAR_DATA* ch, CHAR_DATA* vch, bool fAutoFail){
  AFFECT_DATA af, *paf;
  int dam;
  int dt = obj ? obj->value[3] : gsn_martial_arts_a;
  int dam_type;

  if (obj == NULL)
    return;
  else if (fAutoFail)
    dam = 0;
  else{
    dam = 50 * get_wepdam( obj, ch, vch, dt, &dam_type) / 100;
  }

  if (damage(ch, vch, dam, dt + TYPE_HIT, DAM_INTERNAL, TRUE ) > 1){
    if (ch->fighting == NULL)
      return;

    if (number_percent() < 50)
      return;

    if ( (paf = affect_find(vch->affected, gen_bleed)) == NULL){
      af.type = gen_bleed;
      af.level = ch->level;
      af.duration = number_range(2, 3);
      af.where = TO_NONE;
      af.bitvector = 0;
      af.location = APPLY_NONE;
      /* modifier controls duration of damage (10/tick)*/
      af.modifier = number_range(8, 15);
      paf = affect_to_char(vch, &af);
      string_to_affect(paf, ch->name);	
      act("A spray of blood shoots forth from $n's belly!", vch, NULL, NULL, TO_ROOM);
      act("A spray of blood shoots forth from your stomach!", vch, NULL, NULL, TO_CHAR);
    }
    else{
      act("You send some more blood flying from $n's wound!", vch, NULL, NULL, TO_ROOM);
      /* modifier controls duration of damage (10/tick)*/
      paf->modifier = number_range(10, 25);
      string_to_affect(paf, ch->name);	
    }
  }    
}

void form_hth( OBJ_DATA* obj, CHAR_DATA* ch, CHAR_DATA* vch, bool fAutoFail){
  AFFECT_DATA af;

  if (fAutoFail){
    send_to_char("You've failed to achive the proper focus.\n\r", ch);
    return;
  }

  if (!is_affected(ch, gsn_enhanced_damage)){
    af.type	= gsn_enhanced_damage;
    af.level	= ch->level;
    af.duration	= 0;
    
    af.where	= TO_AFFECTS;
    af.bitvector= 0;
    af.location	= APPLY_NONE;
    af.modifier	= 0;
    affect_join(ch, &af);
    act("You begin to bypass $N's inherited resistances.", ch, NULL, vch, TO_CHAR);
  }
}
void form_hth2( OBJ_DATA* obj, CHAR_DATA* ch, CHAR_DATA* vch, bool fAutoFail){
  AFFECT_DATA af;
  int sn = gsn_invigorate;

  if (fAutoFail){
    send_to_char("You've failed to achive the proper focus.\n\r", ch);
    return;
  }
  if (!is_affected(ch, sn)){
    af.type	= gsn_invigorate;
    af.level	= ch->level;
    af.duration	= 0;
    
    af.where	= TO_AFFECTS;
    af.bitvector= 0;
    af.location	= APPLY_NONE;
    af.modifier	= 0;
    affect_join(ch, &af);
    act("Your chakera strikes magnify in power.", ch, NULL, vch, TO_CHAR);
  }
}


/* used above and for automatic forms */
bool forms(CHAR_DATA *ch, char *argument, AFFECT_DATA* paf){
  CHAR_DATA* vch;
  OBJ_DATA* wield;

  int skill = get_skill(ch, gsn_forms );

  int wep_type = -1;	//-1 means hth
  int chance;
  bool fAdv = get_skill(ch, skill_lookup("form mastery")) > 2;
  bool fAutoFail = FALSE;

  if (skill < 1){
    if (!paf)
      send_to_char("Huh?\n\r", ch);
    return FALSE;
  }

  /* get type of form we are doing */
  if (fAdv && !IS_NULLSTR(argument)){
    wield = get_eq_char(ch, WEAR_SECONDARY);
  }
  else
    wield = get_eq_char(ch, WEAR_WIELD);
  
  if (wield)
    wep_type = wield->value[0];
  
  if (ch->fighting == NULL){
    if (!paf)
      send_to_char("But you're not fighting!\n\r", ch);
    return FALSE;
  }
  else if ( (vch = get_group_room( ch, TRUE)) != NULL){
    if (!paf)
      act("$N gets in your way.", ch, NULL, vch, TO_CHAR);
    return FALSE;
  }
  else if (wep_type == -1 && ch->class != class_lookup("monk")){
    if (!paf)
      send_to_char("You lack the perfection of technique to attempt this form.\n\r", ch);
    return FALSE;
  }
  else if (get_weapon_skill_obj(ch, wield) < 100){
    if (!paf)
      sendf(ch, "You must be a master of %ss before attempting this form.\n\r", 
	  wield ? weapon_name(wep_type) : "fist");
    return FALSE;
  }
  vch = ch->fighting;

  chance = 4 * skill / 5;
  chance += (get_curr_stat(ch, STAT_DEX) - 20) * 3;

  if (vch){
    chance += (ch->level - vch->level) * 3;
    chance += affect_by_size(ch, vch) * 2;
    chance += (get_curr_stat(ch,STAT_LUCK) - get_curr_stat(vch,STAT_LUCK))* 2;
  }

  if (number_percent() > chance)
    fAutoFail = TRUE;
  

  /* begin doing the forms */
  switch (wep_type){
/* SWORD */
  case WEAPON_SWORD:
    send_to_char("You execute the 'Rising Sun'.\n\r", ch);
    act("$n executes the 'Rising Sun'.", ch, NULL, vch, TO_ROOM);
    form_sword(wield, ch, vch, fAutoFail );
    break;
/* MACE */
  case WEAPON_MACE:
    send_to_char("You execute the 'Armaggedon Smash'.\n\r", ch);
    act("$n executes the 'Armaggedon Smash'.", ch, NULL, vch, TO_ROOM);
    form_mace(wield, ch, vch, fAutoFail );
    break;
/* DAGGER */
  case WEAPON_DAGGER:
    send_to_char("You execute 'Steel Storm'.\n\r", ch);
    act("$n executes 'Steel Storm'.", ch, NULL, vch, TO_ROOM);
    form_dagger(wield, ch, vch, fAutoFail );
    break;
/* AXE */
  case WEAPON_AXE:
    send_to_char("You execute the 'Troll Scourge'.\n\r", ch);
    act("$n executes the 'Troll Scourge'.", ch, NULL, vch, TO_ROOM);
    form_axe(wield, ch, vch, fAutoFail );
    break;
/* STAFF */
  case WEAPON_STAFF:
    send_to_char("You execute the 'Twin Cobra'.\n\r", ch);
    act("$n executes the 'Twin Cobra'.", ch, NULL, vch, TO_ROOM);
    form_staff(wield, ch, vch, fAutoFail );
    break;
/* SPEAR */
  case WEAPON_SPEAR:
    send_to_char("You execute the 'Raven Swarm'.\n\r", ch);
    act("$n executes the 'Raven Swarm'.", ch, NULL, vch, TO_ROOM);
    form_spear(wield, ch, vch, chance );
    break;
/* FLAIL */
  case WEAPON_FLAIL:
    act("You execute the '$g's Hand'.", ch, NULL, NULL, TO_CHAR);
    act("$n executes the '$g's Hand'.", ch, NULL, vch, TO_ROOM);
    form_flail(wield, ch, vch, fAutoFail );
    break;
/* WHIP */
  case WEAPON_WHIP:
    send_to_char("You execute 'The Karakken'.\n\r", ch);
    act("$n executes 'The Karakken'.", ch, NULL, vch, TO_ROOM);
    form_whip(wield, ch, vch, fAutoFail );
    break;
/* POLE */
  case WEAPON_POLEARM:
    send_to_char("You execute the 'Dragon Tail'.\n\r", ch);
    act("$n executes the 'Dragon Tail'.", ch, NULL, vch, TO_ROOM);
    form_pole(wield, ch, vch, fAutoFail );
    break;
/* EXO */
  case WEAPON_EXOTIC:
    send_to_char("You execute the 'Bowel Raker'.\n\r", ch);
    act("$n executes the 'Bowel Raker'.", ch, NULL, vch, TO_ROOM);
    form_exotic(wield, ch, vch, fAutoFail );
    break;
/* HTH */
  default:
    if (fAdv && !IS_NULLSTR(argument)){
      send_to_char("You execute the 'Atemi Strike'.\n\r", ch);
      act("$n executes the 'Atemi Strike'.", ch, NULL, vch, TO_ROOM);
      form_hth(wield, ch, vch, fAutoFail );
    }
    else{
      send_to_char("You execute the 'Eagle Eye'.\n\r", ch);
      act("$n executes the 'Eagle Eye'.", ch, NULL, vch, TO_ROOM);
      form_hth2(wield, ch, vch, fAutoFail );
    }
    break;
  }
  return TRUE;
}

/* GLADIATOR FORMS */
void do_forms(CHAR_DATA *ch, char *argument){
  AFFECT_DATA af, *paf;
  int cost = skill_table[gsn_forms].min_mana;
  int lag = skill_table[gsn_forms].beats;
  int skill = get_skill(ch, gsn_forms );
  
  if (skill < 1){
    send_to_char("Huh?\n\r", ch);
    return ;
  }
  else if (ch->fighting == NULL){
    send_to_char("But you're not fighting!\n\r", ch);
    return;
  }
  else if (ch->mana < cost){
    send_to_char("You cannot muster up the energy.\n\r",ch);
    return;
  }
  else
    ch->mana -= cost;

  handle_skill_cost_percent( ch, ch->pCabal, gsn_forms, 100);
  WAIT_STATE2(ch, lag );

  affect_strip(ch, gsn_forms);
  if (!forms(ch, argument, NULL ))
    return;

  af.type = gsn_forms;
  af.level = ch->level;
  af.duration = number_range(0, 1);
  af.location = TO_AFFECTS;
  af.bitvector = 0;
  af.location = APPLY_NONE;
  af.modifier = 0;
  paf = affect_to_char( ch, &af );
  string_to_affect( paf, argument );
}

/* ***** JUSTICE POWERS ***** */


void spell_raise_morale( int sn, int level, CHAR_DATA *ch, void *vo, int target ){
  CHAR_DATA* victim = (CHAR_DATA*) vo;
  AFFECT_DATA af;

  if (is_affected(victim, sn )){
    send_to_char("You are already raising morale of your Justice troops!\n\r", ch);
    return;
  }

  send_to_char("You begin to activly raise morale of your Justice troops.\n\r", ch);
  
  af.type	= sn;
  af.level	= level;
  af.duration	= 24;
  af.where	= TO_AFFECTS;
  af.bitvector	= 0;
  
  af.location	= APPLY_HITROLL;
  af.modifier	= number_fuzzy(level / 7);
  affect_to_char( victim, &af);

  af.location	= APPLY_DAMROLL;
  af.modifier	= number_fuzzy(level / 8);
  affect_to_char( victim, &af);

  af.location	= APPLY_MOVE_GAIN;
  af.modifier	= UMAX(0, 20 + (level - 30) * 2);
  affect_to_char( victim, &af);
}

void do_judge(CHAR_DATA *ch, char *argument){
  char arg[MIL];
  CHAR_DATA *victim;
  int counter;
  int max_pen;
  one_argument(argument, arg);
  if (get_skill(ch,skill_lookup("judge")) == 0)
    {
      send_to_char("Huh?\n\r",ch);
      return;
    }
  if ( arg[0] == '\0' )
    {
      send_to_char("Judge whom?\n\r", ch);
      return;
    }
  if ( ( victim = get_char_room( ch, NULL, arg ) ) == NULL )
    {
        send_to_char( "They aren't here.\n\r", ch );
        return;
    }
  if (IS_NPC(victim))
    {
      send_to_char("Mobs don't care for the laws sentients set down.\n\r", ch);
        return;
    }
/* subtract cp's */
  handle_skill_cost( ch, ch->pCabal, gsn_judge );

  if ( victim->pcdata->ethos == CH_ETHOS_LAWFUL)
    sendf(ch,"%s upholds the law.\n\r",victim->name);
  else if ( victim->pcdata->ethos == CH_ETHOS_NEUTRAL)
    sendf(ch,"%s is ambivalent to the law.\n\r",victim->name);
  else if ( victim->pcdata->ethos == CH_ETHOS_CHAOTIC)
    sendf(ch,"%s does not believe in laws.\n\r",victim->name);
  else
    send_to_char("There's something wrong.  Notify an immortal.\n\r", ch);
  counter = victim->pcdata->flagged;
  if (counter == 0)
    sendf(ch,"%s is a model citizen.\n\r",victim->name);
  else if (counter < 3)
    sendf(ch,"%s does a good job observing the laws.\n\r",victim->name);
  else if (counter < 5)
    sendf(ch,"%s has had %s share of brush-ins with the law.\n\r",victim->name, (victim->sex == 2) ? "her" : "his");
  else if (counter < 10)
    sendf(ch,"%s is a common criminal.\n\r",victim->name);
  else
    sendf(ch,"%s is a die-hard criminal.\n\r",victim->name);

  max_pen = show_crimes( ch, victim, TRUE, FALSE );
  switch ( max_pen ){
  case CRIME_LIGHT:
    send_to_char( "The penalties allowed under the law are: Normal, Bail.\n\r", ch );	break;
  case CRIME_NORMAL:
    send_to_char( "The penalties allowed under the law are: Normal, Bail, Extended.\n\r", ch );	break;
  case CRIME_HEAVY:
    send_to_char( "The penalties allowed under the law are: Normal, Bail, Extended, Death\n\r", ch ); break;
  case CRIME_DEATH:
    send_to_char( "The penalties allowed under the law are: Death\n\r", ch ); break;
  }
}

void do_wanted( CHAR_DATA *ch, char *argument ){

  char arg1[MIL], arg2[MIL],buf[MSL];
  CHAR_DATA *victim;
  argument = one_argument( argument, arg1 );
  argument = one_argument( argument, arg2 );

  if (get_skill(ch,skill_lookup("wanted")) < 2){
    send_to_char("Huh?\n\r", ch );
    return;
  }
  if ( arg1[0] == '\0' || arg2[0] == '\0' ){
    send_to_char( "Syntax: wanted <character> <y/n>.\n\r", ch );
    return;
  }
  if ( ( victim = get_char( arg1 ) ) == NULL ){
    send_to_char( "They aren't here.\n\r", ch );
    return;
  }
  if (victim->level >= LEVEL_IMMORTAL && (ch->level < victim->level)){
    sendf(ch, "You do not have the power to arrest %s.\n\r", PERS2(victim));
    return;
  }
  if ( IS_NPC(victim) ){
    send_to_char( "You cannot arrest mobs!.n\r", ch );
    return;
  }
  if (ch == victim){
    send_to_char("You cannot do that.\n\r", ch);
    return;
  }
  if (is_affected(victim, gen_jail) || 
      (IS_SET(victim->in_room->room_flags2, ROOM_JAILCELL)
       && jail_check(victim->in_room)) ){
    send_to_char("Not on prisoners.\n\r", ch);
    return;
  }
  if ( !str_cmp( arg2, "y" ) ){
    AFFECT_DATA* paf;
    AREA_DATA* pArea;
    bool fFound = FALSE;
      
    /* check if the victim is fighting a JUSTICE mob in lawful area */
    if (victim->fighting
	&& IS_NPC(victim->fighting) && victim->fighting->pCabal 
	&& IS_CABAL(victim->fighting->pCabal, CABAL_JUSTICE) 
	&& IS_AREA(ch->in_room->area, AREA_LAWFUL)){
      AFFECT_DATA af;
      set_crime(victim, victim->fighting,  ch->in_room->area, CRIME_OBSTRUCT);
      af.type		= gsn_timer;
      af.level		= 60;
      af.duration	= 1;
      af.where		= TO_NONE;
      af.bitvector	= 0;
      af.location	= APPLY_NONE;
      af.modifier	= 0;
      affect_to_char(victim, &af );
    }

/* check if there are any crimes to flag for, if there are, move crimes from level to bitvector */
    for (paf = victim->affected; paf; paf = paf->next ){
      if (paf->type == gsn_wanted && paf->modifier){
	paf->bitvector |= paf->modifier;
	paf->modifier = 0;
	fFound = TRUE;
	/* crime found/wanted we increase the relations but need area first */
	if ( (pArea = get_area_data( paf->location )) == NULL){
	  bug("do_wanted: could not get area for vnum %d.", paf->location);
	  continue;
	}
	else if (pArea->pCabal)
	  affect_justice_relations(pArea->pCabal, 2);
      }
    }
/* subtract cp's */
    handle_skill_cost( ch, ch->pCabal, gsn_wanted );
    
/* check if the wanted command was deserved */
    if (!fFound){
/* Penalty for wrongful accusation */
      char buf[MIL];
/* safety for multiple justices flagging at same time */
      if (is_affected(victim, gsn_timer)){
	send_to_char("This person has been recently marked wanted.\n\r", ch);
	return;
      }
      sprintf( buf, "%s has attempted to mark %s WANTED without due evidence!", PERS2(ch), PERS2(victim));
      cabal_echo_flag( CABAL_JUSTICE, buf );
      cp_event(ch, victim, NULL, CP_EVENT_WANTED_FALSE );
      /* if person is out of cps we demote them */
      if (GET_CP( ch ) < 1){
	if ( ch->pcdata->rank > RANK_NEWBIE ){
	  CABAL_DATA* pParent = get_parent( ch->pCabal );
	  char sub[MIL];
	  sprintf( buf, "Due to lack of care when considering evidence of crimes, %s has been demoted.", PERS2(ch) );
	  cabal_echo( ch->pCabal, buf );
	  strcat( buf, "\n\r");
	  sprintf( sub, "%s's demotion.", PERS2(ch));
	  do_hal( pParent->name, sub, buf, NOTE_NEWS );
	  promote( ch, ch->pCabal, -1 );
	  if (ch->pcdata->member)
	    ch->pcdata->member->time_stamp = mud_data.current_time;
	}
	return;
      }
    }
    else if ( !IS_SET(victim->act, PLR_WANTED) ){
      AFFECT_DATA af;
      SET_BIT( victim->act, PLR_WANTED );
      victim->pcdata->flagged ++;
      sendf(ch, "%s is now a criminal.\n\r", PERS2(victim) );
      send_to_char( "You are now WANTED!\n\r", victim);
      sprintf(buf,"NOTICE: %s has been marked a criminal by %s.",victim->name, ch->name);
      cabal_echo_flag( CABAL_JUSTICE, buf );
      cp_event(ch, victim, NULL, CP_EVENT_WANTED );

      af.type		= gsn_timer;
      af.level		= 60;
      af.duration	= 1;
      af.where		= TO_NONE;
      af.bitvector	= 0;
      af.location	= APPLY_NONE;
      af.modifier	= 0;
      affect_to_char(victim, &af );
      return;
    }
    else{
      if (is_affected(victim, gsn_timer)){
	send_to_char("This person has been recently marked wanted.\n\r", ch);
	return;
      }
      sendf(ch, "You record %s's new offense against the Law.\n\r", PERS2(victim) );
      sendf(victim, "%s has marked you for another transgression against the Law!\n\r", PERS2(ch));
      victim->pcdata->flagged++;
      sprintf(buf,"NOTICE: %s has been marked for another offense by %s.",victim->name, ch->name);
      cabal_echo_flag( CABAL_JUSTICE, buf );
    }
    return;
  }
  if ( !str_cmp( arg2, "n" ) ){
    if (IS_OUTLAW(victim)){
      send_to_char("Not on outlaws.\n\r", ch);
      return;
    }
    if ( IS_SET(victim->act, PLR_WANTED) ){
      REMOVE_BIT( victim->act, PLR_WANTED );
      victim->pcdata->flagged -= 1;
      sendf(ch, "%s is no longer a criminal.\n\r", PERS2(victim) );
      send_to_char( "You are no longer WANTED!\n\r", victim );
      sprintf(buf,"NOTICE: %s has been removed as a criminal by %s.",victim->name, ch->name);
      cabal_echo_flag( CABAL_JUSTICE, buf );
      affect_strip( victim, gsn_wanted );
    }
    else
      sendf(ch, "%s isn't a criminal.\n\r", PERS2(victim));
    return;
  }
  send_to_char( "Syntax: wanted <character> <y/n>.\n\r", ch );
}

/* grants detect invis */
void spell_third_eye( int sn, int level, CHAR_DATA *ch, void *vo, int target ){
    CHAR_DATA *victim = (CHAR_DATA *) vo;
    AFFECT_DATA af;
    if ( IS_AFFECTED(victim, AFF_DETECT_INVIS) )
    {
        if (victim == ch)
            act("You can already see invisible objects.",ch,NULL,victim,TO_CHAR);
        else
            act("$N can already see invisible things.",ch,NULL,victim,TO_CHAR);
        return;
    }
    af.where     = TO_AFFECTS;
    af.type      = sn;
    af.level     = level;
    af.duration  = level / 2;
    af.modifier  = 0;
    af.location  = APPLY_NONE;
    af.bitvector = AFF_DETECT_INVIS;
    affect_to_char( victim, &af );
    act_new( "You become very sensitive to things unseen.", ch,NULL,victim,TO_CHARVICT,POS_DEAD );
    if ( ch != victim )
      act("$N becomes very sensitive to things unseen.",ch,NULL,victim,TO_CHAR);
}

/* builds a justice watchtower */
void do_watchtower( CHAR_DATA *ch, char *argument ){
  AFFECT_DATA af;
  int sn = skill_lookup("watchtower");
  int cost = skill_table[sn].min_mana;
  int lag = skill_table[sn].beats;

  if (get_skill(ch, sn) < 2){
    send_to_char("Huh?\n\r", ch );
    return;
  }
  else if (!ch->in_room || !IS_AREA(ch->in_room->area, AREA_LAWFUL)){
    send_to_char("You may only order construction of watchtowers in lawful areas.\n\r", ch);
    return;
  }
  else if (!IS_OUTSIDE(ch)){
    send_to_char("You cannot build a watchtower indoors!\n\r", ch);
    return;
  }
  else if (IS_AFFECTED2(ch, AFF_SILENCE)){
    send_to_char("As you try to give the order, no sound comes out!\n\r",ch);
    return;
  }
  if (is_affected(ch, gsn_gag)){
    send_to_char("You try to work your mouth but the gag holds fast.\n\r", ch);
    return;
  }
  if (is_affected(ch,gsn_uppercut)){
    send_to_char("Your jaws hurts too much to move.\n\r",ch);
    return;
  }
  else if (ch->mana < cost){
    send_to_char("You are too tired to order your guards about effectivly.\n\r", ch );
    return;
  }
  else
    ch->mana -= cost;

  WAIT_STATE2( ch, lag );
    
/* subtract cp's */
  handle_skill_cost( ch, ch->pCabal, sn );

/* start the gen */
  af.type	= gen_watchtower;
  af.level	= ch->level;
  af.duration	= -1;
  
  af.where	= TO_AFFECTS;
  af.bitvector	= AFF_SANCTUARY;
  af.location	= APPLY_NONE;
  af.modifier	= 0;

  affect_to_char(ch, &af );

}

/* rallies justice troops in a city */
void do_rally_justice( CHAR_DATA *ch, char *argument ){
  char * const his_her [] = { "its", "his", "her" };
  AFFECT_DATA af;
  char buf[MIL];
  int sn = skill_lookup("rally call");
  int cost = skill_table[sn].min_mana;
  int lag = skill_table[sn].beats;

  if (get_skill(ch, sn) < 2){
    send_to_char("Huh?\n\r", ch );
    return;
  }
  else if (!ch->in_room || !IS_AREA(ch->in_room->area, AREA_LAWFUL)){
    send_to_char("You may only rally Justice troops in lawful areas.\n\r", ch);
    return;
  }
  else if (IS_AFFECTED2(ch, AFF_SILENCE)){
    send_to_char("As you let forth a mighty call, no sound comes out!\n\r",ch);
    return;
  }
  else if (is_affected(ch, gsn_gag)){
    send_to_char("You try to work your mouth but the gag holds fast.\n\r", ch);
    return;
  }
  else if (is_affected(ch,gsn_uppercut)){
    send_to_char("Your jaws hurts too much to move.\n\r",ch);
    return;
  }
  else if (is_affected(ch, sn )){
    send_to_char("You are not yet ready to rally your troops again.\n\r",ch );
    return;
  }
  else if (ch->mana < cost){
    send_to_char("You are too tired to rally your troops.\n\r", ch );
    return;
  }
  else
    ch->mana -= cost;

  WAIT_STATE2( ch, lag );
  sprintf( buf, "The strong notes of a war horn pass through the area as %s rallies %s troops!",
	   PERS2( ch ), his_her[URANGE(0,ch->sex,2)]);
  do_mpzecho( ch, buf );

/* subtract cp's */
  handle_skill_cost( ch, ch->pCabal, sn );

  affect_strip( ch, gen_mob_gen );

/* start the gen */
  af.type	= gen_mob_gen;
  af.level	= MOB_VNUM_JUSTICE_PATROL;	//mob to be spawned
  af.duration	= 4;				//how many times to spawn the mobs
  
  af.where	= TO_NONE;
  af.bitvector	= IS_LEADER( ch ) ? 1 : 1;	//troops to be spawned per tick
  af.location	= ch->in_room->area->vnum;	//area to rally troops in
  af.modifier	= IS_LEADER( ch ) ? 6 : 3;	//max troops to be spawned

  affect_to_char(ch, &af );
/* attach wait period */
  af.type	= sn;
  af.level	= ch->level;
  af.duration	= 18;
  af.where	= TO_AFFECTS;
  af.bitvector	= 0;
  af.location	= 0;
  af.modifier	= 0;
  affect_to_char(ch, &af );

}


void spell_shield_justice( int sn, int level, CHAR_DATA *ch, void *vo, int target )
{
    OBJ_DATA *shield;
    AFFECT_DATA *paf;

    if (IS_ELDER(ch))
      shield = create_object( get_obj_index(OBJ_VNUM_JUSTICE_SHIELD2), level );
    else
      shield = create_object( get_obj_index(OBJ_VNUM_JUSTICE_SHIELD), level );
    shield->timer = level;
    paf = new_affect();
    paf->type       = sn;
    paf->level      = level;
    paf->duration   = -1;
    paf->location   = APPLY_HITROLL;
    paf->modifier   = level/6;
    paf->bitvector  = 0;
    paf->next       = shield->affected;
    shield->affected   = paf;
    paf = new_affect();
    paf->type       = sn;
    paf->level      = level;
    paf->duration   = -1;
    paf->location   = APPLY_DAMROLL;
    paf->modifier   = level/7;
    paf->bitvector  = 0;
    paf->next       = shield->affected;
    shield->affected   = paf;
    paf = new_affect();
    paf->type       = sn;
    paf->level      = level;
    paf->duration   = -1;
    paf->location   = APPLY_HIT;
    paf->modifier   = level;
    paf->bitvector  = 0;
    paf->next       = shield->affected;
    shield->affected   = paf;
    obj_to_char(shield, ch);
    act("You create $p!",ch,shield,NULL,TO_CHAR);
    act("$n creates $p!",ch,shield,NULL,TO_ROOM);
}

/* gets next step to a criminal */
void do_hunt( CHAR_DATA *ch, char *argument )
{
    extern char * const dir_name[];
    char arg[MSL];   
    CHAR_DATA *victim;
    int direction, maxdist, roll;
    int skill = get_skill(ch, gsn_hunt);    
    const int cost = skill_table[gsn_hunt].min_mana;

    one_argument( argument, arg );

/* Checks to see if the caster is a Hunter */
    if (skill < 2){
      send_to_char("Huh?\n\r", ch);
      return;
    }
    else if( arg[0] == '\0' )
    {
        send_to_char( "Whom are you trying to hunt?\n\r", ch );
        return;
    }
    victim = get_char( arg );
    if( victim == NULL )
    {
        send_to_char("No-one around by that name.\n\r", ch );
        return;
    }
    else if (IS_NPC(victim)){
      send_to_char("Why would you want to hunt a mob?\n\r", ch);
      return;
    }
    else if( ch->in_room == victim->in_room )
    {
        sendf(ch, "%s is here!", PERS2(victim));
        return;
    }
    else if (!IS_WANTED(victim)){
      send_to_char("You may only use this to track criminals.\n\r", ch);
      return;
    }
    else if (ch->mana < cost){
      send_to_char( "You can't concentrate sufficiently\n\r", ch );
      return;
    }
    ch->mana -= cost;
    WAIT_STATE2( ch, skill_table[gsn_hunt].beats );

/* subtract cp's */
    handle_skill_cost( ch, ch->pCabal, gsn_hunt );

    /* skill check */
    if (number_percent() > skill){
      send_to_char("You can't seem to pick up a trail.\n\r", ch);
      return;
    }

    /* defense check */
    if (victim->in_room->vnum == ROOM_VNUM_LIMBO
	|| IS_OUTLAW(victim)
	|| IS_SET(victim->in_room->room_flags, ROOM_NOWHERE)
	|| IS_SET(victim->in_room->room_flags, ROOM_NO_SCAN)
	|| is_affected(victim, gsn_coffin)
	|| is_affected(victim, gsn_burrow)
	|| is_affected(victim, gsn_catalepsy)){
      if (victim->in_room->vnum != ROOM_VNUM_LIMBO)
	send_to_char("You can barely sense the trail.\n\r", ch);
      maxdist = 15;
    }
    else
      maxdist = 512;

    roll = (number_range(1,100));
    if (roll < 33)
        act( "$n carefully examines the area.", ch, NULL, NULL, TO_ROOM );
    else if (roll < 66)
       act( "$n carefully checks the ground for tracks.", ch, NULL, NULL, TO_ROOM );
    else
        act( "$n listens carefully for some sounds.", ch, NULL, NULL, TO_ROOM );


    direction = find_first_step(ch->in_room, victim->in_room, maxdist, TRUE, NULL);
    switch(direction)
    {
    case BFS_ERROR:
        send_to_char("Hmm... something seems to be wrong.\n\r", ch);
        break;
    case BFS_ALREADY_THERE:
        send_to_char("You're already in the same room!\n\r", ch);
        break;
    case BFS_NO_PATH:
        send_to_char("You can't sense a trail from here.\n\r", ch);
        check_improve(ch,gsn_hunt,FALSE,0);
        break;
    default:  
        if( ( IS_NPC (ch) && number_percent () > 75) || (!IS_NPC (ch) && number_percent () > get_skill(ch,gsn_hunt) )
        || IS_AFFECTED2(ch,AFF_MISDIRECTION))
        {
            do
            { 
                direction = number_door();
            }
            while( ( ch->in_room->exit[direction] == NULL ) || ( ch->in_room->exit[direction]->to_room == NULL) );
       }
        sendf( ch, "%s is %s from here.\n\r", PERS2(victim), dir_name[direction] );
        check_improve(ch,gsn_hunt,TRUE,0);
        break;
    }
}

/* throws a bolo, causes difficult movement or delayed sleep at higher skill */
void do_bolo( CHAR_DATA* ch, char* argument ){
  CHAR_DATA* victim;
  int skill = get_skill( ch, gsn_bolo );
  int chance = skill;
  int neck_chance = UMAX(0, chance - 85) * 3 + 20;

  bool fForce = FALSE;
  bool fAttack = FALSE;

  const int cost = skill_table[gsn_bolo].min_mana;
  const int lag = skill_table[gsn_bolo].beats;
  
  if (skill < 2){
    send_to_char("Huh?\n\r", ch);
    return;
  }
  /* get the target */
  if (IS_NULLSTR( argument)){
    if (ch->fighting)
      victim = ch->fighting;
    /* check if a pet wolfhound exists (justice mob) and take its target */
    else if (ch->pet && ch->pet->pIndexData->vnum == MOB_VNUM_HOUND 
	     && ch->pet->fighting
	     && ch->pet->in_room
	     && ch->pet->in_room == ch->in_room ){	     
      victim = ch->pet->fighting;
      if (IS_WANTED( victim) && is_safe_quiet( ch, victim ))
	fForce = TRUE;
    }
    else{
      send_to_char("You are not fighting anyone.\n\r", ch);
      return;
    }
  }
  else if ( (victim = get_char_room(ch, NULL, argument )) == NULL){
    send_to_char("They aren't here.\n\r", ch );
    return;
  }
  else if (!fForce && is_safe(ch, victim ))
    return;

  /* misc. checks */
  if (!IS_AWAKE(victim) || is_affected(victim, gsn_ecstacy )){
    send_to_char("What would be the point of that?\n\r", ch);
    return;
  }
  else if (ch == victim){
    return;
  }
  else if (ch->mana < cost){
    send_to_char("You cannot concentrate sufficiently to aim.\n\r", ch);
    return;
  }
  else 
    ch->mana -= cost;

  WAIT_STATE2( ch, lag );

/* subtract cp's */
  handle_skill_cost( ch, ch->pCabal, gsn_hunt );
  
  /* modify chance slightly */
  chance += (get_curr_stat(ch,STAT_DEX) - get_curr_stat(victim,STAT_DEX)) * 3;
  chance += get_curr_stat(ch,STAT_LUCK) - get_curr_stat(victim,STAT_LUCK);

  /* safety */
  if (IS_NPC(victim) && IS_SET(victim->act,ACT_TOO_BIG) )
    chance = 0;

/* do the yells */
  if ( !fForce && ch->fighting != victim && victim->fighting != ch){
    char buf[MIL];
    a_yell(ch,victim);
    sprintf(buf, "Help! %s just threw a bolo at me!",PERS(ch,victim));
    j_yell(victim,buf);
    fAttack = TRUE;
  }
  
  /* check if skill high enugh to throw at the neck */
  if (skill > 84 && number_percent() < neck_chance){
    if (number_percent() > chance
	|| saves_spell( victim->level - 3, victim, DAM_OTHER ,skill_table[gsn_bolo].spell_type) ){
      dam_message( ch, victim, NULL, 0, gsn_bolo, FALSE, FALSE, gsn_bolo, TRUE );
    }
    else{
      AFFECT_DATA af;

      act("You throw a bolo at $N's neck.", ch, NULL, victim, TO_CHAR);
      act("$n throws a bolo at $N's neck.", ch, NULL, victim, TO_NOTVICT);
      act("$n throws a bolo at your neck.", ch, NULL, victim, TO_VICT);
      dam_message( ch, victim, NULL, 5, gsn_bolo, FALSE, FALSE, gsn_bolo, TRUE );

      if (!is_affected(victim, gen_suffocate )){
	af.type		= gen_suffocate;
	af.level	= ch->level;
	af.duration	= 4;		//how long before person falls asleep for 1 tick
	
	af.where	= TO_AFFECTS;
	af.bitvector	= 0;
	af.location	= APPLY_NONE;
	af.modifier	= FALSE;	//NO DAMAGE
	affect_to_char( victim, &af );
      }
    }
  }
/* hit the legs */
  else{
    if (number_percent() > chance ){
      dam_message( ch, victim, NULL, 0, gsn_bolo, FALSE, FALSE, gsn_bolo, TRUE );
    }
    else{
      AFFECT_DATA af;
      act("You throw a bolo at $N's legs.", ch, NULL, victim, TO_CHAR);
      act("$n throws a bolo at $N's legs.", ch, NULL, victim, TO_NOTVICT);
      act("$n throws a bolo at your legs.", ch, NULL, victim, TO_VICT);
      dam_message( ch, victim, NULL, 5, gsn_bolo, FALSE, FALSE, gsn_bolo, TRUE );

      if (!is_affected(victim, gsn_enfeeblement)){
	af.type		= gsn_enfeeblement;
	af.level	= ch->level;
	af.duration	= 5;		
	
	af.where	= TO_AFFECTS;
	af.bitvector	= 0;
	af.location	= APPLY_DEX;
	af.modifier	= -2;	
	affect_to_char( victim, &af );
      }
    }
  }
  if ( fAttack && IS_AWAKE(victim) && victim->fighting == NULL)
    multi_hit(victim,ch,TYPE_UNDEFINED);
}

      

/* marks a person with mark of prey */
void spell_justice_sigil( int sn, int level, CHAR_DATA *ch, void *vo, int target ){
  CHAR_DATA *victim;
  bool fForce = FALSE;

  if (IS_NULLSTR( target_name)){
    if (ch->fighting)
      victim = ch->fighting;
    /* check if a pet wolfhound exists (justice mob) and take its target */
    else if (ch->pet && ch->pet->pIndexData->vnum == MOB_VNUM_HOUND 
	     && ch->pet->fighting
	     && ch->pet->in_room
	     && ch->pet->in_room == ch->in_room){
      victim = ch->pet->fighting;
      if (IS_WANTED( victim) && is_safe_quiet( ch, victim ))
	fForce = TRUE;
    }
    else{
      send_to_char("Place the Justice Sigil on who?\n\r", ch);
      return;
    }
  }
  else if ( (victim = get_char_room(ch, NULL, target_name )) == NULL){
    send_to_char("They aren't here.\n\r", ch );
    return;
  }
  else if (!fForce && is_safe(ch, victim ))
    return;

  if ( !fForce && ch->fighting != victim && victim->fighting != ch){
    m_yell( ch, victim, FALSE );
    if (IS_AWAKE(victim) && victim->fighting == NULL)
      multi_hit(victim,ch,TYPE_UNDEFINED);
  }
  
  /* cast the actual mark of prey here */
  spell_mark_prey( sn, level, ch, victim, target );
       
}
  
/* sumons the hound used by ENFORCER justice */
void spell_hound_call( int sn, int level, CHAR_DATA *ch, void *vo, int target ){
    char buf[MSL];
    CHAR_DATA *hound;
    AFFECT_DATA af;
    int i;


    if (get_skill(ch,sn) < 2){
      send_to_char("Huh?\n\r", ch );
      return;
    }
    else if (is_affected(ch, sn)){
      send_to_char("You are not yet ready to call a new hound.\n\r", ch);
      return;
    }
    else if (is_captured(ch->pCabal)){
      send_to_char("The hounds will not answer without your Standard.\n\r", ch);
      return;
    }
    sprintf(buf, "The strong clear notes of %s's hunting horn pierce the area.", PERS2( ch ));
    do_mpzecho( ch, buf );
    if (ch->pet ){
      if (ch->pet->pIndexData->vnum ==  MOB_VNUM_HOUND)
	do_say(ch->pet, "Woof? Woof woof woof?");
      else
	do_say(ch->pet, "What? I'm not good enough?");
      return;
    }

    hound = create_mobile( get_mob_index(MOB_VNUM_HOUND) );
    for (i = 0; i < MAX_STATS; i++)
        hound->perm_stat[i] = UMIN(25, (ch->level / 10) + 17);

    hound->alignment = 0;
    hound->level = ch->level;
    hound->sex = ch->sex;

    char_to_room(hound,ch->in_room);

    SET_BIT(hound->affected_by, AFF_CHARM);
    SET_BIT(hound->act, ACT_PET);

    hound->comm = COMM_NOTELL|COMM_NOYELL|COMM_NOCHANNELS;
    
    ch->pet = hound;
    add_follower(hound, ch);
    hound->leader = ch;
    hound->summoner = ch;

    /* Hunter cannot hide ghosted */
    ch->pcdata->ghost = (time_t)NULL;

    act("$N heels to your side!",ch, NULL, hound,TO_CHAR);
    act("$N heels to $n's side!",ch,NULL, hound,TO_ROOM);
    check_social( hound, "growl", "" );
    do_mpasound(hound, "You hear the baying of a hound nearby.");


    af.type               = sn;
    af.level              = level;
    af.duration           = 2;
    af.where		  = TO_AFFECTS;
    af.bitvector          = 0;
    af.modifier           = 0;
    af.location           = APPLY_NONE;
    affect_to_char(ch, &af);
}

void do_hound_obey( CHAR_DATA *ch, char *argument )
{
    char arg[MIL];
    char arg2[MIL];
    CHAR_DATA *victim;

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

    if (ch->pet == NULL || ch->pet->pIndexData->vnum != MOB_VNUM_HOUND)
    {
      send_to_char("You have no hound to direct.\n\r", ch );
      return;
    }
    else
      SET_BIT(ch->pet->affected_by, AFF_CHARM);

    if (!str_cmp(arg, "stay")){
      SET_BIT(ch->pet->special, SPECIAL_SENTINEL);
      REMOVE_BIT(ch->pet->special, SPECIAL_RETURN);
      REMOVE_BIT(ch->pet->special, SPECIAL_COWARD);
      send_to_char("Your hound will stay in this room.\n\r",ch);
      return;
    }
    else if (!str_cmp(arg, "come")){
      SET_BIT(ch->pet->special, SPECIAL_RETURN);
      REMOVE_BIT(ch->pet->special, SPECIAL_SENTINEL);
      REMOVE_BIT(ch->pet->special, SPECIAL_COWARD);
      ch->pet->hunttime = 0;
      ch->pet->hunting = NULL;
      send_to_char("Your hound is returning to you.\n\r",ch);
      return;
    }
    else if (!str_cmp(arg, "hunt")){
      if( arg2[0] == '\0' ) {
	send_to_char( "Who do you want your hound to hunt?\n\r", ch );
	return;
      }
      else if( (victim = get_char_world( ch, arg2 )) == NULL){
	send_to_char("No one around by that name.\n\r", ch );
	return;
      }
      else if( ch->in_room == victim->in_room ) 
      {
	sendf(ch, "%s is already here!\n\r", PERS2(victim));
	return;
      } 
      else if (IS_NPC(victim)){
	sendf(ch, "You cannot set your hound on mobs!\n\r");
	return;
      }
      if (!is_pk(ch,victim) && !IS_WANTED(victim))
      {
        sendf(ch, "You cannot set your hound on those whom you cannot harm!\n\r");
        return;
      }

      REMOVE_BIT(ch->pet->special, SPECIAL_SENTINEL);
      REMOVE_BIT(ch->pet->special, SPECIAL_COWARD);
      REMOVE_BIT(ch->pet->special, SPECIAL_RETURN);

      sendf(ch, "Your hound races off to find %s.\n\r",PERS2(victim));
      ch->pet->hunttime = 999;
      REMOVE_BIT( ch->pet->affected_by, AFF_CHARM );
      ch->pet->hunting = victim;
      return;        
    }
    else if (!str_cmp(arg, "coward"))
    {
      SET_BIT(ch->pet->special, SPECIAL_COWARD);
      REMOVE_BIT(ch->pet->special, SPECIAL_SENTINEL);
      REMOVE_BIT(ch->pet->special, SPECIAL_RETURN);
      send_to_char("Your hound will stay in this room until attacked.\n\r",ch);
      return;
    }
    send_to_char( "You may command your hound to stay, come, hunt, or coward.\n\r",ch);
}


void spell_guard_call( int sn, int level, CHAR_DATA *ch, void *vo, int target )
{
    char buf[MSL];
    CHAR_DATA *guard;
    int i;
 

    if (get_skill(ch,sn) < 2){
      send_to_char("Huh?\n\r", ch );
      return;
    }
    else if (is_affected(ch, sn)){
      send_to_char("The guardhouse has still not processed your request.\n\r", ch);
      return;
    }
    else if (is_captured(ch->pCabal)){
      send_to_char("The guards will not answer without your Standard.\n\r", ch);
      return;
    }
    sprintf(buf, "Guards! Guards!");
    do_yell(ch, buf);

    if (ch->pet ){
      do_say(ch->pet, "What? I'm not good enough?");
      return;
    }

    guard = create_mobile( get_mob_index(MOB_VNUM_SPECIAL_GUARD) );
    for (i = 0; i < MAX_STATS; i++)
      guard->perm_stat[i] = UMIN(25, (ch->level / 10) + 17);

    guard->alignment = 0;
    guard->level = ch->level;
    guard->sex = ch->sex;
    
    char_to_room(guard,ch->in_room);

    SET_BIT(guard->affected_by, AFF_CHARM);
    SET_BIT(guard->act, ACT_PET);

    guard->comm = COMM_NOTELL|COMM_NOYELL|COMM_NOCHANNELS;
    
    ch->pet = guard;
    ch->summoner = ch;
 
    add_follower(guard,ch);

    guard->leader = ch;
    guard->master = ch;
    
    /* Justice cannot hide ghosted */
    ch->pcdata->ghost = (time_t)NULL;
    act("$N arrives to aid you.", ch, NULL, guard, TO_CHAR);
    act("$N arrives to aid $n.", ch, NULL, guard, TO_ROOM);
}

void do_ensnare(CHAR_DATA *ch, char *argument)
{
    char arg[MIL], buf[MIL];
    CHAR_DATA *victim;
    AFFECT_DATA af, *paf;
    int cost = skill_table[gsn_ensnare].min_mana;
    int lag = skill_table[gsn_ensnare].beats;
    int skill = get_skill(ch, gsn_ensnare);

    one_argument(argument, arg);

    if ( skill < 2)
    {
	send_to_char("Huh?\n\r",ch);
	return;
    }
    if (arg[0] == '\0'){
      victim = ch->fighting;
      if (victim == NULL){
	send_to_char("But you aren't in combat!\n\r",ch);
	return;
      }
    }
    else if ((victim = get_char_room(ch, NULL, arg)) == NULL)
    {
      send_to_char("They aren't here.\n\r",ch);
      return;
    }
    if (victim == ch)
    {
	send_to_char("Why would you want to do that?\n\r",ch);
	return;
    }
    if (IS_NPC(victim) || !IS_SET(victim->act, PLR_WANTED))
    {
        send_to_char("You can only ensnare criminals.\n\r", ch);
        return;
    }
    else if (IS_AREA(victim->in_room->area, AREA_CABAL)){
      send_to_char("You cannot ensnare in cabals.\n\r", ch);
      return;
    }
    if (is_affected(victim,gen_ensnare))
    {
	send_to_char("You have already ensnared that person.\n\r",ch);
	return;
    }
    else if (is_ghost(victim, 600)){
      send_to_char("Not on ghosts.\n\r", ch);
      return;
    }
    if (IS_OUTLAW(victim)){
      act("Your guards aware of $N's  status as an Outlaw refuse your orders!", ch, NULL, victim, TO_CHAR);
      act("$n's guards aware of your reputation as an Outlaw refuse to ensnare you!", ch, NULL, victim, TO_VICT);
      return;
    }
    else if (ch->mana < cost){
      send_to_char("You are too tired to order your guards about effectivly.\n\r", ch );
      return;
    }
    else
      ch->mana -= cost;

/* subtract cp's */
    handle_skill_cost( ch, ch->pCabal, gsn_ensnare );

    WAIT_STATE(ch, lag);

    /* Justice cannot hide ghosted */
    ch->pcdata->ghost = (time_t)NULL;

    if (number_percent() > skill ){
      send_to_char("You failed.\n\r", ch );
      check_improve(ch, gsn_ensnare, FALSE, 0);
      return;
    }
    check_improve(ch, gsn_ensnare, TRUE, 0);

    sendf(ch,"You call onto the guards to prevent %s from leaving the area.\n\r",PERS(victim,ch));
    sendf(victim,"%s ensnares you, preventing your from leaving the area temporarily.\n\r",PERS(ch,victim));

    af.type               = gen_ensnare;
    af.level              = ch->level;
    af.duration           = number_range(6, 12);
    af.where		  = TO_AFFECTS; 
    af.bitvector          = 0;
    af.modifier           = 0;      
    af.location           = 0;
    paf = affect_to_char(victim, &af);
    string_to_affect( paf, ch->name );

    sprintf( buf, "%s has been ensnared in %s.", PERS2(victim), ch->in_room->area->name);
    cabal_echo_flag(CABAL_HEARGUARD, buf );
}


/* ***** ASSASSIN POWERS ***** */
void do_spy( CHAR_DATA *ch, char *argument ){
  char arg[MIL];
  CHAR_DATA *victim;
  AFFECT_DATA af;
  argument = one_argument( argument, arg);

  if (get_skill(ch, gsn_eavesdrop) < 1){
    send_to_char("Huh?\n\r", ch);
    return;
  }
  if (IS_NPC(ch))
    return;
  if ( arg[0] == '\0' ){
    if (ch->pcdata->eavesdropping != NULL){
      act("You are spying on $N.",ch,NULL,ch->pcdata->eavesdropping,TO_CHAR);
      return;
    }
    else{
      send_to_char("Whom do you wish to spy on?\n\r",ch);
      return;
    }
  }
  if (!str_cmp(arg,"none")){
    if (ch->pcdata->eavesdropping != NULL){
      act("You recall the spies from $N's location.",ch,NULL,ch->pcdata->eavesdropping,TO_CHAR); 
      affect_strip(ch,gsn_eavesdrop);
      ch->pcdata->eavesdropping->pcdata->eavesdropped = NULL;
      ch->pcdata->eavesdropping = NULL;
      return;
    }
    else{
      send_to_char("You are not spying anyone.\n\r",ch);
      return;
    }
  }
  if (is_affected(ch,gsn_eavesdrop)){
    send_to_char("You may only spy on one person at a time.\n\r",ch);
    return;
  }
  if ( ( victim = get_char_world( ch, arg ) ) == NULL ){
    send_to_char( "You fail to locate them.\n\r", ch );
    return;
  }
  if (ch == victim){
    send_to_char("That is pointless.\n\r",ch);
    return;
  }
  if (IS_NPC(victim)){
    send_to_char("Why would you want to spy on a mob?\n\r",ch);
    return;
  }
  if (IS_IMMORTAL(victim)){
    send_to_char("Spy on gods? Who do you think you are?\n\r", ch);
    return;
  }
  if (ch->mana < skill_table[gsn_eavesdrop].min_mana){
    send_to_char("You lack the power to communicate with the spies.\n\r", ch);
    return;
  }
  else
    ch->mana -=  skill_table[gsn_eavesdrop].min_mana;

  WAIT_STATE(ch,skill_table[gsn_eavesdrop].beats);
 
  if (number_percent() > get_skill(ch,gsn_eavesdrop) 
      || victim->pcdata->eavesdropped != NULL){
    act("The spies report lack of success.", ch, NULL, victim, TO_CHAR);
    check_improve(ch, gsn_eavesdrop, 20, FALSE);
    return;
  }
/* subtract cp's */
  handle_skill_cost( ch, ch->pCabal, gsn_eavesdrop );

  act("Your spies begin to keep track of $N's every communication.", ch, NULL, victim, TO_CHAR);

  ch->pcdata->eavesdropping = victim;
  victim->pcdata->eavesdropped = ch;
  af.where     = TO_AFFECTS;
  af.type      = gsn_eavesdrop;
  af.level     = ch->level;
  af.duration  = 24;   
  af.location  = APPLY_NONE;
  af.modifier  = 0; //timesince last report (must wait 4 ticks)
  af.bitvector = 0;
  affect_to_char(ch,&af);
  check_improve(ch, gsn_eavesdrop, 20, FALSE);
}

/* eavesdropped room reports */
void spy_report( CHAR_DATA* ch ){
  AREA_DATA* pArea;
  AFFECT_DATA* paf;
  CHAR_DATA* och = NULL;
  char buf[MIL];
  char* text;

  if (IS_NPC(ch))
    return;
  else if ( (och = ch->pcdata->eavesdropped) == NULL)
    return;
  else if (ch->pcdata->pbounty == NULL)
    return;
  else if ( (paf = affect_find(och->affected, gsn_eavesdrop)) == NULL)
    return;
  else if (paf->modifier > 0){
    paf->modifier--;
    return;
  }
  else if (number_percent() < 60)
    return;

  /* location */
  if (IS_AFFECTED2(ch,AFF_SHADOWFORM) 
      || IS_IMMORTAL(ch)
      || IS_AFFECTED2(ch,AFF_TREEFORM)
      || IS_AFFECTED2(ch,AFF_CATALEPSY)
      || IS_ROOM(ch->in_room, ROOM_NOWHERE)
      || IS_ROOM(ch->in_room, ROOM_NO_SCAN)
      || is_affected(ch,gsn_bat_form) 
      || is_affected(ch,gsn_coffin) 
      || is_affected(ch,gsn_entomb)){
    return;
  }
  /* report location */
  /* get random area to mention */
  if ( (pArea = get_rand_aexit(ch->in_room->area)) == NULL)
    pArea = ch->in_room->area;

/* compose the text to say */
  switch (ch->in_room->sector_type){
  default:		text = "on the ground"	; break;
  case SECT_INSIDE:	text = "indoors"	; break;
  case SECT_CITY:	text = "a sidewalk"	; break;
  case SECT_FIELD:	text = "in grass"	; break;
  case SECT_FOREST:	text = "in bush"	; break;
  case SECT_HILLS:	text = "on a hill"	; break;
  case SECT_MOUNTAIN:	text = "amongst stones"	; break;
  case SECT_WATER_SWIM:	text = "in depths"	; break;
  case SECT_WATER_NOSWIM:text = "in water"	; break;
  case SECT_SWAMP:	text = "in mud"		; break;
  case SECT_AIR:	text = "flying"		; break;
  case SECT_DESERT:	text = "in sand"	; break;
  case SECT_LAVA:	text = "in fire"	; break;
  case SECT_SNOW:	text = "in ice"		; break;
  }
  sprintf(buf, "Spies report %s %s near %s.\n\r", PERS2(ch), text, pArea->name);
  send_to_char(buf, och);
  paf->modifier = number_range(3, 5);
}
  
void do_spyold( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    ROOM_INDEX_DATA *ori_room;

    if (ch->mana < 70 )
    {
	send_to_char("You don't have enough mana.\n\r",ch);
	return;
    }
    ch->mana -= 70;
    if ( (victim = get_char_world(ch, argument)) == NULL)
    {
      act("Not even $g's power can locate them.", ch, NULL, NULL, TO_CHAR);
      return;
    }
    if ( (victim->level > ch->level + 7) && saves_spell(ch->level, victim, DAM_OTHER, skill_table[gsn_spy].spell_type))
    {
	send_to_char("Your minions have failed to reach them.\n\r",ch);
	return;
    }
    if (ch == victim)
        do_look( ch, "auto" );

    else
    {
	ori_room = ch->in_room;
	char_from_room( ch );
	char_to_room( ch, victim->in_room );
	do_look( ch, "auto" );
	char_from_room( ch );
	char_to_room( ch, ori_room );
    }
    WAIT_STATE(ch,skill_table[gsn_spy].beats);
}

/* ***** MYSTIC POWERS ***** */

/* SPELL GIFT
   General effects: sends one magical item to another savant
   Coded By:        Athaekeetha
*/


void spell_gift( int sn, int level, CHAR_DATA *ch, void *vo,int target)
{
    CHAR_DATA *victim;
    OBJ_DATA *obj;
    char arg[MIL], arg2[MIL];
    bool char_has_obj = FALSE;

/* Get the obj and victim names */
    target_name = one_argument(target_name, arg);
    target_name = one_argument(target_name, arg2);


/* If caster is an NPC */
    if (IS_NPC(ch)) {
      return;
    }

/* Usage message if not enough args */
    if (arg2[0] == '\0') {
      send_to_char ("Syntax: gift <target> <item>\n\r", ch);
      return;
    }

/* Get the obj from room or caster, else fail */
    obj = get_obj_list (ch, arg2, ch->in_room->contents);
    if (obj == NULL) {
	obj = get_obj_list (ch, arg2, ch->carrying);
	if (obj == NULL) {
	  sendf(ch, "I see no %s here.\n\r", arg2);
	  return;
	}

/* We need to know if obj is in room or held */
	char_has_obj = TRUE;
    }

/* Check if caster can find the victim */
    victim = get_char_world (ch, arg);
    if (victim == NULL) {
      sendf (ch, "%s does not seem to be around.\n\r", arg);
      return;
    }
    /* check fo  NO_SUMMON being off */
    if (IS_SET(victim->act,PLR_NOSUMMON)){
      send_to_char("Target player must have NO_SUMMON turned OFF.\n\r", ch);
      return;
    }

/* Check if caster is high enough lev to send this item */
    if (obj->level > ch->level) {
      send_to_char( "You are not powerful enough to make a gift "\
		    "of this item.\n\r", ch );
      return;
    }

/* Make sure the item is not being worn */
    if (obj->wear_loc != -1) {
      sendf (ch, "You must remove the %s first.\n\r", arg2);
      return;
    }

/* Make sure the caster can drop the item */
    if (!can_drop_obj (ch, obj)) {
	send_to_char( "You can't let go of it.\n\r", ch );
	return;
    }

/* Check if the victim can carry more items */
    if (victim->carry_number + get_obj_number (obj) > can_carry_n (victim)) {
      act("$N has $S hands full.", ch, NULL, victim, TO_CHAR);
      return;
    }

/* Check if the victim can carry more weight */
    if (get_carry_weight (victim) + get_obj_weight_char (victim, obj) > 
	can_carry_w (victim)) {
      sendf(ch, "%s can't carry that much weight.\n\r", PERS(victim,ch));
      return;
    }

/* Check if the victim can see the item */
    if (!can_see_obj (victim, obj)) {
      sendf (ch, "%s can't see it.\n\r", PERS(victim,ch));
      return;
    }

/* Check if victim OR caster is in NO_SUMM or NO_GATE */
    if (IS_SET (victim->in_room->room_flags, ROOM_NO_SUMMONIN) || 
	IS_SET (ch->in_room->room_flags, ROOM_NO_SUMMONOUT) ||
	IS_SET (victim->in_room->room_flags, ROOM_NO_GATEIN) || 
	IS_SET (ch->in_room->room_flags, ROOM_NO_GATEOUT)) {
      send_to_char ("A magical force greater than your own prevents "\
		    "your gift.\n\r", ch);
      return;
    }

/* Take the item from the caster */
    if (char_has_obj == TRUE) { 
      obj_from_char (obj);
    }
    else {
      obj_from_room (obj);
    }

/* Random chance (Very small) of blowing up the item */
    if (number_percent() + (ch->level / 5) <= 15) {
      sendf(ch, "The %s dissapears with a loud -pop-.\n\r", arg2);
      extract_obj (obj);
      return;
    } 

/* Random chance of going elsewhere other than victim */
    if (number_percent() + (ch->level / 5) >= 20) {
      obj_to_room (obj, victim->in_room);

/* Show everyone the action - spell worked properly */
      act ("$p arrives as a gift from $N.", victim, obj, ch, TO_CHAR);
      act ("$N gives a gift of $p to $n.", victim, obj, ch, TO_ROOM);
      act ("You send $p to $N as a gift.", ch, obj, victim, TO_CHAR);
    }

/* Show the caster there was a problem, and hint to the victim */
    else {
      RID* pR = get_rand_room(0,0,	//area range (0 to ignore)
			      0,0,	//room ramge (0 to ignore)
			      NULL,0,	//areas to choose from
			      NULL,0,	//areas to exclude
			      NULL,0,	//sectors required
			      NULL,0,	//sectors to exlude
			      NULL,0,	//room1 flags required
			      NULL,0,	//room1 flags to exclude
			      NULL,0,	//room2 flags required
			      NULL,0,	//room2 flags to exclude
			      5,	//number of seed areas
			      FALSE,	//exit required?
			      FALSE,	//Safe?
			      NULL);	//Character for room checks
      if (pR)
	obj_to_room (obj, pR );
      send_to_char ("You sense a disruption in your spell.\n\r", ch);
      send_to_char ("You feel a touch of deja-vu.\n\r", victim);      
    }
}

//servant commands for monsters created through awaken life
//current command is stored in "status"
void do_servant_awaken_life( CHAR_DATA *ch, CHAR_DATA* servant, char *argument ){
  AFFECT_DATA af;
  const int gsn_awaken_life = skill_lookup("awaken life");
  int order_wait = 0;

  if (ch == NULL || servant == NULL || servant->pCabal == NULL)
    return;
  else if (IS_NPC(ch) || !IS_NPC(servant))
    return;
  else if (IS_NULLSTR(argument)){
    send_to_char("Your servant can: Rampage, Destroy, Move, Retreat and Report.\n\r", ch);
    return;
  }
  else if (is_affected(servant, gsn_awaken_life) && !str_prefix(argument, "report")){
    send_to_char("It seems to ignore your orders.\n\r", ch);
    return;
  }

  //RAMPAGE (pick random rooms to destroy in the area monster is in)
  if (!str_prefix(argument, "rampage")){
    char buf1[MIL], buf[MIL], name[MIL];
    CHAR_DATA* vch;

    if (servant->in_room->area->pCabal && is_friendly(servant->in_room->area->pCabal, servant->pCabal) != CABAL_ENEMY){
      send_to_char("You require a vendetta before committing such a hostile action.\n\r", ch);
      return;
    }
    servant->status = AWAKENLIFE_RAMP;
    sendf( ch, "%s will now rampage through %s.\n\r", capitalize(PERS2(servant)), servant->in_room->area->name);
    order_wait = 24;

    sprintf( name, "%s", servant->short_descr);
    name[0] = UPPER(name[0]);
    sprintf( buf, "A messenger yells '`6%s spotted rampaging through %s`6!``'\n\r",
	     name,
	     servant->in_room->area->name);
    sprintf( buf1, "%s's roar echos through the area as it begins its rampage!\n\r", name);

    for (vch = player_list; vch; vch = vch->next_player){
      if (!IS_AWAKE( vch))
	continue;
      else if (vch->in_room->area == servant->in_room->area)
	send_to_char( buf1, vch );
      else
	send_to_char( buf, vch );
    }
  }
  //DESTROY (servant will move to current room and then destroy it)
  else if (!str_prefix(argument, "destroy")){
    if (ch->in_room->area->pCabal && is_friendly(ch->in_room->area->pCabal, ch->pCabal) != CABAL_ENEMY){
      send_to_char("You require a vendetta before committing such a hostile action.\n\r", ch);
      return;
    }
    servant->status = AWAKENLIFE_DEST;
    if (set_path(servant, servant->in_room, ch->in_room, 256, NULL) < 0)
      sendf( ch, "%s cannot find its way here.\n\r", capitalize(PERS2(servant)));
    else
      sendf( ch, "%s will try to destroy this room.\n\r", capitalize(PERS2(servant)));
    order_wait = 1;
  }
  //MOVE will cause the servant to move here
  else if (!str_prefix(argument, "move")){
    servant->status = AWAKENLIFE_MOVE;
    if (set_path(servant, servant->in_room, ch->in_room, 256, NULL) < 0)
      sendf( ch, "%s cannot find its way here.\n\r", capitalize(PERS2(servant)));
    else
      sendf( ch, "%s will now head to this room.\n\r", capitalize(PERS2(servant)));
    order_wait = 3;
  }
  //RETREAT will cause the servant to head for the cabal
  else if (!str_prefix( argument, "retreat")){
    CABAL_DATA* pCab = get

Showing the first 100 KB of 333.3 KB. Download the archive for the full file.

Site Stats

Snippets: 1791
Codebases: 571