3 @brief 町の施設処理 / Building commands
6 Created by Ken Wigle for Kangband - a variant of Angband 2.8.3\n
9 Rewritten for Kangband 2.8.3i using Kamband's version of\n
10 bldg.c as written by Ivan Tkatchev\n
12 Changed for ZAngband by Robert Ruehlmann\n
17 #include "floor-events.h"
18 #include "floor-save.h"
19 #include "object-boost.h"
20 #include "object-flavor.h"
21 #include "object-hook.h"
23 #include "monsterrace-hook.h"
34 #include "cmd-spell.h"
36 #include "player-status.h"
37 #include "spells-status.h"
38 #include "realm-hex.h"
39 #include "dungeon-file.h"
42 #include "player-effects.h"
45 * @brief 闘技場のモンスターID及び報酬アイテムテーブル
47 const arena_type arena_info[MAX_ARENA_MONS + 2] =
49 { MON_NOBORTA, TV_AMULET, SV_AMULET_ADORNMENT },
50 { MON_MORI_TROLL, TV_FOOD, SV_FOOD_PINT_OF_WINE },
51 { MON_IMP, TV_POTION, SV_POTION_SPEED },
52 { MON_LION_HEART, 0, 0 },
53 { MON_MASTER_YEEK, TV_POTION, SV_POTION_CURING },
54 { MON_SABRE_TIGER, TV_WAND, SV_WAND_STONE_TO_MUD },
55 { MON_LIZARD_KING, TV_WAND, SV_WAND_TELEPORT_AWAY },
56 { MON_WYVERN, TV_POTION, SV_POTION_HEALING },
57 { MON_ARCH_VILE, TV_POTION, SV_POTION_RESISTANCE },
58 { MON_ELF_LORD , TV_POTION, SV_POTION_ENLIGHTENMENT },
59 { MON_GHOUL_KING, TV_FOOD, SV_FOOD_RESTORING },
60 { MON_COLBRAN, TV_RING, SV_RING_ELEC },
61 { MON_BICLOPS, TV_WAND, SV_WAND_ACID_BALL },
62 { MON_M_MINDCRAFTER, TV_POTION, SV_POTION_SELF_KNOWLEDGE },
63 { MON_GROO, TV_SCROLL, SV_SCROLL_ACQUIREMENT },
64 { MON_RAAL, TV_SCROLL, SV_SCROLL_STAR_DESTRUCTION },
65 { MON_DREADMASTER, TV_WAND, SV_WAND_HYPODYNAMIA },
66 { MON_ULTRA_PALADIN, TV_STAFF, SV_STAFF_DISPEL_EVIL },
67 { MON_BARNEY, TV_RING, SV_RING_RES_CHAOS },
68 { MON_TROLL_KING, TV_SCROLL, SV_SCROLL_MASS_GENOCIDE },
69 { MON_BARON_HELL, TV_POTION, SV_POTION_AUGMENTATION },
70 { MON_F_ANGEL, TV_SCROLL, SV_SCROLL_RUNE_OF_PROTECTION },
71 { MON_G_C_DRAKE, TV_WAND, SV_WAND_DRAGON_FIRE },
72 { MON_IRON_LICH, TV_STAFF, SV_STAFF_DESTRUCTION },
73 { MON_DROLEM, TV_POTION, SV_POTION_STAR_HEALING },
74 { MON_G_TITAN, TV_WAND, SV_WAND_GENOCIDE },
75 { MON_G_BALROG, TV_POTION, SV_POTION_EXPERIENCE },
76 { MON_ELDER_VAMPIRE, TV_RING, SV_RING_SUSTAIN },
77 { MON_NIGHTWALKER, TV_WAND, SV_WAND_STRIKING },
78 { MON_S_TYRANNO, TV_SCROLL, SV_SCROLL_STAR_ACQUIREMENT },
79 { MON_G_MASTER_MYS, TV_ROD, SV_ROD_IDENTIFY },
80 { MON_LORD_CHAOS, TV_POTION, SV_POTION_LIFE },
81 { MON_SHADOWLORD, TV_POTION, SV_POTION_STAR_ENLIGHTENMENT },
82 { MON_ULT_BEHOLDER, TV_AMULET, SV_AMULET_REFLECTION },
83 { MON_JABBERWOCK, TV_ROD, SV_ROD_HEALING },
84 { MON_LOCKE_CLONE, TV_WAND, SV_WAND_DISINTEGRATE },
85 { MON_WYRM_SPACE, TV_ROD, SV_ROD_RESTORATION },
86 { MON_SHAMBLER, TV_SCROLL, SV_SCROLL_STAR_ACQUIREMENT },
87 { MON_BLACK_REAVER, TV_RING, SV_RING_LORDLY },
88 { MON_FENGHUANG, TV_STAFF, SV_STAFF_THE_MAGI },
89 { MON_WYRM_POWER, TV_SCROLL, SV_SCROLL_ARTIFACT },
90 { 0, 0, 0 }, /* Victory prizing */
91 { MON_HAGURE, TV_SCROLL, SV_SCROLL_ARTIFACT },
96 * ループ中で / hack as in leave_store in store.c
98 static bool leave_bldg = FALSE;
101 * @brief 施設毎に設定された種族、職業、魔法領域フラグがプレイヤーと一致するかを判定する。
102 * @details 各種ギルドや寺院など、特定の職業ならば優遇措置を得られる施設、
103 * あるいは食堂など特定の種族では利用できない施設の判定処理を行う。
104 * @param bldg 施設構造体の参照ポインタ
105 * @return 種族、職業、魔法領域のいずれかが一致しているかの是非。
107 static bool is_owner(building_type *bldg)
109 if (bldg->member_class[p_ptr->pclass] == BUILDING_OWNER)
114 if (bldg->member_race[p_ptr->prace] == BUILDING_OWNER)
119 if ((is_magic(p_ptr->realm1) && (bldg->member_realm[p_ptr->realm1] == BUILDING_OWNER)) ||
120 (is_magic(p_ptr->realm2) && (bldg->member_realm[p_ptr->realm2] == BUILDING_OWNER)))
129 * @brief 施設毎に設定された種族、職業、魔法領域フラグがプレイヤーと一致するかを判定する。
131 * @details 各種ギルドや寺院など、特定の職業ならば優遇措置を得られる施設、
132 * あるいは食堂など特定の種族では利用できない施設の判定処理を行う。
133 * @param bldg 施設構造体の参照ポインタ
134 * @return 種族、職業、魔法領域のいずれかが一致しているかの是非。
135 * @todo is_owner()との実質的な多重実装なので、リファクタリングを行うべきである。
137 static bool is_member(building_type *bldg)
139 if (bldg->member_class[p_ptr->pclass])
144 if (bldg->member_race[p_ptr->prace])
149 if ((is_magic(p_ptr->realm1) && bldg->member_realm[p_ptr->realm1]) ||
150 (is_magic(p_ptr->realm2) && bldg->member_realm[p_ptr->realm2]))
156 if (p_ptr->pclass == CLASS_SORCERER)
160 for (i = 0; i < MAX_MAGIC; i++)
162 if (bldg->member_realm[i+1]) OK = TRUE;
170 * @brief コンソールに表示された施設に関する情報を消去する / Clear the building information
171 * @details 消去は行毎にヌル文字列で行われる。
172 * @param min_row 開始行番号
173 * @param max_row 末尾行番号
176 static void clear_bldg(int min_row, int max_row)
180 for (i = min_row; i <= max_row; i++)
188 static void building_prt_gold(void)
191 prt(_("手持ちのお金: ", "Gold Remaining: "), 23,53);
192 sprintf(tmp_str, "%9ld", (long)p_ptr->au);
193 prt(tmp_str, 23, 68);
197 * @brief 施設のサービス一覧を表示する / Display a building.
198 * @param bldg 施設構造体の参照ポインタ
201 static void show_building(building_type* bldg)
209 sprintf(tmp_str, "%s (%s) %35s", bldg->owner_name, bldg->owner_race, bldg->name);
213 for (i = 0; i < 8; i++)
215 if (bldg->letters[i])
217 if (bldg->action_restr[i] == 0)
219 if ((is_owner(bldg) && (bldg->member_costs[i] == 0)) ||
220 (!is_owner(bldg) && (bldg->other_costs[i] == 0)))
222 action_color = TERM_WHITE;
225 else if (is_owner(bldg))
227 action_color = TERM_YELLOW;
228 sprintf(buff, _("($%ld)", "(%ldgp)"), (long int)bldg->member_costs[i]);
232 action_color = TERM_YELLOW;
233 sprintf(buff, _("($%ld)", "(%ldgp)"), (long int)bldg->other_costs[i]); }
235 else if (bldg->action_restr[i] == 1)
237 if (!is_member(bldg))
239 action_color = TERM_L_DARK;
240 strcpy(buff, _("(閉店)", "(closed)"));
242 else if ((is_owner(bldg) && (bldg->member_costs[i] == 0)) ||
243 (is_member(bldg) && (bldg->other_costs[i] == 0)))
245 action_color = TERM_WHITE;
248 else if (is_owner(bldg))
250 action_color = TERM_YELLOW;
251 sprintf(buff, _("($%ld)", "(%ldgp)"), (long int)bldg->member_costs[i]);
255 action_color = TERM_YELLOW;
256 sprintf(buff, _("($%ld)", "(%ldgp)"), (long int)bldg->other_costs[i]);
263 action_color = TERM_L_DARK;
264 strcpy(buff, _("(閉店)", "(closed)"));
266 else if (bldg->member_costs[i] != 0)
268 action_color = TERM_YELLOW;
269 sprintf(buff, _("($%ld)", "(%ldgp)"), (long int)bldg->member_costs[i]);
273 action_color = TERM_WHITE;
278 sprintf(tmp_str," %c) %s %s", bldg->letters[i], bldg->act_names[i], buff);
279 c_put_str(action_color, tmp_str, 19+(i/2), 35*(i%2));
282 prt(_(" ESC) 建物を出る", " ESC) Exit building"), 23, 0);
286 * @brief 闘技場に入るコマンドの処理 / arena commands
287 * @param cmd 闘技場処理のID
290 static void arena_comm(int cmd)
299 if (p_ptr->arena_number == MAX_ARENA_MONS)
302 prt(_("アリーナの優勝者!", " Arena Victor!"), 5, 0);
303 prt(_("おめでとう!あなたは全ての敵を倒しました。", "Congratulations! You have defeated all before you."), 7, 0);
304 prt(_("賞金として $1,000,000 が与えられます。", "For that, receive the prize: 1,000,000 gold pieces"), 8, 0);
308 p_ptr->au += 1000000L;
309 msg_print(_("スペースキーで続行", "Press the space bar to continue"));
311 p_ptr->arena_number++;
313 else if (p_ptr->arena_number > MAX_ARENA_MONS)
315 if (p_ptr->arena_number < MAX_ARENA_MONS+2)
317 msg_print(_("君のために最強の挑戦者を用意しておいた。", "The strongest challenger is waiting for you."));
319 if (get_check(_("挑戦するかね?", "Do you fight? ")))
321 msg_print(_("死ぬがよい。", "Die, maggots."));
324 p_ptr->exit_bldg = FALSE;
327 /* Save the surface floor as saved floor */
328 prepare_change_floor_mode(CFM_SAVE_FLOORS);
330 p_ptr->inside_arena = TRUE;
331 p_ptr->leaving = TRUE;
336 msg_print(_("残念だ。", "We are disappointed."));
341 msg_print(_("あなたはアリーナに入り、しばらくの間栄光にひたった。",
342 "You enter the arena briefly and bask in your glory."));
346 else if (p_ptr->riding && (p_ptr->pclass != CLASS_BEASTMASTER) && (p_ptr->pclass != CLASS_CAVALRY))
348 msg_print(_("ペットに乗ったままではアリーナへ入れさせてもらえなかった。",
349 "You don't have permission to enter with pet."));
354 p_ptr->exit_bldg = FALSE;
357 /* Save the surface floor as saved floor */
358 prepare_change_floor_mode(CFM_SAVE_FLOORS);
360 p_ptr->inside_arena = TRUE;
361 p_ptr->leaving = TRUE;
366 if (p_ptr->arena_number == MAX_ARENA_MONS)
367 msg_print(_("あなたは勝利者だ。 アリーナでのセレモニーに参加しなさい。",
368 "You are victorious. Enter the arena for the ceremony."));
370 else if (p_ptr->arena_number > MAX_ARENA_MONS)
372 msg_print(_("あなたはすべての敵に勝利した。", "You have won against all foes."));
376 r_ptr = &r_info[arena_info[p_ptr->arena_number].r_idx];
377 name = (r_name + r_ptr->name);
378 msg_format(_("%s に挑戦するものはいないか?", "Do I hear any challenges against: %s"), name);
380 p_ptr->monster_race_idx = arena_info[p_ptr->arena_number].r_idx;
381 p_ptr->window |= (PW_MONSTER);
386 case BACT_ARENA_RULES:
389 /* Peruse the arena help file */
390 (void)show_file(TRUE, _("arena_j.txt", "arena.txt"), NULL, 0, 0);
398 * @brief カジノのスロットシンボルを表示する / display fruit for dice slots
399 * @param row シンボルを表示する行の上端
400 * @param col シンボルを表示する行の左端
401 * @param fruit 表示するシンボルID
404 static void display_fruit(int row, int col, int fruit)
409 c_put_str(TERM_YELLOW, " ####.", row, col);
410 c_put_str(TERM_YELLOW, " # #", row + 1, col);
411 c_put_str(TERM_YELLOW, " # #", row + 2, col);
412 c_put_str(TERM_YELLOW, "# #", row + 3, col);
413 c_put_str(TERM_YELLOW, "# #", row + 4, col);
414 c_put_str(TERM_YELLOW, "# # ", row + 5, col);
415 c_put_str(TERM_YELLOW, "# # ", row + 6, col);
416 c_put_str(TERM_YELLOW, ".#### ", row + 7, col);
418 " Lemon "), row + 8, col);
421 c_put_str(TERM_ORANGE, " ## ", row, col);
422 c_put_str(TERM_ORANGE, " #..# ", row + 1, col);
423 c_put_str(TERM_ORANGE, " #....# ", row + 2, col);
424 c_put_str(TERM_ORANGE, "#......#", row + 3, col);
425 c_put_str(TERM_ORANGE, "#......#", row + 4, col);
426 c_put_str(TERM_ORANGE, " #....# ", row + 5, col);
427 c_put_str(TERM_ORANGE, " #..# ", row + 6, col);
428 c_put_str(TERM_ORANGE, " ## ", row + 7, col);
430 " Orange "), row + 8, col);
433 c_put_str(TERM_SLATE, _(" Λ ", " /\\ ") , row, col);
434 c_put_str(TERM_SLATE, _(" || ", " ## ") , row + 1, col);
435 c_put_str(TERM_SLATE, _(" || ", " ## ") , row + 2, col);
436 c_put_str(TERM_SLATE, _(" || ", " ## ") , row + 3, col);
437 c_put_str(TERM_SLATE, _(" || ", " ## ") , row + 4, col);
438 c_put_str(TERM_SLATE, _(" || ", " ## ") , row + 5, col);
439 c_put_str(TERM_UMBER, _(" |=亜=| ", " ###### ") , row + 6, col);
440 c_put_str(TERM_UMBER, _(" 目 ", " ## ") , row + 7, col);
441 prt( _(" 剣 ", " Sword ") , row + 8, col);
444 c_put_str(TERM_SLATE, " ###### ", row, col);
445 c_put_str(TERM_SLATE, "# #", row + 1, col);
446 c_put_str(TERM_SLATE, "# ++++ #", row + 2, col);
447 c_put_str(TERM_SLATE, "# +==+ #", row + 3, col);
448 c_put_str(TERM_SLATE, "# ++ #", row + 4, col);
449 c_put_str(TERM_SLATE, " # # ", row + 5, col);
450 c_put_str(TERM_SLATE, " # # ", row + 6, col);
451 c_put_str(TERM_SLATE, " ## ", row + 7, col);
453 " Shield "), row + 8, col);
456 c_put_str(TERM_VIOLET, " ## ", row, col);
457 c_put_str(TERM_VIOLET, " ###### ", row + 1, col);
458 c_put_str(TERM_VIOLET, "########", row + 2, col);
459 c_put_str(TERM_VIOLET, "########", row + 3, col);
460 c_put_str(TERM_VIOLET, "########", row + 4, col);
461 c_put_str(TERM_VIOLET, " ###### ", row + 5, col);
462 c_put_str(TERM_VIOLET, " #### ", row + 6, col);
463 c_put_str(TERM_VIOLET, " ## ", row + 7, col);
465 " Plum "), row + 8, col);
468 c_put_str(TERM_RED, " ##", row, col);
469 c_put_str(TERM_RED, " ### ", row + 1, col);
470 c_put_str(TERM_RED, " #..# ", row + 2, col);
471 c_put_str(TERM_RED, " #..# ", row + 3, col);
472 c_put_str(TERM_RED, " ###### ", row + 4, col);
473 c_put_str(TERM_RED, "#..##..#", row + 5, col);
474 c_put_str(TERM_RED, "#..##..#", row + 6, col);
475 c_put_str(TERM_RED, " ## ## ", row + 7, col);
477 " Cherry "), row + 8, col);
483 * kpoker no (tyuto-hannpa na)pakuri desu...
484 * joker ha shineru node haitte masen.
486 * TODO: donataka! tsukutte!
487 * - agatta yaku no kiroku (like DQ).
488 * - kakkoii card no e.
489 * - sousa-sei no koujyo.
490 * - code wo wakariyasuku.
492 * - Joker... -- done.
495 * 9/15/2000 joker wo jissou. soreto, code wo sukosi kakikae. --Habu
498 #define SUIT_OF(card) ((card) / 13) /*!< トランプカードのスートを返す */
499 #define NUM_OF(card) ((card) % 13) /*!< トランプカードの番号を返す */
500 #define IS_JOKER(card) ((card) == 52) /*!< トランプカードがジョーカーかどうかを返す */
502 static int cards[5]; /*!< ポーカーの現在の手札ID */
509 static void reset_deck(int deck[])
512 for (i = 0; i < 53; i++) deck[i] = i;
515 for (i = 0; i < 53; i++){
516 int tmp1 = randint0(53 - i) + i;
518 deck[i] = deck[tmp1];
524 * @brief ポーカープレイ中にジョーカーを持っているかの判定を返す。
525 * @return ジョーカーを持っているか。
527 static bool have_joker(void)
531 for (i = 0; i < 5; i++){
532 if(IS_JOKER(cards[i])) return TRUE;
538 * @brief ポーカーの手札に該当の番号の札があるかを返す。
539 * @param num 探したいカードの番号。
540 * @return 該当の番号が手札にあるか。
542 static bool find_card_num(int num)
545 for (i = 0; i < 5; i++)
546 if (NUM_OF(cards[i]) == num && !IS_JOKER(cards[i])) return TRUE;
551 * @brief ポーカーの手札がフラッシュ役を得ているかを帰す。
554 static bool yaku_check_flush(void)
557 bool joker_is_used = FALSE;
559 suit = IS_JOKER(cards[0]) ? SUIT_OF(cards[1]) : SUIT_OF(cards[0]);
560 for (i = 0; i < 5; i++){
561 if (SUIT_OF(cards[i]) != suit){
562 if(have_joker() && !joker_is_used)
563 joker_is_used = TRUE;
573 * @brief ポーカーの手札がストレートを含んだ高位の役を得ているかを帰す。
574 * @return 役の判定結果 0…ストレート、フラッシュいずれもなし/1…ストレートのみ/2…ストレートフラッシュ/3…ロイヤルストレートフラッシュ
576 static int yaku_check_straight(void)
579 bool joker_is_used = FALSE;
580 bool straight = FALSE;
583 for (i = 0; i < 5; i++)
585 if (NUM_OF(cards[i]) < lowest && !IS_JOKER(cards[i]))
586 lowest = NUM_OF(cards[i]);
589 /* Check Royal Straight Flush */
590 if (yaku_check_flush())
593 for (i = 0; i < 4; i++)
595 if (!find_card_num(9 + i)){
596 if( have_joker() && !joker_is_used )
597 joker_is_used = TRUE;
602 if (i == 4) return 3; /* Wow! Royal Straight Flush!!! */
605 for (i = 0; i < 3; i++)
607 if (!find_card_num(10 + i))
610 if (i == 3 && have_joker()) return 3; /* Wow! Royal Straight Flush!!! */
614 joker_is_used = FALSE;
616 /* Straight Only Check */
618 if (lowest == 0) { /* (10 - J - Q - K)[JOKER] - A */
619 for (i = 0; i < 4; i++)
621 if (!find_card_num(9 + i)) {
622 if (have_joker() && !joker_is_used)
623 joker_is_used = TRUE;
628 if(i == 4) straight = TRUE;
631 joker_is_used = FALSE;
633 for (i = 0; i < 5; i++)
635 if(!find_card_num(lowest + i)){
636 if( have_joker() && !joker_is_used )
637 joker_is_used = TRUE;
642 if(i == 5) straight = TRUE;
644 if (straight && yaku_check_flush()) return 2; /* Straight Flush */
645 else if(straight) return 1; /* Only Straight */
650 * @brief ポーカーのペア役の状態を返す。
651 * @return 0:nopair 1:1 pair 2:2 pair 3:3 cards 4:full house 6:4cards
653 static int yaku_check_pair(void)
655 int i, i2, matching = 0;
657 for (i = 0; i < 5; i++)
659 for (i2 = i+1; i2 < 5; i2++)
661 if (IS_JOKER(cards[i]) || IS_JOKER(cards[i2])) continue;
662 if (NUM_OF(cards[i]) == NUM_OF(cards[i2]))
693 #define ODDS_5A 3000 /*!< ファイブエースの役倍率 */
694 #define ODDS_5C 400 /*!< ファイブカードの役倍率 */
695 #define ODDS_RF 200 /*!< ロイヤルストレートフラッシュの役倍率 */
696 #define ODDS_SF 80 /*!< ストレートフラッシュの役倍率 */
697 #define ODDS_4C 16 /*!< フォアカードの役倍率 */
698 #define ODDS_FH 12 /*!< フルハウスの役倍率 */
699 #define ODDS_FL 8 /*!< フラッシュの役倍率 */
700 #define ODDS_ST 4 /*!< ストレートの役倍率 */
701 #define ODDS_3C 1 /*!< スリーカードの役倍率 */
702 #define ODDS_2P 1 /*!< ツーペアの役倍率 */
705 * @brief ポーカーの役をチェックし、その結果を画面に表示しつつ結果を返す。
708 static int yaku_check(void)
712 switch(yaku_check_straight()){
714 c_put_str(TERM_YELLOW, _("ロイヤルストレートフラッシュ", "Royal Flush"), 4, 3);
717 c_put_str(TERM_YELLOW, _("ストレートフラッシュ", "Straight Flush"), 4, 3);
720 c_put_str(TERM_YELLOW, _("ストレート", "Straight"), 4, 3);
723 /* Not straight -- fall through */
727 if (yaku_check_flush())
729 c_put_str(TERM_YELLOW, _("フラッシュ", "Flush"), 4, 3);
733 switch (yaku_check_pair())
736 c_put_str(TERM_YELLOW, _("ワンペア", "One pair"), 4, 3);
739 c_put_str(TERM_YELLOW, _("ツーペア", "Two pair"), 4, 3);
742 c_put_str(TERM_YELLOW, _("スリーカード", "Three of a kind"), 4, 3);
745 c_put_str(TERM_YELLOW, _("フルハウス", "Full house"), 4, 3);
748 c_put_str(TERM_YELLOW, _("フォーカード", "Four of a kind"), 4, 3);
751 if (!NUM_OF(cards[0]) && !NUM_OF(cards[1]))
753 c_put_str(TERM_YELLOW, _("ファイブエース", "Five ace"), 4, 3);
758 c_put_str(TERM_YELLOW, _("ファイブカード", "Five of a kind"), 4, 3);
768 * @brief ポーカーの捨てる/残すインターフェイスの表示を更新する。
769 * @param hoge カーソルの現在位置
770 * @param kaeruka カードの捨てる/残すフラグ配列
773 static void display_kaeruka(int hoge, int kaeruka[])
776 char col = TERM_WHITE;
777 for (i = 0; i < 5; i++)
779 if (i == hoge) col = TERM_YELLOW;
780 else if(kaeruka[i]) col = TERM_WHITE;
781 else col = TERM_L_BLUE;
784 c_put_str(col, _("かえる", "Change"), 14, 5+i*16);
786 c_put_str(col, _("のこす", " Stay "), 14, 5+i*16);
788 if (hoge > 4) col = TERM_YELLOW;
789 else col = TERM_WHITE;
790 c_put_str(col, _("決定", "Sure"), 16, 38);
792 /* Hilite current option */
793 if (hoge < 5) move_cursor(14, 5+hoge*16);
794 else move_cursor(16, 38);
798 * @brief ポーカーの手札を表示する。
801 static void display_cards(void)
804 char suitcolor[4] = {TERM_YELLOW, TERM_L_RED, TERM_L_BLUE, TERM_L_GREEN};
806 concptr suit[4] = {"★", "●", "¶", "†"};
807 concptr card_grph[13][7] = {{"A %s ",
898 concptr joker_grph[7] = { " ",
908 concptr suit[4] = {"[]", "qp", "<>", "db"};
909 concptr card_grph[13][7] = {{"A %s ",
1000 concptr joker_grph[7] = { " ",
1009 for (i = 0; i < 5; i++)
1011 prt(_("┏━━━━━━┓", " +------------+ "), 5, i*16);
1014 for (i = 0; i < 5; i++)
1016 for (j = 0; j < 7; j++)
1018 prt(_("┃", " |"), j+6, i*16);
1019 if(IS_JOKER(cards[i]))
1020 c_put_str(TERM_VIOLET, joker_grph[j], j+6, 2+i*16);
1022 c_put_str(suitcolor[SUIT_OF(cards[i])], format(card_grph[NUM_OF(cards[i])][j], suit[SUIT_OF(cards[i])], suit[SUIT_OF(cards[i])]), j+6, 2+i*16);
1023 prt(_("┃", "| "), j+6, i*16+14);
1026 for (i = 0; i < 5; i++)
1028 prt(_("┗━━━━━━┛", " +------------+ "), 13, i*16);
1033 * @brief ポーカーの1プレイルーチン。
1036 static int do_poker(void)
1040 int deck[53]; /* yamafuda : 0...52 */
1042 int kaeruka[5]; /* 0:kaenai 1:kaeru */
1046 bool kakikae = TRUE;
1050 for (i = 0; i < 5; i++)
1052 cards[i] = deck[deck_ptr++];
1053 kaeruka[i] = 0; /* default:nokosu */
1056 /* suteruno wo kimeru */
1057 prt(_("残すカードを決めて下さい(方向で移動, スペースで選択)。", "Stay witch? "), 0, 0);
1064 if (kakikae) display_kaeruka(k+kettei*5, kaeruka);
1069 case '6': case 'l': case 'L': case KTRL('F'):
1070 if (!kettei) k = (k+1)%5;
1071 else {k = 0;kettei = FALSE;}
1074 case '4': case 'h': case 'H': case KTRL('B'):
1075 if (!kettei) k = (k+4)%5;
1076 else {k = 4;kettei = FALSE;}
1079 case '2': case 'j': case 'J': case KTRL('N'):
1080 if (!kettei) {kettei = TRUE;kakikae = TRUE;}
1082 case '8': case 'k': case 'K': case KTRL('P'):
1083 if (kettei) {kettei = FALSE;kakikae = TRUE;}
1085 case ' ': case '\r':
1086 if (kettei) done = TRUE;
1087 else {kaeruka[k] = !kaeruka[k];kakikae = TRUE;}
1096 for (i = 0; i < 5; i++)
1097 if (kaeruka[i] == 1) cards[i] = deck[deck_ptr++]; /* soshite toru */
1101 return yaku_check();
1106 /* end of poker codes --Koka */
1109 * @brief カジノ1プレイごとのメインルーチン / gamble_comm
1110 * @param cmd プレイするゲームID
1113 static bool gamble_comm(int cmd)
1116 int roll1, roll2, roll3, choice, odds, win;
1121 char out_val[160], tmp_str[80], again;
1126 if (cmd == BACT_GAMBLE_RULES)
1128 /* Peruse the gambling help file */
1129 (void)show_file(TRUE, _("jgambling.txt", "gambling.txt"), NULL, 0, 0);
1136 msg_print(_("おい!おまえ一文なしじゃないか!こっから出ていけ!",
1137 "Hey! You don't have gold - get out of here!"));
1145 maxbet = p_ptr->lev * 200;
1147 /* We can't bet more than we have */
1148 maxbet = MIN(maxbet, p_ptr->au);
1151 strcpy(out_val, "");
1152 sprintf(tmp_str,_("賭け金 (1-%ld)?", "Your wager (1-%ld) ? "), (long int)maxbet);
1156 * Use get_string() because we may need more than
1157 * the s16b value returned by get_quantity().
1159 if (get_string(tmp_str, out_val, 32))
1162 for (p = out_val; *p == ' '; p++);
1167 if (wager > p_ptr->au)
1169 msg_print(_("おい!金が足りないじゃないか!出ていけ!", "Hey! You don't have the gold - get out of here!"));
1174 else if (wager > maxbet)
1176 msg_format(_("%ldゴールドだけ受けよう。残りは取っときな。",
1177 "I'll take %ld gold of that. Keep the rest."), (long int)maxbet);
1182 msg_print(_("OK、1ゴールドからはじめよう。", "Ok, we'll start with 1 gold."));
1188 oldgold = p_ptr->au;
1190 sprintf(tmp_str, _("ゲーム前の所持金: %9ld", "Gold before game: %9ld"), (long int)oldgold);
1191 prt(tmp_str, 20, 2);
1192 sprintf(tmp_str, _("現在の掛け金: %9ld", "Current Wager: %9ld"), (long int)wager);
1193 prt(tmp_str, 21, 2);
1200 case BACT_IN_BETWEEN: /* Game of In-Between */
1201 c_put_str(TERM_GREEN, _("イン・ビトイーン", "In Between"),5,2);
1205 roll1 = randint1(10);
1206 roll2 = randint1(10);
1207 choice = randint1(10);
1208 sprintf(tmp_str, _("黒ダイス: %d 黒ダイス: %d", "Black die: %d Black Die: %d"), roll1, roll2);
1211 sprintf(tmp_str, _("赤ダイス: %d", "Red die: %d"), choice);
1213 prt(tmp_str, 11, 14);
1214 if (((choice > roll1) && (choice < roll2)) ||
1215 ((choice < roll1) && (choice > roll2)))
1218 case BACT_CRAPS: /* Game of Craps */
1219 c_put_str(TERM_GREEN, _("クラップス", "Craps"), 5, 2);
1223 roll1 = randint1(6);
1224 roll2 = randint1(6);
1225 roll3 = roll1 + roll2;
1227 sprintf(tmp_str, _("1振りめ: %d %d Total: %d",
1228 "First roll: %d %d Total: %d"), roll1, roll2, roll3);
1230 if ((roll3 == 7) || (roll3 == 11))
1232 else if ((roll3 == 2) || (roll3 == 3) || (roll3 == 12))
1237 msg_print(_("なにかキーを押すともう一回振ります。", "Hit any key to roll again"));
1240 roll1 = randint1(6);
1241 roll2 = randint1(6);
1242 roll3 = roll1 + roll2;
1243 sprintf(tmp_str, _("出目: %d %d 合計: %d",
1244 "Roll result: %d %d Total: %d"), roll1, roll2, roll3);
1246 if (roll3 == choice)
1248 else if (roll3 == 7)
1250 } while ((win != TRUE) && (win != FALSE));
1253 case BACT_SPIN_WHEEL: /* Spin the Wheel Game */
1256 c_put_str(TERM_GREEN, _("ルーレット", "Wheel"), 5, 2);
1258 prt("0 1 2 3 4 5 6 7 8 9", 7, 5);
1259 prt("--------------------------------", 8, 3);
1260 strcpy(out_val, "");
1261 get_string(_("何番? (0-9): ", "Pick a number (0-9): "), out_val, 32);
1263 for (p = out_val; iswspace(*p); p++);
1267 msg_print(_("0番にしとくぜ。", "I'll put you down for 0."));
1270 else if (choice > 9)
1272 msg_print(_("OK、9番にしとくぜ。", "Ok, I'll put you down for 9."));
1276 roll1 = randint0(10);
1277 sprintf(tmp_str, _("ルーレットは回り、止まった。勝者は %d番だ。",
1278 "The wheel spins to a stop and the winner is %d"), roll1);
1279 prt(tmp_str, 13, 3);
1281 prt("*", 9, (3 * roll1 + 5));
1282 if (roll1 == choice)
1286 case BACT_DICE_SLOTS: /* The Dice Slots */
1287 c_put_str(TERM_GREEN, _("ダイス・スロット", "Dice Slots"), 5, 2);
1288 c_put_str(TERM_YELLOW, _("レモン レモン 2", ""), 6, 37);
1289 c_put_str(TERM_YELLOW, _("レモン レモン レモン 5", ""), 7, 37);
1290 c_put_str(TERM_ORANGE, _("オレンジ オレンジ オレンジ 10", ""), 8, 37);
1291 c_put_str(TERM_UMBER, _("剣 剣 剣 20", ""), 9, 37);
1292 c_put_str(TERM_SLATE, _("盾 盾 盾 50", ""), 10, 37);
1293 c_put_str(TERM_VIOLET, _("プラム プラム プラム 200", ""), 11, 37);
1294 c_put_str(TERM_RED, _("チェリー チェリー チェリー 1000", ""), 12, 37);
1297 roll1 = randint1(21);
1307 roll2 = randint1(21);
1317 choice = randint1(21);
1327 put_str("/--------------------------\\", 7, 2);
1328 prt("\\--------------------------/", 17, 2);
1329 display_fruit(8, 3, roll1 - 1);
1330 display_fruit(8, 12, roll2 - 1);
1331 display_fruit(8, 21, choice - 1);
1332 if ((roll1 == roll2) && (roll2 == choice))
1351 else if ((roll1 == 1) && (roll2 == 1))
1360 if (odds) win = TRUE;
1366 prt(_("あなたの勝ち", "YOU WON"), 16, 37);
1368 p_ptr->au += odds * wager;
1369 sprintf(tmp_str, _("倍率: %d", "Payoff: %d"), odds);
1371 prt(tmp_str, 17, 37);
1375 prt(_("あなたの負け", "You Lost"), 16, 37);
1378 sprintf(tmp_str, _("現在の所持金: %9ld", "Current Gold: %9ld"), (long int)p_ptr->au);
1380 prt(tmp_str, 22, 2);
1381 prt(_("もう一度(Y/N)?", "Again(Y/N)?"), 18, 37);
1383 move_cursor(18, 52);
1388 if (wager > p_ptr->au)
1390 msg_print(_("おい!金が足りないじゃないか!ここから出て行け!",
1391 "Hey! You don't have the gold - get out of here!"));
1397 } while ((again == 'y') || (again == 'Y'));
1400 if (p_ptr->au >= oldgold)
1402 msg_print(_("「今回は儲けたな!でも次はこっちが勝ってやるからな、絶対に!」",
1403 "You came out a winner! We'll win next time, I'm sure."));
1404 chg_virtue(V_CHANCE, 3);
1408 msg_print(_("「金をスッてしまったな、わはは!うちに帰った方がいいぜ。」", "You lost gold! Haha, better head home."));
1409 chg_virtue(V_CHANCE, -3);
1419 * @brief モンスター闘技場に参加するモンスターを更新する。
1422 void update_gambling_monsters(void)
1429 bool old_inside_battle = p_ptr->inside_battle;
1431 for (i = 0; i < max_d_idx; i++)
1432 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
1434 mon_level = randint1(MIN(max_dl, 122)) + 5;
1435 if (randint0(100) < 60)
1437 i = randint1(MIN(max_dl, 122)) + 5;
1438 mon_level = MAX(i, mon_level);
1440 if (randint0(100) < 30)
1442 i = randint1(MIN(max_dl, 122)) + 5;
1443 mon_level = MAX(i, mon_level);
1450 for (i = 0; i < 4; i++)
1456 get_mon_num_prep(monster_can_entry_arena, NULL);
1457 p_ptr->inside_battle = TRUE;
1458 r_idx = get_mon_num(mon_level);
1459 p_ptr->inside_battle = old_inside_battle;
1460 if (!r_idx) continue;
1462 if ((r_info[r_idx].flags1 & RF1_UNIQUE) || (r_info[r_idx].flags7 & RF7_UNIQUE2))
1464 if ((r_info[r_idx].level + 10) > mon_level) continue;
1467 for (j = 0; j < i; j++)
1468 if (r_idx == battle_mon[j]) break;
1469 if (j < i) continue;
1473 battle_mon[i] = r_idx;
1474 if (r_info[r_idx].level < 45) tekitou = TRUE;
1477 for (i = 0; i < 4; i++)
1479 monster_race *r_ptr = &r_info[battle_mon[i]];
1480 int num_taisei = count_bits(r_ptr->flagsr & (RFR_IM_ACID | RFR_IM_ELEC | RFR_IM_FIRE | RFR_IM_COLD | RFR_IM_POIS));
1482 if (r_ptr->flags1 & RF1_FORCE_MAXHP)
1483 power[i] = r_ptr->hdice * r_ptr->hside * 2;
1485 power[i] = r_ptr->hdice * (r_ptr->hside + 1);
1486 power[i] = power[i] * (100 + r_ptr->level) / 100;
1487 if (r_ptr->speed > 110)
1488 power[i] = power[i] * (r_ptr->speed * 2 - 110) / 100;
1489 if (r_ptr->speed < 110)
1490 power[i] = power[i] * (r_ptr->speed - 20) / 100;
1492 power[i] = power[i] * (num_taisei * 2 + 5) / 10;
1493 else if (r_ptr->a_ability_flags2 & RF6_INVULNER)
1494 power[i] = power[i] * 4 / 3;
1495 else if (r_ptr->a_ability_flags2 & RF6_HEAL)
1496 power[i] = power[i] * 4 / 3;
1497 else if (r_ptr->a_ability_flags1 & RF5_DRAIN_MANA)
1498 power[i] = power[i] * 11 / 10;
1499 if (r_ptr->flags1 & RF1_RAND_25)
1500 power[i] = power[i] * 9 / 10;
1501 if (r_ptr->flags1 & RF1_RAND_50)
1502 power[i] = power[i] * 9 / 10;
1503 if (r_ptr->flagsr & RFR_RES_ALL) power[i] *= 100000;
1504 if (r_ptr->arena_ratio) power[i] = power[i] * r_ptr->arena_ratio / 100;
1509 for (i = 0; i < 4; i++)
1511 power[i] = total * 60 / power[i];
1512 if (tekitou && ((power[i] < 160) || power[i] > 1500)) break;
1513 if ((power[i] < 160) && randint0(20)) break;
1514 if (power[i] < 101) power[i] = 100 + randint1(5);
1515 mon_odds[i] = power[i];
1522 * @brief モンスター闘技場のメインルーチン
1523 * @return 賭けを開始したか否か
1525 static bool kakutoujou(void)
1529 char out_val[160], tmp_str[80];
1532 if ((current_world_ptr->game_turn - old_battle) > TURNS_PER_TICK * 250)
1534 update_gambling_monsters();
1535 old_battle = current_world_ptr->game_turn;
1543 msg_print(_("おい!おまえ一文なしじゃないか!こっから出ていけ!", "Hey! You don't have gold - get out of here!"));
1555 "Monsters Odds"), 4, 4);
1559 monster_race *r_ptr = &r_info[battle_mon[i]];
1561 sprintf(buf, _("%d) %-58s %4ld.%02ld倍", "%d) %-58s %4ld.%02ld"), i+1,
1562 _(format("%s%s",r_name + r_ptr->name, (r_ptr->flags1 & RF1_UNIQUE) ? "もどき" : " "),
1563 format("%s%s", (r_ptr->flags1 & RF1_UNIQUE) ? "Fake " : "", r_name + r_ptr->name)),
1564 (long int)mon_odds[i]/100, (long int)mon_odds[i]%100);
1567 prt(_("どれに賭けますか:", "Which monster: "), 0, 0);
1577 if (i >= '1' && i <= '4')
1579 sel_monster = i-'1';
1580 battle_odds = mon_odds[sel_monster];
1587 for (i = 0; i < 4; i++)
1588 if (i != sel_monster) clear_bldg(i + 5, i + 5);
1590 maxbet = p_ptr->lev * 200;
1592 /* We can't bet more than we have */
1593 maxbet = MIN(maxbet, p_ptr->au);
1596 strcpy(out_val, "");
1597 sprintf(tmp_str,_("賭け金 (1-%ld)?", "Your wager (1-%ld) ? "), (long int)maxbet);
1599 * Use get_string() because we may need more than
1600 * the s16b value returned by get_quantity().
1602 if (get_string(tmp_str, out_val, 32))
1605 for (p = out_val; *p == ' '; p++);
1610 if (wager > p_ptr->au)
1612 msg_print(_("おい!金が足りないじゃないか!出ていけ!", "Hey! You don't have the gold - get out of here!"));
1618 else if (wager > maxbet)
1620 msg_format(_("%ldゴールドだけ受けよう。残りは取っときな。", "I'll take %ld gold of that. Keep the rest."), (long int)maxbet);
1626 msg_print(_("OK、1ゴールドでいこう。", "Ok, we'll start with 1 gold."));
1630 battle_odds = MAX(wager+1, wager * battle_odds / 100);
1635 /* Save the surface floor as saved floor */
1636 prepare_change_floor_mode(CFM_SAVE_FLOORS);
1638 p_ptr->inside_battle = TRUE;
1639 p_ptr->leaving = TRUE;
1653 * @brief 本日の賞金首情報を表示する。
1656 static void today_target(void)
1659 monster_race *r_ptr = &r_info[today_mon];
1662 c_put_str(TERM_YELLOW, _("本日の賞金首", "Wanted monster that changes from day to day"), 5, 10);
1663 sprintf(buf,_("ターゲット: %s", "target: %s"),r_name + r_ptr->name);
1664 c_put_str(TERM_YELLOW, buf, 6, 10);
1665 sprintf(buf,_("死体 ---- $%d", "corpse ---- $%d"), (int)r_ptr->level * 50 + 100);
1667 sprintf(buf,_("骨 ---- $%d", "skeleton ---- $%d"), (int)r_ptr->level * 30 + 60);
1669 p_ptr->today_mon = today_mon;
1673 * @brief ツチノコの賞金首情報を表示する。
1676 static void tsuchinoko(void)
1679 c_put_str(TERM_YELLOW, _("一獲千金の大チャンス!!!", "Big chance to quick money!!!"), 5, 10);
1680 c_put_str(TERM_YELLOW, _("ターゲット:幻の珍獣「ツチノコ」", "target: the rarest animal 'Tsuchinoko'"), 6, 10);
1681 c_put_str(TERM_WHITE, _("生け捕り ---- $1,000,000", "catch alive ---- $1,000,000"), 8, 10);
1682 c_put_str(TERM_WHITE, _("死体 ---- $200,000", "corpse ---- $200,000"), 9, 10);
1683 c_put_str(TERM_WHITE, _("骨 ---- $100,000", "bones ---- $100,000"), 10, 10);
1687 * @brief 通常の賞金首情報を表示する。
1690 static void shoukinkubi(void)
1696 prt(_("死体を持ち帰れば報酬を差し上げます。", "Offer a prize when you bring a wanted monster's corpse"),4 ,10);
1697 c_put_str(TERM_YELLOW, _("現在の賞金首", "Wanted monsters"), 6, 10);
1699 for (i = 0; i < MAX_KUBI; i++)
1703 monster_race *r_ptr = &r_info[(current_world_ptr->bounty_r_idx[i] > 10000 ? current_world_ptr->bounty_r_idx[i] - 10000 : current_world_ptr->bounty_r_idx[i])];
1705 if (current_world_ptr->bounty_r_idx[i] > 10000)
1708 done_mark = _("(済)", "(done)");
1716 c_prt(color, format("%s %s", r_name + r_ptr->name, done_mark), y+7, 10);
1719 if (!y && (i < MAX_KUBI -1))
1721 prt(_("何かキーを押してください", "Hit any key."), 0, 0);
1732 * 賞金首の報酬テーブル / List of prize object
1735 OBJECT_TYPE_VALUE tval; /*!< ベースアイテムのメイン種別ID */
1736 OBJECT_SUBTYPE_VALUE sval; /*!< ベースアイテムのサブ種別ID */
1737 } prize_list[MAX_KUBI] =
1739 {TV_POTION, SV_POTION_CURING},
1740 {TV_POTION, SV_POTION_SPEED},
1741 {TV_POTION, SV_POTION_SPEED},
1742 {TV_POTION, SV_POTION_RESISTANCE},
1743 {TV_POTION, SV_POTION_ENLIGHTENMENT},
1745 {TV_POTION, SV_POTION_HEALING},
1746 {TV_POTION, SV_POTION_RESTORE_MANA},
1747 {TV_SCROLL, SV_SCROLL_STAR_DESTRUCTION},
1748 {TV_POTION, SV_POTION_STAR_ENLIGHTENMENT},
1749 {TV_SCROLL, SV_SCROLL_SUMMON_PET},
1751 {TV_SCROLL, SV_SCROLL_GENOCIDE},
1752 {TV_POTION, SV_POTION_STAR_HEALING},
1753 {TV_POTION, SV_POTION_STAR_HEALING},
1754 {TV_POTION, SV_POTION_NEW_LIFE},
1755 {TV_SCROLL, SV_SCROLL_MASS_GENOCIDE},
1757 {TV_POTION, SV_POTION_LIFE},
1758 {TV_POTION, SV_POTION_LIFE},
1759 {TV_POTION, SV_POTION_AUGMENTATION},
1760 {TV_POTION, SV_POTION_INVULNERABILITY},
1761 {TV_SCROLL, SV_SCROLL_ARTIFACT},
1765 * @brief 賞金首の引き換え処理 / Get prize
1766 * @return 各種賞金首のいずれかでも換金が行われたか否か。
1768 static bool kankin(void)
1772 bool change = FALSE;
1773 GAME_TEXT o_name[MAX_NLEN];
1776 /* Loop for inventory and right/left arm */
1777 for (i = 0; i <= INVEN_LARM; i++)
1779 o_ptr = &inventory[i];
1781 /* Living Tsuchinoko worthes $1000000 */
1782 if ((o_ptr->tval == TV_CAPTURE) && (o_ptr->pval == MON_TSUCHINOKO))
1784 char buf[MAX_NLEN+20];
1785 object_desc(o_name, o_ptr, 0);
1786 sprintf(buf, _("%s を換金しますか?", "Convert %s into money? "),o_name);
1789 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (long int)(1000000L * o_ptr->number));
1790 p_ptr->au += 1000000L * o_ptr->number;
1791 p_ptr->redraw |= (PR_GOLD);
1792 inven_item_increase(i, -o_ptr->number);
1793 inven_item_describe(i);
1794 inven_item_optimize(i);
1800 for (i = 0; i < INVEN_PACK; i++)
1802 o_ptr = &inventory[i];
1804 /* Corpse of Tsuchinoko worthes $200000 */
1805 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_CORPSE) && (o_ptr->pval == MON_TSUCHINOKO))
1807 char buf[MAX_NLEN+20];
1808 object_desc(o_name, o_ptr, 0);
1809 sprintf(buf, _("%s を換金しますか?", "Convert %s into money? "),o_name);
1812 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (long int)(200000L * o_ptr->number));
1813 p_ptr->au += 200000L * o_ptr->number;
1814 p_ptr->redraw |= (PR_GOLD);
1815 inven_item_increase(i, -o_ptr->number);
1816 inven_item_describe(i);
1817 inven_item_optimize(i);
1823 for (i = 0; i < INVEN_PACK; i++)
1825 o_ptr = &inventory[i];
1827 /* Bones of Tsuchinoko worthes $100000 */
1828 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_SKELETON) && (o_ptr->pval == MON_TSUCHINOKO))
1830 char buf[MAX_NLEN+20];
1831 object_desc(o_name, o_ptr, 0);
1832 sprintf(buf, _("%s を換金しますか?", "Convert %s into money? "),o_name);
1835 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (long int)(100000L * o_ptr->number));
1836 p_ptr->au += 100000L * o_ptr->number;
1837 p_ptr->redraw |= (PR_GOLD);
1838 inven_item_increase(i, -o_ptr->number);
1839 inven_item_describe(i);
1840 inven_item_optimize(i);
1846 for (i = 0; i < INVEN_PACK; i++)
1848 o_ptr = &inventory[i];
1849 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_CORPSE) && (streq(r_name + r_info[o_ptr->pval].name, r_name + r_info[today_mon].name)))
1851 char buf[MAX_NLEN+20];
1852 object_desc(o_name, o_ptr, 0);
1853 sprintf(buf, _("%s を換金しますか?", "Convert %s into money? "),o_name);
1856 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (long int)((r_info[today_mon].level * 50 + 100) * o_ptr->number));
1857 p_ptr->au += (r_info[today_mon].level * 50 + 100) * o_ptr->number;
1858 p_ptr->redraw |= (PR_GOLD);
1859 inven_item_increase(i, -o_ptr->number);
1860 inven_item_describe(i);
1861 inven_item_optimize(i);
1867 for (i = 0; i < INVEN_PACK; i++)
1869 o_ptr = &inventory[i];
1871 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_SKELETON) && (streq(r_name + r_info[o_ptr->pval].name, r_name + r_info[today_mon].name)))
1873 char buf[MAX_NLEN+20];
1874 object_desc(o_name, o_ptr, 0);
1875 sprintf(buf, _("%s を換金しますか?", "Convert %s into money? "),o_name);
1878 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (long int)((r_info[today_mon].level * 30 + 60) * o_ptr->number));
1879 p_ptr->au += (r_info[today_mon].level * 30 + 60) * o_ptr->number;
1880 p_ptr->redraw |= (PR_GOLD);
1881 inven_item_increase(i, -o_ptr->number);
1882 inven_item_describe(i);
1883 inven_item_optimize(i);
1889 for (j = 0; j < MAX_KUBI; j++)
1891 /* Need reverse order --- Positions will be changed in the loop */
1892 for (i = INVEN_PACK-1; i >= 0; i--)
1894 o_ptr = &inventory[i];
1895 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->pval == current_world_ptr->bounty_r_idx[j]))
1897 char buf[MAX_NLEN+20];
1899 INVENTORY_IDX item_new;
1902 object_desc(o_name, o_ptr, 0);
1903 sprintf(buf, _("%sを渡しますか?", "Hand %s over? "),o_name);
1904 if (!get_check(buf)) continue;
1906 #if 0 /* Obsoleted */
1907 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (r_info[current_world_ptr->bounty_r_idx[j]].level + 1) * 300 * o_ptr->number);
1908 p_ptr->au += (r_info[current_world_ptr->bounty_r_idx[j]].level+1) * 300 * o_ptr->number;
1909 p_ptr->redraw |= (PR_GOLD);
1910 inven_item_increase(i, -o_ptr->number);
1911 inven_item_describe(i);
1912 inven_item_optimize(i);
1913 chg_virtue(V_JUSTICE, 5);
1914 current_world_ptr->bounty_r_idx[j] += 10000;
1917 #endif /* Obsoleted */
1920 inven_item_increase(i, -o_ptr->number);
1921 inven_item_describe(i);
1922 inven_item_optimize(i);
1924 chg_virtue(V_JUSTICE, 5);
1925 current_world_ptr->bounty_r_idx[j] += 10000;
1927 /* Count number of unique corpses already handed */
1928 for (num = 0, k = 0; k < MAX_KUBI; k++)
1930 if (current_world_ptr->bounty_r_idx[k] >= 10000) num++;
1932 msg_format(_("これで合計 %d ポイント獲得しました。" ,"You earned %d point%s total."), num, (num > 1 ? "s" : ""));
1934 /* Prepare to make a prize */
1935 object_prep(&forge, lookup_kind(prize_list[num-1].tval, prize_list[num-1].sval));
1936 apply_magic(&forge, current_floor_ptr->object_level, AM_NO_FIXED_ART);
1938 object_aware(&forge);
1939 object_known(&forge);
1942 * Hand it --- Assume there is an empty slot.
1943 * Since a corpse is handed at first,
1944 * there is at least one empty slot.
1946 item_new = inven_carry(&forge);
1948 object_desc(o_name, &forge, 0);
1949 msg_format(_("%s(%c)を貰った。", "You get %s (%c). "), o_name, index_to_label(item_new));
1951 /* Auto-inscription */
1952 autopick_alter_item(item_new, FALSE);
1962 msg_print(_("賞金を得られそうなものは持っていなかった。", "You have nothing."));
1970 * @brief 宿屋の利用サブルーチン
1971 * @details inn commands\n
1972 * Note that resting for the night was a perfect way to avoid player\n
1973 * ghosts in the town *if* you could only make it to the inn in time (-:\n
1974 * Now that the ghosts are temporarily disabled in 2.8.X, this function\n
1975 * will not be that useful. I will keep it in the hopes the player\n
1976 * ghost code does become a reality again. Does help to avoid filthy urchins.\n
1977 * Resting at night is also a quick way to restock stores -KMW-\n
1978 * @param cmd 宿屋の利用施設ID
1979 * @return 施設の利用が実際に行われたか否か。
1981 static bool inn_comm(int cmd)
1985 case BACT_FOOD: /* Buy food & drink */
1986 if (p_ptr->food >= PY_FOOD_FULL)
1988 msg_print(_("今は満腹だ。", "You are full now."));
1991 msg_print(_("バーテンはいくらかの食べ物とビールをくれた。", "The barkeep gives you some gruel and a beer."));
1992 (void)set_food(PY_FOOD_MAX - 1);
1995 case BACT_REST: /* Rest for the night */
1996 if ((p_ptr->poisoned) || (p_ptr->cut))
1998 msg_print(_("あなたに必要なのは部屋ではなく、治療者です。", "You need a healer, not a room."));
2000 msg_print(_("すみません、でもうちで誰かに死なれちゃ困りますんで。", "Sorry, but don't want anyone dying in here."));
2004 s32b oldturn = current_world_ptr->game_turn;
2005 int prev_day, prev_hour, prev_min;
2007 extract_day_hour_min(&prev_day, &prev_hour, &prev_min);
2008 if ((prev_hour >= 6) && (prev_hour <= 17))
2009 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("宿屋に泊まった。", "stay over daytime at the inn."));
2011 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("宿屋に泊まった。", "stay over night at the inn."));
2013 current_world_ptr->game_turn = (current_world_ptr->game_turn / (TURNS_PER_TICK * TOWN_DAWN / 2) + 1) * (TURNS_PER_TICK * TOWN_DAWN / 2);
2014 if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
2016 current_world_ptr->dungeon_turn += MIN((current_world_ptr->game_turn - oldturn), TURNS_PER_TICK * 250) * INN_DUNGEON_TURN_ADJ;
2017 if (current_world_ptr->dungeon_turn > current_world_ptr->dungeon_turn_limit) current_world_ptr->dungeon_turn = current_world_ptr->dungeon_turn_limit;
2020 prevent_turn_overflow();
2022 if ((prev_hour >= 18) && (prev_hour <= 23)) do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
2023 p_ptr->chp = p_ptr->mhp;
2025 if (ironman_nightmare)
2027 msg_print(_("眠りに就くと恐ろしい光景が心をよぎった。", "Horrible visions flit through your mind as you sleep."));
2029 /* Have some nightmares */
2032 sanity_blast(NULL, FALSE);
2033 if (!one_in_(3)) break;
2036 msg_print(_("あなたは絶叫して目を覚ました。", "You awake screaming."));
2037 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("悪夢にうなされてよく眠れなかった。", "be troubled by a nightmare."));
2044 p_ptr->chp = p_ptr->mhp;
2045 p_ptr->csp = p_ptr->msp;
2046 if (p_ptr->pclass == CLASS_MAGIC_EATER)
2049 for (i = 0; i < 72; i++)
2051 p_ptr->magic_num1[i] = p_ptr->magic_num2[i] * EATER_CHARGE;
2053 for (; i < 108; i++)
2055 p_ptr->magic_num1[i] = 0;
2059 if ((prev_hour >= 6) && (prev_hour <= 17))
2061 msg_print(_("あなたはリフレッシュして目覚め、夕方を迎えた。", "You awake refreshed for the evening."));
2062 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("夕方を迎えた。", "awake refreshed."));
2066 msg_print(_("あなたはリフレッシュして目覚め、新たな日を迎えた。", "You awake refreshed for the new day."));
2067 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("すがすがしい朝を迎えた。", "awake refreshed."));
2073 case BACT_RUMORS: /* Listen for rumors */
2075 display_rumor(TRUE);
2085 * @brief クエスト情報を表示しつつ処理する。/ Display quest information
2086 * @param questnum クエストのID
2087 * @param do_init クエストの開始処理(TRUE)、結果処理か(FALSE)
2090 static void get_questinfo(IDX questnum, bool do_init)
2093 QUEST_IDX old_quest;
2094 GAME_TEXT tmp_str[80];
2096 /* Clear the text */
2097 for (i = 0; i < 10; i++)
2099 quest_text[i][0] = '\0';
2102 quest_text_line = 0;
2104 /* Set the quest number temporary */
2105 old_quest = p_ptr->inside_quest;
2106 p_ptr->inside_quest = questnum;
2108 /* Get the quest text */
2109 init_flags = INIT_SHOW_TEXT;
2110 if (do_init) init_flags |= INIT_ASSIGN;
2112 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
2114 /* Reset the old quest number */
2115 p_ptr->inside_quest = old_quest;
2117 /* Print the quest info */
2118 sprintf(tmp_str, _("クエスト情報 (危険度: %d 階相当)", "Quest Information (Danger level: %d)"), (int)quest[questnum].level);
2122 prt(quest[questnum].name, 7, 0);
2124 for (i = 0; i < 10; i++)
2126 c_put_str(TERM_YELLOW, quest_text[i], i + 8, 0);
2131 * @brief クエスト処理のメインルーチン / Request a quest from the Lord.
2134 static void castle_quest(void)
2136 QUEST_IDX q_index = 0;
2137 monster_race *r_ptr;
2144 /* Current quest of the building */
2145 q_index = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].special;
2147 /* Is there a quest available at the building? */
2150 put_str(_("今のところクエストはありません。", "I don't have a quest for you at the moment."), 8, 0);
2154 q_ptr = &quest[q_index];
2156 /* Quest is completed */
2157 if (q_ptr->status == QUEST_STATUS_COMPLETED)
2159 /* Rewarded quest */
2160 q_ptr->status = QUEST_STATUS_REWARDED;
2162 get_questinfo(q_index, FALSE);
2164 reinit_wilderness = TRUE;
2167 else if (q_ptr->status == QUEST_STATUS_FAILED)
2169 get_questinfo(q_index, FALSE);
2171 /* Mark quest as done (but failed) */
2172 q_ptr->status = QUEST_STATUS_FAILED_DONE;
2174 reinit_wilderness = TRUE;
2176 /* Quest is still unfinished */
2177 else if (q_ptr->status == QUEST_STATUS_TAKEN)
2179 put_str(_("あなたは現在のクエストを終了させていません!", "You have not completed your current quest yet!"), 8, 0);
2180 put_str(_("CTRL-Qを使えばクエストの状態がチェックできます。", "Use CTRL-Q to check the status of your quest."), 9, 0);
2181 put_str(_("クエストを終わらせたら戻って来て下さい。", "Return when you have completed your quest."), 12, 0);
2184 else if (q_ptr->status == QUEST_STATUS_UNTAKEN)
2186 q_ptr->status = QUEST_STATUS_TAKEN;
2188 reinit_wilderness = TRUE;
2190 /* Assign a new quest */
2191 if (q_ptr->type == QUEST_TYPE_KILL_ANY_LEVEL)
2193 if (q_ptr->r_idx == 0)
2195 /* Random monster at least 5 - 10 levels out of deep */
2196 q_ptr->r_idx = get_mon_num(q_ptr->level + 4 + randint1(6));
2199 r_ptr = &r_info[q_ptr->r_idx];
2201 while ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->rarity != 1))
2203 q_ptr->r_idx = get_mon_num(q_ptr->level) + 4 + randint1(6);
2204 r_ptr = &r_info[q_ptr->r_idx];
2207 if (q_ptr->max_num == 0)
2209 /* Random monster number */
2210 if (randint1(10) > 7)
2213 q_ptr->max_num = randint1(3) + 1;
2217 name = (r_name + r_ptr->name);
2218 msg_format(_("クエスト: %sを %d体倒す", "Your quest: kill %d %s"), name,q_ptr->max_num);
2222 get_questinfo(q_index, TRUE);
2229 * @brief 町に関するヘルプを表示する / Display town history
2232 static void town_history(void)
2236 /* Peruse the building help file */
2237 (void)show_file(TRUE, _("jbldg.txt", "bldg.txt"), NULL, 0, 0);
2242 * @brief 射撃時クリティカルによるダメージ期待値修正計算(スナイパーの集中処理と武器経験値) / critical happens at i / 10000
2243 * @param plus_ammo 矢弾のダメージ修正
2244 * @param plus_bow 弓のダメージ修正
2246 * @note 基本ダメージ量と重量はこの部位では計算に加わらない。
2248 HIT_POINT calc_crit_ratio_shot(HIT_POINT plus_ammo, HIT_POINT plus_bow)
2251 object_type *j_ptr = &inventory[INVEN_BOW];
2253 /* Extract "shot" power */
2254 i = p_ptr->to_h_b + plus_ammo;
2256 if (p_ptr->tval_ammo == TV_BOLT)
2257 i = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + i) * BTH_PLUS_ADJ);
2259 i = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + i) * BTH_PLUS_ADJ);
2261 /* Snipers can shot more critically with crossbows */
2262 if (p_ptr->concent) i += ((i * p_ptr->concent) / 5);
2263 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->tval_ammo == TV_BOLT)) i *= 2;
2265 /* Good bow makes more critical */
2266 i += plus_bow * 8 * (p_ptr->concent ? p_ptr->concent + 5 : 5);
2274 * @brief 射撃時クリティカルによるダメージ期待値修正計算(重量依存部分) / critical happens at i / 10000
2275 * @param weight 武器の重量
2276 * @param plus_ammo 矢弾のダメージ修正
2277 * @param plus_bow 弓のダメージ修正
2278 * @param dam 基本ダメージ量
2281 HIT_POINT calc_expect_crit_shot(WEIGHT weight, int plus_ammo, int plus_bow, HIT_POINT dam)
2285 i = calc_crit_ratio_shot(plus_ammo, plus_bow);
2290 crit = MIN(500, 900/weight);
2291 num += dam * 3 /2 * crit;
2294 crit = MIN(500, 1350/weight);
2296 num += dam * 2 * crit;
2302 num += dam * 3 * crit;
2308 num += (10000 - i) * dam;
2315 * @brief 攻撃時クリティカルによるダメージ期待値修正計算(重量と毒針処理) / critical happens at i / 10000
2316 * @param weight 武器の重量
2317 * @param plus 武器のダメージ修正
2319 * @param meichuu 命中値
2320 * @param dokubari 毒針処理か否か
2323 HIT_POINT calc_expect_crit(WEIGHT weight, int plus, HIT_POINT dam, s16b meichuu, bool dokubari)
2328 if(dokubari) return dam;
2330 i = (weight + (meichuu * 3 + plus * 5) + p_ptr->skill_thn);
2336 if (k < 400) num += (2 * dam + 5) * (400 - k);
2337 if (k < 700) num += (2 * dam + 10) * (MIN(700, k + 650) - MAX(400, k));
2338 if (k > (700 - 650) && k < 900) num += (3 * dam + 15) * (MIN(900, k + 650) - MAX(700, k));
2339 if (k > (900 - 650) && k < 1300) num += (3 * dam + 20) * (MIN(1300, k + 650) - MAX(900, k));
2340 if (k > (1300 - 650)) num += (7 * dam / 2 + 25) * MIN(650, k - (1300 - 650));
2343 if(p_ptr->pclass == CLASS_NINJA)
2346 num += (4444 - i) * dam;
2352 num += (5000 - i) * dam;
2360 * @brief 攻撃時スレイによるダメージ期待値修正計算 / critical happens at i / 10000
2362 * @param mult スレイ倍率(掛け算部分)
2363 * @param div スレイ倍率(割り算部分)
2364 * @param force 理力特別計算フラグ
2367 static HIT_POINT calc_slaydam(HIT_POINT dam, int mult, int div, bool force)
2375 tmp += dam * 60 * 2;
2389 * @brief 攻撃時の期待値計算(スレイ→重量クリティカル→切れ味効果)
2391 * @param mult スレイ倍率(掛け算部分)
2392 * @param div スレイ倍率(割り算部分)
2393 * @param force 理力特別計算フラグ
2395 * @param plus 武器ダメージ修正
2396 * @param meichuu 命中値
2397 * @param dokubari 毒針処理か否か
2398 * @param vorpal_mult 切れ味倍率(掛け算部分)
2399 * @param vorpal_div 切れ味倍率(割り算部分)
2402 static u32b calc_expect_dice(u32b dam, int mult, int div, bool force, WEIGHT weight, int plus, s16b meichuu, bool dokubari, int vorpal_mult, int vorpal_div)
2404 dam = calc_slaydam(dam, mult, div, force);
2405 dam = calc_expect_crit(weight, plus, dam, meichuu, dokubari);
2406 dam = calc_slaydam(dam, vorpal_mult, vorpal_div, FALSE);
2412 * @brief 武器の各条件毎のダメージ期待値を表示する。
2415 * @param mindice ダイス部分最小値
2416 * @param maxdice ダイス部分最大値
2418 * @param dam_bonus ダメージ修正値
2420 * @param color 条件内容の表示色
2422 * Display the damage figure of an object\n
2423 * (used by compare_weapon_aux)\n
2425 * Only accurate for the current weapon, because it includes\n
2426 * the current +dam of the player.\n
2429 static void show_weapon_dmg(int r, int c, int mindice, int maxdice, int blows, int dam_bonus, concptr attr, byte color)
2431 GAME_TEXT tmp_str[80];
2434 mindam = blows * (mindice + dam_bonus);
2435 maxdam = blows * (maxdice + dam_bonus);
2437 /* Print the intro text */
2438 c_put_str(color, attr, r, c);
2440 /* Calculate the min and max damage figures */
2441 sprintf(tmp_str, _("1ターン: %d-%d ダメージ", "Attack: %d-%d damage"), mindam, maxdam);
2443 /* Print the damage */
2444 put_str(tmp_str, r, c + 8);
2449 * @brief 武器一つ毎のダメージ情報を表示する。
2450 * @param o_ptr オブジェクトの構造体の参照ポインタ。
2451 * @param col 表示する行の上端
2454 * Show the damage figures for the various monster types\n
2456 * Only accurate for the current weapon, because it includes\n
2457 * the current number of blows for the player.\n
2460 static void compare_weapon_aux(object_type *o_ptr, int col, int r)
2462 BIT_FLAGS flgs[TR_FLAG_SIZE];
2463 int blow = p_ptr->num_blow[0];
2465 bool dokubari = FALSE;
2467 /* Effective dices */
2468 int eff_dd = o_ptr->dd + p_ptr->to_dd[0];
2469 int eff_ds = o_ptr->ds + p_ptr->to_ds[0];
2471 int mindice = eff_dd;
2472 int maxdice = eff_ds * eff_dd;
2475 int vorpal_mult = 1;
2477 int dmg_bonus = o_ptr->to_d + p_ptr->to_d[0];
2480 /* Get the flags of the weapon */
2481 object_flags(o_ptr, flgs);
2483 if((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) dokubari = TRUE;
2486 /* Show Critical Damage*/
2487 mindam = calc_expect_crit(o_ptr->weight, o_ptr->to_h, mindice, p_ptr->to_h[0], dokubari);
2488 maxdam = calc_expect_crit(o_ptr->weight, o_ptr->to_h, maxdice, p_ptr->to_h[0], dokubari);
2490 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("会心:", "Critical:"), TERM_L_RED);
2494 if ((have_flag(flgs, TR_VORPAL) || hex_spelling(HEX_RUNESWORD)))
2496 if((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD))
2507 mindam = calc_expect_dice(mindice, 1, 1, FALSE, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2508 maxdam = calc_expect_dice(maxdice, 1, 1, FALSE, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2509 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("切れ味:", "Vorpal:") , TERM_L_RED);
2512 if ((p_ptr->pclass != CLASS_SAMURAI) && have_flag(flgs, TR_FORCE_WEAPON) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
2516 mindam = calc_expect_dice(mindice, 1, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2517 maxdam = calc_expect_dice(maxdice, 1, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2518 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("理力:", "Force :"), TERM_L_BLUE);
2521 /* Print the relevant lines */
2522 if (have_flag(flgs, TR_KILL_ANIMAL))
2524 mindam = calc_expect_dice(mindice, 4, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2525 maxdam = calc_expect_dice(maxdice, 4, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2526 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("動物:", "Animals:"), TERM_YELLOW);
2528 else if (have_flag(flgs, TR_SLAY_ANIMAL))
2530 mindam = calc_expect_dice(mindice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2531 maxdam = calc_expect_dice(maxdice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2532 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("動物:", "Animals:"), TERM_YELLOW);
2534 if (have_flag(flgs, TR_KILL_EVIL))
2536 mindam = calc_expect_dice(mindice, 7, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2537 maxdam = calc_expect_dice(maxdice, 7, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2538 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("邪悪:", "Evil:"), TERM_YELLOW);
2540 else if (have_flag(flgs, TR_SLAY_EVIL))
2542 mindam = calc_expect_dice(mindice, 2, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2543 maxdam = calc_expect_dice(maxdice, 2, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2544 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("邪悪:", "Evil:"), TERM_YELLOW);
2546 if (have_flag(flgs, TR_KILL_HUMAN))
2548 mindam = calc_expect_dice(mindice, 4, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2549 maxdam = calc_expect_dice(maxdice, 4, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2550 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("人間:", "Human:"), TERM_YELLOW);
2552 else if (have_flag(flgs, TR_SLAY_HUMAN))
2554 mindam = calc_expect_dice(mindice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2555 maxdam = calc_expect_dice(maxdice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2556 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("人間:", "Human:"), TERM_YELLOW);
2558 if (have_flag(flgs, TR_KILL_UNDEAD))
2560 mindam = calc_expect_dice(mindice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2561 maxdam = calc_expect_dice(maxdice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2562 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("不死:", "Undead:"), TERM_YELLOW);
2564 else if (have_flag(flgs, TR_SLAY_UNDEAD))
2566 mindam = calc_expect_dice(mindice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2567 maxdam = calc_expect_dice(maxdice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2568 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("不死:", "Undead:"), TERM_YELLOW);
2570 if (have_flag(flgs, TR_KILL_DEMON))
2572 mindam = calc_expect_dice(mindice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2573 maxdam = calc_expect_dice(maxdice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2574 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("悪魔:", "Demons:") , TERM_YELLOW);
2576 else if (have_flag(flgs, TR_SLAY_DEMON))
2578 mindam = calc_expect_dice(mindice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2579 maxdam = calc_expect_dice(maxdice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2580 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("悪魔:", "Demons:") , TERM_YELLOW);
2582 if (have_flag(flgs, TR_KILL_ORC))
2584 mindam = calc_expect_dice(mindice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2585 maxdam = calc_expect_dice(maxdice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2586 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("オーク:", "Orcs:"), TERM_YELLOW);
2588 else if (have_flag(flgs, TR_SLAY_ORC))
2590 mindam = calc_expect_dice(mindice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2591 maxdam = calc_expect_dice(maxdice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2592 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("オーク:", "Orcs:"), TERM_YELLOW);
2594 if (have_flag(flgs, TR_KILL_TROLL))
2596 mindam = calc_expect_dice(mindice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2597 maxdam = calc_expect_dice(maxdice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2598 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("トロル:", "Trolls:") , TERM_YELLOW);
2600 else if (have_flag(flgs, TR_SLAY_TROLL))
2602 mindam = calc_expect_dice(mindice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2603 maxdam = calc_expect_dice(maxdice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2604 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("トロル:", "Trolls:") , TERM_YELLOW);
2606 if (have_flag(flgs, TR_KILL_GIANT))
2608 mindam = calc_expect_dice(mindice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2609 maxdam = calc_expect_dice(maxdice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2610 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("巨人:", "Giants:"), TERM_YELLOW);
2612 else if (have_flag(flgs, TR_SLAY_GIANT))
2614 mindam = calc_expect_dice(mindice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2615 maxdam = calc_expect_dice(maxdice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2616 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("巨人:", "Giants:"), TERM_YELLOW);
2618 if (have_flag(flgs, TR_KILL_DRAGON))
2620 mindam = calc_expect_dice(mindice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2621 maxdam = calc_expect_dice(maxdice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2622 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("竜:", "Dragons:"), TERM_YELLOW);
2624 else if (have_flag(flgs, TR_SLAY_DRAGON))
2626 mindam = calc_expect_dice(mindice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2627 maxdam = calc_expect_dice(maxdice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2628 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("竜:", "Dragons:"), TERM_YELLOW);
2630 if (have_flag(flgs, TR_BRAND_ACID))
2632 mindam = calc_expect_dice(mindice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2633 maxdam = calc_expect_dice(maxdice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2634 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("酸属性:", "Acid:"), TERM_RED);
2636 if (have_flag(flgs, TR_BRAND_ELEC))
2638 mindam = calc_expect_dice(mindice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2639 maxdam = calc_expect_dice(maxdice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2640 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("電属性:", "Elec:"), TERM_RED);
2642 if (have_flag(flgs, TR_BRAND_FIRE))
2644 mindam = calc_expect_dice(mindice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2645 maxdam = calc_expect_dice(maxdice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2646 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("炎属性:", "Fire:"), TERM_RED);
2648 if (have_flag(flgs, TR_BRAND_COLD))
2650 mindam = calc_expect_dice(mindice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2651 maxdam = calc_expect_dice(maxdice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2652 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("冷属性:", "Cold:"), TERM_RED);
2654 if (have_flag(flgs, TR_BRAND_POIS))
2656 mindam = calc_expect_dice(mindice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2657 maxdam = calc_expect_dice(maxdice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
2658 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("毒属性:", "Poison:"), TERM_RED);
2663 * @brief 武器匠における武器一つ毎の完全情報を表示する。
2664 * @param o_ptr オブジェクトの構造体の参照ポインタ。
2665 * @param row 表示する列の左端
2666 * @param col 表示する行の上端
2668 * Displays all info about a weapon
2670 * Only accurate for the current weapon, because it includes
2671 * various info about the player's +to_dam and number of blows.
2674 static void list_weapon(object_type *o_ptr, TERM_LEN row, TERM_LEN col)
2676 GAME_TEXT o_name[MAX_NLEN];
2677 GAME_TEXT tmp_str[80];
2679 DICE_NUMBER eff_dd = o_ptr->dd + p_ptr->to_dd[0];
2680 DICE_SID eff_ds = o_ptr->ds + p_ptr->to_ds[0];
2681 HIT_RELIABILITY reli = p_ptr->skill_thn + (p_ptr->to_h[0] + o_ptr->to_h) * BTH_PLUS_ADJ;
2683 /* Print the weapon name */
2684 object_desc(o_name, o_ptr, OD_NAME_ONLY);
2685 c_put_str(TERM_YELLOW, o_name, row, col);
2687 /* Print the player's number of blows */
2688 sprintf(tmp_str, _("攻撃回数: %d", "Number of Blows: %d"), p_ptr->num_blow[0]);
2689 put_str(tmp_str, row+1, col);
2691 /* Print to_hit and to_dam of the weapon */
2692 sprintf(tmp_str, _("命中率: 0 50 100 150 200 (敵のAC)", "To Hit: 0 50 100 150 200 (AC)"));
2693 put_str(tmp_str, row+2, col);
2695 /* Print the weapons base damage dice */
2696 sprintf(tmp_str, " %2d %2d %2d %2d %2d (%%)",
2697 (int)hit_chance(reli, 0),
2698 (int)hit_chance(reli, 50),
2699 (int)hit_chance(reli, 100),
2700 (int)hit_chance(reli, 150),
2701 (int)hit_chance(reli, 200));
2702 put_str(tmp_str, row+3, col);
2703 c_put_str(TERM_YELLOW, _("可能なダメージ:", "Possible Damage:"), row+5, col);
2705 /* Damage for one blow (if it hits) */
2706 sprintf(tmp_str, _("攻撃一回につき %d-%d", "One Strike: %d-%d damage"),
2707 (int)(eff_dd + o_ptr->to_d + p_ptr->to_d[0]),
2708 (int)(eff_ds * eff_dd + o_ptr->to_d + p_ptr->to_d[0]));
2709 put_str(tmp_str, row+6, col+1);
2711 /* Damage for the complete attack (if all blows hit) */
2712 sprintf(tmp_str, _("1ターンにつき %d-%d", "One Attack: %d-%d damage"),
2713 (int)(p_ptr->num_blow[0] * (eff_dd + o_ptr->to_d + p_ptr->to_d[0])),
2714 (int)(p_ptr->num_blow[0] * (eff_ds * eff_dd + o_ptr->to_d + p_ptr->to_d[0])));
2715 put_str(tmp_str, row+7, col+1);
2719 * @brief 武器匠鑑定1回分(オブジェクト2種)の処理。/ Compare weapons
2721 * Copies the weapons to compare into the weapon-slot and\n
2722 * compares the values for both weapons.\n
2723 * 武器1つだけで比較をしないなら費用は半額になる。
2724 * @param bcost 基本鑑定費用
2725 * @return 最終的にかかった費用
2727 static PRICE compare_weapons(PRICE bcost)
2730 OBJECT_IDX item, item2;
2731 object_type *o_ptr[2];
2732 object_type orig_weapon;
2736 TERM_LEN wid = 38, mgn = 2;
2737 bool old_character_xtra = character_xtra;
2740 PRICE cost = 0; /* First time no price */
2745 /* Store copy of original wielded weapon */
2746 i_ptr = &inventory[INVEN_RARM];
2747 object_copy(&orig_weapon, i_ptr);
2749 item_tester_hook = item_tester_hook_orthodox_melee_weapons;
2751 /* Get the first weapon */
2752 q = _("第一の武器は?", "What is your first weapon? ");
2753 s = _("比べるものがありません。", "You have nothing to compare.");
2755 o_ptr[0] = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT));
2769 /* Only compare melee weapons */
2770 item_tester_hook = item_tester_hook_orthodox_melee_weapons;
2772 /* Hack -- prevent "icky" message */
2773 character_xtra = TRUE;
2775 /* Diaplay selected weapon's infomation */
2776 for (i = 0; i < n; i++)
2778 int col = (wid * i + mgn);
2780 /* Copy i-th weapon into the weapon slot (if it's not already there) */
2781 if (o_ptr[i] != i_ptr) object_copy(i_ptr, o_ptr[i]);
2783 p_ptr->update |= PU_BONUS;
2786 /* List the new values */
2787 list_weapon(o_ptr[i], row, col);
2788 compare_weapon_aux(o_ptr[i], col, row + 8);
2790 /* Copy back the original weapon into the weapon slot */
2791 object_copy(i_ptr, &orig_weapon);
2794 /* Reset the values for the old weapon */
2795 p_ptr->update |= PU_BONUS;
2798 character_xtra = old_character_xtra;
2801 put_str(format("[ 比較対象: 's'で変更 ($%d) ]", cost), 1, (wid + mgn));
2802 put_str("(一番高いダメージが適用されます。複数の倍打効果は足し算されません。)", row + 4, 0);
2803 prt("現在の技量から判断すると、あなたの武器は以下のような威力を発揮します:", 0, 0);
2805 put_str(format("[ 's' Select secondary weapon($%d) ]", cost), row + 1, (wid * i + mgn));
2806 put_str("(Only highest damage applies per monster. Special damage not cumulative.)", row + 4, 0);
2807 prt("Based on your current abilities, here is what your weapons will do", 0, 0);
2815 if (total + cost > p_ptr->au)
2817 msg_print(_("お金が足りません!", "You don't have enough money!"));
2822 q = _("第二の武器は?", "What is your second weapon? ");
2823 s = _("比べるものがありません。", "You have nothing to compare.");
2825 /* Get the second weapon */
2826 o_ptr[1] = choose_object(&item2, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT));
2827 if (!o_ptr[1]) continue;
2845 * @brief ACから回避率、ダメージ減少率を計算し表示する。 / Evaluate AC
2847 * Calculate and display the dodge-rate and the protection-rate
2849 * @param iAC プレイヤーのAC。
2850 * @return 常にTRUEを返す。
2852 static bool eval_ac(ARMOUR_CLASS iAC)
2856 "ダメージ軽減率とは、敵の攻撃が当たった時そのダメージを\n"
2857 "何パーセント軽減するかを示します。\n"
2858 "ダメージ軽減は通常の直接攻撃(種類が「攻撃する」と「粉砕する」の物)\n"
2859 "に対してのみ効果があります。\n \n"
2860 "敵のレベルとは、その敵が通常何階に現れるかを示します。\n \n"
2861 "回避率は敵の直接攻撃を何パーセントの確率で避けるかを示し、\n"
2862 "敵のレベルとあなたのACによって決定されます。\n \n"
2863 "ダメージ期待値とは、敵の100ポイントの通常攻撃に対し、\n"
2864 "回避率とダメージ軽減率を考慮したダメージの期待値を示します。\n";
2867 "'Protection Rate' means how much damage is reduced by your armor.\n"
2868 "Note that the Protection rate is effective only against normal "
2869 "'attack' and 'shatter' type melee attacks, "
2870 "and has no effect against any other types such as 'poison'.\n \n"
2871 "'Dodge Rate' indicates the success rate on dodging the "
2872 "monster's melee attacks. "
2873 "It is depend on the level of the monster and your AC.\n \n"
2874 "'Average Damage' indicates the expected amount of damage "
2875 "when you are attacked by normal melee attacks with power=100.";
2879 TERM_LEN col, row = 2;
2881 char buf[80*20], *t;
2883 /* AC lower than zero has no effect */
2884 if (iAC < 0) iAC = 0;
2887 protection = 100 * MIN(iAC, 150) / 250;
2892 put_str(format(_("あなたの現在のAC: %3d", "Your current AC : %3d"), iAC), row++, 0);
2893 put_str(format(_("ダメージ軽減率 : %3d%%", "Protection rate : %3d%%"), protection), row++, 0);
2896 put_str(_("敵のレベル :", "Level of Monster:"), row + 0, 0);
2897 put_str(_("回避率 :", "Dodge Rate :"), row + 1, 0);
2898 put_str(_("ダメージ期待値 :", "Average Damage :"), row + 2, 0);
2900 for (col = 17 + 1, lvl = 0; lvl <= 100; lvl += 10, col += 5)
2902 int quality = 60 + lvl * 3; /* attack quality with power 60 */
2903 int dodge; /* 回避率(%) */
2904 int average; /* ダメージ期待値 */
2906 put_str(format("%3d", lvl), row + 0, col);
2909 dodge = 5 + (MIN(100, 100 * (iAC * 3 / 4) / quality) * 9 + 5) / 10;
2910 put_str(format("%3d%%", dodge), row + 1, col);
2912 /* 100点の攻撃に対してのダメージ期待値を計算 */
2913 average = (100 - dodge) * (100 - protection) / 100;
2914 put_str(format("%3d", average), row + 2, col);
2918 roff_to_buf(memo, 70, buf, sizeof(buf));
2919 for (t = buf; t[0]; t += strlen(t) + 1)
2920 put_str(t, (row++) + 4, 4);
2922 prt(_("現在のあなたの装備からすると、あなたの防御力はこれくらいです:", "Defense abilities from your current Armor Class are evaluated below."), 0, 0);
2934 * @brief 修復材料のオブジェクトから修復対象に特性を移植する。
2935 * @param to_ptr 修復対象オブジェクトの構造体の参照ポインタ。
2936 * @param from_ptr 修復材料オブジェクトの構造体の参照ポインタ。
2937 * @return 修復対象になるならTRUEを返す。
2939 static void give_one_ability_of_object(object_type *to_ptr, object_type *from_ptr)
2942 int cand[TR_FLAG_MAX];
2943 BIT_FLAGS to_flgs[TR_FLAG_SIZE];
2944 BIT_FLAGS from_flgs[TR_FLAG_SIZE];
2946 object_flags(to_ptr, to_flgs);
2947 object_flags(from_ptr, from_flgs);
2949 for (i = 0; i < TR_FLAG_MAX; i++)
2953 case TR_IGNORE_ACID:
2954 case TR_IGNORE_ELEC:
2955 case TR_IGNORE_FIRE:
2956 case TR_IGNORE_COLD:
2965 case TR_FIXED_FLAVOR:
2968 if (have_flag(from_flgs, i) && !have_flag(to_flgs, i))
2970 if (!(is_pval_flag(i) && (from_ptr->pval < 1))) cand[n++] = i;
2978 int tr_idx = cand[randint0(n)];
2979 add_flag(to_ptr->art_flags, tr_idx);
2980 if (is_pval_flag(tr_idx)) to_ptr->pval = MAX(to_ptr->pval, 1);
2981 bmax = MIN(3, MAX(1, 40 / (to_ptr->dd * to_ptr->ds)));
2982 if (tr_idx == TR_BLOWS) to_ptr->pval = MIN(to_ptr->pval, bmax);
2983 if (tr_idx == TR_SPEED) to_ptr->pval = MIN(to_ptr->pval, 4);
2990 * @brief アイテム修復処理のメインルーチン / Repair broken weapon
2991 * @param bcost 基本修復費用
2994 static PRICE repair_broken_weapon_aux(PRICE bcost)
2997 OBJECT_IDX item, mater;
2998 object_type *o_ptr, *mo_ptr; /* broken weapon and material weapon */
3000 int i, dd_bonus, ds_bonus;
3001 KIND_OBJECT_IDX k_idx;
3002 char basenm[MAX_NLEN];
3007 prt(_("修復には材料となるもう1つの武器が必要です。", "Hand one material weapon to repair a broken weapon."), row, 2);
3008 prt(_("材料に使用した武器はなくなります!", "The material weapon will disappear after repairing!!"), row+1, 2);
3010 q = _("どの折れた武器を修復しますか?", "Repair which broken weapon? ");
3011 s = _("修復できる折れた武器がありません。", "You have no broken weapon to repair.");
3013 /* Only forge broken weapons */
3014 item_tester_hook = item_tester_hook_broken_weapon;
3016 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP));
3017 if (!o_ptr) return (0);
3019 /* It is worthless */
3020 if (!object_is_ego(o_ptr) && !object_is_artifact(o_ptr))
3022 msg_format(_("それは直してもしょうがないぜ。", "It is worthless to repair."));
3026 /* They are too many */
3027 if (o_ptr->number > 1)
3029 msg_format(_("一度に複数を修復することはできません!", "They are too many to repair at once!"));
3033 /* Display item name */
3034 object_desc(basenm, o_ptr, OD_NAME_ONLY);
3035 prt(format(_("修復する武器 : %s", "Repairing: %s"), basenm), row+3, 2);
3037 q = _("材料となる武器は?", "Which weapon for material? ");
3038 s = _("材料となる武器がありません。", "You have no material to repair.");
3040 /* Only forge broken weapons */
3041 item_tester_hook = item_tester_hook_orthodox_melee_weapons;
3043 mo_ptr = choose_object(&mater, q, s, (USE_INVEN | USE_EQUIP));
3044 if (!mo_ptr) return (0);
3047 msg_print(_("クラインの壷じゃない!", "This is not a klein bottle!"));
3051 /* Display item name */
3052 object_desc(basenm, mo_ptr, OD_NAME_ONLY);
3053 prt(format(_("材料とする武器: %s", "Material : %s"), basenm), row+4, 2);
3055 /* Get the value of one of the items (except curses) */
3056 cost = bcost + object_value_real(o_ptr) * 2;
3058 if (!get_check(format(_("$%dかかりますがよろしいですか? ", "Costs %d gold, okay? "), cost))) return (0);
3060 /* Check if the player has enough money */
3061 if (p_ptr->au < cost)
3063 object_desc(basenm, o_ptr, OD_NAME_ONLY);
3064 msg_format(_("%sを修復するだけのゴールドがありません!", "You do not have the gold to repair %s!"), basenm);
3069 p_ptr->total_weight -= o_ptr->weight;
3071 if (o_ptr->sval == SV_BROKEN_DAGGER)
3076 /* Suppress compiler warning */
3079 for (j = 1; j < max_k_idx; j++)
3081 object_kind *k_aux_ptr = &k_info[j];
3083 if (k_aux_ptr->tval != TV_SWORD) continue;
3084 if ((k_aux_ptr->sval == SV_BROKEN_DAGGER) ||
3085 (k_aux_ptr->sval == SV_BROKEN_SWORD) ||
3086 (k_aux_ptr->sval == SV_DOKUBARI)) continue;
3087 if (k_aux_ptr->weight > 99) continue;
3096 else /* TV_BROKEN_SWORD */
3098 /* Repair to a sword or sometimes material's type weapon */
3099 OBJECT_TYPE_VALUE tval = (one_in_(5) ? mo_ptr->tval : TV_SWORD);
3103 object_kind *ck_ptr;
3105 k_idx = lookup_kind(tval, SV_ANY);
3106 ck_ptr = &k_info[k_idx];
3108 if (tval == TV_SWORD)
3110 if ((ck_ptr->sval == SV_BROKEN_DAGGER) ||
3111 (ck_ptr->sval == SV_BROKEN_SWORD) ||
3112 (ck_ptr->sval == SV_DIAMOND_EDGE) ||
3113 (ck_ptr->sval == SV_DOKUBARI)) continue;
3115 if (tval == TV_POLEARM)
3117 if ((ck_ptr->sval == SV_DEATH_SCYTHE) ||
3118 (ck_ptr->sval == SV_TSURIZAO)) continue;
3120 if (tval == TV_HAFTED)
3122 if ((ck_ptr->sval == SV_GROND) ||
3123 (ck_ptr->sval == SV_WIZSTAFF) ||
3124 (ck_ptr->sval == SV_NAMAKE_HAMMER)) continue;
3131 /* Calculate dice bonuses */
3132 dd_bonus = o_ptr->dd - k_info[o_ptr->k_idx].dd;
3133 ds_bonus = o_ptr->ds - k_info[o_ptr->k_idx].ds;
3134 dd_bonus += mo_ptr->dd - k_info[mo_ptr->k_idx].dd;
3135 ds_bonus += mo_ptr->ds - k_info[mo_ptr->k_idx].ds;
3137 /* Change base object */
3138 k_ptr = &k_info[k_idx];
3139 o_ptr->k_idx = k_idx;
3140 o_ptr->weight = k_ptr->weight;
3141 o_ptr->tval = k_ptr->tval;
3142 o_ptr->sval = k_ptr->sval;
3143 o_ptr->dd = k_ptr->dd;
3144 o_ptr->ds = k_ptr->ds;
3146 /* Copy base object's ability */
3147 for (i = 0; i < TR_FLAG_SIZE; i++) o_ptr->art_flags[i] |= k_ptr->flags[i];
3148 if (k_ptr->pval) o_ptr->pval = MAX(o_ptr->pval, randint1(k_ptr->pval));
3149 if (have_flag(k_ptr->flags, TR_ACTIVATE)) o_ptr->xtra2 = (byte_hack)k_ptr->act_idx;
3155 for (i = 1; i < dd_bonus; i++)
3157 if (one_in_(o_ptr->dd + i)) o_ptr->dd++;
3163 for (i = 1; i < ds_bonus; i++)
3165 if (one_in_(o_ptr->ds + i)) o_ptr->ds++;
3169 if (have_flag(k_ptr->flags, TR_BLOWS))
3171 int bmax = MIN(3, MAX(1, 40 / (o_ptr->dd * o_ptr->ds)));
3172 o_ptr->pval = MIN(o_ptr->pval, bmax);
3175 /* Add one random ability from material weapon */
3176 give_one_ability_of_object(o_ptr, mo_ptr);
3178 /* Add to-dam, to-hit and to-ac from material weapon */
3179 o_ptr->to_d += MAX(0, (mo_ptr->to_d / 3));
3180 o_ptr->to_h += MAX(0, (mo_ptr->to_h / 3));
3181 o_ptr->to_a += MAX(0, (mo_ptr->to_a));
3183 if ((o_ptr->name1 == ART_NARSIL) ||
3184 (object_is_random_artifact(o_ptr) && one_in_(1)) ||
3185 (object_is_ego(o_ptr) && one_in_(7)))
3188 if (object_is_ego(o_ptr))
3190 add_flag(o_ptr->art_flags, TR_IGNORE_FIRE);
3191 add_flag(o_ptr->art_flags, TR_IGNORE_ACID);
3194 /* Add one random ability from material weapon */
3195 give_one_ability_of_object(o_ptr, mo_ptr);
3197 /* Add one random activation */
3198 if (!activation_index(o_ptr)) one_activation(o_ptr);
3201 if (o_ptr->name1 == ART_NARSIL)
3203 one_high_resistance(o_ptr);
3207 msg_print(_("これはかなりの業物だったようだ。", "This blade seems to be exceptionally."));
3210 object_desc(basenm, o_ptr, OD_NAME_ONLY);
3212 msg_format("$%dで%sに修復しました。", cost, basenm);
3214 msg_format("Repaired into %s for %d gold.", basenm, cost);
3218 /* Remove BROKEN flag */
3219 o_ptr->ident &= ~(IDENT_BROKEN);
3221 /* Add repaired flag */
3222 o_ptr->discount = 99;
3224 p_ptr->total_weight += o_ptr->weight;
3227 /* Decrease material object */
3228 inven_item_increase(mater, -1);
3229 inven_item_optimize(mater);
3232 p_ptr->update |= PU_BONUS;
3235 /* Something happened */
3240 * @brief アイテム修復処理の過渡ルーチン / Repair broken weapon
3241 * @param bcost 基本鑑定費用
3244 static int repair_broken_weapon(PRICE bcost)
3248 cost = repair_broken_weapon_aux(bcost);
3255 * @brief アイテムの強化を行う。 / Enchant item
3256 * @param cost 1回毎の費用
3257 * @param to_hit 命中をアップさせる量
3258 * @param to_dam ダメージをアップさせる量
3259 * @param to_ac ACをアップさせる量
3260 * @return 実際に行ったらTRUE
3262 static bool enchant_item(PRICE cost, HIT_PROB to_hit, HIT_POINT to_dam, ARMOUR_CLASS to_ac)
3269 int maxenchant = (p_ptr->lev / 5);
3270 char tmp_str[MAX_NLEN];
3273 prt(format(_("現在のあなたの技量だと、+%d まで改良できます。", " Based on your skill, we can improve up to +%d."), maxenchant), 5, 0);
3274 prt(format(_(" 改良の料金は一個につき$%d です。", " The price for the service is %d gold per item."), cost), 7, 0);
3276 q = _("どのアイテムを改良しますか?", "Improve which item? ");
3277 s = _("改良できるものがありません。", "You have nothing to improve.");
3279 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP | IGNORE_BOTHHAND_SLOT));
3280 if (!o_ptr) return (FALSE);
3282 /* Check if the player has enough money */
3283 if (p_ptr->au < (cost * o_ptr->number))
3285 object_desc(tmp_str, o_ptr, OD_NAME_ONLY);
3286 msg_format(_("%sを改良するだけのゴールドがありません!", "You do not have the gold to improve %s!"), tmp_str);
3290 /* Enchant to hit */
3291 for (i = 0; i < to_hit; i++)
3293 if (o_ptr->to_h < maxenchant)
3295 if (enchant(o_ptr, 1, (ENCH_TOHIT | ENCH_FORCE)))
3303 /* Enchant to damage */
3304 for (i = 0; i < to_dam; i++)
3306 if (o_ptr->to_d < maxenchant)
3308 if (enchant(o_ptr, 1, (ENCH_TODAM | ENCH_FORCE)))
3317 for (i = 0; i < to_ac; i++)
3319 if (o_ptr->to_a < maxenchant)
3321 if (enchant(o_ptr, 1, (ENCH_TOAC | ENCH_FORCE)))
3332 if (flush_failure) flush();
3333 msg_print(_("改良に失敗した。", "The improvement failed."));
3338 object_desc(tmp_str, o_ptr, OD_NAME_AND_ENCHANT);
3340 msg_format("$%dで%sに改良しました。", cost * o_ptr->number, tmp_str);
3342 msg_format("Improved into %s for %d gold.", tmp_str, cost * o_ptr->number);
3345 /* Charge the money */
3346 p_ptr->au -= (cost * o_ptr->number);
3348 if (item >= INVEN_RARM) calc_android_exp();
3350 /* Something happened */
3357 * @brief 魔道具の使用回数を回復させる施設のメインルーチン / Recharge rods, wands and staves
3359 * The player can select the number of charges to add\n
3360 * (up to a limit), and the recharge never fails.\n
3362 * The cost for rods depends on the level of the rod. The prices\n
3363 * for recharging wands and staves are dependent on the cost of\n
3367 static void building_recharge(void)
3375 PARAMETER_VALUE charges;
3377 char tmp_str[MAX_NLEN];
3381 /* Display some info */
3383 prt(_(" 再充填の費用はアイテムの種類によります。", " The prices of recharge depend on the type."), 6, 0);
3386 /* Only accept legal items */
3387 item_tester_hook = item_tester_hook_recharge;
3389 q = _("どのアイテムに魔力を充填しますか? ", "Recharge which item? ");
3390 s = _("魔力を充填すべきアイテムがない。", "You have nothing to recharge.");
3392 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
3395 k_ptr = &k_info[o_ptr->k_idx];
3398 * We don't want to give the player free info about
3399 * the level of the item or the number of charges.
3401 /* The item must be "known" */
3402 if (!object_is_known(o_ptr))
3404 msg_format(_("充填する前に鑑定されている必要があります!", "The item must be identified first!"));
3407 if ((p_ptr->au >= 50) &&
3408 get_check(_("$50で鑑定しますか? ", "Identify for 50 gold? ")))
3412 identify_item(o_ptr);
3413 object_desc(tmp_str, o_ptr, 0);
3414 msg_format(_("%s です。", "You have: %s."), tmp_str);
3416 /* Auto-inscription */
3417 autopick_alter_item(item, FALSE);
3419 /* Update the gold display */
3420 building_prt_gold();
3428 /* Extract the object "level" */
3429 lev = k_info[o_ptr->k_idx].level;
3431 /* Price for a rod */
3432 if (o_ptr->tval == TV_ROD)
3434 if (o_ptr->timeout > 0)
3436 /* Fully recharge */
3437 price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
3441 /* No recharge necessary */
3443 msg_format(_("それは再充填する必要はありません。", "That doesn't need to be recharged."));
3447 else if (o_ptr->tval == TV_STAFF)
3449 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3450 price = (k_info[o_ptr->k_idx].cost / 10) * o_ptr->number;
3452 /* Pay at least 10 gold per charge */
3453 price = MAX(10, price);
3457 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3458 price = (k_info[o_ptr->k_idx].cost / 10);
3460 /* Pay at least 10 gold per charge */
3461 price = MAX(10, price);
3464 /* Limit the number of charges for wands and staffs */
3465 if (o_ptr->tval == TV_WAND
3466 && (o_ptr->pval / o_ptr->number >= k_ptr->pval))
3468 if (o_ptr->number > 1)
3470 msg_print(_("この魔法棒はもう充分に充填されています。", "These wands are already fully charged."));
3474 msg_print(_("この魔法棒はもう充分に充填されています。", "This wand is already fully charged."));
3478 else if (o_ptr->tval == TV_STAFF && o_ptr->pval >= k_ptr->pval)
3480 if (o_ptr->number > 1)
3482 msg_print(_("この杖はもう充分に充填されています。", "These staffs are already fully charged."));
3486 msg_print(_("この杖はもう充分に充填されています。", "This staff is already fully charged."));
3491 /* Check if the player has enough money */
3492 if (p_ptr->au < price)
3494 object_desc(tmp_str, o_ptr, OD_NAME_ONLY);
3496 msg_format("%sを再充填するには$%d 必要です!", tmp_str,price );
3498 msg_format("You need %d gold to recharge %s!", price, tmp_str);
3504 if (o_ptr->tval == TV_ROD)
3507 if (get_check(format("そのロッドを$%d で再充填しますか?", price)))
3509 if (get_check(format("Recharge the %s for %d gold? ",
3510 ((o_ptr->number > 1) ? "rods" : "rod"), price)))
3514 /* Recharge fully */
3524 if (o_ptr->tval == TV_STAFF)
3525 max_charges = k_ptr->pval - o_ptr->pval;
3527 max_charges = o_ptr->number * k_ptr->pval - o_ptr->pval;
3529 /* Get the quantity for staves and wands */
3530 charges = (PARAMETER_VALUE)get_quantity(format(_("一回分$%d で何回分充填しますか?", "Add how many charges for %d gold? "), price),
3531 MIN(p_ptr->au / price, max_charges));
3534 if (charges < 1) return;
3536 /* Get the new price */
3540 o_ptr->pval += charges;
3542 /* We no longer think the item is empty */
3543 o_ptr->ident &= ~(IDENT_EMPTY);
3547 object_desc(tmp_str, o_ptr, 0);
3549 msg_format("%sを$%d で再充填しました。", tmp_str, price);
3551 msg_format("%^s %s recharged for %d gold.", tmp_str, ((o_ptr->number > 1) ? "were" : "was"), price);
3553 p_ptr->update |= (PU_COMBINE | PU_REORDER);
3555 p_ptr->window |= (PW_INVEN);
3566 * @brief 魔道具の使用回数を回復させる施設の一括処理向けサブルーチン / Recharge rods, wands and staves
3568 * The player can select the number of charges to add\n
3569 * (up to a limit), and the recharge never fails.\n
3571 * The cost for rods depends on the level of the rod. The prices\n
3572 * for recharging wands and staves are dependent on the cost of\n
3576 static void building_recharge_all(void)
3583 PRICE total_cost = 0;
3586 /* Display some info */
3589 prt(_(" 再充填の費用はアイテムの種類によります。", " The prices of recharge depend on the type."), 6, 0);
3591 /* Calculate cost */
3592 for ( i = 0; i < INVEN_PACK; i++)
3594 o_ptr = &inventory[i];
3596 /* skip non magic device */
3597 if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
3599 /* need identified */
3600 if (!object_is_known(o_ptr)) total_cost += 50;
3602 /* Extract the object "level" */
3603 lev = k_info[o_ptr->k_idx].level;
3605 k_ptr = &k_info[o_ptr->k_idx];
3607 switch (o_ptr->tval)
3610 price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
3614 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3615 price = (k_info[o_ptr->k_idx].cost / 10) * o_ptr->number;
3617 /* Pay at least 10 gold per charge */
3618 price = MAX(10, price);
3621 price = (k_ptr->pval - o_ptr->pval) * price;
3625 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3626 price = (k_info[o_ptr->k_idx].cost / 10);
3628 /* Pay at least 10 gold per charge */
3629 price = MAX(10, price);
3632 price = (o_ptr->number * k_ptr->pval - o_ptr->pval) * price;
3636 /* if price <= 0 then item have enough charge */
3637 if (price > 0) total_cost += price;
3642 msg_print(_("充填する必要はありません。", "No need to recharge."));
3647 /* Check if the player has enough money */
3648 if (p_ptr->au < total_cost)
3650 msg_format(_("すべてのアイテムを再充填するには$%d 必要です!", "You need %d gold to recharge all items!"), total_cost );
3654 if (!get_check(format(_("すべてのアイテムを $%d で再充填しますか?", "Recharge all items for %d gold? "), total_cost))) return;
3656 for (i = 0; i < INVEN_PACK; i++)
3658 o_ptr = &inventory[i];
3659 k_ptr = &k_info[o_ptr->k_idx];
3661 /* skip non magic device */
3662 if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
3664 if (!object_is_known(o_ptr))
3666 identify_item(o_ptr);
3668 /* Auto-inscription */
3669 autopick_alter_item(i, FALSE);
3673 switch (o_ptr->tval)
3679 if (o_ptr->pval < k_ptr->pval) o_ptr->pval = k_ptr->pval;
3680 /* We no longer think the item is empty */
3681 o_ptr->ident &= ~(IDENT_EMPTY);
3684 if (o_ptr->pval < o_ptr->number * k_ptr->pval)
3685 o_ptr->pval = o_ptr->number * k_ptr->pval;
3686 /* We no longer think the item is empty */
3687 o_ptr->ident &= ~(IDENT_EMPTY);
3693 msg_format(_("$%d で再充填しました。", "You pay %d gold."), total_cost);
3695 p_ptr->update |= (PU_COMBINE | PU_REORDER);
3697 p_ptr->window |= (PW_INVEN);
3700 p_ptr->au -= total_cost;
3707 * @brief 町間のテレポートを行うメインルーチン。
3708 * @return テレポート処理を決定したか否か
3710 bool tele_town(void)
3716 if (current_floor_ptr->dun_level)
3718 msg_print(_("この魔法は地上でしか使えない!", "This spell can only be used on the surface!"));
3722 if (p_ptr->inside_arena || p_ptr->inside_battle)
3724 msg_print(_("この魔法は外でしか使えない!", "This spell can only be used outside!"));
3731 for (i = 1; i < max_towns; i++)
3735 if ((i == NO_TOWN) || (i == SECRET_TOWN) || (i == p_ptr->town_num) || !(p_ptr->visit & (1L << (i - 1)))) continue;
3737 sprintf(buf, "%c) %-20s", I2A(i - 1), town_info[i].name);
3744 msg_print(_("まだ行けるところがない。", "You have not yet visited any town."));
3750 prt(_("どこに行きますか:", "Which town you go: "), 0, 0);
3760 else if ((i < 'a') || (i > ('a'+max_towns-2))) continue;
3761 else if (((i-'a'+1) == p_ptr->town_num) || ((i-'a'+1) == NO_TOWN) || ((i-'a'+1) == SECRET_TOWN) || !(p_ptr->visit & (1L << (i-'a')))) continue;
3765 for (y = 0; y < current_world_ptr->max_wild_y; y++)
3767 for (x = 0; x < current_world_ptr->max_wild_x; x++)
3769 if(wilderness[y][x].town == (i-'a'+1))
3771 p_ptr->wilderness_y = y;
3772 p_ptr->wilderness_x = x;
3777 p_ptr->leaving = TRUE;
3779 p_ptr->teleport_town = TRUE;
3785 * @brief 施設でモンスターの情報を知るメインルーチン / research_mon -KMW-
3786 * @return 常にTRUEを返す。
3787 * @todo 返り値が意味不明なので直した方が良いかもしれない。
3789 static bool research_mon(void)
3797 bool recall = FALSE;
3801 /* XTRA HACK WHATSEARCH */
3807 /* XTRA HACK REMEMBER_IDX */
3808 static int old_sym = '\0';
3809 static IDX old_i = 0;
3813 /* Get a character, or abort */
3814 if (!get_com(_("モンスターの文字を入力して下さい(記号 or ^A全,^Uユ,^N非ユ,^M名前):",
3815 "Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): "), &sym, FALSE))
3823 /* Find that character info, and describe it */
3824 for (i = 0; ident_info[i]; ++i)
3826 if (sym == ident_info[i][0]) break;
3829 /* XTRA HACK WHATSEARCH */
3830 if (sym == KTRL('A'))
3833 strcpy(buf, _("全モンスターのリスト", "Full monster list."));
3835 else if (sym == KTRL('U'))
3838 strcpy(buf, _("ユニーク・モンスターのリスト", "Unique monster list."));
3840 else if (sym == KTRL('N'))
3843 strcpy(buf, _("ユニーク外モンスターのリスト", "Non-unique monster list."));
3845 else if (sym == KTRL('M'))
3848 if (!get_string(_("名前(英語の場合小文字で可)", "Enter name:"),temp, 70))
3855 sprintf(buf, _("名前:%sにマッチ", "Monsters with a name \"%s\""),temp);
3857 else if (ident_info[i])
3859 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
3863 sprintf(buf, "%c - %s", sym, _("無効な文字", "Unknown Symbol"));
3866 /* Display the result */
3869 /* Allocate the "who" array */
3870 C_MAKE(who, max_r_idx, MONRACE_IDX);
3872 /* Collect matching monsters */
3873 for (n = 0, i = 1; i < max_r_idx; i++)
3875 monster_race *r_ptr = &r_info[i];
3878 if (!r_ptr->name) continue;
3880 /* XTRA HACK WHATSEARCH */
3881 /* Require non-unique monsters if needed */
3882 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
3884 /* Require unique monsters if needed */
3885 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
3893 for (xx = 0; temp[xx] && xx < 80; xx++)
3896 if (iskanji(temp[xx]))
3902 if (isupper(temp[xx])) temp[xx] = (char)tolower(temp[xx]);
3906 strcpy(temp2, r_name + r_ptr->E_name);
3908 strcpy(temp2, r_name + r_ptr->name);
3910 for (xx = 0; temp2[xx] && xx < 80; xx++)
3911 if (isupper(temp2[xx])) temp2[xx] = (char)tolower(temp2[xx]);
3914 if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
3916 if (my_strstr(temp2, temp))
3920 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
3923 /* Nothing to recall */
3926 /* Free the "who" array */
3927 C_KILL(who, max_r_idx, MONRACE_IDX);
3937 /* Sort if needed */
3940 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
3944 /* Start at the end */
3945 /* XTRA HACK REMEMBER_IDX */
3946 if (old_sym == sym && old_i < n) i = old_i;
3951 /* Scan the monster memory */
3954 /* Extract a race */
3957 /* Hack -- Begin the prompt */
3960 /* Hack -- Complete the prompt */
3961 Term_addstr(-1, TERM_WHITE, _(" ['r'思い出, ' 'で続行, ESC]", " [(r)ecall, ESC, space to continue]"));
3969 /*** Recall on screen ***/
3971 /* Get maximal info about this monster */
3972 lore_do_probe(r_idx);
3974 /* Save this monster ID */
3975 monster_race_track(r_idx);
3978 /* know every thing mode */
3979 screen_roff(r_idx, 0x01);
3982 /* XTRA HACK REMEMBER_IDX */
3990 /* Normal commands */
3991 if (query != 'r') break;
3998 if (query == ESCAPE) break;
4000 /* Move to "prev" monster */
4006 if (!expand_list) break;
4010 /* Move to "next" monster */
4016 if (!expand_list) break;
4022 /* Re-display the identity */
4023 /* prt(buf, 5, 5);*/
4025 /* Free the "who" array */
4026 C_KILL(who, max_r_idx, MONRACE_IDX);
4029 return (!notpicked);
4034 * @brief 施設の処理実行メインルーチン / Execute a building command
4035 * @param bldg 施設構造体の参照ポインタ
4036 * @param i 実行したい施設のサービステーブルの添字
4039 static void bldg_process_command(building_type *bldg, int i)
4041 BACT_IDX bact = bldg->actions[i];
4049 bcost = bldg->member_costs[i];
4051 bcost = bldg->other_costs[i];
4053 /* action restrictions */
4054 if (((bldg->action_restr[i] == 1) && !is_member(bldg)) ||
4055 ((bldg->action_restr[i] == 2) && !is_owner(bldg)))
4057 msg_print(_("それを選択する権利はありません!", "You have no right to choose that!"));
4061 /* check gold (HACK - Recharge uses variable costs) */
4062 if ((bact != BACT_RECHARGE) &&
4063 (((bldg->member_costs[i] > p_ptr->au) && is_owner(bldg)) ||
4064 ((bldg->other_costs[i] > p_ptr->au) && !is_owner(bldg))))
4066 msg_print(_("お金が足りません!", "You do not have the gold!"));
4075 case BACT_RESEARCH_ITEM:
4076 paid = identify_fully(FALSE);
4078 case BACT_TOWN_HISTORY:
4081 case BACT_RACE_LEGENDS:
4087 case BACT_KING_LEGENDS:
4088 case BACT_ARENA_LEGENDS:
4093 case BACT_ARENA_RULES:
4097 case BACT_IN_BETWEEN:
4099 case BACT_SPIN_WHEEL:
4100 case BACT_DICE_SLOTS:
4101 case BACT_GAMBLE_RULES:
4108 paid = inn_comm(bact);
4110 case BACT_RESEARCH_MONSTER:
4111 paid = research_mon();
4113 case BACT_COMPARE_WEAPONS:
4115 bcost = compare_weapons(bcost);
4117 case BACT_ENCHANT_WEAPON:
4118 item_tester_hook = object_allow_enchant_melee_weapon;
4119 enchant_item(bcost, 1, 1, 0);
4121 case BACT_ENCHANT_ARMOR:
4122 item_tester_hook = object_is_armour;
4123 enchant_item(bcost, 0, 0, 1);
4126 building_recharge();
4128 case BACT_RECHARGE_ALL:
4129 building_recharge_all();
4131 case BACT_IDENTS: /* needs work */
4132 if (!get_check(_("持ち物を全て鑑定してよろしいですか?", "Do you pay for identify all your possession? "))) break;
4134 msg_print(_(" 持ち物全てが鑑定されました。", "Your possessions have been identified."));
4137 case BACT_IDENT_ONE: /* needs work */
4138 paid = ident_spell(FALSE);
4143 case BACT_HEALING: /* needs work */
4144 paid = cure_critical_wounds(200);
4146 case BACT_RESTORE: /* needs work */
4147 paid = restore_all_status();
4149 case BACT_ENCHANT_ARROWS:
4150 item_tester_hook = item_tester_hook_ammo;
4151 enchant_item(bcost, 1, 1, 0);
4153 case BACT_ENCHANT_BOW:
4154 item_tester_tval = TV_BOW;
4155 enchant_item(bcost, 1, 1, 0);
4159 if (recall_player(p_ptr, 1)) paid = TRUE;
4162 case BACT_TELEPORT_LEVEL:
4164 paid = free_level_recall(p_ptr);
4167 case BACT_LOSE_MUTATION:
4168 if (p_ptr->muta1 || p_ptr->muta2 || (p_ptr->muta3 & ~MUT3_GOOD_LUCK) ||
4169 (p_ptr->pseikaku != SEIKAKU_LUCKY && (p_ptr->muta3 & MUT3_GOOD_LUCK)))
4171 while(!lose_mutation(0));
4176 msg_print(_("治すべき突然変異が無い。", "You have no mutations."));
4185 case BACT_TSUCHINOKO:
4202 msg_print(_("平衡化の儀式を行なった。", "You received an equalization ritual."));
4203 set_virtue(V_COMPASSION, 0);
4204 set_virtue(V_HONOUR, 0);
4205 set_virtue(V_JUSTICE, 0);
4206 set_virtue(V_SACRIFICE, 0);
4207 set_virtue(V_KNOWLEDGE, 0);
4208 set_virtue(V_FAITH, 0);
4209 set_virtue(V_ENLIGHTEN, 0);
4210 set_virtue(V_ENCHANT, 0);
4211 set_virtue(V_CHANCE, 0);
4212 set_virtue(V_NATURE, 0);
4213 set_virtue(V_HARMONY, 0);
4214 set_virtue(V_VITALITY, 0);
4215 set_virtue(V_UNLIFE, 0);
4216 set_virtue(V_PATIENCE, 0);
4217 set_virtue(V_TEMPERANCE, 0);
4218 set_virtue(V_DILIGENCE, 0);
4219 set_virtue(V_VALOUR, 0);
4220 set_virtue(V_INDIVIDUALISM, 0);
4225 case BACT_TELE_TOWN:
4230 paid = eval_ac(p_ptr->dis_ac + p_ptr->dis_to_a);
4233 case BACT_BROKEN_WEAPON:
4235 bcost = repair_broken_weapon(bcost);
4246 * @brief クエスト入り口にプレイヤーが乗った際の処理 / Do building commands
4249 void do_cmd_quest(void)
4251 if(p_ptr->wild_mode) return;
4253 take_turn(p_ptr, 100);
4255 if (!cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_QUEST_ENTER))
4257 msg_print(_("ここにはクエストの入口はない。", "You see no quest level here."));
4262 msg_print(_("ここにはクエストへの入口があります。", "There is an entry of a quest."));
4263 if (!get_check(_("クエストに入りますか?", "Do you enter? "))) return;
4264 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
4265 msg_print(_("『とにかく入ってみようぜぇ。』", ""));
4266 else if(p_ptr->pseikaku == SEIKAKU_CHARGEMAN) msg_print("『全滅してやるぞ!』");
4268 /* Player enters a new quest */
4272 leave_quest_check();
4274 if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM) current_floor_ptr->dun_level = 1;
4275 p_ptr->inside_quest = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].special;
4277 p_ptr->leaving = TRUE;
4283 * @brief 施設入り口にプレイヤーが乗った際の処理 / Do building commands
4286 void do_cmd_bldg(void)
4291 building_type *bldg;
4293 if(p_ptr->wild_mode) return;
4295 take_turn(p_ptr, 100);
4297 if (!cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_BLDG))
4299 msg_print(_("ここには建物はない。", "You see no building here."));
4303 which = f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat].subtype;
4305 bldg = &building[which];
4307 /* Don't re-init the wilderness */
4308 reinit_wilderness = FALSE;
4310 if ((which == 2) && (p_ptr->arena_number < 0))
4312 msg_print(_("「敗者に用はない。」", "'There's no place here for a LOSER like you!'"));
4315 else if ((which == 2) && p_ptr->inside_arena)
4317 if (!p_ptr->exit_bldg && m_cnt > 0)
4319 prt(_("ゲートは閉まっている。モンスターがあなたを待っている!", "The gates are closed. The monster awaits!"), 0, 0);
4323 /* Don't save the arena as saved floor */
4324 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_NO_RETURN);
4326 p_ptr->inside_arena = FALSE;
4327 p_ptr->leaving = TRUE;
4329 /* Re-enter the arena */
4330 command_new = SPECIAL_KEY_BUILDING;
4332 /* No energy needed to re-enter the arena */
4338 else if (p_ptr->inside_battle)
4340 /* Don't save the arena as saved floor */
4341 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_NO_RETURN);
4343 p_ptr->leaving = TRUE;
4344 p_ptr->inside_battle = FALSE;
4346 /* Re-enter the monster arena */
4347 command_new = SPECIAL_KEY_BUILDING;
4349 /* No energy needed to re-enter the arena */
4356 p_ptr->oldpy = p_ptr->y;
4357 p_ptr->oldpx = p_ptr->x;
4363 /* Hack -- Increase "icky" depth */
4370 show_building(bldg);
4373 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_BUILD);
4380 building_prt_gold();
4384 if (command == ESCAPE)
4387 p_ptr->inside_arena = FALSE;
4388 p_ptr->inside_battle = FALSE;
4392 for (i = 0; i < 8; i++)
4394 if (bldg->letters[i])
4396 if (bldg->letters[i] == command)
4404 if(validcmd) bldg_process_command(bldg, i);
4409 select_floor_music();
4414 /* Reinit wilderness to activate quests ... */
4415 if (reinit_wilderness)
4417 p_ptr->leaving = TRUE;
4420 /* Hack -- Decrease "icky" depth */
4425 p_ptr->update |= (PU_VIEW | PU_MONSTERS | PU_BONUS | PU_LITE | PU_MON_LITE);
4426 p_ptr->redraw |= (PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
4427 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);