nightmare3_fluffos_v2/
nightmare3_fluffos_v2/bin/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/ChangeLog.old/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/Win32/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/compat/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/compat/simuls/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/include/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/clone/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/command/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/data/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/etc/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/include/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/inherit/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/inherit/master/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/log/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/tests/compiler/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/tests/efuns/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/tests/operators/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/u/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/tmp/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/windows/
nightmare3_fluffos_v2/lib/cmds/ambassador/
nightmare3_fluffos_v2/lib/cmds/database/
nightmare3_fluffos_v2/lib/cmds/hm/
nightmare3_fluffos_v2/lib/cmds/soul/
nightmare3_fluffos_v2/lib/daemon/cfg/
nightmare3_fluffos_v2/lib/daemon/cfg/mon_races/
nightmare3_fluffos_v2/lib/daemon/cfg/races/
nightmare3_fluffos_v2/lib/daemon/include/
nightmare3_fluffos_v2/lib/daemon/save/
nightmare3_fluffos_v2/lib/daemon/services/
nightmare3_fluffos_v2/lib/daemon/soul/
nightmare3_fluffos_v2/lib/doc/
nightmare3_fluffos_v2/lib/doc/TestPlans/
nightmare3_fluffos_v2/lib/doc/approval/
nightmare3_fluffos_v2/lib/doc/approval/QC/
nightmare3_fluffos_v2/lib/doc/approval/balance/
nightmare3_fluffos_v2/lib/doc/build/
nightmare3_fluffos_v2/lib/doc/build/armours/
nightmare3_fluffos_v2/lib/doc/build/economy/
nightmare3_fluffos_v2/lib/doc/build/etc/
nightmare3_fluffos_v2/lib/doc/build/monster/
nightmare3_fluffos_v2/lib/doc/build/room/
nightmare3_fluffos_v2/lib/doc/build/virtual/
nightmare3_fluffos_v2/lib/doc/build/weapon/
nightmare3_fluffos_v2/lib/doc/classes/
nightmare3_fluffos_v2/lib/doc/efun/
nightmare3_fluffos_v2/lib/doc/etc/
nightmare3_fluffos_v2/lib/doc/help/creator/
nightmare3_fluffos_v2/lib/doc/help/hm/
nightmare3_fluffos_v2/lib/doc/law/
nightmare3_fluffos_v2/lib/doc/lpc/basic/
nightmare3_fluffos_v2/lib/doc/lpc/data_types/
nightmare3_fluffos_v2/lib/doc/lpc/etc/
nightmare3_fluffos_v2/lib/doc/lpc/intermediate/
nightmare3_fluffos_v2/lib/doc/lpc/types/
nightmare3_fluffos_v2/lib/doc/mudlib/
nightmare3_fluffos_v2/lib/doc/mudlib/features/
nightmare3_fluffos_v2/lib/domains/Examples/etc/
nightmare3_fluffos_v2/lib/domains/Examples/room/
nightmare3_fluffos_v2/lib/domains/Examples/virtual/
nightmare3_fluffos_v2/lib/domains/Examples/virtual/exaA/
nightmare3_fluffos_v2/lib/domains/Examples/virtual/exaB/
nightmare3_fluffos_v2/lib/domains/Examples/weapon/
nightmare3_fluffos_v2/lib/domains/Praxis/
nightmare3_fluffos_v2/lib/domains/Praxis/adm/
nightmare3_fluffos_v2/lib/domains/Praxis/attic/
nightmare3_fluffos_v2/lib/domains/Praxis/cemetary/
nightmare3_fluffos_v2/lib/domains/Praxis/cemetary/mon/
nightmare3_fluffos_v2/lib/domains/Praxis/data/
nightmare3_fluffos_v2/lib/domains/Praxis/death/
nightmare3_fluffos_v2/lib/domains/Praxis/mountains/
nightmare3_fluffos_v2/lib/domains/Praxis/obj/armour/
nightmare3_fluffos_v2/lib/domains/Praxis/obj/magic/
nightmare3_fluffos_v2/lib/domains/Praxis/obj/weapon/
nightmare3_fluffos_v2/lib/domains/Praxis/orc_valley/
nightmare3_fluffos_v2/lib/domains/Praxis/quests/
nightmare3_fluffos_v2/lib/domains/Praxis/standardOld/
nightmare3_fluffos_v2/lib/include/
nightmare3_fluffos_v2/lib/log/
nightmare3_fluffos_v2/lib/log/errors/
nightmare3_fluffos_v2/lib/log/reports/
nightmare3_fluffos_v2/lib/log/watch/
nightmare3_fluffos_v2/lib/news/
nightmare3_fluffos_v2/lib/secure/cfg/
nightmare3_fluffos_v2/lib/secure/cmds/ambassador/
nightmare3_fluffos_v2/lib/secure/cmds/mortal/
nightmare3_fluffos_v2/lib/secure/save/users/d/
nightmare3_fluffos_v2/lib/secure/std/
nightmare3_fluffos_v2/lib/std/hm/
nightmare3_fluffos_v2/lib/std/living/
nightmare3_fluffos_v2/lib/std/room/
nightmare3_fluffos_v2/lib/std/user/
nightmare3_fluffos_v2/lib/std/virtual/
nightmare3_fluffos_v2/lib/www/
nightmare3_fluffos_v2/lib/www/errors/
nightmare3_fluffos_v2/lib/www/gateways/
nightmare3_fluffos_v2/win32/
/* _backstab.c
 * /cmds/skills
 * originally coded by ? on ?
 * modified by Bohemund on 9 March 1994
 * rewriten by Gregon@Nightmare June 1994 
 *   in accordance with law and approval requests: 
 *     only one attack
 *     socket available for items to attenuate backstab strength
 *     minor bugs eliminated
 *     can now aim for a limb and all damage is taken off some limb
 */
 
