summaryrefslogtreecommitdiffstats
path: root/crawl-ref
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
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')
-rw-r--r--crawl-ref/README.txt12
-rw-r--r--crawl-ref/settings/messages.txt2
-rw-r--r--crawl-ref/source/abyss.cc2
-rw-r--r--crawl-ref/source/acr.cc14
-rw-r--r--crawl-ref/source/beam.cc19
-rw-r--r--crawl-ref/source/cloud.cc2
-rw-r--r--crawl-ref/source/dat/database/wpnnoise.txt94
-rw-r--r--crawl-ref/source/decks.cc2
-rw-r--r--crawl-ref/source/describe.cc2
-rw-r--r--crawl-ref/source/dungeon.cc2
-rw-r--r--crawl-ref/source/effects.cc11
-rw-r--r--crawl-ref/source/fight.cc27
-rw-r--r--crawl-ref/source/food.cc4
-rw-r--r--crawl-ref/source/ghost.cc15
-rw-r--r--crawl-ref/source/it_use3.cc10
-rw-r--r--crawl-ref/source/item_use.cc10
-rw-r--r--crawl-ref/source/items.cc16
-rw-r--r--crawl-ref/source/makeitem.cc84
-rw-r--r--crawl-ref/source/mapdef.cc12
-rw-r--r--crawl-ref/source/misc.cc6
-rw-r--r--crawl-ref/source/mon-util.cc6
-rw-r--r--crawl-ref/source/monstuff.cc12
-rw-r--r--crawl-ref/source/ouch.cc9
-rw-r--r--crawl-ref/source/player.cc4
-rw-r--r--crawl-ref/source/randart.cc6
-rw-r--r--crawl-ref/source/religion.cc43
-rw-r--r--crawl-ref/source/spells4.cc2
-rw-r--r--crawl-ref/source/spl-book.cc2
-rw-r--r--crawl-ref/source/spl-cast.cc8
-rw-r--r--crawl-ref/source/traps.cc50
-rw-r--r--crawl-ref/source/view.cc9
-rw-r--r--crawl-ref/source/xom.cc40
32 files changed, 306 insertions, 231 deletions
diff --git a/crawl-ref/README.txt b/crawl-ref/README.txt
index e9010dbf7d..e6b9749d63 100644
--- a/crawl-ref/README.txt
+++ b/crawl-ref/README.txt
@@ -25,9 +25,9 @@ If you'd like to dive in immediately, your best bets are to
* read quickstart.txt (in the /docs directory), or
* for studious readers, browse the manual (see below for all doc files).
-Additionally, you may want to print out the file keys.pdf from the /docs
-folder. Besides a full list of command keys (don't bother with it), it contains
-two pages of help for new players.
+If you're used to playing an older version, you might want to print out the
+file key_changes.pdf from the /docs for an easy reference of new commands
+and changed key settings.
Note that you can read quickstart.txt and the manual when playing; pressing '?'
brings up a menu for that.
@@ -53,10 +53,12 @@ read in-game by bringing up the help menu with '?'):
* aptitudes.txt Some numbers defining certain aspects of the races.
Helpful, but not needed for winning.
* quickstart.txt A short introduction for new players.
+* quickstart.pdf The same file, in pdf format.
* ssh_guide.txt An elaborate introduction on how to get internet play
to work. For Windows only.
-* keys.pdf A printable document, listing all commands and it also
- contains a very short guide for new players.
+* tiles_help.txt An explanation of the Tiles interface.
+* key_changes.pdf A printable document, listing all new commands and
+ changed key settings.
The settings/ folder contains, among others, the following files:
diff --git a/crawl-ref/settings/messages.txt b/crawl-ref/settings/messages.txt
index 1fe894831f..5227d46a20 100644
--- a/crawl-ref/settings/messages.txt
+++ b/crawl-ref/settings/messages.txt
@@ -35,5 +35,5 @@ msc = darkgrey:You start (resting|searching)
msc = darkgrey:Unknown command
msc = darkgrey:disappears in a puff of smoke
#
-msc = darkgrey:miss(es)? (the|you|it)
+msc = darkgrey:plain:miss(es)? (the|you|it)
msc = darkgrey:but (do no|doesn't do any) damage
diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc
index 2ef221a30a..e3e850af08 100644
--- a/crawl-ref/source/abyss.cc
+++ b/crawl-ref/source/abyss.cc
@@ -231,7 +231,7 @@ static void _generate_area(int gx1, int gy1, int gx2, int gy2,
for (int i = gx1; i <= gx2; i++)
for (int j = gy1; j <= gy2; j++)
{
- if (grd[i][j] == DNGN_UNSEEN && random2(100) <= thickness)
+ if (grd[i][j] == DNGN_UNSEEN && x_chance_in_y(thickness + 1, 100))
{
grd[i][j] = DNGN_FLOOR;
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 80e55b8fc9..2e7a26b559 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -2851,7 +2851,7 @@ static void _decrement_durations()
// Note the beauty of Trog! They get an extra save that's at
// the very least 20% and goes up to 100%.
- if (you.religion == GOD_TROG && you.piety > random2(150)
+ if (you.religion == GOD_TROG && x_chance_in_y(you.piety, 150)
&& !player_under_penance())
{
mpr("Trog's vigour flows through your veins.");
@@ -2949,7 +2949,7 @@ static void _decrement_durations()
// to even start rotting right now, but that could be changed. -- bwr
if (you.species == SP_MUMMY)
you.rotting = 0;
- else if (random2(20) <= (you.rotting - 1))
+ else if (x_chance_in_y(you.rotting, 20))
{
mpr("You feel your flesh rotting away.", MSGCH_WARN);
ouch(1, 0, KILLED_BY_ROTTING);
@@ -2980,7 +2980,7 @@ static void _decrement_durations()
if (you.duration[DUR_POISONING] > 0)
{
- if (random2(5) <= (you.duration[DUR_POISONING] - 1))
+ if (x_chance_in_y(you.duration[DUR_POISONING], 5))
{
if (you.duration[DUR_POISONING] > 10 && random2(you.duration[DUR_POISONING]) >= 8)
{
@@ -3096,15 +3096,15 @@ static void _world_reacts()
run_environment_effects();
- if ( !you.cannot_act() && !player_mutation_level(MUT_BLURRY_VISION)
- && random2(50) < you.skills[SK_TRAPS_DOORS] )
+ if (!you.cannot_act() && !player_mutation_level(MUT_BLURRY_VISION)
+ && x_chance_in_y(you.skills[SK_TRAPS_DOORS], 50))
{
- search_around(false); // check nonadjacent squares too
+ search_around(false); // Check nonadjacent squares too.
}
stealth = check_stealth();
-#if 0
+#ifdef DEBUG_STEALTH
// Too annoying for regular diagnostics.
mprf(MSGCH_DIAGNOSTICS, "stealth: %d", stealth );
#endif
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
diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc
index 24b62e6977..9b01fa84d6 100644
--- a/crawl-ref/source/cloud.cc
+++ b/crawl-ref/source/cloud.cc
@@ -541,7 +541,7 @@ void in_a_cloud()
case CLOUD_MIASMA:
mpr("You are engulfed in a dark miasma.");
- if (player_prot_life() > random2(3))
+ if (x_chance_in_y(player_prot_life(), 3))
return;
poison_player(1);
diff --git a/crawl-ref/source/dat/database/wpnnoise.txt b/crawl-ref/source/dat/database/wpnnoise.txt
index 3526bf7174..3821aa06f4 100644
--- a/crawl-ref/source/dat/database/wpnnoise.txt
+++ b/crawl-ref/source/dat/database/wpnnoise.txt
@@ -68,9 +68,11 @@ weapon_sings
@The_weapon@ makes a painfully high-pitched squeak.
+@The_weapon@ sings an ear-splitting high note.
+
@The_weapon@ sings a sudden staccato note.
-@The_weapon@ sings a catchy @tune_or_melody@.
+@The_weapon@ @sings_or_hums@ a catchy @tune_or_melody@.
@The_weapon@ hums a slow waltz.
@@ -89,7 +91,7 @@ weapon_sings
@The_weapon@ hums an eerie @tune_or_melody@.
-@The_weapon@ hums a slow and mournful tune.
+@The_weapon@ @sings_or_hums@ a slow and mournful tune.
@The_weapon@ launches into yet another solo.
@@ -105,6 +107,8 @@ weapon_sings
@The_weapon@ sings a little jingle.
+@The_weapon@ raucously launches into song.
+
@The_weapon@ strikes up a funeral march.
@The_weapon@ merrily whistles a melody.
@@ -127,6 +131,12 @@ In a hysterical voice, @the_weapon@ strikes up a march.
@The_weapon@ @nearly_or_clearly@ @hits_or_misses@ the concert pitch.
+@The_weapon@ sings a song about @song_theme@.
+
+@The_weapon@ composes a hymn about @song_theme@.
+
+@The_weapon@ composes a ballad about your adventures.
+
#imitates instruments
@The_weapon@ makes a twanging sound.
@@ -179,6 +189,8 @@ In a hysterical voice, @the_weapon@ strikes up a march.
@The_weapon@ tries to improvise rhymes, and fails miserably.
+@The_weapon@ asks you for a rhyme on '@rhyme_word@'.
+
@The_weapon@ complains about @double_or_triple@ swords.
@The_weapon@ derides short swords.
@@ -187,6 +199,12 @@ In a hysterical voice, @the_weapon@ strikes up a march.
@The_weapon@ chants, "Rather stab than club, rather slice than rub!"
+@The_weapon@ says, "Whips just don't cut it for me, don't you agree?"
+
+@The_weapon@ muses on the connection between 'duet' and 'duel'.
+
+@Your_weapon@ wails, "I am too young to rust!"
+
# end Singing Sword
%%%%
############################################################
@@ -210,9 +228,9 @@ weapon_talks
@Your_weapon@ cheers you on.
-@Your_weapon@ calls out a warning!
+@Your_weapon@ intones a prayer.
-@Your_weapon@ hurls insults at you.
+@Your_weapon@ calls out a warning!
@Your_weapon@ chatters happily.
@@ -241,11 +259,9 @@ weapon_talks
@Your_weapon@ amuses itself with detailed descriptions of past executions.
-@Your_weapon@ wails, "I am too young to rust!"
-
@Your_weapon@ wishes everyone in the dungeon @unpleasant_or_sudden@ @demise_or_death@.
-@Your_weapon@ fumes, "Being battered, bent and broken sure is better than this boredom!"
+@Your_weapon@ fumes, "Being battered, bent, and broken sure is better than this boredom!"
@Your_weapon@ yells, "No battle, no fun!"
@@ -263,12 +279,36 @@ weapon_talks
@Your_weapon@ shouts, "Left! No, no, right!".
-@Your_weapon@ says, "How I wish you were a better fighter."
+@Your_weapon@ sighs, "How I wish you were a better fighter."
@Your_weapon@ grouses, "Could you please kill something? I'm itching all over."
@Your_weapon@ shouts, "Make war, not love!"
+@Your_weapon@ cries out, "You certainly can't call me dull!"
+
+@Your_weapon@ tells you the story of its previous owner's @demise_or_death@.
+
+@Your_weapon@ brightly announces, "I've got so much to tell you!"
+
+@Your_weapon@ comments on your fighting techniques.
+
+@Your_weapon@ says, "You could say something too, you know."
+
+@Your_weapon@ complains, "Are you always this @silent@?"
+
+@Your_weapon@ says, "Why don't you say something for a change?"
+
+@Your_weapon@ asks, "Did you take a vow of silence?"
+
+@Your_weapon@ shouts a battle cry!
+
+@Your_weapon@ shouts, "Onwards! It's kill or die!"
+
+@Your_weapon@ says, "You can tell me everything! I can keep a secret!"
+
+@Your_weapon@ grouses, "Silence can be so depressing."
+
#makes noises
@Your_weapon@ growls menacingly.
@@ -310,8 +350,6 @@ weapon_talks
@Your_weapon@ yawns loudly.
-@Your_weapon@ intones a prayer.
-
@Your_weapon@ cries out!
@Your_weapon@ swears loudly.
@@ -346,6 +384,8 @@ weapon_talks
@Your_weapon@ yelps loudly!
+@Your_weapon@ cheers!
+
@Your_weapon@ lets out a series of bird calls.
# end weapon chatter
@@ -474,6 +514,12 @@ waltz
menuet
%%%%
+sings_or_hums
+
+sings
+
+hums
+%%%%
an_aria_or_fugue
an aria
@@ -522,3 +568,31 @@ double
triple
%%%%
+rhyme_word
+
+fountain of blood
+
+killing spree
+
+battlefield
+%%%%
+song_theme
+
+battle and fame
+
+death and destruction
+
+the glory of death
+%%%%
+silent
+
+uncommunicative
+
+taciturn
+
+quiet
+
+silent
+
+boring
+%%%% \ No newline at end of file
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index de5e5c5a62..6298404b97 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -2225,7 +2225,7 @@ static void _deepen_water(const coord_def& center, int radius)
const coord_def p = *ri;
if (grd(p) == DNGN_SHALLOW_WATER
&& p != you.pos()
- && random2(8) < 1 + count_neighbours(p.x, p.y, DNGN_DEEP_WATER))
+ && x_chance_in_y(1+count_neighbours(p.x, p.y, DNGN_DEEP_WATER), 8))
{
dungeon_terrain_changed(p, DNGN_DEEP_WATER);
}
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 2b122cbc63..5adabd8e35 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -743,7 +743,7 @@ static std::string _describe_demon(const monsters &mons)
description << ".";
- if (random2(40) < 3)
+ if (x_chance_in_y(3, 40))
{
if (player_can_smell())
{
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 927e8fc600..622f97ef5d 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -7698,7 +7698,7 @@ bool dgn_region::overlaps(const map_mask &mask) const
coord_def dgn_region::random_edge_point() const
{
- return random2(size.x + size.y) < size.x ?
+ return x_chance_in_y(size.x, size.x + size.y) ?
coord_def( pos.x + random2(size.x),
coinflip()? pos.y : pos.y + size.y - 1 )
: coord_def( coinflip()? pos.x : pos.x + size.x - 1,
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 26d2847bef..db5f40a017 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -2474,9 +2474,9 @@ void handle_time(long time_delta)
}
}
- // Adjust the player's stats if s/he has the deterioration mutation
+ // Adjust the player's stats if s/he has the deterioration mutation.
if (player_mutation_level(MUT_DETERIORATION)
- && random2(200) <= player_mutation_level(MUT_DETERIORATION) * 5 - 2)
+ && x_chance_in_y(player_mutation_level(MUT_DETERIORATION) * 5 - 1, 200))
{
lose_stat(STAT_RANDOM, 1, false, "deterioration mutation");
}
@@ -2531,13 +2531,13 @@ void handle_time(long time_delta)
// roll.)
if (is_sanctuary(you.x_pos, you.y_pos)
&& you.magic_contamination >= 5
- && random2(25) <= you.magic_contamination)
+ && x_chance_in_y(you.magic_contamination + 1, 25))
{
mpr("Your body momentarily shudders from a surge of wild "
"energies until Zin's power calms it.", MSGCH_GOD);
}
else if (you.magic_contamination >= 5
- && random2(25) <= you.magic_contamination)
+ && x_chance_in_y(you.magic_contamination + 1, 25))
{
mpr("Your body shudders with the violent release "
"of wild energies!", MSGCH_WARN);
@@ -2654,11 +2654,10 @@ void handle_time(long time_delta)
}
// Check to see if an upset god wants to do something to the player.
- // jmf: moved huge thing to religion.cc
handle_god_time();
if (player_mutation_level(MUT_SCREAM)
- && (random2(100) <= 2 + player_mutation_level(MUT_SCREAM) * 3))
+ && x_chance_in_y(3 + player_mutation_level(MUT_SCREAM) * 3, 100))
{
yell(true);
}
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 0bbfc47f96..21fcd0613c 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -1477,7 +1477,7 @@ void melee_attack::player_weapon_auto_id()
&& weapon->base_type == OBJ_WEAPONS
&& !is_range_weapon( *weapon )
&& !item_ident( *weapon, ISFLAG_KNOW_PLUSES )
- && random2(100) < you.skills[ wpn_skill ])
+ && x_chance_in_y(you.skills[ wpn_skill ], 100))
{
set_ident_flags( *weapon, ISFLAG_KNOW_PLUSES );
mprf("You are wielding %s.", weapon->name(DESC_NOCAP_A).c_str());
@@ -1542,7 +1542,7 @@ int melee_attack::player_stab(int damage)
if (mons_is_sleeping(def))
{
// Sleeping moster wakes up when stabbed but may be groggy.
- if (random2(200) <= you.skills[SK_STABBING] + you.dex)
+ if (x_chance_in_y(you.skills[SK_STABBING] + you.dex + 1, 200))
{
int stun = random2( you.dex + 1 );
@@ -2319,8 +2319,8 @@ bool melee_attack::apply_damage_brand()
break;
}
case SPWPN_PAIN:
- if (defender->res_negative_energy()
- && random2(8) <= attacker->skill(SK_NECROMANCY))
+ if (!defender->res_negative_energy()
+ && x_chance_in_y(attacker->skill(SK_NECROMANCY) + 1, 8))
{
if (defender_visible)
{
@@ -2350,7 +2350,7 @@ bool melee_attack::apply_damage_brand()
if (mons_class_is_confusable(def->type)
&& hdcheck >= defender->get_experience_level())
{
- // declaring these just to pass to the enchant function
+ // Declaring these just to pass to the enchant function.
bolt beam_temp;
beam_temp.thrower =
attacker->atype() == ACT_PLAYER? KILL_YOU : KILL_MON;
@@ -2586,13 +2586,13 @@ void melee_attack::player_apply_staff_damage()
case STAFF_POISON:
{
- // cap chance at 30% -- let staff of Olgreb shine
+ // Cap chance at 30% -- let staff of Olgreb shine.
int temp_rand = damage_done + you.skills[SK_POISON_MAGIC];
if (temp_rand > 30)
temp_rand = 30;
- if (random2(100) < temp_rand)
+ if (x_chance_in_y(temp_rand, 100))
{
// Poison monster message needs to arrive after hit message.
emit_nodmg_hit_message();
@@ -2605,7 +2605,7 @@ void melee_attack::player_apply_staff_damage()
if (mons_res_negative_energy(def))
break;
- if (random2(8) <= you.skills[SK_NECROMANCY])
+ if (x_chance_in_y(you.skills[SK_NECROMANCY] + 1, 8))
{
special_damage = player_staff_damage(SK_NECROMANCY);
@@ -2876,8 +2876,8 @@ void melee_attack::player_stab_check()
bool roll_needed = true;
int roll = 155;
- // This ordering is important!
+ // This ordering is important!
switch (unchivalric)
{
default:
@@ -2919,7 +2919,10 @@ void melee_attack::player_stab_check()
// See if we need to roll against dexterity / stabbing.
if (stab_attempt && roll_needed)
- stab_attempt = (random2(roll) <= you.skills[SK_STABBING] + you.dex);
+ {
+ stab_attempt = x_chance_in_y(you.skills[SK_STABBING] + you.dex + 1,
+ roll);
+ }
}
void melee_attack::player_apply_attack_delay()
@@ -3500,7 +3503,7 @@ void melee_attack::check_defender_train_armour()
return;
const item_def *arm = defender->slot_item(EQ_BODY_ARMOUR);
- if (arm && coinflip() && random2(1000) <= item_mass(*arm))
+ if (arm && coinflip() && x_chance_in_y(item_mass(*arm) + 1, 1000))
defender->exercise(SK_ARMOUR, coinflip()? 2 : 1);
}
@@ -3707,7 +3710,7 @@ void melee_attack::mons_apply_attack_flavour(const mon_attack_def &attk)
if (mons_is_summoned(def))
break;
- if (defender->res_negative_energy() > random2(3))
+ if (x_chance_in_y(defender->res_negative_energy(), 3))
break;
if (defender->stat_hp() < defender->stat_maxhp())
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index 6c92065f09..b915203df7 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -1773,7 +1773,7 @@ void vampire_nutrition_per_turn(const item_def &corpse, int feeding)
// Human blood gives extra healing during feeding.
if (hp_amt >= duration)
hp_amt /= duration;
- else if (random2(duration) < hp_amt)
+ else if (x_chance_in_y(hp_amt, duration))
hp_amt = 1;
_heal_from_food(hp_amt, 0, one_chance_in(duration/2),
@@ -2259,7 +2259,7 @@ static int _determine_chunk_effect(int which_chunk_type, bool rotten_chunk)
// saprovores get rotting meat effect from clean chunks, since they
// love rotting meat.
if (wearing_amulet(AMU_THE_GOURMAND)
- && random2(GOURMAND_MAX) < you.duration[DUR_GOURMAND])
+ && x_chance_in_y(you.duration[DUR_GOURMAND], GOURMAND_MAX))
{
if (player_mutation_level(MUT_SAPROVOROUS) == 3)
{
diff --git a/crawl-ref/source/ghost.cc b/crawl-ref/source/ghost.cc
index b4f2788ab7..728489b8f2 100644
--- a/crawl-ref/source/ghost.cc
+++ b/crawl-ref/source/ghost.cc
@@ -533,6 +533,7 @@ void ghost_demon::find_extra_ghosts( std::vector<ghost_demon> &gs, int n )
find_transiting_ghosts(gs, n);
}
+// Returns the number of extra ghosts allowed on the level.
int ghost_demon::n_extra_ghosts()
{
const int lev = you.your_level + 1;
@@ -554,15 +555,19 @@ int ghost_demon::n_extra_ghosts()
return (0);
// No multiple ghosts until level 9 of the main dungeon.
- if ((lev < 9 && you.where_are_you == BRANCH_MAIN_DUNGEON)
- || (subdepth < 2 && you.where_are_you == BRANCH_LAIR)
- || (subdepth < 2 && you.where_are_you == BRANCH_ORCISH_MINES))
+ if (lev < 9 && you.where_are_you == BRANCH_MAIN_DUNGEON
+ || subdepth < 2 && you.where_are_you == BRANCH_LAIR
+ || subdepth < 2 && you.where_are_you == BRANCH_ORCISH_MINES)
+ {
return (0);
+ }
if (you.where_are_you == BRANCH_LAIR
|| you.where_are_you == BRANCH_ORCISH_MINES
- || (you.where_are_you == BRANCH_MAIN_DUNGEON && lev < 15))
+ || you.where_are_you == BRANCH_MAIN_DUNGEON && lev < 15)
+ {
return (1);
+ }
- return 1 + (random2(20) < lev) + (random2(40) < lev);
+ return (1 + x_chance_in_y(lev, 20) + x_chance_in_y(lev, 40));
}
diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc
index a247b568f5..ef0ed9af09 100644
--- a/crawl-ref/source/it_use3.cc
+++ b/crawl-ref/source/it_use3.cc
@@ -223,7 +223,7 @@ void special_wielded()
break;
case SPWLD_SHADOW:
- if (random2(8) <= player_spec_death())
+ if (x_chance_in_y(player_spec_death() + 1, 8))
{
create_monster(
mgen_data(MONS_SHADOW, BEH_FRIENDLY,
@@ -514,7 +514,7 @@ bool evoke_wielded()
your_spells( SPELL_OLGREBS_TOXIC_RADIANCE, power, false );
- if (you.skills[SK_EVOCATIONS] >= random2(10))
+ if (x_chance_in_y(you.skills[SK_EVOCATIONS] + 1, 10))
your_spells( SPELL_VENOM_BOLT, power, false );
break;
@@ -563,7 +563,7 @@ bool evoke_wielded()
else if (wpn.sub_type == STAFF_CHANNELING)
{
if (you.magic_points < you.max_magic_points
- && you.skills[SK_EVOCATIONS] + 10 >= random2(40))
+ && x_chance_in_y(you.skills[SK_EVOCATIONS] + 11, 40))
{
mpr("You channel some magical energy.");
inc_mp( 1 + random2(3), false );
@@ -695,7 +695,7 @@ bool evoke_wielded()
static bool efreet_flask(void)
{
- bool friendly = (you.skills[SK_EVOCATIONS] / 3 + 10 > random2(20));
+ bool friendly = x_chance_in_y(10 + you.skills[SK_EVOCATIONS] / 3, 20);
mpr("You open the flask...");
@@ -960,7 +960,7 @@ static bool box_of_beasts()
mpr("You open the lid...");
- if (random2(100) < 60 + you.skills[SK_EVOCATIONS])
+ if (x_chance_in_y(60 + you.skills[SK_EVOCATIONS], 100))
{
monster_type beasty = MONS_PROGRAM_BUG;
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 568645fc89..af14f7570b 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -2242,7 +2242,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
{
if (!teleport
&& !item_ident(you.inv[throw_2], ISFLAG_KNOW_PLUSES)
- && random2(100) < shoot_skill)
+ && x_chance_in_y(shoot_skill, 100))
{
set_ident_flags( item, ISFLAG_KNOW_PLUSES );
set_ident_flags( you.inv[throw_2], ISFLAG_KNOW_PLUSES );
@@ -2251,7 +2251,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
you.inv[throw_2].name(DESC_NOCAP_A).c_str());
}
}
- else if (!teleport && random2(100) < shoot_skill)
+ else if (!teleport && x_chance_in_y(shoot_skill, 100))
{
item_def& weapon = you.inv[you.equip[EQ_WEAPON]];
set_ident_flags(weapon, ISFLAG_KNOW_PLUSES);
@@ -2414,7 +2414,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
// ID check
if (!teleport
&& !item_ident(you.inv[throw_2], ISFLAG_KNOW_PLUSES)
- && random2(100) < you.skills[SK_THROWING])
+ && x_chance_in_y(you.skills[SK_THROWING], 100))
{
set_ident_flags( item, ISFLAG_KNOW_PLUSES );
set_ident_flags( you.inv[throw_2], ISFLAG_KNOW_PLUSES );
@@ -3936,7 +3936,7 @@ bool enchant_weapon( enchant_stat_type which_stat, bool quiet, item_def &wpn )
// Even if not affected, it may be uncursed.
if (!is_enchantable_weapon(wpn, false)
- || enchant_level >= 4 && random2(9) < enchant_level)
+ || enchant_level >= 4 && x_chance_in_y(enchant_level, 9))
{
if (is_cursed)
{
@@ -4060,7 +4060,7 @@ bool enchant_armour( int &ac_change, bool quiet, item_def &arm )
// Even if not affected, it may be uncursed.
if (!is_enchantable_armour(arm, false)
- || arm.plus >= 3 && random2(8) < arm.plus)
+ || arm.plus >= 3 && x_chance_in_y(arm.plus, 8))
{
if (is_cursed)
{
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index ff0731d68f..e373e6f93b 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -172,12 +172,12 @@ static int _cull_items(void)
int first_cleaned = NON_ITEM;
- // 2. avoid shops by avoiding (0,5..9)
- // 3. avoid monster inventory by iterating over the dungeon grid
+ // 2. Avoid shops by avoiding (0,5..9).
+ // 3. Avoid monster inventory by iterating over the dungeon grid.
for (int x = 5; x < GXM; x++)
for (int y = 5; y < GYM; y++)
{
- // 1. not near player!
+ // 1. Not near player!
if (x > you.x_pos - 9 && x < you.x_pos + 9
&& y > you.y_pos - 9 && y < you.y_pos + 9)
{
@@ -186,23 +186,23 @@ static int _cull_items(void)
int next;
- // iterate through the grids list of items:
+ // Iterate through the grids list of items.
for (int item = igrd[x][y]; item != NON_ITEM; item = next)
{
next = mitm[item].link; // in case we can't get it later.
- if (_item_ok_to_clean(item) && random2(100) < 15)
+ if (_item_ok_to_clean(item) && x_chance_in_y(15, 100))
{
const item_def& obj(mitm[item]);
if (is_fixed_artefact(obj))
{
- // 7. move uniques to abyss
+ // 7. Move uniques to abyss.
set_unique_item_status( OBJ_WEAPONS, obj.special,
UNIQ_LOST_IN_ABYSS );
}
else if (is_unrandom_artefact(obj))
{
- // 9. unmark unrandart
+ // 9. Unmark unrandart.
const int z = find_unrandart_index(obj);
if (z != -1)
set_unrandart_exist(z, false);
@@ -213,7 +213,7 @@ static int _cull_items(void)
if (first_cleaned == NON_ITEM)
first_cleaned = item;
}
- } // end for item
+ }
}
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index 4c52a30ec7..c27a6bf7a3 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -864,12 +864,12 @@ static weapon_type _determine_weapon_subtype(int item_level)
WPN_TRIPLE_SWORD
};
- if (item_level > 6 && random2(100) < (10 + item_level)
- && one_chance_in(30))
+ if (item_level > 6 && one_chance_in(30)
+ && x_chance_in_y(10 + item_level, 100))
{
rc = RANDOM_ELEMENT(rare_subtypes);
}
- else if (random2(20) < 20 - item_level)
+ else if (x_chance_in_y(20 - item_level, 20))
rc = RANDOM_ELEMENT(common_subtypes);
else
{
@@ -878,7 +878,7 @@ static weapon_type _determine_weapon_subtype(int item_level)
{
const int wpntype = random2(NUM_WEAPONS);
- if (weapon_rarity(wpntype) > random2(10))
+ if (x_chance_in_y(weapon_rarity(wpntype), 10))
{
rc = static_cast<weapon_type>(wpntype);
break;
@@ -893,7 +893,7 @@ static bool _try_make_weapon_artefact(item_def& item, int force_type,
int item_level)
{
if (item.sub_type != WPN_CLUB && item_level > 2
- && random2(4000) <= 100 + (item_level * 3))
+ && x_chance_in_y(101 + (item_level * 3), 4000))
{
// Make a randart or unrandart.
@@ -944,8 +944,8 @@ static bool _try_make_weapon_artefact(item_def& item, int force_type,
// If it isn't an artefact yet, try to make a fixed artefact.
if (item_level > 6
- && random2(3000) <= 30 + (item_level * 3)
- && one_chance_in(12))
+ && one_chance_in(12)
+ && x_chance_in_y(31 + (item_level * 3), 3000))
{
#ifdef DEBUG_DIAGNOSTICS
mprf(MSGCH_DIAGNOSTICS, "Making fixed artefact.");
@@ -1175,8 +1175,11 @@ static brand_type _determine_weapon_brand(const item_def& item, int item_level)
for (int count = 0; count < tries && rc == SPWPN_NORMAL; ++count)
{
- if (!(force_good || is_demonic(item) || random2(300) <= 100+item_level))
+ if (!force_good && !is_demonic(item)
+ && !x_chance_in_y(101 + item_level, 300))
+ {
continue;
+ }
// We are not guaranteed to have a special set by the end of this
switch (item.sub_type)
@@ -1560,7 +1563,7 @@ static void _generate_weapon_item(item_def& item, bool allow_uniques,
_weapon_add_racial_modifiers(item);
if ((force_good || is_demonic(item) || forced_ego
- || random2(200) <= 50 + item_level)
+ || x_chance_in_y(51 + item_level, 200))
// Nobody would bother enchanting a mundane club.
&& item.sub_type != WPN_CLUB
&& item.sub_type != WPN_GIANT_CLUB
@@ -1792,7 +1795,7 @@ static void _generate_missile_item(item_def& item, int force_type,
else
item.quantity = 1 + random2(9) + random2(12) + random2(12) + random2(15);
- if (10 + item_level >= random2(100))
+ if (x_chance_in_y(11 + item_level, 100))
item.plus += random2(5);
// elven arrows and dwarven bolts are quality items
@@ -1806,7 +1809,7 @@ static void _generate_missile_item(item_def& item, int force_type,
static bool _try_make_armour_artefact(item_def& item, int force_type,
int item_level)
{
- if (item_level > 2 && random2(4000) <= (100 + item_level * 3))
+ if (item_level > 2 && x_chance_in_y(101 + item_level * 3, 4000))
{
// Make a randart or unrandart.
@@ -2036,7 +2039,7 @@ static special_armour_type _determine_armour_ego(const item_def& item,
break;
case 3:
// This is an odd limitation, but I'm not changing it yet.
- if (force_type == OBJ_RANDOM && random2(50) <= 10 + item_level)
+ if (force_type == OBJ_RANDOM && x_chance_in_y(11 + item_level, 50))
rc = SPARM_ARCHMAGI;
break;
}
@@ -2103,16 +2106,19 @@ static void _generate_armour_item(item_def& item, bool allow_uniques,
item.special = SPARM_NORMAL;
if (force_good || forced_ego || item.sub_type == ARM_WIZARD_HAT
- || 50 + item_level >= random2(250))
+ || x_chance_in_y(51 + item_level, 250))
{
// Make a good item...
item.plus += random2(3);
- if (item.sub_type <= ARM_PLATE_MAIL && 20 + item_level >= random2(300))
+ if (item.sub_type <= ARM_PLATE_MAIL
+ && x_chance_in_y(21 + item_level, 300))
+ {
item.plus += random2(3);
+ }
if (!no_ego
- && (30 + item_level >= random2(350))
+ && x_chance_in_y(31 + item_level, 350)
&& (force_good
|| forced_ego
|| get_equip_race(item) != ISFLAG_ORCISH
@@ -2464,7 +2470,7 @@ static void _generate_book_item(item_def& item, int force_type,
}
if (!one_chance_in(100)
- && random2(item_level+1) + 1 < book_rarity(item.sub_type))
+ && x_chance_in_y(book_rarity(item.sub_type)-1, item_level+1))
{
item.sub_type = BOOK_DESTRUCTION; // continue trying
}
@@ -2473,17 +2479,17 @@ static void _generate_book_item(item_def& item, int force_type,
|| item.sub_type == BOOK_MANUAL
|| book_rarity(item.sub_type) == 100);
- // tome of destruction: rare!
- if ( item_level > 10 && random2(7000) <= item_level + 20 )
+ // Tome of destruction: rare!
+ if (item_level > 10 && x_chance_in_y(21 + item_level, 7000))
item.sub_type = BOOK_DESTRUCTION;
- // skill manuals - also rare
- if ( item_level > 6 && random2(4000) <= item_level + 20 )
+ // Skill manuals - also rare.
+ if (item_level > 6 && x_chance_in_y(21 + item_level, 4000))
item.sub_type = BOOK_MANUAL;
}
- // Determine which skill for a manual
- if ( item.sub_type == BOOK_MANUAL )
+ // Determine which skill for a manual.
+ if (item.sub_type == BOOK_MANUAL)
{
if (one_chance_in(4))
item.plus = SK_SPELLCASTING + random2(NUM_SKILLS - SK_SPELLCASTING);
@@ -2532,8 +2538,8 @@ static bool _try_make_jewellery_unrandart(item_def& item, int force_type,
if (item_level > 2
&& you.level_type != LEVEL_ABYSS
&& you.level_type != LEVEL_PANDEMONIUM
- && random2(2000) <= 100 + (item_level * 3)
- && one_chance_in(20))
+ && one_chance_in(20)
+ && x_chance_in_y(101 + item_level * 3, 2000))
{
// The old generation code did not respect force_type here.
const int idx = find_okay_unrandart(OBJ_JEWELLERY, force_type);
@@ -2611,7 +2617,7 @@ static void _generate_jewellery_item(item_def& item, bool allow_uniques,
{
item.plus2 = 1 + (one_chance_in(3) ? random2(3) : random2avg(6, 2));
- if (random2(25) < 9) // 36% of such rings {dlb}
+ if (x_chance_in_y(9, 25)) // 36% of such rings {dlb}
{
// make "ring of damage"
do_uncurse_item(item);
@@ -2623,7 +2629,7 @@ static void _generate_jewellery_item(item_def& item, bool allow_uniques,
// All jewellery base types should now work. -- bwr
if (allow_uniques && item_level > 2
- && random2(4000) <= 100 + (item_level * 3))
+ && x_chance_in_y(101 + item_level * 3, 4000))
{
make_item_randart( item );
}
@@ -2736,7 +2742,7 @@ int items( int allow_uniques, // not just true-false,
0));
// misc items placement wholly dependent upon current depth {dlb}:
- if (item_level > 7 && (20 + item_level) >= random2(3500))
+ if (item_level > 7 && x_chance_in_y(21 + item_level, 3500))
item.base_type = OBJ_MISCELLANY;
if (item_level < 7
@@ -3045,7 +3051,7 @@ static item_make_species_type _give_weapon(monsters *mon, int level,
}
// intentional fallthrough
case MONS_BIG_KOBOLD:
- if (random2(5) < 3) // give hand weapon
+ if (x_chance_in_y(3, 5)) // give hand weapon
{
item.base_type = OBJ_WEAPONS;
@@ -3062,7 +3068,7 @@ static item_make_species_type _give_weapon(monsters *mon, int level,
if (one_chance_in(3))
item_race = MAKE_ITEM_ORCISH;
- if (random2(5) < 3) // give hand weapon
+ if (x_chance_in_y(3, 5)) // give hand weapon
{
item.base_type = OBJ_WEAPONS;
item.sub_type = WPN_CLUB;
@@ -3085,7 +3091,7 @@ static item_make_species_type _give_weapon(monsters *mon, int level,
// deliberate fall through {dlb}
case MONS_JESSICA:
case MONS_IJYB:
- if (random2(5) < 3) // < 1 // give hand weapon
+ if (x_chance_in_y(3, 5)) // give hand weapon
{
item.base_type = OBJ_WEAPONS;
item.sub_type = (coinflip() ? WPN_DAGGER : WPN_CLUB);
@@ -3641,7 +3647,7 @@ static item_make_species_type _give_weapon(monsters *mon, int level,
if (!force_item && mons_is_unique( mon->type ))
{
- if (random2(100) <= 9 + mon->hit_dice)
+ if (x_chance_in_y(10 + mon->hit_dice, 100))
level = MAKE_GOOD_ITEM;
else if (level != MAKE_GOOD_ITEM)
level += 5;
@@ -3719,7 +3725,7 @@ static void _give_ammo(monsters *mon, int level,
{
case MONS_KOBOLD:
case MONS_BIG_KOBOLD:
- if (random2(5) < 2)
+ if (x_chance_in_y(2, 5))
{
item_race = MAKE_ITEM_NO_RACE;
weap_class = OBJ_MISSILES;
@@ -3949,7 +3955,7 @@ void give_armour(monsters *mon, int level)
case MONS_NORBERT:
case MONS_PSYCHE:
case MONS_TERENCE:
- if (random2(5) < 2)
+ if (x_chance_in_y(2, 5))
{
mitm[bp].base_type = OBJ_ARMOUR;
@@ -4113,7 +4119,7 @@ void give_armour(monsters *mon, int level)
if (mons_is_unique( mon->type ) && level != MAKE_GOOD_ITEM)
{
- if (random2(100) < 9 + mon->hit_dice)
+ if (x_chance_in_y(9 + mon->hit_dice, 100))
level = MAKE_GOOD_ITEM;
else
level = level * 2 + 5;
@@ -4189,22 +4195,22 @@ armour_type get_random_armour_type(int item_level)
{
int armtype = random2(3);
- if (random2(35) <= item_level + 10)
+ if (x_chance_in_y(11 + item_level, 35))
{
armtype = random2(5);
if (one_chance_in(4))
armtype = ARM_ANIMAL_SKIN;
}
- if (random2(60) <= item_level + 10)
+ if (x_chance_in_y(11 + item_level, 60))
armtype = random2(ARM_SHIELD); // body armour of some kind
- if (10 + item_level >= random2(400) && one_chance_in(20))
+ if (one_chance_in(20) && x_chance_in_y(11 + item_level, 400))
armtype = ARM_DRAGON_HIDE + random2(7); // (ice) dragon/troll/crystal
- if (10 + item_level >= random2(500) && one_chance_in(20))
+ if (one_chance_in(20) && x_chance_in_y(11 + item_level, 500))
{
- // other dragon hides/armour or animal skin
+ // Other dragon hides/armour or animal skin.
armtype = ARM_STEAM_DRAGON_HIDE + random2(11);
if (armtype == ARM_ANIMAL_SKIN && one_chance_in(20))
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index 851c9819fe..362bd33c11 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -1835,7 +1835,7 @@ mons_spec mons_list::pick_monster(mons_spec_slot &slot)
i != slot.mlist.end(); ++i)
{
const int weight = i->genweight;
- if (random2(totweight += weight) < weight)
+ if (x_chance_in_y(weight, totweight += weight))
{
pick = *i;
@@ -2266,7 +2266,7 @@ item_spec item_list::pick_item(item_spec_slot &slot)
i != slot.ilist.end(); ++i)
{
const int weight = i->genweight;
- if (random2(cumulative += weight) < weight)
+ if (x_chance_in_y(weight, cumulative += weight))
spec = *i;
}
@@ -2673,10 +2673,8 @@ int subst_spec::value()
int cumulative = 0;
int chosen = 0;
for (int i = 0, size = repl.size(); i < size; ++i)
- {
- if (random2(cumulative += repl[i].second) < repl[i].second)
+ if (x_chance_in_y(repl[i].second, cumulative += repl[i].second))
chosen = repl[i].first;
- }
if (fix)
frozen_value = chosen;
@@ -2767,7 +2765,7 @@ int colour_spec::get_colour()
int chosen = BLACK;
int cweight = 0;
for (int i = 0, size = colours.size(); i < size; ++i)
- if (random2(cweight += colours[i].second) < colours[i].second)
+ if (x_chance_in_y(colours[i].second, cweight += colours[i].second))
chosen = colours[i].first;
if (fix)
fixed_colour = chosen;
@@ -3079,7 +3077,7 @@ feature_spec feature_slot::get_feat(int def_glyph)
for (int i = 0, size = feats.size(); i < size; ++i)
{
const feature_spec &feat = feats[i];
- if (random2(tweight += feat.genweight) < feat.genweight)
+ if (x_chance_in_y(feat.genweight, tweight += feat.genweight))
chosen_feat = feat;
}
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 14f1e568d5..aa560a50d4 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -1125,7 +1125,7 @@ static void maybe_bloodify_square(int x, int y, int amount, bool spatter = false
if (!spatter && !allow_bleeding_on_square(x,y))
return;
- if (amount > random2(20))
+ if (x_chance_in_y(amount, 20))
{
#ifdef DEBUG_DIAGNOSTICS
mprf(MSGCH_DIAGNOSTICS,
@@ -1269,14 +1269,14 @@ void search_around( bool only_adjacent )
int effective = you.skills[SK_TRAPS_DOORS] / (2*dist - 1);
if (grd[srx][sry] == DNGN_SECRET_DOOR
- && random2(17) <= effective)
+ && x_chance_in_y(effective + 1, 17))
{
mpr("You found a secret door!");
reveal_secret_door(srx, sry);
exercise(SK_TRAPS_DOORS, (coinflip() ? 2 : 1));
}
else if (grd[srx][sry] == DNGN_UNDISCOVERED_TRAP
- && random2(17) <= effective)
+ && x_chance_in_y(effective + 1, 17))
{
i = trap_at_xy(srx, sry);
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 94a0ffbc2f..ba81b53e8a 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -5689,7 +5689,7 @@ void monsters::apply_enchantment(const mon_enchant &me)
int damage = 0;
// tiny: 1/6, little: 2/5, small: 3/4, medium and above: always
- if (random2(SIZE_GIANT - mon_size) <= mon_size)
+ if (x_chance_in_y(mon_size + 1, SIZE_GIANT - mon_size))
damage++;
// Handled specially to make up for its small size.
@@ -5895,7 +5895,7 @@ void monsters::apply_enchantment(const mon_enchant &me)
case ENCH_SHAPESHIFTER: // This ench never runs out!
if (type == MONS_SHAPESHIFTER
- || random2(1000) < ( 1000 / ((15 * hit_dice) / 5)))
+ || x_chance_in_y(1000 / (15 * hit_dice / 5), 1000))
{
monster_polymorph(this, RANDOM_MONSTER, PPT_SAME);
}
@@ -6381,7 +6381,7 @@ void monsters::react_to_damage(int damage)
{
// The royal jelly objects to taking damage and will SULK. :-)
if (type == MONS_ROYAL_JELLY && alive()
- && damage > 8 && random2(50) < damage)
+ && damage > 8 && x_chance_in_y(damage, 50))
{
const int tospawn =
1 + random2avg(1 + std::min((damage - 8) / 8, 5), 2);
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 920f4d528e..643e0b2d37 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -2266,7 +2266,7 @@ static bool _choose_random_patrol_target_grid(monsters *mon)
{
// Slightly greater chance to simply head for the centre.
count_grids += 3;
- if (random2(count_grids) < 3)
+ if (x_chance_in_y(3, count_grids))
set_target = true;
}
else if (one_chance_in(++count_grids))
@@ -3538,7 +3538,7 @@ monsters *choose_random_monster_on_level(int weight,
{
mons_count += 2;
// Named monsters have doubled chances.
- if (random2(mons_count) < 2)
+ if (x_chance_in_y(2, mons_count))
chosen = mon;
}
else if (one_chance_in(++mons_count))
@@ -4233,7 +4233,7 @@ static bool _handle_special_ability(monsters *monster, bolt & beem)
if (!mons_player_visible( monster ))
break;
- if (monster->type != MONS_HELL_HOUND && random2(13) < 3
+ if (monster->type != MONS_HELL_HOUND && x_chance_in_y(3, 13)
|| one_chance_in(10))
{
setup_dragon(monster, beem);
@@ -5624,7 +5624,7 @@ int mons_natural_regen_rate(monsters *monster)
static inline bool _mons_natural_regen_roll(monsters *monster)
{
const int regen_rate = mons_natural_regen_rate(monster);
- return (random2(25) < regen_rate);
+ return (x_chance_in_y(regen_rate, 25));
}
// Do natural regeneration for monster.
@@ -5996,7 +5996,7 @@ static void _handle_monster_move(int i, monsters *monster)
}
}
- if (random2(2 + pfound) < 2)
+ if (x_chance_in_y(2, 2 + pfound))
mmov_x = mmov_y = 0;
// Bounds check: don't let confused monsters try to run
@@ -7030,7 +7030,7 @@ static bool _mon_can_move_to_pos(const monsters *monster, const int count_x,
case CLOUD_STINK:
if (mons_res_poison(monster) > 0)
return (true);
- if (1 + random2(5) < monster->hit_dice)
+ if (x_chance_in_y(monster->hit_dice - 1, 5))
return (true);
if (monster->hit_points >= random2avg(19, 2))
return (true);
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index e60da7c57b..79ba0944ee 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -277,7 +277,7 @@ void splash_with_acid( char acid_strength )
continue;
}
- if (random2(20) <= acid_strength)
+ if (x_chance_in_y(acid_strength + 1, 20))
item_corrode( you.equip[splc] );
}
@@ -309,11 +309,10 @@ void weapon_acid( char acid_strength )
msg::stream << "Your " << your_hand(true) << " burn!" << std::endl;
ouch( roll_dice( 1, acid_strength ), 0, KILLED_BY_ACID );
}
- else if (random2(20) <= acid_strength)
- {
+
+ if (x_chance_in_y(acid_strength + 1, 20))
item_corrode( hand_thing );
- }
-} // end weapon_acid()
+}
void item_corrode( int itco )
{
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 15cb592619..aa308bf8d5 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -2852,7 +2852,7 @@ void forget_map(unsigned char chance_forgotten, bool force)
for (unsigned char ycount = 0; ycount < GYM; ycount++)
{
if (!see_grid(xcount, ycount)
- && (force || random2(100) < chance_forgotten))
+ && (force || x_chance_in_y(chance_forgotten, 100)))
{
env.map[xcount][ycount].clear();
}
@@ -6733,7 +6733,7 @@ void player::awake()
void player::check_awaken(int disturbance)
{
- if (asleep() && random2(50) <= disturbance)
+ if (asleep() && x_chance_in_y(disturbance + 1, 50))
awake();
}
diff --git a/crawl-ref/source/randart.cc b/crawl-ref/source/randart.cc
index 8d35c5f481..e0108b9d80 100644
--- a/crawl-ref/source/randart.cc
+++ b/crawl-ref/source/randart.cc
@@ -829,7 +829,11 @@ void static _get_randart_properties(const item_def &item,
}
}
- bool done_powers = (random2(12 < power_level));
+ // This can't be right. random2(boolean) == 0, always. (jpeg)
+// bool done_powers = (random2(12 < power_level));
+
+ // Try to improve items that still have a low power level.
+ bool done_powers = x_chance_in_y(power_level, 12);
// res_fire
if (!done_powers
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 5685844599..6835875cf9 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -999,8 +999,8 @@ static void _give_nemelex_gift()
// Nemelex will give at least one gift early.
if (you.num_gifts[GOD_NEMELEX_XOBEH] == 0
- && random2(piety_breakpoint(1)) <= you.piety
- || random2(MAX_PIETY) <= you.piety && one_chance_in(3)
+ && x_chance_in_y(you.piety + 1, piety_breakpoint(1))
+ || x_chance_in_y(you.piety + 1, MAX_PIETY) && one_chance_in(3)
&& !you.attribute[ATTR_CARD_COUNTDOWN])
{
misc_item_type gift_type;
@@ -1208,7 +1208,7 @@ static bool _blessing_healing(monsters* mon, bool extra)
if (heal_monster(mon, mon->max_hit_points, extra))
{
// A high-HP monster might get a unique name.
- if (random2(100) <= mon->max_hit_points)
+ if (x_chance_in_y(mon->max_hit_points + 1, 100))
give_monster_proper_name(mon);
return (true);
}
@@ -3600,7 +3600,7 @@ static void _ely_dull_inventory_weapons()
if (num_dulled > 0)
{
- if (chance >= random2(100))
+ if (x_chance_in_y(chance + 1, 100))
dec_penance(GOD_ELYVILON, 1);
simple_god_message(
@@ -5200,7 +5200,7 @@ static piety_gain_t _sacrifice_one_item_noncount( const item_def& item)
switch (you.religion)
{
case GOD_NEMELEX_XOBEH:
- if (you.attribute[ATTR_CARD_COUNTDOWN] && random2(800) < value)
+ if (you.attribute[ATTR_CARD_COUNTDOWN] && x_chance_in_y(value, 800))
{
you.attribute[ATTR_CARD_COUNTDOWN]--;
#if DEBUG_DIAGNOSTICS || DEBUG_CARDS || DEBUG_SACRIFICE
@@ -5211,7 +5211,7 @@ static piety_gain_t _sacrifice_one_item_noncount( const item_def& item)
if (item.base_type == OBJ_CORPSES && one_chance_in(2+you.piety/50)
// Nemelex piety gain is fairly fast...at least
// when you have low piety.
- || value/2 >= random2(30 + you.piety/2))
+ || x_chance_in_y(value/2 + 1, 30 + you.piety/2))
{
if ( is_artefact(item) )
{
@@ -5241,27 +5241,6 @@ static piety_gain_t _sacrifice_one_item_noncount( const item_def& item)
you.sacrifice_value[item.base_type] += value;
break;
- case GOD_OKAWARU:
- case GOD_MAKHLEB:
- if (item.base_type == OBJ_CORPSES
- || value >= random2(200)
- || (player_under_penance() && value >= random2(5)))
- {
- gain_piety(1);
- relative_piety_gain = PIETY_SOME;
- }
- break;
-
- case GOD_SIF_MUNA:
- if (value >= 150) // no point in saccing stacks to Sif
- {
- gain_piety(1 + random2(3));
- relative_piety_gain = PIETY_SOME;
- }
- break;
-
- case GOD_KIKUBAAQUDGHA:
- case GOD_TROG:
case GOD_SHINING_ONE:
gain_piety(1);
relative_piety_gain = PIETY_SOME;
@@ -5270,7 +5249,7 @@ static piety_gain_t _sacrifice_one_item_noncount( const item_def& item)
default:
break;
}
- return relative_piety_gain;
+ return (relative_piety_gain);
}
void offer_items()
@@ -5670,7 +5649,7 @@ harm_protection_type god_protects_from_harm(god_type god, bool actual)
const int min_piety = piety_breakpoint(0);
bool praying = (you.duration[DUR_PRAYER]
&& random2(you.piety) >= min_piety);
- bool anytime = (one_chance_in(10) || you.piety > random2(1000));
+ bool anytime = (one_chance_in(10) || x_chance_in_y(you.piety, 1000));
bool penance = you.penance[god];
// If actual is true, return HPT_NONE if the given god can protect
@@ -5712,8 +5691,8 @@ void god_smites_you(god_type god, kill_method_type death_type,
{
// Your god won't protect you from his own smiting, and Xom is too
// capricious to protect you from any god's smiting.
- if (you.religion != god && you.religion != GOD_XOM &&
- !player_under_penance() && you.piety > random2(MAX_PIETY * 2))
+ if (you.religion != god && you.religion != GOD_XOM
+ && !player_under_penance() && x_chance_in_y(you.piety, MAX_PIETY * 2))
{
god_speaks(you.religion,
make_stringf("Mortal, I have averted the wrath of %s... "
@@ -5820,7 +5799,7 @@ void handle_god_time()
const char *origfavour = describe_xom_favour();
const bool good = you.piety > (MAX_PIETY / 2);
int size = abs(you.piety - 100);
- delta = (random2(1000) < 511) ? 1 : -1;
+ delta = (x_chance_in_y(511, 1000) ? 1 : -1);
size += delta;
you.piety = (MAX_PIETY / 2) + (good ? size : -size);
const char *newfavour = describe_xom_favour();
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index 5d62772b28..3acf2fe0b4 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -1976,7 +1976,7 @@ void cast_fragmentation(int pow) // jmf: ripped idea from airstrike
blast.name = "blast of metal fragments";
blast.damage.num = 4;
- if (okay_to_dest && pow >= 80 && random2(500) < pow / 5)
+ if (okay_to_dest && pow >= 80 && x_chance_in_y(pow / 5, 500))
{
blast.damage.num += 2;
grd[beam.tx][beam.ty] = DNGN_FLOOR;
diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc
index 9192e4dd4e..0ab544910f 100644
--- a/crawl-ref/source/spl-book.cc
+++ b/crawl-ref/source/spl-book.cc
@@ -1311,7 +1311,7 @@ bool learn_spell(int book)
}
if (player_mutation_level(MUT_BLURRY_VISION) > 0
- && random2(4) < player_mutation_level(MUT_BLURRY_VISION))
+ && x_chance_in_y(player_mutation_level(MUT_BLURRY_VISION), 4))
{
mpr("The writing blurs into unreadable gibberish.");
you.turn_is_over = true;
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 08e9890a99..51a3c0ff70 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1100,10 +1100,10 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
if (you.religion == GOD_SIF_MUNA
&& !player_under_penance()
- && you.piety >= 100 && random2(150) <= you.piety)
+ && you.piety >= 100 && x_chance_in_y(you.piety + 1, 150))
{
canned_msg(MSG_NOTHING_HAPPENS);
- return SPRET_FAIL;
+ return (SPRET_FAIL);
}
unsigned int sptype = 0;
@@ -2896,8 +2896,8 @@ static void _miscast_divination(int severity, const char* cause)
static void _miscast_necromancy(int severity, const char* cause)
{
if (you.religion == GOD_KIKUBAAQUDGHA
- && (!player_under_penance() && you.piety >= piety_breakpoint(1)
- && you.piety > random2(150)))
+ && !player_under_penance() && you.piety >= piety_breakpoint(1)
+ && x_chance_in_y(you.piety, 150))
{
canned_msg(MSG_NOTHING_HAPPENS);
return;
diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc
index 5822d624f3..0b726a678f 100644
--- a/crawl-ref/source/traps.cc
+++ b/crawl-ref/source/traps.cc
@@ -254,7 +254,7 @@ static void dart_trap(bool trap_known, int trapped, bolt &pbolt, bool poison)
msg += "hits you!";
mpr(msg.c_str());
- if (poison && random2(100) < 50 - (3 * player_AC()) / 2
+ if (poison && x_chance_in_y(50 - (3 * player_AC()) / 2, 100)
&& !player_res_poison())
{
poison_player( 1 + random2(3) );
@@ -721,27 +721,27 @@ static int damage_or_escape_net(int hold)
damage += level - 1;
}
- // Berserkers get a fighting bonus
+ // Berserkers get a fighting bonus.
if (you.duration[DUR_BERSERKER])
damage += 2;
- // check stats
- if (you.strength > random2(18))
+ // Check stats.
+ if (x_chance_in_y(you.strength, 18))
damage++;
- if (you.dex > random2(12))
+ if (x_chance_in_y(you.dex, 12))
escape++;
- if (player_evasion() > random2(20))
+ if (x_chance_in_y(player_evasion(), 20))
escape++;
- // monsters around you add urgency
+ // Monsters around you add urgency.
if (!i_feel_safe())
{
damage++;
escape++;
}
- // confusion makes the whole thing somewhat harder
- // (less so for trying to escape)
+ // Confusion makes the whole thing somewhat harder
+ // (less so for trying to escape).
if (you.duration[DUR_CONF])
{
if (escape > 1)
@@ -750,26 +750,26 @@ static int damage_or_escape_net(int hold)
damage -= 2;
}
- // damaged nets are easier to destroy
+ // Damaged nets are easier to destroy.
if (hold < 0)
{
damage += random2(-hold/3 + 1);
- // ... and easier to slip out of (but only if escape looks feasible)
+ // ... and easier to slip out of (but only if escape looks feasible).
if (you.attribute[ATTR_HELD] < 5 || escape >= damage)
escape += random2(-hold/2) + 1;
}
- // if undecided, choose damaging approach (it's quicker)
+ // If undecided, choose damaging approach (it's quicker).
if (damage >= escape)
return (-damage); // negate value
return (escape);
}
-// calls the above function to decide on how to get free
-// note that usually the net will be damaged until trying to slip out
-// becomes feasible (for size etc.), so it may take even longer
+// Calls the above function to decide on how to get free.
+// Note that usually the net will be damaged until trying to slip out
+// becomes feasible (for size etc.), so it may take even longer.
void free_self_from_net()
{
int net = get_trapping_net(you.x_pos, you.y_pos);
@@ -787,9 +787,10 @@ void free_self_from_net()
hold, you.attribute[ATTR_HELD], do_what);
#endif
- if (do_what <= 0) // you try to destroy the net
- { // for previously undamaged nets this takes at least 2
- // and at most 8 turns
+ if (do_what <= 0) // You try to destroy the net
+ {
+ // For previously undamaged nets this takes at least 2 and at most
+ // 8 turns.
bool can_slice = you.attribute[ATTR_TRANSFORMATION] == TRAN_BLADE_HANDS
|| you.equip[EQ_WEAPON] != -1
&& can_cut_meat(you.inv[you.equip[EQ_WEAPON]]);
@@ -802,7 +803,8 @@ void free_self_from_net()
if (you.duration[DUR_BERSERKER])
damage *= 2;
- // medium sized characters are at disadvantage and sometimes get a bonus
+ // Medium sized characters are at disadvantage and sometimes
+ // get a bonus.
if (you.body_size(PSIZE_BODY) == SIZE_MEDIUM)
damage += coinflip();
@@ -832,8 +834,8 @@ void free_self_from_net()
else
mpr("You struggle against the net.");
- // occasionally decrease duration a bit
- // (this is so switching from damage to escape does not hurt as much)
+ // Occasionally decrease duration a bit
+ // (this is so switching from damage to escape does not hurt as much).
if (you.attribute[ATTR_HELD] > 1 && coinflip())
{
you.attribute[ATTR_HELD]--;
@@ -842,14 +844,16 @@ void free_self_from_net()
you.attribute[ATTR_HELD]--;
}
}
- else // you try to escape (takes at least 3 turns, and at most 10)
+ else
{
+ // You try to escape (takes at least 3 turns, and at most 10).
int escape = do_what;
if (you.duration[DUR_HASTE]) // extra bonus, also Berserk
escape++;
- // medium sized characters are at disadvantage and sometimes get a bonus
+ // Medium sized characters are at disadvantage and sometimes
+ // get a bonus.
if (you.body_size(PSIZE_BODY) == SIZE_MEDIUM)
escape += coinflip();
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 89cc37c67c..c25c8d874f 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -804,7 +804,7 @@ static void _good_god_follower_attitude_change(monsters *monster)
{
monster->flags |= MF_ATT_CHANGE_ATTEMPT;
- if (you.piety > random2(MAX_PIETY) && !you.penance[you.religion])
+ if (x_chance_in_y(you.piety, MAX_PIETY) && !you.penance[you.religion])
{
int wpn = you.equip[EQ_WEAPON];
if (wpn != -1
@@ -887,8 +887,11 @@ static void _handle_seen_interrupt(monsters* monster)
void handle_monster_shouts(monsters* monster, bool force)
{
- if (!force && (!you.turn_is_over || random2(30) < you.skills[SK_STEALTH]))
+ if (!force && (!you.turn_is_over
+ || x_chance_in_y(you.skills[SK_STEALTH], 30)))
+ {
return;
+ }
// Friendly or neutral monsters don't shout.
if (!force && (mons_friendly(monster) || mons_neutral(monster)))
@@ -1274,7 +1277,7 @@ bool check_awaken(monsters* monster)
if (mons_perc < 0)
mons_perc = 0;
- if (random2(stealth) <= mons_perc)
+ if (x_chance_in_y(mons_perc + 1, stealth))
return (true); // Oops, the monster wakes up!
// You didn't wake the monster!
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index 9bd707eb26..e67afa4598 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -432,7 +432,7 @@ static bool _xom_is_good(int sever)
// This series of random calls produces a poisson-looking
// distribution: initial hump, plus a long-ish tail.
- if (random2(sever) <= 1)
+ if (x_chance_in_y(2, sever))
{
potion_type pot =
static_cast<potion_type>(
@@ -456,13 +456,13 @@ static bool _xom_is_good(int sever)
done = true;
}
}
- else if (random2(sever) <= 2)
+ else if (x_chance_in_y(3, sever))
{
_xom_makes_you_cast_random_spell(sever);
done = true;
}
- else if (random2(sever) <= 3)
+ else if (x_chance_in_y(4, sever))
{
// XXX: Can we clean up this ugliness, please?
const int numdemons =
@@ -544,13 +544,13 @@ static bool _xom_is_good(int sever)
delete[] is_demonic;
delete[] summons;
}
- else if (random2(sever) <= 4)
+ else if (x_chance_in_y(5, sever))
{
_xom_gives_item(sever);
done = true;
}
- else if (random2(sever) <= 5)
+ else if (x_chance_in_y(6, sever))
{
monster_type mon = _xom_random_demon(sever);
const bool is_demonic = (mons_class_holiness(mon) == MH_DEMONIC);
@@ -586,7 +586,7 @@ static bool _xom_is_good(int sever)
done = true;
}
}
- else if (random2(sever) <= 6)
+ else if (x_chance_in_y(7, sever))
{
if (there_are_monsters_nearby())
{
@@ -614,13 +614,13 @@ static bool _xom_is_good(int sever)
}
}
}
- else if (random2(sever) <= 7)
+ else if (x_chance_in_y(8, sever))
{
_xom_gives_item(sever);
done = true;
}
- else if (random2(sever) <= 8)
+ else if (x_chance_in_y(9, sever))
{
// This can fail with radius 1, or in open areas.
if (vitrify_area(random2avg(sever / 2, 3) + 1))
@@ -630,7 +630,7 @@ static bool _xom_is_good(int sever)
done = true;
}
}
- else if (random2(sever) <= 9)
+ else if (x_chance_in_y(10, sever))
{
if (you.can_safely_mutate()
&& player_mutation_level(MUT_MUTATION_RESISTANCE) < 3)
@@ -653,7 +653,7 @@ static bool _xom_is_good(int sever)
}
}
}
- else if (random2(sever) <= 10)
+ else if (x_chance_in_y(11, sever))
{
monster_type mon = _xom_random_demon(sever);
const bool is_demonic = (mons_class_holiness(mon) == MH_DEMONIC);
@@ -689,7 +689,7 @@ static bool _xom_is_good(int sever)
done = true;
}
}
- else if (random2(sever) <= 11)
+ else if (x_chance_in_y(12, sever))
{
if (player_in_a_dangerous_place())
{
@@ -735,7 +735,7 @@ static bool _xom_is_bad(int sever)
while (!done)
{
- if (random2(sever) <= 2)
+ if (x_chance_in_y(3, sever))
{
god_speaks(GOD_XOM, _get_xom_speech("zero miscast effect").c_str());
@@ -743,7 +743,7 @@ static bool _xom_is_bad(int sever)
done = true;
}
- else if (random2(sever) <= 3)
+ else if (x_chance_in_y(4, sever))
{
god_speaks(GOD_XOM, _get_xom_speech("minor miscast effect").c_str());
@@ -752,7 +752,7 @@ static bool _xom_is_bad(int sever)
done = true;
}
- else if (random2(sever) <= 4)
+ else if (x_chance_in_y(5, sever))
{
god_speaks(GOD_XOM, _get_xom_speech("lose stats").c_str());
@@ -761,7 +761,7 @@ static bool _xom_is_bad(int sever)
done = true;
}
- else if (random2(sever) <= 5)
+ else if (x_chance_in_y(6, sever))
{
god_speaks(GOD_XOM, _get_xom_speech("medium miscast effect").c_str());
@@ -770,7 +770,7 @@ static bool _xom_is_bad(int sever)
done = true;
}
- else if (random2(sever) <= 6)
+ else if (x_chance_in_y(7, sever))
{
if (you.can_safely_mutate()
&& player_mutation_level(MUT_MUTATION_RESISTANCE) < 3)
@@ -793,7 +793,7 @@ static bool _xom_is_bad(int sever)
}
}
}
- else if (random2(sever) <= 7)
+ else if (x_chance_in_y(8, sever))
{
if (there_are_monsters_nearby())
{
@@ -821,7 +821,7 @@ static bool _xom_is_bad(int sever)
}
}
}
- else if (random2(sever) <= 8)
+ else if (x_chance_in_y(9, sever))
{
std::string speech = _get_xom_speech("draining or torment");
@@ -852,7 +852,7 @@ static bool _xom_is_bad(int sever)
}
}
}
- else if (random2(sever) <= 9)
+ else if (x_chance_in_y(10, sever))
{
std::string speech = _get_xom_speech("hostile monster");
@@ -892,7 +892,7 @@ static bool _xom_is_bad(int sever)
}
}
}
- else if (random2(sever) <= 10)
+ else if (x_chance_in_y(11, sever))
{
god_speaks(GOD_XOM, _get_xom_speech("major miscast effect").c_str());