}
/* Hack -- decline "teleport level" in some case */
- if ((f6 & RF6_TELE_LEVEL) && TELE_LEVEL_IS_INEFF(0))
+ if ((f6 & RF6_TELE_LEVEL) && is_teleport_level_ineffective(target_ptr, 0))
{
f6 &= ~(RF6_TELE_LEVEL);
}
}
/* Hack -- decline "teleport level" in some case */
- if ((f6 & RF6_TELE_LEVEL) && TELE_LEVEL_IS_INEFF((target_idx == target_ptr->riding) ? 0 : target_idx))
+ if ((f6 & RF6_TELE_LEVEL) && is_teleport_level_ineffective(target_ptr, (target_idx == target_ptr->riding) ? 0 : target_idx))
{
f6 &= ~(RF6_TELE_LEVEL);
}
/*!
* @brief 選択アルファベットラベルからプレイヤーの装備オブジェクトIDを返す /
+ * @param player_ptr プレーヤーへの参照ポインタ
* Convert a label into the index of a item in the "equip"
* @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
*/
extern void blood_curse_to_enemy(player_type *caster_ptr, MONSTER_IDX m_idx);
extern bool fire_crimson(player_type *shooter_ptr);
extern bool tele_town(player_type *caster_ptr);
+extern bool is_teleport_level_ineffective(player_type *caster_ptr, MONSTER_IDX idx);
extern int project_length;
-
-/* Is "teleport level" ineffective to this target? */
-#define TELE_LEVEL_IS_INEFF(TARGET) \
- (p_ptr->current_floor_ptr->inside_arena || p_ptr->phase_out || \
- (p_ptr->current_floor_ptr->inside_quest && !random_quest_number(p_ptr->current_floor_ptr->dun_level)) || \
- (((TARGET) <= 0) && (quest_number(p_ptr->current_floor_ptr->dun_level) || (p_ptr->current_floor_ptr->dun_level >= d_info[p_ptr->dungeon_idx].maxdepth)) && \
- (p_ptr->current_floor_ptr->dun_level >= 1) && ironman_downward))
}
/* No effect in some case */
- if (TELE_LEVEL_IS_INEFF(m_idx))
+ if (is_teleport_level_ineffective(creature_ptr, m_idx))
{
if (see_m) msg_print(_("効果がなかった。", "There is no effect."));
return;
}
+/*!
+* todo 変数名が実態と合っているかどうかは要確認
+* テレポート・レベルが効かないモンスターであるかどうかを判定する
+* @param caster_ptr プレーヤーへの参照ポインタ
+* @param idx テレポート・レベル対象のモンスター
+*/
+bool is_teleport_level_ineffective(player_type *caster_ptr, MONSTER_IDX idx)
+{
+ floor_type *floor_ptr = caster_ptr->current_floor_ptr;
+ bool is_special_floor = floor_ptr->inside_arena || caster_ptr->phase_out ||
+ (floor_ptr->inside_quest && !random_quest_number(floor_ptr->dun_level));
+ bool is_invalid_floor = idx <= 0;
+ is_invalid_floor &= quest_number(floor_ptr->dun_level) || (floor_ptr->dun_level >= d_info[caster_ptr->dungeon_idx].maxdepth);
+ is_invalid_floor &= caster_ptr->current_floor_ptr->dun_level >= 1;
+ is_invalid_floor &= ironman_downward;
+ return is_special_floor || is_invalid_floor;
+}
+
+
static bool update_player(player_type *caster_ptr)
{
caster_ptr->update |= PU_COMBINE | PU_REORDER;