Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

magic2.c File Reference

#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"
#include "interp.h"
#include "magic.h"

Include dependency graph for magic2.c:

Go to the source code of this file.

Functions

void spell_farsight (int sn, int level, CHAR_DATA *ch, void *vo, int target)
void spell_nexus (int sn, int level, CHAR_DATA *ch, void *vo, int target)
void spell_portal (int sn, int level, CHAR_DATA *ch, void *vo, int target)

Variables

char * target_name


Function Documentation

void spell_farsight int  sn,
int  level,
CHAR_DATA ch,
void *  vo,
int  target
 

Definition at line 44 of file magic2.c.

References AFF_BLIND, do_function(), do_scan(), IS_AFFECTED, send_to_char(), and target_name.

00045 {
00046     if (IS_AFFECTED (ch, AFF_BLIND))
00047     {
00048         send_to_char ("Maybe it would help if you could see?\n\r", ch);
00049         return;
00050     }
00051 
00052     do_function (ch, &do_scan, target_name);
00053 }

Here is the call graph for this function:

void spell_nexus int  sn,
int  level,
CHAR_DATA ch,
void *  vo,
int  target
 

Definition at line 110 of file magic2.c.

References act, can_see_room(), create_object(), DAM_NONE, extract_obj(), get_char_world(), get_eq_char(), get_obj_index(), char_data::imm_flags, IMM_SUMMON, char_data::in_room, is_clan(), IS_IMMORTAL, IS_NPC, is_same_clan(), IS_SET, obj_data::item_type, ITEM_WARP_STONE, char_data::level, LEVEL_HERO, obj_to_room(), OBJ_VNUM_PORTAL, room_index_data::people, room_index_data::room_flags, ROOM_NO_RECALL, ROOM_PRIVATE, ROOM_SAFE, ROOM_SOLITARY, saves_spell(), send_to_char(), target_name, obj_data::timer, TO_CHAR, TO_ROOM, obj_data::value, room_index_data::vnum, and WEAR_HOLD.

00111 {
00112     CHAR_DATA *victim;
00113     OBJ_DATA *portal, *stone;
00114     ROOM_INDEX_DATA *to_room, *from_room;
00115 
00116     from_room = ch->in_room;
00117 
00118     if ((victim = get_char_world (ch, target_name)) == NULL
00119         || victim == ch
00120         || (to_room = victim->in_room) == NULL
00121         || !can_see_room (ch, to_room) || !can_see_room (ch, from_room)
00122         || IS_SET (to_room->room_flags, ROOM_SAFE)
00123         || IS_SET (from_room->room_flags, ROOM_SAFE)
00124         || IS_SET (to_room->room_flags, ROOM_PRIVATE)
00125         || IS_SET (to_room->room_flags, ROOM_SOLITARY)
00126         || IS_SET (to_room->room_flags, ROOM_NO_RECALL)
00127         || IS_SET (from_room->room_flags, ROOM_NO_RECALL)
00128         || victim->level >= level + 3 || (!IS_NPC (victim) && victim->level >= LEVEL_HERO)    /* NOT trust */
00129         || (IS_NPC (victim) && IS_SET (victim->imm_flags, IMM_SUMMON))
00130         || (IS_NPC (victim) && saves_spell (level, victim, DAM_NONE))
00131         || (is_clan (victim) && !is_same_clan (ch, victim)))
00132     {
00133         send_to_char ("You failed.\n\r", ch);
00134         return;
00135     }
00136 
00137     stone = get_eq_char (ch, WEAR_HOLD);
00138     if (!IS_IMMORTAL (ch)
00139         && (stone == NULL || stone->item_type != ITEM_WARP_STONE))
00140     {
00141         send_to_char ("You lack the proper component for this spell.\n\r",
00142                       ch);
00143         return;
00144     }
00145 
00146     if (stone != NULL && stone->item_type == ITEM_WARP_STONE)
00147     {
00148         act ("You draw upon the power of $p.", ch, stone, NULL, TO_CHAR);
00149         act ("It flares brightly and vanishes!", ch, stone, NULL, TO_CHAR);
00150         extract_obj (stone);
00151     }
00152 
00153     /* portal one */
00154     if ((portal = create_object (get_obj_index (OBJ_VNUM_PORTAL), 0)) == NULL)
00155     {
00156         send_to_char("ERROR: Create_object returned NULL, please seek a coder.\n\r",ch);
00157         return;
00158     }
00159     
00160     portal->timer = 1 + level / 10;
00161     portal->value[3] = to_room->vnum;
00162 
00163     obj_to_room (portal, from_room);
00164 
00165     act ("$p rises up from the ground.", ch, portal, NULL, TO_ROOM);
00166     act ("$p rises up before you.", ch, portal, NULL, TO_CHAR);
00167 
00168     /* no second portal if rooms are the same */
00169     if (to_room == from_room)
00170         return;
00171 
00172     /* portal two */
00173     if ((portal = create_object (get_obj_index (OBJ_VNUM_PORTAL), 0)) == NULL)
00174     {
00175         send_to_char("ERROR: Create_object returned NULL, please seek a coder.\n\r",ch);
00176         return;
00177     }
00178     
00179     portal->timer = 1 + level / 10;
00180     portal->value[3] = from_room->vnum;
00181 
00182     obj_to_room (portal, to_room);
00183 
00184     if (to_room->people != NULL)
00185     {
00186         act ("$p rises up from the ground.", to_room->people, portal, NULL,
00187              TO_ROOM);
00188         act ("$p rises up from the ground.", to_room->people, portal, NULL,
00189              TO_CHAR);
00190     }
00191 }

