Ejemplo n.º 1
0
bool
summon_criminal_demons(struct creature *vict)
{
    struct creature *mob;
    int vnum_base = (IS_EVIL(vict)) ? ARCHONIC_BASE : DEMONIC_BASE;
    int demon_num = GET_REMORT_GEN(vict) / 2 + 1;
    int idx;

    for (idx = 0; idx < demon_num; idx++) {
        mob = read_mobile(vnum_base + MIN(4, (GET_LEVEL(vict) / 9))
            + number(0, 1));
        if (!mob) {
            errlog("Unable to load mob in demonic_overmind");
            return false;
        }
        start_hunting(mob, vict);
        SET_BIT(NPC_FLAGS(mob), NPC_SPIRIT_TRACKER);
        CREATE(mob->mob_specials.func_data, int, 1);
        *((int *)mob->mob_specials.func_data) = GET_IDNUM(vict);

        char_to_room(mob, vict->in_room, true);
        act("The air suddenly cracks open and $n steps out!", false,
            mob, NULL, NULL, TO_ROOM);
    }

    if (IS_EVIL(vict))
        mudlog(GET_INVIS_LVL(vict), NRM, true,
            "%d archons dispatched to hunt down %s",
            demon_num, GET_NAME(vict));
    else
        mudlog(GET_INVIS_LVL(vict), NRM, true,
            "%d demons dispatched to hunt down %s", demon_num, GET_NAME(vict));

    return true;
}
Ejemplo n.º 2
0
int cityguard(struct char_data *ch, int cmd, char *arg)
{
	struct char_data *tch, *evil;
	int max_evil;

	if (cmd || !AWAKE(ch) || (GET_POS(ch) == POSITION_FIGHTING))
		return (FALSE);

	max_evil = 300;
	evil = 0;

	for (tch=world[ch->in_room].people; tch; tch = tch->next_in_room) {
		if (tch->specials.fighting) {
         if ((GET_ALIGNMENT(tch) < max_evil) &&
             (IS_NPC(tch) || IS_NPC(tch->specials.fighting))) {
				max_evil = GET_ALIGNMENT(tch);
				evil = tch;
			}
		}
	}

	if (evil && !IS_EVIL(evil->specials.fighting))
	{
		act("$n screams 'PROTECT THE INNOCENT!  BANZAI!!! CHARGE!!! ARARARAGGGHH!'", FALSE, ch, 0, 0, TO_ROOM);
		hit(ch, evil, TYPE_UNDEFINED);
		return(TRUE);
	}

	return(FALSE);
}
Ejemplo n.º 3
0
/* specjalne sprawdzanie affectow z zaklec*/
bool check_hold(CHAR_DATA *ch, CHAR_DATA *victim, int type, int spell)
{
    sh_int sn;

    if( type < 0 || type > MAX_SPELL_INFO )
        return FALSE;

    sn = si_spell_info[type][spell].sn;

    //zeby nie wrzucac holda na wardancerow i berserkierow
    if( IS_AFFECTED( victim, AFF_FREE_ACTION ))
        return TRUE;

    if( check_affect( ch, victim, type, spell) )
        return TRUE;

    if( sn == gsn_holdevil )
        return !IS_EVIL(victim);
    else if( sn == gsn_holdperson )
        return !IS_SET(race_table[GET_RACE(victim)].type, PERSON);
    else if ( sn == gsn_holdmonster )
        return !IS_SET(race_table[GET_RACE(victim)].type, MONSTER);
    else if ( sn == gsn_holdplant )
        return !IS_SET(race_table[GET_RACE(victim)].type, PLANT);
    else if ( sn == gsn_holdanimal )
        return !IS_SET(race_table[GET_RACE(victim)].type, ANIMAL);
    else
        return !is_undead(victim);

    return FALSE;
}
Ejemplo n.º 4
0
static void
quest_weapon_enchant(struct creature *ch, struct obj_data *obj, int lvl)
{
    int i;
    for (i = MAX_OBJ_AFFECT - 1; i >= 0; i--) {
        if (obj->affected[i].location == APPLY_HITROLL ||
            obj->affected[i].location == APPLY_DAMROLL) {
            obj->affected[i].location = APPLY_NONE;
            obj->affected[i].modifier = 0;
        } else if (i < MAX_OBJ_AFFECT - 2 && obj->affected[i].location) {
            obj->affected[i + 2].location = obj->affected[i].location;
            obj->affected[i + 2].modifier = obj->affected[i].modifier;
        }
    }

    obj->affected[0].location = APPLY_HITROLL;
    obj->affected[0].modifier = MAX(2, number(2, 4)) +
        (lvl >= 50) + (lvl >= 56) + (lvl >= 60) + (lvl >= 67);

    obj->affected[1].location = APPLY_DAMROLL;
    obj->affected[1].modifier = MAX(2, number(2, 4)) +
        (lvl >= 50) + (lvl >= 56) + (lvl >= 60) + (lvl >= 67);

    if (IS_GOOD(ch)) {
        SET_BIT(GET_OBJ_EXTRA(obj), ITEM_ANTI_EVIL);
        act("$p glows a bright blue.", false, ch, obj, NULL, TO_CHAR);
    } else if (IS_EVIL(ch)) {
        SET_BIT(GET_OBJ_EXTRA(obj), ITEM_ANTI_GOOD);
        act("$p glows a bright red.", false, ch, obj, NULL, TO_CHAR);
    } else {
        act("$p glows a bright yellow.", false, ch, obj, NULL, TO_CHAR);
    }

    SET_BIT(GET_OBJ_EXTRA(obj), ITEM_MAGIC | ITEM_GLOW);
}
Ejemplo n.º 5
0
int
is_ok_char(struct char_data * keeper, struct char_data * ch, int shop_nr)
{
  char buf[200];

  if (!(CAN_SEE(keeper, ch)))
    {
      do_say(keeper, MSG_NO_SEE_CHAR, cmd_say, 0);
      return (FALSE);
    }
  if (IS_GOD(ch))
    return (TRUE);

  if ((IS_GOOD(ch) && NOTRADE_GOOD(shop_nr)) ||
      (IS_EVIL(ch) && NOTRADE_EVIL(shop_nr)) ||
      (IS_NEUTRAL(ch) && NOTRADE_NEUTRAL(shop_nr)))
    {
      sprintf(buf, "%s %s", GET_NAME(ch), MSG_NO_SELL_ALIGN);
      do_tell(keeper, buf, cmd_tell, 0);
      return (FALSE);
    }
  if (IS_NPC(ch))
    return (TRUE);

  if ((IS_MAGIC_USER(ch) && NOTRADE_MAGIC_USER(shop_nr)) ||
      (IS_CLERIC(ch) && NOTRADE_CLERIC(shop_nr)) ||
      (IS_THIEF(ch) && NOTRADE_THIEF(shop_nr)) ||
      (IS_WARRIOR(ch) && NOTRADE_WARRIOR(shop_nr)))
    {
      sprintf(buf, "%s %s", GET_NAME(ch), MSG_NO_SELL_CLASS);
      do_tell(keeper, buf, cmd_tell, 0);
      return (FALSE);
    }
  return (TRUE);
}
Ejemplo n.º 6
0
// Returns a tmpstr allocated char* containing an appropriate ANSI
// color code for the given target struct creature (tch) with the given
// recipient struct creature(ch)'s color settings in mind.
const char *
get_char_class_color_code(struct creature *ch, struct creature *tch,
    int char_class)
{
    switch (char_class) {
    case CLASS_MAGIC_USER:
        return CCMAG(ch, C_NRM);
    case CLASS_CLERIC:
        if (IS_GOOD(tch)) {
            return CCBLU_BLD(ch, C_NRM);
        } else if (IS_EVIL(tch)) {
            return CCRED_BLD(ch, C_NRM);
        } else {
            return CCYEL(ch, C_NRM);
        }
    case CLASS_KNIGHT:
        if (IS_GOOD(tch)) {
            return CCBLU_BLD(ch, C_NRM);
        } else if (IS_EVIL(tch)) {
            return CCRED(ch, C_NRM);
        } else {
            return CCYEL(ch, C_NRM);
        }
    case CLASS_RANGER:
        return CCGRN(ch, C_NRM);
    case CLASS_BARB:
        return CCCYN(ch, C_NRM);
    case CLASS_THIEF:
        return CCNRM_BLD(ch, C_NRM);
    case CLASS_CYBORG:
        return CCCYN(ch, C_NRM);
    case CLASS_PSIONIC:
        return CCMAG(ch, C_NRM);
    case CLASS_PHYSIC:
        return CCNRM_BLD(ch, C_NRM);
    case CLASS_BARD:
        return CCYEL_BLD(ch, C_NRM);
    case CLASS_MONK:
        return CCGRN(ch, C_NRM);
    case CLASS_MERCENARY:
        return CCYEL(ch, C_NRM);
    default:
        return CCNRM(ch, C_NRM);
    }
}
Ejemplo n.º 7
0
int invalid_align(struct char_data *ch, struct obj_data *obj)
{
  if (OBJ_FLAGGED(obj, ITEM_ANTI_EVIL) && IS_EVIL(ch))
    return TRUE;
  if (OBJ_FLAGGED(obj, ITEM_ANTI_GOOD) && IS_GOOD(ch))
    return TRUE;
  if (OBJ_FLAGGED(obj, ITEM_ANTI_NEUTRAL) && IS_NEUTRAL(ch))
    return TRUE;
  return FALSE;
}
Ejemplo n.º 8
0
int calcManaMulti(CharData *ch) {
    int multi = 100;

    if(ROOM_FLAGGED(ch->in_room, ROOM_MANA_REGEN))
        multi += 50;
    
    if(IS_AFFECTED(ch, AFF_WRAITHFORM))
        multi += 25;

    if((GET_CLASS(ch) == CLASS_SHADOW_DANCER) && (IS_DARK(ch->in_room) || IS_AFFECTED(ch, AFF_SHADOW_SPHERE)))
        multi += 50;

    if(IS_AFFECTED(ch, AFF_POISON))
        multi -= 100;

    if(!IS_NPC(ch)) {
        if( !IS_NPC(ch) && ROOM_FLAGGED(ch->in_room, ROOM_SUFFER) && ( GET_LEVEL(ch) < LVL_IMMORT ))
            multi -= 90;
        else if (!GET_COND(ch, THIRST) && IS_AMARA(ch))
            multi -= 90;
        else if (IS_IZARTI(ch) && IS_EVIL(ch))
            multi -= 90;
        else if (IS_DEMON(ch) && IS_GOOD(ch))
            multi -= 90;
    }

    if(GET_RACE(ch) == RACE_STROLL)
        multi += 100;

    /* Position calculations    */
    switch (GET_POS(ch)) {
        case POS_MEDITATING:
        case POS_SLEEPING:
            multi += 120;
            break;
        case POS_RESTING:
            multi += 60;
            break;
    }

    multi += (int)GET_SKILL(ch, SKILL_DEVOTION);

    // Don't let a player's regeneration completely stagnate...
    multi = MAX(multi, 25);
    return multi;
}
Ejemplo n.º 9
0
/* Hitpoint gain per game hour */
int hit_gain(CharData * ch)
{    
    // Character is messed
    if (IN_ROOM(ch) == -1) return 0;

    // Delusion health deflates fairly quickly
    if(affected_by_spell(ch, SKILL_DELUSION))
        return -(GET_MAX_HIT(ch) * spell_level(ch, SKILL_DELUSION) / 9);

    /* Are they rotting away ? */
    if (!IS_NPC(ch) && IS_UNDEAD(ch)) {
        return ( (GET_LEVEL(ch) < 50) && (ch->desc) ) ? -GET_LEVEL(ch) : 0;
    }

    /* Race calculations */
    /* vampires don't regenerate in sunlight, unless they're shadow sphered */
    if (!IS_NPC(ch) && IS_VAMPIRE(ch) &&
            IS_SUNLIGHT(IN_ROOM(ch)) && !IS_AFFECTED(ch, AFF_SHADOW_SPHERE))
        return 0;

    if(!IS_NPC(ch)) {
        int suffer = 0;

        if(ROOM_FLAGGED(ch->in_room, ROOM_SUFFER) && ( GET_LEVEL(ch) < LVL_IMMORT ))
            suffer = 1;
        else if(!GET_COND(ch, THIRST) && IS_AMARA(ch))
            suffer = 1;
        else if (IS_IZARTI(ch) && IS_EVIL(ch))
            suffer = 1;
        else if (IS_DEMON(ch) && IS_GOOD(ch))
            suffer = 1;

        if(suffer == 1) {
            if(percentSuccess(2))
                damage(ch, ch, -SUFFER_RATE, TYPE_ROOM_SUFFER);
            return 0;
        }
    }

    int base = calcHitBase(ch);
    int multiplier = calcHitMulti(ch);
    int bonus = calcHitBonus(ch);

    int gain = base*multiplier/100 + bonus;
    return (gain);
}/* hit_gain */
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
int calcMoveMulti(CharData *ch) {
    int multi = 100;
    
    if(IS_AFFECTED(ch, AFF_PLAGUE) > 0)
        multi -= 50;

    /* vampires barely regen vigor in sunlight, unless they're shadow sphered */
    if (!IS_NPC(ch) && IS_VAMPIRE(ch) && IS_SUNLIGHT(IN_ROOM(ch)) && !IS_AFFECTED(ch, AFF_SHADOW_SPHERE))
        multi -= 90;
    else if (IS_AFFECTED(ch, AFF_POISON))
        multi -= 90;
    else if ((GET_COND(ch, HUNGER) == 0 && !IS_VAMPIRE(ch)) || (GET_COND(ch, THIRST) == 0))
        multi -= 90;

    if( ROOM_FLAGGED(ch->in_room, ROOM_SUFFER) && ( GET_LEVEL(ch) < LVL_IMMORT ))
        multi -= 90;
    else if (!GET_COND(ch, THIRST) && IS_AMARA(ch))
        multi -= 90;
    else if (IS_IZARTI(ch) && IS_EVIL(ch))
        multi -= 90;
    else if (IS_DEMON(ch) && IS_GOOD(ch))
        multi -= 90;

    /* Position calculations    */
    switch (GET_POS(ch)) {
        case POS_MEDITATING:
        case POS_SLEEPING:
            multi += 120;
            break;
        case POS_RESTING:
            multi += 80;
            break;
        case POS_SITTING:
            multi += 40;	/* Divide by 8 */
            break;
    }

    // Don't let a player's regeneration completely stagnate...
    multi = MAX(multi, 25);
    return multi;
}
Ejemplo n.º 12
0
static void
quest_armor_enchant(struct creature *ch, struct obj_data *obj, int lvl)
{
    int i;

    for (i = 0; i < MAX_OBJ_AFFECT - 1; i++) {
        if (obj->affected[i].location == APPLY_AC ||
            obj->affected[i].location == APPLY_SAVING_BREATH ||
            obj->affected[i].location == APPLY_SAVING_SPELL ||
            obj->affected[i].location == APPLY_SAVING_PARA) {
            obj->affected[i].location = APPLY_NONE;
            obj->affected[i].modifier = 0;
        }
    }

    obj->affected[0].location = APPLY_AC;
    obj->affected[0].modifier = -(lvl / 8) - 5;

    obj->affected[1].location = APPLY_SAVING_PARA;
    obj->affected[1].modifier = -(4 + (lvl >= 53));

    obj->affected[2].location = APPLY_SAVING_BREATH;
    obj->affected[2].modifier = -(4 + (lvl >= 53));

    obj->affected[3].location = APPLY_SAVING_SPELL;
    obj->affected[3].modifier = -(4 + (lvl >= 53));

    if (IS_GOOD(ch)) {
        SET_BIT(GET_OBJ_EXTRA(obj), ITEM_ANTI_EVIL);
        act("$p glows a bright blue.", false, ch, obj, NULL, TO_CHAR);
    } else if (IS_EVIL(ch)) {
        SET_BIT(GET_OBJ_EXTRA(obj), ITEM_ANTI_GOOD);
        act("$p glows a bright red.", false, ch, obj, NULL, TO_CHAR);
    } else {
        act("$p glows a bright yellow.", false, ch, obj, NULL, TO_CHAR);
    }

    SET_BIT(GET_OBJ_EXTRA(obj), ITEM_MAGIC | ITEM_GLOW);
}
Ejemplo n.º 13
0
// Returns a const char* containing an appropriate '&c' color code for the given target
// struct creature (tch) suitable for use with send_to_desc.
const char *
get_char_class_color(struct creature *tch, int char_class)
{
    switch (char_class) {
    case CLASS_MAGIC_USER:
        return "&m";
    case CLASS_CLERIC:
    case CLASS_KNIGHT:
        if (IS_GOOD(tch)) {
            return "&B";
        } else if (IS_EVIL(tch)) {
            return "&R";
        } else {
            return "&y";
        }
    case CLASS_RANGER:
        return "&g";
    case CLASS_BARB:
        return "&c";
    case CLASS_THIEF:
        return "&N";
    case CLASS_CYBORG:
        return "&c";
    case CLASS_PSIONIC:
        return "&m";
    case CLASS_PHYSIC:
        return "&N";
    case CLASS_BARD:
        return "&Y";
    case CLASS_MONK:
        return "&g";
    case CLASS_MERCENARY:
        return "&y";
    default:
        return "&n";
    }
}
Ejemplo n.º 14
0
void do_omni( CHAR_DATA *ch, char *argument )
{
    char buf[MAX_STRING_LENGTH];
    char buf2[MAX_STRING_LENGTH];
    BUFFER *output;
    DESCRIPTOR_DATA *d;
    int immmatch;
    int mortmatch;
    int hptemp;  
 /*
 * Initalize Variables.
 */

    immmatch = 0;
       mortmatch = 0;
    buf[0] = '\0';
    output = new_buf();

 /*          
 * Count and output */
      sprintf(buf,"\n\r{B---{WI{wm{Wm{wo{Wr{wt{Wa{wl{Ws{B----{x\n\r");
        add_buf(output,buf);
        sprintf( buf, "{WN{wa{Wm{we           {WL{we{Wv{we{Wl   {WW{wi{Wz      {WI{wn{Wc{wo{Wg    {WG{wh{Wo{ws{Wt    {W[{wV{Wn{wu{Wm{W]{x\n\r");      
        add_buf(output,buf);
    for ( d = descriptor_list; d != NULL; d = d->next )
    {
        CHAR_DATA *wch;

        if ( d->connected != CON_PLAYING || !can_see( ch, d->character ) )    
            continue;

        wch   = ( d->original != NULL ) ? d->original : d->character;

        if (!can_see(ch,wch)  || wch->level < 102)
            continue;

        immmatch++;

        sprintf( buf, "{R%-14s %-3d     %-3d      %-3d      %-3d      [%-3d]{x\n\r",
                        wch->name,
                        wch->level,
                        wch->invis_level,
                        wch->incog_level,
			   wch->ghost_level,
                        wch->in_room->vnum);
                        add_buf(output,buf);
    }


 /*
 * Count and output the Morts.
 */
        sprintf( buf, " \n\r {B----{YM{yo{Yr{yt{Ya{yl{Ys{B----{x\n\r");
        add_buf(output,buf);
        sprintf( buf, "{WN{wa{Wm{we           {WG{wo{Wd      {WR{wa{Wc{we{W/{wC{Wl{wa{Ws{ws  {WP{wo{Ws{wi{Wt{wi{Wo{wn      {WL{we{Wv   {w%%{Wh{wp{Ws    {w[{WV{wn{Wu{wm{W]{x\n\r");   

        add_buf(output,buf);
        hptemp = 0;

   for ( d = descriptor_list; d != NULL; d = d->next )    
    {
        CHAR_DATA *wch;
        char const *class;

        if ( d->connected != CON_PLAYING || !can_see( ch, d->character ) )
            continue;

        wch   = ( d->original != NULL ) ? d->original : d->character;

        if (!can_see(ch,wch) || wch->level > ch->level || wch->level > 101)   
            continue;

        mortmatch++;
        if ((wch->max_hit != wch->hit) && (wch->hit > 0))
                hptemp = (wch->hit*100)/wch->max_hit;
        else if (wch->max_hit == wch->hit)
                hptemp = 100;
        else if (wch->hit < 0)
                hptemp = 0;    

        class = class_table[wch->class].who_name;

        sprintf( buf, "{G%-14s %-7s  %6.6s/%3.3s  %-10s    %-3d   %-3d%%    [%-3d]{x\n\r",
                wch->name,
                IS_GOOD(wch)? "Good" : IS_EVIL(wch) ? "Evil" : "Neutral",
                wch->race < MAX_PC_RACE ? pc_race_table[wch->race].who_name : " ",
                class,
                capitalize( position_table[wch->position].name) ,
                wch->level,
                hptemp,
                wch->in_room->vnum);
        add_buf(output,buf);
    }

/*
 * Tally the counts and send the whole list out.
 */
   sprintf( buf2, "\n\r{CIMMs found: {w%d{x\n\r", immmatch );
    add_buf(output,buf2);
    sprintf( buf2, "{CMorts found: {y%d{x\n\r", mortmatch );    
    add_buf(output,buf2);
    page_to_char( buf_string(output), ch );
    free_buf(output);
    return;
}                          
Ejemplo n.º 15
0
/* Some initializations for characters, including initial skills
   If mode == 0, then act as though the character was entering the
   game for the first time.  Otherwise, act as though the character
   is being set to that level.
 */
