コード例 #1
0
ファイル: special.c プロジェクト: Onirik79/bardmud
SPEC_RET spec_fido( CHAR_DATA *ch )
{
	OBJ_DATA *corpse;
	OBJ_DATA *c_next;
	OBJ_DATA *obj;
	OBJ_DATA *obj_next;

	if ( !is_awake(ch) )
		return FALSE;

	for ( corpse = ch->in_room->first_content;  corpse;  corpse = c_next )
	{
		c_next = corpse->next_content;
		if ( corpse->type != OBJTYPE_CORPSE_MOB )
			continue;

		act( AT_ACTION, "$n divora selvaggiamente un cadavere.", ch, NULL, NULL, TO_ROOM );

		for ( obj = corpse->first_content;  obj;  obj = obj_next )
		{
			obj_next = obj->next_content;
			obj_from_obj( obj );
			obj_to_room( obj, ch->in_room );
		}

		free_object( corpse );
		return TRUE;
	}

	return FALSE;
}
コード例 #2
0
ファイル: handler.c プロジェクト: Calebros/aol
/* Extract an object from the world */
void extract_obj(struct obj_data * obj)
{
  struct obj_data *temp;

  if (obj->worn_by != NULL)
    if (unequip_char(obj->worn_by, obj->worn_on) != obj)
      log("SYSERR: Inconsistent worn_by and worn_on pointers!!");
  if (obj->in_room != NOWHERE)
    obj_from_room(obj);
  else if (obj->carried_by)
    obj_from_char(obj);
  else if (obj->in_obj)
    obj_from_obj(obj);

  /* Get rid of the contents of the object, as well. */
  while (obj->contains)
    extract_obj(obj->contains);

  REMOVE_FROM_LIST(obj, object_list, next);

  if (GET_OBJ_RNUM(obj) >= 0)
    (obj_index[GET_OBJ_RNUM(obj)].number)--;

  if (SCRIPT(obj))
    extract_script(SCRIPT(obj));

  free_obj(obj);
}
コード例 #3
0
bool spec_fido( CHAR_DATA *ch )
{
	OBJ_DATA *corpse;
	OBJ_DATA *c_next;
	OBJ_DATA *obj;
	OBJ_DATA *obj_next;

	if ( !IS_AWAKE(ch) )
	return FALSE;

	for ( corpse = ch->in_room->contents; corpse != NULL; corpse = c_next )
	{
	c_next = corpse->next_content;
	if ( corpse->item_type != ITEM_CORPSE_NPC )
		continue;

	act( "$n savagely devours a corpse.", ch, NULL, NULL, TO_ROOM );
	for ( obj = corpse->contains; obj; obj = obj_next )
	{
		obj_next = obj->next_content;
		obj_from_obj( obj );
		obj_to_room( obj, ch->in_room );
	}
	extract_obj( corpse );
	return TRUE;
	}

	return FALSE;
}
コード例 #4
0
void take_obj_list(struct char_data *ch,struct obj_data *o,int *amount,struct char_data *give_to)
{
  char buf[MAX_STRING_LENGTH];

  if (*amount<=0 && !o) return;
  if (o->contains)
    take_obj_list(ch,o->contains,amount,give_to);
  else if (o->next_content)
    take_obj_list(ch,o->next_content,amount,give_to);
  else {
    if (o->carried_by)
      obj_from_char(o);
    if (o->in_obj)
      obj_from_obj(o);
    *amount -= o->obj_flags.cost;
    sendf(ch,"Your %s is taken.\n",o->short_description);
    if (give_to)
      sendf(give_to,"You take his %s.\n",o->short_description);
    if (give_to) {
      sprintf(buf,"FINE: %d take from %s",o->virtual,GET_NAME(ch));
      slog(buf);
      obj_to_char(o,give_to);
      o->held_for=mystrdup(GET_NAME(ch));
    } else {
      sprintf(buf,"LINK: %d take from %s",o->virtual,GET_NAME(ch));
      slog(buf);
      extract_obj(o);
    }
  }
コード例 #5
0
ファイル: handler.c プロジェクト: Lundessa/raven3
/* Extract an object from the world */
void extract_obj(struct obj_data *obj)
{
  struct char_data *ch, *next = NULL;
  struct obj_data *temp;

  if (obj->worn_by != NULL)
    if (unequip_char(obj->worn_by, obj->worn_on) != obj)
      log("SYSERR: Inconsistent worn_by and worn_on pointers!!");
  if (IN_ROOM(obj) != NOWHERE)
    obj_from_room(obj);
  else if (obj->carried_by)
    obj_from_char(obj);
  else if (obj->in_obj)
    obj_from_obj(obj);

  if (OBJ_SAT_IN_BY(obj)){
    for (ch = OBJ_SAT_IN_BY(obj); OBJ_SAT_IN_BY(obj); ch = next){
      if (!NEXT_SITTING(ch))
        OBJ_SAT_IN_BY(obj) = NULL;
      else
        OBJ_SAT_IN_BY(obj) = (next = NEXT_SITTING(ch));
      SITTING(ch) = NULL;
      NEXT_SITTING(ch) = NULL;
    }
  }

  /* Get rid of the contents of the object, as well. */
  while (obj->contains)
    extract_obj(obj->contains);

  REMOVE_FROM_LIST(obj, object_list, next);

  if (GET_OBJ_RNUM(obj) != NOTHING)
    (obj_index[GET_OBJ_RNUM(obj)].number)--;

  if (SCRIPT(obj))
    extract_script(obj, OBJ_TRIGGER);

  if (obj->events != NULL) {
	  if (obj->events->iSize > 0) {
		struct event * pEvent;

		while ((pEvent = simple_list(obj->events)) != NULL)
		  event_cancel(pEvent);
	  }
	  free_list(obj->events);
    obj->events = NULL;
  }

  if (GET_OBJ_RNUM(obj) == NOTHING || obj->proto_script != obj_proto[GET_OBJ_RNUM(obj)].proto_script)
    free_proto_script(obj, OBJ_TRIGGER);

  free_obj(obj);
}
コード例 #6
0
void handle_waterwheel_destruction(OBJ_DATA & obj)
{
    // Verify a room
    ROOM_INDEX_DATA * room(get_room_for_obj(obj));
    if (room == NULL)
        return;

    // Load up the remains and transfer the contents
    OBJ_DATA * remains(create_object(get_obj_index(OBJ_VNUM_WATERWHEEL_REMAINS), 0));
    remains->level = obj.level;

    for (OBJ_DATA * item(obj.contains); item != NULL; item = obj.contains)
    {
        obj_from_obj(item);
        obj_to_obj(item, remains);
    }

    obj_to_room(remains, room);
}
コード例 #7
0
ファイル: act.obj2.c プロジェクト: MUDOmnibus/DikuMUD-Alfa
void weight_change_object(struct obj_data *obj, int weight)
{
	struct obj_data *tmp_obj;
	struct char_data *tmp_ch;

	if (obj->in_room != NOWHERE) {
		GET_OBJ_WEIGHT(obj) += weight;
	} else if (tmp_ch = obj->carried_by) {
		obj_from_char(obj);
		GET_OBJ_WEIGHT(obj) += weight;
		obj_to_char(obj, tmp_ch);
	} else if (tmp_obj = obj->in_obj) {
		obj_from_obj(obj);
		GET_OBJ_WEIGHT(obj) += weight;
		obj_to_obj(obj, tmp_obj);
	} else {
		log("Unknown attempt to subtract weight from an object.");
	}
}
コード例 #8
0
ファイル: condition.c プロジェクト: apfigueiredo/wardome
void MakeScrap(struct char_data *ch, struct obj_data *obj)
{
  char buf[256];
  struct obj_data *t, *x;
  int pos;


  if (!ch || !obj || (ch->in_room == NOWHERE))
    return;

  act("$p falls to the ground in scraps.", TRUE, ch, obj, 0, TO_CHAR);
  act("$p falls to the ground in scraps.", TRUE, ch, obj, 0, TO_ROOM);

  t = read_object(9, VIRTUAL);
  if (!t)
    return;

  sprintf(buf, "Scraps from %s&n lie in a pile",
	  obj->short_description);
  t->description = str_dup(buf);
  t->short_description = str_dup("a pile of scraps");

  if (obj->carried_by) {
    obj_from_char(obj);
  } else if (obj->worn_by) {
    for (pos = 0; pos < NUM_WEARS; pos++)
      if (ch->equipment[pos] == obj)
	break;
    if (pos >= NUM_WEARS) {
      log("SYSERR: MakeScrap(), can't find worn object in equip");
      exit(1);
    }
    obj = unequip_char(ch, pos);
  }
  obj_to_room(t, ch->in_room);
  while (obj->contains) {
    x = obj->contains;
    obj_from_obj(x);
    obj_to_room(x, ch->in_room);
  }
  extract_obj(obj);
}
コード例 #9
0
ファイル: spec_procs.c プロジェクト: MUDOmnibus/DikuMUD-Alfa
int fido(struct char_data *ch, int cmd, char *arg)
{

	struct obj_data *i, *temp, *next_obj;

	if (cmd || !AWAKE(ch))
		return(FALSE);

	for (i = world[ch->in_room].contents; i; i = i->next_content) {
		if (GET_ITEM_TYPE(i)==ITEM_CONTAINER && i->obj_flags.value[3]) {
			act("$n savagely devour a corpse.", FALSE, ch, 0, 0, TO_ROOM);
			for(temp = i->contains; temp; temp=next_obj)
			{
				next_obj = temp->next_content;
				obj_from_obj(temp);
				obj_to_room(temp,ch->in_room);
			}
			extract_obj(i);
			return(TRUE);
		}
	}
	return(FALSE);
}
コード例 #10
0
ファイル: object.cpp プロジェクト: AmagicalFishy/BladeCraft
/*
 * Extract an obj from the world.
 */
void Object::extract_obj ()
{
  Object *obj_content;

  if (in_room != NULL)
    obj_from_room ();
  else if (carried_by != NULL)
    obj_from_char ();
  else if (in_obj != NULL)
    obj_from_obj ();

  ObjIter o, next;
  for (o = contains.begin(); o != contains.end(); o = next) {
    obj_content = *o;
    next = ++o;
    obj_content->extract_obj();
  }

  deepobnext = object_list.erase(find(object_list.begin(), object_list.end(), this));

  AffIter af;
  for (af = affected.begin(); af != affected.end(); af++) {
    delete *af;
  }
  affected.clear();

  std::list<ExtraDescription *>::iterator ed;
  for (ed = extra_descr.begin(); ed != extra_descr.end(); ed++) {
    delete *ed;
  }
  extra_descr.clear();

  --pIndexData->count;
  delete this;
  return;
}
コード例 #11
0
ファイル: mudlimits.c プロジェクト: Lundessa/NewRavenVM
/*
** Update PCs, NPCs, and objects
*/
void
point_update( void )
{
    int slot;

    void update_char_objects(CharData * ch); /* handler.c */
    void extract_obj(ObjData * obj);	     /* handler.c */
    void update_char_quests(CharData * ch);  /* quest.c */
    CharData *i, *next_char;
    ObjData  *j, *next_thing, *jj, *next_thing2, *debugnext;
    int loopvar;

    /* characters */
    for( i = character_list; i; i = next_char )
    {
        next_char = i->next;

        // state flags
        i->tickstate = 0;

        /* dismount anyone who's gotten separated from their steed */
        /* Note that it's superfluous to check for both rider AND mount */
        if (i->rider && i->rider->in_room != i->in_room) {
            i->rider->mount = NULL;
            i->rider = NULL;
        }

        /* Prayer timer */
        if (i->player_specials->saved.prayer_time > 0) {
            if (i->player_specials->saved.prayer_time == 1) {
                i->player_specials->saved.prayer_time = 0;
                send_to_char("Your prayers will be heard once again.\r\n", i);
            } else
                i->player_specials->saved.prayer_time -= 1;
        }

        for(slot = 0; slot<4; slot++) {
            if (COOLDOWN(i, slot) ) {
                COOLDOWN(i, slot) -= 1;
                if (!COOLDOWN(i, slot) ) {
                    switch( GET_CLASS(i) ) {
                        case CLASS_DEATH_KNIGHT:
                            break;
                        case CLASS_SOLAMNIC_KNIGHT:
                            break;
                        case CLASS_MAGIC_USER:
                            break;
                        case CLASS_SHADOW_DANCER:
                            if(slot == SLOT_SLIPPERY_MIND)
                                break;
                            else if(slot == SLOT_NODESHIFT)
                                sendChar(i, "You may once again shift your spectrum.\r\n");
                            else sendChar(i, "ERROR!\r\n");
                            break;
                        case CLASS_THIEF:
                            if(slot== SLOT_BLACKJACK) {
                                sendChar(i, "You are able to use blackjack again.\r\n");
                                break;
                            }
                            else sendChar(i, "ERROR!\r\n");
                        case CLASS_ASSASSIN:
                            if(slot == SLOT_DETERRENCE)
                                sendChar(i, "You are able to use deterrence again.\r\n");
                            else sendChar(i, "ERROR!\r\n");
                            break;
                        case CLASS_CLERIC:
                            if(slot == SLOT_SHADOW_FORM)
                                sendChar(i, "You are ready to enter shadow form again..\r\n");
                            else sendChar(i, "ERROR!\r\n");
                        case CLASS_WARRIOR:
                            if(slot == SLOT_REDOUBT)
                                sendChar(i, "You can shield yourself again.\r\n");
                            else if(slot == SLOT_COMMANDING_SHOUT)
                                sendChar(i, "You can shout commands again.\r\n");
                            else sendChar(i, "ERROR!\r\n");
                            break;
                        case CLASS_SHOU_LIN:
                            break;
                        case CLASS_RANGER:
                            break;
                        case CLASS_NECROMANCER:
                            if(slot == SLOT_QUICKEN)
                                sendChar(i, "You may once again rise from the grave.\r\n");
                            else if(slot == SLOT_METAMORPHOSIS)
                                sendChar(i, "You may once again metamorphisize.\r\n");
                            else sendChar(i, "ERROR!\r\n");
                            break;

                        default:
                            sendChar(i, "ERROR!\r\n");
                            break;
                    }
                }
            }
        }

        if( IS_AFFECTED(i, AFF_PLAGUE )) infectious(i);

        if( !IS_NPC(i) )
        {
            update_char_objects(i);
            if( GET_LEVEL(i) < LVL_GOD )
                check_idling(i);
            update_char_quests(i);
        }
        gain_condition(i, HUNGER, IS_AFFECTED(i, AFF_REGENERATE)? -2:-1);
        gain_condition(i, DRUNK, -1);

        /* Amara get thirsty in different ways */
        if (IS_AMARA(i)) {
            if (IN_ROOM(i) >= 0 && IN_ROOM(i) <= top_of_world) {
                switch (SECT(IN_ROOM(i))) {
                    case SECT_WATER_SWIM:
                    case SECT_WATER_NOSWIM:
                        gain_condition(i, THIRST, 1);
                        break;
                    case SECT_UNDERWATER:
                    case SECT_UNDERWATER_RIVER:
                        gain_condition(i, THIRST, 24);
                        break;
                    default:
                        gain_condition(i, THIRST, -2);
                        break;
                }
            } else gain_condition(i, THIRST, -2);
        } else gain_condition(i, THIRST, -1);
    }/* for */

    debugnext = NULL;
    /* objects */
    for( j = object_list; j; j = next_thing )
    {
        next_thing = j->next;	/* Next in object list */
        debugnext = j;		// we didn't crash if we got here

        if( IS_SET_AR( j->obj_flags.extra_flags, ITEM_TIMED ))
        {
            if( GET_OBJ_TIMER(j) > 0 )
                GET_OBJ_TIMER(j)--;

            if (GET_OBJ_TIMER(j) == 0) {
                if(contains_soulbound(j)) {
                    GET_OBJ_TIMER(j) = 1;
                    continue;
                }

                if (SCRIPT_CHECK(j, OTRIG_TIMER)) {
                    REMOVE_BIT_AR(j->obj_flags.extra_flags, ITEM_TIMED);
                    timer_otrigger(j);
                    continue;    // don't do anything more with this
                }
            }

            if( GET_OBJ_TYPE(j) == ITEM_KEY )
            {
                static char *keyVaporMsgs[] = {
                    "$p vanishes with a flash.",
                    "$p begins to shake violently.",
                    "$p begins to vibrate.",
                    "$p begins to hum.",
                    "$p begins to glow."
                };

                if( GET_OBJ_TIMER(j) < (sizeof( keyVaporMsgs )/sizeof( *keyVaporMsgs )))
                {
                    int vaporMsg = GET_OBJ_TIMER(j);

                    if( j->carried_by )
                        act( keyVaporMsgs[ vaporMsg ], FALSE, j->carried_by, j, 0, TO_CHAR);

                    else if( j->worn_by )
                    {
                        act( keyVaporMsgs[ vaporMsg ], FALSE, j->worn_by, j, 0, TO_CHAR);
                        for( loopvar = 0; loopvar < NUM_WEARS; loopvar++ )
                        {
                            if( j->worn_by->equipment[loopvar] == j )
                                j->worn_by->equipment[loopvar] = 0;
                        }
                    }
                    else if( j->in_room != NOWHERE && world[j->in_room].people )
                    {
                        act( keyVaporMsgs[ vaporMsg ], FALSE, world[j->in_room].people, j, 0, TO_CHAR);
                        act( keyVaporMsgs[ vaporMsg ], FALSE, world[j->in_room].people, j, 0, TO_ROOM);
                    }
                    extract_obj(j);
                    continue;
                }/* ITEM_KEY has timed out */
            }/* if ITEM_KEY */
            else if (GET_OBJ_TYPE(j) == ITEM_AFFECT)
            {
                if (!GET_OBJ_TIMER(j)) {
                    if (j->in_room != NOWHERE && world[j->in_room].people) {
                        act(j->action_description, FALSE, world[j->in_room].people,
                                j, 0, TO_CHAR);
                        act(j->action_description, FALSE, world[j->in_room].people,
                                j, 0, TO_ROOM);
                    }
                    extract_obj(j);
                    continue; // object gone, don't act further on it!
                }
            }
            else if( !GET_OBJ_TIMER(j) )
            {
                /* The object timed out - delete it */
                if( j->carried_by )
                    act( "$p crumbles to dust and is blown away.", FALSE, j->carried_by, j, 0, TO_CHAR );

                else if( j->worn_by )
                {
                    act("$p crumbles to dust and is blown away.", FALSE, j->worn_by, j, 0, TO_CHAR);
                    unequip_char( j->worn_by, j->worn_at );
                }
                else if( j->in_room != NOWHERE && world[j->in_room].people )
                {
                    act( "$p crumbles to dust and is blown away.",
                            FALSE, world[j->in_room].people, j, 0, TO_CHAR);
                    act( "$p crumbles to dust and is blown away.",
                            FALSE, world[j->in_room].people, j, 0, TO_ROOM);
                }
                extract_obj(j);
                continue; // object gone, don't act further on it!
            }
        } /* if OBJ_TIMED */

        /* if this looks like a portal */
        if ( (GET_OBJ_RNUM(j) >= 0 && GET_OBJ_RNUM(j) <= top_of_objt) &&
                obj_index[GET_OBJ_RNUM(j)].func == portal_proc &&
                GET_OBJ_TYPE(j) == ITEM_OTHER )
        { /* Mage created portals are type other, permanent portals are type portal. */
            /* Permanent portals thus don't decay. */
            if (GET_OBJ_VAL(j, 2) > 0)
                GET_OBJ_VAL(j,2)--;
        }
        /*
         ** Digger
         */
        /* If this is a corpse */
        if ((GET_OBJ_TYPE(j) == ITEM_CONTAINER) && GET_OBJ_VAL(j, 3)) {
            /* timer count down */
            if (GET_OBJ_TIMER(j) > 0)
                GET_OBJ_TIMER(j)--;

            // PC corpses which are empty will decay eventually..
            if(!CAN_WEAR(j, ITEM_WEAR_TAKE) && !(j->contains))
            {
                GET_OBJ_TIMER(j) = MAX(GET_OBJ_TIMER(j) / 3, 0);
            }

            if (!GET_OBJ_TIMER(j)) {
                if(contains_soulbound(j)) {
                    GET_OBJ_TIMER(j) = 1;
                    continue;
                }

                if (j->carried_by)
                    act("$p decays in your hands.", FALSE, j->carried_by, j, 0, TO_CHAR);
                
                else if ((j->in_room != NOWHERE) && (world[j->in_room].people)) {
                    static char *decay_messages[] = {
                        "A quivering hoard of maggots consumes $p.",
                        "A flock of vultures swoop down from the sky to devour $p.",
                        "The $p rots and decays as the shards of bone are blown to the four winds.",
                        "The $p rots and decays leaving behind the pungent stench of death.",
                        "A bolt of holy fire streaks from the heavens to burn the corpse of $p to ash.",
                        "The $p rots to ash and is swept away by the winds of time."
                    };
                    int decay_idx = (int)( random() % ( sizeof( decay_messages ) / sizeof( *decay_messages )));

                    act( decay_messages[ decay_idx ], TRUE, world[j->in_room].people, j, 0, TO_ROOM);
                    act( decay_messages[ decay_idx ], TRUE, world[j->in_room].people, j, 0, TO_CHAR);
                }/* JBP */
                
                for (jj = j->contains; jj; jj = next_thing2) {
                    next_thing2 = jj->next_content;	/* Next in inventory */
                    obj_from_obj(jj);

                    if (j->in_obj) {
                        if ( GET_OBJ_TYPE(j) != ITEM_KEY    &&
                                GET_OBJ_TYPE(j) != ITEM_SCROLL &&
                                GET_OBJ_TYPE(j) != ITEM_POTION &&
                                GET_OBJ_TYPE(j) != ITEM_DUST   &&
                                (GET_OBJ_VNUM(j) == 1460 ||
                                GET_OBJ_VNUM(j) == 1461 ||
                                GET_OBJ_VNUM(j) == 1462   ) )
                            continue;  // Refrigeration to keep food from rotting.
                        obj_to_obj(jj, j->in_obj);
                    }
                    else if (j->carried_by)
                        obj_to_room(jj, j->carried_by->in_room);
                    else if (j->in_room != NOWHERE)
                        obj_to_room(jj, j->in_room);
                    else
                    {
                        /* OLD WAY: assert(FALSE); */
                        mudlog(NRM, LVL_IMMORT, TRUE, "SYSERR: Something is wrong with a container." );
                        obj_to_room(jj, real_room(1201));
                    }
                }
                extract_obj(j);
            }
        }

        /* Imhotep: Added support for ITEM_TROPHY pieces that decay after
         * a given MUD date */        
        if(IS_OBJ_STAT(j, ITEM_TROPHY)) {
            if(GET_OBJ_TIMER(j) < TICKS_SO_FAR) {
                if (j->carried_by)
                    act("$p shimmers and vanishes out of your hands!", FALSE, j->carried_by, j, 0,
                            TO_CHAR);
                else if (j->worn_by) {
                    act("$p shimmers and vanishes!", FALSE, j->worn_by, j, 0, TO_CHAR);
                    unequip_char(j->worn_by, j->worn_at);
                } else if (j->in_room != NOWHERE && world[j->in_room].people) {
                    act("$p shimmers and vanishes!", FALSE,
                            world[j->in_room].people, j, 0, TO_CHAR);
                    act("$p shimmers and vanishes!", FALSE,
                            world[j->in_room].people, j, 0, TO_ROOM);
                }
                extract_obj(j);
                continue;
            }
        }
    }
}/* point_update */
コード例 #12
0
ファイル: effects.c プロジェクト: KillerMud/Source
/* kwasowy efekt */
void acid_effect( void *vo, int level, int dam, int target )
{
    if ( target == TARGET_ROOM )
    {
        ROOM_INDEX_DATA * room = ( ROOM_INDEX_DATA * ) vo;
        OBJ_DATA *obj, *obj_next;

        for ( obj = room->contents; obj != NULL; obj = obj_next )
        {
            OBJ_NEXT_CONTENT( obj, obj_next );

            if ( IS_OBJ_STAT( obj, ITEM_NOPURGE ) )
                continue;

            acid_effect( obj, level, dam, TARGET_OBJ );
        }
        return ;
    }

    if ( target == TARGET_CHAR )   /* do the effect on a victim */
    {
        CHAR_DATA * victim = ( CHAR_DATA * ) vo;
        OBJ_DATA *obj, *obj_next;

        if ( !victim->in_room )
            return ;

		if ( is_affected(victim, gsn_mirrorfall) )
		{
			affect_strip(victim, gsn_mirrorfall);
			return;
		}

        /* brak sprawdzania czy zszedl */
        for ( obj = victim->carrying; obj != NULL; obj = obj_next )
        {
            OBJ_NEXT_CONTENT( obj, obj_next );
            acid_effect( obj, level, dam, TARGET_OBJ );
        }
        return ;
    }

    if ( target == TARGET_OBJ )  /* toast an object */
    {
        OBJ_DATA * obj = ( OBJ_DATA * ) vo;
        OBJ_DATA *t_obj, *n_obj;
        char *msg;

	/* Tener: dodanie szansy na unikniêcie w zale¿no¶ci od poziomu czaru [20080512] */
	//2008-11-20, Brohacz: wylaczam. Spelle powyzej 25 levela nie psuja przeciez przez to gratow!
	/*if ( URANGE( 1, number_range( 1, 30 - level ), 10 ) < 5 )
	   return;*/

        if ( !check_item_resist( obj, RESIST_ACID, dam ) )
            return ;

	if( obj->liczba_mnoga )
	{
	    switch ( obj->item_type )
            {
	        case ITEM_CONTAINER:
            	case ITEM_CORPSE_PC:
            	case ITEM_CORPSE_NPC:
	                msg = "$p sycz± i rozpuszczaj± siê.";
                	break;
            	case ITEM_ARMOR:
            	case ITEM_WEAPON:
	                msg = "$p skwiercz± i rozpadaj± siê.";
                	break;
            	case ITEM_CLOTHING:
	                msg = "$p czerniej± i krusz± siê.";
                	break;
            	case ITEM_STAFF:
            	case ITEM_WAND:
	                msg = "$p czerniej± i pêkaj±.";
                	break;
            	case ITEM_SCROLL:
	                msg = "$p rozpuszczaj± siê w k³ebach dymu.";
                	break;
            	default:
	                msg = "$p rozpuszczaj± siê w k³ebach dymu.";
                	break;
            }
        }
	else
	{
            switch ( obj->item_type )
            {
	        case ITEM_CONTAINER:
            	case ITEM_CORPSE_PC:
            	case ITEM_CORPSE_NPC:
	                msg = "$p syczy i rozpuszcza siê.";
                	break;
            	case ITEM_ARMOR:
            	case ITEM_WEAPON:
	                msg = "$p skwierczy i rozpada siê.";
                	break;
            	case ITEM_CLOTHING:
	                msg = "$p czernieje i kruszy siê.";
                	break;
            	case ITEM_STAFF:
            	case ITEM_WAND:
	                msg = "$p czernieje i pêka.";
                	break;
            	case ITEM_SCROLL:
	                msg = "$p rozpuszcza siê w k³ebach dymu.";
                	break;
            	default:
	                msg = "$p rozpuszcza siê w k³ebach dymu.";
                	break;
            }
        }



        if ( obj->carried_by != NULL )
            act( msg, obj->carried_by, obj, NULL, TO_ALL );
        else if ( obj->in_room != NULL && obj->in_room->people != NULL )
            act( msg, obj->in_room->people, obj, NULL, TO_ALL );

        /* get rid of the object */
        if ( obj->contains )   /* dump contents */
        {
            for ( t_obj = obj->contains; t_obj != NULL; t_obj = n_obj )
            {
                n_obj = t_obj->next_content;
                obj_from_obj( t_obj );

                if ( obj->in_room != NULL )
                    obj_to_room( t_obj, obj->in_room );

                else if ( obj->carried_by != NULL )
                    obj_to_room( t_obj, obj->carried_by->in_room );

                else
                {
                    /*artefact*/
                    if ( is_artefact( t_obj ) ) extract_artefact( t_obj );
                    if ( obj->contains ) extract_artefact_container( obj );
                    extract_obj( t_obj );
                    continue;
                }

                acid_effect( t_obj, level / 2, dam / 2, TARGET_OBJ );
            }
        }

        /*artefact*/
        if ( is_artefact( obj ) ) extract_artefact( obj );
        if ( obj->contains ) extract_artefact_container( obj );
        extract_obj( obj );
        return ;
    }
}
コード例 #13
0
void acid_effect(void *vo, int level, int dam, int target)
{
	if (target == TARGET_ROOM) /* nail objects on the floor */
	{
		ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo;
		OBJ_DATA *obj, *obj_next;

		for (obj = room->contents; obj != NULL; obj = obj_next)
		{
			obj_next = obj->next_content;
			acid_effect(obj,level,dam,TARGET_OBJ);
		}
		return;
	}

	if (target == TARGET_CHAR)  /* do the effect on a victim */
	{
		CHAR_DATA *victim = (CHAR_DATA *) vo;
		OBJ_DATA *obj, *obj_next;
		
	/* let's toast some gear */
		for (obj = victim->carrying; obj != NULL; obj = obj_next)
		{
			obj_next = obj->next_content;
			acid_effect(obj,level,dam,TARGET_OBJ);
		}
		return;
	}

	if (target == TARGET_OBJ) /* toast an object */
	{
		OBJ_DATA *obj = (OBJ_DATA *) vo;
		OBJ_DATA *t_obj,*n_obj;
		int chance = level / 4 + dam / 10;
		char *msg;

		if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF)
			||  IS_OBJ_STAT(obj,ITEM_NOPURGE)
			||  number_range(0,4) == 0)
			return;

		if (chance > 25)
			chance = (chance - 25) / 2 + 25;
		if (chance > 50)
			chance = (chance - 50) / 2 + 50;

		if (IS_OBJ_STAT(obj,ITEM_BLESS))
			chance -= 5;

		chance -= obj->level * 2;

		switch (obj->item_type)
		{
			default:
			return;
			case ITEM_CONTAINER:
			case ITEM_CORPSE_PC:
			case ITEM_CORPSE_NPC:
			msg = "$p fumes and dissolves.";
			break;
			case ITEM_ARMOR:
			msg = "$p is pitted and etched.";
			break;
			case ITEM_CLOTHING:
			msg = "$p is corroded into scrap.";
			break;
			case ITEM_STAFF:
			case ITEM_WAND:
			chance -= 10;
			msg = "$p corrodes and breaks.";
			break;
			case ITEM_SCROLL:
			chance += 10;
			msg = "$p is burned into waste.";
			break; 
		}

		chance = URANGE(5,chance,95);

		if (number_percent() > chance)
			return;

		if (obj->carried_by != NULL)
			act(msg,obj->carried_by,obj,NULL,TO_ALL);
		else if (obj->in_room != NULL && obj->in_room->people != NULL)
			act(msg,obj->in_room->people,obj,NULL,TO_ALL);

	if (obj->item_type == ITEM_ARMOR)  /* etch it */
		{
			AFFECT_DATA *paf;
			bool af_found = FALSE;
			int i;

			affect_enchant(obj);

			for ( paf = obj->affected; paf != NULL; paf = paf->next)
			{
				if ( paf->location == APPLY_AC)
				{
					af_found = TRUE;
					paf->type = -1;
					paf->modifier += 1;
					paf->level = UMAX(paf->level,level);
					break;
				}
			}
			
			if (!af_found)
			/* needs a new affect */
			{
				paf = new_affect();
				
				paf->type       = -1;
				paf->level      = level;
				paf->duration   = -1;
				paf->location   = APPLY_AC;
				paf->modifier   =  1;
				paf->bitvector  = 0;
				paf->next       = obj->affected;
				obj->affected   = paf;
			}
			
			if (obj->carried_by != NULL && obj->wear_loc != WEAR_NONE)
				for (i = 0; i < 4; i++)
					obj->carried_by->armor[i] += 1;
				return;
			}

	/* get rid of the object */
	if (obj->contains)  /* dump contents */
			{
				for (t_obj = obj->contains; t_obj != NULL; t_obj = n_obj)
				{
					n_obj = t_obj->next_content;
					obj_from_obj(t_obj);
					if (obj->in_room != NULL)
						obj_to_room(t_obj,obj->in_room);
					else if (obj->carried_by != NULL)
						obj_to_room(t_obj,obj->carried_by->in_room);
					else
					{
						extract_obj(t_obj);
						continue;
					}

					acid_effect(t_obj,level/2,dam/2,TARGET_OBJ);
				}
			}

			extract_obj(obj);
			return;
		}
}
コード例 #14
0
void fire_effect(void *vo, int level, int dam, int target)
{
	if (target == TARGET_ROOM)  /* nail objects on the floor */
	{
		ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo;
		OBJ_DATA *obj, *obj_next;

		for (obj = room->contents; obj != NULL; obj = obj_next)
		{
			obj_next = obj->next_content;
			fire_effect(obj,level,dam,TARGET_OBJ);
		}
		return;
	}

	if (target == TARGET_CHAR)   /* do the effect on a victim */
	{
		CHAR_DATA *victim = (CHAR_DATA *) vo;
		OBJ_DATA *obj, *obj_next;

	/* chance of blindness */
		if (!IS_AFFECTED(victim,AFF_BLIND)
			&&  !saves_spell(level / 4 + dam / 20, victim,DAM_FIRE))
		{
			AFFECT_DATA af;
			act("$n is blinded by smoke!",victim,NULL,NULL,TO_ROOM);
			act("Your eyes tear up from smoke...you can't see a thing!", victim,NULL,NULL,TO_CHAR);

			af.where        = TO_AFFECTS;
			af.type         = skill_lookup("fire breath");
			af.level        = level;
			af.duration     = number_range(0,level/10);
			af.location     = APPLY_HITROLL;
			af.modifier     = -4;
			af.bitvector    = AFF_BLIND;

			affect_to_char(victim,&af);
		}

	/* getting thirsty */
		if (!IS_NPC(victim))
			gain_condition(victim,COND_THIRST,dam/20);

	/* let's toast some gear! */
		for (obj = victim->carrying; obj != NULL; obj = obj_next)
		{
			obj_next = obj->next_content;

			fire_effect(obj,level,dam,TARGET_OBJ);
		}
		return;
	}

	if (target == TARGET_OBJ)  /* toast an object */
	{
		OBJ_DATA *obj = (OBJ_DATA *) vo;
		OBJ_DATA *t_obj,*n_obj;
		int chance = level / 4 + dam / 10;
		char *msg;

		if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF)
			||  IS_OBJ_STAT(obj,ITEM_NOPURGE)
			||  number_range(0,4) == 0)
			return;

		if (chance > 25)
			chance = (chance - 25) / 2 + 25;
		if (chance > 50)
			chance = (chance - 50) / 2 + 50;

		if (IS_OBJ_STAT(obj,ITEM_BLESS))
			chance -= 5;
		chance -= obj->level * 2;

		switch ( obj->item_type )
		{
			default:             
			return;
			case ITEM_CONTAINER:
			msg = "$p ignites and burns!";
			break;
			case ITEM_POTION:
			chance += 25;
			msg = "$p bubbles and boils!";
			break;
			case ITEM_SCROLL:
			chance += 50;
			msg = "$p crackles and burns!";
			break;
			case ITEM_STAFF:
			chance += 10;
			msg = "$p smokes and chars!";
			break;
			case ITEM_WAND:
			msg = "$p sparks and sputters!";
			break;
			case ITEM_FOOD:
			msg = "$p blackens and crisps!";
			break;
			case ITEM_PILL:
			msg = "$p melts and drips!";
			break;
		}

		chance = URANGE(5,chance,95);

		if (number_percent() > chance)
			return;

		if (obj->carried_by != NULL)
			act( msg, obj->carried_by, obj, NULL, TO_ALL );
		else if (obj->in_room != NULL && obj->in_room->people != NULL)
			act(msg,obj->in_room->people,obj,NULL,TO_ALL);

		if (obj->contains)
		{
			/* dump the contents */

			for (t_obj = obj->contains; t_obj != NULL; t_obj = n_obj)
			{
				n_obj = t_obj->next_content;
				obj_from_obj(t_obj);
				if (obj->in_room != NULL)
					obj_to_room(t_obj,obj->in_room);
				else if (obj->carried_by != NULL)
					obj_to_room(t_obj,obj->carried_by->in_room);
				else
				{
					extract_obj(t_obj);
					continue;
				}
				fire_effect(t_obj,level/2,dam/2,TARGET_OBJ);
			}
		}

		extract_obj( obj );
		return;
	}
}
コード例 #15
0
ファイル: effects.c プロジェクト: KillerMud/Source
void cold_effect( void *vo, int level, int dam, int target )
{
    if ( target == TARGET_ROOM )  /* nail objects on the floor */
    {
        ROOM_INDEX_DATA * room = ( ROOM_INDEX_DATA * ) vo;
        OBJ_DATA *obj, *obj_next;

        for ( obj = room->contents; obj != NULL; obj = obj_next )
        {
            OBJ_NEXT_CONTENT( obj, obj_next );

            if ( IS_OBJ_STAT( obj, ITEM_NOPURGE ) )
                continue;

            cold_effect( obj, level, dam, TARGET_OBJ );
        }
        return ;
    }

    if ( target == TARGET_CHAR )  /* whack a character */
    {
        CHAR_DATA * victim = ( CHAR_DATA * ) vo;
        OBJ_DATA *obj, *obj_next;

        if ( !victim->in_room )
            return ;

		if ( is_affected(victim, gsn_mirrorfall) )
		{
			affect_strip(victim, gsn_mirrorfall);
			return;
		}

        /* let's toast some gear */
        for ( obj = victim->carrying; obj != NULL; obj = obj_next )
        {
            OBJ_NEXT_CONTENT( obj, obj_next );
            cold_effect( obj, level, dam, TARGET_OBJ );
        }
        return ;
    }

    if ( target == TARGET_OBJ )  /* toast an object */
    {
        OBJ_DATA * obj = ( OBJ_DATA * ) vo;
        OBJ_DATA *t_obj, *n_obj;
        char *msg;

        if( obj->liczba_mnoga )
        	msg = "$p zamarzaj± i rozpryskuj± siê na kawa³ki!";
        else
        	msg = "$p zamarza i rozpryskuje siê na kawa³ki!";

	/* Tener: dodanie szansy na unikniêcie w zale¿no¶ci od poziomu czaru [20080512] */
	//2008-11-20, Brohacz: wylaczam. Spelle powyzej 25 levela nie psuja przeciez przez to gratow!	
	/*if ( URANGE( 1, number_range( 1, 30 - level ), 10 ) < 5 )
	   return;*/

        if ( !check_item_resist( obj, RESIST_COLD, dam ) )
            return ;

        if ( obj->carried_by != NULL )
			act( msg, obj->carried_by, obj, NULL, TO_ALL );

        else if ( obj->in_room != NULL && obj->in_room->people != NULL )
            act( msg, obj->in_room->people, obj, NULL, TO_ALL );

        /* get rid of the object */
        if ( obj->contains )   /* dump contents */
        {
            for ( t_obj = obj->contains; t_obj != NULL; t_obj = n_obj )
            {
                n_obj = t_obj->next_content;
                obj_from_obj( t_obj );

                if ( obj->in_room != NULL )
                    obj_to_room( t_obj, obj->in_room );

                else if ( obj->carried_by != NULL )
                    obj_to_room( t_obj, obj->carried_by->in_room );

                else
                {
                    /*artefact*/
                    if ( is_artefact( t_obj ) ) extract_artefact( t_obj );
                    if ( obj->contains ) extract_artefact_container( obj );
                    extract_obj( t_obj );
                    continue;
                }

                cold_effect( t_obj, level / 2, dam / 2, TARGET_OBJ );
            }
        }

        /*artefact*/
        if ( is_artefact( obj ) ) extract_artefact( obj );
        if ( obj->contains ) extract_artefact_container( obj );
        extract_obj( obj );
        return ;
    }
}
コード例 #16
0
ファイル: magic.c プロジェクト: Yuffster/CircleMUD
void mag_summons(int level, struct char_data *ch, struct obj_data *obj,
		      int spellnum, int savetype)
{
  struct char_data *mob = NULL;
  struct obj_data *tobj, *next_obj;
  int pfail = 0, msg = 0, fmsg = 0, num = 1, handle_corpse = FALSE, i;
  mob_vnum mob_num;

  if (ch == NULL)
    return;

  switch (spellnum) {
  case SPELL_CLONE:
    msg = 10;
    fmsg = rand_number(2, 6);	/* Random fail message. */
    mob_num = MOB_CLONE;
    pfail = 50;	/* 50% failure, should be based on something later. */
    break;

  case SPELL_ANIMATE_DEAD:
    if (obj == NULL || !IS_CORPSE(obj)) {
      act(mag_summon_fail_msgs[7], FALSE, ch, 0, 0, TO_CHAR);
      return;
    }
    handle_corpse = TRUE;
    msg = 11;
    fmsg = rand_number(2, 6);	/* Random fail message. */
    mob_num = MOB_ZOMBIE;
    pfail = 10;	/* 10% failure, should vary in the future. */
    break;

  default:
    return;
  }

  if (AFF_FLAGGED(ch, AFF_CHARM)) {
    send_to_char(ch, "You are too giddy to have any followers!\r\n");
    return;
  }
  if (rand_number(0, 101) < pfail) {
    send_to_char(ch, "%s", mag_summon_fail_msgs[fmsg]);
    return;
  }
  for (i = 0; i < num; i++) {
    if (!(mob = read_mobile(mob_num, VIRTUAL))) {
      send_to_char(ch, "You don't quite remember how to make that creature.\r\n");
      return;
    }
    char_to_room(mob, IN_ROOM(ch));
    IS_CARRYING_W(mob) = 0;
    IS_CARRYING_N(mob) = 0;
    SET_BIT(AFF_FLAGS(mob), AFF_CHARM);
    if (spellnum == SPELL_CLONE) {
      /* Don't mess up the prototype; use new string copies. */
      mob->player.name = strdup(GET_NAME(ch));
      mob->player.short_descr = strdup(GET_NAME(ch));
    }
    act(mag_summon_msgs[msg], FALSE, ch, 0, mob, TO_ROOM);
    add_follower(mob, ch);
  }
  if (handle_corpse) {
    for (tobj = obj->contains; tobj; tobj = next_obj) {
      next_obj = tobj->next_content;
      obj_from_obj(tobj);
      obj_to_char(tobj, mob);
    }
    extract_obj(obj);
  }
}
コード例 #17
0
ファイル: update.c プロジェクト: bucketmouse/fft-mud
/*
 * Update all objs.
 * This function is performance sensitive.
 */
