ring.c
./lib/players/angel/obj/ring.c · 1.3 KB
From the archive h7v3.0a.tar.gz
Download the archive « Back to the archive contents
/* A ring of spell turning */
#include <mudlib.h>
#include <ansi.h>
#include <spell.h>
inherit MAGIC_ARMOUR;
void reset(status arg) {
if(arg) return;
set_name("ring");
set_info(
"A ring of spell turning.\n"+
"This ring, when worn, creates a magical aura, which will \n"+
"cause any non-area effect spells to bounce back to the caster.\n");
set_sell_destruct(1);
set_enchanted(1);
set_alias("external");
set_weight(1);
set_value(3000); /* 'cause its magical */
set_ac(1);
set_type("ring");
set_short("A ring");
}
status spell_capture(object caster,
object target,
object target_ob,
object previous,
int dmg) {
mixed *loaded_spell;
loaded_spell = caster->query_loaded_spell();
if(target->query_spell_dmg() != -1) return 0; /* we're not casting a spell*/
if(AREA_EFFECT) return 0;
if(TARGET == caster) return 0;
if(!query_worn()) return 0; /* must wear item to have spell reflect */
if(target_ob) destruct(target_ob);
say(caster->query_name()+"'s "+GREEN_F+SPELL_NAME+OFF+
" bounces back!\n", caster);
tell_room(environment(), caster->query_name()+"'s "+SPELL_NAME+
"bounces back!\n");
tell_object(caster, "Your "+SPELL_NAME+" bounces back!\n");
COMPONENT = 0;
TARGET = caster;
SPELL_TIME = 0;
target->set_loaded_spell(loaded_spell);
return 1;
}