Difference for server/apply.c from version 1.37 to 1.38


version 1.37 version 1.38
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_apply_c =   * static char *rcsid_apply_c =
  *   "$Id: apply.c,v 1.37 2001/05/25 04:29:01 mwedel Exp $";   *   "$Id: apply.c,v 1.38 2001/05/29 04:41:53 mwedel Exp $";
  */   */
 /*  /*
     CrossFire, A Multiplayer game for X-windows      CrossFire, A Multiplayer game for X-windows
Line 344
 
Line 344
      * Note:  Nothing should break by allowing this ratio to be different or       * Note:  Nothing should break by allowing this ratio to be different or
      * using normal level - it is just a matter of play balance.       * using normal level - it is just a matter of play balance.
      */       */
 #ifdef ALLOW_SKILLS  
     if(who->type==PLAYER) {       if(who->type==PLAYER) {
       object *wc_obj=NULL;        object *wc_obj=NULL;
   
Line 356
 
Line 355
  level=wc_obj->level;    level=wc_obj->level;
     }      }
     return (improvs <= ((level/5)+5));      return (improvs <= ((level/5)+5));
 #else  
     return (improvs <= (level+5));  
 #endif  
 }  }
   
 /* Returns the object count that of the number of objects found that  /* Returns the object count that of the number of objects found that
Line 1315
 
Line 1311
   
 static void apply_book (object *op, object *tmp)  static void apply_book (object *op, object *tmp)
 {  {
 #ifdef ALLOW_SKILLS  
     int lev_diff;      int lev_diff;
 #endif  
   
     if(QUERY_FLAG(op, FLAG_BLIND)&&!QUERY_FLAG(op,FLAG_WIZ)) {      if(QUERY_FLAG(op, FLAG_BLIND)&&!QUERY_FLAG(op,FLAG_WIZ)) {
       new_draw_info(NDI_UNIQUE, 0,op,"You are unable to read while blind.");        new_draw_info(NDI_UNIQUE, 0,op,"You are unable to read while blind.");
Line 1328
 
Line 1322
  "You open the %s and find it empty.", tmp->name);   "You open the %s and find it empty.", tmp->name);
       return;        return;
     }      }
 #ifdef ALLOW_SKILLS /* need a literacy skill to read stuff! */  
       /* need a literacy skill to read stuff! */
     if ( ! change_skill(op,SK_LITERACY)) {      if ( ! change_skill(op,SK_LITERACY)) {
       new_draw_info(NDI_UNIQUE, 0,op,        new_draw_info(NDI_UNIQUE, 0,op,
  "You are unable to decipher the strange symbols.");   "You are unable to decipher the strange symbols.");
Line 1351
 
Line 1346
  new_draw_info(NDI_UNIQUE, 0,op,"This book is totally beyond your comprehension.");   new_draw_info(NDI_UNIQUE, 0,op,"This book is totally beyond your comprehension.");
       return;        return;
     }      }
 #endif  
   
     new_draw_info_format (NDI_UNIQUE, 0, op,      new_draw_info_format (NDI_UNIQUE, 0, op,
                           "You open the %s and start reading.", tmp->name);                            "You open the %s and start reading.", tmp->name);
     new_draw_info(NDI_UNIQUE | NDI_NAVY, 0, op, tmp->msg);      new_draw_info(NDI_UNIQUE | NDI_NAVY, 0, op, tmp->msg);
   
 #ifdef ALLOW_SKILLS /* gain xp from reading */        /* gain xp from reading */ 
     if(!QUERY_FLAG(tmp,FLAG_NO_SKILL_IDENT)) { /* only if not read before */       if(!QUERY_FLAG(tmp,FLAG_NO_SKILL_IDENT)) { /* only if not read before */
       int exp_gain=calc_skill_exp(op,tmp);        int exp_gain=calc_skill_exp(op,tmp);
       if(!QUERY_FLAG(tmp,FLAG_IDENTIFIED)) {        if(!QUERY_FLAG(tmp,FLAG_IDENTIFIED)) {
Line 1370
 
Line 1364
       add_exp(op,exp_gain);        add_exp(op,exp_gain);
       SET_FLAG(tmp,FLAG_NO_SKILL_IDENT); /* so no more xp gained from this book */         SET_FLAG(tmp,FLAG_NO_SKILL_IDENT); /* so no more xp gained from this book */
     }      }
 #endif  
 }  }
   
   
 #ifdef ALLOW_SKILLS  
 static void apply_skillscroll (object *op, object *tmp)  static void apply_skillscroll (object *op, object *tmp)
 {  {
   switch ((int) learn_skill (op, tmp))    switch ((int) learn_skill (op, tmp))
Line 1401
 
Line 1393
       return;        return;
     }      }
 }  }
 #endif  
   
   
 /* Special prayers are granted by gods and lost when the follower decides  /* Special prayers are granted by gods and lost when the follower decides
Line 1531
 
Line 1522
        tmp->slaying=NULL;         tmp->slaying=NULL;
     }      }
   
 #ifdef ALLOW_SKILLS   
     /* need a literacy skill to learn spells. Also, having a literacy level      /* need a literacy skill to learn spells. Also, having a literacy level
      * lower than the spell will make learning the spell more difficult */       * lower than the spell will make learning the spell more difficult */
     if ( ! change_skill(op,SK_LITERACY)) {      if ( ! change_skill(op,SK_LITERACY)) {
       new_draw_info(NDI_UNIQUE, 0,op,"You can't read! Your attempt fails.");        new_draw_info(NDI_UNIQUE, 0,op,"You can't read! Your attempt fails.");
       return;        return;
     }      }
 #endif  
     if(tmp->stats.sp < 0 || tmp->stats.sp > NROFREALSPELLS      if(tmp->stats.sp < 0 || tmp->stats.sp > NROFREALSPELLS
         || spells[tmp->stats.sp].level>(SK_level(op)+10)) {          || spells[tmp->stats.sp].level>(SK_level(op)+10)) {
       new_draw_info(NDI_UNIQUE, 0,op,"You are unable to decipher the strange symbols.");        new_draw_info(NDI_UNIQUE, 0,op,"You are unable to decipher the strange symbols.");
Line 1584
 
Line 1573
  learn_spell[spells[tmp->stats.sp].cleric ? op->stats.Wis : op->stats.Int]) {   learn_spell[spells[tmp->stats.sp].cleric ? op->stats.Wis : op->stats.Int]) {
       new_draw_info(NDI_UNIQUE, 0,op,"You succeed in learning the spell!");        new_draw_info(NDI_UNIQUE, 0,op,"You succeed in learning the spell!");
       do_learn_spell (op, tmp->stats.sp, 0);        do_learn_spell (op, tmp->stats.sp, 0);
 #ifdef ALLOW_SKILLS /* xp gain to literacy for spell learning */  
         /* xp gain to literacy for spell learning */
       if ( ! QUERY_FLAG (tmp, FLAG_STARTEQUIP))        if ( ! QUERY_FLAG (tmp, FLAG_STARTEQUIP))
         add_exp(op,calc_skill_exp(op,tmp));          add_exp(op,calc_skill_exp(op,tmp));
 #endif  
     } else {      } else {
       play_sound_player_only(op->contr, SOUND_FUMBLE_SPELL,0,0);        play_sound_player_only(op->contr, SOUND_FUMBLE_SPELL,0,0);
       new_draw_info(NDI_UNIQUE, 0,op,"You fail to learn the spell.\n");        new_draw_info(NDI_UNIQUE, 0,op,"You fail to learn the spell.\n");
Line 1616
 
Line 1605
     }      }
   
     if(op->type==PLAYER) {      if(op->type==PLAYER) {
 #ifdef ALLOW_SKILLS /* players need a literacy skill to read stuff! */   /* players need a literacy skill to read stuff! */
  int exp_gain=0;   int exp_gain=0;
   
         if ( ! change_skill(op,SK_LITERACY)) {          if ( ! change_skill(op,SK_LITERACY)) {
Line 1640
 
Line 1629
         SET_FLAG(tmp,FLAG_APPLIED);          SET_FLAG(tmp,FLAG_APPLIED);
         (void) check_skill_to_apply(op,tmp);          (void) check_skill_to_apply(op,tmp);
         CLEAR_FLAG(tmp,FLAG_APPLIED);          CLEAR_FLAG(tmp,FLAG_APPLIED);
   
 #endif/* ALLOW_SKILLS */   
         old_shoot= op->contr->shoottype;          old_shoot= op->contr->shoottype;
         old_spell = op->contr->chosen_spell;          old_spell = op->contr->chosen_spell;
         op->contr->shoottype=range_scroll;          op->contr->shoottype=range_scroll;
Line 1899
 
Line 1886
     }      }
   
   case SKILLSCROLL:    case SKILLSCROLL:
 #ifdef ALLOW_SKILLS /* calls here shouldnt happen, but to be on safe side put here */   
     if (op->type == PLAYER) {      if (op->type == PLAYER) {
       apply_skillscroll (op, tmp);        apply_skillscroll (op, tmp);
       return 1;        return 1;
     }      }
 #endif  
     return 0;      return 0;
   
   case SPELLBOOK:    case SPELLBOOK:
Line 1958
 
Line 1943
   case WAND:    case WAND:
   case ROD:    case ROD:
   case HORN:    case HORN:
 #ifdef ALLOW_SKILLS  
   case SKILL:    case SKILL:
 #endif  
   case BOW:    case BOW:
     if (tmp->env != op)      if (tmp->env != op)
       return 2;   /* not in inventory */        return 2;   /* not in inventory */
Line 2168
 
Line 2151
     switch(op->type) {      switch(op->type) {
     case WEAPON:      case WEAPON:
       (void) change_abil (who,op);        (void) change_abil (who,op);
 #ifdef ALLOW_SKILLS /* 'unready' melee weapons skill if it is current skill */         /* 'unready' melee weapons skill if it is current skill */
       (void) check_skill_to_apply(who,op);        (void) check_skill_to_apply(who,op);
       if(QUERY_FLAG(who,FLAG_READY_WEAPON))         if(QUERY_FLAG(who,FLAG_READY_WEAPON))
  CLEAR_FLAG(who,FLAG_READY_WEAPON);    CLEAR_FLAG(who,FLAG_READY_WEAPON);
 #endif  
       sprintf(buf,"You unwield %s.",query_name(op));        sprintf(buf,"You unwield %s.",query_name(op));
       break;        break;
 #ifdef ALLOW_SKILLS  
     case SKILL:         /* allows objects to impart skills */      case SKILL:         /* allows objects to impart skills */
       if (op != who->chosen_skill) {        if (op != who->chosen_skill) {
           LOG (llevError, "BUG: apply_special(): applied skill is not "            LOG (llevError, "BUG: apply_special(): applied skill is not "
Line 2199
 
Line 2181
       CLEAR_FLAG (who, FLAG_READY_SKILL);        CLEAR_FLAG (who, FLAG_READY_SKILL);
       buf[0] = '\0';        buf[0] = '\0';
       break;        break;
 #endif  
     case ARMOUR:      case ARMOUR:
     case HELMET:      case HELMET:
     case SHIELD:      case SHIELD:
Line 2217
 
Line 2199
     case WAND:      case WAND:
     case ROD:      case ROD:
     case HORN:      case HORN:
 #ifdef ALLOW_SKILLS  
       (void) check_skill_to_apply(who,op);        (void) check_skill_to_apply(who,op);
 #endif  
       sprintf(buf,"You unready %s.",query_name(op));        sprintf(buf,"You unready %s.",query_name(op));
       if(who->type==PLAYER) {        if(who->type==PLAYER) {
         who->contr->shoottype = range_none;          who->contr->shoottype = range_none;
Line 2301
 
Line 2281
   
     SET_FLAG(op, FLAG_APPLIED);      SET_FLAG(op, FLAG_APPLIED);
   
 #ifdef ALLOW_SKILLS       /*check for melee weapons skill, alter player status.   /* check for melee weapons skill, alter player status.
     * Note that we need to call this *before* change_abil */      * Note that we need to call this *before* change_abil */
     if(!check_skill_to_apply(who,op)) return 1;      if(!check_skill_to_apply(who,op)) return 1;
     if(!QUERY_FLAG(who,FLAG_READY_WEAPON))      if(!QUERY_FLAG(who,FLAG_READY_WEAPON))
          SET_FLAG(who, FLAG_READY_WEAPON);           SET_FLAG(who, FLAG_READY_WEAPON);
 #endif  
   
     (void) change_abil (who,op);      (void) change_abil (who,op);
     sprintf(buf,"You wield %s.",query_name(op));      sprintf(buf,"You wield %s.",query_name(op));
Line 2333
 
Line 2312
     (void) change_abil (who,op);      (void) change_abil (who,op);
     sprintf(buf,"You wear %s.",query_name(op));      sprintf(buf,"You wear %s.",query_name(op));
     break;      break;
 #ifdef ALLOW_SKILLS /* this part is needed for skill-tools */   
     /* this part is needed for skill-tools */
   case SKILL:    case SKILL:
     if (who->chosen_skill) {      if (who->chosen_skill) {
         LOG (llevError, "BUG: apply_special(): can't apply two skills\n");          LOG (llevError, "BUG: apply_special(): can't apply two skills\n");
Line 2364
 
Line 2344
     SET_FLAG (who, FLAG_READY_SKILL);      SET_FLAG (who, FLAG_READY_SKILL);
     buf[0] = '\0';      buf[0] = '\0';
     break;      break;
 #endif  
   
   case WAND:    case WAND:
   case ROD:    case ROD:
   case HORN:    case HORN:
   case BOW:    case BOW:
 #ifdef ALLOW_SKILLS /* check for skill, alter player status */       /* check for skill, alter player status */
     SET_FLAG(op, FLAG_APPLIED);      SET_FLAG(op, FLAG_APPLIED);
     if(!check_skill_to_apply(who,op)) return 1;      if(!check_skill_to_apply(who,op)) return 1;
 #endif  
     new_draw_info_format (NDI_UNIQUE, 0, who, "You ready %s.", query_name(op));      new_draw_info_format (NDI_UNIQUE, 0, who, "You ready %s.", query_name(op));
     if(who->type==PLAYER) {      if(who->type==PLAYER) {
       switch (op->type) {        switch (op->type) {


Legend:
line(s) removed in v.1.37 
line(s) changed
 line(s) added in v.1.38

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