-/*!
+/*!
* @brief テレポート魔法全般
* @date 2020/06/04
* @author Hourier
#include "avatar/avatar.h"
#include "core/asking-player.h"
#include "core/speed-table.h"
+#include "dungeon/quest.h"
#include "effect/attribute-types.h"
#include "effect/effect-characteristics.h"
#include "floor/cave.h"
#include "monster-race/monster-race.h"
#include "monster-race/race-brightness-mask.h"
#include "monster-race/race-flags-resistance.h"
-#include "monster-race/race-flags7.h"
#include "monster/monster-info.h"
#include "monster/monster-status-setter.h"
#include "monster/monster-status.h"
#include "monster/monster-update.h"
#include "mutation/mutation-flag-types.h"
#include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
#include "player-base/player-class.h"
#include "player/player-move.h"
#include "player/player-status.h"
#include "spell-kind/spells-launcher.h"
+#include "system/angband-system.h"
#include "system/floor-type-definition.h"
#include "system/grid-type-definition.h"
#include "system/item-entity.h"
return false;
}
- grid_type *g_ptr;
+ 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 (!g_ptr->has_monster() || (g_ptr->m_idx == player_ptr->riding)) {
msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
return false;
}
MonsterEntity *m_ptr;
MonsterRaceInfo *r_ptr;
m_ptr = &player_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
- r_ptr = &monraces_info[m_ptr->r_idx];
+ r_ptr = &m_ptr->get_monrace();
(void)set_monster_csleep(player_ptr, g_ptr->m_idx, 0);
if (!cave_monster_teleportable_bold(player_ptr, m_idx, ny, nx, mode)) {
continue;
}
- if (!(inside_quest(player_ptr->current_floor_ptr->quest_number) || player_ptr->current_floor_ptr->inside_arena)) {
+ if (!(player_ptr->current_floor_ptr->is_in_quest() || player_ptr->current_floor_ptr->inside_arena)) {
if (player_ptr->current_floor_ptr->grid_array[ny][nx].is_icky()) {
continue;
}
lite_spot(player_ptr, oy, ox);
lite_spot(player_ptr, ny, nx);
- if (monraces_info[m_ptr->r_idx].brightness_flags.has_any_of(ld_mask)) {
- RedrawingFlagsUpdater::get_instance().set_flag(StatusRedrawingFlag::MONSTER_LITE);
+ if (m_ptr->get_monrace().brightness_flags.has_any_of(ld_mask)) {
+ RedrawingFlagsUpdater::get_instance().set_flag(StatusRecalculatingFlag::MONSTER_LITE);
}
return true;
lite_spot(player_ptr, oy, ox);
lite_spot(player_ptr, ny, nx);
- if (monraces_info[m_ptr->r_idx].brightness_flags.has_any_of(ld_mask)) {
- RedrawingFlagsUpdater::get_instance().set_flag(StatusRedrawingFlag::MONSTER_LITE);
+ if (m_ptr->get_monrace().brightness_flags.has_any_of(ld_mask)) {
+ RedrawingFlagsUpdater::get_instance().set_flag(StatusRecalculatingFlag::MONSTER_LITE);
}
}
auto pick = randint1(cur_candidates);
/* Search again the choosen location */
- auto yy = top;
- auto xx = 0;
- for (; yy <= bottom; yy++) {
- for (xx = left; xx <= right; xx++) {
- if (!cave_player_teleportable_bold(player_ptr, yy, xx, mode)) {
+ auto y = top;
+ auto x = 0;
+ for (; y <= bottom; y++) {
+ for (x = left; x <= right; x++) {
+ if (!cave_player_teleportable_bold(player_ptr, y, x, mode)) {
continue;
}
- int d = distance(player_ptr->y, player_ptr->x, yy, xx);
+ int d = distance(player_ptr->y, player_ptr->x, y, x);
if (d > dis) {
continue;
}
}
}
- if (player_bold(player_ptr, yy, xx)) {
+ const Pos2D pos(y, x);
+ if (player_ptr->is_located_at(pos)) {
return false;
}
msg_format("『こっちだぁ、%s』", player_ptr->name);
}
#endif
- (void)move_player_effect(player_ptr, yy, xx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
+ (void)move_player_effect(player_ptr, pos.y, pos.x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
return true;
}
MONSTER_IDX tmp_m_idx = player_ptr->current_floor_ptr->grid_array[oy + yy][ox + xx].m_idx;
if (tmp_m_idx && (player_ptr->riding != tmp_m_idx)) {
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[tmp_m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
bool can_follow = r_ptr->ability_flags.has(MonsterAbilityType::TPORT);
can_follow &= r_ptr->resistance_flags.has_not(MonsterResistanceType::RESIST_TELEPORT);
*/
void teleport_player_away(MONSTER_IDX m_idx, PlayerType *player_ptr, POSITION dis, bool is_quantum_effect)
{
- if (player_ptr->phase_out) {
+ if (AngbandSystem::get_instance().is_phase_out()) {
return;
}
}
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[tmp_m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
bool can_follow = r_ptr->ability_flags.has(MonsterAbilityType::TPORT);
can_follow &= r_ptr->resistance_flags.has_not(MonsterResistanceType::RESIST_TELEPORT);
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 &= player_ptr->current_floor_ptr->grid_array[y][x].has_monster() || player_ptr->current_floor_ptr->grid_array[y][x].m_idx == player_ptr->riding;
if (is_anywhere) {
break;
}
bool is_followable = old_ml;
is_followable &= old_cdis <= MAX_PLAYER_SIGHT;
is_followable &= w_ptr->timewalk_m_idx == 0;
- is_followable &= !player_ptr->phase_out;
+ is_followable &= !AngbandSystem::get_instance().is_phase_out();
is_followable &= los(player_ptr, player_ptr->y, player_ptr->x, oldfy, oldfx);
if (!is_followable) {
return;
for (i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
o_ptr = &player_ptr->inventory_list[i];
- if (o_ptr->is_valid() && !o_ptr->is_cursed()) {
- auto flags = object_flags(o_ptr);
- if (flags.has(TR_TELEPORT)) {
- follow = true;
- break;
- }
+ if (o_ptr->is_valid() && !o_ptr->is_cursed() && o_ptr->get_flags().has(TR_TELEPORT)) {
+ follow = true;
+ break;
}
}
}
if (!follow) {
return;
}
- if (!get_check_strict(player_ptr, _("ついていきますか?", "Do you follow it? "), CHECK_OKAY_CANCEL)) {
+ if (!input_check_strict(player_ptr, _("ついていきますか?", "Do you follow it? "), UserCheck::OKAY_CANCEL)) {
return;
}