summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-28 02:38:40 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-28 02:38:40 +0000
commitd0e22192444cc1a233c24d234cc71c77b35f4c38 (patch)
treef349ff515c5094e7e4f8293428d312adbae5c740
parent2aa24954694bc86a4f9a8dbce8e991997c229311 (diff)
downloadcrawl-ref-d0e22192444cc1a233c24d234cc71c77b35f4c38.tar.gz
crawl-ref-d0e22192444cc1a233c24d234cc71c77b35f4c38.zip
Handle it properly when Xom tries to make your weapon a hostile dancing
weapon and fails. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4720 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/spells3.cc6
-rw-r--r--crawl-ref/source/spells3.h2
-rw-r--r--crawl-ref/source/xom.cc15
3 files changed, 13 insertions, 10 deletions
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index a63f9758ac..7d5181195b 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -471,7 +471,7 @@ void simulacrum(int power)
}
}
-void dancing_weapon(int pow, bool force_hostile)
+bool dancing_weapon(int pow, bool force_hostile)
{
int numsc = std::min(2 + (random2(pow) / 5), 6);
@@ -521,7 +521,7 @@ void dancing_weapon(int pow, bool force_hostile)
else
msg::stream << "Your " << your_hand(true) << " twitch."
<< std::endl;
- return;
+ return false;
}
// We are successful:
@@ -544,6 +544,8 @@ void dancing_weapon(int pow, bool force_hostile)
menv[summs].inv[MSLOT_WEAPON] = i;
menv[summs].colour = mitm[i].colour;
burden_change();
+
+ return true;
} // end dancing_weapon()
//
diff --git a/crawl-ref/source/spells3.h b/crawl-ref/source/spells3.h
index e8fc4bf846..49d60e2df1 100644
--- a/crawl-ref/source/spells3.h
+++ b/crawl-ref/source/spells3.h
@@ -82,7 +82,7 @@ bool project_noise(void);
/* ***********************************************************************
* called from: religion - spell
* *********************************************************************** */
-void dancing_weapon(int pow, bool force_hostile);
+bool dancing_weapon(int pow, bool force_hostile);
// updated 24may2000 {dlb}
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index bb8e61bc80..9f056c8932 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -837,13 +837,14 @@ static bool xom_is_bad(int sever)
}
else if (random2(sever) <= 9)
{
+ bool success = false;
+
if (one_chance_in(4))
- dancing_weapon(100, true); // nasty, but fun
+ success = dancing_weapon(100, true); // nasty, but fun
else
{
const int numdemons =
std::min(random2(random2(random2(sever+1)+1)+1)+1, 14);
- bool success = false;
for (int i = 0; i < numdemons; i++)
{
@@ -854,13 +855,13 @@ static bool xom_is_bad(int sever)
success = true;
}
}
+ }
- if (success)
- {
- god_speaks(GOD_XOM, _get_xom_speech("hostile monster"));
+ if (success)
+ {
+ god_speaks(GOD_XOM, _get_xom_speech("hostile monster"));
- done = true;
- }
+ done = true;
}
}
else if (random2(sever) <= 10)