Ejemplo n.º 1
0
struct obj_data *unequip_char(struct char_data *ch, int pos)
{
  int j;
  struct obj_data *obj;

  if ((pos < 0 || pos >= NUM_WEARS) || GET_EQ(ch, pos) == NULL) {
    core_dump();
    return (NULL);
  }

  obj = GET_EQ(ch, pos);
  obj->worn_by = NULL;
  obj->worn_on = -1;

  if (GET_OBJ_TYPE(obj) == ITEM_ARMOR)
    GET_AC(ch) += apply_ac(ch, pos);

  if (IN_ROOM(ch) != NOWHERE) {
    if (pos == WEAR_LIGHT && GET_OBJ_TYPE(obj) == ITEM_LIGHT)
      if (GET_OBJ_VAL(obj, 2))	/* if light is ON */
	world[IN_ROOM(ch)].light--;
  } else
    log("SYSERR: IN_ROOM(ch) = NOWHERE when unequipping char %s.", GET_NAME(ch));

  GET_EQ(ch, pos) = NULL;

  for (j = 0; j < MAX_OBJ_AFFECT; j++)
    affect_modify_ar(ch, obj->affected[j].location,
		  obj->affected[j].modifier,
		  GET_OBJ_AFFECT(obj), FALSE);

  affect_total(ch);

  return (obj);
}
Ejemplo n.º 2
0
struct obj_data *unequip_char(struct char_data *ch, int pos)
{
  int j;
  struct obj_data *obj;
   
  assert(pos>=0 && pos<MAX_WEAR);
  assert(ch->equipment[pos]);
  
  obj = ch->equipment[pos];

  assert(!obj->in_obj && obj->in_room == NOWHERE && !obj->carried_by);

  if (GET_ITEM_TYPE(obj) == ITEM_ARMOR)
    GET_AC(ch) += apply_ac(ch, pos);
  
  ch->equipment[pos] = 0;
  obj->equipped_by = 0;
  obj->eq_pos = -1;
  
  for(j=0; j<MAX_OBJ_AFFECT; j++)
    affect_modify(ch, obj->affected[j].location,
		  (int)obj->affected[j].modifier,
		  obj->obj_flags.bitvector, FALSE);
  
  affect_total(ch);
  
  return(obj);
}
Ejemplo n.º 3
0
/* Remove an affected_type structure from a char (called when duration
   reaches zero). Pointer *af must never be NIL! Frees mem and calls 
   affect_location_apply                                                */
void affect_remove( struct char_data *ch, struct affected_type *af )
{
  struct affected_type *hjp;
  
  if (!ch->affected) {
    logE("affect removed from char without affect");
    logE(GET_NAME(ch));
    return;
  }
  
  affect_modify(ch, af->location, (int) af->modifier,
		af->bitvector, FALSE);
  
  
  /* remove structure *af from linked list */
  
  if (ch->affected == af) {
    /* remove head of list */
    ch->affected = af->next;
  } else {
    
    for(hjp = ch->affected; (hjp->next) && (hjp->next != af); hjp = hjp->next);
    
    if (hjp->next != af) {
      logE("Could not locate affected_type in ch->affected. (handler.c, affect_remove)");
      return;
    }
    hjp->next = af->next; /* skip the af element */
  }
  
  free ( af );
  
  affect_total(ch);
}
Ejemplo n.º 4
0
/* Remove an affected_type structure from a char (called when duration
   reaches zero). Pointer *af must never be NIL! Frees mem and calls 
   affect_location_apply                                                */
