#include "monster/monster-info.h"
#include "monster/monster-status-setter.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "mutation/mutation-flag-types.h"
#include "object/warning.h"
#include "player-base/player-class.h"
std::string m_name;
bool can_move = true;
bool do_past = false;
- if (grid.m_idx && (m_ptr->ml || p_can_enter || p_can_kill_walls)) {
+ if (is_monster(grid.m_idx) && (m_ptr->ml || p_can_enter || p_can_kill_walls)) {
auto *r_ptr = &m_ptr->get_monrace();
auto effects = player_ptr->effects();
auto is_stunned = effects->stun()->is_stunned();
#include "monster/monster-description-types.h"
#include "monster/monster-flag-types.h"
#include "monster/monster-info.h"
+#include "monster/monster-util.h"
#include "mutation/mutation-flag-types.h"
#include "mutation/mutation-techniques.h"
#include "object-enchant/item-feeling.h"
const auto y = player_ptr->y + ddy[dir];
const auto x = player_ptr->x + ddx[dir];
const auto &grid = floor.grid_array[y][x];
- if (!grid.m_idx) {
+ if (!is_monster(grid.m_idx)) {
msg_print(_("邪悪な存在を感じとれません!", "You sense no evil there!"));
return true;
}
const auto y = player_ptr->y + ddy[dir];
const auto x = player_ptr->x + ddx[dir];
auto &grid = floor.grid_array[y][x];
- if (!grid.m_idx) {
+ if (!is_monster(grid.m_idx)) {
msg_print(_("あなたは何もない場所で手を振った。", "You wave your hands in the air."));
return true;
}
#include "grid/grid.h"
#include "main/sound-definitions-table.h"
#include "main/sound-of-music.h"
+#include "monster/monster-util.h"
#include "object/object-mark-types.h"
#include "player-status/player-energy.h"
#include "player/player-status-flags.h"
int new_dir = cycle[chome[prev_dir] + i];
const Pos2D pos(player_ptr->y + ddy[new_dir], player_ptr->x + ddx[new_dir]);
const auto &grid = floor.get_grid(pos);
- if (grid.m_idx) {
+ if (is_monster(grid.m_idx)) {
const auto &monster = floor.m_list[grid.m_idx];
if (monster.ml) {
return true;
#include "game-option/special-options.h"
#include "grid/feature.h"
#include "grid/grid.h"
+#include "monster/monster-util.h"
#include "player-status/player-energy.h"
#include "player/player-move.h"
#include "system/floor-type-definition.h"
POSITION row = player_ptr->y + ddy[dir];
POSITION col = player_ptr->x + ddx[dir];
g_ptr = &floor_ptr->grid_array[row][col];
- if (g_ptr->m_idx) {
+ if (is_monster(g_ptr->m_idx)) {
auto *m_ptr = &floor_ptr->m_list[g_ptr->m_idx];
if (m_ptr->ml) {
return 0;
#include "monster/monster-describer.h"
#include "monster/monster-info.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "mspell/mspell-damage-calculator.h"
#include "spell-kind/spells-launcher.h"
#include "spell-kind/spells-lite.h"
const auto &floor = *player_ptr->current_floor_ptr;
const Pos2D pos(target_row, target_col);
const auto &grid = floor.get_grid(pos);
- if ((grid.m_idx == 0) || !grid.has_los() || !projectable(player_ptr, player_ptr->y, player_ptr->x, target_row, target_col)) {
+ if (!is_monster(grid.m_idx) || !grid.has_los() || !projectable(player_ptr, player_ptr->y, player_ptr->x, target_row, target_col)) {
return std::nullopt;
}
#include "monster/monster-info.h"
#include "monster/monster-processor.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "mspell/monster-power-table.h"
#include "player-base/player-class.h"
#include "player-info/mane-data-type.h"
const auto &floor = *player_ptr->current_floor_ptr;
const Pos2D pos(target_row, target_col);
const auto &grid_target = floor.get_grid(pos);
- auto should_teleport = grid_target.m_idx == 0;
+ auto should_teleport = !is_monster(grid_target.m_idx);
should_teleport &= grid_target.has_los();
should_teleport &= projectable(player_ptr, player_ptr->y, player_ptr->x, target_row, target_col);
if (!should_teleport) {
#include "inventory/inventory-object.h"
#include "inventory/inventory-slot-types.h"
#include "io/input-key-requester.h"
+#include "monster/monster-util.h"
#include "object/tval-types.h"
#include "player-base/player-class.h"
#include "player-info/samurai-data-type.h"
const auto o_idx = chest_check(player_ptr->current_floor_ptr, pos, false);
if (grid.get_terrain_mimic().flags.has_not(TerrainCharacteristics::OPEN) && !o_idx) {
msg_print(_("そこには開けるものが見当たらない。", "You see nothing there to open."));
- } else if (grid.m_idx && player_ptr->riding != grid.m_idx) {
+ } else if (is_monster(grid.m_idx) && player_ptr->riding != grid.m_idx) {
PlayerEnergy(player_ptr).set_player_turn_energy(100);
msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
do_cmd_attack(player_ptr, pos.y, pos.x, HISSATSU_NONE);
const auto &grid = player_ptr->current_floor_ptr->get_grid(pos);
if (grid.get_terrain_mimic().flags.has_not(TerrainCharacteristics::CLOSE)) {
msg_print(_("そこには閉じるものが見当たらない。", "You see nothing there to close."));
- } else if (grid.m_idx) {
+ } else if (is_monster(grid.m_idx)) {
PlayerEnergy(player_ptr).set_player_turn_energy(100);
msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
do_cmd_attack(player_ptr, pos.y, pos.x, HISSATSU_NONE);
const auto o_idx = chest_check(player_ptr->current_floor_ptr, pos, true);
if (!is_trap(player_ptr, feat) && !o_idx) {
msg_print(_("そこには解除するものが見当たらない。", "You see nothing there to disarm."));
- } else if (grid.m_idx && player_ptr->riding != grid.m_idx) {
+ } else if (is_monster(grid.m_idx) && player_ptr->riding != grid.m_idx) {
msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
do_cmd_attack(player_ptr, pos.y, pos.x, HISSATSU_NONE);
} else if (o_idx) {
const Grid &grid = player_ptr->current_floor_ptr->get_grid(pos);
if (grid.get_terrain_mimic().flags.has_not(TerrainCharacteristics::BASH)) {
msg_print(_("そこには体当たりするものが見当たらない。", "You see nothing there to bash."));
- } else if (grid.m_idx) {
+ } else if (is_monster(grid.m_idx)) {
PlayerEnergy(player_ptr).set_player_turn_energy(100);
msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
do_cmd_attack(player_ptr, pos.y, pos.x, HISSATSU_NONE);
msg_print(_("そこにはくさびを打てるものが見当たらない。", "You see nothing there to spike."));
} else if (!get_spike(player_ptr, &i_idx)) {
msg_print(_("くさびを持っていない!", "You have no spikes!"));
- } else if (grid.m_idx) {
+ } else if (is_monster(grid.m_idx)) {
PlayerEnergy(player_ptr).set_player_turn_energy(100);
msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
do_cmd_attack(player_ptr, pos.y, pos.x, HISSATSU_NONE);
#include "io/write-diary.h"
#include "main/music-definitions-table.h"
#include "main/sound-of-music.h"
+#include "monster/monster-util.h"
#include "player-base/player-class.h"
#include "player-info/samurai-data-type.h"
#include "player-status/player-energy.h"
const auto &grid = player_ptr->current_floor_ptr->get_grid(pos);
const auto &terrain = grid.get_terrain_mimic();
PlayerEnergy(player_ptr).set_player_turn_energy(100);
- if (grid.m_idx) {
+ if (is_monster(grid.m_idx)) {
do_cmd_attack(player_ptr, pos.y, pos.x, HISSATSU_NONE);
return false;
}
#include "monster/monster-info.h"
#include "monster/monster-status-setter.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "monster/smart-learn-types.h"
#include "object-hook/hook-weapon.h"
#include "pet/pet-util.h"
return false;
}
- if (grid.m_idx) {
+ if (is_monster(grid.m_idx)) {
PlayerEnergy(player_ptr).set_player_turn_energy(100);
msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
const auto *m_ptr = &player_ptr->current_floor_ptr->m_list[grid.m_idx];
- if (!grid.m_idx || !m_ptr->ml) {
+ if (!is_monster(grid.m_idx) || !m_ptr->ml) {
msg_print(_("その場所にはモンスターはいません。", "There is no monster here."));
return false;
}
target_pet = old_target_pet;
auto &floor = *player_ptr->current_floor_ptr;
const auto &grid = floor.grid_array[target_row][target_col];
- if (grid.m_idx == 0) {
+ if (!is_monster(grid.m_idx)) {
return;
}
player_ptr->pet_t_m_idx = 0;
} else {
auto *g_ptr = &player_ptr->current_floor_ptr->grid_array[target_row][target_col];
- if (g_ptr->m_idx && (player_ptr->current_floor_ptr->m_list[g_ptr->m_idx].ml)) {
+ if (is_monster(g_ptr->m_idx) && (player_ptr->current_floor_ptr->m_list[g_ptr->m_idx].ml)) {
player_ptr->pet_t_m_idx = player_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
player_ptr->pet_follow_distance = PET_DESTROY_DIST;
} else {
#include "floor/geometry.h"
#include "grid/grid.h"
#include "io/input-key-requester.h"
+#include "monster/monster-util.h"
#include "player-base/player-class.h"
#include "player-info/samurai-data-type.h"
#include "player-status/player-energy.h"
msg_print(_("ドアは掘れない。", "You cannot tunnel through doors."));
} else if (terrain_mimic.flags.has_not(TerrainCharacteristics::TUNNEL)) {
msg_print(_("そこは掘れない。", "You can't tunnel through that."));
- } else if (grid.m_idx) {
+ } else if (is_monster(grid.m_idx)) {
PlayerEnergy(player_ptr).set_player_turn_energy(100);
msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
do_cmd_attack(player_ptr, pos.y, pos.x, HISSATSU_NONE);
#include "monster/monster-status-setter.h"
#include "monster/monster-status.h"
#include "monster/monster-update.h"
+#include "monster/monster-util.h"
#include "object/object-broken.h"
#include "object/object-info.h"
#include "object/object-mark-types.h"
if (snipe_type == SP_KILL_WALL) {
g_ptr = &floor_ptr->grid_array[ny][nx];
- if (g_ptr->cave_has_flag(TerrainCharacteristics::HURT_ROCK) && !g_ptr->m_idx) {
+ if (g_ptr->cave_has_flag(TerrainCharacteristics::HURT_ROCK) && !is_monster(g_ptr->m_idx)) {
if (any_bits(g_ptr->info, (CAVE_MARK))) {
msg_print(_("岩が砕け散った。", "Wall rocks were shattered."));
}
}
/* Stopped by walls/doors */
- if (!cave_has_flag_bold(floor_ptr, ny, nx, TerrainCharacteristics::PROJECT) && !floor_ptr->grid_array[ny][nx].m_idx) {
+ if (!cave_has_flag_bold(floor_ptr, ny, nx, TerrainCharacteristics::PROJECT) && !is_monster(floor_ptr->grid_array[ny][nx].m_idx)) {
break;
}
y = ny;
/* Monster here, Try to hit it */
- if (floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(floor_ptr->grid_array[y][x].m_idx)) {
sound(SOUND_SHOOT_HIT);
Grid *c_mon_ptr = &floor_ptr->grid_array[y][x];
#include "mind/mind-elementalist.h"
#include "mind/mind-ninja.h"
#include "monster/monster-update.h"
+#include "monster/monster-util.h"
#include "player/special-defense-types.h"
#include "room/door-definition.h"
#include "spell-class/spells-mirror-master.h"
auto obvious = false;
auto known = grid.has_los();
- src_idx = src_idx ? src_idx : 0;
+ src_idx = is_monster(src_idx) ? src_idx : 0;
dam = (dam + r) / (r + 1);
if (terrain.flags.has(TerrainCharacteristics::TREE)) {
if (player_can_see_bold(player_ptr, y, x)) {
obvious = true;
}
- if (grid.m_idx) {
+ if (is_monster(grid.m_idx)) {
update_monster(player_ptr, grid.m_idx, false);
}
if (player_can_see_bold(player_ptr, y, x)) {
obvious = true;
}
- if (grid.m_idx) {
+ if (is_monster(grid.m_idx)) {
update_monster(player_ptr, grid.m_idx, false);
}
#include "monster-floor/monster-summon.h"
#include "monster-floor/place-monster-types.h"
#include "monster/monster-info.h"
+#include "monster/monster-util.h"
#include "object-enchant/tr-types.h"
#include "object-hook/hook-expendable.h"
#include "object/object-broken.h"
auto is_item_affected = false;
const auto known = grid.has_los();
- src_idx = src_idx ? src_idx : 0;
+ src_idx = is_monster(src_idx) ? src_idx : 0;
dam = (dam + r) / (r + 1);
std::set<OBJECT_IDX> processed_list;
for (auto it = grid.o_idx_list.begin(); it != grid.o_idx_list.end();) {
}
BIT_FLAGS mode = 0L;
- if (!src_idx || player_ptr->current_floor_ptr->m_list[src_idx].is_pet()) {
+ if (is_monster(src_idx) || player_ptr->current_floor_ptr->m_list[src_idx].is_pet()) {
mode |= PM_FORCE_PET;
}
#include "effect/effect-monster-util.h"
#include "monster-race/monster-race.h"
#include "monster-race/race-indice-types.h"
+#include "monster/monster-util.h"
#include "system/monster-entity.h"
#include "system/monster-race-info.h"
#include "view/display-messages.h"
if (em_ptr->seen) {
em_ptr->obvious = true;
}
- if (!em_ptr->src_idx) {
+ if (is_player(em_ptr->src_idx)) {
msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), em_ptr->m_name);
}
if (randint0(100 + (em_ptr->caster_lev / 2)) < (em_ptr->r_ptr->level + 35)) {
if (em_ptr->seen) {
em_ptr->obvious = true;
}
- if (!em_ptr->src_idx) {
+ if (is_player(em_ptr->src_idx)) {
msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), em_ptr->m_name);
}
if (em_ptr->seen) {
em_ptr->obvious = true;
}
- if (!em_ptr->src_idx) {
+ if (is_player(em_ptr->src_idx)) {
msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), em_ptr->m_name);
}
if (em_ptr->seen) {
em_ptr->obvious = true;
}
- if (!em_ptr->src_idx) {
+ if (is_player(em_ptr->src_idx)) {
msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
"You point at %s, screaming the word, 'DIE!'."),
em_ptr->m_name);
}
- if ((randint0(100 + (em_ptr->caster_lev / 2)) < (em_ptr->r_ptr->level + 35)) && ((em_ptr->src_idx <= 0) || (em_ptr->m_caster_ptr->r_idx != MonsterRaceId::KENSHIROU))) {
+ if ((randint0(100 + (em_ptr->caster_lev / 2)) < (em_ptr->r_ptr->level + 35)) && (!is_monster(em_ptr->src_idx) || (em_ptr->m_caster_ptr->r_idx != MonsterRaceId::KENSHIROU))) {
em_ptr->note = _("には効果がなかった。", " is unaffected.");
em_ptr->dam = 0;
}
#include "monster/monster-info.h"
#include "monster/monster-status-setter.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "system/floor-type-definition.h"
#include "system/grid-type-definition.h"
#include "system/monster-entity.h"
// who == 0ならばプレイヤーなので、それの判定.
static void effect_monster_old_heal_check_player(PlayerType *player_ptr, EffectMonster *em_ptr)
{
- if (em_ptr->src_idx != 0) {
+ if (is_monster(em_ptr->src_idx)) {
return;
}
effect_monster_old_heal_check_player(player_ptr, em_ptr);
if (em_ptr->m_ptr->r_idx == MonsterRaceId::LEPER) {
em_ptr->heal_leper = true;
- if (!em_ptr->src_idx) {
+ if (is_player(em_ptr->src_idx)) {
chg_virtue(player_ptr, Virtue::COMPASSION, 5);
}
}
em_ptr->note = _("の動きが速くなった。", " starts moving faster.");
}
- if (!em_ptr->src_idx) {
+ if (is_player(em_ptr->src_idx)) {
if (em_ptr->r_ptr->kind_flags.has(MonsterKindType::UNIQUE)) {
chg_virtue(player_ptr, Virtue::INDIVIDUALISM, 1);
}
#include "monster/monster-info.h"
#include "monster/monster-status-setter.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "system/grid-type-definition.h"
#include "system/monster-entity.h"
#include "system/monster-race-info.h"
return ProcessResult::PROCESS_CONTINUE;
}
- if (em_ptr->src_idx <= 0) {
+ if (!is_monster(em_ptr->src_idx)) {
msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), em_ptr->m_name);
(void)hp_player(player_ptr, em_ptr->dam);
em_ptr->dam = 0;
if (em_ptr->seen) {
em_ptr->obvious = true;
}
- if (!em_ptr->src_idx) {
+ if (is_player(em_ptr->src_idx)) {
msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), em_ptr->m_name);
}
em_ptr->note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
em_ptr->note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
- if (em_ptr->src_idx > 0) {
+ if (is_monster(em_ptr->src_idx)) {
em_ptr->do_conf = randint0(4) + 4;
} else {
em_ptr->do_conf = randint0(8) + 8;
if (em_ptr->seen) {
em_ptr->obvious = true;
}
- if (!em_ptr->src_idx) {
+ if (is_player(em_ptr->src_idx)) {
msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), em_ptr->m_name);
}
} else {
em_ptr->note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
em_ptr->note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
- if (em_ptr->src_idx > 0) {
+ if (is_monster(em_ptr->src_idx)) {
em_ptr->do_conf = randint0(4) + 4;
em_ptr->do_stun = randint0(4) + 4;
} else {
#include "monster/monster-info.h"
#include "monster/monster-status-setter.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "player/player-damage.h"
#include "spell-kind/spells-genocide.h"
#include "system/grid-type-definition.h"
return ProcessResult::PROCESS_CONTINUE;
}
- if ((em_ptr->src_idx > 0) ? ((em_ptr->caster_lev + randint1(em_ptr->dam)) > (em_ptr->r_ptr->level + 10 + randint1(20)))
- : (((em_ptr->caster_lev / 2) + randint1(em_ptr->dam)) > (em_ptr->r_ptr->level + randint1(200)))) {
+ if (is_monster(em_ptr->src_idx) ? ((em_ptr->caster_lev + randint1(em_ptr->dam)) > (em_ptr->r_ptr->level + 10 + randint1(20)))
+ : (((em_ptr->caster_lev / 2) + randint1(em_ptr->dam)) > (em_ptr->r_ptr->level + randint1(200)))) {
em_ptr->dam = ((40 + randint1(20)) * em_ptr->m_ptr->hp) / 100;
if (em_ptr->m_ptr->hp < em_ptr->dam) {
em_ptr->dam = em_ptr->m_ptr->hp - 1;
}
std::string_view spell_name(_("モンスター消滅", "Genocide One"));
- if (genocide_aux(player_ptr, em_ptr->g_ptr->m_idx, em_ptr->dam, !em_ptr->src_idx, (em_ptr->r_ptr->level + 1) / 2, spell_name.data())) {
+ if (genocide_aux(player_ptr, em_ptr->g_ptr->m_idx, em_ptr->dam, is_player(em_ptr->src_idx), (em_ptr->r_ptr->level + 1) / 2, spell_name.data())) {
if (em_ptr->seen_msg) {
msg_format(_("%sは消滅した!", "%s^ disappeared!"), em_ptr->m_name);
}
ProcessResult effect_monster_photo(PlayerType *player_ptr, EffectMonster *em_ptr)
{
- if (!em_ptr->src_idx) {
+ if (is_player(em_ptr->src_idx)) {
msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), em_ptr->m_name);
}
#include "monster-race/monster-race.h"
#include "monster/monster-info.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "system/angband-system.h"
#include "system/floor-type-definition.h"
#include "system/grid-type-definition.h"
auto *floor_ptr = player_ptr->current_floor_ptr;
this->g_ptr = &floor_ptr->grid_array[this->y][this->x];
this->m_ptr = &floor_ptr->m_list[this->g_ptr->m_idx];
- this->m_caster_ptr = (this->src_idx > 0) ? &floor_ptr->m_list[this->src_idx] : nullptr;
+ this->m_caster_ptr = is_monster(this->src_idx) ? &floor_ptr->m_list[this->src_idx] : nullptr;
this->r_ptr = &this->m_ptr->get_monrace();
this->seen = this->m_ptr->ml;
this->seen_msg = is_seen(player_ptr, this->m_ptr);
this->slept = this->m_ptr->is_asleep();
this->known = (this->m_ptr->cdis <= MAX_PLAYER_SIGHT) || AngbandSystem::get_instance().is_phase_out();
this->note_dies = this->m_ptr->get_died_message();
- this->caster_lev = (this->src_idx > 0) ? this->m_caster_ptr->get_monrace().level : (player_ptr->lev * 2);
+ this->caster_lev = is_monster(this->src_idx) ? this->m_caster_ptr->get_monrace().level : (player_ptr->lev * 2);
}
#include "monster/monster-status-setter.h"
#include "monster/monster-status.h"
#include "monster/monster-update.h"
+#include "monster/monster-util.h"
#include "object-enchant/special-object-flags.h"
#include "object/object-kind-hook.h"
#include "spell-kind/blood-curse.h"
*/
static ProcessResult is_affective(PlayerType *player_ptr, EffectMonster *em_ptr)
{
- if (!em_ptr->g_ptr->m_idx) {
+ if (!is_monster(em_ptr->g_ptr->m_idx)) {
return ProcessResult::PROCESS_FALSE;
}
- if (em_ptr->src_idx && (em_ptr->g_ptr->m_idx == em_ptr->src_idx)) {
+ if (is_monster(em_ptr->src_idx) && (em_ptr->g_ptr->m_idx == em_ptr->src_idx)) {
return ProcessResult::PROCESS_FALSE;
}
if (sukekaku && ((em_ptr->m_ptr->r_idx == MonsterRaceId::SUKE) || (em_ptr->m_ptr->r_idx == MonsterRaceId::KAKU))) {
if (em_ptr->m_ptr->hp < 0) {
return ProcessResult::PROCESS_FALSE;
}
- if (em_ptr->src_idx || em_ptr->g_ptr->m_idx != player_ptr->riding) {
+ if (is_monster(em_ptr->src_idx) || em_ptr->g_ptr->m_idx != player_ptr->riding) {
return ProcessResult::PROCESS_TRUE;
}
}
}
- if (em_ptr->src_idx > 0) {
+ if (is_monster(em_ptr->src_idx)) {
monster_gain_exp(player_ptr, em_ptr->src_idx, em_ptr->m_ptr->r_idx);
}
*/
static bool deal_effect_damage_from_monster(PlayerType *player_ptr, EffectMonster *em_ptr)
{
- if (em_ptr->src_idx <= 0) {
+ if (!is_monster(em_ptr->src_idx)) {
return false;
}
*/
static void effect_makes_change_virtues(PlayerType *player_ptr, EffectMonster *em_ptr)
{
- if ((em_ptr->src_idx > 0) || !em_ptr->slept) {
+ if (is_monster(em_ptr->src_idx) || !em_ptr->slept) {
return;
}
auto should_alive = r_ptr->kind_flags.has(MonsterKindType::UNIQUE);
should_alive |= r_ptr->misc_flags.has(MonsterMiscType::QUESTOR);
should_alive |= r_ptr->population_flags.has(MonsterPopulationType::NAZGUL);
- if (should_alive && !AngbandSystem::get_instance().is_phase_out() && (em_ptr->src_idx > 0) && (em_ptr->dam > em_ptr->m_ptr->hp)) {
+ if (should_alive && !AngbandSystem::get_instance().is_phase_out() && is_monster(em_ptr->src_idx) && (em_ptr->dam > em_ptr->m_ptr->hp)) {
em_ptr->dam = em_ptr->m_ptr->hp;
}
}
em_ptr->note = _("が消え去った!", " disappears!");
- if (!em_ptr->src_idx) {
+ if (is_monster(em_ptr->src_idx)) {
chg_virtue(player_ptr, Virtue::VALOUR, -1);
}
- teleport_flags tflag = i2enum<teleport_flags>((!em_ptr->src_idx ? TELEPORT_DEC_VALOUR : TELEPORT_SPONTANEOUS) | TELEPORT_PASSIVE);
+ teleport_flags tflag = i2enum<teleport_flags>((is_monster(em_ptr->src_idx) ? TELEPORT_DEC_VALOUR : TELEPORT_SPONTANEOUS) | TELEPORT_PASSIVE);
teleport_away(player_ptr, em_ptr->g_ptr->m_idx, em_ptr->do_dist, tflag);
em_ptr->y = em_ptr->m_ptr->fy;
return;
}
- if (em_ptr->src_idx == 0) {
+ if (is_player(em_ptr->src_idx)) {
if (!(em_ptr->flag & PROJECT_NO_HANGEKI)) {
set_target(m_ptr, monster_target_y, monster_target_x);
}
}
const auto &m_caster_ref = *em_ptr->m_caster_ptr;
- if ((em_ptr->src_idx > 0) && m_caster_ref.is_pet() && !player_ptr->is_located_at({ m_ptr->target_y, m_ptr->target_x })) {
+ if (is_monster(em_ptr->src_idx) && m_caster_ref.is_pet() && !player_ptr->is_located_at({ m_ptr->target_y, m_ptr->target_x })) {
set_target(m_ptr, m_caster_ref.fy, m_caster_ref.fx);
}
}
#include "core/window-redrawer.h"
#include "effect/effect-player.h"
#include "mind/mind-mirror-master.h"
+#include "monster/monster-util.h"
#include "player/player-damage.h"
#include "player/player-status-flags.h"
#include "status/bad-status-setter.h"
return;
}
- if (ep_ptr->src_idx > 0) {
+ if (is_monster(ep_ptr->src_idx)) {
msg_format(_("%s^に精神エネルギーを吸い取られてしまった!", "%s^ draws psychic energy from you!"), ep_ptr->m_name);
} else {
msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drained!"));
};
rfu.set_flags(flags);
- if ((ep_ptr->src_idx <= 0) || (ep_ptr->m_ptr->hp >= ep_ptr->m_ptr->maxhp)) {
+ if (!is_monster(ep_ptr->src_idx) || (ep_ptr->m_ptr->hp >= ep_ptr->m_ptr->maxhp)) {
ep_ptr->dam = 0;
return;
}
#include "monster-race/monster-race.h"
#include "monster/monster-describer.h"
#include "monster/monster-description-types.h"
+#include "monster/monster-util.h"
#include "player-base/player-class.h"
#include "player-info/samurai-data-type.h"
#include "player/player-status-flags.h"
msg_print(mes);
POSITION t_y;
POSITION t_x;
- if (ep_ptr->src_idx > 0) {
+ if (is_monster(ep_ptr->src_idx)) {
auto *floor_ptr = player_ptr->current_floor_ptr;
auto *m_ptr = &floor_ptr->m_list[ep_ptr->src_idx];
do {
auto is_effective = ep_ptr->dam > 0;
is_effective &= randint0(55) < (player_ptr->lev * 3 / 5 + 20);
- is_effective &= ep_ptr->src_idx > 0;
+ is_effective &= is_monster(ep_ptr->src_idx);
is_effective &= ep_ptr->src_idx != player_ptr->riding;
if (is_effective && kawarimi(player_ptr, true)) {
return ProcessResult::PROCESS_FALSE;
}
- if ((ep_ptr->src_idx == 0) || (ep_ptr->src_idx == player_ptr->riding)) {
+ if (is_player(ep_ptr->src_idx) || (ep_ptr->src_idx == player_ptr->riding)) {
return ProcessResult::PROCESS_FALSE;
}
*/
static void describe_effect_source(PlayerType *player_ptr, EffectPlayerType *ep_ptr, concptr src_name)
{
- if (ep_ptr->src_idx > 0) {
+ if (is_monster(ep_ptr->src_idx)) {
ep_ptr->m_ptr = &player_ptr->current_floor_ptr->m_list[ep_ptr->src_idx];
ep_ptr->rlev = ep_ptr->m_ptr->get_monrace().level >= 1 ? ep_ptr->m_ptr->get_monrace().level : 1;
angband_strcpy(ep_ptr->m_name, monster_desc(player_ptr, ep_ptr->m_ptr, 0), sizeof(ep_ptr->m_name));
switch_effects_player(player_ptr, ep_ptr);
SpellHex(player_ptr).store_vengeful_damage(ep_ptr->get_damage);
- if ((player_ptr->tim_eyeeye || SpellHex(player_ptr).is_spelling_specific(HEX_EYE_FOR_EYE)) && (ep_ptr->get_damage > 0) && !player_ptr->is_dead && (ep_ptr->src_idx > 0)) {
+ if ((player_ptr->tim_eyeeye || SpellHex(player_ptr).is_spelling_specific(HEX_EYE_FOR_EYE)) && (ep_ptr->get_damage > 0) && !player_ptr->is_dead && is_monster(ep_ptr->src_idx)) {
const auto m_name_self = monster_desc(player_ptr, ep_ptr->m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
msg_print(_(format("攻撃が%s自身を傷つけた!", ep_ptr->m_name), format("The attack of %s has wounded %s!", ep_ptr->m_name, m_name_self.data())));
(*project)(player_ptr, 0, 0, ep_ptr->m_ptr->fy, ep_ptr->m_ptr->fx, ep_ptr->get_damage, AttributeType::MISSILE, PROJECT_KILL, std::nullopt);
#include "monster/monster-describer.h"
#include "monster/monster-description-types.h"
#include "monster/monster-info.h"
+#include "monster/monster-util.h"
#include "pet/pet-fall-off.h"
#include "player/player-status.h"
#include "spell-class/spells-mirror-master.h"
if (any_bits(flag, PROJECT_JUMP)) {
x1 = target_x;
y1 = target_y;
- } else if (src_idx <= 0) {
+ } else if (!is_monster(src_idx)) {
x1 = player_ptr->x;
y1 = player_ptr->y;
- } else if (src_idx > 0) {
+ } else if (is_monster(src_idx)) {
x1 = player_ptr->current_floor_ptr->m_list[src_idx].fx;
y1 = player_ptr->current_floor_ptr->m_list[src_idx].fy;
} else {
update_creature(player_ptr);
if (flag & PROJECT_KILL) {
- see_s_msg = (src_idx > 0) ? is_seen(player_ptr, &player_ptr->current_floor_ptr->m_list[src_idx])
- : (!src_idx ? true : (player_can_see_bold(player_ptr, y1, x1) && projectable(player_ptr, player_ptr->y, player_ptr->x, y1, x1)));
+ see_s_msg = is_monster(src_idx) ? is_seen(player_ptr, &player_ptr->current_floor_ptr->m_list[src_idx])
+ : (is_player(src_idx) ? true : (player_can_see_bold(player_ptr, y1, x1) && projectable(player_ptr, player_ptr->y, player_ptr->x, y1, x1)));
}
if (flag & (PROJECT_GRID)) {
} else {
msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
}
- } else if (src_idx <= 0) {
+ } else if (!is_monster(src_idx)) {
sound(SOUND_REFLECT);
}
if (!src_idx && (project_m_n == 1) && none_bits(flag, PROJECT_JUMP)) {
const Pos2D pos_project(project_m_y, project_m_x);
const auto &grid = floor.get_grid(pos_project);
- if (grid.m_idx > 0) {
+ if (is_monster(grid.m_idx)) {
auto &monster = floor.m_list[grid.m_idx];
if (monster.ml) {
if (!player_ptr->effects()->hallucination()->is_hallucinated()) {
}
std::string who_name;
- if (src_idx > 0) {
+ if (is_monster(src_idx)) {
who_name = monster_desc(player_ptr, &floor.m_list[src_idx], MD_WRONGDOER_NAME);
}
#include "grid/grid.h"
#include "monster-race/monster-race.h"
#include "monster/monster-info.h"
+#include "monster/monster-util.h"
#include "room/lake-types.h"
#include "spell-kind/spells-floor.h"
#include "system/artifact-type-definition.h"
}
auto *r_ptr = &monraces_info[floor.m_list[grid.m_idx].r_idx];
- if (grid.m_idx && !(streamer.flags.has(TerrainCharacteristics::PLACE) && monster_can_cross_terrain(player_ptr, feat, r_ptr, 0))) {
+ if (is_monster(grid.m_idx) && !(streamer.flags.has(TerrainCharacteristics::PLACE) && monster_can_cross_terrain(player_ptr, feat, r_ptr, 0))) {
/* Delete the monster (if any) */
delete_monster(player_ptr, pos.y, pos.x);
}
#include "grid/object-placer.h"
#include "grid/trap.h"
#include "monster-race/monster-race.h"
+#include "monster/monster-util.h"
#include "system/dungeon-info.h"
#include "system/floor-type-definition.h"
#include "system/grid-type-definition.h"
{
auto *floor_ptr = player_ptr->current_floor_ptr;
auto *g_ptr = &floor_ptr->grid_array[y][x];
- if (!g_ptr->is_floor() || pattern_tile(floor_ptr, y, x) || !g_ptr->o_idx_list.empty() || (g_ptr->m_idx != 0) || next_to_walls(floor_ptr, y, x) < walls) {
+ if (!g_ptr->is_floor() || pattern_tile(floor_ptr, y, x) || !g_ptr->o_idx_list.empty() || is_monster(g_ptr->m_idx) || next_to_walls(floor_ptr, y, x) < walls) {
return false;
}
x = randint0(floor_ptr->width);
const Pos2D pos(y, x);
const auto &grid = floor_ptr->get_grid(pos);
- if (!grid.is_floor() || !grid.o_idx_list.empty() || grid.m_idx) {
+ if (!grid.is_floor() || !grid.o_idx_list.empty() || is_monster(grid.m_idx)) {
continue;
}
continue;
}
- if (grid.m_idx != 0) {
+ if (is_monster(grid.m_idx)) {
delete_monster_idx(player_ptr, grid.m_idx);
}
continue;
}
- if (grid.m_idx != 0) {
+ if (is_monster(grid.m_idx)) {
delete_monster_idx(player_ptr, grid.m_idx);
}
#include "grid/lighting-colors-table.h"
#include "mind/mind-ninja.h"
#include "monster/monster-update.h"
+#include "monster/monster-util.h"
#include "player/special-defense-types.h"
#include "room/door-definition.h"
#include "system/dungeon-info.h"
g_ptr->info &= ~(CAVE_MARK);
}
- if (g_ptr->m_idx) {
+ if (is_monster(g_ptr->m_idx)) {
update_monster(player_ptr, g_ptr->m_idx, false);
}
auto *cc_ptr = &floor_ptr->grid_array[yy][xx];
cc_ptr->info |= CAVE_GLOW;
if (cc_ptr->is_view()) {
- if (cc_ptr->m_idx) {
+ if (is_monster(cc_ptr->m_idx)) {
update_monster(player_ptr, cc_ptr->m_idx, false);
}
#include "monster/monster-info.h"
#include "monster/monster-status.h"
#include "monster/monster-update.h"
+#include "monster/monster-util.h"
#include "object/item-tester-hooker.h"
#include "object/object-mark-types.h"
#include "player-info/class-info.h"
const auto &grid = player_ptr->current_floor_ptr->get_grid({ y, x });
/* Must be a "naked" floor grid */
- if (grid.m_idx) {
+ if (is_monster(grid.m_idx)) {
continue;
}
if (floor.is_in_dungeon()) {
return;
}
- if (grid.m_idx > 0) {
+ if (is_monster(grid.m_idx)) {
update_monster(player_ptr, grid.m_idx, false);
}
return false;
}
- if (grid.m_idx && (grid.m_idx != m_idx)) {
+ if (is_monster(grid.m_idx) && (grid.m_idx != m_idx)) {
return false;
}
if (player_ptr->is_located_at(pos)) {
return false;
}
- if (grid.m_idx && (grid.m_idx != player_ptr->riding)) {
+ if (is_monster(grid.m_idx) && (grid.m_idx != player_ptr->riding)) {
return false;
}
return;
}
- if (g_ptr->m_idx > 0) {
+ if (is_monster(g_ptr->m_idx)) {
delete_monster_idx(player_ptr, g_ptr->m_idx);
}
}
#include "game-option/special-options.h"
#include "grid/feature.h"
#include "io/screen-util.h"
+#include "monster/monster-util.h"
#include "player/player-status.h"
#include "system/angband-system.h"
#include "system/floor-type-definition.h"
TERM_COLOR ta = default_color;
auto tc = '*';
- if (g_ptr->m_idx && floor_ptr->m_list[g_ptr->m_idx].ml) {
+ if (is_monster(g_ptr->m_idx) && floor_ptr->m_list[g_ptr->m_idx].ml) {
map_info(player_ptr, ny, nx, &a, &c, &ta, &tc);
if (!is_ascii_graphics(a)) {
#include "grid/feature.h"
#include "grid/grid.h"
#include "mind/mind-numbers.h"
+#include "monster/monster-util.h"
#include "player-attack/player-attack.h"
#include "player/player-move.h"
#include "spell-kind/earthquake.h"
y = player_ptr->y + ddy[dir];
x = player_ptr->x + ddx[dir];
- if (!player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (!is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
return false;
}
y += ddy[dir];
x += ddx[dir];
- if (player_can_enter(player_ptr, player_ptr->current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(player_ptr, player_ptr->current_floor_ptr->grid_array[y][x].feat) && !player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (player_can_enter(player_ptr, player_ptr->current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(player_ptr, player_ptr->current_floor_ptr->grid_array[y][x].feat) && !is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
msg_print(nullptr);
(void)move_player_effect(player_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
}
#include "monster-race/race-brightness-flags.h"
#include "monster-race/race-flags-resistance.h"
#include "monster/monster-describer.h"
+#include "monster/monster-util.h"
#include "player-base/player-class.h"
#include "player-info/equipment-info.h"
#include "player-status/player-energy.h"
return ProcessResult::PROCESS_TRUE;
}
- if (genocide_aux(player_ptr, em_ptr->g_ptr->m_idx, em_ptr->dam, !em_ptr->src_idx, (em_ptr->r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One"))) {
+ if (genocide_aux(player_ptr, em_ptr->g_ptr->m_idx, em_ptr->dam, is_player(em_ptr->src_idx), (em_ptr->r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One"))) {
if (em_ptr->seen_msg) {
msg_format(_("%sは消滅した!", "%s^ disappeared!"), em_ptr->m_name);
}
#include "monster/monster-describer.h"
#include "monster/monster-status.h"
#include "monster/monster-update.h"
+#include "monster/monster-util.h"
#include "pet/pet-util.h"
#include "player-base/player-class.h"
#include "player-info/equipment-info.h"
PLAYER_LEVEL plev = player_ptr->lev;
int dam = damroll(8 + ((plev - 5) / 4) + boost / 12, 8);
fire_beam(player_ptr, AttributeType::MISSILE, dir, dam);
- if (!player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (!is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
return true;
}
#include "monster/monster-describer.h"
#include "monster/monster-status.h"
#include "monster/monster-update.h"
+#include "monster/monster-util.h"
#include "object-enchant/trc-types.h"
#include "object/object-kind-hook.h"
#include "player-attack/player-attack.h"
continue;
}
- if (!grid_new.m_idx) {
+ if (!is_monster(grid_new.m_idx)) {
if (tm_idx) {
msg_print(_("失敗!", "Failed!"));
} else {
#include "mind/mind-warrior.h"
#include "cmd-action/cmd-attack.h"
#include "floor/geometry.h"
+#include "monster/monster-util.h"
#include "spell-kind/spells-teleport.h"
#include "system/floor-type-definition.h"
#include "system/grid-type-definition.h"
}
POSITION y = player_ptr->y + ddy[dir];
POSITION x = player_ptr->x + ddx[dir];
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
if (randint0(player_ptr->skill_dis) < 7) {
msg_print(_("うまく逃げられなかった。", "You failed to run away."));
g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
/* Hack -- attack monsters */
- if (g_ptr->m_idx) {
+ if (is_monster(g_ptr->m_idx)) {
do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
} else {
msg_print(_("攻撃が空をきった。", "You attack the empty air."));
#include "monster-race/monster-race.h"
#include "monster/monster-status-setter.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "player-attack/player-attack.h"
#include "player-base/player-class.h"
#include "player-info/monk-data-type.h"
}
POSITION y = player_ptr->y + ddy[dir];
POSITION x = player_ptr->x + ddx[dir];
- if (!player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (!is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
msg_print(nullptr);
return true;
}
do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
handle_stuff(player_ptr);
do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
}
#include "monster/monster-processor-util.h"
#include "monster/monster-status-setter.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "system/dungeon-info.h"
#include "system/floor-type-definition.h"
#include "system/grid-type-definition.h"
*/
bool process_monster_attack_to_monster(PlayerType *player_ptr, turn_flags *turn_flags_ptr, MONSTER_IDX m_idx, Grid *g_ptr, bool can_cross)
{
- if (!turn_flags_ptr->do_move || (g_ptr->m_idx == 0)) {
+ if (!turn_flags_ptr->do_move || !is_monster(g_ptr->m_idx)) {
return false;
}
#include "monster/monster-processor-util.h"
#include "monster/monster-status.h"
#include "monster/monster-update.h"
+#include "monster/monster-util.h"
#include "pet/pet-util.h"
#include "player/player-status-flags.h"
#include "system/angband-system.h"
return true;
}
- if (grid.m_idx > 0) {
+ if (is_monster(grid.m_idx)) {
turn_flags_ptr->do_move = true;
return true;
}
#include "monster/monster-info.h"
#include "monster/monster-status-setter.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "system/floor-type-definition.h"
#include "system/grid-type-definition.h"
#include "system/item-entity.h"
}
g_ptr = &floor_ptr->grid_array[y][x];
- if (g_ptr->m_idx) {
+ if (is_monster(g_ptr->m_idx)) {
delete_monster_idx(player_ptr, g_ptr->m_idx);
}
}
summon_specific_type = SUMMON_NONE;
bool notice = false;
- if (src_idx <= 0) {
+ if (!is_monster(src_idx)) {
notice = true;
} else {
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[src_idx];
int number_mon = 0;
for (int i2 = 0; i2 < floor.width; ++i2) {
for (int j2 = 0; j2 < floor.height; j2++) {
- auto quest_monster = (floor.grid_array[j2][i2].m_idx > 0);
+ auto quest_monster = is_monster(floor.grid_array[j2][i2].m_idx);
quest_monster &= (floor.m_list[floor.grid_array[j2][i2].m_idx].r_idx == q_ptr->r_idx);
if (quest_monster) {
number_mon++;
g_ptr->m_idx = m_pop(&floor);
hack_m_idx_ii = g_ptr->m_idx;
- if (!g_ptr->m_idx) {
+ if (!is_monster(g_ptr->m_idx)) {
return false;
}
m_ptr->mflag.clear();
m_ptr->mflag2.clear();
- if (any_bits(mode, PM_MULTIPLY) && (src_idx > 0) && !floor.m_list[src_idx].is_original_ap()) {
+ if (any_bits(mode, PM_MULTIPLY) && is_monster(src_idx) && !floor.m_list[src_idx].is_original_ap()) {
m_ptr->ap_r_idx = floor.m_list[src_idx].ap_r_idx;
if (floor.m_list[src_idx].mflag2.has(MonsterConstantFlagType::KAGE)) {
m_ptr->mflag2.set(MonsterConstantFlagType::KAGE);
}
}
- if ((src_idx > 0) && r_ptr->kind_flags.has_none_of(alignment_mask)) {
+ if (is_monster(src_idx) && r_ptr->kind_flags.has_none_of(alignment_mask)) {
m_ptr->sub_align = floor.m_list[src_idx].sub_align;
} else {
m_ptr->sub_align = SUB_ALIGN_NEUTRAL;
m_ptr->nickname.clear();
m_ptr->exp = 0;
- if (src_idx > 0 && floor.m_list[src_idx].is_pet()) {
+ if (is_monster(src_idx) && floor.m_list[src_idx].is_pet()) {
set_bits(mode, PM_FORCE_PET);
m_ptr->parent_m_idx = src_idx;
} else {
choose_new_monster(player_ptr, g_ptr->m_idx, true, MonsterRace::empty_id());
r_ptr = &m_ptr->get_monrace();
m_ptr->mflag2.set(MonsterConstantFlagType::CHAMELEON);
- if (r_ptr->kind_flags.has(MonsterKindType::UNIQUE) && (src_idx <= 0)) {
+ if (r_ptr->kind_flags.has(MonsterKindType::UNIQUE) && (!is_monster(src_idx))) {
m_ptr->sub_align = SUB_ALIGN_NEUTRAL;
}
} else if (any_bits(mode, PM_KAGE) && none_bits(mode, PM_FORCE_PET)) {
m_ptr->ml = false;
if (any_bits(mode, PM_FORCE_PET)) {
set_pet(player_ptr, m_ptr);
- } else if (((src_idx == 0) && r_ptr->behavior_flags.has(MonsterBehaviorType::FRIENDLY)) || is_friendly_idx(player_ptr, src_idx) || any_bits(mode, PM_FORCE_FRIENDLY)) {
+ } else if ((is_player(src_idx) && r_ptr->behavior_flags.has(MonsterBehaviorType::FRIENDLY)) || is_friendly_idx(player_ptr, src_idx) || any_bits(mode, PM_FORCE_FRIENDLY)) {
if (!monster_has_hostile_align(player_ptr, nullptr, 0, -1, r_ptr) && !player_ptr->current_floor_ptr->inside_arena) {
set_friendly(m_ptr);
}
#include "monster/monster-describer.h"
#include "monster/monster-flag-types.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "monster/smart-learn-types.h"
#include "player/player-status-flags.h"
#include "system/floor-type-definition.h"
if (player_ptr->is_located_at(pos)) {
return false;
}
- if (grid.m_idx) {
+ if (is_monster(grid.m_idx)) {
return false;
}
if (!in_bounds(floor_ptr, ay, ax)) {
continue;
}
- if (floor_ptr->grid_array[ay][ax].m_idx > 0) {
+ if (is_monster(floor_ptr->grid_array[ay][ax].m_idx)) {
count++;
}
}
continue;
}
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
k++;
}
}
#include "monster/monster-info.h"
#include "monster/monster-processor-util.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "monster/smart-learn-types.h"
#include "player-base/player-class.h"
#include "player-info/samurai-data-type.h"
}
player_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = g_ptr->m_idx;
- if (g_ptr->m_idx) {
+ if (is_monster(g_ptr->m_idx)) {
y_ptr->fy = oy;
y_ptr->fx = ox;
update_monster(player_ptr, g_ptr->m_idx, true);
{
return do_get_mon_num_prep(player_ptr, nullptr, nullptr, false);
}
+
+bool is_player(MONSTER_IDX m_idx)
+{
+ return m_idx == 0;
+}
+
+bool is_monster(MONSTER_IDX m_idx)
+{
+ return m_idx > 0;
+}
monsterrace_hook_type get_monster_hook2(PlayerType *player_ptr, POSITION y, POSITION x);
errr get_mon_num_prep(PlayerType *player_ptr, monsterrace_hook_type hook1, monsterrace_hook_type hook2);
errr get_mon_num_prep_bounty(PlayerType *player_ptr);
+bool is_player(MONSTER_IDX m_idx);
+bool is_monster(MONSTER_IDX m_idx);
#include "monster/monster-flag-types.h"
#include "monster/monster-info.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "mspell/assign-monster-spell.h"
#include "mspell/improper-mspell-remover.h"
#include "mspell/mspell-judgement.h"
for (const auto &[y, x] : grid_g) {
const Pos2D pos(y, x);
const auto &grid = floor_ptr->get_grid(pos);
- if ((grid.m_idx > 0) && (y != y2 || x != x2)) {
+ if (is_monster(grid.m_idx) && (y != y2 || x != x2)) {
auto *m_ptr = &floor_ptr->m_list[grid.m_idx];
if (is_friend == m_ptr->is_pet()) {
return false;
#include "monster-race/monster-race.h"
#include "monster-race/race-flags-resistance.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "player-base/player-class.h"
#include "player-base/player-race.h"
#include "player-info/race-info.h"
const auto &grid = floor.get_grid(pos);
if (y == y2 && x == x2) {
hit2 = true;
- } else if (is_friend && grid.m_idx > 0 && !m_ptr->is_hostile_to_melee(floor.m_list[grid.m_idx])) {
+ } else if (is_friend && is_monster(grid.m_idx) && !m_ptr->is_hostile_to_melee(floor.m_list[grid.m_idx])) {
return false;
}
#include "floor/geometry.h"
#include "grid/grid.h"
#include "monster/monster-info.h"
+#include "monster/monster-util.h"
#include "player/digestion-processor.h"
#include "player/player-move.h"
#include "player/player-status.h"
msg_print(_("この地形は食べられない。", "You cannot eat this feature."));
} else if (terrain.flags.has(TerrainCharacteristics::PERMANENT)) {
msg_format(_("いてっ!この%sはあなたの歯より硬い!", "Ouch! This %s is harder than your teeth!"), terrain_mimic.name.data());
- } else if (grid.m_idx) {
+ } else if (is_monster(grid.m_idx)) {
const auto &monster = player_ptr->current_floor_ptr->m_list[grid.m_idx];
msg_print(_("何かが邪魔しています!", "There's something in the way!"));
if (!monster.ml || !monster.is_pet()) {
#include "monster/monster-pain-describer.h"
#include "monster/monster-status-setter.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "object-enchant/tr-types.h"
#include "object-hook/hook-expendable.h"
#include "object-hook/hook-weapon.h"
auto *floor_ptr = this->player_ptr->current_floor_ptr;
auto *angry_m_ptr = &floor_ptr->m_list[floor_ptr->grid_array[this->y][this->x].m_idx];
- if ((floor_ptr->grid_array[this->y][this->x].m_idx == 0) || !angry_m_ptr->is_friendly() || angry_m_ptr->is_invulnerable()) {
+ if (!is_monster(floor_ptr->grid_array[this->y][this->x].m_idx) || !angry_m_ptr->is_friendly() || angry_m_ptr->is_invulnerable()) {
this->do_drop = false;
return;
}
#include "monster-race/race-indice-types.h"
#include "monster/monster-info.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "mspell/mspell-damage-calculator.h"
#include "mutation/mutation-flag-types.h"
#include "object-enchant/tr-types.h"
const auto *g_ptr = &floor.grid_array[my][mx];
- if (!g_ptr->m_idx) {
+ if (!is_monster(g_ptr->m_idx)) {
continue;
}
#include "monster-attack/monster-attack-player.h"
#include "monster-race/monster-race.h"
#include "monster/monster-describer.h"
+#include "monster/monster-util.h"
#include "pet/pet-util.h"
#include "player-base/player-class.h"
#include "player/player-damage.h"
Grid *g_ptr;
g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
- if (g_ptr->m_idx) {
+ if (is_monster(g_ptr->m_idx)) {
continue;
}
#include "monster/monster-describer.h"
#include "monster/monster-status-setter.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "object-enchant/tr-types.h"
#include "object-enchant/vorpal-weapon.h"
#include "object-hook/hook-weapon.h"
}
earthquake(player_ptr, player_ptr->y, player_ptr->x, 10, 0);
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx == 0) {
+ if (!is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
*(pa_ptr->mdeath) = true;
}
}
POSITION x = player_ptr->x + ddx_ddd[dir];
g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
m_ptr = &player_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
- if (g_ptr->m_idx && (m_ptr->ml || cave_has_flag_bold(player_ptr->current_floor_ptr, y, x, TerrainCharacteristics::PROJECT))) {
+ if (is_monster(g_ptr->m_idx) && (m_ptr->ml || cave_has_flag_bold(player_ptr->current_floor_ptr, y, x, TerrainCharacteristics::PROJECT))) {
do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
}
}
#include "monster-race/monster-race-hook.h"
#include "monster-race/monster-race.h"
#include "monster/monster-update.h"
+#include "monster/monster-util.h"
#include "monster/smart-learn-types.h"
#include "mutation/mutation-calculator.h"
#include "mutation/mutation-flag-types.h"
}
lite_spot(player_ptr, y, x);
- if (g_ptr->m_idx) {
+ if (is_monster(g_ptr->m_idx)) {
update_monster(player_ptr, g_ptr->m_idx, false);
}
*/
bool player_place(PlayerType *player_ptr, POSITION y, POSITION x)
{
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx != 0) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
return false;
}
#include "dungeon/dungeon-flag-types.h"
#include "floor/geometry.h"
#include "hpmp/hp-mp-processor.h"
+#include "monster/monster-util.h"
#include "player/digestion-processor.h"
#include "player/player-status.h"
#include "spell-kind/spells-specific-bolt.h"
POSITION x = player_ptr->x + ddx[dir];
const auto *g_ptr = &floor.grid_array[y][x];
stop_mouth(player_ptr);
- if (!(g_ptr->m_idx)) {
+ if (!is_monster(g_ptr->m_idx)) {
msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
return false;
}
#include "inventory/inventory-slot-types.h"
#include "io/input-key-requester.h"
#include "monster-race/monster-race.h"
+#include "monster/monster-util.h"
#include "object-enchant/object-curse.h"
#include "object-enchant/tr-types.h"
#include "object-enchant/trc-types.h"
if (dir == 5) {
continue;
}
- if (floor_ptr->grid_array[dy][dx].m_idx) {
+ if (is_monster(floor_ptr->grid_array[dy][dx].m_idx)) {
flag = true;
}
}
#include "monster/monster-describer.h"
#include "monster/monster-info.h"
#include "monster/monster-update.h"
+#include "monster/monster-util.h"
#include "object-enchant/tr-types.h"
#include "player-info/equipment-info.h"
#include "player/player-damage.h"
y = player_ptr->y + ddy_cdd[cdir];
x = player_ptr->x + ddx_cdd[cdir];
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
} else {
msg_print(_("攻撃は空を切った。", "You attack the empty air."));
y = player_ptr->y + ddy_cdd[(cdir + 7) % 8];
x = player_ptr->x + ddx_cdd[(cdir + 7) % 8];
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
} else {
msg_print(_("攻撃は空を切った。", "You attack the empty air."));
y = player_ptr->y + ddy_cdd[(cdir + 1) % 8];
x = player_ptr->x + ddx_cdd[(cdir + 1) % 8];
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
} else {
msg_print(_("攻撃は空を切った。", "You attack the empty air."));
y = player_ptr->y + ddy[dir];
x = player_ptr->x + ddx[dir];
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
do_cmd_attack(player_ptr, y, x, HISSATSU_FIRE);
} else {
msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
y = player_ptr->y + ddy[dir];
x = player_ptr->x + ddx[dir];
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
do_cmd_attack(player_ptr, y, x, HISSATSU_MINEUCHI);
} else {
msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
const auto *floor_ptr = player_ptr->current_floor_ptr;
const auto &grid = floor_ptr->grid_array[y][x];
- if (!grid.m_idx) {
+ if (!is_monster(grid.m_idx)) {
msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
return std::nullopt;
}
y = player_ptr->y + ddy[dir];
x = player_ptr->x + ddx[dir];
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
do_cmd_attack(player_ptr, y, x, HISSATSU_POISON);
} else {
msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
y = player_ptr->y + ddy[dir];
x = player_ptr->x + ddx[dir];
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
do_cmd_attack(player_ptr, y, x, HISSATSU_ZANMA);
} else {
msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
x = player_ptr->x + ddx[dir];
const auto &floor = *player_ptr->current_floor_ptr;
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
} else {
msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
if (floor.get_dungeon_definition().flags.has(DungeonFeatureType::NO_MELEE)) {
return "";
}
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
int i;
POSITION ty = y, tx = x;
POSITION oy = y, ox = x;
y = player_ptr->y + ddy[dir];
x = player_ptr->x + ddx[dir];
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
do_cmd_attack(player_ptr, y, x, HISSATSU_HAGAN);
}
y = player_ptr->y + ddy[dir];
x = player_ptr->x + ddx[dir];
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
do_cmd_attack(player_ptr, y, x, HISSATSU_COLD);
} else {
msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
y = player_ptr->y + ddy[dir];
x = player_ptr->x + ddx[dir];
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
do_cmd_attack(player_ptr, y, x, HISSATSU_KYUSHO);
} else {
msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
y = player_ptr->y + ddy[dir];
x = player_ptr->x + ddx[dir];
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
do_cmd_attack(player_ptr, y, x, HISSATSU_MAJIN);
} else {
msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
y = player_ptr->y + ddy[dir];
x = player_ptr->x + ddx[dir];
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
do_cmd_attack(player_ptr, y, x, HISSATSU_SUTEMI);
} else {
msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
y = player_ptr->y + ddy[dir];
x = player_ptr->x + ddx[dir];
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
do_cmd_attack(player_ptr, y, x, HISSATSU_ELEC);
} else {
msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
x = player_ptr->x + ddx_ddd[dir];
auto *g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
- if ((g_ptr->m_idx == 0) || (!m_ptr->ml && !cave_has_flag_bold(player_ptr->current_floor_ptr, y, x, TerrainCharacteristics::PROJECT))) {
+ if (!is_monster(g_ptr->m_idx) || (!m_ptr->ml && !cave_has_flag_bold(player_ptr->current_floor_ptr, y, x, TerrainCharacteristics::PROJECT))) {
continue;
}
y = player_ptr->y + ddy[dir];
x = player_ptr->x + ddx[dir];
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
do_cmd_attack(player_ptr, y, x, HISSATSU_QUAKE);
} else {
earthquake(player_ptr, player_ptr->y, player_ptr->x, 10, 0);
x = player_ptr->x + ddx[dir];
g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
- if (g_ptr->m_idx) {
+ if (is_monster(g_ptr->m_idx)) {
do_cmd_attack(player_ptr, y, x, HISSATSU_3DAN);
} else {
msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
}
/* Monster is dead? */
- if (!g_ptr->m_idx) {
+ if (!is_monster(g_ptr->m_idx)) {
break;
}
y = player_ptr->y + ddy[dir];
x = player_ptr->x + ddx[dir];
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
do_cmd_attack(player_ptr, y, x, HISSATSU_DRAIN);
} else {
msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
y = player_ptr->y + ddy[dir];
x = player_ptr->x + ddx[dir];
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
handle_stuff(player_ptr);
do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
}
y = player_ptr->y + ddy[dir];
x = player_ptr->x + ddx[dir];
- if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx)) {
do_cmd_attack(player_ptr, y, x, HISSATSU_UNDEAD);
} else {
msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
#include "grid/trap.h"
#include "monster-floor/monster-generator.h"
#include "monster-floor/place-monster-types.h"
+#include "monster/monster-util.h"
#include "system/floor-type-definition.h"
#include "system/grid-type-definition.h"
#include "system/player-type-definition.h"
static bool is_cave_empty_grid(PlayerType *player_ptr, Grid *g_ptr)
{
bool is_empty_grid = g_ptr->cave_has_flag(TerrainCharacteristics::PLACE);
- is_empty_grid &= g_ptr->m_idx == 0;
+ is_empty_grid &= !is_monster(g_ptr->m_idx);
is_empty_grid &= !player_grid(player_ptr, g_ptr);
return is_empty_grid;
}
}
g_ptr = &floor_ptr->grid_array[y1][x1];
- if (!g_ptr->is_floor() || !g_ptr->o_idx_list.empty() || g_ptr->m_idx) {
+ if (!g_ptr->is_floor() || !g_ptr->o_idx_list.empty() || is_monster(g_ptr->m_idx)) {
continue;
}
#include "io/cursor.h"
#include "io/screen-util.h"
#include "monster/monster-update.h"
+#include "monster/monster-util.h"
#include "pet/pet-util.h"
#include "spell-kind/spells-teleport.h"
#include "system/angband-system.h"
reset_bits(g_ptr->info, CAVE_MARK);
}
- if (g_ptr->m_idx) {
+ if (is_monster(g_ptr->m_idx)) {
update_monster(this->player_ptr, g_ptr->m_idx, false);
}
continue;
}
- if (g_ref.m_idx == 0) {
+ if (!is_monster(g_ref.m_idx)) {
this->remove_mirror(y, x);
}
}
}
const auto &grid = floor.grid_array[project_m_y][project_m_x];
const auto &monster = floor.m_list[grid.m_idx];
- if (project_m_n == 1 && grid.m_idx > 0 && monster.ml) {
+ if (project_m_n == 1 && is_monster(grid.m_idx) && monster.ml) {
if (!this->player_ptr->effects()->hallucination()->is_hallucinated()) {
monster_race_track(this->player_ptr, monster.ap_r_idx);
}
const auto *floor_ptr = player_ptr->current_floor_ptr;
const auto *g_ptr = &floor_ptr->grid_array[project_m_y][project_m_x];
const auto *m_ptr = &floor_ptr->m_list[g_ptr->m_idx];
- if (project_m_n == 1 && g_ptr->m_idx > 0 && m_ptr->ml) {
+ if (project_m_n == 1 && is_monster(g_ptr->m_idx) && m_ptr->ml) {
if (!player_ptr->effects()->hallucination()->is_hallucinated()) {
monster_race_track(player_ptr, m_ptr->ap_r_idx);
}
#include "monster/monster-info.h"
#include "monster/monster-status-setter.h"
#include "monster/monster-update.h"
+#include "monster/monster-util.h"
#include "monster/smart-learn-types.h"
#include "player/player-damage.h"
#include "player/player-move.h"
continue;
}
- if (floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(floor_ptr->grid_array[y][x].m_idx)) {
continue;
}
continue;
}
- if (!grid.m_idx) {
+ if (!is_monster(grid.m_idx)) {
continue;
}
continue;
}
- if (grid_neighbor.m_idx) {
+ if (is_monster(grid_neighbor.m_idx)) {
continue;
}
msg_format(_("%s^は岩石に埋もれてしまった!", "%s^ is embedded in the rock!"), m_name.data());
}
- if (grid.m_idx) {
+ if (is_monster(grid.m_idx)) {
const auto &m_ref = floor_ptr->m_list[grid.m_idx];
if (record_named_pet && m_ref.is_named_pet()) {
const auto m2_name = monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE);
#include "monster/monster-description-types.h"
#include "monster/monster-info.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "monster/smart-learn-types.h"
#include "object-enchant/special-object-flags.h"
#include "object/object-mark-types.h"
continue;
}
- if (grid.m_idx) {
+ if (is_monster(grid.m_idx)) {
auto &monster = floor.m_list[grid.m_idx];
auto &monrace = monster.get_monrace();
#include "monster/monster-status-setter.h"
#include "monster/monster-status.h"
#include "monster/monster-update.h"
+#include "monster/monster-util.h"
#include "player/special-defense-types.h"
#include "spell-kind/spells-launcher.h"
#include "system/angband-system.h"
auto *g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
g_ptr->info &= ~(CAVE_TEMP);
g_ptr->info |= (CAVE_GLOW);
- if (g_ptr->m_idx) {
+ if (is_monster(g_ptr->m_idx)) {
PERCENTAGE chance = 25;
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
auto *r_ptr = &m_ptr->get_monrace();
note_spot(player_ptr, point.y, point.x);
}
- if (grid.m_idx) {
+ if (is_monster(grid.m_idx)) {
update_monster(player_ptr, grid.m_idx, false);
}
#include "monster/monster-status-setter.h"
#include "monster/monster-status.h"
#include "monster/monster-update.h"
+#include "monster/monster-util.h"
#include "mutation/mutation-flag-types.h"
#include "object-enchant/tr-types.h"
#include "player-base/player-class.h"
Grid *g_ptr;
g_ptr = &player_ptr->current_floor_ptr->grid_array[ty][tx];
- if (!g_ptr->m_idx || (g_ptr->m_idx == player_ptr->riding)) {
+ if (!is_monster(g_ptr->m_idx) || (g_ptr->m_idx == player_ptr->riding)) {
msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
return false;
}
bool is_anywhere = w_ptr->wizard;
is_anywhere &= (mode & TELEPORT_PASSIVE) == 0;
- is_anywhere &= (player_ptr->current_floor_ptr->grid_array[y][x].m_idx > 0) || player_ptr->current_floor_ptr->grid_array[y][x].m_idx == player_ptr->riding;
+ is_anywhere &= is_monster(player_ptr->current_floor_ptr->grid_array[y][x].m_idx) || player_ptr->current_floor_ptr->grid_array[y][x].m_idx == player_ptr->riding;
if (is_anywhere) {
break;
}
#include "monster/monster-describer.h"
#include "monster/monster-status-setter.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "player-info/class-info.h"
#include "player/player-damage.h"
#include "spell-kind/spells-floor.h"
const auto &terrrain = grid.get_terrain();
grid.info &= ~(CAVE_ROOM | CAVE_ICKY);
const auto &monster = floor.m_list[grid.m_idx];
- if (grid.m_idx && monster.is_asleep()) {
+ if (is_monster(grid.m_idx) && monster.is_asleep()) {
(void)set_monster_csleep(player_ptr, grid.m_idx, 0);
if (monster.ml) {
const auto m_name = monster_desc(player_ptr, &monster, 0);
#include "floor/geometry.h"
#include "game-option/disturbance-options.h"
#include "grid/feature-flag-types.h"
+#include "monster/monster-util.h"
#include "spell-realm/spells-crusade.h"
#include "spell/range-calc.h"
#include "system/angband-system.h"
if (!cave_has_flag_bold(&floor, pos_to.y, pos_to.x, TerrainCharacteristics::PROJECT)) {
break;
}
- if ((dir != 5) && floor.get_grid(pos_to).m_idx != 0) {
+ if ((dir != 5) && is_monster(floor.get_grid(pos_to).m_idx)) {
break;
}
#include "main/sound-of-music.h"
#include "mind/mind-force-trainer.h"
#include "monster/monster-describer.h"
+#include "monster/monster-util.h"
#include "object/object-kind-hook.h"
#include "player-base/player-class.h"
#include "player-info/class-info.h"
return false;
}
- if (floor_ptr->grid_array[y][x].m_idx) {
+ if (is_monster(floor_ptr->grid_array[y][x].m_idx)) {
const auto m_name = monster_desc(player_ptr, &floor_ptr->m_list[floor_ptr->grid_array[y][x].m_idx], 0);
msg_format(_("%sが邪魔だ!", "%s^ is standing in your way."), m_name.data());
PlayerEnergy(player_ptr).reset_player_turn();
#include "monster-race/race-indice-types.h"
#include "monster/monster-info.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "monster/smart-learn-types.h"
#include "object/item-tester-hooker.h"
#include "object/item-use-flags.h"
/* Summoned by a monster */
BIT_FLAGS mode = PM_ALLOW_GROUP;
auto *floor_ptr = player_ptr->current_floor_ptr;
- if (src_idx > 0) {
+ if (is_monster(src_idx)) {
auto *m_ptr = &floor_ptr->m_list[src_idx];
if (m_ptr->is_pet()) {
mode |= PM_FORCE_PET;
#include "effect/spells-effect-util.h"
#include "floor/cave.h"
#include "grid/feature-flag-types.h"
+#include "monster/monster-util.h"
#include "spell-class/spells-mirror-master.h"
#include "system/angband-system.h"
#include "system/floor-type-definition.h"
}
}
- if (any_bits(pp_ptr->flag, PROJECT_STOP) && !pp_ptr->position->empty() && (player_ptr->is_located_at(pos) || grid.m_idx != 0)) {
+ if (any_bits(pp_ptr->flag, PROJECT_STOP) && !pp_ptr->position->empty() && (player_ptr->is_located_at(pos) || is_monster(grid.m_idx))) {
return true;
}
#include "monster/monster-describer.h"
#include "monster/monster-description-types.h"
#include "monster/monster-flag-types.h"
+#include "monster/monster-util.h"
#include "object/item-tester-hooker.h"
#include "object/object-mark-types.h"
#include "player-base/player-race.h"
static short describe_grid(PlayerType *player_ptr, GridExamination *ge_ptr)
{
- if ((ge_ptr->g_ptr->m_idx == 0) || !player_ptr->current_floor_ptr->m_list[ge_ptr->g_ptr->m_idx].ml) {
+ if (!is_monster(ge_ptr->g_ptr->m_idx) || !player_ptr->current_floor_ptr->m_list[ge_ptr->g_ptr->m_idx].ml) {
return CONTINUOUS_DESCRIPTION;
}
#include "monster/monster-flag-types.h"
#include "monster/monster-info.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "object/object-mark-types.h"
#include "system/angband-system.h"
#include "system/floor-type-definition.h"
}
const auto &grid = floor.get_grid(pos);
- if (grid.m_idx) {
+ if (is_monster(grid.m_idx)) {
auto &monster = floor.m_list[grid.m_idx];
if (monster.ml) {
return true;
#include "grid/grid.h"
#include "monster-race/monster-race.h"
#include "monster/monster-flag-types.h"
+#include "monster/monster-util.h"
#include "system/artifact-type-definition.h"
#include "system/floor-type-definition.h"
#include "system/grid-type-definition.h"
/* Extract monster race */
MonsterRaceInfo *ap_r_ptr_a;
- if (grid_a.m_idx && monster_a.ml) {
+ if (is_monster(grid_a.m_idx) && monster_a.ml) {
ap_r_ptr_a = &monster_a.get_appearance_monrace();
} else {
ap_r_ptr_a = nullptr;
}
MonsterRaceInfo *ap_r_ptr_b;
- if (grid_b.m_idx && monster_b.ml) {
+ if (is_monster(grid_b.m_idx) && monster_b.ml) {
ap_r_ptr_b = &monster_b.get_appearance_monrace();
} else {
ap_r_ptr_b = nullptr;
#include "grid/feature.h"
#include "grid/grid.h"
#include "monster-race/monster-race.h"
+#include "monster/monster-util.h"
#include "object/object-info.h"
#include "object/object-mark-types.h"
#include "system/baseitem-info.h"
break;
}
- if (grid.m_idx && display_autopick != 0) {
+ if (is_monster(grid.m_idx) && display_autopick != 0) {
set_term_color(player_ptr, y, x, ap, cp);
return;
}
#include "monster-race/monster-race.h"
#include "monster/monster-describer.h"
#include "monster/monster-description-types.h"
+#include "monster/monster-util.h"
#include "object/item-tester-hooker.h"
#include "object/object-info.h"
#include "player-base/player-class.h"
*/
static const MonsterEntity *monster_on_floor_items(FloorType *floor_ptr, const Grid *g_ptr)
{
- if (g_ptr->m_idx == 0) {
+ if (!is_monster(g_ptr->m_idx)) {
return nullptr;
}
#include "monster-floor/monster-summon.h"
#include "monster/monster-describer.h"
#include "monster/monster-status.h"
+#include "monster/monster-util.h"
#include "mutation/mutation-processor.h"
#include "object/lite-processor.h"
#include "perception/simple-perception.h"
for (auto x = 0; x < floor_ptr->width; ++x) {
for (auto y = 0; y < floor_ptr->height; y++) {
auto *g_ptr = &floor_ptr->grid_array[y][x];
- if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != this->player_ptr->riding)) {
+ if (is_monster(g_ptr->m_idx) && (g_ptr->m_idx != this->player_ptr->riding)) {
number_mon++;
win_m_idx = g_ptr->m_idx;
}