rocks vs unicorns

A reddit thread mentioned that throwing rocks at unicorns behaved
the same as throwing gems at them:  not treated as an attack and if
teleporting away is allowed, they will.  Change to treat shooting
gems and glass at unicorns with a sling as an attack rather than as
just giving the gem or piece of glass to them, and treat throwing
or shooting rocks and gray stones as an attack too.

If picked up by blind hero while not yet seen, gems and glass
format as "gem" and rocks and gray stones format as "stone" so the
player can always tell the difference.  Forgetting to unwield a
sling before interacting with a unicorn is on the player's head.
This commit is contained in:
PatR
2020-07-26 07:46:07 -07:00
parent d3ee8a7717
commit 0fe9905cf8
2 changed files with 22 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.256 $ $NHDT-Date: 1595668889 2020/07/25 09:21:29 $
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.257 $ $NHDT-Date: 1595774758 2020/07/26 14:45:58 $
General Fixes and Modified Features
-----------------------------------
@@ -228,6 +228,7 @@ hero poly'd into a mind flayer who used #monster to emit a psychic blast was
some hero attacks that should have gotten a skill bonus or penalty didn't
change internal name of "<foo> venom" to "splash of <foo> venom"
singularize "splashes" to "splash" instead of "splashe"
treat slinging gems and tossing or slinging stones at unicorns as attacks
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 dothrow.c $NHDT-Date: 1584398443 2020/03/16 22:40:43 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.184 $ */
/* NetHack 3.6 dothrow.c $NHDT-Date: 1595774758 2020/07/26 14:45:58 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.187 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1611,7 +1611,13 @@ register struct obj *obj; /* g.thrownobj or g.kickedobj or uwep */
tmp += 1000; /* Guaranteed hit */
}
if (obj->oclass == GEM_CLASS && is_unicorn(mon->data)) {
/* throwing real gems to co-aligned unicorns boosts Luck,
to cross-aligned unicorns changes Luck by random amount;
throwing worthless glass doesn't affect Luck but doesn't anger them;
3.7: treat rocks and gray stones as attacks rather than like glass
and also treat gems or glass shot via sling as attacks */
if (obj->oclass == GEM_CLASS && is_unicorn(mon->data)
&& objects[obj->otyp].oc_material != MINERAL && !uslinging()) {
if (mon->msleeping || !mon->mcanmove) {
tmiss(obj, mon, FALSE);
return 0;
@@ -1628,8 +1634,8 @@ register struct obj *obj; /* g.thrownobj or g.kickedobj or uwep */
at leader... (kicked artifact is ok too; HMON_APPLIED could
occur if quest artifact polearm or grapnel ever gets added) */
if (hmode != HMON_APPLIED && quest_arti_hits_leader(obj, mon)) {
/* AIS: changes to wakeup() means that it's now less inappropriate here
than it used to be, but the manual version works just as well */
/* AIS: changes to wakeup() means that it's now less inappropriate
here than it used to be, but manual version works just as well */
mon->msleeping = 0;
mon->mstrategy &= ~STRAT_WAITMASK;
@@ -1823,15 +1829,16 @@ gem_accept(mon, obj)
register struct monst *mon;
register struct obj *obj;
{
static NEARDATA const char
nogood[] = " is not interested in your junk.",
acceptgift[] = " accepts your gift.",
maybeluck[] = " hesitatingly",
noluck[] = " graciously",
addluck[] = " gratefully";
char buf[BUFSZ];
boolean is_buddy = sgn(mon->data->maligntyp) == sgn(u.ualign.type);
boolean is_gem = objects[obj->otyp].oc_material == GEMSTONE;
int ret = 0;
static NEARDATA const char nogood[] = " is not interested in your junk.";
static NEARDATA const char acceptgift[] = " accepts your gift.";
static NEARDATA const char maybeluck[] = " hesitatingly";
static NEARDATA const char noluck[] = " graciously";
static NEARDATA const char addluck[] = " gratefully";
Strcpy(buf, Monnam(mon));
mon->mpeaceful = 1;
@@ -1851,7 +1858,8 @@ register struct obj *obj;
Strcat(buf, nogood);
goto nopick;
}
/* making guesses */
/* making guesses */
} else if (has_oname(obj) || objects[obj->otyp].oc_uname) {
if (is_gem) {
if (is_buddy) {
@@ -1865,7 +1873,8 @@ register struct obj *obj;
Strcat(buf, nogood);
goto nopick;
}
/* value completely unknown to @ */
/* value completely unknown to @ */
} else {
if (is_gem) {
if (is_buddy) {