}
}
+static std::string build_timeout_description(const activation_type &act, const ItemEntity &item)
+{
+ const auto constant = act.timeout.constant;
+ const auto dice = act.timeout.dice;
+ if (constant == 0 && dice == 0) {
+ return _("いつでも", "every turn");
+ }
+
+ if (constant >= 0) {
+ std::stringstream ss;
+ ss << _("", "every ");
+ if (constant > 0) {
+ ss << constant;
+ if (dice > 0) {
+ ss << '+';
+ }
+ }
+
+ if (dice > 0) {
+ ss << 'd' << dice;
+ }
+
+ ss << _(" ターン毎", " turns");
+ return ss.str();
+ }
+
+ std::stringstream ss;
+ switch (act.index) {
+ case RandomArtActType::BR_FIRE:
+ ss << _("", "every ") << (item.bi_key == BaseitemKey(ItemKindType::RING, SV_RING_FLAMES) ? 200 : 250) << _(" ターン毎", " turns");
+ return ss.str();
+ case RandomArtActType::BR_COLD:
+ ss << _("", "every ") << (item.bi_key == BaseitemKey(ItemKindType::RING, SV_RING_ICE) ? 200 : 250) << _(" ターン毎", " turns");
+ return ss.str();
+ case RandomArtActType::TERROR:
+ return _("3*(レベル+10) ターン毎", "every 3 * (level+10) turns");
+ case RandomArtActType::MURAMASA:
+ return _("確率50%で壊れる", "(destroyed 50%)");
+ default:
+ return "undefined";
+ }
+}
+
/*!
* @brief オブジェクトの発動効果名称を返す(サブルーチン/汎用)
* @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
}
const auto desc = build_activation_description(*it, *o_ptr);
-
- /* Timeout description */
- std::stringstream timeout;
- const auto constant = it->timeout.constant;
- const auto dice = it->timeout.dice;
- if (constant == 0 && dice == 0) {
- /* We can activate it every turn */
- timeout << _("いつでも", "every turn");
- } else if (constant < 0) {
- /* Activations that have special timeout */
- switch (it->index) {
- case RandomArtActType::BR_FIRE:
- timeout << _("", "every ") << (o_ptr->bi_key == BaseitemKey(ItemKindType::RING, SV_RING_FLAMES) ? 200 : 250) << _(" ターン毎", " turns");
- break;
- case RandomArtActType::BR_COLD:
- timeout << _("", "every ") << (o_ptr->bi_key == BaseitemKey(ItemKindType::RING, SV_RING_ICE) ? 200 : 250) << _(" ターン毎", " turns");
- break;
- case RandomArtActType::TERROR:
- timeout << _("3*(レベル+10) ターン毎", "every 3 * (level+10) turns");
- break;
- case RandomArtActType::MURAMASA:
- timeout << _("確率50%で壊れる", "(destroyed 50%)");
- break;
- default:
- timeout << "undefined";
- break;
- }
- } else {
- timeout << _("", "every ");
- if (constant > 0) {
- timeout << constant;
- if (dice > 0) {
- timeout << '+';
- }
- }
- if (dice > 0) {
- timeout << 'd' << dice;
- }
- timeout << _(" ターン毎", " turns");
- }
-
+ const auto timeout = build_timeout_description(*it, *o_ptr);
std::stringstream ss;
- ss << desc << _(" : ", " ") << timeout.str();
+ ss << desc << _(" : ", " ") << timeout;
return ss.str();
}