summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-03 10:48:49 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-03 10:48:49 +0000
commit3471205dd3f3330d432b00ef79461abfdfe8f45c (patch)
treeb4202e55a5e145eee8388a3114fe2dc34cbfb5d8 /crawl-ref
parentd8537ce97fcc261408188af698b908948a0a2b84 (diff)
downloadcrawl-ref-3471205dd3f3330d432b00ef79461abfdfe8f45c.tar.gz
crawl-ref-3471205dd3f3330d432b00ef79461abfdfe8f45c.zip
Minor code cleanups.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2728 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/decks.cc2
-rw-r--r--crawl-ref/source/mon-util.cc26
-rw-r--r--crawl-ref/source/monstuff.cc1
3 files changed, 11 insertions, 18 deletions
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index e3808cb5d0..29be1c6757 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -1974,7 +1974,7 @@ static void trowel_card(int power, deck_rarity_type rarity)
}
if ( !done_stuff )
- mpr("Nothing appears to happen.");
+ canned_msg(MSG_NOTHING_HAPPENS);
return;
}
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 84e27d4843..9f9cd74b41 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -4422,8 +4422,8 @@ void monsters::apply_enchantment(const mon_enchant &me)
// the enchantment doubles as the durability of a net
// the more corroded it gets, the more easily it will break
- int hold = mitm[net].plus; // this will usually be negative
- int mon_size = body_size(PSIZE_BODY);
+ const int hold = mitm[net].plus; // this will usually be negative
+ const int mon_size = body_size(PSIZE_BODY);
// smaller monsters can escape more quickly
if (mon_size < random2(SIZE_BIG) // BIG = 5
@@ -4561,13 +4561,11 @@ void monsters::apply_enchantment(const mon_enchant &me)
del_ench(ENCH_SUBMERGED); // forced to surface
else if (hit_points <= max_hit_points / 2)
break;
- else if (((type == MONS_ELECTRICAL_EEL
- || type == MONS_LAVA_SNAKE)
- && (random2(1000) < 20
- || (mons_near(this)
- && hit_points == max_hit_points
- && !one_chance_in(10))))
- || random2(2000) < 10
+ else if (((type == MONS_ELECTRICAL_EEL || type == MONS_LAVA_SNAKE)
+ && (one_chance_in(50) || (mons_near(this)
+ && hit_points == max_hit_points
+ && !one_chance_in(10))))
+ || one_chance_in(200)
|| (mons_near(this)
&& hit_points == max_hit_points
&& !one_chance_in(5)))
@@ -4578,7 +4576,7 @@ void monsters::apply_enchantment(const mon_enchant &me)
}
case ENCH_POISON:
{
- int poisonval = me.degree;
+ const int poisonval = me.degree;
int dam = (poisonval >= 4) ? 1 : 0;
if (coinflip())
@@ -4610,8 +4608,7 @@ void monsters::apply_enchantment(const mon_enchant &me)
}
case ENCH_ROT:
{
- if (hit_points > 1
- && random2(1000) < 333)
+ if (hit_points > 1 && one_chance_in(3))
{
hurt_monster(this, 1);
if (hit_points < max_hit_points && coinflip())
@@ -4658,11 +4655,8 @@ void monsters::apply_enchantment(const mon_enchant &me)
case ENCH_GLOWING_SHAPESHIFTER: // this ench never runs out
// number of actions is fine for shapeshifters
- if (type == MONS_GLOWING_SHAPESHIFTER
- || random2(1000) < 250)
- {
+ if (type == MONS_GLOWING_SHAPESHIFTER || one_chance_in(4))
monster_polymorph(this, RANDOM_MONSTER, PPT_SAME);
- }
break;
case ENCH_SHAPESHIFTER: // this ench never runs out
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 3894c45254..92b457d3c9 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -5553,7 +5553,6 @@ static void mons_in_cloud(monsters *monster)
hurted -= random2(1 + monster->ac);
break; // to damage routine at end {dlb}
- // what of armour of poison resistance here? {dlb}
case CLOUD_POISON:
simple_monster_message(monster, " is engulfed in a cloud of poison!");