/
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/
inherit "inherit/monster";

#define NAME        (string)this_player()->query_name()
#define MY_STAT     17
#define YOUR_STAT   (int)this_player()->query_charisma()
#define ROOM_MOD    200

static int counter, i;
reset(arg) {
  ::reset(arg);
  "/room/city/pub/inn2" -> reset();
  "/room/city/pub/inn3" -> reset();
  "/room/city/pub/inn4" -> reset();
  "/room/city/pub/inn5" -> reset();
  if(arg) return;
  counter = 0;

  set_name("samantha");
  set_short("Samantha, the Grandmaster Thief");
  set_long(
	"Her short brown hair and dark seductive eyes and smile makes \n"+
	"her renowned across the city as a man killer. No one can resist \n"+
	"this woman, no one dares to. No living man has ever known to   \n"+
	"say no to her.\n");
  set_level(19);
  set_gender(2);
  set_race("human");

  set_chance(50);
  set_spell_dam(50 + random(100));
  set_spell_mess1("Samantha kicks you in the head!");
  set_spell_mess2("Samantha kicks 0 in the head!");

  set_hp(2100);
  set_wc(30);
  set_ac(15);

  load_spells(10, ({ "miss", "acd", "lb", "fb", "fs", "bbb" }));
  load_chat(7, ({ "Samantha asks: Would you like to spend the night here?\n",
	"Samantha looks you up and down with careful eyes.\n",
        "Samantha smiles at you seductively\n",
	"Samantha says: The rooms are up stairs, and are quite cheap.\n"
  }));
  load_a_chat(5, ({ "Samantha says: You shouldn't tangle with me.\n",
	"Samantha says: I wouldn't do that if I were you.\n",
	"Samantha asks: Feel like a bit of sport, hmm..?\n",
	"Samantha says: I'm stronger than you think.\n",
	"Samantha tumbles away from your blow.\n",
	"Samantha kicks you hard.\n",
	"Samantha punches you in the face.\n"
  }));


    move_object(clone_object("room/city/pub/key"),this_object());
    move_object(clone_object("room/city/pub/key"),this_object());
    move_object(clone_object("room/city/pub/key"),this_object());
    move_object(clone_object("room/city/pub/key"),this_object());
}

catch_tell(string str) {
  string tmp1, tmp2;

  if(sscanf(str, "%s says: rent %s", tmp1, tmp2) ||
     sscanf(str, "%s says: room %s", tmp1, tmp2))
     rent_room();
}

rent_room() {
  object key, door;
  int cost;

  if(!present("key", this_object())) {
    tell_room(environment(), "Samantha says: Sorry "+ NAME +", but I don't "+
    "have any rooms left to rent.\n");
    return 1;
  }
  if(present("key", this_player())) {
    key = present("key", this_player());
    if(!counter) {
      if(key -> id(NAME)) {
        tell_room(environment(), "Samantha says: You've stolen one of "+
	"my keys!\n"+
	"Samantha snatches the key away!\n");
	destruct(key);
	return 1;
      }
    }
    if(environment() -> query_players(NAME)) {
	tell_room(environment(), "Samantha says: But "+NAME+", you already "+
	"have rented a room.\n");
        return 1;
    }
  }
  tell_object(this_player(), "Samantha haggles with you over the price of "+
  "a room.\n");

  cost = room_cost();
  if(random(MY_STAT) > random(YOUR_STAT))
    cost += random(cost) /4;
  else
    cost -= random(cost) /3;

  if(this_player()->query_money() < cost) {
    tell_room(environment(), "Samantha says: But you don't have "+
    cost +" copper coins for the room!\n");
    return 1;
  }
  tell_object(this_player(), "Samantha takes "+ cost +" copper coins for "+
  "the room.\n");
  this_player()->add_money(-cost);

  key = present("key", this_object());
  if(!this_player()->add_weight(1)) {
    tell_room(environment(), "Samantha says: You cannot carry this key, "+
    NAME +", so I will just leave it here.\nSamantha drops a key.\n");
    move_object(key, environment(this_object()));
  }
  else {
    tell_object(this_player(), "Samantha gives you a key.\n");
    say("Samantha gives "+NAME+" a key.\n",this_player());
    move_object(key, this_player());
  }
  tell_object(this_player(), "You write your name in the inn's register.\n");
  say(NAME +" writes "+this_player()->query_possessive() +" name "+
  "in the inn's register.\n",this_player());

  key -> set_key_id(NAME);
  key -> set_number(counter + 1);
  make_doors(NAME, this_player());
  environment()->add_players(NAME);
  return 1;
}

  

room_cost() {
  return ROOM_MOD * (int)this_player()->query_level();
}

make_doors(string str, object obj) {
  object obj_1, obj_2;
  string tmp1, tmp2;
  string loc_1, loc_2;
  object obj1, obj2;
  if(!str) return;
   loc_1 = "/room/city/pub/inn"+ (counter+2);
   loc_2 = "/room/city/pub/inn"+ (10 - counter);
   if(sscanf(loc_1, "%s0%s", tmp1, tmp2))
     loc_1 = tmp1 + tmp2;
   obj1 = find_object(loc_1);
   obj2 = find_object(loc_2);
   obj1 -> reset();
   obj2 -> reset();
   obj1 -> set_door_attribute("west door", "key id", str);
   obj1 -> set_door_attribute("west door", "lock difficulty", 
				(int)this_player()->query_level());
   obj2 -> set_door_attribute("east door", "key id", str);

   counter ++;
   
    
 
 
} 

init() {
  ::init();
  check();
}

check() {
  object obj;
  if(!counter) {
    if(present("key", this_player())) {
      obj = all_inventory(this_player());
      for(i=0; i<sizeof(obj); i++) {
         if(obj[i] -> id("skandles downfall")) {
            tell_room(environment(), "Samantha says: Hey "+ NAME +", "+
            "how did you get that!\n");
            say("Samantha snatches the key away from "+NAME+".\n",this_player());
            tell_object(this_player(), "Samantha snatches the key away "+
             "from you!\n");
            destruct(obj[i]);
        }
      }
    }
  }
}