コード例 #1
0
ファイル: si_spells.c プロジェクト: krs256/KillerMUDPL
bool check_freezing_rain(CHAR_DATA *ch, CHAR_DATA *victim, int type, int spell)
{
    sh_int sn;

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

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

    if ( !IS_OUTSIDE(ch) || IS_SET(sector_table[ch->in_room->sector_type].flag, SECT_NOWEATHER))
        return TRUE;

    return FALSE;
}
コード例 #2
0
ファイル: si_spells.c プロジェクト: krs256/KillerMUDPL
bool check_meteor(CHAR_DATA *ch, CHAR_DATA *victim, int type, int spell)
{
    sh_int sn;
    EVENT_DATA *event = NULL;

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

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

    if ( !IS_OUTSIDE(ch) ||
            IS_SET(sector_table[ch->in_room->sector_type].flag, SECT_NOWEATHER))
        return TRUE;

    for( event = event_first; event; event = event->next )
        if( (event->type == EVENT_SUMMON_LESSER_METEOR && (CHAR_DATA *)event->arg1 == ch ) ||
                (event->type == EVENT_SUMMON_GREATER_METEOR && (CHAR_DATA *)event->arg1 == ch ))
            return TRUE;


    return FALSE;
}
コード例 #3
0
ファイル: si_spells.c プロジェクト: krs256/KillerMUDPL
bool check_call_lightning(CHAR_DATA *ch, CHAR_DATA *victim, int type, int spell)
{
    sh_int sn;
    EVENT_DATA *event = NULL;

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

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

    if ( !IS_OUTSIDE(ch) ||
            IS_SET(sector_table[ch->in_room->sector_type].flag, SECT_NOWEATHER))
        return TRUE;

    for( event = event_first; event; event = event->next )
        if( event->type == EVENT_CALL_LIGHTNING &&
                (CHAR_DATA *)event->arg1 == ch )
            return TRUE;


    return FALSE;
}
コード例 #4
0
ファイル: update.c プロジェクト: MUDOmnibus/Rom24b6-for-Cpp
/*
 * Update the weather.
 */
