This is awesome on so many levels. I've always loved playing Nemelex,
but having to do weird stuff with inscriptions made it a little
frustrating some times. This just means the experience is so much
better! :D

-Jude

On Mon, Dec 6, 2010 at 8:36 AM, jpeg <j-p-...@users.sourceforge.net> wrote:
>       via  fe245c2b2ece11e1a55f1f1d3e70a3a58f57967d (commit)
>      from  020c4ecb8dfdfcbc3935b725a5c01ebaa185c905 (commit)
>
> -----------------------------------------------------------------------
> commit fe245c2b2ece11e1a55f1f1d3e70a3a58f57967d
> Author: Johanna Ploog <j-p-...@users.sourceforge.net>
> Date:   Sun Dec 5 23:25:11 2010 +0100
>
>    Allow the player more control over what items to sac to Nemelex.
>
>    Implement a toggle on the second religion screen (^!) that allows
>    fine-tuning over which item types to skip and which ones to actually
>    sacrifice when praying.
>
>    So far, this behaviour is completely undocumented.
>
>    There's currently no feedback at all if prayer skips over items or
>    even if everything in a stack turns out not to match the player's
>    sacrifice categories.
>    Also, we probably don't want such ineffective prayer to cost a turn.
>
> -----------------------------------------------------------------------
>
> Summary of changes:
>  crawl-ref/source/describe.cc     |   49 ++++++++++++++++++++++++-----
>  crawl-ref/source/godprayer.cc    |   44 +++++++++++++++++++++++++++
>  crawl-ref/source/ng-setup.cc     |    3 ++
>  crawl-ref/source/player.h        |    4 ++
>  crawl-ref/source/religion-enum.h |   11 +++++++
>  crawl-ref/source/religion.cc     |   62 +++++++++++++++++++++----------------
>  crawl-ref/source/tag-version.h   |   35 +++++++++++----------
>  crawl-ref/source/tags.cc         |   15 +++++++++
>  8 files changed, 170 insertions(+), 53 deletions(-)
>
> diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
> index 048d50b..7c43357 100644
> --- a/crawl-ref/source/describe.cc
> +++ b/crawl-ref/source/describe.cc
> @@ -4073,14 +4073,38 @@ static void _detailed_god_description(god_type 
> which_god)
>                          "Evocations skill help here, as the power of 
> Nemelex's "
>                          "abilities is governed by Evocations instead of "
>                          "Invocations. The type of the deck gifts strongly "
> -                         "depends on the dominating item class sacrificed:\n"
> -                         "  decks of Escape      -- armour\n"
> -                         "  decks of Destruction -- weapons and ammunition\n"
> -                         "  decks of Dungeons    -- jewellery, books, "
> -                                                    "miscellaneous items\n"
> -                         "  decks of Summoning   -- corpses, chunks, blood\n"
> -                         "  decks of Wonders     -- consumables: food, 
> potions, "
> -                                                    "scrolls, wands\n";
> +                         "depends on the dominating item class 
> sacrificed:\n";
> +
> +                for (int i = 0; i < NUM_NEMELEX_GIFT_TYPES; ++i)
> +                {
> +                    const bool active = you.nemelex_sacrificing[i];
> +                    std::string desc = "";
> +                    switch (i)
> +                    {
> +                    case NEM_GIFT_ESCAPE:
> +                        desc = "decks of Escape      -- armour";
> +                        break;
> +                    case NEM_GIFT_DESTRUCTION:
> +                        desc = "decks of Destruction -- weapons and 
> ammunition";
> +                        break;
> +                    case NEM_GIFT_DUNGEONS:
> +                        desc = "decks of Dungeons    -- jewellery, books, "
> +                                                    "miscellaneous items";
> +                        break;
> +                    case NEM_GIFT_SUMMONING:
> +                        desc = "decks of Summoning   -- corpses, chunks, 
> blood";
> +                        break;
> +                    case NEM_GIFT_WONDERS:
> +                        desc = "decks of Wonders     -- consumables: food, 
> potions, "
> +                                                    "scrolls, wands";
> +                        break;
> +                    }
> +                    broken += make_stringf(" %c %s%s%s\n",
> +                                           'a' + (char) i,
> +                                           active ? "+ " : "- <darkgrey>",
> +                                           desc.c_str(),
> +                                           active ? "" : "</darkgrey>");
> +                }
>             }
>         default:
>             break;
> @@ -4110,7 +4134,14 @@ static void _detailed_god_description(god_type 
> which_god)
>     mouse_control mc(MOUSE_MODE_MORE);
>
>     const int keyin = getchm();
> -    if (keyin == '!' || keyin == CK_MOUSE_CMD)
> +    if (you.religion == GOD_NEMELEX_XOBEH
> +        && keyin >= 'a' && keyin < 'a' + (char) NUM_NEMELEX_GIFT_TYPES)
> +    {
> +        const int num = keyin - 'a';
> +        you.nemelex_sacrificing[num] = !you.nemelex_sacrificing[num];
> +        _detailed_god_description(which_god);
> +    }
> +    else if (keyin == '!' || keyin == CK_MOUSE_CMD)
>         describe_god(which_god, true);
>  }
>
> diff --git a/crawl-ref/source/godprayer.cc b/crawl-ref/source/godprayer.cc
> index e46add5..5cec0bb 100644
> --- a/crawl-ref/source/godprayer.cc
> +++ b/crawl-ref/source/godprayer.cc
> @@ -724,6 +724,42 @@ piety_gain_t sacrifice_item_stack(const item_def& item, 
> int *js)
>     return (relative_gain);
>  }
>
> +static bool _check_nemelex_sacrificing_item_type(const item_def& item)
> +{
> +    switch (item.base_type)
> +    {
> +    case OBJ_ARMOUR:
> +        return (you.nemelex_sacrificing[NEM_GIFT_ESCAPE]);
> +
> +    case OBJ_WEAPONS:
> +    case OBJ_STAVES:
> +    case OBJ_MISSILES:
> +        return (you.nemelex_sacrificing[NEM_GIFT_DESTRUCTION]);
> +
> +    case OBJ_CORPSES:
> +        return (you.nemelex_sacrificing[NEM_GIFT_SUMMONING]);
> +
> +    case OBJ_POTIONS:
> +        if (is_blood_potion(item))
> +            return (you.nemelex_sacrificing[NEM_GIFT_SUMMONING]);
> +        return (you.nemelex_sacrificing[NEM_GIFT_WONDERS]);
> +
> +    case OBJ_FOOD:
> +        if (item.sub_type == FOOD_CHUNK)
> +            return (you.nemelex_sacrificing[NEM_GIFT_SUMMONING]);
> +    // else fall through
> +    case OBJ_WANDS:
> +    case OBJ_SCROLLS:
> +        return (you.nemelex_sacrificing[NEM_GIFT_WONDERS]);
> +
> +    case OBJ_JEWELLERY:
> +    case OBJ_BOOKS:
> +    case OBJ_MISCELLANY:
> +        return (you.nemelex_sacrificing[NEM_GIFT_DUNGEONS]);
> +    }
> +    return (false);
> +}
> +
>  static void _offer_items()
>  {
>     if (you.religion == GOD_NO_GOD || !god_likes_items(you.religion))
> @@ -767,6 +803,14 @@ static void _offer_items()
>             continue;
>         }
>
> +        // Skip items you don't want to sacrifice right now.
> +        if (you.religion == GOD_NEMELEX_XOBEH
> +            && !_check_nemelex_sacrificing_item_type(item))
> +        {
> +            i = next;
> +            continue;
> +        }
> +
>         // Ignore {!D} inscribed items.
>         if (!check_warning_inscriptions(item, OPER_DESTROY))
>         {
> diff --git a/crawl-ref/source/ng-setup.cc b/crawl-ref/source/ng-setup.cc
> index 7a4d674..042b84e 100644
> --- a/crawl-ref/source/ng-setup.cc
> +++ b/crawl-ref/source/ng-setup.cc
> @@ -1691,6 +1691,9 @@ static void _setup_generic(const newgame_def& ng)
>     // Generate the second name of Jiyva
>     fix_up_jiyva_name();
>
> +    for (int i = 0; i < NUM_NEMELEX_GIFT_TYPES; ++i)
> +        you.nemelex_sacrificing = true;
> +
>     // Create the save file.
>     you.save = new package((get_savedir_filename(you.your_name, "", "")
>                             + SAVE_SUFFIX).c_str(), true, true);
> diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
> index d29f63c..011d27f 100644
> --- a/crawl-ref/source/player.h
> +++ b/crawl-ref/source/player.h
> @@ -14,6 +14,7 @@
>  #include "itemprop-enum.h"
>  #include "package.h"
>  #include "place-info.h"
> +#include "religion-enum.h"
>
>  #include "species.h"
>
> @@ -190,6 +191,9 @@ public:
>   FixedVector<short,   MAX_NUM_GODS>  num_current_gifts;
>   FixedVector<short,   MAX_NUM_GODS>  num_total_gifts;
>
> +  // Nemelex sacrifice toggles
> +  FixedVector<bool, NUM_NEMELEX_GIFT_TYPES> nemelex_sacrificing;
> +
>   FixedVector<uint8_t, NUM_MUTATIONS> mutation;
>   FixedVector<uint8_t, NUM_MUTATIONS> innate_mutations;
>
> diff --git a/crawl-ref/source/religion-enum.h 
> b/crawl-ref/source/religion-enum.h
> index 2846d17..46a1e8f 100644
> --- a/crawl-ref/source/religion-enum.h
> +++ b/crawl-ref/source/religion-enum.h
> @@ -16,4 +16,15 @@ enum harm_protection_type
>     HPT_RELIABLE_PRAYING_PLUS_ANYTIME,
>     NUM_HPTS
>  };
> +
> +enum nemelex_gift_types
> +{
> +    NEM_GIFT_ESCAPE = 0,
> +    NEM_GIFT_DESTRUCTION,
> +    NEM_GIFT_DUNGEONS,
> +    NEM_GIFT_SUMMONING,
> +    NEM_GIFT_WONDERS,
> +    NUM_NEMELEX_GIFT_TYPES,
> +};
> +
>  #endif
> diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
> index ad57aa0..67bbf62 100644
> --- a/crawl-ref/source/religion.cc
> +++ b/crawl-ref/source/religion.cc
> @@ -1143,29 +1143,29 @@ static bool _need_missile_gift(bool forced)
>
>  void get_pure_deck_weights(int weights[])
>  {
> -    weights[0] = you.sacrifice_value[OBJ_ARMOUR] + 1;
> -    weights[1] = you.sacrifice_value[OBJ_WEAPONS]
> -                 + you.sacrifice_value[OBJ_STAVES]
> -                 + you.sacrifice_value[OBJ_MISSILES] + 1;
> -    weights[2] = you.sacrifice_value[OBJ_MISCELLANY]
> -                 + you.sacrifice_value[OBJ_JEWELLERY]
> -                 + you.sacrifice_value[OBJ_BOOKS];
> -    weights[3] = you.sacrifice_value[OBJ_CORPSES] / 2;
> -    weights[4] = you.sacrifice_value[OBJ_POTIONS]
> -                 + you.sacrifice_value[OBJ_SCROLLS]
> -                 + you.sacrifice_value[OBJ_WANDS]
> -                 + you.sacrifice_value[OBJ_FOOD];
> +    weights[NEM_GIFT_ESCAPE]      = you.sacrifice_value[OBJ_ARMOUR] + 1;
> +    weights[NEM_GIFT_DESTRUCTION] = you.sacrifice_value[OBJ_WEAPONS]
> +                                    + you.sacrifice_value[OBJ_STAVES]
> +                                    + you.sacrifice_value[OBJ_MISSILES] + 1;
> +    weights[NEM_GIFT_DUNGEONS]    = you.sacrifice_value[OBJ_MISCELLANY]
> +                                    + you.sacrifice_value[OBJ_JEWELLERY]
> +                                    + you.sacrifice_value[OBJ_BOOKS];
> +    weights[NEM_GIFT_SUMMONING]   = you.sacrifice_value[OBJ_CORPSES] / 2;
> +    weights[NEM_GIFT_WONDERS]     = you.sacrifice_value[OBJ_POTIONS]
> +                                    + you.sacrifice_value[OBJ_SCROLLS]
> +                                    + you.sacrifice_value[OBJ_WANDS]
> +                                    + you.sacrifice_value[OBJ_FOOD];
>  }
>
>  static void _update_sacrifice_weights(int which)
>  {
>     switch (which)
>     {
> -    case 0:
> +    case NEM_GIFT_ESCAPE:
>         you.sacrifice_value[OBJ_ARMOUR] /= 5;
>         you.sacrifice_value[OBJ_ARMOUR] *= 4;
>         break;
> -    case 1:
> +    case NEM_GIFT_DESTRUCTION:
>         you.sacrifice_value[OBJ_WEAPONS]  /= 5;
>         you.sacrifice_value[OBJ_STAVES]   /= 5;
>         you.sacrifice_value[OBJ_MISSILES] /= 5;
> @@ -1173,18 +1173,18 @@ static void _update_sacrifice_weights(int which)
>         you.sacrifice_value[OBJ_STAVES]   *= 4;
>         you.sacrifice_value[OBJ_MISSILES] *= 4;
>         break;
> -    case 2:
> +    case NEM_GIFT_DUNGEONS:
>         you.sacrifice_value[OBJ_MISCELLANY] /= 5;
>         you.sacrifice_value[OBJ_JEWELLERY]  /= 5;
>         you.sacrifice_value[OBJ_BOOKS]      /= 5;
>         you.sacrifice_value[OBJ_MISCELLANY] *= 4;
>         you.sacrifice_value[OBJ_JEWELLERY]  *= 4;
>         you.sacrifice_value[OBJ_BOOKS]      *= 4;
> -    case 3:
> +    case NEM_GIFT_SUMMONING:
>         you.sacrifice_value[OBJ_CORPSES] /= 5;
>         you.sacrifice_value[OBJ_CORPSES] *= 4;
>         break;
> -    case 4:
> +    case NEM_GIFT_WONDERS:
>         you.sacrifice_value[OBJ_POTIONS] /= 5;
>         you.sacrifice_value[OBJ_SCROLLS] /= 5;
>         you.sacrifice_value[OBJ_WANDS]   /= 5;
> @@ -1204,8 +1204,9 @@ static void _show_pure_deck_chances()
>
>     get_pure_deck_weights(weights);
>
> -    float total = (float) (weights[0] + weights[1] + weights[2] + weights[3]
> -                           + weights[4]);
> +    float total = 0;
> +    for (int i = 0; i < NUM_NEMELEX_GIFT_TYPES; ++i)
> +        total += (float) weights[i];
>
>     mprf(MSGCH_DIAGNOSTICS, "Pure cards chances: "
>          "escape %0.2f%%, destruction %0.2f%%, dungeons %0.2f%%,"
> @@ -1218,6 +1219,20 @@ static void _show_pure_deck_chances()
>  }
>  #endif
>
> +static misc_item_type _gift_type_to_deck(int gift)
> +{
> +    switch (gift)
> +    {
> +    case NEM_GIFT_ESCAPE:      return (MISC_DECK_OF_ESCAPE);
> +    case NEM_GIFT_DESTRUCTION: return (MISC_DECK_OF_DESTRUCTION);
> +    case NEM_GIFT_DUNGEONS:    return (MISC_DECK_OF_DUNGEONS);
> +    case NEM_GIFT_SUMMONING:   return (MISC_DECK_OF_SUMMONING);
> +    case NEM_GIFT_WONDERS:     return (MISC_DECK_OF_WONDERS);
> +    }
> +    ASSERT(false);
> +    return (NUM_MISCELLANY);
> +}
> +
>  static bool _give_nemelex_gift(bool forced = false)
>  {
>     // But only if you're not levitating over deep water.
> @@ -1235,17 +1250,10 @@ static bool _give_nemelex_gift(bool forced = false)
>         misc_item_type gift_type;
>
>         // Make a pure deck.
> -        const misc_item_type pure_decks[] = {
> -            MISC_DECK_OF_ESCAPE,
> -            MISC_DECK_OF_DESTRUCTION,
> -            MISC_DECK_OF_DUNGEONS,
> -            MISC_DECK_OF_SUMMONING,
> -            MISC_DECK_OF_WONDERS
> -        };
>         int weights[5];
>         get_pure_deck_weights(weights);
>         const int choice = choose_random_weighted(weights, weights+5);
> -        gift_type = pure_decks[choice];
> +        gift_type = _gift_type_to_deck(choice);
>  #if defined(DEBUG_GIFTS) || defined(DEBUG_CARDS)
>         _show_pure_deck_chances();
>  #endif
> diff --git a/crawl-ref/source/tag-version.h b/crawl-ref/source/tag-version.h
> index 9ce99c6..4e44742 100644
> --- a/crawl-ref/source/tag-version.h
> +++ b/crawl-ref/source/tag-version.h
> @@ -7,23 +7,24 @@
>  // Minor version will be reset to zero when major version changes.
>  enum tag_minor_version
>  {
> -    TAG_MINOR_RESET        = 0, // Minor tags were reset
> -    TAG_MINOR_DIAG_COUNTERS= 1, // Counters for diag/ortho moves.
> -    TAG_MINOR_FISHTAIL     = 2, // Merfolk's tail state.
> -    TAG_MINOR_DENSITY      = 3, // Count of level's explorable area.
> -    TAG_MINOR_MALIGN       = 4, // Keep malign gateway markers around for 
> longer.
> -    TAG_MINOR_GOD_GIFTS    = 5, // Track current as well as total god gifts.
> -    TAG_MINOR_ATT_SWAP     = 6, // Sort attitude enums by friendliness.
> -    TAG_MINOR_GRATE        = 7, // Iron grates.
> -    TAG_MINOR_XP_STEALING  = 8, // Block kill sniping.
> -    TAG_MINOR_EARTH_ATTUNE = 9, // [G]nomes earth attunement.
> -    TAG_MINOR_CROSSTRAIN   = 10, // Track skill points gained with 
> crosstraining.
> -    TAG_MINOR_ADD_ID_INFO  = 11, // Additional identification info
> -    TAG_MINOR_SLOW_RESKILL = 12, // Ashenzari progressive reskilling
> -    TAG_MINOR_RUNE_SUBST   = 13, // Removal of stored rune_subst.
> -    TAG_MINOR_NO_CSTRINGS  = 14, // No const-length strings in saves.
> -    TAG_MINOR_YOU_FORM     = 15, // Give transformations a field on their 
> own.
> -    TAG_MINOR_VERSION      = 15, // Current version.  (Keep equal to max.)
> +    TAG_MINOR_RESET          = 0, // Minor tags were reset
> +    TAG_MINOR_DIAG_COUNTERS  = 1, // Counters for diag/ortho moves.
> +    TAG_MINOR_FISHTAIL       = 2, // Merfolk's tail state.
> +    TAG_MINOR_DENSITY        = 3, // Count of level's explorable area.
> +    TAG_MINOR_MALIGN         = 4, // Keep malign gateway markers around for 
> longer.
> +    TAG_MINOR_GOD_GIFTS      = 5, // Track current as well as total god 
> gifts.
> +    TAG_MINOR_ATT_SWAP       = 6, // Sort attitude enums by friendliness.
> +    TAG_MINOR_GRATE          = 7, // Iron grates.
> +    TAG_MINOR_XP_STEALING    = 8, // Block kill sniping.
> +    TAG_MINOR_EARTH_ATTUNE   = 9, // [G]nomes earth attunement.
> +    TAG_MINOR_CROSSTRAIN     = 10, // Track skill points gained with 
> crosstraining.
> +    TAG_MINOR_ADD_ID_INFO    = 11, // Additional identification info
> +    TAG_MINOR_SLOW_RESKILL   = 12, // Ashenzari progressive reskilling
> +    TAG_MINOR_RUNE_SUBST     = 13, // Removal of stored rune_subst.
> +    TAG_MINOR_NO_CSTRINGS    = 14, // No const-length strings in saves.
> +    TAG_MINOR_YOU_FORM       = 15, // Give transformations a field on their 
> own.
> +    TAG_MINOR_NEMELEX_TOGGLE = 16, // Store Nemelex' sacrificing toggle 
> values.
> +    TAG_MINOR_VERSION        = 16, // Current version.  (Keep equal to max.)
>  };
>
>  #endif
> diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
> index 192c77c..9b3f5e4 100644
> --- a/crawl-ref/source/tags.cc
> +++ b/crawl-ref/source/tags.cc
> @@ -1137,6 +1137,10 @@ static void tag_construct_you(writer &th)
>     for (i = 0; i < MAX_NUM_GODS; i++)
>         marshallShort(th, you.num_total_gifts[i]);
>
> +    marshallByte(th, NUM_NEMELEX_GIFT_TYPES);
> +    for (i = 0; i < NUM_NEMELEX_GIFT_TYPES; ++i)
> +        marshallBoolean(th, you.nemelex_sacrificing[i]);
> +
>     marshallByte(th, you.gift_timeout);
>  #if TAG_MAJOR_VERSION == 31
>     marshallByte(th, you.normal_vision);
> @@ -1792,6 +1796,17 @@ static void tag_read_you(reader &th, int minorVersion)
>     for (i = 0; i < count; i++)
>         you.num_total_gifts[i] = unmarshallShort(th);
>
> +#if TAG_MAJOR_VERSION == 31
> +    if (minorVersion >= TAG_MINOR_NEMELEX_TOGGLE)
> +    {
> +#endif
> +    count = unmarshallByte(th);
> +    for (i = 0; i < count; i++)
> +        you.nemelex_sacrificing[i] = unmarshallBoolean(th);
> +#if TAG_MAJOR_VERSION == 31
> +    }
> +#endif
> +
>     you.gift_timeout   = unmarshallByte(th);
>
>  #if TAG_MAJOR_VERSION == 31
>
> --
> Dungeon Crawl Stone Soup
>
> ------------------------------------------------------------------------------
> What happens now with your Lotus Notes apps - do you make another costly
> upgrade, or settle for being marooned without product support? Time to move
> off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
> use, and manage than apps on traditional platforms. Sign up for the Lotus
> Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
> _______________________________________________
> Crawl-ref-commits mailing list
> crawl-ref-comm...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/crawl-ref-commits
>

------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
Crawl-ref-discuss mailing list
Crawl-ref-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/crawl-ref-discuss

Reply via email to