summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/beam.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-07 11:58:54 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-07 11:58:54 +0000
commit167ae03b160a0ccadd7934b2bfe557d491f1cb1f (patch)
treec1ee0ef626b416c5eee0f62082da72cb9f4137c3 /crawl-ref/source/beam.cc
parent33dc7cedd5a65d3bd1ce8eff9006e4517a3390dd (diff)
downloadcrawl-ref-167ae03b160a0ccadd7934b2bfe557d491f1cb1f.tar.gz
crawl-ref-167ae03b160a0ccadd7934b2bfe557d491f1cb1f.zip
Another clean up, and add some new weapon speech.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6439 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/beam.cc')
-rw-r--r--crawl-ref/source/beam.cc19
1 files changed, 9 insertions, 10 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 7ec80af5c5..def9eea4b0 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -742,7 +742,7 @@ dice_def calc_dice( int num_dice, int max_damage )
// Divide the damage among the dice, and add one
// occasionally to make up for the fractions. -- bwr
ret.size = max_damage / num_dice;
- ret.size += (random2( num_dice ) < max_damage % num_dice);
+ ret.size += x_chance_in_y(max_damage % num_dice, num_dice);
}
return (ret);
@@ -4054,7 +4054,8 @@ static int _affect_player( bolt &beam, item_def *item )
if (you.equip[EQ_BODY_ARMOUR] != -1)
{
if (!player_light_armour(false) && one_chance_in(4)
- && random2(1000) <= item_mass( you.inv[you.equip[EQ_BODY_ARMOUR]] ))
+ && x_chance_in_y(item_mass(you.inv[you.equip[EQ_BODY_ARMOUR]]) + 1,
+ 1000))
{
exercise( SK_ARMOUR, 1 );
}
@@ -4106,8 +4107,8 @@ static int _affect_player( bolt &beam, item_def *item )
else if (item->special == SPMSL_POISONED)
{
if (!player_res_poison()
- && (hurted || (beam.ench_power == AUTOMATIC_HIT
- && random2(100) < 90 - (3 * player_AC()))))
+ && (hurted || beam.ench_power == AUTOMATIC_HIT
+ && x_chance_in_y(90 - 3 * player_AC(), 100)))
{
poison_player( 1 + random2(3) );
was_affected = true;
@@ -4115,7 +4116,7 @@ static int _affect_player( bolt &beam, item_def *item )
}
else if (item->special == SPMSL_CURARE)
{
- if (random2(100) < 90 - (3 * player_AC()))
+ if (x_chance_in_y(90 - 3 * player_AC(), 100))
{
curare_hits_player( _beam_ouch_agent(beam), 1 + random2(3) );
was_affected = true;
@@ -4736,22 +4737,20 @@ static int _affect_monster(bolt &beam, monsters *mon, item_def *item)
int num_levels = 0;
// ench_power == AUTOMATIC_HIT if this is a poisoned needle.
if (beam.ench_power == AUTOMATIC_HIT
- && random2(100) < 90 - (3 * mon->ac))
+ && x_chance_in_y(90 - 3 * mon->ac, 100))
{
num_levels = 2;
}
else if (random2(hurt_final) - random2(mon->ac) > 0)
- {
num_levels = 1;
- }
int num_success = 0;
if (YOU_KILL(beam.thrower))
{
const int skill_level = _name_to_skill_level(beam.name);
- if ( skill_level + 25 > random2(50) )
+ if (x_chance_in_y(skill_level + 25, 50))
num_success++;
- if ( skill_level > random2(50) )
+ if (x_chance_in_y(skill_level, 50))
num_success++;
}
else