[CF-Devel] rings with fire/cold immu?

Andreas Vogl andi.vogl at gmx.net
Fri Sep 15 09:42:29 CDT 2000


on Fri, 15 Sep 2000 the seer wrote:
>
     
      You're wrong, unfortunately.  I do mean immunities.  The first
     
     >
     
      ring I ever got was a ring imm. to cold and fire.  If they're not
     
     >
     
      supposed to be there, then someone needs to look at the code,
     
     >
     
      because they do crop up from time to time.
     
     
I don't know what to say... The thought of rings with fire/cold
immu doesn't please me. I've never heard of it before, nor have
I ever seen such a ring.

However, truth can only be found in the code:
The function set_ring_bonus() in common/treasure.c is the one
and only function that adds random bonuses to rings as far as
I know.
I've included the function into this post, it's quite readable
code. As you can see, there's no fire/cold immu but protection
only.

Are you sure that you are using the current crossfire version
0.95.6 ? And did you use it when you found that immu ring?
Of course it could also be me who is wrong. Please, one of you
developer-experts out there: Help me! Are rings with fire/cold
immu possible after all? Might there be a *hidden* second function
for ring bonuses or sth?

common/treasure.c:
^^^^^^^^^^^^^^^^^^

/*
 * Randomly adds one magical ability to the given object.
 */

void set_ring_bonus(object *op,int bonus)
{
  int r=RANDOM()%(bonus>0?25:11);

  if(op->type==AMULET)
  {
    if(!(RANDOM()%21))
      r=20+RANDOM()%2;
    else
    {
      if(RANDOM()&2)
        r=10;
      else
        r=11+RANDOM()%9;
    }
  }

  switch(r)
  {
  
  ...
  
  case 11:
    if(bonus==2) { /* Maybe make an artifact of this? */
      op->immune|=AT_PARALYZE;
      op->immune|=AT_SLOW;
      op->stats.exp+=1;
      op->value*=5;
    } else
      op->protected|=AT_PARALYZE;
    break;
  case 12:
    op->protected|=AT_MAGIC;
    op->value*=2;
    break;
  case 13:
    op->protected|=AT_ELECTRICITY;
    break;
  case 14:
    op->protected|=AT_FIRE;        /* <- fire protection only */
    op->vulnerable|=AT_COLD;
    op->value=(op->value*3)/2;
    break;
  case 15:
    op->protected|=AT_DRAIN;
    break;
  case 16:
    op->protected|=AT_SLOW;
    break;
  case 17:
    op->protected|=AT_COLD;        /* <- cold protection only */
    op->vulnerable|=AT_FIRE;
    break;
  case 18:
    op->protected|=AT_POISON;
    break;
  case 19:
    op->protected|=AT_FEAR;
    break;
  
  ...
  
  }
  
  if(bonus>0)
    op->value*=2*bonus;
  else
    op->value= -(op->value*2*bonus)/3;
}

---
Andreas V.

-- 
Sent through GMX FreeMail - 
     
     http://www.gmx.net
     
     
    


More information about the crossfire mailing list