void affect_remove( struct char_data *ch, struct affected_type *af )
{
    struct affected_type *hjp;

    assert(ch->affected);

    affect_modify(ch, af->location, af->modifier,
		  af->bitvector, FALSE);


    /* remove structure *af from linked list */

    if (ch->affected == af) {
	/* remove head of list */
	ch->affected = af->next;
    } else {

	for(hjp = ch->affected; (hjp->next) && (hjp->next != af); hjp = hjp->next);

	if (hjp->next != af) {
	    log("FATAL : Could not locate affected_type in ch->affected. (handler.c, affect_remove)");
	    exit(1);
	}
	hjp->next = af->next; /* skip the af element */
    }

    free ( af );

    affect_total(ch);
}
Ejemplo n.º 5
0
void raw_kill(struct char_data *ch)
{
	if (ch->specials.fighting)
		stop_fighting(ch);

	death_cry(ch);

	make_corpse(ch);
	affect_total(ch); 
	extract_char(ch);
}
Ejemplo n.º 6
0
/* Insert an affect_type in a char_data structure
   Automatically sets apropriate bits and apply's */
void affect_to_char(struct char_data * ch, struct affected_type * af)
{
  struct affected_type *affected_alloc;

  CREATE(affected_alloc, struct affected_type, 1);

  *affected_alloc = *af;
  affected_alloc->next = ch->affected;
  ch->affected = affected_alloc;

  affect_modify(ch, af->location, af->modifier, af->bitvector, TRUE);
  affect_total(ch);
}
Ejemplo n.º 7
0
void equip_char(struct char_data *ch, struct obj_data *obj, int pos)
{
  int j;

  if (pos < 0 || pos >= NUM_WEARS) {
    core_dump();
    return;
  }

  if (GET_EQ(ch, pos)) {
    log("SYSERR: Char is already equipped: %s, %s", GET_NAME(ch),
	    obj->short_description);
    return;
  }
  if (obj->carried_by) {
    log("SYSERR: EQUIP: Obj is carried_by when equip.");
    return;
  }
  if (IN_ROOM(obj) != NOWHERE) {
    log("SYSERR: EQUIP: Obj is in_room when equip.");
    return;
  }
  if (invalid_align(ch, obj) || invalid_class(ch, obj)) {
    act("You are zapped by $p and instantly let go of it.", FALSE, ch, obj, 0, TO_CHAR);
    act("$n is zapped by $p and instantly lets go of it.", FALSE, ch, obj, 0, TO_ROOM);
    /* Changed to drop in inventory instead of the ground. */
    obj_to_char(obj, ch);
    return;
  }

  GET_EQ(ch, pos) = obj;
  obj->worn_by = ch;
  obj->worn_on = pos;

  if (GET_OBJ_TYPE(obj) == ITEM_ARMOR)
    GET_AC(ch) -= apply_ac(ch, pos);

  if (IN_ROOM(ch) != NOWHERE) {
    if (pos == WEAR_LIGHT && GET_OBJ_TYPE(obj) == ITEM_LIGHT)
      if (GET_OBJ_VAL(obj, 2))	/* if light is ON */
	world[IN_ROOM(ch)].light++;
  } else
    log("SYSERR: IN_ROOM(ch) = NOWHERE when equipping char %s.", GET_NAME(ch));

  for (j = 0; j < MAX_OBJ_AFFECT; j++)
    affect_modify_ar(ch, obj->affected[j].location,
		  obj->affected[j].modifier,
		  GET_OBJ_AFFECT(obj), TRUE);

  affect_total(ch);
}
Ejemplo n.º 8
0
/* Remove an affected_type structure from a char (called when duration reaches
 * zero). Pointer *af must never be NIL!  Frees mem and calls
 * affect_location_apply */
void affect_remove(struct char_data *ch, struct affected_type *af)
{
  struct affected_type *temp;

  if (ch->affected == NULL) {
    core_dump();
    return;
  }

  affect_modify_ar(ch, af->location, af->modifier, af->bitvector, FALSE);
  REMOVE_FROM_LIST(af, ch->affected, next);
  free(af);
  affect_total(ch);
}
Ejemplo n.º 9
0
struct obj_data *unequip_char(struct char_data * ch, int pos)
{
  int j;
  struct obj_data *obj;