#include <std.h>
#define XX "%^BOLD%^RED%^"
 
inherit DAEMON;
 
int cmd_backstab(string str) {
  string who, limb, vicname, bsname, *limbs, hitlimb,knifname;
  object *weapons, *knives, victim, here, tmp_ob, *tmp_obs;
  int i, damage, tmp, murder, dex, vicdex, prot;
  
  if(!str) {
    notify_fail("Correct syntax: backstab victim [limb]\n");
    return 0;
  }
  if(this_player()->query_ghost()) {
    notify_fail("You cannot do that in your present immaterial state.\n");
    return 0;
  }
  if(this_player()->query_disabled()) return 1;
  if(environment(this_player())->query_property("no attack")) {
    notify_fail("You may not attack in this place.\n");
    return 0;
  }
  if(murder=(int)this_player()->query_skill("murder") < 5) {
    notify_fail("You aren't skilled enough to do that.\n");
    return 0;
  }
  if(sscanf(str,"%s %s",who,limb)!=2) {
    who=str;
    limb=0;
  }
 
  if(!(victim = present(lower_case(who),here=environment(this_player())))) {
    notify_fail("You don't see that target here.\n");
    return 0;
  }
  if(victim == this_player()) {
    notify_fail("Backstab yourself?\n");
    return 0;
  }
  if(victim->query_ghost()) {
    notify_fail("Backstab a ghost?\n");
    return 0;
  }
  if(!living(victim)){ 
    notify_fail("You would look pretty silly backstabbing that.\n");
    return 0;
  }
 
  vicname=victim->query_cap_name();
  if(limb && member_array(limb,limbs=(string *)victim->query_limbs()) == -1) {
    notify_fail(vicname+" does not have a "+limb+".\n");
    return 0;
  }
 
  if(victim->query_property("no backstab")) {
    notify_fail(vicname+" is immune to your backstab.");
    return 0;
  }
 
  knives = ({});
  weapons = (object *)this_player()->query_wielded();
 
  for(i=0, tmp = sizeof(weapons); i<tmp; i++) {
    if((string)weapons[i]->query_type() != "knife") continue;
    knives += ({ weapons[i] });
  }
  if(!sizeof(knives)) {
    write("You are not well equipped for backstabbing.");
    return 1;
  }
  this_player()->set_disabled();
  if(member_array(victim, (object *)this_player()->query_hunted()) != -1 ||
     member_array(victim, (object *)this_player()->query_attackers())!=-1) {
    notify_fail("You have lost the element of surprise!\n");
    return 0;
  }
  if(tmp_ob = (object)this_player()->query_current_attacker()) {
    notify_fail(sprintf("You are already in combat with %s.",
      (string)tmp_ob->query_cap_name()));
    return 0;}
 
  if(victim->is_player() && !interactive(victim)) return 0;
 
  if(!this_player()->kill_ob(victim, 0)) return 1; 
 
  bsname=(string)this_player()->query_cap_name();
  if((int)this_player()->query_stats("dexterity") + 5 < 
                              (int)victim->query_stats("dexterity")){
    message("my action", XX+vicname+" sees your attempted backstab and "
            "evades it!%^RESET%^", this_player());
    message("other action",XX+bsname+
            " just tried to backstab you!  Luckily, you are too fast for "+
            this_player()->query_objective()+".", victim);
    if(!victim->is_player()) victim->kill_ob(this_player(),0);
    return 1;
  }
 
  message("my_action",XX+"You backstab "+vicname+"!",this_player());
  tell_room(here,XX+bsname+" backstabs "+vicname+"!", 
	    ({ victim, this_player() }) );
  message("other action",XX+bsname+" backstabs you!",victim);
 
//in an item set_property("no backstab", x) will cause the damage done by the
//backstab to be reduced by x percent
  for(i=0;i<sizeof(tmp_obs=all_inventory(victim));i++) {
    if(tmp=tmp_obs[i]->query_property("no backstab") && tmp > prot) tmp=prot;
  }
 
  damage = murder;
  damage += (int)this_player()->query_sp()/5;
  damage -= vicdex=(int)victim->query_stats("dexterity");
  damage += dex=(int)this_player()->query_stats("dexterity");
  damage += (int)this_player()->query_skill("knife");
  this_player()->add_skill_points("murder",5);
  
    this_player()->set_backstab(sizeof(knives));
  for(i=0; i<sizeof(knives); i++) {
   if(limb && random(100) < (murder-vicdex) ) hitlimb=limb;
   else hitlimb=(string)victim->return_target_limb();
   knifname=(string)knives[i]->query_short();
 
   if(random(110)>((int)this_player()->mobility(0)+35+dex)) {
//almost the same way hits are determined in the game, with a slight bonus
//since have element of surprise
     message("other_combat",XX+capitalize(knifname)+" barely misses your "+
              hitlimb+".",victim);
     message("my_combat", XX+"You miss "+ vicname+"'s "+hitlimb+" by inches.",
             this_player());
     tell_room(here,bsname+" barely misses "+vicname+"'s "+hitlimb+".",
               ({victim,this_player()}) );
   }
   else {
     message("other_combat",XX+capitalize(knifname)+" tears into your "+
             hitlimb+"!",victim);
     message("my_combat",XX+"You slash into "+vicname+"'s "+hitlimb+" with "+
             knifname+"!",this_player());
     tell_room(here,bsname+" slashes "+vicname+"'s "+hitlimb+" with "+knifname+
               "!",({this_player(),victim}) );
//damage tally done here and exacted with a socket for devices or monsters 
//which can attenuate the damage
 
     damage = damage/2 +random(damage/2);
     damage -= victim->query_current_protection(hitlimb);
     if(prot) damage-=damage/prot;   
     victim->do_damage(hitlimb,damage);
      victim->check_on_limb(hitlimb);
    
   }
  }
  this_player()->add_alignment(-5);
  return 1;
}
 
void help() {
  write("Syntax: backstab <enemy> [limb]\n\n"
	"This command is used to initiate combat with the "
	"monster or player you specify. Optionally, you can add a limb "
        "to aim for on the victim.\n");
}