Attached Files:
|
pubby_unrandarts.patch [^] (35,617 bytes) 2013-06-23 14:14 [Show Content] [Hide Content]From c625007a34cbd25a0438027fc044c5f33dcf8b03 Mon Sep 17 00:00:00 2001
From: pubby <pubby8@gmail.com>
Date: Sun, 23 Jun 2013 06:40:26 -0500
Subject: [PATCH] Add new unrandarts. No tiles.
Trog's Gloves:
Trog's hand in glove form. It gives your UC an antimagic brand.
Moon troll leather armour:
Double regen branded with spirit shield.
Boots of Ultimate Suction:
Let's you cling to walls and provides trample resistance.
Macabre Finger Necklace:
A warding amulet that provides you with another ring slot.
I rewrote some of the jewellery code, but never re-added the
TOUCH_UI code I removed in _prompt_ring_to_remove. Note that octopodes
never had TOUCH_UI code for their jewellery in the first place. This
should probably be looked at.
Also, the player dumps do not show the amulet
ring on the top, but I do not consider this a problem.
---
crawl-ref/source/art-data.txt | 30 +++
crawl-ref/source/art-func.h | 14 ++
crawl-ref/source/command.cc | 25 +--
crawl-ref/source/dat/descript/unrand.txt | 16 ++
crawl-ref/source/describe.cc | 4 +-
crawl-ref/source/enum.h | 5 +-
crawl-ref/source/item_use.cc | 360 +++++++++++++------------------
crawl-ref/source/itemname.cc | 3 +
crawl-ref/source/itemprop.cc | 10 +
crawl-ref/source/items.cc | 3 +-
crawl-ref/source/melee_attack.cc | 4 +-
crawl-ref/source/output.cc | 5 +-
crawl-ref/source/player-act.cc | 6 +-
crawl-ref/source/player-equip.cc | 7 +-
crawl-ref/source/player.cc | 16 +-
crawl-ref/source/spl-goditem.cc | 2 +-
crawl-ref/source/util/art-data.pl | 3 +-
crawl-ref/source/wiz-item.cc | 7 +-
18 files changed, 279 insertions(+), 241 deletions(-)
diff --git a/crawl-ref/source/art-data.txt b/crawl-ref/source/art-data.txt
index 7b02c65..3472317 100644
--- a/crawl-ref/source/art-data.txt
+++ b/crawl-ref/source/art-data.txt
@@ -90,6 +90,7 @@
# * poison: Grants poison resistance.
# * randapp: Generated with a random artefact's appearance (used by
# strictly-bad unrands).
+# * regen: Provides regeneration.
# * rmsl: Passively repels missiles.
# * rnd_tele: Induces random teleportation.
# * seeinv: Lets wearer see invisible.
@@ -1068,6 +1069,35 @@ TILE: urand_axe_of_woe
TILE_EQ: axe_of_woe
BOOL: nogen
+ENUM: GLOVES_TROG
+NAME: Trog's gloves
+OBJ: OBJ_ARMOUR/ARM_GLOVES
+PLUS: +0
+COLOUR: ETC_BLOOD
+MAGIC: 30
+BOOL: regen, nospell
+
+NAME: Moon Troll leather armour
+OBJ: OBJ_ARMOUR/ARM_TROLL_LEATHER_ARMOUR
+PLUS: +4
+COLOUR: ETC_SHIMMER_BLUE
+BRAND: SPARM_SPIRIT_SHIELD
+MP: +5
+BOOL: regen
+
+ENUM: SUCTION
+NAME: boots of Ultimate Suction
+OBJ: OBJ_ARMOUR/ARM_BOOTS
+PLUS: +5
+COLOUR: LIGHTMAGENTA
+CURSED: 3
+STEALTH: -50
+
+ENUM: FINGER_AMULET
+NAME: Macabre Finger Necklace
+OBJ: OBJ_JEWELLERY/AMU_WARDING
+COLOUR: ETC_BONE
+
# This is the first of two amulets used to test suppression aura.
# Together, they confer every randart effect except for a few that are
# determined explicitly by checking whether a certain amulet is worn
diff --git a/crawl-ref/source/art-func.h b/crawl-ref/source/art-func.h
index 4ebb834..7dec061 100644
--- a/crawl-ref/source/art-func.h
+++ b/crawl-ref/source/art-func.h
@@ -817,3 +817,17 @@ static void _WOE_melee_effect(item_def* weapon, actor* attacker,
if (!mondied)
defender->hurt(attacker, defender->stat_hp());
}
+
+///////////////////////////////////////////////////
+
+static void _SUCTION_equip(item_def *item, bool *show_msgs, bool unmeld)
+{
+ _equip_mpr(show_msgs, "The boots bond to your feet with incredible force.");
+}
+
+static void _SUCTION_unequip(item_def *item, bool *show_msgs)
+{
+ _equip_mpr(show_msgs, "You hear a satisfying slurp and then a pop.");
+ fake_noisy(15, you.pos());
+}
+
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 7258e3f..9340a23 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -555,18 +555,19 @@ void list_jewellery(void)
int colour = MSGCOL_BLACK;
const char *slot =
- (i == EQ_LEFT_RING) ? "Left ring" :
- (i == EQ_RIGHT_RING) ? "Right ring" :
- (i == EQ_AMULET) ? "Amulet" :
- (i == EQ_RING_ONE) ? "1st ring" :
- (i == EQ_RING_TWO) ? "2nd ring" :
- (i == EQ_RING_THREE) ? "3rd ring" :
- (i == EQ_RING_FOUR) ? "4th ring" :
- (i == EQ_RING_FIVE) ? "5th ring" :
- (i == EQ_RING_SIX) ? "6th ring" :
- (i == EQ_RING_SEVEN) ? "7th ring" :
- (i == EQ_RING_EIGHT) ? "8th ring"
- : "unknown";
+ (i == EQ_LEFT_RING) ? "Left ring" :
+ (i == EQ_RIGHT_RING) ? "Right ring" :
+ (i == EQ_AMULET) ? "Amulet" :
+ (i == EQ_RING_ONE) ? "1st ring" :
+ (i == EQ_RING_TWO) ? "2nd ring" :
+ (i == EQ_RING_THREE) ? "3rd ring" :
+ (i == EQ_RING_FOUR) ? "4th ring" :
+ (i == EQ_RING_FIVE) ? "5th ring" :
+ (i == EQ_RING_SIX) ? "6th ring" :
+ (i == EQ_RING_SEVEN) ? "7th ring" :
+ (i == EQ_RING_EIGHT) ? "8th ring" :
+ (i == EQ_RING_AMULET) ? "Amulet ring"
+ : "unknown";
string item;
if (jewellery_id != -1 && !you_tran_can_wear(you.inv[jewellery_id])
diff --git a/crawl-ref/source/dat/descript/unrand.txt b/crawl-ref/source/dat/descript/unrand.txt
index c320908..8cde214 100644
--- a/crawl-ref/source/dat/descript/unrand.txt
+++ b/crawl-ref/source/dat/descript/unrand.txt
@@ -461,6 +461,22 @@ As you hold this axe your mind does not feel fully your own. Your body begins
to exhibit strength far beyond its capabilities, and your movements become
guided by Makhleb.
%%%%
+Trog's gloves
+
+A pair of gloves passed down from a great lineage of berserkers.
+%%%%
+Moon Troll leather armour
+
+An enchanted hide from a now extinct species.
+%%%%
+boots of Ultimate Suction
+
+A novel pair of boots invented by a suitor of Arachne.
+%%%%
+Macabre Finger Necklace
+
+This dangling finger would look better with a ring on it.
+%%%%
milk chocolate
This item is a debugging aid, granting a vast array of mostly beneficial
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 990a953..85a204d 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -250,7 +250,8 @@ static vector<string> _randart_propnames(const item_def& item,
{ "Stlth", ARTP_STEALTH, 2 }, // handled specially
{ "Curse", ARTP_CURSED, 2 },
{ "Clar", ARTP_CLARITY, 2 },
- { "RMsl", ARTP_RMSL, 2 }
+ { "RMsl", ARTP_RMSL, 2 },
+ { "Regen", ARTP_REGENERATION, 2 },
};
// For randart jewellery, note the base jewellery type if it's not
@@ -432,6 +433,7 @@ static string _randart_descrip(const item_def &item)
{ ARTP_MUTAGENIC, "It causes magical contamination when unequipped.", false},
{ ARTP_RMSL, "It protects you from missiles.", false},
{ ARTP_FOG, "It can be evoked to emit clouds of fog.", false},
+ { ARTP_REGENERATION, "It increases your rate of regeneration.", false},
};
for (unsigned i = 0; i < ARRAYSZ(propdescs); ++i)
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 159cde1..1a12009 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -1654,11 +1654,13 @@ enum equipment_type
EQ_RING_SIX,
EQ_RING_SEVEN,
EQ_RING_EIGHT,
+ // Finger amulet provides an extra ring slot
+ EQ_RING_AMULET,
NUM_EQUIP,
EQ_MIN_ARMOUR = EQ_CLOAK,
EQ_MAX_ARMOUR = EQ_BODY_ARMOUR,
- EQ_MAX_WORN = EQ_RING_EIGHT,
+ EQ_MAX_WORN = EQ_RING_AMULET,
// these aren't actual equipment slots, they're categories for functions
EQ_STAFF = 100, // weapon with base_type OBJ_STAVES
EQ_RINGS, // check both rings
@@ -3021,6 +3023,7 @@ enum artefact_prop_type
#if TAG_MAJOR_VERSION == 34
ARTP_FOG,
#endif
+ ARTP_REGENERATION,
ARTP_NUM_PROPERTIES
};
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 3b02d2f..4c43fea 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -1012,93 +1012,74 @@ bool takeoff_armour(int item)
return true;
}
-static int _prompt_ring_to_remove(int new_ring)
+// Returns a list of possible ring slots.
+static vector<equipment_type> _current_ring_slots()
{
- const item_def *left = you.slot_item(EQ_LEFT_RING, true);
- const item_def *right = you.slot_item(EQ_RIGHT_RING, true);
-
- mesclr();
- mprf("Wearing %s.", you.inv[new_ring].name(DESC_A).c_str());
-
- const char lslot = index_to_letter(left->link);
- const char rslot = index_to_letter(right->link);
-
-#ifdef TOUCH_UI
- string prompt = "You're wearing two rings. Remove which one?";
- Popup *pop = new Popup(prompt);
- pop->push_entry(new MenuEntry(prompt, MEL_TITLE));
- InvEntry *me = new InvEntry(*left);
- pop->push_entry(me);
- me = new InvEntry(*right);
- pop->push_entry(me);
-
- int c;
- do
- c = pop->pop();
- while (c != lslot && c != rslot && c != '<' && c != '>'
- && !key_is_escape(c) && c != ' ');
-
-#else
- mprf(MSGCH_PROMPT,
- "You're wearing two rings. Remove which one? (%c/%c/<</>/Esc)",
- lslot, rslot);
-
- mprf(" << or %s", left->name(DESC_INVENTORY).c_str());
- mprf(" > or %s", right->name(DESC_INVENTORY).c_str());
- flush_prev_message();
-
- // Deactivate choice from tile inventory.
- // FIXME: We need to be able to get the choice (item letter)
- // *without* the choice taking action by itself!
- mouse_control mc(MOUSE_MODE_PROMPT);
- int c;
- do
- c = getchm();
- while (c != lslot && c != rslot && c != '<' && c != '>'
- && !key_is_escape(c) && c != ' ');
-#endif
-
- mesclr();
-
- if (key_is_escape(c) || c == ' ')
- return -1;
-
- const int eqslot = (c == lslot || c == '<') ? EQ_LEFT_RING
- : EQ_RIGHT_RING;
- return you.equip[eqslot];
+ vector<equipment_type> ret;
+ if (you.species == SP_OCTOPODE)
+ {
+ const int num_rings = (form_keeps_mutations() || you.form == TRAN_SPIDER
+ ? 8 : 2);
+ for (int i = 0; i != num_rings; ++i)
+ {
+ ret.push_back((equipment_type)(EQ_RING_ONE + i));
+ }
+ }
+ else
+ {
+ ret.push_back(EQ_LEFT_RING);
+ ret.push_back(EQ_RIGHT_RING);
+ }
+ if (player_equip_unrand(UNRAND_FINGER_AMULET))
+ ret.push_back(EQ_RING_AMULET);
+ return ret;
}
-static int _prompt_ring_to_remove_octopode(int new_ring)
+static vector<equipment_type> _current_jewellery_slots()
{
- const item_def *rings[8];
- char slots[8];
-
- const int num_rings = (form_keeps_mutations() || you.form == TRAN_SPIDER
- ? 8 : 2);
-
- for (int i = 0; i < num_rings; i++)
- {
- rings[i] = you.slot_item((equipment_type)(EQ_RING_ONE + i), true);
- ASSERT(rings[i]);
- slots[i] = index_to_letter(rings[i]->link);
- }
+ vector<equipment_type> ret = _current_ring_slots();
+ ret.push_back(EQ_AMULET);
+ return ret;
+}
+static int _prompt_ring_to_remove(int new_ring)
+{
+ const vector<equipment_type> ring_slots = _current_ring_slots();
+ vector<char> slot_chars;
+ vector<item_def*> rings;
+ for (vector<equipment_type>::const_iterator slot = ring_slots.begin();
+ slot != ring_slots.end();
+ ++slot)
+ {
+ rings.push_back(you.slot_item(*slot, true));
+ ASSERT(rings.back());
+ slot_chars.push_back(index_to_letter(rings.back()->link));
+ }
+
mesclr();
-// mprf("Wearing %s.", you.inv[new_ring].name(DESC_A).c_str());
-
+
mprf(MSGCH_PROMPT,
"You're wearing all the rings you can. Remove which one?");
-//I think it looks better without the letters.
-// (%c/%c/%c/%c/%c/%c/%c/%c/Esc)",
-// one_slot, two_slot, three_slot, four_slot, five_slot, six_slot, seven_slot, eight_slot);
mprf(MSGCH_PROMPT, "(<w>?</w> for menu, <w>Esc</w> to cancel)");
-
- for (int i = 0; i < num_rings; i++)
- mprf_nocap("%s", rings[i]->name(DESC_INVENTORY).c_str());
+
+ // FIXME: Needs TOUCH_UI version
+
+ for (size_t i = 0; i < rings.size(); i++)
+ {
+ string m;
+ if (ring_slots[i] == EQ_LEFT_RING)
+ m += "<< or ";
+ if (ring_slots[i] == EQ_RIGHT_RING)
+ m += "> or ";
+ if (ring_slots[i] == EQ_RING_AMULET)
+ m += "^ or ";
+ m += rings[i]->name(DESC_INVENTORY);
+ mprf_nocap("%s", m.c_str());
+ }
flush_prev_message();
-
+
// Deactivate choice from tile inventory.
- // FIXME: We need to be able to get the choice (item letter)
+ // FIXME: We need to be able to get the choice (item letter)n
// *without* the choice taking action by itself!
int eqslot = EQ_NONE;
@@ -1107,13 +1088,18 @@ static int _prompt_ring_to_remove_octopode(int new_ring)
do
{
c = getchm();
- for (int i = 0; i < num_rings; i++)
- if (c == slots[i])
+ for (size_t i = 0; i < slot_chars.size(); i++)
+ {
+ if (c == slot_chars[i]
+ || (ring_slots[i] == EQ_LEFT_RING && c == '<')
+ || (ring_slots[i] == EQ_RIGHT_RING && c == '>')
+ || (ring_slots[i] == EQ_RING_AMULET && c == '^'))
{
- eqslot = EQ_RING_ONE + i;
+ eqslot = ring_slots[i];
c = ' ';
break;
}
+ }
} while (!key_is_escape(c) && c != ' ' && c != '?');
mesclr();
@@ -1126,6 +1112,7 @@ static int _prompt_ring_to_remove_octopode(int new_ring)
return you.equip[eqslot];
}
+
// Checks whether a to-be-worn or to-be-removed item affects
// character stats and whether wearing/removing it could be fatal.
// If so, warns the player, or just returns false if quiet is true.
@@ -1275,92 +1262,48 @@ bool safe_to_remove(const item_def &item, bool quiet)
// Does not do amulets.
static bool _swap_rings(int ring_slot)
{
- const item_def* lring = you.slot_item(EQ_LEFT_RING, true);
- const item_def* rring = you.slot_item(EQ_RIGHT_RING, true);
-
- // If ring slots were melded, we should have been prevented from
- // putting on the ring at all. If it becomes possible for just
- // one ring slot to be melded, the subsequent code will need to
- // be revisited, so prevent that, too.
- ASSERT(!you.melded[EQ_LEFT_RING]);
- ASSERT(!you.melded[EQ_RIGHT_RING]);
-
- if (lring->cursed() && rring->cursed())
- {
- mprf("You're already wearing two cursed rings!");
- return false;
- }
-
- int unwanted;
-
- // Don't prompt if both rings are of the same type.
- if ((lring->sub_type == rring->sub_type
- && lring->plus == rring->plus
- && lring->plus2 == rring->plus2
- && !is_artefact(*lring) && !is_artefact(*rring)) ||
- lring->cursed() || rring->cursed())
- {
- if (lring->cursed())
- unwanted = you.equip[EQ_RIGHT_RING];
- else
- unwanted = you.equip[EQ_LEFT_RING];
- }
- else
- {
- // Ask the player which existing ring is persona non grata.
- unwanted = _prompt_ring_to_remove(ring_slot);
- }
-
- if (unwanted == -1)
- {
- canned_msg(MSG_OK);
- return false;
- }
-
- if (!remove_ring(unwanted, false))
- return false;
-
- // Check for stat loss.
- if (!_safe_to_remove_or_wear(you.inv[ring_slot], false))
- return false;
-
- // Put on the new ring.
- start_delay(DELAY_JEWELLERY_ON, 1, ring_slot);
-
- return true;
-}
-
-static bool _swap_rings_octopode(int ring_slot)
-{
- const item_def* ring[8];
- for (int i = 0; i < 8; i++)
- ring[i] = you.slot_item((equipment_type)(EQ_RING_ONE + i), true);
- int array = 0;
+ vector<equipment_type> ring_slots = _current_ring_slots();
+ const int num_rings = ring_slots.size();
int unwanted = 0;
int cursed = 0;
int melded = 0; // Both melded rings and unavailable slots.
int available = 0;
-
- for (int slots = EQ_RING_ONE;
- slots < NUM_EQUIP && array < 8;
- ++slots, ++array)
- {
- if (!you_tran_can_wear(slots) || you.melded[slots])
+ bool all_same = true;
+ item_def* first_ring = NULL;
+ for (vector<equipment_type>::iterator slot = ring_slots.begin();
+ slot != ring_slots.end();
+ ++slot)
+ {
+ item_def* ring = you.slot_item(*slot, true);
+ if (!you_tran_can_wear(*slot) || you.melded[*slot])
melded++;
- else if (ring[array] != NULL)
+ else if (ring != NULL)
{
- if (ring[array]->cursed())
+ if (first_ring == NULL)
+ first_ring = ring;
+ else if (all_same)
+ {
+ if (ring->sub_type != first_ring->sub_type
+ || ring->plus != first_ring->plus
+ || ring->plus2 != first_ring->plus2
+ || is_artefact(*ring))
+ {
+ all_same = false;
+ }
+ }
+
+ if (ring->cursed())
cursed++;
else
{
available++;
- unwanted = you.equip[slots];
+ unwanted = you.equip[*slot];
}
}
}
-
- // We can't put a ring on, because we're wearing 8 cursed ones.
- if (melded == 8)
+
+ // We can't put a ring on, because we're wearing all cursed ones.
+ if (melded == num_rings)
{
// Shouldn't happen, because hogs and bats can't put on jewellery at
// all and thus won't get this far.
@@ -1371,7 +1314,7 @@ static bool _swap_rings_octopode(int ring_slot)
{
mprf("You're already wearing %s cursed rings!%s",
number_in_words(cursed).c_str(),
- (cursed == 8 ? " Isn't that enough for you?" : ""));
+ (cursed == num_rings ? " Isn't that enough for you?" : ""));
return false;
}
// The simple case - only one available ring.
@@ -1384,8 +1327,12 @@ static bool _swap_rings_octopode(int ring_slot)
// multiple available rings.
else if (available > 1)
{
- unwanted = _prompt_ring_to_remove_octopode(ring_slot);
-
+ // Don't prompt if all the rings are the same
+ if (!all_same)
+ {
+ unwanted = _prompt_ring_to_remove(ring_slot);
+ }
+
// Cancelled:
if (unwanted < -1)
{
@@ -1397,15 +1344,6 @@ static bool _swap_rings_octopode(int ring_slot)
return false;
}
-#if 0
- // In case something goes wrong.
- if (unwanted == -1)
- {
- canned_msg(MSG_OK);
- return false;
- }
-#endif
-
// Put on the new ring.
start_delay(DELAY_JEWELLERY_ON, 1, ring_slot);
@@ -1441,34 +1379,29 @@ static bool _puton_item(int item_slot)
return false;
}
- const bool lring = you.slot_item(EQ_LEFT_RING, true);
- const bool rring = you.slot_item(EQ_RIGHT_RING, true);
+ const vector<equipment_type> ring_slots = _current_ring_slots();
const bool is_amulet = jewellery_is_amulet(item);
- bool blinged_octopode = false;
- if (you.species == SP_OCTOPODE)
- {
- blinged_octopode = true;
- for (int eq = EQ_RING_ONE; eq <= EQ_RING_EIGHT; eq++)
- {
- // Skip unavailable slots.
- if (!you_tran_can_wear(eq))
- continue;
-
- if (!you.slot_item((equipment_type)eq, true))
- {
- blinged_octopode = false;
- break;
- }
- }
- }
if (!is_amulet) // i.e. it's a ring
{
+
if (!you_tran_can_wear(item))
{
mpr("You can't wear that in your present form.");
return false;
}
+
+ bool maxed_out = true;
+ for (vector<equipment_type>::const_iterator slot = ring_slots.begin();
+ slot != ring_slots.end();
+ ++slot)
+ {
+ if (!you.slot_item(*slot, true))
+ {
+ maxed_out = false;
+ break;
+ }
+ }
const item_def* gloves = you.slot_item(EQ_GLOVES, false);
// Cursed gloves cannot be removed.
@@ -1477,11 +1410,8 @@ static bool _puton_item(int item_slot)
mpr("You can't take your gloves off to put on a ring!");
return false;
}
-
- if (blinged_octopode)
- return _swap_rings_octopode(item_slot);
-
- if (lring && rring)
+
+ if (maxed_out)
return _swap_rings(item_slot);
}
else if (item_def* amulet = you.slot_item(EQ_AMULET, true))
@@ -1508,32 +1438,22 @@ static bool _puton_item(int item_slot)
if (!_safe_to_remove_or_wear(item, false))
return false;
- equipment_type hand_used;
+ equipment_type hand_used = EQ_NONE;
if (is_amulet)
hand_used = EQ_AMULET;
- else if (you.species == SP_OCTOPODE)
+ else
{
- for (hand_used = EQ_RING_ONE; hand_used <= EQ_RING_EIGHT;
- hand_used = (equipment_type)(hand_used + 1))
+ for (vector<equipment_type>::const_iterator slot = ring_slots.begin();
+ slot != ring_slots.end();
+ ++slot)
{
- // Skip unavailble slots.
- if (!you_tran_can_wear(hand_used))
- continue;
-
- if (!you.slot_item(hand_used, true))
+ if (!you.slot_item(*slot, true))
+ {
+ hand_used = *slot;
break;
+ }
}
- ASSERT(hand_used <= EQ_RING_EIGHT);
- }
- else
- {
- // First ring always goes on left hand.
- hand_used = EQ_LEFT_RING;
-
- // ... unless we're already wearing a ring on the left hand.
- if (lring && !rring)
- hand_used = EQ_RIGHT_RING;
}
const unsigned int old_talents = your_talents(false).size();
@@ -1594,14 +1514,14 @@ bool remove_ring(int slot, bool announce)
int ring_wear_2;
bool has_jewellery = false;
bool has_melded = false;
- const equipment_type first = you.species == SP_OCTOPODE ? EQ_AMULET
- : EQ_LEFT_RING;
- const equipment_type last = you.species == SP_OCTOPODE ? EQ_RING_EIGHT
- : EQ_AMULET;
+ const vector<equipment_type> ring_slots = _current_ring_slots();
+ const vector<equipment_type> jewellery_slots = _current_jewellery_slots();
- for (int eq = first; eq <= last; eq++)
+ for (vector<equipment_type>::const_iterator it = jewellery_slots.begin();
+ it != jewellery_slots.end();
+ ++it)
{
- if (player_wearing_slot(eq))
+ if (player_wearing_slot(*it))
{
if (has_jewellery)
{
@@ -1609,11 +1529,11 @@ bool remove_ring(int slot, bool announce)
hand_used = EQ_NONE;
}
else
- hand_used = (equipment_type) eq;
+ hand_used = *it;
has_jewellery = true;
}
- else if (you.melded[eq])
+ else if (you.melded[*it])
has_melded = true;
}
@@ -1682,6 +1602,16 @@ bool remove_ring(int slot, bool announce)
mpr("You can't take your gloves off to remove any rings!");
return false;
}
+ else if (hand_used == EQ_AMULET
+ && you.equip[EQ_RING_AMULET] != -1
+ && !remove_ring(you.equip[EQ_RING_AMULET], announce))
+ {
+ // This can be removed in the future if more ring amulets are added.
+ ASSERT(player_equip_unrand(UNRAND_FINGER_AMULET));
+
+ mpr("The amulet cannot be taken off without first removing the ring!");
+ return false;
+ }
if (!check_warning_inscriptions(you.inv[you.equip[hand_used]],
OPER_REMOVE))
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 6eabcda..47fc483 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -258,6 +258,9 @@ string item_def::name(description_level_type descrip, bool terse, bool ident,
case EQ_RING_EIGHT:
buff << " (on tentacle)";
break;
+ case EQ_RING_AMULET:
+ buff << " (on amulet)";
+ break;
default:
die("Item in an invalid slot");
}
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 8a0b190..826b03b 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -14,6 +14,7 @@
#include "externs.h"
+#include "art-enum.h"
#include "artefact.h"
#include "decks.h"
#include "describe.h"
@@ -1750,6 +1751,15 @@ static bool _slot_blocked(const item_def &item)
return false;
}
}
+
+ if (player_equip_unrand(UNRAND_FINGER_AMULET))
+ {
+ if (you.equip[EQ_RING_AMULET] == -1
+ || _item_is_swappable(you.inv[you.equip[EQ_RING_AMULET]], false))
+ {
+ return false;
+ }
+ }
// No free slot found.
return true;
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 60dedd4..31bd36f 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -2117,7 +2117,8 @@ bool drop_item(int item_dropped, int quant_drop)
|| item_dropped == you.equip[EQ_RING_FIVE]
|| item_dropped == you.equip[EQ_RING_SIX]
|| item_dropped == you.equip[EQ_RING_SEVEN]
- || item_dropped == you.equip[EQ_RING_EIGHT])
+ || item_dropped == you.equip[EQ_RING_EIGHT]
+ || item_dropped == you.equip[EQ_RING_AMULET])
{
if (!Options.easy_unequip)
{
diff --git a/crawl-ref/source/melee_attack.cc b/crawl-ref/source/melee_attack.cc
index 6d688e0..539b0d3 100644
--- a/crawl-ref/source/melee_attack.cc
+++ b/crawl-ref/source/melee_attack.cc
@@ -5270,7 +5270,9 @@ bool melee_attack::do_knockback(bool trample)
{
do
{
- if (defender->is_player() && you.mutation[MUT_TRAMPLE_RESISTANCE])
+ if (defender->is_player()
+ && (you.mutation[MUT_TRAMPLE_RESISTANCE]
+ || player_equip_unrand(UNRAND_SUCTION)))
{
if (x_chance_in_y(9, 10))
return false;
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 285aa9b..fcc8456 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -1687,7 +1687,8 @@ const char *equip_slot_to_name(int equip)
{
if (equip == EQ_RINGS
|| equip == EQ_LEFT_RING || equip == EQ_RIGHT_RING
- || equip >= EQ_RING_ONE && equip <= EQ_RING_EIGHT)
+ || equip >= EQ_RING_ONE && equip <= EQ_RING_EIGHT
+ || equip == EQ_RING_AMULET)
{
return "Ring";
}
@@ -1750,6 +1751,7 @@ static void _print_overview_screen_equip(column_composer& cols,
EQ_GLOVES, EQ_BOOTS, EQ_AMULET, EQ_RIGHT_RING, EQ_LEFT_RING,
EQ_RING_ONE, EQ_RING_TWO, EQ_RING_THREE, EQ_RING_FOUR,
EQ_RING_FIVE, EQ_RING_SIX, EQ_RING_SEVEN, EQ_RING_EIGHT,
+ EQ_RING_AMULET,
};
char buf[100];
@@ -1770,6 +1772,7 @@ static void _print_overview_screen_equip(column_composer& cols,
continue;
}
+ // This skips over EQ_RING_AMULET, but that's probably okay for now.
if (you.species != SP_OCTOPODE && eqslot > EQ_AMULET)
continue;
diff --git a/crawl-ref/source/player-act.cc b/crawl-ref/source/player-act.cc
index d5ea690..e8b870c 100644
--- a/crawl-ref/source/player-act.cc
+++ b/crawl-ref/source/player-act.cc
@@ -233,6 +233,8 @@ brand_type player::damage_brand(int)
}
else if (duration[DUR_CONFUSING_TOUCH])
ret = SPWPN_CONFUSE;
+ else if (player_equip_unrand(UNRAND_GLOVES_TROG))
+ ret = SPWPN_ANTIMAGIC;
else
{
switch (form)
@@ -267,7 +269,7 @@ brand_type player::damage_brand(int)
}
// Returns the item in the given equipment slot, NULL if the slot is empty.
-// eq must be in [EQ_WEAPON, EQ_RING_EIGHT], or bad things will happen.
+// eq must be in [EQ_WEAPON, EQ_RING_AMULET], or bad things will happen.
item_def *player::slot_item(equipment_type eq, bool include_melded) const
{
ASSERT_RANGE(eq, EQ_WEAPON, NUM_EQUIP);
@@ -727,7 +729,7 @@ bool player::berserk() const
bool player::can_cling_to_walls() const
{
- return you.form == TRAN_SPIDER;
+ return you.form == TRAN_SPIDER || player_equip_unrand(UNRAND_SUCTION);
}
bool player::is_web_immune() const
diff --git a/crawl-ref/source/player-equip.cc b/crawl-ref/source/player-equip.cc
index 7749b7a..1c8ee40 100644
--- a/crawl-ref/source/player-equip.cc
+++ b/crawl-ref/source/player-equip.cc
@@ -2,6 +2,7 @@
#include "player-equip.h"
+#include "art-enum.h"
#include "areas.h"
#include "artefact.h"
#include "delay.h"
@@ -144,7 +145,8 @@ static void _equip_effect(equipment_type slot, int item_slot, bool unmeld,
ASSERT(slot == eq
|| eq == EQ_RINGS && (slot == EQ_LEFT_RING || slot == EQ_RIGHT_RING)
- || eq == EQ_RINGS && you.species == SP_OCTOPODE);
+ || eq == EQ_RINGS && you.species == SP_OCTOPODE
+ || eq == EQ_RINGS && player_equip_unrand(UNRAND_FINGER_AMULET));
if (msg)
_equip_use_warning(item);
@@ -168,7 +170,8 @@ static void _unequip_effect(equipment_type slot, int item_slot, bool meld,
ASSERT(slot == eq
|| eq == EQ_RINGS && (slot == EQ_LEFT_RING || slot == EQ_RIGHT_RING)
- || eq == EQ_RINGS && you.species == SP_OCTOPODE);
+ || eq == EQ_RINGS && you.species == SP_OCTOPODE
+ || eq == EQ_RINGS && player_equip_unrand(UNRAND_FINGER_AMULET));
if (slot == EQ_WEAPON)
_unequip_weapon_effect(item, msg, meld);
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 162530d..266f842 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -673,6 +673,13 @@ bool you_can_wear(int eq, bool special_armour)
return (eq >= EQ_RING_ONE && eq <= EQ_RING_EIGHT
|| eq == EQ_AMULET || eq == EQ_SHIELD || eq == EQ_WEAPON);
}
+
+ // Amulet provides another slot
+ if (player_equip_unrand(UNRAND_FINGER_AMULET))
+ {
+ if (eq == EQ_RING_AMULET)
+ return true;
+ }
switch (eq)
{
@@ -868,7 +875,8 @@ bool you_tran_can_wear(int eq, bool check_mutation)
// Everyone else can wear jewellery...
if (eq == EQ_AMULET || eq == EQ_RINGS
|| eq == EQ_LEFT_RING || eq == EQ_RIGHT_RING
- || eq == EQ_RING_ONE || eq == EQ_RING_TWO)
+ || eq == EQ_RING_ONE || eq == EQ_RING_TWO
+ || eq == EQ_RING_AMULET)
{
return true;
}
@@ -1260,6 +1268,9 @@ static int _player_bonus_regen()
{
// Rings.
rr += 40 * you.wearing(EQ_RINGS, RING_REGENERATION);
+
+ // Artefacts
+ rr += 40 * you.scan_artefacts(ARTP_REGENERATION);
// Troll leather (except for trolls).
if ((you.wearing(EQ_BODY_ARMOUR, ARM_TROLL_LEATHER_ARMOUR)
@@ -1418,11 +1429,12 @@ int player_hunger_rate(bool temp)
// All effects negated by magical suppression should go in here.
if (!you.suppressed())
{
- // rings
+ // rings and artefacts
if (you.hp < you.hp_max
&& player_mutation_level(MUT_SLOW_HEALING) < 3)
{
hunger += 3 * you.wearing(EQ_RINGS, RING_REGENERATION);
+ hunger += 3 * you.scan_artefacts(ARTP_REGENERATION);
}
hunger += 4 * you.wearing(EQ_RINGS, RING_HUNGER);
diff --git a/crawl-ref/source/spl-goditem.cc b/crawl-ref/source/spl-goditem.cc
index 17f4732..d4e0153 100644
--- a/crawl-ref/source/spl-goditem.cc
+++ b/crawl-ref/source/spl-goditem.cc
@@ -744,7 +744,7 @@ bool curse_item(bool armour, bool alreadyknown, string *pre_msg)
if (armour)
min_type = EQ_MIN_ARMOUR, max_type = EQ_MAX_ARMOUR;
else
- min_type = EQ_LEFT_RING, max_type = EQ_RING_EIGHT;
+ min_type = EQ_LEFT_RING, max_type = EQ_RING_AMULET;
for (int i = min_type; i <= max_type; i++)
{
if (you.equip[i] != -1 && !you.inv[you.equip[i]].cursed())
diff --git a/crawl-ref/source/util/art-data.pl b/crawl-ref/source/util/art-data.pl
index b7cfb18..abbfc3e 100755
--- a/crawl-ref/source/util/art-data.pl
+++ b/crawl-ref/source/util/art-data.pl
@@ -55,6 +55,7 @@ my %field_type = (
NOTELEP => "bool",
POISON => "bool",
RANDAPP => "bool",
+ REGEN => "bool",
RMSL => "bool",
RND_TELE => "bool",
SEEINV => "bool",
@@ -489,7 +490,7 @@ my @art_order = (
"NOSPELL", "RND_TELE", "NOTELEP", "ANGRY", "METAB", "\n",
"MUTATE", "ACC", "DAM", "CURSED", "STEALTH", "MP", "\n",
"BASE_DELAY", "HP", "CLARITY", "BASE_ACC", "BASE_DAM", "\n",
- "RMSL", "FOG", "\n",
+ "RMSL", "FOG", "REGEN", "\n",
"}",
"equip_func", "unequip_func", "world_reacts_func", "{fight_func_func",
diff --git a/crawl-ref/source/wiz-item.cc b/crawl-ref/source/wiz-item.cc
index ffef8ee..3216c6c 100644
--- a/crawl-ref/source/wiz-item.cc
+++ b/crawl-ref/source/wiz-item.cc
@@ -283,6 +283,7 @@ static const char* _prop_name[] = {
"BDam",
"RMsl",
"Fog",
+ "Regen",
};
#define ARTP_VAL_BOOL 0
@@ -326,6 +327,7 @@ static int8_t _prop_type[] = {
ARTP_VAL_ANY, //BASE_DAM
ARTP_VAL_BOOL, //RMSL
ARTP_VAL_BOOL, //FOG
+ ARTP_VAL_BOOL, //REGEN
};
static void _tweak_randart(item_def &item)
@@ -1011,7 +1013,8 @@ static void _debug_acquirement_stats(FILE *ostat)
EQ_WEAPON, EQ_BODY_ARMOUR, EQ_SHIELD, EQ_HELMET, EQ_CLOAK,
EQ_GLOVES, EQ_BOOTS, EQ_AMULET, EQ_RIGHT_RING, EQ_LEFT_RING,
EQ_RING_ONE, EQ_RING_TWO, EQ_RING_THREE, EQ_RING_FOUR,
- EQ_RING_FIVE, EQ_RING_SIX, EQ_RING_SEVEN, EQ_RING_EIGHT
+ EQ_RING_FIVE, EQ_RING_SIX, EQ_RING_SEVEN, EQ_RING_EIGHT,
+ EQ_RING_AMULET
};
bool naked = true;
@@ -1361,6 +1364,7 @@ static void _debug_rap_stats(FILE *ostat)
0, //ARTP_BASE_DAM
1, //ARTP_RMSL
1, //ARTP_FOG
+ 1, //ARTP_REGENERATION
-1
};
@@ -1508,6 +1512,7 @@ static void _debug_rap_stats(FILE *ostat)
"ARTP_BASE_DAM",
"ARTP_RMSL"
"ARTP_FOG",
+ "ARTP_REGENERATION",
};
fprintf(ostat, " All Good Bad\n");
--
1.8.2.3
pubby_unrandarts2.patch [^] (37,484 bytes) 2013-06-24 04:06 [Show Content] [Hide Content]From 89f412defcffefcc834ed834bbb41679b85da364 Mon Sep 17 00:00:00 2001
From: pubby <pubby8@gmail.com>
Date: Sun, 23 Jun 2013 06:40:26 -0500
Subject: [PATCH] Add new unrandarts. No tiles.
Trog's Gloves:
Trog's hand in glove form. It gives your UC an antimagic brand.
Moon troll leather armour:
Double regen branded with spirit shield.
Boots of Ultimate Suction:
Let's you cling to walls and provides trample resistance.
Macabre Finger Necklace:
A warding amulet that provides you with another ring slot.
I rewrote some of the jewellery code, but never re-added the
TOUCH_UI code I removed in _prompt_ring_to_remove. Note that octopodes
never had TOUCH_UI code for their jewellery in the first place. This
should probably be looked at.
Also, the player dumps do not show the amulet
ring on the top, but I do not consider this a problem.
---
crawl-ref/source/art-data.txt | 30 +++
crawl-ref/source/art-func.h | 14 ++
crawl-ref/source/command.cc | 25 +-
crawl-ref/source/dat/descript/unrand.txt | 16 ++
crawl-ref/source/describe.cc | 4 +-
crawl-ref/source/enum.h | 5 +-
crawl-ref/source/item_use.cc | 407 +++++++++++++------------------
crawl-ref/source/itemname.cc | 3 +
crawl-ref/source/itemprop.cc | 10 +
crawl-ref/source/items.cc | 3 +-
crawl-ref/source/melee_attack.cc | 4 +-
crawl-ref/source/output.cc | 5 +-
crawl-ref/source/player-act.cc | 6 +-
crawl-ref/source/player-equip.cc | 7 +-
crawl-ref/source/player.cc | 16 +-
crawl-ref/source/spl-goditem.cc | 2 +-
crawl-ref/source/util/art-data.pl | 3 +-
crawl-ref/source/wiz-item.cc | 7 +-
18 files changed, 307 insertions(+), 260 deletions(-)
diff --git a/crawl-ref/source/art-data.txt b/crawl-ref/source/art-data.txt
index 7b02c65..3472317 100644
--- a/crawl-ref/source/art-data.txt
+++ b/crawl-ref/source/art-data.txt
@@ -90,6 +90,7 @@
# * poison: Grants poison resistance.
# * randapp: Generated with a random artefact's appearance (used by
# strictly-bad unrands).
+# * regen: Provides regeneration.
# * rmsl: Passively repels missiles.
# * rnd_tele: Induces random teleportation.
# * seeinv: Lets wearer see invisible.
@@ -1068,6 +1069,35 @@ TILE: urand_axe_of_woe
TILE_EQ: axe_of_woe
BOOL: nogen
+ENUM: GLOVES_TROG
+NAME: Trog's gloves
+OBJ: OBJ_ARMOUR/ARM_GLOVES
+PLUS: +0
+COLOUR: ETC_BLOOD
+MAGIC: 30
+BOOL: regen, nospell
+
+NAME: Moon Troll leather armour
+OBJ: OBJ_ARMOUR/ARM_TROLL_LEATHER_ARMOUR
+PLUS: +4
+COLOUR: ETC_SHIMMER_BLUE
+BRAND: SPARM_SPIRIT_SHIELD
+MP: +5
+BOOL: regen
+
+ENUM: SUCTION
+NAME: boots of Ultimate Suction
+OBJ: OBJ_ARMOUR/ARM_BOOTS
+PLUS: +5
+COLOUR: LIGHTMAGENTA
+CURSED: 3
+STEALTH: -50
+
+ENUM: FINGER_AMULET
+NAME: Macabre Finger Necklace
+OBJ: OBJ_JEWELLERY/AMU_WARDING
+COLOUR: ETC_BONE
+
# This is the first of two amulets used to test suppression aura.
# Together, they confer every randart effect except for a few that are
# determined explicitly by checking whether a certain amulet is worn
diff --git a/crawl-ref/source/art-func.h b/crawl-ref/source/art-func.h
index 4ebb834..7dec061 100644
--- a/crawl-ref/source/art-func.h
+++ b/crawl-ref/source/art-func.h
@@ -817,3 +817,17 @@ static void _WOE_melee_effect(item_def* weapon, actor* attacker,
if (!mondied)
defender->hurt(attacker, defender->stat_hp());
}
+
+///////////////////////////////////////////////////
+
+static void _SUCTION_equip(item_def *item, bool *show_msgs, bool unmeld)
+{
+ _equip_mpr(show_msgs, "The boots bond to your feet with incredible force.");
+}
+
+static void _SUCTION_unequip(item_def *item, bool *show_msgs)
+{
+ _equip_mpr(show_msgs, "You hear a satisfying slurp and then a pop.");
+ fake_noisy(15, you.pos());
+}
+
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 7258e3f..9340a23 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -555,18 +555,19 @@ void list_jewellery(void)
int colour = MSGCOL_BLACK;
const char *slot =
- (i == EQ_LEFT_RING) ? "Left ring" :
- (i == EQ_RIGHT_RING) ? "Right ring" :
- (i == EQ_AMULET) ? "Amulet" :
- (i == EQ_RING_ONE) ? "1st ring" :
- (i == EQ_RING_TWO) ? "2nd ring" :
- (i == EQ_RING_THREE) ? "3rd ring" :
- (i == EQ_RING_FOUR) ? "4th ring" :
- (i == EQ_RING_FIVE) ? "5th ring" :
- (i == EQ_RING_SIX) ? "6th ring" :
- (i == EQ_RING_SEVEN) ? "7th ring" :
- (i == EQ_RING_EIGHT) ? "8th ring"
- : "unknown";
+ (i == EQ_LEFT_RING) ? "Left ring" :
+ (i == EQ_RIGHT_RING) ? "Right ring" :
+ (i == EQ_AMULET) ? "Amulet" :
+ (i == EQ_RING_ONE) ? "1st ring" :
+ (i == EQ_RING_TWO) ? "2nd ring" :
+ (i == EQ_RING_THREE) ? "3rd ring" :
+ (i == EQ_RING_FOUR) ? "4th ring" :
+ (i == EQ_RING_FIVE) ? "5th ring" :
+ (i == EQ_RING_SIX) ? "6th ring" :
+ (i == EQ_RING_SEVEN) ? "7th ring" :
+ (i == EQ_RING_EIGHT) ? "8th ring" :
+ (i == EQ_RING_AMULET) ? "Amulet ring"
+ : "unknown";
string item;
if (jewellery_id != -1 && !you_tran_can_wear(you.inv[jewellery_id])
diff --git a/crawl-ref/source/dat/descript/unrand.txt b/crawl-ref/source/dat/descript/unrand.txt
index c320908..8cde214 100644
--- a/crawl-ref/source/dat/descript/unrand.txt
+++ b/crawl-ref/source/dat/descript/unrand.txt
@@ -461,6 +461,22 @@ As you hold this axe your mind does not feel fully your own. Your body begins
to exhibit strength far beyond its capabilities, and your movements become
guided by Makhleb.
%%%%
+Trog's gloves
+
+A pair of gloves passed down from a great lineage of berserkers.
+%%%%
+Moon Troll leather armour
+
+An enchanted hide from a now extinct species.
+%%%%
+boots of Ultimate Suction
+
+A novel pair of boots invented by a suitor of Arachne.
+%%%%
+Macabre Finger Necklace
+
+This dangling finger would look better with a ring on it.
+%%%%
milk chocolate
This item is a debugging aid, granting a vast array of mostly beneficial
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 990a953..85a204d 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -250,7 +250,8 @@ static vector<string> _randart_propnames(const item_def& item,
{ "Stlth", ARTP_STEALTH, 2 }, // handled specially
{ "Curse", ARTP_CURSED, 2 },
{ "Clar", ARTP_CLARITY, 2 },
- { "RMsl", ARTP_RMSL, 2 }
+ { "RMsl", ARTP_RMSL, 2 },
+ { "Regen", ARTP_REGENERATION, 2 },
};
// For randart jewellery, note the base jewellery type if it's not
@@ -432,6 +433,7 @@ static string _randart_descrip(const item_def &item)
{ ARTP_MUTAGENIC, "It causes magical contamination when unequipped.", false},
{ ARTP_RMSL, "It protects you from missiles.", false},
{ ARTP_FOG, "It can be evoked to emit clouds of fog.", false},
+ { ARTP_REGENERATION, "It increases your rate of regeneration.", false},
};
for (unsigned i = 0; i < ARRAYSZ(propdescs); ++i)
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 159cde1..1a12009 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -1654,11 +1654,13 @@ enum equipment_type
EQ_RING_SIX,
EQ_RING_SEVEN,
EQ_RING_EIGHT,
+ // Finger amulet provides an extra ring slot
+ EQ_RING_AMULET,
NUM_EQUIP,
EQ_MIN_ARMOUR = EQ_CLOAK,
EQ_MAX_ARMOUR = EQ_BODY_ARMOUR,
- EQ_MAX_WORN = EQ_RING_EIGHT,
+ EQ_MAX_WORN = EQ_RING_AMULET,
// these aren't actual equipment slots, they're categories for functions
EQ_STAFF = 100, // weapon with base_type OBJ_STAVES
EQ_RINGS, // check both rings
@@ -3021,6 +3023,7 @@ enum artefact_prop_type
#if TAG_MAJOR_VERSION == 34
ARTP_FOG,
#endif
+ ARTP_REGENERATION,
ARTP_NUM_PROPERTIES
};
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 3b02d2f..b3153c4 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -1012,93 +1012,82 @@ bool takeoff_armour(int item)
return true;
}
-static int _prompt_ring_to_remove(int new_ring)
+// Returns a list of possible ring slots.
+static vector<equipment_type> _current_ring_types()
{
- const item_def *left = you.slot_item(EQ_LEFT_RING, true);
- const item_def *right = you.slot_item(EQ_RIGHT_RING, true);
-
- mesclr();
- mprf("Wearing %s.", you.inv[new_ring].name(DESC_A).c_str());
-
- const char lslot = index_to_letter(left->link);
- const char rslot = index_to_letter(right->link);
-
-#ifdef TOUCH_UI
- string prompt = "You're wearing two rings. Remove which one?";
- Popup *pop = new Popup(prompt);
- pop->push_entry(new MenuEntry(prompt, MEL_TITLE));
- InvEntry *me = new InvEntry(*left);
- pop->push_entry(me);
- me = new InvEntry(*right);
- pop->push_entry(me);
-
- int c;
- do
- c = pop->pop();
- while (c != lslot && c != rslot && c != '<' && c != '>'
- && !key_is_escape(c) && c != ' ');
-
-#else
- mprf(MSGCH_PROMPT,
- "You're wearing two rings. Remove which one? (%c/%c/<</>/Esc)",
- lslot, rslot);
-
- mprf(" << or %s", left->name(DESC_INVENTORY).c_str());
- mprf(" > or %s", right->name(DESC_INVENTORY).c_str());
- flush_prev_message();
-
- // Deactivate choice from tile inventory.
- // FIXME: We need to be able to get the choice (item letter)
- // *without* the choice taking action by itself!
- mouse_control mc(MOUSE_MODE_PROMPT);
- int c;
- do
- c = getchm();
- while (c != lslot && c != rslot && c != '<' && c != '>'
- && !key_is_escape(c) && c != ' ');
-#endif
-
- mesclr();
-
- if (key_is_escape(c) || c == ' ')
- return -1;
-
- const int eqslot = (c == lslot || c == '<') ? EQ_LEFT_RING
- : EQ_RIGHT_RING;
- return you.equip[eqslot];
+ vector<equipment_type> ret;
+ if (you.species == SP_OCTOPODE)
+ {
+ const int num_rings = (form_keeps_mutations() || you.form == TRAN_SPIDER
+ ? 8 : 2);
+ for (int i = 0; i != num_rings; ++i)
+ {
+ ret.push_back((equipment_type)(EQ_RING_ONE + i));
+ }
+ }
+ else
+ {
+ ret.push_back(EQ_LEFT_RING);
+ ret.push_back(EQ_RIGHT_RING);
+ }
+ if (player_equip_unrand(UNRAND_FINGER_AMULET))
+ ret.push_back(EQ_RING_AMULET);
+ return ret;
}
-static int _prompt_ring_to_remove_octopode(int new_ring)
+static vector<equipment_type> _current_jewellery_types()
{
- const item_def *rings[8];
- char slots[8];
-
- const int num_rings = (form_keeps_mutations() || you.form == TRAN_SPIDER
- ? 8 : 2);
+ vector<equipment_type> ret = _current_ring_types();
+ ret.push_back(EQ_AMULET);
+ return ret;
+}
- for (int i = 0; i < num_rings; i++)
- {
- rings[i] = you.slot_item((equipment_type)(EQ_RING_ONE + i), true);
- ASSERT(rings[i]);
- slots[i] = index_to_letter(rings[i]->link);
- }
+static bool _ring_change_prohibited_by_gloves(equipment_type eq)
+{
+ const item_def* gloves = you.slot_item(EQ_GLOVES, false);
+ return (gloves && gloves->cursed()
+ && (eq == EQ_LEFT_RING
+ || eq == EQ_RIGHT_RING));
+}
+static int _prompt_ring_to_remove(int new_ring)
+{
+ const vector<equipment_type> ring_types = _current_ring_types();
+ vector<char> slot_chars;
+ vector<item_def*> rings;
+ for (vector<equipment_type>::const_iterator eq_it = ring_types.begin();
+ eq_it != ring_types.end();
+ ++eq_it)
+ {
+ rings.push_back(you.slot_item(*eq_it, true));
+ ASSERT(rings.back());
+ slot_chars.push_back(index_to_letter(rings.back()->link));
+ }
+
mesclr();
-// mprf("Wearing %s.", you.inv[new_ring].name(DESC_A).c_str());
-
+
mprf(MSGCH_PROMPT,
"You're wearing all the rings you can. Remove which one?");
-//I think it looks better without the letters.
-// (%c/%c/%c/%c/%c/%c/%c/%c/Esc)",
-// one_slot, two_slot, three_slot, four_slot, five_slot, six_slot, seven_slot, eight_slot);
mprf(MSGCH_PROMPT, "(<w>?</w> for menu, <w>Esc</w> to cancel)");
-
- for (int i = 0; i < num_rings; i++)
- mprf_nocap("%s", rings[i]->name(DESC_INVENTORY).c_str());
+
+ // FIXME: Needs TOUCH_UI version
+
+ for (size_t i = 0; i < rings.size(); i++)
+ {
+ string m;
+ if (ring_types[i] == EQ_LEFT_RING)
+ m += "<< or ";
+ if (ring_types[i] == EQ_RIGHT_RING)
+ m += "> or ";
+ if (ring_types[i] == EQ_RING_AMULET)
+ m += "^ or ";
+ m += rings[i]->name(DESC_INVENTORY);
+ mprf_nocap("%s", m.c_str());
+ }
flush_prev_message();
-
+
// Deactivate choice from tile inventory.
- // FIXME: We need to be able to get the choice (item letter)
+ // FIXME: We need to be able to get the choice (item letter)n
// *without* the choice taking action by itself!
int eqslot = EQ_NONE;
@@ -1107,13 +1096,18 @@ static int _prompt_ring_to_remove_octopode(int new_ring)
do
{
c = getchm();
- for (int i = 0; i < num_rings; i++)
- if (c == slots[i])
+ for (size_t i = 0; i < slot_chars.size(); i++)
+ {
+ if (c == slot_chars[i]
+ || (ring_types[i] == EQ_LEFT_RING && c == '<')
+ || (ring_types[i] == EQ_RIGHT_RING && c == '>')
+ || (ring_types[i] == EQ_RING_AMULET && c == '^'))
{
- eqslot = EQ_RING_ONE + i;
+ eqslot = ring_types[i];
c = ' ';
break;
}
+ }
} while (!key_is_escape(c) && c != ' ' && c != '?');
mesclr();
@@ -1126,6 +1120,7 @@ static int _prompt_ring_to_remove_octopode(int new_ring)
return you.equip[eqslot];
}
+
// Checks whether a to-be-worn or to-be-removed item affects
// character stats and whether wearing/removing it could be fatal.
// If so, warns the player, or just returns false if quiet is true.
@@ -1275,92 +1270,52 @@ bool safe_to_remove(const item_def &item, bool quiet)
// Does not do amulets.
static bool _swap_rings(int ring_slot)
{
- const item_def* lring = you.slot_item(EQ_LEFT_RING, true);
- const item_def* rring = you.slot_item(EQ_RIGHT_RING, true);
-
- // If ring slots were melded, we should have been prevented from
- // putting on the ring at all. If it becomes possible for just
- // one ring slot to be melded, the subsequent code will need to
- // be revisited, so prevent that, too.
- ASSERT(!you.melded[EQ_LEFT_RING]);
- ASSERT(!you.melded[EQ_RIGHT_RING]);
-
- if (lring->cursed() && rring->cursed())
- {
- mprf("You're already wearing two cursed rings!");
- return false;
- }
-
- int unwanted;
-
- // Don't prompt if both rings are of the same type.
- if ((lring->sub_type == rring->sub_type
- && lring->plus == rring->plus
- && lring->plus2 == rring->plus2
- && !is_artefact(*lring) && !is_artefact(*rring)) ||
- lring->cursed() || rring->cursed())
- {
- if (lring->cursed())
- unwanted = you.equip[EQ_RIGHT_RING];
- else
- unwanted = you.equip[EQ_LEFT_RING];
- }
- else
- {
- // Ask the player which existing ring is persona non grata.
- unwanted = _prompt_ring_to_remove(ring_slot);
- }
-
- if (unwanted == -1)
- {
- canned_msg(MSG_OK);
- return false;
- }
-
- if (!remove_ring(unwanted, false))
- return false;
-
- // Check for stat loss.
- if (!_safe_to_remove_or_wear(you.inv[ring_slot], false))
- return false;
-
- // Put on the new ring.
- start_delay(DELAY_JEWELLERY_ON, 1, ring_slot);
-
- return true;
-}
-
-static bool _swap_rings_octopode(int ring_slot)
-{
- const item_def* ring[8];
- for (int i = 0; i < 8; i++)
- ring[i] = you.slot_item((equipment_type)(EQ_RING_ONE + i), true);
- int array = 0;
+ vector<equipment_type> ring_types = _current_ring_types();
+ const int num_rings = ring_types.size();
int unwanted = 0;
int cursed = 0;
int melded = 0; // Both melded rings and unavailable slots.
int available = 0;
-
- for (int slots = EQ_RING_ONE;
- slots < NUM_EQUIP && array < 8;
- ++slots, ++array)
- {
- if (!you_tran_can_wear(slots) || you.melded[slots])
+ bool all_same = true;
+ item_def* first_ring = NULL;
+ bool gloves_prohibit = false;
+ for (vector<equipment_type>::iterator eq_it = ring_types.begin();
+ eq_it != ring_types.end();
+ ++eq_it)
+ {
+ item_def* ring = you.slot_item(*eq_it, true);
+ if (!you_tran_can_wear(*eq_it) || you.melded[*eq_it])
melded++;
- else if (ring[array] != NULL)
+ else if (ring != NULL)
{
- if (ring[array]->cursed())
+ if (first_ring == NULL)
+ first_ring = ring;
+ else if (all_same)
+ {
+ if (ring->sub_type != first_ring->sub_type
+ || ring->plus != first_ring->plus
+ || ring->plus2 != first_ring->plus2
+ || is_artefact(*ring))
+ {
+ all_same = false;
+ }
+ }
+
+ if (_ring_change_prohibited_by_gloves(*eq_it))
+ gloves_prohibit = true;
+
+ if (ring->cursed())
cursed++;
- else
+ else if (!_ring_change_prohibited_by_gloves(*eq_it))
{
available++;
- unwanted = you.equip[slots];
+ unwanted = you.equip[*eq_it];
}
}
}
-
- // We can't put a ring on, because we're wearing 8 cursed ones.
- if (melded == 8)
+
+ // We can't put a ring on, because we're wearing all cursed ones.
+ if (melded == num_rings)
{
// Shouldn't happen, because hogs and bats can't put on jewellery at
// all and thus won't get this far.
@@ -1369,9 +1324,12 @@ static bool _swap_rings_octopode(int ring_slot)
}
else if (available == 0)
{
- mprf("You're already wearing %s cursed rings!%s",
- number_in_words(cursed).c_str(),
- (cursed == 8 ? " Isn't that enough for you?" : ""));
+ if (gloves_prohibit)
+ mpr("You can't take your gloves off to put on a ring!");
+ else
+ mprf("You're already wearing %s cursed rings!%s",
+ number_in_words(cursed).c_str(),
+ (cursed == num_rings ? " Isn't that enough for you?" : ""));
return false;
}
// The simple case - only one available ring.
@@ -1384,8 +1342,12 @@ static bool _swap_rings_octopode(int ring_slot)
// multiple available rings.
else if (available > 1)
{
- unwanted = _prompt_ring_to_remove_octopode(ring_slot);
-
+ // Don't prompt if all the rings are the same
+ if (!all_same)
+ {
+ unwanted = _prompt_ring_to_remove(ring_slot);
+ }
+
// Cancelled:
if (unwanted < -1)
{
@@ -1397,15 +1359,6 @@ static bool _swap_rings_octopode(int ring_slot)
return false;
}
-#if 0
- // In case something goes wrong.
- if (unwanted == -1)
- {
- canned_msg(MSG_OK);
- return false;
- }
-#endif
-
// Put on the new ring.
start_delay(DELAY_JEWELLERY_ON, 1, ring_slot);
@@ -1441,47 +1394,33 @@ static bool _puton_item(int item_slot)
return false;
}
- const bool lring = you.slot_item(EQ_LEFT_RING, true);
- const bool rring = you.slot_item(EQ_RIGHT_RING, true);
+ const vector<equipment_type> ring_types = _current_ring_types();
const bool is_amulet = jewellery_is_amulet(item);
- bool blinged_octopode = false;
- if (you.species == SP_OCTOPODE)
- {
- blinged_octopode = true;
- for (int eq = EQ_RING_ONE; eq <= EQ_RING_EIGHT; eq++)
- {
- // Skip unavailable slots.
- if (!you_tran_can_wear(eq))
- continue;
-
- if (!you.slot_item((equipment_type)eq, true))
- {
- blinged_octopode = false;
- break;
- }
- }
- }
if (!is_amulet) // i.e. it's a ring
{
+
if (!you_tran_can_wear(item))
{
mpr("You can't wear that in your present form.");
return false;
}
-
- const item_def* gloves = you.slot_item(EQ_GLOVES, false);
- // Cursed gloves cannot be removed.
- if (gloves && gloves->cursed())
+
+ bool need_swap = true;
+ for (vector<equipment_type>::const_iterator eq_it = ring_types.begin();
+ eq_it != ring_types.end();
+ ++eq_it)
{
- mpr("You can't take your gloves off to put on a ring!");
- return false;
+ if (_ring_change_prohibited_by_gloves(*eq_it))
+ continue;
+ if (!you.slot_item(*eq_it, true))
+ {
+ need_swap = false;
+ break;
+ }
}
-
- if (blinged_octopode)
- return _swap_rings_octopode(item_slot);
-
- if (lring && rring)
+
+ if (need_swap)
return _swap_rings(item_slot);
}
else if (item_def* amulet = you.slot_item(EQ_AMULET, true))
@@ -1508,32 +1447,31 @@ static bool _puton_item(int item_slot)
if (!_safe_to_remove_or_wear(item, false))
return false;
- equipment_type hand_used;
+ equipment_type hand_used = EQ_NONE;
if (is_amulet)
hand_used = EQ_AMULET;
- else if (you.species == SP_OCTOPODE)
+ else
{
- for (hand_used = EQ_RING_ONE; hand_used <= EQ_RING_EIGHT;
- hand_used = (equipment_type)(hand_used + 1))
+ bool gloves_prohibit = false;
+ for (vector<equipment_type>::const_iterator eq_it = ring_types.begin();
+ eq_it != ring_types.end();
+ ++eq_it)
{
- // Skip unavailble slots.
- if (!you_tran_can_wear(hand_used))
- continue;
-
- if (!you.slot_item(hand_used, true))
+ if (_ring_change_prohibited_by_gloves(*eq_it))
+ gloves_prohibit = true;
+ else if (!you.slot_item(*eq_it, true))
+ {
+ hand_used = *eq_it;
break;
+ }
+ }
+ if (hand_used == EQ_NONE && gloves_prohibit)
+ {
+ // This shouldn't happen, but just in case...
+ mpr("You can't take your gloves off to put on a ring!");
+ return false;
}
- ASSERT(hand_used <= EQ_RING_EIGHT);
- }
- else
- {
- // First ring always goes on left hand.
- hand_used = EQ_LEFT_RING;
-
- // ... unless we're already wearing a ring on the left hand.
- if (lring && !rring)
- hand_used = EQ_RIGHT_RING;
}
const unsigned int old_talents = your_talents(false).size();
@@ -1594,14 +1532,14 @@ bool remove_ring(int slot, bool announce)
int ring_wear_2;
bool has_jewellery = false;
bool has_melded = false;
- const equipment_type first = you.species == SP_OCTOPODE ? EQ_AMULET
- : EQ_LEFT_RING;
- const equipment_type last = you.species == SP_OCTOPODE ? EQ_RING_EIGHT
- : EQ_AMULET;
+ const vector<equipment_type> ring_types = _current_ring_types();
+ const vector<equipment_type> jewellery_slots = _current_jewellery_types();
- for (int eq = first; eq <= last; eq++)
+ for (vector<equipment_type>::const_iterator eq_it = jewellery_slots.begin();
+ eq_it != jewellery_slots.end();
+ ++eq_it)
{
- if (player_wearing_slot(eq))
+ if (player_wearing_slot(*eq_it))
{
if (has_jewellery)
{
@@ -1609,11 +1547,11 @@ bool remove_ring(int slot, bool announce)
hand_used = EQ_NONE;
}
else
- hand_used = (equipment_type) eq;
+ hand_used = *eq_it;
has_jewellery = true;
}
- else if (you.melded[eq])
+ else if (you.melded[*eq_it])
has_melded = true;
}
@@ -1633,14 +1571,6 @@ bool remove_ring(int slot, bool announce)
return false;
}
- const item_def* gloves = you.slot_item(EQ_GLOVES);
- const bool gloves_cursed = gloves && gloves->cursed();
- if (gloves_cursed && !player_wearing_slot(EQ_AMULET))
- {
- mpr("You can't take your gloves off to remove any rings!");
- return false;
- }
-
if (hand_used == EQ_NONE)
{
const int equipn =
@@ -1676,10 +1606,19 @@ bool remove_ring(int slot, bool announce)
mpr("You can't take that off while it's melded.");
return false;
}
- else if (gloves_cursed
- && (hand_used == EQ_LEFT_RING || hand_used == EQ_RIGHT_RING))
+ else if (_ring_change_prohibited_by_gloves(hand_used))
+ {
+ mpr("You can't take your gloves off to remove a ring!");
+ return false;
+ }
+ else if (hand_used == EQ_AMULET
+ && you.equip[EQ_RING_AMULET] != -1
+ && !remove_ring(you.equip[EQ_RING_AMULET], announce))
{
- mpr("You can't take your gloves off to remove any rings!");
+ // This can be removed in the future if more ring amulets are added.
+ ASSERT(player_equip_unrand(UNRAND_FINGER_AMULET));
+
+ mpr("The amulet cannot be taken off without first removing the ring!");
return false;
}
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 6eabcda..47fc483 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -258,6 +258,9 @@ string item_def::name(description_level_type descrip, bool terse, bool ident,
case EQ_RING_EIGHT:
buff << " (on tentacle)";
break;
+ case EQ_RING_AMULET:
+ buff << " (on amulet)";
+ break;
default:
die("Item in an invalid slot");
}
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 8a0b190..826b03b 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -14,6 +14,7 @@
#include "externs.h"
+#include "art-enum.h"
#include "artefact.h"
#include "decks.h"
#include "describe.h"
@@ -1750,6 +1751,15 @@ static bool _slot_blocked(const item_def &item)
return false;
}
}
+
+ if (player_equip_unrand(UNRAND_FINGER_AMULET))
+ {
+ if (you.equip[EQ_RING_AMULET] == -1
+ || _item_is_swappable(you.inv[you.equip[EQ_RING_AMULET]], false))
+ {
+ return false;
+ }
+ }
// No free slot found.
return true;
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 60dedd4..31bd36f 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -2117,7 +2117,8 @@ bool drop_item(int item_dropped, int quant_drop)
|| item_dropped == you.equip[EQ_RING_FIVE]
|| item_dropped == you.equip[EQ_RING_SIX]
|| item_dropped == you.equip[EQ_RING_SEVEN]
- || item_dropped == you.equip[EQ_RING_EIGHT])
+ || item_dropped == you.equip[EQ_RING_EIGHT]
+ || item_dropped == you.equip[EQ_RING_AMULET])
{
if (!Options.easy_unequip)
{
diff --git a/crawl-ref/source/melee_attack.cc b/crawl-ref/source/melee_attack.cc
index 6d688e0..539b0d3 100644
--- a/crawl-ref/source/melee_attack.cc
+++ b/crawl-ref/source/melee_attack.cc
@@ -5270,7 +5270,9 @@ bool melee_attack::do_knockback(bool trample)
{
do
{
- if (defender->is_player() && you.mutation[MUT_TRAMPLE_RESISTANCE])
+ if (defender->is_player()
+ && (you.mutation[MUT_TRAMPLE_RESISTANCE]
+ || player_equip_unrand(UNRAND_SUCTION)))
{
if (x_chance_in_y(9, 10))
return false;
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 285aa9b..fcc8456 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -1687,7 +1687,8 @@ const char *equip_slot_to_name(int equip)
{
if (equip == EQ_RINGS
|| equip == EQ_LEFT_RING || equip == EQ_RIGHT_RING
- || equip >= EQ_RING_ONE && equip <= EQ_RING_EIGHT)
+ || equip >= EQ_RING_ONE && equip <= EQ_RING_EIGHT
+ || equip == EQ_RING_AMULET)
{
return "Ring";
}
@@ -1750,6 +1751,7 @@ static void _print_overview_screen_equip(column_composer& cols,
EQ_GLOVES, EQ_BOOTS, EQ_AMULET, EQ_RIGHT_RING, EQ_LEFT_RING,
EQ_RING_ONE, EQ_RING_TWO, EQ_RING_THREE, EQ_RING_FOUR,
EQ_RING_FIVE, EQ_RING_SIX, EQ_RING_SEVEN, EQ_RING_EIGHT,
+ EQ_RING_AMULET,
};
char buf[100];
@@ -1770,6 +1772,7 @@ static void _print_overview_screen_equip(column_composer& cols,
continue;
}
+ // This skips over EQ_RING_AMULET, but that's probably okay for now.
if (you.species != SP_OCTOPODE && eqslot > EQ_AMULET)
continue;
diff --git a/crawl-ref/source/player-act.cc b/crawl-ref/source/player-act.cc
index d5ea690..e8b870c 100644
--- a/crawl-ref/source/player-act.cc
+++ b/crawl-ref/source/player-act.cc
@@ -233,6 +233,8 @@ brand_type player::damage_brand(int)
}
else if (duration[DUR_CONFUSING_TOUCH])
ret = SPWPN_CONFUSE;
+ else if (player_equip_unrand(UNRAND_GLOVES_TROG))
+ ret = SPWPN_ANTIMAGIC;
else
{
switch (form)
@@ -267,7 +269,7 @@ brand_type player::damage_brand(int)
}
// Returns the item in the given equipment slot, NULL if the slot is empty.
-// eq must be in [EQ_WEAPON, EQ_RING_EIGHT], or bad things will happen.
+// eq must be in [EQ_WEAPON, EQ_RING_AMULET], or bad things will happen.
item_def *player::slot_item(equipment_type eq, bool include_melded) const
{
ASSERT_RANGE(eq, EQ_WEAPON, NUM_EQUIP);
@@ -727,7 +729,7 @@ bool player::berserk() const
bool player::can_cling_to_walls() const
{
- return you.form == TRAN_SPIDER;
+ return you.form == TRAN_SPIDER || player_equip_unrand(UNRAND_SUCTION);
}
bool player::is_web_immune() const
diff --git a/crawl-ref/source/player-equip.cc b/crawl-ref/source/player-equip.cc
index 7749b7a..1c8ee40 100644
--- a/crawl-ref/source/player-equip.cc
+++ b/crawl-ref/source/player-equip.cc
@@ -2,6 +2,7 @@
#include "player-equip.h"
+#include "art-enum.h"
#include "areas.h"
#include "artefact.h"
#include "delay.h"
@@ -144,7 +145,8 @@ static void _equip_effect(equipment_type slot, int item_slot, bool unmeld,
ASSERT(slot == eq
|| eq == EQ_RINGS && (slot == EQ_LEFT_RING || slot == EQ_RIGHT_RING)
- || eq == EQ_RINGS && you.species == SP_OCTOPODE);
+ || eq == EQ_RINGS && you.species == SP_OCTOPODE
+ || eq == EQ_RINGS && player_equip_unrand(UNRAND_FINGER_AMULET));
if (msg)
_equip_use_warning(item);
@@ -168,7 +170,8 @@ static void _unequip_effect(equipment_type slot, int item_slot, bool meld,
ASSERT(slot == eq
|| eq == EQ_RINGS && (slot == EQ_LEFT_RING || slot == EQ_RIGHT_RING)
- || eq == EQ_RINGS && you.species == SP_OCTOPODE);
+ || eq == EQ_RINGS && you.species == SP_OCTOPODE
+ || eq == EQ_RINGS && player_equip_unrand(UNRAND_FINGER_AMULET));
if (slot == EQ_WEAPON)
_unequip_weapon_effect(item, msg, meld);
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 162530d..266f842 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -673,6 +673,13 @@ bool you_can_wear(int eq, bool special_armour)
return (eq >= EQ_RING_ONE && eq <= EQ_RING_EIGHT
|| eq == EQ_AMULET || eq == EQ_SHIELD || eq == EQ_WEAPON);
}
+
+ // Amulet provides another slot
+ if (player_equip_unrand(UNRAND_FINGER_AMULET))
+ {
+ if (eq == EQ_RING_AMULET)
+ return true;
+ }
switch (eq)
{
@@ -868,7 +875,8 @@ bool you_tran_can_wear(int eq, bool check_mutation)
// Everyone else can wear jewellery...
if (eq == EQ_AMULET || eq == EQ_RINGS
|| eq == EQ_LEFT_RING || eq == EQ_RIGHT_RING
- || eq == EQ_RING_ONE || eq == EQ_RING_TWO)
+ || eq == EQ_RING_ONE || eq == EQ_RING_TWO
+ || eq == EQ_RING_AMULET)
{
return true;
}
@@ -1260,6 +1268,9 @@ static int _player_bonus_regen()
{
// Rings.
rr += 40 * you.wearing(EQ_RINGS, RING_REGENERATION);
+
+ // Artefacts
+ rr += 40 * you.scan_artefacts(ARTP_REGENERATION);
// Troll leather (except for trolls).
if ((you.wearing(EQ_BODY_ARMOUR, ARM_TROLL_LEATHER_ARMOUR)
@@ -1418,11 +1429,12 @@ int player_hunger_rate(bool temp)
// All effects negated by magical suppression should go in here.
if (!you.suppressed())
{
- // rings
+ // rings and artefacts
if (you.hp < you.hp_max
&& player_mutation_level(MUT_SLOW_HEALING) < 3)
{
hunger += 3 * you.wearing(EQ_RINGS, RING_REGENERATION);
+ hunger += 3 * you.scan_artefacts(ARTP_REGENERATION);
}
hunger += 4 * you.wearing(EQ_RINGS, RING_HUNGER);
diff --git a/crawl-ref/source/spl-goditem.cc b/crawl-ref/source/spl-goditem.cc
index 17f4732..d4e0153 100644
--- a/crawl-ref/source/spl-goditem.cc
+++ b/crawl-ref/source/spl-goditem.cc
@@ -744,7 +744,7 @@ bool curse_item(bool armour, bool alreadyknown, string *pre_msg)
if (armour)
min_type = EQ_MIN_ARMOUR, max_type = EQ_MAX_ARMOUR;
else
- min_type = EQ_LEFT_RING, max_type = EQ_RING_EIGHT;
+ min_type = EQ_LEFT_RING, max_type = EQ_RING_AMULET;
for (int i = min_type; i <= max_type; i++)
{
if (you.equip[i] != -1 && !you.inv[you.equip[i]].cursed())
diff --git a/crawl-ref/source/util/art-data.pl b/crawl-ref/source/util/art-data.pl
index b7cfb18..abbfc3e 100755
--- a/crawl-ref/source/util/art-data.pl
+++ b/crawl-ref/source/util/art-data.pl
@@ -55,6 +55,7 @@ my %field_type = (
NOTELEP => "bool",
POISON => "bool",
RANDAPP => "bool",
+ REGEN => "bool",
RMSL => "bool",
RND_TELE => "bool",
SEEINV => "bool",
@@ -489,7 +490,7 @@ my @art_order = (
"NOSPELL", "RND_TELE", "NOTELEP", "ANGRY", "METAB", "\n",
"MUTATE", "ACC", "DAM", "CURSED", "STEALTH", "MP", "\n",
"BASE_DELAY", "HP", "CLARITY", "BASE_ACC", "BASE_DAM", "\n",
- "RMSL", "FOG", "\n",
+ "RMSL", "FOG", "REGEN", "\n",
"}",
"equip_func", "unequip_func", "world_reacts_func", "{fight_func_func",
diff --git a/crawl-ref/source/wiz-item.cc b/crawl-ref/source/wiz-item.cc
index ffef8ee..3216c6c 100644
--- a/crawl-ref/source/wiz-item.cc
+++ b/crawl-ref/source/wiz-item.cc
@@ -283,6 +283,7 @@ static const char* _prop_name[] = {
"BDam",
"RMsl",
"Fog",
+ "Regen",
};
#define ARTP_VAL_BOOL 0
@@ -326,6 +327,7 @@ static int8_t _prop_type[] = {
ARTP_VAL_ANY, //BASE_DAM
ARTP_VAL_BOOL, //RMSL
ARTP_VAL_BOOL, //FOG
+ ARTP_VAL_BOOL, //REGEN
};
static void _tweak_randart(item_def &item)
@@ -1011,7 +1013,8 @@ static void _debug_acquirement_stats(FILE *ostat)
EQ_WEAPON, EQ_BODY_ARMOUR, EQ_SHIELD, EQ_HELMET, EQ_CLOAK,
EQ_GLOVES, EQ_BOOTS, EQ_AMULET, EQ_RIGHT_RING, EQ_LEFT_RING,
EQ_RING_ONE, EQ_RING_TWO, EQ_RING_THREE, EQ_RING_FOUR,
- EQ_RING_FIVE, EQ_RING_SIX, EQ_RING_SEVEN, EQ_RING_EIGHT
+ EQ_RING_FIVE, EQ_RING_SIX, EQ_RING_SEVEN, EQ_RING_EIGHT,
+ EQ_RING_AMULET
};
bool naked = true;
@@ -1361,6 +1364,7 @@ static void _debug_rap_stats(FILE *ostat)
0, //ARTP_BASE_DAM
1, //ARTP_RMSL
1, //ARTP_FOG
+ 1, //ARTP_REGENERATION
-1
};
@@ -1508,6 +1512,7 @@ static void _debug_rap_stats(FILE *ostat)
"ARTP_BASE_DAM",
"ARTP_RMSL"
"ARTP_FOG",
+ "ARTP_REGENERATION",
};
fprintf(ostat, " All Good Bad\n");
--
1.8.2.3
0001-Change-Trog-s-Gloves-to-antimagic-while-berserk.patch [^] (2,162 bytes) 2013-09-01 23:18 [Show Content] [Hide Content]From 34765dd834d48127e19d81ae1c65591f2169465f Mon Sep 17 00:00:00 2001
From: pubby <pubby8@gmail.com>
Date: Sun, 1 Sep 2013 01:30:45 -0500
Subject: [PATCH 1/2] Change Trog's Gloves to antimagic while berserk.
Also, -cast was removed.
The previous effect was too specific; it was only useful to UC trog
worshippers that could wear gloves.
Requiring you to be berserk to get the antimagic makes the effect still
useful to berserkers, but is now useful to many more characters.
---
crawl-ref/source/art-data.txt | 4 ++--
crawl-ref/source/dat/descript/unrand.txt | 3 ++-
crawl-ref/source/player-act.cc | 2 +-
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/crawl-ref/source/art-data.txt b/crawl-ref/source/art-data.txt
index a63cf75..7a1890b 100644
--- a/crawl-ref/source/art-data.txt
+++ b/crawl-ref/source/art-data.txt
@@ -1074,8 +1074,8 @@ NAME: Trog's gloves
OBJ: OBJ_ARMOUR/ARM_GLOVES
PLUS: +0
COLOUR: ETC_BLOOD
-MAGIC: 30
-BOOL: regen, nospell
+MAGIC: 25
+BOOL: regen
NAME: Moon Troll leather armour
OBJ: OBJ_ARMOUR/ARM_TROLL_LEATHER_ARMOUR
diff --git a/crawl-ref/source/dat/descript/unrand.txt b/crawl-ref/source/dat/descript/unrand.txt
index 5c0ab8e..1387f46 100644
--- a/crawl-ref/source/dat/descript/unrand.txt
+++ b/crawl-ref/source/dat/descript/unrand.txt
@@ -464,7 +464,8 @@ guided by Makhleb.
%%%%
Trog's gloves
-A pair of gloves passed down from a great lineage of berserkers.
+A pair of gloves passed down from a great lineage of Troglodytes. It enchants
+your unarmed combat with an antimagic effect while berserking.
%%%%
Moon Troll leather armour
diff --git a/crawl-ref/source/player-act.cc b/crawl-ref/source/player-act.cc
index 698964e..28da481 100644
--- a/crawl-ref/source/player-act.cc
+++ b/crawl-ref/source/player-act.cc
@@ -235,7 +235,7 @@ brand_type player::damage_brand(int)
}
else if (duration[DUR_CONFUSING_TOUCH])
ret = SPWPN_CONFUSE;
- else if (player_equip_unrand(UNRAND_GLOVES_TROG))
+ else if (berserk() && player_equip_unrand(UNRAND_GLOVES_TROG))
ret = SPWPN_ANTIMAGIC;
else
{
--
1.8.2.3
0002-Fix-Rename-boots-of-suction-into-boots-of-bonding.patch [^] (3,496 bytes) 2013-09-01 23:18 [Show Content] [Hide Content]From d1267c264be121f9afa702ecc86a99bfff7407d7 Mon Sep 17 00:00:00 2001
From: pubby <pubby8@gmail.com>
Date: Sun, 1 Sep 2013 02:35:48 -0500
Subject: [PATCH 2/2] Fix+Rename boots of suction into boots of bonding.
Renamed to imply a boot covered in a sticky substance.
Their AC was increased by 1, and their clinging code was fixed.
---
crawl-ref/source/art-data.txt | 6 +++---
crawl-ref/source/art-func.h | 4 ++--
crawl-ref/source/dat/descript/unrand.txt | 5 +++--
crawl-ref/source/melee_attack.cc | 2 +-
crawl-ref/source/player-act.cc | 3 +--
5 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/crawl-ref/source/art-data.txt b/crawl-ref/source/art-data.txt
index 7a1890b..49d063d 100644
--- a/crawl-ref/source/art-data.txt
+++ b/crawl-ref/source/art-data.txt
@@ -1085,10 +1085,10 @@ BRAND: SPARM_SPIRIT_SHIELD
MP: +5
BOOL: regen
-ENUM: SUCTION
-NAME: boots of Ultimate Suction
+ENUM: BONDING
+NAME: boots of Bonding
OBJ: OBJ_ARMOUR/ARM_BOOTS
-PLUS: +5
+PLUS: +6
COLOUR: LIGHTMAGENTA
CURSED: 3
STEALTH: -50
diff --git a/crawl-ref/source/art-func.h b/crawl-ref/source/art-func.h
index f0fdbc5..7e6e986 100644
--- a/crawl-ref/source/art-func.h
+++ b/crawl-ref/source/art-func.h
@@ -821,12 +821,12 @@ static void _WOE_melee_effect(item_def* weapon, actor* attacker,
///////////////////////////////////////////////////
-static void _SUCTION_equip(item_def *item, bool *show_msgs, bool unmeld)
+static void _BONDING_equip(item_def *item, bool *show_msgs, bool unmeld)
{
_equip_mpr(show_msgs, "The boots bond to your feet with incredible force.");
}
-static void _SUCTION_unequip(item_def *item, bool *show_msgs)
+static void _BONDING_unequip(item_def *item, bool *show_msgs)
{
_equip_mpr(show_msgs, "You hear a satisfying slurp and then a pop.");
fake_noisy(15, you.pos());
diff --git a/crawl-ref/source/dat/descript/unrand.txt b/crawl-ref/source/dat/descript/unrand.txt
index 1387f46..7a32e38 100644
--- a/crawl-ref/source/dat/descript/unrand.txt
+++ b/crawl-ref/source/dat/descript/unrand.txt
@@ -471,9 +471,10 @@ Moon Troll leather armour
An enchanted hide from a now extinct species.
%%%%
-boots of Ultimate Suction
+boots of Bonding
-A novel pair of boots invented by a suitor of Arachne.
+A novel pair of boots invented by a suitor of Arachne. They are incredibly
+sticky which allows its wearer to cling to walls.
%%%%
Macabre Finger Necklace
diff --git a/crawl-ref/source/melee_attack.cc b/crawl-ref/source/melee_attack.cc
index 7bdc3b3..ea8ddf0 100644
--- a/crawl-ref/source/melee_attack.cc
+++ b/crawl-ref/source/melee_attack.cc
@@ -5298,7 +5298,7 @@ bool melee_attack::do_knockback(bool trample)
do
{
if (defender->is_player()
- && player_equip_unrand(UNRAND_SUCTION))
+ && player_equip_unrand(UNRAND_BONDING))
{
if (x_chance_in_y(9, 10))
return false;
diff --git a/crawl-ref/source/player-act.cc b/crawl-ref/source/player-act.cc
index 28da481..8ddfc06 100644
--- a/crawl-ref/source/player-act.cc
+++ b/crawl-ref/source/player-act.cc
@@ -724,8 +724,7 @@ bool player::berserk() const
bool player::can_cling_to_walls() const
{
- return form == TRAN_SPIDER;
- return form == TRAN_SPIDER || player_equip_unrand(UNRAND_SUCTION);
+ return form == TRAN_SPIDER || player_equip_unrand(UNRAND_BONDING);
}
bool player::is_web_immune() const
--
1.8.2.3
|