X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fartifact.c;h=6d69e6be94676116c5ab710b96d0d03cd3aa7b9f;hb=dc594aecf753be6bcb09c2b882ed9bc999ac810b;hp=e3ee6c75ab86b8fda4ae713a3e98062969b7632a;hpb=da8fbe58583c0e11e2b2f282c92e568de27b2005;p=hengband%2Fhengband.git diff --git a/src/artifact.c b/src/artifact.c index e3ee6c75a..6d69e6be9 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -11,14 +11,41 @@ */ #include "angband.h" +#include "util.h" + #include "artifact.h" +#include "cmd-smith.h" #include "avatar.h" +#include "floor.h" #include "cmd-activate.h" +#include "object.h" +#include "objectkind.h" #include "object-boost.h" #include "object-curse.h" +#include "object-ego.h" +#include "object-flavor.h" #include "object-hook.h" #include "spells-object.h" +#include "files.h" +#include "grid.h" +#include "monster.h" +#include "view-mainwindow.h" +#include "player-class.h" +#include "player-personality.h" +#include "world.h" + + /* + * The artifact arrays + */ +artifact_type *a_info; +char *a_name; +char *a_text; + +/* + * Maximum number of artifacts in a_info.txt + */ +ARTIFACT_IDX max_a_idx; static bool has_extreme_damage_rate(object_type *o_ptr); static bool weakening_artifact(object_type *o_ptr); @@ -1522,7 +1549,7 @@ static void get_random_name(object_type *o_ptr, char *return_name, bool armour, * @param a_scroll アーティファクト生成の巻物上の処理。呪いのアーティファクトが生成対象外となる。 * @return 常にTRUE(1)を返す */ -bool create_artifact(object_type *o_ptr, bool a_scroll) +bool become_random_artifact(object_type *o_ptr, bool a_scroll) { GAME_TEXT new_name[1024]; PARAMETER_VALUE has_pval = 0; @@ -1674,7 +1701,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll) random_slay(o_ptr); break; default: - if (p_ptr->wizard) msg_print("Switch error in create_artifact!"); + if (current_world_ptr->wizard) msg_print("Switch error in become_random_artifact!"); powers++; } }; @@ -1824,8 +1851,8 @@ bool create_artifact(object_type *o_ptr, bool a_scroll) } } sprintf(new_name, _("《%s》", "'%s'"), dummy_name); - chg_virtue(V_INDIVIDUALISM, 2); - chg_virtue(V_ENCHANT, 5); + chg_virtue(p_ptr, V_INDIVIDUALISM, 2); + chg_virtue(p_ptr, V_ENCHANT, 5); } else { @@ -2018,6 +2045,7 @@ void random_artifact_resistance(object_type * o_ptr, artifact_type *a_ptr) /*! * @brief フロアの指定された位置に固定アーティファクトを生成する。 / Create the artifact of the specified number * @details 固定アーティファクト構造体から基本ステータスをコピーした後、所定の座標でdrop_item()で落とす。 + * @param player_ptr プレーヤーへの参照ポインタ * @param a_idx 生成する固定アーティファクト構造体のID * @param y アイテムを落とす地点のy座標 * @param x アイテムを落とす地点のx座標 @@ -2026,7 +2054,7 @@ void random_artifact_resistance(object_type * o_ptr, artifact_type *a_ptr) * 仮に2個以上存在可能かつ装備品以外の固定アーティファクトが作成されれば * drop_near()関数の返り値は信用できなくなる. */ -bool create_named_art(ARTIFACT_IDX a_idx, POSITION y, POSITION x) +bool create_named_art(player_type *player_ptr, ARTIFACT_IDX a_idx, POSITION y, POSITION x) { object_type forge; object_type *q_ptr; @@ -2069,7 +2097,7 @@ bool create_named_art(ARTIFACT_IDX a_idx, POSITION y, POSITION x) random_artifact_resistance(q_ptr, a_ptr); /* Drop the artifact from heaven */ - return drop_near(q_ptr, -1, y, x) ? TRUE : FALSE; + return drop_near(player_ptr, q_ptr, -1, y, x) ? TRUE : FALSE; } /*対邪平均ダメージの計算処理*/ @@ -2207,7 +2235,7 @@ bool make_artifact(object_type *o_ptr) ARTIFACT_IDX i; /* No artifacts in the town */ - if (!current_floor_ptr->dun_level) return (FALSE); + if (!p_ptr->current_floor_ptr->dun_level) return (FALSE); /* Paranoia -- no "plural" artifacts */ if (o_ptr->number != 1) return (FALSE); @@ -2232,10 +2260,10 @@ bool make_artifact(object_type *o_ptr) if (a_ptr->sval != o_ptr->sval) continue; /* XXX XXX Enforce minimum "depth" (loosely) */ - if (a_ptr->level > current_floor_ptr->dun_level) + if (a_ptr->level > p_ptr->current_floor_ptr->dun_level) { /* Acquire the "out-of-depth factor" */ - int d = (a_ptr->level - current_floor_ptr->dun_level) * 2; + int d = (a_ptr->level - p_ptr->current_floor_ptr->dun_level) * 2; /* Roll for out-of-depth creation */ if (!one_in_(d)) continue; @@ -2275,7 +2303,7 @@ bool make_artifact_special(object_type *o_ptr) KIND_OBJECT_IDX k_idx = 0; /*! @note 地上ではキャンセルする / No artifacts in the town */ - if (!current_floor_ptr->dun_level) return (FALSE); + if (!p_ptr->current_floor_ptr->dun_level) return (FALSE); /*! @note get_obj_num_hookによる指定がある場合は生成をキャンセルする / Themed object */ if (get_obj_num_hook) return (FALSE); @@ -2295,10 +2323,10 @@ bool make_artifact_special(object_type *o_ptr) /*! @note アーティファクト生成階が現在に対して足りない場合は高確率で1/(不足階層*2)を満たさないと生成リストに加えられない / * XXX XXX Enforce minimum "depth" (loosely) */ - if (a_ptr->level > current_floor_ptr->object_level) + if (a_ptr->level > p_ptr->current_floor_ptr->object_level) { /* @note / Acquire the "out-of-depth factor". Roll for out-of-depth creation. */ - int d = (a_ptr->level - current_floor_ptr->object_level) * 2; + int d = (a_ptr->level - p_ptr->current_floor_ptr->object_level) * 2; if (!one_in_(d)) continue; } @@ -2308,9 +2336,9 @@ bool make_artifact_special(object_type *o_ptr) /*! @note INSTA_ART型固定アーティファクトのベースアイテムもチェック対象とする。ベースアイテムの生成階層が足りない場合1/(不足階層*5) を満たさないと除外される。 / * Find the base object. XXX XXX Enforce minimum "object" level (loosely). Acquire the "out-of-depth factor". Roll for out-of-depth creation. */ k_idx = lookup_kind(a_ptr->tval, a_ptr->sval); - if (k_info[k_idx].level > current_floor_ptr->object_level) + if (k_info[k_idx].level > p_ptr->current_floor_ptr->object_level) { - int d = (k_info[k_idx].level - current_floor_ptr->object_level) * 5; + int d = (k_info[k_idx].level - p_ptr->current_floor_ptr->object_level) * 5; if (!one_in_(d)) continue; }