  assert(pos >= 0 && pos < NUM_WEARS);
  assert(GET_EQ(ch, pos));

  obj = GET_EQ(ch, pos);
  obj->worn_by = NULL;
  obj->worn_on = -1;

  if (GET_OBJ_TYPE(obj) == ITEM_ARMOR)
    GET_AC(ch) += apply_ac(ch, pos);

  if (ch->in_room != NOWHERE) {
    if (pos == WEAR_LIGHT && GET_OBJ_TYPE(obj) == ITEM_LIGHT)
      if (GET_OBJ_VAL(obj, 2))	/* if light is ON */
	world[ch->in_room].light--;
  } else {
    log("SYSERR: ch->in_room = NOWHERE when un-equipping char.");
  }

  GET_EQ(ch, pos) = NULL;

  for (j = 0; j < MAX_OBJ_AFFECT; j++)
    affect_modify(ch, obj->affected[j].location,
		  obj->affected[j].modifier,
		  obj->obj_flags.bitvector, FALSE);

  if (affected_by_spell(ch, SKILL_ENVENOM) && (pos == WEAR_WIELD))
  {
    send_to_char("As your weapon leaves your hand, the venom on it dissipates.\r\n", ch);
    affect_from_char(ch, SKILL_ENVENOM);
  }

  if (affected_by_spell(ch, SPELL_ADAMANT_MACE) && (pos == WEAR_WIELD))
    affect_from_char(ch, SPELL_ADAMANT_MACE);

  affect_total(ch);

