integrate aklys feature introduced in 3.6.1 into display
(cherry picked from commit 3fe8325f14)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 dothrow.c $NHDT-Date: 1522967321 2018/04/05 22:28:41 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.135 $ */
|
||||
/* NetHack 3.6 dothrow.c $NHDT-Date: 1525012611 2018/04/29 14:36:51 $ $NHDT-Branch: master $:$NHDT-Revision: 1.137 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2013. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -1082,6 +1082,7 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
|
||||
register int range, urange;
|
||||
boolean crossbowing, impaired = (Confusion || Stunned || Blind
|
||||
|| Hallucination || Fumbling);
|
||||
boolean tethered_weapon = (obj->otyp == AKLYS && (wep_mask & W_WEP) != 0);
|
||||
|
||||
notonhead = FALSE; /* reset potentially stale value */
|
||||
if ((obj->cursed || obj->greased) && (u.dx || u.dy) && !rn2(7)) {
|
||||
@@ -1131,8 +1132,7 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
|
||||
if (u.dz < 0
|
||||
/* Mjollnir must we wielded to be thrown--caller verifies this;
|
||||
aklys must we wielded as primary to return when thrown */
|
||||
&& ((Role_if(PM_VALKYRIE) && obj->oartifact == ART_MJOLLNIR)
|
||||
|| (obj->otyp == AKLYS && (wep_mask & W_WEP) != 0))
|
||||
&& ((Role_if(PM_VALKYRIE) && obj->oartifact == ART_MJOLLNIR) || tethered_weapon)
|
||||
&& !impaired) {
|
||||
pline("%s the %s and returns to your hand!", Tobjnam(obj, "hit"),
|
||||
ceiling(u.ux, u.uy));
|
||||
@@ -1217,7 +1217,7 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
|
||||
range = 20; /* you must be giant */
|
||||
else if (obj->oartifact == ART_MJOLLNIR)
|
||||
range = (range + 1) / 2; /* it's heavy */
|
||||
else if (obj->otyp == AKLYS && (wep_mask & W_WEP) != 0)
|
||||
else if (tethered_weapon) /* primary weapon is aklys */
|
||||
/* if an aklys is going to return, range is limited by the
|
||||
length of the attached cord [implicit aspect of item] */
|
||||
range = min(range, BOLT_LIM / 2);
|
||||
@@ -1227,7 +1227,8 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
|
||||
if (Underwater)
|
||||
range = 1;
|
||||
|
||||
mon = bhit(u.dx, u.dy, range, THROWN_WEAPON,
|
||||
mon = bhit(u.dx, u.dy, range,
|
||||
tethered_weapon ? THROWN_TETHERED_WEAPON : THROWN_WEAPON,
|
||||
(int FDECL((*), (MONST_P, OBJ_P))) 0,
|
||||
(int FDECL((*), (OBJ_P, OBJ_P))) 0, &obj);
|
||||
thrownobj = obj; /* obj may be null now */
|
||||
@@ -1236,8 +1237,14 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
|
||||
if (Is_airlevel(&u.uz) || Levitation)
|
||||
hurtle(-u.dx, -u.dy, urange, TRUE);
|
||||
|
||||
if (!obj)
|
||||
if (!obj) {
|
||||
/* bhit display cleanup was left with this caller
|
||||
for tethered_weapon, but clean it up now since
|
||||
we're about to return */
|
||||
if (tethered_weapon)
|
||||
tmp_at(DISP_END, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (mon) {
|
||||
@@ -1264,8 +1271,11 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
|
||||
}
|
||||
|
||||
if (!thrownobj) {
|
||||
; /* missile has already been handled */
|
||||
/* missile has already been handled */
|
||||
if (tethered_weapon) tmp_at(DISP_END, 0);
|
||||
} else if (u.uswallow) {
|
||||
if (tethered_weapon)
|
||||
tmp_at(DISP_END, 0);
|
||||
/* ball is not picked up by monster */
|
||||
if (obj != uball)
|
||||
(void) mpickobj(u.ustuck, obj);
|
||||
@@ -1274,9 +1284,12 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
|
||||
/* Mjollnir must we wielded to be thrown--caller verifies this;
|
||||
aklys must we wielded as primary to return when thrown */
|
||||
if ((obj->oartifact == ART_MJOLLNIR && Role_if(PM_VALKYRIE))
|
||||
|| (obj->otyp == AKLYS && (wep_mask & W_WEP) != 0)) {
|
||||
|| tethered_weapon) {
|
||||
if (rn2(100)) {
|
||||
sho_obj_return_to_u(obj); /* display its flight */
|
||||
if (tethered_weapon)
|
||||
tmp_at(DISP_END, BACKTRACK);
|
||||
else
|
||||
sho_obj_return_to_u(obj); /* display its flight */
|
||||
|
||||
if (!impaired && rn2(100)) {
|
||||
pline("%s to your hand!", Tobjnam(obj, "return"));
|
||||
@@ -1320,6 +1333,7 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
|
||||
thrownobj = (struct obj *) 0;
|
||||
return;
|
||||
} else {
|
||||
if (tethered_weapon) tmp_at(DISP_END, 0);
|
||||
/* when this location is stepped on, the weapon will be
|
||||
auto-picked up due to 'obj->was_thrown' of 1;
|
||||
addinv() prevents thrown Mjollnir from being placed
|
||||
|
||||
Reference in New Issue
Block a user