Mage Stuff

Drow Code:

#include <version.h>
#include <flags.h>

int drowbonus;
int tempspellpower;
void check_for_medal(string check_spell, int normal_cost);


/************************************************************************/

int cast_wl(string what)
{
   tempspellpower=spellpower;
   check_for_medal("wl",10+(spellpower * 5));
   if ( set_spellcost((10 + (spellpower * 5)-drowbonus), 0, 0, 5) ) return 1;
   if ( !what )
      return (write("Cast Web Ladder up, down, or across?\n"),1);
   if ( what != "up" && what != "down" && what != "across" )
      return (write("Cast Web Ladder up, down, or across?\n"),1);
   if ( present("\nweb_ladder", env(TP)) )
      return (write("There is already a web ladder spell present here.\n"),1);
   if ( !pay_spellcost() ) return 1;
   this_player()->add_hook("move_player",({"move_player_hook"}));
   if ( drowbonus>0 ) write("You clutch your medallion tightly.\n");
   write("You begin summoning the power of Losoth....\n");
   spell_being_cast = "Web Ladder";
   called_spell = "web_ladder";
   call_out("web_ladder",1,what);
   return 1;
}
/************************************************************************/

int cast_eh(string what)
{
   tempspellpower=spellpower;
   check_for_medal("eh",10 + (spellpower * 5) );
   if ( set_spellcost(((10 + (spellpower * 5))-drowbonus), 0x00010000, 0, 5) ) return 1;
   if ( what && what != TPRN )
      return (write("The Expose Hidden spell may only be focused upon yourself.\n"), 1);
   else if ( pay_spellcost() )
   {
      this_player()->add_hook("move_player",({"move_player_hook"}));
      if ( drowbonus>0 ) write("You clutch your medallion tightly.\n");
      write("You begin summoning the power of Losoth....\n");
      spell_being_cast = "Expose Hidden";
      called_spell = "expose_hidden";
      call_out("expose_hidden",1,what);
   }
   return 1;
}

/************************************************************************/

int cast_sp(string what)
{
   tempspellpower=spellpower;
   check_for_medal("sp",15 + (spellpower * 5));
   if ( set_spellcost((15 + (spellpower * 5)-drowbonus), 0, 0, 5) ) return 1;
   if ( what && what != TPRN )
      return (write("The Silk Pack may only be focused upon yourself.\n"), 1);
   if ( !pay_spellcost() ) return 1;
   this_player()->add_hook("move_player",({"move_player_hook"}));
   if ( drowbonus>0 ) write("You clutch your medallion tightly.\n");
   write("You begin summoning the power of Losoth....\n");
   spell_being_cast = "Silk Pack";
   called_spell = "silk_pack";
   call_out("silk_pack",1,what);
   return 1;
}

/************************************************************************/

int cast_sa(string what)
{
   tempspellpower=spellpower;
   check_for_medal("sa",3*(INT(TP)/2)+(spellpower * 10) );
   if ( set_spellcost( ( (3* (INT(TP)/2) +(spellpower * 10) )-drowbonus),
                       0, 0, 5) ) return 1;
   if ( what && what != TPRN )
      return (write("The Silk Armour spell may only be focused upon yourself.\n"), 1);
   else if ( present("\narmour_tag", TP) )
   {
      write("You already have magical armouring cast upon you.\n");
      return 1;
   }
   if ( !pay_spellcost() ) return 1;
   this_player()->add_hook("move_player",({"move_player_hook"}));
   if ( drowbonus>0 ) write("You clutch your medallion tightly.\n");
   write("You begin summoning the power of Losoth....\n");
   spell_being_cast = "Silk Armour";
   called_spell = "silk_armour";
   call_out("silk_armour",1,what);
   return 1;
}

/************************************************************************/
int cast_sb(string what)
{
   tempspellpower=spellpower;
   check_for_medal("sb",INT(TP)+(INT(TP))+(spellpower * 6));
   if ( set_spellcost((INT(TP) + (INT(TP)) + (spellpower * 6)-drowbonus), 0x01000000, 0, 5) )
      return 1;
   if ( !(tempob = get_living_but_us_AA(what)) ) return 1;
   if ( env(TP)->query_no_kill(tempob) )
   {
      write("The spell fails.\n");
      spell_being_cast = 0;
      return 1;
   }
   if ( (tempob)->query_unkillable()==1 )
   {
      write("The spell fails.\n");
      spell_being_cast = 0;
      return 1;
   }
   if ( NO_MAGIC )
/*   if ( member_array("no magic",env(TP)->query_property()) > -1 ) */
   {
      write("The spell fails.\n");
      spell_being_cast = 0;
      return 1;
   }
   if ( present("\nspiderspell", environment(TP)) )
   {
      write("You have already summoned a spider here.\n");
      return 1;
   }
   if ( !pay_spellcost() ) return 1;
   this_player()->add_hook("move_player",({"move_player_hook"}));
   if ( drowbonus>0 ) write("You clutch your medallion tightly.\n");
   write("You begin summoning the power of Losoth....\n");
   spell_being_cast = "Spider Bite";
   called_spell = "spider_bite";
   call_out("spider_bite",4,what);
   return 1;
}

/************************************************************************/

