예제 #1
0
bool spell_chain_lightning( char_data* ch, char_data* victim, void*,
  int level, int )
{
  room_data*  room;

  if( null_caster( ch, SPELL_CHAIN_LIGHTNING ) ) 
    return TRUE;

  room = ch->in_room;

  if( room->sector_type == SECT_UNDERWATER ) {
    water_shock( ch, SPELL_CHAIN_LIGHTNING, level );
    return TRUE;
    }
 
  for( ; victim != NULL; ) {
    damage_shock( victim, ch, spell_damage( SPELL_CHAIN_LIGHTNING, level ),
      "*The bifurcating lightning bolt" );
    if( number_range( 0, 3 ) == 0
      || ( victim = random_pers( room ) ) == ch 
      || !can_kill( ch, victim ) )
      break;
    }

  return TRUE;
}
예제 #2
0
int killed_by_none(int n, int* configuration, int to_test)
{
	int i;
	for(i = 0; i < n; i++)
	{
		if(i != to_test && can_kill(configuration[i], i, 
		    configuration[to_test], to_test))
			return 0;
	}
	return 1;
}
예제 #3
0
void water_shock( char_data* ch, int spell, int level )
{
  char_data*  victim;

  for( int i = 0; i < *ch->array; i++ ) 
    if( ( victim = character( ch->array->list[i] ) ) != NULL
      && can_kill( ch, victim ) )
      damage_shock( victim, ch, 2*spell_damage( spell, level ),
        "*The water shock" );
    
  return;
}
예제 #4
0
int non_kill_run(int* x, int start, int length)
{
	int i;
	for(i = start; i < (start + length); i++)
	{
		if(can_kill(x[i], i, x[start +
		     length], (start + length)))
		{
			return 0;
		}
	}
	return 1;
}
예제 #5
0
void char_bash( char_data* ch, char_data* victim )
{
  int delay;

  if( victim == ch ) {
    send( ch, "Bashing yourself is not very productive.\n\r" );
    return;
    }

  if( victim->species != NULL ) { 
    if( is_set( &victim->species->act_flags, ACT_NO_BASH ) ) {
      send( ch, "Bashing that does not make sense.\n\r" );
      return;
      }
    if( is_set( &victim->species->act_flags, ACT_GHOST ) ) {
      send( ch, "Bashing a ghost is a completely futile exercise.\n\r" );
      return;
      }
    }

  if( victim->position < POS_FIGHTING ) {
    send( ch, "Your victim is already on the ground!\n\r" );
    return;
    }

  if( victim->Size( ) > ch->Size( )+1 ) {
    send( ch, "%s is way too large for you to successfully bash %s.\n\r",
      victim, victim->Him_Her( ) );
    return;
    }

  if( !can_kill( ch, victim ) )
    return;

  check_killer( ch, victim );
  ch->fighting = victim;
  react_attack( ch, victim );  

  remove_bit( &ch->status, STAT_LEAPING );
  remove_bit( &ch->status, STAT_WIMPY );

  ch->improve_skill( SKILL_BASH );

  delay = bash_attack( ch, victim );
  add_queue( &ch->active, delay );
}
예제 #6
0
/*
 * beam function shoots a beam on the Board.
 * i is ith row and j is jth column at which the beam currently is
 * dir = 1 => beam will travel northwards
 * dir = 2 => beam will travel southwards
 * dir = 3 => beam will travel eastwards
 * dir = 4 => beam will travel westwards
 * */
void Board::beam(int i, int j, int dir)
{
		while(1)
		{
				switch(dir)
				{
						case 1:
								i--;
								break;
						case 2:
								i++;
								break;
						case 3:
								j++;
								break;
						case 4:
								j--;			
				}

				if( (i >= 0 && i < 9) && (j >= 0 && j < 9) )
				{
						if(matrix[i][j] != NULL)
						{
								if(can_kill(i, j, dir))
								{
										return;
								}

						}	
				}
				else
				{
						return;
				}		
		}
}
예제 #7
0
bool join_fight( char_data* victim, char_data* ch, char_data* rch )
{
  if( rch == ch )
    return FALSE;

  if( rch == victim )
    return TRUE;

  if( rch->pcdata != NULL ) {
    if( is_set( rch->pcdata->pfile->flags, PLR_AUTO_ASSIST ) 
      && is_same_group( rch, victim ) && !is_same_group( rch, ch )
      && can_kill( rch, ch ) )
      return TRUE;
    return FALSE;
    }
 
  if( is_set( &rch->status, STAT_PET ) ) {
    if( rch->leader == victim && ( victim->pcdata == NULL
      || is_set( victim->pcdata->pfile->flags, PLR_PET_ASSIST ) ) )
      return TRUE;
    return FALSE;
    }

  if( rch->species != NULL && victim->species != NULL 
    && is_set( &rch->species->act_flags, ACT_ASSIST_GROUP )
    && !is_set( &victim->status, STAT_PET ) ) {
    if( victim->species->nation != NATION_NONE
      && rch->species->nation == victim->species->nation )
      return TRUE;
    if( victim->species->group != GROUP_NONE
      && victim->species->group == rch->species->group )
      return TRUE;
    }

  return FALSE;
}  
예제 #8
0
int fitness_test(int n, int* configuration)
{
	int i, j;
	int tmp_fit = 0;
	int kill_flag;

	for(i = 0; i < n; i++)
	{
		kill_flag = 0;
		for(j = i; j < n; j++)
		{
			if((i != j) && can_kill(configuration[i], i, 
			    configuration[j], j))
			{
				kill_flag = 1;
				break;	
			}
		}
		if(!kill_flag)
			tmp_fit++;
	}

	return  tmp_fit;
}