magic.c
tmw/orig/magic.c · 222.2 KB
From the archive tmw.tar.gz
Download the archive « Back to the archive contents
/***************************************************************************
* Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, *
* Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe. *
* *
* Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael *
* Chastain, Michael Quan, and Mitchell Tse. *
* *
* Envy Diku Mud improvements copyright (C) 1994 by Michael Quan, David *
* Love, Guilherme 'Willie' Arnold, and Mitchell Tse. *
* *
* In order to use any part of this Envy Diku Mud, you must comply with *
* the original Diku license in 'license.doc', the Merc license in *
* 'license.txt', as well as the Envy license in 'license.nvy'. *
* In particular, you may not remove either of these copyright notices. *
* *
* Much time and thought has gone into this software and you are *
* benefitting. We hope that you share your changes too. What goes *
* around, comes around. *
***************************************************************************/
#define unix 1
#if defined( macintosh )
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"
/*
* External functions.
*/
bool is_safe args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
void set_fighting args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
/*
* Local functions.
*/
void say_spell args( ( CHAR_DATA *ch, int sn ) );
int blood_count args( ( OBJ_DATA *list, int amount ) );
void magic_mob args( ( CHAR_DATA *ch, OBJ_DATA *obj, int vnum ) );
int slot_lookup args( ( int slot ) );
int sc_dam args( ( CHAR_DATA *ch, int dam ) );
/*
* "Permament sn's": slot loading for objects -- Altrag
*/
int slot_lookup( int slot )
{
int sn;
for ( sn = 0; skill_table[sn].name[0] != '\0'; sn++ )
if ( skill_table[sn].slot == slot )
return sn;
bug( "Slot_lookup: no such slot #%d", slot );
return 0;
}
/*
* Replacement for MAX_SKILL -- Altrag
*/
bool is_sn( int sn )
{
int cnt;
for ( cnt = 0; skill_table[cnt].name[0] != '\0'; cnt++ )
if ( cnt == sn )
return TRUE;
return FALSE;
}
void magic_mob ( CHAR_DATA *ch, OBJ_DATA *obj, int vnum )
{
CHAR_DATA *victim;
CHAR_DATA *zombie;
MOB_INDEX_DATA *ZombIndex;
MOB_INDEX_DATA *pMobIndex;
char *name;
char buf [MAX_STRING_LENGTH];
if ( !( pMobIndex = get_mob_index( vnum ) ) )
{
send_to_char(AT_BLUE, "Nothing happens.\n\r", ch);
return;
}
ZombIndex = get_mob_index( 3 );
victim = create_mobile( pMobIndex );
zombie = create_mobile( ZombIndex );
name = victim->short_descr;
sprintf( buf, zombie->short_descr, name );
free_string( zombie->short_descr );
zombie->short_descr = str_dup(buf);
sprintf( buf, zombie->long_descr, name );
free_string( zombie->long_descr );
zombie->long_descr = str_dup(buf);
victim->perm_hit /= 2;
victim->hit = MAX_HIT(victim);
zombie->mod_hit = victim->mod_hit;
zombie->perm_hit = victim->perm_hit;
zombie->hit = victim->hit;
zombie->level = victim->level;
SET_BIT( zombie->act, ACT_UNDEAD );
SET_BIT( zombie->act, ACT_PET );
SET_BIT( zombie->affected_by, AFF_CHARM );
char_to_room( zombie, ch->in_room );
add_follower( zombie, ch );
update_pos( zombie );
act( AT_BLUE, "$n passes $s hands over $p, $E slowly rises to serve $S new master.", ch, obj, zombie, TO_ROOM );
act( AT_BLUE, "You animate $p, it rises to serve you.", ch, obj, NULL, TO_CHAR );
char_to_room( victim, ch->in_room );
extract_char ( victim, TRUE );
return;
}
int blood_count( OBJ_DATA *list, int amount )
{
OBJ_DATA *obj;
int count;
OBJ_DATA *obj_next;
count = 0;
for ( obj = list; obj; obj = obj_next )
{
obj_next = obj->next_content;
if ( obj->deleted )
continue;
if ( ( obj->item_type == ITEM_BLOOD ) && ( count != amount ) )
{
count++;
extract_obj( obj );
}
}
return count;
}
void update_skpell( CHAR_DATA *ch, int sn )
{
int xp = 0;
char buf[MAX_STRING_LENGTH];
int adept;
if ( IS_NPC( ch ) )
return;
adept = IS_NPC( ch ) ? 100 :
class_table[prime_class( ch )].skill_adept;
if ( ch->pcdata->learned[sn] <= 0
|| ch->pcdata->learned[sn] >= adept )
return;
ch->pcdata->learned[sn] += ( get_curr_wis( ch ) / 5 );
if ( ch->pcdata->learned[sn] > adept )
ch->pcdata->learned[sn] = adept;
xp = ch->level / 5;
if ( xp < 2 )
xp = 2;
xp = number_range( xp * 2, ( xp * xp ) / 3 );
if (!(ch->fighting))
{
sprintf( buf, "You gain %d experience for your success with %s.\n\r",
xp, skill_table[sn].name );
send_to_char( C_DEFAULT, buf, ch );
}
gain_exp( ch, xp );
return;
}
int skill_lookup( const char *name )
{
int sn;
for ( sn = 0; skill_table[sn].name[0] != '\0'; sn++ )
{
if ( !skill_table[sn].name )
break;
if ( LOWER( name[0] ) == LOWER( skill_table[sn].name[0] )
&& !str_prefix( name, skill_table[sn].name ) )
return sn;
}
return -1;
}
/*
* Utter mystical words for an sn.
*/
void say_spell( CHAR_DATA *ch, int sn )
{
CHAR_DATA *rch;
char *pName;
char buf [ MAX_STRING_LENGTH ];
char buf2 [ MAX_STRING_LENGTH ];
int iSyl;
int length;
struct syl_type
{
char * old;
char * new;
};
static const struct syl_type syl_table [ ] =
{
{ " ", " " },
{ "ar", "abra" },
{ "au", "kada" },
{ "bless", "fido" },
{ "blind", "nose" },
{ "bur", "mosa" },
{ "cu", "judi" },
{ "de", "oculo" },
{ "en", "unso" },
{ "light", "dies" },
{ "lo", "hi" },
{ "mor", "zak" },
{ "move", "sido" },
{ "ness", "lacri" },
{ "ning", "illa" },
{ "per", "duda" },
{ "ra", "gru" },
{ "re", "candus" },
{ "son", "sabru" },
{ "tect", "infra" },
{ "tri", "cula" },
{ "ven", "nofo" },
{ "a", "a" }, { "b", "b" }, { "c", "q" }, { "d", "e" },
{ "e", "z" }, { "f", "y" }, { "g", "o" }, { "h", "p" },
{ "i", "u" }, { "j", "y" }, { "k", "t" }, { "l", "r" },
{ "m", "w" }, { "n", "i" }, { "o", "a" }, { "p", "s" },
{ "q", "d" }, { "r", "f" }, { "s", "g" }, { "t", "h" },
{ "u", "j" }, { "v", "z" }, { "w", "x" }, { "x", "n" },
{ "y", "l" }, { "z", "k" },
{ "", "" }
};
buf[0] = '\0';
for ( pName = skill_table[sn].name; *pName != '\0'; pName += length )
{
for ( iSyl = 0;
( length = strlen( syl_table[iSyl].old ) ) != 0;
iSyl++ )
{
if ( !str_prefix( syl_table[iSyl].old, pName ) )
{
strcat( buf, syl_table[iSyl].new );
break;
}
}
if ( length == 0 )
length = 1;
}
sprintf( buf2, "$n %s the words, '%s'.",
"utters", buf );
sprintf( buf, "$n %s the words, '%s'.",
"utters", skill_table[sn].name );
for ( rch = ch->in_room->people; rch; rch = rch->next_in_room )
{
if ( rch != ch )
act(AT_BLUE,
is_class( rch, prime_class(ch) )
? buf
: buf2, ch, NULL, rch, TO_VICT );
}
return;
}
/*
* Compute a saving throw.
* Negative apply's make saving throw better.
*/
bool saves_spell( int level, CHAR_DATA *victim )
{
int save;
int base = 20;
int savebase;
if ( IS_NPC( victim ) )
base += 30;
savebase = 0 - victim->saving_throw / 2;
if ( victim->race == RACE_DWARF )
savebase += 25 * savebase / 100;
if ( !IS_NPC( victim ) )
savebase /= 6;
else
savebase /= 2;
save = base + ( victim->level - level ) + savebase;
save = URANGE( 5, save, ( victim->race == RACE_DWARF ) ? 95 : 90 );
return number_percent( ) < save;
}
/*
* The kludgy global is for spells who want more stuff from command line.
*/
char *target_name;
void do_acspell ( CHAR_DATA *ch, OBJ_DATA *pObj, char *argument )
{
void *vo;
OBJ_DATA *obj = NULL;
CHAR_DATA *victim;
char arg1 [ MAX_INPUT_LENGTH ];
char arg2 [ MAX_INPUT_LENGTH ];
int sn;
int spec;
spec = skill_lookup( "astral walk" );
target_name = one_argument( argument, arg1 );
one_argument( target_name, arg2 );
if ( IS_NPC( ch ) )
if ( IS_SET( ch->affected_by, AFF_CHARM ) )
return;
if ( ( sn = skill_lookup( arg1 ) ) < 0)
{
send_to_char(AT_BLUE, "You can't do that.\n\r", ch );
return;
}
if ( ( sn == spec ) && ( is_name( ch, arg2, ch->name ) ) )
{
send_to_char( AT_BLUE, "You are already in the same room as yourself.\n\r", ch );
return;
}
/*
* Locate targets.
*/
victim = NULL;
obj = NULL;
vo = NULL;
switch ( skill_table[sn].target )
{
default:
bug( "Do_cast: bad target for sn %d.", sn );
return;
case TAR_GROUP_OFFENSIVE:
case TAR_GROUP_DEFENSIVE:
case TAR_GROUP_ALL:
case TAR_GROUP_OBJ:
case TAR_GROUP_IGNORE:
group_cast( sn, URANGE( 1, ch->level, LEVEL_HERO ), ch, arg2 );
return;
case TAR_IGNORE:
break;
case TAR_CHAR_OFFENSIVE:
if ( IS_SET( ch->in_room->room_flags, ROOM_NO_OFFENSIVE ) )
{
send_to_char( AT_BLUE, "You failed.\n\r", ch );
return;
}
if ( arg2[0] == '\0' )
{
if ( !( victim = ch->fighting ) )
{
send_to_char(AT_BLUE, "Cast the spell on whom?\n\r", ch );
return;
}
}
else
{
if ( !( victim = get_char_room( ch, arg2 ) ) )
{
send_to_char(AT_BLUE, "They aren't here.\n\r", ch );
return;
}
}
if ( IS_AFFECTED(victim, AFF_PEACE) )
{
send_to_char(AT_WHITE, "A wave of peace overcomes you.\n\r", ch);
return;
}
if ( IS_AFFECTED( ch, AFF_PEACE) )
{
affect_strip( ch, skill_lookup("aura of peace") );
REMOVE_BIT( ch->affected_by, AFF_PEACE );
}
if ( is_safe(ch, victim) )
{
send_to_char(AT_BLUE,"You failed.\n\r",ch);
return;
}
vo = (void *) victim;
break;
case TAR_CHAR_DEFENSIVE:
if ( arg2[0] == '\0' )
{
victim = ch;
}
else
{
if ( !( victim = get_char_room( ch, arg2 ) ) )
{
send_to_char(AT_BLUE, "They aren't here.\n\r", ch );
return;
}
}
vo = (void *) victim;
break;
case TAR_CHAR_SELF:
if ( arg2[0] != '\0' && !is_name( ch, arg2, ch->name ) )
{
send_to_char(AT_BLUE, "You cannot cast this spell on another.\n\r", ch );
return;
}
vo = (void *) ch;
break;
case TAR_OBJ_INV:
if ( arg2[0] == '\0' )
{
send_to_char(AT_BLUE, "What should the spell be cast upon?\n\r", ch );
return;
}
if ( !( obj = get_obj_carry( ch, arg2 ) ) )
{
send_to_char(AT_BLUE, "You are not carrying that.\n\r", ch );
return;
}
vo = (void *) obj;
break;
}
WAIT_STATE( ch, skill_table[sn].beats );
if ( IS_SET( ch->in_room->room_flags, ROOM_NO_MAGIC ) )
{
send_to_char( AT_BLUE, "You failed.\n\r", ch );
return;
}
if ( !IS_NPC( ch ) )
update_skpell( ch, sn );
(*skill_table[sn].spell_fun) ( sn, URANGE( 1, ch->level, LEVEL_HERO ),
ch, vo );
if ( vo )
{
oprog_invoke_trigger( pObj, ch, vo );
if ( skill_table[sn].target == TAR_OBJ_INV )
oprog_cast_sn_trigger( obj, ch, sn, vo );
rprog_cast_sn_trigger( ch->in_room, ch, sn, vo );
}
if ( skill_table[sn].target == TAR_CHAR_OFFENSIVE
&& victim->master != ch && victim != ch && IS_AWAKE( victim ) )
{
CHAR_DATA *vch;
for ( vch = ch->in_room->people; vch; vch = vch->next_in_room )
{
if ( vch->deleted )
continue;
if ( victim == vch && !victim->fighting )
{
multi_hit( victim, ch, TYPE_UNDEFINED );
break;
}
}
}
return;
}
void do_cast( CHAR_DATA *ch, char *argument )
{
void *vo;
OBJ_DATA *obj;
CHAR_DATA *victim;
char arg1 [ MAX_INPUT_LENGTH ];
char arg2 [ MAX_INPUT_LENGTH ];
int mana;
int sn;
bool IS_DIVINE;
/* int spec; */
/* char buf [ MAX_STRING_LENGTH ];*/
/* spec = skill_lookup( "astral walk" ); */
IS_DIVINE = FALSE;
/*
if(ch->pcdata->in_mech != '\0')
{
send_to_char(C_DEFAULT, "But, you're in a mech!",ch);
return;
}
*/
target_name = one_argument( argument, arg1 );
if ( arg1[0] != '\0' )
if ( !str_prefix( arg1, "divine" ) && ch->level >= LEVEL_IMMORTAL )
{
IS_DIVINE = TRUE;
target_name = one_argument( target_name, arg1 );
}
one_argument( target_name, arg2 );
if ( arg1[0] == '\0' )
{
send_to_char(AT_BLUE, "Cast which what where?\n\r", ch);
return;
}
if ( IS_AFFECTED( ch, AFF_MUTE ))
{
send_to_char(AT_WHITE, "You have been silenced.\n\r", ch);
return;
}
if ( IS_NPC( ch ) )
if ( IS_SET( ch->affected_by, AFF_CHARM ) )
return;
if ( !IS_NPC( ch ) )
if ( ( sn = skill_lookup( arg1 ) ) < 0
|| !can_use_skpell( ch, sn ) )
{
send_to_char(AT_BLUE, "You can't do that.\n\r", ch );
return;
}
if ( IS_NPC( ch ) )
if ( ( sn = skill_lookup( arg1 ) ) < 0 )
return;
if ( ch->position < skill_table[sn].minimum_position )
{
send_to_char(AT_BLUE, "You can't concentrate enough.\n\r", ch );
return;
}
/*
if ( ch->level < LEVEL_IMMORTAL && ch->class == CLASS_VAMPIRE )
if ( !IS_SET( ch->in_room->room_flags, ROOM_INDOORS ) )
{
if ( time_info.hour > 6 && time_info.hour < 18 )
{
int chance;
chance = 15;
if (number_percent ( )< chance)
{
send_to_char(AT_RED, "The sun blocks your magic!\n\r", ch );
return;
}
}
}
*/
if ( IS_STUNNED( ch, STUN_MAGIC ) )
{
send_to_char(AT_LBLUE, "You're too stunned to cast spells.\n\r", ch );
return;
}
if ( !IS_NPC( ch ) && ( !( ch->level > LEVEL_MORTAL ) ) )
{
mana = UMAX( 1, SPELL_COST( ch, sn ));
if ( ch->race == RACE_ELF || ch->race == RACE_ELDER )
mana -= mana / 4;
}
else
mana = 0;
if ( skill_table[sn].spell_fun == spell_null )
{
send_to_char( AT_BLUE, "You can't do that.\n\r", ch );
return;
}
/*
* Locate targets.
*/
victim = NULL;
obj = NULL;
vo = NULL;
switch ( skill_table[sn].target )
{
default:
bug( "Do_cast: bad target for sn %d.", sn );
return;
case TAR_GROUP_OFFENSIVE:
case TAR_GROUP_DEFENSIVE:
case TAR_GROUP_ALL:
case TAR_GROUP_OBJ:
case TAR_GROUP_IGNORE:
group_cast( sn, URANGE( 1, ch->level, LEVEL_HERO ), ch, arg2 );
return;
case TAR_IGNORE:
break;
case TAR_CHAR_OFFENSIVE:
if ( IS_SET( ch->in_room->room_flags, ROOM_NO_OFFENSIVE ) )
{
send_to_char( AT_BLUE, "You failed.\n\r", ch );
return;
}
if ( arg2[0] == '\0' )
{
if ( !( victim = ch->fighting ) )
{
send_to_char(AT_BLUE, "Cast the spell on whom?\n\r", ch );
return;
}
}
else
{
if ( !( victim = get_char_room( ch, arg2 ) ) ||
victim->in_vehicle != NULL )
{
send_to_char(AT_BLUE, "They aren't here.\n\r", ch );
return;
}
}
if ( IS_AFFECTED(victim, AFF_PEACE) )
{
send_to_char(AT_WHITE, "A wave of peace overcomes you.\n\r", ch);
return;
}
if ( IS_AFFECTED( ch, AFF_PEACE) )
{
affect_strip( ch, skill_lookup("aura of peace") );
REMOVE_BIT( ch->affected_by, AFF_PEACE );
}
if (is_safe(ch, victim ) )
{
send_to_char( AT_BLUE, "You failed.\n\r",ch);
return;
}
vo = (void *) victim;
break;
case TAR_CHAR_DEFENSIVE:
if ( arg2[0] == '\0' )
{
victim = ch;
}
else
{
if ( !( victim = get_char_room( ch, arg2 ) ) )
{
send_to_char(AT_BLUE, "They aren't here.\n\r", ch );
return;
}
}
vo = (void *) victim;
break;
case TAR_CHAR_SELF:
if ( arg2[0] != '\0' && !is_name( ch, arg2, ch->name ) )
{
send_to_char(AT_BLUE, "You cannot cast this spell on another.\n\r", ch );
return;
}
vo = (void *) ch;
break;
case TAR_OBJ_INV:
if ( arg2[0] == '\0' )
{
send_to_char(AT_BLUE, "What should the spell be cast upon?\n\r", ch );
return;
}
if ( !(obj = get_obj_here( ch, arg2 ) ) )
{
send_to_char( AT_BLUE, "You can't find that.\n\r", ch );
return;
}
vo = (void *) obj;
break;
}
if ( !IS_NPC( ch ) ){
if ( !is_class( ch, CLASS_VAMPIRE ) && ch->mana < mana )
{
send_to_char(AT_BLUE, "You don't have enough mana.\n\r", ch );
return;
}
else{
if ( ( ch->bp < mana ) && ( is_class( ch, CLASS_VAMPIRE ) ) )
{
send_to_char(AT_RED, "You are to starved to cast, you must feed.\n\r", ch );
return;
}}}
if ( str_cmp( skill_table[sn].name, "ventriloquate" ) )
say_spell( ch, sn );
if ( IS_SET( ch->in_room->room_flags, ROOM_NO_MAGIC ) )
{
send_to_char( AT_BLUE, "You failed.\n\r", ch );
return;
}
if ( ( IS_SET( ch->in_room->room_flags, ROOM_NO_OFFENSIVE ) ) && ( skill_table[sn].target == TAR_CHAR_OFFENSIVE ) )
{
send_to_char( AT_BLUE, "You failed.\n\r", ch );
return;
}
WAIT_STATE( ch, skill_table[sn].beats );
if ( !IS_NPC( ch ) ){
if ( number_percent( ) > ch->pcdata->learned[sn] )
{
send_to_char(AT_BLUE, "You lost your concentration.\n\r", ch );
MT( ch ) -= mana / 2;
}
else
{
MT( ch ) -= mana;
if ( ( IS_AFFECTED2( ch, AFF_CONFUSED ) )
&& number_percent( ) < 10 )
{
act(AT_YELLOW, "$n looks around confused at what's going on.", ch, NULL, NULL, TO_ROOM );
send_to_char( AT_YELLOW, "You become confused and botch the spell.\n\r", ch );
return;
}
update_skpell( ch, sn );
(*skill_table[sn].spell_fun) ( sn,
IS_DIVINE ?
URANGE( 1, ch->level, LEVEL_HERO )*3 :
URANGE( 1, ch->level, LEVEL_HERO ) ,
ch, vo );
}}
if ( IS_NPC( ch ) )
(*skill_table[sn].spell_fun) ( sn,
IS_DIVINE ?
URANGE( 1, ch->level, LEVEL_HERO )*3 :
URANGE( 1, ch->level, LEVEL_HERO ) ,
ch, vo );
if ( vo )
{
if ( skill_table[sn].target == TAR_OBJ_INV )
oprog_cast_sn_trigger( obj, ch, sn, vo );
rprog_cast_sn_trigger( ch->in_room, ch, sn, vo );
}
if ( skill_table[sn].target == TAR_CHAR_OFFENSIVE
&& victim->master != ch && victim != ch && IS_AWAKE( victim ) )
{
CHAR_DATA *vch;
for ( vch = ch->in_room->people; vch; vch = vch->next_in_room )
{
if ( vch->deleted )
continue;
if ( victim == vch && !victim->fighting )
{
multi_hit( victim, ch, TYPE_UNDEFINED );
break;
}
}
}
/* bug("do_cast: bad return on sn %d", sn); */
return;
}
/*
* Cast spells at targets using a magical object.
*/
void obj_cast_spell( int sn, int level, CHAR_DATA *ch, CHAR_DATA *victim,
OBJ_DATA *obj )
{
void *vo;
if ( sn <= 0 )
return;
if ( !is_sn(sn) || skill_table[sn].spell_fun == 0 )
{
bug( "Obj_cast_spell: bad sn %d.", sn );
return;
}
if ( IS_SET( ch->in_room->room_flags, ROOM_NO_MAGIC ) )
{
send_to_char( AT_BLUE, "The magic of the item fizzles.\n\r", ch );
return;
}
switch ( skill_table[sn].target )
{
default:
bug( "Obj_cast_spell: bad target for sn %d.", sn );
return;
case TAR_GROUP_OFFENSIVE:
case TAR_GROUP_DEFENSIVE:
case TAR_GROUP_ALL:
case TAR_GROUP_OBJ:
case TAR_GROUP_IGNORE:
group_cast( sn, URANGE( 1, level, LEVEL_HERO ), ch,
victim ? (void *)victim : (void *)obj );
return;
case TAR_IGNORE:
vo = NULL;
break;
case TAR_CHAR_OFFENSIVE:
if ( IS_SET( ch->in_room->room_flags, ROOM_NO_OFFENSIVE ) )
{
send_to_char( AT_BLUE, "The magic of the item fizzles.\n\r", ch );
return;
}
if ( !victim )
victim = ch->fighting;
if ( !victim || ( !IS_NPC( victim ) && ch != victim ) )
{
send_to_char(AT_BLUE, "You can't do that.\n\r", ch );
return;
}
if ( ( ( ch->clan == 0 ) || ( ch->clan == 0 ) ) && ( !IS_NPC( victim ) ) )
return;
if ( IS_AFFECTED(victim, AFF_PEACE) )
{
send_to_char(AT_WHITE, "A wave of peace overcomes you.\n\r", ch);
return;
}
if ( IS_AFFECTED( ch, AFF_PEACE) )
{
affect_strip( ch, skill_lookup("aura of peace") );
REMOVE_BIT( ch->affected_by, AFF_PEACE );
}
/*
if ( ( ( ch->level - 11 > victim->level )
|| ( ch->level + 11 < victim->level ) )
&& ( !IS_NPC(victim) ) )
{
send_to_char(AT_WHITE, "That is not in the pkill range... valid range is +/- 10 levels.\n\r", ch );
return;
} */
vo = (void *) victim;
break;
case TAR_CHAR_DEFENSIVE:
if ( !victim )
victim = ch;
vo = (void *) victim;
break;
case TAR_CHAR_SELF:
vo = (void *) ch;
break;
case TAR_OBJ_INV:
if ( !obj )
{
send_to_char(AT_BLUE, "You can't do that.\n\r", ch );
return;
}
vo = (void *) obj;
break;
}
/* target_name = "";*/
(*skill_table[sn].spell_fun) ( sn, level, ch, vo );
if ( vo )
{
if ( skill_table[sn].target == TAR_OBJ_INV )
oprog_cast_sn_trigger( obj, ch, sn, vo );
rprog_cast_sn_trigger( ch->in_room, ch, sn, vo );
}
if ( skill_table[sn].target == TAR_CHAR_OFFENSIVE
&& victim->master != ch && ch != victim )
{
CHAR_DATA *vch;
for ( vch = ch->in_room->people; vch; vch = vch->next_in_room )
{
if ( vch->deleted )
continue;
if ( victim == vch && !victim->fighting )
{
multi_hit( victim, ch, TYPE_UNDEFINED );
break;
}
}
}
return;
}
/*
* Spell functions.
*/
void spell_acid_blast( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
dam = dice( level, 8 );
dam = sc_dam( ch, dam );
if ( saves_spell( level, victim ) )
dam /= 2;
damage( ch, victim, dam, sn );
return;
}
void spell_animate( int sn, int level, CHAR_DATA *ch, void *vo )
{
OBJ_DATA *obj = (OBJ_DATA *) vo;
OBJ_DATA *obj_next;
if ( obj->item_type != ITEM_CORPSE_NPC )
{
send_to_char(AT_BLUE, "You cannot animate that.\n\r", ch );
return;
}
obj_next = obj->next;
if (obj->deleted)
return;
magic_mob( ch, obj, obj->ac_vnum );
extract_obj(obj);
return;
}
void spell_armor( 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.level = level;
af.duration = 24;
af.location = APPLY_AC;
af.modifier = -25;
af.bitvector = 0;
affect_to_char( victim, &af );
if ( ch != victim )
send_to_char(AT_BLUE, "Ok.\n\r", ch );
send_to_char(AT_BLUE, "You feel someone protecting you.\n\r", victim );
return;
}
void spell_astral( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim;
CHAR_DATA *pet;
if ( !( victim = get_char_world( ch, target_name ) )
|| 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_ASTRAL_IN )
|| IS_SET( ch->in_room->room_flags, ROOM_NO_ASTRAL_OUT )
|| IS_SET( victim->in_room->area->area_flags, AREA_PROTOTYPE )
|| IS_SET( victim->act, ACT_NOASTRAL )
|| IS_ARENA(ch)
|| victim->in_room->area == arena.area
|| IS_AFFECTED( victim, AFF_NOASTRAL ) )
{
send_to_char(AT_BLUE, "You failed.\n\r", ch );
return;
}
for ( pet = ch->in_room->people; pet; pet = pet->next_in_room )
{
if ( IS_NPC( pet ) )
if ( IS_SET( pet->act, ACT_PET ) && ( pet->master == ch ) )
break;
}
act(AT_BLUE, "$n vanishes in a flash of blinding light.", ch, NULL, NULL, TO_ROOM );
if ( ch != victim )
{
if ( pet )
{
act( AT_BLUE, "$n vanishes in a flash of blinding light.", pet, NULL, NULL, TO_ROOM );
char_from_room( pet );
}
char_from_room( ch );
char_to_room( ch, victim->in_room );
}
act(AT_BLUE, "$n appears in a flash of blinding light.", ch, NULL,
NULL, TO_ROOM );
do_look( ch, "auto" );
if ( pet )
{
char_to_room( pet, victim->in_room );
act( AT_BLUE, "$n appears in a flash of blinding light.", pet, NULL, NULL, TO_ROOM );
}
return;
}
void spell_pass_plant ( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim ;
CHAR_DATA *pet;
if ( IS_AFFECTED( ch, AFF_ANTI_FLEE ) )
{
send_to_char( AT_WHITE, "You cannot walk through the plants in your condition!\n\r", ch );
return;
}
if ( ch->in_room->sector_type == SECT_INSIDE
|| ch->in_room->sector_type == SECT_CITY
|| ch->in_room->sector_type == SECT_AIR
)
{
send_to_char(AT_GREEN, "There are no plants here.\n\r", ch );
return;
}
if ( IS_SET( ch->in_room->room_flags, ROOM_NO_SHADOW ) )
{
send_to_char(AT_GREEN, "The plants do not respond to your call.\n\r", ch);
return;
}
if ( !( victim = get_char_world( ch, target_name ) )
|| victim->in_room->area != ch->in_room->area
|| IS_SET( victim->in_room->room_flags, ROOM_PRIVATE )
|| IS_SET( victim->in_room->room_flags, ROOM_SOLITARY )
|| victim->in_room->sector_type == SECT_INSIDE
|| victim->in_room->sector_type == SECT_CITY
|| victim->in_room->sector_type == SECT_AIR
|| IS_AFFECTED( victim, AFF_NOASTRAL ) )
{
send_to_char(AT_GREEN, "The plants do not reach there.\n\r", ch );
return;
}
for ( pet = ch->in_room->people; pet; pet = pet->next_in_room )
{
if ( IS_NPC( pet ) )
if ( IS_SET( pet->act, ACT_PET ) && ( pet->master == ch ) )
break;
}
if ( ch != victim )
{
act(AT_GREEN, "$n melts into the surrounding plant life.", ch, NULL, NULL, TO_ROOM );
char_from_room( ch );
char_to_room( ch, victim->in_room );
act(AT_GREEN, "$n steps out of the surrounding plant life.", ch, NULL, NULL, TO_ROOM );
if ( pet )
{
act( AT_BLUE, "$n melts into the surrounding plant life.", pet, NULL, NULL, TO_ROOM );
char_from_room( pet );
char_to_room( pet, victim->in_room );
act( AT_BLUE, "$n steps out of the surrounding plant life.", pet, NULL, NULL, TO_ROOM );
}
}
do_look( ch, "auto" );
return;
}
void spell_aura( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( IS_AFFECTED( victim, AFF_PEACE) )
return;
af.type = sn;
af.level = level;
af.duration = number_fuzzy( level / 8 );
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_PEACE;
affect_to_char( victim, &af );
send_to_char(AT_BLUE, "You feel a wave of peace flow lightly over your body.\n\r", victim );
act(AT_BLUE, "$n looks very peaceful.", victim, NULL, NULL, TO_ROOM );
return;
}
void spell_bless( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( victim->position == POS_FIGHTING || is_affected( victim, sn ) )
return;
af.type = sn;
af.level = level;
af.duration = 6 + level;
af.location = APPLY_HITROLL;
af.modifier = level / 8;
af.bitvector = 0;
affect_to_char( victim, &af );
af.location = APPLY_SAVING_SPELL;
af.modifier = 0 - level / 8;
affect_to_char( victim, &af );
if ( ch != victim )
send_to_char(AT_BLUE, "Ok.\n\r", ch );
send_to_char(AT_BLUE, "You feel righteous.\n\r", victim );
return;
}
void spell_darkbless( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( victim->position == POS_FIGHTING || is_affected( victim, sn ) )
return;
af.type = sn;
af.level = level;
af.duration = 20 + level;
af.location = APPLY_DAMROLL;
af.modifier = level / 6;
af.bitvector = 0;
affect_to_char( victim, &af );
af.location = APPLY_HIT;
af.modifier = level * 3;
affect_to_char( victim, &af );
if ( ch != victim )
send_to_char(AT_BLUE, "You call forth the hand of oblivion.\n\r", ch );
send_to_char(AT_BLUE, "The hand of oblivion rests upon you.\n\r", victim );
return;
}
void spell_aid( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( victim->position == POS_FIGHTING || is_affected( victim, sn ) )
return;
af.type = sn;
af.level = level;
af.duration = 8 + level;
af.location = APPLY_HITROLL;
af.modifier = level / 6;
af.bitvector = 0;
affect_to_char( victim, &af );
af.location = APPLY_SAVING_SPELL;
af.modifier = 0 - level / 6;
affect_to_char( victim, &af );
af.location = APPLY_HIT;
af.modifier = level * 3;
affect_to_char( victim, &af );
if ( ch != victim )
send_to_char(AT_BLUE, "You grant them divine aid.\n\r", ch );
send_to_char(AT_BLUE, "You feel divine aid reashure you.\n\r", victim );
return;
}
void spell_bio_acceleration( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( victim->position == POS_FIGHTING || is_affected( victim, sn ) )
return;
af.type = sn;
af.level = level;
af.duration = 20 + level;
af.location = APPLY_HIT;
af.modifier = number_fuzzy ( level * 4 );
af.bitvector = 0;
affect_to_char( victim, &af );
af.location = APPLY_MOVE;
af.modifier = level * 2;
affect_to_char( victim, &af );
send_to_char( AT_BLUE, "You greatly enhance your bio-functions.\n\r", ch );
act(AT_BLUE, "$n's body shudders briefly.", ch, NULL, NULL, TO_ROOM);
return;
}
/*Decklarean*/
void spell_draw_strength( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( victim->position == POS_FIGHTING || is_affected( victim, sn ) )
return;
af.type = sn;
af.level = level;
af.duration = 20 + level;
af.location = APPLY_MANA;
af.modifier = number_fuzzy ( level * 4 );
af.bitvector = 0;
affect_to_char( victim, &af );
af.location = APPLY_HIT;
af.modifier = -af.modifier;
affect_to_char( victim, &af );
/* They still have hitpoints over there max hit points
get ride of them */
if ( MAX_HIT(victim) < victim->hit )
victim->hit = MAX_HIT(victim);
send_to_char( AT_BLUE, "You draw from your physical strength and increase your energy reserve.\n\r", ch );
act(AT_BLUE, "$n's body weakens.", ch, NULL, NULL, TO_ROOM);
return;
}
/*
void spell_barkskin( 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 = 35;
af.location = APPLY_AC;
af.modifier = -30;
af.bitvector = 0;
affect_to_char( victim, &af);
af.location = APPLY_SAVING_SPELL;
af.modifier = 0 - LEVEL / 12;
affect_to_char( victim, &af);
if ( ch != victim )
send_to_char( "Ok.\n\r", ch );
send_to_char( "Your skin turns into a bark-like texture.\n\r",
victim, );
return;
}
*/
void spell_blindness( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( IS_AFFECTED( victim, AFF_BLIND ) || saves_spell( level, victim ) )
{
send_to_char(AT_BLUE, "You have failed.\n\r", ch );
return;
}
af.type = sn;
af.level = level;
af.duration = 5;
af.location = APPLY_HITROLL;
af.modifier = -10;
af.bitvector = AFF_BLIND;
affect_to_char( victim, &af );
act(AT_WHITE, "$N is blinded!", ch, NULL, victim, TO_CHAR );
send_to_char(AT_WHITE, "You are blinded!\n\r", victim );
act(AT_WHITE, "$N is blinded!", ch, NULL, victim, TO_NOTVICT );
return;
}
void spell_silence( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( IS_AFFECTED( victim, AFF_MUTE ) || saves_spell( level, victim ) )
{
send_to_char(AT_BLUE, "You have failed.\n\r", ch );
return;
}
af.type = sn;
af.level = level;
af.duration = 2;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_MUTE;
affect_to_char( victim, &af );
act(AT_WHITE, "$N is silenced!", ch, NULL, victim, TO_CHAR );
send_to_char(AT_WHITE, "You are silenced!\n\r", victim );
act(AT_WHITE, "$N is silenced!", ch, NULL, victim, TO_NOTVICT );
return;
}
void spell_blood_bath( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim;
if ( blood_count( ch->in_room->contents, 5 ) < 2 )
{
send_to_char( AT_RED, "There is not enough blood in the room.\n\r", ch );
return;
}
for ( victim = ch->in_room->people; victim; victim = victim->next_in_room )
{
if ( victim->deleted )
continue;
if ( IS_NPC( victim ) )
continue;
victim->hit = UMIN( victim->hit + 250, MAX_HIT(victim) );
update_pos( victim );
act( AT_RED, "You bath $N in the life giving fluid.", ch, NULL, victim, TO_CHAR );
act( AT_RED, "$n baths $N in blood.", ch, NULL, victim, TO_ROOM );
act( AT_RED, "$n baths you in blood.", ch, NULL, victim, TO_VICT );
}
send_to_char( AT_RED, "The blood bath is over.\n\r", ch );
return;
}
void spell_burning_hands( 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, 14, 17, 20, 23, 26, 29,
29, 29, 30, 30, 31, 31, 32, 32, 33, 33,
34, 34, 35, 35, 36, 36, 37, 37, 38, 38,
39, 39, 40, 40, 41, 41, 42, 42, 43, 43,
44, 44, 45, 45, 46, 46, 47, 47, 48, 48,
48, 48, 49, 49, 49, 49, 50, 50, 50, 51,
51, 51, 52, 52, 52, 53, 53, 53, 54, 54,
54, 54, 54, 54, 55, 55, 55, 55, 55, 55,
56, 56, 56, 56, 56, 57, 57, 58, 59, 60
};
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 );
dam = sc_dam( ch, dam );
if ( saves_spell( level, victim ) )
dam /= 2;
damage( ch, victim, dam, sn );
return;
}
void spell_call_lightning( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *vch;
int dam;
if ( !IS_OUTSIDE( ch ) )
{
send_to_char(AT_WHITE, "You must be out of doors.\n\r", ch );
return;
}
if ( weather_info.sky < SKY_RAINING )
{
send_to_char(AT_WHITE, "You need bad weather.\n\r", ch );
return;
}
dam = dice( level / 2, 8 );
send_to_char(AT_WHITE, "Lightning slashes out of the sky to strike your foes!\n\r", ch );
act(AT_WHITE, "$n calls lightning from the sky to strike $s foes!",
ch, NULL, NULL, TO_ROOM );
for ( vch = char_list; vch; vch = vch->next )
{
if ( vch->deleted || !vch->in_room )
continue;
if ( vch->in_room == ch->in_room )
{
if ( vch != ch
&& ( IS_NPC( ch ) ? !IS_NPC( vch ) : IS_NPC( vch ) ) )
{
dam = sc_dam( ch, dam );
damage( ch, vch, saves_spell( level, vch ) ? dam/2 : dam, sn );
}
continue;
}
if ( vch->in_room->area == ch->in_room->area
&& IS_OUTSIDE( vch )
&& IS_AWAKE( vch ) )
send_to_char(AT_LBLUE, "Lightning flashes in the sky.\n\r", vch );
}
return;
}
void spell_cause_light( int sn, int level, CHAR_DATA *ch, void *vo )
{
int dam = dice( 1, 8 ) + level / 3;
dam = sc_dam( ch, dam );
damage( ch, (CHAR_DATA *) vo, dam, sn );
return;
}
void spell_cause_critical( int sn, int level, CHAR_DATA *ch, void *vo )
{
int dam = dice( 3, 8 ) + level - 6;
dam = sc_dam( ch, dam );
damage( ch, (CHAR_DATA *) vo, dam, sn );
return;
}
void spell_cause_serious( int sn, int level, CHAR_DATA *ch, void *vo )
{
int dam = dice( 2, 8 ) + level / 2;
dam = sc_dam( ch, dam );
damage( ch, (CHAR_DATA *) vo, dam, sn );
return;
}
void spell_change_sex( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
af.type = sn;
af.level = level;
af.duration = 10 * level;
af.location = APPLY_SEX;
do
{
af.modifier = number_range( 0, 2 ) - victim->sex;
}
while ( af.modifier == 0 );
af.bitvector = 0;
affect_to_char( victim, &af );
if ( ch != victim )
send_to_char(AT_WHITE, "Ok.\n\r", ch );
send_to_char(AT_BLUE, "You feel different.\n\r", victim );
return;
}
void spell_charm_person( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( victim == ch )
{
send_to_char(AT_BLUE, "You like yourself even better!\n\r", ch );
return;
}
if ( !IS_NPC( victim ) )
return;
if ( IS_AFFECTED( victim, AFF_CHARM )
|| IS_AFFECTED( ch, AFF_CHARM )
|| level < victim->level
|| saves_spell( level, victim ) )
return;
if(IS_SIMM(victim, IMM_CHARM))
return;
if ( victim->master )
stop_follower( victim );
add_follower( victim, ch );
af.type = sn;
af.level = level;
af.duration = number_fuzzy( level / 6 );
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_CHARM;
affect_to_char( victim, &af );
send_to_char(AT_BLUE, "Ok.\n\r", ch );
act(AT_BLUE, "Isn't $n just so nice?", ch, NULL, victim, TO_VICT );
return;
}
void spell_chill_touch( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
static const int dam_each [ ] =
{
0,
0, 0, 6, 7, 8, 9, 12, 13, 13, 13,
14, 14, 14, 15, 15, 15, 16, 16, 16, 17,
17, 17, 18, 18, 18, 19, 19, 19, 20, 20,
20, 21, 21, 21, 22, 22, 22, 23, 23, 23,
24, 24, 24, 25, 25, 25, 26, 26, 26, 27,
27, 27, 27, 28, 28, 28, 29, 29, 29, 30,
30, 30, 31, 31, 31, 32, 32, 33, 33, 33,
34, 34, 34, 35, 35, 35, 36, 36, 36, 37,
37, 37, 37, 37, 38, 38, 38, 38, 39, 39,
39, 39, 39, 40, 40, 40, 41, 41, 42, 43
};
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 );
dam = sc_dam( ch, dam );
if ( !saves_spell( level, victim ) )
{
af.type = sn;
af.level = level;
af.duration = 6;
af.location = APPLY_STR;
af.modifier = -1;
af.bitvector = 0;
affect_join( victim, &af );
}
else
{
dam /= 2;
}
damage( ch, victim, dam, sn );
return;
}
void spell_colour_spray( 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, 0, 0, 0, 0,
30, 35, 40, 45, 50, 55, 55, 55, 56, 57,
58, 58, 59, 60, 61, 61, 62, 63, 64, 64,
65, 66, 67, 67, 68, 69, 70, 70, 71, 72,
73, 73, 74, 75, 76, 76, 77, 78, 79, 79,
79, 80, 80, 81, 81, 82, 82, 83, 83, 84,
84, 85, 85, 86, 86, 87, 87, 88, 88, 90,
90, 91, 91, 92, 92, 93, 93, 94, 94, 95,
95, 96, 96, 97, 97, 98, 98, 99, 99, 100,
100,101,102,102,103, 104,105,106,107,120
};
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 );
dam = sc_dam( ch, dam );
if ( saves_spell( level, victim ) )
dam /= 2;
damage( ch, victim, dam, sn );
return;
}
void spell_continual_light( int sn, int level, CHAR_DATA *ch, void *vo )
{
OBJ_DATA *light;
light = create_object( get_obj_index( OBJ_VNUM_LIGHT_BALL ), 0 );
obj_to_room( light, ch->in_room );
act(AT_BLUE, "You twiddle your thumbs and $p appears.", ch, light, NULL, TO_CHAR );
act(AT_BLUE, "$n twiddles $s thumbs and $p appears.", ch, light, NULL, TO_ROOM );
return;
}
void spell_control_weather( int sn, int level, CHAR_DATA *ch, void *vo )
{
if ( !str_cmp( target_name, "better" ) )
weather_info.change += dice( level / 3, 4 );
else if ( !str_cmp( target_name, "worse" ) )
weather_info.change -= dice( level / 3, 4 );
else
send_to_char (AT_BLUE, "Do you want it to get better or worse?\n\r", ch );
send_to_char(AT_BLUE, "Ok.\n\r", ch );
return;
}
void spell_create_food( int sn, int level, CHAR_DATA *ch, void *vo )
{
OBJ_DATA *mushroom;
mushroom = create_object( get_obj_index( OBJ_VNUM_MUSHROOM ), 0 );
mushroom->value[0] = 5 + level;
obj_to_room( mushroom, ch->in_room );
act(AT_ORANGE, "$p suddenly appears.", ch, mushroom, NULL, TO_CHAR );
act(AT_ORANGE, "$p suddenly appears.", ch, mushroom, NULL, TO_ROOM );
return;
}
void spell_create_spring( int sn, int level, CHAR_DATA *ch, void *vo )
{
OBJ_DATA *spring;
spring = create_object( get_obj_index( OBJ_VNUM_SPRING ), 0 );
spring->timer = level;
obj_to_room( spring, ch->in_room );
act(AT_BLUE, "$p flows from the ground.", ch, spring, NULL, TO_CHAR );
act(AT_BLUE, "$p flows from the ground.", ch, spring, NULL, TO_ROOM );
return;
}
void spell_create_water( int sn, int level, CHAR_DATA *ch, void *vo )
{
OBJ_DATA *obj = (OBJ_DATA *) vo;
int water;
if ( obj->item_type != ITEM_DRINK_CON )
{
send_to_char(AT_BLUE, "It is unable to hold water.\n\r", ch );
return;
}
if ( obj->value[2] != LIQ_WATER && obj->value[1] != 0 )
{
send_to_char(AT_BLUE, "It contains some other liquid.\n\r", ch );
return;
}
water = UMIN( level * ( weather_info.sky >= SKY_RAINING ? 4 : 2 ),
obj->value[0] - obj->value[1] );
if ( water > 0 )
{
obj->value[2] = LIQ_WATER;
obj->value[1] += water;
if ( !is_name( NULL, "water", obj->name ) )
{
char buf [ MAX_STRING_LENGTH ];
sprintf( buf, "%s water", obj->name );
free_string( obj->name );
obj->name = str_dup( buf );
}
act(AT_BLUE, "$p is filled.", ch, obj, NULL, TO_CHAR );
}
return;
}
void spell_cure_blindness( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
if ( !is_affected( victim, gsn_blindness ) )
return;
affect_strip( victim, gsn_blindness );
if ( ch != victim )
send_to_char(AT_BLUE, "Ok.\n\r", ch );
send_to_char(AT_WHITE, "Your vision returns!\n\r", victim );
return;
}
void spell_cure_critical( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int heal;
heal = dice( 3, 8 ) + level - 6;
victim->hit = UMIN( victim->hit + heal, MAX_HIT(victim)) ;
update_pos( victim );
if ( ch != victim )
send_to_char(AT_BLUE, "Ok.\n\r", ch );
send_to_char(AT_BLUE, "You feel better!\n\r", victim );
return;
}
void spell_cure_light( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int heal;
heal = dice( 1, 8 ) + level / 3;
victim->hit = UMIN( victim->hit + heal, MAX_HIT(victim));
update_pos( victim );
if ( ch != victim )
send_to_char(AT_BLUE, "Ok.\n\r", ch );
send_to_char(AT_BLUE, "You feel better!\n\r", victim );
return;
}
void spell_cure_poison( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
if ( !is_affected( victim, gsn_poison ) )
return;
affect_strip( victim, gsn_poison );
send_to_char(AT_GREEN, "Ok.\n\r", ch );
send_to_char(AT_GREEN, "A warm feeling runs through your body.\n\r", victim );
act(AT_GREEN, "$N looks better.", ch, NULL, victim, TO_NOTVICT );
return;
}
void spell_cure_serious( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int heal;
heal = dice( 2, 8 ) + level / 2 ;
victim->hit = UMIN( victim->hit + heal, MAX_HIT(victim));
update_pos( victim );
send_to_char(AT_BLUE, "You feel better!\n\r", victim );
if ( ch != victim )
send_to_char(AT_BLUE, "Ok.\n\r", ch );
return;
}
void spell_curse( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( IS_AFFECTED( victim, AFF_CURSE ) || saves_spell( level, victim ) )
{
send_to_char(AT_RED, "You have failed.\n\r", ch );
return;
}
af.type = sn;
af.level = level;
af.duration = 4 * level;
af.location = APPLY_HITROLL;
af.modifier = -1;
af.bitvector = AFF_CURSE;
affect_to_char( victim, &af );
af.location = APPLY_SAVING_SPELL;
af.modifier = 1;
affect_to_char( victim, &af );
if ( ch != victim )
send_to_char(AT_RED, "Ok.\n\r", ch );
send_to_char(AT_RED, "You feel unclean.\n\r", victim );
return;
}
void spell_detect_evil( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( IS_AFFECTED( victim, AFF_DETECT_EVIL ) )
return;
af.type = sn;
af.level = level;
af.duration = level;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_DETECT_EVIL;
affect_to_char( victim, &af );
if ( ch != victim )
send_to_char(AT_BLUE, "Ok.\n\r", ch );
send_to_char(AT_BLUE, "Your eyes tingle.\n\r", victim );
return;
}
void spell_detect_hidden( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( IS_AFFECTED( victim, AFF_DETECT_HIDDEN ) )
return;
af.type = sn;
af.level = level;
af.duration = level;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_DETECT_HIDDEN;
affect_to_char( victim, &af );
if ( ch != victim )
send_to_char(AT_BLUE, "Ok.\n\r", ch );
send_to_char(AT_BLUE, "Your awareness improves.\n\r", victim );
return;
}
void spell_detect_invis( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( IS_AFFECTED( victim, AFF_DETECT_INVIS ) )
return;
af.type = sn;
af.level = level;
af.duration = level;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_DETECT_INVIS;
affect_to_char( victim, &af );
if ( ch != victim )
send_to_char(AT_BLUE, "Ok.\n\r", ch );
send_to_char(AT_BLUE, "Your eyes tingle.\n\r", victim );
return;
}
void spell_truesight( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( IS_AFFECTED2( victim, AFF_TRUESIGHT ) )
return;
af.type = sn;
af.level = level;
af.duration = level / 8;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_TRUESIGHT;
affect_to_char2( victim, &af );
if ( ch != victim )
send_to_char(AT_BLUE, "Ok.\n\r", ch );
send_to_char(AT_BLUE, "Your eyes tingle.\n\r", victim );
return;
}
void spell_detect_magic( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( IS_AFFECTED( victim, AFF_DETECT_MAGIC ) )
return;
af.type = sn;
af.level = level;
af.duration = level;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_DETECT_MAGIC;
affect_to_char( victim, &af );
if ( ch != victim )
send_to_char(AT_BLUE, "Ok.\n\r", ch );
send_to_char(AT_BLUE, "Your eyes tingle.\n\r", victim );
return;
}
void spell_detect_poison( int sn, int level, CHAR_DATA *ch, void *vo )
{
OBJ_DATA *obj = (OBJ_DATA *) vo;
if ( obj->item_type == ITEM_DRINK_CON || obj->item_type == ITEM_FOOD )
{
if ( obj->value[3] != 0 )
send_to_char(AT_GREEN, "You smell poisonous fumes.\n\r", ch );
else
send_to_char(AT_GREEN, "It looks very delicious.\n\r", ch );
}
else
{
send_to_char(AT_GREEN, "It looks very delicious.\n\r", ch );
}
return;
}
/* Dispel Magic recoded by Thelonius for EnvyMud
look for the improved version below
void spell_dispel_magic ( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA *paf;
if ( (victim == ch) || !IS_NPC( ch )
&& ( !IS_NPC( victim )
|| ( IS_AFFECTED( victim, AFF_CHARM )
&& is_same_group( ch, victim->master ) ) ) )
{
for ( paf = victim->affected; paf; paf = paf->next )
{
if ( paf->deleted )
continue;
affect_remove( victim, paf );
}
}
if ( victim == ch )
{
act(AT_BLUE, "You have removed all magic effects from yourself.",
ch, NULL, NULL, TO_CHAR );
act(AT_BLUE, "$n has removed all magic effects from $mself.",
ch, NULL, NULL, TO_ROOM );
}
else
{
act(AT_BLUE, "You have removed all magic effects from $N.",
ch, NULL, victim, TO_CHAR );
act(AT_BLUE, "$n has removed all magic effects from you.",
ch, NULL, victim, TO_VICT );
act(AT_BLUE, "$n has removed all magic effects from $N.",
ch, NULL, victim, TO_NOTVICT );
}
return;
}
else
{
for ( paf = victim->affected; paf; paf = paf->next )
{
if ( paf->deleted )
continue;
if ( !saves_spell( level, victim ) )
{
send_to_char(AT_BLUE, skill_table[paf->type].msg_off, victim );
send_to_char(AT_BLUE, "\n\r", victim );
act(AT_BLUE, "$n is no longer affected by '$t'.",
victim, skill_table[paf->type].name, NULL, TO_ROOM );
affect_strip( victim, paf->type );
break;
}
}
if ( IS_AFFECTED( victim, AFF_SANCTUARY)
&& !saves_spell( level, victim ) )
{
REMOVE_BIT( victim->affected_by, AFF_SANCTUARY );
send_to_char(AT_GREY, "The white aura around your body fades.\n\r",
victim );
act(AT_GREY, "The white aura around $n's body fades.",
victim, NULL, NULL, TO_ROOM );
}
if ( IS_AFFECTED( victim, AFF_FIRESHIELD)
&& !saves_spell( level, victim ) )
{
REMOVE_BIT( victim->affected_by, AFF_FIRESHIELD );
send_to_char(AT_RED, "The flames about your body have been doused.\n\r",
victim );
act(AT_RED, "The flames about $n's body burn out.",
victim, NULL, NULL, TO_ROOM );
}
if ( IS_AFFECTED( victim, AFF_SHOCKSHIELD)
&& !saves_spell( level, victim ) )
{
REMOVE_BIT( victim->affected_by, AFF_SHOCKSHIELD );
send_to_char(AT_BLUE, "The electricity about your body flee's into the ground..\n\r",
victim );
act(AT_BLUE, "The electricity about $n's body flee's into the ground.",
victim, NULL, NULL, TO_ROOM );
}
if ( IS_AFFECTED( victim, AFF_ICESHIELD)
&& !saves_spell( level, victim ) )
{
REMOVE_BIT( victim->affected_by, AFF_ICESHIELD );
send_to_char(AT_LBLUE, "The icy crust about your body melts to a puddle..\n\r",
victim );
act(AT_LBLUE, "The icy crust about $n's body melts to a puddle.",
victim, NULL, NULL, TO_ROOM );
}
if ( !victim->fighting || !is_same_group( ch, victim->fighting ) )
multi_hit( victim, ch, TYPE_UNDEFINED );
}
return;
}
*/
void spell_dispel_evil( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
if ( !IS_NPC( ch ) && IS_EVIL( ch ) )
{
send_to_char(AT_RED, "You are too EVIL to cast this.\n\r", ch );
return;
}
if ( IS_GOOD( victim ) )
{
act(AT_BLUE, "God protects $N.", ch, NULL, victim, TO_ROOM );
return;
}
if ( IS_NEUTRAL( victim ) )
{
act(AT_BLUE, "$N does not seem to be affected.", ch, NULL, victim, TO_CHAR );
return;
}
dam = dice( level, 4 );
dam = sc_dam( ch, dam );
if ( saves_spell( level, victim ) )
dam /= 2;
damage( ch, victim, dam, sn );
return;
}
void spell_earthquake( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *vch;
send_to_char(AT_ORANGE, "The earth trembles beneath your feet!\n\r", ch );
act(AT_ORANGE, "$n makes the earth tremble and shiver.", ch, NULL, NULL, TO_ROOM );
for ( vch = char_list; vch; vch = vch->next )
{
if ( vch->deleted || !vch->in_room )
continue;
if ( vch->in_room == ch->in_room )
{
if ( vch != ch && ( IS_NPC( ch ) ? !IS_NPC( vch )
: IS_NPC( vch ) ) )
damage( ch, vch, level + dice( 2, 8 ), sn );
continue;
}
if ( vch->in_room->area == ch->in_room->area )
send_to_char(AT_ORANGE, "The earth trembles and shivers.\n\r", vch );
}
return;
}
void spell_chain_lightning( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *vch;
send_to_char(AT_BLUE, "Bolts of electricity arc from your hands!\n\r", ch );
act(AT_BLUE, "Electrical energy bursts from $n's hands.", ch, NULL, NULL, TO_ROOM );
for ( vch = char_list; vch; vch = vch->next )
{
if ( vch->deleted || !vch->in_room )
continue;
if ( vch->in_room == ch->in_room )
{
if ( vch != ch && ( IS_NPC( ch ) ? !IS_NPC( vch )
: IS_NPC( vch ) ) )
damage( ch, vch, level + dice( level, 6 ), sn );
continue;
}
if ( vch->in_room->area == ch->in_room->area )
send_to_char(AT_BLUE, "The air fills with static.\n\r", vch );
}
return;
}
/* RT version of chain
void spell_chain_lightning(int sn, int level, CHAR_DATA *ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
CHAR_DATA *tmp_vict,*last_vict,*next_vict;
bool found;
int dam;
* first strike *
act(AT_BLUE, "A lightning bolt leaps from $n's hand and arcs to $N.",
ch,NULL,victim,TO_ROOM);
act(AT_BLUE, "A lightning bolt leaps from your hand and arcs to $N.",
ch,NULL,victim,TO_CHAR);
act(AT_BLUE, "A lightning bolt leaps from $n's hand and hits you!",
ch,NULL,victim,TO_VICT);
dam = level + dice(level,6);
if (saves_spell(level,victim))
dam /= 3;
damage(ch,victim,dam,sn);*,DAM_LIGHTNING);*
last_vict = victim;
level -= 4; * decrement damage *
* new targets *
while (level > 0)
{
found = FALSE;
for (tmp_vict = ch->in_room->people;
tmp_vict != NULL;
tmp_vict = next_vict)
{
if(tmp_vect->deleted) continue;
next_vict = tmp_vict->next_in_room;
if (*!is_safe_spell(ch,tmp_vict,TRUE) &&* tmp_vict != last_vict)
{
found = TRUE;
last_vict = tmp_vict;
act(AT_BLUE, "The bolt arcs to $n!",tmp_vict,NULL,NULL,TO_ROOM);
act(AT_BLUE, "The bolt hits you!",tmp_vict,NULL,NULL,TO_CHAR);
dam = level + dice(level,6);
if (saves_spell(level,tmp_vict))
dam /= 3;
damage(ch,tmp_vict,dam,sn);*,DAM_LIGHTNING);*
level -= 4; * decrement damage *
}
} * end target searching loop *
if (!found) * no target found, hit the caster *
{
if (ch == NULL)
return;
if (last_vict == ch) * no double hits *
{
act(AT_BLUE,
"The bolt seems to have fizzled out.",ch,NULL,NULL,TO_ROOM);
act(AT_BLUE, "The bolt grounds out through your body.",
ch,NULL,NULL,TO_CHAR);
return;
}
last_vict = ch;
act(AT_BLUE, "The bolt arcs to $n...whoops!",ch,NULL,NULL,TO_ROOM);
send_to_char(AT_BLUE, "You are struck by your own lightning!\n\r",ch);
dam = level + dice(level,6);
if (saves_spell(level,ch))
dam /= 3;
damage(ch,ch,dam,sn);*,DAM_LIGHTNING);*
level -= 4; * decrement damage *
if (ch == NULL)
return;
}
* now go back and find more targets *
}
}
*/
void spell_meteor_swarm( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *vch;
AFFECT_DATA af;
send_to_char(AT_RED, "Flaming meteors fly forth from your outstreched hands!\n\r", ch );
act(AT_RED, "Hundreds of flaming meteors fly forth from $n's hands.", ch, NULL, NULL, TO_ROOM );
for ( vch = char_list; vch; vch = vch->next )
{
if ( vch->deleted || !vch->in_room )
continue;
if ( vch->in_room == ch->in_room )
{
if ( vch != ch && ( IS_NPC( ch ) ? !IS_NPC( vch )
: IS_NPC( vch ) ) )
damage( ch, vch, level + dice( level, 8 ), sn );
if ( vch != ch )
{
af.type = sn;
af.level = level;
af.duration = level / 8;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_FLAMING;
affect_join( vch, &af );
send_to_char(AT_RED, "You body bursts into flame!\n\r", vch);
}
continue;
}
}
return;
}
void spell_enchant_weapon( int sn, int level, CHAR_DATA *ch, void *vo )
{
OBJ_DATA *obj = (OBJ_DATA *) vo;
AFFECT_DATA *paf;
if ( obj->item_type != ITEM_WEAPON
|| IS_OBJ_STAT( obj, ITEM_MAGIC )
|| ( obj->affected && !IS_OBJ_STAT( obj, ITEM_DWARVEN ) ) )
{
send_to_char(AT_BLUE, "That item cannot be enchanted.\n\r", ch );
return;
}
if ( !affect_free )
{
paf = alloc_perm( sizeof( *paf ) );
}
else
{
paf = affect_free;
affect_free = affect_free->next;
}
paf->type = sn;
paf->duration = -1;
paf->location = APPLY_HITROLL;
paf->modifier = 1 + (level >= 18) + (level >= 25) + (level >= 45) + (level >= 65) +(level >= 90);
paf->bitvector = 0;
paf->next = obj->affected;
obj->affected = paf;
if ( !affect_free )
{
paf = alloc_perm( sizeof( *paf ) );
}
else
{
paf = affect_free;
affect_free = affect_free->next;
}
paf->type = sn;
paf->duration = -1;
paf->location = APPLY_DAMROLL;
paf->modifier = 1 + (level >= 18) + (level >= 25) + (level >= 45) + (level >= 65) +(level >= 90);;
paf->bitvector = 0;
paf->next = obj->affected;
obj->affected = paf;
if ( IS_GOOD( ch ) )
{
SET_BIT( obj->extra_flags, ITEM_ANTI_EVIL);
act(AT_BLUE, "$p glows.", ch, obj, NULL, TO_CHAR );
}
else if ( IS_EVIL( ch ) )
{
SET_BIT( obj->extra_flags, ITEM_ANTI_GOOD );
act(AT_RED, "$p glows", ch, obj, NULL, TO_CHAR );
}
else
{
SET_BIT( obj->extra_flags, ITEM_ANTI_EVIL );
SET_BIT( obj->extra_flags, ITEM_ANTI_GOOD );
act(AT_YELLOW, "$p glows.", ch, obj, NULL, TO_CHAR );
}
send_to_char(AT_BLUE, "Ok.\n\r", ch );
return;
}
void spell_flame_blade( int sn, int level, CHAR_DATA *ch, void *vo )
{
OBJ_DATA *obj = (OBJ_DATA *) vo;
if ( obj->item_type != ITEM_WEAPON
|| IS_OBJ_STAT( obj, ITEM_MAGIC )
|| IS_OBJ_STAT( obj, ITEM_FLAME )
|| ( obj->affected && !IS_OBJ_STAT( obj, ITEM_DWARVEN ) ) )
{
send_to_char(AT_RED, "That item cannot be enchanted.\n\r", ch );
return;
}
SET_BIT( obj->extra_flags, ITEM_MAGIC);
SET_BIT( obj->extra_flags, ITEM_FLAME );
send_to_char(AT_RED, "Ok.\n\r", ch );
return;
}
void spell_chaos_blade( int sn, int level, CHAR_DATA *ch, void *vo )
{
OBJ_DATA *obj = (OBJ_DATA *) vo;
if ( obj->item_type != ITEM_WEAPON
|| IS_OBJ_STAT( obj, ITEM_MAGIC )
|| IS_OBJ_STAT( obj, ITEM_CHAOS )
|| ( obj->affected && !IS_OBJ_STAT( obj, ITEM_DWARVEN ) ) )
{
send_to_char(AT_YELLOW, "That item cannot be enchanted.\n\r", ch );
return;
}
SET_BIT( obj->extra_flags, ITEM_MAGIC);
SET_BIT( obj->extra_flags, ITEM_CHAOS );
send_to_char(AT_YELLOW, "Ok.\n\r", ch );
return;
}
void spell_frost_blade( int sn, int level, CHAR_DATA *ch, void *vo )
{
OBJ_DATA *obj = (OBJ_DATA *) vo;
if ( obj->item_type != ITEM_WEAPON
|| IS_OBJ_STAT( obj, ITEM_MAGIC )
|| IS_OBJ_STAT( obj, ITEM_ICY )
|| ( obj->affected && !IS_OBJ_STAT( obj, ITEM_DWARVEN ) ) )
{
send_to_char(AT_LBLUE, "That item cannot be enchanted.\n\r", ch );
return;
}
SET_BIT( obj->extra_flags, ITEM_MAGIC);
SET_BIT( obj->extra_flags, ITEM_ICY );
send_to_char(AT_LBLUE, "Ok.\n\r", ch );
return;
}
void spell_holysword( int sn, int level, CHAR_DATA *ch, void *vo )
{
OBJ_DATA *obj = (OBJ_DATA *) vo;
AFFECT_DATA *paf;
if ( obj->item_type != ITEM_WEAPON
|| IS_OBJ_STAT( obj, ITEM_MAGIC )
|| ( obj->affected && !IS_OBJ_STAT( obj, ITEM_DWARVEN ) ) )
{
send_to_char(AT_BLUE, "That item cannot be consecrated.\n\r", ch );
return;
}
if ( !affect_free )
{
paf = alloc_perm( sizeof( *paf ) );
}
else
{
paf = affect_free;
affect_free = affect_free->next;
}
paf->type = sn;
paf->duration = -1;
paf->location = APPLY_HITROLL;
paf->modifier = 6 + (level >= 18) + (level >= 25) + (level >= 40) + (level >= 60) +(level >= 90);
paf->bitvector = 0;
paf->next = obj->affected;
obj->affected = paf;
if ( !affect_free )
{
paf = alloc_perm( sizeof( *paf ));
}
else
{
paf = affect_free;
affect_free = affect_free->next;
}
paf->type = sn;
paf->duration = -1;
paf->location = APPLY_DAMROLL;
paf->modifier = 6 + (level >= 18) + (level >= 25) + (level >= 45) + (level >= 65) +(level >= 90);;
paf->bitvector = 0;
paf->next = obj->affected;
obj->affected = paf;
if ( IS_GOOD( ch ) )
{
SET_BIT( obj->extra_flags, ITEM_ANTI_EVIL);
act(AT_BLUE, "$p glows.", ch, obj, NULL, TO_CHAR );
}
else if ( IS_EVIL( ch ) )
{
SET_BIT( obj->extra_flags, ITEM_ANTI_GOOD );
act(AT_RED, "$p glows", ch, obj, NULL, TO_CHAR );
}
else
{
SET_BIT( obj->extra_flags, ITEM_ANTI_EVIL );
SET_BIT( obj->extra_flags, ITEM_ANTI_GOOD );
act(AT_YELLOW, "$p glows.", ch, obj, NULL, TO_CHAR );
}
SET_BIT( obj->anti_class_flags, ITEM_ANTI_WARRIOR );
SET_BIT( obj->anti_class_flags, ITEM_ANTI_MAGE );
SET_BIT( obj->anti_class_flags, ITEM_ANTI_BARD );
SET_BIT( obj->anti_class_flags, ITEM_ANTI_RANGER );
SET_BIT( obj->anti_class_flags, ITEM_ANTI_VAMP );
SET_BIT( obj->anti_class_flags, ITEM_ANTI_DRUID );
SET_BIT( obj->anti_class_flags, ITEM_ANTI_PSI );
SET_BIT( obj->anti_class_flags, ITEM_ANTI_THIEF );
SET_BIT( obj->anti_class_flags, ITEM_ANTI_NECRO );
SET_BIT( obj->anti_class_flags, ITEM_ANTI_WWF );
SET_BIT( obj->anti_class_flags, ITEM_ANTI_MONK );
SET_BIT( obj->anti_class_flags, ITEM_ANTI_NINJA );
send_to_char(AT_BLUE, "Ok.\n\r", ch );
return;
}
/*
* Drain XP, MANA, HP.
* Caster gains HP.
*/
void spell_energy_drain( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
if ( saves_spell( level, victim ) )
return;
/* ch->alignment = UMAX(-1000, ch->alignment - 200); */
if ( victim->level <= 2 )
{
dam = ch->hit + 1;
}
else
{
victim->mana /= 2;
victim->move /= 2;
dam = dice( 4, level );
if ( ( ch->hit + dam ) > ( MAX_HIT(ch) + 200 ) )
ch->hit = ( MAX_HIT(ch) + 200 );
else
ch->hit += dam;
}
dam = sc_dam( ch, dam );
damage( ch, victim, dam, sn );
return;
}
void spell_psychic_quake( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *vch;
send_to_char(AT_YELLOW, "You let the chaos free from your mind!\n\r", ch );
act(AT_YELLOW, "$n's face becomes blank and concentrated.", ch, NULL, NULL, TO_ROOM );
for ( vch = char_list; vch; vch = vch->next )
{
if ( vch->deleted || !vch->in_room )
continue;
if ( vch->in_room == ch->in_room )
{
if ( vch != ch && ( IS_NPC( ch ) ? !IS_NPC( vch )
: IS_NPC( vch ) ) )
if (vch != ch )
spell_energy_drain(sn, level/2, ch, vch);
continue;
}
if ( vch->in_room->area == ch->in_room->area )
send_to_char(AT_BLUE, "A wave of chaos brushes your mind.\n\r", vch );
}
return;
}
void spell_farsight( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim;
ROOM_INDEX_DATA *blah;
if ( !( victim = get_char_world( ch, target_name ) )
|| 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_ASTRAL_IN )
|| IS_SET( ch->in_room->room_flags, ROOM_NO_ASTRAL_OUT ) )
{
send_to_char(AT_BLUE, "You failed.\n\r", ch );
return;
}
blah = ch->in_room;
if ( ch != victim )
{
char_from_room( ch );
char_to_room( ch, victim->in_room );
}
do_look( ch, "auto" );
if (ch != victim )
{
char_from_room( ch );
char_to_room( ch, blah );
}
return;
}
void spell_fireball( 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, 0, 0, 0, 0,
0, 0, 0, 0, 30, 35, 40, 45, 50, 55,
60, 65, 70, 75, 80, 82, 84, 86, 88, 90,
92, 94, 96, 98, 100, 102, 104, 106, 108, 110,
112, 114, 116, 118, 120, 122, 124, 126, 128, 130,
132, 134, 136, 138, 140, 142, 144, 146, 148, 150,
152, 154, 156, 158, 160, 162, 164, 166, 168, 170,
172, 174, 176, 178, 180, 182, 184, 186, 188, 190,
192, 194, 196, 198, 200, 202, 204, 206, 208, 210,
215, 220, 225, 230, 235, 240, 245, 250, 255, 260
};
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] * 7 );
dam = sc_dam( ch, dam );
if ( IS_AFFECTED( victim, AFF_FIRESHIELD ) )
dam /= 6;
if ( IS_AFFECTED( victim, AFF_ICESHIELD ) )
dam += dam/2;
if ( saves_spell( level, victim ) )
dam /= 2;
damage( ch, victim, dam, sn );
return;
}
void spell_molecular_unbind( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
OBJ_DATA *obj_lose;
OBJ_DATA *obj_next;
if(saves_spell ( level, victim ))
{
send_to_char(AT_BLUE, "You failed.\n\r", ch );
return;
}
for ( obj_lose = victim->carrying; obj_lose; obj_lose = obj_next )
{
char *msg;
obj_next = obj_lose->next_content;
if ( obj_lose->deleted )
continue;
if ( obj_lose->wear_loc == WEAR_NONE )
continue;
if ( IS_SET( obj_lose->extra_flags, ITEM_NO_DAMAGE ) )
continue;
switch ( obj_lose->item_type )
{
default:
msg = "Your $p gets ruined!";
extract_obj( obj_lose );
break;
case ITEM_DRINK_CON:
case ITEM_POTION:
case ITEM_CONTAINER:
case ITEM_LIGHT:
msg = "Your $p shatters!";
extract_obj( obj_lose );
break;
case ITEM_WEAPON:
case ITEM_ARMOR:
{
OBJ_DATA *pObj;
OBJ_INDEX_DATA *pObjIndex;
char *name;
char buf[MAX_STRING_LENGTH];
pObjIndex = get_obj_index(4);
pObj = create_object(pObjIndex, obj_lose->level);
name = obj_lose->short_descr;
sprintf(buf, pObj->description, name);
free_string(pObj->description);
pObj->description = str_dup(buf);
pObj->weight = obj_lose->weight;
pObj->timer = obj_lose->level;
msg = "$p has been destroyed!";
extract_obj( obj_lose );
obj_to_room ( pObj, victim->in_room );
break;
act(AT_YELLOW, msg, victim, obj_lose, NULL, TO_CHAR );
}
}
}
return;
}
void spell_shatter( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
OBJ_DATA *obj_lose;
OBJ_DATA *obj_next;
if(saves_spell ( level, victim ))
{
send_to_char(AT_BLUE, "You failed.\n\r", ch );
return;
}
for ( obj_lose = victim->carrying; obj_lose; obj_lose = obj_next )
{
char *msg;
obj_next = obj_lose->next_content;
if ( obj_lose->deleted )
continue;
if ( obj_lose->wear_loc == WEAR_NONE )
continue;
if ( IS_SET( obj_lose->extra_flags, ITEM_NO_DAMAGE ) )
continue;
switch ( obj_lose->item_type )
{
default:
msg = "Your $p gets ruined!";
extract_obj( obj_lose );
break;
case ITEM_DRINK_CON:
case ITEM_POTION:
case ITEM_CONTAINER:
case ITEM_LIGHT:
msg = "Your $p shatters!";
extract_obj( obj_lose );
break;
case ITEM_WEAPON:
case ITEM_ARMOR:
{
OBJ_DATA *pObj;
OBJ_INDEX_DATA *pObjIndex;
char *name;
char buf[MAX_STRING_LENGTH];
pObjIndex = get_obj_index(4);
pObj = create_object(pObjIndex, obj_lose->level);
name = obj_lose->short_descr;
sprintf(buf, pObj->description, name);
free_string(pObj->description);
pObj->description = str_dup(buf);
pObj->weight = obj_lose->weight;
pObj->timer = obj_lose->level;
msg = "$p has been destroyed!";
extract_obj( obj_lose );
obj_to_room ( pObj, victim->in_room );
break;
act(AT_YELLOW, msg, victim, obj_lose, NULL, TO_CHAR );
}
}
}
return;
}
void spell_fireshield( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( IS_AFFECTED( victim, AFF_FIRESHIELD ) )
return;
af.type = sn;
af.level = level;
af.duration = number_fuzzy( level / 8 );
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_FIRESHIELD;
affect_to_char( victim, &af );
send_to_char(AT_RED, "Your body is engulfed by unfelt flame.\n\r", victim );
act(AT_RED, "$n's body is engulfed in flames.", victim, NULL, NULL, TO_ROOM );
return;
}
void spell_flamestrike( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
dam = dice( 6, level/2 );
dam = sc_dam( ch, dam );
if ( IS_AFFECTED( victim, AFF_FIRESHIELD ) )
dam /= 2;
if ( IS_AFFECTED( victim, AFF_ICESHIELD ) )
dam += dam/4;
if ( saves_spell( level, victim ) )
dam /= 2;
damage( ch, victim, dam, sn );
return;
}
void spell_faerie_fire( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( IS_AFFECTED( victim, AFF_FAERIE_FIRE ) )
return;
af.type = sn;
af.level = level;
af.duration = level;
af.location = APPLY_AC;
af.modifier = 2 * level;
af.bitvector = AFF_FAERIE_FIRE;
affect_to_char( victim, &af );
af.location = APPLY_HITROLL;
af.modifier = 0 - level/10;
affect_to_char( victim, &af );
send_to_char(AT_PINK, "You are surrounded by a pink outline.\n\r", victim );
act(AT_PINK, "$n is surrounded by a pink outline.", victim, NULL, NULL, TO_ROOM );
return;
}
void spell_faerie_fog( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *ich;
send_to_char(AT_PURPLE, "You conjure a cloud of purple smoke.\n\r", ch );
act(AT_PURPLE, "$n conjures a cloud of purple smoke.", ch, NULL, NULL, TO_ROOM );
for ( ich = ch->in_room->people; ich; ich = ich->next_in_room )
{
if ( !IS_NPC( ich ) && IS_SET( ich->act, PLR_WIZINVIS ) )
continue;
if ( ich == ch || saves_spell( level, ich ) )
continue;
affect_strip ( ich, gsn_invis );
affect_strip ( ich, gsn_mass_invis );
affect_strip ( ich, gsn_sneak );
affect_strip ( ich, gsn_shadow );
affect_strip ( ich, skill_lookup("phase shift") );
affect_strip ( ich, skill_lookup("mist form") );
affect_strip ( ich, gsn_hide );
affect_strip ( ich, gsn_chameleon );
REMOVE_BIT ( ich->affected_by, AFF_HIDE );
REMOVE_BIT ( ich->affected_by, AFF_INVISIBLE );
REMOVE_BIT ( ich->affected_by, AFF_SNEAK );
REMOVE_BIT ( ich->affected_by2, AFF_PHASED );
act(AT_PURPLE, "$n is revealed!", ich, NULL, NULL, TO_ROOM );
send_to_char(AT_PURPLE, "You are revealed!\n\r", ich );
}
return;
}
void spell_fly( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( IS_AFFECTED( victim, AFF_FLYING ) )
return;
af.type = sn;
af.level = level;
af.duration = level + 3;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_FLYING;
affect_to_char( victim, &af );
send_to_char(AT_BLUE, "Your feet rise off the ground.\n\r", victim );
act(AT_BLUE, "$n's feet rise off the ground.", victim, NULL, NULL, TO_ROOM );
return;
}
void spell_gate( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *gch;
int npccount = 0;
int pccount = 0;
for ( gch = ch->in_room->people; gch; gch = gch->next_in_room )
{
if ( IS_NPC( gch ) && !IS_AFFECTED( gch, AFF_CHARM ) )
npccount++;
if ( !IS_NPC( gch ) ||
( IS_NPC( gch ) && IS_AFFECTED( gch, AFF_CHARM ) ) )
pccount++;
}
if ( npccount > pccount )
{
do_say( ch, "There are too many of us here! One must die!" );
return;
}
do_say( ch, "Come brothers! Join me in this glorious bloodbath!" );
char_to_room( create_mobile( get_mob_index( MOB_VNUM_DEMON1 ) ),
ch->in_room );
return;
}
/*
* Spell for mega1.are from Glop/Erkenbrand.
*/
void spell_general_purpose( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
dam = number_range( 25, 100 );
dam = sc_dam( ch, dam );
if ( saves_spell( level, victim ) )
dam /= 2;
damage( ch, victim, dam, sn );
return;
}
void spell_giant_strength( 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.level = level;
af.duration = level;
af.location = APPLY_STR;
af.modifier = 1 + (level >= 18) + (level >= 25);
af.bitvector = 0;
affect_to_char( victim, &af );
if ( ch != victim )
send_to_char(AT_BLUE, "Ok.\n\r", ch );
send_to_char(AT_BLUE, "You feel stronger.\n\r", victim );
return;
}
void spell_eternal_intellect( 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.level = level;
af.duration = level/2;
af.location = APPLY_INT;
af.modifier = 1 + (level >= 18) + (level >= 25);
af.bitvector = 0;
affect_to_char( victim, &af );
if ( ch != victim )
send_to_char(AT_BLUE, "Ok.\n\r", ch );
send_to_char(AT_BLUE, "You feel an unsurpased intelligence.\n\r", victim );
return;
}
void spell_golden_aura( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *)vo;
AFFECT_DATA af;
if ( IS_AFFECTED2( victim, AFF_GOLDEN ) )
return;
if ( !IS_NPC( ch )
&& !can_use_skpell( ch, sn ) )
{
send_to_char(AT_BLUE, "Nothing happens.\n\r", ch );
return;
}
af.type = sn;
af.level = level;
af.duration = number_fuzzy( level / 8 );
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_GOLDEN;
affect_to_char2( victim, &af );
send_to_char( AT_YELLOW, "You are surrounded by a golden aura.\n\r", victim );
act(AT_YELLOW, "$n is surrounded by a golden aura.", victim, NULL, NULL, TO_ROOM );
return;
}
void spell_goodberry( int sn, int level, CHAR_DATA *ch, void *vo )
{
OBJ_DATA *obj = (OBJ_DATA *) vo;
OBJ_DATA *berry;
if ( obj->item_type != ITEM_FOOD
|| IS_OBJ_STAT( obj, ITEM_MAGIC ) )
{
send_to_char(AT_BLUE, "You can do nothing to that item.\n\r", ch );
return;
}
act(AT_BLUE, "You pass your hand over $p slowly.", ch, obj, NULL, TO_CHAR );
act(AT_BLUE, "$n has created a goodberry.", ch, NULL, NULL, TO_ROOM );
berry = create_object( get_obj_index( OBJ_VNUM_BERRY ), 0 );
berry->timer = ch->level;
berry->value[0] = ch->level * 3;
berry->value[1] = ch->level * 8;
extract_obj( obj );
obj_to_char( berry, ch );
return;
}
void spell_harm( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
dam = UMAX( 20, victim->hit - dice( 1,4 ) );
dam = sc_dam( ch, dam );
if ( saves_spell( level, victim ) )
dam = UMIN( 50, dam / 4 );
dam = UMIN( 175, dam );
damage( ch, victim, dam, sn );
return;
}
void spell_heal( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
victim->hit = UMIN( (victim->hit + (ch->level*5)), MAX_HIT(victim) );
update_pos( victim );
if ( ch != victim )
send_to_char(AT_BLUE, "Ok.\n\r", ch );
send_to_char(AT_BLUE, "A warm feeling fills your body.\n\r", victim );
return;
}
/*
* Spell for mega1.are from Glop/Erkenbrand.
*/
void spell_high_explosive( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
dam = number_range( 30, 120 );
dam = sc_dam( ch, dam );
if ( saves_spell( level, victim ) )
dam /= 2;
damage( ch, victim, dam, sn );
return;
}
void spell_iceshield( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( IS_AFFECTED( victim, AFF_ICESHIELD ) )
return;
af.type = sn;
af.level = level;
af.duration = number_fuzzy( level / 3 );
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_ICESHIELD;
affect_to_char( victim, &af );
send_to_char(AT_LBLUE, "An Icy crust forms about your body.\n\r", victim );
act(AT_LBLUE, "An icy crust forms about $n's body.", victim, NULL, NULL, TO_ROOM );
return;
}
void spell_icestorm( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
dam = dice( level, 10 );
dam = sc_dam( ch, dam );
if ( IS_AFFECTED( victim, AFF_ICESHIELD ) )
dam /= 2;
if ( IS_AFFECTED( victim, AFF_FIRESHIELD ) )
dam += dam/4;
if ( saves_spell( level, victim ) )
dam /= 2;
damage( ch, victim, dam, sn );
return;
}
void spell_holy_fires( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
dam = dice( level, 10 );
dam = sc_dam( ch, dam );
if ( saves_spell( level, victim ) )
dam /= 2;
damage( ch, victim, dam, sn );
return;
}
void spell_identify( int sn, int level, CHAR_DATA *ch, void *vo )
{
OBJ_DATA *obj = (OBJ_DATA *) vo;
AFFECT_DATA *paf;
char buf [ MAX_STRING_LENGTH ];
int spn;
sprintf( buf,
"Object '%s' is type %s, extra flags %s %s %s.\n\r",
obj->name,
item_type_name( obj ),
obj->extra_flags ? extra_bit_name( obj->extra_flags ) : "",
obj->anti_race_flags ? antirace_bit_name(obj->anti_race_flags) : "",
obj->anti_class_flags ? anticlass_bit_name(obj->anti_class_flags) : "");
send_to_char(AT_CYAN, buf, ch );
#ifdef NEW_MONEY
sprintf( buf, "Weight : %d, level : %d.\n\r", obj->weight, obj->level );
send_to_char( AT_CYAN, buf, ch );
sprintf( buf, "Gold Value: %d Silver Value: %d Copper Value: %d\n\r",
obj->cost.gold, obj->cost.silver, obj->cost.copper );
#else
sprintf( buf,
"Weight : %d, value : %d, level : %d.\n\r",
obj->weight,
obj->cost,
obj->level );
#endif
send_to_char(AT_CYAN, buf, ch );
switch ( obj->item_type )
{
case ITEM_PILL:
case ITEM_SCROLL:
case ITEM_POTION:
sprintf( buf, "Level %d spells of:", obj->value[0] );
send_to_char(AT_CYAN, buf, ch );
if ( is_sn(obj->value[1]) )
{
send_to_char(AT_CYAN, " '", ch );
send_to_char(AT_WHITE, skill_table[obj->value[1]].name, ch );
send_to_char(AT_CYAN, "'", ch );
}
if ( is_sn(obj->value[2]) )
{
send_to_char(AT_CYAN, " '", ch );
send_to_char(AT_WHITE, skill_table[obj->value[2]].name, ch );
send_to_char(AT_CYAN, "'", ch );
}
if ( is_sn(obj->value[3]) )
{
send_to_char(AT_CYAN, " '", ch );
send_to_char(AT_WHITE, skill_table[obj->value[3]].name, ch );
send_to_char(AT_CYAN, "'", ch );
}
send_to_char(AT_CYAN, ".\n\r", ch );
break;
case ITEM_WAND:
case ITEM_LENSE:
case ITEM_STAFF:
if (!(obj->value[1] == -1 ) )
sprintf( buf, "Has %d(%d) charges of level %d",
obj->value[1], obj->value[2], obj->value[0] );
else
sprintf( buf, "Has unlimited charges of level %d", obj->value[0] );
send_to_char(AT_CYAN, buf, ch );
if ( is_sn(obj->value[3]) )
{
send_to_char(AT_CYAN, " '", ch );
send_to_char(AT_WHITE, skill_table[obj->value[3]].name, ch );
send_to_char(AT_CYAN, "'", ch );
}
send_to_char(AT_CYAN, ".\n\r", ch );
break;
case ITEM_WEAPON:
sprintf( buf, "Damage is %d to %d (average %d).\n\r",
obj->value[1], obj->value[2],
( obj->value[1] + obj->value[2] ) / 2 );
send_to_char(AT_RED, buf, ch );
break;
case ITEM_ARMOR:
sprintf( buf, "Armor class is %d.\n\r", obj->value[0] );
send_to_char(AT_CYAN, buf, ch );
break;
}
if ( obj->ac_type != 0 )
{
switch( obj->ac_type )
{
default: send_to_char(AT_CYAN, "Invoke Type Unknown.\n\r", ch ); break;
case 1 :
{
if ( obj->ac_charge[1] != -1 )
sprintf( buf, "Object creation invoke, with [%d/%d] charges.\n\r",
obj->ac_charge[0], obj->ac_charge[1] );
else
sprintf( buf, "Object creation invoke, with unlimited charges.\n\r" );
send_to_char(AT_CYAN, buf, ch );
break;
}
case 2 :
{
if ( obj->ac_charge[1] != -1 )
sprintf( buf, "Monster creation invoke, with [%d/%d] charges.\n\r",
obj->ac_charge[0], obj->ac_charge[1] );
else
sprintf( buf, "Monster creation invoke, with unlimited charges.\n\r" );
send_to_char(AT_CYAN, buf, ch );
break;
}
case 3 :
{
if ( obj->ac_charge[1] != -1 )
sprintf( buf, "Transfer invoke, with [%d/%d] charges.\n\r",
obj->ac_charge[0], obj->ac_charge[1] );
else
sprintf( buf, "Transfer invoke, with unlimited charges.\n\r" );
send_to_char(AT_CYAN, buf, ch );
break;
}
case 4 :
{
if ( obj->ac_charge[1] != -1 )
sprintf( buf, "Object morph invoke, with [%d/%d] charges.\n\r",
obj->ac_charge[0], obj->ac_charge[1] );
else
sprintf( buf, "Object morph invoke, with unlimited charges.\n\r" );
send_to_char(AT_CYAN, buf, ch );
break;
}
case 5 :
{
if ( obj->ac_charge[1] != -1 )
sprintf( buf, "Spell invoke, has [%d/%d] charges of ",
obj->ac_charge[0], obj->ac_charge[1] );
else
sprintf( buf, "Spell invoke, with unlimited charges of " );
send_to_char(AT_CYAN, buf, ch );
spn = skill_lookup( obj->ac_spell );
if ( is_sn(spn) )
{
send_to_char(AT_CYAN, " '", ch );
send_to_char(AT_WHITE, spn ? obj->ac_spell : "(none)", ch );
send_to_char(AT_CYAN, "'\n\r", ch );
}
break;
}
}
}
for ( paf = obj->pIndexData->affected; paf; paf = paf->next )
{
if ( paf->location != APPLY_NONE && paf->modifier != 0 )
{
sprintf( buf, "Affects %s by %d.\n\r",
affect_loc_name( paf->location ), paf->modifier );
send_to_char(AT_BLUE, buf, ch );
}
}
for ( paf = obj->affected; paf; paf = paf->next )
{
if ( paf->location != APPLY_NONE && paf->modifier != 0 )
{
sprintf( buf, "Affects %s by %d.\n\r",
affect_loc_name( paf->location ), paf->modifier );
send_to_char(AT_BLUE, buf, ch );
}
}
return;
}
void spell_vibrate( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( IS_AFFECTED( victim, AFF_VIBRATING ) )
return;
af.type = sn;
af.level = level;
af.duration = number_fuzzy( level / 8 );
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_VIBRATING;
affect_to_char( victim, &af );
send_to_char(AT_LBLUE, "You set up a complex set of vibrations around your body.\n\r", victim );
act(AT_LBLUE, "$n's body begins to vibrate.", victim, NULL, NULL, TO_ROOM );
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;
af.type = sn;
af.level = level;
af.duration = 2 * level;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_INFRARED;
affect_to_char( victim, &af );
send_to_char(AT_RED, "Your eyes glow.\n\r", victim );
act(AT_RED, "$n's eyes glow.\n\r", ch, NULL, NULL, TO_ROOM );
return;
}
void spell_incinerate( 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.level = level;
af.duration = level;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_FLAMING;
affect_join( victim, &af );
if ( ch != victim )
send_to_char(AT_RED, "Ok.\n\r", ch );
send_to_char(AT_RED, "Your body bursts into flames!\n\r", victim );
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;
af.type = sn;
af.level = level;
af.duration = 24;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_INVISIBLE;
affect_to_char( victim, &af );
send_to_char(AT_GREY, "You fade out of existence.\n\r", victim );
act(AT_GREY, "$n fades out of existence.", victim, NULL, NULL, TO_ROOM );
return;
}
void spell_phase_shift( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( IS_AFFECTED2( victim, AFF_PHASED ) )
return;
af.type = sn;
af.level = level;
af.duration = ch->level/6;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_PHASED;
affect_to_char2( victim, &af );
send_to_char(AT_GREY, "You phase into another plane.\n\r", victim );
act(AT_GREY, "$n phases out of reality.", victim, NULL, NULL, TO_ROOM );
return;
}
void spell_mist_form( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if ( IS_AFFECTED2( victim, AFF_PHASED ) )
return;
af.type = sn;
af.level = level;
af.duration = ch->level/6;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_PHASED;
affect_to_char2( victim, &af );
send_to_char(AT_GREY, "You seem to feel transparent.\n\r", victim );
act(AT_GREY, "$n takes on the form of a mist.", victim, NULL, NULL, TO_ROOM );
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(AT_BLUE, 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 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,
70, 72, 74, 76, 78, 80, 82, 84, 86, 88,
90, 92, 94, 96, 98, 100,102,104,106,108,
110,112,114,116,118, 120,122,124,126,128,
130,132,134,136,138, 140,142,144,146,148,
150,152,154,156,158, 160,162,164,166,170
};
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 );
dam = sc_dam( ch, dam );
if ( saves_spell( level, victim ) )
dam /= 2;
if ( IS_AFFECTED( victim, AFF_SHOCKSHIELD ) )
dam /= 2;
damage( ch, victim, dam, sn );
return;
}
void spell_locate_object( int sn, int level, CHAR_DATA *ch, void *vo )
{
OBJ_DATA *obj;
OBJ_DATA *in_obj;
char buf [ MAX_INPUT_LENGTH ];
bool found;
found = FALSE;
for ( obj = object_list; obj; obj = obj->next )
{
if ( !can_see_obj( ch, obj ) || !is_name( ch, target_name, obj->name ) )
continue;
if ( IS_SET( obj->extra_flags, ITEM_NO_LOCATE) && ( get_trust( ch ) < L_APP ) )
continue;
found = TRUE;
for ( in_obj = obj; in_obj->in_obj; in_obj = in_obj->in_obj )
;
if ( in_obj->carried_by )
{
sprintf( buf, "%s carried by %s.\n\r",
obj->short_descr, PERS( in_obj->carried_by, ch ) );
}
else if ( in_obj->stored_by )
{
sprintf( buf, "%s in storage.\n\r",
obj->short_descr );
}
else
{
sprintf( buf, "%s in %s.\n\r",
obj->short_descr, !in_obj->in_room
? "somewhere" : in_obj->in_room->name );
}
buf[0] = UPPER( buf[0] );
send_to_char(AT_BLUE, buf, ch );
}
if ( !found )
send_to_char(AT_WHITE, "Nothing like that in hell, earth, or heaven.\n\r", ch );
return;
}
void spell_magic_missile( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
static const 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,
15, 15, 15, 15, 15, 16, 16, 16, 16, 16,
18, 18, 18, 18, 18, 20, 20, 20, 20, 20,
21, 21, 21, 21, 21, 22, 22, 22, 22, 22,
24, 24, 24, 24, 24, 26, 26, 26, 26, 26,
28, 28, 28, 28, 28, 30, 31, 32, 33, 40
};
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 );
dam = sc_dam( ch, dam );
if ( saves_spell( level, victim ) )
dam /= 2;
damage( ch, victim, dam, sn );
return;
}
void spell_mana( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
victim->mana = UMIN( victim->mana + 70, MAX_MANA(victim) );
update_pos( victim );
if ( ch != victim )
send_to_char(AT_BLUE, "Ok.\n\r", ch );
send_to_char(AT_BLUE, "You feel a surge of energy.\n\r", victim );
return;
}
void spell_mass_invis( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *gch;
AFFECT_DATA af;
for ( gch = ch->in_room->people; gch; gch = gch->next_in_room )
{
if ( !is_same_group( gch, ch ) || IS_AFFECTED( gch, AFF_INVISIBLE ) )
continue;
send_to_char(AT_GREY, "You slowly fade out of existence.\n\r", gch );
act(AT_GREY, "$n slowly fades out of existence.", gch, NULL, NULL, TO_ROOM );
af.type = sn;
af.level = level;
af.duration = 24;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_INVISIBLE;
affect_to_char( gch, &af );
}
send_to_char(AT_BLUE, "Ok.\n\r", ch );
return;
}
void spell_null( int sn, int level, CHAR_DATA *ch, void *vo )
{
send_to_char(AT_WHITE, "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.level = level;
af.duration = number_fuzzy( level / 4 );
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_PASS_DOOR;
affect_to_char( victim, &af );
send_to_char(AT_GREY, "You turn translucent.\n\r", victim );
act(AT_GREY, "$n turns translucent.", victim, NULL, NULL, TO_ROOM );
return;
}
void spell_permenancy( int sn, int level, CHAR_DATA *ch, void *vo )
{
OBJ_DATA *obj = (OBJ_DATA *) vo;
/* AFFECT_DATA *paf;*/
if ( obj->item_type != ITEM_WAND
&& obj->item_type != ITEM_STAFF
&& obj->item_type != ITEM_LENSE )
{
send_to_char(AT_BLUE, "You cannot make that item permenant.\n\r", ch );
return;
}
obj->value[2] = -1;
obj->value[1] = -1;
act(AT_BLUE, "You run your finger up $p, you can feel it's power growing.", ch, obj, NULL, TO_CHAR );
act(AT_BLUE, "$n slowly runs $s finger up $p.", ch, obj, NULL, TO_ROOM );
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 ) || victim->race == RACE_GHOUL )
return;
af.type = sn;
af.level = level;
af.duration = level;
af.location = APPLY_STR;
af.modifier = -2;
af.bitvector = AFF_POISON;
affect_join( victim, &af );
if ( ch != victim )
send_to_char(AT_GREEN, "Ok.\n\r", ch );
send_to_char(AT_GREEN, "You feel very sick.\n\r", victim );
return;
}
void spell_polymorph( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
char buf [MAX_STRING_LENGTH];
AFFECT_DATA af;
if ( !(victim = get_char_world( ch, target_name ) )
|| victim == ch
|| saves_spell( level, victim)
|| IS_AFFECTED( ch, AFF_POLYMORPH ) )
{
send_to_char( AT_BLUE, "You failed.\n\r", ch );
return;
}
af.type = sn;
af.level = level;
af.duration = level/5;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_POLYMORPH;
affect_to_char2( ch, &af );
if (!IS_NPC(victim))
{
sprintf( buf, "%s %s", victim->name, victim->pcdata->title);
free_string( ch->long_descr );
ch->long_descr = str_dup(buf);
}
else
{
sprintf( buf, "%s", victim->long_descr );
free_string( ch->long_descr );
ch->long_descr = str_dup(buf);
}
act(AT_BLUE, "$n's form wavers and then resolidifies.", ch, NULL, NULL, TO_ROOM);
send_to_char(AT_BLUE, "You have succesfully polymorphed.\n\r", ch );
return;
}
void spell_portal( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
OBJ_DATA *gate1;
OBJ_DATA *gate2;
int duration;
if ( !( victim = get_char_world( ch, target_name ) )
|| victim == ch
|| !victim->in_room
|| 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_ASTRAL_IN )
|| IS_SET( ch->in_room->room_flags, ROOM_NO_ASTRAL_OUT )
|| IS_ARENA(ch)
|| victim->in_room->area == arena.area
|| IS_SET( victim->in_room->area->area_flags, AREA_PROTOTYPE ) )
{
send_to_char(AT_BLUE, "You failed.\n\r", ch );
return;
}
duration = level/10;
gate1 = create_object( get_obj_index( OBJ_VNUM_PORTAL ), 0 );
gate2 = create_object( get_obj_index( OBJ_VNUM_PORTAL ), 0 );
gate1->timer = duration;
gate2->timer = duration;
gate2->value[0] = ch->in_room->vnum;
gate1->value[0] = victim->in_room->vnum;
act(AT_BLUE, "A huge shimmering gate rises from the ground.", ch, NULL, NULL, TO_CHAR );
act(AT_BLUE, "$n utters a few incantations and a gate rises from the ground.", ch, NULL, NULL, TO_ROOM );
obj_to_room( gate1, ch->in_room );
act(AT_BLUE, "A huge shimmering gate rises from the ground.", victim, NULL, NULL, TO_CHAR );
act(AT_BLUE, "A huge shimmering gate rises from the ground.", victim, NULL, NULL, TO_ROOM );
obj_to_room( gate2, victim->in_room );
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.level = level;
af.duration = 24;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_PROTECT;
affect_to_char( victim, &af );
if ( ch != victim )
send_to_char(AT_BLUE, "Ok.\n\r", ch );
send_to_char(AT_BLUE, "You feel protected.\n\r", victim );
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 + 50, MAX_MOVE(victim));
if ( ch != victim )
send_to_char(AT_BLUE, "Ok.\n\r", ch );
send_to_char(AT_BLUE, "You feel less tired.\n\r", victim );
return;
}
/* Expulsion of ITEM_NOREMOVE addition by Katrina */
void spell_remove_curse( int sn, int level, CHAR_DATA *ch, void *vo )
{
OBJ_DATA *obj;
CHAR_DATA *victim = (CHAR_DATA *) vo;
int iWear, SkNum;
int yesno = FALSE;
for ( iWear = 0; iWear < MAX_WEAR; iWear ++ )
{
if ( !( obj = get_eq_char( victim, iWear ) ) )
continue;
if ( IS_SET( obj->extra_flags, ITEM_NODROP ) )
{
REMOVE_BIT( obj->extra_flags, ITEM_NODROP );
send_to_char( AT_BLUE, "You feel a burden relieved.\n\r", ch );
yesno = TRUE;
}
if ( IS_SET( obj->extra_flags, ITEM_NOREMOVE ) )
{
REMOVE_BIT( obj->extra_flags, ITEM_NOREMOVE );
unequip_char( victim, obj );
obj_from_char( obj );
obj_to_room( obj, victim->in_room );
act(AT_BLUE, "You toss $p to the ground.", victim, obj, NULL, TO_CHAR );
act(AT_BLUE, "$n tosses $p to the ground.", victim, obj, NULL, TO_ROOM );
yesno = TRUE;
}
}
/* objs in inv uncursed by Kjodo */
for ( obj = ch->carrying; obj; obj = obj->next_content )
{
if ( IS_SET( obj->extra_flags, ITEM_NODROP ) )
{
REMOVE_BIT( obj->extra_flags, ITEM_NODROP );
send_to_char( AT_BLUE, "You feel a burden relieved.\n\r", ch );
yesno = TRUE;
}
if ( IS_SET( obj->extra_flags, ITEM_NOREMOVE ) )
{
REMOVE_BIT( obj->extra_flags, ITEM_NOREMOVE );
obj_from_char( obj );
obj_to_room( obj, victim->in_room );
act(AT_BLUE, "You toss $p to the ground.", victim, obj, NULL, TO_CHAR );
act(AT_BLUE, "$n tosses $p to the ground.", victim, obj, NULL, TO_ROOM );
yesno = TRUE;
}
/* if ( IS_ANTI_CLASS( obj, ITEM_ANTI_MAGE ) )
{
REMOVE_BIT( obj->anti_class_flags, ITEM_ANTI_MAGE );
act(AT_WHITE, "$p glows white.", victim, obj, NULL, TO_CHAR );
yesno = TRUE;
}
if ( IS_ANTI_CLASS( obj, ITEM_ANTI_CLERIC ) )
{
REMOVE_BIT( obj->anti_class_flags, ITEM_ANTI_CLERIC );
act(AT_WHITE, "$p glows white.", victim, obj, NULL, TO_CHAR );
yesno = TRUE;
}
if ( IS_ANTI_CLASS( obj, ITEM_ANTI_THIEF ) )
{
REMOVE_BIT( obj->anti_class_flags, ITEM_ANTI_THIEF );
act(AT_WHITE, "$p glows white.", victim, obj, NULL, TO_CHAR );
yesno = TRUE;
}
if ( IS_ANTI_CLASS( obj, ITEM_ANTI_WARRIOR ) )
{
REMOVE_BIT( obj->anti_class_flags, ITEM_ANTI_WARRIOR );
act(AT_WHITE, "$p glows white.", victim, obj, NULL, TO_CHAR );
yesno = TRUE;
}
if ( IS_ANTI_CLASS( obj, ITEM_ANTI_PSI ) )
{
REMOVE_BIT( obj->anti_class_flags, ITEM_ANTI_PSI );
act(AT_WHITE, "$p glows white.", victim, obj, NULL, TO_CHAR );
yesno = TRUE;
}
if ( IS_ANTI_CLASS( obj, ITEM_ANTI_DRUID ) )
{
REMOVE_BIT( obj->anti_class_flags, ITEM_ANTI_DRUID );
act(AT_WHITE, "$p glows white.", victim, obj, NULL, TO_CHAR );
yesno = TRUE;
}
if ( IS_ANTI_CLASS( obj, ITEM_ANTI_RANGER ) )
{
REMOVE_BIT( obj->anti_class_flags, ITEM_ANTI_RANGER );
act(AT_WHITE, "$p glows white.", victim, obj, NULL, TO_CHAR );
yesno = TRUE;
}
if ( IS_ANTI_CLASS( obj, ITEM_ANTI_PALADIN ) )
{
REMOVE_BIT( obj->anti_class_flags, ITEM_ANTI_PALADIN );
act(AT_WHITE, "$p glows white.", victim, obj, NULL, TO_CHAR );
yesno = TRUE;
}
if ( IS_ANTI_CLASS( obj, ITEM_ANTI_BARD ) )
{
REMOVE_BIT( obj->anti_class_flags, ITEM_ANTI_BARD );
act(AShowing the first 100 KB of 222.2 KB. Download the archive for the full file.