int cast_wm(string what)
{
   tempspellpower=spellpower;
   check_for_medal("wm",(spellpower * 50));
   if ( set_spellcost(((spellpower * 50)-drowbonus), 0, 0x01010000, 5) ) return 1;
   if ( !what ) write("Cast Web Mouth at who?\n");
   else
      if ( tempob = get_living_but_us(what) )
   {
      if ( tempob->query_ghost() )
      {
         write("Web Mouth may only be focused upon living players.\n");
         return 1;
      }
      if ( tempob->query_npc() )
      {
         write("Web Mouth may only be focused upon players.\n");
         return 1;
      }
      if ( present("\nweb_mouth", tempob) )
      {
         write(tempob->query_name()+ " already has a gag of webbing.\n");
         return 1;
      }
      if ( !pay_spellcost() ) return 1;
      this_player()->add_hook("move_player",({"move_player_hook"}));
      if ( drowbonus>0 ) write("You clutch your medallion tightly.\n");
      write("You begin summoning the power of Losoth....\n");
      spell_being_cast = "Web Mouth";
      called_spell = "web_mouth";
      call_out("web_mouth",2,what);
   }
   return 1;
}

/************************************************************************/

int cast_ps(string what)
{
   tempspellpower=spellpower;
   check_for_medal("ps",25 + (10 * spellpower));
   if ( set_spellcost((25 + (10 * spellpower)-drowbonus), 0, 0, 5) ) return 1;
   if ( !what ) tempob = TP;
   else if ( !(tempob = get_living(what)) ) return 1;
   if ( present("\npoison_shield", tempob) )
   {
      write((tempob == TP?"You":"They")+ " already have Poison Shield "+
            "cast upon " +(tempob == TP?"you":"them")+ ".\n");
      return 1;
   }
   if ( !pay_spellcost() ) return 1;
   this_player()->add_hook("move_player",({"move_player_hook"}));
   if ( drowbonus>0 ) write("You clutch your medallion tightly.\n");
   write("You begin summoning the power of Losoth....\n");
   spell_being_cast = "Poison Shield";
   called_spell = "poison_shield";
   call_out("poison_shield",1,what);
   return 1;
}

/************************************************************************/

int cast_vs(string what)
{
   tempspellpower=spellpower;
   check_for_medal("vs",INT(TP) + (DEX(TP) / 2) + (spellpower * 3));
   if ( set_spellcost((INT(TP) + (DEX(TP) / 2) + LVL(TP)/3 + (spellpower * 4)-drowbonus), 0x01000000, 0, 5) )
      return 1;
   if ( !(tempob = get_living_but_us_AA(what)) ) return 1;
   if ( env(TP)->query_no_kill(tempob) ) return 1;
   if ( tempob->query_ghost() )
   {
      write("Venom Spit may only be focused upon living players.\n");
      return 1;
   }
   if ( (tempob)->query_unkillable()==1 )
   {
      write("The spell fails.\n");
      spell_being_cast = 0;
      return 1;
   }

   if ( !pay_spellcost() ) return 1;
   this_player()->add_hook("move_player",({"move_player_hook"}));
   if ( drowbonus>0 ) write("You clutch your medallion tightly.\n");
   write("You begin summoning the power of Losoth....\n");
   spell_being_cast = "Venom Spit";
   called_spell = "venom_spit";
   call_out("venom_spit",4,what);
   return 1;
}

/************************************************************************/

int cast_wh(string what)
{
   tempspellpower=spellpower;
   check_for_medal("wh",25 + (5 * spellpower));
   if ( set_spellcost((25 + (5 * spellpower)-drowbonus), 0, 0, 5) ) return 1;
   if ( what && what != TPRN )
   {
      write("You can only focus Web Hands on yourself.\n");
      return 1;
   }
   if ( present("\nweb_hands", TP) )
   {
      write("You already have a Web Hands spell on you.\n");
      return 1;
   }
   if ( !pay_spellcost() ) return 1;
   this_player()->add_hook("move_player",({"move_player_hook"}));
   if ( drowbonus>0 ) write("You clutch your medallion tightly.\n");
   write("You begin summoning the power of Losoth....\n");
   spell_being_cast = "Web Hands";
   called_spell = "web_hands";
   call_out("web_hands",1,what);
   return 1;
}

/************************************************************************/

int cast_ws(string what)
{
   tempspellpower=spellpower;
   check_for_medal("ws",35 + (10 * spellpower));
   if ( set_spellcost((35 + (10 * spellpower)-drowbonus), 0x00000001, 0, 5) ) return 1;
   if ( what && what != TPRN )
   {
      write("You can only focus Web Shield on yourself.\n");
      return 1;
   }
   if ( present("\nweb_shield", TP) )
   {
      write("You already have a Web Shield spell on you.\n");
      return 1;
   }
   if ( !pay_spellcost() ) return 1;
   this_player()->add_hook("move_player",({"move_player_hook"}));
   if ( drowbonus>0 ) write("You clutch your medallion tightly.\n");
   write("You begin summoning the power of Losoth....\n");
   spell_being_cast = "Web Shield";
   called_spell = "web_shield";
   call_out("web_shield",1,what);
   return 1;
}

/************************************************************************/

