magic.c
demise/src/magic.c · 221.6 KB
From the archive dodbackup-final.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. *
* *
* In order to use any part of this Merc Diku Mud, you must comply with *
* both the original Diku license in 'license.doc' as well the Merc *
* license in 'license.txt'. 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. *
***************************************************************************/
/***************************************************************************
* God Wars Mud improvements copyright (C) 1994, 1995, 1996 by Richard *
* Woolcock. This mud is NOT to be copied in whole or in part, or to be *
* run without the permission of Richard Woolcock. Nobody else has *
* permission to authorise the use of this code. *
***************************************************************************/
#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"
/*
* Local functions.
*/
void say_spell args ((CHAR_DATA * ch, int sn));
void improve_spl args ((CHAR_DATA * ch, int dtype, int sn));
/*
* Improve ability at a certain spell type. KaVir.
*/
void
improve_spl (CHAR_DATA * ch, int dtype, int sn)
{
char buf[MIL];
char bufskill[MIL];
char buftype[MIL];
int dice1, dice2, train, trapper, max;
int chance = 55;
if (IS_SET (mudconfig->world_affects, WORLD_DOUBLETRAIN))
chance -= 15;
if (IS_SET (mudconfig->world_affects, WORLD_HALFTRAIN))
chance += 15;
dice1 = number_percent ();
dice2 = number_range (1, 100);
if (!IS_MAGE (ch) && !IS_DRAC_MAGE (ch) && !IS_RAKSHASA (ch))
max = 200;
else if (ch->level < LEVEL_MAGE)
max = 240;
else if (ch->level < LEVEL_ARCHMAGE)
max = 300;
else if (ch->level >= LEVEL_ARCHMAGE)
max = 400;
if (IS_DRAC_MAGE (ch) && max > 300)
max -= 40;
if (IS_MAGE (ch) && dtype == ch->pcdata->runes[0])
max += 50;
trapper = ch->spl[dtype];
train = dtype + 28;
if (ch->spl[dtype] >= max)
{
ch->training[train] = 0;
return;
}
if ((dice1 > ch->training[train] || dice2 > ch->training[train])
|| (dice1 >= chance || dice2 >= chance))
ch->training[train] += number_range (10, 18);
else
return;
if (ch->training[train] >= ch->spl[dtype])
{
ch->spl[dtype]++;
ch->training[train] = 0;
}
if (trapper == ch->spl[dtype])
return;
if (ch->spl[dtype] == 1)
sprintf (bufskill, "an apprentice of");
else if (ch->spl[dtype] == 26)
sprintf (bufskill, "a student at");
else if (ch->spl[dtype] == 51)
sprintf (bufskill, "a scholar at");
else if (ch->spl[dtype] == 76)
sprintf (bufskill, "a magus at");
else if (ch->spl[dtype] == 101)
sprintf (bufskill, "an adept at");
else if (ch->spl[dtype] == 126)
sprintf (bufskill, "a mage at");
else if (ch->spl[dtype] == 151)
sprintf (bufskill, "a warlock at");
else if (ch->spl[dtype] == 176)
sprintf (bufskill, "a master wizard at");
else if (ch->spl[dtype] == 200)
sprintf (bufskill, "a grand sorcerer at");
else if (ch->spl[dtype] == 240)
sprintf (bufskill, "the complete master of");
else if (ch->spl[dtype] == 300)
sprintf (bufskill, "the ultimate master of");
else if (ch->spl[dtype] == 400)
sprintf (bufskill, "the supreme master of");
else if (ch->spl[dtype] == 450)
sprintf (bufskill, "the very essence of");
else
return;
if (dtype == 0)
sprintf (buftype, "#pA#Pi#pr#7");
else if (dtype == 1)
sprintf (buftype, "#rF#Rir#re#7");
else if (dtype == 2)
sprintf (buftype, "#lWa#Lt#ler#7");
else if (dtype == 3)
sprintf (buftype, "#gEa#Gr#gth#7");
else if (dtype == 4)
sprintf (buftype, "#oSp#yir#oit#7");
else
return;
sprintf (buf, "#7You are now %s %s magic#n.\n\r", bufskill, buftype);
send_to_char (buf, ch);
return;
}
bool
is_obj (CHAR_DATA * ch)
{
OBJ_DATA *obj;
if ((obj = ch->pcdata->chobj) == NULL)
{
send_to_char ("Huh?\n\r", ch);
return FALSE;
}
if (obj->chobj == NULL || obj->chobj != ch)
{
send_to_char ("Huh?\n\r", ch);
return FALSE;
}
if (!IS_DEMON (ch))
{
send_to_char ("Huh?\n\r", ch);
return FALSE;
}
if (!IS_SET (ch->pcdata->disc[O_POWERS], DEM_MAGIC))
{
send_to_char ("You haven't been granted the gift of magic.\n\r", ch);
return FALSE;
}
return TRUE;
}
/*
* Lookup a skill by name.
*/
int
skill_lookup (const char *name)
{
int sn;
for (sn = 0; sn < MAX_SKILL; sn++)
{
if (skill_table[sn].name == NULL)
break;
if (LOWER (name[0]) == LOWER (skill_table[sn].name[0])
&& !str_prefix (name, skill_table[sn].name))
return sn;
}
return -1;
}
/*
* Lookup a skill by slot number.
* Used for object loading.
*/
int
slot_lookup (int slot)
{
extern bool fBootDb;
int sn;
if (slot <= 0)
return -1;
for (sn = 0; sn < MAX_SKILL; sn++)
{
if (slot == skill_table[sn].slot)
return sn;
}
if (fBootDb)
{
bug ("Slot_lookup: bad slot %d.", slot);
abort ();
}
return -1;
}
int
sn_lookup (int sn)
{
int num;
if (sn <= 0 || sn > MAX_SKILL)
return 0;
num = skill_table[sn].slot;
return num;
}
/*
* Utter mystical words for an sn.
*/
void
say_spell (CHAR_DATA * ch, int sn)
{
char buf[MSL];
char buf2[MSL];
char buf3[MSL];
char colour[MSL];
char *pName;
char *gtype;
bool add_s;
int iSyl;
int length;
struct syl_type
{
char *old;
char *new;
};
static const struct syl_type syl_table[] = {
{" ", " "},
{"ar", "abra"},
{"au", "kada"},
{"bless", "fir doz"},
{"blind", "noq wol"},
{"bur", "mosa"},
{"cu", "judi"},
{"de", "ocu loi"},
{"en", "uns ot"},
{"light", "dies"},
{"lo", "hi"},
{"mor", "zak"},
{"move", "sido"},
{"ness", "lacr ipu"},
{"ning", "ill arki"},
{"per", "duda sim"},
{"ra", "gru tpr"},
{"re", "cand usy"},
{"son", "sab rux"},
{"tect", "ix tra"},
{"tri", "cul ay"},
{"ven", "nofo uj"},
{"a", "a"}, {"b", "b"}, {"c", "q"}, {"d", "e"},
{"e", "z"}, {"f", "yr ill"}, {"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, "#7$n utters the words, '#P%s#7'.#n", buf);
sprintf (buf3, "#7You utter the words, '#P%s#7'.#n", buf);
// sprintf (buf, "#7$n utters the words, '#P%s#7'.#n", skill_table[sn].name);
if (IS_EXTRA (ch, EXTRA_OSWITCH))
{
gtype = "blade";
add_s = TRUE;
}
else if (IS_HEAD (ch, LOST_EYE_L) && IS_HEAD (ch, LOST_EYE_R))
{
gtype = "empty eye sockets";
add_s = FALSE;
}
else if (IS_HEAD (ch, LOST_EYE_L))
{
gtype = "right eye";
add_s = TRUE;
}
else if (IS_HEAD (ch, LOST_EYE_R))
{
gtype = "left eye";
add_s = TRUE;
}
else
{
gtype = "eyes";
add_s = FALSE;
}
if (skill_table[sn].target == 0)
{
sprintf (colour, "$n's #p%s glow%s passionately purple for a moment.",
gtype, add_s ? "s" : "");
ADD_COLOUR (ch, colour, MAGENTA);
act (colour, ch, NULL, NULL, TO_ROOM);
sprintf (colour, "Your #p%s glow%s passionately purple for a moment.",
gtype, add_s ? "s" : "");
ADD_COLOUR (ch, colour, MAGENTA);
act (colour, ch, NULL, NULL, TO_CHAR);
act (buf2, ch, NULL, NULL, TO_ROOM);
act (buf3, ch, NULL, NULL, TO_CHAR);
}
else if (skill_table[sn].target == 1)
{
sprintf (colour, "$n's #r%s glow%s fiery red for a moment.", gtype,
add_s ? "s" : "");
ADD_COLOUR (ch, colour, D_RED);
act (colour, ch, NULL, NULL, TO_ROOM);
sprintf (colour, "Your #r%s glow%s fiery red for a moment.", gtype,
add_s ? "s" : "");
ADD_COLOUR (ch, colour, D_RED);
act (colour, ch, NULL, NULL, TO_CHAR);
act (buf2, ch, NULL, NULL, TO_ROOM);
act (buf3, ch, NULL, NULL, TO_CHAR);
}
else if (skill_table[sn].target == 2)
{
sprintf (colour, "$n's #l%s glow%s brilliantly blue for a moment.",
gtype, add_s ? "s" : "");
ADD_COLOUR (ch, colour, D_BLUE);
act (colour, ch, NULL, NULL, TO_ROOM);
sprintf (colour, "Your #l%s glow%s brilliantly blue for a moment.",
gtype, add_s ? "s" : "");
ADD_COLOUR (ch, colour, D_BLUE);
act (colour, ch, NULL, NULL, TO_CHAR);
act (buf2, ch, NULL, NULL, TO_ROOM);
act (buf3, ch, NULL, NULL, TO_CHAR);
}
else if (skill_table[sn].target == 3)
{
sprintf (colour, "$n's #g%s glow%s emerald green for a moment.", gtype,
add_s ? "s" : "");
ADD_COLOUR (ch, colour, D_GREEN);
act (colour, ch, NULL, NULL, TO_ROOM);
sprintf (colour, "Your #g%s glow%s emerald green for a moment.", gtype,
add_s ? "s" : "");
ADD_COLOUR (ch, colour, D_GREEN);
act (colour, ch, NULL, NULL, TO_CHAR);
act (buf2, ch, NULL, NULL, TO_ROOM);
act (buf3, ch, NULL, NULL, TO_CHAR);
}
else if (skill_table[sn].target == 4)
{
sprintf (colour, "$n's #y%s glow%s florescent yellow for a moment.",
gtype, add_s ? "s" : "");
ADD_COLOUR (ch, colour, YELLOW);
act (colour, ch, NULL, NULL, TO_ROOM);
sprintf (colour, "Your #y%s glow%s florescent yellow for a moment.",
gtype, add_s ? "s" : "");
ADD_COLOUR (ch, colour, YELLOW);
act (colour, ch, NULL, NULL, TO_CHAR);
act (buf2, ch, NULL, NULL, TO_ROOM);
act (buf3, ch, NULL, NULL, TO_CHAR);
}
return;
}
/*
* Compute a saving throw.
* Negative apply's make saving throw better.
*/
bool
saves_spell (sh_int level, CHAR_DATA * victim)
{
int save;
int tsave;
if (!IS_NPC (victim))
{
tsave = (victim->spl[0] + victim->spl[1] + victim->spl[2] +
victim->spl[3] + victim->spl[4]) * 0.05;
save = 50 + (tsave - level - victim->saving_throw) * 5;
}
else
save = 50 + (victim->level - level - victim->saving_throw) * 5;
save = URANGE (15, save, 85);
return number_percent () < save;
}
/*
* The kludgy global is for spells who want more stuff from command line.
*/
char *target_name;
void
do_cast (CHAR_DATA * ch, char *argument)
{
char arg1[MIL];
char arg2[MIL];
CHAR_DATA *victim;
OBJ_DATA *obj;
void *vo;
int mana;
int sn;
/*
* Switched NPC's can cast spells, but others can't.
*/
if (IS_NPC (ch) && ch->desc == NULL)
return;
/* Polymorphed players cannot cast spells */
if (!IS_NPC (ch) && IS_AFFECTED (ch, AFF_POLYMORPH) &&
!IS_VAMPAFF (ch, VAM_DISGUISED))
{
if (!IS_SET (ch->dpwrs, DRA_MAGIC))
{
if (!is_obj (ch))
{
send_to_char ("You cannot cast spells in this form.\n\r", ch);
return;
}
}
}
if (ch->in_room != NULL)
{
if (IS_SET (ch->in_room->added_flags, ROOM2_WARDVSMAGIC))
{
stc ("Somthing prevents you from casting magic in this room...\n\r",
ch);
return;
}
}
/*Ghosts can't channel the magic needed to cast spells */
if (IS_GHOST (ch))
{
stc ("You can not cast spells, the weave will not yield to you.\n\r",
ch);
return;
}
if (IS_ITEMAFF (ch, ITEMA_REFLECT))
{
send_to_char ("You are unable to focus your spell.\n\r", ch);
return;
}
target_name = one_argument (argument, arg1);
one_argument (target_name, arg2);
if (arg1[0] == '\0')
{
send_to_char ("Cast which what where?\n\r", ch);
return;
}
if ((sn = skill_lookup (arg1)) < 0 || skill_table[sn].skill_level > 20
|| (!IS_NPC (ch) && ch->level < skill_table[sn].skill_level))
{
send_to_char ("You can't do that.\n\r", ch);
return;
}
if (ch->position < skill_table[sn].minimum_position)
{
if (ch->move < 50)
{
send_to_char ("You can't concentrate enough.\n\r", ch);
return;
}
ch->move = ch->move - 50;
}
mana = IS_NPC (ch) ? 0 : UMAX (skill_table[sn].min_mana,
100 / (2 + (ch->level * 12) -
skill_table[sn].skill_level));
if (!IS_NPC (ch) && IS_SET (ch->act, PLR_WOLFMAN))
{
if (ch->pcdata->disc[TOTEM_OWL] < 4)
mana *= 2;
}
if (!IS_NPC (ch) && IS_DRAGON (ch) && IS_SET (ch->dpwrs, DRA_MAGIC))
{
mana = 1;
}
if (!IS_NPC (ch) && ch->mana < mana)
{
send_to_char ("You don't have enough mystical power.\n\r", ch);
return;
}
if (!IS_NPC (ch) && number_percent () > ch->pcdata->learned[sn])
{
send_to_char ("You lost your concentration.\n\r", ch);
ch->mana -= mana / 2;
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_IGNORE:
break;
case TAR_CHAR_OFFENSIVE:
if (arg2[0] == '\0')
{
if ((victim = ch->fighting) == NULL)
{
send_to_char ("Cast the spell on whom?\n\r", ch);
return;
}
}
else
{
if ((victim = get_char_room (ch, arg2)) == NULL)
{
send_to_char ("They aren't here.\n\r", ch);
return;
}
}
if (ch == victim)
send_to_char ("Cast this on yourself? Ok...\n\r", ch);
if (IS_ITEMAFF (victim, ITEMA_REFLECT))
{
send_to_char ("You are unable to focus your spell upon them.\n\r",
ch);
return;
}
if (ch != victim)
{
if (is_safe (ch, victim))
return;
}
if (!IS_NPC (ch))
{
if (IS_AFFECTED (ch, AFF_CHARM) && ch->master == victim)
{
send_to_char ("You can't do that on your own follower.\n\r",
ch);
return;
}
}
if (!IS_NPC (ch) && IS_ITEMAFF (ch, ITEMA_PEACE))
do_majesty (ch, "");
vo = (void *) victim;
break;
case TAR_CHAR_DEFENSIVE:
if (arg2[0] == '\0')
{
victim = ch;
}
else
{
if ((victim = get_char_room (ch, arg2)) == NULL)
{
send_to_char ("They aren't here.\n\r", ch);
return;
}
}
if (IS_GHOST (victim))
{
stc ("You can not affect them with such simple spells.", ch);
return;
}
if (IS_ITEMAFF (victim, ITEMA_REFLECT))
{
send_to_char ("You are unable to focus your spell upon them.\n\r",
ch);
return;
}
vo = (void *) victim;
break;
case TAR_CHAR_SELF:
if (arg2[0] != '\0' && !is_name (arg2, ch->name))
{
send_to_char ("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 ("What should the spell be cast upon?\n\r", ch);
return;
}
if ((obj = get_obj_carry (ch, arg2)) == NULL)
{
send_to_char ("You are not carrying that.\n\r", ch);
return;
}
vo = (void *) obj;
break;
}
if (str_cmp (skill_table[sn].name, "ventriloquate"))
say_spell (ch, sn);
if (!IS_IMMORTAL (ch))
{
if (!IS_NPC (ch) && IS_MAGE (ch) && (ch->spheres[MTIM] > 1))
{
int to_wait = 9;
waiting (ch, (to_wait - ch->spheres[MTIM]));
send_to_char ("You sidestep time.\n\r", ch);
}
else if (!IS_NPC (ch) && IS_DRAC_MAGE (ch)
&& ch->pcdata->cpowers[DRAC_MAGIC] > 2)
{
int to_wait = 6;
waiting (ch, to_wait);
send_to_char ("Your dragon heritage speeds the casting.\n\r", ch);
}
else
waiting (ch, skill_table[sn].beats);
}
ch->mana -= mana;
/* Check players ability at spell type for spell power...KaVir */
if (IS_NPC (ch))
(*skill_table[sn].spell_fun) (sn, ch->level, ch, vo);
else if (!IS_MAGE (ch))
{
(*skill_table[sn].spell_fun) (sn,
(ch->spl[skill_table[sn].target] * 0.25),
ch, vo);
improve_spl (ch, skill_table[sn].target, sn);
}
else if (IS_MAGE (ch))
{
if (ch->spheres[MENT] >= 1)
{
(*skill_table[sn].spell_fun) (sn,
(ch->spl[skill_table[sn].target] *
(0.25 + (ch->spheres[MENT] * 0.1))),
ch, vo);
improve_spl (ch, skill_table[sn].target, sn);
}
else
{
(*skill_table[sn].spell_fun) (sn,
(ch->spl[skill_table[sn].target] *
0.25), ch, vo);
improve_spl (ch, skill_table[sn].target, sn);
}
}
if (skill_table[sn].target == TAR_CHAR_OFFENSIVE
&& victim != ch && victim->master != ch)
{
CHAR_DATA *vch;
CHAR_DATA *vch_next;
for (vch = ch->in_room->people; vch; vch = vch_next)
{
vch_next = vch->next_in_room;
if (victim == vch && victim->fighting == NULL)
{
multi_hit (victim, ch, TYPE_UNDEFINED);
break;
}
}
}
return;
}
/*
* Cast spells at targets using a magical object.
*/
void
obj_cast_spell (int sn, sh_int level, CHAR_DATA * ch, CHAR_DATA * victim,
OBJ_DATA * obj)
{
void *vo;
if (sn <= 0)
return;
if (sn >= MAX_SKILL || skill_table[sn].spell_fun == 0)
{
bug ("Obj_cast_spell: bad sn %d.", sn);
return;
}
switch (skill_table[sn].target)
{
default:
bug ("Obj_cast_spell: bad target for sn %d.", sn);
return;
case TAR_IGNORE:
vo = NULL;
break;
case TAR_CHAR_OFFENSIVE:
if (victim == NULL)
victim = ch->fighting;
if (victim == NULL)
{
send_to_char ("You can't do that.\n\r", ch);
return;
}
if (IS_ITEMAFF (victim, ITEMA_REFLECT))
{
send_to_char ("You are unable to focus your spell upon them.\n\r",
ch);
return;
}
if (ch != victim)
{
if (is_safe (ch, victim))
return;
}
if (!IS_NPC (ch) && IS_ITEMAFF (ch, ITEMA_PEACE))
do_majesty (ch, "");
vo = (void *) victim;
break;
case TAR_CHAR_DEFENSIVE:
if (victim == NULL)
victim = ch;
vo = (void *) victim;
break;
case TAR_CHAR_SELF:
vo = (void *) ch;
break;
case TAR_OBJ_INV:
if (obj == NULL)
{
send_to_char ("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 (skill_table[sn].target == TAR_CHAR_OFFENSIVE
&& victim != ch && victim->master != ch)
{
CHAR_DATA *vch;
CHAR_DATA *vch_next;
for (vch = ch->in_room->people; vch; vch = vch_next)
{
vch_next = vch->next_in_room;
if (victim == vch && victim->fighting == NULL)
{
multi_hit (victim, ch, TYPE_UNDEFINED);
break;
}
}
}
return;
}
/*
* Spell functions.
*/
void
spell_acid_arrow (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
if (IS_ITEMAFF (victim, ITEMA_ACIDSHIELD))
return;
dam = dice (level, 6);
if (saves_spell (level, victim))
dam /= 2;
damage (ch, victim, dam, sn, DAM_ACID, FALSE, TRUE, TRUE);
if (victim == NULL || victim->position == POS_DEAD)
return;
update_pos (victim);
return;
}
void
spell_acid_arrow_weapon (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
if (IS_ITEMAFF (victim, ITEMA_ACIDSHIELD))
return;
dam = dice (level, 6);
if (saves_spell (level, victim))
dam /= 2;
damage (ch, victim, dam, sn, DAM_ACID, FALSE, TRUE, TRUE);
if (victim == NULL || victim->position == POS_DEAD)
return;
update_pos (victim);
return;
}
void
spell_acid_blast_shield (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
if (IS_ITEMAFF (victim, ITEMA_ACIDSHIELD))
return;
dam = dice (level, 6);
if (saves_spell (level, victim))
dam /= 2;
damage (ch, victim, dam, sn, DAM_ACID, FALSE, TRUE, TRUE);
if (victim == NULL || victim->position == POS_DEAD)
return;
update_pos (victim);
return;
}
void
spell_acid_blast (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
if (IS_ITEMAFF (victim, ITEMA_ACIDSHIELD))
return;
dam = dice (level, 6);
if (saves_spell (level, victim))
dam /= 2;
damage (ch, victim, dam, sn, DAM_ACID, FALSE, TRUE, TRUE);
if (victim == NULL || victim->position == POS_DEAD)
return;
update_pos (victim);
return;
}
void
spell_blade (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
if (IS_ITEMAFF (victim, ITEMA_BLADESHIELD))
return;
dam = dice (level, 10);
if (saves_spell (level, victim))
dam /= 2;
damage (ch, victim, dam, sn, DAM_NORMAL, FALSE, TRUE, TRUE);
if (victim == NULL || victim->position == POS_DEAD)
return;
update_pos (victim);
return;
}
void
spell_blade_shield (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
if (IS_ITEMAFF (victim, ITEMA_BLADESHIELD))
return;
dam = dice (level, 10);
if (saves_spell (level, victim))
dam /= 2;
damage (ch, victim, dam, sn, DAM_NORMAL, FALSE, TRUE, TRUE);
if (victim == NULL || victim->position == POS_DEAD)
return;
update_pos (victim);
return;
}
void
spell_armor (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if (is_affected (victim, sn))
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
af.type = sn;
af.duration = 24;
af.modifier = -20;
af.location = APPLY_AC;
af.bitvector = 0;
affect_to_char (victim, &af);
act ("$n is shrouded in a suit of translucent glowing armor.", victim, NULL,
NULL, TO_ROOM);
send_to_char
("You are shrouded in a suit of translucent glowing armor.\n\r", victim);
if (ch != victim)
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_bless (int sn, sh_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 = 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);
act ("$n is blessed.", victim, NULL, NULL, TO_ROOM);
send_to_char ("You feel righteous.\n\r", victim);
if (ch != victim)
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_spirit_kiss (int sn, sh_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 = 6 * level;
af.location = APPLY_HITROLL;
af.modifier = level * 10;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_DAMROLL;
af.modifier = level * 10;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_SAVING_SPELL;
af.modifier = 0 - level * 5;
affect_to_char (victim, &af);
act ("$n is kissed by the spirits.", victim, NULL, NULL, TO_ROOM);
send_to_char ("You are kissed by the spirits.\n\r", victim);
if (ch != victim)
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_gaia_bless (int sn, sh_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 = 150;
af.location = APPLY_HITROLL;
af.modifier = 200;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_DAMROLL;
af.modifier = 200;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_DAMCAP;
af.modifier = 500;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_AC;
af.modifier = -1000;
affect_to_char (victim, &af);
act ("$n is blessed by gaia.", victim, NULL, NULL, TO_ROOM);
send_to_char ("You are blessed by gaia.\n\r", victim);
if (ch != victim)
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_draygon_bless (int sn, sh_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 = 100;
af.location = APPLY_HITROLL;
af.modifier = 350;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_DAMROLL;
af.modifier = 350;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_DAMCAP;
af.modifier = 450;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_AC;
af.modifier = -600;
affect_to_char (victim, &af);
act ("$n is blessed by Draygon the Lord of Dragons.", victim, NULL, NULL,
TO_ROOM);
send_to_char ("You are blessed by Draygon the Lord of Dragons.\n\r",
victim);
if (ch != victim)
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_bless_heaven (int sn, sh_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 = 150;
af.location = APPLY_HITROLL;
af.modifier = 750;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_DAMROLL;
af.modifier = 750;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_DAMCAP;
af.modifier = 1000;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_AC;
af.modifier = -1000;
affect_to_char (victim, &af);
act ("$n is blessed by the Celestials.", victim, NULL, NULL, TO_ROOM);
send_to_char ("You are blessed by the Celestials.\n\r", victim);
if (ch != victim)
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_dragon_luck (int sn, sh_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 = 150;
af.location = APPLY_HITROLL;
af.modifier = 100;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_DAMROLL;
af.modifier = 100;
af.bitvector = 0;
affect_to_char (victim, &af);
act ("$n gains the luck of the dragon.", victim, NULL, NULL, TO_ROOM);
send_to_char ("You have the luck of the dragon.\n\r", victim);
if (ch != victim)
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_empower (int sn, sh_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 = 150;
af.location = APPLY_HITROLL;
af.modifier = 100;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_DAMROLL;
af.modifier = 100;
af.bitvector = 0;
affect_to_char (victim, &af);
act ("$n becomes empowered.", victim, NULL, NULL, TO_ROOM);
send_to_char ("You become empowered.\n\r", victim);
if (ch != victim)
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_djinn_curse (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if (ch == victim)
{
stc ("I dont think you really want to do that.\n\r", ch);
return;
}
if (is_affected (victim, sn))
return;
af.type = sn;
af.duration = 150;
af.location = APPLY_HITROLL;
af.modifier = -100;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_DAMROLL;
af.modifier = -100;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_DAMCAP;
af.modifier = -500;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_STR;
af.modifier = -50;
af.bitvector = AFF_ROT;
affect_to_char (victim, &af);
act ("$n looks terrible as the Curse of the Djinn's takes affect.", victim,
NULL, NULL, TO_ROOM);
send_to_char ("You have been afflicted with the Djinn's Curse.\n\r",
victim);
return;
}
void
spell_pestilence (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if (ch == victim)
{
stc ("I dont think you really want to do that.\n\r", ch);
return;
}
if (is_affected (victim, sn))
return;
af.type = sn;
af.duration = 20;
af.location = APPLY_HITROLL;
af.modifier = -150;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_DAMROLL;
af.modifier = -150;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_DAMCAP;
af.modifier = -300;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_STR;
af.modifier = -20;
af.bitvector = AFF_ROT;
affect_to_char (victim, &af);
act
("$n looks terrible as the #gP#oe#0s#ot#gil#oe#0n#oc#ge#n takes affect.",
victim, NULL, NULL, TO_ROOM);
send_to_char
("You have been afflicted with a horrible #gP#oe#0s#ot#gil#oe#0n#oc#ge#n.\n\r",
victim);
return;
}
void
spell_nephcurse (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if (ch == victim)
{
stc ("I dont think you really want to do that.\n\r", ch);
return;
}
if (is_affected (victim, sn))
return;
af.type = sn;
af.duration = 50;
af.location = APPLY_HITROLL;
af.modifier = -600;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_DAMROLL;
af.modifier = -600;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_AC;
af.modifier = +2000;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_DAMCAP;
af.modifier = -1500;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_STR;
af.modifier = -50;
af.bitvector = 0;
affect_to_char (victim, &af);
return;
}
void
spell_dragon_roar (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if (ch == victim)
{
stc ("I dont think you really want to do that.\n\r", ch);
return;
}
if (is_affected (victim, sn))
{
act ("$N is already terrified by your roar.", ch, NULL, victim,
TO_CHAR);
return;
}
af.type = sn;
af.duration = 5;
af.location = APPLY_HITROLL;
af.modifier = -150;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_DAMROLL;
af.modifier = -150;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_DAMCAP;
af.modifier = -500;
af.bitvector = 0;
affect_to_char (victim, &af);
act ("$N looks terrified as $n roars savagely at $M.", ch, NULL, victim,
TO_NOTVICT);
act ("$N looks terrified as you roar savagely at $M.", ch, NULL, victim,
TO_CHAR);
act ("You are terrified as $n roars savagely at you.", ch, NULL, victim,
TO_VICT);
return;
}
void
spell_entropy (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
char buf[MIL];
int dam = number_range (200 * level, 400 * level);
if (ch == victim)
{
stc ("I dont think you really want to do that.\n\r", ch);
return;
}
if (is_affected (victim, sn))
{
act ("You have already struck $N with your entropic blast.", ch, NULL,
victim, TO_CHAR);
return;
}
af.type = sn;
af.duration = level * 4;
af.location = APPLY_HITROLL;
af.modifier = -10 * level;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_DAMROLL;
af.modifier = -10 * level;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_DAMCAP;
af.modifier = -50 * level;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_MAGIC_RESISTANCE;
af.modifier = -4 * level;
af.bitvector = 0;
affect_to_char (victim, &af);
af.location = APPLY_STR;
af.modifier = -2 * level;
af.bitvector = AFF_ROT;
affect_to_char (victim, &af);
act ("$n strikes you with a powerfull entropic blast.", ch, NULL, victim,
TO_VICT);
act ("You strike $N with a powerfull entropic blast.", ch, NULL, victim,
TO_CHAR);
act ("$n strikes $N with a powerfull entropic blast.", ch, NULL, victim,
TO_NOTVICT);
damage (ch, victim, dam, gsn_entropy, DAM_CHAOS, FALSE, TRUE, TRUE);
return;
}
void
spell_blindness (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
char buf[MIL];
if (IS_AFFECTED (victim, AFF_BLIND) || saves_spell (level, victim))
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
af.type = sn;
af.location = APPLY_HITROLL;
af.modifier = -4;
af.duration = 1 + level;
af.bitvector = AFF_BLIND;
affect_to_char (victim, &af);
send_to_char ("You are blinded!\n\r", victim);
if (!IS_NPC (victim))
sprintf (buf, "%s is blinded!\n\r", victim->name);
else
sprintf (buf, "%s is blinded!\n\r", victim->short_descr);
send_to_char (buf, ch);
return;
}
void
spell_burning_hands_weapon (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
static const int dam_each[] = {
4,
6, 8, 10, 12, 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,
50, 60, 70, 80, 90, 100, 125, 150, 175, 200
};
int dam;
if (IS_ITEMAFF (victim, ITEMA_FIRESHIELD))
return;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
level = UMIN (level, sizeof (dam_each) / sizeof (dam_each[0]) - 1);
level = UMAX (0, level);
dam = number_range (dam_each[level] / 2, dam_each[level] * 2);
if (saves_spell (level, victim))
dam >>= 1;
damage (ch, victim, dam, sn, DAM_FIRE, FALSE, TRUE, TRUE);
if (victim == NULL || victim->position == POS_DEAD)
return;
update_pos (victim);
return;
}
void
spell_burning_hands (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
static const int dam_each[] = {
4,
6, 8, 10, 12, 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,
50, 60, 70, 80, 90, 100, 125, 150, 175, 200
};
int dam;
if (IS_ITEMAFF (victim, ITEMA_FIRESHIELD))
return;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
level = UMIN (level, sizeof (dam_each) / sizeof (dam_each[0]) - 1);
level = UMAX (0, level);
dam = number_range (dam_each[level] / 2, dam_each[level] * 2);
if (saves_spell (level, victim))
dam >>= 1;
damage (ch, victim, dam, sn, DAM_FIRE, FALSE, TRUE, TRUE);
if (victim == NULL || victim->position == POS_DEAD)
return;
update_pos (victim);
return;
}
void
spell_call_lightning (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *vch;
CHAR_DATA *vch_next;
int dam;
int number_hit = 0;
if (!IS_OUTSIDE (ch))
{
send_to_char ("You must be out of doors.\n\r", ch);
return;
}
if (weather_info.sky < SKY_RAINING)
{
send_to_char ("You need bad weather.\n\r", ch);
return;
}
dam = dice (level / 2, 8);
send_to_char ("God's lightning strikes your foes!\n\r", ch);
act ("$n calls God's lightning to strike $s foes!",
ch, NULL, NULL, TO_ROOM);
for (vch = char_list; vch != NULL; vch = vch_next)
{
vch_next = vch->next;
if (vch->in_room == NULL)
continue;
if (number_hit > 9)
continue;
if (vch->in_room == ch->in_room)
{
if (vch != ch && (IS_NPC (ch) ? !IS_NPC (vch) : IS_NPC (vch)))
{
if (IS_ITEMAFF (vch, ITEMA_SHOCKSHIELD))
continue;
if (saves_spell (level, vch))
dam /= 2;
number_hit++;
damage (ch, vch, dam, sn, DAM_SHOCK, FALSE, TRUE, TRUE);
if (vch == NULL || vch->position == POS_DEAD)
continue;
}
continue;
}
if (vch->in_room->area == ch->in_room->area
&& IS_OUTSIDE (vch) && IS_AWAKE (vch))
send_to_char ("Lightning flashes in the sky.\n\r", vch);
}
return;
}
void
spell_triad_thunder (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *vch;
CHAR_DATA *vch_next;
int dam;
dam = dice (10 * level, 12 * level);
for (vch = char_list; vch != NULL; vch = vch_next)
{
vch_next = vch->next;
if (vch->in_room == NULL)
continue;
if (vch->in_room == ch->in_room)
{
if (vch != ch && (IS_NPC (ch) ? !IS_NPC (vch) : IS_NPC (vch)))
{
if (IS_ITEMAFF (vch, ITEMA_SHOCKSHIELD))
continue;
if (saves_spell (level, vch))
dam /= 2;
damage (ch, vch, dam, sn, DAM_SHOCK, FALSE, TRUE, TRUE);
dam = dice (12 * level, 14 * level);
damage (ch, vch, dam, sn, DAM_SHOCK, FALSE, TRUE, TRUE);
dam = dice (10 * level, 12 * level);
damage (ch, vch, dam, sn, DAM_SHOCK, FALSE, TRUE, TRUE);
if (vch == NULL || vch->position == POS_DEAD)
continue;
}
continue;
}
if (vch->in_room->area == ch->in_room->area
&& IS_OUTSIDE (vch) && IS_AWAKE (vch))
send_to_char ("Lightning flashes in the sky.\n\r", vch);
}
return;
}
void
spell_cause_light (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
int dam = number_range (level, 2 * level);
damage (ch, (CHAR_DATA *) vo, dam, sn, DAM_MAGIC, FALSE, TRUE, TRUE);
return;
}
void
spell_cause_critical (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
int dam = number_range (4 * level, 8 * level);
damage (ch, (CHAR_DATA *) vo, dam, sn, DAM_MAGIC, FALSE, TRUE, TRUE);
return;
}
void
spell_cause_serious (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
int dam = number_range (2 * level, 4 * level);
damage (ch, (CHAR_DATA *) vo, dam, sn, DAM_MAGIC, FALSE, TRUE, TRUE);
return;
}
void
spell_change_sex (int sn, sh_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 = 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);
send_to_char ("You feel different.\n\r", victim);
if (ch != victim)
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_charm_person (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if (victim == ch)
{
send_to_char ("You like yourself even better!\n\r", ch);
return;
}
if (!IS_NPC (victim) && IS_IMMUNE (victim, IMM_CHARM))
{
send_to_char ("You failed.\n\r", ch);
return;
}
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
/* I don't want people charming ghosts and stuff - KaVir */
if (IS_NPC (victim) && IS_AFFECTED (victim, AFF_ETHEREAL))
{
send_to_char ("You failed.\n\r", ch);
return;
}
if (IS_AFFECTED (victim, AFF_CHARM)
|| IS_AFFECTED (ch, AFF_CHARM)
|| level < victim->level || saves_spell (level, victim))
return;
if (victim->master)
stop_follower (victim);
add_follower (victim, ch);
af.type = sn;
af.duration = number_fuzzy (level / 4);
af.location = 0;
af.modifier = 0;
af.bitvector = AFF_CHARM;
affect_to_char (victim, &af);
act ("Isn't $n just so nice?", ch, NULL, victim, TO_VICT);
if (ch != victim)
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_chill_touch (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
static const int dam_each[] = {
9,
10, 10, 10, 11, 11, 12, 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,
30, 40, 50, 60, 70, 80, 90, 100, 110, 120
};
AFFECT_DATA af;
int dam;
if (IS_ITEMAFF (victim, ITEMA_ICESHIELD))
return;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
level = UMIN (level, sizeof (dam_each) / sizeof (dam_each[0]) - 1);
level = UMAX (0, level);
dam = number_range (dam_each[level] / 2, dam_each[level] * 2);
if ((!saves_spell (level, victim) ||
IS_NPC (victim) || !IS_VAMPIRE (victim)))
{
af.type = sn;
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, DAM_COLD, FALSE, TRUE, TRUE);
if (victim == NULL || victim->position == POS_DEAD)
return;
return;
}
void
spell_chill_wendigo (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
static const int dam_each[] = {
9,
10, 10, 10, 11, 11, 12, 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,
30, 40, 50, 60, 70, 80, 90, 100, 110, 120
};
AFFECT_DATA af;
int dam;
if (IS_ITEMAFF (victim, ITEMA_ICESHIELD))
return;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
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);
af.type = sn;
af.duration = 6;
af.location = APPLY_STR;
af.modifier = -1;
af.bitvector = 0;
affect_join (victim, &af);
damage (ch, victim, dam, sn, DAM_COLD, FALSE, TRUE, TRUE);
if (victim == NULL || victim->position == POS_DEAD)
return;
return;
}
void
spell_chill_touch_shield (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
static const int dam_each[] = {
9,
10, 10, 10, 11, 11, 12, 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,
30, 40, 50, 60, 70, 80, 90, 100, 110, 120
};
AFFECT_DATA af;
int dam;
if (IS_ITEMAFF (victim, ITEMA_ICESHIELD))
return;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
level = UMIN (level, sizeof (dam_each) / sizeof (dam_each[0]) - 1);
level = UMAX (0, level);
dam = number_range (dam_each[level] / 2, dam_each[level] * 2);
if ((!saves_spell (level, victim) ||
IS_NPC (victim) || !IS_VAMPIRE (victim)))
{
af.type = sn;
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, DAM_COLD, FALSE, TRUE, TRUE);
if (victim == NULL || victim->position == POS_DEAD)
return;
return;
}
void
spell_colour_spray (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
static const int dam_each[] = {
10,
15, 15, 15, 15, 15, 20, 20, 20, 20, 20,
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,
85, 95, 110, 125, 150, 175, 200, 250, 300, 350
};
int dam;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
level = UMIN (level, sizeof (dam_each) / sizeof (dam_each[0]) - 1);
level = UMAX (0, level);
dam = number_range (dam_each[level] / 2, dam_each[level] * 2);
if (saves_spell (level, victim))
dam /= 2;
damage (ch, victim, dam, sn, DAM_MAGIC, FALSE, TRUE, TRUE);
return;
}
void
spell_continual_light (int sn, sh_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 ("$n twiddles $s thumbs and $p appears.", ch, light, NULL, TO_ROOM);
act ("You twiddle your thumbs and $p appears.", ch, light, NULL, TO_CHAR);
return;
}
void
spell_control_weather (int sn, sh_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 ("Do you want it to get better or worse?\n\r", ch);
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_create_food (int sn, sh_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 ("$p suddenly appears.", ch, mushroom, NULL, TO_ROOM);
act ("$p suddenly appears.", ch, mushroom, NULL, TO_CHAR);
return;
}
void
spell_create_spring (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
OBJ_DATA *spring;
if (!IS_NPC (ch) && IS_VAMPIRE (ch))
spring = create_object (get_obj_index (OBJ_VNUM_BLOOD_SPRING), 0);
else
spring = create_object (get_obj_index (OBJ_VNUM_SPRING), 0);
spring->timer = (level << 2) + 30;
obj_to_room (spring, ch->in_room);
act ("$p flows from the ground.", ch, spring, NULL, TO_ROOM);
act ("$p flows from the ground.", ch, spring, NULL, TO_CHAR);
return;
}
void
spell_create_water (int sn, sh_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 ("It is unable to hold water.\n\r", ch);
return;
}
if (obj->value[2] != LIQ_WATER && obj->value[1] != 0)
{
send_to_char ("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 ("water", obj->name))
{
char buf[MSL];
sprintf (buf, "%s water", obj->name);
free_string (obj->name);
obj->name = str_dup (buf);
}
act ("$p is filled.", ch, obj, NULL, TO_CHAR);
}
return;
}
void
spell_cure_blindness (int sn, sh_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);
send_to_char ("Your vision returns!\n\r", victim);
if (ch != victim)
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_cure_critical (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int heal;
heal = number_range (4 * level, 8 * level);
victim->hit = UMIN (victim->hit + heal, victim->max_hit);
if (victim->hit > victim->max_hit)
victim->hit = victim->max_hit;
update_pos (victim);
send_to_char ("You feel better!\n\r", victim);
if (ch != victim)
if (ch->fighting != NULL && IS_MAGE (ch))
waiting (ch, 9);
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_cure_light (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int heal;
heal = number_range (level, 2 * level);
victim->hit = UMIN (victim->hit + heal, victim->max_hit);
if (victim->hit > victim->max_hit)
victim->hit = victim->max_hit;
update_pos (victim);
send_to_char ("You feel better!\n\r", victim);
if (ch != victim)
if (ch->fighting != NULL && IS_MAGE (ch))
waiting (ch, 9);
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_cure_poison (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
if (is_affected (victim, gsn_poison))
{
affect_strip (victim, gsn_poison);
act ("$N looks better.", ch, NULL, victim, TO_NOTVICT);
send_to_char ("A warm feeling runs through your body.\n\r", victim);
send_to_char ("Ok.\n\r", ch);
}
return;
}
void
spell_cure_serious (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int heal;
heal = number_range (2 * level, 4 * level);
victim->hit = UMIN (victim->hit + heal, victim->max_hit);
if (victim->hit > victim->max_hit)
victim->hit = victim->max_hit;
update_pos (victim);
send_to_char ("You feel better!\n\r", victim);
if (ch != victim)
if (ch->fighting != NULL && IS_MAGE (ch))
waiting (ch, 9);
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_curse (int sn, sh_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 ("Nothing happens.\n\r", ch);
return;
}
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
af.type = sn;
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);
send_to_char ("You feel unclean.\n\r", victim);
if (ch != victim)
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_tracer (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if (IS_AFFECTED (victim, AFF_TRACER))
return;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
af.type = sn;
af.duration = 4 * level;
af.modifier = 0;
af.location = APPLY_NONE;
af.bitvector = AFF_TRACER;
affect_to_char (victim, &af);
send_to_char ("You feel tainted.\n\r", victim);
if (ch != victim)
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_detect_evil (int sn, sh_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.duration = level;
af.modifier = 0;
af.location = APPLY_NONE;
af.bitvector = AFF_DETECT_EVIL;
affect_to_char (victim, &af);
send_to_char ("Your eyes tingle.\n\r", victim);
if (ch != victim)
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_detect_hidden (int sn, sh_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.duration = level;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_DETECT_HIDDEN;
affect_to_char (victim, &af);
send_to_char ("Your awareness improves.\n\r", victim);
if (ch != victim)
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_detect_invis (int sn, sh_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.duration = level;
af.modifier = 0;
af.location = APPLY_NONE;
af.bitvector = AFF_DETECT_INVIS;
affect_to_char (victim, &af);
send_to_char ("Your eyes tingle.\n\r", victim);
if (ch != victim)
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_detect_magic (int sn, sh_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.duration = level;
af.modifier = 0;
af.location = APPLY_NONE;
af.bitvector = AFF_DETECT_MAGIC;
affect_to_char (victim, &af);
send_to_char ("Your eyes tingle.\n\r", victim);
if (ch != victim)
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_detect_poison (int sn, sh_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 ("You smell poisonous fumes.\n\r", ch);
else
send_to_char ("It looks very delicious.\n\r", ch);
}
else
{
send_to_char ("It doesn't look poisoned.\n\r", ch);
}
return;
}
void
spell_dispel_evil (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
if (!IS_NPC (ch) && IS_EVIL (ch))
victim = ch;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
if (IS_GOOD (victim))
{
act ("God protects $N.", ch, NULL, victim, TO_ROOM);
return;
}
if (IS_NEUTRAL (victim))
{
act ("$N does not seem to be affected.", ch, NULL, victim, TO_CHAR);
return;
}
dam = dice (level, 4);
if (saves_spell (level, victim))
dam /= 2;
damage (ch, victim, dam, sn, DAM_MAGIC, FALSE, TRUE, TRUE);
return;
}
void
spell_holybolt (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
dam = dice (level, 50);
if (IS_EVIL (victim))
dam *= 2;
if (saves_spell (level, victim))
dam /= 2;
damage (ch, victim, dam, sn, DAM_LIGHT, FALSE, TRUE, TRUE);
return;
}
void
spell_dispel_undead (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
if (victim == ch && ch->fighting != NULL)
{
send_to_char ("You failed.\n\r", ch);
return;
}
if (victim != ch && (saves_spell (level, victim) || level < victim->level))
{
send_to_char ("You failed.\n\r", ch);
return;
}
if (IS_AFFECTED (ch, AFF_CURSE))
{
send_to_char ("Not while cursed.\n\r", ch);
return;
}
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
if (ch != victim)
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
}
if (!IS_NYM (victim, NYM_DEATHPLANE))
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
REMOVE_BIT (victim->nymbits, NYM_DEATHPLANE);
if (IS_NYM (ch, NYM_DEATHPLANE))
REMOVE_BIT (ch->nymbits, NYM_DEATHPLANE);
if (ch == victim)
{
act ("You remove all undead affects from yourself.", ch, NULL, victim,
TO_CHAR);
act ("$n has removed all undead affects from $mself.", ch, NULL,
victim, TO_NOTVICT);
}
else
{
act ("You remove all undead affects from $N.", ch, NULL, victim,
TO_CHAR);
act ("$n has removed all undead affects from $N.", ch, NULL, victim,
TO_NOTVICT);
act ("$n has removed all undead affects from you.", ch, NULL, victim,
TO_VICT);
}
return;
}
void
spell_dispel_magic (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
if (victim != ch && (saves_spell (level, victim) || level < victim->level))
{
send_to_char ("You failed.\n\r", ch);
return;
}
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
if (ch != victim)
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
}
if (!(victim->affected))
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
while (victim->affected)
affect_remove (victim, victim->affected);
if (ch == victim)
{
act ("You remove all magical affects from yourself.", ch, NULL, victim,
TO_CHAR);
act ("$n has removed all magical affects from $mself.", ch, NULL,
victim, TO_NOTVICT);
}
else
{
act ("You remove all magical affects from $N.", ch, NULL, victim,
TO_CHAR);
act ("$n has removed all magical affects from $N.", ch, NULL, victim,
TO_NOTVICT);
act ("$n has removed all magical affects from you.", ch, NULL, victim,
TO_VICT);
}
return;
}
void
spell_earthquake (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *vch;
CHAR_DATA *vch_next;
int number_hit = 0;
send_to_char ("The earth trembles beneath your feet!\n\r", ch);
act ("$n makes the earth tremble and shiver.", ch, NULL, NULL, TO_ROOM);
for (vch = char_list; vch != NULL; vch = vch_next)
{
vch_next = vch->next;
if (vch->in_room == NULL)
continue;
if (number_hit > 9)
continue;
if (ch == vch)
continue;
if (vch->in_room == ch->in_room)
{
damage (ch, vch, level + dice (20, 80), sn, DAM_NORMAL, FALSE,
TRUE, TRUE);
number_hit++;
continue;
}
if (vch->in_room->area == ch->in_room->area)
send_to_char ("The earth trembles and shivers.\n\r", vch);
}
return;
}
void
spell_enchant_weapon (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
OBJ_DATA *obj = (OBJ_DATA *) vo;
AFFECT_DATA *paf;
if (obj->item_type != ITEM_WEAPON
|| IS_SET (obj->quest, QUEST_ENCHANTED)
|| IS_SET (obj->quest, QUEST_ARTIFACT)
|| IS_SET (obj->quest, QUEST_RELIC) || obj->chobj != NULL)
{
send_to_char ("You are unable to enchant this weapon.\n\r", ch);
return;
}
if (IS_SET (obj->extra_flags, ITEM_VANISH))
{
stc ("Not on Illusions.\n\r", ch);
return;
}
if (affect_free == NULL)
{
paf = alloc_perm (sizeof (*paf));
}
else
{
paf = affect_free;
affect_free = affect_free->next;
}
paf->type = -1;
paf->duration = -1;
paf->location = APPLY_HITROLL;
paf->modifier = level / 5;
paf->bitvector = 0;
paf->next = obj->affected;
obj->affected = paf;
if (affect_free == NULL)
{
paf = alloc_perm (sizeof (*paf));
}
else
{
paf = affect_free;
affect_free = affect_free->next;
}
paf->type = -1;
paf->duration = -1;
paf->location = APPLY_DAMROLL;
paf->modifier = level / 10;
paf->bitvector = 0;
paf->next = obj->affected;
obj->affected = paf;
if (IS_GOOD (ch))
{
SET_BIT (obj->extra_flags, ITEM_ANTI_EVIL);
SET_BIT (obj->quest, QUEST_ENCHANTED);
act ("$p glows blue.", ch, obj, NULL, TO_CHAR);
act ("$p glows blue.", ch, obj, NULL, TO_ROOM);
}
else if (IS_EVIL (ch))
{
SET_BIT (obj->extra_flags, ITEM_ANTI_GOOD);
SET_BIT (obj->quest, QUEST_ENCHANTED);
act ("$p glows red.", ch, obj, NULL, TO_CHAR);
act ("$p glows red.", ch, obj, NULL, TO_ROOM);
}
else
{
SET_BIT (obj->extra_flags, ITEM_ANTI_EVIL);
SET_BIT (obj->extra_flags, ITEM_ANTI_GOOD);
SET_BIT (obj->quest, QUEST_ENCHANTED);
act ("$p glows yellow.", ch, obj, NULL, TO_CHAR);
act ("$p glows yellow.", ch, obj, NULL, TO_ROOM);
}
return;
}
/*
* Drain XP, MANA, HP.
* Caster gains HP.
*/
void
spell_energy_drain (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
int hp;
if (saves_spell (level, victim))
return;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
if (!IS_HERO (ch) && !IS_DEMON (ch))
ch->alignment = UMAX (-1000, ch->alignment - 200);
if (victim->level <= 2)
{
dam = ch->hit + 1;
}
else
{
dam = dice (1, level);
if (IS_NPC (victim) || !IS_IMMUNE (victim, IMM_DRAIN))
{
victim->mana -= number_range (1, 10);
if (victim->mana < 0)
victim->mana = 0;
victim->move -= number_range (1, 10);
if (victim->move < 0)
victim->move = 0;
ch->hit += dam;
if (ch->hit > (2 * ch->max_hit))
ch->hit = (2 * ch->max_hit);
}
}
hp = victim->hit;
if (IS_IMMUNE (victim, IMM_DRAIN))
victim->hit += dam;
damage (ch, victim, dam, sn, DAM_MAGIC, FALSE, TRUE, TRUE);
if (victim == NULL || victim->position == POS_DEAD)
return;
if (IS_IMMUNE (victim, IMM_DRAIN))
victim->hit = hp;
if (!IS_NPC (ch) && ch != victim)
do_beastlike (ch, "");
return;
}
void
spell_spirit_drain (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam = level;
victim->mana -= dam;
if (victim->mana < 0)
victim->mana = 0;
victim->move -= dam;
if (victim->move < 0)
victim->move = 0;
ch->hit += dam;
if (ch->hit > (2 * ch->max_hit))
ch->hit = (2 * ch->max_hit);
if (ch->hit > (10000 + ch->max_hit))
ch->hit = (10000 + ch->max_hit);
damage (ch, victim, dam, sn, DAM_MAGIC, FALSE, TRUE, TRUE);
if (victim == NULL || victim->position == POS_DEAD)
return;
return;
}
void
spell_fireball_shield (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
static const int dam_each[] = {
20,
20, 20, 20, 20, 20, 25, 25, 25, 25, 25,
30, 30, 30, 30, 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,
150, 200, 250, 300, 400, 500, 650, 750, 850, 1000
};
int dam;
if (IS_ITEMAFF (victim, ITEMA_FIRESHIELD))
return;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
level = UMIN (level, sizeof (dam_each) / sizeof (dam_each[0]) - 1);
level = UMAX (0, level);
dam = number_range (dam_each[level] / 2, dam_each[level] * 2);
if (saves_spell (level, victim))
dam /= 2;
damage (ch, victim, dam, sn, DAM_FIRE, FALSE, TRUE, TRUE);
if (victim == NULL || victim->position == POS_DEAD)
return;
update_pos (victim);
return;
}
void
spell_fireball (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
static const int dam_each[] = {
20,
20, 20, 20, 20, 20, 25, 25, 25, 25, 25,
30, 30, 30, 30, 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,
150, 200, 250, 300, 400, 500, 650, 750, 850, 1000
};
int dam;
if (IS_ITEMAFF (victim, ITEMA_FIRESHIELD))
return;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
level = UMIN (level, sizeof (dam_each) / sizeof (dam_each[0]) - 1);
level = UMAX (0, level);
dam = number_range (dam_each[level] / 2, dam_each[level] * 2);
if (saves_spell (level, victim))
dam /= 2;
damage (ch, victim, dam, sn, DAM_FIRE, FALSE, TRUE, TRUE);
if (victim == NULL || victim->position == POS_DEAD)
return;
update_pos (victim);
return;
}
void
spell_vengence (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
static const int dam_each[] = {
20,
20, 20, 20, 20, 20, 25, 25, 25, 25, 25,
30, 30, 30, 30, 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,
150, 200, 250, 300, 400, 500, 650, 750, 850, 1000
};
int dam;
if (IS_XBITS (victim, X_SHIELD_FLAMES))
return;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
level = UMIN (level, sizeof (dam_each) / sizeof (dam_each[0]) - 1);
level = UMAX (0, level);
dam = number_range (dam_each[level] / 2, dam_each[level] * 2);
if (saves_spell (level, victim))
dam /= 2;
damage (ch, victim, dam, sn, DAM_FIRE, FALSE, TRUE, TRUE);
if (victim == NULL || victim->position == POS_DEAD)
return;
update_pos (victim);
return;
}
void
spell_ice_blast_weapon (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
static const int dam_each[] = {
20,
20, 20, 20, 20, 20, 25, 25, 25, 25, 25,
30, 30, 30, 30, 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,
150, 200, 250, 300, 400, 500, 650, 750, 850, 1000
};
int dam;
if (IS_ITEMAFF (victim, ITEMA_ICESHIELD))
return;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
level = UMIN (level, sizeof (dam_each) / sizeof (dam_each[0]) - 1);
level = UMAX (0, level);
dam = number_range (dam_each[level] / 2, dam_each[level] * 2);
if (saves_spell (level, victim))
dam /= 2;
damage (ch, victim, dam, sn, DAM_COLD, FALSE, TRUE, TRUE);
if (victim == NULL || victim->position == POS_DEAD)
return;
update_pos (victim);
return;
}
void
spell_ice_blast (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
static const int dam_each[] = {
20,
20, 20, 20, 20, 20, 25, 25, 25, 25, 25,
30, 30, 30, 30, 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,
150, 200, 250, 300, 400, 500, 650, 750, 850, 1000
};
int dam;
if (IS_ITEMAFF (victim, ITEMA_ICESHIELD))
return;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
level = UMIN (level, sizeof (dam_each) / sizeof (dam_each[0]) - 1);
level = UMAX (0, level);
dam = number_range (dam_each[level] / 2, dam_each[level] * 2);
if (saves_spell (level, victim))
dam /= 2;
damage (ch, victim, dam, sn, DAM_COLD, FALSE, TRUE, TRUE);
if (victim == NULL || victim->position == POS_DEAD)
return;
update_pos (victim);
return;
}
void
spell_flamestrike (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
if (IS_ITEMAFF (victim, ITEMA_FIRESHIELD))
return;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
dam = dice (6, 8);
if (saves_spell (level, victim))
dam /= 2;
damage (ch, victim, dam, sn, DAM_FIRE, FALSE, TRUE, TRUE);
if (victim == NULL || victim->position == POS_DEAD)
return;
update_pos (victim);
return;
}
void
spell_faerie_fire (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if (IS_AFFECTED (victim, AFF_FAERIE_FIRE))
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
af.type = sn;
af.duration = level;
af.location = APPLY_AC;
af.modifier = 2 * level;
af.bitvector = AFF_FAERIE_FIRE;
affect_to_char (victim, &af);
send_to_char ("You are surrounded by a pink outline.\n\r", victim);
act ("$n is surrounded by a pink outline.", victim, NULL, NULL, TO_ROOM);
return;
}
void
spell_faerie_fog (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *ich;
act ("$n conjures a cloud of purple smoke.", ch, NULL, NULL, TO_ROOM);
send_to_char ("You conjure a cloud of purple smoke.\n\r", ch);
for (ich = ch->in_room->people; ich != NULL; 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);
REMOVE_BIT (ich->affected_by, AFF_HIDE);
REMOVE_BIT (ich->affected_by, AFF_INVISIBLE);
REMOVE_BIT (ich->affected_by, AFF_SNEAK);
REMOVE_BIT (ich->xbits, X_NINJA_HIDE);
if (!IS_NPC (ich))
{
REMOVE_BIT (ich->pcdata->cpowers[DRAC_WEAPONRY], DRAC_INVIS);
}
REMOVE_BIT (ich->vampaff, VAM_OBFUSCATE);
ich->obfuscate = 0;
act ("$n is revealed!", ich, NULL, NULL, TO_ROOM);
send_to_char ("You are revealed!\n\r", ich);
}
return;
}
void
spell_faerie_light (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *ich;
bool reveal = FALSE;
act ("$n conjures several motes of purple light.", ch, NULL, NULL, TO_ROOM);
send_to_char ("You conjure several motes of purple light.\n\r", ch);
for (ich = ch->in_room->people; ich != NULL; ich = ich->next_in_room)
{
if (ich == ch || saves_spell (level, ich))
continue;
if (IS_SET (ich->corbits, COR_DARKNESS))
{
REMOVE_BIT (ich->corbits, COR_DARKNESS);
if (ich->in_room != NULL)
{
if (IS_SET (ich->in_room->room_flags, ROOM_DJINN_DARKNESS))
REMOVE_BIT (ich->in_room->room_flags, ROOM_DJINN_DARKNESS);
}
reveal = TRUE;
}
else if (IS_MORE (ich, MORE_DARKNESS))
{
REMOVE_BIT (ich->more, MORE_DARKNESS);
REMOVE_BIT (ich->in_room->room_flags, ROOM_TOTAL_DARKNESS);
if (ich->in_room != NULL)
{
if (IS_SET (ich->in_room->room_flags, ROOM_TOTAL_DARKNESS))
REMOVE_BIT (ich->in_room->room_flags, ROOM_TOTAL_DARKNESS);
}
reveal = TRUE;
}
else
continue;
}
if (reveal)
{
act ("The purple light banishes the darkness.", ch, NULL, NULL,
TO_ROOM);
}
return;
}
void
spell_fly (int sn, sh_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.duration = level + 3;
af.location = 0;
af.modifier = 0;
af.bitvector = AFF_FLYING;
affect_to_char (victim, &af);
send_to_char ("You rise up off the ground.\n\r", victim);
act ("$n rises up off the ground.", victim, NULL, NULL, TO_ROOM);
return;
}
void
spell_gate (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
return;
char_to_room (create_mobile (get_mob_index (MOB_VNUM_VAMPIRE)),
ch->in_room);
return;
}
/*
* Spell for mega1.are from Glop/Erkenbrand.
*/
void
spell_general_purpose (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
dam = number_range (25, 100);
if (saves_spell (level, victim))
dam /= 2;
damage (ch, victim, dam, sn, DAM_MAGIC, FALSE, TRUE, TRUE);
return;
}
void
spell_giant_strength (int sn, sh_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 = level;
af.location = APPLY_STR;
af.modifier = 1 + (level >= 18) + (level >= 25);
af.bitvector = 0;
affect_to_char (victim, &af);
send_to_char ("You feel stronger.\n\r", victim);
if (ch != victim)
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_harm (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
dam = number_range (4 * level, 8 * level);
if (saves_spell (level, victim))
dam = UMIN (50, dam * 0.25);
dam = UMIN (100, dam);
damage (ch, victim, dam, sn, DAM_MAGIC, FALSE, TRUE, TRUE);
return;
}
void
spell_heal (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int heal = number_range (8 * level, 16 * level);
victim->hit = UMIN (victim->hit + heal, victim->max_hit);
if (victim->hit > victim->max_hit)
victim->hit = victim->max_hit;
update_pos (victim);
send_to_char ("A warm feeling fills your body.\n\r", victim);
if (ch == victim)
act ("$n heals $mself.", ch, NULL, NULL, TO_ROOM);
else
act ("$n heals $N.", ch, NULL, victim, TO_NOTVICT);
if (ch != victim)
if (ch->fighting != NULL && IS_MAGE (ch))
waiting (ch, 9);
send_to_char ("Ok.\n\r", ch);
return;
}
/*
* Spell for mega1.are from Glop/Erkenbrand.
*/
void
spell_high_explosive (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
dam = number_range (30, 120);
if (saves_spell (level, victim))
dam /= 2;
damage (ch, victim, dam, sn, DAM_MAGIC, FALSE, TRUE, TRUE);
return;
}
void
spell_identify (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
OBJ_DATA *obj = (OBJ_DATA *) vo;
char buf[MSL];
AFFECT_DATA *paf;
int itemtype;
act ("You examine $p carefully.", ch, obj, NULL, TO_CHAR);
act ("$n examines $p carefully.", ch, obj, NULL, TO_ROOM);
sprintf (buf, "Object '%s' is type %s, extra flags %s.\n\rWeight is %d, value is %d.\n\r", obj->name, item_type_name (obj->item_type), /* OLC */
extra_bit_name (obj->extra_flags), obj->weight, obj->cost);
send_to_char (buf, ch);
if ((obj->points > 0 && obj->item_type != ITEM_QUEST
&& obj->item_type != ITEM_EXP && obj->item_type != ITEM_CRYSTAL
&& obj->item_type != ITEM_PAGE) || obj->crystal > 0)
{
if (obj->points > 0 && obj->crystal > 0)
{
sprintf (buf, "Credit value is %d, Crystal value is %d\n\r",
obj->points, obj->crystal);
}
else if (obj->points > 0)
{
sprintf (buf, "Credit value is %d.\n\r", obj->points);
}
else if (obj->crystal > 0)
{
sprintf (buf, "Crystal value is %d.\n\r", obj->crystal);
}
send_to_char (buf, ch);
}
if (obj->questmaker != NULL && strlen (obj->questmaker) > 1 &&
obj->questowner != NULL && strlen (obj->questowner) > 1 &&
obj->item_type != ITEM_CORPSE_NPC && obj->item_type != ITEM_CORPSE_PC)
{
sprintf (buf, "This object was created by %s, and is owned by %s.\n\r",
obj->questmaker, obj->questowner);
send_to_char (buf, ch);
}
else if (obj->questmaker != NULL && strlen (obj->questmaker) > 1 &&
obj->item_type != ITEM_CORPSE_NPC
&& obj->item_type != ITEM_CORPSE_PC)
{
sprintf (buf, "This object was created by %s.\n\r", obj->questmaker);
send_to_char (buf, ch);
}
else if (obj->questowner != NULL && strlen (obj->questowner) > 1 &&
obj->item_type != ITEM_CORPSE_NPC
&& obj->item_type != ITEM_CORPSE_PC)
{
sprintf (buf, "This object is owned by %s.\n\r", obj->questowner);
send_to_char (buf, ch);
}
if (obj->creator != NULL && strlen (obj->creator) > 1 &&
obj->item_type != ITEM_CORPSE_NPC && obj->item_type != ITEM_CORPSE_PC)
{
sprintf (buf, "This object was originally created by %s.\n\r",
obj->creator);
send_to_char (buf, ch);
}
if (obj->item_type != ITEM_PAGE)
{
/* if (IS_SET (obj->weapflags, WEAPON_IKIRYU))
{
sprintf (buf, "This object will regenerate the wearer %s more times.", obj->specpower);
stc (buf, ch);
} */
if (IS_SET (obj->quest, QUEST_ENCHANTED))
send_to_char ("This item has been enchanted.\n\r", ch);
if (IS_SET (obj->spectype, SITEM_PLANARTOUCHED))
send_to_char
("This item is filled with the power of the Celestial's.\n\r", ch);
if (IS_SET (obj->weapflags, WEAPON_BONDED))
send_to_char ("This item is bonded by a master of weapons.\n\r", ch);
if (IS_SET (obj->quest, QUEST_MAGEENCHANT))
send_to_char ("This item is Imbued with Quintessence.\n\r", ch);
if (IS_SET (obj->quest, QUEST_BLOODAGONY))
send_to_char ("This weapon is dripping with Kindred blood.\n\r", ch);
if (IS_SET (obj->spectype, SITEM_GAIATOUCHED))
send_to_char ("This item is filled with the power of Gaia.\n\r", ch);
if (IS_SET (obj->weapflags, WEAPON_TATTOOED))
send_to_char ("This item looks pretty with its tattoo.\n\r", ch);
if (IS_WEAP (obj, WEAPON_HOLY))
send_to_char ("This weapon is engulfed in a blue holy flame.\n\r",
ch);
if (IS_WEAP (obj, WEAPON_POISON))
send_to_char ("This weapon is covered in a vile green venom.\n\r",
ch);
if (IS_WEAP (obj, WEAPON_FROST))
send_to_char ("This weapon has a deep blue tint.\n\r", ch);
if (IS_WEAP (obj, WEAPON_FLAMING))
send_to_char ("This weapon gives of a dull heat.\n\r", ch);
if (IS_WEAP (obj, WEAPON_ACID))
send_to_char ("This weapon gives of a acidic stench.\n\r", ch);
if (IS_WEAP (obj, WEAPON_SHOCKING))
send_to_char ("This weapon hums with electricity.\n\r", ch);
if (IS_WEAP (obj, WEAPON_SKINDANCER))
send_to_char
("This weapon throbs with #lMy#Ls#7ti#Lc#lal#n magic.\n\r", ch);
if (IS_WEAP (obj, WEAPON_SUPERSPEED))
send_to_char
("This Ancient Artifact grants the owner unimaginable speed.\n\r",
ch);
if (IS_WEAP (obj, WEAPON_WEBBING))
send_to_char
("This Ancient Artifact is covered in thin Spider Silk.\n\r", ch);
if (IS_WEAP (obj, WEAPON_ARMOR))
send_to_char
("This Ancient Artifact is pulsating with Archaic Protective Magic.\n\r",
ch);
if (IS_WEAP (obj, WEAPON_REDEEMER))
send_to_char
("This Ancient Artifact is radiating an Immense Hunger.\n\r", ch);
if (IS_WEAP (obj, WEAPON_MASTERMAGE))
send_to_char
("This Ancient Artifact grants the owner Ancient Powerfull Magic.\n\r",
ch);
if (IS_SET (obj->quest, QUEST_SPELLPROOF))
send_to_char ("This item is resistant to offensive spells.\n\r", ch);
if (IS_SET (obj->spectype, SITEM_DEMONIC))
{
if (IS_SET (obj->spectype, SITEM_SILVER))
{
stc
("This item is crafted crafted from dark demonsteel and gleaming silver.\n\r",
ch);
}
else
{
send_to_char ("This item is crafted from dark demonsteel.\n\r",
ch);
}
}
else if (IS_SET (obj->spectype, SITEM_SILVER))
send_to_char ("This item is crafted from gleaming silver.\n\r", 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 (buf, ch);
if (obj->value[1] >= 0 && obj->value[1] < MAX_SKILL)
{
send_to_char (" '", ch);
send_to_char (skill_table[obj->value[1]].name, ch);
send_to_char ("'", ch);
}
if (obj->value[2] >= 0 && obj->value[2] < MAX_SKILL)
{
send_to_char (" '", ch);
send_to_char (skill_table[obj->value[2]].name, ch);
send_to_char ("'", ch);
}
if (obj->value[3] >= 0 && obj->value[3] < MAX_SKILL)
{
send_to_char (" '", ch);
send_to_char (skill_table[obj->value[3]].name, ch);
send_to_char ("'", ch);
}
send_to_char (".\n\r", ch);
if (obj->pIndexData->vnum == 3038)
{
sprintf (buf,
"$p has %d uses before it is no longer covered by its warranty.",
(1000 - obj->pilluses));
act (buf, ch, obj, NULL, TO_CHAR);
}
break;
case ITEM_QUEST:
sprintf (buf, "Credit value is %d.\n\r", obj->value[0]);
send_to_char (buf, ch);
break;
case ITEM_EXP:
sprintf (buf, "Exp value is %d.\n\r", obj->value[0]);
send_to_char (buf, ch);
break;
case ITEM_CRYSTAL:
sprintf (buf, "Crystal value is %d.\n\r", obj->value[0]);
send_to_char (buf, ch);
break;
case ITEM_QUESTCARD:
sprintf (buf, "Quest completion reward is %d credit.\n\r", obj->level);
send_to_char (buf, ch);
break;
case ITEM_WAND:
case ITEM_STAFF:
sprintf (buf, "Has %d(%d) charges of level %d",
obj->value[1], obj->value[2], obj->value[0]);
send_to_char (buf, ch);
if (obj->value[3] >= 0 && obj->value[3] < MAX_SKILL)
{
send_to_char (" '", ch);
send_to_char (skill_table[obj->value[3]].name, ch);
send_to_char ("'", ch);
}
send_to_char (".\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 (buf, ch);
if (obj->value[0] >= 1000)
itemtype = obj->value[0] - ((obj->value[0] / 1000) * 1000);
else
itemtype = obj->value[0];
if (itemtype > 0)
{
if (obj->level < 10)
sprintf (buf, "%s is a minor spell weapon.\n\r",
capitalize (obj->short_descr));
else if (obj->level < 20)
sprintf (buf, "%s is a lesser spell weapon.\n\r",
capitalize (obj->short_descr));
else if (obj->level < 30)
sprintf (buf, "%s is an average spell weapon.\n\r",
capitalize (obj->short_descr));
else if (obj->level < 40)
sprintf (buf, "%s is a greater spell weapon.\n\r",
capitalize (obj->short_descr));
else if (obj->level < 50)
sprintf (buf, "%s is a major spell weapon.\n\r",
capitalize (obj->short_descr));
else if (obj->level > 50)
sprintf (buf, "%s is an ultimate spell weapon.\n\r",
capitalize (obj->short_descr));
else
sprintf (buf, "%s is a supreme spell weapon.\n\r",
capitalize (obj->short_descr));
send_to_char (buf, ch);
}
if (itemtype == 1)
sprintf (buf, "This weapon is dripping with corrosive acid.\n\r");
else if (itemtype == 4)
sprintf (buf, "This weapon radiates an aura of darkness.\n\r");
else if (itemtype == 30)
sprintf (buf, "This ancient relic is the bane of all evil.\n\r");
else if (itemtype == 34)
sprintf (buf,
"This vampiric weapon drinks the souls of its victims.\n\r");
else if (itemtype == 37)
sprintf (buf, "This weapon has been tempered in hellfire.\n\r");
else if (itemtype == 48)
sprintf (buf, "This weapon crackles with sparks of lightning.\n\r");
else if (itemtype == 53)
sprintf (buf, "This weapon is dripping with a dark poison.\n\r");
else if (itemtype > 0)
sprintf (buf, "This weapon has been imbued with the power of %s.\n\r",
skill_table[itemtype].name);
if (itemtype > 0)
send_to_char (buf, ch);
if (obj->value[0] >= 1000)
itemtype = obj->value[0] / 1000;
else
break;
if (itemtype == 4)
sprintf (buf, "This weapon radiates an aura of darkness.\n\r");
else if (itemtype == 27 || itemtype == 2)
sprintf (buf,
"This weapon allows the wielder to see invisible things.\n\r");
else if (itemtype == 39 || itemtype == 3)
sprintf (buf, "This weapon grants the power of flight.\n\r");
else if (itemtype == 45 || itemtype == 1)
sprintf (buf,
"This weapon allows the wielder to see in the dark.\n\r");
else if (itemtype == 46 || itemtype == 5)
sprintf (buf,
"This weapon renders the wielder invisible to the human eye.\n\r");
else if (itemtype == 52 || itemtype == 6)
sprintf (buf,
"This weapon allows the wielder to walk through solid doors.\n\r");
else if (itemtype == 54 || itemtype == 7)
sprintf (buf, "This holy weapon protects the wielder from evil.\n\r");
else if (itemtype == 57 || itemtype == 8)
sprintf (buf,
"This ancient weapon protects the wielder in combat.\n\r");
else if (itemtype == 9)
sprintf (buf,
"This crafty weapon allows the wielder to walk in complete silence.\n\r");
else if (itemtype == 10)
sprintf (buf,
"This powerful weapon surrounds its wielder with a shield of lightning.\n\r");
else if (itemtype == 11)
sprintf (buf,
"This powerful weapon surrounds its wielder with a shield of fire.\n\r");
else if (itemtype == 12)
sprintf (buf,
"This powerful weapon surrounds its wielder with a shield of ice.\n\r");
else if (itemtype == 13)
sprintf (buf,
"This powerful weapon surrounds its wielder with a shield of acid.\n\r");
else if (itemtype == 14)
sprintf (buf,
"This powerful weapon surrounds its wielder with a shield of blades.\n\r");
else if (itemtype == 15)
sprintf (buf,
"This ancient weapon surrounds its wielder with a shield of chaos.\n\r");
else if (itemtype == 16)
sprintf (buf,
"This ancient weapon regenerates the wounds of its wielder.\n\r");
else if (itemtype == 17)
sprintf (buf,
"This ancient weapon allows its wielder to move at supernatural speed.\n\r");
else if (itemtype == 18)
sprintf (buf,
"This razor sharp weapon can slice through armour without difficulty.\n\r");
else if (itemtype == 19)
sprintf (buf,
"This ancient weapon protects its wearer from player attacks.\n\r");
else if (itemtype == 20)
sprintf (buf,
"This ancient weapon surrounds its wielder with a shield of darkness.\n\r");
else if (itemtype == 21)
sprintf (buf,
"This ancient weapon grants superior protection to its wielder.\n\r");
else if (itemtype == 22)
sprintf (buf,
"This ancient weapon grants its wielder supernatural vision.\n\r");
else if (itemtype == 23)
sprintf (buf,
"This ancient weapon makes its wielder fleet-footed.\n\r");
else if (itemtype == 24)
sprintf (buf,
"This ancient weapon conceals its wielder from sight.\n\r");
else if (itemtype == 25)
sprintf (buf,
"This ancient weapon invokes the power of the beast.\n\r");
else
sprintf (buf, "This item is bugged...please report it.\n\r");
if (itemtype > 0)
send_to_char (buf, ch);
break;
case ITEM_ARMOR:
sprintf (buf, "Armor class is %d.\n\r", obj->value[0]);
send_to_char (buf, ch);
if (obj->value[3] < 1)
break;
if (obj->value[3] == 4)
sprintf (buf, "This object radiates an aura of darkness.\n\r");
else if (obj->value[3] == 27 || obj->value[3] == 2)
sprintf (buf,
"This item allows the wearer to see invisible things.\n\r");
else if (obj->value[3] == 39 || obj->value[3] == 3)
sprintf (buf, "This object grants the power of flight.\n\r");
else if (obj->value[3] == 45 || obj->value[3] == 1)
sprintf (buf, "This item allows the wearer to see in the dark.\n\r");
else if (obj->value[3] == 46 || obj->value[3] == 5)
sprintf (buf,
"This object renders the wearer invisible to the human eye.\n\r");
else if (obj->value[3] == 52 || obj->value[3] == 6)
sprintf (buf,
"This object allows the wearer to walk through solid doors.\n\r");
else if (obj->value[3] == 54 || obj->value[3] == 7)
sprintf (buf, "This holy relic protects the wearer from evil.\n\r");
else if (obj->value[3] == 57 || obj->value[3] == 8)
sprintf (buf,
"This ancient relic protects the wearer in combat.\n\r");
else if (obj->value[3] == 9)
sprintf (buf,
"This crafty item allows the wearer to walk in complete silence.\n\r");
else if (obj->value[3] == 10)
sprintf (buf,
"This powerful item surrounds its wearer with a shield of lightning.\n\r");
else if (obj->value[3] == 11)
sprintf (buf,
"This powerful item surrounds its wearer with a shield of fire.\n\r");
else if (obj->value[3] == 12)
sprintf (buf,
"This powerful item surrounds its wearer with a shield of ice.\n\r");
else if (obj->value[3] == 13)
sprintf (buf,
"This powerful item surrounds its wearer with a shield of acid.\n\r");
else if (obj->value[3] == 14)
sprintf (buf,
"This powerful item surrounds its wearer with a shield of blades.\n\r");
else if (obj->value[3] == 15)
sprintf (buf,
"This ancient item surrounds its wearer with a shield of chaos.\n\r");
else if (obj->value[3] == 16)
sprintf (buf,
"This ancient item regenerates the wounds of its wearer.\n\r");
else if (obj->value[3] == 17)
sprintf (buf,
"This ancient item allows its wearer to move at supernatural speed.\n\r");
else if (obj->value[3] == 18)
sprintf (buf,
"This powerful item allows its wearer to shear through armour without difficulty.\n\r");
else if (obj->value[3] == 19)
sprintf (buf,
"This powerful item protects its wearer from player attacks.\n\r");
else if (obj->value[3] == 20)
sprintf (buf,
"This ancient item surrounds its wearer with a shield of darkness.\n\r");
else if (obj->value[3] == 21)
sprintf (buf,
"This ancient item grants superior protection to its wearer.\n\r");
else if (obj->value[3] == 22)
sprintf (buf,
"This ancient item grants its wearer supernatural vision.\n\r");
else if (obj->value[3] == 23)
sprintf (buf, "This ancient item makes its wearer fleet-footed.\n\r");
else if (obj->value[3] == 24)
sprintf (buf,
"This ancient item conceals its wearer from sight.\n\r");
else if (obj->value[3] == 25)
sprintf (buf,
"This ancient item invokes the power of the beast.\n\r");
else
sprintf (buf, "This item is bugged...please report it.\n\r");
if (obj->value[3] > 0)
send_to_char (buf, ch);
break;
}
for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next)
{
if (paf->location != APPLY_NONE && paf->modifier != 0)
{
sprintf (buf, "%s %d.\n\r",
affect_loc_name (paf->location), paf->modifier);
send_to_char (buf, ch);
}
}
for (paf = obj->affected; paf != NULL; paf = paf->next)
{
if (paf->location != APPLY_NONE && paf->modifier != 0)
{
sprintf (buf, "%s %d.\n\r",
affect_loc_name (paf->location), paf->modifier);
send_to_char (buf, ch);
}
}
return;
}
void
spell_infravision (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if (IS_AFFECTED (victim, AFF_INFRARED))
return;
act ("$n's eyes glow fiery red.\n\r", ch, NULL, NULL, TO_ROOM);
af.type = sn;
af.duration = 2 * level;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_INFRARED;
affect_to_char (victim, &af);
send_to_char ("Your eyes glow fiery red.\n\r", victim);
if (ch != victim)
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_invis (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if (IS_AFFECTED (victim, AFF_INVISIBLE))
return;
act ("$n fades out of existence.", victim, NULL, NULL, TO_ROOM);
af.type = sn;
af.duration = 24;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_INVISIBLE;
affect_to_char (victim, &af);
send_to_char ("You fade out of existence.\n\r", victim);
/*
if ( ch != victim )
send_to_char( "Ok.\n\r", ch );
*/
return;
}
void
spell_know_alignment (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
char *msg;
int ap;
ap = victim->alignment;
if (ap > 700)
msg = "$N has an aura as white as the driven snow.";
else if (ap > 350)
msg = "$N is of excellent moral character.";
else if (ap > 100)
msg = "$N is often kind and thoughtful.";
else if (ap > -100)
msg = "$N doesn't have a firm moral commitment.";
else if (ap > -350)
msg = "$N lies to $S friends.";
else if (ap > -700)
msg = "$N's slash DISEMBOWELS you!";
else
msg = "I'd rather just not say anything at all about $N.";
act (msg, ch, NULL, victim, TO_CHAR);
return;
}
void
spell_lightning_bolt_shield (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
static const int dam_each[] = {
10,
15, 15, 15, 20, 20, 25, 25, 25, 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, 80, 90, 120, 150, 200, 250, 300, 350, 400
};
int dam;
if (IS_ITEMAFF (victim, ITEMA_SHOCKSHIELD))
return;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
level = UMIN (level, sizeof (dam_each) / sizeof (dam_each[0]) - 1);
level = UMAX (0, level);
dam = number_range (dam_each[level] / 2, dam_each[level] * 2);
if (saves_spell (level, victim))
dam /= 2;
damage (ch, victim, dam, sn, DAM_SHOCK, FALSE, TRUE, TRUE);
if (victim == NULL || victim->position == POS_DEAD)
return;
return;
}
void
spell_lightning_bolt (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
static const int dam_each[] = {
10,
15, 15, 15, 20, 20, 25, 25, 25, 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, 80, 90, 120, 150, 200, 250, 300, 350, 400
};
int dam;
if (IS_ITEMAFF (victim, ITEMA_SHOCKSHIELD))
return;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
level = UMIN (level, sizeof (dam_each) / sizeof (dam_each[0]) - 1);
level = UMAX (0, level);
dam = number_range (dam_each[level] / 2, dam_each[level] * 2);
if (saves_spell (level, victim))
dam /= 2;
damage (ch, victim, dam, sn, DAM_SHOCK, FALSE, TRUE, TRUE);
if (victim == NULL || victim->position == POS_DEAD)
return;
return;
}
void
spell_locate_object (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
char buf[MSL];
char arg[MSL];
char room[MSL];
char plane[MSL];
OBJ_DATA *obj;
OBJ_DATA *in_obj;
OBJ_DATA *obj2;
int obj_count = 1;
bool count;
bool found;
if (target_name == NULL || strlen (target_name) < 3)
{
send_to_char ("What do you wish to locate?\n\r", ch);
return;
}
found = FALSE;
for (obj = object_list; obj != NULL; obj = obj->next)
{
if (!can_see_obj (ch, obj) || !is_abbr (target_name, obj->name))
continue;
if (IS_SET (obj->extra_flags, ITEM_NOLOCATE) && !IS_IMMORTAL (ch))
continue;
found = TRUE;
for (in_obj = obj; in_obj->in_obj != NULL; in_obj = in_obj->in_obj)
;
if (in_obj->carried_by != NULL)
{
count = FALSE;
if (in_obj->carried_by->in_room == NULL)
{
sprintf (plane, "%s", plane_name2 (-1));
}
else
{
sprintf (plane, "%s",
plane_name2 (in_obj->carried_by->in_room->area->
plane));
}
if (IS_IMMORTAL (ch))
{
sprintf (buf,
"#R[#y%3d#R] #7(#y%5d#7) #c[%s#c]#n %s carried by %s.\n\r",
obj_count, obj->pIndexData->vnum, align_who (plane,
11),
obj->short_descr, PERS (in_obj->carried_by, ch));
count = TRUE;
}
else
{
if (in_obj->carried_by->in_room->area->plane ==
ch->in_room->area->plane)
{
sprintf (buf,
"#R[#y%3d#R] #c[%s#c]#n %s carried by %s.\n\r",
obj_count, align_who (plane, 11), obj->short_descr,
PERS (in_obj->carried_by, ch));
count = TRUE;
}
else
{
sprintf (buf,
"#R[#y---#R] #c[%s#c]#n %s carried by %s.\n\r",
align_who (plane, 11), obj->short_descr,
PERS (in_obj->carried_by, ch));
count = FALSE;
}
}
if (count)
obj_count++;
}
else if ((obj2 = obj->in_obj) != NULL)
{
count = FALSE;
if (in_obj->in_room == NULL)
{
sprintf (room, "somewhere");
sprintf (plane, "%s", plane_name2 (-1));
}
else
{
sprintf (room, "%s", in_obj->in_room->name);
sprintf (plane, "%s",
plane_name2 (in_obj->in_room->area->plane));
}
if (IS_IMMORTAL (ch))
{
sprintf (buf,
"#R[#y%3d#R] #7(#y%5d#7) #c[%s#c]#n %s inside %s in %s.\n\r",
obj_count, obj->pIndexData->vnum, align_who (plane,
11),
obj->short_descr, obj2->short_descr, room);
count = TRUE;
}
else
{
if (in_obj->in_room != NULL
&& in_obj->in_room->area->plane == ch->in_room->area->plane)
{
sprintf (buf,
"#R[#y%3d#R] #c[%s#c]#n %s inside %s in %s.\n\r",
obj_count, align_who (plane, 11), obj->short_descr,
obj2->short_descr, room);
count = TRUE;
}
else
{
sprintf (buf,
"#R[#y---#R] #c[%s#c]#n %s inside %s in %s.\n\r",
align_who (plane, 11), obj->short_descr,
obj2->short_descr, room);
count = FALSE;
}
}
if (count)
obj_count++;
}
else
{
count = FALSE;
if (in_obj->in_room == NULL)
{
sprintf (room, "somewhere");
sprintf (plane, "%s", plane_name2 (-1));
}
else
{
sprintf (room, "%s", in_obj->in_room->name);
sprintf (plane, "%s",
plane_name2 (in_obj->in_room->area->plane));
}
if (IS_IMMORTAL (ch))
{
sprintf (buf,
"#R[#y%3d#R] #7(#y%5d#7) #c[%s#c]#n %s in %s.\n\r",
obj_count, obj->pIndexData->vnum, align_who (plane,
11),
obj->short_descr, room);
count = TRUE;
}
else
{
if (in_obj->in_room != NULL
&& in_obj->in_room->area->plane == ch->in_room->area->plane)
{
sprintf (buf, "#R[#y%3d#R] #c[%s#c]#n %s in %s.\n\r",
obj_count, align_who (plane, 11), obj->short_descr,
room);
count = TRUE;
}
else
{
sprintf (buf, "#R[#y---#R] #c[%s#c]#n %s in %s.\n\r",
align_who (plane, 11), obj->short_descr, room);
count = FALSE;
}
}
if (count)
obj_count++;
}
buf[0] = UPPER (buf[0]);
send_to_char (buf, ch);
}
if (!found)
send_to_char ("Nothing like that in hell, earth, or heaven.\n\r", ch);
return;
}
void
spell_magic_missile (int sn, sh_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, 20, 25, 30, 35, 40, 45, 55, 65, 75
};
int dam;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
{
send_to_char ("Nothing happens.\n\r", ch);
return;
}
level = UMIN (level, sizeof (dam_each) / sizeof (dam_each[0]) - 1);
level = UMAX (0, level);
dam = number_range (dam_each[level] / 2, dam_each[level] * 2);
if (saves_spell (level, victim))
dam /= 2;
damage (ch, victim, dam, sn, DAM_MAGIC, FALSE, TRUE, TRUE);
return;
}
void
spell_mass_invis (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
AFFECT_DATA af;
CHAR_DATA *gch;
for (gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room)
{
if (!is_same_group (gch, ch) || IS_AFFECTED (gch, AFF_INVISIBLE))
continue;
act ("$n slowly fades out of existence.", gch, NULL, NULL, TO_ROOM);
send_to_char ("You slowly fade out of existence.\n\r", gch);
af.type = sn;
af.duration = 24;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_INVISIBLE;
affect_to_char (gch, &af);
}
send_to_char ("Ok.\n\r", ch);
return;
}
void
spell_null (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
send_to_char ("That's not a spell!\n\r", ch);
return;
}
void
spell_pass_door (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if (IS_AFFECTED (victim, AFF_PASS_DOOR))
return;
af.type = sn;
af.duration = number_fuzzy (level / 4);
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_PASS_DOOR;
affect_to_char (victim, &af);
act ("$n turns translucent.", victim, NULL, NULL, TO_ROOM);
send_to_char ("You turn translucent.\n\r", victim);
return;
}
void
spell_poison (int sn, sh_int level, CHAR_DATA * ch, void *vo)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
char buf[MIL];
/* Ghosts cannot be poisoned - KaVir */
if (IS_NPC (victim) && IS_AFFECTED (victim, AFF_ETHEREAL))
return;
if (!IS_NPC (victim) && IS_VAMPIRE (victim))
return;
else if (!IS_NPC (victim) && IS_WEREWOLF (victim) &&
victim->pcdata->disc[TOTEM_SPIDER] > 2)
return;
else if (!IS_NPC (victim) && IS_NINJA (victim)
&& victim->pcdata->npowers[NPOWER_NINGENNO] > 4)
return;
if (!IS_NPC (victim) && victim->pcdata->atm >= number_percent ())
return;
if (saves_spell (level, victim))
return;
af.type = sn;
af.duration = level;
af.location = APPLY_STR;
af.modifier = 0 - number_range (1, 3);
af.bitvector = AFF_POISON;
affect_join (victim, &af);
send_to_char ("You feel very sick.\n\r", victim);
if (ch == victim)
return;
if (!IS_NPC (victim))
sprintf (buf, "%s looks very sick as your poison takes affect.\n\r",
victim->name);
else
sprintf (buf, "%s looks very sick as your poison takes affect.\n\r",
victim->short_descr);
send_to_char (buf, ch);
return;
}
void
spell_protecShowing the first 100 KB of 221.6 KB. Download the archive for the full file.