diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-07-10 19:35:05 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-07-10 19:35:05 +0000 |
commit | eae61da171bd07d54eb09775a244257411359221 (patch) | |
tree | 488fae4fa0bce9a941ce789d65cb38d962e211d3 /crawl-ref/source/misc.cc | |
parent | 68f11497c4e4cc2ea402ac135f833a41565d6a65 (diff) | |
download | crawl-ref-eae61da171bd07d54eb09775a244257411359221.tar.gz crawl-ref-eae61da171bd07d54eb09775a244257411359221.zip |
Monster enchantment overhaul:
* Enchantment degree is converted into duration up-front. The average
enchantment duration should be nearly the same as before, but we guarantee
minimum durations on enchantments. Enchantment duration variance is much
less, needs testing to see whether this makes enchantments and summoning too
strong.
* Enchantments that rely on degree (like poison, sticky flame) still use it.
* Durations are now based on individual movement ticks, not turns (10 ticks =
1 normal player turn).
* Breaks saves, abjuration doesn't work (will fix).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1828 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/misc.cc')
-rw-r--r-- | crawl-ref/source/misc.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 7d492a148b..590a8fcda8 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -2287,3 +2287,21 @@ coord_def pick_adjacent_free_square(int x, int y) } return result; } + +// Converts a movement speed to a duration. i.e., answers the +// question: if the monster is so fast, how much time has it spent in +// its last movement? +// +// If speed is 10 (normal), one movement is a duration of 10. +// If speed is 1 (very slow), each movement is a duration of 100. +// If speed is 15 (50% faster than normal), each movement is a duration of +// 6.6667. +int speed_to_duration(int speed) +{ + if (speed < 1) + speed = 10; + else if (speed > 100) + speed = 100; + + return div_rand_round(100, speed); +} |