diff -i smaug14/src/magic.c smaug18/src/magic.c
8c8
<  * Tricops and Fireblade                                      |             *
---
>  * Tricops, Fireblade, Edmond, Conran                         |             *
28a29
> 
73a75,91
> 
> 
> bool can_astral_room( ROOM_INDEX_DATA * room )
> {
>       if ( xIS_SET( room->room_flags, ROOM_PRIVATE )
>               || xIS_SET( room->room_flags, ROOM_SOLITARY )
>               || xIS_SET( room->room_flags, ROOM_NO_ASTRAL )
>               || xIS_SET( room->room_flags, ROOM_DEATH )
>               || xIS_SET( room->room_flags, ROOM_NO_RECALL )
>               || xIS_SET( room->room_flags, ROOM_PROTOTYPE )
>               || IS_SET( room->area->flags, AFLAG_NOPORTALIN ) || IS_SET( room->area->flags, AFLAG_NOTELEPORT ) )
>               return FALSE;
> 
> 
>       return TRUE;
> }
> 
262c280,281
<                       && !str_prefix( name, skill_table[sn]->name )
---
>                       && ( !str_prefix( name, skill_table[sn]->name )
>                               || ( sysdata.magichell && ch->level > 35 && number_percent(  ) < 30 ) )
283c302,303
<               if ( !str_cmp( name, skill_table[sn]->name )
---
>               if ( ( !str_cmp( name, skill_table[sn]->name )
>                               || ( sysdata.magichell && ch->level > 35 && number_percent(  ) < 30 ) )
674c694
<       if ( IS_SET( ch->immune, ris ) )
---
>       if ( IS_SET( ch->immune, ris ) || IS_SET( ch->stance_immune, ris ) )
676c696
<       if ( IS_SET( ch->resistant, ris ) )
---
>       if ( IS_SET( ch->resistant, ris ) || IS_SET( ch->stance_immune, ris ) )
678c698
<       if ( IS_SET( ch->susceptible, ris ) )
---
>       if ( IS_SET( ch->susceptible, ris ) || IS_SET( ch->stance_immune, ris ) )
1069a1090
>                               {
1084a1106
>                               }
1087a1110
>                               {
1103a1127
>                               }
1160a1185,1186
> 
> 
1217a1244,1246
>                       if ( sysdata.magichell && ch->level > 35 && number_percent(  ) < 30 )
>                               *victim = ch;
> 
1300a1330,1336
>                       if ( SPELL_FLAG( skill, SF_NOMOB ) && IS_NPC( *victim ) )
>                       {
>                               send_to_char( "Your magic fails to take hold.\n\r", ch );
>                               return &pAbort;
>                       }
> 
> 
1358a1395,1397
> 
> 
> 
1400c1439,1440
<                       if ( IS_SET( ch->in_room->room_flags, ROOM_NO_MAGIC ) )
---
>                       if ( xIS_SET( ch->in_room->room_flags, ROOM_NO_MAGIC )
>                               || IS_SET( ch->in_room->area->flags, AFLAG_NOMAGIC ) )
1567c1607,1612
<                       mana = IS_NPC( ch ) ? 0 : UMAX( skill->min_mana, 100 / ( 2 + ch->level - skill->skill_level[ch->class] ) );
---
>                       if ( !sysdata.magichell )
>                               mana = IS_NPC( ch ) ? 0 : UMAX( skill->min_mana,
>                                       100 / ( 2 + ch->level - skill->skill_level[ch->class] ) );
>                       else
>                               mana = IS_NPC( ch ) ? 0 : UMAX( skill->min_mana * number_range( 5, 10 ) / 5,
>                                       ( 100 / ( 2 + ch->level - skill->skill_level[ch->class] ) ) * number_range( 5, 10 ) / 5 );
1887c1932
<       if ( IS_SET( ch->in_room->room_flags, ROOM_NO_MAGIC ) )
---
>       if ( !ch->in_room || xIS_SET( ch->in_room->room_flags, ROOM_NO_MAGIC ) )
1894c1939
<       if ( IS_SET( ch->in_room->room_flags, ROOM_SAFE ) && skill->target == TAR_CHAR_OFFENSIVE )
---
>       if ( xIS_SET( ch->in_room->room_flags, ROOM_SAFE ) && skill->target == TAR_CHAR_OFFENSIVE )
1905c1950
<       if ( ( skill->target == TAR_CHAR_OFFENSIVE || number_bits( 7 ) == 1 )  /* 1/128 chance if non-offensive */
---
>       if ( ch != victim && ( skill->target == TAR_CHAR_OFFENSIVE || number_bits( 7 ) == 1 )   /* 1/128 chance if non-offensive */
1966a2012,2016
>                       if ( SPELL_FLAG( skill, SF_NOMOB ) && IS_NPC( victim ) )
>                       {
>                               send_to_char( "Your magic fails to take hold.\n\r", ch );
>                               return rNONE;
>                       }
2006a2057
> 
2143a2195,2196
>                       if ( IS_NPC( vch ) && xIS_SET( vch->act, ACT_MOBINVIS ) )
>                               continue;
2245a2299,2304
>       if ( get_timer( ch, TIMER_PKILLED ) > 0 )
>       {
>               send_to_char( "You have been killed in the past five minutes.\n\r", ch );
>               return rSPELL_FAILED;
>       }
> 
2270a2330,2336
> /* cannot charm mobs while having just been killed/killer */
>       if ( get_timer( ch, TIMER_PKILLED ) > 0 )
>       {
>               send_to_char( "You are still too weak..\n\r", ch );
>               return rSPELL_FAILED;
>       }
> 
2551c2617
<               act( AT_MAGIC, "Laying your hands on $N's eyes, you pray to life $S blindness.", ch, NULL, victim, TO_CHAR );
---
>               act( AT_MAGIC, "Laying your hands on $N's eyes, you pray to lift $S blindness.", ch, NULL, victim, TO_CHAR );
2560a2627
>       int x = 0;
2569a2637
> 
2573c2641,2642
<               victim->mental_state = URANGE( -100, victim->mental_state, -10 );
---
>               x = victim->mental_state < 0 ? -x : x;
>               victim->mental_state = URANGE( -25, victim->mental_state, 25 );
2722a2792,2797
> /* Bug Fix to prevent possesed mobs from being dispelled -Shaddai */
>       if ( IS_NPC( victim ) && IS_AFFECTED( victim, AFF_POSSESS ) )
>       {
>               immune_casting( skill, ch, victim, NULL );
>               return rVICT_IMMUNE;
>       }
2919c2994
<       if ( IS_SET( ch->in_room->room_flags, ROOM_SAFE ) )
---
>       if ( xIS_SET( ch->in_room->room_flags, ROOM_SAFE ) )
2934a3010,3011
>                       if ( IS_NPC( vch ) && xIS_SET( vch->act, ACT_MOBINVIS ) )
>                               continue;
3194a3272,3274
>               if ( IS_NPC( ich ) && xIS_SET( ich->act, ACT_MOBINVIS ) )
>                       continue;
> 
3282a3363,3364
>               if ( obj->owner[0] != '\0' )
>                       ch_printf_color( ch, "&cOwner: &Y%s\n\r", obj->owner );
3401,3408d3482
< /* DELETE LATER -- SHADDAI 
<     if ( IS_NPC(victim) && xIS_SET(victim->act, ACT_POLYMORPHED) )
<       ch_printf(ch,"%s appears to truly be %s.\n\r",
<       name, 
<       ((ch->level > victim->level + 10) 
<        && victim->desc && victim->desc->original)
<       ? victim->desc->original->name : "someone else");
< */
3588a3663,3670
> /*
> 
> ch_ret spell_locate_object( int sn, int level, CHAR_DATA *ch, void *vo )
> {
>     char buf[MAX_INPUT_LENGTH];
>     OBJ_DATA *obj;
>     OBJ_DATA *in_obj;
>     int cnt, found = 0;
3589a3672,3679
>     for ( obj = first_object; obj; obj = obj->next )
>     {
>       if ( !can_see_obj( ch, obj ) || !nifty_is_name( target_name, obj->name ) )
>           continue;
>       if ( (IS_OBJ_STAT( obj, ITEM_PROTOTYPE )
>       ||    IS_OBJ_STAT( obj, ITEM_NOLOCATE  ) )
>       &&   !IS_IMMORTAL(ch) )
>           continue;
3591c3681,3731
< ch_ret spell_locate_object( int sn, int level, CHAR_DATA * ch, void *vo )
---
>       found++;
> 
>       for ( cnt = 0, in_obj = obj;
>             in_obj->in_obj && cnt < 100;
>             in_obj = in_obj->in_obj, ++cnt )
>           ;
>       if ( cnt >= MAX_NEST )
>       {
>           sprintf( buf, "spell_locate_obj: object [%d] %s is nested more than %d times!",
>               obj->pIndexData->vnum, obj->short_descr, MAX_NEST );
>           bug( buf, 0 );
>           continue;
>       }
> 
>       if ( in_obj->carried_by )
>       {
>           if ( IS_IMMORTAL( in_obj->carried_by )
>           &&  !IS_NPC( in_obj->carried_by ) )
>           && ( get_trust( ch ) < in_obj->carried_by->pcdata->wizinvis )
>             &&  xIS_SET( in_obj->carried_by->act, PLR_WIZINVIS ) )
>            {
>               found--;
>               continue;
>            }
> 
>           sprintf( buf, "%s carried by %s.\n\r",
>                  obj_short(obj), PERS(in_obj->carried_by, ch) );
>       }
>       else
>       {
>           sprintf( buf, "%s in %s.\n\r",
>               obj_short(obj), in_obj->in_room == NULL
>                   ? "somewhere" : in_obj->in_room->name );
>       }
> 
>       buf[0] = UPPER(buf[0]);
>         set_char_color( AT_MAGIC, ch );
>         send_to_char( buf, ch );
>     }
> 
>     if ( !found )
>     {
>       send_to_char( "Nothing like that exists.\n\r", ch );
>       return rSPELL_FAILED;
>     }
>     return rNONE;
> }
> */
> 
> 
> bool can_locate_obj( CHAR_DATA * ch, OBJ_DATA * obj )
3593,3596c3733,3754
<       char buf[MAX_INPUT_LENGTH];
<       OBJ_DATA *obj;
<       OBJ_DATA *in_obj;
<       int cnt, found = 0;
---
>       if ( IS_OBJ_STAT( obj, ITEM_NOLOCATE ) )
>               return FALSE;
>       if ( obj->item_type != ITEM_CORPSE_PC && !CAN_WEAR( obj, ITEM_TAKE ) && ch->level < sysdata.level_getobjnotake )
>               return FALSE;
>       if ( !IS_IMMORTAL( ch ) && IS_OBJ_STAT( obj, ITEM_PROTOTYPE ) )
>               return FALSE;
>       if ( xIS_SET( ch->act, PLR_HOLYLIGHT ) )
>               return TRUE;
>       if ( IS_OBJ_STAT( obj, ITEM_BURIED ) || IS_OBJ_STAT( obj, ITEM_HIDDEN ) )
>               return FALSE;
>       if ( IS_AFFECTED( ch, AFF_TRUESIGHT ) )
>               return TRUE;
>       if ( IS_AFFECTED( ch, AFF_BLIND ) )
>               return FALSE;
>       if ( IS_OBJ_STAT( obj, ITEM_INVIS ) && !IS_AFFECTED( ch, AFF_DETECT_INVIS ) )
>               return FALSE;
>       return TRUE;
> }
> 
> bool can_locate_mob( CHAR_DATA * ch, CHAR_DATA * victim )
> {
>       bool ch_immort;
3598c3756,3762
<       for ( obj = first_object; obj; obj = obj->next )
---
>       /*
>        * to remove if we want caster to not locate hmself 
>        */
>       if ( ch == victim )
>               return TRUE;
>       ch_immort = IS_IMMORTAL( ch );
>       if ( IS_NPC( victim ) )
3600,3603c3764,3797
<               if ( !can_see_obj( ch, obj ) || !nifty_is_name( target_name, obj->name ) )
<                       continue;
<               if ( ( IS_OBJ_STAT( obj, ITEM_PROTOTYPE ) || IS_OBJ_STAT( obj, ITEM_NOLOCATE ) ) && !IS_IMMORTAL( ch ) )
<                       continue;
---
>               if ( xIS_SET( victim->act, ACT_MOBINVIS ) && get_trust( ch ) < victim->mobinvis )
>                       return FALSE;
>               if ( xIS_SET( victim->act, ACT_NOLOCATE ) )
>                       return FALSE;
>       }
>       else
>       {
>               if ( xIS_SET( victim->act, PLR_WIZINVIS ) && get_trust( ch ) < victim->pcdata->wizinvis )
>                       return FALSE;
>               if ( victim->timer > 1 && !IS_NPC( ch ) && IS_PKILL( victim ) && !ch_immort && !victim->desc )
>                       return FALSE;
>               if ( IS_IMMORTAL( victim ) && !ch_immort )
>                       return FALSE;
>       }
>       if ( xIS_SET( ch->act, PLR_HOLYLIGHT ) )
>               return TRUE;
>       if ( !IS_AFFECTED( ch, AFF_TRUESIGHT ) )
>       {
>               if ( IS_AFFECTED( ch, AFF_BLIND ) )
>                       return FALSE;
>               /*
>                * if ( room_is_dark( victim->in_room ) && !IS_AFFECTED(ch, AFF_INFRARED) )
>                * return FALSE; 
>                */
>               if ( IS_AFFECTED( victim, AFF_INVISIBLE ) && !IS_AFFECTED( ch, AFF_DETECT_INVIS ) )
>                       return FALSE;
>               if ( IS_AFFECTED( victim, AFF_HIDE )
>                       && !IS_AFFECTED( ch, AFF_DETECT_HIDDEN ) && ( IS_NPC( ch ) != IS_NPC( victim ) ) )
>                       return FALSE;
>       }
>       if ( NOT_AUTHED( victim ) && !ch_immort )
>               return FALSE;
>       return TRUE;
> }
3605c3799,3800
<               found++;
---
> typedef enum
> { CTN_ROOM, CTN_MOB } ct_type;
3607,3615c3802,3865
<               for ( cnt = 0, in_obj = obj; in_obj->in_obj && cnt < 100; in_obj = in_obj->in_obj, ++cnt )
<                       ;
<               if ( cnt >= MAX_NEST )
<               {
<                       sprintf( buf, "spell_locate_obj: object [%d] %s is nested more than %d times!",
<                               obj->pIndexData->vnum, obj->short_descr, MAX_NEST );
<                       bug( buf, 0 );
<                       continue;
<               }
---
> typedef struct keyw_node KEYW_NODE;
> struct keyw_node
> {
>       KEYW_NODE *next;
>       char *key;
>       bool ok;
> };
> 
> KEYW_NODE *keyw_hash[1024];
> KEYW_NODE *keyw_vec;
> int keyw_num;
> 
> typedef struct pairs_node PAIRS_NODE;
> struct pairs_node
> {
>       PAIRS_NODE *next;
>       char *desc;
>       char *cont;
>       int num;
>       ct_type ct;
> };
> 
> PAIRS_NODE *pairs_hash[512];
> PAIRS_NODE *pairs_vec;
> int pairs_num;
> int pair_overflow;
> 
> typedef struct print_node PRINT_NODE;
> struct print_node
> {
>       PRINT_NODE *next;
>       PAIRS_NODE *obj;
> };
> 
> PRINT_NODE *print_hash[512];
> PRINT_NODE *print_vec;
> int print_num;
> 
> extern int top_obj_index;
> 
> char *cont_descr( void *cont, ct_type t )
> {
>       CHAR_DATA *mob;
> 
>       if ( !cont )
>               return NULL;
>       if ( t == CTN_ROOM )
>               return ( ( ROOM_INDEX_DATA * ) cont )->name;
>       mob = cont;
>       return IS_NPC( mob ) ? mob->short_descr : mob->name;
> }
> 
> /* a _should_ be a 32 bits integer. Returns a 10 bits key */
> #define iKEYW( a )   ( ( ( ( int ) a >> 2 ) ^ ( ( int ) a >> 12 ) ^ ( ( int ) a >> 22 ) ) & 1023 )
> /* Like iKEYW, but returns a 9 bits key */
> #define iKEYP( a )   ( ( ( ( int ) a >> 2 ) ^ ( ( int ) a >> 11 ) ^ ( ( int ) a >> 20 ) ) & 511 )
> 
> #define MAX_PAIRS 2000
> 
> void build_pairs( CHAR_DATA * ch, OBJ_DATA * obj, void *ctn, ct_type ctp, char *ct_name, int nest )
> {
>       KEYW_NODE *keyw;
>       PAIRS_NODE *pair;
>       int idx, pkey;
3617c3867,3874
<               if ( in_obj->carried_by )
---
>       if ( nest > 100 )
>       {
>               log_string( "Pairs nest level exceeded." );
>               return;
>       }
>       for ( ; obj; obj = obj->next_content )
>       {
>               if ( can_locate_obj( ch, obj ) )
3619,3622c3876,3880
<                       if ( IS_IMMORTAL( in_obj->carried_by )
<                               && !IS_NPC( in_obj->carried_by )
<                               && ( get_trust( ch ) < in_obj->carried_by->pcdata->wizinvis )
<                               && xIS_SET( in_obj->carried_by->act, PLR_WIZINVIS ) )
---
>                       idx = iKEYW( obj->name );
>                       for ( keyw = keyw_hash[idx]; keyw; keyw = keyw->next )
>                               if ( keyw->key == obj->name )
>                                       break;
>                       if ( !keyw && keyw_num < top_obj_index )
3624,3625c3882,3908
<                               found--;
<                               continue;
---
>                               keyw = keyw_vec + keyw_num++;
>                               keyw->key = obj->name;
>                               keyw->ok = nifty_is_name( target_name, obj->name );
>                               keyw->next = keyw_hash[idx];
>                               keyw_hash[idx] = keyw;
>                       }
>                       if ( keyw ? keyw->ok : nifty_is_name( target_name, obj->name ) )
>                       {
>                               pkey = ( int ) ( obj->short_descr ) ^ ( int ) ct_name ^ ( ctp << 2 );
>                               idx = iKEYP( pkey );
>                               for ( pair = pairs_hash[idx]; pair; pair = pair->next )
>                                       if ( pair->desc == obj->short_descr && pair->cont == ct_name && pair->ct == ctp )
>                                               break;
>                               if ( !pair && pairs_num < MAX_PAIRS )
>                               {
>                                       pair = pairs_vec + pairs_num++;
>                                       pair->desc = obj->short_descr;
>                                       pair->cont = ct_name;
>                                       pair->ct = ctp;
>                                       pair->num = obj->count;
>                                       pair->next = pairs_hash[idx];
>                                       pairs_hash[idx] = pair;
>                               }
>                               else if ( pair )
>                                       pair->num += obj->count;
>                               else
>                                       pair_overflow++;
3627,3628c3910,3911
< 
<                       sprintf( buf, "%s carried by %s.\n\r", obj_short( obj ), PERS( in_obj->carried_by, ch ) );
---
>                       if ( obj->first_content )
>                               build_pairs( ch, obj->first_content, ctn, ctp, ct_name, nest + 1 );
3630c3913,3949
<               else
---
>       }
> }
> 
> ch_ret spell_locate_object( int sn, int level, CHAR_DATA * ch, void *vo )
> {
>       extern ROOM_INDEX_DATA *room_index_hash[MAX_KEY_HASH];
>       ROOM_INDEX_DATA *room;
>       CHAR_DATA *mob;
>       PRINT_NODE *objprn;
>       PAIRS_NODE *locprn, *nextpair;
>       int x, objnum, hitnum, idx;
>       char msg[2048];
> 
>       for ( x = 0; x < 1024; x++ )
>               keyw_hash[x] = NULL;
>       keyw_vec = malloc( top_obj_index * sizeof( KEYW_NODE ) );
>       keyw_num = 0;
>       for ( x = 0; x < 512; x++ )
>               pairs_hash[x] = NULL;
>       pairs_vec = malloc( MAX_PAIRS * sizeof( PAIRS_NODE ) );
>       pairs_num = 0;
>       if ( !keyw_vec || !pairs_vec )
>       {
>               if ( keyw_vec )
>                       free( keyw_vec );
>               if ( pairs_vec )
>                       free( pairs_vec );
>               set_char_color( AT_MAGIC, ch );
>               send_to_char( "You failed.\n\r", ch );
>               sprintf( msg, "Locate object low on memory for %s.", ch->name );
>               log_string( msg );
>               return rSPELL_FAILED;
>       }
>       pair_overflow = 0;
>       for ( x = 0; x < MAX_KEY_HASH; x++ )
>       {
>               for ( room = room_index_hash[x]; room; room = room->next )
3632,3633c3951,3957
<                       sprintf( buf, "%s in %s.\n\r",
<                               obj_short( obj ), in_obj->in_room == NULL ? "somewhere" : in_obj->in_room->name );
---
>                       if ( xIS_SET( room->room_flags, ROOM_NOLOCATE )
>                               || xIS_SET( room->room_flags, ROOM_CLANSTOREROOM ) || xIS_SET( room->room_flags, ROOM_HOUSE ) )
>                               continue;
>                       build_pairs( ch, room->first_content, room, CTN_ROOM, room->name, 1 );
>                       for ( mob = room->first_person; mob; mob = mob->next_in_room )
>                               if ( can_locate_mob( ch, mob ) )
>                                       build_pairs( ch, mob->first_carrying, mob, CTN_MOB, cont_descr( mob, CTN_MOB ), 1 );
3635,3636c3959,3972
< 
<               buf[0] = UPPER( buf[0] );
---
>       }
>       if ( pair_overflow )
>       {
>               sprintf( msg, "Pair overflowed by %d locating %s.", pair_overflow, target_name );
>               log_string( msg );
>       }
>       free( keyw_vec );
>       for ( x = 0; x < 512; x++ )
>               print_hash[x] = NULL;
>       print_vec = malloc( MAX_PAIRS * sizeof( PRINT_NODE ) );
>       print_num = 0;
>       if ( !print_vec )
>       {
>               free( pairs_vec );
3638,3647c3974,3977
< 
< /*
<       Gorog added this 98/09/02 but obj_short(obj) now nukes memory
<       and crashes us when the resulting buffer is sent to the pager
<       (not confined to just pager_printf).  Something else somewhere
<       else must have changed recently to exacerbate this problem,
<       as it is now a guaranteed crash cause. - Blodkai
<       pager_printf( ch, buf );
< */
<               send_to_char( buf, ch );
---
>               send_to_char( "You failed.\n\r", ch );
>               sprintf( msg, "Locate object low on memory for %s.", ch->name );
>               log_string( msg );
>               return rSPELL_FAILED;
3649,3650c3979,4032
< 
<       if ( !found )
---
>       for ( x = 0; x < 512; x++ )
>               for ( locprn = pairs_hash[x]; locprn; locprn = nextpair )
>               {
>                       nextpair = locprn->next;
>                       idx = iKEYP( locprn->desc );
>                       for ( objprn = print_hash[idx]; objprn; objprn = objprn->next )
>                               if ( objprn->obj->desc == locprn->desc )
>                                       break;
>                       if ( !objprn )
>                       {
>                               objprn = print_vec + print_num++;
>                               objprn->next = print_hash[idx];
>                               print_hash[idx] = objprn;
>                               locprn->next = NULL;
>                               objprn->obj = locprn;
>                       }
>                       else
>                       {
>                               locprn->next = objprn->obj;
>                               objprn->obj = locprn;
>                       }
>               }
>       objnum = hitnum = 0;
>       set_char_color( AT_MAGIC, ch );
>       send_to_char( "For a brief moment, your awareness expands to encompass the whole world...\n\r", ch );
>       for ( x = 0; x < 512; x++ )
>               for ( objprn = print_hash[x]; objprn; objprn = objprn->next )
>               {
>                       bool multi;
> 
>                       if ( !objnum )
>                               send_to_char( "...and you find to be in existence:\n\r\n\r", ch );
>                       send_to_char( objprn->obj->desc, ch );
>                       multi = FALSE;
>                       for ( locprn = objprn->obj; locprn; locprn = locprn->next )
>                       {
>                               if ( locprn == objprn->obj && locprn->next )
>                               {
>                                       send_to_char( ":\n\r", ch );
>                                       multi = TRUE;
>                               }
>                               ch_printf( ch,
>                                       /*
>                                        * multi ? "  %3d%s%s\n\r" : " (%d)%s%s\n\r",
>                                        * locprn->num, 
>                                        */
>                                       multi ? "  %s%s\n\r" : "%s%s\n\r", locprn->ct == CTN_ROOM ? " in " : " on ", locprn->cont );
>                               hitnum++;
>                       }
>                       objnum++;
>               }
>       free( print_vec );
>       free( pairs_vec );
>       if ( !objnum )
3652c4034
<               send_to_char( "Nothing like that exists.\n\r", ch );
---
>               send_to_char( "...but nothing like that exists.\n\r", ch );
3654a4037,4061
>       /*
>        * Locate is eating too much cpu time. 
>        */
>       if ( IS_IMMORTAL( ch ) )
>               ch_printf( ch, "\n\rFound %d instances of %d objects.\n\r", hitnum, objnum );
>       else if ( hitnum )
>       {
>               x = ( hitnum * 3 ) / ( get_curr_wis( ch ) + get_curr_int( ch ) );
>               if ( x )
>               {
>                       if ( x < 3 )
>                               ;
>                       else if ( x < 10 )
>                               send_to_char( "\n\r... your mind is unable to cope with this much information...\n\r", ch );
>                       else if ( x < 20 )
>                               send_to_char( "\n\r...your mind is SHATTERED by the flood of information!\n\r", ch );
>                       else
>                       {
>                               send_to_char( "\n\r...ENOUGH!  Your mortal mind was not meant for omniscience.\n\r", ch );
>                               send_to_char( "What is left of it may need time to recover from this ordeal...\n\r", ch );
>                       }
>                       x = ch->mental_state < 0 ? -x : x;
>                       ch->mental_state = URANGE( -ch->level, ch->mental_state + x / 5, ch->level );
>               }
>       }
3659a4067,4068
> 
> 
3735c4144,4147
<       af.type = sn;
---
>       /*
>        * af.type      = sn; -Only till I fix SN's 
>        */
>       af.type = gsn_poison;
3843c4255
<       if ( chance( ch, 70 + get_curr_wis( ch ) ) )
---
>       if ( !chance( ch, 70 + get_curr_wis( ch ) ) )
3922c4334,4335
<               || ( victim != ch && IS_SET( victim->in_room->room_flags, ROOM_SAFE ) ) || saves_spell_staff( chance, victim ) )
---
>               || ( victim != ch && xIS_SET( victim->in_room->room_flags, ROOM_SAFE ) )
>               || saves_spell_staff( chance, victim ) )
3975,3980c4388,4393
<               || IS_SET( ch->in_room->room_flags, ROOM_NO_ASTRAL )
<               || IS_SET( victim->in_room->room_flags, ROOM_SAFE )
<               || IS_SET( victim->in_room->room_flags, ROOM_PRIVATE )
<               || IS_SET( victim->in_room->room_flags, ROOM_SOLITARY )
<               || IS_SET( victim->in_room->room_flags, ROOM_NO_SUMMON )
<               || IS_SET( victim->in_room->room_flags, ROOM_NO_RECALL )
---
>               || xIS_SET( ch->in_room->room_flags, ROOM_NO_ASTRAL )
>               || xIS_SET( victim->in_room->room_flags, ROOM_SAFE )
>               || xIS_SET( victim->in_room->room_flags, ROOM_PRIVATE )
>               || xIS_SET( victim->in_room->room_flags, ROOM_SOLITARY )
>               || xIS_SET( victim->in_room->room_flags, ROOM_NO_SUMMON )
>               || xIS_SET( victim->in_room->room_flags, ROOM_NO_RECALL )
3982a4396
>               || victim->in_room == ch->in_room
3983a4398
>               || ( IS_NPC( victim ) && xIS_SET( victim->act, ACT_AGGRESSIVE ) )
4019c4434,4452
<       char_to_room( victim, ch->in_room );
---
>       if ( sysdata.magichell && ch->level > 35 )
>       {
>               ROOM_INDEX_DATA *troom;
> 
>               for ( ;; )
>               {
>                       troom = get_room_index( number_range( 1300, 100000 ) );
>                       if ( troom )
>                               if ( !troom->first_person && !xIS_SET( troom->room_flags, ROOM_DEATH ) )
>                                       break;
>               }
> 
>               if ( troom && can_astral_room( troom ) )
>                       char_to_room( victim, troom );
>               else
>                       char_to_room( victim, ch->in_room );
>       }
>       else
>               char_to_room( victim, ch->in_room );
4054c4487,4505
<       char_to_room( ch, victim->in_room );
---
>       if ( sysdata.magichell && ch->level > 35 )
>       {
>               ROOM_INDEX_DATA *troom;
> 
>               for ( ;; )
>               {
>                       troom = get_room_index( number_range( 1300, 100000 ) );
>                       if ( troom )
>                               if ( !troom->first_person && !xIS_SET( troom->room_flags, ROOM_DEATH ) )
>                                       break;
>               }
> 
>               if ( troom && can_astral_room( troom ) )
>                       char_to_room( ch, troom );
>               else
>                       char_to_room( ch, victim->in_room );
>       }
>       else
>               char_to_room( ch, victim->in_room );
4072c4523
<               || IS_SET( victim->in_room->room_flags, ROOM_NO_RECALL )
---
>               || xIS_SET( victim->in_room->room_flags, ROOM_NO_RECALL )
4082c4533
<               pRoomIndex = get_room_index( number_range( 0, 32767 ) );
---
>               pRoomIndex = get_room_index( number_range( 0, MAX_VNUM ) );
4084,4086c4535,4537
<                       if ( !IS_SET( pRoomIndex->room_flags, ROOM_PRIVATE )
<                               && !IS_SET( pRoomIndex->room_flags, ROOM_SOLITARY )
<                               && !IS_SET( pRoomIndex->room_flags, ROOM_NO_ASTRAL )
---
>                       if ( !xIS_SET( pRoomIndex->room_flags, ROOM_PRIVATE )
>                               && !xIS_SET( pRoomIndex->room_flags, ROOM_SOLITARY )
>                               && !xIS_SET( pRoomIndex->room_flags, ROOM_NO_ASTRAL )
4088,4089c4539,4540
<                               && !IS_SET( pRoomIndex->room_flags, ROOM_PROTOTYPE )
<                               && !IS_SET( pRoomIndex->room_flags, ROOM_NO_RECALL ) && in_hard_range( ch, pRoomIndex->area ) )
---
>                               && !xIS_SET( pRoomIndex->room_flags, ROOM_PROTOTYPE )
>                               && !xIS_SET( pRoomIndex->room_flags, ROOM_NO_RECALL ) && in_hard_range( ch, pRoomIndex->area ) )
4095c4546,4564
<       char_to_room( victim, pRoomIndex );
---
>       if ( sysdata.magichell && ch->level > 35 )
>       {
>               ROOM_INDEX_DATA *troom;
> 
>               for ( ;; )
>               {
>                       troom = get_room_index( number_range( 1300, 100000 ) );
>                       if ( troom )
>                               if ( !troom->first_person && !xIS_SET( troom->room_flags, ROOM_DEATH ) )
>                                       break;
>               }
> 
>               if ( troom && can_astral_room( troom ) )
>                       char_to_room( victim, troom );
>               else
>                       char_to_room( victim, pRoomIndex );
>       }
>       else
>               char_to_room( victim, pRoomIndex );
4101a4571,4633
> #ifdef MYSTARIC
> /*
>  * Group Teleport Spell
>  * Mystaric Sept. 15, 99
>  *
>  */
> 
> /*  Returns the number ot people within a grouped party */
> int number_in_group( CHAR_DATA * ch )
> {
>       CHAR_DATA *nch, *nch_next;
>       ROOM_INDEX_DATA *start = ch->in_room;
>       int number = 0;
> 
>       for ( nch = start->first_person; nch; nch = nch_next )
>       {
>               nch_next = nch->next_in_room;
>               if ( is_same_group( nch, ch ) )
>                       number += 1;
>       }
>       return number;
> }
> 
> ch_ret spell_group_teleport( int sn, int level, CHAR_DATA * ch, void *vo )
> {
>       CHAR_DATA *victim = ( CHAR_DATA * ) vo;
>       CHAR_DATA *nch, *nch_next;
>       ROOM_INDEX_DATA *start = ch->in_room, *pRoomIndex;
>       SKILLTYPE *skill = get_skilltype( sn );
>       int mana;
> 
>       if ( !victim )
>               victim = ch;
> 
>       if ( !victim->in_room
>               || xIS_SET( victim->in_room->room_flags, ROOM_NO_RECALL )
>               || ( !IS_NPC( ch ) && victim->fighting )
>               || ( victim != ch && ( saves_spell_staff( level, victim ) || saves_wands( level, victim ) ) ) )
>       {
>               failed_casting( skill, ch, victim, NULL );
>               return rSPELL_FAILED;
>       }
> 
>       for ( ;; )
>       {
>               pRoomIndex = get_room_index( number_range( 0, MAX_VNUM ) );
>               if ( pRoomIndex )
>                       if ( pRoomIndex != start )
>                               if ( !xIS_SET( pRoomIndex->room_flags, ROOM_PRIVATE )
>                                       && !xIS_SET( pRoomIndex->room_flags, ROOM_SOLITARY )
>                                       && !xIS_SET( pRoomIndex->room_flags, ROOM_NO_ASTRAL )
>                                       && !IS_SET( pRoomIndex->area->flags, AFLAG_NOTELEPORT )
>                                       && !xIS_SET( pRoomIndex->room_flags, ROOM_PROTOTYPE )
>                                       && !xIS_SET( pRoomIndex->room_flags, ROOM_NO_RECALL ) && in_hard_range( ch, pRoomIndex->area ) )
>                                       break;
>       }
> 
>       mana = number_in_group( victim ) * 100;
>       if ( !IS_NPC( ch ) && ch->mana < mana )
>       {
>               send_to_char( "You don't have enough mana.\n\r", ch );
>               return rSPELL_FAILED;
>       }
4102a4635,4700
>       act( AT_MAGIC, "$n's arms rise towards the sky, a tornado engulfs the area.", victim, NULL, NULL, TO_ROOM );
>       act( AT_MAGIC, "$n's group is sucked into the raging tornadoes.", victim, NULL, NULL, TO_ROOM );
> 
>       char_from_room( victim );
>       if ( sysdata.magichell && ch->level > 35 )
>       {
>               ROOM_INDEX_DATA *troom;
> 
>               for ( ;; )
>               {
>                       troom = get_room_index( number_range( 1300, 100000 ) );
>                       if ( troom )
>                               if ( !troom->first_person && !xIS_SET( troom->room_flags, ROOM_DEATH ) )
>                                       break;
>               }
> 
>               if ( troom && can_astral_room( troom ) )
>                       char_to_room( victim, troom );
>               else
>                       char_to_room( victim, pRoomIndex );
>       }
>       else
>               char_to_room( victim, pRoomIndex );
>       do_look( victim, "auto" );
> 
>       for ( nch = start->first_person; nch; nch = nch_next )
>       {
>               nch_next = nch->next_in_room;
>               if ( is_same_group( nch, victim ) && ( in_hard_range( nch, pRoomIndex->area ) ) )
>               {
>                       char_from_room( nch );
>                       char_to_room( nch, pRoomIndex );
>                       if ( !IS_NPC( nch ) )
>                               do_look( nch, "auto" );
>               }
>       }
>       victim->mana -= mana;
>       return rNONE;
> }
> #endif
> 
> /*
> ch_ret spell_ventriloquate( int sn, int level, CHAR_DATA *ch, void *vo )
> {
>     char buf1[MAX_STRING_LENGTH];
>     char buf2[MAX_STRING_LENGTH];
>     char speaker[MAX_INPUT_LENGTH];
>     CHAR_DATA *vch;
> 
>     target_name = one_argument( target_name, speaker );
> 
>     sprintf( buf1, "%s says '%s'.\n\r",              speaker, target_name );
>     sprintf( buf2, "Someone makes %s say '%s'.\n\r", speaker, target_name );
>     buf1[0] = UPPER(buf1[0]);
> 
>     for ( vch = ch->in_room->first_person; vch; vch = vch->next_in_room )
>     {
>       if ( !is_name( speaker, vch->name ) ) {
>           set_char_color( AT_SAY, vch );
>           send_to_char( saves_spell_staff( level, vch ) ? buf2 : buf1, vch );
>       }
>     }
> 
>     return rNONE;
> }
> */
4107a4706
>       char buf3[MAX_STRING_LENGTH];
4111a4711,4715
>       if ( speaker[0] == '\0' )
>       {
>               send_to_char( "Your voice sputters as you try to cast it in random directions.\n\r", ch );
>               return rSPELL_FAILED;
>       }
4114a4719
>       sprintf( buf3, "%s makes %s say '%s'.\n\r", capitalize( ch->name ), speaker, target_name );
4122c4727,4730
<                       send_to_char( saves_spell_staff( level, vch ) ? buf2 : buf1, vch );
---
>                       if ( get_trust( vch ) >= LEVEL_IMMORTAL )
>                               send_to_char( buf3, vch );
>                       else
>                               send_to_char( saves_spell_staff( level, vch ) ? buf2 : buf1, vch );
4130d4737
< 
4374c4981
<       if ( IS_SET( ch->in_room->room_flags, ROOM_SAFE ) )
---
>       if ( xIS_SET( ch->in_room->room_flags, ROOM_SAFE ) )
4383a4991,4993
>               if ( IS_NPC( vch ) && xIS_SET( vch->act, ACT_MOBINVIS ) )
>                       continue;
> 
4458,4463c5068,5073
<               || IS_SET( victim->in_room->room_flags, ROOM_PRIVATE )
<               || IS_SET( victim->in_room->room_flags, ROOM_SOLITARY )
<               || IS_SET( victim->in_room->room_flags, ROOM_NO_ASTRAL )
<               || IS_SET( victim->in_room->room_flags, ROOM_DEATH )
<               || IS_SET( victim->in_room->room_flags, ROOM_PROTOTYPE )
<               || IS_SET( ch->in_room->room_flags, ROOM_NO_RECALL )
---
>               || xIS_SET( victim->in_room->room_flags, ROOM_PRIVATE )
>               || xIS_SET( victim->in_room->room_flags, ROOM_SOLITARY )
>               || xIS_SET( victim->in_room->room_flags, ROOM_NO_ASTRAL )
>               || xIS_SET( victim->in_room->room_flags, ROOM_DEATH )
>               || xIS_SET( victim->in_room->room_flags, ROOM_PROTOTYPE )
>               || xIS_SET( ch->in_room->room_flags, ROOM_NO_RECALL )
4489c5099
<       if ( IS_OBJ_STAT( obj, ITEM_NODROP ) )
---
>       if ( IS_OBJ_STAT( obj, ITEM_NODROP ) || IS_OBJ_STAT( obj, ITEM_PERMANENT ) )
4511a5122,5143
> ch_ret spell_close_portal( int sn, int level, CHAR_DATA * ch, void *vo )
> {
> 
>       OBJ_DATA *obj;
>       OBJ_DATA *obj_next;
> 
>       for ( obj = ch->in_room->first_content; obj; obj = obj_next )
>       {
>               obj_next = obj->next_content;
>               if ( obj->item_type == ITEM_PORTAL )
>               {
>                       remove_portal( obj );
>                       obj->item_type = ITEM_TRASH;
>                       extract_obj( obj );
>                       act( AT_MAGIC, "As $n utters a lengthy incantation, the portal spins into nothingness.", ch, NULL, NULL,
>                               TO_ROOM );
>                       act( AT_MAGIC, "As you utter a lengthy incantation, the portal spins into nothingness.", ch, NULL, NULL,
>                               TO_CHAR );
>               }
>       }
>       return rNONE;
> }
4513,4519d5144
< /*
<  * Syntax portal (mob/char) 
<  * opens a 2-way EX_PORTAL from caster's room to room inhabited by  
<  *  mob or character won't mess with existing exits
<  *
<  * do_mp_open_passage, combined with spell_astral
<  */
4537,4544c5162,5173
<               || IS_SET( victim->in_room->room_flags, ROOM_PRIVATE )
<               || IS_SET( victim->in_room->room_flags, ROOM_SOLITARY )
<               || IS_SET( victim->in_room->room_flags, ROOM_NO_ASTRAL )
<               || IS_SET( victim->in_room->room_flags, ROOM_DEATH )
<               || IS_SET( victim->in_room->room_flags, ROOM_NO_RECALL )
<               || IS_SET( victim->in_room->room_flags, ROOM_PROTOTYPE )
<               || IS_SET( ch->in_room->room_flags, ROOM_NO_RECALL )
<               || IS_SET( ch->in_room->room_flags, ROOM_NO_ASTRAL )
---
>               || xIS_SET( victim->in_room->room_flags, ROOM_PRIVATE )
>               || xIS_SET( victim->in_room->room_flags, ROOM_SOLITARY )
>               || xIS_SET( victim->in_room->room_flags, ROOM_NO_ASTRAL )
>               || xIS_SET( victim->in_room->room_flags, ROOM_DEATH )
>               || xIS_SET( victim->in_room->room_flags, ROOM_NO_RECALL )
>               || xIS_SET( victim->in_room->room_flags, ROOM_PROTOTYPE )
>               || xIS_SET( ch->in_room->room_flags, ROOM_NO_RECALL )
>               || xIS_SET( ch->in_room->room_flags, ROOM_NO_ASTRAL )
>               || IS_SET( ch->in_room->area->flags, AFLAG_NOPORTALOUT )
>               || IS_SET( victim->in_room->area->flags, AFLAG_NOPORTALIN )
>               || IS_SET( victim->in_room->area->flags, AFLAG_NOASTRAL )
>               || IS_SET( ch->in_room->area->flags, AFLAG_NOASTRAL )
4661,4666c5290,5295
<               || IS_SET( victim->in_room->room_flags, ROOM_PRIVATE )
<               || IS_SET( victim->in_room->room_flags, ROOM_SOLITARY )
<               || IS_SET( victim->in_room->room_flags, ROOM_NO_ASTRAL )
<               || IS_SET( victim->in_room->room_flags, ROOM_DEATH )
<               || IS_SET( victim->in_room->room_flags, ROOM_PROTOTYPE )
<               || IS_SET( ch->in_room->room_flags, ROOM_NO_RECALL )
---
>               || xIS_SET( victim->in_room->room_flags, ROOM_PRIVATE )
>               || xIS_SET( victim->in_room->room_flags, ROOM_SOLITARY )
>               || xIS_SET( victim->in_room->room_flags, ROOM_NO_ASTRAL )
>               || xIS_SET( victim->in_room->room_flags, ROOM_DEATH )
>               || xIS_SET( victim->in_room->room_flags, ROOM_PROTOTYPE )
>               || xIS_SET( ch->in_room->room_flags, ROOM_NO_RECALL )
4685c5314,5332
<       char_to_room( ch, location );
---
>       if ( sysdata.magichell && ch->level > 35 )
>       {
>               ROOM_INDEX_DATA *troom;
> 
>               for ( ;; )
>               {
>                       troom = get_room_index( number_range( 1300, 100000 ) );
>                       if ( troom )
>                               if ( !troom->first_person && !xIS_SET( troom->room_flags, ROOM_DEATH ) )
>                                       break;
>               }
> 
>               if ( troom && can_astral_room( troom ) )
>                       char_to_room( ch, troom );
>               else
>                       char_to_room( ch, location );
>       }
>       else
>               char_to_room( ch, location );
4688a5336,5338
> 
>       if ( chance_attrib( victim, 20, get_curr_wis( victim ) ) && !IS_PKILL( ch ) )
>               send_to_char( "You get an uneasy feeling that you are being watched.\n\r", victim );
4762,4766c5412,5418
<               || IS_SET( victim->in_room->room_flags, ROOM_PRIVATE )
<               || IS_SET( victim->in_room->room_flags, ROOM_SOLITARY )
<               || IS_SET( victim->in_room->room_flags, ROOM_NO_ASTRAL )
<               || IS_SET( victim->in_room->room_flags, ROOM_DEATH )
<               || IS_SET( victim->in_room->room_flags, ROOM_PROTOTYPE )
---
>               || xIS_SET( victim->in_room->room_flags, ROOM_PRIVATE )
>               || xIS_SET( victim->in_room->room_flags, ROOM_SOLITARY )
>               || xIS_SET( victim->in_room->room_flags, ROOM_NO_ASTRAL )
>               || xIS_SET( victim->in_room->room_flags, ROOM_DEATH )
>               || xIS_SET( victim->in_room->room_flags, ROOM_PROTOTYPE )
>               || IS_SET( victim->in_room->area->flags, AFLAG_NOASTRAL )
>               || IS_SET( ch->in_room->area->flags, AFLAG_NOASTRAL )
4771c5423
<               || IS_SET( ch->in_room->room_flags, ROOM_NO_RECALL )
---
>               || xIS_SET( ch->in_room->room_flags, ROOM_NO_RECALL )
4788c5440,5458
<       char_to_room( ch, victim->in_room );
---
>       if ( sysdata.magichell && ch->level > 35 )
>       {
>               ROOM_INDEX_DATA *troom;
> 
>               for ( ;; )
>               {
>                       troom = get_room_index( number_range( 1300, 100000 ) );
>                       if ( troom )
>                               if ( !troom->first_person && !xIS_SET( troom->room_flags, ROOM_DEATH ) )
>                                       break;
>               }
> 
>               if ( troom && can_astral_room( troom ) )
>                       char_to_room( ch, troom );
>               else
>                       char_to_room( ch, victim->in_room );
>       }
>       else
>               char_to_room( ch, victim->in_room );
4822,4827c5492,5499
<               || IS_SET( victim->in_room->room_flags, ROOM_PRIVATE )
<               || IS_SET( victim->in_room->room_flags, ROOM_SOLITARY )
<               || IS_SET( victim->in_room->room_flags, ROOM_NO_ASTRAL )
<               || IS_SET( victim->in_room->room_flags, ROOM_DEATH )
<               || IS_SET( victim->in_room->room_flags, ROOM_PROTOTYPE )
<               || IS_SET( ch->in_room->room_flags, ROOM_NO_RECALL )
---
>               || xIS_SET( victim->in_room->room_flags, ROOM_PRIVATE )
>               || xIS_SET( victim->in_room->room_flags, ROOM_SOLITARY )
>               || xIS_SET( victim->in_room->room_flags, ROOM_NO_ASTRAL )
>               || xIS_SET( victim->in_room->room_flags, ROOM_DEATH )
>               || xIS_SET( victim->in_room->room_flags, ROOM_PROTOTYPE )
>               || IS_SET( victim->in_room->area->flags, AFLAG_NOASTRAL )
>               || IS_SET( ch->in_room->area->flags, AFLAG_NOASTRAL )
>               || xIS_SET( ch->in_room->room_flags, ROOM_NO_RECALL )
4848c5520,5538
<       char_to_room( ch, victim->in_room );
---
>       if ( sysdata.magichell && ch->level > 35 )
>       {
>               ROOM_INDEX_DATA *troom;
> 
>               for ( ;; )
>               {
>                       troom = get_room_index( number_range( 1300, 100000 ) );
>                       if ( troom )
>                               if ( !troom->first_person && !xIS_SET( troom->room_flags, ROOM_DEATH ) )
>                                       break;
>               }
> 
>               if ( troom && can_astral_room( troom ) )
>                       char_to_room( ch, troom );
>               else
>                       char_to_room( ch, victim->in_room );
>       }
>       else
>               char_to_room( ch, victim->in_room );
4870,4875c5560,5567
<               || IS_SET( victim->in_room->room_flags, ROOM_PRIVATE )
<               || IS_SET( victim->in_room->room_flags, ROOM_SOLITARY )
<               || IS_SET( victim->in_room->room_flags, ROOM_NO_ASTRAL )
<               || IS_SET( victim->in_room->room_flags, ROOM_DEATH )
<               || IS_SET( victim->in_room->room_flags, ROOM_PROTOTYPE )
<               || IS_SET( ch->in_room->room_flags, ROOM_NO_RECALL )
---
>               || xIS_SET( victim->in_room->room_flags, ROOM_PRIVATE )
>               || xIS_SET( victim->in_room->room_flags, ROOM_SOLITARY )
>               || xIS_SET( victim->in_room->room_flags, ROOM_NO_ASTRAL )
>               || xIS_SET( victim->in_room->room_flags, ROOM_DEATH )
>               || xIS_SET( victim->in_room->room_flags, ROOM_PROTOTYPE )
>               || xIS_SET( ch->in_room->room_flags, ROOM_NO_RECALL )
>               || IS_SET( victim->in_room->area->flags, AFLAG_NOASTRAL )
>               || IS_SET( ch->in_room->area->flags, AFLAG_NOASTRAL )
4889c5581,5599
<       char_to_room( ch, victim->in_room );
---
>       if ( sysdata.magichell && ch->level > 35 )
>       {
>               ROOM_INDEX_DATA *troom;
> 
>               for ( ;; )
>               {
>                       troom = get_room_index( number_range( 1300, 100000 ) );
>                       if ( troom )
>                               if ( !troom->first_person && !xIS_SET( troom->room_flags, ROOM_DEATH ) )
>                                       break;
>               }
> 
>               if ( troom && can_astral_room( troom ) )
>                       char_to_room( ch, troom );
>               else
>                       char_to_room( ch, victim->in_room );
>       }
>       else
>               char_to_room( ch, victim->in_room );
4908a5619
> 
4910a5622,5623
>               separate_obj( obj );
> 
5029c5742
<       if ( ( pMobIndex = get_mob_index( ( sh_int ) abs( corpse->cost ) ) ) == NULL )
---
>       if ( ( pMobIndex = get_mob_index( ( int ) abs( corpse->cost ) ) ) == NULL )
5067c5780,5783
<               mob->level = UMIN( ch->level / 2, pMobIndex->level );
---
> /* this used to base off level of mob, but plevelers were having a hay day */
> /* If someone comes up with a better way than making level 20, 200 hp mobs */
> /* feel free to change the level formula back */
>               mob->level = number_fuzzy( 5 );
5167a5884,5889
>       if ( IS_PACIFIST( victim ) )
>       {
>               immune_casting( skill, ch, victim, NULL );
>               return rVICT_IMMUNE;
>       }
> 
5274c5996
<       if ( IS_SET( ch->in_room->room_flags, ROOM_SAFE ) )
---
>       if ( xIS_SET( ch->in_room->room_flags, ROOM_SAFE ) )
5283a6006,6007
>               if ( IS_NPC( vch ) && xIS_SET( vch->act, ACT_MOBINVIS ) )
>                       continue;
5341,5346c6065,6072
<               || IS_SET( victim->in_room->room_flags, ROOM_PRIVATE )
<               || IS_SET( victim->in_room->room_flags, ROOM_SOLITARY )
<               || IS_SET( victim->in_room->room_flags, ROOM_NO_ASTRAL )
<               || IS_SET( victim->in_room->room_flags, ROOM_DEATH )
<               || IS_SET( victim->in_room->room_flags, ROOM_PROTOTYPE )
<               || IS_SET( ch->in_room->room_flags, ROOM_NO_RECALL )
---
>               || xIS_SET( victim->in_room->room_flags, ROOM_PRIVATE )
>               || xIS_SET( victim->in_room->room_flags, ROOM_SOLITARY )
>               || xIS_SET( victim->in_room->room_flags, ROOM_NO_ASTRAL )
>               || xIS_SET( victim->in_room->room_flags, ROOM_DEATH )
>               || xIS_SET( victim->in_room->room_flags, ROOM_PROTOTYPE )
>               || xIS_SET( ch->in_room->room_flags, ROOM_NO_RECALL )
>               || IS_SET( victim->in_room->area->flags, AFLAG_NOASTRAL )
>               || IS_SET( ch->in_room->area->flags, AFLAG_NOASTRAL )
5361c6087,6105
<       char_to_room( ch, victim->in_room );
---
>       if ( sysdata.magichell && ch->level > 35 )
>       {
>               ROOM_INDEX_DATA *troom;
> 
>               for ( ;; )
>               {
>                       troom = get_room_index( number_range( 1300, 100000 ) );
>                       if ( troom )
>                               if ( !troom->first_person && !xIS_SET( troom->room_flags, ROOM_DEATH ) )
>                                       break;
>               }
> 
>               if ( troom && can_astral_room( troom ) )
>                       char_to_room( ch, troom );
>               else
>                       char_to_room( ch, victim->in_room );
>       }
>       else
>               char_to_room( ch, victim->in_room );
5487c6231
<       if ( IS_SET( ch->in_room->room_flags, ROOM_SAFE ) )
---
>       if ( xIS_SET( ch->in_room->room_flags, ROOM_SAFE ) )
5502a6247,6249
>               if ( IS_NPC( vch ) && xIS_SET( vch->act, ACT_MOBINVIS ) )
>                       continue;
> 
5680c6427,6433
<                                       victim->hit = URANGE( 0, victim->hit + af.modifier, victim->max_hit );
---
> 
>                                       victim->hit = URANGE( 0, victim->hit + ( !IS_NPC( ch )
>                                                       && IS_NPC( victim ) ? af.modifier / 4 : af.modifier ), victim->max_hit );
> /*
> Blod - August, 2000
>                   victim->hit = URANGE( 0, victim->hit + af.modifier, victim->max_hit );
> */
5742a6496,6499
> 
>       if ( SPELL_FLAG( skill, SF_NOMOB ) && victim && IS_NPC( victim ) )
>               return rSPELL_FAILED;
> 
5753a6511,6513
>               if ( SPELL_FLAG( skill, SF_NOMOB ) && IS_NPC( victim ) )
>                       return rSPELL_FAILED;
> 
5820a6581
>                               || ( SPELL_FLAG( skill, SF_NOMOB ) && IS_NPC( victim ) )
6209c6970
<                               && !IS_SET( victim->in_room->room_flags, ROOM_NO_ASTRAL ) && SPELL_FLAG( skill, SF_CHARACTER ) )
---
>                               && !xIS_SET( victim->in_room->room_flags, ROOM_NO_ASTRAL ) && SPELL_FLAG( skill, SF_CHARACTER ) )
6513c7274
<       dam = 1.3 * ( l * number_range( 1, 40 ) + 145 );
---
>       dam = 1.3 * ( l * number_range( 1, 30 ) + 145 );
6568a7330,7332
>       char buf[MAX_STRING_LENGTH];
>       char buf2[MAX_STRING_LENGTH];
>       char buf3[MAX_STRING_LENGTH];
6573c7337
<       if ( IS_OBJ_STAT( obj, ITEM_NODROP ) )
---
>       if ( IS_OBJ_STAT( obj, ITEM_NODROP ) || IS_OBJ_STAT( obj, ITEM_PERMANENT ) )
6585c7349,7351
<       if ( !CAN_WEAR( obj, ITEM_TAKE ) || ( obj->item_type == ITEM_CORPSE_NPC ) || ( obj->item_type == ITEM_CORPSE_PC ) )
---
>       if ( !CAN_WEAR( obj, ITEM_TAKE )
>               || ( obj->item_type == ITEM_CORPSE_NPC )
>               || ( obj->item_type == ITEM_CORPSE_PC ) || ( obj->item_type == ITEM_KEY ) )
6593c7359
<       val = obj->cost / 2;
---
>       val = obj->cost / 3;
6706c7472,7547
<       if ( victim == NULL )
---
>       if ( obj->item_type != ITEM_TREASURE )
>       {
>               if ( get_curr_int( ch ) > 19 && get_curr_wis( ch ) > 19 )
>               {
>                       if ( number_bits( 3 ) == 1 )
>                       {
>                               obj_from_char( obj );
>                               obj->item_type = ITEM_TREASURE;
>                               obj->timer = -1;
>                               obj->value[0] = 0;
>                               obj->value[1] = 0;
>                               obj->value[2] = 0;
>                               obj->value[3] = 0;
>                               obj->value[4] = 0;
>                               obj->value[5] = 0;
>                               obj->cost = obj->cost * 2;
>                               obj->weight = obj->weight * 2;
>                               ch_printf_color( ch, "&YA yellowish glow slowly seeps over the item, leaving behind pure gold.\n\r" );
>                               sprintf( buf, "(Gold) %s", obj->short_descr );
>                               STRFREE( obj->short_descr );
>                               obj->short_descr = STRALLOC( buf );
>                               sprintf( buf2, "%s %s", obj->name, "midas gold" );
>                               STRFREE( obj->name );
>                               obj->name = STRALLOC( buf2 );
>                               sprintf( buf3, "(Gold) %s", obj->description );
>                               STRFREE( obj->description );
>                               obj->description = STRALLOC( buf3 );
>                               if ( ch->carry_weight + get_obj_weight( obj ) > can_carry_w( ch ) )
>                               {
>                                       act( AT_ACTION, "The item is suddenly too heavy for you to carry.", ch, NULL, NULL, TO_CHAR );
>                                       act( AT_ACTION, "You drop $p.", ch, obj, NULL, TO_CHAR );
>                                       act( AT_ACTION, "$n drops $p.", ch, obj, NULL, TO_ROOM );
>                                       obj_to_room( obj, ch->in_room );
>                               }
>                               else
>                                       obj_to_char( obj, ch );
>                               return rNONE;
>                       }
>               }
>               else if ( number_bits( 6 ) == 1 )
>               {
>                       obj_from_char( obj );
>                       obj->item_type = ITEM_TREASURE;
>                       obj->timer = -1;
>                       obj->value[0] = 0;
>                       obj->value[1] = 0;
>                       obj->value[2] = 0;
>                       obj->value[3] = 0;
>                       obj->value[4] = 0;
>                       obj->value[5] = 0;
>                       obj->cost = obj->cost * 2;
>                       obj->weight = obj->weight * 2;
>                       ch_printf_color( ch, "&YA yellowish glow slowly seeps over the item, leaving behind pure gold.\n\r" );
>                       sprintf( buf, "(Gold) %s", obj->short_descr );
>                       STRFREE( obj->short_descr );
>                       obj->short_descr = STRALLOC( buf );
>                       sprintf( buf2, "%s %s", obj->name, "midas gold" );
>                       STRFREE( obj->name );
>                       obj->name = STRALLOC( buf2 );
>                       sprintf( buf3, "(Gold) %s", obj->description );
>                       STRFREE( obj->description );
>                       obj->description = STRALLOC( buf3 );
>                       if ( ch->carry_weight + get_obj_weight( obj ) > can_carry_w( ch ) )
>                       {
>                               act( AT_ACTION, "The item is suddenly too heavy for you to carry.", ch, NULL, NULL, TO_CHAR );
>                               act( AT_ACTION, "You drop $p.", ch, obj, NULL, TO_CHAR );
>                               act( AT_ACTION, "$n drops $p.", ch, obj, NULL, TO_ROOM );
>                               obj_to_room( obj, ch->in_room );
>                       }
>                       else
>                               obj_to_char( obj, ch );
>                       return rNONE;
>               }
>       }
> 
>       if ( victim == NULL || !IS_NPC( victim ) )
6715c7556
<               send_to_char( "Ok\n\r", ch );
---
>               send_to_char( "You transmogrify the item to gold!\n\r", ch );
6730c7571
<               send_to_char( "Ok\n\r", ch );
---
>               send_to_char( "You transmogrify the item to gold!\n\r", ch );
6734d7574
<