diff options
author | Neil Moore <neil@s-z.org> | 2014-05-31 12:59:19 -0400 |
---|---|---|
committer | Neil Moore <neil@s-z.org> | 2014-05-31 13:03:21 -0400 |
commit | c0390336e72f97504a8bc5bde54bd5204ab4f5d0 (patch) | |
tree | a39aefbab619d959dac4acd1fd6e00cd94bb2663 /crawl-ref/source/mon-act.cc | |
parent | 6f8b3a6e36001494fd876b1958e34054918a99bc (diff) | |
download | crawl-ref-c0390336e72f97504a8bc5bde54bd5204ab4f5d0.tar.gz crawl-ref-c0390336e72f97504a8bc5bde54bd5204ab4f5d0.zip |
Use a distribution instead of several random rolls.
Diffstat (limited to 'crawl-ref/source/mon-act.cc')
-rw-r--r-- | crawl-ref/source/mon-act.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc index 67e419af90..1dd257ba3e 100644 --- a/crawl-ref/source/mon-act.cc +++ b/crawl-ref/source/mon-act.cc @@ -2074,14 +2074,13 @@ void handle_monster_move(monster* mons) && !mons_is_avatar(mons->type) && !mons->wont_attack() && gold > 0) { - for (int i = 0; i < gold; i++) - if (one_chance_in(20)) - { - simple_monster_message(mons, - " is distracted by the nearby gold."); - mons->speed_increment -= non_move_energy; - return; - } + if (bernoulli(gold, 1/20.0)) + { + simple_monster_message(mons, + " is distracted by the nearby gold."); + mons->speed_increment -= non_move_energy; + return; + } } if (crawl_state.disables[DIS_MON_ACT] && _unfriendly_or_insane(mons)) |