  return (obj);
}
Ejemplo n.º 10
0
void equip_char(struct char_data *ch, struct obj_data *obj, int pos)
{
    int j;

    assert(pos>=0 && pos<MAX_WEAR);
    assert(!(ch->equipment[pos]));

    if (obj->carried_by) {
	log("EQUIP: Obj is carried_by when equip.");
	return;
    }

    if (obj->in_room!=NOWHERE) {
	log("EQUIP: Obj is in_room when equip.");
	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))) {
	if (ch->in_room != NOWHERE) {
/*
	    act("You are zapped by $p and instantly drop it.", FALSE, ch, obj, 0, TO_CHAR);
	    act("$n is zapped by $p and instantly drop it.", FALSE, ch, obj, 0, TO_ROOM);
	    obj_to_room(obj, ch->in_room);
	    return; */
	} else {
	    log("ch->in_room = NOWHERE when equipping char.");
	}
    }

    ch->equipment[pos] = obj;

    if (GET_ITEM_TYPE(obj) == ITEM_ARMOR)
	GET_AC(ch) -= apply_ac(ch, pos);

    for(j=0; j<MAX_OBJ_AFFECT; j++)
	affect_modify(ch, obj->affected[j].location,
	  obj->affected[j].modifier,
	  obj->obj_flags.bitvector, TRUE);

    affect_total(ch);
}
Ejemplo n.º 11
0
void
restore_creature_affects(struct creature *ch, struct aff_stash *aff_stash)
{
    struct affected_type *cur_aff;
    int pos;

    for (pos = 0; pos < NUM_WEARS; pos++) {
        if (aff_stash->saved_eq[pos])
            equip_char(ch, aff_stash->saved_eq[pos], pos, EQUIP_WORN);
        if (aff_stash->saved_impl[pos])
            equip_char(ch, aff_stash->saved_impl[pos], pos, EQUIP_IMPLANT);
        if (aff_stash->saved_tattoo[pos])
            equip_char(ch, aff_stash->saved_tattoo[pos], pos, EQUIP_TATTOO);
    }

    for (cur_aff = aff_stash->saved_affs; cur_aff; cur_aff = cur_aff->next)
        affect_modify(ch, cur_aff->location, cur_aff->modifier,
                      cur_aff->bitvector, cur_aff->aff_index, true);
    ch->affected = aff_stash->saved_affs;
    affect_total(ch);
}
Ejemplo n.º 12
0
/* cause the morph to happen: universal thru this function to prevent errors */
void perform_morph(char_data *ch, ubyte form) {
	ACMD(do_dismount);
	double move_mod, health_mod, mana_mod;

	if (IS_NPC(ch)) {
		return;
	}

	if (IS_RIDING(ch) && form != MORPH_NONE) {
		do_dismount(ch, "", 0, 0);
	}

	// read current pools
	health_mod = (double) GET_HEALTH(ch) / GET_MAX_HEALTH(ch);
	move_mod = (double) GET_MOVE(ch) / GET_MAX_MOVE(ch);
	mana_mod = (double) GET_MANA(ch) / GET_MAX_MANA(ch);

	/* Remove his morph bonuses from his current form */
	update_morph_stats(ch, FALSE);

	/* Set the new form */
	GET_MORPH(ch) = form;

	/* Add new morph bonuses */
	update_morph_stats(ch, TRUE);
	
	// this fixes all the things
	affect_total(ch);

	// set new pools
	GET_HEALTH(ch) = (sh_int) (GET_MAX_HEALTH(ch) * health_mod);
	GET_MOVE(ch) = (sh_int) (GET_MAX_MOVE(ch) * move_mod);
	GET_MANA(ch) = (sh_int) (GET_MAX_MANA(ch) * mana_mod);

	/* check for claws */
	if (MORPH_FLAGGED(ch, MORPH_FLAG_NO_CLAWS) && AFF_FLAGGED(ch, AFF_CLAWS)) {
		affects_from_char_by_aff_flag(ch, AFF_CLAWS);
	}
}
Ejemplo n.º 13
0
void equip_char(struct char_data * ch, struct obj_data * obj, int pos)
{
  int j;
  int invalid_class(struct char_data *ch, struct obj_data *obj);
  int invalid_race(struct char_data *ch, struct obj_data *obj);

  assert(pos >= 0 && pos < NUM_WEARS);

  if (GET_EQ(ch, pos)) {
    GET_NAME(ch, chname);
    sprintf(buf, "SYSERR: Char is already equipped: %s, %s", chname,
	    obj->short_description);
    FREE_NAME(chname);
    log(buf);
    return;
  }

if (obj->carried_by) {
  log("SYSERR: EQUIP: Obj is carried_by when equip.");
    return;
  }

  if (obj->in_room != NOWHERE) {
    log("SYSERR: EQUIP: Obj is in_room when equip.");
    return;
  }

  /*  Let's change the messages here.  Soli, 8/12/99  */
  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)))
  {
      act("You are zapped by $p and instantly let go of it.", FALSE, ch, obj, 0, TO_CHAR);
      act("$n is zapped by $p and instantly lets go of it.", FALSE, ch, obj, 0, TO_ROOM);
      obj_to_char(obj, ch);	/* changed to drop in inventory instead of
				 * ground */
      return;
  }

  /*  I'm moving the other two to a seperate function, checked before we
      actually wear the eq.  Soli, 8/12/99  */

  GET_EQ(ch, pos) = obj;
  obj->worn_by = ch;
  obj->worn_on = pos;

  if (GET_OBJ_TYPE(obj) == ITEM_ARMOR)
    GET_AC(ch) -= apply_ac(ch, pos);

  if (ch->in_room != NOWHERE) {
    if (pos == WEAR_LIGHT && GET_OBJ_TYPE(obj) == ITEM_LIGHT)
      if (GET_OBJ_VAL(obj, 2))	/* if light is ON */
	world[ch->in_room].light++;
  } else {
    log("SYSERR: ch->in_room = NOWHERE when equipping char.");
  }

  for (j = 0; j < MAX_OBJ_AFFECT; j++)
    affect_modify(ch, obj->affected[j].location,
		  obj->affected[j].modifier,
		  obj->obj_flags.bitvector, TRUE);
  affect_total(ch);
}
Ejemplo n.º 14
0
void affect_from_char_II(struct char_data * ch, int skill, int type, int action)
{

 struct affected_type *aff, *next;
 struct affected_type *temp;
 struct affected_type af[3];
 int i, k;
 bool accum_affect = FALSE, accum_duration = FALSE;
 
 for (aff = ch->affected; aff; aff = next) {
    next = aff->next;
    if (aff->type == type) {
    affect_modify(ch, aff->location, aff->modifier, aff->bitvector, FALSE);
  REMOVE_FROM_LIST(aff, ch->affected, next);
  free(aff);
  affect_total(ch);
 }
}

if (action == 2) {
switch (skill) {
      case SPELL_POLYMORPH:
   if (PLR_FLAGGED(ch, PLR_RABBIT)){
REMOVE_BIT(PLR_FLAGS(ch), PLR_RABBIT);
REMOVE_BIT(PRF_FLAGS(ch), PRF_NOTSELF);
send_to_char("You feel yourself growing, and your ears shrinking. You no longer feel like a rabbit.\r\n", ch);
act("$n's body grows, $s ears shrinking. $n no longer looks like a rabbit.\r\n", 0, ch, 0, 0, TO_ROOM);

}
if (PLR_FLAGGED(ch, PLR_BIRD)) {
REMOVE_BIT(PLR_FLAGS(ch), PLR_BIRD);
REMOVE_BIT(PRF_FLAGS(ch), PRF_NOTSELF);
send_to_char("You feel yourself growing and your feathers falling away. You no longer feel like a bird.\r\n", ch);
act("$n's body grows, $s feathers falling away as it expands. $n no longer looks like a bird.\r\n", 0, ch, 0, 0, TO_ROOM);

}
if (PLR_FLAGGED(ch, PLR_WOLF)) {
REMOVE_BIT(PLR_FLAGS(ch), PLR_WOLF);
REMOVE_BIT(PRF_FLAGS(ch), PRF_NOTSELF);
send_to_char("You feel your your fur shed and your teeth shrink. You no longer feel like a wolf.\r\n", ch);
act("$n's teeth shrink, $s fur shedding. $n no longer looks like a wolf.\r\n", 0, ch, 0, 0, TO_ROOM);
}
if (PLR_FLAGGED(ch, PLR_BEAR)) {
REMOVE_BIT(PLR_FLAGS(ch), PLR_BEAR);
REMOVE_BIT(PRF_FLAGS(ch), PRF_NOTSELF);
send_to_char("Your claws shrink as does the rest of your body. You no longer feel like a bear.\r\n", ch);
act("$n's claws shrink as does the rest of $s body. $n no longer looks like a bear.\r\n", 0, ch, 0, 0, TO_ROOM);
}
if (PLR_FLAGGED(ch, PLR_CAT)){
REMOVE_BIT(PLR_FLAGS(ch), PLR_CAT);
REMOVE_BIT(PRF_FLAGS(ch), PRF_NOTSELF);
send_to_char("You feel your body growing, and your fur shedding. You no longer feel like a cat.\r\n", ch);
act("$n's body slowly grows, $s fur shedding. $n no longer looks like a cat.\r\n", 0, ch, 0, 0, TO_ROOM);
}

  for (k = 0; k < NUM_WEARS; k++)
  if (GET_EQ(ch, k)){
    GET_OBJ_DISGUISE(GET_EQ(ch, k)) = 0;
  }

       if (affected_by_spell(ch, SPELL_FLIGHT))
       affect_from_char_II(ch, SPELL_FLIGHT, SPELL_FLIGHT, 1);
       if (affected_by_spell(ch, SPELL_HASTE))
       affect_from_char_II(ch, SPELL_HASTE, SPELL_HASTE, 1);
       break;
      case SKILL_STANCE:

   if (!AFF_FLAGGED(ch, AFF_TIRED)) {
   for (i = 0; i < 3; i++) {
    af[0].type     = SPELL_DONTUSEME;
    af[0].location = APPLY_HITROLL;
    af[0].modifier = 2;
    af[0].duration = 7;
    af[0].bitvector = AFF_STANCE;

    af[1].type      = SPELL_DONTUSEME;
    af[1].location = APPLY_AC;
    af[1].modifier = -50;
    af[1].duration = 7;
    af[1].bitvector = AFF_STANCE;
 
    af[2].type      = SPELL_DONTUSEME;
    af[2].location = APPLY_STR;
    af[2].modifier = 2;
    af[2].duration = 7;
    af[2].bitvector = AFF_STANCE;


      if (af[i].bitvector || (af[i].location != APPLY_NONE)) {
        affect_join(ch, af+i, accum_duration, FALSE, accum_affect, FALSE);
      }
    }
}
     break;

    default:
      break;
  }
 }
}
Ejemplo n.º 15
0
/*
 * Remove an affected_type structure from a char (called when duration
 * reaches zero). Pointer *af must never be NIL!  Frees mem and calls
 * affect_location_apply
 */
