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 "object-hook.h"
18 #include "monsterrace-hook.h"
27 #include "cmd-spell.h"
29 #include "player-status.h"
30 #include "spells-status.h"
33 * ループ中で / hack as in leave_store in store.c
35 static bool leave_bldg = FALSE;
38 * @brief 施設毎に設定された種族、職業、魔法領域フラグがプレイヤーと一致するかを判定する。
39 * @details 各種ギルドや寺院など、特定の職業ならば優遇措置を得られる施設、
40 * あるいは食堂など特定の種族では利用できない施設の判定処理を行う。
41 * @param bldg 施設構造体の参照ポインタ
42 * @return 種族、職業、魔法領域のいずれかが一致しているかの是非。
44 static bool is_owner(building_type *bldg)
46 if (bldg->member_class[p_ptr->pclass] == BUILDING_OWNER)
51 if (bldg->member_race[p_ptr->prace] == BUILDING_OWNER)
56 if ((is_magic(p_ptr->realm1) && (bldg->member_realm[p_ptr->realm1] == BUILDING_OWNER)) ||
57 (is_magic(p_ptr->realm2) && (bldg->member_realm[p_ptr->realm2] == BUILDING_OWNER)))
66 * @brief 施設毎に設定された種族、職業、魔法領域フラグがプレイヤーと一致するかを判定する。
68 * @details 各種ギルドや寺院など、特定の職業ならば優遇措置を得られる施設、
69 * あるいは食堂など特定の種族では利用できない施設の判定処理を行う。
70 * @param bldg 施設構造体の参照ポインタ
71 * @return 種族、職業、魔法領域のいずれかが一致しているかの是非。
72 * @todo is_owner()との実質的な多重実装なので、リファクタリングを行うべきである。
74 static bool is_member(building_type *bldg)
76 if (bldg->member_class[p_ptr->pclass])
81 if (bldg->member_race[p_ptr->prace])
86 if ((is_magic(p_ptr->realm1) && bldg->member_realm[p_ptr->realm1]) ||
87 (is_magic(p_ptr->realm2) && bldg->member_realm[p_ptr->realm2]))
93 if (p_ptr->pclass == CLASS_SORCERER)
97 for (i = 0; i < MAX_MAGIC; i++)
99 if (bldg->member_realm[i+1]) OK = TRUE;
107 * @brief コンソールに表示された施設に関する情報を消去する / Clear the building information
108 * @details 消去は行毎にヌル文字列で行われる。
109 * @param min_row 開始行番号
110 * @param max_row 末尾行番号
113 static void clear_bldg(int min_row, int max_row)
117 for (i = min_row; i <= max_row; i++)
125 static void building_prt_gold(void)
128 prt(_("手持ちのお金: ", "Gold Remaining: "), 23,53);
129 sprintf(tmp_str, "%9ld", (long)p_ptr->au);
130 prt(tmp_str, 23, 68);
134 * @brief 施設のサービス一覧を表示する / Display a building.
135 * @param bldg 施設構造体の参照ポインタ
138 static void show_building(building_type* bldg)
146 sprintf(tmp_str, "%s (%s) %35s", bldg->owner_name, bldg->owner_race, bldg->name);
150 for (i = 0; i < 8; i++)
152 if (bldg->letters[i])
154 if (bldg->action_restr[i] == 0)
156 if ((is_owner(bldg) && (bldg->member_costs[i] == 0)) ||
157 (!is_owner(bldg) && (bldg->other_costs[i] == 0)))
159 action_color = TERM_WHITE;
162 else if (is_owner(bldg))
164 action_color = TERM_YELLOW;
165 sprintf(buff, _("($%ld)", "(%ldgp)"), (long int)bldg->member_costs[i]);
169 action_color = TERM_YELLOW;
170 sprintf(buff, _("($%ld)", "(%ldgp)"), (long int)bldg->other_costs[i]); }
172 else if (bldg->action_restr[i] == 1)
174 if (!is_member(bldg))
176 action_color = TERM_L_DARK;
177 strcpy(buff, _("(閉店)", "(closed)"));
179 else if ((is_owner(bldg) && (bldg->member_costs[i] == 0)) ||
180 (is_member(bldg) && (bldg->other_costs[i] == 0)))
182 action_color = TERM_WHITE;
185 else if (is_owner(bldg))
187 action_color = TERM_YELLOW;
188 sprintf(buff, _("($%ld)", "(%ldgp)"), (long int)bldg->member_costs[i]);
192 action_color = TERM_YELLOW;
193 sprintf(buff, _("($%ld)", "(%ldgp)"), (long int)bldg->other_costs[i]);
200 action_color = TERM_L_DARK;
201 strcpy(buff, _("(閉店)", "(closed)"));
203 else if (bldg->member_costs[i] != 0)
205 action_color = TERM_YELLOW;
206 sprintf(buff, _("($%ld)", "(%ldgp)"), (long int)bldg->member_costs[i]);
210 action_color = TERM_WHITE;
215 sprintf(tmp_str," %c) %s %s", bldg->letters[i], bldg->act_names[i], buff);
216 c_put_str(action_color, tmp_str, 19+(i/2), 35*(i%2));
219 prt(_(" ESC) 建物を出る", " ESC) Exit building"), 23, 0);
223 * @brief 闘技場に入るコマンドの処理 / arena commands
224 * @param cmd 闘技場処理のID
227 static void arena_comm(int cmd)
236 if (p_ptr->arena_number == MAX_ARENA_MONS)
239 prt(_("アリーナの優勝者!", " Arena Victor!"), 5, 0);
240 prt(_("おめでとう!あなたは全ての敵を倒しました。", "Congratulations! You have defeated all before you."), 7, 0);
241 prt(_("賞金として $1,000,000 が与えられます。", "For that, receive the prize: 1,000,000 gold pieces"), 8, 0);
245 p_ptr->au += 1000000L;
246 msg_print(_("スペースキーで続行", "Press the space bar to continue"));
248 p_ptr->arena_number++;
250 else if (p_ptr->arena_number > MAX_ARENA_MONS)
252 if (p_ptr->arena_number < MAX_ARENA_MONS+2)
254 msg_print(_("君のために最強の挑戦者を用意しておいた。", "The strongest challenger is waiting for you."));
256 if (get_check(_("挑戦するかね?", "Do you fight? ")))
258 msg_print(_("死ぬがよい。", "Die, maggots."));
261 p_ptr->exit_bldg = FALSE;
264 /* Save the surface floor as saved floor */
265 prepare_change_floor_mode(CFM_SAVE_FLOORS);
267 p_ptr->inside_arena = TRUE;
268 p_ptr->leaving = TRUE;
273 msg_print(_("残念だ。", "We are disappointed."));
278 msg_print(_("あなたはアリーナに入り、しばらくの間栄光にひたった。",
279 "You enter the arena briefly and bask in your glory."));
283 else if (p_ptr->riding && (p_ptr->pclass != CLASS_BEASTMASTER) && (p_ptr->pclass != CLASS_CAVALRY))
285 msg_print(_("ペットに乗ったままではアリーナへ入れさせてもらえなかった。",
286 "You don't have permission to enter with pet."));
291 p_ptr->exit_bldg = FALSE;
294 /* Save the surface floor as saved floor */
295 prepare_change_floor_mode(CFM_SAVE_FLOORS);
297 p_ptr->inside_arena = TRUE;
298 p_ptr->leaving = TRUE;
303 if (p_ptr->arena_number == MAX_ARENA_MONS)
304 msg_print(_("あなたは勝利者だ。 アリーナでのセレモニーに参加しなさい。",
305 "You are victorious. Enter the arena for the ceremony."));
307 else if (p_ptr->arena_number > MAX_ARENA_MONS)
309 msg_print(_("あなたはすべての敵に勝利した。", "You have won against all foes."));
313 r_ptr = &r_info[arena_info[p_ptr->arena_number].r_idx];
314 name = (r_name + r_ptr->name);
315 msg_format(_("%s に挑戦するものはいないか?", "Do I hear any challenges against: %s"), name);
317 p_ptr->monster_race_idx = arena_info[p_ptr->arena_number].r_idx;
318 p_ptr->window |= (PW_MONSTER);
323 case BACT_ARENA_RULES:
326 /* Peruse the arena help file */
327 (void)show_file(TRUE, _("arena_j.txt", "arena.txt"), NULL, 0, 0);
335 * @brief カジノのスロットシンボルを表示する / display fruit for dice slots
336 * @param row シンボルを表示する行の上端
337 * @param col シンボルを表示する行の左端
338 * @param fruit 表示するシンボルID
341 static void display_fruit(int row, int col, int fruit)
346 c_put_str(TERM_YELLOW, " ####.", row, col);
347 c_put_str(TERM_YELLOW, " # #", row + 1, col);
348 c_put_str(TERM_YELLOW, " # #", row + 2, col);
349 c_put_str(TERM_YELLOW, "# #", row + 3, col);
350 c_put_str(TERM_YELLOW, "# #", row + 4, col);
351 c_put_str(TERM_YELLOW, "# # ", row + 5, col);
352 c_put_str(TERM_YELLOW, "# # ", row + 6, col);
353 c_put_str(TERM_YELLOW, ".#### ", row + 7, col);
355 " Lemon "), row + 8, col);
358 c_put_str(TERM_ORANGE, " ## ", row, col);
359 c_put_str(TERM_ORANGE, " #..# ", row + 1, col);
360 c_put_str(TERM_ORANGE, " #....# ", row + 2, col);
361 c_put_str(TERM_ORANGE, "#......#", row + 3, col);
362 c_put_str(TERM_ORANGE, "#......#", row + 4, col);
363 c_put_str(TERM_ORANGE, " #....# ", row + 5, col);
364 c_put_str(TERM_ORANGE, " #..# ", row + 6, col);
365 c_put_str(TERM_ORANGE, " ## ", row + 7, col);
367 " Orange "), row + 8, col);
370 c_put_str(TERM_SLATE, _(" Λ ", " /\\ ") , row, col);
371 c_put_str(TERM_SLATE, _(" || ", " ## ") , row + 1, col);
372 c_put_str(TERM_SLATE, _(" || ", " ## ") , row + 2, col);
373 c_put_str(TERM_SLATE, _(" || ", " ## ") , row + 3, col);
374 c_put_str(TERM_SLATE, _(" || ", " ## ") , row + 4, col);
375 c_put_str(TERM_SLATE, _(" || ", " ## ") , row + 5, col);
376 c_put_str(TERM_UMBER, _(" |=亜=| ", " ###### ") , row + 6, col);
377 c_put_str(TERM_UMBER, _(" 目 ", " ## ") , row + 7, col);
378 prt( _(" 剣 ", " Sword ") , row + 8, col);
381 c_put_str(TERM_SLATE, " ###### ", row, col);
382 c_put_str(TERM_SLATE, "# #", row + 1, col);
383 c_put_str(TERM_SLATE, "# ++++ #", row + 2, col);
384 c_put_str(TERM_SLATE, "# +==+ #", row + 3, col);
385 c_put_str(TERM_SLATE, "# ++ #", row + 4, col);
386 c_put_str(TERM_SLATE, " # # ", row + 5, col);
387 c_put_str(TERM_SLATE, " # # ", row + 6, col);
388 c_put_str(TERM_SLATE, " ## ", row + 7, col);
390 " Shield "), row + 8, col);
393 c_put_str(TERM_VIOLET, " ## ", row, col);
394 c_put_str(TERM_VIOLET, " ###### ", row + 1, col);
395 c_put_str(TERM_VIOLET, "########", row + 2, col);
396 c_put_str(TERM_VIOLET, "########", row + 3, col);
397 c_put_str(TERM_VIOLET, "########", row + 4, col);
398 c_put_str(TERM_VIOLET, " ###### ", row + 5, col);
399 c_put_str(TERM_VIOLET, " #### ", row + 6, col);
400 c_put_str(TERM_VIOLET, " ## ", row + 7, col);
402 " Plum "), row + 8, col);
405 c_put_str(TERM_RED, " ##", row, col);
406 c_put_str(TERM_RED, " ### ", row + 1, col);
407 c_put_str(TERM_RED, " #..# ", row + 2, col);
408 c_put_str(TERM_RED, " #..# ", row + 3, col);
409 c_put_str(TERM_RED, " ###### ", row + 4, col);
410 c_put_str(TERM_RED, "#..##..#", row + 5, col);
411 c_put_str(TERM_RED, "#..##..#", row + 6, col);
412 c_put_str(TERM_RED, " ## ## ", row + 7, col);
414 " Cherry "), row + 8, col);
420 * kpoker no (tyuto-hannpa na)pakuri desu...
421 * joker ha shineru node haitte masen.
423 * TODO: donataka! tsukutte!
424 * - agatta yaku no kiroku (like DQ).
425 * - kakkoii card no e.
426 * - sousa-sei no koujyo.
427 * - code wo wakariyasuku.
429 * - Joker... -- done.
432 * 9/15/2000 joker wo jissou. soreto, code wo sukosi kakikae. --Habu
435 #define SUIT_OF(card) ((card) / 13) /*!< トランプカードのスートを返す */
436 #define NUM_OF(card) ((card) % 13) /*!< トランプカードの番号を返す */
437 #define IS_JOKER(card) ((card) == 52) /*!< トランプカードがジョーカーかどうかを返す */
439 static int cards[5]; /*!< ポーカーの現在の手札ID */
446 static void reset_deck(int deck[])
449 for (i = 0; i < 53; i++) deck[i] = i;
452 for (i = 0; i < 53; i++){
453 int tmp1 = randint0(53 - i) + i;
455 deck[i] = deck[tmp1];
461 * @brief ポーカープレイ中にジョーカーを持っているかの判定を返す。
462 * @return ジョーカーを持っているか。
464 static bool have_joker(void)
468 for (i = 0; i < 5; i++){
469 if(IS_JOKER(cards[i])) return TRUE;
475 * @brief ポーカーの手札に該当の番号の札があるかを返す。
476 * @param num 探したいカードの番号。
477 * @return 該当の番号が手札にあるか。
479 static bool find_card_num(int num)
482 for (i = 0; i < 5; i++)
483 if (NUM_OF(cards[i]) == num && !IS_JOKER(cards[i])) return TRUE;
488 * @brief ポーカーの手札がフラッシュ役を得ているかを帰す。
491 static bool yaku_check_flush(void)
494 bool joker_is_used = FALSE;
496 suit = IS_JOKER(cards[0]) ? SUIT_OF(cards[1]) : SUIT_OF(cards[0]);
497 for (i = 0; i < 5; i++){
498 if (SUIT_OF(cards[i]) != suit){
499 if(have_joker() && !joker_is_used)
500 joker_is_used = TRUE;
510 * @brief ポーカーの手札がストレートを含んだ高位の役を得ているかを帰す。
511 * @return 役の判定結果 0…ストレート、フラッシュいずれもなし/1…ストレートのみ/2…ストレートフラッシュ/3…ロイヤルストレートフラッシュ
513 static int yaku_check_straight(void)
516 bool joker_is_used = FALSE;
517 bool straight = FALSE;
520 for (i = 0; i < 5; i++)
522 if (NUM_OF(cards[i]) < lowest && !IS_JOKER(cards[i]))
523 lowest = NUM_OF(cards[i]);
526 /* Check Royal Straight Flush */
527 if (yaku_check_flush())
530 for (i = 0; i < 4; i++)
532 if (!find_card_num(9 + i)){
533 if( have_joker() && !joker_is_used )
534 joker_is_used = TRUE;
539 if (i == 4) return 3; /* Wow! Royal Straight Flush!!! */
542 for (i = 0; i < 3; i++)
544 if (!find_card_num(10 + i))
547 if (i == 3 && have_joker()) return 3; /* Wow! Royal Straight Flush!!! */
551 joker_is_used = FALSE;
553 /* Straight Only Check */
555 if (lowest == 0) { /* (10 - J - Q - K)[JOKER] - A */
556 for (i = 0; i < 4; i++)
558 if (!find_card_num(9 + i)) {
559 if (have_joker() && !joker_is_used)
560 joker_is_used = TRUE;
565 if(i == 4) straight = TRUE;
568 joker_is_used = FALSE;
570 for (i = 0; i < 5; i++)
572 if(!find_card_num(lowest + i)){
573 if( have_joker() && !joker_is_used )
574 joker_is_used = TRUE;
579 if(i == 5) straight = TRUE;
581 if (straight && yaku_check_flush()) return 2; /* Straight Flush */
582 else if(straight) return 1; /* Only Straight */
587 * @brief ポーカーのペア役の状態を返す。
588 * @return 0:nopair 1:1 pair 2:2 pair 3:3 cards 4:full house 6:4cards
590 static int yaku_check_pair(void)
592 int i, i2, matching = 0;
594 for (i = 0; i < 5; i++)
596 for (i2 = i+1; i2 < 5; i2++)
598 if (IS_JOKER(cards[i]) || IS_JOKER(cards[i2])) continue;
599 if (NUM_OF(cards[i]) == NUM_OF(cards[i2]))
630 #define ODDS_5A 3000 /*!< ファイブエースの役倍率 */
631 #define ODDS_5C 400 /*!< ファイブカードの役倍率 */
632 #define ODDS_RF 200 /*!< ロイヤルストレートフラッシュの役倍率 */
633 #define ODDS_SF 80 /*!< ストレートフラッシュの役倍率 */
634 #define ODDS_4C 16 /*!< フォアカードの役倍率 */
635 #define ODDS_FH 12 /*!< フルハウスの役倍率 */
636 #define ODDS_FL 8 /*!< フラッシュの役倍率 */
637 #define ODDS_ST 4 /*!< ストレートの役倍率 */
638 #define ODDS_3C 1 /*!< スリーカードの役倍率 */
639 #define ODDS_2P 1 /*!< ツーペアの役倍率 */
642 * @brief ポーカーの役をチェックし、その結果を画面に表示しつつ結果を返す。
645 static int yaku_check(void)
649 switch(yaku_check_straight()){
651 c_put_str(TERM_YELLOW, _("ロイヤルストレートフラッシュ", "Royal Flush"), 4, 3);
654 c_put_str(TERM_YELLOW, _("ストレートフラッシュ", "Straight Flush"), 4, 3);
657 c_put_str(TERM_YELLOW, _("ストレート", "Straight"), 4, 3);
660 /* Not straight -- fall through */
664 if (yaku_check_flush())
666 c_put_str(TERM_YELLOW, _("フラッシュ", "Flush"), 4, 3);
670 switch (yaku_check_pair())
673 c_put_str(TERM_YELLOW, _("ワンペア", "One pair"), 4, 3);
676 c_put_str(TERM_YELLOW, _("ツーペア", "Two pair"), 4, 3);
679 c_put_str(TERM_YELLOW, _("スリーカード", "Three of a kind"), 4, 3);
682 c_put_str(TERM_YELLOW, _("フルハウス", "Full house"), 4, 3);
685 c_put_str(TERM_YELLOW, _("フォーカード", "Four of a kind"), 4, 3);
688 if (!NUM_OF(cards[0]) && !NUM_OF(cards[1]))
690 c_put_str(TERM_YELLOW, _("ファイブエース", "Five ace"), 4, 3);
695 c_put_str(TERM_YELLOW, _("ファイブカード", "Five of a kind"), 4, 3);
705 * @brief ポーカーの捨てる/残すインターフェイスの表示を更新する。
706 * @param hoge カーソルの現在位置
707 * @param kaeruka カードの捨てる/残すフラグ配列
710 static void display_kaeruka(int hoge, int kaeruka[])
713 char col = TERM_WHITE;
714 for (i = 0; i < 5; i++)
716 if (i == hoge) col = TERM_YELLOW;
717 else if(kaeruka[i]) col = TERM_WHITE;
718 else col = TERM_L_BLUE;
721 c_put_str(col, _("かえる", "Change"), 14, 5+i*16);
723 c_put_str(col, _("のこす", " Stay "), 14, 5+i*16);
725 if (hoge > 4) col = TERM_YELLOW;
726 else col = TERM_WHITE;
727 c_put_str(col, _("決定", "Sure"), 16, 38);
729 /* Hilite current option */
730 if (hoge < 5) move_cursor(14, 5+hoge*16);
731 else move_cursor(16, 38);
735 * @brief ポーカーの手札を表示する。
738 static void display_cards(void)
741 char suitcolor[4] = {TERM_YELLOW, TERM_L_RED, TERM_L_BLUE, TERM_L_GREEN};
743 concptr suit[4] = {"★", "●", "¶", "†"};
744 concptr card_grph[13][7] = {{"A %s ",
835 concptr joker_grph[7] = { " ",
845 concptr suit[4] = {"[]", "qp", "<>", "db"};
846 concptr card_grph[13][7] = {{"A %s ",
937 concptr joker_grph[7] = { " ",
946 for (i = 0; i < 5; i++)
948 prt(_("┏━━━━━━┓", " +------------+ "), 5, i*16);
951 for (i = 0; i < 5; i++)
953 for (j = 0; j < 7; j++)
955 prt(_("┃", " |"), j+6, i*16);
956 if(IS_JOKER(cards[i]))
957 c_put_str(TERM_VIOLET, joker_grph[j], j+6, 2+i*16);
959 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);
960 prt(_("┃", "| "), j+6, i*16+14);
963 for (i = 0; i < 5; i++)
965 prt(_("┗━━━━━━┛", " +------------+ "), 13, i*16);
970 * @brief ポーカーの1プレイルーチン。
973 static int do_poker(void)
977 int deck[53]; /* yamafuda : 0...52 */
979 int kaeruka[5]; /* 0:kaenai 1:kaeru */
987 for (i = 0; i < 5; i++)
989 cards[i] = deck[deck_ptr++];
990 kaeruka[i] = 0; /* default:nokosu */
993 /* suteruno wo kimeru */
994 prt(_("残すカードを決めて下さい(方向で移動, スペースで選択)。", "Stay witch? "), 0, 0);
1001 if (kakikae) display_kaeruka(k+kettei*5, kaeruka);
1006 case '6': case 'l': case 'L': case KTRL('F'):
1007 if (!kettei) k = (k+1)%5;
1008 else {k = 0;kettei = FALSE;}
1011 case '4': case 'h': case 'H': case KTRL('B'):
1012 if (!kettei) k = (k+4)%5;
1013 else {k = 4;kettei = FALSE;}
1016 case '2': case 'j': case 'J': case KTRL('N'):
1017 if (!kettei) {kettei = TRUE;kakikae = TRUE;}
1019 case '8': case 'k': case 'K': case KTRL('P'):
1020 if (kettei) {kettei = FALSE;kakikae = TRUE;}
1022 case ' ': case '\r':
1023 if (kettei) done = TRUE;
1024 else {kaeruka[k] = !kaeruka[k];kakikae = TRUE;}
1033 for (i = 0; i < 5; i++)
1034 if (kaeruka[i] == 1) cards[i] = deck[deck_ptr++]; /* soshite toru */
1038 return yaku_check();
1043 /* end of poker codes --Koka */
1046 * @brief カジノ1プレイごとのメインルーチン / gamble_comm
1047 * @param cmd プレイするゲームID
1050 static bool gamble_comm(int cmd)
1053 int roll1, roll2, roll3, choice, odds, win;
1058 char out_val[160], tmp_str[80], again;
1063 if (cmd == BACT_GAMBLE_RULES)
1065 /* Peruse the gambling help file */
1066 (void)show_file(TRUE, _("jgambling.txt", "gambling.txt"), NULL, 0, 0);
1073 msg_print(_("おい!おまえ一文なしじゃないか!こっから出ていけ!",
1074 "Hey! You don't have gold - get out of here!"));
1082 maxbet = p_ptr->lev * 200;
1084 /* We can't bet more than we have */
1085 maxbet = MIN(maxbet, p_ptr->au);
1088 strcpy(out_val, "");
1089 sprintf(tmp_str,_("賭け金 (1-%ld)?", "Your wager (1-%ld) ? "), (long int)maxbet);
1093 * Use get_string() because we may need more than
1094 * the s16b value returned by get_quantity().
1096 if (get_string(tmp_str, out_val, 32))
1099 for (p = out_val; *p == ' '; p++);
1104 if (wager > p_ptr->au)
1106 msg_print(_("おい!金が足りないじゃないか!出ていけ!", "Hey! You don't have the gold - get out of here!"));
1111 else if (wager > maxbet)
1113 msg_format(_("%ldゴールドだけ受けよう。残りは取っときな。",
1114 "I'll take %ld gold of that. Keep the rest."), (long int)maxbet);
1119 msg_print(_("OK、1ゴールドからはじめよう。", "Ok, we'll start with 1 gold."));
1125 oldgold = p_ptr->au;
1127 sprintf(tmp_str, _("ゲーム前の所持金: %9ld", "Gold before game: %9ld"), (long int)oldgold);
1128 prt(tmp_str, 20, 2);
1129 sprintf(tmp_str, _("現在の掛け金: %9ld", "Current Wager: %9ld"), (long int)wager);
1130 prt(tmp_str, 21, 2);
1137 case BACT_IN_BETWEEN: /* Game of In-Between */
1138 c_put_str(TERM_GREEN, _("イン・ビトイーン", "In Between"),5,2);
1142 roll1 = randint1(10);
1143 roll2 = randint1(10);
1144 choice = randint1(10);
1145 sprintf(tmp_str, _("黒ダイス: %d 黒ダイス: %d", "Black die: %d Black Die: %d"), roll1, roll2);
1148 sprintf(tmp_str, _("赤ダイス: %d", "Red die: %d"), choice);
1150 prt(tmp_str, 11, 14);
1151 if (((choice > roll1) && (choice < roll2)) ||
1152 ((choice < roll1) && (choice > roll2)))
1155 case BACT_CRAPS: /* Game of Craps */
1156 c_put_str(TERM_GREEN, _("クラップス", "Craps"), 5, 2);
1160 roll1 = randint1(6);
1161 roll2 = randint1(6);
1162 roll3 = roll1 + roll2;
1164 sprintf(tmp_str, _("1振りめ: %d %d Total: %d",
1165 "First roll: %d %d Total: %d"), roll1, roll2, roll3);
1167 if ((roll3 == 7) || (roll3 == 11))
1169 else if ((roll3 == 2) || (roll3 == 3) || (roll3 == 12))
1174 msg_print(_("なにかキーを押すともう一回振ります。", "Hit any key to roll again"));
1177 roll1 = randint1(6);
1178 roll2 = randint1(6);
1179 roll3 = roll1 + roll2;
1180 sprintf(tmp_str, _("出目: %d %d 合計: %d",
1181 "Roll result: %d %d Total: %d"), roll1, roll2, roll3);
1183 if (roll3 == choice)
1185 else if (roll3 == 7)
1187 } while ((win != TRUE) && (win != FALSE));
1190 case BACT_SPIN_WHEEL: /* Spin the Wheel Game */
1193 c_put_str(TERM_GREEN, _("ルーレット", "Wheel"), 5, 2);
1195 prt("0 1 2 3 4 5 6 7 8 9", 7, 5);
1196 prt("--------------------------------", 8, 3);
1197 strcpy(out_val, "");
1198 get_string(_("何番? (0-9): ", "Pick a number (0-9): "), out_val, 32);
1200 for (p = out_val; iswspace(*p); p++);
1204 msg_print(_("0番にしとくぜ。", "I'll put you down for 0."));
1207 else if (choice > 9)
1209 msg_print(_("OK、9番にしとくぜ。", "Ok, I'll put you down for 9."));
1213 roll1 = randint0(10);
1214 sprintf(tmp_str, _("ルーレットは回り、止まった。勝者は %d番だ。",
1215 "The wheel spins to a stop and the winner is %d"), roll1);
1216 prt(tmp_str, 13, 3);
1218 prt("*", 9, (3 * roll1 + 5));
1219 if (roll1 == choice)
1223 case BACT_DICE_SLOTS: /* The Dice Slots */
1224 c_put_str(TERM_GREEN, _("ダイス・スロット", "Dice Slots"), 5, 2);
1225 c_put_str(TERM_YELLOW, _("レモン レモン 2", ""), 6, 37);
1226 c_put_str(TERM_YELLOW, _("レモン レモン レモン 5", ""), 7, 37);
1227 c_put_str(TERM_ORANGE, _("オレンジ オレンジ オレンジ 10", ""), 8, 37);
1228 c_put_str(TERM_UMBER, _("剣 剣 剣 20", ""), 9, 37);
1229 c_put_str(TERM_SLATE, _("盾 盾 盾 50", ""), 10, 37);
1230 c_put_str(TERM_VIOLET, _("プラム プラム プラム 200", ""), 11, 37);
1231 c_put_str(TERM_RED, _("チェリー チェリー チェリー 1000", ""), 12, 37);
1234 roll1 = randint1(21);
1244 roll2 = randint1(21);
1254 choice = randint1(21);
1264 put_str("/--------------------------\\", 7, 2);
1265 prt("\\--------------------------/", 17, 2);
1266 display_fruit(8, 3, roll1 - 1);
1267 display_fruit(8, 12, roll2 - 1);
1268 display_fruit(8, 21, choice - 1);
1269 if ((roll1 == roll2) && (roll2 == choice))
1288 else if ((roll1 == 1) && (roll2 == 1))
1297 if (odds) win = TRUE;
1303 prt(_("あなたの勝ち", "YOU WON"), 16, 37);
1305 p_ptr->au += odds * wager;
1306 sprintf(tmp_str, _("倍率: %d", "Payoff: %d"), odds);
1308 prt(tmp_str, 17, 37);
1312 prt(_("あなたの負け", "You Lost"), 16, 37);
1315 sprintf(tmp_str, _("現在の所持金: %9ld", "Current Gold: %9ld"), (long int)p_ptr->au);
1317 prt(tmp_str, 22, 2);
1318 prt(_("もう一度(Y/N)?", "Again(Y/N)?"), 18, 37);
1320 move_cursor(18, 52);
1325 if (wager > p_ptr->au)
1327 msg_print(_("おい!金が足りないじゃないか!ここから出て行け!",
1328 "Hey! You don't have the gold - get out of here!"));
1334 } while ((again == 'y') || (again == 'Y'));
1337 if (p_ptr->au >= oldgold)
1339 msg_print(_("「今回は儲けたな!でも次はこっちが勝ってやるからな、絶対に!」",
1340 "You came out a winner! We'll win next time, I'm sure."));
1341 chg_virtue(V_CHANCE, 3);
1345 msg_print(_("「金をスッてしまったな、わはは!うちに帰った方がいいぜ。」", "You lost gold! Haha, better head home."));
1346 chg_virtue(V_CHANCE, -3);
1356 * @brief モンスター闘技場に参加するモンスターをリセットする。
1359 void battle_monsters(void)
1366 bool old_inside_battle = p_ptr->inside_battle;
1368 for (i = 0; i < max_d_idx; i++)
1369 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
1371 mon_level = randint1(MIN(max_dl, 122))+5;
1372 if (randint0(100) < 60)
1374 i = randint1(MIN(max_dl, 122))+5;
1375 mon_level = MAX(i, mon_level);
1377 if (randint0(100) < 30)
1379 i = randint1(MIN(max_dl, 122))+5;
1380 mon_level = MAX(i, mon_level);
1387 for(i = 0; i < 4; i++)
1393 get_mon_num_prep(monster_can_entry_arena, NULL);
1394 p_ptr->inside_battle = TRUE;
1395 r_idx = get_mon_num(mon_level);
1396 p_ptr->inside_battle = old_inside_battle;
1397 if (!r_idx) continue;
1399 if ((r_info[r_idx].flags1 & RF1_UNIQUE) || (r_info[r_idx].flags7 & RF7_UNIQUE2))
1401 if ((r_info[r_idx].level + 10) > mon_level) continue;
1404 for (j = 0; j < i; j++)
1405 if(r_idx == battle_mon[j]) break;
1410 battle_mon[i] = r_idx;
1411 if (r_info[r_idx].level < 45) tekitou = TRUE;
1416 monster_race *r_ptr = &r_info[battle_mon[i]];
1417 int num_taisei = count_bits(r_ptr->flagsr & (RFR_IM_ACID | RFR_IM_ELEC | RFR_IM_FIRE | RFR_IM_COLD | RFR_IM_POIS));
1419 if (r_ptr->flags1 & RF1_FORCE_MAXHP)
1420 power[i] = r_ptr->hdice * r_ptr->hside * 2;
1422 power[i] = r_ptr->hdice * (r_ptr->hside + 1);
1423 power[i] = power[i] * (100 + r_ptr->level) / 100;
1424 if (r_ptr->speed > 110)
1425 power[i] = power[i] * (r_ptr->speed * 2 - 110) / 100;
1426 if (r_ptr->speed < 110)
1427 power[i] = power[i] * (r_ptr->speed - 20) / 100;
1429 power[i] = power[i] * (num_taisei*2+5) / 10;
1430 else if (r_ptr->a_ability_flags2 & RF6_INVULNER)
1431 power[i] = power[i] * 4 / 3;
1432 else if (r_ptr->a_ability_flags2 & RF6_HEAL)
1433 power[i] = power[i] * 4 / 3;
1434 else if (r_ptr->a_ability_flags1 & RF5_DRAIN_MANA)
1435 power[i] = power[i] * 11 / 10;
1436 if (r_ptr->flags1 & RF1_RAND_25)
1437 power[i] = power[i] * 9 / 10;
1438 if (r_ptr->flags1 & RF1_RAND_50)
1439 power[i] = power[i] * 9 / 10;
1440 if (r_ptr->flagsr & RFR_RES_ALL) power[i] *= 100000;
1441 if (r_ptr->arena_ratio) power[i] = power[i] * r_ptr->arena_ratio / 100;
1448 power[i] = total*60/power[i];
1449 if (tekitou && ((power[i] < 160) || power[i] > 1500)) break;
1450 if ((power[i] < 160) && randint0(20)) break;
1451 if (power[i] < 101) power[i] = 100 + randint1(5);
1452 mon_odds[i] = power[i];
1459 * @brief モンスター闘技場のメインルーチン
1460 * @return 賭けを開始したか否か
1462 static bool kakutoujou(void)
1466 char out_val[160], tmp_str[80];
1469 if ((turn - old_battle) > TURNS_PER_TICK*250)
1480 msg_print(_("おい!おまえ一文なしじゃないか!こっから出ていけ!", "Hey! You don't have gold - get out of here!"));
1492 "Monsters Odds"), 4, 4);
1496 monster_race *r_ptr = &r_info[battle_mon[i]];
1498 sprintf(buf, _("%d) %-58s %4ld.%02ld倍", "%d) %-58s %4ld.%02ld"), i+1,
1499 _(format("%s%s",r_name + r_ptr->name, (r_ptr->flags1 & RF1_UNIQUE) ? "もどき" : " "),
1500 format("%s%s", (r_ptr->flags1 & RF1_UNIQUE) ? "Fake " : "", r_name + r_ptr->name)),
1501 (long int)mon_odds[i]/100, (long int)mon_odds[i]%100);
1504 prt(_("どれに賭けますか:", "Which monster: "), 0, 0);
1514 if (i >= '1' && i <= '4')
1516 sel_monster = i-'1';
1517 battle_odds = mon_odds[sel_monster];
1525 if (i !=sel_monster) clear_bldg(i+5,i+5);
1527 maxbet = p_ptr->lev * 200;
1529 /* We can't bet more than we have */
1530 maxbet = MIN(maxbet, p_ptr->au);
1533 strcpy(out_val, "");
1534 sprintf(tmp_str,_("賭け金 (1-%ld)?", "Your wager (1-%ld) ? "), (long int)maxbet);
1536 * Use get_string() because we may need more than
1537 * the s16b value returned by get_quantity().
1539 if (get_string(tmp_str, out_val, 32))
1542 for (p = out_val; *p == ' '; p++);
1547 if (wager > p_ptr->au)
1549 msg_print(_("おい!金が足りないじゃないか!出ていけ!", "Hey! You don't have the gold - get out of here!"));
1555 else if (wager > maxbet)
1557 msg_format(_("%ldゴールドだけ受けよう。残りは取っときな。", "I'll take %ld gold of that. Keep the rest."), (long int)maxbet);
1563 msg_print(_("OK、1ゴールドでいこう。", "Ok, we'll start with 1 gold."));
1567 battle_odds = MAX(wager+1, wager * battle_odds / 100);
1572 /* Save the surface floor as saved floor */
1573 prepare_change_floor_mode(CFM_SAVE_FLOORS);
1575 p_ptr->inside_battle = TRUE;
1576 p_ptr->leaving = TRUE;
1590 * @brief 本日の賞金首情報を表示する。
1593 static void today_target(void)
1596 monster_race *r_ptr = &r_info[today_mon];
1599 c_put_str(TERM_YELLOW, _("本日の賞金首", "Wanted monster that changes from day to day"), 5, 10);
1600 sprintf(buf,_("ターゲット: %s", "target: %s"),r_name + r_ptr->name);
1601 c_put_str(TERM_YELLOW, buf, 6, 10);
1602 sprintf(buf,_("死体 ---- $%d", "corpse ---- $%d"), (int)r_ptr->level * 50 + 100);
1604 sprintf(buf,_("骨 ---- $%d", "skeleton ---- $%d"), (int)r_ptr->level * 30 + 60);
1606 p_ptr->today_mon = today_mon;
1610 * @brief ツチノコの賞金首情報を表示する。
1613 static void tsuchinoko(void)
1616 c_put_str(TERM_YELLOW, _("一獲千金の大チャンス!!!", "Big chance to quick money!!!"), 5, 10);
1617 c_put_str(TERM_YELLOW, _("ターゲット:幻の珍獣「ツチノコ」", "target: the rarest animal 'Tsuchinoko'"), 6, 10);
1618 c_put_str(TERM_WHITE, _("生け捕り ---- $1,000,000", "catch alive ---- $1,000,000"), 8, 10);
1619 c_put_str(TERM_WHITE, _("死体 ---- $200,000", "corpse ---- $200,000"), 9, 10);
1620 c_put_str(TERM_WHITE, _("骨 ---- $100,000", "bones ---- $100,000"), 10, 10);
1624 * @brief 通常の賞金首情報を表示する。
1627 static void shoukinkubi(void)
1633 prt(_("死体を持ち帰れば報酬を差し上げます。", "Offer a prize when you bring a wanted monster's corpse"),4 ,10);
1634 c_put_str(TERM_YELLOW, _("現在の賞金首", "Wanted monsters"), 6, 10);
1636 for (i = 0; i < MAX_KUBI; i++)
1640 monster_race *r_ptr = &r_info[(kubi_r_idx[i] > 10000 ? kubi_r_idx[i] - 10000 : kubi_r_idx[i])];
1642 if (kubi_r_idx[i] > 10000)
1645 done_mark = _("(済)", "(done)");
1653 c_prt(color, format("%s %s", r_name + r_ptr->name, done_mark), y+7, 10);
1656 if (!y && (i < MAX_KUBI -1))
1658 prt(_("何かキーを押してください", "Hit any key."), 0, 0);
1669 * 賞金首の報酬テーブル / List of prize object
1672 OBJECT_TYPE_VALUE tval; /*!< ベースアイテムのメイン種別ID */
1673 OBJECT_SUBTYPE_VALUE sval; /*!< ベースアイテムのサブ種別ID */
1674 } prize_list[MAX_KUBI] =
1676 {TV_POTION, SV_POTION_CURING},
1677 {TV_POTION, SV_POTION_SPEED},
1678 {TV_POTION, SV_POTION_SPEED},
1679 {TV_POTION, SV_POTION_RESISTANCE},
1680 {TV_POTION, SV_POTION_ENLIGHTENMENT},
1682 {TV_POTION, SV_POTION_HEALING},
1683 {TV_POTION, SV_POTION_RESTORE_MANA},
1684 {TV_SCROLL, SV_SCROLL_STAR_DESTRUCTION},
1685 {TV_POTION, SV_POTION_STAR_ENLIGHTENMENT},
1686 {TV_SCROLL, SV_SCROLL_SUMMON_PET},
1688 {TV_SCROLL, SV_SCROLL_GENOCIDE},
1689 {TV_POTION, SV_POTION_STAR_HEALING},
1690 {TV_POTION, SV_POTION_STAR_HEALING},
1691 {TV_POTION, SV_POTION_NEW_LIFE},
1692 {TV_SCROLL, SV_SCROLL_MASS_GENOCIDE},
1694 {TV_POTION, SV_POTION_LIFE},
1695 {TV_POTION, SV_POTION_LIFE},
1696 {TV_POTION, SV_POTION_AUGMENTATION},
1697 {TV_POTION, SV_POTION_INVULNERABILITY},
1698 {TV_SCROLL, SV_SCROLL_ARTIFACT},
1702 * @brief 賞金首の引き換え処理 / Get prize
1703 * @return 各種賞金首のいずれかでも換金が行われたか否か。
1705 static bool kankin(void)
1709 bool change = FALSE;
1710 GAME_TEXT o_name[MAX_NLEN];
1713 /* Loop for inventory and right/left arm */
1714 for (i = 0; i <= INVEN_LARM; i++)
1716 o_ptr = &inventory[i];
1718 /* Living Tsuchinoko worthes $1000000 */
1719 if ((o_ptr->tval == TV_CAPTURE) && (o_ptr->pval == MON_TSUCHINOKO))
1721 char buf[MAX_NLEN+20];
1722 object_desc(o_name, o_ptr, 0);
1723 sprintf(buf, _("%s を換金しますか?", "Convert %s into money? "),o_name);
1726 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (long int)(1000000L * o_ptr->number));
1727 p_ptr->au += 1000000L * o_ptr->number;
1728 p_ptr->redraw |= (PR_GOLD);
1729 inven_item_increase(i, -o_ptr->number);
1730 inven_item_describe(i);
1731 inven_item_optimize(i);
1737 for (i = 0; i < INVEN_PACK; i++)
1739 o_ptr = &inventory[i];
1741 /* Corpse of Tsuchinoko worthes $200000 */
1742 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_CORPSE) && (o_ptr->pval == MON_TSUCHINOKO))
1744 char buf[MAX_NLEN+20];
1745 object_desc(o_name, o_ptr, 0);
1746 sprintf(buf, _("%s を換金しますか?", "Convert %s into money? "),o_name);
1749 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (long int)(200000L * o_ptr->number));
1750 p_ptr->au += 200000L * o_ptr->number;
1751 p_ptr->redraw |= (PR_GOLD);
1752 inven_item_increase(i, -o_ptr->number);
1753 inven_item_describe(i);
1754 inven_item_optimize(i);
1760 for (i = 0; i < INVEN_PACK; i++)
1762 o_ptr = &inventory[i];
1764 /* Bones of Tsuchinoko worthes $100000 */
1765 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_SKELETON) && (o_ptr->pval == MON_TSUCHINOKO))
1767 char buf[MAX_NLEN+20];
1768 object_desc(o_name, o_ptr, 0);
1769 sprintf(buf, _("%s を換金しますか?", "Convert %s into money? "),o_name);
1772 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (long int)(100000L * o_ptr->number));
1773 p_ptr->au += 100000L * o_ptr->number;
1774 p_ptr->redraw |= (PR_GOLD);
1775 inven_item_increase(i, -o_ptr->number);
1776 inven_item_describe(i);
1777 inven_item_optimize(i);
1783 for (i = 0; i < INVEN_PACK; i++)
1785 o_ptr = &inventory[i];
1786 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)))
1788 char buf[MAX_NLEN+20];
1789 object_desc(o_name, o_ptr, 0);
1790 sprintf(buf, _("%s を換金しますか?", "Convert %s into money? "),o_name);
1793 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (long int)((r_info[today_mon].level * 50 + 100) * o_ptr->number));
1794 p_ptr->au += (r_info[today_mon].level * 50 + 100) * o_ptr->number;
1795 p_ptr->redraw |= (PR_GOLD);
1796 inven_item_increase(i, -o_ptr->number);
1797 inven_item_describe(i);
1798 inven_item_optimize(i);
1804 for (i = 0; i < INVEN_PACK; i++)
1806 o_ptr = &inventory[i];
1808 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)))
1810 char buf[MAX_NLEN+20];
1811 object_desc(o_name, o_ptr, 0);
1812 sprintf(buf, _("%s を換金しますか?", "Convert %s into money? "),o_name);
1815 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (long int)((r_info[today_mon].level * 30 + 60) * o_ptr->number));
1816 p_ptr->au += (r_info[today_mon].level * 30 + 60) * o_ptr->number;
1817 p_ptr->redraw |= (PR_GOLD);
1818 inven_item_increase(i, -o_ptr->number);
1819 inven_item_describe(i);
1820 inven_item_optimize(i);
1826 for (j = 0; j < MAX_KUBI; j++)
1828 /* Need reverse order --- Positions will be changed in the loop */
1829 for (i = INVEN_PACK-1; i >= 0; i--)
1831 o_ptr = &inventory[i];
1832 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->pval == kubi_r_idx[j]))
1834 char buf[MAX_NLEN+20];
1836 INVENTORY_IDX item_new;
1839 object_desc(o_name, o_ptr, 0);
1840 sprintf(buf, _("%sを渡しますか?", "Hand %s over? "),o_name);
1841 if (!get_check(buf)) continue;
1843 #if 0 /* Obsoleted */
1844 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (r_info[kubi_r_idx[j]].level + 1) * 300 * o_ptr->number);
1845 p_ptr->au += (r_info[kubi_r_idx[j]].level+1) * 300 * o_ptr->number;
1846 p_ptr->redraw |= (PR_GOLD);
1847 inven_item_increase(i, -o_ptr->number);
1848 inven_item_describe(i);
1849 inven_item_optimize(i);
1850 chg_virtue(V_JUSTICE, 5);
1851 kubi_r_idx[j] += 10000;
1854 #endif /* Obsoleted */
1857 inven_item_increase(i, -o_ptr->number);
1858 inven_item_describe(i);
1859 inven_item_optimize(i);
1861 chg_virtue(V_JUSTICE, 5);
1862 kubi_r_idx[j] += 10000;
1864 /* Count number of unique corpses already handed */
1865 for (num = 0, k = 0; k < MAX_KUBI; k++)
1867 if (kubi_r_idx[k] >= 10000) num++;
1869 msg_format(_("これで合計 %d ポイント獲得しました。" ,"You earned %d point%s total."), num, (num > 1 ? "s" : ""));
1871 /* Prepare to make a prize */
1872 object_prep(&forge, lookup_kind(prize_list[num-1].tval, prize_list[num-1].sval));
1873 apply_magic(&forge, object_level, AM_NO_FIXED_ART);
1875 object_aware(&forge);
1876 object_known(&forge);
1879 * Hand it --- Assume there is an empty slot.
1880 * Since a corpse is handed at first,
1881 * there is at least one empty slot.
1883 item_new = inven_carry(&forge);
1885 object_desc(o_name, &forge, 0);
1886 msg_format(_("%s(%c)を貰った。", "You get %s (%c). "), o_name, index_to_label(item_new));
1888 /* Auto-inscription */
1889 autopick_alter_item(item_new, FALSE);
1899 msg_print(_("賞金を得られそうなものは持っていなかった。", "You have nothing."));
1907 * @brief 宿屋の利用サブルーチン
1908 * @details inn commands\n
1909 * Note that resting for the night was a perfect way to avoid player\n
1910 * ghosts in the town *if* you could only make it to the inn in time (-:\n
1911 * Now that the ghosts are temporarily disabled in 2.8.X, this function\n
1912 * will not be that useful. I will keep it in the hopes the player\n
1913 * ghost code does become a reality again. Does help to avoid filthy urchins.\n
1914 * Resting at night is also a quick way to restock stores -KMW-\n
1915 * @param cmd 宿屋の利用施設ID
1916 * @return 施設の利用が実際に行われたか否か。
1918 static bool inn_comm(int cmd)
1922 case BACT_FOOD: /* Buy food & drink */
1923 if (p_ptr->food >= PY_FOOD_FULL)
1925 msg_print(_("今は満腹だ。", "You are full now."));
1928 msg_print(_("バーテンはいくらかの食べ物とビールをくれた。", "The barkeep gives you some gruel and a beer."));
1929 (void)set_food(PY_FOOD_MAX - 1);
1932 case BACT_REST: /* Rest for the night */
1933 if ((p_ptr->poisoned) || (p_ptr->cut))
1935 msg_print(_("あなたに必要なのは部屋ではなく、治療者です。", "You need a healer, not a room."));
1937 msg_print(_("すみません、でもうちで誰かに死なれちゃ困りますんで。", "Sorry, but don't want anyone dying in here."));
1941 s32b oldturn = turn;
1942 int prev_day, prev_hour, prev_min;
1944 extract_day_hour_min(&prev_day, &prev_hour, &prev_min);
1945 if ((prev_hour >= 6) && (prev_hour <= 17))
1946 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("宿屋に泊まった。", "stay over daytime at the inn."));
1948 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("宿屋に泊まった。", "stay over night at the inn."));
1950 turn = (turn / (TURNS_PER_TICK * TOWN_DAWN / 2) + 1) * (TURNS_PER_TICK * TOWN_DAWN / 2);
1951 if (dungeon_turn < dungeon_turn_limit)
1953 dungeon_turn += MIN((turn - oldturn), TURNS_PER_TICK * 250) * INN_DUNGEON_TURN_ADJ;
1954 if (dungeon_turn > dungeon_turn_limit) dungeon_turn = dungeon_turn_limit;
1957 prevent_turn_overflow();
1959 if ((prev_hour >= 18) && (prev_hour <= 23)) do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
1960 p_ptr->chp = p_ptr->mhp;
1962 if (ironman_nightmare)
1964 msg_print(_("眠りに就くと恐ろしい光景が心をよぎった。", "Horrible visions flit through your mind as you sleep."));
1966 /* Have some nightmares */
1969 sanity_blast(NULL, FALSE);
1970 if (!one_in_(3)) break;
1973 msg_print(_("あなたは絶叫して目を覚ました。", "You awake screaming."));
1974 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("悪夢にうなされてよく眠れなかった。", "be troubled by a nightmare."));
1981 p_ptr->chp = p_ptr->mhp;
1982 p_ptr->csp = p_ptr->msp;
1983 if (p_ptr->pclass == CLASS_MAGIC_EATER)
1986 for (i = 0; i < 72; i++)
1988 p_ptr->magic_num1[i] = p_ptr->magic_num2[i] * EATER_CHARGE;
1990 for (; i < 108; i++)
1992 p_ptr->magic_num1[i] = 0;
1996 if ((prev_hour >= 6) && (prev_hour <= 17))
1998 msg_print(_("あなたはリフレッシュして目覚め、夕方を迎えた。", "You awake refreshed for the evening."));
1999 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("夕方を迎えた。", "awake refreshed."));
2003 msg_print(_("あなたはリフレッシュして目覚め、新たな日を迎えた。", "You awake refreshed for the new day."));
2004 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("すがすがしい朝を迎えた。", "awake refreshed."));
2010 case BACT_RUMORS: /* Listen for rumors */
2012 display_rumor(TRUE);
2022 * @brief クエスト情報を表示しつつ処理する。/ Display quest information
2023 * @param questnum クエストのID
2024 * @param do_init クエストの開始処理(TRUE)、結果処理か(FALSE)
2027 static void get_questinfo(IDX questnum, bool do_init)
2030 QUEST_IDX old_quest;
2031 GAME_TEXT tmp_str[80];
2033 /* Clear the text */
2034 for (i = 0; i < 10; i++)
2036 quest_text[i][0] = '\0';
2039 quest_text_line = 0;
2041 /* Set the quest number temporary */
2042 old_quest = p_ptr->inside_quest;
2043 p_ptr->inside_quest = questnum;
2045 /* Get the quest text */
2046 init_flags = INIT_SHOW_TEXT;
2047 if (do_init) init_flags |= INIT_ASSIGN;
2049 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
2051 /* Reset the old quest number */
2052 p_ptr->inside_quest = old_quest;
2054 /* Print the quest info */
2055 sprintf(tmp_str, _("クエスト情報 (危険度: %d 階相当)", "Quest Information (Danger level: %d)"), (int)quest[questnum].level);
2059 prt(quest[questnum].name, 7, 0);
2061 for (i = 0; i < 10; i++)
2063 c_put_str(TERM_YELLOW, quest_text[i], i + 8, 0);
2068 * @brief クエスト処理のメインルーチン / Request a quest from the Lord.
2071 static void castle_quest(void)
2073 QUEST_IDX q_index = 0;
2074 monster_race *r_ptr;
2081 /* Current quest of the building */
2082 q_index = grid_array[p_ptr->y][p_ptr->x].special;
2084 /* Is there a quest available at the building? */
2087 put_str(_("今のところクエストはありません。", "I don't have a quest for you at the moment."), 8, 0);
2091 q_ptr = &quest[q_index];
2093 /* Quest is completed */
2094 if (q_ptr->status == QUEST_STATUS_COMPLETED)
2096 /* Rewarded quest */
2097 q_ptr->status = QUEST_STATUS_REWARDED;
2099 get_questinfo(q_index, FALSE);
2101 reinit_wilderness = TRUE;
2104 else if (q_ptr->status == QUEST_STATUS_FAILED)
2106 get_questinfo(q_index, FALSE);
2108 /* Mark quest as done (but failed) */
2109 q_ptr->status = QUEST_STATUS_FAILED_DONE;
2111 reinit_wilderness = TRUE;
2113 /* Quest is still unfinished */
2114 else if (q_ptr->status == QUEST_STATUS_TAKEN)
2116 put_str(_("あなたは現在のクエストを終了させていません!", "You have not completed your current quest yet!"), 8, 0);
2117 put_str(_("CTRL-Qを使えばクエストの状態がチェックできます。", "Use CTRL-Q to check the status of your quest."), 9, 0);
2118 put_str(_("クエストを終わらせたら戻って来て下さい。", "Return when you have completed your quest."), 12, 0);
2121 else if (q_ptr->status == QUEST_STATUS_UNTAKEN)
2123 q_ptr->status = QUEST_STATUS_TAKEN;
2125 reinit_wilderness = TRUE;
2127 /* Assign a new quest */
2128 if (q_ptr->type == QUEST_TYPE_KILL_ANY_LEVEL)
2130 if (q_ptr->r_idx == 0)
2132 /* Random monster at least 5 - 10 levels out of deep */
2133 q_ptr->r_idx = get_mon_num(q_ptr->level + 4 + randint1(6));
2136 r_ptr = &r_info[q_ptr->r_idx];
2138 while ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->rarity != 1))
2140 q_ptr->r_idx = get_mon_num(q_ptr->level) + 4 + randint1(6);
2141 r_ptr = &r_info[q_ptr->r_idx];
2144 if (q_ptr->max_num == 0)
2146 /* Random monster number */
2147 if (randint1(10) > 7)
2150 q_ptr->max_num = randint1(3) + 1;
2154 name = (r_name + r_ptr->name);
2155 msg_format(_("クエスト: %sを %d体倒す", "Your quest: kill %d %s"), name,q_ptr->max_num);
2159 get_questinfo(q_index, TRUE);
2166 * @brief 町に関するヘルプを表示する / Display town history
2169 static void town_history(void)
2173 /* Peruse the building help file */
2174 (void)show_file(TRUE, _("jbldg.txt", "bldg.txt"), NULL, 0, 0);
2179 * @brief 射撃時クリティカルによるダメージ期待値修正計算(スナイパーの集中処理と武器経験値) / critical happens at i / 10000
2180 * @param plus_ammo 矢弾のダメージ修正
2181 * @param plus_bow 弓のダメージ修正
2183 * @note 基本ダメージ量と重量はこの部位では計算に加わらない。
2185 HIT_POINT calc_crit_ratio_shot(HIT_POINT plus_ammo, HIT_POINT plus_bow)
2188 object_type *j_ptr = &inventory[INVEN_BOW];
2190 /* Extract "shot" power */
2191 i = p_ptr->to_h_b + plus_ammo;
2193 if (p_ptr->tval_ammo == TV_BOLT)
2194 i = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + i) * BTH_PLUS_ADJ);
2196 i = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + i) * BTH_PLUS_ADJ);
2198 /* Snipers can shot more critically with crossbows */
2199 if (p_ptr->concent) i += ((i * p_ptr->concent) / 5);
2200 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->tval_ammo == TV_BOLT)) i *= 2;
2202 /* Good bow makes more critical */
2203 i += plus_bow * 8 * (p_ptr->concent ? p_ptr->concent + 5 : 5);
2211 * @brief 射撃時クリティカルによるダメージ期待値修正計算(重量依存部分) / critical happens at i / 10000
2212 * @param weight 武器の重量
2213 * @param plus_ammo 矢弾のダメージ修正
2214 * @param plus_bow 弓のダメージ修正
2215 * @param dam 基本ダメージ量
2218 HIT_POINT calc_expect_crit_shot(WEIGHT weight, int plus_ammo, int plus_bow, HIT_POINT dam)
2222 i = calc_crit_ratio_shot(plus_ammo, plus_bow);
2227 crit = MIN(500, 900/weight);
2228 num += dam * 3 /2 * crit;
2231 crit = MIN(500, 1350/weight);
2233 num += dam * 2 * crit;
2239 num += dam * 3 * crit;
2245 num += (10000 - i) * dam;
2252 * @brief 攻撃時クリティカルによるダメージ期待値修正計算(重量と毒針処理) / critical happens at i / 10000
2253 * @param weight 武器の重量
2254 * @param plus 武器のダメージ修正
2256 * @param meichuu 命中値
2257 * @param dokubari 毒針処理か否か
2260 HIT_POINT calc_expect_crit(WEIGHT weight, int plus, HIT_POINT dam, s16b meichuu, bool dokubari)
2265 if(dokubari) return dam;
2267 i = (weight + (meichuu * 3 + plus * 5) + p_ptr->skill_thn);
2273 if (k < 400) num += (2 * dam + 5) * (400 - k);
2274 if (k < 700) num += (2 * dam + 10) * (MIN(700, k + 650) - MAX(400, k));
2275 if (k > (700 - 650) && k < 900) num += (3 * dam + 15) * (MIN(900, k + 650) - MAX(700, k));
2276 if (k > (900 - 650) && k < 1300) num += (3 * dam + 20) * (MIN(1300, k + 650) - MAX(900, k));
2277 if (k > (1300 - 650)) num += (7 * dam / 2 + 25) * MIN(650, k - (1300 - 650));
2280 if(p_ptr->pclass == CLASS_NINJA)
2283 num += (4444 - i) * dam;
2289 num += (5000 - i) * dam;
2297 * @brief 攻撃時スレイによるダメージ期待値修正計算 / critical happens at i / 10000
2299 * @param mult スレイ倍率(掛け算部分)
2300 * @param div スレイ倍率(割り算部分)
2301 * @param force 理力特別計算フラグ
2304 static HIT_POINT calc_slaydam(HIT_POINT dam, int mult, int div, bool force)
2312 tmp += dam * 60 * 2;
2326 * @brief 攻撃時の期待値計算(スレイ→重量クリティカル→切れ味効果)
2328 * @param mult スレイ倍率(掛け算部分)
2329 * @param div スレイ倍率(割り算部分)
2330 * @param force 理力特別計算フラグ
2332 * @param plus 武器ダメージ修正
2333 * @param meichuu 命中値
2334 * @param dokubari 毒針処理か否か
2335 * @param vorpal_mult 切れ味倍率(掛け算部分)
2336 * @param vorpal_div 切れ味倍率(割り算部分)
2339 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)
2341 dam = calc_slaydam(dam, mult, div, force);
2342 dam = calc_expect_crit(weight, plus, dam, meichuu, dokubari);
2343 dam = calc_slaydam(dam, vorpal_mult, vorpal_div, FALSE);
2349 * @brief 武器の各条件毎のダメージ期待値を表示する。
2352 * @param mindice ダイス部分最小値
2353 * @param maxdice ダイス部分最大値
2355 * @param dam_bonus ダメージ修正値
2357 * @param color 条件内容の表示色
2359 * Display the damage figure of an object\n
2360 * (used by compare_weapon_aux)\n
2362 * Only accurate for the current weapon, because it includes\n
2363 * the current +dam of the player.\n
2366 static void show_weapon_dmg(int r, int c, int mindice, int maxdice, int blows, int dam_bonus, concptr attr, byte color)
2368 GAME_TEXT tmp_str[80];
2371 mindam = blows * (mindice + dam_bonus);
2372 maxdam = blows * (maxdice + dam_bonus);
2374 /* Print the intro text */
2375 c_put_str(color, attr, r, c);
2377 /* Calculate the min and max damage figures */
2378 sprintf(tmp_str, _("1ターン: %d-%d ダメージ", "Attack: %d-%d damage"), mindam, maxdam);
2380 /* Print the damage */
2381 put_str(tmp_str, r, c + 8);
2386 * @brief 武器一つ毎のダメージ情報を表示する。
2387 * @param o_ptr オブジェクトの構造体の参照ポインタ。
2388 * @param col 表示する行の上端
2391 * Show the damage figures for the various monster types\n
2393 * Only accurate for the current weapon, because it includes\n
2394 * the current number of blows for the player.\n
2397 static void compare_weapon_aux(object_type *o_ptr, int col, int r)
2399 BIT_FLAGS flgs[TR_FLAG_SIZE];
2400 int blow = p_ptr->num_blow[0];
2402 bool dokubari = FALSE;
2404 /* Effective dices */
2405 int eff_dd = o_ptr->dd + p_ptr->to_dd[0];
2406 int eff_ds = o_ptr->ds + p_ptr->to_ds[0];
2408 int mindice = eff_dd;
2409 int maxdice = eff_ds * eff_dd;
2412 int vorpal_mult = 1;
2414 int dmg_bonus = o_ptr->to_d + p_ptr->to_d[0];
2417 /* Get the flags of the weapon */
2418 object_flags(o_ptr, flgs);
2420 if((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) dokubari = TRUE;
2423 /* Show Critical Damage*/
2424 mindam = calc_expect_crit(o_ptr->weight, o_ptr->to_h, mindice, p_ptr->to_h[0], dokubari);
2425 maxdam = calc_expect_crit(o_ptr->weight, o_ptr->to_h, maxdice, p_ptr->to_h[0], dokubari);
2427 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("会心:", "Critical:"), TERM_L_RED);
2431 if ((have_flag(flgs, TR_VORPAL) || hex_spelling(HEX_RUNESWORD)))
2433 if((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD))
2444 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);
2445 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);
2446 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("切れ味:", "Vorpal:") , TERM_L_RED);
2449 if ((p_ptr->pclass != CLASS_SAMURAI) && have_flag(flgs, TR_FORCE_WEAPON) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
2453 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);
2454 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);
2455 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("理力:", "Force :"), TERM_L_BLUE);
2458 /* Print the relevant lines */
2459 if (have_flag(flgs, TR_KILL_ANIMAL))
2461 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);
2462 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);
2463 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("動物:", "Animals:"), TERM_YELLOW);
2465 else if (have_flag(flgs, TR_SLAY_ANIMAL))
2467 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);
2468 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);
2469 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("動物:", "Animals:"), TERM_YELLOW);
2471 if (have_flag(flgs, TR_KILL_EVIL))
2473 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);
2474 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);
2475 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("邪悪:", "Evil:"), TERM_YELLOW);
2477 else if (have_flag(flgs, TR_SLAY_EVIL))
2479 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);
2480 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);
2481 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("邪悪:", "Evil:"), TERM_YELLOW);
2483 if (have_flag(flgs, TR_KILL_HUMAN))
2485 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);
2486 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);
2487 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("人間:", "Human:"), TERM_YELLOW);
2489 else if (have_flag(flgs, TR_SLAY_HUMAN))
2491 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);
2492 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);
2493 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("人間:", "Human:"), TERM_YELLOW);
2495 if (have_flag(flgs, TR_KILL_UNDEAD))
2497 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);
2498 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);
2499 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("不死:", "Undead:"), TERM_YELLOW);
2501 else if (have_flag(flgs, TR_SLAY_UNDEAD))
2503 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);
2504 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);
2505 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("不死:", "Undead:"), TERM_YELLOW);
2507 if (have_flag(flgs, TR_KILL_DEMON))
2509 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);
2510 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);
2511 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("悪魔:", "Demons:") , TERM_YELLOW);
2513 else if (have_flag(flgs, TR_SLAY_DEMON))
2515 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);
2516 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);
2517 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("悪魔:", "Demons:") , TERM_YELLOW);
2519 if (have_flag(flgs, TR_KILL_ORC))
2521 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);
2522 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);
2523 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("オーク:", "Orcs:"), TERM_YELLOW);
2525 else if (have_flag(flgs, TR_SLAY_ORC))
2527 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);
2528 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);
2529 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("オーク:", "Orcs:"), TERM_YELLOW);
2531 if (have_flag(flgs, TR_KILL_TROLL))
2533 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);
2534 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);
2535 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("トロル:", "Trolls:") , TERM_YELLOW);
2537 else if (have_flag(flgs, TR_SLAY_TROLL))
2539 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);
2540 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);
2541 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("トロル:", "Trolls:") , TERM_YELLOW);
2543 if (have_flag(flgs, TR_KILL_GIANT))
2545 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);
2546 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);
2547 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("巨人:", "Giants:"), TERM_YELLOW);
2549 else if (have_flag(flgs, TR_SLAY_GIANT))
2551 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);
2552 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);
2553 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("巨人:", "Giants:"), TERM_YELLOW);
2555 if (have_flag(flgs, TR_KILL_DRAGON))
2557 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);
2558 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);
2559 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("竜:", "Dragons:"), TERM_YELLOW);
2561 else if (have_flag(flgs, TR_SLAY_DRAGON))
2563 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);
2564 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);
2565 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("竜:", "Dragons:"), TERM_YELLOW);
2567 if (have_flag(flgs, TR_BRAND_ACID))
2569 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);
2570 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);
2571 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("酸属性:", "Acid:"), TERM_RED);
2573 if (have_flag(flgs, TR_BRAND_ELEC))
2575 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);
2576 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);
2577 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("電属性:", "Elec:"), TERM_RED);
2579 if (have_flag(flgs, TR_BRAND_FIRE))
2581 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);
2582 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);
2583 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("炎属性:", "Fire:"), TERM_RED);
2585 if (have_flag(flgs, TR_BRAND_COLD))
2587 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);
2588 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);
2589 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("冷属性:", "Cold:"), TERM_RED);
2591 if (have_flag(flgs, TR_BRAND_POIS))
2593 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);
2594 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);
2595 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("毒属性:", "Poison:"), TERM_RED);
2600 * @brief 武器匠における武器一つ毎の完全情報を表示する。
2601 * @param o_ptr オブジェクトの構造体の参照ポインタ。
2602 * @param row 表示する列の左端
2603 * @param col 表示する行の上端
2605 * Displays all info about a weapon
2607 * Only accurate for the current weapon, because it includes
2608 * various info about the player's +to_dam and number of blows.
2611 static void list_weapon(object_type *o_ptr, TERM_LEN row, TERM_LEN col)
2613 GAME_TEXT o_name[MAX_NLEN];
2614 GAME_TEXT tmp_str[80];
2616 DICE_NUMBER eff_dd = o_ptr->dd + p_ptr->to_dd[0];
2617 DICE_SID eff_ds = o_ptr->ds + p_ptr->to_ds[0];
2618 HIT_RELIABILITY reli = p_ptr->skill_thn + (p_ptr->to_h[0] + o_ptr->to_h) * BTH_PLUS_ADJ;
2620 /* Print the weapon name */
2621 object_desc(o_name, o_ptr, OD_NAME_ONLY);
2622 c_put_str(TERM_YELLOW, o_name, row, col);
2624 /* Print the player's number of blows */
2625 sprintf(tmp_str, _("攻撃回数: %d", "Number of Blows: %d"), p_ptr->num_blow[0]);
2626 put_str(tmp_str, row+1, col);
2628 /* Print to_hit and to_dam of the weapon */
2629 sprintf(tmp_str, _("命中率: 0 50 100 150 200 (敵のAC)", "To Hit: 0 50 100 150 200 (AC)"));
2630 put_str(tmp_str, row+2, col);
2632 /* Print the weapons base damage dice */
2633 sprintf(tmp_str, " %2d %2d %2d %2d %2d (%%)",
2634 (int)hit_chance(reli, 0),
2635 (int)hit_chance(reli, 50),
2636 (int)hit_chance(reli, 100),
2637 (int)hit_chance(reli, 150),
2638 (int)hit_chance(reli, 200));
2639 put_str(tmp_str, row+3, col);
2640 c_put_str(TERM_YELLOW, _("可能なダメージ:", "Possible Damage:"), row+5, col);
2642 /* Damage for one blow (if it hits) */
2643 sprintf(tmp_str, _("攻撃一回につき %d-%d", "One Strike: %d-%d damage"),
2644 (int)(eff_dd + o_ptr->to_d + p_ptr->to_d[0]),
2645 (int)(eff_ds * eff_dd + o_ptr->to_d + p_ptr->to_d[0]));
2646 put_str(tmp_str, row+6, col+1);
2648 /* Damage for the complete attack (if all blows hit) */
2649 sprintf(tmp_str, _("1ターンにつき %d-%d", "One Attack: %d-%d damage"),
2650 (int)(p_ptr->num_blow[0] * (eff_dd + o_ptr->to_d + p_ptr->to_d[0])),
2651 (int)(p_ptr->num_blow[0] * (eff_ds * eff_dd + o_ptr->to_d + p_ptr->to_d[0])));
2652 put_str(tmp_str, row+7, col+1);
2656 * @brief 武器匠鑑定1回分(オブジェクト2種)の処理。/ Compare weapons
2658 * Copies the weapons to compare into the weapon-slot and\n
2659 * compares the values for both weapons.\n
2660 * 武器1つだけで比較をしないなら費用は半額になる。
2661 * @param bcost 基本鑑定費用
2662 * @return 最終的にかかった費用
2664 static PRICE compare_weapons(PRICE bcost)
2667 OBJECT_IDX item, item2;
2668 object_type *o_ptr[2];
2669 object_type orig_weapon;
2673 TERM_LEN wid = 38, mgn = 2;
2674 bool old_character_xtra = character_xtra;
2677 PRICE cost = 0; /* First time no price */
2682 /* Store copy of original wielded weapon */
2683 i_ptr = &inventory[INVEN_RARM];
2684 object_copy(&orig_weapon, i_ptr);
2686 item_tester_hook = item_tester_hook_orthodox_melee_weapons;
2688 /* Get the first weapon */
2689 q = _("第一の武器は?", "What is your first weapon? ");
2690 s = _("比べるものがありません。", "You have nothing to compare.");
2692 o_ptr[0] = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT));
2706 /* Only compare melee weapons */
2707 item_tester_hook = item_tester_hook_orthodox_melee_weapons;
2709 /* Hack -- prevent "icky" message */
2710 character_xtra = TRUE;
2712 /* Diaplay selected weapon's infomation */
2713 for (i = 0; i < n; i++)
2715 int col = (wid * i + mgn);
2717 /* Copy i-th weapon into the weapon slot (if it's not already there) */
2718 if (o_ptr[i] != i_ptr) object_copy(i_ptr, o_ptr[i]);
2720 p_ptr->update |= PU_BONUS;
2723 /* List the new values */
2724 list_weapon(o_ptr[i], row, col);
2725 compare_weapon_aux(o_ptr[i], col, row + 8);
2727 /* Copy back the original weapon into the weapon slot */
2728 object_copy(i_ptr, &orig_weapon);
2731 /* Reset the values for the old weapon */
2732 p_ptr->update |= PU_BONUS;
2735 character_xtra = old_character_xtra;
2738 put_str(format("[ 比較対象: 's'で変更 ($%d) ]", cost), 1, (wid + mgn));
2739 put_str("(一番高いダメージが適用されます。複数の倍打効果は足し算されません。)", row + 4, 0);
2740 prt("現在の技量から判断すると、あなたの武器は以下のような威力を発揮します:", 0, 0);
2742 put_str(format("[ 's' Select secondary weapon($%d) ]", cost), row + 1, (wid * i + mgn));
2743 put_str("(Only highest damage applies per monster. Special damage not cumulative.)", row + 4, 0);
2744 prt("Based on your current abilities, here is what your weapons will do", 0, 0);
2752 if (total + cost > p_ptr->au)
2754 msg_print(_("お金が足りません!", "You don't have enough money!"));
2759 q = _("第二の武器は?", "What is your second weapon? ");
2760 s = _("比べるものがありません。", "You have nothing to compare.");
2762 /* Get the second weapon */
2763 o_ptr[1] = choose_object(&item2, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT));
2764 if (!o_ptr[1]) continue;
2782 * @brief ACから回避率、ダメージ減少率を計算し表示する。 / Evaluate AC
2784 * Calculate and display the dodge-rate and the protection-rate
2786 * @param iAC プレイヤーのAC。
2787 * @return 常にTRUEを返す。
2789 static bool eval_ac(ARMOUR_CLASS iAC)
2793 "ダメージ軽減率とは、敵の攻撃が当たった時そのダメージを\n"
2794 "何パーセント軽減するかを示します。\n"
2795 "ダメージ軽減は通常の直接攻撃(種類が「攻撃する」と「粉砕する」の物)\n"
2796 "に対してのみ効果があります。\n \n"
2797 "敵のレベルとは、その敵が通常何階に現れるかを示します。\n \n"
2798 "回避率は敵の直接攻撃を何パーセントの確率で避けるかを示し、\n"
2799 "敵のレベルとあなたのACによって決定されます。\n \n"
2800 "ダメージ期待値とは、敵の100ポイントの通常攻撃に対し、\n"
2801 "回避率とダメージ軽減率を考慮したダメージの期待値を示します。\n";
2804 "'Protection Rate' means how much damage is reduced by your armor.\n"
2805 "Note that the Protection rate is effective only against normal "
2806 "'attack' and 'shatter' type melee attacks, "
2807 "and has no effect against any other types such as 'poison'.\n \n"
2808 "'Dodge Rate' indicates the success rate on dodging the "
2809 "monster's melee attacks. "
2810 "It is depend on the level of the monster and your AC.\n \n"
2811 "'Average Damage' indicates the expected amount of damage "
2812 "when you are attacked by normal melee attacks with power=100.";
2816 TERM_LEN col, row = 2;
2818 char buf[80*20], *t;
2820 /* AC lower than zero has no effect */
2821 if (iAC < 0) iAC = 0;
2824 protection = 100 * MIN(iAC, 150) / 250;
2829 put_str(format(_("あなたの現在のAC: %3d", "Your current AC : %3d"), iAC), row++, 0);
2830 put_str(format(_("ダメージ軽減率 : %3d%%", "Protection rate : %3d%%"), protection), row++, 0);
2833 put_str(_("敵のレベル :", "Level of Monster:"), row + 0, 0);
2834 put_str(_("回避率 :", "Dodge Rate :"), row + 1, 0);
2835 put_str(_("ダメージ期待値 :", "Average Damage :"), row + 2, 0);
2837 for (col = 17 + 1, lvl = 0; lvl <= 100; lvl += 10, col += 5)
2839 int quality = 60 + lvl * 3; /* attack quality with power 60 */
2840 int dodge; /* 回避率(%) */
2841 int average; /* ダメージ期待値 */
2843 put_str(format("%3d", lvl), row + 0, col);
2846 dodge = 5 + (MIN(100, 100 * (iAC * 3 / 4) / quality) * 9 + 5) / 10;
2847 put_str(format("%3d%%", dodge), row + 1, col);
2849 /* 100点の攻撃に対してのダメージ期待値を計算 */
2850 average = (100 - dodge) * (100 - protection) / 100;
2851 put_str(format("%3d", average), row + 2, col);
2855 roff_to_buf(memo, 70, buf, sizeof(buf));
2856 for (t = buf; t[0]; t += strlen(t) + 1)
2857 put_str(t, (row++) + 4, 4);
2859 prt(_("現在のあなたの装備からすると、あなたの防御力はこれくらいです:", "Defense abilities from your current Armor Class are evaluated below."), 0, 0);
2871 * @brief 修復材料のオブジェクトから修復対象に特性を移植する。
2872 * @param to_ptr 修復対象オブジェクトの構造体の参照ポインタ。
2873 * @param from_ptr 修復材料オブジェクトの構造体の参照ポインタ。
2874 * @return 修復対象になるならTRUEを返す。
2876 static void give_one_ability_of_object(object_type *to_ptr, object_type *from_ptr)
2879 int cand[TR_FLAG_MAX];
2880 BIT_FLAGS to_flgs[TR_FLAG_SIZE];
2881 BIT_FLAGS from_flgs[TR_FLAG_SIZE];
2883 object_flags(to_ptr, to_flgs);
2884 object_flags(from_ptr, from_flgs);
2886 for (i = 0; i < TR_FLAG_MAX; i++)
2890 case TR_IGNORE_ACID:
2891 case TR_IGNORE_ELEC:
2892 case TR_IGNORE_FIRE:
2893 case TR_IGNORE_COLD:
2902 case TR_FIXED_FLAVOR:
2905 if (have_flag(from_flgs, i) && !have_flag(to_flgs, i))
2907 if (!(is_pval_flag(i) && (from_ptr->pval < 1))) cand[n++] = i;
2915 int tr_idx = cand[randint0(n)];
2916 add_flag(to_ptr->art_flags, tr_idx);
2917 if (is_pval_flag(tr_idx)) to_ptr->pval = MAX(to_ptr->pval, 1);
2918 bmax = MIN(3, MAX(1, 40 / (to_ptr->dd * to_ptr->ds)));
2919 if (tr_idx == TR_BLOWS) to_ptr->pval = MIN(to_ptr->pval, bmax);
2920 if (tr_idx == TR_SPEED) to_ptr->pval = MIN(to_ptr->pval, 4);
2927 * @brief アイテム修復処理のメインルーチン / Repair broken weapon
2928 * @param bcost 基本修復費用
2931 static PRICE repair_broken_weapon_aux(PRICE bcost)
2934 OBJECT_IDX item, mater;
2935 object_type *o_ptr, *mo_ptr; /* broken weapon and material weapon */
2937 int i, dd_bonus, ds_bonus;
2938 KIND_OBJECT_IDX k_idx;
2939 char basenm[MAX_NLEN];
2944 prt(_("修復には材料となるもう1つの武器が必要です。", "Hand one material weapon to repair a broken weapon."), row, 2);
2945 prt(_("材料に使用した武器はなくなります!", "The material weapon will disappear after repairing!!"), row+1, 2);
2947 q = _("どの折れた武器を修復しますか?", "Repair which broken weapon? ");
2948 s = _("修復できる折れた武器がありません。", "You have no broken weapon to repair.");
2950 /* Only forge broken weapons */
2951 item_tester_hook = item_tester_hook_broken_weapon;
2953 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP));
2954 if (!o_ptr) return (0);
2956 /* It is worthless */
2957 if (!object_is_ego(o_ptr) && !object_is_artifact(o_ptr))
2959 msg_format(_("それは直してもしょうがないぜ。", "It is worthless to repair."));
2963 /* They are too many */
2964 if (o_ptr->number > 1)
2966 msg_format(_("一度に複数を修復することはできません!", "They are too many to repair at once!"));
2970 /* Display item name */
2971 object_desc(basenm, o_ptr, OD_NAME_ONLY);
2972 prt(format(_("修復する武器 : %s", "Repairing: %s"), basenm), row+3, 2);
2974 q = _("材料となる武器は?", "Which weapon for material? ");
2975 s = _("材料となる武器がありません。", "You have no material to repair.");
2977 /* Only forge broken weapons */
2978 item_tester_hook = item_tester_hook_orthodox_melee_weapons;
2980 mo_ptr = choose_object(&mater, q, s, (USE_INVEN | USE_EQUIP));
2981 if (!mo_ptr) return (0);
2984 msg_print(_("クラインの壷じゃない!", "This is not a klein bottle!"));
2988 /* Display item name */
2989 object_desc(basenm, mo_ptr, OD_NAME_ONLY);
2990 prt(format(_("材料とする武器: %s", "Material : %s"), basenm), row+4, 2);
2992 /* Get the value of one of the items (except curses) */
2993 cost = bcost + object_value_real(o_ptr) * 2;
2995 if (!get_check(format(_("$%dかかりますがよろしいですか? ", "Costs %d gold, okay? "), cost))) return (0);
2997 /* Check if the player has enough money */
2998 if (p_ptr->au < cost)
3000 object_desc(basenm, o_ptr, OD_NAME_ONLY);
3001 msg_format(_("%sを修復するだけのゴールドがありません!", "You do not have the gold to repair %s!"), basenm);
3006 p_ptr->total_weight -= o_ptr->weight;
3008 if (o_ptr->sval == SV_BROKEN_DAGGER)
3013 /* Suppress compiler warning */
3016 for (j = 1; j < max_k_idx; j++)
3018 object_kind *k_aux_ptr = &k_info[j];
3020 if (k_aux_ptr->tval != TV_SWORD) continue;
3021 if ((k_aux_ptr->sval == SV_BROKEN_DAGGER) ||
3022 (k_aux_ptr->sval == SV_BROKEN_SWORD) ||
3023 (k_aux_ptr->sval == SV_DOKUBARI)) continue;
3024 if (k_aux_ptr->weight > 99) continue;
3033 else /* TV_BROKEN_SWORD */
3035 /* Repair to a sword or sometimes material's type weapon */
3036 OBJECT_TYPE_VALUE tval = (one_in_(5) ? mo_ptr->tval : TV_SWORD);
3040 object_kind *ck_ptr;
3042 k_idx = lookup_kind(tval, SV_ANY);
3043 ck_ptr = &k_info[k_idx];
3045 if (tval == TV_SWORD)
3047 if ((ck_ptr->sval == SV_BROKEN_DAGGER) ||
3048 (ck_ptr->sval == SV_BROKEN_SWORD) ||
3049 (ck_ptr->sval == SV_DIAMOND_EDGE) ||
3050 (ck_ptr->sval == SV_DOKUBARI)) continue;
3052 if (tval == TV_POLEARM)
3054 if ((ck_ptr->sval == SV_DEATH_SCYTHE) ||
3055 (ck_ptr->sval == SV_TSURIZAO)) continue;
3057 if (tval == TV_HAFTED)
3059 if ((ck_ptr->sval == SV_GROND) ||
3060 (ck_ptr->sval == SV_WIZSTAFF) ||
3061 (ck_ptr->sval == SV_NAMAKE_HAMMER)) continue;
3068 /* Calculate dice bonuses */
3069 dd_bonus = o_ptr->dd - k_info[o_ptr->k_idx].dd;
3070 ds_bonus = o_ptr->ds - k_info[o_ptr->k_idx].ds;
3071 dd_bonus += mo_ptr->dd - k_info[mo_ptr->k_idx].dd;
3072 ds_bonus += mo_ptr->ds - k_info[mo_ptr->k_idx].ds;
3074 /* Change base object */
3075 k_ptr = &k_info[k_idx];
3076 o_ptr->k_idx = k_idx;
3077 o_ptr->weight = k_ptr->weight;
3078 o_ptr->tval = k_ptr->tval;
3079 o_ptr->sval = k_ptr->sval;
3080 o_ptr->dd = k_ptr->dd;
3081 o_ptr->ds = k_ptr->ds;
3083 /* Copy base object's ability */
3084 for (i = 0; i < TR_FLAG_SIZE; i++) o_ptr->art_flags[i] |= k_ptr->flags[i];
3085 if (k_ptr->pval) o_ptr->pval = MAX(o_ptr->pval, randint1(k_ptr->pval));
3086 if (have_flag(k_ptr->flags, TR_ACTIVATE)) o_ptr->xtra2 = (byte_hack)k_ptr->act_idx;
3092 for (i = 1; i < dd_bonus; i++)
3094 if (one_in_(o_ptr->dd + i)) o_ptr->dd++;
3100 for (i = 1; i < ds_bonus; i++)
3102 if (one_in_(o_ptr->ds + i)) o_ptr->ds++;
3106 if (have_flag(k_ptr->flags, TR_BLOWS))
3108 int bmax = MIN(3, MAX(1, 40 / (o_ptr->dd * o_ptr->ds)));
3109 o_ptr->pval = MIN(o_ptr->pval, bmax);
3112 /* Add one random ability from material weapon */
3113 give_one_ability_of_object(o_ptr, mo_ptr);
3115 /* Add to-dam, to-hit and to-ac from material weapon */
3116 o_ptr->to_d += MAX(0, (mo_ptr->to_d / 3));
3117 o_ptr->to_h += MAX(0, (mo_ptr->to_h / 3));
3118 o_ptr->to_a += MAX(0, (mo_ptr->to_a));
3120 if ((o_ptr->name1 == ART_NARSIL) ||
3121 (object_is_random_artifact(o_ptr) && one_in_(1)) ||
3122 (object_is_ego(o_ptr) && one_in_(7)))
3125 if (object_is_ego(o_ptr))
3127 add_flag(o_ptr->art_flags, TR_IGNORE_FIRE);
3128 add_flag(o_ptr->art_flags, TR_IGNORE_ACID);
3131 /* Add one random ability from material weapon */
3132 give_one_ability_of_object(o_ptr, mo_ptr);
3134 /* Add one random activation */
3135 if (!activation_index(o_ptr)) one_activation(o_ptr);
3138 if (o_ptr->name1 == ART_NARSIL)
3140 one_high_resistance(o_ptr);
3144 msg_print(_("これはかなりの業物だったようだ。", "This blade seems to be exceptionally."));
3147 object_desc(basenm, o_ptr, OD_NAME_ONLY);
3149 msg_format("$%dで%sに修復しました。", cost, basenm);
3151 msg_format("Repaired into %s for %d gold.", basenm, cost);
3155 /* Remove BROKEN flag */
3156 o_ptr->ident &= ~(IDENT_BROKEN);
3158 /* Add repaired flag */
3159 o_ptr->discount = 99;
3161 p_ptr->total_weight += o_ptr->weight;
3164 /* Decrease material object */
3165 inven_item_increase(mater, -1);
3166 inven_item_optimize(mater);
3169 p_ptr->update |= PU_BONUS;
3172 /* Something happened */
3177 * @brief アイテム修復処理の過渡ルーチン / Repair broken weapon
3178 * @param bcost 基本鑑定費用
3181 static int repair_broken_weapon(PRICE bcost)
3185 cost = repair_broken_weapon_aux(bcost);
3192 * @brief アイテムの強化を行う。 / Enchant item
3193 * @param cost 1回毎の費用
3194 * @param to_hit 命中をアップさせる量
3195 * @param to_dam ダメージをアップさせる量
3196 * @param to_ac ACをアップさせる量
3197 * @return 実際に行ったらTRUE
3199 static bool enchant_item(PRICE cost, HIT_PROB to_hit, HIT_POINT to_dam, ARMOUR_CLASS to_ac)
3206 int maxenchant = (p_ptr->lev / 5);
3207 char tmp_str[MAX_NLEN];
3210 prt(format(_("現在のあなたの技量だと、+%d まで改良できます。", " Based on your skill, we can improve up to +%d."), maxenchant), 5, 0);
3211 prt(format(_(" 改良の料金は一個につき$%d です。", " The price for the service is %d gold per item."), cost), 7, 0);
3213 q = _("どのアイテムを改良しますか?", "Improve which item? ");
3214 s = _("改良できるものがありません。", "You have nothing to improve.");
3216 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP | IGNORE_BOTHHAND_SLOT));
3217 if (!o_ptr) return (FALSE);
3219 /* Check if the player has enough money */
3220 if (p_ptr->au < (cost * o_ptr->number))
3222 object_desc(tmp_str, o_ptr, OD_NAME_ONLY);
3223 msg_format(_("%sを改良するだけのゴールドがありません!", "You do not have the gold to improve %s!"), tmp_str);
3227 /* Enchant to hit */
3228 for (i = 0; i < to_hit; i++)
3230 if (o_ptr->to_h < maxenchant)
3232 if (enchant(o_ptr, 1, (ENCH_TOHIT | ENCH_FORCE)))
3240 /* Enchant to damage */
3241 for (i = 0; i < to_dam; i++)
3243 if (o_ptr->to_d < maxenchant)
3245 if (enchant(o_ptr, 1, (ENCH_TODAM | ENCH_FORCE)))
3254 for (i = 0; i < to_ac; i++)
3256 if (o_ptr->to_a < maxenchant)
3258 if (enchant(o_ptr, 1, (ENCH_TOAC | ENCH_FORCE)))
3269 if (flush_failure) flush();
3270 msg_print(_("改良に失敗した。", "The improvement failed."));
3275 object_desc(tmp_str, o_ptr, OD_NAME_AND_ENCHANT);
3277 msg_format("$%dで%sに改良しました。", cost * o_ptr->number, tmp_str);
3279 msg_format("Improved into %s for %d gold.", tmp_str, cost * o_ptr->number);
3282 /* Charge the money */
3283 p_ptr->au -= (cost * o_ptr->number);
3285 if (item >= INVEN_RARM) calc_android_exp();
3287 /* Something happened */
3294 * @brief 魔道具の使用回数を回復させる施設のメインルーチン / Recharge rods, wands and staves
3296 * The player can select the number of charges to add\n
3297 * (up to a limit), and the recharge never fails.\n
3299 * The cost for rods depends on the level of the rod. The prices\n
3300 * for recharging wands and staves are dependent on the cost of\n
3304 static void building_recharge(void)
3312 PARAMETER_VALUE charges;
3314 char tmp_str[MAX_NLEN];
3318 /* Display some info */
3320 prt(_(" 再充填の費用はアイテムの種類によります。", " The prices of recharge depend on the type."), 6, 0);
3323 /* Only accept legal items */
3324 item_tester_hook = item_tester_hook_recharge;
3326 q = _("どのアイテムに魔力を充填しますか? ", "Recharge which item? ");
3327 s = _("魔力を充填すべきアイテムがない。", "You have nothing to recharge.");
3329 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
3332 k_ptr = &k_info[o_ptr->k_idx];
3335 * We don't want to give the player free info about
3336 * the level of the item or the number of charges.
3338 /* The item must be "known" */
3339 if (!object_is_known(o_ptr))
3341 msg_format(_("充填する前に鑑定されている必要があります!", "The item must be identified first!"));
3344 if ((p_ptr->au >= 50) &&
3345 get_check(_("$50で鑑定しますか? ", "Identify for 50 gold? ")))
3349 identify_item(o_ptr);
3350 object_desc(tmp_str, o_ptr, 0);
3351 msg_format(_("%s です。", "You have: %s."), tmp_str);
3353 /* Auto-inscription */
3354 autopick_alter_item(item, FALSE);
3356 /* Update the gold display */
3357 building_prt_gold();
3365 /* Extract the object "level" */
3366 lev = k_info[o_ptr->k_idx].level;
3368 /* Price for a rod */
3369 if (o_ptr->tval == TV_ROD)
3371 if (o_ptr->timeout > 0)
3373 /* Fully recharge */
3374 price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
3378 /* No recharge necessary */
3380 msg_format(_("それは再充填する必要はありません。", "That doesn't need to be recharged."));
3384 else if (o_ptr->tval == TV_STAFF)
3386 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3387 price = (k_info[o_ptr->k_idx].cost / 10) * o_ptr->number;
3389 /* Pay at least 10 gold per charge */
3390 price = MAX(10, price);
3394 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3395 price = (k_info[o_ptr->k_idx].cost / 10);
3397 /* Pay at least 10 gold per charge */
3398 price = MAX(10, price);
3401 /* Limit the number of charges for wands and staffs */
3402 if (o_ptr->tval == TV_WAND
3403 && (o_ptr->pval / o_ptr->number >= k_ptr->pval))
3405 if (o_ptr->number > 1)
3407 msg_print(_("この魔法棒はもう充分に充填されています。", "These wands are already fully charged."));
3411 msg_print(_("この魔法棒はもう充分に充填されています。", "This wand is already fully charged."));
3415 else if (o_ptr->tval == TV_STAFF && o_ptr->pval >= k_ptr->pval)
3417 if (o_ptr->number > 1)
3419 msg_print(_("この杖はもう充分に充填されています。", "These staffs are already fully charged."));
3423 msg_print(_("この杖はもう充分に充填されています。", "This staff is already fully charged."));
3428 /* Check if the player has enough money */
3429 if (p_ptr->au < price)
3431 object_desc(tmp_str, o_ptr, OD_NAME_ONLY);
3433 msg_format("%sを再充填するには$%d 必要です!", tmp_str,price );
3435 msg_format("You need %d gold to recharge %s!", price, tmp_str);
3441 if (o_ptr->tval == TV_ROD)
3444 if (get_check(format("そのロッドを$%d で再充填しますか?", price)))
3446 if (get_check(format("Recharge the %s for %d gold? ",
3447 ((o_ptr->number > 1) ? "rods" : "rod"), price)))
3451 /* Recharge fully */
3461 if (o_ptr->tval == TV_STAFF)
3462 max_charges = k_ptr->pval - o_ptr->pval;
3464 max_charges = o_ptr->number * k_ptr->pval - o_ptr->pval;
3466 /* Get the quantity for staves and wands */
3467 charges = (PARAMETER_VALUE)get_quantity(format(_("一回分$%d で何回分充填しますか?", "Add how many charges for %d gold? "), price),
3468 MIN(p_ptr->au / price, max_charges));
3471 if (charges < 1) return;
3473 /* Get the new price */
3477 o_ptr->pval += charges;
3479 /* We no longer think the item is empty */
3480 o_ptr->ident &= ~(IDENT_EMPTY);
3484 object_desc(tmp_str, o_ptr, 0);
3486 msg_format("%sを$%d で再充填しました。", tmp_str, price);
3488 msg_format("%^s %s recharged for %d gold.", tmp_str, ((o_ptr->number > 1) ? "were" : "was"), price);
3490 p_ptr->update |= (PU_COMBINE | PU_REORDER);
3492 p_ptr->window |= (PW_INVEN);
3503 * @brief 魔道具の使用回数を回復させる施設の一括処理向けサブルーチン / Recharge rods, wands and staves
3505 * The player can select the number of charges to add\n
3506 * (up to a limit), and the recharge never fails.\n
3508 * The cost for rods depends on the level of the rod. The prices\n
3509 * for recharging wands and staves are dependent on the cost of\n
3513 static void building_recharge_all(void)
3520 PRICE total_cost = 0;
3523 /* Display some info */
3526 prt(_(" 再充填の費用はアイテムの種類によります。", " The prices of recharge depend on the type."), 6, 0);
3528 /* Calculate cost */
3529 for ( i = 0; i < INVEN_PACK; i++)
3531 o_ptr = &inventory[i];
3533 /* skip non magic device */
3534 if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
3536 /* need identified */
3537 if (!object_is_known(o_ptr)) total_cost += 50;
3539 /* Extract the object "level" */
3540 lev = k_info[o_ptr->k_idx].level;
3542 k_ptr = &k_info[o_ptr->k_idx];
3544 switch (o_ptr->tval)
3547 price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
3551 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3552 price = (k_info[o_ptr->k_idx].cost / 10) * o_ptr->number;
3554 /* Pay at least 10 gold per charge */
3555 price = MAX(10, price);
3558 price = (k_ptr->pval - o_ptr->pval) * price;
3562 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3563 price = (k_info[o_ptr->k_idx].cost / 10);
3565 /* Pay at least 10 gold per charge */
3566 price = MAX(10, price);
3569 price = (o_ptr->number * k_ptr->pval - o_ptr->pval) * price;
3573 /* if price <= 0 then item have enough charge */
3574 if (price > 0) total_cost += price;
3579 msg_print(_("充填する必要はありません。", "No need to recharge."));
3584 /* Check if the player has enough money */
3585 if (p_ptr->au < total_cost)
3587 msg_format(_("すべてのアイテムを再充填するには$%d 必要です!", "You need %d gold to recharge all items!"), total_cost );
3591 if (!get_check(format(_("すべてのアイテムを $%d で再充填しますか?", "Recharge all items for %d gold? "), total_cost))) return;
3593 for (i = 0; i < INVEN_PACK; i++)
3595 o_ptr = &inventory[i];
3596 k_ptr = &k_info[o_ptr->k_idx];
3598 /* skip non magic device */
3599 if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
3601 if (!object_is_known(o_ptr))
3603 identify_item(o_ptr);
3605 /* Auto-inscription */
3606 autopick_alter_item(i, FALSE);
3610 switch (o_ptr->tval)
3616 if (o_ptr->pval < k_ptr->pval) o_ptr->pval = k_ptr->pval;
3617 /* We no longer think the item is empty */
3618 o_ptr->ident &= ~(IDENT_EMPTY);
3621 if (o_ptr->pval < o_ptr->number * k_ptr->pval)
3622 o_ptr->pval = o_ptr->number * k_ptr->pval;
3623 /* We no longer think the item is empty */
3624 o_ptr->ident &= ~(IDENT_EMPTY);
3630 msg_format(_("$%d で再充填しました。", "You pay %d gold."), total_cost);
3632 p_ptr->update |= (PU_COMBINE | PU_REORDER);
3634 p_ptr->window |= (PW_INVEN);
3637 p_ptr->au -= total_cost;
3644 * @brief 町間のテレポートを行うメインルーチン。
3645 * @return テレポート処理を決定したか否か
3647 bool tele_town(void)
3655 msg_print(_("この魔法は地上でしか使えない!", "This spell can only be used on the surface!"));
3659 if (p_ptr->inside_arena || p_ptr->inside_battle)
3661 msg_print(_("この魔法は外でしか使えない!", "This spell can only be used outside!"));
3668 for (i = 1; i < max_towns; i++)
3672 if ((i == NO_TOWN) || (i == SECRET_TOWN) || (i == p_ptr->town_num) || !(p_ptr->visit & (1L << (i - 1)))) continue;
3674 sprintf(buf, "%c) %-20s", I2A(i - 1), town_info[i].name);
3681 msg_print(_("まだ行けるところがない。", "You have not yet visited any town."));
3687 prt(_("どこに行きますか:", "Which town you go: "), 0, 0);
3697 else if ((i < 'a') || (i > ('a'+max_towns-2))) continue;
3698 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;
3702 for (y = 0; y < max_wild_y; y++)
3704 for (x = 0; x < max_wild_x; x++)
3706 if(wilderness[y][x].town == (i-'a'+1))
3708 p_ptr->wilderness_y = y;
3709 p_ptr->wilderness_x = x;
3714 p_ptr->leaving = TRUE;
3716 p_ptr->teleport_town = TRUE;
3722 * @brief 施設でモンスターの情報を知るメインルーチン / research_mon -KMW-
3723 * @return 常にTRUEを返す。
3724 * @todo 返り値が意味不明なので直した方が良いかもしれない。
3726 static bool research_mon(void)
3734 bool recall = FALSE;
3738 /* XTRA HACK WHATSEARCH */
3744 /* XTRA HACK REMEMBER_IDX */
3745 static int old_sym = '\0';
3746 static IDX old_i = 0;
3750 /* Get a character, or abort */
3751 if (!get_com(_("モンスターの文字を入力して下さい(記号 or ^A全,^Uユ,^N非ユ,^M名前):",
3752 "Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): "), &sym, FALSE))
3760 /* Find that character info, and describe it */
3761 for (i = 0; ident_info[i]; ++i)
3763 if (sym == ident_info[i][0]) break;
3766 /* XTRA HACK WHATSEARCH */
3767 if (sym == KTRL('A'))
3770 strcpy(buf, _("全モンスターのリスト", "Full monster list."));
3772 else if (sym == KTRL('U'))
3775 strcpy(buf, _("ユニーク・モンスターのリスト", "Unique monster list."));
3777 else if (sym == KTRL('N'))
3780 strcpy(buf, _("ユニーク外モンスターのリスト", "Non-unique monster list."));
3782 else if (sym == KTRL('M'))
3785 if (!get_string(_("名前(英語の場合小文字で可)", "Enter name:"),temp, 70))
3792 sprintf(buf, _("名前:%sにマッチ", "Monsters with a name \"%s\""),temp);
3794 else if (ident_info[i])
3796 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
3800 sprintf(buf, "%c - %s", sym, _("無効な文字", "Unknown Symbol"));
3803 /* Display the result */
3806 /* Allocate the "who" array */
3807 C_MAKE(who, max_r_idx, MONRACE_IDX);
3809 /* Collect matching monsters */
3810 for (n = 0, i = 1; i < max_r_idx; i++)
3812 monster_race *r_ptr = &r_info[i];
3815 if (!r_ptr->name) continue;
3817 /* XTRA HACK WHATSEARCH */
3818 /* Require non-unique monsters if needed */
3819 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
3821 /* Require unique monsters if needed */
3822 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
3830 for (xx = 0; temp[xx] && xx < 80; xx++)
3833 if (iskanji(temp[xx]))
3839 if (isupper(temp[xx])) temp[xx] = (char)tolower(temp[xx]);
3843 strcpy(temp2, r_name + r_ptr->E_name);
3845 strcpy(temp2, r_name + r_ptr->name);
3847 for (xx = 0; temp2[xx] && xx < 80; xx++)
3848 if (isupper(temp2[xx])) temp2[xx] = (char)tolower(temp2[xx]);
3851 if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
3853 if (my_strstr(temp2, temp))
3857 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
3860 /* Nothing to recall */
3863 /* Free the "who" array */
3864 C_KILL(who, max_r_idx, MONRACE_IDX);
3874 /* Sort if needed */
3877 /* Select the sort method */
3878 ang_sort_comp = ang_sort_comp_hook;
3879 ang_sort_swap = ang_sort_swap_hook;
3881 /* Sort the array */
3882 ang_sort(who, &why, n);
3886 /* Start at the end */
3887 /* XTRA HACK REMEMBER_IDX */
3888 if (old_sym == sym && old_i < n) i = old_i;
3893 /* Scan the monster memory */
3896 /* Extract a race */
3899 /* Hack -- Begin the prompt */
3902 /* Hack -- Complete the prompt */
3903 Term_addstr(-1, TERM_WHITE, _(" ['r'思い出, ' 'で続行, ESC]", " [(r)ecall, ESC, space to continue]"));
3911 /*** Recall on screen ***/
3913 /* Get maximal info about this monster */
3914 lore_do_probe(r_idx);
3916 /* Save this monster ID */
3917 monster_race_track(r_idx);
3920 /* know every thing mode */
3921 screen_roff(r_idx, 0x01);
3924 /* XTRA HACK REMEMBER_IDX */
3932 /* Normal commands */
3933 if (query != 'r') break;
3940 if (query == ESCAPE) break;
3942 /* Move to "prev" monster */
3948 if (!expand_list) break;
3952 /* Move to "next" monster */
3958 if (!expand_list) break;
3964 /* Re-display the identity */
3965 /* prt(buf, 5, 5);*/
3967 /* Free the "who" array */
3968 C_KILL(who, max_r_idx, MONRACE_IDX);
3971 return (!notpicked);
3976 * @brief 施設の処理実行メインルーチン / Execute a building command
3977 * @param bldg 施設構造体の参照ポインタ
3978 * @param i 実行したい施設のサービステーブルの添字
3981 static void bldg_process_command(building_type *bldg, int i)
3983 BACT_IDX bact = bldg->actions[i];
3991 bcost = bldg->member_costs[i];
3993 bcost = bldg->other_costs[i];
3995 /* action restrictions */
3996 if (((bldg->action_restr[i] == 1) && !is_member(bldg)) ||
3997 ((bldg->action_restr[i] == 2) && !is_owner(bldg)))
3999 msg_print(_("それを選択する権利はありません!", "You have no right to choose that!"));
4003 /* check gold (HACK - Recharge uses variable costs) */
4004 if ((bact != BACT_RECHARGE) &&
4005 (((bldg->member_costs[i] > p_ptr->au) && is_owner(bldg)) ||
4006 ((bldg->other_costs[i] > p_ptr->au) && !is_owner(bldg))))
4008 msg_print(_("お金が足りません!", "You do not have the gold!"));
4017 case BACT_RESEARCH_ITEM:
4018 paid = identify_fully(FALSE);
4020 case BACT_TOWN_HISTORY:
4023 case BACT_RACE_LEGENDS:
4029 case BACT_KING_LEGENDS:
4030 case BACT_ARENA_LEGENDS:
4035 case BACT_ARENA_RULES:
4039 case BACT_IN_BETWEEN:
4041 case BACT_SPIN_WHEEL:
4042 case BACT_DICE_SLOTS:
4043 case BACT_GAMBLE_RULES:
4050 paid = inn_comm(bact);
4052 case BACT_RESEARCH_MONSTER:
4053 paid = research_mon();
4055 case BACT_COMPARE_WEAPONS:
4057 bcost = compare_weapons(bcost);
4059 case BACT_ENCHANT_WEAPON:
4060 item_tester_hook = object_allow_enchant_melee_weapon;
4061 enchant_item(bcost, 1, 1, 0);
4063 case BACT_ENCHANT_ARMOR:
4064 item_tester_hook = object_is_armour;
4065 enchant_item(bcost, 0, 0, 1);
4068 building_recharge();
4070 case BACT_RECHARGE_ALL:
4071 building_recharge_all();
4073 case BACT_IDENTS: /* needs work */
4074 if (!get_check(_("持ち物を全て鑑定してよろしいですか?", "Do you pay for identify all your possession? "))) break;
4076 msg_print(_(" 持ち物全てが鑑定されました。", "Your possessions have been identified."));
4079 case BACT_IDENT_ONE: /* needs work */
4080 paid = ident_spell(FALSE);
4085 case BACT_HEALING: /* needs work */
4086 paid = cure_critical_wounds(200);
4088 case BACT_RESTORE: /* needs work */
4089 paid = restore_all_status();
4091 case BACT_ENCHANT_ARROWS:
4092 item_tester_hook = item_tester_hook_ammo;
4093 enchant_item(bcost, 1, 1, 0);
4095 case BACT_ENCHANT_BOW:
4096 item_tester_tval = TV_BOW;
4097 enchant_item(bcost, 1, 1, 0);
4101 if (recall_player(p_ptr, 1)) paid = TRUE;
4104 case BACT_TELEPORT_LEVEL:
4106 paid = free_level_recall(p_ptr);
4109 case BACT_LOSE_MUTATION:
4110 if (p_ptr->muta1 || p_ptr->muta2 || (p_ptr->muta3 & ~MUT3_GOOD_LUCK) ||
4111 (p_ptr->pseikaku != SEIKAKU_LUCKY && (p_ptr->muta3 & MUT3_GOOD_LUCK)))
4113 while(!lose_mutation(0));
4118 msg_print(_("治すべき突然変異が無い。", "You have no mutations."));
4127 case BACT_TSUCHINOKO:
4144 msg_print(_("平衡化の儀式を行なった。", "You received an equalization ritual."));
4145 set_virtue(V_COMPASSION, 0);
4146 set_virtue(V_HONOUR, 0);
4147 set_virtue(V_JUSTICE, 0);
4148 set_virtue(V_SACRIFICE, 0);
4149 set_virtue(V_KNOWLEDGE, 0);
4150 set_virtue(V_FAITH, 0);
4151 set_virtue(V_ENLIGHTEN, 0);
4152 set_virtue(V_ENCHANT, 0);
4153 set_virtue(V_CHANCE, 0);
4154 set_virtue(V_NATURE, 0);
4155 set_virtue(V_HARMONY, 0);
4156 set_virtue(V_VITALITY, 0);
4157 set_virtue(V_UNLIFE, 0);
4158 set_virtue(V_PATIENCE, 0);
4159 set_virtue(V_TEMPERANCE, 0);
4160 set_virtue(V_DILIGENCE, 0);
4161 set_virtue(V_VALOUR, 0);
4162 set_virtue(V_INDIVIDUALISM, 0);
4167 case BACT_TELE_TOWN:
4172 paid = eval_ac(p_ptr->dis_ac + p_ptr->dis_to_a);
4175 case BACT_BROKEN_WEAPON:
4177 bcost = repair_broken_weapon(bcost);
4188 * @brief クエスト入り口にプレイヤーが乗った際の処理 / Do building commands
4191 void do_cmd_quest(void)
4193 if(p_ptr->wild_mode) return;
4195 take_turn(p_ptr, 100);;
4197 if (!cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_QUEST_ENTER))
4199 msg_print(_("ここにはクエストの入口はない。", "You see no quest level here."));
4204 msg_print(_("ここにはクエストへの入口があります。", "There is an entry of a quest."));
4205 if (!get_check(_("クエストに入りますか?", "Do you enter? "))) return;
4206 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
4207 msg_print(_("『とにかく入ってみようぜぇ。』", ""));
4208 else if(p_ptr->pseikaku == SEIKAKU_CHARGEMAN) msg_print("『全滅してやるぞ!』");
4210 /* Player enters a new quest */
4214 leave_quest_check();
4216 if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM) dun_level = 1;
4217 p_ptr->inside_quest = grid_array[p_ptr->y][p_ptr->x].special;
4219 p_ptr->leaving = TRUE;
4225 * @brief 施設入り口にプレイヤーが乗った際の処理 / Do building commands
4228 void do_cmd_bldg(void)
4233 building_type *bldg;
4235 if(p_ptr->wild_mode) return;
4237 take_turn(p_ptr, 100);;
4239 if (!cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_BLDG))
4241 msg_print(_("ここには建物はない。", "You see no building here."));
4245 which = f_info[grid_array[p_ptr->y][p_ptr->x].feat].subtype;
4247 bldg = &building[which];
4249 /* Don't re-init the wilderness */
4250 reinit_wilderness = FALSE;
4252 if ((which == 2) && (p_ptr->arena_number < 0))
4254 msg_print(_("「敗者に用はない。」", "'There's no place here for a LOSER like you!'"));
4257 else if ((which == 2) && p_ptr->inside_arena)
4259 if (!p_ptr->exit_bldg && m_cnt > 0)
4261 prt(_("ゲートは閉まっている。モンスターがあなたを待っている!", "The gates are closed. The monster awaits!"), 0, 0);
4265 /* Don't save the arena as saved floor */
4266 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_NO_RETURN);
4268 p_ptr->inside_arena = FALSE;
4269 p_ptr->leaving = TRUE;
4271 /* Re-enter the arena */
4272 command_new = SPECIAL_KEY_BUILDING;
4274 /* No energy needed to re-enter the arena */
4280 else if (p_ptr->inside_battle)
4282 /* Don't save the arena as saved floor */
4283 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_NO_RETURN);
4285 p_ptr->leaving = TRUE;
4286 p_ptr->inside_battle = FALSE;
4288 /* Re-enter the monster arena */
4289 command_new = SPECIAL_KEY_BUILDING;
4291 /* No energy needed to re-enter the arena */
4298 p_ptr->oldpy = p_ptr->y;
4299 p_ptr->oldpx = p_ptr->x;
4305 /* Hack -- Increase "icky" depth */
4312 show_building(bldg);
4315 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_BUILD);
4322 building_prt_gold();
4326 if (command == ESCAPE)
4329 p_ptr->inside_arena = FALSE;
4330 p_ptr->inside_battle = FALSE;
4334 for (i = 0; i < 8; i++)
4336 if (bldg->letters[i])
4338 if (bldg->letters[i] == command)
4346 if(validcmd) bldg_process_command(bldg, i);
4351 select_floor_music();
4356 /* Reinit wilderness to activate quests ... */
4357 if (reinit_wilderness)
4359 p_ptr->leaving = TRUE;
4362 /* Hack -- Decrease "icky" depth */
4367 p_ptr->update |= (PU_VIEW | PU_MONSTERS | PU_BONUS | PU_LITE | PU_MON_LITE);
4368 p_ptr->redraw |= (PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
4369 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);