/*!
+ * @file open-close-execution.cpp
* @brief 扉や箱を開ける処理
* @date 2020/07/11
* @author Hourier
#include "main/sound-definitions-table.h"
#include "main/sound-of-music.h"
#include "perception/object-perception.h"
+#include "player-status/player-energy.h"
#include "player/player-status-table.h"
#include "specific-object/chest.h"
#include "status/bad-status-setter.h"
#include "status/experience.h"
#include "system/floor-type-definition.h"
#include "system/object-type-definition.h"
+#include "system/player-type-definition.h"
#include "term/screen-processor.h"
#include "util/bit-flags-calculator.h"
#include "view/display-messages.h"
{
grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
feature_type *f_ptr = &f_info[g_ptr->feat];
- take_turn(creature_ptr, 100);
+ PlayerEnergy(creature_ptr).set_player_turn_energy(100);
if (!has_flag(f_ptr->flags, FF_OPEN)) {
- msg_format(_("%sはがっちりと閉じられているようだ。", "The %s appears to be stuck."), f_name + f_info[get_feat_mimic(g_ptr)].name);
+ msg_format(_("%sはがっちりと閉じられているようだ。", "The %s appears to be stuck."), f_info[get_feat_mimic(g_ptr)].name.c_str());
return FALSE;
}
return FALSE;
}
-/*
- * todo 常にFALSEを返している
+/*!
* @brief 「閉じる」動作コマンドのサブルーチン /
* Perform the basic "close" command
* @param y 対象を行うマスのY座標
* Assume destination is an open/broken door
* Assume there is no monster blocking the destination
* Returns TRUE if repeated commands may continue
+ * @todo 常にFALSEを返している
*/
bool exe_close(player_type *creature_ptr, POSITION y, POSITION x)
{
grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
FEAT_IDX old_feat = g_ptr->feat;
bool more = FALSE;
- take_turn(creature_ptr, 100);
+ PlayerEnergy(creature_ptr).set_player_turn_energy(100);
if (!has_flag(f_info[old_feat].flags, FF_CLOSE))
return more;
- s16b closed_feat = feat_state(creature_ptr, old_feat, FF_CLOSE);
+ s16b closed_feat = feat_state(creature_ptr->current_floor_ptr, old_feat, FF_CLOSE);
if ((g_ptr->o_idx || (g_ptr->info & CAVE_OBJECT)) && (closed_feat != old_feat) && !has_flag(f_info[closed_feat].flags, FF_DROP)) {
msg_print(_("何かがつっかえて閉まらない。", "Something prevents it from closing."));
} else {
return FALSE;
if (!has_flag(f_ptr->flags, FF_OPEN)) {
- msg_format(_("%sはがっちりと閉じられているようだ。", "The %s appears to be stuck."), f_name + f_info[get_feat_mimic(g_ptr)].name);
+ msg_format(_("%sはがっちりと閉じられているようだ。", "The %s appears to be stuck."), f_info[get_feat_mimic(g_ptr)].name.c_str());
} else if (f_ptr->power) {
i = creature_ptr->skill_dis;
if (creature_ptr->blind || no_lite(creature_ptr))
{
bool more = FALSE;
object_type *o_ptr = &creature_ptr->current_floor_ptr->o_list[o_idx];
- take_turn(creature_ptr, 100);
+ PlayerEnergy(creature_ptr).set_player_turn_energy(100);
int i = creature_ptr->skill_dis;
if (creature_ptr->blind || no_lite(creature_ptr))
i = i / 10;
{
grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
feature_type *f_ptr = &f_info[g_ptr->feat];
- concptr name = (f_name + f_ptr->name);
+ concptr name = f_ptr->name.c_str();
int power = f_ptr->power;
bool more = FALSE;
int i = creature_ptr->skill_dis;
- take_turn(creature_ptr, 100);
+ PlayerEnergy(creature_ptr).set_player_turn_energy(100);
if (creature_ptr->blind || no_lite(creature_ptr))
i = i / 10;
int bash = adj_str_blow[creature_ptr->stat_index[A_STR]];
int temp = f_ptr->power;
bool more = FALSE;
- concptr name = f_name + f_info[get_feat_mimic(g_ptr)].name;
- take_turn(creature_ptr, 100);
+ concptr name = f_info[get_feat_mimic(g_ptr)].name.c_str();
+ PlayerEnergy(creature_ptr).set_player_turn_energy(100);
msg_format(_("%sに体当たりをした!", "You smash into the %s!"), name);
temp = (bash - (temp * 10));
if (creature_ptr->pclass == CLASS_BERSERKER)
if (randint0(100) < temp) {
msg_format(_("%sを壊した!", "The %s crashes open!"), name);
sound(has_flag(f_ptr->flags, FF_GLASS) ? SOUND_GLASS : SOUND_OPENDOOR);
- if ((randint0(100) < 50) || (feat_state(creature_ptr, g_ptr->feat, FF_OPEN) == g_ptr->feat) || has_flag(f_ptr->flags, FF_GLASS)) {
+ if ((randint0(100) < 50) || (feat_state(creature_ptr->current_floor_ptr, g_ptr->feat, FF_OPEN) == g_ptr->feat) || has_flag(f_ptr->flags, FF_GLASS)) {
cave_alter_feat(creature_ptr, y, x, FF_BASH);
} else {
cave_alter_feat(creature_ptr, y, x, FF_OPEN);
}
return more;
-}
\ No newline at end of file
+}