Monsters can gain resistances by eating corpses

This is based on both the EvilHack implementation by
k21971 <keith.simpson1971@gmail.com>, and xNetHack
implementation by copperwater <aosdict@gmail.com>.
This commit is contained in:
Pasi Kallinen
2021-05-23 19:02:38 +03:00
parent 20cbadcf85
commit 8d2407f1f2
8 changed files with 149 additions and 50 deletions

View File

@@ -655,6 +655,7 @@ extern void morehungry(int);
extern void lesshungry(int);
extern boolean is_fainted(void);
extern void reset_faint(void);
extern int corpse_intrinsic(struct permonst *);
extern void violated_vegetarian(void);
extern void newuhs(boolean);
extern struct obj *floorfood(const char *, int);
@@ -665,6 +666,7 @@ extern void food_substitution(struct obj *, struct obj *);
extern void eating_conducts(struct permonst *);
extern int eat_brains(struct monst *, struct monst *, boolean, int *);
extern void fix_petrification(void);
extern boolean should_givit(int, struct permonst *);
extern void consume_oeaten(struct obj *, int);
extern boolean maybe_finished_meal(boolean);
extern void set_tin_variety(struct obj *, int);
@@ -1392,6 +1394,7 @@ extern int movemon(void);
extern int meatmetal(struct monst *);
extern int meatobj(struct monst *);
extern int meatcorpse(struct monst *);
extern void mon_givit(struct monst *, struct permonst *);
extern void mpickgold(struct monst *);
extern boolean mpickstuff(struct monst *, const char *);
extern int curr_mon_load(struct monst *);

View File

@@ -10,22 +10,24 @@
#define pm_resistance(ptr, typ) (((ptr)->mresists & (typ)) != 0)
#define mon_resistancebits(mon) \
((mon)->data->mresists | (mon)->mextrinsics | (mon)->mintrinsics)
#define resists_fire(mon) \
((((mon)->data->mresists | (mon)->mextrinsics) & MR_FIRE) != 0)
((mon_resistancebits(mon) & MR_FIRE) != 0)
#define resists_cold(mon) \
((((mon)->data->mresists | (mon)->mextrinsics) & MR_COLD) != 0)
((mon_resistancebits(mon) & MR_COLD) != 0)
#define resists_sleep(mon) \
((((mon)->data->mresists | (mon)->mextrinsics) & MR_SLEEP) != 0)
((mon_resistancebits(mon) & MR_SLEEP) != 0)
#define resists_disint(mon) \
((((mon)->data->mresists | (mon)->mextrinsics) & MR_DISINT) != 0)
((mon_resistancebits(mon) & MR_DISINT) != 0)
#define resists_elec(mon) \
((((mon)->data->mresists | (mon)->mextrinsics) & MR_ELEC) != 0)
((mon_resistancebits(mon) & MR_ELEC) != 0)
#define resists_poison(mon) \
((((mon)->data->mresists | (mon)->mextrinsics) & MR_POISON) != 0)
((mon_resistancebits(mon) & MR_POISON) != 0)
#define resists_acid(mon) \
((((mon)->data->mresists | (mon)->mextrinsics) & MR_ACID) != 0)
((mon_resistancebits(mon) & MR_ACID) != 0)
#define resists_ston(mon) \
((((mon)->data->mresists | (mon)->mextrinsics) & MR_STONE) != 0)
((mon_resistancebits(mon) & MR_STONE) != 0)
#define immune_poisongas(ptr) ((ptr) == &mons[PM_HEZROU])

View File

@@ -106,6 +106,7 @@ struct monst {
uchar m_ap_type; /* what mappearance is describing, m_ap_types */
schar mtame; /* level of tameness, implies peaceful */
unsigned short mintrinsics; /* low 8 correspond to mresists */
unsigned short mextrinsics; /* low 8 correspond to mresists */
unsigned long seen_resistance; /* M_SEEN_x; saw you resist an effect */
int mspec_used; /* monster's special ability attack timeout */

View File

@@ -17,7 +17,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files.
*/
#define EDITLEVEL 34
#define EDITLEVEL 35
/*
* Development status possibilities.