/
lib/banish/
lib/d/
lib/doc/
lib/doc/domains/
lib/doc/efun/
lib/doc/examples/
lib/doc/examples/armour/
lib/doc/examples/contain/
lib/doc/examples/food/
lib/doc/examples/magic/
lib/doc/examples/monster/
lib/doc/examples/room/
lib/doc/examples/weapons/
lib/function/
lib/include/
lib/include/fn_specs/
lib/include/skills/
lib/info/
lib/inherit/base/
lib/log/
lib/manuals/312/
lib/news/
lib/obj/party/
lib/objects/components/
lib/open/
lib/open/library/
lib/open/party/
lib/players/
lib/players/zilanthius/
lib/room/
lib/room/city/arena/
lib/room/city/creator/
lib/room/city/garden/monst/
lib/room/city/obj/
lib/room/city/shop/
lib/room/death/
lib/room/registry/
lib/secure/
lib/secure/UDP_CMD_DIR/
lib/skills/
lib/skills/fighter/
lib/skills/thief/
lib/usr/
lib/usr/creators/
lib/usr/players/
/* potion */

inherit "inherit/drink";
inherit "inherit/wand";

string spell;

string query_spell();
status set_spell(string s);

void reset(status arg) {
  if(arg) return;
  set_name("potion");
  set_short("Potion");
  set_info("@@query_potion_string:$this_object()$@@");
  set_spell("cure wounds"); /* default potion */
  set_weight(1);
  set_room_msg("@@query_name:$this_player()$@@ quaffs a potion.\n");
}

string query_object_type() { return "Potion"; }

string query_spell()       { return spell; }

status set_spell(string s) { 
  string *loading_spell;
  int i;

  if(!s) return 0;
  loading_spell = (mixed *)clone_object("obj/shadows/get_spell")->get_spell(s);  
  if(member_array("passive", loading_spell) == -1) return 0;
  if((i = member_array("level", loading_spell)) != -1) {
    set_cast_level(loading_spell[i+1]);
    set_charges(100);
    spell = s;
    set_casting_msg("You quaff a @@query_name:$this_object()$@@ of "+
                    spell +".\n");
    set_spells(({ "drink", spell,
                  "quaff", spell,
    }));  /* activation 'words' have to be query_verb() to add_action() */
    return 1;
  }
  return 0;
}

void add_spell(mixed arg) {
  if(!arg) return;
  if(stringp(arg)) arg = ({ arg, });
  set_spell(arg[0]);
}

status drink(string str) {
  if(!::drink(str)) return 0;
  if(spell && query_charges()) load_spell(0);
  return 1;
}

void end_spell() {
  charges = 0;
}
 
string query_potion_string() {
  if(query_full() && spell) {
    return "It is a Potion of "+ capitalize(spell) +".\n";
  }
  else {
    return "You find nothing special.\n";
  }
}