void
do_start(struct creature *ch, int mode)
{
    void advance_level(struct creature *ch, int8_t keep_internal);
    int8_t new_player = 0;
    int i;
    struct obj_data *implant_save[NUM_WEARS];
    struct obj_data *tattoo_save[NUM_WEARS];

    // remove implant affects
    for (i = 0; i < NUM_WEARS; i++) {
        if (GET_IMPLANT(ch, i))
            implant_save[i] = raw_unequip_char(ch, i, EQUIP_IMPLANT);
        else
            implant_save[i] = NULL;
        if (GET_TATTOO(ch, i))
            tattoo_save[i] = raw_unequip_char(ch, i, EQUIP_TATTOO);
        else
            tattoo_save[i] = NULL;
    }

    if (GET_EXP(ch) == 0 && !IS_REMORT(ch) && !IS_VAMPIRE(ch))
        new_player = true;

    GET_LEVEL(ch) = 1;
    GET_EXP(ch) = 1;

    if (mode)
        roll_real_abils(ch);

    for (i = 1; i <= MAX_SKILLS; i++)
        SET_SKILL(ch, i, 0);

    if (IS_VAMPIRE(ch))
        GET_LIFE_POINTS(ch) = 1;
    else
        GET_LIFE_POINTS(ch) = 3 * (GET_WIS(ch) + GET_CON(ch)) / 40;

    ch->points.max_hit = 20;
    ch->points.max_mana = 100;
    ch->points.max_move = 82;

    if (IS_TABAXI(ch)) {
        SET_SKILL(ch, SKILL_CLAW, LEARNED(ch));
        SET_SKILL(ch, SKILL_BITE, LEARNED(ch));
    }
    if (IS_ELF(ch)) {
        SET_SKILL(ch, SKILL_ARCHERY, LEARNED(ch));
    }

    switch (GET_CLASS(ch)) {
    case CLASS_MAGIC_USER:
        SET_SKILL(ch, SKILL_PUNCH, 10);
        break;
    case CLASS_CLERIC:
        SET_SKILL(ch, SKILL_PUNCH, 10);
        break;
    case CLASS_THIEF:
        SET_SKILL(ch, SKILL_PUNCH, 15);
        SET_SKILL(ch, SKILL_SNEAK, 10);
        SET_SKILL(ch, SKILL_HIDE, 5);
        SET_SKILL(ch, SKILL_STEAL, 15);
        break;
    case CLASS_WARRIOR:
        SET_SKILL(ch, SKILL_PUNCH, 20);
        break;
    case CLASS_BARB:
        SET_SKILL(ch, SKILL_PUNCH, 15);
        break;
    case CLASS_PSIONIC:
        SET_SKILL(ch, SKILL_PUNCH, 10);
        break;
    case CLASS_PHYSIC:
        SET_SKILL(ch, SKILL_PUNCH, 10);
        break;
    case CLASS_CYBORG:
        SET_SKILL(ch, SKILL_PUNCH, 10);
        break;
    case CLASS_KNIGHT:
        SET_SKILL(ch, SKILL_PUNCH, 20);
        break;
    case CLASS_RANGER:
        SET_SKILL(ch, SKILL_PUNCH, 15);
        GET_MAX_MOVE(ch) += dice(4, 9);
        break;
    case CLASS_MONK:
        SET_SKILL(ch, SKILL_PUNCH, 20);
        break;
    case CLASS_MERCENARY:
        SET_SKILL(ch, SKILL_PUNCH, 20);
    case CLASS_BARD:
        SET_SKILL(ch, SKILL_PUNCH, 25);
        SET_SKILL(ch, SKILL_ARCHERY, 25);
        break;

    }

    if (new_player) {
        if (PAST_CLASS(GET_CLASS(ch))) {
            deposit_past_bank(ch->desc->account,
                8192 + number(256, 2048) + GET_INT(ch) + GET_WIS(ch));
            ch->points.gold =
                8192 + number(256, 2048) + GET_INT(ch) + GET_WIS(ch);
        } else if (FUTURE_CLASS(GET_CLASS(ch))) {
            deposit_future_bank(ch->desc->account,
                8192 + number(256, 2048) + GET_INT(ch) + GET_WIS(ch));
            ch->points.cash =
                8192 + number(256, 2048) + GET_INT(ch) + GET_WIS(ch);
        }

        // New players do not start with the gown at this point
        // This has been left in for reference for generic newbie starting gear for the future.
        // New players start with a hospital gown and items most dear to them
        /*
        struct obj_data *gown = read_object(33800);
        if (gown != NULL) {
            equip_char(ch, gown, WEAR_ABOUT, EQUIP_WORN);
        }
        */

        // Good clerics start with a holy symbol on neck
        if ((GET_CLASS(ch) == CLASS_CLERIC) && IS_GOOD(ch)) {
            struct obj_data *talisman = read_object(1280);
            if (talisman != NULL) {
                equip_char(ch, talisman, WEAR_NECK_1, EQUIP_WORN);
            }
        }

        // Evil clerics start with a holy symbol on hold
        if ((GET_CLASS(ch) == CLASS_CLERIC) && IS_EVIL(ch)) {
            struct obj_data *symbol = read_object(1260);
            if (symbol != NULL) {
                equip_char(ch, symbol, WEAR_HOLD, EQUIP_WORN);
            }
        }

        // Good knights start with a holy symbol on finger
        if ((GET_CLASS(ch) == CLASS_KNIGHT) && IS_GOOD(ch)) {
            struct obj_data *ring = read_object(1287);
            if (ring != NULL) {
                equip_char(ch, ring, WEAR_FINGER_L, EQUIP_WORN);
            }
        }

        // Evil knights start with a holy symbol on neck
        if ((GET_CLASS(ch) == CLASS_KNIGHT) && IS_EVIL(ch)) {
            struct obj_data *pendant = read_object(1270);
            if (pendant != NULL) {
                equip_char(ch, pendant, WEAR_NECK_1, EQUIP_WORN);
            }
        }

        // Bards start with a percussion instrument held, and stringed in inventory
        if (GET_CLASS(ch) == CLASS_BARD) {
            struct obj_data *lute = read_object(3218);
            if (lute != NULL) {
                obj_to_char(lute, ch);
            }
        }
   
        set_title(ch, "the complete newbie");
    }

    advance_level(ch, 0);

    GET_MAX_MOVE(ch) += GET_CON(ch);

    GET_HIT(ch) = GET_MAX_HIT(ch);
    GET_MANA(ch) = GET_MAX_MANA(ch);
    GET_MOVE(ch) = GET_MAX_MOVE(ch);

    GET_COND(ch, THIRST) = 24;
    GET_COND(ch, FULL) = 24;
    GET_COND(ch, DRUNK) = 0;

    if (new_player) {
        ch->player.time.played = 0;
        ch->player.time.logon = time(NULL);
    }

    for (i = 0; i < NUM_WEARS; i++) {
        if (implant_save[i])
            equip_char(ch, implant_save[i], i, EQUIP_IMPLANT);
        if (tattoo_save[i])
            equip_char(ch, tattoo_save[i], i, EQUIP_TATTOO);
    }
}
Ejemplo n.º 16
0
bool check_social( CHAR_DATA * ch, const char *command, const char *argument )
{
   char arg[MAX_INPUT_LENGTH];
   CHAR_DATA *victim;
   SOCIALTYPE *social;

   if( ( social = find_social( command ) ) == NULL )
      return FALSE;

   if( !IS_NPC( ch ) && IS_SET( ch->act, PLR_NO_EMOTE ) )
   {
      send_to_char( "You are anti-social!\r\n", ch );
      return TRUE;
   }

   switch ( ch->position )
   {
      case POS_DEAD:
         send_to_char( "Lie still; you are DEAD.\r\n", ch );
         return TRUE;

      case POS_INCAP:
      case POS_MORTAL:
         send_to_char( "You are hurt far too bad for that.\r\n", ch );
         return TRUE;

      case POS_STUNNED:
         send_to_char( "You are too stunned to do that.\r\n", ch );
         return TRUE;

      case POS_SLEEPING:
         /*
          * I just know this is the path to a 12" 'if' statement.  :(
          * But two players asked for it already!  -- Furey
          */
         if( !str_cmp( social->name, "snore" ) )
            break;
         send_to_char( "In your dreams, or what?\r\n", ch );
         return TRUE;

   }

   one_argument( argument, arg );
   victim = NULL;
   if( arg[0] == '\0' )
   {
      act( AT_SOCIAL, social->others_no_arg, ch, NULL, victim, TO_ROOM );
      act( AT_SOCIAL, social->char_no_arg, ch, NULL, victim, TO_CHAR );
   }
   else if( ( victim = get_char_room( ch, arg ) ) == NULL )
   {
      send_to_char( "They aren't here.\r\n", ch );
   }
   else if( victim == ch )
   {
      act( AT_SOCIAL, social->others_auto, ch, NULL, victim, TO_ROOM );
      act( AT_SOCIAL, social->char_auto, ch, NULL, victim, TO_CHAR );
   }
   else
   {
      act( AT_SOCIAL, social->others_found, ch, NULL, victim, TO_NOTVICT );
      act( AT_SOCIAL, social->char_found, ch, NULL, victim, TO_CHAR );
      act( AT_SOCIAL, social->vict_found, ch, NULL, victim, TO_VICT );

      if( !IS_NPC( ch ) && IS_NPC( victim )
          && !IS_AFFECTED( victim, AFF_CHARM ) && IS_AWAKE( victim ) && !IS_SET( victim->pIndexData->progtypes, ACT_PROG ) )
      {
         switch ( number_bits( 4 ) )
         {
            case 0:
               if( !IS_SET( ch->in_room->room_flags, ROOM_SAFE ) || IS_EVIL( ch ) )
                  multi_hit( victim, ch, TYPE_UNDEFINED );
               else if( IS_NEUTRAL( ch ) )
               {
                  act( AT_ACTION, "$n slaps $N.", victim, NULL, ch, TO_NOTVICT );
                  act( AT_ACTION, "You slap $N.", victim, NULL, ch, TO_CHAR );
                  act( AT_ACTION, "$n slaps you.", victim, NULL, ch, TO_VICT );
               }
               else
               {
                  act( AT_ACTION, "$n acts like $N doesn't even exist.", victim, NULL, ch, TO_NOTVICT );
                  act( AT_ACTION, "You just ignore $N.", victim, NULL, ch, TO_CHAR );
                  act( AT_ACTION, "$n appears to be ignoring you.", victim, NULL, ch, TO_VICT );
               }
               break;

            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            case 8:
               act( AT_SOCIAL, social->others_found, victim, NULL, ch, TO_NOTVICT );
               act( AT_SOCIAL, social->char_found, victim, NULL, ch, TO_CHAR );
               act( AT_SOCIAL, social->vict_found, victim, NULL, ch, TO_VICT );
               break;

            case 9:
            case 10:
            case 11:
            case 12:
               act( AT_ACTION, "$n slaps $N.", victim, NULL, ch, TO_NOTVICT );
               act( AT_ACTION, "You slap $N.", victim, NULL, ch, TO_CHAR );
               act( AT_ACTION, "$n slaps you.", victim, NULL, ch, TO_VICT );
               break;
         }
      }
   }

   return TRUE;
}
Ejemplo n.º 17
0
void do_track( CHAR_DATA *ch, char *argument )
{
	char       buf [ MAX_STRING_LENGTH ];
	char       arg [ MAX_STRING_LENGTH ];
	CHAR_DATA *victim;
	int        direction, skill;
	bool       fArea=TRUE;

	skill=get_skill(ch, gsn_track);

	if (IS_NPC(ch))
	{
		return;
	}

	if ( ch->mount )
	{
		send_to_char( "Najpierw zsi±d¼ ze swojego wierzchowca.\n\r", ch );
		return;
	}

	if ( !IS_IMMORTAL( ch ) && IS_AFFECTED( ch, AFF_BLIND ) )
	{
		act("$n klêka i bezradnie potrz±sa g³ow±.",ch,NULL,NULL,TO_ROOM);
		send_to_char("Klekasz, ale przecie¿ niczego nie widzisz.\n\r",ch);
		return;
	}
	if ( room_is_dark( ch, ch->in_room ) &&  !(IS_AFFECTED( ch, AFF_DARK_VISION ) || IS_IMMORTAL( ch ) ))
	{
		send_to_char("Klekasz, ale jest tu tak ciemno, ¿e niczego nie widzisz.\n\r",ch);
		return;
	}

	// wycinamy niektóre ze sektorów
	switch ( ch->in_room->sector_type )
	{
		case  6:  //woda p³yw
		case  7:  //woda niep
		case 19:  //rzeka
		case 20:  //jezioro
		case 21:  //morze
		case 22:  //ocean
		case 23:  //lawa
		case 24:  //ruchome piaski
		case 25:  //gor±ce ¼ród³o
		case 34:  //pod wod±
		case 37:  //ciemna woda
		case 39:  //podziemne jezioro
			send_to_char( "Tutaj chyba nie da siê szukaæ ¶ladów.\n\r", ch );
			return;
	}

	// komunikaty dla tych, którzy nie umiej± szukaæ ¶ladów
	if ( skill == 0 )
	{
		switch (number_range(1,7))
		{
			case 1:
				act("$n klêka i nie wie co robiæ dalej.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Klêkasz i nie za bardzo wiesz co robiæ dalej.\n\r",ch);
				break;
			case 2:
				act("$n klêka i niczego nie widzi.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Klêkasz i niczego nie widzisz.\n\r",ch);
				break;
			case 3:
				act("$n mocno tupie, klêka i przygl±da siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Mocno tupiesz, klêkasz i przygl±dasz siê ¶ladom.\n\r",ch);
				break;
			case 4:
				act("$n klêka i ¶ledzi tropy, ale nie ma o tym zielonego pojêcia.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Klêkasz i ¶ledzisz tropy, choæ nie masz o tym zielonego pojêcia.\n\r",ch);
				break;
			case 5:
				act("$n klêka i robi nieszczê¶liw± minê.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Klêkasz i robisz nieszczê¶liw± minê.\n\r",ch);
				break;
			case 6:
				act("$n rozgl±da siê dooko³a.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Rozgl±dasz siê dooko³a, ale to nie pomaga.\n\r",ch);
				break;
			case 7:
				act("$n zastanawia siê nad tym, ¿e tropienie to niez³a umiejêtno¶æ.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Zastanawiasz siê nad tym, ¿e tropienie to niez³a umiejêtno¶æ.\n\r",ch);
				break;
			default :
				send_to_char( "Nie masz pojêcia jak to siê robi.\n\r", ch );
				act("$n klêka i ¶ledzi tropy, ale nie ma o tym zielonego pojêcia.",ch,NULL,NULL,TO_ROOM);
				break;
		}
		return;
	}

	// bonus/kara od dobrej lokacji s± wiêksze ni¿ od z³ej
	if ( EXT_IS_SET( ch->in_room->room_flags, ROOM_CONSECRATE ))
	{
		if (IS_EVIL( ch ) ) skill -= number_range(1,5);
		if (IS_GOOD( ch ) ) skill += number_range(1,5);
	}

	if ( EXT_IS_SET( ch->in_room->room_flags, ROOM_DESECRATE ))
	{
		if (IS_EVIL( ch ) ) skill += number_range(0,4);
		if (IS_GOOD( ch ) ) skill -= number_range(0,4);
	}

	// sprawdzamy czy skill nie zrobi³ siê nam mniejszy ni¿ 1
	if (skill < 1)
	{
		skill = 1;
	}

	// no to zaczynamy w³a¶ciwe trackowanie :D
	one_argument( argument, arg );

#ifdef ENABLE_NEW_TRACK
	if(MAX_TRACK_LEN > 0)
	{
		track_new(ch, skill, argument);
		return;
	}
#endif

	if ( arg[0] == '\0' )
	{
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		act("Klêkasz i z uwag± przygl±dasz siê ¶ladom.",ch,NULL,NULL,TO_CHAR);
		return;
	}

	if ( fArea )
	{
		victim = get_char_area( ch, arg );
	}
	else
	{
		victim = get_char_world( ch, arg );
	}

	if ( !victim )
	{
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		act("Klêkasz, przygl±dasz siê ¶ladom, ale nie znajdujesz ¿adnego tropu.",ch,NULL,NULL,TO_CHAR);
		WAIT_STATE( ch, skill_table[gsn_track].beats );
		return;
	}

	if(victim==ch)
	{
		act("Zastanawiasz siê przez chwilê czy to ma sens, no có¿...",ch,NULL,NULL,TO_CHAR);
		return;
	}

	if ( ch->in_room == victim->in_room )
	{
		act( "Klêkasz i badasz trop, po chwili zdajesz sobie sprawê, ¿e $N stoi ko³o ciebie.", ch, NULL, victim, TO_CHAR );
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		return;
	}

	if ( skill < number_range( 20, 40 ) )
	{
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		act("Klêkasz, przygl±dasz siê ¶ladom, ale nie znajdujesz ¿adnego tropu.",ch,NULL,NULL,TO_CHAR);
		WAIT_STATE( ch, skill_table[gsn_track].beats );
		check_improve(ch, NULL, gsn_track, FALSE, 12);
		return;
	}

	if ( IS_AFFECTED ( victim, AFF_SPIRIT_WALK ) )
	{
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		act("Klêkasz, przygl±dasz siê ¶ladom, ale nie znajdujesz ¿adnego tropu.",ch,NULL,NULL,TO_CHAR);
		WAIT_STATE( ch, skill_table[gsn_track].beats );
		return;
	}
	else
	{
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		act("Klêkasz i przygladasz siê ¶ladom, chyba widzisz jaki¶ trop.",ch,NULL,NULL,TO_CHAR);
	}

	WAIT_STATE( ch, skill_table[gsn_track].beats );


	direction = find_path( ch->in_room->vnum, victim->in_room->vnum, ch, -40000, fArea );

	if ( direction == -1 )
	{
		act( "Niestety, nie mo¿esz nic wiêcej odczytaæ ze ¶ladów.", ch, NULL, victim, TO_CHAR );
		return;
	}

	if ( direction < 0 || direction >= MAX_DIR )
	{
		send_to_char( "Hmm... co¶ jest nie tak.\n\r", ch );
		return;
	}

/*
 * Give a random direction if the player misses the die roll.
 */
	if ( number_percent() > skill )
	{
		do
		{
			direction = number_door( );
		}
		while (   !( ch->in_room->exit[direction] ) || !( ch->in_room->exit[direction]->u1.to_room ) );
	}

	check_improve(ch, NULL, gsn_track, TRUE, 9);

/*
 * Display the results of the search.
 */


	sprintf( buf, "Znajdujesz ¶lady $Z prowadz±ce na %s.", direction == 4 ? "górê" : dir_name[direction] );
	act( buf, ch, NULL, victim, TO_CHAR );
	return;
}
Ejemplo n.º 18
0
/*
 * Every spell that does damage comes through here.  This calculates the
 * amount of damage, adds in any modifiers, determines what the saves are,
 * tests for save and calls damage().
 *
 * -1 = dead, otherwise the amount of damage done.
 */
