return;
}
+ constexpr auto prompt = _("いくつ付加しますか?", "Enchant how many?");
const auto attribute_flags = Smith::get_effect_tr_flags(effect);
auto add_essence_count = 1;
if (attribute_flags.has_any_of(TR_PVAL_FLAG_MASK)) {
}
o_ptr->pval = 1;
} else if (o_ptr->pval == 0) {
- char tmp_val[8] = "1";
- auto limit = std::min(5, smith.get_addable_count(effect, o_ptr));
-
- if (!get_string(format(_("いくつ付加しますか? (1-%d): ", "Enchant how many? (1-%d): "), limit), tmp_val, 1)) {
+ const auto limit = std::min(5, smith.get_addable_count(effect, o_ptr));
+ const auto num_enchants = input_value<short>(prompt, 1, limit, 1);
+ if (!num_enchants.has_value()) {
return;
}
- o_ptr->pval = static_cast<PARAMETER_VALUE>(std::clamp(atoi(tmp_val), 1, limit));
+
+ o_ptr->pval = num_enchants.value();
}
add_essence_count = o_ptr->pval;
} else if (effect == SmithEffectType::SLAY_GLOVE) {
- char tmp_val[8] = "1";
const auto max_val = player_ptr->lev / 7 + 3;
- if (!get_string(format(_("いくつ付加しますか? (1-%d):", "Enchant how many? (1-%d):"), max_val), tmp_val, 2)) {
+ const auto num_enchants = input_value(prompt, 1, max_val, 1);
+ if (!num_enchants.has_value()) {
return;
}
- add_essence_count = std::clamp(atoi(tmp_val), 1, max_val);
+
+ add_essence_count = num_enchants.value();
}
msg_format(_("エッセンスを%d個使用します。", "It will take %d essences."), use_essence * add_essence_count);