<ClCompile Include="..\..\src\action\weapon-shield.c" />\r
<ClCompile Include="..\..\src\artifact\random-art-activation.c" />\r
<ClCompile Include="..\..\src\artifact\random-art-characteristics.c" />\r
+ <ClCompile Include="..\..\src\artifact\random-art-generator.c" />\r
<ClCompile Include="..\..\src\artifact\random-art-misc.c" />\r
<ClCompile Include="..\..\src\artifact\random-art-resistance.c" />\r
<ClCompile Include="..\..\src\artifact\random-art-slay.c" />\r
<ClInclude Include="..\..\src\art-definition\art-weapon-types.h" />\r
<ClInclude Include="..\..\src\art-definition\random-art-effects.h" />\r
<ClInclude Include="..\..\src\artifact\random-art-activation.h" />\r
+ <ClInclude Include="..\..\src\artifact\random-art-generator.h" />\r
<ClInclude Include="..\..\src\artifact\random-art-misc.h" />\r
<ClInclude Include="..\..\src\artifact\random-art-resistance.h" />\r
<ClInclude Include="..\..\src\artifact\random-art-slay.h" />\r
<ClCompile Include="..\..\src\artifact\random-art-characteristics.c">
<Filter>artifact</Filter>
</ClCompile>
+ <ClCompile Include="..\..\src\artifact\random-art-generator.c">
+ <Filter>artifact</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\combat\shoot.h">
<ClInclude Include="..\..\src\artifact\random-art-characteristics.h">
<Filter>artifact</Filter>
</ClInclude>
+ <ClInclude Include="..\..\src\artifact\random-art-generator.h">
+ <Filter>artifact</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\src\wall.bmp" />
artifact/random-art-activation.c artifact/random-art-activation.h \
artifact/random-art-bias-types.h \
artifact/random-art-characteristics.c artifact/random-art-characteristics.h \
+ artifact/random-art-generator.c artifact/random-art-generator.h \
artifact/random-art-misc.c artifact/random-art-misc.h \
artifact/random-art-pval-investor.c artifact/random-art-pval-investor.h \
artifact/random-art-resistance.c artifact/random-art-resistance.h \
--- /dev/null
+#include "artifact/random-art-generator.h"
+#include "artifact/random-art-activation.h"
+#include "artifact/random-art-bias-types.h"
+#include "artifact/random-art-characteristics.h"
+#include "artifact/random-art-misc.h"
+#include "artifact/random-art-pval-investor.h"
+#include "artifact/random-art-resistance.h"
+#include "artifact/random-art-slay.h"
+#include "core/asking-player.h"
+#include "core/window-redrawer.h"
+#include "flavor/object-flavor.h"
+#include "game-option/cheat-types.h"
+#include "object-enchant/special-object-flags.h"
+#include "object-enchant/tr-types.h"
+#include "object-hook/hook-armor.h"
+#include "object-hook/hook-checker.h"
+#include "object-hook/hook-weapon.h"
+#include "object/object-flags.h"
+#include "object/object-kind-hook.h"
+#include "object/object-kind.h"
+#include "object/object-value-calc.h"
+#include "perception/identification.h"
+#include "perception/object-perception.h"
+#include "player/avatar.h"
+#include "sv-definition/sv-weapon-types.h"
+#include "util/bit-flags-calculator.h"
+#include "util/quarks.h"
+#include "view/display-messages.h"
+#include "wizard/artifact-bias-table.h"
+#include "wizard/wizard-messages.h"
+#include "world/world.h"
+
+static bool weakening_artifact(player_type *player_ptr, object_type *o_ptr)
+{
+ KIND_OBJECT_IDX k_idx = lookup_kind(o_ptr->tval, o_ptr->sval);
+ object_kind *k_ptr = &k_info[k_idx];
+ BIT_FLAGS flgs[TR_FLAG_SIZE];
+ object_flags(player_ptr, o_ptr, flgs);
+
+ if (have_flag(flgs, TR_KILL_EVIL)) {
+ remove_flag(o_ptr->art_flags, TR_KILL_EVIL);
+ add_flag(o_ptr->art_flags, TR_SLAY_EVIL);
+ return TRUE;
+ }
+
+ if (k_ptr->dd < o_ptr->dd) {
+ o_ptr->dd--;
+ return TRUE;
+ }
+
+ if (k_ptr->ds < o_ptr->ds) {
+ o_ptr->ds--;
+ return TRUE;
+ }
+
+ if (o_ptr->to_d > 10) {
+ o_ptr->to_d = o_ptr->to_d - damroll(1, 6);
+ if (o_ptr->to_d < 10) {
+ o_ptr->to_d = 10;
+ }
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/*!
+ * @brief ランダムアーティファクト生成のメインルーチン
+ * @details 既に生成が済んでいるオブジェクトの構造体を、アーティファクトとして強化する。
+ * @param player_ptr プレーヤーへの参照ポインタ
+ * @param o_ptr 対象のオブジェクト構造体ポインタ
+ * @param a_scroll アーティファクト生成の巻物上の処理。呪いのアーティファクトが生成対象外となる。
+ * @return 常にTRUE(1)を返す
+ */
+bool become_random_artifact(player_type *player_ptr, object_type *o_ptr, bool a_scroll)
+{
+ o_ptr->artifact_bias = 0;
+ o_ptr->name1 = 0;
+ o_ptr->name2 = 0;
+ for (int i = 0; i < TR_FLAG_SIZE; i++)
+ o_ptr->art_flags[i] |= k_info[o_ptr->k_idx].flags[i];
+
+ bool has_pval = FALSE;
+ if (o_ptr->pval)
+ has_pval = TRUE;
+
+ int warrior_artifact_bias = 0;
+ if (a_scroll && one_in_(4)) {
+ switch (player_ptr->pclass) {
+ case CLASS_WARRIOR:
+ case CLASS_BERSERKER:
+ case CLASS_ARCHER:
+ case CLASS_SAMURAI:
+ case CLASS_CAVALRY:
+ case CLASS_SMITH:
+ o_ptr->artifact_bias = BIAS_WARRIOR;
+ break;
+ case CLASS_MAGE:
+ case CLASS_HIGH_MAGE:
+ case CLASS_SORCERER:
+ case CLASS_MAGIC_EATER:
+ case CLASS_BLUE_MAGE:
+ o_ptr->artifact_bias = BIAS_MAGE;
+ break;
+ case CLASS_PRIEST:
+ o_ptr->artifact_bias = BIAS_PRIESTLY;
+ break;
+ case CLASS_ROGUE:
+ case CLASS_NINJA:
+ o_ptr->artifact_bias = BIAS_ROGUE;
+ warrior_artifact_bias = 25;
+ break;
+ case CLASS_RANGER:
+ case CLASS_SNIPER:
+ o_ptr->artifact_bias = BIAS_RANGER;
+ warrior_artifact_bias = 30;
+ break;
+ case CLASS_PALADIN:
+ o_ptr->artifact_bias = BIAS_PRIESTLY;
+ warrior_artifact_bias = 40;
+ break;
+ case CLASS_WARRIOR_MAGE:
+ case CLASS_RED_MAGE:
+ o_ptr->artifact_bias = BIAS_MAGE;
+ warrior_artifact_bias = 40;
+ break;
+ case CLASS_CHAOS_WARRIOR:
+ o_ptr->artifact_bias = BIAS_CHAOS;
+ warrior_artifact_bias = 40;
+ break;
+ case CLASS_MONK:
+ case CLASS_FORCETRAINER:
+ o_ptr->artifact_bias = BIAS_PRIESTLY;
+ break;
+ case CLASS_MINDCRAFTER:
+ case CLASS_BARD:
+ if (randint1(5) > 2)
+ o_ptr->artifact_bias = BIAS_PRIESTLY;
+ break;
+ case CLASS_TOURIST:
+ if (randint1(5) > 2)
+ o_ptr->artifact_bias = BIAS_WARRIOR;
+ break;
+ case CLASS_IMITATOR:
+ if (randint1(2) > 1)
+ o_ptr->artifact_bias = BIAS_RANGER;
+ break;
+ case CLASS_BEASTMASTER:
+ o_ptr->artifact_bias = BIAS_CHR;
+ warrior_artifact_bias = 50;
+ break;
+ case CLASS_MIRROR_MASTER:
+ if (randint1(4) > 1) {
+ o_ptr->artifact_bias = BIAS_MAGE;
+ } else {
+ o_ptr->artifact_bias = BIAS_ROGUE;
+ }
+
+ break;
+ }
+ }
+
+ if (a_scroll && (randint1(100) <= warrior_artifact_bias))
+ o_ptr->artifact_bias = BIAS_WARRIOR;
+
+ GAME_TEXT new_name[1024];
+ strcpy(new_name, "");
+
+ bool a_cursed = FALSE;
+ if (!a_scroll && one_in_(A_CURSED))
+ a_cursed = TRUE;
+ if (((o_ptr->tval == TV_AMULET) || (o_ptr->tval == TV_RING)) && object_is_cursed(o_ptr))
+ a_cursed = TRUE;
+
+ int powers = randint1(5) + 1;
+ while (one_in_(powers) || one_in_(7) || one_in_(10))
+ powers++;
+
+ if (!a_cursed && one_in_(WEIRD_LUCK))
+ powers *= 2;
+
+ if (a_cursed)
+ powers /= 2;
+
+ int max_powers = powers;
+ int max_type = object_is_weapon_ammo(o_ptr) ? 7 : 5;
+ while (powers--) {
+ switch (randint1(max_type)) {
+ case 1:
+ case 2:
+ random_plus(o_ptr);
+ has_pval = TRUE;
+ break;
+ case 3:
+ case 4:
+ if (one_in_(2) && object_is_weapon_ammo(o_ptr) && (o_ptr->tval != TV_BOW)) {
+ if (a_cursed && !one_in_(13))
+ break;
+ if (one_in_(13)) {
+ if (one_in_(o_ptr->ds + 4))
+ o_ptr->ds++;
+ } else {
+ if (one_in_(o_ptr->dd + 1))
+ o_ptr->dd++;
+ }
+ } else
+ random_resistance(o_ptr);
+ break;
+ case 5:
+ random_misc(player_ptr, o_ptr);
+ break;
+ case 6:
+ case 7:
+ random_slay(o_ptr);
+ break;
+ default:
+ if (current_world_ptr->wizard)
+ msg_print("Switch error in become_random_artifact!");
+ powers++;
+ }
+ };
+
+ if (has_pval) {
+ if (have_flag(o_ptr->art_flags, TR_BLOWS)) {
+ o_ptr->pval = randint1(2);
+ if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_HAYABUSA))
+ o_ptr->pval++;
+ } else {
+ do {
+ o_ptr->pval++;
+ } while (o_ptr->pval < randint1(5) || one_in_(o_ptr->pval));
+ }
+
+ if ((o_ptr->pval > 4) && !one_in_(WEIRD_LUCK))
+ o_ptr->pval = 4;
+ }
+
+ if (object_is_armour(player_ptr, o_ptr))
+ o_ptr->to_a += randint1(o_ptr->to_a > 19 ? 1 : 20 - o_ptr->to_a);
+ else if (object_is_weapon_ammo(o_ptr)) {
+ o_ptr->to_h += randint1(o_ptr->to_h > 19 ? 1 : 20 - o_ptr->to_h);
+ o_ptr->to_d += randint1(o_ptr->to_d > 19 ? 1 : 20 - o_ptr->to_d);
+ if ((have_flag(o_ptr->art_flags, TR_WIS)) && (o_ptr->pval > 0))
+ add_flag(o_ptr->art_flags, TR_BLESSED);
+ }
+
+ add_flag(o_ptr->art_flags, TR_IGNORE_ACID);
+ add_flag(o_ptr->art_flags, TR_IGNORE_ELEC);
+ add_flag(o_ptr->art_flags, TR_IGNORE_FIRE);
+ add_flag(o_ptr->art_flags, TR_IGNORE_COLD);
+
+ s32b total_flags = flag_cost(player_ptr, o_ptr, o_ptr->pval);
+ if (a_cursed)
+ curse_artifact(player_ptr, o_ptr);
+
+ if (!a_cursed && one_in_(object_is_armour(player_ptr, o_ptr) ? ACTIVATION_CHANCE * 2 : ACTIVATION_CHANCE)) {
+ o_ptr->xtra2 = 0;
+ give_activation_power(o_ptr);
+ }
+
+ if (object_is_armour(player_ptr, o_ptr)) {
+ while ((o_ptr->to_d + o_ptr->to_h) > 20) {
+ if (one_in_(o_ptr->to_d) && one_in_(o_ptr->to_h))
+ break;
+ o_ptr->to_d -= (HIT_POINT)randint0(3);
+ o_ptr->to_h -= (HIT_PROB)randint0(3);
+ }
+ while ((o_ptr->to_d + o_ptr->to_h) > 10) {
+ if (one_in_(o_ptr->to_d) || one_in_(o_ptr->to_h))
+ break;
+ o_ptr->to_d -= (HIT_POINT)randint0(3);
+ o_ptr->to_h -= (HIT_PROB)randint0(3);
+ }
+ }
+
+ if (((o_ptr->artifact_bias == BIAS_MAGE) || (o_ptr->artifact_bias == BIAS_INT)) && (o_ptr->tval == TV_GLOVES))
+ add_flag(o_ptr->art_flags, TR_FREE_ACT);
+
+ if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE)) {
+ o_ptr->to_h = 0;
+ o_ptr->to_d = 0;
+ remove_flag(o_ptr->art_flags, TR_BLOWS);
+ remove_flag(o_ptr->art_flags, TR_FORCE_WEAPON);
+ remove_flag(o_ptr->art_flags, TR_SLAY_ANIMAL);
+ remove_flag(o_ptr->art_flags, TR_SLAY_EVIL);
+ remove_flag(o_ptr->art_flags, TR_SLAY_UNDEAD);
+ remove_flag(o_ptr->art_flags, TR_SLAY_DEMON);
+ remove_flag(o_ptr->art_flags, TR_SLAY_ORC);
+ remove_flag(o_ptr->art_flags, TR_SLAY_TROLL);
+ remove_flag(o_ptr->art_flags, TR_SLAY_GIANT);
+ remove_flag(o_ptr->art_flags, TR_SLAY_DRAGON);
+ remove_flag(o_ptr->art_flags, TR_KILL_DRAGON);
+ remove_flag(o_ptr->art_flags, TR_SLAY_HUMAN);
+ remove_flag(o_ptr->art_flags, TR_VORPAL);
+ remove_flag(o_ptr->art_flags, TR_BRAND_POIS);
+ remove_flag(o_ptr->art_flags, TR_BRAND_ACID);
+ remove_flag(o_ptr->art_flags, TR_BRAND_ELEC);
+ remove_flag(o_ptr->art_flags, TR_BRAND_FIRE);
+ remove_flag(o_ptr->art_flags, TR_BRAND_COLD);
+ }
+
+ int power_level;
+ if (!object_is_weapon_ammo(o_ptr)) {
+ if (a_cursed)
+ power_level = 0;
+ else if (total_flags < 15000)
+ power_level = 1;
+ else if (total_flags < 35000)
+ power_level = 2;
+ else
+ power_level = 3;
+ } else {
+ if (a_cursed)
+ power_level = 0;
+ else if (total_flags < 20000)
+ power_level = 1;
+ else if (total_flags < 45000)
+ power_level = 2;
+ else
+ power_level = 3;
+ }
+
+ while (has_extreme_damage_rate(player_ptr, o_ptr) && !one_in_(SWORDFISH_LUCK))
+ weakening_artifact(player_ptr, o_ptr);
+
+ if (a_scroll) {
+ GAME_TEXT dummy_name[MAX_NLEN] = "";
+ concptr ask_msg = _("このアーティファクトを何と名付けますか?", "What do you want to call the artifact? ");
+ object_aware(player_ptr, o_ptr);
+ object_known(o_ptr);
+ o_ptr->ident |= IDENT_FULL_KNOWN;
+ o_ptr->art_name = quark_add("");
+ (void)screen_object(player_ptr, o_ptr, 0L);
+ if (!get_string(ask_msg, dummy_name, sizeof dummy_name) || !dummy_name[0]) {
+ /* Cancelled */
+ if (one_in_(2)) {
+ get_table_sindarin_aux(dummy_name);
+ } else {
+ get_table_name_aux(dummy_name);
+ }
+ }
+
+ sprintf(new_name, _("《%s》", "'%s'"), dummy_name);
+ chg_virtue(player_ptr, V_INDIVIDUALISM, 2);
+ chg_virtue(player_ptr, V_ENCHANT, 5);
+ } else {
+ get_random_name(o_ptr, new_name, object_is_armour(player_ptr, o_ptr), power_level);
+ }
+
+ o_ptr->art_name = quark_add(new_name);
+ msg_format_wizard(player_ptr, CHEAT_OBJECT,
+ _("パワー %d で 価値%ld のランダムアーティファクト生成 バイアスは「%s」", "Random artifact generated - Power:%d Value:%d Bias:%s."), max_powers,
+ total_flags, artifact_bias_name[o_ptr->artifact_bias]);
+ player_ptr->window |= PW_INVEN | PW_EQUIP;
+ return TRUE;
+}
--- /dev/null
+#pragma once
+
+#include "system/angband.h"
+
+bool become_random_artifact(player_type *player_ptr, object_type *o_ptr, bool a_scroll);
*/
#include "object-enchant/apply-magic-accessory.h"
-#include "object-enchant/artifact.h"
+#include "artifact/random-art-generator.h"
#include "object-enchant/object-boost.h"
#include "object-enchant/object-ego.h"
#include "object-enchant/special-object-flags.h"
*/
#include "object-enchant/apply-magic-armor.h"
+#include "artifact/random-art-generator.h"
#include "inventory/inventory-slot-types.h"
-#include "object-enchant/artifact.h"
#include "object-enchant/object-boost.h"
#include "object-enchant/object-ego.h"
#include "object/object-kind-hook.h"
*/
#include "object-enchant/apply-magic-others.h"
+#include "artifact/random-art-generator.h"
#include "floor/floor.h"
#include "game-option/cheat-options.h"
#include "inventory/inventory-slot-types.h"
#include "monster-race/monster-race-hook.h"
#include "monster/monster-list.h"
#include "monster/monster-util.h"
-#include "object-enchant/artifact.h"
#include "object-enchant/object-ego.h"
#include "object-enchant/tr-types.h"
#include "object-enchant/trc-types.h"
*/
#include "object-enchant/apply-magic-weapon.h"
+#include "artifact/random-art-generator.h"
#include "floor/floor.h"
#include "inventory/inventory-slot-types.h"
-#include "object-enchant/artifact.h"
#include "object-enchant/object-boost.h"
#include "object-enchant/object-ego.h"
#include "object-enchant/tr-types.h"
#include "artifact/random-art-activation.h"
#include "artifact/random-art-bias-types.h"
#include "artifact/random-art-characteristics.h"
-#include "artifact/random-art-misc.h"
#include "artifact/random-art-pval-investor.h"
-#include "artifact/random-art-resistance.h"
-#include "artifact/random-art-slay.h"
#include "art-definition/art-armor-types.h"
#include "art-definition/art-protector-types.h"
#include "art-definition/art-sword-types.h"
*/
ARTIFACT_IDX max_a_idx;
-static bool weakening_artifact(player_type *player_ptr, object_type *o_ptr)
-{
- KIND_OBJECT_IDX k_idx = lookup_kind(o_ptr->tval, o_ptr->sval);
- object_kind *k_ptr = &k_info[k_idx];
- BIT_FLAGS flgs[TR_FLAG_SIZE];
- object_flags(player_ptr, o_ptr, flgs);
-
- if (have_flag(flgs, TR_KILL_EVIL)) {
- remove_flag(o_ptr->art_flags, TR_KILL_EVIL);
- add_flag(o_ptr->art_flags, TR_SLAY_EVIL);
- return TRUE;
- }
-
- if (k_ptr->dd < o_ptr->dd) {
- o_ptr->dd--;
- return TRUE;
- }
-
- if (k_ptr->ds < o_ptr->ds) {
- o_ptr->ds--;
- return TRUE;
- }
-
- if (o_ptr->to_d > 10) {
- o_ptr->to_d = o_ptr->to_d - damroll(1, 6);
- if (o_ptr->to_d < 10) {
- o_ptr->to_d = 10;
- }
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-/*!
- * @brief ランダムアーティファクト生成のメインルーチン
- * @details 既に生成が済んでいるオブジェクトの構造体を、アーティファクトとして強化する。
- * @param player_ptr プレーヤーへの参照ポインタ
- * @param o_ptr 対象のオブジェクト構造体ポインタ
- * @param a_scroll アーティファクト生成の巻物上の処理。呪いのアーティファクトが生成対象外となる。
- * @return 常にTRUE(1)を返す
- */
-bool become_random_artifact(player_type *player_ptr, object_type *o_ptr, bool a_scroll)
-{
- o_ptr->artifact_bias = 0;
- o_ptr->name1 = 0;
- o_ptr->name2 = 0;
- for (int i = 0; i < TR_FLAG_SIZE; i++)
- o_ptr->art_flags[i] |= k_info[o_ptr->k_idx].flags[i];
-
- bool has_pval = FALSE;
- if (o_ptr->pval)
- has_pval = TRUE;
-
- int warrior_artifact_bias = 0;
- if (a_scroll && one_in_(4)) {
- switch (player_ptr->pclass) {
- case CLASS_WARRIOR:
- case CLASS_BERSERKER:
- case CLASS_ARCHER:
- case CLASS_SAMURAI:
- case CLASS_CAVALRY:
- case CLASS_SMITH:
- o_ptr->artifact_bias = BIAS_WARRIOR;
- break;
- case CLASS_MAGE:
- case CLASS_HIGH_MAGE:
- case CLASS_SORCERER:
- case CLASS_MAGIC_EATER:
- case CLASS_BLUE_MAGE:
- o_ptr->artifact_bias = BIAS_MAGE;
- break;
- case CLASS_PRIEST:
- o_ptr->artifact_bias = BIAS_PRIESTLY;
- break;
- case CLASS_ROGUE:
- case CLASS_NINJA:
- o_ptr->artifact_bias = BIAS_ROGUE;
- warrior_artifact_bias = 25;
- break;
- case CLASS_RANGER:
- case CLASS_SNIPER:
- o_ptr->artifact_bias = BIAS_RANGER;
- warrior_artifact_bias = 30;
- break;
- case CLASS_PALADIN:
- o_ptr->artifact_bias = BIAS_PRIESTLY;
- warrior_artifact_bias = 40;
- break;
- case CLASS_WARRIOR_MAGE:
- case CLASS_RED_MAGE:
- o_ptr->artifact_bias = BIAS_MAGE;
- warrior_artifact_bias = 40;
- break;
- case CLASS_CHAOS_WARRIOR:
- o_ptr->artifact_bias = BIAS_CHAOS;
- warrior_artifact_bias = 40;
- break;
- case CLASS_MONK:
- case CLASS_FORCETRAINER:
- o_ptr->artifact_bias = BIAS_PRIESTLY;
- break;
- case CLASS_MINDCRAFTER:
- case CLASS_BARD:
- if (randint1(5) > 2)
- o_ptr->artifact_bias = BIAS_PRIESTLY;
- break;
- case CLASS_TOURIST:
- if (randint1(5) > 2)
- o_ptr->artifact_bias = BIAS_WARRIOR;
- break;
- case CLASS_IMITATOR:
- if (randint1(2) > 1)
- o_ptr->artifact_bias = BIAS_RANGER;
- break;
- case CLASS_BEASTMASTER:
- o_ptr->artifact_bias = BIAS_CHR;
- warrior_artifact_bias = 50;
- break;
- case CLASS_MIRROR_MASTER:
- if (randint1(4) > 1) {
- o_ptr->artifact_bias = BIAS_MAGE;
- } else {
- o_ptr->artifact_bias = BIAS_ROGUE;
- }
-
- break;
- }
- }
-
- if (a_scroll && (randint1(100) <= warrior_artifact_bias))
- o_ptr->artifact_bias = BIAS_WARRIOR;
-
- GAME_TEXT new_name[1024];
- strcpy(new_name, "");
-
- bool a_cursed = FALSE;
- if (!a_scroll && one_in_(A_CURSED))
- a_cursed = TRUE;
- if (((o_ptr->tval == TV_AMULET) || (o_ptr->tval == TV_RING)) && object_is_cursed(o_ptr))
- a_cursed = TRUE;
-
- int powers = randint1(5) + 1;
- while (one_in_(powers) || one_in_(7) || one_in_(10))
- powers++;
-
- if (!a_cursed && one_in_(WEIRD_LUCK))
- powers *= 2;
-
- if (a_cursed)
- powers /= 2;
-
- int max_powers = powers;
- int max_type = object_is_weapon_ammo(o_ptr) ? 7 : 5;
- while (powers--) {
- switch (randint1(max_type)) {
- case 1:
- case 2:
- random_plus(o_ptr);
- has_pval = TRUE;
- break;
- case 3:
- case 4:
- if (one_in_(2) && object_is_weapon_ammo(o_ptr) && (o_ptr->tval != TV_BOW)) {
- if (a_cursed && !one_in_(13))
- break;
- if (one_in_(13)) {
- if (one_in_(o_ptr->ds + 4))
- o_ptr->ds++;
- } else {
- if (one_in_(o_ptr->dd + 1))
- o_ptr->dd++;
- }
- } else
- random_resistance(o_ptr);
- break;
- case 5:
- random_misc(player_ptr, o_ptr);
- break;
- case 6:
- case 7:
- random_slay(o_ptr);
- break;
- default:
- if (current_world_ptr->wizard)
- msg_print("Switch error in become_random_artifact!");
- powers++;
- }
- };
-
- if (has_pval) {
- if (have_flag(o_ptr->art_flags, TR_BLOWS)) {
- o_ptr->pval = randint1(2);
- if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_HAYABUSA))
- o_ptr->pval++;
- } else {
- do {
- o_ptr->pval++;
- } while (o_ptr->pval < randint1(5) || one_in_(o_ptr->pval));
- }
-
- if ((o_ptr->pval > 4) && !one_in_(WEIRD_LUCK))
- o_ptr->pval = 4;
- }
-
- if (object_is_armour(player_ptr, o_ptr))
- o_ptr->to_a += randint1(o_ptr->to_a > 19 ? 1 : 20 - o_ptr->to_a);
- else if (object_is_weapon_ammo(o_ptr)) {
- o_ptr->to_h += randint1(o_ptr->to_h > 19 ? 1 : 20 - o_ptr->to_h);
- o_ptr->to_d += randint1(o_ptr->to_d > 19 ? 1 : 20 - o_ptr->to_d);
- if ((have_flag(o_ptr->art_flags, TR_WIS)) && (o_ptr->pval > 0))
- add_flag(o_ptr->art_flags, TR_BLESSED);
- }
-
- add_flag(o_ptr->art_flags, TR_IGNORE_ACID);
- add_flag(o_ptr->art_flags, TR_IGNORE_ELEC);
- add_flag(o_ptr->art_flags, TR_IGNORE_FIRE);
- add_flag(o_ptr->art_flags, TR_IGNORE_COLD);
-
- s32b total_flags = flag_cost(player_ptr, o_ptr, o_ptr->pval);
- if (a_cursed)
- curse_artifact(player_ptr, o_ptr);
-
- if (!a_cursed && one_in_(object_is_armour(player_ptr, o_ptr) ? ACTIVATION_CHANCE * 2 : ACTIVATION_CHANCE)) {
- o_ptr->xtra2 = 0;
- give_activation_power(o_ptr);
- }
-
- if (object_is_armour(player_ptr, o_ptr)) {
- while ((o_ptr->to_d + o_ptr->to_h) > 20) {
- if (one_in_(o_ptr->to_d) && one_in_(o_ptr->to_h))
- break;
- o_ptr->to_d -= (HIT_POINT)randint0(3);
- o_ptr->to_h -= (HIT_PROB)randint0(3);
- }
- while ((o_ptr->to_d + o_ptr->to_h) > 10) {
- if (one_in_(o_ptr->to_d) || one_in_(o_ptr->to_h))
- break;
- o_ptr->to_d -= (HIT_POINT)randint0(3);
- o_ptr->to_h -= (HIT_PROB)randint0(3);
- }
- }
-
- if (((o_ptr->artifact_bias == BIAS_MAGE) || (o_ptr->artifact_bias == BIAS_INT)) && (o_ptr->tval == TV_GLOVES))
- add_flag(o_ptr->art_flags, TR_FREE_ACT);
-
- if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE)) {
- o_ptr->to_h = 0;
- o_ptr->to_d = 0;
- remove_flag(o_ptr->art_flags, TR_BLOWS);
- remove_flag(o_ptr->art_flags, TR_FORCE_WEAPON);
- remove_flag(o_ptr->art_flags, TR_SLAY_ANIMAL);
- remove_flag(o_ptr->art_flags, TR_SLAY_EVIL);
- remove_flag(o_ptr->art_flags, TR_SLAY_UNDEAD);
- remove_flag(o_ptr->art_flags, TR_SLAY_DEMON);
- remove_flag(o_ptr->art_flags, TR_SLAY_ORC);
- remove_flag(o_ptr->art_flags, TR_SLAY_TROLL);
- remove_flag(o_ptr->art_flags, TR_SLAY_GIANT);
- remove_flag(o_ptr->art_flags, TR_SLAY_DRAGON);
- remove_flag(o_ptr->art_flags, TR_KILL_DRAGON);
- remove_flag(o_ptr->art_flags, TR_SLAY_HUMAN);
- remove_flag(o_ptr->art_flags, TR_VORPAL);
- remove_flag(o_ptr->art_flags, TR_BRAND_POIS);
- remove_flag(o_ptr->art_flags, TR_BRAND_ACID);
- remove_flag(o_ptr->art_flags, TR_BRAND_ELEC);
- remove_flag(o_ptr->art_flags, TR_BRAND_FIRE);
- remove_flag(o_ptr->art_flags, TR_BRAND_COLD);
- }
-
- int power_level;
- if (!object_is_weapon_ammo(o_ptr)) {
- if (a_cursed)
- power_level = 0;
- else if (total_flags < 15000)
- power_level = 1;
- else if (total_flags < 35000)
- power_level = 2;
- else
- power_level = 3;
- } else {
- if (a_cursed)
- power_level = 0;
- else if (total_flags < 20000)
- power_level = 1;
- else if (total_flags < 45000)
- power_level = 2;
- else
- power_level = 3;
- }
-
- while (has_extreme_damage_rate(player_ptr, o_ptr) && !one_in_(SWORDFISH_LUCK))
- weakening_artifact(player_ptr, o_ptr);
-
- if (a_scroll) {
- GAME_TEXT dummy_name[MAX_NLEN] = "";
- concptr ask_msg = _("このアーティファクトを何と名付けますか?", "What do you want to call the artifact? ");
- object_aware(player_ptr, o_ptr);
- object_known(o_ptr);
- o_ptr->ident |= (IDENT_FULL_KNOWN);
- o_ptr->art_name = quark_add("");
- (void)screen_object(player_ptr, o_ptr, 0L);
- if (!get_string(ask_msg, dummy_name, sizeof dummy_name) || !dummy_name[0]) {
- /* Cancelled */
- if (one_in_(2)) {
- get_table_sindarin_aux(dummy_name);
- } else {
- get_table_name_aux(dummy_name);
- }
- }
-
- sprintf(new_name, _("《%s》", "'%s'"), dummy_name);
- chg_virtue(player_ptr, V_INDIVIDUALISM, 2);
- chg_virtue(player_ptr, V_ENCHANT, 5);
- } else {
- get_random_name(o_ptr, new_name, object_is_armour(player_ptr, o_ptr), power_level);
- }
-
- o_ptr->art_name = quark_add(new_name);
- msg_format_wizard(player_ptr, CHEAT_OBJECT,
- _("パワー %d で 価値%ld のランダムアーティファクト生成 バイアスは「%s」", "Random artifact generated - Power:%d Value:%d Bias:%s."), max_powers,
- total_flags, artifact_bias_name[o_ptr->artifact_bias]);
- player_ptr->window |= PW_INVEN | PW_EQUIP;
- return TRUE;
-}
-
/*!
* @brief オブジェクトから能力発動IDを取得する。
* @details いくつかのケースで定義されている発動効果から、
extern char *a_text;
extern ARTIFACT_IDX max_a_idx;
-bool become_random_artifact(player_type *player_ptr, object_type *o_ptr, bool a_scroll);
int activation_index(player_type *player_ptr, object_type *o_ptr);
const activation_type *find_activation_info(player_type *player_ptr, object_type *o_ptr);
void random_artifact_resistance(player_type *player_ptr, object_type *o_ptr, artifact_type *a_ptr);
#include "spell-kind/spells-enchant.h"
+#include "artifact/random-art-generator.h"
#include "flavor/flavor-describer.h"
#include "flavor/object-flavor-types.h"
#include "floor/floor-object.h"
#include "inventory/inventory-object.h"
#include "io/write-diary.h"
#include "mind/racial-android.h"
-#include "object-enchant/artifact.h"
#include "object-hook/hook-enchant.h"
#include "object-hook/hook-perception.h"
#include "object-hook/hook-weapon.h"
*/
#include "wizard/wizard-special-process.h"
+#include "artifact/random-art-generator.h"
#include "birth/inventory-initializer.h"
#include "cmd-io/cmd-dump.h"
#include "cmd-io/cmd-help.h"