static void decide_activation_level(ae_type *ae_ptr)
{
if (ae_ptr->o_ptr->is_fixed_artifact()) {
- ae_ptr->lev = artifacts_info.at(ae_ptr->o_ptr->fixed_artifact_idx).level;
+ ae_ptr->lev = ArtifactsInfo::get_instance().get_artifact(ae_ptr->o_ptr->fixed_artifact_idx).level;
return;
}
}
if (o_ptr->is_fixed_artifact()) {
- const auto &fixed_artifact = artifacts_info.at(o_ptr->fixed_artifact_idx);
+ const auto &fixed_artifact = ArtifactsInfo::get_instance().get_artifact(o_ptr->fixed_artifact_idx);
if (fixed_artifact.flags.has(TR_ACTIVATE)) {
return fixed_artifact.act_idx;
}
*/
void apply_artifact(PlayerType *player_ptr, ItemEntity *o_ptr)
{
- auto &a_ref = artifacts_info.at(o_ptr->fixed_artifact_idx);
- o_ptr->pval = a_ref.pval;
- o_ptr->ac = a_ref.ac;
- o_ptr->dd = a_ref.dd;
- o_ptr->ds = a_ref.ds;
- o_ptr->to_a = a_ref.to_a;
- o_ptr->to_h = a_ref.to_h;
- o_ptr->to_d = a_ref.to_d;
- o_ptr->weight = a_ref.weight;
- o_ptr->activation_id = a_ref.act_idx;
-
- invest_curse_to_fixed_artifact(a_ref, o_ptr);
- fixed_artifact_random_abilities(player_ptr, a_ref, o_ptr);
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(o_ptr->fixed_artifact_idx);
+ o_ptr->pval = artifact.pval;
+ o_ptr->ac = artifact.ac;
+ o_ptr->dd = artifact.dd;
+ o_ptr->ds = artifact.ds;
+ o_ptr->to_a = artifact.to_a;
+ o_ptr->to_h = artifact.to_h;
+ o_ptr->to_d = artifact.to_d;
+ o_ptr->weight = artifact.weight;
+ o_ptr->activation_id = artifact.act_idx;
+
+ invest_curse_to_fixed_artifact(artifact, o_ptr);
+ fixed_artifact_random_abilities(player_ptr, artifact, o_ptr);
}
/*!
*/
bool create_named_art(PlayerType *player_ptr, FixedArtifactId a_idx, POSITION y, POSITION x)
{
- auto &a_ref = artifacts_info.at(a_idx);
- if (a_ref.name.empty()) {
+ auto &artifact = ArtifactsInfo::get_instance().get_artifact(a_idx);
+ if (artifact.name.empty()) {
return false;
}
- auto bi_id = lookup_baseitem_id(a_ref.bi_key);
+ auto bi_id = lookup_baseitem_id(artifact.bi_key);
if (bi_id == 0) {
return true;
}
return false;
}
- a_ref.is_generated = true;
+ artifact.is_generated = true;
return true;
}
if (!o_idx) {
msg_format(_("%sはどこかへ行った。", "The %s went somewhere."), item_name.data());
if (q_ptr->is_fixed_artifact()) {
- artifacts_info.at(j_ptr->fixed_artifact_idx).is_generated = false;
+ ArtifactsInfo::get_instance().get_artifact(j_ptr->fixed_artifact_idx).is_generated = false;
}
return;
}
quest_list[QuestId::TOWER1].complev = player_ptr->lev;
break;
case QuestKindType::FIND_ARTIFACT:
- artifacts_info.at(q_ptr->reward_artifact_idx).gen_flags.reset(ItemGenerationTraitType::QUESTITEM);
+ ArtifactsInfo::get_instance().get_artifact(q_ptr->reward_artifact_idx).gen_flags.reset(ItemGenerationTraitType::QUESTITEM);
break;
case QuestKindType::RANDOM:
monraces_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
flags.reset(baseitem.flags);
if (item.is_fixed_artifact()) {
- const auto &a_ref = artifacts_info.at(item.fixed_artifact_idx);
- flags.reset(a_ref.flags);
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(item.fixed_artifact_idx);
+ flags.reset(artifact.flags);
}
if (item.is_ego()) {
const auto fixed_art_id = item.fixed_artifact_idx;
const auto is_known_artifact = opt.known && item.is_fixed_artifact() && none_bits(opt.mode, OD_BASE_NAME);
- return is_known_artifact ? artifacts_info.at(fixed_art_id).name : baseitems_info[item.bi_id].name;
+ return is_known_artifact ? ArtifactsInfo::get_instance().get_artifact(fixed_art_id).name : baseitems_info[item.bi_id].name;
}
#ifdef JP
}
if (item.is_fixed_artifact() && object_flags(&item).has_not(TR_FULL_NAME)) {
- const auto &a_ref = artifacts_info.at(item.fixed_artifact_idx);
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(item.fixed_artifact_idx);
/* '『' から始まらない伝説のアイテムの名前は最初に付加する */
- if (a_ref.name.find("『", 0, 2) != 0) {
- return a_ref.name;
+ if (artifact.name.find("『", 0, 2) != 0) {
+ return artifact.name;
}
return "";
}
if (item.is_fixed_artifact()) {
- const auto &artifact = artifacts_info.at(item.fixed_artifact_idx);
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(item.fixed_artifact_idx);
if (artifact.name.find("『", 0, 2) == 0) {
return artifact.name;
}
}
if (item.is_fixed_artifact()) {
- const auto &artifact = artifacts_info.at(item.fixed_artifact_idx);
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(item.fixed_artifact_idx);
ss << ' ' << artifact.name;
return ss.str();
}
g_ptr->o_idx_list.add(floor_ptr, o_idx);
}
-static void generate_artifact(PlayerType *player_ptr, qtwg_type *qtwg_ptr, const FixedArtifactId artifact_index)
+static void generate_artifact(PlayerType *player_ptr, qtwg_type *qtwg_ptr, const FixedArtifactId a_idx)
{
- if (artifact_index == FixedArtifactId::NONE) {
+ if (a_idx == FixedArtifactId::NONE) {
return;
}
- auto &fixed_artifact = artifacts_info.at(artifact_index);
- if (!fixed_artifact.is_generated && create_named_art(player_ptr, artifact_index, *qtwg_ptr->y, *qtwg_ptr->x)) {
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(a_idx);
+ if (!artifact.is_generated && create_named_art(player_ptr, a_idx, *qtwg_ptr->y, *qtwg_ptr->x)) {
return;
}
return true;
}
- auto &artifact = artifacts_info.at(q_ptr->reward_artifact_idx);
+ auto &artifact = ArtifactsInfo::get_instance().get_artifact(q_ptr->reward_artifact_idx);
artifact.gen_flags.set(ItemGenerationTraitType::QUESTITEM);
return true;
}
int count = 0;
FixedArtifactId reward_idx = FixedArtifactId::NONE;
+ const auto &artifacts = ArtifactsInfo::get_instance();
for (auto idx = 2; idx < num; idx++) {
const auto a_idx = i2enum<FixedArtifactId>(atoi(zz[idx]));
if (a_idx == FixedArtifactId::NONE) {
continue;
}
- if (artifacts_info.at(a_idx).is_generated) {
+ if (artifacts.get_artifact(a_idx).is_generated) {
continue;
}
if (reward_idx != FixedArtifactId::NONE) {
q_ptr->reward_artifact_idx = reward_idx;
- artifacts_info.at(reward_idx).gen_flags.set(ItemGenerationTraitType::QUESTITEM);
+ artifacts.get_artifact(reward_idx).gen_flags.set(ItemGenerationTraitType::QUESTITEM);
} else {
q_ptr->type = QuestKindType::KILL_ALL;
}
}
if (o_ref.is_fixed_artifact()) {
- artifacts_info.at(o_ref.fixed_artifact_idx).floor_id = cur_floor_id;
+ ArtifactsInfo::get_instance().get_artifact(o_ref.fixed_artifact_idx).floor_id = cur_floor_id;
}
}
}
continue;
}
- auto &fixed_artifact = artifacts_info.at(o_ptr->fixed_artifact_idx);
- if (fixed_artifact.floor_id == new_floor_id) {
- fixed_artifact.is_generated = true;
+ auto &artifact = ArtifactsInfo::get_instance().get_artifact(o_ptr->fixed_artifact_idx);
+ if (artifact.floor_id == new_floor_id) {
+ artifact.is_generated = true;
} else {
delete_object_idx(player_ptr, i);
}
}
if (o_ptr->is_fixed_artifact()) {
- artifacts_info.at(o_ptr->fixed_artifact_idx).floor_id = 0;
+ ArtifactsInfo::get_instance().get_artifact(o_ptr->fixed_artifact_idx).floor_id = 0;
}
}
}
flag = true;
}
+ auto &artifact = ArtifactsInfo::get_instance().get_artifact(j_ptr->fixed_artifact_idx);
if (!flag) {
int candidates = 0, pick;
for (ty = 1; ty < floor_ptr->height - 1; ty++) {
if (preserve_mode) {
if (j_ptr->is_fixed_artifact() && !j_ptr->is_known()) {
- artifacts_info.at(j_ptr->fixed_artifact_idx).is_generated = false;
+ artifact.is_generated = false;
}
}
}
if (j_ptr->is_fixed_artifact()) {
- artifacts_info.at(j_ptr->fixed_artifact_idx).is_generated = false;
+ artifact.is_generated = false;
}
return 0;
}
if (j_ptr->is_fixed_artifact() && w_ptr->character_dungeon) {
- auto &artifact = artifacts_info.at(j_ptr->fixed_artifact_idx);
artifact.floor_id = player_ptr->floor_id;
}
/* Hack -- Preserve unknown artifacts */
if (o_ptr->is_fixed_artifact()) {
- artifacts_info.at(o_ptr->fixed_artifact_idx).is_generated = false;
+ ArtifactsInfo::get_instance().get_artifact(o_ptr->fixed_artifact_idx).is_generated = false;
if (cheat_peek) {
const auto item_name = describe_flavor(player_ptr, o_ptr, (OD_NAME_ONLY | OD_STORE));
msg_format(_("伝説のアイテム (%s) はストリーマーにより削除された。", "Artifact (%s) was deleted by streamer."), item_name.data());
if (!w_ptr->character_dungeon || preserve_mode) {
if (o_ptr->is_fixed_artifact() && !o_ptr->is_known()) {
- artifacts_info.at(o_ptr->fixed_artifact_idx).is_generated = false;
+ ArtifactsInfo::get_instance().get_artifact(o_ptr->fixed_artifact_idx).is_generated = false;
}
}
OBJECT_IDX o_idx = o_pop(floor_ptr);
if (o_idx == 0) {
if (q_ptr->is_fixed_artifact()) {
- artifacts_info.at(q_ptr->fixed_artifact_idx).is_generated = false;
+ ArtifactsInfo::get_instance().get_artifact(q_ptr->fixed_artifact_idx).is_generated = false;
}
return;
const auto &quest_list = QuestList::get_instance();
const auto a_idx = quest_list[floor_ptr->quest_number].reward_artifact_idx;
if (a_idx != FixedArtifactId::NONE) {
- const auto &a_ref = artifacts_info.at(a_idx);
- if (a_ref.gen_flags.has_not(ItemGenerationTraitType::INSTA_ART)) {
- letter[index].object = lookup_baseitem_id(a_ref.bi_key);
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(a_idx);
+ if (artifact.gen_flags.has_not(ItemGenerationTraitType::INSTA_ART)) {
+ letter[index].object = lookup_baseitem_id(artifact.bi_key);
}
}
}
uint16_t why = 3;
ang_sort(player_ptr, whats.data(), &why, whats.size(), ang_sort_art_comp, ang_sort_art_swap);
for (auto a_idx : whats) {
- const auto &a_ref = artifacts_info.at(a_idx);
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(a_idx);
constexpr auto unknown_art = _("未知の伝説のアイテム", "Unknown Artifact");
- const auto bi_id = lookup_baseitem_id(a_ref.bi_key);
+ const auto bi_id = lookup_baseitem_id(artifact.bi_key);
constexpr auto template_basename = _(" %s\n", " The %s\n");
if (bi_id == 0) {
fprintf(fff, template_basename, unknown_art);
case QuestKindType::FIND_ARTIFACT: {
std::string item_name("");
if (q_ref.reward_artifact_idx != FixedArtifactId::NONE) {
- const auto &a_ref = artifacts_info.at(q_ref.reward_artifact_idx);
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(q_ref.reward_artifact_idx);
ItemEntity item;
- auto bi_id = lookup_baseitem_id(a_ref.bi_key);
+ auto bi_id = lookup_baseitem_id(artifact.bi_key);
item.prep(bi_id);
item.fixed_artifact_idx = q_ref.reward_artifact_idx;
item.ident = IDENT_STORE;
*/
void ItemLoaderBase::load_artifact()
{
- ArtifactType dummy;
auto loading_max_a_idx = rd_u16b();
for (auto i = 0U; i < loading_max_a_idx; i++) {
const auto a_idx = i2enum<FixedArtifactId>(i);
- auto &artifact = (i > 0) ? artifacts_info.at(a_idx) : dummy;
+ auto &artifact = ArtifactsInfo::get_instance().get_artifact(a_idx);
artifact.is_generated = rd_bool();
if (h_older_than(1, 5, 0, 0)) {
artifact.floor_id = 0;
o_ptr->curse_flags.set(CurseTraitType::PERMA_CURSE);
}
if (o_ptr->is_fixed_artifact()) {
- const auto &a_ref = artifacts_info.at(o_ptr->fixed_artifact_idx);
- if (a_ref.gen_flags.has(ItemGenerationTraitType::HEAVY_CURSE)) {
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(o_ptr->fixed_artifact_idx);
+ if (artifact.gen_flags.has(ItemGenerationTraitType::HEAVY_CURSE)) {
o_ptr->curse_flags.set(CurseTraitType::HEAVY_CURSE);
}
- if (a_ref.gen_flags.has(ItemGenerationTraitType::PERMA_CURSE)) {
+ if (artifact.gen_flags.has(ItemGenerationTraitType::PERMA_CURSE)) {
o_ptr->curse_flags.set(CurseTraitType::PERMA_CURSE);
}
} else if (o_ptr->is_ego()) {
}
if (o_ptr->is_fixed_artifact()) {
- const auto &a_ref = artifacts_info.at(o_ptr->fixed_artifact_idx);
- if (a_ref.name.empty()) {
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(o_ptr->fixed_artifact_idx);
+ if (artifact.name.empty()) {
o_ptr->fixed_artifact_idx = FixedArtifactId::NONE;
}
}
}
q_ptr->reward_artifact_idx = i2enum<FixedArtifactId>(rd_s16b());
if (q_ptr->reward_artifact_idx != FixedArtifactId::NONE) {
- artifacts_info.at(q_ptr->reward_artifact_idx).gen_flags.set(ItemGenerationTraitType::QUESTITEM);
+ ArtifactsInfo::get_instance().get_artifact(q_ptr->reward_artifact_idx).gen_flags.set(ItemGenerationTraitType::QUESTITEM);
}
q_ptr->flags = rd_byte();
*/
bool drop_single_artifact(PlayerType *player_ptr, monster_death_type *md_ptr, FixedArtifactId a_idx)
{
- auto &a_ref = artifacts_info.at(a_idx);
- if (a_ref.is_generated) {
+ auto &artifact = ArtifactsInfo::get_instance().get_artifact(a_idx);
+ if (artifact.is_generated) {
return false;
}
}
const auto a_idx = dungeon.final_artifact;
- auto &a_ref = artifacts_info.at(a_idx);
- if (a_ref.is_generated) {
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(a_idx);
+ if (artifact.is_generated) {
return bi_id;
}
break;
}
- a_ptr = &artifacts_info.at(a_idx);
+ a_ptr = &ArtifactsInfo::get_instance().get_artifact(a_idx);
} while (a_ptr->is_generated);
create_named_art(player_ptr, a_idx, md_ptr->md_y, md_ptr->md_x);
}
apply_artifact(this->player_ptr, this->o_ptr);
- auto &a_ref = artifacts_info.at(this->o_ptr->fixed_artifact_idx);
- a_ref.is_generated = true;
-
+ ArtifactsInfo::get_instance().get_artifact(this->o_ptr->fixed_artifact_idx).is_generated = true;
return true;
}
return false;
}
- const auto &a_ref = artifacts_info.at(a_idx);
- if (a_ref.gen_flags.has(ItemGenerationTraitType::INSTA_ART)) {
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(a_idx);
+ if (artifact.gen_flags.has(ItemGenerationTraitType::INSTA_ART)) {
return false;
}
- return o_ptr->bi_key == a_ref.bi_key;
+ return o_ptr->bi_key == artifact.bi_key;
}
auto flags = baseitem.flags;
if (o_ptr->is_fixed_artifact()) {
- flags = artifacts_info.at(o_ptr->fixed_artifact_idx).flags;
+ flags = ArtifactsInfo::get_instance().get_artifact(o_ptr->fixed_artifact_idx).flags;
}
if (o_ptr->is_ego()) {
if (o_ptr->is_fully_known()) {
if (o_ptr->is_fixed_artifact()) {
- flags = artifacts_info.at(o_ptr->fixed_artifact_idx).flags;
+ flags = ArtifactsInfo::get_instance().get_artifact(o_ptr->fixed_artifact_idx).flags;
}
flags.set(o_ptr->art_flags);
flags.reset(baseitem.flags);
if (o_ptr->is_fixed_artifact()) {
- const auto &a_ref = artifacts_info.at(o_ptr->fixed_artifact_idx);
- flags.reset(a_ref.flags);
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(o_ptr->fixed_artifact_idx);
+ flags.reset(artifact.flags);
} else if (o_ptr->is_ego()) {
const auto &e_ref = egos_info[o_ptr->ego_idx];
flags.reset(e_ref.flags);
PRICE value = baseitems_info[o_ptr->bi_id].cost;
auto flags = object_flags(o_ptr);
if (o_ptr->is_fixed_artifact()) {
- const auto &a_ref = artifacts_info.at(o_ptr->fixed_artifact_idx);
- if (!a_ref.cost) {
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(o_ptr->fixed_artifact_idx);
+ if (!artifact.cost) {
return 0;
}
- value = a_ref.cost;
+ value = artifact.cost;
value += flag_cost(o_ptr, o_ptr->pval);
return value;
} else if (o_ptr->is_ego()) {
int trivial_info = 0;
auto flags = object_flags(o_ptr);
- const auto item_text = o_ptr->is_fixed_artifact() ? artifacts_info.at(o_ptr->fixed_artifact_idx).text.data() : baseitems_info[o_ptr->bi_id].text.data();
+ const auto &artifacts = ArtifactsInfo::get_instance();
+ const auto item_text = o_ptr->is_fixed_artifact() ? artifacts.get_artifact(o_ptr->fixed_artifact_idx).text.data() : baseitems_info[o_ptr->bi_id].text.data();
const auto item_text_lines = shape_buffer(item_text, 77 - 15);
int i = 0;
q_ptr->curse_flags.clear();
if (o_ptr->is_fixed_artifact()) {
- const auto &fixed_artifact = artifacts_info.at(o_ptr->fixed_artifact_idx);
- level = (level + std::max(fixed_artifact.level - 8, 5)) / 2;
- level += std::min(20, fixed_artifact.rarity / (fixed_artifact.gen_flags.has(ItemGenerationTraitType::INSTA_ART) ? 10 : 3));
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(o_ptr->fixed_artifact_idx);
+ level = (level + std::max(artifact.level - 8, 5)) / 2;
+ level += std::min(20, artifact.rarity / (artifact.gen_flags.has(ItemGenerationTraitType::INSTA_ART) ? 10 : 3));
} else if (o_ptr->is_ego()) {
level += std::max(3, (egos_info[o_ptr->ego_idx].rating - 5) / 2);
} else if (o_ptr->is_random_artifact()) {
auto max_a_num = enum2i(artifacts_info.rbegin()->first);
tmp16u = max_a_num + 1;
wr_u16b(tmp16u);
- ArtifactType dummy;
for (auto i = 0U; i < tmp16u; i++) {
const auto a_idx = i2enum<FixedArtifactId>(i);
- const auto &artifact = (i > 0) ? artifacts_info.at(a_idx) : dummy;
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(a_idx);
wr_bool(artifact.is_generated);
wr_s16b(artifact.floor_id);
}
*/
void get_bloody_moon_flags(ItemEntity *o_ptr)
{
- o_ptr->art_flags = artifacts_info.at(FixedArtifactId::BLOOD).flags;
+ o_ptr->art_flags = ArtifactsInfo::get_instance().get_artifact(FixedArtifactId::BLOOD).flags;
int dummy = randint1(2) + randint1(2);
for (int i = 0; i < dummy; i++) {
/* During generation, destroyed artifacts are "preserved" */
if (preserve_mode || in_generate) {
/* Scan all objects in the grid */
+ const auto &artifacts = ArtifactsInfo::get_instance();
for (const auto this_o_idx : g_ptr->o_idx_list) {
ItemEntity *o_ptr;
o_ptr = &floor_ptr->o_list[this_o_idx];
/* Hack -- Preserve unknown artifacts */
if (o_ptr->is_fixed_artifact() && (!o_ptr->is_known() || in_generate)) {
- artifacts_info.at(o_ptr->fixed_artifact_idx).is_generated = false;
+ artifacts.get_artifact(o_ptr->fixed_artifact_idx).is_generated = false;
if (in_generate && cheat_peek) {
const auto item_name = describe_flavor(player_ptr, o_ptr, (OD_NAME_ONLY | OD_STORE));
ArtifactsInfo ArtifactsInfo::instance{};
+ArtifactType ArtifactsInfo::dummy{};
+
ArtifactsInfo &ArtifactsInfo::get_instance()
{
return instance;
ArtifactType &ArtifactsInfo::get_artifact(const FixedArtifactId id) const
{
+ if (id == FixedArtifactId::NONE) {
+ return dummy;
+ }
+
return artifacts_info.at(id);
}
private:
ArtifactsInfo() = default;
static ArtifactsInfo instance;
+ static ArtifactType dummy;
};
int z2;
/* Sort by total kills */
+ const auto &artifact_w1 = ArtifactsInfo::get_instance().get_artifact(w1);
+ const auto &artifact_w2 = ArtifactsInfo::get_instance().get_artifact(w2);
if (*why >= 3) {
/* Extract total kills */
- z1 = enum2i(artifacts_info.at(w1).bi_key.tval());
- z2 = enum2i(artifacts_info.at(w2).bi_key.tval());
+ z1 = enum2i(artifact_w1.bi_key.tval());
+ z2 = enum2i(artifact_w2.bi_key.tval());
/* Compare total kills */
if (z1 < z2) {
/* Sort by monster level */
if (*why >= 2) {
/* Extract levels */
- z1 = artifacts_info.at(w1).bi_key.sval().value();
- z2 = artifacts_info.at(w2).bi_key.sval().value();
+ z1 = artifact_w1.bi_key.sval().value();
+ z2 = artifact_w2.bi_key.sval().value();
/* Compare levels */
if (z1 < z2) {
/* Sort by monster experience */
if (*why >= 1) {
/* Extract experience */
- z1 = artifacts_info.at(w1).level;
- z2 = artifacts_info.at(w2).level;
+ z1 = artifact_w1.level;
+ z2 = artifact_w2.level;
/* Compare experience */
if (z1 < z2) {
*/
static void analyze_addition(ItemEntity *o_ptr, char *addition, size_t addition_sz)
{
- const auto &a_ref = artifacts_info.at(o_ptr->fixed_artifact_idx);
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(o_ptr->fixed_artifact_idx);
strcpy(addition, "");
- if (a_ref.gen_flags.has_all_of({ ItemGenerationTraitType::XTRA_POWER, ItemGenerationTraitType::XTRA_H_RES })) {
+ if (artifact.gen_flags.has_all_of({ ItemGenerationTraitType::XTRA_POWER, ItemGenerationTraitType::XTRA_H_RES })) {
angband_strcat(addition, _("能力and耐性", "Ability and Resistance"), addition_sz);
- } else if (a_ref.gen_flags.has(ItemGenerationTraitType::XTRA_POWER)) {
+ } else if (artifact.gen_flags.has(ItemGenerationTraitType::XTRA_POWER)) {
angband_strcat(addition, _("能力", "Ability"), addition_sz);
- if (a_ref.gen_flags.has(ItemGenerationTraitType::XTRA_RES_OR_POWER)) {
+ if (artifact.gen_flags.has(ItemGenerationTraitType::XTRA_RES_OR_POWER)) {
angband_strcat(addition, _("(1/2でand耐性)", "(plus Resistance about 1/2)"), addition_sz);
}
- } else if (a_ref.gen_flags.has(ItemGenerationTraitType::XTRA_H_RES)) {
+ } else if (artifact.gen_flags.has(ItemGenerationTraitType::XTRA_H_RES)) {
angband_strcat(addition, _("耐性", "Resistance"), addition_sz);
- if (a_ref.gen_flags.has(ItemGenerationTraitType::XTRA_RES_OR_POWER)) {
+ if (artifact.gen_flags.has(ItemGenerationTraitType::XTRA_RES_OR_POWER)) {
angband_strcat(addition, _("(1/2でand能力)", "(plus Ability about 1/2)"), addition_sz);
}
- } else if (a_ref.gen_flags.has(ItemGenerationTraitType::XTRA_RES_OR_POWER)) {
+ } else if (artifact.gen_flags.has(ItemGenerationTraitType::XTRA_RES_OR_POWER)) {
angband_strcat(addition, _("能力or耐性", "Ability or Resistance"), addition_sz);
}
- if (a_ref.gen_flags.has(ItemGenerationTraitType::XTRA_DICE)) {
+ if (artifact.gen_flags.has(ItemGenerationTraitType::XTRA_DICE)) {
if (strlen(addition) > 0) {
angband_strcat(addition, _("、", ", "), addition_sz);
}
*/
static void analyze_misc(ItemEntity *o_ptr, char *misc_desc, size_t misc_desc_sz)
{
- const auto &a_ref = artifacts_info.at(o_ptr->fixed_artifact_idx);
- strnfmt(misc_desc, misc_desc_sz, _("レベル %d, 希少度 %u, %d.%d kg, $%ld", "Level %d, Rarity %u, %d.%d lbs, %ld Gold"), (int)a_ref.level, a_ref.rarity,
- _(lb_to_kg_integer(a_ref.weight), a_ref.weight / 10), _(lb_to_kg_fraction(a_ref.weight), a_ref.weight % 10), (long int)a_ref.cost);
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(o_ptr->fixed_artifact_idx);
+ const auto *mes = _("レベル %d, 希少度 %u, %d.%d kg, $%ld", "Level %d, Rarity %u, %d.%d lbs, %ld Gold");
+ strnfmt(misc_desc, misc_desc_sz, mes, (int)artifact.level, artifact.rarity,
+ _(lb_to_kg_integer(artifact.weight), artifact.weight / 10), _(lb_to_kg_fraction(artifact.weight), artifact.weight % 10), (long int)artifact.cost);
}
/*!
*/
static bool make_fake_artifact(ItemEntity *o_ptr, FixedArtifactId fixed_artifact_idx)
{
- auto &a_ref = artifacts_info.at(fixed_artifact_idx);
- if (a_ref.name.empty()) {
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(fixed_artifact_idx);
+ if (artifact.name.empty()) {
return false;
}
- const auto bi_id = lookup_baseitem_id(a_ref.bi_key);
+ const auto bi_id = lookup_baseitem_id(artifact.bi_key);
if (bi_id == 0) {
return false;
}
o_ptr->prep(bi_id);
o_ptr->fixed_artifact_idx = fixed_artifact_idx;
- o_ptr->pval = a_ref.pval;
- o_ptr->ac = a_ref.ac;
- o_ptr->dd = a_ref.dd;
- o_ptr->ds = a_ref.ds;
- o_ptr->to_a = a_ref.to_a;
- o_ptr->to_h = a_ref.to_h;
- o_ptr->to_d = a_ref.to_d;
- o_ptr->weight = a_ref.weight;
+ o_ptr->pval = artifact.pval;
+ o_ptr->ac = artifact.ac;
+ o_ptr->dd = artifact.dd;
+ o_ptr->ds = artifact.ds;
+ o_ptr->to_a = artifact.to_a;
+ o_ptr->to_h = artifact.to_h;
+ o_ptr->to_d = artifact.to_d;
+ o_ptr->weight = artifact.weight;
return true;
}
}
}
- artifacts_info.at(i2enum<FixedArtifactId>(int_a_idx)).is_generated = aware;
+ ArtifactsInfo::get_instance().get_artifact(i2enum<FixedArtifactId>(int_a_idx)).is_generated = aware;
msg_print(aware ? "Modified." : "Restored.");
}
concptr p = "Enter number of items to roll: ";
char tmp_val[80];
+ const auto &artifacts = ArtifactsInfo::get_instance();
if (o_ptr->is_fixed_artifact()) {
- artifacts_info.at(o_ptr->fixed_artifact_idx).is_generated = false;
+ artifacts.get_artifact(o_ptr->fixed_artifact_idx).is_generated = false;
}
uint32_t i, matches, better, worse, other, correct;
q_ptr->wipe();
make_object(player_ptr, q_ptr, mode);
if (q_ptr->is_fixed_artifact()) {
- artifacts_info.at(q_ptr->fixed_artifact_idx).is_generated = false;
+ artifacts.get_artifact(q_ptr->fixed_artifact_idx).is_generated = false;
}
if (o_ptr->bi_key != q_ptr->bi_key) {
}
if (o_ptr->is_fixed_artifact()) {
- artifacts_info.at(o_ptr->fixed_artifact_idx).is_generated = true;
+ artifacts.get_artifact(o_ptr->fixed_artifact_idx).is_generated = true;
}
}
char ch;
bool changed = false;
+ const auto &artifacts = ArtifactsInfo::get_instance();
while (true) {
wiz_display_item(player_ptr, q_ptr);
if (!get_com("[a]ccept, [w]orthless, [c]ursed, [n]ormal, [g]ood, [e]xcellent, [s]pecial? ", &ch, false)) {
if (q_ptr->is_fixed_artifact()) {
- artifacts_info.at(q_ptr->fixed_artifact_idx).is_generated = false;
+ artifacts.get_artifact(q_ptr->fixed_artifact_idx).is_generated = false;
q_ptr->fixed_artifact_idx = FixedArtifactId::NONE;
}
}
if (q_ptr->is_fixed_artifact()) {
- artifacts_info.at(q_ptr->fixed_artifact_idx).is_generated = false;
+ artifacts.get_artifact(q_ptr->fixed_artifact_idx).is_generated = false;
q_ptr->fixed_artifact_idx = FixedArtifactId::NONE;
}
if (a_ids.size() == 1) {
const auto a_idx = a_ids.back();
- auto &a_ref = artifacts_info.at(a_idx);
- if (must || (ok_art && !a_ref.is_generated)) {
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(a_idx);
+ if (must || (ok_art && !artifact.is_generated)) {
(void)create_named_art(player_ptr, a_idx, player_ptr->y, player_ptr->x);
} else {
wishing_puff_of_smoke();
}
if (a_idx != FixedArtifactId::NONE) {
- const auto &a_ref = artifacts_info.at(a_idx);
- if (must || (ok_art && !a_ref.is_generated)) {
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(a_idx);
+ if (must || (ok_art && !artifact.is_generated)) {
(void)create_named_art(player_ptr, a_idx, player_ptr->y, player_ptr->x);
} else {
wishing_puff_of_smoke();
*/
static std::string wiz_make_named_artifact_desc(PlayerType *player_ptr, FixedArtifactId a_idx)
{
- const auto &a_ref = artifacts_info.at(a_idx);
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(a_idx);
ItemEntity item;
- item.prep(lookup_baseitem_id(a_ref.bi_key));
+ item.prep(lookup_baseitem_id(artifact.bi_key));
item.fixed_artifact_idx = a_idx;
object_known(&item);
return describe_flavor(player_ptr, &item, OD_NAME_ONLY);
screen_load();
const auto a_idx = create_a_idx.value();
- const auto &artifact = artifacts_info.at(a_idx);
+ const auto &artifact = ArtifactsInfo::get_instance().get_artifact(a_idx);
if (artifact.is_generated) {
msg_print("It's already allocated.");
return;