mirror of
https://codeberg.org/noisytoot/notnotdnethack.git
synced 2025-05-03 22:05:09 +01:00
Sword and pistol offhand melee handling
Previously, hitting with a melee weapon main hand and a pistol offhand would result in bonking the target with the pistol. It now noticies this case, skips any offhand attacks, and prompts you for a shot from the offhand weapon after your melee attacks. This means you get to decide what direction to shoot AFTER seeing what effect your melee attacks had on the target.
This commit is contained in:
parent
938ea7a558
commit
af86292262
3 changed files with 30 additions and 3 deletions
|
@ -2462,6 +2462,7 @@ E boolean FDECL(mdofire, (struct monst *, struct monst *, int, int));
|
|||
E boolean FDECL(umetgaze, (struct monst *));
|
||||
E int NDECL(dothrow);
|
||||
E int NDECL(dofire);
|
||||
E int FDECL(uthrow, (struct obj *, struct obj *, int, boolean));
|
||||
E int FDECL(mthrow, (struct monst *, struct obj *, struct obj *, int, int, boolean));
|
||||
E void FDECL(return_ammo, (genericptr_t, long));
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ STATIC_DCL void FDECL(return_thrownobj, (struct monst *, struct obj *));
|
|||
STATIC_DCL void FDECL(toss_up, (struct obj *, boolean));
|
||||
STATIC_DCL int FDECL(calc_multishot, (struct monst *, struct obj *, struct obj *, int));
|
||||
STATIC_DCL int FDECL(calc_range, (struct monst *, struct obj *, struct obj *, int *));
|
||||
STATIC_DCL int FDECL(uthrow, (struct obj *, struct obj *, int, boolean));
|
||||
STATIC_DCL boolean FDECL(misthrow, (struct monst *, struct obj *, struct obj *, boolean, int *, int *, int *));
|
||||
STATIC_DCL struct obj * FDECL(blaster_ammo, (struct obj *));
|
||||
|
||||
|
@ -2671,8 +2670,14 @@ boolean forcedestroy;
|
|||
if (ammo->ostolen && u.sealsActive&SEAL_ANDROMALIUS) unbind(SEAL_ANDROMALIUS, TRUE);
|
||||
if (breaktest(ammo) && u.sealsActive&SEAL_ASTAROTH) unbind(SEAL_ASTAROTH, TRUE);
|
||||
if ((ammo->otyp == EGG) && u.sealsActive&SEAL_ECHIDNA) unbind(SEAL_ECHIDNA, TRUE);
|
||||
/* degrade engravings on this spot */
|
||||
u_wipe_engr(2);
|
||||
if(launcher && is_firearm(launcher)){
|
||||
/* degrade engravings on this spot (less) */
|
||||
u_wipe_engr(1);
|
||||
}
|
||||
else {
|
||||
/* degrade engravings on this spot */
|
||||
u_wipe_engr(2);
|
||||
}
|
||||
}
|
||||
|
||||
/* you touch the rubber chicken */
|
||||
|
@ -2725,6 +2730,10 @@ boolean forcedestroy;
|
|||
(multishot != 1 ? "s" : "")); /* (might be 1 if player gave shotlimit) */
|
||||
}
|
||||
}
|
||||
if(launcher && is_firearm(launcher)){
|
||||
/* bang! */
|
||||
wake_nearto_noisy(u.ux, u.uy, (multishot+1)*2);
|
||||
}
|
||||
|
||||
/* get range calculation */
|
||||
int range = calc_range(&youmonst, ammo, launcher, &hurtle_dist);
|
||||
|
|
17
src/xhity.c
17
src/xhity.c
|
@ -696,6 +696,14 @@ int tary;
|
|||
){
|
||||
continue; // not allowed, don't attack
|
||||
}
|
||||
/*4a: PC's ranged offhand */
|
||||
if(youagr && aatyp == AT_XWEP && (!uwep || !is_launcher(uwep))
|
||||
&& uswapwep && is_launcher(uswapwep)
|
||||
&& ((uquiver && ammo_and_launcher(uquiver, uswapwep)) || is_blaster(uswapwep))
|
||||
){
|
||||
//Handle after the end of the attack chain
|
||||
continue;
|
||||
}
|
||||
|
||||
/* get correct weapon */
|
||||
if (aatyp == AT_WEAP || aatyp == AT_DEVA) {
|
||||
|
@ -1275,6 +1283,15 @@ int tary;
|
|||
is_null_attk(attk) /* no more attacks */
|
||||
));
|
||||
|
||||
/*4b: PC's ranged offhand */
|
||||
if(youagr && u.twoweap && (!Upolyd || could_twoweap(youracedata)) && (!uwep || !is_launcher(uwep))
|
||||
&& uswapwep && is_launcher(uswapwep)
|
||||
&& ((uquiver && ammo_and_launcher(uquiver, uswapwep)) || is_blaster(uswapwep))
|
||||
){
|
||||
uthrow(uquiver, uswapwep, 0, FALSE);
|
||||
if(DEADMONSTER(mdef))
|
||||
allres |= MM_DEF_DIED;
|
||||
}
|
||||
/* make per-round counterattacks -- note that these cannot use otmp or attk, as those are per-attack */
|
||||
if (dopassive)
|
||||
allres = xpassivey(magr, mdef, (struct attack *)0, (struct obj *)0, vis, allres, pd, TRUE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue