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

@@ -2248,6 +2248,8 @@ high skill level in martial arts or bare-handed combat sometimes hits twice
answering '?<return>' at the "genocide what?" prompt (for either monster class
or single species) runs the #genocided command to show what types of
monsters have already been genocided and then re-prompts
throwing the silver bell (or other invocation item, or the Amulet) to the
quest leader will identify it instead of being treated as an attack
Platform- and/or Interface-Specific New Features

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*/

View File

@@ -219,15 +219,26 @@ expulsion(boolean seal)
artifact or you've just thrown it to/at him or her. If quest
completion text hasn't been given yet, give it now. Otherwise
give another message about the character keeping the artifact
and using the magic portal to return to the dungeon. */
and using the magic portal to return to the dungeon. Also called
if hero throws or kicks an invocation item (probably the Bell)
at the leader. */
void
finish_quest(struct obj *obj) /* quest artifact or thrown unique item;
possibly null if carrying Amulet */
* possibly null if carrying the Amulet */
{
struct obj *otmp;
/*
* Possible extensions [would mostly need to be done in thitmonst()]:
* if the invocation has already been performed, leader keeps any
* thrown (or kicked) invocation item, perhaps stating the intent
* to guard it for the future;
* if the item is an unidentified fake Amulet, identify it instead
* of treating the throw as an attack.
*/
if (obj && objects[obj->otyp].oc_unique) {
/* tossed one of the invocation items (or AoY) at the quest leader */
/* tossed one of the invocation items (or AoY) at the quest leader */
if (Deaf)
return; /* optional (unlike quest completion) so skip if deaf */
/* do ID first so that the message identifying the item will refer to
@@ -494,8 +505,10 @@ void
quest_stat_check(struct monst *mtmp)
{
if (mtmp->data->msound == MS_NEMESIS)
Qstat(in_battle) = (!helpless(mtmp)
&& monnear(mtmp, u.ux, u.uy));
Qstat(in_battle) = (!helpless(mtmp) && monnear(mtmp, u.ux, u.uy));
}
#undef Not_firsttime
#undef Qstat
/*quest.c*/

View File

@@ -659,4 +659,6 @@ deliver_splev_message(void)
}
}
#undef QTEXT_FILE
/*questpgr.c*/