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

magic2.c

Go to the documentation of this file.
00001 /***************************************************************************
00002  *  Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,        *
00003  *  Michael Seifert, Hans Henrik Strfeldt, Tom Madsen, and Katja Nyboe.    *
00004  *                                                                         *
00005  *  Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael          *
00006  *  Chastain, Michael Quan, and Mitchell Tse.                              *
00007  *                                                                         *
00008  *  In order to use any part of this Merc Diku Mud, you must comply with   *
00009  *  both the original Diku license in 'license.doc' as well the Merc       *
00010  *  license in 'license.txt'.  In particular, you may not remove either of *
00011  *  these copyright notices.                                               *
00012  *                                                                         *
00013  *  Much time and thought has gone into this software and you are          *
00014  *  benefitting.  We hope that you share your changes too.  What goes      *
00015  *  around, comes around.                                                  *
00016  ***************************************************************************/
00017 
00018 /***************************************************************************
00019  *  ROM 2.4 is copyright 1993-1998 Russ Taylor                             *
00020  *  ROM has been brought to you by the ROM consortium                      *
00021  *      Russ Taylor (rtaylor@hypercube.org)                                *
00022  *      Gabrielle Taylor (gtaylor@hypercube.org)                           *
00023  *      Brian Moore (zump@rom.org)                                         *
00024  *  By using this code, you have agreed to follow the terms of the         *
00025  *  ROM license, in the file Rom24/doc/rom.license                         *
00026  ***************************************************************************/
00027 
00028 #if defined(macintosh)
00029 #include <types.h>
00030 #else
00031 #include <sys/types.h>
00032 #endif
00033 #include <stdio.h>
00034 #include <stdlib.h>
00035 #include <string.h>
00036 #include <time.h>
00037 #include "merc.h"
00038 #include "interp.h"
00039 #include "magic.h"
00040 
00041 
00042 extern char *target_name;
00043 
00044 void spell_farsight (int sn, int level, CHAR_DATA * ch, void *vo, int target)
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 }
00054 
00055 
00056 void spell_portal (int sn, int level, CHAR_DATA * ch, void *vo, int target)
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 }
00109 
00110 void spell_nexus (int sn, int level, CHAR_DATA * ch, void *vo, int target)
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 }

Generated on Thu Jan 13 21:48:12 2005 for Beyond the Shadows by  doxygen 1.4.0