Exemplo n.º 1
0
static void AddSpirit(OBJ_DATA & obj)
{
    static const char * adjectives[] = {"holy", "righteous", "smiting"};
    AddSphereEffect(obj, Forge::Trait_Spirit, ADJECTIVE);
    if (number_bits(2) == 0) SET_BIT(obj.extra_flags[0], ITEM_BLESS);
    if (number_bits(2) == 0) SET_BIT(obj.extra_flags[0], ITEM_GLOW);
    obj.value[3] = DAM_HOLY;
}
Exemplo n.º 2
0
static void AddFire(OBJ_DATA & obj)
{
    static const char * adjectives[] = {"flaming", "burning", "scorching"};
    AddSphereEffect(obj, Forge::Trait_Fire, ADJECTIVE);
    if (number_bits(2) == 0) SET_BIT(obj.extra_flags[0], ITEM_GLOW);
    if (number_bits(2) == 0) SET_BIT(obj.extra_flags[0], ITEM_WARM);
    obj.value[3] = DAM_FIRE;
}
Exemplo n.º 3
0
bool spec_cast_adept( CHAR_DATA *ch )
{
    CHAR_DATA *victim;
    CHAR_DATA *v_next;

    if ( !IS_AWAKE(ch) )
	return FALSE;

    for ( victim = ch->in_room->people; victim != NULL; victim = v_next )
    {
	v_next = victim->next_in_room;
	if ( victim != ch && can_see( ch, victim ) && number_bits( 1 ) == 0 )
	    break;
    }

    if ( victim == NULL )
	return FALSE;

    switch ( number_bits( 3 ) )
    {
    case 0:
	act( "$n utters the word 'tehctah'.", ch, NULL, NULL, TO_ROOM );
	spell_armor( skill_lookup( "armor" ), ch->level, ch, victim );
	return TRUE;

    case 1:
	act( "$n utters the word 'nhak'.", ch, NULL, NULL, TO_ROOM );
	spell_bless( skill_lookup( "bless" ), ch->level, ch, victim );
	return TRUE;

    case 2:
	act( "$n utters the word 'yeruf'.", ch, NULL, NULL, TO_ROOM );
	spell_cure_blindness( skill_lookup( "cure blindness" ),
	    ch->level, ch, victim );
	return TRUE;

    case 3:
	act( "$n utters the word 'garf'.", ch, NULL, NULL, TO_ROOM );
	spell_cure_light( skill_lookup( "cure light" ),
	    ch->level, ch, victim );
	return TRUE;

    case 4:
	act( "$n utters the words 'rozar'.", ch, NULL, NULL, TO_ROOM );
	spell_cure_poison( skill_lookup( "cure poison" ),
	    ch->level, ch, victim );
	return TRUE;

    case 5:
	act( "$n utters the words 'nadroj'.", ch, NULL, NULL, TO_ROOM );
	spell_refresh( skill_lookup( "refresh" ), ch->level, ch, victim );
	return TRUE;

    }

    return FALSE;
}
Exemplo n.º 4
0
bool spec_cast_cleric( CHAR_DATA *ch )
{
    CHAR_DATA *victim;
    CHAR_DATA *v_next;
    char *spell;
    int sn;

    summon_if_hating( ch );

    if ( ch->position != POS_FIGHTING
       && ch->position !=  POS_EVASIVE
       && ch->position !=  POS_DEFENSIVE
       && ch->position !=  POS_AGGRESSIVE
       && ch->position !=  POS_BERSERK
    )
	return FALSE;

    for ( victim = ch->in_room->first_person; victim; victim = v_next )
    {
	v_next = victim->next_in_room;
	if ( who_fighting( victim ) == ch && number_bits( 2 ) == 0 )
	    break;
    }

    if ( !victim || victim == ch )
	return FALSE;

    for ( ;; )
    {
	int min_level;

	switch ( number_bits( 4 ) )
	{
	case  0: min_level =  0; spell = "cause light";    break;
	case  1: min_level =  3; spell = "cause serious";  break;
	case  2: min_level =  6; spell = "earthquake";     break;
	case  3: min_level =  7; spell = "blindness";	   break;
	case  4: min_level =  9; spell = "cause critical"; break;
	case  5: min_level = 10; spell = "dispel evil";    break;
	case  6: min_level = 12; spell = "curse";          break;
	case  7: min_level = 13; spell = "flamestrike";    break;
	case  8: 
	case  9:
	case 10: min_level = 15; spell = "harm";           break;
	default: min_level = 16; spell = "dispel magic";   break;
	}

	if ( ch->level >= min_level )
	    break;
    }

    if ( ( sn = skill_lookup( spell ) ) < 0 )
	return FALSE;
    (*skill_table[sn]->spell_fun) ( sn, ch->level, ch, victim );
    return TRUE;
}
Exemplo n.º 5
0
static void AddVoid(OBJ_DATA & obj)
{
    static const char * adjectives[] = {"unholy", "grim"};
    AddSphereEffect(obj, Forge::Trait_Void, ADJECTIVE);
    if (number_bits(2) == 0) SET_BIT(obj.extra_flags[0], ITEM_EVIL);
    if (number_bits(2) == 0) SET_BIT(obj.extra_flags[0], ITEM_DARK);

    if (obj.value[3] == DAM_NEGATIVE) obj.value[3] = DAM_DEFILEMENT;
    else obj.value[3] = DAM_NEGATIVE;
}
Exemplo n.º 6
0
bool spec_cast_mage( CHAR_DATA *ch )
{
    CHAR_DATA *victim;
    CHAR_DATA *v_next;
    char *spell;
    int sn;

    summon_if_hating( ch );

    if ( ch->position != POS_FIGHTING
       && ch->position !=  POS_EVASIVE
       && ch->position !=  POS_DEFENSIVE
       && ch->position !=  POS_AGGRESSIVE
       && ch->position !=  POS_BERSERK
    )
	return FALSE;

    for ( victim = ch->in_room->first_person; victim; victim = v_next )
    {
	v_next = victim->next_in_room;
	if ( who_fighting( victim ) && number_bits( 2 ) == 0 )
	    break;
    }

    if ( !victim || victim == ch )
	return FALSE;

    for ( ;; )
    {
	int min_level;

	switch ( number_bits( 4 ) )
	{
	case  0: min_level =  0; spell = "black hand";	   break;
	case  1: min_level =  3; spell = "chill touch";    break;
	case  2: min_level =  7; spell = "weaken";         break;
	case  3: min_level =  8; spell = "galvanic whip";  break;
	case  4: min_level = 11; spell = "colour spray";   break;
	case  5: min_level = 12; spell = "weaken";	   break;
	case  6: min_level = 13; spell = "energy drain";   break;
	case  7: min_level = 14; spell = "spectral furor"; break;
	case  8:
	case  9: min_level = 15; spell = "fireball";       break;
	default: min_level = 20; spell = "acid blast";     break;
	}

	if ( ch->level >= min_level )
	    break;
    }

    if ( ( sn = skill_lookup( spell ) ) < 0 )
	return FALSE;
    (*skill_table[sn]->spell_fun) ( sn, ch->level, ch, victim );
    return TRUE;
}
Exemplo n.º 7
0
bool spec_cast_undead( CHAR_DATA *ch )
{
    CHAR_DATA *victim;
    CHAR_DATA *v_next;
    char *spell;
    int sn;

    summon_if_hating( ch );

    if ( ch->position != POS_FIGHTING
       && ch->position !=  POS_EVASIVE
       && ch->position !=  POS_DEFENSIVE
       && ch->position !=  POS_AGGRESSIVE
       && ch->position !=  POS_BERSERK
    )
	return FALSE;

    for ( victim = ch->in_room->first_person; victim; victim = v_next )
    {
	v_next = victim->next_in_room;
	if ( who_fighting( victim ) == ch && number_bits( 2 ) == 0 )
	    break;
    }

    if ( !victim || victim == ch )
	return FALSE;

    for ( ;; )
    {
	int min_level;

	switch ( number_bits( 4 ) )
	{
	case  0: min_level =  0; spell = "chill touch";    break;
	case  1: min_level = 11; spell = "weaken";         break;
	case  2: min_level = 12; spell = "curse";          break;
	case  3: min_level = 13; spell = "blindness";      break;
	case  4: min_level = 14; spell = "poison";         break;
	case  5: min_level = 15; spell = "energy drain";   break;
	case  6: min_level = 18; spell = "harm";           break;
	default: min_level = 40; spell = "gate";           break;
	}

	if ( ch->level >= min_level )
	    break;
    }

    if ( ( sn = skill_lookup( spell ) ) < 0 )
	return FALSE;
    (*skill_table[sn]->spell_fun) ( sn, ch->level, ch, victim );
    return TRUE;
}
Exemplo n.º 8
0
bool spec_jedi_healer( CHAR_DATA * ch )
{
   CHAR_DATA *victim;
   CHAR_DATA *v_next;

   if( !IS_AWAKE( ch ) )
      return FALSE;

   for( victim = ch->in_room->first_person; victim; victim = v_next )
   {
      v_next = victim->next_in_room;
      if( victim != ch && can_see( ch, victim ) && number_bits( 1 ) == 0 )
         break;
   }

   if( !victim )
      return FALSE;

   switch ( number_bits( 12 ) )
   {
      case 0:
         act( AT_MAGIC, "$n pauses and concentrates for a moment.", ch, NULL, NULL, TO_ROOM );
         spell_smaug( skill_lookup( "armor" ), ch->top_level, ch, victim );
         return TRUE;

      case 1:
         act( AT_MAGIC, "$n pauses and concentrates for a moment.", ch, NULL, NULL, TO_ROOM );
         spell_smaug( skill_lookup( "good fortune" ), ch->top_level, ch, victim );
         return TRUE;

      case 2:
         act( AT_MAGIC, "$n pauses and concentrates for a moment.", ch, NULL, NULL, TO_ROOM );
         spell_cure_blindness( skill_lookup( "cure blindness" ), ch->top_level, ch, victim );
         return TRUE;

      case 3:
         act( AT_MAGIC, "$n pauses and concentrates for a moment.", ch, NULL, NULL, TO_ROOM );
         spell_smaug( skill_lookup( "cure light" ), ch->top_level, ch, victim );
         return TRUE;

      case 4:
         act( AT_MAGIC, "$n pauses and concentrates for a moment.", ch, NULL, NULL, TO_ROOM );
         spell_cure_poison( skill_lookup( "cure poison" ), ch->top_level, ch, victim );
         return TRUE;

      case 5:
         act( AT_MAGIC, "$n pauses and concentrates for a moment.", ch, NULL, NULL, TO_ROOM );
         spell_smaug( skill_lookup( "refresh" ), ch->top_level, ch, victim );
         return TRUE;
   }
   return FALSE;
}
Exemplo n.º 9
0
bool spec_cast_cleric( CHAR_DATA *ch )
{
	CHAR_DATA *victim;
	CHAR_DATA *v_next;
	char *spell;
	int sn;

	if ( ch->position != POS_FIGHTING )
		return FALSE;

	for ( victim = ch->in_room->people; victim != NULL; victim = v_next )
	{
		v_next = victim->next_in_room;
		if ( victim->fighting == ch && number_bits( 2 ) == 0 )
			break;
	}

	if ( victim == NULL )
		return FALSE;

	for ( ;; )
	{
		int min_level;

		switch ( number_bits( 4 ) )
		{
			case  0: min_level =  0; spell = "blindness";      break;
			case  1: min_level =  3; spell = "cause serious";  break;
			case  2: min_level =  7; spell = "earthquake";     break;
			case  3: min_level =  9; spell = "cause critical"; break;
			case  4: min_level = 10; spell = "dispel evil";    break;
			case  5: min_level = 12; spell = "curse";          break;
			case  6: min_level = 12; spell = "change sex";     break;
			case  7: min_level = 13; spell = "flamestrike";    break;
			case  8:
			case  9:
			case 10: min_level = 15; spell = "harm";           break;
			case 11: min_level = 15; spell = "plague";	   break;
			default: min_level = 16; spell = "dispel magic";   break;
		}

		if ( ch->level >= min_level )
			break;
	}

	if ( ( sn = skill_lookup( spell ) ) < 0 )
		return FALSE;
	(*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim,TARGET_CHAR);
	return TRUE;
}
Exemplo n.º 10
0
bool spec_cast_mage( CHAR_DATA *ch )
{
	CHAR_DATA *victim;
	CHAR_DATA *v_next;
	char *spell;
	int sn;

	if ( ch->position != POS_FIGHTING )
		return FALSE;

	for ( victim = ch->in_room->people; victim != NULL; victim = v_next )
	{
		v_next = victim->next_in_room;
		if ( victim->fighting == ch && number_bits( 2 ) == 0 )
			break;
	}

	if ( victim == NULL )
		return FALSE;

	for ( ;; )
	{
		int min_level;

		switch ( number_bits( 4 ) )
		{
			case  0: min_level =  0; spell = "blindness";      break;
			case  1: min_level =  3; spell = "chill touch";    break;
			case  2: min_level =  7; spell = "weaken";         break;
			case  3: min_level =  8; spell = "teleport";       break;
			case  4: min_level = 11; spell = "colour spray";   break;
			case  5: min_level = 12; spell = "change sex";     break;
			case  6: min_level = 13; spell = "energy drain";   break;
			case  7:
			case  8:
			case  9: min_level = 15; spell = "fireball";       break;
			case 10: min_level = 20; spell = "plague";	   break;
			default: min_level = 20; spell = "acid blast";     break;
		}

		if ( ch->level >= min_level )
			break;
	}

	if ( ( sn = skill_lookup( spell ) ) < 0 )
		return FALSE;
	(*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim,TARGET_CHAR);
	return TRUE;
}
Exemplo n.º 11
0
bool spec_cast_judge( CHAR_DATA *ch )
{
	CHAR_DATA *victim;
	CHAR_DATA *v_next;
	char *spell;
	int sn;
 
	if ( ch->position != POS_FIGHTING )
		return FALSE;
 
	for ( victim = ch->in_room->people; victim != NULL; victim = v_next )
	{
		v_next = victim->next_in_room;
		if ( victim->fighting == ch && number_bits( 2 ) == 0 )
			break;
	}
 
	if ( victim == NULL )
		return FALSE;
 
	spell = "high explosive";
	if ( ( sn = skill_lookup( spell ) ) < 0 )
		return FALSE;
	(*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim,TARGET_CHAR);
	return TRUE;
}
Exemplo n.º 12
0
SPEC_RET spec_breath_any( CHAR_DATA *ch )
{
	if ( ch->position != POSITION_FIGHT
	  && ch->position != POSITION_EVASIVE
	  && ch->position != POSITION_DEFENSIVE
	  && ch->position != POSITION_AGGRESSIVE
	  && ch->position != POSITION_BERSERK )
	{
		return FALSE;
	}

	switch ( number_bits(3) )
	{
	  case 0:	return spec_breath_fire		( ch );
	  case 1:
	  case 2:	return spec_breath_lightning( ch );
	  case 3:	return spec_breath_gas		( ch );
	  case 4:	return spec_breath_acid		( ch );
	  case 5:
	  case 6:
	  case 7:	return spec_breath_frost	( ch );
	}

	return FALSE;
}
Exemplo n.º 13
0
void
objfun_sword_aggro(OBJ_DATA *obj, CHAR_DATA *keeper)
{
    /* Weapon 'draws' an aggro mob's attention to the player */
    /* If fighting,  make cast spells? */
    CHAR_DATA          *vch;

    if (obj->item_type != ITEM_WEAPON)
        return;
    if ((keeper == NULL) || (obj == NULL))
        return;

    if ((get_eq_char(keeper, WEAR_WIELD) != obj)
        && (get_eq_char(keeper, WEAR_WIELD_2) != obj))
        return;
    if (keeper == NULL || keeper->fighting == NULL)
        return;

    for (vch = keeper->in_room->first_person; vch != NULL; vch = vch->next_in_room) {
        if (IS_NPC(vch)
            && (vch->level > keeper->level)
            && IS_SET(vch->act, ACT_AGGRESSIVE)
            && vch->fighting == NULL && number_bits(4) == 0) {
            act("$p carried by $n glows in $s hands.", keeper, obj, NULL, TO_ROOM);
            act("$p carried by you glows in your hands.", keeper, obj, NULL, TO_CHAR);
            act("$p says 'LOOK! LOOK!  $n is here!!'", keeper, obj, NULL, TO_ROOM);
            act("$p says 'LOOK! LOOK!  $n is here!!'", keeper, obj, NULL, TO_CHAR);
            multi_hit(vch, keeper, TYPE_UNDEFINED);
            break;
        }
    }
    return;
}
Exemplo n.º 14
0
static void AddAir(OBJ_DATA & obj)
{
    static const char * adjectives[] = {"crackling", "sparking", "shocking"};
    AddSphereEffect(obj, Forge::Trait_Air, ADJECTIVE);
    if (number_bits(2) == 0) SET_BIT(obj.extra_flags[0], ITEM_HUM);
    obj.value[3] = DAM_LIGHTNING;
}
Exemplo n.º 15
0
bool spec_police_fine( CHAR_DATA * ch )
{
   CHAR_DATA *victim;
   CHAR_DATA *v_next;
   int vip;
   char buf[MAX_STRING_LENGTH];

   if( !IS_AWAKE( ch ) || ch->fighting )
      return FALSE;

   for( victim = ch->in_room->first_person; victim; victim = v_next )
   {
      v_next = victim->next_in_room;
      if( IS_NPC( victim ) )
         continue;
      if( !can_see( ch, victim ) )
         continue;
      if( number_bits( 1 ) == 0 )
         continue;
      for( vip = 0; vip <= 31; vip++ )
         if( IS_SET( ch->vip_flags, 1 << vip ) && IS_SET( victim->pcdata->wanted_flags, 1 << vip ) )
         {
            sprintf( buf, "Hey you're wanted on %s!", planet_flags[vip] );
            do_say( ch, buf );
            act( AT_ACTION, "$n fines $N an enormous amount of money.", ch, NULL, victim, TO_NOTVICT );
            act( AT_ACTION, "$n fines you an enourmous amount of money.", ch, NULL, victim, TO_VICT );
            victim->gold /= 2;
            REMOVE_BIT( victim->pcdata->wanted_flags, 1 << vip );
            return TRUE;
         }
   }
   return FALSE;
}
Exemplo n.º 16
0
void expire_items( char_data * ch )
{
   list < obj_data * >::iterator iobj;
   for( iobj = ch->carrying.begin(  ); iobj != ch->carrying.end(  ); )
   {
      obj_data *obj = *iobj;
      ++iobj;

      // If the player is less powerful than the object, it has a chance of simply disappearing without notice.
      if( ch->char_ego(  ) < obj->ego && number_bits( 3 ) > 4 )
      {
         log_printf( "obj %d, %s, removed from %s. Random ego check.", obj->pIndexData->vnum, obj->short_descr, ch->name );
         rare_purge( ch, obj );
         continue;
      }

      // The larger the item's ego, the larger it's implied worth. So you get less time to stash it offline.
      if( ch->pcdata->daysidle > 100 - obj->ego )
      {
         log_printf( "obj %d, %s, removed from %s. Exceeded ego idle time.", obj->pIndexData->vnum, obj->short_descr, ch->name );
         rare_purge( ch, obj );
         continue;
      }
   }
}
Exemplo n.º 17
0
bool spec_police_attack(CHAR_DATA * ch)
{
	CHAR_DATA *victim;
	CHAR_DATA *v_next;
	int vip;
	char buf[MAX_STRING_LENGTH];

	if (!IS_AWAKE(ch) || ch->fighting)
		return FALSE;

	for (victim = ch->in_room->first_person; victim; victim = v_next) {
		v_next = victim->next_in_room;
		if (IS_NPC(victim))
			continue;
		if (!can_see(ch, victim))
			continue;
		if (number_bits(1) == 0)
			continue;
		for (vip = 0; vip < 32; vip++)
			if (IS_SET(ch->vip_flags, 1 << vip)
			    && IS_SET(victim->pcdata->wanted_flags, 1 << vip)) {
				sprintf(buf, "Hey you're wanted on %s!",
					planet_flags[vip]);
				do_say(ch, buf);
				REMOVE_BIT(victim->pcdata->wanted_flags,
					   1 << vip);
				multi_hit(ch, victim, TYPE_UNDEFINED);
				return TRUE;
			}

	}

	return FALSE;

}
Exemplo n.º 18
0
/*
 * Core procedure for dragons.
 */
