summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/artefact.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-08-09 19:52:43 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-08-09 19:52:43 +0000
commitdedf3d075e5c6c7cb3aa7ccb6939723fd98254a1 (patch)
tree4abe0db12f63eea2149f14ded9b7a47f246aa701 /crawl-ref/source/artefact.cc
parentf7a49b238c645e9979a1619d590427f713e781cc (diff)
downloadcrawl-ref-dedf3d075e5c6c7cb3aa7ccb6939723fd98254a1.tar.gz
crawl-ref-dedf3d075e5c6c7cb3aa7ccb6939723fd98254a1.zip
Fix the weird beam tiles for unknown beam types.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10510 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/artefact.cc')
-rw-r--r--crawl-ref/source/artefact.cc23
1 files changed, 12 insertions, 11 deletions
diff --git a/crawl-ref/source/artefact.cc b/crawl-ref/source/artefact.cc
index 7fb3178569..e170ce540b 100644
--- a/crawl-ref/source/artefact.cc
+++ b/crawl-ref/source/artefact.cc
@@ -638,7 +638,8 @@ static int _randart_add_one_property( const item_def &item,
// An artefact will pass this check if it has any non-stat properties, and
// also if it has enough stat (AC, EV, Str, Dex, Int, Acc, Dam) properties.
-static bool _check_stat_props( const artefact_properties_t &proprt )
+// Returns how many (more) stat properties we need to add.
+static int _need_bonus_stat_props( const artefact_properties_t &proprt )
{
int num_stats = 0;
int num_acc_dam = 0;
@@ -656,22 +657,25 @@ static bool _check_stat_props( const artefact_properties_t &proprt )
else if (i >= ARTP_ACCURACY && i <= ARTP_DAMAGE)
num_acc_dam++;
else
- return (true);
+ return (0);
}
num_stats += num_acc_dam;
// If an artefact has no properties at all, something is wrong.
if (num_stats == 0)
- return (false);
+ return (2);
// Artefacts with two of more stat-only properties are fine.
if (num_stats >= 2)
- return (true);
+ return (0);
// If an artefact has exactly one stat property, we might want to add
- // some more. (50% chance if it's Acc/Dam, else always.)
- return (num_acc_dam > 0 || coinflip());
+ // some more. (66% chance if it's Acc/Dam, else always.)
+ if (num_acc_dam > 0)
+ return (random2(3));
+
+ return (1 + random2(2));
}
void static _get_randart_properties(const item_def &item,
@@ -1158,12 +1162,9 @@ void static _get_randart_properties(const item_def &item,
// "Boring" artefacts (no properties, or only one stat property)
// get an additional property, or maybe two of them.
- if (!_check_stat_props(proprt))
- {
+ int add_prop = _need_bonus_stat_props(proprt);
+ while (0 < add_prop--)
power_level += _randart_add_one_property(item, proprt);
- if (coinflip())
- power_level += _randart_add_one_property(item, proprt);
- }
if ((power_level < 2 && one_chance_in(5)) || one_chance_in(30))
{