int mag_damage(int level, struct char_data *ch, struct char_data *victim,
		     int spellnum, int savetype)
{
  int dam = 0;

  if (victim == NULL || ch == NULL)
    return (0);

  switch (spellnum) {
    /* Mostly mages */
  case SPELL_MAGIC_MISSILE:
  case SPELL_CHILL_TOUCH:	/* chill touch also has an affect */
    if (IS_MAGIC_USER(ch))
      dam = dice(1, 8) + 1;
    else
      dam = dice(1, 6) + 1;
    break;
  case SPELL_BURNING_HANDS:
    if (IS_MAGIC_USER(ch))
      dam = dice(3, 8) + 3;
    else
      dam = dice(3, 6) + 3;
    break;
  case SPELL_SHOCKING_GRASP:
    if (IS_MAGIC_USER(ch))
      dam = dice(5, 8) + 5;
    else
      dam = dice(5, 6) + 5;
    break;
  case SPELL_LIGHTNING_BOLT:
    if (IS_MAGIC_USER(ch))
      dam = dice(7, 8) + 7;
    else
      dam = dice(7, 6) + 7;
    break;
  case SPELL_COLOR_SPRAY:
    if (IS_MAGIC_USER(ch))
      dam = dice(9, 8) + 9;
    else
      dam = dice(9, 6) + 9;
    break;
  case SPELL_FIREBALL:
    if (IS_MAGIC_USER(ch))
      dam = dice(11, 8) + 11;
    else
      dam = dice(11, 6) + 11;
    break;

    /* Mostly clerics */
  case SPELL_DISPEL_EVIL:
    dam = dice(6, 8) + 6;
    if (IS_EVIL(ch)) {
      victim = ch;
      dam = GET_HIT(ch) - 1;
    } else if (IS_GOOD(victim)) {
      act("The gods protect $N.", FALSE, ch, 0, victim, TO_CHAR);
      return (0);
    }
    break;
  case SPELL_DISPEL_GOOD:
    dam = dice(6, 8) + 6;
    if (IS_GOOD(ch)) {
      victim = ch;
      dam = GET_HIT(ch) - 1;
    } else if (IS_EVIL(victim)) {
      act("The gods protect $N.", FALSE, ch, 0, victim, TO_CHAR);
      return (0);
    }
    break;


  case SPELL_CALL_LIGHTNING:
    dam = dice(7, 8) + 7;
    break;

  case SPELL_HARM:
    dam = dice(8, 8) + 8;
    break;

  case SPELL_ENERGY_DRAIN:
    if (GET_LEVEL(victim) <= 2)
      dam = 100;
    else
      dam = dice(1, 10);
    break;

    /* Area spells */
  case SPELL_EARTHQUAKE:
    dam = dice(2, 8) + level;
    break;

  } /* switch(spellnum) */


  /* divide damage by two if victim makes his saving throw */
  if (mag_savingthrow(victim, savetype, 0))
    dam /= 2;

  /* and finally, inflict the damage */
  return (damage(ch, victim, dam, spellnum));
}
Ejemplo n.º 19
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.º 20
0
void show_char_to_char(struct char_data *i, struct char_data *ch, int mode)
{
    char buffer[MAX_STRING_LENGTH];
    int j, found, percent;
    struct obj_data *tmp_obj;

    if (mode == 0) {

        if (IS_AFFECTED(i, AFF_HIDE) || !CAN_SEE(ch,i)) {
            if (IS_AFFECTED(ch, AFF_SENSE_LIFE))
                send_to_char("You sense a hidden life form in the room.\n\r", ch);
            return;
        }

        if (!(i->player.long_descr)||(GET_POS(i) != i->specials.default_pos)) {
            /* A player char or a mobile without long descr, or not in default pos. */
            if (!IS_NPC(i)) {
                strcpy(buffer,GET_NAME(i));
                strcat(buffer," ");
                strcat(buffer,GET_TITLE(i));
            } else {
                strcpy(buffer, i->player.short_descr);
                CAP(buffer);
            }

            if ( IS_AFFECTED(i,AFF_INVISIBLE))
                strcat(buffer," (invisible)");

            switch(GET_POS(i)) {
            case POSITION_STUNNED  :
                strcat(buffer," is lying here, stunned.");
                break;
            case POSITION_INCAP    :
                strcat(buffer," is lying here, incapacitated.");
                break;
            case POSITION_MORTALLYW:
                strcat(buffer," is lying here, mortally wounded.");
                break;
            case POSITION_DEAD     :
                strcat(buffer," is lying here, dead.");
                break;
            case POSITION_STANDING :
                strcat(buffer," is standing here.");
                break;
            case POSITION_SITTING  :
                strcat(buffer," is sitting here.");
                break;
            case POSITION_RESTING  :
                strcat(buffer," is resting here.");
                break;
            case POSITION_SLEEPING :
                strcat(buffer," is sleeping here.");
                break;
            case POSITION_FIGHTING :
                if (i->specials.fighting) {

                    strcat(buffer," is here, fighting ");
                    if (i->specials.fighting == ch)
                        strcat(buffer," YOU!");
                    else {
                        if (i->in_room == i->specials.fighting->in_room)
                            if (IS_NPC(i->specials.fighting))
                                strcat(buffer, i->specials.fighting->player.short_descr);
                            else
                                strcat(buffer, GET_NAME(i->specials.fighting));
                        else
                            strcat(buffer, "someone who has already left.");
                    }
                } else /* NIL fighting pointer */
                    strcat(buffer," is here struggling with thin air.");
                break;
            default :
                strcat(buffer," is floating here.");
                break;
            }
            if (IS_AFFECTED(ch, AFF_DETECT_EVIL)) {
                if (IS_EVIL(i))
                    strcat(buffer, " (Red Aura)");
            }

            strcat(buffer,"\n\r");
            send_to_char(buffer, ch);
        }
        else  /* npc with long */
        {
            if (IS_AFFECTED(i,AFF_INVISIBLE))
                strcpy(buffer,"*");
            else
                *buffer = '\0';

            if (IS_AFFECTED(ch, AFF_DETECT_EVIL)) {
                if (IS_EVIL(i))
                    strcat(buffer, " (Red Aura)");
            }

            strcat(buffer, i->player.long_descr);

            send_to_char(buffer, ch);
        }

        if (IS_AFFECTED(i,AFF_SANCTUARY))
            act("$n glows with a bright light!", FALSE, i, 0, ch, TO_VICT);

    } else if (mode == 1) {

        if (i->player.description)
            send_to_char(i->player.description, ch);
        else {
            act("You see nothing special about $m.", FALSE, i, 0, ch, TO_VICT);
        }

        /* Show a character to another */

        if (GET_MAX_HIT(i) > 0)
            percent = (100*GET_HIT(i))/GET_MAX_HIT(i);
        else
            percent = -1; /* How could MAX_HIT be < 1?? */

        if (IS_NPC(i))
            strcpy(buffer, i->player.short_descr);
        else
            strcpy(buffer, GET_NAME(i));

        if (percent >= 100)
            strcat(buffer, " is in an excellent condition.\n\r");
        else if (percent >= 90)
            strcat(buffer, " has a few scratches.\n\r");
        else if (percent >= 75)
            strcat(buffer, " has some small wounds and bruises.\n\r");
        else if (percent >= 50)
            strcat(buffer, " has quite a few wounds.\n\r");
        else if (percent >= 30)
            strcat(buffer, " has some big nasty wounds and scratches.\n\r");
        else if (percent >= 15)
            strcat(buffer, " looks pretty hurt.\n\r");
        else if (percent >= 0)
            strcat(buffer, " is in an awful condition.\n\r");
        else
            strcat(buffer, " is bleeding awfully from big wounds.\n\r");

        send_to_char(buffer, ch);

        found = FALSE;
        for (j=0; j< MAX_WEAR; j++) {
            if (i->equipment[j]) {
                if (CAN_SEE_OBJ(ch,i->equipment[j])) {
                    found = TRUE;
                }
            }
        }
        if (found) {
            act("\n\r$n is using:", FALSE, i, 0, ch, TO_VICT);
            for (j=0; j< MAX_WEAR; j++) {
                if (i->equipment[j]) {
                    if (CAN_SEE_OBJ(ch,i->equipment[j])) {
                        send_to_char(where[j],ch);
                        show_obj_to_char(i->equipment[j],ch,1);
                    }
                }
            }
        }
        if ((GET_CLASS(ch) == CLASS_THIEF) && (ch != i)) {
            found = FALSE;
            send_to_char("\n\rYou attempt to peek at the inventory:\n\r", ch);
            for(tmp_obj = i->carrying; tmp_obj; tmp_obj = tmp_obj->next_content) {
                if (CAN_SEE_OBJ(ch, tmp_obj) && (number(0,20) < GET_LEVEL(ch))) {
                    show_obj_to_char(tmp_obj, ch, 1);
                    found = TRUE;
                }
            }
            if (!found)
                send_to_char("You can't see anything.\n\r", ch);
        }

    } else if (mode == 2) {

        /* Lists inventory */
        act("$n is carrying:", FALSE, i, 0, ch, TO_VICT);
        list_obj_to_char(i->carrying,ch,1,TRUE);
    }
}
Ejemplo n.º 21
0
bool mob_magic_user(struct char_data *ch)
{
    struct char_data *vict;

    if(GET_CLASS(ch) != MOB_CLASS_MAGIC_USER)
        return (FALSE);

    if (GET_POS(ch) != POS_FIGHTING)
        return (FALSE);

    /* pseudo-randomly choose someone in the room who is fighting me */
    for (vict = world[IN_ROOM(ch)].people; vict; vict = vict->next_in_room)
        if (FIGHTING(vict) == ch && !rand_number(0, 4))
            break;

    /* if I didn't pick any of those, then just slam the guy I'm fighting */
    if (vict == NULL && IN_ROOM(FIGHTING(ch)) == IN_ROOM(ch))
        vict = FIGHTING(ch);

    /* Hm...didn't pick anyone...I'll wait a round. */
    if (vict == NULL)
        return (TRUE);

    if (GET_LEVEL(ch) > 13 && rand_number(0, 10) == 0)
        cast_spell(ch, vict, NULL, NOWHERE, SPELL_POISON);

    if (GET_LEVEL(ch) > 7 && rand_number(0, 8) == 0)
        cast_spell(ch, vict, NULL, NOWHERE, SPELL_BLINDNESS);

    if (GET_LEVEL(ch) > 12 && rand_number(0, 12) == 0) {
        if (IS_EVIL(ch))
            cast_spell(ch, vict, NULL, NOWHERE, SPELL_ENERGY_DRAIN);
        else if (IS_GOOD(ch))
            cast_spell(ch, vict, NULL, NOWHERE, SPELL_DISPEL_EVIL);
    }

    if (rand_number(0, 4))
        return (TRUE);

    switch (GET_LEVEL(ch)) {
    case 4:
    case 5:
        cast_spell(ch, vict, NULL, NOWHERE, SPELL_MAGIC_MISSILE);
        break;
    case 6:
    case 7:
        cast_spell(ch, vict, NULL, NOWHERE, SPELL_CHILL_TOUCH);
        break;
    case 8:
    case 9:
        cast_spell(ch, vict, NULL, NOWHERE, SPELL_BURNING_HANDS);
        break;
    case 10:
    case 11:
        cast_spell(ch, vict, NULL, NOWHERE, SPELL_SHOCKING_GRASP);
        break;
    case 12:
    case 13:
        cast_spell(ch, vict, NULL, NOWHERE, SPELL_LIGHTNING_BOLT);
        break;
    case 14:
    case 15:
    case 16:
    case 17:
        cast_spell(ch, vict, NULL, NOWHERE, SPELL_COLOR_SPRAY);
        break;
    default:
        cast_spell(ch, vict, NULL, NOWHERE, SPELL_FIREBALL);
        break;
    }
    return (TRUE);

}
Ejemplo n.º 22
0
void auto_equip(struct char_data *ch, struct obj_data *obj, int location)
{
  int j;

  if (location > 0) { /* was worn */
    switch (j = (location - 1)) {
      case WEAR_FINGER_R:
      case WEAR_FINGER_L:
	if (!CAN_WEAR(obj,ITEM_WEAR_FINGER))
	  location = LOC_INVENTORY;
	break;
      case WEAR_NECK_1:
      case WEAR_NECK_2:
	if (!CAN_WEAR(obj,ITEM_WEAR_NECK))
	  location = LOC_INVENTORY;
	break;
      case WEAR_BODY:
	if (!CAN_WEAR(obj,ITEM_WEAR_BODY))
	  location = LOC_INVENTORY;
	break;
      case WEAR_HEAD:
	if (!CAN_WEAR(obj,ITEM_WEAR_HEAD))
	  location = LOC_INVENTORY;
	break;
      case WEAR_LEGS:
	if (!CAN_WEAR(obj,ITEM_WEAR_LEGS))
	  location = LOC_INVENTORY;
	break;
      case WEAR_FOOT_R:
      case WEAR_FOOT_L:
	if (!CAN_WEAR(obj,ITEM_WEAR_FEET))
	  location = LOC_INVENTORY;
	break;
      case WEAR_HAND_R:
      case WEAR_HAND_L:
	if (!CAN_WEAR(obj,ITEM_WEAR_HANDS))
	  location = LOC_INVENTORY;
	break;
      case WEAR_ARM_R:
      case WEAR_ARM_L:
	if (!CAN_WEAR(obj,ITEM_WEAR_ARMS))
	  location = LOC_INVENTORY;
	break;
      case WEAR_BACK:
	if (!CAN_WEAR(obj,ITEM_WEAR_BACK))
	  location = LOC_INVENTORY;
	break;
      case WEAR_WAIST:
	if (!CAN_WEAR(obj,ITEM_WEAR_WAIST))
	  location = LOC_INVENTORY;
	break;
      case WEAR_WRIST_R:
      case WEAR_WRIST_L:
	if (!CAN_WEAR(obj,ITEM_WEAR_WRIST))
	  location = LOC_INVENTORY;
	break;
      case WEAR_WIELD:
      case WEAR_HOLD:
	if (!CAN_WEAR(obj, ITEM_WEAR_HOLD) &&
            !CAN_WEAR(obj, ITEM_WEAR_TAKE))
	  location = LOC_INVENTORY;
	break;
      default:
	location = LOC_INVENTORY;
    }
    if (location > 0) {
      if (!GET_EQ(ch,j)) {
        /* check ch's alignment to prevent $M from being zapped through auto-equip */
	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)))
	  location = LOC_INVENTORY;
	else
	  equip_char(ch, obj, j);
      } else  { /* oops - saved player with double equipment[j]? */
        char aeq[128];
        sprintf(aeq, "SYSERR: autoeq: '%s' already equipped in position %d.", GET_NAME(ch), location);
        mudlog(aeq, BRF, LVL_IMMORT, TRUE);
        location = LOC_INVENTORY;
      }
    }
  }

  if ( location <= 0 )
    obj_to_char(obj, ch);
}
Ejemplo n.º 23
0
/* ---------------------------------------------------------------------
 * CMD_EVAL
 * This monster evaluates an if/or/and statement
 * There are five kinds of statement:
 * 1) keyword and value (no $-code)	    if random 30
 * 2) keyword, comparison and value	    if people > 2
 * 3) keyword and actor		    	    if isnpc $n
 * 4) keyword, actor and value		    if carries $n sword
 * 5) keyword, actor, comparison and value  if level $n >= 10
 *
 *----------------------------------------------------------------------
 */