int cast_ww(string what)
{
   tempspellpower=spellpower;
   check_for_medal("ww",15+(10*spellpower));
   if ( set_spellcost(((15+(10*spellpower))-drowbonus), 0x00000001, 0, 5) ) return 1;
   if ( !what )
      return (write("Cast Web Wall in what direction?\n"),1);

   if ( !environment(this_player())->query_exit(what) )
      return (write("Cast Web Wall in what direction?\n"),1);

/*  if(what != "east" && what != "west" && what != "north" && */
/*     what != "south" && what != "e" && what != "w" && */
/*     what != "n" && what != "s" && what != "up" && */
/*     what != "down" && what != "u" && what != "d" && */
/*     what != "southeast" && what != "se" && what != "ne" && */
/*     what != "northeast" && what != "southwest" && what != "sw" && */
/*     what != "northwest" && what != "nw") */
/*    return(write("Cast Web Wall in what direction?\n"),1); */

   if ( what=="e" ) what="east";
   if ( what=="w" ) what="west";
   if ( what=="n" ) what="north";
   if ( what=="s" ) what="south";
   if ( what=="ne" ) what="northeast";
   if ( what=="se" ) what="southeast";
   if ( what=="nw" ) what="northwest";
   if ( what=="sw" ) what="southwest";
   if ( what=="u" ) what="up";
   if ( what=="d" ) what="down";

   if ( present("\nweb_wall", environment(TP)) )
   {
      writef("The magic of the Web Wall spell that is already here prevents you from "
             "summoning another.");
      return 1;
   }
   if(env(TP)->query_no_pk()) 
   {
      write("The spell fails.\n");
      return 1;
   }
   if ( env(TP)->query_no_kill() )
   {
      write("The spell fails.\n");
      return 1;
   }
   if ( NO_MAGIC )
   {
      write("The spell fails.\n");
      return 1;
   }
   if ( !pay_spellcost() ) return 1;
   this_player()->add_hook("move_player",({"move_player_hook"}));
   if ( drowbonus>0 ) write("You clutch your medallion tightly.\n");
   write("You begin summoning the power of Losoth....\n");
   spell_being_cast = "Web Wall";
   called_spell = "web_wall";
   call_out("web_wall",1,what);
   return 1;
}

/************************************************************************/

int cast_wd(string what)
{
   tempspellpower=spellpower;
   check_for_medal("wd",10 +(TP_I/2)+(spellpower * 8));
   if ( set_spellcost( ((10 +(TP_I/2)+(spellpower * 8))-drowbonus), 0x00000100, 0x01000000, 5) ) return 1;
   if ( what && what != TPRN )
   {
      write("The Web Defender spell may only be focused upon yourself.\n");
      return 1;
   }
   if ( !(TP->query_attack()) )
   {
      write("You are not being attacked!\n");
      return 1;
   }
   if ( present("\nweb_defender", environment(TP)) )
   {
      write("You already have a web defender here.\n");
      return 1;
   }
   if ( !(present(TP->query_attack(), environment(TP))) )
   {
      write("Your attacker is not here!\n");
      return 1;
   }
   if ( !pay_spellcost() ) return 1;
   this_player()->add_hook("move_player",({"move_player_hook"}));
   if ( drowbonus>0 ) write("You clutch your medallion tightly.\n");
   write("You begin summoning the power of Losoth....\n");
   spell_being_cast = "Web Defender";
   called_spell = "web_defender";
   call_out("web_defender",4,what);
   return 1;
}

/************************************************************************/

int cast_sl(string what)
{
   tempspellpower=spellpower;
   check_for_medal("sl",25 + (12 * spellpower));
   if ( set_spellcost((25 + (12 * spellpower)-drowbonus), 0x00000001, 0, 5) ) return 1;
   if ( what && what != TPRN )
   {
      write("The Spider Legs spell may only be focused upon yourself.\n");
      return 1;
   }
   if ( !what ) tempob = TP;
   else if ( !(tempob = get_living(what)) ) return 1;
   if ( present("\nspider_legs", tempob) )
   {
      write((tempob == TP?"You":"They")+ " already have Spider Legs "+
            "cast upon " +(tempob == TP?"you":"them")+ ".\n");
      return 1;
   }
   if ( !pay_spellcost() ) return 1;
   this_player()->add_hook("move_player",({"move_player_hook"}));
   if ( drowbonus>0 ) write("You clutch your medallion tightly.\n");
   write("You begin summoning the power of Losoth....\n");
   spell_being_cast = "Spider Legs";
   called_spell = "spider_legs";
   call_out("spider_legs",1,what);
   return 1;
}

/************************************************************************/
/************************************************************************/

