Difference for server/spell_effect.c from version 1.143 to 1.144


version 1.143 version 1.144
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_spell_effect_c =   * static char *rcsid_spell_effect_c =
  *   "$Id: spell_effect.c,v 1.143 2005/11/06 12:24:32 ryo_saeba Exp $";   *   "$Id: spell_effect.c,v 1.144 2005/11/16 08:16:09 mwedel Exp $";
  */   */
   
   
Line 341
 
Line 341
      */       */
     if(op->type == 0 || op->arch == NULL ||       if(op->type == 0 || op->arch == NULL ||
        QUERY_FLAG(op,FLAG_NO_PICK)          QUERY_FLAG(op,FLAG_NO_PICK)
        || QUERY_FLAG(op, FLAG_NO_PASS) || op->type == TREASURE)         || op->move_block || op->type == TREASURE)
  return;   return;
   
     tmp = rndm(0, 7);      tmp = rndm(0, 7);
Line 374
 
Line 374
  m = op->map;   m = op->map;
  mflags = get_map_flags(m, &m, x, y, &x, &y);   mflags = get_map_flags(m, &m, x, y, &x, &y);
   
  if (mflags & (P_WALL | P_NO_MAGIC | P_OUT_OF_MAP))   if (mflags & (P_NO_MAGIC | P_OUT_OF_MAP))
        break;
   
    if (GET_MAP_MOVE_BLOCK(m, x, y) & MOVE_FLY_LOW)
      break;       break;
   
  /* Get the top most object */   /* Get the top most object */
Line 674
 
