X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fobject2.c;h=b800143785a37ec66b3eb0f4690745a5b2676284;hb=2e0bb544a4dbdd0a190028450cf6efbad793fc5c;hp=08e326174323cf180a4c68edead4d63672f82d35;hpb=93edeca9a4b29b830d96253c1a1dcf2bb57f2b18;p=hengband%2Fhengband.git diff --git a/src/object2.c b/src/object2.c index 08e326174..b80014378 100644 --- a/src/object2.c +++ b/src/object2.c @@ -1,6 +1,6 @@ -/*! +/*! * @file object2.c - * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤Î¼ÂÁõ / Object code, part 2 + * @brief オブジェクトの実装 / Object code, part 2 * @date 2014/01/11 * @author * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n @@ -13,12 +13,49 @@ #include "angband.h" -#include "kajitips.h" +static void one_sustain(object_type *o_ptr); + + +static cptr const kaji_tips[5] = +{ +#ifdef JP + "現在持っているエッセンスの一覧を表示する。", + "アイテムからエッセンスを取り出す。エッセンスを取られたアイテムは全く魔法がかかっていない初期状態に戻る。", + "既にエッセンスが付加されたアイテムからエッセンスのみ消し去る。エッセンスは手に入らない。", + "アイテムにエッセンスを付加する。既にエッセンスが付加されたアイテムやアーティファクトには付加できない。", + "武器や防具を強化したり、攻撃で傷つかないようにしたりする。エッセンスが付加されたアイテムやアーティファクトに対しても使用できる。", +#else + "Display essences you have.", + "Extract essences from an item. The item become non magical.", + "Remove added essences from an equipment which was improved before. The removed essence will be ruined.", + "Add essences to an item. The improved items or artifacts cannot be reimprove.", + "Enchant an equipment or make an equiment element-proofed. The improved items and artifacts can be enchanted too.", +#endif +}; + +/*! + * @brief 対象のオブジェクトにランダムな能力維持を一つ付加する。/ Choose one random sustain + * @details 重複の抑止はない。 + * @param o_ptr 対象のオブジェクト構造体ポインタ + * @return なし + */ +static void one_sustain(object_type *o_ptr) +{ + switch (randint0(6)) + { + case 0: add_flag(o_ptr->art_flags, TR_SUST_STR); break; + case 1: add_flag(o_ptr->art_flags, TR_SUST_INT); break; + case 2: add_flag(o_ptr->art_flags, TR_SUST_WIS); break; + case 3: add_flag(o_ptr->art_flags, TR_SUST_DEX); break; + case 4: add_flag(o_ptr->art_flags, TR_SUST_CON); break; + case 5: add_flag(o_ptr->art_flags, TR_SUST_CHR); break; + } +} /*! - * @brief ¾²¾å¡¢¥â¥ó¥¹¥¿¡¼½ê»ý¤Ç¥¹¥¿¥Ã¥¯¤µ¤ì¤¿¥¢¥¤¥Æ¥à¤òºï½ü¤·¥¹¥¿¥Ã¥¯¤òÊä´°¤¹¤ë / Excise a dungeon object from any stacks - * @param o_idx ºï½üÂоݤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΥݥ¤¥ó¥¿ - * @return ¤Ê¤· + * @brief 床上、モンスター所持でスタックされたアイテムを削除しスタックを補完する / Excise a dungeon object from any stacks + * @param o_idx 削除対象のオブジェクト構造体ポインタ + * @return なし */ void excise_object_idx(int o_idx) { @@ -143,10 +180,10 @@ void excise_object_idx(int o_idx) } /*! - * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤òºï½ü¤¹¤ë / + * @brief オブジェクトを削除する / * Delete a dungeon object - * @param o_idx ºï½üÂоݤΥª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΥݥ¤¥ó¥¿ - * @return ¤Ê¤· + * @param o_idx 削除対象のオブジェクト構造体ポインタ + * @return なし * @details * Handle "stacks" of objects correctly. */ @@ -182,11 +219,11 @@ void delete_object_idx(int o_idx) /*! - * @brief ¥Õ¥í¥¢¤Ë¥Þ¥¹¤ËÍî¤Á¤Æ¤¤¤ë¥ª¥Ö¥¸¥§¥¯¥È¤òÁ´¤Æºï½ü¤¹¤ë / Deletes all objects at given location + * @brief フロアにマスに落ちているオブジェクトを全て削除する / Deletes all objects at given location * Delete a dungeon object - * @param y ºï½ü¤·¤¿¥Õ¥í¥¢¥Þ¥¹¤ÎYºÂɸ - * @param x ºï½ü¤·¤¿¥Õ¥í¥¢¥Þ¥¹¤ÎXºÂɸ - * @return ¤Ê¤· + * @param y 削除したフロアマスのY座標 + * @param x 削除したフロアマスのX座標 + * @return なし */ void delete_object(int y, int x) { @@ -229,21 +266,18 @@ void delete_object(int y, int x) /*! - * @brief ¥°¥í¡¼¥Ð¥ë¥ª¥Ö¥¸¥§¥¯¥ÈÇÛÎó¤ËÂФ·»ØÄêÈϰϤΥª¥Ö¥¸¥§¥¯¥È¤òÀ°Íý¤·¤ÆID¤Î¼ã¤¤½ç¤Ë´ó¤»¤ë / + * @brief グローバルオブジェクト配列に対し指定範囲のオブジェクトを整理してIDの若い順に寄せる / * Move an object from index i1 to index i2 in the object list - * @param i1 À°Íý¤·¤¿¤¤ÇÛÎó¤Î»ÏÅÀ - * @param i2 À°Íý¤·¤¿¤¤ÇÛÎó¤Î½ªÅÀ - * @return ¤Ê¤· + * @param i1 整理したい配列の始点 + * @param i2 整理したい配列の終点 + * @return なし */ -static void compact_objects_aux(int i1, int i2) +static void compact_objects_aux(IDX i1, IDX i2) { - int i; - + IDX i; cave_type *c_ptr; - object_type *o_ptr; - /* Do nothing */ if (i1 == i2) return; @@ -316,12 +350,12 @@ static void compact_objects_aux(int i1, int i2) /*! - * @brief ¥°¥í¡¼¥Ð¥ë¥ª¥Ö¥¸¥§¥¯¥ÈÇÛÎ󤫤éÍ¥ÀèÅÙ¤ÎÄ㤤¤â¤Î¤òºï½ü¤·¡¢¥Ç¡¼¥¿¤ò°µ½Ì¤¹¤ë¡£ / + * @brief グローバルオブジェクト配列から優先度の低いものを削除し、データを圧縮する。 / * Compact and Reorder the object list. - * @size ºÇÄã¤Ç¤â¸º¤é¤·¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¿ô¤Î¿å½à - * @return ¤Ê¤· + * @param size 最低でも減らしたいオブジェクト数の水準 + * @return なし * @details - * ¡Ê´í¸±¤Ê¤Î¤Ç»ÈÍѤˤÏÃí°Õ¤¹¤ë¤³¤È¡Ë + * (危険なので使用には注意すること) * This function can be very dangerous, use with caution!\n *\n * When actually "compacting" objects, we base the saving throw on a\n @@ -333,7 +367,8 @@ static void compact_objects_aux(int i1, int i2) */ void compact_objects(int size) { - int i, y, x, num, cnt; + IDX i; + int y, x, num, cnt; int cur_lev, cur_dis, chance; object_type *o_ptr; @@ -342,12 +377,7 @@ void compact_objects(int size) if (size) { /* Message */ -#ifdef JP - msg_print("¥¢¥¤¥Æ¥à¾ðÊó¤ò°µ½Ì¤·¤Æ¤¤¤Þ¤¹..."); -#else - msg_print("Compacting objects..."); -#endif - + msg_print(_("アイテム情報を圧縮しています...", "Compacting objects...")); /* Redraw map */ p_ptr->redraw |= (PR_MAP); @@ -402,7 +432,7 @@ void compact_objects(int size) } /* Nearby objects start out "immune" */ - if ((cur_dis > 0) && (distance(py, px, y, x) < cur_dis)) continue; + if ((cur_dis > 0) && (distance(p_ptr->y, p_ptr->x, y, x) < cur_dis)) continue; /* Saving throw */ chance = 90; @@ -441,7 +471,7 @@ void compact_objects(int size) /*! - * @brief ¥°¥í¡¼¥Ð¥ë¥ª¥Ö¥¸¥§¥¯¥ÈÇÛÎó¤ò½é´ü²½¤¹¤ë / + * @brief グローバルオブジェクト配列を初期化する / * Delete all the items when player leaves the level * @note we do NOT visually reflect these (irrelevant) changes * @details @@ -450,7 +480,7 @@ void compact_objects(int size) * we know we are clearing every object. Technically, we only * clear those fields for grids/monsters containing objects, * and we clear it once for every such object. - * @return ¤Ê¤· + * @return なし */ void wipe_o_list(void) { @@ -516,16 +546,16 @@ void wipe_o_list(void) /*! - * @brief ¥°¥í¡¼¥Ð¥ë¥ª¥Ö¥¸¥§¥¯¥ÈÇÛÎ󤫤é¶õ¤­¤ò¼èÆÀ¤¹¤ë / + * @brief グローバルオブジェクト配列から空きを取得する / * Acquires and returns the index of a "free" object. - * @return ³«¤¤¤Æ¤¤¤ë¥ª¥Ö¥¸¥§¥¯¥ÈÍ×ÁǤÎID + * @return 開いているオブジェクト要素のID * @details * This routine should almost never fail, but in case it does, * we must be sure to handle "failure" of this routine. */ -s16b o_pop(void) +IDX o_pop(void) { - int i; + IDX i; /* Initial allocation */ @@ -565,12 +595,7 @@ s16b o_pop(void) /* Warn the player (except during dungeon creation) */ -#ifdef JP - if (character_dungeon) msg_print("¥¢¥¤¥Æ¥à¤¬Â¿¤¹¤®¤ë¡ª"); -#else - if (character_dungeon) msg_print("Too many objects!"); -#endif - + if (character_dungeon) msg_print(_("アイテムが多すぎる!", "Too many objects!")); /* Oops */ return (0); @@ -578,10 +603,10 @@ s16b o_pop(void) /*! - * @brief ¥ª¥Ö¥¸¥§¥¯¥ÈÀ¸À®¥Æ¡¼¥Ö¥ë¤ËÀ¸À®À©Ìó¤ò²Ã¤¨¤ë / + * @brief オブジェクト生成テーブルに生成制約を加える / * Apply a "object restriction function" to the "object allocation table" - * @return ¾ï¤Ë0¤òÊÖ¤¹¡£ - * @details À¸À®¤ÎÀ©Ìó¤Ï¥°¥í¡¼¥Ð¥ë¤Îget_obj_num_hook´Ø¿ô¥Ý¥¤¥ó¥¿¤Ç²Ã¤¨¤ë + * @return 常に0を返す。 + * @details 生成の制約はグローバルのget_obj_num_hook関数ポインタで加える */ static errr get_obj_num_prep(void) { @@ -614,10 +639,10 @@ static errr get_obj_num_prep(void) /*! - * @brief ¥ª¥Ö¥¸¥§¥¯¥ÈÀ¸À®¥Æ¡¼¥Ö¥ë¤«¤é¥¢¥¤¥Æ¥à¤ò¼èÆÀ¤¹¤ë / + * @brief オブジェクト生成テーブルからアイテムを取得する / * Choose an object kind that seems "appropriate" to the given level - * @param À¸À®³¬ - * @return Áª¤Ð¤ì¤¿¥ª¥Ö¥¸¥§¥¯¥È¥Ù¡¼¥¹ID + * @param level 生成階 + * @return 選ばれたオブジェクトベースID * @details * This function uses the "prob2" field of the "object allocation table",\n * and various local information, to calculate the "prob3" field of the\n @@ -754,10 +779,10 @@ s16b get_obj_num(int level) /*! - * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤ò´ÕÄêºÑ¤Ë¤¹¤ë / + * @brief オブジェクトを鑑定済にする / * Known is true when the "attributes" of an object are "known". - * @param o_ptr ´ÕÄêºÑ¤Ë¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿ - * @return ¤Ê¤· + * @param o_ptr 鑑定済にするオブジェクトの構造体参照ポインタ + * @return なし * These include tohit, todam, toac, cost, and pval (charges).\n *\n * Note that "knowing" an object gives you everything that an "awareness"\n @@ -787,10 +812,10 @@ void object_known(object_type *o_ptr) } /*! - * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤ò¡ö´ÕÄê¡öºÑ¤Ë¤¹¤ë / + * @brief オブジェクトを*鑑定*済にする / * The player is now aware of the effects of the given object. - * @param o_ptr ¡ö´ÕÄê¡öºÑ¤Ë¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿ - * @return ¤Ê¤· + * @param o_ptr *鑑定*済にするオブジェクトの構造体参照ポインタ + * @return なし */ void object_aware(object_type *o_ptr) { @@ -818,10 +843,10 @@ void object_aware(object_type *o_ptr) /*! - * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤ò»î¹ÔºÑ¤Ë¤¹¤ë / + * @brief オブジェクトを試行済にする / * Something has been "sampled" - * @param o_ptr »î¹ÔºÑ¤Ë¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿ - * @return ¤Ê¤· + * @param o_ptr 試行済にするオブジェクトの構造体参照ポインタ + * @return なし */ void object_tried(object_type *o_ptr) { @@ -830,9 +855,11 @@ void object_tried(object_type *o_ptr) } -/* - * Return the "value" of an "unknown" item - * Make a guess at the value of non-aware items +/*! + * @brief 未鑑定なベースアイテムの基本価格を返す / + * Return the "value" of an "unknown" item Make a guess at the value of non-aware items + * @param o_ptr 未鑑定価格を確認したいオブジェクトの構造体参照ポインタ + * @return オブジェクトの未鑑定価格 */ static s32b object_value_base(object_type *o_ptr) { @@ -888,7 +915,13 @@ static s32b object_value_base(object_type *o_ptr) } -/* Return the value of the flags the object has... */ +/*! + * @brief オブジェクトのフラグ類から価格を算出する / + * Return the value of the flags the object has... + * @param o_ptr フラグ価格を確認したいオブジェクトの構造体参照ポインタ + * @param plusses フラグに与える価格の基本重み + * @return オブジェクトのフラグ価格 + */ s32b flag_cost(object_type *o_ptr, int plusses) { s32b total = 0; @@ -988,7 +1021,7 @@ s32b flag_cost(object_type *o_ptr, int plusses) if (have_flag(flgs, TR_EASY_SPELL)) total += 1500; if (have_flag(flgs, TR_THROW)) total += 5000; if (have_flag(flgs, TR_FREE_ACT)) total += 4500; - if (have_flag(flgs, TR_HOLD_LIFE)) total += 8500; + if (have_flag(flgs, TR_HOLD_EXP)) total += 8500; tmp_cost = 0; count = 0; @@ -1096,26 +1129,31 @@ s32b flag_cost(object_type *o_ptr, int plusses) } -/* - * Return the "real" price of a "known" item, not including discounts - * - * Wand and staffs get cost for each charge - * - * Armor is worth an extra 100 gold per bonus point to armor class. - * - * Weapons are worth an extra 100 gold per bonus point (AC,TH,TD). - * - * Missiles are only worth 5 gold per bonus point, since they - * usually appear in groups of 20, and we want the player to get - * the same amount of cash for any "equivalent" item. Note that - * missiles never have any of the "pval" flags, and in fact, they - * only have a few of the available flags, primarily of the "slay" - * and "brand" and "ignore" variety. - * - * Armor with a negative armor bonus is worthless. - * Weapons with negative hit+damage bonuses are worthless. - * - * Every wearable item with a "pval" bonus is worth extra (see below). +/*! + * @brief オブジェクトの真の価格を算出する / + * Return the value of the flags the object has... + * @param o_ptr 本価格を確認したいオブジェクトの構造体参照ポインタ + * @return オブジェクトの本価格 + * @details + * Return the "real" price of a "known" item, not including discounts\n + *\n + * Wand and staffs get cost for each charge\n + *\n + * Armor is worth an extra 100 gold per bonus point to armor class.\n + *\n + * Weapons are worth an extra 100 gold per bonus point (AC,TH,TD).\n + *\n + * Missiles are only worth 5 gold per bonus point, since they\n + * usually appear in groups of 20, and we want the player to get\n + * the same amount of cash for any "equivalent" item. Note that\n + * missiles never have any of the "pval" flags, and in fact, they\n + * only have a few of the available flags, primarily of the "slay"\n + * and "brand" and "ignore" variety.\n + *\n + * Armor with a negative armor bonus is worthless.\n + * Weapons with negative hit+damage bonuses are worthless.\n + *\n + * Every wearable item with a "pval" bonus is worth extra (see below).\n */ s32b object_value_real(object_type *o_ptr) { @@ -1365,16 +1403,19 @@ s32b object_value_real(object_type *o_ptr) } -/* +/*! + * @brief オブジェクト価格算出のメインルーチン / * Return the price of an item including plusses (and charges) - * - * This function returns the "value" of the given item (qty one) - * - * Never notice "unknown" bonuses or properties, including "curses", - * since that would give the player information he did not have. - * - * Note that discounted items stay discounted forever, even if - * the discount is "forgotten" by the player via memory loss. + * @param o_ptr 判明している現価格を確認したいオブジェクトの構造体参照ポインタ + * @return オブジェクトの判明している現価格 + * @details + * This function returns the "value" of the given item (qty one)\n + *\n + * Never notice "unknown" bonuses or properties, including "curses",\n + * since that would give the player information he did not have.\n + *\n + * Note that discounted items stay discounted forever, even if\n + * the discount is "forgotten" by the player via memory loss.\n */ s32b object_value(object_type *o_ptr) { @@ -1417,8 +1458,12 @@ s32b object_value(object_type *o_ptr) } -/* + +/*! + * @brief 破壊可能なアイテムかを返す / * Determines whether an object can be destroyed, and makes fake inscription. + * @param o_ptr 破壊可能かを確認したいオブジェクトの構造体参照ポインタ + * @return オブジェクトが破壊可能ならばTRUEを返す */ bool can_player_destroy_object(object_type *o_ptr) { @@ -1454,21 +1499,21 @@ bool can_player_destroy_object(object_type *o_ptr) } -/* +/*! + * @brief 魔法棒やロッドのスロット分割時に使用回数を分配する / * Distribute charges of rods or wands. - * - * o_ptr = source item - * q_ptr = target item, must be of the same type as o_ptr - * amt = number of items that are transfered + * @param o_ptr 分割元オブジェクトの構造体参照ポインタ source item + * @param q_ptr 分割先オブジェクトの構造体参照ポインタ target item, must be of the same type as o_ptr + * @param amt 分割したい回数量 number of items that are transfered + * @return なし + * @details + * Hack -- If rods or wands are dropped, the total maximum timeout or\n + * charges need to be allocated between the two stacks. If all the items\n + * are being dropped, it makes for a neater message to leave the original\n + * stack's pval alone. -LM-\n */ void distribute_charges(object_type *o_ptr, object_type *q_ptr, int amt) { - /* - * Hack -- If rods or wands are dropped, the total maximum timeout or - * charges need to be allocated between the two stacks. If all the items - * are being dropped, it makes for a neater message to leave the original - * stack's pval alone. -LM- - */ if ((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_ROD)) { q_ptr->pval = o_ptr->pval * amt / o_ptr->number; @@ -1490,13 +1535,18 @@ void distribute_charges(object_type *o_ptr, object_type *q_ptr, int amt) } } +/*! + * @brief 魔法棒やロッドの使用回数を減らす / + * @param o_ptr オブジェクトの構造体参照ポインタ source item + * @param amt 減らしたい回数量 number of items that are transfered + * @return なし + * @details + * Hack -- If rods or wand are destroyed, the total maximum timeout or\n + * charges of the stack needs to be reduced, unless all the items are\n + * being destroyed. -LM-\n + */ void reduce_charges(object_type *o_ptr, int amt) { - /* - * Hack -- If rods or wand are destroyed, the total maximum timeout or - * charges of the stack needs to be reduced, unless all the items are - * being destroyed. -LM- - */ if (((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_ROD)) && (amt < o_ptr->number)) { @@ -1504,7 +1554,6 @@ void reduce_charges(object_type *o_ptr, int amt) } } - /* * Determine if an item can "absorb" a second item * @@ -1532,9 +1581,12 @@ void reduce_charges(object_type *o_ptr, int amt) #define MAX_STACK_SIZE 99 -/* - * Determine if an item can partly absorb a second item. - * Return maximum number of stack. +/*! + * @brief 両オブジェクトをスロットに重ね合わせ可能な最大数を返す。 + * Determine if an item can partly absorb a second item. Return maximum number of stack. + * @param o_ptr 検証したいオブジェクトの構造体参照ポインタ1 + * @param j_ptr 検証したいオブジェクトの構造体参照ポインタ2 + * @return 重ね合わせ可能なアイテム数 */ int object_similar_part(object_type *o_ptr, object_type *j_ptr) { @@ -1736,8 +1788,12 @@ int object_similar_part(object_type *o_ptr, object_type *j_ptr) return max_num; } -/* - * Determine if an item can absorb a second item. +/*! + * @brief 両オブジェクトをスロットに重ねることができるかどうかを返す。 + * Determine if an item can absorb a second item. + * @param o_ptr 検証したいオブジェクトの構造体参照ポインタ1 + * @param j_ptr 検証したいオブジェクトの構造体参照ポインタ2 + * @return 重ね合わせ可能ならばTRUEを返す。 */ bool object_similar(object_type *o_ptr, object_type *j_ptr) { @@ -1759,9 +1815,12 @@ bool object_similar(object_type *o_ptr, object_type *j_ptr) } - -/* +/*! + * @brief 両オブジェクトをスロットに重ね合わせる。 * Allow one item to "absorb" another, assuming they are similar + * @param o_ptr 重ね合わせ先のオブジェクトの構造体参照ポインタ + * @param j_ptr 重ね合わせ元のオブジェクトの構造体参照ポインタ + * @return なし */ void object_absorb(object_type *o_ptr, object_type *j_ptr) { @@ -1811,14 +1870,18 @@ void object_absorb(object_type *o_ptr, object_type *j_ptr) } -/* +/*! + * @brief tvalとsvalに対応するベースアイテムのIDを返す。 * Find the index of the object_kind with the given tval and sval + * @param tval 検索したいベースアイテムのtval + * @param sval 検索したいベースアイテムのsval + * @return なし */ -s16b lookup_kind(int tval, int sval) +IDX lookup_kind(OBJECT_TYPE_VALUE tval, OBJECT_SUBTYPE_VALUE sval) { - int k; + IDX k; int num = 0; - int bk = 0; + IDX bk = 0; /* Look for it */ for (k = 1; k < max_k_idx; k++) @@ -1849,11 +1912,7 @@ s16b lookup_kind(int tval, int sval) #if 0 /* Oops */ -#ifdef JP - msg_format("¥¢¥¤¥Æ¥à¤¬¤Ê¤¤ (%d,%d)", tval, sval); -#else - msg_format("No object (%d,%d)", tval, sval); -#endif + msg_format(_("アイテムがない (%d,%d)", "No object (%d,%d)"), tval, sval); #endif @@ -1862,8 +1921,11 @@ s16b lookup_kind(int tval, int sval) } -/* +/*! + * @brief オブジェクトを初期化する * Wipe an object clean. + * @param o_ptr 初期化したいオブジェクトの構造体参照ポインタ + * @return なし */ void object_wipe(object_type *o_ptr) { @@ -1872,8 +1934,12 @@ void object_wipe(object_type *o_ptr) } -/* - * Prepare an object based on an existing object +/*! + * @brief オブジェクトを複製する + * Wipe an object clean. + * @param o_ptr 複製元のオブジェクトの構造体参照ポインタ + * @param j_ptr 複製先のオブジェクトの構造体参照ポインタ + * @return なし */ void object_copy(object_type *o_ptr, object_type *j_ptr) { @@ -1882,10 +1948,14 @@ void object_copy(object_type *o_ptr, object_type *j_ptr) } -/* +/*! + * @brief オブジェクト構造体にベースアイテムを作成する * Prepare an object based on an object kind. + * @param o_ptr 代入したいオブジェクトの構造体参照ポインタ + * @param k_idx 新たに作成したいベースアイテム情報のID + * @return なし */ -void object_prep(object_type *o_ptr, int k_idx) +void object_prep(object_type *o_ptr, KIND_OBJECT_IDX k_idx) { object_kind *k_ptr = &k_info[k_idx]; @@ -1919,7 +1989,7 @@ void object_prep(object_type *o_ptr, int k_idx) o_ptr->ds = k_ptr->ds; /* Default activation */ - if (k_ptr->act_idx > 0) o_ptr->xtra2 = k_ptr->act_idx; + if (k_ptr->act_idx > 0) o_ptr->xtra2 = (XTRA8)k_ptr->act_idx; /* Hack -- worthless items are always "broken" */ if (k_info[o_ptr->k_idx].cost <= 0) o_ptr->ident |= (IDENT_BROKEN); @@ -1934,46 +2004,50 @@ void object_prep(object_type *o_ptr, int k_idx) } -/* +/*! + * @brief 上質以上のオブジェクトに与えるための各種ボーナスを正規乱数も加えて算出する。 * Help determine an "enchantment bonus" for an object. - * - * To avoid floating point but still provide a smooth distribution of bonuses, - * we simply round the results of division in such a way as to "average" the - * correct floating point value. - * - * This function has been changed. It uses "randnor()" to choose values from - * a normal distribution, whose mean moves from zero towards the max as the - * level increases, and whose standard deviation is equal to 1/4 of the max, - * and whose values are forced to lie between zero and the max, inclusive. - * - * Since the "level" rarely passes 100 before Morgoth is dead, it is very - * rare to get the "full" enchantment on an object, even a deep levels. - * - * It is always possible (albeit unlikely) to get the "full" enchantment. - * - * A sample distribution of values from "m_bonus(10, N)" is shown below: - * - * N 0 1 2 3 4 5 6 7 8 9 10 - * --- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- - * 0 66.37 13.01 9.73 5.47 2.89 1.31 0.72 0.26 0.12 0.09 0.03 - * 8 46.85 24.66 12.13 8.13 4.20 2.30 1.05 0.36 0.19 0.08 0.05 - * 16 30.12 27.62 18.52 10.52 6.34 3.52 1.95 0.90 0.31 0.15 0.05 - * 24 22.44 15.62 30.14 12.92 8.55 5.30 2.39 1.63 0.62 0.28 0.11 - * 32 16.23 11.43 23.01 22.31 11.19 7.18 4.46 2.13 1.20 0.45 0.41 - * 40 10.76 8.91 12.80 29.51 16.00 9.69 5.90 3.43 1.47 0.88 0.65 - * 48 7.28 6.81 10.51 18.27 27.57 11.76 7.85 4.99 2.80 1.22 0.94 - * 56 4.41 4.73 8.52 11.96 24.94 19.78 11.06 7.18 3.68 1.96 1.78 - * 64 2.81 3.07 5.65 9.17 13.01 31.57 13.70 9.30 6.04 3.04 2.64 - * 72 1.87 1.99 3.68 7.15 10.56 20.24 25.78 12.17 7.52 4.42 4.62 - * 80 1.02 1.23 2.78 4.75 8.37 12.04 27.61 18.07 10.28 6.52 7.33 - * 88 0.70 0.57 1.56 3.12 6.34 10.06 15.76 30.46 12.58 8.47 10.38 - * 96 0.27 0.60 1.25 2.28 4.30 7.60 10.77 22.52 22.51 11.37 16.53 - * 104 0.22 0.42 0.77 1.36 2.62 5.33 8.93 13.05 29.54 15.23 22.53 - * 112 0.15 0.20 0.56 0.87 2.00 3.83 6.86 10.06 17.89 27.31 30.27 - * 120 0.03 0.11 0.31 0.46 1.31 2.48 4.60 7.78 11.67 25.53 45.72 - * 128 0.02 0.01 0.13 0.33 0.83 1.41 3.24 6.17 9.57 14.22 64.07 + * @param max ボーナス値の限度 + * @param level ボーナス値に加味する基準生成階 + * @return 算出されたボーナス値 + * @details + * To avoid floating point but still provide a smooth distribution of bonuses,\n + * we simply round the results of division in such a way as to "average" the\n + * correct floating point value.\n + *\n + * This function has been changed. It uses "randnor()" to choose values from\n + * a normal distribution, whose mean moves from zero towards the max as the\n + * level increases, and whose standard deviation is equal to 1/4 of the max,\n + * and whose values are forced to lie between zero and the max, inclusive.\n + *\n + * Since the "level" rarely passes 100 before Morgoth is dead, it is very\n + * rare to get the "full" enchantment on an object, even a deep levels.\n + *\n + * It is always possible (albeit unlikely) to get the "full" enchantment.\n + *\n + * A sample distribution of values from "m_bonus(10, N)" is shown below:\n + *\n + * N 0 1 2 3 4 5 6 7 8 9 10\n + * --- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----\n + * 0 66.37 13.01 9.73 5.47 2.89 1.31 0.72 0.26 0.12 0.09 0.03\n + * 8 46.85 24.66 12.13 8.13 4.20 2.30 1.05 0.36 0.19 0.08 0.05\n + * 16 30.12 27.62 18.52 10.52 6.34 3.52 1.95 0.90 0.31 0.15 0.05\n + * 24 22.44 15.62 30.14 12.92 8.55 5.30 2.39 1.63 0.62 0.28 0.11\n + * 32 16.23 11.43 23.01 22.31 11.19 7.18 4.46 2.13 1.20 0.45 0.41\n + * 40 10.76 8.91 12.80 29.51 16.00 9.69 5.90 3.43 1.47 0.88 0.65\n + * 48 7.28 6.81 10.51 18.27 27.57 11.76 7.85 4.99 2.80 1.22 0.94\n + * 56 4.41 4.73 8.52 11.96 24.94 19.78 11.06 7.18 3.68 1.96 1.78\n + * 64 2.81 3.07 5.65 9.17 13.01 31.57 13.70 9.30 6.04 3.04 2.64\n + * 72 1.87 1.99 3.68 7.15 10.56 20.24 25.78 12.17 7.52 4.42 4.62\n + * 80 1.02 1.23 2.78 4.75 8.37 12.04 27.61 18.07 10.28 6.52 7.33\n + * 88 0.70 0.57 1.56 3.12 6.34 10.06 15.76 30.46 12.58 8.47 10.38\n + * 96 0.27 0.60 1.25 2.28 4.30 7.60 10.77 22.52 22.51 11.37 16.53\n + * 104 0.22 0.42 0.77 1.36 2.62 5.33 8.93 13.05 29.54 15.23 22.53\n + * 112 0.15 0.20 0.56 0.87 2.00 3.83 6.86 10.06 17.89 27.31 30.27\n + * 120 0.03 0.11 0.31 0.46 1.31 2.48 4.60 7.78 11.67 25.53 45.72\n + * 128 0.02 0.01 0.13 0.33 0.83 1.41 3.24 6.17 9.57 14.22 64.07\n */ -s16b m_bonus(int max, int level) +int m_bonus(int max, DEPTH level) { int bonus, stand, extra, value; @@ -2016,153 +2090,109 @@ s16b m_bonus(int max, int level) } -/* - * Cheat -- describe a created object for the user +/*! + * @brief デバッグ時にアイテム生成情報をメッセージに出力する / Cheat -- describe a created object for the user + * @param o_ptr デバッグ出力するオブジェクトの構造体参照ポインタ + * @return なし */ static void object_mention(object_type *o_ptr) { char o_name[MAX_NLEN]; - /* Describe */ - object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE)); - - /* Artifact */ - if (object_is_fixed_artifact(o_ptr)) - { - /* Silly message */ -#ifdef JP - msg_format("ÅÁÀâ¤Î¥¢¥¤¥Æ¥à (%s)", o_name); -#else - msg_format("Artifact (%s)", o_name); -#endif - - } - - /* Random Artifact */ - else if (o_ptr->art_name) - { -#ifdef JP - msg_print("¥é¥ó¥À¥à¡¦¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È"); -#else - msg_print("Random artifact"); -#endif - - } - - /* Ego-item */ - else if (object_is_ego(o_ptr)) - { - /* Silly message */ -#ifdef JP - msg_format("̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à (%s)", o_name); -#else - msg_format("Ego-item (%s)", o_name); -#endif - - } + object_aware(o_ptr); + object_known(o_ptr); - /* Normal item */ - else - { - /* Silly message */ -#ifdef JP - msg_format("¥¢¥¤¥Æ¥à (%s)", o_name); -#else - msg_format("Object (%s)", o_name); -#endif + /* Mark the item as fully known */ + o_ptr->ident |= (IDENT_MENTAL); - } + /* Description */ + object_desc(o_name, o_ptr, 0); + msg_format_wizard(CHEAT_OBJECT, _("%sを生成しました。", "%s was generated."), o_name); } - -/* +/*! + * @brief INSTA_ART型の固定アーティファクトの生成を確率に応じて試行する。 * Mega-Hack -- Attempt to create one of the "Special Objects" - * - * We are only called from "make_object()", and we assume that - * "apply_magic()" is called immediately after we return. - * - * Note -- see "make_artifact()" and "apply_magic()" + * @param o_ptr 生成に割り当てたいオブジェクトの構造体参照ポインタ + * @return 生成に成功したらTRUEを返す。 + * @details + * We are only called from "make_object()", and we assume that\n + * "apply_magic()" is called immediately after we return.\n + *\n + * Note -- see "make_artifact()" and "apply_magic()"\n */ static bool make_artifact_special(object_type *o_ptr) { - int i; - int k_idx = 0; + IDX i; + IDX k_idx = 0; - - /* No artifacts in the town */ + /*! @note 地上ではキャンセルする / No artifacts in the town */ if (!dun_level) return (FALSE); - /* Themed object */ + /*! @note get_obj_num_hookによる指定がある場合は生成をキャンセルする / Themed object */ if (get_obj_num_hook) return (FALSE); - /* Check the artifact list (just the "specials") */ + /*! @note 全固定アーティファクト中からIDの若い順に生成対象とその確率を走査する / Check the artifact list (just the "specials") */ for (i = 0; i < max_a_idx; i++) { artifact_type *a_ptr = &a_info[i]; - /* Skip "empty" artifacts */ + /*! @note アーティファクト名が空の不正なデータは除外する / Skip "empty" artifacts */ if (!a_ptr->name) continue; - /* Cannot make an artifact twice */ + /*! @note 既に生成回数がカウントされたアーティファクト、QUESTITEMと非INSTA_ARTは除外 / Cannot make an artifact twice */ if (a_ptr->cur_num) continue; - if (a_ptr->gen_flags & TRG_QUESTITEM) continue; if (!(a_ptr->gen_flags & TRG_INSTA_ART)) continue; - /* XXX XXX Enforce minimum "depth" (loosely) */ - if (a_ptr->level > dun_level) + /*! @note アーティファクト生成階が現在に対して足りない場合は高確率で1/(不足階層*2)を満たさないと生成リストに加えられない / + * XXX XXX Enforce minimum "depth" (loosely) */ + if (a_ptr->level > object_level) { - /* Acquire the "out-of-depth factor" */ - int d = (a_ptr->level - dun_level) * 2; - - /* Roll for out-of-depth creation */ + /* @note / Acquire the "out-of-depth factor". Roll for out-of-depth creation. */ + int d = (a_ptr->level - object_level) * 2; if (!one_in_(d)) continue; } - /* Artifact "rarity roll" */ + /*! @note 1/(レア度)の確率を満たさないと除外される / Artifact "rarity roll" */ if (!one_in_(a_ptr->rarity)) continue; - /* Find the base object */ + /*! @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); - - /* XXX XXX Enforce minimum "object" level (loosely) */ if (k_info[k_idx].level > object_level) { - /* Acquire the "out-of-depth factor" */ int d = (k_info[k_idx].level - object_level) * 5; - - /* Roll for out-of-depth creation */ if (!one_in_(d)) continue; } - /* Assign the template */ + /*! @note 前述の条件を満たしたら、後のIDのアーティファクトはチェックせずすぐ確定し生成処理に移す / + * Assign the template. Mega-Hack -- mark the item as an artifact. Hack: Some artifacts get random extra powers. Success. */ object_prep(o_ptr, k_idx); - /* Mega-Hack -- mark the item as an artifact */ o_ptr->name1 = i; - - /* Hack: Some artifacts get random extra powers */ random_artifact_resistance(o_ptr, a_ptr); - - /* Success */ return (TRUE); } - /* Failure */ + /*! @note 全INSTA_ART固定アーティファクトを試行しても決まらなかった場合 FALSEを返す / Failure */ return (FALSE); } -/* - * Attempt to change an object into an artifact - * - * This routine should only be called by "apply_magic()" - * - * Note -- see "make_artifact_special()" and "apply_magic()" +/*! + * @brief 非INSTA_ART型の固定アーティファクトの生成を確率に応じて試行する。 + * Mega-Hack -- Attempt to create one of the "Special Objects" + * @param o_ptr 生成に割り当てたいオブジェクトの構造体参照ポインタ + * @return 生成に成功したらTRUEを返す。 + * @details + * Attempt to change an object into an artifact\n + * This routine should only be called by "apply_magic()"\n + * Note -- see "make_artifact_special()" and "apply_magic()"\n */ static bool make_artifact(object_type *o_ptr) { - int i; + IDX i; /* No artifacts in the town */ @@ -2218,8 +2248,12 @@ static bool make_artifact(object_type *o_ptr) } -/* - * Choose random ego type +/*! + * @brief アイテムのエゴをレア度の重みに合わせてランダムに選択する + * Choose random ego type + * @param slot 取得したいエゴの装備部位 + * @param good TRUEならば通常のエゴ、FALSEならば呪いのエゴが選択対象となる。 + * @return 選択されたエゴ情報のID、万一選択できなかった場合はmax_e_idxが返る。 */ static byte get_random_ego(byte slot, bool good) { @@ -2258,19 +2292,24 @@ static byte get_random_ego(byte slot, bool good) } -/* +/*! + * @brief 武器系オブジェクトに生成ランクごとの強化を与えるサブルーチン * Apply magic to an item known to be a "weapon" - * - * Hack -- note special base damage dice boosting - * Hack -- note special processing for weapon/digger + * @param o_ptr 強化を与えたいオブジェクトの構造体参照ポインタ + * @param level 生成基準階 + * @param power 生成ランク + * @return なし + * @details + * Hack -- note special base damage dice boosting\n + * Hack -- note special processing for weapon/digger\n */ -static void a_m_aux_1(object_type *o_ptr, int level, int power) +static void a_m_aux_1(object_type *o_ptr, DEPTH level, int power) { - int tohit1 = randint1(5) + m_bonus(5, level); - int todam1 = randint1(5) + m_bonus(5, level); + HIT_PROB tohit1 = randint1(5) + (HIT_PROB)m_bonus(5, level); + HIT_POINT todam1 = randint1(5) + (HIT_POINT)m_bonus(5, level); - int tohit2 = m_bonus(10, level); - int todam2 = m_bonus(10, level); + HIT_PROB tohit2 = (HIT_PROB)m_bonus(10, level); + HIT_POINT todam2 = (HIT_POINT)m_bonus(10, level); if ((o_ptr->tval == TV_BOLT) || (o_ptr->tval == TV_ARROW) || (o_ptr->tval == TV_SHOT)) { @@ -2428,20 +2467,20 @@ static void a_m_aux_1(object_type *o_ptr, int level, int power) break; case EGO_PATTERN: if (one_in_(3)) - add_flag(o_ptr->art_flags, TR_HOLD_LIFE); + add_flag(o_ptr->art_flags, TR_HOLD_EXP); if (one_in_(3)) add_flag(o_ptr->art_flags, TR_DEX); if (one_in_(5)) add_flag(o_ptr->art_flags, TR_RES_FEAR); break; case EGO_SHARPNESS: - o_ptr->pval = m_bonus(5, level) + 1; + o_ptr->pval = (PARAMETER_VALUE)m_bonus(5, level) + 1; break; case EGO_EARTHQUAKES: if (one_in_(3) && (level > 60)) add_flag(o_ptr->art_flags, TR_BLOWS); else - o_ptr->pval = m_bonus(3, level); + o_ptr->pval = (PARAMETER_VALUE)m_bonus(3, level); break; case EGO_VAMPIRIC: if (one_in_(5)) @@ -2570,7 +2609,11 @@ static void a_m_aux_1(object_type *o_ptr, int level, int power) } } - +/*! + * @brief ドラゴン装備にランダムな耐性を与える + * @param o_ptr 強化を与えたいオブジェクトの構造体参照ポインタ + * @return なし + */ static void dragon_resist(object_type * o_ptr) { do @@ -2583,7 +2626,11 @@ static void dragon_resist(object_type * o_ptr) while (one_in_(2)); } - +/*! + * @brief オブジェクトにランダムな強いESPを与える + * @param o_ptr 強化を与えたいオブジェクトの構造体参照ポインタ + * @return なし + */ static bool add_esp_strong(object_type *o_ptr) { bool nonliv = FALSE; @@ -2598,7 +2645,12 @@ static bool add_esp_strong(object_type *o_ptr) return nonliv; } - +/*! + * @brief オブジェクトにランダムな弱いESPを与える + * @param o_ptr 強化を与えたいオブジェクトの構造体参照ポインタ + * @param extra TRUEならばESPの最大付与数が増える(TRUE -> 3+1d6 / FALSE -> 1d3) + * @return なし + */ static void add_esp_weak(object_type *o_ptr, bool extra) { int i; @@ -2628,17 +2680,21 @@ static void add_esp_weak(object_type *o_ptr, bool extra) } -/* +/*! + * @brief 防具系オブジェクトに生成ランクごとの強化を与えるサブルーチン * Apply magic to an item known to be "armor" - * - * Hack -- note special processing for crown/helm - * Hack -- note special processing for robe of permanence + * @param o_ptr 強化を与えたいオブジェクトの構造体参照ポインタ + * @param level 生成基準階 + * @param power 生成ランク + * @return なし + * @details + * Hack -- note special processing for crown/helm\n + * Hack -- note special processing for robe of permanence\n */ static void a_m_aux_2(object_type *o_ptr, int level, int power) { - int toac1 = randint1(5) + m_bonus(5, level); - - int toac2 = m_bonus(10, level); + ARMOUR_CLASS toac1 = (ARMOUR_CLASS)randint1(5) + m_bonus(5, level); + ARMOUR_CLASS toac2 = (ARMOUR_CLASS)m_bonus(10, level); /* Good */ if (power > 0) @@ -2679,10 +2735,6 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power) { if (one_in_(50) || (power > 2)) /* power > 2 is debug only */ create_artifact(o_ptr, FALSE); - - /* Mention the item */ - if (cheat_peek) object_mention(o_ptr); - break; } @@ -2726,24 +2778,23 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power) switch (o_ptr->name2) { - case EGO_DWARVEN: - if (o_ptr->tval != TV_HARD_ARMOR) - { - okay_flag = FALSE; - break; - } - case EGO_DRUID: - if (o_ptr->tval != TV_SOFT_ARMOR) - { - okay_flag = FALSE; - break; - } - default: + case EGO_DWARVEN: + if (o_ptr->tval != TV_HARD_ARMOR) + { + okay_flag = FALSE; + } + break; + case EGO_DRUID: + if (o_ptr->tval != TV_SOFT_ARMOR) + { + okay_flag = FALSE; + } + break; + default: break; } - if (okay_flag) - break; + if (okay_flag) break; } switch (o_ptr->name2) { @@ -2794,8 +2845,6 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power) if (o_ptr->sval == SV_DRAGON_SHIELD) { - /* Mention the item */ - if (cheat_peek) object_mention(o_ptr); dragon_resist(o_ptr); if (!one_in_(3)) break; } @@ -2844,8 +2893,6 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power) { if (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES) { - /* Mention the item */ - if (cheat_peek) object_mention(o_ptr); dragon_resist(o_ptr); if (!one_in_(3)) break; } @@ -2872,8 +2919,6 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power) { if (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE) { - /* Mention the item */ - if (cheat_peek) object_mention(o_ptr); dragon_resist(o_ptr); if (!one_in_(3)) break; } @@ -2980,8 +3025,6 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power) { if (o_ptr->sval == SV_DRAGON_HELM) { - /* Mention the item */ - if (cheat_peek) object_mention(o_ptr); dragon_resist(o_ptr); if (!one_in_(3)) break; } @@ -3080,7 +3123,7 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power) o_ptr->to_d -= 6; o_ptr->to_h -= 6; break; - case EGO_NAZGUL: + case EGO_NAZGUL: o_ptr->to_d -= 3; o_ptr->to_h -= 3; if (one_in_(3)) add_flag(o_ptr->art_flags, TR_COWARDICE); @@ -3101,14 +3144,20 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power) break; } } + } -/* +/*! + * @brief 装飾品系オブジェクトに生成ランクごとの強化を与えるサブルーチン * Apply magic to an item known to be a "ring" or "amulet" - * - * Hack -- note special "pval boost" code for ring of speed - * Hack -- note that some items must be cursed (or blessed) + * @param o_ptr 強化を与えたいオブジェクトの構造体参照ポインタ + * @param level 生成基準階 + * @param power 生成ランク + * @return なし + * @details + * Hack -- note special "pval boost" code for ring of speed\n + * Hack -- note that some items must be cursed (or blessed)\n */ static void a_m_aux_3(object_type *o_ptr, int level, int power) { @@ -3123,7 +3172,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power) case SV_RING_ATTACKS: { /* Stat bonus */ - o_ptr->pval = m_bonus(2, level); + o_ptr->pval = (PARAMETER_VALUE)m_bonus(2, level); if (one_in_(15)) o_ptr->pval++; if (o_ptr->pval < 1) o_ptr->pval = 1; @@ -3154,7 +3203,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power) case SV_RING_DEX: { /* Stat bonus */ - o_ptr->pval = 1 + m_bonus(5, level); + o_ptr->pval = 1 + (PARAMETER_VALUE)m_bonus(5, level); /* Cursed */ if (power < 0) @@ -3176,7 +3225,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power) case SV_RING_SPEED: { /* Base speed (1 to 10) */ - o_ptr->pval = randint1(5) + m_bonus(5, level); + o_ptr->pval = randint1(5) + (PARAMETER_VALUE)m_bonus(5, level); /* Super-charge the ring */ while (randint0(100) < 50) o_ptr->pval++; @@ -3196,9 +3245,6 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power) break; } - /* Mention the item */ - if (cheat_peek) object_mention(o_ptr); - break; } @@ -3211,7 +3257,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power) while (one_in_(4)); /* Bonus to armor class */ - o_ptr->to_a = 10 + randint1(5) + m_bonus(10, level); + o_ptr->to_a = 10 + randint1(5) + (ARMOUR_CLASS)m_bonus(10, level); } break; @@ -3225,7 +3271,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power) case SV_RING_SEARCHING: { /* Bonus to searching */ - o_ptr->pval = 1 + m_bonus(5, level); + o_ptr->pval = 1 + (PARAMETER_VALUE)m_bonus(5, level); /* Cursed */ if (power < 0) @@ -3250,7 +3296,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power) case SV_RING_ELEC: { /* Bonus to armor class */ - o_ptr->to_a = 5 + randint1(5) + m_bonus(10, level); + o_ptr->to_a = 5 + randint1(5) + (ARMOUR_CLASS)m_bonus(10, level); break; } @@ -3265,7 +3311,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power) o_ptr->curse_flags |= TRC_CURSED; /* Penalize */ - o_ptr->pval = 0 - (1 + m_bonus(5, level)); + o_ptr->pval = 0 - (1 + (PARAMETER_VALUE)m_bonus(5, level)); if (power > 0) power = 0 - power; break; @@ -3281,8 +3327,8 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power) o_ptr->curse_flags |= TRC_CURSED; /* Penalize */ - o_ptr->to_a = 0 - (5 + m_bonus(10, level)); - o_ptr->pval = 0 - (1 + m_bonus(5, level)); + o_ptr->to_a = 0 - (5 + (ARMOUR_CLASS)m_bonus(10, level)); + o_ptr->pval = 0 - (1 + (PARAMETER_VALUE)m_bonus(5, level)); if (power > 0) power = 0 - power; break; @@ -3292,7 +3338,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power) case SV_RING_DAMAGE: { /* Bonus to damage */ - o_ptr->to_d = 1 + randint1(5) + m_bonus(16, level); + o_ptr->to_d = 1 + randint1(5) + (HIT_POINT)m_bonus(16, level); /* Cursed */ if (power < 0) @@ -3314,7 +3360,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power) case SV_RING_ACCURACY: { /* Bonus to hit */ - o_ptr->to_h = 1 + randint1(5) + m_bonus(16, level); + o_ptr->to_h = 1 + randint1(5) + (HIT_PROB)m_bonus(16, level); /* Cursed */ if (power < 0) @@ -3336,7 +3382,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power) case SV_RING_PROTECTION: { /* Bonus to armor class */ - o_ptr->to_a = 5 + randint1(8) + m_bonus(10, level); + o_ptr->to_a = 5 + randint1(8) + (ARMOUR_CLASS)m_bonus(10, level); /* Cursed */ if (power < 0) @@ -3358,8 +3404,8 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power) case SV_RING_SLAYING: { /* Bonus to damage and to hit */ - o_ptr->to_d = randint1(5) + m_bonus(12, level); - o_ptr->to_h = randint1(5) + m_bonus(12, level); + o_ptr->to_d = randint1(5) + (HIT_POINT)m_bonus(12, level); + o_ptr->to_h = randint1(5) + (HIT_PROB)m_bonus(12, level); /* Cursed */ if (power < 0) @@ -3380,7 +3426,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power) case SV_RING_MUSCLE: { - o_ptr->pval = 1 + m_bonus(3, level); + o_ptr->pval = 1 + (PARAMETER_VALUE)m_bonus(3, level); if (one_in_(4)) o_ptr->pval++; /* Cursed */ @@ -3617,7 +3663,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power) case SV_AMULET_WISDOM: case SV_AMULET_CHARISMA: { - o_ptr->pval = 1 + m_bonus(5, level); + o_ptr->pval = 1 + (PARAMETER_VALUE)m_bonus(5, level); /* Cursed */ if (power < 0) @@ -3676,7 +3722,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power) /* Amulet of searching */ case SV_AMULET_SEARCHING: { - o_ptr->pval = randint1(2) + m_bonus(4, level); + o_ptr->pval = randint1(2) + (PARAMETER_VALUE)m_bonus(4, level); /* Cursed */ if (power < 0) @@ -3697,15 +3743,12 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power) /* Amulet of the Magi -- never cursed */ case SV_AMULET_THE_MAGI: { - o_ptr->pval = randint1(5) + m_bonus(5, level); - o_ptr->to_a = randint1(5) + m_bonus(5, level); + o_ptr->pval = randint1(5) + (PARAMETER_VALUE)m_bonus(5, level); + o_ptr->to_a = randint1(5) + (ARMOUR_CLASS)m_bonus(5, level); /* gain one low ESP */ add_esp_weak(o_ptr, FALSE); - /* Mention the item */ - if (cheat_peek) object_mention(o_ptr); - break; } @@ -3719,8 +3762,8 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power) o_ptr->curse_flags |= (TRC_CURSED); /* Penalize */ - o_ptr->pval = 0 - (randint1(5) + m_bonus(5, level)); - o_ptr->to_a = 0 - (randint1(5) + m_bonus(5, level)); + o_ptr->pval = 0 - (randint1(5) + (PARAMETER_VALUE)m_bonus(5, level)); + o_ptr->to_a = 0 - (randint1(5) + (ARMOUR_CLASS)m_bonus(5, level)); if (power > 0) power = 0 - power; break; @@ -3728,7 +3771,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power) case SV_AMULET_MAGIC_MASTERY: { - o_ptr->pval = 1 + m_bonus(4, level); + o_ptr->pval = 1 + (PARAMETER_VALUE)m_bonus(4, level); /* Cursed */ if (power < 0) @@ -3773,8 +3816,8 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power) o_ptr->name2 = EGO_AMU_SEE_INVIS; break; case 7: case 8: - if (have_flag(k_ptr->flags, TR_HOLD_LIFE)) break; - o_ptr->name2 = EGO_AMU_HOLD_LIFE; + if (have_flag(k_ptr->flags, TR_HOLD_EXP)) break; + o_ptr->name2 = EGO_AMU_HOLD_EXP; break; case 9: if (have_flag(k_ptr->flags, TR_LEVITATION)) break; @@ -3895,11 +3938,12 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power) } } - -/* - * Hack -- help pick an item type +/*! + * @brief モンスターが人形のベースにできるかを返す + * @param r_idx チェックしたいモンスター種族のID + * @return 人形にできるならTRUEを返す */ -static bool item_monster_okay(int r_idx) +static bool item_monster_okay(MONRACE_IDX r_idx) { monster_race *r_ptr = &r_info[r_idx]; @@ -3916,9 +3960,14 @@ static bool item_monster_okay(int r_idx) } -/* +/*! + * @brief その他雑多のオブジェクトに生成ランクごとの強化を与えるサブルーチン * Apply magic to an item known to be "boring" - * + * @param o_ptr 強化を与えたいオブジェクトの構造体参照ポインタ + * @param level 生成基準階 + * @param power 生成ランク + * @return なし + * @details * Hack -- note the special code for various items */ static void a_m_aux_4(object_type *o_ptr, int level, int power) @@ -4048,7 +4097,7 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power) case TV_FIGURINE: { - int i = 1; + PARAMETER_VALUE i = 1; int check; monster_race *r_ptr; @@ -4082,24 +4131,12 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power) /* Some figurines are cursed */ if (one_in_(6)) o_ptr->curse_flags |= TRC_CURSED; - if (cheat_peek) - { -#ifdef JP - msg_format("%s¤Î¿Í·Á, ¿¼¤µ +%d%s", -#else - msg_format("Figurine of %s, depth +%d%s", -#endif - - r_name + r_ptr->name, check - 1, - !object_is_cursed(o_ptr) ? "" : " {cursed}"); - } - break; } case TV_CORPSE: { - int i = 1; + PARAMETER_VALUE i = 1; int check; u32b match = 0; @@ -4141,16 +4178,6 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power) o_ptr->pval = i; - if (cheat_peek) - { -#ifdef JP - msg_format("%s¤Î»àÂÎ, ¿¼¤µ +%d", -#else - msg_format("Corpse of %s, depth +%d", -#endif - - r_name + r_ptr->name, check - 1); - } object_aware(o_ptr); object_known(o_ptr); @@ -4159,7 +4186,7 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power) case TV_STATUE: { - int i = 1; + PARAMETER_VALUE i = 1; monster_race *r_ptr; @@ -4180,12 +4207,7 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power) if (cheat_peek) { -#ifdef JP - msg_format("%s¤ÎÁü", r_name + r_ptr->name); -#else - msg_format("Statue of %s", r_name + r_ptr->name); -#endif - + msg_format(_("%sの像", "Statue of %s"), r_name + r_ptr->name); } object_aware(o_ptr); object_known(o_ptr); @@ -4195,7 +4217,7 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power) case TV_CHEST: { - byte obj_level = k_info[o_ptr->k_idx].level; + DEPTH obj_level = k_info[o_ptr->k_idx].level; /* Hack -- skip ruined chests */ if (obj_level <= 0) break; @@ -4214,39 +4236,43 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power) } } - -/* +/*! + * @brief 生成されたベースアイテムに魔法的な強化を与えるメインルーチン * Complete the "creation" of an object by applying "magic" to the item - * - * This includes not only rolling for random bonuses, but also putting the - * finishing touches on ego-items and artifacts, giving charges to wands and - * staffs, giving fuel to lites, and placing traps on chests. - * - * In particular, note that "Instant Artifacts", if "created" by an external - * routine, must pass through this function to complete the actual creation. - * - * The base "chance" of the item being "good" increases with the "level" - * parameter, which is usually derived from the dungeon level, being equal - * to the level plus 10, up to a maximum of 75. If "good" is true, then - * the object is guaranteed to be "good". If an object is "good", then - * the chance that the object will be "great" (ego-item or artifact), also - * increases with the "level", being equal to half the level, plus 5, up to - * a maximum of 20. If "great" is true, then the object is guaranteed to be - * "great". At dungeon level 65 and below, 15/100 objects are "great". - * - * If the object is not "good", there is a chance it will be "cursed", and - * if it is "cursed", there is a chance it will be "broken". These chances - * are related to the "good" / "great" chances above. - * - * Otherwise "normal" rings and amulets will be "good" half the time and - * "cursed" half the time, unless the ring/amulet is always good or cursed. - * - * If "okay" is true, and the object is going to be "great", then there is - * a chance that an artifact will be created. This is true even if both the - * "good" and "great" arguments are false. As a total hack, if "great" is - * true, then the item gets 3 extra "attempts" to become an artifact. - */ -void apply_magic(object_type *o_ptr, int lev, u32b mode) + * @param o_ptr 強化を与えたいオブジェクトの構造体参照ポインタ + * @param lev 生成基準階 + * @param mode 生成オプション + * @return なし + * @details + * This includes not only rolling for random bonuses, but also putting the\n + * finishing touches on ego-items and artifacts, giving charges to wands and\n + * staffs, giving fuel to lites, and placing traps on chests.\n + *\n + * In particular, note that "Instant Artifacts", if "created" by an external\n + * routine, must pass through this function to complete the actual creation.\n + *\n + * The base "chance" of the item being "good" increases with the "level"\n + * parameter, which is usually derived from the dungeon level, being equal\n + * to the level plus 10, up to a maximum of 75. If "good" is true, then\n + * the object is guaranteed to be "good". If an object is "good", then\n + * the chance that the object will be "great" (ego-item or artifact), also\n + * increases with the "level", being equal to half the level, plus 5, up to\n + * a maximum of 20. If "great" is true, then the object is guaranteed to be\n + * "great". At dungeon level 65 and below, 15/100 objects are "great".\n + *\n + * If the object is not "good", there is a chance it will be "cursed", and\n + * if it is "cursed", there is a chance it will be "broken". These chances\n + * are related to the "good" / "great" chances above.\n + *\n + * Otherwise "normal" rings and amulets will be "good" half the time and\n + * "cursed" half the time, unless the ring/amulet is always good or cursed.\n + *\n + * If "okay" is true, and the object is going to be "great", then there is\n + * a chance that an artifact will be created. This is true even if both the\n + * "good" and "great" arguments are false. As a total hack, if "great" is\n + * true, then the item gets 3 extra "attempts" to become an artifact.\n + */ +void apply_magic(object_type *o_ptr, DEPTH lev, BIT_FLAGS mode) { int i, rolls, f1, f2, power; @@ -4389,10 +4415,6 @@ void apply_magic(object_type *o_ptr, int lev, u32b mode) if (a_ptr->gen_flags & (TRG_RANDOM_CURSE1)) o_ptr->curse_flags |= get_curse(1, o_ptr); if (a_ptr->gen_flags & (TRG_RANDOM_CURSE2)) o_ptr->curse_flags |= get_curse(2, o_ptr); - - /* Cheat -- peek at the item */ - if (cheat_peek) object_mention(o_ptr); - /* Done */ return; } @@ -4515,7 +4537,7 @@ void apply_magic(object_type *o_ptr, int lev, u32b mode) } /* Hack -- apply activatin index if needed */ - if (e_ptr->act_idx) o_ptr->xtra2 = e_ptr->act_idx; + if (e_ptr->act_idx) o_ptr->xtra2 = (XTRA8)e_ptr->act_idx; /* Hack -- apply extra penalties if needed */ if ((object_is_cursed(o_ptr) || object_is_broken(o_ptr)) && !(e_ptr->gen_flags & (TRG_POWERFUL))) @@ -4629,9 +4651,6 @@ void apply_magic(object_type *o_ptr, int lev, u32b mode) if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_HAYABUSA) && (o_ptr->pval > 2) && (o_ptr->name2 != EGO_ATTACKS)) o_ptr->pval = 2; } - - /* Cheat -- describe the item */ - if (cheat_peek) object_mention(o_ptr); /* Done */ return; @@ -4653,13 +4672,18 @@ void apply_magic(object_type *o_ptr, int lev, u32b mode) if (k_ptr->gen_flags & (TRG_RANDOM_CURSE1)) o_ptr->curse_flags |= get_curse(1, o_ptr); if (k_ptr->gen_flags & (TRG_RANDOM_CURSE2)) o_ptr->curse_flags |= get_curse(2, o_ptr); } + + } -/* +/*! + * @brief ベースアイテムが上質として扱われるかどうかを返す。 * Hack -- determine if a template is "good" + * @param k_idx 判定したいベースアイテムのID + * @return ベースアイテムが上質ならばTRUEを返す。 */ -static bool kind_is_good(int k_idx) +static bool kind_is_good(KIND_OBJECT_IDX k_idx) { object_kind *k_ptr = &k_info[k_idx]; @@ -4739,20 +4763,20 @@ static bool kind_is_good(int k_idx) return (FALSE); } - -/* +/*! + * @brief 生成階に応じたベースアイテムの生成を行う。 * Attempt to make an object (normal or good/great) - * - * This routine plays nasty games to generate the "special artifacts". - * - * This routine uses "object_level" for the "generation level". - * - * We assume that the given object has been "wiped". + * @param j_ptr 生成結果を収めたいオブジェクト構造体の参照ポインタ + * @param mode オプションフラグ + * @return 生成に成功したらTRUEを返す。 + * @details + * This routine plays nasty games to generate the "special artifacts".\n + * This routine uses "object_level" for the "generation level".\n + * We assume that the given object has been "wiped".\n */ -bool make_object(object_type *j_ptr, u32b mode) +bool make_object(object_type *j_ptr, BIT_FLAGS mode) { int prob, base; - byte obj_level; /* Chance of "special object" */ @@ -4765,7 +4789,7 @@ bool make_object(object_type *j_ptr, u32b mode) /* Generate a special object, or a normal object */ if (!one_in_(prob) || !make_artifact_special(j_ptr)) { - int k_idx; + IDX k_idx; /* Good objects */ if ((mode & AM_GOOD) && !get_obj_num_hook) @@ -4813,34 +4837,28 @@ bool make_object(object_type *j_ptr, u32b mode) } } - obj_level = k_info[j_ptr->k_idx].level; - if (object_is_fixed_artifact(j_ptr)) obj_level = a_info[j_ptr->name1].level; - - /* Notice "okay" out-of-depth objects */ - if (!object_is_cursed(j_ptr) && !object_is_broken(j_ptr) && - (obj_level > dun_level)) - { - /* Cheat -- peek at items */ - if (cheat_peek) object_mention(j_ptr); - } + if (cheat_peek) object_mention(j_ptr); /* Success */ return (TRUE); } -/* +/*! + * @brief フロアの指定位置に生成階に応じたベースアイテムの生成を行う。 * Attempt to place an object (normal or good/great) at the given location. - * - * This routine plays nasty games to generate the "special artifacts". - * - * This routine uses "object_level" for the "generation level". - * - * This routine requires a clean floor grid destination. + * @param y 配置したいフロアのY座標 + * @param x 配置したいフロアのX座標 + * @param mode オプションフラグ + * @return 生成に成功したらTRUEを返す。 + * @details + * This routine plays nasty games to generate the "special artifacts".\n + * This routine uses "object_level" for the "generation level".\n + * This routine requires a clean floor grid destination.\n */ -void place_object(int y, int x, u32b mode) +void place_object(POSITION y, POSITION x, BIT_FLAGS mode) { - s16b o_idx; + IDX o_idx; /* Acquire grid */ cave_type *c_ptr = &cave[y][x]; @@ -4910,9 +4928,12 @@ void place_object(int y, int x, u32b mode) } -/* +/*! + * @brief 生成階に応じた財宝オブジェクトの生成を行う。 * Make a treasure object - * + * @param j_ptr 生成結果を収めたいオブジェクト構造体の参照ポインタ + * @return 生成に成功したらTRUEを返す。 + * @details * The location must be a legal, clean, floor grid. */ bool make_gold(object_type *j_ptr) @@ -4951,12 +4972,16 @@ bool make_gold(object_type *j_ptr) } -/* +/*! + * @brief フロアの指定位置に生成階に応じた財宝オブジェクトの生成を行う。 * Places a treasure (Gold or Gems) at given location - * + * @param y 配置したいフロアのY座標 + * @param x 配置したいフロアのX座標 + * @return 生成に成功したらTRUEを返す。 + * @details * The location must be a legal, clean, floor grid. */ -void place_gold(int y, int x) +void place_gold(POSITION y, POSITION x) { s16b o_idx; @@ -5021,21 +5046,27 @@ void place_gold(int y, int x) } -/* +/*! + * @brief 生成済のオブジェクトをフロアの所定の位置に落とす。 * Let an object fall to the ground at or near a location. - * - * The initial location is assumed to be "in_bounds()". - * - * This function takes a parameter "chance". This is the percentage - * chance that the item will "disappear" instead of drop. If the object - * has been thrown, then this is the chance of disappearance on contact. - * - * Hack -- this function uses "chance" to determine if it should produce - * some form of "description" of the drop event (under the player). - * - * We check several locations to see if we can find a location at which - * the object can combine, stack, or be placed. Artifacts will try very - * hard to be placed, including "teleporting" to a useful grid if needed. + * @param j_ptr 落としたいオブジェクト構造体の参照ポインタ + * @param chance ドロップの成功率(%) + * @param y 配置したいフロアのY座標 + * @param x 配置したいフロアのX座標 + * @return 生成に成功したらTRUEを返す。 + * @details + * The initial location is assumed to be "in_bounds()".\n + *\n + * This function takes a parameter "chance". This is the percentage\n + * chance that the item will "disappear" instead of drop. If the object\n + * has been thrown, then this is the chance of disappearance on contact.\n + *\n + * Hack -- this function uses "chance" to determine if it should produce\n + * some form of "description" of the drop event (under the player).\n + *\n + * We check several locations to see if we can find a location at which\n + * the object can combine, stack, or be placed. Artifacts will try very\n + * hard to be placed, including "teleporting" to a useful grid if needed.\n */ s16b drop_near(object_type *j_ptr, int chance, int y, int x) { @@ -5071,7 +5102,7 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x) { /* Message */ #ifdef JP - msg_format("%s¤Ï¾Ã¤¨¤¿¡£", o_name); + msg_format("%sは消えた。", o_name); #else msg_format("The %s disappear%s.", o_name, (plural ? "" : "s")); @@ -5079,12 +5110,7 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x) /* Debug */ -#ifdef JP - if (p_ptr->wizard) msg_print("(ÇË»)"); -#else - if (p_ptr->wizard) msg_print("(breakage)"); -#endif - + if (p_ptr->wizard) msg_print(_("(破損)", "(breakage)")); /* Failure */ return (0); @@ -5188,7 +5214,7 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x) { /* Message */ #ifdef JP - msg_format("%s¤Ï¾Ã¤¨¤¿¡£", o_name); + msg_format("%sは消えた。", o_name); #else msg_format("The %s disappear%s.", o_name, (plural ? "" : "s")); @@ -5196,12 +5222,7 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x) /* Debug */ -#ifdef JP - if (p_ptr->wizard) msg_print("(¾²¥¹¥Ú¡¼¥¹¤¬¤Ê¤¤)"); -#else - if (p_ptr->wizard) msg_print("(no floor space)"); -#endif - + if (p_ptr->wizard) msg_print(_("(床スペースがない)", "(no floor space)")); /* Failure */ return (0); @@ -5248,17 +5269,13 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x) { /* Message */ #ifdef JP - msg_format("%s¤Ï¾Ã¤¨¤¿¡£", o_name); + msg_format("%sは消えた。", o_name); #else msg_format("The %s disappear%s.", o_name, (plural ? "" : "s")); #endif /* Debug */ -#ifdef JP - if (p_ptr->wizard) msg_print("(¾²¥¹¥Ú¡¼¥¹¤¬¤Ê¤¤)"); -#else - if (p_ptr->wizard) msg_print("(no floor space)"); -#endif + if (p_ptr->wizard) msg_print(_("(床スペースがない)", "(no floor space)")); /* Mega-Hack -- preserve artifacts */ if (preserve_mode) @@ -5335,7 +5352,7 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x) { /* Message */ #ifdef JP - msg_format("%s¤Ï¾Ã¤¨¤¿¡£", o_name); + msg_format("%sは消えた。", o_name); #else msg_format("The %s disappear%s.", o_name, (plural ? "" : "s")); @@ -5343,12 +5360,7 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x) /* Debug */ -#ifdef JP - if (p_ptr->wizard) msg_print("(¥¢¥¤¥Æ¥à¤¬Â¿²á¤®¤ë)"); -#else - if (p_ptr->wizard) msg_print("(too many objects)"); -#endif - + if (p_ptr->wizard) msg_print(_("(アイテムが多過ぎる)", "(too many objects)")); /* Hack -- Preserve artifacts */ if (object_is_fixed_artifact(j_ptr)) @@ -5399,12 +5411,7 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x) /* Message when an object falls under the player */ if (chance && player_bold(by, bx)) { -#ifdef JP - msg_print("²¿¤«¤¬Â­²¼¤Ëž¤¬¤Ã¤Æ¤­¤¿¡£"); -#else - msg_print("You feel something roll beneath your feet."); -#endif - + msg_print(_("何かが足下に転がってきた。", "You feel something roll beneath your feet.")); } /* XXX XXX XXX */ @@ -5414,14 +5421,22 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x) } -/* +/*! + * @brief 獲得ドロップを行う。 * Scatter some "great" objects near the player + * @param y1 配置したいフロアのY座標 + * @param x1 配置したいフロアのX座標 + * @param num 獲得の処理回数 + * @param great TRUEならば必ず高級品以上を落とす + * @param special TRUEならば必ず特別品を落とす + * @param known TRUEならばオブジェクトが必ず*鑑定*済になる + * @return なし */ void acquirement(int y1, int x1, int num, bool great, bool special, bool known) { object_type *i_ptr; object_type object_type_body; - u32b mode = AM_GOOD | (great || special ? AM_GREAT : 0L) | (special ? AM_SPECIAL : 0L) ; + BIT_FLAGS mode = AM_GOOD | (great || special ? AM_GREAT : 0L) | (special ? AM_SPECIAL : 0L) ; /* Acquirement */ while (num--) @@ -5458,8 +5473,8 @@ void acquirement(int y1, int x1, int num, bool great, bool special, bool known) typedef struct { - int tval; - int sval; + OBJECT_TYPE_VALUE tval; + OBJECT_SUBTYPE_VALUE sval; int prob; byte flag; } amuse_type; @@ -5483,6 +5498,14 @@ amuse_type amuse_info[] = { 0, 0, 0 } }; +/*! + * @brief 誰得ドロップを行う。 + * @param y1 配置したいフロアのY座標 + * @param x1 配置したいフロアのX座標 + * @param num 誰得の処理回数 + * @param known TRUEならばオブジェクトが必ず*鑑定*済になる + * @return なし + */ void amusement(int y1, int x1, int num, bool known) { object_type *i_ptr; @@ -5497,7 +5520,8 @@ void amusement(int y1, int x1, int num, bool known) /* Acquirement */ while (num) { - int i, k_idx, a_idx = 0; + int i; + IDX k_idx, a_idx = 0; int r = randint0(t); bool insta_art, fixed_art; @@ -5572,8 +5596,9 @@ void amusement(int y1, int x1, int num, bool known) /* See init_feat_variables() in init2.c */ static s16b normal_traps[MAX_NORMAL_TRAPS]; -/* - * Initialize arrays for normal traps +/*! + * @brief タグに従って、基本トラップテーブルを初期化する / Initialize arrays for normal traps + * @return なし */ void init_normal_traps(void) { @@ -5599,13 +5624,15 @@ void init_normal_traps(void) normal_traps[cur_trap++] = f_tag_to_index_in_init("TRAP_ALARM"); } -/* +/*! + * @brief 基本トラップをランダムに選択する / * Get random trap - * - * XXX XXX XXX This routine should be redone to reflect trap "level". - * That is, it does not make sense to have spiked pits at 50 feet. - * Actually, it is not this routine, but the "trap instantiation" - * code, which should also check for "trap doors" on quest levels. + * @return 選択したトラップのID + * @details + * XXX XXX XXX This routine should be redone to reflect trap "level".\n + * That is, it does not make sense to have spiked pits at 50 feet.\n + * Actually, it is not this routine, but the "trap instantiation"\n + * code, which should also check for "trap doors" on quest levels.\n */ s16b choose_random_trap(void) { @@ -5632,8 +5659,12 @@ s16b choose_random_trap(void) return feat; } -/* +/*! + * @brief マスに存在するトラップを秘匿する / * Disclose an invisible trap + * @param y 秘匿したいマスのY座標 + * @param x 秘匿したいマスのX座標 + * @return なし */ void disclose_grid(int y, int x) { @@ -5657,15 +5688,15 @@ void disclose_grid(int y, int x) } } - -/* - * Places a random trap at the given location. - * +/*! + * @brief マスをトラップを配置する / * The location must be a legal, naked, floor grid. - * - * Note that all traps start out as "invisible" and "untyped", and then - * when they are "discovered" (by detecting them or setting them off), - * the trap is "instantiated" as a visible, "typed", trap. + * @param y 配置したいマスのY座標 + * @param x 配置したいマスのX座標 + * @return + * Note that all traps start out as "invisible" and "untyped", and then\n + * when they are "discovered" (by detecting them or setting them off),\n + * the trap is "instantiated" as a visible, "typed", trap.\n */ void place_trap(int y, int x) { @@ -5682,9 +5713,11 @@ void place_trap(int y, int x) c_ptr->feat = choose_random_trap(); } - -/* +/*! + * @brief 魔道具の使用回数の残量を示すメッセージを表示する / * Describe the charges on an item in the inventory. + * @param item 残量を表示したいプレイヤーのアイテム所持スロット + * @return なし */ void inven_item_charges(int item) { @@ -5699,11 +5732,11 @@ void inven_item_charges(int item) #ifdef JP if (o_ptr->pval <= 0) { - msg_print("¤â¤¦ËâÎϤ¬»Ä¤Ã¤Æ¤¤¤Ê¤¤¡£"); + msg_print("もう魔力が残っていない。"); } else { - msg_format("¤¢¤È %d ²óʬ¤ÎËâÎϤ¬»Ä¤Ã¤Æ¤¤¤ë¡£", o_ptr->pval); + msg_format("あと %d 回分の魔力が残っている。", o_ptr->pval); } #else /* Multiple charges */ @@ -5723,9 +5756,11 @@ void inven_item_charges(int item) } - -/* +/*! + * @brief アイテムの残り所持数メッセージを表示する / * Describe an item in the inventory. + * @param item 残量を表示したいプレイヤーのアイテム所持スロット + * @return なし */ void inven_item_describe(int item) { @@ -5737,16 +5772,16 @@ void inven_item_describe(int item) /* Print a message */ #ifdef JP - /* "no more" ¤Î¾ì¹ç¤Ï¤³¤Á¤é¤Çɽ¼¨¤¹¤ë */ + /* "no more" の場合はこちらで表示する */ if (o_ptr->number <= 0) { - /*FIRST*//*¤³¤³¤Ï¤â¤¦Ä̤é¤Ê¤¤¤«¤â */ - msg_format("¤â¤¦%s¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£", o_name); + /*FIRST*//*ここはもう通らないかも */ + msg_format("もう%sを持っていない。", o_name); } else { - /* ¥¢¥¤¥Æ¥à̾¤ò±ÑÆüÀÚ¤êÂؤ¨µ¡Ç½Âбþ */ - msg_format("¤Þ¤À %s¤ò»ý¤Ã¤Æ¤¤¤ë¡£", o_name); + /* アイテム名を英日切り替え機能対応 */ + msg_format("まだ %sを持っている。", o_name); } #else msg_format("You have %s.", o_name); @@ -5754,9 +5789,12 @@ void inven_item_describe(int item) } - -/* +/*! + * @brief アイテムの残り所持数メッセージを表示する / * Increase the "number" of an item in the inventory + * @param item 所持数を増やしたいプレイヤーのアイテム所持スロット + * @param num 増やしたい量 + * @return なし */ void inven_item_increase(int item, int num) { @@ -5770,7 +5808,7 @@ void inven_item_increase(int item, int num) else if (num < 0) num = 0; /* Un-apply */ - num -= o_ptr->number; + num -= (ITEM_NUMBER)o_ptr->number; /* Change the number and weight */ if (num) @@ -5808,9 +5846,11 @@ void inven_item_increase(int item, int num) } } - -/* +/*! + * @brief 所持アイテムスロットから所持数のなくなったアイテムを消去する / * Erase an inventory slot if it has no more items + * @param item 消去したいプレイヤーのアイテム所持スロット + * @return なし */ void inven_item_optimize(int item) { @@ -5870,9 +5910,11 @@ void inven_item_optimize(int item) p_ptr->window |= (PW_SPELL); } - -/* +/*! + * @brief 床上の魔道具の残り残量メッセージを表示する / * Describe the charges on an item on the floor. + * @param item メッセージの対象にしたいアイテム所持スロット + * @return なし */ void floor_item_charges(int item) { @@ -5887,11 +5929,11 @@ void floor_item_charges(int item) #ifdef JP if (o_ptr->pval <= 0) { - msg_print("¤³¤Î¾²¾å¤Î¥¢¥¤¥Æ¥à¤Ï¡¢¤â¤¦ËâÎϤ¬»Ä¤Ã¤Æ¤¤¤Ê¤¤¡£"); + msg_print("この床上のアイテムは、もう魔力が残っていない。"); } else { - msg_format("¤³¤Î¾²¾å¤Î¥¢¥¤¥Æ¥à¤Ï¡¢¤¢¤È %d ²óʬ¤ÎËâÎϤ¬»Ä¤Ã¤Æ¤¤¤ë¡£", o_ptr->pval); + msg_format("この床上のアイテムは、あと %d 回分の魔力が残っている。", o_ptr->pval); } #else /* Multiple charges */ @@ -5911,9 +5953,11 @@ void floor_item_charges(int item) } - -/* - * Describe an item in the inventory. +/*! + * @brief 床上のアイテムの残り数メッセージを表示する / + * Describe the charges on an item on the floor. + * @param item メッセージの対象にしたいアイテム所持スロット + * @return なし */ void floor_item_describe(int item) { @@ -5925,14 +5969,14 @@ void floor_item_describe(int item) /* Print a message */ #ifdef JP - /* "no more" ¤Î¾ì¹ç¤Ï¤³¤Á¤é¤Çɽ¼¨¤òʬ¤±¤ë */ + /* "no more" の場合はこちらで表示を分ける */ if (o_ptr->number <= 0) { - msg_format("¾²¾å¤Ë¤Ï¡¢¤â¤¦%s¤Ï¤Ê¤¤¡£", o_name); + msg_format("床上には、もう%sはない。", o_name); } else { - msg_format("¾²¾å¤Ë¤Ï¡¢¤Þ¤À %s¤¬¤¢¤ë¡£", o_name); + msg_format("床上には、まだ %sがある。", o_name); } #else msg_format("You see %s.", o_name); @@ -5941,8 +5985,12 @@ void floor_item_describe(int item) } -/* +/*! + * @brief 床上のアイテムの数を増やす / * Increase the "number" of an item on the floor + * @param item 増やしたいアイテムの所持スロット + * @param num 増やしたいアイテムの数 + * @return なし */ void floor_item_increase(int item, int num) { @@ -5956,15 +6004,18 @@ void floor_item_increase(int item, int num) else if (num < 0) num = 0; /* Un-apply */ - num -= o_ptr->number; + num -= (int)o_ptr->number; /* Change the number */ - o_ptr->number += num; + o_ptr->number += (ITEM_NUMBER)num; } -/* +/*! + * @brief 床上の数の無くなったアイテムスロットを消去する / * Optimize an item on the floor (destroy "empty" items) + * @param item 消去したいアイテムの所持スロット + * @return なし */ void floor_item_optimize(int item) { @@ -5981,8 +6032,11 @@ void floor_item_optimize(int item) } -/* +/*! + * @brief アイテムを拾う際にザックから溢れずに済むかを判定する / * Check if we have space for an item in the pack without overflow + * @param o_ptr 拾いたいオブジェクトの構造体参照ポインタ + * @return 溢れずに済むならTRUEを返す */ bool inven_carry_okay(object_type *o_ptr) { @@ -6007,7 +6061,14 @@ bool inven_carry_okay(object_type *o_ptr) return (FALSE); } - +/*! + * @brief オブジェクトを定義された基準に従いソートするための関数 / + * Check if we have space for an item in the pack without overflow + * @param o_ptr 比較対象オブジェクトの構造体参照ポインタ1 + * @param o_value o_ptrのアイテム価値(手動であらかじめ代入する必要がある?) + * @param j_ptr 比較対象オブジェクトの構造体参照ポインタ2 + * @return o_ptrの方が上位ならばTRUEを返す。 + */ bool object_sort_comp(object_type *o_ptr, s32b o_value, object_type *j_ptr) { int o_type, j_type; @@ -6089,27 +6150,30 @@ bool object_sort_comp(object_type *o_ptr, s32b o_value, object_type *j_ptr) } -/* +/*! + * @brief オブジェクトをプレイヤーが拾って所持スロットに納めるメインルーチン / * Add an item to the players inventory, and return the slot used. - * - * If the new item can combine with an existing item in the inventory, - * it will do so, using "object_similar()" and "object_absorb()", else, - * the item will be placed into the "proper" location in the inventory. - * - * This function can be used to "over-fill" the player's pack, but only - * once, and such an action must trigger the "overflow" code immediately. - * Note that when the pack is being "over-filled", the new item must be - * placed into the "overflow" slot, and the "overflow" must take place - * before the pack is reordered, but (optionally) after the pack is - * combined. This may be tricky. See "dungeon.c" for info. - * - * Note that this code must remove any location/stack information - * from the object once it is placed into the inventory. + * @param o_ptr 拾うオブジェクトの構造体参照ポインタ + * @return 収められた所持スロットのID、拾うことができなかった場合-1を返す。 + * @details + * If the new item can combine with an existing item in the inventory,\n + * it will do so, using "object_similar()" and "object_absorb()", else,\n + * the item will be placed into the "proper" location in the inventory.\n + *\n + * This function can be used to "over-fill" the player's pack, but only\n + * once, and such an action must trigger the "overflow" code immediately.\n + * Note that when the pack is being "over-filled", the new item must be\n + * placed into the "overflow" slot, and the "overflow" must take place\n + * before the pack is reordered, but (optionally) after the pack is\n + * combined. This may be tricky. See "dungeon.c" for info.\n + *\n + * Note that this code must remove any location/stack information\n + * from the object once it is placed into the inventory.\n */ s16b inven_carry(object_type *o_ptr) { - int i, j, k; - int n = -1; + INVENTORY_IDX i, j, k; + INVENTORY_IDX n = -1; object_type *j_ptr; @@ -6227,19 +6291,21 @@ s16b inven_carry(object_type *o_ptr) } -/* +/*! + * @brief 装備スロットからオブジェクトを外すメインルーチン / * Take off (some of) a non-cursed equipment item - * - * Note that only one item at a time can be wielded per slot. - * - * Note that taking off an item when "full" may cause that item - * to fall to the ground. - * - * Return the inventory slot into which the item is placed. + * @param item オブジェクトを外したい所持テーブルのID + * @param amt 外したい個数 + * @return 収められた所持スロットのID、拾うことができなかった場合-1を返す。 + * @details + * Note that only one item at a time can be wielded per slot.\n + * Note that taking off an item when "full" may cause that item\n + * to fall to the ground.\n + * Return the inventory slot into which the item is placed.\n */ -s16b inven_takeoff(int item, int amt) +INVENTORY_IDX inven_takeoff(INVENTORY_IDX item, ITEM_NUMBER amt) { - int slot; + INVENTORY_IDX slot; object_type forge; object_type *q_ptr; @@ -6276,45 +6342,25 @@ s16b inven_takeoff(int item, int amt) if (((item == INVEN_RARM) || (item == INVEN_LARM)) && object_is_melee_weapon(o_ptr)) { -#ifdef JP - act = "¤òÁõÈ÷¤«¤é¤Ï¤º¤·¤¿"; -#else - act = "You were wielding"; -#endif - + act = _("を装備からはずした", "You were wielding"); } /* Took off bow */ else if (item == INVEN_BOW) { -#ifdef JP - act = "¤òÁõÈ÷¤«¤é¤Ï¤º¤·¤¿"; -#else - act = "You were holding"; -#endif - + act = _("を装備からはずした", "You were holding"); } /* Took off light */ else if (item == INVEN_LITE) { -#ifdef JP - act = "¤ò¸÷¸»¤«¤é¤Ï¤º¤·¤¿"; -#else - act = "You were holding"; -#endif - + act = _("を光源からはずした", "You were holding"); } /* Took off something */ else { -#ifdef JP - act = "¤òÁõÈ÷¤«¤é¤Ï¤º¤·¤¿"; -#else - act = "You were wearing"; -#endif - + act = _("を装備からはずした", "You were wearing"); } /* Modify, Optimize */ @@ -6326,7 +6372,7 @@ s16b inven_takeoff(int item, int amt) /* Message */ #ifdef JP - msg_format("%s(%c)%s¡£", o_name, index_to_label(slot), act); + msg_format("%s(%c)%s。", o_name, index_to_label(slot), act); #else msg_format("%s %s (%c).", act, o_name, index_to_label(slot)); #endif @@ -6337,16 +6383,19 @@ s16b inven_takeoff(int item, int amt) } -/* +/*! + * @brief 所持スロットから床下にオブジェクトを落とすメインルーチン / * Drop (some of) a non-cursed inventory/equipment item - * + * @param item 所持テーブルのID + * @param amt 落としたい個数 + * @return なし + * @details * The object will be dropped "near" the current location */ -void inven_drop(int item, int amt) +void inven_drop(INVENTORY_IDX item, ITEM_NUMBER amt) { object_type forge; object_type *q_ptr; - object_type *o_ptr; char o_name[MAX_NLEN]; @@ -6389,15 +6438,10 @@ void inven_drop(int item, int amt) object_desc(o_name, q_ptr, 0); /* Message */ -#ifdef JP - msg_format("%s(%c)¤òÍî¤È¤·¤¿¡£", o_name, index_to_label(item)); -#else - msg_format("You drop %s (%c).", o_name, index_to_label(item)); -#endif - + msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(item)); /* Drop it near the player */ - (void)drop_near(q_ptr, 0, py, px); + (void)drop_near(q_ptr, 0, p_ptr->y, p_ptr->x); /* Modify, Describe, Optimize */ inven_item_increase(item, -amt); @@ -6406,9 +6450,11 @@ void inven_drop(int item, int amt) } -/* +/*! + * @brief プレイヤーの所持スロットに存在するオブジェクトをまとめなおす / * Combine items in the pack - * + * @return なし + * @details * Note special handling of the "overflow" slot */ void combine_pack(void) @@ -6513,17 +6559,14 @@ void combine_pack(void) while (combined); /* Message */ -#ifdef JP - if (flag) msg_print("¥¶¥Ã¥¯¤ÎÃæ¤Î¥¢¥¤¥Æ¥à¤ò¤Þ¤È¤áľ¤·¤¿¡£"); -#else - if (flag) msg_print("You combine some items in your pack."); -#endif + if (flag) msg_print(_("ザックの中のアイテムをまとめ直した。", "You combine some items in your pack.")); } - -/* +/*! + * @brief プレイヤーの所持スロットに存在するオブジェクトを並び替える / * Reorder items in the pack - * + * @return なし + * @details * Note special handling of the "overflow" slot */ void reorder_pack(void) @@ -6584,28 +6627,25 @@ void reorder_pack(void) } /* Message */ -#ifdef JP - if (flag) msg_print("¥¶¥Ã¥¯¤ÎÃæ¤Î¥¢¥¤¥Æ¥à¤òÊ¤Ùľ¤·¤¿¡£"); -#else - if (flag) msg_print("You reorder some items in your pack."); -#endif - + if (flag) msg_print(_("ザックの中のアイテムを並べ直した。", "You reorder some items in your pack.")); } - -/* +/*! + * @brief 現在アクティブになっているウィンドウにオブジェクトの詳細を表示する / * Hack -- display an object kind in the current window - * + * @param k_idx ベースアイテムの参照ID + * @return なし + * @details * Include list of usable spells for readible books */ -void display_koff(int k_idx) +void display_koff(IDX k_idx) { int y; object_type forge; object_type *q_ptr; int sval; - int use_realm; + REALM_IDX use_realm; char o_name[MAX_NLEN]; @@ -6652,7 +6692,7 @@ void display_koff(int k_idx) { int spell = -1; int num = 0; - byte spells[64]; + SPELL_IDX spells[64]; /* Extract spells */ for (spell = 0; spell < 32; spell++) @@ -6670,7 +6710,12 @@ void display_koff(int k_idx) } } -/* Choose one of items that have warning flag */ +/*! + * @brief 警告を放つアイテムを選択する / + * Choose one of items that have warning flag + * Calculate spell damages + * @return 警告を行う + */ object_type *choose_warning_item(void) { int i; @@ -6698,15 +6743,21 @@ object_type *choose_warning_item(void) return number ? &inventory[choices[randint0(number)]] : NULL; } -/* Calculate spell damages */ -static void spell_damcalc(monster_type *m_ptr, int typ, int dam, int limit, int *max) +/*! + * @brief 警告基準を定めるために魔法の効果属性に基づいて最大魔法ダメージを計算する / + * Calculate spell damages + * @param m_ptr 魔法を行使するモンスターの構造体参照ポインタ + * @param typ 効果属性のID + * @param dam 基本ダメージ + * @param max 算出した最大ダメージを返すポインタ + * @return なし + */ +static void spell_damcalc(monster_type *m_ptr, int typ, HIT_POINT dam, int *max) { monster_race *r_ptr = &r_info[m_ptr->r_idx]; int rlev = r_ptr->level; bool ignore_wraith_form = FALSE; - if (limit) dam = (dam > limit) ? limit : dam; - /* Vulnerability, resistance and immunity */ switch (typ) { @@ -6937,7 +6988,29 @@ static void spell_damcalc(monster_type *m_ptr, int typ, int dam, int limit, int if (dam > *max) *max = dam; } -/* Calculate blow damages */ +/*! +* @brief 警告基準を定めるために魔法の効果属性に基づいて最大魔法ダメージを計算する。 / +* Calculate spell damages +* @param spell_num RF4ならRF4_SPELL_STARTのように32区切りのベースとなる数値 +* @param typ 効果属性のID +* @param m_idx 魔法を行使するモンスターのID +* @param max 算出した最大ダメージを返すポインタ +* @return なし +*/ +void spell_damcalc_by_spellnum(int spell_num, int typ, MONSTER_IDX m_idx, int *max) +{ + monster_type *m_ptr = &m_list[m_idx]; + HIT_POINT dam = monspell_damage((spell_num), m_idx, DAM_MAX); + spell_damcalc(m_ptr, typ, dam, max); +} + +/*! + * @brief 警告基準を定めるためにモンスターの打撃最大ダメージを算出する / + * Calculate blow damages + * @param m_ptr 打撃を行使するモンスターの構造体参照ポインタ + * @param blow_ptr モンスターの打撃能力の構造体参照ポインタ + * @return 算出された最大ダメージを返す。 + */ static int blow_damcalc(monster_type *m_ptr, monster_blow *blow_ptr) { int dam = blow_ptr->d_dice * blow_ptr->d_side; @@ -6963,25 +7036,25 @@ static int blow_damcalc(monster_type *m_ptr, monster_blow *blow_ptr) break; case RBE_ACID: - spell_damcalc(m_ptr, GF_ACID, dam, 0, &dummy_max); + spell_damcalc(m_ptr, GF_ACID, dam, &dummy_max); dam = dummy_max; check_wraith_form = FALSE; break; case RBE_ELEC: - spell_damcalc(m_ptr, GF_ELEC, dam, 0, &dummy_max); + spell_damcalc(m_ptr, GF_ELEC, dam, &dummy_max); dam = dummy_max; check_wraith_form = FALSE; break; case RBE_FIRE: - spell_damcalc(m_ptr, GF_FIRE, dam, 0, &dummy_max); + spell_damcalc(m_ptr, GF_FIRE, dam, &dummy_max); dam = dummy_max; check_wraith_form = FALSE; break; case RBE_COLD: - spell_damcalc(m_ptr, GF_COLD, dam, 0, &dummy_max); + spell_damcalc(m_ptr, GF_COLD, dam, &dummy_max); dam = dummy_max; check_wraith_form = FALSE; break; @@ -7001,14 +7074,20 @@ static int blow_damcalc(monster_type *m_ptr, monster_blow *blow_ptr) else { dam = (dam + 1) / 2; - spell_damcalc(m_ptr, mbe_info[blow_ptr->effect].explode_type, dam, 0, &dummy_max); + spell_damcalc(m_ptr, mbe_info[blow_ptr->effect].explode_type, dam, &dummy_max); dam = dummy_max; } return dam; } -/* Examine the grid (xx,yy) and warn the player if there are any danger */ +/*! + * @brief プレイヤーが特定地点へ移動した場合に警告を発する処理 / + * Examine the grid (xx,yy) and warn the player if there are any danger + * @param xx 危険性を調査するマスのX座標 + * @param yy 危険性を調査するマスのY座標 + * @return 警告を無視して進むことを選択するかか問題が無ければTRUE、警告に従ったならFALSEを返す。 + */ bool process_warning(int xx, int yy) { int mx, my; @@ -7042,49 +7121,43 @@ bool process_warning(int xx, int yy) /* Monster spells (only powerful ones)*/ if (projectable(my, mx, yy, xx)) - { - int breath_dam_div3 = m_ptr->hp / 3; - int breath_dam_div6 = m_ptr->hp / 6; + { u32b f4 = r_ptr->flags4; - u32b f5 = r_ptr->flags5; - u32b f6 = r_ptr->flags6; + u32b f5 = r_ptr->a_ability_flags1; + u32b f6 = r_ptr->a_ability_flags2; if (!(d_info[dungeon_type].flags1 & DF1_NO_MAGIC)) { - int rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1); - int storm_dam = rlev * 4 + 150; - bool powerful = (bool)(r_ptr->flags2 & RF2_POWERFUL); - - if (f4 & RF4_BA_CHAO) spell_damcalc(m_ptr, GF_CHAOS, rlev * (powerful ? 3 : 2) + 100, 0, &dam_max0); - if (f5 & RF5_BA_MANA) spell_damcalc(m_ptr, GF_MANA, storm_dam, 0, &dam_max0); - if (f5 & RF5_BA_DARK) spell_damcalc(m_ptr, GF_DARK, storm_dam, 0, &dam_max0); - if (f5 & RF5_BA_LITE) spell_damcalc(m_ptr, GF_LITE, storm_dam, 0, &dam_max0); - if (f6 & RF6_HAND_DOOM) spell_damcalc(m_ptr, GF_HAND_DOOM, p_ptr->chp * 6 / 10, 0, &dam_max0); - if (f6 & RF6_PSY_SPEAR) spell_damcalc(m_ptr, GF_PSY_SPEAR, powerful ? (rlev * 2 + 150) : (rlev * 3 / 2 + 100), 0, &dam_max0); + if (f4 & RF4_BA_CHAO) spell_damcalc_by_spellnum(MS_BALL_CHAOS, GF_CHAOS, c_ptr->m_idx, &dam_max0); + if (f5 & RF5_BA_MANA) spell_damcalc_by_spellnum(MS_BALL_MANA, GF_MANA, c_ptr->m_idx, &dam_max0); + if (f5 & RF5_BA_DARK) spell_damcalc_by_spellnum(MS_BALL_DARK, GF_DARK, c_ptr->m_idx, &dam_max0); + if (f5 & RF5_BA_LITE) spell_damcalc_by_spellnum(MS_STARBURST, GF_LITE, c_ptr->m_idx, &dam_max0); + if (f6 & RF6_HAND_DOOM) spell_damcalc_by_spellnum(MS_HAND_DOOM, GF_HAND_DOOM, c_ptr->m_idx, &dam_max0); + if (f6 & RF6_PSY_SPEAR) spell_damcalc_by_spellnum(MS_PSY_SPEAR, GF_PSY_SPEAR, c_ptr->m_idx, &dam_max0); } - if (f4 & RF4_ROCKET) spell_damcalc(m_ptr, GF_ROCKET, m_ptr->hp / 4, 800, &dam_max0); - if (f4 & RF4_BR_ACID) spell_damcalc(m_ptr, GF_ACID, breath_dam_div3, 1600, &dam_max0); - if (f4 & RF4_BR_ELEC) spell_damcalc(m_ptr, GF_ELEC, breath_dam_div3, 1600, &dam_max0); - if (f4 & RF4_BR_FIRE) spell_damcalc(m_ptr, GF_FIRE, breath_dam_div3, 1600, &dam_max0); - if (f4 & RF4_BR_COLD) spell_damcalc(m_ptr, GF_COLD, breath_dam_div3, 1600, &dam_max0); - if (f4 & RF4_BR_POIS) spell_damcalc(m_ptr, GF_POIS, breath_dam_div3, 800, &dam_max0); - if (f4 & RF4_BR_NETH) spell_damcalc(m_ptr, GF_NETHER, breath_dam_div6, 550, &dam_max0); - if (f4 & RF4_BR_LITE) spell_damcalc(m_ptr, GF_LITE, breath_dam_div6, 400, &dam_max0); - if (f4 & RF4_BR_DARK) spell_damcalc(m_ptr, GF_DARK, breath_dam_div6, 400, &dam_max0); - if (f4 & RF4_BR_CONF) spell_damcalc(m_ptr, GF_CONFUSION, breath_dam_div6, 450, &dam_max0); - if (f4 & RF4_BR_SOUN) spell_damcalc(m_ptr, GF_SOUND, breath_dam_div6, 450, &dam_max0); - if (f4 & RF4_BR_CHAO) spell_damcalc(m_ptr, GF_CHAOS, breath_dam_div6, 600, &dam_max0); - if (f4 & RF4_BR_DISE) spell_damcalc(m_ptr, GF_DISENCHANT, breath_dam_div6, 500, &dam_max0); - if (f4 & RF4_BR_NEXU) spell_damcalc(m_ptr, GF_NEXUS, breath_dam_div3, 250, &dam_max0); - if (f4 & RF4_BR_TIME) spell_damcalc(m_ptr, GF_TIME, breath_dam_div3, 150, &dam_max0); - if (f4 & RF4_BR_INER) spell_damcalc(m_ptr, GF_INERTIA, breath_dam_div6, 200, &dam_max0); - if (f4 & RF4_BR_GRAV) spell_damcalc(m_ptr, GF_GRAVITY, breath_dam_div3, 200, &dam_max0); - if (f4 & RF4_BR_SHAR) spell_damcalc(m_ptr, GF_SHARDS, breath_dam_div6, 500, &dam_max0); - if (f4 & RF4_BR_PLAS) spell_damcalc(m_ptr, GF_PLASMA, breath_dam_div6, 150, &dam_max0); - if (f4 & RF4_BR_WALL) spell_damcalc(m_ptr, GF_FORCE, breath_dam_div6, 200, &dam_max0); - if (f4 & RF4_BR_MANA) spell_damcalc(m_ptr, GF_MANA, breath_dam_div3, 250, &dam_max0); - if (f4 & RF4_BR_NUKE) spell_damcalc(m_ptr, GF_NUKE, breath_dam_div3, 800, &dam_max0); - if (f4 & RF4_BR_DISI) spell_damcalc(m_ptr, GF_DISINTEGRATE, breath_dam_div6, 150, &dam_max0); + if (f4 & RF4_ROCKET) spell_damcalc_by_spellnum(MS_ROCKET, GF_ROCKET, c_ptr->m_idx, &dam_max0); + if (f4 & RF4_BR_ACID) spell_damcalc_by_spellnum(MS_BR_ACID, GF_ACID, c_ptr->m_idx, &dam_max0); + if (f4 & RF4_BR_ELEC) spell_damcalc_by_spellnum(MS_BR_ELEC, GF_ELEC, c_ptr->m_idx, &dam_max0); + if (f4 & RF4_BR_FIRE) spell_damcalc_by_spellnum(MS_BR_FIRE, GF_FIRE, c_ptr->m_idx, &dam_max0); + if (f4 & RF4_BR_COLD) spell_damcalc_by_spellnum(MS_BR_COLD, GF_COLD, c_ptr->m_idx, &dam_max0); + if (f4 & RF4_BR_POIS) spell_damcalc_by_spellnum(MS_BR_POIS, GF_POIS, c_ptr->m_idx, &dam_max0); + if (f4 & RF4_BR_NETH) spell_damcalc_by_spellnum(MS_BR_NETHER, GF_NETHER, c_ptr->m_idx, &dam_max0); + if (f4 & RF4_BR_LITE) spell_damcalc_by_spellnum(MS_BR_LITE, GF_LITE, c_ptr->m_idx, &dam_max0); + if (f4 & RF4_BR_DARK) spell_damcalc_by_spellnum(MS_BR_DARK, GF_DARK, c_ptr->m_idx, &dam_max0); + if (f4 & RF4_BR_CONF) spell_damcalc_by_spellnum(MS_BR_CONF, GF_CONFUSION, c_ptr->m_idx, &dam_max0); + if (f4 & RF4_BR_SOUN) spell_damcalc_by_spellnum(MS_BR_SOUND, GF_SOUND, c_ptr->m_idx, &dam_max0); + if (f4 & RF4_BR_CHAO) spell_damcalc_by_spellnum(MS_BR_CHAOS, GF_CHAOS, c_ptr->m_idx, &dam_max0); + if (f4 & RF4_BR_DISE) spell_damcalc_by_spellnum(MS_BR_DISEN, GF_DISENCHANT, c_ptr->m_idx, &dam_max0); + if (f4 & RF4_BR_NEXU) spell_damcalc_by_spellnum(MS_BR_NEXUS, GF_NEXUS, c_ptr->m_idx, &dam_max0); + if (f4 & RF4_BR_TIME) spell_damcalc_by_spellnum(MS_BR_TIME, GF_TIME, c_ptr->m_idx, &dam_max0); + if (f4 & RF4_BR_INER) spell_damcalc_by_spellnum(MS_BR_INERTIA, GF_INERTIAL, c_ptr->m_idx, &dam_max0); + if (f4 & RF4_BR_GRAV) spell_damcalc_by_spellnum(MS_BR_GRAVITY, GF_GRAVITY, c_ptr->m_idx, &dam_max0); + if (f4 & RF4_BR_SHAR) spell_damcalc_by_spellnum(MS_BR_SHARDS, GF_SHARDS, c_ptr->m_idx, &dam_max0); + if (f4 & RF4_BR_PLAS) spell_damcalc_by_spellnum(MS_BR_PLASMA, GF_PLASMA, c_ptr->m_idx, &dam_max0); + if (f4 & RF4_BR_WALL) spell_damcalc_by_spellnum(MS_BR_FORCE, GF_FORCE, c_ptr->m_idx, &dam_max0); + if (f4 & RF4_BR_MANA) spell_damcalc_by_spellnum(MS_BR_MANA, GF_MANA, c_ptr->m_idx, &dam_max0); + if (f4 & RF4_BR_NUKE) spell_damcalc_by_spellnum(MS_BR_NUKE, GF_NUKE, c_ptr->m_idx, &dam_max0); + if (f4 & RF4_BR_DISI) spell_damcalc_by_spellnum(MS_BR_DISI, GF_DISINTEGRATE, c_ptr->m_idx, &dam_max0); } /* Monster melee attacks */ @@ -7121,20 +7194,14 @@ bool process_warning(int xx, int yy) { object_type *o_ptr = choose_warning_item(); - if (o_ptr) object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); -#ifdef JP - else strcpy(o_name, "ÂÎ"); /* Warning ability without item */ - msg_format("%s¤¬±Ô¤¯¿Ì¤¨¤¿¡ª", o_name); -#else - else strcpy(o_name, "body"); /* Warning ability without item */ - msg_format("Your %s pulsates sharply!", o_name); -#endif + if (o_ptr) + object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); + else + strcpy(o_name, _("体", "body")); /* Warning ability without item */ + msg_format(_("%sが鋭く震えた!", "Your %s pulsates sharply!"), o_name); + disturb(0, 1); -#ifdef JP - return get_check("ËÜÅö¤Ë¤³¤Î¤Þ¤Þ¿Ê¤à¤«¡©"); -#else - return get_check("Really want to go ahead? "); -#endif + return get_check(_("本当にこのまま進むか?", "Really want to go ahead? ")); } } else old_damage = old_damage / 2; @@ -7145,26 +7212,23 @@ bool process_warning(int xx, int yy) { object_type *o_ptr = choose_warning_item(); - if (o_ptr) object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); -#ifdef JP - else strcpy(o_name, "ÂÎ"); /* Warning ability without item */ - msg_format("%s¤¬¿Ì¤¨¤¿¡ª", o_name); -#else - else strcpy(o_name, "body"); /* Warning ability without item */ - msg_format("Your %s pulsates!", o_name); -#endif + if (o_ptr) + object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); + else + strcpy(o_name, _("体", "body")); /* Warning ability without item */ + msg_format(_("%sが鋭く震えた!", "Your %s pulsates sharply!"), o_name); disturb(0, 1); -#ifdef JP - return get_check("ËÜÅö¤Ë¤³¤Î¤Þ¤Þ¿Ê¤à¤«¡©"); -#else - return get_check("Really want to go ahead? "); -#endif + return get_check(_("本当にこのまま進むか?", "Really want to go ahead? ")); } return TRUE; } - +/*! + * @brief エッセンスの付加可能な武器や矢弾かを返す + * @param o_ptr チェックしたいオブジェクトの構造体参照ポインタ + * @return エッセンスの付加可能な武器か矢弾ならばTRUEを返す。 + */ static bool item_tester_hook_melee_ammo(object_type *o_ptr) { switch (o_ptr->tval) @@ -7188,129 +7252,129 @@ static bool item_tester_hook_melee_ammo(object_type *o_ptr) } -/* - * A structure for smithing +/*! + * エッセンス情報の構造体 / A structure for smithing */ typedef struct { int add; /* TR flag number or special essence id */ cptr add_name; /* Name of this ability */ - int type; /* Menu number */ + ESSENCE_IDX type; /* Menu number */ int essence; /* Index for carrying essences */ int value; /* Needed value to add this ability */ } essence_type; -/* - * Smithing type data for Weapon smith +/*! + * エッセンス情報テーブル Smithing type data for Weapon smith */ #ifdef JP static essence_type essence_info[] = { - {TR_STR, "ÏÓÎÏ", 4, TR_STR, 20}, - {TR_INT, "ÃÎǽ", 4, TR_INT, 20}, - {TR_WIS, "¸­¤µ", 4, TR_WIS, 20}, - {TR_DEX, "´ïÍѤµ", 4, TR_DEX, 20}, - {TR_CON, "Âѵ×ÎÏ", 4, TR_CON, 20}, - {TR_CHR, "Ì¥ÎÏ", 4, TR_CHR, 20}, - {TR_MAGIC_MASTERY, "ËâÎÏ»ÙÇÛ", 4, TR_MAGIC_MASTERY, 20}, - {TR_STEALTH, "±£Ì©", 4, TR_STEALTH, 40}, - {TR_SEARCH, "õº÷", 4, TR_SEARCH, 15}, - {TR_INFRA, "ÀÖ³°Àþ»ëÎÏ", 4, TR_INFRA, 15}, - {TR_TUNNEL, "ºÎ·¡", 4, TR_TUNNEL, 15}, - {TR_SPEED, "¥¹¥Ô¡¼¥É", 4, TR_SPEED, 12}, - {TR_BLOWS, "Äɲù¶·â", 1, TR_BLOWS, 20}, - {TR_CHAOTIC, "¥«¥ª¥¹¹¶·â", 1, TR_CHAOTIC, 15}, - {TR_VAMPIRIC, "µÛ·ì¹¶·â", 1, TR_VAMPIRIC, 60}, - {TR_IMPACT, "ÃÏ¿Ìȯư", 7, TR_IMPACT, 15}, - {TR_BRAND_POIS, "ÆÇ»¦", 1, TR_BRAND_POIS, 20}, - {TR_BRAND_ACID, "Íϲò", 1, TR_BRAND_ACID, 20}, - {TR_BRAND_ELEC, "ÅÅ·â", 1, TR_BRAND_ELEC, 20}, - {TR_BRAND_FIRE, "¾Æ´þ", 1, TR_BRAND_FIRE, 20}, - {TR_BRAND_COLD, "Åà·ë", 1, TR_BRAND_COLD, 20}, - {TR_SUST_STR, "ÏÓÎÏ°Ý»ý", 3, TR_SUST_STR, 15}, - {TR_SUST_INT, "ÃÎǽ°Ý»ý", 3, TR_SUST_STR, 15}, - {TR_SUST_WIS, "¸­¤µ°Ý»ý", 3, TR_SUST_STR, 15}, - {TR_SUST_DEX, "´ïÍѤµ°Ý»ý", 3, TR_SUST_STR, 15}, - {TR_SUST_CON, "Âѵ×ÎÏ°Ý»ý", 3, TR_SUST_STR, 15}, - {TR_SUST_CHR, "Ì¥ÎÏ°Ý»ý", 3, TR_SUST_STR, 15}, - {TR_IM_ACID, "»ÀÌȱÖ", 2, TR_IM_ACID, 20}, - {TR_IM_ELEC, "ÅÅ·âÌȱÖ", 2, TR_IM_ACID, 20}, - {TR_IM_FIRE, "²Ð±êÌȱÖ", 2, TR_IM_ACID, 20}, - {TR_IM_COLD, "Î䵤ÌȱÖ", 2, TR_IM_ACID, 20}, - {TR_REFLECT, "È¿¼Í", 2, TR_REFLECT, 20}, - {TR_FREE_ACT, "ËãáãÃΤ餺", 3, TR_FREE_ACT, 20}, - {TR_HOLD_LIFE, "À¸Ì¿ÎÏ°Ý»ý", 3, TR_HOLD_LIFE, 20}, - {TR_RES_ACID, "ÂÑ»À", 2, TR_RES_ACID, 15}, - {TR_RES_ELEC, "ÂÑÅÅ·â", 2, TR_RES_ELEC, 15}, - {TR_RES_FIRE, "ÂѲбê", 2, TR_RES_FIRE, 15}, - {TR_RES_COLD, "ÂÑÎ䵤", 2, TR_RES_COLD, 15}, - {TR_RES_POIS, "ÂÑÆÇ", 2, TR_RES_POIS, 25}, - {TR_RES_FEAR, "ÂѶ²ÉÝ", 2, TR_RES_FEAR, 20}, - {TR_RES_LITE, "ÂÑÁ®¸÷", 2, TR_RES_LITE, 20}, - {TR_RES_DARK, "ÂѰŹõ", 2, TR_RES_DARK, 20}, - {TR_RES_BLIND, "ÂÑÌÕÌÜ", 2, TR_RES_BLIND, 20}, - {TR_RES_CONF, "ÂѺ®Íð", 2, TR_RES_CONF, 20}, - {TR_RES_SOUND, "Âѹ첻", 2, TR_RES_SOUND, 20}, - {TR_RES_SHARDS, "ÂÑÇËÊÒ", 2, TR_RES_SHARDS, 20}, - {TR_RES_NETHER, "ÂÑÃϹö", 2, TR_RES_NETHER, 20}, - {TR_RES_NEXUS, "ÂÑ°ø²Ìº®Íð", 2, TR_RES_NEXUS, 20}, - {TR_RES_CHAOS, "ÂÑ¥«¥ª¥¹", 2, TR_RES_CHAOS, 20}, - {TR_RES_DISEN, "ÂÑÎô²½", 2, TR_RES_DISEN, 20}, + {TR_STR, "腕力", 4, TR_STR, 20}, + {TR_INT, "知能", 4, TR_INT, 20}, + {TR_WIS, "賢さ", 4, TR_WIS, 20}, + {TR_DEX, "器用さ", 4, TR_DEX, 20}, + {TR_CON, "耐久力", 4, TR_CON, 20}, + {TR_CHR, "魅力", 4, TR_CHR, 20}, + {TR_MAGIC_MASTERY, "魔力支配", 4, TR_MAGIC_MASTERY, 20}, + {TR_STEALTH, "隠密", 4, TR_STEALTH, 40}, + {TR_SEARCH, "探索", 4, TR_SEARCH, 15}, + {TR_INFRA, "赤外線視力", 4, TR_INFRA, 15}, + {TR_TUNNEL, "採掘", 4, TR_TUNNEL, 15}, + {TR_SPEED, "スピード", 4, TR_SPEED, 12}, + {TR_BLOWS, "追加攻撃", 1, TR_BLOWS, 20}, + {TR_CHAOTIC, "カオス攻撃", 1, TR_CHAOTIC, 15}, + {TR_VAMPIRIC, "吸血攻撃", 1, TR_VAMPIRIC, 60}, + {TR_IMPACT, "地震発動", 7, TR_IMPACT, 15}, + {TR_BRAND_POIS, "毒殺", 1, TR_BRAND_POIS, 20}, + {TR_BRAND_ACID, "溶解", 1, TR_BRAND_ACID, 20}, + {TR_BRAND_ELEC, "電撃", 1, TR_BRAND_ELEC, 20}, + {TR_BRAND_FIRE, "焼棄", 1, TR_BRAND_FIRE, 20}, + {TR_BRAND_COLD, "凍結", 1, TR_BRAND_COLD, 20}, + {TR_SUST_STR, "腕力維持", 3, TR_SUST_STR, 15}, + {TR_SUST_INT, "知能維持", 3, TR_SUST_STR, 15}, + {TR_SUST_WIS, "賢さ維持", 3, TR_SUST_STR, 15}, + {TR_SUST_DEX, "器用さ維持", 3, TR_SUST_STR, 15}, + {TR_SUST_CON, "耐久力維持", 3, TR_SUST_STR, 15}, + {TR_SUST_CHR, "魅力維持", 3, TR_SUST_STR, 15}, + {TR_IM_ACID, "酸免疫", 2, TR_IM_ACID, 20}, + {TR_IM_ELEC, "電撃免疫", 2, TR_IM_ACID, 20}, + {TR_IM_FIRE, "火炎免疫", 2, TR_IM_ACID, 20}, + {TR_IM_COLD, "冷気免疫", 2, TR_IM_ACID, 20}, + {TR_REFLECT, "反射", 2, TR_REFLECT, 20}, + {TR_FREE_ACT, "麻痺知らず", 3, TR_FREE_ACT, 20}, + {TR_HOLD_EXP, "経験値維持", 3, TR_HOLD_EXP, 20}, + {TR_RES_ACID, "耐酸", 2, TR_RES_ACID, 15}, + {TR_RES_ELEC, "耐電撃", 2, TR_RES_ELEC, 15}, + {TR_RES_FIRE, "耐火炎", 2, TR_RES_FIRE, 15}, + {TR_RES_COLD, "耐冷気", 2, TR_RES_COLD, 15}, + {TR_RES_POIS, "耐毒", 2, TR_RES_POIS, 25}, + {TR_RES_FEAR, "耐恐怖", 2, TR_RES_FEAR, 20}, + {TR_RES_LITE, "耐閃光", 2, TR_RES_LITE, 20}, + {TR_RES_DARK, "耐暗黒", 2, TR_RES_DARK, 20}, + {TR_RES_BLIND, "耐盲目", 2, TR_RES_BLIND, 20}, + {TR_RES_CONF, "耐混乱", 2, TR_RES_CONF, 20}, + {TR_RES_SOUND, "耐轟音", 2, TR_RES_SOUND, 20}, + {TR_RES_SHARDS, "耐破片", 2, TR_RES_SHARDS, 20}, + {TR_RES_NETHER, "耐地獄", 2, TR_RES_NETHER, 20}, + {TR_RES_NEXUS, "耐因果混乱", 2, TR_RES_NEXUS, 20}, + {TR_RES_CHAOS, "耐カオス", 2, TR_RES_CHAOS, 20}, + {TR_RES_DISEN, "耐劣化", 2, TR_RES_DISEN, 20}, {TR_SH_FIRE, "", 0, -2, 0}, {TR_SH_ELEC, "", 0, -2, 0}, {TR_SH_COLD, "", 0, -2, 0}, - {TR_NO_MAGIC, "È¿ËâË¡", 3, TR_NO_MAGIC, 15}, - {TR_WARNING, "·Ù¹ð", 3, TR_WARNING, 20}, - {TR_LEVITATION, "ÉâÍ·", 3, TR_LEVITATION, 20}, - {TR_LITE_1, "±Êµ×¸÷¸»", 3, TR_LITE_1, 15}, + {TR_NO_MAGIC, "反魔法", 3, TR_NO_MAGIC, 15}, + {TR_WARNING, "警告", 3, TR_WARNING, 20}, + {TR_LEVITATION, "浮遊", 3, TR_LEVITATION, 20}, + {TR_LITE_1, "永久光源", 3, TR_LITE_1, 15}, {TR_LITE_2, "", 0, -2, 0}, {TR_LITE_3, "", 0, -2, 0}, - {TR_SEE_INVIS, "²Ä»ëÆ©ÌÀ", 3, TR_SEE_INVIS, 20}, - {TR_TELEPATHY, "¥Æ¥ì¥Ñ¥·¡¼", 6, TR_TELEPATHY, 15}, - {TR_SLOW_DIGEST, "Ãپò½", 3, TR_SLOW_DIGEST, 15}, - {TR_REGEN, "µÞ®²óÉü", 3, TR_REGEN, 20}, - {TR_TELEPORT, "¥Æ¥ì¥Ý¡¼¥È", 3, TR_TELEPORT, 25}, - - {TR_SLAY_EVIL, "¼Ù°­ÇÜÂÇ", 5, TR_SLAY_EVIL, 100}, - {TR_KILL_EVIL, "¼Ù°­ÇÜÇÜÂÇ", 0, TR_SLAY_EVIL, 60}, - {TR_SLAY_ANIMAL, "ưʪÇÜÂÇ", 5, TR_SLAY_ANIMAL, 20}, - {TR_KILL_ANIMAL, "ưʪÇÜÇÜÂÇ", 5, TR_SLAY_ANIMAL, 60}, - {TR_SLAY_UNDEAD, "ÉÔ»àÇÜÂÇ", 5, TR_SLAY_UNDEAD, 20}, - {TR_KILL_UNDEAD, "ÉÔ»àÇÜÇÜÂÇ", 5, TR_SLAY_UNDEAD, 60}, - {TR_SLAY_DEMON, "°­ËâÇÜÂÇ", 5, TR_SLAY_DEMON, 20}, - {TR_KILL_DEMON, "°­ËâÇÜÇÜÂÇ", 5, TR_SLAY_DEMON, 60}, - {TR_SLAY_ORC, "¥ª¡¼¥¯ÇÜÂÇ", 5, TR_SLAY_ORC, 15}, - {TR_KILL_ORC, "¥ª¡¼¥¯ÇÜÇÜÂÇ", 5, TR_SLAY_ORC, 60}, - {TR_SLAY_TROLL, "¥È¥í¥ëÇÜÂÇ", 5, TR_SLAY_TROLL, 15}, - {TR_KILL_TROLL, "¥È¥í¥ëÇÜÇÜÂÇ", 5, TR_SLAY_TROLL, 60}, - {TR_SLAY_GIANT, "µð¿ÍÇÜÂÇ", 5, TR_SLAY_GIANT, 20}, - {TR_KILL_GIANT, "µð¿ÍÇÜÇÜÂÇ", 5, TR_SLAY_GIANT, 60}, - {TR_SLAY_DRAGON, "εÇÜÂÇ", 5, TR_SLAY_DRAGON, 20}, - {TR_KILL_DRAGON, "εÇÜÇÜÂÇ", 5, TR_SLAY_DRAGON, 60}, - {TR_SLAY_HUMAN, "¿Í´ÖÇÜÂÇ", 5, TR_SLAY_HUMAN, 20}, - {TR_KILL_HUMAN, "¿Í´ÖÇÜÇÜÂÇ", 5, TR_SLAY_HUMAN, 60}, - - {TR_ESP_ANIMAL, "ưʪESP", 6, TR_SLAY_ANIMAL, 40}, - {TR_ESP_UNDEAD, "ÉÔ»àESP", 6, TR_SLAY_UNDEAD, 40}, - {TR_ESP_DEMON, "°­ËâESP", 6, TR_SLAY_DEMON, 40}, - {TR_ESP_ORC, "¥ª¡¼¥¯ESP", 6, TR_SLAY_ORC, 40}, - {TR_ESP_TROLL, "¥È¥í¥ëESP", 6, TR_SLAY_TROLL, 40}, - {TR_ESP_GIANT, "µð¿ÍESP", 6, TR_SLAY_GIANT, 40}, - {TR_ESP_DRAGON, "εESP", 6, TR_SLAY_DRAGON, 40}, - {TR_ESP_HUMAN, "¿Í´ÖESP", 6, TR_SLAY_HUMAN, 40}, - - {ESSENCE_ATTACK, "¹¶·â", 10, TR_ES_ATTACK, 30}, - {ESSENCE_AC, "Ëɸæ", 10, TR_ES_AC, 15}, - {ESSENCE_TMP_RES_ACID, "»ÀÂÑÀ­È¯Æ°", 7, TR_RES_ACID, 50}, - {ESSENCE_TMP_RES_ELEC, "ÅÅ·âÂÑÀ­È¯Æ°", 7, TR_RES_ELEC, 50}, - {ESSENCE_TMP_RES_FIRE, "²Ð±êÂÑÀ­È¯Æ°", 7, TR_RES_FIRE, 50}, - {ESSENCE_TMP_RES_COLD, "Î䵤ÂÑÀ­È¯Æ°", 7, TR_RES_COLD, 50}, - {ESSENCE_SH_FIRE, "²Ð±ê¥ª¡¼¥é", 7, -1, 50}, - {ESSENCE_SH_ELEC, "Åŷ⥪¡¼¥é", 7, -1, 50}, - {ESSENCE_SH_COLD, "Î䵤¥ª¡¼¥é", 7, -1, 50}, - {ESSENCE_RESISTANCE, "Á´ÂÑÀ­", 2, -1, 150}, - {ESSENCE_SUSTAIN, "ÁõÈ÷ÊÝ»ý", 10, -1, 10}, - {ESSENCE_SLAY_GLOVE, "»¦Ù¤¤Î¾®¼ê", 1, TR_ES_ATTACK, 200}, + {TR_SEE_INVIS, "可視透明", 3, TR_SEE_INVIS, 20}, + {TR_TELEPATHY, "テレパシー", 6, TR_TELEPATHY, 15}, + {TR_SLOW_DIGEST, "遅消化", 3, TR_SLOW_DIGEST, 15}, + {TR_REGEN, "急速回復", 3, TR_REGEN, 20}, + {TR_TELEPORT, "テレポート", 3, TR_TELEPORT, 25}, + + {TR_SLAY_EVIL, "邪悪倍打", 5, TR_SLAY_EVIL, 100}, + {TR_KILL_EVIL, "邪悪倍倍打", 0, TR_SLAY_EVIL, 60}, + {TR_SLAY_ANIMAL, "動物倍打", 5, TR_SLAY_ANIMAL, 20}, + {TR_KILL_ANIMAL, "動物倍倍打", 5, TR_SLAY_ANIMAL, 60}, + {TR_SLAY_UNDEAD, "不死倍打", 5, TR_SLAY_UNDEAD, 20}, + {TR_KILL_UNDEAD, "不死倍倍打", 5, TR_SLAY_UNDEAD, 60}, + {TR_SLAY_DEMON, "悪魔倍打", 5, TR_SLAY_DEMON, 20}, + {TR_KILL_DEMON, "悪魔倍倍打", 5, TR_SLAY_DEMON, 60}, + {TR_SLAY_ORC, "オーク倍打", 5, TR_SLAY_ORC, 15}, + {TR_KILL_ORC, "オーク倍倍打", 5, TR_SLAY_ORC, 60}, + {TR_SLAY_TROLL, "トロル倍打", 5, TR_SLAY_TROLL, 15}, + {TR_KILL_TROLL, "トロル倍倍打", 5, TR_SLAY_TROLL, 60}, + {TR_SLAY_GIANT, "巨人倍打", 5, TR_SLAY_GIANT, 20}, + {TR_KILL_GIANT, "巨人倍倍打", 5, TR_SLAY_GIANT, 60}, + {TR_SLAY_DRAGON, "竜倍打", 5, TR_SLAY_DRAGON, 20}, + {TR_KILL_DRAGON, "竜倍倍打", 5, TR_SLAY_DRAGON, 60}, + {TR_SLAY_HUMAN, "人間倍打", 5, TR_SLAY_HUMAN, 20}, + {TR_KILL_HUMAN, "人間倍倍打", 5, TR_SLAY_HUMAN, 60}, + + {TR_ESP_ANIMAL, "動物ESP", 6, TR_SLAY_ANIMAL, 40}, + {TR_ESP_UNDEAD, "不死ESP", 6, TR_SLAY_UNDEAD, 40}, + {TR_ESP_DEMON, "悪魔ESP", 6, TR_SLAY_DEMON, 40}, + {TR_ESP_ORC, "オークESP", 6, TR_SLAY_ORC, 40}, + {TR_ESP_TROLL, "トロルESP", 6, TR_SLAY_TROLL, 40}, + {TR_ESP_GIANT, "巨人ESP", 6, TR_SLAY_GIANT, 40}, + {TR_ESP_DRAGON, "竜ESP", 6, TR_SLAY_DRAGON, 40}, + {TR_ESP_HUMAN, "人間ESP", 6, TR_SLAY_HUMAN, 40}, + + {ESSENCE_ATTACK, "攻撃", 10, TR_ES_ATTACK, 30}, + {ESSENCE_AC, "防御", 10, TR_ES_AC, 15}, + {ESSENCE_TMP_RES_ACID, "酸耐性発動", 7, TR_RES_ACID, 50}, + {ESSENCE_TMP_RES_ELEC, "電撃耐性発動", 7, TR_RES_ELEC, 50}, + {ESSENCE_TMP_RES_FIRE, "火炎耐性発動", 7, TR_RES_FIRE, 50}, + {ESSENCE_TMP_RES_COLD, "冷気耐性発動", 7, TR_RES_COLD, 50}, + {ESSENCE_SH_FIRE, "火炎オーラ", 7, -1, 50}, + {ESSENCE_SH_ELEC, "電撃オーラ", 7, -1, 50}, + {ESSENCE_SH_COLD, "冷気オーラ", 7, -1, 50}, + {ESSENCE_RESISTANCE, "全耐性", 2, -1, 150}, + {ESSENCE_SUSTAIN, "装備保持", 10, -1, 10}, + {ESSENCE_SLAY_GLOVE, "殺戮の小手", 1, TR_ES_ATTACK, 200}, {-1, NULL, 0, -1, 0} }; @@ -7350,7 +7414,7 @@ static essence_type essence_info[] = {TR_IM_COLD, "cold immunity", 2, TR_IM_ACID, 20}, {TR_REFLECT, "reflection", 2, TR_REFLECT, 20}, {TR_FREE_ACT, "free action", 3, TR_FREE_ACT, 20}, - {TR_HOLD_LIFE, "hold life", 3, TR_HOLD_LIFE, 20}, + {TR_HOLD_EXP, "hold experience", 3, TR_HOLD_EXP, 20}, {TR_RES_ACID, "resistance to acid", 2, TR_RES_ACID, 15}, {TR_RES_ELEC, "resistance to electric", 2, TR_RES_ELEC, 15}, {TR_RES_FIRE, "resistance to fire", 2, TR_RES_FIRE, 15}, @@ -7428,45 +7492,45 @@ static essence_type essence_info[] = #endif -/* - * Essense names for Weapon smith +/*! + * エッセンス名テーブル / Essense names for Weapon smith */ #ifdef JP cptr essence_name[] = { - "ÏÓÎÏ", - "ÃÎǽ", - "¸­¤µ", - "´ïÍѤµ", - "Âѵ×ÎÏ", - "Ì¥ÎÏ", - "ËâÎÏ»ÙÇÛ", + "腕力", + "知能", + "賢さ", + "器用さ", + "耐久力", + "魅力", + "魔力支配", "", - "±£Ì©", - "õº÷", - "ÀÖ³°Àþ»ëÎÏ", - "ºÎ·¡", - "¥¹¥Ô¡¼¥É", - "Äɲù¶·â", - "¥«¥ª¥¹¹¶·â", - "µÛ·ì¹¶·â", - "ưʪÇÜÂÇ", - "¼Ù°­ÇÜÂÇ", - "ÉÔ»àÇÜÂÇ", - "°­ËâÇÜÂÇ", - "¥ª¡¼¥¯ÇÜÂÇ", - "¥È¥í¥ëÇÜÂÇ", - "µð¿ÍÇÜÂÇ", - "εÇÜÂÇ", + "隠密", + "探索", + "赤外線視力", + "採掘", + "スピード", + "追加攻撃", + "カオス攻撃", + "吸血攻撃", + "動物倍打", + "邪悪倍打", + "不死倍打", + "悪魔倍打", + "オーク倍打", + "トロル倍打", + "巨人倍打", + "竜倍打", "", "", - "ÃÏ¿Ì", - "ÆÇ»¦", - "Íϲò", - "ÅÅ·â", - "¾Æ´þ", - "Åà·ë", - "ǽÎÏ°Ý»ý", + "地震", + "毒殺", + "溶解", + "電撃", + "焼棄", + "凍結", + "能力維持", "", "", "", @@ -7474,48 +7538,48 @@ cptr essence_name[] = "", "", "", - "ÌȱÖ", + "免疫", "", "", "", "", - "È¿¼Í", - "ËãáãÃΤ餺", - "À¸Ì¿ÎÏ°Ý»ý", - "ÂÑ»À", - "ÂÑÅÅ·â", - "ÂѲбê", - "ÂÑÎ䵤", - "ÂÑÆÇ", - "ÂѶ²ÉÝ", - "ÂÑÁ®¸÷", - "ÂѰŹõ", - "ÂÑÌÕÌÜ", - "ÂѺ®Íð", - "Âѹ첻", - "ÂÑÇËÊÒ", - "ÂÑÃϹö", - "ÂÑ°ø²Ìº®Íð", - "ÂÑ¥«¥ª¥¹", - "ÂÑÎô²½", + "反射", + "麻痺知らず", + "経験値維持", + "耐酸", + "耐電撃", + "耐火炎", + "耐冷気", + "耐毒", + "耐恐怖", + "耐閃光", + "耐暗黒", + "耐盲目", + "耐混乱", + "耐轟音", + "耐破片", + "耐地獄", + "耐因果混乱", + "耐カオス", + "耐劣化", "", "", - "¿Í´ÖÇÜÂÇ", + "人間倍打", "", "", - "È¿ËâË¡", + "反魔法", "", "", - "·Ù¹ð", + "警告", "", "", "", - "ÉâÍ·", - "±Êµ×¸÷¸»", - "²Ä»ëÆ©ÌÀ", - "¥Æ¥ì¥Ñ¥·¡¼", - "Ãپò½", - "µÞ®²óÉü", + "浮遊", + "永久光源", + "可視透明", + "テレパシー", + "遅消化", + "急速回復", "", "", "", @@ -7524,18 +7588,18 @@ cptr essence_name[] = "", "", "", - "¥Æ¥ì¥Ý¡¼¥È", + "テレポート", "", "", - "¹¶·â", - "Ëɸæ", + "攻撃", + "防御", NULL }; #else -static cptr essence_name[] = +cptr essence_name[] = { "strength", "intelligen.", @@ -7584,7 +7648,7 @@ static cptr essence_name[] = "", "reflection", "free action", - "hold life", + "hold exp", "res. acid", "res. elec.", "res. fire", @@ -7637,7 +7701,10 @@ static cptr essence_name[] = }; #endif - +/*! + * @brief 所持しているエッセンス一覧を表示する + * @return なし + */ static void display_essence(void) { int i, num = 0; @@ -7647,39 +7714,41 @@ static void display_essence(void) { prt("",i,0); } -#ifdef JP - prt("¥¨¥Ã¥»¥ó¥¹ ¸Ä¿ô ¥¨¥Ã¥»¥ó¥¹ ¸Ä¿ô ¥¨¥Ã¥»¥ó¥¹ ¸Ä¿ô", 1, 8); -#else - prt("Essence Num Essence Num Essence Num ", 1, 8); -#endif + prt(_("エッセンス 個数 エッセンス 個数 エッセンス 個数", + "Essence Num Essence Num Essence Num "), 1, 8); for (i = 0; essence_name[i]; i++) { if (!essence_name[i][0]) continue; prt(format("%-11s %5d", essence_name[i], p_ptr->magic_num1[i]), 2+num%21, 8+num/21*22); num++; } -#ifdef JP - prt("¸½ºß½ê»ý¤·¤Æ¤¤¤ë¥¨¥Ã¥»¥ó¥¹", 0, 0); -#else - prt("List of all essences you have.", 0, 0); -#endif + prt(_("現在所持しているエッセンス", "List of all essences you have."), 0, 0); (void)inkey(); screen_load(); return; } +/*! + * @brief エッセンスの抽出処理 + * @return なし + */ static void drain_essence(void) { int drain_value[sizeof(p_ptr->magic_num1) / sizeof(s32b)]; - int i, item; + int i; + OBJECT_IDX item; int dec = 4; bool observe = FALSE; - int old_ds, old_dd, old_to_h, old_to_d, old_ac, old_to_a, old_pval, old_name2, old_timeout; - u32b old_flgs[TR_FLAG_SIZE], new_flgs[TR_FLAG_SIZE]; + int old_ds, old_dd, old_to_h, old_to_d, old_ac, old_to_a, old_pval, old_name2; + TIME_EFFECT old_timeout; + BIT_FLAGS old_flgs[TR_FLAG_SIZE], new_flgs[TR_FLAG_SIZE]; object_type *o_ptr; - cptr q, s; - byte iy, ix, marked, number; - s16b next_o_idx, weight; + cptr q, s; + POSITION iy, ix; + byte_hack marked; + ITEM_NUMBER number; + OBJECT_IDX next_o_idx; + WEIGHT weight; for (i = 0; i < sizeof(drain_value) / sizeof(int); i++) drain_value[i] = 0; @@ -7688,13 +7757,8 @@ static void drain_essence(void) item_tester_no_ryoute = TRUE; /* Get an item */ -#ifdef JP - q = "¤É¤Î¥¢¥¤¥Æ¥à¤«¤éÃê½Ð¤·¤Þ¤¹¤«¡©"; - s = "Ãê½Ð¤Ç¤­¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£"; -#else - q = "Extract from which item? "; - s = "You have nothing you can extract from."; -#endif + q = _("どのアイテムから抽出しますか?", "Extract from which item? "); + s = _("抽出できるアイテムがありません。", "You have nothing you can extract from."); if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; @@ -7714,14 +7778,10 @@ static void drain_essence(void) { char o_name[MAX_NLEN]; object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); -#ifdef JP - if (!get_check(format("ËÜÅö¤Ë%s¤«¤éÃê½Ð¤·¤Æ¤è¤í¤·¤¤¤Ç¤¹¤«¡©", o_name))) return; -#else - if (!get_check(format("Really extract from %s? ", o_name))) return; -#endif + if (!get_check(format(_("本当に%sから抽出してよろしいですか?", "Really extract from %s? "), o_name))) return; } - energy_use = 100; + p_ptr->energy_use = 100; object_flags(o_ptr, old_flgs); if (have_flag(old_flgs, TR_KILL_DRAGON)) add_flag(old_flgs, TR_SLAY_DRAGON); @@ -7788,7 +7848,7 @@ static void drain_essence(void) for (i = 0; essence_info[i].add_name; i++) { essence_type *es_ptr = &essence_info[i]; - int pval = 0; + PARAMETER_VALUE pval = 0; if (es_ptr->add < TR_FLAG_MAX && is_pval_flag(es_ptr->add) && old_pval) pval = (have_flag(new_flgs, es_ptr->add)) ? old_pval - o_ptr->pval : old_pval; @@ -7884,11 +7944,11 @@ static void drain_essence(void) } if (!observe) { - msg_print(_("¥¨¥Ã¥»¥ó¥¹¤ÏÃê½Ð¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£", "You were not able to extract any essence.")); + msg_print(_("エッセンスは抽出できませんでした。", "You were not able to extract any essence.")); } else { - msg_print(_("Ãê½Ð¤·¤¿¥¨¥Ã¥»¥ó¥¹:", "Extracted essences:")); + msg_print(_("抽出したエッセンス:", "Extracted essences:")); for (i = 0; essence_name[i]; i++) { @@ -7898,7 +7958,7 @@ static void drain_essence(void) p_ptr->magic_num1[i] += drain_value[i]; p_ptr->magic_num1[i] = MIN(20000, p_ptr->magic_num1[i]); msg_print(NULL); - msg_format("%s...%d%s", essence_name[i], drain_value[i], _("¡£", ". ")); + msg_format("%s...%d%s", essence_name[i], drain_value[i], _("。", ". ")); } } @@ -7912,23 +7972,25 @@ static void drain_essence(void) p_ptr->window |= (PW_INVEN); } - - -static int choose_essence(void) +/*! + * @brief 付加するエッセンスの大別を選択する + * @return 選んだエッセンスの大別ID + */ +static COMMAND_CODE choose_essence(void) { - int mode = 0; + COMMAND_CODE mode = 0; char choice; - int menu_line = (use_menu ? 1 : 0); + COMMAND_CODE menu_line = (use_menu ? 1 : 0); #ifdef JP cptr menu_name[] = { - "Éð´ï°À­", - "ÂÑÀ­", - "ǽÎÏ", - "¿ôÃÍ", - "¥¹¥ì¥¤", + "武器属性", + "耐性", + "能力", + "数値", + "スレイ", "ESP", - "¤½¤Î¾" + "その他" }; #else cptr menu_name[] = { @@ -7941,7 +8003,7 @@ static int choose_essence(void) "Others" }; #endif - const int mode_max = 7; + const COMMAND_CODE mode_max = 7; #ifdef ALLOW_REPEAT if (repeat_pull(&mode) && 1 <= mode && mode <= mode_max) @@ -7958,8 +8020,8 @@ static int choose_essence(void) int i; for (i = 0; i < mode_max; i++) #ifdef JP - prt(format(" %s %s", (menu_line == 1+i) ? "¡Õ" : " ", menu_name[i]), 2 + i, 14); - prt("¤É¤Î¼ïÎà¤Î¥¨¥Ã¥»¥ó¥¹Éղäò¹Ô¤¤¤Þ¤¹¤«¡©", 0, 0); + prt(format(" %s %s", (menu_line == 1+i) ? "》" : " ", menu_name[i]), 2 + i, 14); + prt("どの種類のエッセンス付加を行いますか?", 0, 0); #else prt(format(" %s %s", (menu_line == 1+i) ? "> " : " ", menu_name[i]), 2 + i, 14); prt("Choose from menu.", 0, 0); @@ -8004,17 +8066,13 @@ static int choose_essence(void) for (i = 0; i < mode_max; i++) prt(format(" %c) %s", 'a' + i, menu_name[i]), 2 + i, 14); -#ifdef JP - if (!get_com("²¿¤òÉղä·¤Þ¤¹¤«:", &choice, TRUE)) -#else - if (!get_com("Command :", &choice, TRUE)) -#endif + if (!get_com(_("何を付加しますか:", "Command :"), &choice, TRUE)) { screen_load(); return 0; } - if (isupper(choice)) choice = tolower(choice); + if (isupper(choice)) choice = (char)tolower(choice); if ('a' <= choice && choice <= 'a' + (char)mode_max - 1) mode = (int)choice - 'a' + 1; @@ -8028,10 +8086,16 @@ static int choose_essence(void) return mode; } -static void add_essence(int mode) +/*! + * @brief エッセンスを実際に付加する + * @param mode エッセンスの大別ID + * @return なし + */ +static void add_essence(ESSENCE_IDX mode) { - int item, max_num = 0; - int i; + OBJECT_IDX item; + int max_num = 0; + COMMAND_CODE i; bool flag,redraw; char choice; cptr q, s; @@ -8066,11 +8130,7 @@ static void add_essence(int mode) redraw = FALSE; /* Build a prompt */ -#ifdef JP - (void) strnfmt(out_val, 78, "('*'¤Ç°ìÍ÷, ESC¤ÇÃæÃÇ) ¤É¤ÎǽÎϤòÉղä·¤Þ¤¹¤«¡©"); -#else - (void)strnfmt(out_val, 78, "(*=List, ESC=exit) Add which ability? "); -#endif + (void) strnfmt(out_val, 78, _("('*'で一覧, ESCで中断) どの能力を付加しますか?", "(*=List, ESC=exit) Add which ability? ")); if (use_menu) screen_save(); /* Get a spell from the user */ @@ -8078,7 +8138,7 @@ static void add_essence(int mode) choice = (always_show_list || use_menu) ? ESCAPE:1; while (!flag) { - bool able[22]; + bool able[22] = {0}; if( choice==ESCAPE ) choice = ' '; else if( !get_com(out_val, &choice, FALSE) )break; @@ -8159,7 +8219,7 @@ static void add_essence(int mode) /* Print header(s) */ #ifdef JP - prt(format(" %-43s %6s/%s", "ǽÎÏ(ɬÍ×¥¨¥Ã¥»¥ó¥¹)", "ɬÍ׿ô", "½ê»ý¿ô"), 1, x); + prt(format(" %-43s %6s/%s", "能力(必要エッセンス)", "必要数", "所持数"), 1, x); #else prt(format(" %-43s %6s/%s", "Ability (needed essence)", "Needs", "Possess"), 1, x); @@ -8172,11 +8232,7 @@ static void add_essence(int mode) if (use_menu) { if (ctr == (menu_line-1)) -#ifdef JP - strcpy(dummy, "¡Õ "); -#else - strcpy(dummy, "> "); -#endif + strcpy(dummy, _("》 ", "> ")); else strcpy(dummy, " "); } @@ -8201,49 +8257,29 @@ static void add_essence(int mode) switch(es_ptr->add) { case ESSENCE_SH_FIRE: -#ifdef JP - strcat(dummy, "(¾Æ´þ+ÂѲбê)"); -#else - strcat(dummy, "(brand fire + res.fire)"); -#endif + strcat(dummy, _("(焼棄+耐火炎)", "(brand fire + res.fire)")); if (p_ptr->magic_num1[TR_BRAND_FIRE] < es_ptr->value) able[ctr] = FALSE; if (p_ptr->magic_num1[TR_RES_FIRE] < es_ptr->value) able[ctr] = FALSE; break; case ESSENCE_SH_ELEC: -#ifdef JP - strcat(dummy, "(ÅÅ·â+ÂÑÅÅ·â)"); -#else - strcat(dummy, "(brand elec. + res. elec.)"); -#endif + strcat(dummy, _("(電撃+耐電撃)", "(brand elec. + res. elec.)")); if (p_ptr->magic_num1[TR_BRAND_ELEC] < es_ptr->value) able[ctr] = FALSE; if (p_ptr->magic_num1[TR_RES_ELEC] < es_ptr->value) able[ctr] = FALSE; break; case ESSENCE_SH_COLD: -#ifdef JP - strcat(dummy, "(Åà·ë+ÂÑÎ䵤)"); -#else - strcat(dummy, "(brand cold + res. cold)"); -#endif + strcat(dummy, _("(凍結+耐冷気)", "(brand cold + res. cold)")); if (p_ptr->magic_num1[TR_BRAND_COLD] < es_ptr->value) able[ctr] = FALSE; if (p_ptr->magic_num1[TR_RES_COLD] < es_ptr->value) able[ctr] = FALSE; break; case ESSENCE_RESISTANCE: -#ifdef JP - strcat(dummy, "(ÂѲбê+ÂÑÎ䵤+ÂÑÅÅ·â+ÂÑ»À)"); -#else - strcat(dummy, "(r.fire+r.cold+r.elec+r.acid)"); -#endif + strcat(dummy, _("(耐火炎+耐冷気+耐電撃+耐酸)", "(r.fire+r.cold+r.elec+r.acid)")); if (p_ptr->magic_num1[TR_RES_FIRE] < es_ptr->value) able[ctr] = FALSE; if (p_ptr->magic_num1[TR_RES_COLD] < es_ptr->value) able[ctr] = FALSE; if (p_ptr->magic_num1[TR_RES_ELEC] < es_ptr->value) able[ctr] = FALSE; if (p_ptr->magic_num1[TR_RES_ACID] < es_ptr->value) able[ctr] = FALSE; break; case ESSENCE_SUSTAIN: -#ifdef JP - strcat(dummy, "(ÂѲбê+ÂÑÎ䵤+ÂÑÅÅ·â+ÂÑ»À)"); -#else - strcat(dummy, "(r.fire+r.cold+r.elec+r.acid)"); -#endif + strcat(dummy, _("(耐火炎+耐冷気+耐電撃+耐酸)", "(r.fire+r.cold+r.elec+r.acid)")); if (p_ptr->magic_num1[TR_RES_FIRE] < es_ptr->value) able[ctr] = FALSE; if (p_ptr->magic_num1[TR_RES_COLD] < es_ptr->value) able[ctr] = FALSE; if (p_ptr->magic_num1[TR_RES_ELEC] < es_ptr->value) able[ctr] = FALSE; @@ -8287,7 +8323,7 @@ static void add_essence(int mode) ask = (isupper(choice)); /* Lowercase */ - if (ask) choice = tolower(choice); + if (ask) choice = (char)tolower(choice); /* Extract request */ i = (islower(choice) ? A2I(choice) : -1); @@ -8306,11 +8342,7 @@ static void add_essence(int mode) char tmp_val[160]; /* Prompt */ -#ifdef JP - (void) strnfmt(tmp_val, 78, "%s¤òÉղä·¤Þ¤¹¤«¡© ", essence_info[num[i]].add_name); -#else - (void) strnfmt(tmp_val, 78, "Add the abilitiy of %s? ", essence_info[num[i]].add_name); -#endif + (void) strnfmt(tmp_val, 78, _("%sを付加しますか? ", "Add the abilitiy of %s? "), essence_info[num[i]].add_name); /* Belay that order */ if (!get_check(tmp_val)) continue; @@ -8345,13 +8377,8 @@ static void add_essence(int mode) item_tester_no_ryoute = TRUE; /* Get an item */ -#ifdef JP - q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò²þÎɤ·¤Þ¤¹¤«¡©"; - s = "²þÎɤǤ­¤ë¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£"; -#else - q = "Improve which item? "; - s = "You have nothing to improve."; -#endif + q = _("どのアイテムを改良しますか?", "Improve which item? "); + s = _("改良できるアイテムがありません。", "You have nothing to improve."); if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; @@ -8369,11 +8396,7 @@ static void add_essence(int mode) if ((mode != 10) && (object_is_artifact(o_ptr) || object_is_smith(o_ptr))) { -#ifdef JP - msg_print("¤½¤Î¥¢¥¤¥Æ¥à¤Ï¤³¤ì°Ê¾å²þÎɤǤ­¤Ê¤¤¡£"); -#else - msg_print("This item is no more able to be improved."); -#endif + msg_print(_("そのアイテムはこれ以上改良できない。", "This item is no more able to be improved.")); return; } @@ -8384,97 +8407,60 @@ static void add_essence(int mode) if (o_ptr->number > 1) { use_essence *= o_ptr->number; -#ifdef JP - msg_format("%d¸Ä¤¢¤ë¤Î¤Ç¥¨¥Ã¥»¥ó¥¹¤Ï%dɬÍפǤ¹¡£", o_ptr->number, use_essence); -#else - msg_format("It will take %d essences.",use_essence); -#endif - + msg_format(_("%d個あるのでエッセンスは%d必要です。", "It will take %d essences."), o_ptr->number, use_essence); } if (es_ptr->essence != -1) { if (p_ptr->magic_num1[es_ptr->essence] < use_essence) { -#ifdef JP - msg_print("¥¨¥Ã¥»¥ó¥¹¤¬Â­¤ê¤Ê¤¤¡£"); -#else - msg_print("You don't have enough essences."); -#endif + msg_print(_("エッセンスが足りない。", "You don't have enough essences.")); return; } if (is_pval_flag(es_ptr->add)) { if (o_ptr->pval < 0) { -#ifdef JP - msg_print("¤³¤Î¥¢¥¤¥Æ¥à¤ÎǽÎϽ¤Àµ¤ò¶¯²½¤¹¤ë¤³¤È¤Ï¤Ç¤­¤Ê¤¤¡£"); -#else - msg_print("You cannot increase magic number of this item."); -#endif + msg_print(_("このアイテムの能力修正を強化することはできない。", "You cannot increase magic number of this item.")); return; } else if (es_ptr->add == TR_BLOWS) { if (o_ptr->pval > 1) { -#ifdef JP - if (!get_check("½¤ÀµÃͤÏ1¤Ë¤Ê¤ê¤Þ¤¹¡£¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) return; -#else - if (!get_check("The magic number of this weapon will become 1. Are you sure? ")) return; -#endif + if (!get_check(_("修正値は1になります。よろしいですか?", "The magic number of this weapon will become 1. Are you sure? "))) return; } o_ptr->pval = 1; -#ifdef JP - msg_format("¥¨¥Ã¥»¥ó¥¹¤ò%d¸Ä»ÈÍѤ·¤Þ¤¹¡£", use_essence); -#else - msg_format("It will take %d essences.", use_essence); -#endif + msg_format(_("エッセンスを%d個使用します。", "It will take %d essences."), use_essence); } else if (o_ptr->pval > 0) { use_essence *= o_ptr->pval; -#ifdef JP - msg_format("¥¨¥Ã¥»¥ó¥¹¤ò%d¸Ä»ÈÍѤ·¤Þ¤¹¡£", use_essence); -#else - msg_format("It will take %d essences.", use_essence); -#endif + msg_format(_("エッセンスを%d個使用します。", "It will take %d essences."), use_essence); } else { char tmp[80]; char tmp_val[160]; - int pval; - int limit = MIN(5, p_ptr->magic_num1[es_ptr->essence]/es_ptr->value); + PARAMETER_VALUE pval; + PARAMETER_VALUE limit = MIN(5, p_ptr->magic_num1[es_ptr->essence]/es_ptr->value); -#ifdef JP - sprintf(tmp, "¤¤¤¯¤ÄÉղä·¤Þ¤¹¤«¡© (1-%d): ", limit); -#else - sprintf(tmp, "Enchant how many? (1-%d): ", limit); -#endif + sprintf(tmp, _("いくつ付加しますか? (1-%d): ", "Enchant how many? (1-%d): "), limit); strcpy(tmp_val, "1"); if (!get_string(tmp, tmp_val, 1)) return; - pval = atoi(tmp_val); + pval = (PARAMETER_VALUE)atoi(tmp_val); if (pval > limit) pval = limit; else if (pval < 1) pval = 1; o_ptr->pval += pval; use_essence *= pval; -#ifdef JP - msg_format("¥¨¥Ã¥»¥ó¥¹¤ò%d¸Ä»ÈÍѤ·¤Þ¤¹¡£", use_essence); -#else - msg_format("It will take %d essences.", use_essence); -#endif + msg_format(_("エッセンスを%d個使用します。", "It will take %d essences."), use_essence); } if (p_ptr->magic_num1[es_ptr->essence] < use_essence) { -#ifdef JP - msg_print("¥¨¥Ã¥»¥ó¥¹¤¬Â­¤ê¤Ê¤¤¡£"); -#else - msg_print("You don't have enough essences."); -#endif + msg_print(_("エッセンスが足りない。", "You don't have enough essences.")); return; } } @@ -8482,30 +8468,19 @@ static void add_essence(int mode) { char tmp_val[160]; int val; - int get_to_h, get_to_d; + HIT_PROB get_to_h; + HIT_POINT get_to_d; strcpy(tmp_val, "1"); -#ifdef JP - if (!get_string(format("¤¤¤¯¤ÄÉղä·¤Þ¤¹¤«¡© (1-%d):", p_ptr->lev/7+3), tmp_val, 2)) return; -#else - if (!get_string(format("Enchant how many? (1-%d):", p_ptr->lev/7+3), tmp_val, 2)) return; -#endif + if (!get_string(format(_("いくつ付加しますか? (1-%d):", "Enchant how many? (1-%d):"), p_ptr->lev/7+3), tmp_val, 2)) return; val = atoi(tmp_val); if (val > p_ptr->lev/7+3) val = p_ptr->lev/7+3; else if (val < 1) val = 1; use_essence *= val; -#ifdef JP - msg_format("¥¨¥Ã¥»¥ó¥¹¤ò%d¸Ä»ÈÍѤ·¤Þ¤¹¡£", use_essence); -#else - msg_format("It will take %d essences.", use_essence); -#endif + msg_format(_("エッセンスを%d個使用します。", "It will take %d essences."), use_essence); if (p_ptr->magic_num1[es_ptr->essence] < use_essence) { -#ifdef JP - msg_print("¥¨¥Ã¥»¥ó¥¹¤¬Â­¤ê¤Ê¤¤¡£"); -#else - msg_print("You don't have enough essences."); -#endif + msg_print(_("エッセンスが足りない。", "You don't have enough essences.")); return; } get_to_h = ((val+1)/2+randint0(val/2+1)); @@ -8519,12 +8494,8 @@ static void add_essence(int mode) { if ((o_ptr->to_h >= p_ptr->lev/5+5) && (o_ptr->to_d >= p_ptr->lev/5+5)) { -#ifdef JP - msg_print("²þÎɤ˼ºÇÔ¤·¤¿¡£"); -#else - msg_print("You failed to enchant."); -#endif - energy_use = 100; + msg_print(_("改良に失敗した。", "You failed to enchant.")); + p_ptr->energy_use = 100; return; } else @@ -8537,12 +8508,8 @@ static void add_essence(int mode) { if (o_ptr->to_a >= p_ptr->lev/5+5) { -#ifdef JP - msg_print("²þÎɤ˼ºÇÔ¤·¤¿¡£"); -#else - msg_print("You failed to enchant."); -#endif - energy_use = 100; + msg_print(_("改良に失敗した。", "You failed to enchant.")); + p_ptr->energy_use = 100; return; } else @@ -8603,11 +8570,7 @@ static void add_essence(int mode) } if (!success) { -#ifdef JP - msg_print("¥¨¥Ã¥»¥ó¥¹¤¬Â­¤ê¤Ê¤¤¡£"); -#else - msg_print("You don't have enough essences."); -#endif + msg_print(_("エッセンスが足りない。", "You don't have enough essences.")); return; } if (es_ptr->add == ESSENCE_SUSTAIN) @@ -8623,10 +8586,10 @@ static void add_essence(int mode) } } - energy_use = 100; + p_ptr->energy_use = 100; #ifdef JP - msg_format("%s¤Ë%s¤ÎǽÎϤòÉղä·¤Þ¤·¤¿¡£", o_name, es_ptr->add_name); + msg_format("%sに%sの能力を付加しました。", o_name, es_ptr->add_name); #else msg_format("You have added ability of %s to %s.", es_ptr->add_name, o_name); #endif @@ -8638,25 +8601,23 @@ static void add_essence(int mode) p_ptr->window |= (PW_INVEN); } - +/*! + * @brief エッセンスを消去する + * @return なし + */ static void erase_essence(void) { - int item; + OBJECT_IDX item; cptr q, s; object_type *o_ptr; char o_name[MAX_NLEN]; - u32b flgs[TR_FLAG_SIZE]; + BIT_FLAGS flgs[TR_FLAG_SIZE]; item_tester_hook = object_is_smith; /* Get an item */ -#ifdef JP - q = "¤É¤Î¥¢¥¤¥Æ¥à¤Î¥¨¥Ã¥»¥ó¥¹¤ò¾Ãµî¤·¤Þ¤¹¤«¡©"; - s = "¥¨¥Ã¥»¥ó¥¹¤òÉղä·¤¿¥¢¥¤¥Æ¥à¤¬¤¢¤ê¤Þ¤»¤ó¡£"; -#else - q = "Remove from which item? "; - s = "You have nothing to remove essence."; -#endif + q = _("どのアイテムのエッセンスを消去しますか?", "Remove from which item? "); + s = _("エッセンスを付加したアイテムがありません。", "You have nothing to remove essence."); if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; @@ -8673,13 +8634,9 @@ static void erase_essence(void) } object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); -#ifdef JP - if (!get_check(format("¤è¤í¤·¤¤¤Ç¤¹¤«¡© [%s]", o_name))) return; -#else - if (!get_check(format("Are you sure? [%s]", o_name))) return; -#endif + if (!get_check(format(_("よろしいですか? [%s]", "Are you sure? [%s]"), o_name))) return; - energy_use = 100; + p_ptr->energy_use = 100; if (o_ptr->xtra3 == 1+ESSENCE_SLAY_GLOVE) { @@ -8692,11 +8649,7 @@ static void erase_essence(void) o_ptr->xtra3 = 0; object_flags(o_ptr, flgs); if (!(have_pval_flags(flgs))) o_ptr->pval = 0; -#ifdef JP - msg_print("¥¨¥Ã¥»¥ó¥¹¤ò¼è¤êµî¤Ã¤¿¡£"); -#else - msg_print("You removed all essence you have added."); -#endif + msg_print(_("エッセンスを取り去った。", "You removed all essence you have added.")); /* Combine the pack */ p_ptr->notice |= (PN_COMBINE | PN_REORDER); @@ -8705,43 +8658,33 @@ static void erase_essence(void) p_ptr->window |= (PW_INVEN); } +/*! + * @brief 鍛冶コマンドのメインルーチン + * @param only_browse TRUEならばエッセンス一覧の表示のみを行う + * @return なし + */ void do_cmd_kaji(bool only_browse) { - int mode = 0; + COMMAND_CODE mode = 0; char choice; - int menu_line = (use_menu ? 1 : 0); + COMMAND_CODE menu_line = (use_menu ? 1 : 0); if (!only_browse) { if (p_ptr->confused) { -#ifdef JP - msg_print("º®Í𤷤Ƥ¤¤Æºî¶È¤Ç¤­¤Ê¤¤¡ª"); -#else - msg_print("You are too confused!"); -#endif - + msg_print(_("混乱していて作業できない!", "You are too confused!")); return; } if (p_ptr->blind) { -#ifdef JP - msg_print("Ìܤ¬¸«¤¨¤Ê¤¯¤Æºî¶È¤Ç¤­¤Ê¤¤¡ª"); -#else - msg_print("You are blind!"); -#endif - + msg_print(_("目が見えなくて作業できない!", "You are blind!")); return; } if (p_ptr->image) { -#ifdef JP - msg_print("¤¦¤Þ¤¯¸«¤¨¤Ê¤¯¤Æºî¶È¤Ç¤­¤Ê¤¤¡ª"); -#else - msg_print("You are hallucinating!"); -#endif - + msg_print(_("うまく見えなくて作業できない!", "You are hallucinating!")); return; } } @@ -8759,12 +8702,12 @@ void do_cmd_kaji(bool only_browse) while(!mode) { #ifdef JP - prt(format(" %s ¥¨¥Ã¥»¥ó¥¹°ìÍ÷", (menu_line == 1) ? "¡Õ" : " "), 2, 14); - prt(format(" %s ¥¨¥Ã¥»¥ó¥¹Ãê½Ð", (menu_line == 2) ? "¡Õ" : " "), 3, 14); - prt(format(" %s ¥¨¥Ã¥»¥ó¥¹¾Ãµî", (menu_line == 3) ? "¡Õ" : " "), 4, 14); - prt(format(" %s ¥¨¥Ã¥»¥ó¥¹ÉÕ²Ã", (menu_line == 4) ? "¡Õ" : " "), 5, 14); - prt(format(" %s Éð´ï/Ëɶñ¶¯²½", (menu_line == 5) ? "¡Õ" : " "), 6, 14); - prt(format("¤É¤Î¼ïÎà¤Îµ»½Ñ¤ò%s¤Þ¤¹¤«¡©", only_browse ? "Ä´¤Ù" : "»È¤¤"), 0, 0); + prt(format(" %s エッセンス一覧", (menu_line == 1) ? "》" : " "), 2, 14); + prt(format(" %s エッセンス抽出", (menu_line == 2) ? "》" : " "), 3, 14); + prt(format(" %s エッセンス消去", (menu_line == 3) ? "》" : " "), 4, 14); + prt(format(" %s エッセンス付加", (menu_line == 4) ? "》" : " "), 5, 14); + prt(format(" %s 武器/防具強化", (menu_line == 5) ? "》" : " "), 6, 14); + prt(format("どの種類の技術を%sますか?", only_browse ? "調べ" : "使い"), 0, 0); #else prt(format(" %s List essences", (menu_line == 1) ? "> " : " "), 2, 14); prt(format(" %s Extract essence", (menu_line == 2) ? "> " : " "), 3, 14); @@ -8807,12 +8750,12 @@ void do_cmd_kaji(bool only_browse) while (!mode) { #ifdef JP - prt(" a) ¥¨¥Ã¥»¥ó¥¹°ìÍ÷", 2, 14); - prt(" b) ¥¨¥Ã¥»¥ó¥¹Ãê½Ð", 3, 14); - prt(" c) ¥¨¥Ã¥»¥ó¥¹¾Ãµî", 4, 14); - prt(" d) ¥¨¥Ã¥»¥ó¥¹ÉÕ²Ã", 5, 14); - prt(" e) Éð´ï/Ëɶñ¶¯²½", 6, 14); - if (!get_com(format("¤É¤ÎǽÎϤò%s¤Þ¤¹¤«:", only_browse ? "Ä´¤Ù" : "»È¤¤"), &choice, TRUE)) + prt(" a) エッセンス一覧", 2, 14); + prt(" b) エッセンス抽出", 3, 14); + prt(" c) エッセンス消去", 4, 14); + prt(" d) エッセンス付加", 5, 14); + prt(" e) 武器/防具強化", 6, 14); + if (!get_com(format("どの能力を%sますか:", only_browse ? "調べ" : "使い"), &choice, TRUE)) #else prt(" a) List essences", 2, 14); prt(" b) Extract essence", 3, 14); @@ -8895,8 +8838,12 @@ void do_cmd_kaji(bool only_browse) } -/* +/*! + * @brief 投擲時たいまつに投げやすい/焼棄/アンデッドスレイの特別効果を返す。 * Torches have special abilities when they are flaming. + * @param o_ptr 投擲するオブジェクトの構造体参照ポインタ + * @param flgs 特別に追加するフラグを返す参照ポインタ + * @return なし */ void torch_flags(object_type *o_ptr, u32b *flgs) { @@ -8911,6 +8858,14 @@ void torch_flags(object_type *o_ptr, u32b *flgs) } } +/*! + * @brief 投擲時たいまつにダイスを与える。 + * Torches have special abilities when they are flaming. + * @param o_ptr 投擲するオブジェクトの構造体参照ポインタ + * @param dd 特別なダイス数を返す参照ポインタ + * @param ds 特別なダイス面数を返す参照ポインタ + * @return なし + */ void torch_dice(object_type *o_ptr, int *dd, int *ds) { if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_TORCH)) @@ -8923,6 +8878,12 @@ void torch_dice(object_type *o_ptr, int *dd, int *ds) } } +/*! + * @brief 投擲時命中したたいまつの寿命を縮める。 + * Torches have special abilities when they are flaming. + * @param o_ptr 投擲するオブジェクトの構造体参照ポインタ + * @return なし + */ void torch_lost_fuel(object_type *o_ptr) { if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_TORCH))