bool dragon( CHAR_DATA *ch, char *spell_name )
{
    CHAR_DATA *victim;
    CHAR_DATA *v_next;
    int sn;

    if ( ch->position != POS_FIGHTING
       && ch->position !=  POS_EVASIVE
       && ch->position !=  POS_DEFENSIVE
       && ch->position !=  POS_AGGRESSIVE
       && ch->position !=  POS_BERSERK
    )
	return FALSE;

    for ( victim = ch->in_room->first_person; victim; victim = v_next )
    {
	v_next = victim->next_in_room;
	if ( who_fighting( victim ) == ch && number_bits( 2 ) == 0 )
	    break;
    }

    if ( !victim )
	return FALSE;

    if ( ( sn = skill_lookup( spell_name ) ) < 0 )
	return FALSE;
    (*skill_table[sn]->spell_fun) ( sn, ch->level, ch, victim );
    return TRUE;
}
Exemplo n.º 19
0
bool spec_cast_undead( CHAR_DATA *ch )
{
    CHAR_DATA *victim;
    CHAR_DATA *v_next;
    char *spell;
    int sn;

    if ( ch->position != POS_FIGHTING )
	return FALSE;

    for ( victim = ch->in_room->people; victim != NULL; victim = v_next )
    {
	v_next = victim->next_in_room;
	if ( victim->fighting == ch && number_bits( 2 ) == 0 )
	    break;
    }

    if ( victim == NULL )
	return FALSE;

    for ( ;; )
    {
	int min_level;

	switch ( number_bits( 4 ) )
	{
	case  0: min_level =  0; spell = "curse";          break;
	case  1: min_level =  3; spell = "weaken";         break;
	case  2: min_level =  6; spell = "chill touch";    break;
	case  3: min_level =  9; spell = "blindness";      break;
	case  4: min_level = 12; spell = "poison";         break;
	case  5: min_level = 15; spell = "energy drain";   break;
	case  6: min_level = 18; spell = "harm";           break;
	case  7: min_level = 21; spell = "teleport";       break;
	default: min_level = 24; spell = "gate";           break;
	}

	if ( ch->level >= min_level )
	    break;
    }

    if ( ( sn = skill_lookup( spell ) ) < 0 )
	return FALSE;
    (*skill_table[sn].spell_fun) ( sn, ch->level, ch, victim );
    return TRUE;
}
Exemplo n.º 20
0
void do_krecall(CHAR_DATA * ch, char *argument)
{
	char buf[MAX_STRING_LENGTH];
	CHAR_DATA *victim;
	CHAR_DATA *mount;
	ROOM_INDEX_DATA *location;
	KINGDOM_DATA *kingdom;

	if(IS_NPC(ch) || (kingdom = get_kingdom(ch->pcdata->kingdom)) == &kingdom_default)
	{
		send_to_char("You have no kingdom!\n\r", ch);
		return;
	}

	act("$n's body flickers with green energy.", ch, 0, 0, TO_ROOM);
	act("Your body flickers with green energy.", ch, 0, 0, TO_CHAR);

	if((location = get_room_index(kingdom->recall)) == 0)
	{
		send_to_char("Your kingdom has no recall set.\n\r", ch);
		return;
	}

	if(ch->in_room == location)
		return;

	if(IS_SET(ch->in_room->room_flags, ROOM_NO_RECALL) || IS_AFFECTED(ch, AFF_CURSE))
	{
		send_to_char("You are unable to recall.\n\r", ch);
		return;
	}

	if((victim = ch->fighting) != 0)
	{
		if(number_bits(1) == 0)
		{
			WAIT_STATE(ch, 4);
			sprintf(buf, "You failed!\n\r");
			send_to_char(buf, ch);
			return;
		}
		sprintf(buf, "You recall from combat!\n\r");
		send_to_char(buf, ch);
		stop_fighting(ch, TRUE);
	}

	act("$n disappears.", ch, 0, 0, TO_ROOM);
	char_from_room(ch);
	char_to_room(ch, location);
	act("$n appears in the room.", ch, 0, 0, TO_ROOM);
	do_look(ch, "auto");

	if((mount = ch->mount) == 0)
		return;
	char_from_room(mount);
	char_to_room(mount, ch->in_room);
	return;
}
Exemplo n.º 21
0
/*
 * Stick a little fuzz on a number.
 */