Line 677
     return 1;      return 1;
 }  }
   
 /* earth to dust spell.  Basically destroys earthwalsl in the area.  /* earth to dust spell.  Basically destroys earthwalls in the area.
  */   */
 int cast_earth_to_dust(object *op,object *caster, object *spell_ob) {  int cast_earth_to_dust(object *op,object *caster, object *spell_ob) {
     object *tmp, *next;      object *tmp, *next;
Line 695
 
Line 698
      mflags = get_map_flags(m, &m, sx, sy, &sx, &sy);       mflags = get_map_flags(m, &m, sx, sy, &sx, &sy);
   
      if (mflags & P_OUT_OF_MAP) continue;       if (mflags & P_OUT_OF_MAP) continue;
      /* If the space doesn't block, no wall here to remove */  
      if (mflags & P_BLOCKED) {       /* If the space doesn't block, no wall here to remove
         * Don't care too much what it blocks - this allows for
         * any sort of earthwall/airwall/waterwall, etc
         * type effects.
         */
        if (GET_MAP_MOVE_BLOCK(m, sx, sy)) {
  for(tmp=get_map_ob(m, sx, sy);tmp!=NULL;tmp=next) {   for(tmp=get_map_ob(m, sx, sy);tmp!=NULL;tmp=next) {
      next=tmp->above;       next=tmp->above;
      if(tmp&&QUERY_FLAG(tmp, FLAG_TEAR_DOWN))       if(tmp&&QUERY_FLAG(tmp, FLAG_TEAR_DOWN))
Line 1112
 
Line 1120
     }      }
     m = op->map;      m = op->map;
   
     if ((QUERY_FLAG(spell_ob, FLAG_NO_PASS) || x != op->x || y != op->y) &&      if ((spell_ob->move_block || x != op->x || y != op->y) &&
  get_map_flags(m, &m, x, y, &x, &y) & (P_OUT_OF_MAP | P_BLOCKED)) {        (get_map_flags(m, &m, x, y, &x, &y) & P_OUT_OF_MAP ||
         ((spell_ob->move_block & GET_MAP_MOVE_BLOCK(m, x, y)) == spell_ob->move_block))) {
  new_draw_info(NDI_UNIQUE, 0,op,"Something is in the way.");   new_draw_info(NDI_UNIQUE, 0,op,"Something is in the way.");
  return 0;   return 0;
     }      }
Line 1199
 
Line 1208
  y = tmp->y+i*freearr_y[dir2];   y = tmp->y+i*freearr_y[dir2];
  m = tmp->map;   m = tmp->map;
   
  if(!(get_map_flags(m, &m, x, y, &x, &y) & (P_OUT_OF_MAP | P_BLOCKED)) && !posblocked) {   if(!(get_map_flags(m, &m, x, y, &x, &y) & P_OUT_OF_MAP) &&
      ((tmp->move_block & GET_MAP_MOVE_BLOCK(m, x, y)) != tmp->move_block) &&
      !posblocked) {
      tmp2 = get_object();       tmp2 = get_object();
      copy_object(tmp,tmp2);       copy_object(tmp,tmp2);
      tmp2->x = x;       tmp2->x = x;
Line 1215
 
Line 1226
  y = tmp->y-i*freearr_y[dir2];   y = tmp->y-i*freearr_y[dir2];
  m = tmp->map;   m = tmp->map;
   
  if(!(get_map_flags(m, &m, x, y, &x, &y) & (P_OUT_OF_MAP | P_BLOCKED)) && !negblocked) {   if(!(get_map_flags(m, &m, x, y, &x, &y) & P_OUT_OF_MAP) &&
      ((tmp->move_block & GET_MAP_MOVE_BLOCK(m, x, y)) != tmp->move_block) &&
      !negblocked) {
      tmp2 = get_object();       tmp2 = get_object();
      copy_object(tmp,tmp2);       copy_object(tmp,tmp2);
      tmp2->x = x;       tmp2->x = x;
Line 1235
 
Line 1248
 int dimension_door(object *op,object *caster, object *spob, int dir) {  int dimension_door(object *op,object *caster, object *spob, int dir) {
     uint32 dist, maxdist;      uint32 dist, maxdist;
     int mflags;      int mflags;
       mapstruct *m;
       sint16  sx, sy;
   
     if(op->type!=PLAYER)      if(op->type!=PLAYER)
  return 0;   return 0;
Line 1257
 
Line 1272
  }   }
   
  for(dist=0;dist<op->contr->count; dist++) {   for(dist=0;dist<op->contr->count; dist++) {
      mflags = get_map_flags(op->map, NULL,        mflags = get_map_flags(op->map, &m,
  op->x+freearr_x[dir]*(dist+1), op->y+freearr_y[dir]*(dist+1),   op->x+freearr_x[dir]*(dist+1), op->y+freearr_y[dir]*(dist+1),
  NULL, NULL);   &sx, &sy);
   
      if ((mflags & (P_NO_MAGIC | P_OUT_OF_MAP)) ||       if (mflags & (P_NO_MAGIC | P_OUT_OF_MAP)) break;
  ((mflags & P_NO_PASS) && (mflags & P_BLOCKSVIEW))) break;  
        if ((mflags & P_BLOCKSVIEW) &&
          OB_TYPE_MOVE_BLOCK(op, GET_MAP_MOVE_BLOCK(m, sx, sy))) break;
  }   }
   
  if(dist<op->contr->count) {   if(dist<op->contr->count) {
Line 1279
 
Line 1296
  * lots of other maps that protect areas with no magic, but the   * lots of other maps that protect areas with no magic, but the
  * areas themselves don't contain no magic spaces.   * areas themselves don't contain no magic spaces.
  */   */
  if(get_map_flags(op->map, NULL,    /* This call here is really just to normalize the coordinates */
      op->x+freearr_x[dir]*dist, op->y+freearr_y[dir]*dist,   get_map_flags(op->map, &m,op->x+freearr_x[dir]*dist, op->y+freearr_y[dir]*dist,
      NULL, NULL) & P_BLOCKED) {       &sx, &sy);
    if (OB_TYPE_MOVE_BLOCK(op, GET_MAP_MOVE_BLOCK(m, sx, sy))) {
  new_draw_info(NDI_UNIQUE, 0,op,"You cast your spell, but nothing happens.\n");   new_draw_info(NDI_UNIQUE, 0,op,"You cast your spell, but nothing happens.\n");
  return 1; /* Maybe the penalty should be more severe... */   return 1; /* Maybe the penalty should be more severe... */
  }   }
Line 1292
 
Line 1310
  */   */
   
  for(dist=0; dist < maxdist; dist++) {   for(dist=0; dist < maxdist; dist++) {
      mflags = get_map_flags(op->map, NULL,        mflags = get_map_flags(op->map, &m,
  op->x+freearr_x[dir] * (dist+1),    op->x+freearr_x[dir] * (dist+1),
          op->y+freearr_y[dir] * (dist+1),           op->y+freearr_y[dir] * (dist+1),
          NULL, NULL);           &sx, &sy);
      if ((mflags & (P_NO_MAGIC | P_OUT_OF_MAP)) ||  
  ((mflags & P_NO_PASS) && (mflags & P_BLOCKSVIEW))) {       if (mflags & (P_NO_MAGIC | P_OUT_OF_MAP)) break;
  break;  
      }       if ((mflags & P_BLOCKSVIEW) &&
          OB_TYPE_MOVE_BLOCK(op, GET_MAP_MOVE_BLOCK(m, sx, sy))) break;
   
  }   }
   
  /* If the destination is blocked, keep backing up until we   /* If the destination is blocked, keep backing up until we
  * find a place for the player.   * find a place for the player.
  */   */
  for(;dist>0; dist--)   for(;dist>0; dist--) {
      if ((get_map_flags(op->map,NULL,        if (get_map_flags(op->map, &m,op->x+freearr_x[dir]*dist, op->y+freearr_y[dir]*dist,
        op->x+freearr_x[dir]*dist,     &sx, &sy) & P_OUT_OF_MAP) continue;
        op->y+freearr_y[dir]*dist,  
        NULL, NULL) & (P_BLOCKED | P_OUT_OF_MAP)) ==0)   
  break;       if (!OB_TYPE_MOVE_BLOCK(op, GET_MAP_MOVE_BLOCK(m, sx, sy))) break;
   
    }
  if(!dist) {   if(!dist) {
      new_draw_info(NDI_UNIQUE, 0,op,"Your spell failed!\n");       new_draw_info(NDI_UNIQUE, 0,op,"Your spell failed!\n");
      return 0;       return 0;
Line 1537
 
Line 1558
  }   }
     }      }
      
     if (QUERY_FLAG(spell_ob, FLAG_FLYING))      force->move_type = spell_ob->move_type;
  SET_FLAG(force, FLAG_FLYING);  
   
     if (QUERY_FLAG(spell_ob, FLAG_SEE_IN_DARK))      if (QUERY_FLAG(spell_ob, FLAG_SEE_IN_DARK))
  SET_FLAG(force, FLAG_SEE_IN_DARK);   SET_FLAG(force, FLAG_SEE_IN_DARK);
Line 1785
 
Line 1805
   
      mflags = get_map_flags(mp, &mp, nx, ny, &nx, &ny);       mflags = get_map_flags(mp, &mp, nx, ny, &nx, &ny);
   
      if(mflags & (P_OUT_OF_MAP | P_WALL | P_NO_MAGIC))       if(mflags & (P_OUT_OF_MAP | P_NO_MAGIC))
    continue;
   
        /* Treat alchemy a little differently - most spell effects
         * use fly as the movement type - for alchemy, consider it
         * ground level effect.
         */
        if (GET_MAP_MOVE_BLOCK(mp, nx, ny) & MOVE_WALK)
  continue;   continue;
   
      small_nuggets=0;       small_nuggets=0;
Line 2346
 
Line 2373
     y = op->y+freearr_y[dir];      y = op->y+freearr_y[dir];
   
     /* if there's no place to put the golem, abort */      /* if there's no place to put the golem, abort */
     if((dir==-1) || (get_map_flags(m, &m, x, y, &x, &y) & (P_BLOCKED | P_OUT_OF_MAP))) {      if((dir==-1) || (get_map_flags(m, &m, x, y, &x, &y) &  P_OUT_OF_MAP) ||
         ((spell->other_arch->clone.move_type & GET_MAP_MOVE_BLOCK(m, x, y)) == spell->other_arch->clone.move_type)) {
  new_draw_info(NDI_UNIQUE, 0,op,"There is something in the way.");   new_draw_info(NDI_UNIQUE, 0,op,"There is something in the way.");
  return 0;   return 0;
     }      }
Line 2569
 
Line 2597
 void move_aura(object *aura) {  void move_aura(object *aura) {
     int i, mflags;      int i, mflags;
     object *env;      object *env;
       mapstruct *m;
   
     /* auras belong in inventories */      /* auras belong in inventories */
     env = aura->env;      env = aura->env;
Line 2601
 
Line 2630
  sint16 nx, ny;   sint16 nx, ny;
  nx = aura->x + freearr_x[i];   nx = aura->x + freearr_x[i];
  ny = aura->y + freearr_y[i];   ny = aura->y + freearr_y[i];
  mflags = get_map_flags(env->map, NULL, nx, ny, NULL, NULL);   mflags = get_map_flags(env->map, &m, nx, ny, &nx, &ny);
  if ((mflags & (P_WALL | P_OUT_OF_MAP)) == 0) {  
    /* Consider the movement tyep of the person with the aura as
    * movement type of the aura.  Eg, if the player is flying, the aura
    * is flying also, if player is walking, it is on the ground, etc.
    */
    if (!(mflags & P_OUT_OF_MAP) && !(OB_TYPE_MOVE_BLOCK(env, GET_MAP_MOVE_BLOCK(m, nx, ny)))) {
      hit_map(aura,i,aura->attacktype,0);       hit_map(aura,i,aura->attacktype,0);
   
      if(aura->other_arch) {       if(aura->other_arch) {
  object *new_ob;   object *new_ob;
   
  new_ob = arch_to_object(aura->other_arch);   new_ob = arch_to_object(aura->other_arch);
  new_ob->x = nx;   new_ob->x = nx;
  new_ob->y = ny;   new_ob->y = ny;
  insert_ob_in_map(new_ob,env->map,aura,0);   insert_ob_in_map(new_ob,m,aura,0);
      }       }
  }   }
     }      }
Line 2695
 
Line 2730
     insert_ob_in_map(tmp, op->map, op, INS_BELOW_ORIGINATOR);      insert_ob_in_map(tmp, op->map, op, INS_BELOW_ORIGINATOR);
     return 1;      return 1;
 }  }
   


Legend:
line(s) removed in v.1.143 
line(s) changed
 line(s) added in v.1.144

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