magic.c
muddy/src/magic.c · 217.6 KB
From the archive astrum.tar.bz2
Download the archive « Back to the archive contents
/* $Id: magic.c,v 1.666 2004/09/20 10:49:49 shrike Exp $ */
/************************************************************************************
* Copyright 2004 Astrum Metaphora consortium *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
* *
************************************************************************************/
/************************************************************************************
* ANATOLIA 2.1 is copyright 1996-1997 Serdar BULUT, Ibrahim CANPUNAR *
* ANATOLIA has been brought to you by ANATOLIA consortium *
* Serdar BULUT {Chronos} bulut@rorqual.cc.metu.edu.tr *
* Ibrahim Canpunar {Asena} canpunar@rorqual.cc.metu.edu.tr *
* Murat BICER {KIO} mbicer@rorqual.cc.metu.edu.tr *
* D.Baris ACAR {Powerman} dbacar@rorqual.cc.metu.edu.tr *
* By using this code, you have agreed to follow the terms of the *
* ANATOLIA license, in the file Anatolia/anatolia.licence *
***********************************************************************************/
/************************************************************************************
* 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. *
************************************************************************************/
/************************************************************************************
* ROM 2.4 is copyright 1993-1995 Russ Taylor *
* ROM has been brought to you by the ROM consortium *
* Russ Taylor (rtaylor@pacinfo.com) *
* Gabrielle Taylor (gtaylor@pacinfo.com) *
* Brian Moore (rom@rom.efn.org) *
* By using this code, you have agreed to follow the terms of the *
* ROM license, in the file Rom24/doc/rom.license *
*************************************************************************************/
/************************************************************************************
* Copyright (c) 1998 fjoe <fjoe@iclub.nsu.ru> *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND *
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE *
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE *
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE *
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL *
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS *
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) *
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT *
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY *
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF *
* SUCH DAMAGE. *
************************************************************************************/
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"
#include "fight.h"
#include "quest.h"
#include "gquest.h"
#include "rating.h"
#include "fight.h"
#include "cyborg.h"
#include "skills.h"
#include "update.h"
#include "conquer.h"
#include "psionics.h"
#include "war.h"
#include "wanderers.h"
#include "shamans.h"
extern bool check_grounding (CHAR_DATA *ch);
extern bool check_galka (CHAR_DATA *ch);
extern bool check_dodge (CHAR_DATA *ch, CHAR_DATA *victim);
extern bool war_can_charm (CHAR_DATA * ch, CHAR_DATA * victim);
extern bool does_not_affect_spell_level (CHAR_DATA * mob);
extern bool check_altar_negation (CHAR_DATA * ch);
extern bool check_altar_immobility (CHAR_DATA * ch, ROOM_INDEX_DATA * where);
DECLARE_DO_FUN(do_yell );
DECLARE_DO_FUN(do_look );
DECLARE_DO_FUN(do_stand );
DECLARE_DO_FUN(do_track );
void agent_net_printf(CHAR_DATA *ch, CHAR_DATA *victim, int);
bool dispel_parser(CHAR_DATA *victim, AFFECT_DATA *paf);
bool dispel (int level, CHAR_DATA *ch);
bool dispel1 (int level, CHAR_DATA *ch, int sn);
bool dispel2 (int level, CHAR_DATA *ch, flag64_t aff);
/*
* for casting different rooms
* returned value is the range
*/
int allowed_other(CHAR_DATA *ch, int sn)
{
if (IS_SET(SKILL(sn)->flags, SKILL_RANGE))
return ch->level / 20 + 1;
return 0;
}
/*
* The kludgy globasl are for spells who want more stuff from command line.
*/
const char *target_name;
const char *extra_arguments;
/*
* * check_trust - check if victim allow ch to cast SPELL_QUESTIONABLE spell
* */
bool check_trust(CHAR_DATA *ch, CHAR_DATA *victim)
{
if (ch == victim)
return TRUE;
if (IS_NPC(victim))
{
if (is_same_group(ch, victim))
return TRUE;
if (victim->clan && (victim->clan == ch->clan
|| CLAN(victim->clan)->diplomacy[ch->clan] == DIP_ALLY))
return TRUE;
if (IS_GOOD(ch) && IS_GOOD(victim))
return TRUE;
return FALSE;
}
if (IS_SET(victim->pcdata->trust, TRUST_ALL))
return TRUE;
if (IS_SET(victim->pcdata->trust, TRUST_ALIGN)
&& ch->alignment == victim->alignment)
return TRUE;
return (IS_SET(victim->pcdata->trust, TRUST_GROUP)
&& is_same_group(ch, victim))
|| (ch->clan && IS_SET(victim->pcdata->trust, TRUST_CLAN)
&& (ch->clan == victim->clan
|| (CLAN(ch->clan)->diplomacy[victim->clan] == DIP_ALLY
&& CLAN(victim->clan)->diplomacy[ch->clan] == DIP_ALLY)));
}
bool can_cast(CHAR_DATA *ch, CHAR_DATA *victim)
{
if (ch == NULL || victim == NULL)
return FALSE;
if (ch->in_war && victim->in_war && (ch->in_war == victim->in_war)
&& (ch->war_status == PS_ALIVE))
return TRUE;
if (IS_SET(ch->comm, PLR_PEACE))
{
if ((!IS_NPC(victim) && !IS_SET(victim->comm, PLR_PEACE))
|| (IS_NPC(victim) && victim->master && !IS_NPC(victim->master)
&& !IS_SET(victim->master->comm, PLR_PEACE)))
{
act("Your energy does not reach $N.", ch, NULL, victim, TO_CHAR);
return FALSE;
}
}
return TRUE;
}
void make_spellbane(CHAR_DATA *ch, CHAR_DATA *victim, int mult)
{
if (ch == victim)
{
char_act("Your spellbane has deflected the spell!", ch);
act("$N's spellbane has deflected the spell!", ch, NULL, ch, TO_ROOM);
damage(ch, ch, mult * ch->level, gsn_spellbane, DAM_NEGATIVE, TRUE);
} else
{
act_puts("$N deflects your spell!", ch, NULL, victim, TO_CHAR, POS_DEAD);
act("You deflect $n's spell!", ch, NULL, victim, TO_VICT);
act("$N deflects $n's spell!", ch, NULL, victim, TO_NOTVICT);
if (!is_safe(ch, victim))
{
damage(victim, ch, mult * victim->level, gsn_spellbane,
DAM_NEGATIVE, TRUE);
check_improve(victim, gsn_spellbane, TRUE, 1);
}
}
return;
}
/*
* spellbane checker for do_cast, do_cast_obj
*/
bool check_spellbane_org(CHAR_DATA *ch, CHAR_DATA *victim, int sn, int bane_chance, int mult)
{
if (!IS_MAGIC(sn))
return FALSE;
if (!IS_AFFECTED(victim, AFF_SPELLBANE)
|| (number_percent() >= bane_chance))
return FALSE;
make_spellbane(ch, victim, mult);
return TRUE;
}
/*
* spellbane checker for other places missed in do_cast, do_cast_obj
*/
bool check_spellbane(CHAR_DATA *ch, CHAR_DATA *victim, int sn)
{
skill_t *sk;
if (IS_IMMORTAL(ch))
return FALSE;
if (!IS_AFFECTED(victim, AFF_SPELLBANE)
|| (number_percent() >= get_skill(victim, gsn_spellbane) * 2 / 3))
return FALSE;
sk = SKILL(sn);
if (sk->type != TYPE_SPELL
&& sk->type != TYPE_MIRACLE
&& sk->type != TYPE_PROGRAM)
return FALSE;
if (!IS_SET(sk->flags, SKILL_AREA_ATTACK))
return FALSE;
if (IS_SET(sk->group, GROUP_HEALING | GROUP_PROTECTIVE |
GROUP_ENHANCEMENT | GROUP_CURATIVE))
return FALSE;
make_spellbane(ch, victim, 3);
return TRUE;
}
bool check_absorb(CHAR_DATA *ch, CHAR_DATA *victim, int sn, bool distant)
{
skill_t *sk;
if ((ch == victim)
|| !IS_AFFECTED(victim, AFF_ABSORB)
|| (number_percent() >= get_skill(victim, gsn_absorb) * 2/3))
return FALSE;
sk = SKILL(sn);
if (sk->type != TYPE_SPELL)
return FALSE;
if (distant && !IS_SET(sk->flags, SKILL_AREA_ATTACK))
return FALSE;
act("Your $t fails to pass $N's energy field!",
ch, flag_string(skill_types, sk->type), victim, TO_CHAR | ACT_TRANS);
act("You absorb $n's $t!",
ch, flag_string(skill_types, sk->type), victim, TO_VICT | ACT_TRANS);
act("$N absorbs $n's $t!",
ch, flag_string(skill_types, sk->type), victim, TO_NOTVICT | ACT_TRANS);
check_improve(victim, gsn_absorb, TRUE, 1);
if (distant || IS_NPC(ch))
victim->mana += sk->min_mana;
return TRUE;
}
bool check_components(CHAR_DATA *ch, int sn, int chance)
{
skill_t *spell;
spell = SKILL(sn);
if (IS_SET(ch->comm, COMM_NOCAST)
&& !IS_SKILL(sn) && !IS_ABILITY(sn) && !IS_LANGUAGE(sn))
{
char_printf(ch, "The gods have deprived you of the ability to cast spells.\n");
return FALSE;
}
if (ch->position < spell->min_pos)
{
char_act("You cannot concentrate.", ch);
return FALSE;
}
if (ch->in_room
&& (IS_SET(ch->in_room->room_flags, ROOM_BATTLE_ARENA)
|| (ch->in_war && ch->war_status == PS_ALIVE))
&& IS_SET(spell->flags, SKILL_NOARENA))
{
char_act("You can't use it at the battle arena.", ch);
return FALSE;
}
if (is_affected(ch, gsn_shielding) && IS_SPELL(sn))
{
char_act("You're trying to reach for the Absolute Lore but something blocks you.", ch);
return FALSE;
}
if (is_affected(ch, gsn_garble) && IS_SET(spell->flags, SKILL_VERBAL))
{
char_act("Your lips counter to your will say rubbish.", ch);
return FALSE;
}
if (is_affected(ch, gsn_deafen) && IS_SET(spell->flags, SKILL_VERBAL))
{
char_act("It seems your incantations are not precise.", ch);
if (!IS_NPC(ch))
{
ch->mana -= mana_cost(ch, sn) / 2;
ch->mana = UMAX(ch->mana, 0);
}
WAIT_STATE(ch, spell->beats / 2);
return FALSE;
}
if (IS_AFFECTED(ch, AFF_WEB) && IS_SET(spell->flags, SKILL_GEST))
{
if (number_percent() >= 30)
{
char_act("You are moving too clumsily in the web.", ch);
if (!IS_NPC(ch))
{
ch->mana -= mana_cost(ch, sn) / 2;
ch->mana = UMAX(ch->mana, 0);
}
WAIT_STATE(ch, spell->beats / 2);
return FALSE;
}
}
if (IS_AFFECTED(ch, AFF_FEAR) && IS_SET(spell->flags, SKILL_MENTAL))
{
char_act("You are too scared for this.", ch);
return FALSE;
}
if (HAS_SKILL(ch, gsn_vampire)
&& !IS_SET(ch->form, FORM_VAMPIRE)
&& !IS_SET(spell->flags, SKILL_CLAN)
&& (IS_MAGIC(sn) || IS_SET(spell->flags, SKILL_VAMPIRE))
&& (sn != gsn_vampire))
{
act("You can use this $t only in vampiric form!",
ch, flag_string(skill_types, spell->type), NULL, TO_CHAR | ACT_TRANS);
return FALSE;
}
if (HAS_SKILL(ch, gsn_spellbane) && IS_MAGIC(sn))
{
char_act("You the Furious Warrior, instead of the magician shameful!", ch);
return FALSE;
}
if ((ch->level < LEVEL_IMMORTAL)
&& IS_SET(ch->in_room->room_flags, ROOM_NOMAGIC)
&& !IS_NONMAGIC(sn)
&& !HAS_SKILL(ch, gsn_spellbane))
{
act("Seems, your $ts are powerless here.",
ch, flag_string(skill_types, spell->type), NULL, TO_CHAR | ACT_TRANS);
act("Seems, $n's $ts are powerless here.",
ch, flag_string(skill_types, spell->type), NULL, TO_ROOM | ACT_TRANS);
return FALSE;
}
if (!IS_NPC(ch))
{
if ((ch->level < LEVEL_IMMORTAL) && IS_CLAN_SKILL(spell))
{
chance = get_clan_max_percent(ch, sn, chance);
// here we call check_altar_negation second time
// bad thing, but.. let it be
if (chance == 0)
{
if (check_altar_negation (ch))
char_act ("An altar of {mnegation{x blocks your clan power!", ch);
else
char_act("All over again return a clan item.", ch);
return FALSE;
}
}
}
if (chance == 0) {
switch(spell->type)
{
case TYPE_SPELL:
char_act("You do not know such spell.", ch);
break;
case TYPE_MIRACLE:
char_act("You cannot ask Gods about such miracle.", ch);
break;
case TYPE_POWER:
char_act("You cannot concentrate on such ability.", ch);
break;
case TYPE_ABILITY:
char_act("You do not possess such ability.", ch);
break;
case TYPE_SONG:
char_act("You cannot sing it.", ch);
break;
case TYPE_PROGRAM:
char_act("At you it is not established such program.", ch);
break;
case TYPE_LANGUAGE:
char_act("You do not know such language.", ch);
break;
default:
char_act("You are not familiar with the given ability.", ch);
}
return FALSE;
}
if (spell->spell_fun == NULL
&& !IS_SKILL(sn) && !IS_ABILITY(sn) && !IS_LANGUAGE(sn))
{
act("This $t can't be used in that way. Look at {Chelp $T{x.",
ch, flag_string(skill_types, spell->type),
spell->name, TO_CHAR | ACT_TRANS);
return FALSE;
}
return TRUE;
}
bool target_ioga(CHAR_DATA *ch, int sn, int * ptarget, void **pvo, int *poff, int *pdoor)
{
CHAR_DATA *victim;
OBJ_DATA *obj;
void* vo;
char targetname[MAX_STRING_LENGTH];
char tmp[MAX_STRING_LENGTH];
char *p;
int target, range;
skill_t *spell;
/*
* Locate targets.
*/
victim = NULL;
obj = NULL;
vo = NULL;
target = TARGET_NONE;
one_argument(target_name, tmp, sizeof(tmp));
if (!str_cmp(tmp, "at"))
target_name = one_argument(target_name, tmp, sizeof(tmp));
strnzcpy(targetname, sizeof(targetname), target_name);
if ((p = strchr(targetname, ':')) != NULL)
{
*p = '\0';
extra_arguments = p+1;
} else
extra_arguments = str_empty;
spell = SKILL(sn);
switch (spell->target)
{
default:
bug("Do_cast: bad target for sn %d.", sn);
return FALSE;
case TAR_IGNORE:
break;
case TAR_CHAR_OFFENSIVE:
if (targetname[0] == '\0')
{
if ((victim = ch->fighting) == NULL || victim->in_room != ch->in_room)
{
act("Use $t at whom?",
ch, flag_string(skill_types, spell->type), NULL, TO_CHAR);
return FALSE;
}
} else
{
if ((range = allowed_other(ch, sn)) > 0)
{
if (!(victim = get_char_spell(ch, targetname, pdoor, range)))
return FALSE;
if (IS_NPC(victim)
&& victim->in_room != ch->in_room)
{
if (room_is_private(ch->in_room))
{
act("You can't use this $t in private realms.",
ch, flag_string(skill_types, spell->type), NULL, TO_CHAR);
return FALSE;
}
if (IS_SET(victim->pIndexData->act, ACT_NOTRACK)
&& !IS_AFFECTED(victim, AFF_CHARM))
{
act_puts("You can't use this $t at $N so far away.",
ch, flag_string(skill_types, spell->type), victim, TO_CHAR, POS_DEAD);
return FALSE;
}
}
} else if (!(victim = get_char_room(ch, targetname)))
{
char_act("They aren't here.", ch);
return FALSE;
}
}
vo = (void *) victim;
target = TARGET_CHAR;
break;
case TAR_CHAR_DEFENSIVE:
if (targetname[0] == '\0')
victim = ch;
else if ((victim = get_char_room(ch, targetname)) == NULL)
{
char_act("They aren't here.", ch);
return FALSE;
}
vo = (void *) victim;
target = TARGET_CHAR;
break;
case TAR_CHAR_SELF:
if (targetname[0] == '\0')
victim = ch;
else
{
if ((victim = get_char_room(ch, targetname)) == NULL
|| (!IS_NPC(ch) && victim != ch))
{
act("You can't use this $t on others.",
ch, flag_string(skill_types, spell->type), NULL, TO_CHAR);
char_act("They aren't here.", ch);
return FALSE;
}
}
vo = (void *) victim;
target = TARGET_CHAR;
break;
case TAR_OBJ_INV:
if (targetname[0] == '\0')
{
act("What is the target?",
ch, NULL, NULL, TO_CHAR);
return FALSE;
}
if ((obj = get_obj_carry(ch, targetname)) == NULL)
{
act("At you it is not present.",
ch, NULL, NULL, TO_CHAR);
return FALSE;
}
vo = (void *) obj;
target = TARGET_OBJ;
break;
case TAR_OBJ_CHAR_OFF:
if (targetname[0] == '\0') {
if ((victim = ch->fighting) == NULL)
{
act("What or whom is the target?",
ch, NULL, NULL, TO_CHAR);
return FALSE;
}
target = TARGET_CHAR;
} else if ((victim = get_char_room(ch, targetname)))
target = TARGET_CHAR;
if (target == TARGET_CHAR)
{
if (IS_AFFECTED(ch, AFF_CHARM)
&& ch->master == victim)
{
act("You cannot make it on the Master.", ch, NULL, NULL, TO_CHAR);
return FALSE;
}
vo = (void *) victim;
} else if ((obj = get_obj_here(ch, targetname)))
{
vo = (void *) obj;
target = TARGET_OBJ;
} else
{
act("You do not see it here.", ch, NULL, NULL, TO_CHAR);
return FALSE;
}
break;
case TAR_OBJ_CHAR_DEF:
if (targetname[0] == '\0')
{
vo = (void *) ch;
target = TARGET_CHAR;
} else if ((victim = get_char_room(ch, targetname)))
{
vo = (void *) victim;
target = TARGET_CHAR;
} else if ((obj = get_obj_carry(ch, targetname)))
{
vo = (void *) obj;
target = TARGET_OBJ;
} else
{
act("You do not see it here.",
ch, NULL, NULL, TO_CHAR);
return FALSE;
}
break;
}
say_spell(ch, sn);
if (!victim)
victim = ch;
switch (target)
{
case TARGET_CHAR:
vo = (void *) victim;
switch (spell->target)
{
case TAR_CHAR_DEFENSIVE:
case TAR_OBJ_CHAR_DEF:
if (IS_SET(spell->flags, SKILL_QUESTIONABLE)
&& !check_trust(ch, victim))
{
act("$N do not trust you enough for this $t.",
ch, flag_string(skill_types, spell->type),
victim, TO_CHAR);
return FALSE;
}
break;
case TAR_CHAR_OFFENSIVE:
case TAR_OBJ_CHAR_OFF:
*poff = TRUE;
if (IS_SET(spell->flags, SKILL_QUESTIONABLE))
*poff = !check_trust(ch, victim);
if (*poff)
{
if (is_safe(ch, victim))
return FALSE;
if (!IS_NPC(ch)
&& !IS_NPC(victim)
&& victim != ch
&& ch->fighting != victim
&& victim->fighting != ch
&& !IS_AFFECTED(victim, AFF_CHARM))
{
act_yell(victim, "Die $i, you nasty dog!", ch, NULL);
agent_net_printf(victim, ch, ANET_ATTACK);
}
break;
}
}
break;
case TARGET_OBJ:
vo = (void*) obj;
break;
}
*ptarget = target;
*pvo = vo;
return TRUE;
}
// Procedure for detecting skill/spell levels.
// Not used for psionic powers and most (auto)skills, actually.
int spell_level(CHAR_DATA *ch, int sn, bool offensive)
{
OBJ_DATA *staff;
skill_t *spell;
CHAR_DATA *gch;
AFFECT_DATA *paf;
int slevel, clevel, chance;
if ((spell = SKILL(sn)) == NULL)
return 0;
if (IS_NPC(ch))
return ch->level + 1 + ch->level/40;
if (!IS_MAGIC(sn))
slevel = LVL(ch);
else if (is_class_mage(ch))
slevel = LVL(ch) - UMAX(0,(ch->level / 20));
else
slevel = LVL(ch) - UMAX(5,(ch->level / 10));
if (IS_CLAN_SKILL(spell)) slevel = LVL(ch);
if (IS_SPELL(sn) && (chance = get_skill(ch, gsn_spell_craft)))
{
if (number_percent() < chance)
{
slevel = UMAX(slevel, LVL(ch));
check_improve(ch, gsn_spell_craft, TRUE, 1);
}
else
check_improve(ch, gsn_spell_craft, FALSE, 1);
}
if (IS_MIRACLE(sn) && (chance = get_skill(ch, gsn_faith)))
{
if (number_percent() < chance)
{
slevel = UMAX(slevel, LVL(ch));
check_improve(ch, gsn_faith, TRUE, 1);
}
else
check_improve(ch, gsn_faith, FALSE, 1);
}
if (IS_PROGRAM(sn) && (chance = get_skill(ch, gsn_computers)))
{
if (number_percent() < chance)
{
slevel = UMAX(slevel, LVL(ch));
check_improve(ch, gsn_computers, TRUE, 1);
}
else
check_improve(ch, gsn_computers, FALSE, 1);
}
if (IS_SONG(sn) && (chance = get_skill(ch, gsn_singing)))
{
if (number_percent() < chance)
{
slevel = UMAX(slevel, LVL(ch));
check_improve(ch, gsn_singing, TRUE, 1);
}
else
check_improve(ch, gsn_singing, FALSE, 1);
}
// Ok, now different improvements
if (IS_SET(spell->group, GROUP_MALADICTIONS)
&& (chance = get_skill(ch, gsn_improved_maladiction)))
{
if (number_percent() < chance)
{
slevel = UMAX(slevel, LVL(ch));
slevel += chance/50;
check_improve(ch, gsn_improved_maladiction, TRUE, 1);
}
else
check_improve(ch, gsn_improved_maladiction, FALSE, 1);
}
if ((chance = get_skill(ch, gsn_improved_necromancy))
&& IS_SET(spell->group, GROUP_NECROMANCY))
{
if (number_percent() < chance)
{
slevel = UMAX(slevel, LVL(ch));
slevel += chance/50;
check_improve(ch, gsn_improved_necromancy, TRUE, 1);
}
else
check_improve(ch, gsn_improved_necromancy, FALSE, 1);
}
if ((chance = get_skill(ch, gsn_improved_beguiling))
&& IS_SET(spell->group, GROUP_BEGUILING))
{
if (number_percent() < chance)
{
slevel = UMAX(slevel, LVL(ch));
slevel += chance/50;
check_improve(ch, gsn_improved_beguiling, TRUE, 1);
}
else
check_improve(ch, gsn_improved_beguiling, FALSE, 1);
}
if ((chance = get_skill(ch, gsn_improved_combat))
&& IS_SET(spell->group, GROUP_COMBAT))
{
if (number_percent() < chance)
{
slevel = UMAX(slevel, LVL(ch));
slevel += chance/20;
check_improve(ch, gsn_improved_combat, TRUE, 1);
}
else
check_improve(ch, gsn_improved_combat, FALSE, 1);
}
if ((chance = get_skill(ch, gsn_improved_attack))
&& IS_SET(spell->group, GROUP_ATTACK))
{
if (number_percent() < chance)
{
slevel = UMAX(slevel, LVL(ch));
slevel += chance/10;
check_improve(ch, gsn_improved_attack, TRUE, 1);
}
else
check_improve(ch, gsn_improved_attack, FALSE, 1);
}
if ((chance = get_skill(ch, gsn_improved_benediction))
&& IS_SET(spell->group, GROUP_BENEDICTIONS))
{
if (number_percent() < chance)
{
slevel = UMAX(slevel, LVL(ch));
slevel += chance/10;
check_improve(ch, gsn_improved_benediction, TRUE, 1);
}
else
check_improve(ch, gsn_improved_benediction, FALSE, 1);
}
if ((chance = get_skill(ch, gsn_improved_protective))
&& IS_SET(spell->group, GROUP_PROTECTIVE))
{
if (number_percent() < chance)
{
slevel = UMAX(slevel, LVL(ch));
slevel += chance/10;
check_improve(ch, gsn_improved_protective, TRUE, 1);
}
else
check_improve(ch, gsn_improved_protective, FALSE, 1);
}
if ((chance = get_skill(ch, gsn_improved_summoning))
&& IS_SET(spell->group, GROUP_SUMMONING))
{
if (number_percent() < chance)
{
slevel = UMAX(slevel, LVL(ch));
slevel += chance / 10;
check_improve(ch, gsn_improved_summoning, TRUE, 1);
}
else
check_improve(ch, gsn_improved_summoning, FALSE, 1);
}
if ((chance = get_skill(ch, gsn_improved_curative))
&& IS_SET(spell->group, GROUP_HEALING))
{
if (number_percent() < chance)
{
slevel = UMAX(slevel, LVL(ch));
slevel += chance / 10;
slevel += LVL(ch);
check_improve(ch, gsn_improved_curative, TRUE, 1);
}
else
check_improve(ch, gsn_improved_curative, FALSE, 1);
}
if (IS_SPELL(sn) && (number_percent() < get_skill(ch, gsn_mastering_spell))
&& IS_SET(spell->group, GROUP_HEALING | GROUP_PROTECTIVE
| GROUP_ENHANCEMENT | GROUP_CURATIVE))
{
slevel += number_range(3, 4);
check_improve(ch, gsn_mastering_spell, TRUE, 1);
}
if (is_class_mage(ch))
{
if (IS_MIRACLE(sn))
{
slevel += UMAX(0, get_curr_stat(ch, STAT_WIS) - 21);
slevel += UMAX(0, get_curr_stat(ch, STAT_INT) - 21)/2;
}
else if (IS_SPELL(sn))
{
slevel += UMAX(0, get_curr_stat(ch, STAT_INT) - 21);
slevel += UMAX(0, get_curr_stat(ch, STAT_WIS) - 21)/2;
}
else if (IS_PROGRAM(sn))
{
slevel += (UMAX(0, get_curr_stat(ch, STAT_INT)-21) +
UMAX(0, get_curr_stat(ch, STAT_WIS)-21)) * 3/4;
}
}
if (IS_SONG(sn))
slevel += UMAX(0, get_curr_stat(ch, STAT_CHA)) * 3/2;
if (IS_POWER(sn))
slevel += (UMAX(0, get_curr_stat(ch, STAT_INT)-21) +
UMAX(0,get_curr_stat(ch, STAT_WIS)-21) +
UMAX(0,get_curr_stat(ch, STAT_CON)-21)) / 2;
// ËÏÇÄÁ-ÎÉÂÕÄØ ÒÁÓËÏÍÅÎÔÁÒÉÍ, ËÏÇÄÁ classes/ ÐÏÐÒÁ×ÉÍ
if (!IS_CLAN_SKILL(spell) && IS_MAGIC(sn)
&& (((ch->class == CLASS_CLERIC) /*&& IS_MIRACLE(sn)*/)
|| ((ch->class == CLASS_PRIEST) /*&& IS_MIRACLE(sn)*/)
|| ((ch->class == CLASS_OCCULTIST) /*&& IS_MIRACLE(sn)*/)
|| ((ch->class == CLASS_ENGINEER) /*&& IS_PROGRAM(sn)*/)) )
{
if (offensive)
slevel = number_range(slevel, slevel + slevel/10);
else
slevel = number_range(slevel, UMAX(100, slevel + 20));
}
if (slevel < 1)
slevel = 1;
// GM : Applying spellaffect as extra levels for spells
for (paf = ch->affected;paf; paf = paf->next)
if (paf->location == APPLY_SPELL_AFFECT)
slevel += paf->modifier;
// GM : Applying Bonus for Magic Room
if (IS_SET(ch->in_room->room_flags, ROOM_MAGIC) && IS_SPELL(sn))
slevel += 2;
// GM : Applying Bonus for Staves and Wands
if ((staff = get_eq_char(ch, WEAR_HOLD))
&& (staff->pIndexData->item_type == ITEM_STAFF
|| staff->pIndexData->item_type == ITEM_WAND))
{
if (staff->value[3] == sn)
{
if (is_class_warrior(ch)) // GM: Real Mages have a real bonus
slevel += number_range(2, 2 + staff->value[0] / 25);
else
slevel += staff->value[0] / 25 + 2;
} else
{
if (is_class_warrior(ch)) // GM: Real Mages have a real bonus
slevel += number_range(1, 1 + staff->level / 45);
else
slevel += staff->level / 45 + 1;
}
if (staff->pIndexData->vnum == OBJ_VNUM_WAND_EMPOWERED
|| staff->pIndexData->vnum == OBJ_VNUM_STAFF_EMPOWERED)
{
if (is_class_warrior(ch)) // GM: Real Mages have a real bonus
slevel += number_range(1, 1 + staff->level / 45);
else
slevel += staff->level / 45 + 1;
}
}
// GM : Better casting without charmies
clevel = 0;
for (gch = char_list; gch != NULL; gch = gch->next)
{
if (is_same_group(gch, ch)
&& IS_AFFECTED(gch, AFF_CHARM)
&& (gch->master == ch))
{
if (does_not_affect_spell_level (gch))
continue;
clevel++;
}
}
slevel -= number_range(clevel / 2,clevel * 2);
if (altar_works (ch, ALTAR_MAGIC_POS))
{
char_act ("You feel a stream of energy and your magic becomes stronger!", ch);
slevel += number_range (1,2);
}
slevel = UMAX(1, slevel);
return slevel;
}
int spellbane_chance(CHAR_DATA *ch, CHAR_DATA *victim, skill_t *spell)
{
int bane_chance = 100;
if (spell->target == TAR_CHAR_OFFENSIVE)
bane_chance = get_skill(victim, gsn_spellbane);
if (IS_SET(spell->group, GROUP_COMBAT | GROUP_ATTACK))
bane_chance -= 20;
if (spell->type == TYPE_SPELL)
bane_chance -= (get_skill(ch, gsn_mastering_spell) / 20);
if (IS_SET(spell->group, GROUP_HEALING | GROUP_PROTECTIVE |
GROUP_ENHANCEMENT | GROUP_CURATIVE))
bane_chance = 120; //ÎÁ ×ÓÑËÉÊ ÓÌÕÞÁÊ :))
return bane_chance;
}
void do_cast_org(CHAR_DATA *ch, const char *argument, int type)
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
void *vo;
int mana = 0;
int sn = -1;
int target;
int door;
bool cast_far = FALSE;
bool offensive = FALSE;
int slevel;
int chance = 0;
int spell_power = 0;
skill_t *spell;
pcskill_t *ps;
OBJ_DATA * wield;
target_name = one_argument(argument, arg2, sizeof(arg2));
if (arg2[0] == '\0')
{
char_act("To make that, how, where?", ch);
return;
}
substitute_skill_alias(arg2, arg1, sizeof(arg1));
if (IS_NPC(ch))
{
if (!str_cmp(arg1, "nowait"))
{
target_name = one_argument(target_name, arg1, sizeof(arg1));
if (ch->wait)
ch->wait = 0;
} else if (ch->wait)
{
// log_printf("%s: wait state %d", ch->name, ch->wait);
return;
}
sn = sn_lookup(arg1);
chance = get_skill(ch, sn);
} else
{
spell_power = mult_argument(arg1, arg1, sizeof(arg1));
if (spell_power < 2)
spell_power = 0;
if ((ps = skill_vlookup_type(&ch->pcdata->learned, arg1, type))
&& skill_level(ch, sn = ps->sn) <= ch->level)
chance = ps->percent;
}
if (sn < 0 || (spell = SKILL(sn)) == NULL)
{
act("No such $t, or skill of any other type.",
ch, flag_string(skill_types, type), NULL, TO_CHAR | ACT_TRANS);
return;
}
if (IS_RITUAL (sn))
{
do_perform (ch, argument);
return;
}
if (IS_TATTOO (sn))
{
do_activate (ch, argument);
return;
}
if (IS_POWER(sn) && HAS_SKILL(ch, gsn_psionics))
{
do_concentrate(ch, argument);
return;
}
if (!IS_SPELL(sn) && !IS_PROGRAM(sn))
spell_power = 0;
if (IS_SET(ch->form, FORM_BEAR | FORM_WOLF)
&& !IS_NONMAGIC(sn)
&& number_percent() > get_skill(ch, gsn_body_control))
{
WAIT_STATE(ch, spell->beats / 4); // GM : ÞÔÏÂÙ ÈÁÌÑ×ÎÏÊ ÒÁÓËÁÞËÉ ÎÅ ÂÙÌÏ.
check_improve(ch, gsn_body_control, FALSE, 20);
char_act("The animal inside does not allow you to concentrate.", ch);
return;
}
check_improve(ch, gsn_body_control, TRUE, 4);
// if(IS_NPC(ch) || type < 0)
type = spell->type;
if(spell->type != type)
{
act_puts3("'$t' is a $T, not a $U.",
ch,
spell->name,
flag_string(skill_types, spell->type),
flag_string(skill_types, type),
TO_CHAR | ACT_TRANS, POS_DEAD);
return;
}
if (!check_components(ch, sn, chance))
return;
if (!IS_NPC(ch))
{
if (number_percent() < get_skill(ch, gsn_mastering_spell))
mana = mana_cost(ch, sn) + 640 * spell_power;
else
mana = mana_cost(ch, sn) + 1000 * spell_power;
if (ch->mana < mana)
{
char_act("You have not enough mana.", ch);
return;
}
}
if (!target_ioga(ch, sn, &target, &vo, &offensive, &door))
{
WAIT_STATE(ch, MISSING_TARGET_DELAY);
return;
}
victim = NULL;
if (target == TARGET_CHAR)
{
victim = (CHAR_DATA *) vo;
cast_far = victim->in_room != ch->in_room;
if (victim->in_room
&& (IS_SET(victim->in_room->room_flags, ROOM_BATTLE_ARENA)
|| (victim->in_war && victim->war_status == PS_ALIVE ))
&& IS_SET(spell->flags, SKILL_NOARENA))
{
char_act("You can't use it versus people at the battle arena.", ch);
return;
}
}
if ((!IS_NPC(ch)) && (ch->pcdata)
&& (spell->target == TAR_CHAR_DEFENSIVE
|| spell->target == TAR_CHAR_SELF
|| spell->target == TAR_OBJ_CHAR_DEF))
{
if (IS_SET(ch->pcdata->wishes, WISH_SPELLUP2))
WAIT_STATE(ch, spell->beats / 4);
else if (IS_SET(ch->pcdata->wishes, WISH_SPELLUP1))
WAIT_STATE(ch, spell->beats / 2);
else
WAIT_STATE(ch, spell->beats);
}
else if ((!IS_NPC(ch))
&& (ch->pcdata)
&& (victim != NULL)
&& (victim->in_room == ch->in_room)
&& offensive
&& IS_SET(spell->group, GROUP_COMBAT | GROUP_ATTACK))
{
if (IS_AFFECTED(ch, AFF_HASTE))
{
WAIT_STATE(ch, spell->beats / 2);
} else if (IS_AFFECTED(ch, AFF_SLOW))
{
WAIT_STATE(ch, spell->beats * 2);
} else
WAIT_STATE(ch, spell->beats);
}
else if (HAS_SKILL(ch, gsn_improved_curative)
&& IS_SET(spell->group, GROUP_HEALING | GROUP_CURATIVE))
WAIT_STATE(ch, spell->beats / 2);
else
WAIT_STATE(ch, spell->beats);
if (target == TARGET_CHAR && victim->religion == RELIGION_KEMM
&& (IS_SPELL(sn) || IS_MIRACLE(sn))
&& (NULL != get_eq_char(victim, WEAR_TATTOO))
&& victim != ch
&& number_percent() < 10)
{
if (!check_galka(ch))
{
act_puts("$N's tattoo glows {Ggreen{z and $gN{he} reject your spell!",
ch, NULL, victim, TO_CHAR, POS_DEAD);
act("Your tattoo glows {Ggreen{z and your reject $n's spell!",
ch, NULL, victim, TO_VICT);
act("$N's tattoo glows {Ggreen{z and $gN{he} reject $n's spell!",
ch, NULL, victim, TO_NOTVICT);
return;
}
}
// GM: lightsaber chance - lightsaber defence mode.
if (target == TARGET_CHAR
&& victim != ch)
{
wield = get_eq_char (victim, WEAR_WIELD);
if (wield && wield->value[0] == WEAPON_LIGHTSABER
&& (number_range(0, 300) < get_skill(ch, sn_lookup("saberdefense"))))
{
act_puts("$N's lightsword glows and $gN(he) absorbs your spell!",
ch, NULL, victim, TO_CHAR, POS_DEAD);
act("Your lightsword glows and you absorb $n's spell!",
ch, NULL, victim, TO_VICT);
act("$N's lightsword glows and $gN(he) absorbs $n's spell!",
ch, NULL, victim, TO_NOTVICT);
victim->mana += mana;
victim->mana = UMIN(victim->mana, victim->max_mana);
check_improve(ch, sn_lookup("saberdefense"), TRUE, 1);
return;
} else
check_improve(ch, sn_lookup("saberdefense"), FALSE, 1);
}
// GM: cast control aka spell power
if (spell_power > 0)
{
int sp_chance = 100;
sp_chance -= spell_power * 20;
if (IS_SPELL(sn))
{
sp_chance += (get_skill(ch, gsn_mastering_spell) / 10);
sp_chance += (get_skill(ch, gsn_cast_control) / 2);
check_improve(ch, gsn_cast_control, TRUE, 1);
}
if (IS_POWER(sn))
{
sp_chance += (get_skill(ch, gsn_psionics) * 2 / 5);
check_improve(ch, gsn_psionics, TRUE, 1);
}
if (IS_PROGRAM(sn))
{
sp_chance += get_skill(ch, gsn_optimization) / 2;
check_improve(ch, gsn_optimization, TRUE, 1);
}
if (number_percent() > sp_chance && !IS_IMMORTAL(ch))
{
act("$t of $n out of control!",
ch,
IS_SPELL(sn) ? "Magic" : "Power",
NULL, TO_ROOM);
act("$t out of control!",
ch,
IS_SPELL(sn) ? "Your magic" : "Your power",
NULL, TO_CHAR);
ch->mana = 0;
WAIT_STATE(ch, spell->beats * 2);
return;
}
}
if (ch->daze >= 16)
chance = URANGE(0, chance, 10);
else if (ch->daze >= 8)
chance = URANGE(0, chance, 25);
else if (ch->daze >= 4)
chance = URANGE(0, chance, 50);
if (number_percent() > chance)
{
switch(type)
{
case TYPE_SPELL:
act("Your magic power betrays you.",
ch, NULL, NULL, TO_CHAR);
break;
case TYPE_POWER:
act("Your concentration is broken.",
ch, NULL, NULL, TO_CHAR);
break;
case TYPE_MIRACLE:
act("Your faith betrays you.",
ch, NULL, NULL, TO_CHAR);
break;
case TYPE_SONG:
act("You fail to perform a singing skill.",
ch, NULL, NULL, TO_CHAR);
break;
case TYPE_PROGRAM:
act("Unexpected error found... Program aborted.",
ch, NULL, NULL, TO_CHAR);
break;
default:
act("You failed to use a $t.",
ch, flag_string(skill_types, spell->type), NULL, TO_CHAR);
}
if (type != TYPE_SKILL)
check_improve(ch, sn, FALSE, 1);
ch->mana -= mana / 2;
if (cast_far)
cast_far = FALSE;
}
else
{
slevel = spell_level(ch, sn, offensive) + spell_power;
if (victim)
{
if (!can_cast(ch, victim))
return;
if (check_spellbane_org(ch, victim, sn, spellbane_chance(ch, victim, spell), 3))
return;
if (check_absorb(ch, victim, sn, FALSE))
{
ch->mana -= mana;
victim->mana += mana;
return;
}
}
ch->mana -= mana;
if (spell->spell_fun != NULL)
{
spell->spell_fun(sn, slevel, ch, vo, target);
check_improve(ch, sn, TRUE, 1);
} else if (spell->do_fun != NULL)
{
spell->do_fun(ch, target_name);
}
}
if (target != TARGET_CHAR || JUST_KILLED(ch) || JUST_KILLED(victim))
return;
if (cast_far && door != -1)
{
path_to_track(ch, victim, door);
return;
}
if (offensive && victim != ch && victim->master != ch
&& victim->fighting == NULL && IS_AWAKE(victim)
&& victim->in_room == ch->in_room)
multi_hit(victim, ch, TYPE_UNDEFINED);
}
DO_FUN(do_universal_cast)
{
do_cast_org(ch, argument, -1);
}
DO_FUN(do_cast)
{
do_cast_org(ch, argument, TYPE_SPELL);
}
DO_FUN(do_pray)
{
char arg[MAX_INPUT_LENGTH];
one_argument(argument, arg, sizeof(arg));
if(!str_cmp(arg,"for") || !str_cmp(arg,"Ï"))
argument = one_argument(argument, arg, sizeof(arg));
do_cast_org(ch, argument, TYPE_MIRACLE);
}
DO_FUN(do_sing)
{
do_cast_org(ch, argument, TYPE_SONG);
}
DO_FUN(do_execute)
{
do_cast_org(ch, argument, TYPE_PROGRAM);
}
DO_FUN(do_use)
{
do_cast_org(ch, argument, TYPE_ABILITY);
}
DO_FUN(do_do)
{
do_cast_org(ch, argument, TYPE_SKILL);
}
/*
* Cast spells at targets using a magical object.
*/
void obj_cast_spell(int sn, int level, CHAR_DATA *ch, CHAR_DATA *victim, OBJ_DATA *obj)
{
void *vo;
int target = TARGET_NONE;
skill_t *spell;
int bane_chance;
bool offensive = FALSE;
if (sn <= 0
|| (spell = skill_lookup(sn)) == NULL
|| spell->spell_fun == NULL)
return;
bane_chance = 100;
switch (spell->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)
{
char_act("You can't do this.", ch);
return;
}
if (is_safe(ch, victim))
{
char_act("Something wrong...", ch);
return;
}
vo = (void *) victim;
target = TARGET_CHAR;
bane_chance = get_skill(victim, gsn_spellbane) - 20;
break;
case TAR_CHAR_DEFENSIVE:
case TAR_CHAR_SELF:
if (victim == NULL)
victim = ch;
vo = (void *) victim;
target = TARGET_CHAR;
break;
case TAR_OBJ_INV:
if (obj == NULL)
{
char_act("You can't do this.", ch);
return;
}
vo = (void *) obj;
target = TARGET_OBJ;
break;
case TAR_OBJ_CHAR_OFF:
if (victim == NULL && obj == NULL)
{
if (ch->fighting != NULL)
victim = ch->fighting;
else {
char_act("You can't do this.", ch);
return;
}
}
if (victim)
{
if (is_safe(ch, victim))
{
char_act("Something wrong...", ch);
return;
}
vo = (void *) victim;
target = TARGET_CHAR;
}
else {
vo = (void *) obj;
target = TARGET_OBJ;
}
break;
case TAR_OBJ_CHAR_DEF:
if (victim == NULL && obj == NULL)
{
vo = (void *) ch;
target = TARGET_CHAR;
}
else if (victim != NULL)
{
vo = (void *) victim;
target = TARGET_CHAR;
}
else {
vo = (void *) obj;
target = TARGET_OBJ;
}
break;
}
if (victim == NULL)
victim = ch;
switch (target)
{
case TARGET_CHAR:
vo = (void *) victim;
switch (spell->target)
{
case TAR_CHAR_DEFENSIVE:
case TAR_OBJ_CHAR_DEF:
if (IS_SET(spell->flags, SKILL_QUESTIONABLE)
&& !check_trust(ch, victim))
{
act("$N do not trust you enough for this $t.",
ch, flag_string(skill_types, spell->type),
victim, TO_CHAR);
return;
}
break;
case TAR_CHAR_OFFENSIVE:
case TAR_OBJ_CHAR_OFF:
offensive = TRUE;
if (IS_SET(spell->flags, SKILL_QUESTIONABLE))
offensive = !check_trust(ch, victim);
if (offensive)
{
if (is_safe(ch, victim))
return;
if (!IS_NPC(ch)
&& !IS_NPC(victim)
&& victim != ch
&& ch->fighting != victim
&& victim->fighting != ch
&& !IS_AFFECTED(victim, AFF_CHARM))
{
act_yell(victim, "Die $i, you nasty dog!", ch, NULL);
agent_net_printf(victim, ch, ANET_ATTACK);
}
break;
}
}
break;
case TARGET_OBJ:
vo = (void*) obj;
break;
}
if (victim == ch)
bane_chance = 100;
if (check_spellbane_org(ch, victim, sn, bane_chance, 20))
return;
if (check_absorb(ch, victim, sn, TRUE))
return;
if (victim->religion == RELIGION_KEMM
&& victim != ch
&& number_percent() < 15)
{
act_puts("$N's tattoo glows {Ggreen{z and $gN{he} reject your spell!",
ch, NULL, victim, TO_CHAR, POS_DEAD);
act("Your tattoo glows {Ggreen{z and your reject $n's spell!",
ch, NULL, victim, TO_VICT);
act("$N's tattoo glows {Ggreen{z and $gN{he} reject $n's spell!",
ch, NULL, victim, TO_NOTVICT);
return;
}
if (target == TARGET_OBJ && ((OBJ_DATA*) vo)->extracted)
return;
if (IS_AFFECTED(victim, AFF_SPELLBANE)
&& victim == ch)
return;
target_name = str_empty;
spell->spell_fun(sn, level, ch, vo, target);
if (target != TARGET_CHAR || JUST_KILLED(victim) || JUST_KILLED(ch))
return;
if (offensive && victim != ch && victim->master != ch
&& victim->fighting == NULL && IS_AWAKE(victim))
multi_hit(victim, ch, TYPE_UNDEFINED);
}
/* --------------- Spell functions --------------- */
SPELL_FUN(spell_deadly_cloud)
{
CHAR_DATA *vch;
CHAR_DATA *vch_next;
int dam,hp_dam,dice_dam,hpch;
if (IS_AFFECTED(ch, AFF_FEAR))
{
char_act("Imposible, You can poison someone!", ch);
return;
}
act("$n summons Death Cloud from the deep of Hell!", ch, NULL, NULL, TO_ROOM);
act("You summon Death Cloud!", ch, NULL, NULL, TO_CHAR);
hpch = UMAX(16, ch->hit);
hp_dam = number_range(hpch / 15 + 1, 8);
dice_dam = dice(level, 12);
dam = UMAX(hp_dam + dice_dam/10, dice_dam + hp_dam/10);
poison_effect(ch->in_room, level, dam, TARGET_ROOM);
for (vch = ch->in_room->people; vch != NULL; vch = vch_next)
{
vch_next = vch->next_in_room;
if (is_safe_spell(ch, vch, TRUE)
|| (IS_NPC(ch) && IS_NPC(vch)
&& (ch->fighting == vch || vch->fighting == ch)))
continue;
if (saves_spell(level, vch, DAM_POISON))
{
poison_effect(vch, level/2, dam/4, TARGET_CHAR);
damage(ch, vch, dam/2, sn, DAM_POISON, TRUE);
} else
{
poison_effect(vch, level, dam, TARGET_CHAR);
damage(ch, vch, dam, sn, DAM_POISON, TRUE);
}
}
}
SPELL_FUN(spell_acid_blast)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam, chance = 200;
if (IS_AFFECTED(ch, AFF_FEAR))
{
char_act("You too scare to do this!", ch);
return;
}
chance -= (level - LVL(victim));
chance -= get_skill(ch, gsn_cast_control);
// chance -= get_skill(ch, gsn_mastering_spell) / 10;
if (number_range(1, chance) == 1
&& victim->level < (level + (level / 4))
&& !IS_CLAN_GUARD(victim)
&& !IS_IMMORTAL(victim)
&& IS_NPC(victim)
&& !IS_SET(victim->abilities, EA_IMMUN_INSTANT))
{
act("Your acid blast criticaly hits $N in a head!",
ch, NULL, victim, TO_CHAR);
act("$n's acid blast criticaly hits $N in a head!",
ch, NULL, victim, TO_NOTVICT);
act("$n's acid blast criticaly hits your in a head!",
ch, NULL, victim, TO_VICT);
// char_act("You {Rdead{x fall to the ground.", victim); GM : It is NPC...
victim->position = POS_DEAD;
handle_death(ch, victim);
return;
}
dam = number_range(level*14, level*18);
// dam = dice(level, 18);
if (saves_spell(level, victim, DAM_ACID))
dam /= 2;
damage(ch, victim, dam, sn,DAM_ACID,TRUE);
acid_effect(victim, level/2, dam/2, TARGET_CHAR);
return;
}
SPELL_FUN(spell_armor)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if (is_affected(victim, sn))
{
if (victim == ch)
char_act("You already have magical armor.", ch);
else
act("$N already has magical armor.", ch, NULL, victim, TO_CHAR);
return;
}
af.where = TO_AFFECTS;
af.type = sn;
af.level = level;
af.duration = 7 + level / 6;
af.modifier = -1 * UMAX(20, 10 + level / 4); /* af.modifier = -20;*/
af.location = APPLY_AC;
af.bitvector = 0;
affect_to_char(victim, &af);
char_act("You sense how something defence you.", victim);
if (ch != victim)
act("$N now under you magical defence.", ch, NULL, victim, TO_CHAR);
return;
}
SPELL_FUN(spell_bless)
{
CHAR_DATA *victim;
OBJ_DATA *obj;
AFFECT_DATA af;
int duration;
/* deal with the object case first */
if (target == TARGET_OBJ)
{
obj = (OBJ_DATA *) vo;
if (IS_OBJ_STAT(obj,ITEM_BLESS))
{
act("$p already has blessing.",ch,obj,NULL,TO_CHAR);
return;
}
if (IS_OBJ_STAT(obj,ITEM_EVIL))
{
AFFECT_DATA *paf;
paf = affect_find(obj->affected,gsn_curse);
if (!saves_dispel(level,paf != NULL ? paf->level : obj->level,0))
{
if (paf != NULL)
affect_remove_obj(obj,paf);
act("$p glows {CLight blue{x.",ch,obj,NULL,TO_ALL);
REMOVE_BIT(obj->extra_flags,ITEM_EVIL);
return;
} else
{
act("{rEvil{x in $p is too powerfull to overcome it.",
ch,obj,NULL,TO_CHAR);
return;
}
}
duration = (2 * level) / 3;
if (IS_NPC(ch))
duration *= 10;
af.where = TO_OBJECT;
af.type = sn;
af.level = level;
af.duration = duration;
af.location = APPLY_SAVES;
af.modifier = -1;
af.bitvector = ITEM_BLESS;
affect_to_obj(obj,&af);
act("$p is surrounded by {Wholy aura{x.",ch,obj,NULL,TO_ALL);
return;
}
/* character target */
victim = (CHAR_DATA *) vo;
if (victim->position == POS_FIGHTING || is_affected(victim, sn))
{
if (victim == ch)
char_act("You already are blessed.", ch);
else
act("$N already has divine blessing.", ch, NULL, victim, TO_CHAR);
return;
}
if (IS_CYBORG(victim))
{
char_act("You cannot bless a cyborg!", ch);
return;
}
af.where = TO_AFFECTS;
af.type = sn;
af.level = level;
af.duration = (6 + level / 2);
af.location = APPLY_HITROLL;
af.modifier = level / 8;
af.bitvector = 0;
affect_to_char(victim, &af);
af.location = APPLY_SAVING_SPELL;
af.modifier = -10;
affect_to_char(victim, &af);
char_act("You feel as you blessing is granted!", victim);
if (ch != victim)
act("You grant $N the blessing.", ch, NULL, victim, TO_CHAR);
return;
}
SPELL_FUN(spell_blindness)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if (IS_AFFECTED(ch, AFF_FEAR))
{
char_act("You too scare to do this!", ch);
return;
}
if (IS_AFFECTED(victim, AFF_BLIND))
{
if (ch == victim)
char_act("That do you achieve? You in fact are already blind!", ch);
else
act("$N it is already blind!", ch, NULL, victim, TO_CHAR);
return;
}
if (saves_spell(level, victim, DAM_MAGIC) || IS_UNDEAD(victim))
{
char_act("It is impossible to you.", ch);
return;
}
af.where = TO_AFFECTS;
af.type = sn;
af.level = level;
af.location = APPLY_HITROLL;
af.modifier = 0 - number_fuzzy(level/3);
af.duration = UMAX(3, level/18);
af.bitvector = AFF_BLIND;
affect_to_char(victim, &af);
char_act("You have blinded!", victim);
act("$n has blinded!", victim, NULL, NULL, TO_ROOM);
return;
}
SPELL_FUN(spell_burning_hands)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
if (IS_AFFECTED(ch, AFF_FEAR))
{
char_act("You too scare to do this!", ch);
return;
}
dam = number_range(level, level * 3) + 35;
if (saves_spell(level, victim,DAM_FIRE))
dam /= 2;
else
fire_effect(victim, level, dam * 3, TARGET_CHAR);
damage(ch, victim, dam, sn, DAM_FIRE,TRUE);
return;
}
SPELL_FUN(spell_call_lightning)
{
CHAR_DATA *vch;
CHAR_DATA *vch_next;
int dam;
if (IS_AFFECTED(ch, AFF_FEAR))
{
char_act("You too scare to do this!", ch);
return;
}
if (!IS_OUTSIDE(ch))
{
char_act("You need to leave outside.", ch);
return;
}
if (weather_info.sky < SKY_RAINING)
{
char_act("You will need bad weather.", ch);
return;
}
dam = dice(level, 12);
char_act("The lightning from the sky hits you!", ch);
act("$n causes a lightning from the sky which hits $gn{his}!",
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 (vch->in_room == ch->in_room)
{
if (is_safe_spell(ch, vch, TRUE))
continue;
if (check_grounding(vch))
continue;
damage(ch, vch, saves_spell(level, vch, DAM_LIGHTNING) ? dam / 2 : dam,
sn, DAM_LIGHTNING, TRUE);
continue;
}
if (vch->in_room->area == ch->in_room->area
&& IS_OUTSIDE(vch)
&& IS_AWAKE(vch))
char_act("In the sky lightnings sparkle.", vch);
}
}
/* RT calm spell stops all fighting in the room */
SPELL_FUN(spell_calm)
{
CHAR_DATA *vch;
int mlevel = 0;
int count = 0;
int high_level = 0;
int chance;
AFFECT_DATA af;
/* get sum of all mobile levels in the room */
for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room)
{
if (vch->position == POS_FIGHTING)
{
count++;
if (IS_NPC(vch))
mlevel += vch->level;
else
mlevel += vch->level / 2;
high_level = UMAX(high_level,vch->level);
}
}
/* compute chance of stopping combat */
chance = 4 * level - high_level + 2 * count;
if (IS_IMMORTAL(ch)) /* always works */
mlevel = 0;
if (number_range(0, chance) >= mlevel)
{ /* hard to stop large fights */
for (vch = ch->in_room->people; vch; vch = vch->next_in_room)
{
if (is_immune(vch, DAM_MAGIC) || IS_UNDEAD(vch))
continue;
if (is_safe_spell(ch, vch, TRUE))
continue;
if (check_spellbane(ch, vch, sn))
continue;
if (IS_AFFECTED(vch, AFF_CALM | AFF_BERSERK)
|| is_affected(vch, gsn_frenzy))
continue;
char_act("The strange calmness covers you.", vch);
if (vch->fighting || vch->position == POS_FIGHTING)
stop_fighting(vch, FALSE);
af.where = TO_AFFECTS;
af.type = sn;
af.level = level;
af.duration = level/4;
af.location = APPLY_HITROLL;
if (!IS_NPC(vch))
af.modifier = -1 * vch->level / 2;
else
af.modifier = -1 * vch->level / 4;
af.bitvector = AFF_CALM;
affect_to_char(vch, &af);
af.location = APPLY_DAMROLL;
affect_to_char(vch, &af);
}
}
}
SPELL_FUN(spell_cause_light)
{
CHAR_DATA * victim = (CHAR_DATA *) vo;
AFFECT_DATA *af, paf;
int dam;
if (IS_AFFECTED(ch, AFF_FEAR))
{
char_act("You too scare to do this!", ch);
return;
}
if (ch == victim)
{
act("You won't do it.", ch, NULL, NULL, TO_CHAR);
return;
}
dam = level * get_skill(ch, sn) / 100 + dice(2,8);
for (af = victim->affected; af; af = af->next)
{
if (af->type == gsn_cause_critical)
{
act("$n is bleeding critically.", victim, NULL, ch, TO_ROOM);
act("You are bleeding critically.", ch, NULL, victim, TO_VICT);
victim->hit = UMAX(-1, victim->hit - dam);
update_pos(victim);
return;
}
else if (af->type == gsn_cause_serious)
{
act("$n is bleeding seriously.", victim, NULL, ch, TO_ROOM);
act("You are bleeding seriously.", ch, NULL, victim, TO_VICT);
victim->hit = UMAX(-1, victim->hit - dam);
update_pos(victim);
return;
}
else if (af->type == gsn_cause_light)
break;
}
if (af == NULL)
{
act("$n's wounds start to bleed lightly.",
victim, NULL, ch, TO_ROOM);
act("Your wounds start to bleed lightly.",
ch, NULL, victim, TO_VICT);
paf.where = TO_AFFECTS;
paf.type = gsn_cause_light;
paf.level = level;
paf.duration = -1;
paf.location = APPLY_HIT;
paf.modifier = - dam;
paf.bitvector = 0;
affect_to_char (victim, &paf);
update_pos(victim);
return;
}
if ((dam - af->modifier) < victim->max_hit * 3/17)
{
act("$n's wounds continue to bleed lightly.",
victim, NULL, ch, TO_ROOM);
act("Your wounds continue to bleed lightly.",
ch, NULL, victim, TO_VICT);
paf.where = TO_AFFECTS;
paf.type = gsn_cause_light;
paf.level = level;
paf.duration = -1;
paf.location = APPLY_HIT;
paf.modifier = - dam;
paf.bitvector = 0;
affect_join (victim, &paf);
update_pos(victim);
return;
}
dam -= af->modifier;
affect_remove(victim, af);
act("$n's wounds start to bleed seriously.",
victim, NULL, ch, TO_ROOM);
act("Your wounds start to bleed seriously.",
ch, NULL, victim, TO_VICT);
paf.where = TO_AFFECTS;
paf.type = gsn_cause_serious;
paf.level = level;
paf.duration = -1;
paf.location = APPLY_HIT;
paf.modifier = - dam;
paf.bitvector = 0;
affect_to_char (victim, &paf);
victim->hit = UMAX(victim->hit, -1);
update_pos(victim);
return;
}
SPELL_FUN(spell_cause_serious)
{
CHAR_DATA * victim = (CHAR_DATA *) vo;
AFFECT_DATA *af, paf;
int dam;
if (IS_AFFECTED(ch, AFF_FEAR))
{
char_act("You too scare to do this!", ch);
return;
}
if (ch == victim)
{
act("You won't do it.", ch, NULL, NULL, TO_CHAR);
return;
}
dam = level * get_skill(ch, sn) / 67 + dice(3,8);
for (af = victim->affected; af; af = af->next)
{
if (af->type == gsn_cause_critical)
{
act("$n is bleeding critically.", victim, NULL, ch, TO_ROOM);
act("You are bleeding critically.", ch, NULL, victim, TO_VICT);
victim->hit = UMAX(-1, victim->hit - dam);
update_pos(victim);
return;
}
else if (af->type == gsn_cause_serious)
break;
else if (af->type == gsn_cause_light)
{
spell_cause_light(gsn_cause_light, level, ch, vo, target);
return;
}
}
if (af == NULL)
{
spell_cause_light(gsn_cause_light, level, ch, vo, target);
return;
}
if ((dam - af->modifier) < victim->max_hit /2)
{
act("$n's wounds continue to bleed seriously.",
victim, NULL, ch, TO_ROOM);
act("Your wounds continue to bleed seriously.",
ch, NULL, victim, TO_VICT);
paf.where = TO_AFFECTS;
paf.type = gsn_cause_serious;
paf.level = level;
paf.duration = -1;
paf.location = APPLY_HIT;
paf.modifier = - dam;
paf.bitvector = 0;
affect_join (victim, &paf);
update_pos(victim);
return;
}
dam -= af->modifier;
affect_remove(victim, af);
act("$n's wounds start to bleed critically.",
victim, NULL, ch, TO_ROOM);
act("Your wounds start to bleed critically.",
ch, NULL, victim, TO_VICT);
paf.where = TO_AFFECTS;
paf.type = gsn_cause_critical;
paf.level = level;
paf.duration = -1;
paf.location = APPLY_HIT;
paf.modifier = - dam;
paf.bitvector = 0;
affect_to_char (victim, &paf);
victim->hit = UMAX(-1, victim->hit);
update_pos(victim);
return;
}
SPELL_FUN(spell_cause_critical)
{
CHAR_DATA * victim = (CHAR_DATA *) vo;
AFFECT_DATA *af, paf;
int dam;
if (IS_AFFECTED(ch, AFF_FEAR))
{
char_act("You too scare to do this!", ch);
return;
}
if (ch == victim)
{
act("You won't do it.", ch, NULL, NULL, TO_CHAR);
return;
}
dam = level * get_skill(ch, sn) / 50 + dice(4,8);
for (af = victim->affected; af; af = af->next)
{
if (af->type == gsn_cause_critical)
break;
else if (af->type == gsn_cause_serious)
{
spell_cause_serious(gsn_cause_serious, level, ch, vo, target);
return;
} else if (af->type == gsn_cause_light)
{
spell_cause_light(gsn_cause_light, level, ch, vo, target);
return;
}
}
if (af == NULL)
{
spell_cause_light(gsn_cause_light, level, ch, vo, target);
return;
}
if ((dam - af->modifier) < victim->max_hit)
{
act("$n's wounds continue to bleed critically.",
victim, NULL, ch, TO_ROOM);
act("Your wounds continue to bleed critically.",
ch, NULL, victim, TO_VICT);
paf.where = TO_AFFECTS;
paf.type = gsn_cause_critical;
paf.level = level;
paf.duration = -1;
paf.location = APPLY_HIT;
paf.modifier = - dam;
paf.bitvector = 0;
affect_join (victim, &paf);
update_pos(victim);
return;
}
act("$n is harmed very bad.",
victim, NULL, ch, TO_ROOM);
act("You are harmed very bad.",
ch, NULL, victim, TO_VICT);
victim->hit = UMAX(-1, victim->hit - dam);
update_pos(victim);
return;
}
SPELL_FUN(spell_chain_lightning)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
CHAR_DATA *vch,*last_vict,*next_vict;
bool found;
int dam;
/* first strike */
if (IS_AFFECTED(ch, AFF_FEAR))
{
char_act("You too scare to do this!", ch);
return;
}
act("The electric spark is broken from fingers $n and gets in $N.",
ch, NULL, victim, TO_ROOM);
act("The electric spark is broken from your fingers and gets in $N.",
ch, NULL, victim, TO_CHAR);
act("The electric spark is broken from fingers $n and gets in you!",
ch, NULL, victim, TO_VICT);
dam = dice(level,6);
if (!check_grounding(victim))
{
if (saves_spell(level, victim, DAM_LIGHTNING))
dam /= 3;
damage(ch, victim, dam, sn, DAM_LIGHTNING, TRUE);
level -= 4; /* decrement damage */
}
last_vict = victim;
/* new targets */
while (level > 0)
{
found = FALSE;
for (vch = ch->in_room->people; vch; vch = next_vict)
{
next_vict = vch->next_in_room;
if (vch == last_vict)
continue;
if (is_safe_spell(ch, vch, TRUE))
{
act("The electric spark passes through a $n's body.",
ch, NULL, NULL, TO_ROOM | ACT_VERBOSE);
act("The electric spark passes through your body.",
ch, NULL, NULL, TO_CHAR | ACT_VERBOSE);
continue;
}
last_vict = vch;
act("The high electricity shakes $n!",
vch, NULL, NULL, TO_ROOM | ACT_VERBOSE);
act("The high electricity shakes you!",
vch, NULL, NULL, TO_CHAR | ACT_VERBOSE);
dam = dice(level,6);
if (!check_grounding(vch))
{
if (saves_spell(level, vch, DAM_LIGHTNING))
dam /= 3;
damage(ch, vch, dam, sn, DAM_LIGHTNING, TRUE);
level -= 4; /* decrement damage */
found = TRUE;
}
} /* end target searching loop */
if (found)
continue;
/* no target found, hit the caster */
if (ch == NULL)
return;
if (last_vict == ch)
{ /* no double hits */
act("The electric spark leaves in the ground.",
ch, NULL, NULL, TO_ROOM);
act("The electric spark leaves through your body in the ground.",
ch, NULL, NULL, TO_CHAR);
return;
}
last_vict = ch;
act("The electric spark hits $n... Ops!", ch, NULL, NULL, TO_ROOM);
char_act("You are struck with own electric spark!", ch);
dam = dice(level,6);
if (!check_grounding(ch))
{
if (saves_spell(level, ch, DAM_LIGHTNING))
dam /= 3;
damage(ch, ch, dam, sn, DAM_LIGHTNING, TRUE);
level -= 4; /* decrement damage */
}
} /* now go back and find more targets */
}
SPELL_FUN(spell_enlarge)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if (is_affected(victim, sn))
{
if (victim == ch)
char_act("You are already enlarged.", ch);
else
act("It is impossible to enlarge $N even more strongly.", ch, NULL, victim, TO_CHAR);
return;
}
if (is_affected(victim, gsn_shrink))
{
if (!dispel1(level, victim, gsn_shrink))
act("You failed to enlarge $N.", ch, NULL, victim, TO_CHAR);
return;
}
if (is_affected(victim, gsn_polymorph))
{
if (victim == ch)
char_act("You have already changed yourself.", ch);
else
act("$N has already changed $gN{himself}.", ch, NULL, victim, TO_CHAR);
return ;
}
af.where = TO_AFFECTS;
af.type = sn;
af.level = level;
af.duration = level / 12;
af.location = APPLY_SIZE;
af.modifier = UMAX(1, level / 30);
af.bitvector = 0;
affect_to_char(victim, &af);
act("$n unexpectedly enlarges in sizes!", victim, NULL, NULL, TO_ROOM);
act("You unexpectedly enlarge!", victim, NULL, NULL, TO_CHAR);
}
SPELL_FUN(spell_shrink)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if (is_affected(victim, sn))
{
if (victim == ch)
char_act("You are already shrinked.", ch);
else
act("It is impossible to shrink $N even more strongly.", ch, NULL, victim, TO_CHAR);
return;
}
if (is_affected(victim, gsn_enlarge))
{
if (!dispel1(level, victim, gsn_enlarge))
act("You failed to shrink $N.", ch, NULL, victim, TO_CHAR);
return;
}
if (is_affected(victim, gsn_polymorph))
{
if (victim == ch)
char_act("You have already changed yourself.", ch);
else
act("$N has already changed $gN{himself}.", ch, NULL, victim, TO_CHAR);
return ;
}
af.where = TO_AFFECTS;
af.type = sn;
af.level = level;
af.duration = level / 12;
af.location = APPLY_SIZE;
af.modifier = - UMAX(1, level / 30);
af.bitvector = 0;
affect_to_char(victim, &af);
act("$n unexpectedly shrinkes in sizes!", victim, NULL, NULL, TO_ROOM);
act("You unexpectedly shrink!", victim, NULL, NULL, TO_CHAR);
}
SPELL_FUN(spell_healing_light)
{
AFFECT_DATA af,af2;
if (IS_UNDEAD(ch))
{
act("To you even to think about such it is disgusting.", ch, NULL, NULL, TO_CHAR);
return;
}
if (is_affected_room(ch->in_room, sn))
{
char_act("This room has already been cured by the {WLight{x.", ch);
return;
}
af.where = TO_ROOM_CONST;
af.type = sn;
af.level = level;
af.duration = level / 25;
af.location = APPLY_ROOM_HEAL;
af.modifier = level;
af.bitvector = 0;
affect_to_room(ch->in_room, &af);
af2.where = TO_AFFECTS;
af2.type = sn;
af2.level = level;
af2.duration = level / 10;
af2.modifier = 0;
af2.location = APPLY_NONE;
af2.bitvector = 0;
affect_to_char(ch, &af2);
char_act("The room is filled by the {WLight{x.", ch);
act("The room is filled by the {WLight{x which radiates by $n.",
ch, NULL, NULL, TO_ROOM);
}
/*
* Types are the following:
*
* -1 manacles
* 0 charm person
* 1 attract other
* 2 control undead
* 3 control cyborg
* 4 control animal
* 5 mind control
* 6 fascinate // GM : BattleMages' stuff
*
*/
bool charm_parser(int type, int sn, int level, CHAR_DATA *ch, void *vo, int target)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
race_t *r;
int chance, duration = 0;
// Common stupidity checks
if (is_gquest_mob(victim))
{
char_act("On this creation hunting is declared. Just kill it.", ch);
return FALSE;
}
if (IS_AFFECTED(ch, AFF_CHARM))
{
char_act("Your now charmed", ch);
return FALSE;
}
if (count_charmed(ch) && IS_NPC(victim))
return FALSE;
if (IS_AFFECTED(ch, AFF_FEAR))
{
char_act("You too scare to do this!", ch);
return FALSE;
}
if (victim == ch)
{
char_act("You again become yourself!", ch);
return FALSE;
}
if (!can_see(victim, ch))
{
act("Your charm has no borders, but $N cannot estimate it.", ch, NULL, victim, TO_CHAR);
return FALSE;
}
if (victim->fighting)
{
act("All attention of $N is absorbed by fight.", ch, NULL, victim, TO_CHAR);
return FALSE;
}
if (victim->position == POS_SLEEPING)
{
char_act("How do you want to charm sleeping one?!", ch);
return FALSE;
}
if (!war_can_charm (ch, victim))
return FALSE;
if (!IS_IMMORTAL(ch))
{
if ((get_eq_char(ch, WEAR_BODY) == NULL
|| get_eq_char(ch, WEAR_HEAD) == NULL
|| get_eq_char(ch, WEAR_LEGS) == NULL
|| get_eq_char(ch, WEAR_FEET) == NULL
|| get_eq_char(ch, WEAR_HANDS) == NULL
|| get_eq_char(ch, WEAR_ARMS) == NULL
|| get_eq_char(ch, WEAR_ABOUT) == NULL
|| get_eq_char(ch, WEAR_WAIST) == NULL)
&& !IS_NPC(victim))
{
char_act("{REQ check failed!!!{x", ch);
WAIT_STATE(ch, 10 * PULSE_VIOLENCE);
return FALSE;
}
}
if (IS_AFFECTED(victim, AFF_CHARM)
|| is_safe(ch, victim)
|| is_immune(victim, DAM_CHARM)
|| (IS_NPC(victim) && victim->pIndexData->pShop != NULL))
return FALSE;
r = race_lookup(ORG_RACE(victim));
// Ok, now personalised by sn's checks.
if (type >= 0)
{
if ((type == 1) && (ch->sex == victim->sex))
{
act("Try chances with representatives of other sex!",
ch, NULL, victim, TO_CHAR);
return FALSE;
}
if ((type == 2) && !IS_UNDEAD(victim))
{
act("$N it is not similar on an undead.", ch, NULL, victim, TO_CHAR);
return FALSE;
}
if ((type != 2) && IS_UNDEAD(victim))
{
act("To undeads your charms are indifferent.", ch, NULL, victim, TO_CHAR);
return FALSE;
}
if ((type == 3) && !IS_CYBORG(victim))
{
act("$N ÎÅ ËÉÂÅÒÎÅÔÉÞÅÓËÉÊ ÏÒÇÁÎÉÚÍ.", ch, NULL, victim, TO_CHAR);
return FALSE;
}
// ðÕÓÔØ "×ÅÄÕÔÓÑ ËÁË ÌÏÈÉ" ÐÏËÁ GrayMage ÎÅ ÚÁÈÏÞÅÔ ÎÁÏÂÏÒÏÔ. /sg
/*
if ((type != 3) && IS_CYBORG(victim)) {
act("To cybernetic organisms your charms are indifferent.",
ch, NULL, victim, TO_CHAR);
return FALSE;
}
*/
if ((type == 4) && (r && r->pcdata) && !IS_SET(victim->form, FORM_WOLF|FORM_BEAR))
{
act("Can, you will try it on monsters?", ch, NULL, victim, TO_CHAR);
return FALSE;
}
if (((type == 0) || (type == 1)) && !(r && r->pcdata))
{
act("$N is the disgusting monster. You does not contribute to zoophilia.", ch, NULL, victim, TO_CHAR);
return FALSE;
}
}
chance = get_skill(ch, sn);
chance /= 3;
chance += (level - LVL(victim));
chance += (get_curr_stat(ch, STAT_LCK) -
get_curr_stat(victim, STAT_LCK)) * 2;
if ((type == 0) || (type == 1) || (type == 6))
{
chance += URANGE(0, (get_curr_stat(ch, STAT_INT)-20)*4, 20);
chance += (get_curr_stat(ch, STAT_CHA) -
get_curr_stat(victim, STAT_CHA)) * 2;
}
else if (type == 2)
{
chance += URANGE(0, (get_curr_stat(ch, STAT_INT)-20)*4, 20);
chance += get_skill(ch, gsn_improved_necromancy)/10;
}
else if (type == 3)
{
chance += URANGE(0, (get_curr_stat(ch, STAT_INT)-20)*3, 15);
chance += URANGE(0, (get_curr_stat(ch, STAT_WIS)-20)*3, 15);
}
else if (type == 4)
{
chance += (get_curr_stat(ch, STAT_CHA) - 20) * 5;
chance += (level - LVL(victim)) * 2;
chance += (get_curr_stat(ch,STAT_INT) -
get_curr_stat(victim,STAT_INT)) * 5;
}
else if (type == 5)
{
chance += URANGE(0, (get_curr_stat(ch, STAT_WIS)-20)*4, 20);
chance += UMAX(0,(get_curr_stat(ch, STAT_INT) -
get_curr_stat(victim, STAT_WIS)) * 2);
}
/*
if (type == 5 ? !psychic_contest(ch, victim, sn) :
saves_spell(level, victim, DAM_CHARM))
chance /= 10;
*/
if (saves_spell(level, victim, DAM_CHARM))
chance /= 15;
if (IS_NPC(victim))
{
if (level > LVL(victim))
chance = 85;
else if ((level + level / 20) < LVL(victim))
chance = 0;
}
else
chance = URANGE(2, chance, 40);
resists_modify(&chance, check_immune(victim, DAM_CHARM), TRUE);
if (type == 6 && IS_NPC(victim))
chance = 0;
if (chance == 0)
{
act("ôÙ ÎÅ × ÓÏÓÔÏÑÎÉÉ ÏÞÁÒÏ×ÁÔØ $N.", ch, NULL, victim, TO_CHAR);
return FALSE;
}
if (number_percent() < get_skill(ch, gsn_mastering_charm) && !IS_NPC (victim))
duration = -2;
else if (!IS_NPC(victim))
duration = level / 15 + 1;
else
duration = level * 2;
if (number_percent() < chance)
{
if (victim->master)
stop_follower(victim);
add_follower(victim, ch);
victim->leader = ch;
af.where = TO_AFFECTS;
af.type = sn;
af.level = level;
af.duration = duration;
af.location = 0;
af.modifier = 0;
af.bitvector = AFF_CHARM;
affect_to_char(victim, &af);
act("Is $n soo beutifull?", ch, NULL, victim, TO_VICT);
if (IS_NPC(victim))
victim->long_descr = mlstr_addstr(victim->short_descr,"\n");
/*
* Types are the following:
*
* -1 manacles
* 0 charm person
* 1 attract other
* 2 control undead
* 3 control cyborg
* 4 control animal
* 5 mind control
* 6 fascinate // GM : BattleMage's staff...
*
*/
if (ch != victim)
{
// if (type == 0)
// GM : TODO Add more msg for each type!
act("$N looks at you with love in eyes.",
ch, NULL, victim, TO_CHAR);
}
return TRUE;
} else
{
act("You failed to charm $N.", ch, NULL, victim, TO_CHAR);
return FALSE;
}
}
SPELL_FUN(spell_charm_person)
{
charm_parser(0, sn, level, ch, vo, target);
}
SPELL_FUN(spell_attract_other)
{
charm_parser(1, sn, level, ch, vo, target);
}
SPELL_FUN(spell_control_undead)
{
charm_parser(2, sn, level, ch, vo, target);
}
SPELL_FUN(spell_control_cyborg)
{
charm_parser(3, sn, level, ch, vo, target);
}
SPELL_FUN(spell_control_animal)
{
charm_parser(4, sn, level, ch, vo, target);
}
// By GrayMage
SPELL_FUN(spell_mind_control)
{
/*
CHAR_DATA *victim = (CHAR_DATA *) vo;
int psp;
psp = 2 * psionic_level(victim);
if (ch->psp < psp)
{
act("You need $j psi power $qj{points} to dominate $gN{him}.",
ch, (const void *) psp, victim, TO_CHAR);
return;
}
ch->psp -= psp;
*/
charm_parser(5, sn, level, ch, vo, target);
}
SPELL_FUN(spell_fascinate)
{
charm_parser(6, sn, level, ch, vo, target);
}
SPELL_FUN(spell_manacles)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
if (!IS_SET(victim->plr_flags, PLR_WANTED))
{
act("But $N now not wanted.", ch, NULL, victim, TO_CHAR);
return;
}
if (IS_AFFECTED(ch,AFF_FEAR))
{
char_act("You too scare to do this!", ch);
return;
}
if (!is_affected(victim, sn))
{
AFFECT_DATA af;
af.where = TO_AFFECTS;
af.type = sn;
af.level = level;
af.duration = 5 + level/5;
af.bitvector = 0;
af.modifier = 0 - (get_curr_stat(victim, STAT_DEX)-4);
af.location = APPLY_DEX;
affect_to_char(victim, &af);
af.modifier = -level/4;
af.location = APPLY_HITROLL;
affect_to_char(victim, &af);
af.modifier = -level/2;
af.location = APPLY_DAMROLL;
affect_to_char(victim, &af);
}
charm_parser(-1, sn, level+20, ch, vo, TARGET_CHAR);
}
SPELL_FUN(spell_chill_touch)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
int dam;
if (IS_AFFECTED(ch,AFF_FEAR))
{
char_act("You too scare to do this!", ch);
return;
}
dam = number_range(level, level*7) + 10;
if (check_dodge(ch, victim))
{
level = level - level /10;
dam = dam - dam / 3;
}
if (!saves_spell(level, victim, DAM_COLD))
{
if (!is_affected(victim, sn))
{
act("$n turns blue and shivers.", victim, NULL, NULL, TO_ROOM);
af.where = TO_AFFECTS;
af.type = sn;
af.level = number_range(level/2, 3*level/4);
af.duration = level/15;
af.location = APPLY_STR;
af.modifier = - number_range(10,20);
af.bitvector = 0;
affect_join(victim, &af);
}
} else
dam = dam - dam / 3;
damage(ch, victim, dam, sn, DAM_COLD, TRUE);
}
SPELL_FUN(spell_colour_spray)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
if (IS_AFFECTED(ch,AFF_FEAR)){
char_act("You too scare to do this!", ch);
return;
}
dam = number_range(level*2, level*5) + 40;
if (saves_spell(level, victim, DAM_LIGHT))
dam /= 2;
else
spell_blindness(sn, 2*level/3, ch, (void *) victim, TARGET_CHAR);
damage(ch, victim, dam, sn, DAM_LIGHT, TRUE);
}
SPELL_FUN(spell_continual_light)
{
OBJ_DATA *light;
if (target_name[0] != '\0') /* do a glow on some object */
{
light = get_obj_carry(ch, target_name);
if (light == NULL)
{
char_act("You do not see it here.", ch);
return;
}
if (IS_OBJ_STAT(light, ITEM_GLOW))
{
act("$p already shines.", ch, light, NULL, TO_CHAR);
return;
}
SET_BIT(light->extra_flags, ITEM_GLOW);
act("$p begins shines.", ch, light, NULL, TO_ALL);
return;
}
light = create_obj(get_obj_index(OBJ_VNUM_LIGHT_BALL), 0);
obj_to_room(light, ch->in_room);
act("$n creates shining $p.", ch, light, NULL, TO_ROOM);
act("You create shining $p.", ch, light, NULL, TO_CHAR);
return;
}
SPELL_FUN(spell_create_food)
{
OBJ_DATA *mushroom;
mushroom = create_obj(get_obj_index(OBJ_VNUM_MUSHROOM), 0);
mushroom->value[0] = (ch->level < 50) ? (level / 2) : (level / 3);
mushroom->value[1] = (ch->level < 50) ? level : level * 2 / 3;
if (number_percent() < 5)
mushroom->value[3] = 1;
obj_to_room(mushroom, ch->in_room);
act("Suddenly before you grows $p.", ch, mushroom, NULL, TO_ROOM);
act("Suddenly before you grows $p.", ch, mushroom, NULL, TO_CHAR);
return;
}
SPELL_FUN(spell_create_rose)
{
OBJ_DATA *rose;
if (strlen(target_name) > 200)
{
char_act("You can read through all this?", ch);
return;
}
if (target_name[0] == '\0')
{
char_act("Do you want to create what rose?", ch);
return;
}
rose = create_named_obj(get_obj_index(OBJ_VNUM_ROSE), 0,
target_name);
rose->ed = ed_new2(rose->pIndexData->ed, target_name);
act("$n creates $p.", ch, rose, NULL, TO_ROOM);
act("You create $p.", ch, rose, NULL, TO_CHAR);
obj_to_char(rose, ch);
}
SPELL_FUN(spell_create_spring)
{
OBJ_DATA *spring;
spring = create_obj(get_obj_index(OBJ_VNUM_SPRING), 0);
spring->timer = level;
obj_to_room(spring, ch->in_room);
act("Suddenly from the ground begins spring $p.", ch, spring, NULL, TO_ROOM);
act("Suddenly from the ground begins spring $p.", ch, spring, NULL, TO_CHAR);
return;
}
SPELL_FUN(spell_create_water)
{
OBJ_DATA *obj = (OBJ_DATA *) vo;
int water;
if (obj->pIndexData->item_type != ITEM_DRINK_CON)
{
char_act("This container cannot comprise water.", ch);
return;
}
if (obj->value[2] != LIQ_WATER && obj->value[1] != 0)
{
char_act("This filled with other liquid.", 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))
{
const char *p = obj->name;
obj->name = str_printf("%s %s", obj->name, "water");
free_string(p);
}
act("$p it is filled.", ch, obj, NULL, TO_CHAR);
}
}
SPELL_FUN(spell_cure_light)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA *af, paf;
int heal;
heal = dice(1, 8) + level / 4 + 5;
if(CAN_HEAL(ch, victim))
{
if (IS_CYBORG(victim) && ch != victim)
{
char_act("It it is difficult to cure.", ch);
heal /= 2;
}
victim->hit = UMIN(victim->hit + heal, victim->max_hit);
update_pos(victim);
char_act("You feel better!", victim);
if (ch != victim)
char_act("Ok.", ch);
}
else if(!is_safe(ch,victim))
{
damage(ch, victim, heal, sn, DAM_LIGHT, TRUE);
return;
}
for (af = victim->affected; af; af = af->next)
{
if (af->type == gsn_cause_critical)
{
act("Alas this miracle can't cure critical wounds of $N.",
ch, NULL, victim, TO_CHAR);
return;
}
if (af->type == gsn_cause_serious)
{
act("Alas this miracle can't cure serious wounds of $N.",
ch, NULL, victim, TO_CHAR);
return;
}
if (af->type == gsn_cause_light)
break;
}
if (af == NULL)
return;
heal = level * get_skill(ch, sn) / 100 + dice(2,8);
if (heal + af->modifier >= 0)
{
act("Your wounds stopped bleeding.",
ch, NULL, victim, TO_VICT);
act("$n's wounds stopped bleeding.",
victim, NULL, ch, TO_ROOM);
affect_remove(victim, af);
return;
}
else
{
act("$n's wounds continue to bleed lightly.",
victim, NULL, ch, TO_ROOM);
act("Your wounds continue to bleed lightly.",
ch, NULL, victim, TO_VICT);
paf.where = TO_AFFECTS;
paf.type = gsn_cause_light;
paf.level = level;
paf.duration = -1;
paf.location = APPLY_HIT;
paf.modifier = heal;
paf.bitvector = 0;
affect_join (victim, &paf);
update_pos(victim);
return;
}
return;
}
SPELL_FUN(spell_cure_serious)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA *af, paf;
int heal;
heal = dice(2, 8) + level / 3 + 10 ;
if(CAN_HEAL(ch, victim)) {
if (IS_CYBORG(victim) && ch != victim) {
char_act("It it is difficult to cure.", ch);
heal /= 2;
}
victim->hit = UMIN(victim->hit + heal, victim->max_hit);
update_pos(victim);
char_act("You feel better!", victim);
if (ch != victim)
char_act("Ok.", ch);
}
else if(!is_safe(ch,victim))
{
damage(ch, victim, heal, sn, DAM_LIGHT, TRUE);
return;
}
for (af = victim->affected; af; af = af->next)
{
if (af->type == gsn_cause_critical)
{
act("Alas this miracle can't cure critical wounds of $N.",
ch, NULL, victim, TO_CHAR);
return;
}
if (af->type == gsn_cause_serious)
{
heal = level * get_skill(ch, sn) / 67 + dice(3,8);
break;
}
if (af->type == gsn_cause_light)
{
spell_cure_light(sn, level, ch, vo, target);
return;
}
}
if (af == NULL)
return;
if ( (-heal - af->modifier) < victim->max_hit * 3/17)
{
heal += af->modifier;
affect_remove(victim, af);
if (heal >= 0)
{
act("Your wounds stopped bleeding.",
ch, NULL, victim, TO_VICT);
act("$n's wounds stopped bleeding.",
victim, NULL, ch, TO_ROOM);
return;
}
act("Your wounds stopped bleeding so seriously.",
ch, NULL, victim, TO_VICT);
act("$n's wounds stopped bleeding so seriously.",
victim, NULL, ch, TO_ROOM);
paf.where = TO_AFFECTS;
paf.type = gsn_cause_light;
paf.level = level;
paf.duration = -1;
paf.location = APPLY_HIT;
paf.modifier = heal;
paf.bitvector = 0;
affect_join (victim, &paf);
update_pos(victim);
return;
}
else
{
act("$n's wounds continue to bleed seriously.",
victim, NULL, ch, TO_ROOM);
act("Your wounds continue to bleed seriously.",
ch, NULL, victim, TO_VICT);
paf.where = TO_AFFECTS;
paf.type = gsn_cause_serious;
paf.level = level;
paf.duration = -1;
paf.location = APPLY_HIT;
paf.modifier = heal;
paf.bitvector = 0;
affect_join (victim, &paf);
update_pos(victim);
return;
}
return;
}
SPELL_FUN(spell_cure_critical)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA *af, paf;
int heal;
heal = dice(3, 8) + level / 2 ;
if(CAN_HEAL(ch,victim)) {
if (IS_CYBORG(victim) && ch != victim) {
char_act("It it is difficult to cure.", ch);
heal /= 2;
}
victim->hit = UMIN(victim->hit + heal, victim->max_hit);
update_pos(victim);
char_act("You feel better!", victim);
if (ch != victim)
char_act("Ok.", ch);
}
else if(!is_safe(ch, victim))
{
damage(ch, victim, heal, sn, DAM_LIGHT, TRUE);
return;
}
for (af = victim->affected; af; af = af->next)
{
if (af->type == gsn_cause_critical)
{
heal = level * get_skill(ch, sn) / 50 + dice(4,8);
break;
}
if (af->type == gsn_cause_serious)
{
spell_cure_serious(sn, level, ch, vo, target);
return;
}
if (af->type == gsn_cause_light)
{
spell_cure_light(sn, level, ch, vo, target);
return;
}
}
if (af == NULL)
return;
if ( (-heal - af->modifier) < victim->max_hit / 2)
{
heal += af->modifier;
affect_remove(victim, af);
if (heal >= 0)
{
act("Your wounds stopped bleeding.",
ch, NULL, victim, TO_VICT);
act("$n's wounds stopped bleeding.",
victim, NULL, ch, TO_ROOM);
return;
}
act("Your wounds stopped bleeding so critically.",
ch, NULL, victim, TO_VICT);
act("$n's wounds stopped bleeding so critically.",
victim, NULL, ch, TO_ROOM);
paf.where = TO_AFFECTS;
paf.type = gsn_cause_serious;
paf.level = level;
paf.duration = -1;
paf.location = APPLY_HIT;
paf.modifier = heal;
paf.bitvector = 0;
affect_join (victim, &paf);
update_pos(victim);
return;
}
else
{
act("$n's wounds continue to bleed critically.",
victim, NULL, ch, TO_ROOM);
act("Your wounds continue to bleed critically.",
ch, NULL, victim, TO_VICT);
paf.where = TO_AFFECTS;
paf.type = gsn_cause_critical;
paf.level = level;
paf.duration = -1;
paf.location = APPLY_HIT;
paf.modifier = heal;
paf.bitvector = 0;
affect_join (victim, &paf);
update_pos(victim);
return;
}
return;
}
SPELL_FUN(spell_curse)
{
CHAR_DATA *victim;
OBJ_DATA *obj;
AFFECT_DATA af;
/* deal with the object case first */
if (IS_AFFECTED(ch, AFF_FEAR))
{
char_act("You too scare to do this!", ch);
return;
}
if (target == TARGET_OBJ)
{
obj = (OBJ_DATA *) vo;
if (IS_OBJ_STAT(obj, ITEM_EVIL))
{
act("$p it is already filled with {DEvil{x.", ch, obj, NULL, TO_CHAR);
return;
}
if (IS_OBJ_STAT(obj, ITEM_BLESS))
{
AFFECT_DATA *paf;
paf = affect_find(obj->affected,sn_lookup("bless"));
if (!saves_dispel(level,paf != NULL ? paf->level : obj->level,0))
{
if (paf != NULL)
affect_remove_obj(obj,paf);
act("$p shrouds with the {Rred aura{x.", ch, obj, NULL, TO_ALL);
REMOVE_BIT(obj->extra_flags,ITEM_BLESS);
return;
} else
{
act("{WHoly aura{x around $p is too powerful to clean her.",
ch, obj, NULL, TO_CHAR);
return;
}
}
af.where = TO_OBJECT;
af.type = sn;
af.level = level;
af.duration = (8 + level / 5);
af.location = APPLY_SAVES;
af.modifier = +1;
af.bitvector = ITEM_EVIL;
affect_to_obj(obj,&af);
act("$p flashes with {Rred{x aura.",ch,obj,NULL,TO_ALL);
return;
}
/* character curses */
victim = (CHAR_DATA *) vo;
if (IS_AFFECTED(victim, AFF_CURSE))
{
if (ch == victim)
char_act("Sadomazo? You already feel uncomfortably!", ch);
else
act("$N already looks uncomfortably!", ch, NULL, victim, TO_CHAR);
return;
}
if (saves_spell(level, victim, DAM_NEGATIVE))
{
char_act("Your spell has not passed!", ch);
return;
}
af.where = TO_AFFECTS;
af.type = sn;
af.level = level;
af.duration = (8 + level / 10);
af.location = APPLY_HITROLL;
af.modifier = -1 * (level / 8);
af.bitvector = AFF_CURSE;
affect_to_char(victim, &af);
af.location = APPLY_SAVING_SPELL;
af.modifier = 10;
affect_to_char(victim, &af);
char_act("You feel uncomfortably.", victim);
if (ch != victim)
act("$N looks uncomfortably.",ch,NULL,victim,TO_CHAR);
return;
}
/* RT replacement demonfire spell */
SPELL_FUN(spell_demonfire)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
if (IS_AFFECTED(ch,AFF_FEAR)){
char_act("You too scare to do this!", ch);
return;
}
if (!IS_NPC(ch) && !IS_EVIL(ch))
{
victim = ch;
char_act("{rDemons of the Hell{x have turned back against you!", ch);
}
if (victim != ch)
{
act("$n sends {rDemons of the Hell{x on $N!",
ch,NULL,victim,TO_ROOM);
act("$n sends to you {rDemons of the Hell{x!",
ch,NULL,victim,TO_VICT);
char_act("You cause {rDemons of the Hell{x!", ch);
}
dam = dice(level, 12);
if (saves_spell(level, victim,DAM_NEGATIVE))
dam /= 2;
spell_curse(gsn_curse, 3 * level / 4, ch, (void *) victim, TARGET_CHAR);
damage(ch, victim, dam, sn, DAM_NEGATIVE ,TRUE);
}
/* added by chronos */
SPELL_FUN(spell_bluefire)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
if (IS_AFFECTED(ch,AFF_FEAR)){
char_act("You too scare to do this!", ch);
return;
}
if (!IS_NPC(ch) && !IS_NEUTRAL(ch))
{
victim = ch;
char_act("Yours {BBlue Fire{x of {gEarth{x burns you!", ch);
}
if (victim != ch)
{
act("$n causes {BBlue Fire{x of {gEarth{x to bring down it on $N!",
ch,NULL,victim,TO_ROOM);
act("$n burns you by {BBlue Fire{x of {gEarth{x!",
ch,NULL,victim,TO_VICT);
char_act("You cause spirits {BBlue Fire{x!", ch);
}
dam = dice(level, 12);
if (saves_spell(level, victim,DAM_FIRE))
dam /= 2;
damage(ch, victim, dam, sn, DAM_FIRE ,TRUE);
}
SPELL_FUN(spell_detect_evil)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if (IS_AFFECTED(victim, AFF_DETECT_EVIL))
{
if (victim == ch)
char_act("You already feel {rEvil{x.", ch);
else
act("$N already feels {rEvil{x.",ch,NULL,victim,TO_CHAR);
return;
}
af.where = TO_AFFECTS;
af.type = sn;
af.level = level;
af.duration = (5 + level / 3);
af.modifier = 0;
af.location = APPLY_NONE;
af.bitvector = AFF_DETECT_EVIL;
affect_to_char(victim, &af);
char_act("In your eyes flash {Rred{x sparkles.", victim);
if (ch != victim)
char_act("Ok.", ch);
return;
}
SPELL_FUN(spell_detect_good)
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
AFFECT_DATA af;
if (IS_AFFECTED(victim, AFF_DETECT_GOOD))
{
if (victim == ch)
char_act("You already feel {WGoodness{x.", ch);
else
act("$N already feels {WGoodness{x.",ch,NULL,victim,TO_CHAR);
return;
}
af.where = TO_AFFECTS;
af.type = sn;
af.level = level;
af.duration = (5 + level / 3);
af.modifier = 0;
af.location = APPLY_NONE;
af.bitvector Showing the first 100 KB of 217.6 KB. Download the archive for the full file.