コード例 #1
0
bool spec_executioner( CHAR_DATA *ch )
{
	char buf[MSL]={'\0'};
	CHAR_DATA *victim;
	CHAR_DATA *v_next;
	char *crime;

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

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

	if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_KILLER) 
	&&   can_see(ch,victim))
		{ crime = "KILLER"; break; }

	if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_THIEF) 
	&&   can_see(ch,victim))
		{ crime = "THIEF"; break; }
	}

	if ( victim == NULL )
	return FALSE;

	sprintf( buf, "%s is a %s!  PROTECT THE INNOCENT!  MORE BLOOOOD!!!", victim->name, crime );
	REMOVE_BIT(ch->comm,COMM_NOSHOUT);
	do_function(ch, &do_yell, buf );
	multi_hit( ch, victim, TYPE_UNDEFINED );
	return TRUE;
}
コード例 #2
0
bool spec_guard( CHAR_DATA *ch )
{
	char buf[MSL]={'\0'};
	CHAR_DATA *victim;
	CHAR_DATA *v_next;
	CHAR_DATA *ech;
	char *crime;
	int max_evil;

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

	max_evil = 300;
	ech      = NULL;
	crime    = "";

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

	if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_KILLER) 
	&&   can_see(ch,victim))
		{ crime = "KILLER"; break; }

	if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_THIEF) 
	&&   can_see(ch,victim))
		{ crime = "THIEF"; break; }

	if ( victim->fighting != NULL
	&&   victim->fighting != ch
	&&   victim->alignment < max_evil )
	{
		max_evil = victim->alignment;
		ech      = victim;
	}
	}

	if ( victim != NULL )
	{
	sprintf( buf, "%s is a %s!  PROTECT THE INNOCENT!!  BANZAI!!", victim->name, crime );
	REMOVE_BIT(ch->comm,COMM_NOSHOUT);
	do_function(ch, &do_yell, buf );
	multi_hit( ch, victim, TYPE_UNDEFINED );
	return TRUE;
	}

	if ( ech != NULL )
	{
	act( "$n screams 'PROTECT THE INNOCENT!!  BANZAI!!", ch, NULL, NULL, TO_ROOM );
	multi_hit( ch, ech, TYPE_UNDEFINED );
	return TRUE;
	}

	return FALSE;
}
コード例 #3
0
ファイル: special.c プロジェクト: ccubed/SWRCustom
bool spec_clan_guard( CHAR_DATA * ch )
{
  CHAR_DATA *victim = NULL;
  CHAR_DATA *v_next = NULL;

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

  for( victim = ch->in_room->first_person; victim; victim = v_next )
  {
    v_next = victim->next_in_room;
    if( !can_see( ch, victim ) )
      continue;
    if( get_timer( victim, TIMER_RECENTFIGHT ) > 0 )
      continue;
    if( !IS_NPC( victim ) && victim->pcdata && victim->pcdata->clan
	&& IS_AWAKE( victim ) && victim->pcdata->clan != ch->mob_clan
	&& nifty_is_name( victim->pcdata->clan->name,
	  ch->mob_clan->atwar ) )
    {
      char buf[MAX_STRING_LENGTH];
      snprintf( buf, MAX_STRING_LENGTH, "%s",
		"Hey you're not allowed in here!" );
      do_yell( ch, buf );
      multi_hit( ch, victim, TYPE_UNDEFINED );
      return TRUE;
    }
  }

  return FALSE;
}
コード例 #4
0
ファイル: special.c プロジェクト: AndrewBudd/swr-fuss-ace
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;
}
コード例 #5
0
/* File read/write code redone using standard Smaug I/O routines - Samson 9-12-98 */
void do_finger( CHAR_DATA *ch, char *argument )
{
  CHAR_DATA *victim;

  if( IS_NPC(ch) )
  {
     send_to_char( "Mobs can't use the finger command.\n\r", ch );
     return;
  }

  if ( argument[0] == '\0' )
  {
      send_to_char("Finger whom?\n\r", ch );
      return;
  }

  victim = get_char_world(ch, argument);

  if ( ( victim == NULL ) || (!victim) )
  {
      read_finger( ch, argument );
      return;
  }

  if ( IS_IMMORTAL(victim) && !IS_IMMORTAL(ch) )
  {
	send_to_char( "Cannot finger an immortal.\n\r", ch );
	return;
  }
/*
  if ( ( ch->top_level < victim->top_level && ch->top_level < LEVEL_INFINITE ) && IS_IMMORTAL(ch) )
  {
	send_to_char( "Cannot finger an immortal above your own level.\n\r", ch );
	return;
  }
*/
  if ( IS_NPC( victim ) )
  {
      read_finger( ch, argument );
      return;
  }

  if ( !can_see( ch, victim ) )
  {
      send_to_char("They aren't here.\n\r", ch );
      return;
  }

  send_to_char("&w          Finger Info\n\r", ch);
  send_to_char("          -----------\n\r", ch);
  ch_printf(ch, "&wName : &G%-20s &wAge: &G%d\n\r", victim->name, victim->pcage );
  ch_printf(ch, "&wSex  : &G%-20s\n\r",
                victim->sex == SEX_MALE   ? "Male"   :
                victim->sex == SEX_FEMALE ? "Female" : "Neutral" );
  ch_printf(ch, "&wTitle: &G%s\n\r", victim->pcdata->title );
  ch_printf(ch, "&wHomepage: &G%s\n\r", victim->pcdata->homepage ? victim->pcdata->homepage : "None" );
//  ch_printf(ch, "&wClan: &G%s\n\r", victim->pcdata->clan ? victim->pcdata->clan->name : "Unclanned" );
  ch_printf(ch, "&wLast on: &G%s\n\r", (char *) ctime( &ch->logon ) );
  return;
}
コード例 #6
0
ファイル: helper.c プロジェクト: AstoniaDev/openMerc
void compute_dlight(int xc,int yc)
{
        int xs,ys,xe,ye,x,y,v,d,best=0,m;
        unsigned long long prof;

        prof=prof_start();

        xs=max(0,xc-LIGHTDIST);
        ys=max(0,yc-LIGHTDIST);
        xe=min(MAPX-1,xc+1+LIGHTDIST);
        ye=min(MAPY-1,yc+1+LIGHTDIST);

        for (y=ys; y<ye; y++) {
                m=y*MAPX+xs;
                for (x=xs; x<xe; x++,m++) {
                        if ((xc-x)*(xc-x)+(yc-y)*(yc-y)>(LIGHTDIST*LIGHTDIST+1)) continue;
                        if (!(map[m].flags&MF_INDOORS)) {
                                if ((v=can_see(0,xc,yc,x,y,LIGHTDIST))==0) continue;
                                d=256/(v*(abs(xc-x)+abs(yc-y)));
                                if (d>best) best=d;
                        }
                }
        }
        if (best>256) best=256;
        map[xc+yc*MAPX].dlight=best;

        prof_stop(18,prof);
}
コード例 #7
0
ファイル: character.c プロジェクト: ryjen/muddled
Character *get_char_world(Character *ch, const char *argument)
{
    char arg[BUF_SIZ];
    long number;
    Character *wch;
    int count;

    if ((wch = get_char_room(ch, argument)) != NULL) {
        return wch;
    }
    number = number_argument(argument, arg);
    count = 0;

    for (wch = first_character; wch != NULL; wch = wch->next)
    {

        if (wch->inRoom == NULL || !can_see(ch, wch)
                || !is_name(arg, wch->name)) {
            continue;
        }

        if (++count == number) {
            return wch;
        }
    }
    return NULL;
}
コード例 #8
0
ファイル: monmove.cpp プロジェクト: Oddzball/Cataclysm-DDA
/* will_reach() is used for determining whether we'll get to stairs (and
 * potentially other locations of interest).  It is generally permissive.
 * TODO: Pathfinding;
         Make sure that non-smashing monsters won't "teleport" through windows
         Injure monsters if they're gonna be walking through pits or whatevs
 */
