PR #1093 - quest leader vs thrown invocation items

Pull request from entrez:  if hero throws (or kicks) an invocation
item or the Amulet at the quest leader, identify it and give it back
instead of treating the throw (or kicked item) as an attack.

In addition to the fixes entry I've made several tweaks to related
code, mostly to refer to the leader as "Someone" rather than "It" if
unseen.

Closes #1093
This commit is contained in:
PatR
2023-09-20 12:10:57 -07:00
parent bda0b3b807
commit 14c7b2015d
4 changed files with 30 additions and 9 deletions

View File

@@ -1920,8 +1920,8 @@ tmiss(struct obj *obj, struct monst *mon, boolean maybe_wakeup)
return;
}
#define special_obj_hits_leader(obj, mon) \
((is_quest_artifact(obj) || objects[obj->otyp].oc_unique) \
#define special_obj_hits_leader(obj, mon) \
((is_quest_artifact(obj) || objects[obj->otyp].oc_unique) \
&& mon->m_id == gq.quest_status.leader_m_id)
/*
@@ -2031,12 +2031,12 @@ thitmonst(
mon->mstrategy &= ~STRAT_WAITMASK;
if (mon->mcanmove) {
pline("%s catches %s.", Monnam(mon), the(xname(obj)));
pline("%s catches %s.", Some_Monnam(mon), the(xname(obj)));
if (mon->mpeaceful) {
boolean next2u = monnear(mon, u.ux, u.uy);
finish_quest(obj); /* acknowledge quest completion */
pline("%s %s %s back to you.", Monnam(mon),
pline("%s %s %s back to you.", Some_Monnam(mon),
(next2u ? "hands" : "tosses"), the(xname(obj)));
if (!next2u)
sho_obj_return_to_u(obj);
@@ -2230,6 +2230,8 @@ thitmonst(
return 0;
}
#undef special_obj_hits_leader
static int
gem_accept(register struct monst *mon, register struct obj *obj)
{
@@ -2646,4 +2648,6 @@ throw_gold(struct obj *obj)
return ECMD_TIME;
}
#undef AutoReturn
/*dothrow.c*/