void web_ladder(string what)
{
   string *quelad;
   string *crosslad;

   object webladder;
   this_player()->remove_hook("move_player");
   write("You cast Web Ladder...\n");
   say(TPN+ " mutters a strange phrase and gestures upward.\n");
   if ( NO_MAGIC )
   {
      write("The spell fails.\n");
      say("Nothing happens.\n");
      spell_being_cast = 0;
      return;
   }
   if ( quelad = (string *) env(TP)->query_ladder() )
   {
      if ( (what == "up") && (quelad[0] == "up") )
      {
         writef("Webbing shoots from your fingertips. It intertwines and "+
                "forms a ladder of webbing that hangs against the "
                +quelad[1]+ "!\n");
         sayf("Webbing shoots from " +TPN+ "'s fingertips. It intertwines and "+
              "forms a ladder of webbing that hangs against the " +quelad[1]+ "!\n");
         webladder = clone_object("w/mickie/spells/web_ladder");
         webladder->move(env(TP));
         webladder->initialize(quelad, tempspellpower);
         webladder->do_raise();
         spell_being_cast = 0;
         return;
      }
      if ( (what == "down") && (quelad[0] == "down") )
      {
         writef("Webbing shoots from your fingertips. It intertwines and "+
                "forms a ladder of webbing that hangs down the "
                +quelad[1]+ "!\n");
         sayf("Webbing shoots from " +TPN+ "'s fingertips. It intertwines and "+
              "forms a ladder of webbing that hangs down the " +quelad[1]+ "!\n");
         webladder = clone_object("w/mickie/spells/web_ladder");
         webladder->move(env(TP));
         webladder->initialize(quelad, tempspellpower);
         webladder->do_lower();
         spell_being_cast = 0;
         return;
      }
   }
   if ( crosslad = (string *) env(TP)->query_ladder_across() )
   {
      if ( what == "across" )
      {
         writef("Webbing shoots from your fingertips. It intertwines and "+
                "forms a ladder of webbing that stretches " +crosslad[1]+ "!\n");
         sayf("Webbing shoots from " +TPN+ "'s fingertips. It intertwines and "+
              "forms a ladder of webbing that stretches " +crosslad[1]+ "!\n");
         webladder = clone_object("w/mickie/spells/web_ladder");
         webladder->move(env(TP));
         webladder->initialize(crosslad, tempspellpower);
         webladder->do_place();
         spell_being_cast = 0;
         return;
      }
   }
   write("Nothing happens.\n");
   say(TPN+ " looks disappointed.\n");
   spell_being_cast = 0;
   return;
}

void expose_hidden(string what)
{
   this_player()->remove_hook("move_player");
   write("You place your palms together over your head "+
         "and mumble Expose Hidden.\n");
   say(TPN+ " places " +TPP+ " palms together over " +TPP+ " head "+
       "and mumbles an arcane spell.\n");
   if ( NO_MAGIC )
   {
      write("The spell fails.\n");
      say("Nothing happens.\n");
      spell_being_cast = 0;
   }
   else
   {
      object *ob;
      int z,i;
      ob=all_inventory(environment(this_player()));
      write("Glowing tendrils snake out from your hands in all directions.\n");
      say("Glowing tendrils snake out from " +TPN+ "'s hands in all directions.\n");

      for ( z=0,i=sizeof(ob);z<i;z++ )
         if ( ( ob[z] )->query_hidden() == 1 )
         {
            if ( ( ob[z] )->query_dex() < ((TP->query_dex()-2)+random(3+(2*tempspellpower))) )
            {
               write( capitalize(( ob[z] )->query_real_name())+ " is exposed by a "+
                      "glowing tendril!\n");
               say( capitalize(( ob[z] )->query_real_name())+ " is exposed by a "+
                    "glowing tendril!\n",
                    ( ob[z] ));
               tell_object((ob[z]),"A glowing tendril touches you "+
                           "and forces you out of hiding!\n");
               ( ob[z] )->silent_remove_from_hide();
            }
            else
            {
               tell_object((ob[z]),"A glowing tendril almost touches "+
                           "you but you dodge it agilely!\n");
            }
         }
      write("The glowing tendrils fade away.\n");
      say("The glowing tendrils fade away.\n"); 
      spell_being_cast = 0;
   }
}

void silk_pack(string what)
{
   object mypack;
   int pack_weight;
   this_player()->remove_hook("move_player");
   write("You cup your hands together and cast Silk Pack...\n");
   say(TPN+ " speaks an incantation and cups "+
       TPP+ " hands together.\n");
   if ( NO_MAGIC )
   {
      write("The spell fails.\n");
      say("Nothing happens.\n");
      spell_being_cast = 0;}
   else
   {
      mypack = clone_object("w/mickie/spells/silk_pack");
      mypack->set_spellpower(tempspellpower);
      writef("Silk webbing swirls between your hands and begins "+
             "taking the shape of a pack as you move your hands apart.\n");
      sayf("Silk webbing swirls between "+
           TPN+ "'s hands and begins to taking the shape of a pack "+
           "as " +TPP+ " hands move apart.\n");
      pack_weight=(mypack->query_weight());
      if ( this_player()->add_weight(pack_weight) )
      {
         mypack->move(TP);
         mypack->add_weight(pack_weight);
      }
      else
      {
         writef("You are carrying too much to hold the "+
                "pack.\nThe pack falls to the ground.\n");
         sayf(TPN+ " struggles to carry the "+
              "pack.\nThe pack falls to the ground.\n");
         mypack->move( environment( TP ) );
      }
      spell_being_cast = 0;
   }
}

void silk_armour(string what)
{
   object myarmour;
   this_player()->remove_hook("move_player");
   write("You stretch your arms out and cast Silk Armour...\n");
   say(TPN+ " stretches " +TPP+ " arms out and mumbles something.\n");
   if ( NO_MAGIC )
   {
      write("The spell fails.\n");
      say("Nothing happens.\n");
   }
   else
   {
      myarmour = clone_object("w/mickie/spells/silk_armour");
      myarmour->initialize(tempspellpower);
      myarmour->move(TP);
   }
   spell_being_cast = 0;
}

