From 1b6a9218017b078613a735323eed1c334a06c793 Mon Sep 17 00:00:00 2001 From: haranp Date: Tue, 23 Oct 2007 21:23:06 +0000 Subject: Receiving a pure deck from Nemelex now decays the appropriate sacrifice weight by 20%. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2525 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/religion.cc | 47 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) (limited to 'crawl-ref/source/religion.cc') diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 2b7ec23128..7fc6188660 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -532,6 +532,48 @@ static void get_pure_deck_weights(int weights[]) you.sacrifice_value[OBJ_FOOD]; } +static void update_sacrifice_weights(int which) +{ + switch ( which ) + { + case 0: + you.sacrifice_value[OBJ_ARMOUR] /= 5; + you.sacrifice_value[OBJ_ARMOUR] *= 4; + break; + case 1: + you.sacrifice_value[OBJ_WEAPONS] /= 5; + you.sacrifice_value[OBJ_STAVES] /= 5; + you.sacrifice_value[OBJ_MISSILES] /= 5; + you.sacrifice_value[OBJ_WEAPONS] *= 4; + you.sacrifice_value[OBJ_STAVES] *= 4; + you.sacrifice_value[OBJ_MISSILES] *= 4; + break; + case 2: + you.sacrifice_value[OBJ_MISCELLANY] /= 5; + you.sacrifice_value[OBJ_JEWELLERY] /= 5; + you.sacrifice_value[OBJ_BOOKS] /= 5; + you.sacrifice_value[OBJ_GOLD] /= 5; + you.sacrifice_value[OBJ_MISCELLANY] *= 4; + you.sacrifice_value[OBJ_JEWELLERY] *= 4; + you.sacrifice_value[OBJ_BOOKS] *= 4; + you.sacrifice_value[OBJ_GOLD] *= 4; + case 3: + you.sacrifice_value[OBJ_CORPSES] /= 5; + you.sacrifice_value[OBJ_CORPSES] *= 4; + break; + case 4: + you.sacrifice_value[OBJ_POTIONS] /= 5; + you.sacrifice_value[OBJ_SCROLLS] /= 5; + you.sacrifice_value[OBJ_WANDS] /= 5; + you.sacrifice_value[OBJ_FOOD] /= 5; + you.sacrifice_value[OBJ_POTIONS] *= 4; + you.sacrifice_value[OBJ_SCROLLS] *= 4; + you.sacrifice_value[OBJ_WANDS] *= 4; + you.sacrifice_value[OBJ_FOOD] *= 4; + break; + } +} + #if DEBUG_GIFTS || DEBUG_CARDS static void show_pure_deck_chances() { @@ -573,11 +615,12 @@ static void give_nemelex_gift() }; int weights[5]; get_pure_deck_weights(weights); - gift_type = pure_decks[choose_random_weighted(weights, weights+5)]; - + const int choice = choose_random_weighted(weights, weights+5); + gift_type = pure_decks[choice]; #if DEBUG_GIFTS || DEBUG_CARDS show_pure_deck_chances(); #endif + update_sacrifice_weights(choice); } else { -- cgit v1.2.3-54-g00ecf