Difference for server/monster.c from version 1.97 to 1.98


version 1.97 version 1.98
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_monster_c =   * static char *rcsid_monster_c =
  *    "$Id: monster.c,v 1.97 2006/03/14 15:33:28 ryo_saeba Exp $";   *    "$Id: monster.c,v 1.98 2006/05/05 09:26:35 ryo_saeba Exp $";
  */   */
   
 /*  /*
Line 33
 
Line 33
 #include <skills.h>  #include <skills.h>
 #endif  #endif
   
   static int can_hit(object *ob1, object *ob2, rv_vector *rv);
   static int monster_cast_spell(object *head, object *part,object *pl,int dir, rv_vector *rv);
   static int monster_use_scroll(object *head, object *part, object *pl, int dir, rv_vector *rv);
   static int monster_use_skill(object *head, object *part, object *pl, int dir);
   static int monster_use_range(object *head, object *part, object *pl, int dir);
   static int monster_use_bow(object *head, object *part, object *pl, int dir);
   static void monster_check_pickup(object *monster);
   static int monster_can_pick(object *monster, object *item);
   static void monster_apply_below(object *monster);
   static int dist_att(int dir, object *ob, object *enemy, object *part, rv_vector *rv);
   static int run_att(int dir, object *ob, object *enemy, object *part, rv_vector *rv);
   static int hitrun_att(int dir, object *ob, object *enemy);
   static int wait_att(int dir, object *ob, object *enemy, object *part, rv_vector *rv);
   static int disthit_att(int dir, object *ob, object *enemy, object *part, rv_vector *rv);
   static int wait_att2(int dir, object *ob, object *enemy, object *part, rv_vector *rv);
   static void circ1_move(object *ob);
   static void circ2_move(object *ob);
   static void pace_movev(object *ob);
   static void pace_moveh(object *ob);
   static void pace2_movev(object *ob);
   static void pace2_moveh(object *ob);
   static void rand_move(object *ob);
   static int talk_to_npc(object *op, object *npc, const char *txt);
   static int talk_to_wall(object *pl, object *npc, const char *txt);
   
   
 #define MIN_MON_RADIUS 3 /* minimum monster detection radius */  #define MIN_MON_RADIUS 3 /* minimum monster detection radius */
   
Line 167
 
