handler.c
demise/src/handler.c · 133.0 KB
From the archive dodbackup-final.tar.gz
Download the archive « Back to the archive contents
/***************************************************************************
* Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, *
* Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe. *
* *
* Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael *
* Chastain, Michael Quan, and Mitchell Tse. *
* *
* In order to use any part of this Merc Diku Mud, you must comply with *
* both the original Diku license in 'license.doc' as well the Merc *
* license in 'license.txt'. In particular, you may not remove either of *
* these copyright notices. *
* *
* Much time and thought has gone into this software and you are *
* benefitting. We hope that you share your changes too. What goes *
* around, comes around. *
***************************************************************************/
/***************************************************************************
* God Wars Mud improvements copyright (C) 1994, 1995, 1996 by Richard *
* Woolcock. This mud is NOT to be copied in whole or in part, or to be *
* run without the permission of Richard Woolcock. Nobody else has *
* permission to authorise the use of this code. *
***************************************************************************/
#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "merc.h"
AFFECT_DATA *affect_free;
ALIAS_DATA *alias_free;
/*
* Local functions.
*/
void
alias_remove (CHAR_DATA * ch, ALIAS_DATA * ali)
{
if (IS_NPC (ch))
return;
if (ch->pcdata->alias == NULL)
{
bug ("Alias_remove: no alias.", 0);
return;
}
if (ali == ch->pcdata->alias)
{
ch->pcdata->alias = ali->next;
}
else
{
ALIAS_DATA *prev;
for (prev = ch->pcdata->alias; prev; prev = prev->next)
{
if (prev->next == ali)
{
prev->next = ali->next;
break;
}
}
if (prev == NULL)
{
bug ("Alias_remove: cannot find ali.", 0);
return;
}
}
ali->next = alias_free;
alias_free = ali;
return;
}
/*
* Retrieve a character's trusted level for permission checking.
*/
int
get_trust (CHAR_DATA * ch)
{
if (ch->desc != NULL && ch->desc->original != NULL)
ch = ch->desc->original;
if (ch->trust != 0)
return ch->trust;
if (IS_NPC (ch) && ch->level >= LEVEL_HERO)
return LEVEL_HERO - 1;
else
return ch->level;
}
/*
* Retrieve a character's age.
*/
int
get_age (CHAR_DATA * ch)
{
return 17 + (ch->played + (int) (current_time - ch->logon)) / 7200;
}
int
get_hours (CHAR_DATA * ch)
{
return (ch->played + (int) (current_time - ch->logon)) / 3600;
}
/*
* Retrieve character's current strength.
*/
int
get_curr_str (CHAR_DATA * ch)
{
int max;
if (IS_NPC (ch))
return 13;
max = 25;
return URANGE (3, ch->pcdata->perm_str + ch->pcdata->mod_str, max);
}
/*
* Retrieve character's current intelligence.
*/
int
get_curr_int (CHAR_DATA * ch)
{
int max;
if (IS_NPC (ch))
return 13;
max = 25;
return URANGE (3, ch->pcdata->perm_int + ch->pcdata->mod_int, max);
}
/*
* Retrieve character's current wisdom.
*/
int
get_curr_wis (CHAR_DATA * ch)
{
int max;
if (IS_NPC (ch))
return 13;
max = 25;
return URANGE (3, ch->pcdata->perm_wis + ch->pcdata->mod_wis, max);
}
/*
* Retrieve character's current dexterity.
*/
int
get_curr_dex (CHAR_DATA * ch)
{
int max;
if (IS_NPC (ch))
return 13;
max = 25;
return URANGE (3, ch->pcdata->perm_dex + ch->pcdata->mod_dex, max);
}
/*
* Retrieve character's current constitution.
*/
int
get_curr_con (CHAR_DATA * ch)
{
int max;
if (IS_NPC (ch))
return 13;
max = 25;
return URANGE (3, ch->pcdata->perm_con + ch->pcdata->mod_con, max);
}
/*
* Retrieve a character's carry capacity.
*/
int
can_carry_n (CHAR_DATA * ch)
{
if (!IS_NPC (ch) && ch->level >= LEVEL_IMMORTAL)
return 1000;
if (IS_NPC (ch) && IS_SET (ch->act, ACT_PET))
return 0;
return MAX_WEAR + 10;
}
/*
* Retrieve a character's carry capacity.
*/
int
can_carry_w (CHAR_DATA * ch)
{
if (!IS_NPC (ch) && ch->level >= LEVEL_IMMORTAL)
return 1000000;
if (IS_NPC (ch) && IS_SET (ch->act, ACT_PET))
return 0;
return str_app[get_curr_str (ch)].carry;
}
/*
* See if a string is one of the names of an object.
*/
bool
is_name (const char *str, char *namelist)
{
char name[MIL];
for (;;)
{
namelist = one_argument (namelist, name);
if (name[0] == '\0')
return FALSE;
if (!str_cmp (str, name))
return TRUE;
}
}
/*
* Like is_name, but uses abbreviations.
*/
bool
is_abbr (const char *str, char *namelist)
{
char name[MIL];
for (;;)
{
namelist = one_argument (namelist, name);
if (name[0] == '\0') /* Ignore empty strings */
return FALSE;
if (name[1] == '\0') /* 1 char strings must be exact match */
{
if (!str_cmp (str, name))
return TRUE;
else
return FALSE;
}
else if (!str_prefix (str, name))
return TRUE;
}
return FALSE;
}
/*
* Gives the number of the string. KaVir.
*/
int
loc_name (const char *str, char *namelist)
{
int pos = 0;
char name[MIL];
for (;;)
{
namelist = one_argument (namelist, name);
if (name[0] == '\0')
return -1;
if (!str_cmp (str, name))
return pos;
pos++;
}
}
/*
* Apply or remove an affect to a character.
*/
void
affect_modify (CHAR_DATA * ch, AFFECT_DATA * paf, bool fAdd)
{
OBJ_DATA *wield;
int mod;
mod = paf->modifier;
if (fAdd)
{
SET_BIT (ch->affected_by, paf->bitvector);
}
else
{
REMOVE_BIT (ch->affected_by, paf->bitvector);
mod = 0 - mod;
}
if (IS_NPC (ch))
{
switch (paf->location)
{
default:
break;
case APPLY_NONE:
break;
case APPLY_MANA:
ch->max_mana += mod;
break;
case APPLY_HIT:
ch->max_hit += mod;
break;
case APPLY_MOVE:
ch->max_move += mod;
break;
case APPLY_AC:
ch->armor += mod;
break;
case APPLY_HITROLL:
ch->hitroll += mod;
break;
case APPLY_DAMROLL:
ch->damroll += mod;
break;
case APPLY_DAMCAP:
ch->damcapbonus += mod;
break;
case APPLY_SAVING_PARA:
ch->saving_throw += mod;
break;
case APPLY_SAVING_ROD:
ch->saving_throw += mod;
break;
case APPLY_SAVING_PETRI:
ch->saving_throw += mod;
break;
case APPLY_SAVING_BREATH:
ch->saving_throw += mod;
break;
case APPLY_SAVING_SPELL:
ch->saving_throw += mod;
break;
case APPLY_POLY:
ch->polyaff += mod;
break;
case APPLY_GENERATION:
ch->vampgen += mod;
break;
case APPLY_BLOOD_MAX:
ch->blood[BLOOD_POOL] += mod;
break;
case APPLY_BLOOD_POT:
ch->blood[BLOOD_POTENCY] += mod;
break;
}
return;
}
if (IS_HIGHLANDER (ch))
return;
switch (paf->location)
{
default:
bug ("Affect_modify: unknown location %d.", paf->location);
return;
case APPLY_NONE:
break;
case APPLY_STR:
ch->pcdata->mod_str += mod;
break;
case APPLY_DEX:
ch->pcdata->mod_dex += mod;
break;
case APPLY_INT:
ch->pcdata->mod_int += mod;
break;
case APPLY_WIS:
ch->pcdata->mod_wis += mod;
break;
case APPLY_CON:
ch->pcdata->mod_con += mod;
break;
case APPLY_SEX:
ch->sex += mod;
break;
case APPLY_CLASS:
break;
case APPLY_LEVEL:
break;
case APPLY_AGE:
break;
case APPLY_HEIGHT:
break;
case APPLY_WEIGHT:
break;
case APPLY_MANA:
ch->max_mana += mod;
break;
case APPLY_HIT:
ch->max_hit += mod;
break;
case APPLY_MOVE:
ch->max_move += mod;
break;
case APPLY_GOLD:
break;
case APPLY_EXP:
break;
case APPLY_AC:
ch->armor += mod;
break;
case APPLY_HITROLL:
ch->hitroll += mod;
break;
case APPLY_DAMROLL:
ch->damroll += mod;
break;
case APPLY_DAMCAP:
ch->damcapbonus += mod;
break;
case APPLY_MAGIC_RESISTANCE:
ch->pcdata->atm += mod;
break;
case APPLY_SAVING_PARA:
ch->saving_throw += mod;
break;
case APPLY_SAVING_ROD:
ch->saving_throw += mod;
break;
case APPLY_SAVING_PETRI:
ch->saving_throw += mod;
break;
case APPLY_SAVING_BREATH:
ch->saving_throw += mod;
break;
case APPLY_SAVING_SPELL:
ch->saving_throw += mod;
break;
case APPLY_POLY:
ch->polyaff += mod;
break;
case APPLY_GENERATION:
ch->vampgen += mod;
break;
case APPLY_ANIMALISM:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_ANIMALISM] += mod;
break;
case APPLY_AUSPEX:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_AUSPEX] += mod;
break;
case APPLY_CELERITY:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_CELERITY] += mod;
break;
case APPLY_CHIMERSTRY:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_CHIMERSTRY] += mod;
break;
case APPLY_DAIMOINON:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_DAIMOINON] += mod;
break;
case APPLY_DOMINATE:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_DOMINATE] += mod;
break;
case APPLY_FORTITUDE:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_FORTITUDE] += mod;
break;
case APPLY_MELPOMINEE:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_MELPOMINEE] += mod;
break;
case APPLY_NECROMANCY:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_NECROMANCY] += mod;
break;
case APPLY_OBEAH:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_OBEAH] += mod;
break;
case APPLY_OBFUSCATE:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_OBFUSCATE] += mod;
break;
case APPLY_OBTENEBRATION:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_OBTENEBRATION] += mod;
break;
case APPLY_POTENCE:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_POTENCE] += mod;
break;
case APPLY_PRESENCE:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_PRESENCE] += mod;
break;
case APPLY_PROTEAN:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_PROTEAN] += mod;
break;
case APPLY_QUIETUS:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_QUIETUS] += mod;
break;
case APPLY_SERPENTIS:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_SERPENTIS] += mod;
break;
case APPLY_THANATOSIS:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_THANATOSIS] += mod;
break;
case APPLY_THAUMATURGY:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_THAUMATURGY] += mod;
break;
case APPLY_VICISSITUDE:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_VICISSITUDE] += mod;
break;
case APPLY_SET_ANIMALISM:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_ANIMALISM] < mod)
ch->pcdata->powers_set[DISC_ANIMALISM] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_AUSPEX:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_AUSPEX] < mod)
ch->pcdata->powers_set[DISC_AUSPEX] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_CELERITY:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_CELERITY] < mod)
ch->pcdata->powers_set[DISC_CELERITY] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_CHIMERSTRY:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_CHIMERSTRY] < mod)
ch->pcdata->powers_set[DISC_CHIMERSTRY] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_DAIMOINON:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_DAIMOINON] < mod)
ch->pcdata->powers_set[DISC_DAIMOINON] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_DOMINATE:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_DOMINATE] < mod)
ch->pcdata->powers_set[DISC_DOMINATE] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_FORTITUDE:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_FORTITUDE] < mod)
ch->pcdata->powers_set[DISC_FORTITUDE] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_MELPOMINEE:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_MELPOMINEE] < mod)
ch->pcdata->powers_set[DISC_MELPOMINEE] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_NECROMANCY:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_NECROMANCY] < mod)
ch->pcdata->powers_set[DISC_NECROMANCY] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_OBEAH:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_OBEAH] < mod)
ch->pcdata->powers_set[DISC_OBEAH] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_OBFUSCATE:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_OBFUSCATE] < mod)
ch->pcdata->powers_set[DISC_OBFUSCATE] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_OBTENEBRATION:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_OBTENEBRATION] < mod)
ch->pcdata->powers_set[DISC_OBTENEBRATION] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_POTENCE:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_POTENCE] < mod)
ch->pcdata->powers_set[DISC_POTENCE] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_PRESENCE:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_PRESENCE] < mod)
ch->pcdata->powers_set[DISC_PRESENCE] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_PROTEAN:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_PROTEAN] < mod)
ch->pcdata->powers_set[DISC_PROTEAN] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_QUIETUS:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_QUIETUS] < mod)
ch->pcdata->powers_set[DISC_QUIETUS] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_SERPENTIS:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_SERPENTIS] < mod)
ch->pcdata->powers_set[DISC_SERPENTIS] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_THANATOSIS:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_THANATOSIS] < mod)
ch->pcdata->powers_set[DISC_THANATOSIS] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_THAUMATURGY:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_THAUMATURGY] < mod)
ch->pcdata->powers_set[DISC_THAUMATURGY] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_VICISSITUDE:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_VICISSITUDE] < mod)
ch->pcdata->powers_set[DISC_VICISSITUDE] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_BLOOD_MAX:
ch->blood[BLOOD_POOL] += mod;
break;
case APPLY_BLOOD_POT:
ch->blood[BLOOD_POTENCY] += mod;
break;
}
/*
* Check for weapon wielding.
* Guard against recursion (for weapons with affects).
*/
if ((wield = get_eq_char (ch, WEAR_WIELD)) != NULL
&& wield->item_type == ITEM_WEAPON
&& get_obj_weight (wield) > str_app[get_curr_str (ch)].wield)
{
static int depth;
if (depth == 0)
{
depth++;
act ("You drop $p.", ch, wield, NULL, TO_CHAR);
act ("$n drops $p.", ch, wield, NULL, TO_ROOM);
obj_from_char (wield);
obj_to_room (wield, ch->in_room);
depth--;
}
}
return;
}
void
objaffect_modify (CHAR_DATA * ch, OBJ_DATA * obj, AFFECT_DATA * paf,
bool fAdd)
{
OBJ_DATA *wield;
int mod;
mod = paf->modifier;
if (fAdd)
{
SET_BIT (ch->affected_by, paf->bitvector);
}
else
{
REMOVE_BIT (ch->affected_by, paf->bitvector);
mod = 0 - mod;
}
if (IS_NPC (ch))
{
switch (paf->location)
{
default:
break;
case APPLY_NONE:
break;
case APPLY_MANA:
ch->max_mana += mod;
break;
case APPLY_HIT:
ch->max_hit += mod;
break;
case APPLY_MOVE:
ch->max_move += mod;
break;
case APPLY_AC:
ch->armor += mod;
break;
case APPLY_HITROLL:
ch->hitroll += mod;
break;
case APPLY_DAMROLL:
ch->damroll += mod;
break;
case APPLY_DAMCAP:
ch->damcapbonus += mod;
break;
case APPLY_SAVING_PARA:
ch->saving_throw += mod;
break;
case APPLY_SAVING_ROD:
ch->saving_throw += mod;
break;
case APPLY_SAVING_PETRI:
ch->saving_throw += mod;
break;
case APPLY_SAVING_BREATH:
ch->saving_throw += mod;
break;
case APPLY_SAVING_SPELL:
ch->saving_throw += mod;
break;
case APPLY_POLY:
ch->polyaff += mod;
break;
case APPLY_GENERATION:
ch->vampgen += mod;
break;
case APPLY_BLOOD_MAX:
ch->blood[BLOOD_POOL] += mod;
break;
case APPLY_BLOOD_POT:
ch->blood[BLOOD_POTENCY] += mod;
break;
}
return;
}
if (IS_HIGHLANDER (ch) && !IS_SET (obj->spectype, SITEM_HIGHLANDER)
&& !IS_SET (obj->quest, QUEST_ARTIFACT))
return;
switch (paf->location)
{
default:
bug ("Affect_modify: unknown location %d.", paf->location);
return;
case APPLY_NONE:
break;
case APPLY_STR:
ch->pcdata->mod_str += mod;
break;
case APPLY_DEX:
ch->pcdata->mod_dex += mod;
break;
case APPLY_INT:
ch->pcdata->mod_int += mod;
break;
case APPLY_WIS:
ch->pcdata->mod_wis += mod;
break;
case APPLY_CON:
ch->pcdata->mod_con += mod;
break;
case APPLY_SEX:
ch->sex += mod;
break;
case APPLY_CLASS:
break;
case APPLY_LEVEL:
break;
case APPLY_AGE:
break;
case APPLY_HEIGHT:
break;
case APPLY_WEIGHT:
break;
case APPLY_MANA:
ch->max_mana += mod;
break;
case APPLY_HIT:
ch->max_hit += mod;
break;
case APPLY_MOVE:
ch->max_move += mod;
break;
case APPLY_GOLD:
break;
case APPLY_EXP:
break;
case APPLY_AC:
ch->armor += mod;
break;
case APPLY_HITROLL:
ch->hitroll += mod;
break;
case APPLY_DAMROLL:
ch->damroll += mod;
break;
case APPLY_DAMCAP:
ch->damcapbonus += mod;
break;
case APPLY_MAGIC_RESISTANCE:
ch->pcdata->atm += mod;
break;
case APPLY_SAVING_PARA:
ch->saving_throw += mod;
break;
case APPLY_SAVING_ROD:
ch->saving_throw += mod;
break;
case APPLY_SAVING_PETRI:
ch->saving_throw += mod;
break;
case APPLY_SAVING_BREATH:
ch->saving_throw += mod;
break;
case APPLY_SAVING_SPELL:
ch->saving_throw += mod;
break;
case APPLY_POLY:
ch->polyaff += mod;
break;
case APPLY_GENERATION:
ch->vampgen += mod;
break;
case APPLY_ANIMALISM:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_ANIMALISM] += mod;
break;
case APPLY_AUSPEX:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_AUSPEX] += mod;
break;
case APPLY_CELERITY:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_CELERITY] += mod;
break;
case APPLY_CHIMERSTRY:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_CHIMERSTRY] += mod;
break;
case APPLY_DAIMOINON:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_DAIMOINON] += mod;
break;
case APPLY_DOMINATE:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_DOMINATE] += mod;
break;
case APPLY_FORTITUDE:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_FORTITUDE] += mod;
break;
case APPLY_MELPOMINEE:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_MELPOMINEE] += mod;
break;
case APPLY_NECROMANCY:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_NECROMANCY] += mod;
break;
case APPLY_OBEAH:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_OBEAH] += mod;
break;
case APPLY_OBFUSCATE:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_OBFUSCATE] += mod;
break;
case APPLY_OBTENEBRATION:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_OBTENEBRATION] += mod;
break;
case APPLY_POTENCE:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_POTENCE] += mod;
break;
case APPLY_PRESENCE:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_PRESENCE] += mod;
break;
case APPLY_PROTEAN:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_PROTEAN] += mod;
break;
case APPLY_QUIETUS:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_QUIETUS] += mod;
break;
case APPLY_SERPENTIS:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_SERPENTIS] += mod;
break;
case APPLY_THANATOSIS:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_THANATOSIS] += mod;
break;
case APPLY_THAUMATURGY:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_THAUMATURGY] += mod;
break;
case APPLY_VICISSITUDE:
if (!IS_NPC (ch))
ch->pcdata->powers_mod[DISC_VICISSITUDE] += mod;
break;
case APPLY_SET_ANIMALISM:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_ANIMALISM] < mod)
ch->pcdata->powers_set[DISC_ANIMALISM] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_AUSPEX:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_AUSPEX] < mod)
ch->pcdata->powers_set[DISC_AUSPEX] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_CELERITY:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_CELERITY] < mod)
ch->pcdata->powers_set[DISC_CELERITY] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_CHIMERSTRY:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_CHIMERSTRY] < mod)
ch->pcdata->powers_set[DISC_CHIMERSTRY] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_DAIMOINON:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_DAIMOINON] < mod)
ch->pcdata->powers_set[DISC_DAIMOINON] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_DOMINATE:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_DOMINATE] < mod)
ch->pcdata->powers_set[DISC_DOMINATE] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_FORTITUDE:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_FORTITUDE] < mod)
ch->pcdata->powers_set[DISC_FORTITUDE] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_MELPOMINEE:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_MELPOMINEE] < mod)
ch->pcdata->powers_set[DISC_MELPOMINEE] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_NECROMANCY:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_NECROMANCY] < mod)
ch->pcdata->powers_set[DISC_NECROMANCY] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_OBEAH:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_OBEAH] < mod)
ch->pcdata->powers_set[DISC_OBEAH] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_OBFUSCATE:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_OBFUSCATE] < mod)
ch->pcdata->powers_set[DISC_OBFUSCATE] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_OBTENEBRATION:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_OBTENEBRATION] < mod)
ch->pcdata->powers_set[DISC_OBTENEBRATION] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_POTENCE:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_POTENCE] < mod)
ch->pcdata->powers_set[DISC_POTENCE] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_PRESENCE:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_PRESENCE] < mod)
ch->pcdata->powers_set[DISC_PRESENCE] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_PROTEAN:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_PROTEAN] < mod)
ch->pcdata->powers_set[DISC_PROTEAN] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_QUIETUS:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_QUIETUS] < mod)
ch->pcdata->powers_set[DISC_QUIETUS] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_SERPENTIS:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_SERPENTIS] < mod)
ch->pcdata->powers_set[DISC_SERPENTIS] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_THANATOSIS:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_THANATOSIS] < mod)
ch->pcdata->powers_set[DISC_THANATOSIS] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_THAUMATURGY:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_THAUMATURGY] < mod)
ch->pcdata->powers_set[DISC_THAUMATURGY] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_SET_VICISSITUDE:
if (!IS_NPC (ch) && ch->pcdata->powers_set[DISC_VICISSITUDE] < mod)
ch->pcdata->powers_set[DISC_VICISSITUDE] = mod;
ch->pcdata->powers_set_wear++;
break;
case APPLY_BLOOD_MAX:
ch->blood[BLOOD_POOL] += mod;
break;
case APPLY_BLOOD_POT:
ch->blood[BLOOD_POTENCY] += mod;
break;
}
/*
* Check for weapon wielding.
* Guard against recursion (for weapons with affects).
*/
if ((wield = get_eq_char (ch, WEAR_WIELD)) != NULL
&& wield->item_type == ITEM_WEAPON
&& get_obj_weight (wield) > str_app[get_curr_str (ch)].wield)
{
static int depth;
if (depth == 0)
{
depth++;
act ("You drop $p.", ch, wield, NULL, TO_CHAR);
act ("$n drops $p.", ch, wield, NULL, TO_ROOM);
obj_from_char (wield);
obj_to_room (wield, ch->in_room);
depth--;
}
}
return;
}
/*
* Give an affect to a char.
*/
void
affect_to_char (CHAR_DATA * ch, AFFECT_DATA * paf)
{
AFFECT_DATA *paf_new;
if (affect_free == NULL)
{
paf_new = alloc_perm (sizeof (*paf_new));
}
else
{
paf_new = affect_free;
affect_free = affect_free->next;
}
*paf_new = *paf;
paf_new->next = ch->affected;
ch->affected = paf_new;
affect_modify (ch, paf_new, TRUE);
return;
}
/*
* Remove an affect from a char.
*/
void
affect_remove (CHAR_DATA * ch, AFFECT_DATA * paf)
{
if (ch->affected == NULL)
{
bug ("Affect_remove: no affect.", 0);
return;
}
affect_modify (ch, paf, FALSE);
if (paf == ch->affected)
{
ch->affected = paf->next;
}
else
{
AFFECT_DATA *prev;
for (prev = ch->affected; prev != NULL; prev = prev->next)
{
if (prev->next == paf)
{
prev->next = paf->next;
break;
}
}
if (prev == NULL)
{
bug ("Affect_remove: cannot find paf.", 0);
return;
}
}
paf->next = affect_free;
affect_free = paf->next;
return;
}
/*
* Strip all affects of a given sn.
*/
void
affect_strip (CHAR_DATA * ch, int sn)
{
AFFECT_DATA *paf;
AFFECT_DATA *paf_next;
for (paf = ch->affected; paf != NULL; paf = paf_next)
{
paf_next = paf->next;
if (paf->type == sn)
affect_remove (ch, paf);
}
return;
}
/*
* Return true if a char is affected by a spell.
*/
bool
is_affected (CHAR_DATA * ch, int sn)
{
AFFECT_DATA *paf;
for (paf = ch->affected; paf != NULL; paf = paf->next)
{
if (paf->type == sn)
return TRUE;
}
return FALSE;
}
/*
* Add or enhance an affect.
*/
void
affect_join (CHAR_DATA * ch, AFFECT_DATA * paf)
{
AFFECT_DATA *paf_old;
bool found;
found = FALSE;
for (paf_old = ch->affected; paf_old != NULL; paf_old = paf_old->next)
{
if (paf_old->type == paf->type)
{
paf->duration += paf_old->duration;
paf->modifier += paf_old->modifier;
affect_remove (ch, paf_old);
break;
}
}
affect_to_char (ch, paf);
return;
}
/*
* Move a char out of a room.
*/
void
char_from_room (CHAR_DATA * ch)
{
OBJ_DATA *obj;
char bugbuf[MSL];
if (ch->in_room == NULL)
{
sprintf (bugbuf, "%s: Char_from_room: NULL.", ch->name);
bug (bugbuf, 0);
return;
}
if (!IS_NPC (ch) && !IS_NYM (ch, NYM_SCANNING))
--ch->in_room->area->nplayer;
if (!IS_NPC (ch) && IS_VAMPIRE (ch) && IS_MORE (ch, MORE_HAND_FLAME)
&& !IS_NYM (ch, NYM_SCANNING) && ch->in_room->light > 0)
--ch->in_room->light;
else if ((obj = get_eq_char (ch, WEAR_WIELD)) != NULL
&& !IS_NYM (ch, NYM_SCANNING)
&& obj->item_type == ITEM_LIGHT
&& obj->value[2] != 0 && ch->in_room->light > 0)
--ch->in_room->light;
else if ((obj = get_eq_char (ch, WEAR_HOLD)) != NULL
&& !IS_NYM (ch, NYM_SCANNING)
&& obj->item_type == ITEM_LIGHT
&& obj->value[2] != 0 && ch->in_room->light > 0)
--ch->in_room->light;
if (IS_XXX (ch, XXX_CAMOUFLAGE) && !IS_XXX (ch, XXX_CALLALLFIX))
REMOVE_BIT (ch->xxxbits, XXX_CAMOUFLAGE);
if (!IS_NPC (ch) && IS_LICH (ch) && !IS_XXX (ch, XXX_CALLALLFIX)
&& (IS_SET (ch->in_room->added_flags, ROOM2_LICHCIRCLE4)
|| IS_SET (ch->in_room->added_flags, ROOM2_LICHCIRCLE3)
|| IS_SET (ch->in_room->added_flags, ROOM2_LICHCIRCLE2)
|| IS_SET (ch->in_room->added_flags, ROOM2_LICHCIRCLE)))
{
if (IS_SET (ch->in_room->added_flags, ROOM2_LICHCIRCLE4))
REMOVE_BIT (ch->in_room->added_flags, ROOM2_LICHCIRCLE4);
else if (IS_SET (ch->in_room->added_flags, ROOM2_LICHCIRCLE3))
REMOVE_BIT (ch->in_room->added_flags, ROOM2_LICHCIRCLE3);
else if (IS_SET (ch->in_room->added_flags, ROOM2_LICHCIRCLE2))
REMOVE_BIT (ch->in_room->added_flags, ROOM2_LICHCIRCLE2);
else if IS_SET
(ch->in_room->added_flags, ROOM2_LICHCIRCLE)
REMOVE_BIT (ch->in_room->added_flags, ROOM2_LICHCIRCLE);
else
stc ("bug, lich circle move, inform linksys", ch);
stc ("Your blood circle has warn off!\n\r", ch);
REMOVE_BIT (ch->xxxbits, XXX_LICHCIRCLE);
}
if (!IS_NPC (ch) && IS_MORE (ch, MORE_DARKNESS)
&& !IS_NYM (ch, NYM_SCANNING))
{
if (ch->in_room != NULL)
{
REMOVE_BIT (ch->in_room->room_flags, ROOM_TOTAL_DARKNESS);
REMOVE_BIT (ch->more, MORE_DARKNESS);
ch->pcdata->darkness = 60;
act ("The darkness in the room gradually fades away to nothing.",
ch, NULL, NULL, TO_CHAR);
act ("The darkness in the room gradually fades away to nothing.",
ch, NULL, NULL, TO_ROOM);
}
}
if (!IS_NPC (ch) && IS_COR (ch, COR_DARKNESS) && !IS_NYM (ch, NYM_SCANNING))
{
if (ch->in_room != NULL)
{
REMOVE_BIT (ch->in_room->room_flags, ROOM_DJINN_DARKNESS);
REMOVE_BIT (ch->more, COR_DARKNESS);
ch->darkdjinn = 60;
act ("The darkness in the room gradually fades away to nothing.",
ch, NULL, NULL, TO_CHAR);
act ("The darkness in the room gradually fades away to nothing.",
ch, NULL, NULL, TO_ROOM);
}
}
if (!IS_NPC (ch) && IS_MORE (ch, MORE_SILENCE)
&& !IS_NYM (ch, NYM_SCANNING))
{
if (ch->in_room != NULL)
{
REMOVE_BIT (ch->in_room->added_flags, ROOM2_SILENCE);
REMOVE_BIT (ch->more, MORE_SILENCE);
ch->pcdata->silence = 60;
act ("The room is no longer silent.", ch, NULL, NULL, TO_CHAR);
act ("The room is no longer silent.", ch, NULL, NULL, TO_ROOM);
}
}
if (!IS_NPC (ch) && IS_MORE (ch, MORE_REINA) && !IS_NYM (ch, NYM_SCANNING))
{
if (ch->in_room != NULL)
{
REMOVE_BIT (ch->in_room->room_flags, ROOM_SAFE);
REMOVE_BIT (ch->more, MORE_REINA);
ch->pcdata->reina = 60;
send_to_char
("The peaceful harmony in the air gradually fades away to nothing.\n\r",
ch);
act
("The peaceful harmony in the air gradually fades away to nothing.",
ch, NULL, NULL, TO_ROOM);
}
}
else if (!IS_NPC (ch) && IS_MORE (ch, MORE_NEUTRAL)
&& !IS_NYM (ch, NYM_SCANNING))
{
if (ch->in_room != NULL)
{
REMOVE_BIT (ch->in_room->room_flags, ROOM_SAFE);
REMOVE_BIT (ch->more, MORE_NEUTRAL);
ch->pcdata->obeah = 30;
if (IS_DRACONIAN (ch))
{
send_to_char
("The truce granted by your Dragon forefathers is slowly disbanded.\n\r",
ch);
act
("The truce granted by the Dragon forefathers is slowly disbanded.",
ch, NULL, NULL, TO_ROOM);
}
else
{
send_to_char
("The peaceful harmony in the air gradually fades away to nothing.\n\r",
ch);
act
("The peaceful harmony in the air gradually fades away to nothing.",
ch, NULL, NULL, TO_ROOM);
}
}
}
if (IS_AFFECTED (ch, AFF_HIDE) && !IS_NYM (ch, NYM_SCANNING))
{
REMOVE_BIT (ch->affected_by, AFF_HIDE);
send_to_char ("You step from the shadows.\n\r", ch);
/*
act("$n steps from the shadows.",ch,NULL,NULL,TO_ROOM);
*/
}
if (ch == ch->in_room->people)
{
ch->in_room->people = ch->next_in_room;
}
else
{
CHAR_DATA *prev;
for (prev = ch->in_room->people; prev; prev = prev->next_in_room)
{
if (prev->next_in_room == ch)
{
prev->next_in_room = ch->next_in_room;
break;
}
}
if (prev == NULL)
bug ("Char_from_room: ch not found.", 0);
}
ch->in_room = NULL;
ch->next_in_room = NULL;
return;
}
/*
* Move a char into a room.
*/
void
char_to_room (CHAR_DATA * ch, ROOM_INDEX_DATA * pRoomIndex)
{
OBJ_DATA *obj;
char bugbuf[MSL];
if (pRoomIndex == NULL)
{
sprintf (bugbuf, "%s: Char_to_room: NULL. putting them in limbo",
ch->name);
char_to_room (ch, get_room_index (ROOM_VNUM_ALTAR));
bug (bugbuf, 0);
return;
}
ch->in_room = pRoomIndex;
ch->next_in_room = pRoomIndex->people;
pRoomIndex->people = ch;
if (!IS_NPC (ch) && !IS_NYM (ch, NYM_SCANNING))
++ch->in_room->area->nplayer;
if (!IS_NPC (ch) && IS_VAMPIRE (ch) && IS_MORE (ch, MORE_HAND_FLAME)
&& !IS_NYM (ch, NYM_SCANNING))
++ch->in_room->light;
else if ((obj = get_eq_char (ch, WEAR_WIELD)) != NULL
&& !IS_NYM (ch, NYM_SCANNING)
&& obj->item_type == ITEM_LIGHT && obj->value[2] != 0)
++ch->in_room->light;
else if ((obj = get_eq_char (ch, WEAR_HOLD)) != NULL
&& !IS_NYM (ch, NYM_SCANNING)
&& obj->item_type == ITEM_LIGHT && obj->value[2] != 0)
++ch->in_room->light;
if (ch->loc_hp[6] > 0 && ch->in_room->blood < 1000
&& !IS_NYM (ch, NYM_SCANNING))
{
if (IS_VAMPIRE (ch))
ch->loc_hp[6] = 0;
else
ch->in_room->blood += 1;
}
if (!IS_NPC (ch) && IS_MORE (ch, MORE_DARKNESS)
&& !IS_NYM (ch, NYM_SCANNING))
{
SET_BIT (ch->in_room->room_flags, ROOM_TOTAL_DARKNESS);
ch->pcdata->darkness = 60;
act ("The room is filled with darkness.", ch, NULL, NULL, TO_CHAR);
act ("The room is filled with darkness.", ch, NULL, NULL, TO_ROOM);
}
if (!IS_NPC (ch) && IS_COR (ch, COR_DARKNESS) && !IS_NYM (ch, NYM_SCANNING))
{
SET_BIT (ch->in_room->room_flags, ROOM_DJINN_DARKNESS);
ch->darkdjinn = 60;
act ("The room is filled with darkness.", ch, NULL, NULL, TO_CHAR);
act ("The room is filled with darkness.", ch, NULL, NULL, TO_ROOM);
}
if (!IS_NPC (ch) && IS_MORE (ch, MORE_SILENCE)
&& !IS_NYM (ch, NYM_SCANNING))
{
SET_BIT (ch->in_room->added_flags, ROOM2_SILENCE);
ch->pcdata->silence = 60;
act ("The room is filled with silence.", ch, NULL, NULL, TO_CHAR);
act ("The room is filled with silence.", ch, NULL, NULL, TO_ROOM);
}
if (ch->in_room != NULL && !IS_NPC (ch) && !IS_NYM (ch, NYM_SCANNING))
{
int dam = number_range (3500, 5500);
int foot = number_range (1, 2);
if (IS_SET (ch->in_room->added_flags, ROOM2_CALTROPS) && !IS_NINJA (ch)
&& !IS_IMMORTAL (ch))
{
act ("You step on a small caltrop that explodes.", ch, NULL, NULL,
TO_CHAR);
act ("$n steps on a small caltrop that explodes.", ch, NULL, NULL,
TO_ROOM);
ch->hit -= dam;
ch->agg += number_range (2, 4);
update_pos (ch);
if (!limbsafe2 (ch))
{
if (foot == 1)
{
if (!IS_LEG_L (ch, LOST_LEG))
{
SET_BIT (ch->loc_hp[4], LOST_LEG);
SET_BIT (ch->loc_hp[6], BLEEDING_LEG_L);
if (IS_BLEEDING (ch, BLEEDING_FOOT_L))
REMOVE_BIT (ch->loc_hp[6], BLEEDING_FOOT_L);
act ("The exploding caltrop tears your left leg off.",
ch, NULL, NULL, TO_CHAR);
act ("The exploding caltrop tears $n's left leg off.",
ch, NULL, NULL, TO_ROOM);
make_part (ch, "leg");
if (IS_LEG_L (ch, LOST_LEG) && IS_LEG_R (ch, LOST_LEG))
{
if ((obj = get_eq_char (ch, WEAR_LEGS)) != NULL)
take_item (ch, obj);
}
if ((obj = get_eq_char (ch, WEAR_FEET)) != NULL)
take_item (ch, obj);
}
}
else
{
if (!IS_LEG_R (ch, LOST_LEG))
{
SET_BIT (ch->loc_hp[5], LOST_LEG);
SET_BIT (ch->loc_hp[6], BLEEDING_LEG_R);
if (IS_BLEEDING (ch, BLEEDING_FOOT_R))
REMOVE_BIT (ch->loc_hp[6], BLEEDING_FOOT_R);
act ("The exploding caltrop tears your right leg off.",
ch, NULL, NULL, TO_CHAR);
act ("The exploding caltrop tears $n's right leg off.",
ch, NULL, NULL, TO_ROOM);
make_part (ch, "leg");
if (IS_LEG_L (ch, LOST_LEG) && IS_LEG_R (ch, LOST_LEG))
{
if ((obj = get_eq_char (ch, WEAR_LEGS)) != NULL)
take_item (ch, obj);
}
if ((obj = get_eq_char (ch, WEAR_FEET)) != NULL)
take_item (ch, obj);
}
}
}
ch->in_room->caltrops--;
if (ch->in_room->caltrops < 1)
{
REMOVE_BIT (ch->in_room->added_flags, ROOM2_CALTROPS);
}
}
}
if (!IS_NPC (ch) && IS_MORE (ch, MORE_REINA) && !IS_NYM (ch, NYM_SCANNING))
{
SET_BIT (ch->in_room->room_flags, ROOM_SAFE);
ch->pcdata->reina = 60;
act ("The air is filled with a peaceful harmony.", ch, NULL, NULL,
TO_CHAR);
act ("The air is filled with a peaceful harmony.", ch, NULL, NULL,
TO_ROOM);
}
else if (!IS_NPC (ch) && IS_MORE (ch, MORE_NEUTRAL)
&& !IS_NYM (ch, NYM_SCANNING))
{
SET_BIT (ch->in_room->room_flags, ROOM_SAFE);
ch->pcdata->obeah = 30;
if (IS_DRACONIAN (ch))
{
send_to_char
("Your Dragon forefathers grants a temporary truce here.\n\r",
ch);
act ("$n's Dragon forefathers grants a temporary truce here.", ch,
NULL, NULL, TO_ROOM);
}
else
{
act ("The air is filled with a peaceful harmony.", ch, NULL, NULL,
TO_CHAR);
act ("The air is filled with a peaceful harmony.", ch, NULL, NULL,
TO_ROOM);
}
}
return;
}
/*
* Give an obj to a char.
*/
void
obj_to_char (OBJ_DATA * obj, CHAR_DATA * ch)
{
if (obj == NULL)
return;
if (!IS_NPC (ch)
&& (IS_SET (obj->quest, QUEST_ARTIFACT) || obj->item_type == ITEM_PIECE)
&& !IS_NYM (ch, NYM_HASARTI))
{
SET_BIT (ch->nymbits, NYM_HASARTI);
ch->pcdata->artinum = obj->pIndexData->vnum;
}
if (obj->item_type == ITEM_PIECE)
SET_BIT (ch->xxxbits, XXX_PIECE);
obj->next_content = ch->carrying;
ch->carrying = obj;
obj->carried_by = ch;
obj->in_room = NULL;
obj->in_obj = NULL;
ch->carry_number += 1;
ch->carry_weight += get_obj_weight (obj);
}
/*
* Take an obj from its character.
*/
void
obj_from_char (OBJ_DATA * obj)
{
CHAR_DATA *ch;
if (obj == NULL)
return;
if ((ch = obj->carried_by) == NULL)
{
bug ("Obj_from_char: null ch.", 0);
return;
}
if (obj->wear_loc != WEAR_NONE)
unequip_char (ch, obj);
if (ch->carrying == obj)
{
ch->carrying = obj->next_content;
}
else
{
OBJ_DATA *prev;
for (prev = ch->carrying; prev != NULL; prev = prev->next_content)
{
if (prev->next_content == obj)
{
prev->next_content = obj->next_content;
break;
}
}
if (prev == NULL)
bug ("Obj_from_char: obj not in list.", 0);
}
if (!IS_NPC (ch)
&& (IS_SET (obj->quest, QUEST_ARTIFACT) || obj->item_type == ITEM_PIECE)
&& IS_NYM (ch, NYM_HASARTI))
{
REMOVE_BIT (ch->nymbits, NYM_HASARTI);
ch->pcdata->artinum = 0;
}
if (IS_XXX (ch, XXX_PIECE) && obj->item_type == ITEM_PIECE)
REMOVE_BIT (ch->xxxbits, XXX_PIECE);
obj->carried_by = NULL;
obj->next_content = NULL;
ch->carry_number -= 1;
ch->carry_weight -= get_obj_weight (obj);
return;
}
/*
* Find the ac value of an obj, including position effect.
*/
int
apply_ac (OBJ_DATA * obj, int iWear)
{
if (obj->item_type != ITEM_ARMOR)
return 0;
switch (iWear)
{
case WEAR_BODY:
return 3 * obj->value[0];
case WEAR_HEAD:
return 2 * obj->value[0];
case WEAR_LEGS:
return 2 * obj->value[0];
case WEAR_FEET:
return obj->value[0];
case WEAR_HANDS:
return obj->value[0];
case WEAR_ARMS:
return obj->value[0];
case WEAR_SHIELD:
return obj->value[0];
case WEAR_FINGER_L:
return obj->value[0];
case WEAR_FINGER_R:
return obj->value[0];
case WEAR_NECK_1:
return obj->value[0];
case WEAR_NECK_2:
return obj->value[0];
case WEAR_ABOUT:
return 2 * obj->value[0];
case WEAR_WAIST:
return obj->value[0];
case WEAR_WRIST_L:
return obj->value[0];
case WEAR_WRIST_R:
return obj->value[0];
case WEAR_HOLD:
return obj->value[0];
case WEAR_FACE:
return obj->value[0];
case WEAR_QUIVER:
return 0;
case WEAR_SCABBARD_L:
return 0;
case WEAR_SCABBARD_BACK:
return 0;
case WEAR_SCABBARD_R:
return 0;
case WEAR_STAKE:
return 0;
}
return 0;
}
/*
* Find a piece of eq on a character.
*/
OBJ_DATA *
get_eq_char (CHAR_DATA * ch, int iWear)
{
OBJ_DATA *obj;
for (obj = ch->carrying; obj != NULL; obj = obj->next_content)
{
if (obj->wear_loc == iWear)
return obj;
}
return NULL;
}
/*
* Equip a char with an obj.
*/
void
equip_char (CHAR_DATA * ch, OBJ_DATA * obj, int iWear)
{
CHAR_DATA *chch;
AFFECT_DATA *paf;
char bugbuf[MSL];
int sn;
if (get_eq_char (ch, iWear) != NULL && !IS_NPC (ch))
{
sprintf (bugbuf, "%s %s Equip_char: already equipped (%d).", ch->name,
obj->short_descr, iWear);
bug (bugbuf, 0);
return;
}
if ((IS_OBJ_STAT (obj, ITEM_ANTI_EVIL) && IS_EVIL (ch))
|| (IS_OBJ_STAT (obj, ITEM_ANTI_GOOD) && IS_GOOD (ch))
|| (IS_OBJ_STAT (obj, ITEM_ANTI_NEUTRAL) && IS_NEUTRAL (ch)))
{
/*
* Thanks to Morgenes for the bug fix here!
*/
act ("You are the wrong alignment so $p zaps you making you drop it.",
ch, obj, NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
if ((IS_NPC (ch) || !IS_DEMON (ch)) && IS_SET (obj->spectype, SITEM_DEMONIC)
&& !IS_SET (obj->quest, QUEST_ARTIFACT)
&& obj->pIndexData->vnum != 29681)
{
act ("You are not a demon so $p zaps you making you drop it.", ch, obj,
NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
if (!IS_NPC (ch) && IS_SET (obj->weapflags, WEAPON_NEPHED)
&& !IS_SET (obj->quest, QUEST_ARTIFACT) && !IS_NEPHANDI (ch))
{
act ("$p zaps you making you drop it.", ch, obj, NULL, TO_CHAR);
act ("$p zaps $n making $m and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
if (!IS_NPC (ch) && IS_SET (obj->weapflags, WEAPON_GREMLIN)
&& !IS_SET (obj->quest, QUEST_ARTIFACT))
{
act ("$p cackles and zaps you making you drop it.", ch, obj,
NULL, TO_CHAR);
act ("$p cackles and zaps $n making $m and drops it.", ch, obj, NULL,
TO_ROOM);
act ("an evil spirit leaves $p, while cackling.", ch, obj, NULL,
TO_ROOM);
act ("an evil spirit leaves $p, while cackling.", ch, obj, NULL,
TO_CHAR);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
REMOVE_BIT (obj->weapflags, WEAPON_GREMLIN);
do_autosave (ch, "");
return;
}
if ((IS_NPC (ch) || !IS_ELF (ch)) && IS_SET (obj->spectype, SITEM_ELF)
&& !IS_SET (obj->quest, QUEST_ARTIFACT))
{
act ("You are not an elf so $p zaps you making you drop it.", ch, obj,
NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
if ((IS_NPC (ch) || !IS_BSD (ch)) && obj->specpower == ARM_BONE
&& IS_SET (obj->spectype, SITEM_DEMONIC)
&& !IS_SET (obj->quest, QUEST_ARTIFACT))
{
act
("You are not a black spiral dancer so $p zaps you making you drop it.",
ch, obj, NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
if ((IS_NPC (ch) || !IS_DJINN (ch)) && obj->pIndexData->vnum == 29619
&& !IS_SET (obj->quest, QUEST_ARTIFACT))
{
act ("You are not a djinn so $p zaps you making you drop it.", ch, obj,
NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
if ((IS_NPC (ch) || !IS_ELF (ch)) && obj->pIndexData->vnum == 29648
&& !IS_SET (obj->quest, QUEST_ARTIFACT))
{
act ("You are not an Elf so $p zaps you making you drop it.", ch, obj,
NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
if ((IS_NPC (ch) || !IS_WISHENCHANT (ch)) && obj->pIndexData->vnum == 29616
&& IS_SET (obj->spectype, SITEM_DJINN)
&& !IS_SET (obj->quest, QUEST_ARTIFACT))
{
act ("You are not a wish enchanter so $p zaps you making you drop it.",
ch, obj, NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
if ((IS_NPC (ch) || !IS_PUREMAGE (ch))
&& !IS_SET (obj->spectype, SITEM_DJINN)
&& !IS_SET (obj->spectype, SITEM_NINJA)
&& IS_SET (obj->spectype, SITEM_MAGE)
&& !IS_SET (obj->quest, QUEST_ARTIFACT))
{
act ("You are not a pure mage so $p zaps you making you drop it.", ch,
obj, NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
if (obj->pIndexData->vnum == 29618)
{
char buf[MIL];
sprintf (buf, "%s (Craft)", ch->name);
if (str_cmp (buf, obj->creator))
{
act
("$p starts glowing and sparkling violently, you feel your arm go limp as you drop it.",
ch, obj, NULL, TO_CHAR);
act
("$p starts glowing and sparkling violently, $n arm suddenly go's limp and $s drops the staff.",
ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
}
if (obj->pIndexData->vnum == 29626)
{
char buf[MIL];
sprintf (buf, "%s (Soul Jar)", ch->name);
if (str_cmp (buf, obj->creator))
{
act
("$p starts glowing and sparkling violently, and suddenly you get knocked on you ass by a surge of power.",
ch, obj, NULL, TO_CHAR);
act
("$p starts glowing and sparkling violently, and suddenly $n gets knocked on $s ass by an unseen force, making $m drop $p.",
ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
ch->position = POS_STUNNED;
if (ch->fighting != NULL)
stop_fighting (ch, TRUE);
return;
}
}
if ((IS_NPC (ch) || !IS_SHINOBI (ch))
&& obj->pIndexData->vnum == OBJ_VNUM_PROTOPLASM
&& IS_SET (obj->spectype, SITEM_NINJA)
&& !IS_SET (obj->spectype, SITEM_MAGE)
&& !IS_SET (obj->quest, QUEST_ARTIFACT))
{
act ("You are not a shinobi so $p zaps you making you drop it.", ch,
obj, NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
if ((IS_NPC (ch) || !IS_NINJA (ch)) && IS_SET (obj->spectype, SITEM_NINJA)
&& !IS_SET (obj->quest, QUEST_ARTIFACT))
{
act ("You are not a ninja so $p zaps you making you drop it.", ch, obj,
NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
if ((IS_NPC (ch) || !IS_WEREWOLF (ch))
&& IS_SET (obj->spectype, SITEM_WOLFWEAPON)
&& !IS_SET (obj->quest, QUEST_ARTIFACT))
{
act ("You are not a werewolf so $p zaps you making you drop it.", ch,
obj, NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
if ((IS_NPC (ch) || !IS_SKINDANCER (ch))
&& IS_SET (obj->weapflags, WEAPON_SKINDANCER)
&& !IS_SET (obj->quest, QUEST_ARTIFACT))
{
act ("You are not a skindancer so $p zaps you making you drop it.", ch,
obj, NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
if ((IS_NPC (ch) || !IS_GAIAINQ (ch))
&& IS_SET (obj->weapflags, WEAPON_GAIAINQ)
&& !IS_SET (obj->quest, QUEST_ARTIFACT))
{
act
("You are not a true chosen of gaia so $p zaps you making you drop it.",
ch, obj, NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
if ((IS_NPC (ch) || !IS_BETRAYER (ch))
&& IS_SET (obj->weapflags, WEAPON_BETRAYER)
&& !IS_SET (obj->quest, QUEST_ARTIFACT))
{
act ("You are not a betrayer, so $p zaps you making you drop it.", ch,
obj, NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
if (obj->item_type == ITEM_MASTERY && str_cmp (ch->name, obj->questowner))
{
act ("You are dont own this mastery so $p zaps you making you drop it.",
ch, obj, NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
if (IS_SET (obj->weapflags, WEAPON_WRAITH) && !IS_WRAITH (ch)
&& !IS_SET (obj->quest, QUEST_ARTIFACT))
{
act ("You try to wear something that doesnt belong to your class!",
ch, obj, NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
ch->position = POS_STUNNED;
return;
}
if (obj->pIndexData->vnum == 29681 && !IS_WRAITH (ch))
{
act ("You are dont own this so $p zaps you making you drop it.",
ch, obj, NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
if (IS_SET (obj->quest, QUEST_ARTIFACT) && IS_ITEMAFF (ch, ITEMA_ARTIFACT)
&& !IS_IMMORTAL (ch))
{
act
("You are already equipped with an artifact so $p zaps you making you drop it.",
ch, obj, NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
if (IS_SET (obj->quest, QUEST_ARTIFACT) && !can_arti (ch)
&& !IS_IMMORTAL (ch))
{
act
("You do not have the 100000 required max life essence, so $p zaps you making you drop it.",
ch, obj, NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
if ((IS_NPC (ch) || !IS_HIGHLANDER (ch))
&& IS_SET (obj->spectype, SITEM_HIGHLANDER)
&& !IS_SET (obj->quest, QUEST_ARTIFACT))
{
act ("You are not a highlander so $p zaps you making you drop it.", ch,
obj, NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
if (!IS_NPC (ch) && IS_SET (obj->spectype, SITEM_HIGHLANDER)
&& !IS_SET (obj->quest, QUEST_ARTIFACT))
{
char katana[MSL];
sprintf (katana, "%s (Katana)", ch->name);
if (str_cmp (katana, obj->creator))
{
act ("You didn't create $p, so it zaps you making you drop it.", ch,
obj, NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
}
if ((IS_NPC (ch) || !IS_NPC (ch)) && IS_SET (obj->spectype, SITEM_DRAGON)
&& !IS_SET (obj->quest, QUEST_ARTIFACT))
{
if (obj->item_type == ITEM_SPECIAL && !IS_DRAC_CLERIC (ch))
{
act
("You are not a Cleric of Draygon so $p zaps you making you drop it.",
ch, obj, NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
else if (!IS_DRACONIAN (ch))
{
act
("You are not a draconian nor a dragon so $p zaps you making you drop it.",
ch, obj, NULL, TO_CHAR);
act ("$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM);
obj_from_char (obj);
obj_to_room (obj, ch->in_room);
do_autosave (ch, "");
return;
}
}
if (iWear == WEAR_SCABBARD_L || iWear == WEAR_SCABBARD_R
|| iWear == WEAR_SCABBARD_BACK || iWear == WEAR_STAKE)
{
obj->wear_loc = iWear;
return;
}
if (IS_NPC (ch) || !IS_HIGHLANDER (ch))
ch->armor -= apply_ac (obj, iWear);
else if (IS_HIGHLANDER (ch))
{
if (IS_SET (obj->spectype, SITEM_HIGHLANDER))
ch->armor -= apply_ac (obj, iWear);
else if (IS_SET (obj->quest, QUEST_ARTIFACT))
ch->armor -= apply_ac (obj, iWear);
}
obj->wear_loc = iWear;
if (IS_NPC (ch) || !IS_HIGHLANDER (ch))
{
for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next)
objaffect_modify (ch, obj, paf, TRUE);
for (paf = obj->affected; paf != NULL; paf = paf->next)
objaffect_modify (ch, obj, paf, TRUE);
}
else if (IS_HIGHLANDER (ch))
{
if (IS_SET (obj->spectype, SITEM_HIGHLANDER))
{
for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next)
objaffect_modify (ch, obj, paf, TRUE);
for (paf = obj->affected; paf != NULL; paf = paf->next)
objaffect_modify (ch, obj, paf, TRUE);
}
else if (IS_SET (obj->quest, QUEST_ARTIFACT))
{
for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next)
objaffect_modify (ch, obj, paf, TRUE);
for (paf = obj->affected; paf != NULL; paf = paf->next)
objaffect_modify (ch, obj, paf, TRUE);
}
}
if (obj->item_type == ITEM_LIGHT
&& obj->value[2] != 0 && ch->in_room != NULL)
++ch->in_room->light;
if (!IS_NPC (ch) && ch->pcdata->powers_set_wear > 0)
set_disc (ch);
if (!IS_RNPC (ch))
{
if ((chch = get_char_world (ch, ch->name)) == NULL)
return;
if (chch->desc != ch->desc)
return;
}
if (obj->chpoweron != NULL && obj->chpoweron != '\0'
&& str_cmp (obj->chpoweron, "(null)")
&& !IS_SET (obj->spectype, SITEM_TELEPORTER)
&& !IS_SET (obj->spectype, SITEM_TRANSPORTER))
{
kavitem (str_dup (obj->chpoweron), ch, obj, NULL, TO_CHAR);
if (IS_SET (obj->spectype, SITEM_ACTION))
kavitem (str_dup (obj->chpoweron), ch, obj, NULL, TO_ROOM);
}
if (obj->victpoweron != NULL && obj->victpoweron != '\0'
&& str_cmp (obj->victpoweron, "(null)")
&& !IS_SET (obj->spectype, SITEM_ACTION)
&& !IS_SET (obj->spectype, SITEM_TELEPORTER)
&& !IS_SET (obj->spectype, SITEM_TRANSPORTER))
kavitem (str_dup (obj->victpoweron), ch, obj, NULL, TO_ROOM);
if (obj->wear_loc == WEAR_NONE)
return;
if (!IS_NPC (ch) && IS_SET (obj->quest, QUEST_BLOODAGONY))
{
if (obj->wear_loc == WEAR_WIELD)
SET_BIT (ch->itemaffect, ITEMA_RIGHT_AGG);
else if (obj->wear_loc == WEAR_HOLD)
SET_BIT (ch->itemaffect, ITEMA_LEFT_AGG);
}
if (!IS_NPC (ch) && IS_SET (obj->spectype, SITEM_DEMONIC))
{
if (obj->wear_loc == WEAR_WIELD)
SET_BIT (ch->itemaffect, ITEMA_RIGHT_AGG);
else if (obj->wear_loc == WEAR_HOLD)
SET_BIT (ch->itemaffect, ITEMA_LEFT_AGG);
}
if (!IS_NPC (ch) && IS_SET (obj->weapflags, WEAPON_POISON))
{
if (obj->wear_loc == WEAR_WIELD)
SET_BIT (ch->xbits, X_RIGHT_POISON);
else if (obj->wear_loc == WEAR_HOLD)
SET_BIT (ch->xbits, X_LEFT_POISON);
}
if (!IS_NPC (ch) && IS_SET (obj->weapflags, WEAPON_SHOCKING))
{
if (obj->wear_loc == WEAR_WIELD)
SET_BIT (ch->xbits, X_RIGHT_SHOCK);
else if (obj->wear_loc == WEAR_HOLD)
SET_BIT (ch->xbits, X_LEFT_SHOCK);
}
if (!IS_NPC (ch) && IS_SET (obj->weapflags, WEAPON_ACID))
{
if (obj->wear_loc == WEAR_WIELD)
SET_BIT (ch->xbits, X_RIGHT_ACID);
else if (obj->wear_loc == WEAR_HOLD)
SET_BIT (ch->xbits, X_LEFT_ACID);
}
if (!IS_NPC (ch) && IS_SET (obj->weapflags, WEAPON_FLAMING))
{
if (obj->wear_loc == WEAR_WIELD)
SET_BIT (ch->xbits, X_RIGHT_FLAMING);
else if (obj->wear_loc == WEAR_HOLD)
SET_BIT (ch->xbits, X_LEFT_FLAMING);
}
if (!IS_NPC (ch) && IS_SET (obj->weapflags, WEAPON_HOLY))
{
if (obj->wear_loc == WEAR_WIELD)
SET_BIT (ch->xbits, X_RIGHT_HOLY);
else if (obj->wear_loc == WEAR_HOLD)
SET_BIT (ch->xbits, X_LEFT_HOLY);
}
if (!IS_NPC (ch) && IS_SET (obj->weapflags, WEAPON_FROST))
{
if (obj->wear_loc == WEAR_WIELD)
SET_BIT (ch->xbits, X_RIGHT_FROST);
else if (obj->wear_loc == WEAR_HOLD)
SET_BIT (ch->xbits, X_LEFT_FROST);
}
if (!IS_NPC (ch) && IS_SET (obj->weapflags, WEAPON_SUPERSPEED)
&& !IS_ITEMAFF (ch, ITEMA_SUPERSPEED))
{
SET_BIT (ch->itemaffect, ITEMA_SUPERSPEED);
stc ("Your movements speeds up to an unimaginable pace.\n\r", ch);
act ("$n starts moving with unimaginable speed.", ch, NULL, NULL,
TO_ROOM);
}
if (!IS_NPC (ch) && IS_SET (obj->weapflags, WEAPON_WEBBING)
&& !IS_EM (ch, EM_WEBSPINNER))
{
SET_BIT (ch->evenmore, EM_WEBSPINNER);
act
("$p starts spinning strands of thin spider silk as you fit it around your wrist",
ch, obj, NULL, TO_CHAR);
act
("$p starts spinning strands of thin spider silk as $n fits it around $s wrist.",
ch, obj, NULL, TO_ROOM);
}
if (!IS_NPC (ch) && IS_SET (obj->weapflags, WEAPON_ARMOR)
&& !IS_EM (ch, EM_ARMOR))
{
SET_BIT (ch->evenmore, EM_ARMOR);
act
("A golden bubble springs forth from $p enveloping your entire body.",
ch, obj, NULL, TO_CHAR);
act
("A golden bubble springs forth from $p enveloping $n entire body.",
ch, obj, NULL, TO_ROOM);
}
if (!IS_NPC (ch) && IS_SET (obj->weapflags, WEAPON_REDEEMER)
&& !IS_EM (ch, EM_REDEEMER))
{
SET_BIT (ch->evenmore, EM_REDEEMER);
act
("$p sends a telepathic message into your head '#yUse the Souleater command to receive my true gift#n'.",
ch, obj, NULL, TO_CHAR);
act
("$p glows for a second and $n seems to get a hungry gleam in $s eyes.",
ch, obj, NULL, TO_ROOM);
}
if (!IS_NPC (ch) && IS_SET (obj->weapflags, WEAPON_LORDLY)
&& !IS_XXX (ch, XXX_LORDLY))
{
stc ("wheeee", ch);
SET_BIT (ch->xxxbits, XXX_LORDLY);
}
if (!IS_NPC (ch) && IS_SET (obj->weapflags, WEAPON_MASTERMAGE)
&& !IS_ITEMAFF (ch, ITEMA_MASTERMAGE))
{
SET_BIT (ch->itemaffect, ITEMA_MASTERMAGE);
stc ("Your body starts humming with untapped magical power.\n\r", ch);
act ("$n's body starts humming with untapped magical power.", ch, NULL,
NULL, TO_ROOM);
}
if (IS_SET (obj->weapflags, WEAPON_SKINDANCER)
&& !IS_NYM (ch, NYM_SKINDANCER))
{
SET_BIT (ch->nymbits, NYM_SKINDANCER);
act
("$p hums and throbs with magical energy as you wield it in your hand.",
ch, obj, NULL, TO_CHAR);
act
("$p hums and throbs with magical energy as $n wields it in $s hand.",
ch, obj, NULL, TO_ROOM);
}
if (obj->pIndexData->vnum == 29648 && IS_ELF (ch) && !IS_NPC (ch))
{
SET_BIT (ch->xxbits, XX_ARCHER);
}
if (obj->empflags[2] > 0 && !IS_NPC (ch)
&& !str_cmp (ch->name, obj->questowner) && obj->empflags[2] == ch->pcdata->empire[0])
{
if (obj->empire[0] > 0) {
ch->pcdata->mod_str += obj->empire[0];
ch->pcdata->mod_int += obj->empire[0];
ch->pcdata->mod_wis += obj->empire[0];
ch->pcdata->mod_dex += obj->empire[0];
ch->pcdata->mod_con += obj->empire[0];
}
if (obj->empire[1] > 0) {
ch->max_hit += obj->empire[1];
ch->max_mana += obj->empire[1];
ch->max_move += obj->empire[1];
}
if (obj->empire[2] > 0)
ch->pcdata->empireeq[2] += obj->empire[2];
if (obj->empire[3] > 0)
ch->pcdata->empireeq[3] += obj->empire[3];
if (obj->empire[4] > 0)
ch->pcdata->empireeq[4] += obj->empire[4];
}
if (IS_SET (obj->spectype, SITEM_LEGEND) && !IS_NPC (ch)
&& !str_cmp (ch->name, obj->questowner))
{
if (ch->legendeq < 17)
{
ch->legendeq++;
}
}
if (IS_SET (obj->weapflags, WEAPON_NEPHED) && !IS_NPC (ch)
&& IS_NEPHANDI (ch))
{
ch->pcdata->wres += 1;
}
/*
if (IS_SET (obj->weapflags, WEAPON_WRAITH) && !IS_NPC (ch) && IS_WRAITH (ch)
&& ch->class == CLASS_WRAITH)
{
ch->pcdata->wres += 5;
} */
if (IS_SET (obj->weapflags, WEAPON_WRAITH) && !IS_NPC (ch) && IS_WRAITH (ch)
&& ch->class != CLASS_WRAITH)
{
// ch->pcdata->wres += 3;
if (IS_BALEHOUND (ch) && ch->pcdata->wres >= 45)
{
stc ("You are surrounded by a shield of pure death!\n\r", ch);
act ("$n is surrounded by a shield of pure death!", ch, NULL, NULL,
TO_ROOM);
SET_BIT (ch->xxxbits, XXX_DEATHSHIELD);
}
}
if (IS_SET (obj->spectype, SITEM_DEMONIC) && !IS_NPC (ch) && IS_DEMON (ch))
{
if (ch->pcdata->demonic < 17)
{
ch->pcdata->demonic++;
if (obj->specpower == ARM_PURPLE)
ch->pcdata->atm += 3;
if (obj->specpower == ARM_RED)
ch->pcdata->atm += 4;
if (obj->specpower == ARM_BRASS)
ch->pcdata->atm += 5;
if (obj->specpower == ARM_BONE)
{
if (IS_SET (ch->polyaff, POLY_ANGELFORM) && IS_BSD (ch))
REMOVE_BIT (ch->polyaff, POLY_ANGELFORM);
ch->pcdata->atm += 6;
ch->pcdata->bonearmor++;
if (ch->pcdata->bonearmor < 0)
ch->pcdata->bonearmor = 0;
if (ch->pcdata->bonearmor > 15)
ch->pcdata->bonearmor = 15;
if (ch->pcdata->bonearmor >= 15)
{
if (!IS_POLYAFF (ch, POLY_BSDFORM))
{
act
("Your skeletal armor seems to come alive and merges together like a second skin.",
ch, NULL, NULL, TO_CHAR);
act
("$n's skeletal armor seems to come alive and merges together like a grotesque second skin.",
ch, NULL, NULL, TO_ROOM);
SET_BIT (ch->polyaff, POLY_BSDFORM);
free_string (ch->morph);
ch->morph = str_dup (get_form (ch));
}
}
}
}
}
if ((((obj->item_type == ITEM_ARMOR) && (obj->value[3] >= 1))
|| ((obj->item_type == ITEM_WEAPON) && (obj->value[0] >= 1000))
|| IS_SET (obj->spectype, SITEM_SILVER)
|| IS_SET (obj->spectype, SITEM_DEMONIC)
|| IS_SET (obj->quest, QUEST_ARTIFACT))
&& !IS_SET (obj->weapflags, WEAPON_SOULJAR))
/* && obj->item_type != ITEM_QUIVER
&& obj->item_type != ITEM_ARROW
&& obj->item_type != ITEM_BOW)*/
{
/* It would be so much easier if weapons had 5 values *sigh*.
* Oh well, I'll just have to use v0 for two. KaVir.
*/
if (obj->pIndexData->vnum == 30343)
{
if (obj->value[3] == 16)
obj->value[3] = 0;
}
if (obj->item_type == ITEM_ARMOR)
sn = obj->value[3];
else
sn = obj->value[0] / 1000;
if ((sn == 4) && (IS_AFFECTED (ch, AFF_BLIND)))
return;
else if ((sn == 27) && (IS_AFFECTED (ch, AFF_DETECT_INVIS)))
return;
else if ((sn == 39) && (IS_AFFECTED (ch, AFF_FLYING)))
return;
else if ((sn == 45) && (IS_AFFECTED (ch, AFF_INFRARED)))
return;
else if ((sn == 46) && (IS_AFFECTED (ch, AFF_INVISIBLE)))
return;
else if ((sn == 52) && (IS_AFFECTED (ch, AFF_PASS_DOOR)))
return;
else if ((sn == 54) && (IS_AFFECTED (ch, AFF_PROTECT)))
return;
else if ((sn == 57) && (IS_AFFECTED (ch, AFF_SANCTUARY)))
return;
else if ((sn == 2) && (IS_AFFECTED (ch, AFF_DETECT_INVIS)))
return;
else if ((sn == 3) && (IS_AFFECTED (ch, AFF_FLYING)))
return;
else if ((sn == 1) && (IS_AFFECTED (ch, AFF_INFRARED)))
return;
else if ((sn == 5) && (IS_AFFECTED (ch, AFF_INVISIBLE)))
return;
else if ((sn == 6) && (IS_AFFECTED (ch, AFF_PASS_DOOR)))
return;
else if ((sn == 7) && (IS_AFFECTED (ch, AFF_PROTECT)))
return;
else if ((sn == 8) && (IS_AFFECTED (ch, AFF_SANCTUARY)))
return;
else if ((sn == 9) && (IS_AFFECTED (ch, AFF_SNEAK)))
return;
else if ((sn == 10) && (IS_ITEMAFF (ch, ITEMA_SHOCKSHIELD)))
return;
else if ((sn == 11) && (IS_ITEMAFF (ch, ITEMA_FIRESHIELD)))
return;
else if ((sn == 12) && (IS_ITEMAFF (ch, ITEMA_ICESHIELD)))
return;
else if ((sn == 13) && (IS_ITEMAFF (ch, ITEMA_ACIDSHIELD)))
return;
else if ((sn == 14) && (IS_ITEMAFF (ch, ITEMA_BLADESHIELD)))
return;
else if ((sn == 15) && (IS_ITEMAFF (ch, ITEMA_CHAOSSHIELD)))
return;
else if ((sn == 16) && (IS_ITEMAFF (ch, ITEMA_REGENERATE)))
return;
else if ((sn == 17) && (IS_ITEMAFF (ch, ITEMA_SPEED)))
return;
else if ((sn == 18) && (IS_ITEMAFF (ch, ITEMA_VORPAL)))
return;
else if ((sn == 19) && (IS_ITEMAFF (ch, ITEMA_PEACE)))
return;
else if ((sn == 20) && (IS_ITEMAFF (ch, ITEMA_REFLECT)))
return;
else if ((sn == 21) && (IS_ITEMAFF (ch, ITEMA_RESISTANCE)))
return;
else if ((sn == 22) && (IS_ITEMAFF (ch, ITEMA_VISION)))
return;
else if ((sn == 23) && (IS_ITEMAFF (ch, ITEMA_STALKER)))
return;
else if ((sn == 24) && (IS_ITEMAFF (ch, ITEMA_VANISH)))
return;
else if ((sn == 25) && (IS_ITEMAFF (ch, ITEMA_RAGER)))
return;
else if ((sn == 26) && (IS_ITEMAFF (ch, ITEMA_SHADES)))
return;
if (sn == 4)
{
SET_BIT (ch->affected_by, AFF_BLIND);
send_to_char ("You cannot see a thing!\n\r", ch);
act ("$n seems to be blinded!", ch, NULL, NULL, TO_ROOM);
}
else if (sn == 27 || sn == 2)
{
SET_BIT (ch->affected_by, AFF_DETECT_INVIS);
send_to_char ("Your eyes tingle.\n\r", ch);
act ("$n's eyes flicker with light.", ch, NULL, NULL, TO_ROOM);
}
else if (sn == 39 || sn == 3)
{
SET_BIT (ch->affected_by, AFF_FLYING);
send_to_char ("Your feet rise off the ground.\n\r", ch);
act ("$n's feet rise off the ground.", ch, NULL, NULL, TO_ROOM);
}
else if (sn == 45 || sn == 1)
{
SET_BIT (ch->affected_by, AFF_INFRARED);
send_to_char ("Your eyes glow fiery red.\n\r", ch);
act ("$n's eyes glow fiery red.", ch, NULL, NULL, TO_ROOM);
}
else if (sn == 46 || sn == 5)
{
SET_BIT (ch->affected_by, AFF_INVISIBLE);
send_to_char ("You fade out of existance.\n\r", ch);
act ("$n fades out of existance.", ch, NULL, NULL, TO_ROOM);
}
else if (sn == 52 || sn == 6)
{
SET_BIT (ch->affected_by, AFF_PASS_DOOR);
send_to_char ("You turn translucent.\n\r", ch);
act ("$n turns translucent.", ch, NULL, NULL, TO_ROOM);
}
else if (sn == 54 || sn == 7)
{
SET_BIT (ch->affected_by, AFF_PROTECT);
send_to_char ("You are surrounded by a divine aura.\n\r", ch);
act ("$n is surrounded by a divine aura.", ch, NULL, NULL, TO_ROOM);
}
else if (sn == 57 || sn == 8)
{
SET_BIT (ch->affected_by, AFF_SANCTUARY);
send_to_char ("You are surrounded by a white aura.\n\r", ch);
act ("$n is surrounded by a white aura.", ch, NULL, NULL, TO_ROOM);
}
else if (sn == 9)
{
SET_BIT (ch->affected_by, AFF_SNEAK);
send_to_char ("Your footsteps stop making any sound.\n\r", ch);
act ("$n's footsteps stop making any sound.", ch, NULL, NULL,
TO_ROOM);
}
else if (sn == 10)
{
SET_BIT (ch->itemaffect, ITEMA_SHOCKSHIELD);
send_to_char
("You are surrounded by a crackling shield of lightning.\n\r",
ch);
act ("$n is surrounded by a crackling shield of lightning.", ch,
NULL, NULL, TO_ROOM);
}
else if (sn == 11)
{
SET_BIT (ch->itemaffect, ITEMA_FIRESHIELD);
send_to_char
("You are surrounded by a burning shield of flames.\n\r", ch);
act ("$n is surrounded by a burning shield of flames.", ch, NULL,
NULL, TO_ROOM);
}
else if (sn == 12)
{
SET_BIT (ch->itemaffect, ITEMA_ICESHIELD);
send_to_char
("You are surrounded by a shimmering shield of ice.\n\r", ch);
act ("$n is surrounded by a shimmering shield of ice.", ch, NULL,
NULL, TO_ROOM);
}
else if (sn == 13)
{
SET_BIT (ch->itemaffect, ITEMA_ACIDSHIELD);
send_to_char
("You are surrounded by a bubbling shield of acid.\n\r", ch);
act ("$n is surrounded by a bubbling shield of acid.", ch, NULL,
NULL, TO_ROOM);
}
else if (sn == 14)
{
SET_BIT (ch->itemaffect, ITEMA_BLADESHIELD);
send_to_char
("You are surrounded by a shield of swirling blades.\n\r", ch);
act ("$n is surrounded by a shield of swirling blades.", ch, NULL,
NULL, TO_ROOM);
}
else if (sn == 15)
{
SET_BIT (ch->itemaffect, ITEMA_CHAOSSHIELD);
send_to_char
("You are surrounded by a swirling shield of chaos.\n\r", ch);
act ("$n is surrounded by a swirling shield of chaos.", ch, NULL,
NULL, TO_ROOM);
}
else if (sn == 16)
{
SET_BIT (ch->itemaffect, ITEMA_REGENERATE);
send_to_char ("You start regening faster.\n\r", ch);
}
else if (sn == 17)
{
SET_BIT (ch->itemaffect, ITEMA_SPEED);
send_to_char
("You start moving faster than the eye can follow.\n\r", ch);
act ("$n starts moving faster than the eye can follow.", ch, NULL,
NULL, TO_ROOM);
}
else if (sn == 18)
{
SET_BIT (ch->itemaffect, ITEMA_VORPAL);
send_to_char
("You get the feeling that you can cut through anything.\n\r",
ch);
}
else if (sn == 19)
{
SET_BIT (ch->itemaffect, ITEMA_PEACE);
send_to_char ("You feel more peaceful.\n\r", ch);
}
else if (sn == 20)
{
SET_BIT (ch->itemaffect, ITEMA_REFLECT);
send_to_char
("You are surrounded by a flickering shield of darkness.\n\r",
ch);
act ("$n is surrounded by a flickering shield of darkness.", ch,
NULL, NULL, TO_ROOM);
}
else if (sn == 21)
{
SET_BIT (ch->itemaffect, ITEMA_RESISTANCE);
send_to_char ("You feel a presence protecting you from damage.\n\r",
ch);
}
else if (sn == 22)
{
SET_BIT (ch->itemaffect, ITEMA_VISION);
send_to_char ("Your eyes begin to shimmer with a bright white.\n\r",
ch);
act ("$n's eyes begin to shimmer with a bright white.", ch, NULL,
NULL, TO_ROOM);
}
else if (sn == 23)
SET_BIT (ch->itemaffect, ITEMA_STALKER);
else if (sn == 24)
{
SET_BIT (ch->itemaffect, ITEMA_VANISH);
send_to_char ("You blend into the shadows.\n\r", ch);
act ("$n gradually fades into the shadows.", ch, NULL, NULL,
TO_ROOM);
}
else if (sn == 25 && !IS_NPC (ch))
{
SET_BIT (ch->itemaffect, ITEMA_RAGER);
if (IS_WEREWOLF (ch) && ch->pcdata->wolf < 100)
{
if (IS_VAMPIRE (ch))
ch->pcdata->vamprage = ch->beast * 2.5;
ch->pcdata->wolf = 300;
do_werewolf (ch, "");
}
else if (IS_WEREWOLF (ch))
{
if (IS_VAMPIRE (ch))
ch->pcdata->vamprage = ch->beast * 2.5;
ch->pcdata->wolf = 300;
}
else if (IS_VAMPIRE (ch))
ch->pcdata->vamprage = ch->beast * 2.5;
else if (IS_NINJA (ch))
ch->pcdata->npowers[NINJA_RAGE] = 200;
}
else if (sn == 26)
SET_BIT (ch->itemaffect, ITEMA_SHADES);
if (IS_SET (obj->spectype, SITEM_HIGHLANDER) && !IS_NPC (ch)
&& obj->item_type == ITEM_WEAPON)
{
SET_BIT (ch->itemaffect, ITEMA_HIGHLANDER);
}
if (IS_HL (ch) && !IS_SET (ch->itemaffect, ITEMA_HIGHLANDER) &&
IS_SET (obj->quest, QUEST_ARTIFACT)
&& obj->item_type == ITEM_WEAPON)
{
SET_BIT (ch->itemaffect, ITEMA_HIGHLANDER);
}
if (IS_SET (obj->quest, QUEST_ARTIFACT))
SET_BIT (ch->itemaffect, ITEMA_ARTIFACT);
if (IS_SET (obj->spectype, SITEM_SILVER) && obj->wear_loc == WEAR_WIELD)
SET_BIT (ch->itemaffect, ITEMA_RIGHT_SILVER);
if (IS_SET (obj->spectype, SITEM_SILVER) && obj->wear_loc == WEAR_HOLD)
SET_BIT (ch->itemaffect, ITEMA_LEFT_SILVER);
}
return;
}
/*
* Unequip a char with an obj.
*/
void
unequip_char (CHAR_DATA * ch, OBJ_DATA * obj)
{
CHAR_DATA *chch;
AFFECT_DATA *paf;
int sn;
int oldpos = obj->wear_loc;
if (obj->wear_loc == WEAR_NONE)
{
bug ("Unequip_char: already unequipped.", 0);
return;
}
if (obj->wear_loc == WEAR_SCABBARD_L || obj->wear_loc == WEAR_SCABBARD_R
|| obj->wear_loc == WEAR_SCABBARD_BACK || obj->wear_loc == WEAR_STAKE)
{
obj->wear_loc = -1;
return;
}
if (IS_NPC (ch) || !IS_HIGHLANDER (ch))
ch->armor += apply_ac (obj, obj->wear_loc);
else if (IS_HIGHLANDER (ch))
{
if (IS_SET (obj->spectype, SITEM_HIGHLANDER))
ch->armor += apply_ac (obj, obj->wear_loc);
else if (IS_SET (obj->quest, QUEST_ARTIFACT))
ch->armor += apply_ac (obj, obj->wear_loc);
}
obj->wear_loc = -1;
if (IS_NPC (ch) || !IS_HIGHLANDER (ch))
{
for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next)
objaffect_modify (ch, obj, paf, FALSE);
for (paf = obj->affected; paf != NULL; paf = paf->next)
objaffect_modify (ch, obj, paf, FALSE);
}
else if (IS_HIGHLANDER (ch))
{
if (IS_SET (obj->spectype, SITEM_HIGHLANDER))
{
for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next)
objaffect_modify (ch, obj, paf, FALSE);
for (paf = obj->affected; paf != NULL; paf = paf->next)
objaffect_modify (ch, obj, paf, FALSE);
}
else if (IS_SET (obj->quest, QUEST_ARTIFACT))
{
for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next)
objaffect_modify (ch, obj, paf, FALSE);
for (paf = obj->affected; paf != NULL; paf = paf->next)
objaffect_modify (ch, obj, paf, FALSE);
}
}
if (obj->item_type == ITEM_LIGHT
&& obj->value[2] != 0 && ch->in_room != NULL && ch->in_room->light > 0)
--ch->in_room->light;
if (!IS_NPC (ch) && ch->pcdata->powers_set_wear > 0)
set_disc (ch);
if ((chch = get_char_world (ch, ch->name)) == NULL)
return;
if (chch->desc != ch->desc)
return;
if (!IS_NPC (ch)
&& (ch->desc != NULL && ch->desc->connected != CON_PLAYING))
return;
if (obj->chpoweroff != NULL && obj->chpoweroff != '\0'
&& str_cmp (obj->chpoweroff, "(null)")
&& !IS_SET (obj->spectype, SITEM_TELEPORTER)
&& !IS_SET (obj->spectype, SITEM_TRANSPORTER))
{
kavitem (str_dup (obj->chpoweroff), ch, obj, NULL, TO_CHAR);
if (IS_SET (obj->spectype, SITEM_ACTION))
kavitem (str_dup (obj->chpoweroff), ch, obj, NULL, TO_ROOM);
}
if (obj->victpoweroff != NULL && obj->victpoweroff != '\0'
&& str_cmp (obj->victpoweroff, "(null)")
&& !IS_SET (obj->spectype, SITEM_ACTION)
&& !IS_SET (obj->spectype, SITEM_TELEPORTER)
&& !IS_SET (obj->spectype, SITEM_TRANSPORTER))
kavitem (str_dup (obj->victpoweroff), ch, obj, NULL, TO_ROOM);
if (obj->empflags[2] > 0 && !IS_NPC (ch)
&& !str_cmp (ch->name, obj->questowner) && obj->empflags[2] == ch->pcdata->empire[0])
{
if (obj->empire[0] > 0) {
ch->pcdata->mod_str -= obj->empire[0];
ch->pcdata->mod_int -= obj->empire[0];
ch->pcdata->mod_wis -= obj->empire[0];
ch->pcdata->mod_dex -= obj->empire[0];
ch->pcdata->mod_con -= obj->empire[0];
}
// if (obj->empire[1] > 0)
// ch->pcdata->empireeq[1] -= obj->empire[1];
if (obj->empire[1] > 0) {
ch->max_hit -= obj->empire[1];
ch->max_mana -= obj->empire[1];
ch->max_move -= obj->empire[1];
}
if (obj->empire[2] > 0)
ch->pcdata->empireeq[2] -= obj->empire[2];
if (obj->empire[3] > 0)
ch->pcdata->empireeq[3] -= obj->empire[3];
if (obj->empire[4] > 0)
ch->pcdata->empireeq[4] -= obj->empire[4];
}
if (IS_SET (obj->spectype, SITEM_LEGEND) && !IS_NPC (ch)
&& ch->legendeq > 0)
{
ch->legendeq--;
}
if (IS_SET (obj->weapflags, WEAPON_SPELLORB) && obj->value[0] != 15000)
obj->value[0] = 15000;
if (IS_SET (obj->weapflags, WEAPON_WRAITH) && !IS_NPC (ch) && IS_WRAITH (ch)
&& ch->class == CLASS_WRAITH)
{
ch->pcdata->wres -= 5;
}
if (IS_SET (obj->weapflags, WEAPON_WRAITH) && !IS_NPC (ch) && IS_WRAITH (ch)
&& ch->class != CLASS_WRAITH)
{
ch->pcdata->wres -= 3;
if (IS_BALEHOUND (ch) && ch->pcdata->wres < 45)
{
stc ("You loose your shield of pure death!\n\r", ch);
act ("$n's shield of pure death fades away!", ch, NULL, NULL,
TO_ROOM);
REMOVE_BIT (ch->xxxbits, XXX_DEATHSHIELD);
}
}
if (IS_SET (obj->weapflags, WEAPON_NEPHED) && !IS_NPC (ch)
&& IS_NEPHANDI (ch))
{
ch->pcdata->wres -= 1;
}
if (IS_SET (obj->spectype, SITEM_DEMONIC) && !IS_NPC (ch)
&& ch->pcdata->demonic > 0 && IS_DEMON (ch))
{
ch->pcdata->demonic--;
if (obj->specpower == ARM_PURPLE)
ch->pcdata->atm -= 3;
if (obj->specpower == ARM_RED)
ch->pcdata->atm -= 4;
if (obj->specpower == ARM_BRASS)
ch->pcdata->atm -= 5;
if (obj->specpower == ARM_BONE)
{
ch->pcdata->atm -= 6;
ch->pcdata->bonearmor--;
if (ch->pcdata->bonearmor < 0)
ch->pcdata->bonearmor = 0;
if (ch->pcdata->bonearmor < 15)
{
if (IS_POLYAFF (ch, POLY_BSDFORM))
{
act
("Your skeletal armor stiffens and slides apart, looking quite normal.",
ch, NULL, NULL, TO_CHAR);
act
("$n's skeletal armor stiffens and slides apart, only looking grotesque now",
ch, NULL, NULL, TO_ROOM);
REMOVE_BIT (ch->polyaff, POLY_BSDFORM);
free_string (ch->morph);
ch->morph = str_dup (get_form (ch));
}
}
}
}
if (IS_SET (obj->weapflags, WEAPON_SUPERSPEED)
&& IS_ITEMAFF (ch, ITEMA_SUPERSPEED))
{
REMOVE_BIT (ch->itemaffect, ITEMA_SUPERSPEED);
stc ("Your movements slow down to normal.\n\r", ch);
act ("$n movements slow down to normal.", ch, NULL, NULL, TO_ROOM);
}
if (IS_SET (obj->weapflags, WEAPON_WEBBING) && IS_EM (ch, EM_WEBSPINNER))
{
REMOVE_BIT (ch->evenmore, EM_WEBSPINNER);
act
("$p stops spinning its spider silk as you remove it from your wrist.",
ch, obj, NULL, TO_CHAR);
act
("$p stops spinning its spider silk as $n removes it from $s wrist.",
ch, obj, NULL, TO_ROOM);
}
if (IS_SET (obj->weapflags, WEAPON_ARMOR) && IS_EM (ch, EM_ARMOR))
{
REMOVE_BIT (ch->evenmore, EM_ARMOR);
act
("The golden bubble surrounding you recedes back into $p.",
ch, obj, NULL, TO_CHAR);
act
("The golden bubble surrounding $n recedes back into $p.",
ch, obj, NULL, TO_ROOM);
}
if (!IS_NPC (ch) && IS_SET (obj->weapflags, WEAPON_REDEEMER)
&& IS_EM (ch, EM_REDEEMER))
{
do_souleater (ch, "");
REMOVE_BIT (ch->evenmore, EM_REDEEMER);
act ("You lose the telepathic link with $p.", ch, obj, NULL, TO_CHAR);
act
("$n seems to lose the hungry glint in $s eyes.",
ch, obj, NULL, TO_ROOM);
}
if (!IS_NPC (ch) && IS_SET (obj->weapflags, WEAPON_LORDLY)
&& IS_XXX (ch, XXX_LORDLY))
{
REMOVE_BIT (ch->xxxbits, XXX_LORDLY);
}
if (IS_SET (obj->weapflags, WEAPON_MASTERMAGE)
&& IS_ITEMAFF (ch, ITEMA_MASTERMAGE))
{
REMOVE_BIT (ch->itemaffect, ITEMA_MASTERMAGE);
stc ("Your feel normal again.\n\r", ch);
act ("$n looks normal again.", ch, NULL, NULL, TO_ROOM);
}
if (IS_SET (obj->weapflags, WEAPON_SKINDANCER)
&& IS_NYM (ch, NYM_SKINDANCER))
{
REMOVE_BIT (ch->nymbits, NYM_SKINDANCER);
act ("$p stops humming as you remove it from your hand.", ch, obj, NULL,
TO_CHAR);
act ("$p stops humming as $n sheaths it.", ch, obj, NULL, TO_ROOM);
}
if (obj->pIndexData->vnum == 29648 && IS_ELF (ch) && !IS_NPC (ch))
{
REMOVE_BIT (ch->xxbits, XX_ARCHER);
}
if ((((obj->item_type == ITEM_ARMOR) && (obj->value[3] >= 1))
|| ((obj->item_type == ITEM_WEAPON) && (obj->value[0] >= 1000))
|| IS_SET (obj->spectype, SITEM_SILVER)
|| IS_SET (obj->spectype, SITEM_DEMONIC)
|| IS_SET (obj->quest, QUEST_ARTIFACT))
&& !IS_SET (obj->weapflags, WEAPON_SOULJAR))
{
if (obj->item_type == ITEM_ARMOR)
sn = obj->value[3];
else
sn = obj->value[0] * 0.001;
if (IS_AFFECTED (ch, AFF_BLIND) && (sn == 4) && !is_affected (ch, 4))
{
REMOVE_BIT (ch->affected_by, AFF_BLIND);
send_to_char ("You can see again.\n\r", ch);
act ("$n seems to be able to see again.", ch, NULL, NULL, TO_ROOM);
}
else if (IS_AFFECTED (ch, AFF_DETECT_INVIS) && (sn == 27 || sn == 2)
&& !is_affected (ch, 27))
{
REMOVE_BIT (ch->affected_by, AFF_DETECT_INVIS);
send_to_char ("Your eyes stop tingling.\n\r", ch);
act ("$n's eyes stop flickering with light.", ch, NULL, NULL,
TO_ROOM);
}
else if (IS_AFFECTED (ch, AFF_FLYING) && (sn == 39 || sn == 3)
&& !is_affected (ch, 39))
{
REMOVE_BIT (ch->affected_by, AFF_FLYING);
send_to_char ("You slowly float to the ground.\n\r", ch);
act ("$n slowly floats to the ground.", ch, NULL, NULL, TO_ROOM);
}
else if (IS_AFFECTED (ch, AFF_INFRARED) && (sn == 45 || sn == 1)
&& !is_affected (ch, 45))
{
REMOVE_BIT (ch->affected_by, AFF_INFRARED);
send_to_char ("Your eyes stop glowing fiery red.\n\r", ch);
act ("$n's eyes stop glowing fiery red.", ch, NULL, NULL, TO_ROOM);
}
else if (IS_AFFECTED (ch, AFF_INVISIBLE) && (sn == 46 || sn == 5)
&& !is_affected (ch, 46))
{
REMOVE_BIT (ch->affected_by, AFF_INVISIBLE);
send_to_char ("You fade into existance.\n\r", ch);
act ("$n fades into existance.", ch, NULL, NULL, TO_ROOM);
}
else if (IS_AFFECTED (ch, AFF_PASS_DOOR) && (sn == 52 || sn == 6)
&& !is_affected (ch, 52))
{
REMOVE_BIT (ch->affected_by, AFF_PASS_DOOR);
send_to_char ("You feel solid again.\n\r", ch);
act ("$n is no longer translucent.", ch, NULL, NULL, TO_ROOM);
}
else if (IS_AFFECTED (ch, AFF_PROTECT) && (sn == 54 || sn == 7)
&& !is_affected (ch, 54))
{
REMOVE_BIT (ch->affected_by, AFF_PROTECT);
send_to_char ("The divine aura around you fades.\n\r", ch);
act ("The divine aura around $n fades.", ch, NULL, NULL, TO_ROOM);
}
else if (IS_AFFECTED (ch, AFF_SANCTUARY) && (sn == 57 || sn == 8)
&& !is_affected (ch, 57))
{
REMOVE_BIT (ch->affected_by, AFF_SANCTUARY);
send_to_char ("The white aura around your body fades.\n\r", ch);
act ("The white aura about $n's body fades.", ch, NULL, NULL,
TO_ROOM);
}
else if (IS_AFFECTED (ch, AFF_SNEAK) && (sn == 9)
&& !is_affected (ch, 80))
{
REMOVE_BIT (ch->affected_by, AFF_SNEAK);
send_to_char ("You are no longer moving so quietly.\n\r", ch);
act ("$n is no longer moving so quietly.", ch, NULL, NULL, TO_ROOM);
}
else if (IS_ITEMAFF (ch, ITEMA_SHOCKSHIELD) && (sn == 10))
{
REMOVE_BIT (ch->itemaffect, ITEMA_SHOCKSHIELD);
send_to_char
("The crackling shield of lightning around you fades.\n\r", ch);
act ("The crackling shield of lightning around $n fades.", ch, NULL,
NULL, TO_ROOM);
}
else if (IS_ITEMAFF (ch, ITEMA_FIRESHIELD) && (sn == 11))
{
REMOVE_BIT (ch->itemaffect, ITEMA_FIRESHIELD);
send_to_char ("The burning shield of fire around you fades.\n\r",
ch);
act ("The burning shield of fire around $n fades.", ch, NULL, NULL,
TO_ROOM);
}
else if (IS_ITEMAFF (ch, ITEMA_ICESHIELD) && (sn == 12))
{
REMOVE_BIT (ch->itemaffect, ITEMA_ICESHIELD);
send_to_char ("The shimmering shield of ice around you fades.\n\r",
ch);
act ("The shimmering shield of ice around $n fades.", ch, NULL,
NULL, TO_ROOM);
}
else if (IS_ITEMAFF (ch, ITEMA_ACIDSHIELD) && (sn == 13))
{
REMOVE_BIT (ch->itemaffect, ITEMA_ACIDSHIELD);
send_to_char ("The bubbling shield of acid around you fades.\n\r",
ch);
act ("The bubbling shield of acid around $n fades.", ch, NULL, NULL,
TO_ROOM);
}
else if (IS_ITEMAFF (ch, ITEMA_BLADESHIELD) && (sn == 14))
{
REMOVE_BIT (ch->itemaffect, ITEMA_BLADESHIELD);
send_to_char ("The shield of swirling blades around you fades.\n\r",
ch);
act ("The shield of swirling blades around $n fades.", ch, NULL,
NULL, TO_ROOM);
}
else if (IS_ITEMAFF (ch, ITEMA_CHAOSSHIELD) && (sn == 15))
{
REMOVE_BIT (ch->itemaffect, ITEMA_CHAOSSHIELD);
send_to_char ("The swirling shield of chaos around you fades.\n\r",
ch);
act ("The swirling shield of chaos around $n fades.", ch, NULL,
NULL, TO_ROOM);
}
else if (sn == 16)
REMOVE_BIT (ch->itemaffect, ITEMA_REGENERATE);
else if (IS_ITEMAFF (ch, ITEMA_SPEED) && (sn == 17))
{
REMOVE_BIT (ch->itemaffect, ITEMA_SPEED);
send_to_char ("Your actions slow down to normal speed.\n\r", ch);
act ("$n stops moving at supernatural speed.", ch, NULL, NULL,
TO_ROOM);
}
else if (sn == 18)
REMOVE_BIT (ch->itemaffect, ITEMA_VORPAL);
else if (sn == 19)
REMOVE_BIT (ch->itemaffect, ITEMA_PEACE);
else if (IS_ITEMAFF (ch, ITEMA_REFLECT) && sn == 20)
{
REMOVE_BIT (ch->itemaffect, ITEMA_REFLECT);
send_to_char
("The flickering shield of darkness around you fades.\n\r", ch);
act ("The flickering shield of darkness around $n fades.", ch, NULL,
NULL, TO_ROOM);
}
else if (sn == 21)
REMOVE_BIT (ch->itemaffect, ITEMA_RESISTANCE);
else if (IS_ITEMAFF (ch, ITEMA_VISION) && sn == 22)
{
REMOVE_BIT (ch->itemaffect, ITEMA_VISION);
send_to_char ("Your eyes stop shimmery with a bright white.\n\r",
ch);
act ("$n's eyes stop shimmering with a bright white.", ch, NULL,
NULL, TO_ROOM);
}
else if (sn == 23)
REMOVE_BIT (ch->itemaffect, ITEMA_STALKER);
else if (IS_ITEMAFF (ch, ITEMA_VANISH) && sn == 24)
{
REMOVE_BIT (ch->itemaffect, ITEMA_VANISH);
send_to_char ("You emerge from the shadows.\n\r", ch);
act ("$n gradually fades out of the shadows.", ch, NULL, NULL,
TO_ROOM);
}
else if (sn == 25 && !IS_NPC (ch) && IS_ITEMAFF (ch, ITEMA_RAGER))
{
REMOVE_BIT (ch->itemaffect, ITEMA_RAGER);
if (IS_WEREWOLF (ch) && ch->pcdata->wolf >= 100)
{
if (IS_VAMPIRE (ch))
ch->pcdata->vamprage = 0;
ch->pcdata->wolf = 0;
do_unwerewolf (ch, "");
}
else if (IS_VAMPIRE (ch))
ch->pcdata->vamprage = 0;
else if (IS_NINJA (ch))
ch->pcdata->npowers[NINJA_RAGE] = 0;
}
else if (IS_ITEMAFF (ch, ITEMA_SHADES) && (sn == 26))
REMOVE_BIT (ch->itemaffect, ITEMA_SHADES);
}
if (IS_SET (obj->spectype, SITEM_HIGHLANDER) && !IS_NPC (ch)
&& obj->item_type == ITEM_WEAPON)
{
REMOVE_BIT (ch->itemaffect, ITEMA_HIGHLANDER);
}
if (IS_HL (ch) && IS_SET (ch->itemaffect, ITEMA_HIGHLANDER) &&
IS_SET (obj->quest, QUEST_ARTIFACT) && obj->item_type == ITEM_WEAPON)
{
REMOVE_BIT (ch->itemaffect, ITEMA_HIGHLANDER);
}
if (IS_SET (obj->quest, QUEST_ARTIFACT))
REMOVE_BIT (ch->itemaffect, ITEMA_ARTIFACT);
if (IS_SET (obj->spectype, SITEM_SILVER) && oldpos == WEAR_WIELD)
REMOVE_BIT (ch->itemaffect, ITEMA_RIGHT_SILVER);
else if (IS_SET (obj->spectype, SITEM_SILVER) && oldpos == WEAR_HOLD)
REMOVE_BIT (ch->itemaffect, ITEMA_LEFT_SILVER);
if (IS_ITEMAFF (ch, ITEMA_RIGHT_AGG) && oldpos == WEAR_WIELD)
REMOVE_BIT (ch->itemaffect, ITEMA_RIGHT_AGG);
else if (IS_ITEMAFF (ch, ITEMA_LEFT_AGG) && oldpos == WEAR_HOLD)
REMOVE_BIT (ch->itemaffect, ITEMA_LEFT_AGG);
if (IS_XBITS (ch, X_RIGHT_POISON) && oldpos == WEAR_WIELD)
REMOVE_BIT (ch->xbits, X_RIGHT_POISON);
else if (IS_XBITS (ch, X_LEFT_POISON) && oldpos == WEAR_HOLD)
REMOVE_BIT (ch->xbits, X_LEFT_POISON);
if (IS_XBITS (ch, X_RIGHT_SHOCK) && oldpos == WEAR_WIELD)
REMOVE_BIT (ch->xbits, X_RIGHT_SHOCK);
else if (IS_XBITS (ch, X_LEFT_SHOCK) && oldpos == WEAR_HOLD)
REMOVE_BIT (ch->xbits, X_LEFT_SHOCK);
if (IS_XBITS (ch, X_RIGHT_FROST) && oldpos == WEAR_WIELD)
REMOVE_BIT (ch->xbits, X_RIGHT_FROST);
else if (IS_XBITS (ch, X_LEFT_FROST) && oldpos == WEAR_HOLD)
REMOVE_BIT (ch->xbits, X_LEFT_FROST);
if (IS_XBITS (ch, X_RIGHT_FLAMING) && oldpos == WEAR_WIELD)
REMOVE_BIT (ch->xbits, X_RIGHT_FLAMING);
else if (IS_XBITS (ch, X_LEFT_FLAMING) && oldpos == WEAR_HOLD)
REMOVE_BIT (ch->xbits, X_LEFT_FLAMING);
if (IS_XBITS (ch, X_RIGHT_ACID) && oldpos == WEAR_WIELD)
REMOVE_BIT (ch->xbits, X_RIGHT_ACID);
else if (IS_XBITS (ch, X_LEFT_ACID) && oldpos == WEAR_HOLD)
REMOVE_BIT (ch->xbits, X_LEFT_ACID);
if (IS_XBITS (ch, X_RIGHT_HOLY) && oldpos == WEAR_WIELD)
REMOVE_BIT (ch->xbits, X_RIGHT_HOLY);
else if (IS_XBITS (ch, X_LEFT_HOLY) && oldpos == WEAR_HOLD)
REMOVE_BIT (ch->xbits, X_LEFT_HOLY);
return;
}
/*
* Count occurrences of an obj in a list.
*/
int
count_obj_list (OBJ_INDEX_DATA * pObjIndex, OBJ_DATA * list)
{
OBJ_DATA *obj;
int nMatch;
nMatch = 0;
for (obj = list; obj != NULL; obj = obj->next_content)
{
if (obj->pIndexData == pObjIndex)
nMatch++;
}
return nMatch;
}
/*
* Move an obj out of a room.
*/
void
obj_from_room (OBJ_DATA * obj)
{
ROOM_INDEX_DATA *in_room;
if (obj == NULL)
return;
if ((in_room = obj->in_room) == NULL)
{
bug ("obj_from_room: NULL.", 0);
return;
}
if (obj == in_room->contents)
{
in_room->contents = obj->next_content;
}
else
{
OBJ_DATA *prev;
for (prev = in_room->contents; prev; prev = prev->next_content)
{
if (prev->next_content == obj)
{
prev->next_content = obj->next_content;
break;
}
}
if (prev == NULL)
{
bug ("Obj_from_room: obj not found.", 0);
return;
}
}
obj->in_room = NULL;
obj->next_content = NULL;
return;
}
/*
* Move an obj into a room.
*/
void
obj_to_room (OBJ_DATA * obj, ROOM_INDEX_DATA * pRoomIndex)
{
if (obj == NULL)
return;
obj->next_content = pRoomIndex->contents;
pRoomIndex->contents = obj;
obj->in_room = pRoomIndex;
obj->carried_by = NULL;
obj->in_obj = NULL;
return;
}
/*
* Move an object into an object.
*/
void
obj_to_obj (OBJ_DATA * obj, OBJ_DATA * obj_to)
{
if (obj == NULL)
return;
obj->next_content = obj_to->contains;
obj_to->contains = obj;
obj->in_obj = obj_to;
obj->in_room = NULL;
obj->carried_by = NULL;
for (; obj_to != NULL; obj_to = obj_to->in_obj)
{
if (obj_to->carried_by != NULL
&& !IS_SET (obj_to->spectype, SITEM_MORPH))
obj_to->carried_by->carry_weight += get_obj_weight (obj);
}
return;
}
/*
* Move an object out of an object.
*/
void
obj_from_obj (OBJ_DATA * obj)
{
OBJ_DATA *obj_from;
if (obj == NULL)
return;
if ((obj_from = obj->in_obj) == NULL)
{
bug ("Obj_from_obj: null obj_from.", 0);
return;
}
if (obj == obj_from->contains)
{
obj_from->contains = obj->next_content;
}
else
{
OBJ_DATA *prev;
for (prev = obj_from->contains; prev; prev = prev->next_content)
{
if (prev->next_content == obj)
{
prev->next_content = obj->next_content;
break;
}
}
if (prev == NULL)
{
bug ("Obj_from_obj: obj not found.", 0);
return;
}
}
obj->next_content = NULL;
obj->in_obj = NULL;
for (; obj_from != NULL; obj_from = obj_from->in_obj)
{
if (obj_from->carried_by != NULL
&& !IS_SET (obj_from->spectype, SITEM_MORPH))
obj_from->carried_by->carry_weight -= get_obj_weight (obj);
}
return;
}
/*
* Extract an obj from the world.
*/
void
extract_obj (OBJ_DATA * obj)
{
CHAR_DATA *ch;
CHAR_DATA *wch;
OBJ_DATA *obj_content;
OBJ_DATA *obj_next;
ROOM_INDEX_DATA *to_room;
if (obj->item_type == ITEM_WALL && obj->in_room != NULL &&
obj->value[0] >= 0 && obj->value[0] <= 5)
{
EXIT_DATA *pexit;
int direction = obj->value[0];
if ((pexit = obj->in_room->exit[direction]) != NULL)
{
REMOVE_BIT (pexit->exit_info, EX_WALL_WATER);
REMOVE_BIT (pexit->exit_info, EX_WALL_GRANITE);
REMOVE_BIT (pexit->exit_info, EX_WALL_FLAME);
}
}
else if (obj->item_type == ITEM_WARD && obj->in_room != NULL &&
obj->value[0] >= 0 && obj->value[0] <= 5)
{
EXIT_DATA *pexit;
int direction = obj->value[0];
if ((pexit = obj->in_room->exit[direction]) != NULL)
{
REMOVE_BIT (pexit->exit_info, EX_WARD_GHOULS);
REMOVE_BIT (pexit->exit_info, EX_WARD_LUPINES);
REMOVE_BIT (pexit->exit_info, EX_WARD_KINDRED);
REMOVE_BIT (pexit->exit_info, EX_WARD_SPIRITS);
}
}
if (obj->in_room != NULL)
obj_from_room (obj);
else if (obj->carried_by != NULL)
obj_from_char (obj);
else if (obj->in_obj != NULL)
obj_from_obj (obj);
if (IS_SET (obj->quest, QUEST_SONG))
{
for (wch = char_list; wch != NULL; wch = wch->next)
{
if (IS_NPC (wch))
continue;
if (wch->pcdata->memorised == NULL)
continue;
if (wch->pcdata->memorised == obj)
{
send_to_char ("You suddenly forget what you were singing!\n\r",
wch);
wch->pcdata->memorised = NULL;
}
}
}
if ((ch = obj->chobj) != NULL
&& !IS_NPC (ch) && ch->pcdata->chobj == obj && IS_HEAD (ch, LOST_HEAD))
{
REMOVE_BIT (ch->loc_hp[0], LOST_HEAD);
REMOVE_BIT (ch->affected_by, AFF_POLYMORPH);
free_string (ch->morph);
ch->morph = str_dup ("");
ch->hit = 1;
ch->pcdata->chobj = NULL;
obj->chobj = NULL;
send_to_char ("Your soul is freed as a ghost.\n\r", ch);
if (ch->level < 3)
ch->level = 3;
SET_BIT (ch->nymbits, NYM_DEAD);
}
else if ((ch = obj->chobj) != NULL
&& !IS_NPC (ch)
&& ch->pcdata->chobj == obj
&& (IS_EXTRA (ch, EXTRA_OSWITCH) || ch->pcdata->obj_vnum != 0))
{
if (ch->pcdata->obj_vnum != 0)
{
send_to_char ("You have been destroyed!\n\r", ch);
ch->pcdata->chobj = NULL;
obj->chobj = NULL;
}
else
{
REMOVE_BIT (ch->extra, EXTRA_OSWITCH);
REMOVE_BIT (ch->affected_by, AFF_POLYMORPH);
free_string (ch->morph);
ch->morph = str_dup ("");
char_from_room (ch);
char_to_room (ch, get_room_index (ROOM_VNUM_ALTAR));
ch->pcdata->chobj = NULL;
obj->chobj = NULL;
send_to_char ("You return to your body.\n\r", ch);
}
}
else if (obj->chobj != NULL)
{
if (!IS_NPC (obj->chobj))
obj->chobj->pcdata->chobj = NULL;
obj->chobj = NULL;
bug ("Extract_obj: obj %d chobj invalid.", obj->pIndexData->vnum);
}
if ((ch = obj->sat) != NULL && ch->sat == obj)
{
obj->sat = NULL;
ch->sat = NULL;
}
if ((to_room = obj->to_room) != NULL && to_room->to_obj == obj)
{
obj->to_room = NULL;
to_room->to_obj = NULL;
}
for (obj_content = obj->contains; obj_content; obj_content = obj_next)
{
obj_next = obj_content->next_content;
if (obj->contains != NULL)
extract_obj (obj->contains);
}
if (object_list == obj)
{
object_list = obj->next;
}
else
{
OBJ_DATA *prev;
for (prev = object_list; prev != NULL; prev = prev->next)
{
if (prev->next == obj)
{
prev->next = obj->next;
break;
}
}
if (prev == NULL)
{
bug ("Extract_obj: obj %d not found.", obj->pIndexData->vnum);
return;
}
}
{
AFFECT_DATA *paf;
AFFECT_DATA *paf_next;
for (paf = obj->affected; paf != NULL; paf = paf_next)
{
paf_next = paf->next;
paf->next = affect_free;
affect_free = paf;
/* kavirp */
}
}
{
EXTRA_DESCR_DATA *ed;
EXTRA_DESCR_DATA *ed_next;
for (ed = obj->extra_descr; ed != NULL; ed = ed_next)
{
ed_next = ed->next;
free_string (ed->description);
free_string (ed->keyword);
/* kavirp */
ed->next = extra_descr_free;
extra_descr_free = ed;
}
}
free_string (obj->name);
free_string (obj->description);
free_string (obj->short_descr);
if (obj->chpoweron != NULL)
free_string (obj->chpoweron);
if (obj->chpoweroff != NULL)
free_string (obj->chpoweroff);
if (obj->chpoweruse != NULL)
free_string (obj->chpoweruse);
if (obj->victpoweron != NULL)
free_string (obj->victpoweron);
if (obj->victpoweroff != NULL)
free_string (obj->victpoweroff);
if (obj->victpoweruse != NULL)
free_string (obj->victpoweruse);
if (obj->actcommands != NULL)
free_string (obj->actcommands);
if (obj->questmaker != NULL)
free_string (obj->questmaker);
if (obj->questowner != NULL)
free_string (obj->questowner);
--obj->pIndexData->count;
obj->next = obj_free;
obj_free = obj;
return;
}
/*
* Extract a char from the world.
*/
void
extract_char (CHAR_DATA * ch, bool fPull)
{
CHAR_DATA *wch;
CHAR_DATA *familiar;
CHAR_DATA *wizard;
OBJ_DATA *obj;
OBJ_DATA *obj_next;
if (ch == NULL)
return;
if (ch->in_room == NULL)
{
bug ("Extract_char: NULL.", 0);
return;
}
if (fPull)
die_follower (ch);
stop_fighting (ch, TRUE);
for (obj = ch->carrying; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
extract_obj (obj);
}
if (IS_NPC (ch) || !IS_NPC (ch) && !IS_NYM (ch, NYM_DEAD))
char_from_room (ch);
if (IS_NPC (ch))
--ch->pIndexData->count;
else if (ch->pcdata->chobj != NULL)
{
ch->pcdata->chobj->chobj = NULL;
ch->pcdata->chobj = NULL;
}
if ((obj = ch->sat) != NULL && obj->sat == ch)
{
obj->sat = NULL;
ch->sat = NULL;
}
if (!fPull)
{
if (!IS_NPC (ch) && !IS_NYM (ch, NYM_DEAD))
char_to_room (ch, get_room_index (ROOM_VNUM_ALTAR));
return;
}
if (ch->desc != NULL && ch->desc->original != NULL)
do_return (ch, "");
for (wch = char_list; wch != NULL; wch = wch->next)
{
if (wch->reply == ch)
wch->reply = NULL;
}
if (ch == char_list)
{
char_list = ch->next;
}
else
{
CHAR_DATA *prev;
for (prev = char_list; prev != NULL; prev = prev->next)
{
if (prev->next == ch)
{
prev->next = ch->next;
break;
}
}
if (prev == NULL)
{
bug ("Extract_char: char not found.", 0);
return;
}
}
if (ch->desc)
ch->desc->character = NULL;
if ((wizard = ch->wizard) != NULL)
{
if (!IS_NPC (wizard))
wizard->pcdata->familiar = NULL;
ch->wizard = NULL;
}
if ((wizard = ch->mount) != NULL)
{
if (IS_SET (ch->mounted, IS_MOUNT))
{
send_to_char ("You fall to the ground.\n\r", wizard);
act ("$n falls to the ground.", wizard, NULL, NULL, TO_ROOM);
wizard->position = POS_RESTING;
}
wizard->mount = NULL;
wizard->mounted = 0;
ch->mount = NULL;
ch->mounted = 0;
}
if ((familiar = ch->embrace) != NULL)
{
ch->embrace = NULL;
ch->embraced = ARE_NONE;
familiar->embrace = NULL;
familiar->embraced = ARE_NONE;
}
if (!IS_NPC (ch))
{
if ((familiar = ch->pcdata->partner) != NULL)
ch->pcdata->partner = NULL;
if ((familiar = ch->pcdata->propose) != NULL)
{
ch->pcdata->propose = NULL;
familiar->pcdata->propose = NULL;
}
if ((familiar = ch->pcdata->familiar) != NULL)
{
familiar->wizard = NULL;
ch->pcdata->familiar = NULL;
if (IS_NPC (familiar))
{
act ("$n slowly fades away to nothing.", familiar, NULL, NULL,
TO_ROOM);
extract_char (familiar, TRUE);
}
}
}
for (familiar = char_list; familiar != NULL; familiar = familiar->next)
{
if (!IS_NPC (familiar) && familiar->pcdata->partner == ch)
familiar->pcdata->partner = NULL;
}
if (IS_NPC (ch) && strlen (ch->lord) > 1)
{
for (wch = char_list; wch != NULL; wch = wch->next)
{
if (IS_NPC (wch))
continue;
if (str_cmp (wch->name, ch->lord))
continue;
if (wch->pcdata->followers > 0)
wch->pcdata->followers--;
if (IS_EXTRA (wch, EXTRA_NO_ACTION))
REMOVE_BIT (wch->extra, EXTRA_NO_ACTION);
}
}
free_char (ch);
return;
}
/*
* Find a char in the room.
*/
CHAR_DATA *
get_char_room (CHAR_DATA * ch, char *argument)
{
char arg[MIL];
CHAR_DATA *rch;
int number;
int count;
number = number_argument (argument, arg);
count = 0;
if (is_abbr (arg, "self me myself")
&& (IS_NPC (ch) || ch->pcdata->chobj == NULL))
return ch;
for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
{
if (!IS_NPC (rch) && IS_HEAD (rch, LOST_HEAD))
continue;
else if (!IS_NPC (rch) && IS_EXTRA Showing the first 100 KB of 133.0 KB. Download the archive for the full file.