diff options
author | Stefan O'Rear <stefanor@cox.net> | 2010-01-02 17:46:08 -0800 |
---|---|---|
committer | Stefan O'Rear <stefanor@cox.net> | 2010-01-02 17:50:56 -0800 |
commit | 22019ceee8c3df285becfd98445aaec91055c6df (patch) | |
tree | 91c26482c566be2399b049b863f919c803f27222 /crawl-ref/source/makeitem.cc | |
parent | 985744902fd6c56fe3c30a2d1a00aeacfffba475 (diff) | |
download | crawl-ref-22019ceee8c3df285becfd98445aaec91055c6df.tar.gz crawl-ref-22019ceee8c3df285becfd98445aaec91055c6df.zip |
Rods have an intrinsic recharge rate (#300)
Using Eronarn's proposed system. Rods get a baseline of 4 MP per 100
turns; every rod has an enchantment, which adds to this. On top of
that, you get the old Evocations bonus. At maxed Evocations with a
+9 rod, you gain 52 MP per 100 turns.
Unfortunately, all four of the multi-purpose fields were already used
for rods, so I had to spill enchantment into props.
Diffstat (limited to 'crawl-ref/source/makeitem.cc')
-rw-r--r-- | crawl-ref/source/makeitem.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc index 7e991e5c83..5f78853508 100644 --- a/crawl-ref/source/makeitem.cc +++ b/crawl-ref/source/makeitem.cc @@ -3275,19 +3275,42 @@ int items(int allow_uniques, // not just true-false, return (p); } +// Formula from Eronarn on ##crawl-dev; subject to revision +static int _roll_rod_enchant() +{ + int total_prob = 0, cur_ench = 0; + + for (int i = -3; i <= 9; ++i) + { + int extremeness = (i < 0) ? (21 - i) : (15 + i); + + int prob = 600 - extremeness * extremeness; + + if (random2(total_prob += prob) < prob) + cur_ench = i; + } + + return cur_ench; +} + void init_rod_mp(item_def &item, int ncharges) { if (!item_is_rod(item)) return; if (ncharges != -1) + { item.plus2 = ncharges * ROD_CHARGE_MULT; + item.props["rod_enchantment"] = (short)0; + } else { if (item.sub_type == STAFF_STRIKING) item.plus2 = random_range(6, 9) * ROD_CHARGE_MULT; else item.plus2 = random_range(9, 14) * ROD_CHARGE_MULT; + + item.props["rod_enchantment"] = (short)_roll_rod_enchant(); } item.plus = item.plus2; |