Line 192
  * many cases.   * many cases.
  */   */
   
 object *find_enemy(object *npc, rv_vector *rv)  static object *find_enemy(object *npc, rv_vector *rv)
 {  {
     object *attacker, *tmp=NULL;      object *attacker, *tmp=NULL;
   
Line 243
 
Line 268
  * returns 1 if the monster should wake up, 0 otherwise.   * returns 1 if the monster should wake up, 0 otherwise.
  */   */
   
 int check_wakeup(object *op, object *enemy, rv_vector *rv) {  static int check_wakeup(object *op, object *enemy, rv_vector *rv) {
     int radius = op->stats.Wis>MIN_MON_RADIUS?op->stats.Wis:MIN_MON_RADIUS;      int radius = op->stats.Wis>MIN_MON_RADIUS?op->stats.Wis:MIN_MON_RADIUS;
   
     /* Trim work - if no enemy, no need to do anything below */      /* Trim work - if no enemy, no need to do anything below */
Line 277
 
Line 302
     return 0;      return 0;
 }  }
   
 int move_randomly(object *op) {  static int move_randomly(object *op) {
     int i;      int i;
   
     /* Give up to 15 chances for a monster to move randomly */      /* Give up to 15 chances for a monster to move randomly */
Line 644
 
Line 669
     }      }
     return 0;      return 0;
 }  }
 int can_hit(object *ob1,object *ob2, rv_vector *rv) {  
   static int can_hit(object *ob1,object *ob2, rv_vector *rv) {
     object *more;      object *more;
     rv_vector rv1;      rv_vector rv1;
   
Line 703
 
Line 729
  * wizard spells, as the check is against sp, and not grace.   * wizard spells, as the check is against sp, and not grace.
  * can mosnters know cleric spells?   * can mosnters know cleric spells?
  */   */
 object *monster_choose_random_spell(object *monster) {  static object *monster_choose_random_spell(object *monster) {
     object *altern[MAX_KNOWN_SPELLS];      object *altern[MAX_KNOWN_SPELLS];
     object *tmp;      object *tmp;
     int i=0;      int i=0;
Line 734
 
Line 760
  * rv is the vector which describes where the enemy is.   * rv is the vector which describes where the enemy is.
  */   */
   
 int monster_cast_spell(object *head, object *part,object *pl,int dir, rv_vector *rv) {  static int monster_cast_spell(object *head, object *part,object *pl,int dir, rv_vector *rv) {
     object *spell_item;      object *spell_item;
     object *owner;      object *owner;
     rv_vector rv1;      rv_vector rv1;
Line 802
 
Line 828
 }  }
   
   
 int monster_use_scroll(object *head, object *part,object *pl,int dir, rv_vector *rv) {  static int monster_use_scroll(object *head, object *part,object *pl,int dir, rv_vector *rv) {
     object *scroll;      object *scroll;
     object *owner;      object *owner;
     rv_vector rv1;      rv_vector rv1;
Line 855
 
Line 881
  * stealing. TODO: This should be more integrated in the game. -MT, 25.11.01   * stealing. TODO: This should be more integrated in the game. -MT, 25.11.01
  */     */ 
   
 int monster_use_skill(object *head, object *part, object *pl,int dir) {  static int monster_use_skill(object *head, object *part, object *pl,int dir) {
     object *skill, *owner;      object *skill, *owner;
   
     if(!(dir=path_to_player(part,pl,0)))      if(!(dir=path_to_player(part,pl,0)))
Line 893
 
Line 919
   
 /* Monster will use a ranged spell attack. */  /* Monster will use a ranged spell attack. */
   
 int monster_use_range(object *head,object *part,object *pl,int dir)  static int monster_use_range(object *head,object *part,object *pl,int dir)
     {      {
     object *wand, *owner;      object *wand, *owner;
     int at_least_one = 0;      int at_least_one = 0;
Line 960
 
Line 986
  return 0;   return 0;
     }      }
   
 int monster_use_bow(object *head, object *part, object *pl, int dir) {  static int monster_use_bow(object *head, object *part, object *pl, int dir) {
     object *owner;      object *owner;
   
     if(!(dir=path_to_player(part,pl,0)))      if(!(dir=path_to_player(part,pl,0)))
Line 986
 
Line 1012
  * return true if item is a better object.   * return true if item is a better object.
  */   */
   
 int check_good_weapon(object *who, object *item) {  static int check_good_weapon(object *who, object *item) {
     object *other_weap;      object *other_weap;
     int val=0, i;      int val=0, i;
   
Line 1016
 
Line 1042
   
 }  }
   
 int check_good_armour(object *who, object *item) {  static int check_good_armour(object *who, object *item) {
     object *other_armour;      object *other_armour;
     int val=0,i;      int val=0,i;
   
Line 1067
 
Line 1093
  * affect stacking on this space.   * affect stacking on this space.
  */   */
   
 void monster_check_pickup(object *monster) {  static void monster_check_pickup(object *monster) {
     object *tmp,*next;      object *tmp,*next;
     int next_tag;      int next_tag;
   
Line 1093
 
Line 1119
  * I've already utilized flags for bows, wands, rings, etc, etc. -Frank.   * I've already utilized flags for bows, wands, rings, etc, etc. -Frank.
  */   */
   
 int monster_can_pick(object *monster, object *item) {  static int monster_can_pick(object *monster, object *item) {
     int flag=0;      int flag=0;
     int i;      int i;
   
Line 1179
 
Line 1205
  * then make him apply it   * then make him apply it
  */   */
   
 void monster_apply_below(object *monster) {  static void monster_apply_below(object *monster) {
     object *tmp, *next;      object *tmp, *next;
   
     for(tmp=monster->below;tmp!=NULL;tmp=next) {      for(tmp=monster->below;tmp!=NULL;tmp=next) {
Line 1404
 
Line 1430
     return 0;      return 0;
 }  }
   
 void circ1_move (object *ob) {  static void circ1_move (object *ob) {
   static int circle [12] = {3,3,4,5,5,6,7,7,8,1,1,2};    static int circle [12] = {3,3,4,5,5,6,7,7,8,1,1,2};
   if(++ob->move_status > 11)    if(++ob->move_status > 11)
     ob->move_status = 0;      ob->move_status = 0;
Line 1412
 
Line 1438
     (void) move_object(ob,RANDOM()%8+1);      (void) move_object(ob,RANDOM()%8+1);
 }  }
   
 void circ2_move (object *ob) {  static void circ2_move (object *ob) {
   static int circle[20] = {3,3,3,4,4,5,5,5,6,6,7,7,7,8,8,1,1,1,2,2};    static int circle[20] = {3,3,3,4,4,5,5,5,6,6,7,7,7,8,8,1,1,1,2,2};
   if(++ob->move_status > 19)    if(++ob->move_status > 19)
     ob->move_status = 0;      ob->move_status = 0;
Line 1420
 
Line 1446
     (void) move_object(ob,RANDOM()%8+1);      (void) move_object(ob,RANDOM()%8+1);
 }  }
   
 void pace_movev(object *ob) {  static void pace_movev(object *ob) {
   if (ob->move_status++ > 6)    if (ob->move_status++ > 6)
     ob->move_status = 0;      ob->move_status = 0;
   if (ob->move_status < 4)    if (ob->move_status < 4)
Line 1429
 
Line 1455
     (void) move_object(ob,1);      (void) move_object(ob,1);
 }  }
   
 void pace_moveh (object *ob) {  static void pace_moveh (object *ob) {
   if (ob->move_status++ > 6)    if (ob->move_status++ > 6)
     ob->move_status = 0;      ob->move_status = 0;
   if (ob->move_status < 4)    if (ob->move_status < 4)
Line 1438
 
Line 1464
     (void) move_object(ob,7);      (void) move_object(ob,7);
 }  }
   
 void pace2_movev (object *ob) {  static void pace2_movev (object *ob) {
   if (ob->move_status ++ > 16)    if (ob->move_status ++ > 16)
     ob->move_status = 0;      ob->move_status = 0;
   if (ob->move_status <6)    if (ob->move_status <6)
Line 1450
 
Line 1476
   else return;    else return;
 }         }      
   
 void pace2_moveh (object *ob) {  static void pace2_moveh (object *ob) {
   if (ob->move_status ++ > 16)    if (ob->move_status ++ > 16)
     ob->move_status = 0;      ob->move_status = 0;
   if (ob->move_status <6)    if (ob->move_status <6)
Line 1462
 
Line 1488
   else return;    else return;
 }         }      
   
 void rand_move (object *ob) {  static void rand_move (object *ob) {
   int i;    int i;
   if (ob->move_status <1 || ob->move_status >8 ||    if (ob->move_status <1 || ob->move_status >8 ||
       !(move_object(ob,ob->move_status|| ! (RANDOM()% 9))))        !(move_object(ob,ob->move_status|| ! (RANDOM()% 9))))
Line 1640
 
Line 1666
     return 0;      return 0;
 }  }
   
 int talk_to_npc(object *op, object *npc, const char *txt) {  static int talk_to_npc(object *op, object *npc, const char *txt) {
     object *cobj;      object *cobj;
   
     /* Move this commone area up here - shouldn't cost much extra cpu      /* Move this commone area up here - shouldn't cost much extra cpu
Line 1681
 
Line 1707
     return 1;      return 1;
 }  }
   
 int talk_to_wall(object* pl, object *npc, const char *txt) {  static int talk_to_wall(object* pl, object *npc, const char *txt) {
   
     object* inv;      object* inv;
   


Legend:
line(s) removed in v.1.97 
line(s) changed
 line(s) added in v.1.98

File made using version 1.98 of cvs2html by leaf at 2011-07-21 17:37