From 22019ceee8c3df285becfd98445aaec91055c6df Mon Sep 17 00:00:00 2001 From: Stefan O'Rear Date: Sat, 2 Jan 2010 17:46:08 -0800 Subject: 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. --- crawl-ref/source/makeitem.cc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'crawl-ref/source/makeitem.cc') 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; -- cgit v1.2.3-54-g00ecf