Better align drop_throw with hero ammo breakage

There is a comment above the function indicating that it should be
aligned with hero ammo breakage, but this wasn't the case.  One big
difference is that any monster-thrown or -shot object would be deleted
unconditionally if it hit another monster trapped in a pit.  I don't
know why that was in there, but it's not present in hero ammo breakage
chances, and it meant that a monster could sling the Mines luckstone at
the hero, hit a monster in the pit, and permanently lock the hero out of
getting the luckstone (as just happened to a player during the current
tournament).  This pulls the hero breakage rules out into their own
function and uses that for monster breakage as well, to make sure they
are aligned.  I also refactored drop_throw a bit to reduce the number of
separate variables tracking whether the object was deleted (was create,
objgone, and retvalu), and changed its (and ohitmon's) type to boolean.
This commit is contained in:
Michael Meyer
2023-11-09 23:31:35 -05:00
committed by PatR
parent ee0247ac5f
commit d42564bacd
3 changed files with 58 additions and 60 deletions

View File

@@ -667,6 +667,7 @@ extern boolean harmless_missile(struct obj *);
extern boolean throwing_weapon(struct obj *);
extern void throwit(struct obj *, long, boolean, struct obj *);
extern int omon_adj(struct monst *, struct obj *, boolean);
extern boolean should_mulch_missile(struct obj *);
extern int thitmonst(struct monst *, struct obj *);
extern int hero_breaks(struct obj *, coordxy, coordxy, unsigned);
extern int breaks(struct obj *, coordxy, coordxy);
@@ -1824,7 +1825,7 @@ extern void Delay(int);
extern const char *rnd_hallublast(void);
extern boolean m_has_launcher_and_ammo(struct monst *);
extern int thitu(int, int, struct obj **, const char *);
extern int ohitmon(struct monst *, struct obj *, int, boolean);
extern boolean ohitmon(struct monst *, struct obj *, int, boolean);
extern void thrwmu(struct monst *);
extern int spitmu(struct monst *, struct attack *);
extern int breamu(struct monst *, struct attack *);