#include "object-hook.h"
#include "projection.h"
#include "spells-summon.h"
+#include "spells-status.h"
#include "monster-status.h"
#include "quest.h"
#include "artifact.h"
#include "avatar.h"
#include "player-status.h"
+#include "realm-hex.h"
/*!
* @brief フロア脱出時に出戻りが不可能だった場合に警告を加える処理
}
/*!
+ * @brief 魔法系コマンドが制限されているかを返す。
+ * @return 魔法系コマンドを使用可能ならFALSE、不可能ならば理由をメッセージ表示してTRUEを返す。
+ */
+bool cmd_limit_cast(player_type *creature_ptr)
+{
+ if (dun_level && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC))
+ {
+ msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
+ msg_print(NULL);
+ return TRUE;
+ }
+ else if (creature_ptr->anti_magic)
+ {
+ msg_print(_("反魔法バリアが魔法を邪魔した!", "An anti-magic shell disrupts your magic!"));
+ return TRUE;
+ }
+ else if (creature_ptr->shero)
+ {
+ msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+bool cmd_limit_confused(player_type *creature_ptr)
+{
+ if (creature_ptr->confused)
+ {
+ msg_print(_("混乱していてできない!", "You are too confused!"));
+ return TRUE;
+ }
+ return FALSE;
+}
+
+bool cmd_limit_arena(player_type *creature_ptr)
+{
+ if (creature_ptr->inside_arena)
+ {
+ msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
+ msg_print(NULL);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+bool cmd_limit_time_walk(player_type *creature_ptr)
+{
+ if (world_player)
+ {
+ if (flush_failure) flush();
+ msg_print(_("止まった時の中ではうまく働かないようだ。", "It shows no reaction."));
+ sound(SOUND_FAIL);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*!
* @brief 階段を使って階層を昇る処理 / Go up one level
* @return なし
*/
p_ptr->oldpx = 0;
p_ptr->oldpy = 0;
- /* Hack -- take a turn */
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);
/* End the command */
return;
/* Cancel the command */
if (!go_up) return;
- /* Hack -- take a turn */
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);
if (autosave_l) do_cmd_save_game(TRUE);
/* Leaving */
p_ptr->leaving = TRUE;
-
p_ptr->oldpx = 0;
p_ptr->oldpy = 0;
-
- /* Hack -- take a turn */
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);
}
else
prepare_change_floor_mode(CFM_FIRST_FLOOR);
}
- /* Hack -- take a turn */
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);
if (autosave_l) do_cmd_save_game(TRUE);
/* Cancel the arg */
command_arg = 0;
}
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);;
/* Search */
search();
bool more = FALSE;
object_type *o_ptr = &o_list[o_idx];
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);;
/* Attempt to unlock it */
if (o_ptr->pval > 0)
}
/*!
- * @brief 地形は開くものであって、かつ開かれているかを返す /
- * Attempt to open the given chest at the given location
- * @param feat 地形ID
- * @return 開いた地形である場合TRUEを返す / Return TRUE if the given feature is an open door
- */
-static bool is_open(IDX feat)
-{
- return have_flag(f_info[feat].flags, FF_CLOSE) && (feat != feat_state(feat, FF_CLOSE));
-}
-
-
-/*!
* @brief プレイヤーの周辺9マスに該当する地形がいくつあるかを返す /
* Attempt to open the given chest at the given location
* @param y 該当する地形の中から1つのY座標を返す参照ポインタ
feature_type *f_ptr = &f_info[c_ptr->feat];
bool more = FALSE;
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);;
/* Seeing true feature code (ignore mimic) */
/* Monster in the way */
else if (c_ptr->m_idx && p_ptr->riding != c_ptr->m_idx)
{
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);;
msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
py_attack(y, x, 0);
}
FEAT_IDX old_feat = c_ptr->feat;
bool more = FALSE;
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);;
/* Seeing true feature code (ignore mimic) */
/* Monster in the way */
else if (c_ptr->m_idx)
{
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);;
msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
/* Verify legality */
if (!do_cmd_tunnel_test(y, x)) return (FALSE);
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);;
/* Get grid */
c_ptr = &cave[y][x];
/* A monster is in the way */
else if (c_ptr->m_idx)
{
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);;
msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
bool more = FALSE;
object_type *o_ptr = &o_list[o_idx];
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);;
/* Get the "disarm" factor */
i = p_ptr->skill_dis;
int i = p_ptr->skill_dis;
int j;
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);;
/* Penalize some conditions */
if (p_ptr->blind || no_lite()) i = i / 10;
concptr name = f_name + f_info[get_feat_mimic(c_ptr)].name;
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);;
msg_format(_("%sに体当たりをした!", "You smash into the %s!"), name);
/* Monster in the way */
else if (c_ptr->m_idx)
{
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);;
msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
feat = get_feat_mimic(c_ptr);
f_ptr = &f_info[feat];
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);;
if (c_ptr->m_idx)
{
/* Is a monster in the way? */
else if (c_ptr->m_idx)
{
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);;
msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
/* Go for it */
else
{
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);;
/* Successful jamming */
msg_format(_("%sにくさびを打ち込んだ。", "You jam the %s with a spike."), f_name + f_info[feat].name);
/* Get a "repeated" direction */
if (get_rep_dir(&dir, FALSE))
{
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);;
if ((dir != 5) && (p_ptr->special_defense & KATA_MUSOU))
{
change_wild_mode();
/* Give first move to monsters */
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);;
/* HACk -- set the encouter flag for the wilderness generation */
generate_encounter = TRUE;
void do_cmd_run(void)
{
DIRECTION dir;
-
- /* Hack -- no running when confused */
- if (p_ptr->confused)
- {
- msg_print(_("混乱していて走れない!", "You are too confused!"));
- return;
- }
+ if (cmd_limit_confused(p_ptr)) return;
if (p_ptr->special_defense & KATA_MUSOU)
{
command_arg = 0;
}
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);;
if (pickup) mpe_mode |= MPE_DO_PICKUP;
(void)move_player_effect(p_ptr->y, p_ptr->x, mpe_mode);
if (p_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(FALSE);
/* Take a turn (?) */
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);;
/* The sin of sloth */
if (command_arg > 100) chg_virtue(V_DILIGENCE, -1);
p_ptr->redraw |= (PR_EQUIPPY);
}
- p_ptr->energy_use = 100;
+ take_turn(p_ptr, 100);;
/* Rogue and Ninja gets bonus */
if ((p_ptr->pclass == CLASS_ROGUE) || (p_ptr->pclass == CLASS_NINJA))
if (shuriken) chance *= 2;
- /* Save the old location */
prev_y = y;
prev_x = x;
Term_xtra(TERM_XTRA_DELAY, msec);
}
- /* Save the old location */
prev_y = y;
prev_x = x;