diff --git a/crawl-ref/source/godabil.cc b/crawl-ref/source/godabil.cc index d9d3509151d..d0dc9f17007 100644 --- a/crawl-ref/source/godabil.cc +++ b/crawl-ref/source/godabil.cc @@ -1614,7 +1614,8 @@ void trog_remove_trogs_hand() */ static bool _given_gift(const monster* mon) { - return mon->props.exists(BEOGH_WPN_GIFT_KEY) + return mon->props.exists(BEOGH_RANGE_WPN_GIFT_KEY) + || mon->props.exists(BEOGH_MELEE_WPN_GIFT_KEY) || mon->props.exists(BEOGH_ARM_GIFT_KEY) || mon->props.exists(BEOGH_SH_GIFT_KEY); } @@ -1768,8 +1769,10 @@ bool beogh_gift_item() mons->props[BEOGH_SH_GIFT_KEY] = true; else if (body_armour) mons->props[BEOGH_ARM_GIFT_KEY] = true; + else if (range_weapon) + mons->props[BEOGH_RANGE_WPN_GIFT_KEY] = true; else - mons->props[BEOGH_WPN_GIFT_KEY] = true; + mons->props[BEOGH_MELEE_WPN_GIFT_KEY] = true; return true; } diff --git a/crawl-ref/source/godabil.h b/crawl-ref/source/godabil.h index 8057a2e15ca..f20444c5e0c 100644 --- a/crawl-ref/source/godabil.h +++ b/crawl-ref/source/godabil.h @@ -10,7 +10,8 @@ #include "itemprop-enum.h" // brand_type #include "spl-cast.h" -#define BEOGH_WPN_GIFT_KEY "given beogh weapon" +#define BEOGH_RANGE_WPN_GIFT_KEY "given beogh range weapon" +#define BEOGH_MELEE_WPN_GIFT_KEY "given beogh melee weapon" #define BEOGH_ARM_GIFT_KEY "given beogh armour" #define BEOGH_SH_GIFT_KEY "given beogh shield" diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc index 77fa19daf05..33ee385c8bb 100644 --- a/crawl-ref/source/monster.cc +++ b/crawl-ref/source/monster.cc @@ -1604,6 +1604,12 @@ bool monster::wants_weapon(const item_def &weap) const return false; } + // Don't pick up a new weapon if we've been gifted one by the player. + if (is_range_weapon(weap) && props.exists(BEOGH_RANGE_WPN_GIFT_KEY)) + return false; + else if (props.exists(BEOGH_MELEE_WPN_GIFT_KEY)) + return false; + // Arcane spellcasters don't want -Cast. if (is_actual_spellcaster() && is_artefact(weap) @@ -1632,6 +1638,12 @@ bool monster::wants_armour(const item_def &item) const return false; } + // Don't pick up new armour if we've been gifted something by the player. + if (is_shield(item) && props.exists(BEOGH_SH_GIFT_KEY)) + return false; + else if (props.exists(BEOGH_ARM_GIFT_KEY)) + return false; + // Spellcasters won't pick up restricting armour, although they can // start with one. Applies to arcane spells only, of course. if (!pos().origin() && is_actual_spellcaster() diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc index 5a53ba796ed..52fb136199e 100644 --- a/crawl-ref/source/tags.cc +++ b/crawl-ref/source/tags.cc @@ -5933,6 +5933,12 @@ void unmarshallMonster(reader &th, monster& m) m.props[ORIGINAL_TYPE_KEY].get_int() = get_monster_by_name(m.props["original_name"].get_string()); } + + if (m.props.exists("given beogh weapon")) + { + m.props.erase("given beogh weapon"); + m.props[BEOGH_MELEE_WPN_GIFT_KEY] = true; + } #endif if (m.type != MONS_PROGRAM_BUG && mons_species(m.type) == MONS_PROGRAM_BUG)