void spider_legs(string what)
{
   object mylegs;
   this_player()->remove_hook("move_player");
   write("You lift your arms straight up and cast Spider Legs...\n");
   say(TPN+ " lifts " +TPP+ " arms upwards and mumbles something.\n");
   if ( NO_MAGIC )
   {
      write("The spell fails.\n");
      say("Nothing happens.\n");
   }
   else
   {
      mylegs = clone_object("w/mickie/spells/spider_legs");
      mylegs->initialize(tempspellpower);
      mylegs->move(TP);
   }
   spell_being_cast = 0;
}


void spider_bite(string what)
{
   object spider;
   int tempint;
   tempint = INT(TP) + (INT(TP) / 2) + (tempspellpower * 7);
   this_player()->remove_hook("move_player");
   if ( !(tempob = get_living_but_us_AA(what)) )
   {
      writef("A glowing, giant spider appears but "+
             "vanishes after finding no attacker.\n");
      sayf("A glowing, giant spider appears and then vanishes.\n");
      spell_being_cast = 0;
      return;
   }
   writef("You hold your hand up, making a claw and cast "+
          "Spider Bite!\n");
   sayf(TPN+ " holds " +TPP+ " hand up, making a claw, and mutters "+
        "something.\n");
   if ( !(present(tempob,environment(TP))) )
   {
      writef("A glowing, giant spider appears but "+
             "vanishes after finding no attacker.\n");
      sayf("A glowing, giant spider appears and then vanishes.\n");
      spell_being_cast = 0;
      return;
   }
   if ( !random(((TP_I * 10) + 5) * (8 - tempspellpower)) )
   {
      writef("A glowing, giant spider appears before "+
             "you.\nThe spider seems confused and bites you.\n");
      sayf("A glowing, giant spider appears and bites "+
           TPN+ ".\n");
      if ( !TP->query_ghost() )
      {
         spider = clone_object("w/mickie/spells/spiderspell");
         spider->move(environment(TP));
         spider->attack_object(TP);
         spider->initialize(tempspellpower, what, spellaim);
         spider->set_level(((int)TP->query_level()+tempspellpower)-3);
         spider->set_ep(0);
         if ( present(TP->query_attack(), environment(TP)) )
            spider->set_attacker( TP );
      }
      spell_being_cast = 0;
      return;
   }
   else if ( NO_MAGIC )
   {
      write("The Spider Bite spell fails.\n");
      tell_object(tempob, TPN+ " attempts to cast a spell at you but nothing "+
                  "happens.\n");
      say(TPN+ " attempts to cast a spell at " +NAME(tempob)+ " but "+
          "nothing happens.\n", tempob);
      spell_being_cast = 0;
   }
   else
      if ( tempob->query_race() == "spider" )
   {
      writef("A glowing, giant spider appears before "+
             "you.\nThe giant spider becomes enraged and bites you instead!\n");
      sayf("An enraged, glowing, giant spider "+
           "appears and bites " +TPN+ ".\n");
      spider = clone_object("w/mickie/spells/spiderspell");
      spider->move(environment(TP));
      spider->attack_object(TP);
      spider->initialize(tempspellpower, what, spellaim);
      spider->set_level(((int)TP->query_level()+tempspellpower)-3);
      spider->set_ep(0);
      spider->set_attacker( TP );
      spell_being_cast = 0;
   }
   else if ( ANTIMAGIC(tempob) )
   {
      write("You cast Spider Bite at " +NAME(tempob)+ ", but it fails!\n");
      tell_object(tempob, get_f_string(TPN+ " casts a spell at you"+
                                       ", but it fails!\n"));
      sayf(TPN+ " casts a spell at " +NAME(tempob)+ ", but it fails!\n", tempob);
      spell_being_cast = 0;
   }
   else
   {
      if ( tempob )
      {
         randomize_aim(4, tempob);
         if ( present(tempob,environment(this_player())) )
         {
            writef("A glowing, giant spider appears and bites " +NAME(tempob)+
                   "'s " +limb_hit+ "!\n");
            tell_object(tempob, get_f_string("A glowing, giant spider appears "+
                                             "and bites your " +limb_hit+ ".\n"));
            sayf("A glowing, giant spider appears and bites " +NAME(tempob)+
                 "'s " +limb_hit+ "!\n", tempob);
         }
         else
         {
            writef("A glowing, giant spider appears!\n");
            sayf("A glowing, giant spider appears!\n");
         }
         TP->set_attacker(tempob);   
         spider = clone_object("w/mickie/spells/spiderspell");
/*         spider->move(environment(TP));   */
         spider->initialize(tempspellpower, what, spellaim);
         spider->set_level(((int)TP->query_level()+tempspellpower)-3);
         spider->set_ep(0);
         spider->move(environment(TP));
         spider->set_attacker( (TP->query_attack()) );
         spell_being_cast = 0;
      }
   }
   if ( tempob->query_is_player() )
   {
      log_file("PLAYER_KILLS",get_f_string(
                                          capitalize((string)this_player()->query_real_name())+" ("+
                                          this_player()->query_level()+
                                          ") cast Spider Bite at "+
                                          capitalize((string)tempob->query_real_name())+
                                          " ("+tempob->query_level()+") at "+
                                          extract(ctime(time()),4,15)));
   }
}