void obj_update (void)
{
    OBJ_DATA *obj;
    OBJ_DATA *obj_next;

    for (obj = object_list; obj != NULL; obj = obj_next)
    {
        CHAR_DATA *rch;
        char *message;

        obj_next = obj->next;

        if (obj->timer <= 0 || --obj->timer > 0)
            continue;

        switch (obj->item_type)
        {
            default:
                message = "$p crumbles into dust.";
                break;
            case ITEM_FOUNTAIN:
                message = "$p dries up.";
                break;
            case ITEM_CORPSE_NPC:
                message = "$p decays into dust.";
                break;
            case ITEM_CORPSE_PC:
                message = "$p decays into dust.";
                break;
            case ITEM_FOOD:
                message = "$p decomposes.";
                break;
            case ITEM_POTION:
            case ITEM_HEAL_FIXED:
                message = "$p has evaporated from disuse.";
                break;
            case ITEM_PORTAL:
                message = "$p fades out of existence.";
                break;
            case ITEM_CONTAINER:
                    message = "$p crumbles into dust.";
                break;
        }

        if (obj->carried_by != NULL)
        {
            if (IS_NPC (obj->carried_by)
                && obj->carried_by->pIndexData->pShop != NULL)
                obj->carried_by->silver += obj->cost / 5;
            else
            {
                act (message, obj->carried_by, obj, NULL, TO_CHAR);
            }
        }
        else if (obj->in_room != NULL && (rch = obj->in_room->people) != NULL)
        {
            if (!(obj->in_obj 
                  && !CAN_WEAR (obj->in_obj, ITEM_TAKE)))
            {
                act (message, rch, obj, NULL, TO_ROOM);
                act (message, rch, obj, NULL, TO_CHAR);
            }
        }

        if ((obj->item_type == ITEM_CORPSE_PC )
            && obj->contains)
        {                        /* save the contents */
            OBJ_DATA *t_obj, *next_obj;

            for (t_obj = obj->contains; t_obj != NULL; t_obj = next_obj)
            {
                next_obj = t_obj->next_content;
                obj_from_obj (t_obj);

                if (obj->in_obj)    /* in another object */
                    obj_to_obj (t_obj, obj->in_obj);

                else if (obj->carried_by)    /* carried */
                        if (obj->carried_by->in_room == NULL)
                            extract_obj (t_obj);
                        else
                            obj_to_room (t_obj, obj->carried_by->in_room);
                    else
                        obj_to_char (t_obj, obj->carried_by);

                 if (obj->in_room == NULL)    /* destroy it */
                    extract_obj (t_obj);
                else            /* to a room */
                    obj_to_room (t_obj, obj->in_room);
            }
        }

        extract_obj (obj);
    }

    return;
}
コード例 #18
0
void sit(struct char_data *ch, struct gameobject *on)
{
    // TODO - it is currently possible to defeat object pickup restrictions by
    // sitting on them. Need to extract can_get_obj from get_obj and use it!

    // Impassible positions.
    switch (ch->position) {
	case POS_SITTING:
	    if (on == NULL || on == ch->on) {
		send_to_char("You are already sitting down.\n\r", ch);
		return;
	    }
	    break;

	case POS_FIGHTING:
	    send_to_char("Maybe you should finish this fight first?\n\r", ch);
	    return;

	case POS_SLEEPING:
	    if (IS_AFFECTED(ch, AFF_SLEEP)) {
		send_to_char("You can't wake up!\n\r", ch);
		return;
	    }
	    break;
    }

    // Validate target object, if any.
    if (on != NULL) {
	if (!is_situpon(on)) {
	    send_to_char("You can't sit on that.\n\r", ch);
	    return;
	}

	if (ch->position == POS_SLEEPING && on != ch->on) {
	    send_to_char("You'll need to wake up to find it.\n\r", ch);
	    return;
	}

	if (on->carried_by != NULL && on->carried_by != ch) {
	    act_new("The $p is being held by someone!", ch, on, NULL, TO_CHAR, POS_DEAD, false);
	    return;
	}

	if (on->in_obj != NULL) {
	    if (on->in_obj->in_room != ch->in_room) {
		send_to_char("What? Where?\n\r", ch);
		return;
	    }
	}

	if (ch->on != on && (long)count_users(on) >= on->value[0]) {
	    act_new("There's no more room on $p.", ch, on, NULL, TO_CHAR, POS_DEAD, false);
	    return;
	}
    }

    // Sit down, possibly on and object.
    ch->position = POS_SITTING;
    if (on != NULL) {
	ch->on = on;

	if (on->carried_by == ch) {
	    obj_from_char(on);
	    obj_to_room(on, ch->in_room);
	} else if (on->in_obj != NULL) {
	    obj_from_obj(on);
	    obj_to_room(on, ch->in_room);
	}
    }

    // Notify
    switch (ch->position) {
	default:
	    if (on == NULL) {
		send_to_char("You sit down.\n\r", ch);
		act("$n sits down on the ground.", ch, NULL, NULL, TO_ROOM);
	    } else if (IS_SET(on->value[2], SIT_AT)) {
		act("You sit down at $p.", ch, on, NULL, TO_CHAR);
		act("$n sits down at $p.", ch, on, NULL, TO_ROOM);
	    } else if (IS_SET(on->value[2], SIT_ON)) {
		act("You sit on $p.", ch, on, NULL, TO_CHAR);
		act("$n sits on $p.", ch, on, NULL, TO_ROOM);
	    } else {
		act("You sit down in $p.", ch, on, NULL, TO_CHAR);
		act("$n sits down in $p.", ch, on, NULL, TO_ROOM);
	    }
	    break;
	case POS_SLEEPING:
	    if (on == NULL) {
		send_to_char("You wake and sit up.\n\r", ch);
		act("$n wakes and sits up.", ch, NULL, NULL, TO_ROOM);
	    } else if (IS_SET(on->value[2], SIT_AT)) {
		act_new("You wake and sit at $p.", ch, on, NULL, TO_CHAR, POS_DEAD, false);
		act("$n wakes and sits at $p.", ch, on, NULL, TO_ROOM);
	    } else if (IS_SET(on->value[2], SIT_ON)) {
		act_new("You wake and sit on $p.", ch, on, NULL, TO_CHAR, POS_DEAD, false);
		act("$n wakes and sits at $p.", ch, on, NULL, TO_ROOM);
	    } else {
		act_new("You wake and sit in $p.", ch, on, NULL, TO_CHAR, POS_DEAD, false);
		act("$n wakes and sits in $p.", ch, on, NULL, TO_ROOM);
	    }
	    break;
	case POS_RESTING:
	    if (on == NULL) {
		send_to_char("You stop resting.\n\r", ch);
	    } else if (IS_SET(on->value[2], SIT_AT)) {
		act("You sit at $p.", ch, on, NULL, TO_CHAR);
		act("$n sits at $p.", ch, on, NULL, TO_ROOM);
	    } else if (IS_SET(on->value[2], SIT_ON)) {
		act("You sit on $p.", ch, on, NULL, TO_CHAR);
		act("$n sits on $p.", ch, on, NULL, TO_ROOM);
	    }
	    break;
    }
}
コード例 #19
0
ファイル: effects.c プロジェクト: KillerMud/Source
void fire_effect( void *vo, int level, int dam, int target )
{
    if ( target == TARGET_ROOM )   /* nail objects on the floor */
    {
        ROOM_INDEX_DATA * room = ( ROOM_INDEX_DATA * ) vo;
        OBJ_DATA *obj, *obj_next;

        for ( obj = room->contents; obj != NULL; obj = obj_next )
        {
            OBJ_NEXT_CONTENT( obj, obj_next );

            if ( IS_OBJ_STAT( obj, ITEM_NOPURGE ) )
                continue;
            fire_effect( obj, level, dam, TARGET_OBJ );
        }
        return ;
    }

    if ( target == TARGET_CHAR )    /* do the effect on a victim */
    {
        CHAR_DATA * victim = ( CHAR_DATA * ) vo;
        OBJ_DATA *obj, *obj_next;

        if ( !victim->in_room )
            return ;

		if ( is_affected(victim, gsn_mirrorfall) )
		{
			affect_strip(victim, gsn_mirrorfall);
			return;
		}

        /* let's toast some gear! */
        for ( obj = victim->carrying; obj != NULL; obj = obj_next )
        {
            OBJ_NEXT_CONTENT( obj, obj_next );
            fire_effect( obj, level, dam, TARGET_OBJ );
        }
        return ;
    }

    if ( target == TARGET_OBJ )   /* toast an object */
    {
        OBJ_DATA * obj = ( OBJ_DATA * ) vo;
        OBJ_DATA *t_obj, *n_obj;
        char *msg;

	/* Tener: przeniesienie if'a w dobre miejsce [20080523] */
	//2008-11-20, Brohacz: wylaczam. Spelle powyzej 25 levela nie psuja przeciez przez to gratow!
	/*if ( URANGE( 1, number_range( 1, 30 - level ), 10 ) < 5 )
	   return;*/

        if ( !check_item_resist( obj, RESIST_FIRE, dam ) )
            return ;

        /*
          Gurthg
          2003-04-01
          powi±zanie levelu z szans± na zniszczenie grata
         */
 /*ale ten if przecie nie ma sensu - przepuszcza itemy o ujemnej kondycji - kainti 2006 07 10
        if ( URANGE( 1, number_range( 1, 30 - level ), 10 ) < 5 )
            return ;*/

		if(obj->liczba_mnoga)
		{
        	switch ( obj->item_type )
        	{
	            case ITEM_CONTAINER:
                	msg = "$p zapalaj± siê i p³on±!";
                	break;
            	case ITEM_POTION:
	                msg = "$p bulgocz± i eksploduj±!";
                	break;
            	case ITEM_SCROLL:
	                msg = "$p skwiercz± i spalaj± siê!";
                	break;
            	case ITEM_STAFF:
	                msg = "$p dymi± siê i czerniej±!";
                	break;
            	case ITEM_WAND:
	                msg = "$p iskrz± siê i top±!";
                	break;
            	case ITEM_FOOD:
	                msg = "$p czerniej± i krusz± sie!";
                	break;
            	case ITEM_PILL:
	                msg = "$p czerniej± i krusz± sie!";
                	break;
            	case ITEM_GEM:
	                msg = "$p rozgrzewaj± siê i eksploduj±!";
                	break;
            	default:
	                msg = "$p zapalaj± siê i p³on±!";
                	break;
        	}
        }
		else
		{
        	switch ( obj->item_type )
        	{
	            case ITEM_CONTAINER:
                	msg = "$p zapala siê i p³onie!";
                	break;
            	case ITEM_POTION:
	                msg = "$p bulgocze i eksploduje!";
                	break;
            	case ITEM_SCROLL:
	                msg = "$p skwierczy i spala siê!";
                	break;
            	case ITEM_STAFF:
	                msg = "$p dymi siê i czernieje!";
                	break;
            	case ITEM_WAND:
	                msg = "$p iskrzy siê i topi!";
                	break;
            	case ITEM_FOOD:
	                msg = "$p czernieje i kruszy sie!";
                	break;
            	case ITEM_PILL:
	                msg = "$p czernieje i kruszy sie!";
                	break;
            	case ITEM_GEM:
	                msg = "$p rozgrzewa siê i eksploduje!";
                	break;
            	default:
	                msg = "$p zapala siê i p³onie!";
                	break;
        	}
        }

        if ( obj->carried_by != NULL )
            act( msg, obj->carried_by, obj, NULL, TO_ALL );
        else if ( obj->in_room != NULL && obj->in_room->people != NULL )
            act( msg, obj->in_room->people, obj, NULL, TO_ALL );

        if ( obj->contains )
        {
            /* dump the contents */

            for ( t_obj = obj->contains; t_obj != NULL; t_obj = n_obj )
            {
                n_obj = t_obj->next_content;
                obj_from_obj( t_obj );
                if ( obj->in_room != NULL )
                    obj_to_room( t_obj, obj->in_room );
                else if ( obj->carried_by != NULL )
                    obj_to_room( t_obj, obj->carried_by->in_room );
                else
                {
                    /*artefact*/
                    if ( is_artefact( t_obj ) ) extract_artefact( t_obj );
                    if ( obj->contains ) extract_artefact_container( obj );
                    extract_obj( t_obj );
                    continue;
                }
                fire_effect( t_obj, level / 2, dam / 2, TARGET_OBJ );
            }
        }

        /*artefact*/
        if ( is_artefact( obj ) ) extract_artefact( obj );
        if ( obj->contains ) extract_artefact_container( obj );
        extract_obj( obj );
        return ;
    }
}
コード例 #20
0
ファイル: effects.c プロジェクト: KillerMud/Source
void shock_effect( void *vo, int level, int dam, int target )
{
    if ( target == TARGET_ROOM )
    {
        ROOM_INDEX_DATA * room = ( ROOM_INDEX_DATA * ) vo;
        OBJ_DATA *obj, *obj_next;

        for ( obj = room->contents; obj != NULL; obj = obj_next )
        {
            OBJ_NEXT_CONTENT( obj, obj_next );

            if ( IS_OBJ_STAT( obj, ITEM_NOPURGE ) )
                continue;

            shock_effect( obj, level, dam, TARGET_OBJ );
        }
        return ;
    }

    else if ( target == TARGET_CHAR )
    {
        CHAR_DATA * victim = ( CHAR_DATA * ) vo;
        OBJ_DATA *obj, *obj_next;

        if ( !victim->in_room )
            return ;

        /* jesli ma mozg znaczy siê mozna zszkokowac */
        if ( IS_SET( race_table[ GET_RACE( victim ) ].parts, PART_BRAINS ) &&
             !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_MAGICAL ) &&
             !is_undead( victim ) &&
             !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_CONSTRUCT ) &&
             !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_MIST ) &&
             !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_BLOB ) &&
             !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_DRAGON ) )
        {
            int chance_of_knockout = 0;

            if ( IS_SET( race_table[ GET_RACE( victim ) ].type, PERSON ) )
                chance_of_knockout = 10 + dam/10 + level/10;
            else if ( IS_SET( race_table[ GET_RACE( victim ) ].type, ANIMAL ) )
                chance_of_knockout = 5 + dam/11.5 + level/11.5;
            else if ( IS_SET( race_table[ GET_RACE( victim ) ].type, MONSTER ) )
                chance_of_knockout = 3 + dam/13 + level/13;

            if ( chance_of_knockout > 0 && number_percent() < chance_of_knockout && !IS_AFFECTED(victim,AFF_STABILITY) )
            {
                /* wait */
                WAIT_STATE( victim, URANGE( 12, dam/3, 36 ) );
                /* stoi badz walczy? no to hop na glebe */
                if ( victim->position == POS_STANDING || victim->position == POS_FIGHTING )
                {
                    if ( victim->sex == 0 )
                    {
                        send_to_char( "Tracisz kontrolê nad swoim cia³em i osuwasz siê po³przytomne na ziemie.\n\r", victim );
                        act( "$n osuwa siê polprzytomne na ziemie.", victim, NULL, NULL, TO_ROOM );
                    }
                    else if ( victim->sex == 1 )
                    {
                        send_to_char( "Tracisz kontrolê nad swoim cia³em i osuwasz siê po³przytomny na ziemie.\n\r", victim );
                        act( "$n osuwa siê polprzytomny na ziemie.", victim, NULL, NULL, TO_ROOM );
                    }
                    else
                    {
                        send_to_char( "Tracisz kontrolê nad swoim cia³em i osuwasz siê po³przytomna na ziemie.\n\r", victim );
                        act( "$n osuwa siê polprzytomna na ziemie.", victim, NULL, NULL, TO_ROOM );
                    }
                    victim->position = POS_SITTING;
                }
                /* lezy, siedzi, restuje, umiera etc? no to niech dalej umiera */
                else
                {
                    send_to_char( "Tracisz kontrolê nad swoim cia³em.\n\r", victim );
                    act( "Cia³o $z wyprê¿a siê i wiotczeje pod wp³ywem potê¿nego wy³adowania.", victim, NULL, NULL, TO_ROOM );
                }
            }
        }

		if ( is_affected(victim, gsn_mirrorfall) )
		{
			affect_strip(victim, gsn_mirrorfall);
			return;
		}

		/* toast some gear */
        for ( obj = victim->carrying; obj != NULL; obj = obj_next )
        {
            OBJ_NEXT_CONTENT( obj, obj_next );
            shock_effect( obj, level, dam, TARGET_OBJ );
        }
        return ;
    }

    if ( target == TARGET_OBJ )
    {
        OBJ_DATA * obj = ( OBJ_DATA * ) vo;
        OBJ_DATA *t_obj, *n_obj;
        char *msg;

	/* Tener: dodanie szansy na unikniêcie w zale¿no¶ci od poziomu czaru [20080512] */
	//2008-11-20, Brohacz: wylaczam. Spelle powyzej 25 levela nie psuja przeciez przez to gratow!
	/*if ( URANGE( 1, number_range( 1, 30 - level ), 10 ) < 5 )
	   return;*/

	if ( obj->item_type != ITEM_WAND && obj->item_type != ITEM_STAFF && obj->item_type != ITEM_JEWELRY )
	    return;

        if ( !check_item_resist( obj, RESIST_ELECTRICITY, dam ) )
            return ;

	if(obj->liczba_mnoga)
	{
            switch ( obj->item_type )
            {
	        default:
                	return ;
            	case ITEM_WAND:
            	case ITEM_STAFF:
	                msg = "$p rozb³yskuj± i po chwili eksploduj±!";
                	break;
            	case ITEM_JEWELRY:
	                msg = "$p stapiaj± siê w bezwarto¶ciow± bry³kê.";
            }
	}
	else
        {
            switch ( obj->item_type )
            {
	        default:
                	return ;
            	case ITEM_WAND:
            	case ITEM_STAFF:
	                msg = "$p rozb³yskuje i po chwili eksploduje!";
                	break;
            	case ITEM_JEWELRY:
	                msg = "$p stapia siê w bezwarto¶ciow± bry³kê.";
            }
        }

        if ( obj->carried_by != NULL )
            act( msg, obj->carried_by, obj, NULL, TO_ALL );
        else if ( obj->in_room != NULL && obj->in_room->people != NULL )
            act( msg, obj->in_room->people, obj, NULL, TO_ALL );

        /* get rid of the object */
        if ( obj->contains )   /* dump contents */
        {
            for ( t_obj = obj->contains; t_obj != NULL; t_obj = n_obj )
            {
                n_obj = t_obj->next_content;
                obj_from_obj( t_obj );

                if ( obj->in_room != NULL )
                    obj_to_room( t_obj, obj->in_room );

                else if ( obj->carried_by != NULL )
                    obj_to_room( t_obj, obj->carried_by->in_room );

                else
                {
                    /*artefact*/
                    if ( is_artefact( t_obj ) ) extract_artefact( t_obj );
                    if ( obj->contains ) extract_artefact_container( obj );
                    extract_obj( t_obj );
                    continue;
                }

                shock_effect( t_obj, level / 2, dam / 2, TARGET_OBJ );
            }
        }

        /*artefact*/
        if ( is_artefact( obj ) ) extract_artefact( obj );
        if ( obj->contains ) extract_artefact_container( obj );
        extract_obj( obj );
        return ;
    }
}
コード例 #21
0
ファイル: transformation.cpp プロジェクト: Sebguer/OpenRPI
void
transformation_animal_spell (CHAR_DATA * ch, AFFECTED_TYPE * spell,
			     void *target, int target_type)
{
  WOUND_DATA *wound, *next_wound;
  CHAR_DATA *tch;
  OBJ_DATA *tobj, *obj, *next_obj;
  char buf[MAX_STRING_LENGTH];
  bool base = false, extended = false;

  if (target_type == TARGET_OBJ)
    {
      tobj = (OBJ_DATA *) target;
      if (GET_ITEM_TYPE (tobj) == ITEM_CONTAINER
	  && tobj->nVirtual == VNUM_CORPSE)
	{
	  if ((spell->a.spell.discipline == SKILL_VOODOO
	       || spell->a.spell.discipline == SKILL_VOODOO)
	      && spell->a.spell.magnitude < MAGNITUDE_POWERFUL)
	    {
	      sprintf (buf,
		       "Suddenly, #2%s#0 appears to mend slightly, looking decidedly less decayed.",
		       tobj->short_description);
	      act (buf, false, ch, tobj, 0, TO_ROOM | _ACT_FORMAT);
	      act (buf, false, ch, 0, 0, TO_CHAR | _ACT_FORMAT);
	      tobj->obj_timer += spell->a.spell.magnitude;
	      return;
	    }
	  else
	    if ((spell->a.spell.discipline == SKILL_VOODOO
		 || spell->a.spell.discipline == SKILL_VOODOO)
		&& spell->a.spell.magnitude >= MAGNITUDE_POWERFUL)
	    {
	      sprintf (buf,
		       "A faint white aura briefly limns #2%s#0 before fading away.",
		       tobj->short_description);
	      act (buf, false, ch, tobj, 0, TO_ROOM | _ACT_FORMAT);
	      act (buf, false, ch, 0, 0, TO_CHAR | _ACT_FORMAT);
	      tobj->obj_flags.extra_flags &= ~ITEM_TIMER;
	      return;
	    }
	  if (spell->a.spell.discipline == SKILL_VOODOO
	      && spell->a.spell.magnitude < MAGNITUDE_POWERFUL)
	    {
	      sprintf (buf,
		       "Before your very eyes, #2%s#0 appears to putrefy with startling abruptness.",
		       tobj->short_description);
	      act (buf, false, ch, tobj, 0, TO_ROOM | _ACT_FORMAT);
	      act (buf, false, ch, 0, 0, TO_CHAR | _ACT_FORMAT);
	      tobj->obj_timer -= spell->a.spell.magnitude;
	      tobj->obj_timer = MAX (1, tobj->obj_timer);
	      return;
	    }
	  else if (spell->a.spell.discipline == SKILL_VOODOO
		   && spell->a.spell.magnitude >= MAGNITUDE_POWERFUL)
	    {
	      sprintf (buf,
		       "Without warning, #2%s#0 putrifies wretchedly before decaying into nothingness.",
		       tobj->short_description);
	      act (buf, false, ch, tobj, 0, TO_ROOM | _ACT_FORMAT);
	      act (buf, false, ch, 0, 0, TO_CHAR | _ACT_FORMAT);
	      for (obj = tobj->contains; obj; obj = next_obj)
		{
		  next_obj = obj->next_content;
		  obj->obj_timer = 12;
		  obj_from_obj (&obj, 0);
		  if (tobj->in_room != NOWHERE)
		    obj_to_room (obj, tobj->in_room);
		  else
		    extract_obj (obj);
		}
	      extract_obj (tobj);
	      return;
	    }
	}
    }

  else if (target_type == TARGET_OTHER || target_type == TARGET_SELF)
    {
      tch = (CHAR_DATA *) target;
      if (spell->a.spell.discipline == SKILL_VOODOO)
	{
	  sprintf (buf,
		   "You suddenly feel quite envigorated, tingling with health and well-being.\n");
	  send_to_char (buf, tch);
	  sprintf (buf,
		   "$n's eyes suddenly take on an envigorated sparkle, and $s posture straightens.");
	  act (buf, true, tch, 0, 0, TO_ROOM | _ACT_FORMAT);
	  tch->move += spell->a.spell.magnitude * 10;
	  return;
	}
      else if (spell->a.spell.discipline == SKILL_VOODOO)
	{
	  for (wound = tch->wounds; wound; wound = next_wound)
	    {
	      next_wound = wound->next;
	      wound->healerskill =
		ch->skills[SKILL_VOODOO] + (spell->a.spell.magnitude * 5);
	      wound->healerskill = MIN (90, wound->healerskill);
	      base = true;
	      if (wound->infection)
		wound->infection = -1;
	      if (wound->bleeding)
		wound->bleeding = 0;
	      if (spell->a.spell.magnitude > MAGNITUDE_STAUNCH)
		{
		  if (wound->infection)
		    wound->infection = 0;
		  adjust_wound (tch, wound, spell->a.spell.magnitude * -1);
		  extended = true;
		}
	    }
	  sprintf (buf,
		   "You are briefly surrounded by a cool, soothing nimbus of white light.\n");
	  send_to_char (buf, tch);

	  if (base)
	    {
	      sprintf (buf,
		       "\nYour wounds ache less beneath the touch of the magical radiance.\n");
	      send_to_char (buf, tch);
	    }

	  if (extended)
	    {
	      sprintf (buf,
		       "\nBefore your very eyes, your wounds begin to gently mend themselves.\n");
	      send_to_char (buf, tch);
	    }

	  sprintf (buf,
		   "$n is briefly surrounded by a soft nimbus of white light.");
	  act (buf, true, tch, 0, 0, TO_ROOM | _ACT_FORMAT);

	  return;
	}
      else if (spell->a.spell.discipline == SKILL_VOODOO)
	{
	  sprintf (buf,
		   "You are briefly surrounded by an inky cloud of fetid darkness.\n");
	  send_to_char (buf, tch);

	  sprintf (buf, "$n is momentarily enveloped in an inky darkness.");
	  act (buf, true, tch, 0, 0, TO_ROOM | _ACT_FORMAT);

	  for (wound = tch->wounds; wound; wound = next_wound)
	    {
	      next_wound = wound->next;
	      if (((ch->skills[SKILL_VOODOO] / 5 +
		    spell->a.spell.magnitude) > tch->con)
		  || number (1, 25) > tch->con)
		{
		  wound->infection = -1;
		  wound->healerskill = 0;
		  base = true;
		}
	      if (spell->a.spell.magnitude > MAGNITUDE_STAUNCH)
		{
		  if (adjust_wound (tch, wound, spell->a.spell.magnitude))
		    return;
		  extended = true;
		}
	    }

	  if (base)
	    {
	      sprintf (buf,
		       "\nYour wounds ache at the darkness' touch, before slowly beginning to pustulate.\n");
	      send_to_char (buf, tch);
	    }

	  if (extended)
	    {
	      sprintf (buf,
		       "\nHorrified, you watch as your wounds seem to worsen before your very eyes.\n");
	      send_to_char (buf, tch);
	    }

	  criminalize (ch, tch, tch->room->zone, CRIME_KILL);

	  return;
	}
    }

  send_to_char
    ("Your incantation, though complete, does not seem to have any effect.\n",
     ch);
}
コード例 #22
0
ファイル: effects.c プロジェクト: KillerMud/Source
void sound_effect( void *vo, int level, int dam, int target )
{
	if ( target == TARGET_CHAR )
    {
        CHAR_DATA * victim = ( CHAR_DATA * ) vo;
        OBJ_DATA *obj, *obj_next;
        AFFECT_DATA af;

        if ( !victim->in_room )
            return ;

        /* jesli ma uszy moze ogluchnac */
        if ( IS_SET( race_table[ GET_RACE( victim ) ].parts, PART_EAR ) &&
             !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_MAGICAL ) &&
             !is_undead( victim ) &&
             !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_CONSTRUCT ) &&
             !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_MIST ) &&
             !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_BLOB ) &&
             !IS_SET( race_table[ GET_RACE( victim ) ].form, FORM_DRAGON ) &&
             !IS_AFFECTED( victim, AFF_DEAFNESS ) &&
             !IS_AFFECTED( victim, AFF_PERFECT_SENSES ) )
        {
            if ( number_percent() < dam - victim->resists[RESIST_SOUND]  )
            {
				af.where = TO_AFFECTS;
				af.type = 169;
				af.level = level;
				af.duration = 3;
				af.rt_duration = 0;
				af.location = APPLY_NONE;
				af.modifier = 0;
				af.bitvector = &AFF_DEAFNESS;
				affect_to_char( victim, &af, NULL, TRUE );
				send_to_char( "Ból w uszach potêguje siê coraz bardziej, a g³osy wokó³ ciebie nagle milkn±.\n\r", victim );
				act( "Z uszu $z wyp³ywa stru¿ka krwi.", victim, NULL, NULL, TO_ROOM );
            }
        }

        if ( is_affected(victim, gsn_mirrorfall) )
		{
			affect_strip(victim, gsn_mirrorfall);
			return;
		}

        for ( obj = victim->carrying; obj != NULL; obj = obj_next )
        {
            OBJ_NEXT_CONTENT( obj, obj_next );
            sound_effect( obj, level, dam, TARGET_OBJ );
        }
        return ;
    }
	else if ( target == TARGET_OBJ )
    {
        OBJ_DATA * obj = ( OBJ_DATA * ) vo;
        OBJ_DATA *t_obj, *n_obj;

	/* Tener: dodanie szansy na unikniêcie w zale¿no¶ci od poziomu czaru [20080512] */
	//2008-11-20, Brohacz: wylaczam. Spelle powyzej 25 levela nie psuja przeciez przez to gratow!
	/*if ( URANGE( 1, number_range( 1, 30 - level ), 10 ) < 5 )
	   return;*/


		if ( !check_item_resist( obj, RESIST_SOUND, dam+level ) )
			return;

        if ( obj->carried_by != NULL )
        {
        	if( obj->liczba_mnoga)
        		act( "$p rozpryskuj± siê na kawa³eczki.", obj->carried_by, obj, NULL, TO_ALL );
        	else
            	act( "$p rozpryskuje siê na kawa³eczki.", obj->carried_by, obj, NULL, TO_ALL );
        }
        else if ( obj->in_room != NULL && obj->in_room->people != NULL )
        {
          	if( obj->liczba_mnoga)
        		act( "$p rozpryskuj± siê na kawa³eczki.", obj->carried_by, obj, NULL, TO_ALL );
        	else
            	act( "$p rozpryskuje siê na kawa³eczki.", obj->carried_by, obj, NULL, TO_ALL );
        }

        if ( obj->contains )
        {
            for ( t_obj = obj->contains; t_obj != NULL; t_obj = n_obj )
            {
                n_obj = t_obj->next_content;
                obj_from_obj( t_obj );

                if ( obj->in_room != NULL )
                    obj_to_room( t_obj, obj->in_room );
                else if ( obj->carried_by != NULL )
                    obj_to_room( t_obj, obj->carried_by->in_room );
                else
                {
                    /*artefact*/
                    if ( is_artefact( t_obj ) ) extract_artefact( t_obj );
                    if ( obj->contains ) extract_artefact_container( obj );
                    extract_obj( t_obj );
                    continue;
                }
                shock_effect( t_obj, level / 2, dam / 2, TARGET_OBJ );
            }
        }

        /*artefact*/
        if ( is_artefact( obj ) ) extract_artefact( obj );
        if ( obj->contains ) extract_artefact_container( obj );
        extract_obj( obj );
        return ;
    }
    else if ( target == TARGET_ROOM )
    {
        ROOM_INDEX_DATA * room = ( ROOM_INDEX_DATA * ) vo;
        OBJ_DATA *obj, *obj_next;

        for ( obj = room->contents; obj != NULL; obj = obj_next )
        {
            OBJ_NEXT_CONTENT( obj, obj_next );

            sound_effect( obj, level, dam, TARGET_OBJ );
        }
        return ;
    }
	return;
}
コード例 #23
0
ファイル: update.c プロジェクト: MUDOmnibus/Rom24b6-for-Cpp
/*
 * Update all objs.
 * This function is performance sensitive.
 */
