/
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/
/* back stab */

#define <mudlib.h>
#define NAME      (string)this_player()->query_name()

status backstab(string str) {
  object obj, primary, weapon;
  string type;
  int your_dex;
  int dam;
  int my_backstab;

  
  if(!str) {
    notify_fail("backstab who?\n");
    return 0;
  }

  obj = present(lower_case(str), environment(this_player()));
  if(!obj) {
    notify_fail(capitalize(str)+" isn't here to backstab!\n");
    return 0;
  }
#ifndef PLAYER_KILL
  if(!obj->query_npc() && !this_player()->query_npc()) {
    write("You cannot backstab an unsuspecting player!\n");
    return 1;
  }
#endif
  if(!living(obj)) {
    write("Well, it doesn't move. It hardly knows you are here.\n");
    return 1;
  }
  if((primary = (object)this_player()->query_primary_attack())) {
    if(present(primary, environment(this_player()))) {
      write("You can't backstab someone while fighting!\n");
      return 1;
    }
  }
  if(!this_player()->query_stealth_on()) {
    write("You must sneak up on your victim before you can backstab them!\n");
    return 1;
  }
  your_dex = (int)obj->query_intelligence();
  /* for surprising them...must beat their intelligence */
  my_backstab = (int)this_player()->query_backstab();
  if(random(your_dex) <= random(my_backstab)){
    write("You sneak up on "+ obj->short() +"...\n");
    write("You surprise "+ obj->short() +"!!\n");
    say(NAME +" sneaks up on "+ obj->short() +"...\n");
    say(NAME +" surprises "+ obj->short() +"!!\n");
    dam = random(my_backstab) + (int)this_player()->query_wc();
    dam = dam * ((int)this_player()->query_backstab()/5 + 1);
   (int)obj->hit_player(dam);
    weapon = (object)this_player()->query_right_weapon();
    if(weapon) type = (string)weapon->query_type();
    this_player()->attack_msg(dam,type,obj,"right");
  }
  else {
    write("You sneak up on "+ obj -> short() +"...\n");
    write(obj->short() +" sees you coming, and dodges the attack!\n");
    tell_object(obj,"You see "+ this_player()->query_name() 
                    +" sneaking up on you.\n");
    say("You see "+ this_player()->query_name()
        +" sneaking up on "+ obj->query_name() +".\n", obj);
    this_player()->add_secondary_attacker(obj); /* get ready to attack */
    this_player()->set_primary_attack(obj);     /* make sure focus of attack */
    this_player()->attack();                    /* attack */
  }
  return 1;
}

/* Native Mode Move */

#include <move.h>