Here is the call graph for this function:

void spell_portal int  sn,
int  level,
CHAR_DATA ch,
void *  vo,
int  target
 

Definition at line 56 of file magic2.c.

References act, can_see_room(), create_object(), DAM_NONE, extract_obj(), get_char_world(), get_eq_char(), get_obj_index(), char_data::imm_flags, IMM_SUMMON, obj_data::in_room, char_data::in_room, is_clan(), IS_IMMORTAL, IS_NPC, is_same_clan(), IS_SET, obj_data::item_type, ITEM_WARP_STONE, char_data::level, LEVEL_HERO, obj_to_room(), OBJ_VNUM_PORTAL, room_index_data::room_flags, ROOM_NO_RECALL, ROOM_PRIVATE, ROOM_SAFE, ROOM_SOLITARY, saves_spell(), send_to_char(), target_name, obj_data::timer, TO_CHAR, TO_ROOM, obj_data::value, room_index_data::vnum, and WEAR_HOLD.

00057 {
00058     CHAR_DATA *victim;
00059     OBJ_DATA *portal, *stone;
00060 
00061     if ((victim = get_char_world (ch, target_name)) == NULL
00062         || victim == ch
00063         || victim->in_room == NULL
00064         || !can_see_room (ch, victim->in_room)
00065         || IS_SET (victim->in_room->room_flags, ROOM_SAFE)
00066         || IS_SET (victim->in_room->room_flags, ROOM_PRIVATE)
00067         || IS_SET (victim->in_room->room_flags, ROOM_SOLITARY)
00068         || IS_SET (victim->in_room->room_flags, ROOM_NO_RECALL)
00069         || IS_SET (ch->in_room->room_flags, ROOM_NO_RECALL)
00070         || victim->level >= level + 3 || (!IS_NPC (victim) && victim->level >= LEVEL_HERO)    /* NOT trust */
00071         || (IS_NPC (victim) && IS_SET (victim->imm_flags, IMM_SUMMON))
00072         || (IS_NPC (victim) && saves_spell (level, victim, DAM_NONE))
00073         || (is_clan (victim) && !is_same_clan (ch, victim)))
00074     {
00075         send_to_char ("You failed.\n\r", ch);
00076         return;
00077     }
00078 
00079     stone = get_eq_char (ch, WEAR_HOLD);
00080     if (!IS_IMMORTAL (ch)
00081         && (stone == NULL || stone->item_type != ITEM_WARP_STONE))
00082     {
00083         send_to_char ("You lack the proper component for this spell.\n\r",
00084                       ch);
00085         return;
00086     }
00087 
00088     if (stone != NULL && stone->item_type == ITEM_WARP_STONE)
00089     {
00090         act ("You draw upon the power of $p.", ch, stone, NULL, TO_CHAR);
00091         act ("It flares brightly and vanishes!", ch, stone, NULL, TO_CHAR);
00092         extract_obj (stone);
00093     }
00094 
00095     if ((portal = create_object (get_obj_index (OBJ_VNUM_PORTAL), 0)) == NULL)
00096     {
00097         send_to_char("ERROR: Create_object returned NULL, please seek a coder.\n\r",ch);
00098         return;
00099     }
00100 
00101     portal->timer = 2 + level / 25;
00102     portal->value[3] = victim->in_room->vnum;
00103 
00104     obj_to_room (portal, ch->in_room);
00105 
00106     act ("$p rises up from the ground.", ch, portal, NULL, TO_ROOM);
00107     act ("$p rises up before you.", ch, portal, NULL, TO_CHAR);
00108 }

Here is the call graph for this function:


Variable Documentation

char* target_name
 

Definition at line 304 of file magic.c.

Referenced by do_cast(), obj_cast_spell(), spell_continual_light(), spell_control_weather(), spell_farsight(), spell_gate(), spell_locate_object(), spell_nexus(), spell_portal(), spell_summon(), and spell_ventriloquate().


Generated on Thu Jan 13 22:09:27 2005 for Beyond the Shadows by  doxygen 1.4.0