Difference for server/disease.c from version 1.26 to 1.27


version 1.26 version 1.27
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_disease_c =   * static char *rcsid_disease_c =
  *   "$Id: disease.c,v 1.26 2003/04/10 05:21:48 mwedel Exp $";   *   "$Id: disease.c,v 1.27 2003/09/13 05:02:09 mwedel Exp $";
  */   */
 /*  /*
     CrossFire, A Multiplayer game for X-windows      CrossFire, A Multiplayer game for X-windows
Line 264
 
Line 264
   
   
 /*  check to see if an object is infectable:  /*  check to see if an object is infectable:
  objects with immunity aren't infectable.   * objects with immunity aren't infectable.
  objects already infected aren't infectable.   * objects already infected aren't infectable.
  dead objects aren't infectable.   * dead objects aren't infectable.
  undead objects are infectible only if specifically named.   * undead objects are infectible only if specifically named.
 */  */
 int infect_object(object *victim, object *disease, int force) {  int infect_object(object *victim, object *disease, int force) {
     object *tmp;      object *tmp;
Line 317
 
Line 317
   
     if(get_owner(disease)) {      if(get_owner(disease)) {
  set_owner(new_disease,disease->owner);   set_owner(new_disease,disease->owner);
  new_disease->chosen_skill = disease->chosen_skill;  
  new_disease->exp_obj = disease->exp_obj;   /* Only need to update skill if different */
    if (new_disease->skill != disease->skill) {
        if (new_disease->skill) free_string(new_disease->skill);
        if (disease->skill) new_disease->skill = add_refcount(disease->skill);
    }
     }      }
     else {  /* for diseases which are passed by hitting, set owner and praying skill*/      else {  /* for diseases which are passed by hitting, set owner and praying skill*/
  if(disease->env && disease->env->type==PLAYER) {   if(disease->env && disease->env->type==PLAYER) {
      object *player = disease->env;       object *player = disease->env;
   
      new_disease->chosen_skill = find_skill(player,SK_PRAYING);  
   
      /* Not all players have praying.  A side effect here is that  
       * players can infect others with diseases they get from traps,  
       * but that is not likely a big deal.  
       */  
      if (new_disease->chosen_skill) {  
  set_owner(new_disease,player);   set_owner(new_disease,player);
  new_disease->exp_obj = new_disease->chosen_skill->exp_obj;       /* the skill pointer for these diseases should already be set up -
      }        * hardcoding in 'praying' is not the right approach.
         */
  }   }
     }      }
   
Line 372
 
Line 370
   object *victim;    object *victim;
   object *tmp;    object *tmp;
   victim = disease->env;    victim = disease->env;
   
   /* This is a quick hack - for whatever reason, disease->env will point    /* This is a quick hack - for whatever reason, disease->env will point
    * back to disease, causing endless loops.  Why this happens really needs     * back to disease, causing endless loops.  Why this happens really needs
    * to be found, but this should at least prevent the infinite loops.     * to be found, but this should at least prevent the infinite loops.
    */     */
   
   if(victim == NULL || victim==disease)     if(victim == NULL || victim==disease)
     return 0;/* no-one to inflict symptoms on */      return 0;/* no-one to inflict symptoms on */
   
   symptom = find_symptom(disease);    symptom = find_symptom(disease);
   if(symptom==NULL) /* no symptom?  need to generate one! */      if(symptom==NULL) {
     {   /* no symptom?  need to generate one! */
       object *new_symptom;        object *new_symptom;
       /* first check and see if the carrier of the disease  
  is immune.  If so, no symptoms!  */   /* first check and see if the carrier of the disease is immune.  If so, no symptoms!  */
       if(!is_susceptible_to_disease(victim, disease)) return 0;        if(!is_susceptible_to_disease(victim, disease)) return 0;
   
       /* check for an actual immunity */        /* check for an actual immunity */
   
       /* do an immunity check */        /* do an immunity check */
       if(victim->head) tmp = victim->head->inv;        if(victim->head) tmp = victim->head->inv;
       else tmp = victim->inv;        else tmp = victim->inv;
Line 401
 
Line 401
       new_symptom = get_archetype("symptom");        new_symptom = get_archetype("symptom");
   
       /* Something special done with dam.  We want diseases to be more        /* Something special done with dam.  We want diseases to be more
  random in what they'll kill, so we'll make the damage they   * random in what they'll kill, so we'll make the damage they
  do random, note, this has a weird effect with progressive diseases.*/   * do random, note, this has a weird effect with progressive diseases.
    */
       if(disease->stats.dam != 0) {        if(disease->stats.dam != 0) {
  int dam = disease->stats.dam;   int dam = disease->stats.dam;
   
  /* reduce the damage, on average, 50%, and making things random. */   /* reduce the damage, on average, 50%, and making things random. */
   
  dam = random_roll(1, FABS(dam), victim, PREFER_LOW);   dam = random_roll(1, FABS(dam), victim, PREFER_LOW);
  if(disease->stats.dam < 0) dam = -dam;   if(disease->stats.dam < 0) dam = -dam;
  new_symptom->stats.dam = dam;   new_symptom->stats.dam = dam;
       }        }
   
   
    
       new_symptom->stats.maxsp = disease->stats.maxsp;         new_symptom->stats.maxsp = disease->stats.maxsp;
       new_symptom->stats.food = new_symptom->stats.maxgrace;        new_symptom->stats.food = new_symptom->stats.maxgrace;
   
Line 439
 
Line 441
       new_symptom->other_arch = disease->other_arch;        new_symptom->other_arch = disease->other_arch;
   
       set_owner(new_symptom,disease->owner);        set_owner(new_symptom,disease->owner);
       /* Unfortunately, set_owner does the wrong thing to the skills pointers   if (new_symptom->skill != disease->skill) {
  resulting in exp going into the owners *current* chosen skill. */       if (new_symptom->skill) free_string(new_symptom->skill);
       new_symptom->chosen_skill = disease->chosen_skill;       if (disease->skill) new_symptom->skill = add_refcount(disease->skill);
       new_symptom->exp_obj = disease->exp_obj;   }
    
   
       CLEAR_FLAG(new_symptom,FLAG_NO_PASS);        CLEAR_FLAG(new_symptom,FLAG_NO_PASS);
       insert_ob_in_ob(new_symptom,victim);        insert_ob_in_ob(new_symptom,victim);
       return 1;        return 1;
     }      }
      
   /* now deal with progressing diseases:  we increase the debility    /* now deal with progressing diseases:  we increase the debility
      caused by the symptoms.  */       * caused by the symptoms.
        */
   
   if(disease->stats.ac!=0) {    if(disease->stats.ac!=0) {
     float scale;      float scale;
   
     symptom->value += disease->stats.ac;      symptom->value += disease->stats.ac;
     scale = 1.0 + symptom->value/100.0;      scale = 1.0 + symptom->value/100.0;
     /* now rescale all the debilities */      /* now rescale all the debilities */
Line 594
 
Line 596
      remove_symptoms(disease);       remove_symptoms(disease);
      remove_ob(disease);       remove_ob(disease);
      cure=1;       cure=1;
      if(caster) add_exp(caster,disease->stats.exp);       if(caster) change_exp(caster,disease->stats.exp,
      caster->chosen_skill?caster->chosen_skill->skill:NULL, 0);
      free_object(disease);       free_object(disease);
      }       }
  }   }


Legend:
line(s) removed in v.1.26 
line(s) changed
 line(s) added in v.1.27

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