void weather_update( void )
{
    char buf[MAX_STRING_LENGTH];
    DESCRIPTOR_DATA *d;
    int diff;

    buf[0] = '\0';

    switch ( ++time_info.hour )
    {
    case  5:
	weather_info.sunlight = SUN_LIGHT;
	strcat( buf, "The day has begun.\n\r" );
	break;

    case  6:
	weather_info.sunlight = SUN_RISE;
	strcat( buf, "The sun rises in the east.\n\r" );
	break;

    case 19:
	weather_info.sunlight = SUN_SET;
	strcat( buf, "The sun slowly disappears in the west.\n\r" );
	break;

    case 20:
	weather_info.sunlight = SUN_DARK;
	strcat( buf, "The night has begun.\n\r" );
	break;

    case 24:
	time_info.hour = 0;
	time_info.day++;
	break;
    }

    if ( time_info.day   >= 35 )
    {
	time_info.day = 0;
	time_info.month++;
    }

    if ( time_info.month >= 17 )
    {
	time_info.month = 0;
	time_info.year++;
    }

    /*
     * Weather change.
     */
    if ( time_info.month >= 9 && time_info.month <= 16 )
	diff = weather_info.mmhg >  985 ? -2 : 2;
    else
	diff = weather_info.mmhg > 1015 ? -2 : 2;

    weather_info.change   += diff * dice(1, 4) + dice(2, 6) - dice(2, 6);
    weather_info.change    = UMAX(weather_info.change, -12);
    weather_info.change    = UMIN(weather_info.change,  12);

    weather_info.mmhg += weather_info.change;
    weather_info.mmhg  = UMAX(weather_info.mmhg,  960);
    weather_info.mmhg  = UMIN(weather_info.mmhg, 1040);

    switch ( weather_info.sky )
    {
    default: 
	bug( "Weather_update: bad sky %d.", weather_info.sky );
	weather_info.sky = SKY_CLOUDLESS;
	break;

    case SKY_CLOUDLESS:
	if ( weather_info.mmhg <  990
	|| ( weather_info.mmhg < 1010 && number_bits( 2 ) == 0 ) )
	{
	    strcat( buf, "The sky is getting cloudy.\n\r" );
	    weather_info.sky = SKY_CLOUDY;
	}
	break;

    case SKY_CLOUDY:
	if ( weather_info.mmhg <  970
	|| ( weather_info.mmhg <  990 && number_bits( 2 ) == 0 ) )
	{
	    strcat( buf, "It starts to rain.\n\r" );
	    weather_info.sky = SKY_RAINING;
	}

	if ( weather_info.mmhg > 1030 && number_bits( 2 ) == 0 )
	{
	    strcat( buf, "The clouds disappear.\n\r" );
	    weather_info.sky = SKY_CLOUDLESS;
	}
	break;

    case SKY_RAINING:
	if ( weather_info.mmhg <  970 && number_bits( 2 ) == 0 )
	{
	    strcat( buf, "Lightning flashes in the sky.\n\r" );
	    weather_info.sky = SKY_LIGHTNING;
	}

	if ( weather_info.mmhg > 1030
	|| ( weather_info.mmhg > 1010 && number_bits( 2 ) == 0 ) )
	{
	    strcat( buf, "The rain stopped.\n\r" );
	    weather_info.sky = SKY_CLOUDY;
	}
	break;

    case SKY_LIGHTNING:
	if ( weather_info.mmhg > 1010
	|| ( weather_info.mmhg >  990 && number_bits( 2 ) == 0 ) )
	{
	    strcat( buf, "The lightning has stopped.\n\r" );
	    weather_info.sky = SKY_RAINING;
	    break;
	}
	break;
    }

    if ( buf[0] != '\0' )
    {
	for ( d = descriptor_list; d != NULL; d = d->next )
	{
	    if ( d->connected == CON_PLAYING
	    &&   IS_OUTSIDE(d->character)
	    &&   IS_AWAKE(d->character) )
		send_to_char( buf, d->character );
	}
    }

    return;
}
コード例 #5
0
ファイル: weather.c プロジェクト: Firehed/RotK
/*
New weather command. Reads the new weather stats as well as  tells you
what time of day it is (morning, noon, night) 
Added so that players don't HAVE to have autoweather enabled*/
void do_weather( CHAR_DATA *ch, char *argument )
{
    char buf[MSL];
    char buf2[MSL];
    char *suf;
    int day;

    day     = time_info.day + 1;

         if ( day > 4 && day <  20 ) suf = "th";
    else if ( day % 10 ==  1       ) suf = "st";
    else if ( day % 10 ==  2       ) suf = "nd";
    else if ( day % 10 ==  3       ) suf = "rd";
    else                             suf = "th";


    if ( !IS_OUTSIDE(ch) )
    {
	send_to_char( "You can't see the weather indoors.\n\r", ch );
	return;
    }
        send_to_char("{x\n\r",ch); 

        if (weather_info.sky == SKY_RAINING)
        {
  if ( number_range( 0, 100 ) <= 15  )
{
        send_to_char("{g[{YWeather{g] {CThere is a cold rain trickling down.{x",ch);
}
else
  if ( number_range( 0, 100 ) <= 30  )
{
        send_to_char("{g[{YWeather{g] {CThere is a warm rain trickling down.{x",ch);
}
else   if ( number_range( 0, 100 ) <= 45  )
{
        send_to_char("{g[{YWeather{g] {CBig Huge {GFrogs{C are dropping from the sky like raindrops",ch); 
}

else
  if ( number_range( 0, 100 ) <= 60  )
{
        send_to_char("{g[{YWeather{g] {CBig Huge {YDragons{C are falling from the sky.",ch); 
}
else
  if ( number_range( 0, 100 ) <= 75  )
{
        send_to_char("{g[{YWeather{g] {CBig Huge {BPuppies{C are falling out of the sky like raindrops.",ch); 
}
else   if ( number_range( 0, 100 ) <= 85  )
{
        send_to_char("{g[{YWeather{g] {YKitten{C Sized animals appear to be falling left and right. Bonzai!!!!!.",ch); 
}
else
  if ( number_range( 0, 100 ) <= 100  )
{
        send_to_char("{g[{YWeather{g] {CBig Huge {RRats{C are falling out of the sky like raindrops.",ch); 
}

        send_to_char("{x\n\r",ch); 

        }

        else if (weather_info.sky == SKY_CLOUDY)
        {
        sprintf( buf, "{g[{YWeather{g] %s{x.\n\r",
        weather_info.change >= 0
        ? "{CA warm breeze can be felt about"
        : "{CA cold breeze can be felt about" );
    send_to_char( buf, ch );
        }
                 else if (weather_info.sky == SKY_CLOUDLESS)
        {
        send_to_char("{g[{YWeather{g] {CThe sky is beautiful, not a cloud around.{x\n\r",ch);
        }
                 else if (weather_info.sky == SKY_THUNDERSTORM)
        {
        send_to_char("{g[{YWeather{g] {CThe skies thunder as a storm approaches.{x\n\r",ch);
        }
                 else if (weather_info.sky == SKY_ICESTORM)
        {
        send_to_char("{g[{YWeather{g] {CSheets of ice appear to be falling from the sky.{x\n\r",ch);
        }
                 else if (weather_info.sky == SKY_HAILSTORM)
        {
        send_to_char("{g[{YWeather{g] {CGolfball like substances are falling from the sky.{x\n\r",ch);
        }
                 else if (weather_info.sky == SKY_SNOWING)
        {
        send_to_char("{g[{YWeather{g] {CA light snow is falling.{x\n\r",ch);
        }
                 else if (weather_info.sky == SKY_BLIZZARD)
        {
        send_to_char("{g[{YWeather{g] {CThere is a blizzard about.{x\n\r",ch);
       }
                 else if (weather_info.sky == SKY_FOGGY)
        {
        send_to_char("{g[{YWeather{g] {CA misty haze covers the horizon.{x\n\r",ch);
        }

        else if (weather_info.sky == SKY_LIGHTNING)
        {
        send_to_char("{g[{YWeather{g] {CA {y Lightning{w storm is approaching {x\n\r",ch);
     }
    sprintf( buf2,
	"{B[{W Time  {B] {RIt is {M%d{R o'clock {Y%s{x\n\r",
	(time_info.hour % 12 == 0) ? 12 : time_info.hour %12,
	time_info.hour >= 12 ? "pm" : "am");
    send_to_char( buf2, ch );
    return;

}