summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/randart.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-16 18:15:47 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-16 18:15:47 +0000
commitd90a2c7adcc5b54144b0a4136c7bcc6939d18900 (patch)
tree35354f50d604d756f9bbdc1dbb9a8b34a61fa968 /crawl-ref/source/randart.cc
parent4fb4c7cba1e4c4943c8683c48602c63f86a47a43 (diff)
downloadcrawl-ref-d90a2c7adcc5b54144b0a4136c7bcc6939d18900.tar.gz
crawl-ref-d90a2c7adcc5b54144b0a4136c7bcc6939d18900.zip
Fix TSO's artefact weapon blessing. A blessed weapon will now be marked
as a gift from him, gifts from him will always be of holy wrath and never poisoned, and make_item_randart() will now check for appropriateness of god gifts. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4262 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/randart.cc')
-rw-r--r--crawl-ref/source/randart.cc46
1 files changed, 33 insertions, 13 deletions
diff --git a/crawl-ref/source/randart.cc b/crawl-ref/source/randart.cc
index 57927f6863..8d9ceb8f42 100644
--- a/crawl-ref/source/randart.cc
+++ b/crawl-ref/source/randart.cc
@@ -59,7 +59,7 @@ static bool god_fits_artefact(const god_type which_god, const item_def &item)
{
case GOD_BEOGH:
if (brand == SPWPN_ORC_SLAYING)
- return (false);
+ return (false); // goes against orcish theme
break;
case GOD_ELYVILON: // peaceful healer god, no weapons, no berserking
@@ -89,6 +89,14 @@ static bool god_fits_artefact(const god_type which_god, const item_def &item)
return (false); // goes against anti-mutagenic theme
break;
+ case GOD_SHINING_ONE:
+ if (brand == SPWPN_VENOM)
+ return (false); // goes against anti-poison theme
+
+ if (brand != SPWPN_HOLY_WRATH)
+ return (false); // goes against holiness theme
+ break;
+
case GOD_SIF_MUNA:
case GOD_KIKUBAAQUDGHA:
case GOD_VEHUMET:
@@ -116,13 +124,11 @@ static bool god_fits_artefact(const god_type which_god, const item_def &item)
return (true);
}
-static std::string replace_name_parts(const std::string name_in,
- const item_def item)
+static god_type gift_from_god(const item_def item)
{
- std::string name = name_in;
-
// maybe god gift?
god_type god_gift = GOD_NO_GOD;
+
if (item.orig_monnum < 0)
{
int help = -item.orig_monnum - 2;
@@ -130,6 +136,16 @@ static std::string replace_name_parts(const std::string name_in,
god_gift = static_cast<god_type>(help);
}
+ return god_gift;
+}
+
+static std::string replace_name_parts(const std::string name_in,
+ const item_def item)
+{
+ std::string name = name_in;
+
+ god_type god_gift = gift_from_god(item);
+
// Don't allow "player's Death" type names for god gifts (except Xom!)
if (god_gift != GOD_NO_GOD && god_gift != GOD_XOM
&& name.find("@player_name@'s", 0) != std::string::npos
@@ -1238,13 +1254,7 @@ std::string randart_name( const item_def &item )
{
result += item_base_name(item) + " ";
- std::string name;
-
- // special case for blessed artefact weapons, since they're unique
- if (is_blessed(item))
- name = "of @player_name@";
- else
- name = getRandNameString(lookup);
+ std::string name = getRandNameString(lookup);
if (name.empty() && god_gift) // if nothing found, try god name alone
{
@@ -1277,6 +1287,13 @@ std::string randart_name( const item_def &item )
}
}
+ if (is_blessed(item) && god_gift)
+ {
+ result = item_base_name(item) + " ";
+ std::string name = "of @player_name@";
+ result += replace_name_parts(name, item);
+ }
+
return result;
}
@@ -1676,11 +1693,14 @@ bool make_item_randart( item_def &item )
item.flags |= ISFLAG_RANDART;
+ god_type god_gift = gift_from_god(item);
+
do
{
item.special = (random_int() & RANDART_SEED_MASK);
}
- while (randart_is_bad( item ));
+ while (randart_is_bad(item)
+ || (god_gift != GOD_NO_GOD && !god_fits_artefact(god_gift, item)));
return (true);
}