ms_ptr->ability_flags &= RF_ABILITY_INT_MASK;
}
- if (ms_ptr->ability_flags.has(MonsterAbilityType::TELE_LEVEL) && is_teleport_level_ineffective(player_ptr, (ms_ptr->target_idx == player_ptr->riding) ? 0 : ms_ptr->target_idx)) {
+ const auto &floor = *player_ptr->current_floor_ptr;
+ if (ms_ptr->ability_flags.has(MonsterAbilityType::TELE_LEVEL) && floor.can_teleport_level((ms_ptr->target_idx != player_ptr->riding) ? ms_ptr->target_idx != 0 : false)) {
ms_ptr->ability_flags.reset(MonsterAbilityType::TELE_LEVEL);
}
}
msa_ptr->ability_flags &= RF_ABILITY_NOMAGIC_MASK;
}
-static void check_mspell_smart(PlayerType *player_ptr, msa_type *msa_ptr)
+static void check_mspell_smart(const FloorType &floor, msa_type *msa_ptr)
{
if (msa_ptr->r_ptr->behavior_flags.has_not(MonsterBehaviorType::SMART)) {
return;
msa_ptr->ability_flags &= RF_ABILITY_INT_MASK;
}
- if (msa_ptr->ability_flags.has(MonsterAbilityType::TELE_LEVEL) && is_teleport_level_ineffective(player_ptr, 0)) {
+ if (msa_ptr->ability_flags.has(MonsterAbilityType::TELE_LEVEL) && floor.can_teleport_level()) {
msa_ptr->ability_flags.reset(MonsterAbilityType::TELE_LEVEL);
}
}
set_no_magic_mask(msa_ptr);
decide_lite_area(player_ptr, msa_ptr);
check_mspell_stupid(player_ptr, msa_ptr);
- check_mspell_smart(player_ptr, msa_ptr);
+ check_mspell_smart(*player_ptr->current_floor_ptr, msa_ptr);
if (!check_mspell_continuation(player_ptr, msa_ptr)) {
return false;
}
#include <algorithm>
/*!
- * @brief テレポート・レベルが効かないモンスターであるかどうかを判定する
- * @param player_ptr プレイヤーへの参照ポインタ
- * @param idx テレポート・レベル対象のモンスター
- * @todo 変数名が実態と合っているかどうかは要確認
- */
-bool is_teleport_level_ineffective(PlayerType *player_ptr, MONSTER_IDX idx)
-{
- const auto &floor = *player_ptr->current_floor_ptr;
- auto is_special_floor = floor.inside_arena;
- is_special_floor |= AngbandSystem::get_instance().is_watching();
- is_special_floor |= floor.is_in_quest() && !inside_quest(floor.get_random_quest_id());
- auto is_invalid_floor = idx <= 0;
- is_invalid_floor &= inside_quest(floor.get_quest_id()) || (floor.dun_level >= floor.get_dungeon_definition().maxdepth);
- is_invalid_floor &= floor.dun_level >= 1;
- is_invalid_floor &= ironman_downward;
- return is_special_floor || is_invalid_floor;
-}
-
-/*!
* @brief プレイヤー及びモンスターをレベルテレポートさせる /
* Teleport the player one level up or down (random when legal)
* @param player_ptr プレイヤーへの参照ポインタ
see_m = is_seen(player_ptr, m_ptr);
}
- if (is_teleport_level_ineffective(player_ptr, m_idx)) {
+ if (floor.can_teleport_level(m_idx != 0)) {
if (see_m) {
msg_print(_("効果がなかった。", "There is no effect."));
}
bool teleport_level_other(PlayerType *player_ptr);
bool tele_town(PlayerType *player_ptr);
void reserve_alter_reality(PlayerType *player_ptr, TIME_EFFECT turns);
-bool is_teleport_level_ineffective(PlayerType *player_ptr, MONSTER_IDX idx);
bool recall_player(PlayerType *player_ptr, TIME_EFFECT turns);
bool free_level_recall(PlayerType *player_ptr);
bool reset_recall(PlayerType *player_ptr);
#include "system/floor-type-definition.h"
#include "dungeon/quest.h"
+#include "game-option/birth-options.h"
#include "system/angband-system.h"
#include "system/dungeon-info.h"
#include "system/grid-type-definition.h"
is_in_fixed_quest &= !inside_quest(this->get_random_quest_id());
return is_in_fixed_quest || this->inside_arena || AngbandSystem::get_instance().is_watching();
}
+
+/*!
+ * @brief テレポート・レベル無効フロアの判定
+ * @param to_player プレイヤーを対象としているか否か
+ * @return テレポート・レベルが不可能ならばtrue
+ */
+bool FloorType::can_teleport_level(bool to_player) const
+{
+ auto is_invalid_floor = to_player;
+ is_invalid_floor &= inside_quest(this->get_quest_id()) || (this->dun_level >= this->get_dungeon_definition().maxdepth);
+ is_invalid_floor &= this->dun_level >= 1;
+ is_invalid_floor &= ironman_downward;
+ return this->is_special() || is_invalid_floor;
+}
QuestId get_quest_id(const int bonus = 0) const;
bool has_los(const Pos2D pos) const;
bool is_special() const;
+ bool can_teleport_level(bool to_player = false) const;
};