int number_fuzzy( int number )
{
    switch ( number_bits( 2 ) )
    {
    case 0:  number -= 1; break;
    case 3:  number += 1; break;
    }

    return UMAX( 1, number );
}
Exemplo n.º 22
0
void
objfun_cast_fight(OBJ_DATA *obj, CHAR_DATA *keeper)
{
    int                 sn;
    CHAR_DATA          *victim;
    int                 min_lev;
    char               *spell = "";

    if (keeper == NULL || (keeper->fighting == NULL)
        || (obj->item_type != ITEM_WEAPON))
        return;
    if ((get_eq_char(keeper, WEAR_WIELD) != obj)
        && (get_eq_char(keeper, WEAR_WIELD_2) != obj))
        return;                    /* Must be wielded to work */
    for (victim = keeper->in_room->first_person; victim != NULL; victim = victim->next_in_room)
        if (victim->fighting == keeper && number_bits(2) == 0)
            break;

    if ((victim == NULL)
        || (victim->is_free != FALSE))
        return;
    switch (number_range(0, 5)) {
        case 0:
            min_lev = 5;
            spell = "magic missile";
            break;
        case 1:
            min_lev = 7;
            spell = "colour spray";
            break;
        case 2:
            min_lev = 8;
            spell = "chill touch";
            break;
        case 3:
            min_lev = 30;
            spell = "fireball";
            break;
        case 4:
            min_lev = 55;
            spell = "flamestrike";
            break;
        case 5:
            min_lev = 30;
            spell = "lightning bolt";
            break;
    }
    if ((sn = skill_lookup(spell)) < 0)
        return;
    act("$p glows brightly at $n!", victim, obj, NULL, TO_ROOM);
    act("$p glows brightly at you!", victim, obj, NULL, TO_CHAR);
    obj_cast_spell(sn, obj->level, keeper, victim, obj);
    return;
}
Exemplo n.º 23
0
static void AddSphereEffect(OBJ_DATA & obj, Forge::Trait trait, const char * adjective)
{
    if (AddTraitEffect(obj, trait))
    {
        std::ostringstream mess;
        mess << adjective << ' ' << obj.obj_str;
        copy_string(obj.obj_str, mess.str().c_str());
    }

    if (number_bits(2) == 0) SET_BIT(obj.extra_flags[0], ITEM_MAGIC);
}
Exemplo n.º 24
0
bool spec_nasty( CHAR_DATA *ch )
{
	CHAR_DATA *victim, *v_next;
	long gold;
 
	if (!IS_AWAKE(ch)) {
	   return FALSE;
	}
 
	if (ch->position != POS_FIGHTING) {
	   for ( victim = ch->in_room->people; victim != NULL; victim = v_next)
	   {
		  v_next = victim->next_in_room;
		  if (!IS_NPC(victim)
			 && (victim->level > ch->level)
			 && (victim->level < ch->level + 10))
		  {
		 do_function(ch, &do_backstab, victim->name);
			 if (ch->position != POS_FIGHTING)
		 {
				 do_function(ch, &do_murder, victim->name);
		 }

			 /* should steal some coins right away? :) */
			 return TRUE;
		  }
	   }
	   return FALSE;    /*  No one to attack */
	}
 
	/* okay, we must be fighting.... steal some coins and flee */
	if ( (victim = ch->fighting) == NULL)
		return FALSE;   /* let's be paranoid.... */
 
	switch ( number_bits(2) )
	{
		case 0:  act( "$n rips apart your coin purse, spilling your gold!",
					 ch, NULL, victim, TO_VICT);
				 act( "You slash apart $N's coin purse and gather his gold.",
					 ch, NULL, victim, TO_CHAR);
				 act( "$N's coin purse is ripped apart!",
					 ch, NULL, victim, TO_NOTVICT);
				 gold = victim->gold / 10;  /* steal 10% of his gold */
				 victim->gold -= gold;
				 ch->gold     += gold;
				 return TRUE;
 
		case 1:  do_function(ch, &do_flee, "");
				 return TRUE;
 
		default: return FALSE;
	}
}
Exemplo n.º 25
0
int spell_ethereal_snake_devour(int sn, int level, CHAR_DATA *ch, void *vo )
{

    CHAR_DATA *victim = (CHAR_DATA *) vo;
    OBJ_DATA  *obj_lose;
    OBJ_DATA  *obj_next;
        
    if ( !IS_NPC(victim) )
    {
      send_to_char(AT_BLUE, "You failed.\n\r", ch);
      return SKPELL_MISSED;
    }
        
    if ( number_percent( ) < level && !saves_spell( level, victim ) )
      for ( obj_lose = victim->carrying; obj_lose; obj_lose = obj_next )
      {
          obj_next = obj_lose->next_content;
          if ( obj_lose->deleted )
              continue;
   
          if ( number_bits( 2 ) != 0 )
              continue;
     
          act(AT_WHITE, "$p has been devoured by an ethereal snake!",      victim, obj_lose, NULL, TO_CHAR );
          act(AT_WHITE, "$n's $p has been devoured by an ethereal snake!", victim, obj_lose, NULL, TO_ROOM );
          extract_obj( obj_lose ) ;
      }
        
    if ( !saves_spell( level, victim ) )

    /*
     * Devour char, do not generate a corpse, do not
     * give experience for kill.  Extract_char will take care   
     * of items carried/wielded by victim.
     */
    {
        act(AT_WHITE, "Your ethereal snake has DEVOURED $N!",         ch, NULL, victim, TO_CHAR );
        act(AT_WHITE, "You have been DEVOURED by $n's ethereal snake!", ch, NULL, victim, TO_VICT );
        act(AT_WHITE, "$n's ethereal snake DEDVOURS $N!",       ch, NULL, victim, TO_ROOM );
    
        if ( IS_NPC( victim ) )
	{
            extract_char( victim, TRUE );
	}
        else
	{
            extract_char( victim, FALSE );
	}
    }     
    return SKPELL_NO_DAMAGE;
}
Exemplo n.º 26
0
SPEC_RET spec_thief( CHAR_DATA *ch )
{
	CHAR_DATA *victim;
	CHAR_DATA *v_next;
	int		   gold;
	int		   maxgold;

	if ( ch->position != POSITION_STAND )
		return FALSE;

	for ( victim = ch->in_room->first_person;  victim;  victim = v_next )
	{
		v_next = victim->next_in_room;

		if ( IS_MOB(victim) )			continue;
		if ( IS_ADMIN(victim) )			continue;
		if ( number_bits(2) != 0 )		continue;
		if ( !can_see(ch, victim) )		continue;

		if ( is_awake(victim) && number_range(0, get_level(ch)/2) == 0 )
		{
			act( AT_ACTION, "$n mi sta derubando! Dannato ladro!",
				ch, NULL, victim, TO_VICT	 );
			if ( get_curr_sense(ch, SENSE_SIXTH) > 75 )
			{
				act( AT_ACTION, "Mi accorgo che $n sta frugando nel suo sacco di monete di $N!",
					ch, NULL, victim, TO_NOVICT );
			}
		}
		else
		{
			maxgold = get_level(ch)/2 * get_level(ch)/2 * 1000;
			gold = victim->gold * number_range( 1, URANGE(2, get_level(ch)/8, 10) ) / 100;
			ch->gold += 9 * gold / 10;
			victim->gold -= gold;

			if ( ch->gold > maxgold )
			{
				boost_economy( ch->in_room->area, ch->gold - maxgold/2 );
				ch->gold = maxgold/2;
			}
		}
		return TRUE;
	} /* chiude il for */

	return FALSE;
}
Exemplo n.º 27
0
bool spec_thief( CHAR_DATA *ch )
{
    CHAR_DATA *victim;
    CHAR_DATA *v_next;
    int gold, maxgold;

    if ( ch->position != POS_STANDING )
	return FALSE;

    for ( victim = ch->in_room->first_person; victim; victim = v_next )
    {
	v_next = victim->next_in_room;

	if ( IS_NPC(victim)
	||   victim->level >= LEVEL_IMMORTAL
	||   number_bits( 2 ) != 0
	||   !can_see( ch, victim ) )	/* Thx Glop */
	    continue;

	if ( IS_AWAKE(victim) && number_range( 0, ch->level ) == 0 )
	{
	    act( AT_ACTION, "You discover $n's hands in your sack of gold!",
		ch, NULL, victim, TO_VICT );
	    act( AT_ACTION, "$N discovers $n's hands in $S sack of gold!",
		ch, NULL, victim, TO_NOTVICT );
	    return TRUE;
	}
	else
	{
	    maxgold = ch->level * ch->level * 1000;
	    gold = victim->gold
	    	 * number_range( 1, URANGE(2, ch->level/4, 10) ) / 100;
	    ch->gold     += 9 * gold / 10;
	    victim->gold -= gold;
	    if ( ch->gold > maxgold )
	    {
		boost_economy( ch->in_room->area, ch->gold - maxgold/2 );
		ch->gold = maxgold/2;
	    }
	    return TRUE;
	}
    }

    return FALSE;
}
Exemplo n.º 28
0
void check_waterwheel_charging(OBJ_DATA & obj)
{
    static const int DurationStep(20);

    // Verify that the object is a crystal and the waterwheel is in a room
    if (obj.contains == NULL || obj.contains->material != material_lookup("crystal") || obj.contains->item_type != ITEM_GEM)
        return;

    // Verify that the waterwheel is in a room
    ROOM_INDEX_DATA * room(get_room_for_obj(obj));
    if (room == NULL)
        return;

    // Check for existing effect
    AFFECT_DATA * paf(get_obj_affect(obj.contains, gsn_constructwaterwheel));
    if (paf == NULL)
    {
        // First time, add the effect
        AFFECT_DATA af = {0};
        af.where    = TO_OBJECT;
        af.type     = gsn_constructwaterwheel;
        af.level    = obj.level;
        af.duration = DurationStep;
        af.bitvector = ITEM_HUM;
        affect_to_obj(obj.contains, &af);

        if (room != NULL)
            act("Inside the waterwheel, $p begins to emit a faint humming sound.", room->people, obj.contains, NULL, TO_ALL);

        return;
    }

    // Increase the duration
    int maxCharge(obj.level * 5);
    if (paf->duration + DurationStep < maxCharge)
    {
        paf->duration += DurationStep;
        act("$p's hum intensifies slightly as it absorbs the river's energy.", room->people, obj.contains, NULL, TO_ALL);
        return;
    }
    
    paf->duration = maxCharge;
    if (number_bits(1) == 0)
        act("From inside the waterwheel, $p hums steadily, unable to absorb any more power.", room->people, obj.contains, NULL, TO_ALL);
}
Exemplo n.º 29
0
bool spec_thief( CHAR_DATA *ch )
{
	CHAR_DATA *victim;
	CHAR_DATA *v_next;
	long gold,silver;

	if ( ch->position != POS_STANDING )
	return FALSE;

	for ( victim = ch->in_room->people; victim != NULL; victim = v_next )
	{
	v_next = victim->next_in_room;

	if ( IS_NPC(victim)
	||   victim->level >= LEVEL_IMMORTAL
	||   number_bits( 5 ) != 0 
	||   !can_see(ch,victim))
		continue;

	if ( IS_AWAKE(victim) && number_range( 0, ch->level ) == 0 )
	{
		act( "You discover $n's hands in your wallet!",
		ch, NULL, victim, TO_VICT );
		act( "$N discovers $n's hands in $S wallet!",
		ch, NULL, victim, TO_NOTVICT );
		return TRUE;
	}
	else
	{
		gold = victim->gold * UMIN(number_range(1,20),ch->level / 2) / 100;
		gold = UMIN(gold, ch->level * ch->level * 10 );
		ch->gold     += gold;
		victim->gold -= gold;
		silver = victim->silver * UMIN(number_range(1,20),ch->level/2)/100;
		silver = UMIN(silver,ch->level*ch->level * 25);
		ch->silver	+= silver;
		victim->silver -= silver;
		return TRUE;
	}
	}

	return FALSE;
}
Exemplo n.º 30
0
/*
 * Special procedures for mobiles.
 */
bool spec_breath_any( CHAR_DATA *ch )
{
	if ( ch->position != POS_FIGHTING )
		return FALSE;

	switch ( number_bits( 3 ) )
	{
		case 0: return spec_breath_fire		( ch );
		case 1:
		case 2: return spec_breath_lightning	( ch );
		case 3: return spec_breath_gas		( ch );
		case 4: return spec_breath_acid		( ch );
		case 5:
		case 6:
		case 7: return spec_breath_frost		( ch );
	}

	return FALSE;
}