Changeset 580

Show
Ignore:
Timestamp:
09/28/07 09:19:45 (10 months ago)
Author:
takkaria
Message:

Tweak the way detection works a bit (#263):

  • Make detect treasure always detect objects, gold, and buried gold over the entire level.
  • Make door/stair detection work over the entire level, and make it a bit more expensive.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk

    • Property bzr:revision-id:v3-trunk0 set to
      513 me@rephial.org-20070928112818-0w6plp46k8exdip2
    • Property bzr:file-ids set
    • Property bzr:revision-info set to
      timestamp: 2007-09-28 12:28:18.029999971 +0100
      committer: Andrew Sidwell <me@rephial.org>
      properties:
      branch-nick: 263-radius
  • trunk/lib/edit/object.txt

    r567 r580  
    15491549G:?:w 
    15501550I:70:26:0 
    1551 W:0:0:5:15 
     1551W:0:0:5:30 
    15521552A:100:0 to 100 
    15531553F:EASY_KNOW 
    1554 E:DET_GOLD 
     1554E:DET_TREASURE 
    15551555 
    15561556N:193:Object Detection 
     
    15581558I:70:27:0 
    15591559W:0:0:5:15 
    1560 A:100:0 to 100 
    1561 F:EASY_KNOW 
    1562 E:DET_OBJ 
     1560F:EASY_KNOW 
     1561E:DET_TREASURE 
    15631562 
    15641563N:194:Trap Detection 
     
    15771576G:?:w 
    15781577I:70:29:0 
    1579 W:5:0:5:35 
     1578W:5:0:5:60 
    15801579A:100:5 to 100 
    15811580F:EASY_KNOW 
     
    24242423W:5:0:50:400 
    24252424A:100:5 to 100 
    2426 E:DET_GOLD:35 
     2425E:DET_TREASURE:50 
    24272426 
    24282427N:302:Object Location 
     
    24302429I:66:29:0 
    24312430W:5:0:50:200 
    2432 A:100:5 to 100 
    2433 E:DET_OBJ:35 
     2431E:DET_TREASURE:35 
    24342432 
    24352433 
  • trunk/lib/edit/p_class.txt

    r305 r580  
    116116B:5:3:3:25:3 
    117117B:6:99:0:0:0 
    118 B:7:99:0:0:0 
    119118B:8:11:7:25:6 
    120119B:9:15:5:40:6 
     
    288287B:5:11:4:65:1 
    289288B:6:10:3:60:1 
    290 B:7:12:4:65:1 
    291289B:8:18:18:60:2 
    292290B:9:20:10:50:4 
     
    375373B:5:5:3:40:1 
    376374B:6:99:0:0:0 
    377 B:7:99:0:0:0 
    378375B:8:23:25:90:3 
    379376B:9:25:15:50:4 
  • trunk/lib/edit/spell.txt

    r367 r580  
    7878I:90:0:4 
    7979D:Detects all treasure in the immediate area. 
    80  
    81 N:7:Detect Objects 
    82 I:90:0:6 
    83 D:Detects all objects in the immediate area. 
    8480 
    8581N:8:Identify 
  • trunk/src/effects.c

    r558 r580  
    565565                        (void)do_inc_stat(A_WIS); 
    566566                        (void)detect_traps(); 
    567                         (void)detect_doors(); 
    568                         (void)detect_stairs(); 
     567                        (void)detect_doorstairs(); 
    569568                        (void)detect_treasure(); 
    570                         (void)detect_objects_gold(); 
    571                         (void)detect_objects_normal(); 
    572569                        identify_pack(); 
    573570                        self_knowledge(TRUE); 
     
    627624                } 
    628625 
    629  
    630                 case EF_DET_GOLD: 
     626                case EF_DET_TREASURE: 
    631627                { 
    632628                        if (detect_treasure()) *ident = TRUE; 
    633                         if (detect_objects_gold()) *ident = TRUE; 
    634                         return TRUE; 
    635                 } 
    636  
    637                 case EF_DET_OBJ: 
    638                 { 
    639                         if (detect_objects_normal()) *ident = TRUE; 
    640629                        return TRUE; 
    641630                } 
     
    649638                case EF_DET_DOORSTAIR: 
    650639                { 
    651                         if (detect_doors()) *ident = TRUE; 
    652                         if (detect_stairs()) *ident = TRUE; 
     640                        if (detect_doorstairs()) *ident = TRUE; 
    653641                        return TRUE; 
    654642                } 
     
    971959                        wiz_lite(); 
    972960                        (void)detect_traps(); 
    973                         (void)detect_doors(); 
    974                         (void)detect_stairs(); 
     961                        (void)detect_doorstairs(); 
    975962                        return TRUE; 
    976963                } 
  • trunk/src/effects.h

    r543 r580  
    122122        EFFECT(RESIST_ALL,     FALSE, "grants resistance to everything!!!") 
    123123 
    124         EFFECT(DET_GOLD,       FALSE, "detects all treasure in the surrounding area") 
    125         EFFECT(DET_OBJ,        FALSE, "detects all objects in the surrounding area") 
     124        EFFECT(DET_TREASURE,   FALSE, "detects all gold and objects on the level") 
    126125        EFFECT(DET_TRAP,       FALSE, "detects all traps in the surrounding area") 
    127         EFFECT(DET_DOORSTAIR,  FALSE, "detects all doors and stairs in the surrounding area") 
     126        EFFECT(DET_DOORSTAIR,  FALSE, "detects all doors and stairs on the level") 
    128127        EFFECT(DET_INVIS,      FALSE, "detects all invisible creatures in the surrounding area") 
    129128        EFFECT(DET_EVIL,       FALSE, "detects all evil creatures in the immidiate area") 
  • trunk/src/externs.h

    r567 r580  
    535535extern void set_recall(void); 
    536536extern bool detect_traps(void); 
    537 extern bool detect_doors(void); 
    538 extern bool detect_stairs(void); 
     537extern bool detect_doorstairs(void); 
    539538extern bool detect_treasure(void); 
    540 extern bool detect_objects_gold(void); 
    541 extern bool detect_objects_normal(void); 
    542539extern bool detect_objects_magic(void); 
    543540extern bool detect_monsters_normal(void); 
  • trunk/src/load.c

    r557 r580  
    10911091        else 
    10921092        { 
     1093                int cnt; 
     1094 
    10931095                /* Read the number of spells */ 
    10941096                rd_u16b(&tmp16u); 
     
    11001102 
    11011103                /* Read the spell flags */ 
    1102                 for (i = 0; i < tmp16u; i++) 
    1103                 { 
    1104                         rd_byte(&p_ptr->spell_flags[i]); 
     1104                for (i = 0, cnt = 0; i < tmp16u; i++, cnt++) 
     1105                { 
     1106                        rd_byte(&p_ptr->spell_flags[cnt]); 
     1107                        if (p_ptr->spell_order[cnt] == 7) 
     1108                                cnt--; 
    11051109                } 
    11061110 
    11071111                /* Read the spell order */ 
    1108                 for (i = 0; i < tmp16u; i++) 
    1109                 { 
    1110                         rd_byte(&p_ptr->spell_order[i]); 
     1112                for (i = 0, cnt = 0; i < tmp16u; i++, cnt++) 
     1113                { 
     1114                        rd_byte(&p_ptr->spell_order[cnt]); 
     1115                        if (p_ptr->spell_order[cnt] == 7) 
     1116                                cnt--; 
    11111117                } 
    11121118        } 
  • trunk/src/spells2.c

    r532 r580  
    10121012 
    10131013/* 
    1014  * Detect all doors inside radius 22
    1015  */ 
    1016 bool detect_doors(void) 
     1014 * Detect all doors and stairs
     1015 */ 
     1016bool detect_doorstairs(void) 
    10171017{ 
    10181018        int y, x; 
    1019  
    1020         bool detect = FALSE; 
     1019        bool doors = FALSE, stairs = FALSE; 
    10211020 
    10221021 
     
    10281027                        if (!in_bounds_fully(y, x)) continue; 
    10291028 
    1030                         /* Restrict to being in a certain radius */ 
    1031                         if (distance(p_ptr->py, p_ptr->px, y, x) > DET_RADIUS) continue; 
    1032  
    10331029                        /* Detect secret doors */ 
    10341030                        if (cave_feat[y][x] == FEAT_SECRET) 
    1035                         { 
    1036                                 /* Pick a door */ 
    10371031                                place_closed_door(y, x); 
    1038                         } 
    10391032 
    10401033                        /* Detect doors */ 
     
    10511044 
    10521045                                /* Obvious */ 
    1053                                 detect = TRUE; 
     1046                                doors = TRUE; 
    10541047                        } 
    1055                 } 
    1056         } 
    1057  
    1058         /* Describe */ 
    1059         if (detect) 
    1060         { 
    1061                 msg_print("You sense the presence of doors!"); 
    1062         } 
    1063  
    1064         /* Result */ 
    1065         return (detect); 
    1066 } 
    1067  
    1068  
    1069 /* 
    1070  * Detect all stairs inside radius 22. 
    1071  */ 
    1072 bool detect_stairs(void) 
    1073 { 
    1074         int y, x; 
    1075  
    1076         bool detect = FALSE; 
    1077  
    1078  
    1079         /* Scan the dungeon */ 
    1080         for (y = 1; y < DUNGEON_HGT - 1; y++) 
    1081         { 
    1082                 for (x = 1; x < DUNGEON_WID - 1; x++) 
    1083                 { 
    1084                         if (!in_bounds_fully(y, x)) continue; 
    1085  
    1086                         /* Restrict to being in a certain radius */ 
    1087                         if (distance(p_ptr->py, p_ptr->px, y, x) > DET_RADIUS) continue; 
    10881048 
    10891049                        /* Detect stairs */ 
     
    10981058 
    10991059                                /* Obvious */ 
    1100                                 detect = TRUE; 
     1060                                stairs = TRUE; 
    11011061                        } 
     1062 
    11021063                } 
    11031064        } 
    11041065 
    11051066        /* Describe */ 
    1106         if (detect) 
    1107         { 
    1108                 msg_print("You sense the presence of stairs!"); 
    1109         } 
     1067        if (doors && !stairs)      msg_print("You sense the presence of doors!"); 
     1068        else if (!doors && stairs) msg_print("You sense the presence of stairs!"); 
     1069        else if (doors && stairs)  msg_print("You sense the presence of doors and stairs!"); 
    11101070 
    11111071        /* Result */ 
    1112         return (detect); 
     1072        return (doors || stairs); 
    11131073} 
    11141074 
     
    11191079bool detect_treasure(void) 
    11201080{ 
     1081        int i; 
    11211082        int y, x; 
    11221083 
    1123         bool detect = FALSE; 
     1084        bool gold_buried = FALSE; 
     1085        bool gold_object = FALSE; 
     1086        bool objects = FALSE; 
    11241087 
    11251088 
     
    11301093                { 
    11311094                        if (!in_bounds_fully(y, x)) continue; 
    1132  
    1133                         /* Restrict to being in a certain radius */ 
    1134                         if (distance(p_ptr->py, p_ptr->px, y, x) > DET_RADIUS) continue; 
    11351095 
    11361096                        /* Notice embedded gold */ 
     
    11531113 
    11541114                                /* Detect */ 
    1155                                 detect = TRUE; 
     1115                                gold_buried = TRUE; 
    11561116                        } 
    11571117                } 
    11581118        } 
    1159  
    1160         /* Describe */ 
    1161         if (detect) 
    1162         { 
    1163                 msg_print("You sense the presence of buried treasure!"); 
    1164         } 
    1165  
    1166         /* Result */ 
    1167         return (detect); 
    1168 } 
    1169  
    1170  
    1171  
    1172 /* 
    1173  * Detect all "gold" objects inside radius 22. 
    1174  */ 
    1175 bool detect_objects_gold(void) 
    1176 { 
    1177         int i, y, x; 
    1178  
    1179         bool detect = FALSE; 
    1180  
    11811119 
    11821120        /* Scan objects */ 
     
    11951133                x = o_ptr->ix; 
    11961134 
    1197                 /* Only detect nearby objects */ 
    1198                 if (distance(p_ptr->py, p_ptr->px, y, x) > DET_RADIUS) continue; 
    1199  
    1200                 /* Detect "gold" objects */ 
    1201                 if (o_ptr->tval == TV_GOLD) 
    1202                 { 
    1203                         /* Hack -- memorize it */ 
    1204                         o_ptr->marked = TRUE; 
    1205  
    1206                         /* Redraw */ 
    1207                         lite_spot(y, x); 
    1208  
    1209                         /* Detect */ 
    1210                         detect = TRUE; 
    1211                 } 
    1212         } 
    1213  
    1214         /* Describe */ 
    1215         if (detect) 
    1216         { 
     1135                /* Hack -- memorize it */ 
     1136                o_ptr->marked = TRUE; 
     1137 
     1138                /* Redraw */ 
     1139                lite_spot(y, x); 
     1140 
     1141                /* Detect */ 
     1142                if (!squelch_hide_item(o_ptr)) 
     1143                        objects = TRUE; 
     1144        } 
     1145 
     1146        if (gold_object) 
    12171147                msg_print("You sense the presence of treasure!"); 
    1218         } 
    1219  
    1220         /* Result */ 
    1221         return (detect); 
    1222 
    1223  
    1224  
    1225 /* 
    1226  * Detect all "normal" objects inisde radius 22. 
    1227  */ 
    1228 bool detect_objects_normal(void) 
    1229 
    1230         int i, y, x; 
    1231  
    1232         bool detect = FALSE; 
    1233  
    1234  
    1235         /* Scan objects */ 
    1236         for (i = 1; i < o_max; i++) 
    1237         { 
    1238                 object_type *o_ptr = &o_list[i]; 
    1239  
    1240                 /* Skip dead objects */ 
    1241                 if (!o_ptr->k_idx) continue; 
    1242  
    1243                 /* Skip held objects */ 
    1244                 if (o_ptr->held_m_idx) continue; 
    1245  
    1246                 /* Location */ 
    1247                 y = o_ptr->iy; 
    1248                 x = o_ptr->ix; 
    1249  
    1250                 /* Only detect nearby objects */ 
    1251                 if (distance(p_ptr->py, p_ptr->px, y, x) > DET_RADIUS) continue; 
    1252  
    1253                 /* Detect "real" objects */ 
    1254                 if (o_ptr->tval != TV_GOLD) 
    1255                 { 
    1256                         /* Hack -- memorize it */ 
    1257                         o_ptr->marked = TRUE; 
    1258  
    1259                         /* Redraw */ 
    1260                         lite_spot(y, x); 
    1261  
    1262                         /* Detect */ 
    1263                         if (!squelch_hide_item(o_ptr)) 
    1264                                 detect = TRUE; 
    1265                 } 
    1266         } 
    1267  
    1268         /* Describe */ 
    1269         if (detect) 
    1270         { 
     1148 
     1149        if (gold_buried) 
     1150                msg_print("You sense the presence of buried treasure!"); 
     1151 
     1152        if (objects) 
    12711153                msg_print("You sense the presence of objects!"); 
    1272         } 
    1273  
    1274         /* Result */ 
    1275         return (detect); 
     1154 
     1155        return (gold_object || gold_buried || objects); 
    12761156} 
    12771157 
     
    13341214        } 
    13351215 
    1336         /* Describe */ 
    13371216        if (detect) 
    1338         { 
    13391217                msg_print("You sense the presence of magic objects!"); 
    1340         } 
    1341  
    1342         /* Return result */ 
    1343         return (detect); 
     1218 
     1219        return detect; 
    13441220} 
    13451221 
     
    13881264        } 
    13891265 
    1390         /* Describe */ 
    13911266        if (flag) 
    1392         { 
    1393                 /* Describe result */ 
    13941267                msg_print("You sense the presence of monsters!"); 
    1395         } 
    13961268 
    13971269        /* Result */ 
    1398         return (flag)
     1270        return flag
    13991271} 
    14001272 
     
    14541326        } 
    14551327 
    1456         /* Describe */ 
    14571328        if (flag) 
    1458         { 
    1459                 /* Describe result */ 
    14601329                msg_print("You sense the presence of invisible creatures!"); 
    1461         } 
    1462  
    1463         /* Result */ 
     1330 
    14641331        return (flag); 
    14651332} 
     
    15211388        } 
    15221389 
    1523         /* Describe */ 
    15241390        if (flag) 
    1525         { 
    1526                 /* Describe result */ 
    15271391                msg_print("You sense the presence of evil creatures!"); 
    1528         } 
    1529  
    1530         /* Result */ 
    1531         return (flag); 
     1392 
     1393        return flag; 
    15321394} 
    15331395 
     
    15431405        /* Detect everything */ 
    15441406        if (detect_traps()) detect = TRUE; 
    1545         if (detect_doors()) detect = TRUE; 
    1546         if (detect_stairs()) detect = TRUE; 
     1407        if (detect_doorstairs()) detect = TRUE; 
    15471408        if (detect_treasure()) detect = TRUE; 
    1548         if (detect_objects_gold()) detect = TRUE; 
    1549         if (detect_objects_normal()) detect = TRUE; 
    15501409        if (detect_monsters_invis()) detect = TRUE; 
    15511410        if (detect_monsters_normal()) detect = TRUE; 
  • trunk/src/x-spell.c

    r507 r580  
    3232#define SPELL_CURE_LIGHT_WOUNDS         5 
    3333#define SPELL_TREASURE_DETECTION        6 
    34 #define SPELL_OBJECT_DETECTION          7 
     34/* #define SPELL_OBJECT_DETECTION          7 */ 
    3535#define SPELL_IDENTIFY                  8 
    3636#define SPELL_DETECT_INVISIBLE          9 
     
    510510                { 
    511511                        (void)detect_treasure(); 
    512                         (void)detect_objects_gold(); 
    513512                        break; 
    514513                } 
     
    522521                } 
    523522 
    524                 case SPELL_OBJECT_DETECTION: 
    525                 { 
    526                         (void)detect_objects_normal(); 
    527                         break; 
    528                 } 
    529  
    530523                case SPELL_FIND_TRAPS_DOORS: 
    531524                { 
    532525                        (void)detect_traps(); 
    533                         (void)detect_doors(); 
    534                         (void)detect_stairs(); 
     526                        (void)detect_doorstairs(); 
    535527                        break; 
    536528                } 
     
    968960                case PRAYER_DETECT_DOORS_STAIRS: 
    969961                { 
    970                         (void)detect_doors(); 
    971                         (void)detect_stairs(); 
     962                        (void)detect_doorstairs(); 
    972963                        break; 
    973964                }