本文整理汇总了C++中IS_NPC函数的典型用法代码示例。如果您正苦于以下问题:C++ IS_NPC函数的具体用法?C++ IS_NPC怎么用?C++ IS_NPC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IS_NPC函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: do_setquest
void do_setquest( CHAR_DATA *ch, char *argument )
{
char arg1[MIL],
arg2[MIL],
arg3[MIL],
arg4[MIL];
QUEST_DATA *quest;
int x;
set_char_color( AT_PLAIN, ch );
if ( IS_NPC( ch ) ) {
error( ch );
return;
}
if ( !IS_IMMORTAL( ch ) ) {
error( ch );
return;
}
if ( !ch->desc ) {
bug( "%s", "do_setquest (desc): no descriptor" );
return;
}
switch ( ch->substate ) {
default:
break;
case SUB_QUEST_DESC:
if ( !ch->dest_buf || !( quest = ( QUEST_DATA * ) ch->dest_buf ) ) {
bug( "%s: sub_quest_desc: NULL ch->dest_buf", __FUNCTION__ );
ch->substate = SUB_NONE;
return;
}
ch->dest_buf = NULL;
if ( VLD_STR( quest->desc ) )
STRFREE( quest->desc );
quest->desc = copy_buffer( ch );
stop_editing( ch );
write_quest_list( );
ch->substate = SUB_NONE;
return;
}
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if ( arg1[0] == '\0' ) {
send_to_char( "&cUsage: setquest save all\r\n", ch );
send_to_char( " setquest <&Cqname&c> create\r\n", ch );
send_to_char( " setquest <&Cqname&c> delete\r\n", ch );
send_to_char( " setquest <&Cqname&c> chapter <#> delete\r\n", ch );
send_to_char( " setquest <&Cqname&c> desc\r\n", ch );
send_to_char( " setquest <&Cqname&c> <&Cfield&c>\r\n", ch );
send_to_char( " setquest <&Cquest&c> remove <&Cplayer&c>\r\n", ch );
send_to_char( " showquest <&Cqname&c>\r\n", ch );
send_to_char( " Field being one of:\r\n", ch );
send_to_char( "level svnum stype chapters chapter timelimit skipchapters glory\r\n", ch );
send_to_char( "\r\nchapter <n> <field2>\r\n", ch );
send_to_char( " Field2 being one of:\r\n", ch );
send_to_char( "create delete svnum stype\r\n", ch );
send_to_char( "name timelimit level kamount\r\n", ch );
send_to_char( "Note: 3600 = 1 hour timelimit\r\n", ch );
return;
}
if ( ( !str_cmp( arg1, "tutorial" ) && ch->level < 108 )
|| ( !str_cmp( arg1, "etutorial" ) && ch->level < 108 ) || ( !str_cmp( arg1, "dtutorial" )
&& ch->level < 108 ) ) {
send_to_char( "You need Vladaar's permission to change anything with tutorials.\r\n", ch );
return;
}
if ( !str_cmp( arg1, "save" ) ) {
if ( !str_cmp( arg2, "all" ) ) {
write_quest_list( );
send_to_char( "All quests saved.\r\n", ch );
return;
}
}
quest = get_quest_from_name( arg1 );
if ( !str_cmp( arg2, "create" ) ) {
if ( quest && VLD_STR( quest->name ) && !str_cmp( quest->name, arg1 ) ) {
ch_printf( ch, "(%s): quest already exists!\r\n", quest->name );
return;
}
CREATE( quest, QUEST_DATA, 1 );
quest->name = STRALLOC( arg1 );
quest->number = -1;
add_new_quest( ch, quest );
write_quest_list( );
return;
}
if ( !quest ) {
//.........这里部分代码省略.........
开发者ID:jpavonabian,项目名称:6Dragones,代码行数:101,代码来源:quests.c
示例2: do_rpalignment
void do_rpalignment( CHAR_DATA *ch, char *argument )
{
char buf[MSL];
char arg[MAX_INPUT_LENGTH];
one_argument( argument, arg );
if (IS_NPC(ch)) return;
if (!IS_CLASS(ch,CLASS_RPONLY))
{
ch->pcdata->rpalign=RPALIGN_NONE;
return;
}
if ( arg[0] == '\0' )
{
send_to_char( "Please enter 'light', 'merc', 'none', or 'dark'.\n\r",ch );
return;
}
if (!str_cmp(arg,"light"))
{ //if(ch->pcdata->quest >=10000){
// ch->pcdata->quest -= 10000;
ch->pcdata->rpalign = RPALIGN_LIGHT;
send_to_char( "DDAlignment is now for the light.\n\r", ch );
sprintf(buf,"%s has chosen to be a warrior for the light.\n\r",ch->name);
do_info(NULL,buf);
}
//else
//send_to_char("You do not have the needed 10K qps.\n\r",ch);}
else if (!str_cmp(arg,"dark"))
{
//if(ch->pcdata->quest >=10000){
//ch->pcdata->quest -= 10000;
ch->pcdata->rpalign = RPALIGN_DARK;
send_to_char( "DDAlignment is now for the dark.\n\r", ch );
sprintf(buf,"%s has chosen to be a warrior for the darkness.\n\r",ch->name);
do_info(NULL,buf);
}
// }else
//send_to_char("You do not have the needed 10K qps.\n\r",ch);}
else if(!str_cmp(arg,"merc"))
{
//if(ch->pcdata->quest >=10000){
// ch->pcdata->quest -= 10000;
ch->pcdata->rpalign = RPALIGN_NEUTRAL;
send_to_char( "DDAlignment is now for neither light nor dark.\n\r", ch );
sprintf(buf,"%s has chosen to be a warrior for themselves.\n\r",ch->name);
do_info(NULL,buf);
}
// } else
//send_to_char("You do not have the needed 10K qps.\n\r",ch);}
else if(!str_cmp(arg,"love"))
{
if(ch->pcdata->quest >=1000000)
{
ch->pcdata->quest -= 1000000;
ch->pcdata->rpalign = RPALIGN_LOVE;
send_to_char( "DDAlignment is now for the heart and the soul.\n\r", ch );
sprintf(buf,"%s has chosen to be a warrior for Love.\n\r",ch->name);
do_info(NULL,buf);
}
else
send_to_char("You do not have the needed 1000K qps.\n\r",ch);
}
else if(!str_cmp(arg,"none"))
{
//if(ch->pcdata->quest >=20000){
//ch->pcdata->quest -= 20000;
ch->pcdata->rpalign = RPALIGN_NONE;
send_to_char( "Alignment is now none.\n\r", ch );
sprintf(buf,"%s has given up in the war between the light and dark.\n\r",ch->name);
do_info(NULL,buf);
}
//}else
//send_to_char("You do not have the needed 20K qps.\n\r",ch);}
else
{
send_to_char( "Please enter 'light', 'merc', 'none', or 'dark'.\n\r", ch );
return;
}
return;
}
开发者ID:pfchrono,项目名称:Anotherland_Mud,代码行数:88,代码来源:rpalign.c
示例3: do_finger
void do_finger( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
CHAR_DATA *victim;
FILE *fp;
bool fOld;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Finger whom?\n\r", ch );
return;
}
if ( ( victim = get_char_world( ch, arg ) ) != NULL)
{
if (!IS_NPC(victim))
{
act( "$N is on right now!", ch, NULL, victim, TO_CHAR );
return;
}
}
if(!check_valid_name(arg) && !IS_IMMORTAL(ch))
{
send_to_char("That's not a valid name.\n\r",ch);
}
victim = new_char();
victim->pcdata = new_pcdata();
fOld = FALSE;
fclose( fpReserve );
sprintf( buf, "%s%s", PLAYER_DIR, capitalize( arg ) );
if ( ( fp = fopen( buf, "r" ) ) != NULL )
{
int iNest;
for ( iNest = 0; iNest < MAX_NEST; iNest++ )
rgObjNest[iNest] = NULL;
fOld = TRUE;
for ( ; ; )
{
char letter;
char *word;
letter = fread_letter( fp );
if ( letter == '*' )
{
fread_to_eol( fp );
continue;
}
if ( letter != '#' )
{
bug( "do_finger: Load_char_obj: # not found.", 0 );
break;
}
word = fread_word( fp );
if ( !str_cmp( word, "PLAYER" ) ) fread_char( victim, fp );
else if ( !str_cmp( word, "OBJECT" ) ) break;
else if ( !str_cmp( word, "O" ) ) break;
else if ( !str_cmp( word, "PET" ) ) break;
else if ( !str_cmp( word, "BANK-ACCOUNT" ) ) break;
else if ( !str_cmp( word, "END" ) ) break;
else
{
bug( "Load_char_obj: bad section.", 0 );
break;
}
}
fclose( fp );
}
fpReserve = fopen( NULL_FILE, "r" );
if ( !fOld )
{
send_to_char("No player by that name exists.\n\r",ch);
free_pcdata(victim->pcdata);
free_char(victim);
return;
}
if ( (victim->level > LEVEL_HERO) && (victim->level > ch->level) )
{
send_to_char("The gods wouldn't like that.\n\r",ch);
free_pcdata(victim->pcdata);
free_char(victim);
return;
}
sprintf(buf,"%s last logged off on %s\n\r",
victim->name, (char *) ctime(&victim->llogoff));
send_to_char(buf,ch);
if(get_trust(ch) == MAX_LEVEL)
//.........这里部分代码省略.........
开发者ID:michaelmwu,项目名称:bota,代码行数:101,代码来源:finger.c
示例4: check_social
bool check_social (CHAR_DATA * ch, char *command, char *argument)
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
int cmd;
bool found;
found = FALSE;
for (cmd = 0; social_table[cmd].name[0] != '\0'; cmd++)
{
if (command[0] == social_table[cmd].name[0]
&& !str_prefix (command, social_table[cmd].name))
{
found = TRUE;
break;
}
}
if (!found)
return FALSE;
if (!IS_NPC (ch) && IS_SET (ch->comm, COMM_NOEMOTE))
{
send_to_char ("You are anti-social!\n\r", ch);
return TRUE;
}
switch (ch->position)
{
case POS_DEAD:
send_to_char ("Lie still; you are DEAD.\n\r", ch);
return TRUE;
case POS_INCAP:
case POS_MORTAL:
send_to_char ("You are hurt far too bad for that.\n\r", ch);
return TRUE;
case POS_STUNNED:
send_to_char ("You are too stunned to do that.\n\r", 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_table[cmd].name, "snore"))
break;
send_to_char ("In your dreams, or what?\n\r", ch);
return TRUE;
}
one_argument (argument, arg);
victim = NULL;
if (arg[0] == '\0')
{
act (social_table[cmd].others_no_arg, ch, NULL, victim, TO_ROOM);
act (social_table[cmd].char_no_arg, ch, NULL, victim, TO_CHAR);
}
else if ((victim = get_char_room (ch, arg)) == NULL)
{
send_to_char ("They aren't here.\n\r", ch);
}
else if (victim == ch)
{
act (social_table[cmd].others_auto, ch, NULL, victim, TO_ROOM);
act (social_table[cmd].char_auto, ch, NULL, victim, TO_CHAR);
}
else
{
act (social_table[cmd].others_found, ch, NULL, victim, TO_NOTVICT);
act (social_table[cmd].char_found, ch, NULL, victim, TO_CHAR);
act (social_table[cmd].vict_found, ch, NULL, victim, TO_VICT);
if (!IS_NPC (ch) && IS_NPC (victim)
&& !IS_AFFECTED (victim, AFF_CHARM)
&& IS_AWAKE (victim) && victim->desc == NULL)
{
switch (number_bits (4))
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
act (social_table[cmd].others_found,
victim, NULL, ch, TO_NOTVICT);
act (social_table[cmd].char_found, victim, NULL, ch,
TO_CHAR);
act (social_table[cmd].vict_found, victim, NULL, ch,
TO_VICT);
break;
//.........这里部分代码省略.........
开发者ID:MUDOmnibus,项目名称:TinyROM,代码行数:101,代码来源:interp.c
示例5: sp_damage
bool sp_damage( OBJ_DATA * obj, CHAR_DATA * ch, CHAR_DATA * victim, int dam, int type, int sn, bool show_msg )
{
int ch_strong, ch_weak, ch_race, ch_suscept, ch_resist, vi_strong, vi_weak, vi_race, vi_suscept, vi_resist;
float dam_modifier = 1.0;
float tmp = 0;
bool can_reflect = TRUE;
bool can_absorb = TRUE;
if ( victim == NULL )
return FALSE;
/*
* First, check caster's strengths and weaknesses.
*
*/
if ( IS_SET( type, NO_REFLECT ) )
{
REMOVE_BIT( type, NO_REFLECT );
can_reflect = FALSE;
}
if ( IS_SET( type, NO_ABSORB ) )
{
REMOVE_BIT( type, NO_ABSORB );
can_absorb = FALSE;
}
if ( obj == NULL )
{
if ( ( can_reflect )
&& ( skill_table[sn].target == TAR_CHAR_OFFENSIVE )
&& ( IS_AFFECTED( victim, AFF_CLOAK_REFLECTION ) )
&& ( ch != victim ) && ( number_percent( ) < ( victim->get_level("psuedo") - 70 ) ) )
{
act( "@@N$n's @@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@N glows brightly as $Nn's spell hits it, and the spell is [email protected]@N!!", ch,
victim, NULL, TO_ROOM );
act( "@@N$N's @@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@N glows brightly, and reflects your spell back on [email protected]@N!!", ch, NULL, victim,
TO_CHAR );
act( "@@NYour @@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@N glows brightly, and reflects the spell back on [email protected]@N!!!", victim, NULL, ch,
TO_CHAR );
( *skill_table[sn].spell_fun ) ( sn, 60, ch, ( void * )ch, NULL );
return FALSE;
}
else if ( ( can_reflect )
&& ( skill_table[sn].target == TAR_CHAR_OFFENSIVE )
&& ( IS_AFFECTED( victim, AFF_CLOAK_ABSORPTION ) )
&& ( ch != victim ) && ( number_percent( ) < ( victim->get_level("psuedo") - 55 ) ) )
{
int mana;
mana = mana_cost( ch, sn );
victim->mana = UMIN( victim->max_mana, victim->mana + mana );
act( "@@N$n's @@[email protected]@N glows brightly as $N's spell hits it, then [email protected]@N!!", victim, NULL, ch, TO_ROOM );
act( "@@N$N's @@[email protected]@N glows brightly, and absorbs your [email protected]@N!!", ch, NULL, victim, TO_CHAR );
act( "@@NYour @@[email protected]@N glows brightly, and absorbs $N's [email protected]@N!!!", victim, NULL, ch, TO_CHAR );
return FALSE;
}
ch_strong = ( IS_NPC( ch ) ?
( ( ( ch->race > 0 )
&& ( ch->race < MAX_RACE ) ) ?
race_table[ch->race].strong_realms : ch->npcdata->strong_magic ) : race_table[ch->race].strong_realms );
ch_resist = ( IS_NPC( ch ) ?
( ( ( ch->race > 0 )
&& ( ch->race < MAX_RACE ) ) ?
race_table[ch->race].resist_realms : ch->npcdata->resist ) : race_table[ch->race].resist_realms );
ch_weak = ( IS_NPC( ch ) ?
( ( ( ch->race > 0 )
&& ( ch->race < MAX_RACE ) ) ?
race_table[ch->race].weak_realms : ch->npcdata->weak_magic ) : race_table[ch->race].weak_realms );
ch_suscept = ( IS_NPC( ch ) ?
( ( ( ch->race > 0 )
&& ( ch->race < MAX_RACE ) ) ?
race_table[ch->race].suscept_realms : ch->npcdata->suscept ) : race_table[ch->race].suscept_realms );
ch_race = ( IS_NPC( ch ) ?
( ( ( ch->race > 0 )
&& ( ch->race < MAX_RACE ) ) ?
race_table[ch->race].race_flags : ch->race_mods ) : race_table[ch->race].race_flags );
if ( IS_SET( ch_strong, type ) )
{
dam_modifier += .35;
}
else if ( IS_SET( ch_weak, type ) )
{
dam_modifier -= .35;
}
if ( IS_SET( ch_race, RACE_MOD_STRONG_MAGIC ) )
{
dam_modifier += .25;
}
else if ( IS_SET( ch_race, RACE_MOD_WEAK_MAGIC ) )
{
//.........这里部分代码省略.........
开发者ID:Catcheeto,项目名称:ackfuss,代码行数:101,代码来源:spell_dam.c
示例6: do_simple_move
/* do_simple_move assumes
* 1. That there is no master and no followers.
* 2. That the direction exists.
*
* Returns :
* 1 : If succes.
* 0 : If fail
*/
int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
{
char throwaway[MAX_INPUT_LENGTH] = ""; /* Functions assume writable. */
room_rnum was_in;
int need_movement, moveadd = 0;
struct obj_data *k;
/*
* Check for special routines (North is 1 in command list, but 0 here) Note
* -- only check if following; this avoids 'double spec-proc' bug
*/
if (need_specials_check && special(ch, dir + 1, throwaway))
return (0);
/* blocked by a leave trigger ? */
if (!leave_mtrigger(ch, dir))
return 0;
if (!leave_wtrigger(&world[IN_ROOM(ch)], ch, dir))
return 0;
/* charmed? */
if (AFF_FLAGGED(ch, AFF_CHARM) && ch->master && IN_ROOM(ch) == IN_ROOM(ch->master)) {
send_to_char(ch, "The thought of leaving your master makes you weep.\r\n");
act("$n bursts into tears.", FALSE, ch, 0, 0, TO_ROOM);
return (0);
}
/* if this room or the one we're going to needs a boat, check for one */
if ((SECT(IN_ROOM(ch)) == SECT_WATER_NOSWIM) ||
(SECT(EXIT(ch, dir)->to_room) == SECT_WATER_NOSWIM)) {
if (!has_boat(ch)) {
send_to_char(ch, "You need a boat to go there.\r\n");
return (0);
}
}
/* move points needed is avg. move loss for src and destination sect type
* You know .. I don't like this system, let's base this not ONLY on terrain type
* but also on dex of char.
* Needs to adjust on max abils
* Original:
* need_movement = (movement_loss[SECT(IN_ROOM(ch))] +
movement_loss[SECT(EXIT(ch, dir)->to_room)]) / 2;
*/
if (GET_DEX(ch) <= 5) /* 0(1?)-5 Dex */
moveadd = 8;
if ((GET_DEX(ch) >= 6) && (GET_DEX(ch) <= 10)) /* 6-10 Dex */
moveadd = 6;
if ((GET_DEX(ch) >= 11) && (GET_DEX(ch) <= 15)) /* 11-15 Dex */
moveadd = 4;
if (GET_DEX(ch) >= 16) /* 16+ Up to ..? Dex */
moveadd = 2;
need_movement = (movement_loss[SECT(IN_ROOM(ch))] + movement_loss[SECT(EXIT(ch, dir)->to_room)] + moveadd) / 2;
if (GET_MOVE(ch) < need_movement && !IS_NPC(ch)) {
if (need_specials_check && ch->master)
send_to_char(ch, "You are too exhausted to follow.\r\n");
else
send_to_char(ch, "You are too exhausted.\r\n");
return (0);
}
if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_ATRIUM)) {
if (!House_can_enter(ch, GET_ROOM_VNUM(EXIT(ch, dir)->to_room))) {
send_to_char(ch, "That's private property -- no trespassing!\r\n");
return (0);
}
}
if (ROOM_FLAGGED(EXIT(ch, dir)->to_room, ROOM_TUNNEL) &&
num_pc_in_room(&(world[EXIT(ch, dir)->to_room])) >= tunnel_size) {
if (tunnel_size > 1)
send_to_char(ch, "There isn't enough room for you to go there!\r\n");
else
send_to_char(ch, "There isn't enough room there for more than one person!\r\n");
return (0);
}
/* Room big enough for you? */
if ((SIZE(EXIT(ch, dir)->to_room) < GET_SIZE(ch)) && (SIZE(EXIT(ch, dir)->to_room) != SIZE_SPECIAL) && (GET_LEVEL(ch) < LVL_GOD)) { //GOD+ can enter any room
send_to_char(ch, "You are too big to fit in there!\r\n");
return (0);
}
/* Mortals and low level gods cannot enter greater god rooms. */
/* irrelevant because of min/max level -mak 8.21.05 -reinstated 2.9.06
if (ROOM_FLAGGED(EXIT(ch, dir)->to_room, ROOM_GODROOM) &&
//.........这里部分代码省略.........
开发者ID:nitetrip,项目名称:nitetripCode,代码行数:101,代码来源:act.movement.c
示例7: perform_psidrain
void
perform_psidrain(struct creature *ch, struct creature *vict)
{
int find_distance(struct room_data *tmp, struct room_data *location);
int dist, drain, prob, percent;
if (!can_psidrain(ch, vict, &dist, true))
return;
if (AFF3_FLAGGED(vict, AFF3_PSISHIELD) && creature_distrusts(vict, ch)) {
prob = CHECK_SKILL(ch, SKILL_PSIDRAIN) + GET_INT(ch);
prob += skill_bonus(ch, SKILL_PSIDRAIN);
percent = skill_bonus(vict, SPELL_PSISHIELD);
percent += number(1, 120);
if (mag_savingthrow(vict, GET_LEVEL(ch), SAVING_PSI))
percent *= 2;
if (GET_INT(vict) > GET_INT(ch))
percent += (GET_INT(vict) - GET_INT(ch)) * 8;
if (percent >= prob) {
act("Your attack is deflected by $N's psishield!",
false, ch, NULL, vict, TO_CHAR);
act("$n's psychic attack is deflected by your psishield!",
false, ch, NULL, vict, TO_VICT);
act("$n staggers under an unseen force.",
true, ch, NULL, vict, TO_NOTVICT);
return;
}
}
if (GET_MANA(vict) <= 0) {
act("$E is completely drained of psychic energy.",
true, ch, NULL, vict, TO_CHAR);
return;
}
drain = dice(GET_LEVEL(ch), GET_INT(ch) + GET_REMORT_GEN(ch)) +
CHECK_SKILL(ch, SKILL_PSIDRAIN);
if (dist > 0)
drain /= dist + 1;
drain /= 4;
drain = MAX(0, MIN(GET_MANA(vict), drain));
prob = CHECK_SKILL(ch, SKILL_PSIDRAIN) + GET_INT(ch) +
(AFF3_FLAGGED(vict, AFF3_PSISHIELD) ? -20 : 0);
if (is_fighting(vict))
prob += 15;
if (dist > 0)
prob -= dist * 3;
act("$n strains against an unseen force.", false, ch, NULL, vict, TO_ROOM);
//
// failure
//
if (number(0, 121) > prob) {
send_to_char(ch, "You are unable to create the drainage link!\r\n");
WAIT_STATE(ch, 2 RL_SEC);
if (IS_NPC(vict) && !is_fighting(vict)) {
if (ch->in_room == vict->in_room) {
add_combat(vict, ch, false);
add_combat(ch, vict, true);
} else {
remember(vict, ch);
if (NPC2_FLAGGED(vict, NPC2_HUNT))
start_hunting(vict, ch);
}
}
}
//
// success
//
else {
act("A torrent of psychic energy is ripped out of $N's mind!",
false, ch, NULL, vict, TO_CHAR);
if (ch->in_room != vict->in_room &&
GET_LEVEL(vict) + number(0, CHECK_SKILL(vict, SKILL_PSIDRAIN)) >
GET_LEVEL(ch))
act("Your psychic energy is ripped from you from afar!",
false, ch, NULL, vict, TO_VICT);
else
act("Your psychic energy is ripped from you by $n!",
false, ch, NULL, vict, TO_VICT);
GET_MANA(vict) -= drain;
GET_MANA(ch) = MIN(GET_MAX_MANA(ch), GET_MANA(ch) + drain);
GET_MOVE(ch) -= 20;
WAIT_STATE(vict, 1 RL_SEC);
//.........这里部分代码省略.........
开发者ID:TempusMUD,项目名称:Tempuscode,代码行数:101,代码来源:act.psionic.c
示例8: do_track
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);
}
//.........这里部分代码省略.........
开发者ID:blanciq,项目名称:bq-killer,代码行数:101,代码来源:track.c
示例9: hunt_victim
void hunt_victim( CHAR_DATA *ch )
{
CHAR_DATA *tmp;
int dir,chance;
bool found;
if ( !ch || !ch->hunting )
{
return;
}
/*
* Make sure the victim still exists.
*/
for ( found = FALSE, tmp = char_list; tmp && !found; tmp = tmp->next )
{
if ( ch->hunting == tmp )
{
found = TRUE;
}
}
if ( !can_move( ch) || !found || !can_see( ch, ch->hunting ) )
{
stop_hunting( ch );
return;
}
if ( ch->in_room == ch->hunting->in_room )
{
if ( ch->fighting )
return;
found_prey( ch, ch->hunting );
return;
}
if ( !IS_NPC ( ch ) )
{
WAIT_STATE( ch, skill_table[gsn_track].beats );
}
dir = find_path( ch->in_room->vnum, ch->hunting->in_room->vnum, ch, -40000, TRUE );
if ( dir < 0 || dir >= MAX_DIR )
{
stop_hunting( ch );
return;
}
/*
* Give a random direction if the mob misses the die roll.
*
* 20% for PC
* 2% for NPC
*/
chance = IS_NPC ( ch ) ? 2 : 20;
if ( number_percent( ) < chance + 1 )
{
do
{
dir = number_door( );
}
while ( !( ch->in_room->exit[dir] )
|| !( ch->in_room->exit[dir]->u1.to_room ) );
}
if ( IS_SET(ch->in_room->exit[dir]->exit_info, EX_SECRET) &&
!IS_SET(ch->in_room->exit[dir]->exit_info, EX_HIDDEN) &&
IS_AFFECTED(ch, AFF_DETECT_HIDDEN) )
{
// do_secret(ch, (char *)dir_name[dir]);
return;
}
if ( IS_SET( ch->in_room->exit[dir]->exit_info, EX_CLOSED ) )
{
do_open( ch, (char *) dir_name[dir] );
return;
}
if( IS_SET(sector_table[ch->in_room->exit[dir]->u1.to_room->sector_type].flag, SECT_UNDERWATER)
|| IS_SET(ch->in_room->exit[dir]->exit_info, EX_NO_MOB)
|| EXT_IS_SET(ch->in_room->exit[dir]->u1.to_room->room_flags, ROOM_NO_MOB)
|| ( EXT_IS_SET(ch->act, ACT_STAY_AREA)
&& ch->in_room->exit[dir]->u1.to_room->area != ch->in_room->area )
|| ( EXT_IS_SET(ch->act, ACT_STAY_SECTOR)
&& ch->in_room->exit[dir]->u1.to_room->sector_type != ch->in_room->sector_type )
|| ( EXT_IS_SET(ch->act, ACT_OUTDOORS)
&& EXT_IS_SET(ch->in_room->exit[dir]->u1.to_room->room_flags,ROOM_INDOORS))
|| ( EXT_IS_SET(ch->act, ACT_INDOORS)
&& EXT_IS_SET(ch->in_room->exit[dir]->u1.to_room->room_flags,ROOM_INDOORS)))
return;
move_char( ch, dir, FALSE, NULL );
if ( !ch->hunting )
{
if ( !ch->in_room )
{
//.........这里部分代码省略.........
开发者ID:blanciq,项目名称:bq-killer,代码行数:101,代码来源:track.c
示例10: do_mposet
void do_mposet( CHAR_DATA * ch, const char *argument )
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
char arg3[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
OBJ_DATA *obj;
char outbuf[MAX_STRING_LENGTH];
int value, tmp;
/*
* A desc means switched.. too many loopholes if we allow that..
*/
if ( !IS_NPC( ch ) || IS_AFFECTED( ch, AFF_CHARM ) || ch->desc )
{
send_to_char( "Huh?\r\n", ch );
return;
}
smash_tilde( argument );
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
mudstrlcpy( arg3, argument, MAX_INPUT_LENGTH );
if ( !*arg1 )
{
progbug( "MpOset: no args", ch );
return;
}
if ( ( obj = get_obj_here( ch, arg1 ) ) == NULL )
{
progbug( "MpOset: no object", ch );
return;
}
if ( IS_OBJ_STAT( obj, ITEM_PROTOTYPE ) )
{
progbug( "MpOset: can't set prototype items", ch );
return;
}
separate_obj( obj );
value = atoi( arg3 );
if ( !str_cmp( arg2, "value0" ) || !str_cmp( arg2, "v0" ) )
{
obj->value[0] = value;
return;
}
if ( !str_cmp( arg2, "value1" ) || !str_cmp( arg2, "v1" ) )
{
obj->value[1] = value;
return;
}
if ( !str_cmp( arg2, "value2" ) || !str_cmp( arg2, "v2" ) )
{
obj->value[2] = value;
return;
}
if ( !str_cmp( arg2, "value3" ) || !str_cmp( arg2, "v3" ) )
{
obj->value[3] = value;
return;
}
if ( !str_cmp( arg2, "value4" ) || !str_cmp( arg2, "v4" ) )
{
obj->value[4] = value;
return;
}
if ( !str_cmp( arg2, "value5" ) || !str_cmp( arg2, "v5" ) )
{
obj->value[5] = value;
return;
}
if ( !str_cmp( arg2, "type" ) )
{
if ( !argument || argument[0] == '\0' )
{
progbug( "MpOset: no type", ch );
return;
}
value = get_otype( argument );
if ( value < 1 )
{
progbug( "MpOset: Invalid type", ch );
return;
}
obj->item_type = ( short ) value;
return;
}
if ( !str_cmp( arg2, "flags" ) )
{
//.........这里部分代码省略.........
开发者ID:andycervantes,项目名称:SMAUG-Pi,代码行数:101,代码来源:mpxset.c
示例11: do_mapout
void do_mapout( CHAR_DATA* ch, const char* argument)
{
char arg[MAX_INPUT_LENGTH];
OBJ_DATA *map_obj; /* an obj made with map as an ed */
OBJ_INDEX_DATA *map_obj_index; /* obj_index for previous */
EXTRA_DESCR_DATA *ed; /* the ed for it to go in */
int rooms, rows, cols, avail_rooms;
if( !ch )
{
bug( "%s", "do_mapout: null ch" );
return;
}
if( IS_NPC( ch ) )
{
send_to_char( "Not in mobs.\r\n", ch );
return;
}
if( !ch->desc )
{
bug( "%s", "do_mapout: no descriptor" );
return;
}
switch ( ch->substate )
{
default:
break;
case SUB_WRITING_NOTE:
if( ch->dest_buf != ch->pnote )
bug( "%s", "do_mapout: sub_writing_map: ch->dest_buf != ch->pnote" );
STRFREE( ch->pnote->text );
ch->pnote->text = copy_buffer( ch );
stop_editing( ch );
return;
}
set_char_color( AT_NOTE, ch );
argument = one_argument( argument, arg );
smash_tilde( argument );
if( !str_cmp( arg, "stat" ) )
{
if( !ch->pnote )
{
send_to_char( "You have no map in progress.\r\n", ch );
return;
}
map_stats( ch, &rooms, &rows, &cols );
ch_printf( ch, "Map represents %d rooms, %d rows, and %d columns\r\n", rooms, rows, cols );
avail_rooms = num_rooms_avail( ch );
ch_printf( ch, "You currently have %d unused rooms.\r\n", avail_rooms );
act( AT_ACTION, "$n glances at an etherial map.", ch, NULL, NULL, TO_ROOM );
return;
}
if( !str_cmp( arg, "write" ) )
{
note_attach( ch );
ch->substate = SUB_WRITING_NOTE;
ch->dest_buf = ch->pnote;
start_editing( ch, ch->pnote->text );
return;
}
if( !str_cmp( arg, "clear" ) )
{
if( !ch->pnote )
{
send_to_char( "You have no map in progress\r\n", ch );
return;
}
STRFREE( ch->pnote->text );
STRFREE( ch->pnote->subject );
STRFREE( ch->pnote->to_list );
STRFREE( ch->pnote->date );
STRFREE( ch->pnote->sender );
DISPOSE( ch->pnote );
ch->pnote = NULL;
send_to_char( "Map cleared.\r\n", ch );
return;
}
if( !str_cmp( arg, "show" ) )
{
if( !ch->pnote )
{
send_to_char( "You have no map in progress.\r\n", ch );
return;
}
send_to_char( ch->pnote->text, ch );
do_mapout( ch, "stat" );
return;
}
if( !str_cmp( arg, "create" ) )
{
if( !ch->pnote )
{
send_to_char( "You have no map in progress.\r\n", ch );
return;
}
map_stats( ch, &rooms, &rows, &cols );
//.........这里部分代码省略.........
开发者ID:Igdra,项目名称:smaugfuss,代码行数:101,代码来源:mapout.c
示例12: do_mpmset
void do_mpmset( CHAR_DATA * ch, const char *argument )
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
char arg3[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
char log_buf[MAX_STRING_LENGTH];
char outbuf[MAX_STRING_LENGTH];
CHAR_DATA *victim;
int value, v2;
int minattr, maxattr;
/*
* A desc means switched.. too many loopholes if we allow that..
*/
if ( !IS_NPC( ch ) || IS_AFFECTED( ch, AFF_CHARM ) || ch->desc )
{
send_to_char( "Huh?\r\n", ch );
return;
}
smash_tilde( argument );
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
mudstrlcpy( arg3, argument, MAX_INPUT_LENGTH );
if ( !*arg1 )
{
progbug( "MpMset: no args", ch );
return;
}
if ( ( victim = get_char_room( ch, arg1 ) ) == NULL )
{
progbug( "MpMset: no victim", ch );
return;
}
if ( IS_IMMORTAL( victim ) )
{
send_to_char( "You can't do that!\r\n", ch );
return;
}
if ( IS_NPC( victim ) && xIS_SET( victim->act, ACT_PROTOTYPE ) )
{
progbug( "MpMset: victim is proto", ch );
return;
}
if ( IS_NPC( victim ) )
{
minattr = 1;
maxattr = 25;
}
else
{
minattr = 3;
maxattr = 18;
}
value = is_number( arg3 ) ? atoi( arg3 ) : -1;
if ( atoi( arg3 ) < -1 && value == -1 )
value = atoi( arg3 );
if ( !str_cmp( arg2, "str" ) )
{
if ( value < minattr || value > maxattr )
{
progbug( "MpMset: Invalid str", ch );
return;
}
victim->perm_str = value;
return;
}
if ( !str_cmp( arg2, "int" ) )
{
if ( value < minattr || value > maxattr )
{
progbug( "MpMset: Invalid int", ch );
return;
}
victim->perm_int = value;
return;
}
if ( !str_cmp( arg2, "wis" ) )
{
if ( value < minattr || value > maxattr )
{
progbug( "MpMset: Invalid wis", ch );
return;
}
victim->perm_wis = value;
return;
}
if ( !str_cmp( arg2, "dex" ) )
//.........这里部分代码省略.........
开发者ID:andycervantes,项目名称:SMAUG-Pi,代码行数:101,代码来源:mpxset.c
示例13: do_journal
void do_journal( CHAR_DATA *ch, char *argument )
{
QUEST_DATA *quest;
CHQUEST_DATA *chquest;
CHAP_DATA *chap;
char arg1[MIL],
arg2[MIL];
char *chapdesc;
int x = 0,
total = 0,
cando = 0,
done = 0,
num = 0,
progress = 0,
avail = 0;
bool found = FALSE,
completed = FALSE;
set_char_color( AT_PLAIN, ch );
if ( IS_NPC( ch ) ) {
error( ch );
return;
}
argument = one_argument( argument, arg1 );
if ( VLD_STR( arg1 ) && !str_cmp( arg1, "completados" ) ) {
completed = TRUE;
argument = one_argument( argument, arg1 );
}
argument = one_argument( argument, arg2 );
if ( !arg1 || arg1[0] == '\0' ) {
char questtime[MSL] = "";
char chaptime[MSL] = "";
char minsecs[MSL] = "";
int time = 0,
mins = 0,
secs = 0;
ch_printf( ch, "\r\n&YQUESTS De %s&D\r\n\r\n", ch->name );
send_to_char( "&cNIV Quest Capítulo Progreso&D\r\n", ch );
for ( quest = first_quest; quest; quest = quest->next ) {
num = quest->number;
total++;
if ( ch->level < quest->level )
continue;
cando++;
for ( chquest = ch->pcdata->first_quest; chquest; chquest = chquest->next ) {
if ( chquest->questnum == quest->number ) {
progress = chquest->progress;
break;
}
}
if ( !progress || !chquest )
continue;
chap = get_chap_from_quest( progress, quest );
if ( !completed ) {
if ( progress > quest->chapters ) {
done++;
continue;
}
if ( !chap )
continue;
if ( chap && chap->desc )
chapdesc = chap->desc;
else
chapdesc = ( char * ) "NULL: No desc for this chapter.";
}
else { /* Only show completed quest */
if ( progress > quest->chapters ) {
chapdesc = ( char * ) "¡quest completado!";
done++;
}
else
continue;
}
avail++;
if ( ch->level == quest->level )
send_to_char( "&Y", ch );
else if ( quest->level >= ( ch->level - 3 ) )
send_to_char( "&G", ch );
else
send_to_char( "&z", ch );
ch_printf( ch, "%3d %20s %7d %s", quest->level, capitalize( quest->name ), progress,
chapdesc );
if ( chquest->kamount > 0 )
ch_printf( ch, "&R(%d)&D", chquest->kamount );
send_to_char( "\r\n", ch );
//.........这里部分代码省略.........
开发者ID:jpavonabian,项目名称:6Dragones,代码行数:101,代码来源:quests.c
示例14: do_showquest
void do_showquest( CHAR_DATA *ch, char *argument )
{
char arg[MSL],
arg2[MSL];
CHAP_DATA *chap;
int count = 0;
QUEST_DATA *quest;
int x,
y;
if ( !ch || IS_NPC( ch ) )
return;
argument = one_argument( argument, arg );
argument = one_argument( argument, arg2 );
if ( !arg || arg[0] == '\0' ) {
ch_printf( ch, "&Y%4s %3s %20s %4s %3s %5s %6s %s&D\r\n", "Num", "Lvl", "Name", "Desc",
"Cha", "Lmt", "Type", "Vnum" );
for ( quest = first_quest; quest; quest = quest->next ) {
count++;
ch_printf( ch, "&G%4d &R%3d &W%20s %s &R%3d %5d &W%6s &w%d%s &w%d&D\r\n", quest->number,
quest->level, quest->name, quest->desc ? " &GY" : " &RN",
quest->chapters, quest->timelimit,
( quest->stype == 0 ) ? "Mobile" : ( quest->stype ==
1 ) ? "Object" : ( quest->stype ==
2 ) ? "Room" :
"Unknown", quest->svnum, quest->skipchapters ? " &GCan Skip" : "",
quest->glory );
}
ch_printf( ch, "\r\n&G%d &wquests.&D\r\n", count );
return;
}
quest = get_quest_from_name( arg );
if ( !quest ) {
send_to_char( "No such quest. Use 'showquest [(questname)] [(chapter #)]'.\r\n", ch );
return;
}
ch_printf( ch, "\r\n&zName:&w %s\r\n", quest->name );
ch_printf( ch, "&zMin Level:&w %-3d &zChapters:&w %-3d &zTime Limit:&w %-5d\r\n",
quest->level, quest->chapters, quest->timelimit );
ch_printf( ch, "&zSkipChapters: &w%s\r\n", quest->skipchapters ? "Yes" : "No" );
ch_printf( ch, "&zGlory: %d\r\n", quest->glory );
if ( !arg2 || arg2[0] == '\0' ) {
for ( chap = quest->first_chapter; chap; chap = chap->next )
ch_printf( ch,
"&c - Chapter &C%d&c - Minlev: &C%d &cTLimit: &C%d &cKAmount: &C%d &cName:&C %s\r\n",
chap->number, chap->level, chap->timelimit, chap->kamount, chap->desc );
return;
}
if ( !is_number( arg2 ) ) {
send_to_char( "Use 'showquest [(questname)] [(chapter #)]'.\r\n", ch );
return;
}
chap = get_chap_from_quest( atoi( arg2 ), quest );
if ( !chap ) {
send_to_char( "No such chapter to display.\r\n", ch );
return;
}
ch_printf( ch, "&c - Chapter &C%d&c - Name:&C %s\r\n\r\n&cDESC - &C%s", chap->number,
chap->desc, chap->bio ? chap->bio : "(not yet entered)" );
}
开发者ID:jpavonabian,项目名称:6Dragones,代 |
请发表评论