void obj_update( void )
{   
    OBJ_DATA *obj;
    OBJ_DATA *obj_next;
    AFFECT_DATA *paf, *paf_next;

    for ( obj = object_list; obj != NULL; obj = obj_next )
    {
	CHAR_DATA *rch;
	char *message;

	obj_next = obj->next;

	/* go through affects and decrement */
        for ( paf = obj->affected; paf != NULL; paf = paf_next )
        {
            paf_next    = paf->next;
            if ( paf->duration > 0 )
            {
                paf->duration--;
                if (number_range(0,4) == 0 && paf->level > 0)
                  paf->level--;  /* spell strength fades with time */
            }
            else if ( paf->duration < 0 )
                ;
            else
            {
                if ( paf_next == NULL
                ||   paf_next->type != paf->type
                ||   paf_next->duration > 0 )
                {
                    if ( paf->type > 0 && skill_table[paf->type].msg_obj )
                    {
			if (obj->carried_by != NULL)
			{
			    rch = obj->carried_by;
			    act(skill_table[paf->type].msg_obj,
				rch,obj,NULL,TO_CHAR);
			}
			if (obj->in_room != NULL 
			&& obj->in_room->people != NULL)
			{
			    rch = obj->in_room->people;
			    act(skill_table[paf->type].msg_obj,
				rch,obj,NULL,TO_ALL);
			}
                    }
                }

                affect_remove_obj( obj, paf );
            }
        }


	if ( obj->timer <= 0 || --obj->timer > 0 )
	    continue;

	switch ( obj->item_type )
	{
	default:              message = "$p crumbles into dust.";  break;
	case ITEM_FOUNTAIN:   message = "$p dries up.";         break;
	case ITEM_CORPSE_NPC: message = "$p decays into dust."; break;
	case ITEM_CORPSE_PC:  message = "$p decays into dust."; break;
	case ITEM_FOOD:       message = "$p decomposes.";	break;
	case ITEM_POTION:     message = "$p has evaporated from disuse.";	
								break;
	case ITEM_PORTAL:     message = "$p fades out of existence."; break;
	case ITEM_CONTAINER: 
	    if (CAN_WEAR(obj,ITEM_WEAR_FLOAT))
		if (obj->contains)
		    message = 
		"$p flickers and vanishes, spilling its contents on the floor.";
		else
		    message = "$p flickers and vanishes.";
	    else
		message = "$p crumbles into dust.";
	    break;
	}

	if ( obj->carried_by != NULL )
	{
	    if (IS_NPC(obj->carried_by) 
	    &&  obj->carried_by->pIndexData->pShop != NULL)
		obj->carried_by->silver += obj->cost/5;
	    else
	    {
	    	act( message, obj->carried_by, obj, NULL, TO_CHAR );
		if ( obj->wear_loc == WEAR_FLOAT)
		    act(message,obj->carried_by,obj,NULL,TO_ROOM);
	    }
	}
	else if ( obj->in_room != NULL
	&&      ( rch = obj->in_room->people ) != NULL )
	{
	    if (! (obj->in_obj && obj->in_obj->pIndexData->vnum == OBJ_VNUM_PIT
	           && !CAN_WEAR(obj->in_obj,ITEM_TAKE)))
	    {
	    	act( message, rch, obj, NULL, TO_ROOM );
	    	act( message, rch, obj, NULL, TO_CHAR );
	    }
	}

        if ((obj->item_type == ITEM_CORPSE_PC || obj->wear_loc == WEAR_FLOAT)
	&&  obj->contains)
	{   /* save the contents */
     	    OBJ_DATA *t_obj, *next_obj;

	    for (t_obj = obj->contains; t_obj != NULL; t_obj = next_obj)
	    {
		next_obj = t_obj->next_content;
		obj_from_obj(t_obj);

		if (obj->in_obj) /* in another object */
		    obj_to_obj(t_obj,obj->in_obj);

		else if (obj->carried_by)  /* carried */
		    if (obj->wear_loc == WEAR_FLOAT)
			if (obj->carried_by->in_room == NULL)
			    extract_obj(t_obj);
			else
			    obj_to_room(t_obj,obj->carried_by->in_room);
		    else
		    	obj_to_char(t_obj,obj->carried_by);

		else if (obj->in_room == NULL)  /* destroy it */
		    extract_obj(t_obj);

		else /* to a room */
		    obj_to_room(t_obj,obj->in_room);
	    }
	}

	extract_obj( obj );
    }

    return;
}
コード例 #24
0
ファイル: genobj.c プロジェクト: ryantm/deimos-mud
int delete_object(obj_rnum rnum)
{
  obj_rnum i;
  zone_rnum zrnum;
  struct obj_data *obj, *tmp, *next_tmp;
  int shop, j, zone, cmd_no;

  if (rnum == NOTHING || rnum > top_of_objt)
    return NOTHING;
  
  obj = &obj_proto[rnum];

  zrnum = real_zone_by_thing(GET_OBJ_VNUM(obj));

  /* This is something you might want to read about in the logs. */
  log("GenOLC: delete_object: Deleting object #%d (%s).", GET_OBJ_VNUM(obj), obj->short_description);

  for (tmp = object_list; tmp; tmp = next_tmp) {
    next_tmp = tmp->next;
    if (tmp->item_number != obj->item_number)
      continue;

    /* extract_obj() will just axe contents. */
    if (tmp->contains) {
      struct obj_data *this_content, *next_content;
      for (this_content = tmp->contains; this_content; this_content = next_content) {
        next_content = this_content->next_content;
        if (IN_ROOM(tmp)) {
          /* Transfer stuff from object to room. */
          obj_from_obj(this_content);
          obj_to_room(this_content, IN_ROOM(tmp));
        } else if (tmp->worn_by || tmp->carried_by) {
          /* Transfer stuff from object to person inventory. */
          obj_from_char(this_content);
          obj_to_char(this_content, tmp->carried_by);
        } else if (tmp->in_obj) {
          /* Transfer stuff from object to containing object. */
          obj_from_obj(this_content);
          obj_to_obj(this_content, tmp->in_obj);
        }
      }
    }
    /* Remove from object_list, etc. - handles weightchanges, and similar. */
    extract_obj(tmp);
  }

  /* Make sure all are removed. */
  assert(obj_index[rnum].number == 0);

  /* Adjust rnums of all other objects. */
  for (tmp = object_list; tmp; tmp = tmp->next) {
    GET_OBJ_RNUM(tmp) -= (GET_OBJ_RNUM(tmp) > rnum);
  }

  for (i = rnum; i < top_of_objt; i++) {
    obj_index[i] = obj_index[i + 1];
    obj_proto[i] = obj_proto[i + 1];
    obj_proto[i].item_number = i;
  }

  top_of_objt--;
  RECREATE(obj_index, struct index_data, top_of_objt + 1);
  RECREATE(obj_proto, struct obj_data, top_of_objt + 1);

  /* Renumber notice boards. */
  for (j = 0; j < NUM_OF_BOARDS; j++)
    BOARD_RNUM(j) -= (BOARD_RNUM(j) > rnum);

  /* Renumber shop produce. */
  for (shop = 0; shop <= top_shop; shop++)
    for (j = 0; SHOP_PRODUCT(shop, j) != NOTHING; j++)
      SHOP_PRODUCT(shop, j) -= (SHOP_PRODUCT(shop, j) > rnum);

  /* Renumber zone table. */
  for (zone = 0; zone <= top_of_zone_table; zone++) {
    for (cmd_no = 0; ZCMD(zone, cmd_no).command != 'S'; cmd_no++) {
      switch (ZCMD(zone, cmd_no).command) {
      case 'P':
        if (ZCMD(zone, cmd_no).arg3 == rnum) {
          delete_command(&zone_table[zone], cmd_no);
        } else
          ZCMD(zone, cmd_no).arg3 -= (ZCMD(zone, cmd_no).arg3 > rnum);
	break;
      case 'O':
      case 'G':
      case 'E':
        if (ZCMD(zone, cmd_no).arg1 == rnum) {
          delete_command(&zone_table[zone], cmd_no);
        } else
          ZCMD(zone, cmd_no).arg1 -= (ZCMD(zone, cmd_no).arg1 > rnum);
	break;
      case 'R':
        if (ZCMD(zone, cmd_no).arg2 == rnum) {
          delete_command(&zone_table[zone], cmd_no);
        } else
          ZCMD(zone, cmd_no).arg2 -= (ZCMD(zone, cmd_no).arg2 > rnum);
	break;
      }
    }
  }

  save_objects(zrnum);

  return rnum;
}
コード例 #25
0
ファイル: limits.c プロジェクト: matthewbode/mg2
/* Update PCs, NPCs, and objects */
void point_update(void)
{
  struct char_data *i, *next_char;
  struct obj_data *j, *next_thing, *jj, *next_thing2;

  /* characters */
  for (i = character_list; i; i = next_char) {
    next_char = i->next;
	
    gain_condition(i, FULL, -1);
    gain_condition(i, DRUNK, -1);
    gain_condition(i, THIRST, -1);
	
    if (GET_POS(i) >= POS_STUNNED) {
      GET_HIT(i) = MIN(GET_HIT(i) + hit_gain(i), GET_MAX_HIT(i));
      GET_MANA(i) = MIN(GET_MANA(i) + mana_gain(i), GET_MAX_MANA(i));
      GET_MOVE(i) = MIN(GET_MOVE(i) + move_gain(i), GET_MAX_MOVE(i));
      if (AFF_FLAGGED(i, AFF_POISON))
	if (damage(i, i, 2, SPELL_POISON) == -1)
	  continue;	/* Oops, they died. -gg 6/24/98 */
      if (GET_POS(i) <= POS_STUNNED)
	update_pos(i);
    } else if (GET_POS(i) == POS_INCAP) {
      if (damage(i, i, 1, TYPE_SUFFERING) == -1)
	continue;
    } else if (GET_POS(i) == POS_MORTALLYW) {
      if (damage(i, i, 2, TYPE_SUFFERING) == -1)
	continue;
    }
    if (!IS_NPC(i)) {
      update_char_objects(i);
      if (GET_LEVEL(i) < idle_max_level)
	check_idling(i);
    }
  }

  /* objects */
  for (j = object_list; j; j = next_thing) {
    next_thing = j->next;	/* Next in object list */

    /* If this is a corpse */
    if (IS_CORPSE(j)) {
      /* timer count down */
      if (GET_OBJ_TIMER(j) > 0)
	GET_OBJ_TIMER(j)--;

      if (!GET_OBJ_TIMER(j)) {

	if (j->carried_by)
	  act("$p decays in your hands.", FALSE, j->carried_by, j, 0, TO_CHAR);
	else if ((IN_ROOM(j) != NOWHERE) && (world[IN_ROOM(j)].people)) {
	  act("A quivering horde of maggots consumes $p.",
	      TRUE, world[IN_ROOM(j)].people, j, 0, TO_ROOM);
	  act("A quivering horde of maggots consumes $p.",
	      TRUE, world[IN_ROOM(j)].people, j, 0, TO_CHAR);
	}
	for (jj = j->contains; jj; jj = next_thing2) {
	  next_thing2 = jj->next_content;	/* Next in inventory */
	  obj_from_obj(jj);

	  if (j->in_obj)
	    obj_to_obj(jj, j->in_obj);
	  else if (j->carried_by)
	    obj_to_room(jj, IN_ROOM(j->carried_by));
	  else if (IN_ROOM(j) != NOWHERE)
	    obj_to_room(jj, IN_ROOM(j));
	  else
	    core_dump();
	}
	extract_obj(j);
      }
    }
    /* If the timer is set, count it down and at 0, try the trigger */
    /* note to .rej hand-patchers: make this last in your point-update() */
    else if (GET_OBJ_TIMER(j)>0) {
      GET_OBJ_TIMER(j)--; 
      if (!GET_OBJ_TIMER(j))
        timer_otrigger(j);
    }
  }
}
コード例 #26
0
void get_obj(struct char_data *ch, struct gameobject *obj, struct gameobject *container)
{
    struct char_data *gch;
    int members;
    char buffer[100];

    if (!CAN_WEAR(obj, ITEM_TAKE)) {
	send_to_char("You can't take that.\n\r", ch);
	return;
    }

    if ((ch->carry_number + get_obj_number(obj)) > can_carry_n(ch)
	    && (!IS_IMMORTAL(ch))) {
	act("$d: you can't carry that many items.",
		ch, NULL, object_name_get(obj), TO_CHAR);
	return;
    }


    if ((ch->carry_weight + get_obj_weight(obj)) > can_carry_w(ch)) {
	act("$d: you can't carry that much weight.", ch, NULL, object_name_get(obj), TO_CHAR);
	return;
    }

    if (obj->in_room != NULL) {
	for (gch = obj->in_room->people; gch != NULL; gch = gch->next_in_room) {
	    if (gch->on == obj) {
		act("$N appears to be using $p.", ch, obj, gch, TO_CHAR);
		return;
	    }
	}
    }


    if (container != NULL) {
	if (container->objprototype->vnum == OBJ_VNUM_PIT
		&& get_trust(ch) < obj->level) {
	    send_to_char("You are not powerful enough to use it.\n\r", ch);
	    return;
	}

	if (container->objprototype->vnum == OBJ_VNUM_PIT
		&& !CAN_WEAR(container, ITEM_TAKE)
		&& !IS_OBJ_STAT(obj, ITEM_HAD_TIMER))
	    obj->timer = 0;
	act_new("You get $p from $P.", ch, obj, container, TO_CHAR, POS_RESTING, true);
	act_new("$n gets $p from $P.", ch, obj, container, TO_ROOM, POS_RESTING, true);
	REMOVE_BIT(obj->extra_flags, ITEM_HAD_TIMER);
	obj_from_obj(obj);
    } else {
	act_new("You get $p.", ch, obj, container, TO_CHAR, POS_RESTING, true);
	act_new("$n gets $p.", ch, obj, container, TO_ROOM, POS_RESTING, true);
	obj_from_room(obj);
    }

    if (obj->item_type == ITEM_MONEY) {
	ch->silver += obj->value[0];
	ch->gold += obj->value[1];

	if (IS_SET(ch->act, PLR_AUTOSPLIT)) {
	    members = 0;
	    for (gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room)
		if (!IS_AFFECTED(gch, AFF_CHARM) && is_same_group(gch, ch))
		    members++;

	    if (members > 1 && (obj->value[0] > 1 || obj->value[1])) {
		sprintf(buffer, "%ld %ld", obj->value[0], obj->value[1]);
		do_split(ch, buffer);
	    }
	}

	extract_obj(obj);
    } else {
	obj_to_char(obj, ch);
    }

    return;
}