int cmd_eval( sh_int vnum, char *line, int check,
	CHAR_DATA *mob, CHAR_DATA *ch, 
	const void *arg1, const void *arg2, CHAR_DATA *rch )
{
    CHAR_DATA *lval_char = mob;
    CHAR_DATA *vch = (CHAR_DATA *) arg2;
    OBJ_DATA *obj1 = (OBJ_DATA  *) arg1;
    OBJ_DATA *obj2 = (OBJ_DATA  *) arg2;
    OBJ_DATA  *lval_obj = NULL;

    char *original, buf[MAX_INPUT_LENGTH], code;
    int lval = 0, oper = 0, rval = -1;

    original = line;
    line = one_argument( line, buf );
    if ( buf[0] == '\0' || mob == NULL )
	return FALSE;

    /*
     * If this mobile has no target, let's assume our victim is the one
     */
    if ( mob->mprog_target == NULL )
	mob->mprog_target = ch;

    switch ( check )
    {
	/*
	 * Case 1: keyword and value
	 */
	case CHK_RAND:
	    return( atoi( buf ) < number_percent() );
	case CHK_MOBHERE:
	    if ( is_number( buf ) )
		return( get_mob_vnum_room( mob, atoi(buf) ) );
	    else
		return( (bool) (get_char_room( mob, buf) != NULL) );
	case CHK_OBJHERE:
	    if ( is_number( buf ) )
		return( get_obj_vnum_room( mob, atoi(buf) ) );
	    else
		return( (bool) (get_obj_here( mob, buf) != NULL) );
        case CHK_MOBEXISTS:
	    return( (bool) (get_char_world( mob, buf) != NULL) );
	case CHK_OBJEXISTS:
	    return( (bool) (get_obj_world( mob, buf) != NULL) );
	/*
	 * Case 2 begins here: We sneakily use rval to indicate need
	 * 		       for numeric eval...
	 */
	case CHK_PEOPLE:
	    rval = count_people_room( mob, 0 ); break;
	case CHK_PLAYERS:
	    rval = count_people_room( mob, 1 ); break;
	case CHK_MOBS:
	    rval = count_people_room( mob, 2 ); break;
	case CHK_CLONES:
	    rval = count_people_room( mob, 3 ); break;
	case CHK_ORDER:
	    rval = get_order( mob ); break;
	case CHK_HOUR:
	    rval = time_info.hour; break;
	default:;
    }

    /*
     * Case 2 continued: evaluate expression
     */
    if ( rval >= 0 )
    {
	if ( (oper = keyword_lookup( fn_evals, buf )) < 0 )
	{
	    sprintf( buf, "Cmd_eval: prog %d syntax error(2) '%s'",
		vnum, original );
	    bug( buf, 0 );
	    return FALSE;
	}
	one_argument( line, buf );
	lval = rval;
	rval = atoi( buf );
	return( num_eval( lval, oper, rval ) );
    }

    /*
     * Case 3,4,5: Grab actors from $* codes
     */
    if ( buf[0] != '$' || buf[1] == '\0' )
    {
	sprintf( buf, "Cmd_eval: prog %d syntax error(3) '%s'",
		vnum, original );
	bug( buf, 0 );
        return FALSE;
    }
    else
        code = buf[1];
    switch( code )
    {
    	case 'i':
            lval_char = mob; break;
        case 'n':
            lval_char = ch; break;
        case 't':
            lval_char = vch; break;
        case 'r':
            lval_char = rch == NULL ? get_random_char( mob ) : rch ; break;
        case 'o':
            lval_obj = obj1; break;
        case 'p':
            lval_obj = obj2; break;
	case 'q':
	    lval_char = mob->mprog_target; break;
	default:
	    sprintf( buf, "Cmd_eval: prog %d syntax error(4) '%s'",
		vnum, original );
	    bug( buf, 0 );
	    return FALSE;
    }
    /*
     * From now on, we need an actor, so if none was found, bail out
     */
    if ( lval_char == NULL && lval_obj == NULL )
    	return FALSE;

    /*
     * Case 3: Keyword, comparison and value
     */
    switch( check )
    {
	case CHK_ISPC:
            return( lval_char != NULL && !IS_NPC( lval_char ) );
        case CHK_ISNPC:
            return( lval_char != NULL && IS_NPC( lval_char ) );
        case CHK_ISGOOD:
            return( lval_char != NULL && IS_GOOD( lval_char ) );
        case CHK_ISEVIL:
            return( lval_char != NULL && IS_EVIL( lval_char ) );
        case CHK_ISNEUTRAL:
            return( lval_char != NULL && IS_NEUTRAL( lval_char ) );
	case CHK_ISIMMORT:
            return( lval_char != NULL && IS_IMMORTAL( lval_char ) );
        case CHK_ISCHARM: /* A relic from MERC 2.2 MOBprograms */
            return( lval_char != NULL && IS_AFFECTED( lval_char, AFF_CHARM ) );
        case CHK_ISFOLLOW:
            return( lval_char != NULL && lval_char->master != NULL 
		 && lval_char->master->in_room == lval_char->in_room );
	case CHK_ISACTIVE:
	    return( lval_char != NULL && lval_char->position > POS_SLEEPING );
	case CHK_ISDELAY:
	    return( lval_char != NULL && lval_char->mprog_delay > 0 );
	case CHK_ISVISIBLE:
            switch( code )
            {
                default :
                case 'i':
                case 'n':
                case 't':
                case 'r':
		case 'q':
	    	    return( lval_char != NULL && can_see( mob, lval_char ) );
		case 'o':
		case 'p':
	    	    return( lval_obj != NULL && can_see_obj( mob, lval_obj ) );
	    }
	case CHK_HASTARGET:
	    return( lval_char != NULL && lval_char->mprog_target != NULL
		&&  lval_char->in_room == lval_char->mprog_target->in_room );
	case CHK_ISTARGET:
	    return( lval_char != NULL && mob->mprog_target == lval_char );
	default:;
     }

     /* 
      * Case 4: Keyword, actor and value
      */
     line = one_argument( line, buf );
     switch( check )
     {
	case CHK_AFFECTED:
	    return( lval_char != NULL 
		&&  IS_SET(lval_char->affected_by, flag_lookup(buf, affect_flags)) );
	case CHK_ACT:
	    return( lval_char != NULL 
		&&  IS_SET(lval_char->act, flag_lookup(buf, act_flags)) );
	case CHK_IMM:
	    return( lval_char != NULL 
		&&  IS_SET(lval_char->imm_flags, flag_lookup(buf, imm_flags)) );
	case CHK_OFF:
	    return( lval_char != NULL 
		&&  IS_SET(lval_char->off_flags, flag_lookup(buf, off_flags)) );
	case CHK_CARRIES:
	    if ( is_number( buf ) )
		return( lval_char != NULL && has_item( lval_char, atoi(buf), -1, FALSE ) );
	    else
		return( lval_char != NULL && (get_obj_carry( lval_char, buf ) != NULL) );
	case CHK_WEARS:
	    if ( is_number( buf ) )
		return( lval_char != NULL && has_item( lval_char, atoi(buf), -1, TRUE ) );
	    else
		return( lval_char != NULL && (get_obj_wear( lval_char, buf ) != NULL) );
	case CHK_HAS:
	    return( lval_char != NULL && has_item( lval_char, -1, item_lookup(buf), FALSE ) );
	case CHK_USES:
	    return( lval_char != NULL && has_item( lval_char, -1, item_lookup(buf), TRUE ) );
	case CHK_NAME:
            switch( code )
            {
                default :
                case 'i':
                case 'n':
                case 't':
                case 'r':
		case 'q':
		    return( lval_char != NULL && is_name( buf, lval_char->name ) );
		case 'o':
		case 'p':
		    return( lval_obj != NULL && is_name( buf, lval_obj->name ) );
	    }
	case CHK_POS:
	    return( lval_char != NULL && lval_char->position == position_lookup( buf ) );
	case CHK_CLAN:
	    return( lval_char != NULL && lval_char->clan == clan_lookup( buf ) );
	case CHK_RACE:
	    return( lval_char != NULL && lval_char->race == race_lookup( buf ) );
	case CHK_OBJTYPE:
	    return( lval_obj != NULL && lval_obj->item_type == item_lookup( buf ) );
	default:;
    }

    /*
     * Case 5: Keyword, actor, comparison and value
     */
    if ( (oper = keyword_lookup( fn_evals, buf )) < 0 )
    {
	sprintf( buf, "Cmd_eval: prog %d syntax error(5): '%s'",
		vnum, original );
	bug( buf, 0 );
	return FALSE;
    }
    one_argument( line, buf );
    rval = atoi( buf );

    switch( check )
    {
	case CHK_VNUM:
	    switch( code )
            {
                default :
                case 'i':
                case 'n':
                case 't':
                case 'r':
		case 'q':
                    if( lval_char != NULL && IS_NPC( lval_char ) )
                        lval = lval_char->pIndexData->vnum;
                    break;
                case 'o':
                case 'p':
                     if ( lval_obj != NULL )
                        lval = lval_obj->pIndexData->vnum;
            }
            break;
	case CHK_HPCNT:
	    if ( lval_char != NULL ) lval = (lval_char->hit * 100)/(UMAX(1,lval_char->max_hit)); break;
	case CHK_ROOM:
	    if ( lval_char != NULL && lval_char->in_room != NULL )
		lval = lval_char->in_room->vnum; break;
        case CHK_SEX:
	    if ( lval_char != NULL ) lval = lval_char->sex; break;
        case CHK_LEVEL:
            if ( lval_char != NULL ) lval = lval_char->level; break;
	case CHK_ALIGN:
            if ( lval_char != NULL ) lval = lval_char->alignment; break;
	case CHK_MONEY:  /* Money is converted to silver... */
	    if ( lval_char != NULL ) 
		lval = lval_char->gold + (lval_char->silver * 100); break;
	case CHK_OBJVAL0:
            if ( lval_obj != NULL ) lval = lval_obj->value[0]; break;
        case CHK_OBJVAL1:
            if ( lval_obj != NULL ) lval = lval_obj->value[1]; break;
        case CHK_OBJVAL2: 
            if ( lval_obj != NULL ) lval = lval_obj->value[2]; break;
        case CHK_OBJVAL3:
            if ( lval_obj != NULL ) lval = lval_obj->value[3]; break;
	case CHK_OBJVAL4:
	    if ( lval_obj != NULL ) lval = lval_obj->value[4]; break;
	case CHK_GRPSIZE:
	    if( lval_char != NULL ) lval = count_people_room( lval_char, 4 ); break;
	default:
            return FALSE;
    }
    return( num_eval( lval, oper, rval ) );
}
Ejemplo n.º 24
0
void mobile_activity(void)
{
  struct char_data *ch, *next_ch, *vict;
  struct obj_data *obj, *best_obj;
  int door, found, max;
  memory_rec *names;

  for (ch = character_list; ch; ch = next_ch) {
    next_ch = ch->next;

    if (!IS_MOB(ch))
      continue;

    /* Examine call for special procedure */
    if (MOB_FLAGGED(ch, MOB_SPEC) && !no_specials) {
      if (mob_index[GET_MOB_RNUM(ch)].func == NULL) {
	log("SYSERR: %s (#%d): Attempting to call non-existing mob function.",
		GET_NAME(ch), GET_MOB_VNUM(ch));
	REMOVE_BIT_AR(MOB_FLAGS(ch), MOB_SPEC);
      } else {
        char actbuf[MAX_INPUT_LENGTH] = "";
	if ((mob_index[GET_MOB_RNUM(ch)].func) (ch, ch, 0, actbuf))
	  continue;		/* go to next char */
      }
    }

    /* If the mob has no specproc, do the default actions */
    if (FIGHTING(ch) || !AWAKE(ch))
      continue;

    /* hunt a victim, if applicable */
    hunt_victim(ch);

    /* Scavenger (picking up objects) */
    if (MOB_FLAGGED(ch, MOB_SCAVENGER))
      if (world[IN_ROOM(ch)].contents && !rand_number(0, 10)) {
	max = 1;
	best_obj = NULL;
	for (obj = world[IN_ROOM(ch)].contents; obj; obj = obj->next_content)
	  if (CAN_GET_OBJ(ch, obj) && GET_OBJ_COST(obj) > max) {
	    best_obj = obj;
	    max = GET_OBJ_COST(obj);
	  }
	if (best_obj != NULL) {
	  obj_from_room(best_obj);
	  obj_to_char(best_obj, ch);
	  act("$n gets $p.", FALSE, ch, best_obj, 0, TO_ROOM);
	}
      }

    /* Mob Movement */
    if (!MOB_FLAGGED(ch, MOB_SENTINEL) && (GET_POS(ch) == POS_STANDING) &&
       ((door = rand_number(0, 18)) < DIR_COUNT) && CAN_GO(ch, door) &&
       !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB) &&
       !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_DEATH) &&
       (!MOB_FLAGGED(ch, MOB_STAY_ZONE) ||
           (world[EXIT(ch, door)->to_room].zone == world[IN_ROOM(ch)].zone))) 
    {
      /* If the mob is charmed, do not move the mob. */
      if (ch->master == NULL)
        perform_move(ch, door, 1);
    }

    /* Aggressive Mobs */
     if (!MOB_FLAGGED(ch, MOB_HELPER) && (!AFF_FLAGGED(ch, AFF_BLIND) || !AFF_FLAGGED(ch, AFF_CHARM))) {
      found = FALSE;
      for (vict = world[IN_ROOM(ch)].people; vict && !found; vict = vict->next_in_room) {
	if (IS_NPC(vict) || !CAN_SEE(ch, vict) || PRF_FLAGGED(vict, PRF_NOHASSLE))
	  continue;

	if (MOB_FLAGGED(ch, MOB_WIMPY) && AWAKE(vict))
	  continue;

	if (MOB_FLAGGED(ch, MOB_AGGRESSIVE  ) ||
	   (MOB_FLAGGED(ch, MOB_AGGR_EVIL   ) && IS_EVIL(vict)) ||
	   (MOB_FLAGGED(ch, MOB_AGGR_NEUTRAL) && IS_NEUTRAL(vict)) ||
	   (MOB_FLAGGED(ch, MOB_AGGR_GOOD   ) && IS_GOOD(vict))) {

          /* Can a master successfully control the charmed monster? */
          if (aggressive_mob_on_a_leash(ch, ch->master, vict))
            continue;

	  hit(ch, vict, TYPE_UNDEFINED);
	  found = TRUE;
	}
      }
    }

    /* Mob Memory */
    if (MOB_FLAGGED(ch, MOB_MEMORY) && MEMORY(ch)) {
      found = FALSE;
      for (vict = world[IN_ROOM(ch)].people; vict && !found; vict = vict->next_in_room) {
	if (IS_NPC(vict) || !CAN_SEE(ch, vict) || PRF_FLAGGED(vict, PRF_NOHASSLE))
	  continue;

	for (names = MEMORY(ch); names && !found; names = names->next) {
	  if (names->id != GET_IDNUM(vict))
            continue;

          /* Can a master successfully control the charmed monster? */
          if (aggressive_mob_on_a_leash(ch, ch->master, vict))
            continue;

          found = TRUE;
          act("'Hey!  You're the fiend that attacked me!!!', exclaims $n.", FALSE, ch, 0, 0, TO_ROOM);
          hit(ch, vict, TYPE_UNDEFINED);
        }
      }
    }

    /* Charmed Mob Rebellion: In order to rebel, there need to be more charmed 
     * monsters than the person can feasibly control at a time.  Then the
     * mobiles have a chance based on the charisma of their leader.
     * 1-4 = 0, 5-7 = 1, 8-10 = 2, 11-13 = 3, 14-16 = 4, 17-19 = 5, etc. */
    if (AFF_FLAGGED(ch, AFF_CHARM) && ch->master && num_followers_charmed(ch->master) > (GET_CHA(ch->master) - 2) / 3) {
      if (!aggressive_mob_on_a_leash(ch, ch->master, ch->master)) {
        if (CAN_SEE(ch, ch->master) && !PRF_FLAGGED(ch->master, PRF_NOHASSLE))
          hit(ch, ch->master, TYPE_UNDEFINED);
        stop_follower(ch);
      }
    }

    /* Helper Mobs */
    if (MOB_FLAGGED(ch, MOB_HELPER) && (!AFF_FLAGGED(ch, AFF_BLIND) || !AFF_FLAGGED(ch, AFF_CHARM))) 
    {
      found = FALSE;
      for (vict = world[IN_ROOM(ch)].people; vict && !found; vict = vict->next_in_room) 
      {
	      if (ch == vict || !IS_NPC(vict) || !FIGHTING(vict))
          continue; 
	      if (IS_NPC(FIGHTING(vict)) || ch == FIGHTING(vict))
          continue;

	      act("$n jumps to the aid of $N!", FALSE, ch, 0, vict, TO_ROOM);
	      hit(ch, FIGHTING(vict), TYPE_UNDEFINED);
	      found = TRUE;
      }
    }

    /* Add new mobile actions here */

  }				/* end for() */
}
Ejemplo n.º 25
0
void mobile_activity(void)
{
  register struct char_data *ch, *next_ch, *vict;
  struct char_data *min_vict = NULL;
  struct obj_data *obj, *next_obj, *best_obj, *cont;
  int door, found, max, where;
  int casual, max_abil=0, curr_abil, gold;
  memory_rec *names;
  room_rnum target_room;

  extern int no_specials;
  ACMD(do_get);

  for (ch = character_list; ch; ch = next_ch) {
    next_ch = ch->next;
    
    if (!IS_MOB(ch))
      continue;
    
    //lance ripristina il master!
 	  if (IS_NPC(ch) && MOB_FLAGGED(ch, MOB_SAVE))
 		  chkmaster(ch);

    // Examine call for special procedure
    if (MOB_FLAGGED(ch, MOB_SPEC) && !no_specials) {
      if (mob_index[GET_MOB_RNUM(ch)].func == NULL) {
	      sprintf(buf, "SYSERR: %s (#%d): Attempting to call non-existing mob func", GET_NAME(ch), GET_MOB_VNUM(ch));
	      log(buf);
	      REMOVE_BIT(MOB_FLAGS(ch), MOB_SPEC);
      }
      else {
	      //(mob_index[GET_MOB_RNUM(ch)].func) (ch, ch, 0, "");
	      if ((mob_index[GET_MOB_RNUM(ch)].func) (ch, ch, 0, ""))
	        continue;	     /*  go to next char*/
      }
    }

// If the mob has no specproc, do the default actions
    if (FIGHTING(ch) || !AWAKE(ch))
      continue;

// Nuovo Scavenger (picking up objects) by Rusty 
    if (MOB_FLAGGED(ch, MOB_SCAVENGER))
	  if (world[ch->in_room].contents && (number(0, 10) > 5)) {
		  max = -1000;
		  best_obj = NULL;
		  for (obj = world[ch->in_room].contents; obj; obj = obj->next_content)
	  	if (CAN_GET_OBJ(ch, obj) && objlevel(obj) > max) {
			  best_obj = obj;
			  max = objlevel(obj);
			}
    
		  if (best_obj != NULL) {
			  obj_from_room(best_obj);
			  obj_to_char(best_obj, ch);
			  act("$n prende $p.", FALSE, ch, best_obj, 0, TO_ROOM);

// Orione, tolta la procedura che fa indossare l'eq raccolto ai mob scavenger
// Scavenger Plus:Mob wear the best object
/*
			  where=find_eq_pos(ch, best_obj, 0);
			  if (CAN_WEAR(best_obj, ITEM_WEAR_WIELD))
			    where=WEAR_WIELD;

			  if ( (where>0) && GET_EQ(ch,where)) {
				  // se ce l'ha gia!
				  if ((objlevel((ch)->equipment[where]))< objlevel(best_obj)) {
				    obj_to_char((obj=unequip_char(ch, where)), ch);
					  act("$n smette di usare $p.", FALSE, ch, obj, 0, TO_ROOM);
				  } 
				  else {
					  where = NUM_WEARS; // cioe' oggetto non indossabile
				  }

				  if (GET_LEVEL(ch)>=objlevel(best_obj)) {
					  if (where>=0 && where <NUM_WEARS) {
						  obj_from_char(best_obj);
						  equip_char(ch,best_obj,where);
						  wear_message(ch,best_obj,where);
					  }
				  }
			  }
*/
		  }
	  } //End ifif

// Mob BodyGuard !?       
    if (MOB_FLAGGED(ch, MOB_BGUARD) && (ch->master)) {
      if (   (FIGHTING(ch->master) && (npc_rescue(ch, ch->master) == FALSE))
	        || (ch->master && WHOKILLED(ch->master)) ) {
        act("$N Si schiera Prontamente al tuo fianco!", FALSE,ch->master, 0, ch, TO_CHAR);
	      act("$n Si schiera prontamente al fianco di $N", FALSE, ch, 0, ch->master, TO_ROOM);
	      if (WHOKILLED(ch->master))	
	        hit(ch, WHOKILLED(ch->master), TYPE_UNDEFINED);/*in ogni caso assiste*/
	      else
	        hit(ch, FIGHTING(ch->master), TYPE_UNDEFINED);/*in ogni caso assiste*/
	    }
     
      if (FIGHTING(ch)) {
	      npc_rescue(ch, ch->master);
		    if (WHOKILLED(ch->master))
		      hit(ch, WHOKILLED(ch->master), TYPE_UNDEFINED);  /*in ogni caso assiste*/
		    continue;
		  }	  
    }

//MOB_THIEF
    if (   MOB_FLAGGED(ch, MOB_CRIMINAL)  && (GET_POS(ch) == POS_RESTING)
        && IS_AFFECTED(ch, AFF_HIDE) && GET_HIT(ch) >= 2*GET_MAX_HIT(ch)/3) {
      appear(ch);
      GET_POS(ch)=POS_STANDING;
    }
    if (   MOB_FLAGGED(ch, MOB_CRIMINAL) 
        && ( GET_POS(ch) == POS_STANDING) 
        && ( (casual = number(0, 11)) < 6 ) ) {   // 50%  Rubare

      // cerca le vittime  1) Devono aver almeno 1 coin  
      //                   2) Deve aver una buona prob di farcela
      for (found=FALSE, min_vict = NULL, vict = world[ch->in_room].people; vict; vict = vict->next_in_room) {
	      if (CAN_SEE(ch, vict) && (vict != ch)) {
	        if ((min_vict == NULL) || (max_abil < 100)) {
	        //se ha il 100% tanto vale fermarsi
	        //Calcolo dell abilita:presa esattamente da D n'D

	          curr_abil = MIN(90, (10*(GET_LEVEL(ch)) - 5*GET_LEVEL(vict)));
	          curr_abil -=  dex_app[GET_DEX(vict)].reaction;
	          if (GET_POS(vict) < POS_STANDING)
	            curr_abil += 200;
	    // Se la vittima e' addormentata-stunned - incap o morta ovviamente
	    //  deruberai questa sicuramente

	          if (   (curr_abil >= 40) 
	              && (GET_GOLD(vict) != 0) 
	              && (curr_abil > max_abil) ) {
	            min_vict = vict;
	            max_abil = curr_abil;
	            found=TRUE;
	          }
	        }
	      }
      }
      // Se ha trovato la vittima
      if (found == TRUE) {
	      if ((casual = number(1, 100)) > max_abil) {
	        if (!IS_NPC(min_vict))
	          act(" $n cerca di prendere dei soldi dal tuo Borsello", FALSE, ch, 0, min_vict, TO_CHAR);
	        else {
	          act("Oops...", FALSE, ch, 0, min_vict, TO_ROOM);
	          act("$n cerca di rubare soldi a $N..Ma viene Scoperto! ", FALSE, ch, 0, min_vict, TO_ROOM);
	        }
	        
	        //Beccato ... fa 2 tentativi di fuga
	        if (((door = number(1, 7)) < NUM_OF_DIRS) && CAN_GO(ch, door) &&
	             !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB | ROOM_DEATH) )
	          perform_move(ch,door,1,CAN_SHOW_ROOM);
	        if ((door -= 1) < NUM_OF_DIRS && CAN_GO(ch, door) &&
	             !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB | ROOM_DEATH) )
	          perform_move(ch,door,1,CAN_SHOW_ROOM);
	        if ((door += 2) < NUM_OF_DIRS && CAN_GO(ch, door) &&
	             !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB | ROOM_DEATH) )
	          perform_move(ch,door,1,CAN_SHOW_ROOM);
	        
	        if (IS_NPC(min_vict)) {
	          act("$n Urla: $N e' uno sporco LADRO!!!!", FALSE, min_vict, 0, ch, TO_ROOM);
	          hit(min_vict, ch, TYPE_UNDEFINED);
	        }
	      }
	      // Il Bastardo ce la fa!
	      else {
	        if (GET_POS(min_vict) < 5) {
	          GET_GOLD(ch) += GET_GOLD(min_vict);
	          GET_GOLD(min_vict) = 0;    //la ripulisce completamente
	        }
	        else {
	          gold = number((GET_GOLD(min_vict) / 10), (GET_GOLD(min_vict) / 2));
	          //gold = MIN(5000, gold);
	          if (gold > 0) {
	            GET_GOLD(ch) += gold;
	            GET_GOLD(min_vict) -= gold;
	            if (GET_GOLD(min_vict) < 0)
	              GET_GOLD(min_vict) = 0;
	          }
	        }
	        // Dopo il furto si allontana
	        if (((door = number(1, 6)) < NUM_OF_DIRS) && CAN_GO(ch, door) &&
	           !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB | ROOM_DEATH) )
	          perform_move(ch,door,1,CAN_SHOW_ROOM);
	        if ((door -=1) < NUM_OF_DIRS && CAN_GO(ch, door) &&
	           !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB | ROOM_DEATH) )
	          perform_move(ch,door,1,CAN_SHOW_ROOM);
	        if ((door +=2) < NUM_OF_DIRS && CAN_GO(ch, door) &&
	           !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB | ROOM_DEATH) )
	          perform_move(ch,door,1,CAN_SHOW_ROOM);
	      }
      }
      else { // Nessuna vittima appetibile:se ne va!
	      
	      if (((door = number(0, 6)) < NUM_OF_DIRS) && CAN_GO(ch, door) &&
	          !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB | ROOM_DEATH) )
	        perform_move(ch, door, 1, CAN_SHOW_ROOM);
      }
    }

