summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-09-14 21:37:09 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-09-14 21:37:09 +0000
commit5945e728fb8d65f4bf0bf90ab9979b7809db6350 (patch)
treee3f71a17289e664d1a4c34236e207dff6262fbb2 /crawl-ref
parent50ebba493b26cbee7f13852a6dc68659e35115b2 (diff)
downloadcrawl-ref-5945e728fb8d65f4bf0bf90ab9979b7809db6350.tar.gz
crawl-ref-5945e728fb8d65f4bf0bf90ab9979b7809db6350.zip
God-gifted (i.e. Nemelex-gifted) decks now ID after one card if it's not
an oddity draw, since these decks are pure and there can be no confusion. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6931 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/decks.cc15
-rw-r--r--crawl-ref/source/items.cc15
-rw-r--r--crawl-ref/source/items.h1
-rw-r--r--crawl-ref/source/mon-util.cc2
4 files changed, 28 insertions, 5 deletions
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index 2db2d0915a..33653f0387 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -445,7 +445,7 @@ static bool _wielding_deck()
return is_deck(you.inv[you.equip[EQ_WEAPON]]);
}
-static void _remember_drawn_card(item_def& deck, card_type card)
+static void _remember_drawn_card(item_def& deck, card_type card, bool allow_id)
{
ASSERT( is_deck(deck) );
CrawlHashTable &props = deck.props;
@@ -453,8 +453,11 @@ static void _remember_drawn_card(item_def& deck, card_type card)
drawn.push_back( static_cast<char>(card) );
// Once you've drawn two cards, you know the deck.
- if (drawn.size() >= 2)
+ if (allow_id &&
+ (drawn.size() >= 2 || origin_is_god_gift(deck)))
+ {
_deck_ident(deck);
+ }
}
const std::vector<card_type> get_drawn_cards(const item_def& deck)
@@ -1108,7 +1111,7 @@ bool deck_triple_draw()
// Note how many cards were removed from the deck.
deck.plus2 += num_to_draw;
for (int i = 0; i < num_to_draw; ++i)
- _remember_drawn_card(deck, draws[i]);
+ _remember_drawn_card(deck, draws[i], false);
you.wield_change = true;
// Make deck disappear *before* the card effect, since we
@@ -1194,6 +1197,10 @@ void evoke_deck( item_def& deck )
unsigned char flags = 0;
card_type card = _draw_top_card(deck, true, flags);
+ // Oddity cards don't give any information about the deck.
+ if (flags & CFLAG_ODDITY)
+ allow_id = false;
+
// Passive Nemelex retribution: sometimes a card gets swapped out.
// More likely to happen with marked decks.
if (you.penance[GOD_NEMELEX_XOBEH])
@@ -1232,7 +1239,7 @@ void evoke_deck( item_def& deck )
props["non_brownie_draws"]--;
deck.plus2++;
- _remember_drawn_card(deck, card);
+ _remember_drawn_card(deck, card, allow_id);
// Get rid of the deck *before* the card effect because a card
// might cause a wielded deck to be swapped out for something else,
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index d206da25d4..df5ad56637 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -1020,6 +1020,21 @@ static bool _origin_is_original_equip(const item_def &item)
return (item.orig_place == 0xFFFFU && item.orig_monnum == -1);
}
+bool origin_is_god_gift(const item_def& item)
+{
+ if (!origin_describable(item))
+ return false;
+
+ if (_origin_is_original_equip(item))
+ return false;
+
+ if (item.orig_monnum >= 0)
+ return false;
+
+ const int iorig = -item.orig_monnum - 2;
+ return (iorig > AQ_SCROLL && iorig < AQ_CARD_GENIE);
+}
+
std::string origin_desc(const item_def &item)
{
if (!origin_describable(item))
diff --git a/crawl-ref/source/items.h b/crawl-ref/source/items.h
index f671d291cb..25db8927f6 100644
--- a/crawl-ref/source/items.h
+++ b/crawl-ref/source/items.h
@@ -134,6 +134,7 @@ void origin_acquired(item_def &item, int agent);
void origin_set_startequip(item_def &item);
void origin_set_unknown(item_def &item);
void origin_set_inventory( void (*oset)(item_def &item) );
+bool origin_is_god_gift(const item_def& item);
std::string origin_monster_name(const item_def &item);
bool item_needs_autopickup(const item_def &);
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 45453355fc..8d8554f162 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -5188,7 +5188,7 @@ bool monsters::is_travelling() const
bool monsters::is_patrolling() const
{
- return (patrol_point != coord_def(0, 0));
+ return (!patrol_point.origin());
}
bool monsters::needs_transit() const