void web_mouth(string what)
{
   object mouth;
   mouth = clone_object("w/mickie/spells/web_mouth");
   this_player()->remove_hook("move_player");
   if ( !(tempob = get_living_but_us_AA(what)) )
   {
      spell_being_cast = 0;
      return;
   }
   write("You cast Web Mouth at " +NAME(tempob)+ "...\n");
   tell_object(tempob, get_f_string(TPN+ " points at your "+
                                    "mouth and mumbles something.\n"));
   say(TPN+ " points " +TPP+ " finger at " +NAME(tempob)+ "'s "+
       "mouth and mumbles something.\n",tempob);

   if ( NO_MAGIC || ANTIMAGIC(tempob) )
   {
      write("The spell fails.\n");
      say("Nothing happens.\n");
      spell_being_cast = 0;
   }
   else if ( LVL(tempob) >= TP_L )
   {
      write("They resist the spell!\n");
      say("Nothing happens.\n");
      spell_being_cast = 0;
   }
   else if ( !random(((TP_I * 10) + 5) * (8 - tempspellpower)) )
   {
      write("The spell goes awry!\n");
      say(TPN+ " attempts to cast a spell, but it goes awry!\n");
      if ( !(present("\nweb_mouth", TP)) )
      {
         writef("Webbing shoots from your fingertip, covering "+
                "your mouth!\n");
         tell_object(tempob, get_f_string("Webbing shoots from "+
                                          TPN+ "'s fingertip and covers " +TP->query_possessive()+
                                          " mouth!\n"));
         sayf("Webbing shoots from " +TPN+ "'s fingertip and "+
              "covers " +TP->query_possessive()+ " mouth!\n", tempob);
         mouth->initialize(tempspellpower);
         mouth->move(TP);
      }
      log_file((string) "/class/mage/log/webmouthed.log",
               "["+ctime(time())+"] " +this_player()->query_name()+
               "'s web mouth backfired.\n");
      spell_being_cast = 0;
      return;
   }
   else if ( random(130 - INT(TP)) > ((DEX(TP) + 20) - DEX(tempob)) * 5 )
   {
      writef("Webbing shoots from your fingertip but misses " 
             +NAME(tempob)+ "'s mouth!\n");
      tell_object(tempob, "Webbing shoots from " +TPN+ "'s fingertip "+
                  "narrowly missing your mouth!\n");
      sayf("Webbing shoots from " +TPN+ "'s fingertips, narrowly missing "+
           NAME(tempob)+ "'s mouth!\n", tempob);
      spell_being_cast = 0;
   }
   else
   {
      writef("Webbing shoots from your fingertip, covering "+
             NAME(tempob)+ "'s mouth!\n");
      tell_object(tempob, get_f_string("Webbing shoots from "+
                                       TPN+ "'s fingertip and covers your mouth!\n"));
      sayf("Webbing shoots from " +TPN+ "'s fingertip and covers "+
           NAME(tempob)+ "'s mouth!\n", tempob);
      mouth->initialize(tempspellpower);
      mouth->move(tempob);
      log_file((string) "/class/mage/log/webmouthed.log",
               "["+ctime(time())+"] " +this_player()->query_name()+
               " webmouthed " +NAME(tempob)+ ".\n");
      spell_being_cast = 0;
   }
}


void poison_shield(string what)
{
   object pshield;
   this_player()->remove_hook("move_player");
   write("You cast Poison Shield...\n");
   say(TPN+ " wraps " +TPP+ " arms around " +TPO+ "self and mutters something.\n");
   if ( tempob != TP )
   {
      write("You point at " +tempob->query_name()+ ".\n");
      tell_object(tempob, get_f_string(TPN+ " points at you!\n"));
      say(TPN+ " points at " +tempob->query_name()+ ".\n",(tempob));
   }
   if ( NO_MAGIC )
   {
      write("The spell fails.\n");
      say("Nothing happens.\n");
      spell_being_cast = 0;
   }
   else
   {
      pshield = clone_object("w/mickie/spells/poisonshield");
      pshield->initialize(tempspellpower);
      pshield->move(tempob);
      spell_being_cast = 0;
   }
}

void web_hands(string what)
{
   object webby;
   this_player()->remove_hook("move_player");
   write("You stare at your hands and cast Web Hands...\n");
   say(TPN+ " stares at " +TPP+ " hands and mumbles something.\n");
   if ( NO_MAGIC )
   {
      write("The spell fails.\n");
      say("Nothing happens.\n");
      spell_being_cast = 0;
   }
   else
   {
      webby = clone_object("w/mickie/spells/webhands");
      webby->initialize(tempspellpower);
      webby->move(TP);
      spell_being_cast = 0;
   }
}