// Mob Sciacalli indossano EQ    
    if (MOB_FLAGGED(ch, MOB_NECRO) && !FIGHTING(ch) && AWAKE(ch))
    if (world[ch->in_room].contents) {
	    max = -1000;
	    best_obj=NULL;
	    for (cont = world[ch->in_room].contents;cont;cont = cont->next_content)
	    if (GET_OBJ_TYPE(cont) == ITEM_CONTAINER) {
	      for (obj = cont->contains; obj; obj = next_obj) {
		      next_obj = obj->next_content;
		      if (obj != NULL) {
		        if (CAN_SEE_OBJ(ch, obj) && ( (max = objlevel(obj)) <= GET_LEVEL(ch)) ) {
		          perform_get_from_container(ch, obj, cont, FIND_OBJ_INV);
		          if (obj != NULL) {
		            where = find_eq_pos(ch, obj, 0);
		            if (CAN_WEAR(obj, ITEM_WEAR_HOLD))
			            where = WEAR_HOLD;
		            if (GET_OBJ_TYPE(obj)==ITEM_LIGHT)
			            where = WEAR_LIGHT;
		            if (CAN_WEAR(obj, ITEM_WEAR_WIELD))
			            where = WEAR_WIELD;
		            if (where < 0) {
			            sprintf(buf,"SYSERR:pos < 0 ,in cont %s obj %d %s In room %d", 
			                        cont->name, 
			                        GET_OBJ_RNUM(obj), 
			                        obj->name, 
			                        IN_ROOM(ch));
			            log(buf);
			            where = NUM_WEARS;
		            }
		            
		            if (GET_EQ(ch, where) && where < NUM_WEARS) {
			            if ((objlevel((ch)->equipment[where])) < objlevel(obj)) {
			              obj_to_char((best_obj = unequip_char(ch, where)), ch);
			              act("$n smette di usare $p.",FALSE, ch, best_obj, 0, TO_ROOM);
			            }
			            else
			              where = NUM_WEARS;
		            }
		            if (where >= 0 && where < NUM_WEARS) {
			            wear_message(ch, obj, where);
			            obj_from_char(obj);
			            equip_char(ch, obj, where);
		            }
		          }
		        }
		      }
	      }
	    } //End forif
	  } //End ifif

