Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7

This commit is contained in:
nhmall
2020-02-08 11:06:04 -05:00
3 changed files with 51 additions and 57 deletions

View File

@@ -562,6 +562,7 @@ E void FDECL(impact_drop, (struct obj *, XCHAR_P, XCHAR_P, XCHAR_P));
/* ### dothrow.c ### */
E int FDECL(multishot_class_bonus, (int, struct obj *, struct obj *));
E int NDECL(dothrow);
E int NDECL(dofire);
E void FDECL(endmultishot, (BOOLEAN_P));

View File

@@ -28,6 +28,52 @@ static NEARDATA const char bullets[] = { ALLOW_COUNT, COIN_CLASS, ALL_CLASSES,
/* g.thrownobj (decl.c) tracks an object until it lands */
int
multishot_class_bonus(pm, ammo, launcher)
int pm;
struct obj *ammo;
struct obj *launcher; /* can be NULL */
{
int multishot = 0;
schar skill = objects[ammo->otyp].oc_skill;
switch (pm) {
case PM_CAVEMAN:
/* give bonus for low-tech gear */
if (skill == -P_SLING || skill == P_SPEAR)
multishot++;
break;
case PM_MONK:
/* allow higher volley count despite skill limitation */
if (skill == -P_SHURIKEN)
multishot++;
break;
case PM_RANGER:
/* arbitrary; encourage use of other missiles beside daggers */
if (skill != P_DAGGER)
multishot++;
break;
case PM_ROGUE:
/* possibly should add knives... */
if (skill == P_DAGGER)
multishot++;
break;
case PM_NINJA:
if (skill == -P_SHURIKEN || skill == -P_DART)
multishot++;
/*FALLTHRU*/
case PM_SAMURAI:
/* role-specific launcher and its ammo */
if (ammo->otyp == YA && launcher && launcher->otyp == YUMI)
multishot++;
break;
default:
break; /* No bonus */
}
return multishot;
}
/* Throw the selected object, asking for direction */
static int
throw_obj(obj, shotlimit)
@@ -130,35 +176,8 @@ int shotlimit;
break;
}
/* ...or is using a special weapon for their role... */
switch (Role_switch) {
case PM_CAVEMAN:
/* give bonus for low-tech gear */
if (skill == -P_SLING || skill == P_SPEAR)
multishot++;
break;
case PM_MONK:
/* allow higher volley count despite skill limitation */
if (skill == -P_SHURIKEN)
multishot++;
break;
case PM_RANGER:
/* arbitrary; encourage use of other missiles beside daggers */
if (skill != P_DAGGER)
multishot++;
break;
case PM_ROGUE:
/* possibly should add knives... */
if (skill == P_DAGGER)
multishot++;
break;
case PM_SAMURAI:
/* role-specific launcher and its ammo */
if (obj->otyp == YA && uwep && uwep->otyp == YUMI)
multishot++;
break;
default:
break; /* No bonus */
}
multishot += multishot_class_bonus(Role_switch, obj, uwep);
/* ...or using their race's special bow; no bonus for spears */
if (!weakmultishot)
switch (Race_switch) {

View File

@@ -188,34 +188,8 @@ struct obj *otmp, *mwep;
multishot = (long) rnd((int) multishot);
/* class bonus */
switch (monsndx(mtmp->data)) {
case PM_CAVEMAN: /* give bonus for low-tech gear */
if (skill == -P_SLING || skill == P_SPEAR)
multishot++;
break;
case PM_MONK: /* allow higher volley count */
if (skill == -P_SHURIKEN)
multishot++;
break;
case PM_RANGER:
if (skill != P_DAGGER)
multishot++;
break;
case PM_ROGUE:
if (skill == P_DAGGER)
multishot++;
break;
case PM_NINJA:
if (skill == -P_SHURIKEN || skill == -P_DART)
multishot++;
/*FALLTHRU*/
case PM_SAMURAI:
if (otmp->otyp == YA && mwep->otyp == YUMI)
multishot++;
break;
default:
break;
}
multishot += multishot_class_bonus(monsndx(mtmp->data), otmp, mwep);
/* racial bonus */
if ((is_elf(mtmp->data) && otmp->otyp == ELVEN_ARROW
&& mwep->otyp == ELVEN_BOW)