Difference for server/attack.c from version 1.113 to 1.114


version 1.113 version 1.114
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_attack_c =   * static char *rcsid_attack_c =
  *   "$Id: attack.c,v 1.113 2005/09/25 02:15:45 cavesomething Exp $";   *   "$Id: attack.c,v 1.114 2005/10/07 19:38:49 akirschbaum Exp $";
  */   */
 /*  /*
     CrossFire, A Multiplayer game for X-windows      CrossFire, A Multiplayer game for X-windows
Line 24
 
Line 24
   
     The authors can be reached via e-mail to crossfire-devel@real-time.com      The authors can be reached via e-mail to crossfire-devel@real-time.com
 */  */
   #include <assert.h>
 #include <global.h>  #include <global.h>
 #include <living.h>  #include <living.h>
 #include <material.h>  #include <material.h>
Line 238
 
Line 239
 /* Object op is hitting the map.  /* Object op is hitting the map.
  * op is going in direction 'dir'   * op is going in direction 'dir'
  * type is the attacktype of the object.   * type is the attacktype of the object.
    * full_hit is set if monster area does not matter.
  * returns 1 if it hits something, 0 otherwise.   * returns 1 if it hits something, 0 otherwise.
  */   */
   
 int hit_map(object *op,int dir,int type) {  int hit_map(object *op, int dir, int type, int full_hit) {
     object *tmp, *next;      object *tmp, *next;
     mapstruct *map;      mapstruct *map;
     sint16 x, y;      sint16 x, y;
Line 333
 
Line 335
      continue;       continue;
   
  if (QUERY_FLAG (tmp, FLAG_ALIVE)) {   if (QUERY_FLAG (tmp, FLAG_ALIVE)) {
      hit_player(tmp,op->stats.dam,op,type);       hit_player(tmp,op->stats.dam,op,type,full_hit);
      retflag |=1;       retflag |=1;
      if (was_destroyed (op, op_tag))       if (was_destroyed (op, op_tag))
  break;   break;
Line 796
 
Line 798
      if (op->attacktype & AT_ACID && hitter->type==PLAYER)       if (op->attacktype & AT_ACID && hitter->type==PLAYER)
  new_draw_info(NDI_UNIQUE, 0,hitter,"You are splashed by acid!\n");   new_draw_info(NDI_UNIQUE, 0,hitter,"You are splashed by acid!\n");
      hit_player(hitter, random_roll(0, (op->stats.dam), hitter,       hit_player(hitter, random_roll(0, (op->stats.dam), hitter,
        PREFER_LOW),op, op->attacktype);         PREFER_LOW),op, op->attacktype, 1);
      if (was_destroyed (op, op_tag)       if (was_destroyed (op, op_tag)
                 || was_destroyed (hitter, hitter_tag)                  || was_destroyed (hitter, hitter_tag)
                 || abort_attack (op, hitter, simple_attack))                  || abort_attack (op, hitter, simple_attack))
Line 807
 
Line 809
  * types in its area, so remove it from here.   * types in its area, so remove it from here.
  */   */
  dam=hit_player(op, random_roll(1, hitdam, hitter, PREFER_HIGH),   dam=hit_player(op, random_roll(1, hitdam, hitter, PREFER_HIGH),
         hitter, type);          hitter, type, 1);
  if (was_destroyed (op, op_tag) || was_destroyed (hitter, hitter_tag)   if (was_destroyed (op, op_tag) || was_destroyed (hitter, hitter_tag)
             || abort_attack (op, hitter, simple_attack))              || abort_attack (op, hitter, simple_attack))
      goto leave;       goto leave;
Line 1679
 
Line 1681
   
 /* This isn't used just for players, but in fact most objects.  /* This isn't used just for players, but in fact most objects.
  * op is the object to be hit, dam is the amount of damage, hitter   * op is the object to be hit, dam is the amount of damage, hitter
  * is what is hitting the object, and type is the attacktype.   * is what is hitting the object, type is the attacktype, and
    * full_hit is set if monster area does not matter.
  * dam is base damage - protections/vulnerabilities/slaying matches can   * dam is base damage - protections/vulnerabilities/slaying matches can
  * modify it.   * modify it.
  */   */
Line 1687
 
Line 1690
   /* Oct 95 - altered the following slightly for MULTIPLE_GODS hack    /* Oct 95 - altered the following slightly for MULTIPLE_GODS hack
    * which needs new attacktype AT_HOLYWORD to work . b.t. */     * which needs new attacktype AT_HOLYWORD to work . b.t. */
   
 int hit_player(object *op,int dam, object *hitter, int type) {  int hit_player(object *op,int dam, object *hitter, int type, int full_hit) {
     int maxdam=0, ndam=0, attacktype=1, magic=(type & AT_MAGIC);      int maxdam=0, ndam=0, attacktype=1, magic=(type & AT_MAGIC);
     int maxattacktype, attacknum;      int maxattacktype, attacknum;
     int body_attack = op && op->head;   /* Did we hit op's head? */      int body_attack = op && op->head;   /* Did we hit op's head? */
Line 1824
 
Line 1827
 #endif  #endif
     }      }
   
       if (!full_hit) {
    archetype *at;
    int area;
    int remainder;
   
    area = 0;
    for(at = op->arch; at != NULL; at = at->more)
        area++;
    assert(area > 0);
   
    /* basically: maxdam /= area; we try to "simulate" a float
       value-effect */
    remainder = 100*(maxdam%area)/area;
    maxdam /= area;
    if (RANDOM()%100 < remainder)
        maxdam++;
       }
   
 #ifdef ATTACK_DEBUG  #ifdef ATTACK_DEBUG
     LOG(llevDebug,"Attacktype %d did %d damage\n", type, maxdam);      LOG(llevDebug,"Attacktype %d did %d damage\n", type, maxdam);


Legend:
line(s) removed in v.1.113 
line(s) changed
 line(s) added in v.1.114

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