// Mob Movement
    if (HUNTING(ch)) 
      hunt_victim(ch);
    else {
	    if (MOB_FLAGGED(ch , MOB_SEARCHER)) {}
 	    else {
        if (ch->in_room != NOWHERE) {
          if (!IS_IN_WILD(ch)) {
            if (   !MOB_FLAGGED(ch, MOB_SENTINEL) 
                && (GET_POS(ch) == POS_STANDING) 
                && (   (door = number(0, 8)) < NUM_OF_DIRS) 
                    && CAN_GO(ch, door) 
                    && !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB | ROOM_DEATH) 
                    && (   !MOB_FLAGGED(ch, MOB_STAY_ZONE) 
                        || (world[EXIT(ch, door)->to_room].zone == world[ch->in_room].zone))) {
              perform_move(ch, door, 1, CAN_SHOW_ROOM);
            }
          }
          else {  // E' in wilderness
            if (MOB_FLAGGED(ch, MOB_WILDHUNT)) 
              door = wild_mobhunter(ch);
            else 
              door = number(0, 8);
            
            if (door >= 0 && door < NUM_OF_DIRS) 
              target_room = wild_target_room(ch, door);
            else 
              target_room = -1;
            
            if (   !MOB_FLAGGED(ch, MOB_SENTINEL) 
                && (GET_POS(ch) == POS_STANDING) 
                && (target_room != -1) 
                && (   !MOB_FLAGGED(ch, MOB_STAY_ZONE) 
                    || (world[target_room].wild_rnum == world[ch->in_room].wild_rnum))) {
              perform_move(ch, door, 1, CAN_SHOW_ROOM);
            }
          }
        }	
      }
    }

