summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/newgame.cc
diff options
context:
space:
mode:
authorCharles Otto <ottochar@gmail.com>2009-11-02 22:24:53 -0500
committerCharles Otto <ottochar@gmail.com>2009-11-02 22:24:53 -0500
commite181fa40e7cbb65b803f221e234776d893c535a5 (patch)
treed41c415fab98c1ddb449ca6a3a4fba7af05dbc16 /crawl-ref/source/newgame.cc
parent6d4419975b494ee8cd6fd6bbc24e78afda1e0f0c (diff)
downloadcrawl-ref-e181fa40e7cbb65b803f221e234776d893c535a5.tar.gz
crawl-ref-e181fa40e7cbb65b803f221e234776d893c535a5.zip
Less consumables for wanderers
Just identify teleportation scrolls/healing potions instead of giving them out.
Diffstat (limited to 'crawl-ref/source/newgame.cc')
-rw-r--r--crawl-ref/source/newgame.cc56
1 files changed, 9 insertions, 47 deletions
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc
index bf38109359..fc71df9283 100644
--- a/crawl-ref/source/newgame.cc
+++ b/crawl-ref/source/newgame.cc
@@ -2220,62 +2220,24 @@ static void _good_potion_or_scroll(int & slot)
slot++;
}
-// Add a specified number of healing/teleportation items to the
-// inventory.
-static void _healing_or_teleport(int quantity, int & slot)
+// Make n random attempts at identifying healing or teleportation.
+static void _healing_or_teleport(int n)
{
- int healing_slot = -1;
- int teleport_slot = -1;
-
- for (int i = 0; i < slot; ++i)
- {
- if (you.inv[i].sub_type == SCR_TELEPORTATION
- && you.inv[i].base_type == OBJ_SCROLLS)
- {
- teleport_slot = i;
- }
- else if (you.inv[i].sub_type == POT_HEALING
- && you.inv[i].base_type == OBJ_POTIONS)
- {
- healing_slot = i;
- }
- }
-
int temp_rand = 2;
// No potions for mummies.
if (you.is_undead == US_UNDEAD)
temp_rand--;
- for (int i = 0; i < quantity; ++i)
+ for (int i = 0; i < n; ++i)
{
switch (random2(temp_rand))
{
case 0:
- if (teleport_slot == -1)
- {
- teleport_slot = slot;
- you.inv[teleport_slot].quantity = 0;
- you.inv[teleport_slot].base_type = OBJ_SCROLLS;
- you.inv[teleport_slot].plus = 0;
- you.inv[teleport_slot].plus2 = 0;
- you.inv[teleport_slot].sub_type = SCR_TELEPORTATION;
- slot++;
- }
- you.inv[teleport_slot].quantity++;
+ set_ident_type(OBJ_SCROLLS, SCR_TELEPORTATION, ID_KNOWN_TYPE);
break;
case 1:
- if (healing_slot == -1)
- {
- healing_slot = slot;
- you.inv[healing_slot].quantity = 0;
- you.inv[healing_slot].base_type = OBJ_POTIONS;
- you.inv[healing_slot].plus = 0;
- you.inv[healing_slot].plus2 = 0;
- you.inv[healing_slot].sub_type = POT_HEALING;
- slot++;
- }
- you.inv[healing_slot].quantity++;
+ set_ident_type(OBJ_POTIONS, POT_HEALING, ID_KNOWN_TYPE);
break;
}
}
@@ -2395,9 +2357,9 @@ void _wanderer_good_equipment(skill_type & skill, int & slot)
case SK_UNARMED_COMBAT:
case SK_INVOCATIONS:
{
- // Random consumables: 2x random healing/teleportation and 1
- // good potion/scroll.
- _healing_or_teleport(2, slot);
+ // Random consumables: 2x attempts to ID healing/teleportation
+ // 1 good potion/scroll.
+ _healing_or_teleport(2);
_good_potion_or_scroll(slot);
break;
}
@@ -2576,7 +2538,7 @@ void _wanderer_decent_equipment(skill_type & skill,
case SK_UNARMED_COMBAT:
case SK_INVOCATIONS:
case SK_EVOCATIONS:
- _healing_or_teleport(1, slot);
+ _healing_or_teleport(1);
break;
}
}