diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dungeon.c | 59 | ||||
-rw-r--r-- | src/externs.h | 2 | ||||
-rw-r--r-- | src/object.pkg | 1 | ||||
-rw-r--r-- | src/object1.c | 3 |
4 files changed, 16 insertions, 49 deletions
diff --git a/src/dungeon.c b/src/dungeon.c index fca12173..dc5c421f 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -154,8 +154,8 @@ byte value_check_aux2(object_type *o_ptr) /* Good weapon bonuses */ if (o_ptr->to_h + o_ptr->to_d > 0) return (SENSE_GOOD_LIGHT); - /* No feeling */ - return (SENSE_NONE); + /* Default to "average" */ + return (SENSE_AVERAGE); } @@ -239,7 +239,7 @@ static bool granted_resurrection(void) return (FALSE); } -byte select_sense(object_type *o_ptr, bool ok_combat, bool ok_magic) +static byte select_sense(object_type *o_ptr) { /* Valid "tval" codes */ switch (o_ptr->tval) @@ -266,7 +266,7 @@ byte select_sense(object_type *o_ptr, bool ok_combat, bool ok_magic) case TV_BOOMERANG: case TV_TRAPKIT: { - if (ok_combat) return 1; + return 1; break; } @@ -278,14 +278,14 @@ byte select_sense(object_type *o_ptr, bool ok_combat, bool ok_magic) case TV_ROD: case TV_ROD_MAIN: { - if (ok_magic) return 2; + return 2; break; } /* Dual use? */ case TV_DAEMON_BOOK: { - if (ok_combat || ok_magic) return 1; + return 1; break; } } @@ -305,12 +305,11 @@ byte select_sense(object_type *o_ptr, bool ok_combat, bool ok_magic) * they learn one form of ID or another, and because most magic items are * easy_know. */ -static void sense_inventory(void) +void sense_inventory(void) { int i, combat_lev, magic_lev; bool heavy_combat, heavy_magic; - bool ok_combat, ok_magic; byte feel; @@ -324,14 +323,6 @@ static void sense_inventory(void) /* No sensing when confused */ if (p_ptr->confused) return; - /* Can we pseudo id */ -#if 0 - - if (0 == rand_int(133 - get_skill_scale(SKILL_COMBAT, 130))) ok_combat = TRUE; - if (0 == rand_int(133 - get_skill_scale(SKILL_MAGIC, 130))) ok_magic = TRUE; - -#endif - /* * In Angband, the chance of pseudo-id uses two different formulae: * @@ -360,23 +351,9 @@ static void sense_inventory(void) /* The combat skill affects weapon/armour pseudo-ID */ combat_lev = get_skill(SKILL_COMBAT); - /* Use the fast formula */ - ok_combat = (0 == rand_int(9000L / (combat_lev * combat_lev + 40))); - /* The magic skill affects magic item pseudo-ID */ magic_lev = get_skill(SKILL_MAGIC); - /* - * Use the slow formula, because spellcasters have id spells - * - * Lowered the base value because V rangers are known to have - * pretty useless pseudo-ID. This should make it ten times more often. - */ - ok_magic = (0 == rand_int(12000L / (magic_lev + 5))); - - /* Both ID rolls failed */ - if (!ok_combat && !ok_magic) return; - /* Higher skill levels give the player better sense of items */ heavy_combat = (combat_lev > 10) ? TRUE : FALSE; heavy_magic = (magic_lev > 10) ? TRUE : FALSE; @@ -394,20 +371,17 @@ static void sense_inventory(void) /* Skip empty slots */ if (!o_ptr->k_idx) continue; - /* Valid "tval" codes */ - okay = select_sense(o_ptr, ok_combat, ok_magic); - - /* Skip non-sense machines */ - if (!okay) continue; - /* We know about it already, do not tell us again */ if (o_ptr->ident & (IDENT_SENSE)) continue; /* It is fully known, no information needed */ if (object_known_p(o_ptr)) continue; - /* Occasional failure on inventory items */ - if ((i < INVEN_WIELD) && (0 != rand_int(5))) continue; + /* Valid "tval" codes */ + okay = select_sense(o_ptr); + + /* Skip non-sense machines */ + if (!okay) continue; /* Check for a feeling */ if (okay == 1) @@ -422,9 +396,6 @@ static void sense_inventory(void) /* Skip non-feelings */ if (feel == SENSE_NONE) continue; - /* Stop everything */ - if (disturb_minor) disturb(0, 0); - /* Get an object description */ object_desc(o_name, o_ptr, FALSE, 0); @@ -3239,12 +3210,6 @@ static void process_world(void) p_ptr->window |= (PW_INVEN); } - /* Feel the p_ptr->inventory */ - if (dun_level || (!p_ptr->wild_mode)) - { - sense_inventory(); - } - /*** Process Objects ***/ /* Process objects */ diff --git a/src/externs.h b/src/externs.h index fbc11627..6a11847a 100644 --- a/src/externs.h +++ b/src/externs.h @@ -887,8 +887,8 @@ extern byte value_check_aux1(object_type *o_ptr); extern byte value_check_aux1_magic(object_type *o_ptr); extern byte value_check_aux2(object_type *o_ptr); extern byte value_check_aux2_magic(object_type *o_ptr); -extern byte select_sense(object_type *o_ptr, bool ok_combat, bool ok_magic); extern void play_game(bool new_game); +extern void sense_inventory(); extern bool psychometry(void); /* files.c */ diff --git a/src/object.pkg b/src/object.pkg index 0141b5f1..feb9a712 100644 --- a/src/object.pkg +++ b/src/object.pkg @@ -1165,7 +1165,6 @@ extern byte value_check_aux1(object_type *o_ptr); extern byte value_check_aux1_magic(object_type *o_ptr); extern byte value_check_aux2(object_type *o_ptr); extern byte value_check_aux2_magic(object_type *o_ptr); -extern byte select_sense(object_type *o_ptr, bool ok_combat, bool ok_magic); extern bool psychometry(void); extern bool remove_curse_object(object_type *o_ptr, bool all); diff --git a/src/object1.c b/src/object1.c index 0592eb8a..f0ab3289 100644 --- a/src/object1.c +++ b/src/object1.c @@ -6357,6 +6357,9 @@ void object_pickup(int this_o_idx) /* Delete the object */ delete_object_idx(this_o_idx); + + /* Sense object. */ + sense_inventory(); } } } |