// Aggressive Mobs
    if (MOB_FLAGGED(ch, MOB_AGGRESSIVE | MOB_AGGR_TO_ALIGN)) {
      found = FALSE;
      for (vict = world[ch->in_room].people; vict && !found; vict = vict->next_in_room) {
	      if (IS_NPC(vict) || !CAN_SEE(ch, vict) || PRF_FLAGGED(vict, PRF_NOHASSLE))
	        continue;
	      if (number(0, 3) < 2)
	        continue; // Simple simulate Random a Joke from Phantom ;P
	      if (GET_ABIL (vict, ABIL_TRATTATIVA) >= EXPERT_LIV)
	        continue; // I pg con trattativa ad esperto fanno pace con gli aggressivi (by Spini)
	      if (controllo_volo(ch, vict))
		continue;
	      if (affected_by_spell (vict, SPELLSKILL, DISEASE_PESTE))
		continue;

	      if (MOB_FLAGGED(ch, MOB_AGGR_NO_PROP) && (MASTER_ID(ch)==GET_IDNUM(vict)))
	        continue;
	      if (MOB_FLAGGED(ch, MOB_AGGR_NO_CLAN) && (CLAN_ID(ch)==GET_CLAN(vict)))
	        continue;
	      if (MOB_FLAGGED(ch, MOB_AGGR_NO_AL_CLAN) && (GET_CLAN_DIPLO(GET_CLAN(ch),GET_CLAN(vict)) == ALLIANCE))
	        continue;
	      if (MOB_FLAGGED(ch, MOB_AGGR_NO_EN_CLAN) && (GET_CLAN_DIPLO(GET_CLAN(ch),GET_CLAN(vict)) == WAR))
	        continue;
	      if (MOB_FLAGGED(ch, MOB_AGGR_NO_PC_CLAN) && (GET_CLAN_DIPLO(GET_CLAN(ch),GET_CLAN(vict)) == PEACE))
	        continue;
	      if (MOB_FLAGGED(ch, MOB_AGGR_VAS_CLAN) && (GET_CLAN_DIPLO(GET_CLAN(ch),GET_CLAN(vict)) == VASSALLO))
	  	    continue;

        if (   !MOB_FLAGGED(ch, MOB_AGGR_TO_ALIGN) 
            || (MOB_FLAGGED(ch, MOB_AGGR_EVIL) && IS_EVIL(vict)) 
            || (MOB_FLAGGED(ch, MOB_AGGR_NEUTRAL) && IS_NEUTRAL(vict)) 
            || (MOB_FLAGGED(ch, MOB_AGGR_GOOD) && IS_GOOD(vict)) ) {
	        if (GET_MOB_SPEC(ch)== thief)
	          npc_backstab(ch,vict);
	        else
	          hit(ch, vict, TYPE_UNDEFINED);
	        found = TRUE;
	      }
      }
    }

