std::vector<MONSTER_IDX> who;
for (MONSTER_IDX pet_ctr = player_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
- if (is_pet(&player_ptr->current_floor_ptr->m_list[pet_ctr]) && (player_ptr->riding != pet_ctr)) {
+ const auto &m_ref = player_ptr->current_floor_ptr->m_list[pet_ctr];
+ if (m_ref.is_pet() && (player_ptr->riding != pet_ctr)) {
who.push_back(pet_ctr);
}
}
monster_race *r_ptr;
r_ptr = &r_info[m_ptr->r_idx];
if (r_ptr->kind_flags.has(MonsterKindType::EVIL) && none_bits(r_ptr->flags1, RF1_QUESTOR) && r_ptr->kind_flags.has_not(MonsterKindType::UNIQUE) && !player_ptr->current_floor_ptr->inside_arena && !inside_quest(player_ptr->current_floor_ptr->quest_number) && (r_ptr->level < randint1(player_ptr->lev + 50)) && m_ptr->mflag2.has_not(MonsterConstantFlagType::NOGENO)) {
- if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname) {
+ if (record_named_pet && m_ptr->is_pet() && m_ptr->nickname) {
GAME_TEXT m_name[MAX_NLEN];
monster_desc(player_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
exe_write_diary(player_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
/* Process the monsters (backwards) */
for (MONSTER_IDX pet_ctr = player_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
- if (is_pet(&player_ptr->current_floor_ptr->m_list[pet_ctr])) {
+ const auto &m_ref = player_ptr->current_floor_ptr->m_list[pet_ctr];
+ if (m_ref.is_pet()) {
who.push_back(pet_ctr);
}
}
msg_print(_("その場所にはモンスターはいません。", "There is no monster here."));
return false;
}
- if (!is_pet(m_ptr) && !force) {
+ if (!m_ptr->is_pet() && !force) {
msg_print(_("そのモンスターはペットではありません。", "That monster is not a pet."));
return false;
}
if (player_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx) {
m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx];
- if (!is_pet(m_ptr)) {
+ if (!m_ptr->is_pet()) {
msg_print(_("そのモンスターはペットではない。", "This monster is not a pet."));
return;
}
{
/* Check pets (backwards) */
for (pet_ctr = player_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
- /* Player has pet */
- if (is_pet(&player_ptr->current_floor_ptr->m_list[pet_ctr])) {
+ const auto &m_ref = player_ptr->current_floor_ptr->m_list[pet_ctr];
+ if (m_ref.is_pet()) {
break;
}
}
player_ptr->pet_extra_flags &= ~(PF_PICKUP_ITEMS);
for (pet_ctr = player_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
m_ptr = &player_ptr->current_floor_ptr->m_list[pet_ctr];
-
- if (is_pet(m_ptr)) {
+ if (m_ptr->is_pet()) {
monster_drop_carried_objects(player_ptr, m_ptr);
}
}
}
BIT_FLAGS mode = 0L;
- if (!who || is_pet(&player_ptr->current_floor_ptr->m_list[who])) {
+ if (!who || player_ptr->current_floor_ptr->m_list[who].is_pet()) {
mode |= PM_FORCE_PET;
}
em_ptr->dam = 1;
}
- if (is_pet(em_ptr->m_ptr)) {
+ if (em_ptr->m_ptr->is_pet()) {
em_ptr->note = _("の動きが速くなった。", " starts moving faster.");
(void)set_monster_fast(player_ptr, em_ptr->g_ptr->m_idx, monster_fast_remaining(em_ptr->m_ptr) + 100);
return true;
*/
static int calcutate_capturable_hp(PlayerType *player_ptr, monster_type *m_ptr, int hp)
{
- if (is_pet(m_ptr)) {
+ if (m_ptr->is_pet()) {
return hp * 4L;
}
auto quest_monster = inside_quest(floor_ptr->quest_number);
quest_monster &= (quest_list[floor_ptr->quest_number].type == QuestKindType::KILL_ALL);
- quest_monster &= !is_pet(em_ptr->m_ptr);
+ quest_monster &= !em_ptr->m_ptr->is_pet();
auto cannot_capture = quest_monster;
cannot_capture |= em_ptr->r_ptr->kind_flags.has(MonsterKindType::UNIQUE);
}
bool has_resistance = (player_ptr->current_floor_ptr->inside_arena);
- has_resistance |= is_pet(em_ptr->m_ptr);
+ has_resistance |= em_ptr->m_ptr->is_pet();
has_resistance |= em_ptr->r_ptr->kind_flags.has(MonsterKindType::UNIQUE);
has_resistance |= any_bits(em_ptr->r_ptr->flags1, RF1_QUESTOR);
has_resistance |= em_ptr->r_ptr->population_flags.has(MonsterPopulationType::NAZGUL);
*/
static void effect_damage_killed_pet(PlayerType *player_ptr, effect_monster_type *em_ptr)
{
- bool sad = is_pet(em_ptr->m_ptr) && !(em_ptr->m_ptr->ml);
+ bool sad = em_ptr->m_ptr->is_pet() && !(em_ptr->m_ptr->ml);
if (em_ptr->known && em_ptr->note) {
monster_desc(player_ptr, em_ptr->m_name, em_ptr->m_ptr, MD_TRUE_NAME);
if (em_ptr->see_s_msg) {
msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
}
- if (record_named_pet && is_pet(em_ptr->m_ptr) && em_ptr->m_ptr->nickname) {
+ if (record_named_pet && em_ptr->m_ptr->is_pet() && em_ptr->m_ptr->nickname) {
char m2_name[MAX_NLEN];
monster_desc(player_ptr, m2_name, em_ptr->m_ptr, MD_INDEF_VISIBLE);
exe_write_diary(player_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
*/
static void postprocess_by_effected_pet(PlayerType *player_ptr, effect_monster_type *em_ptr)
{
- if ((em_ptr->dam <= 0) || is_pet(em_ptr->m_ptr) || em_ptr->m_ptr->is_friendly()) {
+ auto *m_ptr = em_ptr->m_ptr;
+ if ((em_ptr->dam <= 0) || m_ptr->is_pet() || m_ptr->is_friendly()) {
return;
}
if (em_ptr->who == 0) {
if (!(em_ptr->flag & PROJECT_NO_HANGEKI)) {
- set_target(em_ptr->m_ptr, monster_target_y, monster_target_x);
+ set_target(m_ptr, monster_target_y, monster_target_x);
}
return;
}
- if ((em_ptr->who > 0) && is_pet(em_ptr->m_caster_ptr) && !player_bold(player_ptr, em_ptr->m_ptr->target_y, em_ptr->m_ptr->target_x)) {
- set_target(em_ptr->m_ptr, em_ptr->m_caster_ptr->fy, em_ptr->m_caster_ptr->fx);
+ const auto &m_caster_ref = *em_ptr->m_caster_ptr;
+ if ((em_ptr->who > 0) && m_caster_ref.is_pet() && !player_bold(player_ptr, m_ptr->target_y, m_ptr->target_x)) {
+ set_target(m_ptr, m_caster_ref.fy, m_caster_ref.fx);
}
}
continue;
}
- if (!is_pet(m_ptr)) {
+ if (!m_ptr->is_pet()) {
m_ptr->hp = m_ptr->maxhp = m_ptr->max_maxhp;
(void)set_monster_fast(player_ptr, i, 0);
(void)set_monster_slow(player_ptr, i, 0);
auto *m_ptr = &floor_ptr->m_list[i];
monster_race *r_ptr;
int delta = 0;
- if (!monster_is_valid(m_ptr) || is_pet(m_ptr)) {
+ if (!monster_is_valid(m_ptr) || m_ptr->is_pet()) {
continue;
}
for (MONSTER_IDX i = player_ptr->current_floor_ptr->m_max - 1, party_monster_num = 1; (i >= 1) && (party_monster_num < MAX_PARTY_MON); i--) {
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
- if (!monster_is_valid(m_ptr) || !is_pet(m_ptr) || (i == player_ptr->riding) || check_pet_preservation_conditions(player_ptr, m_ptr)) {
+ if (!monster_is_valid(m_ptr) || !m_ptr->is_pet() || (i == player_ptr->riding) || check_pet_preservation_conditions(player_ptr, m_ptr)) {
continue;
}
for (MONSTER_IDX i = player_ptr->current_floor_ptr->m_max - 1; i >= 1; i--) {
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
GAME_TEXT m_name[MAX_NLEN];
- if (!monster_is_valid(m_ptr) || !is_pet(m_ptr) || !m_ptr->nickname || (player_ptr->riding == i)) {
+ if (!monster_is_valid(m_ptr) || !m_ptr->is_pet() || !m_ptr->nickname || (player_ptr->riding == i)) {
continue;
}
continue;
}
- if (is_pet(m_ptr) && i != player_ptr->riding) {
+ if (m_ptr->is_pet() && i != player_ptr->riding) {
has_pet = true;
}
if (!monster_is_valid(m_ptr)) {
continue;
}
- if (!is_pet(m_ptr)) {
+ if (!m_ptr->is_pet()) {
continue;
}
pet_settings = true;
int t_friends = 0;
for (int i = player_ptr->current_floor_ptr->m_max - 1; i >= 1; i--) {
m_ptr = &player_ptr->current_floor_ptr->m_list[i];
- if (!monster_is_valid(m_ptr) || !is_pet(m_ptr)) {
+ if (!monster_is_valid(m_ptr) || !m_ptr->is_pet()) {
continue;
}
*dead = false;
cancel_fear_by_pain(player_ptr, mam_pp_ptr);
make_monster_fear(player_ptr, mam_pp_ptr);
- if ((dam > 0) && !is_pet(m_ptr) && !m_ptr->is_friendly() && (mam_pp_ptr->who != m_idx)) {
- if (is_pet(&floor_ptr->m_list[mam_pp_ptr->who]) && !player_bold(player_ptr, m_ptr->target_y, m_ptr->target_x)) {
- set_target(m_ptr, floor_ptr->m_list[mam_pp_ptr->who].fy, floor_ptr->m_list[mam_pp_ptr->who].fx);
+ if ((dam > 0) && !m_ptr->is_pet() && !m_ptr->is_friendly() && (mam_pp_ptr->who != m_idx)) {
+ const auto &m_ref = floor_ptr->m_list[who];
+ if (m_ref.is_pet() && !player_bold(player_ptr, m_ptr->target_y, m_ptr->target_x)) {
+ set_target(m_ptr, m_ref.fy, m_ref.fx);
}
}
ms_ptr->r_ptr = &r_info[ms_ptr->m_ptr->r_idx];
ms_ptr->see_m = is_seen(player_ptr, ms_ptr->m_ptr);
ms_ptr->maneable = player_has_los_bold(player_ptr, ms_ptr->m_ptr->fy, ms_ptr->m_ptr->fx);
- ms_ptr->pet = is_pet(ms_ptr->m_ptr);
+ ms_ptr->pet = ms_ptr->m_ptr->is_pet();
ms_ptr->in_no_magic_dungeon = d_info[player_ptr->dungeon_idx].flags.has(DungeonFeatureType::NO_MAGIC) && floor_ptr->dun_level && (!inside_quest(floor_ptr->quest_number) || quest_type::is_fixed(floor_ptr->quest_number));
return ms_ptr;
}
monster_desc(player_ptr, m_name, m_ptr, 0);
msg_format(_("%sに乗った。", "You ride on %s."), m_name);
- if (is_pet(m_ptr)) {
+ if (m_ptr->is_pet()) {
return true;
}
}
auto *r_ptr = &r_info[this->m_ptr->r_idx];
- if (is_pet(this->m_ptr) && r_ptr->kind_flags.has(MonsterKindType::UNIQUE) && (this->method == RaceBlowMethodType::EXPLODE)) {
+ if (this->m_ptr->is_pet() && r_ptr->kind_flags.has(MonsterKindType::UNIQUE) && (this->method == RaceBlowMethodType::EXPLODE)) {
this->method = RaceBlowMethodType::HIT;
this->d_dice /= 10;
}
md_ptr->do_item = (md_ptr->r_ptr->drop_flags.has_not(MonsterDropType::ONLY_GOLD) || md_ptr->r_ptr->drop_flags.has_any_of({ MonsterDropType::DROP_GOOD, MonsterDropType::DROP_GREAT }));
md_ptr->cloned = md_ptr->m_ptr->mflag2.has(MonsterConstantFlagType::CLONED);
md_ptr->force_coin = get_coin_type(md_ptr->m_ptr->r_idx);
- md_ptr->drop_chosen_item = drop_item && !md_ptr->cloned && !floor_ptr->inside_arena && !player_ptr->phase_out && !is_pet(md_ptr->m_ptr);
+ md_ptr->drop_chosen_item = drop_item && !md_ptr->cloned && !floor_ptr->inside_arena && !player_ptr->phase_out && !md_ptr->m_ptr->is_pet();
return md_ptr;
}
{
md_ptr->md_y = md_ptr->m_ptr->fy;
md_ptr->md_x = md_ptr->m_ptr->fx;
- if (record_named_pet && is_pet(md_ptr->m_ptr) && md_ptr->m_ptr->nickname) {
+ if (record_named_pet && md_ptr->m_ptr->is_pet() && md_ptr->m_ptr->nickname) {
GAME_TEXT m_name[MAX_NLEN];
monster_desc(player_ptr, m_name, md_ptr->m_ptr, MD_INDEF_VISIBLE);
exe_write_diary(player_ptr, DIARY_NAMED_PET, 3, m_name);
static void on_defeat_arena_monster(PlayerType *player_ptr, monster_death_type *md_ptr)
{
auto *floor_ptr = player_ptr->current_floor_ptr;
- if (!floor_ptr->inside_arena || is_pet(md_ptr->m_ptr)) {
+ if (!floor_ptr->inside_arena || md_ptr->m_ptr->is_pet()) {
return;
}
auto *floor_ptr = player_ptr->current_floor_ptr;
bool is_drop_corpse = one_in_(md_ptr->r_ptr->kind_flags.has(MonsterKindType::UNIQUE) ? 1 : 4);
is_drop_corpse &= md_ptr->r_ptr->drop_flags.has_any_of({ MonsterDropType::DROP_CORPSE, MonsterDropType::DROP_SKELETON });
- is_drop_corpse &= !(floor_ptr->inside_arena || player_ptr->phase_out || md_ptr->cloned || ((md_ptr->m_ptr->r_idx == w_ptr->today_mon) && is_pet(md_ptr->m_ptr)));
+ is_drop_corpse &= !(floor_ptr->inside_arena || player_ptr->phase_out || md_ptr->cloned || ((md_ptr->m_ptr->r_idx == w_ptr->today_mon) && md_ptr->m_ptr->is_pet()));
if (!is_drop_corpse) {
return;
}
drop_numbers = 0;
}
- if (is_pet(md_ptr->m_ptr) || player_ptr->phase_out || player_ptr->current_floor_ptr->inside_arena) {
+ if (md_ptr->m_ptr->is_pet() || player_ptr->phase_out || player_ptr->current_floor_ptr->inside_arena) {
drop_numbers = 0;
}
static bool decide_pet_approch_direction(PlayerType *player_ptr, monster_type *m_ptr, monster_type *t_ptr)
{
auto *r_ptr = &r_info[m_ptr->r_idx];
- if (!is_pet(m_ptr)) {
+ if (!m_ptr->is_pet()) {
return false;
}
if (player_ptr->riding_t_m_idx && player_bold(player_ptr, m_ptr->fy, m_ptr->fx)) {
y = floor_ptr->m_list[player_ptr->riding_t_m_idx].fy;
x = floor_ptr->m_list[player_ptr->riding_t_m_idx].fx;
- } else if (is_pet(m_ptr) && player_ptr->pet_t_m_idx) {
+ } else if (m_ptr->is_pet() && player_ptr->pet_t_m_idx) {
y = floor_ptr->m_list[player_ptr->pet_t_m_idx].fy;
x = floor_ptr->m_list[player_ptr->pet_t_m_idx].fx;
} else {
static bool decide_pet_movement_direction(MonsterSweepGrid *msd)
{
auto *m_ptr = &msd->player_ptr->current_floor_ptr->m_list[msd->m_idx];
- if (!is_pet(m_ptr)) {
+ if (!m_ptr->is_pet()) {
return false;
}
feature_type *f_ptr;
f_ptr = &f_info[g_ptr->feat];
turn_flags_ptr->do_move = false;
- if ((r_ptr->behavior_flags.has_not(MonsterBehaviorType::OPEN_DOOR)) || f_ptr->flags.has_not(FloorFeatureType::OPEN) || (is_pet(m_ptr) && ((player_ptr->pet_extra_flags & PF_OPEN_DOORS) == 0))) {
+ if ((r_ptr->behavior_flags.has_not(MonsterBehaviorType::OPEN_DOOR)) || f_ptr->flags.has_not(FloorFeatureType::OPEN) || (m_ptr->is_pet() && ((player_ptr->pet_extra_flags & PF_OPEN_DOORS) == 0))) {
return true;
}
static void bash_glass_door(PlayerType *player_ptr, turn_flags *turn_flags_ptr, monster_type *m_ptr, feature_type *f_ptr, bool may_bash)
{
auto *r_ptr = &r_info[m_ptr->r_idx];
- if (!may_bash || (r_ptr->behavior_flags.has_not(MonsterBehaviorType::BASH_DOOR)) || f_ptr->flags.has_not(FloorFeatureType::BASH) || (is_pet(m_ptr) && ((player_ptr->pet_extra_flags & PF_OPEN_DOORS) == 0))) {
+ if (!may_bash || (r_ptr->behavior_flags.has_not(MonsterBehaviorType::BASH_DOOR)) || f_ptr->flags.has_not(FloorFeatureType::BASH) || (m_ptr->is_pet() && ((player_ptr->pet_extra_flags & PF_OPEN_DOORS) == 0))) {
return;
}
}
turn_flags_ptr->do_move = false;
- if (is_pet(m_ptr) || (randint1(BREAK_RUNE_PROTECTION) >= r_ptr->level)) {
+ if (m_ptr->is_pet() || (randint1(BREAK_RUNE_PROTECTION) >= r_ptr->level)) {
return true;
}
}
turn_flags_ptr->do_move = false;
- if (is_pet(m_ptr)) {
+ if (m_ptr->is_pet()) {
return true;
}
bool is_pickup_items = (player_ptr->pet_extra_flags & PF_PICKUP_ITEMS) != 0;
is_pickup_items &= r_ptr->behavior_flags.has(MonsterBehaviorType::TAKE_ITEM);
- is_takable_or_killable &= !is_pet(m_ptr) || is_pickup_items;
+ is_takable_or_killable &= !m_ptr->is_pet() || is_pickup_items;
if (!is_takable_or_killable) {
if (turn_flags_ptr->do_turn) {
break;
}
constexpr auto monspeak_txt(_("monspeak_j.txt", "monspeak.txt"));
- if (is_pet(m_ptr) && can_speak(ap_r_ref, MonsterSpeakType::SPEAK_BATTLE)) {
+ if (m_ptr->is_pet() && can_speak(ap_r_ref, MonsterSpeakType::SPEAK_BATTLE)) {
return monspeak_txt;
}
return;
}
- if (is_pet(m_ptr)) {
+ if (m_ptr->is_pet()) {
return;
}
{
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
auto *r_ptr = &r_info[m_ptr->r_idx];
- bool can_runaway = is_pet(m_ptr) || m_ptr->is_friendly();
+ bool can_runaway = m_ptr->is_pet() || m_ptr->is_friendly();
can_runaway &= (r_ptr->kind_flags.has(MonsterKindType::UNIQUE)) || (r_ptr->population_flags.has(MonsterPopulationType::NAZGUL));
can_runaway &= !player_ptr->phase_out;
if (!can_runaway) {
notice = true;
} else {
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[who];
- if (is_pet(m_ptr)) {
+ if (m_ptr->is_pet()) {
notice = true;
} else if (is_seen(player_ptr, m_ptr)) {
notice = true;
{
auto *m_ptr = &this->player_ptr->current_floor_ptr->m_list[this->m_idx];
auto *r_ptr = &r_info[m_ptr->r_idx];
- if (is_pet(m_ptr)) {
+ if (m_ptr->is_pet()) {
return (this->player_ptr->pet_follow_distance < 0) && (m_ptr->cdis <= (0 - this->player_ptr->pet_follow_distance));
}
{
auto *floor_ptr = this->player_ptr->current_floor_ptr;
auto *m_ptr = &floor_ptr->m_list[this->m_idx];
- if (is_pet(m_ptr) && this->will_run) {
+ if (m_ptr->is_pet() && this->will_run) {
*y = -(*y);
*x = -(*x);
return;
m_ptr->nickname = 0;
m_ptr->exp = 0;
- if (who > 0 && is_pet(&floor_ptr->m_list[who])) {
+ if (who > 0 && floor_ptr->m_list[who].is_pet()) {
set_bits(mode, PM_FORCE_PET);
m_ptr->parent_m_idx = who;
} else {
monster_death(player_ptr, m_idx, false, AttributeType::NONE);
delete_monster_idx(player_ptr, m_idx);
- if (is_pet(m_ptr) && !(m_ptr->ml)) {
+ if (m_ptr->is_pet() && !(m_ptr->ml)) {
msg_print(_("少しの間悲しい気分になった。", "You feel sad for a moment."));
}
}
*/
static BIT_FLAGS dead_mode(monster_death_type *md_ptr)
{
- bool pet = is_pet(md_ptr->m_ptr);
+ bool pet = md_ptr->m_ptr->is_pet();
bool clone = md_ptr->m_ptr->mflag2.has(MonsterConstantFlagType::CLONED);
BIT_FLAGS mode = pet ? PM_FORCE_PET : PM_NONE;
if (clone) {
POSITION wy = md_ptr->md_y;
POSITION wx = md_ptr->md_x;
int attempts = 100;
- bool pet = is_pet(md_ptr->m_ptr);
+ bool pet = md_ptr->m_ptr->is_pet();
do {
scatter(player_ptr, &wy, &wx, md_ptr->md_y, md_ptr->md_x, radius, PROJECT_NONE);
} while (!(in_bounds(floor_ptr, wy, wx) && is_cave_empty_bold2(player_ptr, wy, wx)) && --attempts);
for (int i = 0; i < blue_horrors; i++) {
POSITION wy = md_ptr->md_y;
POSITION wx = md_ptr->md_x;
- bool pet = is_pet(md_ptr->m_ptr);
+ bool pet = md_ptr->m_ptr->is_pet();
BIT_FLAGS mode = dead_mode(md_ptr);
if (summon_specific(player_ptr, (pet ? -1 : md_ptr->m_idx), wy, wx, 100, SUMMON_BLUE_HORROR, mode) && player_can_see_bold(player_ptr, wy, wx)) {
notice = true;
for (int i = 0; i < popped_bubbles; i++) {
POSITION wy = md_ptr->md_y;
POSITION wx = md_ptr->md_x;
- bool pet = is_pet(md_ptr->m_ptr);
+ bool pet = md_ptr->m_ptr->is_pet();
BIT_FLAGS mode = dead_mode(md_ptr);
auto smaller_bubble = md_ptr->m_ptr->r_idx - 1;
if (summon_named_creature(player_ptr, (pet ? -1 : md_ptr->m_idx), wy, wx, smaller_bubble, mode) && player_can_see_bold(player_ptr, wy, wx)) {
for (int i = 0; i < reproduced_centipede; i++) {
POSITION wy = md_ptr->md_y;
POSITION wx = md_ptr->md_x;
- bool pet = is_pet(md_ptr->m_ptr);
+ bool pet = md_ptr->m_ptr->is_pet();
BIT_FLAGS mode = dead_mode(md_ptr);
auto smaller_centipede = md_ptr->m_ptr->r_idx - 1;
for (auto i = 0; i < num_summons; i++) {
auto wy = md_ptr->md_y;
auto wx = md_ptr->md_x;
- auto pet = is_pet(md_ptr->m_ptr);
+ auto pet = md_ptr->m_ptr->is_pet();
BIT_FLAGS mode = dead_mode(md_ptr);
if (summon_named_creature(player_ptr, (pet ? -1 : md_ptr->m_idx), wy, wx, mimic_inside, (BIT_FLAGS)mode) && player_can_see_bold(player_ptr, wy, wx)) {
notice = true;
health_track(player_ptr, i2);
}
- if (is_pet(m_ptr)) {
+ if (m_ptr->is_pet()) {
for (int i = 1; i < floor_ptr->m_max; i++) {
monster_type *m2_ptr = &floor_ptr->m_list[i];
continue;
}
- if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname) {
+ if (record_named_pet && m_ptr->is_pet() && m_ptr->nickname) {
GAME_TEXT m_name[MAX_NLEN];
monster_desc(player_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
exe_write_diary(player_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_COMPACT, m_name);
void MonsterDamageProcessor::get_exp_from_mon(monster_type *m_ptr, int exp_dam)
{
auto *r_ptr = &r_info[m_ptr->r_idx];
- if (!monster_is_valid(m_ptr) || is_pet(m_ptr) || this->player_ptr->phase_out) {
+ if (!monster_is_valid(m_ptr) || m_ptr->is_pet() || this->player_ptr->phase_out) {
return;
}
auto dummy_y = m_ptr->fy;
auto dummy_x = m_ptr->fx;
auto mode = (BIT_FLAGS)0;
- if (is_pet(m_ptr)) {
+ if (m_ptr->is_pet()) {
mode |= PM_FORCE_PET;
}
/* Handle all other visible monster requests */
/* Tanuki? */
- if (is_pet(m_ptr) && !is_original_ap(m_ptr)) {
+ if (m_ptr->is_pet() && !is_original_ap(m_ptr)) {
#ifdef JP
char *t;
char buf[128];
#endif
(void)strcat(desc, name);
} else {
- if (is_pet(m_ptr)) {
+ if (m_ptr->is_pet()) {
(void)strcpy(desc, _("あなたの", "your "));
} else {
(void)strcpy(desc, _("", "the "));
*/
bool are_enemies(PlayerType *player_ptr, monster_type *m_ptr, monster_type *n_ptr)
{
- auto *r_ptr = &r_info[m_ptr->r_idx];
- monster_race *s_ptr = &r_info[n_ptr->r_idx];
-
if (player_ptr->phase_out) {
- if (is_pet(m_ptr) || is_pet(n_ptr)) {
+ if (m_ptr->is_pet() || n_ptr->is_pet()) {
return false;
}
return true;
}
- if (r_ptr->wilderness_flags.has_any_of({ MonsterWildernessType::WILD_TOWN, MonsterWildernessType::WILD_ALL }) && s_ptr->wilderness_flags.has_any_of({ MonsterWildernessType::WILD_TOWN, MonsterWildernessType::WILD_ALL })) {
- if (!is_pet(m_ptr) && !is_pet(n_ptr)) {
+ const auto &r1_ref = r_info[m_ptr->r_idx];
+ const auto &r2_ref = r_info[n_ptr->r_idx];
+ const auto is_m1_wild = r1_ref.wilderness_flags.has_any_of({ MonsterWildernessType::WILD_TOWN, MonsterWildernessType::WILD_ALL });
+ const auto is_m2_wild = r2_ref.wilderness_flags.has_any_of({ MonsterWildernessType::WILD_TOWN, MonsterWildernessType::WILD_ALL });
+ if (is_m1_wild && is_m2_wild) {
+ if (!m_ptr->is_pet() && !n_ptr->is_pet()) {
return false;
}
}
return m_ptr->ap_r_idx == m_ptr->r_idx;
}
-bool is_pet(const monster_type *m_ptr)
-{
- return m_ptr->mflag2.has(MonsterConstantFlagType::PET);
-}
-
bool is_hostile(const monster_type *m_ptr)
{
- return !m_ptr->is_friendly() && !is_pet(m_ptr);
+ return !m_ptr->is_friendly() && !m_ptr->is_pet();
}
/*!
bool monster_has_hostile_align(PlayerType *player_ptr, monster_type *m_ptr, int pa_good, int pa_evil, monster_race *r_ptr);
bool is_original_ap_and_seen(PlayerType *player_ptr, monster_type *m_ptr);
-bool is_pet(const monster_type *m_ptr);
bool is_hostile(const monster_type *m_ptr);
bool is_original_ap(const monster_type *m_ptr);
bool is_mimicry(monster_type *m_ptr);
msg_format(_("%sは消え去った!", "%^s disappears!"), m_name);
}
- if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname) {
+ if (record_named_pet && m_ptr->is_pet() && m_ptr->nickname) {
GAME_TEXT m_name[MAX_NLEN];
monster_desc(player_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
exe_write_diary(player_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_LOSE_PARENT, m_name);
gets_angry = true;
}
- if (is_pet(m_ptr) && (((r_ptr->kind_flags.has(MonsterKindType::UNIQUE) || (r_ptr->population_flags.has(MonsterPopulationType::NAZGUL))) && monster_has_hostile_align(player_ptr, nullptr, 10, -10, r_ptr)) || r_ptr->resistance_flags.has(MonsterResistanceType::RESIST_ALL))) {
+ if (m_ptr->is_pet() && (((r_ptr->kind_flags.has(MonsterKindType::UNIQUE) || (r_ptr->population_flags.has(MonsterPopulationType::NAZGUL))) && monster_has_hostile_align(player_ptr, nullptr, 10, -10, r_ptr)) || r_ptr->resistance_flags.has(MonsterResistanceType::RESIST_ALL))) {
gets_angry = true;
}
}
GAME_TEXT m_name[MAX_NLEN];
- monster_desc(player_ptr, m_name, m_ptr, is_pet(m_ptr) ? MD_ASSUME_VISIBLE : 0);
+ monster_desc(player_ptr, m_name, m_ptr, m_ptr->is_pet() ? MD_ASSUME_VISIBLE : 0);
/* When riding a hostile alignment pet */
if (player_ptr->riding == m_idx) {
msg_format(_("あなたは振り落とされた。", "You have fallen."));
}
- if (is_pet(m_ptr) || see_m) {
+ if (m_ptr->is_pet() || see_m) {
msg_format(_("%^sは突然敵にまわった!", "%^s suddenly becomes hostile!"), m_name);
}
int count = 0;
DEPTH rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
- BIT_FLAGS p_mode = is_pet(m_ptr) ? PM_FORCE_PET : PM_NONE;
+ BIT_FLAGS p_mode = m_ptr->is_pet() ? PM_FORCE_PET : PM_NONE;
for (int k = 0; k < A_MAX; k++) {
if (summon_specific(player_ptr, m_idx, m_ptr->fy, m_ptr->fx, rlev, SUMMON_MOLD, (PM_ALLOW_GROUP | p_mode))) {
}
if ((k < 4) && (!k || !randint0(k * MON_MULT_ADJ))) {
- if (multiply_monster(player_ptr, m_idx, false, (is_pet(m_ptr) ? PM_FORCE_PET : 0))) {
+ if (multiply_monster(player_ptr, m_idx, false, (m_ptr->is_pet() ? PM_FORCE_PET : 0))) {
if (player_ptr->current_floor_ptr->m_list[hack_m_idx_ii].ml && is_original_ap_and_seen(player_ptr, m_ptr)) {
r_ptr->r_flags2 |= RF2_MULTIPLY;
}
m_ptr->mflag2.reset(MonsterConstantFlagType::NOFLOW);
}
- if (m_ptr->cdis <= (is_pet(m_ptr) ? (r_ptr->aaf > MAX_SIGHT ? MAX_SIGHT : r_ptr->aaf) : r_ptr->aaf)) {
+ if (m_ptr->cdis <= (m_ptr->is_pet() ? (r_ptr->aaf > MAX_SIGHT ? MAX_SIGHT : r_ptr->aaf) : r_ptr->aaf)) {
return true;
}
auto is_wakeup = false;
if (m_ptr->cdis < AAF_LIMIT) {
/* Handle "sensing radius" */
- if (m_ptr->cdis <= (is_pet(m_ptr) ? ((r_ptr->aaf > MAX_SIGHT) ? MAX_SIGHT : r_ptr->aaf) : r_ptr->aaf)) {
+ if (m_ptr->cdis <= (m_ptr->is_pet() ? ((r_ptr->aaf > MAX_SIGHT) ? MAX_SIGHT : r_ptr->aaf) : r_ptr->aaf)) {
is_wakeup = true;
}
m_ptr->mspeed = get_mspeed(floor_ptr, r_ptr);
/* Sub-alignment of a monster */
- if (!is_pet(m_ptr) && r_ptr->kind_flags.has_none_of(alignment_mask)) {
+ if (!m_ptr->is_pet() && r_ptr->kind_flags.has_none_of(alignment_mask)) {
m_ptr->sub_align = old_sub_align;
} else {
m_ptr->sub_align = SUB_ALIGN_NEUTRAL;
}
m_ptr->exp = 0;
- if (is_pet(m_ptr) || m_ptr->ml) {
+ if (m_ptr->is_pet() || m_ptr->ml) {
auto is_hallucinated = player_ptr->effects()->hallucination()->is_hallucinated();
if (!ignore_unview || player_can_see_bold(player_ptr, m_ptr->fy, m_ptr->fx)) {
if (is_hallucinated) {
for (const auto &[y, x] : grid_g) {
if ((floor_ptr->grid_array[y][x].m_idx > 0) && (y != y2 || x != x2)) {
auto *m_ptr = &floor_ptr->m_list[floor_ptr->grid_array[y][x].m_idx];
- if (is_friend == is_pet(m_ptr)) {
+ if (is_friend == m_ptr->is_pet()) {
return false;
}
}
}
bool hit2 = false;
- bool is_friend = is_pet(m_ptr);
+ bool is_friend = m_ptr->is_pet();
for (const auto &[y, x] : grid_g) {
if (y == y2 && x == x2) {
hit2 = true;
{
BIT_FLAGS u_mode = 0L;
auto *m_ptr = &floor_ptr->m_list[m_idx];
- bool pet = is_pet(m_ptr);
+ bool pet = m_ptr->is_pet();
if (!pet) {
u_mode |= PM_ALLOW_UNIQUE;
}
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
msg_print(_("何かが邪魔しています!", "There's something in the way!"));
- if (!m_ptr->ml || !is_pet(m_ptr)) {
+ if (!m_ptr->ml || !m_ptr->is_pet()) {
do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
}
} else if (f_ptr->flags.has(FloorFeatureType::TREE)) {
}
auto *r_ptr = &r_info[m_ptr->r_idx];
- if (!is_pet(m_ptr)) {
+ if (!m_ptr->is_pet()) {
continue;
}
}
auto *r_ptr = &r_info[m_ptr->r_idx];
- if (!is_pet(m_ptr)) {
+ if (!m_ptr->is_pet()) {
continue;
}
return;
}
- if (is_pet(m_ptr)) {
+ if (m_ptr->is_pet()) {
return;
}
}
if (gg_ptr->m_idx) {
- if (record_named_pet && is_pet(&floor_ptr->m_list[gg_ptr->m_idx]) && floor_ptr->m_list[gg_ptr->m_idx].nickname) {
+ const auto &m_ref = floor_ptr->m_list[gg_ptr->m_idx];
+ if (record_named_pet && m_ref.is_pet() && m_ref.nickname) {
char m2_name[MAX_NLEN];
monster_desc(player_ptr, m2_name, m_ptr, MD_INDEF_VISIBLE);
continue;
}
} else {
- if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname) {
+ if (record_named_pet && m_ptr->is_pet() && m_ptr->nickname) {
GAME_TEXT m_name[MAX_NLEN];
monster_desc(player_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
{
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
auto *r_ptr = &r_info[m_ptr->r_idx];
- if (is_pet(m_ptr) && !player_cast) {
+ if (m_ptr->is_pet() && !player_cast) {
return false;
}
} else if (player_cast && m_ptr->mflag2.has(MonsterConstantFlagType::NOGENO)) {
resist = true;
} else {
- if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname) {
+ if (record_named_pet && m_ptr->is_pet() && m_ptr->nickname) {
GAME_TEXT m_name[MAX_NLEN];
monster_desc(player_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
exe_write_diary(player_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
}
}
- if (m_ptr->is_friendly() && !is_pet(m_ptr)) {
+ if (m_ptr->is_friendly() && !m_ptr->is_pet()) {
if (see_m) {
msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
}
bool okay = true;
for (MONSTER_IDX i = 1; i < player_ptr->current_floor_ptr->m_max; i++) {
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
- if (!MonsterRace(m_ptr->r_idx).is_valid() || !is_pet(m_ptr)) {
+ if (!MonsterRace(m_ptr->r_idx).is_valid() || !m_ptr->is_pet()) {
continue;
}
if (m_ptr->nickname) {
for (MONSTER_IDX i = 1; i < player_ptr->current_floor_ptr->m_max; i++) {
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
- if (!MonsterRace(m_ptr->r_idx).is_valid() || !is_pet(m_ptr)) {
+ if (!MonsterRace(m_ptr->r_idx).is_valid() || !m_ptr->is_pet()) {
continue;
}
if (m_ptr->is_friendly()) {
mode |= PM_FORCE_FRIENDLY;
}
- if (is_pet(m_ptr)) {
+ if (m_ptr->is_pet()) {
mode |= PM_FORCE_PET;
}
if (m_ptr->mflag2.has(MonsterConstantFlagType::NOPET)) {
sleep = true;
}
- if (!is_pet(m_ptr)) {
+ if (!m_ptr->is_pet()) {
m_ptr->mflag2.set(MonsterConstantFlagType::NOPET);
}
}
if (player_has_los_bold(player_ptr, m_ptr->fy, m_ptr->fx)) {
- if (!is_pet(m_ptr)) {
+ if (!m_ptr->is_pet()) {
(void)set_monster_fast(player_ptr, i, monster_fast_remaining(m_ptr) + 100);
speed = true;
}
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
QuestCompletionChecker(player_ptr, m_ptr).complete();
- if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname) {
+ if (record_named_pet && m_ptr->is_pet() && m_ptr->nickname) {
char m2_name[MAX_NLEN];
monster_desc(player_ptr, m2_name, m_ptr, MD_INDEF_VISIBLE);
auto *floor_ptr = player_ptr->current_floor_ptr;
if (who > 0) {
auto *m_ptr = &floor_ptr->m_list[who];
- if (is_pet(m_ptr)) {
+ if (m_ptr->is_pet()) {
mode |= PM_FORCE_PET;
}
}
{
return this->mflag2.has(MonsterConstantFlagType::FRIENDLY);
}
+
+bool monster_type::is_pet() const
+{
+ return this->mflag2.has(MonsterConstantFlagType::PET);
+}
MONSTER_IDX parent_m_idx{}; /*!< 召喚主のモンスターID */
bool is_friendly() const;
+ bool is_pet() const;
};
for (POSITION y = min_hgt; y <= max_hgt; y++) {
for (POSITION x = min_wid; x <= max_wid; x++) {
- grid_type *g_ptr;
if (!target_set_accept(player_ptr, y, x)) {
continue;
}
- g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
- if ((mode & (TARGET_KILL)) && !target_able(player_ptr, g_ptr->m_idx)) {
+ const auto &g_ref = player_ptr->current_floor_ptr->grid_array[y][x];
+ if ((mode & (TARGET_KILL)) && !target_able(player_ptr, g_ref.m_idx)) {
continue;
}
- if ((mode & (TARGET_KILL)) && !target_pet && is_pet(&player_ptr->current_floor_ptr->m_list[g_ptr->m_idx])) {
+ const auto &m_ref = player_ptr->current_floor_ptr->m_list[g_ref.m_idx];
+ if ((mode & (TARGET_KILL)) && !target_pet && m_ref.is_pet()) {
continue;
}
for (MONSTER_IDX i = 1; i < player_ptr->current_floor_ptr->m_max; i++) {
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
- if (!monster_is_valid(m_ptr) || !m_ptr->ml || is_pet(m_ptr)) {
+ if (!monster_is_valid(m_ptr) || !m_ptr->ml || m_ptr->is_pet()) {
continue;
}
concptr attitude;
if (!(mode & 0x01)) {
attitude = "";
- } else if (is_pet(m_ptr)) {
+ } else if (m_ptr->is_pet()) {
attitude = _(", ペット", ", pet");
} else if (m_ptr->is_friendly()) {
attitude = _(", 友好的", ", friendly");
size_t i;
for (i = 0; i < monster_list.size(); i++) {
auto m_ptr = &floor_ptr->m_list[monster_list[i]];
- if (is_pet(m_ptr)) {
+ if (m_ptr->is_pet()) {
continue;
} // pet
if (!MonsterRace(m_ptr->r_idx).is_valid()) {
continue;
}
- if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname) {
+ if (record_named_pet && m_ptr->is_pet() && m_ptr->nickname) {
GAME_TEXT m_name[MAX_NLEN];
monster_desc(player_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
continue;
}
- if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname) {
+ if (record_named_pet && m_ptr->is_pet() && m_ptr->nickname) {
GAME_TEXT m_name[MAX_NLEN];
monster_desc(player_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
exe_write_diary(player_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name);