bool monster::will_reach(int x, int y)
{
    monster_attitude att = attitude(&(g->u));
    if (att != MATT_FOLLOW && att != MATT_ATTACK && att != MATT_FRIEND)
        return false;

    if (has_flag(MF_DIGS))
        return false;

    if (has_flag(MF_IMMOBILE) && (posx() != x || posy() != y))
        return false;

    std::vector<point> path = g->m.route(posx(), posy(), x, y, has_flag(MF_BASHES));
    if (path.size() == 0)
        return false;

    if (has_flag(MF_SMELLS) && g->scent(posx(), posy()) > 0 &&
            g->scent(x, y) > g->scent(posx(), posy()))
        return true;

    if (can_hear() && wandf > 0 && rl_dist(wandx, wandy, x, y) <= 2 &&
            rl_dist(posx(), posy(), wandx, wandy) <= wandf)
        return true;

    int t;
    if (can_see() && g->m.sees(posx(), posy(), x, y, g->light_level(), t))
        return true;

    return false;
}
コード例 #9
0
ファイル: mbr_fun.c プロジェクト: Catcheeto/ackfuss
const char *char_data::get_name( CHAR_DATA *looker )
{
    if ( looker != NULL )
    {
        if ( can_see(looker, this) )
        {
            if ( IS_NPC(this) )
                return npcdata->short_descr;
            else
            {
                if ( IS_WOLF(this) && (IS_SHIFTED(this) || IS_RAGED(this)) )
                    return "A Large @@bWolf@@N";
                else
                    return name.c_str();
            }
        }
        else
        {
            if ( IS_IMMORTAL(this) )
                return "A Mystical Being";
            else
                return "Someone";
        }
    }
    else
    {
        if ( IS_NPC(this) )
            return npcdata->short_descr;
        else
            return name.c_str();
    }

    return "Unknown!";
}
コード例 #10
0
ファイル: mob_prog.c プロジェクト: Firehed/RotK
void mp_greet_trigger( CHAR_DATA *ch )
{
    CHAR_DATA *mob;

    for ( mob = ch->in_room->people; mob != NULL; mob = mob->next_in_room )
    {    
	if ( IS_NPC( mob )
	&& ( HAS_TRIGGER(mob, TRIG_GREET) || HAS_TRIGGER(mob,TRIG_GRALL) ) )
	{
	    /*
	     * Greet trigger works only if the mobile is not busy
	     * (fighting etc.). If you want to catch all players, use
	     * GrAll trigger
	     */
	    if ( HAS_TRIGGER( mob,TRIG_GREET )
	    &&   mob->position == mob->pIndexData->default_pos
	    &&   can_see( mob, ch ) )
		mp_percent_trigger( mob, ch, NULL, NULL, TRIG_GREET );
	    else                 
	    if ( HAS_TRIGGER( mob, TRIG_GRALL ) )
		mp_percent_trigger( mob, ch, NULL, NULL, TRIG_GRALL );
	}
    }
    return;
}
コード例 #11
0
ファイル: boe.monster.cpp プロジェクト: PBrookfield/cboe-msvc
// Looks at all spaces within 2, looking for a spot which is clear of nastiness and beings
// returns {0,0} if none found
// THIS MAKES NO ADJUSTMENTS FOR BIG MONSTERS!!!
location find_clear_spot(location from_where,short mode)
//mode; // 0 - normal  1 - prefer adjacent space
{
	location loc,store_loc;
	short num_tries = 0,r1;
	
	while (num_tries < 75) {
		num_tries++;
		loc = from_where;
		r1 = get_ran(1,-2,2);
		loc.x = loc.x + r1;
		r1 = get_ran(1,-2,2);
		loc.y = loc.y + r1;
		if ((loc_off_act_area(loc) == false) && (is_blocked(loc) == false)
			&& (can_see(from_where,loc,1) == 0)
			&& (!(is_combat()) || (pc_there(loc) == 6))
			&& (!(is_town()) || (loc != univ.town.p_loc))
			 && (!(univ.town.misc_i(loc.x,loc.y) & 248)) && // check for crate, barrel, barrier, quickfire
			(!(univ.town.explored(loc.x,loc.y) & 254))) { // check for fields, clouds
				if ((mode == 0) || ((mode == 1) && (adjacent(from_where,loc) == true)))
					return loc;
					else store_loc = loc;			
				}
		}
	return store_loc;
}
コード例 #12
0
ファイル: ant.cpp プロジェクト: Xenoveritas/abuse
static int ant_dodge(game_object *o)
{
  if (o->lvars[ANT_need_to_dodge]==1)
  {
    o->lvars[ANT_need_to_dodge]=0;
    if ((jrand()%2)==0)
    {
      o->set_state(stopped);
      o->set_aistate(ANT_JUMP);
      if (!can_see(o,o->x,o->y,o->x,o->y-120))   // is there a roof above?
      {
    o->set_yvel(-17);
    o->set_xvel(0);
    o->set_aistate(ANT_JUMP_ROOF);
    ant_ai();
      } else
      {
    o->set_yvel(-12);
    if (o->direction>0)
      o->set_xvel(22);
    else o->set_xvel(-22);
    o->set_aistate(ANT_JUMP);
      }
    }
    return 1;
  } else return 0;
}
コード例 #13
0
ファイル: class_healer.c プロジェクト: blakepell/CrimsonSkies
/*
 * Mass refresh will refresh every visible character in the room for only
 * 3 more mana than a normal refresh.  It also has an additional 1 to 10
 * movement random bonus on top of the normal refresh.
 */
