summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/it_use2.cc24
-rw-r--r--crawl-ref/source/item_use.cc104
-rw-r--r--crawl-ref/source/player.cc48
-rw-r--r--crawl-ref/source/player.h1
4 files changed, 152 insertions, 25 deletions
diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc
index c6cac55f36..955bd69e98 100644
--- a/crawl-ref/source/it_use2.cc
+++ b/crawl-ref/source/it_use2.cc
@@ -593,19 +593,35 @@ void unuse_randart(const item_def &item)
{
ASSERT( is_random_artefact( item ) );
+ const bool ident = fully_identified(item);
+
randart_properties_t proprt;
randart_wpn_properties( item, proprt );
if (proprt[RAP_AC])
+ {
you.redraw_armour_class = 1;
+ if (!ident)
+ {
+ mprf("You feel less %s.",
+ proprt[RAP_AC] > 0? "well-protected" : "vulnerable");
+ }
+ }
if (proprt[RAP_EVASION])
+ {
you.redraw_evasion = 1;
+ if (!ident)
+ {
+ mprf("You feel less %s.",
+ proprt[RAP_EVASION] > 0? "nimble" : "awkward");
+ }
+ }
- // modify ability scores
- modify_stat( STAT_STRENGTH, -proprt[RAP_STRENGTH], true );
- modify_stat( STAT_INTELLIGENCE, -proprt[RAP_INTELLIGENCE], true );
- modify_stat( STAT_DEXTERITY, -proprt[RAP_DEXTERITY], true );
+ // modify ability scores, always output messages
+ modify_stat( STAT_STRENGTH, -proprt[RAP_STRENGTH], false );
+ modify_stat( STAT_INTELLIGENCE, -proprt[RAP_INTELLIGENCE], false );
+ modify_stat( STAT_DEXTERITY, -proprt[RAP_DEXTERITY], false );
if (proprt[RAP_NOISES] != 0)
you.special_wield = SPWLD_NONE;
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index a16b8c6e88..5988e2c255 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -2239,6 +2239,12 @@ void jewellery_wear_effects(item_def &item)
{
item_type_id_state_type ident = ID_TRIED_TYPE;
+ // Randart jewellery shouldn't auto-ID just because the
+ // base type is known. Somehow the player should still
+ // be told, preferably by message. (jpeg)
+ const bool artefact = is_random_artefact( item );
+ const bool identified = fully_identified( item );
+
switch (item.sub_type)
{
case RING_FIRE:
@@ -2261,63 +2267,86 @@ void jewellery_wear_effects(item_def &item)
case RING_PROTECTION:
you.redraw_armour_class = 1;
if (item.plus != 0)
- ident = ID_KNOWN_TYPE;
+ {
+ if (!artefact)
+ ident = ID_KNOWN_TYPE;
+ else if (!identified)
+ {
+ mprf("You feel %s.", item.plus > 0?
+ "well-protected" : "more vulnerable");
+ }
+ }
break;
case RING_INVISIBILITY:
if (!you.duration[DUR_INVIS])
{
mpr("You become transparent for a moment.");
- ident = ID_KNOWN_TYPE;
+ if (!artefact)
+ ident = ID_KNOWN_TYPE;
}
break;
case RING_EVASION:
you.redraw_evasion = 1;
if (item.plus != 0)
- ident = ID_KNOWN_TYPE;
+ {
+ if (!artefact)
+ ident = ID_KNOWN_TYPE;
+ else if (!identified)
+ mprf("You feel %s.", item.plus > 0? "nimbler" : "more awkward");
+ }
break;
case RING_STRENGTH:
- modify_stat(STAT_STRENGTH, item.plus, true);
- if (item.plus != 0)
+ modify_stat(STAT_STRENGTH, item.plus, !artefact);
+ if (item.plus != 0 && !artefact)
ident = ID_KNOWN_TYPE;
break;
case RING_DEXTERITY:
- modify_stat(STAT_DEXTERITY, item.plus, true);
- if (item.plus != 0)
+ modify_stat(STAT_DEXTERITY, item.plus, !artefact);
+ if (item.plus != 0 && !artefact)
ident = ID_KNOWN_TYPE;
break;
case RING_INTELLIGENCE:
- modify_stat(STAT_INTELLIGENCE, item.plus, true);
- if (item.plus != 0)
+ modify_stat(STAT_INTELLIGENCE, item.plus, !artefact);
+ if (item.plus != 0 && !artefact)
ident = ID_KNOWN_TYPE;
break;
case RING_MAGICAL_POWER:
calc_mp();
- ident = ID_KNOWN_TYPE;
+ if (!artefact)
+ ident = ID_KNOWN_TYPE;
break;
case RING_LEVITATION:
- mpr("You feel buoyant.");
- ident = ID_KNOWN_TYPE;
+ if (!scan_randarts( RAP_LEVITATE ))
+ {
+ mpr("You feel buoyant.");
+ if (!artefact)
+ ident = ID_KNOWN_TYPE;
+ }
break;
case RING_TELEPORTATION:
if (!scan_randarts( RAP_CAN_TELEPORT ))
{
mpr("You feel slightly jumpy.");
- ident = ID_KNOWN_TYPE;
- break;
+ if (!artefact)
+ ident = ID_KNOWN_TYPE;
}
break;
case AMU_RAGE:
- mpr("You feel a brief urge to hack something to bits.");
- ident = ID_KNOWN_TYPE;
+ if (!scan_randarts( RAP_BERSERK ))
+ {
+ mpr("You feel a brief urge to hack something to bits.");
+ if (!artefact)
+ ident = ID_KNOWN_TYPE;
+ }
break;
case AMU_THE_GOURMAND:
@@ -2327,7 +2356,7 @@ void jewellery_wear_effects(item_def &item)
// Artefacts have completely different appearance than base types
// so we don't allow them to make the base types known
- if (is_random_artefact( item ))
+ if (artefact)
use_randart(item);
else
set_ident_type( item.base_type, item.sub_type, ident );
@@ -3852,21 +3881,56 @@ void use_randart(const item_def &item)
const bool alreadyknown = item_type_known(item);
const bool dangerous = player_in_a_dangerous_place();
+ const bool ident = fully_identified(item);
randart_properties_t proprt;
randart_wpn_properties( item, proprt );
+ // Give messages for stat changes, possibly only if !identified
if (proprt[RAP_AC])
+ {
you.redraw_armour_class = 1;
+ if (!ident)
+ {
+ mprf("You feel %s.", proprt[RAP_AC] > 0?
+ "well-protected" : "more vulnerable");
+ }
+ }
if (proprt[RAP_EVASION])
+ {
you.redraw_evasion = 1;
+ if (!ident)
+ {
+ mprf("You feel somewhat %s.", proprt[RAP_EVASION] > 0?
+ "nimbler" : "more awkward");
+ }
+ }
// modify ability scores
- modify_stat( STAT_STRENGTH, proprt[RAP_STRENGTH], true );
- modify_stat( STAT_INTELLIGENCE, proprt[RAP_INTELLIGENCE], true );
- modify_stat( STAT_DEXTERITY, proprt[RAP_DEXTERITY], true );
+ // output result even when identified (because of potential fatality)
+ modify_stat( STAT_STRENGTH, proprt[RAP_STRENGTH], false );
+ modify_stat( STAT_INTELLIGENCE, proprt[RAP_INTELLIGENCE], false );
+ modify_stat( STAT_DEXTERITY, proprt[RAP_DEXTERITY], false );
+
+ // For evokable stuff, check whether other equipped items yield
+ // the same ability. If not, give a message.
+ // Do NOT give all these messages if the randart is identified.
+ if (!ident)
+ {
+ if (proprt[RAP_LEVITATE] && !items_give_ability(item.link, RAP_LEVITATE))
+ mpr("You feel buoyant.");
+
+ if (proprt[RAP_INVISIBLE] && !you.duration[DUR_INVIS])
+ mpr("You become transparent for a moment.");
+
+ if (proprt[RAP_CAN_TELEPORT] && !items_give_ability(item.link, RAP_CAN_TELEPORT))
+ mpr("You feel slightly jumpy.");
+
+ if (proprt[RAP_BERSERK] && !items_give_ability(item.link, RAP_BERSERK))
+ mpr("You feel a brief urge to hack something to bits.");
+ }
if (proprt[RAP_NOISES])
you.special_wield = 50 + proprt[RAP_NOISES];
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 145a490d7f..7b2cab6c3a 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -3933,6 +3933,52 @@ int slaying_bonus(char which_affected)
return (ret);
} // end slaying_bonus()
+// Checks each equip slot for an evokable item (jewellery or randart).
+// Returns true if any of these has the same ability as the one handed in.
+bool items_give_ability(const int slot, char abil)
+{
+ for (int i = EQ_WEAPON; i < NUM_EQUIP; i++)
+ {
+ const int eq = you.equip[i];
+
+ if (eq == -1)
+ continue;
+
+ // skip item to compare with
+ if (eq == slot)
+ continue;
+
+ // only weapons give their effects when in our hands
+ if (i == EQ_WEAPON && you.inv[ eq ].base_type != OBJ_WEAPONS)
+ continue;
+
+ if (eq == EQ_LEFT_RING || eq == EQ_RIGHT_RING)
+ {
+ if (abil == RAP_LEVITATE && you.inv[eq].sub_type == RING_LEVITATION)
+ return (true);
+ if (abil == RAP_CAN_TELEPORT && you.inv[eq].sub_type == RING_TELEPORTATION)
+ return (true);
+ if (abil == RAP_INVISIBLE && you.inv[eq].sub_type == RING_INVISIBILITY)
+ return (true);
+ }
+ else if (eq == EQ_AMULET)
+ {
+ if (abil == RAP_BERSERK && you.inv[eq].sub_type == AMU_RAGE)
+ return (true);
+ }
+
+ // other items are not evokable
+ if (!is_random_artefact( you.inv[ eq ] ))
+ continue;
+
+ if (randart_wpn_property(you.inv[ eq ], abil))
+ return (true);
+ }
+
+ // none of the equipped items possesses this ability
+ return (false);
+} // end scan_randarts()
+
/* Checks each equip slot for a randart, and adds up all of those with
a given property. Slow if any randarts are worn, so avoid where possible. */
int scan_randarts(char which_property, bool calc_unid)
@@ -4012,7 +4058,7 @@ void modify_stat(stat_type which_stat, char amount, bool suppress_msg)
break;
}
- if (!suppress_msg)
+ if (!suppress_msg && amount != 0)
mpr( msg.c_str(), (amount > 0) ? MSGCH_INTRINSIC_GAIN : MSGCH_WARN );
*ptr_stat += amount;
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index 7a87e5d676..a346cd9a38 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -233,6 +233,7 @@ int player_teleport(bool calc_unid = true);
/* ***********************************************************************
* called from: ability - acr - items - misc - spells1 - spells3
* *********************************************************************** */
+bool items_give_ability(const int slot, char abil);
int scan_randarts(char which_property, bool calc_unid = true);