From 14c7b2015d59f65f3feac323a15eef6f2331e965 Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 20 Sep 2023 12:10:57 -0700 Subject: [PATCH] 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 --- doc/fixes3-7-0.txt | 2 ++ src/dothrow.c | 12 ++++++++---- src/quest.c | 23 ++++++++++++++++++----- src/questpgr.c | 2 ++ 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 1e33bfe1e..171e1daa4 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -2248,6 +2248,8 @@ high skill level in martial arts or bare-handed combat sometimes hits twice answering '?' 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 diff --git a/src/dothrow.c b/src/dothrow.c index 3cb230f27..2df4be975 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -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*/ diff --git a/src/quest.c b/src/quest.c index 1ebd3da59..8a55b1826 100644 --- a/src/quest.c +++ b/src/quest.c @@ -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*/ diff --git a/src/questpgr.c b/src/questpgr.c index 88c8e504e..04bb6e719 100644 --- a/src/questpgr.c +++ b/src/questpgr.c @@ -659,4 +659,6 @@ deliver_splev_message(void) } } +#undef QTEXT_FILE + /*questpgr.c*/