Difference for server/attack.c from version 1.70 to 1.71


version 1.70 version 1.71
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_attack_c =   * static char *rcsid_attack_c =
  *   "$Id: attack.c,v 1.70 2002/07/25 06:57:14 mwedel Exp $";   *   "$Id: attack.c,v 1.71 2002/08/31 07:28:07 mwedel Exp $";
  */   */
 /*  /*
     CrossFire, A Multiplayer game for X-windows      CrossFire, A Multiplayer game for X-windows
Line 1118
 
Line 1118
  */   */
  int rate;   int rate;
    
  if(op->resist[ATNR_DRAIN] > 0)    if(op->resist[ATNR_DRAIN] >= 0)
    rate = 50 + op->resist[ATNR_DRAIN] / 2;     rate = 50 + op->resist[ATNR_DRAIN] / 2;
  else if(op->resist[ATNR_DRAIN] < 0)   else if(op->resist[ATNR_DRAIN] < 0)
    rate = 5000 / (100 - op->resist[ATNR_DRAIN]);     rate = 5000 / (100 - op->resist[ATNR_DRAIN]);
Line 1135
 
Line 1135
        /* If we can't drain, lets try to do physical damage */         /* If we can't drain, lets try to do physical damage */
  dam = hit_player_attacktype(op, hitter, dam, ATNR_PHYSICAL, magic);   dam = hit_player_attacktype(op, hitter, dam, ATNR_PHYSICAL, magic);
  } else {   } else {
        /* Randomly give the hitter some hp */
      if(hitter->stats.hp<hitter->stats.maxhp &&       if(hitter->stats.hp<hitter->stats.maxhp &&
         (op->level > hitter->level) &&          (op->level > hitter->level) &&
         random_roll(0, (op->level-hitter->level+2), hitter, PREFER_HIGH)>3)          random_roll(0, (op->level-hitter->level+2), hitter, PREFER_HIGH)>3)
        hitter->stats.hp++;         hitter->stats.hp++;
   
      if (!op_on_battleground(hitter, NULL, NULL)) {       /* Can't do drains on battleground spaces.
        /* Player gets half as much exp as was drained. */        * Move the wiz check up here - before, the hitter wouldn't gain exp
        if(!QUERY_FLAG(op,FLAG_WAS_WIZ))        * exp, but the wiz would still lose exp!  If drainee is a wiz,
         * nothing happens.
         */
        if (!op_on_battleground(hitter, NULL, NULL) && !QUERY_FLAG(op,FLAG_WAS_WIZ)) {
    object *owner = get_owner(hitter), *old_skill;
   
    /* Try to find the owner of the thing doing the drain - thus, if
    * you summon vampires, you get some exp.  Most of this code
    * below is taken directly from kill_object
    */
    if (owner != hitter) {
        old_skill = owner->chosen_skill;
        owner->chosen_skill = hitter->chosen_skill;
        owner->exp_obj=hitter->exp_obj;
   
        /* Not sure if this will happen or not - I'm think it could with
         * summoned pets - they may use a skill and thus the chosen_skill
         * gets updated to something they have.
         */
        if (owner->chosen_skill && owner->chosen_skill->env != owner) {
    LOG(llevDebug,"kill_object: chosen skill doesn't belong to owner? (%s, %s)\n",
        owner->chosen_skill->name, owner->name);
    owner->chosen_skill = NULL;
        }
        if (owner->exp_obj && owner->exp_obj->env != owner) {
    LOG(llevDebug,"kill_object: exp_obj doesn't belong to owner? (%s, %s)\n",
        owner->exp_obj->name, owner->name);
    owner->exp_obj = NULL;
        }
    }
    if (owner) {
        add_exp(owner,op->stats.exp/(rate*2));
        owner->chosen_skill = old_skill;
    } else {
  add_exp(hitter,op->stats.exp/(rate*2));   add_exp(hitter,op->stats.exp/(rate*2));
    }
        add_exp(op,-op->stats.exp/rate);         add_exp(op,-op->stats.exp/rate);
      }       }
      dam = 0; /* Drain is an effect */       dam = 0; /* Drain is an effect */
  }   }
       } break;        }
         break;
     case ATNR_TURN_UNDEAD:      case ATNR_TURN_UNDEAD:
       {        {
  if (QUERY_FLAG(op,FLAG_UNDEAD)) {   if (QUERY_FLAG(op,FLAG_UNDEAD)) {


Legend:
line(s) removed in v.1.70 
line(s) changed
 line(s) added in v.1.71

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