// Mob Memory
    if (MOB_FLAGGED(ch, MOB_MEMORY) && MEMORY(ch)) {
      found = FALSE;
      for (vict = world[ch->in_room].people; vict && !found; vict = vict->next_in_room) {
        if (!CAN_SEE(ch, vict) || PRF_FLAGGED(vict, PRF_NOHASSLE))
          continue;
        for (names = MEMORY(ch); names && !found; names = names->next)
        if (names->id == GET_IDNUM(vict)) {
          found = TRUE;
          act("$n esclama, 'Hey!! Tu sei il tipo che mi ha attaccato!!!'", FALSE, ch, 0, 0, TO_ROOM);
          hit(ch, vict, TYPE_UNDEFINED);
        } //End forif
      }
    }

// Helper Mobs Paladino del bene
    if (   MOB_FLAGGED(ch, MOB_HELPER)
        && !MOB_FLAGGED(ch, MOB_CRIMINALHELPER) ) {
      found = FALSE;
      for (vict = world[ch->in_room].people; vict && !found; vict = vict->next_in_room)
      if (   ch != vict 
          && IS_NPC(vict) 
          && FIGHTING(vict) 
          && !IS_NPC(FIGHTING(vict)) 
          && ch != FIGHTING(vict) ) {			
        if (   MOB_FLAGGED(vict, MOB_CRIMINAL)
            || (   (ch->master)
                && (FIGHTING(vict) == ch->master) ) ) {
	        hit(ch, vict, TYPE_UNDEFINED);
	        found = TRUE;
	      } 		
	      else { 
	        act("$n arriva in aiuto di $N!", FALSE, ch, 0, vict, TO_ROOM);
	        hit(ch, FIGHTING(vict), TYPE_UNDEFINED);
	        found = TRUE;
	      }
	    } //End forif
    }
	
// Helper Mobs Servo del male
    if (   MOB_FLAGGED(ch, MOB_CRIMINALHELPER)
        && !MOB_FLAGGED(ch, MOB_HELPER) ) {
      found = FALSE;
      for (vict = world[ch->in_room].people; vict && !found; vict = vict->next_in_room)
      if (   ch != vict 
          && IS_NPC(vict) 
          && FIGHTING(vict) 
          && !IS_NPC(FIGHTING(vict)) 
          && ch != FIGHTING(vict) ) {			
        if (   MOB_FLAGGED(vict, MOB_CRIMINAL)
            || (   (ch->master) 
                && (vict == ch->master) ) ) {
          act("$n arriva in aiuto di $N!", FALSE, ch, 0, vict, TO_ROOM);
          hit(ch, FIGHTING(vict), TYPE_UNDEFINED);
          found = TRUE;
        }
      } //End forif
    }
	
// Add new mobile actions here

  }				// end for()
}
Ejemplo n.º 26
0
bool check_social( CHAR_DATA * ch, const char *command, const char *argument )
{
   char arg[MAX_INPUT_LENGTH];
   CHAR_DATA *victim, *victim_next;
   SOCIALTYPE *social;
   CHAR_DATA *removed[128];   /* What are the chances of more than 128? */
   ROOM_INDEX_DATA *room;
   int i = 0, k = 0;

   if( ( social = find_social( command ) ) == NULL )
      return FALSE;

   if( !IS_NPC( ch ) && xIS_SET( ch->act, PLR_NO_EMOTE ) )
   {
      send_to_char( "You are anti-social!\r\n", ch );
      return TRUE;
   }

   switch ( ch->position )
   {
      case POS_DEAD:
         send_to_char( "Lie still; you are DEAD.\r\n", ch );
         return TRUE;

      case POS_INCAP:
      case POS_MORTAL:
         send_to_char( "You are hurt far too bad for that.\r\n", ch );
         return TRUE;

      case POS_STUNNED:
         send_to_char( "You are too stunned to do that.\r\n", ch );
         return TRUE;

      case POS_SLEEPING:
         /*
          * I just know this is the path to a 12" 'if' statement.  :(
          * But two players asked for it already!  -- Furey
          */
         if( !str_cmp( social->name, "snore" ) )
            break;
         send_to_char( "In your dreams, or what?\r\n", ch );
         return TRUE;
   }

   /*
    * Search room for chars ignoring social sender and 
    * remove them from the room until social has been  
    * completed              
    */
   room = ch->in_room;
   for( victim = ch->in_room->first_person; victim; victim = victim_next )
   {
      if( i == 127 )
         break;
      victim_next = victim->next_in_room;
      if( is_ignoring( victim, ch ) )
      {
         if( !IS_IMMORTAL( ch ) || get_trust( victim ) > get_trust( ch ) )
         {
            removed[i] = victim;
            i++;
            UNLINK( victim, room->first_person, room->last_person, next_in_room, prev_in_room );
         }
         else
         {
            set_char_color( AT_IGNORE, victim );
            ch_printf( victim, "You attempt to ignore %s," " but are unable to do so.\r\n", ch->name );
         }
      }
   }

   one_argument( argument, arg );
   victim = NULL;
   if( arg[0] == '\0' )
   {
      act( AT_SOCIAL, social->others_no_arg, ch, NULL, victim, TO_ROOM );
      act( AT_SOCIAL, social->char_no_arg, ch, NULL, victim, TO_CHAR );
   }
   else if( ( victim = get_char_room( ch, arg ) ) == NULL )
   {
      /*
       * If they aren't in the room, they may be in the list of 
       * people ignoring...                 
       */
      if( i != 0 )
      {
         for( k = 0, victim = removed[0]; k < i; k++, victim = removed[k] )
         {
            if( nifty_is_name( victim->name, arg ) || nifty_is_name_prefix( arg, victim->name ) )
            {
               set_char_color( AT_IGNORE, ch );
               ch_printf( ch, "%s is ignoring you.\r\n", victim->name );
               break;
            }
         }
      }

      if( !victim )
         send_to_char( "They aren't here.\r\n", ch );
   }
   else if( victim == ch )
   {
      act( AT_SOCIAL, social->others_auto, ch, NULL, victim, TO_ROOM );
      act( AT_SOCIAL, social->char_auto, ch, NULL, victim, TO_CHAR );
   }
   else
   {
      act( AT_SOCIAL, social->others_found, ch, NULL, victim, TO_NOTVICT );
      act( AT_SOCIAL, social->char_found, ch, NULL, victim, TO_CHAR );
      act( AT_SOCIAL, social->vict_found, ch, NULL, victim, TO_VICT );

      if( !IS_NPC( ch ) && IS_NPC( victim )
          && !IS_AFFECTED( victim, AFF_CHARM ) && IS_AWAKE( victim ) && !HAS_PROG( victim->pIndexData, ACT_PROG ) )
      {
         switch ( number_bits( 4 ) )
         {
            case 0:
               if( IS_EVIL( ch ) && !is_safe( victim, ch, TRUE ) )   /* was IS_EVIL(ch) ||.... didn't make sense to me - FB */
                     multi_hit( victim, ch, TYPE_UNDEFINED );
               else if( IS_NEUTRAL( ch ) )
               {
                  act( AT_ACTION, "$n slaps $N.", victim, NULL, ch, TO_NOTVICT );
                  act( AT_ACTION, "You slap $N.", victim, NULL, ch, TO_CHAR );
                  act( AT_ACTION, "$n slaps you.", victim, NULL, ch, TO_VICT );
               }
               else
               {
                  act( AT_ACTION, "$n acts like $N doesn't even exist.", victim, NULL, ch, TO_NOTVICT );
                  act( AT_ACTION, "You just ignore $N.", victim, NULL, ch, TO_CHAR );
                  act( AT_ACTION, "$n appears to be ignoring you.", victim, NULL, ch, TO_VICT );
               }
               break;

            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            case 8:
               act( AT_SOCIAL, social->others_found, victim, NULL, ch, TO_NOTVICT );
               act( AT_SOCIAL, social->char_found, victim, NULL, ch, TO_CHAR );
               act( AT_SOCIAL, social->vict_found, victim, NULL, ch, TO_VICT );
               break;

            case 9:
            case 10:
            case 11:
            case 12:
               act( AT_ACTION, "$n slaps $N.", victim, NULL, ch, TO_NOTVICT );
               act( AT_ACTION, "You slap $N.", victim, NULL, ch, TO_CHAR );
               act( AT_ACTION, "$n slaps you.", victim, NULL, ch, TO_VICT );
               break;
         }
      }
   }

   /*
    * Replace the chars in the ignoring list to the room 
    * note that the ordering of the players in the room  
    * might change                
    */
   if( i != 0 )
   {
      for( k = 0, victim = removed[0]; k < i; k++, victim = removed[k] )
      {
         LINK( victim, room->first_person, room->last_person, next_in_room, prev_in_room );
      }
   }

   return TRUE;
}
Ejemplo n.º 27
0
int magic_user(struct char_data *ch, int cmd, char *arg)
{
	struct char_data *vict;

	if(cmd) return FALSE;

	if(GET_POS(ch)!=POSITION_FIGHTING) return FALSE;
	
	if(!ch->specials.fighting) return FALSE;


	/* Find a dude to do evil things upon ! */

	for (vict = world[ch->in_room].people; vict; vict = vict->next_in_room )
		if (vict->specials.fighting==ch && number(0,2)==0)
			break;

	if (!vict)
		return FALSE;


	if( (vict!=ch->specials.fighting) && (GET_LEVEL(ch)>13) && (number(0,7)==0) )
	{
		act("$n utters the words 'dilan oso'.", 1, ch, 0, 0, TO_ROOM);
		cast_sleep(GET_LEVEL(ch), ch, "", SPELL_TYPE_SPELL, vict, 0);
		return TRUE;
	}

	if( (GET_LEVEL(ch)>12) && (number(0,6)==0) )
	{
		act("$n utters the words 'gharia miwi'.", 1, ch, 0, 0, TO_ROOM);
		cast_curse(GET_LEVEL(ch), ch, "", SPELL_TYPE_SPELL, vict, 0);
		return TRUE;
	}

	if( (GET_LEVEL(ch)>7) && (number(0,5)==0) )
	{
		act("$n utters the words 'koholian dia'.", 1, ch, 0, 0, TO_ROOM);
		cast_blindness(GET_LEVEL(ch), ch, "", SPELL_TYPE_SPELL, vict, 0);
		return TRUE;
	}

	if( (GET_LEVEL(ch)>12) && (number(0,8)==0) && IS_EVIL(ch))
	{
		act("$n utters the words 'ib er dranker'.", 1, ch, 0, 0, TO_ROOM);
		cast_energy_drain(GET_LEVEL(ch), ch, "", SPELL_TYPE_SPELL, vict, 0);
		return TRUE;
	}

	switch (GET_LEVEL(ch)) {
		case 1:
		case 2:
		case 3:
		case 4:
			act("$n utters the words 'hahili duvini'.", 1, ch, 0, 0, TO_ROOM);
			cast_magic_missile(GET_LEVEL(ch), ch, "", SPELL_TYPE_SPELL, vict, 0);
			break;
		case 5:
		case 6:
		case 7:
		case 8:
			act("$n utters the words 'grynt oef'.", 1, ch, 0, 0, TO_ROOM);
			cast_burning_hands(GET_LEVEL(ch), ch, "", SPELL_TYPE_SPELL, vict, 0);
			break;
		case 9:
		case 10:
			act("$n utters the words 'sjulk divi'.", 1, ch, 0, 0, TO_ROOM);
			cast_lightning_bolt(GET_LEVEL(ch), ch, "", SPELL_TYPE_SPELL, vict, 0);
			break;
		case 11:
		case 12:
		case 13:
		case 14:
			act("$n utters the words 'nasson hof'.", 1, ch, 0, 0, TO_ROOM);
			cast_colour_spray(GET_LEVEL(ch), ch, "", SPELL_TYPE_SPELL, vict, 0);
			break;
		default:
			act("$n utters the words 'tuborg'.", 1, ch, 0, 0, TO_ROOM);
			cast_fireball(GET_LEVEL(ch), ch, "", SPELL_TYPE_SPELL, vict, 0);
			break;
	}
	return TRUE;
}