testing for Vlad

Redo the check for whether a monster is Vlad when deciding whether to
keep it out of a bones file.  Use the new check in find_defensive()
where Vlad won't waste a turn attempting to use a wand of digging when
in his undiggable own tower.  (Failing to check for vampshifted Vlad
in the latter case wasn't actually a bug because if/when shifted,
he's unable to use items so couldn't attempt to use wand of digging.
Switch to the new check anyway.)
This commit is contained in:
PatR
2023-06-09 16:09:26 -07:00
parent e475dca209
commit 9079250cfc
3 changed files with 17 additions and 15 deletions
+14 -10
View File
@@ -205,25 +205,29 @@ struct monst {
#define MON_WEP(mon) ((mon)->mw) #define MON_WEP(mon) ((mon)->mw)
#define MON_NOWEP(mon) ((mon)->mw = (struct obj *) 0) #define MON_NOWEP(mon) ((mon)->mw = (struct obj *) 0)
/* dead monsters stay on the fmon list until dmonsfree() at end of turn */
#define DEADMONSTER(mon) ((mon)->mhp < 1) #define DEADMONSTER(mon) ((mon)->mhp < 1)
#define is_starting_pet(mon) ((mon)->m_id == gc.context.startingpet_mid) #define is_starting_pet(mon) ((mon)->m_id == gc.context.startingpet_mid)
#define is_vampshifter(mon) \ #define is_vampshifter(mon) \
((mon)->cham == PM_VAMPIRE || (mon)->cham == PM_VAMPIRE_LEADER \ ((mon)->cham == PM_VAMPIRE || (mon)->cham == PM_VAMPIRE_LEADER \
|| (mon)->cham == PM_VLAD_THE_IMPALER) || (mon)->cham == PM_VLAD_THE_IMPALER)
#define vampshifted(mon) (is_vampshifter((mon)) && !is_vampire((mon)->data)) #define vampshifted(mon) (is_vampshifter((mon)) && !is_vampire((mon)->data))
/* Vlad might be vampshifted so just checking monst->data is insufficient */
#define is_Vlad(m) ((m)->data == &mons[PM_VLAD_THE_IMPALER] \
|| (m)->cham == PM_VLAD_THE_IMPALER)
/* monsters which cannot be displaced: priests, shopkeepers, vault guards, /* monsters which cannot be displaced: temple priests, shopkeepers,
Oracle, quest leader */ vault guards, the Oracle, quest leader */
#define mundisplaceable(mon) ((mon)->ispriest \ #define mundisplaceable(mon) \
|| (mon)->isshk \ ((mon)->ispriest || (mon)->isshk \
|| (mon)->isgd \ || (mon)->isgd || (mon)->data == &mons[PM_ORACLE] \
|| (mon)->data == &mons[PM_ORACLE] \ || (mon)->m_id == gq.quest_status.leader_m_id)
|| (mon)->m_id == gq.quest_status.leader_m_id)
/* mimic appearances that block vision/light */ /* mimic appearances that block vision/light */
#define is_lightblocker_mappear(mon) \ #define is_lightblocker_mappear(mon) \
(is_obj_mappear(mon, BOULDER) \ (is_obj_mappear(mon, BOULDER) \
|| (M_AP_TYPE(mon) == M_AP_FURNITURE \ || (M_AP_TYPE(mon) == M_AP_FURNITURE \
&& ((mon)->mappearance == S_hcdoor \ && ((mon)->mappearance == S_hcdoor \
|| (mon)->mappearance == S_vcdoor \ || (mon)->mappearance == S_vcdoor \
|| (mon)->mappearance < S_ndoor /* = walls */ \ || (mon)->mappearance < S_ndoor /* = walls */ \
+2 -3
View File
@@ -381,7 +381,7 @@ can_make_bones(void)
return TRUE; return TRUE;
} }
/* monster removed before saving a bones file, /* monster might need to be removed before saving a bones file,
in case these characters are not in their home bases */ in case these characters are not in their home bases */
static void static void
remove_mon_from_bones(struct monst *mtmp) remove_mon_from_bones(struct monst *mtmp)
@@ -390,8 +390,7 @@ remove_mon_from_bones(struct monst *mtmp)
if (mtmp->iswiz || mptr == &mons[PM_MEDUSA] if (mtmp->iswiz || mptr == &mons[PM_MEDUSA]
|| mptr->msound == MS_NEMESIS || mptr->msound == MS_LEADER || mptr->msound == MS_NEMESIS || mptr->msound == MS_LEADER
|| mptr == &mons[PM_VLAD_THE_IMPALER] || is_Vlad(mtmp) /* mptr == &mons[VLAD_THE_IMPALER] || cham == VLAD */
|| mtmp->cham == PM_VLAD_THE_IMPALER /* in case he's vampshifted */
|| (mptr == &mons[PM_ORACLE] && !fixuporacle(mtmp))) || (mptr == &mons[PM_ORACLE] && !fixuporacle(mtmp)))
mongone(mtmp); mongone(mtmp);
} }
+1 -2
View File
@@ -621,8 +621,7 @@ find_defensive(struct monst *mtmp, boolean tryescape)
&& !(levl[x][y].wall_info & W_NONDIGGABLE) && !(levl[x][y].wall_info & W_NONDIGGABLE)
&& !(Is_botlevel(&u.uz) || In_endgame(&u.uz)) && !(Is_botlevel(&u.uz) || In_endgame(&u.uz))
&& !(is_ice(x, y) || is_pool(x, y) || is_lava(x, y)) && !(is_ice(x, y) || is_pool(x, y) || is_lava(x, y))
&& !(mtmp->data == &mons[PM_VLAD_THE_IMPALER] && !(is_Vlad(mtmp) && In_V_tower(&u.uz))) {
&& In_V_tower(&u.uz))) {
gm.m.defensive = obj; gm.m.defensive = obj;
gm.m.has_defense = MUSE_WAN_DIGGING; gm.m.has_defense = MUSE_WAN_DIGGING;
} }