Crossfire Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CF: stealing more than once




       This is patch to make it possible to steal from a 
        creature more than once, if you are unseen by it.

        It still becomes progressively unlikely that you 
        can keep on stealing, as the creatures wis score
        (and thus its apbility to detect you) is raised
        with each attempt.

					-b.t.

*** skills.c.orig	Tue Sep 30 07:20:05 1997
--- skills.c	Tue Sep 30 08:06:03 1997
***************
*** 1,16 ****
  
  /* Initial coding: 6 Sep 1994, Nick Williams (njw@cs.city.ac.uk) */
   
  /* Generalized code + added hiding and lockpicking skills, */
! /* March 3, 1995, brian thomas (thomas@nomad.astro.psu.edu) */
  
  /* Added more skills, fixed bug in stealing code */
! /* April 21, 1995, brian thomas (thomas@nomad.astro.psu.edu) */
   
  /* Added more skills, fixed bugs, see skills.h */
! /* May/June, 1995, brian thomas (thomas@nomad.astro.psu.edu) */
  
  /* July 95 Code re-vamped. Now we add the experience objects, all
   * player activities which gain experience will bbe through the use
   * of skillls. Thus, I added hand_weapons, missile_weapons, and 
   * remove_traps skills -b.t. 
--- 1,16 ----
  
  /* Initial coding: 6 Sep 1994, Nick Williams (njw@cs.city.ac.uk) */
   
  /* Generalized code + added hiding and lockpicking skills, */
! /* March 3, 1995, brian thomas (thomas@astro.psu.edu) */
  
  /* Added more skills, fixed bug in stealing code */
! /* April 21, 1995, brian thomas (thomas@astro.psu.edu) */
   
  /* Added more skills, fixed bugs, see skills.h */
! /* May/June, 1995, brian thomas (thomas@astro.psu.edu) */
  
  /* July 95 Code re-vamped. Now we add the experience objects, all
   * player activities which gain experience will bbe through the use
   * of skillls. Thus, I added hand_weapons, missile_weapons, and 
   * remove_traps skills -b.t. 
***************
*** 34,43 ****
--- 34,50 ----
  /* Sept 96 - changed parsing of params through use_skill command, also
   * added in throw skill -b.t. */
  
  /* Oct 96 - altered hiding and stealing code for playbalance. -b.t. */
  
+ /* Sept 97 - yet another alteration to the stealing code. Lets allow
+  * multiple stealing, after having alerted the victim. But only subsequent
+  * steals made while we are unseen (in dark, invisible, hidden) will have
+  * any chance of success. Also, on each subsequent attempt, we raise the
+  * wisdom of the npc a bit, which makes it ultimately possible for the
+  * npc to detect the theif, regardless of the situation. -b.t. */
+ 
  #include <global.h>
  #include <object.h>
  #ifndef __CEXTRACT__
  #include <sproto.h>
  #endif
