Skip to content

Commit

Permalink
Prevent orcs from swapping from Beogh gifts back to their original eq…
Browse files Browse the repository at this point in the history
…uipment

Let's assume that the player at least thinks they know best.
  • Loading branch information
Chris Campbell committed Mar 5, 2016
1 parent eab8b1e commit e60c81d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
7 changes: 5 additions & 2 deletions crawl-ref/source/godabil.cc
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion crawl-ref/source/godabil.h
Expand Up @@ -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"

Expand Down
12 changes: 12 additions & 0 deletions crawl-ref/source/monster.cc
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
6 changes: 6 additions & 0 deletions crawl-ref/source/tags.cc
Expand Up @@ -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)
Expand Down

0 comments on commit e60c81d

Please sign in to comment.