#include "util/bit-flags-calculator.h"
#include "view/display-messages.h"
#include "world/world.h"
-#include <algorithm>
#include <optional>
#include <string>
{
auto *floor_ptr = this->player_ptr->current_floor_ptr;
auto *m_ptr = &floor_ptr->m_list[this->m_idx];
- const auto &r_ref = m_ptr->get_real_r_ref();
if (!note.empty()) {
msg_format("%s^%s", m_name.data(), note.data());
return;
return;
}
- const auto explode = std::any_of(std::begin(r_ref.blow), std::end(r_ref.blow),
- [](const auto &blow) { return blow.method == RaceBlowMethodType::EXPLODE; });
-
+ const auto is_explodable = m_ptr->is_explodable();
+ const auto died_mes = m_ptr->get_died_message();
if (m_ptr->has_living_flag()) {
- if (explode) {
- msg_format(_("%sは爆発して死んだ。", "%s^ explodes and dies."), m_name.data());
+ if (is_explodable) {
+ this->show_explosion_message(died_mes, m_name);
return;
}
return;
}
- if (explode) {
- msg_format(_("%sは爆発して粉々になった。", "%s^ explodes into tiny shreds."), m_name.data());
+ if (is_explodable) {
+ this->show_explosion_message(died_mes, m_name);
return;
}
msg_format(mes, m_name.data());
}
+void MonsterDamageProcessor::show_explosion_message(std::string_view died_mes, std::string_view m_name)
+{
+ std::stringstream ss;
+ ss << _(m_name, format("%s^", m_name.data()));
+ ss << died_mes;
+ msg_print(ss.str());
+ return;
+}
+
void MonsterDamageProcessor::show_bounty_message(std::string_view m_name)
{
auto *floor_ptr = this->player_ptr->current_floor_ptr;
void death_amberites(std::string_view m_name);
void dying_scream(std::string_view m_name);
void show_kill_message(std::string_view note, std::string_view m_name);
+ void show_explosion_message(std::string_view died_mes, std::string_view m_name);
void show_bounty_message(std::string_view m_name);
void set_redraw();
void summon_special_unique();
return monrace.has_living_flag();
}
+bool MonsterEntity::is_explodable() const
+{
+ const auto &monrace = monraces_info[this->r_idx];
+ return monrace.is_explodable();
+}
+
std::string MonsterEntity::get_died_message() const
{
const auto &monrace = monraces_info[this->r_idx];
bool is_invulnerable() const;
byte get_temporary_speed() const;
bool has_living_flag(bool is_apperance = false) const;
+ bool is_explodable() const;
std::string get_died_message() const;
};
#include "system/monster-race-info.h"
#include "monster/horror-descriptions.h"
+#include <algorithm>
/*!
* @brief エルドリッチホラーの形容詞種別を決める
return this->kind_flags.has_none_of({ MonsterKindType::DEMON, MonsterKindType::UNDEAD, MonsterKindType::NONLIVING });
}
+bool MonsterRaceInfo::is_explodable() const
+{
+ return std::any_of(std::begin(this->blow), std::end(this->blow),
+ [](const auto &blow) { return blow.method == RaceBlowMethodType::EXPLODE; });
+}
+
/*!
* @brief モンスターを撃破した際の述語メッセージを返す
* @return 撃破されたモンスターの述語
*/
std::string MonsterRaceInfo::get_died_message() const
{
- const auto is_explodable = std::any_of(std::begin(this->blow), std::end(this->blow),
- [](const auto &blow) { return blow.method == RaceBlowMethodType::EXPLODE; });
+ const auto is_explodable = this->is_explodable();
if (this->has_living_flag()) {
return is_explodable ? _("は爆発して死んだ。", " explodes and dies.") : _("は死んだ。", " dies.");
}
const std::string &decide_horror_message() const;
bool has_living_flag() const;
+ bool is_explodable() const;
std::string get_died_message() const;
};