diff options
author | Chris Campbell <chriscampbell89@gmail.com> | 2014-03-03 00:05:13 +0000 |
---|---|---|
committer | Chris Campbell <chriscampbell89@gmail.com> | 2014-03-03 00:13:44 +0000 |
commit | 2f3bebc844bfe267e124c18000f8cc4ffcb5a628 (patch) | |
tree | f9a4ef205e23edc493e504e82cbc57f197d9c87c /crawl-ref/source/godprayer.cc | |
parent | 0bebd3a1b33cd3884f7f882a4455e030e366d1bf (diff) | |
download | crawl-ref-2f3bebc844bfe267e124c18000f8cc4ffcb5a628.tar.gz crawl-ref-2f3bebc844bfe267e124c18000f8cc4ffcb5a628.zip |
Adjust Ashenzari curse scroll weights, sometimes generate multiple scrolls
Look at the number of available armour slots for your species to decide on the
weightings for curse scrolls, and generate 1-3 curse scrolls per remove curse
scroll, based on piety.
Diffstat (limited to 'crawl-ref/source/godprayer.cc')
-rw-r--r-- | crawl-ref/source/godprayer.cc | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/crawl-ref/source/godprayer.cc b/crawl-ref/source/godprayer.cc index 4048ebc803..5c6338b7e7 100644 --- a/crawl-ref/source/godprayer.cc +++ b/crawl-ref/source/godprayer.cc @@ -516,23 +516,38 @@ static void _give_sac_group_feedback(int which) static void _ashenzari_sac_scroll(const item_def& item) { int scr = SCR_CURSE_JEWELLERY; - if (you.species != SP_FELID - && (you.species != SP_OCTOPODE || one_chance_in(4))) - { - scr = random_choose(SCR_CURSE_WEAPON, SCR_CURSE_ARMOUR, - SCR_CURSE_JEWELLERY, -1); - } - int it = items(0, OBJ_SCROLLS, scr, true, 0, MAKE_ITEM_NO_RACE, - 0, 0, GOD_ASHENZARI); - if (it == NON_ITEM) + int num = min(1 + random2(1 + you.piety / 50), 3); + + int wpn = 3; + int arm = 0; + int jwl = (you.species != SP_OCTOPODE) ? 3 : 9; + + for (int i = EQ_MIN_ARMOUR; i <= EQ_MAX_ARMOUR; i++) + if (you_can_wear(i, true)) + arm++; + + do { - mpr("You feel the world is against you."); - return; - } + if (you.species != SP_FELID) + { + scr = random_choose_weighted(wpn, SCR_CURSE_WEAPON, + arm, SCR_CURSE_ARMOUR, + jwl, SCR_CURSE_JEWELLERY, + 0); + } + int it = items(0, OBJ_SCROLLS, scr, true, 0, MAKE_ITEM_NO_RACE, + 0, 0, GOD_ASHENZARI); + if (it == NON_ITEM) + { + mpr("You feel the world is against you."); + return; + } - mitm[it].quantity = 1; - if (!move_item_to_grid(&it, you.pos(), true)) - destroy_item(it, true); // can't happen + mitm[it].quantity = 1; + if (!move_item_to_grid(&it, you.pos(), true)) + destroy_item(it, true); // can't happen + } + while (--num > 0); } // Is the destroyed weapon valuable enough to gain piety by doing so? |