Changeset 583

Show
Ignore:
Timestamp:
09/28/07 11:45:18 (1 year ago)
Author:
takkaria
Message:

Implement parts of #357:

  • Make pseudo-id not occur whilst resting
  • Make items, when worn long enough, get automatically ID'd
  • Introduce one_in_() syntax
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk

    • Property bzr:revision-id:v3-trunk0 changed from
      513 me@rephial.org-20070928002737-5msple19r3ahxzdz
      to
      513 me@rephial.org-20070928002737-5msple19r3ahxzdz
      516 me@rephial.org-20070928154419-ut9r6jjy2hu0r11e
    • Property bzr:revision-info changed from
      timestamp: 2007-09-28 01:27:37.368000031 +0100
      committer: Andrew Sidwell <me@rephial.org>
      properties:
      branch-nick: 365-autoconf
      to
      timestamp: 2007-09-28 16:44:19.459000111 +0100
      committer: Andrew Sidwell <me@rephial.org>
      properties:
      branch-nick: 357
  • trunk/lib/edit/p_class.txt

    r580 r583  
    7070C:25:18:18:1:14:2:70:55 
    7171X:10:7:10:0:0:0:45:45 
    72 I:9:0:9000:40 
     72I:9:0:4000:40 
    7373A:6:30:5 
    7474M:0:0:0:0 
     
    9292C:30:36:30:2:16:20:34:20 
    9393X:7:13:9:0:0:0:15:15 
    94 I:0:30:240000:5 
     94I:0:30:110000:5 
    9595A:4:40:2 
    9696M:90:1:1:300 
     
    263263C:45:32:28:5:32:24:60:66 
    264264X:15:10:10:0:0:0:40:30 
    265 I:6:25:20000:40 
     265I:6:25:10000:40 
    266266A:5:30:3 
    267267M:90:1:5:350 
     
    348348C:30:32:28:3:24:16:56:72 
    349349X:8:10:10:0:0:0:30:45 
    350 I:4:30:30000:40 
     350I:4:30:14000:40 
    351351A:5:35:4 
    352352M:90:1:3:400 
     
    434434C:20:24:25:1:12:2:68:40 
    435435X:7:10:11:0:0:0:35:30 
    436 I:6:35:80000:40 
     436I:6:35:40000:40 
    437437A:5:30:5 
    438438M:91:2:1:400 
  • trunk/src/dungeon.c

    r565 r583  
    109109        char o_name[80]; 
    110110 
    111  
    112         /*** Check for "sensing" ***/ 
    113  
    114         /* No sensing when confused */ 
     111        unsigned int rate; 
     112 
     113 
     114        /* No ID when resting or confused */ 
     115        if (p_ptr->resting) return; 
    115116        if (p_ptr->timed[TMD_CONFUSED]) return; 
    116117 
     118 
     119        /* Get improvement rate */ 
    117120        if (cp_ptr->flags & CF_PSEUDO_ID_IMPROV) 
    118         { 
    119                 if (0 != rand_int(cp_ptr->sense_base / (plev * plev + cp_ptr->sense_div))) 
    120                         return; 
    121         } 
     121                rate = cp_ptr->sense_base / (plev * plev + cp_ptr->sense_div); 
    122122        else 
    123         { 
    124                 if (0 != rand_int(cp_ptr->sense_base / (plev + cp_ptr->sense_div))) 
    125                         return; 
    126         } 
    127  
    128  
    129         /*** Sense everything ***/ 
     123                rate = cp_ptr->sense_base / (plev + cp_ptr->sense_div); 
     124 
     125        if (!one_in_(rate)) return; 
     126 
    130127 
    131128        /* Check everything */ 
     
    168165                if (!okay) continue; 
    169166 
     167                /* It is known, no information needed */ 
     168                if (object_known_p(o_ptr)) continue; 
     169 
     170 
     171                /* It has already been sensed, do not sense it again */ 
     172                if (o_ptr->ident & (IDENT_SENSE)) 
     173                { 
     174                        /* Small chance of wielded, sensed items getting complete ID */ 
     175                        if (!o_ptr->name1 && (i >= INVEN_WIELD) && one_in_(1000)) 
     176                                do_ident_item(i, o_ptr); 
     177 
     178                        continue; 
     179                } 
     180 
     181                /* Occasional failure on inventory items */ 
     182                if ((i < INVEN_WIELD) && one_in_(5)) continue; 
     183 
     184 
     185 
    170186                /* It's already been pseudo-ID'd */ 
    171187                if (o_ptr->pseudo && 
    172188                    o_ptr->pseudo != INSCRIP_INDESTRUCTIBLE) continue; 
    173  
    174                 /* It has already been sensed, do not sense it again */ 
    175                 if (o_ptr->ident & (IDENT_SENSE)) continue; 
    176  
    177                 /* It is known, no information needed */ 
    178                 if (object_known_p(o_ptr)) continue; 
    179  
    180                 /* Occasional failure on inventory items */ 
    181                 if ((i < INVEN_WIELD) && (0 != rand_int(5))) continue; 
    182189 
    183190                /* Indestructible objects are either excellent or terrible */ 
  • trunk/src/z-rand.h

    r569 r583  
    5252 
    5353 
     54/** 
     55 * Return TRUE one time in `x`. 
     56 */ 
     57#define one_in_(x)              (!rand_int(x)) 
    5458 
    5559/**** Available Variables ****/