void spell_mass_refresh(int sn, int level, CHAR_DATA * ch, void *vo, int target)
{
    CHAR_DATA *gch;
    char buf[MAX_STRING_LENGTH];

    for (gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room)
    {
        // If the character can't be seen they can't be refreshed, we don't
        // want this used to sniff out hidden characters.
        if (!can_see(ch, gch))
        {
            continue;
        }

        gch->move = UMIN(gch->move + level + number_range(1, 10), gch->max_move);

        if (gch->max_move == gch->move)
        {
            send_to_char("You feel fully refreshed!\r\n", gch);
        }
        else
        {
            send_to_char("You feel less tired.\r\n", gch);
        }

        if (gch != ch)
        {
            sprintf(buf, "%s has been refreshed.\r\n", gch->name);
            send_to_char(buf, ch);
        }

    }

} // end spell_mass_refresh
コード例 #14
0
ファイル: special.c プロジェクト: danielkrainas/ganadia
bool spec_clan_guard(CHAR_DATA * ch)
{
	CHAR_DATA *victim;
	CHAR_DATA *v_next;

	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 (!can_see(ch, victim))
			continue;
		if (get_timer(victim, TIMER_RECENTFIGHT) > 0)
			continue;
		if (!IS_NPC(victim) && victim->pcdata && victim->pcdata->clan
		    && IS_AWAKE(victim)
		    && str_cmp(ch->name, victim->pcdata->clan->name)) {
			do_yell(ch, "Hey your not allowed in here!");
			multi_hit(ch, victim, TYPE_UNDEFINED);
			return TRUE;
		}
	}

	return FALSE;
}
コード例 #15
0
ファイル: special.c プロジェクト: danielkrainas/ganadia
bool spec_new_republic_trooper(CHAR_DATA * ch)
{
	CHAR_DATA *victim;
	CHAR_DATA *v_next;

	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 (!can_see(ch, victim))
			continue;
		if (get_timer(victim, TIMER_RECENTFIGHT) > 0)
			continue;
		if ((IS_NPC(victim) && nifty_is_name("imperial", victim->name)
		     && victim->fighting && who_fighting(victim) != ch) ||
		    (!IS_NPC(victim) && victim->pcdata && victim->pcdata->clan
		     && IS_AWAKE(victim)
		     && nifty_is_name("empire", victim->pcdata->clan->name))) {
			do_yell(ch, "Long live the New Republic!");
			multi_hit(ch, victim, TYPE_UNDEFINED);
			return TRUE;
		}

	}

	return FALSE;

}
コード例 #16
0
ファイル: special.c プロジェクト: danielkrainas/ganadia
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;

}
コード例 #17
0
ファイル: monmove.cpp プロジェクト: AkrionXxarr/Cataclysm-DDA
/* will_reach() is used for determining whether we'll get to stairs (and
 * potentially other locations of interest).  It is generally permissive.
 * TODO: Pathfinding;
         Make sure that non-smashing monsters won't "teleport" through windows
         Injure monsters if they're gonna be walking through pits or whatevs
 */