***************
*** 57,67 ****
  {
    object *success=NULL, *tmp=NULL, *next;
    int roll=0, chance=0, stats_value = get_weighted_skill_stats(who)*3;
    int victim_lvl=op->level*3, thief_lvl = SK_level(who)*10;
  
!   /* Go thru their inventory, stealing */
    for(tmp = op->inv; tmp != NULL; tmp = next) {
      next = tmp->below;
  
      /* you can't steal worn items, starting items, wiz stuff, 
       * innate abilities, or items w/o a type. Generally 
--- 64,86 ----
  {
    object *success=NULL, *tmp=NULL, *next;
    int roll=0, chance=0, stats_value = get_weighted_skill_stats(who)*3;
    int victim_lvl=op->level*3, thief_lvl = SK_level(who)*10;
  
!   /* if the victim is aware of a thief in the area (FLAG_NO_STEAL set on them)
!    * they will try to prevent stealing if they can. Only unseen theives will
!    * have much chance of success. */
!   if(op->type!=PLAYER && QUERY_FLAG(op,FLAG_NO_STEAL)) 
!     if(can_detect_enemy(op,who)) {
!       npc_call_help(op);
!       CLEAR_FLAG(op, FLAG_UNAGGRESSIVE);
!       new_draw_info(NDI_UNIQUE, 0,who,"Your attempt is prevented!");
!       return 0;
!     } else /* help npc to detect thief next time by raising its wisdom */ 
!       op->stats.Wis += (op->stats.Int/5)+1;
! 
!   /* Ok then, go thru their inventory, stealing */
    for(tmp = op->inv; tmp != NULL; tmp = next) {
      next = tmp->below;
  
      /* you can't steal worn items, starting items, wiz stuff, 
       * innate abilities, or items w/o a type. Generally 
***************
*** 81,96 ****
  
      /* Okay, try stealing this item. Dependent on dexterity of thief,
       * skill level, see the adj_stealroll fctn for more detail. */
  
      roll=(RANDOM()%100+RANDOM()%100)/2; /* weighted 1-100 */ 
-     chance=adj_stealchance(who,op,(stats_value+thief_lvl-victim_lvl));
  
!     if (roll < chance ) {
  		pick_up(who, tmp);
! 		if(can_pick(who,tmp)) 
  		  success = tmp;
  		break;
      }
    }
  
    /* If you arent high enough level, you might get something BUT
--- 100,118 ----
  
      /* Okay, try stealing this item. Dependent on dexterity of thief,
       * skill level, see the adj_stealroll fctn for more detail. */
  
      roll=(RANDOM()%100+RANDOM()%100)/2; /* weighted 1-100 */ 
  
!     if((chance=adj_stealchance(who,op,(stats_value+thief_lvl-victim_lvl)))==-1)
!       return 0;
!     else if (roll < chance ) {
  		pick_up(who, tmp);
! 		if(can_pick(who,tmp)) {
! 	          /* for players, play_sound: steals item */
  		  success = tmp;
+                 }
  		break;
      }
    }
  
    /* If you arent high enough level, you might get something BUT
***************
*** 103,124 ****
    ) {
      /* victim figures out where the thief is! */
      if(who->hide) make_visible(who);
  
      if(op->type != PLAYER) {
-       object *tmpitem=NULL;
  
        /* The unaggressives look after themselves 8) */
-       CLEAR_FLAG(op, FLAG_UNAGGRESSIVE);
        if(who->type==PLAYER) {
  	npc_call_help(op);
  	new_draw_info_format(NDI_UNIQUE, 0,who,
  		  "%s notices your attempted pilfering!",query_name(op));
        }
!       /* all remaining npc items are guarded now. Set flag NO_STEAL */
!       for(tmpitem=op->inv;tmpitem!=NULL;tmpitem=tmpitem->below)
! 	       SET_FLAG(tmpitem,FLAG_NO_STEAL);
      } else {
        char buf[MAX_BUF];
        /* Notify the other player */
        if (success && who->stats.Int > RANDOM()%20) {
  	sprintf(buf, "Your %s is missing!", query_name(success));
--- 125,145 ----
    ) {
      /* victim figures out where the thief is! */
      if(who->hide) make_visible(who);
  
      if(op->type != PLAYER) {
  
        /* The unaggressives look after themselves 8) */
        if(who->type==PLAYER) {
  	npc_call_help(op);
  	new_draw_info_format(NDI_UNIQUE, 0,who,
  		  "%s notices your attempted pilfering!",query_name(op));
        }
!       CLEAR_FLAG(op, FLAG_UNAGGRESSIVE);
!       /* all remaining npc items are guarded now. Set flag NO_STEAL 
!        * on the victim. */
!       SET_FLAG(op,FLAG_NO_STEAL);
      } else {
        char buf[MAX_BUF];
        /* Notify the other player */
        if (success && who->stats.Int > RANDOM()%20) {
  	sprintf(buf, "Your %s is missing!", query_name(success));
***************
*** 223,233 ****
  	  else return (calc_skill_exp(op,tmp));
      }
      return 0;
  }
  
! /* Implementation by bt. (thomas@nomad.astro.psu.edu)
   * monster implementation 7-7-95 by bt.
   */
  
  int pick_lock(object *pl, int dir)
  {
--- 244,254 ----
  	  else return (calc_skill_exp(op,tmp));
      }
      return 0;
  }
  
! /* Implementation by bt. (thomas@astro.psu.edu)
   * monster implementation 7-7-95 by bt.
   */
  
  int pick_lock(object *pl, int dir)
  {
***************
*** 294,309 ****
  		spring_trap(door->inv,pl); 	       
      } 
      return success;
  }
  
! /* HIDE CODE. Right now, user becomes 'invisible' for
   * a short while (success and duration dependant on player SK_level,
!  * dexterity, charisma, and map difficulty
   * Players have a good chance of becoming 'unhidden' if they move
   * and like invisiblity will be come visible if they attack
!  * Implemented by b.t. (thomas@nomad.astro.psu.edu)
   * July 7, 1995 - made hiding possible for monsters. -b.t.
   */ 
  
  /* patched this to take terrain into consideration */
  
--- 315,330 ----
  		spring_trap(door->inv,pl); 	       
      } 
      return success;
  }
  
! /* HIDE CODE. The user becomes undetectable (not just 'invisible') for
   * a short while (success and duration dependant on player SK_level,
!  * dexterity, charisma, and map difficulty). 
   * Players have a good chance of becoming 'unhidden' if they move
   * and like invisiblity will be come visible if they attack
!  * Implemented by b.t. (thomas@astro.psu.edu)
   * July 7, 1995 - made hiding possible for monsters. -b.t.
   */ 
  
  /* patched this to take terrain into consideration */
  
***************
*** 626,636 ****
  }  
  
  /* players using this skill can 'charm' a monster --
   * into working for them. It can only be used on 
   * non-special (see below) 'neutral' creatures. 
!  * -b.t. (thomas@nomad.astro.psu.edu)
   */
  
  int use_oratory(object *pl, int dir) {
    int expsum=0,x=pl->x+freearr_x[dir],y=pl->y+freearr_y[dir],chance;
    int stat1 = get_skill_stat1(pl);
--- 647,657 ----
  }  
  
  /* players using this skill can 'charm' a monster --
   * into working for them. It can only be used on 
   * non-special (see below) 'neutral' creatures. 
!  * -b.t. (thomas@astro.psu.edu)
   */
  
  int use_oratory(object *pl, int dir) {
    int expsum=0,x=pl->x+freearr_x[dir],y=pl->y+freearr_y[dir],chance;
    int stat1 = get_skill_stat1(pl);
[to unsubscribe etc., send mail to crossfire-request@ifi.uio.no]