rslash.c

./lib/players/deathurg/private/thief/rslash.c · 1.8 KB

From the archive h7v3.0a.tar.gz

Download the archive   « Back to the archive contents

/* back stab */

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

status rslash(string str) {
  object obj, primary, weapon;
  string type;
  int your_dex;
  int dam;
int my_dex;
  
  if(!str) {
    notify_fail("Slash who?\n");
    return 0;
  }

  obj = present(lower_case(str), environment(this_player()));
  if(!obj) {
    notify_fail(capitalize(str)+" isn't here to slash!\n");
    return 0;
  }
  if(!living(obj)) {
    write("Well, it doesn't move. It hardly knows you are here.\n");
    return 1;
  }
  your_dex = (int)obj->query_dexterity();

your_dex=your_dex/2;
  /* To successfully roll...must beat their dexterity */
  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>

Site Stats

Snippets: 1791
Codebases: 571