-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.533 $ $NHDT-Date: 1621037617 2021/05/15 00:13:37 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.534 $ $NHDT-Date: 1621131203 2021/05/16 02:13:23 $
General Fixes and Modified Features
-----------------------------------
poisonous"
innocuous items like scrolls or eucalyptus leaves did harm when falling on
hero's head after being thrown upward
+fighter types who start out knowing all non-magic armor should not know
+ cornuthaum and dunce cap
+prediscovered weapons adjustmens: only knights and samurai know polearms;
+ rangers know launchers (bows), ammo (arrows), and spears regardless
+ of their race/species; likewise, rogues know all daggers
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
-/* NetHack 3.7 u_init.c $NHDT-Date: 1606009005 2020/11/22 01:36:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.72 $ */
+/* NetHack 3.7 u_init.c $NHDT-Date: 1621131203 2021/05/16 02:13:23 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.75 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2017. */
/* NetHack may be freely redistributed. See license for details. */
}
/* Know ordinary (non-magical) objects of a certain class,
- * like all gems except the loadstone and luckstone.
- */
+ like all gems except the loadstone and luckstone. */
static void
knows_class(char sym)
{
- register int ct;
- for (ct = 1; ct < NUM_OBJECTS; ct++)
+ struct obj odummy, *o;
+ int ct;
+
+ odummy = cg.zeroobj;
+ odummy.oclass = sym;
+ o = &odummy; /* for use in various obj.h macros */
+
+ /*
+ * Note: the exceptions here can be bypassed if necessary by
+ * calling knows_object() directly. So an elven ranger,
+ * for example, knows all elven weapons despite the bow,
+ * arrow, and spear limitation below.
+ */
+
+ for (ct = g.bases[(uchar) sym]; ct < g.bases[(uchar) sym + 1]; ct++) {
+ /* not flagged as magic but shouldn't be pre-discovered */
+ if (ct == CORNUTHAUM || ct == DUNCE_CAP)
+ continue;
+ if (sym == WEAPON_CLASS) {
+ odummy.otyp = ct; /* update 'o' */
+ /* arbitrary: only knights and samurai recognize polearms */
+ if ((!Role_if(PM_KNIGHT) && !Role_if(PM_SAMURAI)) && is_pole(o))
+ continue;
+ /* rangers know all launchers (bows, &c), ammo (arrows, &c),
+ and spears regardless of race/species, but not other weapons */
+ if (Role_if(PM_RANGER)
+ && (!is_launcher(o) && !is_ammo(o) && !is_spear(o)))
+ continue;
+ /* rogues know daggers, regardless of racial variations */
+ if (Role_if(PM_ROGUE) && (objects[o->otyp].oc_skill != P_DAGGER))
+ continue;
+ }
+
if (objects[ct].oc_class == sym && !objects[ct].oc_magic)
knows_object(ct);
+ }
}
void
ini_inv(Barbarian);
if (!rn2(6))
ini_inv(Lamp);
- knows_class(WEAPON_CLASS);
+ knows_class(WEAPON_CLASS); /* excluding polearms */
knows_class(ARMOR_CLASS);
skill_init(Skill_B);
break;
break;
case PM_KNIGHT:
ini_inv(Knight);
- knows_class(WEAPON_CLASS);
+ knows_class(WEAPON_CLASS); /* all weapons */
knows_class(ARMOR_CLASS);
/* give knights chess-like mobility--idea from wooledge@..cwru.edu */
HJumping |= FROMOUTSIDE;
Ranger[RAN_TWO_ARROWS].trquan = rn1(10, 50);
Ranger[RAN_ZERO_ARROWS].trquan = rn1(10, 30);
ini_inv(Ranger);
+ knows_class(WEAPON_CLASS); /* bows, arrows, spears only */
skill_init(Skill_Ran);
break;
case PM_ROGUE:
if (!rn2(5))
ini_inv(Blindfold);
knows_object(SACK);
+ knows_class(WEAPON_CLASS); /* daggers only */
skill_init(Skill_R);
break;
case PM_SAMURAI:
ini_inv(Samurai);
if (!rn2(5))
ini_inv(Blindfold);
- knows_class(WEAPON_CLASS);
+ knows_class(WEAPON_CLASS); /* all weapons */
knows_class(ARMOR_CLASS);
skill_init(Skill_S);
break;
ini_inv(Valkyrie);
if (!rn2(6))
ini_inv(Lamp);
- knows_class(WEAPON_CLASS);
+ knows_class(WEAPON_CLASS); /* excludes polearms */
knows_class(ARMOR_CLASS);
skill_init(Skill_V);
break;