void web_defender(string what)
{
   object myimage;
   string owner;
   owner = TPN;
   this_player()->remove_hook("move_player");
   write("You cast Web Defender...\n");
   say(TPN+ " mumbles something.\n");
   if ( NO_MAGIC )
   {
      write("The spell fails.\n");
      say("Nothing happens.\n");
      spell_being_cast = 0;
   }
   else
   {
      int imageloop;
      for ( imageloop=0;imageloop<(tempspellpower+1);imageloop++ )
      {
         myimage = clone_object("w/mickie/spells/web_image");
         write("You step to the side and an image of you is left behind.\n");
         say(TPN+ " takes a step to the side leaving an image behind.\n");
         myimage->set_level(1);
         myimage->set_int((int)TP->query_int()/2);
         myimage->set_ep(0);
         myimage->set_hp(75);
         myimage->initialize(tempspellpower, owner);
         myimage->move(environment(TP));
         if ( TP->query_attack() )
         {
            myimage->set_attacker( (TP->query_attack()) );
            (this_player()->query_attack())->attacked_by(myimage);
         }
      }  
      spell_being_cast = 0;
   }
}


void venom_spit(string what)
{
#ifdef VERSION_INCREASED_MORTAL_LEVEL
   tempint = TP_L + (tempspellpower * 7) + random(6 * TP_L / 4 + 2 * INT(TP) + 2*tempspellpower);
#else
   tempint = INT(TP) + (tempspellpower * 7) + random(TP_L + tempspellpower*2);
#endif
   this_player()->remove_hook("move_player");
   if ( !(tempob = get_living_but_us_AA(what)) )
   {
      write("Cast Venom Spit at what?\n");
      spell_being_cast = 0;
      return;
   }
   writef("You touch your hand to your throat and cast Venom Spit!\n");
   sayf(TPN+ " touches " +TPP+ " hand to " +TPP+ " throat and mutters something.\n");
   if ( !random(((TP_I * 10) + 5) * (8 - tempspellpower)) )
   {
      write("A black liquid that is tinted with green streaks starts spewing from "+
            "your mouth.\nYou lose your concentration and it runs down your body.\n");
      say("A black liquid that is tinted with green streaks spews from " +TPN+ 
          "'s mouth and runs down " +TPP+ " body.\n");
      if ( !TP->query_ghost() )
      {
         TP->add_exp(tempint = TP->special_hit(random(tempint / 2), spellaim, "poison"));
      }
      spell_being_cast = 0;
      return;
   }
   else if ( NO_MAGIC )
   {
      write("The Venom Spit spell fails.\n");
      tell_object(tempob, TPN+ " attempts to cast a spell at you but nothing "+
                  "happens.\n");
      say(TPN+ " attempts to cast a spell at " +NAME(tempob)+ " but "+
          "nothing happens.\n", tempob);
      spell_being_cast = 0;
   }
   else
   {
      string *messages;
      int power, subpower;
      power = tempint;
      if ( power > 59 ) subpower = 10;
      else if ( power > 55 ) subpower = 9;
      else if ( power > 50 ) subpower = 8;
      else if ( power > 45 ) subpower = 7;
      else if ( power > 40 ) subpower = 6;
      else if ( power > 35 ) subpower = 5;
      else if ( power > 30 ) subpower = 4;
      else if ( power > 25 ) subpower = 3;
      else if ( power > 20 ) subpower = 2;
      else if ( power < 21 ) subpower = 1;

      messages = ({ ({ "A tiny", "squirts", "yelp","stings some of"}),
                  ({ "A tiny", "squirts", "yelp","blisters some of"}),
                  ({ "A small", "flies", "shake","scalds some of"}),
                  ({ "A", "bursts", "whimper","creates a pus-filled wound on"}),
                  ({ "A dangerous", "sprays", "cringe","numbs and discolours some of"}),
                  ({ "A large","gushes", "shudder","sears and cracks some of"}),
                  ({ "A lethal", "spews", "stumble","poisons and kills a large spot of"}),
                  ({ "A powerful", "explodes", "stagger","deadens much of"}),
                  ({ "A deadly", "streaks", "nearly fall","raises many oozing boils on"}),
                  ({ "A roiling", "erupts", "scream","creates numerous wounds that ooze pus on"}),
                  ({"A tremendous","thunders", "nearly faint","eats its way into"})})
                 [subpower];
      write("Glistening black mandibles protrude from your mouth!\n");
      say("Glistening black mandibles protrude from " +TPN+ "'s mouth.\n");

      if ( !tempob )
      {
         tell_object(TP, get_f_string(
                                     messages[0]+ " stream of black and green venom " +messages[1]+ 
                                     " from your mouth onto the ground!\n"));
         tell_room(env(TP),
                   get_f_string(messages[0]+ " stream of black and green venom " +messages[1]+ 
                                " from " +TPN+ "'s mouth onto the ground!\n"),({TP}));
         spell_being_cast = 0;
         return;
      }
      if ( ANTIMAGIC(tempob) )
      {
         tell_object(TP, get_f_string(
                                     messages[0]+ " stream of black and green venom " +messages[1]+ 
                                     " from your mouth towards " +NAME(tempob)+ " but vanishes!\n"));
         tell_object(tempob, get_f_string(messages[0]+ " stream of black and green venom "
                                          +messages[1]+ " from " +TPN+ "'s mouth towards you, but vanishes!\n"));
         tell_room(env(TP), get_f_string(messages[0]+ " stream of black and green venom "
                                         +messages[1]+ " from " +TPN+ "'s mouth towards " +NAME(tempob)+ 
                                         ", but vanishes!\n"), ({ tempob,TP}) );
         spell_being_cast = 0;
      }
      else if ( random(120 - INT(TP)) > ((DEX(TP) + 20) - DEX(tempob)) * 5 )
      {
         tell_object(TP, get_f_string(
                                     messages[0]+ " stream of black and green venom " +messages[1]+ 
                                     " from your mouth towards " +NAME(tempob)+ " but misses!\n"));
         tell_object(tempob, get_f_string(messages[0]+ " stream of black and green venom "
                                          +messages[1]+ " from " +TPN+ "'s mouth towards you, but misses!\n"));
         tell_room(env(TP), get_f_string(messages[0]+ " stream of black and green venom "
                                         +messages[1]+ " from " +TPN+ "'s mouth towards " +NAME(tempob)+ 
                                         ", but misses!\n"), ({ tempob,TP}) );
         spell_being_cast = 0;
      }
      else
      {
         if ( tempob && !tempob->query_ghost() )
         {

            tell_object(TP, get_f_string(
                                        messages[0]+ " stream of black and green venom " +messages[1]+ 
                                        " from your mouth and covers " +NAME(tempob)+ ".\n" +NAME(tempob)+
                                        " " +messages[2]+ "s as the venom " +messages[3]+
                                        " " +tempob->query_possessive()+ " flesh!\n"));

            tell_object(tempob, get_f_string(messages[0]+ " stream of black and green venom "
                                             +messages[1]+ " from " +TPN+ "'s mouth and covers you.\nYou " +messages[2]+ 
                                             " as the venom " +messages[3]+ " your flesh!\n"));

            tell_room(env(TP), get_f_string(messages[0]+ " stream of black and green venom "
                                            +messages[1]+ " from " +TPN+ "'s mouth and covers " +NAME(tempob)+ 
                                            ".\n" +NAME(tempob)+ " " +messages[2]+ "s as the venom " +messages[3]+ 
                                            " " +tempob->query_possessive()+ " flesh!\n"),({ tempob,TP}));
            tempint = tempob->special_hit(tempint, spellaim,"poison");
            TP->add_exp(tempint * 2);
            if ( tempob ) TP->set_attacker(tempob);
            if ( tempob && tempob->query_is_player() )
            {
               log_file("PLAYER_KILLS",
                        get_f_string(capitalize((string)this_player()->query_real_name())+
                                     " (" +this_player()->query_level()+ ") cast Venom Spit at "+
                                     capitalize((string)tempob->query_real_name())+
                                     " ("+tempob->query_level()+") at " +extract(ctime(time()),4,15)));}
            spell_being_cast = 0;
         }
      }
      spell_being_cast = 0;
   }
   spell_being_cast = 0;
}