bool monster::will_reach(game *g, int x, int y)
{
 monster_attitude att = attitude(&(g->u));
 if (att != MATT_FOLLOW && att != MATT_ATTACK && att != MATT_FRIEND)
  return false;

 if (has_flag(MF_DIGS))
  return false;

 if (has_flag(MF_IMMOBILE) && (posx != x || posy != y))
  return false;

 if (has_flag(MF_SMELLS) && g->scent(posx, posy) > 0 &&
     g->scent(x, y) > g->scent(posx, posy))
  return true;

 if (can_hear() && wandf > 0 && rl_dist(wandx, wandy, x, y) <= 2 &&
     rl_dist(posx, posy, wandx, wandy) <= wandf)
  return true;

 int t;
 if (can_see() && g->m.sees(posx, posy, x, y, g->light_level(), t))
  return true;

 return false;
}
コード例 #18
0
/*
 * Check for parry.
 */
bool check_parry( CHAR_DATA *ch, CHAR_DATA *victim )
{
	int chance;

	if ( !IS_AWAKE(victim) )
		return FALSE;

	chance = get_skill(victim,gsn_parry) / 2;

	if ( get_eq_char( victim, WEAR_WIELD ) == NULL )
	{
		if (IS_NPC(victim))
			chance /= 2;
		else
			return FALSE;
	}

	if (!can_see(ch,victim))
		return FALSE;

	if ( dice_rolls(ch, chance,8) >= 1 )
		return FALSE;

	act( "You parry $n's attack.",  ch, NULL, victim, TO_VICT, 1 );
	act( "$N parries your attack.", ch, NULL, victim, TO_CHAR, 1 );
	return TRUE;
}
コード例 #19
0
ファイル: special.c プロジェクト: MUDOmnibus/Merc21-for-GCC4
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;
}
コード例 #20
0
ファイル: ant.cpp プロジェクト: Xenoveritas/abuse
// if we first saw the player or it's been a while since we've seen the player then do a scream
static void scream_check(game_object *o, game_object *b)
{
  if (can_see(o,o->x,o->y,b->x,b->y))
  {
    if (o->lvars[ANT_no_see_time]==0 || o->lvars[ANT_no_see_time]>20)
      the_game->play_sound(S_ASCREAM_SND,127,o->x,o->y);
    o->lvars[ANT_no_see_time]=1;
  } else o->lvars[ANT_no_see_time]++;
}
コード例 #21
0
ファイル: ant.cpp プロジェクト: Xenoveritas/abuse
static void fire_at_player(game_object *o, game_object *b)
{
  int32_t firex=o->x+(o->direction>0?15:-15),firey=o->y-15,
          playerx=b->x+b->xvel()*8,playery=b->y-15+b->yvel()*2;
  if (can_see(o,o->x,o->y,firex,firey) && can_see(o,firex,firey,playerx,playery))
  {
    int angle=lisp_atan2(firey-playery,playerx-firex);
    void *call_list=NULL;
    PtrRef r1(call_list);
    push_onto_list(LPointer::Create(b),call_list);
    push_onto_list(LNumber::Create(angle),call_list);
    push_onto_list(LNumber::Create(firey),call_list);
    push_onto_list(LNumber::Create(firex),call_list);
    push_onto_list(LNumber::Create(o->aitype()),call_list);
    push_onto_list(LPointer::Create(o),call_list);
    ((LSymbol *)l_fire_object)->EvalUserFunction((LList *)call_list);
    o->set_state((character_state)S_weapon_fire);
  }
}
コード例 #22
0
ファイル: ant.c プロジェクト: spippolatore/abuse
static void fire_at_player(game_object *o, game_object *b)
{
  long firex=o->x+(o->direction>0?15:-15),firey=o->y-15,
       playerx=b->x+b->xvel()*8,playery=b->y-15+b->yvel()*2;
  if (can_see(o,o->x,o->y,firex,firey) && can_see(o,firex,firey,playerx,playery))
  {
    int angle=lisp_atan2(firey-playery,playerx-firex);
    void *call_list=NULL;
    p_ref r1(call_list);
    push_onto_list(new_lisp_pointer(b),call_list);
    push_onto_list(new_lisp_number(angle),call_list);
    push_onto_list(new_lisp_number(firey),call_list);
    push_onto_list(new_lisp_number(firex),call_list);
    push_onto_list(new_lisp_number(o->aitype()),call_list);
    push_onto_list(new_lisp_pointer(o),call_list);
    eval_user_fun((lisp_symbol *)l_fire_object,call_list);
    o->set_state((character_state)S_weapon_fire);
  }
}
コード例 #23
0
ファイル: io.cpp プロジェクト: NotGoodAtCoding/CS327
void io_display(dungeon_t *d)
{
  uint32_t y, x;
  uint32_t illuminated;
  clear();
  for (y = 0; y < DUNGEON_Y; y++) {
    for (x = 0; x < DUNGEON_X; x++) {
      if ((illuminated = is_illuminated(d->pc, y, x))) {
        attron(A_BOLD);
      }
      if (d->charmap[y][x] &&
          can_see(d,
                  character_get_pos(d->pc),
                  character_get_pos(d->charmap[y][x]),
                  1)) {
        mvaddch(y + 1, x, character_get_symbol(d->charmap[y][x]));
      } else {
        switch (pc_learned_terrain(d->pc, y, x)) {
        case ter_wall:
        case ter_wall_immutable:
        case ter_unknown:
          mvaddch(y + 1, x, ' ');
          break;
        case ter_floor:
        case ter_floor_room:
          mvaddch(y + 1, x, '.');
          break;
        case ter_floor_hall:
          mvaddch(y + 1, x, '#');
          break;
        case ter_debug:
          mvaddch(y + 1, x, '*');
          break;
        case ter_stairs_up:
          mvaddch(y + 1, x, '<');
          break;
        case ter_stairs_down:
          mvaddch(y + 1, x, '>');
          break;
        default:
 /* Use zero as an error symbol, since it stands out somewhat, and it's *
  * not otherwise used.                                                 */
          mvaddch(y + 1, x, '0');
        }
      }
      if (illuminated) {
        attroff(A_BOLD);
      }
    }
  }

  io_print_message_queue(0, 0);

  refresh();
}
コード例 #24
0
static void npc_next_pos_14(dungeon *d, npc *c, pair_t next)
{
  /* pass wall; not smart; not telepathic;     tunneling; not erratic */
  if (can_see(d, character_get_pos(c), character_get_pos(d->PC), 0, 0)) {
    c->pc_last_known_position[dim_y] = character_get_y(d->PC);
    c->pc_last_known_position[dim_x] = character_get_x(d->PC);
    npc_next_pos_line_of_sight(d, c, next);
  } else {
    npc_next_pos_rand_pass(d, c, next);
  }
}
コード例 #25
0
static void npc_next_pos_00(dungeon *d, npc *c, pair_t next)
{
  /* not smart; not telepathic; not tunneling; not erratic */
  if (can_see(d, character_get_pos(c), character_get_pos(d->PC), 0, 0)) {
    c->pc_last_known_position[dim_y] = d->PC->position[dim_y];
    c->pc_last_known_position[dim_x] = d->PC->position[dim_x];
    npc_next_pos_line_of_sight(d, c, next);
  } else {
    npc_next_pos_rand(d, c, next);
  }
}
コード例 #26
0
ファイル: special.c プロジェクト: AndrewBudd/swr-fuss-ace
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;
}
コード例 #27
0
ファイル: pc.cpp プロジェクト: NotGoodAtCoding/CS327
void pc_observe_terrain(character *the_pc, dungeon_t *d)
{
  pair_t where;
  pc *p;
  int8_t y_min, y_max, x_min, x_max;

  p = (pc *) the_pc;

  y_min = p->position[dim_y] - PC_VISUAL_RANGE;
  if (y_min < 0) {
    y_min = 0;
  }
  y_max = p->position[dim_y] + PC_VISUAL_RANGE;
  if (y_max > DUNGEON_Y - 1) {
    y_max = DUNGEON_Y - 1;
  }
  x_min = p->position[dim_x] - PC_VISUAL_RANGE;
  if (x_min < 0) {
    x_min = 0;
  }
  x_max = p->position[dim_x] + PC_VISUAL_RANGE;
  if (x_max > DUNGEON_X - 1) {
    x_max = DUNGEON_X - 1;
  }

  for (where[dim_y] = y_min; where[dim_y] <= y_max; where[dim_y]++) {
    where[dim_x] = x_min;
    can_see(d, p->position, where, 1);
    where[dim_x] = x_max;
    can_see(d, p->position, where, 1);
  }
  /* Take one off the x range because we alreay hit the corners above. */
  for (where[dim_x] = x_min - 1; where[dim_x] <= x_max - 1; where[dim_x]++) {
    where[dim_y] = y_min;
    can_see(d, p->position, where, 1);
    where[dim_y] = y_max;
    can_see(d, p->position, where, 1);
  }       
}
コード例 #28
0
int monster::sight_range( const int light_level ) const
{
    // Non-aquatic monsters can't see much when submerged
    if( !can_see() || ( underwater && !has_flag( MF_SWIMS ) && !has_flag( MF_AQUATIC ) && !digging() ) ) {
        return 1;
    }

    int range = ( light_level * type->vision_day ) +
                ( ( DAYLIGHT_LEVEL - light_level ) * type->vision_night );
    range /= DAYLIGHT_LEVEL;

    return range;
}
コード例 #29
0
ファイル: boe.monster.cpp プロジェクト: PBrookfield/cboe-msvc
bool rand_move(char i)
{
	bool acted_yet = false;
	short j;
	location store_loc;
	
	// first, if outdoor, just roam. 
	if (is_out()) {
		store_loc = random_shift(univ.party.out_c[i].m_loc);
		return outdoor_move_monster(i,store_loc);
		}
		
	if (univ.town.monst[i].targ_loc == univ.town.monst[i].cur_loc)
		univ.town.monst[i].targ_loc.x = 0;
			
	// FIrst, try to move to monst_targs. If it don't work, then we'll shift.
	if (univ.town.monst[i].targ_loc.x > 0)
		acted_yet = seek_party(i,univ.town.monst[i].cur_loc,univ.town.monst[i].targ_loc);

	if (acted_yet == false) {
		univ.town.monst[i].targ_loc.x = 0;
		for (j = 0; j < 3; j++) {
			store_loc = univ.town.monst[i].cur_loc;
			store_loc.x += get_ran(1,0,24) - 12;
			store_loc.y += get_ran(1,0,24) - 12;
			if ((loc_off_act_area(store_loc) == false) && (can_see(univ.town.monst[i].cur_loc,store_loc,0) < 5)) {
				univ.town.monst[i].targ_loc = store_loc; j = 3;
				}
			}

		if (univ.town.monst[i].targ_loc.x == 0) {
			// maybe pick a wand loc, else juist pick a loc
			j = get_ran(1,0,3);
			store_loc = univ.town->wandering_locs[j];
			
			if ((loc_off_act_area(store_loc) == false) && (get_ran(1,0,1) == 1))
				univ.town.monst[i].targ_loc = store_loc;
				else {
				store_loc = univ.town.monst[i].cur_loc;
				store_loc.x += get_ran(1,0,20) - 10;
				store_loc.y += get_ran(1,0,20) - 10;
				if (loc_off_act_area(store_loc) == false)
					univ.town.monst[i].targ_loc = store_loc;
				}
			}
		if (univ.town.monst[i].targ_loc.x > 0)
			acted_yet = seek_party(i,univ.town.monst[i].cur_loc,univ.town.monst[i].targ_loc);
		}

	return acted_yet;
}
コード例 #30
0
ファイル: special.c プロジェクト: Tener/KillerMUD
bool spec_executioner( CHAR_DATA *ch )
{
    char buf[ MAX_STRING_LENGTH ];
    CHAR_DATA *victim;
    CHAR_DATA *v_next;
    char *crime;

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

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

        if ( !IS_NPC( victim ) && EXT_IS_SET( victim->act, PLR_KILLER )
             && can_see( ch, victim ) )
        {
            crime = "KILLER"; break;
        }

        if ( !IS_NPC( victim ) && EXT_IS_SET( victim->act, PLR_THIEF )
             && can_see( ch, victim ) )
        {
            crime = "THIEF"; break;
        }
    }

    if ( victim == NULL )
        return FALSE;

    sprintf( buf, "%s is a %s!  BRONIÆ NIEWINNYCH!  KRRRRWII!!!",
             victim->name, crime );
    REMOVE_BIT( ch->comm, COMM_NOSHOUT );
    do_function( ch, &do_yell, buf );
    multi_hit( ch, victim, TYPE_UNDEFINED );
    return TRUE;
}