diff options
author | Bardur Arantsson <bardur@scientician.net> | 2016-06-20 22:49:05 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2016-06-20 22:49:05 +0200 |
commit | 68e2a10b2d76cb3a2f5aa6818b4b184b6a02ef14 (patch) | |
tree | ec51a0b9156c6a28fa2764441ca66db36441604b | |
parent | fc41a7d28d8896da79963d23ed1afba408e27470 (diff) |
Rework RF{1,2,3,7,8,9}_* monster flags to use flag_set<>
44 files changed, 1226 insertions, 1637 deletions
diff --git a/src/birth.cc b/src/birth.cc index fb0c2a0d..188d9892 100644 --- a/src/birth.cc +++ b/src/birth.cc @@ -27,6 +27,7 @@ #include "modules.hpp" #include "monster2.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "notes.hpp" #include "object1.hpp" #include "object2.hpp" @@ -804,8 +805,8 @@ static void player_wipe(void) r_ptr->max_num = 100; /* Hack -- Reset the max counter */ - if (r_ptr->flags1 & RF1_UNIQUE) r_ptr->max_num = 1; - if (r_ptr->flags3 & RF3_UNIQUE_4) r_ptr->max_num = 4; + if (r_ptr->flags & RF_UNIQUE) r_ptr->max_num = 1; + if (r_ptr->flags & RF_UNIQUE_4) r_ptr->max_num = 4; /* Clear player kills */ r_ptr->r_pkills = 0; diff --git a/src/cave.cc b/src/cave.cc index b9ef80db..48aa7740 100644 --- a/src/cave.cc +++ b/src/cave.cc @@ -6,6 +6,7 @@ #include "hook_enter_dungeon_in.hpp" #include "monster2.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_spell_flag.hpp" #include "monster_type.hpp" #include "object1.hpp" @@ -1111,7 +1112,7 @@ static void map_info(int y, int x, byte *ap, char *cp) monster_type *m_ptr = &m_list[c_ptr->m_idx]; auto const r_ptr = m_ptr->race(); - if (r_ptr->flags9 & RF9_MIMIC) + if (r_ptr->flags & RF_MIMIC) { /* Acquire object being mimicked */ object_type *o_ptr = &o_list[m_ptr->mimic_o_idx()]; @@ -1155,10 +1156,10 @@ static void map_info(int y, int x, byte *ap, char *cp) } /* Multi-hued monster */ - else if (r_ptr->flags1 & RF1_ATTR_MULTI) + else if (r_ptr->flags & RF_ATTR_MULTI) { /* Is it a shapechanger? */ - if (r_ptr->flags2 & RF2_SHAPECHANGER) + if (r_ptr->flags & RF_SHAPECHANGER) { image_random(ap, cp); } @@ -1166,7 +1167,7 @@ static void map_info(int y, int x, byte *ap, char *cp) *cp = c; /* Multi-hued attr */ - if (r_ptr->flags2 & RF2_ATTR_ANY) + if (r_ptr->flags & RF_ATTR_ANY) { *ap = randint(15); } @@ -1177,7 +1178,7 @@ static void map_info(int y, int x, byte *ap, char *cp) } /* Normal monster (not "clear" in any way) */ - else if (!(r_ptr->flags1 & (RF1_ATTR_CLEAR | RF1_CHAR_CLEAR))) + else if (!(r_ptr->flags & (RF_ATTR_CLEAR | RF_CHAR_CLEAR))) { /* Use char */ *cp = c; @@ -1203,14 +1204,14 @@ static void map_info(int y, int x, byte *ap, char *cp) else { /* Normal (non-clear char) monster */ - if (!(r_ptr->flags1 & RF1_CHAR_CLEAR)) + if (!(r_ptr->flags & RF_CHAR_CLEAR)) { /* Normal char */ *cp = c; } /* Normal (non-clear attr) monster */ - else if (!(r_ptr->flags1 & RF1_ATTR_CLEAR)) + else if (!(r_ptr->flags & RF_ATTR_CLEAR)) { /* Normal attr */ *ap = a; @@ -1234,7 +1235,7 @@ static void map_info(int y, int x, byte *ap, char *cp) monster_race *r_ptr = &r_info[p_ptr->body_monster]; /* Get the "player" attr */ - if (!avoid_other && (r_ptr->flags1 & RF1_ATTR_MULTI)) + if (!avoid_other && (r_ptr->flags & RF_ATTR_MULTI)) { a = get_shimmer_color(); } @@ -1541,7 +1542,7 @@ void map_info_default(int y, int x, byte *ap, char *cp) monster_type *m_ptr = &m_list[c_ptr->m_idx]; auto const r_ptr = m_ptr->race(); - if (r_ptr->flags9 & RF9_MIMIC) + if (r_ptr->flags & RF_MIMIC) { /* Acquire object being mimicked */ object_type *o_ptr = &o_list[m_ptr->mimic_o_idx()]; @@ -1585,10 +1586,10 @@ void map_info_default(int y, int x, byte *ap, char *cp) } /* Multi-hued monster */ - else if (r_ptr->flags1 & RF1_ATTR_MULTI) + else if (r_ptr->flags & RF_ATTR_MULTI) { /* Is it a shapechanger? */ - if (r_ptr->flags2 & RF2_SHAPECHANGER) + if (r_ptr->flags & RF_SHAPECHANGER) { image_random(ap, cp); } @@ -1596,7 +1597,7 @@ void map_info_default(int y, int x, byte *ap, char *cp) *cp = c; /* Multi-hued attr */ - if (r_ptr->flags2 & RF2_ATTR_ANY) + if (r_ptr->flags & RF_ATTR_ANY) { *ap = randint(15); } @@ -1607,7 +1608,7 @@ void map_info_default(int y, int x, byte *ap, char *cp) } /* Normal monster (not "clear" in any way) */ - else if (!(r_ptr->flags1 & (RF1_ATTR_CLEAR | RF1_CHAR_CLEAR))) + else if (!(r_ptr->flags & (RF_ATTR_CLEAR | RF_CHAR_CLEAR))) { /* Use char */ *cp = c; @@ -1630,14 +1631,14 @@ void map_info_default(int y, int x, byte *ap, char *cp) else { /* Normal (non-clear char) monster */ - if (!(r_ptr->flags1 & RF1_CHAR_CLEAR)) + if (!(r_ptr->flags & RF_CHAR_CLEAR)) { /* Normal char */ *cp = c; } /* Normal (non-clear attr) monster */ - else if (!(r_ptr->flags1 & RF1_ATTR_CLEAR)) + else if (!(r_ptr->flags & RF_ATTR_CLEAR)) { /* Normal attr */ *ap = a; @@ -1663,7 +1664,7 @@ void map_info_default(int y, int x, byte *ap, char *cp) monster_race *r_ptr = &r_info[p_ptr->body_monster]; /* Get the "player" attr */ - if (!avoid_other && (r_ptr->flags1 & RF1_ATTR_MULTI)) + if (!avoid_other && (r_ptr->flags & RF_ATTR_MULTI)) { a = get_shimmer_color(); } @@ -1788,7 +1789,7 @@ void note_spot(int y, int x) monster_type *m_ptr = &m_list[c_ptr->m_idx]; auto r_ptr = m_ptr->race(); - if (r_ptr->flags9 & RF9_MIMIC) + if (r_ptr->flags & RF_MIMIC) { object_type *o_ptr = &o_list[m_ptr->mimic_o_idx()]; o_ptr->marked = TRUE; @@ -3533,7 +3534,7 @@ void forget_mon_lite(void) * This function works within the current player's field of view * calculated by update_view(), so it should normally be called * whenever FoV is updated (== PU_VIEW | PU_MON_LITE). The other - * case is when RF9_HAS_LITE monsters have moved or dead. Monster + * case is when RF_HAS_LITE monsters have moved or dead. Monster * creation occurs out of LoS, so I chose not to take this into * consideration. * @@ -3639,7 +3640,7 @@ void update_mon_lite(void) auto r_ptr = m_ptr->race(); /* Skip monsters not carrying light source */ - if (!(r_ptr->flags9 & RF9_HAS_LITE)) continue; + if (!(r_ptr->flags & RF_HAS_LITE)) continue; /* Access the location */ fy = m_ptr->fy; @@ -4025,7 +4026,7 @@ void wiz_lite(void) monster_type *m_ptr = &m_list[c_ptr->m_idx]; auto const r_ptr = m_ptr->race(); - if (r_ptr->flags9 & RF9_MIMIC) + if (r_ptr->flags & RF_MIMIC) { object_type *o_ptr = &o_list[m_ptr->mimic_o_idx()]; o_ptr->marked = TRUE; diff --git a/src/cmd1.cc b/src/cmd1.cc index dddcbcef..cff05246 100644 --- a/src/cmd1.cc +++ b/src/cmd1.cc @@ -25,6 +25,7 @@ #include "monster2.hpp" #include "monster3.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_spell_flag.hpp" #include "monster_type.hpp" #include "object1.hpp" @@ -260,68 +261,68 @@ s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, case TV_DIGGING: { /* Slay Animal */ - if ((f1 & (TR1_SLAY_ANIMAL)) && (r_ptr->flags3 & RF3_ANIMAL)) + if ((f1 & (TR1_SLAY_ANIMAL)) && (r_ptr->flags & RF_ANIMAL)) { if (mult < 2) mult = 2; } /* Slay Evil */ - if ((f1 & (TR1_SLAY_EVIL)) && (r_ptr->flags3 & RF3_EVIL)) + if ((f1 & (TR1_SLAY_EVIL)) && (r_ptr->flags & RF_EVIL)) { if (mult < 2) mult = 2; } /* Slay Undead */ - if ((f1 & (TR1_SLAY_UNDEAD)) && (r_ptr->flags3 & RF3_UNDEAD)) + if ((f1 & (TR1_SLAY_UNDEAD)) && (r_ptr->flags & RF_UNDEAD)) { if (mult < 3) mult = 3; } /* Slay Demon */ - if ((f1 & (TR1_SLAY_DEMON)) && (r_ptr->flags3 & RF3_DEMON)) + if ((f1 & (TR1_SLAY_DEMON)) && (r_ptr->flags & RF_DEMON)) { if (mult < 3) mult = 3; } /* Slay Orc */ - if ((f1 & (TR1_SLAY_ORC)) && (r_ptr->flags3 & RF3_ORC)) + if ((f1 & (TR1_SLAY_ORC)) && (r_ptr->flags & RF_ORC)) { if (mult < 3) mult = 3; } /* Slay Troll */ - if ((f1 & (TR1_SLAY_TROLL)) && (r_ptr->flags3 & RF3_TROLL)) + if ((f1 & (TR1_SLAY_TROLL)) && (r_ptr->flags & RF_TROLL)) { if (mult < 3) mult = 3; } /* Slay Giant */ - if ((f1 & (TR1_SLAY_GIANT)) && (r_ptr->flags3 & RF3_GIANT)) + if ((f1 & (TR1_SLAY_GIANT)) && (r_ptr->flags & RF_GIANT)) { if (mult < 3) mult = 3; } /* Slay Dragon */ - if ((f1 & (TR1_SLAY_DRAGON)) && (r_ptr->flags3 & RF3_DRAGON)) + if ((f1 & (TR1_SLAY_DRAGON)) && (r_ptr->flags & RF_DRAGON)) { if (mult < 3) mult = 3; } /* Execute Dragon */ - if ((f1 & (TR1_KILL_DRAGON)) && (r_ptr->flags3 & RF3_DRAGON)) + if ((f1 & (TR1_KILL_DRAGON)) && (r_ptr->flags & RF_DRAGON)) { if (mult < 5) mult = 5; } /* Execute Undead */ - if ((f5 & (TR5_KILL_UNDEAD)) && (r_ptr->flags3 & RF3_UNDEAD)) + if ((f5 & (TR5_KILL_UNDEAD)) && (r_ptr->flags & RF_UNDEAD)) { if (mult < 5) mult = 5; } /* Execute Demon */ - if ((f5 & (TR5_KILL_DEMON)) && (r_ptr->flags3 & RF3_DEMON)) + if ((f5 & (TR5_KILL_DEMON)) && (r_ptr->flags & RF_DEMON)) { if (mult < 5) mult = 5; } @@ -330,11 +331,11 @@ s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, /* Brand (Acid) */ if (f1 & (TR1_BRAND_ACID)) { - if (r_ptr->flags3 & RF3_IM_ACID) + if (r_ptr->flags & RF_IM_ACID) { // No additional multiplier } - else if (r_ptr->flags9 & RF9_SUSCEP_ACID) + else if (r_ptr->flags & RF_SUSCEP_ACID) { if (mult < 6) mult = 6; } @@ -347,11 +348,11 @@ s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, /* Brand (Elec) */ if (f1 & (TR1_BRAND_ELEC)) { - if (r_ptr->flags3 & RF3_IM_ELEC) + if (r_ptr->flags & RF_IM_ELEC) { // No additional multiplier } - else if (r_ptr->flags9 & RF9_SUSCEP_ELEC) + else if (r_ptr->flags & RF_SUSCEP_ELEC) { if (mult < 6) mult = 6; } @@ -364,11 +365,11 @@ s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, /* Brand (Fire) */ if (f1 & (TR1_BRAND_FIRE)) { - if (r_ptr->flags3 & RF3_IM_FIRE) + if (r_ptr->flags & RF_IM_FIRE) { // No additional multiplier } - else if (r_ptr->flags3 & RF3_SUSCEP_FIRE) + else if (r_ptr->flags & RF_SUSCEP_FIRE) { if (mult < 6) mult = 6; } @@ -381,11 +382,11 @@ s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, /* Brand (Cold) */ if (f1 & (TR1_BRAND_COLD)) { - if (r_ptr->flags3 & RF3_IM_COLD) + if (r_ptr->flags & RF_IM_COLD) { // No additional multiplier } - else if (r_ptr->flags3 & RF3_SUSCEP_COLD) + else if (r_ptr->flags & RF_SUSCEP_COLD) { if (mult < 6) mult = 6; } @@ -398,11 +399,11 @@ s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, /* Brand (Poison) */ if (f1 & (TR1_BRAND_POIS) || (p_ptr->tim_poison)) { - if (r_ptr->flags3 & RF3_IM_POIS) + if (r_ptr->flags & RF_IM_POIS) { // No additional damage } - else if (r_ptr->flags9 & RF9_SUSCEP_POIS) + else if (r_ptr->flags & RF_SUSCEP_POIS) { if (mult < 6) mult = 6; if (magik(95)) *special |= SPEC_POIS; @@ -417,7 +418,7 @@ s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, /* Wounding */ if (f5 & (TR5_WOUNDING)) { - if (r_ptr->flags8 & RF8_NO_CUT) + if (r_ptr->flags & RF_NO_CUT) { // No additional damage } @@ -565,7 +566,7 @@ void touch_zap_player(monster_type *m_ptr) { auto r_ptr = m_ptr->race(); - if (r_ptr->flags2 & RF2_AURA_FIRE) + if (r_ptr->flags & RF_AURA_FIRE) { if (!(p_ptr->immune_fire)) { @@ -589,7 +590,7 @@ void touch_zap_player(monster_type *m_ptr) } - if (r_ptr->flags2 & RF2_AURA_ELEC) + if (r_ptr->flags & RF_AURA_ELEC) { if (!(p_ptr->immune_elec)) { @@ -649,7 +650,7 @@ static void carried_monster_attack(s16b m_idx, bool_ *fear, bool_ *mdeath, r_ptr = &r_info[o_ptr->pval]; /* Not allowed to attack */ - if (r_ptr->flags1 & RF1_NEVER_BLOW) return; + if (r_ptr->flags & RF_NEVER_BLOW) return; /* Total armor */ ac = t_ptr->ac; @@ -1036,8 +1037,8 @@ static void carried_monster_attack(s16b m_idx, bool_ *fear, bool_ *mdeath, { auto tr_ptr = t_ptr->race(); /* Aura fire */ - if ((tr_ptr->flags2 & RF2_AURA_FIRE) && - !(r_ptr->flags3 & RF3_IM_FIRE)) + if ((tr_ptr->flags & RF_AURA_FIRE) && + !(r_ptr->flags & RF_IM_FIRE)) { if (t_ptr->ml) { @@ -1051,8 +1052,8 @@ static void carried_monster_attack(s16b m_idx, bool_ *fear, bool_ *mdeath, } /* Aura elec */ - if ((tr_ptr->flags2 & RF2_AURA_ELEC) && - !(r_ptr->flags3 & RF3_IM_ELEC)) + if ((tr_ptr->flags & RF_AURA_ELEC) && + !(r_ptr->flags & RF_IM_ELEC)) { if (t_ptr->ml) { @@ -1138,7 +1139,7 @@ static void incarnate_monster_attack(s16b m_idx, bool_ *fear, bool_ *mdeath, auto r_ptr = &r_info[p_ptr->body_monster]; /* Not allowed to attack */ - if (r_ptr->flags1 & RF1_NEVER_BLOW) return; + if (r_ptr->flags & RF_NEVER_BLOW) return; /* Total armor */ ac = t_ptr->ac; @@ -1524,8 +1525,8 @@ static void incarnate_monster_attack(s16b m_idx, bool_ *fear, bool_ *mdeath, if (touched) { /* Aura fire */ - if ((tr_ptr->flags2 & RF2_AURA_FIRE) && - !(r_ptr->flags3 & RF3_IM_FIRE)) + if ((tr_ptr->flags & RF_AURA_FIRE) && + !(r_ptr->flags & RF_IM_FIRE)) { if (t_ptr->ml) { @@ -1539,8 +1540,8 @@ static void incarnate_monster_attack(s16b m_idx, bool_ *fear, bool_ *mdeath, } /* Aura elec */ - if ((tr_ptr->flags2 & RF2_AURA_ELEC) && - !(r_ptr->flags3 & RF3_IM_ELEC)) + if ((tr_ptr->flags & RF_AURA_ELEC) && + !(r_ptr->flags & RF_IM_ELEC)) { if (t_ptr->ml) { @@ -1661,7 +1662,7 @@ void attack_special(monster_type *m_ptr, s32b special, int dam) /* Special - Cut monster */ if (special & SPEC_CUT) { - if (r_ptr->flags8 & RF8_NO_CUT) + if (r_ptr->flags & RF_NO_CUT) { // No damage } @@ -1683,11 +1684,11 @@ void attack_special(monster_type *m_ptr, s32b special, int dam) /* Special - Poison monster */ if (special & SPEC_POIS) { - if (r_ptr->flags3 & RF3_IM_POIS) + if (r_ptr->flags & RF_IM_POIS) { // No damage } - else if (r_ptr->flags9 & RF9_SUSCEP_POIS) + else if (r_ptr->flags & RF_SUSCEP_POIS) { if (m_ptr->poisoned) { @@ -1747,11 +1748,11 @@ static void py_attack_hand(int *k, monster_type *m_ptr, s32b *special) /* Extract monster name (or "it") */ auto const r_ptr = m_ptr->race(); - if (r_ptr->flags1 & RF1_UNIQUE) resist_stun += 88; - if (r_ptr->flags3 & RF3_NO_CONF) resist_stun += 44; - if (r_ptr->flags3 & RF3_NO_SLEEP) resist_stun += 44; - if ((r_ptr->flags3 & RF3_UNDEAD) || - (r_ptr->flags3 & RF3_NONLIVING)) resist_stun += 88; + if (r_ptr->flags & RF_UNIQUE) resist_stun += 88; + if (r_ptr->flags & RF_NO_CONF) resist_stun += 44; + if (r_ptr->flags & RF_NO_SLEEP) resist_stun += 44; + if ((r_ptr->flags & RF_UNDEAD) || + (r_ptr->flags & RF_NONLIVING)) resist_stun += 88; if (plev) { @@ -1790,7 +1791,7 @@ static void py_attack_hand(int *k, monster_type *m_ptr, s32b *special) /* Describe attack */ if (ma_ptr->effect & MA_KNEE) { - if (r_ptr->flags1 & RF1_MALE) + if (r_ptr->flags & RF_MALE) { if (!desc) msg_format("You hit %s in the groin with your knee!", m_name); @@ -1811,7 +1812,7 @@ static void py_attack_hand(int *k, monster_type *m_ptr, s32b *special) if (ma_ptr->effect & MA_SLOW) { if (! - ((r_ptr->flags1 & RF1_NEVER_MOVE) || + ((r_ptr->flags & RF_NEVER_MOVE) || strchr("UjmeEv$,DdsbBFIJQSXclnw!=?", r_ptr->d_char))) { if (!desc) msg_format("You kick %s in the ankle.", m_name); @@ -1853,7 +1854,7 @@ static void py_attack_hand(int *k, monster_type *m_ptr, s32b *special) if (((special_effect & MA_FULL_SLOW) || (special_effect & MA_SLOW)) && ((*k + p_ptr->to_d) < m_ptr->hp)) { - if (!(r_ptr->flags1 & RF1_UNIQUE) && + if (!(r_ptr->flags & RF_UNIQUE) && (randint(plev) > m_ptr->level) && m_ptr->mspeed > 60) { msg_format("%^s starts limping slower.", m_name); @@ -1899,7 +1900,7 @@ static void do_nazgul(int *k, int *num, int num_blow, int weap, std::shared_ptr< allow_shatter = FALSE; /* Mega Hack -- Hitting Nazgul is REALY dangerous (ideas from Akhronath) */ - if (r_ptr->flags7 & RF7_NAZGUL) + if (r_ptr->flags & RF_NAZGUL) { if ((!o_ptr->name2) && (!artifact_p(o_ptr)) && allow_shatter) { @@ -2014,7 +2015,7 @@ void py_attack(int y, int x, int max_blow) /* Disturb the player */ disturb(0); - if (r_info[p_ptr->body_monster].flags1 & RF1_NEVER_BLOW) + if (r_info[p_ptr->body_monster].flags & RF_NEVER_BLOW) { msg_print("You cannot attack in this form!"); return; @@ -2183,8 +2184,8 @@ void py_attack(int y, int x, int max_blow) if ((f1 & TR1_VAMPIRIC) || (chaos_effect == 1)) { if (! - ((r_ptr->flags3 & RF3_UNDEAD) || - (r_ptr->flags3 & RF3_NONLIVING))) + ((r_ptr->flags & RF_UNDEAD) || + (r_ptr->flags & RF_NONLIVING))) drain_result = m_ptr->hp; else drain_result = 0; @@ -2450,7 +2451,7 @@ void py_attack(int y, int x, int max_blow) } /* Confuse the monster */ - if (r_ptr->flags3 & RF3_NO_CONF) + if (r_ptr->flags & RF_NO_CONF) { msg_format("%^s is unaffected.", m_name); } @@ -2476,7 +2477,7 @@ void py_attack(int y, int x, int max_blow) else if ((chaos_effect == 5) && cave_floor_bold(y, x) && (randint(90) > m_ptr->level)) { - if (!((r_ptr->flags1 & RF1_UNIQUE) || + if (!((r_ptr->flags & RF_UNIQUE) || (r_ptr->spells & SF_BR_CHAO) || (m_ptr->mflag & MFLAG_QUEST))) { @@ -2621,7 +2622,7 @@ bool_ player_can_enter(byte feature) else if (f_info[feature].flags1 & FF1_NO_WALK) return (FALSE); else if ((f_info[feature].flags1 & FF1_WEB) && - ((!(r_info[p_ptr->body_monster].flags7 & RF7_SPIDER)) && (p_ptr->mimic_form != resolve_mimic_name("Spider")))) + ((!(r_info[p_ptr->body_monster].flags & RF_SPIDER)) && (p_ptr->mimic_form != resolve_mimic_name("Spider")))) return (FALSE); return (TRUE); @@ -2647,7 +2648,7 @@ static bool_ easy_open_door(int y, int x) monster_race *r_ptr = &r_info[p_ptr->body_monster]; - if ((p_ptr->body_monster != 0) && !(r_ptr->flags2 & RF2_OPEN_DOOR)) + if ((p_ptr->body_monster != 0) && !(r_ptr->flags & RF_OPEN_DOOR)) { msg_print("You cannot open doors."); @@ -2771,21 +2772,21 @@ void move_player_aux(int dir, int do_pickup, int run, bool_ disarm) /* Hack - random movement */ if (p_ptr->disembodied) tmp = dir; - else if ((r_ptr->flags1 & RF1_RAND_25) && (r_ptr->flags1 & RF1_RAND_50)) + else if ((r_ptr->flags & RF_RAND_25) && (r_ptr->flags & RF_RAND_50)) { if (randint(100) < 75) tmp = randint(9); else tmp = dir; } - else if (r_ptr->flags1 & RF1_RAND_50) + else if (r_ptr->flags & RF_RAND_50) { if (randint(100) < 50) tmp = randint(9); else tmp = dir; } - else if (r_ptr->flags1 & RF1_RAND_25) + else if (r_ptr->flags & RF_RAND_25) { if (randint(100) < 25) tmp = randint(9); @@ -2963,7 +2964,7 @@ void move_player_aux(int dir, int do_pickup, int run, bool_ disarm) py_attack(y, x, -1); } else if (cave_floor_bold(p_ptr->py, p_ptr->px) || - (mr_ptr->flags2 & RF2_PASS_WALL)) + (mr_ptr->flags & RF_PASS_WALL)) { msg_format("You push past %s.", m_name); m_ptr->fy = p_ptr->py; @@ -4339,7 +4340,7 @@ void do_cmd_pet(void) m_ptr = &m_list[pet_ctr]; r_ptr = &r_info[m_ptr->r_idx]; - if ((!(r_ptr->flags7 & RF7_NO_DEATH)) && ((m_ptr->status == MSTATUS_PET) || (m_ptr->status == MSTATUS_FRIEND))) /* Get rid of it! */ + if ((!(r_ptr->flags & RF_NO_DEATH)) && ((m_ptr->status == MSTATUS_PET) || (m_ptr->status == MSTATUS_FRIEND))) /* Get rid of it! */ { bool_ checked = FALSE; char command; @@ -4408,7 +4409,7 @@ void do_cmd_pet(void) m_ptr = &m_list[pet_ctr]; r_ptr = &r_info[m_ptr->r_idx]; - if ((!(r_ptr->flags7 & RF7_NO_DEATH)) && ((m_ptr->status == MSTATUS_COMPANION))) /* Get rid of it! */ + if ((!(r_ptr->flags & RF_NO_DEATH)) && ((m_ptr->status == MSTATUS_COMPANION))) /* Get rid of it! */ { bool_ delete_this = FALSE; @@ -4572,7 +4573,7 @@ bool_ do_cmd_leave_body(bool_ drop_body) o_ptr->ident |= IDENT_STOREB; /* Unique corpses are unique */ - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { o_ptr->name1 = 201; } @@ -4668,13 +4669,13 @@ bool_ execute_inscription(byte i, byte y, byte x) monster_type *m_ptr = &m_list[c_ptr->m_idx]; auto const r_ptr = m_ptr->race(); - if (r_ptr->flags7 & RF7_CAN_FLY) + if (r_ptr->flags & RF_CAN_FLY) { msg_print("The monster simply flies over the chasm."); } else { - if (!(r_ptr->flags1 & RF1_UNIQUE)) + if (!(r_ptr->flags & RF_UNIQUE)) { msg_print("The monster falls in the chasm!"); delete_monster_idx(c_ptr->m_idx); diff --git a/src/cmd2.cc b/src/cmd2.cc index d1f26cae..5bd508b2 100644 --- a/src/cmd2.cc +++ b/src/cmd2.cc @@ -27,6 +27,7 @@ #include "monster2.hpp" #include "monster3.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_type.hpp" #include "object1.hpp" #include "object2.hpp" @@ -81,7 +82,7 @@ static bool_ do_cmd_bash_fountain(int y, int x) monster_race *r_ptr = &r_info[p_ptr->body_monster]; - if ((p_ptr->body_monster != 0) && !(r_ptr->flags2 & RF2_BASH_DOOR)) + if ((p_ptr->body_monster != 0) && !(r_ptr->flags & RF_BASH_DOOR)) { msg_print("You cannot do that."); @@ -772,7 +773,7 @@ static bool_ do_cmd_open_chest(int y, int x, s16b o_idx) monster_race *r_ptr = &r_info[p_ptr->body_monster]; - if ((p_ptr->body_monster != 0) && !(r_ptr->flags2 & RF2_OPEN_DOOR)) + if ((p_ptr->body_monster != 0) && !(r_ptr->flags & RF_OPEN_DOOR)) { msg_print("You cannot open chests."); @@ -1014,7 +1015,7 @@ static bool_ do_cmd_open_aux(int y, int x, int dir) monster_race *r_ptr = &r_info[p_ptr->body_monster]; - if ((p_ptr->body_monster != 0) && !(r_ptr->flags2 & RF2_OPEN_DOOR)) + if ((p_ptr->body_monster != 0) && !(r_ptr->flags & RF_OPEN_DOOR)) { msg_print("You cannot open doors."); @@ -1129,7 +1130,7 @@ void do_cmd_open(void) monster_race *r_ptr = &r_info[p_ptr->body_monster]; - if ((p_ptr->body_monster != 0) && !(r_ptr->flags2 & RF2_OPEN_DOOR)) + if ((p_ptr->body_monster != 0) && !(r_ptr->flags & RF_OPEN_DOOR)) { msg_print("You cannot open doors."); @@ -1249,7 +1250,7 @@ static bool_ do_cmd_close_aux(int y, int x, int dir) monster_race *r_ptr = &r_info[p_ptr->body_monster]; - if ((p_ptr->body_monster != 0) && !(r_ptr->flags2 & RF2_OPEN_DOOR)) + if ((p_ptr->body_monster != 0) && !(r_ptr->flags & RF_OPEN_DOOR)) { msg_print("You cannot close doors."); @@ -2145,7 +2146,7 @@ static bool_ do_cmd_bash_aux(int y, int x, int dir) monster_race *r_ptr = &r_info[p_ptr->body_monster]; - if ((p_ptr->body_monster != 0) && !(r_ptr->flags2 & RF2_BASH_DOOR)) + if ((p_ptr->body_monster != 0) && !(r_ptr->flags & RF_BASH_DOOR)) { msg_print("You cannot do that."); @@ -2259,7 +2260,7 @@ void do_cmd_bash(void) monster_race *r_ptr = &r_info[p_ptr->body_monster]; - if ((p_ptr->body_monster != 0) && !(r_ptr->flags2 & RF2_BASH_DOOR)) + if ((p_ptr->body_monster != 0) && !(r_ptr->flags & RF_BASH_DOOR)) { msg_print("You cannot do that."); @@ -3355,9 +3356,9 @@ void do_cmd_fire(void) cptr note_dies = " dies."; /* Some monsters get "destroyed" */ - if ((r_ptr->flags3 & RF3_DEMON) || - (r_ptr->flags3 & RF3_UNDEAD) || - (r_ptr->flags2 & RF2_STUPID) || + if ((r_ptr->flags & RF_DEMON) || + (r_ptr->flags & RF_UNDEAD) || + (r_ptr->flags & RF_STUPID) || (strchr("Evg", r_ptr->d_char))) { /* Special note at death */ @@ -3769,9 +3770,9 @@ void do_cmd_throw(void) cptr note_dies = " dies."; /* Some monsters get "destroyed" */ - if ((r_ptr->flags3 & RF3_DEMON) || - (r_ptr->flags3 & RF3_UNDEAD) || - (r_ptr->flags2 & RF2_STUPID) || + if ((r_ptr->flags & RF_DEMON) || + (r_ptr->flags & RF_UNDEAD) || + (r_ptr->flags & RF_STUPID) || (strchr("Evg", r_ptr->d_char))) { /* Special note at death */ @@ -4096,9 +4097,9 @@ void do_cmd_boomerang(void) cptr note_dies = " dies."; /* Some monsters get "destroyed" */ - if ((r_ptr->flags3 & RF3_DEMON) || - (r_ptr->flags3 & RF3_UNDEAD) || - (r_ptr->flags2 & RF2_STUPID) || + if ((r_ptr->flags & RF_DEMON) || + (r_ptr->flags & RF_UNDEAD) || + (r_ptr->flags & RF_STUPID) || (strchr("Evg", r_ptr->d_char))) { /* Special note at death */ @@ -4781,7 +4782,7 @@ void do_cmd_steal() } /* The monster is immune */ - if (r_info[m_ptr->r_idx].flags7 & RF7_NO_THEFT) + if (r_info[m_ptr->r_idx].flags & RF_NO_THEFT) { msg_print("The monster is guarding the treasures."); return; diff --git a/src/cmd3.cc b/src/cmd3.cc index 51939fe6..473f5c0d 100644 --- a/src/cmd3.cc +++ b/src/cmd3.cc @@ -18,6 +18,7 @@ #include "hooks.hpp" #include "monster1.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "object1.hpp" #include "object2.hpp" #include "object_kind.hpp" @@ -1325,7 +1326,7 @@ static void roff_top(int r_idx) Term_gotoxy(0, 0); /* A title (use "The" for non-uniques) */ - if (!(r_ptr->flags1 & RF1_UNIQUE)) + if (!(r_ptr->flags & RF_UNIQUE)) { Term_addstr( -1, TERM_WHITE, "The "); } @@ -1435,10 +1436,10 @@ void do_cmd_query_symbol(void) monster_race *r_ptr = &r_info[i]; /* Require non-unique monsters if needed */ - if (norm && (r_ptr->flags1 & RF1_UNIQUE)) continue; + if (norm && (r_ptr->flags & RF_UNIQUE)) continue; /* Require unique monsters if needed */ - if (uniq && !(r_ptr->flags1 & RF1_UNIQUE)) continue; + if (uniq && !(r_ptr->flags & RF_UNIQUE)) continue; /* Require monsters with the name requested if needed */ if (name) diff --git a/src/cmd4.cc b/src/cmd4.cc index b63a2c2c..45ee0363 100644 --- a/src/cmd4.cc +++ b/src/cmd4.cc @@ -20,6 +20,7 @@ #include "messages.hpp" #include "monster2.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_type.hpp" #include "notes.hpp" #include "object1.hpp" @@ -3276,9 +3277,9 @@ static void do_cmd_knowledge_uniques(void) monster_race *r_ptr = &r_info[k]; /* Only print Uniques */ - if ((r_ptr->flags1 & RF1_UNIQUE) && - !(r_ptr->flags7 & RF7_PET) && - !(r_ptr->flags7 & RF7_NEUTRAL)) + if ((r_ptr->flags & RF_UNIQUE) && + !(r_ptr->flags & RF_PET) && + !(r_ptr->flags & RF_NEUTRAL)) { unique_r_idxs.push_back(k); } @@ -3298,7 +3299,7 @@ static void do_cmd_knowledge_uniques(void) monster_race *r_ptr = &r_info[r_idx]; /* Only print Uniques */ - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { bool_ dead = (r_ptr->max_num == 0); @@ -3446,7 +3447,7 @@ static void do_cmd_knowledge_pets(void) monster_desc(pet_name, m_ptr, 0x88); w.write("{}{} ({})\n", - (r_ptr->flags1 & RF1_UNIQUE) ? "#####G" : "", + (r_ptr->flags & RF_UNIQUE) ? "#####G" : "", pet_name, (m_ptr->status < MSTATUS_COMPANION) ? "pet" : "companion"); } @@ -3492,7 +3493,7 @@ static void do_cmd_knowledge_kill_count(void) { monster_race *r_ptr = &r_info[kk]; - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { if (r_ptr->max_num == 0) { @@ -3526,7 +3527,7 @@ static void do_cmd_knowledge_kill_count(void) { monster_race *r_ptr = &r_info[k]; - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { bool_ dead = (r_ptr->max_num == 0); diff --git a/src/cmd5.cc b/src/cmd5.cc index 2c9798de..29651cf2 100644 --- a/src/cmd5.cc +++ b/src/cmd5.cc @@ -16,6 +16,7 @@ #include "lua_bind.hpp" #include "monster2.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_spell_flag.hpp" #include "object1.hpp" #include "object2.hpp" @@ -592,7 +593,7 @@ cptr symbiote_name(bool_ capitalize) monster_race *r_ptr = &r_info[o_ptr->pval]; cptr s = NULL; - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { /* Unique monster; no preceding "your", and ignore our name. */ strncpy(buf, r_ptr->name, sizeof(buf)); @@ -857,7 +858,7 @@ static void apply_monster_power(monster_race const *r_ptr, std::size_t monster_s int const rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1); /* 'Powerful' monsters have wider radii */ - int rad = (r_ptr->flags2 & RF2_POWERFUL) + int rad = (r_ptr->flags & RF_POWERFUL) ? 1 + (p_ptr->lev / 15) : 1 + (p_ptr->lev / 20); diff --git a/src/cmd6.cc b/src/cmd6.cc index b1022bd1..b34efeb3 100644 --- a/src/cmd6.cc +++ b/src/cmd6.cc @@ -25,6 +25,7 @@ #include "mimic.hpp" #include "monster2.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_spell_flag.hpp" #include "monster_type.hpp" #include "object1.hpp" @@ -789,7 +790,7 @@ static void corpse_effect(object_type *o_ptr, bool_ cutting) } /* Hack -- Jellies are immune to acid only if they are already acidic */ - if (strchr("j", r_ptr->d_char) && (r_ptr->flags3 & RF3_IM_ACID)) + if (strchr("j", r_ptr->d_char) && (r_ptr->flags & RF_IM_ACID)) { dam = damroll(8, 8); @@ -811,7 +812,7 @@ static void corpse_effect(object_type *o_ptr, bool_ cutting) * are immune to poison because their body already contains * poisonous chemicals. */ - if (strchr("ijkmS,", r_ptr->d_char) && (r_ptr->flags3 & RF3_IM_POIS)) + if (strchr("ijkmS,", r_ptr->d_char) && (r_ptr->flags & RF_IM_POIS)) { if (!(p_ptr->resist_pois || p_ptr->oppose_pois)) { @@ -826,58 +827,58 @@ static void corpse_effect(object_type *o_ptr, bool_ cutting) */ if (!harmful && !cutting && (o_ptr->sval != SV_CORPSE_MEAT)) { - if (r_ptr->flags3 & RF3_IM_ACID) + if (r_ptr->flags & RF_IM_ACID) { set_oppose_acid(p_ptr->oppose_acid + rand_int(10) + 10); } - if (r_ptr->flags3 & RF3_IM_ELEC) + if (r_ptr->flags & RF_IM_ELEC) { set_oppose_elec(p_ptr->oppose_elec + rand_int(10) + 10); } - if (r_ptr->flags3 & RF3_IM_FIRE) + if (r_ptr->flags & RF_IM_FIRE) { set_oppose_fire(p_ptr->oppose_fire + rand_int(10) + 10); } - if (r_ptr->flags3 & RF3_IM_COLD) + if (r_ptr->flags & RF_IM_COLD) { set_oppose_cold(p_ptr->oppose_cold + rand_int(10) + 10); } - if (r_ptr->flags3 & RF3_IM_POIS) + if (r_ptr->flags & RF_IM_POIS) { set_oppose_pois(p_ptr->oppose_pois + rand_int(10) + 10); } - if (r_ptr->flags3 & RF3_RES_NETH) + if (r_ptr->flags & RF_RES_NETH) { set_protevil(p_ptr->protevil + rand_int(25) + 3 * r_ptr->level); } - if (r_ptr->flags3 & RF3_RES_PLAS) + if (r_ptr->flags & RF_RES_PLAS) { set_oppose_fire(p_ptr->oppose_fire + rand_int(20) + 20); } - if (r_ptr->flags2 & RF2_SHAPECHANGER) + if (r_ptr->flags & RF_SHAPECHANGER) { /* DGDGDG (void)set_mimic(20 , rand_int(MIMIC_VALAR)); */ } - if (r_ptr->flags3 & RF3_DEMON) + if (r_ptr->flags & RF_DEMON) { /* DGDGDG (void)set_mimic(30 , MIMIC_DEMON); */ } - if (r_ptr->flags3 & RF3_UNDEAD) + if (r_ptr->flags & RF_UNDEAD) { /* DGDGDG (void)set_mimic(30 , MIMIC_VAMPIRE); */ } - if (r_ptr->flags3 & RF3_NO_FEAR) + if (r_ptr->flags & RF_NO_FEAR) { (void)set_afraid(0); } - if (r_ptr->flags3 & RF3_NO_STUN) + if (r_ptr->flags & RF_NO_STUN) { (void)set_stun(0); } - if (r_ptr->flags3 & RF3_NO_CONF) + if (r_ptr->flags & RF_NO_CONF) { (void)set_confused(0); } @@ -1372,7 +1373,7 @@ void do_cmd_eat_food(void) /* Not all is edible. Apologies if messy. */ /* Check weight -- they have to have some meat left */ - if (r_ptr->flags9 & RF9_DROP_SKELETON) + if (r_ptr->flags & RF_DROP_SKELETON) { if (o_ptr->weight <= (r_ptr->weight * 3) / 5) { @@ -1566,7 +1567,7 @@ void do_cmd_cut_corpse(void) { case SV_CORPSE_CORPSE: { - if (r_ptr->flags9 & RF9_DROP_SKELETON) + if (r_ptr->flags & RF_DROP_SKELETON) { not_meat = (r_ptr->weight * 3) / 5; } @@ -2948,8 +2949,8 @@ void do_cmd_read_scroll(void) { monster_race *r_ptr = &r_info[k]; - if (r_ptr->flags1 & RF1_UNIQUE && - !(r_ptr->flags9 & RF9_SPECIAL_GENE)) + if (r_ptr->flags & RF_UNIQUE && + !(r_ptr->flags & RF_SPECIAL_GENE)) { r_ptr->max_num = 1; } @@ -5859,7 +5860,7 @@ const char *activation_aux(object_type * o_ptr, bool_ doit, int item) { if (!doit) return "detect orcs every 10 turns"; msg_print("Your weapon glows brightly..."); - (void)detect_monsters_xxx(RF3_ORC, DEFAULT_RADIUS); + detect_monsters_orcs(DEFAULT_RADIUS); o_ptr->timeout = 10; diff --git a/src/cmd7.cc b/src/cmd7.cc index 5b1eaf02..1d6718a9 100644 --- a/src/cmd7.cc +++ b/src/cmd7.cc @@ -20,6 +20,7 @@ #include "mimic.hpp" #include "monster2.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_type.hpp" #include "object1.hpp" #include "object2.hpp" @@ -3653,7 +3654,7 @@ void do_cmd_summoner_extract() object_type *o_ptr = get_object(item); bool_ partial; - if (r_info[o_ptr->pval2].flags1 & RF1_UNIQUE) + if (r_info[o_ptr->pval2].flags & RF_UNIQUE) { partial = FALSE; } @@ -3702,7 +3703,7 @@ void summon_true(int r_idx, int item) /* Uniques are less likely to be nice */ - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { /* Because it's unique, it will always be destroyed */ used = TRUE; @@ -4102,7 +4103,7 @@ void do_cmd_symbiotic(void) m_ptr = &m_list[c_ptr->m_idx]; auto const r_ptr = m_ptr->race(); - if (!(r_ptr->flags1 & RF1_NEVER_MOVE)) + if (!(r_ptr->flags & RF_NEVER_MOVE)) { msg_print("You can only hypnotise monsters that cannot move."); } @@ -4110,7 +4111,7 @@ void do_cmd_symbiotic(void) { msg_print("You can only hypnotise pets and companions."); } - else if (r_ptr->flags9 & RF9_SPECIAL_GENE) + else if (r_ptr->flags & RF_SPECIAL_GENE) { msg_print("You cannot hypnotise this monster."); } diff --git a/src/defines.h b/src/defines.h index 942675b5..7c33e15a 100644 --- a/src/defines.h +++ b/src/defines.h @@ -2628,182 +2628,6 @@ #define MONSTER_LEVEL_MAX 150 -/* - * New monster race bit flags - */ -#define RF1_UNIQUE 0x00000001 /* Unique Monster */ -#define RF1_QUESTOR 0x00000002 /* Quest Monster */ -#define RF1_MALE 0x00000004 /* Male gender */ -#define RF1_FEMALE 0x00000008 /* Female gender */ -#define RF1_CHAR_CLEAR 0x00000010 /* Absorbs symbol */ -#define RF1_CHAR_MULTI 0x00000020 /* Changes symbol */ -#define RF1_ATTR_CLEAR 0x00000040 /* Absorbs color */ -#define RF1_ATTR_MULTI 0x00000080 /* Changes color */ -#define RF1_FORCE_DEPTH 0x00000100 /* Start at "correct" depth */ -#define RF1_FORCE_MAXHP 0x00000200 /* Start with max hitpoints */ -#define RF1_FORCE_SLEEP 0x00000400 /* Start out sleeping */ -#define RF1_FORCE_EXTRA 0x00000800 /* Start out something */ -#define RF1_FRIEND 0x00001000 /* Arrive with a friend */ -#define RF1_FRIENDS 0x00002000 /* Arrive with some friends */ -#define RF1_ESCORT 0x00004000 /* Arrive with an escort */ -#define RF1_ESCORTS 0x00008000 /* Arrive with some escorts */ -#define RF1_NEVER_BLOW 0x00010000 /* Never make physical blow */ -#define RF1_NEVER_MOVE 0x00020000 /* Never make physical move */ -#define RF1_RAND_25 0x00040000 /* Moves randomly (25%) */ -#define RF1_RAND_50 0x00080000 /* Moves randomly (50%) */ -#define RF1_ONLY_GOLD 0x00100000 /* Drop only gold */ -#define RF1_ONLY_ITEM 0x00200000 /* Drop only items */ -#define RF1_DROP_60 0x00400000 /* Drop an item/gold (60%) */ -#define RF1_DROP_90 0x00800000 /* Drop an item/gold (90%) */ -#define RF1_DROP_1D2 0x01000000 /* Drop 1d2 items/gold */ -#define RF1_DROP_2D2 0x02000000 /* Drop 2d2 items/gold */ -#define RF1_DROP_3D2 0x04000000 /* Drop 3d2 items/gold */ -#define RF1_DROP_4D2 0x08000000 /* Drop 4d2 items/gold */ -#define RF1_DROP_GOOD 0x10000000 /* Drop good items */ -#define RF1_DROP_GREAT 0x20000000 /* Drop great items */ -#define RF1_DROP_USEFUL 0x40000000 /* Drop "useful" items */ -#define RF1_DROP_CHOSEN 0x80000000 /* Drop "chosen" items */ - -/* - * New monster race bit flags - */ -#define RF2_STUPID 0x00000001 /* Monster is stupid */ -#define RF2_SMART 0x00000002 /* Monster is smart */ -#define RF2_CAN_SPEAK 0x00000004 /* TY: can speak */ -#define RF2_REFLECTING 0x00000008 /* Reflects bolts */ -#define RF2_INVISIBLE 0x00000010 /* Monster avoids vision */ -#define RF2_COLD_BLOOD 0x00000020 /* Monster avoids infra */ -#define RF2_EMPTY_MIND 0x00000040 /* Monster avoids telepathy */ -#define RF2_WEIRD_MIND 0x00000080 /* Monster avoids telepathy? */ -#define RF2_DEATH_ORB 0x00000100 /* Death Orb */ -#define RF2_REGENERATE 0x00000200 /* Monster regenerates */ -#define RF2_SHAPECHANGER 0x00000400 /* TY: shapechanger */ -#define RF2_ATTR_ANY 0x00000800 /* TY: Attr_any */ -#define RF2_POWERFUL 0x00001000 /* Monster has strong breath */ -#define RF2_ELDRITCH_HORROR 0x00002000 /* Sanity-blasting horror */ -#define RF2_AURA_FIRE 0x00004000 /* Burns in melee */ -#define RF2_AURA_ELEC 0x00008000 /* Shocks in melee */ -#define RF2_OPEN_DOOR 0x00010000 /* Monster can open doors */ -#define RF2_BASH_DOOR 0x00020000 /* Monster can bash doors */ -#define RF2_PASS_WALL 0x00040000 /* Monster can pass walls */ -#define RF2_KILL_WALL 0x00080000 /* Monster can destroy walls */ -#define RF2_MOVE_BODY 0x00100000 /* Monster can move monsters */ -#define RF2_KILL_BODY 0x00200000 /* Monster can kill monsters */ -#define RF2_TAKE_ITEM 0x00400000 /* Monster can pick up items */ -#define RF2_KILL_ITEM 0x00800000 /* Monster can crush items */ -#define RF2_BRAIN_1 0x01000000 -#define RF2_BRAIN_2 0x02000000 -#define RF2_BRAIN_3 0x04000000 -#define RF2_BRAIN_4 0x08000000 -#define RF2_BRAIN_5 0x10000000 -#define RF2_BRAIN_6 0x20000000 -#define RF2_BRAIN_7 0x40000000 -#define RF2_BRAIN_8 0x80000000 - -/* - * New monster race bit flags - */ -#define RF3_ORC 0x00000001 /* Orc */ -#define RF3_TROLL 0x00000002 /* Troll */ -#define RF3_GIANT 0x00000004 /* Giant */ -#define RF3_DRAGON 0x00000008 /* Dragon */ -#define RF3_DEMON 0x00000010 /* Demon */ -#define RF3_UNDEAD 0x00000020 /* Undead */ -#define RF3_EVIL 0x00000040 /* Evil */ -#define RF3_ANIMAL 0x00000080 /* Animal */ -#define RF3_THUNDERLORD 0x00000100 /* DG: Thunderlord */ -#define RF3_GOOD 0x00000200 /* Good */ -#define RF3_AURA_COLD 0x00000400 /* Freezes in melee */ -#define RF3_NONLIVING 0x00000800 /* TY: Non-Living (?) */ -#define RF3_HURT_LITE 0x00001000 /* Hurt by lite */ -#define RF3_HURT_ROCK 0x00002000 /* Hurt by rock remover */ -#define RF3_SUSCEP_FIRE 0x00004000 /* Hurt badly by fire */ -#define RF3_SUSCEP_COLD 0x00008000 /* Hurt badly by cold */ -#define RF3_IM_ACID 0x00010000 /* Resist acid a lot */ -#define RF3_IM_ELEC 0x00020000 /* Resist elec a lot */ -#define RF3_IM_FIRE 0x00040000 /* Resist fire a lot */ -#define RF3_IM_COLD 0x00080000 /* Resist cold a lot */ -#define RF3_IM_POIS 0x00100000 /* Resist poison a lot */ -#define RF3_RES_TELE 0x00200000 /* Resist teleportation */ -#define RF3_RES_NETH 0x00400000 /* Resist nether a lot */ -#define RF3_RES_WATE 0x00800000 /* Resist water */ -#define RF3_RES_PLAS 0x01000000 /* Resist plasma */ -#define RF3_RES_NEXU 0x02000000 /* Resist nexus */ -#define RF3_RES_DISE 0x04000000 /* Resist disenchantment */ -#define RF3_UNIQUE_4 0x08000000 /* Is a "Nazgul" unique */ -#define RF3_NO_FEAR 0x10000000 /* Cannot be scared */ -#define RF3_NO_STUN 0x20000000 /* Cannot be stunned */ -#define RF3_NO_CONF 0x40000000 /* Cannot be confused */ -#define RF3_NO_SLEEP 0x80000000 /* Cannot be slept */ - -/* - * New monster race bit flags - */ -#define RF7_AQUATIC 0x00000001 /* Aquatic monster */ -#define RF7_CAN_SWIM 0x00000002 /* Monster can swim */ -#define RF7_CAN_FLY 0x00000004 /* Monster can fly */ -#define RF7_FRIENDLY 0x00000008 /* Monster is friendly */ -#define RF7_PET 0x00000010 /* Monster is a pet */ -#define RF7_MORTAL 0x00000020 /* Monster is a mortal being */ -#define RF7_SPIDER 0x00000040 /* Monster is a spider (can pass webs) */ -#define RF7_NAZGUL 0x00000080 /* Monster is a Nazgul */ -#define RF7_DG_CURSE 0x00000100 /* If killed the monster grant a DG Curse to the player */ -#define RF7_POSSESSOR 0x00000200 /* Is it a dreaded possessor monster ? */ -#define RF7_NO_DEATH 0x00000400 /* Cannot be killed */ -#define RF7_NO_TARGET 0x00000800 /* Cannot be targeted */ -#define RF7_AI_ANNOY 0x00001000 /* Try to tease the player */ -#define RF7_AI_SPECIAL 0x00002000 /* For quests */ -#define RF7_NEUTRAL 0x00004000 /* Monster is neutral */ -#define RF7_DROP_ART 0x00008000 /* Monster drop one art */ -#define RF7_DROP_RANDART 0x00010000 /* Monster drop one randart */ -#define RF7_AI_PLAYER 0x00020000 /* Controlled by the player */ -#define RF7_NO_THEFT 0x00040000 /* Monster is immune to theft */ -#define RF7_SPIRIT 0x00080000 /* This is a Spirit, coming from the Void */ - - -/* - * Monster race flags - */ -#define RF8_DUNGEON 0x00000001 -#define RF8_WILD_TOWN 0x00000002 -#define RF8_XXX8X02 0x00000004 -#define RF8_WILD_SHORE 0x00000008 -#define RF8_WILD_OCEAN 0x00000010 -#define RF8_WILD_WASTE 0x00000020 -#define RF8_WILD_WOOD 0x00000040 -#define RF8_WILD_VOLCANO 0x00000080 -#define RF8_XXX8X08 0x00000100 -#define RF8_WILD_MOUNTAIN 0x00000200 -#define RF8_WILD_GRASS 0x00000400 -#define RF8_NO_CUT 0x00000800 -#define RF8_CTHANGBAND 0x00001000 /* Not used in ToME */ -/* XXX */ -#define RF8_ZANGBAND 0x00004000 /* Not used in ToME */ -#define RF8_JOKEANGBAND 0x00008000 -#define RF8_ANGBAND 0x00010000 - -#define RF8_WILD_TOO 0x80000000 - - -/* - * Monster race flags - */ -#define RF9_DROP_CORPSE 0x00000001 -#define RF9_DROP_SKELETON 0x00000002 -#define RF9_HAS_LITE 0x00000004 /* Carries a lite */ -#define RF9_MIMIC 0x00000008 /* *REALLY* looks like an object ... only nastier */ -#define RF9_HAS_EGG 0x00000010 /* Can be monster's eggs */ -#define RF9_IMPRESED 0x00000020 /* The monster can follow you on each level until he dies */ -#define RF9_SUSCEP_ACID 0x00000040 /* Susceptible to acid */ -#define RF9_SUSCEP_ELEC 0x00000080 /* Susceptible to lightning */ -#define RF9_SUSCEP_POIS 0x00000100 /* Susceptible to poison */ -#define RF9_KILL_TREES 0x00000200 /* Monster can eat trees */ -#define RF9_WYRM_PROTECT 0x00000400 /* The monster is protected by great wyrms of power: They'll be summoned if it's killed */ -#define RF9_DOPPLEGANGER 0x00000800 /* The monster looks like you */ -#define RF9_ONLY_DEPTH 0x00001000 /* The monster can only be generated at the GIVEN depth */ -#define RF9_SPECIAL_GENE 0x00002000 /* The monster can only be generated in special conditions like quests, special dungeons, ... */ -#define RF9_NEVER_GENE 0x00004000 /* The monster cannot be normaly generated */ - /*** Macro Definitions ***/ diff --git a/src/dungeon.cc b/src/dungeon.cc index cd904f29..c05c6ed3 100644 --- a/src/dungeon.cc +++ b/src/dungeon.cc @@ -40,6 +40,7 @@ #include "monster2.hpp" #include "monster3.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_type.hpp" #include "modules.hpp" #include "notes.hpp" @@ -791,7 +792,7 @@ static void regen_monsters(void) if (!frac) frac = 1; /* Hack -- Some monsters regenerate quickly */ - if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2; + if (r_ptr->flags & RF_REGENERATE) frac *= 2; /* Hack -- Regenerate */ @@ -828,7 +829,7 @@ static void regen_monsters(void) /* Hack -- Some monsters regenerate quickly */ auto const r_ptr = m_ptr->race(); - if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2; + if (r_ptr->flags & RF_REGENERATE) frac *= 2; /* Hack -- Regenerate */ m_ptr->hp += frac; @@ -2967,7 +2968,7 @@ static void process_world(void) monster_type *m_ptr = &m_list[cave[my][mx].m_idx]; auto const r_ptr = m_ptr->race(); - if ((r_ptr->flags9 & RF9_IMPRESED) && can_create_companion()) + if ((r_ptr->flags & RF_IMPRESED) && can_create_companion()) { msg_format("And you have given the imprint to your %s!", r_ptr->name); m_ptr->status = MSTATUS_COMPANION; @@ -4512,7 +4513,7 @@ static void process_player(void) auto const r_ptr = m_ptr->race(); /* Skip non-multi-hued monsters */ - if (!(r_ptr->flags1 & RF1_ATTR_MULTI)) continue; + if (!(r_ptr->flags & RF_ATTR_MULTI)) continue; /* Reset the flag */ shimmer_monsters = TRUE; diff --git a/src/files.cc b/src/files.cc index 96269259..8758e692 100644 --- a/src/files.cc +++ b/src/files.cc @@ -27,6 +27,7 @@ #include "monster3.hpp" #include "monster_ego.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_type.hpp" #include "notes.hpp" #include "object1.hpp" @@ -1476,7 +1477,7 @@ static void display_player_various(void) } else if (!r_info[p_ptr->body_monster].body_parts[BODY_WEAPON]) { - if (r_info[p_ptr->body_monster].flags1 & RF1_NEVER_BLOW) + if (r_info[p_ptr->body_monster].flags & RF_NEVER_BLOW) desc = "nil!"; else { @@ -1560,13 +1561,13 @@ void wield_monster_flags(u32b *f1, u32b *f2, u32b *f3, u32b *f4, u32b *f5, u32b { r_ptr = &r_info[o_ptr->pval]; - if (r_ptr->flags2 & RF2_INVISIBLE) + if (r_ptr->flags & RF_INVISIBLE) (*f2) |= TR2_INVIS; - if (r_ptr->flags2 & RF2_REFLECTING) + if (r_ptr->flags & RF_REFLECTING) (*f2) |= TR2_REFLECT; - if (r_ptr->flags7 & RF7_CAN_FLY) + if (r_ptr->flags & RF_CAN_FLY) (*f3) |= TR3_FEATHER; - if (r_ptr->flags7 & RF7_AQUATIC) + if (r_ptr->flags & RF_AQUATIC) (*f5) |= TR5_WATER_BREATH; } } @@ -1712,24 +1713,24 @@ void player_flags(u32b *f1, u32b *f2, u32b *f3, u32b *f4, u32b *f5, u32b *esp) { monster_race *r_ptr = &r_info[p_ptr->body_monster]; - if (r_ptr->flags2 & RF2_REFLECTING) (*f2) |= TR2_REFLECT; - if (r_ptr->flags2 & RF2_REGENERATE) (*f3) |= TR3_REGEN; - if (r_ptr->flags2 & RF2_AURA_FIRE) (*f3) |= TR3_SH_FIRE; - if (r_ptr->flags2 & RF2_AURA_ELEC) (*f3) |= TR3_SH_ELEC; - if (r_ptr->flags2 & RF2_PASS_WALL) (*f3) |= TR3_WRAITH; - if (r_ptr->flags3 & RF3_SUSCEP_FIRE) (*f2) |= TR2_SENS_FIRE; - if (r_ptr->flags3 & RF3_IM_ACID) (*f2) |= TR2_RES_ACID; - if (r_ptr->flags3 & RF3_IM_ELEC) (*f2) |= TR2_RES_ELEC; - if (r_ptr->flags3 & RF3_IM_FIRE) (*f2) |= TR2_RES_FIRE; - if (r_ptr->flags3 & RF3_IM_POIS) (*f2) |= TR2_RES_POIS; - if (r_ptr->flags3 & RF3_IM_COLD) (*f2) |= TR2_RES_COLD; - if (r_ptr->flags3 & RF3_RES_NETH) (*f2) |= TR2_RES_NETHER; - if (r_ptr->flags3 & RF3_RES_NEXU) (*f2) |= TR2_RES_NEXUS; - if (r_ptr->flags3 & RF3_RES_DISE) (*f2) |= TR2_RES_DISEN; - if (r_ptr->flags3 & RF3_NO_FEAR) (*f2) |= TR2_RES_FEAR; - if (r_ptr->flags3 & RF3_NO_SLEEP) (*f2) |= TR2_FREE_ACT; - if (r_ptr->flags3 & RF3_NO_CONF) (*f2) |= TR2_RES_CONF; - if (r_ptr->flags7 & RF7_CAN_FLY) (*f3) |= TR3_FEATHER; + if (r_ptr->flags & RF_REFLECTING) (*f2) |= TR2_REFLECT; + if (r_ptr->flags & RF_REGENERATE) (*f3) |= TR3_REGEN; + if (r_ptr->flags & RF_AURA_FIRE) (*f3) |= TR3_SH_FIRE; + if (r_ptr->flags & RF_AURA_ELEC) (*f3) |= TR3_SH_ELEC; + if (r_ptr->flags & RF_PASS_WALL) (*f3) |= TR3_WRAITH; + if (r_ptr->flags & RF_SUSCEP_FIRE) (*f2) |= TR2_SENS_FIRE; + if (r_ptr->flags & RF_IM_ACID) (*f2) |= TR2_RES_ACID; + if (r_ptr->flags & RF_IM_ELEC) (*f2) |= TR2_RES_ELEC; + if (r_ptr->flags & RF_IM_FIRE) (*f2) |= TR2_RES_FIRE; + if (r_ptr->flags & RF_IM_POIS) (*f2) |= TR2_RES_POIS; + if (r_ptr->flags & RF_IM_COLD) (*f2) |= TR2_RES_COLD; + if (r_ptr->flags & RF_RES_NETH) (*f2) |= TR2_RES_NETHER; + if (r_ptr->flags & RF_RES_NEXU) (*f2) |= TR2_RES_NEXUS; + if (r_ptr->flags & RF_RES_DISE) (*f2) |= TR2_RES_DISEN; + if (r_ptr->flags & RF_NO_FEAR) (*f2) |= TR2_RES_FEAR; + if (r_ptr->flags & RF_NO_SLEEP) (*f2) |= TR2_FREE_ACT; + if (r_ptr->flags & RF_NO_CONF) (*f2) |= TR2_RES_CONF; + if (r_ptr->flags & RF_CAN_FLY) (*f3) |= TR3_FEATHER; } (*f1) |= p_ptr->xtra_f1; @@ -2701,7 +2702,7 @@ errr file_character(cptr name, bool_ full) { monster_race *r_ptr = &r_info[k]; - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { bool_ dead = (r_ptr->max_num == 0); if (dead) @@ -4052,7 +4053,7 @@ static long total_points(void) { monster_race *r_ptr = &r_info[k]; - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { bool_ dead = (r_ptr->max_num == 0); diff --git a/src/generate.cc b/src/generate.cc index ed35035c..6474f6de 100644 --- a/src/generate.cc +++ b/src/generate.cc @@ -21,6 +21,7 @@ #include "loadsave.hpp" #include "monster2.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_spell_flag.hpp" #include "monster_type.hpp" #include "object2.hpp" @@ -2674,10 +2675,10 @@ static bool_ vault_aux_jelly(int r_idx) monster_race *r_ptr = &r_info[r_idx]; /* Decline unique monsters */ - if (r_ptr->flags1 & RF1_UNIQUE) return (FALSE); + if (r_ptr->flags & RF_UNIQUE) return (FALSE); /* Also decline evil jellies (like death molds and shoggoths) */ - if (r_ptr->flags3 & RF3_EVIL) return (FALSE); + if (r_ptr->flags & RF_EVIL) return (FALSE); /* Require icky thing, jelly, mold, or mushroom */ if (!strchr("ijm,", r_ptr->d_char)) return (FALSE); @@ -2695,10 +2696,10 @@ static bool_ vault_aux_animal(int r_idx) monster_race *r_ptr = &r_info[r_idx]; /* Decline unique monsters */ - if (r_ptr->flags1 & RF1_UNIQUE) return (FALSE); + if (r_ptr->flags & RF_UNIQUE) return (FALSE); /* Require "animal" flag */ - if (!(r_ptr->flags3 & RF3_ANIMAL)) return (FALSE); + if (!(r_ptr->flags & RF_ANIMAL)) return (FALSE); /* Okay */ return (TRUE); @@ -2713,10 +2714,10 @@ static bool_ vault_aux_undead(int r_idx) monster_race *r_ptr = &r_info[r_idx]; /* Decline unique monsters */ - if (r_ptr->flags1 & RF1_UNIQUE) return (FALSE); + if (r_ptr->flags & RF_UNIQUE) return (FALSE); /* Require Undead */ - if (!(r_ptr->flags3 & RF3_UNDEAD)) return (FALSE); + if (!(r_ptr->flags & RF_UNDEAD)) return (FALSE); /* Okay */ return (TRUE); @@ -2731,7 +2732,7 @@ static bool_ vault_aux_chapel(int r_idx) monster_race *r_ptr = &r_info[r_idx]; /* Decline unique monsters */ - if (r_ptr->flags1 & RF1_UNIQUE) return (FALSE); + if (r_ptr->flags & RF_UNIQUE) return (FALSE); /* Require "priest" or Angel */ if (!((r_ptr->d_char == 'A') || strstr(r_ptr->name, "riest"))) @@ -2752,7 +2753,7 @@ static bool_ vault_aux_kennel(int r_idx) monster_race *r_ptr = &r_info[r_idx]; /* Decline unique monsters */ - if (r_ptr->flags1 & RF1_UNIQUE) return (FALSE); + if (r_ptr->flags & RF_UNIQUE) return (FALSE); /* Require a Zephyr Hound or a dog */ return ((r_ptr->d_char == 'Z') || (r_ptr->d_char == 'C')); @@ -2768,7 +2769,7 @@ static bool_ vault_aux_treasure(int r_idx) monster_race *r_ptr = &r_info[r_idx]; /* Decline unique monsters */ - if (r_ptr->flags1 & RF1_UNIQUE) return (FALSE); + if (r_ptr->flags & RF_UNIQUE) return (FALSE); /* Require "priest" or Angel */ if (!((r_ptr->d_char == '!') || (r_ptr->d_char == '|') || @@ -2798,7 +2799,7 @@ static bool_ vault_aux_clone(int r_idx) static bool_ vault_aux_symbol(int r_idx) { return ((r_info[r_idx].d_char == (r_info[template_race].d_char)) - && !(r_info[r_idx].flags1 & RF1_UNIQUE)); + && !(r_info[r_idx].flags & RF_UNIQUE)); } @@ -2810,7 +2811,7 @@ static bool_ vault_aux_orc(int r_idx) monster_race *r_ptr = &r_info[r_idx]; /* Decline unique monsters */ - if (r_ptr->flags1 & RF1_UNIQUE) return (FALSE); + if (r_ptr->flags & RF_UNIQUE) return (FALSE); /* Hack -- Require "o" monsters */ if (!strchr("o", r_ptr->d_char)) return (FALSE); @@ -2829,7 +2830,7 @@ static bool_ vault_aux_troll(int r_idx) monster_race *r_ptr = &r_info[r_idx]; /* Decline unique monsters */ - if (r_ptr->flags1 & RF1_UNIQUE) return (FALSE); + if (r_ptr->flags & RF_UNIQUE) return (FALSE); /* Hack -- Require "T" monsters */ if (!strchr("T", r_ptr->d_char)) return (FALSE); @@ -2847,7 +2848,7 @@ static bool_ vault_aux_giant(int r_idx) monster_race *r_ptr = &r_info[r_idx]; /* Decline unique monsters */ - if (r_ptr->flags1 & RF1_UNIQUE) return (FALSE); + if (r_ptr->flags & RF_UNIQUE) return (FALSE); /* Hack -- Require "P" monsters */ if (!strchr("P", r_ptr->d_char)) return (FALSE); @@ -2865,7 +2866,7 @@ static bool_ vault_aux_demon(int r_idx) monster_race *r_ptr = &r_info[r_idx]; /* Decline unique monsters */ - if (r_ptr->flags1 & RF1_UNIQUE) return (FALSE); + if (r_ptr->flags & RF_UNIQUE) return (FALSE); /* Hack -- Require "U" monsters */ if (!strchr("U", r_ptr->d_char)) return (FALSE); @@ -2968,7 +2969,7 @@ static void build_type5(int by0, int bx0) template_race = randint(max_r_idx - 2); /* Reject uniques */ - if (r_info[template_race].flags1 & RF1_UNIQUE) continue; + if (r_info[template_race].flags & RF_UNIQUE) continue; /* Reject OoD monsters in a loose fashion */ if (((r_info[template_race].level) + randint(5)) > @@ -3239,7 +3240,7 @@ static void build_type6(int by0, int bx0) { template_race = randint(max_r_idx - 2); } - while ((r_info[template_race].flags1 & RF1_UNIQUE) + while ((r_info[template_race].flags & RF_UNIQUE) || (((r_info[template_race].level) + randint(5)) > (dun_level + randint(5)))); @@ -3311,7 +3312,7 @@ static void build_type6(int by0, int bx0) monster_race *r_ptr = &r_info[r_idx]; /* Decline unique monsters */ - if (r_ptr->flags1 & RF1_UNIQUE) return (FALSE); + if (r_ptr->flags & RF_UNIQUE) return (FALSE); /* Hack -- Require "d" or "D" monsters */ if (!strchr("Dd", r_ptr->d_char)) return (FALSE); @@ -7820,7 +7821,7 @@ static bool_ cave_gen(void) } case FATE_FIND_R: { - if ((r_info[fates[i].r_idx].cur_num == 1) && (r_info[fates[i].r_idx].flags1 & RF1_UNIQUE)) fates[i].icky = TRUE; + if ((r_info[fates[i].r_idx].cur_num == 1) && (r_info[fates[i].r_idx].flags & RF_UNIQUE)) fates[i].icky = TRUE; break; } } diff --git a/src/init1.cc b/src/init1.cc index 9b76b8f8..327faca6 100644 --- a/src/init1.cc +++ b/src/init1.cc @@ -16,6 +16,7 @@ #include "monster2.hpp" #include "monster_ego.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_spell.hpp" #include "monster_type.hpp" #include "object1.hpp" @@ -153,242 +154,6 @@ static cptr r_info_blow_effect[] = /* - * Monster race flags - */ -static cptr r_info_flags1[] = -{ - "UNIQUE", - "QUESTOR", - "MALE", - "FEMALE", - "CHAR_CLEAR", - "CHAR_MULTI", - "ATTR_CLEAR", - "ATTR_MULTI", - "FORCE_DEPTH", - "FORCE_MAXHP", - "FORCE_SLEEP", - "FORCE_EXTRA", - "FRIEND", - "FRIENDS", - "ESCORT", - "ESCORTS", - "NEVER_BLOW", - "NEVER_MOVE", - "RAND_25", - "RAND_50", - "ONLY_GOLD", - "ONLY_ITEM", - "DROP_60", - "DROP_90", - "DROP_1D2", - "DROP_2D2", - "DROP_3D2", - "DROP_4D2", - "DROP_GOOD", - "DROP_GREAT", - "DROP_USEFUL", - "DROP_CHOSEN" -}; - -/* - * Monster race flags - */ -static cptr r_info_flags2[] = -{ - "STUPID", - "SMART", - "CAN_SPEAK", - "REFLECTING", - "INVISIBLE", - "COLD_BLOOD", - "EMPTY_MIND", - "WEIRD_MIND", - "DEATH_ORB", - "REGENERATE", - "SHAPECHANGER", - "ATTR_ANY", - "POWERFUL", - "ELDRITCH_HORROR", - "AURA_FIRE", - "AURA_ELEC", - "OPEN_DOOR", - "BASH_DOOR", - "PASS_WALL", - "KILL_WALL", - "MOVE_BODY", - "KILL_BODY", - "TAKE_ITEM", - "KILL_ITEM", - "BRAIN_1", - "BRAIN_2", - "BRAIN_3", - "BRAIN_4", - "BRAIN_5", - "BRAIN_6", - "BRAIN_7", - "BRAIN_8" -}; - -/* - * Monster race flags - */ -static cptr r_info_flags3[] = -{ - "ORC", - "TROLL", - "GIANT", - "DRAGON", - "DEMON", - "UNDEAD", - "EVIL", - "ANIMAL", - "THUNDERLORD", - "GOOD", - "AURA_COLD", /* TODO: Implement aura_cold */ - "NONLIVING", - "HURT_LITE", - "HURT_ROCK", - "SUSCEP_FIRE", - "SUSCEP_COLD", - "IM_ACID", - "IM_ELEC", - "IM_FIRE", - "IM_COLD", - "IM_POIS", - "RES_TELE", - "RES_NETH", - "RES_WATE", - "RES_PLAS", - "RES_NEXU", - "RES_DISE", - "UNIQUE_4", - "NO_FEAR", - "NO_STUN", - "NO_CONF", - "NO_SLEEP" -}; - -/* - * Monster race flags - */ -static cptr r_info_flags7[] = -{ - "AQUATIC", - "CAN_SWIM", - "CAN_FLY", - "FRIENDLY", - "PET", - "MORTAL", - "SPIDER", - "NAZGUL", - "DG_CURSE", - "POSSESSOR", - "NO_DEATH", - "NO_TARGET", - "AI_ANNOY", - "AI_SPECIAL", - "NEUTRAL", - "DROP_ART", - "DROP_RANDART", - "AI_PLAYER", - "NO_THEFT", - "SPIRIT", - "XXX7X20", - "XXX7X21", - "XXX7X22", - "XXX7X23", - "XXX7X24", - "XXX7X25", - "XXX7X26", - "XXX7X27", - "XXX7X28", - "XXX7X29", - "XXX7X30", - "XXX7X31", -}; - -/* - * Monster race flags - */ -static cptr r_info_flags8[] = -{ - "WILD_ONLY", - "WILD_TOWN", - "XXX8X02", - "WILD_SHORE", - "WILD_OCEAN", - "WILD_WASTE", - "WILD_WOOD", - "WILD_VOLCANO", - "XXX8X08", - "WILD_MOUNTAIN", - "WILD_GRASS", - "NO_CUT", - "CTHANGBAND", - "XXX8X13", - "ZANGBAND", - "JOKEANGBAND", - "BASEANGBAND", - "XXX8X17", - "XXX8X18", - "XXX8X19", - "XXX8X20", - "XXX8X21", - "XXX8X22", - "XXX8X23", - "XXX8X24", - "XXX8X25", - "XXX8X26", - "XXX8X27", - "XXX8X28", - "XXX8X29", - "XXX8X30", - "WILD_TOO", -}; - - -/* - * Monster race flags - Drops - */ -static cptr r_info_flags9[] = -{ - "DROP_CORPSE", - "DROP_SKELETON", - "HAS_LITE", - "MIMIC", - "HAS_EGG", - "IMPRESED", - "SUSCEP_ACID", - "SUSCEP_ELEC", - "SUSCEP_POIS", - "KILL_TREES", - "WYRM_PROTECT", - "DOPPLEGANGER", - "ONLY_DEPTH", - "SPECIAL_GENE", - "NEVER_GENE", - "XXX9X15", - "XXX9X16", - "XXX9X17", - "XXX9X18", - "XXX9X19", - "XXX9X20", - "XXX9X21", - "XXX9X22", - "XXX9X23", - "XXX9X24", - "XXX9X25", - "XXX9X26", - "XXX9X27", - "XXX9X28", - "XXX9X29", - "XXX9X30", - "XXX9X31", -}; - - -/* * Object flags */ static cptr k_info_flags1[] = @@ -5344,21 +5109,17 @@ errr init_ra_info_txt(FILE *fp) return (0); } -/* - * Grab one (basic) flag in a monster_race from a textual string - */ -static errr grab_one_basic_flag(monster_race *r_ptr, cptr what) + +static errr grab_monster_race_flag(monster_race_flag_set *flags, cptr what) { - if (lookup_flags(what, - flag_tie(&r_ptr->flags1, r_info_flags1), - flag_tie(&r_ptr->flags2, r_info_flags2), - flag_tie(&r_ptr->flags3, r_info_flags3), - flag_tie(&r_ptr->flags7, r_info_flags7), - flag_tie(&r_ptr->flags8, r_info_flags8), - flag_tie(&r_ptr->flags9, r_info_flags9))) - { - return 0; - } +#define RF(tier, index, name) \ + if (streq(what, #name)) \ + { \ + *flags |= BOOST_PP_CAT(RF_,name); \ + return 0; \ + }; +#include "monster_race_flag_list.hpp" +#undef RF /* Oops */ msg_format("Unknown monster flag '%s'.", what); @@ -5683,7 +5444,7 @@ errr init_r_info_txt(FILE *fp) /* Process 'F' for "Basic Flags" (multiple lines) */ if (buf[0] == 'F') { - if (0 != grab_one_basic_flag(r_ptr, buf + 2)) + if (0 != grab_monster_race_flag(&r_ptr->flags, buf + 2)) { return (5); } @@ -5721,84 +5482,12 @@ errr init_r_info_txt(FILE *fp) return (6); } - /* Postprocessing */ - for (i = 1; i < max_r_idx; i++) - { - /* Invert flag WILD_ONLY <-> RF8_DUNGEON */ - r_info[i].flags8 ^= 1L; - } - /* Success */ return (0); } /* - * Grab one (basic) flag in a monster_race from a textual string - */ -static errr grab_one_basic_ego_flag(monster_ego *re_ptr, cptr what, bool_ add) -{ - /* Dispatch to correct set of flags */ - u32b *f1 = add ? &re_ptr->mflags1 : &re_ptr->nflags1; - u32b *f2 = add ? &re_ptr->mflags2 : &re_ptr->nflags2; - u32b *f3 = add ? &re_ptr->mflags3 : &re_ptr->nflags3; - u32b *f7 = add ? &re_ptr->mflags7 : &re_ptr->nflags7; - u32b *f8 = add ? &re_ptr->mflags8 : &re_ptr->nflags8; - u32b *f9 = add ? &re_ptr->mflags9 : &re_ptr->nflags9; - - /* Lookup */ - if (lookup_flags(what, - flag_tie(f1, r_info_flags1), - flag_tie(f2, r_info_flags2), - flag_tie(f3, r_info_flags3), - flag_tie(f7, r_info_flags7), - flag_tie(f8, r_info_flags8), - flag_tie(f9, r_info_flags9))) - { - return 0; - } - - /* Oops */ - msg_format("Unknown monster flag '%s'.", what); - - /* Failure */ - return (1); -} - - -/* - * Grab one (basic) flag in a monster_race from a textual string - */ -static errr grab_one_ego_flag(monster_ego *re_ptr, cptr what, bool_ must) -{ - /* Dispatch to correct set of flags */ - u32b *f1 = must ? &re_ptr->flags1 : &re_ptr->hflags1; - u32b *f2 = must ? &re_ptr->flags2 : &re_ptr->hflags2; - u32b *f3 = must ? &re_ptr->flags3 : &re_ptr->hflags3; - u32b *f7 = must ? &re_ptr->flags7 : &re_ptr->hflags7; - u32b *f8 = must ? &re_ptr->flags8 : &re_ptr->hflags8; - u32b *f9 = must ? &re_ptr->flags9 : &re_ptr->hflags9; - - /* Lookup */ - if (lookup_flags(what, - flag_tie(f1, r_info_flags1), - flag_tie(f2, r_info_flags2), - flag_tie(f3, r_info_flags3), - flag_tie(f7, r_info_flags7), - flag_tie(f8, r_info_flags8), - flag_tie(f9, r_info_flags9))) - { - return (0); - } - - /* Oops */ - msg_format("Unknown monster flag '%s'.", what); - - /* Failure */ - return (1); -} - -/* * Initialize the "re_info" array, by parsing an ascii "template" file */ errr init_re_info_txt(FILE *fp) @@ -6042,7 +5731,7 @@ errr init_re_info_txt(FILE *fp) /* Parse this entry */ else { - if (0 != grab_one_ego_flag(re_ptr, s, TRUE)) + if (0 != grab_monster_race_flag(&re_ptr->flags, s)) { return (5); } @@ -6072,7 +5761,7 @@ errr init_re_info_txt(FILE *fp) /* Parse this entry */ else { - if (0 != grab_one_ego_flag(re_ptr, s, FALSE)) + if (0 != grab_monster_race_flag(&re_ptr->hflags, s)) { return (5); } @@ -6085,7 +5774,7 @@ errr init_re_info_txt(FILE *fp) /* Process 'M' for "Basic Monster Flags" (multiple lines) */ if (buf[0] == 'M') { - if (0 != grab_one_basic_ego_flag(re_ptr, buf + 2, TRUE)) + if (0 != grab_monster_race_flag(&re_ptr->mflags, buf + 2)) { return (5); } @@ -6102,13 +5791,12 @@ errr init_re_info_txt(FILE *fp) /* XXX XXX XXX Hack -- Read no flags */ if (!strcmp(s, "MF_ALL")) { - /* No flags */ - re_ptr->nflags1 = re_ptr->nflags2 = re_ptr->nflags3 = re_ptr->nflags7 = re_ptr->nflags8 = re_ptr->nflags9 = 0xFFFFFFFF; + re_ptr->nflags = ~monster_race_flag_set(); } /* Parse this entry */ else { - if (0 != grab_one_basic_ego_flag(re_ptr, s, FALSE)) + if (0 != grab_monster_race_flag(&re_ptr->nflags, s)) { return (5); } @@ -6378,29 +6066,6 @@ errr grab_one_dungeon_flag(dungeon_flag_set *flags, const char *str) return (1); } -/* - * Grab one (basic) flag in a monster_race from a textual string - */ -static errr grab_one_basic_monster_flag(dungeon_info_type *d_ptr, cptr what, byte rule) -{ - if (lookup_flags(what, - flag_tie(&d_ptr->rules[rule].mflags1, r_info_flags1), - flag_tie(&d_ptr->rules[rule].mflags2, r_info_flags2), - flag_tie(&d_ptr->rules[rule].mflags3, r_info_flags3), - flag_tie(&d_ptr->rules[rule].mflags7, r_info_flags7), - flag_tie(&d_ptr->rules[rule].mflags8, r_info_flags8), - flag_tie(&d_ptr->rules[rule].mflags9, r_info_flags9))) - { - return 0; - } - - /* Oops */ - msg_format("Unknown monster flag '%s'.", what); - - /* Failure */ - return (1); -} - /* * Initialize the "d_info" array, by parsing an ascii "template" file @@ -6827,7 +6492,7 @@ errr init_d_info_txt(FILE *fp) /* Parse this entry */ else { - if (0 != grab_one_basic_monster_flag(d_ptr, s, rule_num)) + if (0 != grab_monster_race_flag(&d_ptr->rules[rule_num].mflags, s)) { return (5); } diff --git a/src/init2.cc b/src/init2.cc index 1f6a1907..d0bf5697 100644 --- a/src/init2.cc +++ b/src/init2.cc @@ -23,6 +23,7 @@ #include "modules.hpp" #include "monster_ego.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_type.hpp" #include "object_kind.hpp" #include "owner_type.hpp" @@ -1103,7 +1104,7 @@ static void init_guardians(void) { monster_race *r_ptr = &r_info[d_ptr->final_guardian]; - r_ptr->flags9 |= RF9_SPECIAL_GENE; + r_ptr->flags |= RF_SPECIAL_GENE; /* Mark the final artifact */ if (d_ptr->final_artifact) @@ -1124,7 +1125,7 @@ static void init_guardians(void) /* Give randart if there are no final artifacts */ if (!(d_ptr->final_artifact) && !(d_ptr->final_object)) { - r_ptr->flags7 |= RF7_DROP_RANDART; + r_ptr->flags |= RF_DROP_RANDART; } } } diff --git a/src/melee1.cc b/src/melee1.cc index 4dcf8fa0..89e0660a 100644 --- a/src/melee1.cc +++ b/src/melee1.cc @@ -15,6 +15,7 @@ #include "monster2.hpp" #include "monster3.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_type.hpp" #include "object1.hpp" #include "object2.hpp" @@ -235,7 +236,7 @@ bool_ carried_make_attack_normal(int r_idx) bool_ alive = TRUE; /* Not allowed to attack */ - if (r_ptr->flags1 & RF1_NEVER_BLOW) return (FALSE); + if (r_ptr->flags & RF_NEVER_BLOW) return (FALSE); /* Total armor */ ac = p_ptr->ac + p_ptr->to_a; @@ -280,7 +281,7 @@ bool_ carried_make_attack_normal(int r_idx) /* Hack -- Apply "protection from evil" */ if ((p_ptr->protevil > 0) && - (r_ptr->flags3 & RF3_EVIL) && + (r_ptr->flags & RF_EVIL) && (p_ptr->lev >= rlev) && ((rand_int(100) + p_ptr->lev) > 50)) { @@ -293,7 +294,7 @@ bool_ carried_make_attack_normal(int r_idx) /* Hack -- Apply "protection from good" */ if ((p_ptr->protgood > 0) && - (r_ptr->flags3 & RF3_GOOD) && + (r_ptr->flags & RF_GOOD) && (p_ptr->lev >= rlev) && ((rand_int(100) + p_ptr->lev) > 50)) { @@ -1249,7 +1250,7 @@ bool_ make_attack_normal(int m_idx, byte divis) /* Not allowed to attack? */ auto r_ptr = m_ptr->race(); - if (r_ptr->flags1 & RF1_NEVER_BLOW) return (FALSE); + if (r_ptr->flags & RF_NEVER_BLOW) return (FALSE); /* ...nor if friendly */ if (is_friend(m_ptr) >= 0) @@ -1259,7 +1260,7 @@ bool_ make_attack_normal(int m_idx, byte divis) } /* Cannot attack the player if mortal and player fated to never die by the ... */ - if ((r_ptr->flags7 & RF7_MORTAL) && (p_ptr->no_mortal)) return (FALSE); + if ((r_ptr->flags & RF_MORTAL) && (p_ptr->no_mortal)) return (FALSE); /* Total armor */ ac = p_ptr->ac + p_ptr->to_a; @@ -1435,7 +1436,7 @@ bool_ make_attack_normal(int m_idx, byte divis) if (chance > 50000) chance = 50000; chance -= rlev * 300; - if ((randint(100000) < chance) && (r_ptr->flags3 & RF3_EVIL)) + if ((randint(100000) < chance) && (r_ptr->flags & RF_EVIL)) { /* Message */ msg_format("The hand of Eru Iluvatar stops %s blow.", m_name); @@ -1447,7 +1448,7 @@ bool_ make_attack_normal(int m_idx, byte divis) /* Hack -- Apply "protection from evil" */ if ((p_ptr->protevil > 0) && - (r_ptr->flags3 & RF3_EVIL) && + (r_ptr->flags & RF_EVIL) && (p_ptr->lev >= rlev) && ((rand_int(100) + p_ptr->lev) > 50)) { @@ -1460,7 +1461,7 @@ bool_ make_attack_normal(int m_idx, byte divis) /* Hack -- Apply "protection from good" */ if ((p_ptr->protgood > 0) && - (r_ptr->flags3 & RF3_GOOD) && + (r_ptr->flags & RF_GOOD) && (p_ptr->lev >= rlev) && ((rand_int(100) + p_ptr->lev) > 50)) { @@ -1675,16 +1676,16 @@ bool_ make_attack_normal(int m_idx, byte divis) * a successful blow. Uniques have a better chance. -LM- * Nazgul have a 25% chance */ - if (r_ptr->flags7 & RF7_NAZGUL) + if (r_ptr->flags & RF_NAZGUL) { black_breath_attack(4); } - else if ((m_ptr->level >= 35) && (r_ptr->flags3 & RF3_UNDEAD) && - (r_ptr->flags1 & RF1_UNIQUE)) + else if ((m_ptr->level >= 35) && (r_ptr->flags & RF_UNDEAD) && + (r_ptr->flags & RF_UNIQUE)) { black_breath_attack(300 - m_ptr->level); } - else if ((m_ptr->level >= 40) && (r_ptr->flags3 & RF3_UNDEAD)) + else if ((m_ptr->level >= 40) && (r_ptr->flags & RF_UNDEAD)) { black_breath_attack(450 - m_ptr->level); } @@ -2638,7 +2639,7 @@ bool_ make_attack_normal(int m_idx, byte divis) { if (p_ptr->sh_fire && alive) { - if (!(r_ptr->flags3 & RF3_IM_FIRE)) + if (!(r_ptr->flags & RF_IM_FIRE)) { msg_format("%^s is suddenly very hot!", m_name); if (mon_take_hit(m_idx, damroll(2, 6), &fear, @@ -2652,7 +2653,7 @@ bool_ make_attack_normal(int m_idx, byte divis) if (p_ptr->sh_elec && alive) { - if (!(r_ptr->flags3 & RF3_IM_ELEC)) + if (!(r_ptr->flags & RF_IM_ELEC)) { msg_format("%^s gets zapped!", m_name); if (mon_take_hit(m_idx, damroll(2, 6), &fear, @@ -2677,7 +2678,7 @@ bool_ make_attack_normal(int m_idx, byte divis) if (p_ptr->shield && (p_ptr->shield_opt & SHIELD_FIRE) && alive) { - if (!(r_ptr->flags3 & RF3_IM_FIRE)) + if (!(r_ptr->flags & RF_IM_FIRE)) { msg_format("%^s gets burned by your fiery shield!", m_name); if (mon_take_hit(m_idx, damroll(p_ptr->shield_power_opt, p_ptr->shield_power_opt2), &fear, @@ -2704,7 +2705,7 @@ bool_ make_attack_normal(int m_idx, byte divis) { int tmp; - if ((!(r_ptr->flags1 & RF1_UNIQUE)) && (damroll(p_ptr->shield_power_opt, p_ptr->shield_power_opt2) - m_ptr->level > 0)) + if ((!(r_ptr->flags & RF_UNIQUE)) && (damroll(p_ptr->shield_power_opt, p_ptr->shield_power_opt2) - m_ptr->level > 0)) { msg_format("%^s gets scared away!", m_name); diff --git a/src/melee2.cc b/src/melee2.cc index 3e03c8f6..9d09fb67 100644 --- a/src/melee2.cc +++ b/src/melee2.cc @@ -28,6 +28,7 @@ #include "monster2.hpp" #include "monster3.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_spell.hpp" #include "monster_spell_flag.hpp" #include "monster_type.hpp" @@ -69,7 +70,7 @@ bool_ mon_take_hit_mon(int s_idx, int m_idx, int dam, bool_ *fear, cptr note) /* Some monsters are immune to death */ auto const r_ptr = m_ptr->race(); - if (r_ptr->flags7 & RF7_NO_DEATH) return FALSE; + if (r_ptr->flags & RF_NO_DEATH) return FALSE; /* Wake it up */ m_ptr->csleep = 0; @@ -80,7 +81,7 @@ bool_ mon_take_hit_mon(int s_idx, int m_idx, int dam, bool_ *fear, cptr note) /* It is dead now... or is it? */ if (m_ptr->hp < 0) { - if (((r_ptr->flags1 & RF1_UNIQUE) && (m_ptr->status <= MSTATUS_NEUTRAL_P)) || + if (((r_ptr->flags & RF_UNIQUE) && (m_ptr->status <= MSTATUS_NEUTRAL_P)) || (m_ptr->mflag & MFLAG_QUEST)) { m_ptr->hp = 1; @@ -96,10 +97,10 @@ bool_ mon_take_hit_mon(int s_idx, int m_idx, int dam, bool_ *fear, cptr note) monster_desc(m_name, m_ptr, 0); /* Make a sound */ - if ((r_ptr->flags3 & RF3_DEMON) || - (r_ptr->flags3 & RF3_UNDEAD) || - (r_ptr->flags2 & RF2_STUPID) || - (r_ptr->flags3 & RF3_NONLIVING) || + if ((r_ptr->flags & RF_DEMON) || + (r_ptr->flags & RF_UNDEAD) || + (r_ptr->flags & RF_STUPID) || + (r_ptr->flags & RF_NONLIVING) || (strchr("Evg", r_ptr->d_char))) { sound(SOUND_N_KILL); @@ -120,10 +121,10 @@ bool_ mon_take_hit_mon(int s_idx, int m_idx, int dam, bool_ *fear, cptr note) /* Do nothing */ } /* Death by Physical attack -- non-living monster */ - else if ((r_ptr->flags3 & RF3_DEMON) || - (r_ptr->flags3 & RF3_UNDEAD) || - (r_ptr->flags2 & RF2_STUPID) || - (r_ptr->flags3 & RF3_NONLIVING) || + else if ((r_ptr->flags & RF_DEMON) || + (r_ptr->flags & RF_UNDEAD) || + (r_ptr->flags & RF_STUPID) || + (r_ptr->flags & RF_NONLIVING) || (strchr("Evg", r_ptr->d_char))) { cmonster_msg(TERM_L_RED, "%^s is destroyed.", m_name); @@ -174,7 +175,7 @@ bool_ mon_take_hit_mon(int s_idx, int m_idx, int dam, bool_ *fear, cptr note) } /* When an Unique dies, it stays dead */ - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { r_ptr->max_num = 0; } @@ -231,7 +232,7 @@ void mon_handle_fear(monster_type *m_ptr, int dam, bool_ *fear) /* Sometimes a monster gets scared by damage */ auto const r_ptr = m_ptr->race(); - if (!m_ptr->monfear && !(r_ptr->flags3 & RF3_NO_FEAR)) + if (!m_ptr->monfear && !(r_ptr->flags & RF_NO_FEAR)) { int percentage; @@ -292,7 +293,7 @@ void mon_handle_fear(monster_type *m_ptr, int dam, bool_ *fear) static bool_ int_outof(std::shared_ptr<monster_race> r_ptr, int prob) { /* Non-Smart monsters are half as "smart" */ - if (!(r_ptr->flags2 & RF2_SMART)) prob = prob / 2; + if (!(r_ptr->flags & RF_SMART)) prob = prob / 2; /* Roll the dice */ return (rand_int(100) < prob); @@ -313,7 +314,7 @@ static void remove_bad_spells(int m_idx, monster_spell_flag_set *spells_p) /* Too stupid to know anything? */ auto const r_ptr = m_ptr->race(); - if (r_ptr->flags2 & RF2_STUPID) return; + if (r_ptr->flags & RF_STUPID) return; /* Must be cheating or learning */ @@ -712,7 +713,7 @@ static monster_spell const *choose_attack_spell(int m_idx, std::vector<monster_s /* Stupid monsters choose randomly */ auto const r_ptr = m_ptr->race(); - if (r_ptr->flags2 & RF2_STUPID) + if (r_ptr->flags & RF_STUPID) { /* Pick at random */ return spells[rand_int(spells.size())]; @@ -847,7 +848,7 @@ static void breath(int m_idx, int typ, int dam_hp, int rad) auto const r_ptr = m_ptr->race(); /* Determine the radius of the blast */ - if (rad < 1) rad = (r_ptr->flags2 & RF2_POWERFUL) ? 3 : 2; + if (rad < 1) rad = (r_ptr->flags & RF_POWERFUL) ? 3 : 2; /* Target the player with a ball attack */ (void)project(m_idx, rad, p_ptr->py, p_ptr->px, dam_hp, typ, flg); @@ -867,7 +868,7 @@ static void monst_breath_monst(int m_idx, int y, int x, int typ, int dam_hp, int auto const r_ptr = m_ptr->race(); /* Determine the radius of the blast */ - if (rad < 1) rad = (r_ptr->flags2 & RF2_POWERFUL) ? 3 : 2; + if (rad < 1) rad = (r_ptr->flags & RF_POWERFUL) ? 3 : 2; (void)project(m_idx, rad, y, x, dam_hp, typ, flg); } @@ -1043,7 +1044,7 @@ static bool_ monst_spell_monst(int m_idx) monster_spell_flag_set allowed_spells = r_ptr->spells; /* Hack -- allow "desperate" spells */ - if ((r_ptr->flags2 & RF2_SMART) && + if ((r_ptr->flags & RF_SMART) && (m_ptr->hp < m_ptr->maxhp / 10) && (rand_int(100) < 50)) { @@ -1626,8 +1627,8 @@ static bool_ monst_spell_monst(int m_idx) } /* Attempt a saving throw */ - if ((tr_ptr->flags1 & RF1_UNIQUE) || - (tr_ptr->flags3 & RF3_NO_CONF) || + if ((tr_ptr->flags & RF_UNIQUE) || + (tr_ptr->flags & RF_NO_CONF) || (t_ptr->level > randint((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10)) { /* No obvious effect */ @@ -1663,8 +1664,8 @@ static bool_ monst_spell_monst(int m_idx) } /* Attempt a saving throw */ - if ((tr_ptr->flags1 & RF1_UNIQUE) || - (tr_ptr->flags3 & RF3_NO_CONF) || + if ((tr_ptr->flags & RF_UNIQUE) || + (tr_ptr->flags & RF_NO_CONF) || (t_ptr->level > randint((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10)) { /* No obvious effect */ @@ -1878,7 +1879,7 @@ static bool_ monst_spell_monst(int m_idx) if (disturb_other) disturb(1); if (blind || !see_m) monster_msg("%^s mumbles, and you hear scary noises.", m_name); else monster_msg("%^s casts a fearful illusion at %s.", m_name, t_name); - if (tr_ptr->flags3 & RF3_NO_FEAR) + if (tr_ptr->flags & RF_NO_FEAR) { if (see_t) monster_msg("%^s refuses to be frightened.", t_name); } @@ -1902,7 +1903,7 @@ static bool_ monst_spell_monst(int m_idx) if (blind || !see_m) monster_msg("%^s mumbles.", m_name); else monster_msg("%^s casts a spell, burning %s%s eyes.", m_name, t_name, (!strcmp(t_name, "it") ? "s" : "'s")); - if (tr_ptr->flags3 & RF3_NO_CONF) /* Simulate blindness with confusion */ + if (tr_ptr->flags & RF_NO_CONF) /* Simulate blindness with confusion */ { if (see_t) monster_msg("%^s is unaffected.", t_name); } @@ -1926,7 +1927,7 @@ static bool_ monst_spell_monst(int m_idx) if (disturb_other) disturb(1); if (blind || !see_m) monster_msg("%^s mumbles, and you hear puzzling noises.", m_name); else monster_msg("%^s creates a mesmerising illusion in front of %s.", m_name, t_name); - if (tr_ptr->flags3 & RF3_NO_CONF) + if (tr_ptr->flags & RF_NO_CONF) { if (see_t) monster_msg("%^s disbelieves the feeble spell.", t_name); } @@ -1949,7 +1950,7 @@ static bool_ monst_spell_monst(int m_idx) if (disturb_other) disturb(1); if (!blind && see_either) monster_msg("%^s drains power from %s%s muscles.", m_name, t_name, (!strcmp(t_name, "it") ? "s" : "'s")); - if (tr_ptr->flags1 & RF1_UNIQUE) + if (tr_ptr->flags & RF_UNIQUE) { if (see_t) monster_msg("%^s is unaffected.", t_name); } @@ -1971,8 +1972,8 @@ static bool_ monst_spell_monst(int m_idx) if (!direct) break; if (disturb_other) disturb(1); if (!blind && see_m) monster_msg("%^s stares intently at %s.", m_name, t_name); - if ((tr_ptr->flags1 & RF1_UNIQUE) || - (tr_ptr->flags3 & RF3_NO_STUN)) + if ((tr_ptr->flags & RF_UNIQUE) || + (tr_ptr->flags & RF_NO_STUN)) { if (see_t) monster_msg("%^s is unaffected.", t_name); } @@ -2026,7 +2027,7 @@ static bool_ monst_spell_monst(int m_idx) else if (!blind) monster_msg("%^s invokes the Hand of Doom on %s.", m_name, t_name); else monster_msg ("You hear someone invoke the Hand of Doom!"); - if (tr_ptr->flags1 & RF1_UNIQUE) + if (tr_ptr->flags & RF_UNIQUE) { if (!blind && see_t) monster_msg("^%s is unaffected!", t_name); } @@ -2167,9 +2168,9 @@ static bool_ monst_spell_monst(int m_idx) monster_msg("%^s teleports %s away.", m_name, t_name); - if (tr_ptr->flags3 & RF3_RES_TELE) + if (tr_ptr->flags & RF_RES_TELE) { - if (tr_ptr->flags1 & RF1_UNIQUE) + if (tr_ptr->flags & RF_UNIQUE) { if (see_t) { @@ -2282,7 +2283,7 @@ static bool_ monst_spell_monst(int m_idx) if (blind || !see_m) monster_msg("%^s mumbles.", m_name); else monster_msg("%^s magically summons %s %s.", m_name, m_poss, - ((r_ptr->flags1) & RF1_UNIQUE ? + ((r_ptr->flags) & RF_UNIQUE ? "minions" : "kin")); summon_kin_type = r_ptr->d_char; /* Big hack */ for (int k = 0; k < 6; k++) @@ -2773,7 +2774,7 @@ static bool_ make_attack_spell(int m_idx) /* Cannot attack the player if mortal and player fated to never die by the ... */ auto const r_ptr = m_ptr->race(); - if ((r_ptr->flags7 & RF7_MORTAL) && (p_ptr->no_mortal)) return (FALSE); + if ((r_ptr->flags & RF_MORTAL) && (p_ptr->no_mortal)) return (FALSE); /* Hack -- Extract the spell probability */ chance = (r_ptr->freq_inate + r_ptr->freq_spell) / 2; @@ -2810,7 +2811,7 @@ static bool_ make_attack_spell(int m_idx) } /* Hack -- allow "desperate" spells */ - if ((r_ptr->flags2 & RF2_SMART) && + if ((r_ptr->flags & RF_SMART) && (m_ptr->hp < m_ptr->maxhp / 10) && (rand_int(100) < 50)) { @@ -2829,7 +2830,7 @@ static bool_ make_attack_spell(int m_idx) /* Check for a clean bolt shot */ if ((allowed_spells & SF_BOLT_MASK) && - !(r_ptr->flags2 & RF2_STUPID) && + !(r_ptr->flags & RF_STUPID) && !clean_shot(m_ptr->fy, m_ptr->fx, y, x)) { /* Remove spells that will only hurt friends */ @@ -2838,7 +2839,7 @@ static bool_ make_attack_spell(int m_idx) /* Check for a possible summon */ if ((allowed_spells & SF_SUMMON_MASK) && - !(r_ptr->flags2 & RF2_STUPID) && + !(r_ptr->flags & RF_STUPID) && !(summon_possible(y, x))) { /* Remove summoning spells */ @@ -2873,7 +2874,7 @@ static bool_ make_attack_spell(int m_idx) failrate = 25 - (rlev + 3) / 4; /* Hack -- Stupid monsters will never fail (for jellies and such) */ - if (r_ptr->flags2 & RF2_STUPID) failrate = 0; + if (r_ptr->flags & RF_STUPID) failrate = 0; /* Check for spell failure (inate attacks never fail) */ if ((!thrown_spell->is_innate) && (rand_int(100) < failrate)) @@ -4017,7 +4018,7 @@ static bool_ make_attack_spell(int m_idx) if (blind) msg_format("%^s mumbles.", m_name); else msg_format("%^s magically summons %s %s.", m_name, m_poss, - ((r_ptr->flags1) & RF1_UNIQUE ? + ((r_ptr->flags) & RF_UNIQUE ? "minions" : "kin")); summon_kin_type = r_ptr->d_char; /* Big hack */ @@ -4645,7 +4646,7 @@ static void get_target_monster(int m_idx) if (m_idx == i) continue; /* Cannot be targeted */ - if (rt_ptr->flags7 & RF7_NO_TARGET) continue; + if (rt_ptr->flags & RF_NO_TARGET) continue; if (is_enemy(m_ptr, t_ptr) && (los(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx) && ((dd = distance(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx)) < d))) @@ -4705,13 +4706,13 @@ static bool_ get_moves(int m_idx, int *mm) const auto r_ptr = m_ptr->race(); /* A possessor is not interrested in the player, it only wants a corpse */ - if (r_ptr->flags7 & RF7_POSSESSOR) + if (r_ptr->flags & RF_POSSESSOR) { find_corpse(m_ptr, &y2, &x2); } /* Let quests redefine AI */ - if (r_ptr->flags7 & RF7_AI_SPECIAL) + if (r_ptr->flags & RF_AI_SPECIAL) { struct hook_monster_ai_in in = { m_idx, &m_list[m_idx] }; struct hook_monster_ai_out out = { 0, 0 }; @@ -4724,7 +4725,7 @@ static bool_ get_moves(int m_idx, int *mm) if (m_idx == p_ptr->control) { - if ((r_ptr->flags7 & RF7_AI_PLAYER) || magik(85)) + if ((r_ptr->flags & RF_AI_PLAYER) || magik(85)) { if (distance(p_ptr->py, p_ptr->px, m_ptr->fy, m_ptr->fx) < 50) { @@ -4739,7 +4740,7 @@ static bool_ get_moves(int m_idx, int *mm) int x = m_ptr->fx - x2; /* Tease the player */ - if (r_ptr->flags7 & RF7_AI_ANNOY) + if (r_ptr->flags & RF_AI_ANNOY) { if (distance(m_ptr->fy, m_ptr->fx, y2, x2) < 4) { @@ -4749,7 +4750,7 @@ static bool_ get_moves(int m_idx, int *mm) } /* Death orbs .. */ - if (r_ptr->flags2 & RF2_DEATH_ORB) + if (r_ptr->flags & RF_DEATH_ORB) { if (!los(m_ptr->fy, m_ptr->fx, y2, x2)) { @@ -4765,10 +4766,10 @@ static bool_ get_moves(int m_idx, int *mm) * Animal packs try to get the player out of corridors * (...unless they can move through walls -- TY) */ - if ((r_ptr->flags1 & RF1_FRIENDS) && - (r_ptr->flags3 & RF3_ANIMAL) && - !((r_ptr->flags2 & RF2_PASS_WALL) || - (r_ptr->flags2 & RF2_KILL_WALL))) + if ((r_ptr->flags & RF_FRIENDS) && + (r_ptr->flags & RF_ANIMAL) && + !((r_ptr->flags & RF_PASS_WALL) || + (r_ptr->flags & RF_KILL_WALL))) { int i, room = 0; @@ -4792,7 +4793,7 @@ static bool_ get_moves(int m_idx, int *mm) } /* Monster groups try to surround the player */ - if (!done && (r_ptr->flags1 & RF1_FRIENDS)) + if (!done && (r_ptr->flags & RF_FRIENDS)) { int i; @@ -5075,7 +5076,7 @@ static bool_ monst_attack_monst(int m_idx, int t_idx) const auto tr_ptr = t_ptr->race(); /* Not allowed to attack */ - if (r_ptr->flags1 & RF1_NEVER_BLOW) return FALSE; + if (r_ptr->flags & RF_NEVER_BLOW) return FALSE; /* Total armor */ const int ac = t_ptr->ac; @@ -5487,8 +5488,8 @@ static bool_ monst_attack_monst(int m_idx, int t_idx) if (touched) { /* Aura fire */ - if ((tr_ptr->flags2 & RF2_AURA_FIRE) && - !(r_ptr->flags3 & RF3_IM_FIRE)) + if ((tr_ptr->flags & RF_AURA_FIRE) && + !(r_ptr->flags & RF_IM_FIRE)) { if (m_ptr->ml || t_ptr->ml) { @@ -5502,7 +5503,7 @@ static bool_ monst_attack_monst(int m_idx, int t_idx) } /* Aura elec */ - if ((tr_ptr->flags2 & RF2_AURA_ELEC) && !(r_ptr->flags3 & RF3_IM_ELEC)) + if ((tr_ptr->flags & RF_AURA_ELEC) && !(r_ptr->flags & RF_IM_ELEC)) { if (m_ptr->ml || t_ptr->ml) { @@ -5594,27 +5595,27 @@ static bool_ player_invis(monster_type * m_ptr) s16b inv = p_ptr->invis; s16b mlv = m_ptr->level; - if (r_ptr->flags3 & RF3_NO_SLEEP) + if (r_ptr->flags & RF_NO_SLEEP) mlv += 10; - if (r_ptr->flags3 & RF3_DRAGON) + if (r_ptr->flags & RF_DRAGON) mlv += 20; - if (r_ptr->flags3 & RF3_UNDEAD) + if (r_ptr->flags & RF_UNDEAD) mlv += 15; - if (r_ptr->flags3 & RF3_DEMON) + if (r_ptr->flags & RF_DEMON) mlv += 15; - if (r_ptr->flags3 & RF3_ANIMAL) + if (r_ptr->flags & RF_ANIMAL) mlv += 15; - if (r_ptr->flags3 & RF3_ORC) + if (r_ptr->flags & RF_ORC) mlv -= 15; - if (r_ptr->flags3 & RF3_TROLL) + if (r_ptr->flags & RF_TROLL) mlv -= 10; - if (r_ptr->flags2 & RF2_STUPID) + if (r_ptr->flags & RF_STUPID) mlv /= 2; - if (r_ptr->flags2 & RF2_SMART) + if (r_ptr->flags & RF_SMART) mlv = (mlv * 5) / 4; if (m_ptr->mflag & MFLAG_QUEST) inv = 0; - if (r_ptr->flags2 & RF2_INVISIBLE) + if (r_ptr->flags & RF_INVISIBLE) inv = 0; if (m_ptr->mflag & MFLAG_CONTROL) inv = 0; @@ -5659,7 +5660,7 @@ static void process_monster(int m_idx, bool_ is_frien) const bool_ inv = player_invis(m_ptr); auto const r_ptr = m_ptr->race(); - if (r_ptr->flags9 & RF9_DOPPLEGANGER) doppleganger = m_idx; + if (r_ptr->flags & RF_DOPPLEGANGER) doppleganger = m_idx; /* Handle "bleeding" */ if (m_ptr->bleeding) @@ -5872,12 +5873,12 @@ static void process_monster(int m_idx, bool_ is_frien) bool_ gets_angry = FALSE; /* No one wants to be your friend if you're aggravating */ - if ((m_ptr->status > MSTATUS_NEUTRAL) && (m_ptr->status < MSTATUS_COMPANION) && (p_ptr->aggravate) && !(r_ptr->flags7 & RF7_PET)) + if ((m_ptr->status > MSTATUS_NEUTRAL) && (m_ptr->status < MSTATUS_COMPANION) && (p_ptr->aggravate) && !(r_ptr->flags & RF_PET)) gets_angry = TRUE; /* Paranoia... no friendly uniques outside wizard mode -- TY */ if ((m_ptr->status > MSTATUS_NEUTRAL) && (m_ptr->status < MSTATUS_COMPANION) && !(wizard) && - (r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_PET)) + (r_ptr->flags & RF_UNIQUE) && !(r_ptr->flags & RF_PET)) gets_angry = TRUE; if (gets_angry) @@ -5940,7 +5941,7 @@ static void process_monster(int m_idx, bool_ is_frien) if (randint(SPEAK_CHANCE) == 1) { - if (player_has_los_bold(oy, ox) && (r_ptr->flags2 & RF2_CAN_SPEAK)) + if (player_has_los_bold(oy, ox) && (r_ptr->flags & RF_CAN_SPEAK)) { char m_name[80]; char monmessage[1024]; @@ -6007,8 +6008,8 @@ static void process_monster(int m_idx, bool_ is_frien) } /* 75% random movement */ - else if ((r_ptr->flags1 & (RF1_RAND_50)) && - (r_ptr->flags1 & (RF1_RAND_25)) && + else if ((r_ptr->flags & RF_RAND_50) && + (r_ptr->flags & RF_RAND_25) && (rand_int(100) < 75)) { /* Try four "random" directions */ @@ -6016,7 +6017,7 @@ static void process_monster(int m_idx, bool_ is_frien) } /* 50% random movement */ - else if ((r_ptr->flags1 & (RF1_RAND_50)) && + else if ((r_ptr->flags & RF_RAND_50) && (rand_int(100) < 50)) { /* Try four "random" directions */ @@ -6024,7 +6025,7 @@ static void process_monster(int m_idx, bool_ is_frien) } /* 25% random movement */ - else if ((r_ptr->flags1 & (RF1_RAND_25)) && + else if ((r_ptr->flags & RF_RAND_25) && (rand_int(100) < 25)) { /* Try four "random" directions */ @@ -6087,7 +6088,7 @@ static void process_monster(int m_idx, bool_ is_frien) /* Hack -- check for Glyph of Warding */ if ((c_ptr->feat == FEAT_GLYPH) && - !(r_ptr->flags1 & RF1_NEVER_BLOW)) + !(r_ptr->flags & RF_NEVER_BLOW)) { /* Assume no move allowed */ do_move = FALSE; @@ -6113,7 +6114,7 @@ static void process_monster(int m_idx, bool_ is_frien) } /* Hack -- trees are obstacle */ - else if ((cave[ny][nx].feat == FEAT_TREES) && (r_ptr->flags9 & RF9_KILL_TREES)) + else if ((cave[ny][nx].feat == FEAT_TREES) && (r_ptr->flags & RF_KILL_TREES)) { do_move = TRUE; @@ -6144,28 +6145,28 @@ static void process_monster(int m_idx, bool_ is_frien) /* Some monsters can fly */ - else if ((f_info[c_ptr->feat].flags1 & FF1_CAN_LEVITATE) && (r_ptr->flags7 & RF7_CAN_FLY)) + else if ((f_info[c_ptr->feat].flags1 & FF1_CAN_LEVITATE) && (r_ptr->flags & RF_CAN_FLY)) { /* Pass through walls/doors/rubble */ do_move = TRUE; } /* Some monsters can fly */ - else if ((f_info[c_ptr->feat].flags1 & FF1_CAN_FLY) && (r_ptr->flags7 & RF7_CAN_FLY)) + else if ((f_info[c_ptr->feat].flags1 & FF1_CAN_FLY) && (r_ptr->flags & RF_CAN_FLY)) { /* Pass through trees/... */ do_move = TRUE; } /* Monster moves through walls (and doors) */ - else if ((f_info[c_ptr->feat].flags1 & FF1_CAN_PASS) && (r_ptr->flags2 & RF2_PASS_WALL)) + else if ((f_info[c_ptr->feat].flags1 & FF1_CAN_PASS) && (r_ptr->flags & RF_PASS_WALL)) { /* Pass through walls/doors/rubble */ do_move = TRUE; } /* Monster destroys walls (and doors) */ - else if ((f_info[c_ptr->feat].flags1 & FF1_CAN_PASS) && (r_ptr->flags2 & RF2_KILL_WALL)) + else if ((f_info[c_ptr->feat].flags1 & FF1_CAN_PASS) && (r_ptr->flags & RF_KILL_WALL)) { /* Eat through walls/doors/rubble */ do_move = TRUE; @@ -6186,7 +6187,7 @@ static void process_monster(int m_idx, bool_ is_frien) } /* Monster moves through walls (and doors) */ - else if ((f_info[c_ptr->feat].flags1 & FF1_CAN_PASS) && (r_ptr->flags2 & RF2_PASS_WALL)) + else if ((f_info[c_ptr->feat].flags1 & FF1_CAN_PASS) && (r_ptr->flags & RF_PASS_WALL)) { /* Pass through walls/doors/rubble */ do_move = TRUE; @@ -6194,7 +6195,7 @@ static void process_monster(int m_idx, bool_ is_frien) /* Monster moves through webs */ else if ((f_info[c_ptr->feat].flags1 & FF1_WEB) && - (r_ptr->flags7 & RF7_SPIDER)) + (r_ptr->flags & RF_SPIDER)) { /* Pass through webs */ do_move = TRUE; @@ -6210,7 +6211,7 @@ static void process_monster(int m_idx, bool_ is_frien) /* Take a turn */ do_turn = TRUE; - if ((r_ptr->flags2 & RF2_OPEN_DOOR) && + if ((r_ptr->flags & RF_OPEN_DOOR) && ((is_friend(m_ptr) <= 0) || p_ptr->pet_open_doors)) { /* Closed doors and secret doors */ @@ -6245,7 +6246,7 @@ static void process_monster(int m_idx, bool_ is_frien) } /* Stuck doors -- attempt to bash them down if allowed */ - if (may_bash && (r_ptr->flags2 & RF2_BASH_DOOR) && + if (may_bash && (r_ptr->flags & RF_BASH_DOOR) && ((is_friend(m_ptr) <= 0) || p_ptr->pet_open_doors)) { int k; @@ -6294,7 +6295,7 @@ static void process_monster(int m_idx, bool_ is_frien) } } else if (do_move && (c_ptr->feat == FEAT_MINOR_GLYPH) - && !(r_ptr->flags1 & RF1_NEVER_BLOW)) + && !(r_ptr->flags & RF_NEVER_BLOW)) { /* Assume no move allowed */ do_move = FALSE; @@ -6339,7 +6340,7 @@ static void process_monster(int m_idx, bool_ is_frien) /* Access that cave grid's contents */ y_ptr = &m_list[c_ptr->m_idx]; - if (!(r_ptr->flags3 & RF3_IM_COLD)) + if (!(r_ptr->flags & RF_IM_COLD)) { if ((m_ptr->hp - distance(ny, nx, oy, ox)*2) <= 0) { @@ -6379,7 +6380,7 @@ static void process_monster(int m_idx, bool_ is_frien) /* Some monsters never attack */ if (do_move && (ny == p_ptr->py) && (nx == p_ptr->px) && - (r_ptr->flags1 & RF1_NEVER_BLOW)) + (r_ptr->flags & RF_NEVER_BLOW)) { /* Do not move */ do_move = FALSE; @@ -6416,12 +6417,12 @@ static void process_monster(int m_idx, bool_ is_frien) do_move = FALSE; /* Kill weaker monsters */ - if ((r_ptr->flags2 & RF2_KILL_BODY) && + if ((r_ptr->flags & RF_KILL_BODY) && (r_ptr->mexp > z_ptr->mexp) && (cave_floor_bold(ny, nx)) && /* Friends don't kill friends... */ !((is_friend(m_ptr) > 0) && (is_friend(m2_ptr) > 0)) && /* Uniques aren't faceless monsters in a crowd */ - !(z_ptr->flags1 & RF1_UNIQUE) && + !(z_ptr->flags & RF_UNIQUE) && /* Don't wreck quests */ !(m2_ptr->mflag & (MFLAG_QUEST | MFLAG_QUEST2)) && /* Don't punish summoners for relying on their friends */ @@ -6455,7 +6456,7 @@ static void process_monster(int m_idx, bool_ is_frien) } /* Push past weaker monsters (unless leaving a wall) */ - else if ((r_ptr->flags2 & RF2_MOVE_BODY) && + else if ((r_ptr->flags & RF_MOVE_BODY) && (r_ptr->mexp > z_ptr->mexp) && cave_floor_bold(ny, nx) && (cave_floor_bold(m_ptr->fy, m_ptr->fx))) { @@ -6477,11 +6478,8 @@ static void process_monster(int m_idx, bool_ is_frien) } /* Some monsters never move */ - if (do_move && (r_ptr->flags1 & RF1_NEVER_MOVE)) + if (do_move && (r_ptr->flags & RF_NEVER_MOVE)) { - /* Hack -- memorize lack of attacks */ - /* if (m_ptr->ml) r_ptr->r_flags1 |= RF1_NEVER_MOVE; */ - /* Do not move */ do_move = FALSE; } @@ -6573,7 +6571,7 @@ static void process_monster(int m_idx, bool_ is_frien) if (o_ptr->tval == TV_GOLD) continue; /* Incarnate ? */ - if ((o_ptr->tval == TV_CORPSE) && (r_ptr->flags7 & RF7_POSSESSOR) && + if ((o_ptr->tval == TV_CORPSE) && (r_ptr->flags & RF_POSSESSOR) && ((o_ptr->sval == SV_CORPSE_CORPSE) || (o_ptr->sval == SV_CORPSE_SKELETON))) { if (ai_possessor(m_idx, this_o_idx)) return; @@ -6581,15 +6579,13 @@ static void process_monster(int m_idx, bool_ is_frien) /* Take or Kill objects on the floor */ /* rr9: Pets will no longer pick up/destroy items */ - if ((((r_ptr->flags2 & RF2_TAKE_ITEM) && + if ((((r_ptr->flags & RF_TAKE_ITEM) && ((is_friend(m_ptr) <= 0) || p_ptr->pet_pickup_items)) || - (r_ptr->flags2 & RF2_KILL_ITEM)) && + (r_ptr->flags & RF_KILL_ITEM)) && (is_friend(m_ptr) <= 0)) { u32b f1, f2, f3, f4, f5, esp; - u32b flg3 = 0L; - char m_name[80]; char o_name[80]; @@ -6603,23 +6599,24 @@ static void process_monster(int m_idx, bool_ is_frien) monster_desc(m_name, m_ptr, 0x04); /* React to objects that hurt the monster */ - if (f5 & (TR5_KILL_DEMON)) flg3 |= RF3_DEMON; - if (f5 & (TR5_KILL_UNDEAD)) flg3 |= RF3_UNDEAD; - if (f1 & (TR1_SLAY_DRAGON)) flg3 |= RF3_DRAGON; - if (f1 & (TR1_SLAY_TROLL)) flg3 |= RF3_TROLL; - if (f1 & (TR1_SLAY_GIANT)) flg3 |= RF3_GIANT; - if (f1 & (TR1_SLAY_ORC)) flg3 |= RF3_ORC; - if (f1 & (TR1_SLAY_DEMON)) flg3 |= RF3_DEMON; - if (f1 & (TR1_SLAY_UNDEAD)) flg3 |= RF3_UNDEAD; - if (f1 & (TR1_SLAY_ANIMAL)) flg3 |= RF3_ANIMAL; - if (f1 & (TR1_SLAY_EVIL)) flg3 |= RF3_EVIL; + monster_race_flag_set flg; + if (f5 & (TR5_KILL_DEMON)) flg |= RF_DEMON; + if (f5 & (TR5_KILL_UNDEAD)) flg |= RF_UNDEAD; + if (f1 & (TR1_SLAY_DRAGON)) flg |= RF_DRAGON; + if (f1 & (TR1_SLAY_TROLL)) flg |= RF_TROLL; + if (f1 & (TR1_SLAY_GIANT)) flg |= RF_GIANT; + if (f1 & (TR1_SLAY_ORC)) flg |= RF_ORC; + if (f1 & (TR1_SLAY_DEMON)) flg |= RF_DEMON; + if (f1 & (TR1_SLAY_UNDEAD)) flg |= RF_UNDEAD; + if (f1 & (TR1_SLAY_ANIMAL)) flg |= RF_ANIMAL; + if (f1 & (TR1_SLAY_EVIL)) flg |= RF_EVIL; /* The object cannot be picked up by the monster */ - if (artifact_p(o_ptr) || (r_ptr->flags3 & flg3) || + if (artifact_p(o_ptr) || (r_ptr->flags & flg) || (o_ptr->art_name)) { /* Only give a message for "take_item" */ - if (r_ptr->flags2 & RF2_TAKE_ITEM) + if (r_ptr->flags & RF_TAKE_ITEM) { /* Describe observable situations */ if (m_ptr->ml && player_has_los_bold(ny, nx)) @@ -6632,7 +6629,7 @@ static void process_monster(int m_idx, bool_ is_frien) } /* Pick up the item */ - else if (r_ptr->flags2 & RF2_TAKE_ITEM) + else if (r_ptr->flags & RF_TAKE_ITEM) { /* Describe observable situations */ if (player_has_los_bold(ny, nx)) @@ -6678,7 +6675,7 @@ static void process_monster(int m_idx, bool_ is_frien) } /* Update monster light */ - if (r_ptr->flags9 & RF9_HAS_LITE) p_ptr->update |= (PU_MON_LITE); + if (r_ptr->flags & RF_HAS_LITE) p_ptr->update |= (PU_MON_LITE); } /* Stop when done */ @@ -6810,7 +6807,7 @@ void process_monsters(void) monster_type *m_ptr; /* Check the doppleganger */ - if (doppleganger && !(r_info[m_list[doppleganger].r_idx].flags9 & RF9_DOPPLEGANGER)) + if (doppleganger && !(r_info[m_list[doppleganger].r_idx].flags & RF_DOPPLEGANGER)) doppleganger = 0; /* Hack -- calculate the "player noise" */ diff --git a/src/modules.cc b/src/modules.cc index a0014502..888de4aa 100644 --- a/src/modules.cc +++ b/src/modules.cc @@ -24,6 +24,7 @@ #include "lua_bind.hpp" #include "monster2.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_type.hpp" #include "object2.hpp" #include "object_type.hpp" @@ -780,7 +781,7 @@ static bool_ theme_push_past(void *data, void *in_, void *out_) if (m_ptr->status >= MSTATUS_NEUTRAL) { if (cave_floor_bold(p->y, p->x) || - (mr_ptr->flags2 == RF2_PASS_WALL)) + (mr_ptr->flags == RF_PASS_WALL)) { char buf[128]; diff --git a/src/monster1.cc b/src/monster1.cc index e7c1a35f..9c838af9 100644 --- a/src/monster1.cc +++ b/src/monster1.cc @@ -12,6 +12,7 @@ #include "monster2.hpp" #include "monster_ego.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_spell_flag.hpp" #include "player_type.hpp" #include "util.hpp" @@ -63,26 +64,22 @@ static void roff_aux(std::shared_ptr<monster_race const> r_ptr) cptr vp[64]; /* Shorthand */ - u32b const flags1 = r_ptr->flags1; - u32b const flags2 = r_ptr->flags2; - u32b const flags3 = r_ptr->flags3; - u32b const flags7 = r_ptr->flags7; - u32b const flags9 = r_ptr->flags9; + auto const flags = r_ptr->flags; monster_spell_flag_set spells = r_ptr->spells; /* Extract a gender (if applicable) */ int msex = 0; - if (flags1 & RF1_FEMALE) + if (flags & RF_FEMALE) { msex = 2; } - else if (flags1 & RF1_MALE) + else if (flags & RF_MALE) { msex = 1; } /* Treat uniques differently */ - if (flags1 & RF1_UNIQUE) + if (flags & RF_UNIQUE) { if (r_ptr->max_num == 0) { @@ -120,7 +117,7 @@ static void roff_aux(std::shared_ptr<monster_race const> r_ptr) old = FALSE; /* Describe location */ - if (r_ptr->flags7 & RF7_PET) + if (r_ptr->flags & RF_PET) { text_out(format("%^s is ", wd_he[msex])); text_out_c(TERM_L_BLUE, "friendly"); @@ -174,18 +171,18 @@ static void roff_aux(std::shared_ptr<monster_race const> r_ptr) text_out("moves"); /* Random-ness */ - if ((flags1 & (RF1_RAND_50)) || (flags1 & (RF1_RAND_25))) + if ((flags & RF_RAND_50) || (flags & RF_RAND_25)) { /* Adverb */ - if ((flags1 & (RF1_RAND_50)) && (flags1 & (RF1_RAND_25))) + if ((flags & RF_RAND_50) && (flags & RF_RAND_25)) { text_out(" extremely"); } - else if (flags1 & (RF1_RAND_50)) + else if (flags & RF_RAND_50) { text_out(" somewhat"); } - else if (flags1 & (RF1_RAND_25)) + else if (flags & RF_RAND_25) { text_out(" a bit"); } @@ -217,7 +214,7 @@ static void roff_aux(std::shared_ptr<monster_race const> r_ptr) } /* The code above includes "attack speed" */ - if (flags1 & RF1_NEVER_MOVE) + if (flags & RF_NEVER_MOVE) { /* Introduce */ if (old) @@ -245,7 +242,7 @@ static void roff_aux(std::shared_ptr<monster_race const> r_ptr) /* Describe experience if known */ { /* Introduction */ - if (flags1 & RF1_UNIQUE) + if (flags & RF_UNIQUE) { text_out("Killing this"); } @@ -255,21 +252,21 @@ static void roff_aux(std::shared_ptr<monster_race const> r_ptr) } /* Describe the "quality" */ - if (flags2 & RF2_ELDRITCH_HORROR) text_out_c(TERM_VIOLET, " sanity-blasting"); - if (flags3 & RF3_ANIMAL) text_out_c(TERM_VIOLET, " natural"); - if (flags3 & RF3_EVIL) text_out_c(TERM_VIOLET, " evil"); - if (flags3 & RF3_GOOD) text_out_c(TERM_VIOLET, " good"); - if (flags3 & RF3_UNDEAD) text_out_c(TERM_VIOLET, " undead"); + if (flags & RF_ELDRITCH_HORROR) text_out_c(TERM_VIOLET, " sanity-blasting"); + if (flags & RF_ANIMAL) text_out_c(TERM_VIOLET, " natural"); + if (flags & RF_EVIL) text_out_c(TERM_VIOLET, " evil"); + if (flags & RF_GOOD) text_out_c(TERM_VIOLET, " good"); + if (flags & RF_UNDEAD) text_out_c(TERM_VIOLET, " undead"); /* Describe the "race" */ - if (flags3 & RF3_DRAGON) text_out_c(TERM_VIOLET, " dragon"); - else if (flags3 & RF3_DEMON) text_out_c(TERM_VIOLET, " demon"); - else if (flags3 & RF3_GIANT) text_out_c(TERM_VIOLET, " giant"); - else if (flags3 & RF3_TROLL) text_out_c(TERM_VIOLET, " troll"); - else if (flags3 & RF3_ORC) text_out_c(TERM_VIOLET, " orc"); - else if (flags3 & RF3_THUNDERLORD)text_out_c(TERM_VIOLET, " Thunderlord"); - else if (flags7 & RF7_SPIDER) text_out_c(TERM_VIOLET, " spider"); - else if (flags7 & RF7_NAZGUL) text_out_c(TERM_VIOLET, " Nazgul"); + if (flags & RF_DRAGON) text_out_c(TERM_VIOLET, " dragon"); + else if (flags & RF_DEMON) text_out_c(TERM_VIOLET, " demon"); + else if (flags & RF_GIANT) text_out_c(TERM_VIOLET, " giant"); + else if (flags & RF_TROLL) text_out_c(TERM_VIOLET, " troll"); + else if (flags & RF_ORC) text_out_c(TERM_VIOLET, " orc"); + else if (flags & RF_THUNDERLORD)text_out_c(TERM_VIOLET, " Thunderlord"); + else if (flags & RF_SPIDER) text_out_c(TERM_VIOLET, " spider"); + else if (flags & RF_NAZGUL) text_out_c(TERM_VIOLET, " Nazgul"); else text_out(" creature"); /* Group some variables */ @@ -310,26 +307,26 @@ static void roff_aux(std::shared_ptr<monster_race const> r_ptr) } } - if ((flags2 & RF2_AURA_FIRE) && (flags2 & RF2_AURA_ELEC)) + if ((flags & RF_AURA_FIRE) && (flags & RF_AURA_ELEC)) { text_out(format("%^s is surrounded by ", wd_he[msex])); text_out_c(TERM_VIOLET, "flames and electricity"); text_out(". "); } - else if (flags2 & RF2_AURA_FIRE) + else if (flags & RF_AURA_FIRE) { text_out(format("%^s is surrounded by ", wd_he[msex])); text_out_c(TERM_ORANGE, "flames"); text_out(". "); } - else if (flags2 & RF2_AURA_ELEC) + else if (flags & RF_AURA_ELEC) { text_out(format("%^s is surrounded by ", wd_he[msex])); text_out_c(TERM_L_BLUE, "electricity"); text_out(". "); } - if (flags2 & RF2_REFLECTING) + if (flags & RF_REFLECTING) { text_out(format("%^s ", wd_he[msex])); text_out_c(TERM_L_UMBER, "reflects"); @@ -338,14 +335,14 @@ static void roff_aux(std::shared_ptr<monster_race const> r_ptr) /* Describe escorts */ - if ((flags1 & RF1_ESCORT) || (flags1 & RF1_ESCORTS)) + if ((flags & RF_ESCORT) || (flags & RF_ESCORTS)) { text_out(format("%^s usually appears with escorts. ", wd_he[msex])); } /* Describe friends */ - else if ((flags1 & RF1_FRIEND) || (flags1 & RF1_FRIENDS)) + else if ((flags & RF_FRIEND) || (flags & RF_FRIENDS)) { text_out(format("%^s usually appears in groups. ", wd_he[msex])); @@ -522,7 +519,7 @@ static void roff_aux(std::shared_ptr<monster_race const> r_ptr) text_out(" magical, casting spells"); /* Adverb */ - if (flags2 & RF2_SMART) text_out_c(TERM_YELLOW, " intelligently"); + if (flags & RF_SMART) text_out_c(TERM_YELLOW, " intelligently"); /* Scan */ for (n = 0; n < vn; n++) @@ -562,7 +559,7 @@ static void roff_aux(std::shared_ptr<monster_race const> r_ptr) text_out_c(TERM_L_GREEN, format("%d", r_ptr->ac)); /* Maximized hitpoints */ - if (flags1 & RF1_FORCE_MAXHP) + if (flags & RF_FORCE_MAXHP) { text_out(" and a life rating of "); text_out_c(TERM_L_GREEN, format("%d", r_ptr->hdice * r_ptr->hside)); @@ -582,15 +579,15 @@ static void roff_aux(std::shared_ptr<monster_race const> r_ptr) /* Collect special abilities. */ vn = 0; - if (flags2 & RF2_OPEN_DOOR) vp[vn++] = "open doors"; - if (flags2 & RF2_BASH_DOOR) vp[vn++] = "bash down doors"; - if (flags2 & RF2_PASS_WALL) vp[vn++] = "pass through walls"; - if (flags2 & RF2_KILL_WALL) vp[vn++] = "bore through walls"; - if (flags2 & RF2_MOVE_BODY) vp[vn++] = "push past weaker monsters"; - if (flags2 & RF2_KILL_BODY) vp[vn++] = "destroy weaker monsters"; - if (flags2 & RF2_TAKE_ITEM) vp[vn++] = "pick up objects"; - if (flags2 & RF2_KILL_ITEM) vp[vn++] = "destroy objects"; - if (flags9 & RF9_HAS_LITE) vp[vn++] = "illuminate the dungeon"; + if (flags & RF_OPEN_DOOR) vp[vn++] = "open doors"; + if (flags & RF_BASH_DOOR) vp[vn++] = "bash down doors"; + if (flags & RF_PASS_WALL) vp[vn++] = "pass through walls"; + if (flags & RF_KILL_WALL) vp[vn++] = "bore through walls"; + if (flags & RF_MOVE_BODY) vp[vn++] = "push past weaker monsters"; + if (flags & RF_KILL_BODY) vp[vn++] = "destroy weaker monsters"; + if (flags & RF_TAKE_ITEM) vp[vn++] = "pick up objects"; + if (flags & RF_KILL_ITEM) vp[vn++] = "destroy objects"; + if (flags & RF_HAS_LITE) vp[vn++] = "illuminate the dungeon"; /* Describe special abilities. */ if (vn) @@ -616,19 +613,19 @@ static void roff_aux(std::shared_ptr<monster_race const> r_ptr) /* Describe special abilities. */ - if (flags2 & RF2_INVISIBLE) + if (flags & RF_INVISIBLE) { text_out_c(TERM_GREEN, format("%^s is invisible. ", wd_he[msex])); } - if (flags2 & RF2_COLD_BLOOD) + if (flags & RF_COLD_BLOOD) { text_out(format("%^s is cold blooded. ", wd_he[msex])); } - if (flags2 & RF2_EMPTY_MIND) + if (flags & RF_EMPTY_MIND) { text_out(format("%^s is not detected by telepathy. ", wd_he[msex])); } - if (flags2 & RF2_WEIRD_MIND) + if (flags & RF_WEIRD_MIND) { text_out(format("%^s is rarely detected by telepathy. ", wd_he[msex])); } @@ -636,12 +633,12 @@ static void roff_aux(std::shared_ptr<monster_race const> r_ptr) { text_out_c(TERM_L_UMBER, format("%^s breeds explosively. ", wd_he[msex])); } - if (flags2 & RF2_REGENERATE) + if (flags & RF_REGENERATE) { text_out_c(TERM_L_WHITE, format("%^s regenerates quickly. ", wd_he[msex])); } - if (r_ptr->flags7 & RF7_MORTAL) + if (r_ptr->flags & RF_MORTAL) { text_out_c(TERM_RED, format("%^s is a mortal being. ", wd_he[msex])); } @@ -653,37 +650,37 @@ static void roff_aux(std::shared_ptr<monster_race const> r_ptr) /* Collect susceptibilities */ vn = 0; - if (flags3 & RF3_HURT_ROCK) + if (flags & RF_HURT_ROCK) { vp[vn++] = "rock remover"; color[vn - 1] = TERM_UMBER; } - if (flags3 & RF3_HURT_LITE) + if (flags & RF_HURT_LITE) { vp[vn++] = "bright light"; color[vn - 1] = TERM_YELLOW; } - if (flags3 & RF3_SUSCEP_FIRE) + if (flags & RF_SUSCEP_FIRE) { vp[vn++] = "fire"; color[vn - 1] = TERM_RED; } - if (flags3 & RF3_SUSCEP_COLD) + if (flags & RF_SUSCEP_COLD) { vp[vn++] = "cold"; color[vn - 1] = TERM_L_WHITE; } - if (flags9 & RF9_SUSCEP_ACID) + if (flags & RF_SUSCEP_ACID) { vp[vn++] = "acid"; color[vn - 1] = TERM_GREEN; } - if (flags9 & RF9_SUSCEP_ELEC) + if (flags & RF_SUSCEP_ELEC) { vp[vn++] = "lightning"; color[vn - 1] = TERM_L_BLUE; } - if (flags9 & RF9_SUSCEP_POIS) + if (flags & RF_SUSCEP_POIS) { vp[vn++] = "poison"; color[vn - 1] = TERM_L_GREEN; @@ -714,27 +711,27 @@ static void roff_aux(std::shared_ptr<monster_race const> r_ptr) /* Collect immunities */ vn = 0; - if (flags3 & RF3_IM_ACID) + if (flags & RF_IM_ACID) { vp[vn++] = "acid"; color[vn - 1] = TERM_L_GREEN; } - if (flags3 & RF3_IM_ELEC) + if (flags & RF_IM_ELEC) { vp[vn++] = "lightning"; color[vn - 1] = TERM_L_BLUE; } - if (flags3 & RF3_IM_FIRE) + if (flags & RF_IM_FIRE) { vp[vn++] = "fire"; color[vn - 1] = TERM_L_RED; } - if (flags3 & RF3_IM_COLD) + if (flags & RF_IM_COLD) { vp[vn++] = "cold"; color[vn - 1] = TERM_L_BLUE; } - if (flags3 & RF3_IM_POIS) + if (flags & RF_IM_POIS) { vp[vn++] = "poison"; color[vn - 1] = TERM_L_GREEN; @@ -765,12 +762,12 @@ static void roff_aux(std::shared_ptr<monster_race const> r_ptr) /* Collect resistances */ vn = 0; - if (flags3 & RF3_RES_NETH) vp[vn++] = "nether"; - if (flags3 & RF3_RES_WATE) vp[vn++] = "water"; - if (flags3 & RF3_RES_PLAS) vp[vn++] = "plasma"; - if (flags3 & RF3_RES_NEXU) vp[vn++] = "nexus"; - if (flags3 & RF3_RES_DISE) vp[vn++] = "disenchantment"; - if (flags3 & RF3_RES_TELE) vp[vn++] = "teleportation"; + if (flags & RF_RES_NETH) vp[vn++] = "nether"; + if (flags & RF_RES_WATE) vp[vn++] = "water"; + if (flags & RF_RES_PLAS) vp[vn++] = "plasma"; + if (flags & RF_RES_NEXU) vp[vn++] = "nexus"; + if (flags & RF_RES_DISE) vp[vn++] = "disenchantment"; + if (flags & RF_RES_TELE) vp[vn++] = "teleportation"; /* Describe resistances */ if (vn) @@ -797,10 +794,10 @@ static void roff_aux(std::shared_ptr<monster_race const> r_ptr) /* Collect non-effects */ vn = 0; - if (flags3 & RF3_NO_STUN) vp[vn++] = "stunned"; - if (flags3 & RF3_NO_FEAR) vp[vn++] = "frightened"; - if (flags3 & RF3_NO_CONF) vp[vn++] = "confused"; - if (flags3 & RF3_NO_SLEEP) vp[vn++] = "slept"; + if (flags & RF_NO_STUN) vp[vn++] = "stunned"; + if (flags & RF_NO_FEAR) vp[vn++] = "frightened"; + if (flags & RF_NO_CONF) vp[vn++] = "confused"; + if (flags & RF_NO_SLEEP) vp[vn++] = "slept"; /* Describe non-effects */ if (vn) @@ -886,15 +883,15 @@ static void roff_aux(std::shared_ptr<monster_race const> r_ptr) byte drop_item; drop_gold = drop_item = - (((r_ptr->flags1 & (RF1_DROP_4D2)) ? 8 : 0) + - ((r_ptr->flags1 & (RF1_DROP_3D2)) ? 6 : 0) + - ((r_ptr->flags1 & (RF1_DROP_2D2)) ? 4 : 0) + - ((r_ptr->flags1 & (RF1_DROP_1D2)) ? 2 : 0) + - ((r_ptr->flags1 & (RF1_DROP_90)) ? 1 : 0) + - ((r_ptr->flags1 & (RF1_DROP_60)) ? 1 : 0)); + (((r_ptr->flags & RF_DROP_4D2) ? 8 : 0) + + ((r_ptr->flags & RF_DROP_3D2) ? 6 : 0) + + ((r_ptr->flags & RF_DROP_2D2) ? 4 : 0) + + ((r_ptr->flags & RF_DROP_1D2) ? 2 : 0) + + ((r_ptr->flags & RF_DROP_90) ? 1 : 0) + + ((r_ptr->flags & RF_DROP_60) ? 1 : 0)); - if (r_ptr->flags1 & RF1_ONLY_GOLD) drop_item = 0; - if (r_ptr->flags1 & RF1_ONLY_ITEM) drop_gold = 0; + if (r_ptr->flags & RF_ONLY_GOLD) drop_item = 0; + if (r_ptr->flags & RF_ONLY_ITEM) drop_gold = 0; /* No "n" needed */ sin = FALSE; @@ -924,13 +921,13 @@ static void roff_aux(std::shared_ptr<monster_race const> r_ptr) /* Great */ - if (flags1 & RF1_DROP_GREAT) + if (flags & RF_DROP_GREAT) { p = " exceptional"; } /* Good (no "n" needed) */ - else if (flags1 & RF1_DROP_GOOD) + else if (flags & RF_DROP_GOOD) { p = " good"; sin = FALSE; @@ -1240,7 +1237,7 @@ static void roff_aux(std::shared_ptr<monster_race const> r_ptr) } /* Notice lack of attacks */ - else if (flags1 & RF1_NEVER_BLOW) + else if (flags & RF_NEVER_BLOW) { text_out(format("%^s has no physical attacks. ", wd_he[msex])); } @@ -1272,7 +1269,7 @@ static void roff_name(int r_idx, int ego) const byte a2 = r_ptr->x_attr; /* A title (use "The" for non-uniques) */ - if (!(r_ptr->flags1 & RF1_UNIQUE)) + if (!(r_ptr->flags & RF_UNIQUE)) { Term_addstr( -1, TERM_WHITE, "The "); } @@ -1382,10 +1379,10 @@ bool_ monster_quest(int r_idx) monster_race *r_ptr = &r_info[r_idx]; /* Random quests are in the dungeon */ - if (!(r_ptr->flags8 & RF8_DUNGEON)) return FALSE; + if (r_ptr->flags & RF_WILD_ONLY) return FALSE; /* No random quests for aquatic monsters */ - if (r_ptr->flags7 & RF7_AQUATIC) return FALSE; + if (r_ptr->flags & RF_AQUATIC) return FALSE; /* No random quests for multiplying monsters */ if (r_ptr->spells & SF_MULTIPLY) return FALSE; @@ -1398,7 +1395,7 @@ bool_ monster_dungeon(int r_idx) { monster_race *r_ptr = &r_info[r_idx]; - if (r_ptr->flags8 & RF8_DUNGEON) + if (!(r_ptr->flags & RF_WILD_ONLY)) return TRUE; else return FALSE; @@ -1409,7 +1406,7 @@ static bool_ monster_ocean(int r_idx) { monster_race *r_ptr = &r_info[r_idx]; - if (r_ptr->flags8 & RF8_WILD_OCEAN) + if (r_ptr->flags & RF_WILD_OCEAN) return TRUE; else return FALSE; @@ -1420,7 +1417,7 @@ static bool_ monster_shore(int r_idx) { monster_race *r_ptr = &r_info[r_idx]; - if (r_ptr->flags8 & RF8_WILD_SHORE) + if (r_ptr->flags & RF_WILD_SHORE) return TRUE; else return FALSE; @@ -1431,7 +1428,7 @@ static bool_ monster_waste(int r_idx) { monster_race *r_ptr = &r_info[r_idx]; - if (r_ptr->flags8 & RF8_WILD_WASTE) + if (r_ptr->flags & RF_WILD_WASTE) return TRUE; else return FALSE; @@ -1442,7 +1439,7 @@ static bool_ monster_town(int r_idx) { monster_race *r_ptr = &r_info[r_idx]; - if (r_ptr->flags8 & RF8_WILD_TOWN) + if (r_ptr->flags & RF_WILD_TOWN) return TRUE; else return FALSE; @@ -1453,7 +1450,7 @@ static bool_ monster_wood(int r_idx) { monster_race *r_ptr = &r_info[r_idx]; - if (r_ptr->flags8 & RF8_WILD_WOOD) + if (r_ptr->flags & RF_WILD_WOOD) return TRUE; else return FALSE; @@ -1464,7 +1461,7 @@ static bool_ monster_volcano(int r_idx) { monster_race *r_ptr = &r_info[r_idx]; - if (r_ptr->flags8 & RF8_WILD_VOLCANO) + if (r_ptr->flags & RF_WILD_VOLCANO) return TRUE; else return FALSE; @@ -1475,7 +1472,7 @@ static bool_ monster_mountain(int r_idx) { monster_race *r_ptr = &r_info[r_idx]; - if (r_ptr->flags8 & RF8_WILD_MOUNTAIN) + if (r_ptr->flags & RF_WILD_MOUNTAIN) return TRUE; else return FALSE; @@ -1486,7 +1483,7 @@ static bool_ monster_grass(int r_idx) { monster_race *r_ptr = &r_info[r_idx]; - if (r_ptr->flags8 & RF8_WILD_GRASS) + if (r_ptr->flags & RF_WILD_GRASS) return TRUE; else return FALSE; @@ -1499,7 +1496,7 @@ static bool_ monster_deep_water(int r_idx) if (!monster_dungeon(r_idx)) return FALSE; - if (r_ptr->flags7 & RF7_AQUATIC) + if (r_ptr->flags & RF_AQUATIC) return TRUE; else return FALSE; @@ -1512,7 +1509,7 @@ static bool_ monster_shallow_water(int r_idx) if (!monster_dungeon(r_idx)) return FALSE; - if (r_ptr->flags2 & RF2_AURA_FIRE) + if (r_ptr->flags & RF_AURA_FIRE) return FALSE; else return TRUE; @@ -1525,9 +1522,9 @@ static bool_ monster_lava(int r_idx) if (!monster_dungeon(r_idx)) return FALSE; - if (((r_ptr->flags3 & RF3_IM_FIRE) || - (r_ptr->flags7 & RF7_CAN_FLY)) && - !(r_ptr->flags3 & RF3_AURA_COLD)) + if (((r_ptr->flags & RF_IM_FIRE) || + (r_ptr->flags & RF_CAN_FLY)) && + !(r_ptr->flags & RF_AURA_COLD)) return TRUE; else return FALSE; @@ -1585,9 +1582,9 @@ bool_ monster_can_cross_terrain(byte feat, std::shared_ptr<monster_race> r_ptr) /* Deep water */ if (feat == FEAT_DEEP_WATER) { - if ((r_ptr->flags7 & RF7_AQUATIC) || - (r_ptr->flags7 & RF7_CAN_FLY) || - (r_ptr->flags7 & RF7_CAN_SWIM)) + if ((r_ptr->flags & RF_AQUATIC) || + (r_ptr->flags & RF_CAN_FLY) || + (r_ptr->flags & RF_CAN_SWIM)) return TRUE; else return FALSE; @@ -1595,14 +1592,14 @@ bool_ monster_can_cross_terrain(byte feat, std::shared_ptr<monster_race> r_ptr) /* Shallow water */ else if (feat == FEAT_SHAL_WATER) { - if (r_ptr->flags2 & RF2_AURA_FIRE) + if (r_ptr->flags & RF_AURA_FIRE) return FALSE; else return TRUE; } /* Aquatic monster */ - else if ((r_ptr->flags7 & RF7_AQUATIC) && - !(r_ptr->flags7 & RF7_CAN_FLY)) + else if ((r_ptr->flags & RF_AQUATIC) && + !(r_ptr->flags & RF_CAN_FLY)) { return FALSE; } @@ -1610,8 +1607,8 @@ bool_ monster_can_cross_terrain(byte feat, std::shared_ptr<monster_race> r_ptr) else if ((feat == FEAT_SHAL_LAVA) || (feat == FEAT_DEEP_LAVA)) { - if ((r_ptr->flags3 & RF3_IM_FIRE) || - (r_ptr->flags7 & RF7_CAN_FLY)) + if ((r_ptr->flags & RF_IM_FIRE) || + (r_ptr->flags & RF_CAN_FLY)) return TRUE; else return FALSE; diff --git a/src/monster2.cc b/src/monster2.cc index b387b495..52b342d4 100644 --- a/src/monster2.cc +++ b/src/monster2.cc @@ -22,6 +22,7 @@ #include "monster3.hpp" #include "monster_ego.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_spell_flag.hpp" #include "monster_type.hpp" #include "object1.hpp" @@ -173,20 +174,10 @@ bool_ mego_ok(monster_race const *r_ptr, int ego) int i; /* needed flags */ - if (re_ptr->flags1 && ((re_ptr->flags1 & r_ptr->flags1) != re_ptr->flags1)) return FALSE; - if (re_ptr->flags2 && ((re_ptr->flags2 & r_ptr->flags2) != re_ptr->flags2)) return FALSE; - if (re_ptr->flags3 && ((re_ptr->flags3 & r_ptr->flags3) != re_ptr->flags3)) return FALSE; - if (re_ptr->flags7 && ((re_ptr->flags7 & r_ptr->flags7) != re_ptr->flags7)) return FALSE; - if (re_ptr->flags8 && ((re_ptr->flags8 & r_ptr->flags8) != re_ptr->flags8)) return FALSE; - if (re_ptr->flags9 && ((re_ptr->flags9 & r_ptr->flags9) != re_ptr->flags9)) return FALSE; + if (re_ptr->flags && ((re_ptr->flags & r_ptr->flags) != re_ptr->flags)) return FALSE; /* unwanted flags */ - if (re_ptr->hflags1 && (re_ptr->hflags1 & r_ptr->flags1)) return FALSE; - if (re_ptr->hflags2 && (re_ptr->hflags2 & r_ptr->flags2)) return FALSE; - if (re_ptr->hflags3 && (re_ptr->hflags3 & r_ptr->flags3)) return FALSE; - if (re_ptr->hflags7 && (re_ptr->hflags7 & r_ptr->flags7)) return FALSE; - if (re_ptr->hflags8 && (re_ptr->hflags8 & r_ptr->flags8)) return FALSE; - if (re_ptr->hflags9 && (re_ptr->hflags9 & r_ptr->flags9)) return FALSE; + if (re_ptr->hflags && (re_ptr->hflags & r_ptr->flags)) return FALSE; /* Need good race -- IF races are specified */ if (re_ptr->r_char[0]) @@ -331,21 +322,11 @@ std::shared_ptr<monster_race> race_info_idx(int r_idx, int ego) MODIFY(nr_ptr->level, re_ptr->level, 1); /* Take off some flags */ - nr_ptr->flags1 &= ~(re_ptr->nflags1); - nr_ptr->flags2 &= ~(re_ptr->nflags2); - nr_ptr->flags3 &= ~(re_ptr->nflags3); - nr_ptr->flags7 &= ~(re_ptr->nflags7); - nr_ptr->flags8 &= ~(re_ptr->nflags8); - nr_ptr->flags9 &= ~(re_ptr->nflags9); + nr_ptr->flags &= ~re_ptr->nflags; nr_ptr->spells &= ~(re_ptr->nspells); /* Add some flags */ - nr_ptr->flags1 |= re_ptr->mflags1; - nr_ptr->flags2 |= re_ptr->mflags2; - nr_ptr->flags3 |= re_ptr->mflags3; - nr_ptr->flags7 |= re_ptr->mflags7; - nr_ptr->flags8 |= re_ptr->mflags8; - nr_ptr->flags9 |= re_ptr->mflags9; + nr_ptr->flags |= re_ptr->mflags; nr_ptr->spells |= re_ptr->mspells; /* Change the char/attr is needed */ @@ -453,7 +434,7 @@ void delete_monster_idx(int i) /* XXX XXX XXX remove monster light source */ bool_ had_lite = FALSE; - if (r_ptr->flags9 & RF9_HAS_LITE) had_lite = TRUE; + if (r_ptr->flags & RF_HAS_LITE) had_lite = TRUE; /* Hack -- remove target monster */ @@ -679,7 +660,7 @@ void compact_monsters(int size) if ((m_ptr->mflag & MFLAG_QUEST) && (cnt < 1000)) chance = 100; /* Try not to compact Unique Monsters */ - if (r_ptr->flags1 & RF1_UNIQUE) chance = 99; + if (r_ptr->flags & RF_UNIQUE) chance = 99; /* All monsters get a saving throw */ if (rand_int(100) < chance) continue; @@ -866,34 +847,9 @@ bool_ apply_rule(monster_race *r_ptr, byte rule) { int a; - if (d_ptr->rules[rule].mflags1) + if (d_ptr->rules[rule].mflags) { - if ((d_ptr->rules[rule].mflags1 & r_ptr->flags1) != d_ptr->rules[rule].mflags1) - return FALSE; - } - if (d_ptr->rules[rule].mflags2) - { - if ((d_ptr->rules[rule].mflags2 & r_ptr->flags2) != d_ptr->rules[rule].mflags2) - return FALSE; - } - if (d_ptr->rules[rule].mflags3) - { - if ((d_ptr->rules[rule].mflags3 & r_ptr->flags3) != d_ptr->rules[rule].mflags3) - return FALSE; - } - if (d_ptr->rules[rule].mflags7) - { - if ((d_ptr->rules[rule].mflags7 & r_ptr->flags7) != d_ptr->rules[rule].mflags7) - return FALSE; - } - if (d_ptr->rules[rule].mflags8) - { - if ((d_ptr->rules[rule].mflags8 & r_ptr->flags8) != d_ptr->rules[rule].mflags8) - return FALSE; - } - if (d_ptr->rules[rule].mflags9) - { - if ((d_ptr->rules[rule].mflags9 & r_ptr->flags9) != d_ptr->rules[rule].mflags9) + if ((d_ptr->rules[rule].mflags & r_ptr->flags) != d_ptr->rules[rule].mflags) return FALSE; } if (d_ptr->rules[rule].mspells) @@ -913,13 +869,7 @@ bool_ apply_rule(monster_race *r_ptr, byte rule) { int a; - if (d_ptr->rules[rule].mflags1 && (r_ptr->flags1 & d_ptr->rules[rule].mflags1)) return TRUE; - if (d_ptr->rules[rule].mflags2 && (r_ptr->flags2 & d_ptr->rules[rule].mflags2)) return TRUE; - if (d_ptr->rules[rule].mflags3 && (r_ptr->flags3 & d_ptr->rules[rule].mflags3)) return TRUE; - if (d_ptr->rules[rule].mflags7 && (r_ptr->flags7 & d_ptr->rules[rule].mflags7)) return TRUE; - if (d_ptr->rules[rule].mflags8 && (r_ptr->flags8 & d_ptr->rules[rule].mflags8)) return TRUE; - if (d_ptr->rules[rule].mflags9 && (r_ptr->flags9 & d_ptr->rules[rule].mflags9)) return TRUE; - + if (d_ptr->rules[rule].mflags && (r_ptr->flags & d_ptr->rules[rule].mflags)) return TRUE; if (d_ptr->rules[rule].mspells && (r_ptr->spells & d_ptr->rules[rule].mspells)) return TRUE; for (a = 0; a < 5; a++) @@ -1040,20 +990,20 @@ s16b get_mon_num(int level) r_ptr = &r_info[r_idx]; /* Hack -- "unique" monsters must be "unique" */ - if ((r_ptr->flags1 & RF1_UNIQUE) && + if ((r_ptr->flags & RF_UNIQUE) && (r_ptr->cur_num >= r_ptr->max_num)) { continue; } /* Depth Monsters never appear out of depth */ - if ((r_ptr->flags1 & RF1_FORCE_DEPTH) && (r_ptr->level > dun_level)) + if ((r_ptr->flags & RF_FORCE_DEPTH) && (r_ptr->level > dun_level)) { continue; } /* Depth Monsters never appear out of their depth */ - if ((r_ptr->flags9 & RF9_ONLY_DEPTH) && (r_ptr->level != dun_level)) + if ((r_ptr->flags & RF_ONLY_DEPTH) && (r_ptr->level != dun_level)) { continue; } @@ -1061,14 +1011,14 @@ s16b get_mon_num(int level) if(in_tome) { /* Zangbandish monsters not allowed */ - if (r_ptr->flags8 & RF8_ZANGBAND) continue; + if (r_ptr->flags & RF_ZANGBAND) continue; /* Lovecraftian monsters not allowed */ - if (r_ptr->flags8 & RF8_CTHANGBAND) continue; + if (r_ptr->flags & RF_CTHANGBAND) continue; } /* Joke monsters allowed ? or not ? */ - if (!joke_monsters && (r_ptr->flags8 & RF8_JOKEANGBAND)) continue; + if (!joke_monsters && (r_ptr->flags & RF_JOKEANGBAND)) continue; /* Some dungeon types restrict the possible monsters */ if (!summon_hack && !restrict_monster_to_dungeon(r_idx) && dun_level) continue; @@ -1239,7 +1189,7 @@ void monster_desc(char *desc, monster_type *m_ptr, int mode) { hallu_race = &r_info[randint(max_r_idx - 2)]; } - while ((hallu_race->flags1 & RF1_UNIQUE) && (hallu_race->name != nullptr)); + while ((hallu_race->flags & RF_UNIQUE) && (hallu_race->name != nullptr)); strcpy(silly_name, hallu_race->name); } @@ -1264,8 +1214,8 @@ void monster_desc(char *desc, monster_type *m_ptr, int mode) int kind = 0x00; /* Extract the gender (if applicable) */ - if (r_ptr->flags1 & RF1_FEMALE) kind = 0x20; - else if (r_ptr->flags1 & RF1_MALE) kind = 0x10; + if (r_ptr->flags & RF_FEMALE) kind = 0x20; + else if (r_ptr->flags & RF_MALE) kind = 0x10; /* Ignore the gender (if desired) */ if (!m_ptr || !pron) kind = 0x00; @@ -1365,8 +1315,8 @@ void monster_desc(char *desc, monster_type *m_ptr, int mode) else if ((mode & 0x02) && (mode & 0x01)) { /* The monster is visible, so use its gender */ - if (r_ptr->flags1 & RF1_FEMALE) strcpy(desc, "herself"); - else if (r_ptr->flags1 & RF1_MALE) strcpy(desc, "himself"); + if (r_ptr->flags & RF_FEMALE) strcpy(desc, "herself"); + else if (r_ptr->flags & RF_MALE) strcpy(desc, "himself"); else strcpy(desc, "itself"); } @@ -1375,7 +1325,7 @@ void monster_desc(char *desc, monster_type *m_ptr, int mode) else { /* It could be a Unique */ - if ((r_ptr->flags1 & RF1_UNIQUE) && !(p_ptr->image)) + if ((r_ptr->flags & RF_UNIQUE) && !(p_ptr->image)) { /* Start with the name (thus nominative and objective) */ (void)strcpy(desc, name); @@ -1436,7 +1386,7 @@ void monster_race_desc(char *desc, int r_idx, int ego) } /* It could be a Unique */ - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { /* Start with the name (thus nominative and objective) */ (void)strcpy(desc, name); @@ -1474,9 +1424,9 @@ static void sanity_blast(monster_type * m_ptr, bool_ necro) char m_name[80]; monster_desc(m_name, m_ptr, 0); - if (!(r_ptr->flags1 & RF1_UNIQUE)) + if (!(r_ptr->flags & RF_UNIQUE)) { - if (r_ptr->flags1 & RF1_FRIENDS) + if (r_ptr->flags & RF_FRIENDS) power /= 2; } else power *= 2; @@ -1487,7 +1437,7 @@ static void sanity_blast(monster_type * m_ptr, bool_ necro) if (!(m_ptr->ml)) return ; /* Cannot see it for some reason */ - if (!(r_ptr->flags2 & RF2_ELDRITCH_HORROR)) + if (!(r_ptr->flags & RF_ELDRITCH_HORROR)) return ; /* oops */ @@ -1703,7 +1653,7 @@ void update_mon(int m_idx, bool_ full) { /* Infravision only works on "warm" creatures */ /* Below, we will need to know that infravision failed */ - if (!(r_ptr->flags2 & RF2_COLD_BLOOD)) + if (!(r_ptr->flags & RF_COLD_BLOOD)) { /* Infravision works */ easy = flag = TRUE; @@ -1714,7 +1664,7 @@ void update_mon(int m_idx, bool_ full) if (player_can_see_bold(fy, fx)) { /* Visible, or detectable, monsters get seen */ - if (p_ptr->see_inv || !(r_ptr->flags2 & RF2_INVISIBLE)) + if (p_ptr->see_inv || !(r_ptr->flags & RF_INVISIBLE)) { easy = flag = TRUE; } @@ -1728,32 +1678,32 @@ void update_mon(int m_idx, bool_ full) bool_ can_esp = FALSE; /* Different ESP */ - if ((p_ptr->telepathy & ESP_ORC) && (r_ptr->flags3 & RF3_ORC)) can_esp = TRUE; - if ((p_ptr->telepathy & ESP_SPIDER) && (r_ptr->flags7 & RF7_SPIDER)) can_esp = TRUE; - if ((p_ptr->telepathy & ESP_TROLL) && (r_ptr->flags3 & RF3_TROLL)) can_esp = TRUE; - if ((p_ptr->telepathy & ESP_DRAGON) && (r_ptr->flags3 & RF3_DRAGON)) can_esp = TRUE; - if ((p_ptr->telepathy & ESP_GIANT) && (r_ptr->flags3 & RF3_GIANT)) can_esp = TRUE; - if ((p_ptr->telepathy & ESP_DEMON) && (r_ptr->flags3 & RF3_DEMON)) can_esp = TRUE; - if ((p_ptr->telepathy & ESP_UNDEAD) && (r_ptr->flags3 & RF3_UNDEAD)) can_esp = TRUE; - if ((p_ptr->telepathy & ESP_EVIL) && (r_ptr->flags3 & RF3_EVIL)) can_esp = TRUE; - if ((p_ptr->telepathy & ESP_ANIMAL) && (r_ptr->flags3 & RF3_ANIMAL)) can_esp = TRUE; - if ((p_ptr->telepathy & ESP_THUNDERLORD) && (r_ptr->flags3 & RF3_THUNDERLORD)) can_esp = TRUE; - if ((p_ptr->telepathy & ESP_GOOD) && (r_ptr->flags3 & RF3_GOOD)) can_esp = TRUE; - if ((p_ptr->telepathy & ESP_NONLIVING) && (r_ptr->flags3 & RF3_NONLIVING)) can_esp = TRUE; - if ((p_ptr->telepathy & ESP_UNIQUE) && ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags3 & RF3_UNIQUE_4))) can_esp = TRUE; + if ((p_ptr->telepathy & ESP_ORC) && (r_ptr->flags & RF_ORC)) can_esp = TRUE; + if ((p_ptr->telepathy & ESP_SPIDER) && (r_ptr->flags & RF_SPIDER)) can_esp = TRUE; + if ((p_ptr->telepathy & ESP_TROLL) && (r_ptr->flags & RF_TROLL)) can_esp = TRUE; + if ((p_ptr->telepathy & ESP_DRAGON) && (r_ptr->flags & RF_DRAGON)) can_esp = TRUE; + if ((p_ptr->telepathy & ESP_GIANT) && (r_ptr->flags & RF_GIANT)) can_esp = TRUE; + if ((p_ptr->telepathy & ESP_DEMON) && (r_ptr->flags & RF_DEMON)) can_esp = TRUE; + if ((p_ptr->telepathy & ESP_UNDEAD) && (r_ptr->flags & RF_UNDEAD)) can_esp = TRUE; + if ((p_ptr->telepathy & ESP_EVIL) && (r_ptr->flags & RF_EVIL)) can_esp = TRUE; + if ((p_ptr->telepathy & ESP_ANIMAL) && (r_ptr->flags & RF_ANIMAL)) can_esp = TRUE; + if ((p_ptr->telepathy & ESP_THUNDERLORD) && (r_ptr->flags & RF_THUNDERLORD)) can_esp = TRUE; + if ((p_ptr->telepathy & ESP_GOOD) && (r_ptr->flags & RF_GOOD)) can_esp = TRUE; + if ((p_ptr->telepathy & ESP_NONLIVING) && (r_ptr->flags & RF_NONLIVING)) can_esp = TRUE; + if ((p_ptr->telepathy & ESP_UNIQUE) && ((r_ptr->flags & RF_UNIQUE) || (r_ptr->flags & RF_UNIQUE_4))) can_esp = TRUE; if (p_ptr->telepathy & ESP_ALL) can_esp = TRUE; /* Only do this when we can really detect monster */ if (can_esp) { /* Empty mind, no telepathy */ - if (r_ptr->flags2 & RF2_EMPTY_MIND) + if (r_ptr->flags & RF_EMPTY_MIND) { /* No telepathy */ } /* Weird mind, occasional telepathy */ - else if (r_ptr->flags2 & RF2_WEIRD_MIND) + else if (r_ptr->flags & RF_WEIRD_MIND) { if (rand_int(100) < 10) { @@ -1836,7 +1786,7 @@ void update_mon(int m_idx, bool_ full) if (m_ptr->ml != old_ml) { - if (r_ptr->flags2 & RF2_ELDRITCH_HORROR) + if (r_ptr->flags & RF_ELDRITCH_HORROR) { sanity_blast(m_ptr, FALSE); } @@ -2094,7 +2044,7 @@ s16b place_monster_one(int y, int x, int r_idx, int ego, bool_ slp, int status) } /* Ego Uniques are NOT to be created */ - if ((r_ptr->flags1 & RF1_UNIQUE) && ego) + if ((r_ptr->flags & RF_UNIQUE) && ego) { return 0; } @@ -2111,28 +2061,28 @@ s16b place_monster_one(int y, int x, int r_idx, int ego, bool_ slp, int status) } /* Unallow some uniques to be generated outside of their quests/special levels/dungeons */ - if ((r_ptr->flags9 & RF9_SPECIAL_GENE) && (!m_allow_special[r_idx])) + if ((r_ptr->flags & RF_SPECIAL_GENE) && (!m_allow_special[r_idx])) { if (wizard) cmsg_format(TERM_L_RED, "WARNING: Refused monster(%d): SPECIAL_GENE", r_idx); return 0; } /* Disallow Spirits in The Void, now this *IS* an ugly hack, I hate to do it ... */ - if ((r_ptr->flags7 & RF7_SPIRIT) && (dungeon_type != DUNGEON_VOID)) + if ((r_ptr->flags & RF_SPIRIT) && (dungeon_type != DUNGEON_VOID)) { if (wizard) cmsg_format(TERM_L_RED, "WARNING: Refused monster(%d): SPIRIT in non VOID", r_idx); return 0; } /* Fully forbid it */ - if (r_ptr->flags9 & RF9_NEVER_GENE) + if (r_ptr->flags & RF_NEVER_GENE) { if (wizard) cmsg_print(TERM_L_RED, "WARNING: Refused monster: NEVER_GENE"); return 0; } /* Hack -- "unique" monsters must be "unique" */ - if ((r_ptr->flags1 & RF1_UNIQUE) && (r_ptr->max_num == -1) && (!m_allow_special[r_idx])) + if ((r_ptr->flags & RF_UNIQUE) && (r_ptr->max_num == -1) && (!m_allow_special[r_idx])) { /* Cannot create */ if (wizard) cmsg_format(TERM_L_RED, "WARNING: Refused monster %d: unique not unique", r_idx); @@ -2147,7 +2097,7 @@ s16b place_monster_one(int y, int x, int r_idx, int ego, bool_ slp, int status) } /* Hack -- "unique" monsters must be "unique" */ - if ((r_ptr->flags1 & RF1_UNIQUE) && (r_ptr->cur_num >= r_ptr->max_num) && (r_ptr->max_num != -1) && (!bypass_r_ptr_max_num)) + if ((r_ptr->flags & RF_UNIQUE) && (r_ptr->cur_num >= r_ptr->max_num) && (r_ptr->max_num != -1) && (!bypass_r_ptr_max_num)) { /* Cannot create */ if (wizard) cmsg_format(TERM_L_RED, "WARNING: Refused monster %d: cur_num >= max_num", r_idx); @@ -2155,7 +2105,7 @@ s16b place_monster_one(int y, int x, int r_idx, int ego, bool_ slp, int status) } /* Depth monsters may NOT be created out of depth */ - if ((r_ptr->flags1 & RF1_FORCE_DEPTH) && (dun_level < r_ptr->level)) + if ((r_ptr->flags & RF_FORCE_DEPTH) && (dun_level < r_ptr->level)) { /* Cannot create */ if (wizard) cmsg_print(TERM_L_RED, "WARNING: FORCE_DEPTH"); @@ -2166,7 +2116,7 @@ s16b place_monster_one(int y, int x, int r_idx, int ego, bool_ slp, int status) if (r_ptr->level > dun_level) { /* Unique monsters */ - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { /* Message for cheaters */ if ((cheat_hear) || (p_ptr->precognition)) msg_format("Deep Unique (%s).", r_ptr->name); @@ -2187,7 +2137,7 @@ s16b place_monster_one(int y, int x, int r_idx, int ego, bool_ slp, int status) } /* Note the monster */ - else if (r_ptr->flags1 & RF1_UNIQUE) + else if (r_ptr->flags & RF_UNIQUE) { /* Unique monsters induce message */ if ((cheat_hear) || (p_ptr->precognition)) msg_format("Unique (%s).", r_ptr->name); @@ -2242,11 +2192,11 @@ s16b place_monster_one(int y, int x, int r_idx, int ego, bool_ slp, int status) m_ptr->status = status; /* Friendly? */ - if (m_ptr->status < MSTATUS_FRIEND && r_ptr->flags7 & RF7_PET) + if (m_ptr->status < MSTATUS_FRIEND && r_ptr->flags & RF_PET) { m_ptr->status = MSTATUS_FRIEND; } - if (m_ptr->status < MSTATUS_NEUTRAL && r_ptr->flags7 & RF7_NEUTRAL) + if (m_ptr->status < MSTATUS_NEUTRAL && r_ptr->flags & RF_NEUTRAL) { m_ptr->status = MSTATUS_NEUTRAL; } @@ -2265,12 +2215,12 @@ s16b place_monster_one(int y, int x, int r_idx, int ego, bool_ slp, int status) /* Only if not fated to die */ if ((dungeon_type != DUNGEON_DEATH) && (!place_monster_one_no_drop)) { - const bool_ good = (r_ptr->flags1 & RF1_DROP_GOOD) ? TRUE : FALSE; - const bool_ great = (r_ptr->flags1 & RF1_DROP_GREAT) ? TRUE : FALSE; + const bool_ good = (r_ptr->flags & RF_DROP_GOOD) ? TRUE : FALSE; + const bool_ great = (r_ptr->flags & RF_DROP_GREAT) ? TRUE : FALSE; - const bool_ do_gold = (!(r_ptr->flags1 & RF1_ONLY_ITEM)); - const bool_ do_item = (!(r_ptr->flags1 & RF1_ONLY_GOLD)); - const bool_ do_mimic = (r_ptr->flags9 & RF9_MIMIC); + const bool_ do_gold = (!(r_ptr->flags & RF_ONLY_ITEM)); + const bool_ do_item = (!(r_ptr->flags & RF_ONLY_GOLD)); + const bool_ do_mimic = (r_ptr->flags & RF_MIMIC); const int force_coin = get_coin_type(r_ptr); @@ -2285,18 +2235,18 @@ s16b place_monster_one(int y, int x, int r_idx, int ego, bool_ slp, int status) object_level = (dun_level + r_ptr->level) / 2; /* Determine how much we can drop */ - if ((r_ptr->flags1 & (RF1_DROP_60)) && (rand_int(100) < 60)) number++; - if ((r_ptr->flags1 & (RF1_DROP_90)) && (rand_int(100) < 90)) number++; - if (r_ptr->flags1 & (RF1_DROP_1D2)) number += damroll(1, 2); - if (r_ptr->flags1 & (RF1_DROP_2D2)) number += damroll(2, 2); - if (r_ptr->flags1 & (RF1_DROP_3D2)) number += damroll(3, 2); - if (r_ptr->flags1 & (RF1_DROP_4D2)) number += damroll(4, 2); - if (r_ptr->flags9 & RF9_MIMIC) number = 1; + if ((r_ptr->flags & RF_DROP_60) && (rand_int(100) < 60)) number++; + if ((r_ptr->flags & RF_DROP_90) && (rand_int(100) < 90)) number++; + if (r_ptr->flags & RF_DROP_1D2) number += damroll(1, 2); + if (r_ptr->flags & RF_DROP_2D2) number += damroll(2, 2); + if (r_ptr->flags & RF_DROP_3D2) number += damroll(3, 2); + if (r_ptr->flags & RF_DROP_4D2) number += damroll(4, 2); + if (r_ptr->flags & RF_MIMIC) number = 1; /* Hack -- handle creeping coins */ coin_type = force_coin; - if (r_ptr->flags7 & RF7_DROP_RANDART) + if (r_ptr->flags & RF_DROP_RANDART) { int tries = 1000; /* Get local object */ @@ -2401,7 +2351,7 @@ s16b place_monster_one(int y, int x, int r_idx, int ego, bool_ slp, int status) /* Assign maximal hitpoints */ - if (r_ptr->flags1 & RF1_FORCE_MAXHP) + if (r_ptr->flags & RF_FORCE_MAXHP) { m_ptr->maxhp = maxroll(r_ptr->hdice, r_ptr->hside); } @@ -2430,7 +2380,7 @@ s16b place_monster_one(int y, int x, int r_idx, int ego, bool_ slp, int status) m_ptr->mspeed = m_ptr->speed; /* Hack -- small racial variety */ - if (!(r_ptr->flags1 & RF1_UNIQUE)) + if (!(r_ptr->flags & RF_UNIQUE)) { /* Allow some small variation per monster */ i = extract_energy[m_ptr->speed] / 10; @@ -2461,7 +2411,7 @@ s16b place_monster_one(int y, int x, int r_idx, int ego, bool_ slp, int status) m_ptr->energy = (byte)rand_int(100); /* Force monster to wait for player */ - if (r_ptr->flags1 & RF1_FORCE_SLEEP) + if (r_ptr->flags & RF_FORCE_SLEEP) { /* Monster is still being nice */ m_ptr->mflag |= (MFLAG_NICE); @@ -2487,7 +2437,7 @@ s16b place_monster_one(int y, int x, int r_idx, int ego, bool_ slp, int status) /* Hack -- Notice new multi-hued monsters */ - if (r_ptr->flags1 & RF1_ATTR_MULTI) shimmer_monsters = TRUE; + if (r_ptr->flags & RF_ATTR_MULTI) shimmer_monsters = TRUE; /* Count monsters on the level */ { @@ -2499,7 +2449,7 @@ s16b place_monster_one(int y, int x, int r_idx, int ego, bool_ slp, int status) } /* Unique monsters on saved levels should be "marked" */ - if ((r_ptr->flags1 & RF1_UNIQUE) && get_dungeon_save(dummy)) + if ((r_ptr->flags & RF_UNIQUE) && get_dungeon_save(dummy)) { r_ptr->on_saved = TRUE; } @@ -2635,7 +2585,7 @@ static bool_ place_monster_okay(int r_idx) if (z_ptr->level > r_ptr->level) return (FALSE); /* Skip unique monsters */ - if (z_ptr->flags1 & RF1_UNIQUE) return (FALSE); + if (z_ptr->flags & RF_UNIQUE) return (FALSE); /* Paranoia -- Skip identical monsters */ if (place_monster_idx == r_idx) return (FALSE); @@ -2679,7 +2629,7 @@ bool_ place_monster_aux(int y, int x, int r_idx, bool_ slp, bool_ grp, int statu /* Friends for certain monsters */ - if (r_ptr->flags1 & RF1_FRIENDS) + if (r_ptr->flags & RF_FRIENDS) { /* Attempt to place a group */ (void)place_monster_group(y, x, r_idx, slp, status); @@ -2687,7 +2637,7 @@ bool_ place_monster_aux(int y, int x, int r_idx, bool_ slp, bool_ grp, int statu /* Escorts for certain monsters */ - if (r_ptr->flags1 & RF1_ESCORT) + if (r_ptr->flags & RF_ESCORT) { old_get_mon_num_hook = get_mon_num_hook; @@ -2732,8 +2682,8 @@ bool_ place_monster_aux(int y, int x, int r_idx, bool_ slp, bool_ grp, int statu place_monster_one(ny, nx, z, pick_ego_monster(&r_info[z]), slp, status); /* Place a "group" of escorts if needed */ - if ((r_info[z].flags1 & RF1_FRIENDS) || - (r_ptr->flags1 & RF1_ESCORTS)) + if ((r_info[z].flags & RF_FRIENDS) || + (r_ptr->flags & RF_ESCORTS)) { /* Place a group of monsters */ (void)place_monster_group(ny, nx, z, slp, status); @@ -2809,8 +2759,8 @@ bool_ alloc_horde(int y, int x) r_ptr = &r_info[r_idx]; - if (!(r_ptr->flags1 & RF1_UNIQUE) - && !(r_ptr->flags1 & RF1_ESCORTS)) + if (!(r_ptr->flags & RF_UNIQUE) + && !(r_ptr->flags & RF_ESCORTS)) break; } @@ -2933,56 +2883,56 @@ static bool_ summon_specific_okay(int r_idx) case SUMMON_ANT: { okay = ((r_ptr->d_char == 'a') && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_SPIDER: { okay = ((r_ptr->d_char == 'S') && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_HOUND: { okay = (((r_ptr->d_char == 'C') || (r_ptr->d_char == 'Z')) && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_HYDRA: { okay = ((r_ptr->d_char == 'M') && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_ANGEL: { okay = ((r_ptr->d_char == 'A') && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_DEMON: { - okay = ((r_ptr->flags3 & RF3_DEMON) && - !(r_ptr->flags1 & RF1_UNIQUE)); + okay = ((r_ptr->flags & RF_DEMON) && + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_UNDEAD: { - okay = ((r_ptr->flags3 & RF3_UNDEAD) && - !(r_ptr->flags1 & RF1_UNIQUE)); + okay = ((r_ptr->flags & RF_UNDEAD) && + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_DRAGON: { - okay = ((r_ptr->flags3 & RF3_DRAGON) && - !(r_ptr->flags1 & RF1_UNIQUE)); + okay = ((r_ptr->flags & RF_DRAGON) && + !(r_ptr->flags & RF_UNIQUE)); break; } @@ -3014,40 +2964,40 @@ static bool_ summon_specific_okay(int r_idx) case SUMMON_UNIQUE: { - okay = (r_ptr->flags1 & RF1_UNIQUE) ? TRUE : FALSE; + okay = (r_ptr->flags & RF_UNIQUE) ? TRUE : FALSE; break; } case SUMMON_BIZARRE1: { okay = ((r_ptr->d_char == 'm') && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_BIZARRE2: { okay = ((r_ptr->d_char == 'b') && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_BIZARRE3: { okay = ((r_ptr->d_char == 'Q') && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_BIZARRE4: { okay = ((r_ptr->d_char == 'v') && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_BIZARRE5: { okay = ((r_ptr->d_char == '$') && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } @@ -3058,15 +3008,15 @@ static bool_ summon_specific_okay(int r_idx) (r_ptr->d_char == '=') || (r_ptr->d_char == '$') || (r_ptr->d_char == '|')) && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_HI_DEMON: { - okay = ((r_ptr->flags3 & RF3_DEMON) && + okay = ((r_ptr->flags & RF_DEMON) && (r_ptr->d_char == 'U') && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } @@ -3074,34 +3024,34 @@ static bool_ summon_specific_okay(int r_idx) case SUMMON_KIN: { okay = ((r_ptr->d_char == summon_kin_type) && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_DAWN: { okay = ((strstr(r_ptr->name, "the Dawn")) && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_ANIMAL: { - okay = ((r_ptr->flags3 & RF3_ANIMAL) && - !(r_ptr->flags1 & RF1_UNIQUE)); + okay = ((r_ptr->flags & RF_ANIMAL) && + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_ANIMAL_RANGER: { - okay = ((r_ptr->flags3 & RF3_ANIMAL) && + okay = ((r_ptr->flags & RF_ANIMAL) && (strchr("abcflqrwBCIJKMRS", r_ptr->d_char)) && - !(r_ptr->flags3 & RF3_DRAGON) && - !(r_ptr->flags3 & RF3_EVIL) && - !(r_ptr->flags3 & RF3_UNDEAD) && - !(r_ptr->flags3 & RF3_DEMON) && + !(r_ptr->flags & RF_DRAGON) && + !(r_ptr->flags & RF_EVIL) && + !(r_ptr->flags & RF_UNDEAD) && + !(r_ptr->flags & RF_DEMON) && !r_ptr->spells && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } @@ -3110,87 +3060,87 @@ static bool_ summon_specific_okay(int r_idx) okay = (((r_ptr->d_char == 'L') || (r_ptr->d_char == 'V') || (r_ptr->d_char == 'W')) && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_HI_DRAGON_NO_UNIQUES: { okay = ((r_ptr->d_char == 'D') && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_NO_UNIQUES: { - okay = (!(r_ptr->flags1 & RF1_UNIQUE)); + okay = (!(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_PHANTOM: { okay = ((strstr(r_ptr->name, "Phantom")) && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_ELEMENTAL: { okay = ((strstr(r_ptr->name, "lemental")) && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_THUNDERLORD: { - okay = (r_ptr->flags3 & RF3_THUNDERLORD) ? TRUE : FALSE; + okay = (r_ptr->flags & RF_THUNDERLORD) ? TRUE : FALSE; break; } case SUMMON_BLUE_HORROR: { okay = ((strstr(r_ptr->name, "lue horror")) && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_BUG: { okay = ((strstr(r_ptr->name, "Software bug")) && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_RNG: { okay = ((strstr(r_ptr->name, "Random Number Generator")) && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_MINE: { - okay = (r_ptr->flags1 & RF1_NEVER_MOVE) ? TRUE : FALSE; + okay = (r_ptr->flags & RF_NEVER_MOVE) ? TRUE : FALSE; break; } case SUMMON_HUMAN: { okay = ((r_ptr->d_char == 'p') && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_SHADOWS: { okay = ((r_ptr->d_char == 'G') && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } case SUMMON_QUYLTHULG: { okay = ((r_ptr->d_char == 'Q') && - !(r_ptr->flags1 & RF1_UNIQUE)); + !(r_ptr->flags & RF_UNIQUE)); break; } @@ -3499,7 +3449,7 @@ static bool_ mutate_monster_okay(int r_idx) /* Hack - Only summon dungeon monsters */ if (!monster_dungeon(r_idx)) return (FALSE); - okay = ((r_ptr->d_char == summon_kin_type) && !(r_ptr->flags1 & RF1_UNIQUE) + okay = ((r_ptr->d_char == summon_kin_type) && !(r_ptr->flags & RF_UNIQUE) && (r_ptr->level >= dun_level)); return okay; @@ -3721,10 +3671,10 @@ void update_smart_learn(int m_idx, int what) auto const r_ptr = m_ptr->race(); /* Too stupid to learn anything */ - if (r_ptr->flags2 & RF2_STUPID) return; + if (r_ptr->flags & RF_STUPID) return; /* Not intelligent, only learn sometimes */ - if (!(r_ptr->flags2 & RF2_SMART) && magik(50)) return; + if (!(r_ptr->flags & RF_SMART) && magik(50)) return; /* XXX XXX XXX */ diff --git a/src/monster3.cc b/src/monster3.cc index ab002899..f8bb0837 100644 --- a/src/monster3.cc +++ b/src/monster3.cc @@ -15,6 +15,7 @@ #include "melee2.hpp" #include "monster2.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_spell_flag.hpp" #include "monster_type.hpp" #include "object2.hpp" @@ -82,7 +83,7 @@ bool_ change_side(monster_type *m_ptr) { case MSTATUS_FRIEND: m_ptr->status = MSTATUS_ENEMY; - if ((r_ptr->flags3 & RF3_ANIMAL) && (!(r_ptr->flags3 & RF3_EVIL))) + if ((r_ptr->flags & RF_ANIMAL) && (!(r_ptr->flags & RF_EVIL))) inc_piety(GOD_YAVANNA, -m_ptr->level * 4); break; case MSTATUS_NEUTRAL_P: @@ -93,7 +94,7 @@ bool_ change_side(monster_type *m_ptr) break; case MSTATUS_PET: m_ptr->status = MSTATUS_ENEMY; - if ((r_ptr->flags3 & RF3_ANIMAL) && (!(r_ptr->flags3 & RF3_EVIL))) + if ((r_ptr->flags & RF_ANIMAL) && (!(r_ptr->flags & RF_EVIL))) inc_piety(GOD_YAVANNA, -m_ptr->level * 4); break; case MSTATUS_COMPANION: @@ -175,7 +176,7 @@ bool_ ai_possessor(int m_idx, int o_idx) m_ptr->csleep = 0; /* Assign maximal hitpoints */ - if (r_ptr->flags1 & RF1_FORCE_MAXHP) + if (r_ptr->flags & RF_FORCE_MAXHP) { m_ptr->maxhp = maxroll(r_ptr->hdice, r_ptr->hside); } @@ -209,7 +210,7 @@ bool_ ai_possessor(int m_idx, int o_idx) if (r_ptr->spells & SF_MULTIPLY) num_repro++; /* Hack -- Notice new multi-hued monsters */ - if (r_ptr->flags1 & RF1_ATTR_MULTI) shimmer_monsters = TRUE; + if (r_ptr->flags & RF_ATTR_MULTI) shimmer_monsters = TRUE; /* Hack -- Count the monsters on the level */ r_ptr->cur_num++; @@ -250,7 +251,7 @@ void ai_deincarnate(int m_idx) m_ptr->csleep = 0; /* Assign maximal hitpoints */ - if (r_ptr->flags1 & RF1_FORCE_MAXHP) + if (r_ptr->flags & RF_FORCE_MAXHP) { m_ptr->maxhp = maxroll(r_ptr->hdice, r_ptr->hside); } @@ -284,7 +285,7 @@ void ai_deincarnate(int m_idx) if (r_ptr->spells & SF_MULTIPLY) num_repro++; /* Hack -- Notice new multi-hued monsters */ - if (r_ptr->flags1 & RF1_ATTR_MULTI) shimmer_monsters = TRUE; + if (r_ptr->flags & RF_ATTR_MULTI) shimmer_monsters = TRUE; /* Hack -- Count the monsters on the level */ r_ptr->cur_num++; diff --git a/src/monster_ego.hpp b/src/monster_ego.hpp index 010ff98f..b578d03e 100644 --- a/src/monster_ego.hpp +++ b/src/monster_ego.hpp @@ -2,6 +2,7 @@ #include "h-basic.h" #include "monster_blow.hpp" +#include "monster_race_flag_set.hpp" #include "monster_spell_flag_set.hpp" #include <array> @@ -39,37 +40,17 @@ struct monster_ego byte freq_spell = 0; /* Other spell frequency */ /* Ego flags */ - u32b flags1 = 0; - u32b flags2 = 0; - u32b flags3 = 0; - u32b flags7 = 0; - u32b flags8 = 0; - u32b flags9 = 0; - u32b hflags1 = 0; - u32b hflags2 = 0; - u32b hflags3 = 0; - u32b hflags7 = 0; - u32b hflags8 = 0; - u32b hflags9 = 0; + monster_race_flag_set flags; + monster_race_flag_set hflags; /* Monster flags */ - u32b mflags1 = 0; - u32b mflags2 = 0; - u32b mflags3 = 0; - u32b mflags7 = 0; - u32b mflags8 = 0; - u32b mflags9 = 0; + monster_race_flag_set mflags; /* Monster spells */ monster_spell_flag_set mspells; - /* Negative Flags, to be removed from the monster flags */ - u32b nflags1 = 0; - u32b nflags2 = 0; - u32b nflags3 = 0; - u32b nflags7 = 0; - u32b nflags8 = 0; - u32b nflags9 = 0; + /* Negative flags, to be removed from the monster flags */ + monster_race_flag_set nflags; /* Negative spells; to be removed from the monster spells */ monster_spell_flag_set nspells; diff --git a/src/monster_race.hpp b/src/monster_race.hpp index 3a13e4b4..58c49e1f 100644 --- a/src/monster_race.hpp +++ b/src/monster_race.hpp @@ -3,6 +3,7 @@ #include "body.hpp" #include "h-basic.h" #include "monster_blow.hpp" +#include "monster_race_flag_set.hpp" #include "monster_spell_flag_set.hpp" #include "obj_theme.hpp" @@ -48,12 +49,7 @@ struct monster_race byte freq_inate = 0; /* Inate spell frequency */ byte freq_spell = 0; /* Other spell frequency */ - u32b flags1 = 0; /* Flags 1 (general) */ - u32b flags2 = 0; /* Flags 2 (abilities) */ - u32b flags3 = 0; /* Flags 3 (race/resist) */ - u32b flags7 = 0; /* Flags 7 (movement related abilities) */ - u32b flags8 = 0; /* Flags 8 (wilderness info) */ - u32b flags9 = 0; /* Flags 9 (drops info) */ + monster_race_flag_set flags; /* Flags */ monster_spell_flag_set spells; /* Spells */ diff --git a/src/monster_race_flag.hpp b/src/monster_race_flag.hpp new file mode 100644 index 00000000..098e8176 --- /dev/null +++ b/src/monster_race_flag.hpp @@ -0,0 +1,12 @@ +#pragma once + +#include "monster_race_flag_set.hpp" +#include <boost/preprocessor/cat.hpp> + +// +// Define flag set for each flag. +// +#define RF(tier, index, name) \ + DECLARE_FLAG(monster_race_flag_set, BOOST_PP_CAT(RF_,name), tier, index) +#include "monster_race_flag_list.hpp" +#undef RF diff --git a/src/monster_race_flag_list.hpp b/src/monster_race_flag_list.hpp new file mode 100644 index 00000000..10a36a3f --- /dev/null +++ b/src/monster_race_flag_list.hpp @@ -0,0 +1,159 @@ +/** + * X-macro list of all the monster race flags + */ + +/* RF(<tier>, <index>, <name>) */ + +RF(1, 0, UNIQUE) +RF(1, 1, QUESTOR) +RF(1, 2, MALE) +RF(1, 3, FEMALE) +RF(1, 4, CHAR_CLEAR) +RF(1, 5, CHAR_MULTI) +RF(1, 6, ATTR_CLEAR) +RF(1, 7, ATTR_MULTI) +RF(1, 8, FORCE_DEPTH) +RF(1, 9, FORCE_MAXHP) +RF(1, 10, FORCE_SLEEP) +RF(1, 11, FORCE_EXTRA) +RF(1, 12, FRIEND) +RF(1, 13, FRIENDS) +RF(1, 14, ESCORT) +RF(1, 15, ESCORTS) +RF(1, 16, NEVER_BLOW) +RF(1, 17, NEVER_MOVE) +RF(1, 18, RAND_25) +RF(1, 19, RAND_50) +RF(1, 20, ONLY_GOLD) +RF(1, 21, ONLY_ITEM) +RF(1, 22, DROP_60) +RF(1, 23, DROP_90) +RF(1, 24, DROP_1D2) +RF(1, 25, DROP_2D2) +RF(1, 26, DROP_3D2) +RF(1, 27, DROP_4D2) +RF(1, 28, DROP_GOOD) +RF(1, 29, DROP_GREAT) +RF(1, 30, DROP_USEFUL) +RF(1, 31, DROP_CHOSEN) + +RF(2, 0, STUPID) +RF(2, 1, SMART) +RF(2, 2, CAN_SPEAK) +RF(2, 3, REFLECTING) +RF(2, 4, INVISIBLE) +RF(2, 5, COLD_BLOOD) +RF(2, 6, EMPTY_MIND) +RF(2, 7, WEIRD_MIND) +RF(2, 8, DEATH_ORB) +RF(2, 9, REGENERATE) +RF(2, 10, SHAPECHANGER) +RF(2, 11, ATTR_ANY) +RF(2, 12, POWERFUL) +RF(2, 13, ELDRITCH_HORROR) +RF(2, 14, AURA_FIRE) +RF(2, 15, AURA_ELEC) +RF(2, 16, OPEN_DOOR) +RF(2, 17, BASH_DOOR) +RF(2, 18, PASS_WALL) +RF(2, 19, KILL_WALL) +RF(2, 20, MOVE_BODY) +RF(2, 21, KILL_BODY) +RF(2, 22, TAKE_ITEM) +RF(2, 23, KILL_ITEM) +RF(2, 24, BRAIN_1) +RF(2, 25, BRAIN_2) +RF(2, 26, BRAIN_3) +RF(2, 27, BRAIN_4) +RF(2, 28, BRAIN_5) +RF(2, 29, BRAIN_6) +RF(2, 30, BRAIN_7) +RF(2, 31, BRAIN_8) + +RF(3, 0, ORC) +RF(3, 1, TROLL) +RF(3, 2, GIANT) +RF(3, 3, DRAGON) +RF(3, 4, DEMON) +RF(3, 5, UNDEAD) +RF(3, 6, EVIL) +RF(3, 7, ANIMAL) +RF(3, 8, THUNDERLORD) +RF(3, 9, GOOD) +RF(3, 10, AURA_COLD) +RF(3, 11, NONLIVING) +RF(3, 12, HURT_LITE) +RF(3, 13, HURT_ROCK) +RF(3, 14, SUSCEP_FIRE) +RF(3, 15, SUSCEP_COLD) +RF(3, 16, IM_ACID) +RF(3, 17, IM_ELEC) +RF(3, 18, IM_FIRE) +RF(3, 19, IM_COLD) +RF(3, 20, IM_POIS) +RF(3, 21, RES_TELE) +RF(3, 22, RES_NETH) +RF(3, 23, RES_WATE) +RF(3, 24, RES_PLAS) +RF(3, 25, RES_NEXU) +RF(3, 26, RES_DISE) +RF(3, 27, UNIQUE_4) +RF(3, 28, NO_FEAR) +RF(3, 29, NO_STUN) +RF(3, 30, NO_CONF) +RF(3, 31, NO_SLEEP) + +RF(4, 0, AQUATIC) +RF(4, 1, CAN_SWIM) +RF(4, 2, CAN_FLY) +RF(4, 3, FRIENDLY) +RF(4, 4, PET) +RF(4, 5, MORTAL) +RF(4, 6, SPIDER) +RF(4, 7, NAZGUL) +RF(4, 8, DG_CURSE) +RF(4, 9, POSSESSOR) +RF(4, 10, NO_DEATH) +RF(4, 11, NO_TARGET) +RF(4, 12, AI_ANNOY) +RF(4, 13, AI_SPECIAL) +RF(4, 14, NEUTRAL) +RF(4, 15, DROP_ART) +RF(4, 16, DROP_RANDART) +RF(4, 17, AI_PLAYER) +RF(4, 18, NO_THEFT) +RF(4, 19, SPIRIT) + +RF(5, 0, WILD_ONLY) +RF(5, 1, WILD_TOWN) +RF(5, 2, XXX8X02) +RF(5, 3, WILD_SHORE) +RF(5, 4, WILD_OCEAN) +RF(5, 5, WILD_WASTE) +RF(5, 6, WILD_WOOD) +RF(5, 7, WILD_VOLCANO) +RF(5, 8, XXX8X08) +RF(5, 9, WILD_MOUNTAIN) +RF(5, 10, WILD_GRASS) +RF(5, 11, NO_CUT) +RF(5, 12, CTHANGBAND) +RF(5, 14, ZANGBAND) +RF(5, 15, JOKEANGBAND) +RF(5, 16, BASEANGBAND) +RF(5, 31, WILD_TOO) + +RF(6, 0, DROP_CORPSE) +RF(6, 1, DROP_SKELETON) +RF(6, 2, HAS_LITE) +RF(6, 3, MIMIC) +RF(6, 4, HAS_EGG) +RF(6, 5, IMPRESED) +RF(6, 6, SUSCEP_ACID) +RF(6, 7, SUSCEP_ELEC) +RF(6, 8, SUSCEP_POIS) +RF(6, 9, KILL_TREES) +RF(6, 10, WYRM_PROTECT) +RF(6, 11, DOPPLEGANGER) +RF(6, 12, ONLY_DEPTH) +RF(6, 13, SPECIAL_GENE) +RF(6, 14, NEVER_GENE) diff --git a/src/monster_race_flag_set.hpp b/src/monster_race_flag_set.hpp new file mode 100644 index 00000000..958201b1 --- /dev/null +++ b/src/monster_race_flag_set.hpp @@ -0,0 +1,7 @@ +#pragma once + +#include "flag_set.hpp" + +constexpr std::size_t RF_MAX_TIERS = 6; + +typedef flag_set<RF_MAX_TIERS> monster_race_flag_set; diff --git a/src/object1.cc b/src/object1.cc index 7a462b41..1aaf2a6c 100644 --- a/src/object1.cc +++ b/src/object1.cc @@ -26,6 +26,7 @@ #include "monster2.hpp" #include "monster_ego.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_type.hpp" #include "object2.hpp" #include "object_kind.hpp" @@ -1374,7 +1375,7 @@ std::string object_desc_aux(object_type *o_ptr, int pref, int mode) { monster_race* r_ptr = &r_info[o_ptr->pval2]; modstr = basenm; - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { basenm = fmt::format("& {}'s #~", r_ptr->name); } @@ -1531,11 +1532,11 @@ std::string object_desc_aux(object_type *o_ptr, int pref, int mode) t += ' '; } - else if ((o_ptr->tval == TV_CORPSE) && (r_ptr->flags1 & RF1_UNIQUE)) + else if ((o_ptr->tval == TV_CORPSE) && (r_ptr->flags & RF_UNIQUE)) {} - else if ((o_ptr->tval == TV_HYPNOS) && (r_ptr->flags1 & RF1_UNIQUE)) + else if ((o_ptr->tval == TV_HYPNOS) && (r_ptr->flags & RF_UNIQUE)) {} /* Hack -- The only one of its kind */ diff --git a/src/object2.cc b/src/object2.cc index ebf185b2..7a4b6211 100644 --- a/src/object2.cc +++ b/src/object2.cc @@ -21,6 +21,7 @@ #include "mimic.hpp" #include "monster2.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_type.hpp" #include "object1.hpp" #include "object_kind.hpp" @@ -3261,7 +3262,7 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power) int r_idx = get_mon_num(dun_level); r_ptr = &r_info[r_idx]; - if (!(r_ptr->flags1 & RF1_UNIQUE)) + if (!(r_ptr->flags & RF_UNIQUE)) o_ptr->pval2 = r_idx; else o_ptr->pval2 = 2; @@ -3281,7 +3282,7 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power) r_idx = get_mon_num(dun_level); r_ptr = &r_info[r_idx]; - if (r_ptr->flags9 & RF9_HAS_EGG) + if (r_ptr->flags & RF_HAS_EGG) { o_ptr->pval2 = r_idx; OK = TRUE; @@ -3303,7 +3304,7 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power) int r_idx = get_mon_num(dun_level); r_ptr = &r_info[r_idx]; - if (!(r_ptr->flags1 & RF1_NEVER_MOVE)) + if (!(r_ptr->flags & RF_NEVER_MOVE)) o_ptr->pval = r_idx; else o_ptr->pval = 20; @@ -6337,7 +6338,7 @@ void pack_decay(int item) } /* Monster must have a skeleton for its corpse to become one */ - if ((i_ptr->sval == SV_CORPSE_CORPSE) && (r_ptr->flags3 & RF9_DROP_SKELETON)) + if ((i_ptr->sval == SV_CORPSE_CORPSE) && (r_ptr->flags & RF_DROP_SKELETON)) { /* Replace the corpse with a skeleton */ object_prep(i_ptr, lookup_kind(TV_CORPSE, SV_CORPSE_SKELETON)); @@ -6432,7 +6433,7 @@ void floor_decay(int item) } /* Monster must have a skeleton for its corpse to become one */ - if ((i_ptr->sval == SV_CORPSE_CORPSE) && (r_ptr->flags3 & RF9_DROP_SKELETON)) + if ((i_ptr->sval == SV_CORPSE_CORPSE) && (r_ptr->flags & RF_DROP_SKELETON)) { /* Replace the corpse with a skeleton */ object_prep(i_ptr, lookup_kind(TV_CORPSE, SV_CORPSE_SKELETON)); diff --git a/src/powers.cc b/src/powers.cc index 632fb338..45ca3e0c 100644 --- a/src/powers.cc +++ b/src/powers.cc @@ -21,6 +21,7 @@ #include "monster2.hpp" #include "monster3.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_type.hpp" #include "object1.hpp" #include "object2.hpp" @@ -561,7 +562,7 @@ static void power_activate(int power) m_ptr = &m_list[c_ptr->m_idx]; auto const r_ptr = m_ptr->race(); - if ((r_ptr->flags1 & RF1_NEVER_MOVE) && (m_ptr->status == MSTATUS_PET) && (!(r_ptr->flags9 & RF9_SPECIAL_GENE))) + if ((r_ptr->flags & RF_NEVER_MOVE) && (m_ptr->status == MSTATUS_PET) && (!(r_ptr->flags & RF_SPECIAL_GENE))) { q_ptr = &forge; object_prep(q_ptr, lookup_kind(TV_HYPNOS, 1)); @@ -1001,7 +1002,7 @@ static void power_activate(int power) monster_type *m_ptr = &m_list[c_ptr->m_idx]; auto const r_ptr = m_ptr->race(); - if (r_ptr->flags3 & RF3_EVIL) + if (r_ptr->flags & RF_EVIL) { /* Delete the monster, rather than killing it. */ delete_monster_idx(c_ptr->m_idx); diff --git a/src/q_bounty.cc b/src/q_bounty.cc index dac4fef7..26d3f6cd 100644 --- a/src/q_bounty.cc +++ b/src/q_bounty.cc @@ -2,6 +2,7 @@ #include "monster2.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_spell_flag.hpp" #include "object1.hpp" #include "object2.hpp" @@ -23,29 +24,29 @@ static bool_ lua_mon_hook_bounty(int r_idx) monster_race* r_ptr = &r_info[r_idx]; /* Reject uniques */ - if (r_ptr->flags1 & RF1_UNIQUE) return (FALSE); + if (r_ptr->flags & RF_UNIQUE) return (FALSE); /* Reject those who cannot leave anything */ - if (!(r_ptr->flags9 & RF9_DROP_CORPSE)) return (FALSE); + if (!(r_ptr->flags & RF_DROP_CORPSE)) return (FALSE); /* Accept only monsters that can be generated */ - if (r_ptr->flags9 & RF9_SPECIAL_GENE) return (FALSE); - if (r_ptr->flags9 & RF9_NEVER_GENE) return (FALSE); + if (r_ptr->flags & RF_SPECIAL_GENE) return (FALSE); + if (r_ptr->flags & RF_NEVER_GENE) return (FALSE); /* Reject pets */ - if (r_ptr->flags7 & RF7_PET) return (FALSE); + if (r_ptr->flags & RF_PET) return (FALSE); /* Reject friendly creatures */ - if (r_ptr->flags7 & RF7_FRIENDLY) return (FALSE); + if (r_ptr->flags & RF_FRIENDLY) return (FALSE); /* Accept only monsters that are not breeders */ if (r_ptr->spells & SF_MULTIPLY) return (FALSE); /* Forbid joke monsters */ - if (r_ptr->flags8 & RF8_JOKEANGBAND) return (FALSE); + if (r_ptr->flags & RF_JOKEANGBAND) return (FALSE); /* Accept only monsters that are not good */ - if (r_ptr->flags3 & RF3_GOOD) return (FALSE); + if (r_ptr->flags & RF_GOOD) return (FALSE); /* The rest are acceptable */ return (TRUE); diff --git a/src/q_god.cc b/src/q_god.cc index d9bf955c..4634b46b 100644 --- a/src/q_god.cc +++ b/src/q_god.cc @@ -9,6 +9,7 @@ #include "hook_enter_dungeon_in.hpp" #include "hook_player_level_in.hpp" #include "hooks.hpp" +#include "monster_race_flag.hpp" #include "monster_spell_flag.hpp" #include "object2.hpp" #include "player_type.hpp" @@ -469,13 +470,13 @@ static void quest_god_set_god_dungeon_attributes_eru() d_info[DUNGEON_GOD].rules[0].percent = 50; /* M: We want evil or flying characters */ - d_info[DUNGEON_GOD].rules[0].mflags3 = RF3_EVIL; + d_info[DUNGEON_GOD].rules[0].mflags = RF_EVIL; d_info[DUNGEON_GOD].rules[1].mode = 3; d_info[DUNGEON_GOD].rules[1].percent = 50; /* M: We want evil or flying characters */ - d_info[DUNGEON_GOD].rules[1].mflags7 = RF7_CAN_FLY; + d_info[DUNGEON_GOD].rules[1].mflags = RF_CAN_FLY; } static void quest_god_set_god_dungeon_attributes_manwe() @@ -533,11 +534,11 @@ static void quest_god_set_god_dungeon_attributes_manwe() /* M: We want air(poison-type) or flying characters. Orcs * too. They would have ransacked his elf-loving temple :) */ - d_info[DUNGEON_GOD].rules[0].mflags2 = RF2_INVISIBLE; - d_info[DUNGEON_GOD].rules[1].mflags3 = RF3_ORC | RF3_IM_POIS; + d_info[DUNGEON_GOD].rules[0].mflags = RF_INVISIBLE; + d_info[DUNGEON_GOD].rules[1].mflags = RF_ORC | RF_IM_POIS; d_info[DUNGEON_GOD].rules[2].mspells = SF_BR_POIS | SF_BR_GRAV; d_info[DUNGEON_GOD].rules[3].mspells = SF_BA_POIS; - d_info[DUNGEON_GOD].rules[4].mflags7 = RF7_CAN_FLY; + d_info[DUNGEON_GOD].rules[4].mflags = RF_CAN_FLY; } static void quest_god_set_god_dungeon_attributes_tulkas() @@ -582,7 +583,7 @@ static void quest_god_set_god_dungeon_attributes_tulkas() d_info[DUNGEON_GOD].rules[0].percent = 100; /* M: plenty demons please */ - d_info[DUNGEON_GOD].rules[0].mflags3 = RF3_DEMON | RF3_EVIL; + d_info[DUNGEON_GOD].rules[0].mflags = RF_DEMON | RF_EVIL; } static void quest_god_set_god_dungeon_attributes_melkor() @@ -635,7 +636,7 @@ static void quest_god_set_god_dungeon_attributes_melkor() d_info[DUNGEON_GOD].rules[1].percent = 20; /* M: */ - d_info[DUNGEON_GOD].rules[1].mflags3 = RF3_GOOD; + d_info[DUNGEON_GOD].rules[1].mflags = RF_GOOD; } static void quest_god_set_god_dungeon_attributes_yavanna() @@ -685,8 +686,8 @@ static void quest_god_set_god_dungeon_attributes_yavanna() d_info[DUNGEON_GOD].rules[0].percent = 100; /* M: */ - d_info[DUNGEON_GOD].rules[0].mflags3 = - RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING; + d_info[DUNGEON_GOD].rules[0].mflags = + RF_DEMON | RF_UNDEAD | RF_NONLIVING; } static void quest_god_set_god_dungeon_attributes_aule() @@ -783,11 +784,11 @@ static void quest_god_set_god_dungeon_attributes_varda() d_info[DUNGEON_GOD].rules[4].percent = 20; /* M: We want air(poison-type) or flying characters. Orcs too. */ - d_info[DUNGEON_GOD].rules[0].mflags2 = RF2_INVISIBLE; - d_info[DUNGEON_GOD].rules[1].mflags3 = RF3_ORC | RF3_IM_POIS; + d_info[DUNGEON_GOD].rules[0].mflags = RF_INVISIBLE; + d_info[DUNGEON_GOD].rules[1].mflags = RF_ORC | RF_IM_POIS; d_info[DUNGEON_GOD].rules[2].mspells = SF_BR_POIS | SF_BR_GRAV; d_info[DUNGEON_GOD].rules[3].mspells = SF_BA_POIS; - d_info[DUNGEON_GOD].rules[4].mflags7 = RF7_CAN_FLY; + d_info[DUNGEON_GOD].rules[4].mflags = RF_CAN_FLY; } static void quest_god_set_god_dungeon_attributes_ulmo() @@ -830,9 +831,9 @@ static void quest_god_set_god_dungeon_attributes_ulmo() d_info[DUNGEON_GOD].rules[2].percent = 30; /* M: Aquatic creatures only. */ - d_info[DUNGEON_GOD].rules[0].mflags3 = RF7_CAN_FLY; - d_info[DUNGEON_GOD].rules[1].mflags3 = RF7_AQUATIC; - d_info[DUNGEON_GOD].rules[2].mflags3 = RF3_RES_WATE; + d_info[DUNGEON_GOD].rules[0].mflags = RF_CAN_FLY; + d_info[DUNGEON_GOD].rules[1].mflags = RF_AQUATIC; + d_info[DUNGEON_GOD].rules[2].mflags = RF_RES_WATE; } static void quest_god_set_god_dungeon_attributes_mandos() @@ -876,7 +877,7 @@ static void quest_god_set_god_dungeon_attributes_mandos() d_info[DUNGEON_GOD].rules[0].r_char[2] = '\0'; d_info[DUNGEON_GOD].rules[0].r_char[3] = '\0'; d_info[DUNGEON_GOD].rules[0].r_char[4] = '\0'; - d_info[DUNGEON_GOD].rules[0].mflags3 = RF3_UNDEAD | RF3_EVIL; + d_info[DUNGEON_GOD].rules[0].mflags = RF_UNDEAD | RF_EVIL; } static bool_ quest_god_level_end_gen_hook(void *, void *, void *) diff --git a/src/q_main.cc b/src/q_main.cc index b81ba9b3..4cbf63ef 100644 --- a/src/q_main.cc +++ b/src/q_main.cc @@ -5,6 +5,7 @@ #include "hook_new_monster_in.hpp" #include "hooks.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_type.hpp" #include "player_type.hpp" #include "tables.hpp" @@ -153,9 +154,9 @@ static bool_ quest_sauron_resurect_hook(void *, void *in_, void *) monster_type *m_ptr = &m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; - if ((r_ptr->flags7 & RF7_NAZGUL) && r_info[get_sauron()].max_num) + if ((r_ptr->flags & RF_NAZGUL) && r_info[get_sauron()].max_num) { - msg_format("Somehow you feel %s is not totally destroyed...", (r_ptr->flags1 & RF1_FEMALE ? "she" : "he")); + msg_format("Somehow you feel %s is not totally destroyed...", (r_ptr->flags & RF_FEMALE ? "she" : "he")); r_ptr->max_num = 1; } else if ((m_ptr->r_idx == get_sauron()) && (quest[QUEST_ONE].status < QUEST_STATUS_FINISHED)) diff --git a/src/q_poison.cc b/src/q_poison.cc index 464c93ef..b1205dca 100644 --- a/src/q_poison.cc +++ b/src/q_poison.cc @@ -10,6 +10,7 @@ #include "messages.hpp" #include "monster2.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_spell_flag.hpp" #include "monster_type.hpp" #include "object2.hpp" diff --git a/src/q_rand.cc b/src/q_rand.cc index 26903848..f22675b7 100644 --- a/src/q_rand.cc +++ b/src/q_rand.cc @@ -16,6 +16,7 @@ #include "monster2.hpp" #include "monster3.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_spell_flag.hpp" #include "monster_type.hpp" #include "object1.hpp" @@ -112,23 +113,23 @@ void initialize_random_quests(int n) r_ptr = &r_info[q_ptr->r_idx]; /* Accept only monsters that can be generated */ - if (r_ptr->flags9 & RF9_SPECIAL_GENE) continue; - if (r_ptr->flags9 & RF9_NEVER_GENE) continue; + if (r_ptr->flags & RF_SPECIAL_GENE) continue; + if (r_ptr->flags & RF_NEVER_GENE) continue; /* Accept only monsters that are not breeders */ if (r_ptr->spells & SF_MULTIPLY) continue; /* Forbid joke monsters */ - if (r_ptr->flags8 & RF8_JOKEANGBAND) continue; + if (r_ptr->flags & RF_JOKEANGBAND) continue; /* Accept only monsters that are not friends */ - if (r_ptr->flags7 & RF7_PET) continue; + if (r_ptr->flags & RF_PET) continue; /* Refuse nazguls */ - if (r_ptr->flags7 & RF7_NAZGUL) continue; + if (r_ptr->flags & RF_NAZGUL) continue; /* Accept only monsters that are not good */ - if (r_ptr->flags3 & RF3_GOOD) continue; + if (r_ptr->flags & RF_GOOD) continue; /* If module says a monster race is friendly, then skip */ if (modules[game_module_idx].race_status != NULL) @@ -151,11 +152,11 @@ void initialize_random_quests(int n) if (!ok) continue; /* No mutliple uniques */ - if ((r_ptr->flags1 & RF1_UNIQUE) && + if ((r_ptr->flags & RF_UNIQUE) && ((q_ptr->type != 1) || (r_ptr->max_num == -1))) continue; /* No single non uniques */ - if ((!(r_ptr->flags1 & RF1_UNIQUE)) && (q_ptr->type == 1)) continue; + if ((!(r_ptr->flags & RF_UNIQUE)) && (q_ptr->type == 1)) continue; /* Level restriction */ min_level = (rl > RQ_LEVEL_CAP) ? RQ_LEVEL_CAP : rl; @@ -175,7 +176,7 @@ void initialize_random_quests(int n) } else { - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { r_ptr->max_num = -1; } diff --git a/src/rule_type.hpp b/src/rule_type.hpp index d6424641..b88ce7bf 100644 --- a/src/rule_type.hpp +++ b/src/rule_type.hpp @@ -1,6 +1,7 @@ #pragma once #include "h-basic.h" +#include "monster_race_flag_set.hpp" #include "monster_spell_flag_set.hpp" /* Define monster generation rules */ @@ -9,13 +10,7 @@ struct rule_type byte mode = 0; /* Mode of combination of the monster flags */ byte percent = 0; /* Percent of monsters affected by the rule */ - u32b mflags1 = 0; /* The monster flags that are allowed */ - u32b mflags2 = 0; - u32b mflags3 = 0; - u32b mflags7 = 0; - u32b mflags8 = 0; - u32b mflags9 = 0; - + monster_race_flag_set mflags; /* The monster flags that are allowed */ monster_spell_flag_set mspells; /* Monster spells the are allowed */ char r_char[5] = { 0 }; /* Monster race allowed */ diff --git a/src/spells1.cc b/src/spells1.cc index 98520b04..8e109a77 100644 --- a/src/spells1.cc +++ b/src/spells1.cc @@ -22,6 +22,7 @@ #include "monster2.hpp" #include "monster3.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_spell_flag.hpp" #include "monster_type.hpp" #include "object1.hpp" @@ -93,7 +94,7 @@ s16b poly_r_idx(int r_idx) int i, r; /* Hack -- Uniques never polymorph */ - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) return (r_idx); /* Pick a (possibly new) non-unique race */ @@ -109,7 +110,7 @@ s16b poly_r_idx(int r_idx) r_ptr = &r_info[r]; /* Ignore unique monsters */ - if (r_ptr->flags1 & RF1_UNIQUE) continue; + if (r_ptr->flags & RF_UNIQUE) continue; /* Use that index */ r_idx = r; @@ -353,7 +354,7 @@ void teleport_away(int m_idx, int dis) /* Update monster light */ auto const r_ptr = m_ptr->race(); - if (r_ptr->flags9 & RF9_HAS_LITE) + if (r_ptr->flags & RF_HAS_LITE) { p_ptr->update |= (PU_MON_LITE); } @@ -471,7 +472,7 @@ static void teleport_to_player(int m_idx) lite_spot(ny, nx); /* Update monster light */ - if (r_ptr->flags9 & RF9_HAS_LITE) p_ptr->update |= (PU_MON_LITE); + if (r_ptr->flags & RF_HAS_LITE) p_ptr->update |= (PU_MON_LITE); } @@ -600,7 +601,7 @@ void teleport_player(int dis) { auto const r_ptr = m_list[cave[oy + yy][ox + xx].m_idx].race(); - if ((r_ptr->spells & SF_TPORT) && !(r_ptr->flags3 & RF3_RES_TELE)) + if ((r_ptr->spells & SF_TPORT) && !(r_ptr->flags & RF_RES_TELE)) /* * The latter limitation is to avoid * totally unkillable suckers... @@ -3891,7 +3892,7 @@ static bool_ project_o(int who, int r, int y, int x, int dam, int typ) monster_race *r_ptr = &r_info[o_ptr->pval2]; s32b dama, radius = 7; - if (r_ptr->flags1 & RF1_FORCE_MAXHP) + if (r_ptr->flags & RF_FORCE_MAXHP) dama = maxroll(r_ptr->hdice, r_ptr->hside); else dama = damroll(r_ptr->hdice, r_ptr->hside); @@ -4356,17 +4357,17 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) auto r_ptr = m_ptr->race(); /* Mega Gachk */ - if (r_ptr->flags2 & RF2_DEATH_ORB) + if (r_ptr->flags & RF_DEATH_ORB) { msg_format("%^s is immune to magic.", m_name); return seen; } /* Some monsters get "destroyed" */ - if ((r_ptr->flags3 & RF3_DEMON) || - (r_ptr->flags3 & RF3_UNDEAD) || - (r_ptr->flags2 & RF2_STUPID) || - (r_ptr->flags3 & RF3_NONLIVING) || + if ((r_ptr->flags & RF_DEMON) || + (r_ptr->flags & RF_UNDEAD) || + (r_ptr->flags & RF_STUPID) || + (r_ptr->flags & RF_NONLIVING) || (strchr("Evg", r_ptr->d_char))) { /* Special note at death */ @@ -4397,48 +4398,48 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_IDENTIFY: break; /* none of the above anger */ case GF_TRAP_DEMONSOUL: - if (r_ptr->flags3 & RF3_DEMON) + if (r_ptr->flags & RF_DEMON) get_angry = TRUE; break; case GF_KILL_WALL: - if (r_ptr->flags3 & RF3_HURT_ROCK) + if (r_ptr->flags & RF_HURT_ROCK) get_angry = TRUE; break; case GF_HOLY_FIRE: - if (!(r_ptr->flags3 & RF3_GOOD)) + if (!(r_ptr->flags & RF_GOOD)) get_angry = TRUE; break; case GF_TURN_UNDEAD: case GF_DISP_UNDEAD: - if (r_ptr->flags3 & RF3_UNDEAD) + if (r_ptr->flags & RF_UNDEAD) get_angry = TRUE; break; case GF_TURN_EVIL: case GF_DISP_EVIL: - if (r_ptr->flags3 & RF3_EVIL) + if (r_ptr->flags & RF_EVIL) get_angry = TRUE; break; case GF_DISP_GOOD: - if (r_ptr->flags3 & RF3_GOOD) + if (r_ptr->flags & RF_GOOD) get_angry = TRUE; break; case GF_DISP_DEMON: - if (r_ptr->flags3 & RF3_DEMON) + if (r_ptr->flags & RF_DEMON) get_angry = TRUE; break; case GF_DISP_LIVING: case GF_UNBREATH: - if (!(r_ptr->flags3 & RF3_UNDEAD) && - !(r_ptr->flags3 & RF3_NONLIVING)) + if (!(r_ptr->flags & RF_UNDEAD) && + !(r_ptr->flags & RF_NONLIVING)) get_angry = TRUE; break; case GF_PSI: case GF_PSI_DRAIN: - if (!(r_ptr->flags2 & RF2_EMPTY_MIND)) + if (!(r_ptr->flags & RF_EMPTY_MIND)) get_angry = TRUE; break; case GF_DOMINATION: - if (!(r_ptr->flags3 & RF3_NO_CONF)) + if (!(r_ptr->flags & RF_NO_CONF)) get_angry = TRUE; break; case GF_OLD_POLY: @@ -4448,7 +4449,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) break; case GF_LITE: case GF_LITE_WEAK: - if (r_ptr->flags3 & RF3_HURT_LITE) + if (r_ptr->flags & RF_HURT_LITE) get_angry = TRUE; break; case GF_INSTA_DEATH: @@ -4497,7 +4498,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) { if (seen) obvious = TRUE; - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { note = " resists."; dam = 0; @@ -4520,12 +4521,12 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_ACID: { if (seen) obvious = TRUE; - if (r_ptr->flags9 & RF9_SUSCEP_ACID) + if (r_ptr->flags & RF_SUSCEP_ACID) { note = " is hit hard."; dam *= 3; } - if (r_ptr->flags3 & RF3_IM_ACID) + if (r_ptr->flags & RF_IM_ACID) { note = " resists a lot."; dam /= 9; @@ -4537,12 +4538,12 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_ELEC: { if (seen) obvious = TRUE; - if (r_ptr->flags9 & RF9_SUSCEP_ELEC) + if (r_ptr->flags & RF_SUSCEP_ELEC) { note = " is hit hard."; dam *= 3; } - if (r_ptr->flags3 & RF3_IM_ELEC) + if (r_ptr->flags & RF_IM_ELEC) { note = " resists a lot."; dam /= 9; @@ -4554,12 +4555,12 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_FIRE: { if (seen) obvious = TRUE; - if (r_ptr->flags3 & RF3_SUSCEP_FIRE) + if (r_ptr->flags & RF_SUSCEP_FIRE) { note = " is hit hard."; dam *= 3; } - if (r_ptr->flags3 & RF3_IM_FIRE) + if (r_ptr->flags & RF_IM_FIRE) { note = " resists a lot."; dam /= 9; @@ -4571,12 +4572,12 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_COLD: { if (seen) obvious = TRUE; - if (r_ptr->flags3 & RF3_SUSCEP_COLD) + if (r_ptr->flags & RF_SUSCEP_COLD) { note = " is hit hard."; dam *= 3; } - if (r_ptr->flags3 & RF3_IM_COLD) + if (r_ptr->flags & RF_IM_COLD) { note = " resists a lot."; dam /= 9; @@ -4589,13 +4590,13 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) { if (seen) obvious = TRUE; if (magik(25)) do_pois = (10 + randint(11) + r) / (r + 1); - if (r_ptr->flags9 & RF9_SUSCEP_POIS) + if (r_ptr->flags & RF_SUSCEP_POIS) { note = " is hit hard."; dam *= 3; do_pois *= 2; } - if (r_ptr->flags3 & RF3_IM_POIS) + if (r_ptr->flags & RF_IM_POIS) { note = " resists a lot."; dam /= 9; @@ -4610,7 +4611,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) { if (seen) obvious = TRUE; if (magik(15)) do_pois = (10 + randint(11) + r) / (r + 1); - if ((r_ptr->flags3 & RF3_NONLIVING) || (r_ptr->flags3 & RF3_UNDEAD)) + if ((r_ptr->flags & RF_NONLIVING) || (r_ptr->flags & RF_UNDEAD)) { note = " is immune."; dam = 0; @@ -4624,7 +4625,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) { if (seen) obvious = TRUE; - if (r_ptr->flags3 & RF3_IM_POIS) + if (r_ptr->flags & RF_IM_POIS) { note = " resists."; dam *= 3; @@ -4638,7 +4639,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_HELL_FIRE: { if (seen) obvious = TRUE; - if (r_ptr->flags3 & RF3_EVIL) + if (r_ptr->flags & RF_EVIL) { dam *= 2; note = " is hit hard."; @@ -4650,12 +4651,12 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_HOLY_FIRE: { if (seen) obvious = TRUE; - if (r_ptr->flags3 & RF3_GOOD) + if (r_ptr->flags & RF_GOOD) { dam = 0; note = " is immune."; } - else if (r_ptr->flags3 & RF3_EVIL) + else if (r_ptr->flags & RF_EVIL) { dam *= 2; note = " is hit hard."; @@ -4680,7 +4681,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_PLASMA: { if (seen) obvious = TRUE; - if (r_ptr->flags3 & RF3_RES_PLAS) + if (r_ptr->flags & RF_RES_PLAS) { note = " resists."; dam *= 3; @@ -4693,18 +4694,18 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_NETHER: { if (seen) obvious = TRUE; - if (r_ptr->flags3 & RF3_UNDEAD) + if (r_ptr->flags & RF_UNDEAD) { note = " is immune."; dam = 0; } - else if (r_ptr->flags3 & RF3_RES_NETH) + else if (r_ptr->flags & RF_RES_NETH) { note = " resists."; dam *= 3; dam /= (randint(6) + 6); } - else if (r_ptr->flags3 & RF3_EVIL) + else if (r_ptr->flags & RF_EVIL) { dam /= 2; note = " resists somewhat."; @@ -4723,7 +4724,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) note = " is immune."; dam = 0; } - else if (r_ptr->flags3 & RF3_RES_WATE) + else if (r_ptr->flags & RF_RES_WATE) { note = " resists."; dam *= 3; @@ -4743,7 +4744,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) note = " is immune."; dam = 0; } - else if (r_ptr->flags3 & RF3_RES_WATE) + else if (r_ptr->flags & RF_RES_WATE) { note = " resists."; dam *= 3; @@ -4832,7 +4833,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) do_poly = TRUE; do_conf = (5 + randint(11) + r) / (r + 1); if ((r_ptr->spells & SF_BR_CHAO) || - ((r_ptr->flags3 & RF3_DEMON) && (randint(3) == 1))) + ((r_ptr->flags & RF_DEMON) && (randint(3) == 1))) { note = " resists."; dam *= 3; @@ -4904,7 +4905,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) dam *= 2; dam /= (randint(6) + 6); } - else if (r_ptr->flags3 & RF3_NO_CONF) + else if (r_ptr->flags & RF_NO_CONF) { note = " resists somewhat."; dam /= 2; @@ -4916,7 +4917,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_DISENCHANT: { if (seen) obvious = TRUE; - if (r_ptr->flags3 & RF3_RES_DISE) + if (r_ptr->flags & RF_RES_DISE) { note = " resists."; dam *= 3; @@ -4929,7 +4930,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_NEXUS: { if (seen) obvious = TRUE; - if (r_ptr->flags3 & RF3_RES_NEXU) + if (r_ptr->flags & RF_RES_NEXU) { note = " resists."; dam *= 3; @@ -5082,9 +5083,9 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) if (seen) obvious = TRUE; - if (r_ptr->flags3 & RF3_RES_TELE) + if (r_ptr->flags & RF_RES_TELE) { - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { note = " is unaffected!"; resist_tele = TRUE; @@ -5110,7 +5111,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) { /* 1. slowness */ /* Powerful monsters can resist */ - if ((r_ptr->flags1 & RF1_UNIQUE) || + if ((r_ptr->flags & RF_UNIQUE) || (m_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)) { obvious = FALSE; @@ -5126,7 +5127,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1; /* Attempt a saving throw */ - if ((r_ptr->flags1 & RF1_UNIQUE) || + if ((r_ptr->flags & RF_UNIQUE) || (m_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)) { /* Resist */ @@ -5151,14 +5152,14 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_DISINTEGRATE: { if (seen) obvious = TRUE; - if (r_ptr->flags3 & RF3_HURT_ROCK) + if (r_ptr->flags & RF_HURT_ROCK) { note = " loses some skin!"; note_dies = " evaporates!"; dam *= 2; } - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { if (rand_int(m_ptr->level + 10) > rand_int(p_ptr->lev)) { @@ -5171,7 +5172,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_FEAR: { - if (r_ptr->flags3 & RF3_NO_FEAR) + if (r_ptr->flags & RF_NO_FEAR) note = " is unaffected."; else set_afraid(p_ptr->afraid + (dam / 2) + randint(dam / 2)); @@ -5184,14 +5185,14 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_PSI: { if (seen) obvious = TRUE; - if (r_ptr->flags2 & RF2_EMPTY_MIND) + if (r_ptr->flags & RF_EMPTY_MIND) { dam = 0; note = " is immune!"; } - else if ((r_ptr->flags2 & RF2_STUPID) || - (r_ptr->flags2 & RF2_WEIRD_MIND) || - (r_ptr->flags3 & RF3_ANIMAL) || + else if ((r_ptr->flags & RF_STUPID) || + (r_ptr->flags & RF_WEIRD_MIND) || + (r_ptr->flags & RF_ANIMAL) || (m_ptr->level > randint(3 * dam))) { dam /= 3; @@ -5199,8 +5200,8 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) /* Powerful demons & undead can turn a mindcrafter's * attacks back on them */ - if (((r_ptr->flags3 & RF3_UNDEAD) || - (r_ptr->flags3 & RF3_DEMON)) && + if (((r_ptr->flags & RF_UNDEAD) || + (r_ptr->flags & RF_DEMON)) && (m_ptr->level > p_ptr->lev / 2) && (randint(2) == 1)) { @@ -5229,7 +5230,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) break; case 3: { - if (r_ptr->flags3 & RF3_NO_FEAR) + if (r_ptr->flags & RF_NO_FEAR) note = " is unaffected."; else set_afraid(p_ptr->afraid + 3 + randint(dam)); @@ -5272,14 +5273,14 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_PSI_DRAIN: { if (seen) obvious = TRUE; - if (r_ptr->flags2 & RF2_EMPTY_MIND) + if (r_ptr->flags & RF_EMPTY_MIND) { dam = 0; note = " is immune!"; } - else if ((r_ptr->flags2 & RF2_STUPID) || - (r_ptr->flags2 & RF2_WEIRD_MIND) || - (r_ptr->flags3 & RF3_ANIMAL) || + else if ((r_ptr->flags & RF_STUPID) || + (r_ptr->flags & RF_WEIRD_MIND) || + (r_ptr->flags & RF_ANIMAL) || (m_ptr->level > randint(3 * dam))) { dam /= 3; @@ -5289,8 +5290,8 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) * Powerful demons & undead can turn a mindcrafter's * attacks back on them */ - if (((r_ptr->flags3 & RF3_UNDEAD) || - (r_ptr->flags3 & RF3_DEMON)) && + if (((r_ptr->flags & RF_UNDEAD) || + (r_ptr->flags & RF_DEMON)) && (m_ptr->level > p_ptr->lev / 2) && (randint(2) == 1)) { @@ -5336,7 +5337,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1; /* Attempt a saving throw */ - if ((r_ptr->flags1 & RF1_UNIQUE) || + if ((r_ptr->flags & RF_UNIQUE) || (m_ptr->level > 5 + randint(dam))) { /* Resist */ @@ -5360,8 +5361,8 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) if (seen) obvious = TRUE; /* Attempt a saving throw */ - if ((r_ptr->flags1 & RF1_UNIQUE) || - (r_ptr->flags3 & RF3_NO_CONF) || + if ((r_ptr->flags & RF_UNIQUE) || + (r_ptr->flags & RF_NO_CONF) || (m_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)) { /* Resist */ @@ -5371,8 +5372,8 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) * Powerful demons & undead can turn a mindcrafter's * attacks back on them */ - if (((r_ptr->flags3 & RF3_UNDEAD) || - (r_ptr->flags3 & RF3_DEMON)) && + if (((r_ptr->flags & RF_UNDEAD) || + (r_ptr->flags & RF_DEMON)) && (m_ptr->level > p_ptr->lev / 2) && (randint(2) == 1)) { @@ -5397,7 +5398,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) break; default: { - if (r_ptr->flags3 & RF3_NO_FEAR) + if (r_ptr->flags & RF_NO_FEAR) note = " is unaffected."; else set_afraid(p_ptr->afraid + dam); @@ -5418,7 +5419,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) { note = " is in your thrall!"; m_ptr->status = MSTATUS_PET; - if ((r_ptr->flags3 & RF3_ANIMAL) && (!(r_ptr->flags3 & RF3_EVIL))) + if ((r_ptr->flags & RF_ANIMAL) && (!(r_ptr->flags & RF_EVIL))) inc_piety(GOD_YAVANNA, m_ptr->level * 2); } else @@ -5450,13 +5451,13 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) if (seen) obvious = TRUE; do_stun = (randint(15) + 1) / (r + 1); if (magik(33)) do_cut = (10 + randint(15) + r) / (r + 1); - if (r_ptr->flags3 & RF3_SUSCEP_COLD) + if (r_ptr->flags & RF_SUSCEP_COLD) { note = " is hit hard."; dam *= 3; do_cut *= 2; } - if (r_ptr->flags3 & RF3_IM_COLD) + if (r_ptr->flags & RF_IM_COLD) { note = " resists a lot."; dam /= 9; @@ -5471,9 +5472,9 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) { if (seen) obvious = TRUE; - if ((r_ptr->flags3 & RF3_UNDEAD) || - (r_ptr->flags3 & RF3_DEMON) || - (r_ptr->flags3 & RF3_NONLIVING) || + if ((r_ptr->flags & RF_UNDEAD) || + (r_ptr->flags & RF_DEMON) || + (r_ptr->flags & RF_NONLIVING) || (strchr("Egv", r_ptr->d_char))) { note = " is unaffected!"; @@ -5488,14 +5489,14 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_DEATH_RAY: { if (seen) obvious = TRUE; - if ((r_ptr->flags3 & RF3_UNDEAD) || - (r_ptr->flags3 & RF3_NONLIVING)) + if ((r_ptr->flags & RF_UNDEAD) || + (r_ptr->flags & RF_NONLIVING)) { note = " is immune."; obvious = FALSE; dam = 0; } - else if (((r_ptr->flags1 & RF1_UNIQUE) && + else if (((r_ptr->flags & RF_UNIQUE) && (randint(888) != 666)) || (((m_ptr->level + randint(20)) > randint((dam) + randint(10))) && randint(100) != 66 )) @@ -5519,7 +5520,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) do_poly = TRUE; /* Powerful monsters can resist */ - if ((r_ptr->flags1 & RF1_UNIQUE) || + if ((r_ptr->flags & RF_UNIQUE) || (m_ptr->mflag & MFLAG_QUEST) || (m_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)) { @@ -5610,7 +5611,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) if (seen) obvious = TRUE; /* Powerful monsters can resist */ - if ((r_ptr->flags1 & RF1_UNIQUE) || + if ((r_ptr->flags & RF_UNIQUE) || (m_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)) { note = " is unaffected!"; @@ -5636,7 +5637,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) if (seen) obvious = TRUE; /* Attempt a saving throw */ - if ((r_ptr->flags3 & RF3_NO_SLEEP) || + if ((r_ptr->flags & RF_NO_SLEEP) || (m_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)) { /* No obvious effect */ @@ -5662,7 +5663,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) if (seen) obvious = TRUE; /* Attempt a saving throw */ - if ((r_ptr->flags1 & RF1_UNIQUE) || + if ((r_ptr->flags & RF_UNIQUE) || (m_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)) { note = " is unaffected!"; @@ -5689,7 +5690,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) /* Attempt a saving throw */ if ((m_ptr->mflag & MFLAG_QUEST) || - (r_ptr->flags3 & RF3_NO_CONF) || + (r_ptr->flags & RF_NO_CONF) || (m_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 5)) { /* Resist */ @@ -5707,7 +5708,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) { note = " suddenly seems friendly!"; m_ptr->status = MSTATUS_FRIEND; - if ((r_ptr->flags3 & RF3_ANIMAL) && (!(r_ptr->flags3 & RF3_EVIL))) + if ((r_ptr->flags & RF_ANIMAL) && (!(r_ptr->flags & RF_EVIL))) inc_piety(GOD_YAVANNA, m_ptr->level * 2); } } @@ -5726,7 +5727,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) /* Attempt a saving throw */ if ((m_ptr->mflag & MFLAG_QUEST) || - (r_ptr->flags3 & RF3_NO_CONF) || + (r_ptr->flags & RF_NO_CONF) || (m_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 5)) { /* Resist */ @@ -5746,7 +5747,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) if (can_create_companion()) m_ptr->status = MSTATUS_COMPANION; else m_ptr->status = MSTATUS_PET; - if ((r_ptr->flags3 & RF3_ANIMAL) && (!(r_ptr->flags3 & RF3_EVIL))) + if ((r_ptr->flags & RF_ANIMAL) && (!(r_ptr->flags & RF_EVIL))) inc_piety(GOD_YAVANNA, m_ptr->level * 2); } } @@ -5762,9 +5763,9 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) if (seen) obvious = TRUE; /* Attempt a saving throw */ - if ((r_ptr->flags1 & RF1_UNIQUE) || + if ((r_ptr->flags & RF_UNIQUE) || (m_ptr->mflag & MFLAG_QUEST) || - (!(r_ptr->flags3 & RF3_UNDEAD)) || + (!(r_ptr->flags & RF_UNDEAD)) || (m_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)) { /* Resist */ @@ -5793,9 +5794,9 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) if (seen) obvious = TRUE; /* Attempt a saving throw */ - if ((r_ptr->flags1 & RF1_UNIQUE) || + if ((r_ptr->flags & RF_UNIQUE) || (m_ptr->mflag & MFLAG_QUEST) || - (!(r_ptr->flags1 & RF1_NEVER_MOVE)) || + (!(r_ptr->flags & RF_NEVER_MOVE)) || (m_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)) { /* Resist */ @@ -5824,10 +5825,10 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) if (seen) obvious = TRUE; /* Attempt a saving throw */ - if ((r_ptr->flags1 & RF1_UNIQUE) || + if ((r_ptr->flags & RF_UNIQUE) || (m_ptr->mflag & MFLAG_QUEST) || - (!(r_ptr->flags3 & RF3_ANIMAL)) || - (r_ptr->flags3 & RF3_NO_CONF) || + (!(r_ptr->flags & RF_ANIMAL)) || + (r_ptr->flags & RF_NO_CONF) || (m_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)) { /* Resist */ @@ -5857,9 +5858,9 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) if (seen) obvious = TRUE; /* Attempt a saving throw */ - if ((r_ptr->flags1 & RF1_UNIQUE) || + if ((r_ptr->flags & RF_UNIQUE) || (m_ptr->mflag & MFLAG_QUEST) || - (!(r_ptr->flags3 & RF3_DEMON)) || + (!(r_ptr->flags & RF_DEMON)) || (m_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)) { /* Resist */ @@ -5891,7 +5892,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) do_conf = damroll(3, (dam / 2)) + 1; /* Attempt a saving throw */ - if ((r_ptr->flags3 & RF3_NO_CONF) || + if ((r_ptr->flags & RF_NO_CONF) || (m_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)) { /* Resist */ @@ -5938,7 +5939,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) do_conf = damroll(3, (dam / 2)) + 1; /* Attempt a saving throw */ - if ((r_ptr->flags3 & RF3_NO_CONF) || + if ((r_ptr->flags & RF_NO_CONF) || (m_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)) { /* Resist */ @@ -5978,7 +5979,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1; /* Attempt a saving throw */ - if ((r_ptr->flags1 & RF1_UNIQUE) || + if ((r_ptr->flags & RF_UNIQUE) || (m_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)) { /* Resist */ @@ -5990,7 +5991,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) } /* Non_living resists */ - if (r_ptr->flags3 & RF3_NONLIVING) + if (r_ptr->flags & RF_NONLIVING) { /* Resist */ do_stun = 0; @@ -6012,7 +6013,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) do_conf = damroll(3, (dam / 2)) + 1; /* Attempt a saving throw */ - if ((r_ptr->flags3 & RF3_NO_CONF) || + if ((r_ptr->flags & RF_NO_CONF) || (m_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)) { /* Resist */ @@ -6043,7 +6044,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_LITE_WEAK: { /* Hurt by light */ - if (r_ptr->flags3 & RF3_HURT_LITE) + if (r_ptr->flags & RF_HURT_LITE) { /* Obvious effect */ if (seen) obvious = TRUE; @@ -6075,7 +6076,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) dam *= 2; dam /= (randint(6) + 6); } - else if (r_ptr->flags3 & RF3_HURT_LITE) + else if (r_ptr->flags & RF_HURT_LITE) { note = " cringes from the light!"; note_dies = " shrivels away in the light!"; @@ -6092,8 +6093,8 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) /* Likes darkness... */ if ((r_ptr->spells & SF_BR_DARK) || - (r_ptr->flags3 & RF3_ORC) || - (r_ptr->flags3 & RF3_HURT_LITE)) + (r_ptr->flags & RF_ORC) || + (r_ptr->flags & RF_HURT_LITE)) { note = " resists."; dam *= 2; @@ -6107,7 +6108,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_KILL_WALL: { /* Hurt by rock remover */ - if (r_ptr->flags3 & RF3_HURT_ROCK) + if (r_ptr->flags & RF_HURT_ROCK) { /* Notice effect */ if (seen) obvious = TRUE; @@ -6134,13 +6135,13 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) if (dungeon_flags & DF_NO_TELEPORT) break; /* No teleport on special levels */ /* Only affect undead */ - if (r_ptr->flags3 & RF3_UNDEAD) + if (r_ptr->flags & RF_UNDEAD) { bool_ resists_tele = FALSE; - if (r_ptr->flags3 & RF3_RES_TELE) + if (r_ptr->flags & RF_RES_TELE) { - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { note = " is unaffected!"; resists_tele = TRUE; @@ -6177,13 +6178,13 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) { if (dungeon_flags & DF_NO_TELEPORT) break; /* No teleport on special levels */ /* Only affect evil */ - if (r_ptr->flags3 & RF3_EVIL) + if (r_ptr->flags & RF_EVIL) { bool_ resists_tele = FALSE; - if (r_ptr->flags3 & RF3_RES_TELE) + if (r_ptr->flags & RF_RES_TELE) { - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { note = " is unaffected!"; resists_tele = TRUE; @@ -6221,9 +6222,9 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) bool_ resists_tele = FALSE; if (dungeon_flags & DF_NO_TELEPORT) break; /* No teleport on special levels */ - if (r_ptr->flags3 & RF3_RES_TELE) + if (r_ptr->flags & RF_RES_TELE) { - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { note = " is unaffected!"; resists_tele = TRUE; @@ -6254,7 +6255,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_TURN_UNDEAD: { /* Only affect undead */ - if (r_ptr->flags3 & RF3_UNDEAD) + if (r_ptr->flags & RF_UNDEAD) { /* Obvious */ if (seen) obvious = TRUE; @@ -6289,7 +6290,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_TURN_EVIL: { /* Only affect evil */ - if (r_ptr->flags3 & RF3_EVIL) + if (r_ptr->flags & RF_EVIL) { /* Obvious */ if (seen) obvious = TRUE; @@ -6330,8 +6331,8 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) do_fear = damroll(3, (dam / 2)) + 1; /* Attempt a saving throw */ - if ((r_ptr->flags1 & RF1_UNIQUE) || - (r_ptr->flags3 & RF3_NO_FEAR) || + if ((r_ptr->flags & RF_UNIQUE) || + (r_ptr->flags & RF_NO_FEAR) || (m_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)) { /* No obvious effect */ @@ -6350,7 +6351,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_DISP_UNDEAD: { /* Only affect undead */ - if (r_ptr->flags3 & RF3_UNDEAD) + if (r_ptr->flags & RF_UNDEAD) { /* Obvious */ if (seen) obvious = TRUE; @@ -6378,7 +6379,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_DISP_EVIL: { /* Only affect evil */ - if (r_ptr->flags3 & RF3_EVIL) + if (r_ptr->flags & RF_EVIL) { /* Obvious */ if (seen) obvious = TRUE; @@ -6405,7 +6406,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_DISP_GOOD: { /* Only affect good */ - if (r_ptr->flags3 & RF3_GOOD) + if (r_ptr->flags & RF_GOOD) { /* Obvious */ if (seen) obvious = TRUE; @@ -6432,8 +6433,8 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_DISP_LIVING: { /* Only affect non-undead */ - if (!(r_ptr->flags3 & RF3_UNDEAD) && - !(r_ptr->flags3 & RF3_NONLIVING)) + if (!(r_ptr->flags & RF_UNDEAD) && + !(r_ptr->flags & RF_NONLIVING)) { /* Obvious */ if (seen) obvious = TRUE; @@ -6460,7 +6461,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_DISP_DEMON: { /* Only affect demons */ - if (r_ptr->flags3 & RF3_DEMON) + if (r_ptr->flags & RF_DEMON) { /* Obvious */ if (seen) obvious = TRUE; @@ -6527,9 +6528,9 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) if (seen) obvious = TRUE; /* Check race */ - if ((r_ptr->flags1 & RF1_UNIQUE) || + if ((r_ptr->flags & RF_UNIQUE) || (m_ptr->mflag & MFLAG_QUEST) || - (!(r_ptr->flags3 & RF3_DEMON))) + (!(r_ptr->flags & RF_DEMON))) { /* No obvious effect */ note = " is unaffected!"; @@ -6546,7 +6547,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) object_prep(i_ptr, lookup_kind(TV_CORPSE, SV_CORPSE_CORPSE)); /* Unique corpses are unique */ - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { object_aware(i_ptr); i_ptr->name1 = 201; @@ -6573,7 +6574,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_INSTA_DEATH: { - if (magik(95) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags3 & RF3_UNDEAD) && !(r_ptr->flags3 & RF3_NONLIVING)) { + if (magik(95) && !(r_ptr->flags & RF_UNIQUE) && !(r_ptr->flags & RF_UNDEAD) && !(r_ptr->flags & RF_NONLIVING)) { /* Kill outright, but reduce exp. */ m_ptr->level = m_ptr->level / 3; dam = 32535; /* Should be enough */ @@ -6598,7 +6599,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) /* "Unique" monsters cannot be polymorphed */ - if (r_ptr->flags1 & RF1_UNIQUE) do_poly = FALSE; + if (r_ptr->flags & RF_UNIQUE) do_poly = FALSE; /* * "Quest" monsters cannot be polymorphed @@ -6607,7 +6608,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) do_poly = FALSE; /* "Unique" monsters can only be "killed" by the player unless they are player's friends */ - if ((r_ptr->flags1 & RF1_UNIQUE) && (m_ptr->status <= MSTATUS_NEUTRAL_P)) + if ((r_ptr->flags & RF_UNIQUE) && (m_ptr->status <= MSTATUS_NEUTRAL_P)) { /* Uniques may only be killed by the player */ if (who && (who != -2) && (dam > m_ptr->hp)) dam = m_ptr->hp; @@ -6621,7 +6622,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) if ((who > 0) && (dam > m_ptr->hp)) dam = m_ptr->hp; } - if (do_pois && (!(r_ptr->flags3 & RF3_IM_POIS)) && (!(r_ptr->flags3 & SF_BR_POIS)) && hurt_monster(m_ptr)) + if (do_pois && (!(r_ptr->flags & RF_IM_POIS)) && (!(r_ptr->flags & SF_BR_POIS)) && hurt_monster(m_ptr)) { if (m_ptr->poisoned) note = " is more poisoned."; else note = " is poisoned."; @@ -6785,7 +6786,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) /* Confusion and Chaos breathers (and sleepers) never confuse */ else if (do_conf && - !(r_ptr->flags3 & RF3_NO_CONF) && + !(r_ptr->flags & RF_NO_CONF) && !(r_ptr->spells & SF_BR_CONF) && !(r_ptr->spells & SF_BR_CHAO) && hurt_monster(m_ptr)) { @@ -8488,7 +8489,7 @@ bool_ project(int who, int rad, int y, int x, int dam, int typ, int flg) { auto ref_ptr = m_list[cave[y][x].m_idx].race(); - if ((ref_ptr->flags2 & RF2_REFLECTING) && (randint(10) != 1) + if ((ref_ptr->flags & RF_REFLECTING) && (randint(10) != 1) && (dist_hack > 1)) { int t_y, t_x; diff --git a/src/spells2.cc b/src/spells2.cc index 08d65a4b..535b03f2 100644 --- a/src/spells2.cc +++ b/src/spells2.cc @@ -22,6 +22,7 @@ #include "monster2.hpp" #include "monster3.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_spell_flag.hpp" #include "monster_type.hpp" #include "notes.hpp" @@ -847,132 +848,132 @@ void self_knowledge(FILE *fff) { monster_race *r_ptr = &r_info[p_ptr->body_monster]; - if (r_ptr->flags1 & RF1_CHAR_CLEAR || - r_ptr->flags1 & RF1_ATTR_CLEAR) + if (r_ptr->flags & RF_CHAR_CLEAR || + r_ptr->flags & RF_ATTR_CLEAR) info[i++] = "You are transparent."; - if ((r_ptr->flags1 & RF1_CHAR_MULTI) || - (r_ptr->flags2 & RF2_SHAPECHANGER)) + if ((r_ptr->flags & RF_CHAR_MULTI) || + (r_ptr->flags & RF_SHAPECHANGER)) info[i++] = "Your form constantly changes."; - if (r_ptr->flags1 & RF1_ATTR_MULTI) + if (r_ptr->flags & RF_ATTR_MULTI) info[i++] = "Your color constantly changes."; - if (r_ptr->flags1 & RF1_NEVER_BLOW) + if (r_ptr->flags & RF_NEVER_BLOW) info[i++] = "You do not have a physical weapon."; - if (r_ptr->flags1 & RF1_NEVER_MOVE) + if (r_ptr->flags & RF_NEVER_MOVE) info[i++] = "You cannot move."; - if ((r_ptr->flags1 & RF1_RAND_25) && - (r_ptr->flags1 & RF1_RAND_50)) + if ((r_ptr->flags & RF_RAND_25) && + (r_ptr->flags & RF_RAND_50)) info[i++] = "You move extremely erratically."; - else if (r_ptr->flags1 & RF1_RAND_50) + else if (r_ptr->flags & RF_RAND_50) info[i++] = "You move somewhat erratically."; - else if (r_ptr->flags1 & RF1_RAND_25) + else if (r_ptr->flags & RF_RAND_25) info[i++] = "You move a bit erratically."; - if (r_ptr->flags2 & RF2_STUPID) + if (r_ptr->flags & RF_STUPID) info[i++] = "You are very stupid (INT -4)."; - if (r_ptr->flags2 & RF2_SMART) + if (r_ptr->flags & RF_SMART) info[i++] = "You are very smart (INT +4)."; /* Not implemented */ - if (r_ptr->flags2 & RF2_CAN_SPEAK) + if (r_ptr->flags & RF_CAN_SPEAK) info[i++] = "You can speak."; else info[i++] = "You cannot speak."; /* Not implemented */ - if (r_ptr->flags2 & RF2_COLD_BLOOD) + if (r_ptr->flags & RF_COLD_BLOOD) info[i++] = "You are cold blooded."; /* Not implemented */ - if (r_ptr->flags2 & RF2_EMPTY_MIND) + if (r_ptr->flags & RF_EMPTY_MIND) info[i++] = "You have an empty mind."; - if (r_ptr->flags2 & RF2_WEIRD_MIND) + if (r_ptr->flags & RF_WEIRD_MIND) info[i++] = "You have a weird mind."; if (r_ptr->spells & SF_MULTIPLY) info[i++] = "You can multiply."; - if (r_ptr->flags2 & RF2_POWERFUL) + if (r_ptr->flags & RF_POWERFUL) info[i++] = "You have strong breath."; /* Not implemented */ - if (r_ptr->flags2 & RF2_ELDRITCH_HORROR) + if (r_ptr->flags & RF_ELDRITCH_HORROR) info[i++] = "You are an eldritch horror."; - if (r_ptr->flags2 & RF2_OPEN_DOOR) + if (r_ptr->flags & RF_OPEN_DOOR) info[i++] = "You can open doors."; else info[i++] = "You cannot open doors."; - if (r_ptr->flags2 & RF2_BASH_DOOR) + if (r_ptr->flags & RF_BASH_DOOR) info[i++] = "You can bash doors."; else info[i++] = "You cannot bash doors."; - if (r_ptr->flags2 & RF2_PASS_WALL) + if (r_ptr->flags & RF_PASS_WALL) info[i++] = "You can pass walls."; - if (r_ptr->flags2 & RF2_KILL_WALL) + if (r_ptr->flags & RF_KILL_WALL) info[i++] = "You destroy walls."; /* Not implemented */ - if (r_ptr->flags2 & RF2_MOVE_BODY) + if (r_ptr->flags & RF_MOVE_BODY) info[i++] = "You can move monsters."; /* Not implemented */ - if (r_ptr->flags3 & RF3_ORC) + if (r_ptr->flags & RF_ORC) info[i++] = "You have orc blood in your veins."; /* Not implemented */ - else if (r_ptr->flags3 & RF3_TROLL) + else if (r_ptr->flags & RF_TROLL) info[i++] = "You have troll blood in your veins."; /* Not implemented */ - else if (r_ptr->flags3 & RF3_GIANT) + else if (r_ptr->flags & RF_GIANT) info[i++] = "You have giant blood in your veins."; /* Not implemented */ - else if (r_ptr->flags3 & RF3_DRAGON) + else if (r_ptr->flags & RF_DRAGON) info[i++] = "You have dragon blood in your veins."; /* Not implemented */ - else if (r_ptr->flags3 & RF3_DEMON) + else if (r_ptr->flags & RF_DEMON) info[i++] = "You have demon blood in your veins."; /* Not implemented */ - else if (r_ptr->flags3 & RF3_UNDEAD) + else if (r_ptr->flags & RF_UNDEAD) info[i++] = "You are an undead."; /* Not implemented */ - else if (r_ptr->flags3 & RF3_ANIMAL) + else if (r_ptr->flags & RF_ANIMAL) info[i++] = "You are an animal."; /* Not implemented */ - else if (r_ptr->flags3 & RF3_THUNDERLORD) + else if (r_ptr->flags & RF_THUNDERLORD) info[i++] = "You have thunderlord blood in your veins."; - if (r_ptr->flags3 & RF3_EVIL) + if (r_ptr->flags & RF_EVIL) info[i++] = "You are inherently evil."; - else if (r_ptr->flags3 & RF3_GOOD) + else if (r_ptr->flags & RF_GOOD) info[i++] = "You are inherently good."; - if (r_ptr->flags3 & RF3_AURA_COLD) + if (r_ptr->flags & RF_AURA_COLD) info[i++] = "You are surrounded by a chilly aura."; /* Not implemented */ - if (r_ptr->flags3 & RF3_NONLIVING) + if (r_ptr->flags & RF_NONLIVING) info[i++] = "You are not living."; /* Not implemented */ - if (r_ptr->flags3 & RF3_HURT_LITE) + if (r_ptr->flags & RF_HURT_LITE) info[i++] = "Your eyes are vulnerable to bright light."; /* Not implemented */ - if (r_ptr->flags3 & RF3_HURT_ROCK) + if (r_ptr->flags & RF_HURT_ROCK) info[i++] = "You can be hurt by rock remover."; - if (r_ptr->flags3 & RF3_SUSCEP_FIRE) + if (r_ptr->flags & RF_SUSCEP_FIRE) info[i++] = "You are vulnerable to fire."; - if (r_ptr->flags3 & RF3_SUSCEP_COLD) + if (r_ptr->flags & RF_SUSCEP_COLD) info[i++] = "You are vulnerable to cold."; - if (r_ptr->flags3 & RF3_RES_TELE) + if (r_ptr->flags & RF_RES_TELE) info[i++] = "You are resistant to teleportation."; - if (r_ptr->flags3 & RF3_RES_NETH) + if (r_ptr->flags & RF_RES_NETH) info[i++] = "You are resistant to nether."; - if (r_ptr->flags3 & RF3_RES_WATE) + if (r_ptr->flags & RF_RES_WATE) info[i++] = "You are resistant to water."; - if (r_ptr->flags3 & RF3_RES_PLAS) + if (r_ptr->flags & RF_RES_PLAS) info[i++] = "You are resistant to plasma."; - if (r_ptr->flags3 & RF3_RES_WATE) + if (r_ptr->flags & RF_RES_WATE) info[i++] = "You are resistant to nexus."; - if (r_ptr->flags3 & RF3_RES_DISE) + if (r_ptr->flags & RF_RES_DISE) info[i++] = "You are resistant to disease."; /* Not implemented */ - if (r_ptr->flags3 & RF3_NO_SLEEP) + if (r_ptr->flags & RF_NO_SLEEP) info[i++] = "You cannot be slept."; /* Not implemented */ - if (r_ptr->flags3 & RF3_UNIQUE_4) + if (r_ptr->flags & RF_UNIQUE_4) info[i++] = "You are a Nazgul."; - if (r_ptr->flags3 & RF3_NO_FEAR) + if (r_ptr->flags & RF_NO_FEAR) info[i++] = "You are immune to fear."; - if (r_ptr->flags3 & RF3_NO_STUN) + if (r_ptr->flags & RF_NO_STUN) info[i++] = "You are immune to stun."; - if (r_ptr->flags3 & RF3_NO_CONF) + if (r_ptr->flags & RF_NO_CONF) info[i++] = "You are immune to confusion."; - if (r_ptr->flags3 & RF3_NO_SLEEP) + if (r_ptr->flags & RF_NO_SLEEP) info[i++] = "You are immune to sleep."; if (r_ptr->spells & SF_SHRIEK) @@ -1154,49 +1155,49 @@ void self_knowledge(FILE *fff) if (r_ptr->spells & SF_S_UNIQUE) info[i++] = "You can magically summon an unique monster."; /* Not implemented */ - if (r_ptr->flags7 & RF7_AQUATIC) + if (r_ptr->flags & RF_AQUATIC) info[i++] = "You are aquatic."; /* Not implemented */ - if (r_ptr->flags7 & RF7_CAN_SWIM) + if (r_ptr->flags & RF_CAN_SWIM) info[i++] = "You can swim."; /* Not implemented */ - if (r_ptr->flags7 & RF7_CAN_FLY) + if (r_ptr->flags & RF_CAN_FLY) info[i++] = "You can fly."; - if ((r_ptr->flags7 & RF7_MORTAL) == 0) + if ((r_ptr->flags & RF_MORTAL) == 0) info[i++] = "You are immortal."; /* Not implemented */ - if (r_ptr->flags7 & RF7_NAZGUL) + if (r_ptr->flags & RF_NAZGUL) info[i++] = "You are a Nazgul."; - if (r_ptr->flags7 & RF7_SPIDER) + if (r_ptr->flags & RF_SPIDER) info[i++] = "You are a spider."; - if (r_ptr->flags8 & RF8_WILD_TOWN) + if (r_ptr->flags & RF_WILD_TOWN) info[i++] = "You appear in towns."; - if (r_ptr->flags8 & RF8_WILD_SHORE) + if (r_ptr->flags & RF_WILD_SHORE) info[i++] = "You appear on the shore."; - if (r_ptr->flags8 & RF8_WILD_OCEAN) + if (r_ptr->flags & RF_WILD_OCEAN) info[i++] = "You appear in the ocean."; - if (r_ptr->flags8 & RF8_WILD_WASTE) + if (r_ptr->flags & RF_WILD_WASTE) info[i++] = "You appear in the waste."; - if (r_ptr->flags8 & RF8_WILD_WOOD) + if (r_ptr->flags & RF_WILD_WOOD) info[i++] = "You appear in woods."; - if (r_ptr->flags8 & RF8_WILD_VOLCANO) + if (r_ptr->flags & RF_WILD_VOLCANO) info[i++] = "You appear in volcanos."; - if (r_ptr->flags8 & RF8_WILD_MOUNTAIN) + if (r_ptr->flags & RF_WILD_MOUNTAIN) info[i++] = "You appear in the mountains."; - if (r_ptr->flags8 & RF8_WILD_GRASS) + if (r_ptr->flags & RF_WILD_GRASS) info[i++] = "You appear in grassy areas."; - if (r_ptr->flags9 & RF9_SUSCEP_ACID) + if (r_ptr->flags & RF_SUSCEP_ACID) info[i++] = "You are vulnerable to acid."; - if (r_ptr->flags9 & RF9_SUSCEP_ELEC) + if (r_ptr->flags & RF_SUSCEP_ELEC) info[i++] = "You are vulnerable to electricity."; - if (r_ptr->flags9 & RF9_SUSCEP_POIS) + if (r_ptr->flags & RF_SUSCEP_POIS) info[i++] = "You are vulnerable to poison."; - if (r_ptr->flags9 & RF9_KILL_TREES) + if (r_ptr->flags & RF_KILL_TREES) info[i++] = "You can eat trees."; - if (r_ptr->flags9 & RF9_WYRM_PROTECT) + if (r_ptr->flags & RF_WYRM_PROTECT) info[i++] = "You are protected by great wyrms of power."; } @@ -2386,7 +2387,7 @@ template <typename P> bool detect_objects_fn(int radius, const char *object_mess monster_type *m_ptr = &m_list[o_ptr->held_m_idx]; auto const r_ptr = m_ptr->race(); - if (!(r_ptr->flags9 & RF9_MIMIC)) + if (!(r_ptr->flags & RF_MIMIC)) { continue; /* Skip mimics completely */ } @@ -2482,7 +2483,7 @@ bool detect_objects_normal(int rad) bool_ detect_monsters_normal(int rad) { auto predicate = [](monster_race *r_ptr) -> bool { - return (!(r_ptr->flags2 & RF2_INVISIBLE)) || + return (!(r_ptr->flags & RF_INVISIBLE)) || p_ptr->see_inv || p_ptr->tim_invis; }; @@ -2505,7 +2506,7 @@ bool_ detect_monsters_normal(int rad) bool_ detect_monsters_invis(int rad) { auto predicate = [](monster_race *r_ptr) -> bool { - return (r_ptr->flags2 & RF2_INVISIBLE); + return (r_ptr->flags & RF_INVISIBLE); }; if (detect_monsters_fn(rad, predicate)) @@ -2523,41 +2524,17 @@ bool_ detect_monsters_invis(int rad) /* - * A "generic" detect monsters routine, tagged to flags3 + * Detect orcs */ -bool_ detect_monsters_xxx(u32b match_flag, int rad) +void detect_monsters_orcs(int rad) { - auto predicate = [match_flag](monster_race *r_ptr) -> bool { - return (r_ptr->flags3 & match_flag); + auto predicate = [](monster_race *r_ptr) -> bool { + return (r_ptr->flags & RF_ORC); }; if (detect_monsters_fn(rad, predicate)) { - cptr desc_monsters = "weird monsters"; - switch (match_flag) - { - case RF3_DEMON: - desc_monsters = "demons"; - break; - case RF3_UNDEAD: - desc_monsters = "the undead"; - break; - case RF3_GOOD: - desc_monsters = "good"; - break; - case RF3_ORC: - desc_monsters = "orcs"; - break; - } - - /* Describe result */ - msg_format("You sense the presence of %s!", desc_monsters); - msg_print(NULL); - return TRUE; - } - else - { - return FALSE; + msg_print("You sense the presence of orcs!"); } } @@ -3991,7 +3968,7 @@ bool_ genocide_aux(bool_ player_cast, char typ) if (!m_ptr->r_idx) continue; /* Hack -- Skip Unique Monsters */ - if (r_ptr->flags1 & RF1_UNIQUE) continue; + if (r_ptr->flags & RF_UNIQUE) continue; /* Hack -- Skip Quest Monsters */ if (m_ptr->mflag & MFLAG_QUEST) continue; @@ -4000,7 +3977,7 @@ bool_ genocide_aux(bool_ player_cast, char typ) if (r_ptr->d_char != typ) continue; /* Oups */ - if (r_ptr->flags2 & RF2_DEATH_ORB) + if (r_ptr->flags & RF_DEATH_ORB) { int wx, wy; int attempts = 500; @@ -4117,7 +4094,7 @@ bool_ mass_genocide(bool_ player_cast) if (!m_ptr->r_idx) continue; /* Hack -- Skip unique monsters */ - if (r_ptr->flags1 & RF1_UNIQUE) continue; + if (r_ptr->flags & RF_UNIQUE) continue; /* Hack -- Skip Quest Monsters */ if (m_ptr->mflag & MFLAG_QUEST) continue; @@ -4126,7 +4103,7 @@ bool_ mass_genocide(bool_ player_cast) if (m_ptr->cdis > MAX_SIGHT) continue; /* Oups */ - if (r_ptr->flags2 & RF2_DEATH_ORB) + if (r_ptr->flags & RF_DEATH_ORB) { int wx, wy; int attempts = 500; @@ -4554,8 +4531,8 @@ void earthquake(int cy, int cx, int r) auto const r_ptr = m_ptr->race(); /* Most monsters cannot co-exist with rock */ - if (!(r_ptr->flags2 & RF2_KILL_WALL) && - !(r_ptr->flags2 & RF2_PASS_WALL)) + if (!(r_ptr->flags & RF_KILL_WALL) && + !(r_ptr->flags & RF_PASS_WALL)) { char m_name[80]; @@ -4563,7 +4540,7 @@ void earthquake(int cy, int cx, int r) sn = 0; /* Monster can move to escape the wall */ - if (!(r_ptr->flags1 & RF1_NEVER_MOVE)) + if (!(r_ptr->flags & RF_NEVER_MOVE)) { /* Look for safety */ for (i = 0; i < 8; i++) @@ -4805,10 +4782,10 @@ static void cave_temp_room_lite(void) update_mon(c_ptr->m_idx, FALSE); /* Stupid monsters rarely wake up */ - if (r_ptr->flags2 & RF2_STUPID) chance = 10; + if (r_ptr->flags & RF_STUPID) chance = 10; /* Smart monsters always wake up */ - if (r_ptr->flags2 & RF2_SMART) chance = 100; + if (r_ptr->flags & RF_SMART) chance = 100; /* Sometimes monsters wake up */ if (m_ptr->csleep && (rand_int(100) < chance)) @@ -5165,7 +5142,7 @@ void teleport_swap(int dir) monster_type *m_ptr = &m_list[c_ptr->m_idx]; auto const r_ptr = m_ptr->race(); - if (r_ptr->flags3 & RF3_RES_TELE) + if (r_ptr->flags & RF_RES_TELE) { msg_print("Your teleportation is blocked!"); } diff --git a/src/spells2.hpp b/src/spells2.hpp index ce72a883..ae3099da 100644 --- a/src/spells2.hpp +++ b/src/spells2.hpp @@ -2,6 +2,7 @@ #include "h-basic.h" #include "identify_mode.hpp" +#include "monster_race_flag_set.hpp" #include "object_filter.hpp" #include "object_type_fwd.hpp" @@ -32,7 +33,7 @@ extern bool detect_objects_gold(int rad); extern bool detect_objects_normal(int rad); extern bool_ detect_monsters_normal(int rad); extern bool_ detect_monsters_invis(int rad); -extern bool_ detect_monsters_xxx(u32b match_flag, int rad); +extern void detect_monsters_orcs(int rad); extern bool_ detect_all(int rad); extern void stair_creation(void); extern bool_ wall_stone(int y, int x); diff --git a/src/spells3.cc b/src/spells3.cc index b5b69598..26a15541 100644 --- a/src/spells3.cc +++ b/src/spells3.cc @@ -9,6 +9,7 @@ #include "monster2.hpp" #include "monster3.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_type.hpp" #include "object1.hpp" #include "object2.hpp" @@ -2271,7 +2272,7 @@ casting_result melkor_mind_steal() auto const r_ptr = m_ptr->race(); if ((randint(m_ptr->level) < chance) && - ((r_ptr->flags1 & RF1_UNIQUE) == 0)) + ((r_ptr->flags & RF_UNIQUE) == 0)) { p_ptr->control = target_who; m_ptr->mflag |= MFLAG_CONTROL; diff --git a/src/tables.cc b/src/tables.cc index 02bdfedf..5f873630 100644 --- a/src/tables.cc +++ b/src/tables.cc @@ -10,6 +10,7 @@ #include "tables.h" #include "modules.hpp" +#include "monster_race_flag.hpp" #include "monster_spell_flag.hpp" #include "options.hpp" #include "q_library.hpp" diff --git a/src/traps.cc b/src/traps.cc index 7911ad2d..8786e858 100644 --- a/src/traps.cc +++ b/src/traps.cc @@ -21,6 +21,7 @@ #include "gods.hpp" #include "monster2.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_type.hpp" #include "object1.hpp" #include "object2.hpp" @@ -222,8 +223,8 @@ static bool_ player_handle_trap_of_walls(void) auto const r_ptr = m_ptr->race(); /* Most monsters cannot co-exist with rock */ - if ((!(r_ptr->flags2 & RF2_KILL_WALL)) && - (!(r_ptr->flags2 & RF2_PASS_WALL))) + if ((!(r_ptr->flags & RF_KILL_WALL)) && + (!(r_ptr->flags & RF_PASS_WALL))) { char m_name[80]; @@ -231,7 +232,7 @@ static bool_ player_handle_trap_of_walls(void) sn = 0; /* Monster can move to escape the wall */ - if (!(r_ptr->flags1 & RF1_NEVER_MOVE)) + if (!(r_ptr->flags & RF_NEVER_MOVE)) { /* Look for safety */ for (i = 0; i < 8; i++) @@ -2450,7 +2451,7 @@ bool_ mon_hit_trap_aux_scroll(int m_idx, int sval) monster_race *r_ptr = &r_info[m_ptr->r_idx]; genocide_aux(FALSE, r_ptr->d_char); /* although there's no point in a multiple genocide trap... */ - return (!(r_ptr->flags1 & RF1_UNIQUE)); + return (!(r_ptr->flags & RF_UNIQUE)); } case SV_SCROLL_MASS_GENOCIDE: for (k = 0; k < 8; k++) @@ -2613,7 +2614,7 @@ bool_ mon_hit_trap_aux_potion(int m_idx, object_type *o_ptr) case SV_POTION_LIFE: { monster_race *r_ptr = &r_info[m_ptr->r_idx]; - if (r_ptr->flags3 & RF3_UNDEAD) + if (r_ptr->flags & RF_UNDEAD) { typ = GF_HOLY_FIRE; dam = damroll(20, 20); @@ -2683,17 +2684,17 @@ bool_ mon_hit_trap(int m_idx) /* Can set off check */ /* Ghosts only set off Ghost traps */ - if ((r_ptr->flags2 & RF2_PASS_WALL) && !(f2 & TRAP2_KILL_GHOST)) return (FALSE); + if ((r_ptr->flags & RF_PASS_WALL) && !(f2 & TRAP2_KILL_GHOST)) return (FALSE); /* Some traps are specialized to some creatures */ if (f2 & TRAP2_ONLY_MASK) { bool_ affect = FALSE; - if ((f2 & TRAP2_ONLY_DRAGON) && (r_ptr->flags3 & RF3_DRAGON)) affect = TRUE; - if ((f2 & TRAP2_ONLY_DEMON) && (r_ptr->flags3 & RF3_DEMON)) affect = TRUE; - if ((f2 & TRAP2_ONLY_UNDEAD) && (r_ptr->flags3 & RF3_UNDEAD)) affect = TRUE; - if ((f2 & TRAP2_ONLY_EVIL) && (r_ptr->flags3 & RF3_EVIL)) affect = TRUE; - if ((f2 & TRAP2_ONLY_ANIMAL) && (r_ptr->flags3 & RF3_ANIMAL)) affect = TRUE; + if ((f2 & TRAP2_ONLY_DRAGON) && (r_ptr->flags & RF_DRAGON)) affect = TRUE; + if ((f2 & TRAP2_ONLY_DEMON) && (r_ptr->flags & RF_DEMON)) affect = TRUE; + if ((f2 & TRAP2_ONLY_UNDEAD) && (r_ptr->flags & RF_UNDEAD)) affect = TRUE; + if ((f2 & TRAP2_ONLY_EVIL) && (r_ptr->flags & RF_EVIL)) affect = TRUE; + if ((f2 & TRAP2_ONLY_ANIMAL) && (r_ptr->flags & RF_ANIMAL)) affect = TRUE; /* Don't set it off if forbidden */ if (!affect) return (FALSE); @@ -2713,13 +2714,13 @@ bool_ mon_hit_trap(int m_idx) smartness = r_ptr->level; /* Smart monsters are better at detecting traps */ - if (r_ptr->flags2 & RF2_SMART) smartness += 10; + if (r_ptr->flags & RF_SMART) smartness += 10; /* Some monsters have already noticed one of out traps */ if (m_ptr->smart & SM_NOTE_TRAP) smartness += 20; /* Stupid monsters are no good at detecting traps */ - if (r_ptr->flags2 & (RF2_STUPID | RF2_EMPTY_MIND)) smartness = -150; + if (r_ptr->flags & (RF_STUPID | RF_EMPTY_MIND)) smartness = -150; /* Check if the monster notices the trap */ if (randint(300) > (difficulty - smartness + 150)) notice = TRUE; @@ -2738,13 +2739,13 @@ bool_ mon_hit_trap(int m_idx) smartness = r_ptr->level / 5; /* Smart monsters are better at disarming */ - if (r_ptr->flags2 & RF2_SMART) smartness *= 2; + if (r_ptr->flags & RF_SMART) smartness *= 2; /* Stupid monsters never disarm traps */ - if (r_ptr->flags2 & RF2_STUPID) smartness = -150; + if (r_ptr->flags & RF_STUPID) smartness = -150; /* Nonsmart animals never disarm traps */ - if ((r_ptr->flags3 & RF3_ANIMAL) && !(r_ptr->flags2 & RF2_SMART)) smartness = -150; + if ((r_ptr->flags & RF_ANIMAL) && !(r_ptr->flags & RF_SMART)) smartness = -150; /* Check if the monster disarms the trap */ if (randint(120) > (difficulty - smartness + 80)) disarm = TRUE; @@ -2823,9 +2824,9 @@ bool_ mon_hit_trap(int m_idx) cptr note_dies = " dies."; /* Some monsters get "destroyed" */ - if ((r_ptr->flags3 & RF3_DEMON) || - (r_ptr->flags3 & RF3_UNDEAD) || - (r_ptr->flags2 & RF2_STUPID) || + if ((r_ptr->flags & RF_DEMON) || + (r_ptr->flags & RF_UNDEAD) || + (r_ptr->flags & RF_STUPID) || (strchr("Evg", r_ptr->d_char))) { /* Special note at death */ diff --git a/src/wizard1.cc b/src/wizard1.cc index a6072dad..d1631ccf 100644 --- a/src/wizard1.cc +++ b/src/wizard1.cc @@ -4,6 +4,7 @@ #include "cmd7.hpp" #include "ego_item_type.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_spell_flag.hpp" #include "object1.hpp" #include "object2.hpp" @@ -1371,7 +1372,7 @@ static void spoil_mon_desc(cptr fname) monster_race *r_ptr = &r_info[who_i]; /* Get the "name" */ - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { sprintf(nam, "[U] %s", r_ptr->name); } @@ -1401,7 +1402,7 @@ static void spoil_mon_desc(cptr fname) sprintf(ac, "%d", r_ptr->ac); /* Hitpoints */ - if ((r_ptr->flags1 & RF1_FORCE_MAXHP) || (r_ptr->hside == 1)) + if ((r_ptr->flags & RF_FORCE_MAXHP) || (r_ptr->hside == 1)) { sprintf(hp, "%d", r_ptr->hdice * r_ptr->hside); } @@ -1491,22 +1492,19 @@ static void spoil_mon_info(cptr fname) monster_race *r_ptr = &r_info[n]; /* Extract the flags */ - auto const flags1 = r_ptr->flags1; - auto const flags2 = r_ptr->flags2; - auto const flags3 = r_ptr->flags3; - auto const flags9 = r_ptr->flags9; + auto const flags = r_ptr->flags; auto const spells = r_ptr->spells; breath = FALSE; magic = FALSE; /* Extract a gender (if applicable) */ - if (flags1 & RF1_FEMALE) msex = 2; - else if (flags1 & RF1_MALE) msex = 1; + if (flags & RF_FEMALE) msex = 2; + else if (flags & RF_MALE) msex = 1; else msex = 0; /* Prefix */ - if (flags1 & RF1_UNIQUE) + if (flags & RF_UNIQUE) { spoil_out("[U] "); } @@ -1555,7 +1553,7 @@ static void spoil_mon_info(cptr fname) spoil_out(buf); /* Hitpoints */ - if ((flags1 & RF1_FORCE_MAXHP) || (r_ptr->hside == 1)) + if ((flags & RF_FORCE_MAXHP) || (r_ptr->hside == 1)) { sprintf(buf, "Hp:%d ", r_ptr->hdice * r_ptr->hside); } @@ -1581,31 +1579,31 @@ static void spoil_mon_info(cptr fname) spoil_out("This"); - if (flags2 & RF2_ELDRITCH_HORROR) spoil_out (" sanity-blasting"); - if (flags3 & RF3_ANIMAL) spoil_out(" natural"); - if (flags3 & RF3_EVIL) spoil_out(" evil"); - if (flags3 & RF3_GOOD) spoil_out(" good"); - if (flags3 & RF3_UNDEAD) spoil_out(" undead"); - - if (flags3 & RF3_DRAGON) spoil_out(" dragon"); - else if (flags3 & RF3_DEMON) spoil_out(" demon"); - else if (flags3 & RF3_GIANT) spoil_out(" giant"); - else if (flags3 & RF3_TROLL) spoil_out(" troll"); - else if (flags3 & RF3_ORC) spoil_out(" orc"); - else if (flags3 & RF3_THUNDERLORD) spoil_out (" Thunderlord"); + if (flags & RF_ELDRITCH_HORROR) spoil_out (" sanity-blasting"); + if (flags & RF_ANIMAL) spoil_out(" natural"); + if (flags & RF_EVIL) spoil_out(" evil"); + if (flags & RF_GOOD) spoil_out(" good"); + if (flags & RF_UNDEAD) spoil_out(" undead"); + + if (flags & RF_DRAGON) spoil_out(" dragon"); + else if (flags & RF_DEMON) spoil_out(" demon"); + else if (flags & RF_GIANT) spoil_out(" giant"); + else if (flags & RF_TROLL) spoil_out(" troll"); + else if (flags & RF_ORC) spoil_out(" orc"); + else if (flags & RF_THUNDERLORD) spoil_out (" Thunderlord"); else spoil_out(" creature"); spoil_out(" moves"); - if ((flags1 & (RF1_RAND_50)) && (flags1 & (RF1_RAND_25))) + if ((flags & RF_RAND_50) && (flags & RF_RAND_25)) { spoil_out(" extremely erratically"); } - else if (flags1 & (RF1_RAND_50)) + else if (flags & RF_RAND_50) { spoil_out(" somewhat erratically"); } - else if (flags1 & (RF1_RAND_25)) + else if (flags & RF_RAND_25) { spoil_out(" a bit erratically"); } @@ -1614,52 +1612,52 @@ static void spoil_mon_info(cptr fname) spoil_out(" normally"); } - if (flags1 & RF1_NEVER_MOVE) + if (flags & RF_NEVER_MOVE) { spoil_out(", but does not deign to chase intruders"); } spoil_out(". "); - if (!r_ptr->level || (flags1 & RF1_FORCE_DEPTH)) + if (!r_ptr->level || (flags & RF_FORCE_DEPTH)) { sprintf(buf, "%s is never found out of depth. ", wd_che[msex]); spoil_out(buf); } - if (flags1 & RF1_FORCE_SLEEP) + if (flags & RF_FORCE_SLEEP) { sprintf(buf, "%s is always created sluggish. ", wd_che[msex]); spoil_out(buf); } - if (flags2 & RF2_AURA_FIRE) + if (flags & RF_AURA_FIRE) { sprintf(buf, "%s is surrounded by flames. ", wd_che[msex]); spoil_out(buf); } - if (flags2 & RF2_AURA_ELEC) + if (flags & RF_AURA_ELEC) { sprintf(buf, "%s is surrounded by electricity. ", wd_che[msex]); spoil_out(buf); } - if (flags2 & RF2_REFLECTING) + if (flags & RF_REFLECTING) { sprintf(buf, "%s reflects bolt spells. ", wd_che[msex]); spoil_out(buf); } - if (flags1 & RF1_ESCORT) + if (flags & RF_ESCORT) { sprintf(buf, "%s usually appears with ", wd_che[msex]); spoil_out(buf); - if (flags1 & RF1_ESCORTS) spoil_out("escorts. "); + if (flags & RF_ESCORTS) spoil_out("escorts. "); else spoil_out("an escort. "); } - if ((flags1 & RF1_FRIEND) || (flags1 & RF1_FRIENDS)) + if ((flags & RF_FRIEND) || (flags & RF_FRIENDS)) { sprintf(buf, "%s usually appears in groups. ", wd_che[msex]); spoil_out(buf); @@ -1723,7 +1721,7 @@ static void spoil_mon_info(cptr fname) else spoil_out(" or "); spoil_out(vp[i]); } - if (flags2 & RF2_POWERFUL) spoil_out(" powerfully"); + if (flags & RF_POWERFUL) spoil_out(" powerfully"); } /* Collect spells */ @@ -1810,7 +1808,7 @@ static void spoil_mon_info(cptr fname) } spoil_out(" magical, casting spells"); - if (flags2 & RF2_SMART) spoil_out(" intelligently"); + if (flags & RF_SMART) spoil_out(" intelligently"); for (i = 0; i < vn; i++) { @@ -1831,15 +1829,15 @@ static void spoil_mon_info(cptr fname) /* Collect special abilities. */ vn = 0; - if (flags2 & RF2_OPEN_DOOR) vp[vn++] = "open doors"; - if (flags2 & RF2_BASH_DOOR) vp[vn++] = "bash down doors"; - if (flags2 & RF2_PASS_WALL) vp[vn++] = "pass through walls"; - if (flags2 & RF2_KILL_WALL) vp[vn++] = "bore through walls"; - if (flags2 & RF2_MOVE_BODY) vp[vn++] = "push past weaker monsters"; - if (flags2 & RF2_KILL_BODY) vp[vn++] = "destroy weaker monsters"; - if (flags2 & RF2_TAKE_ITEM) vp[vn++] = "pick up objects"; - if (flags2 & RF2_KILL_ITEM) vp[vn++] = "destroy objects"; - if (flags9 & RF9_HAS_LITE) vp[vn++] = "illuminate the dungeon"; + if (flags & RF_OPEN_DOOR) vp[vn++] = "open doors"; + if (flags & RF_BASH_DOOR) vp[vn++] = "bash down doors"; + if (flags & RF_PASS_WALL) vp[vn++] = "pass through walls"; + if (flags & RF_KILL_WALL) vp[vn++] = "bore through walls"; + if (flags & RF_MOVE_BODY) vp[vn++] = "push past weaker monsters"; + if (flags & RF_KILL_BODY) vp[vn++] = "destroy weaker monsters"; + if (flags & RF_TAKE_ITEM) vp[vn++] = "pick up objects"; + if (flags & RF_KILL_ITEM) vp[vn++] = "destroy objects"; + if (flags & RF_HAS_LITE) vp[vn++] = "illuminate the dungeon"; if (vn) { @@ -1854,22 +1852,22 @@ static void spoil_mon_info(cptr fname) spoil_out(". "); } - if (flags2 & RF2_INVISIBLE) + if (flags & RF_INVISIBLE) { spoil_out(wd_che[msex]); spoil_out(" is invisible. "); } - if (flags2 & RF2_COLD_BLOOD) + if (flags & RF_COLD_BLOOD) { spoil_out(wd_che[msex]); spoil_out(" is cold blooded. "); } - if (flags2 & RF2_EMPTY_MIND) + if (flags & RF_EMPTY_MIND) { spoil_out(wd_che[msex]); spoil_out(" is not detected by telepathy. "); } - if (flags2 & RF2_WEIRD_MIND) + if (flags & RF_WEIRD_MIND) { spoil_out(wd_che[msex]); spoil_out(" is rarely detected by telepathy. "); @@ -1879,7 +1877,7 @@ static void spoil_mon_info(cptr fname) spoil_out(wd_che[msex]); spoil_out(" breeds explosively. "); } - if (flags2 & RF2_REGENERATE) + if (flags & RF_REGENERATE) { spoil_out(wd_che[msex]); spoil_out(" regenerates quickly. "); @@ -1887,10 +1885,10 @@ static void spoil_mon_info(cptr fname) /* Collect susceptibilities */ vn = 0; - if (flags3 & RF3_HURT_ROCK) vp[vn++] = "rock remover"; - if (flags3 & RF3_HURT_LITE) vp[vn++] = "bright light"; - if (flags3 & RF3_SUSCEP_FIRE) vp[vn++] = "fire"; - if (flags3 & RF3_SUSCEP_COLD) vp[vn++] = "cold"; + if (flags & RF_HURT_ROCK) vp[vn++] = "rock remover"; + if (flags & RF_HURT_LITE) vp[vn++] = "bright light"; + if (flags & RF_SUSCEP_FIRE) vp[vn++] = "fire"; + if (flags & RF_SUSCEP_COLD) vp[vn++] = "cold"; if (vn) { @@ -1907,11 +1905,11 @@ static void spoil_mon_info(cptr fname) /* Collect immunities */ vn = 0; - if (flags3 & RF3_IM_ACID) vp[vn++] = "acid"; - if (flags3 & RF3_IM_ELEC) vp[vn++] = "lightning"; - if (flags3 & RF3_IM_FIRE) vp[vn++] = "fire"; - if (flags3 & RF3_IM_COLD) vp[vn++] = "cold"; - if (flags3 & RF3_IM_POIS) vp[vn++] = "poison"; + if (flags & RF_IM_ACID) vp[vn++] = "acid"; + if (flags & RF_IM_ELEC) vp[vn++] = "lightning"; + if (flags & RF_IM_FIRE) vp[vn++] = "fire"; + if (flags & RF_IM_COLD) vp[vn++] = "cold"; + if (flags & RF_IM_POIS) vp[vn++] = "poison"; if (vn) { @@ -1928,12 +1926,12 @@ static void spoil_mon_info(cptr fname) /* Collect resistances */ vn = 0; - if (flags3 & RF3_RES_NETH) vp[vn++] = "nether"; - if (flags3 & RF3_RES_WATE) vp[vn++] = "water"; - if (flags3 & RF3_RES_PLAS) vp[vn++] = "plasma"; - if (flags3 & RF3_RES_NEXU) vp[vn++] = "nexus"; - if (flags3 & RF3_RES_DISE) vp[vn++] = "disenchantment"; - if (flags3 & RF3_RES_TELE) vp[vn++] = "teleportation"; + if (flags & RF_RES_NETH) vp[vn++] = "nether"; + if (flags & RF_RES_WATE) vp[vn++] = "water"; + if (flags & RF_RES_PLAS) vp[vn++] = "plasma"; + if (flags & RF_RES_NEXU) vp[vn++] = "nexus"; + if (flags & RF_RES_DISE) vp[vn++] = "disenchantment"; + if (flags & RF_RES_TELE) vp[vn++] = "teleportation"; if (vn) { @@ -1950,10 +1948,10 @@ static void spoil_mon_info(cptr fname) /* Collect non-effects */ vn = 0; - if (flags3 & RF3_NO_STUN) vp[vn++] = "stunned"; - if (flags3 & RF3_NO_FEAR) vp[vn++] = "frightened"; - if (flags3 & RF3_NO_CONF) vp[vn++] = "confused"; - if (flags3 & RF3_NO_SLEEP) vp[vn++] = "slept"; + if (flags & RF_NO_STUN) vp[vn++] = "stunned"; + if (flags & RF_NO_FEAR) vp[vn++] = "frightened"; + if (flags & RF_NO_CONF) vp[vn++] = "confused"; + if (flags & RF_NO_SLEEP) vp[vn++] = "slept"; if (vn) { @@ -1986,12 +1984,12 @@ static void spoil_mon_info(cptr fname) spoil_out(buf); i = 0; - if (flags1 & (RF1_DROP_60)) i += 1; - if (flags1 & (RF1_DROP_90)) i += 2; - if (flags1 & (RF1_DROP_1D2)) i += 2; - if (flags1 & (RF1_DROP_2D2)) i += 4; - if (flags1 & (RF1_DROP_3D2)) i += 6; - if (flags1 & (RF1_DROP_4D2)) i += 8; + if (flags & RF_DROP_60) i += 1; + if (flags & RF_DROP_90) i += 2; + if (flags & RF_DROP_1D2) i += 2; + if (flags & RF_DROP_2D2) i += 4; + if (flags & RF_DROP_3D2) i += 6; + if (flags & RF_DROP_4D2) i += 8; /* Drops gold and/or items */ if (i) @@ -2015,24 +2013,24 @@ static void spoil_mon_info(cptr fname) spoil_out(buf); } - if (flags1 & RF1_DROP_GREAT) + if (flags & RF_DROP_GREAT) { if (sin) spoil_out("n"); spoil_out(" exceptional object"); } - else if (flags1 & RF1_DROP_GOOD) + else if (flags & RF_DROP_GOOD) { spoil_out(" good object"); } - else if (flags1 & RF1_DROP_USEFUL) + else if (flags & RF_DROP_USEFUL) { spoil_out(" useful object"); } - else if (flags1 & RF1_ONLY_ITEM) + else if (flags & RF_ONLY_ITEM) { spoil_out(" object"); } - else if (flags1 & RF1_ONLY_GOLD) + else if (flags & RF_ONLY_GOLD) { spoil_out(" treasure"); } @@ -2045,7 +2043,7 @@ static void spoil_mon_info(cptr fname) } if (i > 1) spoil_out("s"); - if (flags1 & RF1_DROP_CHOSEN) + if (flags & RF_DROP_CHOSEN) { spoil_out(", in addition to chosen objects"); } @@ -2292,7 +2290,7 @@ static void spoil_mon_info(cptr fname) { spoil_out(". "); } - else if (flags1 & RF1_NEVER_BLOW) + else if (flags & RF_NEVER_BLOW) { sprintf(buf, "%s has no physical attacks. ", wd_che[msex]); spoil_out(buf); diff --git a/src/xtra1.cc b/src/xtra1.cc index 8815e756..db057278 100644 --- a/src/xtra1.cc +++ b/src/xtra1.cc @@ -26,6 +26,7 @@ #include "monster1.hpp" #include "monster2.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_type.hpp" #include "object1.hpp" #include "object2.hpp" @@ -1401,7 +1402,7 @@ static void fix_m_list(void) if (m_ptr->hp < 0) continue; /* Skip unseen monsters */ - if (r_ptr->flags9 & RF9_MIMIC) + if (r_ptr->flags & RF_MIMIC) { /* Acquire object */ object_type *o_ptr = &o_list[m_ptr->mimic_o_idx()]; @@ -1441,7 +1442,7 @@ static void fix_m_list(void) if (!r_ptr->total_visible) continue; /* Uniques */ - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { attr = TERM_L_BLUE; } @@ -1453,7 +1454,7 @@ static void fix_m_list(void) { attr = TERM_VIOLET; - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { attr = TERM_RED; } @@ -1461,7 +1462,7 @@ static void fix_m_list(void) } else { - if (!(r_ptr->flags1 & RF1_UNIQUE)) attr = TERM_GREEN; + if (!(r_ptr->flags & RF_UNIQUE)) attr = TERM_GREEN; } @@ -2055,13 +2056,13 @@ void calc_wield_monster() { r_ptr = &r_info[o_ptr->pval]; - if (r_ptr->flags2 & RF2_INVISIBLE) + if (r_ptr->flags & RF_INVISIBLE) p_ptr->invis += 20; - if (r_ptr->flags2 & RF2_REFLECTING) + if (r_ptr->flags & RF_REFLECTING) p_ptr->reflect = TRUE; - if (r_ptr->flags7 & RF7_CAN_FLY) + if (r_ptr->flags & RF_CAN_FLY) p_ptr->ffall = TRUE; - if (r_ptr->flags7 & RF7_AQUATIC) + if (r_ptr->flags & RF_AQUATIC) p_ptr->water_breath = TRUE; } } @@ -2207,29 +2208,29 @@ void calc_body_bonus() p_ptr->ac += r_ptr->ac; p_ptr->pspeed = r_ptr->speed; - if (r_ptr->flags1 & RF1_NEVER_MOVE) p_ptr->immovable = TRUE; - if (r_ptr->flags2 & RF2_STUPID) p_ptr->stat_add[A_INT] -= 1; - if (r_ptr->flags2 & RF2_SMART) p_ptr->stat_add[A_INT] += 1; - if (r_ptr->flags2 & RF2_REFLECTING) p_ptr->reflect = TRUE; - if (r_ptr->flags2 & RF2_INVISIBLE) p_ptr->invis += 20; - if (r_ptr->flags2 & RF2_REGENERATE) p_ptr->regenerate = TRUE; - if (r_ptr->flags2 & RF2_AURA_FIRE) p_ptr->sh_fire = TRUE; - if (r_ptr->flags2 & RF2_AURA_ELEC) p_ptr->sh_elec = TRUE; - if (r_ptr->flags2 & RF2_PASS_WALL) p_ptr->wraith_form = TRUE; - if (r_ptr->flags3 & RF3_SUSCEP_FIRE) p_ptr->sensible_fire = TRUE; - if (r_ptr->flags3 & RF3_IM_ACID) p_ptr->resist_acid = TRUE; - if (r_ptr->flags3 & RF3_IM_ELEC) p_ptr->resist_elec = TRUE; - if (r_ptr->flags3 & RF3_IM_FIRE) p_ptr->resist_fire = TRUE; - if (r_ptr->flags3 & RF3_IM_POIS) p_ptr->resist_pois = TRUE; - if (r_ptr->flags3 & RF3_IM_COLD) p_ptr->resist_cold = TRUE; - if (r_ptr->flags3 & RF3_RES_NETH) p_ptr->resist_neth = TRUE; - if (r_ptr->flags3 & RF3_RES_NEXU) p_ptr->resist_nexus = TRUE; - if (r_ptr->flags3 & RF3_RES_DISE) p_ptr->resist_disen = TRUE; - if (r_ptr->flags3 & RF3_NO_FEAR) p_ptr->resist_fear = TRUE; - if (r_ptr->flags3 & RF3_NO_SLEEP) p_ptr->free_act = TRUE; - if (r_ptr->flags3 & RF3_NO_CONF) p_ptr->resist_conf = TRUE; - if (r_ptr->flags7 & RF7_CAN_FLY) p_ptr->ffall = TRUE; - if (r_ptr->flags7 & RF7_AQUATIC) p_ptr->water_breath = TRUE; + if (r_ptr->flags & RF_NEVER_MOVE) p_ptr->immovable = TRUE; + if (r_ptr->flags & RF_STUPID) p_ptr->stat_add[A_INT] -= 1; + if (r_ptr->flags & RF_SMART) p_ptr->stat_add[A_INT] += 1; + if (r_ptr->flags & RF_REFLECTING) p_ptr->reflect = TRUE; + if (r_ptr->flags & RF_INVISIBLE) p_ptr->invis += 20; + if (r_ptr->flags & RF_REGENERATE) p_ptr->regenerate = TRUE; + if (r_ptr->flags & RF_AURA_FIRE) p_ptr->sh_fire = TRUE; + if (r_ptr->flags & RF_AURA_ELEC) p_ptr->sh_elec = TRUE; + if (r_ptr->flags & RF_PASS_WALL) p_ptr->wraith_form = TRUE; + if (r_ptr->flags & RF_SUSCEP_FIRE) p_ptr->sensible_fire = TRUE; + if (r_ptr->flags & RF_IM_ACID) p_ptr->resist_acid = TRUE; + if (r_ptr->flags & RF_IM_ELEC) p_ptr->resist_elec = TRUE; + if (r_ptr->flags & RF_IM_FIRE) p_ptr->resist_fire = TRUE; + if (r_ptr->flags & RF_IM_POIS) p_ptr->resist_pois = TRUE; + if (r_ptr->flags & RF_IM_COLD) p_ptr->resist_cold = TRUE; + if (r_ptr->flags & RF_RES_NETH) p_ptr->resist_neth = TRUE; + if (r_ptr->flags & RF_RES_NEXU) p_ptr->resist_nexus = TRUE; + if (r_ptr->flags & RF_RES_DISE) p_ptr->resist_disen = TRUE; + if (r_ptr->flags & RF_NO_FEAR) p_ptr->resist_fear = TRUE; + if (r_ptr->flags & RF_NO_SLEEP) p_ptr->free_act = TRUE; + if (r_ptr->flags & RF_NO_CONF) p_ptr->resist_conf = TRUE; + if (r_ptr->flags & RF_CAN_FLY) p_ptr->ffall = TRUE; + if (r_ptr->flags & RF_AQUATIC) p_ptr->water_breath = TRUE; } diff --git a/src/xtra2.cc b/src/xtra2.cc index 4f853928..222d12cd 100644 --- a/src/xtra2.cc +++ b/src/xtra2.cc @@ -27,6 +27,7 @@ #include "monster3.hpp" #include "monster_ego.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" #include "monster_type.hpp" #include "notes.hpp" #include "object1.hpp" @@ -2182,13 +2183,13 @@ void place_corpse(monster_type *m_ptr) auto const r_ptr = m_ptr->race(); /* It has a physical form */ - if (r_ptr->flags9 & RF9_DROP_CORPSE) + if (r_ptr->flags & RF_DROP_CORPSE) { /* Wipe the object */ object_prep(i_ptr, lookup_kind(TV_CORPSE, SV_CORPSE_CORPSE)); /* Unique corpses are unique */ - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { object_aware(i_ptr); i_ptr->name1 = 201; @@ -2218,13 +2219,13 @@ void place_corpse(monster_type *m_ptr) } /* The creature is an animated skeleton. */ - if (!(r_ptr->flags9 & RF9_DROP_CORPSE) && (r_ptr->flags9 & RF9_DROP_SKELETON)) + if (!(r_ptr->flags & RF_DROP_CORPSE) && (r_ptr->flags & RF_DROP_SKELETON)) { /* Wipe the object */ object_prep(i_ptr, lookup_kind(TV_CORPSE, SV_CORPSE_SKELETON)); /* Unique corpses are unique */ - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { object_aware(i_ptr); i_ptr->name1 = 201; @@ -2520,7 +2521,7 @@ void monster_death(int m_idx) } /* If the doppleganger die, the variable must be set accordingly */ - if (r_ptr->flags9 & RF9_DOPPLEGANGER) doppleganger = 0; + if (r_ptr->flags & RF_DOPPLEGANGER) doppleganger = 0; /* Need copy of object list since we're going to mutate it */ auto const object_idxs(m_ptr->hold_o_idxs); @@ -2671,7 +2672,7 @@ void monster_death(int m_idx) } /* Mega-Hack -- drop "winner" treasures */ - else if (r_ptr->flags1 & RF1_DROP_CHOSEN) + else if (r_ptr->flags & RF_DROP_CHOSEN) { if (strstr(r_ptr->name, "Morgoth, Lord of Darkness")) { @@ -2733,7 +2734,7 @@ void monster_death(int m_idx) /* Drop it in the dungeon */ drop_near(q_ptr, -1, y, x); } - else if (r_ptr->flags7 & RF7_NAZGUL) + else if (r_ptr->flags & RF_NAZGUL) { /* Get local object */ q_ptr = &forge; @@ -2818,7 +2819,7 @@ void monster_death(int m_idx) } /* Hack - the protected monsters must be advanged */ - else if (r_ptr->flags9 & RF9_WYRM_PROTECT) + else if (r_ptr->flags & RF_WYRM_PROTECT) { int xx = x, yy = y; int attempts = 100; @@ -3036,7 +3037,7 @@ bool_ mon_take_hit(int m_idx, int dam, bool_ *fear, cptr note) if (health_who == m_idx) p_ptr->redraw |= (PR_FRAME); /* Some mosnters are immune to death */ - if (r_ptr->flags7 & RF7_NO_DEATH) return FALSE; + if (r_ptr->flags & RF_NO_DEATH) return FALSE; /* Wake it up */ m_ptr->csleep = 0; @@ -3060,7 +3061,7 @@ bool_ mon_take_hit(int m_idx, int dam, bool_ *fear, cptr note) /* Extract monster name */ monster_desc(m_name, m_ptr, 0); - if ((r_ptr->flags7 & RF7_DG_CURSE) && (randint(2) == 1)) + if ((r_ptr->flags & RF_DG_CURSE) && (randint(2) == 1)) { int curses = 2 + randint(5); @@ -3074,7 +3075,7 @@ bool_ mon_take_hit(int m_idx, int dam, bool_ *fear, cptr note) while (--curses); } - if (r_ptr->flags2 & RF2_CAN_SPEAK) + if (r_ptr->flags & RF_CAN_SPEAK) { char line_got[80]; /* Dump a message */ @@ -3100,10 +3101,10 @@ bool_ mon_take_hit(int m_idx, int dam, bool_ *fear, cptr note) } /* Death by Physical attack -- non-living monster */ - else if ((r_ptr->flags3 & RF3_DEMON) || - (r_ptr->flags3 & RF3_UNDEAD) || - (r_ptr->flags2 & RF2_STUPID) || - (r_ptr->flags3 & RF3_NONLIVING) || + else if ((r_ptr->flags & RF_DEMON) || + (r_ptr->flags & RF_UNDEAD) || + (r_ptr->flags & RF_STUPID) || + (r_ptr->flags & RF_NONLIVING) || (strchr("Evg", r_ptr->d_char))) { cmsg_format(TERM_L_RED, "You have destroyed %s.", m_name); @@ -3164,7 +3165,7 @@ bool_ mon_take_hit(int m_idx, int dam, bool_ *fear, cptr note) } /* When the player kills a Unique, it stays dead */ - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { r_ptr->max_num = 0; } @@ -3173,7 +3174,7 @@ bool_ mon_take_hit(int m_idx, int dam, bool_ *fear, cptr note) monster_death(m_idx); /* Eru doesn't appreciate good monster death */ - if (r_ptr->flags3 & RF3_GOOD) + if (r_ptr->flags & RF_GOOD) { inc_piety(GOD_ERU, -7 * m_ptr->level); inc_piety(GOD_MANWE, -10 * m_ptr->level); @@ -3185,7 +3186,7 @@ bool_ mon_take_hit(int m_idx, int dam, bool_ *fear, cptr note) } /* Manwe appreciate evil monster death */ - if (r_ptr->flags3 & RF3_EVIL) + if (r_ptr->flags & RF_EVIL) { int inc = std::max(1, m_ptr->level / 2); @@ -3201,7 +3202,7 @@ bool_ mon_take_hit(int m_idx, int dam, bool_ *fear, cptr note) if (praying_to(GOD_TULKAS)) { inc_piety(GOD_TULKAS, inc / 2); - if (r_ptr->flags3 & RF3_DEMON) + if (r_ptr->flags & RF_DEMON) { inc_piety(GOD_TULKAS, inc); } @@ -3209,7 +3210,7 @@ bool_ mon_take_hit(int m_idx, int dam, bool_ *fear, cptr note) } /* Yavanna likes when corruption is destroyed */ - if ((r_ptr->flags3 & RF3_NONLIVING) || (r_ptr->flags3 & RF3_DEMON) || (r_ptr->flags3 & RF3_UNDEAD)) + if ((r_ptr->flags & RF_NONLIVING) || (r_ptr->flags & RF_DEMON) || (r_ptr->flags & RF_UNDEAD)) { int inc = std::max(1, m_ptr->level / 2); inc_piety(GOD_YAVANNA, inc); @@ -3222,12 +3223,12 @@ bool_ mon_take_hit(int m_idx, int dam, bool_ *fear, cptr note) inc_piety(GOD_YAVANNA, -inc); /* Killing animals in her name is a VERY bad idea */ - if (r_ptr->flags3 & RF3_ANIMAL) + if (r_ptr->flags & RF_ANIMAL) inc_piety(GOD_YAVANNA, -(inc * 3)); } /* SHould we absorb its soul? */ - if (p_ptr->absorb_soul && (!(r_ptr->flags3 & RF3_UNDEAD)) && (!(r_ptr->flags3 & RF3_NONLIVING))) + if (p_ptr->absorb_soul && (!(r_ptr->flags & RF_UNDEAD)) && (!(r_ptr->flags & RF_NONLIVING))) { msg_print("You absorb the life of the dying soul."); hp_player(1 + (m_ptr->level / 2) + get_skill_scale(SKILL_NECROMANCY, 40)); @@ -3237,7 +3238,7 @@ bool_ mon_take_hit(int m_idx, int dam, bool_ *fear, cptr note) * XXX XXX XXX Mega-Hack -- Remove random quest rendered * impossible */ - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { int i; @@ -3265,7 +3266,7 @@ bool_ mon_take_hit(int m_idx, int dam, bool_ *fear, cptr note) } /* Make note of unique kills */ - if (r_ptr->flags1 & RF1_UNIQUE) + if (r_ptr->flags & RF_UNIQUE) { char note[80]; @@ -3276,7 +3277,7 @@ bool_ mon_take_hit(int m_idx, int dam, bool_ *fear, cptr note) } /* Recall even invisible uniques or winners */ - if (m_ptr->ml || (r_ptr->flags1 & RF1_UNIQUE)) + if (m_ptr->ml || (r_ptr->flags & RF_UNIQUE)) { /* Count kills this life */ if (r_ptr->r_pkills < MAX_SHORT) r_ptr->r_pkills++; @@ -3620,9 +3621,9 @@ static cptr look_mon_desc(int m_idx) /* Determine if the monster is "living" (vs "undead") */ monster_type *m_ptr = &m_list[m_idx]; auto const r_ptr = m_ptr->race(); - if (r_ptr->flags3 & RF3_UNDEAD) living = FALSE; - if (r_ptr->flags3 & RF3_DEMON) living = FALSE; - if (r_ptr->flags3 & RF3_NONLIVING) living = FALSE; + if (r_ptr->flags & RF_UNDEAD) living = FALSE; + if (r_ptr->flags & RF_DEMON) living = FALSE; + if (r_ptr->flags & RF_NONLIVING) living = FALSE; if (strchr("Egv", r_ptr->d_char)) living = FALSE; @@ -3696,7 +3697,7 @@ static bool target_able(int m_idx) if (is_friend(m_ptr) > 0) return (FALSE); /* Honor flag */ - if (r_info[m_ptr->r_idx].flags7 & RF7_NO_TARGET) return (FALSE); + if (r_info[m_ptr->r_idx].flags & RF_NO_TARGET) return (FALSE); /* XXX XXX XXX Hack -- Never target trappers */ /* if (CLEAR_ATTR && (CLEAR_CHAR)) return (FALSE); */ @@ -4014,7 +4015,7 @@ static int target_set_aux(int y, int x, int mode, cptr info) auto const r_ptr = m_ptr->race(); /* Mimics special treatment -- looks like an object */ - if ((r_ptr->flags9 & RF9_MIMIC) && (m_ptr->csleep)) + if ((r_ptr->flags & RF_MIMIC) && (m_ptr->csleep)) { /* Acquire object */ object_type *o_ptr = &o_list[m_ptr->mimic_o_idx()]; @@ -4137,8 +4138,8 @@ static int target_set_aux(int y, int x, int mode, cptr info) s1 = "It is "; /* Hack -- take account of gender */ - if (r_ptr->flags1 & RF1_FEMALE) s1 = "She is "; - else if (r_ptr->flags1 & RF1_MALE) s1 = "He is "; + if (r_ptr->flags & RF_FEMALE) s1 = "She is "; + else if (r_ptr->flags & RF_MALE) s1 = "He is "; /* Use a preposition */ s2 = "carrying "; @@ -5267,9 +5268,9 @@ void make_wish(void) if (!r_ptr->name) continue; - if (r_ptr->flags9 & RF9_SPECIAL_GENE) continue; - if (r_ptr->flags9 & RF9_NEVER_GENE) continue; - if (r_ptr->flags1 & RF1_UNIQUE) continue; + if (r_ptr->flags & RF_SPECIAL_GENE) continue; + if (r_ptr->flags & RF_NEVER_GENE) continue; + if (r_ptr->flags & RF_UNIQUE) continue; sprintf(buf, "%s", r_ptr->name); strlower(buf); |