Autoquiver fix
Implement a patch which <Someone> posted on the newsgroup back in September: "If I had my druthers, daggers would be chosen over other weapons if there's no missiles or suitable ammo available, and weapons not designed for throwing wouldn't be chosen at all."
This commit is contained in:
+32
-28
@@ -216,49 +216,53 @@ autoquiver()
|
|||||||
register struct obj *otmp, *oammo = 0, *omissile = 0, *omisc = 0;
|
register struct obj *otmp, *oammo = 0, *omissile = 0, *omisc = 0;
|
||||||
|
|
||||||
if (uquiver)
|
if (uquiver)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Scan through the inventory */
|
/* Scan through the inventory */
|
||||||
for (otmp = invent; otmp; otmp = otmp->nobj) {
|
for (otmp = invent; otmp; otmp = otmp->nobj) {
|
||||||
if (otmp->owornmask || otmp->oartifact || !otmp->dknown) {
|
if (otmp->owornmask || otmp->oartifact || !otmp->dknown) {
|
||||||
; /* Skip it */
|
; /* Skip it */
|
||||||
} else if (otmp->otyp == ROCK ||
|
} else if (otmp->otyp == ROCK ||
|
||||||
/* seen rocks or known flint or known glass */
|
/* seen rocks or known flint or known glass */
|
||||||
(objects[otmp->otyp].oc_name_known &&
|
(objects[otmp->otyp].oc_name_known &&
|
||||||
otmp->otyp == FLINT) ||
|
otmp->otyp == FLINT) ||
|
||||||
(objects[otmp->otyp].oc_name_known &&
|
(objects[otmp->otyp].oc_name_known &&
|
||||||
otmp->oclass == GEM_CLASS &&
|
otmp->oclass == GEM_CLASS &&
|
||||||
objects[otmp->otyp].oc_material == GLASS)) {
|
objects[otmp->otyp].oc_material == GLASS)) {
|
||||||
if (uslinging())
|
if (uslinging())
|
||||||
oammo = otmp;
|
oammo = otmp;
|
||||||
else if (!omisc)
|
else if (!omisc)
|
||||||
omisc = otmp;
|
omisc = otmp;
|
||||||
} else if (otmp->oclass == GEM_CLASS) {
|
} else if (otmp->oclass == GEM_CLASS) {
|
||||||
; /* skip non-rock gems--they're ammo but
|
; /* skip non-rock gems--they're ammo but
|
||||||
player has to select them explicitly */
|
player has to select them explicitly */
|
||||||
} else if (is_ammo(otmp)) {
|
} else if (is_ammo(otmp)) {
|
||||||
if (ammo_and_launcher(otmp, uwep))
|
if (ammo_and_launcher(otmp, uwep))
|
||||||
/* Ammo matched with launcher (bow and arrow, crossbow and bolt) */
|
/* Ammo matched with launcher (bow and arrow, crossbow and bolt) */
|
||||||
oammo = otmp;
|
oammo = otmp;
|
||||||
else
|
else
|
||||||
/* Mismatched ammo (no better than an ordinary weapon) */
|
/* Mismatched ammo (no better than an ordinary weapon) */
|
||||||
omisc = otmp;
|
omisc = otmp;
|
||||||
} else if (is_missile(otmp)) {
|
} else if (is_missile(otmp)) {
|
||||||
/* Missile (dart, shuriken, etc.) */
|
/* Missile (dart, shuriken, etc.) */
|
||||||
omissile = otmp;
|
omissile = otmp;
|
||||||
} else if (otmp->oclass == WEAPON_CLASS && !is_launcher(otmp)) {
|
} else if (otmp->oclass == WEAPON_CLASS && throwing_weapon(otmp)) {
|
||||||
/* Ordinary weapon */
|
/* Ordinary weapon */
|
||||||
omisc = otmp;
|
if (objects[otmp->otyp].oc_skill == P_DAGGER
|
||||||
}
|
&& !omissile)
|
||||||
|
omissile = otmp;
|
||||||
|
else
|
||||||
|
omisc = otmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pick the best choice */
|
/* Pick the best choice */
|
||||||
if (oammo)
|
if (oammo)
|
||||||
setuqwep(oammo);
|
setuqwep(oammo);
|
||||||
else if (omissile)
|
else if (omissile)
|
||||||
setuqwep(omissile);
|
setuqwep(omissile);
|
||||||
else if (omisc)
|
else if (omisc)
|
||||||
setuqwep(omisc);
|
setuqwep(omisc);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user