void affect_remove(struct char_data * ch, struct affected_type * af, int output)
{
  struct affected_type *temp;
  struct affected_type aff;
  bool accum_affect = FALSE;
  int k;

  if (ch->affected == NULL) {
    core_dump();
    return;
  }

  switch (af->type)
  {

    case SPELL_CHARM:
    { 
      struct char_data* victim = ch->master;
      if (output == 0) break;

      affect_modify(ch, af->location, af->modifier, af->bitvector, FALSE);
      REMOVE_FROM_LIST(af, ch->affected, next);
      free(af);
      affect_total(ch);

      if (ch->master)
      {
        stop_follower(ch);
      }

      if (victim)
      {
        if(IS_NPC(ch))
        {
          SET_BIT(MOB_FLAGS(ch), MOB_AGGRESSIVE | MOB_MEMORY);
        }
        if (mag_savingthrow(victim, SAVING_SPELL))
        {
          hit(victim, ch, TYPE_UNDEFINED);
        }
      }
      return;
    }

    case SPELL_LIGHT:
      if (output == 0) break;
      if (!af->next || (af->next->type != af->type) ||
         (af->next->duration > 0)) 
      {
        if (world[ch->in_room].name != (char*) NULL)
        {
          world[ch->in_room].light -= 10;
        }
      }
      break;
    case SPELL_DARKNESS:
      if (output == 0) break;
      if (!af->next || (af->next->type != af->type) ||
         (af->next->duration > 0)) 
      {
        if (world[ch->in_room].name != (char*) NULL)
        {
          world[ch->in_room].light += 10;
        }
      }
      break;
    case SPELL_BLACK_PLAGUE:
      mag_affects(30, ch, ch, SPELL_BREATH_OF_LIFE, SAVING_SPELL);
      break;
    case SPELL_CALL_ANIMAL_SPIRIT:
    case SPELL_ANIMAL_SUMMONING:
    case SPELL_ANIMAL_SUMMONING_II:
    case SPELL_ANIMAL_SUMMONING_III:
    case SPELL_CONJURE_ELEMENTAL:
    case SPELL_GREATER_ELEMENTAL:
    case SPELL_DUST_DEVIL:
    case SPELL_STICKS_TO_SNAKES:
    case SPELL_SUMMON_INSECTS:
    case SPELL_AERIAL_SERVANT:
    case SPELL_SUMMON_GUARD:
      if (IS_NPC(ch))
      {
        if (GET_POS(ch) > POS_DEAD)
        {
          if (output == 1)
          {
            affect_modify(ch, af->location, af->modifier, af->bitvector, FALSE);
            REMOVE_FROM_LIST(af, ch->affected, next);
            free(af);
            affect_total(ch);

            GET_NAME(ch, chname);
	    stop_fighting(ch); /*Fighting Bug Fix Jasrags*/
            sprintf(buf, "%s disappears into thin air as the summoning ends.", 
              chname);
            act(buf, FALSE, world[ch->in_room].people, 0, 0, TO_ROOM);
            FREE_NAME(chname);
            extract_char(ch);
            ch = NULL;
            return;
          }
        }
      }
      break;
   case SPELL_POLYMORPH:
   if (!PRF_FLAGGED(ch, PRF_NOTSELF)) {
          affect_modify(ch, af->location, af->modifier, af->bitvector, FALSE);
          REMOVE_FROM_LIST(af, ch->affected, next);
          free(af);
          affect_total(ch);
          return;
   }
   break;
   case SPELL_DONTUSEME:
   if(AFF_FLAGGED(ch, AFF_STANCE) && !AFF_FLAGGED(ch, AFF_TIRED)) {
      aff.type = SKILL_STANCE;
      aff.duration = 2;
      aff.location = APPLY_STR;
      aff.modifier = -2;
      aff.bitvector = AFF_TIRED;
      accum_affect = FALSE;

      affect_to_char(ch, &aff);
    }
   break;
    default:
      break;
  }

  if (output && (af->type > 0) && (af->type <= MAX_SPELLS) && af->type != SPELL_POLYMORPH && af->type != SPELL_DONTUSEME) {
    if (!af->next || (af->next->type != af->type) ||
        (af->next->duration > 0)) {
      if (*spell_wear_off_msg[af->type]) {
        send_to_char(spell_wear_off_msg[af->type], ch);
        send_to_char("\r\n", ch);
      }
  }
}

if (output && (af->type > 0) && (af->type <= MAX_SPELLS) && af->type == SPELL_POLYMORPH)  {

  if (!af->next || (af->next->type != af->type) ||
        (af->next->duration > 0)) {
   if (PLR_FLAGGED(ch, PLR_RABBIT)){
REMOVE_BIT(PLR_FLAGS(ch), PLR_RABBIT);
REMOVE_BIT(PRF_FLAGS(ch), PRF_NOTSELF);
send_to_char("You feel yourself growing, and your ears shrinking. You no longer feel like a rabbit.\r\n", ch);
act("$n's body grows, $s ears shrinking. $n no longer looks like a rabbit.\r\n", 0, ch, 0, 0, TO_ROOM);

}
if (PLR_FLAGGED(ch, PLR_BIRD)) {
REMOVE_BIT(PLR_FLAGS(ch), PLR_BIRD);
REMOVE_BIT(PRF_FLAGS(ch), PRF_NOTSELF);
send_to_char("You feel yourself growing and your feathers falling away. You no longer feel like a bird.\r\n", ch);
act("$n's body grows, $s feathers falling away as it expands. $n no longer looks like a bird.\r\n", 0, ch, 0, 0, TO_ROOM);

}
if (PLR_FLAGGED(ch, PLR_WOLF)) {
REMOVE_BIT(PLR_FLAGS(ch), PLR_WOLF);
REMOVE_BIT(PRF_FLAGS(ch), PRF_NOTSELF);
send_to_char("You feel your your fur shed and your teeth shrink. You no longer feel like a wolf.\r\n", ch);
act("$n's teeth shrink, $s fur shedding. $n no longer looks like a wolf.\r\n", 0, ch, 0, 0, TO_ROOM);
}
if (PLR_FLAGGED(ch, PLR_BEAR)) {
REMOVE_BIT(PLR_FLAGS(ch), PLR_BEAR);
REMOVE_BIT(PRF_FLAGS(ch), PRF_NOTSELF);
send_to_char("Your claws shrink as does the rest of your body. You no longer feel like a bear.\r\n", ch);
act("$n's claws shrink as does the rest of $s body. $n no longer looks like a bear.\r\n", 0, ch, 0, 0, TO_ROOM);
}
if (PLR_FLAGGED(ch, PLR_CAT)){
REMOVE_BIT(PLR_FLAGS(ch), PLR_CAT);
REMOVE_BIT(PRF_FLAGS(ch), PRF_NOTSELF);
send_to_char("You feel your body growing, and your fur shedding. You no longer feel like a cat.\r\n", ch);
act("$n's body slowly grows, $s fur shedding. $n no longer looks like a cat.\r\n", 0, ch, 0, 0, TO_ROOM);
}

for (k = 0; k < NUM_WEARS; k++)
  if (GET_EQ(ch, k)){
    GET_OBJ_DISGUISE(GET_EQ(ch, k)) = 0;
  }

}
} 

  affect_modify(ch, af->location, af->modifier, af->bitvector, FALSE);
  REMOVE_FROM_LIST(af, ch->affected, next);
  free(af);
  affect_total(ch);
}
Ejemplo n.º 16
0
void equip_char(struct char_data *ch, struct obj_data *obj, int pos)
{
  int j;
  
  assert(pos>=0 && pos<MAX_WEAR);
  assert(!(ch->equipment[pos]));
  
  if (obj->carried_by) {
    logE("EQUIP: Obj is carried_by when equip.");
    assert(0);
  }
  
  if (obj->in_room!=NOWHERE) {
    logE("EQUIP: Obj is in_room when equip.");
    assert(0);
    return;
  }

  /*
    if the item is limited, check its ego.
    use some funky function to determine if pc's ego is higher than objs'
    ego.. if it is, proceed.. otherwise, deny.
    */
  j = ItemEgoClash(ch, obj, 0);
  if (j < -5) {
    act("$p almost seems to say 'You're much too puny to use me, twerp!'",0,
	ch, obj, 0, TO_CHAR); 
    act("$p falls to the floor",0,ch, obj, 0, TO_CHAR); 
    act("$p removes itself, and falls to the floor",0,ch, obj, 0, TO_ROOM); 
    obj_to_room(obj, ch->in_room);
    do_save(ch,"",0);
    return;
  } else if (j < 0) {
    act("$p almost seems to say 'You're pretty puny.  I don't want to be seen with you!\n", 0, ch, obj, 0, TO_CHAR);
    act("$p falls to the floor",0,ch, obj, 0, TO_CHAR); 
    act("$p removes itself, and falls to the floor",0,ch, obj, 0, TO_ROOM); 
    obj_to_room(obj, ch->in_room);
    do_save(ch,"",0);
    return;
  }

  if (ItemAlignClash(ch, obj)) {
    if (ch->in_room != NOWHERE) {
      
      act("You are zapped by $p and instantly drop it.", 
	  FALSE, ch, obj, 0, TO_CHAR);
      act("$n is zapped by $p and instantly drop it.", 
	  FALSE, ch, obj, 0, TO_ROOM);
      obj_to_room(obj, ch->in_room);
      do_save(ch,"",0);
      return;
    } else {
      logE("ch->in_room = NOWHERE when equipping char.");
      assert(0);
    }
  }
  
  if (IS_AFFECTED(ch, AFF_SNEAK) &&
      IsRestricted(GetItemClassRestrictions(obj), CLASS_THIEF))
    affect_from_char(ch, SKILL_SNEAK);
  
  ch->equipment[pos] = obj;
  obj->equipped_by = ch;
  obj->eq_pos = pos;
  
  if (GET_ITEM_TYPE(obj) == ITEM_ARMOR)
    GET_AC(ch) -= apply_ac(ch, pos);
  
  for(j=0; j<MAX_OBJ_AFFECT; j++)
    affect_modify(ch, obj->affected[j].location,
		  (int)obj->affected[j].modifier,
		  obj->obj_flags.bitvector, TRUE);

  if (GET_ITEM_TYPE(obj) == ITEM_WEAPON) {
    /* some nifty manuevering for strength */
    if (IS_NPC(ch) && !IS_SET(ch->specials.act, ACT_POLYSELF))
       GiveMinStrToWield(obj, ch);
  }
  
  affect_total(ch);
}