?? magic.c
字號:
}
}
return;
}
void spell_infravision( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( IS_AFFECTED(victim, AFF_INFRARED) )
return;
act( "$n's eyes glow red.\n\r", ch, NULL, NULL, TO_ROOM );
af.type = sn;
af.duration = 2 * level;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_INFRARED;
affect_to_char( victim, &af );
send_to_char( "Your eyes glow red.\n\r", victim );
if ( ch != victim )
send_to_char( "Ok.\n\r", ch );
return;
}
void spell_invis( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( IS_AFFECTED(victim, AFF_INVISIBLE) )
return;
act( "$n fades out of existence.", victim, NULL, NULL, TO_ROOM );
af.type = sn;
af.duration = 24;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_INVISIBLE;
affect_to_char( victim, &af );
send_to_char( "You fade out of existence.\n\r", victim );
if ( ch != victim )
send_to_char( "Ok.\n\r", ch );
return;
}
void spell_know_alignment( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
char *msg;
int ap;
ap = victim->alignment;
if ( ap > 700 ) msg = "$N has an aura as white as the driven snow.";
else if ( ap > 350 ) msg = "$N is of excellent moral character.";
else if ( ap > 100 ) msg = "$N is often kind and thoughtful.";
else if ( ap > -100 ) msg = "$N doesn't have a firm moral commitment.";
else if ( ap > -350 ) msg = "$N lies to $S friends.";
else if ( ap > -700 ) msg = "$N's slash DISEMBOWELS you!";
else msg = "I'd rather just not say anything at all about $N.";
act( msg, ch, NULL, victim, TO_CHAR );
return;
}
void spell_lightning_bolt( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
static const sh_int dam_each[] =
{
0,
0, 0, 0, 0, 0, 0, 0, 0, 25, 28,
31, 34, 37, 40, 40, 41, 42, 42, 43, 44,
44, 45, 46, 46, 47, 48, 48, 49, 50, 50,
51, 52, 52, 53, 54, 54, 55, 56, 56, 57,
58, 58, 59, 60, 60, 61, 62, 62, 63, 64
};
int dam;
level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1);
level = UMAX(0, level);
dam = number_range( dam_each[level] / 2, dam_each[level] * 2 );
if ( saves_spell( level, victim ) )
dam /= 2;
damage( ch, victim, dam, sn );
return;
}
void spell_locate_object( int sn, int level, CHAR_DATA *ch, void *vo )
{
char buf[MAX_INPUT_LENGTH];
char buf1[32768]; // @@@ This is the limit to the response length...
OBJ_DATA *obj;
OBJ_DATA *in_obj;
bool found;
buf1[0] = '\0'; // @@@
found = FALSE;
for ( obj = object_list; obj != NULL; obj = obj->next )
{
if ( !can_see_obj( ch, obj ) || !is_name( target_name, obj->name ) )
continue;
found = TRUE;
for ( in_obj = obj; in_obj->in_obj != NULL; in_obj = in_obj->in_obj )
;
if ( in_obj->carried_by != NULL )
{
sprintf( buf, "%s carried by %s.\n\r",
obj->short_descr, PERS(in_obj->carried_by, ch) );
}
else
{
sprintf( buf, "%s in %s.\n\r",
obj->short_descr, in_obj->in_room == NULL
? "somewhere" : in_obj->in_room->name );
}
buf[0] = UPPER(buf[0]);
// send_to_char( buf, ch ); @@@
if (strlen(buf1) + strlen(buf) >= sizeof buf1 - 2) // @@@
break;
strcat(buf1, buf); // @@@
}
if ( !found )
send_to_char( "Nothing like that in hell, earth, or heaven.\n\r", ch );
else // @@@
send_to_char( buf1, ch ); // @@@
return;
}
void spell_magic_missile( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
static const sh_int dam_each[] =
{
0,
3, 3, 4, 4, 5, 6, 6, 6, 6, 6,
7, 7, 7, 7, 7, 8, 8, 8, 8, 8,
9, 9, 9, 9, 9, 10, 10, 10, 10, 10,
11, 11, 11, 11, 11, 12, 12, 12, 12, 12,
13, 13, 13, 13, 13, 14, 14, 14, 14, 14
};
int dam;
level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1);
level = UMAX(0, level);
dam = number_range( dam_each[level] / 2, dam_each[level] * 2 );
if ( saves_spell( level, victim ) )
dam /= 2;
damage( ch, victim, dam, sn );
return;
}
void spell_mass_invis( int sn, int level, CHAR_DATA *ch, void *vo )
{
AFFECT_DATA af;
CHAR_DATA *gch;
for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room )
{
if ( !is_same_group( gch, ch ) || IS_AFFECTED(gch, AFF_INVISIBLE) )
continue;
act( "$n slowly fades out of existence.", gch, NULL, NULL, TO_ROOM );
send_to_char( "You slowly fade out of existence.\n\r", gch );
af.type = sn;
af.duration = 24;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_INVISIBLE;
affect_to_char( gch, &af );
}
send_to_char( "Ok.\n\r", ch );
return;
}
void spell_null( int sn, int level, CHAR_DATA *ch, void *vo )
{
send_to_char( "That's not a spell!\n\r", ch );
return;
}
void spell_pass_door( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( IS_AFFECTED(victim, AFF_PASS_DOOR) )
return;
af.type = sn;
af.duration = number_fuzzy( level / 4 );
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_PASS_DOOR;
affect_to_char( victim, &af );
act( "$n turns translucent.", victim, NULL, NULL, TO_ROOM );
send_to_char( "You turn translucent.\n\r", victim );
return;
}
void spell_poison( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( saves_spell( level, victim ) )
return;
af.type = sn;
af.duration = level;
af.location = APPLY_STR;
af.modifier = -2;
af.bitvector = AFF_POISON;
affect_join( victim, &af );
send_to_char( "You feel very sick.\n\r", victim );
if ( ch != victim )
send_to_char( "Ok.\n\r", ch );
return;
}
void spell_protection( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( IS_AFFECTED(victim, AFF_PROTECT) )
return;
af.type = sn;
af.duration = 24;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_PROTECT;
affect_to_char( victim, &af );
send_to_char( "You feel protected.\n\r", victim );
if ( ch != victim )
send_to_char( "Ok.\n\r", ch );
return;
}
void spell_refresh( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
victim->move = UMIN( victim->move + level, victim->max_move );
send_to_char( "You feel less tired.\n\r", victim );
if ( ch != victim )
send_to_char( "Ok.\n\r", ch );
return;
}
void spell_remove_curse( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
if ( is_affected( victim, gsn_curse ) )
{
affect_strip( victim, gsn_curse );
send_to_char( "You feel better.\n\r", victim );
if ( ch != victim )
send_to_char( "Ok.\n\r", ch );
}
return;
}
void spell_sanctuary( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( IS_AFFECTED(victim, AFF_SANCTUARY) )
return;
af.type = sn;
af.duration = number_fuzzy( level / 8 );
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_SANCTUARY;
affect_to_char( victim, &af );
act( "$n is surrounded by a white aura.", victim, NULL, NULL, TO_ROOM );
send_to_char( "You are surrounded by a white aura.\n\r", victim );
return;
}
void spell_shield( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( is_affected( victim, sn ) )
return;
af.type = sn;
af.duration = 8 + level;
af.location = APPLY_AC;
af.modifier = -20;
af.bitvector = 0;
affect_to_char( victim, &af );
act( "$n is surrounded by a force shield.", victim, NULL, NULL, TO_ROOM );
send_to_char( "You are surrounded by a force shield.\n\r", victim );
return;
}
void spell_shocking_grasp( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
static const int dam_each[] =
{
0,
0, 0, 0, 0, 0, 0, 20, 25, 29, 33,
36, 39, 39, 39, 40, 40, 41, 41, 42, 42,
43, 43, 44, 44, 45, 45, 46, 46, 47, 47,
48, 48, 49, 49, 50, 50, 51, 51, 52, 52,
53, 53, 54, 54, 55, 55, 56, 56, 57, 57
};
int dam;
level = UMIN(level, sizeof(dam_each)/sizeof(dam_each[0]) - 1);
level = UMAX(0, level);
dam = number_range( dam_each[level] / 2, dam_each[level] * 2 );
if ( saves_spell( level, victim ) )
dam /= 2;
damage( ch, victim, dam, sn );
return;
}
void spell_sleep( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( IS_AFFECTED(victim, AFF_SLEEP)
|| level < victim->level
|| saves_spell( level, victim ) )
return;
af.type = sn;
af.duration = 4 + level;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_SLEEP;
affect_join( victim, &af );
if ( IS_AWAKE(victim) )
{
send_to_char( "You feel very sleepy ..... zzzzzz.\n\r", victim );
act( "$n goes to sleep.", victim, NULL, NULL, TO_ROOM );
victim->position = POS_SLEEPING;
}
return;
}
void spell_stone_skin( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( is_affected( ch, sn ) )
return;
af.type = sn;
af.duration = level;
af.location = APPLY_AC;
af.modifier = -40;
af.bitvector = 0;
affect_to_char( victim, &af );
act( "$n's skin turns to stone.", victim, NULL, NULL, TO_ROOM );
send_to_char( "Your skin turns to stone.\n\r", victim );
return;
}
void spell_summon( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim;
if ( ( victim = get_char_world( ch, target_name ) ) == NULL
|| victim == ch
|| victim->in_room == NULL
|| IS_SET(victim->in_room->room_flags, ROOM_SAFE)
|| IS_SET(victim->in_room->room_flags, ROOM_PRIVATE)
|| IS_SET(victim->in_room->room_flags, ROOM_SOLITARY)
|| IS_SET(victim->in_room->room_flags, ROOM_NO_RECALL)
|| victim->level >= level + 3
|| victim->fighting != NULL
|| victim->in_room->area != ch->in_room->area
|| (IS_NPC(victim) && saves_spell( level, victim ) ) )
{
send_to_char( "You failed.\n\r", ch );
return;
}
act( "$n disappears suddenly.", victim, NULL, NULL, TO_ROOM );
char_from_room( victim );
char_to_room( victim, ch->in_room );
act( "$n arrives suddenly.", victim, NULL, NULL, TO_ROOM );
act( "$N has summoned you!", ch, NULL, victim, TO_VICT );
do_look( victim, "auto" );
return;
}
void spell_teleport( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
ROOM_INDEX_DATA *pRoomIndex;
if ( victim->in_room == NULL
|| IS_SET(victim->in_room->room_flags, ROOM_NO_RECALL)
|| ( !IS_NPC(ch) && victim->fighting != NULL )
|| ( victim != ch
&& ( saves_spell( level, victim ) || saves_spell( level, victim ) ) ) )
{
send_to_char( "You failed.\n\r", ch );
return;
}
for ( ; ; )
{
pRoomIndex = get_room_index( number_range( 0, 65535 ) );
if ( pRoomIndex != NULL )
if ( !IS_SET(pRoomIndex->room_flags, ROOM_PRIVATE)
&& !IS_SET(pRoomIndex->room_flags, ROOM_SOLITARY) )
break;
}
act( "$n slowly fades out of existence.", victim, NULL, NULL, TO_ROOM );
char_from_room( victim );
char_to_room( victim, pRoomIndex );
act( "$n slowly fades into existence.", victim, NULL, NULL, TO_ROOM );
do_look( victim, "auto" );
return;
}
void spell_ventriloquate( int sn, int level, CHAR_DATA *ch, void *vo )
{
char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
char speaker[MAX_INPUT_LENGTH];
CHAR_DATA *vch;
target_name = one_argument( target_name, speaker );
sprintf( buf1, "%s says '%s'.\n\r", speaker, target_name );
sprintf( buf2, "Someone makes %s say '%s'.\n\r", speaker, target_name );
buf1[0] = UPPER(buf1[0]);
for ( vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room )
{
if ( !is_name( speaker, vch->name ) )
send_to_char( saves_spell( level, vch ) ? buf2 : buf1, vch );
}
return;
}
void spell_weaken( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( is_affected( victim, sn ) || saves_spell( level, victim ) )
return;
af.type = sn;
af.duration = level / 2;
af.location = APPLY_STR;
af.modifier = -2;
af.bitvector = 0;
affect_to_char( victim, &af );
send_to_char( "You feel weaker.\n\r", victim );
if ( ch != victim )
send_to_char( "Ok.\n\r", ch );
return;
}
/*
* This is for muds that _want_ scrolls of recall.
* Ick.
*/
void spell_word_of_recall( int sn, int level, CHAR_DATA *ch, void *vo )
{
do_recall( (CHAR_DATA *) vo, "" );
return;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -