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
19 #include "floor-events.h"
20 #include "floor-save.h"
21 #include "object-boost.h"
22 #include "object-flavor.h"
23 #include "object-hook.h"
25 #include "monsterrace-hook.h"
36 #include "cmd-spell.h"
38 #include "player-status.h"
40 #include "spells-status.h"
41 #include "realm-hex.h"
42 #include "dungeon-file.h"
45 #include "player-effects.h"
48 #include "view-mainwindow.h"
51 * @brief 闘技場のモンスターID及び報酬アイテムテーブル
53 const arena_type arena_info[MAX_ARENA_MONS + 2] =
55 { MON_NOBORTA, TV_AMULET, SV_AMULET_ADORNMENT },
56 { MON_MORI_TROLL, TV_FOOD, SV_FOOD_PINT_OF_WINE },
57 { MON_IMP, TV_POTION, SV_POTION_SPEED },
58 { MON_LION_HEART, 0, 0 },
59 { MON_MASTER_YEEK, TV_POTION, SV_POTION_CURING },
60 { MON_SABRE_TIGER, TV_WAND, SV_WAND_STONE_TO_MUD },
61 { MON_LIZARD_KING, TV_WAND, SV_WAND_TELEPORT_AWAY },
62 { MON_WYVERN, TV_POTION, SV_POTION_HEALING },
63 { MON_ARCH_VILE, TV_POTION, SV_POTION_RESISTANCE },
64 { MON_ELF_LORD , TV_POTION, SV_POTION_ENLIGHTENMENT },
65 { MON_GHOUL_KING, TV_FOOD, SV_FOOD_RESTORING },
66 { MON_COLBRAN, TV_RING, SV_RING_ELEC },
67 { MON_BICLOPS, TV_WAND, SV_WAND_ACID_BALL },
68 { MON_M_MINDCRAFTER, TV_POTION, SV_POTION_SELF_KNOWLEDGE },
69 { MON_GROO, TV_SCROLL, SV_SCROLL_ACQUIREMENT },
70 { MON_RAAL, TV_SCROLL, SV_SCROLL_STAR_DESTRUCTION },
71 { MON_DREADMASTER, TV_WAND, SV_WAND_HYPODYNAMIA },
72 { MON_ULTRA_PALADIN, TV_STAFF, SV_STAFF_DISPEL_EVIL },
73 { MON_BARNEY, TV_RING, SV_RING_RES_CHAOS },
74 { MON_TROLL_KING, TV_SCROLL, SV_SCROLL_MASS_GENOCIDE },
75 { MON_BARON_HELL, TV_POTION, SV_POTION_AUGMENTATION },
76 { MON_F_ANGEL, TV_SCROLL, SV_SCROLL_RUNE_OF_PROTECTION },
77 { MON_G_C_DRAKE, TV_WAND, SV_WAND_DRAGON_FIRE },
78 { MON_IRON_LICH, TV_STAFF, SV_STAFF_DESTRUCTION },
79 { MON_DROLEM, TV_POTION, SV_POTION_STAR_HEALING },
80 { MON_G_TITAN, TV_WAND, SV_WAND_GENOCIDE },
81 { MON_G_BALROG, TV_POTION, SV_POTION_EXPERIENCE },
82 { MON_ELDER_VAMPIRE, TV_RING, SV_RING_SUSTAIN },
83 { MON_NIGHTWALKER, TV_WAND, SV_WAND_STRIKING },
84 { MON_S_TYRANNO, TV_SCROLL, SV_SCROLL_STAR_ACQUIREMENT },
85 { MON_G_MASTER_MYS, TV_ROD, SV_ROD_IDENTIFY },
86 { MON_LORD_CHAOS, TV_POTION, SV_POTION_LIFE },
87 { MON_SHADOWLORD, TV_POTION, SV_POTION_STAR_ENLIGHTENMENT },
88 { MON_ULT_BEHOLDER, TV_AMULET, SV_AMULET_REFLECTION },
89 { MON_JABBERWOCK, TV_ROD, SV_ROD_HEALING },
90 { MON_LOCKE_CLONE, TV_WAND, SV_WAND_DISINTEGRATE },
91 { MON_WYRM_SPACE, TV_ROD, SV_ROD_RESTORATION },
92 { MON_SHAMBLER, TV_SCROLL, SV_SCROLL_STAR_ACQUIREMENT },
93 { MON_BLACK_REAVER, TV_RING, SV_RING_LORDLY },
94 { MON_FENGHUANG, TV_STAFF, SV_STAFF_THE_MAGI },
95 { MON_WYRM_POWER, TV_SCROLL, SV_SCROLL_ARTIFACT },
96 { 0, 0, 0 }, /* Victory prizing */
97 { MON_HAGURE, TV_SCROLL, SV_SCROLL_ARTIFACT },
102 * ループ中で / hack as in leave_store in store.c
104 static bool leave_bldg = FALSE;
107 * @brief 施設毎に設定された種族、職業、魔法領域フラグがプレイヤーと一致するかを判定する。
108 * @details 各種ギルドや寺院など、特定の職業ならば優遇措置を得られる施設、
109 * あるいは食堂など特定の種族では利用できない施設の判定処理を行う。
110 * @param bldg 施設構造体の参照ポインタ
111 * @return 種族、職業、魔法領域のいずれかが一致しているかの是非。
113 static bool is_owner(building_type *bldg)
115 if (bldg->member_class[p_ptr->pclass] == BUILDING_OWNER)
120 if (bldg->member_race[p_ptr->prace] == BUILDING_OWNER)
125 if ((is_magic(p_ptr->realm1) && (bldg->member_realm[p_ptr->realm1] == BUILDING_OWNER)) ||
126 (is_magic(p_ptr->realm2) && (bldg->member_realm[p_ptr->realm2] == BUILDING_OWNER)))
135 * @brief 施設毎に設定された種族、職業、魔法領域フラグがプレイヤーと一致するかを判定する。
137 * @details 各種ギルドや寺院など、特定の職業ならば優遇措置を得られる施設、
138 * あるいは食堂など特定の種族では利用できない施設の判定処理を行う。
139 * @param bldg 施設構造体の参照ポインタ
140 * @return 種族、職業、魔法領域のいずれかが一致しているかの是非。
141 * @todo is_owner()との実質的な多重実装なので、リファクタリングを行うべきである。
143 static bool is_member(building_type *bldg)
145 if (bldg->member_class[p_ptr->pclass])
150 if (bldg->member_race[p_ptr->prace])
155 if ((is_magic(p_ptr->realm1) && bldg->member_realm[p_ptr->realm1]) ||
156 (is_magic(p_ptr->realm2) && bldg->member_realm[p_ptr->realm2]))
162 if (p_ptr->pclass == CLASS_SORCERER)
166 for (i = 0; i < MAX_MAGIC; i++)
168 if (bldg->member_realm[i+1]) OK = TRUE;
176 * @brief コンソールに表示された施設に関する情報を消去する / Clear the building information
177 * @details 消去は行毎にヌル文字列で行われる。
178 * @param min_row 開始行番号
179 * @param max_row 末尾行番号
182 static void clear_bldg(int min_row, int max_row)
186 for (i = min_row; i <= max_row; i++)
194 static void building_prt_gold(void)
197 prt(_("手持ちのお金: ", "Gold Remaining: "), 23,53);
198 sprintf(tmp_str, "%9ld", (long)p_ptr->au);
199 prt(tmp_str, 23, 68);
203 * @brief 施設のサービス一覧を表示する / Display a building.
204 * @param bldg 施設構造体の参照ポインタ
207 static void show_building(building_type* bldg)
215 sprintf(tmp_str, "%s (%s) %35s", bldg->owner_name, bldg->owner_race, bldg->name);
219 for (i = 0; i < 8; i++)
221 if (bldg->letters[i])
223 if (bldg->action_restr[i] == 0)
225 if ((is_owner(bldg) && (bldg->member_costs[i] == 0)) ||
226 (!is_owner(bldg) && (bldg->other_costs[i] == 0)))
228 action_color = TERM_WHITE;
231 else if (is_owner(bldg))
233 action_color = TERM_YELLOW;
234 sprintf(buff, _("($%ld)", "(%ldgp)"), (long int)bldg->member_costs[i]);
238 action_color = TERM_YELLOW;
239 sprintf(buff, _("($%ld)", "(%ldgp)"), (long int)bldg->other_costs[i]); }
241 else if (bldg->action_restr[i] == 1)
243 if (!is_member(bldg))
245 action_color = TERM_L_DARK;
246 strcpy(buff, _("(閉店)", "(closed)"));
248 else if ((is_owner(bldg) && (bldg->member_costs[i] == 0)) ||
249 (is_member(bldg) && (bldg->other_costs[i] == 0)))
251 action_color = TERM_WHITE;
254 else if (is_owner(bldg))
256 action_color = TERM_YELLOW;
257 sprintf(buff, _("($%ld)", "(%ldgp)"), (long int)bldg->member_costs[i]);
261 action_color = TERM_YELLOW;
262 sprintf(buff, _("($%ld)", "(%ldgp)"), (long int)bldg->other_costs[i]);
269 action_color = TERM_L_DARK;
270 strcpy(buff, _("(閉店)", "(closed)"));
272 else if (bldg->member_costs[i] != 0)
274 action_color = TERM_YELLOW;
275 sprintf(buff, _("($%ld)", "(%ldgp)"), (long int)bldg->member_costs[i]);
279 action_color = TERM_WHITE;
284 sprintf(tmp_str," %c) %s %s", bldg->letters[i], bldg->act_names[i], buff);
285 c_put_str(action_color, tmp_str, 19+(i/2), 35*(i%2));
288 prt(_(" ESC) 建物を出る", " ESC) Exit building"), 23, 0);
292 * @brief 闘技場に入るコマンドの処理 / arena commands
293 * @param cmd 闘技場処理のID
296 static void arena_comm(int cmd)
305 if (p_ptr->arena_number == MAX_ARENA_MONS)
308 prt(_("アリーナの優勝者!", " Arena Victor!"), 5, 0);
309 prt(_("おめでとう!あなたは全ての敵を倒しました。", "Congratulations! You have defeated all before you."), 7, 0);
310 prt(_("賞金として $1,000,000 が与えられます。", "For that, receive the prize: 1,000,000 gold pieces"), 8, 0);
314 p_ptr->au += 1000000L;
315 msg_print(_("スペースキーで続行", "Press the space bar to continue"));
317 p_ptr->arena_number++;
319 else if (p_ptr->arena_number > MAX_ARENA_MONS)
321 if (p_ptr->arena_number < MAX_ARENA_MONS+2)
323 msg_print(_("君のために最強の挑戦者を用意しておいた。", "The strongest challenger is waiting for you."));
325 if (get_check(_("挑戦するかね?", "Do you fight? ")))
327 msg_print(_("死ぬがよい。", "Die, maggots."));
330 p_ptr->exit_bldg = FALSE;
333 /* Save the surface floor as saved floor */
334 prepare_change_floor_mode(CFM_SAVE_FLOORS);
336 p_ptr->inside_arena = TRUE;
337 p_ptr->leaving = TRUE;
342 msg_print(_("残念だ。", "We are disappointed."));
347 msg_print(_("あなたはアリーナに入り、しばらくの間栄光にひたった。",
348 "You enter the arena briefly and bask in your glory."));
352 else if (p_ptr->riding && (p_ptr->pclass != CLASS_BEASTMASTER) && (p_ptr->pclass != CLASS_CAVALRY))
354 msg_print(_("ペットに乗ったままではアリーナへ入れさせてもらえなかった。",
355 "You don't have permission to enter with pet."));
360 p_ptr->exit_bldg = FALSE;
363 /* Save the surface floor as saved floor */
364 prepare_change_floor_mode(CFM_SAVE_FLOORS);
366 p_ptr->inside_arena = TRUE;
367 p_ptr->leaving = TRUE;
372 if (p_ptr->arena_number == MAX_ARENA_MONS)
373 msg_print(_("あなたは勝利者だ。 アリーナでのセレモニーに参加しなさい。",
374 "You are victorious. Enter the arena for the ceremony."));
376 else if (p_ptr->arena_number > MAX_ARENA_MONS)
378 msg_print(_("あなたはすべての敵に勝利した。", "You have won against all foes."));
382 r_ptr = &r_info[arena_info[p_ptr->arena_number].r_idx];
383 name = (r_name + r_ptr->name);
384 msg_format(_("%s に挑戦するものはいないか?", "Do I hear any challenges against: %s"), name);
386 p_ptr->monster_race_idx = arena_info[p_ptr->arena_number].r_idx;
387 p_ptr->window |= (PW_MONSTER);
392 case BACT_ARENA_RULES:
395 /* Peruse the arena help file */
396 (void)show_file(TRUE, _("arena_j.txt", "arena.txt"), NULL, 0, 0);
404 * @brief カジノのスロットシンボルを表示する / display fruit for dice slots
405 * @param row シンボルを表示する行の上端
406 * @param col シンボルを表示する行の左端
407 * @param fruit 表示するシンボルID
410 static void display_fruit(int row, int col, int fruit)
415 c_put_str(TERM_YELLOW, " ####.", row, col);
416 c_put_str(TERM_YELLOW, " # #", row + 1, col);
417 c_put_str(TERM_YELLOW, " # #", row + 2, col);
418 c_put_str(TERM_YELLOW, "# #", row + 3, col);
419 c_put_str(TERM_YELLOW, "# #", row + 4, col);
420 c_put_str(TERM_YELLOW, "# # ", row + 5, col);
421 c_put_str(TERM_YELLOW, "# # ", row + 6, col);
422 c_put_str(TERM_YELLOW, ".#### ", row + 7, col);
424 " Lemon "), row + 8, col);
427 c_put_str(TERM_ORANGE, " ## ", row, col);
428 c_put_str(TERM_ORANGE, " #..# ", row + 1, col);
429 c_put_str(TERM_ORANGE, " #....# ", row + 2, col);
430 c_put_str(TERM_ORANGE, "#......#", row + 3, col);
431 c_put_str(TERM_ORANGE, "#......#", row + 4, col);
432 c_put_str(TERM_ORANGE, " #....# ", row + 5, col);
433 c_put_str(TERM_ORANGE, " #..# ", row + 6, col);
434 c_put_str(TERM_ORANGE, " ## ", row + 7, col);
436 " Orange "), row + 8, col);
439 c_put_str(TERM_SLATE, _(" Λ ", " /\\ ") , row, col);
440 c_put_str(TERM_SLATE, _(" || ", " ## ") , row + 1, col);
441 c_put_str(TERM_SLATE, _(" || ", " ## ") , row + 2, col);
442 c_put_str(TERM_SLATE, _(" || ", " ## ") , row + 3, col);
443 c_put_str(TERM_SLATE, _(" || ", " ## ") , row + 4, col);
444 c_put_str(TERM_SLATE, _(" || ", " ## ") , row + 5, col);
445 c_put_str(TERM_UMBER, _(" |=亜=| ", " ###### ") , row + 6, col);
446 c_put_str(TERM_UMBER, _(" 目 ", " ## ") , row + 7, col);
447 prt( _(" 剣 ", " Sword ") , row + 8, col);
450 c_put_str(TERM_SLATE, " ###### ", row, col);
451 c_put_str(TERM_SLATE, "# #", row + 1, col);
452 c_put_str(TERM_SLATE, "# ++++ #", row + 2, col);
453 c_put_str(TERM_SLATE, "# +==+ #", row + 3, col);
454 c_put_str(TERM_SLATE, "# ++ #", row + 4, col);
455 c_put_str(TERM_SLATE, " # # ", row + 5, col);
456 c_put_str(TERM_SLATE, " # # ", row + 6, col);
457 c_put_str(TERM_SLATE, " ## ", row + 7, col);
459 " Shield "), row + 8, col);
462 c_put_str(TERM_VIOLET, " ## ", row, col);
463 c_put_str(TERM_VIOLET, " ###### ", row + 1, col);
464 c_put_str(TERM_VIOLET, "########", row + 2, col);
465 c_put_str(TERM_VIOLET, "########", row + 3, col);
466 c_put_str(TERM_VIOLET, "########", row + 4, col);
467 c_put_str(TERM_VIOLET, " ###### ", row + 5, col);
468 c_put_str(TERM_VIOLET, " #### ", row + 6, col);
469 c_put_str(TERM_VIOLET, " ## ", row + 7, col);
471 " Plum "), row + 8, col);
474 c_put_str(TERM_RED, " ##", row, col);
475 c_put_str(TERM_RED, " ### ", row + 1, col);
476 c_put_str(TERM_RED, " #..# ", row + 2, col);
477 c_put_str(TERM_RED, " #..# ", row + 3, col);
478 c_put_str(TERM_RED, " ###### ", row + 4, col);
479 c_put_str(TERM_RED, "#..##..#", row + 5, col);
480 c_put_str(TERM_RED, "#..##..#", row + 6, col);
481 c_put_str(TERM_RED, " ## ## ", row + 7, col);
483 " Cherry "), row + 8, col);
489 * kpoker no (tyuto-hannpa na)pakuri desu...
490 * joker ha shineru node haitte masen.
492 * TODO: donataka! tsukutte!
493 * - agatta yaku no kiroku (like DQ).
494 * - kakkoii card no e.
495 * - sousa-sei no koujyo.
496 * - code wo wakariyasuku.
498 * - Joker... -- done.
501 * 9/15/2000 joker wo jissou. soreto, code wo sukosi kakikae. --Habu
504 #define SUIT_OF(card) ((card) / 13) /*!< トランプカードのスートを返す */
505 #define NUM_OF(card) ((card) % 13) /*!< トランプカードの番号を返す */
506 #define IS_JOKER(card) ((card) == 52) /*!< トランプカードがジョーカーかどうかを返す */
508 static int cards[5]; /*!< ポーカーの現在の手札ID */
515 static void reset_deck(int deck[])
518 for (i = 0; i < 53; i++) deck[i] = i;
521 for (i = 0; i < 53; i++){
522 int tmp1 = randint0(53 - i) + i;
524 deck[i] = deck[tmp1];
530 * @brief ポーカープレイ中にジョーカーを持っているかの判定を返す。
531 * @return ジョーカーを持っているか。
533 static bool have_joker(void)
537 for (i = 0; i < 5; i++){
538 if(IS_JOKER(cards[i])) return TRUE;
544 * @brief ポーカーの手札に該当の番号の札があるかを返す。
545 * @param num 探したいカードの番号。
546 * @return 該当の番号が手札にあるか。
548 static bool find_card_num(int num)
551 for (i = 0; i < 5; i++)
552 if (NUM_OF(cards[i]) == num && !IS_JOKER(cards[i])) return TRUE;
557 * @brief ポーカーの手札がフラッシュ役を得ているかを帰す。
560 static bool yaku_check_flush(void)
563 bool joker_is_used = FALSE;
565 suit = IS_JOKER(cards[0]) ? SUIT_OF(cards[1]) : SUIT_OF(cards[0]);
566 for (i = 0; i < 5; i++){
567 if (SUIT_OF(cards[i]) != suit){
568 if(have_joker() && !joker_is_used)
569 joker_is_used = TRUE;
579 * @brief ポーカーの手札がストレートを含んだ高位の役を得ているかを帰す。
580 * @return 役の判定結果 0…ストレート、フラッシュいずれもなし/1…ストレートのみ/2…ストレートフラッシュ/3…ロイヤルストレートフラッシュ
582 static int yaku_check_straight(void)
585 bool joker_is_used = FALSE;
586 bool straight = FALSE;
589 for (i = 0; i < 5; i++)
591 if (NUM_OF(cards[i]) < lowest && !IS_JOKER(cards[i]))
592 lowest = NUM_OF(cards[i]);
595 /* Check Royal Straight Flush */
596 if (yaku_check_flush())
599 for (i = 0; i < 4; i++)
601 if (!find_card_num(9 + i)){
602 if( have_joker() && !joker_is_used )
603 joker_is_used = TRUE;
608 if (i == 4) return 3; /* Wow! Royal Straight Flush!!! */
611 for (i = 0; i < 3; i++)
613 if (!find_card_num(10 + i))
616 if (i == 3 && have_joker()) return 3; /* Wow! Royal Straight Flush!!! */
620 joker_is_used = FALSE;
622 /* Straight Only Check */
624 if (lowest == 0) { /* (10 - J - Q - K)[JOKER] - A */
625 for (i = 0; i < 4; i++)
627 if (!find_card_num(9 + i)) {
628 if (have_joker() && !joker_is_used)
629 joker_is_used = TRUE;
634 if(i == 4) straight = TRUE;
637 joker_is_used = FALSE;
639 for (i = 0; i < 5; i++)
641 if(!find_card_num(lowest + i)){
642 if( have_joker() && !joker_is_used )
643 joker_is_used = TRUE;
648 if(i == 5) straight = TRUE;
650 if (straight && yaku_check_flush()) return 2; /* Straight Flush */
651 else if(straight) return 1; /* Only Straight */
656 * @brief ポーカーのペア役の状態を返す。
657 * @return 0:nopair 1:1 pair 2:2 pair 3:3 cards 4:full house 6:4cards
659 static int yaku_check_pair(void)
661 int i, i2, matching = 0;
663 for (i = 0; i < 5; i++)
665 for (i2 = i+1; i2 < 5; i2++)
667 if (IS_JOKER(cards[i]) || IS_JOKER(cards[i2])) continue;
668 if (NUM_OF(cards[i]) == NUM_OF(cards[i2]))
699 #define ODDS_5A 3000 /*!< ファイブエースの役倍率 */
700 #define ODDS_5C 400 /*!< ファイブカードの役倍率 */
701 #define ODDS_RF 200 /*!< ロイヤルストレートフラッシュの役倍率 */
702 #define ODDS_SF 80 /*!< ストレートフラッシュの役倍率 */
703 #define ODDS_4C 16 /*!< フォアカードの役倍率 */
704 #define ODDS_FH 12 /*!< フルハウスの役倍率 */
705 #define ODDS_FL 8 /*!< フラッシュの役倍率 */
706 #define ODDS_ST 4 /*!< ストレートの役倍率 */
707 #define ODDS_3C 1 /*!< スリーカードの役倍率 */
708 #define ODDS_2P 1 /*!< ツーペアの役倍率 */
711 * @brief ポーカーの役をチェックし、その結果を画面に表示しつつ結果を返す。
714 static int yaku_check(void)
718 switch(yaku_check_straight()){
720 c_put_str(TERM_YELLOW, _("ロイヤルストレートフラッシュ", "Royal Flush"), 4, 3);
723 c_put_str(TERM_YELLOW, _("ストレートフラッシュ", "Straight Flush"), 4, 3);
726 c_put_str(TERM_YELLOW, _("ストレート", "Straight"), 4, 3);
729 /* Not straight -- fall through */
733 if (yaku_check_flush())
735 c_put_str(TERM_YELLOW, _("フラッシュ", "Flush"), 4, 3);
739 switch (yaku_check_pair())
742 c_put_str(TERM_YELLOW, _("ワンペア", "One pair"), 4, 3);
745 c_put_str(TERM_YELLOW, _("ツーペア", "Two pair"), 4, 3);
748 c_put_str(TERM_YELLOW, _("スリーカード", "Three of a kind"), 4, 3);
751 c_put_str(TERM_YELLOW, _("フルハウス", "Full house"), 4, 3);
754 c_put_str(TERM_YELLOW, _("フォーカード", "Four of a kind"), 4, 3);
757 if (!NUM_OF(cards[0]) && !NUM_OF(cards[1]))
759 c_put_str(TERM_YELLOW, _("ファイブエース", "Five ace"), 4, 3);
764 c_put_str(TERM_YELLOW, _("ファイブカード", "Five of a kind"), 4, 3);
774 * @brief ポーカーの捨てる/残すインターフェイスの表示を更新する。
775 * @param hoge カーソルの現在位置
776 * @param kaeruka カードの捨てる/残すフラグ配列
779 static void display_kaeruka(int hoge, int kaeruka[])
782 char col = TERM_WHITE;
783 for (i = 0; i < 5; i++)
785 if (i == hoge) col = TERM_YELLOW;
786 else if(kaeruka[i]) col = TERM_WHITE;
787 else col = TERM_L_BLUE;
790 c_put_str(col, _("かえる", "Change"), 14, 5+i*16);
792 c_put_str(col, _("のこす", " Stay "), 14, 5+i*16);
794 if (hoge > 4) col = TERM_YELLOW;
795 else col = TERM_WHITE;
796 c_put_str(col, _("決定", "Sure"), 16, 38);
798 /* Hilite current option */
799 if (hoge < 5) move_cursor(14, 5+hoge*16);
800 else move_cursor(16, 38);
804 * @brief ポーカーの手札を表示する。
807 static void display_cards(void)
810 char suitcolor[4] = {TERM_YELLOW, TERM_L_RED, TERM_L_BLUE, TERM_L_GREEN};
812 concptr suit[4] = {"★", "●", "¶", "†"};
813 concptr card_grph[13][7] = {{"A %s ",
904 concptr joker_grph[7] = { " ",
914 concptr suit[4] = {"[]", "qp", "<>", "db"};
915 concptr card_grph[13][7] = {{"A %s ",
1006 concptr joker_grph[7] = { " ",
1015 for (i = 0; i < 5; i++)
1017 prt(_("┏━━━━━━┓", " +------------+ "), 5, i*16);
1020 for (i = 0; i < 5; i++)
1022 for (j = 0; j < 7; j++)
1024 prt(_("┃", " |"), j+6, i*16);
1025 if(IS_JOKER(cards[i]))
1026 c_put_str(TERM_VIOLET, joker_grph[j], j+6, 2+i*16);
1028 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);
1029 prt(_("┃", "| "), j+6, i*16+14);
1032 for (i = 0; i < 5; i++)
1034 prt(_("┗━━━━━━┛", " +------------+ "), 13, i*16);
1039 * @brief ポーカーの1プレイルーチン。
1042 static int do_poker(void)
1046 int deck[53]; /* yamafuda : 0...52 */
1048 int kaeruka[5]; /* 0:kaenai 1:kaeru */
1052 bool kakikae = TRUE;
1056 for (i = 0; i < 5; i++)
1058 cards[i] = deck[deck_ptr++];
1059 kaeruka[i] = 0; /* default:nokosu */
1062 /* suteruno wo kimeru */
1063 prt(_("残すカードを決めて下さい(方向で移動, スペースで選択)。", "Stay witch? "), 0, 0);
1070 if (kakikae) display_kaeruka(k+kettei*5, kaeruka);
1075 case '6': case 'l': case 'L': case KTRL('F'):
1076 if (!kettei) k = (k+1)%5;
1077 else {k = 0;kettei = FALSE;}
1080 case '4': case 'h': case 'H': case KTRL('B'):
1081 if (!kettei) k = (k+4)%5;
1082 else {k = 4;kettei = FALSE;}
1085 case '2': case 'j': case 'J': case KTRL('N'):
1086 if (!kettei) {kettei = TRUE;kakikae = TRUE;}
1088 case '8': case 'k': case 'K': case KTRL('P'):
1089 if (kettei) {kettei = FALSE;kakikae = TRUE;}
1091 case ' ': case '\r':
1092 if (kettei) done = TRUE;
1093 else {kaeruka[k] = !kaeruka[k];kakikae = TRUE;}
1102 for (i = 0; i < 5; i++)
1103 if (kaeruka[i] == 1) cards[i] = deck[deck_ptr++]; /* soshite toru */
1107 return yaku_check();
1112 /* end of poker codes --Koka */
1115 * @brief カジノ1プレイごとのメインルーチン / gamble_comm
1116 * @param cmd プレイするゲームID
1119 static bool gamble_comm(int cmd)
1122 int roll1, roll2, roll3, choice, odds, win;
1127 char out_val[160], tmp_str[80], again;
1132 if (cmd == BACT_GAMBLE_RULES)
1134 /* Peruse the gambling help file */
1135 (void)show_file(TRUE, _("jgambling.txt", "gambling.txt"), NULL, 0, 0);
1142 msg_print(_("おい!おまえ一文なしじゃないか!こっから出ていけ!",
1143 "Hey! You don't have gold - get out of here!"));
1151 maxbet = p_ptr->lev * 200;
1153 /* We can't bet more than we have */
1154 maxbet = MIN(maxbet, p_ptr->au);
1157 strcpy(out_val, "");
1158 sprintf(tmp_str,_("賭け金 (1-%ld)?", "Your wager (1-%ld) ? "), (long int)maxbet);
1162 * Use get_string() because we may need more than
1163 * the s16b value returned by get_quantity().
1165 if (get_string(tmp_str, out_val, 32))
1168 for (p = out_val; *p == ' '; p++);
1173 if (wager > p_ptr->au)
1175 msg_print(_("おい!金が足りないじゃないか!出ていけ!", "Hey! You don't have the gold - get out of here!"));
1180 else if (wager > maxbet)
1182 msg_format(_("%ldゴールドだけ受けよう。残りは取っときな。",
1183 "I'll take %ld gold of that. Keep the rest."), (long int)maxbet);
1188 msg_print(_("OK、1ゴールドからはじめよう。", "Ok, we'll start with 1 gold."));
1194 oldgold = p_ptr->au;
1196 sprintf(tmp_str, _("ゲーム前の所持金: %9ld", "Gold before game: %9ld"), (long int)oldgold);
1197 prt(tmp_str, 20, 2);
1198 sprintf(tmp_str, _("現在の掛け金: %9ld", "Current Wager: %9ld"), (long int)wager);
1199 prt(tmp_str, 21, 2);
1206 case BACT_IN_BETWEEN: /* Game of In-Between */
1207 c_put_str(TERM_GREEN, _("イン・ビトイーン", "In Between"),5,2);
1211 roll1 = randint1(10);
1212 roll2 = randint1(10);
1213 choice = randint1(10);
1214 sprintf(tmp_str, _("黒ダイス: %d 黒ダイス: %d", "Black die: %d Black Die: %d"), roll1, roll2);
1217 sprintf(tmp_str, _("赤ダイス: %d", "Red die: %d"), choice);
1219 prt(tmp_str, 11, 14);
1220 if (((choice > roll1) && (choice < roll2)) ||
1221 ((choice < roll1) && (choice > roll2)))
1224 case BACT_CRAPS: /* Game of Craps */
1225 c_put_str(TERM_GREEN, _("クラップス", "Craps"), 5, 2);
1229 roll1 = randint1(6);
1230 roll2 = randint1(6);
1231 roll3 = roll1 + roll2;
1233 sprintf(tmp_str, _("1振りめ: %d %d Total: %d",
1234 "First roll: %d %d Total: %d"), roll1, roll2, roll3);
1236 if ((roll3 == 7) || (roll3 == 11))
1238 else if ((roll3 == 2) || (roll3 == 3) || (roll3 == 12))
1243 msg_print(_("なにかキーを押すともう一回振ります。", "Hit any key to roll again"));
1246 roll1 = randint1(6);
1247 roll2 = randint1(6);
1248 roll3 = roll1 + roll2;
1249 sprintf(tmp_str, _("出目: %d %d 合計: %d",
1250 "Roll result: %d %d Total: %d"), roll1, roll2, roll3);
1252 if (roll3 == choice)
1254 else if (roll3 == 7)
1256 } while ((win != TRUE) && (win != FALSE));
1259 case BACT_SPIN_WHEEL: /* Spin the Wheel Game */
1262 c_put_str(TERM_GREEN, _("ルーレット", "Wheel"), 5, 2);
1264 prt("0 1 2 3 4 5 6 7 8 9", 7, 5);
1265 prt("--------------------------------", 8, 3);
1266 strcpy(out_val, "");
1267 get_string(_("何番? (0-9): ", "Pick a number (0-9): "), out_val, 32);
1269 for (p = out_val; iswspace(*p); p++);
1273 msg_print(_("0番にしとくぜ。", "I'll put you down for 0."));
1276 else if (choice > 9)
1278 msg_print(_("OK、9番にしとくぜ。", "Ok, I'll put you down for 9."));
1282 roll1 = randint0(10);
1283 sprintf(tmp_str, _("ルーレットは回り、止まった。勝者は %d番だ。",
1284 "The wheel spins to a stop and the winner is %d"), roll1);
1285 prt(tmp_str, 13, 3);
1287 prt("*", 9, (3 * roll1 + 5));
1288 if (roll1 == choice)
1292 case BACT_DICE_SLOTS: /* The Dice Slots */
1293 c_put_str(TERM_GREEN, _("ダイス・スロット", "Dice Slots"), 5, 2);
1294 c_put_str(TERM_YELLOW, _("レモン レモン 2", ""), 6, 37);
1295 c_put_str(TERM_YELLOW, _("レモン レモン レモン 5", ""), 7, 37);
1296 c_put_str(TERM_ORANGE, _("オレンジ オレンジ オレンジ 10", ""), 8, 37);
1297 c_put_str(TERM_UMBER, _("剣 剣 剣 20", ""), 9, 37);
1298 c_put_str(TERM_SLATE, _("盾 盾 盾 50", ""), 10, 37);
1299 c_put_str(TERM_VIOLET, _("プラム プラム プラム 200", ""), 11, 37);
1300 c_put_str(TERM_RED, _("チェリー チェリー チェリー 1000", ""), 12, 37);
1303 roll1 = randint1(21);
1313 roll2 = randint1(21);
1323 choice = randint1(21);
1333 put_str("/--------------------------\\", 7, 2);
1334 prt("\\--------------------------/", 17, 2);
1335 display_fruit(8, 3, roll1 - 1);
1336 display_fruit(8, 12, roll2 - 1);
1337 display_fruit(8, 21, choice - 1);
1338 if ((roll1 == roll2) && (roll2 == choice))
1357 else if ((roll1 == 1) && (roll2 == 1))
1366 if (odds) win = TRUE;
1372 prt(_("あなたの勝ち", "YOU WON"), 16, 37);
1374 p_ptr->au += odds * wager;
1375 sprintf(tmp_str, _("倍率: %d", "Payoff: %d"), odds);
1377 prt(tmp_str, 17, 37);
1381 prt(_("あなたの負け", "You Lost"), 16, 37);
1384 sprintf(tmp_str, _("現在の所持金: %9ld", "Current Gold: %9ld"), (long int)p_ptr->au);
1386 prt(tmp_str, 22, 2);
1387 prt(_("もう一度(Y/N)?", "Again(Y/N)?"), 18, 37);
1389 move_cursor(18, 52);
1394 if (wager > p_ptr->au)
1396 msg_print(_("おい!金が足りないじゃないか!ここから出て行け!",
1397 "Hey! You don't have the gold - get out of here!"));
1403 } while ((again == 'y') || (again == 'Y'));
1406 if (p_ptr->au >= oldgold)
1408 msg_print(_("「今回は儲けたな!でも次はこっちが勝ってやるからな、絶対に!」",
1409 "You came out a winner! We'll win next time, I'm sure."));
1410 chg_virtue(V_CHANCE, 3);
1414 msg_print(_("「金をスッてしまったな、わはは!うちに帰った方がいいぜ。」", "You lost gold! Haha, better head home."));
1415 chg_virtue(V_CHANCE, -3);
1425 * @brief モンスター闘技場に参加するモンスターを更新する。
1428 void update_gambling_monsters(void)
1435 bool old_inside_battle = p_ptr->inside_battle;
1437 for (i = 0; i < max_d_idx; i++)
1438 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
1440 mon_level = randint1(MIN(max_dl, 122)) + 5;
1441 if (randint0(100) < 60)
1443 i = randint1(MIN(max_dl, 122)) + 5;
1444 mon_level = MAX(i, mon_level);
1446 if (randint0(100) < 30)
1448 i = randint1(MIN(max_dl, 122)) + 5;
1449 mon_level = MAX(i, mon_level);
1456 for (i = 0; i < 4; i++)
1462 get_mon_num_prep(monster_can_entry_arena, NULL);
1463 p_ptr->inside_battle = TRUE;
1464 r_idx = get_mon_num(mon_level);
1465 p_ptr->inside_battle = old_inside_battle;
1466 if (!r_idx) continue;
1468 if ((r_info[r_idx].flags1 & RF1_UNIQUE) || (r_info[r_idx].flags7 & RF7_UNIQUE2))
1470 if ((r_info[r_idx].level + 10) > mon_level) continue;
1473 for (j = 0; j < i; j++)
1474 if (r_idx == battle_mon[j]) break;
1475 if (j < i) continue;
1479 battle_mon[i] = r_idx;
1480 if (r_info[r_idx].level < 45) tekitou = TRUE;
1483 for (i = 0; i < 4; i++)
1485 monster_race *r_ptr = &r_info[battle_mon[i]];
1486 int num_taisei = count_bits(r_ptr->flagsr & (RFR_IM_ACID | RFR_IM_ELEC | RFR_IM_FIRE | RFR_IM_COLD | RFR_IM_POIS));
1488 if (r_ptr->flags1 & RF1_FORCE_MAXHP)
1489 power[i] = r_ptr->hdice * r_ptr->hside * 2;
1491 power[i] = r_ptr->hdice * (r_ptr->hside + 1);
1492 power[i] = power[i] * (100 + r_ptr->level) / 100;
1493 if (r_ptr->speed > 110)
1494 power[i] = power[i] * (r_ptr->speed * 2 - 110) / 100;
1495 if (r_ptr->speed < 110)
1496 power[i] = power[i] * (r_ptr->speed - 20) / 100;
1498 power[i] = power[i] * (num_taisei * 2 + 5) / 10;
1499 else if (r_ptr->a_ability_flags2 & RF6_INVULNER)
1500 power[i] = power[i] * 4 / 3;
1501 else if (r_ptr->a_ability_flags2 & RF6_HEAL)
1502 power[i] = power[i] * 4 / 3;
1503 else if (r_ptr->a_ability_flags1 & RF5_DRAIN_MANA)
1504 power[i] = power[i] * 11 / 10;
1505 if (r_ptr->flags1 & RF1_RAND_25)
1506 power[i] = power[i] * 9 / 10;
1507 if (r_ptr->flags1 & RF1_RAND_50)
1508 power[i] = power[i] * 9 / 10;
1509 if (r_ptr->flagsr & RFR_RES_ALL) power[i] *= 100000;
1510 if (r_ptr->arena_ratio) power[i] = power[i] * r_ptr->arena_ratio / 100;
1515 for (i = 0; i < 4; i++)
1517 power[i] = total * 60 / power[i];
1518 if (tekitou && ((power[i] < 160) || power[i] > 1500)) break;
1519 if ((power[i] < 160) && randint0(20)) break;
1520 if (power[i] < 101) power[i] = 100 + randint1(5);
1521 mon_odds[i] = power[i];
1528 * @brief モンスター闘技場のメインルーチン
1529 * @return 賭けを開始したか否か
1531 static bool kakutoujou(void)
1535 char out_val[160], tmp_str[80];
1538 if ((current_world_ptr->game_turn - old_battle) > TURNS_PER_TICK * 250)
1540 update_gambling_monsters();
1541 old_battle = current_world_ptr->game_turn;
1549 msg_print(_("おい!おまえ一文なしじゃないか!こっから出ていけ!", "Hey! You don't have gold - get out of here!"));
1561 "Monsters Odds"), 4, 4);
1565 monster_race *r_ptr = &r_info[battle_mon[i]];
1567 sprintf(buf, _("%d) %-58s %4ld.%02ld倍", "%d) %-58s %4ld.%02ld"), i+1,
1568 _(format("%s%s",r_name + r_ptr->name, (r_ptr->flags1 & RF1_UNIQUE) ? "もどき" : " "),
1569 format("%s%s", (r_ptr->flags1 & RF1_UNIQUE) ? "Fake " : "", r_name + r_ptr->name)),
1570 (long int)mon_odds[i]/100, (long int)mon_odds[i]%100);
1573 prt(_("どれに賭けますか:", "Which monster: "), 0, 0);
1583 if (i >= '1' && i <= '4')
1585 sel_monster = i-'1';
1586 battle_odds = mon_odds[sel_monster];
1593 for (i = 0; i < 4; i++)
1594 if (i != sel_monster) clear_bldg(i + 5, i + 5);
1596 maxbet = p_ptr->lev * 200;
1598 /* We can't bet more than we have */
1599 maxbet = MIN(maxbet, p_ptr->au);
1602 strcpy(out_val, "");
1603 sprintf(tmp_str,_("賭け金 (1-%ld)?", "Your wager (1-%ld) ? "), (long int)maxbet);
1605 * Use get_string() because we may need more than
1606 * the s16b value returned by get_quantity().
1608 if (get_string(tmp_str, out_val, 32))
1611 for (p = out_val; *p == ' '; p++);
1616 if (wager > p_ptr->au)
1618 msg_print(_("おい!金が足りないじゃないか!出ていけ!", "Hey! You don't have the gold - get out of here!"));
1624 else if (wager > maxbet)
1626 msg_format(_("%ldゴールドだけ受けよう。残りは取っときな。", "I'll take %ld gold of that. Keep the rest."), (long int)maxbet);
1632 msg_print(_("OK、1ゴールドでいこう。", "Ok, we'll start with 1 gold."));
1636 battle_odds = MAX(wager+1, wager * battle_odds / 100);
1641 /* Save the surface floor as saved floor */
1642 prepare_change_floor_mode(CFM_SAVE_FLOORS);
1644 p_ptr->inside_battle = TRUE;
1645 p_ptr->leaving = TRUE;
1659 * @brief 本日の賞金首情報を表示する。
1662 static void today_target(void)
1665 monster_race *r_ptr = &r_info[today_mon];
1668 c_put_str(TERM_YELLOW, _("本日の賞金首", "Wanted monster that changes from day to day"), 5, 10);
1669 sprintf(buf,_("ターゲット: %s", "target: %s"),r_name + r_ptr->name);
1670 c_put_str(TERM_YELLOW, buf, 6, 10);
1671 sprintf(buf,_("死体 ---- $%d", "corpse ---- $%d"), (int)r_ptr->level * 50 + 100);
1673 sprintf(buf,_("骨 ---- $%d", "skeleton ---- $%d"), (int)r_ptr->level * 30 + 60);
1675 p_ptr->today_mon = today_mon;
1679 * @brief ツチノコの賞金首情報を表示する。
1682 static void tsuchinoko(void)
1685 c_put_str(TERM_YELLOW, _("一獲千金の大チャンス!!!", "Big chance to quick money!!!"), 5, 10);
1686 c_put_str(TERM_YELLOW, _("ターゲット:幻の珍獣「ツチノコ」", "target: the rarest animal 'Tsuchinoko'"), 6, 10);
1687 c_put_str(TERM_WHITE, _("生け捕り ---- $1,000,000", "catch alive ---- $1,000,000"), 8, 10);
1688 c_put_str(TERM_WHITE, _("死体 ---- $200,000", "corpse ---- $200,000"), 9, 10);
1689 c_put_str(TERM_WHITE, _("骨 ---- $100,000", "bones ---- $100,000"), 10, 10);
1693 * @brief 通常の賞金首情報を表示する。
1696 static void shoukinkubi(void)
1702 prt(_("死体を持ち帰れば報酬を差し上げます。", "Offer a prize when you bring a wanted monster's corpse"),4 ,10);
1703 c_put_str(TERM_YELLOW, _("現在の賞金首", "Wanted monsters"), 6, 10);
1705 for (i = 0; i < MAX_KUBI; i++)
1709 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])];
1711 if (current_world_ptr->bounty_r_idx[i] > 10000)
1714 done_mark = _("(済)", "(done)");
1722 c_prt(color, format("%s %s", r_name + r_ptr->name, done_mark), y+7, 10);
1725 if (!y && (i < MAX_KUBI -1))
1727 prt(_("何かキーを押してください", "Hit any key."), 0, 0);
1738 * 賞金首の報酬テーブル / List of prize object
1741 OBJECT_TYPE_VALUE tval; /*!< ベースアイテムのメイン種別ID */
1742 OBJECT_SUBTYPE_VALUE sval; /*!< ベースアイテムのサブ種別ID */
1743 } prize_list[MAX_KUBI] =
1745 {TV_POTION, SV_POTION_CURING},
1746 {TV_POTION, SV_POTION_SPEED},
1747 {TV_POTION, SV_POTION_SPEED},
1748 {TV_POTION, SV_POTION_RESISTANCE},
1749 {TV_POTION, SV_POTION_ENLIGHTENMENT},
1751 {TV_POTION, SV_POTION_HEALING},
1752 {TV_POTION, SV_POTION_RESTORE_MANA},
1753 {TV_SCROLL, SV_SCROLL_STAR_DESTRUCTION},
1754 {TV_POTION, SV_POTION_STAR_ENLIGHTENMENT},
1755 {TV_SCROLL, SV_SCROLL_SUMMON_PET},
1757 {TV_SCROLL, SV_SCROLL_GENOCIDE},
1758 {TV_POTION, SV_POTION_STAR_HEALING},
1759 {TV_POTION, SV_POTION_STAR_HEALING},
1760 {TV_POTION, SV_POTION_NEW_LIFE},
1761 {TV_SCROLL, SV_SCROLL_MASS_GENOCIDE},
1763 {TV_POTION, SV_POTION_LIFE},
1764 {TV_POTION, SV_POTION_LIFE},
1765 {TV_POTION, SV_POTION_AUGMENTATION},
1766 {TV_POTION, SV_POTION_INVULNERABILITY},
1767 {TV_SCROLL, SV_SCROLL_ARTIFACT},
1771 * @brief 賞金首の引き換え処理 / Get prize
1772 * @return 各種賞金首のいずれかでも換金が行われたか否か。
1774 static bool kankin(void)
1778 bool change = FALSE;
1779 GAME_TEXT o_name[MAX_NLEN];
1782 /* Loop for inventory and right/left arm */
1783 for (i = 0; i <= INVEN_LARM; i++)
1785 o_ptr = &inventory[i];
1787 /* Living Tsuchinoko worthes $1000000 */
1788 if ((o_ptr->tval == TV_CAPTURE) && (o_ptr->pval == MON_TSUCHINOKO))
1790 char buf[MAX_NLEN+20];
1791 object_desc(o_name, o_ptr, 0);
1792 sprintf(buf, _("%s を換金しますか?", "Convert %s into money? "),o_name);
1795 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (long int)(1000000L * o_ptr->number));
1796 p_ptr->au += 1000000L * o_ptr->number;
1797 p_ptr->redraw |= (PR_GOLD);
1798 inven_item_increase(i, -o_ptr->number);
1799 inven_item_describe(i);
1800 inven_item_optimize(i);
1806 for (i = 0; i < INVEN_PACK; i++)
1808 o_ptr = &inventory[i];
1810 /* Corpse of Tsuchinoko worthes $200000 */
1811 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_CORPSE) && (o_ptr->pval == MON_TSUCHINOKO))
1813 char buf[MAX_NLEN+20];
1814 object_desc(o_name, o_ptr, 0);
1815 sprintf(buf, _("%s を換金しますか?", "Convert %s into money? "),o_name);
1818 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (long int)(200000L * o_ptr->number));
1819 p_ptr->au += 200000L * o_ptr->number;
1820 p_ptr->redraw |= (PR_GOLD);
1821 inven_item_increase(i, -o_ptr->number);
1822 inven_item_describe(i);
1823 inven_item_optimize(i);
1829 for (i = 0; i < INVEN_PACK; i++)
1831 o_ptr = &inventory[i];
1833 /* Bones of Tsuchinoko worthes $100000 */
1834 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_SKELETON) && (o_ptr->pval == MON_TSUCHINOKO))
1836 char buf[MAX_NLEN+20];
1837 object_desc(o_name, o_ptr, 0);
1838 sprintf(buf, _("%s を換金しますか?", "Convert %s into money? "),o_name);
1841 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (long int)(100000L * o_ptr->number));
1842 p_ptr->au += 100000L * o_ptr->number;
1843 p_ptr->redraw |= (PR_GOLD);
1844 inven_item_increase(i, -o_ptr->number);
1845 inven_item_describe(i);
1846 inven_item_optimize(i);
1852 for (i = 0; i < INVEN_PACK; i++)
1854 o_ptr = &inventory[i];
1855 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)))
1857 char buf[MAX_NLEN+20];
1858 object_desc(o_name, o_ptr, 0);
1859 sprintf(buf, _("%s を換金しますか?", "Convert %s into money? "),o_name);
1862 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (long int)((r_info[today_mon].level * 50 + 100) * o_ptr->number));
1863 p_ptr->au += (r_info[today_mon].level * 50 + 100) * o_ptr->number;
1864 p_ptr->redraw |= (PR_GOLD);
1865 inven_item_increase(i, -o_ptr->number);
1866 inven_item_describe(i);
1867 inven_item_optimize(i);
1873 for (i = 0; i < INVEN_PACK; i++)
1875 o_ptr = &inventory[i];
1877 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)))
1879 char buf[MAX_NLEN+20];
1880 object_desc(o_name, o_ptr, 0);
1881 sprintf(buf, _("%s を換金しますか?", "Convert %s into money? "),o_name);
1884 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (long int)((r_info[today_mon].level * 30 + 60) * o_ptr->number));
1885 p_ptr->au += (r_info[today_mon].level * 30 + 60) * o_ptr->number;
1886 p_ptr->redraw |= (PR_GOLD);
1887 inven_item_increase(i, -o_ptr->number);
1888 inven_item_describe(i);
1889 inven_item_optimize(i);
1895 for (j = 0; j < MAX_KUBI; j++)
1897 /* Need reverse order --- Positions will be changed in the loop */
1898 for (i = INVEN_PACK-1; i >= 0; i--)
1900 o_ptr = &inventory[i];
1901 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->pval == current_world_ptr->bounty_r_idx[j]))
1903 char buf[MAX_NLEN+20];
1905 INVENTORY_IDX item_new;
1908 object_desc(o_name, o_ptr, 0);
1909 sprintf(buf, _("%sを渡しますか?", "Hand %s over? "),o_name);
1910 if (!get_check(buf)) continue;
1912 #if 0 /* Obsoleted */
1913 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (r_info[current_world_ptr->bounty_r_idx[j]].level + 1) * 300 * o_ptr->number);
1914 p_ptr->au += (r_info[current_world_ptr->bounty_r_idx[j]].level+1) * 300 * o_ptr->number;
1915 p_ptr->redraw |= (PR_GOLD);
1916 inven_item_increase(i, -o_ptr->number);
1917 inven_item_describe(i);
1918 inven_item_optimize(i);
1919 chg_virtue(V_JUSTICE, 5);
1920 current_world_ptr->bounty_r_idx[j] += 10000;
1923 #endif /* Obsoleted */
1926 inven_item_increase(i, -o_ptr->number);
1927 inven_item_describe(i);
1928 inven_item_optimize(i);
1930 chg_virtue(V_JUSTICE, 5);
1931 current_world_ptr->bounty_r_idx[j] += 10000;
1933 /* Count number of unique corpses already handed */
1934 for (num = 0, k = 0; k < MAX_KUBI; k++)
1936 if (current_world_ptr->bounty_r_idx[k] >= 10000) num++;
1938 msg_format(_("これで合計 %d ポイント獲得しました。" ,"You earned %d point%s total."), num, (num > 1 ? "s" : ""));
1940 /* Prepare to make a prize */
1941 object_prep(&forge, lookup_kind(prize_list[num-1].tval, prize_list[num-1].sval));
1942 apply_magic(&forge, current_floor_ptr->object_level, AM_NO_FIXED_ART);
1944 object_aware(&forge);
1945 object_known(&forge);
1948 * Hand it --- Assume there is an empty slot.
1949 * Since a corpse is handed at first,
1950 * there is at least one empty slot.
1952 item_new = inven_carry(&forge);
1954 object_desc(o_name, &forge, 0);
1955 msg_format(_("%s(%c)を貰った。", "You get %s (%c). "), o_name, index_to_label(item_new));
1957 /* Auto-inscription */
1958 autopick_alter_item(item_new, FALSE);
1968 msg_print(_("賞金を得られそうなものは持っていなかった。", "You have nothing."));
1976 * @brief 宿屋の利用サブルーチン
1977 * @details inn commands\n
1978 * Note that resting for the night was a perfect way to avoid player\n
1979 * ghosts in the town *if* you could only make it to the inn in time (-:\n
1980 * Now that the ghosts are temporarily disabled in 2.8.X, this function\n
1981 * will not be that useful. I will keep it in the hopes the player\n
1982 * ghost code does become a reality again. Does help to avoid filthy urchins.\n
1983 * Resting at night is also a quick way to restock stores -KMW-\n
1984 * @param cmd 宿屋の利用施設ID
1985 * @return 施設の利用が実際に行われたか否か。
1987 static bool inn_comm(int cmd)
1991 case BACT_FOOD: /* Buy food & drink */
1992 if (p_ptr->food >= PY_FOOD_FULL)
1994 msg_print(_("今は満腹だ。", "You are full now."));
1997 msg_print(_("バーテンはいくらかの食べ物とビールをくれた。", "The barkeep gives you some gruel and a beer."));
1998 (void)set_food(PY_FOOD_MAX - 1);
2001 case BACT_REST: /* Rest for the night */
2002 if ((p_ptr->poisoned) || (p_ptr->cut))
2004 msg_print(_("あなたに必要なのは部屋ではなく、治療者です。", "You need a healer, not a room."));
2006 msg_print(_("すみません、でもうちで誰かに死なれちゃ困りますんで。", "Sorry, but don't want anyone dying in here."));
2010 s32b oldturn = current_world_ptr->game_turn;
2011 int prev_day, prev_hour, prev_min;
2013 extract_day_hour_min(&prev_day, &prev_hour, &prev_min);
2014 if ((prev_hour >= 6) && (prev_hour <= 17))
2015 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("宿屋に泊まった。", "stay over daytime at the inn."));
2017 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("宿屋に泊まった。", "stay over night at the inn."));
2019 current_world_ptr->game_turn = (current_world_ptr->game_turn / (TURNS_PER_TICK * TOWN_DAWN / 2) + 1) * (TURNS_PER_TICK * TOWN_DAWN / 2);
2020 if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
2022 current_world_ptr->dungeon_turn += MIN((current_world_ptr->game_turn - oldturn), TURNS_PER_TICK * 250) * INN_DUNGEON_TURN_ADJ;
2023 if (current_world_ptr->dungeon_turn > current_world_ptr->dungeon_turn_limit) current_world_ptr->dungeon_turn = current_world_ptr->dungeon_turn_limit;
2026 prevent_turn_overflow();
2028 if ((prev_hour >= 18) && (prev_hour <= 23)) do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
2029 p_ptr->chp = p_ptr->mhp;
2031 if (ironman_nightmare)
2033 msg_print(_("眠りに就くと恐ろしい光景が心をよぎった。", "Horrible visions flit through your mind as you sleep."));
2035 /* Have some nightmares */
2038 sanity_blast(NULL, FALSE);
2039 if (!one_in_(3)) break;
2042 msg_print(_("あなたは絶叫して目を覚ました。", "You awake screaming."));
2043 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("悪夢にうなされてよく眠れなかった。", "be troubled by a nightmare."));
2050 p_ptr->chp = p_ptr->mhp;
2051 p_ptr->csp = p_ptr->msp;
2052 if (p_ptr->pclass == CLASS_MAGIC_EATER)
2055 for (i = 0; i < 72; i++)
2057 p_ptr->magic_num1[i] = p_ptr->magic_num2[i] * EATER_CHARGE;
2059 for (; i < 108; i++)
2061 p_ptr->magic_num1[i] = 0;
2065 if ((prev_hour >= 6) && (prev_hour <= 17))
2067 msg_print(_("あなたはリフレッシュして目覚め、夕方を迎えた。", "You awake refreshed for the evening."));
2068 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("夕方を迎えた。", "awake refreshed."));
2072 msg_print(_("あなたはリフレッシュして目覚め、新たな日を迎えた。", "You awake refreshed for the new day."));
2073 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("すがすがしい朝を迎えた。", "awake refreshed."));
2079 case BACT_RUMORS: /* Listen for rumors */
2081 display_rumor(TRUE);
2091 * @brief クエスト情報を表示しつつ処理する。/ Display quest information
2092 * @param questnum クエストのID
2093 * @param do_init クエストの開始処理(TRUE)、結果処理か(FALSE)
2096 static void get_questinfo(IDX questnum, bool do_init)
2099 QUEST_IDX old_quest;
2100 GAME_TEXT tmp_str[80];
2102 /* Clear the text */
2103 for (i = 0; i < 10; i++)
2105 quest_text[i][0] = '\0';
2108 quest_text_line = 0;
2110 /* Set the quest number temporary */
2111 old_quest = p_ptr->inside_quest;
2112 p_ptr->inside_quest = questnum;
2114 /* Get the quest text */
2115 init_flags = INIT_SHOW_TEXT;
2116 if (do_init) init_flags |= INIT_ASSIGN;
2118 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
2120 /* Reset the old quest number */
2121 p_ptr->inside_quest = old_quest;
2123 /* Print the quest info */
2124 sprintf(tmp_str, _("クエスト情報 (危険度: %d 階相当)", "Quest Information (Danger level: %d)"), (int)quest[questnum].level);
2128 prt(quest[questnum].name, 7, 0);
2130 for (i = 0; i < 10; i++)
2132 c_put_str(TERM_YELLOW, quest_text[i], i + 8, 0);
2137 * @brief クエスト処理のメインルーチン / Request a quest from the Lord.
2140 static void castle_quest(void)
2142 QUEST_IDX q_index = 0;
2143 monster_race *r_ptr;
2150 /* Current quest of the building */
2151 q_index = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].special;
2153 /* Is there a quest available at the building? */
2156 put_str(_("今のところクエストはありません。", "I don't have a quest for you at the moment."), 8, 0);
2160 q_ptr = &quest[q_index];
2162 /* Quest is completed */
2163 if (q_ptr->status == QUEST_STATUS_COMPLETED)
2165 /* Rewarded quest */
2166 q_ptr->status = QUEST_STATUS_REWARDED;
2168 get_questinfo(q_index, FALSE);
2170 reinit_wilderness = TRUE;
2173 else if (q_ptr->status == QUEST_STATUS_FAILED)
2175 get_questinfo(q_index, FALSE);
2177 /* Mark quest as done (but failed) */
2178 q_ptr->status = QUEST_STATUS_FAILED_DONE;
2180 reinit_wilderness = TRUE;
2182 /* Quest is still unfinished */
2183 else if (q_ptr->status == QUEST_STATUS_TAKEN)
2185 put_str(_("あなたは現在のクエストを終了させていません!", "You have not completed your current quest yet!"), 8, 0);
2186 put_str(_("CTRL-Qを使えばクエストの状態がチェックできます。", "Use CTRL-Q to check the status of your quest."), 9, 0);
2187 put_str(_("クエストを終わらせたら戻って来て下さい。", "Return when you have completed your quest."), 12, 0);
2190 else if (q_ptr->status == QUEST_STATUS_UNTAKEN)
2192 q_ptr->status = QUEST_STATUS_TAKEN;
2194 reinit_wilderness = TRUE;
2196 /* Assign a new quest */
2197 if (q_ptr->type == QUEST_TYPE_KILL_ANY_LEVEL)
2199 if (q_ptr->r_idx == 0)
2201 /* Random monster at least 5 - 10 levels out of deep */
2202 q_ptr->r_idx = get_mon_num(q_ptr->level + 4 + randint1(6));
2205 r_ptr = &r_info[q_ptr->r_idx];
2207 while ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->rarity != 1))
2209 q_ptr->r_idx = get_mon_num(q_ptr->level) + 4 + randint1(6);
2210 r_ptr = &r_info[q_ptr->r_idx];
2213 if (q_ptr->max_num == 0)
2215 /* Random monster number */
2216 if (randint1(10) > 7)
2219 q_ptr->max_num = randint1(3) + 1;
2223 name = (r_name + r_ptr->name);
2224 msg_format(_("クエスト: %sを %d体倒す", "Your quest: kill %d %s"), name,q_ptr->max_num);
2228 get_questinfo(q_index, TRUE);
2235 * @brief 町に関するヘルプを表示する / Display town history
2238 static void town_history(void)
2242 /* Peruse the building help file */
2243 (void)show_file(TRUE, _("jbldg.txt", "bldg.txt"), NULL, 0, 0);
2248 * @brief 攻撃時スレイによるダメージ期待値修正計算 / critical happens at i / 10000
2250 * @param mult スレイ倍率(掛け算部分)
2251 * @param div スレイ倍率(割り算部分)
2252 * @param force 理力特別計算フラグ
2255 static HIT_POINT calc_slaydam(HIT_POINT dam, int mult, int div, bool force)
2263 tmp += dam * 60 * 2;
2277 * @brief 攻撃時の期待値計算(スレイ→重量クリティカル→切れ味効果)
2279 * @param mult スレイ倍率(掛け算部分)
2280 * @param div スレイ倍率(割り算部分)
2281 * @param force 理力特別計算フラグ
2283 * @param plus 武器ダメージ修正
2284 * @param meichuu 命中値
2285 * @param dokubari 毒針処理か否か
2286 * @param vorpal_mult 切れ味倍率(掛け算部分)
2287 * @param vorpal_div 切れ味倍率(割り算部分)
2290 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)
2292 dam = calc_slaydam(dam, mult, div, force);
2293 dam = calc_expect_crit(weight, plus, dam, meichuu, dokubari);
2294 dam = calc_slaydam(dam, vorpal_mult, vorpal_div, FALSE);
2300 * @brief 武器の各条件毎のダメージ期待値を表示する。
2303 * @param mindice ダイス部分最小値
2304 * @param maxdice ダイス部分最大値
2306 * @param dam_bonus ダメージ修正値
2308 * @param color 条件内容の表示色
2310 * Display the damage figure of an object\n
2311 * (used by compare_weapon_aux)\n
2313 * Only accurate for the current weapon, because it includes\n
2314 * the current +dam of the player.\n
2317 static void show_weapon_dmg(int r, int c, int mindice, int maxdice, int blows, int dam_bonus, concptr attr, byte color)
2319 GAME_TEXT tmp_str[80];
2322 mindam = blows * (mindice + dam_bonus);
2323 maxdam = blows * (maxdice + dam_bonus);
2325 /* Print the intro text */
2326 c_put_str(color, attr, r, c);
2328 /* Calculate the min and max damage figures */
2329 sprintf(tmp_str, _("1ターン: %d-%d ダメージ", "Attack: %d-%d damage"), mindam, maxdam);
2331 /* Print the damage */
2332 put_str(tmp_str, r, c + 8);
2337 * @brief 武器一つ毎のダメージ情報を表示する。
2338 * @param o_ptr オブジェクトの構造体の参照ポインタ。
2339 * @param col 表示する行の上端
2342 * Show the damage figures for the various monster types\n
2344 * Only accurate for the current weapon, because it includes\n
2345 * the current number of blows for the player.\n
2348 static void compare_weapon_aux(object_type *o_ptr, int col, int r)
2350 BIT_FLAGS flgs[TR_FLAG_SIZE];
2351 int blow = p_ptr->num_blow[0];
2353 bool dokubari = FALSE;
2355 /* Effective dices */
2356 int eff_dd = o_ptr->dd + p_ptr->to_dd[0];
2357 int eff_ds = o_ptr->ds + p_ptr->to_ds[0];
2359 int mindice = eff_dd;
2360 int maxdice = eff_ds * eff_dd;
2363 int vorpal_mult = 1;
2365 int dmg_bonus = o_ptr->to_d + p_ptr->to_d[0];
2368 /* Get the flags of the weapon */
2369 object_flags(o_ptr, flgs);
2371 if((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) dokubari = TRUE;
2374 /* Show Critical Damage*/
2375 mindam = calc_expect_crit(o_ptr->weight, o_ptr->to_h, mindice, p_ptr->to_h[0], dokubari);
2376 maxdam = calc_expect_crit(o_ptr->weight, o_ptr->to_h, maxdice, p_ptr->to_h[0], dokubari);
2378 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("会心:", "Critical:"), TERM_L_RED);
2382 if ((have_flag(flgs, TR_VORPAL) || hex_spelling(HEX_RUNESWORD)))
2384 if((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD))
2395 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);
2396 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);
2397 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("切れ味:", "Vorpal:") , TERM_L_RED);
2400 if ((p_ptr->pclass != CLASS_SAMURAI) && have_flag(flgs, TR_FORCE_WEAPON) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
2404 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);
2405 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);
2406 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("理力:", "Force :"), TERM_L_BLUE);
2409 /* Print the relevant lines */
2410 if (have_flag(flgs, TR_KILL_ANIMAL))
2412 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);
2413 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);
2414 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("動物:", "Animals:"), TERM_YELLOW);
2416 else if (have_flag(flgs, TR_SLAY_ANIMAL))
2418 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);
2419 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);
2420 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("動物:", "Animals:"), TERM_YELLOW);
2422 if (have_flag(flgs, TR_KILL_EVIL))
2424 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);
2425 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);
2426 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("邪悪:", "Evil:"), TERM_YELLOW);
2428 else if (have_flag(flgs, TR_SLAY_EVIL))
2430 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);
2431 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);
2432 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("邪悪:", "Evil:"), TERM_YELLOW);
2434 if (have_flag(flgs, TR_KILL_HUMAN))
2436 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);
2437 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);
2438 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("人間:", "Human:"), TERM_YELLOW);
2440 else if (have_flag(flgs, TR_SLAY_HUMAN))
2442 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);
2443 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);
2444 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("人間:", "Human:"), TERM_YELLOW);
2446 if (have_flag(flgs, TR_KILL_UNDEAD))
2448 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);
2449 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);
2450 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("不死:", "Undead:"), TERM_YELLOW);
2452 else if (have_flag(flgs, TR_SLAY_UNDEAD))
2454 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);
2455 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);
2456 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("不死:", "Undead:"), TERM_YELLOW);
2458 if (have_flag(flgs, TR_KILL_DEMON))
2460 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);
2461 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);
2462 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("悪魔:", "Demons:") , TERM_YELLOW);
2464 else if (have_flag(flgs, TR_SLAY_DEMON))
2466 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);
2467 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);
2468 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("悪魔:", "Demons:") , TERM_YELLOW);
2470 if (have_flag(flgs, TR_KILL_ORC))
2472 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);
2473 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);
2474 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("オーク:", "Orcs:"), TERM_YELLOW);
2476 else if (have_flag(flgs, TR_SLAY_ORC))
2478 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);
2479 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);
2480 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("オーク:", "Orcs:"), TERM_YELLOW);
2482 if (have_flag(flgs, TR_KILL_TROLL))
2484 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);
2485 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);
2486 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("トロル:", "Trolls:") , TERM_YELLOW);
2488 else if (have_flag(flgs, TR_SLAY_TROLL))
2490 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);
2491 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);
2492 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("トロル:", "Trolls:") , TERM_YELLOW);
2494 if (have_flag(flgs, TR_KILL_GIANT))
2496 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);
2497 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);
2498 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("巨人:", "Giants:"), TERM_YELLOW);
2500 else if (have_flag(flgs, TR_SLAY_GIANT))
2502 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);
2503 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);
2504 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("巨人:", "Giants:"), TERM_YELLOW);
2506 if (have_flag(flgs, TR_KILL_DRAGON))
2508 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);
2509 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);
2510 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("竜:", "Dragons:"), TERM_YELLOW);
2512 else if (have_flag(flgs, TR_SLAY_DRAGON))
2514 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);
2515 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);
2516 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("竜:", "Dragons:"), TERM_YELLOW);
2518 if (have_flag(flgs, TR_BRAND_ACID))
2520 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);
2521 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);
2522 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("酸属性:", "Acid:"), TERM_RED);
2524 if (have_flag(flgs, TR_BRAND_ELEC))
2526 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);
2527 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);
2528 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("電属性:", "Elec:"), TERM_RED);
2530 if (have_flag(flgs, TR_BRAND_FIRE))
2532 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);
2533 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);
2534 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("炎属性:", "Fire:"), TERM_RED);
2536 if (have_flag(flgs, TR_BRAND_COLD))
2538 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);
2539 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);
2540 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("冷属性:", "Cold:"), TERM_RED);
2542 if (have_flag(flgs, TR_BRAND_POIS))
2544 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);
2545 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);
2546 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("毒属性:", "Poison:"), TERM_RED);
2551 * @brief 武器匠における武器一つ毎の完全情報を表示する。
2552 * @param o_ptr オブジェクトの構造体の参照ポインタ。
2553 * @param row 表示する列の左端
2554 * @param col 表示する行の上端
2556 * Displays all info about a weapon
2558 * Only accurate for the current weapon, because it includes
2559 * various info about the player's +to_dam and number of blows.
2562 static void list_weapon(object_type *o_ptr, TERM_LEN row, TERM_LEN col)
2564 GAME_TEXT o_name[MAX_NLEN];
2565 GAME_TEXT tmp_str[80];
2567 DICE_NUMBER eff_dd = o_ptr->dd + p_ptr->to_dd[0];
2568 DICE_SID eff_ds = o_ptr->ds + p_ptr->to_ds[0];
2569 HIT_RELIABILITY reli = p_ptr->skill_thn + (p_ptr->to_h[0] + o_ptr->to_h) * BTH_PLUS_ADJ;
2571 /* Print the weapon name */
2572 object_desc(o_name, o_ptr, OD_NAME_ONLY);
2573 c_put_str(TERM_YELLOW, o_name, row, col);
2575 /* Print the player's number of blows */
2576 sprintf(tmp_str, _("攻撃回数: %d", "Number of Blows: %d"), p_ptr->num_blow[0]);
2577 put_str(tmp_str, row+1, col);
2579 /* Print to_hit and to_dam of the weapon */
2580 sprintf(tmp_str, _("命中率: 0 50 100 150 200 (敵のAC)", "To Hit: 0 50 100 150 200 (AC)"));
2581 put_str(tmp_str, row+2, col);
2583 /* Print the weapons base damage dice */
2584 sprintf(tmp_str, " %2d %2d %2d %2d %2d (%%)",
2585 (int)hit_chance(reli, 0),
2586 (int)hit_chance(reli, 50),
2587 (int)hit_chance(reli, 100),
2588 (int)hit_chance(reli, 150),
2589 (int)hit_chance(reli, 200));
2590 put_str(tmp_str, row+3, col);
2591 c_put_str(TERM_YELLOW, _("可能なダメージ:", "Possible Damage:"), row+5, col);
2593 /* Damage for one blow (if it hits) */
2594 sprintf(tmp_str, _("攻撃一回につき %d-%d", "One Strike: %d-%d damage"),
2595 (int)(eff_dd + o_ptr->to_d + p_ptr->to_d[0]),
2596 (int)(eff_ds * eff_dd + o_ptr->to_d + p_ptr->to_d[0]));
2597 put_str(tmp_str, row+6, col+1);
2599 /* Damage for the complete attack (if all blows hit) */
2600 sprintf(tmp_str, _("1ターンにつき %d-%d", "One Attack: %d-%d damage"),
2601 (int)(p_ptr->num_blow[0] * (eff_dd + o_ptr->to_d + p_ptr->to_d[0])),
2602 (int)(p_ptr->num_blow[0] * (eff_ds * eff_dd + o_ptr->to_d + p_ptr->to_d[0])));
2603 put_str(tmp_str, row+7, col+1);
2607 * @brief 武器匠鑑定1回分(オブジェクト2種)の処理。/ Compare weapons
2609 * Copies the weapons to compare into the weapon-slot and\n
2610 * compares the values for both weapons.\n
2611 * 武器1つだけで比較をしないなら費用は半額になる。
2612 * @param bcost 基本鑑定費用
2613 * @return 最終的にかかった費用
2615 static PRICE compare_weapons(PRICE bcost)
2618 OBJECT_IDX item, item2;
2619 object_type *o_ptr[2];
2620 object_type orig_weapon;
2624 TERM_LEN wid = 38, mgn = 2;
2625 bool old_character_xtra = character_xtra;
2628 PRICE cost = 0; /* First time no price */
2633 /* Store copy of original wielded weapon */
2634 i_ptr = &inventory[INVEN_RARM];
2635 object_copy(&orig_weapon, i_ptr);
2637 item_tester_hook = item_tester_hook_orthodox_melee_weapons;
2639 /* Get the first weapon */
2640 q = _("第一の武器は?", "What is your first weapon? ");
2641 s = _("比べるものがありません。", "You have nothing to compare.");
2643 o_ptr[0] = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT));
2657 /* Only compare melee weapons */
2658 item_tester_hook = item_tester_hook_orthodox_melee_weapons;
2660 /* Hack -- prevent "icky" message */
2661 character_xtra = TRUE;
2663 /* Diaplay selected weapon's infomation */
2664 for (i = 0; i < n; i++)
2666 int col = (wid * i + mgn);
2668 /* Copy i-th weapon into the weapon slot (if it's not already there) */
2669 if (o_ptr[i] != i_ptr) object_copy(i_ptr, o_ptr[i]);
2671 p_ptr->update |= PU_BONUS;
2674 /* List the new values */
2675 list_weapon(o_ptr[i], row, col);
2676 compare_weapon_aux(o_ptr[i], col, row + 8);
2678 /* Copy back the original weapon into the weapon slot */
2679 object_copy(i_ptr, &orig_weapon);
2682 /* Reset the values for the old weapon */
2683 p_ptr->update |= PU_BONUS;
2686 character_xtra = old_character_xtra;
2689 put_str(format("[ 比較対象: 's'で変更 ($%d) ]", cost), 1, (wid + mgn));
2690 put_str("(一番高いダメージが適用されます。複数の倍打効果は足し算されません。)", row + 4, 0);
2691 prt("現在の技量から判断すると、あなたの武器は以下のような威力を発揮します:", 0, 0);
2693 put_str(format("[ 's' Select secondary weapon($%d) ]", cost), row + 1, (wid * i + mgn));
2694 put_str("(Only highest damage applies per monster. Special damage not cumulative.)", row + 4, 0);
2695 prt("Based on your current abilities, here is what your weapons will do", 0, 0);
2703 if (total + cost > p_ptr->au)
2705 msg_print(_("お金が足りません!", "You don't have enough money!"));
2710 q = _("第二の武器は?", "What is your second weapon? ");
2711 s = _("比べるものがありません。", "You have nothing to compare.");
2713 /* Get the second weapon */
2714 o_ptr[1] = choose_object(&item2, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT));
2715 if (!o_ptr[1]) continue;
2733 * @brief ACから回避率、ダメージ減少率を計算し表示する。 / Evaluate AC
2735 * Calculate and display the dodge-rate and the protection-rate
2737 * @param iAC プレイヤーのAC。
2738 * @return 常にTRUEを返す。
2740 static bool eval_ac(ARMOUR_CLASS iAC)
2744 "ダメージ軽減率とは、敵の攻撃が当たった時そのダメージを\n"
2745 "何パーセント軽減するかを示します。\n"
2746 "ダメージ軽減は通常の直接攻撃(種類が「攻撃する」と「粉砕する」の物)\n"
2747 "に対してのみ効果があります。\n \n"
2748 "敵のレベルとは、その敵が通常何階に現れるかを示します。\n \n"
2749 "回避率は敵の直接攻撃を何パーセントの確率で避けるかを示し、\n"
2750 "敵のレベルとあなたのACによって決定されます。\n \n"
2751 "ダメージ期待値とは、敵の100ポイントの通常攻撃に対し、\n"
2752 "回避率とダメージ軽減率を考慮したダメージの期待値を示します。\n";
2755 "'Protection Rate' means how much damage is reduced by your armor.\n"
2756 "Note that the Protection rate is effective only against normal "
2757 "'attack' and 'shatter' type melee attacks, "
2758 "and has no effect against any other types such as 'poison'.\n \n"
2759 "'Dodge Rate' indicates the success rate on dodging the "
2760 "monster's melee attacks. "
2761 "It is depend on the level of the monster and your AC.\n \n"
2762 "'Average Damage' indicates the expected amount of damage "
2763 "when you are attacked by normal melee attacks with power=100.";
2767 TERM_LEN col, row = 2;
2769 char buf[80*20], *t;
2771 /* AC lower than zero has no effect */
2772 if (iAC < 0) iAC = 0;
2775 protection = 100 * MIN(iAC, 150) / 250;
2780 put_str(format(_("あなたの現在のAC: %3d", "Your current AC : %3d"), iAC), row++, 0);
2781 put_str(format(_("ダメージ軽減率 : %3d%%", "Protection rate : %3d%%"), protection), row++, 0);
2784 put_str(_("敵のレベル :", "Level of Monster:"), row + 0, 0);
2785 put_str(_("回避率 :", "Dodge Rate :"), row + 1, 0);
2786 put_str(_("ダメージ期待値 :", "Average Damage :"), row + 2, 0);
2788 for (col = 17 + 1, lvl = 0; lvl <= 100; lvl += 10, col += 5)
2790 int quality = 60 + lvl * 3; /* attack quality with power 60 */
2791 int dodge; /* 回避率(%) */
2792 int average; /* ダメージ期待値 */
2794 put_str(format("%3d", lvl), row + 0, col);
2797 dodge = 5 + (MIN(100, 100 * (iAC * 3 / 4) / quality) * 9 + 5) / 10;
2798 put_str(format("%3d%%", dodge), row + 1, col);
2800 /* 100点の攻撃に対してのダメージ期待値を計算 */
2801 average = (100 - dodge) * (100 - protection) / 100;
2802 put_str(format("%3d", average), row + 2, col);
2806 roff_to_buf(memo, 70, buf, sizeof(buf));
2807 for (t = buf; t[0]; t += strlen(t) + 1)
2808 put_str(t, (row++) + 4, 4);
2810 prt(_("現在のあなたの装備からすると、あなたの防御力はこれくらいです:", "Defense abilities from your current Armor Class are evaluated below."), 0, 0);
2822 * @brief 修復材料のオブジェクトから修復対象に特性を移植する。
2823 * @param to_ptr 修復対象オブジェクトの構造体の参照ポインタ。
2824 * @param from_ptr 修復材料オブジェクトの構造体の参照ポインタ。
2825 * @return 修復対象になるならTRUEを返す。
2827 static void give_one_ability_of_object(object_type *to_ptr, object_type *from_ptr)
2830 int cand[TR_FLAG_MAX];
2831 BIT_FLAGS to_flgs[TR_FLAG_SIZE];
2832 BIT_FLAGS from_flgs[TR_FLAG_SIZE];
2834 object_flags(to_ptr, to_flgs);
2835 object_flags(from_ptr, from_flgs);
2837 for (i = 0; i < TR_FLAG_MAX; i++)
2841 case TR_IGNORE_ACID:
2842 case TR_IGNORE_ELEC:
2843 case TR_IGNORE_FIRE:
2844 case TR_IGNORE_COLD:
2853 case TR_FIXED_FLAVOR:
2856 if (have_flag(from_flgs, i) && !have_flag(to_flgs, i))
2858 if (!(is_pval_flag(i) && (from_ptr->pval < 1))) cand[n++] = i;
2866 int tr_idx = cand[randint0(n)];
2867 add_flag(to_ptr->art_flags, tr_idx);
2868 if (is_pval_flag(tr_idx)) to_ptr->pval = MAX(to_ptr->pval, 1);
2869 bmax = MIN(3, MAX(1, 40 / (to_ptr->dd * to_ptr->ds)));
2870 if (tr_idx == TR_BLOWS) to_ptr->pval = MIN(to_ptr->pval, bmax);
2871 if (tr_idx == TR_SPEED) to_ptr->pval = MIN(to_ptr->pval, 4);
2878 * @brief アイテム修復処理のメインルーチン / Repair broken weapon
2879 * @param bcost 基本修復費用
2882 static PRICE repair_broken_weapon_aux(PRICE bcost)
2885 OBJECT_IDX item, mater;
2886 object_type *o_ptr, *mo_ptr; /* broken weapon and material weapon */
2888 int i, dd_bonus, ds_bonus;
2889 KIND_OBJECT_IDX k_idx;
2890 char basenm[MAX_NLEN];
2895 prt(_("修復には材料となるもう1つの武器が必要です。", "Hand one material weapon to repair a broken weapon."), row, 2);
2896 prt(_("材料に使用した武器はなくなります!", "The material weapon will disappear after repairing!!"), row+1, 2);
2898 q = _("どの折れた武器を修復しますか?", "Repair which broken weapon? ");
2899 s = _("修復できる折れた武器がありません。", "You have no broken weapon to repair.");
2901 /* Only forge broken weapons */
2902 item_tester_hook = item_tester_hook_broken_weapon;
2904 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP));
2905 if (!o_ptr) return (0);
2907 /* It is worthless */
2908 if (!object_is_ego(o_ptr) && !object_is_artifact(o_ptr))
2910 msg_format(_("それは直してもしょうがないぜ。", "It is worthless to repair."));
2914 /* They are too many */
2915 if (o_ptr->number > 1)
2917 msg_format(_("一度に複数を修復することはできません!", "They are too many to repair at once!"));
2921 /* Display item name */
2922 object_desc(basenm, o_ptr, OD_NAME_ONLY);
2923 prt(format(_("修復する武器 : %s", "Repairing: %s"), basenm), row+3, 2);
2925 q = _("材料となる武器は?", "Which weapon for material? ");
2926 s = _("材料となる武器がありません。", "You have no material to repair.");
2928 /* Only forge broken weapons */
2929 item_tester_hook = item_tester_hook_orthodox_melee_weapons;
2931 mo_ptr = choose_object(&mater, q, s, (USE_INVEN | USE_EQUIP));
2932 if (!mo_ptr) return (0);
2935 msg_print(_("クラインの壷じゃない!", "This is not a klein bottle!"));
2939 /* Display item name */
2940 object_desc(basenm, mo_ptr, OD_NAME_ONLY);
2941 prt(format(_("材料とする武器: %s", "Material : %s"), basenm), row+4, 2);
2943 /* Get the value of one of the items (except curses) */
2944 cost = bcost + object_value_real(o_ptr) * 2;
2946 if (!get_check(format(_("$%dかかりますがよろしいですか? ", "Costs %d gold, okay? "), cost))) return (0);
2948 /* Check if the player has enough money */
2949 if (p_ptr->au < cost)
2951 object_desc(basenm, o_ptr, OD_NAME_ONLY);
2952 msg_format(_("%sを修復するだけのゴールドがありません!", "You do not have the gold to repair %s!"), basenm);
2957 p_ptr->total_weight -= o_ptr->weight;
2959 if (o_ptr->sval == SV_BROKEN_DAGGER)
2964 /* Suppress compiler warning */
2967 for (j = 1; j < max_k_idx; j++)
2969 object_kind *k_aux_ptr = &k_info[j];
2971 if (k_aux_ptr->tval != TV_SWORD) continue;
2972 if ((k_aux_ptr->sval == SV_BROKEN_DAGGER) ||
2973 (k_aux_ptr->sval == SV_BROKEN_SWORD) ||
2974 (k_aux_ptr->sval == SV_DOKUBARI)) continue;
2975 if (k_aux_ptr->weight > 99) continue;
2984 else /* TV_BROKEN_SWORD */
2986 /* Repair to a sword or sometimes material's type weapon */
2987 OBJECT_TYPE_VALUE tval = (one_in_(5) ? mo_ptr->tval : TV_SWORD);
2991 object_kind *ck_ptr;
2993 k_idx = lookup_kind(tval, SV_ANY);
2994 ck_ptr = &k_info[k_idx];
2996 if (tval == TV_SWORD)
2998 if ((ck_ptr->sval == SV_BROKEN_DAGGER) ||
2999 (ck_ptr->sval == SV_BROKEN_SWORD) ||
3000 (ck_ptr->sval == SV_DIAMOND_EDGE) ||
3001 (ck_ptr->sval == SV_DOKUBARI)) continue;
3003 if (tval == TV_POLEARM)
3005 if ((ck_ptr->sval == SV_DEATH_SCYTHE) ||
3006 (ck_ptr->sval == SV_TSURIZAO)) continue;
3008 if (tval == TV_HAFTED)
3010 if ((ck_ptr->sval == SV_GROND) ||
3011 (ck_ptr->sval == SV_WIZSTAFF) ||
3012 (ck_ptr->sval == SV_NAMAKE_HAMMER)) continue;
3019 /* Calculate dice bonuses */
3020 dd_bonus = o_ptr->dd - k_info[o_ptr->k_idx].dd;
3021 ds_bonus = o_ptr->ds - k_info[o_ptr->k_idx].ds;
3022 dd_bonus += mo_ptr->dd - k_info[mo_ptr->k_idx].dd;
3023 ds_bonus += mo_ptr->ds - k_info[mo_ptr->k_idx].ds;
3025 /* Change base object */
3026 k_ptr = &k_info[k_idx];
3027 o_ptr->k_idx = k_idx;
3028 o_ptr->weight = k_ptr->weight;
3029 o_ptr->tval = k_ptr->tval;
3030 o_ptr->sval = k_ptr->sval;
3031 o_ptr->dd = k_ptr->dd;
3032 o_ptr->ds = k_ptr->ds;
3034 /* Copy base object's ability */
3035 for (i = 0; i < TR_FLAG_SIZE; i++) o_ptr->art_flags[i] |= k_ptr->flags[i];
3036 if (k_ptr->pval) o_ptr->pval = MAX(o_ptr->pval, randint1(k_ptr->pval));
3037 if (have_flag(k_ptr->flags, TR_ACTIVATE)) o_ptr->xtra2 = (byte_hack)k_ptr->act_idx;
3043 for (i = 1; i < dd_bonus; i++)
3045 if (one_in_(o_ptr->dd + i)) o_ptr->dd++;
3051 for (i = 1; i < ds_bonus; i++)
3053 if (one_in_(o_ptr->ds + i)) o_ptr->ds++;
3057 if (have_flag(k_ptr->flags, TR_BLOWS))
3059 int bmax = MIN(3, MAX(1, 40 / (o_ptr->dd * o_ptr->ds)));
3060 o_ptr->pval = MIN(o_ptr->pval, bmax);
3063 /* Add one random ability from material weapon */
3064 give_one_ability_of_object(o_ptr, mo_ptr);
3066 /* Add to-dam, to-hit and to-ac from material weapon */
3067 o_ptr->to_d += MAX(0, (mo_ptr->to_d / 3));
3068 o_ptr->to_h += MAX(0, (mo_ptr->to_h / 3));
3069 o_ptr->to_a += MAX(0, (mo_ptr->to_a));
3071 if ((o_ptr->name1 == ART_NARSIL) ||
3072 (object_is_random_artifact(o_ptr) && one_in_(1)) ||
3073 (object_is_ego(o_ptr) && one_in_(7)))
3076 if (object_is_ego(o_ptr))
3078 add_flag(o_ptr->art_flags, TR_IGNORE_FIRE);
3079 add_flag(o_ptr->art_flags, TR_IGNORE_ACID);
3082 /* Add one random ability from material weapon */
3083 give_one_ability_of_object(o_ptr, mo_ptr);
3085 /* Add one random activation */
3086 if (!activation_index(o_ptr)) one_activation(o_ptr);
3089 if (o_ptr->name1 == ART_NARSIL)
3091 one_high_resistance(o_ptr);
3095 msg_print(_("これはかなりの業物だったようだ。", "This blade seems to be exceptionally."));
3098 object_desc(basenm, o_ptr, OD_NAME_ONLY);
3100 msg_format("$%dで%sに修復しました。", cost, basenm);
3102 msg_format("Repaired into %s for %d gold.", basenm, cost);
3106 /* Remove BROKEN flag */
3107 o_ptr->ident &= ~(IDENT_BROKEN);
3109 /* Add repaired flag */
3110 o_ptr->discount = 99;
3112 p_ptr->total_weight += o_ptr->weight;
3115 /* Decrease material object */
3116 inven_item_increase(mater, -1);
3117 inven_item_optimize(mater);
3120 p_ptr->update |= PU_BONUS;
3123 /* Something happened */
3128 * @brief アイテム修復処理の過渡ルーチン / Repair broken weapon
3129 * @param bcost 基本鑑定費用
3132 static int repair_broken_weapon(PRICE bcost)
3136 cost = repair_broken_weapon_aux(bcost);
3143 * @brief アイテムの強化を行う。 / Enchant item
3144 * @param cost 1回毎の費用
3145 * @param to_hit 命中をアップさせる量
3146 * @param to_dam ダメージをアップさせる量
3147 * @param to_ac ACをアップさせる量
3148 * @return 実際に行ったらTRUE
3150 static bool enchant_item(PRICE cost, HIT_PROB to_hit, HIT_POINT to_dam, ARMOUR_CLASS to_ac)
3157 int maxenchant = (p_ptr->lev / 5);
3158 char tmp_str[MAX_NLEN];
3161 prt(format(_("現在のあなたの技量だと、+%d まで改良できます。", " Based on your skill, we can improve up to +%d."), maxenchant), 5, 0);
3162 prt(format(_(" 改良の料金は一個につき$%d です。", " The price for the service is %d gold per item."), cost), 7, 0);
3164 q = _("どのアイテムを改良しますか?", "Improve which item? ");
3165 s = _("改良できるものがありません。", "You have nothing to improve.");
3167 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP | IGNORE_BOTHHAND_SLOT));
3168 if (!o_ptr) return (FALSE);
3170 /* Check if the player has enough money */
3171 if (p_ptr->au < (cost * o_ptr->number))
3173 object_desc(tmp_str, o_ptr, OD_NAME_ONLY);
3174 msg_format(_("%sを改良するだけのゴールドがありません!", "You do not have the gold to improve %s!"), tmp_str);
3178 /* Enchant to hit */
3179 for (i = 0; i < to_hit; i++)
3181 if (o_ptr->to_h < maxenchant)
3183 if (enchant(o_ptr, 1, (ENCH_TOHIT | ENCH_FORCE)))
3191 /* Enchant to damage */
3192 for (i = 0; i < to_dam; i++)
3194 if (o_ptr->to_d < maxenchant)
3196 if (enchant(o_ptr, 1, (ENCH_TODAM | ENCH_FORCE)))
3205 for (i = 0; i < to_ac; i++)
3207 if (o_ptr->to_a < maxenchant)
3209 if (enchant(o_ptr, 1, (ENCH_TOAC | ENCH_FORCE)))
3220 if (flush_failure) flush();
3221 msg_print(_("改良に失敗した。", "The improvement failed."));
3226 object_desc(tmp_str, o_ptr, OD_NAME_AND_ENCHANT);
3228 msg_format("$%dで%sに改良しました。", cost * o_ptr->number, tmp_str);
3230 msg_format("Improved into %s for %d gold.", tmp_str, cost * o_ptr->number);
3233 /* Charge the money */
3234 p_ptr->au -= (cost * o_ptr->number);
3236 if (item >= INVEN_RARM) calc_android_exp();
3238 /* Something happened */
3245 * @brief 魔道具の使用回数を回復させる施設のメインルーチン / Recharge rods, wands and staves
3247 * The player can select the number of charges to add\n
3248 * (up to a limit), and the recharge never fails.\n
3250 * The cost for rods depends on the level of the rod. The prices\n
3251 * for recharging wands and staves are dependent on the cost of\n
3255 static void building_recharge(void)
3263 PARAMETER_VALUE charges;
3265 char tmp_str[MAX_NLEN];
3269 /* Display some info */
3271 prt(_(" 再充填の費用はアイテムの種類によります。", " The prices of recharge depend on the type."), 6, 0);
3274 /* Only accept legal items */
3275 item_tester_hook = item_tester_hook_recharge;
3277 q = _("どのアイテムに魔力を充填しますか? ", "Recharge which item? ");
3278 s = _("魔力を充填すべきアイテムがない。", "You have nothing to recharge.");
3280 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
3283 k_ptr = &k_info[o_ptr->k_idx];
3286 * We don't want to give the player free info about
3287 * the level of the item or the number of charges.
3289 /* The item must be "known" */
3290 if (!object_is_known(o_ptr))
3292 msg_format(_("充填する前に鑑定されている必要があります!", "The item must be identified first!"));
3295 if ((p_ptr->au >= 50) &&
3296 get_check(_("$50で鑑定しますか? ", "Identify for 50 gold? ")))
3300 identify_item(o_ptr);
3301 object_desc(tmp_str, o_ptr, 0);
3302 msg_format(_("%s です。", "You have: %s."), tmp_str);
3304 /* Auto-inscription */
3305 autopick_alter_item(item, FALSE);
3307 /* Update the gold display */
3308 building_prt_gold();
3316 /* Extract the object "level" */
3317 lev = k_info[o_ptr->k_idx].level;
3319 /* Price for a rod */
3320 if (o_ptr->tval == TV_ROD)
3322 if (o_ptr->timeout > 0)
3324 /* Fully recharge */
3325 price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
3329 /* No recharge necessary */
3331 msg_format(_("それは再充填する必要はありません。", "That doesn't need to be recharged."));
3335 else if (o_ptr->tval == TV_STAFF)
3337 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3338 price = (k_info[o_ptr->k_idx].cost / 10) * o_ptr->number;
3340 /* Pay at least 10 gold per charge */
3341 price = MAX(10, price);
3345 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3346 price = (k_info[o_ptr->k_idx].cost / 10);
3348 /* Pay at least 10 gold per charge */
3349 price = MAX(10, price);
3352 /* Limit the number of charges for wands and staffs */
3353 if (o_ptr->tval == TV_WAND
3354 && (o_ptr->pval / o_ptr->number >= k_ptr->pval))
3356 if (o_ptr->number > 1)
3358 msg_print(_("この魔法棒はもう充分に充填されています。", "These wands are already fully charged."));
3362 msg_print(_("この魔法棒はもう充分に充填されています。", "This wand is already fully charged."));
3366 else if (o_ptr->tval == TV_STAFF && o_ptr->pval >= k_ptr->pval)
3368 if (o_ptr->number > 1)
3370 msg_print(_("この杖はもう充分に充填されています。", "These staffs are already fully charged."));
3374 msg_print(_("この杖はもう充分に充填されています。", "This staff is already fully charged."));
3379 /* Check if the player has enough money */
3380 if (p_ptr->au < price)
3382 object_desc(tmp_str, o_ptr, OD_NAME_ONLY);
3384 msg_format("%sを再充填するには$%d 必要です!", tmp_str,price );
3386 msg_format("You need %d gold to recharge %s!", price, tmp_str);
3392 if (o_ptr->tval == TV_ROD)
3395 if (get_check(format("そのロッドを$%d で再充填しますか?", price)))
3397 if (get_check(format("Recharge the %s for %d gold? ",
3398 ((o_ptr->number > 1) ? "rods" : "rod"), price)))
3402 /* Recharge fully */
3412 if (o_ptr->tval == TV_STAFF)
3413 max_charges = k_ptr->pval - o_ptr->pval;
3415 max_charges = o_ptr->number * k_ptr->pval - o_ptr->pval;
3417 /* Get the quantity for staves and wands */
3418 charges = (PARAMETER_VALUE)get_quantity(format(_("一回分$%d で何回分充填しますか?", "Add how many charges for %d gold? "), price),
3419 MIN(p_ptr->au / price, max_charges));
3422 if (charges < 1) return;
3424 /* Get the new price */
3428 o_ptr->pval += charges;
3430 /* We no longer think the item is empty */
3431 o_ptr->ident &= ~(IDENT_EMPTY);
3435 object_desc(tmp_str, o_ptr, 0);
3437 msg_format("%sを$%d で再充填しました。", tmp_str, price);
3439 msg_format("%^s %s recharged for %d gold.", tmp_str, ((o_ptr->number > 1) ? "were" : "was"), price);
3441 p_ptr->update |= (PU_COMBINE | PU_REORDER);
3443 p_ptr->window |= (PW_INVEN);
3454 * @brief 魔道具の使用回数を回復させる施設の一括処理向けサブルーチン / Recharge rods, wands and staves
3456 * The player can select the number of charges to add\n
3457 * (up to a limit), and the recharge never fails.\n
3459 * The cost for rods depends on the level of the rod. The prices\n
3460 * for recharging wands and staves are dependent on the cost of\n
3464 static void building_recharge_all(void)
3471 PRICE total_cost = 0;
3474 /* Display some info */
3477 prt(_(" 再充填の費用はアイテムの種類によります。", " The prices of recharge depend on the type."), 6, 0);
3479 /* Calculate cost */
3480 for ( i = 0; i < INVEN_PACK; i++)
3482 o_ptr = &inventory[i];
3484 /* skip non magic device */
3485 if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
3487 /* need identified */
3488 if (!object_is_known(o_ptr)) total_cost += 50;
3490 /* Extract the object "level" */
3491 lev = k_info[o_ptr->k_idx].level;
3493 k_ptr = &k_info[o_ptr->k_idx];
3495 switch (o_ptr->tval)
3498 price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
3502 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3503 price = (k_info[o_ptr->k_idx].cost / 10) * o_ptr->number;
3505 /* Pay at least 10 gold per charge */
3506 price = MAX(10, price);
3509 price = (k_ptr->pval - o_ptr->pval) * price;
3513 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3514 price = (k_info[o_ptr->k_idx].cost / 10);
3516 /* Pay at least 10 gold per charge */
3517 price = MAX(10, price);
3520 price = (o_ptr->number * k_ptr->pval - o_ptr->pval) * price;
3524 /* if price <= 0 then item have enough charge */
3525 if (price > 0) total_cost += price;
3530 msg_print(_("充填する必要はありません。", "No need to recharge."));
3535 /* Check if the player has enough money */
3536 if (p_ptr->au < total_cost)
3538 msg_format(_("すべてのアイテムを再充填するには$%d 必要です!", "You need %d gold to recharge all items!"), total_cost );
3542 if (!get_check(format(_("すべてのアイテムを $%d で再充填しますか?", "Recharge all items for %d gold? "), total_cost))) return;
3544 for (i = 0; i < INVEN_PACK; i++)
3546 o_ptr = &inventory[i];
3547 k_ptr = &k_info[o_ptr->k_idx];
3549 /* skip non magic device */
3550 if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
3552 if (!object_is_known(o_ptr))
3554 identify_item(o_ptr);
3556 /* Auto-inscription */
3557 autopick_alter_item(i, FALSE);
3561 switch (o_ptr->tval)
3567 if (o_ptr->pval < k_ptr->pval) o_ptr->pval = k_ptr->pval;
3568 /* We no longer think the item is empty */
3569 o_ptr->ident &= ~(IDENT_EMPTY);
3572 if (o_ptr->pval < o_ptr->number * k_ptr->pval)
3573 o_ptr->pval = o_ptr->number * k_ptr->pval;
3574 /* We no longer think the item is empty */
3575 o_ptr->ident &= ~(IDENT_EMPTY);
3581 msg_format(_("$%d で再充填しました。", "You pay %d gold."), total_cost);
3583 p_ptr->update |= (PU_COMBINE | PU_REORDER);
3585 p_ptr->window |= (PW_INVEN);
3588 p_ptr->au -= total_cost;
3595 * @brief 町間のテレポートを行うメインルーチン。
3596 * @return テレポート処理を決定したか否か
3598 bool tele_town(void)
3604 if (current_floor_ptr->dun_level)
3606 msg_print(_("この魔法は地上でしか使えない!", "This spell can only be used on the surface!"));
3610 if (p_ptr->inside_arena || p_ptr->inside_battle)
3612 msg_print(_("この魔法は外でしか使えない!", "This spell can only be used outside!"));
3619 for (i = 1; i < max_towns; i++)
3623 if ((i == NO_TOWN) || (i == SECRET_TOWN) || (i == p_ptr->town_num) || !(p_ptr->visit & (1L << (i - 1)))) continue;
3625 sprintf(buf, "%c) %-20s", I2A(i - 1), town_info[i].name);
3632 msg_print(_("まだ行けるところがない。", "You have not yet visited any town."));
3638 prt(_("どこに行きますか:", "Which town you go: "), 0, 0);
3648 else if ((i < 'a') || (i > ('a'+max_towns-2))) continue;
3649 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;
3653 for (y = 0; y < current_world_ptr->max_wild_y; y++)
3655 for (x = 0; x < current_world_ptr->max_wild_x; x++)
3657 if(wilderness[y][x].town == (i-'a'+1))
3659 p_ptr->wilderness_y = y;
3660 p_ptr->wilderness_x = x;
3665 p_ptr->leaving = TRUE;
3667 p_ptr->teleport_town = TRUE;
3673 * @brief 施設でモンスターの情報を知るメインルーチン / research_mon -KMW-
3674 * @return 常にTRUEを返す。
3675 * @todo 返り値が意味不明なので直した方が良いかもしれない。
3677 static bool research_mon(void)
3685 bool recall = FALSE;
3689 /* XTRA HACK WHATSEARCH */
3695 /* XTRA HACK REMEMBER_IDX */
3696 static int old_sym = '\0';
3697 static IDX old_i = 0;
3701 /* Get a character, or abort */
3702 if (!get_com(_("モンスターの文字を入力して下さい(記号 or ^A全,^Uユ,^N非ユ,^M名前):",
3703 "Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): "), &sym, FALSE))
3711 /* Find that character info, and describe it */
3712 for (i = 0; ident_info[i]; ++i)
3714 if (sym == ident_info[i][0]) break;
3717 /* XTRA HACK WHATSEARCH */
3718 if (sym == KTRL('A'))
3721 strcpy(buf, _("全モンスターのリスト", "Full monster list."));
3723 else if (sym == KTRL('U'))
3726 strcpy(buf, _("ユニーク・モンスターのリスト", "Unique monster list."));
3728 else if (sym == KTRL('N'))
3731 strcpy(buf, _("ユニーク外モンスターのリスト", "Non-unique monster list."));
3733 else if (sym == KTRL('M'))
3736 if (!get_string(_("名前(英語の場合小文字で可)", "Enter name:"),temp, 70))
3743 sprintf(buf, _("名前:%sにマッチ", "Monsters with a name \"%s\""),temp);
3745 else if (ident_info[i])
3747 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
3751 sprintf(buf, "%c - %s", sym, _("無効な文字", "Unknown Symbol"));
3754 /* Display the result */
3757 /* Allocate the "who" array */
3758 C_MAKE(who, max_r_idx, MONRACE_IDX);
3760 /* Collect matching monsters */
3761 for (n = 0, i = 1; i < max_r_idx; i++)
3763 monster_race *r_ptr = &r_info[i];
3766 if (!r_ptr->name) continue;
3768 /* XTRA HACK WHATSEARCH */
3769 /* Require non-unique monsters if needed */
3770 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
3772 /* Require unique monsters if needed */
3773 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
3781 for (xx = 0; temp[xx] && xx < 80; xx++)
3784 if (iskanji(temp[xx]))
3790 if (isupper(temp[xx])) temp[xx] = (char)tolower(temp[xx]);
3794 strcpy(temp2, r_name + r_ptr->E_name);
3796 strcpy(temp2, r_name + r_ptr->name);
3798 for (xx = 0; temp2[xx] && xx < 80; xx++)
3799 if (isupper(temp2[xx])) temp2[xx] = (char)tolower(temp2[xx]);
3802 if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
3804 if (my_strstr(temp2, temp))
3808 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
3811 /* Nothing to recall */
3814 /* Free the "who" array */
3815 C_KILL(who, max_r_idx, MONRACE_IDX);
3825 /* Sort if needed */
3828 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
3832 /* Start at the end */
3833 /* XTRA HACK REMEMBER_IDX */
3834 if (old_sym == sym && old_i < n) i = old_i;
3839 /* Scan the monster memory */
3842 /* Extract a race */
3845 /* Hack -- Begin the prompt */
3848 /* Hack -- Complete the prompt */
3849 Term_addstr(-1, TERM_WHITE, _(" ['r'思い出, ' 'で続行, ESC]", " [(r)ecall, ESC, space to continue]"));
3857 /*** Recall on screen ***/
3859 /* Get maximal info about this monster */
3860 lore_do_probe(r_idx);
3862 /* Save this monster ID */
3863 monster_race_track(r_idx);
3866 /* know every thing mode */
3867 screen_roff(r_idx, 0x01);
3870 /* XTRA HACK REMEMBER_IDX */
3878 /* Normal commands */
3879 if (query != 'r') break;
3886 if (query == ESCAPE) break;
3888 /* Move to "prev" monster */
3894 if (!expand_list) break;
3898 /* Move to "next" monster */
3904 if (!expand_list) break;
3910 /* Re-display the identity */
3911 /* prt(buf, 5, 5);*/
3913 /* Free the "who" array */
3914 C_KILL(who, max_r_idx, MONRACE_IDX);
3917 return (!notpicked);
3922 * @brief 施設の処理実行メインルーチン / Execute a building command
3923 * @param bldg 施設構造体の参照ポインタ
3924 * @param i 実行したい施設のサービステーブルの添字
3927 static void bldg_process_command(building_type *bldg, int i)
3929 BACT_IDX bact = bldg->actions[i];
3937 bcost = bldg->member_costs[i];
3939 bcost = bldg->other_costs[i];
3941 /* action restrictions */
3942 if (((bldg->action_restr[i] == 1) && !is_member(bldg)) ||
3943 ((bldg->action_restr[i] == 2) && !is_owner(bldg)))
3945 msg_print(_("それを選択する権利はありません!", "You have no right to choose that!"));
3949 /* check gold (HACK - Recharge uses variable costs) */
3950 if ((bact != BACT_RECHARGE) &&
3951 (((bldg->member_costs[i] > p_ptr->au) && is_owner(bldg)) ||
3952 ((bldg->other_costs[i] > p_ptr->au) && !is_owner(bldg))))
3954 msg_print(_("お金が足りません!", "You do not have the gold!"));
3963 case BACT_RESEARCH_ITEM:
3964 paid = identify_fully(FALSE);
3966 case BACT_TOWN_HISTORY:
3969 case BACT_RACE_LEGENDS:
3975 case BACT_KING_LEGENDS:
3976 case BACT_ARENA_LEGENDS:
3981 case BACT_ARENA_RULES:
3985 case BACT_IN_BETWEEN:
3987 case BACT_SPIN_WHEEL:
3988 case BACT_DICE_SLOTS:
3989 case BACT_GAMBLE_RULES:
3996 paid = inn_comm(bact);
3998 case BACT_RESEARCH_MONSTER:
3999 paid = research_mon();
4001 case BACT_COMPARE_WEAPONS:
4003 bcost = compare_weapons(bcost);
4005 case BACT_ENCHANT_WEAPON:
4006 item_tester_hook = object_allow_enchant_melee_weapon;
4007 enchant_item(bcost, 1, 1, 0);
4009 case BACT_ENCHANT_ARMOR:
4010 item_tester_hook = object_is_armour;
4011 enchant_item(bcost, 0, 0, 1);
4014 building_recharge();
4016 case BACT_RECHARGE_ALL:
4017 building_recharge_all();
4019 case BACT_IDENTS: /* needs work */
4020 if (!get_check(_("持ち物を全て鑑定してよろしいですか?", "Do you pay for identify all your possession? "))) break;
4022 msg_print(_(" 持ち物全てが鑑定されました。", "Your possessions have been identified."));
4025 case BACT_IDENT_ONE: /* needs work */
4026 paid = ident_spell(FALSE);
4031 case BACT_HEALING: /* needs work */
4032 paid = cure_critical_wounds(200);
4034 case BACT_RESTORE: /* needs work */
4035 paid = restore_all_status();
4037 case BACT_ENCHANT_ARROWS:
4038 item_tester_hook = item_tester_hook_ammo;
4039 enchant_item(bcost, 1, 1, 0);
4041 case BACT_ENCHANT_BOW:
4042 item_tester_tval = TV_BOW;
4043 enchant_item(bcost, 1, 1, 0);
4047 if (recall_player(p_ptr, 1)) paid = TRUE;
4050 case BACT_TELEPORT_LEVEL:
4052 paid = free_level_recall(p_ptr);
4055 case BACT_LOSE_MUTATION:
4056 if (p_ptr->muta1 || p_ptr->muta2 || (p_ptr->muta3 & ~MUT3_GOOD_LUCK) ||
4057 (p_ptr->pseikaku != SEIKAKU_LUCKY && (p_ptr->muta3 & MUT3_GOOD_LUCK)))
4059 while(!lose_mutation(0));
4064 msg_print(_("治すべき突然変異が無い。", "You have no mutations."));
4073 case BACT_TSUCHINOKO:
4090 msg_print(_("平衡化の儀式を行なった。", "You received an equalization ritual."));
4091 set_virtue(V_COMPASSION, 0);
4092 set_virtue(V_HONOUR, 0);
4093 set_virtue(V_JUSTICE, 0);
4094 set_virtue(V_SACRIFICE, 0);
4095 set_virtue(V_KNOWLEDGE, 0);
4096 set_virtue(V_FAITH, 0);
4097 set_virtue(V_ENLIGHTEN, 0);
4098 set_virtue(V_ENCHANT, 0);
4099 set_virtue(V_CHANCE, 0);
4100 set_virtue(V_NATURE, 0);
4101 set_virtue(V_HARMONY, 0);
4102 set_virtue(V_VITALITY, 0);
4103 set_virtue(V_UNLIFE, 0);
4104 set_virtue(V_PATIENCE, 0);
4105 set_virtue(V_TEMPERANCE, 0);
4106 set_virtue(V_DILIGENCE, 0);
4107 set_virtue(V_VALOUR, 0);
4108 set_virtue(V_INDIVIDUALISM, 0);
4113 case BACT_TELE_TOWN:
4118 paid = eval_ac(p_ptr->dis_ac + p_ptr->dis_to_a);
4121 case BACT_BROKEN_WEAPON:
4123 bcost = repair_broken_weapon(bcost);
4134 * @brief 施設入り口にプレイヤーが乗った際の処理 / Do building commands
4137 void do_cmd_bldg(void)
4142 building_type *bldg;
4144 if(p_ptr->wild_mode) return;
4146 take_turn(p_ptr, 100);
4148 if (!cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_BLDG))
4150 msg_print(_("ここには建物はない。", "You see no building here."));
4154 which = f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat].subtype;
4156 bldg = &building[which];
4158 /* Don't re-init the wilderness */
4159 reinit_wilderness = FALSE;
4161 if ((which == 2) && (p_ptr->arena_number < 0))
4163 msg_print(_("「敗者に用はない。」", "'There's no place here for a LOSER like you!'"));
4166 else if ((which == 2) && p_ptr->inside_arena)
4168 if (!p_ptr->exit_bldg && m_cnt > 0)
4170 prt(_("ゲートは閉まっている。モンスターがあなたを待っている!", "The gates are closed. The monster awaits!"), 0, 0);
4174 /* Don't save the arena as saved floor */
4175 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_NO_RETURN);
4177 p_ptr->inside_arena = FALSE;
4178 p_ptr->leaving = TRUE;
4180 /* Re-enter the arena */
4181 command_new = SPECIAL_KEY_BUILDING;
4183 /* No energy needed to re-enter the arena */
4189 else if (p_ptr->inside_battle)
4191 /* Don't save the arena as saved floor */
4192 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_NO_RETURN);
4194 p_ptr->leaving = TRUE;
4195 p_ptr->inside_battle = FALSE;
4197 /* Re-enter the monster arena */
4198 command_new = SPECIAL_KEY_BUILDING;
4200 /* No energy needed to re-enter the arena */
4207 p_ptr->oldpy = p_ptr->y;
4208 p_ptr->oldpx = p_ptr->x;
4214 /* Hack -- Increase "icky" depth */
4221 show_building(bldg);
4224 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_BUILD);
4231 building_prt_gold();
4235 if (command == ESCAPE)
4238 p_ptr->inside_arena = FALSE;
4239 p_ptr->inside_battle = FALSE;
4243 for (i = 0; i < 8; i++)
4245 if (bldg->letters[i])
4247 if (bldg->letters[i] == command)
4255 if(validcmd) bldg_process_command(bldg, i);
4260 select_floor_music();
4265 /* Reinit wilderness to activate quests ... */
4266 if (reinit_wilderness)
4268 p_ptr->leaving = TRUE;
4271 /* Hack -- Decrease "icky" depth */
4276 p_ptr->update |= (PU_VIEW | PU_MONSTERS | PU_BONUS | PU_LITE | PU_MON_LITE);
4277 p_ptr->redraw |= (PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
4278 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);