From cbf67e5890e40248a1ccf8477e09761ea12a85f4 Mon Sep 17 00:00:00 2001 From: dolorous Date: Wed, 21 May 2008 17:18:46 +0000 Subject: Replace Elyvilon's single-weapon-destruction retribution with a multiple-weapon-dulling retribution. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5173 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/religion.cc | 94 +++++++++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 40 deletions(-) (limited to 'crawl-ref/source/religion.cc') diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 0f37b88013..0c8d8c94fc 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -3063,63 +3063,77 @@ static bool _zin_retribution() return false; } -static void _ely_destroy_inventory_weapon() +static void _ely_dull_inventory_weapons() { - int count = 0; - int item = ENDOFPACK; + int chance = 50; + int num_dulled = 0; + int quiver_link; + + you.m_quiver->get_desired_item(NULL, &quiver_link); - for (int i = 0; i < ENDOFPACK; i++) + for (int i = 0; i < ENDOFPACK; ++i) { - if (!is_valid_item( you.inv[i] )) - continue; + if (!is_valid_item(you.inv[i])) + continue; if (you.inv[i].base_type == OBJ_WEAPONS || you.inv[i].base_type == OBJ_MISSILES) { + // don't dull artefacts if (is_artefact(you.inv[i])) continue; - // item is valid for destroying, so give it a chance - count++; - if (one_chance_in( count )) - item = i; - } - } + // don't dull weapons below -1/-1 + if (you.inv[i].base_type == OBJ_WEAPONS + && you.inv[i].plus <= -1 && you.inv[i].plus2 <= -1) + { + continue; + } + // don't dull ammo below -1 + else if (you.inv[i].plus <= -1) + continue; - // any item to destroy? - if (item == ENDOFPACK) - return; + // 2/3 of the time, don't do anything + if (!one_chance_in(3)) + continue; - int value = 1; - bool wielded = false; + bool wielded = false; + bool quivered = false; - // increase value of wielded weapons or large stacks of ammo - if (you.inv[item].base_type == OBJ_WEAPONS - && you.inv[item].link == you.equip[EQ_WEAPON]) - { - wielded = true; - value += 2; - } - else if (you.inv[item].quantity > random2(you.penance[GOD_ELYVILON])) - value += 1 + random2(2); + if (you.inv[i].link == you.equip[EQ_WEAPON]) + wielded = true; + if (you.inv[i].link == quiver_link) + quivered = true; - piety_gain_t pgain = (value == 1) ? PIETY_NONE : PIETY_SOME; + // dull the weapon/ammo + if (you.inv[i].plus > -1) + you.inv[i].plus--; + if ((you.inv[i].base_type == OBJ_WEAPONS) + && you.inv[i].plus2 > -1) + { + you.inv[i].plus2--; + } - // Elyvilon doesn't care about item sacrifices at altars, so I'm - // stealing _Sacrifice_Messages. - _print_sacrifice_message(GOD_ELYVILON, you.inv[item], pgain, true); + // update the weapon/ammo display, if necessary + if (wielded) + you.wield_change = true; + if (quivered) + you.m_quiver->on_item_fired(you.inv[i]); - if (wielded) - { - unwield_item(true); - you.wield_change = true; - you.m_quiver->on_weapon_changed(); + chance += item_value(you.inv[i], true) / 50; + num_dulled++; + } } - destroy_item(you.inv[item]); - burden_change(); + if (num_dulled > 0) + { + if (chance >= random2(100)) + dec_penance(GOD_ELYVILON, 1); - dec_penance(GOD_ELYVILON, value); + snprintf(info, INFO_SIZE, " dulls %syour weapons.", + (num_dulled > 1) ? "" : "one of "); + simple_god_message(info, GOD_ELYVILON); + } } static bool _elyvilon_retribution() @@ -3142,8 +3156,8 @@ static bool _elyvilon_retribution() break; case 3: - case 4: // destroy weapons in your inventory - _ely_destroy_inventory_weapon(); + case 4: // dull weapons in your inventory + _ely_dull_inventory_weapons(); break; } -- cgit v1.2.3-54-g00ecf