void web_shield(string what)
{
   this_player()->remove_hook("move_player");
   write("You stretch your arms out and cast Web Shield...\n");
   say(TPN+ " stretches " +TPP+ " arms out and mumbles something.\n");
   if ( NO_MAGIC )
   {
      write("The spell fails.\n");
      say("Nothing happens.\n");}
   else
   {
      tempob = clone_object("w/mickie/spells/web_shield");
      tempob->initialize(tempspellpower);
      tempob->move(TP);
   }
   spell_being_cast = 0;
}

void web_wall(string what)
{
   object thewall;
   string owner;
   write("You cast Web Wall...\n");
   say(TPN+ " mumbles something and points " +what+ ".\n");
   if ( present("\nweb_wall", environment(TP)) )
   {
      tell_object(TP, get_f_string("The magic of the Web Wall spell that is already "+
                                   "here causes your spell to go awry."));
      spell_being_cast = 0;
      return;
   }
   thewall = clone_object("w/mickie/spells/webwall");
   thewall->move(environment(TP));
   owner = TPN;
   this_player()->remove_hook("move_player");
   write("A wall of webbing appears.\n");
   say("A wall of webbing appears.\n");
   thewall->set_level((int)TP->query_level()/2);
   thewall->set_int((int)TP->query_int()/2);
   thewall->set_ep(0);
   thewall->set_hp(500);
   thewall->initialize(tempspellpower, owner,what);
   spell_being_cast = 0;
}


void check_for_medal(string check_spell, int normal_cost)
{
   object drowmedal,spidey;
   spidey=(present("spidermedallion",this_player()));
   drowmedal=(present("\nreg_medallion",this_player()));
   drowbonus=0;
   if ( spidey )
     if ( spidey->query_worn() )
       {
        if ( explode(file_name(spidey),"#")[0]=="/w/devlin/elves/obj/med" ) 
          {
            if ( member_array(check_spell,({"sl","sp","ww","ps"})) > -1 )
               {
                 drowbonus=(normal_cost*120)/1000; 
                 return;
               }
            else
               {
                 drowbonus=(normal_cost*110)/1000;
                 return;
               }
          }
       }
   if ( drowmedal )
      if ( drowmedal->query_worn() )
        {
              if ( member_array(check_spell,({"sl","sp","ww","ps"})) > -1 )
                 {
                   drowbonus=(70*normal_cost)/1000;
                   return;
                 }
              else
                 {
                   drowbonus=(50*normal_cost)/1000;
                   return;
                 }
        }  
    drowbonus=0;
    return;
}

#include "/w/maker/class/mage/silk_weave/silk_weave.h"

/**EOF*******************************************************************/